From: Andrea Bianco Date: Sat, 18 Dec 2021 18:19:35 +0000 (+0100) Subject: Built motion from commit 7158bc59.|2.5.42 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.openchannel?a=commitdiff_plain;h=72ea3df4a4598e1579bd2e82917e9bcf29217ba6;p=motion2.git Built motion from commit 7158bc59.|2.5.42 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4ba56c8..df8b900 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-17T12:25:08.747Z", + "time": "2021-12-18T18:00:38.089Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e6249dd..55c7a79 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-17T12:25:08.747Z", + "time": "2021-12-18T18:00:38.089Z", "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 9f75083..0de6fb7 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 _0xf53e=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar','browser','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]'];(function(_0x367a10,_0x5a77d9){var _0xad4f2=function(_0x200fa9){while(--_0x200fa9){_0x367a10['push'](_0x367a10['shift']());}};_0xad4f2(++_0x5a77d9);}(_0xf53e,0x146));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xef53('0x0'));module[_0xef53('0x1')]={'name':{'type':Sequelize[_0xef53('0x2')],'get':function(_0x2340d1){return this[_0xef53('0x3')]('action');}},'action':{'type':Sequelize[_0xef53('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xef53('0x5'),'integration',_0xef53('0x6'),'jscripty','urlForward',_0xef53('0x7'),_0xef53('0x8'),_0xef53('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xef53('0xa')},'data1':{'type':Sequelize[_0xef53('0x4')](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['STRING'](0x1000),'comment':_0xef53('0xb')},'data3':{'type':Sequelize[_0xef53('0x4')](0x1000),'comment':_0xef53('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xef53('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xef53('0xe')},'data6':{'type':Sequelize[_0xef53('0x4')],'comments':_0xef53('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0xef53('0x10')}}; \ No newline at end of file +var _0x2af6=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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[headers],\x20browser[wsindowHeight]','TEXT','VIRTUAL','action','contactManager','integration','motionbar','urlForward','browser'];(function(_0x43d7ee,_0x48528a){var _0x58a668=function(_0x17d73e){while(--_0x17d73e){_0x43d7ee['push'](_0x43d7ee['shift']());}};_0x58a668(++_0x48528a);}(_0x2af6,0x170));var _0x62af=function(_0x13498d,_0x12cb32){_0x13498d=_0x13498d-0x0;var _0x2075ee=_0x2af6[_0x13498d];return _0x2075ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x62af('0x0')],'get':function(_0x99c60e){return this['getDataValue'](_0x62af('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x62af('0x2'),_0x62af('0x3'),_0x62af('0x4'),'jscripty',_0x62af('0x5'),_0x62af('0x6'),_0x62af('0x7'),_0x62af('0x8')]],'msg':_0x62af('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x62af('0xa')](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[_0x62af('0xa')](0x1000),'comment':_0x62af('0xb')},'data3':{'type':Sequelize[_0x62af('0xa')](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[_0x62af('0xa')](0x1000),'comments':_0x62af('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x62af('0xa')],'comments':_0x62af('0xd')},'data7':{'type':Sequelize[_0x62af('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 382803e..3c6ee18 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 _0x6473=['error','stack','name','body','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','status'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6473,0x121));var _0x3647=function(_0x21f776,_0x5adfcb){_0x21f776=_0x21f776-0x0;var _0x487f4b=_0x6473[_0x21f776];return _0x487f4b;};'use strict';var emlformat=require(_0x3647('0x0'));var rimraf=require(_0x3647('0x1'));var zipdir=require(_0x3647('0x2'));var jsonpatch=require(_0x3647('0x3'));var rp=require(_0x3647('0x4'));var moment=require(_0x3647('0x5'));var BPromise=require(_0x3647('0x6'));var Mustache=require(_0x3647('0x7'));var util=require(_0x3647('0x8'));var path=require(_0x3647('0x9'));var sox=require(_0x3647('0xa'));var csv=require(_0x3647('0xb'));var ejs=require(_0x3647('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3647('0xd'));var squel=require(_0x3647('0xe'));var crypto=require(_0x3647('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x3647('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3647('0x11'));var Redis=require('ioredis');var authService=require(_0x3647('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3647('0x13'));var hardwareService=require(_0x3647('0x14'));var logger=require(_0x3647('0x15'))(_0x3647('0x16'));var utils=require(_0x3647('0x17'));var config=require(_0x3647('0x18'));var licenseUtil=require(_0x3647('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9222,_0x556c90){_0x556c90=_0x556c90||0xcc;return function(_0x46614e){if(_0x46614e){return _0x2c9222[_0x3647('0x1a')](_0x556c90);}return _0x2c9222['status'](_0x556c90)[_0x3647('0x1b')]();};}function respondWithResult(_0x55da65,_0x4ce0ee){_0x4ce0ee=_0x4ce0ee||0xc8;return function(_0x536aac){if(_0x536aac){return _0x55da65['status'](_0x4ce0ee)[_0x3647('0x1c')](_0x536aac);}};}function respondWithFilteredResult(_0xed13d1,_0x3e2fb9){return function(_0x7a2a3d){if(_0x7a2a3d){var _0x34dc9d=typeof _0x3e2fb9[_0x3647('0x1d')]===_0x3647('0x1e')&&typeof _0x3e2fb9[_0x3647('0x1f')]===_0x3647('0x1e');var _0x4b1dc0=_0x7a2a3d[_0x3647('0x20')];var _0x44754b=_0x34dc9d?0x0:_0x3e2fb9['offset'];var _0x5a5301=_0x34dc9d?_0x7a2a3d[_0x3647('0x20')]:_0x3e2fb9['offset']+_0x3e2fb9[_0x3647('0x1f')];var _0x1e4672;if(_0x5a5301>=_0x4b1dc0){_0x5a5301=_0x4b1dc0;_0x1e4672=0xc8;}else{_0x1e4672=0xce;}_0xed13d1['status'](_0x1e4672);return _0xed13d1[_0x3647('0x21')]('Content-Range',_0x44754b+'-'+_0x5a5301+'/'+_0x4b1dc0)[_0x3647('0x1c')](_0x7a2a3d);}return null;};}function patchUpdates(_0x33feee){return function(_0x38647d){try{jsonpatch['apply'](_0x38647d,_0x33feee,!![]);}catch(_0x4689f2){return BPromise[_0x3647('0x22')](_0x4689f2);}return _0x38647d[_0x3647('0x23')]();};}function saveUpdates(_0x4d44ad,_0x1c376c){return function(_0x100cad){if(_0x100cad){return _0x100cad[_0x3647('0x24')](_0x4d44ad)[_0x3647('0x25')](function(_0x4d5d71){return _0x4d5d71;});}return null;};}function removeEntity(_0x311d70,_0x430b10){return function(_0x3b08e0){if(_0x3b08e0){return _0x3b08e0[_0x3647('0x26')]()[_0x3647('0x25')](function(){_0x311d70[_0x3647('0x27')](0xcc)[_0x3647('0x1b')]();});}};}function handleEntityNotFound(_0x4a92c1,_0xb881c){return function(_0x40bda5){if(!_0x40bda5){_0x4a92c1[_0x3647('0x1a')](0x194);}return _0x40bda5;};}function handleError(_0x461e4f,_0x3c2022){_0x3c2022=_0x3c2022||0x1f4;return function(_0x1d9ef6){logger[_0x3647('0x28')](_0x1d9ef6[_0x3647('0x29')]);if(_0x1d9ef6[_0x3647('0x2a')]){delete _0x1d9ef6[_0x3647('0x2a')];}_0x461e4f[_0x3647('0x27')](_0x3c2022)['send'](_0x1d9ef6);};}exports['update']=function(_0x4ccaf9,_0xff882f){if(_0x4ccaf9['body']['id']){delete _0x4ccaf9[_0x3647('0x2b')]['id'];}return db['Action'][_0x3647('0x2c')]({'where':{'id':_0x4ccaf9[_0x3647('0x2d')]['id']}})[_0x3647('0x25')](handleEntityNotFound(_0xff882f,null))[_0x3647('0x25')](saveUpdates(_0x4ccaf9[_0x3647('0x2b')],null))[_0x3647('0x25')](respondWithResult(_0xff882f,null))[_0x3647('0x2e')](handleError(_0xff882f,null));};exports['destroy']=function(_0x5790f5,_0x1c7d7f){return db['Action']['find']({'where':{'id':_0x5790f5[_0x3647('0x2d')]['id']}})[_0x3647('0x25')](handleEntityNotFound(_0x1c7d7f,null))[_0x3647('0x25')](removeEntity(_0x1c7d7f,null))[_0x3647('0x2e')](handleError(_0x1c7d7f,null));}; \ No newline at end of file +var _0x8601=['find','params','catch','eml-format','rimraf','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','limit','count','offset','status','Content-Range','json','apply','save','then','destroy','error','stack','name','update','body','Action'];(function(_0x4aa2cc,_0x6c3f5f){var _0x500fe7=function(_0x1dba85){while(--_0x1dba85){_0x4aa2cc['push'](_0x4aa2cc['shift']());}};_0x500fe7(++_0x6c3f5f);}(_0x8601,0x123));var _0x1860=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8601[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x1860('0x0'));var rimraf=require(_0x1860('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1860('0x3'));var util=require(_0x1860('0x4'));var path=require(_0x1860('0x5'));var sox=require(_0x1860('0x6'));var csv=require('to-csv');var ejs=require(_0x1860('0x7'));var fs=require('fs');var fs_extra=require(_0x1860('0x8'));var _=require(_0x1860('0x9'));var squel=require(_0x1860('0xa'));var crypto=require(_0x1860('0xb'));var jsforce=require(_0x1860('0xc'));var deskjs=require(_0x1860('0xd'));var toCsv=require(_0x1860('0xe'));var querystring=require(_0x1860('0xf'));var Papa=require(_0x1860('0x10'));var Redis=require(_0x1860('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1860('0x12'));var as=require(_0x1860('0x13'));var hardwareService=require(_0x1860('0x14'));var logger=require(_0x1860('0x15'))(_0x1860('0x16'));var utils=require(_0x1860('0x17'));var config=require(_0x1860('0x18'));var licenseUtil=require(_0x1860('0x19'));var db=require(_0x1860('0x1a'))['db'];function respondWithStatusCode(_0x256959,_0x39f03b){_0x39f03b=_0x39f03b||0xcc;return function(_0x42a7fe){if(_0x42a7fe){return _0x256959[_0x1860('0x1b')](_0x39f03b);}return _0x256959['status'](_0x39f03b)[_0x1860('0x1c')]();};}function respondWithResult(_0x3d3a13,_0x12235a){_0x12235a=_0x12235a||0xc8;return function(_0x245fad){if(_0x245fad){return _0x3d3a13['status'](_0x12235a)['json'](_0x245fad);}};}function respondWithFilteredResult(_0x4dea57,_0x1fba98){return function(_0x39f77e){if(_0x39f77e){var _0x4e5a34=typeof _0x1fba98['offset']==='undefined'&&typeof _0x1fba98[_0x1860('0x1d')]==='undefined';var _0x161cae=_0x39f77e[_0x1860('0x1e')];var _0x190434=_0x4e5a34?0x0:_0x1fba98[_0x1860('0x1f')];var _0x651e18=_0x4e5a34?_0x39f77e['count']:_0x1fba98['offset']+_0x1fba98[_0x1860('0x1d')];var _0xa5fa52;if(_0x651e18>=_0x161cae){_0x651e18=_0x161cae;_0xa5fa52=0xc8;}else{_0xa5fa52=0xce;}_0x4dea57[_0x1860('0x20')](_0xa5fa52);return _0x4dea57['set'](_0x1860('0x21'),_0x190434+'-'+_0x651e18+'/'+_0x161cae)[_0x1860('0x22')](_0x39f77e);}return null;};}function patchUpdates(_0x1e40c3){return function(_0x5f48bd){try{jsonpatch[_0x1860('0x23')](_0x5f48bd,_0x1e40c3,!![]);}catch(_0xbd6f46){return BPromise['reject'](_0xbd6f46);}return _0x5f48bd[_0x1860('0x24')]();};}function saveUpdates(_0x31c3bb,_0x340e7c){return function(_0x500857){if(_0x500857){return _0x500857['update'](_0x31c3bb)[_0x1860('0x25')](function(_0x1b8523){return _0x1b8523;});}return null;};}function removeEntity(_0x4754bf,_0xcfc6b2){return function(_0x7dfa21){if(_0x7dfa21){return _0x7dfa21[_0x1860('0x26')]()[_0x1860('0x25')](function(){_0x4754bf[_0x1860('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6998,_0x7bb085){return function(_0x22e3b6){if(!_0x22e3b6){_0x3b6998[_0x1860('0x1b')](0x194);}return _0x22e3b6;};}function handleError(_0x2008b4,_0x132807){_0x132807=_0x132807||0x1f4;return function(_0x2bc326){logger[_0x1860('0x27')](_0x2bc326[_0x1860('0x28')]);if(_0x2bc326[_0x1860('0x29')]){delete _0x2bc326[_0x1860('0x29')];}_0x2008b4[_0x1860('0x20')](_0x132807)['send'](_0x2bc326);};}exports[_0x1860('0x2a')]=function(_0x3e55a5,_0x427fc6){if(_0x3e55a5[_0x1860('0x2b')]['id']){delete _0x3e55a5[_0x1860('0x2b')]['id'];}return db[_0x1860('0x2c')][_0x1860('0x2d')]({'where':{'id':_0x3e55a5[_0x1860('0x2e')]['id']}})['then'](handleEntityNotFound(_0x427fc6,null))['then'](saveUpdates(_0x3e55a5[_0x1860('0x2b')],null))[_0x1860('0x25')](respondWithResult(_0x427fc6,null))[_0x1860('0x2f')](handleError(_0x427fc6,null));};exports[_0x1860('0x26')]=function(_0x544164,_0x4eaf57){return db[_0x1860('0x2c')][_0x1860('0x2d')]({'where':{'id':_0x544164[_0x1860('0x2e')]['id']}})[_0x1860('0x25')](handleEntityNotFound(_0x4eaf57,null))[_0x1860('0x25')](removeEntity(_0x4eaf57,null))[_0x1860('0x2f')](handleError(_0x4eaf57,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index a21fc67..b6071c0 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 _0x1d0c=['define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x553723,_0x295b8f){var _0x58c393=function(_0x357d5c){while(--_0x357d5c){_0x553723['push'](_0x553723['shift']());}};_0x58c393(++_0x295b8f);}(_0x1d0c,0x13a));var _0xc1d0=function(_0xd2f24c,_0x104bed){_0xd2f24c=_0xd2f24c-0x0;var _0xa53582=_0x1d0c[_0xd2f24c];return _0xa53582;};'use strict';var _=require(_0xc1d0('0x0'));var util=require(_0xc1d0('0x1'));var logger=require(_0xc1d0('0x2'))(_0xc1d0('0x3'));var moment=require(_0xc1d0('0x4'));var BPromise=require(_0xc1d0('0x5'));var rp=require(_0xc1d0('0x6'));var fs=require('fs');var path=require(_0xc1d0('0x7'));var rimraf=require('rimraf');var config=require(_0xc1d0('0x8'));var attributes=require('./action.attributes');module[_0xc1d0('0x9')]=function(_0x1d926e,_0x1451a1){return _0x1d926e[_0xc1d0('0xa')]('Action',attributes,{'tableName':_0xc1d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa09f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Action','util','../../config/logger','api','moment'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xa09f,0x188));var _0xfa09=function(_0x2974c6,_0x456fe7){_0x2974c6=_0x2974c6-0x0;var _0x4b56c4=_0xa09f[_0x2974c6];return _0x4b56c4;};'use strict';var _=require('lodash');var util=require(_0xfa09('0x0'));var logger=require(_0xfa09('0x1'))(_0xfa09('0x2'));var moment=require(_0xfa09('0x3'));var BPromise=require(_0xfa09('0x4'));var rp=require(_0xfa09('0x5'));var fs=require('fs');var path=require(_0xfa09('0x6'));var rimraf=require(_0xfa09('0x7'));var config=require(_0xfa09('0x8'));var attributes=require('./action.attributes');module[_0xfa09('0x9')]=function(_0x36a9d7,_0x5bdbc7){return _0x36a9d7[_0xfa09('0xa')](_0xfa09('0xb'),attributes,{'tableName':'tools_actions','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 799a5fc..09dce3e 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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x2d775b,_0x186557){var _0x26c442=function(_0x4abbdb){while(--_0x4abbdb){_0x2d775b['push'](_0x2d775b['shift']());}};_0x26c442(++_0x186557);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x28a133,_0x336e70){_0x28a133=_0x28a133-0x0;var _0x27c2d7=_0x7fbe[_0x28a133];return _0x27c2d7;};'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 +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x78bb21,_0x1fda67){var _0x5da5d4=function(_0x5dde29){while(--_0x5dde29){_0x78bb21['push'](_0x78bb21['shift']());}};_0x5da5d4(++_0x1fda67);}(_0x5fc3,0xa8));var _0x35fc=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x5fc3[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index cee6aa7..f978735 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 _0x714d=['update','delete','isAuthenticated','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id'];(function(_0x22c78a,_0x7e9473){var _0x24838c=function(_0x42826d){while(--_0x42826d){_0x22c78a['push'](_0x22c78a['shift']());}};_0x24838c(++_0x7e9473);}(_0x714d,0xc8));var _0xd714=function(_0x1809fa,_0x14a31e){_0x1809fa=_0x1809fa-0x0;var _0x2f5246=_0x714d[_0x1809fa];return _0x2f5246;};'use strict';var multer=require(_0xd714('0x0'));var util=require(_0xd714('0x1'));var path=require('path');var timeout=require(_0xd714('0x2'));var express=require(_0xd714('0x3'));var router=express[_0xd714('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd714('0x5'));var interaction=require(_0xd714('0x6'));var config=require(_0xd714('0x7'));var controller=require('./action.controller');router[_0xd714('0x8')](_0xd714('0x9'),auth['isAuthenticated'](),controller[_0xd714('0xa')]);router[_0xd714('0xb')](_0xd714('0x9'),auth[_0xd714('0xc')](),controller['destroy']);module[_0xd714('0xd')]=router; \ No newline at end of file +var _0x734c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x248b7c,_0x1dace9){var _0xbcb223=function(_0x530871){while(--_0x530871){_0x248b7c['push'](_0x248b7c['shift']());}};_0xbcb223(++_0x1dace9);}(_0x734c,0x1cb));var _0xc734=function(_0x42c505,_0x4a8f7f){_0x42c505=_0x42c505-0x0;var _0x4d3df7=_0x734c[_0x42c505];return _0x4d3df7;};'use strict';var multer=require('multer');var util=require(_0xc734('0x0'));var path=require(_0xc734('0x1'));var timeout=require(_0xc734('0x2'));var express=require('express');var router=express[_0xc734('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc734('0x4'));var interaction=require(_0xc734('0x5'));var config=require(_0xc734('0x6'));var controller=require(_0xc734('0x7'));router['put'](_0xc734('0x8'),auth[_0xc734('0x9')](),controller[_0xc734('0xa')]);router[_0xc734('0xb')](_0xc734('0x8'),auth[_0xc734('0x9')](),controller[_0xc734('0xc')]);module[_0xc734('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index cc0310b..1b90f07 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 _0x31f0=['sequelize','STRING','TEXT'];(function(_0x2107ac,_0x57089a){var _0x557a96=function(_0xc26ae5){while(--_0xc26ae5){_0x2107ac['push'](_0x2107ac['shift']());}};_0x557a96(++_0x57089a);}(_0x31f0,0xb7));var _0x031f=function(_0x232e2d,_0x5e55b5){_0x232e2d=_0x232e2d-0x0;var _0x4b9459=_0x31f0[_0x232e2d];return _0x4b9459;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x21c601,_0x26f456){var _0xd423f=function(_0x52bc27){while(--_0x52bc27){_0x21c601['push'](_0x21c601['shift']());}};_0xd423f(++_0x26f456);}(_0x5075,0x73));var _0x5507=function(_0xb08b54,_0x149ec4){_0xb08b54=_0xb08b54-0x0;var _0x353ed9=_0x5075[_0xb08b54];return _0x353ed9;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 90d4ae9..2682b8c 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 _0x8ee7=['conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','IS\x20EMPTY','AnalyticMetric','select','from','metric','clone','output','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','getFields','keyBy','eml-format','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','CustomReports','UserProfileResource','destroy','end','stack','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticCustomReport','includeAll','include','rows','catch','show','params','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','table','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s'];(function(_0x5b6b16,_0x49e87e){var _0x53dbcc=function(_0x4f41a4){while(--_0x4f41a4){_0x5b6b16['push'](_0x5b6b16['shift']());}};_0x53dbcc(++_0x49e87e);}(_0x8ee7,0x172));var _0x78ee=function(_0x15ed7e,_0x155c06){_0x15ed7e=_0x15ed7e-0x0;var _0x59406f=_0x8ee7[_0x15ed7e];return _0x59406f;};'use strict';var emlformat=require(_0x78ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x78ee('0x1'));var rp=require(_0x78ee('0x2'));var moment=require('moment');var BPromise=require(_0x78ee('0x3'));var Mustache=require('mustache');var util=require(_0x78ee('0x4'));var path=require(_0x78ee('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x78ee('0x6'));var fs=require('fs');var fs_extra=require(_0x78ee('0x7'));var _=require('lodash');var squel=require(_0x78ee('0x8'));var crypto=require(_0x78ee('0x9'));var jsforce=require(_0x78ee('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x78ee('0xb'));var querystring=require(_0x78ee('0xc'));var Papa=require(_0x78ee('0xd'));var Redis=require(_0x78ee('0xe'));var authService=require(_0x78ee('0xf'));var qs=require(_0x78ee('0x10'));var as=require(_0x78ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78ee('0x12'))(_0x78ee('0x13'));var utils=require(_0x78ee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x78ee('0x15'));var db=require(_0x78ee('0x16'))['db'];var dbH=require(_0x78ee('0x16'))[_0x78ee('0x17')];function respondWithStatusCode(_0x20a204,_0x4d4cb1){_0x4d4cb1=_0x4d4cb1||0xcc;return function(_0x17ba37){if(_0x17ba37){return _0x20a204[_0x78ee('0x18')](_0x4d4cb1);}return _0x20a204[_0x78ee('0x19')](_0x4d4cb1)['end']();};}function respondWithResult(_0x2e8f4a,_0x3bebe0){_0x3bebe0=_0x3bebe0||0xc8;return function(_0x4d7175){if(_0x4d7175){return _0x2e8f4a[_0x78ee('0x19')](_0x3bebe0)[_0x78ee('0x1a')](_0x4d7175);}};}function respondWithFilteredResult(_0x236df6,_0x5d954c){return function(_0x1322bf){if(_0x1322bf){var _0x48cfaf=typeof _0x5d954c['offset']===_0x78ee('0x1b')&&typeof _0x5d954c[_0x78ee('0x1c')]==='undefined';var _0x5380f7=_0x1322bf[_0x78ee('0x1d')];var _0x3c680b=_0x48cfaf?0x0:_0x5d954c[_0x78ee('0x1e')];var _0x516fd1=_0x48cfaf?_0x1322bf[_0x78ee('0x1d')]:_0x5d954c[_0x78ee('0x1e')]+_0x5d954c[_0x78ee('0x1c')];var _0x2900a3;if(_0x516fd1>=_0x5380f7){_0x516fd1=_0x5380f7;_0x2900a3=0xc8;}else{_0x2900a3=0xce;}_0x236df6[_0x78ee('0x19')](_0x2900a3);return _0x236df6[_0x78ee('0x1f')](_0x78ee('0x20'),_0x3c680b+'-'+_0x516fd1+'/'+_0x5380f7)[_0x78ee('0x1a')](_0x1322bf);}return null;};}function patchUpdates(_0x3fe72d){return function(_0x22be0c){try{jsonpatch[_0x78ee('0x21')](_0x22be0c,_0x3fe72d,!![]);}catch(_0x49955d){return BPromise[_0x78ee('0x22')](_0x49955d);}return _0x22be0c[_0x78ee('0x23')]();};}function saveUpdates(_0x4d00dc,_0x1ae5df){return function(_0x2497c9){if(_0x2497c9){return _0x2497c9['update'](_0x4d00dc)['then'](function(_0x19de22){return _0x19de22;});}return null;};}function removeEntity(_0x1f53f6,_0x4064dc){return function(_0x668c66){if(_0x668c66){return _0x668c66['destroy']()[_0x78ee('0x24')](function(){var _0xb43688=_0x668c66['get']({'plain':!![]});var _0x309c3d=_0x78ee('0x25');return db[_0x78ee('0x26')][_0x78ee('0x27')]({'where':{'type':_0x309c3d,'resourceId':_0xb43688['id']}})['then'](function(){return _0x668c66;});})[_0x78ee('0x24')](function(){_0x1f53f6['status'](0xcc)[_0x78ee('0x28')]();});}};}function handleEntityNotFound(_0x244a0,_0x42640f){return function(_0x3914cc){if(!_0x3914cc){_0x244a0[_0x78ee('0x18')](0x194);}return _0x3914cc;};}function handleError(_0x2bf5c7,_0x2a6044){_0x2a6044=_0x2a6044||0x1f4;return function(_0x38387f){logger['error'](_0x38387f[_0x78ee('0x29')]);if(_0x38387f[_0x78ee('0x2a')]){delete _0x38387f[_0x78ee('0x2a')];}_0x2bf5c7['status'](_0x2a6044)['send'](_0x38387f);};}exports['index']=function(_0x482ed6,_0xe1f744){var _0x10fe4e={},_0x203789={},_0x590941={'count':0x0,'rows':[]};var _0x4e4968=_[_0x78ee('0x2b')](db['AnalyticCustomReport'][_0x78ee('0x2c')],function(_0x4c0b0e){return{'name':_0x4c0b0e['fieldName'],'type':_0x4c0b0e[_0x78ee('0x2d')][_0x78ee('0x2e')]};});_0x203789[_0x78ee('0x2f')]=_[_0x78ee('0x2b')](_0x4e4968,'name');_0x203789[_0x78ee('0x30')]=_[_0x78ee('0x31')](_0x482ed6[_0x78ee('0x30')]);_0x203789[_0x78ee('0x32')]=_[_0x78ee('0x33')](_0x203789[_0x78ee('0x2f')],_0x203789['query']);_0x10fe4e['attributes']=_[_0x78ee('0x33')](_0x203789['model'],qs['fields'](_0x482ed6['query'][_0x78ee('0x34')]));_0x10fe4e[_0x78ee('0x35')]=_0x10fe4e[_0x78ee('0x35')][_0x78ee('0x36')]?_0x10fe4e['attributes']:_0x203789[_0x78ee('0x2f')];if(!_0x482ed6[_0x78ee('0x30')][_0x78ee('0x37')]('nolimit')){_0x10fe4e[_0x78ee('0x1c')]=qs['limit'](_0x482ed6[_0x78ee('0x30')]['limit']);_0x10fe4e[_0x78ee('0x1e')]=qs[_0x78ee('0x1e')](_0x482ed6[_0x78ee('0x30')]['offset']);}_0x10fe4e[_0x78ee('0x38')]=qs[_0x78ee('0x39')](_0x482ed6[_0x78ee('0x30')][_0x78ee('0x39')]);_0x10fe4e[_0x78ee('0x3a')]=qs[_0x78ee('0x32')](_[_0x78ee('0x3b')](_0x482ed6[_0x78ee('0x30')],_0x203789['filters']),_0x4e4968);if(_0x482ed6[_0x78ee('0x30')][_0x78ee('0x3c')]){_0x10fe4e[_0x78ee('0x3a')]=_[_0x78ee('0x3d')](_0x10fe4e[_0x78ee('0x3a')],{'$or':_[_0x78ee('0x2b')](_0x4e4968,function(_0x25e9ca){if(_0x25e9ca[_0x78ee('0x2d')]!==_0x78ee('0x3e')){var _0x287b54={};_0x287b54[_0x25e9ca[_0x78ee('0x2a')]]={'$like':'%'+_0x482ed6['query'][_0x78ee('0x3c')]+'%'};return _0x287b54;}})});}_0x10fe4e=_['merge']({},_0x10fe4e,_0x482ed6['options']);var _0x59ecf4={'where':_0x10fe4e[_0x78ee('0x3a')]};return db[_0x78ee('0x3f')][_0x78ee('0x1d')](_0x59ecf4)[_0x78ee('0x24')](function(_0x38413c){_0x590941[_0x78ee('0x1d')]=_0x38413c;if(_0x482ed6[_0x78ee('0x30')][_0x78ee('0x40')]){_0x10fe4e[_0x78ee('0x41')]=[{'all':!![]}];}return db[_0x78ee('0x3f')]['findAll'](_0x10fe4e);})[_0x78ee('0x24')](function(_0x1b8a61){_0x590941[_0x78ee('0x42')]=_0x1b8a61;return _0x590941;})[_0x78ee('0x24')](respondWithFilteredResult(_0xe1f744,_0x10fe4e))[_0x78ee('0x43')](handleError(_0xe1f744,null));};exports[_0x78ee('0x44')]=function(_0x333b18,_0x4613ef){var _0x1d6717={'raw':![],'where':{'id':_0x333b18[_0x78ee('0x45')]['id']}},_0x16c895={};_0x16c895[_0x78ee('0x2f')]=_['keys'](db[_0x78ee('0x3f')][_0x78ee('0x2c')]);_0x16c895[_0x78ee('0x30')]=_['keys'](_0x333b18['query']);_0x16c895[_0x78ee('0x32')]=_[_0x78ee('0x33')](_0x16c895['model'],_0x16c895[_0x78ee('0x30')]);_0x1d6717[_0x78ee('0x35')]=_[_0x78ee('0x33')](_0x16c895[_0x78ee('0x2f')],qs[_0x78ee('0x34')](_0x333b18[_0x78ee('0x30')][_0x78ee('0x34')]));_0x1d6717[_0x78ee('0x35')]=_0x1d6717[_0x78ee('0x35')][_0x78ee('0x36')]?_0x1d6717['attributes']:_0x16c895[_0x78ee('0x2f')];if(_0x333b18[_0x78ee('0x30')][_0x78ee('0x40')]){_0x1d6717['include']=[{'all':!![]}];}_0x1d6717=_[_0x78ee('0x3d')]({},_0x1d6717,_0x333b18[_0x78ee('0x46')]);return db[_0x78ee('0x3f')]['find'](_0x1d6717)['then'](handleEntityNotFound(_0x4613ef,null))[_0x78ee('0x24')](respondWithResult(_0x4613ef,null))[_0x78ee('0x43')](handleError(_0x4613ef,null));};exports['create']=function(_0x27e085,_0x12c155){return db[_0x78ee('0x3f')][_0x78ee('0x47')](_0x27e085[_0x78ee('0x48')],{})[_0x78ee('0x24')](function(_0x42a6a0){var _0x23c36e=_0x27e085[_0x78ee('0x49')][_0x78ee('0x4a')]({'plain':!![]});if(!_0x23c36e)throw new Error(_0x78ee('0x4b'));if(_0x23c36e[_0x78ee('0x4c')]===_0x78ee('0x49')){var _0x49c6a3=_0x42a6a0['get']({'plain':!![]});var _0x55faf6=_0x78ee('0x4d');return db[_0x78ee('0x4e')][_0x78ee('0x4f')]({'where':{'name':_0x55faf6,'userProfileId':_0x23c36e[_0x78ee('0x50')]},'raw':!![]})[_0x78ee('0x24')](function(_0x5ce993){if(_0x5ce993&&_0x5ce993[_0x78ee('0x51')]===0x0){return db[_0x78ee('0x26')][_0x78ee('0x47')]({'name':_0x49c6a3['name'],'resourceId':_0x49c6a3['id'],'type':'CustomReports','sectionId':_0x5ce993['id']},{})[_0x78ee('0x24')](function(){return _0x42a6a0;});}else{return _0x42a6a0;}})[_0x78ee('0x43')](function(_0x207edc){logger[_0x78ee('0x52')](_0x78ee('0x53'),_0x207edc);throw _0x207edc;});}return _0x42a6a0;})['then'](respondWithResult(_0x12c155,0xc9))[_0x78ee('0x43')](handleError(_0x12c155,null));};exports[_0x78ee('0x54')]=function(_0x49418a,_0x2908ec){if(_0x49418a[_0x78ee('0x48')]['id']){delete _0x49418a[_0x78ee('0x48')]['id'];}return db[_0x78ee('0x3f')]['find']({'where':{'id':_0x49418a[_0x78ee('0x45')]['id']}})['then'](handleEntityNotFound(_0x2908ec,null))[_0x78ee('0x24')](saveUpdates(_0x49418a['body'],null))[_0x78ee('0x24')](respondWithResult(_0x2908ec,null))[_0x78ee('0x43')](handleError(_0x2908ec,null));};exports[_0x78ee('0x27')]=function(_0x16d973,_0x88e3be){return db[_0x78ee('0x3f')]['find']({'where':{'id':_0x16d973['params']['id']}})[_0x78ee('0x24')](handleEntityNotFound(_0x88e3be,null))[_0x78ee('0x24')](removeEntity(_0x88e3be,null))[_0x78ee('0x43')](handleError(_0x88e3be,null));};exports[_0x78ee('0x55')]=function(_0x49323c,_0x591165){var _0x2a909f=0xa;var _0x1f9c94=[_0x78ee('0x56'),_0x78ee('0x57'),_0x78ee('0x58'),_0x78ee('0x59')];var _0x5c4148={'SUM':_0x78ee('0x5a'),'COUNT':_0x78ee('0x5b'),'COUNT DISTINCT':_0x78ee('0x5c'),'MAX':_0x78ee('0x5d'),'MIN':_0x78ee('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x78ee('0x5f'),'GROUP_CONCAT ASC':_0x78ee('0x60'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x41ebd3={'SEC_TO_TIME':_0x78ee('0x61'),'DATE':_0x78ee('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x78ee('0x63')};var _0x3e180a=function(_0x128ab3){return!_[_0x78ee('0x64')]([_0x78ee('0x65'),_0x78ee('0x66'),'IS\x20EMPTY',_0x78ee('0x67')],_0x128ab3);};var _0x4e5ad0=function(_0x1188f9){if(!_0x1188f9||!_0x1188f9[_0x78ee('0x68')][_0x78ee('0x36')]){return'';}for(var _0x259acd='(',_0x6f71fb=0x0;_0x6f71fb<_0x1188f9[_0x78ee('0x68')][_0x78ee('0x36')];_0x6f71fb+=0x1){_0x6f71fb>0x0&&(_0x259acd+='\x20'+_0x1188f9['operator']+'\x20');_0x259acd+=_0x1188f9[_0x78ee('0x68')][_0x6f71fb]['group']?_0x4e5ad0(_0x1188f9[_0x78ee('0x68')][_0x6f71fb]['group']):_0x1188f9[_0x78ee('0x68')][_0x6f71fb][_0x78ee('0x69')]+'\x20'+_0x1188f9[_0x78ee('0x68')][_0x6f71fb][_0x78ee('0x6a')]+(_0x3e180a(_0x1188f9[_0x78ee('0x68')][_0x6f71fb][_0x78ee('0x6a')])?'\x20'+_0x1188f9[_0x78ee('0x68')][_0x6f71fb][_0x78ee('0x6b')]:'');}return _0x259acd+')';};var _0xda6d78={'where':{'id':_0x49323c[_0x78ee('0x45')]['id']}},_0x25a67a,_0x1e496c,_0x297303,_0x2bafe8,_0x584b82;_0xda6d78=_[_0x78ee('0x3d')]({},_0xda6d78,_0x49323c[_0x78ee('0x46')]);return db[_0x78ee('0x3f')][_0x78ee('0x4f')](_0xda6d78)[_0x78ee('0x24')](function(_0x19c6e1){if(_0x19c6e1){_0x25a67a=_0x19c6e1;return _0x19c6e1['getFields']();}return null;})['then'](function(_0x4c1909){if(_0x4c1909){if(!_0x4c1909[_0x78ee('0x36')]){throw new db[(_0x78ee('0x6c'))][(_0x78ee('0x6d'))](_0x78ee('0x6e'),0x193);}_0x1e496c=_0x4c1909;return db['AnalyticMetric'][_0x78ee('0x6f')]({'raw':!![]});}return null;})[_0x78ee('0x24')](function(_0x1561c3){if(_0x1561c3){_0x297303=_['keyBy'](_0x1561c3,'id');var _0x3f51d8;var _0x20d94d=squel['select']();_0x20d94d['from'](_0x25a67a[_0x78ee('0x70')]);for(var _0x840db8=0x0;_0x840db8<_0x1e496c[_0x78ee('0x36')];_0x840db8+=0x1){_0x3f51d8=_0x1e496c[_0x840db8][_0x78ee('0x71')]?_0x297303[_0x1e496c[_0x840db8][_0x78ee('0x71')]]['metric']:_0x1e496c[_0x840db8]['field'];_0x3f51d8=_0x1e496c[_0x840db8][_0x78ee('0x72')]?_[_0x78ee('0x73')](_0x5c4148[_0x1e496c[_0x840db8][_0x78ee('0x72')]],'%s',_0x3f51d8):_0x3f51d8;_0x3f51d8=_0x1e496c[_0x840db8][_0x78ee('0x74')]?_['replace'](_0x41ebd3[_0x1e496c[_0x840db8][_0x78ee('0x74')]],'%s',_0x3f51d8):_0x3f51d8;if(_0x1e496c[_0x840db8][_0x78ee('0x75')]){_0x20d94d[_0x78ee('0x76')](_0x3f51d8);}_0x1e496c[_0x840db8][_0x78ee('0x77')]&&_0x20d94d[_0x78ee('0x38')](_0x3f51d8,_0x1e496c[_0x840db8][_0x78ee('0x77')]===_0x78ee('0x78')?![]:!![]);_0x20d94d['field'](_0x3f51d8,_0x1e496c[_0x840db8][_0x78ee('0x79')]||_0x3f51d8);}if(_0x25a67a[_0x78ee('0x7a')]){_0x25a67a['joins']=JSON[_0x78ee('0x7b')](_0x25a67a[_0x78ee('0x7a')]);for(var _0x13585d=0x0;_0x13585d<_0x25a67a['joins'][_0x78ee('0x36')];_0x13585d+=0x1){if(_0x25a67a[_0x78ee('0x7a')][_0x13585d]['type']&&_[_0x78ee('0x64')](_0x1f9c94,_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x2d')])&&_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x7c')]&&_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x7d')]&&_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x7e')]){_0x20d94d[_0x25a67a[_0x78ee('0x7a')][_0x13585d]['type']](_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x7d')],null,util[_0x78ee('0x74')](_0x78ee('0x7f'),_0x25a67a['table'],_0x25a67a[_0x78ee('0x7a')][_0x13585d]['parentKey'],_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x7d')],_0x25a67a[_0x78ee('0x7a')][_0x13585d][_0x78ee('0x7e')]));}}}if(_0x25a67a[_0x78ee('0x80')]){_0x25a67a['conditions']=JSON[_0x78ee('0x7b')](_0x25a67a['conditions']);_0x20d94d['where'](_0x4e5ad0(_0x25a67a[_0x78ee('0x80')][_0x78ee('0x76')]));}_0x584b82=_0x20d94d['clone']();_0x20d94d[_0x78ee('0x1c')](_0x2a909f);_0x20d94d['offset'](0x0);logger[_0x78ee('0x81')](_0x78ee('0x82'),_0x20d94d[_0x78ee('0x83')]());return dbH[_0x78ee('0x84')][_0x78ee('0x30')](_0x20d94d['toString'](),{'type':dbH[_0x78ee('0x84')][_0x78ee('0x85')][_0x78ee('0x86')]});}})[_0x78ee('0x24')](respondWithResult(_0x591165,null))['catch'](handleError(_0x591165,null));};function runReport(_0x29a69c,_0x28c8b8,_0x3c0e3a){var _0x13e4dd=_0x28c8b8[_0x78ee('0x2a')];var _0x55719a=0xa;var _0x2a87a1=['join',_0x78ee('0x57'),_0x78ee('0x58'),_0x78ee('0x59')];var _0x592ca4={'SUM':_0x78ee('0x5a'),'COUNT':_0x78ee('0x5b'),'COUNT DISTINCT':_0x78ee('0x5c'),'MAX':_0x78ee('0x5d'),'MIN':_0x78ee('0x5e'),'AVG':_0x78ee('0x87'),'GROUP_CONCAT':_0x78ee('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x78ee('0x88')};var _0x2e0249={'SEC_TO_TIME':_0x78ee('0x61'),'DATE':_0x78ee('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x78ee('0x89'),'UNIX_TIMESTAMP':_0x78ee('0x63')};var _0x4cdb2b=function(_0x337026){return!_[_0x78ee('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x78ee('0x8a'),_0x78ee('0x67')],_0x337026);};var _0x28b967=function(_0x7af18c){if(!_0x7af18c||!_0x7af18c[_0x78ee('0x68')]['length']){return'';}for(var _0x32e7be='(',_0x5719e5=0x0;_0x5719e5<_0x7af18c['rules'][_0x78ee('0x36')];_0x5719e5+=0x1){_0x5719e5>0x0&&(_0x32e7be+='\x20'+_0x7af18c['operator']+'\x20');_0x32e7be+=_0x7af18c['rules'][_0x5719e5][_0x78ee('0x76')]?_0x28b967(_0x7af18c['rules'][_0x5719e5][_0x78ee('0x76')]):_0x7af18c[_0x78ee('0x68')][_0x5719e5][_0x78ee('0x69')]+'\x20'+_0x7af18c['rules'][_0x5719e5][_0x78ee('0x6a')]+(_0x4cdb2b(_0x7af18c[_0x78ee('0x68')][_0x5719e5][_0x78ee('0x6a')])?'\x20'+_0x7af18c[_0x78ee('0x68')][_0x5719e5][_0x78ee('0x6b')]:'');}return _0x32e7be+')';};var _0x14feb4={'where':{'id':_0x29a69c['id']}},_0x155f99,_0xed246a,_0xa09984,_0x21a852,_0x28b2a2;_0x14feb4=_[_0x78ee('0x3d')]({},_0x14feb4,_0x3c0e3a);return db[_0x78ee('0x3f')][_0x78ee('0x4f')](_0x14feb4)[_0x78ee('0x24')](function(_0x4274fb){if(_0x4274fb){_0x155f99=_0x4274fb;return _0x4274fb['getFields']();}return null;})[_0x78ee('0x24')](function(_0x8933da){if(_0x8933da){if(!_0x8933da['length']){throw new db[(_0x78ee('0x6c'))]['ValidationErrorItem'](_0x78ee('0x6e'),0x193);}_0xed246a=_0x8933da;return db[_0x78ee('0x8b')][_0x78ee('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x49dbad){if(_0x49dbad){_0xa09984=_['keyBy'](_0x49dbad,'id');var _0x4998b6;var _0x3c4ac8=squel[_0x78ee('0x8c')]();_0x3c4ac8[_0x78ee('0x8d')](_0x155f99[_0x78ee('0x70')]);for(var _0x9948e6=0x0;_0x9948e6<_0xed246a['length'];_0x9948e6+=0x1){_0x4998b6=_0xed246a[_0x9948e6][_0x78ee('0x71')]?_0xa09984[_0xed246a[_0x9948e6][_0x78ee('0x71')]][_0x78ee('0x8e')]:_0xed246a[_0x9948e6][_0x78ee('0x69')];_0x4998b6=_0xed246a[_0x9948e6][_0x78ee('0x72')]?_[_0x78ee('0x73')](_0x592ca4[_0xed246a[_0x9948e6][_0x78ee('0x72')]],'%s',_0x4998b6):_0x4998b6;_0x4998b6=_0xed246a[_0x9948e6]['format']?_['replace'](_0x2e0249[_0xed246a[_0x9948e6][_0x78ee('0x74')]],'%s',_0x4998b6):_0x4998b6;if(_0xed246a[_0x9948e6]['groupBy']){_0x3c4ac8['group'](_0x4998b6);}_0xed246a[_0x9948e6][_0x78ee('0x77')]&&_0x3c4ac8[_0x78ee('0x38')](_0x4998b6,_0xed246a[_0x9948e6][_0x78ee('0x77')]===_0x78ee('0x78')?![]:!![]);_0x3c4ac8[_0x78ee('0x69')](_0x4998b6,_0xed246a[_0x9948e6][_0x78ee('0x79')]||_0x4998b6);}if(_0x155f99['joins']){_0x155f99[_0x78ee('0x7a')]=JSON['parse'](_0x155f99[_0x78ee('0x7a')]);for(var _0x405481=0x0;_0x405481<_0x155f99['joins'][_0x78ee('0x36')];_0x405481+=0x1){if(_0x155f99[_0x78ee('0x7a')][_0x405481][_0x78ee('0x2d')]&&_[_0x78ee('0x64')](_0x2a87a1,_0x155f99[_0x78ee('0x7a')][_0x405481][_0x78ee('0x2d')])&&_0x155f99[_0x78ee('0x7a')][_0x405481][_0x78ee('0x7c')]&&_0x155f99[_0x78ee('0x7a')][_0x405481][_0x78ee('0x7d')]&&_0x155f99['joins'][_0x405481][_0x78ee('0x7e')]){_0x3c4ac8[_0x155f99[_0x78ee('0x7a')][_0x405481]['type']](_0x155f99[_0x78ee('0x7a')][_0x405481][_0x78ee('0x7d')],null,util[_0x78ee('0x74')](_0x78ee('0x7f'),_0x155f99[_0x78ee('0x70')],_0x155f99['joins'][_0x405481]['parentKey'],_0x155f99['joins'][_0x405481][_0x78ee('0x7d')],_0x155f99[_0x78ee('0x7a')][_0x405481]['foreignKey']));}}}if(_0x155f99[_0x78ee('0x80')]){_0x155f99[_0x78ee('0x80')]=JSON[_0x78ee('0x7b')](_0x155f99[_0x78ee('0x80')]);_0x3c4ac8[_0x78ee('0x3a')](_0x28b967(_0x155f99[_0x78ee('0x80')][_0x78ee('0x76')]));}_0x28b2a2=_0x3c4ac8[_0x78ee('0x8f')]();_0x3c4ac8['limit'](_0x55719a);_0x3c4ac8['offset'](0x0);return;}})[_0x78ee('0x24')](function(){if(_0x28c8b8[_0x78ee('0x90')]==='web'){return null;}var _0x2273f3=_[_0x78ee('0x3d')](_0x28c8b8,{'name':_0x28c8b8[_0x78ee('0x91')]||_0x28c8b8[_0x78ee('0x2a')]||_0x155f99[_0x78ee('0x2a')],'basename':_0x13e4dd,'savename':util[_0x78ee('0x74')]('%s-%s.%s',_0x28c8b8[_0x78ee('0x2a')]||_0x155f99[_0x78ee('0x2a')],require(_0x78ee('0x92'))[_0x78ee('0x93')](0x4),_0x28c8b8[_0x78ee('0x90')]||_0x78ee('0x94')),'reportId':_0x155f99['id'],'reportType':_0x78ee('0x95')});return db[_0x78ee('0x96')][_0x78ee('0x47')](_0x2273f3,{'raw':!![]});})[_0x78ee('0x24')](function(_0x36cee1){if(_0x155f99[_0x78ee('0x70')]===_0x78ee('0x97')){_0x28b2a2[_0x78ee('0x3a')](_0x155f99[_0x78ee('0x70')]+_0x78ee('0x98'),_0x28c8b8[_0x78ee('0x99')],_0x28c8b8[_0x78ee('0x9a')]);}else{_0x28b2a2[_0x78ee('0x3a')](_0x155f99[_0x78ee('0x70')]+_0x78ee('0x9b'),_0x28c8b8[_0x78ee('0x99')],_0x28c8b8[_0x78ee('0x9a')]);}if(_0x36cee1){logger[_0x78ee('0x9c')](_0x78ee('0x9d'),_0x28b2a2[_0x78ee('0x83')]());require(_0x78ee('0x9e'))['fork'](path[_0x78ee('0x56')](__dirname,_0x78ee('0x9f'),_0x36cee1[_0x78ee('0x90')]),[_0x36cee1['id'],_0x28b2a2[_0x78ee('0x83')](),path[_0x78ee('0x56')](__dirname,_0x78ee('0xa0'),_0x36cee1['savename']),_0x13e4dd]);return _0x36cee1;}else{var _0x4d803f=squel[_0x78ee('0x8c')]();_0x4d803f['from']('('+_0x28b2a2[_0x78ee('0x83')]()+')',_0x78ee('0xa1'));_0x4d803f[_0x78ee('0x69')](_0x78ee('0xa2'),_0x78ee('0x1d'));_0x28b2a2[_0x78ee('0x1c')](_0x28c8b8[_0x78ee('0x1c')]||_0x55719a);_0x28b2a2[_0x78ee('0x1e')](_0x28c8b8[_0x78ee('0x1e')]||0x0);return dbH[_0x78ee('0x84')][_0x78ee('0x30')](_0x4d803f[_0x78ee('0x83')](),{'type':dbH[_0x78ee('0x84')][_0x78ee('0x85')][_0x78ee('0x86')]})[_0x78ee('0x24')](function(_0x3ec480){if(!_0x3ec480[_0x78ee('0x36')]){_0x21a852=0x0;}else{_0x21a852=_0x3ec480[0x0]['count']||0x0;}return dbH[_0x78ee('0x84')][_0x78ee('0x30')](_0x28b2a2[_0x78ee('0x83')](),{'type':dbH[_0x78ee('0x84')]['QueryTypes'][_0x78ee('0x86')]});})[_0x78ee('0x24')](function(_0x228c45){return{'rows':_0x228c45||[],'count':_0x21a852};});}});}exports[_0x78ee('0xa3')]=function(_0x2bf43d,_0x5f4d9d){return runReport(_0x2bf43d[_0x78ee('0x45')],_0x2bf43d['query'],_0x2bf43d[_0x78ee('0x46')])[_0x78ee('0x24')](respondWithResult(_0x5f4d9d,null))[_0x78ee('0x43')](handleError(_0x5f4d9d,null));};exports['runReport']=runReport;exports[_0x78ee('0x30')]=function(_0x2021fb,_0x3c2f95){var _0x4b8967=0xa;var _0x132596=[_0x78ee('0x56'),'left_join','right_join',_0x78ee('0x59')];var _0x27e3e3={'SUM':_0x78ee('0x5a'),'COUNT':_0x78ee('0x5b'),'COUNT DISTINCT':_0x78ee('0x5c'),'MAX':_0x78ee('0x5d'),'MIN':_0x78ee('0x5e'),'AVG':_0x78ee('0x87'),'GROUP_CONCAT':_0x78ee('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x78ee('0x88')};var _0x395daa={'SEC_TO_TIME':_0x78ee('0x61'),'DATE':_0x78ee('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x78ee('0x89'),'UNIX_TIMESTAMP':_0x78ee('0x63')};var _0x244d3b=function(_0x361d38){return!_[_0x78ee('0x64')]([_0x78ee('0x65'),_0x78ee('0x66'),_0x78ee('0x8a'),_0x78ee('0x67')],_0x361d38);};var _0x2045aa=function(_0x2a73cc){if(!_0x2a73cc||!_0x2a73cc[_0x78ee('0x68')][_0x78ee('0x36')]){return'';}for(var _0x4691b7='(',_0x557a95=0x0;_0x557a95<_0x2a73cc['rules']['length'];_0x557a95+=0x1){_0x557a95>0x0&&(_0x4691b7+='\x20'+_0x2a73cc['operator']+'\x20');_0x4691b7+=_0x2a73cc['rules'][_0x557a95][_0x78ee('0x76')]?_0x2045aa(_0x2a73cc[_0x78ee('0x68')][_0x557a95][_0x78ee('0x76')]):_0x2a73cc[_0x78ee('0x68')][_0x557a95][_0x78ee('0x69')]+'\x20'+_0x2a73cc[_0x78ee('0x68')][_0x557a95]['condition']+(_0x244d3b(_0x2a73cc[_0x78ee('0x68')][_0x557a95][_0x78ee('0x6a')])?'\x20'+_0x2a73cc[_0x78ee('0x68')][_0x557a95]['value']:'');}return _0x4691b7+')';};var _0x280214={'where':{'id':_0x2021fb[_0x78ee('0x45')]['id']}},_0x30a18e,_0x3203d6,_0x3de62a,_0x55df4a,_0x9c236e;_0x280214=_[_0x78ee('0x3d')]({},_0x280214,_0x2021fb['options']);return db[_0x78ee('0x3f')]['find'](_0x280214)['then'](function(_0x2dca03){if(_0x2dca03){_0x30a18e=_0x2dca03;return _0x2dca03[_0x78ee('0xa4')]();}return null;})['then'](function(_0x318c2c){if(_0x318c2c){if(!_0x318c2c[_0x78ee('0x36')]){throw new db[(_0x78ee('0x6c'))][(_0x78ee('0x6d'))](_0x78ee('0x6e'),0x193);}_0x3203d6=_0x318c2c;return db[_0x78ee('0x8b')]['findAll']({'raw':!![]});}return null;})[_0x78ee('0x24')](function(_0xcb892){if(_0xcb892){_0x3de62a=_[_0x78ee('0xa5')](_0xcb892,'id');var _0x3f566c;var _0x1325b7=squel[_0x78ee('0x8c')]();_0x1325b7['from'](_0x30a18e[_0x78ee('0x70')]);for(var _0x3533f1=0x0;_0x3533f1<_0x3203d6[_0x78ee('0x36')];_0x3533f1+=0x1){_0x3f566c=_0x3203d6[_0x3533f1][_0x78ee('0x71')]?_0x3de62a[_0x3203d6[_0x3533f1][_0x78ee('0x71')]][_0x78ee('0x8e')]:_0x3203d6[_0x3533f1][_0x78ee('0x69')];_0x3f566c=_0x3203d6[_0x3533f1][_0x78ee('0x72')]?_['replace'](_0x27e3e3[_0x3203d6[_0x3533f1]['function']],'%s',_0x3f566c):_0x3f566c;_0x3f566c=_0x3203d6[_0x3533f1][_0x78ee('0x74')]?_[_0x78ee('0x73')](_0x395daa[_0x3203d6[_0x3533f1][_0x78ee('0x74')]],'%s',_0x3f566c):_0x3f566c;if(_0x3203d6[_0x3533f1][_0x78ee('0x75')]){_0x1325b7[_0x78ee('0x76')](_0x3f566c);}_0x3203d6[_0x3533f1][_0x78ee('0x77')]&&_0x1325b7[_0x78ee('0x38')](_0x3f566c,_0x3203d6[_0x3533f1][_0x78ee('0x77')]===_0x78ee('0x78')?![]:!![]);_0x1325b7['field'](_0x3f566c,_0x3203d6[_0x3533f1]['alias']||_0x3f566c);}if(_0x30a18e[_0x78ee('0x7a')]){_0x30a18e['joins']=JSON['parse'](_0x30a18e[_0x78ee('0x7a')]);for(var _0x3c99e4=0x0;_0x3c99e4<_0x30a18e[_0x78ee('0x7a')]['length'];_0x3c99e4+=0x1){if(_0x30a18e[_0x78ee('0x7a')][_0x3c99e4]['type']&&_[_0x78ee('0x64')](_0x132596,_0x30a18e['joins'][_0x3c99e4][_0x78ee('0x2d')])&&_0x30a18e['joins'][_0x3c99e4][_0x78ee('0x7c')]&&_0x30a18e[_0x78ee('0x7a')][_0x3c99e4][_0x78ee('0x7d')]&&_0x30a18e[_0x78ee('0x7a')][_0x3c99e4][_0x78ee('0x7e')]){_0x1325b7[_0x30a18e[_0x78ee('0x7a')][_0x3c99e4][_0x78ee('0x2d')]](_0x30a18e[_0x78ee('0x7a')][_0x3c99e4][_0x78ee('0x7d')],null,util[_0x78ee('0x74')](_0x78ee('0x7f'),_0x30a18e[_0x78ee('0x70')],_0x30a18e[_0x78ee('0x7a')][_0x3c99e4][_0x78ee('0x7c')],_0x30a18e[_0x78ee('0x7a')][_0x3c99e4][_0x78ee('0x7d')],_0x30a18e['joins'][_0x3c99e4][_0x78ee('0x7e')]));}}}if(_0x30a18e[_0x78ee('0x80')]){_0x30a18e[_0x78ee('0x80')]=JSON['parse'](_0x30a18e[_0x78ee('0x80')]);_0x1325b7[_0x78ee('0x3a')](_0x2045aa(_0x30a18e['conditions'][_0x78ee('0x76')]));}_0x9c236e=_0x1325b7[_0x78ee('0x8f')]();_0x1325b7[_0x78ee('0x1c')](_0x4b8967);_0x1325b7[_0x78ee('0x1e')](0x0);logger[_0x78ee('0x81')](_0x78ee('0x82'),_0x1325b7[_0x78ee('0x83')]());return dbH['sequelize']['query'](_0x1325b7[_0x78ee('0x83')](),{'type':dbH[_0x78ee('0x84')][_0x78ee('0x85')][_0x78ee('0x86')]});}})[_0x78ee('0x24')](function(){return{'sql':_0x9c236e[_0x78ee('0x83')]()};})[_0x78ee('0x24')](respondWithResult(_0x3c2f95,null))[_0x78ee('0x43')](handleError(_0x3c2f95,null));}; \ No newline at end of file +var _0x977f=['reject','save','update','then','destroy','CustomReports','sendStatus','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','query','filters','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','rows','catch','params','keys','intersection','length','include','find','create','body','user','get','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','value','orderBy','DESC','parentKey','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','savename','select','COUNT(*)','SELECT','run','runReport','findAll','debug','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','dbH','status','offset','undefined','Content-Range','json'];(function(_0x331dfe,_0x13f0fc){var _0x104132=function(_0x41de65){while(--_0x41de65){_0x331dfe['push'](_0x331dfe['shift']());}};_0x104132(++_0x13f0fc);}(_0x977f,0x1d7));var _0xf977=function(_0x13aee3,_0x500a70){_0x13aee3=_0x13aee3-0x0;var _0x3cb89d=_0x977f[_0x13aee3];return _0x3cb89d;};'use strict';var emlformat=require(_0xf977('0x0'));var rimraf=require(_0xf977('0x1'));var zipdir=require(_0xf977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf977('0x3'));var moment=require(_0xf977('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf977('0x5'));var util=require(_0xf977('0x6'));var path=require('path');var sox=require(_0xf977('0x7'));var csv=require('to-csv');var ejs=require(_0xf977('0x8'));var fs=require('fs');var fs_extra=require(_0xf977('0x9'));var _=require(_0xf977('0xa'));var squel=require(_0xf977('0xb'));var crypto=require(_0xf977('0xc'));var jsforce=require(_0xf977('0xd'));var deskjs=require(_0xf977('0xe'));var toCsv=require(_0xf977('0xf'));var querystring=require(_0xf977('0x10'));var Papa=require(_0xf977('0x11'));var Redis=require('ioredis');var authService=require(_0xf977('0x12'));var qs=require(_0xf977('0x13'));var as=require(_0xf977('0x14'));var hardwareService=require(_0xf977('0x15'));var logger=require(_0xf977('0x16'))(_0xf977('0x17'));var utils=require(_0xf977('0x18'));var config=require(_0xf977('0x19'));var licenseUtil=require(_0xf977('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf977('0x1b')];function respondWithStatusCode(_0x44e8dd,_0x4bdc7c){_0x4bdc7c=_0x4bdc7c||0xcc;return function(_0x1ee804){if(_0x1ee804){return _0x44e8dd['sendStatus'](_0x4bdc7c);}return _0x44e8dd['status'](_0x4bdc7c)['end']();};}function respondWithResult(_0x18510,_0x1be79c){_0x1be79c=_0x1be79c||0xc8;return function(_0x348afb){if(_0x348afb){return _0x18510[_0xf977('0x1c')](_0x1be79c)['json'](_0x348afb);}};}function respondWithFilteredResult(_0x46d27b,_0x3b34f6){return function(_0x3253ce){if(_0x3253ce){var _0x235dd7=typeof _0x3b34f6[_0xf977('0x1d')]===_0xf977('0x1e')&&typeof _0x3b34f6['limit']===_0xf977('0x1e');var _0x37ee57=_0x3253ce['count'];var _0x5b1568=_0x235dd7?0x0:_0x3b34f6[_0xf977('0x1d')];var _0x57be9e=_0x235dd7?_0x3253ce['count']:_0x3b34f6[_0xf977('0x1d')]+_0x3b34f6['limit'];var _0x1e64d0;if(_0x57be9e>=_0x37ee57){_0x57be9e=_0x37ee57;_0x1e64d0=0xc8;}else{_0x1e64d0=0xce;}_0x46d27b['status'](_0x1e64d0);return _0x46d27b['set'](_0xf977('0x1f'),_0x5b1568+'-'+_0x57be9e+'/'+_0x37ee57)[_0xf977('0x20')](_0x3253ce);}return null;};}function patchUpdates(_0x5d9b12){return function(_0x45ac11){try{jsonpatch['apply'](_0x45ac11,_0x5d9b12,!![]);}catch(_0x453aa0){return BPromise[_0xf977('0x21')](_0x453aa0);}return _0x45ac11[_0xf977('0x22')]();};}function saveUpdates(_0x1de7c8,_0x4ba9c8){return function(_0x4363ed){if(_0x4363ed){return _0x4363ed[_0xf977('0x23')](_0x1de7c8)[_0xf977('0x24')](function(_0x3cf169){return _0x3cf169;});}return null;};}function removeEntity(_0x563dd5,_0x397274){return function(_0x56eab7){if(_0x56eab7){return _0x56eab7[_0xf977('0x25')]()[_0xf977('0x24')](function(){var _0x5104d4=_0x56eab7['get']({'plain':!![]});var _0x1fa1ea=_0xf977('0x26');return db['UserProfileResource'][_0xf977('0x25')]({'where':{'type':_0x1fa1ea,'resourceId':_0x5104d4['id']}})[_0xf977('0x24')](function(){return _0x56eab7;});})[_0xf977('0x24')](function(){_0x563dd5[_0xf977('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3faa4c,_0x2f151f){return function(_0x3b7f51){if(!_0x3b7f51){_0x3faa4c[_0xf977('0x27')](0x194);}return _0x3b7f51;};}function handleError(_0x7e06f6,_0x14c492){_0x14c492=_0x14c492||0x1f4;return function(_0x5e74dc){logger[_0xf977('0x28')](_0x5e74dc[_0xf977('0x29')]);if(_0x5e74dc[_0xf977('0x2a')]){delete _0x5e74dc[_0xf977('0x2a')];}_0x7e06f6[_0xf977('0x1c')](_0x14c492)[_0xf977('0x2b')](_0x5e74dc);};}exports[_0xf977('0x2c')]=function(_0x3ab637,_0x4d9ba8){var _0x113e08={},_0x208fa0={},_0x472597={'count':0x0,'rows':[]};var _0xb5eed7=_['map'](db[_0xf977('0x2d')][_0xf977('0x2e')],function(_0x4e472a){return{'name':_0x4e472a[_0xf977('0x2f')],'type':_0x4e472a['type'][_0xf977('0x30')]};});_0x208fa0[_0xf977('0x31')]=_[_0xf977('0x32')](_0xb5eed7,_0xf977('0x2a'));_0x208fa0[_0xf977('0x33')]=_['keys'](_0x3ab637['query']);_0x208fa0[_0xf977('0x34')]=_['intersection'](_0x208fa0[_0xf977('0x31')],_0x208fa0[_0xf977('0x33')]);_0x113e08['attributes']=_['intersection'](_0x208fa0[_0xf977('0x31')],qs[_0xf977('0x35')](_0x3ab637['query']['fields']));_0x113e08[_0xf977('0x36')]=_0x113e08[_0xf977('0x36')]['length']?_0x113e08[_0xf977('0x36')]:_0x208fa0[_0xf977('0x31')];if(!_0x3ab637['query'][_0xf977('0x37')]('nolimit')){_0x113e08[_0xf977('0x38')]=qs[_0xf977('0x38')](_0x3ab637[_0xf977('0x33')][_0xf977('0x38')]);_0x113e08[_0xf977('0x1d')]=qs[_0xf977('0x1d')](_0x3ab637['query'][_0xf977('0x1d')]);}_0x113e08[_0xf977('0x39')]=qs[_0xf977('0x3a')](_0x3ab637['query'][_0xf977('0x3a')]);_0x113e08[_0xf977('0x3b')]=qs[_0xf977('0x34')](_['pick'](_0x3ab637['query'],_0x208fa0[_0xf977('0x34')]),_0xb5eed7);if(_0x3ab637['query'][_0xf977('0x3c')]){_0x113e08[_0xf977('0x3b')]=_[_0xf977('0x3d')](_0x113e08[_0xf977('0x3b')],{'$or':_[_0xf977('0x32')](_0xb5eed7,function(_0x30d32a){if(_0x30d32a[_0xf977('0x3e')]!==_0xf977('0x3f')){var _0x5ad59f={};_0x5ad59f[_0x30d32a[_0xf977('0x2a')]]={'$like':'%'+_0x3ab637[_0xf977('0x33')]['filter']+'%'};return _0x5ad59f;}})});}_0x113e08=_[_0xf977('0x3d')]({},_0x113e08,_0x3ab637[_0xf977('0x40')]);var _0x31b65a={'where':_0x113e08[_0xf977('0x3b')]};return db[_0xf977('0x2d')][_0xf977('0x41')](_0x31b65a)['then'](function(_0x38bc3e){_0x472597[_0xf977('0x41')]=_0x38bc3e;if(_0x3ab637[_0xf977('0x33')][_0xf977('0x42')]){_0x113e08['include']=[{'all':!![]}];}return db[_0xf977('0x2d')]['findAll'](_0x113e08);})[_0xf977('0x24')](function(_0x5ae644){_0x472597[_0xf977('0x43')]=_0x5ae644;return _0x472597;})['then'](respondWithFilteredResult(_0x4d9ba8,_0x113e08))[_0xf977('0x44')](handleError(_0x4d9ba8,null));};exports['show']=function(_0x443a95,_0x5cc677){var _0x5bbe7b={'raw':![],'where':{'id':_0x443a95[_0xf977('0x45')]['id']}},_0x5a4735={};_0x5a4735['model']=_[_0xf977('0x46')](db['AnalyticCustomReport'][_0xf977('0x2e')]);_0x5a4735[_0xf977('0x33')]=_[_0xf977('0x46')](_0x443a95[_0xf977('0x33')]);_0x5a4735[_0xf977('0x34')]=_[_0xf977('0x47')](_0x5a4735['model'],_0x5a4735[_0xf977('0x33')]);_0x5bbe7b[_0xf977('0x36')]=_['intersection'](_0x5a4735[_0xf977('0x31')],qs[_0xf977('0x35')](_0x443a95[_0xf977('0x33')][_0xf977('0x35')]));_0x5bbe7b[_0xf977('0x36')]=_0x5bbe7b['attributes'][_0xf977('0x48')]?_0x5bbe7b[_0xf977('0x36')]:_0x5a4735[_0xf977('0x31')];if(_0x443a95['query'][_0xf977('0x42')]){_0x5bbe7b[_0xf977('0x49')]=[{'all':!![]}];}_0x5bbe7b=_[_0xf977('0x3d')]({},_0x5bbe7b,_0x443a95[_0xf977('0x40')]);return db[_0xf977('0x2d')][_0xf977('0x4a')](_0x5bbe7b)[_0xf977('0x24')](handleEntityNotFound(_0x5cc677,null))[_0xf977('0x24')](respondWithResult(_0x5cc677,null))['catch'](handleError(_0x5cc677,null));};exports[_0xf977('0x4b')]=function(_0x450d5f,_0x35b3c4){return db[_0xf977('0x2d')]['create'](_0x450d5f[_0xf977('0x4c')],{})[_0xf977('0x24')](function(_0x226bda){var _0x2e9ff9=_0x450d5f[_0xf977('0x4d')][_0xf977('0x4e')]({'plain':!![]});if(!_0x2e9ff9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e9ff9[_0xf977('0x4f')]===_0xf977('0x4d')){var _0x21eae9=_0x226bda[_0xf977('0x4e')]({'plain':!![]});var _0x4cc6e2=_0xf977('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x4cc6e2,'userProfileId':_0x2e9ff9[_0xf977('0x51')]},'raw':!![]})[_0xf977('0x24')](function(_0x31b092){if(_0x31b092&&_0x31b092[_0xf977('0x52')]===0x0){return db[_0xf977('0x53')][_0xf977('0x4b')]({'name':_0x21eae9[_0xf977('0x2a')],'resourceId':_0x21eae9['id'],'type':_0xf977('0x26'),'sectionId':_0x31b092['id']},{})['then'](function(){return _0x226bda;});}else{return _0x226bda;}})['catch'](function(_0x22d140){logger[_0xf977('0x28')](_0xf977('0x54'),_0x22d140);throw _0x22d140;});}return _0x226bda;})[_0xf977('0x24')](respondWithResult(_0x35b3c4,0xc9))['catch'](handleError(_0x35b3c4,null));};exports[_0xf977('0x23')]=function(_0x21fddd,_0x395bd0){if(_0x21fddd['body']['id']){delete _0x21fddd[_0xf977('0x4c')]['id'];}return db[_0xf977('0x2d')][_0xf977('0x4a')]({'where':{'id':_0x21fddd[_0xf977('0x45')]['id']}})[_0xf977('0x24')](handleEntityNotFound(_0x395bd0,null))['then'](saveUpdates(_0x21fddd[_0xf977('0x4c')],null))[_0xf977('0x24')](respondWithResult(_0x395bd0,null))[_0xf977('0x44')](handleError(_0x395bd0,null));};exports[_0xf977('0x25')]=function(_0x162203,_0x4bea88){return db[_0xf977('0x2d')]['find']({'where':{'id':_0x162203['params']['id']}})[_0xf977('0x24')](handleEntityNotFound(_0x4bea88,null))[_0xf977('0x24')](removeEntity(_0x4bea88,null))['catch'](handleError(_0x4bea88,null));};exports[_0xf977('0x55')]=function(_0x4ce1c6,_0x439cc4){var _0x2fef31=0xa;var _0x152f8f=[_0xf977('0x56'),'left_join','right_join',_0xf977('0x57')];var _0x15453e={'SUM':'SUM(%s)','COUNT':_0xf977('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf977('0x59'),'MIN':_0xf977('0x5a'),'AVG':_0xf977('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf977('0x5c'),'GROUP_CONCAT DESC':_0xf977('0x5d')};var _0x21b170={'SEC_TO_TIME':_0xf977('0x5e'),'DATE':'DATE(%s)','HOUR':_0xf977('0x5f'),'ROUND':_0xf977('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ae985=function(_0x591ac6){return!_[_0xf977('0x61')]([_0xf977('0x62'),_0xf977('0x63'),_0xf977('0x64'),_0xf977('0x65')],_0x591ac6);};var _0x19394b=function(_0x2eea65){if(!_0x2eea65||!_0x2eea65[_0xf977('0x66')][_0xf977('0x48')]){return'';}for(var _0x3bb17a='(',_0x1bd0bb=0x0;_0x1bd0bb<_0x2eea65[_0xf977('0x66')][_0xf977('0x48')];_0x1bd0bb+=0x1){_0x1bd0bb>0x0&&(_0x3bb17a+='\x20'+_0x2eea65[_0xf977('0x67')]+'\x20');_0x3bb17a+=_0x2eea65['rules'][_0x1bd0bb][_0xf977('0x68')]?_0x19394b(_0x2eea65[_0xf977('0x66')][_0x1bd0bb][_0xf977('0x68')]):_0x2eea65[_0xf977('0x66')][_0x1bd0bb][_0xf977('0x69')]+'\x20'+_0x2eea65[_0xf977('0x66')][_0x1bd0bb]['condition']+(_0x2ae985(_0x2eea65['rules'][_0x1bd0bb][_0xf977('0x6a')])?'\x20'+_0x2eea65[_0xf977('0x66')][_0x1bd0bb]['value']:'');}return _0x3bb17a+')';};var _0x42c256={'where':{'id':_0x4ce1c6['params']['id']}},_0x546d1f,_0x5183c8,_0x5e7860,_0xf7ab94,_0x357350;_0x42c256=_['merge']({},_0x42c256,_0x4ce1c6[_0xf977('0x40')]);return db[_0xf977('0x2d')]['find'](_0x42c256)[_0xf977('0x24')](function(_0xe66c8a){if(_0xe66c8a){_0x546d1f=_0xe66c8a;return _0xe66c8a[_0xf977('0x6b')]();}return null;})[_0xf977('0x24')](function(_0x563244){if(_0x563244){if(!_0x563244[_0xf977('0x48')]){throw new db[(_0xf977('0x6c'))][(_0xf977('0x6d'))](_0xf977('0x6e'),0x193);}_0x5183c8=_0x563244;return db[_0xf977('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xf977('0x24')](function(_0x2ea6ca){if(_0x2ea6ca){_0x5e7860=_[_0xf977('0x70')](_0x2ea6ca,'id');var _0x1bf08f;var _0x24d520=squel['select']();_0x24d520[_0xf977('0x71')](_0x546d1f[_0xf977('0x72')]);for(var _0x5d339e=0x0;_0x5d339e<_0x5183c8[_0xf977('0x48')];_0x5d339e+=0x1){_0x1bf08f=_0x5183c8[_0x5d339e][_0xf977('0x73')]?_0x5e7860[_0x5183c8[_0x5d339e][_0xf977('0x73')]][_0xf977('0x74')]:_0x5183c8[_0x5d339e]['field'];_0x1bf08f=_0x5183c8[_0x5d339e][_0xf977('0x75')]?_[_0xf977('0x76')](_0x15453e[_0x5183c8[_0x5d339e][_0xf977('0x75')]],'%s',_0x1bf08f):_0x1bf08f;_0x1bf08f=_0x5183c8[_0x5d339e][_0xf977('0x77')]?_[_0xf977('0x76')](_0x21b170[_0x5183c8[_0x5d339e][_0xf977('0x77')]],'%s',_0x1bf08f):_0x1bf08f;if(_0x5183c8[_0x5d339e][_0xf977('0x78')]){_0x24d520[_0xf977('0x68')](_0x1bf08f);}_0x5183c8[_0x5d339e]['orderBy']&&_0x24d520[_0xf977('0x39')](_0x1bf08f,_0x5183c8[_0x5d339e]['orderBy']==='DESC'?![]:!![]);_0x24d520[_0xf977('0x69')](_0x1bf08f,_0x5183c8[_0x5d339e][_0xf977('0x79')]||_0x1bf08f);}if(_0x546d1f[_0xf977('0x7a')]){_0x546d1f['joins']=JSON[_0xf977('0x7b')](_0x546d1f['joins']);for(var _0x1ee1fe=0x0;_0x1ee1fe<_0x546d1f[_0xf977('0x7a')][_0xf977('0x48')];_0x1ee1fe+=0x1){if(_0x546d1f[_0xf977('0x7a')][_0x1ee1fe]['type']&&_['includes'](_0x152f8f,_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x3e')])&&_0x546d1f['joins'][_0x1ee1fe]['parentKey']&&_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x7c')]&&_0x546d1f['joins'][_0x1ee1fe][_0xf977('0x7d')]){_0x24d520[_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x3e')]](_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x7c')],null,util['format'](_0xf977('0x7e'),_0x546d1f[_0xf977('0x72')],_0x546d1f['joins'][_0x1ee1fe]['parentKey'],_0x546d1f[_0xf977('0x7a')][_0x1ee1fe][_0xf977('0x7c')],_0x546d1f[_0xf977('0x7a')][_0x1ee1fe]['foreignKey']));}}}if(_0x546d1f[_0xf977('0x7f')]){_0x546d1f[_0xf977('0x7f')]=JSON['parse'](_0x546d1f[_0xf977('0x7f')]);_0x24d520[_0xf977('0x3b')](_0x19394b(_0x546d1f['conditions'][_0xf977('0x68')]));}_0x357350=_0x24d520[_0xf977('0x80')]();_0x24d520[_0xf977('0x38')](_0x2fef31);_0x24d520[_0xf977('0x1d')](0x0);logger['debug'](_0xf977('0x81'),_0x24d520[_0xf977('0x82')]());return dbH['sequelize'][_0xf977('0x33')](_0x24d520[_0xf977('0x82')](),{'type':dbH[_0xf977('0x83')][_0xf977('0x84')]['SELECT']});}})[_0xf977('0x24')](respondWithResult(_0x439cc4,null))[_0xf977('0x44')](handleError(_0x439cc4,null));};function runReport(_0x3ce7ed,_0x4f9ae7,_0x19594f){var _0x4ee3e6=_0x4f9ae7[_0xf977('0x2a')];var _0x2b8424=0xa;var _0x238246=[_0xf977('0x56'),_0xf977('0x85'),_0xf977('0x86'),_0xf977('0x57')];var _0x223f58={'SUM':_0xf977('0x87'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf977('0x88'),'MAX':'MAX(%s)','MIN':_0xf977('0x5a'),'AVG':_0xf977('0x5b'),'GROUP_CONCAT':_0xf977('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf977('0x5d')};var _0x432b7d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf977('0x8a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf977('0x8b')};var _0x48c641=function(_0x2907d8){return!_[_0xf977('0x61')]([_0xf977('0x62'),_0xf977('0x63'),_0xf977('0x64'),_0xf977('0x65')],_0x2907d8);};var _0xd4f620=function(_0x308d82){if(!_0x308d82||!_0x308d82['rules']['length']){return'';}for(var _0x3e44a5='(',_0x776cea=0x0;_0x776cea<_0x308d82['rules'][_0xf977('0x48')];_0x776cea+=0x1){_0x776cea>0x0&&(_0x3e44a5+='\x20'+_0x308d82[_0xf977('0x67')]+'\x20');_0x3e44a5+=_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x68')]?_0xd4f620(_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x68')]):_0x308d82[_0xf977('0x66')][_0x776cea]['field']+'\x20'+_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x6a')]+(_0x48c641(_0x308d82['rules'][_0x776cea][_0xf977('0x6a')])?'\x20'+_0x308d82[_0xf977('0x66')][_0x776cea][_0xf977('0x8c')]:'');}return _0x3e44a5+')';};var _0x2cae22={'where':{'id':_0x3ce7ed['id']}},_0x3b599c,_0x374557,_0x20bce8,_0x4ed1a8,_0x2030a3;_0x2cae22=_[_0xf977('0x3d')]({},_0x2cae22,_0x19594f);return db[_0xf977('0x2d')][_0xf977('0x4a')](_0x2cae22)[_0xf977('0x24')](function(_0x2b8dd8){if(_0x2b8dd8){_0x3b599c=_0x2b8dd8;return _0x2b8dd8[_0xf977('0x6b')]();}return null;})[_0xf977('0x24')](function(_0xe2c2b9){if(_0xe2c2b9){if(!_0xe2c2b9[_0xf977('0x48')]){throw new db[(_0xf977('0x6c'))][(_0xf977('0x6d'))](_0xf977('0x6e'),0x193);}_0x374557=_0xe2c2b9;return db[_0xf977('0x6f')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x2dff45){if(_0x2dff45){_0x20bce8=_[_0xf977('0x70')](_0x2dff45,'id');var _0x5e5338;var _0x592d17=squel['select']();_0x592d17[_0xf977('0x71')](_0x3b599c[_0xf977('0x72')]);for(var _0x57937c=0x0;_0x57937c<_0x374557[_0xf977('0x48')];_0x57937c+=0x1){_0x5e5338=_0x374557[_0x57937c][_0xf977('0x73')]?_0x20bce8[_0x374557[_0x57937c][_0xf977('0x73')]]['metric']:_0x374557[_0x57937c]['field'];_0x5e5338=_0x374557[_0x57937c][_0xf977('0x75')]?_['replace'](_0x223f58[_0x374557[_0x57937c][_0xf977('0x75')]],'%s',_0x5e5338):_0x5e5338;_0x5e5338=_0x374557[_0x57937c][_0xf977('0x77')]?_[_0xf977('0x76')](_0x432b7d[_0x374557[_0x57937c][_0xf977('0x77')]],'%s',_0x5e5338):_0x5e5338;if(_0x374557[_0x57937c][_0xf977('0x78')]){_0x592d17[_0xf977('0x68')](_0x5e5338);}_0x374557[_0x57937c][_0xf977('0x8d')]&&_0x592d17[_0xf977('0x39')](_0x5e5338,_0x374557[_0x57937c][_0xf977('0x8d')]===_0xf977('0x8e')?![]:!![]);_0x592d17['field'](_0x5e5338,_0x374557[_0x57937c][_0xf977('0x79')]||_0x5e5338);}if(_0x3b599c[_0xf977('0x7a')]){_0x3b599c['joins']=JSON[_0xf977('0x7b')](_0x3b599c[_0xf977('0x7a')]);for(var _0x5be54c=0x0;_0x5be54c<_0x3b599c[_0xf977('0x7a')][_0xf977('0x48')];_0x5be54c+=0x1){if(_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x3e')]&&_['includes'](_0x238246,_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x3e')])&&_0x3b599c['joins'][_0x5be54c]['parentKey']&&_0x3b599c['joins'][_0x5be54c]['foreignTable']&&_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x7d')]){_0x592d17[_0x3b599c[_0xf977('0x7a')][_0x5be54c]['type']](_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x7c')],null,util[_0xf977('0x77')](_0xf977('0x7e'),_0x3b599c[_0xf977('0x72')],_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x8f')],_0x3b599c['joins'][_0x5be54c][_0xf977('0x7c')],_0x3b599c[_0xf977('0x7a')][_0x5be54c][_0xf977('0x7d')]));}}}if(_0x3b599c[_0xf977('0x7f')]){_0x3b599c[_0xf977('0x7f')]=JSON[_0xf977('0x7b')](_0x3b599c[_0xf977('0x7f')]);_0x592d17[_0xf977('0x3b')](_0xd4f620(_0x3b599c[_0xf977('0x7f')]['group']));}_0x2030a3=_0x592d17[_0xf977('0x80')]();_0x592d17['limit'](_0x2b8424);_0x592d17[_0xf977('0x1d')](0x0);return;}})[_0xf977('0x24')](function(){if(_0x4f9ae7['output']===_0xf977('0x90')){return null;}var _0x25bd9d=_['merge'](_0x4f9ae7,{'name':_0x4f9ae7[_0xf977('0x91')]||_0x4f9ae7['name']||_0x3b599c['name'],'basename':_0x4ee3e6,'savename':util[_0xf977('0x77')](_0xf977('0x92'),_0x4f9ae7['name']||_0x3b599c[_0xf977('0x2a')],require(_0xf977('0x93'))[_0xf977('0x94')](0x4),_0x4f9ae7[_0xf977('0x95')]||_0xf977('0x96')),'reportId':_0x3b599c['id'],'reportType':_0xf977('0x97')});return db[_0xf977('0x98')][_0xf977('0x4b')](_0x25bd9d,{'raw':!![]});})['then'](function(_0x4c8086){if(_0x3b599c[_0xf977('0x72')]==='cdr'){_0x2030a3[_0xf977('0x3b')](_0x3b599c[_0xf977('0x72')]+_0xf977('0x99'),_0x4f9ae7[_0xf977('0x9a')],_0x4f9ae7[_0xf977('0x9b')]);}else{_0x2030a3[_0xf977('0x3b')](_0x3b599c[_0xf977('0x72')]+_0xf977('0x9c'),_0x4f9ae7[_0xf977('0x9a')],_0x4f9ae7[_0xf977('0x9b')]);}if(_0x4c8086){logger[_0xf977('0x9d')](_0xf977('0x9e'),_0x2030a3[_0xf977('0x82')]());require(_0xf977('0x9f'))['fork'](path[_0xf977('0x56')](__dirname,'../../components/export/',_0x4c8086[_0xf977('0x95')]),[_0x4c8086['id'],_0x2030a3['toString'](),path[_0xf977('0x56')](__dirname,'../../files/reports',_0x4c8086[_0xf977('0xa0')]),_0x4ee3e6]);return _0x4c8086;}else{var _0x211c94=squel[_0xf977('0xa1')]();_0x211c94['from']('('+_0x2030a3[_0xf977('0x82')]()+')','countTable');_0x211c94[_0xf977('0x69')](_0xf977('0xa2'),'count');_0x2030a3[_0xf977('0x38')](_0x4f9ae7[_0xf977('0x38')]||_0x2b8424);_0x2030a3[_0xf977('0x1d')](_0x4f9ae7[_0xf977('0x1d')]||0x0);return dbH[_0xf977('0x83')][_0xf977('0x33')](_0x211c94['toString'](),{'type':dbH[_0xf977('0x83')]['QueryTypes'][_0xf977('0xa3')]})[_0xf977('0x24')](function(_0x5e5adc){if(!_0x5e5adc[_0xf977('0x48')]){_0x4ed1a8=0x0;}else{_0x4ed1a8=_0x5e5adc[0x0][_0xf977('0x41')]||0x0;}return dbH[_0xf977('0x83')]['query'](_0x2030a3[_0xf977('0x82')](),{'type':dbH['sequelize'][_0xf977('0x84')][_0xf977('0xa3')]});})['then'](function(_0x8bf85c){return{'rows':_0x8bf85c||[],'count':_0x4ed1a8};});}});}exports[_0xf977('0xa4')]=function(_0x392b7a,_0x576fc8){return runReport(_0x392b7a['params'],_0x392b7a[_0xf977('0x33')],_0x392b7a[_0xf977('0x40')])['then'](respondWithResult(_0x576fc8,null))[_0xf977('0x44')](handleError(_0x576fc8,null));};exports[_0xf977('0xa5')]=runReport;exports['query']=function(_0x1f0088,_0x460a3f){var _0x478c30=0xa;var _0x5db39f=[_0xf977('0x56'),_0xf977('0x85'),_0xf977('0x86'),_0xf977('0x57')];var _0x45a51a={'SUM':'SUM(%s)','COUNT':_0xf977('0x58'),'COUNT DISTINCT':_0xf977('0x88'),'MAX':_0xf977('0x59'),'MIN':_0xf977('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf977('0x89'),'GROUP_CONCAT ASC':_0xf977('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x42070a={'SEC_TO_TIME':_0xf977('0x5e'),'DATE':'DATE(%s)','HOUR':_0xf977('0x5f'),'ROUND':_0xf977('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3e0148=function(_0x524c2e){return!_[_0xf977('0x61')]([_0xf977('0x62'),_0xf977('0x63'),'IS\x20EMPTY',_0xf977('0x65')],_0x524c2e);};var _0x5729f5=function(_0x430575){if(!_0x430575||!_0x430575['rules']['length']){return'';}for(var _0x10f8a2='(',_0x461603=0x0;_0x461603<_0x430575[_0xf977('0x66')]['length'];_0x461603+=0x1){_0x461603>0x0&&(_0x10f8a2+='\x20'+_0x430575[_0xf977('0x67')]+'\x20');_0x10f8a2+=_0x430575[_0xf977('0x66')][_0x461603][_0xf977('0x68')]?_0x5729f5(_0x430575['rules'][_0x461603][_0xf977('0x68')]):_0x430575['rules'][_0x461603][_0xf977('0x69')]+'\x20'+_0x430575[_0xf977('0x66')][_0x461603][_0xf977('0x6a')]+(_0x3e0148(_0x430575['rules'][_0x461603][_0xf977('0x6a')])?'\x20'+_0x430575['rules'][_0x461603]['value']:'');}return _0x10f8a2+')';};var _0x559c4a={'where':{'id':_0x1f0088[_0xf977('0x45')]['id']}},_0x2acfdd,_0x16f072,_0x4266af,_0x44e60,_0x3195c9;_0x559c4a=_[_0xf977('0x3d')]({},_0x559c4a,_0x1f0088['options']);return db[_0xf977('0x2d')][_0xf977('0x4a')](_0x559c4a)[_0xf977('0x24')](function(_0x56839){if(_0x56839){_0x2acfdd=_0x56839;return _0x56839[_0xf977('0x6b')]();}return null;})[_0xf977('0x24')](function(_0x25a8e6){if(_0x25a8e6){if(!_0x25a8e6[_0xf977('0x48')]){throw new db['Sequelize'][(_0xf977('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x16f072=_0x25a8e6;return db['AnalyticMetric'][_0xf977('0xa6')]({'raw':!![]});}return null;})[_0xf977('0x24')](function(_0x1554d3){if(_0x1554d3){_0x4266af=_[_0xf977('0x70')](_0x1554d3,'id');var _0x7a9048;var _0x3345cf=squel[_0xf977('0xa1')]();_0x3345cf['from'](_0x2acfdd['table']);for(var _0x53c86f=0x0;_0x53c86f<_0x16f072['length'];_0x53c86f+=0x1){_0x7a9048=_0x16f072[_0x53c86f][_0xf977('0x73')]?_0x4266af[_0x16f072[_0x53c86f]['MetricId']][_0xf977('0x74')]:_0x16f072[_0x53c86f][_0xf977('0x69')];_0x7a9048=_0x16f072[_0x53c86f]['function']?_[_0xf977('0x76')](_0x45a51a[_0x16f072[_0x53c86f][_0xf977('0x75')]],'%s',_0x7a9048):_0x7a9048;_0x7a9048=_0x16f072[_0x53c86f][_0xf977('0x77')]?_['replace'](_0x42070a[_0x16f072[_0x53c86f][_0xf977('0x77')]],'%s',_0x7a9048):_0x7a9048;if(_0x16f072[_0x53c86f][_0xf977('0x78')]){_0x3345cf[_0xf977('0x68')](_0x7a9048);}_0x16f072[_0x53c86f][_0xf977('0x8d')]&&_0x3345cf[_0xf977('0x39')](_0x7a9048,_0x16f072[_0x53c86f][_0xf977('0x8d')]==='DESC'?![]:!![]);_0x3345cf['field'](_0x7a9048,_0x16f072[_0x53c86f][_0xf977('0x79')]||_0x7a9048);}if(_0x2acfdd[_0xf977('0x7a')]){_0x2acfdd[_0xf977('0x7a')]=JSON[_0xf977('0x7b')](_0x2acfdd[_0xf977('0x7a')]);for(var _0x3b62ba=0x0;_0x3b62ba<_0x2acfdd[_0xf977('0x7a')][_0xf977('0x48')];_0x3b62ba+=0x1){if(_0x2acfdd[_0xf977('0x7a')][_0x3b62ba]['type']&&_[_0xf977('0x61')](_0x5db39f,_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x3e')])&&_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x8f')]&&_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x7c')]&&_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x7d')]){_0x3345cf[_0x2acfdd[_0xf977('0x7a')][_0x3b62ba]['type']](_0x2acfdd[_0xf977('0x7a')][_0x3b62ba]['foreignTable'],null,util['format'](_0xf977('0x7e'),_0x2acfdd[_0xf977('0x72')],_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x8f')],_0x2acfdd[_0xf977('0x7a')][_0x3b62ba][_0xf977('0x7c')],_0x2acfdd['joins'][_0x3b62ba][_0xf977('0x7d')]));}}}if(_0x2acfdd[_0xf977('0x7f')]){_0x2acfdd['conditions']=JSON[_0xf977('0x7b')](_0x2acfdd['conditions']);_0x3345cf[_0xf977('0x3b')](_0x5729f5(_0x2acfdd['conditions'][_0xf977('0x68')]));}_0x3195c9=_0x3345cf['clone']();_0x3345cf[_0xf977('0x38')](_0x478c30);_0x3345cf['offset'](0x0);logger[_0xf977('0xa7')](_0xf977('0x81'),_0x3345cf[_0xf977('0x82')]());return dbH[_0xf977('0x83')][_0xf977('0x33')](_0x3345cf[_0xf977('0x82')](),{'type':dbH[_0xf977('0x83')]['QueryTypes'][_0xf977('0xa3')]});}})['then'](function(){return{'sql':_0x3195c9[_0xf977('0x82')]()};})[_0xf977('0x24')](respondWithResult(_0x460a3f,null))[_0xf977('0x44')](handleError(_0x460a3f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index fa9cda7..9d9a8ec 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 _0xf6a8=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf6a8,0x147));var _0x8f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f6a('0x0'));var util=require(_0x8f6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f6a('0x2'));var BPromise=require(_0x8f6a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f6a('0x4'));var rimraf=require(_0x8f6a('0x5'));var config=require(_0x8f6a('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0x8f6a('0x7')]=function(_0x19ac6e,_0xa5d25a){return _0x19ac6e[_0x8f6a('0x8')](_0x8f6a('0x9'),attributes,{'tableName':_0x8f6a('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfac0=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfac0,0xb0));var _0x0fac=function(_0x599307,_0x283e19){_0x599307=_0x599307-0x0;var _0x456e02=_0xfac0[_0x599307];return _0x456e02;};'use strict';var _=require(_0x0fac('0x0'));var util=require(_0x0fac('0x1'));var logger=require(_0x0fac('0x2'))(_0x0fac('0x3'));var moment=require(_0x0fac('0x4'));var BPromise=require(_0x0fac('0x5'));var rp=require(_0x0fac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fac('0x7'));var config=require(_0x0fac('0x8'));var attributes=require(_0x0fac('0x9'));module['exports']=function(_0x24835b,_0x29407a){return _0x24835b[_0x0fac('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x0fac('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9f43647..94ac255 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 _0xed87=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x13c006,_0x2284ab){var _0x13c8bd=function(_0x245b5d){while(--_0x245b5d){_0x13c006['push'](_0x13c006['shift']());}};_0x13c8bd(++_0x2284ab);}(_0xed87,0x1e1));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var moment=require('moment');var BPromise=require(_0x7ed8('0x2'));var rs=require(_0x7ed8('0x3'));var fs=require('fs');var Redis=require(_0x7ed8('0x4'));var db=require(_0x7ed8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ed8('0x6'));var config=require(_0x7ed8('0x7'));var jayson=require(_0x7ed8('0x8'));var client=jayson[_0x7ed8('0x9')][_0x7ed8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e7d3,_0x53e2fe,_0x12937a){return new BPromise(function(_0x7c3b5f,_0x4edd31){return client['request'](_0x20e7d3,_0x12937a)[_0x7ed8('0xb')](function(_0x5053a8){logger[_0x7ed8('0xc')](_0x7ed8('0xd'),_0x53e2fe,_0x7ed8('0xe'));logger[_0x7ed8('0xf')](_0x7ed8('0x10'),_0x53e2fe,'request\x20sent',JSON[_0x7ed8('0x11')](_0x5053a8));if(_0x5053a8['error']){if(_0x5053a8[_0x7ed8('0x12')]['code']===0x1f4){logger[_0x7ed8('0x12')](_0x7ed8('0xd'),_0x53e2fe,_0x5053a8[_0x7ed8('0x12')][_0x7ed8('0x13')]);return _0x4edd31(_0x5053a8[_0x7ed8('0x12')]['message']);}logger[_0x7ed8('0x12')](_0x7ed8('0xd'),_0x53e2fe,_0x5053a8[_0x7ed8('0x12')]['message']);return _0x7c3b5f(_0x5053a8[_0x7ed8('0x12')][_0x7ed8('0x13')]);}else{logger[_0x7ed8('0xc')](_0x7ed8('0xd'),_0x53e2fe,_0x7ed8('0xe'));_0x7c3b5f(_0x5053a8['result'][_0x7ed8('0x13')]);}})['catch'](function(_0x47e4c5){logger[_0x7ed8('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x53e2fe,_0x47e4c5);_0x4edd31(_0x47e4c5);});});} \ No newline at end of file +var _0xc6d2=['rpc','jayson/promise','client','http','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x2c1a16,_0x2e0cb4){var _0x51c0cf=function(_0x41e796){while(--_0x41e796){_0x2c1a16['push'](_0x2c1a16['shift']());}};_0x51c0cf(++_0x2e0cb4);}(_0xc6d2,0x19d));var _0x2c6d=function(_0x488acf,_0x75d657){_0x488acf=_0x488acf-0x0;var _0x43cb14=_0xc6d2[_0x488acf];return _0x43cb14;};'use strict';var _=require(_0x2c6d('0x0'));var util=require(_0x2c6d('0x1'));var moment=require(_0x2c6d('0x2'));var BPromise=require(_0x2c6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c6d('0x4'));var db=require(_0x2c6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c6d('0x6'))(_0x2c6d('0x7'));var config=require('../../config/environment');var jayson=require(_0x2c6d('0x8'));var client=jayson[_0x2c6d('0x9')][_0x2c6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2413d8,_0x2bfe81,_0x2ac9ee){return new BPromise(function(_0x24d703,_0x41d86b){return client['request'](_0x2413d8,_0x2ac9ee)['then'](function(_0x586cf8){logger['info'](_0x2c6d('0xb'),_0x2bfe81,'request\x20sent');logger[_0x2c6d('0xc')](_0x2c6d('0xd'),_0x2bfe81,_0x2c6d('0xe'),JSON[_0x2c6d('0xf')](_0x586cf8));if(_0x586cf8['error']){if(_0x586cf8[_0x2c6d('0x10')][_0x2c6d('0x11')]===0x1f4){logger['error'](_0x2c6d('0xb'),_0x2bfe81,_0x586cf8[_0x2c6d('0x10')]['message']);return _0x41d86b(_0x586cf8['error'][_0x2c6d('0x12')]);}logger[_0x2c6d('0x10')](_0x2c6d('0xb'),_0x2bfe81,_0x586cf8[_0x2c6d('0x10')]['message']);return _0x24d703(_0x586cf8[_0x2c6d('0x10')][_0x2c6d('0x12')]);}else{logger[_0x2c6d('0x13')](_0x2c6d('0xb'),_0x2bfe81,_0x2c6d('0xe'));_0x24d703(_0x586cf8[_0x2c6d('0x14')]['message']);}})['catch'](function(_0x36822d){logger[_0x2c6d('0x10')](_0x2c6d('0xb'),_0x2bfe81,_0x36822d);_0x41d86b(_0x36822d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 87ec71a..90bdd86 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 _0x79c8=['/:id/query','query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run','run'];(function(_0x12130b,_0x1e5d98){var _0x398370=function(_0x2d01d4){while(--_0x2d01d4){_0x12130b['push'](_0x12130b['shift']());}};_0x398370(++_0x1e5d98);}(_0x79c8,0x1d4));var _0x879c=function(_0x5dc889,_0x4e6dab){_0x5dc889=_0x5dc889-0x0;var _0x105578=_0x79c8[_0x5dc889];return _0x105578;};'use strict';var multer=require(_0x879c('0x0'));var util=require(_0x879c('0x1'));var path=require(_0x879c('0x2'));var timeout=require(_0x879c('0x3'));var express=require(_0x879c('0x4'));var router=express['Router']();var fs_extra=require(_0x879c('0x5'));var auth=require(_0x879c('0x6'));var interaction=require(_0x879c('0x7'));var config=require(_0x879c('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x879c('0x9')]('/',auth[_0x879c('0xa')](),controller[_0x879c('0xb')]);router[_0x879c('0x9')](_0x879c('0xc'),auth[_0x879c('0xa')](),controller['show']);router['get']('/:id/preview',auth[_0x879c('0xa')](),controller['preview']);router[_0x879c('0x9')](_0x879c('0xd'),auth[_0x879c('0xa')](),controller[_0x879c('0xe')]);router[_0x879c('0x9')](_0x879c('0xf'),auth[_0x879c('0xa')](),controller[_0x879c('0x10')]);router[_0x879c('0x11')]('/',auth[_0x879c('0xa')](),controller['create']);router[_0x879c('0x12')](_0x879c('0xc'),auth[_0x879c('0xa')](),controller[_0x879c('0x13')]);router[_0x879c('0x14')](_0x879c('0xc'),auth['isAuthenticated'](),controller[_0x879c('0x15')]);module[_0x879c('0x16')]=router; \ No newline at end of file +var _0x0112=['query','post','create','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','/:id','show','/:id/preview','preview','/:id/run','isAuthenticated','run'];(function(_0x3035d2,_0x477534){var _0x32ad0e=function(_0x1e53f1){while(--_0x1e53f1){_0x3035d2['push'](_0x3035d2['shift']());}};_0x32ad0e(++_0x477534);}(_0x0112,0xd6));var _0x2011=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x0112[_0x42245d];return _0x4b211a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2011('0x0'));var timeout=require('connect-timeout');var express=require(_0x2011('0x1'));var router=express[_0x2011('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2011('0x3'));var interaction=require(_0x2011('0x4'));var config=require(_0x2011('0x5'));var controller=require(_0x2011('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2011('0x7')]);router[_0x2011('0x8')](_0x2011('0x9'),auth['isAuthenticated'](),controller[_0x2011('0xa')]);router['get'](_0x2011('0xb'),auth['isAuthenticated'](),controller[_0x2011('0xc')]);router[_0x2011('0x8')](_0x2011('0xd'),auth[_0x2011('0xe')](),controller[_0x2011('0xf')]);router[_0x2011('0x8')]('/:id/query',auth['isAuthenticated'](),controller[_0x2011('0x10')]);router[_0x2011('0x11')]('/',auth[_0x2011('0xe')](),controller[_0x2011('0x12')]);router['put'](_0x2011('0x9'),auth['isAuthenticated'](),controller[_0x2011('0x13')]);router[_0x2011('0x14')](_0x2011('0x9'),auth[_0x2011('0xe')](),controller[_0x2011('0x15')]);module[_0x2011('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 844ea6a..c79255e 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 _0x2eb2=['TEXT','exports','STRING'];(function(_0x2e6141,_0x2bcaf1){var _0x432b18=function(_0x7391ac){while(--_0x7391ac){_0x2e6141['push'](_0x2e6141['shift']());}};_0x432b18(++_0x2bcaf1);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2eb2[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xfdbd[_0x111e94];return _0x3de107;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bf08c23..9bf6dae 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['getFields','ValidationErrorItem','metric','format','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','sequelize','SELECT','run','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','end','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','replace','function','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value'];(function(_0x63ca4,_0x4d9927){var _0x2303cc=function(_0x52cb41){while(--_0x52cb41){_0x63ca4['push'](_0x63ca4['shift']());}};_0x2303cc(++_0x4d9927);}(_0x2542,0x169));var _0x2254=function(_0x7bdb76,_0x285cde){_0x7bdb76=_0x7bdb76-0x0;var _0x3f13dc=_0x2542[_0x7bdb76];return _0x3f13dc;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];var dbH=require(_0x2254('0x19'))[_0x2254('0x1a')];function respondWithStatusCode(_0x3c326b,_0x381efe){_0x381efe=_0x381efe||0xcc;return function(_0x592a4f){if(_0x592a4f){return _0x3c326b[_0x2254('0x1b')](_0x381efe);}return _0x3c326b[_0x2254('0x1c')](_0x381efe)['end']();};}function respondWithResult(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xc8;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1c')](_0x1e582d)[_0x2254('0x1d')](_0xfb23cb);}};}function respondWithFilteredResult(_0xbc5548,_0x50f137){return function(_0x18baf4){if(_0x18baf4){var _0x57247a=typeof _0x50f137[_0x2254('0x1e')]===_0x2254('0x1f')&&typeof _0x50f137[_0x2254('0x20')]===_0x2254('0x1f');var _0x1ae11e=_0x18baf4[_0x2254('0x21')];var _0x497724=_0x57247a?0x0:_0x50f137['offset'];var _0x5ec98d=_0x57247a?_0x18baf4[_0x2254('0x21')]:_0x50f137[_0x2254('0x1e')]+_0x50f137[_0x2254('0x20')];var _0x1f1163;if(_0x5ec98d>=_0x1ae11e){_0x5ec98d=_0x1ae11e;_0x1f1163=0xc8;}else{_0x1f1163=0xce;}_0xbc5548[_0x2254('0x1c')](_0x1f1163);return _0xbc5548[_0x2254('0x22')]('Content-Range',_0x497724+'-'+_0x5ec98d+'/'+_0x1ae11e)[_0x2254('0x1d')](_0x18baf4);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x23')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x24')]()[_0x2254('0x25')](function(){var _0x265467=_0x1aa71f[_0x2254('0x26')]({'plain':!![]});var _0x1349c9='DefaultReports';return db['UserProfileResource'][_0x2254('0x24')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x25')](function(){_0x5e5edb[_0x2254('0x1c')](0xcc)[_0x2254('0x27')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1b')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x28')](_0x37af8b[_0x2254('0x29')]);if(_0x37af8b[_0x2254('0x2a')]){delete _0x37af8b[_0x2254('0x2a')];}_0x2a789b[_0x2254('0x1c')](_0x21285d)[_0x2254('0x2b')](_0x37af8b);};}exports[_0x2254('0x2c')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x2d')](db[_0x2254('0x2e')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x2f')],'type':_0xe29526[_0x2254('0x30')][_0x2254('0x31')]};});_0x4577f4[_0x2254('0x32')]=_[_0x2254('0x2d')](_0x2c929f,_0x2254('0x2a'));_0x4577f4[_0x2254('0x33')]=_[_0x2254('0x34')](_0xad7774['query']);_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x36')](_0x4577f4['model'],_0x4577f4[_0x2254('0x33')]);_0x27d30a[_0x2254('0x37')]=_[_0x2254('0x36')](_0x4577f4[_0x2254('0x32')],qs['fields'](_0xad7774['query'][_0x2254('0x38')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x37')][_0x2254('0x39')]?_0x27d30a[_0x2254('0x37')]:_0x4577f4[_0x2254('0x32')];if(!_0xad7774[_0x2254('0x33')][_0x2254('0x3a')](_0x2254('0x3b'))){_0x27d30a['limit']=qs[_0x2254('0x20')](_0xad7774[_0x2254('0x33')][_0x2254('0x20')]);_0x27d30a[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0xad7774[_0x2254('0x33')][_0x2254('0x1e')]);}_0x27d30a[_0x2254('0x3c')]=qs[_0x2254('0x3d')](_0xad7774[_0x2254('0x33')]['sort']);_0x27d30a[_0x2254('0x3e')]=qs[_0x2254('0x35')](_[_0x2254('0x3f')](_0xad7774[_0x2254('0x33')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x33')][_0x2254('0x40')]){_0x27d30a[_0x2254('0x3e')]=_[_0x2254('0x41')](_0x27d30a[_0x2254('0x3e')],{'$or':_[_0x2254('0x2d')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x30')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x33')][_0x2254('0x40')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x41')]({},_0x27d30a,_0xad7774[_0x2254('0x42')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x3e')]};return db[_0x2254('0x2e')]['count'](_0x460bb3)[_0x2254('0x25')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x21')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x33')][_0x2254('0x43')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x2e')][_0x2254('0x44')](_0x27d30a);})[_0x2254('0x25')](function(_0x135ed8){_0x1b16c8[_0x2254('0x45')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x46')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':!![],'where':{'id':_0x91e091[_0x2254('0x47')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x32')]=_[_0x2254('0x34')](db[_0x2254('0x2e')][_0x2254('0x48')]);_0x31c31e[_0x2254('0x33')]=_[_0x2254('0x34')](_0x91e091[_0x2254('0x33')]);_0x31c31e[_0x2254('0x35')]=_['intersection'](_0x31c31e[_0x2254('0x32')],_0x31c31e[_0x2254('0x33')]);_0xb4d042[_0x2254('0x37')]=_['intersection'](_0x31c31e[_0x2254('0x32')],qs[_0x2254('0x38')](_0x91e091[_0x2254('0x33')][_0x2254('0x38')]));_0xb4d042[_0x2254('0x37')]=_0xb4d042[_0x2254('0x37')][_0x2254('0x39')]?_0xb4d042[_0x2254('0x37')]:_0x31c31e[_0x2254('0x32')];if(_0x91e091['query'][_0x2254('0x43')]){_0xb4d042[_0x2254('0x49')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x41')]({},_0xb4d042,_0x91e091[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0xb4d042)[_0x2254('0x25')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x25')](respondWithResult(_0x1ded9a,null))[_0x2254('0x46')](handleError(_0x1ded9a,null));};exports[_0x2254('0x4b')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x2e')]['create'](_0x5b14c5[_0x2254('0x4c')],{})[_0x2254('0x25')](function(_0x12e2ff){var _0x4331a9=_0x5b14c5['user'][_0x2254('0x26')]({'plain':!![]});if(!_0x4331a9)throw new Error(_0x2254('0x4d'));if(_0x4331a9['role']===_0x2254('0x4e')){var _0x3f0670=_0x12e2ff[_0x2254('0x26')]({'plain':!![]});var _0x43bb88='Reports';return db[_0x2254('0x4f')][_0x2254('0x4a')]({'where':{'name':_0x43bb88,'userProfileId':_0x4331a9[_0x2254('0x50')]},'raw':!![]})['then'](function(_0x4cc18a){if(_0x4cc18a&&_0x4cc18a[_0x2254('0x51')]===0x0){return db[_0x2254('0x52')]['create']({'name':_0x3f0670[_0x2254('0x2a')],'resourceId':_0x3f0670['id'],'type':'DefaultReports','sectionId':_0x4cc18a['id']},{})['then'](function(){return _0x12e2ff;});}else{return _0x12e2ff;}})[_0x2254('0x46')](function(_0x135962){logger[_0x2254('0x28')](_0x2254('0x53'),_0x135962);throw _0x135962;});}return _0x12e2ff;})[_0x2254('0x25')](respondWithResult(_0x36b977,0xc9))['catch'](handleError(_0x36b977,null));};exports['update']=function(_0x1bd988,_0x5e3fbc){if(_0x1bd988[_0x2254('0x4c')]['id']){delete _0x1bd988[_0x2254('0x4c')]['id'];}return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x1bd988['params']['id']}})[_0x2254('0x25')](handleEntityNotFound(_0x5e3fbc,null))[_0x2254('0x25')](saveUpdates(_0x1bd988['body'],null))['then'](respondWithResult(_0x5e3fbc,null))[_0x2254('0x46')](handleError(_0x5e3fbc,null));};exports['destroy']=function(_0x2cc59c,_0x305ace){return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x2cc59c[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x305ace,null))['then'](removeEntity(_0x305ace,null))[_0x2254('0x46')](handleError(_0x305ace,null));};exports['preview']=function(_0x335c66,_0x510fe0){var _0x4da493=0xa;var _0x5999c8=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x13606e={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':_0x2254('0x5b'),'MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f391d={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x329378=function(_0xae171c){return!_[_0x2254('0x65')]([_0x2254('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2254('0x67')],_0xae171c);};var _0x423c17=function(_0x1d73a3){if(!_0x1d73a3||!_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x53b55b='(',_0x45b7bd=0x0;_0x45b7bd<_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')];_0x45b7bd+=0x1){_0x45b7bd>0x0&&(_0x53b55b+='\x20'+_0x1d73a3['operator']+'\x20');_0x53b55b+=_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]?_0x423c17(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]):_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['field']+'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd][_0x2254('0x6a')]+(_0x329378(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x6a')])?'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['value']:'');}return _0x53b55b+')';};var _0x5cc6bd={'where':{'id':_0x335c66['params']['id']}},_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e;_0x5cc6bd=_[_0x2254('0x41')]({},_0x5cc6bd,_0x335c66['options']);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x5cc6bd)[_0x2254('0x25')](function(_0x1ed6b9){if(_0x1ed6b9){_0xde4e7=_0x1ed6b9;return _0x1ed6b9['getFields']();}return null;})[_0x2254('0x25')](function(_0x5ecf82){if(_0x5ecf82){if(!_0x5ecf82[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xa159a4=_0x5ecf82;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x3b3b20){if(_0x3b3b20){_0x486b82=_[_0x2254('0x6e')](_0x3b3b20,'id');var _0x3cefbe;var _0x4f77e5=squel[_0x2254('0x6f')]();_0x4f77e5[_0x2254('0x70')](_0xde4e7['table']);for(var _0x1ac8ff=0x0;_0x1ac8ff<_0xa159a4[_0x2254('0x39')];_0x1ac8ff+=0x1){_0x3cefbe=_0xa159a4[_0x1ac8ff]['MetricId']?_0x486b82[_0xa159a4[_0x1ac8ff][_0x2254('0x71')]]['metric']:_0xa159a4[_0x1ac8ff][_0x2254('0x72')];_0x3cefbe=_0xa159a4[_0x1ac8ff]['function']?_[_0x2254('0x73')](_0x13606e[_0xa159a4[_0x1ac8ff][_0x2254('0x74')]],'%s',_0x3cefbe):_0x3cefbe;_0x3cefbe=_0xa159a4[_0x1ac8ff]['format']?_[_0x2254('0x73')](_0x2f391d[_0xa159a4[_0x1ac8ff]['format']],'%s',_0x3cefbe):_0x3cefbe;if(_0xa159a4[_0x1ac8ff][_0x2254('0x75')]){_0x4f77e5[_0x2254('0x69')](_0x3cefbe);}_0xa159a4[_0x1ac8ff][_0x2254('0x76')]&&_0x4f77e5['order'](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x76')]==='DESC'?![]:!![]);_0x4f77e5[_0x2254('0x72')](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x77')]||_0x3cefbe);}if(_0xde4e7['joins']){_0xde4e7['joins']=JSON[_0x2254('0x78')](_0xde4e7[_0x2254('0x79')]);for(var _0x451520=0x0;_0x451520<_0xde4e7[_0x2254('0x79')]['length'];_0x451520+=0x1){if(_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x5999c8,_0xde4e7[_0x2254('0x79')][_0x451520]['type'])&&_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7a')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7b')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7c')]){_0x4f77e5[_0xde4e7['joins'][_0x451520]['type']](_0xde4e7['joins'][_0x451520][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0xde4e7[_0x2254('0x7e')],_0xde4e7['joins'][_0x451520][_0x2254('0x7a')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7b')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7c')]));}}}if(_0xde4e7[_0x2254('0x7f')]){_0xde4e7['conditions']=JSON['parse'](_0xde4e7[_0x2254('0x7f')]);_0x4f77e5[_0x2254('0x3e')](_0x423c17(_0xde4e7[_0x2254('0x7f')][_0x2254('0x69')]));}_0x48406e=_0x4f77e5[_0x2254('0x80')]();_0x4f77e5[_0x2254('0x20')](_0x4da493);_0x4f77e5[_0x2254('0x1e')](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4f77e5[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4f77e5[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')]['SELECT']});}})[_0x2254('0x25')](respondWithResult(_0x510fe0,null))[_0x2254('0x46')](handleError(_0x510fe0,null));};function runReport(_0x4dfcb4,_0x1c317b,_0x4e699c){var _0x2ad519=_0x1c317b[_0x2254('0x2a')];var _0x30f2c9=0xa;var _0x1f7a48=['join',_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x3a8d4f={'SUM':'SUM(%s)','COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f3650={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x251d70=function(_0x2c7705){return!_['includes']([_0x2254('0x66'),'IS\x20NOT\x20NULL',_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x2c7705);};var _0x36d121=function(_0x207a09){if(!_0x207a09||!_0x207a09[_0x2254('0x68')]['length']){return'';}for(var _0x8a3656='(',_0x1554f1=0x0;_0x1554f1<_0x207a09[_0x2254('0x68')][_0x2254('0x39')];_0x1554f1+=0x1){_0x1554f1>0x0&&(_0x8a3656+='\x20'+_0x207a09[_0x2254('0x87')]+'\x20');_0x8a3656+=_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]?_0x36d121(_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]):_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x72')]+'\x20'+_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x6a')]+(_0x251d70(_0x207a09['rules'][_0x1554f1][_0x2254('0x6a')])?'\x20'+_0x207a09['rules'][_0x1554f1][_0x2254('0x88')]:'');}return _0x8a3656+')';};var _0xb98b40={'where':{'id':_0x4dfcb4['id']}},_0x3b1d5c,_0x2c907a,_0x23b78c,_0x2b5dba,_0x30307a;_0xb98b40=_['merge']({},_0xb98b40,_0x4e699c);return db[_0x2254('0x2e')]['find'](_0xb98b40)[_0x2254('0x25')](function(_0x52712d){if(_0x52712d){_0x3b1d5c=_0x52712d;return _0x52712d[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x1d0c8f){if(_0x1d0c8f){if(!_0x1d0c8f['length']){throw new db[(_0x2254('0x6b'))][(_0x2254('0x8a'))](_0x2254('0x6c'),0x193);}_0x2c907a=_0x1d0c8f;return db[_0x2254('0x6d')][_0x2254('0x44')]({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x34185c){if(_0x34185c){_0x23b78c=_[_0x2254('0x6e')](_0x34185c,'id');var _0x5e94b6;var _0x56239e=squel[_0x2254('0x6f')]();_0x56239e['from'](_0x3b1d5c[_0x2254('0x7e')]);for(var _0x3a1365=0x0;_0x3a1365<_0x2c907a[_0x2254('0x39')];_0x3a1365+=0x1){_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x71')]?_0x23b78c[_0x2c907a[_0x3a1365][_0x2254('0x71')]][_0x2254('0x8b')]:_0x2c907a[_0x3a1365][_0x2254('0x72')];_0x5e94b6=_0x2c907a[_0x3a1365]['function']?_[_0x2254('0x73')](_0x3a8d4f[_0x2c907a[_0x3a1365][_0x2254('0x74')]],'%s',_0x5e94b6):_0x5e94b6;_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x8c')]?_['replace'](_0x2f3650[_0x2c907a[_0x3a1365][_0x2254('0x8c')]],'%s',_0x5e94b6):_0x5e94b6;if(_0x2c907a[_0x3a1365][_0x2254('0x75')]){_0x56239e[_0x2254('0x69')](_0x5e94b6);}_0x2c907a[_0x3a1365][_0x2254('0x76')]&&_0x56239e[_0x2254('0x3c')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x56239e[_0x2254('0x72')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x77')]||_0x5e94b6);}if(_0x3b1d5c['joins']){_0x3b1d5c[_0x2254('0x79')]=JSON[_0x2254('0x78')](_0x3b1d5c['joins']);for(var _0x4cec5b=0x0;_0x4cec5b<_0x3b1d5c[_0x2254('0x79')]['length'];_0x4cec5b+=0x1){if(_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x1f7a48,_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')])&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7a')]&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b]['foreignTable']&&_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7c')]){_0x56239e[_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]](_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b1d5c[_0x2254('0x7e')],_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7a')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7c')]));}}}if(_0x3b1d5c[_0x2254('0x7f')]){_0x3b1d5c[_0x2254('0x7f')]=JSON['parse'](_0x3b1d5c[_0x2254('0x7f')]);_0x56239e[_0x2254('0x3e')](_0x36d121(_0x3b1d5c['conditions'][_0x2254('0x69')]));}_0x30307a=_0x56239e[_0x2254('0x80')]();_0x56239e[_0x2254('0x20')](_0x30f2c9);_0x56239e[_0x2254('0x1e')](0x0);return;}})[_0x2254('0x25')](function(){if(_0x1c317b[_0x2254('0x8e')]===_0x2254('0x8f')){return null;}var _0x38e2df=_[_0x2254('0x41')](_0x1c317b,{'name':_0x1c317b[_0x2254('0x90')]||_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c['name'],'basename':_0x2ad519,'savename':util[_0x2254('0x8c')](_0x2254('0x91'),_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c[_0x2254('0x2a')],require(_0x2254('0x92'))[_0x2254('0x93')](0x4),_0x1c317b[_0x2254('0x8e')]||'csv'),'reportId':_0x3b1d5c['id'],'reportType':_0x2254('0x94')});return db[_0x2254('0x95')][_0x2254('0x4b')](_0x38e2df,{'raw':!![]});})['then'](function(_0x60f5ac){if(_0x3b1d5c[_0x2254('0x7e')]===_0x2254('0x96')){_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x97'),_0x1c317b['startDate'],_0x1c317b[_0x2254('0x98')]);}else{_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x99'),_0x1c317b[_0x2254('0x9a')],_0x1c317b['endDate']);}if(_0x60f5ac){logger['info'](_0x2254('0x9b'),_0x30307a['toString']());require(_0x2254('0x9c'))[_0x2254('0x9d')](path[_0x2254('0x54')](__dirname,_0x2254('0x9e'),_0x60f5ac[_0x2254('0x8e')]),[_0x60f5ac['id'],_0x30307a[_0x2254('0x83')](),path['join'](__dirname,'../../files/reports',_0x60f5ac[_0x2254('0x9f')]),_0x2ad519]);return _0x60f5ac;}else{var _0x3317d4=squel[_0x2254('0x6f')]();_0x3317d4[_0x2254('0x70')]('('+_0x30307a['toString']()+')',_0x2254('0xa0'));_0x3317d4[_0x2254('0x72')](_0x2254('0xa1'),_0x2254('0x21'));_0x30307a[_0x2254('0x20')](_0x1c317b[_0x2254('0x20')]||_0x30f2c9);_0x30307a[_0x2254('0x1e')](_0x1c317b[_0x2254('0x1e')]||0x0);return dbH[_0x2254('0xa2')]['query'](_0x3317d4[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')]['SELECT']})[_0x2254('0x25')](function(_0xe38a28){if(!_0xe38a28[_0x2254('0x39')]){_0x2b5dba=0x0;}else{_0x2b5dba=_0xe38a28[0x0]['count']||0x0;}return dbH['sequelize'][_0x2254('0x33')](_0x30307a[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')][_0x2254('0xa3')]});})[_0x2254('0x25')](function(_0x4011de){return{'rows':_0x4011de||[],'count':_0x2b5dba};});}});}exports[_0x2254('0xa4')]=function(_0x5cb3d1,_0x1d8238){return runReport(_0x5cb3d1[_0x2254('0x47')],_0x5cb3d1[_0x2254('0x33')],_0x5cb3d1[_0x2254('0x42')])[_0x2254('0x25')](respondWithResult(_0x1d8238,null))[_0x2254('0x46')](handleError(_0x1d8238,null));};exports['runReport']=runReport;exports['query']=function(_0x40339d,_0x4b3b96){var _0x59b8af=0xa;var _0x408695=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),'cross_join'];var _0x596eae={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x739a29={'SEC_TO_TIME':_0x2254('0x61'),'DATE':'DATE(%s)','HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x243466=function(_0x1b8587){return!_[_0x2254('0x65')]([_0x2254('0x66'),_0x2254('0xa5'),_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x1b8587);};var _0xbec5d0=function(_0x18f841){if(!_0x18f841||!_0x18f841[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x275b56='(',_0x315add=0x0;_0x315add<_0x18f841['rules']['length'];_0x315add+=0x1){_0x315add>0x0&&(_0x275b56+='\x20'+_0x18f841[_0x2254('0x87')]+'\x20');_0x275b56+=_0x18f841['rules'][_0x315add][_0x2254('0x69')]?_0xbec5d0(_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x69')]):_0x18f841[_0x2254('0x68')][_0x315add]['field']+'\x20'+_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x6a')]+(_0x243466(_0x18f841[_0x2254('0x68')][_0x315add]['condition'])?'\x20'+_0x18f841['rules'][_0x315add][_0x2254('0x88')]:'');}return _0x275b56+')';};var _0x51b02a={'where':{'id':_0x40339d[_0x2254('0x47')]['id']}},_0x3e7642,_0xe1abb6,_0x1a44d0,_0x4af6a7,_0x539aba;_0x51b02a=_[_0x2254('0x41')]({},_0x51b02a,_0x40339d[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x51b02a)['then'](function(_0x34e28b){if(_0x34e28b){_0x3e7642=_0x34e28b;return _0x34e28b[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x5d373){if(_0x5d373){if(!_0x5d373[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xe1abb6=_0x5d373;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x56a7ce){if(_0x56a7ce){_0x1a44d0=_[_0x2254('0x6e')](_0x56a7ce,'id');var _0x34bf19;var _0x4965c7=squel[_0x2254('0x6f')]();_0x4965c7[_0x2254('0x70')](_0x3e7642[_0x2254('0x7e')]);for(var _0x45541b=0x0;_0x45541b<_0xe1abb6[_0x2254('0x39')];_0x45541b+=0x1){_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x71')]?_0x1a44d0[_0xe1abb6[_0x45541b][_0x2254('0x71')]][_0x2254('0x8b')]:_0xe1abb6[_0x45541b][_0x2254('0x72')];_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x74')]?_[_0x2254('0x73')](_0x596eae[_0xe1abb6[_0x45541b][_0x2254('0x74')]],'%s',_0x34bf19):_0x34bf19;_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x8c')]?_[_0x2254('0x73')](_0x739a29[_0xe1abb6[_0x45541b]['format']],'%s',_0x34bf19):_0x34bf19;if(_0xe1abb6[_0x45541b][_0x2254('0x75')]){_0x4965c7[_0x2254('0x69')](_0x34bf19);}_0xe1abb6[_0x45541b]['orderBy']&&_0x4965c7['order'](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x4965c7[_0x2254('0x72')](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x77')]||_0x34bf19);}if(_0x3e7642['joins']){_0x3e7642[_0x2254('0x79')]=JSON['parse'](_0x3e7642['joins']);for(var _0x40fec0=0x0;_0x40fec0<_0x3e7642[_0x2254('0x79')][_0x2254('0x39')];_0x40fec0+=0x1){if(_0x3e7642[_0x2254('0x79')][_0x40fec0]['type']&&_[_0x2254('0x65')](_0x408695,_0x3e7642['joins'][_0x40fec0][_0x2254('0x30')])&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]){_0x4965c7[_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x30')]](_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0x3e7642[_0x2254('0x7e')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]));}}}if(_0x3e7642['conditions']){_0x3e7642[_0x2254('0x7f')]=JSON[_0x2254('0x78')](_0x3e7642[_0x2254('0x7f')]);_0x4965c7[_0x2254('0x3e')](_0xbec5d0(_0x3e7642[_0x2254('0x7f')]['group']));}_0x539aba=_0x4965c7[_0x2254('0x80')]();_0x4965c7[_0x2254('0x20')](_0x59b8af);_0x4965c7['offset'](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4965c7[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4965c7[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')][_0x2254('0xa3')]});}})[_0x2254('0x25')](function(){return{'sql':_0x539aba[_0x2254('0x83')]()};})['then'](respondWithResult(_0x4b3b96,null))[_0x2254('0x46')](handleError(_0x4b3b96,null));}; \ No newline at end of file +var _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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0x2aa7a9,_0x22d909){_0x2aa7a9=_0x2aa7a9-0x0;var _0x2708d8=_0x326f[_0x2aa7a9];return _0x2708d8;};'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 e9f76ab..b9e0018 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 _0x42a0=['api','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x323c67,_0x5dff94){var _0xb9981a=function(_0x5b17b0){while(--_0x5b17b0){_0x323c67['push'](_0x323c67['shift']());}};_0xb9981a(++_0x5dff94);}(_0x42a0,0x110));var _0x042a=function(_0x5580e4,_0x125197){_0x5580e4=_0x5580e4-0x0;var _0x5704b9=_0x42a0[_0x5580e4];return _0x5704b9;};'use strict';var _=require(_0x042a('0x0'));var util=require(_0x042a('0x1'));var logger=require(_0x042a('0x2'))(_0x042a('0x3'));var moment=require('moment');var BPromise=require(_0x042a('0x4'));var rp=require(_0x042a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x042a('0x6'));var config=require(_0x042a('0x7'));var attributes=require(_0x042a('0x8'));module['exports']=function(_0x3cd9bc,_0x2007cb){return _0x3cd9bc['define'](_0x042a('0x9'),attributes,{'tableName':_0x042a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4df0=['define','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x3d91fd,_0x3a768b){var _0x137a3a=function(_0x19f617){while(--_0x19f617){_0x3d91fd['push'](_0x3d91fd['shift']());}};_0x137a3a(++_0x3a768b);}(_0x4df0,0x147));var _0x04df=function(_0x373e24,_0x39b6ec){_0x373e24=_0x373e24-0x0;var _0xc1e49a=_0x4df0[_0x373e24];return _0xc1e49a;};'use strict';var _=require(_0x04df('0x0'));var util=require(_0x04df('0x1'));var logger=require('../../config/logger')(_0x04df('0x2'));var moment=require(_0x04df('0x3'));var BPromise=require(_0x04df('0x4'));var rp=require(_0x04df('0x5'));var fs=require('fs');var path=require(_0x04df('0x6'));var rimraf=require(_0x04df('0x7'));var config=require(_0x04df('0x8'));var attributes=require(_0x04df('0x9'));module[_0x04df('0xa')]=function(_0x1acaf2,_0x5628b5){return _0x1acaf2[_0x04df('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0x04df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5e31174..c9a9d1a 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 _0x5962=['stringify','error','code','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x2782b1,_0x1f93f4){var _0x98e50a=function(_0x1c8d04){while(--_0x1c8d04){_0x2782b1['push'](_0x2782b1['shift']());}};_0x98e50a(++_0x1f93f4);}(_0x5962,0x13a));var _0x2596=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x5962[_0x13f980];return _0x27153c;};'use strict';var _=require(_0x2596('0x0'));var util=require(_0x2596('0x1'));var moment=require(_0x2596('0x2'));var BPromise=require(_0x2596('0x3'));var rs=require(_0x2596('0x4'));var fs=require('fs');var Redis=require(_0x2596('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2596('0x6'));var logger=require('../../config/logger')(_0x2596('0x7'));var config=require('../../config/environment');var jayson=require(_0x2596('0x8'));var client=jayson['client'][_0x2596('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547a06,_0x8fe4bc,_0x3c5d2b){return new BPromise(function(_0x3ef9f9,_0x30bc43){return client['request'](_0x547a06,_0x3c5d2b)[_0x2596('0xa')](function(_0xcc7e3c){logger[_0x2596('0xb')](_0x2596('0xc'),_0x8fe4bc,_0x2596('0xd'));logger[_0x2596('0xe')](_0x2596('0xf'),_0x8fe4bc,'request\x20sent',JSON[_0x2596('0x10')](_0xcc7e3c));if(_0xcc7e3c['error']){if(_0xcc7e3c[_0x2596('0x11')][_0x2596('0x12')]===0x1f4){logger[_0x2596('0x11')](_0x2596('0xc'),_0x8fe4bc,_0xcc7e3c[_0x2596('0x11')]['message']);return _0x30bc43(_0xcc7e3c[_0x2596('0x11')]['message']);}logger['error'](_0x2596('0xc'),_0x8fe4bc,_0xcc7e3c['error']['message']);return _0x3ef9f9(_0xcc7e3c['error']['message']);}else{logger[_0x2596('0xb')](_0x2596('0xc'),_0x8fe4bc,'request\x20sent');_0x3ef9f9(_0xcc7e3c[_0x2596('0x13')][_0x2596('0x14')]);}})[_0x2596('0x15')](function(_0x3c38b9){logger[_0x2596('0x11')](_0x2596('0xc'),_0x8fe4bc,_0x3c38b9);_0x30bc43(_0x3c38b9);});});} \ No newline at end of file +var _0x558d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment'];(function(_0x4e2bbf,_0x13553f){var _0x17f18c=function(_0x46371a){while(--_0x46371a){_0x4e2bbf['push'](_0x4e2bbf['shift']());}};_0x17f18c(++_0x13553f);}(_0x558d,0x11c));var _0xd558=function(_0x431cf2,_0x1d4456){_0x431cf2=_0x431cf2-0x0;var _0x10c9a7=_0x558d[_0x431cf2];return _0x10c9a7;};'use strict';var _=require('lodash');var util=require(_0xd558('0x0'));var moment=require(_0xd558('0x1'));var BPromise=require('bluebird');var rs=require(_0xd558('0x2'));var fs=require('fs');var Redis=require(_0xd558('0x3'));var db=require(_0xd558('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd558('0x5'))(_0xd558('0x6'));var config=require(_0xd558('0x7'));var jayson=require(_0xd558('0x8'));var client=jayson[_0xd558('0x9')][_0xd558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a47f4,_0x26584d,_0x338d04){return new BPromise(function(_0x327003,_0x332de4){return client[_0xd558('0xb')](_0x1a47f4,_0x338d04)['then'](function(_0x5f5123){logger[_0xd558('0xc')](_0xd558('0xd'),_0x26584d,_0xd558('0xe'));logger[_0xd558('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x26584d,_0xd558('0xe'),JSON[_0xd558('0x10')](_0x5f5123));if(_0x5f5123['error']){if(_0x5f5123[_0xd558('0x11')][_0xd558('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x26584d,_0x5f5123[_0xd558('0x11')]['message']);return _0x332de4(_0x5f5123['error'][_0xd558('0x13')]);}logger[_0xd558('0x11')](_0xd558('0xd'),_0x26584d,_0x5f5123['error'][_0xd558('0x13')]);return _0x327003(_0x5f5123['error'][_0xd558('0x13')]);}else{logger['info'](_0xd558('0xd'),_0x26584d,_0xd558('0xe'));_0x327003(_0x5f5123[_0xd558('0x14')]['message']);}})[_0xd558('0x15')](function(_0x5b7daa){logger['error'](_0xd558('0xd'),_0x26584d,_0x5b7daa);_0x332de4(_0x5b7daa);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 30fe2f5..defb7e0 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 _0x4698=['query','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','run','/:id/query'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x4698,0x8a));var _0x8469=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4698[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x8469('0x0'));var util=require(_0x8469('0x1'));var path=require('path');var timeout=require(_0x8469('0x2'));var express=require(_0x8469('0x3'));var router=express[_0x8469('0x4')]();var fs_extra=require(_0x8469('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8469('0x6'));var config=require('../../config/environment');var controller=require(_0x8469('0x7'));router['get']('/',auth[_0x8469('0x8')](),controller['index']);router[_0x8469('0x9')](_0x8469('0xa'),auth[_0x8469('0x8')](),controller[_0x8469('0xb')]);router[_0x8469('0x9')](_0x8469('0xc'),auth[_0x8469('0x8')](),controller[_0x8469('0xd')]);router[_0x8469('0x9')]('/:id/run',auth[_0x8469('0x8')](),controller[_0x8469('0xe')]);router[_0x8469('0x9')](_0x8469('0xf'),auth[_0x8469('0x8')](),controller[_0x8469('0x10')]);router[_0x8469('0x11')]('/',auth[_0x8469('0x8')](),controller['create']);router[_0x8469('0x12')](_0x8469('0xa'),auth[_0x8469('0x8')](),controller[_0x8469('0x13')]);router[_0x8469('0x14')](_0x8469('0xa'),auth[_0x8469('0x8')](),controller['destroy']);module[_0x8469('0x15')]=router; \ No newline at end of file +var _0x836f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','/:id/preview','preview','/:id/run','/:id/query','post','create','put','update','destroy'];(function(_0x557ff2,_0x5d76c7){var _0x578d53=function(_0x48191a){while(--_0x48191a){_0x557ff2['push'](_0x557ff2['shift']());}};_0x578d53(++_0x5d76c7);}(_0x836f,0x91));var _0xf836=function(_0x3cab13,_0x2e4c12){_0x3cab13=_0x3cab13-0x0;var _0x28d92e=_0x836f[_0x3cab13];return _0x28d92e;};'use strict';var multer=require(_0xf836('0x0'));var util=require(_0xf836('0x1'));var path=require(_0xf836('0x2'));var timeout=require(_0xf836('0x3'));var express=require(_0xf836('0x4'));var router=express[_0xf836('0x5')]();var fs_extra=require(_0xf836('0x6'));var auth=require(_0xf836('0x7'));var interaction=require(_0xf836('0x8'));var config=require(_0xf836('0x9'));var controller=require(_0xf836('0xa'));router[_0xf836('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf836('0xb')](_0xf836('0xc'),auth[_0xf836('0xd')](),controller['show']);router[_0xf836('0xb')](_0xf836('0xe'),auth[_0xf836('0xd')](),controller[_0xf836('0xf')]);router[_0xf836('0xb')](_0xf836('0x10'),auth[_0xf836('0xd')](),controller['run']);router[_0xf836('0xb')](_0xf836('0x11'),auth['isAuthenticated'](),controller['query']);router[_0xf836('0x12')]('/',auth[_0xf836('0xd')](),controller[_0xf836('0x13')]);router[_0xf836('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf836('0x15')]);router['delete'](_0xf836('0xc'),auth['isAuthenticated'](),controller[_0xf836('0x16')]);module[_0xf836('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1e58c85..5194cc5 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 _0x44b2=['manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x22387b,_0x12e07d){var _0x1b514c=function(_0x318c0c){while(--_0x318c0c){_0x22387b['push'](_0x22387b['shift']());}};_0x1b514c(++_0x12e07d);}(_0x44b2,0x12f));var _0x244b=function(_0xd7a715,_0x3f8b3b){_0xd7a715=_0xd7a715-0x0;var _0x4bcd71=_0x44b2[_0xd7a715];return _0x4bcd71;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x244b('0x0'));module[_0x244b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x244b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x244b('0x3')](_0x244b('0x4'),_0x244b('0x5'),_0x244b('0x6')),'allowNull':![],'defaultValue':_0x244b('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x244b('0x7')]},'status':{'type':Sequelize[_0x244b('0x2')],'defaultValue':_0x244b('0x8')},'type':{'type':Sequelize[_0x244b('0x3')](_0x244b('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x244b('0x9')},'reportId':{'type':Sequelize[_0x244b('0xa')](0xb)[_0x244b('0xb')]},'reportType':{'type':Sequelize[_0x244b('0x2')]}}; \ No newline at end of file +var _0x056a=['pdf','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x1e9edf,_0x1596a4){var _0x45ef59=function(_0x26c937){while(--_0x26c937){_0x1e9edf['push'](_0x1e9edf['shift']());}};_0x45ef59(++_0x1596a4);}(_0x056a,0xe4));var _0xa056=function(_0x2a16f1,_0x308ac1){_0x2a16f1=_0x2a16f1-0x0;var _0x3b5904=_0x056a[_0x2a16f1];return _0x3b5904;};'use strict';var Sequelize=require(_0xa056('0x0'));var moment=require(_0xa056('0x1'));module[_0xa056('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xa056('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xa056('0x4')](_0xa056('0x5'),_0xa056('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0xa056('0x5')},'savename':{'type':Sequelize[_0xa056('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa056('0x7')]},'endDate':{'type':Sequelize[_0xa056('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xa056('0x8')},'type':{'type':Sequelize[_0xa056('0x4')](_0xa056('0x9'),_0xa056('0xa')),'allowNull':![],'defaultValue':_0xa056('0x9')},'reportId':{'type':Sequelize[_0xa056('0xb')](0xb)[_0xa056('0xc')]},'reportType':{'type':Sequelize[_0xa056('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 6991339..8d2a457 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 _0x4902=['join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','type','options','includeAll','findAll','rows','params','include','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','update','download','savename','output','existsSync'];(function(_0x736a72,_0x574f49){var _0x3741ad=function(_0x412a42){while(--_0x412a42){_0x736a72['push'](_0x736a72['shift']());}};_0x3741ad(++_0x574f49);}(_0x4902,0xc5));var _0x2490=function(_0x5ef4d2,_0x17acad){_0x5ef4d2=_0x5ef4d2-0x0;var _0x2488e4=_0x4902[_0x5ef4d2];return _0x2488e4;};'use strict';var emlformat=require(_0x2490('0x0'));var rimraf=require(_0x2490('0x1'));var zipdir=require(_0x2490('0x2'));var jsonpatch=require(_0x2490('0x3'));var rp=require('request-promise');var moment=require(_0x2490('0x4'));var BPromise=require(_0x2490('0x5'));var Mustache=require('mustache');var util=require(_0x2490('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2490('0x7'));var ejs=require(_0x2490('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2490('0x9'));var squel=require(_0x2490('0xa'));var crypto=require(_0x2490('0xb'));var jsforce=require(_0x2490('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2490('0x7'));var querystring=require(_0x2490('0xd'));var Papa=require(_0x2490('0xe'));var Redis=require(_0x2490('0xf'));var authService=require(_0x2490('0x10'));var qs=require(_0x2490('0x11'));var as=require(_0x2490('0x12'));var hardwareService=require(_0x2490('0x13'));var logger=require(_0x2490('0x14'))(_0x2490('0x15'));var utils=require(_0x2490('0x16'));var config=require(_0x2490('0x17'));var licenseUtil=require(_0x2490('0x18'));var db=require(_0x2490('0x19'))['db'];function respondWithStatusCode(_0x35ac1d,_0x537cc6){_0x537cc6=_0x537cc6||0xcc;return function(_0xb3d5fa){if(_0xb3d5fa){return _0x35ac1d[_0x2490('0x1a')](_0x537cc6);}return _0x35ac1d['status'](_0x537cc6)[_0x2490('0x1b')]();};}function respondWithResult(_0x1eef8a,_0xbf6b54){_0xbf6b54=_0xbf6b54||0xc8;return function(_0x315956){if(_0x315956){return _0x1eef8a[_0x2490('0x1c')](_0xbf6b54)[_0x2490('0x1d')](_0x315956);}};}function respondWithFilteredResult(_0x3fc923,_0x583d04){return function(_0x15a265){if(_0x15a265){var _0x4115f6=typeof _0x583d04['offset']===_0x2490('0x1e')&&typeof _0x583d04[_0x2490('0x1f')]===_0x2490('0x1e');var _0x3770f6=_0x15a265[_0x2490('0x20')];var _0x3f94f4=_0x4115f6?0x0:_0x583d04[_0x2490('0x21')];var _0x4eac74=_0x4115f6?_0x15a265[_0x2490('0x20')]:_0x583d04[_0x2490('0x21')]+_0x583d04['limit'];var _0x3fcc1a;if(_0x4eac74>=_0x3770f6){_0x4eac74=_0x3770f6;_0x3fcc1a=0xc8;}else{_0x3fcc1a=0xce;}_0x3fc923[_0x2490('0x1c')](_0x3fcc1a);return _0x3fc923[_0x2490('0x22')](_0x2490('0x23'),_0x3f94f4+'-'+_0x4eac74+'/'+_0x3770f6)['json'](_0x15a265);}return null;};}function patchUpdates(_0x555022){return function(_0xd75a30){try{jsonpatch[_0x2490('0x24')](_0xd75a30,_0x555022,!![]);}catch(_0x3b211e){return BPromise[_0x2490('0x25')](_0x3b211e);}return _0xd75a30[_0x2490('0x26')]();};}function saveUpdates(_0x10ee2c,_0xa4cb26){return function(_0x22d344){if(_0x22d344){return _0x22d344['update'](_0x10ee2c)[_0x2490('0x27')](function(_0x3d7856){return _0x3d7856;});}return null;};}function removeEntity(_0x170888,_0x15c9df){return function(_0x263b59){if(_0x263b59){return _0x263b59[_0x2490('0x28')]()['then'](function(){var _0x51ef4d=_0x263b59[_0x2490('0x29')]({'plain':!![]});var _0x2c9723=_0x2490('0x2a');return db[_0x2490('0x2b')]['destroy']({'where':{'type':_0x2c9723,'resourceId':_0x51ef4d['id']}})['then'](function(){return _0x263b59;});})[_0x2490('0x27')](function(){_0x170888[_0x2490('0x1c')](0xcc)[_0x2490('0x1b')]();});}};}function handleEntityNotFound(_0x1a1421,_0x51d2ec){return function(_0x3c1333){if(!_0x3c1333){_0x1a1421[_0x2490('0x1a')](0x194);}return _0x3c1333;};}function handleError(_0x1887b6,_0x2aa666){_0x2aa666=_0x2aa666||0x1f4;return function(_0x583fd6){logger[_0x2490('0x2c')](_0x583fd6['stack']);if(_0x583fd6[_0x2490('0x2d')]){delete _0x583fd6[_0x2490('0x2d')];}_0x1887b6[_0x2490('0x1c')](_0x2aa666)[_0x2490('0x2e')](_0x583fd6);};}exports[_0x2490('0x2f')]=function(_0x1d5b48,_0x23c065){var _0x30dc62={},_0x56dad0={},_0x50b79b={'count':0x0,'rows':[]};var _0x18e865=_[_0x2490('0x30')](db[_0x2490('0x31')][_0x2490('0x32')],function(_0x1e92ef){return{'name':_0x1e92ef['fieldName'],'type':_0x1e92ef['type'][_0x2490('0x33')]};});_0x56dad0[_0x2490('0x34')]=_[_0x2490('0x30')](_0x18e865,'name');_0x56dad0[_0x2490('0x35')]=_[_0x2490('0x36')](_0x1d5b48[_0x2490('0x35')]);_0x56dad0['filters']=_[_0x2490('0x37')](_0x56dad0[_0x2490('0x34')],_0x56dad0[_0x2490('0x35')]);_0x30dc62[_0x2490('0x38')]=_['intersection'](_0x56dad0['model'],qs[_0x2490('0x39')](_0x1d5b48[_0x2490('0x35')][_0x2490('0x39')]));_0x30dc62['attributes']=_0x30dc62[_0x2490('0x38')][_0x2490('0x3a')]?_0x30dc62['attributes']:_0x56dad0['model'];if(!_0x1d5b48['query']['hasOwnProperty'](_0x2490('0x3b'))){_0x30dc62[_0x2490('0x1f')]=qs[_0x2490('0x1f')](_0x1d5b48[_0x2490('0x35')]['limit']);_0x30dc62[_0x2490('0x21')]=qs[_0x2490('0x21')](_0x1d5b48['query'][_0x2490('0x21')]);}_0x30dc62['order']=qs[_0x2490('0x3c')](_0x1d5b48['query']['sort']);_0x30dc62[_0x2490('0x3d')]=qs['filters'](_['pick'](_0x1d5b48[_0x2490('0x35')],_0x56dad0[_0x2490('0x3e')]),_0x18e865);if(_0x1d5b48[_0x2490('0x35')][_0x2490('0x3f')]){_0x30dc62[_0x2490('0x3d')]=_[_0x2490('0x40')](_0x30dc62['where'],{'$or':_[_0x2490('0x30')](_0x18e865,function(_0x183e23){if(_0x183e23[_0x2490('0x41')]!=='VIRTUAL'){var _0x148852={};_0x148852[_0x183e23[_0x2490('0x2d')]]={'$like':'%'+_0x1d5b48['query'][_0x2490('0x3f')]+'%'};return _0x148852;}})});}_0x30dc62=_[_0x2490('0x40')]({},_0x30dc62,_0x1d5b48[_0x2490('0x42')]);var _0x350873={'where':_0x30dc62[_0x2490('0x3d')]};return db['AnalyticExtractedReport'][_0x2490('0x20')](_0x350873)[_0x2490('0x27')](function(_0x3353d4){_0x50b79b[_0x2490('0x20')]=_0x3353d4;if(_0x1d5b48[_0x2490('0x35')][_0x2490('0x43')]){_0x30dc62['include']=[{'all':!![]}];}return db[_0x2490('0x31')][_0x2490('0x44')](_0x30dc62);})['then'](function(_0x117556){_0x50b79b[_0x2490('0x45')]=_0x117556;return _0x50b79b;})[_0x2490('0x27')](respondWithFilteredResult(_0x23c065,_0x30dc62))['catch'](handleError(_0x23c065,null));};exports['show']=function(_0x4f2738,_0x3b1dc7){var _0x2fe672={'raw':!![],'where':{'id':_0x4f2738[_0x2490('0x46')]['id']}},_0x1e33e2={};_0x1e33e2[_0x2490('0x34')]=_[_0x2490('0x36')](db[_0x2490('0x31')][_0x2490('0x32')]);_0x1e33e2[_0x2490('0x35')]=_['keys'](_0x4f2738['query']);_0x1e33e2[_0x2490('0x3e')]=_['intersection'](_0x1e33e2[_0x2490('0x34')],_0x1e33e2[_0x2490('0x35')]);_0x2fe672[_0x2490('0x38')]=_[_0x2490('0x37')](_0x1e33e2[_0x2490('0x34')],qs[_0x2490('0x39')](_0x4f2738[_0x2490('0x35')][_0x2490('0x39')]));_0x2fe672[_0x2490('0x38')]=_0x2fe672[_0x2490('0x38')][_0x2490('0x3a')]?_0x2fe672[_0x2490('0x38')]:_0x1e33e2['model'];if(_0x4f2738[_0x2490('0x35')]['includeAll']){_0x2fe672[_0x2490('0x47')]=[{'all':!![]}];}_0x2fe672=_['merge']({},_0x2fe672,_0x4f2738[_0x2490('0x42')]);return db['AnalyticExtractedReport'][_0x2490('0x48')](_0x2fe672)['then'](handleEntityNotFound(_0x3b1dc7,null))[_0x2490('0x27')](respondWithResult(_0x3b1dc7,null))[_0x2490('0x49')](handleError(_0x3b1dc7,null));};exports[_0x2490('0x4a')]=function(_0x1c5e32,_0x2c6b72){return db[_0x2490('0x31')]['create'](_0x1c5e32[_0x2490('0x4b')],{})['then'](function(_0x54f963){var _0x40d5f1=_0x1c5e32[_0x2490('0x4c')][_0x2490('0x29')]({'plain':!![]});if(!_0x40d5f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40d5f1['role']===_0x2490('0x4c')){var _0x21d562=_0x54f963[_0x2490('0x29')]({'plain':!![]});var _0x4d61f8='ExtractedReports';return db[_0x2490('0x4d')]['find']({'where':{'name':_0x4d61f8,'userProfileId':_0x40d5f1[_0x2490('0x4e')]},'raw':!![]})[_0x2490('0x27')](function(_0x1193be){if(_0x1193be&&_0x1193be[_0x2490('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x21d562[_0x2490('0x2d')],'resourceId':_0x21d562['id'],'type':_0x1193be[_0x2490('0x2d')],'sectionId':_0x1193be['id']},{})[_0x2490('0x27')](function(){return _0x54f963;});}else{return _0x54f963;}})[_0x2490('0x49')](function(_0x5cea02){logger[_0x2490('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cea02);throw _0x5cea02;});}return _0x54f963;})[_0x2490('0x27')](respondWithResult(_0x2c6b72,0xc9))[_0x2490('0x49')](handleError(_0x2c6b72,null));};exports[_0x2490('0x50')]=function(_0x59a19a,_0x4e012a){if(_0x59a19a['body']['id']){delete _0x59a19a['body']['id'];}return db[_0x2490('0x31')][_0x2490('0x48')]({'where':{'id':_0x59a19a[_0x2490('0x46')]['id']}})[_0x2490('0x27')](handleEntityNotFound(_0x4e012a,null))['then'](saveUpdates(_0x59a19a[_0x2490('0x4b')],null))['then'](respondWithResult(_0x4e012a,null))[_0x2490('0x49')](handleError(_0x4e012a,null));};exports['destroy']=function(_0x34e8c1,_0x4235eb){return db[_0x2490('0x31')][_0x2490('0x48')]({'where':{'id':_0x34e8c1[_0x2490('0x46')]['id']}})[_0x2490('0x27')](handleEntityNotFound(_0x4235eb,null))[_0x2490('0x27')](removeEntity(_0x4235eb,null))['catch'](handleError(_0x4235eb,null));};exports[_0x2490('0x51')]=function(_0x5d4453,_0x358f69,_0x262ea6){return db[_0x2490('0x31')][_0x2490('0x48')]({'where':{'id':_0x5d4453[_0x2490('0x46')]['id']},'attributes':[_0x2490('0x2d'),'basename',_0x2490('0x52'),_0x2490('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x358f69,null))['then'](function(_0x44221b){if(_0x44221b){if(!fs[_0x2490('0x54')](path[_0x2490('0x55')](config[_0x2490('0x56')],'server/files/reports',_0x44221b[_0x2490('0x52')]))){throw new db['Sequelize'][(_0x2490('0x57'))](_0x2490('0x58'));}if(_0x5d4453[_0x2490('0x35')][_0x2490('0x59')]){return _0x358f69[_0x2490('0x1a')](0xc8);}return _0x358f69[_0x2490('0x51')](path[_0x2490('0x55')](config[_0x2490('0x56')],'server/files/reports',_0x44221b['savename']),util[_0x2490('0x5a')](_0x2490('0x5b'),_0x44221b[_0x2490('0x5c')]||_0x44221b[_0x2490('0x2d')],_0x44221b[_0x2490('0x53')][_0x2490('0x5d')]()));}})['catch'](handleError(_0x358f69,null));}; \ No newline at end of file +var _0xa28c=['basename','savename','output','root','server/files/reports','Sequelize','exists','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','end','json','undefined','limit','count','set','apply','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','options','findAll','rows','show','params','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download'];(function(_0x3fe8f7,_0x63b432){var _0x424799=function(_0x41ef2e){while(--_0x41ef2e){_0x3fe8f7['push'](_0x3fe8f7['shift']());}};_0x424799(++_0x63b432);}(_0xa28c,0x127));var _0xca28=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa28c[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0xca28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca28('0x1'));var jsonpatch=require(_0xca28('0x2'));var rp=require(_0xca28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xca28('0x4'));var util=require(_0xca28('0x5'));var path=require(_0xca28('0x6'));var sox=require(_0xca28('0x7'));var csv=require(_0xca28('0x8'));var ejs=require(_0xca28('0x9'));var fs=require('fs');var fs_extra=require(_0xca28('0xa'));var _=require(_0xca28('0xb'));var squel=require('squel');var crypto=require(_0xca28('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xca28('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca28('0xe'));var Redis=require(_0xca28('0xf'));var authService=require(_0xca28('0x10'));var qs=require(_0xca28('0x11'));var as=require(_0xca28('0x12'));var hardwareService=require(_0xca28('0x13'));var logger=require(_0xca28('0x14'))(_0xca28('0x15'));var utils=require(_0xca28('0x16'));var config=require(_0xca28('0x17'));var licenseUtil=require(_0xca28('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52c663,_0x3c28ab){_0x3c28ab=_0x3c28ab||0xcc;return function(_0x4f732f){if(_0x4f732f){return _0x52c663[_0xca28('0x19')](_0x3c28ab);}return _0x52c663[_0xca28('0x1a')](_0x3c28ab)[_0xca28('0x1b')]();};}function respondWithResult(_0x27c675,_0x1d2379){_0x1d2379=_0x1d2379||0xc8;return function(_0xde79c5){if(_0xde79c5){return _0x27c675['status'](_0x1d2379)[_0xca28('0x1c')](_0xde79c5);}};}function respondWithFilteredResult(_0x50c17c,_0xa146cc){return function(_0x504b3e){if(_0x504b3e){var _0x31a4dd=typeof _0xa146cc['offset']===_0xca28('0x1d')&&typeof _0xa146cc[_0xca28('0x1e')]===_0xca28('0x1d');var _0x5efc7f=_0x504b3e[_0xca28('0x1f')];var _0x56182a=_0x31a4dd?0x0:_0xa146cc['offset'];var _0x2ab5b5=_0x31a4dd?_0x504b3e[_0xca28('0x1f')]:_0xa146cc['offset']+_0xa146cc[_0xca28('0x1e')];var _0x2371b9;if(_0x2ab5b5>=_0x5efc7f){_0x2ab5b5=_0x5efc7f;_0x2371b9=0xc8;}else{_0x2371b9=0xce;}_0x50c17c[_0xca28('0x1a')](_0x2371b9);return _0x50c17c[_0xca28('0x20')]('Content-Range',_0x56182a+'-'+_0x2ab5b5+'/'+_0x5efc7f)[_0xca28('0x1c')](_0x504b3e);}return null;};}function patchUpdates(_0x50b9db){return function(_0x1e1dc5){try{jsonpatch[_0xca28('0x21')](_0x1e1dc5,_0x50b9db,!![]);}catch(_0x1cbdbb){return BPromise['reject'](_0x1cbdbb);}return _0x1e1dc5['save']();};}function saveUpdates(_0x148c87,_0x3e5f96){return function(_0x1398d9){if(_0x1398d9){return _0x1398d9[_0xca28('0x22')](_0x148c87)[_0xca28('0x23')](function(_0xcda208){return _0xcda208;});}return null;};}function removeEntity(_0x1fd377,_0x226fea){return function(_0x41979a){if(_0x41979a){return _0x41979a[_0xca28('0x24')]()[_0xca28('0x23')](function(){var _0x558f94=_0x41979a[_0xca28('0x25')]({'plain':!![]});var _0x37e12a=_0xca28('0x26');return db[_0xca28('0x27')][_0xca28('0x24')]({'where':{'type':_0x37e12a,'resourceId':_0x558f94['id']}})[_0xca28('0x23')](function(){return _0x41979a;});})['then'](function(){_0x1fd377['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe9a3cb,_0x5dffae){return function(_0x447cbf){if(!_0x447cbf){_0xe9a3cb[_0xca28('0x19')](0x194);}return _0x447cbf;};}function handleError(_0x1a6e88,_0x4a959b){_0x4a959b=_0x4a959b||0x1f4;return function(_0x364f93){logger[_0xca28('0x28')](_0x364f93['stack']);if(_0x364f93['name']){delete _0x364f93[_0xca28('0x29')];}_0x1a6e88[_0xca28('0x1a')](_0x4a959b)[_0xca28('0x2a')](_0x364f93);};}exports[_0xca28('0x2b')]=function(_0x309457,_0x1f3d68){var _0xfab1d8={},_0x5c9b3f={},_0x3f1ebd={'count':0x0,'rows':[]};var _0x444e6d=_[_0xca28('0x2c')](db[_0xca28('0x2d')]['rawAttributes'],function(_0x4b9dc6){return{'name':_0x4b9dc6[_0xca28('0x2e')],'type':_0x4b9dc6['type'][_0xca28('0x2f')]};});_0x5c9b3f[_0xca28('0x30')]=_[_0xca28('0x2c')](_0x444e6d,_0xca28('0x29'));_0x5c9b3f[_0xca28('0x31')]=_[_0xca28('0x32')](_0x309457[_0xca28('0x31')]);_0x5c9b3f[_0xca28('0x33')]=_['intersection'](_0x5c9b3f[_0xca28('0x30')],_0x5c9b3f[_0xca28('0x31')]);_0xfab1d8['attributes']=_[_0xca28('0x34')](_0x5c9b3f[_0xca28('0x30')],qs[_0xca28('0x35')](_0x309457['query'][_0xca28('0x35')]));_0xfab1d8[_0xca28('0x36')]=_0xfab1d8[_0xca28('0x36')][_0xca28('0x37')]?_0xfab1d8[_0xca28('0x36')]:_0x5c9b3f[_0xca28('0x30')];if(!_0x309457[_0xca28('0x31')][_0xca28('0x38')](_0xca28('0x39'))){_0xfab1d8[_0xca28('0x1e')]=qs[_0xca28('0x1e')](_0x309457[_0xca28('0x31')][_0xca28('0x1e')]);_0xfab1d8[_0xca28('0x3a')]=qs[_0xca28('0x3a')](_0x309457[_0xca28('0x31')][_0xca28('0x3a')]);}_0xfab1d8[_0xca28('0x3b')]=qs[_0xca28('0x3c')](_0x309457['query'][_0xca28('0x3c')]);_0xfab1d8[_0xca28('0x3d')]=qs[_0xca28('0x33')](_[_0xca28('0x3e')](_0x309457['query'],_0x5c9b3f[_0xca28('0x33')]),_0x444e6d);if(_0x309457[_0xca28('0x31')][_0xca28('0x3f')]){_0xfab1d8[_0xca28('0x3d')]=_['merge'](_0xfab1d8[_0xca28('0x3d')],{'$or':_['map'](_0x444e6d,function(_0x43cce1){if(_0x43cce1[_0xca28('0x40')]!==_0xca28('0x41')){var _0x4801dd={};_0x4801dd[_0x43cce1[_0xca28('0x29')]]={'$like':'%'+_0x309457['query'][_0xca28('0x3f')]+'%'};return _0x4801dd;}})});}_0xfab1d8=_['merge']({},_0xfab1d8,_0x309457[_0xca28('0x42')]);var _0x5bb14e={'where':_0xfab1d8[_0xca28('0x3d')]};return db[_0xca28('0x2d')]['count'](_0x5bb14e)[_0xca28('0x23')](function(_0x2321cc){_0x3f1ebd[_0xca28('0x1f')]=_0x2321cc;if(_0x309457['query']['includeAll']){_0xfab1d8['include']=[{'all':!![]}];}return db[_0xca28('0x2d')][_0xca28('0x43')](_0xfab1d8);})[_0xca28('0x23')](function(_0x69502){_0x3f1ebd[_0xca28('0x44')]=_0x69502;return _0x3f1ebd;})['then'](respondWithFilteredResult(_0x1f3d68,_0xfab1d8))['catch'](handleError(_0x1f3d68,null));};exports[_0xca28('0x45')]=function(_0x1bb9ea,_0x2760b1){var _0x5949e4={'raw':!![],'where':{'id':_0x1bb9ea[_0xca28('0x46')]['id']}},_0x565198={};_0x565198[_0xca28('0x30')]=_[_0xca28('0x32')](db[_0xca28('0x2d')]['rawAttributes']);_0x565198['query']=_[_0xca28('0x32')](_0x1bb9ea['query']);_0x565198['filters']=_[_0xca28('0x34')](_0x565198[_0xca28('0x30')],_0x565198['query']);_0x5949e4['attributes']=_[_0xca28('0x34')](_0x565198[_0xca28('0x30')],qs['fields'](_0x1bb9ea[_0xca28('0x31')][_0xca28('0x35')]));_0x5949e4['attributes']=_0x5949e4['attributes']['length']?_0x5949e4['attributes']:_0x565198[_0xca28('0x30')];if(_0x1bb9ea[_0xca28('0x31')][_0xca28('0x47')]){_0x5949e4['include']=[{'all':!![]}];}_0x5949e4=_[_0xca28('0x48')]({},_0x5949e4,_0x1bb9ea[_0xca28('0x42')]);return db[_0xca28('0x2d')][_0xca28('0x49')](_0x5949e4)[_0xca28('0x23')](handleEntityNotFound(_0x2760b1,null))['then'](respondWithResult(_0x2760b1,null))[_0xca28('0x4a')](handleError(_0x2760b1,null));};exports[_0xca28('0x4b')]=function(_0x4dc426,_0x5f882){return db['AnalyticExtractedReport'][_0xca28('0x4b')](_0x4dc426[_0xca28('0x4c')],{})[_0xca28('0x23')](function(_0x54e87a){var _0x586a9d=_0x4dc426[_0xca28('0x4d')][_0xca28('0x25')]({'plain':!![]});if(!_0x586a9d)throw new Error(_0xca28('0x4e'));if(_0x586a9d[_0xca28('0x4f')]===_0xca28('0x4d')){var _0x5b74f3=_0x54e87a[_0xca28('0x25')]({'plain':!![]});var _0x949dab=_0xca28('0x26');return db[_0xca28('0x50')][_0xca28('0x49')]({'where':{'name':_0x949dab,'userProfileId':_0x586a9d[_0xca28('0x51')]},'raw':!![]})[_0xca28('0x23')](function(_0x1040ef){if(_0x1040ef&&_0x1040ef[_0xca28('0x52')]===0x0){return db[_0xca28('0x27')][_0xca28('0x4b')]({'name':_0x5b74f3[_0xca28('0x29')],'resourceId':_0x5b74f3['id'],'type':_0x1040ef[_0xca28('0x29')],'sectionId':_0x1040ef['id']},{})[_0xca28('0x23')](function(){return _0x54e87a;});}else{return _0x54e87a;}})[_0xca28('0x4a')](function(_0x4b0093){logger[_0xca28('0x28')](_0xca28('0x53'),_0x4b0093);throw _0x4b0093;});}return _0x54e87a;})[_0xca28('0x23')](respondWithResult(_0x5f882,0xc9))['catch'](handleError(_0x5f882,null));};exports[_0xca28('0x22')]=function(_0x24cb92,_0x196e31){if(_0x24cb92[_0xca28('0x4c')]['id']){delete _0x24cb92['body']['id'];}return db[_0xca28('0x2d')][_0xca28('0x49')]({'where':{'id':_0x24cb92[_0xca28('0x46')]['id']}})[_0xca28('0x23')](handleEntityNotFound(_0x196e31,null))['then'](saveUpdates(_0x24cb92[_0xca28('0x4c')],null))['then'](respondWithResult(_0x196e31,null))[_0xca28('0x4a')](handleError(_0x196e31,null));};exports[_0xca28('0x24')]=function(_0x3631d8,_0x3833cf){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3631d8[_0xca28('0x46')]['id']}})['then'](handleEntityNotFound(_0x3833cf,null))[_0xca28('0x23')](removeEntity(_0x3833cf,null))[_0xca28('0x4a')](handleError(_0x3833cf,null));};exports[_0xca28('0x54')]=function(_0x3a370b,_0x599aae,_0x2cb5c3){return db[_0xca28('0x2d')][_0xca28('0x49')]({'where':{'id':_0x3a370b[_0xca28('0x46')]['id']},'attributes':[_0xca28('0x29'),_0xca28('0x55'),_0xca28('0x56'),_0xca28('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x599aae,null))[_0xca28('0x23')](function(_0x367f9a){if(_0x367f9a){if(!fs['existsSync'](path['join'](config[_0xca28('0x58')],_0xca28('0x59'),_0x367f9a[_0xca28('0x56')]))){throw new db[(_0xca28('0x5a'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3a370b['query'][_0xca28('0x5b')]){return _0x599aae[_0xca28('0x19')](0xc8);}return _0x599aae['download'](path['join'](config['root'],_0xca28('0x59'),_0x367f9a[_0xca28('0x56')]),util[_0xca28('0x5c')](_0xca28('0x5d'),_0x367f9a['basename']||_0x367f9a[_0xca28('0x29')],_0x367f9a[_0xca28('0x57')][_0xca28('0x5e')]()));}})[_0xca28('0x4a')](handleError(_0x599aae,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1fe7b5f..3460cfa 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 _0x9d1a=['rimraf','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x179e65,_0x1a8a69){var _0x1ef216=function(_0x282dfe){while(--_0x282dfe){_0x179e65['push'](_0x179e65['shift']());}};_0x1ef216(++_0x1a8a69);}(_0x9d1a,0x101));var _0xa9d1=function(_0x2a9a82,_0xaca8e0){_0x2a9a82=_0x2a9a82-0x0;var _0x5f49a8=_0x9d1a[_0x2a9a82];return _0x5f49a8;};'use strict';var _=require('lodash');var util=require(_0xa9d1('0x0'));var logger=require(_0xa9d1('0x1'))(_0xa9d1('0x2'));var moment=require(_0xa9d1('0x3'));var BPromise=require(_0xa9d1('0x4'));var rp=require(_0xa9d1('0x5'));var fs=require('fs');var path=require(_0xa9d1('0x6'));var rimraf=require(_0xa9d1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa9d1('0x8'));module[_0xa9d1('0x9')]=function(_0x373c72,_0x256880){return _0x373c72[_0xa9d1('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xa9d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b7f=['../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x22d68a,_0x3f6978){var _0x131c53=function(_0x1781dc){while(--_0x1781dc){_0x22d68a['push'](_0x22d68a['shift']());}};_0x131c53(++_0x3f6978);}(_0x0b7f,0xae));var _0xf0b7=function(_0x211f4e,_0x41fa9c){_0x211f4e=_0x211f4e-0x0;var _0x2cda9c=_0x0b7f[_0x211f4e];return _0x2cda9c;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var logger=require(_0xf0b7('0x2'))('api');var moment=require(_0xf0b7('0x3'));var BPromise=require(_0xf0b7('0x4'));var rp=require(_0xf0b7('0x5'));var fs=require('fs');var path=require(_0xf0b7('0x6'));var rimraf=require(_0xf0b7('0x7'));var config=require(_0xf0b7('0x8'));var attributes=require(_0xf0b7('0x9'));module[_0xf0b7('0xa')]=function(_0x2c5407,_0xc0c8b8){return _0x2c5407['define'](_0xf0b7('0xb'),attributes,{'tableName':_0xf0b7('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 41f1aee..249b537 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 _0x6743=['../../config/logger','../../config/environment','jayson/promise','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6743,0xd0));var _0x3674=function(_0x3a6b78,_0x2d62be){_0x3a6b78=_0x3a6b78-0x0;var _0x4943d4=_0x6743[_0x3a6b78];return _0x4943d4;};'use strict';var _=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var moment=require(_0x3674('0x2'));var BPromise=require(_0x3674('0x3'));var rs=require(_0x3674('0x4'));var fs=require('fs');var Redis=require(_0x3674('0x5'));var db=require(_0x3674('0x6'))['db'];var utils=require(_0x3674('0x7'));var logger=require(_0x3674('0x8'))('rpc');var config=require(_0x3674('0x9'));var jayson=require(_0x3674('0xa'));var client=jayson[_0x3674('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3673b5,_0xe063ab,_0x46628){return new BPromise(function(_0xa634b2,_0x3382af){return client[_0x3674('0xc')](_0x3673b5,_0x46628)[_0x3674('0xd')](function(_0x2926d5){logger['info'](_0x3674('0xe'),_0xe063ab,_0x3674('0xf'));logger[_0x3674('0x10')](_0x3674('0x11'),_0xe063ab,_0x3674('0xf'),JSON[_0x3674('0x12')](_0x2926d5));if(_0x2926d5[_0x3674('0x13')]){if(_0x2926d5[_0x3674('0x13')][_0x3674('0x14')]===0x1f4){logger[_0x3674('0x13')](_0x3674('0xe'),_0xe063ab,_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);return _0x3382af(_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);}logger[_0x3674('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xe063ab,_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);return _0xa634b2(_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);}else{logger[_0x3674('0x16')](_0x3674('0xe'),_0xe063ab,_0x3674('0xf'));_0xa634b2(_0x2926d5[_0x3674('0x17')][_0x3674('0x15')]);}})['catch'](function(_0x419649){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xe063ab,_0x419649);_0x3382af(_0x419649);});});} \ No newline at end of file +var _0x317f=['message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','error'];(function(_0x24450e,_0x420ab9){var _0x7cf367=function(_0x3321a7){while(--_0x3321a7){_0x24450e['push'](_0x24450e['shift']());}};_0x7cf367(++_0x420ab9);}(_0x317f,0x17e));var _0xf317=function(_0x5e9e3d,_0x567718){_0x5e9e3d=_0x5e9e3d-0x0;var _0x579c2c=_0x317f[_0x5e9e3d];return _0x579c2c;};'use strict';var _=require('lodash');var util=require(_0xf317('0x0'));var moment=require(_0xf317('0x1'));var BPromise=require(_0xf317('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf317('0x3'));var db=require(_0xf317('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf317('0x5'));var config=require('../../config/environment');var jayson=require(_0xf317('0x6'));var client=jayson['client'][_0xf317('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f6a74,_0x328145,_0x1ffff9){return new BPromise(function(_0x5b74dd,_0x5e9183){return client[_0xf317('0x8')](_0x4f6a74,_0x1ffff9)[_0xf317('0x9')](function(_0x3ae37c){logger[_0xf317('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x328145,_0xf317('0xb'));logger[_0xf317('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x328145,_0xf317('0xb'),JSON['stringify'](_0x3ae37c));if(_0x3ae37c['error']){if(_0x3ae37c[_0xf317('0xd')]['code']===0x1f4){logger[_0xf317('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x328145,_0x3ae37c[_0xf317('0xd')]['message']);return _0x5e9183(_0x3ae37c[_0xf317('0xd')][_0xf317('0xe')]);}logger['error'](_0xf317('0xf'),_0x328145,_0x3ae37c[_0xf317('0xd')][_0xf317('0xe')]);return _0x5b74dd(_0x3ae37c[_0xf317('0xd')][_0xf317('0xe')]);}else{logger[_0xf317('0xa')](_0xf317('0xf'),_0x328145,_0xf317('0xb'));_0x5b74dd(_0x3ae37c[_0xf317('0x10')][_0xf317('0xe')]);}})[_0xf317('0x11')](function(_0x23ecc2){logger['error'](_0xf317('0xf'),_0x328145,_0x23ecc2);_0x5e9183(_0x23ecc2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index fd80177..603822e 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 _0x1b29=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1b29,0x1b9));var _0x91b2=function(_0x3bf456,_0x1e7b7a){_0x3bf456=_0x3bf456-0x0;var _0x2ff9c7=_0x1b29[_0x3bf456];return _0x2ff9c7;};'use strict';var multer=require(_0x91b2('0x0'));var util=require('util');var path=require(_0x91b2('0x1'));var timeout=require(_0x91b2('0x2'));var express=require(_0x91b2('0x3'));var router=express[_0x91b2('0x4')]();var fs_extra=require(_0x91b2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x91b2('0x6'));var config=require(_0x91b2('0x7'));var controller=require(_0x91b2('0x8'));router[_0x91b2('0x9')]('/',auth['isAuthenticated'](),controller[_0x91b2('0xa')]);router[_0x91b2('0x9')](_0x91b2('0xb'),auth[_0x91b2('0xc')](),controller['show']);router[_0x91b2('0x9')](_0x91b2('0xd'),auth[_0x91b2('0xc')](),controller[_0x91b2('0xe')]);router[_0x91b2('0xf')]('/',auth[_0x91b2('0xc')](),controller[_0x91b2('0x10')]);router[_0x91b2('0x11')](_0x91b2('0xb'),auth[_0x91b2('0xc')](),controller['update']);router[_0x91b2('0x12')](_0x91b2('0xb'),auth[_0x91b2('0xc')](),controller[_0x91b2('0x13')]);module[_0x91b2('0x14')]=router; \ No newline at end of file +var _0x46f2=['download','post','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/download'];(function(_0x477e7e,_0x2929d4){var _0xd97cd0=function(_0x159537){while(--_0x159537){_0x477e7e['push'](_0x477e7e['shift']());}};_0xd97cd0(++_0x2929d4);}(_0x46f2,0xf5));var _0x246f=function(_0x3862e6,_0x168099){_0x3862e6=_0x3862e6-0x0;var _0x50b550=_0x46f2[_0x3862e6];return _0x50b550;};'use strict';var multer=require(_0x246f('0x0'));var util=require('util');var path=require(_0x246f('0x1'));var timeout=require(_0x246f('0x2'));var express=require('express');var router=express[_0x246f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x246f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x246f('0x5')]('/',auth[_0x246f('0x6')](),controller[_0x246f('0x7')]);router['get'](_0x246f('0x8'),auth[_0x246f('0x6')](),controller['show']);router[_0x246f('0x5')](_0x246f('0x9'),auth[_0x246f('0x6')](),controller[_0x246f('0xa')]);router[_0x246f('0xb')]('/',auth[_0x246f('0x6')](),controller[_0x246f('0xc')]);router[_0x246f('0xd')](_0x246f('0x8'),auth[_0x246f('0x6')](),controller['update']);router[_0x246f('0xe')](_0x246f('0x8'),auth[_0x246f('0x6')](),controller[_0x246f('0xf')]);module[_0x246f('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 457445f..745b114 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 _0x0fee=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0fee,0x1b0));var _0xe0fe=function(_0x3c22cb,_0x505ee9){_0x3c22cb=_0x3c22cb-0x0;var _0x2a9300=_0x0fee[_0x3c22cb];return _0x2a9300;};'use strict';var Sequelize=require(_0xe0fe('0x0'));module['exports']={'field':{'type':Sequelize[_0xe0fe('0x1')]},'alias':{'type':Sequelize[_0xe0fe('0x2')]},'function':{'type':Sequelize[_0xe0fe('0x2')]},'format':{'type':Sequelize[_0xe0fe('0x2')]},'groupBy':{'type':Sequelize[_0xe0fe('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe0fe('0x2')]},'custom':{'type':Sequelize[_0xe0fe('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x389a=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x37914d,_0x4209c0){var _0x2b4118=function(_0x10de2){while(--_0x10de2){_0x37914d['push'](_0x37914d['shift']());}};_0x2b4118(++_0x4209c0);}(_0x389a,0x7a));var _0xa389=function(_0x285541,_0x48b48f){_0x285541=_0x285541-0x0;var _0x2f20b4=_0x389a[_0x285541];return _0x2f20b4;};'use strict';var Sequelize=require(_0xa389('0x0'));module[_0xa389('0x1')]={'field':{'type':Sequelize[_0xa389('0x2')]},'alias':{'type':Sequelize[_0xa389('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa389('0x3')]},'custom':{'type':Sequelize[_0xa389('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a800d04..83bcb22 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 _0xea22=['then','destroy','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save'];(function(_0x522e18,_0x8e66df){var _0x3341c5=function(_0x23dcdb){while(--_0x23dcdb){_0x522e18['push'](_0x522e18['shift']());}};_0x3341c5(++_0x8e66df);}(_0xea22,0x183));var _0x2ea2=function(_0x11de22,_0x96e2f5){_0x11de22=_0x11de22-0x0;var _0x54aee9=_0xea22[_0x11de22];return _0x54aee9;};'use strict';var emlformat=require(_0x2ea2('0x0'));var rimraf=require(_0x2ea2('0x1'));var zipdir=require(_0x2ea2('0x2'));var jsonpatch=require(_0x2ea2('0x3'));var rp=require(_0x2ea2('0x4'));var moment=require(_0x2ea2('0x5'));var BPromise=require(_0x2ea2('0x6'));var Mustache=require(_0x2ea2('0x7'));var util=require(_0x2ea2('0x8'));var path=require(_0x2ea2('0x9'));var sox=require('sox');var csv=require(_0x2ea2('0xa'));var ejs=require(_0x2ea2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ea2('0xc'));var squel=require(_0x2ea2('0xd'));var crypto=require('crypto');var jsforce=require(_0x2ea2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2ea2('0xa'));var querystring=require(_0x2ea2('0xf'));var Papa=require(_0x2ea2('0x10'));var Redis=require(_0x2ea2('0x11'));var authService=require(_0x2ea2('0x12'));var qs=require(_0x2ea2('0x13'));var as=require(_0x2ea2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2ea2('0x15'));var utils=require(_0x2ea2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2ea2('0x17'));var db=require(_0x2ea2('0x18'))['db'];function respondWithStatusCode(_0x3eaf74,_0x2c5862){_0x2c5862=_0x2c5862||0xcc;return function(_0x2b8c84){if(_0x2b8c84){return _0x3eaf74[_0x2ea2('0x19')](_0x2c5862);}return _0x3eaf74[_0x2ea2('0x1a')](_0x2c5862)[_0x2ea2('0x1b')]();};}function respondWithResult(_0x139b0e,_0x43ddeb){_0x43ddeb=_0x43ddeb||0xc8;return function(_0x6e9d0c){if(_0x6e9d0c){return _0x139b0e[_0x2ea2('0x1a')](_0x43ddeb)[_0x2ea2('0x1c')](_0x6e9d0c);}};}function respondWithFilteredResult(_0x1558b3,_0x1ac2a3){return function(_0x1d9bdd){if(_0x1d9bdd){var _0x37845f=typeof _0x1ac2a3['offset']==='undefined'&&typeof _0x1ac2a3[_0x2ea2('0x1d')]===_0x2ea2('0x1e');var _0x212825=_0x1d9bdd[_0x2ea2('0x1f')];var _0xc006e8=_0x37845f?0x0:_0x1ac2a3[_0x2ea2('0x20')];var _0x4413c3=_0x37845f?_0x1d9bdd['count']:_0x1ac2a3[_0x2ea2('0x20')]+_0x1ac2a3[_0x2ea2('0x1d')];var _0x34732f;if(_0x4413c3>=_0x212825){_0x4413c3=_0x212825;_0x34732f=0xc8;}else{_0x34732f=0xce;}_0x1558b3[_0x2ea2('0x1a')](_0x34732f);return _0x1558b3[_0x2ea2('0x21')](_0x2ea2('0x22'),_0xc006e8+'-'+_0x4413c3+'/'+_0x212825)[_0x2ea2('0x1c')](_0x1d9bdd);}return null;};}function patchUpdates(_0x41b2af){return function(_0x3fba50){try{jsonpatch[_0x2ea2('0x23')](_0x3fba50,_0x41b2af,!![]);}catch(_0x368dd8){return BPromise[_0x2ea2('0x24')](_0x368dd8);}return _0x3fba50[_0x2ea2('0x25')]();};}function saveUpdates(_0x5e76d2,_0x3d4c23){return function(_0x5ef662){if(_0x5ef662){return _0x5ef662['update'](_0x5e76d2)[_0x2ea2('0x26')](function(_0x4ed627){return _0x4ed627;});}return null;};}function removeEntity(_0x4937f1,_0x1e8bff){return function(_0x125c60){if(_0x125c60){return _0x125c60[_0x2ea2('0x27')]()[_0x2ea2('0x26')](function(){_0x4937f1[_0x2ea2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c154a,_0x1e11df){return function(_0x501878){if(!_0x501878){_0x5c154a[_0x2ea2('0x19')](0x194);}return _0x501878;};}function handleError(_0x57d324,_0x3412d4){_0x3412d4=_0x3412d4||0x1f4;return function(_0x23b612){logger['error'](_0x23b612['stack']);if(_0x23b612[_0x2ea2('0x28')]){delete _0x23b612[_0x2ea2('0x28')];}_0x57d324['status'](_0x3412d4)[_0x2ea2('0x29')](_0x23b612);};}exports[_0x2ea2('0x2a')]=function(_0x580746,_0x3c8e6f){var _0x494157={},_0x1f2091={},_0x1f88b9={'count':0x0,'rows':[]};var _0x51abcb=_['map'](db[_0x2ea2('0x2b')][_0x2ea2('0x2c')],function(_0x7a380f){return{'name':_0x7a380f[_0x2ea2('0x2d')],'type':_0x7a380f[_0x2ea2('0x2e')][_0x2ea2('0x2f')]};});_0x1f2091[_0x2ea2('0x30')]=_[_0x2ea2('0x31')](_0x51abcb,_0x2ea2('0x28'));_0x1f2091[_0x2ea2('0x32')]=_[_0x2ea2('0x33')](_0x580746['query']);_0x1f2091['filters']=_['intersection'](_0x1f2091['model'],_0x1f2091[_0x2ea2('0x32')]);_0x494157[_0x2ea2('0x34')]=_['intersection'](_0x1f2091['model'],qs[_0x2ea2('0x35')](_0x580746[_0x2ea2('0x32')]['fields']));_0x494157['attributes']=_0x494157['attributes'][_0x2ea2('0x36')]?_0x494157[_0x2ea2('0x34')]:_0x1f2091[_0x2ea2('0x30')];if(!_0x580746[_0x2ea2('0x32')][_0x2ea2('0x37')](_0x2ea2('0x38'))){_0x494157[_0x2ea2('0x1d')]=qs[_0x2ea2('0x1d')](_0x580746['query']['limit']);_0x494157['offset']=qs[_0x2ea2('0x20')](_0x580746[_0x2ea2('0x32')][_0x2ea2('0x20')]);}_0x494157[_0x2ea2('0x39')]=qs['sort'](_0x580746[_0x2ea2('0x32')]['sort']);_0x494157[_0x2ea2('0x3a')]=qs['filters'](_[_0x2ea2('0x3b')](_0x580746[_0x2ea2('0x32')],_0x1f2091[_0x2ea2('0x3c')]),_0x51abcb);if(_0x580746[_0x2ea2('0x32')][_0x2ea2('0x3d')]){_0x494157[_0x2ea2('0x3a')]=_[_0x2ea2('0x3e')](_0x494157[_0x2ea2('0x3a')],{'$or':_[_0x2ea2('0x31')](_0x51abcb,function(_0x2f83cd){if(_0x2f83cd[_0x2ea2('0x2e')]!==_0x2ea2('0x3f')){var _0x12137f={};_0x12137f[_0x2f83cd[_0x2ea2('0x28')]]={'$like':'%'+_0x580746[_0x2ea2('0x32')][_0x2ea2('0x3d')]+'%'};return _0x12137f;}})});}_0x494157=_[_0x2ea2('0x3e')]({},_0x494157,_0x580746[_0x2ea2('0x40')]);var _0x3e78a1={'where':_0x494157['where']};return db[_0x2ea2('0x2b')]['count'](_0x3e78a1)['then'](function(_0x221fb0){_0x1f88b9['count']=_0x221fb0;if(_0x580746[_0x2ea2('0x32')]['includeAll']){_0x494157[_0x2ea2('0x41')]=[{'all':!![]}];}return db[_0x2ea2('0x2b')][_0x2ea2('0x42')](_0x494157);})[_0x2ea2('0x26')](function(_0x365ad8){_0x1f88b9[_0x2ea2('0x43')]=_0x365ad8;return _0x1f88b9;})[_0x2ea2('0x26')](respondWithFilteredResult(_0x3c8e6f,_0x494157))[_0x2ea2('0x44')](handleError(_0x3c8e6f,null));};exports[_0x2ea2('0x45')]=function(_0x7ba0e5,_0x2331cc){var _0x4e8b04={'raw':![],'where':{'id':_0x7ba0e5[_0x2ea2('0x46')]['id']}},_0x299925={};_0x299925[_0x2ea2('0x30')]=_[_0x2ea2('0x33')](db[_0x2ea2('0x2b')][_0x2ea2('0x2c')]);_0x299925[_0x2ea2('0x32')]=_[_0x2ea2('0x33')](_0x7ba0e5['query']);_0x299925[_0x2ea2('0x3c')]=_['intersection'](_0x299925[_0x2ea2('0x30')],_0x299925[_0x2ea2('0x32')]);_0x4e8b04[_0x2ea2('0x34')]=_[_0x2ea2('0x47')](_0x299925['model'],qs['fields'](_0x7ba0e5[_0x2ea2('0x32')]['fields']));_0x4e8b04[_0x2ea2('0x34')]=_0x4e8b04[_0x2ea2('0x34')][_0x2ea2('0x36')]?_0x4e8b04[_0x2ea2('0x34')]:_0x299925['model'];if(_0x7ba0e5[_0x2ea2('0x32')][_0x2ea2('0x48')]){_0x4e8b04[_0x2ea2('0x41')]=[{'all':!![]}];}_0x4e8b04=_[_0x2ea2('0x3e')]({},_0x4e8b04,_0x7ba0e5[_0x2ea2('0x40')]);return db[_0x2ea2('0x2b')][_0x2ea2('0x49')](_0x4e8b04)[_0x2ea2('0x26')](handleEntityNotFound(_0x2331cc,null))['then'](respondWithResult(_0x2331cc,null))[_0x2ea2('0x44')](handleError(_0x2331cc,null));};exports[_0x2ea2('0x4a')]=function(_0x528c3d,_0x1aac25){return db[_0x2ea2('0x2b')]['create'](_0x528c3d[_0x2ea2('0x4b')],{})[_0x2ea2('0x26')](respondWithResult(_0x1aac25,0xc9))['catch'](handleError(_0x1aac25,null));};exports[_0x2ea2('0x4c')]=function(_0x364a82,_0x23f18b){return db['AnalyticFieldReport'][_0x2ea2('0x4c')](_0x364a82['body'],{'raw':![],'individualHooks':!![]})[_0x2ea2('0x26')](respondWithResult(_0x23f18b,0xc9))['catch'](handleError(_0x23f18b,null));};exports[_0x2ea2('0x4d')]=function(_0x22426a,_0x515cc9){if(_0x22426a[_0x2ea2('0x4b')]['id']){delete _0x22426a[_0x2ea2('0x4b')]['id'];}return db['AnalyticFieldReport'][_0x2ea2('0x49')]({'where':{'id':_0x22426a[_0x2ea2('0x46')]['id']}})[_0x2ea2('0x26')](handleEntityNotFound(_0x515cc9,null))[_0x2ea2('0x26')](saveUpdates(_0x22426a[_0x2ea2('0x4b')],null))[_0x2ea2('0x26')](respondWithResult(_0x515cc9,null))['catch'](handleError(_0x515cc9,null));};exports[_0x2ea2('0x27')]=function(_0x51139f,_0x3ed96b){return db[_0x2ea2('0x2b')][_0x2ea2('0x49')]({'where':{'id':_0x51139f[_0x2ea2('0x46')]['id']}})[_0x2ea2('0x26')](handleEntityNotFound(_0x3ed96b,null))['then'](removeEntity(_0x3ed96b,null))['catch'](handleError(_0x3ed96b,null));};exports[_0x2ea2('0x4e')]=function(_0x21132c,_0x5fe9e8){return db[_0x2ea2('0x2b')][_0x2ea2('0x27')]({'where':{'id':_0x21132c[_0x2ea2('0x32')][_0x2ea2('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x2ea2('0x26')](respondWithResult(_0x5fe9e8,0xcc))[_0x2ea2('0x44')](handleError(_0x5fe9e8,null));};exports[_0x2ea2('0x50')]=function(_0x81d0ee,_0x291919,_0x384079){return db['AnalyticCustomReport'][_0x2ea2('0x51')]({'where':{'id':_0x81d0ee[_0x2ea2('0x46')]['id']}})['then'](handleEntityNotFound(_0x291919,null))[_0x2ea2('0x26')](function(_0x4e346e){if(_0x4e346e){return db[_0x2ea2('0x52')][_0x2ea2('0x53')](function(_0x5e4545){return db['AnalyticFieldReport'][_0x2ea2('0x27')]({'where':{'CustomReportId':_0x81d0ee[_0x2ea2('0x46')]['id']},'transaction':_0x5e4545})[_0x2ea2('0x26')](function(_0xe6de6c){var _0x8e2bbe=_[_0x2ea2('0x31')](_0x81d0ee[_0x2ea2('0x4b')],function(_0x4de666){delete _0x4de666['id'];_0x4de666[_0x2ea2('0x54')]=_0x81d0ee[_0x2ea2('0x46')]['id'];return _0x4de666;});return db[_0x2ea2('0x2b')][_0x2ea2('0x4c')](_0x8e2bbe,{'transaction':_0x5e4545});});})['then'](function(){return db[_0x2ea2('0x2b')][_0x2ea2('0x42')]({'where':{'CustomReportId':_0x81d0ee[_0x2ea2('0x46')]['id']}});});}})[_0x2ea2('0x26')](respondWithResult(_0x291919,null))[_0x2ea2('0x44')](handleError(_0x291919,null));}; \ No newline at end of file +var _0x9d14=['rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','sequelize','transaction','CustomReportId','eml-format'];(function(_0x3562a3,_0x11ec75){var _0x1ffc21=function(_0x291631){while(--_0x291631){_0x3562a3['push'](_0x3562a3['shift']());}};_0x1ffc21(++_0x11ec75);}(_0x9d14,0x1cd));var _0x49d1=function(_0x276ce1,_0x2846f8){_0x276ce1=_0x276ce1-0x0;var _0x301c54=_0x9d14[_0x276ce1];return _0x301c54;};'use strict';var emlformat=require(_0x49d1('0x0'));var rimraf=require(_0x49d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49d1('0x2'));var rp=require(_0x49d1('0x3'));var moment=require('moment');var BPromise=require(_0x49d1('0x4'));var Mustache=require(_0x49d1('0x5'));var util=require(_0x49d1('0x6'));var path=require('path');var sox=require(_0x49d1('0x7'));var csv=require(_0x49d1('0x8'));var ejs=require(_0x49d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49d1('0xa'));var squel=require(_0x49d1('0xb'));var crypto=require(_0x49d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49d1('0xd'));var Redis=require(_0x49d1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x49d1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x49d1('0x10'));var config=require(_0x49d1('0x11'));var licenseUtil=require(_0x49d1('0x12'));var db=require(_0x49d1('0x13'))['db'];function respondWithStatusCode(_0x456063,_0x1f8d79){_0x1f8d79=_0x1f8d79||0xcc;return function(_0x14a112){if(_0x14a112){return _0x456063[_0x49d1('0x14')](_0x1f8d79);}return _0x456063['status'](_0x1f8d79)[_0x49d1('0x15')]();};}function respondWithResult(_0x324101,_0x2ed474){_0x2ed474=_0x2ed474||0xc8;return function(_0x267704){if(_0x267704){return _0x324101[_0x49d1('0x16')](_0x2ed474)[_0x49d1('0x17')](_0x267704);}};}function respondWithFilteredResult(_0x308ab9,_0xcf1e2e){return function(_0x3f2508){if(_0x3f2508){var _0x5735eb=typeof _0xcf1e2e[_0x49d1('0x18')]===_0x49d1('0x19')&&typeof _0xcf1e2e[_0x49d1('0x1a')]==='undefined';var _0x104d9f=_0x3f2508[_0x49d1('0x1b')];var _0x1b6c24=_0x5735eb?0x0:_0xcf1e2e[_0x49d1('0x18')];var _0x5d64b8=_0x5735eb?_0x3f2508['count']:_0xcf1e2e[_0x49d1('0x18')]+_0xcf1e2e['limit'];var _0x592e2d;if(_0x5d64b8>=_0x104d9f){_0x5d64b8=_0x104d9f;_0x592e2d=0xc8;}else{_0x592e2d=0xce;}_0x308ab9[_0x49d1('0x16')](_0x592e2d);return _0x308ab9[_0x49d1('0x1c')]('Content-Range',_0x1b6c24+'-'+_0x5d64b8+'/'+_0x104d9f)[_0x49d1('0x17')](_0x3f2508);}return null;};}function patchUpdates(_0x98456e){return function(_0x45e83f){try{jsonpatch[_0x49d1('0x1d')](_0x45e83f,_0x98456e,!![]);}catch(_0x57e542){return BPromise['reject'](_0x57e542);}return _0x45e83f[_0x49d1('0x1e')]();};}function saveUpdates(_0x194821,_0x8fd12b){return function(_0x53b0b2){if(_0x53b0b2){return _0x53b0b2[_0x49d1('0x1f')](_0x194821)[_0x49d1('0x20')](function(_0x75b35b){return _0x75b35b;});}return null;};}function removeEntity(_0x33b4a6,_0x461b2e){return function(_0x53b568){if(_0x53b568){return _0x53b568[_0x49d1('0x21')]()[_0x49d1('0x20')](function(){_0x33b4a6[_0x49d1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x322b66,_0x45ee9e){return function(_0x138836){if(!_0x138836){_0x322b66[_0x49d1('0x14')](0x194);}return _0x138836;};}function handleError(_0x96a7af,_0x32a7a1){_0x32a7a1=_0x32a7a1||0x1f4;return function(_0x184c4e){logger[_0x49d1('0x22')](_0x184c4e[_0x49d1('0x23')]);if(_0x184c4e[_0x49d1('0x24')]){delete _0x184c4e[_0x49d1('0x24')];}_0x96a7af[_0x49d1('0x16')](_0x32a7a1)[_0x49d1('0x25')](_0x184c4e);};}exports[_0x49d1('0x26')]=function(_0x3e27c3,_0x5beab3){var _0x585fe9={},_0x3b76f4={},_0x7354bd={'count':0x0,'rows':[]};var _0x522934=_['map'](db[_0x49d1('0x27')][_0x49d1('0x28')],function(_0x2aea83){return{'name':_0x2aea83['fieldName'],'type':_0x2aea83[_0x49d1('0x29')][_0x49d1('0x2a')]};});_0x3b76f4[_0x49d1('0x2b')]=_[_0x49d1('0x2c')](_0x522934,_0x49d1('0x24'));_0x3b76f4['query']=_[_0x49d1('0x2d')](_0x3e27c3[_0x49d1('0x2e')]);_0x3b76f4['filters']=_[_0x49d1('0x2f')](_0x3b76f4[_0x49d1('0x2b')],_0x3b76f4[_0x49d1('0x2e')]);_0x585fe9[_0x49d1('0x30')]=_['intersection'](_0x3b76f4[_0x49d1('0x2b')],qs[_0x49d1('0x31')](_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x31')]));_0x585fe9[_0x49d1('0x30')]=_0x585fe9[_0x49d1('0x30')]['length']?_0x585fe9[_0x49d1('0x30')]:_0x3b76f4[_0x49d1('0x2b')];if(!_0x3e27c3['query'][_0x49d1('0x32')](_0x49d1('0x33'))){_0x585fe9[_0x49d1('0x1a')]=qs['limit'](_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x1a')]);_0x585fe9[_0x49d1('0x18')]=qs[_0x49d1('0x18')](_0x3e27c3['query'][_0x49d1('0x18')]);}_0x585fe9[_0x49d1('0x34')]=qs[_0x49d1('0x35')](_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x35')]);_0x585fe9[_0x49d1('0x36')]=qs[_0x49d1('0x37')](_[_0x49d1('0x38')](_0x3e27c3[_0x49d1('0x2e')],_0x3b76f4['filters']),_0x522934);if(_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x39')]){_0x585fe9[_0x49d1('0x36')]=_[_0x49d1('0x3a')](_0x585fe9[_0x49d1('0x36')],{'$or':_[_0x49d1('0x2c')](_0x522934,function(_0x38dc21){if(_0x38dc21[_0x49d1('0x29')]!=='VIRTUAL'){var _0x51c524={};_0x51c524[_0x38dc21[_0x49d1('0x24')]]={'$like':'%'+_0x3e27c3[_0x49d1('0x2e')][_0x49d1('0x39')]+'%'};return _0x51c524;}})});}_0x585fe9=_[_0x49d1('0x3a')]({},_0x585fe9,_0x3e27c3[_0x49d1('0x3b')]);var _0x2a4fee={'where':_0x585fe9[_0x49d1('0x36')]};return db[_0x49d1('0x27')][_0x49d1('0x1b')](_0x2a4fee)['then'](function(_0x2cb22d){_0x7354bd[_0x49d1('0x1b')]=_0x2cb22d;if(_0x3e27c3['query'][_0x49d1('0x3c')]){_0x585fe9['include']=[{'all':!![]}];}return db[_0x49d1('0x27')][_0x49d1('0x3d')](_0x585fe9);})[_0x49d1('0x20')](function(_0x2d238e){_0x7354bd[_0x49d1('0x3e')]=_0x2d238e;return _0x7354bd;})[_0x49d1('0x20')](respondWithFilteredResult(_0x5beab3,_0x585fe9))['catch'](handleError(_0x5beab3,null));};exports[_0x49d1('0x3f')]=function(_0x304696,_0x119797){var _0x1d689d={'raw':![],'where':{'id':_0x304696[_0x49d1('0x40')]['id']}},_0x53ec51={};_0x53ec51[_0x49d1('0x2b')]=_['keys'](db[_0x49d1('0x27')][_0x49d1('0x28')]);_0x53ec51['query']=_[_0x49d1('0x2d')](_0x304696[_0x49d1('0x2e')]);_0x53ec51['filters']=_[_0x49d1('0x2f')](_0x53ec51['model'],_0x53ec51['query']);_0x1d689d[_0x49d1('0x30')]=_['intersection'](_0x53ec51[_0x49d1('0x2b')],qs[_0x49d1('0x31')](_0x304696[_0x49d1('0x2e')][_0x49d1('0x31')]));_0x1d689d[_0x49d1('0x30')]=_0x1d689d[_0x49d1('0x30')]['length']?_0x1d689d[_0x49d1('0x30')]:_0x53ec51[_0x49d1('0x2b')];if(_0x304696['query'][_0x49d1('0x3c')]){_0x1d689d[_0x49d1('0x41')]=[{'all':!![]}];}_0x1d689d=_['merge']({},_0x1d689d,_0x304696[_0x49d1('0x3b')]);return db[_0x49d1('0x27')][_0x49d1('0x42')](_0x1d689d)['then'](handleEntityNotFound(_0x119797,null))[_0x49d1('0x20')](respondWithResult(_0x119797,null))[_0x49d1('0x43')](handleError(_0x119797,null));};exports[_0x49d1('0x44')]=function(_0x579b5c,_0x4bffea){return db['AnalyticFieldReport'][_0x49d1('0x44')](_0x579b5c[_0x49d1('0x45')],{})[_0x49d1('0x20')](respondWithResult(_0x4bffea,0xc9))['catch'](handleError(_0x4bffea,null));};exports[_0x49d1('0x46')]=function(_0x16ee95,_0x4d51c5){return db[_0x49d1('0x27')]['bulkCreate'](_0x16ee95[_0x49d1('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4d51c5,0xc9))[_0x49d1('0x43')](handleError(_0x4d51c5,null));};exports[_0x49d1('0x1f')]=function(_0x5ca011,_0x5cc4c7){if(_0x5ca011[_0x49d1('0x45')]['id']){delete _0x5ca011['body']['id'];}return db['AnalyticFieldReport'][_0x49d1('0x42')]({'where':{'id':_0x5ca011[_0x49d1('0x40')]['id']}})[_0x49d1('0x20')](handleEntityNotFound(_0x5cc4c7,null))[_0x49d1('0x20')](saveUpdates(_0x5ca011[_0x49d1('0x45')],null))[_0x49d1('0x20')](respondWithResult(_0x5cc4c7,null))[_0x49d1('0x43')](handleError(_0x5cc4c7,null));};exports[_0x49d1('0x21')]=function(_0x5e9cd9,_0x3e8441){return db[_0x49d1('0x27')]['find']({'where':{'id':_0x5e9cd9[_0x49d1('0x40')]['id']}})[_0x49d1('0x20')](handleEntityNotFound(_0x3e8441,null))[_0x49d1('0x20')](removeEntity(_0x3e8441,null))[_0x49d1('0x43')](handleError(_0x3e8441,null));};exports[_0x49d1('0x47')]=function(_0x19704b,_0x4b1852){return db['AnalyticFieldReport'][_0x49d1('0x21')]({'where':{'id':_0x19704b[_0x49d1('0x2e')][_0x49d1('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x49d1('0x20')](respondWithResult(_0x4b1852,0xcc))[_0x49d1('0x43')](handleError(_0x4b1852,null));};exports[_0x49d1('0x49')]=function(_0xe877d9,_0x1a5135,_0x42f5c1){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0xe877d9[_0x49d1('0x40')]['id']}})[_0x49d1('0x20')](handleEntityNotFound(_0x1a5135,null))[_0x49d1('0x20')](function(_0x3bc8e1){if(_0x3bc8e1){return db[_0x49d1('0x4a')][_0x49d1('0x4b')](function(_0xb78a47){return db[_0x49d1('0x27')][_0x49d1('0x21')]({'where':{'CustomReportId':_0xe877d9[_0x49d1('0x40')]['id']},'transaction':_0xb78a47})[_0x49d1('0x20')](function(_0x44639e){var _0x5da8e5=_[_0x49d1('0x2c')](_0xe877d9[_0x49d1('0x45')],function(_0xe8072b){delete _0xe8072b['id'];_0xe8072b[_0x49d1('0x4c')]=_0xe877d9[_0x49d1('0x40')]['id'];return _0xe8072b;});return db[_0x49d1('0x27')]['bulkCreate'](_0x5da8e5,{'transaction':_0xb78a47});});})['then'](function(){return db[_0x49d1('0x27')][_0x49d1('0x3d')]({'where':{'CustomReportId':_0xe877d9[_0x49d1('0x40')]['id']}});});}})[_0x49d1('0x20')](respondWithResult(_0x1a5135,null))['catch'](handleError(_0x1a5135,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6055918..f9ce6e1 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 _0x177c=['rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x6bb4fa,_0x4603e3){var _0x4cd4d0=function(_0x194f14){while(--_0x194f14){_0x6bb4fa['push'](_0x6bb4fa['shift']());}};_0x4cd4d0(++_0x4603e3);}(_0x177c,0x94));var _0xc177=function(_0x117eaa,_0x3357f6){_0x117eaa=_0x117eaa-0x0;var _0x2ca8ea=_0x177c[_0x117eaa];return _0x2ca8ea;};'use strict';var _=require(_0xc177('0x0'));var util=require(_0xc177('0x1'));var logger=require(_0xc177('0x2'))(_0xc177('0x3'));var moment=require(_0xc177('0x4'));var BPromise=require(_0xc177('0x5'));var rp=require(_0xc177('0x6'));var fs=require('fs');var path=require(_0xc177('0x7'));var rimraf=require(_0xc177('0x8'));var config=require('../../config/environment');var attributes=require(_0xc177('0x9'));module[_0xc177('0xa')]=function(_0x479e72,_0x12829d){return _0x479e72[_0xc177('0xb')](_0xc177('0xc'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf92=['../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util'];(function(_0x1c461e,_0x1b98ff){var _0x1dce4f=function(_0x5cbdf0){while(--_0x5cbdf0){_0x1c461e['push'](_0x1c461e['shift']());}};_0x1dce4f(++_0x1b98ff);}(_0xcf92,0x172));var _0x2cf9=function(_0x45ebd2,_0x575711){_0x45ebd2=_0x45ebd2-0x0;var _0x3da67f=_0xcf92[_0x45ebd2];return _0x3da67f;};'use strict';var _=require(_0x2cf9('0x0'));var util=require(_0x2cf9('0x1'));var logger=require(_0x2cf9('0x2'))(_0x2cf9('0x3'));var moment=require(_0x2cf9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cf9('0x5'));var rimraf=require(_0x2cf9('0x6'));var config=require(_0x2cf9('0x7'));var attributes=require(_0x2cf9('0x8'));module[_0x2cf9('0x9')]=function(_0x5db801,_0x3b658c){return _0x5db801[_0x2cf9('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x2cf9('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 546acea..bac155f 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 _0xf728=['message','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../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'];(function(_0x4b13ce,_0x339cb0){var _0x427d4b=function(_0x26aaad){while(--_0x26aaad){_0x4b13ce['push'](_0x4b13ce['shift']());}};_0x427d4b(++_0x339cb0);}(_0xf728,0x17e));var _0x8f72=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xf728[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8f72('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f72('0x1'))['db'];var utils=require(_0x8f72('0x2'));var logger=require(_0x8f72('0x3'))(_0x8f72('0x4'));var config=require(_0x8f72('0x5'));var jayson=require(_0x8f72('0x6'));var client=jayson['client'][_0x8f72('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x152419,_0x170ffa,_0x54554f){return new BPromise(function(_0x4fa93b,_0x16e523){return client[_0x8f72('0x8')](_0x152419,_0x54554f)[_0x8f72('0x9')](function(_0x84235c){logger[_0x8f72('0xa')](_0x8f72('0xb'),_0x170ffa,_0x8f72('0xc'));logger[_0x8f72('0xd')](_0x8f72('0xe'),_0x170ffa,_0x8f72('0xc'),JSON[_0x8f72('0xf')](_0x84235c));if(_0x84235c[_0x8f72('0x10')]){if(_0x84235c[_0x8f72('0x10')][_0x8f72('0x11')]===0x1f4){logger[_0x8f72('0x10')](_0x8f72('0xb'),_0x170ffa,_0x84235c[_0x8f72('0x10')][_0x8f72('0x12')]);return _0x16e523(_0x84235c['error']['message']);}logger['error'](_0x8f72('0xb'),_0x170ffa,_0x84235c[_0x8f72('0x10')][_0x8f72('0x12')]);return _0x4fa93b(_0x84235c[_0x8f72('0x10')][_0x8f72('0x12')]);}else{logger[_0x8f72('0xa')](_0x8f72('0xb'),_0x170ffa,_0x8f72('0xc'));_0x4fa93b(_0x84235c['result'][_0x8f72('0x12')]);}})[_0x8f72('0x13')](function(_0x18a082){logger[_0x8f72('0x10')](_0x8f72('0xb'),_0x170ffa,_0x18a082);_0x16e523(_0x18a082);});});} \ No newline at end of file +var _0x7ad4=['then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x5d95bd,_0x48296a){var _0x2a3489=function(_0x26d892){while(--_0x26d892){_0x5d95bd['push'](_0x5d95bd['shift']());}};_0x2a3489(++_0x48296a);}(_0x7ad4,0x130));var _0x47ad=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ad4[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x47ad('0x0'));var moment=require(_0x47ad('0x1'));var BPromise=require(_0x47ad('0x2'));var rs=require(_0x47ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47ad('0x4'));var logger=require(_0x47ad('0x5'))(_0x47ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x47ad('0x7'));var client=jayson[_0x47ad('0x8')][_0x47ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ed25a,_0x5aed0c,_0x142b7c){return new BPromise(function(_0x27a487,_0x38fb12){return client[_0x47ad('0xa')](_0x5ed25a,_0x142b7c)[_0x47ad('0xb')](function(_0x20c1b1){logger[_0x47ad('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5aed0c,_0x47ad('0xd'));logger[_0x47ad('0xe')](_0x47ad('0xf'),_0x5aed0c,_0x47ad('0xd'),JSON[_0x47ad('0x10')](_0x20c1b1));if(_0x20c1b1[_0x47ad('0x11')]){if(_0x20c1b1[_0x47ad('0x11')]['code']===0x1f4){logger[_0x47ad('0x11')](_0x47ad('0x12'),_0x5aed0c,_0x20c1b1[_0x47ad('0x11')][_0x47ad('0x13')]);return _0x38fb12(_0x20c1b1[_0x47ad('0x11')]['message']);}logger[_0x47ad('0x11')](_0x47ad('0x12'),_0x5aed0c,_0x20c1b1[_0x47ad('0x11')]['message']);return _0x27a487(_0x20c1b1[_0x47ad('0x11')][_0x47ad('0x13')]);}else{logger[_0x47ad('0xc')](_0x47ad('0x12'),_0x5aed0c,'request\x20sent');_0x27a487(_0x20c1b1[_0x47ad('0x14')][_0x47ad('0x13')]);}})['catch'](function(_0x5a6bbb){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5aed0c,_0x5a6bbb);_0x38fb12(_0x5a6bbb);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7b8380e..2aebbef 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(_0x1cee93,_0x5de9e8){var _0x20068a=function(_0x564257){while(--_0x564257){_0x1cee93['push'](_0x1cee93['shift']());}};_0x20068a(++_0x5de9e8);}(_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('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(_0x3a5b6c,_0x2123f4){var _0x2c891f=function(_0x9aa86e){while(--_0x9aa86e){_0x3a5b6c['push'](_0x3a5b6c['shift']());}};_0x2c891f(++_0x2123f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 9179d00..db0e3f0 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 _0x0269=['STRING','sequelize'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0x0269,0x135));var _0x9026=function(_0x4fd451,_0x470854){_0x4fd451=_0x4fd451-0x0;var _0x1a71e6=_0x0269[_0x4fd451];return _0x1a71e6;};'use strict';var Sequelize=require(_0x9026('0x0'));module['exports']={'name':{'type':Sequelize[_0x9026('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x9026('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x9026('0x1')]}}; \ No newline at end of file +var _0xfd07=['exports','STRING','sequelize'];(function(_0x48b986,_0x5acc83){var _0x324ed5=function(_0x343034){while(--_0x343034){_0x48b986['push'](_0x48b986['shift']());}};_0x324ed5(++_0x5acc83);}(_0xfd07,0x104));var _0x7fd0=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xfd07[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x7fd0('0x0'));module[_0x7fd0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x7fd0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 12977e4..381fcea 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 _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x439089,_0x22a66){var _0x5e0d29=function(_0x1c80aa){while(--_0x1c80aa){_0x439089['push'](_0x439089['shift']());}};_0x5e0d29(++_0x22a66);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4c2164,_0x1a6f70){_0x4c2164=_0x4c2164-0x0;var _0x44ccdc=_0xdbf5[_0x4c2164];return _0x44ccdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x174ad8,_0x46e5f0){var _0x20f68b=function(_0x35c0bf){while(--_0x35c0bf){_0x174ad8['push'](_0x174ad8['shift']());}};_0x20f68b(++_0x46e5f0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1e190c,_0x1a07b8){_0x1e190c=_0x1e190c-0x0;var _0x1823e6=_0x8ef6[_0x1e190c];return _0x1823e6;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index dd1ce1f..d49712c 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 _0x5581=['AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x5581,0x115));var _0x1558=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5581[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x1558('0x0'));var util=require('util');var logger=require(_0x1558('0x1'))(_0x1558('0x2'));var moment=require(_0x1558('0x3'));var BPromise=require(_0x1558('0x4'));var rp=require(_0x1558('0x5'));var fs=require('fs');var path=require(_0x1558('0x6'));var rimraf=require('rimraf');var config=require(_0x1558('0x7'));var attributes=require(_0x1558('0x8'));module['exports']=function(_0x24c333,_0xcaef09){return _0x24c333['define'](_0x1558('0x9'),attributes,{'tableName':_0x1558('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22ed=['../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1bfb22,_0x11bf71){var _0x52c53c=function(_0x16152e){while(--_0x16152e){_0x1bfb22['push'](_0x1bfb22['shift']());}};_0x52c53c(++_0x11bf71);}(_0x22ed,0x1a9));var _0xd22e=function(_0x456f94,_0x300c8b){_0x456f94=_0x456f94-0x0;var _0x193640=_0x22ed[_0x456f94];return _0x193640;};'use strict';var _=require(_0xd22e('0x0'));var util=require(_0xd22e('0x1'));var logger=require(_0xd22e('0x2'))(_0xd22e('0x3'));var moment=require(_0xd22e('0x4'));var BPromise=require(_0xd22e('0x5'));var rp=require(_0xd22e('0x6'));var fs=require('fs');var path=require(_0xd22e('0x7'));var rimraf=require(_0xd22e('0x8'));var config=require(_0xd22e('0x9'));var attributes=require(_0xd22e('0xa'));module[_0xd22e('0xb')]=function(_0x4cd924,_0x131034){return _0x4cd924[_0xd22e('0xc')]('AnalyticMetric',attributes,{'tableName':_0xd22e('0xd'),'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 f6c5f49..9efe4a3 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 _0x612a=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5a6e31,_0x28ed9c){var _0x4fd1a4=function(_0x591af2){while(--_0x591af2){_0x5a6e31['push'](_0x5a6e31['shift']());}};_0x4fd1a4(++_0x28ed9c);}(_0x612a,0x1c7));var _0xa612=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x612a[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xa612('0x0'));var util=require(_0xa612('0x1'));var moment=require(_0xa612('0x2'));var BPromise=require(_0xa612('0x3'));var rs=require(_0xa612('0x4'));var fs=require('fs');var Redis=require(_0xa612('0x5'));var db=require(_0xa612('0x6'))['db'];var utils=require(_0xa612('0x7'));var logger=require('../../config/logger')(_0xa612('0x8'));var config=require(_0xa612('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa612('0xa')][_0xa612('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dae12,_0xbe07ae,_0x33489a){return new BPromise(function(_0x29e69b,_0x3990f1){return client['request'](_0x1dae12,_0x33489a)[_0xa612('0xc')](function(_0x160cf1){logger['info'](_0xa612('0xd'),_0xbe07ae,_0xa612('0xe'));logger[_0xa612('0xf')](_0xa612('0x10'),_0xbe07ae,_0xa612('0xe'),JSON[_0xa612('0x11')](_0x160cf1));if(_0x160cf1[_0xa612('0x12')]){if(_0x160cf1[_0xa612('0x12')]['code']===0x1f4){logger[_0xa612('0x12')](_0xa612('0xd'),_0xbe07ae,_0x160cf1[_0xa612('0x12')][_0xa612('0x13')]);return _0x3990f1(_0x160cf1['error'][_0xa612('0x13')]);}logger[_0xa612('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0xbe07ae,_0x160cf1['error'][_0xa612('0x13')]);return _0x29e69b(_0x160cf1[_0xa612('0x12')][_0xa612('0x13')]);}else{logger[_0xa612('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0xbe07ae,_0xa612('0xe'));_0x29e69b(_0x160cf1[_0xa612('0x15')][_0xa612('0x13')]);}})[_0xa612('0x16')](function(_0x4e9ef5){logger[_0xa612('0x12')](_0xa612('0xd'),_0xbe07ae,_0x4e9ef5);_0x3990f1(_0x4e9ef5);});});} \ No newline at end of file +var _0x207b=['client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x207b,0x15e));var _0xb207=function(_0x7dee60,_0x4cb724){_0x7dee60=_0x7dee60-0x0;var _0x58892a=_0x207b[_0x7dee60];return _0x58892a;};'use strict';var _=require(_0xb207('0x0'));var util=require(_0xb207('0x1'));var moment=require(_0xb207('0x2'));var BPromise=require(_0xb207('0x3'));var rs=require(_0xb207('0x4'));var fs=require('fs');var Redis=require(_0xb207('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb207('0x6'));var logger=require(_0xb207('0x7'))(_0xb207('0x8'));var config=require('../../config/environment');var jayson=require(_0xb207('0x9'));var client=jayson[_0xb207('0xa')][_0xb207('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2369a0,_0x470804,_0x4e0aa9){return new BPromise(function(_0x15b3ac,_0x19915e){return client[_0xb207('0xc')](_0x2369a0,_0x4e0aa9)[_0xb207('0xd')](function(_0x1dad4d){logger[_0xb207('0xe')](_0xb207('0xf'),_0x470804,_0xb207('0x10'));logger[_0xb207('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x470804,'request\x20sent',JSON[_0xb207('0x12')](_0x1dad4d));if(_0x1dad4d[_0xb207('0x13')]){if(_0x1dad4d[_0xb207('0x13')][_0xb207('0x14')]===0x1f4){logger[_0xb207('0x13')](_0xb207('0xf'),_0x470804,_0x1dad4d['error'][_0xb207('0x15')]);return _0x19915e(_0x1dad4d[_0xb207('0x13')][_0xb207('0x15')]);}logger['error'](_0xb207('0xf'),_0x470804,_0x1dad4d[_0xb207('0x13')][_0xb207('0x15')]);return _0x15b3ac(_0x1dad4d['error'][_0xb207('0x15')]);}else{logger[_0xb207('0xe')](_0xb207('0xf'),_0x470804,_0xb207('0x10'));_0x15b3ac(_0x1dad4d[_0xb207('0x16')][_0xb207('0x15')]);}})[_0xb207('0x17')](function(_0x5a9d18){logger[_0xb207('0x13')](_0xb207('0xf'),_0x470804,_0x5a9d18);_0x19915e(_0x5a9d18);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0c85ddb..0ce73d8 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 _0x0b3d=['express','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','post','put','isAuthenticated','update','destroy','exports','multer','path'];(function(_0x582d2d,_0x36ad61){var _0x4536cc=function(_0x2ae54b){while(--_0x2ae54b){_0x582d2d['push'](_0x582d2d['shift']());}};_0x4536cc(++_0x36ad61);}(_0x0b3d,0x76));var _0xd0b3=function(_0x4fbffe,_0x4c69d1){_0x4fbffe=_0x4fbffe-0x0;var _0x2bbd73=_0x0b3d[_0x4fbffe];return _0x2bbd73;};'use strict';var multer=require(_0xd0b3('0x0'));var util=require('util');var path=require(_0xd0b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0b3('0x2'));var router=express['Router']();var fs_extra=require(_0xd0b3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd0b3('0x4'));var config=require('../../config/environment');var controller=require(_0xd0b3('0x5'));router[_0xd0b3('0x6')]('/',auth['isAuthenticated'](),controller[_0xd0b3('0x7')]);router['get'](_0xd0b3('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xd0b3('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd0b3('0xa')]('/:id',auth[_0xd0b3('0xb')](),controller[_0xd0b3('0xc')]);router['delete']('/:id',auth[_0xd0b3('0xb')](),controller[_0xd0b3('0xd')]);module[_0xd0b3('0xe')]=router; \ No newline at end of file +var _0x45d1=['multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x45d1,0x1cb));var _0x145d=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x45d1[_0x9c3c56];return _0x2dd782;};'use strict';var multer=require(_0x145d('0x0'));var util=require(_0x145d('0x1'));var path=require('path');var timeout=require(_0x145d('0x2'));var express=require(_0x145d('0x3'));var router=express['Router']();var fs_extra=require(_0x145d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x145d('0x5'));var config=require(_0x145d('0x6'));var controller=require(_0x145d('0x7'));router[_0x145d('0x8')]('/',auth[_0x145d('0x9')](),controller[_0x145d('0xa')]);router[_0x145d('0x8')](_0x145d('0xb'),auth[_0x145d('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x145d('0xc')]);router[_0x145d('0xd')](_0x145d('0xb'),auth['isAuthenticated'](),controller[_0x145d('0xe')]);router['delete'](_0x145d('0xb'),auth[_0x145d('0x9')](),controller[_0x145d('0xf')]);module[_0x145d('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 b0c0ef2..a83d640 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 _0x8521=['TEXT','exports'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x8521,0xf1));var _0x1852=function(_0x15edef,_0x25a255){_0x15edef=_0x15edef-0x0;var _0x5dc85c=_0x8521[_0x15edef];return _0x5dc85c;};'use strict';var Sequelize=require('sequelize');module[_0x1852('0x0')]={'tree':{'type':Sequelize[_0x1852('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf478=['TEXT','exports'];(function(_0x3103cc,_0x55087e){var _0x34f61c=function(_0x532981){while(--_0x532981){_0x3103cc['push'](_0x3103cc['shift']());}};_0x34f61c(++_0x55087e);}(_0xf478,0xb7));var _0x8f47=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf478[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x8f47('0x0')]={'tree':{'type':Sequelize[_0x8f47('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 7379791..4e4721b 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 _0x88b8=['show','params','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x88b8,0x9a));var _0x888b=function(_0x127a60,_0x37f33a){_0x127a60=_0x127a60-0x0;var _0xc1f6a3=_0x88b8[_0x127a60];return _0xc1f6a3;};'use strict';var emlformat=require(_0x888b('0x0'));var rimraf=require(_0x888b('0x1'));var zipdir=require(_0x888b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x888b('0x3'));var moment=require(_0x888b('0x4'));var BPromise=require(_0x888b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x888b('0x6'));var sox=require(_0x888b('0x7'));var csv=require('to-csv');var ejs=require(_0x888b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x888b('0x9'));var squel=require(_0x888b('0xa'));var crypto=require(_0x888b('0xb'));var jsforce=require(_0x888b('0xc'));var deskjs=require(_0x888b('0xd'));var toCsv=require(_0x888b('0xe'));var querystring=require(_0x888b('0xf'));var Papa=require('papaparse');var Redis=require(_0x888b('0x10'));var authService=require(_0x888b('0x11'));var qs=require(_0x888b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x888b('0x13'));var logger=require(_0x888b('0x14'))(_0x888b('0x15'));var utils=require(_0x888b('0x16'));var config=require(_0x888b('0x17'));var licenseUtil=require(_0x888b('0x18'));var db=require(_0x888b('0x19'))['db'];function respondWithStatusCode(_0x190e83,_0x5d0990){_0x5d0990=_0x5d0990||0xcc;return function(_0x2bd742){if(_0x2bd742){return _0x190e83[_0x888b('0x1a')](_0x5d0990);}return _0x190e83[_0x888b('0x1b')](_0x5d0990)[_0x888b('0x1c')]();};}function respondWithResult(_0x395357,_0x41d3fa){_0x41d3fa=_0x41d3fa||0xc8;return function(_0x20b9d8){if(_0x20b9d8){return _0x395357['status'](_0x41d3fa)[_0x888b('0x1d')](_0x20b9d8);}};}function respondWithFilteredResult(_0x3bad91,_0x1f150f){return function(_0x19d248){if(_0x19d248){var _0x56951b=typeof _0x1f150f['offset']===_0x888b('0x1e')&&typeof _0x1f150f['limit']===_0x888b('0x1e');var _0x34f1f0=_0x19d248[_0x888b('0x1f')];var _0x310acb=_0x56951b?0x0:_0x1f150f[_0x888b('0x20')];var _0x18e210=_0x56951b?_0x19d248['count']:_0x1f150f[_0x888b('0x20')]+_0x1f150f['limit'];var _0x437359;if(_0x18e210>=_0x34f1f0){_0x18e210=_0x34f1f0;_0x437359=0xc8;}else{_0x437359=0xce;}_0x3bad91['status'](_0x437359);return _0x3bad91[_0x888b('0x21')]('Content-Range',_0x310acb+'-'+_0x18e210+'/'+_0x34f1f0)[_0x888b('0x1d')](_0x19d248);}return null;};}function patchUpdates(_0x3d548f){return function(_0x414593){try{jsonpatch[_0x888b('0x22')](_0x414593,_0x3d548f,!![]);}catch(_0x116d05){return BPromise[_0x888b('0x23')](_0x116d05);}return _0x414593[_0x888b('0x24')]();};}function saveUpdates(_0x461e4d,_0xb6ad74){return function(_0x41796e){if(_0x41796e){return _0x41796e['update'](_0x461e4d)[_0x888b('0x25')](function(_0x170b0b){return _0x170b0b;});}return null;};}function removeEntity(_0x227137,_0x26a5c0){return function(_0xc8a2a7){if(_0xc8a2a7){return _0xc8a2a7[_0x888b('0x26')]()['then'](function(){_0x227137['status'](0xcc)[_0x888b('0x1c')]();});}};}function handleEntityNotFound(_0x542aca,_0x26fc46){return function(_0xeb8ee9){if(!_0xeb8ee9){_0x542aca[_0x888b('0x1a')](0x194);}return _0xeb8ee9;};}function handleError(_0x4f05fa,_0xec9a8c){_0xec9a8c=_0xec9a8c||0x1f4;return function(_0x3d87ca){logger['error'](_0x3d87ca[_0x888b('0x27')]);if(_0x3d87ca[_0x888b('0x28')]){delete _0x3d87ca[_0x888b('0x28')];}_0x4f05fa[_0x888b('0x1b')](_0xec9a8c)[_0x888b('0x29')](_0x3d87ca);};}exports[_0x888b('0x2a')]=function(_0xe868ba,_0x165afe){var _0x234ad7={},_0x566cae={},_0x451319={'count':0x0,'rows':[]};var _0x58370d=_['map'](db[_0x888b('0x2b')][_0x888b('0x2c')],function(_0x1fc4f6){return{'name':_0x1fc4f6[_0x888b('0x2d')],'type':_0x1fc4f6[_0x888b('0x2e')]['key']};});_0x566cae[_0x888b('0x2f')]=_['map'](_0x58370d,_0x888b('0x28'));_0x566cae[_0x888b('0x30')]=_[_0x888b('0x31')](_0xe868ba['query']);_0x566cae[_0x888b('0x32')]=_['intersection'](_0x566cae[_0x888b('0x2f')],_0x566cae[_0x888b('0x30')]);_0x234ad7[_0x888b('0x33')]=_['intersection'](_0x566cae[_0x888b('0x2f')],qs[_0x888b('0x34')](_0xe868ba[_0x888b('0x30')][_0x888b('0x34')]));_0x234ad7['attributes']=_0x234ad7[_0x888b('0x33')][_0x888b('0x35')]?_0x234ad7['attributes']:_0x566cae[_0x888b('0x2f')];if(!_0xe868ba[_0x888b('0x30')][_0x888b('0x36')]('nolimit')){_0x234ad7['limit']=qs[_0x888b('0x37')](_0xe868ba[_0x888b('0x30')][_0x888b('0x37')]);_0x234ad7[_0x888b('0x20')]=qs['offset'](_0xe868ba['query'][_0x888b('0x20')]);}_0x234ad7[_0x888b('0x38')]=qs['sort'](_0xe868ba['query'][_0x888b('0x39')]);_0x234ad7[_0x888b('0x3a')]=qs[_0x888b('0x32')](_['pick'](_0xe868ba[_0x888b('0x30')],_0x566cae[_0x888b('0x32')]),_0x58370d);if(_0xe868ba[_0x888b('0x30')][_0x888b('0x3b')]){_0x234ad7[_0x888b('0x3a')]=_['merge'](_0x234ad7[_0x888b('0x3a')],{'$or':_[_0x888b('0x3c')](_0x58370d,function(_0x39097d){if(_0x39097d[_0x888b('0x2e')]!==_0x888b('0x3d')){var _0x2ab8d1={};_0x2ab8d1[_0x39097d[_0x888b('0x28')]]={'$like':'%'+_0xe868ba[_0x888b('0x30')][_0x888b('0x3b')]+'%'};return _0x2ab8d1;}})});}_0x234ad7=_[_0x888b('0x3e')]({},_0x234ad7,_0xe868ba[_0x888b('0x3f')]);var _0x4f47e7={'where':_0x234ad7['where']};return db[_0x888b('0x2b')][_0x888b('0x1f')](_0x4f47e7)['then'](function(_0x4ac5d1){_0x451319[_0x888b('0x1f')]=_0x4ac5d1;if(_0xe868ba[_0x888b('0x30')][_0x888b('0x40')]){_0x234ad7[_0x888b('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x234ad7);})[_0x888b('0x25')](function(_0x257794){_0x451319[_0x888b('0x42')]=_0x257794;return _0x451319;})[_0x888b('0x25')](respondWithFilteredResult(_0x165afe,_0x234ad7))[_0x888b('0x43')](handleError(_0x165afe,null));};exports[_0x888b('0x44')]=function(_0x42058c,_0x5d0d1c){var _0x304651={'raw':!![],'where':{'id':_0x42058c[_0x888b('0x45')]['id']}},_0x3e091c={};_0x3e091c[_0x888b('0x2f')]=_[_0x888b('0x31')](db[_0x888b('0x2b')][_0x888b('0x2c')]);_0x3e091c[_0x888b('0x30')]=_[_0x888b('0x31')](_0x42058c[_0x888b('0x30')]);_0x3e091c[_0x888b('0x32')]=_['intersection'](_0x3e091c['model'],_0x3e091c[_0x888b('0x30')]);_0x304651['attributes']=_['intersection'](_0x3e091c[_0x888b('0x2f')],qs[_0x888b('0x34')](_0x42058c['query'][_0x888b('0x34')]));_0x304651[_0x888b('0x33')]=_0x304651[_0x888b('0x33')]['length']?_0x304651['attributes']:_0x3e091c[_0x888b('0x2f')];if(_0x42058c[_0x888b('0x30')][_0x888b('0x40')]){_0x304651[_0x888b('0x41')]=[{'all':!![]}];}_0x304651=_[_0x888b('0x3e')]({},_0x304651,_0x42058c['options']);return db['AnalyticTreeReport'][_0x888b('0x46')](_0x304651)[_0x888b('0x25')](handleEntityNotFound(_0x5d0d1c,null))['then'](respondWithResult(_0x5d0d1c,null))[_0x888b('0x43')](handleError(_0x5d0d1c,null));};exports[_0x888b('0x47')]=function(_0x427d80,_0x5a50a9){return db['AnalyticTreeReport'][_0x888b('0x47')](_0x427d80['body'],{})[_0x888b('0x25')](respondWithResult(_0x5a50a9,0xc9))[_0x888b('0x43')](handleError(_0x5a50a9,null));};exports[_0x888b('0x48')]=function(_0x4c150d,_0x2df34f){if(_0x4c150d[_0x888b('0x49')]['id']){delete _0x4c150d[_0x888b('0x49')]['id'];}return db[_0x888b('0x2b')][_0x888b('0x46')]({'where':{'id':_0x4c150d[_0x888b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2df34f,null))[_0x888b('0x25')](saveUpdates(_0x4c150d[_0x888b('0x49')],null))['then'](respondWithResult(_0x2df34f,null))[_0x888b('0x43')](handleError(_0x2df34f,null));};exports[_0x888b('0x26')]=function(_0x12e54d,_0x5cad1a){return db['AnalyticTreeReport'][_0x888b('0x46')]({'where':{'id':_0x12e54d[_0x888b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cad1a,null))[_0x888b('0x25')](removeEntity(_0x5cad1a,null))[_0x888b('0x43')](handleError(_0x5cad1a,null));}; \ No newline at end of file +var _0x5720=['count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x3a7fe5,_0x371426){var _0x18ed66=function(_0x4f6a16){while(--_0x4f6a16){_0x3a7fe5['push'](_0x3a7fe5['shift']());}};_0x18ed66(++_0x371426);}(_0x5720,0x10d));var _0x0572=function(_0x5d868e,_0x3e31db){_0x5d868e=_0x5d868e-0x0;var _0x378d99=_0x5720[_0x5d868e];return _0x378d99;};'use strict';var emlformat=require(_0x0572('0x0'));var rimraf=require(_0x0572('0x1'));var zipdir=require(_0x0572('0x2'));var jsonpatch=require(_0x0572('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0572('0x4'));var Mustache=require(_0x0572('0x5'));var util=require(_0x0572('0x6'));var path=require(_0x0572('0x7'));var sox=require(_0x0572('0x8'));var csv=require(_0x0572('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0572('0xa'));var squel=require(_0x0572('0xb'));var crypto=require('crypto');var jsforce=require(_0x0572('0xc'));var deskjs=require(_0x0572('0xd'));var toCsv=require(_0x0572('0x9'));var querystring=require(_0x0572('0xe'));var Papa=require(_0x0572('0xf'));var Redis=require(_0x0572('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0572('0x11'));var as=require(_0x0572('0x12'));var hardwareService=require(_0x0572('0x13'));var logger=require('../../config/logger')(_0x0572('0x14'));var utils=require(_0x0572('0x15'));var config=require(_0x0572('0x16'));var licenseUtil=require(_0x0572('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2622e5,_0x4b20fe){_0x4b20fe=_0x4b20fe||0xcc;return function(_0x19eed7){if(_0x19eed7){return _0x2622e5[_0x0572('0x18')](_0x4b20fe);}return _0x2622e5[_0x0572('0x19')](_0x4b20fe)[_0x0572('0x1a')]();};}function respondWithResult(_0x561dbc,_0x2cc054){_0x2cc054=_0x2cc054||0xc8;return function(_0x53cd78){if(_0x53cd78){return _0x561dbc[_0x0572('0x19')](_0x2cc054)[_0x0572('0x1b')](_0x53cd78);}};}function respondWithFilteredResult(_0x365e05,_0x99e4fa){return function(_0x4ce1b6){if(_0x4ce1b6){var _0x19418b=typeof _0x99e4fa[_0x0572('0x1c')]===_0x0572('0x1d')&&typeof _0x99e4fa[_0x0572('0x1e')]===_0x0572('0x1d');var _0x5afc8d=_0x4ce1b6[_0x0572('0x1f')];var _0x4fbe74=_0x19418b?0x0:_0x99e4fa[_0x0572('0x1c')];var _0x2c06f1=_0x19418b?_0x4ce1b6['count']:_0x99e4fa[_0x0572('0x1c')]+_0x99e4fa[_0x0572('0x1e')];var _0x21e556;if(_0x2c06f1>=_0x5afc8d){_0x2c06f1=_0x5afc8d;_0x21e556=0xc8;}else{_0x21e556=0xce;}_0x365e05[_0x0572('0x19')](_0x21e556);return _0x365e05[_0x0572('0x20')](_0x0572('0x21'),_0x4fbe74+'-'+_0x2c06f1+'/'+_0x5afc8d)[_0x0572('0x1b')](_0x4ce1b6);}return null;};}function patchUpdates(_0x435631){return function(_0x692990){try{jsonpatch[_0x0572('0x22')](_0x692990,_0x435631,!![]);}catch(_0x214347){return BPromise['reject'](_0x214347);}return _0x692990[_0x0572('0x23')]();};}function saveUpdates(_0x43be08,_0x4213f3){return function(_0xc3e1b){if(_0xc3e1b){return _0xc3e1b[_0x0572('0x24')](_0x43be08)[_0x0572('0x25')](function(_0x466d69){return _0x466d69;});}return null;};}function removeEntity(_0x4c76b5,_0x3d87b8){return function(_0x5a9560){if(_0x5a9560){return _0x5a9560[_0x0572('0x26')]()[_0x0572('0x25')](function(){_0x4c76b5['status'](0xcc)[_0x0572('0x1a')]();});}};}function handleEntityNotFound(_0x408711,_0x7fbd84){return function(_0x41e8c6){if(!_0x41e8c6){_0x408711[_0x0572('0x18')](0x194);}return _0x41e8c6;};}function handleError(_0x582981,_0x451385){_0x451385=_0x451385||0x1f4;return function(_0x43bf44){logger[_0x0572('0x27')](_0x43bf44['stack']);if(_0x43bf44[_0x0572('0x28')]){delete _0x43bf44['name'];}_0x582981[_0x0572('0x19')](_0x451385)[_0x0572('0x29')](_0x43bf44);};}exports[_0x0572('0x2a')]=function(_0x577f3b,_0xf93a68){var _0x272792={},_0x1bffec={},_0x4dd80c={'count':0x0,'rows':[]};var _0x2e15aa=_[_0x0572('0x2b')](db[_0x0572('0x2c')][_0x0572('0x2d')],function(_0x1bbec8){return{'name':_0x1bbec8[_0x0572('0x2e')],'type':_0x1bbec8['type'][_0x0572('0x2f')]};});_0x1bffec[_0x0572('0x30')]=_[_0x0572('0x2b')](_0x2e15aa,'name');_0x1bffec[_0x0572('0x31')]=_[_0x0572('0x32')](_0x577f3b[_0x0572('0x31')]);_0x1bffec[_0x0572('0x33')]=_[_0x0572('0x34')](_0x1bffec[_0x0572('0x30')],_0x1bffec[_0x0572('0x31')]);_0x272792[_0x0572('0x35')]=_[_0x0572('0x34')](_0x1bffec[_0x0572('0x30')],qs[_0x0572('0x36')](_0x577f3b[_0x0572('0x31')]['fields']));_0x272792[_0x0572('0x35')]=_0x272792[_0x0572('0x35')][_0x0572('0x37')]?_0x272792[_0x0572('0x35')]:_0x1bffec[_0x0572('0x30')];if(!_0x577f3b[_0x0572('0x31')][_0x0572('0x38')](_0x0572('0x39'))){_0x272792['limit']=qs[_0x0572('0x1e')](_0x577f3b[_0x0572('0x31')][_0x0572('0x1e')]);_0x272792[_0x0572('0x1c')]=qs[_0x0572('0x1c')](_0x577f3b[_0x0572('0x31')][_0x0572('0x1c')]);}_0x272792['order']=qs[_0x0572('0x3a')](_0x577f3b[_0x0572('0x31')][_0x0572('0x3a')]);_0x272792[_0x0572('0x3b')]=qs[_0x0572('0x33')](_[_0x0572('0x3c')](_0x577f3b[_0x0572('0x31')],_0x1bffec['filters']),_0x2e15aa);if(_0x577f3b[_0x0572('0x31')]['filter']){_0x272792[_0x0572('0x3b')]=_[_0x0572('0x3d')](_0x272792[_0x0572('0x3b')],{'$or':_[_0x0572('0x2b')](_0x2e15aa,function(_0x2e185d){if(_0x2e185d[_0x0572('0x3e')]!==_0x0572('0x3f')){var _0x14aba1={};_0x14aba1[_0x2e185d[_0x0572('0x28')]]={'$like':'%'+_0x577f3b['query'][_0x0572('0x40')]+'%'};return _0x14aba1;}})});}_0x272792=_['merge']({},_0x272792,_0x577f3b[_0x0572('0x41')]);var _0x30cb76={'where':_0x272792[_0x0572('0x3b')]};return db[_0x0572('0x2c')]['count'](_0x30cb76)[_0x0572('0x25')](function(_0x353e55){_0x4dd80c[_0x0572('0x1f')]=_0x353e55;if(_0x577f3b[_0x0572('0x31')][_0x0572('0x42')]){_0x272792[_0x0572('0x43')]=[{'all':!![]}];}return db[_0x0572('0x2c')][_0x0572('0x44')](_0x272792);})['then'](function(_0x3b5a20){_0x4dd80c['rows']=_0x3b5a20;return _0x4dd80c;})[_0x0572('0x25')](respondWithFilteredResult(_0xf93a68,_0x272792))['catch'](handleError(_0xf93a68,null));};exports[_0x0572('0x45')]=function(_0x25c85f,_0x17e896){var _0x7949f9={'raw':!![],'where':{'id':_0x25c85f[_0x0572('0x46')]['id']}},_0x3284c3={};_0x3284c3['model']=_['keys'](db[_0x0572('0x2c')][_0x0572('0x2d')]);_0x3284c3['query']=_['keys'](_0x25c85f[_0x0572('0x31')]);_0x3284c3['filters']=_[_0x0572('0x34')](_0x3284c3[_0x0572('0x30')],_0x3284c3['query']);_0x7949f9[_0x0572('0x35')]=_[_0x0572('0x34')](_0x3284c3[_0x0572('0x30')],qs[_0x0572('0x36')](_0x25c85f[_0x0572('0x31')]['fields']));_0x7949f9[_0x0572('0x35')]=_0x7949f9['attributes']['length']?_0x7949f9[_0x0572('0x35')]:_0x3284c3[_0x0572('0x30')];if(_0x25c85f[_0x0572('0x31')][_0x0572('0x42')]){_0x7949f9[_0x0572('0x43')]=[{'all':!![]}];}_0x7949f9=_[_0x0572('0x3d')]({},_0x7949f9,_0x25c85f[_0x0572('0x41')]);return db[_0x0572('0x2c')][_0x0572('0x47')](_0x7949f9)['then'](handleEntityNotFound(_0x17e896,null))[_0x0572('0x25')](respondWithResult(_0x17e896,null))[_0x0572('0x48')](handleError(_0x17e896,null));};exports[_0x0572('0x49')]=function(_0x595ac5,_0x277405){return db['AnalyticTreeReport'][_0x0572('0x49')](_0x595ac5[_0x0572('0x4a')],{})['then'](respondWithResult(_0x277405,0xc9))[_0x0572('0x48')](handleError(_0x277405,null));};exports[_0x0572('0x24')]=function(_0x75456c,_0x2e2c15){if(_0x75456c[_0x0572('0x4a')]['id']){delete _0x75456c['body']['id'];}return db['AnalyticTreeReport'][_0x0572('0x47')]({'where':{'id':_0x75456c[_0x0572('0x46')]['id']}})[_0x0572('0x25')](handleEntityNotFound(_0x2e2c15,null))[_0x0572('0x25')](saveUpdates(_0x75456c[_0x0572('0x4a')],null))[_0x0572('0x25')](respondWithResult(_0x2e2c15,null))[_0x0572('0x48')](handleError(_0x2e2c15,null));};exports['destroy']=function(_0x3c50d1,_0x1345bb){return db[_0x0572('0x2c')][_0x0572('0x47')]({'where':{'id':_0x3c50d1[_0x0572('0x46')]['id']}})['then'](handleEntityNotFound(_0x1345bb,null))[_0x0572('0x25')](removeEntity(_0x1345bb,null))['catch'](handleError(_0x1345bb,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f2f1c4e..e737e53 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 _0x0ce4=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x0ce4,0x1bb));var _0x40ce=function(_0x15f25f,_0x215e5a){_0x15f25f=_0x15f25f-0x0;var _0x166c14=_0x0ce4[_0x15f25f];return _0x166c14;};'use strict';var _=require(_0x40ce('0x0'));var util=require(_0x40ce('0x1'));var logger=require(_0x40ce('0x2'))(_0x40ce('0x3'));var moment=require(_0x40ce('0x4'));var BPromise=require(_0x40ce('0x5'));var rp=require(_0x40ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1a977d,_0x348c62){return _0x1a977d['define'](_0x40ce('0x7'),attributes,{'tableName':_0x40ce('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80e4=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x6bf157,_0xdbf619){var _0x4c541e=function(_0x12b768){while(--_0x12b768){_0x6bf157['push'](_0x6bf157['shift']());}};_0x4c541e(++_0xdbf619);}(_0x80e4,0x116));var _0x480e=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x80e4[_0x5ad07c];return _0x204bae;};'use strict';var _=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var logger=require(_0x480e('0x2'))(_0x480e('0x3'));var moment=require(_0x480e('0x4'));var BPromise=require(_0x480e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x480e('0x6'));var rimraf=require(_0x480e('0x7'));var config=require(_0x480e('0x8'));var attributes=require(_0x480e('0x9'));module[_0x480e('0xa')]=function(_0x50c0cb,_0x18ceac){return _0x50c0cb[_0x480e('0xb')](_0x480e('0xc'),attributes,{'tableName':_0x480e('0xd'),'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 3dd789b..bbf4d96 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x522823,_0x384ee1){var _0x56c7f=function(_0x4fa193){while(--_0x4fa193){_0x522823['push'](_0x522823['shift']());}};_0x56c7f(++_0x384ee1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x8bbacf,_0x561127){_0x8bbacf=_0x8bbacf-0x0;var _0x505736=_0x5f2f[_0x8bbacf];return _0x505736;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0xadb5,0xad));var _0x5adb=function(_0x32f706,_0x295301){_0x32f706=_0x32f706-0x0;var _0x35ac84=_0xadb5[_0x32f706];return _0x35ac84;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 429d8cb..fcd9ed4 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 _0xe7c5=['get','isAuthenticated','show','post','create','put','destroy','multer','util','Router','fs-extra','../../components/auth/service','./analyticTreeReport.controller'];(function(_0x42b83b,_0x5c0beb){var _0x5ed29f=function(_0x1cfd13){while(--_0x1cfd13){_0x42b83b['push'](_0x42b83b['shift']());}};_0x5ed29f(++_0x5c0beb);}(_0xe7c5,0xa3));var _0x5e7c=function(_0x37e261,_0x52f605){_0x37e261=_0x37e261-0x0;var _0x44a7fd=_0xe7c5[_0x37e261];return _0x44a7fd;};'use strict';var multer=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e7c('0x2')]();var fs_extra=require(_0x5e7c('0x3'));var auth=require(_0x5e7c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e7c('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5e7c('0x6')]('/:id',auth[_0x5e7c('0x7')](),controller[_0x5e7c('0x8')]);router[_0x5e7c('0x9')]('/',auth[_0x5e7c('0x7')](),controller[_0x5e7c('0xa')]);router[_0x5e7c('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x5e7c('0x7')](),controller[_0x5e7c('0xc')]);module['exports']=router; \ No newline at end of file +var _0xf641=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','connect-timeout','express'];(function(_0x295849,_0x42b3eb){var _0x27d8d4=function(_0x375ae0){while(--_0x375ae0){_0x295849['push'](_0x295849['shift']());}};_0x27d8d4(++_0x42b3eb);}(_0xf641,0x17e));var _0x1f64=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0xf641[_0x33ca22];return _0x1790c3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1f64('0x0'));var express=require(_0x1f64('0x1'));var router=express[_0x1f64('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1f64('0x3'));var interaction=require(_0x1f64('0x4'));var config=require(_0x1f64('0x5'));var controller=require(_0x1f64('0x6'));router[_0x1f64('0x7')]('/',auth[_0x1f64('0x8')](),controller['index']);router['get'](_0x1f64('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x1f64('0xa')]('/',auth[_0x1f64('0x8')](),controller[_0x1f64('0xb')]);router['put'](_0x1f64('0x9'),auth['isAuthenticated'](),controller[_0x1f64('0xc')]);router[_0x1f64('0xd')](_0x1f64('0x9'),auth[_0x1f64('0x8')](),controller[_0x1f64('0xe')]);module[_0x1f64('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d0c656c..03f11df 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 _0x3d6d=['exports','STRING','sequelize'];(function(_0x51b1a6,_0x3acde8){var _0x412d94=function(_0x5f21bc){while(--_0x5f21bc){_0x51b1a6['push'](_0x51b1a6['shift']());}};_0x412d94(++_0x3acde8);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x43afbb,_0x448109){_0x43afbb=_0x43afbb-0x0;var _0xa9ddec=_0x3d6d[_0x43afbb];return _0xa9ddec;};'use strict';var Sequelize=require(_0xd3d6('0x0'));module[_0xd3d6('0x1')]={'name':{'type':Sequelize[_0xd3d6('0x2')]},'basename':{'type':Sequelize[_0xd3d6('0x2')]},'type':{'type':Sequelize[_0xd3d6('0x2')]}}; \ No newline at end of file +var _0x5044=['exports','STRING'];(function(_0x8599ab,_0x2aab42){var _0x191a01=function(_0x2bd1c9){while(--_0x2bd1c9){_0x8599ab['push'](_0x8599ab['shift']());}};_0x191a01(++_0x2aab42);}(_0x5044,0xc8));var _0x4504=function(_0x1c0e04,_0x402de0){_0x1c0e04=_0x1c0e04-0x0;var _0x2e01aa=_0x5044[_0x1c0e04];return _0x2e01aa;};'use strict';var Sequelize=require('sequelize');module[_0x4504('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4504('0x1')]},'type':{'type':Sequelize[_0x4504('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 59d5bc3..02c253b 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 _0x092e=['findAll','rows','show','params','find','catch','get','omit','createdAt','updatedAt','body','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','Attachment','rawAttributes','fieldName','key','model','map','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','order','where','filter','merge','type','options','includeAll','include'];(function(_0x4c65ca,_0xaa401a){var _0x44baa1=function(_0x406787){while(--_0x406787){_0x4c65ca['push'](_0x4c65ca['shift']());}};_0x44baa1(++_0xaa401a);}(_0x092e,0x17a));var _0xe092=function(_0x19f033,_0x4025fb){_0x19f033=_0x19f033-0x0;var _0x475528=_0x092e[_0x19f033];return _0x475528;};'use strict';var emlformat=require(_0xe092('0x0'));var rimraf=require(_0xe092('0x1'));var zipdir=require(_0xe092('0x2'));var jsonpatch=require(_0xe092('0x3'));var rp=require(_0xe092('0x4'));var moment=require(_0xe092('0x5'));var BPromise=require(_0xe092('0x6'));var Mustache=require(_0xe092('0x7'));var util=require(_0xe092('0x8'));var path=require(_0xe092('0x9'));var sox=require(_0xe092('0xa'));var csv=require(_0xe092('0xb'));var ejs=require(_0xe092('0xc'));var fs=require('fs');var fs_extra=require(_0xe092('0xd'));var _=require(_0xe092('0xe'));var squel=require(_0xe092('0xf'));var crypto=require(_0xe092('0x10'));var jsforce=require(_0xe092('0x11'));var deskjs=require(_0xe092('0x12'));var toCsv=require(_0xe092('0xb'));var querystring=require(_0xe092('0x13'));var Papa=require(_0xe092('0x14'));var Redis=require('ioredis');var authService=require(_0xe092('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe092('0x16'));var hardwareService=require(_0xe092('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe092('0x18'));var config=require(_0xe092('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe092('0x1a'))['db'];function respondWithStatusCode(_0x937b0c,_0x285bd2){_0x285bd2=_0x285bd2||0xcc;return function(_0x20cbf2){if(_0x20cbf2){return _0x937b0c['sendStatus'](_0x285bd2);}return _0x937b0c[_0xe092('0x1b')](_0x285bd2)[_0xe092('0x1c')]();};}function respondWithResult(_0x38c3a2,_0x543566){_0x543566=_0x543566||0xc8;return function(_0x254e9e){if(_0x254e9e){return _0x38c3a2[_0xe092('0x1b')](_0x543566)[_0xe092('0x1d')](_0x254e9e);}};}function respondWithFilteredResult(_0xa52746,_0x30e095){return function(_0x1ab45f){if(_0x1ab45f){var _0x1c4ac6=typeof _0x30e095[_0xe092('0x1e')]==='undefined'&&typeof _0x30e095[_0xe092('0x1f')]===_0xe092('0x20');var _0x3e3d59=_0x1ab45f[_0xe092('0x21')];var _0x49d3cc=_0x1c4ac6?0x0:_0x30e095['offset'];var _0x92b4d0=_0x1c4ac6?_0x1ab45f[_0xe092('0x21')]:_0x30e095[_0xe092('0x1e')]+_0x30e095[_0xe092('0x1f')];var _0x4eea69;if(_0x92b4d0>=_0x3e3d59){_0x92b4d0=_0x3e3d59;_0x4eea69=0xc8;}else{_0x4eea69=0xce;}_0xa52746[_0xe092('0x1b')](_0x4eea69);return _0xa52746[_0xe092('0x22')]('Content-Range',_0x49d3cc+'-'+_0x92b4d0+'/'+_0x3e3d59)[_0xe092('0x1d')](_0x1ab45f);}return null;};}function patchUpdates(_0x58e14a){return function(_0x475a46){try{jsonpatch[_0xe092('0x23')](_0x475a46,_0x58e14a,!![]);}catch(_0x2731d5){return BPromise['reject'](_0x2731d5);}return _0x475a46[_0xe092('0x24')]();};}function saveUpdates(_0x4693e7,_0x2e906d){return function(_0x209605){if(_0x209605){return _0x209605[_0xe092('0x25')](_0x4693e7)[_0xe092('0x26')](function(_0x278f29){return _0x278f29;});}return null;};}function removeEntity(_0xb7a32b,_0x4ceca7){return function(_0x34cda4){if(_0x34cda4){return _0x34cda4[_0xe092('0x27')]()[_0xe092('0x26')](function(){_0xb7a32b[_0xe092('0x1b')](0xcc)[_0xe092('0x1c')]();});}};}function handleEntityNotFound(_0x5d9c30,_0x3b4c4c){return function(_0x22a1ee){if(!_0x22a1ee){_0x5d9c30['sendStatus'](0x194);}return _0x22a1ee;};}function handleError(_0x1c93fb,_0x3e99d1){_0x3e99d1=_0x3e99d1||0x1f4;return function(_0x89d440){logger[_0xe092('0x28')](_0x89d440[_0xe092('0x29')]);if(_0x89d440[_0xe092('0x2a')]){delete _0x89d440[_0xe092('0x2a')];}_0x1c93fb[_0xe092('0x1b')](_0x3e99d1)[_0xe092('0x2b')](_0x89d440);};}exports['index']=function(_0x591d3a,_0x16389b){var _0x2158bd={},_0x36337f={},_0x4538e3={'count':0x0,'rows':[]};var _0x17a155=_['map'](db[_0xe092('0x2c')][_0xe092('0x2d')],function(_0xf67ddc){return{'name':_0xf67ddc[_0xe092('0x2e')],'type':_0xf67ddc['type'][_0xe092('0x2f')]};});_0x36337f[_0xe092('0x30')]=_[_0xe092('0x31')](_0x17a155,_0xe092('0x2a'));_0x36337f['query']=_[_0xe092('0x32')](_0x591d3a['query']);_0x36337f[_0xe092('0x33')]=_[_0xe092('0x34')](_0x36337f[_0xe092('0x30')],_0x36337f['query']);_0x2158bd['attributes']=_[_0xe092('0x34')](_0x36337f['model'],qs[_0xe092('0x35')](_0x591d3a['query'][_0xe092('0x35')]));_0x2158bd[_0xe092('0x36')]=_0x2158bd[_0xe092('0x36')][_0xe092('0x37')]?_0x2158bd['attributes']:_0x36337f[_0xe092('0x30')];if(!_0x591d3a[_0xe092('0x38')][_0xe092('0x39')](_0xe092('0x3a'))){_0x2158bd[_0xe092('0x1f')]=qs[_0xe092('0x1f')](_0x591d3a[_0xe092('0x38')][_0xe092('0x1f')]);_0x2158bd['offset']=qs[_0xe092('0x1e')](_0x591d3a[_0xe092('0x38')][_0xe092('0x1e')]);}_0x2158bd[_0xe092('0x3b')]=qs['sort'](_0x591d3a['query']['sort']);_0x2158bd[_0xe092('0x3c')]=qs[_0xe092('0x33')](_['pick'](_0x591d3a[_0xe092('0x38')],_0x36337f[_0xe092('0x33')]),_0x17a155);if(_0x591d3a[_0xe092('0x38')][_0xe092('0x3d')]){_0x2158bd[_0xe092('0x3c')]=_[_0xe092('0x3e')](_0x2158bd[_0xe092('0x3c')],{'$or':_[_0xe092('0x31')](_0x17a155,function(_0x3f2f73){if(_0x3f2f73[_0xe092('0x3f')]!=='VIRTUAL'){var _0x313299={};_0x313299[_0x3f2f73['name']]={'$like':'%'+_0x591d3a[_0xe092('0x38')][_0xe092('0x3d')]+'%'};return _0x313299;}})});}_0x2158bd=_[_0xe092('0x3e')]({},_0x2158bd,_0x591d3a[_0xe092('0x40')]);var _0x30e74e={'where':_0x2158bd[_0xe092('0x3c')]};return db[_0xe092('0x2c')][_0xe092('0x21')](_0x30e74e)[_0xe092('0x26')](function(_0x2b7b75){_0x4538e3['count']=_0x2b7b75;if(_0x591d3a[_0xe092('0x38')][_0xe092('0x41')]){_0x2158bd[_0xe092('0x42')]=[{'all':!![]}];}return db[_0xe092('0x2c')][_0xe092('0x43')](_0x2158bd);})[_0xe092('0x26')](function(_0x4e75f5){_0x4538e3[_0xe092('0x44')]=_0x4e75f5;return _0x4538e3;})[_0xe092('0x26')](respondWithFilteredResult(_0x16389b,_0x2158bd))['catch'](handleError(_0x16389b,null));};exports[_0xe092('0x45')]=function(_0x340aa3,_0x4b6e01){var _0x68ccd1={'raw':!![],'where':{'id':_0x340aa3[_0xe092('0x46')]['id']}},_0x3a5213={};_0x3a5213[_0xe092('0x30')]=_[_0xe092('0x32')](db[_0xe092('0x2c')][_0xe092('0x2d')]);_0x3a5213[_0xe092('0x38')]=_[_0xe092('0x32')](_0x340aa3[_0xe092('0x38')]);_0x3a5213[_0xe092('0x33')]=_['intersection'](_0x3a5213[_0xe092('0x30')],_0x3a5213[_0xe092('0x38')]);_0x68ccd1['attributes']=_[_0xe092('0x34')](_0x3a5213[_0xe092('0x30')],qs[_0xe092('0x35')](_0x340aa3['query']['fields']));_0x68ccd1[_0xe092('0x36')]=_0x68ccd1[_0xe092('0x36')][_0xe092('0x37')]?_0x68ccd1['attributes']:_0x3a5213[_0xe092('0x30')];if(_0x340aa3['query'][_0xe092('0x41')]){_0x68ccd1['include']=[{'all':!![]}];}_0x68ccd1=_['merge']({},_0x68ccd1,_0x340aa3[_0xe092('0x40')]);return db['Attachment'][_0xe092('0x47')](_0x68ccd1)[_0xe092('0x26')](handleEntityNotFound(_0x4b6e01,null))['then'](respondWithResult(_0x4b6e01,null))[_0xe092('0x48')](handleError(_0x4b6e01,null));};exports['clone']=function(_0x10370f,_0xcc6ac){var _0x166d77={'where':{'id':_0x10370f[_0xe092('0x46')]['id']}},_0x33b0f3={};_0x33b0f3[_0xe092('0x30')]=_[_0xe092('0x32')](db['Attachment']['rawAttributes']);_0x166d77[_0xe092('0x36')]=_['intersection'](_0x33b0f3[_0xe092('0x30')],qs[_0xe092('0x35')](_0x10370f[_0xe092('0x38')]['fields']));_0x166d77[_0xe092('0x36')]=_0x166d77['attributes']['length']?_0x166d77[_0xe092('0x36')]:_0x33b0f3[_0xe092('0x30')];if(_0x10370f['query'][_0xe092('0x41')]){_0x166d77[_0xe092('0x42')]=[{'all':!![]}];}_0x166d77=_[_0xe092('0x3e')]({},_0x166d77,_0x10370f['options']);return db[_0xe092('0x2c')]['find'](_0x166d77)[_0xe092('0x26')](handleEntityNotFound(_0xcc6ac,null))[_0xe092('0x26')](function(_0x51a921){if(_0x51a921){var _0x29bbe9=_0x51a921[_0xe092('0x49')]({'plain':!![]});_0x29bbe9=qs[_0xe092('0x4a')](_0x29bbe9,['id',_0xe092('0x4b'),_0xe092('0x4c')]);_0x10370f['body']=_[_0xe092('0x4a')](_0x10370f[_0xe092('0x4d')],['id',_0xe092('0x4b'),_0xe092('0x4c')]);return db['Attachment']['create'](_[_0xe092('0x3e')](_0x29bbe9,_0x10370f[_0xe092('0x4d')]),{'include':_0x10370f[_0xe092('0x38')][_0xe092('0x41')]?[{'all':!![]}]:undefined});}})[_0xe092('0x26')](respondWithResult(_0xcc6ac,0xc9))[_0xe092('0x48')](handleError(_0xcc6ac,null));};exports['update']=function(_0x50b4db,_0x5d90da){if(_0x50b4db['body']['id']){delete _0x50b4db['body']['id'];}return db[_0xe092('0x2c')][_0xe092('0x47')]({'where':{'id':_0x50b4db[_0xe092('0x46')]['id']}})[_0xe092('0x26')](handleEntityNotFound(_0x5d90da,null))[_0xe092('0x26')](saveUpdates(_0x50b4db[_0xe092('0x4d')],null))[_0xe092('0x26')](respondWithResult(_0x5d90da,null))[_0xe092('0x48')](handleError(_0x5d90da,null));};exports[_0xe092('0x27')]=function(_0x5bc4eb,_0x440df7){return db[_0xe092('0x2c')][_0xe092('0x47')]({'where':{'id':_0x5bc4eb[_0xe092('0x46')]['id']}})[_0xe092('0x26')](handleEntityNotFound(_0x440df7,null))[_0xe092('0x26')](removeEntity(_0x440df7,null))['catch'](handleError(_0x440df7,null));};exports['create']=function(_0x2b5fa2,_0x44d8ac,_0x100240){_0x2b5fa2['body'][_0xe092('0x2a')]=_0x2b5fa2[_0xe092('0x4e')][_0xe092('0x4f')];_0x2b5fa2[_0xe092('0x4d')][_0xe092('0x50')]=_0x2b5fa2[_0xe092('0x4e')][_0xe092('0x51')];_0x2b5fa2[_0xe092('0x4d')][_0xe092('0x3f')]=_0x2b5fa2['file'][_0xe092('0x52')];return db['Attachment']['create'](_0x2b5fa2[_0xe092('0x4d')])['then'](respondWithResult(_0x44d8ac,0xc9))['catch'](handleError(_0x44d8ac,null));};exports[_0xe092('0x53')]=function(_0x83660a,_0x50c0c4,_0x42e657){return db[_0xe092('0x2c')][_0xe092('0x54')]({'where':{'id':_0x83660a[_0xe092('0x46')]['id']},'raw':!![]})[_0xe092('0x26')](handleEntityNotFound(_0x50c0c4,null))[_0xe092('0x26')](function(_0x124a2a){if(_0x124a2a){var _0x50485e=_0x124a2a[_0xe092('0x55')]!==null;var _0x255ba7=path[_0xe092('0x56')](config[_0xe092('0x57')],_0xe092('0x58'));if(_0x50485e){_0x255ba7=path[_0xe092('0x56')](_0x255ba7,'offline-chat/');}var _0x4c74a4=path['join'](_0x255ba7,_0x124a2a['basename']);return _0x50c0c4['download'](_0x4c74a4);}})[_0xe092('0x48')](handleError(_0x50c0c4,null));}; \ No newline at end of file +var _0x064e=['attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','then','include','rows','show','params','keys','rawAttributes','intersection','includeAll','find','catch','clone','options','get','createdAt','updatedAt','body','create','update','basename','file','filename','mimetype','download','ChatOfflineMessageId','join','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','error','name','send','map','Attachment','fieldName','type','key','model','query','filters'];(function(_0x366e51,_0x3a0178){var _0x4e23e3=function(_0x7ecebe){while(--_0x7ecebe){_0x366e51['push'](_0x366e51['shift']());}};_0x4e23e3(++_0x3a0178);}(_0x064e,0x12d));var _0xe064=function(_0x2cd463,_0x1ce1e8){_0x2cd463=_0x2cd463-0x0;var _0x45e961=_0x064e[_0x2cd463];return _0x45e961;};'use strict';var emlformat=require(_0xe064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe064('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe064('0x2'));var moment=require(_0xe064('0x3'));var BPromise=require(_0xe064('0x4'));var Mustache=require(_0xe064('0x5'));var util=require('util');var path=require(_0xe064('0x6'));var sox=require(_0xe064('0x7'));var csv=require('to-csv');var ejs=require(_0xe064('0x8'));var fs=require('fs');var fs_extra=require(_0xe064('0x9'));var _=require(_0xe064('0xa'));var squel=require(_0xe064('0xb'));var crypto=require(_0xe064('0xc'));var jsforce=require(_0xe064('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe064('0xe'));var Papa=require(_0xe064('0xf'));var Redis=require(_0xe064('0x10'));var authService=require(_0xe064('0x11'));var qs=require(_0xe064('0x12'));var as=require(_0xe064('0x13'));var hardwareService=require(_0xe064('0x14'));var logger=require(_0xe064('0x15'))(_0xe064('0x16'));var utils=require(_0xe064('0x17'));var config=require(_0xe064('0x18'));var licenseUtil=require(_0xe064('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x328053,_0x2c60db){_0x2c60db=_0x2c60db||0xcc;return function(_0x16e7ba){if(_0x16e7ba){return _0x328053[_0xe064('0x1a')](_0x2c60db);}return _0x328053['status'](_0x2c60db)['end']();};}function respondWithResult(_0x2a3688,_0x1393f2){_0x1393f2=_0x1393f2||0xc8;return function(_0x46ed17){if(_0x46ed17){return _0x2a3688[_0xe064('0x1b')](_0x1393f2)[_0xe064('0x1c')](_0x46ed17);}};}function respondWithFilteredResult(_0x8d0c8f,_0x139926){return function(_0x5153ab){if(_0x5153ab){var _0x49ee4a=typeof _0x139926['offset']===_0xe064('0x1d')&&typeof _0x139926['limit']===_0xe064('0x1d');var _0x18e01a=_0x5153ab[_0xe064('0x1e')];var _0x19f2fe=_0x49ee4a?0x0:_0x139926[_0xe064('0x1f')];var _0x353ed9=_0x49ee4a?_0x5153ab[_0xe064('0x1e')]:_0x139926[_0xe064('0x1f')]+_0x139926[_0xe064('0x20')];var _0x58e51;if(_0x353ed9>=_0x18e01a){_0x353ed9=_0x18e01a;_0x58e51=0xc8;}else{_0x58e51=0xce;}_0x8d0c8f[_0xe064('0x1b')](_0x58e51);return _0x8d0c8f[_0xe064('0x21')](_0xe064('0x22'),_0x19f2fe+'-'+_0x353ed9+'/'+_0x18e01a)[_0xe064('0x1c')](_0x5153ab);}return null;};}function patchUpdates(_0x587c18){return function(_0x50b107){try{jsonpatch[_0xe064('0x23')](_0x50b107,_0x587c18,!![]);}catch(_0x586a30){return BPromise[_0xe064('0x24')](_0x586a30);}return _0x50b107[_0xe064('0x25')]();};}function saveUpdates(_0x49e44d,_0x4c490d){return function(_0x15337f){if(_0x15337f){return _0x15337f['update'](_0x49e44d)['then'](function(_0x288fbe){return _0x288fbe;});}return null;};}function removeEntity(_0x454355,_0x403aaf){return function(_0x295ac9){if(_0x295ac9){return _0x295ac9[_0xe064('0x26')]()['then'](function(){_0x454355['status'](0xcc)[_0xe064('0x27')]();});}};}function handleEntityNotFound(_0x1ac136,_0x2615a1){return function(_0x572c30){if(!_0x572c30){_0x1ac136[_0xe064('0x1a')](0x194);}return _0x572c30;};}function handleError(_0x56e90b,_0x2e350d){_0x2e350d=_0x2e350d||0x1f4;return function(_0x30f249){logger[_0xe064('0x28')](_0x30f249['stack']);if(_0x30f249[_0xe064('0x29')]){delete _0x30f249['name'];}_0x56e90b['status'](_0x2e350d)[_0xe064('0x2a')](_0x30f249);};}exports['index']=function(_0x52d356,_0xd1d99d){var _0x3c6556={},_0x2ec7a0={},_0x34c43a={'count':0x0,'rows':[]};var _0x3b1364=_[_0xe064('0x2b')](db[_0xe064('0x2c')]['rawAttributes'],function(_0x227a8c){return{'name':_0x227a8c[_0xe064('0x2d')],'type':_0x227a8c[_0xe064('0x2e')][_0xe064('0x2f')]};});_0x2ec7a0[_0xe064('0x30')]=_['map'](_0x3b1364,_0xe064('0x29'));_0x2ec7a0[_0xe064('0x31')]=_['keys'](_0x52d356[_0xe064('0x31')]);_0x2ec7a0[_0xe064('0x32')]=_['intersection'](_0x2ec7a0[_0xe064('0x30')],_0x2ec7a0[_0xe064('0x31')]);_0x3c6556[_0xe064('0x33')]=_['intersection'](_0x2ec7a0['model'],qs[_0xe064('0x34')](_0x52d356['query'][_0xe064('0x34')]));_0x3c6556[_0xe064('0x33')]=_0x3c6556[_0xe064('0x33')][_0xe064('0x35')]?_0x3c6556['attributes']:_0x2ec7a0[_0xe064('0x30')];if(!_0x52d356[_0xe064('0x31')][_0xe064('0x36')](_0xe064('0x37'))){_0x3c6556[_0xe064('0x20')]=qs[_0xe064('0x20')](_0x52d356[_0xe064('0x31')][_0xe064('0x20')]);_0x3c6556[_0xe064('0x1f')]=qs[_0xe064('0x1f')](_0x52d356['query'][_0xe064('0x1f')]);}_0x3c6556[_0xe064('0x38')]=qs['sort'](_0x52d356[_0xe064('0x31')]['sort']);_0x3c6556[_0xe064('0x39')]=qs[_0xe064('0x32')](_[_0xe064('0x3a')](_0x52d356['query'],_0x2ec7a0[_0xe064('0x32')]),_0x3b1364);if(_0x52d356[_0xe064('0x31')]['filter']){_0x3c6556[_0xe064('0x39')]=_[_0xe064('0x3b')](_0x3c6556[_0xe064('0x39')],{'$or':_[_0xe064('0x2b')](_0x3b1364,function(_0x12b776){if(_0x12b776[_0xe064('0x2e')]!==_0xe064('0x3c')){var _0x5cd968={};_0x5cd968[_0x12b776[_0xe064('0x29')]]={'$like':'%'+_0x52d356[_0xe064('0x31')][_0xe064('0x3d')]+'%'};return _0x5cd968;}})});}_0x3c6556=_['merge']({},_0x3c6556,_0x52d356['options']);var _0x4c88fb={'where':_0x3c6556[_0xe064('0x39')]};return db[_0xe064('0x2c')][_0xe064('0x1e')](_0x4c88fb)[_0xe064('0x3e')](function(_0x7d2ee1){_0x34c43a[_0xe064('0x1e')]=_0x7d2ee1;if(_0x52d356[_0xe064('0x31')]['includeAll']){_0x3c6556[_0xe064('0x3f')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x3c6556);})[_0xe064('0x3e')](function(_0x471646){_0x34c43a[_0xe064('0x40')]=_0x471646;return _0x34c43a;})[_0xe064('0x3e')](respondWithFilteredResult(_0xd1d99d,_0x3c6556))['catch'](handleError(_0xd1d99d,null));};exports[_0xe064('0x41')]=function(_0x1a83f3,_0x4d3a9e){var _0x161d6e={'raw':!![],'where':{'id':_0x1a83f3[_0xe064('0x42')]['id']}},_0x4d0282={};_0x4d0282['model']=_[_0xe064('0x43')](db['Attachment'][_0xe064('0x44')]);_0x4d0282['query']=_[_0xe064('0x43')](_0x1a83f3[_0xe064('0x31')]);_0x4d0282[_0xe064('0x32')]=_['intersection'](_0x4d0282[_0xe064('0x30')],_0x4d0282[_0xe064('0x31')]);_0x161d6e[_0xe064('0x33')]=_[_0xe064('0x45')](_0x4d0282[_0xe064('0x30')],qs[_0xe064('0x34')](_0x1a83f3[_0xe064('0x31')][_0xe064('0x34')]));_0x161d6e['attributes']=_0x161d6e['attributes'][_0xe064('0x35')]?_0x161d6e['attributes']:_0x4d0282[_0xe064('0x30')];if(_0x1a83f3['query'][_0xe064('0x46')]){_0x161d6e['include']=[{'all':!![]}];}_0x161d6e=_[_0xe064('0x3b')]({},_0x161d6e,_0x1a83f3['options']);return db[_0xe064('0x2c')][_0xe064('0x47')](_0x161d6e)['then'](handleEntityNotFound(_0x4d3a9e,null))[_0xe064('0x3e')](respondWithResult(_0x4d3a9e,null))[_0xe064('0x48')](handleError(_0x4d3a9e,null));};exports[_0xe064('0x49')]=function(_0x54808c,_0xfb6915){var _0x5ea9c1={'where':{'id':_0x54808c['params']['id']}},_0xe059e5={};_0xe059e5[_0xe064('0x30')]=_[_0xe064('0x43')](db[_0xe064('0x2c')][_0xe064('0x44')]);_0x5ea9c1[_0xe064('0x33')]=_['intersection'](_0xe059e5['model'],qs['fields'](_0x54808c[_0xe064('0x31')][_0xe064('0x34')]));_0x5ea9c1[_0xe064('0x33')]=_0x5ea9c1[_0xe064('0x33')]['length']?_0x5ea9c1['attributes']:_0xe059e5[_0xe064('0x30')];if(_0x54808c[_0xe064('0x31')][_0xe064('0x46')]){_0x5ea9c1[_0xe064('0x3f')]=[{'all':!![]}];}_0x5ea9c1=_[_0xe064('0x3b')]({},_0x5ea9c1,_0x54808c[_0xe064('0x4a')]);return db['Attachment'][_0xe064('0x47')](_0x5ea9c1)[_0xe064('0x3e')](handleEntityNotFound(_0xfb6915,null))[_0xe064('0x3e')](function(_0x5f415f){if(_0x5f415f){var _0x1fcfbc=_0x5f415f[_0xe064('0x4b')]({'plain':!![]});_0x1fcfbc=qs['omit'](_0x1fcfbc,['id',_0xe064('0x4c'),_0xe064('0x4d')]);_0x54808c[_0xe064('0x4e')]=_['omit'](_0x54808c['body'],['id',_0xe064('0x4c'),_0xe064('0x4d')]);return db[_0xe064('0x2c')][_0xe064('0x4f')](_[_0xe064('0x3b')](_0x1fcfbc,_0x54808c['body']),{'include':_0x54808c[_0xe064('0x31')][_0xe064('0x46')]?[{'all':!![]}]:undefined});}})[_0xe064('0x3e')](respondWithResult(_0xfb6915,0xc9))[_0xe064('0x48')](handleError(_0xfb6915,null));};exports[_0xe064('0x50')]=function(_0xd7ff66,_0x27a630){if(_0xd7ff66[_0xe064('0x4e')]['id']){delete _0xd7ff66['body']['id'];}return db[_0xe064('0x2c')][_0xe064('0x47')]({'where':{'id':_0xd7ff66[_0xe064('0x42')]['id']}})[_0xe064('0x3e')](handleEntityNotFound(_0x27a630,null))[_0xe064('0x3e')](saveUpdates(_0xd7ff66[_0xe064('0x4e')],null))[_0xe064('0x3e')](respondWithResult(_0x27a630,null))[_0xe064('0x48')](handleError(_0x27a630,null));};exports[_0xe064('0x26')]=function(_0x2c19fe,_0x16edbe){return db[_0xe064('0x2c')][_0xe064('0x47')]({'where':{'id':_0x2c19fe['params']['id']}})[_0xe064('0x3e')](handleEntityNotFound(_0x16edbe,null))[_0xe064('0x3e')](removeEntity(_0x16edbe,null))[_0xe064('0x48')](handleError(_0x16edbe,null));};exports[_0xe064('0x4f')]=function(_0x48741e,_0x45be39,_0x1abd38){_0x48741e[_0xe064('0x4e')]['name']=_0x48741e['file']['originalname'];_0x48741e['body'][_0xe064('0x51')]=_0x48741e[_0xe064('0x52')][_0xe064('0x53')];_0x48741e['body'][_0xe064('0x2e')]=_0x48741e[_0xe064('0x52')][_0xe064('0x54')];return db[_0xe064('0x2c')][_0xe064('0x4f')](_0x48741e[_0xe064('0x4e')])[_0xe064('0x3e')](respondWithResult(_0x45be39,0xc9))[_0xe064('0x48')](handleError(_0x45be39,null));};exports[_0xe064('0x55')]=function(_0x1e8b06,_0x4192de,_0x2f36ae){return db[_0xe064('0x2c')]['findOne']({'where':{'id':_0x1e8b06[_0xe064('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4192de,null))[_0xe064('0x3e')](function(_0x209d5b){if(_0x209d5b){var _0x110b57=_0x209d5b[_0xe064('0x56')]!==null;var _0x4939d7=path[_0xe064('0x57')](config['root'],'server/files/attachments/');if(_0x110b57){_0x4939d7=path['join'](_0x4939d7,'offline-chat/');}var _0x399e75=path['join'](_0x4939d7,_0x209d5b[_0xe064('0x51')]);return _0x4192de[_0xe064('0x55')](_0x399e75);}})['catch'](handleError(_0x4192de,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4f8cf34..8dccd30 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 _0x2baf=['exports','define','Attachment','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./attachment.attributes'];(function(_0x247c60,_0x23a7ec){var _0x42d4f5=function(_0x4a2833){while(--_0x4a2833){_0x247c60['push'](_0x247c60['shift']());}};_0x42d4f5(++_0x23a7ec);}(_0x2baf,0xab));var _0xf2ba=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x2baf[_0x3e0763];return _0x351ca2;};'use strict';var _=require(_0xf2ba('0x0'));var util=require(_0xf2ba('0x1'));var logger=require(_0xf2ba('0x2'))(_0xf2ba('0x3'));var moment=require('moment');var BPromise=require(_0xf2ba('0x4'));var rp=require(_0xf2ba('0x5'));var fs=require('fs');var path=require(_0xf2ba('0x6'));var rimraf=require(_0xf2ba('0x7'));var config=require('../../config/environment');var attributes=require(_0xf2ba('0x8'));module[_0xf2ba('0x9')]=function(_0x466ed9,_0x1e961e){return _0x466ed9[_0xf2ba('0xa')](_0xf2ba('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x533f=['Attachment','attachments','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x533f,0x98));var _0xf533=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x533f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf533('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf533('0x1'));var moment=require(_0xf533('0x2'));var BPromise=require('bluebird');var rp=require(_0xf533('0x3'));var fs=require('fs');var path=require(_0xf533('0x4'));var rimraf=require(_0xf533('0x5'));var config=require(_0xf533('0x6'));var attributes=require(_0xf533('0x7'));module['exports']=function(_0x12c5af,_0x53a117){return _0x12c5af['define'](_0xf533('0x8'),attributes,{'tableName':_0xf533('0x9'),'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 0d9e2ee..b97fc7c 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 _0xad8a=['message','result','catch','CreateAttachment','create','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa37ec9,_0x254622){var _0x35138c=function(_0x21e0e9){while(--_0x21e0e9){_0xa37ec9['push'](_0xa37ec9['shift']());}};_0x35138c(++_0x254622);}(_0xad8a,0xb0));var _0xaad8=function(_0x330ef0,_0x3c2b7a){_0x330ef0=_0x330ef0-0x0;var _0x54706a=_0xad8a[_0x330ef0];return _0x54706a;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var moment=require(_0xaad8('0x2'));var BPromise=require(_0xaad8('0x3'));var rs=require(_0xaad8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaad8('0x5'))['db'];var utils=require(_0xaad8('0x6'));var logger=require(_0xaad8('0x7'))('rpc');var config=require(_0xaad8('0x8'));var jayson=require(_0xaad8('0x9'));var client=jayson[_0xaad8('0xa')][_0xaad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x95aef9,_0x39c599,_0x28f3a1){return new BPromise(function(_0xf3a6c7,_0x11408a){return client[_0xaad8('0xc')](_0x95aef9,_0x28f3a1)['then'](function(_0x52477f){logger[_0xaad8('0xd')](_0xaad8('0xe'),_0x39c599,_0xaad8('0xf'));logger[_0xaad8('0x10')](_0xaad8('0x11'),_0x39c599,_0xaad8('0xf'),JSON[_0xaad8('0x12')](_0x52477f));if(_0x52477f[_0xaad8('0x13')]){if(_0x52477f[_0xaad8('0x13')]['code']===0x1f4){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0x11408a(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);return _0xf3a6c7(_0x52477f[_0xaad8('0x13')][_0xaad8('0x14')]);}else{logger[_0xaad8('0xd')]('Attachment,\x20%s,\x20%s',_0x39c599,_0xaad8('0xf'));_0xf3a6c7(_0x52477f[_0xaad8('0x15')]['message']);}})[_0xaad8('0x16')](function(_0x2a8e12){logger[_0xaad8('0x13')](_0xaad8('0xe'),_0x39c599,_0x2a8e12);_0x11408a(_0x2a8e12);});});}exports[_0xaad8('0x17')]=function(_0x3895e2){var _0x535b82=this;return new Promise(function(_0xfd8b0a,_0x26684c){return db['Attachment'][_0xaad8('0x18')](_0x3895e2['body'],{'raw':_0x3895e2[_0xaad8('0x19')]?_0x3895e2[_0xaad8('0x19')][_0xaad8('0x1a')]===undefined?!![]:![]:!![]})[_0xaad8('0x1b')](function(_0x5cb39b){logger[_0xaad8('0xd')](_0xaad8('0x17'),_0x3895e2);logger['debug'](_0xaad8('0x17'),_0x3895e2,JSON[_0xaad8('0x12')](_0x5cb39b));_0xfd8b0a(_0x5cb39b);})[_0xaad8('0x16')](function(_0x5b4b61){logger['error'](_0xaad8('0x17'),_0x5b4b61[_0xaad8('0x14')],_0x3895e2);_0x26684c(_0x535b82[_0xaad8('0x13')](0x1f4,_0x5b4b61[_0xaad8('0x14')]));});});}; \ No newline at end of file +var _0xc91b=['client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xc91b,0x16f));var _0xbc91=function(_0x4bfe69,_0x4b0066){_0x4bfe69=_0x4bfe69-0x0;var _0x4e4c3d=_0xc91b[_0x4bfe69];return _0x4e4c3d;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var moment=require(_0xbc91('0x2'));var BPromise=require(_0xbc91('0x3'));var rs=require(_0xbc91('0x4'));var fs=require('fs');var Redis=require(_0xbc91('0x5'));var db=require(_0xbc91('0x6'))['db'];var utils=require(_0xbc91('0x7'));var logger=require('../../config/logger')(_0xbc91('0x8'));var config=require(_0xbc91('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbc91('0xa')][_0xbc91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535cb9,_0xf88d45,_0x43731a){return new BPromise(function(_0x36e15f,_0x34f079){return client[_0xbc91('0xc')](_0x535cb9,_0x43731a)[_0xbc91('0xd')](function(_0xa20d9){logger['info'](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));logger[_0xbc91('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0xf88d45,'request\x20sent',JSON[_0xbc91('0x11')](_0xa20d9));if(_0xa20d9[_0xbc91('0x12')]){if(_0xa20d9['error']['code']===0x1f4){logger[_0xbc91('0x12')]('Attachment,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x34f079(_0xa20d9[_0xbc91('0x12')][_0xbc91('0x13')]);}logger[_0xbc91('0x12')]('Attachment,\x20%s,\x20%s',_0xf88d45,_0xa20d9['error'][_0xbc91('0x13')]);return _0x36e15f(_0xa20d9[_0xbc91('0x12')]['message']);}else{logger[_0xbc91('0x14')](_0xbc91('0xe'),_0xf88d45,_0xbc91('0xf'));_0x36e15f(_0xa20d9[_0xbc91('0x15')][_0xbc91('0x13')]);}})[_0xbc91('0x16')](function(_0xb92600){logger[_0xbc91('0x12')](_0xbc91('0xe'),_0xf88d45,_0xb92600);_0x34f079(_0xb92600);});});}exports['CreateAttachment']=function(_0x60911a){var _0x439145=this;return new Promise(function(_0x181d48,_0x31ce1f){return db[_0xbc91('0x17')][_0xbc91('0x18')](_0x60911a[_0xbc91('0x19')],{'raw':_0x60911a['options']?_0x60911a[_0xbc91('0x1a')][_0xbc91('0x1b')]===undefined?!![]:![]:!![]})[_0xbc91('0xd')](function(_0x558c32){logger['info'](_0xbc91('0x1c'),_0x60911a);logger[_0xbc91('0x10')](_0xbc91('0x1c'),_0x60911a,JSON[_0xbc91('0x11')](_0x558c32));_0x181d48(_0x558c32);})['catch'](function(_0x521196){logger[_0xbc91('0x12')](_0xbc91('0x1c'),_0x521196[_0xbc91('0x13')],_0x60911a);_0x31ce1f(_0x439145[_0xbc91('0x12')](0x1f4,_0x521196[_0xbc91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 1de7456..baeeccf 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x68e1a5,_0x3c9ccc){_0x68e1a5=_0x68e1a5-0x0;var _0x599477=_0xdb28[_0x68e1a5];return _0x599477;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x2e7dab,_0x4cfcec){var _0xdc2995=function(_0xd696b4){while(--_0xd696b4){_0x2e7dab['push'](_0x2e7dab['shift']());}};_0xdc2995(++_0x4cfcec);}(_0xadb5,0xad));var _0x5adb=function(_0x4a0d09,_0x592f69){_0x4a0d09=_0x4a0d09-0x0;var _0x1191c7=_0xadb5[_0x4a0d09];return _0x1191c7;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0597b1a..2842635 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 _0x8180=['bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','then','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','passport','Strategy','moment'];(function(_0x105677,_0x21d47f){var _0x977209=function(_0x20499b){while(--_0x20499b){_0x105677['push'](_0x105677['shift']());}};_0x977209(++_0x21d47f);}(_0x8180,0x90));var _0x0818=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8180[_0x1deb03];return _0x189fe7;};'use strict';var passport=require(_0x0818('0x0'));var LocalStrategy=require('passport-local')[_0x0818('0x1')];var moment=require(_0x0818('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x0818('0x3'));var util=require(_0x0818('0x4'));var db=require(_0x0818('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x0818('0x6'));var config=require(_0x0818('0x7'));var logger=require(_0x0818('0x8'))('api');function isActiveDirectoryConfigured(_0x2cf0bf){var _0x32a465=![];if(typeof _0x2cf0bf['activedirectory']!==_0x0818('0x9')){_0x32a465=_0x2cf0bf[_0x0818('0xa')][_0x0818('0xb')]&&_0x2cf0bf[_0x0818('0xa')][_0x0818('0xc')]&&_0x2cf0bf[_0x0818('0xa')][_0x0818('0xd')];}return _0x32a465;}function adAuthenticate(_0x56e251,_0x30848a,_0x5b68bb){return new BPromise(function(_0x302622,_0x4b7328){try{var _0x5611ef=new ActiveDirectory(_0x56e251);_0x5611ef[_0x0818('0xe')](_0x30848a,_0x5b68bb,function(_0x63027a,_0xe9e0f0){if(_0x63027a){logger[_0x0818('0xf')](_0x0818('0x10'),_0x30848a,util[_0x0818('0x11')](_0x63027a,{'showHidden':![],'depth':null}));_0x4b7328(_0x0818('0x12'));}else if(!_0xe9e0f0){logger[_0x0818('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x30848a);_0x4b7328(_0x0818('0x12'));}else{_0x302622(_0xe9e0f0);}});}catch(_0x1ea37b){_0x4b7328(_0x1ea37b);}});}function ActiveDirectoryAuthenticate(_0x1f9fde,_0x585067,_0x262a09,_0x23bcaf){var _0x4795dc,_0x16787b;if(!isActiveDirectoryConfigured(config)){logger[_0x0818('0xf')](_0x0818('0x13'),_0x585067);return _0x23bcaf(null,![],{'message':_0x0818('0x12')});}return db[_0x0818('0x14')][_0x0818('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x0818('0x16')],'raw':!![]})['then'](function(_0x48bf47){_0x4795dc=_0x48bf47;if(!_0x4795dc[_0x0818('0x17')]){logger['error'](_0x0818('0x18'),_0x585067);throw new Error(_0x0818('0x12'));}return _0x1f9fde[_0x0818('0x15')]({'logging':!![],'attributes':['id',_0x0818('0x19'),_0x0818('0x1a'),_0x0818('0x1b'),_0x0818('0x1c'),_0x0818('0x1d'),_0x0818('0x1e'),_0x0818('0x1f'),'online'],'where':{'name':_0x585067,'role':{'$or':[_0x0818('0x20'),_0x0818('0x21'),_0x0818('0x22')]},'adSsoEnabled':!![]}});})[_0x0818('0x23')](function(_0x513c15){if(!_0x513c15||_0x513c15&&_0x513c15[_0x0818('0x19')]!==_0x585067){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x16787b=_0x513c15;var _0x209139=_0x16787b[_0x0818('0x19')]+'@'+config[_0x0818('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x209139,_0x262a09);})['then'](function(_0x3ddbe6){if(_0x16787b[_0x0818('0x1d')]){throw new Error(_0x0818('0x12'));}if(_0x4795dc[_0x0818('0x16')]>0x0){if(_0x16787b['blocked']){if(moment(_0x16787b[_0x0818('0x1f')])['add'](_0x4795dc[_0x0818('0x16')],'minutes')>moment()){throw new Error(_0x0818('0x12'));}return utils[_0x0818('0x24')](_0x16787b,0x0,![],null)[_0x0818('0x23')](function(){return utils[_0x0818('0x25')](_0x16787b);})['then'](function(){return _0x23bcaf(null,_0x16787b);});}else{return utils['getLicense'](_0x16787b)['then'](function(){return _0x23bcaf(null,_0x16787b);});}}else{return utils[_0x0818('0x25')](_0x16787b)['then'](function(){return _0x23bcaf(null,_0x16787b);});}})['catch'](function(_0x534759){return _0x23bcaf(null,![],_0x534759);});}function handleError(_0x32a64c,_0x3574fe,_0x505d7c){return _0x32a64c[_0x0818('0x26')](_0x3574fe||0x1f4)[_0x0818('0x27')]({'message':_0x505d7c?_0x505d7c[_0x0818('0x28')]||_0x505d7c:''});}exports[_0x0818('0x29')]=function(_0x2f94f4,_0x1f564c,_0x1df8bf){passport[_0x0818('0xe')](_0x0818('0x2a'),function(_0x351e3a,_0x1e5dd,_0x2dabc8){var _0x4146d0=_0x351e3a||_0x2dabc8;if(_0x4146d0){return handleError(_0x1f564c,0x191,_0x4146d0);}if(!_0x1e5dd){return handleError(_0x1f564c,0x194,{'message':_0x0818('0x2b')});}else{var _0x239720={'payload':{'id':_0x1e5dd['id'],'role':_0x1e5dd['role']},'options':{'expiresIn':0x15180}};return authService[_0x0818('0x2c')](_0x239720)['then'](function(_0x313959){_0x1f564c[_0x0818('0x2d')]({'id':_0x1e5dd['id'],'token':_0x313959,'statusCall':'','isAlreadyLogged':_0x1e5dd[_0x0818('0x2e')]});});}})(_0x2f94f4,_0x1f564c,_0x1df8bf);};passport[_0x0818('0x2f')](_0x0818('0x2a'),new LocalStrategy({'usernameField':_0x0818('0x19'),'passwordField':_0x0818('0x1a')},function(_0x90beae,_0x581904,_0x4b69c9){return ActiveDirectoryAuthenticate(db[_0x0818('0x30')],_0x90beae,_0x581904,_0x4b69c9);})); \ No newline at end of file +var _0x684b=['ad-login','signToken','use','passport','passport-local','Strategy','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blockedAt','online','admin','user','agent','then','activedirectory','blocked','add','clearBlockUser','getLicense','send','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x684b,0x18f));var _0xb684=function(_0x3d8cfb,_0x4c51d6){_0x3d8cfb=_0x3d8cfb-0x0;var _0x10e248=_0x684b[_0x3d8cfb];return _0x10e248;};'use strict';var passport=require(_0xb684('0x0'));var LocalStrategy=require(_0xb684('0x1'))[_0xb684('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xb684('0x3'));var util=require(_0xb684('0x4'));var db=require(_0xb684('0x5'))['db'];var authService=require(_0xb684('0x6'));var utils=require(_0xb684('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xb684('0x8'));function isActiveDirectoryConfigured(_0x296ee9){var _0x19ffca=![];if(typeof _0x296ee9['activedirectory']!=='undefined'){_0x19ffca=_0x296ee9['activedirectory'][_0xb684('0x9')]&&_0x296ee9['activedirectory'][_0xb684('0xa')]&&_0x296ee9['activedirectory'][_0xb684('0xb')];}return _0x19ffca;}function adAuthenticate(_0x4aed30,_0x4183b1,_0x3b382){return new BPromise(function(_0xa5a7bb,_0x39495f){try{var _0x3b0698=new ActiveDirectory(_0x4aed30);_0x3b0698[_0xb684('0xc')](_0x4183b1,_0x3b382,function(_0x4cc63e,_0x5196dc){if(_0x4cc63e){logger[_0xb684('0xd')](_0xb684('0xe'),_0x4183b1,util['inspect'](_0x4cc63e,{'showHidden':![],'depth':null}));_0x39495f(_0xb684('0xf'));}else if(!_0x5196dc){logger[_0xb684('0xd')](_0xb684('0x10'),_0x4183b1);_0x39495f(_0xb684('0xf'));}else{_0xa5a7bb(_0x5196dc);}});}catch(_0x4312d0){_0x39495f(_0x4312d0);}});}function ActiveDirectoryAuthenticate(_0x15c1c4,_0x5590ce,_0x10e049,_0x425db4){var _0x3d2415,_0x51c8a0;if(!isActiveDirectoryConfigured(config)){logger[_0xb684('0xd')](_0xb684('0x11'),_0x5590ce);return _0x425db4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xb684('0x12')][_0xb684('0x13')]({'where':{'id':0x1},'attributes':[_0xb684('0x14'),_0xb684('0x15')],'raw':!![]})['then'](function(_0x374036){_0x3d2415=_0x374036;if(!_0x3d2415[_0xb684('0x14')]){logger['error'](_0xb684('0x16'),_0x5590ce);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x15c1c4['findOne']({'logging':!![],'attributes':['id',_0xb684('0x17'),_0xb684('0x18'),_0xb684('0x19'),_0xb684('0x1a'),_0xb684('0x1b'),'blocked',_0xb684('0x1c'),_0xb684('0x1d')],'where':{'name':_0x5590ce,'role':{'$or':[_0xb684('0x1e'),_0xb684('0x1f'),_0xb684('0x20')]},'adSsoEnabled':!![]}});})[_0xb684('0x21')](function(_0xcc575){if(!_0xcc575||_0xcc575&&_0xcc575[_0xb684('0x17')]!==_0x5590ce){throw new Error(_0xb684('0xf'));}_0x51c8a0=_0xcc575;var _0x4cbb6c=_0x51c8a0[_0xb684('0x17')]+'@'+config['activedirectory'][_0xb684('0xb')];return adAuthenticate(config[_0xb684('0x22')],_0x4cbb6c,_0x10e049);})[_0xb684('0x21')](function(_0x103a88){if(_0x51c8a0[_0xb684('0x1b')]){throw new Error(_0xb684('0xf'));}if(_0x3d2415['blockDuration']>0x0){if(_0x51c8a0[_0xb684('0x23')]){if(moment(_0x51c8a0['blockedAt'])[_0xb684('0x24')](_0x3d2415[_0xb684('0x15')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xb684('0x25')](_0x51c8a0,0x0,![],null)[_0xb684('0x21')](function(){return utils[_0xb684('0x26')](_0x51c8a0);})[_0xb684('0x21')](function(){return _0x425db4(null,_0x51c8a0);});}else{return utils['getLicense'](_0x51c8a0)[_0xb684('0x21')](function(){return _0x425db4(null,_0x51c8a0);});}}else{return utils[_0xb684('0x26')](_0x51c8a0)[_0xb684('0x21')](function(){return _0x425db4(null,_0x51c8a0);});}})['catch'](function(_0x33b14f){return _0x425db4(null,![],_0x33b14f);});}function handleError(_0x45884c,_0x54404d,_0xcf99e6){return _0x45884c['status'](_0x54404d||0x1f4)[_0xb684('0x27')]({'message':_0xcf99e6?_0xcf99e6[_0xb684('0x28')]||_0xcf99e6:''});}exports['login']=function(_0x170cc1,_0x2b2483,_0x1c9d39){passport[_0xb684('0xc')](_0xb684('0x29'),function(_0x143a81,_0x471de2,_0x3ca74b){var _0x34c8e8=_0x143a81||_0x3ca74b;if(_0x34c8e8){return handleError(_0x2b2483,0x191,_0x34c8e8);}if(!_0x471de2){return handleError(_0x2b2483,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x17a5ad={'payload':{'id':_0x471de2['id'],'role':_0x471de2[_0xb684('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xb684('0x2a')](_0x17a5ad)['then'](function(_0x574f09){_0x2b2483['json']({'id':_0x471de2['id'],'token':_0x574f09,'statusCall':'','isAlreadyLogged':_0x471de2[_0xb684('0x1d')]});});}})(_0x170cc1,_0x2b2483,_0x1c9d39);};passport[_0xb684('0x2b')](_0xb684('0x29'),new LocalStrategy({'usernameField':_0xb684('0x17'),'passwordField':_0xb684('0x18')},function(_0x743707,_0x2ea63c,_0x419c49){return ActiveDirectoryAuthenticate(db['User'],_0x743707,_0x2ea63c,_0x419c49);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 5d9804b..51b5834 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 _0x42f2=['exports','express','Router','login'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x42f2,0xc5));var _0x242f=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x42f2[_0x57014b];return _0x2b258a;};'use strict';var express=require(_0x242f('0x0'));var router=express[_0x242f('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x242f('0x2')]);module[_0x242f('0x3')]=router; \ No newline at end of file +var _0x9320=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0x9320,0x1d4));var _0x0932=function(_0x1b10c1,_0x35f323){_0x1b10c1=_0x1b10c1-0x0;var _0xc584e1=_0x9320[_0x1b10c1];return _0xc584e1;};'use strict';var express=require(_0x0932('0x0'));var router=express[_0x0932('0x1')]();var controller=require(_0x0932('0x2'));router[_0x0932('0x3')]('/',controller[_0x0932('0x4')]);module[_0x0932('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5e6ccb3..1eec010 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(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x7a54,0x106));var _0x47a5=function(_0x24ec16,_0x3b04d6){_0x24ec16=_0x24ec16-0x0;var _0x1f679f=_0x7a54[_0x24ec16];return _0x1f679f;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0x24d65e,_0x23d4b7){_0x24d65e=_0x24d65e-0x0;var _0x2a1aa0=_0x7a54[_0x24d65e];return _0x2a1aa0;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index cc67adb..80ea9c6 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 _0x37f0=['setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware'];(function(_0x30c15a,_0x24a3b3){var _0x377930=function(_0x618ee){while(--_0x618ee){_0x30c15a['push'](_0x30c15a['shift']());}};_0x377930(++_0x24a3b3);}(_0x37f0,0xfe));var _0x037f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x37f0[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x037f('0x0'));var passport=require(_0x037f('0x1'));var router=express[_0x037f('0x2')]();var controller=require(_0x037f('0x3'));var userController=require(_0x037f('0x4'));var authService=require(_0x037f('0x5'));router[_0x037f('0x6')]('/',controller[_0x037f('0x7')]);router[_0x037f('0x6')](_0x037f('0x8'),controller['callback'],authService[_0x037f('0x9')],userController[_0x037f('0x7')],authService[_0x037f('0xa')]);module[_0x037f('0xb')]=router; \ No newline at end of file +var _0x8524=['get','login','callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x39941c,_0x4ad1bb){var _0x52d9c7=function(_0x4e107e){while(--_0x4e107e){_0x39941c['push'](_0x39941c['shift']());}};_0x52d9c7(++_0x4ad1bb);}(_0x8524,0xb9));var _0x4852=function(_0x352072,_0x511db5){_0x352072=_0x352072-0x0;var _0x299d0d=_0x8524[_0x352072];return _0x299d0d;};'use strict';var express=require(_0x4852('0x0'));var passport=require(_0x4852('0x1'));var router=express[_0x4852('0x2')]();var controller=require(_0x4852('0x3'));var userController=require(_0x4852('0x4'));var authService=require('../../components/auth/service');router[_0x4852('0x5')]('/',controller[_0x4852('0x6')]);router[_0x4852('0x5')]('/callback',controller[_0x4852('0x7')],authService[_0x4852('0x8')],userController[_0x4852('0x6')],authService['setTokenCookie']);module[_0x4852('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index be7dd61..ca6180f 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 _0x573a=['\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','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','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','securePassword','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','name','salt','role','disabled','blocked','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','Smtp','port','secure','authentication','auth','pass','merge','format'];(function(_0x373fea,_0x589506){var _0x41e3c9=function(_0xd0b34c){while(--_0xd0b34c){_0x373fea['push'](_0x373fea['shift']());}};_0x41e3c9(++_0x589506);}(_0x573a,0x198));var _0xa573=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x573a[_0x37a79c];return _0x561d89;};'use strict';var util=require(_0xa573('0x0'));var passport=require('passport');var LocalStrategy=require(_0xa573('0x1'))[_0xa573('0x2')];var jayson=require(_0xa573('0x3'));var _=require(_0xa573('0x4'));var rs=require('randomstring');var moment=require(_0xa573('0x5'));var db=require(_0xa573('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xa573('0x7'));var client=jayson[_0xa573('0x8')][_0xa573('0x9')]({'port':0x232b});function localAuthenticate(_0x21f789,_0x463857,_0x4797a2,_0x10abc9){var _0x158d71,_0x548bb6;return db[_0xa573('0xa')][_0xa573('0xb')]({'where':{'id':0x1},'attributes':[_0xa573('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x4bfacf){_0x158d71=_0x4bfacf;return _0x21f789['findOne']({'attributes':['id',_0xa573('0xd'),'password',_0xa573('0xe'),_0xa573('0xf'),_0xa573('0x10'),_0xa573('0x11'),'blockedAt','loginAttempts'],'where':{'name':_0x463857,'role':{'$or':[_0xa573('0x12'),_0xa573('0x13'),_0xa573('0x14')]}}});})[_0xa573('0x15')](function(_0x203bb8){if(!_0x203bb8||_0x203bb8&&_0x203bb8[_0xa573('0xd')]!==_0x463857){throw new Error(_0xa573('0x16'));}else{_0x548bb6=_0x203bb8;return _0x548bb6;}})[_0xa573('0x15')](function(){_0x548bb6[_0xa573('0x17')](_0x4797a2,function(_0x24e3ce,_0x217abd){var _0xb0bbe7=_0x548bb6[_0xa573('0x18')]+0x1;if(_0x24e3ce){return _0x10abc9(_0x24e3ce);}else if(!_0x217abd){if(_0x548bb6['disabled']){return _0x10abc9(null,![],{'message':_0xa573('0x16')});}else if(_0x158d71[_0xa573('0xc')]>0x0){if(_0x548bb6[_0xa573('0x11')]){if(_0x158d71[_0xa573('0x19')]>0x0){if(moment(_0x548bb6[_0xa573('0x1a')])[_0xa573('0x1b')](_0x158d71['blockDuration'],_0xa573('0x1c'))>moment()){return _0x10abc9(null,![],{'message':_0xa573('0x16')});}else{return utils[_0xa573('0x1d')](_0x548bb6,_0xb0bbe7,![],null)[_0xa573('0x15')](function(){return _0x10abc9(null,![],{'message':_0xa573('0x16')});});}}else{return _0x10abc9(null,![],{'message':_0xa573('0x16')});}}else{if(_0xb0bbe7>=_0x158d71['allowedLoginAttempts']){return utils[_0xa573('0x1d')](_0x548bb6,0x0,!![],moment())[_0xa573('0x15')](function(){return _0x10abc9(null,![],{'message':_0xa573('0x16')});});}else{return utils['clearBlockUser'](_0x548bb6,_0xb0bbe7,![],null)[_0xa573('0x15')](function(){return _0x10abc9(null,![],{'message':_0xa573('0x16')});});}}}else{return _0x10abc9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x548bb6[_0xa573('0x10')]){return _0x10abc9(null,![],{'message':_0xa573('0x16')});}else if(_0x158d71[_0xa573('0xc')]>0x0){if(_0x548bb6['blocked']){if(_0x158d71[_0xa573('0x19')]>0x0){if(moment(_0x548bb6[_0xa573('0x1a')])[_0xa573('0x1b')](_0x158d71[_0xa573('0x19')],_0xa573('0x1c'))>moment()){return _0x10abc9(null,![],{'message':_0xa573('0x16')});}else{return utils['clearBlockUser'](_0x548bb6,0x0,![],null)[_0xa573('0x15')](function(){return utils['getLicense'](_0x548bb6);})[_0xa573('0x15')](function(){return _0x10abc9(null,_0x548bb6);});}}else{return _0x10abc9(null,![],{'message':_0xa573('0x16')});}}else{return utils[_0xa573('0x1d')](_0x548bb6,0x0,![],null)[_0xa573('0x15')](function(){return utils[_0xa573('0x1e')](_0x548bb6);})[_0xa573('0x15')](function(){return _0x10abc9(null,_0x548bb6);})[_0xa573('0x1f')](function(_0x2e600a){return _0x10abc9(null,![],_0x2e600a);});}}else{if(_0x548bb6['blocked']){return _0x10abc9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x548bb6)[_0xa573('0x15')](function(){return _0x10abc9(null,_0x548bb6);});}}}});})[_0xa573('0x1f')](function(_0x15857e){return _0x10abc9(null,![],_0x15857e);});}function sendServiceMail(_0x33f31d){return db[_0xa573('0x20')][_0xa573('0x21')]({'where':{'service':!![]},'attributes':['id',_0xa573('0xd'),_0xa573('0x22')],'include':[{'model':db[_0xa573('0x23')],'as':'Smtp'}]})[_0xa573('0x15')](function(_0x3b11f4){if(!_0x3b11f4){throw new Error(_0xa573('0x24'));}var _0x5adaee={'tls':{'rejectUnauthorized':![]}};if(_0x3b11f4['Smtp'][_0xa573('0x25')]){_0x5adaee[_0xa573('0x25')]=_0x3b11f4['Smtp'][_0xa573('0x25')];}else{_0x5adaee[_0xa573('0x26')]=_0x3b11f4[_0xa573('0x27')][_0xa573('0x26')];_0x5adaee[_0xa573('0x28')]=_0x3b11f4['Smtp'][_0xa573('0x28')];_0x5adaee['secure']=_0x3b11f4[_0xa573('0x27')][_0xa573('0x29')];}if(_0x3b11f4[_0xa573('0x27')][_0xa573('0x2a')]){_0x5adaee[_0xa573('0x2b')]={'user':_0x3b11f4[_0xa573('0x27')][_0xa573('0x13')],'pass':_0x3b11f4['Smtp'][_0xa573('0x2c')]};}var _0x2124a9={'account':_0x5adaee,'message':_[_0xa573('0x2d')]({'from':util[_0xa573('0x2e')](_0xa573('0x2f'),_0x3b11f4['name'],_0x3b11f4[_0xa573('0x22')]||_0x3b11f4[_0xa573('0x27')][_0xa573('0x13')])},_0x33f31d)};return client[_0xa573('0x30')](_0xa573('0x31'),_0x2124a9);})[_0xa573('0x15')](function(_0xa2f5ba){if(_0xa2f5ba[_0xa573('0x32')]){throw new Error(util['format'](_0xa573('0x33'),_0xa2f5ba[_0xa573('0x32')]['message']||JSON[_0xa573('0x34')](_0xa2f5ba['error'])));}return!![];});}function handleError(_0x5467c5,_0x45643b,_0x4265dd){return _0x5467c5[_0xa573('0x35')](_0x45643b||0x1f4)['send']({'message':_0x4265dd?_0x4265dd['message']||_0x4265dd:''});}exports[_0xa573('0x36')]=function(_0x145f23,_0xc595ca,_0x12f16e){passport[_0xa573('0x17')](_0xa573('0x37'),function(_0x15328d,_0x35b8cf,_0x1fc5a0){var _0x37617a=_0x15328d||_0x1fc5a0;if(_0x37617a){return handleError(_0xc595ca,0x191,_0x37617a);}if(!_0x35b8cf){return handleError(_0xc595ca,0x194,{'message':_0xa573('0x38')});}else{var _0x4c1f92={'payload':{'id':_0x35b8cf['id'],'role':_0x35b8cf[_0xa573('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0xa573('0x39')](_0x4c1f92)['then'](function(_0x48920b){_0xc595ca[_0xa573('0x3a')]({'id':_0x35b8cf['id'],'token':_0x48920b,'statusCall':'','isAlreadyLogged':_0x35b8cf[_0xa573('0x3b')]});});}})(_0x145f23,_0xc595ca,_0x12f16e);};exports[_0xa573('0x3c')]=function(_0x3c12ec,_0x50af03,_0x68b5ec){if(!_0x3c12ec[_0xa573('0x3d')]['email']){return handleError(_0x50af03,0x1f4,{'message':_0xa573('0x3e')});}var _0x423cfa=rs['generate']();_0x3c12ec[_0xa573('0x3d')][_0xa573('0x22')]=_0x3c12ec[_0xa573('0x3d')][_0xa573('0x22')][_0xa573('0x3f')]()[_0xa573('0x40')]();var _0x5ad111;return db[_0xa573('0xa')][_0xa573('0xb')]({'where':{'id':0x1},'attributes':[_0xa573('0xc'),_0xa573('0x19')],'raw':!![]})[_0xa573('0x15')](function(_0x581719){_0x5ad111=_0x581719;return db[_0xa573('0x41')][_0xa573('0x21')]({'where':{'email':_0x3c12ec[_0xa573('0x3d')][_0xa573('0x22')]}});})[_0xa573('0x15')](function(_0x386661){if(!_0x386661){throw new Error(_0xa573('0x42'));}if(_0x386661[_0xa573('0x10')]){throw new Error(_0xa573('0x43'));}if(_0x386661[_0xa573('0x11')]){if(moment(_0x386661[_0xa573('0x1a')])['add'](_0x5ad111[_0xa573('0x19')],'minutes')>moment()){throw new Error(_0xa573('0x44'));}else{_0x386661[_0xa573('0x11')]=![];_0x386661['blockedAt']=null;}}_0x386661[_0xa573('0x45')]=_0x423cfa;_0x386661['resetPasswordExpires']=Date[_0xa573('0x46')]()+0x36ee80;return _0x386661[_0xa573('0x47')]();})['then'](function(){return sendServiceMail({'to':_0x3c12ec[_0xa573('0x3d')]['email'],'subject':_0xa573('0x48'),'text':_0xa573('0x49')+_0xa573('0x4a')+_0xa573('0x4b')+_0x3c12ec[_0xa573('0x4c')][_0xa573('0x26')]+'/reset/'+_0x423cfa+'\x0a\x0a'+_0xa573('0x4d')});})[_0xa573('0x15')](function(){_0x50af03['status'](0xc8)[_0xa573('0x4e')]({'message':_0xa573('0x4f')});})[_0xa573('0x1f')](function(_0x5ee1c1){return handleError(_0x50af03,0x1f4,_0x5ee1c1);});};exports[_0xa573('0x50')]=function(_0x27499c,_0x38773a,_0x33f7a4){return db['User'][_0xa573('0x21')]({'where':{'resetPasswordToken':_0x27499c[_0xa573('0x51')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xa573('0x15')](function(_0x402a2b){if(!_0x402a2b){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xa573('0xb')]({'attributes':['id',_0xa573('0x52'),_0xa573('0x53'),'passwordHistoryLimit']})[_0xa573('0x15')](function(_0x51caf3){if(_0x51caf3[_0xa573('0x52')])authService[_0xa573('0x54')](_0x27499c[_0xa573('0x3d')][_0xa573('0x55')]);if(!_0x51caf3[_0xa573('0x53')]||!_0x402a2b[_0xa573('0x56')])return _0x402a2b;authService[_0xa573('0x57')](_0x27499c[_0xa573('0x3d')][_0xa573('0x55')],_0x402a2b[_0xa573('0x56')],_0x51caf3['passwordHistoryLimit']);return _0x402a2b;})[_0xa573('0x15')](function(){_0x402a2b[_0xa573('0x55')]=_0x27499c[_0xa573('0x3d')]['password'];_0x402a2b[_0xa573('0x45')]=null;_0x402a2b[_0xa573('0x58')]=null;return _0x402a2b[_0xa573('0x47')]();});})[_0xa573('0x15')](function(){_0x38773a[_0xa573('0x35')](0xc8)[_0xa573('0x4e')]({'message':_0xa573('0x59')});})[_0xa573('0x1f')](function(_0x4d63f2){return handleError(_0x38773a,0x1f4,_0x4d63f2);});};passport[_0xa573('0x5a')](_0xa573('0x37'),new LocalStrategy({'usernameField':_0xa573('0xd'),'passwordField':_0xa573('0x55')},function(_0x2a0c0b,_0x4fc919,_0x303ca1){return localAuthenticate(db[_0xa573('0x41')],_0x2a0c0b,_0x4fc919,_0x303ca1);})); \ No newline at end of file +var _0x9e53=['passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','http','Setting','findOne','blockDuration','then','name','password','role','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blocked','add','minutes','clearBlockUser','disabled','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','use','passport'];(function(_0x555164,_0x13e97c){var _0x541861=function(_0x55d3c3){while(--_0x55d3c3){_0x555164['push'](_0x555164['shift']());}};_0x541861(++_0x13e97c);}(_0x9e53,0xfe));var _0x39e5=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0x9e53[_0x5fe7ce];return _0x3b5793;};'use strict';var util=require('util');var passport=require(_0x39e5('0x0'));var LocalStrategy=require(_0x39e5('0x1'))[_0x39e5('0x2')];var jayson=require(_0x39e5('0x3'));var _=require(_0x39e5('0x4'));var rs=require('randomstring');var moment=require(_0x39e5('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x39e5('0x6'));var utils=require(_0x39e5('0x7'));var client=jayson['client'][_0x39e5('0x8')]({'port':0x232b});function localAuthenticate(_0x444564,_0x36bd3a,_0x42a237,_0x1a9355){var _0xe50eb4,_0x4f3261;return db[_0x39e5('0x9')][_0x39e5('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x39e5('0xb')],'raw':!![]})[_0x39e5('0xc')](function(_0x19afa4){_0xe50eb4=_0x19afa4;return _0x444564[_0x39e5('0xa')]({'attributes':['id',_0x39e5('0xd'),_0x39e5('0xe'),'salt',_0x39e5('0xf'),'disabled','blocked',_0x39e5('0x10'),_0x39e5('0x11')],'where':{'name':_0x36bd3a,'role':{'$or':[_0x39e5('0x12'),_0x39e5('0x13'),_0x39e5('0x14')]}}});})[_0x39e5('0xc')](function(_0x41af83){if(!_0x41af83||_0x41af83&&_0x41af83['name']!==_0x36bd3a){throw new Error(_0x39e5('0x15'));}else{_0x4f3261=_0x41af83;return _0x4f3261;}})[_0x39e5('0xc')](function(){_0x4f3261[_0x39e5('0x16')](_0x42a237,function(_0xf07f52,_0x4c118a){var _0x507233=_0x4f3261[_0x39e5('0x11')]+0x1;if(_0xf07f52){return _0x1a9355(_0xf07f52);}else if(!_0x4c118a){if(_0x4f3261['disabled']){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else if(_0xe50eb4[_0x39e5('0x17')]>0x0){if(_0x4f3261[_0x39e5('0x18')]){if(_0xe50eb4['blockDuration']>0x0){if(moment(_0x4f3261[_0x39e5('0x10')])[_0x39e5('0x19')](_0xe50eb4['blockDuration'],_0x39e5('0x1a'))>moment()){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else{return utils[_0x39e5('0x1b')](_0x4f3261,_0x507233,![],null)[_0x39e5('0xc')](function(){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});});}}else{return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}}else{if(_0x507233>=_0xe50eb4[_0x39e5('0x17')]){return utils[_0x39e5('0x1b')](_0x4f3261,0x0,!![],moment())[_0x39e5('0xc')](function(){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});});}else{return utils['clearBlockUser'](_0x4f3261,_0x507233,![],null)[_0x39e5('0xc')](function(){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});});}}}else{return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}}else{if(_0x4f3261[_0x39e5('0x1c')]){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else if(_0xe50eb4[_0x39e5('0x17')]>0x0){if(_0x4f3261[_0x39e5('0x18')]){if(_0xe50eb4['blockDuration']>0x0){if(moment(_0x4f3261[_0x39e5('0x10')])[_0x39e5('0x19')](_0xe50eb4[_0x39e5('0xb')],_0x39e5('0x1a'))>moment()){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else{return utils[_0x39e5('0x1b')](_0x4f3261,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4f3261);})[_0x39e5('0xc')](function(){return _0x1a9355(null,_0x4f3261);});}}else{return _0x1a9355(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x39e5('0x1b')](_0x4f3261,0x0,![],null)[_0x39e5('0xc')](function(){return utils[_0x39e5('0x1d')](_0x4f3261);})[_0x39e5('0xc')](function(){return _0x1a9355(null,_0x4f3261);})[_0x39e5('0x1e')](function(_0x1bcfd2){return _0x1a9355(null,![],_0x1bcfd2);});}}else{if(_0x4f3261[_0x39e5('0x18')]){return _0x1a9355(null,![],{'message':_0x39e5('0x15')});}else{return utils[_0x39e5('0x1d')](_0x4f3261)[_0x39e5('0xc')](function(){return _0x1a9355(null,_0x4f3261);});}}}});})[_0x39e5('0x1e')](function(_0x1f605d){return _0x1a9355(null,![],_0x1f605d);});}function sendServiceMail(_0x369a6a){return db[_0x39e5('0x1f')][_0x39e5('0x20')]({'where':{'service':!![]},'attributes':['id',_0x39e5('0xd'),'email'],'include':[{'model':db[_0x39e5('0x21')],'as':_0x39e5('0x22')}]})['then'](function(_0x2f1614){if(!_0x2f1614){throw new Error(_0x39e5('0x23'));}var _0x2b28fe={'tls':{'rejectUnauthorized':![]}};if(_0x2f1614[_0x39e5('0x22')][_0x39e5('0x24')]){_0x2b28fe[_0x39e5('0x24')]=_0x2f1614[_0x39e5('0x22')]['service'];}else{_0x2b28fe[_0x39e5('0x25')]=_0x2f1614[_0x39e5('0x22')]['host'];_0x2b28fe[_0x39e5('0x26')]=_0x2f1614[_0x39e5('0x22')]['port'];_0x2b28fe[_0x39e5('0x27')]=_0x2f1614[_0x39e5('0x22')][_0x39e5('0x27')];}if(_0x2f1614[_0x39e5('0x22')][_0x39e5('0x28')]){_0x2b28fe[_0x39e5('0x29')]={'user':_0x2f1614[_0x39e5('0x22')][_0x39e5('0x13')],'pass':_0x2f1614[_0x39e5('0x22')]['pass']};}var _0x12323e={'account':_0x2b28fe,'message':_['merge']({'from':util[_0x39e5('0x2a')](_0x39e5('0x2b'),_0x2f1614[_0x39e5('0xd')],_0x2f1614[_0x39e5('0x2c')]||_0x2f1614[_0x39e5('0x22')][_0x39e5('0x13')])},_0x369a6a)};return client[_0x39e5('0x2d')](_0x39e5('0x2e'),_0x12323e);})[_0x39e5('0xc')](function(_0x3649a9){if(_0x3649a9['error']){throw new Error(util[_0x39e5('0x2a')](_0x39e5('0x2f'),_0x3649a9[_0x39e5('0x30')][_0x39e5('0x31')]||JSON[_0x39e5('0x32')](_0x3649a9[_0x39e5('0x30')])));}return!![];});}function handleError(_0x4ee310,_0x3394ee,_0x252dbc){return _0x4ee310[_0x39e5('0x33')](_0x3394ee||0x1f4)[_0x39e5('0x34')]({'message':_0x252dbc?_0x252dbc['message']||_0x252dbc:''});}exports['login']=function(_0xe930fc,_0x2333a9,_0x35bf18){passport[_0x39e5('0x16')](_0x39e5('0x35'),function(_0x17b6c9,_0x3c2be7,_0x10824d){var _0x23f9c4=_0x17b6c9||_0x10824d;if(_0x23f9c4){return handleError(_0x2333a9,0x191,_0x23f9c4);}if(!_0x3c2be7){return handleError(_0x2333a9,0x194,{'message':_0x39e5('0x36')});}else{var _0x5eba10={'payload':{'id':_0x3c2be7['id'],'role':_0x3c2be7['role']},'options':{'expiresIn':0x15180}};return authService[_0x39e5('0x37')](_0x5eba10)['then'](function(_0x3721d8){_0x2333a9[_0x39e5('0x38')]({'id':_0x3c2be7['id'],'token':_0x3721d8,'statusCall':'','isAlreadyLogged':_0x3c2be7[_0x39e5('0x39')]});});}})(_0xe930fc,_0x2333a9,_0x35bf18);};exports[_0x39e5('0x3a')]=function(_0x31d059,_0x25e589,_0x151a95){if(!_0x31d059[_0x39e5('0x3b')][_0x39e5('0x2c')]){return handleError(_0x25e589,0x1f4,{'message':_0x39e5('0x3c')});}var _0x3ab2c7=rs[_0x39e5('0x3d')]();_0x31d059[_0x39e5('0x3b')][_0x39e5('0x2c')]=_0x31d059['body']['email']['trim']()[_0x39e5('0x3e')]();var _0x14a727;return db[_0x39e5('0x9')][_0x39e5('0xa')]({'where':{'id':0x1},'attributes':[_0x39e5('0x17'),'blockDuration'],'raw':!![]})[_0x39e5('0xc')](function(_0x35f51b){_0x14a727=_0x35f51b;return db[_0x39e5('0x3f')][_0x39e5('0x20')]({'where':{'email':_0x31d059[_0x39e5('0x3b')][_0x39e5('0x2c')]}});})['then'](function(_0x2f5335){if(!_0x2f5335){throw new Error(_0x39e5('0x40'));}if(_0x2f5335['disabled']){throw new Error(_0x39e5('0x41'));}if(_0x2f5335[_0x39e5('0x18')]){if(moment(_0x2f5335[_0x39e5('0x10')])[_0x39e5('0x19')](_0x14a727[_0x39e5('0xb')],'minutes')>moment()){throw new Error(_0x39e5('0x42'));}else{_0x2f5335[_0x39e5('0x18')]=![];_0x2f5335['blockedAt']=null;}}_0x2f5335[_0x39e5('0x43')]=_0x3ab2c7;_0x2f5335[_0x39e5('0x44')]=Date[_0x39e5('0x45')]()+0x36ee80;return _0x2f5335[_0x39e5('0x46')]();})[_0x39e5('0xc')](function(){return sendServiceMail({'to':_0x31d059['body'][_0x39e5('0x2c')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x39e5('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x39e5('0x48')+_0x31d059['headers'][_0x39e5('0x25')]+_0x39e5('0x49')+_0x3ab2c7+'\x0a\x0a'+_0x39e5('0x4a')});})['then'](function(){_0x25e589['status'](0xc8)[_0x39e5('0x34')]({'message':_0x39e5('0x4b')});})[_0x39e5('0x1e')](function(_0x52a22a){return handleError(_0x25e589,0x1f4,_0x52a22a);});};exports[_0x39e5('0x4c')]=function(_0x2e8b5f,_0x138c50,_0x142c3c){return db[_0x39e5('0x3f')][_0x39e5('0x20')]({'where':{'resetPasswordToken':_0x2e8b5f[_0x39e5('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x39e5('0xc')](function(_0x49c1dc){if(!_0x49c1dc){throw new Error(_0x39e5('0x4e'));}return db[_0x39e5('0x9')][_0x39e5('0xa')]({'attributes':['id',_0x39e5('0x4f'),_0x39e5('0x50'),_0x39e5('0x51')]})[_0x39e5('0xc')](function(_0x527e8f){if(_0x527e8f['securePassword'])authService['validatePasswordPattern'](_0x2e8b5f[_0x39e5('0x3b')][_0x39e5('0xe')]);if(!_0x527e8f[_0x39e5('0x50')]||!_0x49c1dc['previousPasswords'])return _0x49c1dc;authService[_0x39e5('0x52')](_0x2e8b5f[_0x39e5('0x3b')][_0x39e5('0xe')],_0x49c1dc[_0x39e5('0x53')],_0x527e8f['passwordHistoryLimit']);return _0x49c1dc;})[_0x39e5('0xc')](function(){_0x49c1dc[_0x39e5('0xe')]=_0x2e8b5f['body'][_0x39e5('0xe')];_0x49c1dc[_0x39e5('0x43')]=null;_0x49c1dc[_0x39e5('0x44')]=null;return _0x49c1dc[_0x39e5('0x46')]();});})[_0x39e5('0xc')](function(){_0x138c50[_0x39e5('0x33')](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x43630f){return handleError(_0x138c50,0x1f4,_0x43630f);});};passport[_0x39e5('0x54')](_0x39e5('0x35'),new LocalStrategy({'usernameField':_0x39e5('0xd'),'passwordField':'password'},function(_0x348bac,_0x36ef02,_0xf82858){return localAuthenticate(db['User'],_0x348bac,_0x36ef02,_0xf82858);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 64271af..601939e 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 _0x0d9e=['/reset/:token','reset','exports','express','./authLocal.controller','post','login','/forgot','forgot'];(function(_0xd28e0b,_0x2cef3c){var _0x5bbf43=function(_0xb4fff0){while(--_0xb4fff0){_0xd28e0b['push'](_0xd28e0b['shift']());}};_0x5bbf43(++_0x2cef3c);}(_0x0d9e,0x1e9));var _0xe0d9=function(_0xa81dc2,_0x16c94e){_0xa81dc2=_0xa81dc2-0x0;var _0x353708=_0x0d9e[_0xa81dc2];return _0x353708;};'use strict';var express=require(_0xe0d9('0x0'));var router=express['Router']();var controller=require(_0xe0d9('0x1'));router[_0xe0d9('0x2')]('/',controller[_0xe0d9('0x3')]);router['post'](_0xe0d9('0x4'),controller[_0xe0d9('0x5')]);router[_0xe0d9('0x2')](_0xe0d9('0x6'),controller[_0xe0d9('0x7')]);module[_0xe0d9('0x8')]=router; \ No newline at end of file +var _0x195d=['reset','exports','express','Router','post','login','/forgot','forgot','/reset/:token'];(function(_0x20b85e,_0x50d027){var _0x35ebc6=function(_0x2d7199){while(--_0x2d7199){_0x20b85e['push'](_0x20b85e['shift']());}};_0x35ebc6(++_0x50d027);}(_0x195d,0x92));var _0xd195=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x195d[_0x5224ba];return _0x459bd2;};'use strict';var express=require(_0xd195('0x0'));var router=express[_0xd195('0x1')]();var controller=require('./authLocal.controller');router[_0xd195('0x2')]('/',controller[_0xd195('0x3')]);router['post'](_0xd195('0x4'),controller[_0xd195('0x5')]);router[_0xd195('0x2')](_0xd195('0x6'),controller[_0xd195('0x7')]);module[_0xd195('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index dd80f97..bfc62f6 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 _0xe09b=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xe09b,0x1df));var _0xbe09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe09b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbe09('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe09('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xbe09('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xbe09('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbe09('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8b3f=['INTEGER','STRING','BOOLEAN'];(function(_0x495977,_0x107906){var _0x2105f8=function(_0x4af937){while(--_0x4af937){_0x495977['push'](_0x495977['shift']());}};_0x2105f8(++_0x107906);}(_0x8b3f,0x1c6));var _0xf8b3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b3f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf8b3('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0xf8b3('0x0')]},'description':{'type':Sequelize[_0xf8b3('0x0')]},'status':{'type':Sequelize[_0xf8b3('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf8b3('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 e2ee1d2..52337cf 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 _0x3a8c=['then','destroy','end','stack','name','send','map','Automation','rawAttributes','fieldName','type','key','model','filters','intersection','fields','length','attributes','query','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','keys','create','body','update','find','addConditions','Condition','ids','omit','getConditions','findOne','options','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset'];(function(_0x4b2b61,_0x1a61f2){var _0x3348d5=function(_0x4404b8){while(--_0x4404b8){_0x4b2b61['push'](_0x4b2b61['shift']());}};_0x3348d5(++_0x1a61f2);}(_0x3a8c,0x82));var _0xc3a8=function(_0x4edac4,_0xb3f65e){_0x4edac4=_0x4edac4-0x0;var _0x4e9ad9=_0x3a8c[_0x4edac4];return _0x4e9ad9;};'use strict';var emlformat=require(_0xc3a8('0x0'));var rimraf=require(_0xc3a8('0x1'));var zipdir=require(_0xc3a8('0x2'));var jsonpatch=require(_0xc3a8('0x3'));var rp=require(_0xc3a8('0x4'));var moment=require(_0xc3a8('0x5'));var BPromise=require(_0xc3a8('0x6'));var Mustache=require(_0xc3a8('0x7'));var util=require(_0xc3a8('0x8'));var path=require('path');var sox=require(_0xc3a8('0x9'));var csv=require(_0xc3a8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3a8('0xb'));var squel=require(_0xc3a8('0xc'));var crypto=require(_0xc3a8('0xd'));var jsforce=require(_0xc3a8('0xe'));var deskjs=require(_0xc3a8('0xf'));var toCsv=require(_0xc3a8('0xa'));var querystring=require(_0xc3a8('0x10'));var Papa=require(_0xc3a8('0x11'));var Redis=require(_0xc3a8('0x12'));var authService=require(_0xc3a8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc3a8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3a8('0x15'))(_0xc3a8('0x16'));var utils=require('../../config/utils');var config=require(_0xc3a8('0x17'));var licenseUtil=require(_0xc3a8('0x18'));var db=require(_0xc3a8('0x19'))['db'];function respondWithStatusCode(_0x3008e1,_0x100e14){_0x100e14=_0x100e14||0xcc;return function(_0x47ca93){if(_0x47ca93){return _0x3008e1[_0xc3a8('0x1a')](_0x100e14);}return _0x3008e1[_0xc3a8('0x1b')](_0x100e14)['end']();};}function respondWithResult(_0x476c0a,_0x1f4162){_0x1f4162=_0x1f4162||0xc8;return function(_0x1e0060){if(_0x1e0060){return _0x476c0a[_0xc3a8('0x1b')](_0x1f4162)['json'](_0x1e0060);}};}function respondWithFilteredResult(_0x552904,_0x508e9e){return function(_0x4b50a7){if(_0x4b50a7){var _0x3ca546=typeof _0x508e9e['offset']==='undefined'&&typeof _0x508e9e[_0xc3a8('0x1c')]===_0xc3a8('0x1d');var _0x1bb7fb=_0x4b50a7[_0xc3a8('0x1e')];var _0x213730=_0x3ca546?0x0:_0x508e9e['offset'];var _0x450abc=_0x3ca546?_0x4b50a7[_0xc3a8('0x1e')]:_0x508e9e[_0xc3a8('0x1f')]+_0x508e9e['limit'];var _0x22a550;if(_0x450abc>=_0x1bb7fb){_0x450abc=_0x1bb7fb;_0x22a550=0xc8;}else{_0x22a550=0xce;}_0x552904[_0xc3a8('0x1b')](_0x22a550);return _0x552904['set']('Content-Range',_0x213730+'-'+_0x450abc+'/'+_0x1bb7fb)['json'](_0x4b50a7);}return null;};}function patchUpdates(_0x2beed3){return function(_0x98ad17){try{jsonpatch['apply'](_0x98ad17,_0x2beed3,!![]);}catch(_0x2c618b){return BPromise['reject'](_0x2c618b);}return _0x98ad17['save']();};}function saveUpdates(_0x5e8d39,_0x8538f3){return function(_0x25d284){if(_0x25d284){return _0x25d284['update'](_0x5e8d39)[_0xc3a8('0x20')](function(_0x5dd17a){return _0x5dd17a;});}return null;};}function removeEntity(_0x47e206,_0x1c6628){return function(_0x52525c){if(_0x52525c){return _0x52525c[_0xc3a8('0x21')]()[_0xc3a8('0x20')](function(){_0x47e206[_0xc3a8('0x1b')](0xcc)[_0xc3a8('0x22')]();});}};}function handleEntityNotFound(_0x5e2b77,_0x30911f){return function(_0x36d9ad){if(!_0x36d9ad){_0x5e2b77[_0xc3a8('0x1a')](0x194);}return _0x36d9ad;};}function handleError(_0x40b802,_0x4b4f6a){_0x4b4f6a=_0x4b4f6a||0x1f4;return function(_0x275ff1){logger['error'](_0x275ff1[_0xc3a8('0x23')]);if(_0x275ff1[_0xc3a8('0x24')]){delete _0x275ff1[_0xc3a8('0x24')];}_0x40b802[_0xc3a8('0x1b')](_0x4b4f6a)[_0xc3a8('0x25')](_0x275ff1);};}exports['index']=function(_0x3c2e79,_0x4c03d7){var _0x1736cf={},_0x3d71a8={},_0x576472={'count':0x0,'rows':[]};var _0x4e4b94=_[_0xc3a8('0x26')](db[_0xc3a8('0x27')][_0xc3a8('0x28')],function(_0x487424){return{'name':_0x487424[_0xc3a8('0x29')],'type':_0x487424[_0xc3a8('0x2a')][_0xc3a8('0x2b')]};});_0x3d71a8[_0xc3a8('0x2c')]=_[_0xc3a8('0x26')](_0x4e4b94,'name');_0x3d71a8['query']=_['keys'](_0x3c2e79['query']);_0x3d71a8[_0xc3a8('0x2d')]=_[_0xc3a8('0x2e')](_0x3d71a8[_0xc3a8('0x2c')],_0x3d71a8['query']);_0x1736cf['attributes']=_['intersection'](_0x3d71a8[_0xc3a8('0x2c')],qs[_0xc3a8('0x2f')](_0x3c2e79['query'][_0xc3a8('0x2f')]));_0x1736cf['attributes']=_0x1736cf['attributes'][_0xc3a8('0x30')]?_0x1736cf[_0xc3a8('0x31')]:_0x3d71a8[_0xc3a8('0x2c')];if(!_0x3c2e79[_0xc3a8('0x32')][_0xc3a8('0x33')]('nolimit')){_0x1736cf[_0xc3a8('0x1c')]=qs['limit'](_0x3c2e79['query'][_0xc3a8('0x1c')]);_0x1736cf[_0xc3a8('0x1f')]=qs[_0xc3a8('0x1f')](_0x3c2e79['query'][_0xc3a8('0x1f')]);}_0x1736cf[_0xc3a8('0x34')]=qs['sort'](_0x3c2e79[_0xc3a8('0x32')][_0xc3a8('0x35')]);_0x1736cf[_0xc3a8('0x36')]=qs['filters'](_[_0xc3a8('0x37')](_0x3c2e79[_0xc3a8('0x32')],_0x3d71a8[_0xc3a8('0x2d')]),_0x4e4b94);if(_0x3c2e79[_0xc3a8('0x32')]['filter']){_0x1736cf[_0xc3a8('0x36')]=_['merge'](_0x1736cf[_0xc3a8('0x36')],{'$or':_[_0xc3a8('0x26')](_0x4e4b94,function(_0x25cbed){if(_0x25cbed[_0xc3a8('0x2a')]!==_0xc3a8('0x38')){var _0x348a8d={};_0x348a8d[_0x25cbed['name']]={'$like':'%'+_0x3c2e79['query'][_0xc3a8('0x39')]+'%'};return _0x348a8d;}})});}_0x1736cf=_[_0xc3a8('0x3a')]({},_0x1736cf,_0x3c2e79['options']);var _0x5918d={'where':_0x1736cf[_0xc3a8('0x36')]};return db[_0xc3a8('0x27')][_0xc3a8('0x1e')](_0x5918d)[_0xc3a8('0x20')](function(_0x37c5ec){_0x576472[_0xc3a8('0x1e')]=_0x37c5ec;if(_0x3c2e79[_0xc3a8('0x32')][_0xc3a8('0x3b')]){_0x1736cf[_0xc3a8('0x3c')]=[{'all':!![]}];}return db[_0xc3a8('0x27')][_0xc3a8('0x3d')](_0x1736cf);})[_0xc3a8('0x20')](function(_0x59f330){_0x576472['rows']=_0x59f330;return _0x576472;})[_0xc3a8('0x20')](respondWithFilteredResult(_0x4c03d7,_0x1736cf))[_0xc3a8('0x3e')](handleError(_0x4c03d7,null));};exports[_0xc3a8('0x3f')]=function(_0x64a7bf,_0x50cb2d){var _0x37b860={'raw':![],'where':{'id':_0x64a7bf[_0xc3a8('0x40')]['id']}},_0x20df8b={};_0x20df8b[_0xc3a8('0x2c')]=_[_0xc3a8('0x41')](db[_0xc3a8('0x27')][_0xc3a8('0x28')]);_0x20df8b['query']=_['keys'](_0x64a7bf['query']);_0x20df8b['filters']=_['intersection'](_0x20df8b[_0xc3a8('0x2c')],_0x20df8b[_0xc3a8('0x32')]);_0x37b860[_0xc3a8('0x31')]=_[_0xc3a8('0x2e')](_0x20df8b[_0xc3a8('0x2c')],qs['fields'](_0x64a7bf['query'][_0xc3a8('0x2f')]));_0x37b860['attributes']=_0x37b860[_0xc3a8('0x31')]['length']?_0x37b860['attributes']:_0x20df8b[_0xc3a8('0x2c')];if(_0x64a7bf['query'][_0xc3a8('0x3b')]){_0x37b860['include']=[{'all':!![]}];}_0x37b860=_[_0xc3a8('0x3a')]({},_0x37b860,_0x64a7bf['options']);return db[_0xc3a8('0x27')]['find'](_0x37b860)[_0xc3a8('0x20')](handleEntityNotFound(_0x50cb2d,null))[_0xc3a8('0x20')](respondWithResult(_0x50cb2d,null))[_0xc3a8('0x3e')](handleError(_0x50cb2d,null));};exports[_0xc3a8('0x42')]=function(_0x4c8f25,_0x5d5080){return db[_0xc3a8('0x27')][_0xc3a8('0x42')](_0x4c8f25[_0xc3a8('0x43')],{})['then'](respondWithResult(_0x5d5080,0xc9))['catch'](handleError(_0x5d5080,null));};exports[_0xc3a8('0x44')]=function(_0x26906d,_0x43df43){if(_0x26906d['body']['id']){delete _0x26906d[_0xc3a8('0x43')]['id'];}return db[_0xc3a8('0x27')][_0xc3a8('0x45')]({'where':{'id':_0x26906d[_0xc3a8('0x40')]['id']}})[_0xc3a8('0x20')](handleEntityNotFound(_0x43df43,null))[_0xc3a8('0x20')](saveUpdates(_0x26906d['body'],null))['then'](respondWithResult(_0x43df43,null))[_0xc3a8('0x3e')](handleError(_0x43df43,null));};exports['destroy']=function(_0x4ac807,_0x30a78d){return db[_0xc3a8('0x27')][_0xc3a8('0x45')]({'where':{'id':_0x4ac807[_0xc3a8('0x40')]['id']}})['then'](handleEntityNotFound(_0x30a78d,null))[_0xc3a8('0x20')](removeEntity(_0x30a78d,null))[_0xc3a8('0x3e')](handleError(_0x30a78d,null));};exports[_0xc3a8('0x46')]=function(_0x4ffd29,_0x373a72,_0x206666){return db[_0xc3a8('0x47')][_0xc3a8('0x45')]({'where':{'id':_0x4ffd29[_0xc3a8('0x40')]['id']}})[_0xc3a8('0x20')](handleEntityNotFound(_0x373a72,null))[_0xc3a8('0x20')](function(_0x1904a1){if(_0x1904a1){return _0x1904a1[_0xc3a8('0x46')](_0x4ffd29[_0xc3a8('0x43')][_0xc3a8('0x48')],_[_0xc3a8('0x49')](_0x4ffd29[_0xc3a8('0x43')],[_0xc3a8('0x48'),'id'])||{});}})[_0xc3a8('0x20')](respondWithResult(_0x373a72,null))['catch'](handleError(_0x373a72,null));};exports[_0xc3a8('0x4a')]=function(_0x1f781d,_0x1209c5,_0x3d9ed6){var _0x4e6020={};var _0x201b1a={};var _0x587943;var _0xafb277;return db[_0xc3a8('0x27')][_0xc3a8('0x4b')]({'where':{'id':_0x1f781d[_0xc3a8('0x40')]['id']}})['then'](handleEntityNotFound(_0x1209c5,null))[_0xc3a8('0x20')](function(_0x9fd05e){if(_0x9fd05e){_0x587943=_0x9fd05e;_0x201b1a[_0xc3a8('0x2c')]=_['keys'](db[_0xc3a8('0x47')][_0xc3a8('0x28')]);_0x201b1a['query']=_[_0xc3a8('0x41')](_0x1f781d[_0xc3a8('0x32')]);_0x201b1a[_0xc3a8('0x2d')]=_['intersection'](_0x201b1a[_0xc3a8('0x2c')],_0x201b1a[_0xc3a8('0x32')]);_0x4e6020[_0xc3a8('0x31')]=_[_0xc3a8('0x2e')](_0x201b1a['model'],qs[_0xc3a8('0x2f')](_0x1f781d[_0xc3a8('0x32')][_0xc3a8('0x2f')]));_0x4e6020['attributes']=_0x4e6020[_0xc3a8('0x31')][_0xc3a8('0x30')]?_0x4e6020[_0xc3a8('0x31')]:_0x201b1a['model'];_0x4e6020['order']=qs[_0xc3a8('0x35')](_0x1f781d[_0xc3a8('0x32')][_0xc3a8('0x35')]);_0x4e6020[_0xc3a8('0x36')]=qs[_0xc3a8('0x2d')](_[_0xc3a8('0x37')](_0x1f781d[_0xc3a8('0x32')],_0x201b1a['filters']));if(_0x1f781d[_0xc3a8('0x32')][_0xc3a8('0x39')]){_0x4e6020[_0xc3a8('0x36')]=_['merge'](_0x4e6020[_0xc3a8('0x36')],{'$or':_[_0xc3a8('0x26')](_0x4e6020[_0xc3a8('0x31')],function(_0x29d47d){var _0x18e4e3={};_0x18e4e3[_0x29d47d]={'$like':'%'+_0x1f781d[_0xc3a8('0x32')][_0xc3a8('0x39')]+'%'};return _0x18e4e3;})});}_0x4e6020=_['merge']({},_0x4e6020,_0x1f781d[_0xc3a8('0x4c')]);return _0x587943[_0xc3a8('0x4a')](_0x4e6020);}})['then'](function(_0x3a49ed){if(_0x3a49ed){_0xafb277=_0x3a49ed[_0xc3a8('0x30')];if(!_0x1f781d[_0xc3a8('0x32')][_0xc3a8('0x33')](_0xc3a8('0x4d'))){_0x4e6020[_0xc3a8('0x1c')]=qs[_0xc3a8('0x1c')](_0x1f781d[_0xc3a8('0x32')]['limit']);_0x4e6020['offset']=qs['offset'](_0x1f781d[_0xc3a8('0x32')][_0xc3a8('0x1f')]);}return _0x587943[_0xc3a8('0x4a')](_0x4e6020);}})[_0xc3a8('0x20')](function(_0x5b903d){if(_0x5b903d){return _0x5b903d?{'count':_0xafb277,'rows':_0x5b903d}:null;}})[_0xc3a8('0x20')](respondWithResult(_0x1209c5,null))['catch'](handleError(_0x1209c5,null));};exports[_0xc3a8('0x4e')]=function(_0x413101,_0x50e4c7,_0x4e2c62){return db[_0xc3a8('0x4f')][_0xc3a8('0x45')]({'where':{'id':_0x413101[_0xc3a8('0x40')]['id']}})[_0xc3a8('0x20')](handleEntityNotFound(_0x50e4c7,null))[_0xc3a8('0x20')](function(_0x103a11){if(_0x103a11){return _0x103a11[_0xc3a8('0x4e')](_0x413101[_0xc3a8('0x43')][_0xc3a8('0x48')],_[_0xc3a8('0x49')](_0x413101[_0xc3a8('0x43')],['ids','id'])||{});}})[_0xc3a8('0x20')](respondWithResult(_0x50e4c7,null))[_0xc3a8('0x3e')](handleError(_0x50e4c7,null));};exports[_0xc3a8('0x50')]=function(_0x52de7d,_0x71758c,_0x3b98f3){var _0x4ad3ec={};var _0x15dd37={};var _0x4fd985;var _0x42ee8e;return db[_0xc3a8('0x27')][_0xc3a8('0x4b')]({'where':{'id':_0x52de7d[_0xc3a8('0x40')]['id']}})['then'](handleEntityNotFound(_0x71758c,null))[_0xc3a8('0x20')](function(_0x43d9c5){if(_0x43d9c5){_0x4fd985=_0x43d9c5;_0x15dd37[_0xc3a8('0x2c')]=_['keys'](db[_0xc3a8('0x4f')][_0xc3a8('0x28')]);_0x15dd37[_0xc3a8('0x32')]=_['keys'](_0x52de7d['query']);_0x15dd37[_0xc3a8('0x2d')]=_['intersection'](_0x15dd37[_0xc3a8('0x2c')],_0x15dd37[_0xc3a8('0x32')]);_0x4ad3ec['attributes']=_['intersection'](_0x15dd37[_0xc3a8('0x2c')],qs[_0xc3a8('0x2f')](_0x52de7d[_0xc3a8('0x32')][_0xc3a8('0x2f')]));_0x4ad3ec[_0xc3a8('0x31')]=_0x4ad3ec[_0xc3a8('0x31')][_0xc3a8('0x30')]?_0x4ad3ec[_0xc3a8('0x31')]:_0x15dd37['model'];_0x4ad3ec[_0xc3a8('0x34')]=qs[_0xc3a8('0x35')](_0x52de7d[_0xc3a8('0x32')][_0xc3a8('0x35')]);_0x4ad3ec['where']=qs[_0xc3a8('0x2d')](_['pick'](_0x52de7d[_0xc3a8('0x32')],_0x15dd37[_0xc3a8('0x2d')]));if(_0x52de7d[_0xc3a8('0x32')][_0xc3a8('0x39')]){_0x4ad3ec[_0xc3a8('0x36')]=_[_0xc3a8('0x3a')](_0x4ad3ec['where'],{'$or':_['map'](_0x4ad3ec[_0xc3a8('0x31')],function(_0xbf1101){var _0x5cd427={};_0x5cd427[_0xbf1101]={'$like':'%'+_0x52de7d[_0xc3a8('0x32')][_0xc3a8('0x39')]+'%'};return _0x5cd427;})});}_0x4ad3ec=_[_0xc3a8('0x3a')]({},_0x4ad3ec,_0x52de7d['options']);return _0x4fd985['getActions'](_0x4ad3ec);}})[_0xc3a8('0x20')](function(_0x531bb3){if(_0x531bb3){_0x42ee8e=_0x531bb3[_0xc3a8('0x30')];if(!_0x52de7d['query']['hasOwnProperty']('nolimit')){_0x4ad3ec[_0xc3a8('0x1c')]=qs[_0xc3a8('0x1c')](_0x52de7d[_0xc3a8('0x32')]['limit']);_0x4ad3ec['offset']=qs['offset'](_0x52de7d[_0xc3a8('0x32')][_0xc3a8('0x1f')]);}return _0x4fd985['getActions'](_0x4ad3ec);}})[_0xc3a8('0x20')](function(_0x12465e){if(_0x12465e){return _0x12465e?{'count':_0x42ee8e,'rows':_0x12465e}:null;}})[_0xc3a8('0x20')](respondWithResult(_0x71758c,null))[_0xc3a8('0x3e')](handleError(_0x71758c,null));}; \ No newline at end of file +var _0xa6c0=['where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','addConditions','Condition','ids','omit','getConditions','findOne','fields','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort'];(function(_0x1526a9,_0x48fb64){var _0x9f4049=function(_0x13271a){while(--_0x13271a){_0x1526a9['push'](_0x1526a9['shift']());}};_0x9f4049(++_0x48fb64);}(_0xa6c0,0x1cd));var _0x0a6c=function(_0x54c6a6,_0x2f8457){_0x54c6a6=_0x54c6a6-0x0;var _0x5e4f88=_0xa6c0[_0x54c6a6];return _0x5e4f88;};'use strict';var emlformat=require(_0x0a6c('0x0'));var rimraf=require(_0x0a6c('0x1'));var zipdir=require(_0x0a6c('0x2'));var jsonpatch=require(_0x0a6c('0x3'));var rp=require('request-promise');var moment=require(_0x0a6c('0x4'));var BPromise=require(_0x0a6c('0x5'));var Mustache=require(_0x0a6c('0x6'));var util=require(_0x0a6c('0x7'));var path=require(_0x0a6c('0x8'));var sox=require(_0x0a6c('0x9'));var csv=require('to-csv');var ejs=require(_0x0a6c('0xa'));var fs=require('fs');var fs_extra=require(_0x0a6c('0xb'));var _=require('lodash');var squel=require(_0x0a6c('0xc'));var crypto=require(_0x0a6c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a6c('0xe'));var toCsv=require(_0x0a6c('0xf'));var querystring=require(_0x0a6c('0x10'));var Papa=require('papaparse');var Redis=require(_0x0a6c('0x11'));var authService=require(_0x0a6c('0x12'));var qs=require(_0x0a6c('0x13'));var as=require(_0x0a6c('0x14'));var hardwareService=require(_0x0a6c('0x15'));var logger=require(_0x0a6c('0x16'))(_0x0a6c('0x17'));var utils=require(_0x0a6c('0x18'));var config=require(_0x0a6c('0x19'));var licenseUtil=require(_0x0a6c('0x1a'));var db=require(_0x0a6c('0x1b'))['db'];function respondWithStatusCode(_0x4d9bf6,_0x262c5f){_0x262c5f=_0x262c5f||0xcc;return function(_0x2a3a66){if(_0x2a3a66){return _0x4d9bf6['sendStatus'](_0x262c5f);}return _0x4d9bf6[_0x0a6c('0x1c')](_0x262c5f)['end']();};}function respondWithResult(_0x24cb79,_0x3e6a04){_0x3e6a04=_0x3e6a04||0xc8;return function(_0x5733e1){if(_0x5733e1){return _0x24cb79[_0x0a6c('0x1c')](_0x3e6a04)['json'](_0x5733e1);}};}function respondWithFilteredResult(_0x46957b,_0x5e2e72){return function(_0x3a38dc){if(_0x3a38dc){var _0x28feef=typeof _0x5e2e72[_0x0a6c('0x1d')]===_0x0a6c('0x1e')&&typeof _0x5e2e72[_0x0a6c('0x1f')]===_0x0a6c('0x1e');var _0x16d51e=_0x3a38dc[_0x0a6c('0x20')];var _0x5e692c=_0x28feef?0x0:_0x5e2e72['offset'];var _0x1c18dd=_0x28feef?_0x3a38dc['count']:_0x5e2e72['offset']+_0x5e2e72[_0x0a6c('0x1f')];var _0x2f2e9d;if(_0x1c18dd>=_0x16d51e){_0x1c18dd=_0x16d51e;_0x2f2e9d=0xc8;}else{_0x2f2e9d=0xce;}_0x46957b[_0x0a6c('0x1c')](_0x2f2e9d);return _0x46957b[_0x0a6c('0x21')]('Content-Range',_0x5e692c+'-'+_0x1c18dd+'/'+_0x16d51e)[_0x0a6c('0x22')](_0x3a38dc);}return null;};}function patchUpdates(_0x49407f){return function(_0x593518){try{jsonpatch[_0x0a6c('0x23')](_0x593518,_0x49407f,!![]);}catch(_0x3ad84f){return BPromise[_0x0a6c('0x24')](_0x3ad84f);}return _0x593518[_0x0a6c('0x25')]();};}function saveUpdates(_0x470af2,_0x11984b){return function(_0x2dbffa){if(_0x2dbffa){return _0x2dbffa[_0x0a6c('0x26')](_0x470af2)[_0x0a6c('0x27')](function(_0x31f6a2){return _0x31f6a2;});}return null;};}function removeEntity(_0x4745c9,_0x3cf4be){return function(_0x48a31a){if(_0x48a31a){return _0x48a31a[_0x0a6c('0x28')]()[_0x0a6c('0x27')](function(){_0x4745c9[_0x0a6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37bb32,_0x15e2c9){return function(_0x4e2ae4){if(!_0x4e2ae4){_0x37bb32['sendStatus'](0x194);}return _0x4e2ae4;};}function handleError(_0x3dcf08,_0x17253c){_0x17253c=_0x17253c||0x1f4;return function(_0xbbc89a){logger[_0x0a6c('0x29')](_0xbbc89a[_0x0a6c('0x2a')]);if(_0xbbc89a[_0x0a6c('0x2b')]){delete _0xbbc89a[_0x0a6c('0x2b')];}_0x3dcf08[_0x0a6c('0x1c')](_0x17253c)['send'](_0xbbc89a);};}exports[_0x0a6c('0x2c')]=function(_0x2a1245,_0x1ddd6c){var _0x244318={},_0x1d610c={},_0x53852e={'count':0x0,'rows':[]};var _0xbf8a8c=_[_0x0a6c('0x2d')](db[_0x0a6c('0x2e')][_0x0a6c('0x2f')],function(_0x3ad663){return{'name':_0x3ad663[_0x0a6c('0x30')],'type':_0x3ad663[_0x0a6c('0x31')][_0x0a6c('0x32')]};});_0x1d610c[_0x0a6c('0x33')]=_[_0x0a6c('0x2d')](_0xbf8a8c,_0x0a6c('0x2b'));_0x1d610c['query']=_[_0x0a6c('0x34')](_0x2a1245[_0x0a6c('0x35')]);_0x1d610c[_0x0a6c('0x36')]=_[_0x0a6c('0x37')](_0x1d610c[_0x0a6c('0x33')],_0x1d610c['query']);_0x244318[_0x0a6c('0x38')]=_[_0x0a6c('0x37')](_0x1d610c[_0x0a6c('0x33')],qs['fields'](_0x2a1245[_0x0a6c('0x35')]['fields']));_0x244318[_0x0a6c('0x38')]=_0x244318[_0x0a6c('0x38')][_0x0a6c('0x39')]?_0x244318[_0x0a6c('0x38')]:_0x1d610c[_0x0a6c('0x33')];if(!_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x3a')]('nolimit')){_0x244318[_0x0a6c('0x1f')]=qs[_0x0a6c('0x1f')](_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x1f')]);_0x244318['offset']=qs['offset'](_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x1d')]);}_0x244318[_0x0a6c('0x3b')]=qs[_0x0a6c('0x3c')](_0x2a1245['query']['sort']);_0x244318[_0x0a6c('0x3d')]=qs['filters'](_[_0x0a6c('0x3e')](_0x2a1245[_0x0a6c('0x35')],_0x1d610c['filters']),_0xbf8a8c);if(_0x2a1245[_0x0a6c('0x35')]['filter']){_0x244318[_0x0a6c('0x3d')]=_[_0x0a6c('0x3f')](_0x244318[_0x0a6c('0x3d')],{'$or':_[_0x0a6c('0x2d')](_0xbf8a8c,function(_0x22d853){if(_0x22d853[_0x0a6c('0x31')]!=='VIRTUAL'){var _0x351f3b={};_0x351f3b[_0x22d853[_0x0a6c('0x2b')]]={'$like':'%'+_0x2a1245['query'][_0x0a6c('0x40')]+'%'};return _0x351f3b;}})});}_0x244318=_[_0x0a6c('0x3f')]({},_0x244318,_0x2a1245['options']);var _0x233a2b={'where':_0x244318[_0x0a6c('0x3d')]};return db[_0x0a6c('0x2e')]['count'](_0x233a2b)[_0x0a6c('0x27')](function(_0x50e3af){_0x53852e[_0x0a6c('0x20')]=_0x50e3af;if(_0x2a1245[_0x0a6c('0x35')][_0x0a6c('0x41')]){_0x244318['include']=[{'all':!![]}];}return db[_0x0a6c('0x2e')][_0x0a6c('0x42')](_0x244318);})['then'](function(_0x539f9c){_0x53852e[_0x0a6c('0x43')]=_0x539f9c;return _0x53852e;})['then'](respondWithFilteredResult(_0x1ddd6c,_0x244318))[_0x0a6c('0x44')](handleError(_0x1ddd6c,null));};exports[_0x0a6c('0x45')]=function(_0x3ee8bf,_0x214b27){var _0x828888={'raw':![],'where':{'id':_0x3ee8bf[_0x0a6c('0x46')]['id']}},_0x3e0d27={};_0x3e0d27[_0x0a6c('0x33')]=_[_0x0a6c('0x34')](db[_0x0a6c('0x2e')][_0x0a6c('0x2f')]);_0x3e0d27['query']=_[_0x0a6c('0x34')](_0x3ee8bf[_0x0a6c('0x35')]);_0x3e0d27[_0x0a6c('0x36')]=_[_0x0a6c('0x37')](_0x3e0d27[_0x0a6c('0x33')],_0x3e0d27['query']);_0x828888[_0x0a6c('0x38')]=_[_0x0a6c('0x37')](_0x3e0d27[_0x0a6c('0x33')],qs['fields'](_0x3ee8bf['query']['fields']));_0x828888['attributes']=_0x828888[_0x0a6c('0x38')][_0x0a6c('0x39')]?_0x828888[_0x0a6c('0x38')]:_0x3e0d27[_0x0a6c('0x33')];if(_0x3ee8bf['query'][_0x0a6c('0x41')]){_0x828888[_0x0a6c('0x47')]=[{'all':!![]}];}_0x828888=_['merge']({},_0x828888,_0x3ee8bf[_0x0a6c('0x48')]);return db['Automation']['find'](_0x828888)['then'](handleEntityNotFound(_0x214b27,null))[_0x0a6c('0x27')](respondWithResult(_0x214b27,null))[_0x0a6c('0x44')](handleError(_0x214b27,null));};exports[_0x0a6c('0x49')]=function(_0x11d483,_0x495a01){return db[_0x0a6c('0x2e')][_0x0a6c('0x49')](_0x11d483['body'],{})[_0x0a6c('0x27')](respondWithResult(_0x495a01,0xc9))[_0x0a6c('0x44')](handleError(_0x495a01,null));};exports[_0x0a6c('0x26')]=function(_0xa5bf90,_0x12297a){if(_0xa5bf90['body']['id']){delete _0xa5bf90[_0x0a6c('0x4a')]['id'];}return db[_0x0a6c('0x2e')][_0x0a6c('0x4b')]({'where':{'id':_0xa5bf90[_0x0a6c('0x46')]['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x12297a,null))[_0x0a6c('0x27')](saveUpdates(_0xa5bf90[_0x0a6c('0x4a')],null))['then'](respondWithResult(_0x12297a,null))[_0x0a6c('0x44')](handleError(_0x12297a,null));};exports[_0x0a6c('0x28')]=function(_0xfcf8ca,_0x1acbbe){return db[_0x0a6c('0x2e')]['find']({'where':{'id':_0xfcf8ca['params']['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x1acbbe,null))['then'](removeEntity(_0x1acbbe,null))[_0x0a6c('0x44')](handleError(_0x1acbbe,null));};exports[_0x0a6c('0x4c')]=function(_0xd5da9e,_0x469760,_0x3f19e7){return db[_0x0a6c('0x4d')][_0x0a6c('0x4b')]({'where':{'id':_0xd5da9e['params']['id']}})['then'](handleEntityNotFound(_0x469760,null))[_0x0a6c('0x27')](function(_0xa68935){if(_0xa68935){return _0xa68935[_0x0a6c('0x4c')](_0xd5da9e[_0x0a6c('0x4a')][_0x0a6c('0x4e')],_[_0x0a6c('0x4f')](_0xd5da9e[_0x0a6c('0x4a')],[_0x0a6c('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x469760,null))[_0x0a6c('0x44')](handleError(_0x469760,null));};exports[_0x0a6c('0x50')]=function(_0x2904fe,_0x347431,_0x3f1cfd){var _0x106e29={};var _0x35af83={};var _0x4d57f1;var _0x212bf8;return db[_0x0a6c('0x2e')][_0x0a6c('0x51')]({'where':{'id':_0x2904fe[_0x0a6c('0x46')]['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x347431,null))[_0x0a6c('0x27')](function(_0x4a5438){if(_0x4a5438){_0x4d57f1=_0x4a5438;_0x35af83[_0x0a6c('0x33')]=_[_0x0a6c('0x34')](db[_0x0a6c('0x4d')][_0x0a6c('0x2f')]);_0x35af83[_0x0a6c('0x35')]=_[_0x0a6c('0x34')](_0x2904fe[_0x0a6c('0x35')]);_0x35af83[_0x0a6c('0x36')]=_['intersection'](_0x35af83[_0x0a6c('0x33')],_0x35af83[_0x0a6c('0x35')]);_0x106e29[_0x0a6c('0x38')]=_[_0x0a6c('0x37')](_0x35af83['model'],qs[_0x0a6c('0x52')](_0x2904fe['query'][_0x0a6c('0x52')]));_0x106e29[_0x0a6c('0x38')]=_0x106e29[_0x0a6c('0x38')][_0x0a6c('0x39')]?_0x106e29[_0x0a6c('0x38')]:_0x35af83['model'];_0x106e29[_0x0a6c('0x3b')]=qs['sort'](_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x3c')]);_0x106e29[_0x0a6c('0x3d')]=qs[_0x0a6c('0x36')](_[_0x0a6c('0x3e')](_0x2904fe[_0x0a6c('0x35')],_0x35af83[_0x0a6c('0x36')]));if(_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x40')]){_0x106e29[_0x0a6c('0x3d')]=_['merge'](_0x106e29['where'],{'$or':_[_0x0a6c('0x2d')](_0x106e29['attributes'],function(_0x132bd7){var _0x19dd6f={};_0x19dd6f[_0x132bd7]={'$like':'%'+_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x40')]+'%'};return _0x19dd6f;})});}_0x106e29=_[_0x0a6c('0x3f')]({},_0x106e29,_0x2904fe[_0x0a6c('0x48')]);return _0x4d57f1['getConditions'](_0x106e29);}})[_0x0a6c('0x27')](function(_0xb9bb07){if(_0xb9bb07){_0x212bf8=_0xb9bb07[_0x0a6c('0x39')];if(!_0x2904fe[_0x0a6c('0x35')][_0x0a6c('0x3a')](_0x0a6c('0x53'))){_0x106e29[_0x0a6c('0x1f')]=qs[_0x0a6c('0x1f')](_0x2904fe['query'][_0x0a6c('0x1f')]);_0x106e29['offset']=qs[_0x0a6c('0x1d')](_0x2904fe['query']['offset']);}return _0x4d57f1['getConditions'](_0x106e29);}})[_0x0a6c('0x27')](function(_0x55a3f1){if(_0x55a3f1){return _0x55a3f1?{'count':_0x212bf8,'rows':_0x55a3f1}:null;}})[_0x0a6c('0x27')](respondWithResult(_0x347431,null))[_0x0a6c('0x44')](handleError(_0x347431,null));};exports[_0x0a6c('0x54')]=function(_0x28c571,_0x1921a5,_0x319722){return db[_0x0a6c('0x55')][_0x0a6c('0x4b')]({'where':{'id':_0x28c571[_0x0a6c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1921a5,null))[_0x0a6c('0x27')](function(_0xcf03d){if(_0xcf03d){return _0xcf03d[_0x0a6c('0x54')](_0x28c571[_0x0a6c('0x4a')][_0x0a6c('0x4e')],_['omit'](_0x28c571[_0x0a6c('0x4a')],[_0x0a6c('0x4e'),'id'])||{});}})[_0x0a6c('0x27')](respondWithResult(_0x1921a5,null))['catch'](handleError(_0x1921a5,null));};exports[_0x0a6c('0x56')]=function(_0x2977f2,_0x4a97f3,_0x3d039e){var _0x4c80e2={};var _0xf486c={};var _0x5a6a86;var _0x363626;return db[_0x0a6c('0x2e')]['findOne']({'where':{'id':_0x2977f2[_0x0a6c('0x46')]['id']}})[_0x0a6c('0x27')](handleEntityNotFound(_0x4a97f3,null))['then'](function(_0x2b9a1c){if(_0x2b9a1c){_0x5a6a86=_0x2b9a1c;_0xf486c['model']=_[_0x0a6c('0x34')](db[_0x0a6c('0x55')][_0x0a6c('0x2f')]);_0xf486c[_0x0a6c('0x35')]=_[_0x0a6c('0x34')](_0x2977f2[_0x0a6c('0x35')]);_0xf486c[_0x0a6c('0x36')]=_[_0x0a6c('0x37')](_0xf486c['model'],_0xf486c[_0x0a6c('0x35')]);_0x4c80e2[_0x0a6c('0x38')]=_['intersection'](_0xf486c[_0x0a6c('0x33')],qs[_0x0a6c('0x52')](_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x52')]));_0x4c80e2['attributes']=_0x4c80e2[_0x0a6c('0x38')]['length']?_0x4c80e2[_0x0a6c('0x38')]:_0xf486c[_0x0a6c('0x33')];_0x4c80e2[_0x0a6c('0x3b')]=qs['sort'](_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x3c')]);_0x4c80e2['where']=qs[_0x0a6c('0x36')](_['pick'](_0x2977f2[_0x0a6c('0x35')],_0xf486c[_0x0a6c('0x36')]));if(_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x40')]){_0x4c80e2['where']=_[_0x0a6c('0x3f')](_0x4c80e2[_0x0a6c('0x3d')],{'$or':_['map'](_0x4c80e2['attributes'],function(_0x5bb03b){var _0x358ae2={};_0x358ae2[_0x5bb03b]={'$like':'%'+_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x40')]+'%'};return _0x358ae2;})});}_0x4c80e2=_[_0x0a6c('0x3f')]({},_0x4c80e2,_0x2977f2[_0x0a6c('0x48')]);return _0x5a6a86[_0x0a6c('0x56')](_0x4c80e2);}})[_0x0a6c('0x27')](function(_0x4dcf6f){if(_0x4dcf6f){_0x363626=_0x4dcf6f[_0x0a6c('0x39')];if(!_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x3a')](_0x0a6c('0x53'))){_0x4c80e2[_0x0a6c('0x1f')]=qs[_0x0a6c('0x1f')](_0x2977f2['query']['limit']);_0x4c80e2[_0x0a6c('0x1d')]=qs[_0x0a6c('0x1d')](_0x2977f2[_0x0a6c('0x35')][_0x0a6c('0x1d')]);}return _0x5a6a86[_0x0a6c('0x56')](_0x4c80e2);}})[_0x0a6c('0x27')](function(_0x25aed8){if(_0x25aed8){return _0x25aed8?{'count':_0x363626,'rows':_0x25aed8}:null;}})[_0x0a6c('0x27')](respondWithResult(_0x4a97f3,null))[_0x0a6c('0x44')](handleError(_0x4a97f3,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ab6392f..cd42f50 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 _0xd672=['Automation','tools_automations','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define'];(function(_0x3caaa4,_0x37931d){var _0xdc7050=function(_0xd72dc0){while(--_0xd72dc0){_0x3caaa4['push'](_0x3caaa4['shift']());}};_0xdc7050(++_0x37931d);}(_0xd672,0xf4));var _0x2d67=function(_0x3d3d7d,_0x2d3f0f){_0x3d3d7d=_0x3d3d7d-0x0;var _0x313797=_0xd672[_0x3d3d7d];return _0x313797;};'use strict';var _=require('lodash');var util=require(_0x2d67('0x0'));var logger=require('../../config/logger')(_0x2d67('0x1'));var moment=require('moment');var BPromise=require(_0x2d67('0x2'));var rp=require(_0x2d67('0x3'));var fs=require('fs');var path=require(_0x2d67('0x4'));var rimraf=require(_0x2d67('0x5'));var config=require(_0x2d67('0x6'));var attributes=require(_0x2d67('0x7'));module['exports']=function(_0x4677b4,_0x40444c){return _0x4677b4[_0x2d67('0x8')](_0x2d67('0x9'),attributes,{'tableName':_0x2d67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc6c=['exports','define','Automation','tools_automations','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./automation.attributes'];(function(_0x523985,_0x4d75bc){var _0x492a79=function(_0x137af4){while(--_0x137af4){_0x523985['push'](_0x523985['shift']());}};_0x492a79(++_0x4d75bc);}(_0xbc6c,0x64));var _0xcbc6=function(_0xb2386e,_0x40c6b2){_0xb2386e=_0xb2386e-0x0;var _0x568491=_0xbc6c[_0xb2386e];return _0x568491;};'use strict';var _=require(_0xcbc6('0x0'));var util=require(_0xcbc6('0x1'));var logger=require('../../config/logger')(_0xcbc6('0x2'));var moment=require(_0xcbc6('0x3'));var BPromise=require(_0xcbc6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbc6('0x5'));var config=require(_0xcbc6('0x6'));var attributes=require(_0xcbc6('0x7'));module[_0xcbc6('0x8')]=function(_0x18e75d,_0x2d3aad){return _0x18e75d[_0xcbc6('0x9')](_0xcbc6('0xa'),attributes,{'tableName':_0xcbc6('0xb'),'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 6dd436d..d50af25 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 _0x2a84=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','Automation,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x1332e8,_0x49d9d9){var _0x2687d2=function(_0x2ed971){while(--_0x2ed971){_0x1332e8['push'](_0x1332e8['shift']());}};_0x2687d2(++_0x49d9d9);}(_0x2a84,0x170));var _0x42a8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2a84[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var moment=require('moment');var BPromise=require(_0x42a8('0x2'));var rs=require(_0x42a8('0x3'));var fs=require('fs');var Redis=require(_0x42a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42a8('0x5'));var logger=require('../../config/logger')(_0x42a8('0x6'));var config=require(_0x42a8('0x7'));var jayson=require(_0x42a8('0x8'));var client=jayson['client'][_0x42a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b17b7,_0x434dc9,_0x10c2fe){return new BPromise(function(_0x4ff8e0,_0x2aa872){return client[_0x42a8('0xa')](_0x4b17b7,_0x10c2fe)['then'](function(_0x40062e){logger[_0x42a8('0xb')]('Automation,\x20%s,\x20%s',_0x434dc9,_0x42a8('0xc'));logger[_0x42a8('0xd')](_0x42a8('0xe'),_0x434dc9,'request\x20sent',JSON['stringify'](_0x40062e));if(_0x40062e[_0x42a8('0xf')]){if(_0x40062e['error'][_0x42a8('0x10')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x2aa872(_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);}logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x4ff8e0(_0x40062e['error']['message']);}else{logger[_0x42a8('0xb')](_0x42a8('0x12'),_0x434dc9,_0x42a8('0xc'));_0x4ff8e0(_0x40062e['result'][_0x42a8('0x11')]);}})[_0x42a8('0x13')](function(_0x3c0d41){logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x3c0d41);_0x2aa872(_0x3c0d41);});});} \ No newline at end of file +var _0xe2cf=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x887b7,_0x280f32){var _0xd7c201=function(_0x21e108){while(--_0x21e108){_0x887b7['push'](_0x887b7['shift']());}};_0xd7c201(++_0x280f32);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xe2cf[_0x574617];return _0x29de90;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var moment=require('moment');var BPromise=require(_0xfe2c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe2c('0x2'));var db=require(_0xfe2c('0x3'))['db'];var utils=require(_0xfe2c('0x4'));var logger=require(_0xfe2c('0x5'))('rpc');var config=require(_0xfe2c('0x6'));var jayson=require(_0xfe2c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0b97,_0x417bc4,_0x5e5b46){return new BPromise(function(_0x485a24,_0x30aafe){return client[_0xfe2c('0x8')](_0x4e0b97,_0x5e5b46)[_0xfe2c('0x9')](function(_0x562414){logger['info'](_0xfe2c('0xa'),_0x417bc4,_0xfe2c('0xb'));logger['debug'](_0xfe2c('0xc'),_0x417bc4,_0xfe2c('0xb'),JSON[_0xfe2c('0xd')](_0x562414));if(_0x562414[_0xfe2c('0xe')]){if(_0x562414[_0xfe2c('0xe')][_0xfe2c('0xf')]===0x1f4){logger[_0xfe2c('0xe')]('Automation,\x20%s,\x20%s',_0x417bc4,_0x562414['error']['message']);return _0x30aafe(_0x562414['error'][_0xfe2c('0x10')]);}logger['error']('Automation,\x20%s,\x20%s',_0x417bc4,_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);return _0x485a24(_0x562414[_0xfe2c('0xe')][_0xfe2c('0x10')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x417bc4,_0xfe2c('0xb'));_0x485a24(_0x562414[_0xfe2c('0x11')][_0xfe2c('0x10')]);}})[_0xfe2c('0x12')](function(_0x565f40){logger[_0xfe2c('0xe')](_0xfe2c('0xa'),_0x417bc4,_0x565f40);_0x30aafe(_0x565f40);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 790bf0b..fe36652 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 _0x5f10=['/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','show'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0x5f10,0xd5));var _0x05f1=function(_0x3a9468,_0x2b6266){_0x3a9468=_0x3a9468-0x0;var _0x1d2345=_0x5f10[_0x3a9468];return _0x1d2345;};'use strict';var multer=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x05f1('0x2')]();var fs_extra=require(_0x05f1('0x3'));var auth=require(_0x05f1('0x4'));var interaction=require(_0x05f1('0x5'));var config=require(_0x05f1('0x6'));var controller=require(_0x05f1('0x7'));router['get']('/',auth[_0x05f1('0x8')](),controller[_0x05f1('0x9')]);router[_0x05f1('0xa')]('/:id',auth[_0x05f1('0x8')](),controller[_0x05f1('0xb')]);router[_0x05f1('0xa')](_0x05f1('0xc'),auth[_0x05f1('0x8')](),controller[_0x05f1('0xd')]);router['get'](_0x05f1('0xe'),auth[_0x05f1('0x8')](),controller[_0x05f1('0xf')]);router[_0x05f1('0x10')]('/',auth[_0x05f1('0x8')](),controller[_0x05f1('0x11')]);router['post'](_0x05f1('0xc'),auth['isAuthenticated'](),controller[_0x05f1('0x12')]);router[_0x05f1('0x10')](_0x05f1('0xe'),auth[_0x05f1('0x8')](),controller[_0x05f1('0x13')]);router[_0x05f1('0x14')](_0x05f1('0x15'),auth[_0x05f1('0x8')](),controller[_0x05f1('0x16')]);router['delete'](_0x05f1('0x15'),auth[_0x05f1('0x8')](),controller[_0x05f1('0x17')]);module[_0x05f1('0x18')]=router; \ No newline at end of file +var _0x5735=['/:id/actions','post','/:id/conditions','addConditions','addActions','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','getConditions'];(function(_0x26b9fc,_0x17bafd){var _0x89ce9=function(_0x172e42){while(--_0x172e42){_0x26b9fc['push'](_0x26b9fc['shift']());}};_0x89ce9(++_0x17bafd);}(_0x5735,0x16a));var _0x5573=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0x5735[_0x4fd82a];return _0x21d2a8;};'use strict';var multer=require(_0x5573('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5573('0x1'));var express=require(_0x5573('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5573('0x3'));var config=require(_0x5573('0x4'));var controller=require(_0x5573('0x5'));router[_0x5573('0x6')]('/',auth['isAuthenticated'](),controller[_0x5573('0x7')]);router[_0x5573('0x6')](_0x5573('0x8'),auth[_0x5573('0x9')](),controller[_0x5573('0xa')]);router[_0x5573('0x6')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x5573('0xb')]);router[_0x5573('0x6')](_0x5573('0xc'),auth[_0x5573('0x9')](),controller['getActions']);router['post']('/',auth[_0x5573('0x9')](),controller['create']);router[_0x5573('0xd')](_0x5573('0xe'),auth[_0x5573('0x9')](),controller[_0x5573('0xf')]);router[_0x5573('0xd')](_0x5573('0xc'),auth[_0x5573('0x9')](),controller[_0x5573('0x10')]);router[_0x5573('0x11')](_0x5573('0x8'),auth['isAuthenticated'](),controller[_0x5573('0x12')]);router[_0x5573('0x13')]('/:id',auth[_0x5573('0x9')](),controller[_0x5573('0x14')]);module[_0x5573('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d26eca7..7ddb1e8 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 _0x58d2=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x5b9d62,_0x2313f4){var _0x30a6a9=function(_0x51ba61){while(--_0x51ba61){_0x5b9d62['push'](_0x5b9d62['shift']());}};_0x30a6a9(++_0x2313f4);}(_0x58d2,0x1aa));var _0x258d=function(_0x4f3de9,_0x1411ab){_0x4f3de9=_0x4f3de9-0x0;var _0x533c9b=_0x58d2[_0x4f3de9];return _0x533c9b;};'use strict';var Sequelize=require(_0x258d('0x0'));module[_0x258d('0x1')]={'name':{'type':Sequelize[_0x258d('0x2')],'unique':_0x258d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x258d('0x4')](_0x258d('0x5')),'allowNull':![],'defaultValue':_0x258d('0x5')},'description':{'type':Sequelize[_0x258d('0x2')]},'active':{'type':Sequelize[_0x258d('0x6')],'defaultValue':0x0,'comment':_0x258d('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x258d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x258d('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x258d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x258d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x258d('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x258d('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x258d('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x258d('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x258d('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)[_0x258d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x258d('0x10')},'dialTimezone':{'type':Sequelize[_0x258d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x258d('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x258d('0x11'),'never',_0x258d('0x12')),'defaultValue':_0x258d('0x11')},'dialAMDActive':{'type':Sequelize[_0x258d('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x258d('0xa')](0x9)[_0x258d('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x258d('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x258d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x258d('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x258d('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x258d('0xa')](0x9)[_0x258d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x258d('0xa')](0x9)[_0x258d('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x258d('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x258d('0xa')](0x9)[_0x258d('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x258d('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x258d('0xa')](0x5)[_0x258d('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x258d('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x258d('0xa')](0x9)[_0x258d('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x258d('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x258d('0x4')](_0x258d('0x19'),_0x258d('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x258d('0xa')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x258d('0x1b')},'dialCutDigit':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x258d('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)[_0x258d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x258d('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)[_0x258d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x258d('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x258d('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)[_0x258d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x258d('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x258d('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x258d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x258d('0x21')}}; \ No newline at end of file +var _0x40bc=['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','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x5da8e9,_0x3beb32){var _0x24a605=function(_0x284ab3){while(--_0x284ab3){_0x5da8e9['push'](_0x5da8e9['shift']());}};_0x24a605(++_0x3beb32);}(_0x40bc,0x10e));var _0xc40b=function(_0xab3a19,_0x273596){_0xab3a19=_0xab3a19-0x0;var _0x30540e=_0x40bc[_0xab3a19];return _0x30540e;};'use strict';var Sequelize=require(_0xc40b('0x0'));module[_0xc40b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc40b('0x2')](_0xc40b('0x3')),'allowNull':![],'defaultValue':_0xc40b('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc40b('0x4')},'limitCalls':{'type':Sequelize[_0xc40b('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc40b('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc40b('0x6')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x7')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'comment':_0xc40b('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc40b('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xc40b('0x2')]('always','never',_0xc40b('0xe')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc40b('0xf')],'defaultValue':0x0,'comment':_0xc40b('0x10')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc40b('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc40b('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc40b('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc40b('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc40b('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc40b('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc40b('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc40b('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc40b('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc40b('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc40b('0x5')](0x9)[_0xc40b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':_0xc40b('0x18')},'dialPrefix':{'type':Sequelize[_0xc40b('0x6')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc40b('0x19')},'dialCutDigit':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc40b('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc40b('0x5')](0x3)[_0xc40b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc40b('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc40b('0x5')](0x5)[_0xc40b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc40b('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b8f7b80..36bce73 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 _0xab54=['UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','map','Campaign','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user'];(function(_0x29dc78,_0x6305e5){var _0x24e5d8=function(_0x24fc44){while(--_0x24fc44){_0x29dc78['push'](_0x29dc78['shift']());}};_0x24e5d8(++_0x6305e5);}(_0xab54,0x1cd));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ab5('0x0'));var zipdir=require(_0x4ab5('0x1'));var jsonpatch=require(_0x4ab5('0x2'));var rp=require(_0x4ab5('0x3'));var moment=require(_0x4ab5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ab5('0x5'));var path=require(_0x4ab5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4ab5('0x7'));var fs=require('fs');var fs_extra=require(_0x4ab5('0x8'));var _=require(_0x4ab5('0x9'));var squel=require(_0x4ab5('0xa'));var crypto=require(_0x4ab5('0xb'));var jsforce=require(_0x4ab5('0xc'));var deskjs=require(_0x4ab5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4ab5('0xe'));var Papa=require('papaparse');var Redis=require(_0x4ab5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4ab5('0x10'));var as=require(_0x4ab5('0x11'));var hardwareService=require(_0x4ab5('0x12'));var logger=require(_0x4ab5('0x13'))(_0x4ab5('0x14'));var utils=require(_0x4ab5('0x15'));var config=require(_0x4ab5('0x16'));var licenseUtil=require(_0x4ab5('0x17'));var db=require(_0x4ab5('0x18'))['db'];function respondWithStatusCode(_0x2eec42,_0x3f6955){_0x3f6955=_0x3f6955||0xcc;return function(_0x312476){if(_0x312476){return _0x2eec42[_0x4ab5('0x19')](_0x3f6955);}return _0x2eec42[_0x4ab5('0x1a')](_0x3f6955)['end']();};}function respondWithResult(_0x4d501f,_0x4dc111){_0x4dc111=_0x4dc111||0xc8;return function(_0x1f4dae){if(_0x1f4dae){return _0x4d501f[_0x4ab5('0x1a')](_0x4dc111)[_0x4ab5('0x1b')](_0x1f4dae);}};}function respondWithFilteredResult(_0x3439c0,_0x45683a){return function(_0x5a856a){if(_0x5a856a){var _0xe6facd=typeof _0x45683a[_0x4ab5('0x1c')]===_0x4ab5('0x1d')&&typeof _0x45683a['limit']===_0x4ab5('0x1d');var _0x12db9b=_0x5a856a['count'];var _0x10eca7=_0xe6facd?0x0:_0x45683a['offset'];var _0x5bf7c7=_0xe6facd?_0x5a856a[_0x4ab5('0x1e')]:_0x45683a[_0x4ab5('0x1c')]+_0x45683a[_0x4ab5('0x1f')];var _0x5ec07b;if(_0x5bf7c7>=_0x12db9b){_0x5bf7c7=_0x12db9b;_0x5ec07b=0xc8;}else{_0x5ec07b=0xce;}_0x3439c0[_0x4ab5('0x1a')](_0x5ec07b);return _0x3439c0[_0x4ab5('0x20')](_0x4ab5('0x21'),_0x10eca7+'-'+_0x5bf7c7+'/'+_0x12db9b)[_0x4ab5('0x1b')](_0x5a856a);}return null;};}function patchUpdates(_0x3f2186){return function(_0x3c2342){try{jsonpatch['apply'](_0x3c2342,_0x3f2186,!![]);}catch(_0x45e80e){return BPromise[_0x4ab5('0x22')](_0x45e80e);}return _0x3c2342[_0x4ab5('0x23')]();};}function saveUpdates(_0x208cb1,_0x2af1f2){return function(_0x2b9c03){if(_0x2b9c03){return _0x2b9c03[_0x4ab5('0x24')](_0x208cb1)[_0x4ab5('0x25')](function(_0x584438){return _0x584438;});}return null;};}function removeEntity(_0x45f7d5,_0x30a04d){return function(_0x2f382a){if(_0x2f382a){return _0x2f382a[_0x4ab5('0x26')]()['then'](function(){var _0xd5e953=_0x2f382a[_0x4ab5('0x27')]({'plain':!![]});var _0x24f0c4=_0x4ab5('0x28');return db[_0x4ab5('0x29')][_0x4ab5('0x26')]({'where':{'type':_0x24f0c4,'resourceId':_0xd5e953['id']}})[_0x4ab5('0x25')](function(){return _0x2f382a;});})['then'](function(){_0x45f7d5[_0x4ab5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa4a2fc,_0x128fd5){return function(_0x358a0f){if(!_0x358a0f){_0xa4a2fc['sendStatus'](0x194);}return _0x358a0f;};}function handleError(_0x5316e8,_0x3643c2){_0x3643c2=_0x3643c2||0x1f4;return function(_0x1515c0){logger['error'](_0x1515c0[_0x4ab5('0x2a')]);if(_0x1515c0[_0x4ab5('0x2b')]){delete _0x1515c0[_0x4ab5('0x2b')];}_0x5316e8['status'](_0x3643c2)[_0x4ab5('0x2c')](_0x1515c0);};}exports['index']=function(_0x1aaf66,_0x39ac55){var _0x49e654={},_0x4cd248={},_0x8c7368={'count':0x0,'rows':[]};var _0x2bb3d4=_[_0x4ab5('0x2d')](db[_0x4ab5('0x2e')]['rawAttributes'],function(_0x5c046c){return{'name':_0x5c046c['fieldName'],'type':_0x5c046c[_0x4ab5('0x2f')][_0x4ab5('0x30')]};});_0x4cd248['model']=_[_0x4ab5('0x2d')](_0x2bb3d4,_0x4ab5('0x2b'));_0x4cd248['query']=_[_0x4ab5('0x31')](_0x1aaf66[_0x4ab5('0x32')]);_0x4cd248[_0x4ab5('0x33')]=_[_0x4ab5('0x34')](_0x4cd248[_0x4ab5('0x35')],_0x4cd248[_0x4ab5('0x32')]);_0x49e654[_0x4ab5('0x36')]=_['intersection'](_0x4cd248[_0x4ab5('0x35')],qs['fields'](_0x1aaf66[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x49e654[_0x4ab5('0x36')]=_0x49e654[_0x4ab5('0x36')][_0x4ab5('0x38')]?_0x49e654['attributes']:_0x4cd248[_0x4ab5('0x35')];if(!_0x1aaf66[_0x4ab5('0x32')][_0x4ab5('0x39')](_0x4ab5('0x3a'))){_0x49e654[_0x4ab5('0x1f')]=qs[_0x4ab5('0x1f')](_0x1aaf66[_0x4ab5('0x32')][_0x4ab5('0x1f')]);_0x49e654[_0x4ab5('0x1c')]=qs['offset'](_0x1aaf66[_0x4ab5('0x32')][_0x4ab5('0x1c')]);}_0x49e654[_0x4ab5('0x3b')]=qs[_0x4ab5('0x3c')](_0x1aaf66[_0x4ab5('0x32')]['sort']);_0x49e654[_0x4ab5('0x3d')]=qs[_0x4ab5('0x33')](_[_0x4ab5('0x3e')](_0x1aaf66[_0x4ab5('0x32')],_0x4cd248['filters']),_0x2bb3d4);if(_0x1aaf66[_0x4ab5('0x32')][_0x4ab5('0x3f')]){_0x49e654[_0x4ab5('0x3d')]=_['merge'](_0x49e654['where'],{'$or':_[_0x4ab5('0x2d')](_0x2bb3d4,function(_0x417fc4){if(_0x417fc4[_0x4ab5('0x2f')]!==_0x4ab5('0x40')){var _0xd585a8={};_0xd585a8[_0x417fc4[_0x4ab5('0x2b')]]={'$like':'%'+_0x1aaf66[_0x4ab5('0x32')][_0x4ab5('0x3f')]+'%'};return _0xd585a8;}})});}_0x49e654=_[_0x4ab5('0x41')]({},_0x49e654,_0x1aaf66[_0x4ab5('0x42')]);var _0x2af510={'where':_0x49e654[_0x4ab5('0x3d')]};return db[_0x4ab5('0x2e')][_0x4ab5('0x1e')](_0x2af510)[_0x4ab5('0x25')](function(_0x54b908){_0x8c7368['count']=_0x54b908;if(_0x1aaf66['query']['includeAll']){_0x49e654[_0x4ab5('0x43')]=[{'all':!![]}];}return db[_0x4ab5('0x2e')][_0x4ab5('0x44')](_0x49e654);})[_0x4ab5('0x25')](function(_0xa92f90){_0x8c7368[_0x4ab5('0x45')]=_0xa92f90;return _0x8c7368;})[_0x4ab5('0x25')](respondWithFilteredResult(_0x39ac55,_0x49e654))[_0x4ab5('0x46')](handleError(_0x39ac55,null));};exports[_0x4ab5('0x47')]=function(_0x30f7f8,_0x12777b){var _0x1ffaea={'raw':![],'where':{'id':_0x30f7f8[_0x4ab5('0x48')]['id']}},_0x8ea4ae={};_0x8ea4ae[_0x4ab5('0x35')]=_[_0x4ab5('0x31')](db[_0x4ab5('0x2e')][_0x4ab5('0x49')]);_0x8ea4ae[_0x4ab5('0x32')]=_[_0x4ab5('0x31')](_0x30f7f8[_0x4ab5('0x32')]);_0x8ea4ae[_0x4ab5('0x33')]=_[_0x4ab5('0x34')](_0x8ea4ae[_0x4ab5('0x35')],_0x8ea4ae['query']);_0x1ffaea[_0x4ab5('0x36')]=_[_0x4ab5('0x34')](_0x8ea4ae[_0x4ab5('0x35')],qs['fields'](_0x30f7f8[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x1ffaea['attributes']=_0x1ffaea[_0x4ab5('0x36')][_0x4ab5('0x38')]?_0x1ffaea['attributes']:_0x8ea4ae[_0x4ab5('0x35')];if(_0x30f7f8[_0x4ab5('0x32')][_0x4ab5('0x4a')]){_0x1ffaea['include']=[{'all':!![]}];}_0x1ffaea=_[_0x4ab5('0x41')]({},_0x1ffaea,_0x30f7f8['options']);return db[_0x4ab5('0x2e')][_0x4ab5('0x4b')](_0x1ffaea)[_0x4ab5('0x25')](handleEntityNotFound(_0x12777b,null))[_0x4ab5('0x25')](respondWithResult(_0x12777b,null))[_0x4ab5('0x46')](handleError(_0x12777b,null));};exports[_0x4ab5('0x4c')]=function(_0x47f151,_0x2ce568){return db[_0x4ab5('0x2e')][_0x4ab5('0x4c')](_0x47f151[_0x4ab5('0x4d')],{})[_0x4ab5('0x25')](function(_0x19e92d){var _0x15c8cb=_0x47f151[_0x4ab5('0x4e')]['get']({'plain':!![]});if(!_0x15c8cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c8cb['role']==='user'){var _0x2a3584=_0x19e92d['get']({'plain':!![]});var _0xf8597=_0x4ab5('0x28');return db[_0x4ab5('0x4f')][_0x4ab5('0x4b')]({'where':{'name':_0xf8597,'userProfileId':_0x15c8cb[_0x4ab5('0x50')]},'raw':!![]})[_0x4ab5('0x25')](function(_0x152ff0){if(_0x152ff0&&_0x152ff0[_0x4ab5('0x51')]===0x0){return db[_0x4ab5('0x29')][_0x4ab5('0x4c')]({'name':_0x2a3584[_0x4ab5('0x2b')],'resourceId':_0x2a3584['id'],'type':_0x152ff0['name'],'sectionId':_0x152ff0['id']},{})[_0x4ab5('0x25')](function(){return _0x19e92d;});}else{return _0x19e92d;}})[_0x4ab5('0x46')](function(_0x4a2112){logger[_0x4ab5('0x52')](_0x4ab5('0x53'),_0x4a2112);throw _0x4a2112;});}return _0x19e92d;})[_0x4ab5('0x25')](respondWithResult(_0x2ce568,0xc9))[_0x4ab5('0x46')](handleError(_0x2ce568,null));};exports[_0x4ab5('0x54')]=function(_0x3af775,_0x448f32){var _0x36134c={'where':{'id':_0x3af775[_0x4ab5('0x48')]['id']}},_0x2265e0={};_0x2265e0[_0x4ab5('0x35')]=_[_0x4ab5('0x31')](db['Campaign'][_0x4ab5('0x49')]);_0x36134c[_0x4ab5('0x36')]=_['intersection'](_0x2265e0['model'],qs[_0x4ab5('0x37')](_0x3af775[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x36134c['attributes']=_0x36134c[_0x4ab5('0x36')][_0x4ab5('0x38')]?_0x36134c[_0x4ab5('0x36')]:_0x2265e0['model'];if(_0x3af775['query'][_0x4ab5('0x4a')]){_0x36134c['include']=[{'all':!![]}];}_0x36134c=_[_0x4ab5('0x41')]({},_0x36134c,_0x3af775['options']);return db[_0x4ab5('0x2e')]['find'](_0x36134c)['then'](handleEntityNotFound(_0x448f32,null))[_0x4ab5('0x25')](function(_0x103f8b){if(_0x103f8b){var _0x2b96d8=_0x103f8b[_0x4ab5('0x27')]({'plain':!![]});_0x2b96d8=qs[_0x4ab5('0x55')](_0x2b96d8,['id','createdAt',_0x4ab5('0x56')]);_0x3af775[_0x4ab5('0x4d')]=_[_0x4ab5('0x55')](_0x3af775['body'],['id',_0x4ab5('0x57'),_0x4ab5('0x56')]);return db[_0x4ab5('0x2e')][_0x4ab5('0x4c')](_[_0x4ab5('0x41')](_0x2b96d8,_0x3af775[_0x4ab5('0x4d')]),{'include':_0x3af775[_0x4ab5('0x32')][_0x4ab5('0x4a')]?[{'all':!![]}]:undefined})[_0x4ab5('0x25')](function(_0x44b616){var _0x3890ba=_0x3af775['user']['get']({'plain':!![]});if(!_0x3890ba)throw new Error(_0x4ab5('0x58'));if(_0x3890ba[_0x4ab5('0x59')]===_0x4ab5('0x4e')){var _0x3b0efd=_0x44b616[_0x4ab5('0x27')]({'plain':!![]});var _0x5b06ec='IvrCampaigns';return db[_0x4ab5('0x4f')][_0x4ab5('0x4b')]({'where':{'name':_0x5b06ec,'userProfileId':_0x3890ba[_0x4ab5('0x50')]},'raw':!![]})[_0x4ab5('0x25')](function(_0x1a8bf8){if(_0x1a8bf8&&_0x1a8bf8[_0x4ab5('0x51')]===0x0){return db['UserProfileResource'][_0x4ab5('0x4c')]({'name':_0x3b0efd['name'],'resourceId':_0x3b0efd['id'],'type':_0x1a8bf8['name'],'sectionId':_0x1a8bf8['id']},{})[_0x4ab5('0x25')](function(){return _0x44b616;});}else{return _0x44b616;}})[_0x4ab5('0x46')](function(_0x51f3a5){logger['error'](_0x4ab5('0x53'),_0x51f3a5);throw _0x51f3a5;});}return _0x44b616;});}})[_0x4ab5('0x25')](respondWithResult(_0x448f32,0xc9))[_0x4ab5('0x46')](handleError(_0x448f32,null));};exports['update']=function(_0x4edd88,_0x19c7d2){if(_0x4edd88[_0x4ab5('0x4d')]['id']){delete _0x4edd88[_0x4ab5('0x4d')]['id'];}return db['Campaign'][_0x4ab5('0x4b')]({'where':{'id':_0x4edd88[_0x4ab5('0x48')]['id']}})['then'](handleEntityNotFound(_0x19c7d2,null))[_0x4ab5('0x25')](saveUpdates(_0x4edd88[_0x4ab5('0x4d')],null))[_0x4ab5('0x25')](respondWithResult(_0x19c7d2,null))[_0x4ab5('0x46')](handleError(_0x19c7d2,null));};exports['destroy']=function(_0x5d2f97,_0x1f8a14){return db[_0x4ab5('0x2e')]['find']({'where':{'id':_0x5d2f97[_0x4ab5('0x48')]['id']}})[_0x4ab5('0x25')](handleEntityNotFound(_0x1f8a14,null))[_0x4ab5('0x25')](removeEntity(_0x1f8a14,null))['catch'](handleError(_0x1f8a14,null));};exports[_0x4ab5('0x5a')]=function(_0x195873,_0x1a0287,_0x48b1ce){var _0x11087c={'raw':!![],'where':{}};var _0x46830b={};var _0x4fdd30={'count':0x0,'rows':[]};return db[_0x4ab5('0x2e')][_0x4ab5('0x5b')]({'where':{'id':_0x195873['params']['id']}})[_0x4ab5('0x25')](handleEntityNotFound(_0x1a0287,null))[_0x4ab5('0x25')](function(_0x12424d){if(_0x12424d){_0x46830b['model']=_['keys'](db[_0x4ab5('0x5c')][_0x4ab5('0x49')]);_0x46830b[_0x4ab5('0x32')]=_['keys'](_0x195873[_0x4ab5('0x32')]);_0x46830b[_0x4ab5('0x33')]=_[_0x4ab5('0x34')](_0x46830b[_0x4ab5('0x35')],_0x46830b[_0x4ab5('0x32')]);_0x11087c['attributes']=_[_0x4ab5('0x34')](_0x46830b['model'],qs[_0x4ab5('0x37')](_0x195873[_0x4ab5('0x32')]['fields']));_0x11087c['attributes']=_0x11087c['attributes']['length']?_0x11087c[_0x4ab5('0x36')]:_0x46830b[_0x4ab5('0x35')];if(!_0x195873[_0x4ab5('0x32')][_0x4ab5('0x39')](_0x4ab5('0x3a'))){_0x11087c['limit']=qs[_0x4ab5('0x1f')](_0x195873['query'][_0x4ab5('0x1f')]);_0x11087c['offset']=qs[_0x4ab5('0x1c')](_0x195873['query'][_0x4ab5('0x1c')]);}_0x11087c[_0x4ab5('0x3b')]=qs[_0x4ab5('0x3c')](_0x195873[_0x4ab5('0x32')][_0x4ab5('0x3c')]);_0x11087c[_0x4ab5('0x3d')]=qs[_0x4ab5('0x33')](_[_0x4ab5('0x3e')](_0x195873['query'],_0x46830b[_0x4ab5('0x33')]));_0x11087c[_0x4ab5('0x3d')][_0x4ab5('0x5d')]=_0x12424d['id'];if(_0x195873[_0x4ab5('0x32')]['filter']){_0x11087c['where']=_[_0x4ab5('0x41')](_0x11087c['where'],{'$or':_['map'](_0x11087c[_0x4ab5('0x36')],function(_0x9e429d){var _0x413155={};_0x413155[_0x9e429d]={'$like':'%'+_0x195873[_0x4ab5('0x32')][_0x4ab5('0x3f')]+'%'};return _0x413155;})});}_0x11087c=_[_0x4ab5('0x41')]({},_0x11087c,_0x195873[_0x4ab5('0x42')]);return db[_0x4ab5('0x5c')]['count']({'where':_0x11087c[_0x4ab5('0x3d')]})[_0x4ab5('0x25')](function(_0x1eba61){_0x4fdd30[_0x4ab5('0x1e')]=_0x1eba61;if(_0x195873['query'][_0x4ab5('0x4a')]){_0x11087c['include']=[{'all':!![]}];}return db[_0x4ab5('0x5c')][_0x4ab5('0x44')](_0x11087c);})[_0x4ab5('0x25')](function(_0x45af2a){_0x4fdd30['rows']=_0x45af2a;return _0x4fdd30;});}})['then'](respondWithFilteredResult(_0x1a0287,_0x11087c))['catch'](handleError(_0x1a0287,null));};exports[_0x4ab5('0x5e')]=function(_0x1c2806,_0x2461cb,_0x56f27e){var _0x5f2c55={'raw':!![],'where':{}};var _0x68a0c7={};var _0x6cf9a2={'count':0x0,'rows':[]};return db['Campaign'][_0x4ab5('0x5b')]({'where':{'id':_0x1c2806[_0x4ab5('0x48')]['id']}})['then'](handleEntityNotFound(_0x2461cb,null))[_0x4ab5('0x25')](function(_0x3f381d){if(_0x3f381d){_0x68a0c7[_0x4ab5('0x35')]=_[_0x4ab5('0x31')](db[_0x4ab5('0x5f')][_0x4ab5('0x49')]);_0x68a0c7[_0x4ab5('0x32')]=_[_0x4ab5('0x31')](_0x1c2806[_0x4ab5('0x32')]);_0x68a0c7['filters']=_[_0x4ab5('0x34')](_0x68a0c7['model'],_0x68a0c7[_0x4ab5('0x32')]);_0x5f2c55[_0x4ab5('0x36')]=_['intersection'](_0x68a0c7['model'],qs[_0x4ab5('0x37')](_0x1c2806[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x5f2c55['attributes']=_0x5f2c55[_0x4ab5('0x36')][_0x4ab5('0x38')]?_0x5f2c55[_0x4ab5('0x36')]:_0x68a0c7[_0x4ab5('0x35')];if(!_0x1c2806[_0x4ab5('0x32')][_0x4ab5('0x39')](_0x4ab5('0x3a'))){_0x5f2c55[_0x4ab5('0x1f')]=qs[_0x4ab5('0x1f')](_0x1c2806[_0x4ab5('0x32')][_0x4ab5('0x1f')]);_0x5f2c55[_0x4ab5('0x1c')]=qs['offset'](_0x1c2806[_0x4ab5('0x32')][_0x4ab5('0x1c')]);}_0x5f2c55[_0x4ab5('0x3b')]=qs[_0x4ab5('0x3c')](_0x1c2806[_0x4ab5('0x32')]['sort']);_0x5f2c55[_0x4ab5('0x3d')]=qs[_0x4ab5('0x33')](_[_0x4ab5('0x3e')](_0x1c2806[_0x4ab5('0x32')],_0x68a0c7[_0x4ab5('0x33')]));_0x5f2c55[_0x4ab5('0x3d')][_0x4ab5('0x5d')]=_0x3f381d['id'];if(_0x1c2806[_0x4ab5('0x32')][_0x4ab5('0x3f')]){_0x5f2c55[_0x4ab5('0x3d')]=_[_0x4ab5('0x41')](_0x5f2c55['where'],{'$or':_[_0x4ab5('0x2d')](_0x5f2c55[_0x4ab5('0x36')],function(_0x169a28){var _0x4af48b={};_0x4af48b[_0x169a28]={'$like':'%'+_0x1c2806[_0x4ab5('0x32')][_0x4ab5('0x3f')]+'%'};return _0x4af48b;})});}_0x5f2c55=_[_0x4ab5('0x41')]({},_0x5f2c55,_0x1c2806[_0x4ab5('0x42')]);return db[_0x4ab5('0x5f')][_0x4ab5('0x1e')]({'where':_0x5f2c55[_0x4ab5('0x3d')]})[_0x4ab5('0x25')](function(_0x27211b){_0x6cf9a2[_0x4ab5('0x1e')]=_0x27211b;if(_0x1c2806[_0x4ab5('0x32')]['includeAll']){_0x5f2c55[_0x4ab5('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4ab5('0x44')](_0x5f2c55);})[_0x4ab5('0x25')](function(_0x55dbb4){_0x6cf9a2[_0x4ab5('0x45')]=_0x55dbb4;return _0x6cf9a2;});}})[_0x4ab5('0x25')](respondWithFilteredResult(_0x2461cb,_0x5f2c55))[_0x4ab5('0x46')](handleError(_0x2461cb,null));};exports['getHopperFinals']=function(_0x1cd9f2,_0x54e217,_0x2f4f44){var _0x33e6c9={'raw':!![],'where':{}};var _0x1080bc={};var _0x30f2ed={'count':0x0,'rows':[]};return db[_0x4ab5('0x2e')]['findOne']({'where':{'id':_0x1cd9f2[_0x4ab5('0x48')]['id']}})['then'](handleEntityNotFound(_0x54e217,null))[_0x4ab5('0x25')](function(_0x11997b){if(_0x11997b){_0x1080bc[_0x4ab5('0x35')]=_[_0x4ab5('0x31')](db['CmHopperFinal'][_0x4ab5('0x49')]);_0x1080bc[_0x4ab5('0x32')]=_[_0x4ab5('0x31')](_0x1cd9f2[_0x4ab5('0x32')]);_0x1080bc['filters']=_['intersection'](_0x1080bc['model'],_0x1080bc['query']);_0x33e6c9['attributes']=_['intersection'](_0x1080bc['model'],qs[_0x4ab5('0x37')](_0x1cd9f2[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x33e6c9[_0x4ab5('0x36')]=_0x33e6c9[_0x4ab5('0x36')][_0x4ab5('0x38')]?_0x33e6c9[_0x4ab5('0x36')]:_0x1080bc[_0x4ab5('0x35')];if(!_0x1cd9f2[_0x4ab5('0x32')][_0x4ab5('0x39')](_0x4ab5('0x3a'))){_0x33e6c9[_0x4ab5('0x1f')]=qs['limit'](_0x1cd9f2['query'][_0x4ab5('0x1f')]);_0x33e6c9[_0x4ab5('0x1c')]=qs[_0x4ab5('0x1c')](_0x1cd9f2['query']['offset']);}_0x33e6c9['order']=qs[_0x4ab5('0x3c')](_0x1cd9f2[_0x4ab5('0x32')][_0x4ab5('0x3c')]);_0x33e6c9[_0x4ab5('0x3d')]=qs[_0x4ab5('0x33')](_[_0x4ab5('0x3e')](_0x1cd9f2[_0x4ab5('0x32')],_0x1080bc[_0x4ab5('0x33')]));_0x33e6c9[_0x4ab5('0x3d')][_0x4ab5('0x5d')]=_0x11997b['id'];if(_0x1cd9f2[_0x4ab5('0x32')]['filter']){_0x33e6c9[_0x4ab5('0x3d')]=_[_0x4ab5('0x41')](_0x33e6c9[_0x4ab5('0x3d')],{'$or':_[_0x4ab5('0x2d')](_0x33e6c9['attributes'],function(_0x6769f1){var _0x1b716d={};_0x1b716d[_0x6769f1]={'$like':'%'+_0x1cd9f2[_0x4ab5('0x32')][_0x4ab5('0x3f')]+'%'};return _0x1b716d;})});}_0x33e6c9=_[_0x4ab5('0x41')]({},_0x33e6c9,_0x1cd9f2[_0x4ab5('0x42')]);return db['CmHopperFinal']['count']({'where':_0x33e6c9[_0x4ab5('0x3d')]})[_0x4ab5('0x25')](function(_0x122761){_0x30f2ed[_0x4ab5('0x1e')]=_0x122761;if(_0x1cd9f2[_0x4ab5('0x32')]['includeAll']){_0x33e6c9['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x4ab5('0x44')](_0x33e6c9);})['then'](function(_0x4b6513){_0x30f2ed[_0x4ab5('0x45')]=_0x4b6513;return _0x30f2ed;});}})['then'](respondWithFilteredResult(_0x54e217,_0x33e6c9))['catch'](handleError(_0x54e217,null));};exports[_0x4ab5('0x60')]=function(_0x2be5dc,_0x5746cc,_0x593414){var _0x46557c={'raw':!![],'where':{}};var _0x3b53a1={};var _0x3dae59={'count':0x0,'rows':[]};return db[_0x4ab5('0x2e')][_0x4ab5('0x5b')]({'where':{'id':_0x2be5dc[_0x4ab5('0x48')]['id']}})['then'](handleEntityNotFound(_0x5746cc,null))[_0x4ab5('0x25')](function(_0x3a29e6){if(_0x3a29e6){_0x3b53a1[_0x4ab5('0x35')]=_[_0x4ab5('0x31')](db[_0x4ab5('0x61')]['rawAttributes']);_0x3b53a1[_0x4ab5('0x32')]=_[_0x4ab5('0x31')](_0x2be5dc[_0x4ab5('0x32')]);_0x3b53a1[_0x4ab5('0x33')]=_[_0x4ab5('0x34')](_0x3b53a1['model'],_0x3b53a1[_0x4ab5('0x32')]);_0x46557c[_0x4ab5('0x36')]=_['intersection'](_0x3b53a1[_0x4ab5('0x35')],qs['fields'](_0x2be5dc[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x46557c[_0x4ab5('0x36')]=_0x46557c['attributes'][_0x4ab5('0x38')]?_0x46557c[_0x4ab5('0x36')]:_0x3b53a1[_0x4ab5('0x35')];if(!_0x2be5dc[_0x4ab5('0x32')][_0x4ab5('0x39')](_0x4ab5('0x3a'))){_0x46557c['limit']=qs[_0x4ab5('0x1f')](_0x2be5dc['query'][_0x4ab5('0x1f')]);_0x46557c[_0x4ab5('0x1c')]=qs[_0x4ab5('0x1c')](_0x2be5dc[_0x4ab5('0x32')][_0x4ab5('0x1c')]);}_0x46557c[_0x4ab5('0x3b')]=qs[_0x4ab5('0x3c')](_0x2be5dc[_0x4ab5('0x32')][_0x4ab5('0x3c')]);_0x46557c[_0x4ab5('0x3d')]=qs['filters'](_[_0x4ab5('0x3e')](_0x2be5dc[_0x4ab5('0x32')],_0x3b53a1[_0x4ab5('0x33')]));_0x46557c[_0x4ab5('0x3d')][_0x4ab5('0x5d')]=_0x3a29e6['id'];if(_0x2be5dc['query'][_0x4ab5('0x3f')]){_0x46557c[_0x4ab5('0x3d')]=_[_0x4ab5('0x41')](_0x46557c[_0x4ab5('0x3d')],{'$or':_[_0x4ab5('0x2d')](_0x46557c[_0x4ab5('0x36')],function(_0x1d06b8){var _0x2bf523={};_0x2bf523[_0x1d06b8]={'$like':'%'+_0x2be5dc[_0x4ab5('0x32')]['filter']+'%'};return _0x2bf523;})});}_0x46557c=_[_0x4ab5('0x41')]({},_0x46557c,_0x2be5dc[_0x4ab5('0x42')]);return db['CmHopperBlack'][_0x4ab5('0x1e')]({'where':_0x46557c[_0x4ab5('0x3d')]})[_0x4ab5('0x25')](function(_0x5b7fb5){_0x3dae59[_0x4ab5('0x1e')]=_0x5b7fb5;if(_0x2be5dc['query']['includeAll']){_0x46557c['include']=[{'all':!![]}];}return db[_0x4ab5('0x61')][_0x4ab5('0x44')](_0x46557c);})['then'](function(_0x41993d){_0x3dae59[_0x4ab5('0x45')]=_0x41993d;return _0x3dae59;});}})[_0x4ab5('0x25')](respondWithFilteredResult(_0x5746cc,_0x46557c))[_0x4ab5('0x46')](handleError(_0x5746cc,null));};exports[_0x4ab5('0x62')]=function(_0x22fc8,_0x18fbd1,_0x2b6823){var _0x415959={};var _0x4fa88e={};var _0x24c409;var _0x35a7b5;return db[_0x4ab5('0x2e')][_0x4ab5('0x5b')]({'where':{'id':_0x22fc8[_0x4ab5('0x48')]['id']}})['then'](handleEntityNotFound(_0x18fbd1,null))[_0x4ab5('0x25')](function(_0x3021fc){if(_0x3021fc){_0x24c409=_0x3021fc;_0x4fa88e['model']=_[_0x4ab5('0x31')](db[_0x4ab5('0x63')][_0x4ab5('0x49')]);_0x4fa88e[_0x4ab5('0x32')]=_[_0x4ab5('0x31')](_0x22fc8[_0x4ab5('0x32')]);_0x4fa88e['filters']=_[_0x4ab5('0x34')](_0x4fa88e['model'],_0x4fa88e[_0x4ab5('0x32')]);_0x415959[_0x4ab5('0x36')]=_[_0x4ab5('0x34')](_0x4fa88e['model'],qs[_0x4ab5('0x37')](_0x22fc8[_0x4ab5('0x32')][_0x4ab5('0x37')]));_0x415959[_0x4ab5('0x36')]=_0x415959[_0x4ab5('0x36')][_0x4ab5('0x38')]?_0x415959['attributes']:_0x4fa88e['model'];_0x415959['order']=qs[_0x4ab5('0x3c')](_0x22fc8[_0x4ab5('0x32')][_0x4ab5('0x3c')]);_0x415959[_0x4ab5('0x3d')]=qs[_0x4ab5('0x33')](_[_0x4ab5('0x3e')](_0x22fc8[_0x4ab5('0x32')],_0x4fa88e['filters']));if(_0x22fc8[_0x4ab5('0x32')][_0x4ab5('0x3f')]){_0x415959[_0x4ab5('0x3d')]=_[_0x4ab5('0x41')](_0x415959[_0x4ab5('0x3d')],{'$or':_['map'](_0x415959[_0x4ab5('0x36')],function(_0x519b27){var _0x68f3a0={};_0x68f3a0[_0x519b27]={'$like':'%'+_0x22fc8['query'][_0x4ab5('0x3f')]+'%'};return _0x68f3a0;})});}_0x415959=_['merge']({},_0x415959,_0x22fc8[_0x4ab5('0x42')]);return _0x24c409[_0x4ab5('0x62')](_0x415959);}})[_0x4ab5('0x25')](function(_0x25ab50){if(_0x25ab50){_0x35a7b5=_0x25ab50[_0x4ab5('0x38')];if(!_0x22fc8[_0x4ab5('0x32')][_0x4ab5('0x39')](_0x4ab5('0x3a'))){_0x415959[_0x4ab5('0x1f')]=qs[_0x4ab5('0x1f')](_0x22fc8[_0x4ab5('0x32')][_0x4ab5('0x1f')]);_0x415959['offset']=qs[_0x4ab5('0x1c')](_0x22fc8[_0x4ab5('0x32')][_0x4ab5('0x1c')]);}return _0x24c409['getLists'](_0x415959);}})[_0x4ab5('0x25')](function(_0x37823b){if(_0x37823b){return _0x37823b?{'count':_0x35a7b5,'rows':_0x37823b}:null;}})[_0x4ab5('0x25')](respondWithResult(_0x18fbd1,null))[_0x4ab5('0x46')](handleError(_0x18fbd1,null));};exports['addLists']=function(_0x4d2fa8,_0x22bb4d,_0xecd6c2){var _0x56c7d7,_0x211789;return db[_0x4ab5('0x2e')]['find']({'where':{'id':_0x4d2fa8['params']['id']}})[_0x4ab5('0x25')](handleEntityNotFound(_0x22bb4d,null))[_0x4ab5('0x25')](function(_0x19059a){if(_0x19059a){_0x211789=_0x19059a;return _0x19059a[_0x4ab5('0x64')](_0x4d2fa8[_0x4ab5('0x4d')]['ids'],_[_0x4ab5('0x55')](_0x4d2fa8[_0x4ab5('0x4d')],[_0x4ab5('0x65'),'id'])||{});}return null;})[_0x4ab5('0x66')](function(_0x32fc6e){var _0x539b93;_0x56c7d7=_0x32fc6e||[];var _0xc57afe=[];if(_0x32fc6e){for(var _0x4357a7=0x0;_0x4357a7<_0x32fc6e[_0x4ab5('0x38')];_0x4357a7+=0x1){var _0x4009a2=_0x32fc6e[_0x4357a7][_0x4ab5('0x27')]({'plain':!![]});_0x211789['dialCheckDuplicateType']=_0x4d2fa8[_0x4ab5('0x4d')][_0x4ab5('0x67')]?_0x4d2fa8['body'][_0x4ab5('0x67')]:_0x211789[_0x4ab5('0x67')];switch(_0x211789['dialCheckDuplicateType']){case'always':_0x539b93=squel['insert']()['into'](_0x4ab5('0x68'))[_0x4ab5('0x69')]([_0x4ab5('0x6a'),_0x4ab5('0x6b'),_0x4ab5('0x6c'),_0x4ab5('0x6d'),'CampaignId','createdAt',_0x4ab5('0x56')],squel['select']()[_0x4ab5('0x6e')](_0x4ab5('0x6a'),_0x4ab5('0x6a'))[_0x4ab5('0x6e')](_0x4ab5('0x6f'),_0x4ab5('0x6b'))[_0x4ab5('0x6e')]('id',_0x4ab5('0x6c'))[_0x4ab5('0x6e')](_0x4009a2[_0x4ab5('0x70')][_0x4ab5('0x71')](),_0x4ab5('0x6d'))[_0x4ab5('0x6e')](_0x4d2fa8[_0x4ab5('0x48')]['id'][_0x4ab5('0x71')](),_0x4ab5('0x5d'))['field']('NOW()',_0x4ab5('0x57'))[_0x4ab5('0x6e')]('NOW()',_0x4ab5('0x56'))['from'](_0x4ab5('0x72'))['where'](_0x4ab5('0x73'))['where'](_0x4ab5('0x74'),_0x4009a2[_0x4ab5('0x70')]['toString']())[_0x4ab5('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x4ab5('0x3d')](_0x4ab5('0x75'),squel[_0x4ab5('0x76')]()['field'](_0x4ab5('0x77'))[_0x4ab5('0x78')]('cm_hopper_final')[_0x4ab5('0x3d')](_0x4ab5('0x79'),_0x4d2fa8['params']['id'][_0x4ab5('0x71')]()))[_0x4ab5('0x3d')](_0x4ab5('0x75'),squel[_0x4ab5('0x76')]()[_0x4ab5('0x6e')](_0x4ab5('0x7a'))[_0x4ab5('0x78')](_0x4ab5('0x68'))['where'](_0x4ab5('0x79'),_0x4d2fa8[_0x4ab5('0x48')]['id'][_0x4ab5('0x71')]())))[_0x4ab5('0x71')]();break;case _0x4ab5('0x7b'):_0x539b93=squel[_0x4ab5('0x7c')]()[_0x4ab5('0x7d')]('cm_hopper')[_0x4ab5('0x69')]([_0x4ab5('0x6a'),_0x4ab5('0x6b'),'ContactId','ListId','CampaignId',_0x4ab5('0x57'),_0x4ab5('0x56')],squel[_0x4ab5('0x76')]()[_0x4ab5('0x6e')](_0x4ab5('0x6a'),'phone')['field'](_0x4ab5('0x6f'),_0x4ab5('0x6b'))[_0x4ab5('0x6e')]('id','ContactId')['field'](_0x4009a2[_0x4ab5('0x70')]['toString'](),_0x4ab5('0x6d'))[_0x4ab5('0x6e')](_0x4d2fa8[_0x4ab5('0x48')]['id'][_0x4ab5('0x71')](),_0x4ab5('0x5d'))[_0x4ab5('0x6e')](_0x4ab5('0x6f'),'createdAt')[_0x4ab5('0x6e')](_0x4ab5('0x6f'),'updatedAt')[_0x4ab5('0x78')](_0x4ab5('0x72'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x4ab5('0x74'),_0x4009a2['CmListId'][_0x4ab5('0x71')]())[_0x4ab5('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x4ab5('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4ab5('0x76')]()[_0x4ab5('0x6e')]('COALESCE(phone,\x27\x27)')[_0x4ab5('0x78')]('cm_hopper')[_0x4ab5('0x3d')](_0x4ab5('0x79'),_0x4d2fa8[_0x4ab5('0x48')]['id']['toString']())))[_0x4ab5('0x71')]();break;default:_0x539b93=squel[_0x4ab5('0x7c')]()['into']('cm_hopper')[_0x4ab5('0x69')]([_0x4ab5('0x6a'),_0x4ab5('0x6b'),_0x4ab5('0x6c'),'ListId',_0x4ab5('0x5d'),_0x4ab5('0x57'),'updatedAt'],squel['select']()['field']('phone',_0x4ab5('0x6a'))[_0x4ab5('0x6e')]('NOW()','scheduledAt')[_0x4ab5('0x6e')]('id','ContactId')[_0x4ab5('0x6e')](_0x4009a2[_0x4ab5('0x70')][_0x4ab5('0x71')](),_0x4ab5('0x6d'))[_0x4ab5('0x6e')](_0x4d2fa8['params']['id'][_0x4ab5('0x71')](),'CampaignId')[_0x4ab5('0x6e')](_0x4ab5('0x6f'),_0x4ab5('0x57'))[_0x4ab5('0x6e')](_0x4ab5('0x6f'),_0x4ab5('0x56'))[_0x4ab5('0x78')](_0x4ab5('0x72'))[_0x4ab5('0x3d')](_0x4ab5('0x73'))[_0x4ab5('0x3d')](_0x4ab5('0x74'),_0x4009a2['CmListId']['toString']())[_0x4ab5('0x3d')](_0x4ab5('0x7e')))[_0x4ab5('0x71')]();}_0xc57afe[_0x4ab5('0x7f')](db[_0x4ab5('0x80')][_0x4ab5('0x32')](_0x539b93));}return BPromise[_0x4ab5('0x81')](_0xc57afe);}})[_0x4ab5('0x25')](function(){return _0x56c7d7;})[_0x4ab5('0x25')](respondWithResult(_0x22bb4d,null))['catch'](handleError(_0x22bb4d,null));};exports['removeLists']=function(_0x1ebf23,_0x133f14,_0x56ca5f){return db[_0x4ab5('0x2e')][_0x4ab5('0x4b')]({'where':{'id':_0x1ebf23[_0x4ab5('0x48')]['id']}})[_0x4ab5('0x25')](handleEntityNotFound(_0x133f14,null))[_0x4ab5('0x25')](function(_0x546373){if(_0x546373){return _0x546373[_0x4ab5('0x82')](_0x1ebf23[_0x4ab5('0x32')][_0x4ab5('0x65')]);}})['then'](function(_0x22cfdd){if(_0x22cfdd){return db[_0x4ab5('0x5c')][_0x4ab5('0x26')]({'where':{'ListId':_0x1ebf23[_0x4ab5('0x32')][_0x4ab5('0x65')],'CampaignId':_0x1ebf23[_0x4ab5('0x48')]['id']}})[_0x4ab5('0x25')](function(){return _0x22cfdd;});}})[_0x4ab5('0x25')](respondWithStatusCode(_0x133f14,null))[_0x4ab5('0x46')](handleError(_0x133f14,null));};exports[_0x4ab5('0x83')]=function(_0x504237,_0x373449,_0x1326f9){var _0x2d0b1c={};var _0x2eaa51={};var _0x1038b9;var _0x46a2d4;return db[_0x4ab5('0x2e')][_0x4ab5('0x5b')]({'where':{'id':_0x504237[_0x4ab5('0x48')]['id']}})[_0x4ab5('0x25')](handleEntityNotFound(_0x373449,null))[_0x4ab5('0x25')](function(_0x7e87ca){if(_0x7e87ca){_0x1038b9=_0x7e87ca;_0x2eaa51[_0x4ab5('0x35')]=_['keys'](db['CmList'][_0x4ab5('0x49')]);_0x2eaa51[_0x4ab5('0x32')]=_['keys'](_0x504237[_0x4ab5('0x32')]);_0x2eaa51['filters']=_[_0x4ab5('0x34')](_0x2eaa51[_0x4ab5('0x35')],_0x2eaa51[_0x4ab5('0x32')]);_0x2d0b1c['attributes']=_[_0x4ab5('0x34')](_0x2eaa51['model'],qs[_0x4ab5('0x37')](_0x504237['query'][_0x4ab5('0x37')]));_0x2d0b1c[_0x4ab5('0x36')]=_0x2d0b1c['attributes']['length']?_0x2d0b1c[_0x4ab5('0x36')]:_0x2eaa51[_0x4ab5('0x35')];_0x2d0b1c[_0x4ab5('0x3b')]=qs[_0x4ab5('0x3c')](_0x504237[_0x4ab5('0x32')]['sort']);_0x2d0b1c[_0x4ab5('0x3d')]=qs[_0x4ab5('0x33')](_['pick'](_0x504237[_0x4ab5('0x32')],_0x2eaa51[_0x4ab5('0x33')]));if(_0x504237[_0x4ab5('0x32')]['filter']){_0x2d0b1c[_0x4ab5('0x3d')]=_['merge'](_0x2d0b1c['where'],{'$or':_['map'](_0x2d0b1c[_0x4ab5('0x36')],function(_0x506c45){var _0x5b179d={};_0x5b179d[_0x506c45]={'$like':'%'+_0x504237['query']['filter']+'%'};return _0x5b179d;})});}_0x2d0b1c=_[_0x4ab5('0x41')]({},_0x2d0b1c,_0x504237[_0x4ab5('0x42')]);return _0x1038b9[_0x4ab5('0x83')](_0x2d0b1c);}})['then'](function(_0x23cbe2){if(_0x23cbe2){_0x46a2d4=_0x23cbe2['length'];if(!_0x504237[_0x4ab5('0x32')]['hasOwnProperty']('nolimit')){_0x2d0b1c[_0x4ab5('0x1f')]=qs[_0x4ab5('0x1f')](_0x504237[_0x4ab5('0x32')][_0x4ab5('0x1f')]);_0x2d0b1c[_0x4ab5('0x1c')]=qs['offset'](_0x504237['query'][_0x4ab5('0x1c')]);}return _0x1038b9[_0x4ab5('0x83')](_0x2d0b1c);}})[_0x4ab5('0x25')](function(_0x50c84f){if(_0x50c84f){return _0x50c84f?{'count':_0x46a2d4,'rows':_0x50c84f}:null;}})[_0x4ab5('0x25')](respondWithResult(_0x373449,null))['catch'](handleError(_0x373449,null));};exports['addBlackLists']=function(_0x3e00e4,_0x1c8547,_0xb5c18b){var _0x3437,_0x2c0aaa;return db[_0x4ab5('0x2e')]['find']({'where':{'id':_0x3e00e4[_0x4ab5('0x48')]['id']}})[_0x4ab5('0x25')](handleEntityNotFound(_0x1c8547,null))['then'](function(_0x5d4294){if(_0x5d4294){_0x2c0aaa=_0x5d4294;return _0x5d4294[_0x4ab5('0x84')](_0x3e00e4[_0x4ab5('0x4d')]['ids'],_['omit'](_0x3e00e4[_0x4ab5('0x4d')],[_0x4ab5('0x65'),'id'])||{});}return null;})[_0x4ab5('0x66')](function(_0x35cb6a){var _0x1ff240;_0x3437=_0x35cb6a||[];var _0x5430ff=[];if(_0x35cb6a){for(var _0x1202c4=0x0;_0x1202c4<_0x35cb6a[_0x4ab5('0x38')];_0x1202c4+=0x1){var _0x53f1cd=_0x35cb6a[_0x1202c4]['get']({'plain':!![]});_0x1ff240=squel[_0x4ab5('0x7c')]()['into'](_0x4ab5('0x85'))['fromQuery'](['phone',_0x4ab5('0x6c'),_0x4ab5('0x6d'),_0x4ab5('0x5d'),_0x4ab5('0x57'),_0x4ab5('0x56')],squel[_0x4ab5('0x76')]()[_0x4ab5('0x6e')](_0x4ab5('0x6a'),'phone')[_0x4ab5('0x6e')]('id',_0x4ab5('0x6c'))[_0x4ab5('0x6e')](_0x53f1cd['CmListId'][_0x4ab5('0x71')](),_0x4ab5('0x6d'))['field'](_0x3e00e4[_0x4ab5('0x48')]['id'][_0x4ab5('0x71')](),_0x4ab5('0x5d'))[_0x4ab5('0x6e')]('NOW()','createdAt')[_0x4ab5('0x6e')](_0x4ab5('0x6f'),_0x4ab5('0x56'))[_0x4ab5('0x78')](_0x4ab5('0x72'))[_0x4ab5('0x3d')](_0x4ab5('0x73'))['where']('ListId\x20=\x20?',_0x53f1cd[_0x4ab5('0x70')][_0x4ab5('0x71')]())[_0x4ab5('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x5430ff[_0x4ab5('0x7f')](db['sequelize'][_0x4ab5('0x32')](_0x1ff240));}return BPromise['all'](_0x5430ff);}})['then'](function(){return _0x3437;})[_0x4ab5('0x25')](respondWithResult(_0x1c8547,null))[_0x4ab5('0x46')](handleError(_0x1c8547,null));};exports[_0x4ab5('0x86')]=function(_0xe231b,_0x3d370b,_0x18670b){return db[_0x4ab5('0x2e')][_0x4ab5('0x4b')]({'where':{'id':_0xe231b['params']['id']}})['then'](handleEntityNotFound(_0x3d370b,null))[_0x4ab5('0x25')](function(_0x59616e){if(_0x59616e){return _0x59616e[_0x4ab5('0x86')](_0xe231b[_0x4ab5('0x32')][_0x4ab5('0x65')]);}})[_0x4ab5('0x25')](function(_0x5de665){if(_0x5de665){return db['CmHopperBlack'][_0x4ab5('0x26')]({'where':{'ListId':_0xe231b[_0x4ab5('0x32')]['ids'],'CampaignId':_0xe231b['params']['id']}})['then'](function(){return _0x5de665;});}})[_0x4ab5('0x25')](respondWithStatusCode(_0x3d370b,null))[_0x4ab5('0x46')](handleError(_0x3d370b,null));}; \ No newline at end of file +var _0x1ddb=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','body','createdAt','getHoppers','findOne','CmHopper','sort','CmHopperHistory','getHopperFinals','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','cm_contacts','CmListId','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','toString','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','addBlackLists','omit','cm_hopper_black','deletedAt\x20IS\x20NULL','push','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','Campaign','findAll','rows','catch','params','options','find','create'];(function(_0x39cd99,_0x548c6d){var _0x534598=function(_0x1a48a6){while(--_0x1a48a6){_0x39cd99['push'](_0x39cd99['shift']());}};_0x534598(++_0x548c6d);}(_0x1ddb,0xc5));var _0xb1dd=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0x1ddb[_0x5c4444];return _0x20d93d;};'use strict';var emlformat=require(_0xb1dd('0x0'));var rimraf=require(_0xb1dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1dd('0x2'));var rp=require('request-promise');var moment=require(_0xb1dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb1dd('0x4'));var util=require(_0xb1dd('0x5'));var path=require(_0xb1dd('0x6'));var sox=require(_0xb1dd('0x7'));var csv=require('to-csv');var ejs=require(_0xb1dd('0x8'));var fs=require('fs');var fs_extra=require(_0xb1dd('0x9'));var _=require(_0xb1dd('0xa'));var squel=require(_0xb1dd('0xb'));var crypto=require(_0xb1dd('0xc'));var jsforce=require(_0xb1dd('0xd'));var deskjs=require(_0xb1dd('0xe'));var toCsv=require(_0xb1dd('0xf'));var querystring=require(_0xb1dd('0x10'));var Papa=require(_0xb1dd('0x11'));var Redis=require('ioredis');var authService=require(_0xb1dd('0x12'));var qs=require(_0xb1dd('0x13'));var as=require(_0xb1dd('0x14'));var hardwareService=require(_0xb1dd('0x15'));var logger=require(_0xb1dd('0x16'))('api');var utils=require(_0xb1dd('0x17'));var config=require(_0xb1dd('0x18'));var licenseUtil=require(_0xb1dd('0x19'));var db=require(_0xb1dd('0x1a'))['db'];function respondWithStatusCode(_0x250d93,_0x22f682){_0x22f682=_0x22f682||0xcc;return function(_0x25b7a4){if(_0x25b7a4){return _0x250d93[_0xb1dd('0x1b')](_0x22f682);}return _0x250d93[_0xb1dd('0x1c')](_0x22f682)['end']();};}function respondWithResult(_0x4349fe,_0x2e99b9){_0x2e99b9=_0x2e99b9||0xc8;return function(_0x2a5a8d){if(_0x2a5a8d){return _0x4349fe[_0xb1dd('0x1c')](_0x2e99b9)[_0xb1dd('0x1d')](_0x2a5a8d);}};}function respondWithFilteredResult(_0x5f2481,_0x183c66){return function(_0x231b71){if(_0x231b71){var _0x2027c1=typeof _0x183c66[_0xb1dd('0x1e')]===_0xb1dd('0x1f')&&typeof _0x183c66['limit']===_0xb1dd('0x1f');var _0x17564f=_0x231b71[_0xb1dd('0x20')];var _0x595aa1=_0x2027c1?0x0:_0x183c66[_0xb1dd('0x1e')];var _0x5872a0=_0x2027c1?_0x231b71[_0xb1dd('0x20')]:_0x183c66['offset']+_0x183c66[_0xb1dd('0x21')];var _0x235109;if(_0x5872a0>=_0x17564f){_0x5872a0=_0x17564f;_0x235109=0xc8;}else{_0x235109=0xce;}_0x5f2481['status'](_0x235109);return _0x5f2481['set'](_0xb1dd('0x22'),_0x595aa1+'-'+_0x5872a0+'/'+_0x17564f)[_0xb1dd('0x1d')](_0x231b71);}return null;};}function patchUpdates(_0x5cedec){return function(_0x1e28c6){try{jsonpatch[_0xb1dd('0x23')](_0x1e28c6,_0x5cedec,!![]);}catch(_0x3bcd9e){return BPromise['reject'](_0x3bcd9e);}return _0x1e28c6[_0xb1dd('0x24')]();};}function saveUpdates(_0x5adcc3,_0x1bdc1c){return function(_0x22e1ee){if(_0x22e1ee){return _0x22e1ee[_0xb1dd('0x25')](_0x5adcc3)[_0xb1dd('0x26')](function(_0x3181f4){return _0x3181f4;});}return null;};}function removeEntity(_0x565d1b,_0x47bcba){return function(_0x3348fa){if(_0x3348fa){return _0x3348fa[_0xb1dd('0x27')]()[_0xb1dd('0x26')](function(){var _0x2c5086=_0x3348fa[_0xb1dd('0x28')]({'plain':!![]});var _0x5b9d6a=_0xb1dd('0x29');return db[_0xb1dd('0x2a')][_0xb1dd('0x27')]({'where':{'type':_0x5b9d6a,'resourceId':_0x2c5086['id']}})[_0xb1dd('0x26')](function(){return _0x3348fa;});})[_0xb1dd('0x26')](function(){_0x565d1b['status'](0xcc)[_0xb1dd('0x2b')]();});}};}function handleEntityNotFound(_0x19bfcf,_0x156554){return function(_0xef3c04){if(!_0xef3c04){_0x19bfcf['sendStatus'](0x194);}return _0xef3c04;};}function handleError(_0x28267c,_0x23d55d){_0x23d55d=_0x23d55d||0x1f4;return function(_0x7704d4){logger['error'](_0x7704d4[_0xb1dd('0x2c')]);if(_0x7704d4[_0xb1dd('0x2d')]){delete _0x7704d4[_0xb1dd('0x2d')];}_0x28267c[_0xb1dd('0x1c')](_0x23d55d)[_0xb1dd('0x2e')](_0x7704d4);};}exports['index']=function(_0x2e0fad,_0x249bbd){var _0x1c1457={},_0x4bf6f0={},_0x33d3dd={'count':0x0,'rows':[]};var _0x118fe1=_[_0xb1dd('0x2f')](db['Campaign'][_0xb1dd('0x30')],function(_0x20925f){return{'name':_0x20925f['fieldName'],'type':_0x20925f[_0xb1dd('0x31')][_0xb1dd('0x32')]};});_0x4bf6f0[_0xb1dd('0x33')]=_[_0xb1dd('0x2f')](_0x118fe1,'name');_0x4bf6f0[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x2e0fad['query']);_0x4bf6f0[_0xb1dd('0x36')]=_['intersection'](_0x4bf6f0[_0xb1dd('0x33')],_0x4bf6f0[_0xb1dd('0x34')]);_0x1c1457[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x4bf6f0[_0xb1dd('0x33')],qs[_0xb1dd('0x39')](_0x2e0fad['query'][_0xb1dd('0x39')]));_0x1c1457[_0xb1dd('0x37')]=_0x1c1457[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x1c1457[_0xb1dd('0x37')]:_0x4bf6f0[_0xb1dd('0x33')];if(!_0x2e0fad['query'][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x1c1457['limit']=qs['limit'](_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x1c1457[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x1c1457[_0xb1dd('0x3d')]=qs['sort'](_0x2e0fad[_0xb1dd('0x34')]['sort']);_0x1c1457[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x2e0fad['query'],_0x4bf6f0['filters']),_0x118fe1);if(_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x40')]){_0x1c1457[_0xb1dd('0x3e')]=_['merge'](_0x1c1457['where'],{'$or':_[_0xb1dd('0x2f')](_0x118fe1,function(_0x1e214a){if(_0x1e214a['type']!==_0xb1dd('0x41')){var _0x45ebd4={};_0x45ebd4[_0x1e214a['name']]={'$like':'%'+_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x45ebd4;}})});}_0x1c1457=_[_0xb1dd('0x42')]({},_0x1c1457,_0x2e0fad['options']);var _0xd36f93={'where':_0x1c1457[_0xb1dd('0x3e')]};return db['Campaign'][_0xb1dd('0x20')](_0xd36f93)['then'](function(_0x281434){_0x33d3dd[_0xb1dd('0x20')]=_0x281434;if(_0x2e0fad[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x1c1457[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x45')][_0xb1dd('0x46')](_0x1c1457);})['then'](function(_0x15f2ce){_0x33d3dd[_0xb1dd('0x47')]=_0x15f2ce;return _0x33d3dd;})[_0xb1dd('0x26')](respondWithFilteredResult(_0x249bbd,_0x1c1457))[_0xb1dd('0x48')](handleError(_0x249bbd,null));};exports['show']=function(_0x3e7e82,_0x458cc3){var _0x51ce60={'raw':![],'where':{'id':_0x3e7e82[_0xb1dd('0x49')]['id']}},_0x2787d1={};_0x2787d1[_0xb1dd('0x33')]=_['keys'](db[_0xb1dd('0x45')][_0xb1dd('0x30')]);_0x2787d1['query']=_['keys'](_0x3e7e82[_0xb1dd('0x34')]);_0x2787d1[_0xb1dd('0x36')]=_['intersection'](_0x2787d1[_0xb1dd('0x33')],_0x2787d1['query']);_0x51ce60[_0xb1dd('0x37')]=_['intersection'](_0x2787d1[_0xb1dd('0x33')],qs['fields'](_0x3e7e82[_0xb1dd('0x34')]['fields']));_0x51ce60[_0xb1dd('0x37')]=_0x51ce60['attributes'][_0xb1dd('0x3a')]?_0x51ce60[_0xb1dd('0x37')]:_0x2787d1[_0xb1dd('0x33')];if(_0x3e7e82[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x51ce60[_0xb1dd('0x44')]=[{'all':!![]}];}_0x51ce60=_[_0xb1dd('0x42')]({},_0x51ce60,_0x3e7e82[_0xb1dd('0x4a')]);return db[_0xb1dd('0x45')][_0xb1dd('0x4b')](_0x51ce60)[_0xb1dd('0x26')](handleEntityNotFound(_0x458cc3,null))[_0xb1dd('0x26')](respondWithResult(_0x458cc3,null))[_0xb1dd('0x48')](handleError(_0x458cc3,null));};exports[_0xb1dd('0x4c')]=function(_0x56a145,_0x3d83ee){return db['Campaign'][_0xb1dd('0x4c')](_0x56a145['body'],{})[_0xb1dd('0x26')](function(_0x45a8c8){var _0x304b90=_0x56a145['user'][_0xb1dd('0x28')]({'plain':!![]});if(!_0x304b90)throw new Error(_0xb1dd('0x4d'));if(_0x304b90['role']===_0xb1dd('0x4e')){var _0x5abff7=_0x45a8c8['get']({'plain':!![]});var _0x96e700='IvrCampaigns';return db[_0xb1dd('0x4f')][_0xb1dd('0x4b')]({'where':{'name':_0x96e700,'userProfileId':_0x304b90[_0xb1dd('0x50')]},'raw':!![]})[_0xb1dd('0x26')](function(_0x45b9a7){if(_0x45b9a7&&_0x45b9a7[_0xb1dd('0x51')]===0x0){return db[_0xb1dd('0x2a')][_0xb1dd('0x4c')]({'name':_0x5abff7[_0xb1dd('0x2d')],'resourceId':_0x5abff7['id'],'type':_0x45b9a7[_0xb1dd('0x2d')],'sectionId':_0x45b9a7['id']},{})[_0xb1dd('0x26')](function(){return _0x45a8c8;});}else{return _0x45a8c8;}})[_0xb1dd('0x48')](function(_0x1ae691){logger[_0xb1dd('0x52')](_0xb1dd('0x53'),_0x1ae691);throw _0x1ae691;});}return _0x45a8c8;})[_0xb1dd('0x26')](respondWithResult(_0x3d83ee,0xc9))[_0xb1dd('0x48')](handleError(_0x3d83ee,null));};exports[_0xb1dd('0x54')]=function(_0x4fd7a7,_0x187212){var _0x5251e4={'where':{'id':_0x4fd7a7['params']['id']}},_0x1ae166={};_0x1ae166[_0xb1dd('0x33')]=_[_0xb1dd('0x35')](db[_0xb1dd('0x45')]['rawAttributes']);_0x5251e4[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x1ae166[_0xb1dd('0x33')],qs['fields'](_0x4fd7a7['query']['fields']));_0x5251e4[_0xb1dd('0x37')]=_0x5251e4['attributes']['length']?_0x5251e4[_0xb1dd('0x37')]:_0x1ae166['model'];if(_0x4fd7a7[_0xb1dd('0x34')]['includeAll']){_0x5251e4[_0xb1dd('0x44')]=[{'all':!![]}];}_0x5251e4=_[_0xb1dd('0x42')]({},_0x5251e4,_0x4fd7a7[_0xb1dd('0x4a')]);return db['Campaign'][_0xb1dd('0x4b')](_0x5251e4)[_0xb1dd('0x26')](handleEntityNotFound(_0x187212,null))[_0xb1dd('0x26')](function(_0x207397){if(_0x207397){var _0xcff843=_0x207397[_0xb1dd('0x28')]({'plain':!![]});_0xcff843=qs['omit'](_0xcff843,['id','createdAt','updatedAt']);_0x4fd7a7[_0xb1dd('0x55')]=_['omit'](_0x4fd7a7[_0xb1dd('0x55')],['id',_0xb1dd('0x56'),'updatedAt']);return db['Campaign'][_0xb1dd('0x4c')](_[_0xb1dd('0x42')](_0xcff843,_0x4fd7a7[_0xb1dd('0x55')]),{'include':_0x4fd7a7[_0xb1dd('0x34')][_0xb1dd('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x59632b){var _0x38b8bf=_0x4fd7a7[_0xb1dd('0x4e')][_0xb1dd('0x28')]({'plain':!![]});if(!_0x38b8bf)throw new Error(_0xb1dd('0x4d'));if(_0x38b8bf['role']===_0xb1dd('0x4e')){var _0x108a2a=_0x59632b[_0xb1dd('0x28')]({'plain':!![]});var _0x54738b=_0xb1dd('0x29');return db['UserProfileSection'][_0xb1dd('0x4b')]({'where':{'name':_0x54738b,'userProfileId':_0x38b8bf['userProfileId']},'raw':!![]})[_0xb1dd('0x26')](function(_0x4398c0){if(_0x4398c0&&_0x4398c0[_0xb1dd('0x51')]===0x0){return db[_0xb1dd('0x2a')][_0xb1dd('0x4c')]({'name':_0x108a2a[_0xb1dd('0x2d')],'resourceId':_0x108a2a['id'],'type':_0x4398c0['name'],'sectionId':_0x4398c0['id']},{})[_0xb1dd('0x26')](function(){return _0x59632b;});}else{return _0x59632b;}})[_0xb1dd('0x48')](function(_0x545c7e){logger[_0xb1dd('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x545c7e);throw _0x545c7e;});}return _0x59632b;});}})['then'](respondWithResult(_0x187212,0xc9))['catch'](handleError(_0x187212,null));};exports[_0xb1dd('0x25')]=function(_0x56c359,_0x2b99b3){if(_0x56c359[_0xb1dd('0x55')]['id']){delete _0x56c359[_0xb1dd('0x55')]['id'];}return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0x56c359[_0xb1dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b99b3,null))[_0xb1dd('0x26')](saveUpdates(_0x56c359[_0xb1dd('0x55')],null))[_0xb1dd('0x26')](respondWithResult(_0x2b99b3,null))[_0xb1dd('0x48')](handleError(_0x2b99b3,null));};exports[_0xb1dd('0x27')]=function(_0xb3dc2f,_0x232995){return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0xb3dc2f['params']['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x232995,null))[_0xb1dd('0x26')](removeEntity(_0x232995,null))['catch'](handleError(_0x232995,null));};exports[_0xb1dd('0x57')]=function(_0x139053,_0x435a5f,_0x29a646){var _0x24d13a={'raw':!![],'where':{}};var _0x260eae={};var _0x3bd6c5={'count':0x0,'rows':[]};return db['Campaign'][_0xb1dd('0x58')]({'where':{'id':_0x139053[_0xb1dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x435a5f,null))[_0xb1dd('0x26')](function(_0x1a9c29){if(_0x1a9c29){_0x260eae['model']=_[_0xb1dd('0x35')](db[_0xb1dd('0x59')]['rawAttributes']);_0x260eae['query']=_[_0xb1dd('0x35')](_0x139053[_0xb1dd('0x34')]);_0x260eae[_0xb1dd('0x36')]=_[_0xb1dd('0x38')](_0x260eae['model'],_0x260eae[_0xb1dd('0x34')]);_0x24d13a[_0xb1dd('0x37')]=_['intersection'](_0x260eae['model'],qs[_0xb1dd('0x39')](_0x139053['query'][_0xb1dd('0x39')]));_0x24d13a[_0xb1dd('0x37')]=_0x24d13a[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x24d13a[_0xb1dd('0x37')]:_0x260eae[_0xb1dd('0x33')];if(!_0x139053[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x24d13a[_0xb1dd('0x21')]=qs[_0xb1dd('0x21')](_0x139053[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x24d13a[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x139053[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x24d13a['order']=qs[_0xb1dd('0x5a')](_0x139053[_0xb1dd('0x34')][_0xb1dd('0x5a')]);_0x24d13a[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_['pick'](_0x139053['query'],_0x260eae[_0xb1dd('0x36')]));_0x24d13a[_0xb1dd('0x3e')]['CampaignId']=_0x1a9c29['id'];if(_0x139053[_0xb1dd('0x34')][_0xb1dd('0x40')]){_0x24d13a[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x24d13a[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x24d13a[_0xb1dd('0x37')],function(_0x3393af){var _0x5e4276={};_0x5e4276[_0x3393af]={'$like':'%'+_0x139053[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x5e4276;})});}_0x24d13a=_[_0xb1dd('0x42')]({},_0x24d13a,_0x139053[_0xb1dd('0x4a')]);return db[_0xb1dd('0x59')][_0xb1dd('0x20')]({'where':_0x24d13a[_0xb1dd('0x3e')]})['then'](function(_0x2ad53d){_0x3bd6c5['count']=_0x2ad53d;if(_0x139053[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x24d13a[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x59')][_0xb1dd('0x46')](_0x24d13a);})[_0xb1dd('0x26')](function(_0xfb64c6){_0x3bd6c5[_0xb1dd('0x47')]=_0xfb64c6;return _0x3bd6c5;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x435a5f,_0x24d13a))[_0xb1dd('0x48')](handleError(_0x435a5f,null));};exports['getHopperHistories']=function(_0x12498d,_0x4920d3,_0x47c205){var _0x28145c={'raw':!![],'where':{}};var _0xa5145b={};var _0x139bdf={'count':0x0,'rows':[]};return db['Campaign'][_0xb1dd('0x58')]({'where':{'id':_0x12498d[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x4920d3,null))['then'](function(_0x402018){if(_0x402018){_0xa5145b['model']=_[_0xb1dd('0x35')](db[_0xb1dd('0x5b')][_0xb1dd('0x30')]);_0xa5145b[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x12498d[_0xb1dd('0x34')]);_0xa5145b[_0xb1dd('0x36')]=_['intersection'](_0xa5145b[_0xb1dd('0x33')],_0xa5145b['query']);_0x28145c[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0xa5145b['model'],qs['fields'](_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x39')]));_0x28145c[_0xb1dd('0x37')]=_0x28145c[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x28145c[_0xb1dd('0x37')]:_0xa5145b[_0xb1dd('0x33')];if(!_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x28145c[_0xb1dd('0x21')]=qs['limit'](_0x12498d[_0xb1dd('0x34')]['limit']);_0x28145c[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x28145c[_0xb1dd('0x3d')]=qs[_0xb1dd('0x5a')](_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x5a')]);_0x28145c['where']=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x12498d[_0xb1dd('0x34')],_0xa5145b[_0xb1dd('0x36')]));_0x28145c[_0xb1dd('0x3e')]['CampaignId']=_0x402018['id'];if(_0x12498d['query'][_0xb1dd('0x40')]){_0x28145c['where']=_[_0xb1dd('0x42')](_0x28145c[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x28145c[_0xb1dd('0x37')],function(_0x58cf8f){var _0x2e2ad4={};_0x2e2ad4[_0x58cf8f]={'$like':'%'+_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x2e2ad4;})});}_0x28145c=_[_0xb1dd('0x42')]({},_0x28145c,_0x12498d[_0xb1dd('0x4a')]);return db['CmHopperHistory'][_0xb1dd('0x20')]({'where':_0x28145c[_0xb1dd('0x3e')]})[_0xb1dd('0x26')](function(_0x451e78){_0x139bdf['count']=_0x451e78;if(_0x12498d[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x28145c[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x5b')][_0xb1dd('0x46')](_0x28145c);})[_0xb1dd('0x26')](function(_0x3d7c81){_0x139bdf[_0xb1dd('0x47')]=_0x3d7c81;return _0x139bdf;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x4920d3,_0x28145c))['catch'](handleError(_0x4920d3,null));};exports[_0xb1dd('0x5c')]=function(_0x39c217,_0x4e3f86,_0x5c1779){var _0x40a27c={'raw':!![],'where':{}};var _0x100c7c={};var _0x735b3a={'count':0x0,'rows':[]};return db[_0xb1dd('0x45')][_0xb1dd('0x58')]({'where':{'id':_0x39c217[_0xb1dd('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e3f86,null))[_0xb1dd('0x26')](function(_0x113b28){if(_0x113b28){_0x100c7c[_0xb1dd('0x33')]=_['keys'](db['CmHopperFinal'][_0xb1dd('0x30')]);_0x100c7c[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x39c217[_0xb1dd('0x34')]);_0x100c7c[_0xb1dd('0x36')]=_['intersection'](_0x100c7c[_0xb1dd('0x33')],_0x100c7c[_0xb1dd('0x34')]);_0x40a27c[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x100c7c['model'],qs[_0xb1dd('0x39')](_0x39c217[_0xb1dd('0x34')]['fields']));_0x40a27c['attributes']=_0x40a27c[_0xb1dd('0x37')]['length']?_0x40a27c['attributes']:_0x100c7c[_0xb1dd('0x33')];if(!_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x40a27c[_0xb1dd('0x21')]=qs[_0xb1dd('0x21')](_0x39c217['query']['limit']);_0x40a27c[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x40a27c[_0xb1dd('0x3d')]=qs[_0xb1dd('0x5a')](_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x5a')]);_0x40a27c[_0xb1dd('0x3e')]=qs['filters'](_[_0xb1dd('0x3f')](_0x39c217[_0xb1dd('0x34')],_0x100c7c[_0xb1dd('0x36')]));_0x40a27c[_0xb1dd('0x3e')][_0xb1dd('0x5d')]=_0x113b28['id'];if(_0x39c217['query'][_0xb1dd('0x40')]){_0x40a27c[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x40a27c[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x40a27c['attributes'],function(_0x2e7526){var _0x2d338b={};_0x2d338b[_0x2e7526]={'$like':'%'+_0x39c217['query'][_0xb1dd('0x40')]+'%'};return _0x2d338b;})});}_0x40a27c=_[_0xb1dd('0x42')]({},_0x40a27c,_0x39c217[_0xb1dd('0x4a')]);return db[_0xb1dd('0x5e')][_0xb1dd('0x20')]({'where':_0x40a27c[_0xb1dd('0x3e')]})[_0xb1dd('0x26')](function(_0x537607){_0x735b3a[_0xb1dd('0x20')]=_0x537607;if(_0x39c217[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x40a27c[_0xb1dd('0x44')]=[{'all':!![]}];}return db[_0xb1dd('0x5e')][_0xb1dd('0x46')](_0x40a27c);})[_0xb1dd('0x26')](function(_0x2de67f){_0x735b3a[_0xb1dd('0x47')]=_0x2de67f;return _0x735b3a;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x4e3f86,_0x40a27c))[_0xb1dd('0x48')](handleError(_0x4e3f86,null));};exports[_0xb1dd('0x5f')]=function(_0x565bc8,_0x30da06,_0x48fb38){var _0x4881b9={'raw':!![],'where':{}};var _0x4a00e0={};var _0x865ab2={'count':0x0,'rows':[]};return db['Campaign'][_0xb1dd('0x58')]({'where':{'id':_0x565bc8[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x30da06,null))['then'](function(_0x51561d){if(_0x51561d){_0x4a00e0['model']=_[_0xb1dd('0x35')](db['CmHopperBlack'][_0xb1dd('0x30')]);_0x4a00e0['query']=_[_0xb1dd('0x35')](_0x565bc8[_0xb1dd('0x34')]);_0x4a00e0[_0xb1dd('0x36')]=_[_0xb1dd('0x38')](_0x4a00e0[_0xb1dd('0x33')],_0x4a00e0['query']);_0x4881b9['attributes']=_[_0xb1dd('0x38')](_0x4a00e0[_0xb1dd('0x33')],qs['fields'](_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x39')]));_0x4881b9[_0xb1dd('0x37')]=_0x4881b9['attributes']['length']?_0x4881b9[_0xb1dd('0x37')]:_0x4a00e0['model'];if(!_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x4881b9[_0xb1dd('0x21')]=qs[_0xb1dd('0x21')](_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x4881b9[_0xb1dd('0x1e')]=qs[_0xb1dd('0x1e')](_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}_0x4881b9['order']=qs['sort'](_0x565bc8['query']['sort']);_0x4881b9[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x565bc8['query'],_0x4a00e0[_0xb1dd('0x36')]));_0x4881b9['where'][_0xb1dd('0x5d')]=_0x51561d['id'];if(_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x40')]){_0x4881b9['where']=_[_0xb1dd('0x42')](_0x4881b9[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x4881b9['attributes'],function(_0x11cb93){var _0x3d672a={};_0x3d672a[_0x11cb93]={'$like':'%'+_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x3d672a;})});}_0x4881b9=_[_0xb1dd('0x42')]({},_0x4881b9,_0x565bc8[_0xb1dd('0x4a')]);return db[_0xb1dd('0x60')][_0xb1dd('0x20')]({'where':_0x4881b9[_0xb1dd('0x3e')]})[_0xb1dd('0x26')](function(_0x1d8969){_0x865ab2[_0xb1dd('0x20')]=_0x1d8969;if(_0x565bc8[_0xb1dd('0x34')][_0xb1dd('0x43')]){_0x4881b9[_0xb1dd('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xb1dd('0x46')](_0x4881b9);})[_0xb1dd('0x26')](function(_0x9812ec){_0x865ab2[_0xb1dd('0x47')]=_0x9812ec;return _0x865ab2;});}})[_0xb1dd('0x26')](respondWithFilteredResult(_0x30da06,_0x4881b9))['catch'](handleError(_0x30da06,null));};exports[_0xb1dd('0x61')]=function(_0x452906,_0x49b560,_0x5d8398){var _0x130647={};var _0x552599={};var _0x225fbc;var _0x4a9ee1;return db[_0xb1dd('0x45')]['findOne']({'where':{'id':_0x452906[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x49b560,null))[_0xb1dd('0x26')](function(_0x1d03ba){if(_0x1d03ba){_0x225fbc=_0x1d03ba;_0x552599[_0xb1dd('0x33')]=_[_0xb1dd('0x35')](db[_0xb1dd('0x62')][_0xb1dd('0x30')]);_0x552599[_0xb1dd('0x34')]=_[_0xb1dd('0x35')](_0x452906[_0xb1dd('0x34')]);_0x552599[_0xb1dd('0x36')]=_[_0xb1dd('0x38')](_0x552599['model'],_0x552599[_0xb1dd('0x34')]);_0x130647[_0xb1dd('0x37')]=_[_0xb1dd('0x38')](_0x552599[_0xb1dd('0x33')],qs[_0xb1dd('0x39')](_0x452906[_0xb1dd('0x34')][_0xb1dd('0x39')]));_0x130647[_0xb1dd('0x37')]=_0x130647[_0xb1dd('0x37')][_0xb1dd('0x3a')]?_0x130647[_0xb1dd('0x37')]:_0x552599[_0xb1dd('0x33')];_0x130647[_0xb1dd('0x3d')]=qs['sort'](_0x452906['query'][_0xb1dd('0x5a')]);_0x130647[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x452906['query'],_0x552599['filters']));if(_0x452906[_0xb1dd('0x34')]['filter']){_0x130647[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x130647[_0xb1dd('0x3e')],{'$or':_[_0xb1dd('0x2f')](_0x130647[_0xb1dd('0x37')],function(_0x296f14){var _0x1519c0={};_0x1519c0[_0x296f14]={'$like':'%'+_0x452906[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x1519c0;})});}_0x130647=_[_0xb1dd('0x42')]({},_0x130647,_0x452906['options']);return _0x225fbc[_0xb1dd('0x61')](_0x130647);}})[_0xb1dd('0x26')](function(_0x4be8b3){if(_0x4be8b3){_0x4a9ee1=_0x4be8b3[_0xb1dd('0x3a')];if(!_0x452906[_0xb1dd('0x34')][_0xb1dd('0x3b')](_0xb1dd('0x3c'))){_0x130647['limit']=qs[_0xb1dd('0x21')](_0x452906[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x130647[_0xb1dd('0x1e')]=qs['offset'](_0x452906[_0xb1dd('0x34')][_0xb1dd('0x1e')]);}return _0x225fbc['getLists'](_0x130647);}})[_0xb1dd('0x26')](function(_0x1e8c80){if(_0x1e8c80){return _0x1e8c80?{'count':_0x4a9ee1,'rows':_0x1e8c80}:null;}})[_0xb1dd('0x26')](respondWithResult(_0x49b560,null))[_0xb1dd('0x48')](handleError(_0x49b560,null));};exports[_0xb1dd('0x63')]=function(_0x46f718,_0x27237e,_0x2c639a){var _0x5ba3af,_0x3f24cf;return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0x46f718[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x27237e,null))[_0xb1dd('0x26')](function(_0x13be2b){if(_0x13be2b){_0x3f24cf=_0x13be2b;return _0x13be2b[_0xb1dd('0x63')](_0x46f718['body'][_0xb1dd('0x64')],_['omit'](_0x46f718['body'],['ids','id'])||{});}return null;})[_0xb1dd('0x65')](function(_0x4c9824){var _0x333110;_0x5ba3af=_0x4c9824||[];var _0x1fffd2=[];if(_0x4c9824){for(var _0x422a0e=0x0;_0x422a0e<_0x4c9824[_0xb1dd('0x3a')];_0x422a0e+=0x1){var _0x2872af=_0x4c9824[_0x422a0e][_0xb1dd('0x28')]({'plain':!![]});_0x3f24cf[_0xb1dd('0x66')]=_0x46f718[_0xb1dd('0x55')][_0xb1dd('0x66')]?_0x46f718[_0xb1dd('0x55')]['dialCheckDuplicateType']:_0x3f24cf['dialCheckDuplicateType'];switch(_0x3f24cf[_0xb1dd('0x66')]){case _0xb1dd('0x67'):_0x333110=squel[_0xb1dd('0x68')]()[_0xb1dd('0x69')](_0xb1dd('0x6a'))[_0xb1dd('0x6b')]([_0xb1dd('0x6c'),_0xb1dd('0x6d'),_0xb1dd('0x6e'),_0xb1dd('0x6f'),_0xb1dd('0x5d'),_0xb1dd('0x56'),_0xb1dd('0x70')],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')]('phone',_0xb1dd('0x6c'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x6d'))['field']('id',_0xb1dd('0x6e'))[_0xb1dd('0x72')](_0x2872af['CmListId']['toString'](),'ListId')['field'](_0x46f718['params']['id']['toString'](),_0xb1dd('0x5d'))[_0xb1dd('0x72')]('NOW()',_0xb1dd('0x56'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')]('deletedAt\x20IS\x20NULL')[_0xb1dd('0x3e')]('ListId\x20=\x20?',_0x2872af[_0xb1dd('0x75')]['toString']())[_0xb1dd('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xb1dd('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb1dd('0x72')](_0xb1dd('0x76'))[_0xb1dd('0x77')]('cm_hopper_final')['where'](_0xb1dd('0x78'),_0x46f718['params']['id'][_0xb1dd('0x79')]()))['where'](_0xb1dd('0x7a'),squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x7b'))[_0xb1dd('0x77')](_0xb1dd('0x6a'))[_0xb1dd('0x3e')](_0xb1dd('0x78'),_0x46f718[_0xb1dd('0x49')]['id'][_0xb1dd('0x79')]())))[_0xb1dd('0x79')]();break;case _0xb1dd('0x7c'):_0x333110=squel[_0xb1dd('0x68')]()[_0xb1dd('0x69')](_0xb1dd('0x6a'))[_0xb1dd('0x6b')]([_0xb1dd('0x6c'),_0xb1dd('0x6d'),_0xb1dd('0x6e'),'ListId','CampaignId',_0xb1dd('0x56'),'updatedAt'],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x6c'),_0xb1dd('0x6c'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x6d'))['field']('id',_0xb1dd('0x6e'))['field'](_0x2872af['CmListId'][_0xb1dd('0x79')](),'ListId')[_0xb1dd('0x72')](_0x46f718['params']['id'][_0xb1dd('0x79')](),_0xb1dd('0x5d'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x56'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')]('deletedAt\x20IS\x20NULL')[_0xb1dd('0x3e')](_0xb1dd('0x7d'),_0x2872af[_0xb1dd('0x75')][_0xb1dd('0x79')]())[_0xb1dd('0x3e')](_0xb1dd('0x7e'))[_0xb1dd('0x3e')](_0xb1dd('0x7a'),squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')]('COALESCE(phone,\x27\x27)')[_0xb1dd('0x77')](_0xb1dd('0x6a'))['where'](_0xb1dd('0x78'),_0x46f718[_0xb1dd('0x49')]['id'][_0xb1dd('0x79')]())))[_0xb1dd('0x79')]();break;default:_0x333110=squel[_0xb1dd('0x68')]()[_0xb1dd('0x69')]('cm_hopper')[_0xb1dd('0x6b')](['phone',_0xb1dd('0x6d'),_0xb1dd('0x6e'),_0xb1dd('0x6f'),'CampaignId',_0xb1dd('0x56'),_0xb1dd('0x70')],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x6c'),_0xb1dd('0x6c'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x6d'))[_0xb1dd('0x72')]('id',_0xb1dd('0x6e'))[_0xb1dd('0x72')](_0x2872af[_0xb1dd('0x75')]['toString'](),'ListId')['field'](_0x46f718[_0xb1dd('0x49')]['id'][_0xb1dd('0x79')](),'CampaignId')[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x56'))[_0xb1dd('0x72')](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')]('deletedAt\x20IS\x20NULL')[_0xb1dd('0x3e')](_0xb1dd('0x7d'),_0x2872af[_0xb1dd('0x75')][_0xb1dd('0x79')]())[_0xb1dd('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xb1dd('0x79')]();}_0x1fffd2['push'](db[_0xb1dd('0x7f')][_0xb1dd('0x34')](_0x333110));}return BPromise[_0xb1dd('0x80')](_0x1fffd2);}})[_0xb1dd('0x26')](function(){return _0x5ba3af;})['then'](respondWithResult(_0x27237e,null))[_0xb1dd('0x48')](handleError(_0x27237e,null));};exports[_0xb1dd('0x81')]=function(_0x7f6a4e,_0x32d5ec,_0x570376){return db[_0xb1dd('0x45')]['find']({'where':{'id':_0x7f6a4e[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x32d5ec,null))[_0xb1dd('0x26')](function(_0xc797fb){if(_0xc797fb){return _0xc797fb[_0xb1dd('0x81')](_0x7f6a4e['query'][_0xb1dd('0x64')]);}})[_0xb1dd('0x26')](function(_0x5255f8){if(_0x5255f8){return db[_0xb1dd('0x59')][_0xb1dd('0x27')]({'where':{'ListId':_0x7f6a4e[_0xb1dd('0x34')][_0xb1dd('0x64')],'CampaignId':_0x7f6a4e[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](function(){return _0x5255f8;});}})[_0xb1dd('0x26')](respondWithStatusCode(_0x32d5ec,null))[_0xb1dd('0x48')](handleError(_0x32d5ec,null));};exports[_0xb1dd('0x82')]=function(_0x5a7144,_0x767f4e,_0x20bb81){var _0x56f41c={};var _0x4de39f={};var _0xbb707;var _0x156e6c;return db[_0xb1dd('0x45')][_0xb1dd('0x58')]({'where':{'id':_0x5a7144['params']['id']}})['then'](handleEntityNotFound(_0x767f4e,null))[_0xb1dd('0x26')](function(_0x53b971){if(_0x53b971){_0xbb707=_0x53b971;_0x4de39f[_0xb1dd('0x33')]=_[_0xb1dd('0x35')](db[_0xb1dd('0x62')][_0xb1dd('0x30')]);_0x4de39f['query']=_[_0xb1dd('0x35')](_0x5a7144[_0xb1dd('0x34')]);_0x4de39f['filters']=_[_0xb1dd('0x38')](_0x4de39f[_0xb1dd('0x33')],_0x4de39f['query']);_0x56f41c[_0xb1dd('0x37')]=_['intersection'](_0x4de39f[_0xb1dd('0x33')],qs[_0xb1dd('0x39')](_0x5a7144['query'][_0xb1dd('0x39')]));_0x56f41c[_0xb1dd('0x37')]=_0x56f41c['attributes'][_0xb1dd('0x3a')]?_0x56f41c[_0xb1dd('0x37')]:_0x4de39f[_0xb1dd('0x33')];_0x56f41c[_0xb1dd('0x3d')]=qs[_0xb1dd('0x5a')](_0x5a7144['query'][_0xb1dd('0x5a')]);_0x56f41c[_0xb1dd('0x3e')]=qs[_0xb1dd('0x36')](_[_0xb1dd('0x3f')](_0x5a7144[_0xb1dd('0x34')],_0x4de39f[_0xb1dd('0x36')]));if(_0x5a7144['query'][_0xb1dd('0x40')]){_0x56f41c[_0xb1dd('0x3e')]=_[_0xb1dd('0x42')](_0x56f41c[_0xb1dd('0x3e')],{'$or':_['map'](_0x56f41c[_0xb1dd('0x37')],function(_0x1f5f31){var _0x5c78fe={};_0x5c78fe[_0x1f5f31]={'$like':'%'+_0x5a7144[_0xb1dd('0x34')][_0xb1dd('0x40')]+'%'};return _0x5c78fe;})});}_0x56f41c=_[_0xb1dd('0x42')]({},_0x56f41c,_0x5a7144[_0xb1dd('0x4a')]);return _0xbb707['getBlackLists'](_0x56f41c);}})[_0xb1dd('0x26')](function(_0x3c0235){if(_0x3c0235){_0x156e6c=_0x3c0235[_0xb1dd('0x3a')];if(!_0x5a7144['query'][_0xb1dd('0x3b')]('nolimit')){_0x56f41c[_0xb1dd('0x21')]=qs['limit'](_0x5a7144[_0xb1dd('0x34')][_0xb1dd('0x21')]);_0x56f41c[_0xb1dd('0x1e')]=qs['offset'](_0x5a7144['query']['offset']);}return _0xbb707['getBlackLists'](_0x56f41c);}})['then'](function(_0x1c4e86){if(_0x1c4e86){return _0x1c4e86?{'count':_0x156e6c,'rows':_0x1c4e86}:null;}})['then'](respondWithResult(_0x767f4e,null))[_0xb1dd('0x48')](handleError(_0x767f4e,null));};exports[_0xb1dd('0x83')]=function(_0x30badf,_0x31337b,_0x565abf){var _0x10ea7f,_0x53b49c;return db[_0xb1dd('0x45')][_0xb1dd('0x4b')]({'where':{'id':_0x30badf[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x31337b,null))[_0xb1dd('0x26')](function(_0xdccf6){if(_0xdccf6){_0x53b49c=_0xdccf6;return _0xdccf6[_0xb1dd('0x83')](_0x30badf[_0xb1dd('0x55')]['ids'],_[_0xb1dd('0x84')](_0x30badf[_0xb1dd('0x55')],['ids','id'])||{});}return null;})[_0xb1dd('0x65')](function(_0xf90113){var _0x1ef11e;_0x10ea7f=_0xf90113||[];var _0x213c05=[];if(_0xf90113){for(var _0x322861=0x0;_0x322861<_0xf90113[_0xb1dd('0x3a')];_0x322861+=0x1){var _0x286a58=_0xf90113[_0x322861][_0xb1dd('0x28')]({'plain':!![]});_0x1ef11e=squel['insert']()['into'](_0xb1dd('0x85'))[_0xb1dd('0x6b')]([_0xb1dd('0x6c'),_0xb1dd('0x6e'),'ListId','CampaignId',_0xb1dd('0x56'),'updatedAt'],squel[_0xb1dd('0x71')]()[_0xb1dd('0x72')](_0xb1dd('0x6c'),_0xb1dd('0x6c'))[_0xb1dd('0x72')]('id',_0xb1dd('0x6e'))[_0xb1dd('0x72')](_0x286a58[_0xb1dd('0x75')]['toString'](),_0xb1dd('0x6f'))[_0xb1dd('0x72')](_0x30badf['params']['id'][_0xb1dd('0x79')](),_0xb1dd('0x5d'))[_0xb1dd('0x72')]('NOW()',_0xb1dd('0x56'))['field'](_0xb1dd('0x73'),_0xb1dd('0x70'))['from'](_0xb1dd('0x74'))[_0xb1dd('0x3e')](_0xb1dd('0x86'))[_0xb1dd('0x3e')](_0xb1dd('0x7d'),_0x286a58[_0xb1dd('0x75')][_0xb1dd('0x79')]())[_0xb1dd('0x3e')](_0xb1dd('0x7e')))[_0xb1dd('0x79')]();_0x213c05[_0xb1dd('0x87')](db[_0xb1dd('0x7f')][_0xb1dd('0x34')](_0x1ef11e));}return BPromise[_0xb1dd('0x80')](_0x213c05);}})['then'](function(){return _0x10ea7f;})[_0xb1dd('0x26')](respondWithResult(_0x31337b,null))['catch'](handleError(_0x31337b,null));};exports[_0xb1dd('0x88')]=function(_0x3eb1b4,_0x369ab0,_0x336f0d){return db[_0xb1dd('0x45')]['find']({'where':{'id':_0x3eb1b4[_0xb1dd('0x49')]['id']}})[_0xb1dd('0x26')](handleEntityNotFound(_0x369ab0,null))[_0xb1dd('0x26')](function(_0x418cd5){if(_0x418cd5){return _0x418cd5[_0xb1dd('0x88')](_0x3eb1b4[_0xb1dd('0x34')][_0xb1dd('0x64')]);}})[_0xb1dd('0x26')](function(_0x19298d){if(_0x19298d){return db['CmHopperBlack'][_0xb1dd('0x27')]({'where':{'ListId':_0x3eb1b4['query'][_0xb1dd('0x64')],'CampaignId':_0x3eb1b4[_0xb1dd('0x49')]['id']}})['then'](function(){return _0x19298d;});}})['then'](respondWithStatusCode(_0x369ab0,null))['catch'](handleError(_0x369ab0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 89b2d1d..6e936d1 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(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index f408661..29009bb 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 _0x3df4=['info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x2cbbfb,_0x2c7419){var _0xe13272=function(_0x544157){while(--_0x544157){_0x2cbbfb['push'](_0x2cbbfb['shift']());}};_0xe13272(++_0x2c7419);}(_0x3df4,0x102));var _0x43df=function(_0x29dc4a,_0x30cd20){_0x29dc4a=_0x29dc4a-0x0;var _0x3171f1=_0x3df4[_0x29dc4a];return _0x3171f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43df('0x0'));var BPromise=require(_0x43df('0x1'));var rs=require(_0x43df('0x2'));var fs=require('fs');var Redis=require(_0x43df('0x3'));var db=require(_0x43df('0x4'))['db'];var utils=require(_0x43df('0x5'));var logger=require(_0x43df('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43df('0x7'));var client=jayson[_0x43df('0x8')][_0x43df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43fd8c,_0x5ba02f,_0x5863be){return new BPromise(function(_0x2492a9,_0x44b685){return client[_0x43df('0xa')](_0x43fd8c,_0x5863be)[_0x43df('0xb')](function(_0x553304){logger[_0x43df('0xc')]('Campaign,\x20%s,\x20%s',_0x5ba02f,_0x43df('0xd'));logger[_0x43df('0xe')](_0x43df('0xf'),_0x5ba02f,_0x43df('0xd'),JSON[_0x43df('0x10')](_0x553304));if(_0x553304[_0x43df('0x11')]){if(_0x553304[_0x43df('0x11')]['code']===0x1f4){logger[_0x43df('0x11')](_0x43df('0x12'),_0x5ba02f,_0x553304['error'][_0x43df('0x13')]);return _0x44b685(_0x553304['error'][_0x43df('0x13')]);}logger[_0x43df('0x11')]('Campaign,\x20%s,\x20%s',_0x5ba02f,_0x553304[_0x43df('0x11')]['message']);return _0x2492a9(_0x553304['error'][_0x43df('0x13')]);}else{logger[_0x43df('0xc')]('Campaign,\x20%s,\x20%s',_0x5ba02f,_0x43df('0xd'));_0x2492a9(_0x553304['result'][_0x43df('0x13')]);}})[_0x43df('0x14')](function(_0x14b258){logger[_0x43df('0x11')](_0x43df('0x12'),_0x5ba02f,_0x14b258);_0x44b685(_0x14b258);});});}exports[_0x43df('0x15')]=function(_0x571404){var _0x376373=this;return new Promise(function(_0x334fae,_0x241066){return db[_0x43df('0x16')]['findAll']({'raw':_0x571404[_0x43df('0x17')]?_0x571404[_0x43df('0x17')][_0x43df('0x18')]===undefined?!![]:![]:!![],'where':_0x571404['options']?_0x571404['options'][_0x43df('0x19')]||null:null,'attributes':_0x571404[_0x43df('0x17')]?_0x571404['options'][_0x43df('0x1a')]||null:null,'limit':_0x571404[_0x43df('0x17')]?_0x571404[_0x43df('0x17')]['limit']||null:null,'include':_0x571404[_0x43df('0x17')]?_0x571404['options'][_0x43df('0x1b')]?_['map'](_0x571404[_0x43df('0x17')][_0x43df('0x1b')],function(_0xbb793b){return{'model':db[_0xbb793b['model']],'as':_0xbb793b['as'],'attributes':_0xbb793b[_0x43df('0x1a')],'include':_0xbb793b['include']?_[_0x43df('0x1c')](_0xbb793b[_0x43df('0x1b')],function(_0xda44f3){return{'model':db[_0xda44f3[_0x43df('0x1d')]],'as':_0xda44f3['as'],'attributes':_0xda44f3[_0x43df('0x1a')],'include':_0xda44f3[_0x43df('0x1b')]?_[_0x43df('0x1c')](_0xda44f3[_0x43df('0x1b')],function(_0xb2578b){return{'model':db[_0xb2578b[_0x43df('0x1d')]],'as':_0xb2578b['as'],'attributes':_0xb2578b[_0x43df('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38f9b8){logger[_0x43df('0xc')](_0x43df('0x15'),_0x571404);logger[_0x43df('0xe')](_0x43df('0x15'),_0x571404,JSON[_0x43df('0x10')](_0x38f9b8));_0x334fae(_0x38f9b8);})[_0x43df('0x14')](function(_0xcc74c7){logger[_0x43df('0x11')]('GetCampaign',_0xcc74c7['message'],_0x571404);_0x241066(_0x376373[_0x43df('0x11')](0x1f4,_0xcc74c7[_0x43df('0x13')]));});});}; \ No newline at end of file +var _0x402f=['rpc','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','message','error','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x24a168,_0x4bad38){var _0x58c139=function(_0x12ec96){while(--_0x12ec96){_0x24a168['push'](_0x24a168['shift']());}};_0x58c139(++_0x4bad38);}(_0x402f,0x6f));var _0xf402=function(_0x3d4b54,_0x381964){_0x3d4b54=_0x3d4b54-0x0;var _0x786a5a=_0x402f[_0x3d4b54];return _0x786a5a;};'use strict';var _=require(_0xf402('0x0'));var util=require('util');var moment=require(_0xf402('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf402('0x2'));var db=require(_0xf402('0x3'))['db'];var utils=require(_0xf402('0x4'));var logger=require('../../config/logger')(_0xf402('0x5'));var config=require('../../config/environment');var jayson=require(_0xf402('0x6'));var client=jayson[_0xf402('0x7')][_0xf402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a8774,_0xa1b27d,_0x55c515){return new BPromise(function(_0x4d1771,_0x2f0ffe){return client[_0xf402('0x9')](_0x2a8774,_0x55c515)[_0xf402('0xa')](function(_0xdc18e0){logger[_0xf402('0xb')](_0xf402('0xc'),_0xa1b27d,_0xf402('0xd'));logger[_0xf402('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'),JSON['stringify'](_0xdc18e0));if(_0xdc18e0['error']){if(_0xdc18e0['error']['code']===0x1f4){logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0['error']['message']);return _0x2f0ffe(_0xdc18e0['error'][_0xf402('0xf')]);}logger['error'](_0xf402('0xc'),_0xa1b27d,_0xdc18e0[_0xf402('0x10')][_0xf402('0xf')]);return _0x4d1771(_0xdc18e0[_0xf402('0x10')]['message']);}else{logger[_0xf402('0xb')]('Campaign,\x20%s,\x20%s',_0xa1b27d,_0xf402('0xd'));_0x4d1771(_0xdc18e0['result']['message']);}})['catch'](function(_0xb45d00){logger[_0xf402('0x10')](_0xf402('0xc'),_0xa1b27d,_0xb45d00);_0x2f0ffe(_0xb45d00);});});}exports[_0xf402('0x11')]=function(_0x2fbe36){var _0x5d7236=this;return new Promise(function(_0x3ed3eb,_0x151166){return db[_0xf402('0x12')][_0xf402('0x13')]({'raw':_0x2fbe36['options']?_0x2fbe36[_0xf402('0x14')][_0xf402('0x15')]===undefined?!![]:![]:!![],'where':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36[_0xf402('0x14')][_0xf402('0x16')]||null:null,'attributes':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36[_0xf402('0x14')][_0xf402('0x17')]||null:null,'limit':_0x2fbe36[_0xf402('0x14')]?_0x2fbe36['options'][_0xf402('0x18')]||null:null,'include':_0x2fbe36['options']?_0x2fbe36[_0xf402('0x14')][_0xf402('0x19')]?_[_0xf402('0x1a')](_0x2fbe36[_0xf402('0x14')][_0xf402('0x19')],function(_0x9cbd83){return{'model':db[_0x9cbd83[_0xf402('0x1b')]],'as':_0x9cbd83['as'],'attributes':_0x9cbd83[_0xf402('0x17')],'include':_0x9cbd83[_0xf402('0x19')]?_[_0xf402('0x1a')](_0x9cbd83[_0xf402('0x19')],function(_0xfad629){return{'model':db[_0xfad629['model']],'as':_0xfad629['as'],'attributes':_0xfad629[_0xf402('0x17')],'include':_0xfad629[_0xf402('0x19')]?_[_0xf402('0x1a')](_0xfad629[_0xf402('0x19')],function(_0x566a3d){return{'model':db[_0x566a3d['model']],'as':_0x566a3d['as'],'attributes':_0x566a3d[_0xf402('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf402('0xa')](function(_0x3a6a8d){logger[_0xf402('0xb')](_0xf402('0x11'),_0x2fbe36);logger['debug'](_0xf402('0x11'),_0x2fbe36,JSON['stringify'](_0x3a6a8d));_0x3ed3eb(_0x3a6a8d);})[_0xf402('0x1c')](function(_0xe3dc2f){logger[_0xf402('0x10')](_0xf402('0x11'),_0xe3dc2f[_0xf402('0xf')],_0x2fbe36);_0x151166(_0x5d7236['error'](0x1f4,_0xe3dc2f[_0xf402('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index cf23fb8..0d2e4b5 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 _0xff32=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','delete','removeBlackLists','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x51ee87,_0x474650){var _0x4a00ae=function(_0x598a37){while(--_0x598a37){_0x51ee87['push'](_0x51ee87['shift']());}};_0x4a00ae(++_0x474650);}(_0xff32,0x15a));var _0x2ff3=function(_0x4e1a81,_0x4c3697){_0x4e1a81=_0x4e1a81-0x0;var _0x52ea72=_0xff32[_0x4e1a81];return _0x52ea72;};'use strict';var multer=require('multer');var util=require(_0x2ff3('0x0'));var path=require(_0x2ff3('0x1'));var timeout=require(_0x2ff3('0x2'));var express=require(_0x2ff3('0x3'));var router=express['Router']();var fs_extra=require(_0x2ff3('0x4'));var auth=require(_0x2ff3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ff3('0x6'));var controller=require(_0x2ff3('0x7'));router[_0x2ff3('0x8')]('/',auth[_0x2ff3('0x9')](),controller[_0x2ff3('0xa')]);router[_0x2ff3('0x8')](_0x2ff3('0xb'),auth[_0x2ff3('0x9')](),controller[_0x2ff3('0xc')]);router[_0x2ff3('0x8')](_0x2ff3('0xd'),auth[_0x2ff3('0x9')](),controller[_0x2ff3('0xe')]);router[_0x2ff3('0x8')](_0x2ff3('0xf'),auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x10')]);router['get']('/:id/hopper_finals',auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x11')]);router['get'](_0x2ff3('0x12'),auth['isAuthenticated'](),controller[_0x2ff3('0x13')]);router[_0x2ff3('0x8')](_0x2ff3('0x14'),auth[_0x2ff3('0x9')](),controller['getLists']);router[_0x2ff3('0x8')]('/:id/blacklists',auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x15')]);router[_0x2ff3('0x16')]('/',auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x17')]);router[_0x2ff3('0x16')](_0x2ff3('0x18'),auth['isAuthenticated'](),controller[_0x2ff3('0x19')]);router['post'](_0x2ff3('0x14'),auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x1a')]);router[_0x2ff3('0x16')](_0x2ff3('0x1b'),auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x1c')]);router[_0x2ff3('0x1d')](_0x2ff3('0xb'),auth[_0x2ff3('0x9')](),controller['update']);router['delete'](_0x2ff3('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x2ff3('0x1e')](_0x2ff3('0x14'),auth[_0x2ff3('0x9')](),controller['removeLists']);router[_0x2ff3('0x1e')](_0x2ff3('0x1b'),auth[_0x2ff3('0x9')](),controller[_0x2ff3('0x1f')]);module[_0x2ff3('0x20')]=router; \ No newline at end of file +var _0xe0c9=['addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xe0c9,0x1b4));var _0x9e0c=function(_0x49f886,_0x2a4f51){_0x49f886=_0x49f886-0x0;var _0x5d6831=_0xe0c9[_0x49f886];return _0x5d6831;};'use strict';var multer=require('multer');var util=require(_0x9e0c('0x0'));var path=require(_0x9e0c('0x1'));var timeout=require(_0x9e0c('0x2'));var express=require(_0x9e0c('0x3'));var router=express[_0x9e0c('0x4')]();var fs_extra=require(_0x9e0c('0x5'));var auth=require(_0x9e0c('0x6'));var interaction=require(_0x9e0c('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x9e0c('0x8')]('/',auth[_0x9e0c('0x9')](),controller[_0x9e0c('0xa')]);router['get'](_0x9e0c('0xb'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0xc')]);router[_0x9e0c('0x8')](_0x9e0c('0xd'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0xe')]);router[_0x9e0c('0x8')](_0x9e0c('0xf'),auth['isAuthenticated'](),controller[_0x9e0c('0x10')]);router[_0x9e0c('0x8')]('/:id/hopper_finals',auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x11')]);router[_0x9e0c('0x8')]('/:id/hopper_black',auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x12')]);router[_0x9e0c('0x8')](_0x9e0c('0x13'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x14')]);router[_0x9e0c('0x8')](_0x9e0c('0x15'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x16')]);router['post']('/',auth[_0x9e0c('0x9')](),controller['create']);router[_0x9e0c('0x17')](_0x9e0c('0x18'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x19')]);router[_0x9e0c('0x17')](_0x9e0c('0x13'),auth['isAuthenticated'](),controller[_0x9e0c('0x1a')]);router[_0x9e0c('0x17')](_0x9e0c('0x15'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x1b')]);router[_0x9e0c('0x1c')](_0x9e0c('0xb'),auth[_0x9e0c('0x9')](),controller['update']);router[_0x9e0c('0x1d')](_0x9e0c('0xb'),auth['isAuthenticated'](),controller[_0x9e0c('0x1e')]);router['delete'](_0x9e0c('0x13'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x1f')]);router[_0x9e0c('0x1d')](_0x9e0c('0x15'),auth[_0x9e0c('0x9')](),controller[_0x9e0c('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1fba85a..49ee6d2 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 _0x8fa4=['TEXT','VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x2c2c7c,_0x221428){var _0x49978d=function(_0x4518d1){while(--_0x4518d1){_0x2c2c7c['push'](_0x2c2c7c['shift']());}};_0x49978d(++_0x221428);}(_0x8fa4,0xe2));var _0x48fa=function(_0x239376,_0x1b1948){_0x239376=_0x239376-0x0;var _0xa95e5e=_0x8fa4[_0x239376];return _0xa95e5e;};'use strict';var Sequelize=require(_0x48fa('0x0'));module['exports']={'key':{'type':Sequelize[_0x48fa('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x48fa('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x48fa('0x1')]},'name':{'type':Sequelize[_0x48fa('0x3')],'get':function(){return this[_0x48fa('0x4')](_0x48fa('0x5'));}}}; \ No newline at end of file +var _0xd479=['TEXT','VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x25ea59,_0x155f2a){var _0x305516=function(_0x109ac0){while(--_0x109ac0){_0x25ea59['push'](_0x25ea59['shift']());}};_0x305516(++_0x155f2a);}(_0xd479,0x11e));var _0x9d47=function(_0x5ddfce,_0x4dcb01){_0x5ddfce=_0x5ddfce-0x0;var _0x22049d=_0xd479[_0x5ddfce];return _0x22049d;};'use strict';var Sequelize=require('sequelize');module[_0x9d47('0x0')]={'key':{'type':Sequelize[_0x9d47('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x9d47('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9d47('0x1')]},'name':{'type':Sequelize[_0x9d47('0x3')],'get':function(){return this[_0x9d47('0x4')](_0x9d47('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e794eed..13bf972 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 _0xef09=['options','includeAll','findAll','rows','show','params','include','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','get','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xef09,0x184));var _0x9ef0=function(_0x314fa0,_0x3b1b47){_0x314fa0=_0x314fa0-0x0;var _0x1dded9=_0xef09[_0x314fa0];return _0x1dded9;};'use strict';var emlformat=require(_0x9ef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ef0('0x1'));var jsonpatch=require(_0x9ef0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9ef0('0x3'));var Mustache=require(_0x9ef0('0x4'));var util=require(_0x9ef0('0x5'));var path=require(_0x9ef0('0x6'));var sox=require(_0x9ef0('0x7'));var csv=require(_0x9ef0('0x8'));var ejs=require(_0x9ef0('0x9'));var fs=require('fs');var fs_extra=require(_0x9ef0('0xa'));var _=require(_0x9ef0('0xb'));var squel=require(_0x9ef0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ef0('0xd'));var toCsv=require(_0x9ef0('0x8'));var querystring=require(_0x9ef0('0xe'));var Papa=require(_0x9ef0('0xf'));var Redis=require(_0x9ef0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9ef0('0x11'));var as=require(_0x9ef0('0x12'));var hardwareService=require(_0x9ef0('0x13'));var logger=require(_0x9ef0('0x14'))(_0x9ef0('0x15'));var utils=require(_0x9ef0('0x16'));var config=require(_0x9ef0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ef0('0x18'))['db'];function respondWithStatusCode(_0x215c2a,_0x471646){_0x471646=_0x471646||0xcc;return function(_0x15d295){if(_0x15d295){return _0x215c2a[_0x9ef0('0x19')](_0x471646);}return _0x215c2a[_0x9ef0('0x1a')](_0x471646)[_0x9ef0('0x1b')]();};}function respondWithResult(_0x39bb7e,_0x295514){_0x295514=_0x295514||0xc8;return function(_0x33de80){if(_0x33de80){return _0x39bb7e[_0x9ef0('0x1a')](_0x295514)[_0x9ef0('0x1c')](_0x33de80);}};}function respondWithFilteredResult(_0x4fd640,_0x774c4){return function(_0x22fcb1){if(_0x22fcb1){var _0x2edee8=typeof _0x774c4[_0x9ef0('0x1d')]==='undefined'&&typeof _0x774c4[_0x9ef0('0x1e')]===_0x9ef0('0x1f');var _0x2ee617=_0x22fcb1[_0x9ef0('0x20')];var _0x242150=_0x2edee8?0x0:_0x774c4[_0x9ef0('0x1d')];var _0x240a2b=_0x2edee8?_0x22fcb1['count']:_0x774c4[_0x9ef0('0x1d')]+_0x774c4['limit'];var _0x4e2f6b;if(_0x240a2b>=_0x2ee617){_0x240a2b=_0x2ee617;_0x4e2f6b=0xc8;}else{_0x4e2f6b=0xce;}_0x4fd640['status'](_0x4e2f6b);return _0x4fd640[_0x9ef0('0x21')](_0x9ef0('0x22'),_0x242150+'-'+_0x240a2b+'/'+_0x2ee617)['json'](_0x22fcb1);}return null;};}function patchUpdates(_0x54b4c3){return function(_0x4bc5c9){try{jsonpatch[_0x9ef0('0x23')](_0x4bc5c9,_0x54b4c3,!![]);}catch(_0x2df336){return BPromise['reject'](_0x2df336);}return _0x4bc5c9['save']();};}function saveUpdates(_0x2a6a6f,_0x2ce612){return function(_0x40909c){if(_0x40909c){return _0x40909c[_0x9ef0('0x24')](_0x2a6a6f)[_0x9ef0('0x25')](function(_0x244004){return _0x244004;});}return null;};}function removeEntity(_0xd87d2b,_0x3d5fa1){return function(_0x111ba8){if(_0x111ba8){return _0x111ba8[_0x9ef0('0x26')]()[_0x9ef0('0x25')](function(){var _0x2d63af=_0x111ba8[_0x9ef0('0x27')]({'plain':!![]});var _0x572a1a=_0x9ef0('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x572a1a,'resourceId':_0x2d63af['id']}})[_0x9ef0('0x25')](function(){return _0x111ba8;});})[_0x9ef0('0x25')](function(){_0xd87d2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf34d2e,_0x3f001c){return function(_0x189a7d){if(!_0x189a7d){_0xf34d2e['sendStatus'](0x194);}return _0x189a7d;};}function handleError(_0x261a21,_0x39b7b2){_0x39b7b2=_0x39b7b2||0x1f4;return function(_0x4a93bd){logger[_0x9ef0('0x29')](_0x4a93bd[_0x9ef0('0x2a')]);if(_0x4a93bd[_0x9ef0('0x2b')]){delete _0x4a93bd[_0x9ef0('0x2b')];}_0x261a21[_0x9ef0('0x1a')](_0x39b7b2)[_0x9ef0('0x2c')](_0x4a93bd);};}exports[_0x9ef0('0x2d')]=function(_0x248d2c,_0x34388d){var _0x112ea1={},_0x43ce6c={},_0x5be4b6={'count':0x0,'rows':[]};var _0x14a441=_[_0x9ef0('0x2e')](db[_0x9ef0('0x2f')][_0x9ef0('0x30')],function(_0x3b9422){return{'name':_0x3b9422['fieldName'],'type':_0x3b9422[_0x9ef0('0x31')][_0x9ef0('0x32')]};});_0x43ce6c[_0x9ef0('0x33')]=_[_0x9ef0('0x2e')](_0x14a441,_0x9ef0('0x2b'));_0x43ce6c['query']=_[_0x9ef0('0x34')](_0x248d2c[_0x9ef0('0x35')]);_0x43ce6c[_0x9ef0('0x36')]=_[_0x9ef0('0x37')](_0x43ce6c[_0x9ef0('0x33')],_0x43ce6c[_0x9ef0('0x35')]);_0x112ea1[_0x9ef0('0x38')]=_[_0x9ef0('0x37')](_0x43ce6c[_0x9ef0('0x33')],qs[_0x9ef0('0x39')](_0x248d2c[_0x9ef0('0x35')][_0x9ef0('0x39')]));_0x112ea1['attributes']=_0x112ea1[_0x9ef0('0x38')][_0x9ef0('0x3a')]?_0x112ea1[_0x9ef0('0x38')]:_0x43ce6c['model'];if(!_0x248d2c[_0x9ef0('0x35')][_0x9ef0('0x3b')](_0x9ef0('0x3c'))){_0x112ea1['limit']=qs[_0x9ef0('0x1e')](_0x248d2c[_0x9ef0('0x35')][_0x9ef0('0x1e')]);_0x112ea1[_0x9ef0('0x1d')]=qs[_0x9ef0('0x1d')](_0x248d2c['query'][_0x9ef0('0x1d')]);}_0x112ea1[_0x9ef0('0x3d')]=qs[_0x9ef0('0x3e')](_0x248d2c[_0x9ef0('0x35')]['sort']);_0x112ea1[_0x9ef0('0x3f')]=qs[_0x9ef0('0x36')](_[_0x9ef0('0x40')](_0x248d2c[_0x9ef0('0x35')],_0x43ce6c[_0x9ef0('0x36')]),_0x14a441);if(_0x248d2c[_0x9ef0('0x35')]['filter']){_0x112ea1[_0x9ef0('0x3f')]=_[_0x9ef0('0x41')](_0x112ea1['where'],{'$or':[{'key':{'$like':'%'+_0x248d2c[_0x9ef0('0x35')][_0x9ef0('0x42')]+'%'}},{'value':{'$like':'%'+_0x248d2c[_0x9ef0('0x35')][_0x9ef0('0x42')]+'%'}}]});}_0x112ea1=_[_0x9ef0('0x41')]({},_0x112ea1,_0x248d2c[_0x9ef0('0x43')]);var _0x3de3e5={'where':_0x112ea1['where']};return db[_0x9ef0('0x2f')][_0x9ef0('0x20')](_0x3de3e5)['then'](function(_0x5a0577){_0x5be4b6['count']=_0x5a0577;if(_0x248d2c['query'][_0x9ef0('0x44')]){_0x112ea1['include']=[{'all':!![]}];}return db[_0x9ef0('0x2f')][_0x9ef0('0x45')](_0x112ea1);})[_0x9ef0('0x25')](function(_0x2843e0){_0x5be4b6[_0x9ef0('0x46')]=_0x2843e0;return _0x5be4b6;})['then'](respondWithFilteredResult(_0x34388d,_0x112ea1))['catch'](handleError(_0x34388d,null));};exports[_0x9ef0('0x47')]=function(_0x506055,_0x47be7a){var _0x41dcad={'raw':!![],'where':{'id':_0x506055[_0x9ef0('0x48')]['id']}},_0x5c6c26={};_0x5c6c26[_0x9ef0('0x33')]=_[_0x9ef0('0x34')](db[_0x9ef0('0x2f')][_0x9ef0('0x30')]);_0x5c6c26[_0x9ef0('0x35')]=_[_0x9ef0('0x34')](_0x506055[_0x9ef0('0x35')]);_0x5c6c26['filters']=_[_0x9ef0('0x37')](_0x5c6c26['model'],_0x5c6c26['query']);_0x41dcad[_0x9ef0('0x38')]=_[_0x9ef0('0x37')](_0x5c6c26[_0x9ef0('0x33')],qs[_0x9ef0('0x39')](_0x506055[_0x9ef0('0x35')][_0x9ef0('0x39')]));_0x41dcad[_0x9ef0('0x38')]=_0x41dcad[_0x9ef0('0x38')][_0x9ef0('0x3a')]?_0x41dcad[_0x9ef0('0x38')]:_0x5c6c26[_0x9ef0('0x33')];if(_0x506055[_0x9ef0('0x35')]['includeAll']){_0x41dcad[_0x9ef0('0x49')]=[{'all':!![]}];}_0x41dcad=_['merge']({},_0x41dcad,_0x506055[_0x9ef0('0x43')]);return db['CannedAnswer']['find'](_0x41dcad)[_0x9ef0('0x25')](handleEntityNotFound(_0x47be7a,null))[_0x9ef0('0x25')](respondWithResult(_0x47be7a,null))[_0x9ef0('0x4a')](handleError(_0x47be7a,null));};exports[_0x9ef0('0x24')]=function(_0x4e9456,_0x5201e5){if(_0x4e9456[_0x9ef0('0x4b')]['id']){delete _0x4e9456[_0x9ef0('0x4b')]['id'];}return db[_0x9ef0('0x2f')][_0x9ef0('0x4c')]({'where':{'id':_0x4e9456[_0x9ef0('0x48')]['id']}})[_0x9ef0('0x25')](handleEntityNotFound(_0x5201e5,null))[_0x9ef0('0x25')](saveUpdates(_0x4e9456['body'],null))[_0x9ef0('0x25')](respondWithResult(_0x5201e5,null))['catch'](handleError(_0x5201e5,null));};exports[_0x9ef0('0x26')]=function(_0x525b46,_0x2950bd){return db[_0x9ef0('0x2f')][_0x9ef0('0x4c')]({'where':{'id':_0x525b46['params']['id']}})[_0x9ef0('0x25')](handleEntityNotFound(_0x2950bd,null))[_0x9ef0('0x25')](removeEntity(_0x2950bd,null))[_0x9ef0('0x4a')](handleError(_0x2950bd,null));};exports[_0x9ef0('0x4d')]=function(_0x592e4c,_0x49c7ae){var _0x1c5fda={'key':_0x592e4c[_0x9ef0('0x4b')][_0x9ef0('0x32')]};if(_0x592e4c[_0x9ef0('0x4b')][_0x9ef0('0x4e')]){_0x1c5fda[_0x9ef0('0x4e')]=_0x592e4c['body']['MailAccountId'];}else if(_0x592e4c[_0x9ef0('0x4b')][_0x9ef0('0x4f')]){_0x1c5fda['SmsAccountId']=_0x592e4c[_0x9ef0('0x4b')]['SmsAccountId'];}else if(_0x592e4c[_0x9ef0('0x4b')][_0x9ef0('0x50')]){_0x1c5fda[_0x9ef0('0x50')]=_0x592e4c['body'][_0x9ef0('0x50')];}else if(_0x592e4c[_0x9ef0('0x4b')]['ChatWebsiteId']){_0x1c5fda[_0x9ef0('0x51')]=_0x592e4c[_0x9ef0('0x4b')][_0x9ef0('0x51')];}return db[_0x9ef0('0x2f')]['find']({'where':_0x1c5fda})['then'](function(_0x214bc7){if(_0x214bc7){throw new db[(_0x9ef0('0x52'))]['ValidationError'](_0x9ef0('0x53'));}return db[_0x9ef0('0x2f')][_0x9ef0('0x4d')](_0x592e4c[_0x9ef0('0x4b')]);})[_0x9ef0('0x25')](function(_0x82bece){var _0x47f8fe=_0x592e4c[_0x9ef0('0x54')][_0x9ef0('0x27')]({'plain':!![]});if(!_0x47f8fe)throw new Error(_0x9ef0('0x55'));if(_0x47f8fe[_0x9ef0('0x56')]===_0x9ef0('0x54')){var _0x2745f4=_0x82bece[_0x9ef0('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x9ef0('0x4c')]({'where':{'name':'CannedAnswers','userProfileId':_0x47f8fe[_0x9ef0('0x57')]},'raw':!![]})[_0x9ef0('0x25')](function(_0x4fb6cf){if(_0x4fb6cf&&_0x4fb6cf[_0x9ef0('0x58')]===0x0){return db[_0x9ef0('0x59')]['create']({'name':_0x2745f4[_0x9ef0('0x2b')],'resourceId':_0x2745f4['id'],'type':_0x4fb6cf[_0x9ef0('0x2b')],'sectionId':_0x4fb6cf['id']},{})[_0x9ef0('0x25')](function(){return _0x82bece;});}else{return _0x82bece;}})['catch'](function(_0x7374e1){logger[_0x9ef0('0x29')](_0x9ef0('0x5a'),_0x7374e1);throw _0x7374e1;});}return _0x82bece;})['then'](respondWithResult(_0x49c7ae,0xc9))[_0x9ef0('0x4a')](handleError(_0x49c7ae,null));}; \ No newline at end of file +var _0xc76e=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','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','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','CannedAnswer','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length'];(function(_0x27af7d,_0x2a2269){var _0x122d1f=function(_0xd84e7e){while(--_0xd84e7e){_0x27af7d['push'](_0x27af7d['shift']());}};_0x122d1f(++_0x2a2269);}(_0xc76e,0x1cf));var _0xec76=function(_0x29e8a1,_0xa8c01){_0x29e8a1=_0x29e8a1-0x0;var _0x54b5f7=_0xc76e[_0x29e8a1];return _0x54b5f7;};'use strict';var emlformat=require(_0xec76('0x0'));var rimraf=require(_0xec76('0x1'));var zipdir=require(_0xec76('0x2'));var jsonpatch=require(_0xec76('0x3'));var rp=require(_0xec76('0x4'));var moment=require(_0xec76('0x5'));var BPromise=require(_0xec76('0x6'));var Mustache=require('mustache');var util=require(_0xec76('0x7'));var path=require('path');var sox=require(_0xec76('0x8'));var csv=require(_0xec76('0x9'));var ejs=require(_0xec76('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xec76('0xb'));var crypto=require('crypto');var jsforce=require(_0xec76('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec76('0x9'));var querystring=require(_0xec76('0xd'));var Papa=require(_0xec76('0xe'));var Redis=require(_0xec76('0xf'));var authService=require(_0xec76('0x10'));var qs=require(_0xec76('0x11'));var as=require(_0xec76('0x12'));var hardwareService=require(_0xec76('0x13'));var logger=require(_0xec76('0x14'))(_0xec76('0x15'));var utils=require(_0xec76('0x16'));var config=require(_0xec76('0x17'));var licenseUtil=require(_0xec76('0x18'));var db=require(_0xec76('0x19'))['db'];function respondWithStatusCode(_0x86a05b,_0x4eef04){_0x4eef04=_0x4eef04||0xcc;return function(_0x421c70){if(_0x421c70){return _0x86a05b[_0xec76('0x1a')](_0x4eef04);}return _0x86a05b[_0xec76('0x1b')](_0x4eef04)[_0xec76('0x1c')]();};}function respondWithResult(_0x2596bd,_0x32adb7){_0x32adb7=_0x32adb7||0xc8;return function(_0x268e0a){if(_0x268e0a){return _0x2596bd['status'](_0x32adb7)[_0xec76('0x1d')](_0x268e0a);}};}function respondWithFilteredResult(_0x181bc0,_0x43712d){return function(_0x65fd21){if(_0x65fd21){var _0x40ef94=typeof _0x43712d['offset']==='undefined'&&typeof _0x43712d[_0xec76('0x1e')]===_0xec76('0x1f');var _0x141cd1=_0x65fd21[_0xec76('0x20')];var _0x443edc=_0x40ef94?0x0:_0x43712d[_0xec76('0x21')];var _0x51173d=_0x40ef94?_0x65fd21[_0xec76('0x20')]:_0x43712d[_0xec76('0x21')]+_0x43712d[_0xec76('0x1e')];var _0x16cb35;if(_0x51173d>=_0x141cd1){_0x51173d=_0x141cd1;_0x16cb35=0xc8;}else{_0x16cb35=0xce;}_0x181bc0[_0xec76('0x1b')](_0x16cb35);return _0x181bc0[_0xec76('0x22')](_0xec76('0x23'),_0x443edc+'-'+_0x51173d+'/'+_0x141cd1)[_0xec76('0x1d')](_0x65fd21);}return null;};}function patchUpdates(_0x41b4d2){return function(_0x12c348){try{jsonpatch[_0xec76('0x24')](_0x12c348,_0x41b4d2,!![]);}catch(_0x17657a){return BPromise[_0xec76('0x25')](_0x17657a);}return _0x12c348[_0xec76('0x26')]();};}function saveUpdates(_0x14c857,_0x4bde3d){return function(_0x416621){if(_0x416621){return _0x416621[_0xec76('0x27')](_0x14c857)[_0xec76('0x28')](function(_0x1d3fce){return _0x1d3fce;});}return null;};}function removeEntity(_0x421dbe,_0xe2bfa2){return function(_0x5d063c){if(_0x5d063c){return _0x5d063c[_0xec76('0x29')]()[_0xec76('0x28')](function(){var _0x2aa328=_0x5d063c[_0xec76('0x2a')]({'plain':!![]});var _0x1c801b='CannedAnswers';return db[_0xec76('0x2b')][_0xec76('0x29')]({'where':{'type':_0x1c801b,'resourceId':_0x2aa328['id']}})[_0xec76('0x28')](function(){return _0x5d063c;});})[_0xec76('0x28')](function(){_0x421dbe[_0xec76('0x1b')](0xcc)[_0xec76('0x1c')]();});}};}function handleEntityNotFound(_0x2c202d,_0x23508a){return function(_0xac4234){if(!_0xac4234){_0x2c202d['sendStatus'](0x194);}return _0xac4234;};}function handleError(_0x2192c2,_0x49f531){_0x49f531=_0x49f531||0x1f4;return function(_0x526b79){logger[_0xec76('0x2c')](_0x526b79['stack']);if(_0x526b79[_0xec76('0x2d')]){delete _0x526b79['name'];}_0x2192c2['status'](_0x49f531)[_0xec76('0x2e')](_0x526b79);};}exports['index']=function(_0x33fbab,_0x927cbc){var _0x663dc4={},_0xda8805={},_0x393e54={'count':0x0,'rows':[]};var _0x1d1f6d=_[_0xec76('0x2f')](db[_0xec76('0x30')][_0xec76('0x31')],function(_0x3d9a8e){return{'name':_0x3d9a8e[_0xec76('0x32')],'type':_0x3d9a8e['type']['key']};});_0xda8805['model']=_[_0xec76('0x2f')](_0x1d1f6d,_0xec76('0x2d'));_0xda8805[_0xec76('0x33')]=_[_0xec76('0x34')](_0x33fbab['query']);_0xda8805[_0xec76('0x35')]=_['intersection'](_0xda8805[_0xec76('0x36')],_0xda8805['query']);_0x663dc4[_0xec76('0x37')]=_[_0xec76('0x38')](_0xda8805[_0xec76('0x36')],qs['fields'](_0x33fbab['query'][_0xec76('0x39')]));_0x663dc4['attributes']=_0x663dc4['attributes'][_0xec76('0x3a')]?_0x663dc4[_0xec76('0x37')]:_0xda8805[_0xec76('0x36')];if(!_0x33fbab[_0xec76('0x33')]['hasOwnProperty'](_0xec76('0x3b'))){_0x663dc4['limit']=qs[_0xec76('0x1e')](_0x33fbab[_0xec76('0x33')][_0xec76('0x1e')]);_0x663dc4[_0xec76('0x21')]=qs['offset'](_0x33fbab[_0xec76('0x33')][_0xec76('0x21')]);}_0x663dc4[_0xec76('0x3c')]=qs[_0xec76('0x3d')](_0x33fbab['query'][_0xec76('0x3d')]);_0x663dc4[_0xec76('0x3e')]=qs['filters'](_[_0xec76('0x3f')](_0x33fbab[_0xec76('0x33')],_0xda8805[_0xec76('0x35')]),_0x1d1f6d);if(_0x33fbab[_0xec76('0x33')][_0xec76('0x40')]){_0x663dc4[_0xec76('0x3e')]=_[_0xec76('0x41')](_0x663dc4['where'],{'$or':[{'key':{'$like':'%'+_0x33fbab[_0xec76('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x33fbab['query']['filter']+'%'}}]});}_0x663dc4=_[_0xec76('0x41')]({},_0x663dc4,_0x33fbab[_0xec76('0x42')]);var _0x4de13a={'where':_0x663dc4[_0xec76('0x3e')]};return db['CannedAnswer'][_0xec76('0x20')](_0x4de13a)[_0xec76('0x28')](function(_0x5ce3e3){_0x393e54['count']=_0x5ce3e3;if(_0x33fbab[_0xec76('0x33')][_0xec76('0x43')]){_0x663dc4[_0xec76('0x44')]=[{'all':!![]}];}return db[_0xec76('0x30')][_0xec76('0x45')](_0x663dc4);})[_0xec76('0x28')](function(_0x1fcb35){_0x393e54[_0xec76('0x46')]=_0x1fcb35;return _0x393e54;})[_0xec76('0x28')](respondWithFilteredResult(_0x927cbc,_0x663dc4))[_0xec76('0x47')](handleError(_0x927cbc,null));};exports['show']=function(_0x111b9e,_0x36e581){var _0x26c161={'raw':!![],'where':{'id':_0x111b9e['params']['id']}},_0x2add39={};_0x2add39[_0xec76('0x36')]=_[_0xec76('0x34')](db[_0xec76('0x30')][_0xec76('0x31')]);_0x2add39['query']=_[_0xec76('0x34')](_0x111b9e[_0xec76('0x33')]);_0x2add39['filters']=_[_0xec76('0x38')](_0x2add39[_0xec76('0x36')],_0x2add39[_0xec76('0x33')]);_0x26c161[_0xec76('0x37')]=_['intersection'](_0x2add39[_0xec76('0x36')],qs[_0xec76('0x39')](_0x111b9e['query']['fields']));_0x26c161['attributes']=_0x26c161[_0xec76('0x37')][_0xec76('0x3a')]?_0x26c161[_0xec76('0x37')]:_0x2add39[_0xec76('0x36')];if(_0x111b9e[_0xec76('0x33')][_0xec76('0x43')]){_0x26c161['include']=[{'all':!![]}];}_0x26c161=_[_0xec76('0x41')]({},_0x26c161,_0x111b9e[_0xec76('0x42')]);return db[_0xec76('0x30')][_0xec76('0x48')](_0x26c161)['then'](handleEntityNotFound(_0x36e581,null))['then'](respondWithResult(_0x36e581,null))[_0xec76('0x47')](handleError(_0x36e581,null));};exports[_0xec76('0x27')]=function(_0x40f009,_0x54aca7){if(_0x40f009[_0xec76('0x49')]['id']){delete _0x40f009[_0xec76('0x49')]['id'];}return db[_0xec76('0x30')][_0xec76('0x48')]({'where':{'id':_0x40f009[_0xec76('0x4a')]['id']}})[_0xec76('0x28')](handleEntityNotFound(_0x54aca7,null))[_0xec76('0x28')](saveUpdates(_0x40f009['body'],null))[_0xec76('0x28')](respondWithResult(_0x54aca7,null))[_0xec76('0x47')](handleError(_0x54aca7,null));};exports[_0xec76('0x29')]=function(_0xb1c01b,_0x426c9c){return db[_0xec76('0x30')][_0xec76('0x48')]({'where':{'id':_0xb1c01b['params']['id']}})[_0xec76('0x28')](handleEntityNotFound(_0x426c9c,null))[_0xec76('0x28')](removeEntity(_0x426c9c,null))['catch'](handleError(_0x426c9c,null));};exports[_0xec76('0x4b')]=function(_0x14fa57,_0x456b71){var _0x348933={'key':_0x14fa57[_0xec76('0x49')]['key']};if(_0x14fa57[_0xec76('0x49')][_0xec76('0x4c')]){_0x348933['MailAccountId']=_0x14fa57[_0xec76('0x49')][_0xec76('0x4c')];}else if(_0x14fa57['body'][_0xec76('0x4d')]){_0x348933['SmsAccountId']=_0x14fa57['body'][_0xec76('0x4d')];}else if(_0x14fa57['body'][_0xec76('0x4e')]){_0x348933[_0xec76('0x4e')]=_0x14fa57[_0xec76('0x49')][_0xec76('0x4e')];}else if(_0x14fa57[_0xec76('0x49')]['ChatWebsiteId']){_0x348933[_0xec76('0x4f')]=_0x14fa57[_0xec76('0x49')][_0xec76('0x4f')];}return db['CannedAnswer']['find']({'where':_0x348933})[_0xec76('0x28')](function(_0x1e979b){if(_0x1e979b){throw new db[(_0xec76('0x50'))][(_0xec76('0x51'))](_0xec76('0x52'));}return db['CannedAnswer'][_0xec76('0x4b')](_0x14fa57[_0xec76('0x49')]);})[_0xec76('0x28')](function(_0x4a8ccc){var _0x2fbd79=_0x14fa57[_0xec76('0x53')][_0xec76('0x2a')]({'plain':!![]});if(!_0x2fbd79)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbd79[_0xec76('0x54')]===_0xec76('0x53')){var _0x155aad=_0x4a8ccc[_0xec76('0x2a')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'CannedAnswers','userProfileId':_0x2fbd79[_0xec76('0x55')]},'raw':!![]})[_0xec76('0x28')](function(_0x25721a){if(_0x25721a&&_0x25721a['autoAssociation']===0x0){return db[_0xec76('0x2b')][_0xec76('0x4b')]({'name':_0x155aad[_0xec76('0x2d')],'resourceId':_0x155aad['id'],'type':_0x25721a[_0xec76('0x2d')],'sectionId':_0x25721a['id']},{})[_0xec76('0x28')](function(){return _0x4a8ccc;});}else{return _0x4a8ccc;}})[_0xec76('0x47')](function(_0x519160){logger[_0xec76('0x2c')](_0xec76('0x56'),_0x519160);throw _0x519160;});}return _0x4a8ccc;})['then'](respondWithResult(_0x456b71,0xc9))['catch'](handleError(_0x456b71,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1870403..6cfa3f0 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 _0x453b=['define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x1e59d4,_0x861818){var _0x4b88cc=function(_0x93558d){while(--_0x93558d){_0x1e59d4['push'](_0x1e59d4['shift']());}};_0x4b88cc(++_0x861818);}(_0x453b,0x164));var _0xb453=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x453b[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xb453('0x0'));var util=require(_0xb453('0x1'));var logger=require(_0xb453('0x2'))(_0xb453('0x3'));var moment=require(_0xb453('0x4'));var BPromise=require(_0xb453('0x5'));var rp=require(_0xb453('0x6'));var fs=require('fs');var path=require(_0xb453('0x7'));var rimraf=require(_0xb453('0x8'));var config=require(_0xb453('0x9'));var attributes=require(_0xb453('0xa'));module[_0xb453('0xb')]=function(_0x434695,_0x4d7c1e){return _0x434695[_0xb453('0xc')](_0xb453('0xd'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb453('0xe'),'collate':_0xb453('0xf')});}; \ No newline at end of file +var _0x9b34=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define'];(function(_0x3990e2,_0x3d123e){var _0x2c64ea=function(_0xb9d791){while(--_0xb9d791){_0x3990e2['push'](_0x3990e2['shift']());}};_0x2c64ea(++_0x3d123e);}(_0x9b34,0x9d));var _0x49b3=function(_0x53a6d8,_0x2349ca){_0x53a6d8=_0x53a6d8-0x0;var _0x430759=_0x9b34[_0x53a6d8];return _0x430759;};'use strict';var _=require(_0x49b3('0x0'));var util=require(_0x49b3('0x1'));var logger=require(_0x49b3('0x2'))(_0x49b3('0x3'));var moment=require('moment');var BPromise=require(_0x49b3('0x4'));var rp=require(_0x49b3('0x5'));var fs=require('fs');var path=require(_0x49b3('0x6'));var rimraf=require(_0x49b3('0x7'));var config=require('../../config/environment');var attributes=require(_0x49b3('0x8'));module[_0x49b3('0x9')]=function(_0xc5c07,_0x2af56d){return _0xc5c07[_0x49b3('0xa')](_0x49b3('0xb'),attributes,{'tableName':_0x49b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x49b3('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 21f18cc..40c20c6 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(_0x22ed83,_0x14f710){var _0x50ef73=function(_0x164d19){while(--_0x164d19){_0x22ed83['push'](_0x22ed83['shift']());}};_0x50ef73(++_0x14f710);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x237b54,_0xc1542b){var _0x63a9a5=function(_0x2da06d){while(--_0x2da06d){_0x237b54['push'](_0x237b54['shift']());}};_0x63a9a5(++_0xc1542b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 148dd64..c954eec 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 _0x562d=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x281e76,_0x8bde50){var _0x5ecce5=function(_0x2382bc){while(--_0x2382bc){_0x281e76['push'](_0x281e76['shift']());}};_0x5ecce5(++_0x8bde50);}(_0x562d,0x1a6));var _0xd562=function(_0xcc9399,_0x127ef1){_0xcc9399=_0xcc9399-0x0;var _0x6d6272=_0x562d[_0xcc9399];return _0x6d6272;};'use strict';var multer=require('multer');var util=require(_0xd562('0x0'));var path=require(_0xd562('0x1'));var timeout=require(_0xd562('0x2'));var express=require(_0xd562('0x3'));var router=express[_0xd562('0x4')]();var fs_extra=require(_0xd562('0x5'));var auth=require(_0xd562('0x6'));var interaction=require(_0xd562('0x7'));var config=require('../../config/environment');var controller=require(_0xd562('0x8'));router[_0xd562('0x9')]('/',auth[_0xd562('0xa')](),controller[_0xd562('0xb')]);router[_0xd562('0x9')](_0xd562('0xc'),auth['isAuthenticated'](),controller[_0xd562('0xd')]);router[_0xd562('0xe')]('/',auth[_0xd562('0xa')](),controller[_0xd562('0xf')]);router[_0xd562('0x10')](_0xd562('0xc'),auth[_0xd562('0xa')](),controller[_0xd562('0x11')]);router['delete'](_0xd562('0xc'),auth['isAuthenticated'](),controller[_0xd562('0x12')]);module[_0xd562('0x13')]=router; \ No newline at end of file +var _0x84f6=['update','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84f6,0xaf));var _0x684f=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x84f6[_0xf5d71c];return _0x5af672;};'use strict';var multer=require('multer');var util=require(_0x684f('0x0'));var path=require(_0x684f('0x1'));var timeout=require(_0x684f('0x2'));var express=require(_0x684f('0x3'));var router=express[_0x684f('0x4')]();var fs_extra=require(_0x684f('0x5'));var auth=require(_0x684f('0x6'));var interaction=require(_0x684f('0x7'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x684f('0x8')]('/',auth['isAuthenticated'](),controller[_0x684f('0x9')]);router[_0x684f('0x8')]('/:id',auth[_0x684f('0xa')](),controller[_0x684f('0xb')]);router[_0x684f('0xc')]('/',auth['isAuthenticated'](),controller[_0x684f('0xd')]);router[_0x684f('0xe')]('/:id',auth[_0x684f('0xa')](),controller[_0x684f('0xf')]);router['delete'](_0x684f('0x10'),auth[_0x684f('0xa')](),controller[_0x684f('0x11')]);module[_0x684f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8026dce..009ce58 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 _0x4a47=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x169de6,_0x471218){var _0x2ecfea=function(_0x4a5de6){while(--_0x4a5de6){_0x169de6['push'](_0x169de6['shift']());}};_0x2ecfea(++_0x471218);}(_0x4a47,0xb5));var _0x74a4=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0x4a47[_0xa388a2];return _0x7ce7f6;};'use strict';var Sequelize=require(_0x74a4('0x0'));module[_0x74a4('0x1')]={'calldate':{'type':Sequelize[_0x74a4('0x2')],'allowNull':![],'defaultValue':_0x74a4('0x3')},'clid':{'type':Sequelize[_0x74a4('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x74a4('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x74a4('0x4')]},'dstchannel':{'type':Sequelize[_0x74a4('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x74a4('0x4')]},'duration':{'type':Sequelize[_0x74a4('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x74a4('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x74a4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x74a4('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x74a4('0x4')]},'sequence':{'type':Sequelize[_0x74a4('0x4')]},'peeraccount':{'type':Sequelize[_0x74a4('0x4')]},'type':{'type':Sequelize[_0x74a4('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','INTEGER','DATE','1970-01-01\x2000:00:01'];(function(_0x4e7fbe,_0x585460){var _0x2e2277=function(_0x3f4cef){while(--_0x3f4cef){_0x4e7fbe['push'](_0x4e7fbe['shift']());}};_0x2e2277(++_0x585460);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x1')},'clid':{'type':Sequelize[_0x3071('0x2')]},'src':{'type':Sequelize[_0x3071('0x2')]},'dst':{'type':Sequelize[_0x3071('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3071('0x2')]},'dstchannel':{'type':Sequelize[_0x3071('0x2')]},'lastapp':{'type':Sequelize[_0x3071('0x2')]},'lastdata':{'type':Sequelize[_0x3071('0x2')]},'duration':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3071('0x2')]},'amaflags':{'type':Sequelize[_0x3071('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3071('0x2')]},'userfield':{'type':Sequelize[_0x3071('0x2')]},'uniqueid':{'type':Sequelize[_0x3071('0x2')]},'linkedid':{'type':Sequelize[_0x3071('0x2')]},'sequence':{'type':Sequelize[_0x3071('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3071('0x2')]},'tag':{'type':Sequelize[_0x3071('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 90b8ec5..9746085 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 _0xf873=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','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/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','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Cdr','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge'];(function(_0x31b9dc,_0x2ae97b){var _0x271209=function(_0x4d3035){while(--_0x4d3035){_0x31b9dc['push'](_0x31b9dc['shift']());}};_0x271209(++_0x2ae97b);}(_0xf873,0xb2));var _0x3f87=function(_0x8a8c51,_0x481527){_0x8a8c51=_0x8a8c51-0x0;var _0x5c79e8=_0xf873[_0x8a8c51];return _0x5c79e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f87('0x0'));var zipdir=require(_0x3f87('0x1'));var jsonpatch=require(_0x3f87('0x2'));var rp=require(_0x3f87('0x3'));var moment=require(_0x3f87('0x4'));var BPromise=require(_0x3f87('0x5'));var Mustache=require(_0x3f87('0x6'));var util=require(_0x3f87('0x7'));var path=require(_0x3f87('0x8'));var sox=require('sox');var csv=require(_0x3f87('0x9'));var ejs=require(_0x3f87('0xa'));var fs=require('fs');var fs_extra=require(_0x3f87('0xb'));var _=require('lodash');var squel=require(_0x3f87('0xc'));var crypto=require(_0x3f87('0xd'));var jsforce=require(_0x3f87('0xe'));var deskjs=require(_0x3f87('0xf'));var toCsv=require(_0x3f87('0x9'));var querystring=require(_0x3f87('0x10'));var Papa=require('papaparse');var Redis=require(_0x3f87('0x11'));var authService=require(_0x3f87('0x12'));var qs=require(_0x3f87('0x13'));var as=require(_0x3f87('0x14'));var hardwareService=require(_0x3f87('0x15'));var logger=require(_0x3f87('0x16'))(_0x3f87('0x17'));var utils=require(_0x3f87('0x18'));var config=require(_0x3f87('0x19'));var licenseUtil=require(_0x3f87('0x1a'));var db=require(_0x3f87('0x1b'))['db'];function respondWithStatusCode(_0x593e9,_0xfd5b65){_0xfd5b65=_0xfd5b65||0xcc;return function(_0x160861){if(_0x160861){return _0x593e9['sendStatus'](_0xfd5b65);}return _0x593e9[_0x3f87('0x1c')](_0xfd5b65)[_0x3f87('0x1d')]();};}function respondWithResult(_0x4ea5c1,_0x1cfba3){_0x1cfba3=_0x1cfba3||0xc8;return function(_0x14324f){if(_0x14324f){return _0x4ea5c1[_0x3f87('0x1c')](_0x1cfba3)[_0x3f87('0x1e')](_0x14324f);}};}function respondWithFilteredResult(_0x3f192a,_0x1c8fb0){return function(_0xd6df66){if(_0xd6df66){var _0x2ccf4d=typeof _0x1c8fb0['offset']===_0x3f87('0x1f')&&typeof _0x1c8fb0[_0x3f87('0x20')]===_0x3f87('0x1f');var _0x4e1df8=_0xd6df66[_0x3f87('0x21')];var _0x56d79e=_0x2ccf4d?0x0:_0x1c8fb0[_0x3f87('0x22')];var _0x13550c=_0x2ccf4d?_0xd6df66[_0x3f87('0x21')]:_0x1c8fb0[_0x3f87('0x22')]+_0x1c8fb0[_0x3f87('0x20')];var _0x4fe75c;if(_0x13550c>=_0x4e1df8){_0x13550c=_0x4e1df8;_0x4fe75c=0xc8;}else{_0x4fe75c=0xce;}_0x3f192a[_0x3f87('0x1c')](_0x4fe75c);return _0x3f192a[_0x3f87('0x23')](_0x3f87('0x24'),_0x56d79e+'-'+_0x13550c+'/'+_0x4e1df8)[_0x3f87('0x1e')](_0xd6df66);}return null;};}function patchUpdates(_0x57f7c5){return function(_0x4acd30){try{jsonpatch['apply'](_0x4acd30,_0x57f7c5,!![]);}catch(_0x73aba6){return BPromise[_0x3f87('0x25')](_0x73aba6);}return _0x4acd30[_0x3f87('0x26')]();};}function saveUpdates(_0x5ed5f1,_0x17e411){return function(_0xb01673){if(_0xb01673){return _0xb01673[_0x3f87('0x27')](_0x5ed5f1)[_0x3f87('0x28')](function(_0x15fad7){return _0x15fad7;});}return null;};}function removeEntity(_0x46d773,_0x30b061){return function(_0xea7dda){if(_0xea7dda){return _0xea7dda[_0x3f87('0x29')]()[_0x3f87('0x28')](function(){_0x46d773[_0x3f87('0x1c')](0xcc)[_0x3f87('0x1d')]();});}};}function handleEntityNotFound(_0x5ca13a,_0x3d03d7){return function(_0x9ed827){if(!_0x9ed827){_0x5ca13a[_0x3f87('0x2a')](0x194);}return _0x9ed827;};}function handleError(_0x5922e9,_0x49674f){_0x49674f=_0x49674f||0x1f4;return function(_0x41f9e9){logger[_0x3f87('0x2b')](_0x41f9e9[_0x3f87('0x2c')]);if(_0x41f9e9[_0x3f87('0x2d')]){delete _0x41f9e9[_0x3f87('0x2d')];}_0x5922e9[_0x3f87('0x1c')](_0x49674f)[_0x3f87('0x2e')](_0x41f9e9);};}exports[_0x3f87('0x2f')]=function(_0x113e40,_0x2e18cb){var _0x43576d={},_0x407828={},_0x439a7d={'count':0x0,'rows':[]};var _0x241d88=_[_0x3f87('0x30')](db[_0x3f87('0x31')]['rawAttributes'],function(_0x150dbb){return{'name':_0x150dbb[_0x3f87('0x32')],'type':_0x150dbb[_0x3f87('0x33')][_0x3f87('0x34')]};});_0x407828['model']=_['map'](_0x241d88,'name');_0x407828[_0x3f87('0x35')]=_[_0x3f87('0x36')](_0x113e40[_0x3f87('0x35')]);_0x407828[_0x3f87('0x37')]=_[_0x3f87('0x38')](_0x407828['model'],_0x407828[_0x3f87('0x35')]);_0x43576d['attributes']=_[_0x3f87('0x38')](_0x407828[_0x3f87('0x39')],qs[_0x3f87('0x3a')](_0x113e40[_0x3f87('0x35')][_0x3f87('0x3a')]));_0x43576d[_0x3f87('0x3b')]=_0x43576d[_0x3f87('0x3b')]['length']?_0x43576d['attributes']:_0x407828[_0x3f87('0x39')];if(!_0x113e40[_0x3f87('0x35')][_0x3f87('0x3c')](_0x3f87('0x3d'))){_0x43576d[_0x3f87('0x20')]=qs[_0x3f87('0x20')](_0x113e40[_0x3f87('0x35')]['limit']);_0x43576d[_0x3f87('0x22')]=qs['offset'](_0x113e40[_0x3f87('0x35')][_0x3f87('0x22')]);}_0x43576d[_0x3f87('0x3e')]=qs[_0x3f87('0x3f')](_0x113e40['query'][_0x3f87('0x3f')]);_0x43576d['where']=qs[_0x3f87('0x37')](_[_0x3f87('0x40')](_0x113e40[_0x3f87('0x35')],_0x407828[_0x3f87('0x37')]),_0x241d88);if(_0x113e40[_0x3f87('0x35')]['filter']){_0x43576d['where']=_['merge'](_0x43576d[_0x3f87('0x41')],{'$or':_[_0x3f87('0x30')](_0x241d88,function(_0x33c9f5){if(_0x33c9f5[_0x3f87('0x33')]!==_0x3f87('0x42')){var _0x18656a={};_0x18656a[_0x33c9f5['name']]={'$like':'%'+_0x113e40[_0x3f87('0x35')]['filter']+'%'};return _0x18656a;}})});}_0x43576d=_[_0x3f87('0x43')]({},_0x43576d,_0x113e40[_0x3f87('0x44')]);var _0x4cd683={'where':_0x43576d[_0x3f87('0x41')]};return db[_0x3f87('0x31')][_0x3f87('0x21')](_0x4cd683)['then'](function(_0x246976){_0x439a7d['count']=_0x246976;if(_0x113e40['query'][_0x3f87('0x45')]){_0x43576d[_0x3f87('0x46')]=[{'all':!![]}];}return db[_0x3f87('0x31')][_0x3f87('0x47')](_0x43576d);})[_0x3f87('0x28')](function(_0x4d9a67){_0x439a7d[_0x3f87('0x48')]=_0x4d9a67;return _0x439a7d;})[_0x3f87('0x28')](respondWithFilteredResult(_0x2e18cb,_0x43576d))[_0x3f87('0x49')](handleError(_0x2e18cb,null));};exports[_0x3f87('0x4a')]=function(_0x50ca7f,_0x13e99f){var _0x458c79={'raw':!![],'where':{'id':_0x50ca7f[_0x3f87('0x4b')]['id']}},_0x33b9ea={};_0x33b9ea[_0x3f87('0x39')]=_[_0x3f87('0x36')](db[_0x3f87('0x31')][_0x3f87('0x4c')]);_0x33b9ea['query']=_['keys'](_0x50ca7f[_0x3f87('0x35')]);_0x33b9ea[_0x3f87('0x37')]=_[_0x3f87('0x38')](_0x33b9ea[_0x3f87('0x39')],_0x33b9ea[_0x3f87('0x35')]);_0x458c79[_0x3f87('0x3b')]=_[_0x3f87('0x38')](_0x33b9ea[_0x3f87('0x39')],qs[_0x3f87('0x3a')](_0x50ca7f[_0x3f87('0x35')][_0x3f87('0x3a')]));_0x458c79['attributes']=_0x458c79[_0x3f87('0x3b')][_0x3f87('0x4d')]?_0x458c79[_0x3f87('0x3b')]:_0x33b9ea[_0x3f87('0x39')];if(_0x50ca7f[_0x3f87('0x35')][_0x3f87('0x45')]){_0x458c79[_0x3f87('0x46')]=[{'all':!![]}];}_0x458c79=_[_0x3f87('0x43')]({},_0x458c79,_0x50ca7f[_0x3f87('0x44')]);return db[_0x3f87('0x31')][_0x3f87('0x4e')](_0x458c79)['then'](handleEntityNotFound(_0x13e99f,null))[_0x3f87('0x28')](respondWithResult(_0x13e99f,null))[_0x3f87('0x49')](handleError(_0x13e99f,null));};exports[_0x3f87('0x4f')]=function(_0x4ec3e4,_0x19d928){return db[_0x3f87('0x31')][_0x3f87('0x4f')](_0x4ec3e4[_0x3f87('0x50')],{})[_0x3f87('0x28')](respondWithResult(_0x19d928,0xc9))[_0x3f87('0x49')](handleError(_0x19d928,null));};exports[_0x3f87('0x27')]=function(_0x5799eb,_0x163ebf){if(_0x5799eb[_0x3f87('0x50')]['id']){delete _0x5799eb[_0x3f87('0x50')]['id'];}return db[_0x3f87('0x31')][_0x3f87('0x4e')]({'where':{'id':_0x5799eb[_0x3f87('0x4b')]['id']}})[_0x3f87('0x28')](handleEntityNotFound(_0x163ebf,null))[_0x3f87('0x28')](saveUpdates(_0x5799eb[_0x3f87('0x50')],null))[_0x3f87('0x28')](respondWithResult(_0x163ebf,null))[_0x3f87('0x49')](handleError(_0x163ebf,null));};exports[_0x3f87('0x29')]=function(_0x53783f,_0x25c95f){return db['Cdr'][_0x3f87('0x4e')]({'where':{'id':_0x53783f[_0x3f87('0x4b')]['id']}})[_0x3f87('0x28')](handleEntityNotFound(_0x25c95f,null))[_0x3f87('0x28')](removeEntity(_0x25c95f,null))[_0x3f87('0x49')](handleError(_0x25c95f,null));};exports[_0x3f87('0x51')]=function(_0x560567,_0x46dee4){return db[_0x3f87('0x31')][_0x3f87('0x51')]()[_0x3f87('0x28')](respondWithResult(_0x46dee4,null))[_0x3f87('0x49')](handleError(_0x46dee4,null));}; \ No newline at end of file +var _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0xb7879d,_0x4c5abe){var _0x3ee92d=function(_0x46e032){while(--_0x46e032){_0xb7879d['push'](_0xb7879d['shift']());}};_0x3ee92d(++_0x4c5abe);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f821c2b..0ad9aec 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x428d97,_0x7e5692){var _0x29009d=function(_0xa4397f){while(--_0xa4397f){_0x428d97['push'](_0x428d97['shift']());}};_0x29009d(++_0x7e5692);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x44c873,_0x3b1beb){var _0x41df51=function(_0x54816f){while(--_0x54816f){_0x44c873['push'](_0x44c873['shift']());}};_0x41df51(++_0x3b1beb);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6cbb0a6..3b280f5 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 _0x4352=['jayson/promise','client','http','request','then','info','request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0x4352,0x163));var _0x2435=function(_0x114d31,_0x5ec6c3){_0x114d31=_0x114d31-0x0;var _0x763cc7=_0x4352[_0x114d31];return _0x763cc7;};'use strict';var _=require(_0x2435('0x0'));var util=require(_0x2435('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2435('0x2'));var fs=require('fs');var Redis=require(_0x2435('0x3'));var db=require(_0x2435('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2435('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2435('0x6'));var client=jayson[_0x2435('0x7')][_0x2435('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d794f,_0x4b0202,_0x31f0de){return new BPromise(function(_0x367052,_0x311935){return client[_0x2435('0x9')](_0x2d794f,_0x31f0de)[_0x2435('0xa')](function(_0x59e5e4){logger[_0x2435('0xb')]('Cdr,\x20%s,\x20%s',_0x4b0202,_0x2435('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4b0202,_0x2435('0xc'),JSON['stringify'](_0x59e5e4));if(_0x59e5e4[_0x2435('0xd')]){if(_0x59e5e4[_0x2435('0xd')][_0x2435('0xe')]===0x1f4){logger[_0x2435('0xd')](_0x2435('0xf'),_0x4b0202,_0x59e5e4[_0x2435('0xd')]['message']);return _0x311935(_0x59e5e4[_0x2435('0xd')]['message']);}logger[_0x2435('0xd')](_0x2435('0xf'),_0x4b0202,_0x59e5e4[_0x2435('0xd')]['message']);return _0x367052(_0x59e5e4[_0x2435('0xd')][_0x2435('0x10')]);}else{logger[_0x2435('0xb')](_0x2435('0xf'),_0x4b0202,'request\x20sent');_0x367052(_0x59e5e4[_0x2435('0x11')][_0x2435('0x10')]);}})[_0x2435('0x12')](function(_0xe38d1c){logger[_0x2435('0xd')](_0x2435('0xf'),_0x4b0202,_0xe38d1c);_0x311935(_0xe38d1c);});});} \ No newline at end of file +var _0x33bc=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Cdr,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x33bc,0xf1));var _0xc33b=function(_0x57647e,_0x3ac4f1){_0x57647e=_0x57647e-0x0;var _0x4fb69c=_0x33bc[_0x57647e];return _0x4fb69c;};'use strict';var _=require('lodash');var util=require(_0xc33b('0x0'));var moment=require(_0xc33b('0x1'));var BPromise=require(_0xc33b('0x2'));var rs=require(_0xc33b('0x3'));var fs=require('fs');var Redis=require(_0xc33b('0x4'));var db=require(_0xc33b('0x5'))['db'];var utils=require(_0xc33b('0x6'));var logger=require(_0xc33b('0x7'))(_0xc33b('0x8'));var config=require(_0xc33b('0x9'));var jayson=require(_0xc33b('0xa'));var client=jayson[_0xc33b('0xb')][_0xc33b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x329da5,_0x1fd21e,_0x30a49a){return new BPromise(function(_0x46ab0c,_0x5097a4){return client[_0xc33b('0xd')](_0x329da5,_0x30a49a)[_0xc33b('0xe')](function(_0xf5efd9){logger[_0xc33b('0xf')]('Cdr,\x20%s,\x20%s',_0x1fd21e,_0xc33b('0x10'));logger[_0xc33b('0x11')](_0xc33b('0x12'),_0x1fd21e,_0xc33b('0x10'),JSON[_0xc33b('0x13')](_0xf5efd9));if(_0xf5efd9['error']){if(_0xf5efd9['error'][_0xc33b('0x14')]===0x1f4){logger[_0xc33b('0x15')]('Cdr,\x20%s,\x20%s',_0x1fd21e,_0xf5efd9[_0xc33b('0x15')]['message']);return _0x5097a4(_0xf5efd9[_0xc33b('0x15')][_0xc33b('0x16')]);}logger[_0xc33b('0x15')]('Cdr,\x20%s,\x20%s',_0x1fd21e,_0xf5efd9[_0xc33b('0x15')][_0xc33b('0x16')]);return _0x46ab0c(_0xf5efd9['error']['message']);}else{logger[_0xc33b('0xf')](_0xc33b('0x17'),_0x1fd21e,_0xc33b('0x10'));_0x46ab0c(_0xf5efd9['result'][_0xc33b('0x16')]);}})[_0xc33b('0x18')](function(_0x4a7aee){logger[_0xc33b('0x15')](_0xc33b('0x17'),_0x1fd21e,_0x4a7aee);_0x5097a4(_0x4a7aee);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0ce2962..192e889 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(_0x3b20c2,_0x888661){var _0x5b4482=function(_0x15b274){while(--_0x15b274){_0x3b20c2['push'](_0x3b20c2['shift']());}};_0x5b4482(++_0x888661);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index ee25abf..7d8f6b5 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 _0xf09b=['*,*,*,*','sequelize','STRING','TEXT'];(function(_0x5ce822,_0x3ed24f){var _0x5da388=function(_0x344e62){while(--_0x344e62){_0x5ce822['push'](_0x5ce822['shift']());}};_0x5da388(++_0x3ed24f);}(_0xf09b,0x6d));var _0xbf09=function(_0x3d80fb,_0x633372){_0x3d80fb=_0x3d80fb-0x0;var _0x40eebe=_0xf09b[_0x3d80fb];return _0x40eebe;};'use strict';var Sequelize=require(_0xbf09('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbf09('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbf09('0x2')]()},'description':{'type':Sequelize[_0xbf09('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbf09('0x3')}}; \ No newline at end of file +var _0xf89b=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x27f614,_0x2b0fdc){var _0x533fe0=function(_0x2f42f5){while(--_0x2f42f5){_0x27f614['push'](_0x27f614['shift']());}};_0x533fe0(++_0x2b0fdc);}(_0xf89b,0x95));var _0xbf89=function(_0xc1b4e5,_0x446061){_0xc1b4e5=_0xc1b4e5-0x0;var _0x526518=_0xf89b[_0xc1b4e5];return _0x526518;};'use strict';var Sequelize=require(_0xbf89('0x0'));module[_0xbf89('0x1')]={'priority':{'type':Sequelize[_0xbf89('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbf89('0x3')],'allowNull':![],'defaultValue':_0xbf89('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbf89('0x3')]},'interval':{'type':Sequelize[_0xbf89('0x3')],'defaultValue':_0xbf89('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 1bf3d47..4c26651 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 _0x9656=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','show','params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','ChatApplication','find','catch','update','body','eml-format','zip-dir','fast-json-patch','moment','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9656,0x15e));var _0x6965=function(_0x3cfb9b,_0x31f26d){_0x3cfb9b=_0x3cfb9b-0x0;var _0x1b32b9=_0x9656[_0x3cfb9b];return _0x1b32b9;};'use strict';var emlformat=require(_0x6965('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6965('0x1'));var jsonpatch=require(_0x6965('0x2'));var rp=require('request-promise');var moment=require(_0x6965('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6965('0x4'));var sox=require('sox');var csv=require(_0x6965('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6965('0x6'));var _=require('lodash');var squel=require(_0x6965('0x7'));var crypto=require(_0x6965('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6965('0x5'));var querystring=require(_0x6965('0x9'));var Papa=require(_0x6965('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6965('0xb'));var hardwareService=require(_0x6965('0xc'));var logger=require(_0x6965('0xd'))('api');var utils=require(_0x6965('0xe'));var config=require(_0x6965('0xf'));var licenseUtil=require(_0x6965('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48a1d0,_0x396c0a){_0x396c0a=_0x396c0a||0xcc;return function(_0x585d14){if(_0x585d14){return _0x48a1d0[_0x6965('0x11')](_0x396c0a);}return _0x48a1d0[_0x6965('0x12')](_0x396c0a)[_0x6965('0x13')]();};}function respondWithResult(_0x509f01,_0x2d52d5){_0x2d52d5=_0x2d52d5||0xc8;return function(_0x209912){if(_0x209912){return _0x509f01[_0x6965('0x12')](_0x2d52d5)[_0x6965('0x14')](_0x209912);}};}function respondWithFilteredResult(_0x3777b1,_0xd759ba){return function(_0x35e280){if(_0x35e280){var _0x40e4f3=typeof _0xd759ba[_0x6965('0x15')]===_0x6965('0x16')&&typeof _0xd759ba[_0x6965('0x17')]==='undefined';var _0x17f50e=_0x35e280[_0x6965('0x18')];var _0xc31577=_0x40e4f3?0x0:_0xd759ba['offset'];var _0x31e3f5=_0x40e4f3?_0x35e280[_0x6965('0x18')]:_0xd759ba[_0x6965('0x15')]+_0xd759ba[_0x6965('0x17')];var _0x130eff;if(_0x31e3f5>=_0x17f50e){_0x31e3f5=_0x17f50e;_0x130eff=0xc8;}else{_0x130eff=0xce;}_0x3777b1['status'](_0x130eff);return _0x3777b1[_0x6965('0x19')](_0x6965('0x1a'),_0xc31577+'-'+_0x31e3f5+'/'+_0x17f50e)[_0x6965('0x14')](_0x35e280);}return null;};}function patchUpdates(_0x263adc){return function(_0x5b9561){try{jsonpatch[_0x6965('0x1b')](_0x5b9561,_0x263adc,!![]);}catch(_0x414498){return BPromise['reject'](_0x414498);}return _0x5b9561[_0x6965('0x1c')]();};}function saveUpdates(_0x213e2c,_0x19148a){return function(_0x4e5015){if(_0x4e5015){return _0x4e5015['update'](_0x213e2c)[_0x6965('0x1d')](function(_0x38fd5b){return _0x38fd5b;});}return null;};}function removeEntity(_0x416ae4,_0x47d18b){return function(_0x175585){if(_0x175585){return _0x175585[_0x6965('0x1e')]()[_0x6965('0x1d')](function(){_0x416ae4[_0x6965('0x12')](0xcc)[_0x6965('0x13')]();});}};}function handleEntityNotFound(_0x1726bb,_0x3a0845){return function(_0x3568d5){if(!_0x3568d5){_0x1726bb[_0x6965('0x11')](0x194);}return _0x3568d5;};}function handleError(_0x77b7ac,_0x14cc29){_0x14cc29=_0x14cc29||0x1f4;return function(_0x3a8f78){logger[_0x6965('0x1f')](_0x3a8f78['stack']);if(_0x3a8f78[_0x6965('0x20')]){delete _0x3a8f78['name'];}_0x77b7ac[_0x6965('0x12')](_0x14cc29)['send'](_0x3a8f78);};}exports[_0x6965('0x21')]=function(_0x1ae67e,_0x35373c){var _0x538eeb={'raw':!![],'where':{'id':_0x1ae67e[_0x6965('0x22')]['id']}},_0x28715c={};_0x28715c[_0x6965('0x23')]=_[_0x6965('0x24')](db['ChatApplication'][_0x6965('0x25')]);_0x28715c[_0x6965('0x26')]=_[_0x6965('0x24')](_0x1ae67e[_0x6965('0x26')]);_0x28715c['filters']=_[_0x6965('0x27')](_0x28715c['model'],_0x28715c['query']);_0x538eeb['attributes']=_['intersection'](_0x28715c['model'],qs[_0x6965('0x28')](_0x1ae67e['query'][_0x6965('0x28')]));_0x538eeb[_0x6965('0x29')]=_0x538eeb['attributes'][_0x6965('0x2a')]?_0x538eeb['attributes']:_0x28715c[_0x6965('0x23')];if(_0x1ae67e[_0x6965('0x26')][_0x6965('0x2b')]){_0x538eeb[_0x6965('0x2c')]=[{'all':!![]}];}_0x538eeb=_[_0x6965('0x2d')]({},_0x538eeb,_0x1ae67e[_0x6965('0x2e')]);return db[_0x6965('0x2f')][_0x6965('0x30')](_0x538eeb)['then'](handleEntityNotFound(_0x35373c,null))[_0x6965('0x1d')](respondWithResult(_0x35373c,null))[_0x6965('0x31')](handleError(_0x35373c,null));};exports[_0x6965('0x32')]=function(_0x82c811,_0x5c6372){if(_0x82c811[_0x6965('0x33')]['id']){delete _0x82c811['body']['id'];}return db['ChatApplication'][_0x6965('0x30')]({'where':{'id':_0x82c811[_0x6965('0x22')]['id']}})[_0x6965('0x1d')](handleEntityNotFound(_0x5c6372,null))[_0x6965('0x1d')](saveUpdates(_0x82c811['body'],null))[_0x6965('0x1d')](respondWithResult(_0x5c6372,null))[_0x6965('0x31')](handleError(_0x5c6372,null));};exports['destroy']=function(_0x1d7a3d,_0x95ee61){return db[_0x6965('0x2f')][_0x6965('0x30')]({'where':{'id':_0x1d7a3d[_0x6965('0x22')]['id']}})[_0x6965('0x1d')](handleEntityNotFound(_0x95ee61,null))['then'](removeEntity(_0x95ee61,null))['catch'](handleError(_0x95ee61,null));}; \ No newline at end of file +var _0x325b=['stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0xd8f71e,_0xf0de01){var _0x260ebf=function(_0xfc9b67){while(--_0xfc9b67){_0xd8f71e['push'](_0xd8f71e['shift']());}};_0x260ebf(++_0xf0de01);}(_0x325b,0x8b));var _0xb325=function(_0xf9203a,_0x187b36){_0xf9203a=_0xf9203a-0x0;var _0x24c339=_0x325b[_0xf9203a];return _0x24c339;};'use strict';var emlformat=require(_0xb325('0x0'));var rimraf=require(_0xb325('0x1'));var zipdir=require(_0xb325('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb325('0x3'));var moment=require(_0xb325('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb325('0x5'));var path=require(_0xb325('0x6'));var sox=require(_0xb325('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb325('0x8'));var _=require('lodash');var squel=require(_0xb325('0x9'));var crypto=require(_0xb325('0xa'));var jsforce=require(_0xb325('0xb'));var deskjs=require(_0xb325('0xc'));var toCsv=require(_0xb325('0xd'));var querystring=require(_0xb325('0xe'));var Papa=require(_0xb325('0xf'));var Redis=require(_0xb325('0x10'));var authService=require(_0xb325('0x11'));var qs=require(_0xb325('0x12'));var as=require(_0xb325('0x13'));var hardwareService=require(_0xb325('0x14'));var logger=require(_0xb325('0x15'))(_0xb325('0x16'));var utils=require('../../config/utils');var config=require(_0xb325('0x17'));var licenseUtil=require(_0xb325('0x18'));var db=require(_0xb325('0x19'))['db'];function respondWithStatusCode(_0x1ee42f,_0x4ac26f){_0x4ac26f=_0x4ac26f||0xcc;return function(_0x306758){if(_0x306758){return _0x1ee42f[_0xb325('0x1a')](_0x4ac26f);}return _0x1ee42f['status'](_0x4ac26f)[_0xb325('0x1b')]();};}function respondWithResult(_0x1265f0,_0x2f0cf1){_0x2f0cf1=_0x2f0cf1||0xc8;return function(_0x266429){if(_0x266429){return _0x1265f0['status'](_0x2f0cf1)[_0xb325('0x1c')](_0x266429);}};}function respondWithFilteredResult(_0x437db0,_0x2b103c){return function(_0x10ce0f){if(_0x10ce0f){var _0x2d7398=typeof _0x2b103c[_0xb325('0x1d')]===_0xb325('0x1e')&&typeof _0x2b103c[_0xb325('0x1f')]==='undefined';var _0x318598=_0x10ce0f['count'];var _0x45d8ac=_0x2d7398?0x0:_0x2b103c[_0xb325('0x1d')];var _0x14ae19=_0x2d7398?_0x10ce0f['count']:_0x2b103c[_0xb325('0x1d')]+_0x2b103c[_0xb325('0x1f')];var _0x345647;if(_0x14ae19>=_0x318598){_0x14ae19=_0x318598;_0x345647=0xc8;}else{_0x345647=0xce;}_0x437db0[_0xb325('0x20')](_0x345647);return _0x437db0[_0xb325('0x21')](_0xb325('0x22'),_0x45d8ac+'-'+_0x14ae19+'/'+_0x318598)[_0xb325('0x1c')](_0x10ce0f);}return null;};}function patchUpdates(_0x214b30){return function(_0x3c322c){try{jsonpatch[_0xb325('0x23')](_0x3c322c,_0x214b30,!![]);}catch(_0x489f02){return BPromise['reject'](_0x489f02);}return _0x3c322c[_0xb325('0x24')]();};}function saveUpdates(_0x40e111,_0xcc088b){return function(_0x259afd){if(_0x259afd){return _0x259afd[_0xb325('0x25')](_0x40e111)[_0xb325('0x26')](function(_0x31ab78){return _0x31ab78;});}return null;};}function removeEntity(_0x4c1027,_0x2166d3){return function(_0x2ad861){if(_0x2ad861){return _0x2ad861[_0xb325('0x27')]()[_0xb325('0x26')](function(){_0x4c1027[_0xb325('0x20')](0xcc)[_0xb325('0x1b')]();});}};}function handleEntityNotFound(_0x4f9034,_0x32af3e){return function(_0x159864){if(!_0x159864){_0x4f9034[_0xb325('0x1a')](0x194);}return _0x159864;};}function handleError(_0x4f5838,_0x2afef7){_0x2afef7=_0x2afef7||0x1f4;return function(_0x3c7c7d){logger[_0xb325('0x28')](_0x3c7c7d[_0xb325('0x29')]);if(_0x3c7c7d[_0xb325('0x2a')]){delete _0x3c7c7d[_0xb325('0x2a')];}_0x4f5838[_0xb325('0x20')](_0x2afef7)['send'](_0x3c7c7d);};}exports[_0xb325('0x2b')]=function(_0x4732ac,_0x383034){var _0x4ff71d={'raw':!![],'where':{'id':_0x4732ac[_0xb325('0x2c')]['id']}},_0x2eff4f={};_0x2eff4f[_0xb325('0x2d')]=_[_0xb325('0x2e')](db[_0xb325('0x2f')][_0xb325('0x30')]);_0x2eff4f['query']=_['keys'](_0x4732ac[_0xb325('0x31')]);_0x2eff4f[_0xb325('0x32')]=_['intersection'](_0x2eff4f['model'],_0x2eff4f[_0xb325('0x31')]);_0x4ff71d[_0xb325('0x33')]=_[_0xb325('0x34')](_0x2eff4f['model'],qs[_0xb325('0x35')](_0x4732ac['query']['fields']));_0x4ff71d[_0xb325('0x33')]=_0x4ff71d[_0xb325('0x33')][_0xb325('0x36')]?_0x4ff71d[_0xb325('0x33')]:_0x2eff4f[_0xb325('0x2d')];if(_0x4732ac[_0xb325('0x31')]['includeAll']){_0x4ff71d[_0xb325('0x37')]=[{'all':!![]}];}_0x4ff71d=_['merge']({},_0x4ff71d,_0x4732ac[_0xb325('0x38')]);return db['ChatApplication'][_0xb325('0x39')](_0x4ff71d)[_0xb325('0x26')](handleEntityNotFound(_0x383034,null))[_0xb325('0x26')](respondWithResult(_0x383034,null))['catch'](handleError(_0x383034,null));};exports[_0xb325('0x25')]=function(_0x565052,_0x13ee29){if(_0x565052[_0xb325('0x3a')]['id']){delete _0x565052['body']['id'];}return db[_0xb325('0x2f')][_0xb325('0x39')]({'where':{'id':_0x565052['params']['id']}})[_0xb325('0x26')](handleEntityNotFound(_0x13ee29,null))[_0xb325('0x26')](saveUpdates(_0x565052[_0xb325('0x3a')],null))[_0xb325('0x26')](respondWithResult(_0x13ee29,null))[_0xb325('0x3b')](handleError(_0x13ee29,null));};exports[_0xb325('0x27')]=function(_0x515c86,_0xf9798a){return db['ChatApplication'][_0xb325('0x39')]({'where':{'id':_0x515c86['params']['id']}})[_0xb325('0x26')](handleEntityNotFound(_0xf9798a,null))[_0xb325('0x26')](removeEntity(_0xf9798a,null))['catch'](handleError(_0xf9798a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 1e6d168..27a4757 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 _0xa567=['utf8mb4_unicode_ci','../../config/logger','api','moment','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4'];(function(_0x282ff9,_0x268bfe){var _0x542612=function(_0x4ad95c){while(--_0x4ad95c){_0x282ff9['push'](_0x282ff9['shift']());}};_0x542612(++_0x268bfe);}(_0xa567,0x119));var _0x7a56=function(_0x4c23cc,_0x161581){_0x4c23cc=_0x4c23cc-0x0;var _0x105568=_0xa567[_0x4c23cc];return _0x105568;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7a56('0x0'))(_0x7a56('0x1'));var moment=require(_0x7a56('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a56('0x3'));var config=require(_0x7a56('0x4'));var attributes=require('./chatApplication.attributes');module[_0x7a56('0x5')]=function(_0x599375,_0x330344){return _0x599375['define'](_0x7a56('0x6'),attributes,{'tableName':_0x7a56('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a56('0x8'),'collate':_0x7a56('0x9')});}; \ No newline at end of file +var _0x22fb=['./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x46fc3d,_0x607a8d){var _0x18eaaf=function(_0x130c11){while(--_0x130c11){_0x46fc3d['push'](_0x46fc3d['shift']());}};_0x18eaaf(++_0x607a8d);}(_0x22fb,0x192));var _0xb22f=function(_0x5da3eb,_0x3d2bf8){_0x5da3eb=_0x5da3eb-0x0;var _0xc06d0e=_0x22fb[_0x5da3eb];return _0xc06d0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb22f('0xa'),'collate':_0xb22f('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index eaa9c6d..cf4b06b 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 _0x7861=['rpc','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1e62b8,_0x5eed4c){var _0x2ab271=function(_0x20f14e){while(--_0x20f14e){_0x1e62b8['push'](_0x1e62b8['shift']());}};_0x2ab271(++_0x5eed4c);}(_0x7861,0xfd));var _0x1786=function(_0x2c469a,_0x141579){_0x2c469a=_0x2c469a-0x0;var _0x448404=_0x7861[_0x2c469a];return _0x448404;};'use strict';var _=require('lodash');var util=require(_0x1786('0x0'));var moment=require(_0x1786('0x1'));var BPromise=require(_0x1786('0x2'));var rs=require(_0x1786('0x3'));var fs=require('fs');var Redis=require(_0x1786('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1786('0x5'));var logger=require(_0x1786('0x6'))(_0x1786('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1786('0x8')][_0x1786('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4743dc,_0x4b32f5,_0x165145){return new BPromise(function(_0x4baad5,_0x1a4e5b){return client[_0x1786('0xa')](_0x4743dc,_0x165145)[_0x1786('0xb')](function(_0x372fdc){logger['info'](_0x1786('0xc'),_0x4b32f5,_0x1786('0xd'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4b32f5,'request\x20sent',JSON[_0x1786('0xe')](_0x372fdc));if(_0x372fdc[_0x1786('0xf')]){if(_0x372fdc[_0x1786('0xf')][_0x1786('0x10')]===0x1f4){logger[_0x1786('0xf')](_0x1786('0xc'),_0x4b32f5,_0x372fdc[_0x1786('0xf')][_0x1786('0x11')]);return _0x1a4e5b(_0x372fdc[_0x1786('0xf')][_0x1786('0x11')]);}logger[_0x1786('0xf')]('ChatApplication,\x20%s,\x20%s',_0x4b32f5,_0x372fdc[_0x1786('0xf')][_0x1786('0x11')]);return _0x4baad5(_0x372fdc['error'][_0x1786('0x11')]);}else{logger[_0x1786('0x12')](_0x1786('0xc'),_0x4b32f5,_0x1786('0xd'));_0x4baad5(_0x372fdc['result']['message']);}})[_0x1786('0x13')](function(_0x5143c4){logger[_0x1786('0xf')](_0x1786('0xc'),_0x4b32f5,_0x5143c4);_0x1a4e5b(_0x5143c4);});});} \ No newline at end of file +var _0xdab6=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0xdab6,0x159));var _0x6dab=function(_0x16daee,_0xaf8850){_0x16daee=_0x16daee-0x0;var _0x436115=_0xdab6[_0x16daee];return _0x436115;};'use strict';var _=require('lodash');var util=require(_0x6dab('0x0'));var moment=require(_0x6dab('0x1'));var BPromise=require(_0x6dab('0x2'));var rs=require(_0x6dab('0x3'));var fs=require('fs');var Redis=require(_0x6dab('0x4'));var db=require(_0x6dab('0x5'))['db'];var utils=require(_0x6dab('0x6'));var logger=require('../../config/logger')(_0x6dab('0x7'));var config=require(_0x6dab('0x8'));var jayson=require(_0x6dab('0x9'));var client=jayson['client'][_0x6dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49452f,_0x20290e,_0x56fed3){return new BPromise(function(_0x140755,_0x26db02){return client[_0x6dab('0xb')](_0x49452f,_0x56fed3)['then'](function(_0x24ac94){logger[_0x6dab('0xc')](_0x6dab('0xd'),_0x20290e,_0x6dab('0xe'));logger['debug'](_0x6dab('0xf'),_0x20290e,_0x6dab('0xe'),JSON['stringify'](_0x24ac94));if(_0x24ac94[_0x6dab('0x10')]){if(_0x24ac94[_0x6dab('0x10')][_0x6dab('0x11')]===0x1f4){logger[_0x6dab('0x10')](_0x6dab('0xd'),_0x20290e,_0x24ac94['error']['message']);return _0x26db02(_0x24ac94[_0x6dab('0x10')][_0x6dab('0x12')]);}logger[_0x6dab('0x10')]('ChatApplication,\x20%s,\x20%s',_0x20290e,_0x24ac94[_0x6dab('0x10')][_0x6dab('0x12')]);return _0x140755(_0x24ac94[_0x6dab('0x10')][_0x6dab('0x12')]);}else{logger[_0x6dab('0xc')](_0x6dab('0xd'),_0x20290e,_0x6dab('0xe'));_0x140755(_0x24ac94[_0x6dab('0x13')][_0x6dab('0x12')]);}})[_0x6dab('0x14')](function(_0x37e704){logger[_0x6dab('0x10')](_0x6dab('0xd'),_0x20290e,_0x37e704);_0x26db02(_0x37e704);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 915c2b1..07470b4 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 _0x3a67=['isAuthenticated','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a67,0x136));var _0x73a6=function(_0x1db434,_0x3219d2){_0x1db434=_0x1db434-0x0;var _0x164ec0=_0x3a67[_0x1db434];return _0x164ec0;};'use strict';var multer=require(_0x73a6('0x0'));var util=require(_0x73a6('0x1'));var path=require('path');var timeout=require(_0x73a6('0x2'));var express=require(_0x73a6('0x3'));var router=express[_0x73a6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73a6('0x5'));var interaction=require(_0x73a6('0x6'));var config=require(_0x73a6('0x7'));var controller=require(_0x73a6('0x8'));router[_0x73a6('0x9')]('/:id',auth[_0x73a6('0xa')](),controller['show']);router[_0x73a6('0xb')](_0x73a6('0xc'),auth['isAuthenticated'](),controller[_0x73a6('0xd')]);router['delete'](_0x73a6('0xc'),auth['isAuthenticated'](),controller[_0x73a6('0xe')]);module[_0x73a6('0xf')]=router; \ No newline at end of file +var _0xdfd6=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x2ee84f,_0xcfa483){var _0x4f4ea6=function(_0x1fbb7b){while(--_0x1fbb7b){_0x2ee84f['push'](_0x2ee84f['shift']());}};_0x4f4ea6(++_0xcfa483);}(_0xdfd6,0x9a));var _0x6dfd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdfd6[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x6dfd('0x0'));var util=require(_0x6dfd('0x1'));var path=require('path');var timeout=require(_0x6dfd('0x2'));var express=require(_0x6dfd('0x3'));var router=express[_0x6dfd('0x4')]();var fs_extra=require(_0x6dfd('0x5'));var auth=require(_0x6dfd('0x6'));var interaction=require(_0x6dfd('0x7'));var config=require(_0x6dfd('0x8'));var controller=require(_0x6dfd('0x9'));router[_0x6dfd('0xa')](_0x6dfd('0xb'),auth[_0x6dfd('0xc')](),controller[_0x6dfd('0xd')]);router[_0x6dfd('0xe')](_0x6dfd('0xb'),auth[_0x6dfd('0xc')](),controller[_0x6dfd('0xf')]);router['delete']('/:id',auth[_0x6dfd('0xc')](),controller[_0x6dfd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 296ac80..01c5f9f 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 _0x260d=['STRING'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0x260d,0xc4));var _0xd260=function(_0x2ffd9d,_0x362ef3){_0x2ffd9d=_0x2ffd9d-0x0;var _0x99c04b=_0x260d[_0x2ffd9d];return _0x99c04b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd260('0x0')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4d1b=['sequelize','STRING','BOOLEAN'];(function(_0x121046,_0x4f06de){var _0x277354=function(_0x43424e){while(--_0x43424e){_0x121046['push'](_0x121046['shift']());}};_0x277354(++_0x4f06de);}(_0x4d1b,0x102));var _0xb4d1=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x4d1b[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xb4d1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4d1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb4d1('0x1')]},'write':{'type':Sequelize[_0xb4d1('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 566d317..3eb0b33 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 _0xe647=['body','describe','getUnread','user','toInteger','addMembers','ids','User','getMembers','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','ChatGroup','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find'];(function(_0x2f421,_0x5144c4){var _0x27b4af=function(_0x119470){while(--_0x119470){_0x2f421['push'](_0x2f421['shift']());}};_0x27b4af(++_0x5144c4);}(_0xe647,0x196));var _0x7e64=function(_0x3d77de,_0x1729df){_0x3d77de=_0x3d77de-0x0;var _0x2922b1=_0xe647[_0x3d77de];return _0x2922b1;};'use strict';var emlformat=require(_0x7e64('0x0'));var rimraf=require(_0x7e64('0x1'));var zipdir=require(_0x7e64('0x2'));var jsonpatch=require(_0x7e64('0x3'));var rp=require(_0x7e64('0x4'));var moment=require(_0x7e64('0x5'));var BPromise=require(_0x7e64('0x6'));var Mustache=require(_0x7e64('0x7'));var util=require(_0x7e64('0x8'));var path=require('path');var sox=require(_0x7e64('0x9'));var csv=require(_0x7e64('0xa'));var ejs=require(_0x7e64('0xb'));var fs=require('fs');var fs_extra=require(_0x7e64('0xc'));var _=require('lodash');var squel=require(_0x7e64('0xd'));var crypto=require('crypto');var jsforce=require(_0x7e64('0xe'));var deskjs=require(_0x7e64('0xf'));var toCsv=require(_0x7e64('0xa'));var querystring=require('querystring');var Papa=require(_0x7e64('0x10'));var Redis=require('ioredis');var authService=require(_0x7e64('0x11'));var qs=require(_0x7e64('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e64('0x13'));var logger=require(_0x7e64('0x14'))('api');var utils=require(_0x7e64('0x15'));var config=require(_0x7e64('0x16'));var licenseUtil=require(_0x7e64('0x17'));var db=require(_0x7e64('0x18'))['db'];config[_0x7e64('0x19')]=_[_0x7e64('0x1a')](config[_0x7e64('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e64('0x1b'))(new Redis(config[_0x7e64('0x19')]));require(_0x7e64('0x1c'))[_0x7e64('0x1d')](socket);function respondWithStatusCode(_0x4cea14,_0x33b7f1){_0x33b7f1=_0x33b7f1||0xcc;return function(_0x20eb50){if(_0x20eb50){return _0x4cea14[_0x7e64('0x1e')](_0x33b7f1);}return _0x4cea14[_0x7e64('0x1f')](_0x33b7f1)['end']();};}function respondWithResult(_0x46e3c6,_0x3557ba){_0x3557ba=_0x3557ba||0xc8;return function(_0x1567e8){if(_0x1567e8){return _0x46e3c6[_0x7e64('0x1f')](_0x3557ba)[_0x7e64('0x20')](_0x1567e8);}};}function respondWithFilteredResult(_0x5077f6,_0x36bc35){return function(_0x22f65b){if(_0x22f65b){var _0x18c0ae=typeof _0x36bc35[_0x7e64('0x21')]===_0x7e64('0x22')&&typeof _0x36bc35['limit']==='undefined';var _0x19190d=_0x22f65b[_0x7e64('0x23')];var _0x1ab1ce=_0x18c0ae?0x0:_0x36bc35[_0x7e64('0x21')];var _0x1f6b03=_0x18c0ae?_0x22f65b[_0x7e64('0x23')]:_0x36bc35['offset']+_0x36bc35[_0x7e64('0x24')];var _0x3c6477;if(_0x1f6b03>=_0x19190d){_0x1f6b03=_0x19190d;_0x3c6477=0xc8;}else{_0x3c6477=0xce;}_0x5077f6['status'](_0x3c6477);return _0x5077f6[_0x7e64('0x25')](_0x7e64('0x26'),_0x1ab1ce+'-'+_0x1f6b03+'/'+_0x19190d)['json'](_0x22f65b);}return null;};}function patchUpdates(_0x2ee6f5){return function(_0x4c085b){try{jsonpatch[_0x7e64('0x27')](_0x4c085b,_0x2ee6f5,!![]);}catch(_0x326d6d){return BPromise[_0x7e64('0x28')](_0x326d6d);}return _0x4c085b['save']();};}function saveUpdates(_0x1cc85d,_0x34ec2f){return function(_0x527940){if(_0x527940){return _0x527940[_0x7e64('0x29')](_0x1cc85d)[_0x7e64('0x2a')](function(_0x130a1c){return _0x130a1c;});}return null;};}function removeEntity(_0x25de3f,_0x12728b){return function(_0x6fe55a){if(_0x6fe55a){return _0x6fe55a[_0x7e64('0x2b')]()['then'](function(){_0x25de3f['status'](0xcc)[_0x7e64('0x2c')]();});}};}function handleEntityNotFound(_0x56029a,_0x5410bc){return function(_0x44b916){if(!_0x44b916){_0x56029a['sendStatus'](0x194);}return _0x44b916;};}function handleError(_0x352ea4,_0x4b0ea4){_0x4b0ea4=_0x4b0ea4||0x1f4;return function(_0x1af05a){logger[_0x7e64('0x2d')](_0x1af05a['stack']);if(_0x1af05a['name']){delete _0x1af05a[_0x7e64('0x2e')];}_0x352ea4[_0x7e64('0x1f')](_0x4b0ea4)['send'](_0x1af05a);};}exports[_0x7e64('0x2f')]=function(_0x32a817,_0x106961){var _0x5ecad3={},_0x6cac0d={},_0x174adc={'count':0x0,'rows':[]};var _0x17a6e4=_[_0x7e64('0x30')](db[_0x7e64('0x31')][_0x7e64('0x32')],function(_0x4bad4d){return{'name':_0x4bad4d[_0x7e64('0x33')],'type':_0x4bad4d[_0x7e64('0x34')]['key']};});_0x6cac0d['model']=_[_0x7e64('0x30')](_0x17a6e4,_0x7e64('0x2e'));_0x6cac0d[_0x7e64('0x35')]=_[_0x7e64('0x36')](_0x32a817['query']);_0x6cac0d[_0x7e64('0x37')]=_[_0x7e64('0x38')](_0x6cac0d['model'],_0x6cac0d[_0x7e64('0x35')]);_0x5ecad3[_0x7e64('0x39')]=_[_0x7e64('0x38')](_0x6cac0d[_0x7e64('0x3a')],qs[_0x7e64('0x3b')](_0x32a817['query'][_0x7e64('0x3b')]));_0x5ecad3['attributes']=_0x5ecad3['attributes'][_0x7e64('0x3c')]?_0x5ecad3[_0x7e64('0x39')]:_0x6cac0d[_0x7e64('0x3a')];if(!_0x32a817['query'][_0x7e64('0x3d')](_0x7e64('0x3e'))){_0x5ecad3[_0x7e64('0x24')]=qs[_0x7e64('0x24')](_0x32a817[_0x7e64('0x35')][_0x7e64('0x24')]);_0x5ecad3[_0x7e64('0x21')]=qs[_0x7e64('0x21')](_0x32a817['query']['offset']);}_0x5ecad3[_0x7e64('0x3f')]=qs[_0x7e64('0x40')](_0x32a817['query'][_0x7e64('0x40')]);_0x5ecad3[_0x7e64('0x41')]=qs[_0x7e64('0x37')](_[_0x7e64('0x42')](_0x32a817[_0x7e64('0x35')],_0x6cac0d[_0x7e64('0x37')]),_0x17a6e4);if(_0x32a817[_0x7e64('0x35')]['filter']){_0x5ecad3[_0x7e64('0x41')]=_['merge'](_0x5ecad3[_0x7e64('0x41')],{'$or':_['map'](_0x17a6e4,function(_0x43e6d2){if(_0x43e6d2[_0x7e64('0x34')]!==_0x7e64('0x43')){var _0x23b9c3={};_0x23b9c3[_0x43e6d2[_0x7e64('0x2e')]]={'$like':'%'+_0x32a817[_0x7e64('0x35')][_0x7e64('0x44')]+'%'};return _0x23b9c3;}})});}_0x5ecad3=_[_0x7e64('0x45')]({},_0x5ecad3,_0x32a817['options']);var _0x4a9081={'where':_0x5ecad3[_0x7e64('0x41')]};return db[_0x7e64('0x31')]['count'](_0x4a9081)['then'](function(_0x333e35){_0x174adc[_0x7e64('0x23')]=_0x333e35;if(_0x32a817['query']['includeAll']){_0x5ecad3[_0x7e64('0x46')]=[{'all':!![]}];}return db[_0x7e64('0x31')][_0x7e64('0x47')](_0x5ecad3);})[_0x7e64('0x2a')](function(_0x23291c){_0x174adc[_0x7e64('0x48')]=_0x23291c;return _0x174adc;})[_0x7e64('0x2a')](respondWithFilteredResult(_0x106961,_0x5ecad3))[_0x7e64('0x49')](handleError(_0x106961,null));};exports[_0x7e64('0x4a')]=function(_0x7ded9e,_0x28a992){var _0x169ee2={'raw':!![],'where':{'id':_0x7ded9e[_0x7e64('0x4b')]['id']}},_0x32e201={};_0x32e201['model']=_[_0x7e64('0x36')](db['ChatGroup'][_0x7e64('0x32')]);_0x32e201[_0x7e64('0x35')]=_['keys'](_0x7ded9e[_0x7e64('0x35')]);_0x32e201[_0x7e64('0x37')]=_[_0x7e64('0x38')](_0x32e201[_0x7e64('0x3a')],_0x32e201[_0x7e64('0x35')]);_0x169ee2[_0x7e64('0x39')]=_[_0x7e64('0x38')](_0x32e201[_0x7e64('0x3a')],qs[_0x7e64('0x3b')](_0x7ded9e[_0x7e64('0x35')][_0x7e64('0x3b')]));_0x169ee2[_0x7e64('0x39')]=_0x169ee2['attributes'][_0x7e64('0x3c')]?_0x169ee2[_0x7e64('0x39')]:_0x32e201[_0x7e64('0x3a')];if(_0x7ded9e[_0x7e64('0x35')][_0x7e64('0x4c')]){_0x169ee2[_0x7e64('0x46')]=[{'all':!![]}];}_0x169ee2=_[_0x7e64('0x45')]({},_0x169ee2,_0x7ded9e[_0x7e64('0x4d')]);return db[_0x7e64('0x31')][_0x7e64('0x4e')](_0x169ee2)['then'](handleEntityNotFound(_0x28a992,null))[_0x7e64('0x2a')](respondWithResult(_0x28a992,null))[_0x7e64('0x49')](handleError(_0x28a992,null));};exports['create']=function(_0x275326,_0x351035){return db['ChatGroup']['create'](_0x275326[_0x7e64('0x4f')],{})[_0x7e64('0x2a')](respondWithResult(_0x351035,0xc9))['catch'](handleError(_0x351035,null));};exports[_0x7e64('0x29')]=function(_0x3c4611,_0x4dc922){if(_0x3c4611[_0x7e64('0x4f')]['id']){delete _0x3c4611[_0x7e64('0x4f')]['id'];}return db['ChatGroup'][_0x7e64('0x4e')]({'where':{'id':_0x3c4611[_0x7e64('0x4b')]['id']}})[_0x7e64('0x2a')](handleEntityNotFound(_0x4dc922,null))[_0x7e64('0x2a')](saveUpdates(_0x3c4611[_0x7e64('0x4f')],null))['then'](respondWithResult(_0x4dc922,null))[_0x7e64('0x49')](handleError(_0x4dc922,null));};exports['destroy']=function(_0x43d722,_0x53cc63){return db[_0x7e64('0x31')][_0x7e64('0x4e')]({'where':{'id':_0x43d722[_0x7e64('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53cc63,null))['then'](removeEntity(_0x53cc63,null))[_0x7e64('0x49')](handleError(_0x53cc63,null));};exports[_0x7e64('0x50')]=function(_0x4256a9,_0x4d7250){return db[_0x7e64('0x31')][_0x7e64('0x50')]()[_0x7e64('0x2a')](respondWithResult(_0x4d7250,null))['catch'](handleError(_0x4d7250,null));};exports[_0x7e64('0x51')]=function(_0x50fee9,_0x54d604,_0x372575){return db['ChatInternalMessage'][_0x7e64('0x23')]({'where':{'ChatGroupId':_0x50fee9['params']['id'],'ToId':_0x50fee9[_0x7e64('0x52')]['id'],'read':![]}})[_0x7e64('0x2a')](function(_0x3afcfc){return{'id':_[_0x7e64('0x53')](_0x50fee9[_0x7e64('0x4b')]['id']),'count':_0x3afcfc};})[_0x7e64('0x2a')](respondWithResult(_0x54d604,null))['catch'](handleError(_0x54d604,null));};exports[_0x7e64('0x54')]=function(_0x3e454f,_0xb396b4,_0x43fc5f){return db[_0x7e64('0x31')][_0x7e64('0x4e')]({'where':{'id':_0x3e454f[_0x7e64('0x4b')]['id']}})[_0x7e64('0x2a')](handleEntityNotFound(_0xb396b4,null))[_0x7e64('0x2a')](function(_0x58f8b7){if(_0x58f8b7){return _0x58f8b7[_0x7e64('0x54')](_0x3e454f[_0x7e64('0x4f')][_0x7e64('0x55')],_['omit'](_0x3e454f[_0x7e64('0x4f')],['ids','id'])||{});}})[_0x7e64('0x2a')](respondWithResult(_0xb396b4,null))[_0x7e64('0x49')](handleError(_0xb396b4,null));};exports['getMembers']=function(_0x1a5cb3,_0x385149,_0x12b50e){var _0x296870={};var _0x37f763={};var _0x2a6448;var _0x1d42ea;return db['ChatGroup']['findOne']({'where':{'id':_0x1a5cb3[_0x7e64('0x4b')]['id']}})['then'](handleEntityNotFound(_0x385149,null))[_0x7e64('0x2a')](function(_0x504f22){if(_0x504f22){_0x2a6448=_0x504f22;_0x37f763[_0x7e64('0x3a')]=_[_0x7e64('0x36')](db[_0x7e64('0x56')][_0x7e64('0x32')]);_0x37f763['query']=_['keys'](_0x1a5cb3['query']);_0x37f763[_0x7e64('0x37')]=_['intersection'](_0x37f763[_0x7e64('0x3a')],_0x37f763[_0x7e64('0x35')]);_0x296870[_0x7e64('0x39')]=_[_0x7e64('0x38')](_0x37f763['model'],qs[_0x7e64('0x3b')](_0x1a5cb3[_0x7e64('0x35')][_0x7e64('0x3b')]));_0x296870[_0x7e64('0x39')]=_0x296870[_0x7e64('0x39')][_0x7e64('0x3c')]?_0x296870[_0x7e64('0x39')]:_0x37f763['model'];_0x296870['order']=qs[_0x7e64('0x40')](_0x1a5cb3[_0x7e64('0x35')][_0x7e64('0x40')]);_0x296870[_0x7e64('0x41')]=qs['filters'](_['pick'](_0x1a5cb3[_0x7e64('0x35')],_0x37f763[_0x7e64('0x37')]));if(_0x1a5cb3[_0x7e64('0x35')]['filter']){_0x296870[_0x7e64('0x41')]=_['merge'](_0x296870[_0x7e64('0x41')],{'$or':_[_0x7e64('0x30')](_0x296870[_0x7e64('0x39')],function(_0x4f5514){var _0x1b986e={};_0x1b986e[_0x4f5514]={'$like':'%'+_0x1a5cb3['query'][_0x7e64('0x44')]+'%'};return _0x1b986e;})});}_0x296870=_['merge']({},_0x296870,_0x1a5cb3[_0x7e64('0x4d')]);return _0x2a6448[_0x7e64('0x57')](_0x296870);}})['then'](function(_0x32f43a){if(_0x32f43a){_0x1d42ea=_0x32f43a[_0x7e64('0x3c')];if(!_0x1a5cb3[_0x7e64('0x35')][_0x7e64('0x3d')](_0x7e64('0x3e'))){_0x296870[_0x7e64('0x24')]=qs[_0x7e64('0x24')](_0x1a5cb3[_0x7e64('0x35')]['limit']);_0x296870[_0x7e64('0x21')]=qs[_0x7e64('0x21')](_0x1a5cb3[_0x7e64('0x35')][_0x7e64('0x21')]);}return _0x2a6448['getMembers'](_0x296870);}})[_0x7e64('0x2a')](function(_0x4edb52){if(_0x4edb52){return _0x4edb52?{'count':_0x1d42ea,'rows':_0x4edb52}:null;}})[_0x7e64('0x2a')](respondWithResult(_0x385149,null))['catch'](handleError(_0x385149,null));};exports[_0x7e64('0x58')]=function(_0x4bd6e5,_0x409842,_0x291975){return db[_0x7e64('0x31')][_0x7e64('0x4e')]({'where':{'id':_0x4bd6e5[_0x7e64('0x4b')]['id']}})[_0x7e64('0x2a')](handleEntityNotFound(_0x409842,null))[_0x7e64('0x2a')](function(_0x472e19){if(_0x472e19){return _0x472e19[_0x7e64('0x58')](_0x4bd6e5['query'][_0x7e64('0x55')]);}})[_0x7e64('0x2a')](respondWithStatusCode(_0x409842,null))[_0x7e64('0x49')](handleError(_0x409842,null));};exports[_0x7e64('0x59')]=function(_0x3b1234,_0x2f1309,_0x5d026d){if(_0x3b1234['body']['id']){delete _0x3b1234['body']['id'];}return db[_0x7e64('0x31')]['find']({'where':{'id':_0x3b1234[_0x7e64('0x4b')]['id']}})[_0x7e64('0x2a')](handleEntityNotFound(_0x2f1309,null))[_0x7e64('0x2a')](function(_0x4f274c){if(_0x4f274c){_0x3b1234[_0x7e64('0x4f')][_0x7e64('0x5a')]=_0x4f274c['id'];return db[_0x7e64('0x5b')]['create'](_0x3b1234['body']);}})['then'](respondWithResult(_0x2f1309,null))[_0x7e64('0x49')](handleError(_0x2f1309,null));};exports[_0x7e64('0x5c')]=function(_0x217709,_0x517a27,_0x2b11ab){var _0x62dcb4={};var _0x3ed907={};var _0x11d217;var _0x9d12f6;return db[_0x7e64('0x31')]['findOne']({'where':{'id':_0x217709[_0x7e64('0x4b')]['id']}})['then'](handleEntityNotFound(_0x517a27,null))[_0x7e64('0x2a')](function(_0xb16f64){if(_0xb16f64){_0x11d217=_0xb16f64;_0x3ed907[_0x7e64('0x3a')]=_['keys'](db[_0x7e64('0x5b')][_0x7e64('0x32')]);_0x3ed907['query']=_[_0x7e64('0x36')](_0x217709['query']);_0x3ed907[_0x7e64('0x37')]=_['intersection'](_0x3ed907[_0x7e64('0x3a')],_0x3ed907[_0x7e64('0x35')]);_0x62dcb4[_0x7e64('0x39')]=_[_0x7e64('0x38')](_0x3ed907[_0x7e64('0x3a')],qs['fields'](_0x217709[_0x7e64('0x35')][_0x7e64('0x3b')]));_0x62dcb4[_0x7e64('0x39')]=_0x62dcb4[_0x7e64('0x39')][_0x7e64('0x3c')]?_0x62dcb4[_0x7e64('0x39')]:_0x3ed907[_0x7e64('0x3a')];_0x62dcb4[_0x7e64('0x3f')]=qs[_0x7e64('0x40')](_0x217709[_0x7e64('0x35')][_0x7e64('0x40')]);_0x62dcb4[_0x7e64('0x41')]=qs[_0x7e64('0x37')](_['pick'](_0x217709[_0x7e64('0x35')],_0x3ed907['filters']));if(_0x217709['query']['filter']){_0x62dcb4[_0x7e64('0x41')]=_['merge'](_0x62dcb4[_0x7e64('0x41')],{'$or':_[_0x7e64('0x30')](_0x62dcb4[_0x7e64('0x39')],function(_0x5600cd){var _0x292063={};_0x292063[_0x5600cd]={'$like':'%'+_0x217709[_0x7e64('0x35')]['filter']+'%'};return _0x292063;})});}if(_0x217709[_0x7e64('0x35')][_0x7e64('0x5d')]){var _0x3e56fb=_0x217709[_0x7e64('0x35')][_0x7e64('0x5d')][_0x7e64('0x5e')](',');var _0x534c74={};_0x534c74[_0x3e56fb[0x0]]={'$gte':moment(_0x3e56fb[0x1])[_0x7e64('0x5f')](_0x7e64('0x60'))};_0x62dcb4[_0x7e64('0x41')]=_[_0x7e64('0x45')](_0x62dcb4[_0x7e64('0x41')],_0x534c74);}_0x62dcb4=_['merge']({},_0x62dcb4,_0x217709[_0x7e64('0x4d')]);return _0x11d217[_0x7e64('0x5c')](_0x62dcb4);}})['then'](function(_0x7c717a){if(_0x7c717a){_0x9d12f6=_0x7c717a[_0x7e64('0x3c')];if(!_0x217709[_0x7e64('0x35')][_0x7e64('0x3d')](_0x7e64('0x3e'))){_0x62dcb4[_0x7e64('0x24')]=qs[_0x7e64('0x24')](_0x217709['query'][_0x7e64('0x24')]);_0x62dcb4[_0x7e64('0x21')]=qs[_0x7e64('0x21')](_0x217709[_0x7e64('0x35')][_0x7e64('0x21')]);}return _0x11d217[_0x7e64('0x5c')](_0x62dcb4);}})[_0x7e64('0x2a')](function(_0x12864){if(_0x12864){return _0x12864?{'count':_0x9d12f6,'rows':_0x12864}:null;}})['then'](respondWithResult(_0x517a27,null))[_0x7e64('0x49')](handleError(_0x517a27,null));}; \ No newline at end of file +var _0xcc97=['register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','sort','getMembers','removeMembers','addMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket'];(function(_0x2eb82f,_0x5b4bf1){var _0x229daa=function(_0x174d6e){while(--_0x174d6e){_0x2eb82f['push'](_0x2eb82f['shift']());}};_0x229daa(++_0x5b4bf1);}(_0xcc97,0x174));var _0x7cc9=function(_0x581bd0,_0x3c9a7c){_0x581bd0=_0x581bd0-0x0;var _0x5bd522=_0xcc97[_0x581bd0];return _0x5bd522;};'use strict';var emlformat=require(_0x7cc9('0x0'));var rimraf=require(_0x7cc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7cc9('0x2'));var rp=require(_0x7cc9('0x3'));var moment=require(_0x7cc9('0x4'));var BPromise=require(_0x7cc9('0x5'));var Mustache=require(_0x7cc9('0x6'));var util=require(_0x7cc9('0x7'));var path=require(_0x7cc9('0x8'));var sox=require(_0x7cc9('0x9'));var csv=require(_0x7cc9('0xa'));var ejs=require(_0x7cc9('0xb'));var fs=require('fs');var fs_extra=require(_0x7cc9('0xc'));var _=require(_0x7cc9('0xd'));var squel=require(_0x7cc9('0xe'));var crypto=require(_0x7cc9('0xf'));var jsforce=require(_0x7cc9('0x10'));var deskjs=require(_0x7cc9('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7cc9('0x12'));var Papa=require(_0x7cc9('0x13'));var Redis=require(_0x7cc9('0x14'));var authService=require(_0x7cc9('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x7cc9('0x16'));var hardwareService=require(_0x7cc9('0x17'));var logger=require(_0x7cc9('0x18'))(_0x7cc9('0x19'));var utils=require(_0x7cc9('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x7cc9('0x1b'));var db=require(_0x7cc9('0x1c'))['db'];config[_0x7cc9('0x1d')]=_['defaults'](config[_0x7cc9('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cc9('0x1e'))(new Redis(config[_0x7cc9('0x1d')]));require(_0x7cc9('0x1f'))[_0x7cc9('0x20')](socket);function respondWithStatusCode(_0x5c4093,_0x446c0e){_0x446c0e=_0x446c0e||0xcc;return function(_0xb0fc58){if(_0xb0fc58){return _0x5c4093[_0x7cc9('0x21')](_0x446c0e);}return _0x5c4093[_0x7cc9('0x22')](_0x446c0e)[_0x7cc9('0x23')]();};}function respondWithResult(_0x5dcc88,_0x53762d){_0x53762d=_0x53762d||0xc8;return function(_0xcb7099){if(_0xcb7099){return _0x5dcc88['status'](_0x53762d)['json'](_0xcb7099);}};}function respondWithFilteredResult(_0x5dc1e5,_0x5aa2a1){return function(_0x86ddd2){if(_0x86ddd2){var _0x39e3b5=typeof _0x5aa2a1[_0x7cc9('0x24')]==='undefined'&&typeof _0x5aa2a1['limit']===_0x7cc9('0x25');var _0x22bb42=_0x86ddd2[_0x7cc9('0x26')];var _0x56dd8f=_0x39e3b5?0x0:_0x5aa2a1['offset'];var _0x2e9567=_0x39e3b5?_0x86ddd2[_0x7cc9('0x26')]:_0x5aa2a1[_0x7cc9('0x24')]+_0x5aa2a1['limit'];var _0x5e7dd1;if(_0x2e9567>=_0x22bb42){_0x2e9567=_0x22bb42;_0x5e7dd1=0xc8;}else{_0x5e7dd1=0xce;}_0x5dc1e5[_0x7cc9('0x22')](_0x5e7dd1);return _0x5dc1e5[_0x7cc9('0x27')](_0x7cc9('0x28'),_0x56dd8f+'-'+_0x2e9567+'/'+_0x22bb42)['json'](_0x86ddd2);}return null;};}function patchUpdates(_0x44ca12){return function(_0x32b1d1){try{jsonpatch[_0x7cc9('0x29')](_0x32b1d1,_0x44ca12,!![]);}catch(_0x1d77fd){return BPromise['reject'](_0x1d77fd);}return _0x32b1d1[_0x7cc9('0x2a')]();};}function saveUpdates(_0x5c38f5,_0x17a326){return function(_0x1be856){if(_0x1be856){return _0x1be856['update'](_0x5c38f5)['then'](function(_0xf369a){return _0xf369a;});}return null;};}function removeEntity(_0x42412b,_0x5e6cb8){return function(_0x27b2fb){if(_0x27b2fb){return _0x27b2fb[_0x7cc9('0x2b')]()[_0x7cc9('0x2c')](function(){_0x42412b[_0x7cc9('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e7d4,_0x2a984a){return function(_0x4fc527){if(!_0x4fc527){_0x51e7d4[_0x7cc9('0x21')](0x194);}return _0x4fc527;};}function handleError(_0xcc9c26,_0x3a87b0){_0x3a87b0=_0x3a87b0||0x1f4;return function(_0x1b8595){logger[_0x7cc9('0x2d')](_0x1b8595[_0x7cc9('0x2e')]);if(_0x1b8595[_0x7cc9('0x2f')]){delete _0x1b8595[_0x7cc9('0x2f')];}_0xcc9c26[_0x7cc9('0x22')](_0x3a87b0)[_0x7cc9('0x30')](_0x1b8595);};}exports[_0x7cc9('0x31')]=function(_0x24ddcd,_0x208a08){var _0x281ada={},_0x779e9={},_0x1b3c51={'count':0x0,'rows':[]};var _0xc4ce5=_['map'](db[_0x7cc9('0x32')][_0x7cc9('0x33')],function(_0x1e9cf3){return{'name':_0x1e9cf3[_0x7cc9('0x34')],'type':_0x1e9cf3[_0x7cc9('0x35')]['key']};});_0x779e9[_0x7cc9('0x36')]=_[_0x7cc9('0x37')](_0xc4ce5,_0x7cc9('0x2f'));_0x779e9[_0x7cc9('0x38')]=_[_0x7cc9('0x39')](_0x24ddcd[_0x7cc9('0x38')]);_0x779e9[_0x7cc9('0x3a')]=_[_0x7cc9('0x3b')](_0x779e9[_0x7cc9('0x36')],_0x779e9[_0x7cc9('0x38')]);_0x281ada['attributes']=_['intersection'](_0x779e9['model'],qs[_0x7cc9('0x3c')](_0x24ddcd[_0x7cc9('0x38')][_0x7cc9('0x3c')]));_0x281ada[_0x7cc9('0x3d')]=_0x281ada[_0x7cc9('0x3d')][_0x7cc9('0x3e')]?_0x281ada[_0x7cc9('0x3d')]:_0x779e9['model'];if(!_0x24ddcd['query'][_0x7cc9('0x3f')](_0x7cc9('0x40'))){_0x281ada[_0x7cc9('0x41')]=qs[_0x7cc9('0x41')](_0x24ddcd[_0x7cc9('0x38')]['limit']);_0x281ada[_0x7cc9('0x24')]=qs[_0x7cc9('0x24')](_0x24ddcd['query']['offset']);}_0x281ada[_0x7cc9('0x42')]=qs['sort'](_0x24ddcd['query']['sort']);_0x281ada[_0x7cc9('0x43')]=qs[_0x7cc9('0x3a')](_[_0x7cc9('0x44')](_0x24ddcd[_0x7cc9('0x38')],_0x779e9[_0x7cc9('0x3a')]),_0xc4ce5);if(_0x24ddcd[_0x7cc9('0x38')]['filter']){_0x281ada[_0x7cc9('0x43')]=_[_0x7cc9('0x45')](_0x281ada[_0x7cc9('0x43')],{'$or':_['map'](_0xc4ce5,function(_0x155cfb){if(_0x155cfb[_0x7cc9('0x35')]!==_0x7cc9('0x46')){var _0x287cee={};_0x287cee[_0x155cfb['name']]={'$like':'%'+_0x24ddcd[_0x7cc9('0x38')][_0x7cc9('0x47')]+'%'};return _0x287cee;}})});}_0x281ada=_['merge']({},_0x281ada,_0x24ddcd[_0x7cc9('0x48')]);var _0x1320eb={'where':_0x281ada['where']};return db[_0x7cc9('0x32')][_0x7cc9('0x26')](_0x1320eb)[_0x7cc9('0x2c')](function(_0x4ce8ea){_0x1b3c51['count']=_0x4ce8ea;if(_0x24ddcd['query'][_0x7cc9('0x49')]){_0x281ada[_0x7cc9('0x4a')]=[{'all':!![]}];}return db[_0x7cc9('0x32')][_0x7cc9('0x4b')](_0x281ada);})[_0x7cc9('0x2c')](function(_0xbdda36){_0x1b3c51[_0x7cc9('0x4c')]=_0xbdda36;return _0x1b3c51;})[_0x7cc9('0x2c')](respondWithFilteredResult(_0x208a08,_0x281ada))[_0x7cc9('0x4d')](handleError(_0x208a08,null));};exports[_0x7cc9('0x4e')]=function(_0x28b33,_0x2ba3b5){var _0x4219c2={'raw':!![],'where':{'id':_0x28b33[_0x7cc9('0x4f')]['id']}},_0x3c44a2={};_0x3c44a2['model']=_[_0x7cc9('0x39')](db[_0x7cc9('0x32')][_0x7cc9('0x33')]);_0x3c44a2['query']=_[_0x7cc9('0x39')](_0x28b33['query']);_0x3c44a2[_0x7cc9('0x3a')]=_[_0x7cc9('0x3b')](_0x3c44a2[_0x7cc9('0x36')],_0x3c44a2['query']);_0x4219c2[_0x7cc9('0x3d')]=_[_0x7cc9('0x3b')](_0x3c44a2['model'],qs[_0x7cc9('0x3c')](_0x28b33['query'][_0x7cc9('0x3c')]));_0x4219c2['attributes']=_0x4219c2[_0x7cc9('0x3d')][_0x7cc9('0x3e')]?_0x4219c2[_0x7cc9('0x3d')]:_0x3c44a2['model'];if(_0x28b33[_0x7cc9('0x38')][_0x7cc9('0x49')]){_0x4219c2['include']=[{'all':!![]}];}_0x4219c2=_[_0x7cc9('0x45')]({},_0x4219c2,_0x28b33[_0x7cc9('0x48')]);return db[_0x7cc9('0x32')]['find'](_0x4219c2)[_0x7cc9('0x2c')](handleEntityNotFound(_0x2ba3b5,null))['then'](respondWithResult(_0x2ba3b5,null))[_0x7cc9('0x4d')](handleError(_0x2ba3b5,null));};exports[_0x7cc9('0x50')]=function(_0x5067cf,_0x3dd435){return db[_0x7cc9('0x32')][_0x7cc9('0x50')](_0x5067cf[_0x7cc9('0x51')],{})[_0x7cc9('0x2c')](respondWithResult(_0x3dd435,0xc9))[_0x7cc9('0x4d')](handleError(_0x3dd435,null));};exports['update']=function(_0x141e17,_0x585b3b){if(_0x141e17[_0x7cc9('0x51')]['id']){delete _0x141e17[_0x7cc9('0x51')]['id'];}return db[_0x7cc9('0x32')]['find']({'where':{'id':_0x141e17[_0x7cc9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x585b3b,null))['then'](saveUpdates(_0x141e17[_0x7cc9('0x51')],null))['then'](respondWithResult(_0x585b3b,null))['catch'](handleError(_0x585b3b,null));};exports[_0x7cc9('0x2b')]=function(_0x496041,_0x3f1546){return db[_0x7cc9('0x32')][_0x7cc9('0x52')]({'where':{'id':_0x496041[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0x3f1546,null))[_0x7cc9('0x2c')](removeEntity(_0x3f1546,null))[_0x7cc9('0x4d')](handleError(_0x3f1546,null));};exports[_0x7cc9('0x53')]=function(_0x3ff96e,_0x4b5fb0){return db[_0x7cc9('0x32')][_0x7cc9('0x53')]()[_0x7cc9('0x2c')](respondWithResult(_0x4b5fb0,null))[_0x7cc9('0x4d')](handleError(_0x4b5fb0,null));};exports[_0x7cc9('0x54')]=function(_0x1d90da,_0x56340e,_0x10849b){return db[_0x7cc9('0x55')][_0x7cc9('0x26')]({'where':{'ChatGroupId':_0x1d90da[_0x7cc9('0x4f')]['id'],'ToId':_0x1d90da[_0x7cc9('0x56')]['id'],'read':![]}})[_0x7cc9('0x2c')](function(_0x480d4c){return{'id':_[_0x7cc9('0x57')](_0x1d90da[_0x7cc9('0x4f')]['id']),'count':_0x480d4c};})[_0x7cc9('0x2c')](respondWithResult(_0x56340e,null))[_0x7cc9('0x4d')](handleError(_0x56340e,null));};exports[_0x7cc9('0x58')]=function(_0x2e7cab,_0x34ad87,_0x5f29b8){return db[_0x7cc9('0x32')][_0x7cc9('0x52')]({'where':{'id':_0x2e7cab[_0x7cc9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x34ad87,null))[_0x7cc9('0x2c')](function(_0x5ccef0){if(_0x5ccef0){return _0x5ccef0['addMembers'](_0x2e7cab[_0x7cc9('0x51')][_0x7cc9('0x59')],_[_0x7cc9('0x5a')](_0x2e7cab['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x34ad87,null))['catch'](handleError(_0x34ad87,null));};exports['getMembers']=function(_0x382944,_0x2c963a,_0x2d1966){var _0x4e554={};var _0x1eee24={};var _0xaf97e2;var _0x92551c;return db[_0x7cc9('0x32')][_0x7cc9('0x5b')]({'where':{'id':_0x382944[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0x2c963a,null))[_0x7cc9('0x2c')](function(_0x119b04){if(_0x119b04){_0xaf97e2=_0x119b04;_0x1eee24[_0x7cc9('0x36')]=_[_0x7cc9('0x39')](db[_0x7cc9('0x5c')][_0x7cc9('0x33')]);_0x1eee24[_0x7cc9('0x38')]=_[_0x7cc9('0x39')](_0x382944['query']);_0x1eee24['filters']=_[_0x7cc9('0x3b')](_0x1eee24[_0x7cc9('0x36')],_0x1eee24[_0x7cc9('0x38')]);_0x4e554[_0x7cc9('0x3d')]=_['intersection'](_0x1eee24[_0x7cc9('0x36')],qs[_0x7cc9('0x3c')](_0x382944[_0x7cc9('0x38')][_0x7cc9('0x3c')]));_0x4e554[_0x7cc9('0x3d')]=_0x4e554[_0x7cc9('0x3d')]['length']?_0x4e554[_0x7cc9('0x3d')]:_0x1eee24[_0x7cc9('0x36')];_0x4e554[_0x7cc9('0x42')]=qs[_0x7cc9('0x5d')](_0x382944[_0x7cc9('0x38')][_0x7cc9('0x5d')]);_0x4e554[_0x7cc9('0x43')]=qs[_0x7cc9('0x3a')](_[_0x7cc9('0x44')](_0x382944[_0x7cc9('0x38')],_0x1eee24[_0x7cc9('0x3a')]));if(_0x382944[_0x7cc9('0x38')]['filter']){_0x4e554[_0x7cc9('0x43')]=_['merge'](_0x4e554['where'],{'$or':_[_0x7cc9('0x37')](_0x4e554[_0x7cc9('0x3d')],function(_0x1b3464){var _0x2cd529={};_0x2cd529[_0x1b3464]={'$like':'%'+_0x382944[_0x7cc9('0x38')][_0x7cc9('0x47')]+'%'};return _0x2cd529;})});}_0x4e554=_['merge']({},_0x4e554,_0x382944['options']);return _0xaf97e2['getMembers'](_0x4e554);}})[_0x7cc9('0x2c')](function(_0x1b6077){if(_0x1b6077){_0x92551c=_0x1b6077[_0x7cc9('0x3e')];if(!_0x382944[_0x7cc9('0x38')][_0x7cc9('0x3f')]('nolimit')){_0x4e554[_0x7cc9('0x41')]=qs['limit'](_0x382944[_0x7cc9('0x38')]['limit']);_0x4e554[_0x7cc9('0x24')]=qs[_0x7cc9('0x24')](_0x382944[_0x7cc9('0x38')][_0x7cc9('0x24')]);}return _0xaf97e2[_0x7cc9('0x5e')](_0x4e554);}})[_0x7cc9('0x2c')](function(_0x5bfc1e){if(_0x5bfc1e){return _0x5bfc1e?{'count':_0x92551c,'rows':_0x5bfc1e}:null;}})[_0x7cc9('0x2c')](respondWithResult(_0x2c963a,null))[_0x7cc9('0x4d')](handleError(_0x2c963a,null));};exports[_0x7cc9('0x5f')]=function(_0x4529d0,_0x1bde55,_0x2d927b){return db[_0x7cc9('0x32')][_0x7cc9('0x52')]({'where':{'id':_0x4529d0['params']['id']}})['then'](handleEntityNotFound(_0x1bde55,null))[_0x7cc9('0x2c')](function(_0x351f04){if(_0x351f04){return _0x351f04[_0x7cc9('0x5f')](_0x4529d0[_0x7cc9('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x1bde55,null))[_0x7cc9('0x4d')](handleError(_0x1bde55,null));};exports[_0x7cc9('0x60')]=function(_0x44fb8e,_0xbede80,_0x29c8d1){if(_0x44fb8e[_0x7cc9('0x51')]['id']){delete _0x44fb8e[_0x7cc9('0x51')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x44fb8e[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0xbede80,null))[_0x7cc9('0x2c')](function(_0x4b51c3){if(_0x4b51c3){_0x44fb8e[_0x7cc9('0x51')]['ChatGroupId']=_0x4b51c3['id'];return db[_0x7cc9('0x55')][_0x7cc9('0x50')](_0x44fb8e[_0x7cc9('0x51')]);}})[_0x7cc9('0x2c')](respondWithResult(_0xbede80,null))[_0x7cc9('0x4d')](handleError(_0xbede80,null));};exports[_0x7cc9('0x61')]=function(_0x923638,_0x43945a,_0x19817e){var _0x41afea={};var _0x21354d={};var _0x28d28b;var _0x2e5ad9;return db[_0x7cc9('0x32')][_0x7cc9('0x5b')]({'where':{'id':_0x923638[_0x7cc9('0x4f')]['id']}})[_0x7cc9('0x2c')](handleEntityNotFound(_0x43945a,null))[_0x7cc9('0x2c')](function(_0x296632){if(_0x296632){_0x28d28b=_0x296632;_0x21354d[_0x7cc9('0x36')]=_[_0x7cc9('0x39')](db[_0x7cc9('0x55')][_0x7cc9('0x33')]);_0x21354d[_0x7cc9('0x38')]=_[_0x7cc9('0x39')](_0x923638[_0x7cc9('0x38')]);_0x21354d[_0x7cc9('0x3a')]=_[_0x7cc9('0x3b')](_0x21354d[_0x7cc9('0x36')],_0x21354d[_0x7cc9('0x38')]);_0x41afea[_0x7cc9('0x3d')]=_[_0x7cc9('0x3b')](_0x21354d[_0x7cc9('0x36')],qs[_0x7cc9('0x3c')](_0x923638[_0x7cc9('0x38')][_0x7cc9('0x3c')]));_0x41afea['attributes']=_0x41afea[_0x7cc9('0x3d')]['length']?_0x41afea[_0x7cc9('0x3d')]:_0x21354d['model'];_0x41afea[_0x7cc9('0x42')]=qs['sort'](_0x923638[_0x7cc9('0x38')][_0x7cc9('0x5d')]);_0x41afea[_0x7cc9('0x43')]=qs[_0x7cc9('0x3a')](_[_0x7cc9('0x44')](_0x923638[_0x7cc9('0x38')],_0x21354d[_0x7cc9('0x3a')]));if(_0x923638['query'][_0x7cc9('0x47')]){_0x41afea['where']=_['merge'](_0x41afea[_0x7cc9('0x43')],{'$or':_['map'](_0x41afea[_0x7cc9('0x3d')],function(_0x5bffb7){var _0x22dad0={};_0x22dad0[_0x5bffb7]={'$like':'%'+_0x923638['query']['filter']+'%'};return _0x22dad0;})});}if(_0x923638[_0x7cc9('0x38')][_0x7cc9('0x62')]){var _0x29faec=_0x923638[_0x7cc9('0x38')][_0x7cc9('0x62')][_0x7cc9('0x63')](',');var _0xb93fe2={};_0xb93fe2[_0x29faec[0x0]]={'$gte':moment(_0x29faec[0x1])['format'](_0x7cc9('0x64'))};_0x41afea['where']=_[_0x7cc9('0x45')](_0x41afea[_0x7cc9('0x43')],_0xb93fe2);}_0x41afea=_[_0x7cc9('0x45')]({},_0x41afea,_0x923638['options']);return _0x28d28b[_0x7cc9('0x61')](_0x41afea);}})[_0x7cc9('0x2c')](function(_0x4e9a96){if(_0x4e9a96){_0x2e5ad9=_0x4e9a96[_0x7cc9('0x3e')];if(!_0x923638[_0x7cc9('0x38')][_0x7cc9('0x3f')]('nolimit')){_0x41afea['limit']=qs['limit'](_0x923638[_0x7cc9('0x38')][_0x7cc9('0x41')]);_0x41afea['offset']=qs[_0x7cc9('0x24')](_0x923638[_0x7cc9('0x38')]['offset']);}return _0x28d28b[_0x7cc9('0x61')](_0x41afea);}})[_0x7cc9('0x2c')](function(_0x5e02a3){if(_0x5e02a3){return _0x5e02a3?{'count':_0x2e5ad9,'rows':_0x5e02a3}:null;}})[_0x7cc9('0x2c')](respondWithResult(_0x43945a,null))[_0x7cc9('0x4d')](handleError(_0x43945a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f3f2d4c..11cdfd2 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 _0xa50f=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1c5bac,_0x1be44f){var _0x5145a1=function(_0x1de9b4){while(--_0x1de9b4){_0x1c5bac['push'](_0x1c5bac['shift']());}};_0x5145a1(++_0x1be44f);}(_0xa50f,0x7e));var _0xfa50=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa50f[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xfa50('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfa50('0x1')](0x0);var events={'afterCreate':_0xfa50('0x2'),'afterUpdate':_0xfa50('0x3'),'afterDestroy':_0xfa50('0x4')};function emitEvent(_0x2384c6){return function(_0x546be7,_0x462161,_0x597ee7){ChatGroupEvents[_0xfa50('0x5')](_0x2384c6+':'+_0x546be7['id'],_0x546be7);ChatGroupEvents[_0xfa50('0x5')](_0x2384c6,_0x546be7);_0x597ee7(null);};}for(var e in events){if(events[_0xfa50('0x6')](e)){var event=events[e];ChatGroup[_0xfa50('0x7')](e,emitEvent(event));}}module[_0xfa50('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x43c4=['ChatGroup','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x3eff98,_0x209781){var _0x40bc7e=function(_0x48dd99){while(--_0x48dd99){_0x3eff98['push'](_0x3eff98['shift']());}};_0x40bc7e(++_0x209781);}(_0x43c4,0xf7));var _0x443c=function(_0x31eff5,_0x262efe){_0x31eff5=_0x31eff5-0x0;var _0x13b099=_0x43c4[_0x31eff5];return _0x13b099;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x443c('0x0'))['db'][_0x443c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x443c('0x2')](0x0);var events={'afterCreate':_0x443c('0x3'),'afterUpdate':_0x443c('0x4'),'afterDestroy':_0x443c('0x5')};function emitEvent(_0x946a91){return function(_0x8dcaf2,_0x362c49,_0x56a8c4){ChatGroupEvents[_0x443c('0x6')](_0x946a91+':'+_0x8dcaf2['id'],_0x8dcaf2);ChatGroupEvents[_0x443c('0x6')](_0x946a91,_0x8dcaf2);_0x56a8c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x443c('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index dc2ebd9..6f6e3d1 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 _0x72a6=['util','../../config/logger','api','bluebird','request-promise','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x72a6,0x113));var _0x672a=function(_0x494a86,_0x1354ce){_0x494a86=_0x494a86-0x0;var _0x351af1=_0x72a6[_0x494a86];return _0x351af1;};'use strict';var _=require('lodash');var util=require(_0x672a('0x0'));var logger=require(_0x672a('0x1'))(_0x672a('0x2'));var moment=require('moment');var BPromise=require(_0x672a('0x3'));var rp=require(_0x672a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x672a('0x5'));var config=require('../../config/environment');var attributes=require(_0x672a('0x6'));module[_0x672a('0x7')]=function(_0xd3b7d8,_0x16a569){return _0xd3b7d8[_0x672a('0x8')](_0x672a('0x9'),attributes,{'tableName':_0x672a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8ac=['../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x18d879,_0x566761){var _0x14ffff=function(_0x3520cd){while(--_0x3520cd){_0x18d879['push'](_0x18d879['shift']());}};_0x14ffff(++_0x566761);}(_0xf8ac,0xc8));var _0xcf8a=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xf8ac[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0xcf8a('0x0'));var util=require('util');var logger=require(_0xcf8a('0x1'))(_0xcf8a('0x2'));var moment=require(_0xcf8a('0x3'));var BPromise=require(_0xcf8a('0x4'));var rp=require(_0xcf8a('0x5'));var fs=require('fs');var path=require(_0xcf8a('0x6'));var rimraf=require(_0xcf8a('0x7'));var config=require(_0xcf8a('0x8'));var attributes=require(_0xcf8a('0x9'));module['exports']=function(_0x5b1acd,_0x55d864){return _0x5b1acd[_0xcf8a('0xa')](_0xcf8a('0xb'),attributes,{'tableName':_0xcf8a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 3d7188a..7a67acb 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 _0xd943=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xd943,0x14a));var _0x3d94=function(_0x109013,_0x10fef1){_0x109013=_0x109013-0x0;var _0x3149d6=_0xd943[_0x109013];return _0x3149d6;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require(_0x3d94('0x4'));var fs=require('fs');var Redis=require(_0x3d94('0x5'));var db=require(_0x3d94('0x6'))['db'];var utils=require(_0x3d94('0x7'));var logger=require(_0x3d94('0x8'))(_0x3d94('0x9'));var config=require(_0x3d94('0xa'));var jayson=require(_0x3d94('0xb'));var client=jayson[_0x3d94('0xc')][_0x3d94('0xd')]({'port':0x232a});config[_0x3d94('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d94('0xe')]));require(_0x3d94('0xf'))['register'](socket);function respondWithRpcPromise(_0x5e138b,_0x5d036b,_0x1f758a){return new BPromise(function(_0x55e0de,_0x5624c0){return client[_0x3d94('0x10')](_0x5e138b,_0x1f758a)['then'](function(_0x18d694){logger[_0x3d94('0x11')](_0x3d94('0x12'),_0x5d036b,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5d036b,_0x3d94('0x13'),JSON[_0x3d94('0x14')](_0x18d694));if(_0x18d694[_0x3d94('0x15')]){if(_0x18d694[_0x3d94('0x15')]['code']===0x1f4){logger[_0x3d94('0x15')]('ChatGroup,\x20%s,\x20%s',_0x5d036b,_0x18d694[_0x3d94('0x15')][_0x3d94('0x16')]);return _0x5624c0(_0x18d694[_0x3d94('0x15')]['message']);}logger[_0x3d94('0x15')](_0x3d94('0x12'),_0x5d036b,_0x18d694[_0x3d94('0x15')][_0x3d94('0x16')]);return _0x55e0de(_0x18d694[_0x3d94('0x15')]['message']);}else{logger[_0x3d94('0x11')](_0x3d94('0x12'),_0x5d036b,_0x3d94('0x13'));_0x55e0de(_0x18d694['result'][_0x3d94('0x16')]);}})[_0x3d94('0x17')](function(_0x3e9022){logger['error'](_0x3d94('0x12'),_0x5d036b,_0x3e9022);_0x5624c0(_0x3e9022);});});} \ No newline at end of file +var _0x79b2=['lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x1c954d,_0x242aa2){var _0x5afef3=function(_0x46bae4){while(--_0x46bae4){_0x1c954d['push'](_0x1c954d['shift']());}};_0x5afef3(++_0x242aa2);}(_0x79b2,0x142));var _0x279b=function(_0x308dcb,_0x58d691){_0x308dcb=_0x308dcb-0x0;var _0x24eec1=_0x79b2[_0x308dcb];return _0x24eec1;};'use strict';var _=require(_0x279b('0x0'));var util=require('util');var moment=require(_0x279b('0x1'));var BPromise=require('bluebird');var rs=require(_0x279b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x279b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x279b('0x4'))(_0x279b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x279b('0x6')][_0x279b('0x7')]({'port':0x232a});config[_0x279b('0x8')]=_[_0x279b('0x9')](config[_0x279b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x279b('0xa'))(new Redis(config[_0x279b('0x8')]));require(_0x279b('0xb'))[_0x279b('0xc')](socket);function respondWithRpcPromise(_0x3fcc99,_0x43a8fd,_0x3af055){return new BPromise(function(_0x3ba356,_0x449b44){return client[_0x279b('0xd')](_0x3fcc99,_0x3af055)[_0x279b('0xe')](function(_0x3c8333){logger[_0x279b('0xf')](_0x279b('0x10'),_0x43a8fd,_0x279b('0x11'));logger[_0x279b('0x12')](_0x279b('0x13'),_0x43a8fd,_0x279b('0x11'),JSON['stringify'](_0x3c8333));if(_0x3c8333['error']){if(_0x3c8333[_0x279b('0x14')]['code']===0x1f4){logger[_0x279b('0x14')](_0x279b('0x10'),_0x43a8fd,_0x3c8333['error']['message']);return _0x449b44(_0x3c8333['error'][_0x279b('0x15')]);}logger[_0x279b('0x14')](_0x279b('0x10'),_0x43a8fd,_0x3c8333['error']['message']);return _0x3ba356(_0x3c8333[_0x279b('0x14')]['message']);}else{logger[_0x279b('0xf')](_0x279b('0x10'),_0x43a8fd,'request\x20sent');_0x3ba356(_0x3c8333['result']['message']);}})[_0x279b('0x16')](function(_0x10be24){logger[_0x279b('0x14')](_0x279b('0x10'),_0x43a8fd,_0x10be24);_0x449b44(_0x10be24);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c181762..43be41c 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 _0xe400=['chatGroup:','./chatGroup.events','save','update','removeListener','register','length'];(function(_0x415317,_0x49eec6){var _0x218c36=function(_0x247be1){while(--_0x247be1){_0x415317['push'](_0x415317['shift']());}};_0x218c36(++_0x49eec6);}(_0xe400,0xfd));var _0x0e40=function(_0x5ad2f4,_0x25ebd6){_0x5ad2f4=_0x5ad2f4-0x0;var _0x3cfcb0=_0xe400[_0x5ad2f4];return _0x3cfcb0;};'use strict';var ChatGroupEvents=require(_0x0e40('0x0'));var events=[_0x0e40('0x1'),'remove',_0x0e40('0x2')];function createListener(_0x2b8657,_0x24c4be){return function(_0x2a9ad7){_0x24c4be['emit'](_0x2b8657,_0x2a9ad7);};}function removeListener(_0x3df270,_0x419a32){return function(){ChatGroupEvents[_0x0e40('0x3')](_0x3df270,_0x419a32);};}exports[_0x0e40('0x4')]=function(_0x544b96){for(var _0x16ca57=0x0,_0x276859=events[_0x0e40('0x5')];_0x16ca57<_0x276859;_0x16ca57++){var _0x10eac6=events[_0x16ca57];var _0x5f4809=createListener(_0x0e40('0x6')+_0x10eac6,_0x544b96);ChatGroupEvents['on'](_0x10eac6,_0x5f4809);}}; \ No newline at end of file +var _0xbc67=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register','length'];(function(_0x52e2a8,_0x22d875){var _0x3d3fb0=function(_0x37e675){while(--_0x37e675){_0x52e2a8['push'](_0x52e2a8['shift']());}};_0x3d3fb0(++_0x22d875);}(_0xbc67,0x64));var _0x7bc6=function(_0x5afb50,_0x39f4a6){_0x5afb50=_0x5afb50-0x0;var _0x4f6e0e=_0xbc67[_0x5afb50];return _0x4f6e0e;};'use strict';var ChatGroupEvents=require(_0x7bc6('0x0'));var events=[_0x7bc6('0x1'),_0x7bc6('0x2'),_0x7bc6('0x3')];function createListener(_0x516b66,_0x42eb13){return function(_0x25068c){_0x42eb13[_0x7bc6('0x4')](_0x516b66,_0x25068c);};}function removeListener(_0x4d8244,_0x19658b){return function(){ChatGroupEvents[_0x7bc6('0x5')](_0x4d8244,_0x19658b);};}exports[_0x7bc6('0x6')]=function(_0x564b67){for(var _0x17587f=0x0,_0x223f97=events[_0x7bc6('0x7')];_0x17587f<_0x223f97;_0x17587f++){var _0x554e64=events[_0x17587f];var _0x26febc=createListener(_0x7bc6('0x8')+_0x554e64,_0x564b67);ChatGroupEvents['on'](_0x554e64,_0x26febc);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3f11389..5eed08d 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 _0xea18=['destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','update','delete'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0xea18,0x145));var _0x8ea1=function(_0x52d2a9,_0xbcc318){_0x52d2a9=_0x52d2a9-0x0;var _0x2b33d0=_0xea18[_0x52d2a9];return _0x2b33d0;};'use strict';var multer=require(_0x8ea1('0x0'));var util=require(_0x8ea1('0x1'));var path=require(_0x8ea1('0x2'));var timeout=require(_0x8ea1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ea1('0x4'));var auth=require(_0x8ea1('0x5'));var interaction=require(_0x8ea1('0x6'));var config=require(_0x8ea1('0x7'));var controller=require('./chatGroup.controller');router[_0x8ea1('0x8')]('/',auth[_0x8ea1('0x9')](),controller[_0x8ea1('0xa')]);router[_0x8ea1('0x8')](_0x8ea1('0xb'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0xc')]);router[_0x8ea1('0x8')](_0x8ea1('0xd'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0xe')]);router[_0x8ea1('0x8')](_0x8ea1('0xf'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x10')]);router['get'](_0x8ea1('0x11'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x12')]);router['get'](_0x8ea1('0x13'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x14')]);router['post']('/',auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x15')]);router[_0x8ea1('0x16')](_0x8ea1('0x11'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x17')]);router[_0x8ea1('0x16')](_0x8ea1('0x13'),auth[_0x8ea1('0x9')](),controller['addMessage']);router['put'](_0x8ea1('0xd'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x18')]);router[_0x8ea1('0x19')](_0x8ea1('0xd'),auth[_0x8ea1('0x9')](),controller[_0x8ea1('0x1a')]);router[_0x8ea1('0x19')](_0x8ea1('0x11'),auth[_0x8ea1('0x9')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0xcdbd=['describe','/:id','show','/:id/unread','isAuthenticated','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','/:id/messages','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe'];(function(_0x1f4b40,_0x52be55){var _0x48696b=function(_0x4add66){while(--_0x4add66){_0x1f4b40['push'](_0x1f4b40['shift']());}};_0x48696b(++_0x52be55);}(_0xcdbd,0xc0));var _0xdcdb=function(_0x5c99d6,_0x2602fa){_0x5c99d6=_0x5c99d6-0x0;var _0x3480e3=_0xcdbd[_0x5c99d6];return _0x3480e3;};'use strict';var multer=require(_0xdcdb('0x0'));var util=require(_0xdcdb('0x1'));var path=require('path');var timeout=require(_0xdcdb('0x2'));var express=require(_0xdcdb('0x3'));var router=express['Router']();var fs_extra=require(_0xdcdb('0x4'));var auth=require(_0xdcdb('0x5'));var interaction=require(_0xdcdb('0x6'));var config=require('../../config/environment');var controller=require(_0xdcdb('0x7'));router[_0xdcdb('0x8')]('/',auth['isAuthenticated'](),controller[_0xdcdb('0x9')]);router['get'](_0xdcdb('0xa'),auth['isAuthenticated'](),controller[_0xdcdb('0xb')]);router[_0xdcdb('0x8')](_0xdcdb('0xc'),auth['isAuthenticated'](),controller[_0xdcdb('0xd')]);router[_0xdcdb('0x8')](_0xdcdb('0xe'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x10')]);router['get'](_0xdcdb('0x11'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x12')]);router[_0xdcdb('0x8')]('/:id/messages',auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x13')]);router[_0xdcdb('0x14')]('/',auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x15')]);router[_0xdcdb('0x14')]('/:id/members',auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x16')]);router[_0xdcdb('0x14')](_0xdcdb('0x17'),auth[_0xdcdb('0xf')](),controller['addMessage']);router[_0xdcdb('0x18')](_0xdcdb('0xc'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x19')]);router[_0xdcdb('0x1a')](_0xdcdb('0xc'),auth[_0xdcdb('0xf')](),controller[_0xdcdb('0x1b')]);router[_0xdcdb('0x1a')](_0xdcdb('0x11'),auth[_0xdcdb('0xf')](),controller['removeMembers']);module[_0xdcdb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8e8c0e5..66199d0 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 _0x9000=['star','thumb','TEXT','STRING','DATE','out','BOOLEAN','sequelize','exports','INTEGER','ENUM'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x9000,0x19e));var _0x0900=function(_0x494160,_0xadfa3f){_0x494160=_0x494160-0x0;var _0x5934b2=_0x9000[_0x494160];return _0x5934b2;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0900('0x2')]},'ratingType':{'type':Sequelize[_0x0900('0x3')](_0x0900('0x4'),_0x0900('0x5')),'defaultValue':_0x0900('0x4')},'ratingMessage':{'type':Sequelize[_0x0900('0x6')]},'pathTranscript':{'type':Sequelize[_0x0900('0x6')]},'mailTranscript':{'type':Sequelize[_0x0900('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0900('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0900('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0900('0x7')]},'browserName':{'type':Sequelize[_0x0900('0x7')]},'browserVersion':{'type':Sequelize[_0x0900('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x0900('0x7')]},'deviceVendor':{'type':Sequelize[_0x0900('0x7')]},'deviceType':{'type':Sequelize[_0x0900('0x7')]},'referer':{'type':Sequelize[_0x0900('0x6')]},'customerIp':{'type':Sequelize[_0x0900('0x7')]},'formData':{'type':Sequelize[_0x0900('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x0900('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0900('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x0900('0x3')]('in',_0x0900('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0900('0x7')]},'customerPort':{'type':Sequelize[_0x0900('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x0900('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x0900('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x6836=['BOOLEAN','ENUM','thumb','TEXT','STRING','DATE','out','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6836,0x1c0));var _0x6683=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x6836[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x6683('0x0'));module[_0x6683('0x1')]={'closed':{'type':Sequelize[_0x6683('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6683('0x3')]('star',_0x6683('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6683('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6683('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6683('0x7')]},'disposition':{'type':Sequelize[_0x6683('0x6')]},'secondDisposition':{'type':Sequelize[_0x6683('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6683('0x6')]},'browserName':{'type':Sequelize[_0x6683('0x6')]},'browserVersion':{'type':Sequelize[_0x6683('0x6')]},'osName':{'type':Sequelize[_0x6683('0x6')]},'osVersion':{'type':Sequelize[_0x6683('0x6')]},'deviceModel':{'type':Sequelize[_0x6683('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6683('0x5')]},'customerIp':{'type':Sequelize[_0x6683('0x6')]},'formData':{'type':Sequelize[_0x6683('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x6683('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6683('0x3')]('in',_0x6683('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6683('0x6')]},'customerPort':{'type':Sequelize[_0x6683('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6683('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x6683('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 006af90..248a0cd 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 _0x3dee=['\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','clone','i.id','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','sequelize','toString','keyBy','merge','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.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','params','includeAll','include','options','create','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','account','POST','follow','isNull','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','addTags','setTags','omit','spread','Tag','emit','removeTags','server','files','tmp','attachments','CmContact','firstName','lastName','read','get','mkdirSync','Chat','Owner','N.A.','closedAt','osName','customerPort','tail','existsSync','createWriteStream','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInteraction.socket','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','stack','name','send','render','body','contact','agent','interaction','Users','map','Tags','TagIds','split','forEach','push','catch','talking','answered','unmanaged','total','closed','UserId','waiting','disposition','abandoned','ChatInteraction','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','select','field','from','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','keys','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x4d6601,_0x4b0b22){var _0x2d0e52=function(_0x51f928){while(--_0x51f928){_0x4d6601['push'](_0x4d6601['shift']());}};_0x2d0e52(++_0x4b0b22);}(_0x3dee,0x1e5));var _0xe3de=function(_0x7a5831,_0xe86f9b){_0x7a5831=_0x7a5831-0x0;var _0x83afe3=_0x3dee[_0x7a5831];return _0x83afe3;};'use strict';var emlformat=require(_0xe3de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3de('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3de('0x2'));var moment=require('moment');var BPromise=require(_0xe3de('0x3'));var Mustache=require('mustache');var util=require(_0xe3de('0x4'));var path=require(_0xe3de('0x5'));var sox=require(_0xe3de('0x6'));var csv=require(_0xe3de('0x7'));var ejs=require(_0xe3de('0x8'));var fs=require('fs');var fs_extra=require(_0xe3de('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe3de('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe3de('0xb'));var toCsv=require(_0xe3de('0x7'));var querystring=require(_0xe3de('0xc'));var Papa=require(_0xe3de('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe3de('0xe'));var as=require(_0xe3de('0xf'));var pdf=require(_0xe3de('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3de('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe3de('0x12'));var licenseUtil=require(_0xe3de('0x13'));var db=require(_0xe3de('0x14'))['db'];config[_0xe3de('0x15')]=_['defaults'](config[_0xe3de('0x15')],{'host':_0xe3de('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3de('0x15')]));require(_0xe3de('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe3de('0x18')][_0xe3de('0x19')]({'port':0x232b});var client9004=jayson[_0xe3de('0x18')][_0xe3de('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x1646aa,_0x32abf5,_0x243509,_0x3baf9e){return new BPromise(function(_0x439b10,_0x5c435b){var _0x546d23=_0x3baf9e||client;return _0x546d23[_0xe3de('0x1a')](_0x1646aa,_0x243509)[_0xe3de('0x1b')](function(_0x4493a1){logger[_0xe3de('0x1c')](_0xe3de('0x1d'),_0x32abf5,_0xe3de('0x1e'));logger[_0xe3de('0x1f')](_0xe3de('0x20'),_0x32abf5,_0xe3de('0x1e'),JSON[_0xe3de('0x21')](_0x4493a1));if(_0x4493a1[_0xe3de('0x22')]){if(_0x4493a1[_0xe3de('0x22')][_0xe3de('0x23')]===0x1f4){logger[_0xe3de('0x22')](_0xe3de('0x1d'),_0x32abf5,_0x4493a1[_0xe3de('0x22')][_0xe3de('0x24')]);return _0x5c435b(_0x4493a1['error'][_0xe3de('0x24')]);}logger['error'](_0xe3de('0x1d'),_0x32abf5,_0x4493a1[_0xe3de('0x22')]['message']);return _0x439b10(_0x4493a1[_0xe3de('0x22')]['message']);}else{logger[_0xe3de('0x1c')](_0xe3de('0x1d'),_0x32abf5,_0xe3de('0x1e'));_0x439b10(_0x4493a1['result']['message']);}})['catch'](function(_0x52205b){logger[_0xe3de('0x22')](_0xe3de('0x1d'),_0x32abf5,_0x52205b);_0x5c435b(_0x52205b);});});}function respondWithStatusCode(_0x4fb82f,_0x86a093){_0x86a093=_0x86a093||0xcc;return function(_0x245736){if(_0x245736){return _0x4fb82f[_0xe3de('0x25')](_0x86a093);}return _0x4fb82f[_0xe3de('0x26')](_0x86a093)[_0xe3de('0x27')]();};}function respondWithResult(_0x12cd39,_0x1a462e){_0x1a462e=_0x1a462e||0xc8;return function(_0x2e4d4e){if(_0x2e4d4e){return _0x12cd39[_0xe3de('0x26')](_0x1a462e)[_0xe3de('0x28')](_0x2e4d4e);}};}function respondWithFilteredResult(_0x58ab21,_0x455737){return function(_0x4ededc){if(_0x4ededc){var _0x22e25e=typeof _0x455737[_0xe3de('0x29')]===_0xe3de('0x2a')&&typeof _0x455737[_0xe3de('0x2b')]==='undefined';var _0x55d9cf=_0x4ededc[_0xe3de('0x2c')];var _0x41ffe9=_0x22e25e?0x0:_0x455737[_0xe3de('0x29')];var _0x58bbe6=_0x22e25e?_0x4ededc['count']:_0x455737['offset']+_0x455737[_0xe3de('0x2b')];var _0x680a4c;if(_0x58bbe6>=_0x55d9cf){_0x58bbe6=_0x55d9cf;_0x680a4c=0xc8;}else{_0x680a4c=0xce;}_0x58ab21[_0xe3de('0x26')](_0x680a4c);return _0x58ab21[_0xe3de('0x2d')](_0xe3de('0x2e'),_0x41ffe9+'-'+_0x58bbe6+'/'+_0x55d9cf)['json'](_0x4ededc);}return null;};}function patchUpdates(_0x3fee24){return function(_0x15dbad){try{jsonpatch['apply'](_0x15dbad,_0x3fee24,!![]);}catch(_0x1724e8){return BPromise['reject'](_0x1724e8);}return _0x15dbad[_0xe3de('0x2f')]();};}function saveUpdates(_0x10c721,_0x3946a8){return function(_0x38d615){if(_0x38d615){return _0x38d615[_0xe3de('0x30')](_0x10c721)[_0xe3de('0x1b')](function(_0x5500de){return _0x5500de;});}return null;};}function removeEntity(_0x306dc4,_0x23bf06){return function(_0x250509){if(_0x250509){return _0x250509[_0xe3de('0x31')]()['then'](function(){_0x306dc4[_0xe3de('0x26')](0xcc)[_0xe3de('0x27')]();});}};}function handleEntityNotFound(_0x50d3ae,_0x326684){return function(_0x4c20ac){if(!_0x4c20ac){_0x50d3ae['sendStatus'](0x194);}return _0x4c20ac;};}function handleError(_0x2204b3,_0x4a41fc){_0x4a41fc=_0x4a41fc||0x1f4;return function(_0x3d8e0f){logger['error'](_0x3d8e0f[_0xe3de('0x32')]);if(_0x3d8e0f[_0xe3de('0x33')]){delete _0x3d8e0f[_0xe3de('0x33')];}_0x2204b3[_0xe3de('0x26')](_0x4a41fc)[_0xe3de('0x34')](_0x3d8e0f);};}function getMustacheRender(_0x4e98d6,_0x4d617f){return Mustache[_0xe3de('0x35')](_0x4e98d6,_['merge'](_0x4d617f[_0xe3de('0x36')],{'contact':_0x4d617f[_0xe3de('0x37')],'message':_0x4d617f[_0xe3de('0x24')],'agent':_0x4d617f[_0xe3de('0x38')],'interaction':_0x4d617f[_0xe3de('0x39')],'account':_0x4d617f['account']}))||'';}function getInteractionUsers(_0x2d4704,_0x2488a6){return new BPromise(function(_0x1adaa7,_0x40deb0){try{if(_0x2488a6[_0x2d4704['id']]){_0x2d4704[_0xe3de('0x3a')]=_[_0xe3de('0x3b')](_0x2488a6[_0x2d4704['id']],function(_0x47c103){return{'id':_0x47c103['id'],'fullname':_0x47c103['fullname']};});}}catch(_0x83feb8){_0x40deb0(_0x83feb8);}_0x1adaa7(_0x2d4704);});}function getInteractionTags(_0x565ab2,_0x3a0d46){return new BPromise(function(_0x151991,_0x93570f){try{if(_0x565ab2['TagIds']){_0x565ab2[_0xe3de('0x3c')]=[];_0x565ab2[_0xe3de('0x3d')][_0xe3de('0x3e')](',')[_0xe3de('0x3f')](function(_0x3bcb6a){_0x565ab2[_0xe3de('0x3c')][_0xe3de('0x40')](_0x3a0d46[_0x3bcb6a]);});}delete _0x565ab2['TagIds'];}catch(_0x5e3afd){_0x93570f(_0x5e3afd);}_0x151991(_0x565ab2);});}function updateChatInteraction(_0x57529b,_0x55d0db,_0x198546){return new BPromise(function(_0x53e663,_0x340e3c){return getInteractionUsers(_0x57529b,_0x198546)[_0xe3de('0x1b')](function(_0x4ec604){return getInteractionTags(_0x4ec604,_0x55d0db);})[_0xe3de('0x1b')](function(_0x1507a1){return getStateInteraction(_0x1507a1);})[_0xe3de('0x1b')](function(_0x412a7c){_0x53e663(_0x412a7c);})[_0xe3de('0x41')](function(_0x4a7294){_0x340e3c(_0x4a7294);});});}function getStateInteraction(_0x278e3d){return new BPromise(function(_0x185098){_0x278e3d['waiting']=0x0;_0x278e3d[_0xe3de('0x42')]=0x0;_0x278e3d[_0xe3de('0x43')]=0x0;_0x278e3d[_0xe3de('0x44')]=0x0;_0x278e3d['abandoned']=0x0;_0x278e3d[_0xe3de('0x45')]=0x0;if(!_0x278e3d[_0xe3de('0x46')]&&!_0x278e3d['UserId']){_0x278e3d['waiting']+=0x1;}if(!_0x278e3d[_0xe3de('0x46')]&&_0x278e3d[_0xe3de('0x47')]){_0x278e3d[_0xe3de('0x42')]+=0x1;if(_0x278e3d['waiting']){_0x278e3d[_0xe3de('0x48')]-=0x1;}}if(_0x278e3d[_0xe3de('0x46')]&&_0x278e3d[_0xe3de('0x49')]==='abandoned'){_0x278e3d[_0xe3de('0x4a')]+=0x1;if(_0x278e3d[_0xe3de('0x48')]){_0x278e3d['waiting']-=0x1;}}else if(_0x278e3d[_0xe3de('0x46')]&&!_0x278e3d[_0xe3de('0x47')]&&_0x278e3d[_0xe3de('0x49')]){_0x278e3d[_0xe3de('0x44')]+=0x1;if(_0x278e3d[_0xe3de('0x48')]){_0x278e3d[_0xe3de('0x48')]-=0x1;}}else if(_0x278e3d['closed']&&_0x278e3d[_0xe3de('0x47')]){_0x278e3d[_0xe3de('0x43')]+=0x1;if(_0x278e3d[_0xe3de('0x42')]){_0x278e3d[_0xe3de('0x42')]-=0x1;}}_0x278e3d[_0xe3de('0x45')]+=0x1;_0x185098(_0x278e3d);});}exports['index']=function(_0x1f80c4,_0x472e43){var _0x444c4b={},_0x31a492={},_0x3d5a0c={'count':0x0,'rows':[]};var _0x5bde57=_['map'](db[_0xe3de('0x4b')][_0xe3de('0x4c')],function(_0x148ff6){return{'name':_0x148ff6[_0xe3de('0x4d')],'type':_0x148ff6[_0xe3de('0x4e')][_0xe3de('0x4f')]};});_0x31a492['model']=_[_0xe3de('0x3b')](_0x5bde57,_0xe3de('0x33'));_0x31a492[_0xe3de('0x50')]=_['keys'](_0x1f80c4[_0xe3de('0x50')]);_0x31a492[_0xe3de('0x51')]=_[_0xe3de('0x52')](_0x31a492[_0xe3de('0x53')],_0x31a492[_0xe3de('0x50')]);_0x444c4b[_0xe3de('0x54')]=_[_0xe3de('0x52')](_0x31a492[_0xe3de('0x53')],qs[_0xe3de('0x55')](_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x55')]));_0x444c4b[_0xe3de('0x54')]=_0x444c4b[_0xe3de('0x54')][_0xe3de('0x56')]?_0x444c4b['attributes']:_0x31a492[_0xe3de('0x53')];if(!_0x1f80c4['query'][_0xe3de('0x57')]('nolimit')){_0x444c4b[_0xe3de('0x2b')]=qs[_0xe3de('0x2b')](_0x1f80c4[_0xe3de('0x50')]['limit']);_0x444c4b[_0xe3de('0x29')]=qs['offset'](_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x29')]);}_0x444c4b[_0xe3de('0x58')]=qs[_0xe3de('0x59')](_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x59')]);_0x444c4b['where']=qs[_0xe3de('0x51')](_[_0xe3de('0x5a')](_0x1f80c4[_0xe3de('0x50')],_0x31a492[_0xe3de('0x51')]),_0x5bde57);var _0x32e10e=[];var _0xadf49a=squel[_0xe3de('0x5b')]()['field']('id')[_0xe3de('0x5c')](_0xe3de('0x33'))['field']('color')[_0xe3de('0x5d')]('tools_tags');var _0x8b884f=squel[_0xe3de('0x5b')]()[_0xe3de('0x5c')]('u.id')[_0xe3de('0x5c')](_0xe3de('0x5e'))[_0xe3de('0x5c')](_0xe3de('0x5f'))[_0xe3de('0x5d')](_0xe3de('0x60'),'ui')[_0xe3de('0x61')]('users','u','u.id\x20=\x20ui.UserId');var _0x59f2db=squel[_0xe3de('0x5b')]()[_0xe3de('0x5d')](_0xe3de('0x62'),'i')[_0xe3de('0x61')]('cm_contacts','c',_0xe3de('0x63'))[_0xe3de('0x61')]('users','o',_0xe3de('0x64'))[_0xe3de('0x61')](_0xe3de('0x65'),'a',_0xe3de('0x66'))[_0xe3de('0x61')](_0xe3de('0x67'),'me',_0xe3de('0x68'))['left_join'](_0xe3de('0x69'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xe3de('0x61')]('tools_tags','t',_0xe3de('0x6a'));var _0x48aa7d=squel['expr']();var _0x1a74d3=[];var _0x4c1f79=squel[_0xe3de('0x6b')]();var _0x4927a2;if(_0x1f80c4[_0xe3de('0x50')]['search']){_0x4927a2=as[_0xe3de('0x6c')](_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x6d')]);var _0x58eda9=_0x4927a2[_0xe3de('0x6e')];for(var _0x47b1ca=0x0;_0x47b1ca<_0x4927a2[_0xe3de('0x6f')][_0xe3de('0x56')];_0x47b1ca++){var _0x3ca32a=_0x4927a2['conditions'][_0x47b1ca];var _0x1d3979='i';var _0x10bc11=_[_0xe3de('0x70')](_0x5bde57,[_0xe3de('0x33'),_0x3ca32a[_0xe3de('0x5c')]]);if(!_0x10bc11){switch(_0x3ca32a['field']){case _0xe3de('0x71'):if(_0x3ca32a[_0xe3de('0x72')]==0x1){_0x59f2db['having']('`'+_0x3ca32a[_0xe3de('0x5c')]+_0xe3de('0x73'));}else{_0x59f2db[_0xe3de('0x74')]('`'+_0x3ca32a['field']+_0xe3de('0x75'));}break;case'Contact':if(_0x3ca32a['operator']===_0xe3de('0x76')){if(_0x3ca32a[_0xe3de('0x72')][_0xe3de('0x3e')]('\x20')[_0xe3de('0x56')]>0x1){_0x48aa7d[_0x58eda9](_0xe3de('0x77'),qs['getFullTextValue'](_0x3ca32a[_0xe3de('0x72')]),null);}else{var _0x4de0df='%'+_0x3ca32a[_0xe3de('0x72')]+'%';_0x48aa7d[_0x58eda9](_0xe3de('0x78'),_0x4de0df,_0x4de0df,_0x4de0df);}}else{_0x10bc11=_['find'](_0x5bde57,['name',_0xe3de('0x79')]);_0x3ca32a['field']=_0xe3de('0x79');_0x5d8514=as['buildExpression'](_0x1d3979,_0x10bc11[_0xe3de('0x4e')],_0x3ca32a);_0x48aa7d[_0x58eda9](_0x5d8514[_0xe3de('0x7a')],_0x5d8514[_0xe3de('0x72')][_0xe3de('0x7b')],_0x5d8514['value'][_0xe3de('0x27')]);}break;case'Tag':var _0x25b4ce=_0x3ca32a['value'][_0xe3de('0x3e')](',')[_0xe3de('0x3b')](function(_0x512adc){return Number(_0x512adc);});_0x25b4ce[_0xe3de('0x3f')](function(_0x526986){_0x4c1f79['or'](_0xe3de('0x7c'),'%,'+_0x526986+',%');});_0x1a74d3=_[_0xe3de('0x7d')](_0x1a74d3,_0x25b4ce);break;case _0xe3de('0x7e'):if(_0x3ca32a[_0xe3de('0x7f')]===_0xe3de('0x76')){_0x48aa7d[_0x58eda9](_0xe3de('0x80'),'%'+_0x3ca32a[_0xe3de('0x72')]+'%',null);}else{_0x10bc11=_[_0xe3de('0x70')](_0x5bde57,[_0xe3de('0x33'),_0xe3de('0x47')]);_0x3ca32a[_0xe3de('0x5c')]=_0xe3de('0x47');_0x5d8514=as['buildExpression'](_0x1d3979,_0x10bc11[_0xe3de('0x4e')],_0x3ca32a);_0x48aa7d[_0x58eda9](_0x5d8514[_0xe3de('0x7a')],_0x5d8514[_0xe3de('0x72')][_0xe3de('0x7b')],_0x5d8514[_0xe3de('0x72')][_0xe3de('0x27')]);}break;case'body':_0x5d8514=as['buildExpression']('me',null,_0x3ca32a);_0x48aa7d[_0x58eda9](_0x5d8514[_0xe3de('0x7a')],_0x5d8514[_0xe3de('0x72')][_0xe3de('0x7b')],_0x5d8514[_0xe3de('0x72')][_0xe3de('0x27')]);break;}}else{var _0x5d8514=as[_0xe3de('0x81')](_0x1d3979,_0x10bc11[_0xe3de('0x4e')],_0x3ca32a);_0x48aa7d[_0x58eda9](_0x5d8514[_0xe3de('0x7a')],_0x5d8514[_0xe3de('0x72')]['start'],_0x5d8514[_0xe3de('0x72')][_0xe3de('0x27')]);}}}else{var _0x3179e5=_(_0x1f80c4[_0xe3de('0x50')])[_0xe3de('0x82')]()[_0xe3de('0x3b')](function(_0x44dfe4){return _['some'](_0x5bde57,['name',_0x44dfe4])?_0x44dfe4:undefined;})[_0xe3de('0x83')]()[_0xe3de('0x72')]();if(!_['isEmpty'](_0x3179e5)){_0x3179e5[_0xe3de('0x3f')](function(_0x5dae5d){if(_0x5dae5d===_0xe3de('0x84')){_0x59f2db[_0xe3de('0x85')](_0xe3de('0x86'),[][_0xe3de('0x87')](_0x1f80c4[_0xe3de('0x50')][_0x5dae5d]));}else if(_0x5dae5d===_0xe3de('0x88')){var _0x2c9f3e=JSON[_0xe3de('0x89')](_0x1f80c4[_0xe3de('0x50')][_0x5dae5d])[_0xe3de('0x8a')];var _0x2d7b37=JSON[_0xe3de('0x89')](_0x1f80c4[_0xe3de('0x50')][_0x5dae5d])[_0xe3de('0x8b')];_0x59f2db[_0xe3de('0x85')](_0xe3de('0x8c'),_0x2c9f3e,_0x2d7b37);}else{if(_0x1f80c4[_0xe3de('0x50')][_0x5dae5d]==='null'){_0x59f2db[_0xe3de('0x85')]('i.'+_0x5dae5d+_0xe3de('0x8d'));}else{_0x59f2db[_0xe3de('0x85')]('i.'+_0x5dae5d+_0xe3de('0x8e'),_0x1f80c4[_0xe3de('0x50')][_0x5dae5d]);}}});}if(_0x1f80c4['query']['read']){if(_0x1f80c4[_0xe3de('0x50')]['read']==0x1){_0x59f2db['having'](_0xe3de('0x8f'));}else{_0x59f2db['having'](_0xe3de('0x90'));}}if(_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x91')]){_0x1a74d3=_[_0xe3de('0x92')](_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x91')])?_0x1f80c4['query'][_0xe3de('0x91')]:new Array(_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x91')]);_0x1a74d3[_0xe3de('0x3f')](function(_0x159ee4){_0x4c1f79['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x159ee4+',%');});}if(_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x93')]){var _0x230b77=_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x93')]['replace']('\x5c','\x5c\x5c')[_0xe3de('0x94')](/'/g,'\x27\x27');if(qs[_0xe3de('0x95')](_0x230b77)){_0x48aa7d['or'](_0xe3de('0x96'),_0x230b77+'%');}else{_0x48aa7d['or'](_0xe3de('0x97'),qs[_0xe3de('0x98')](_0x230b77))['or'](_0xe3de('0x99'),_0x230b77+'%');}}}_0x59f2db[_0xe3de('0x85')](_0x48aa7d);_0x59f2db['group']('i.id');var _0x2de3a1={'type':db[_0xe3de('0x9a')]['QueryTypes'][_0xe3de('0x9b')],'raw':!![]};var _0x329c02=_0x59f2db[_0xe3de('0x9c')]();_0x329c02['field'](_0xe3de('0x9d'));_0x329c02[_0xe3de('0x5c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x444c4b['order']){_0x444c4b['order'][_0xe3de('0x3f')](function(_0x4eb0df){var _0x5d5f3a=_0x4eb0df[0x0]===_0xe3de('0x9e')?_0x4eb0df[0x0]:'i.'+_0x4eb0df[0x0];_0x59f2db[_0xe3de('0x58')](_0x5d5f3a,_0x4eb0df[0x1]===_0xe3de('0x9f')?![]:!![]);});}if(!_[_0xe3de('0xa0')](_0x1a74d3)){_0x59f2db[_0xe3de('0x74')](_0x4c1f79);_0x329c02[_0xe3de('0x85')]('t.id\x20IN\x20?',_0x1a74d3);}BPromise[_0xe3de('0xa1')]()[_0xe3de('0x1b')](function(){if(!_0x4927a2){if(_0x1f80c4[_0xe3de('0x50')][_0xe3de('0x84')])return;_0x329c02['where'](_0xe3de('0xa2'));_0x59f2db[_0xe3de('0x85')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x1f80c4['user'][_0xe3de('0xa3')]!==_0xe3de('0x38'))return;return _0x1f80c4[_0xe3de('0xa4')][_0xe3de('0xa5')]({'attributes':['id'],'raw':!![]})[_0xe3de('0x1b')](function(_0x1540de){if(_['isEmpty'](_0x1540de)){_0x329c02[_0xe3de('0x85')]('i.ChatWebsiteId\x20IS\x20NULL');_0x59f2db[_0xe3de('0x85')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x329c02[_0xe3de('0x85')](_0xe3de('0x86'),_[_0xe3de('0x3b')](_0x1540de,'id'));_0x59f2db['where'](_0xe3de('0x86'),_[_0xe3de('0x3b')](_0x1540de,'id'));}});})[_0xe3de('0x1b')](function(){if(_0x1f80c4['user'][_0xe3de('0xa3')]===_0xe3de('0x38')&&!_0x4927a2&&!_0x1f80c4[_0xe3de('0x50')]['ChatWebsiteId'])return[];return db[_0xe3de('0xa6')][_0xe3de('0x50')](_0x329c02[_0xe3de('0xa7')](),_0x2de3a1);})['then'](function(_0x5cb82d){_0x3d5a0c[_0xe3de('0x2c')]=_0x5cb82d['length'];if(_0x3d5a0c[_0xe3de('0x2c')]===0x0)return[];return db[_0xe3de('0xa6')]['query'](_0xadf49a['toString'](),_0x2de3a1)[_0xe3de('0x1b')](function(_0x1ddcb0){_0x32e10e=_[_0xe3de('0xa8')](_0x1ddcb0,'id');_0x2de3a1=_[_0xe3de('0xa9')](_0x2de3a1,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f80c4['query'][_0xe3de('0x55')]){_0x444c4b[_0xe3de('0x54')]['forEach'](function(_0xa10c69){_0x59f2db[_0xe3de('0x5c')]('i.'+_0xa10c69);});}else{_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xaa'),_0xe3de('0x71'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xab'),_0xe3de('0xac'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xad'),_0xe3de('0xae'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xaf'),_0xe3de('0x9e'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xb0'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xb1'),_0xe3de('0xb2'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xb3'),'Contact.lastName');_0x59f2db[_0xe3de('0x5c')]('c.email',_0xe3de('0xb4'));_0x59f2db['field'](_0xe3de('0xb5'),_0xe3de('0xb6'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xb7'),_0xe3de('0xb8'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xb9'),'Contact.fax');_0x59f2db['field'](_0xe3de('0xba'),'Owner.fullname');_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xbb'),_0xe3de('0xbc'));_0x59f2db[_0xe3de('0x5c')](_0xe3de('0xbd'),_0xe3de('0x3d'));}if(_0x444c4b[_0xe3de('0x2b')])_0x59f2db[_0xe3de('0x2b')](_0x444c4b['limit']);if(_0x444c4b[_0xe3de('0x29')])_0x59f2db['offset'](_0x444c4b[_0xe3de('0x29')]);return db[_0xe3de('0xa6')][_0xe3de('0x50')](_0x59f2db[_0xe3de('0xa7')](),_0x2de3a1);})[_0xe3de('0x1b')](function(_0x227b5d){if(_0x227b5d['length']>0x0)_0x8b884f[_0xe3de('0x85')](_0xe3de('0xbe'),_[_0xe3de('0x3b')](_0x227b5d,'id'));return db[_0xe3de('0xa6')][_0xe3de('0x50')](_0x8b884f[_0xe3de('0xa7')](),_0x2de3a1)[_0xe3de('0x1b')](function(_0x2c0bcb){var _0x5632c2=_[_0xe3de('0xbf')](_0x2c0bcb,_0xe3de('0xc0'));var _0x5d379d=[];_0x227b5d[_0xe3de('0x3f')](function(_0x251d71){_0x5d379d[_0xe3de('0x40')](updateChatInteraction(_0x251d71,_0x32e10e,_0x5632c2));});return BPromise['all'](_0x5d379d);});});})['then'](function(_0x1a0ced){_0x3d5a0c[_0xe3de('0xc1')]=_0x1a0ced;return _0x3d5a0c;})[_0xe3de('0x1b')](respondWithFilteredResult(_0x472e43,_0x444c4b))['catch'](handleError(_0x472e43,null));};exports['show']=function(_0x4996f0,_0x41c98e){var _0x3f85f9={'raw':![],'where':{'id':_0x4996f0[_0xe3de('0xc2')]['id']}},_0x664e07={};_0x664e07[_0xe3de('0x53')]=_[_0xe3de('0x82')](db[_0xe3de('0x4b')][_0xe3de('0x4c')]);_0x664e07['query']=_[_0xe3de('0x82')](_0x4996f0[_0xe3de('0x50')]);_0x664e07['filters']=_[_0xe3de('0x52')](_0x664e07['model'],_0x664e07[_0xe3de('0x50')]);_0x3f85f9['attributes']=_['intersection'](_0x664e07[_0xe3de('0x53')],qs[_0xe3de('0x55')](_0x4996f0[_0xe3de('0x50')][_0xe3de('0x55')]));_0x3f85f9[_0xe3de('0x54')]=_0x3f85f9[_0xe3de('0x54')][_0xe3de('0x56')]?_0x3f85f9[_0xe3de('0x54')]:_0x664e07[_0xe3de('0x53')];if(_0x4996f0[_0xe3de('0x50')][_0xe3de('0xc3')]){_0x3f85f9[_0xe3de('0xc4')]=[{'all':!![]}];}_0x3f85f9=_[_0xe3de('0xa9')]({},_0x3f85f9,_0x4996f0[_0xe3de('0xc5')]);return db['ChatInteraction'][_0xe3de('0x70')](_0x3f85f9)[_0xe3de('0x1b')](handleEntityNotFound(_0x41c98e,null))[_0xe3de('0x1b')](respondWithResult(_0x41c98e,null))[_0xe3de('0x41')](handleError(_0x41c98e,null));};exports[_0xe3de('0xc6')]=function(_0x40456d,_0x297765){return db[_0xe3de('0x4b')][_0xe3de('0xc6')](_0x40456d['body'],{})[_0xe3de('0x1b')](respondWithResult(_0x297765,0xc9))[_0xe3de('0x41')](handleError(_0x297765,null));};exports['update']=function(_0x40fbd8,_0x3c0707){if(_0x40fbd8[_0xe3de('0x36')]['id']){delete _0x40fbd8[_0xe3de('0x36')]['id'];}return db[_0xe3de('0x4b')]['find']({'where':{'id':_0x40fbd8[_0xe3de('0xc2')]['id']}})['then'](handleEntityNotFound(_0x3c0707,null))[_0xe3de('0x1b')](saveUpdates(_0x40fbd8[_0xe3de('0x36')],null))[_0xe3de('0x1b')](respondWithResult(_0x3c0707,null))[_0xe3de('0x41')](handleError(_0x3c0707,null));};exports[_0xe3de('0x31')]=function(_0x307086,_0x297f67){return db[_0xe3de('0x4b')][_0xe3de('0x70')]({'where':{'id':_0x307086['params']['id']}})[_0xe3de('0x1b')](handleEntityNotFound(_0x297f67,null))['then'](removeEntity(_0x297f67,null))[_0xe3de('0x41')](handleError(_0x297f67,null));};exports['describe']=function(_0x3d60f5,_0x59c29c){return db['ChatInteraction']['describe']()[_0xe3de('0x1b')](respondWithResult(_0x59c29c,null))[_0xe3de('0x41')](handleError(_0x59c29c,null));};exports[_0xe3de('0xc7')]=function(_0x5e227b,_0x1d5394){var _0x1108d8=_0x5e227b[_0xe3de('0xc2')]['id'];var _0x5d4927;var _0x2e95d;var _0x44706a;return db[_0xe3de('0x4b')][_0xe3de('0xc8')]({'where':{'id':_0x1108d8}})[_0xe3de('0x1b')](function(_0x45a9f9){_0x5d4927=_0x45a9f9;return db[_0xe3de('0xc9')][_0xe3de('0xc8')]({'where':{'id':_0x45a9f9[_0xe3de('0x84')]},'attributes':['id',_0xe3de('0xca'),_0xe3de('0xcb'),'vidaooTopic',_0xe3de('0xcc'),_0xe3de('0xcd')],'raw':!![]});})[_0xe3de('0x1b')](function(_0x216cfc){if(_0x216cfc&&_0x216cfc['vidaooApiKey']&&_0x216cfc[_0xe3de('0xcb')]){_0x2e95d=_0x216cfc;var _0x10a11e={'interaction':{'id':_0x1108d8},'agent':{'id':_0x5e227b['user']['id'],'name':_0x5e227b[_0xe3de('0xa4')][_0xe3de('0x33')],'fullname':_0x5e227b['user'][_0xe3de('0xce')],'email':_0x5e227b[_0xe3de('0xa4')][_0xe3de('0xcf')]},'contact':_0x5e227b[_0xe3de('0x36')][_0xe3de('0x37')],'account':_0x5e227b[_0xe3de('0x36')][_0xe3de('0xd0')]};var _0x98c3de={'rejectUnauthorized':![],'method':_0xe3de('0xd1'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x216cfc[_0xe3de('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5e227b[_0xe3de('0xa4')]['email']],'buttons':null,'topic':_0x2e95d['vidaooTopic'],'note':_['isNull'](_0x2e95d[_0xe3de('0xcc')])?null:getMustacheRender(_0x2e95d[_0xe3de('0xcc')],_0x10a11e),'metadata':null},'redirect':_0xe3de('0xd2'),'json':!![]};try{if(!_[_0xe3de('0xd3')](_0x2e95d[_0xe3de('0xcd')])){var _0x21e3b0=getMustacheRender(_0x2e95d['vidaooMetadata'],_0x10a11e);var _0x5ecf80=JSON[_0xe3de('0x89')](_0x21e3b0);_0x98c3de['body']['metadata']=_0x5ecf80;}}catch(_0x2e2324){throw new db[(_0xe3de('0x9a'))]['ValidationError'](_0xe3de('0xd4'));}return rp(_0x98c3de);}else{throw new db['Sequelize'][(_0xe3de('0xd5'))](_0xe3de('0xd6'));}})[_0xe3de('0x1b')](function(_0x5dd7c){_0x44706a=_0x5dd7c;if(_0x44706a['id']){var _0x680f2d={'body':_0x44706a[_0xe3de('0xd7')],'ChatWebsiteId':_0x2e95d['id'],'ChatInteractionId':_0x5d4927['id'],'direction':_0xe3de('0xd8'),'UserId':_0x5e227b[_0xe3de('0xa4')]['id']};return db[_0xe3de('0xd9')]['create'](_0x680f2d,{});}else{throw new db[(_0xe3de('0x9a'))][(_0xe3de('0xd5'))](_0xe3de('0xda'));}})['then'](function(){return _0x5d4927[_0xe3de('0xdb')]({'vidaooSessionId':_0x44706a['id']});})[_0xe3de('0x1b')](respondWithResult(_0x1d5394,null))[_0xe3de('0x41')](handleError(_0x1d5394,null));};exports['customUpdate']=function(_0x33bdc4,_0x2f415f){if(_0x33bdc4[_0xe3de('0x36')]['id']){delete _0x33bdc4[_0xe3de('0x36')]['id'];}return db[_0xe3de('0x4b')][_0xe3de('0x70')]({'where':{'id':_0x33bdc4[_0xe3de('0xc2')]['id']},'include':[{'model':db['CmContact'],'as':_0xe3de('0xdc')}]})[_0xe3de('0x1b')](handleEntityNotFound(_0x2f415f,null))[_0xe3de('0x1b')](saveUpdates(_0x33bdc4['body'],null))['then'](respondWithResult(_0x2f415f,null))['catch'](handleError(_0x2f415f,null));};exports[_0xe3de('0xdd')]=function(_0x58baf1,_0x2c68f2,_0x3af609){if(_0x58baf1['body']['id']){delete _0x58baf1['body']['id'];}return db['ChatInteraction'][_0xe3de('0x70')]({'where':{'id':_0x58baf1[_0xe3de('0xc2')]['id']}})['then'](function(_0xbbf8ae){if(!_0xbbf8ae){logger[_0xe3de('0x22')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xe3de('0xdd'),0x194,_0xe3de('0xde'));_0x2c68f2['sendStatus'](0x194);}else{if(_0xbbf8ae[_0xe3de('0x47')]){throw new db[(_0xe3de('0x9a'))][(_0xe3de('0xd5'))]('Interaction\x20already\x20assigned');}}return _0xbbf8ae;})['then'](function(_0x43559d){if(_0x43559d){return _0x43559d['update']({'closed':_0x58baf1[_0xe3de('0x36')]['closed'],'disposition':_0x58baf1[_0xe3de('0x36')]['disposition']})[_0xe3de('0x1b')](function(_0x2b2975){return _0x2b2975;});}})[_0xe3de('0x1b')](function(_0xaa357f){return respondWithRpcPromise(_0xe3de('0xdf'),'abandon',_0x58baf1[_0xe3de('0x36')],client9004);})['then'](respondWithResult(_0x2c68f2,null))[_0xe3de('0x41')](handleError(_0x2c68f2,null));};exports[_0xe3de('0xe0')]=function(_0x793e95,_0x3c49d1,_0x35f65e){_0x793e95[_0xe3de('0x36')][_0xe3de('0x33')]=_0x793e95[_0xe3de('0xe1')][_0xe3de('0xe2')];_0x793e95['body']['basename']=_0x793e95[_0xe3de('0xe1')]['filename'];_0x793e95[_0xe3de('0x36')]['type']=_0x793e95[_0xe3de('0xe1')][_0xe3de('0xe3')];return db['Attachment'][_0xe3de('0xc6')](_0x793e95['body'])[_0xe3de('0x1b')](respondWithResult(_0x3c49d1,0xc9))[_0xe3de('0x41')](handleError(_0x3c49d1,null));};exports[_0xe3de('0xe4')]=function(_0xe2675e,_0x54d09d,_0x37d1a9){return db[_0xe3de('0x4b')]['findOne']({'where':{'id':_0xe2675e[_0xe3de('0xc2')]['id']},'raw':!![]})[_0xe3de('0x1b')](handleEntityNotFound(_0x54d09d,null))['then'](function(_0x406785){if(_0x406785){if(_0x406785[_0xe3de('0x46')]){return _0x54d09d[_0xe3de('0x26')](0x193)['json']({'status':0x193,'message':_0xe3de('0xe5')});}return db[_0xe3de('0xe6')][_0xe3de('0xc8')]({'where':{'id':_0xe2675e[_0xe3de('0x50')][_0xe3de('0xe7')]},'raw':!![]})['then'](handleEntityNotFound(_0x54d09d,null));}})[_0xe3de('0x1b')](function(_0x2ca8aa){if(_0x2ca8aa){var _0x29cf6d=_0x2ca8aa[_0xe3de('0xe8')]!==null;var _0x1d97e6=path['join'](config['root'],_0xe3de('0xe9'));if(_0x29cf6d){_0x1d97e6=path[_0xe3de('0xea')](_0x1d97e6,_0xe3de('0xeb'));}var _0x1be534=path['join'](_0x1d97e6,_0x2ca8aa[_0xe3de('0xec')]);return _0x54d09d[_0xe3de('0xed')](_0x1be534);}})['catch'](handleError(_0x54d09d,null));};exports['close']=function(_0x4a0340,_0x1d42b0){var _0x4a50d8=null;var _0x33c37c=null;var _0xb14e02=null;var _0x228d6f=null;if(_0x4a0340[_0xe3de('0x36')]['id']){delete _0x4a0340['body']['id'];}if(_0x4a0340[_0xe3de('0x36')][_0xe3de('0xee')]){_0x228d6f=path[_0xe3de('0xea')](config['root'],_0xe3de('0xef'),util[_0xe3de('0xf0')](_0xe3de('0xf1'),Date[_0xe3de('0xf2')]()));_0x4a0340[_0xe3de('0x36')][_0xe3de('0xf3')]=_0x228d6f;}return db[_0xe3de('0x4b')][_0xe3de('0x70')]({'where':{'id':_0x4a0340[_0xe3de('0xc2')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xe3de('0xf4'),'include':[{'model':db[_0xe3de('0x7e')],'as':_0xe3de('0x7e')}]}]})[_0xe3de('0x1b')](handleEntityNotFound(_0x1d42b0,null))[_0xe3de('0x1b')](saveUpdates(_0x4a0340[_0xe3de('0x36')],null))[_0xe3de('0x1b')](function(_0x5df089){if(_0x5df089){_0x4a50d8=_0x5df089;return db[_0xe3de('0xc9')][_0xe3de('0x70')]({'where':{'id':_0x4a50d8[_0xe3de('0x84')]}});}})[_0xe3de('0x1b')](function(_0x3e6fea){if(_0x3e6fea){_0xb14e02=_0x3e6fea;return db['CmContact'][_0xe3de('0x70')]({'where':{'id':_0x4a50d8['ContactId']}});}})[_0xe3de('0x1b')](function(_0x2184a3){if(_0x2184a3){_0x33c37c=_0x2184a3;if(_0x228d6f){var _0x289afa=null;for(var _0x342d9a=0x1;_0x342d9a<_0x4a50d8[_0xe3de('0xf4')][_0xe3de('0x56')];++_0x342d9a){_0x289afa=_0x4a50d8[_0xe3de('0xf4')][_0x342d9a];var _0x60813c=_0x289afa[_0xe3de('0x47')]?util[_0xe3de('0xf0')](_0xe3de('0xf5'),_0xb14e02[_0xe3de('0xf6')],_0x289afa[_0xe3de('0x47')]):_0xe3de('0xf7');var _0x306a7c=_0x4a0340[_0xe3de('0x36')][_0xe3de('0xf8')]||util[_0xe3de('0xf0')](_0xe3de('0xf5'),_0xe3de('0xf9'),_0x289afa[_0xe3de('0x79')]);switch(_0xb14e02[_0xe3de('0xfa')]){case _0xe3de('0xfb'):_0x60813c=_0x289afa[_0xe3de('0x47')]?util[_0xe3de('0xf0')]('%s%d',_0xb14e02['agentAlias'],_0x289afa[_0xe3de('0x47')]):_0xe3de('0xf7');break;case _0xe3de('0xfc'):_0x60813c=_0x289afa[_0xe3de('0x47')]?_0x289afa['User'][_0xe3de('0xfd')]||_0x289afa['User'][_0xe3de('0xce')]:_0xe3de('0xf7');break;case'agent_fullname':_0x60813c=_0x289afa[_0xe3de('0x47')]?_0x289afa[_0xe3de('0x7e')][_0xe3de('0xce')]:_0xe3de('0xf7');break;default:_0x60813c=_0x289afa[_0xe3de('0x47')]?util[_0xe3de('0xf0')](_0xe3de('0xf5'),_0xb14e02['agentAlias'],_0x289afa[_0xe3de('0x47')]):_0xe3de('0xf7');}var _0x961114=util[_0xe3de('0xf0')]('[%s]\x20%s:\x20%s\x0a',moment(_0x289afa['createdAt'])['format'](_0xe3de('0xfe')),_0x289afa[_0xe3de('0xff')]==='in'?_0x306a7c:_0x60813c,_0x289afa[_0xe3de('0x36')]);if(!_0x289afa[_0xe3de('0x100')]){fs[_0xe3de('0x101')](_0x228d6f,_0x961114);}}return db[_0xe3de('0x102')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xe3de('0x103')],'as':'Smtp','raw':!![]}]});}}})[_0xe3de('0x1b')](function(_0x4d21d8){if(_0x4d21d8&&_0x4d21d8['Smtp']&&_0x4a0340[_0xe3de('0x36')]){var _0x28108b={'tls':{'rejectUnauthorized':![]}};if(_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x105')]){_0x28108b[_0xe3de('0x105')]=_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x105')];}else{_0x28108b[_0xe3de('0x106')]=_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x106')];_0x28108b['port']=_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x107')];_0x28108b[_0xe3de('0x108')]=_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x108')];}if(_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x109')]){_0x28108b[_0xe3de('0x10a')]={'user':_0x4d21d8[_0xe3de('0x104')][_0xe3de('0xa4')],'pass':_0x4d21d8[_0xe3de('0x104')][_0xe3de('0x10b')]};}return respondWithRpcPromise(_0xe3de('0x10c'),_0xe3de('0x10d'),{'account':_0x28108b,'message':{'from':util[_0xe3de('0xf0')]('\x22%s\x22\x20<%s>',_0x4d21d8[_0xe3de('0x33')],_0x4d21d8[_0xe3de('0xcf')]||_0x4d21d8[_0xe3de('0x104')][_0xe3de('0xa4')]),'to':_0x4a0340['body'][_0xe3de('0xee')],'subject':_0xe3de('0x10e'),'text':util[_0xe3de('0xf0')](_0xe3de('0x10f'),_0x4a0340[_0xe3de('0x36')]['mailTranscript']),'attachments':[{'path':_0x228d6f}]}})[_0xe3de('0x1b')](function(){return _0x4a50d8;})[_0xe3de('0x41')](function(_0x352f80){console[_0xe3de('0x22')](_0x352f80);});}else{return _0x4a50d8;}})[_0xe3de('0x1b')](respondWithStatusCode(_0x1d42b0,0xc8))['catch'](handleError(_0x1d42b0,null));};exports[_0xe3de('0x110')]=function(_0x56afcc,_0x157c2e,_0x1ee65d){return db[_0xe3de('0xd9')]['find']({'where':{'id':_0x56afcc[_0xe3de('0xc2')]['id']}})[_0xe3de('0x1b')](handleEntityNotFound(_0x157c2e,null))[_0xe3de('0x1b')](function(_0x57931e){if(_0x57931e){return _0x57931e['addMessage'](_0x56afcc['body'][_0xe3de('0x111')],_['omit'](_0x56afcc['body'],[_0xe3de('0x111'),'id'])||{});}})['then'](respondWithResult(_0x157c2e,null))[_0xe3de('0x41')](handleError(_0x157c2e,null));};exports['getMessages']=function(_0x2d04f3,_0x375280,_0xef1c02){var _0x5a568a={'raw':![],'where':{}};var _0x2e5bec={};var _0x33d8a0={'count':0x0,'rows':[]};return db[_0xe3de('0x4b')][_0xe3de('0xc8')]({'where':{'id':_0x2d04f3[_0xe3de('0xc2')]['id']}})['then'](handleEntityNotFound(_0x375280,null))['then'](function(_0x5b38d8){if(_0x5b38d8){_0x2e5bec[_0xe3de('0x53')]=_[_0xe3de('0x82')](db[_0xe3de('0xd9')]['rawAttributes']);_0x2e5bec[_0xe3de('0x50')]=_[_0xe3de('0x82')](_0x2d04f3[_0xe3de('0x50')]);_0x2e5bec[_0xe3de('0x51')]=_[_0xe3de('0x52')](_0x2e5bec[_0xe3de('0x53')],_0x2e5bec['query']);_0x5a568a[_0xe3de('0x54')]=_[_0xe3de('0x52')](_0x2e5bec[_0xe3de('0x53')],qs['fields'](_0x2d04f3['query']['fields']));_0x5a568a['attributes']=_0x5a568a['attributes']['length']?_0x5a568a[_0xe3de('0x54')]:_0x2e5bec[_0xe3de('0x53')];if(!_0x2d04f3[_0xe3de('0x50')][_0xe3de('0x57')](_0xe3de('0x112'))){_0x5a568a[_0xe3de('0x2b')]=qs['limit'](_0x2d04f3[_0xe3de('0x50')]['limit']);_0x5a568a[_0xe3de('0x29')]=qs['offset'](_0x2d04f3[_0xe3de('0x50')][_0xe3de('0x29')]);}_0x5a568a['order']=qs[_0xe3de('0x59')](_0x2d04f3[_0xe3de('0x50')][_0xe3de('0x59')]);_0x5a568a['where']=qs[_0xe3de('0x51')](_[_0xe3de('0x5a')](_0x2d04f3[_0xe3de('0x50')],_0x2e5bec[_0xe3de('0x51')]));_0x5a568a['where'][_0xe3de('0xc0')]=_0x5b38d8['id'];if(_0x2d04f3[_0xe3de('0x50')]['filter']){_0x5a568a[_0xe3de('0x85')]=_[_0xe3de('0xa9')](_0x5a568a[_0xe3de('0x85')],{'$or':_[_0xe3de('0x3b')](_0x5a568a[_0xe3de('0x54')],function(_0x505073){var _0x21a05b={};_0x21a05b[_0x505073]={'$like':'%'+_0x2d04f3['query'][_0xe3de('0x93')]+'%'};return _0x21a05b;})});}if(_0x2d04f3[_0xe3de('0x50')]['$gte']){var _0x5e7062=_0x2d04f3[_0xe3de('0x50')][_0xe3de('0x8a')][_0xe3de('0x3e')](',');var _0x1eb6f1={};_0x1eb6f1[_0x5e7062[0x0]]={'$gte':moment(_0x5e7062[0x1])[_0xe3de('0xf0')](_0xe3de('0x113'))};_0x5a568a[_0xe3de('0x85')]=_[_0xe3de('0xa9')](_0x5a568a[_0xe3de('0x85')],_0x1eb6f1);}_0x5a568a=_[_0xe3de('0xa9')]({},_0x5a568a,_0x2d04f3['options']);return db[_0xe3de('0xd9')][_0xe3de('0x2c')]({'where':_0x5a568a[_0xe3de('0x85')]})[_0xe3de('0x1b')](function(_0x130460){_0x33d8a0[_0xe3de('0x2c')]=_0x130460;if(_0x2d04f3[_0xe3de('0x50')][_0xe3de('0xc3')]){_0x5a568a[_0xe3de('0xc4')]=[{'all':!![]}];}return db[_0xe3de('0xd9')][_0xe3de('0x114')](_0x5a568a);})[_0xe3de('0x1b')](function(_0x1a9262){_0x33d8a0[_0xe3de('0xc1')]=_0x1a9262;return _0x33d8a0;});}})[_0xe3de('0x1b')](respondWithFilteredResult(_0x375280,_0x5a568a))['catch'](handleError(_0x375280,null));};exports[_0xe3de('0x115')]=function(_0x301620,_0x3ad511,_0x5ecf58){var _0x49729e={'where':{}},_0x291988={},_0x578fff={'count':0x0,'rows':[]};return db[_0xe3de('0x4b')][_0xe3de('0xc8')]({'where':{'id':_0x301620[_0xe3de('0xc2')]['id']}})[_0xe3de('0x1b')](handleEntityNotFound(_0x3ad511,null))[_0xe3de('0x1b')](function(_0x6af44d){if(_0x6af44d){_0x291988[_0xe3de('0x53')]=_['keys'](db['ChatMessage'][_0xe3de('0x4c')]);_0x291988['query']=_['keys'](_0x301620[_0xe3de('0x50')]);_0x291988[_0xe3de('0x51')]=_[_0xe3de('0x52')](_0x291988[_0xe3de('0x53')],_0x291988[_0xe3de('0x50')]);_0x49729e[_0xe3de('0x54')]=_[_0xe3de('0x52')](_0x291988[_0xe3de('0x53')],qs[_0xe3de('0x55')](_0x301620['query'][_0xe3de('0x55')]));_0x49729e['attributes']=_0x49729e[_0xe3de('0x54')][_0xe3de('0x56')]?_0x49729e['attributes']:_0x291988[_0xe3de('0x53')];if(!_0x301620[_0xe3de('0x50')][_0xe3de('0x57')](_0xe3de('0x112'))){_0x49729e[_0xe3de('0x2b')]=qs[_0xe3de('0x2b')](_0x301620[_0xe3de('0x50')]['limit']);_0x49729e[_0xe3de('0x29')]=qs[_0xe3de('0x29')](_0x301620[_0xe3de('0x50')][_0xe3de('0x29')]);}_0x49729e[_0xe3de('0x58')]=qs[_0xe3de('0x59')](_0x301620[_0xe3de('0x50')][_0xe3de('0x59')]);_0x49729e[_0xe3de('0x85')]=qs[_0xe3de('0x51')](_[_0xe3de('0x5a')](_0x301620[_0xe3de('0x50')],_0x291988['filters']));_0x49729e[_0xe3de('0x85')][_0xe3de('0xc0')]=_0x6af44d['id'];if(_0x301620[_0xe3de('0x50')][_0xe3de('0x93')]){_0x49729e['where']=_[_0xe3de('0xa9')](_0x49729e['where'],{'$or':_[_0xe3de('0x3b')](_0x49729e[_0xe3de('0x54')],function(_0x142bda){var _0x252fd5={};_0x252fd5[_0x142bda]={'$like':'%'+_0x301620['query'][_0xe3de('0x93')]+'%'};return _0x252fd5;})});}_0x49729e[_0xe3de('0x85')][_0xe3de('0x100')]=![];if(_0x301620['query']['id']){_0x49729e[_0xe3de('0x85')]['id']={'$gt':_0x301620[_0xe3de('0x50')]['id']};}_0x49729e=_[_0xe3de('0xa9')]({},_0x49729e,_0x301620[_0xe3de('0xc5')]);return db[_0xe3de('0xd9')][_0xe3de('0x2c')]({'where':_0x49729e['where']})[_0xe3de('0x1b')](function(_0x1033b2){_0x578fff['count']=_0x1033b2;_0x49729e[_0xe3de('0xc4')]=[];if(_0x301620[_0xe3de('0x50')]['includeAgent']){_0x49729e['include']['push']({'model':db[_0xe3de('0x7e')],'as':_0xe3de('0x7e'),'attributes':['id',_0xe3de('0xce'),_0xe3de('0xfd')]});}if(_0x301620[_0xe3de('0x50')][_0xe3de('0xc3')]){_0x49729e['include']=[{'all':!![]}];}return db['ChatMessage'][_0xe3de('0x114')](_0x49729e);})[_0xe3de('0x1b')](function(_0x4a6572){_0x578fff[_0xe3de('0xc1')]=_0x4a6572;return _0x578fff;});}})[_0xe3de('0x1b')](respondWithFilteredResult(_0x3ad511,_0x49729e))['catch'](handleError(_0x3ad511,null));};exports[_0xe3de('0x116')]=function(_0x4f3a7e,_0x4b7728,_0x49e84c){return db[_0xe3de('0x4b')]['find']({'where':{'id':_0x4f3a7e['params']['id']}})['then'](handleEntityNotFound(_0x4b7728,null))['then'](function(_0x462f51){if(_0x462f51){return _0x462f51[_0xe3de('0x117')](_0x4f3a7e['body'][_0xe3de('0x111')],_[_0xe3de('0x118')](_0x4f3a7e[_0xe3de('0x36')],[_0xe3de('0x111'),'id'])||{})[_0xe3de('0x119')](function(){return db[_0xe3de('0x11a')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x4f3a7e[_0xe3de('0x36')]['ids']}});})[_0xe3de('0x1b')](function(_0x27467f){socket[_0xe3de('0x11b')]('chatInteractionTags:save',{'id':Number(_0x4f3a7e['params']['id']),'tags':_0x27467f||[]});return{'id':Number(_0x4f3a7e[_0xe3de('0xc2')]['id']),'tags':_0x27467f||[]};});}})[_0xe3de('0x1b')](respondWithResult(_0x4b7728,null))[_0xe3de('0x41')](handleError(_0x4b7728,null));};exports['removeTags']=function(_0x14d4c4,_0x3e1cb5,_0x450bfb){return db[_0xe3de('0x4b')][_0xe3de('0x70')]({'where':{'id':_0x14d4c4[_0xe3de('0xc2')]['id']}})[_0xe3de('0x1b')](handleEntityNotFound(_0x3e1cb5,null))[_0xe3de('0x1b')](function(_0xa2471f){if(_0xa2471f){return _0xa2471f[_0xe3de('0x11c')](_0x14d4c4[_0xe3de('0x50')][_0xe3de('0x111')]);}})[_0xe3de('0x1b')](respondWithStatusCode(_0x3e1cb5,null))['catch'](handleError(_0x3e1cb5,null));};exports[_0xe3de('0xed')]=function(_0x4d2b48,_0x52d314){var _0x600249=moment()['unix']()[_0xe3de('0xa7')]();var _0x441e65=path[_0xe3de('0xea')](config['root'],_0xe3de('0x11d'),_0xe3de('0x11e'),_0xe3de('0x11f'));var _0x47e61b=path['join'](config['root'],_0xe3de('0x11d'),_0xe3de('0x11e'),_0xe3de('0x120'));var _0x32fa97=path['join'](_0x441e65,_0x600249);var _0x53c620=util[_0xe3de('0xf0')]('transcript-%d-%s.zip',_0x4d2b48[_0xe3de('0xc2')]['id'],_0x600249);var _0x162a24=path[_0xe3de('0xea')](_0x441e65,_0x53c620);var _0x37ed20=[];_0x37ed20[_0xe3de('0x40')]({'model':db['User'],'as':'User','attributes':['id',_0xe3de('0xce')],'raw':!![]});_0x37ed20['push']({'model':db[_0xe3de('0x121')],'as':_0xe3de('0xdc'),'attributes':['id',_0xe3de('0x122'),_0xe3de('0x123')],'raw':!![]});if(_0x4d2b48[_0xe3de('0x50')][_0xe3de('0x120')]){_0x37ed20[_0xe3de('0x40')]({'model':db[_0xe3de('0xe6')],'as':_0xe3de('0xe6'),'raw':!![]});}var _0x5385fc=[{'model':db[_0xe3de('0xd9')],'as':_0xe3de('0xf4'),'attributes':['id',_0xe3de('0x36'),_0xe3de('0x88'),'direction',_0xe3de('0x100'),_0xe3de('0x124')],'include':_0x37ed20}];_0x5385fc['push']({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xe3de('0x33')]});_0x5385fc['push']({'model':db[_0xe3de('0x7e')],'as':'Owner','attributes':['id','fullname']});return db[_0xe3de('0x4b')][_0xe3de('0x70')]({'where':{'id':_0x4d2b48[_0xe3de('0xc2')]['id']},'include':_0x5385fc})[_0xe3de('0x1b')](handleEntityNotFound(_0x52d314,null))[_0xe3de('0x1b')](function(_0x98d48f){if(_0x98d48f){var _0x2af98d=_0x98d48f[_0xe3de('0x125')]({'plain':!![]});fs[_0xe3de('0x126')](_0x32fa97);var _0x1bc221={'channel':_0xe3de('0x127'),'account':_0x2af98d['Account'][_0xe3de('0x33')],'agent':_0x2af98d[_0xe3de('0x128')]?_0x2af98d['Owner']['fullname']:_0xe3de('0x129'),'createdAt':moment(_0x2af98d[_0xe3de('0x88')])[_0xe3de('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2af98d[_0xe3de('0x46')]?moment(_0x2af98d[_0xe3de('0x12a')])[_0xe3de('0xf0')](_0xe3de('0x113'))[_0xe3de('0xa7')]():'','disposition':_0x2af98d[_0xe3de('0x49')],'chatInfo':{'browser':_0x2af98d['browserName'],'os':_0x2af98d[_0xe3de('0x12b')],'referer':_0x2af98d['referer'],'customerIp':_0x2af98d['customerIp'],'customerPort':_0x2af98d[_0xe3de('0x12c')]?_0x2af98d[_0xe3de('0x12c')]:_0xe3de('0x129')},'messages':_(_0x2af98d['Messages'])[_0xe3de('0x12d')]()[_0xe3de('0x93')]({'secret':![]})[_0xe3de('0x3b')](function(_0xe6a32a){if(_0xe6a32a['Attachment']){var _0x1d0d99=path['join'](_0x47e61b,_0xe6a32a['Attachment'][_0xe3de('0xec')]);if(fs[_0xe3de('0x12e')](_0x1d0d99)){fs['createReadStream'](_0x1d0d99)['pipe'](fs[_0xe3de('0x12f')](path[_0xe3de('0xea')](_0x32fa97,_0xe6a32a[_0xe3de('0xe6')]['basename'])));}}return{'date':moment(_0xe6a32a[_0xe3de('0x88')])[_0xe3de('0xf0')](_0xe3de('0x113'))[_0xe3de('0xa7')](),'sender':_0xe6a32a[_0xe3de('0xff')]===_0xe3de('0xd8')?_0xe6a32a['User']?_0xe6a32a[_0xe3de('0x7e')]['fullname']:_0xe3de('0xf7'):_0xe6a32a[_0xe3de('0xdc')][_0xe3de('0x122')]+(_0xe6a32a[_0xe3de('0xdc')][_0xe3de('0x123')]?'\x20'+_0xe6a32a[_0xe3de('0xdc')]['lastName']:''),'body':_0xe6a32a[_0xe3de('0xe6')]?_0xe6a32a['Attachment']['basename']:_0xe6a32a[_0xe3de('0x36')],'direction':_0xe6a32a[_0xe3de('0xff')]===_0xe3de('0xd8')?'A':'C','secret':_0xe6a32a['secret'],'read':_0xe6a32a[_0xe3de('0x124')],'attachment':_0xe6a32a[_0xe3de('0xe6')]};})[_0xe3de('0x72')]()};return ejs[_0xe3de('0x130')](path[_0xe3de('0xea')](config[_0xe3de('0x131')],_0xe3de('0x11d'),_0xe3de('0x132'),_0xe3de('0x133')),{'interaction':_0x1bc221})[_0xe3de('0x1b')](function(_0x8fe560){var _0x5d75f9=path[_0xe3de('0xea')](_0x32fa97,_0xe3de('0x134')+_0x2af98d['id']+'-'+_0x600249+_0xe3de('0x135'));var _0x1ac155={'path':_0x5d75f9,'channel':_0xe3de('0x127'),'interactionId':_0x2af98d['id']};return pdf[_0xe3de('0x136')](_0x8fe560,_0x1ac155);})['then'](function(){return new BPromise(function(_0x4dd21a,_0x5c095e){zipdir(_0x32fa97,{'saveTo':_0x162a24},function(_0x42afb5,_0x2ab6dd){if(_0x42afb5)return _0x5c095e(_0x42afb5);return _0x4dd21a(_0x2ab6dd);});})[_0xe3de('0x1b')](function(){return new BPromise(function(_0x1278d5,_0x55ed1e){rimraf(_0x32fa97,function(_0x478576){if(_0x478576)_0x55ed1e(_0x478576);return _0x1278d5();});});})[_0xe3de('0x1b')](function(){return _0x52d314[_0xe3de('0xed')](_0x162a24,_0x53c620,function(_0x1979a7){if(_0x1979a7){console[_0xe3de('0x137')](_0xe3de('0x138'),_0x1979a7);}else{fs['unlinkSync'](_0x162a24);}});});});}else{return _0x52d314[_0xe3de('0x25')](0xc8);}})[_0xe3de('0x41')](handleError(_0x52d314,null));}; \ No newline at end of file +var _0x225b=['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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','params','rawAttributes','options','create','describe','findOne','ChatWebsite','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','isNull','follow','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','attachmentDownload','Unauthorized','Attachment','ChatOfflineMessageId','root','join','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','getMessages','hasOwnProperty','rows','getMyMessages','nolimit','include','findAll','addTags','setTags','omit','spread','emit','chatInteractionTags:save','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','stack','name','send','merge','body','contact','agent','account','map','fullname','TagIds','Tags','forEach','push','talking','unmanaged','abandoned','closed','UserId','waiting','disposition','answered','total','index','ChatInteraction','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','o.id\x20=\x20i.UserId','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','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','c.firstName'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x225b,0x88));var _0xb225=function(_0x2ec770,_0x38f40a){_0x2ec770=_0x2ec770-0x0;var _0x578d59=_0x225b[_0x2ec770];return _0x578d59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb225('0x0'));var jsonpatch=require(_0xb225('0x1'));var rp=require(_0xb225('0x2'));var moment=require(_0xb225('0x3'));var BPromise=require(_0xb225('0x4'));var Mustache=require(_0xb225('0x5'));var util=require(_0xb225('0x6'));var path=require(_0xb225('0x7'));var sox=require(_0xb225('0x8'));var csv=require('to-csv');var ejs=require(_0xb225('0x9'));var fs=require('fs');var fs_extra=require(_0xb225('0xa'));var _=require(_0xb225('0xb'));var squel=require('squel');var crypto=require(_0xb225('0xc'));var jsforce=require(_0xb225('0xd'));var deskjs=require(_0xb225('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb225('0xf'));var Papa=require(_0xb225('0x10'));var Redis=require(_0xb225('0x11'));var authService=require(_0xb225('0x12'));var qs=require(_0xb225('0x13'));var as=require(_0xb225('0x14'));var pdf=require(_0xb225('0x15'));var hardwareService=require(_0xb225('0x16'));var logger=require(_0xb225('0x17'))(_0xb225('0x18'));var utils=require(_0xb225('0x19'));var config=require(_0xb225('0x1a'));var licenseUtil=require(_0xb225('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb225('0x1c')]=_['defaults'](config[_0xb225('0x1c')],{'host':_0xb225('0x1d'),'port':0x18eb});var socket=require(_0xb225('0x1e'))(new Redis(config[_0xb225('0x1c')]));require('./chatInteraction.socket')[_0xb225('0x1f')](socket);var jayson=require(_0xb225('0x20'));var client=jayson[_0xb225('0x21')][_0xb225('0x22')]({'port':0x232b});var client9004=jayson[_0xb225('0x21')][_0xb225('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x4c8d56,_0x1d72b9,_0x48e2f5,_0x5bb104){return new BPromise(function(_0x4f480e,_0x1b74e3){var _0x4aeda1=_0x5bb104||client;return _0x4aeda1[_0xb225('0x23')](_0x4c8d56,_0x48e2f5)[_0xb225('0x24')](function(_0x1c20fe){logger[_0xb225('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x1d72b9,_0xb225('0x26'));logger[_0xb225('0x27')](_0xb225('0x28'),_0x1d72b9,_0xb225('0x26'),JSON[_0xb225('0x29')](_0x1c20fe));if(_0x1c20fe[_0xb225('0x2a')]){if(_0x1c20fe[_0xb225('0x2a')][_0xb225('0x2b')]===0x1f4){logger[_0xb225('0x2a')](_0xb225('0x2c'),_0x1d72b9,_0x1c20fe[_0xb225('0x2a')][_0xb225('0x2d')]);return _0x1b74e3(_0x1c20fe[_0xb225('0x2a')][_0xb225('0x2d')]);}logger['error'](_0xb225('0x2c'),_0x1d72b9,_0x1c20fe[_0xb225('0x2a')]['message']);return _0x4f480e(_0x1c20fe['error'][_0xb225('0x2d')]);}else{logger[_0xb225('0x25')](_0xb225('0x2c'),_0x1d72b9,_0xb225('0x26'));_0x4f480e(_0x1c20fe[_0xb225('0x2e')][_0xb225('0x2d')]);}})[_0xb225('0x2f')](function(_0x2ba106){logger['error'](_0xb225('0x2c'),_0x1d72b9,_0x2ba106);_0x1b74e3(_0x2ba106);});});}function respondWithStatusCode(_0xa3360e,_0x4da51a){_0x4da51a=_0x4da51a||0xcc;return function(_0x62904c){if(_0x62904c){return _0xa3360e[_0xb225('0x30')](_0x4da51a);}return _0xa3360e[_0xb225('0x31')](_0x4da51a)['end']();};}function respondWithResult(_0xbfe474,_0x310aa9){_0x310aa9=_0x310aa9||0xc8;return function(_0xfcb608){if(_0xfcb608){return _0xbfe474['status'](_0x310aa9)['json'](_0xfcb608);}};}function respondWithFilteredResult(_0x299f9a,_0x191be8){return function(_0x2ba218){if(_0x2ba218){var _0x1fe874=typeof _0x191be8[_0xb225('0x32')]===_0xb225('0x33')&&typeof _0x191be8[_0xb225('0x34')]===_0xb225('0x33');var _0x480ba3=_0x2ba218[_0xb225('0x35')];var _0x39136=_0x1fe874?0x0:_0x191be8[_0xb225('0x32')];var _0x40e383=_0x1fe874?_0x2ba218[_0xb225('0x35')]:_0x191be8[_0xb225('0x32')]+_0x191be8[_0xb225('0x34')];var _0x314d95;if(_0x40e383>=_0x480ba3){_0x40e383=_0x480ba3;_0x314d95=0xc8;}else{_0x314d95=0xce;}_0x299f9a[_0xb225('0x31')](_0x314d95);return _0x299f9a[_0xb225('0x36')]('Content-Range',_0x39136+'-'+_0x40e383+'/'+_0x480ba3)[_0xb225('0x37')](_0x2ba218);}return null;};}function patchUpdates(_0x5af676){return function(_0x627810){try{jsonpatch[_0xb225('0x38')](_0x627810,_0x5af676,!![]);}catch(_0x3547f5){return BPromise[_0xb225('0x39')](_0x3547f5);}return _0x627810[_0xb225('0x3a')]();};}function saveUpdates(_0x10929f,_0x20d689){return function(_0x182125){if(_0x182125){return _0x182125[_0xb225('0x3b')](_0x10929f)[_0xb225('0x24')](function(_0x22f6ec){return _0x22f6ec;});}return null;};}function removeEntity(_0x5e0bce,_0x2263ae){return function(_0x3e4a92){if(_0x3e4a92){return _0x3e4a92[_0xb225('0x3c')]()[_0xb225('0x24')](function(){_0x5e0bce[_0xb225('0x31')](0xcc)[_0xb225('0x3d')]();});}};}function handleEntityNotFound(_0x361464,_0x4b761){return function(_0x9330a8){if(!_0x9330a8){_0x361464[_0xb225('0x30')](0x194);}return _0x9330a8;};}function handleError(_0x125938,_0x2d8dcc){_0x2d8dcc=_0x2d8dcc||0x1f4;return function(_0x24dede){logger[_0xb225('0x2a')](_0x24dede[_0xb225('0x3e')]);if(_0x24dede[_0xb225('0x3f')]){delete _0x24dede[_0xb225('0x3f')];}_0x125938['status'](_0x2d8dcc)[_0xb225('0x40')](_0x24dede);};}function getMustacheRender(_0x29743f,_0x43347c){return Mustache['render'](_0x29743f,_[_0xb225('0x41')](_0x43347c[_0xb225('0x42')],{'contact':_0x43347c[_0xb225('0x43')],'message':_0x43347c['message'],'agent':_0x43347c[_0xb225('0x44')],'interaction':_0x43347c['interaction'],'account':_0x43347c[_0xb225('0x45')]}))||'';}function getInteractionUsers(_0x3d1a1e,_0x128b36){return new BPromise(function(_0x279833,_0x2898a3){try{if(_0x128b36[_0x3d1a1e['id']]){_0x3d1a1e['Users']=_[_0xb225('0x46')](_0x128b36[_0x3d1a1e['id']],function(_0x6de2d5){return{'id':_0x6de2d5['id'],'fullname':_0x6de2d5[_0xb225('0x47')]};});}}catch(_0x30dfc2){_0x2898a3(_0x30dfc2);}_0x279833(_0x3d1a1e);});}function getInteractionTags(_0x3dc1e8,_0x2b73a6){return new BPromise(function(_0x479cd2,_0x11c370){try{if(_0x3dc1e8[_0xb225('0x48')]){_0x3dc1e8[_0xb225('0x49')]=[];_0x3dc1e8[_0xb225('0x48')]['split'](',')[_0xb225('0x4a')](function(_0x218900){_0x3dc1e8['Tags'][_0xb225('0x4b')](_0x2b73a6[_0x218900]);});}delete _0x3dc1e8[_0xb225('0x48')];}catch(_0x1554de){_0x11c370(_0x1554de);}_0x479cd2(_0x3dc1e8);});}function updateChatInteraction(_0x22fb46,_0x4a60a6,_0x1e8b54){return new BPromise(function(_0x3d3d22,_0x27285e){return getInteractionUsers(_0x22fb46,_0x1e8b54)['then'](function(_0x3186c2){return getInteractionTags(_0x3186c2,_0x4a60a6);})[_0xb225('0x24')](function(_0x4ba115){return getStateInteraction(_0x4ba115);})[_0xb225('0x24')](function(_0x656542){_0x3d3d22(_0x656542);})['catch'](function(_0x424d2f){_0x27285e(_0x424d2f);});});}function getStateInteraction(_0x2856a8){return new BPromise(function(_0x45ce74){_0x2856a8['waiting']=0x0;_0x2856a8[_0xb225('0x4c')]=0x0;_0x2856a8['answered']=0x0;_0x2856a8[_0xb225('0x4d')]=0x0;_0x2856a8[_0xb225('0x4e')]=0x0;_0x2856a8['total']=0x0;if(!_0x2856a8[_0xb225('0x4f')]&&!_0x2856a8[_0xb225('0x50')]){_0x2856a8[_0xb225('0x51')]+=0x1;}if(!_0x2856a8[_0xb225('0x4f')]&&_0x2856a8['UserId']){_0x2856a8[_0xb225('0x4c')]+=0x1;if(_0x2856a8['waiting']){_0x2856a8[_0xb225('0x51')]-=0x1;}}if(_0x2856a8[_0xb225('0x4f')]&&_0x2856a8['disposition']==='abandoned'){_0x2856a8['abandoned']+=0x1;if(_0x2856a8[_0xb225('0x51')]){_0x2856a8[_0xb225('0x51')]-=0x1;}}else if(_0x2856a8[_0xb225('0x4f')]&&!_0x2856a8[_0xb225('0x50')]&&_0x2856a8[_0xb225('0x52')]){_0x2856a8[_0xb225('0x4d')]+=0x1;if(_0x2856a8[_0xb225('0x51')]){_0x2856a8['waiting']-=0x1;}}else if(_0x2856a8[_0xb225('0x4f')]&&_0x2856a8[_0xb225('0x50')]){_0x2856a8[_0xb225('0x53')]+=0x1;if(_0x2856a8['talking']){_0x2856a8['talking']-=0x1;}}_0x2856a8[_0xb225('0x54')]+=0x1;_0x45ce74(_0x2856a8);});}exports[_0xb225('0x55')]=function(_0x19d705,_0x5b3d83){var _0x499c71={},_0x4389b4={},_0x30e5c5={'count':0x0,'rows':[]};var _0x355c78=_['map'](db[_0xb225('0x56')]['rawAttributes'],function(_0x1cde61){return{'name':_0x1cde61['fieldName'],'type':_0x1cde61[_0xb225('0x57')][_0xb225('0x58')]};});_0x4389b4[_0xb225('0x59')]=_[_0xb225('0x46')](_0x355c78,_0xb225('0x3f'));_0x4389b4[_0xb225('0x5a')]=_[_0xb225('0x5b')](_0x19d705[_0xb225('0x5a')]);_0x4389b4['filters']=_[_0xb225('0x5c')](_0x4389b4[_0xb225('0x59')],_0x4389b4['query']);_0x499c71[_0xb225('0x5d')]=_['intersection'](_0x4389b4[_0xb225('0x59')],qs[_0xb225('0x5e')](_0x19d705[_0xb225('0x5a')]['fields']));_0x499c71[_0xb225('0x5d')]=_0x499c71[_0xb225('0x5d')][_0xb225('0x5f')]?_0x499c71[_0xb225('0x5d')]:_0x4389b4['model'];if(!_0x19d705['query']['hasOwnProperty']('nolimit')){_0x499c71[_0xb225('0x34')]=qs[_0xb225('0x34')](_0x19d705[_0xb225('0x5a')][_0xb225('0x34')]);_0x499c71[_0xb225('0x32')]=qs[_0xb225('0x32')](_0x19d705[_0xb225('0x5a')][_0xb225('0x32')]);}_0x499c71[_0xb225('0x60')]=qs[_0xb225('0x61')](_0x19d705['query']['sort']);_0x499c71[_0xb225('0x62')]=qs[_0xb225('0x63')](_[_0xb225('0x64')](_0x19d705['query'],_0x4389b4[_0xb225('0x63')]),_0x355c78);var _0x4548ed=[];var _0x380b71=squel[_0xb225('0x65')]()[_0xb225('0x66')]('id')[_0xb225('0x66')](_0xb225('0x3f'))[_0xb225('0x66')](_0xb225('0x67'))[_0xb225('0x68')](_0xb225('0x69'));var _0x5eaf03=squel[_0xb225('0x65')]()[_0xb225('0x66')](_0xb225('0x6a'))['field'](_0xb225('0x6b'))['field'](_0xb225('0x6c'))[_0xb225('0x68')](_0xb225('0x6d'),'ui')['left_join'](_0xb225('0x6e'),'u',_0xb225('0x6f'));var _0x30b696=squel['select']()[_0xb225('0x68')]('chat_interactions','i')[_0xb225('0x70')](_0xb225('0x71'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xb225('0x70')](_0xb225('0x6e'),'o',_0xb225('0x72'))[_0xb225('0x70')](_0xb225('0x73'),'a',_0xb225('0x74'))['left_join']('chat_messages','me',_0xb225('0x75'))[_0xb225('0x70')](_0xb225('0x76'),'it',_0xb225('0x77'))[_0xb225('0x70')]('tools_tags','t',_0xb225('0x78'));var _0x3f4751=squel[_0xb225('0x79')]();var _0x3b5ee3=[];var _0x539210=squel[_0xb225('0x79')]();var _0x1b3cf6;if(_0x19d705['query'][_0xb225('0x7a')]){_0x1b3cf6=as[_0xb225('0x7b')](_0x19d705[_0xb225('0x5a')][_0xb225('0x7a')]);var _0x4ccdd1=_0x1b3cf6[_0xb225('0x7c')];for(var _0x4c7aa0=0x0;_0x4c7aa0<_0x1b3cf6[_0xb225('0x7d')][_0xb225('0x5f')];_0x4c7aa0++){var _0x4a7ef0=_0x1b3cf6[_0xb225('0x7d')][_0x4c7aa0];var _0x2deaaa='i';var _0x4610b=_[_0xb225('0x7e')](_0x355c78,[_0xb225('0x3f'),_0x4a7ef0[_0xb225('0x66')]]);if(!_0x4610b){switch(_0x4a7ef0[_0xb225('0x66')]){case _0xb225('0x7f'):if(_0x4a7ef0[_0xb225('0x80')]==0x1){_0x30b696[_0xb225('0x81')]('`'+_0x4a7ef0[_0xb225('0x66')]+'`\x20=\x200');}else{_0x30b696['having']('`'+_0x4a7ef0['field']+_0xb225('0x82'));}break;case _0xb225('0x83'):if(_0x4a7ef0[_0xb225('0x84')]==='$substring'){if(_0x4a7ef0['value'][_0xb225('0x85')]('\x20')[_0xb225('0x5f')]>0x1){_0x3f4751[_0x4ccdd1](_0xb225('0x86'),qs[_0xb225('0x87')](_0x4a7ef0[_0xb225('0x80')]),null);}else{var _0x5bf935='%'+_0x4a7ef0[_0xb225('0x80')]+'%';_0x3f4751[_0x4ccdd1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5bf935,_0x5bf935,_0x5bf935);}}else{_0x4610b=_[_0xb225('0x7e')](_0x355c78,['name','ContactId']);_0x4a7ef0['field']=_0xb225('0x88');_0x2850c5=as['buildExpression'](_0x2deaaa,_0x4610b['type'],_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5[_0xb225('0x80')]['start'],_0x2850c5[_0xb225('0x80')][_0xb225('0x3d')]);}break;case _0xb225('0x8a'):var _0x28c96e=_0x4a7ef0[_0xb225('0x80')]['split'](',')[_0xb225('0x46')](function(_0x533cb5){return Number(_0x533cb5);});_0x28c96e[_0xb225('0x4a')](function(_0x4e560f){_0x539210['or'](_0xb225('0x8b'),'%,'+_0x4e560f+',%');});_0x3b5ee3=_[_0xb225('0x8c')](_0x3b5ee3,_0x28c96e);break;case _0xb225('0x8d'):if(_0x4a7ef0[_0xb225('0x84')]===_0xb225('0x8e')){_0x3f4751[_0x4ccdd1](_0xb225('0x8f'),'%'+_0x4a7ef0[_0xb225('0x80')]+'%',null);}else{_0x4610b=_[_0xb225('0x7e')](_0x355c78,[_0xb225('0x3f'),_0xb225('0x50')]);_0x4a7ef0['field']=_0xb225('0x50');_0x2850c5=as[_0xb225('0x90')](_0x2deaaa,_0x4610b[_0xb225('0x57')],_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5['value'][_0xb225('0x91')],_0x2850c5['value'][_0xb225('0x3d')]);}break;case _0xb225('0x42'):_0x2850c5=as[_0xb225('0x90')]('me',null,_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5[_0xb225('0x80')]['start'],_0x2850c5[_0xb225('0x80')][_0xb225('0x3d')]);break;}}else{var _0x2850c5=as['buildExpression'](_0x2deaaa,_0x4610b['type'],_0x4a7ef0);_0x3f4751[_0x4ccdd1](_0x2850c5[_0xb225('0x89')],_0x2850c5['value'][_0xb225('0x91')],_0x2850c5['value'][_0xb225('0x3d')]);}}}else{var _0x33b7fc=_(_0x19d705[_0xb225('0x5a')])[_0xb225('0x5b')]()[_0xb225('0x46')](function(_0xd52f85){return _['some'](_0x355c78,[_0xb225('0x3f'),_0xd52f85])?_0xd52f85:undefined;})[_0xb225('0x92')]()[_0xb225('0x80')]();if(!_[_0xb225('0x93')](_0x33b7fc)){_0x33b7fc[_0xb225('0x4a')](function(_0x7f5f3e){if(_0x7f5f3e===_0xb225('0x94')){_0x30b696[_0xb225('0x62')]('i.ChatWebsiteId\x20IN\x20?',[][_0xb225('0x95')](_0x19d705[_0xb225('0x5a')][_0x7f5f3e]));}else if(_0x7f5f3e===_0xb225('0x96')){var _0x484473=JSON[_0xb225('0x97')](_0x19d705[_0xb225('0x5a')][_0x7f5f3e])[_0xb225('0x98')];var _0x1cc037=JSON[_0xb225('0x97')](_0x19d705[_0xb225('0x5a')][_0x7f5f3e])[_0xb225('0x99')];_0x30b696[_0xb225('0x62')](_0xb225('0x9a'),_0x484473,_0x1cc037);}else{if(_0x19d705[_0xb225('0x5a')][_0x7f5f3e]===_0xb225('0x9b')){_0x30b696[_0xb225('0x62')]('i.'+_0x7f5f3e+'\x20IS\x20NULL');}else{_0x30b696['where']('i.'+_0x7f5f3e+_0xb225('0x9c'),_0x19d705[_0xb225('0x5a')][_0x7f5f3e]);}}});}if(_0x19d705['query'][_0xb225('0x9d')]){if(_0x19d705[_0xb225('0x5a')][_0xb225('0x9d')]==0x1){_0x30b696[_0xb225('0x81')](_0xb225('0x9e'));}else{_0x30b696[_0xb225('0x81')]('`unreadMessages`\x20>\x200');}}if(_0x19d705['query']['tag']){_0x3b5ee3=_['isArray'](_0x19d705['query'][_0xb225('0x9f')])?_0x19d705[_0xb225('0x5a')]['tag']:new Array(_0x19d705[_0xb225('0x5a')][_0xb225('0x9f')]);_0x3b5ee3[_0xb225('0x4a')](function(_0x369352){_0x539210['or'](_0xb225('0x8b'),'%,'+_0x369352+',%');});}if(_0x19d705[_0xb225('0x5a')][_0xb225('0xa0')]){var _0x5eff75=_0x19d705[_0xb225('0x5a')][_0xb225('0xa0')][_0xb225('0xa1')]('\x5c','\x5c\x5c')[_0xb225('0xa1')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5eff75)){_0x3f4751['or'](_0xb225('0xa2'),_0x5eff75+'%');}else{_0x3f4751['or'](_0xb225('0xa3'),qs[_0xb225('0x87')](_0x5eff75))['or'](_0xb225('0xa4'),_0x5eff75+'%');}}}_0x30b696[_0xb225('0x62')](_0x3f4751);_0x30b696[_0xb225('0xa5')](_0xb225('0xa6'));var _0x11f43e={'type':db['Sequelize']['QueryTypes'][_0xb225('0xa7')],'raw':!![]};var _0x38f0b4=_0x30b696[_0xb225('0xa8')]();_0x38f0b4['field'](_0xb225('0xa6'));_0x38f0b4[_0xb225('0x66')](_0xb225('0xa9'),_0xb225('0x7f'));if(_0x499c71[_0xb225('0x60')]){_0x499c71['order']['forEach'](function(_0x153034){var _0x5ed7b3=_0x153034[0x0]==='contactName'?_0x153034[0x0]:'i.'+_0x153034[0x0];_0x30b696[_0xb225('0x60')](_0x5ed7b3,_0x153034[0x1]===_0xb225('0xaa')?![]:!![]);});}if(!_['isEmpty'](_0x3b5ee3)){_0x30b696[_0xb225('0x81')](_0x539210);_0x38f0b4[_0xb225('0x62')](_0xb225('0xab'),_0x3b5ee3);}BPromise[_0xb225('0xac')]()[_0xb225('0x24')](function(){if(!_0x1b3cf6){if(_0x19d705['query']['ChatWebsiteId'])return;_0x38f0b4[_0xb225('0x62')](_0xb225('0xad'));_0x30b696['where'](_0xb225('0xad'));return;}if(_0x19d705[_0xb225('0xae')][_0xb225('0xaf')]!==_0xb225('0x44'))return;return _0x19d705[_0xb225('0xae')][_0xb225('0xb0')]({'attributes':['id'],'raw':!![]})['then'](function(_0x474e39){if(_['isEmpty'](_0x474e39)){_0x38f0b4[_0xb225('0x62')](_0xb225('0xb1'));_0x30b696[_0xb225('0x62')](_0xb225('0xb1'));}else{_0x38f0b4[_0xb225('0x62')]('i.ChatWebsiteId\x20IN\x20?',_[_0xb225('0x46')](_0x474e39,'id'));_0x30b696['where'](_0xb225('0xb2'),_[_0xb225('0x46')](_0x474e39,'id'));}});})[_0xb225('0x24')](function(){if(_0x19d705[_0xb225('0xae')][_0xb225('0xaf')]===_0xb225('0x44')&&!_0x1b3cf6&&!_0x19d705[_0xb225('0x5a')][_0xb225('0x94')])return[];return db[_0xb225('0xb3')]['query'](_0x38f0b4[_0xb225('0xb4')](),_0x11f43e);})['then'](function(_0x409cb5){_0x30e5c5[_0xb225('0x35')]=_0x409cb5[_0xb225('0x5f')];if(_0x30e5c5['count']===0x0)return[];return db[_0xb225('0xb3')][_0xb225('0x5a')](_0x380b71['toString'](),_0x11f43e)[_0xb225('0x24')](function(_0x23aa6c){_0x4548ed=_['keyBy'](_0x23aa6c,'id');_0x11f43e=_[_0xb225('0x41')](_0x11f43e,{'model':db[_0xb225('0x56')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19d705['query'][_0xb225('0x5e')]){_0x499c71[_0xb225('0x5d')][_0xb225('0x4a')](function(_0x355b9f){_0x30b696[_0xb225('0x66')]('i.'+_0x355b9f);});}else{_0x30b696['field'](_0xb225('0xa9'),_0xb225('0x7f'));_0x30b696[_0xb225('0x66')](_0xb225('0xb5'),_0xb225('0xb6'));_0x30b696['field'](_0xb225('0xb7'),_0xb225('0xb8'));_0x30b696[_0xb225('0x66')]('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',_0xb225('0xb9'));_0x30b696[_0xb225('0x66')]('i.*');_0x30b696[_0xb225('0x66')](_0xb225('0xba'),_0xb225('0xbb'));_0x30b696['field'](_0xb225('0xbc'),_0xb225('0xbd'));_0x30b696[_0xb225('0x66')](_0xb225('0xbe'),_0xb225('0xbf'));_0x30b696[_0xb225('0x66')](_0xb225('0xc0'),_0xb225('0xc1'));_0x30b696[_0xb225('0x66')](_0xb225('0xc2'),_0xb225('0xc3'));_0x30b696[_0xb225('0x66')](_0xb225('0xc4'),'Contact.fax');_0x30b696['field'](_0xb225('0xc5'),_0xb225('0xc6'));_0x30b696['field'](_0xb225('0xc7'),_0xb225('0xc8'));_0x30b696[_0xb225('0x66')](_0xb225('0xc9'),_0xb225('0x48'));}if(_0x499c71[_0xb225('0x34')])_0x30b696[_0xb225('0x34')](_0x499c71['limit']);if(_0x499c71[_0xb225('0x32')])_0x30b696['offset'](_0x499c71[_0xb225('0x32')]);return db[_0xb225('0xb3')][_0xb225('0x5a')](_0x30b696[_0xb225('0xb4')](),_0x11f43e);})[_0xb225('0x24')](function(_0x2df377){if(_0x2df377[_0xb225('0x5f')]>0x0)_0x5eaf03[_0xb225('0x62')]('ui.ChatInteractionId\x20IN\x20?',_[_0xb225('0x46')](_0x2df377,'id'));return db[_0xb225('0xb3')][_0xb225('0x5a')](_0x5eaf03[_0xb225('0xb4')](),_0x11f43e)[_0xb225('0x24')](function(_0x66e0c2){var _0x1e609d=_[_0xb225('0xca')](_0x66e0c2,_0xb225('0xcb'));var _0x389153=[];_0x2df377[_0xb225('0x4a')](function(_0x1668ed){_0x389153['push'](updateChatInteraction(_0x1668ed,_0x4548ed,_0x1e609d));});return BPromise[_0xb225('0xcc')](_0x389153);});});})['then'](function(_0x17ec7e){_0x30e5c5['rows']=_0x17ec7e;return _0x30e5c5;})[_0xb225('0x24')](respondWithFilteredResult(_0x5b3d83,_0x499c71))[_0xb225('0x2f')](handleError(_0x5b3d83,null));};exports['show']=function(_0x2bab08,_0x2eb77d){var _0x5c62f2={'raw':![],'where':{'id':_0x2bab08[_0xb225('0xcd')]['id']}},_0x57af52={};_0x57af52[_0xb225('0x59')]=_[_0xb225('0x5b')](db[_0xb225('0x56')][_0xb225('0xce')]);_0x57af52['query']=_['keys'](_0x2bab08[_0xb225('0x5a')]);_0x57af52[_0xb225('0x63')]=_['intersection'](_0x57af52[_0xb225('0x59')],_0x57af52[_0xb225('0x5a')]);_0x5c62f2[_0xb225('0x5d')]=_[_0xb225('0x5c')](_0x57af52[_0xb225('0x59')],qs[_0xb225('0x5e')](_0x2bab08[_0xb225('0x5a')][_0xb225('0x5e')]));_0x5c62f2['attributes']=_0x5c62f2[_0xb225('0x5d')][_0xb225('0x5f')]?_0x5c62f2[_0xb225('0x5d')]:_0x57af52[_0xb225('0x59')];if(_0x2bab08[_0xb225('0x5a')]['includeAll']){_0x5c62f2['include']=[{'all':!![]}];}_0x5c62f2=_[_0xb225('0x41')]({},_0x5c62f2,_0x2bab08[_0xb225('0xcf')]);return db[_0xb225('0x56')]['find'](_0x5c62f2)[_0xb225('0x24')](handleEntityNotFound(_0x2eb77d,null))['then'](respondWithResult(_0x2eb77d,null))['catch'](handleError(_0x2eb77d,null));};exports[_0xb225('0xd0')]=function(_0x128d73,_0x319894){return db[_0xb225('0x56')][_0xb225('0xd0')](_0x128d73['body'],{})[_0xb225('0x24')](respondWithResult(_0x319894,0xc9))[_0xb225('0x2f')](handleError(_0x319894,null));};exports[_0xb225('0x3b')]=function(_0x534dc5,_0x6aa7b7){if(_0x534dc5['body']['id']){delete _0x534dc5[_0xb225('0x42')]['id'];}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x534dc5[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x6aa7b7,null))[_0xb225('0x24')](saveUpdates(_0x534dc5[_0xb225('0x42')],null))[_0xb225('0x24')](respondWithResult(_0x6aa7b7,null))['catch'](handleError(_0x6aa7b7,null));};exports['destroy']=function(_0x59b60,_0x1ab951){return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x59b60['params']['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x1ab951,null))[_0xb225('0x24')](removeEntity(_0x1ab951,null))[_0xb225('0x2f')](handleError(_0x1ab951,null));};exports[_0xb225('0xd1')]=function(_0xfa4390,_0x9ef3d9){return db[_0xb225('0x56')][_0xb225('0xd1')]()[_0xb225('0x24')](respondWithResult(_0x9ef3d9,null))[_0xb225('0x2f')](handleError(_0x9ef3d9,null));};exports['createVidaooSession']=function(_0x1edf7b,_0x5273f8){var _0x475e83=_0x1edf7b[_0xb225('0xcd')]['id'];var _0x4e4cd7;var _0x33947d;var _0x4f2dc1;return db[_0xb225('0x56')][_0xb225('0xd2')]({'where':{'id':_0x475e83}})[_0xb225('0x24')](function(_0x360047){_0x4e4cd7=_0x360047;return db[_0xb225('0xd3')][_0xb225('0xd2')]({'where':{'id':_0x360047[_0xb225('0x94')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xb225('0xd4'),_0xb225('0xd5'),_0xb225('0xd6')],'raw':!![]});})[_0xb225('0x24')](function(_0xddc786){if(_0xddc786&&_0xddc786[_0xb225('0xd7')]&&_0xddc786['vidaooEscalation']){_0x33947d=_0xddc786;var _0x34d641={'interaction':{'id':_0x475e83},'agent':{'id':_0x1edf7b[_0xb225('0xae')]['id'],'name':_0x1edf7b[_0xb225('0xae')]['name'],'fullname':_0x1edf7b[_0xb225('0xae')][_0xb225('0x47')],'email':_0x1edf7b['user'][_0xb225('0xd8')]},'contact':_0x1edf7b[_0xb225('0x42')][_0xb225('0x43')],'account':_0x1edf7b[_0xb225('0x42')][_0xb225('0x45')]};var _0x20b197={'rejectUnauthorized':![],'method':_0xb225('0xd9'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0xddc786['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1edf7b['user'][_0xb225('0xd8')]],'buttons':null,'topic':_0x33947d[_0xb225('0xd4')],'note':_[_0xb225('0xda')](_0x33947d[_0xb225('0xd5')])?null:getMustacheRender(_0x33947d['vidaooNote'],_0x34d641),'metadata':null},'redirect':_0xb225('0xdb'),'json':!![]};try{if(!_[_0xb225('0xda')](_0x33947d['vidaooMetadata'])){var _0x11caa1=getMustacheRender(_0x33947d[_0xb225('0xd6')],_0x34d641);var _0x1d661c=JSON[_0xb225('0x97')](_0x11caa1);_0x20b197[_0xb225('0x42')]['metadata']=_0x1d661c;}}catch(_0x223dc5){throw new db[(_0xb225('0xdc'))][(_0xb225('0xdd'))](_0xb225('0xde'));}return rp(_0x20b197);}else{throw new db[(_0xb225('0xdc'))]['ValidationError'](_0xb225('0xdf'));}})[_0xb225('0x24')](function(_0x8e2df2){_0x4f2dc1=_0x8e2df2;if(_0x4f2dc1['id']){var _0xddf8a7={'body':_0x4f2dc1[_0xb225('0xe0')],'ChatWebsiteId':_0x33947d['id'],'ChatInteractionId':_0x4e4cd7['id'],'direction':_0xb225('0xe1'),'UserId':_0x1edf7b['user']['id']};return db[_0xb225('0xe2')][_0xb225('0xd0')](_0xddf8a7,{});}else{throw new db[(_0xb225('0xdc'))]['ValidationError'](_0xb225('0xe3'));}})['then'](function(){return _0x4e4cd7[_0xb225('0xe4')]({'vidaooSessionId':_0x4f2dc1['id']});})[_0xb225('0x24')](respondWithResult(_0x5273f8,null))[_0xb225('0x2f')](handleError(_0x5273f8,null));};exports[_0xb225('0xe5')]=function(_0x186ff4,_0x4aef81){if(_0x186ff4[_0xb225('0x42')]['id']){delete _0x186ff4['body']['id'];}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x186ff4[_0xb225('0xcd')]['id']},'include':[{'model':db[_0xb225('0xe6')],'as':_0xb225('0x83')}]})[_0xb225('0x24')](handleEntityNotFound(_0x4aef81,null))[_0xb225('0x24')](saveUpdates(_0x186ff4['body'],null))[_0xb225('0x24')](respondWithResult(_0x4aef81,null))[_0xb225('0x2f')](handleError(_0x4aef81,null));};exports['abandon']=function(_0x217275,_0x347464,_0x47752d){if(_0x217275[_0xb225('0x42')]['id']){delete _0x217275[_0xb225('0x42')]['id'];}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x217275[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](function(_0x382db5){if(!_0x382db5){logger[_0xb225('0x2a')](_0xb225('0xe7'),_0xb225('0xe8'),0x194,_0xb225('0xe9'));_0x347464[_0xb225('0x30')](0x194);}else{if(_0x382db5['UserId']){throw new db[(_0xb225('0xdc'))][(_0xb225('0xdd'))](_0xb225('0xea'));}}return _0x382db5;})['then'](function(_0x197428){if(_0x197428){return _0x197428[_0xb225('0x3b')]({'closed':_0x217275['body'][_0xb225('0x4f')],'disposition':_0x217275[_0xb225('0x42')][_0xb225('0x52')]})[_0xb225('0x24')](function(_0x2180f8){return _0x2180f8;});}})['then'](function(_0x572447){return respondWithRpcPromise(_0xb225('0xeb'),_0xb225('0xe8'),_0x217275[_0xb225('0x42')],client9004);})['then'](respondWithResult(_0x347464,null))['catch'](handleError(_0x347464,null));};exports[_0xb225('0xec')]=function(_0x179bc8,_0x4bbb58,_0x586158){_0x179bc8[_0xb225('0x42')]['name']=_0x179bc8[_0xb225('0xed')][_0xb225('0xee')];_0x179bc8[_0xb225('0x42')][_0xb225('0xef')]=_0x179bc8['file'][_0xb225('0xf0')];_0x179bc8['body'][_0xb225('0x57')]=_0x179bc8[_0xb225('0xed')]['mimetype'];return db['Attachment']['create'](_0x179bc8['body'])[_0xb225('0x24')](respondWithResult(_0x4bbb58,0xc9))['catch'](handleError(_0x4bbb58,null));};exports[_0xb225('0xf1')]=function(_0x1c42bb,_0x26c3d7,_0xd9ab52){return db['ChatInteraction'][_0xb225('0xd2')]({'where':{'id':_0x1c42bb[_0xb225('0xcd')]['id']},'raw':!![]})[_0xb225('0x24')](handleEntityNotFound(_0x26c3d7,null))[_0xb225('0x24')](function(_0x59d195){if(_0x59d195){if(_0x59d195[_0xb225('0x4f')]){return _0x26c3d7['status'](0x193)[_0xb225('0x37')]({'status':0x193,'message':_0xb225('0xf2')});}return db[_0xb225('0xf3')][_0xb225('0xd2')]({'where':{'id':_0x1c42bb[_0xb225('0x5a')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x26c3d7,null));}})[_0xb225('0x24')](function(_0x254dd4){if(_0x254dd4){var _0x3ba914=_0x254dd4[_0xb225('0xf4')]!==null;var _0x5e2912=path['join'](config[_0xb225('0xf5')],'server/files/attachments/');if(_0x3ba914){_0x5e2912=path[_0xb225('0xf6')](_0x5e2912,'offline-chat/');}var _0x3c586c=path[_0xb225('0xf6')](_0x5e2912,_0x254dd4[_0xb225('0xef')]);return _0x26c3d7[_0xb225('0xf7')](_0x3c586c);}})[_0xb225('0x2f')](handleError(_0x26c3d7,null));};exports[_0xb225('0xf8')]=function(_0x4385e9,_0x4defb3){var _0x23d649=null;var _0x45c2d8=null;var _0x4c10a1=null;var _0x56e10c=null;if(_0x4385e9[_0xb225('0x42')]['id']){delete _0x4385e9[_0xb225('0x42')]['id'];}if(_0x4385e9['body'][_0xb225('0xf9')]){_0x56e10c=path['join'](config[_0xb225('0xf5')],'server/files/chat/upload/',util[_0xb225('0xfa')](_0xb225('0xfb'),Date[_0xb225('0xfc')]()));_0x4385e9[_0xb225('0x42')][_0xb225('0xfd')]=_0x56e10c;}return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x4385e9[_0xb225('0xcd')]['id']},'include':[{'model':db[_0xb225('0xe2')],'as':_0xb225('0xfe'),'include':[{'model':db[_0xb225('0x8d')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x4defb3,null))['then'](saveUpdates(_0x4385e9[_0xb225('0x42')],null))[_0xb225('0x24')](function(_0x1037b4){if(_0x1037b4){_0x23d649=_0x1037b4;return db['ChatWebsite'][_0xb225('0x7e')]({'where':{'id':_0x23d649[_0xb225('0x94')]}});}})[_0xb225('0x24')](function(_0xb039aa){if(_0xb039aa){_0x4c10a1=_0xb039aa;return db[_0xb225('0xe6')][_0xb225('0x7e')]({'where':{'id':_0x23d649['ContactId']}});}})['then'](function(_0xfca62d){if(_0xfca62d){_0x45c2d8=_0xfca62d;if(_0x56e10c){var _0x9e28eb=null;for(var _0x1a81ab=0x1;_0x1a81ab<_0x23d649[_0xb225('0xfe')][_0xb225('0x5f')];++_0x1a81ab){_0x9e28eb=_0x23d649[_0xb225('0xfe')][_0x1a81ab];var _0x33a2aa=_0x9e28eb[_0xb225('0x50')]?util['format'](_0xb225('0xff'),_0x4c10a1[_0xb225('0x100')],_0x9e28eb[_0xb225('0x50')]):_0xb225('0x101');var _0x3fcda5=_0x4385e9['body'][_0xb225('0x102')]||util[_0xb225('0xfa')](_0xb225('0xff'),_0xb225('0x103'),_0x9e28eb[_0xb225('0x88')]);switch(_0x4c10a1[_0xb225('0x104')]){case'website_alias':_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?util[_0xb225('0xfa')]('%s%d',_0x4c10a1[_0xb225('0x100')],_0x9e28eb['UserId']):_0xb225('0x101');break;case _0xb225('0x105'):_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?_0x9e28eb[_0xb225('0x8d')][_0xb225('0x106')]||_0x9e28eb[_0xb225('0x8d')]['fullname']:'System';break;case _0xb225('0x107'):_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?_0x9e28eb[_0xb225('0x8d')]['fullname']:'System';break;default:_0x33a2aa=_0x9e28eb[_0xb225('0x50')]?util[_0xb225('0xfa')]('%s%d',_0x4c10a1[_0xb225('0x100')],_0x9e28eb[_0xb225('0x50')]):_0xb225('0x101');}var _0x28e072=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x9e28eb['createdAt'])[_0xb225('0xfa')](_0xb225('0x108')),_0x9e28eb[_0xb225('0x109')]==='in'?_0x3fcda5:_0x33a2aa,_0x9e28eb[_0xb225('0x42')]);if(!_0x9e28eb[_0xb225('0x10a')]){fs[_0xb225('0x10b')](_0x56e10c,_0x28e072);}}return db[_0xb225('0x10c')][_0xb225('0xd2')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb225('0x10d'),'raw':!![]}]});}}})[_0xb225('0x24')](function(_0x2adc39){if(_0x2adc39&&_0x2adc39[_0xb225('0x10d')]&&_0x4385e9[_0xb225('0x42')]){var _0x59c829={'tls':{'rejectUnauthorized':![]}};if(_0x2adc39[_0xb225('0x10d')][_0xb225('0x10e')]){_0x59c829[_0xb225('0x10e')]=_0x2adc39['Smtp'][_0xb225('0x10e')];}else{_0x59c829['host']=_0x2adc39[_0xb225('0x10d')][_0xb225('0x10f')];_0x59c829[_0xb225('0x110')]=_0x2adc39[_0xb225('0x10d')][_0xb225('0x110')];_0x59c829['secure']=_0x2adc39[_0xb225('0x10d')][_0xb225('0x111')];}if(_0x2adc39[_0xb225('0x10d')][_0xb225('0x112')]){_0x59c829[_0xb225('0x113')]={'user':_0x2adc39['Smtp']['user'],'pass':_0x2adc39[_0xb225('0x10d')][_0xb225('0x114')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x59c829,'message':{'from':util[_0xb225('0xfa')](_0xb225('0x115'),_0x2adc39[_0xb225('0x3f')],_0x2adc39[_0xb225('0xd8')]||_0x2adc39[_0xb225('0x10d')]['user']),'to':_0x4385e9['body'][_0xb225('0xf9')],'subject':_0xb225('0x116'),'text':util[_0xb225('0xfa')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4385e9['body'][_0xb225('0xf9')]),'attachments':[{'path':_0x56e10c}]}})['then'](function(){return _0x23d649;})[_0xb225('0x2f')](function(_0x747232){console[_0xb225('0x2a')](_0x747232);});}else{return _0x23d649;}})[_0xb225('0x24')](respondWithStatusCode(_0x4defb3,0xc8))[_0xb225('0x2f')](handleError(_0x4defb3,null));};exports[_0xb225('0x117')]=function(_0x353a9f,_0x2dadd5,_0x9917fb){return db['ChatMessage']['find']({'where':{'id':_0x353a9f[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x2dadd5,null))[_0xb225('0x24')](function(_0x18fb42){if(_0x18fb42){return _0x18fb42[_0xb225('0x117')](_0x353a9f[_0xb225('0x42')][_0xb225('0x118')],_['omit'](_0x353a9f[_0xb225('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x2dadd5,null))[_0xb225('0x2f')](handleError(_0x2dadd5,null));};exports[_0xb225('0x119')]=function(_0x46c662,_0x1767ee,_0x377d15){var _0x407f88={'raw':![],'where':{}};var _0x4e096a={};var _0x120598={'count':0x0,'rows':[]};return db[_0xb225('0x56')]['findOne']({'where':{'id':_0x46c662[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x1767ee,null))['then'](function(_0x286407){if(_0x286407){_0x4e096a[_0xb225('0x59')]=_[_0xb225('0x5b')](db[_0xb225('0xe2')]['rawAttributes']);_0x4e096a[_0xb225('0x5a')]=_[_0xb225('0x5b')](_0x46c662[_0xb225('0x5a')]);_0x4e096a[_0xb225('0x63')]=_[_0xb225('0x5c')](_0x4e096a[_0xb225('0x59')],_0x4e096a[_0xb225('0x5a')]);_0x407f88[_0xb225('0x5d')]=_[_0xb225('0x5c')](_0x4e096a[_0xb225('0x59')],qs['fields'](_0x46c662[_0xb225('0x5a')][_0xb225('0x5e')]));_0x407f88[_0xb225('0x5d')]=_0x407f88[_0xb225('0x5d')]['length']?_0x407f88[_0xb225('0x5d')]:_0x4e096a['model'];if(!_0x46c662[_0xb225('0x5a')][_0xb225('0x11a')]('nolimit')){_0x407f88['limit']=qs[_0xb225('0x34')](_0x46c662['query'][_0xb225('0x34')]);_0x407f88['offset']=qs[_0xb225('0x32')](_0x46c662[_0xb225('0x5a')]['offset']);}_0x407f88['order']=qs[_0xb225('0x61')](_0x46c662[_0xb225('0x5a')][_0xb225('0x61')]);_0x407f88[_0xb225('0x62')]=qs[_0xb225('0x63')](_[_0xb225('0x64')](_0x46c662['query'],_0x4e096a[_0xb225('0x63')]));_0x407f88[_0xb225('0x62')][_0xb225('0xcb')]=_0x286407['id'];if(_0x46c662[_0xb225('0x5a')]['filter']){_0x407f88[_0xb225('0x62')]=_[_0xb225('0x41')](_0x407f88[_0xb225('0x62')],{'$or':_[_0xb225('0x46')](_0x407f88[_0xb225('0x5d')],function(_0x3f268c){var _0x1b76f0={};_0x1b76f0[_0x3f268c]={'$like':'%'+_0x46c662[_0xb225('0x5a')][_0xb225('0xa0')]+'%'};return _0x1b76f0;})});}if(_0x46c662[_0xb225('0x5a')][_0xb225('0x98')]){var _0x462944=_0x46c662[_0xb225('0x5a')]['$gte'][_0xb225('0x85')](',');var _0x538cc0={};_0x538cc0[_0x462944[0x0]]={'$gte':moment(_0x462944[0x1])[_0xb225('0xfa')]('YYYY-MM-DD\x20HH:mm:ss')};_0x407f88[_0xb225('0x62')]=_[_0xb225('0x41')](_0x407f88[_0xb225('0x62')],_0x538cc0);}_0x407f88=_['merge']({},_0x407f88,_0x46c662[_0xb225('0xcf')]);return db[_0xb225('0xe2')]['count']({'where':_0x407f88['where']})[_0xb225('0x24')](function(_0x387d59){_0x120598[_0xb225('0x35')]=_0x387d59;if(_0x46c662['query']['includeAll']){_0x407f88['include']=[{'all':!![]}];}return db[_0xb225('0xe2')]['findAll'](_0x407f88);})[_0xb225('0x24')](function(_0x2dd683){_0x120598[_0xb225('0x11b')]=_0x2dd683;return _0x120598;});}})[_0xb225('0x24')](respondWithFilteredResult(_0x1767ee,_0x407f88))[_0xb225('0x2f')](handleError(_0x1767ee,null));};exports[_0xb225('0x11c')]=function(_0x3b5278,_0x5aae21,_0x2a8ff2){var _0x44f817={'where':{}},_0x329fb5={},_0x3f7f32={'count':0x0,'rows':[]};return db[_0xb225('0x56')][_0xb225('0xd2')]({'where':{'id':_0x3b5278[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x5aae21,null))['then'](function(_0x366860){if(_0x366860){_0x329fb5[_0xb225('0x59')]=_['keys'](db[_0xb225('0xe2')][_0xb225('0xce')]);_0x329fb5[_0xb225('0x5a')]=_['keys'](_0x3b5278['query']);_0x329fb5['filters']=_[_0xb225('0x5c')](_0x329fb5[_0xb225('0x59')],_0x329fb5[_0xb225('0x5a')]);_0x44f817['attributes']=_['intersection'](_0x329fb5[_0xb225('0x59')],qs[_0xb225('0x5e')](_0x3b5278[_0xb225('0x5a')][_0xb225('0x5e')]));_0x44f817[_0xb225('0x5d')]=_0x44f817[_0xb225('0x5d')][_0xb225('0x5f')]?_0x44f817[_0xb225('0x5d')]:_0x329fb5[_0xb225('0x59')];if(!_0x3b5278[_0xb225('0x5a')][_0xb225('0x11a')](_0xb225('0x11d'))){_0x44f817['limit']=qs['limit'](_0x3b5278[_0xb225('0x5a')][_0xb225('0x34')]);_0x44f817[_0xb225('0x32')]=qs[_0xb225('0x32')](_0x3b5278[_0xb225('0x5a')]['offset']);}_0x44f817[_0xb225('0x60')]=qs[_0xb225('0x61')](_0x3b5278['query'][_0xb225('0x61')]);_0x44f817['where']=qs[_0xb225('0x63')](_[_0xb225('0x64')](_0x3b5278[_0xb225('0x5a')],_0x329fb5[_0xb225('0x63')]));_0x44f817[_0xb225('0x62')][_0xb225('0xcb')]=_0x366860['id'];if(_0x3b5278[_0xb225('0x5a')][_0xb225('0xa0')]){_0x44f817['where']=_[_0xb225('0x41')](_0x44f817[_0xb225('0x62')],{'$or':_['map'](_0x44f817['attributes'],function(_0x1f0742){var _0x3eb3ba={};_0x3eb3ba[_0x1f0742]={'$like':'%'+_0x3b5278[_0xb225('0x5a')][_0xb225('0xa0')]+'%'};return _0x3eb3ba;})});}_0x44f817[_0xb225('0x62')][_0xb225('0x10a')]=![];if(_0x3b5278[_0xb225('0x5a')]['id']){_0x44f817[_0xb225('0x62')]['id']={'$gt':_0x3b5278[_0xb225('0x5a')]['id']};}_0x44f817=_[_0xb225('0x41')]({},_0x44f817,_0x3b5278[_0xb225('0xcf')]);return db[_0xb225('0xe2')][_0xb225('0x35')]({'where':_0x44f817[_0xb225('0x62')]})['then'](function(_0x26445b){_0x3f7f32[_0xb225('0x35')]=_0x26445b;_0x44f817['include']=[];if(_0x3b5278['query']['includeAgent']){_0x44f817[_0xb225('0x11e')][_0xb225('0x4b')]({'model':db['User'],'as':_0xb225('0x8d'),'attributes':['id','fullname',_0xb225('0x106')]});}if(_0x3b5278[_0xb225('0x5a')]['includeAll']){_0x44f817[_0xb225('0x11e')]=[{'all':!![]}];}return db[_0xb225('0xe2')][_0xb225('0x11f')](_0x44f817);})[_0xb225('0x24')](function(_0x25e678){_0x3f7f32[_0xb225('0x11b')]=_0x25e678;return _0x3f7f32;});}})[_0xb225('0x24')](respondWithFilteredResult(_0x5aae21,_0x44f817))[_0xb225('0x2f')](handleError(_0x5aae21,null));};exports[_0xb225('0x120')]=function(_0x418daa,_0x5519d7,_0x4778a2){return db[_0xb225('0x56')]['find']({'where':{'id':_0x418daa['params']['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x5519d7,null))[_0xb225('0x24')](function(_0x532f82){if(_0x532f82){return _0x532f82[_0xb225('0x121')](_0x418daa['body'][_0xb225('0x118')],_[_0xb225('0x122')](_0x418daa['body'],[_0xb225('0x118'),'id'])||{})[_0xb225('0x123')](function(){return db[_0xb225('0x8a')]['findAll']({'attributes':['id','name',_0xb225('0x67')],'where':{'id':_0x418daa[_0xb225('0x42')][_0xb225('0x118')]}});})[_0xb225('0x24')](function(_0x112f79){socket[_0xb225('0x124')](_0xb225('0x125'),{'id':Number(_0x418daa[_0xb225('0xcd')]['id']),'tags':_0x112f79||[]});return{'id':Number(_0x418daa[_0xb225('0xcd')]['id']),'tags':_0x112f79||[]};});}})[_0xb225('0x24')](respondWithResult(_0x5519d7,null))[_0xb225('0x2f')](handleError(_0x5519d7,null));};exports['removeTags']=function(_0x384840,_0x2e4762,_0x218cd8){return db[_0xb225('0x56')][_0xb225('0x7e')]({'where':{'id':_0x384840[_0xb225('0xcd')]['id']}})[_0xb225('0x24')](handleEntityNotFound(_0x2e4762,null))[_0xb225('0x24')](function(_0x3cc05c){if(_0x3cc05c){return _0x3cc05c['removeTags'](_0x384840['query']['ids']);}})['then'](respondWithStatusCode(_0x2e4762,null))[_0xb225('0x2f')](handleError(_0x2e4762,null));};exports[_0xb225('0xf7')]=function(_0x3f52cc,_0x254c84){var _0x2b3f96=moment()['unix']()[_0xb225('0xb4')]();var _0x4da729=path['join'](config[_0xb225('0xf5')],_0xb225('0x126'),_0xb225('0x127'),_0xb225('0x128'));var _0x535643=path[_0xb225('0xf6')](config[_0xb225('0xf5')],'server',_0xb225('0x127'),_0xb225('0x129'));var _0x16456e=path[_0xb225('0xf6')](_0x4da729,_0x2b3f96);var _0x3af17f=util[_0xb225('0xfa')](_0xb225('0x12a'),_0x3f52cc[_0xb225('0xcd')]['id'],_0x2b3f96);var _0x805381=path[_0xb225('0xf6')](_0x4da729,_0x3af17f);var _0x5b5bf8=[];_0x5b5bf8['push']({'model':db[_0xb225('0x8d')],'as':_0xb225('0x8d'),'attributes':['id','fullname'],'raw':!![]});_0x5b5bf8[_0xb225('0x4b')]({'model':db[_0xb225('0xe6')],'as':_0xb225('0x83'),'attributes':['id',_0xb225('0x12b'),_0xb225('0x12c')],'raw':!![]});if(_0x3f52cc[_0xb225('0x5a')][_0xb225('0x129')]){_0x5b5bf8[_0xb225('0x4b')]({'model':db[_0xb225('0xf3')],'as':'Attachment','raw':!![]});}var _0x271e07=[{'model':db['ChatMessage'],'as':_0xb225('0xfe'),'attributes':['id',_0xb225('0x42'),_0xb225('0x96'),_0xb225('0x109'),_0xb225('0x10a'),'read'],'include':_0x5b5bf8}];_0x271e07[_0xb225('0x4b')]({'model':db[_0xb225('0xd3')],'as':_0xb225('0x12d'),'attributes':['id',_0xb225('0x3f')]});_0x271e07[_0xb225('0x4b')]({'model':db[_0xb225('0x8d')],'as':_0xb225('0x12e'),'attributes':['id',_0xb225('0x47')]});return db['ChatInteraction']['find']({'where':{'id':_0x3f52cc[_0xb225('0xcd')]['id']},'include':_0x271e07})[_0xb225('0x24')](handleEntityNotFound(_0x254c84,null))[_0xb225('0x24')](function(_0x45163a){if(_0x45163a){var _0x4c025c=_0x45163a['get']({'plain':!![]});fs[_0xb225('0x12f')](_0x16456e);var _0x12df26={'channel':_0xb225('0x130'),'account':_0x4c025c[_0xb225('0x12d')][_0xb225('0x3f')],'agent':_0x4c025c[_0xb225('0x12e')]?_0x4c025c[_0xb225('0x12e')][_0xb225('0x47')]:_0xb225('0x131'),'createdAt':moment(_0x4c025c[_0xb225('0x96')])[_0xb225('0xfa')](_0xb225('0x132'))[_0xb225('0xb4')](),'closedAt':_0x4c025c['closed']?moment(_0x4c025c[_0xb225('0x133')])[_0xb225('0xfa')](_0xb225('0x132'))['toString']():'','disposition':_0x4c025c[_0xb225('0x52')],'chatInfo':{'browser':_0x4c025c[_0xb225('0x134')],'os':_0x4c025c['osName'],'referer':_0x4c025c[_0xb225('0x135')],'customerIp':_0x4c025c[_0xb225('0x136')],'customerPort':_0x4c025c[_0xb225('0x137')]?_0x4c025c[_0xb225('0x137')]:_0xb225('0x131')},'messages':_(_0x4c025c['Messages'])[_0xb225('0x138')]()['filter']({'secret':![]})[_0xb225('0x46')](function(_0x115b0f){if(_0x115b0f[_0xb225('0xf3')]){var _0x4459e8=path[_0xb225('0xf6')](_0x535643,_0x115b0f['Attachment'][_0xb225('0xef')]);if(fs[_0xb225('0x139')](_0x4459e8)){fs['createReadStream'](_0x4459e8)[_0xb225('0x13a')](fs[_0xb225('0x13b')](path[_0xb225('0xf6')](_0x16456e,_0x115b0f[_0xb225('0xf3')][_0xb225('0xef')])));}}return{'date':moment(_0x115b0f['createdAt'])[_0xb225('0xfa')](_0xb225('0x132'))[_0xb225('0xb4')](),'sender':_0x115b0f[_0xb225('0x109')]===_0xb225('0xe1')?_0x115b0f[_0xb225('0x8d')]?_0x115b0f['User']['fullname']:_0xb225('0x101'):_0x115b0f['Contact'][_0xb225('0x12b')]+(_0x115b0f[_0xb225('0x83')][_0xb225('0x12c')]?'\x20'+_0x115b0f[_0xb225('0x83')][_0xb225('0x12c')]:''),'body':_0x115b0f[_0xb225('0xf3')]?_0x115b0f[_0xb225('0xf3')][_0xb225('0xef')]:_0x115b0f[_0xb225('0x42')],'direction':_0x115b0f[_0xb225('0x109')]===_0xb225('0xe1')?'A':'C','secret':_0x115b0f[_0xb225('0x10a')],'read':_0x115b0f[_0xb225('0x9d')],'attachment':_0x115b0f['Attachment']};})[_0xb225('0x80')]()};return ejs['renderFile'](path['join'](config[_0xb225('0xf5')],_0xb225('0x126'),_0xb225('0x13c'),'downloadInteraction.ejs'),{'interaction':_0x12df26})[_0xb225('0x24')](function(_0x2fda83){var _0x312975=path['join'](_0x16456e,_0xb225('0x13d')+_0x4c025c['id']+'-'+_0x2b3f96+_0xb225('0x13e'));var _0x4aa337={'path':_0x312975,'channel':_0xb225('0x130'),'interactionId':_0x4c025c['id']};return pdf[_0xb225('0x13f')](_0x2fda83,_0x4aa337);})[_0xb225('0x24')](function(){return new BPromise(function(_0x62370f,_0x23b523){zipdir(_0x16456e,{'saveTo':_0x805381},function(_0x5bf5d3,_0x487ed8){if(_0x5bf5d3)return _0x23b523(_0x5bf5d3);return _0x62370f(_0x487ed8);});})[_0xb225('0x24')](function(){return new BPromise(function(_0x229eb9,_0x1af0a9){rimraf(_0x16456e,function(_0x272ad6){if(_0x272ad6)_0x1af0a9(_0x272ad6);return _0x229eb9();});});})[_0xb225('0x24')](function(){return _0x254c84[_0xb225('0xf7')](_0x805381,_0x3af17f,function(_0x1dc7f2){if(_0x1dc7f2){console[_0xb225('0x140')](_0xb225('0x141'),_0x1dc7f2);}else{fs[_0xb225('0x142')](_0x805381);}});});});}else{return _0x254c84[_0xb225('0x30')](0xc8);}})['catch'](handleError(_0x254c84,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3ad701c..cc487fb 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 _0xadfe=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0xadfe,0x73));var _0xeadf=function(_0x5e915d,_0x4d5429){_0x5e915d=_0x5e915d-0x0;var _0x2bc34d=_0xadfe[_0x5e915d];return _0x2bc34d;};'use strict';var EventEmitter=require(_0xeadf('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xeadf('0x1')];var ChatMessage=require(_0xeadf('0x2'))['db'][_0xeadf('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xeadf('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeadf('0x5'),'afterDestroy':_0xeadf('0x6')};function emitEvent(_0x4b72c6){return function(_0x572407,_0x13f06d,_0x5191ee){_0x572407[_0xeadf('0x7')]({'attributes':['id'],'raw':!![]})[_0xeadf('0x8')](function(_0x290bb8){_0x572407[_0xeadf('0x9')](_0xeadf('0xa'),_0x290bb8[_0xeadf('0xb')](function(_0x43bcfd){return{'id':_0x43bcfd['id']};}));return ChatMessage[_0xeadf('0xc')]({'where':{'ChatInteractionId':_0x572407['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeadf('0x8')](function(_0x394548){_0x572407[_0xeadf('0x9')](_0xeadf('0xd'),_0x394548['length']);ChatInteractionEvents[_0xeadf('0xe')](_0x4b72c6+':'+_0x572407['id'],_0x572407);ChatInteractionEvents[_0xeadf('0xe')](_0x4b72c6,_0x572407);_0x5191ee(null);})[_0xeadf('0xf')](_0x5191ee(null));};}for(var e in events){if(events[_0xeadf('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xeadf('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x5790=['exports','events','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook'];(function(_0x4bdc75,_0x43cddc){var _0xdc2b01=function(_0x18d7cf){while(--_0x18d7cf){_0x4bdc75['push'](_0x4bdc75['shift']());}};_0xdc2b01(++_0x43cddc);}(_0x5790,0x100));var _0x0579=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5790[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x0579('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x0579('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0579('0x2')](0x0);var events={'afterCreate':_0x0579('0x3'),'afterUpdate':_0x0579('0x4'),'afterDestroy':_0x0579('0x5')};function emitEvent(_0x352d0f){return function(_0x3eea88,_0x4db200,_0x5d0049){_0x3eea88[_0x0579('0x6')]({'attributes':['id'],'raw':!![]})[_0x0579('0x7')](function(_0x5003d){_0x3eea88[_0x0579('0x8')](_0x0579('0x9'),_0x5003d[_0x0579('0xa')](function(_0x1cc0a4){return{'id':_0x1cc0a4['id']};}));return ChatMessage[_0x0579('0xb')]({'where':{'ChatInteractionId':_0x3eea88['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0579('0x7')](function(_0x4cad07){_0x3eea88['setDataValue'](_0x0579('0xc'),_0x4cad07['length']);ChatInteractionEvents[_0x0579('0xd')](_0x352d0f+':'+_0x3eea88['id'],_0x3eea88);ChatInteractionEvents['emit'](_0x352d0f,_0x3eea88);_0x5d0049(null);})[_0x0579('0xe')](_0x5d0049(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x0579('0xf')](e,emitEvent(event));}}module[_0x0579('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2681640..98a863d 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 _0x7b70=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x7b70,0x102));var _0x07b7=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x7b70[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x07b7('0x0'));var util=require(_0x07b7('0x1'));var logger=require(_0x07b7('0x2'))(_0x07b7('0x3'));var moment=require('moment');var BPromise=require(_0x07b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07b7('0x5'));var rimraf=require('rimraf');var config=require(_0x07b7('0x6'));var attributes=require(_0x07b7('0x7'));module[_0x07b7('0x8')]=function(_0x14e3db,_0x23c560){return _0x14e3db['define'](_0x07b7('0x9'),attributes,{'tableName':_0x07b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ac65f,_0x36fdbd,_0x12d085){if(_0x5ac65f['changed'](_0x07b7('0xb'))){_0x5ac65f['closedAt']=moment()[_0x07b7('0xc')](_0x07b7('0xd'));}_0x12d085(null,_0x5ac65f);}},'charset':_0x07b7('0xe'),'collate':_0x07b7('0xf')});}; \ No newline at end of file +var _0x944c=['closed','closedAt','format','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x16b6f4,_0x45369f){var _0x48cc8c=function(_0x588ebf){while(--_0x588ebf){_0x16b6f4['push'](_0x16b6f4['shift']());}};_0x48cc8c(++_0x45369f);}(_0x944c,0x17a));var _0xc944=function(_0x28aea6,_0x38cf69){_0x28aea6=_0x28aea6-0x0;var _0xa1a04a=_0x944c[_0x28aea6];return _0xa1a04a;};'use strict';var _=require(_0xc944('0x0'));var util=require(_0xc944('0x1'));var logger=require(_0xc944('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc944('0x3'));var rp=require(_0xc944('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc944('0x5'));var config=require(_0xc944('0x6'));var attributes=require(_0xc944('0x7'));module[_0xc944('0x8')]=function(_0x271823,_0x1806cc){return _0x271823[_0xc944('0x9')](_0xc944('0xa'),attributes,{'tableName':_0xc944('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xac1ecc,_0x11bedc,_0x57554c){if(_0xac1ecc[_0xc944('0xc')](_0xc944('0xd'))){_0xac1ecc[_0xc944('0xe')]=moment()[_0xc944('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57554c(null,_0xac1ecc);}},'charset':_0xc944('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5ad8798..fd4fe00 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 _0x1d11=['request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','options','raw','where','attributes','limit','then','UpdateChatInteraction','debug','AddTagsToChatInteraction','find','addTags','ids','body','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x1d11,0xea));var _0x11d1=function(_0x4912f2,_0x1d2a00){_0x4912f2=_0x4912f2-0x0;var _0x2f2b52=_0x1d11[_0x4912f2];return _0x2f2b52;};'use strict';var _=require(_0x11d1('0x0'));var util=require(_0x11d1('0x1'));var moment=require(_0x11d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x11d1('0x3'));var fs=require('fs');var Redis=require(_0x11d1('0x4'));var db=require(_0x11d1('0x5'))['db'];var utils=require(_0x11d1('0x6'));var logger=require('../../config/logger')(_0x11d1('0x7'));var config=require(_0x11d1('0x8'));var jayson=require(_0x11d1('0x9'));var client=jayson[_0x11d1('0xa')][_0x11d1('0xb')]({'port':0x232a});config[_0x11d1('0xc')]=_['defaults'](config['redis'],{'host':_0x11d1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11d1('0xc')]));require(_0x11d1('0xe'))['register'](socket);function respondWithRpcPromise(_0x3d7805,_0x47e0cf,_0x37bb60){return new BPromise(function(_0x538815,_0x2b95b6){return client[_0x11d1('0xf')](_0x3d7805,_0x37bb60)['then'](function(_0xac9437){logger[_0x11d1('0x10')](_0x11d1('0x11'),_0x47e0cf,_0x11d1('0x12'));logger['debug'](_0x11d1('0x13'),_0x47e0cf,'request\x20sent',JSON[_0x11d1('0x14')](_0xac9437));if(_0xac9437[_0x11d1('0x15')]){if(_0xac9437[_0x11d1('0x15')][_0x11d1('0x16')]===0x1f4){logger[_0x11d1('0x15')](_0x11d1('0x11'),_0x47e0cf,_0xac9437[_0x11d1('0x15')][_0x11d1('0x17')]);return _0x2b95b6(_0xac9437[_0x11d1('0x15')][_0x11d1('0x17')]);}logger[_0x11d1('0x15')](_0x11d1('0x11'),_0x47e0cf,_0xac9437[_0x11d1('0x15')]['message']);return _0x538815(_0xac9437[_0x11d1('0x15')][_0x11d1('0x17')]);}else{logger[_0x11d1('0x10')](_0x11d1('0x11'),_0x47e0cf,_0x11d1('0x12'));_0x538815(_0xac9437[_0x11d1('0x18')][_0x11d1('0x17')]);}})[_0x11d1('0x19')](function(_0x2dc0b9){logger[_0x11d1('0x15')](_0x11d1('0x11'),_0x47e0cf,_0x2dc0b9);_0x2b95b6(_0x2dc0b9);});});}exports['UpdateChatInteraction']=function(_0xb25f8f){var _0x4fd398=this;return new Promise(function(_0x22d93c,_0x47d367){return db[_0x11d1('0x1a')]['update'](_0xb25f8f['body'],{'raw':_0xb25f8f[_0x11d1('0x1b')]?_0xb25f8f[_0x11d1('0x1b')][_0x11d1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb25f8f[_0x11d1('0x1b')]?_0xb25f8f['options'][_0x11d1('0x1d')]||null:null,'attributes':_0xb25f8f['options']?_0xb25f8f[_0x11d1('0x1b')][_0x11d1('0x1e')]||null:null,'limit':_0xb25f8f['options']?_0xb25f8f[_0x11d1('0x1b')][_0x11d1('0x1f')]||null:null})[_0x11d1('0x20')](function(_0x3a5f98){logger[_0x11d1('0x10')](_0x11d1('0x21'),_0xb25f8f);logger[_0x11d1('0x22')](_0x11d1('0x21'),_0xb25f8f,JSON[_0x11d1('0x14')](_0x3a5f98));_0x22d93c(_0x3a5f98);})[_0x11d1('0x19')](function(_0x59dd2d){logger['error'](_0x11d1('0x21'),_0x59dd2d[_0x11d1('0x17')],_0xb25f8f);_0x47d367(_0x4fd398['error'](0x1f4,_0x59dd2d[_0x11d1('0x17')]));});});};exports[_0x11d1('0x23')]=function(_0x434c2f){return new Promise(function(_0x22ff20,_0x80af3d){return db[_0x11d1('0x1a')][_0x11d1('0x24')]({'where':_0x434c2f[_0x11d1('0x1b')]?_0x434c2f['options'][_0x11d1('0x1d')]||null:null})[_0x11d1('0x20')](function(_0x4df9a9){if(_0x4df9a9){return _0x4df9a9[_0x11d1('0x25')](_0x434c2f['body'][_0x11d1('0x26')],_['omit'](_0x434c2f[_0x11d1('0x27')],[_0x11d1('0x26'),'id'])||{});}})[_0x11d1('0x28')](function(_0x3030bd){logger['info'](_0x11d1('0x29'),_0x434c2f);logger[_0x11d1('0x22')](_0x11d1('0x29'),_0x434c2f,JSON['stringify'](_0x3030bd));_0x22ff20(_0x3030bd);})[_0x11d1('0x19')](function(_0x920fcd){logger[_0x11d1('0x15')](_0x11d1('0x29'),_0x920fcd[_0x11d1('0x17')],_0x434c2f);_0x80af3d(_this[_0x11d1('0x15')](0x1f4,_0x920fcd[_0x11d1('0x17')]));});});}; \ No newline at end of file +var _0x5cf3=['client','http','redis','defaults','localhost','socket.io-emitter','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatInteraction','update','options','raw','where','attributes','limit','then','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5cf3,0xa5));var _0x35cf=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x5cf3[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x35cf('0x0'));var util=require('util');var moment=require(_0x35cf('0x1'));var BPromise=require(_0x35cf('0x2'));var rs=require(_0x35cf('0x3'));var fs=require('fs');var Redis=require(_0x35cf('0x4'));var db=require(_0x35cf('0x5'))['db'];var utils=require(_0x35cf('0x6'));var logger=require(_0x35cf('0x7'))(_0x35cf('0x8'));var config=require(_0x35cf('0x9'));var jayson=require(_0x35cf('0xa'));var client=jayson[_0x35cf('0xb')][_0x35cf('0xc')]({'port':0x232a});config[_0x35cf('0xd')]=_[_0x35cf('0xe')](config['redis'],{'host':_0x35cf('0xf'),'port':0x18eb});var socket=require(_0x35cf('0x10'))(new Redis(config[_0x35cf('0xd')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x459d32,_0x125cb9,_0xae5f0){return new BPromise(function(_0x520dfb,_0x678e56){return client[_0x35cf('0x11')](_0x459d32,_0xae5f0)['then'](function(_0x51b4f4){logger[_0x35cf('0x12')](_0x35cf('0x13'),_0x125cb9,'request\x20sent');logger[_0x35cf('0x14')](_0x35cf('0x15'),_0x125cb9,_0x35cf('0x16'),JSON['stringify'](_0x51b4f4));if(_0x51b4f4[_0x35cf('0x17')]){if(_0x51b4f4['error'][_0x35cf('0x18')]===0x1f4){logger[_0x35cf('0x17')](_0x35cf('0x13'),_0x125cb9,_0x51b4f4[_0x35cf('0x17')]['message']);return _0x678e56(_0x51b4f4[_0x35cf('0x17')][_0x35cf('0x19')]);}logger[_0x35cf('0x17')](_0x35cf('0x13'),_0x125cb9,_0x51b4f4[_0x35cf('0x17')][_0x35cf('0x19')]);return _0x520dfb(_0x51b4f4[_0x35cf('0x17')][_0x35cf('0x19')]);}else{logger[_0x35cf('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x125cb9,_0x35cf('0x16'));_0x520dfb(_0x51b4f4['result']['message']);}})['catch'](function(_0x1e67b8){logger[_0x35cf('0x17')](_0x35cf('0x13'),_0x125cb9,_0x1e67b8);_0x678e56(_0x1e67b8);});});}exports['UpdateChatInteraction']=function(_0x55e7cb){var _0x58b850=this;return new Promise(function(_0x213ea0,_0x5c3804){return db[_0x35cf('0x1a')][_0x35cf('0x1b')](_0x55e7cb['body'],{'raw':_0x55e7cb['options']?_0x55e7cb[_0x35cf('0x1c')][_0x35cf('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e7cb[_0x35cf('0x1c')]?_0x55e7cb[_0x35cf('0x1c')][_0x35cf('0x1e')]||null:null,'attributes':_0x55e7cb[_0x35cf('0x1c')]?_0x55e7cb['options'][_0x35cf('0x1f')]||null:null,'limit':_0x55e7cb[_0x35cf('0x1c')]?_0x55e7cb[_0x35cf('0x1c')][_0x35cf('0x20')]||null:null})[_0x35cf('0x21')](function(_0x42f6cb){logger[_0x35cf('0x12')](_0x35cf('0x22'),_0x55e7cb);logger[_0x35cf('0x14')](_0x35cf('0x22'),_0x55e7cb,JSON[_0x35cf('0x23')](_0x42f6cb));_0x213ea0(_0x42f6cb);})['catch'](function(_0x1f7900){logger[_0x35cf('0x17')](_0x35cf('0x22'),_0x1f7900[_0x35cf('0x19')],_0x55e7cb);_0x5c3804(_0x58b850[_0x35cf('0x17')](0x1f4,_0x1f7900['message']));});});};exports[_0x35cf('0x24')]=function(_0x54bd52){return new Promise(function(_0x3fc589,_0x202eae){return db[_0x35cf('0x1a')][_0x35cf('0x25')]({'where':_0x54bd52[_0x35cf('0x1c')]?_0x54bd52['options']['where']||null:null})[_0x35cf('0x21')](function(_0x19933e){if(_0x19933e){return _0x19933e['addTags'](_0x54bd52[_0x35cf('0x26')][_0x35cf('0x27')],_[_0x35cf('0x28')](_0x54bd52[_0x35cf('0x26')],[_0x35cf('0x27'),'id'])||{});}})[_0x35cf('0x29')](function(_0x4f8b96){logger['info'](_0x35cf('0x2a'),_0x54bd52);logger[_0x35cf('0x14')](_0x35cf('0x2a'),_0x54bd52,JSON[_0x35cf('0x23')](_0x4f8b96));_0x3fc589(_0x4f8b96);})[_0x35cf('0x2b')](function(_0x1f153c){logger['error']('AddTags',_0x1f153c[_0x35cf('0x19')],_0x54bd52);_0x202eae(_this[_0x35cf('0x17')](0x1f4,_0x1f153c[_0x35cf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 85e93d2..11dfd02 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 _0x6b9e=['update','register','chatInteraction:','save','remove'];(function(_0x307a6b,_0x2d0315){var _0x93a569=function(_0x5b314a){while(--_0x5b314a){_0x307a6b['push'](_0x307a6b['shift']());}};_0x93a569(++_0x2d0315);}(_0x6b9e,0x16b));var _0xe6b9=function(_0x22f0bb,_0x377a43){_0x22f0bb=_0x22f0bb-0x0;var _0x514523=_0x6b9e[_0x22f0bb];return _0x514523;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xe6b9('0x0'),_0xe6b9('0x1'),_0xe6b9('0x2')];function createListener(_0x4f2474,_0x2a2bac){return function(_0x3df84f){_0x2a2bac['emit'](_0x4f2474,_0x3df84f);};}function removeListener(_0x719f0,_0xdb5354){return function(){ChatInteractionEvents['removeListener'](_0x719f0,_0xdb5354);};}exports[_0xe6b9('0x3')]=function(_0x371ec8){for(var _0x4730cd=0x0,_0x29cec2=events['length'];_0x4730cd<_0x29cec2;_0x4730cd++){var _0x3f6d4e=events[_0x4730cd];var _0x35d1ae=createListener(_0xe6b9('0x4')+_0x3f6d4e,_0x371ec8);ChatInteractionEvents['on'](_0x3f6d4e,_0x35d1ae);}}; \ No newline at end of file +var _0x89b2=['removeListener','register','./chatInteraction.events','save','remove','update','emit'];(function(_0x25404f,_0x41e06b){var _0xd0ba74=function(_0x3d45a9){while(--_0x3d45a9){_0x25404f['push'](_0x25404f['shift']());}};_0xd0ba74(++_0x41e06b);}(_0x89b2,0xc6));var _0x289b=function(_0x1b8300,_0x472f39){_0x1b8300=_0x1b8300-0x0;var _0x49deb2=_0x89b2[_0x1b8300];return _0x49deb2;};'use strict';var ChatInteractionEvents=require(_0x289b('0x0'));var events=[_0x289b('0x1'),_0x289b('0x2'),_0x289b('0x3')];function createListener(_0x1e9399,_0x9218b1){return function(_0xcf1649){_0x9218b1[_0x289b('0x4')](_0x1e9399,_0xcf1649);};}function removeListener(_0x1f95d6,_0x1067a0){return function(){ChatInteractionEvents[_0x289b('0x5')](_0x1f95d6,_0x1067a0);};}exports[_0x289b('0x6')]=function(_0x5a6cc7){for(var _0x1f7062=0x0,_0x5a3c5c=events['length'];_0x1f7062<_0x5a3c5c;_0x1f7062++){var _0x2376f0=events[_0x1f7062];var _0x4ab7ba=createListener('chatInteraction:'+_0x2376f0,_0x5a6cc7);ChatInteractionEvents['on'](_0x2376f0,_0x4ab7ba);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 723ebf4..846a09c 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 _0xf3e9=['chatinteraction:addtags','addTags','chatinteraction:update','/:id/custom_update','customUpdate','abandon','put','/:id/close','close','/:id','destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id/attachment_download','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat'];(function(_0x453704,_0xcf42a8){var _0x1d1ba5=function(_0x433ba0){while(--_0x433ba0){_0x453704['push'](_0x453704['shift']());}};_0x1d1ba5(++_0xcf42a8);}(_0xf3e9,0x19c));var _0x9f3e=function(_0x4427b1,_0x4db818){_0x4427b1=_0x4427b1-0x0;var _0x3ca743=_0xf3e9[_0x4427b1];return _0x3ca743;};'use strict';var multer=require('multer');var util=require(_0x9f3e('0x0'));var path=require(_0x9f3e('0x1'));var timeout=require(_0x9f3e('0x2'));var express=require(_0x9f3e('0x3'));var router=express[_0x9f3e('0x4')]();var fs_extra=require(_0x9f3e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9f3e('0x6'));var controller=require(_0x9f3e('0x7'));router[_0x9f3e('0x8')]('/',auth[_0x9f3e('0x9')](),controller['index']);router[_0x9f3e('0x8')](_0x9f3e('0xa'),auth[_0x9f3e('0x9')](),controller[_0x9f3e('0xb')]);router[_0x9f3e('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router['get'](_0x9f3e('0xc'),auth[_0x9f3e('0xd')](),controller['attachmentDownload']);router[_0x9f3e('0x8')](_0x9f3e('0xe'),auth[_0x9f3e('0x9')](),controller[_0x9f3e('0xf')]);router[_0x9f3e('0x8')](_0x9f3e('0x10'),auth[_0x9f3e('0xd')](),controller[_0x9f3e('0x11')]);router[_0x9f3e('0x8')](_0x9f3e('0x12'),auth[_0x9f3e('0x9')](),controller[_0x9f3e('0x13')]);router['post']('/',auth[_0x9f3e('0x9')](),controller[_0x9f3e('0x14')]);router[_0x9f3e('0x15')](_0x9f3e('0x16'),auth[_0x9f3e('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x9f3e('0x17')]({'destination':function(_0x25b563,_0x2b7bd4,_0x52c609){_0x52c609(null,path[_0x9f3e('0x18')](config[_0x9f3e('0x19')],_0x9f3e('0x1a')));},'filename':function(_0x4c6688,_0x33ffd4,_0x12d09f){_0x12d09f(null,util[_0x9f3e('0x1b')]('%s-%s',Date[_0x9f3e('0x1c')](),_0x33ffd4[_0x9f3e('0x1d')][_0x9f3e('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9f3e('0x15')](_0x9f3e('0x1f'),upload[_0x9f3e('0x20')]('file'),controller[_0x9f3e('0x21')]);router[_0x9f3e('0x15')](_0x9f3e('0xe'),auth[_0x9f3e('0xd')](),controller[_0x9f3e('0x22')]);router[_0x9f3e('0x15')](_0x9f3e('0x23'),auth[_0x9f3e('0x9')](),interaction[_0x9f3e('0x24')](_0x9f3e('0x25'),_0x9f3e('0x26')),controller[_0x9f3e('0x27')]);router['put']('/:id',auth[_0x9f3e('0x9')](),interaction[_0x9f3e('0x24')](_0x9f3e('0x25'),_0x9f3e('0x28')),controller['update']);router['put'](_0x9f3e('0x29'),controller[_0x9f3e('0x2a')]);router['put']('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x9f3e('0x2b')]);router[_0x9f3e('0x2c')](_0x9f3e('0x2d'),controller[_0x9f3e('0x2e')]);router['delete'](_0x9f3e('0x2f'),auth['isAuthenticated'](),interaction[_0x9f3e('0x24')](_0x9f3e('0x25'),'chatinteraction:destroy'),controller[_0x9f3e('0x30')]);router['delete'](_0x9f3e('0x23'),auth[_0x9f3e('0x9')](),controller[_0x9f3e('0x31')]);module['exports']=router; \ No newline at end of file +var _0x82a4=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','isAuthenticated','getMessages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags'];(function(_0x48df88,_0x500ded){var _0x377d1c=function(_0x381645){while(--_0x381645){_0x48df88['push'](_0x48df88['shift']());}};_0x377d1c(++_0x500ded);}(_0x82a4,0x9a));var _0x482a=function(_0x30c7e7,_0x4acce2){_0x30c7e7=_0x30c7e7-0x0;var _0x271e38=_0x82a4[_0x30c7e7];return _0x271e38;};'use strict';var multer=require(_0x482a('0x0'));var util=require(_0x482a('0x1'));var path=require('path');var timeout=require(_0x482a('0x2'));var express=require(_0x482a('0x3'));var router=express[_0x482a('0x4')]();var fs_extra=require(_0x482a('0x5'));var auth=require(_0x482a('0x6'));var interaction=require(_0x482a('0x7'));var config=require(_0x482a('0x8'));var controller=require('./chatInteraction.controller');router[_0x482a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x482a('0x9')](_0x482a('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x482a('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router['get']('/:id/attachment_download',auth[_0x482a('0xc')](),controller[_0x482a('0xd')]);router['get'](_0x482a('0xe'),auth[_0x482a('0xf')](),controller[_0x482a('0x10')]);router[_0x482a('0x9')]('/:id/my_messages',auth[_0x482a('0xc')](),controller[_0x482a('0x11')]);router['get'](_0x482a('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x482a('0x13')]('/',auth[_0x482a('0xf')](),controller[_0x482a('0x14')]);router[_0x482a('0x13')](_0x482a('0x15'),auth[_0x482a('0xf')](),controller[_0x482a('0x16')]);var upload=multer({'storage':multer[_0x482a('0x17')]({'destination':function(_0x408eb0,_0x937c4e,_0x8e7592){_0x8e7592(null,path[_0x482a('0x18')](config[_0x482a('0x19')],_0x482a('0x1a')));},'filename':function(_0x4a1bb5,_0x4c1f9b,_0xf023fd){_0xf023fd(null,util['format'](_0x482a('0x1b'),Date['now'](),_0x4c1f9b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x482a('0x1c'),upload[_0x482a('0x1d')](_0x482a('0x1e')),controller[_0x482a('0x1f')]);router[_0x482a('0x13')]('/:id/messages',auth[_0x482a('0xc')](),controller[_0x482a('0x20')]);router[_0x482a('0x13')](_0x482a('0x21'),auth[_0x482a('0xf')](),interaction['tracked'](_0x482a('0x22'),_0x482a('0x23')),controller[_0x482a('0x24')]);router['put'](_0x482a('0xb'),auth[_0x482a('0xf')](),interaction['tracked'](_0x482a('0x22'),_0x482a('0x25')),controller[_0x482a('0x26')]);router[_0x482a('0x27')](_0x482a('0x28'),controller[_0x482a('0x29')]);router[_0x482a('0x27')](_0x482a('0x2a'),auth[_0x482a('0xc')](),controller[_0x482a('0x2b')]);router[_0x482a('0x27')](_0x482a('0x2c'),controller[_0x482a('0x2d')]);router[_0x482a('0x2e')](_0x482a('0xb'),auth[_0x482a('0xf')](),interaction['tracked'](_0x482a('0x22'),_0x482a('0x2f')),controller[_0x482a('0x30')]);router[_0x482a('0x2e')](_0x482a('0x21'),auth[_0x482a('0xf')](),controller[_0x482a('0x31')]);module[_0x482a('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 6b433af..a7de426 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 _0x8c5e=['sequelize','exports','TEXT','medium'];(function(_0x3bcd7b,_0x121396){var _0x135da7=function(_0x24b030){while(--_0x24b030){_0x3bcd7b['push'](_0x3bcd7b['shift']());}};_0x135da7(++_0x121396);}(_0x8c5e,0x148));var _0xe8c5=function(_0x44fede,_0x5613b8){_0x44fede=_0x44fede-0x0;var _0x3f0945=_0x8c5e[_0x44fede];return _0x3f0945;};'use strict';var Sequelize=require(_0xe8c5('0x0'));module[_0xe8c5('0x1')]={'body':{'type':Sequelize[_0xe8c5('0x2')](_0xe8c5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x097b=['sequelize','exports','TEXT','medium','BOOLEAN','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x097b,0x19e));var _0xb097=function(_0x244605,_0x5a54cf){_0x244605=_0x244605-0x0;var _0x379650=_0x097b[_0x244605];return _0x379650;};'use strict';var Sequelize=require(_0xb097('0x0'));module[_0xb097('0x1')]={'body':{'type':Sequelize[_0xb097('0x2')](_0xb097('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb097('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb097('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 20868b9..e9a2e76 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 _0xc20c=['../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','length','options','create','body','find','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','userpic','online','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','autoAssociation','UserProfileResource','push','messages','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x484759,_0x54a76e){var _0x4fc985=function(_0x5c0500){while(--_0x5c0500){_0x484759['push'](_0x484759['shift']());}};_0x4fc985(++_0x54a76e);}(_0xc20c,0x194));var _0xcc20=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xc20c[_0x4c445a];return _0x2f611c;};'use strict';var emlformat=require(_0xcc20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc20('0x1'));var jsonpatch=require(_0xcc20('0x2'));var rp=require(_0xcc20('0x3'));var moment=require(_0xcc20('0x4'));var BPromise=require(_0xcc20('0x5'));var Mustache=require(_0xcc20('0x6'));var util=require(_0xcc20('0x7'));var path=require(_0xcc20('0x8'));var sox=require(_0xcc20('0x9'));var csv=require('to-csv');var ejs=require(_0xcc20('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc20('0xb'));var squel=require(_0xcc20('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc20('0xd'));var toCsv=require(_0xcc20('0xe'));var querystring=require(_0xcc20('0xf'));var Papa=require(_0xcc20('0x10'));var Redis=require(_0xcc20('0x11'));var authService=require(_0xcc20('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcc20('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc20('0x14'))(_0xcc20('0x15'));var utils=require(_0xcc20('0x16'));var config=require(_0xcc20('0x17'));var licenseUtil=require(_0xcc20('0x18'));var db=require('../../mysqldb')['db'];config[_0xcc20('0x19')]=_[_0xcc20('0x1a')](config['redis'],{'host':_0xcc20('0x1b'),'port':0x18eb});var socket=require(_0xcc20('0x1c'))(new Redis(config[_0xcc20('0x19')]));require('./chatInternalMessage.socket')[_0xcc20('0x1d')](socket);function respondWithStatusCode(_0x1e7644,_0xa68b95){_0xa68b95=_0xa68b95||0xcc;return function(_0x2b88d3){if(_0x2b88d3){return _0x1e7644[_0xcc20('0x1e')](_0xa68b95);}return _0x1e7644[_0xcc20('0x1f')](_0xa68b95)[_0xcc20('0x20')]();};}function respondWithResult(_0x16b05f,_0x1d9954){_0x1d9954=_0x1d9954||0xc8;return function(_0x126a03){if(_0x126a03){return _0x16b05f['status'](_0x1d9954)['json'](_0x126a03);}};}function respondWithFilteredResult(_0x40fb27,_0x3a60f8){return function(_0x2f3f00){if(_0x2f3f00){var _0x38d942=typeof _0x3a60f8[_0xcc20('0x21')]==='undefined'&&typeof _0x3a60f8[_0xcc20('0x22')]==='undefined';var _0x13e32d=_0x2f3f00[_0xcc20('0x23')];var _0x130a65=_0x38d942?0x0:_0x3a60f8[_0xcc20('0x21')];var _0x48dd3c=_0x38d942?_0x2f3f00[_0xcc20('0x23')]:_0x3a60f8[_0xcc20('0x21')]+_0x3a60f8[_0xcc20('0x22')];var _0x1fba13;if(_0x48dd3c>=_0x13e32d){_0x48dd3c=_0x13e32d;_0x1fba13=0xc8;}else{_0x1fba13=0xce;}_0x40fb27[_0xcc20('0x1f')](_0x1fba13);return _0x40fb27['set'](_0xcc20('0x24'),_0x130a65+'-'+_0x48dd3c+'/'+_0x13e32d)[_0xcc20('0x25')](_0x2f3f00);}return null;};}function patchUpdates(_0x3d7ac3){return function(_0xd6a54b){try{jsonpatch[_0xcc20('0x26')](_0xd6a54b,_0x3d7ac3,!![]);}catch(_0x4664fc){return BPromise['reject'](_0x4664fc);}return _0xd6a54b[_0xcc20('0x27')]();};}function saveUpdates(_0xf08c23,_0x2e4018){return function(_0x46f847){if(_0x46f847){return _0x46f847[_0xcc20('0x28')](_0xf08c23)[_0xcc20('0x29')](function(_0x35f241){return _0x35f241;});}return null;};}function removeEntity(_0x24a480,_0x5223f8){return function(_0x528b57){if(_0x528b57){return _0x528b57[_0xcc20('0x2a')]()[_0xcc20('0x29')](function(){_0x24a480[_0xcc20('0x1f')](0xcc)[_0xcc20('0x20')]();});}};}function handleEntityNotFound(_0x49a29b,_0x21c6c5){return function(_0x5d2e04){if(!_0x5d2e04){_0x49a29b[_0xcc20('0x1e')](0x194);}return _0x5d2e04;};}function handleError(_0x52cdce,_0x1072f0){_0x1072f0=_0x1072f0||0x1f4;return function(_0x267197){logger[_0xcc20('0x2b')](_0x267197[_0xcc20('0x2c')]);if(_0x267197[_0xcc20('0x2d')]){delete _0x267197['name'];}_0x52cdce[_0xcc20('0x1f')](_0x1072f0)[_0xcc20('0x2e')](_0x267197);};}exports['index']=function(_0x17e5b6,_0x43eed5){var _0x47c0ca={},_0x1ca610={},_0x1604eb={'count':0x0,'rows':[]};var _0x361219=_[_0xcc20('0x2f')](db[_0xcc20('0x30')][_0xcc20('0x31')],function(_0x2556b0){return{'name':_0x2556b0['fieldName'],'type':_0x2556b0[_0xcc20('0x32')][_0xcc20('0x33')]};});_0x1ca610['model']=_[_0xcc20('0x2f')](_0x361219,_0xcc20('0x2d'));_0x1ca610[_0xcc20('0x34')]=_[_0xcc20('0x35')](_0x17e5b6[_0xcc20('0x34')]);_0x1ca610[_0xcc20('0x36')]=_[_0xcc20('0x37')](_0x1ca610[_0xcc20('0x38')],_0x1ca610[_0xcc20('0x34')]);_0x47c0ca[_0xcc20('0x39')]=_['intersection'](_0x1ca610['model'],qs[_0xcc20('0x3a')](_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x3a')]));_0x47c0ca['attributes']=_0x47c0ca[_0xcc20('0x39')]['length']?_0x47c0ca[_0xcc20('0x39')]:_0x1ca610[_0xcc20('0x38')];if(!_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x3b')](_0xcc20('0x3c'))){_0x47c0ca[_0xcc20('0x22')]=qs[_0xcc20('0x22')](_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x22')]);_0x47c0ca[_0xcc20('0x21')]=qs[_0xcc20('0x21')](_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x21')]);}_0x47c0ca[_0xcc20('0x3d')]=qs[_0xcc20('0x3e')](_0x17e5b6['query']['sort']);_0x47c0ca[_0xcc20('0x3f')]=qs[_0xcc20('0x36')](_[_0xcc20('0x40')](_0x17e5b6[_0xcc20('0x34')],_0x1ca610[_0xcc20('0x36')]),_0x361219);if(_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x41')]){_0x47c0ca[_0xcc20('0x3f')]=_[_0xcc20('0x42')](_0x47c0ca[_0xcc20('0x3f')],{'$or':_[_0xcc20('0x2f')](_0x361219,function(_0x4b0a48){if(_0x4b0a48['type']!=='VIRTUAL'){var _0x58770a={};_0x58770a[_0x4b0a48[_0xcc20('0x2d')]]={'$like':'%'+_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x41')]+'%'};return _0x58770a;}})});}_0x47c0ca=_[_0xcc20('0x42')]({},_0x47c0ca,_0x17e5b6['options']);var _0x595a8d={'where':_0x47c0ca[_0xcc20('0x3f')]};return db['ChatInternalMessage'][_0xcc20('0x23')](_0x595a8d)[_0xcc20('0x29')](function(_0x44bcf2){_0x1604eb[_0xcc20('0x23')]=_0x44bcf2;if(_0x17e5b6[_0xcc20('0x34')][_0xcc20('0x43')]){_0x47c0ca[_0xcc20('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xcc20('0x45')](_0x47c0ca);})[_0xcc20('0x29')](function(_0x1d2acd){_0x1604eb['rows']=_0x1d2acd;return _0x1604eb;})[_0xcc20('0x29')](respondWithFilteredResult(_0x43eed5,_0x47c0ca))[_0xcc20('0x46')](handleError(_0x43eed5,null));};exports[_0xcc20('0x47')]=function(_0x73a388,_0x12206b){var _0x5f1fad={'raw':!![],'where':{'id':_0x73a388[_0xcc20('0x48')]['id']}},_0x530d05={};_0x530d05[_0xcc20('0x38')]=_[_0xcc20('0x35')](db['ChatInternalMessage'][_0xcc20('0x31')]);_0x530d05[_0xcc20('0x34')]=_['keys'](_0x73a388[_0xcc20('0x34')]);_0x530d05[_0xcc20('0x36')]=_[_0xcc20('0x37')](_0x530d05[_0xcc20('0x38')],_0x530d05[_0xcc20('0x34')]);_0x5f1fad[_0xcc20('0x39')]=_['intersection'](_0x530d05[_0xcc20('0x38')],qs['fields'](_0x73a388['query'][_0xcc20('0x3a')]));_0x5f1fad[_0xcc20('0x39')]=_0x5f1fad['attributes'][_0xcc20('0x49')]?_0x5f1fad['attributes']:_0x530d05[_0xcc20('0x38')];if(_0x73a388[_0xcc20('0x34')]['includeAll']){_0x5f1fad[_0xcc20('0x44')]=[{'all':!![]}];}_0x5f1fad=_[_0xcc20('0x42')]({},_0x5f1fad,_0x73a388[_0xcc20('0x4a')]);return db[_0xcc20('0x30')]['find'](_0x5f1fad)[_0xcc20('0x29')](handleEntityNotFound(_0x12206b,null))[_0xcc20('0x29')](respondWithResult(_0x12206b,null))['catch'](handleError(_0x12206b,null));};exports[_0xcc20('0x4b')]=function(_0x28f4c2,_0x59b334){return db[_0xcc20('0x30')][_0xcc20('0x4b')](_0x28f4c2['body'],{})[_0xcc20('0x29')](respondWithResult(_0x59b334,0xc9))[_0xcc20('0x46')](handleError(_0x59b334,null));};exports[_0xcc20('0x28')]=function(_0xf1f4c0,_0x2e2e34){if(_0xf1f4c0[_0xcc20('0x4c')]['id']){delete _0xf1f4c0[_0xcc20('0x4c')]['id'];}return db[_0xcc20('0x30')][_0xcc20('0x4d')]({'where':{'id':_0xf1f4c0[_0xcc20('0x48')]['id']}})[_0xcc20('0x29')](handleEntityNotFound(_0x2e2e34,null))[_0xcc20('0x29')](saveUpdates(_0xf1f4c0[_0xcc20('0x4c')],null))[_0xcc20('0x29')](respondWithResult(_0x2e2e34,null))[_0xcc20('0x46')](handleError(_0x2e2e34,null));};exports[_0xcc20('0x2a')]=function(_0x1ea363,_0x5c94c3){return db[_0xcc20('0x30')][_0xcc20('0x4d')]({'where':{'id':_0x1ea363[_0xcc20('0x48')]['id']}})['then'](handleEntityNotFound(_0x5c94c3,null))[_0xcc20('0x29')](removeEntity(_0x5c94c3,null))[_0xcc20('0x46')](handleError(_0x5c94c3,null));};exports[_0xcc20('0x4e')]=function(_0x49740d,_0x1b5ac6){return db[_0xcc20('0x30')]['describe']()['then'](respondWithResult(_0x1b5ac6,null))[_0xcc20('0x46')](handleError(_0x1b5ac6,null));};function wrapUser(_0x3adc62){return function(_0x4507ba){var _0x2e9f64=_0x3adc62[_0xcc20('0x4f')]({'plain':!![]});_0x2e9f64['messages']=[];if(_0x4507ba){_0x2e9f64[_0xcc20('0x50')]=_0x4507ba[_0xcc20('0x51')];_0x2e9f64[_0xcc20('0x52')]=_0x4507ba;}else{_0x2e9f64[_0xcc20('0x50')]=moment(0x0)['format'](_0xcc20('0x53'));_0x2e9f64[_0xcc20('0x52')]={};}return _0x2e9f64;};}exports[_0xcc20('0x54')]=function(_0x216a07,_0x493be8,_0x5d716e){var _0x5eabeb=[];return db[_0xcc20('0x55')]['findAll']({'where':{'role':[_0xcc20('0x56'),_0xcc20('0x57'),_0xcc20('0x58')]},'attributes':['id','fullname','name','role',_0xcc20('0x59'),'internal',_0xcc20('0x5a'),'lastLoginAt',_0xcc20('0x5b'),_0xcc20('0x5c')],'order':qs[_0xcc20('0x3e')](_0xcc20('0x5d')),'include':[{'model':db[_0xcc20('0x5e')],'as':'VoiceQueues','attributes':['id',_0xcc20('0x2d'),_0xcc20('0x32')],'through':{'attributes':[]}}]})[_0xcc20('0x29')](function(_0x3bf592){if(_0x3bf592){var _0x284f30=_0x216a07['user'][_0xcc20('0x4f')]({'plain':!![]});if(!_0x284f30)throw new Error(_0xcc20('0x5f'));if(_0x284f30[_0xcc20('0x60')]===_0xcc20('0x58')){return db['UserProfileSection'][_0xcc20('0x4d')]({'where':{'name':_0xcc20('0x61'),'userProfileId':_0x284f30['userProfileId']},'raw':!![]})[_0xcc20('0x29')](function(_0xd28bcc){if(_0xd28bcc){if(_0xd28bcc[_0xcc20('0x62')]===0x0){return db[_0xcc20('0x63')][_0xcc20('0x45')]({'where':{'sectionId':_0xd28bcc['id']},'raw':!![]})[_0xcc20('0x29')](function(_0x1d1422){var _0x57a5cd=[];if(_['isEmpty'](_0x1d1422)){_0x57a5cd=_[_0xcc20('0x41')](_0x3bf592,function(_0x4cf38){if(_0x4cf38[_0xcc20('0x60')]!==_0xcc20('0x56')){return _0x4cf38;}});return _0x57a5cd;}else{for(var _0x201a19=0x0;_0x201a19<_0x3bf592[_0xcc20('0x49')];_0x201a19++){var _0x5de1f8=_0x3bf592[_0x201a19];if(_0x5de1f8[_0xcc20('0x60')]===_0xcc20('0x56')){var _0x24852f=_[_0xcc20('0x4d')](_0x1d1422,function(_0xb9da49){return _0xb9da49['resourceId']===_0x5de1f8['id'];});if(_0x24852f)_0x57a5cd[_0xcc20('0x64')](_0x5de1f8);}else{_0x57a5cd[_0xcc20('0x64')](_0x5de1f8);}}return _0x57a5cd;}});}else{return _0x3bf592;}}else{var _0xe4b1cb=_['filter'](_0x3bf592,function(_0x5e629d){if(_0x5e629d[_0xcc20('0x60')]!==_0xcc20('0x56')){return _0x5e629d;}});return _0xe4b1cb;}});}else{return _0x3bf592;}}})[_0xcc20('0x29')](function(_0x2a32b8){var _0x299027=[];if(_0x2a32b8){_0x5eabeb=_0x2a32b8;for(var _0x559dfc=0x0;_0x559dfc<_0x2a32b8['length'];_0x559dfc+=0x1){_0x5eabeb[_0x559dfc][_0xcc20('0x65')]=[];_0x299027[_0xcc20('0x64')](db['ChatInternalMessage'][_0xcc20('0x4d')]({'where':{'FromId':[_0x216a07['user']['id'],_0x2a32b8[_0x559dfc]['id']],'ToId':[_0x216a07[_0xcc20('0x58')]['id'],_0x2a32b8[_0x559dfc]['id']],'ChatGroupId':null},'attributes':['id',_0xcc20('0x51'),_0xcc20('0x66'),_0xcc20('0x67'),_0xcc20('0x68'),'body'],'order':qs['sort'](_0xcc20('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2a32b8[_0x559dfc])));}return BPromise[_0xcc20('0x6a')](_0x299027);}return[];})[_0xcc20('0x29')](function(_0x191dfe){return{'rows':_0x191dfe,'count':_0x191dfe['length']};})[_0xcc20('0x29')](respondWithResult(_0x493be8,null))[_0xcc20('0x46')](handleError(_0x493be8,null));}; \ No newline at end of file +var _0x40b6=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model'];(function(_0x469665,_0x394876){var _0x291ab5=function(_0x55c1c7){while(--_0x55c1c7){_0x469665['push'](_0x469665['shift']());}};_0x291ab5(++_0x394876);}(_0x40b6,0x1dc));var _0x640b=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x40b6[_0x58999b];return _0x5efc3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x640b('0x0'));var zipdir=require(_0x640b('0x1'));var jsonpatch=require(_0x640b('0x2'));var rp=require(_0x640b('0x3'));var moment=require(_0x640b('0x4'));var BPromise=require(_0x640b('0x5'));var Mustache=require(_0x640b('0x6'));var util=require('util');var path=require(_0x640b('0x7'));var sox=require(_0x640b('0x8'));var csv=require('to-csv');var ejs=require(_0x640b('0x9'));var fs=require('fs');var fs_extra=require(_0x640b('0xa'));var _=require('lodash');var squel=require(_0x640b('0xb'));var crypto=require(_0x640b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x640b('0xd'));var querystring=require(_0x640b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x640b('0xf'));var qs=require(_0x640b('0x10'));var as=require(_0x640b('0x11'));var hardwareService=require(_0x640b('0x12'));var logger=require(_0x640b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x640b('0x14'));var licenseUtil=require(_0x640b('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x640b('0x16')],{'host':_0x640b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x640b('0x16')]));require('./chatInternalMessage.socket')[_0x640b('0x18')](socket);function respondWithStatusCode(_0x455d8a,_0x15d12e){_0x15d12e=_0x15d12e||0xcc;return function(_0xf249a5){if(_0xf249a5){return _0x455d8a[_0x640b('0x19')](_0x15d12e);}return _0x455d8a[_0x640b('0x1a')](_0x15d12e)[_0x640b('0x1b')]();};}function respondWithResult(_0x1880f3,_0x4d7edc){_0x4d7edc=_0x4d7edc||0xc8;return function(_0x41cde2){if(_0x41cde2){return _0x1880f3[_0x640b('0x1a')](_0x4d7edc)['json'](_0x41cde2);}};}function respondWithFilteredResult(_0x486657,_0x5c0ba0){return function(_0x456365){if(_0x456365){var _0x4b2902=typeof _0x5c0ba0[_0x640b('0x1c')]===_0x640b('0x1d')&&typeof _0x5c0ba0[_0x640b('0x1e')]===_0x640b('0x1d');var _0x57ed8c=_0x456365[_0x640b('0x1f')];var _0x24e144=_0x4b2902?0x0:_0x5c0ba0[_0x640b('0x1c')];var _0x58059e=_0x4b2902?_0x456365['count']:_0x5c0ba0[_0x640b('0x1c')]+_0x5c0ba0['limit'];var _0x15c80e;if(_0x58059e>=_0x57ed8c){_0x58059e=_0x57ed8c;_0x15c80e=0xc8;}else{_0x15c80e=0xce;}_0x486657[_0x640b('0x1a')](_0x15c80e);return _0x486657[_0x640b('0x20')]('Content-Range',_0x24e144+'-'+_0x58059e+'/'+_0x57ed8c)[_0x640b('0x21')](_0x456365);}return null;};}function patchUpdates(_0x5e98c7){return function(_0x35959b){try{jsonpatch[_0x640b('0x22')](_0x35959b,_0x5e98c7,!![]);}catch(_0x2936c1){return BPromise['reject'](_0x2936c1);}return _0x35959b[_0x640b('0x23')]();};}function saveUpdates(_0x29d12e,_0x447d29){return function(_0x764569){if(_0x764569){return _0x764569[_0x640b('0x24')](_0x29d12e)[_0x640b('0x25')](function(_0x263876){return _0x263876;});}return null;};}function removeEntity(_0x7376c8,_0x295b86){return function(_0x2a1dcf){if(_0x2a1dcf){return _0x2a1dcf[_0x640b('0x26')]()[_0x640b('0x25')](function(){_0x7376c8['status'](0xcc)[_0x640b('0x1b')]();});}};}function handleEntityNotFound(_0x50224e,_0x406678){return function(_0x15c074){if(!_0x15c074){_0x50224e[_0x640b('0x19')](0x194);}return _0x15c074;};}function handleError(_0x385700,_0x5bc411){_0x5bc411=_0x5bc411||0x1f4;return function(_0x390dd1){logger['error'](_0x390dd1[_0x640b('0x27')]);if(_0x390dd1['name']){delete _0x390dd1[_0x640b('0x28')];}_0x385700[_0x640b('0x1a')](_0x5bc411)[_0x640b('0x29')](_0x390dd1);};}exports['index']=function(_0x5f03c2,_0x1565b5){var _0x2ffdfa={},_0x5735d5={},_0x217719={'count':0x0,'rows':[]};var _0x1f4967=_[_0x640b('0x2a')](db[_0x640b('0x2b')][_0x640b('0x2c')],function(_0x2984db){return{'name':_0x2984db[_0x640b('0x2d')],'type':_0x2984db[_0x640b('0x2e')][_0x640b('0x2f')]};});_0x5735d5[_0x640b('0x30')]=_[_0x640b('0x2a')](_0x1f4967,_0x640b('0x28'));_0x5735d5[_0x640b('0x31')]=_[_0x640b('0x32')](_0x5f03c2[_0x640b('0x31')]);_0x5735d5['filters']=_[_0x640b('0x33')](_0x5735d5[_0x640b('0x30')],_0x5735d5['query']);_0x2ffdfa['attributes']=_[_0x640b('0x33')](_0x5735d5[_0x640b('0x30')],qs['fields'](_0x5f03c2[_0x640b('0x31')][_0x640b('0x34')]));_0x2ffdfa[_0x640b('0x35')]=_0x2ffdfa[_0x640b('0x35')][_0x640b('0x36')]?_0x2ffdfa[_0x640b('0x35')]:_0x5735d5['model'];if(!_0x5f03c2[_0x640b('0x31')][_0x640b('0x37')](_0x640b('0x38'))){_0x2ffdfa['limit']=qs[_0x640b('0x1e')](_0x5f03c2[_0x640b('0x31')][_0x640b('0x1e')]);_0x2ffdfa[_0x640b('0x1c')]=qs[_0x640b('0x1c')](_0x5f03c2[_0x640b('0x31')][_0x640b('0x1c')]);}_0x2ffdfa[_0x640b('0x39')]=qs[_0x640b('0x3a')](_0x5f03c2[_0x640b('0x31')]['sort']);_0x2ffdfa[_0x640b('0x3b')]=qs[_0x640b('0x3c')](_[_0x640b('0x3d')](_0x5f03c2[_0x640b('0x31')],_0x5735d5[_0x640b('0x3c')]),_0x1f4967);if(_0x5f03c2[_0x640b('0x31')]['filter']){_0x2ffdfa[_0x640b('0x3b')]=_[_0x640b('0x3e')](_0x2ffdfa[_0x640b('0x3b')],{'$or':_[_0x640b('0x2a')](_0x1f4967,function(_0x2a0072){if(_0x2a0072[_0x640b('0x2e')]!==_0x640b('0x3f')){var _0x4aeb56={};_0x4aeb56[_0x2a0072[_0x640b('0x28')]]={'$like':'%'+_0x5f03c2[_0x640b('0x31')][_0x640b('0x40')]+'%'};return _0x4aeb56;}})});}_0x2ffdfa=_[_0x640b('0x3e')]({},_0x2ffdfa,_0x5f03c2[_0x640b('0x41')]);var _0xb5c855={'where':_0x2ffdfa[_0x640b('0x3b')]};return db[_0x640b('0x2b')][_0x640b('0x1f')](_0xb5c855)['then'](function(_0x29fa59){_0x217719[_0x640b('0x1f')]=_0x29fa59;if(_0x5f03c2[_0x640b('0x31')][_0x640b('0x42')]){_0x2ffdfa[_0x640b('0x43')]=[{'all':!![]}];}return db[_0x640b('0x2b')][_0x640b('0x44')](_0x2ffdfa);})[_0x640b('0x25')](function(_0x4cc6b0){_0x217719[_0x640b('0x45')]=_0x4cc6b0;return _0x217719;})[_0x640b('0x25')](respondWithFilteredResult(_0x1565b5,_0x2ffdfa))[_0x640b('0x46')](handleError(_0x1565b5,null));};exports[_0x640b('0x47')]=function(_0x44c8ac,_0x61c4ac){var _0x3c47a1={'raw':!![],'where':{'id':_0x44c8ac[_0x640b('0x48')]['id']}},_0x36d169={};_0x36d169['model']=_[_0x640b('0x32')](db[_0x640b('0x2b')][_0x640b('0x2c')]);_0x36d169[_0x640b('0x31')]=_[_0x640b('0x32')](_0x44c8ac[_0x640b('0x31')]);_0x36d169[_0x640b('0x3c')]=_[_0x640b('0x33')](_0x36d169['model'],_0x36d169['query']);_0x3c47a1[_0x640b('0x35')]=_['intersection'](_0x36d169[_0x640b('0x30')],qs[_0x640b('0x34')](_0x44c8ac[_0x640b('0x31')][_0x640b('0x34')]));_0x3c47a1[_0x640b('0x35')]=_0x3c47a1[_0x640b('0x35')][_0x640b('0x36')]?_0x3c47a1[_0x640b('0x35')]:_0x36d169[_0x640b('0x30')];if(_0x44c8ac[_0x640b('0x31')][_0x640b('0x42')]){_0x3c47a1[_0x640b('0x43')]=[{'all':!![]}];}_0x3c47a1=_[_0x640b('0x3e')]({},_0x3c47a1,_0x44c8ac['options']);return db[_0x640b('0x2b')][_0x640b('0x49')](_0x3c47a1)[_0x640b('0x25')](handleEntityNotFound(_0x61c4ac,null))['then'](respondWithResult(_0x61c4ac,null))['catch'](handleError(_0x61c4ac,null));};exports[_0x640b('0x4a')]=function(_0x1efff2,_0x160b86){return db['ChatInternalMessage'][_0x640b('0x4a')](_0x1efff2[_0x640b('0x4b')],{})['then'](respondWithResult(_0x160b86,0xc9))['catch'](handleError(_0x160b86,null));};exports[_0x640b('0x24')]=function(_0x4db7f2,_0x4e1ad9){if(_0x4db7f2[_0x640b('0x4b')]['id']){delete _0x4db7f2[_0x640b('0x4b')]['id'];}return db[_0x640b('0x2b')][_0x640b('0x49')]({'where':{'id':_0x4db7f2[_0x640b('0x48')]['id']}})[_0x640b('0x25')](handleEntityNotFound(_0x4e1ad9,null))['then'](saveUpdates(_0x4db7f2[_0x640b('0x4b')],null))['then'](respondWithResult(_0x4e1ad9,null))[_0x640b('0x46')](handleError(_0x4e1ad9,null));};exports[_0x640b('0x26')]=function(_0x5d27d8,_0x18fb29){return db['ChatInternalMessage'][_0x640b('0x49')]({'where':{'id':_0x5d27d8[_0x640b('0x48')]['id']}})[_0x640b('0x25')](handleEntityNotFound(_0x18fb29,null))[_0x640b('0x25')](removeEntity(_0x18fb29,null))['catch'](handleError(_0x18fb29,null));};exports['describe']=function(_0x45fe39,_0x8a2f18){return db[_0x640b('0x2b')][_0x640b('0x4c')]()['then'](respondWithResult(_0x8a2f18,null))['catch'](handleError(_0x8a2f18,null));};function wrapUser(_0x1261e9){return function(_0x320d38){var _0x26623f=_0x1261e9['get']({'plain':!![]});_0x26623f[_0x640b('0x4d')]=[];if(_0x320d38){_0x26623f[_0x640b('0x4e')]=_0x320d38[_0x640b('0x4f')];_0x26623f[_0x640b('0x50')]=_0x320d38;}else{_0x26623f[_0x640b('0x4e')]=moment(0x0)[_0x640b('0x51')](_0x640b('0x52'));_0x26623f[_0x640b('0x50')]={};}return _0x26623f;};}exports['getUsers']=function(_0x56cb72,_0x1f4e7e,_0x7cc934){var _0x1b3333=[];return db['User'][_0x640b('0x44')]({'where':{'role':[_0x640b('0x53'),_0x640b('0x54'),_0x640b('0x55')]},'attributes':['id',_0x640b('0x56'),_0x640b('0x28'),_0x640b('0x57'),'userpic',_0x640b('0x58'),'online',_0x640b('0x59'),_0x640b('0x5a'),_0x640b('0x5b')],'order':qs['sort'](_0x640b('0x5c')),'include':[{'model':db[_0x640b('0x5d')],'as':'VoiceQueues','attributes':['id','name',_0x640b('0x2e')],'through':{'attributes':[]}}]})[_0x640b('0x25')](function(_0x4c845f){if(_0x4c845f){var _0x189900=_0x56cb72[_0x640b('0x55')][_0x640b('0x5e')]({'plain':!![]});if(!_0x189900)throw new Error(_0x640b('0x5f'));if(_0x189900['role']===_0x640b('0x55')){return db[_0x640b('0x60')][_0x640b('0x49')]({'where':{'name':'Agents','userProfileId':_0x189900[_0x640b('0x61')]},'raw':!![]})[_0x640b('0x25')](function(_0xb23bae){if(_0xb23bae){if(_0xb23bae[_0x640b('0x62')]===0x0){return db[_0x640b('0x63')][_0x640b('0x44')]({'where':{'sectionId':_0xb23bae['id']},'raw':!![]})['then'](function(_0x4e6bd0){var _0x1159e3=[];if(_['isEmpty'](_0x4e6bd0)){_0x1159e3=_[_0x640b('0x40')](_0x4c845f,function(_0x5ece27){if(_0x5ece27['role']!==_0x640b('0x53')){return _0x5ece27;}});return _0x1159e3;}else{for(var _0x219f5b=0x0;_0x219f5b<_0x4c845f[_0x640b('0x36')];_0x219f5b++){var _0x4db4af=_0x4c845f[_0x219f5b];if(_0x4db4af[_0x640b('0x57')]==='agent'){var _0x26e1b7=_[_0x640b('0x49')](_0x4e6bd0,function(_0x162c78){return _0x162c78[_0x640b('0x64')]===_0x4db4af['id'];});if(_0x26e1b7)_0x1159e3['push'](_0x4db4af);}else{_0x1159e3[_0x640b('0x65')](_0x4db4af);}}return _0x1159e3;}});}else{return _0x4c845f;}}else{var _0x126332=_['filter'](_0x4c845f,function(_0x2292a3){if(_0x2292a3['role']!=='agent'){return _0x2292a3;}});return _0x126332;}});}else{return _0x4c845f;}}})[_0x640b('0x25')](function(_0x4ba5f9){var _0x144d66=[];if(_0x4ba5f9){_0x1b3333=_0x4ba5f9;for(var _0x405e0c=0x0;_0x405e0c<_0x4ba5f9['length'];_0x405e0c+=0x1){_0x1b3333[_0x405e0c][_0x640b('0x4d')]=[];_0x144d66['push'](db[_0x640b('0x2b')][_0x640b('0x49')]({'where':{'FromId':[_0x56cb72[_0x640b('0x55')]['id'],_0x4ba5f9[_0x405e0c]['id']],'ToId':[_0x56cb72['user']['id'],_0x4ba5f9[_0x405e0c]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x640b('0x66'),_0x640b('0x67'),_0x640b('0x68'),'body'],'order':qs[_0x640b('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x640b('0x25')](wrapUser(_0x4ba5f9[_0x405e0c])));}return BPromise['all'](_0x144d66);}return[];})[_0x640b('0x25')](function(_0x1b1326){return{'rows':_0x1b1326,'count':_0x1b1326['length']};})[_0x640b('0x25')](respondWithResult(_0x1f4e7e,null))[_0x640b('0x46')](handleError(_0x1f4e7e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index fe3a0a3..fe54d19 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 _0xe033=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d1f9c,_0x26717d){var _0x41f2f9=function(_0x29a17a){while(--_0x29a17a){_0x4d1f9c['push'](_0x4d1f9c['shift']());}};_0x41f2f9(++_0x26717d);}(_0xe033,0x103));var _0x3e03=function(_0x179ed3,_0x4053c6){_0x179ed3=_0x179ed3-0x0;var _0x519142=_0xe033[_0x179ed3];return _0x519142;};'use strict';var EventEmitter=require(_0x3e03('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x3e03('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3e03('0x2')](0x0);var events={'afterCreate':_0x3e03('0x3'),'afterUpdate':_0x3e03('0x4'),'afterDestroy':_0x3e03('0x5')};function emitEvent(_0x59f3b6){return function(_0x4a1bdc,_0x55c95d,_0x51527b){ChatInternalMessageEvents[_0x3e03('0x6')](_0x59f3b6+':'+_0x4a1bdc['id'],_0x4a1bdc);ChatInternalMessageEvents[_0x3e03('0x6')](_0x59f3b6,_0x4a1bdc);_0x51527b(null);};}for(var e in events){if(events[_0x3e03('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3e03('0x8')](e,emitEvent(event));}}module[_0x3e03('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8eb3=['save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x185182,_0x5d4736){var _0x1d235e=function(_0x157a96){while(--_0x157a96){_0x185182['push'](_0x185182['shift']());}};_0x1d235e(++_0x5d4736);}(_0x8eb3,0x8b));var _0x38eb=function(_0x26ecfa,_0x59ca40){_0x26ecfa=_0x26ecfa-0x0;var _0x2ee323=_0x8eb3[_0x26ecfa];return _0x2ee323;};'use strict';var EventEmitter=require(_0x38eb('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x38eb('0x1'),'afterUpdate':_0x38eb('0x2'),'afterDestroy':_0x38eb('0x3')};function emitEvent(_0x235b87){return function(_0x499f4c,_0x2f72aa,_0x405c62){ChatInternalMessageEvents[_0x38eb('0x4')](_0x235b87+':'+_0x499f4c['id'],_0x499f4c);ChatInternalMessageEvents[_0x38eb('0x4')](_0x235b87,_0x499f4c);_0x405c62(null);};}for(var e in events){if(events[_0x38eb('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x38eb('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cf16cde..29f6fbe 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 _0xe993=['request-promise','path','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x58fbd1,_0x125b4d){var _0x458d81=function(_0x22eb6d){while(--_0x22eb6d){_0x58fbd1['push'](_0x58fbd1['shift']());}};_0x458d81(++_0x125b4d);}(_0xe993,0x7e));var _0x3e99=function(_0x5972d4,_0x57f10f){_0x5972d4=_0x5972d4-0x0;var _0x523b3f=_0xe993[_0x5972d4];return _0x523b3f;};'use strict';var _=require(_0x3e99('0x0'));var util=require('util');var logger=require(_0x3e99('0x1'))(_0x3e99('0x2'));var moment=require('moment');var BPromise=require(_0x3e99('0x3'));var rp=require(_0x3e99('0x4'));var fs=require('fs');var path=require(_0x3e99('0x5'));var rimraf=require(_0x3e99('0x6'));var config=require(_0x3e99('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x3e99('0x8')]=function(_0x34846e,_0x8667b8){return _0x34846e[_0x3e99('0x9')](_0x3e99('0xa'),attributes,{'tableName':_0x3e99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3e99('0xc')});}; \ No newline at end of file +var _0x7648=['api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger'];(function(_0x309bc1,_0x580f7c){var _0x89876=function(_0x3b7b52){while(--_0x3b7b52){_0x309bc1['push'](_0x309bc1['shift']());}};_0x89876(++_0x580f7c);}(_0x7648,0x1bd));var _0x8764=function(_0x35980d,_0xf1fec9){_0x35980d=_0x35980d-0x0;var _0xe865ec=_0x7648[_0x35980d];return _0xe865ec;};'use strict';var _=require(_0x8764('0x0'));var util=require(_0x8764('0x1'));var logger=require(_0x8764('0x2'))(_0x8764('0x3'));var moment=require(_0x8764('0x4'));var BPromise=require(_0x8764('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8764('0x6'));var rimraf=require(_0x8764('0x7'));var config=require(_0x8764('0x8'));var attributes=require(_0x8764('0x9'));module['exports']=function(_0xd6df37,_0x23c7b2){return _0xd6df37[_0x8764('0xa')](_0x8764('0xb'),attributes,{'tableName':_0x8764('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8764('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 296cab5..3f03dbb 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 _0x279c=['socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x20cf60,_0x19e3a9){var _0x3b28e7=function(_0x22c132){while(--_0x22c132){_0x20cf60['push'](_0x20cf60['shift']());}};_0x3b28e7(++_0x19e3a9);}(_0x279c,0x193));var _0xc279=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x279c[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xc279('0x0'));var util=require(_0xc279('0x1'));var moment=require(_0xc279('0x2'));var BPromise=require(_0xc279('0x3'));var rs=require(_0xc279('0x4'));var fs=require('fs');var Redis=require(_0xc279('0x5'));var db=require(_0xc279('0x6'))['db'];var utils=require(_0xc279('0x7'));var logger=require(_0xc279('0x8'))(_0xc279('0x9'));var config=require(_0xc279('0xa'));var jayson=require(_0xc279('0xb'));var client=jayson[_0xc279('0xc')][_0xc279('0xd')]({'port':0x232a});config['redis']=_[_0xc279('0xe')](config[_0xc279('0xf')],{'host':_0xc279('0x10'),'port':0x18eb});var socket=require(_0xc279('0x11'))(new Redis(config[_0xc279('0xf')]));require(_0xc279('0x12'))[_0xc279('0x13')](socket);function respondWithRpcPromise(_0x5371ea,_0x44776d,_0x4e4311){return new BPromise(function(_0x3deec0,_0x14e36b){return client['request'](_0x5371ea,_0x4e4311)[_0xc279('0x14')](function(_0x1f6844){logger[_0xc279('0x15')](_0xc279('0x16'),_0x44776d,_0xc279('0x17'));logger['debug'](_0xc279('0x18'),_0x44776d,_0xc279('0x17'),JSON[_0xc279('0x19')](_0x1f6844));if(_0x1f6844[_0xc279('0x1a')]){if(_0x1f6844['error']['code']===0x1f4){logger[_0xc279('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x44776d,_0x1f6844[_0xc279('0x1a')][_0xc279('0x1b')]);return _0x14e36b(_0x1f6844[_0xc279('0x1a')][_0xc279('0x1b')]);}logger[_0xc279('0x1a')](_0xc279('0x16'),_0x44776d,_0x1f6844[_0xc279('0x1a')][_0xc279('0x1b')]);return _0x3deec0(_0x1f6844[_0xc279('0x1a')]['message']);}else{logger[_0xc279('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x44776d,_0xc279('0x17'));_0x3deec0(_0x1f6844[_0xc279('0x1c')][_0xc279('0x1b')]);}})[_0xc279('0x1d')](function(_0x2549f9){logger[_0xc279('0x1a')](_0xc279('0x16'),_0x44776d,_0x2549f9);_0x14e36b(_0x2549f9);});});} \ No newline at end of file +var _0x76b9=['stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x38accc,_0x4b92df){var _0x5ee815=function(_0x477000){while(--_0x477000){_0x38accc['push'](_0x38accc['shift']());}};_0x5ee815(++_0x4b92df);}(_0x76b9,0x12f));var _0x976b=function(_0xa7c2b4,_0x451a6b){_0xa7c2b4=_0xa7c2b4-0x0;var _0x165e16=_0x76b9[_0xa7c2b4];return _0x165e16;};'use strict';var _=require('lodash');var util=require(_0x976b('0x0'));var moment=require(_0x976b('0x1'));var BPromise=require(_0x976b('0x2'));var rs=require(_0x976b('0x3'));var fs=require('fs');var Redis=require(_0x976b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x976b('0x5'));var logger=require(_0x976b('0x6'))(_0x976b('0x7'));var config=require(_0x976b('0x8'));var jayson=require(_0x976b('0x9'));var client=jayson['client'][_0x976b('0xa')]({'port':0x232a});config['redis']=_[_0x976b('0xb')](config['redis'],{'host':_0x976b('0xc'),'port':0x18eb});var socket=require(_0x976b('0xd'))(new Redis(config[_0x976b('0xe')]));require(_0x976b('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fe685,_0x1fca5b,_0xc23000){return new BPromise(function(_0xccedc5,_0x3193b4){return client[_0x976b('0x10')](_0x3fe685,_0xc23000)['then'](function(_0x2d0d4b){logger['info'](_0x976b('0x11'),_0x1fca5b,_0x976b('0x12'));logger[_0x976b('0x13')](_0x976b('0x14'),_0x1fca5b,_0x976b('0x12'),JSON[_0x976b('0x15')](_0x2d0d4b));if(_0x2d0d4b[_0x976b('0x16')]){if(_0x2d0d4b[_0x976b('0x16')][_0x976b('0x17')]===0x1f4){logger[_0x976b('0x16')](_0x976b('0x11'),_0x1fca5b,_0x2d0d4b[_0x976b('0x16')][_0x976b('0x18')]);return _0x3193b4(_0x2d0d4b[_0x976b('0x16')]['message']);}logger[_0x976b('0x16')](_0x976b('0x11'),_0x1fca5b,_0x2d0d4b[_0x976b('0x16')]['message']);return _0xccedc5(_0x2d0d4b['error']['message']);}else{logger[_0x976b('0x19')](_0x976b('0x11'),_0x1fca5b,'request\x20sent');_0xccedc5(_0x2d0d4b['result'][_0x976b('0x18')]);}})[_0x976b('0x1a')](function(_0x31340e){logger['error'](_0x976b('0x11'),_0x1fca5b,_0x31340e);_0x3193b4(_0x31340e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7c45bd4..aba6e76 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 _0x5d03=['removeListener','register','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x24d711,_0x3cdb28){var _0x3491b4=function(_0xd5957e){while(--_0xd5957e){_0x24d711['push'](_0x24d711['shift']());}};_0x3491b4(++_0x3cdb28);}(_0x5d03,0x1e5));var _0x35d0=function(_0x1d8cf1,_0x37194c){_0x1d8cf1=_0x1d8cf1-0x0;var _0x2ec0db=_0x5d03[_0x1d8cf1];return _0x2ec0db;};'use strict';var ChatInternalMessageEvents=require(_0x35d0('0x0'));var events=[_0x35d0('0x1'),_0x35d0('0x2'),_0x35d0('0x3')];function createListener(_0x479b6f,_0x29944e){return function(_0x4fe0f8){_0x29944e[_0x35d0('0x4')](_0x479b6f,_0x4fe0f8);};}function removeListener(_0x2334bb,_0x37985d){return function(){ChatInternalMessageEvents[_0x35d0('0x5')](_0x2334bb,_0x37985d);};}exports[_0x35d0('0x6')]=function(_0xcc5978){for(var _0x3f32c9=0x0,_0x2a4f3d=events['length'];_0x3f32c9<_0x2a4f3d;_0x3f32c9++){var _0x3240b1=events[_0x3f32c9];var _0x2ca706=createListener('chatInternalMessage:'+_0x3240b1,_0xcc5978);ChatInternalMessageEvents['on'](_0x3240b1,_0x2ca706);}}; \ No newline at end of file +var _0x98d4=['removeListener','register','length','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98d4,0xd3));var _0x498d=function(_0x38cd94,_0x28b7ba){_0x38cd94=_0x38cd94-0x0;var _0x21d210=_0x98d4[_0x38cd94];return _0x21d210;};'use strict';var ChatInternalMessageEvents=require(_0x498d('0x0'));var events=[_0x498d('0x1'),_0x498d('0x2'),_0x498d('0x3')];function createListener(_0x163052,_0x25ef28){return function(_0x78f9fa){_0x25ef28[_0x498d('0x4')](_0x163052,_0x78f9fa);};}function removeListener(_0x23a80c,_0x196e78){return function(){ChatInternalMessageEvents[_0x498d('0x5')](_0x23a80c,_0x196e78);};}exports[_0x498d('0x6')]=function(_0x37de25){for(var _0x51b8d0=0x0,_0x21be3d=events[_0x498d('0x7')];_0x51b8d0<_0x21be3d;_0x51b8d0++){var _0x1b8b98=events[_0x51b8d0];var _0x364708=createListener('chatInternalMessage:'+_0x1b8b98,_0x37de25);ChatInternalMessageEvents['on'](_0x1b8b98,_0x364708);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c733e7c..4771366 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 _0x076c=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','describe','/users','getUsers','show','post','create','put','/:id'];(function(_0x45bc68,_0x2eb526){var _0x207294=function(_0x43c964){while(--_0x43c964){_0x45bc68['push'](_0x45bc68['shift']());}};_0x207294(++_0x2eb526);}(_0x076c,0x93));var _0xc076=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x076c[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0xc076('0x0'));var util=require(_0xc076('0x1'));var path=require(_0xc076('0x2'));var timeout=require(_0xc076('0x3'));var express=require('express');var router=express[_0xc076('0x4')]();var fs_extra=require(_0xc076('0x5'));var auth=require(_0xc076('0x6'));var interaction=require(_0xc076('0x7'));var config=require(_0xc076('0x8'));var controller=require(_0xc076('0x9'));router['get']('/',auth[_0xc076('0xa')](),controller[_0xc076('0xb')]);router[_0xc076('0xc')]('/describe',auth[_0xc076('0xa')](),controller[_0xc076('0xd')]);router[_0xc076('0xc')](_0xc076('0xe'),auth[_0xc076('0xa')](),controller[_0xc076('0xf')]);router[_0xc076('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc076('0x10')]);router[_0xc076('0x11')]('/',auth[_0xc076('0xa')](),controller[_0xc076('0x12')]);router[_0xc076('0x13')](_0xc076('0x14'),controller[_0xc076('0x15')]);router['delete'](_0xc076('0x14'),auth[_0xc076('0xa')](),controller[_0xc076('0x16')]);module[_0xc076('0x17')]=router; \ No newline at end of file +var _0x12db=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','getUsers','/:id','show','post'];(function(_0x14766d,_0x5282d4){var _0x4890e6=function(_0x5c95e4){while(--_0x5c95e4){_0x14766d['push'](_0x14766d['shift']());}};_0x4890e6(++_0x5282d4);}(_0x12db,0x15f));var _0xb12d=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x12db[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0xb12d('0x0'));var util=require(_0xb12d('0x1'));var path=require(_0xb12d('0x2'));var timeout=require(_0xb12d('0x3'));var express=require(_0xb12d('0x4'));var router=express['Router']();var fs_extra=require(_0xb12d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb12d('0x6'));var config=require('../../config/environment');var controller=require(_0xb12d('0x7'));router[_0xb12d('0x8')]('/',auth['isAuthenticated'](),controller[_0xb12d('0x9')]);router[_0xb12d('0x8')](_0xb12d('0xa'),auth[_0xb12d('0xb')](),controller[_0xb12d('0xc')]);router[_0xb12d('0x8')]('/users',auth['isAuthenticated'](),controller[_0xb12d('0xd')]);router[_0xb12d('0x8')](_0xb12d('0xe'),auth[_0xb12d('0xb')](),controller[_0xb12d('0xf')]);router[_0xb12d('0x10')]('/',auth['isAuthenticated'](),controller[_0xb12d('0x11')]);router[_0xb12d('0x12')](_0xb12d('0xe'),controller[_0xb12d('0x13')]);router[_0xb12d('0x14')](_0xb12d('0xe'),auth[_0xb12d('0xb')](),controller[_0xb12d('0x15')]);module[_0xb12d('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7253632..17ec718 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 _0x8f59=['medium','BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x471f7d,_0x59c86b){var _0x3088f1=function(_0x5e8ffa){while(--_0x5e8ffa){_0x471f7d['push'](_0x471f7d['shift']());}};_0x3088f1(++_0x59c86b);}(_0x8f59,0x11d));var _0x98f5=function(_0x269ac2,_0x139b30){_0x269ac2=_0x269ac2-0x0;var _0x288e11=_0x8f59[_0x269ac2];return _0x288e11;};'use strict';var Sequelize=require(_0x98f5('0x0'));module[_0x98f5('0x1')]={'body':{'type':Sequelize[_0x98f5('0x2')](_0x98f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x98f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x98f5('0x5')),'defaultValue':_0x98f5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x98f5('0x6')]},'providerName':{'type':Sequelize[_0x98f5('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7072=['exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x260696,_0x1fdb6a){var _0x2ef493=function(_0x58b7e0){while(--_0x58b7e0){_0x260696['push'](_0x260696['shift']());}};_0x2ef493(++_0x1fdb6a);}(_0x7072,0x138));var _0x2707=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x7072[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'body':{'type':Sequelize[_0x2707('0x1')](_0x2707('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2707('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2707('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x2707('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x2707('0x5')]},'providerResponse':{'type':Sequelize[_0x2707('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5cbb013..b18d8b3 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 _0x07a7=['isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','interface','motionChannel','rejectmessage','parse','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatMessage.socket','register','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ChatMessage','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','../../config/logger','chat-interactions','readAt','format','UserId','user','agent','get','ChatInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x07a7,0xa5));var _0x707a=function(_0x30e648,_0x3bd891){_0x30e648=_0x30e648-0x0;var _0x35aa77=_0x07a7[_0x30e648];return _0x35aa77;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x707a('0x0'));var jsonpatch=require(_0x707a('0x1'));var rp=require(_0x707a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x707a('0x3'));var util=require(_0x707a('0x4'));var path=require(_0x707a('0x5'));var sox=require(_0x707a('0x6'));var csv=require(_0x707a('0x7'));var ejs=require(_0x707a('0x8'));var fs=require('fs');var fs_extra=require(_0x707a('0x9'));var _=require(_0x707a('0xa'));var squel=require(_0x707a('0xb'));var crypto=require(_0x707a('0xc'));var jsforce=require(_0x707a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x707a('0x7'));var querystring=require(_0x707a('0xe'));var Papa=require(_0x707a('0xf'));var Redis=require(_0x707a('0x10'));var authService=require(_0x707a('0x11'));var qs=require(_0x707a('0x12'));var as=require(_0x707a('0x13'));var hardwareService=require(_0x707a('0x14'));var logger=require('../../config/logger')(_0x707a('0x15'));var utils=require(_0x707a('0x16'));var config=require(_0x707a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x707a('0x18'))['db'];config[_0x707a('0x19')]=_['defaults'](config[_0x707a('0x19')],{'host':_0x707a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x707a('0x19')]));require(_0x707a('0x1b'))[_0x707a('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x707a('0x1d')]({'port':0x232c});var client9002=jayson[_0x707a('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e50f0,_0x629711,_0x524a19,_0x52feec){return new BPromise(function(_0x1f3d44,_0x42d1f8){var _0x72d0a6=_0x52feec||client;return _0x72d0a6[_0x707a('0x1f')](_0x2e50f0,_0x524a19)[_0x707a('0x20')](function(_0x336f89){logger[_0x707a('0x21')](_0x707a('0x22'),_0x629711,'request\x20sent');logger[_0x707a('0x23')](_0x707a('0x24'),_0x629711,_0x707a('0x25'),JSON[_0x707a('0x26')](_0x336f89));if(_0x336f89['error']){if(_0x336f89[_0x707a('0x27')][_0x707a('0x28')]===0x1f4){logger['error'](_0x707a('0x22'),_0x629711,_0x336f89['error'][_0x707a('0x29')]);return _0x42d1f8(_0x336f89[_0x707a('0x27')][_0x707a('0x29')]);}logger[_0x707a('0x27')](_0x707a('0x22'),_0x629711,_0x336f89['error']['message']);return _0x1f3d44(_0x336f89[_0x707a('0x27')][_0x707a('0x29')]);}else{logger['info'](_0x707a('0x22'),_0x629711,_0x707a('0x25'));_0x1f3d44(_0x336f89[_0x707a('0x2a')][_0x707a('0x29')]);}})['catch'](function(_0x573511){logger['error']('ChatMessage,\x20%s,\x20%s',_0x629711,_0x573511);_0x42d1f8(_0x573511);});});}function respondWithStatusCode(_0x1db689,_0x130d74){_0x130d74=_0x130d74||0xcc;return function(_0x503cb0){if(_0x503cb0){return _0x1db689[_0x707a('0x2b')](_0x130d74);}return _0x1db689[_0x707a('0x2c')](_0x130d74)[_0x707a('0x2d')]();};}function respondWithResult(_0x15df4b,_0x26e817){_0x26e817=_0x26e817||0xc8;return function(_0x4c7ecc){if(_0x4c7ecc){return _0x15df4b[_0x707a('0x2c')](_0x26e817)[_0x707a('0x2e')](_0x4c7ecc);}};}function respondWithFilteredResult(_0x1a5b03,_0x1bcafa){return function(_0x3742b8){if(_0x3742b8){var _0x148631=typeof _0x1bcafa['offset']==='undefined'&&typeof _0x1bcafa[_0x707a('0x2f')]===_0x707a('0x30');var _0x5bd7fc=_0x3742b8[_0x707a('0x31')];var _0x3945cf=_0x148631?0x0:_0x1bcafa[_0x707a('0x32')];var _0x2c167b=_0x148631?_0x3742b8[_0x707a('0x31')]:_0x1bcafa[_0x707a('0x32')]+_0x1bcafa['limit'];var _0x255100;if(_0x2c167b>=_0x5bd7fc){_0x2c167b=_0x5bd7fc;_0x255100=0xc8;}else{_0x255100=0xce;}_0x1a5b03[_0x707a('0x2c')](_0x255100);return _0x1a5b03['set'](_0x707a('0x33'),_0x3945cf+'-'+_0x2c167b+'/'+_0x5bd7fc)['json'](_0x3742b8);}return null;};}function patchUpdates(_0x3ec178){return function(_0x4c25ba){try{jsonpatch[_0x707a('0x34')](_0x4c25ba,_0x3ec178,!![]);}catch(_0x4b99cb){return BPromise[_0x707a('0x35')](_0x4b99cb);}return _0x4c25ba[_0x707a('0x36')]();};}function saveUpdates(_0x2635d9,_0x48e69b){return function(_0x43571e){if(_0x43571e){return _0x43571e[_0x707a('0x37')](_0x2635d9)[_0x707a('0x20')](function(_0x96dc60){return _0x96dc60;});}return null;};}function removeEntity(_0x4b3660,_0x52b689){return function(_0x12c0bb){if(_0x12c0bb){return _0x12c0bb[_0x707a('0x38')]()[_0x707a('0x20')](function(){_0x4b3660['status'](0xcc)[_0x707a('0x2d')]();});}};}function handleEntityNotFound(_0x33699c,_0x4415dc){return function(_0x2fe57b){if(!_0x2fe57b){_0x33699c[_0x707a('0x2b')](0x194);}return _0x2fe57b;};}function handleError(_0x2ae050,_0x28becf){_0x28becf=_0x28becf||0x1f4;return function(_0x326118){logger[_0x707a('0x27')](_0x326118[_0x707a('0x39')]);if(_0x326118[_0x707a('0x3a')]){delete _0x326118['name'];}_0x2ae050[_0x707a('0x2c')](_0x28becf)['send'](_0x326118);};}exports[_0x707a('0x3b')]=function(_0x17466d,_0x5d8855){var _0x553092={},_0x531846={},_0x56d4cd={'count':0x0,'rows':[]};var _0x22d6a5=_[_0x707a('0x3c')](db['ChatMessage'][_0x707a('0x3d')],function(_0x5ec30d){return{'name':_0x5ec30d['fieldName'],'type':_0x5ec30d[_0x707a('0x3e')][_0x707a('0x3f')]};});_0x531846[_0x707a('0x40')]=_['map'](_0x22d6a5,_0x707a('0x3a'));_0x531846['query']=_[_0x707a('0x41')](_0x17466d['query']);_0x531846[_0x707a('0x42')]=_[_0x707a('0x43')](_0x531846[_0x707a('0x40')],_0x531846['query']);_0x553092[_0x707a('0x44')]=_[_0x707a('0x43')](_0x531846[_0x707a('0x40')],qs[_0x707a('0x45')](_0x17466d[_0x707a('0x46')][_0x707a('0x45')]));_0x553092[_0x707a('0x44')]=_0x553092['attributes']['length']?_0x553092[_0x707a('0x44')]:_0x531846[_0x707a('0x40')];if(!_0x17466d[_0x707a('0x46')][_0x707a('0x47')](_0x707a('0x48'))){_0x553092[_0x707a('0x2f')]=qs[_0x707a('0x2f')](_0x17466d[_0x707a('0x46')][_0x707a('0x2f')]);_0x553092[_0x707a('0x32')]=qs[_0x707a('0x32')](_0x17466d[_0x707a('0x46')][_0x707a('0x32')]);}_0x553092[_0x707a('0x49')]=qs['sort'](_0x17466d['query'][_0x707a('0x4a')]);_0x553092[_0x707a('0x4b')]=qs[_0x707a('0x42')](_['pick'](_0x17466d['query'],_0x531846[_0x707a('0x42')]),_0x22d6a5);if(_0x17466d[_0x707a('0x46')][_0x707a('0x4c')]){_0x553092[_0x707a('0x4b')]=_['merge'](_0x553092[_0x707a('0x4b')],{'$or':_['map'](_0x22d6a5,function(_0x20b7d7){if(_0x20b7d7[_0x707a('0x3e')]!=='VIRTUAL'){var _0x19b935={};_0x19b935[_0x20b7d7[_0x707a('0x3a')]]={'$like':'%'+_0x17466d[_0x707a('0x46')][_0x707a('0x4c')]+'%'};return _0x19b935;}})});}_0x553092=_[_0x707a('0x4d')]({},_0x553092,_0x17466d[_0x707a('0x4e')]);var _0x2579a7={'where':_0x553092[_0x707a('0x4b')]};return db[_0x707a('0x4f')][_0x707a('0x31')](_0x2579a7)[_0x707a('0x20')](function(_0x1bdac8){_0x56d4cd[_0x707a('0x31')]=_0x1bdac8;if(_0x17466d[_0x707a('0x46')][_0x707a('0x50')]){_0x553092[_0x707a('0x51')]=[{'all':!![]}];}return db[_0x707a('0x4f')][_0x707a('0x52')](_0x553092);})[_0x707a('0x20')](function(_0x24e82c){_0x56d4cd[_0x707a('0x53')]=_0x24e82c;return _0x56d4cd;})[_0x707a('0x20')](respondWithFilteredResult(_0x5d8855,_0x553092))[_0x707a('0x54')](handleError(_0x5d8855,null));};exports[_0x707a('0x55')]=function(_0x129c86,_0x570f4d){var _0x5d08bf={'raw':!![],'where':{'id':_0x129c86[_0x707a('0x56')]['id']}},_0x2a32f5={};_0x2a32f5['model']=_[_0x707a('0x41')](db[_0x707a('0x4f')][_0x707a('0x3d')]);_0x2a32f5['query']=_[_0x707a('0x41')](_0x129c86['query']);_0x2a32f5[_0x707a('0x42')]=_[_0x707a('0x43')](_0x2a32f5['model'],_0x2a32f5['query']);_0x5d08bf[_0x707a('0x44')]=_[_0x707a('0x43')](_0x2a32f5['model'],qs[_0x707a('0x45')](_0x129c86['query'][_0x707a('0x45')]));_0x5d08bf['attributes']=_0x5d08bf[_0x707a('0x44')][_0x707a('0x57')]?_0x5d08bf[_0x707a('0x44')]:_0x2a32f5[_0x707a('0x40')];if(_0x129c86[_0x707a('0x46')][_0x707a('0x50')]){_0x5d08bf['include']=[{'all':!![]}];}_0x5d08bf=_[_0x707a('0x4d')]({},_0x5d08bf,_0x129c86[_0x707a('0x4e')]);return db[_0x707a('0x4f')][_0x707a('0x58')](_0x5d08bf)[_0x707a('0x20')](handleEntityNotFound(_0x570f4d,null))[_0x707a('0x20')](respondWithResult(_0x570f4d,null))[_0x707a('0x54')](handleError(_0x570f4d,null));};exports[_0x707a('0x59')]=function(_0x1bc082,_0x5d4617){return db[_0x707a('0x4f')][_0x707a('0x59')](_0x1bc082['body'],{})[_0x707a('0x20')](respondWithResult(_0x5d4617,0xc9))[_0x707a('0x54')](handleError(_0x5d4617,null));};exports[_0x707a('0x37')]=function(_0x210e02,_0x1ad3a8){if(_0x210e02[_0x707a('0x5a')]['id']){delete _0x210e02['body']['id'];}return db['ChatMessage'][_0x707a('0x58')]({'where':{'id':_0x210e02[_0x707a('0x56')]['id']}})[_0x707a('0x20')](handleEntityNotFound(_0x1ad3a8,null))[_0x707a('0x20')](saveUpdates(_0x210e02['body'],null))[_0x707a('0x20')](respondWithResult(_0x1ad3a8,null))[_0x707a('0x54')](handleError(_0x1ad3a8,null));};exports[_0x707a('0x38')]=function(_0x45358f,_0x3ea43a){return db[_0x707a('0x4f')][_0x707a('0x58')]({'where':{'id':_0x45358f[_0x707a('0x56')]['id']}})[_0x707a('0x20')](handleEntityNotFound(_0x3ea43a,null))[_0x707a('0x20')](removeEntity(_0x3ea43a,null))['catch'](handleError(_0x3ea43a,null));};exports[_0x707a('0x5b')]=function(_0x4f81a6,_0x5678f5){return db[_0x707a('0x4f')]['describe']()[_0x707a('0x20')](respondWithResult(_0x5678f5,null))[_0x707a('0x54')](handleError(_0x5678f5,null));};var interaction_log=require(_0x707a('0x5c'))(_0x707a('0x5d'));exports['accept']=function(_0x156ddf,_0x4db9f1,_0x364e28){var _0x2c2759={'agent':{},'channel':'chat'};if(_0x156ddf[_0x707a('0x5a')]['id']){delete _0x156ddf[_0x707a('0x5a')]['id'];}_0x156ddf[_0x707a('0x5a')]['read']=!![];_0x156ddf['body'][_0x707a('0x5e')]=moment()[_0x707a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x156ddf[_0x707a('0x5a')][_0x707a('0x60')]=_0x156ddf[_0x707a('0x5a')][_0x707a('0x60')]||_0x156ddf[_0x707a('0x61')]['id'];_0x2c2759[_0x707a('0x62')]['id']=_0x156ddf[_0x707a('0x5a')][_0x707a('0x60')];return db[_0x707a('0x4f')][_0x707a('0x58')]({'where':{'id':_0x156ddf[_0x707a('0x56')]['id'],'UserId':null}})[_0x707a('0x20')](handleEntityNotFound(_0x4db9f1,null))['then'](saveUpdates(_0x156ddf['body'],null))['then'](function(_0x2b80f8){if(_0x2b80f8){_0x2c2759[_0x707a('0x29')]=_0x2b80f8[_0x707a('0x63')]({'plain':!![]});return db[_0x707a('0x64')][_0x707a('0x58')]({'where':{'id':_0x2b80f8['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4db9f1,null))[_0x707a('0x20')](function(_0x1a79c0){if(_0x1a79c0){return _0x1a79c0['update']({'UserId':_0x156ddf['body'][_0x707a('0x60')],'read1stAt':_[_0x707a('0x65')](_0x1a79c0[_0x707a('0x66')])?moment()[_0x707a('0x5f')](_0x707a('0x67')):undefined});}return null;})[_0x707a('0x20')](function(_0x5253e8){if(_0x5253e8){_0x2c2759[_0x707a('0x68')]=_0x5253e8[_0x707a('0x63')]({'plain':!![]});interaction_log[_0x707a('0x21')](_0x707a('0x69'),_0x156ddf[_0x707a('0x61')]['id'],_0x156ddf[_0x707a('0x61')][_0x707a('0x3a')],_0x156ddf[_0x707a('0x61')][_0x707a('0x6a')],_0x2c2759[_0x707a('0x68')]['id'],_0x156ddf[_0x707a('0x5a')]?JSON[_0x707a('0x26')](_0x156ddf['body']):_0x707a('0x6b'));return respondWithRpcPromise(_0x707a('0x6c'),_0x707a('0x6d'),_0x2c2759);}return null;})[_0x707a('0x20')](function(_0x36149a){var _0x31e27f=_0x707a('0x6e')+_0x36149a[_0x707a('0x29')][_0x707a('0x6f')];return db[_0x707a('0x70')][_0x707a('0x46')](_0x31e27f,{'type':db[_0x707a('0x71')]['QueryTypes'][_0x707a('0x72')],'raw':!![]})[_0x707a('0x20')](function(_0x4a6c97){return _0x4a6c97;});})['then'](function(_0x4de181){if(_0x4de181){_0x2c2759[_0x707a('0x29')][_0x707a('0x73')]=_0x4de181[0x0];if(!_0x156ddf['body'][_0x707a('0x60')])return;return db[_0x707a('0x74')]['find']({'where':{'id':_0x156ddf[_0x707a('0x5a')][_0x707a('0x60')],'role':_0x707a('0x62')},'attributes':['id',_0x707a('0x3a'),'fullname','email',_0x707a('0x75')],'raw':!![]});}return null;})['then'](function(_0xb9ba48){if(!_0xb9ba48)return null;_0x2c2759[_0x707a('0x29')][_0x707a('0x62')]=_0xb9ba48;return _0x2c2759;})['then'](function(_0x235129){if(_0x235129){if(_0x156ddf[_0x707a('0x5a')][_0x707a('0x76')]){_0x2c2759['message']['interface']=util[_0x707a('0x5f')](_0x707a('0x77'),_0x156ddf[_0x707a('0x61')][_0x707a('0x3a')]);_0x2c2759[_0x707a('0x29')]['channel']=_0x2c2759['channel'];_0x2c2759[_0x707a('0x29')]['motionChannel']=_0x2c2759[_0x707a('0x78')];_0x2c2759[_0x707a('0x29')][_0x707a('0x79')]='accept';return respondWithRpcPromise(_0x707a('0x7a'),_0x707a('0x7a'),{'event':_0x707a('0x7b'),'message':_[_0x707a('0x4d')](_0x2c2759[_0x707a('0x29')],JSON['parse'](_0x2c2759[_0x707a('0x68')][_0x707a('0x7c')]))},client9002)[_0x707a('0x20')](function(){return _0x2c2759;});}return _0x2c2759;}return null;})['then'](respondWithResult(_0x4db9f1,null))[_0x707a('0x54')](handleError(_0x4db9f1,null));};var interaction_log=require('../../config/logger')(_0x707a('0x5d'));exports['reject']=function(_0x93b2a6,_0x51884f,_0x5c6cab){var _0x37264b={'agent':{},'channel':'chat'};if(_0x93b2a6[_0x707a('0x5a')]['id']){delete _0x93b2a6['body']['id'];}_0x93b2a6[_0x707a('0x5a')][_0x707a('0x60')]=_0x93b2a6['body'][_0x707a('0x60')]||_0x93b2a6[_0x707a('0x61')]['id'];_0x37264b[_0x707a('0x62')]['id']=_0x93b2a6['body'][_0x707a('0x60')];return db[_0x707a('0x4f')][_0x707a('0x58')]({'where':{'id':_0x93b2a6['params']['id'],'UserId':null}})[_0x707a('0x20')](handleEntityNotFound(_0x51884f,null))[_0x707a('0x20')](function(_0x262d19){if(_0x262d19){_0x37264b['message']=_0x262d19[_0x707a('0x63')]({'plain':!![]});return db[_0x707a('0x64')][_0x707a('0x58')]({'where':{'id':_0x262d19[_0x707a('0x7d')]}});}return null;})[_0x707a('0x20')](handleEntityNotFound(_0x51884f,null))[_0x707a('0x20')](function(_0x3c431a){if(_0x3c431a){_0x37264b[_0x707a('0x68')]=_0x3c431a['get']({'plain':!![]});interaction_log[_0x707a('0x21')](_0x707a('0x7e'),_0x93b2a6[_0x707a('0x61')]['id'],_0x93b2a6[_0x707a('0x61')][_0x707a('0x3a')],_0x93b2a6[_0x707a('0x61')][_0x707a('0x6a')],_0x37264b['interaction']['id'],_0x93b2a6[_0x707a('0x5a')]?JSON[_0x707a('0x26')](_0x93b2a6[_0x707a('0x5a')]):_0x707a('0x6b'));return respondWithRpcPromise('RejectMessage',_0x707a('0x7f'),_0x37264b);}return null;})[_0x707a('0x20')](function(_0x2be271){var _0x1cf2ac=_0x707a('0x6e')+_0x2be271[_0x707a('0x29')][_0x707a('0x6f')];return db[_0x707a('0x70')]['query'](_0x1cf2ac,{'type':db[_0x707a('0x71')]['QueryTypes'][_0x707a('0x72')],'raw':!![]})[_0x707a('0x20')](function(_0x3932ac){return _0x3932ac;});})['then'](function(_0x2d3183){if(_0x2d3183){_0x37264b[_0x707a('0x29')][_0x707a('0x73')]=_0x2d3183[0x0];if(!_0x93b2a6[_0x707a('0x5a')][_0x707a('0x60')])return;return db['User']['find']({'where':{'id':_0x93b2a6[_0x707a('0x5a')][_0x707a('0x60')],'role':_0x707a('0x62')},'attributes':['id',_0x707a('0x3a'),_0x707a('0x80'),'email',_0x707a('0x75')],'raw':!![]});}return null;})[_0x707a('0x20')](function(_0x8c7ad0){if(!_0x8c7ad0)return null;_0x37264b[_0x707a('0x29')]['agent']=_0x8c7ad0;return _0x37264b;})['then'](function(_0x52983a){if(_0x52983a){_0x52983a[_0x707a('0x29')][_0x707a('0x81')]=util[_0x707a('0x5f')]('SIP/%s',_0x93b2a6[_0x707a('0x61')][_0x707a('0x3a')]);_0x52983a[_0x707a('0x29')][_0x707a('0x78')]=_0x37264b['channel'];_0x52983a[_0x707a('0x29')][_0x707a('0x82')]=_0x37264b[_0x707a('0x78')];_0x52983a[_0x707a('0x29')]['event']='reject';respondWithRpcPromise(_0x707a('0x7a'),_0x707a('0x7a'),{'event':_0x707a('0x83'),'message':_[_0x707a('0x4d')](_0x37264b['message'],JSON[_0x707a('0x84')](_0x37264b[_0x707a('0x68')][_0x707a('0x7c')]))},client9002);return _0x37264b;}return null;})[_0x707a('0x20')](respondWithResult(_0x51884f,null))[_0x707a('0x54')](handleError(_0x51884f,null));}; \ No newline at end of file +var _0x5c5f=['read','readAt','format','UserId','user','get','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','agent','manual','interface','channel','EventManager','parse','formData','reject','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','User','internal','motionChannel','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','show','fields','options','find','body','params','describe','chat-interactions','accept','chat'];(function(_0x2041a2,_0x713d3e){var _0xeddfd2=function(_0x4e6809){while(--_0x4e6809){_0x2041a2['push'](_0x2041a2['shift']());}};_0xeddfd2(++_0x713d3e);}(_0x5c5f,0xab));var _0xf5c5=function(_0x2e797e,_0x1b2d11){_0x2e797e=_0x2e797e-0x0;var _0x12a46b=_0x5c5f[_0x2e797e];return _0x12a46b;};'use strict';var emlformat=require(_0xf5c5('0x0'));var rimraf=require(_0xf5c5('0x1'));var zipdir=require(_0xf5c5('0x2'));var jsonpatch=require(_0xf5c5('0x3'));var rp=require(_0xf5c5('0x4'));var moment=require(_0xf5c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf5c5('0x6'));var util=require(_0xf5c5('0x7'));var path=require(_0xf5c5('0x8'));var sox=require('sox');var csv=require(_0xf5c5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5c5('0xa'));var _=require(_0xf5c5('0xb'));var squel=require(_0xf5c5('0xc'));var crypto=require('crypto');var jsforce=require(_0xf5c5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf5c5('0x9'));var querystring=require(_0xf5c5('0xe'));var Papa=require('papaparse');var Redis=require(_0xf5c5('0xf'));var authService=require(_0xf5c5('0x10'));var qs=require(_0xf5c5('0x11'));var as=require(_0xf5c5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5c5('0x13'))(_0xf5c5('0x14'));var utils=require(_0xf5c5('0x15'));var config=require(_0xf5c5('0x16'));var licenseUtil=require(_0xf5c5('0x17'));var db=require(_0xf5c5('0x18'))['db'];config[_0xf5c5('0x19')]=_['defaults'](config['redis'],{'host':_0xf5c5('0x1a'),'port':0x18eb});var socket=require(_0xf5c5('0x1b'))(new Redis(config[_0xf5c5('0x19')]));require(_0xf5c5('0x1c'))[_0xf5c5('0x1d')](socket);var jayson=require(_0xf5c5('0x1e'));var client=jayson['client'][_0xf5c5('0x1f')]({'port':0x232c});var client9002=jayson[_0xf5c5('0x20')][_0xf5c5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x8a6ac0,_0x3fad23,_0x647fb6,_0x1f449e){return new BPromise(function(_0x52a8f9,_0x4138bd){var _0x2e4300=_0x1f449e||client;return _0x2e4300[_0xf5c5('0x21')](_0x8a6ac0,_0x647fb6)[_0xf5c5('0x22')](function(_0x5c69cc){logger['info'](_0xf5c5('0x23'),_0x3fad23,'request\x20sent');logger['debug'](_0xf5c5('0x24'),_0x3fad23,_0xf5c5('0x25'),JSON['stringify'](_0x5c69cc));if(_0x5c69cc[_0xf5c5('0x26')]){if(_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x27')]===0x1f4){logger[_0xf5c5('0x26')](_0xf5c5('0x23'),_0x3fad23,_0x5c69cc['error'][_0xf5c5('0x28')]);return _0x4138bd(_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x28')]);}logger[_0xf5c5('0x26')](_0xf5c5('0x23'),_0x3fad23,_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x28')]);return _0x52a8f9(_0x5c69cc[_0xf5c5('0x26')][_0xf5c5('0x28')]);}else{logger[_0xf5c5('0x29')](_0xf5c5('0x23'),_0x3fad23,'request\x20sent');_0x52a8f9(_0x5c69cc['result']['message']);}})[_0xf5c5('0x2a')](function(_0x29476e){logger[_0xf5c5('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3fad23,_0x29476e);_0x4138bd(_0x29476e);});});}function respondWithStatusCode(_0x187ed6,_0x2076ff){_0x2076ff=_0x2076ff||0xcc;return function(_0x1e9eda){if(_0x1e9eda){return _0x187ed6[_0xf5c5('0x2b')](_0x2076ff);}return _0x187ed6[_0xf5c5('0x2c')](_0x2076ff)[_0xf5c5('0x2d')]();};}function respondWithResult(_0x57c75d,_0x41460b){_0x41460b=_0x41460b||0xc8;return function(_0x396525){if(_0x396525){return _0x57c75d[_0xf5c5('0x2c')](_0x41460b)[_0xf5c5('0x2e')](_0x396525);}};}function respondWithFilteredResult(_0x262586,_0x2ed282){return function(_0x3e825f){if(_0x3e825f){var _0x2da664=typeof _0x2ed282[_0xf5c5('0x2f')]==='undefined'&&typeof _0x2ed282[_0xf5c5('0x30')]===_0xf5c5('0x31');var _0x4783b5=_0x3e825f[_0xf5c5('0x32')];var _0x409e40=_0x2da664?0x0:_0x2ed282['offset'];var _0x35624f=_0x2da664?_0x3e825f[_0xf5c5('0x32')]:_0x2ed282[_0xf5c5('0x2f')]+_0x2ed282[_0xf5c5('0x30')];var _0x262116;if(_0x35624f>=_0x4783b5){_0x35624f=_0x4783b5;_0x262116=0xc8;}else{_0x262116=0xce;}_0x262586[_0xf5c5('0x2c')](_0x262116);return _0x262586[_0xf5c5('0x33')](_0xf5c5('0x34'),_0x409e40+'-'+_0x35624f+'/'+_0x4783b5)['json'](_0x3e825f);}return null;};}function patchUpdates(_0x323ad0){return function(_0xa7ca1b){try{jsonpatch[_0xf5c5('0x35')](_0xa7ca1b,_0x323ad0,!![]);}catch(_0x3d920a){return BPromise['reject'](_0x3d920a);}return _0xa7ca1b[_0xf5c5('0x36')]();};}function saveUpdates(_0x3da238,_0x1d1f6b){return function(_0xff3253){if(_0xff3253){return _0xff3253[_0xf5c5('0x37')](_0x3da238)['then'](function(_0x16c8ba){return _0x16c8ba;});}return null;};}function removeEntity(_0x1efe7d,_0x1378fe){return function(_0x4a6d57){if(_0x4a6d57){return _0x4a6d57[_0xf5c5('0x38')]()[_0xf5c5('0x22')](function(){_0x1efe7d[_0xf5c5('0x2c')](0xcc)[_0xf5c5('0x2d')]();});}};}function handleEntityNotFound(_0x58c2fe,_0x5209cf){return function(_0x5bfe2c){if(!_0x5bfe2c){_0x58c2fe['sendStatus'](0x194);}return _0x5bfe2c;};}function handleError(_0x4e038b,_0x444f30){_0x444f30=_0x444f30||0x1f4;return function(_0x3a9b53){logger['error'](_0x3a9b53[_0xf5c5('0x39')]);if(_0x3a9b53[_0xf5c5('0x3a')]){delete _0x3a9b53[_0xf5c5('0x3a')];}_0x4e038b[_0xf5c5('0x2c')](_0x444f30)['send'](_0x3a9b53);};}exports[_0xf5c5('0x3b')]=function(_0x2e1b6d,_0x5dc612){var _0x3c7ece={},_0x452efe={},_0x242a70={'count':0x0,'rows':[]};var _0x40e2bd=_[_0xf5c5('0x3c')](db[_0xf5c5('0x3d')][_0xf5c5('0x3e')],function(_0x2cc715){return{'name':_0x2cc715['fieldName'],'type':_0x2cc715[_0xf5c5('0x3f')][_0xf5c5('0x40')]};});_0x452efe[_0xf5c5('0x41')]=_[_0xf5c5('0x3c')](_0x40e2bd,_0xf5c5('0x3a'));_0x452efe['query']=_[_0xf5c5('0x42')](_0x2e1b6d[_0xf5c5('0x43')]);_0x452efe[_0xf5c5('0x44')]=_[_0xf5c5('0x45')](_0x452efe['model'],_0x452efe[_0xf5c5('0x43')]);_0x3c7ece[_0xf5c5('0x46')]=_[_0xf5c5('0x45')](_0x452efe[_0xf5c5('0x41')],qs['fields'](_0x2e1b6d['query']['fields']));_0x3c7ece[_0xf5c5('0x46')]=_0x3c7ece[_0xf5c5('0x46')][_0xf5c5('0x47')]?_0x3c7ece[_0xf5c5('0x46')]:_0x452efe[_0xf5c5('0x41')];if(!_0x2e1b6d['query'][_0xf5c5('0x48')](_0xf5c5('0x49'))){_0x3c7ece[_0xf5c5('0x30')]=qs[_0xf5c5('0x30')](_0x2e1b6d[_0xf5c5('0x43')][_0xf5c5('0x30')]);_0x3c7ece[_0xf5c5('0x2f')]=qs[_0xf5c5('0x2f')](_0x2e1b6d[_0xf5c5('0x43')]['offset']);}_0x3c7ece['order']=qs[_0xf5c5('0x4a')](_0x2e1b6d[_0xf5c5('0x43')][_0xf5c5('0x4a')]);_0x3c7ece[_0xf5c5('0x4b')]=qs['filters'](_[_0xf5c5('0x4c')](_0x2e1b6d['query'],_0x452efe['filters']),_0x40e2bd);if(_0x2e1b6d[_0xf5c5('0x43')][_0xf5c5('0x4d')]){_0x3c7ece[_0xf5c5('0x4b')]=_[_0xf5c5('0x4e')](_0x3c7ece[_0xf5c5('0x4b')],{'$or':_[_0xf5c5('0x3c')](_0x40e2bd,function(_0x13ca8b){if(_0x13ca8b['type']!==_0xf5c5('0x4f')){var _0x26d85f={};_0x26d85f[_0x13ca8b[_0xf5c5('0x3a')]]={'$like':'%'+_0x2e1b6d[_0xf5c5('0x43')]['filter']+'%'};return _0x26d85f;}})});}_0x3c7ece=_[_0xf5c5('0x4e')]({},_0x3c7ece,_0x2e1b6d['options']);var _0x242c5b={'where':_0x3c7ece['where']};return db[_0xf5c5('0x3d')][_0xf5c5('0x32')](_0x242c5b)['then'](function(_0x4e635c){_0x242a70[_0xf5c5('0x32')]=_0x4e635c;if(_0x2e1b6d['query'][_0xf5c5('0x50')]){_0x3c7ece['include']=[{'all':!![]}];}return db[_0xf5c5('0x3d')]['findAll'](_0x3c7ece);})[_0xf5c5('0x22')](function(_0x1ba072){_0x242a70['rows']=_0x1ba072;return _0x242a70;})[_0xf5c5('0x22')](respondWithFilteredResult(_0x5dc612,_0x3c7ece))['catch'](handleError(_0x5dc612,null));};exports[_0xf5c5('0x51')]=function(_0x57e9c7,_0x522089){var _0x426504={'raw':!![],'where':{'id':_0x57e9c7['params']['id']}},_0x353901={};_0x353901[_0xf5c5('0x41')]=_[_0xf5c5('0x42')](db[_0xf5c5('0x3d')][_0xf5c5('0x3e')]);_0x353901[_0xf5c5('0x43')]=_[_0xf5c5('0x42')](_0x57e9c7[_0xf5c5('0x43')]);_0x353901['filters']=_['intersection'](_0x353901[_0xf5c5('0x41')],_0x353901[_0xf5c5('0x43')]);_0x426504[_0xf5c5('0x46')]=_[_0xf5c5('0x45')](_0x353901[_0xf5c5('0x41')],qs['fields'](_0x57e9c7[_0xf5c5('0x43')][_0xf5c5('0x52')]));_0x426504[_0xf5c5('0x46')]=_0x426504[_0xf5c5('0x46')][_0xf5c5('0x47')]?_0x426504[_0xf5c5('0x46')]:_0x353901[_0xf5c5('0x41')];if(_0x57e9c7[_0xf5c5('0x43')][_0xf5c5('0x50')]){_0x426504['include']=[{'all':!![]}];}_0x426504=_[_0xf5c5('0x4e')]({},_0x426504,_0x57e9c7[_0xf5c5('0x53')]);return db[_0xf5c5('0x3d')][_0xf5c5('0x54')](_0x426504)[_0xf5c5('0x22')](handleEntityNotFound(_0x522089,null))['then'](respondWithResult(_0x522089,null))[_0xf5c5('0x2a')](handleError(_0x522089,null));};exports['create']=function(_0x461144,_0x1693a5){return db['ChatMessage']['create'](_0x461144[_0xf5c5('0x55')],{})[_0xf5c5('0x22')](respondWithResult(_0x1693a5,0xc9))['catch'](handleError(_0x1693a5,null));};exports[_0xf5c5('0x37')]=function(_0x2c71b5,_0x47d490){if(_0x2c71b5[_0xf5c5('0x55')]['id']){delete _0x2c71b5[_0xf5c5('0x55')]['id'];}return db[_0xf5c5('0x3d')][_0xf5c5('0x54')]({'where':{'id':_0x2c71b5[_0xf5c5('0x56')]['id']}})[_0xf5c5('0x22')](handleEntityNotFound(_0x47d490,null))[_0xf5c5('0x22')](saveUpdates(_0x2c71b5[_0xf5c5('0x55')],null))['then'](respondWithResult(_0x47d490,null))['catch'](handleError(_0x47d490,null));};exports[_0xf5c5('0x38')]=function(_0x24fb4c,_0x41f0c0){return db[_0xf5c5('0x3d')]['find']({'where':{'id':_0x24fb4c[_0xf5c5('0x56')]['id']}})['then'](handleEntityNotFound(_0x41f0c0,null))[_0xf5c5('0x22')](removeEntity(_0x41f0c0,null))[_0xf5c5('0x2a')](handleError(_0x41f0c0,null));};exports[_0xf5c5('0x57')]=function(_0x52570c,_0x301886){return db[_0xf5c5('0x3d')][_0xf5c5('0x57')]()[_0xf5c5('0x22')](respondWithResult(_0x301886,null))['catch'](handleError(_0x301886,null));};var interaction_log=require('../../config/logger')(_0xf5c5('0x58'));exports[_0xf5c5('0x59')]=function(_0x153733,_0x1c8d66,_0x3f35af){var _0x149f78={'agent':{},'channel':_0xf5c5('0x5a')};if(_0x153733[_0xf5c5('0x55')]['id']){delete _0x153733['body']['id'];}_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5b')]=!![];_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5c')]=moment()[_0xf5c5('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')]=_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')]||_0x153733[_0xf5c5('0x5f')]['id'];_0x149f78['agent']['id']=_0x153733[_0xf5c5('0x55')]['UserId'];return db[_0xf5c5('0x3d')][_0xf5c5('0x54')]({'where':{'id':_0x153733[_0xf5c5('0x56')]['id'],'UserId':null}})[_0xf5c5('0x22')](handleEntityNotFound(_0x1c8d66,null))['then'](saveUpdates(_0x153733[_0xf5c5('0x55')],null))['then'](function(_0x38d43c){if(_0x38d43c){_0x149f78[_0xf5c5('0x28')]=_0x38d43c[_0xf5c5('0x60')]({'plain':!![]});return db['ChatInteraction'][_0xf5c5('0x54')]({'where':{'id':_0x38d43c[_0xf5c5('0x61')]}});}return null;})[_0xf5c5('0x22')](handleEntityNotFound(_0x1c8d66,null))[_0xf5c5('0x22')](function(_0x21f0d3){if(_0x21f0d3){return _0x21f0d3[_0xf5c5('0x37')]({'UserId':_0x153733['body']['UserId'],'read1stAt':_[_0xf5c5('0x62')](_0x21f0d3['read1stAt'])?moment()[_0xf5c5('0x5d')](_0xf5c5('0x63')):undefined});}return null;})[_0xf5c5('0x22')](function(_0x49e5df){if(_0x49e5df){_0x149f78[_0xf5c5('0x64')]=_0x49e5df[_0xf5c5('0x60')]({'plain':!![]});interaction_log['info'](_0xf5c5('0x65'),_0x153733[_0xf5c5('0x5f')]['id'],_0x153733[_0xf5c5('0x5f')][_0xf5c5('0x3a')],_0x153733[_0xf5c5('0x5f')][_0xf5c5('0x66')],_0x149f78['interaction']['id'],_0x153733[_0xf5c5('0x55')]?JSON[_0xf5c5('0x67')](_0x153733[_0xf5c5('0x55')]):_0xf5c5('0x68'));return respondWithRpcPromise(_0xf5c5('0x69'),'acceptMessage',_0x149f78);}return null;})[_0xf5c5('0x22')](function(_0xd862dc){var _0x4eba44=_0xf5c5('0x6a')+_0xd862dc['message']['ContactId'];return db[_0xf5c5('0x6b')][_0xf5c5('0x43')](_0x4eba44,{'type':db[_0xf5c5('0x6c')][_0xf5c5('0x6d')][_0xf5c5('0x6e')],'raw':!![]})['then'](function(_0x238a6c){return _0x238a6c;});})[_0xf5c5('0x22')](function(_0x408c6f){if(_0x408c6f){_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x6f')]=_0x408c6f[0x0];if(!_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')])return;return db['User'][_0xf5c5('0x54')]({'where':{'id':_0x153733[_0xf5c5('0x55')][_0xf5c5('0x5e')],'role':'agent'},'attributes':['id',_0xf5c5('0x3a'),_0xf5c5('0x70'),_0xf5c5('0x71'),'internal'],'raw':!![]});}return null;})[_0xf5c5('0x22')](function(_0x58b8f0){if(!_0x58b8f0)return null;_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x72')]=_0x58b8f0;return _0x149f78;})[_0xf5c5('0x22')](function(_0x31c0a8){if(_0x31c0a8){if(_0x153733[_0xf5c5('0x55')][_0xf5c5('0x73')]){_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x74')]=util['format']('SIP/%s',_0x153733[_0xf5c5('0x5f')][_0xf5c5('0x3a')]);_0x149f78[_0xf5c5('0x28')][_0xf5c5('0x75')]=_0x149f78[_0xf5c5('0x75')];_0x149f78[_0xf5c5('0x28')]['motionChannel']=_0x149f78['channel'];_0x149f78[_0xf5c5('0x28')]['event']='accept';return respondWithRpcPromise('EventManager',_0xf5c5('0x76'),{'event':'acceptmessage','message':_['merge'](_0x149f78['message'],JSON[_0xf5c5('0x77')](_0x149f78[_0xf5c5('0x64')][_0xf5c5('0x78')]))},client9002)[_0xf5c5('0x22')](function(){return _0x149f78;});}return _0x149f78;}return null;})['then'](respondWithResult(_0x1c8d66,null))[_0xf5c5('0x2a')](handleError(_0x1c8d66,null));};var interaction_log=require(_0xf5c5('0x13'))(_0xf5c5('0x58'));exports[_0xf5c5('0x79')]=function(_0x3661de,_0x500eab,_0x5963df){var _0x561784={'agent':{},'channel':_0xf5c5('0x5a')};if(_0x3661de[_0xf5c5('0x55')]['id']){delete _0x3661de[_0xf5c5('0x55')]['id'];}_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')]=_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')]||_0x3661de[_0xf5c5('0x5f')]['id'];_0x561784[_0xf5c5('0x72')]['id']=_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')];return db[_0xf5c5('0x3d')][_0xf5c5('0x54')]({'where':{'id':_0x3661de[_0xf5c5('0x56')]['id'],'UserId':null}})[_0xf5c5('0x22')](handleEntityNotFound(_0x500eab,null))[_0xf5c5('0x22')](function(_0x190d35){if(_0x190d35){_0x561784[_0xf5c5('0x28')]=_0x190d35[_0xf5c5('0x60')]({'plain':!![]});return db[_0xf5c5('0x7a')][_0xf5c5('0x54')]({'where':{'id':_0x190d35['ChatInteractionId']}});}return null;})[_0xf5c5('0x22')](handleEntityNotFound(_0x500eab,null))['then'](function(_0x598dcd){if(_0x598dcd){_0x561784[_0xf5c5('0x64')]=_0x598dcd['get']({'plain':!![]});interaction_log[_0xf5c5('0x29')](_0xf5c5('0x7b'),_0x3661de[_0xf5c5('0x5f')]['id'],_0x3661de['user'][_0xf5c5('0x3a')],_0x3661de[_0xf5c5('0x5f')][_0xf5c5('0x66')],_0x561784[_0xf5c5('0x64')]['id'],_0x3661de[_0xf5c5('0x55')]?JSON['stringify'](_0x3661de[_0xf5c5('0x55')]):_0xf5c5('0x68'));return respondWithRpcPromise(_0xf5c5('0x7c'),'rejectMessage',_0x561784);}return null;})[_0xf5c5('0x22')](function(_0x5da05d){var _0x19f1a4=_0xf5c5('0x6a')+_0x5da05d[_0xf5c5('0x28')][_0xf5c5('0x7d')];return db[_0xf5c5('0x6b')]['query'](_0x19f1a4,{'type':db[_0xf5c5('0x6c')][_0xf5c5('0x6d')][_0xf5c5('0x6e')],'raw':!![]})[_0xf5c5('0x22')](function(_0xaf6605){return _0xaf6605;});})[_0xf5c5('0x22')](function(_0x3fbe5a){if(_0x3fbe5a){_0x561784[_0xf5c5('0x28')][_0xf5c5('0x6f')]=_0x3fbe5a[0x0];if(!_0x3661de[_0xf5c5('0x55')][_0xf5c5('0x5e')])return;return db[_0xf5c5('0x7e')][_0xf5c5('0x54')]({'where':{'id':_0x3661de['body'][_0xf5c5('0x5e')],'role':_0xf5c5('0x72')},'attributes':['id',_0xf5c5('0x3a'),_0xf5c5('0x70'),'email',_0xf5c5('0x7f')],'raw':!![]});}return null;})[_0xf5c5('0x22')](function(_0x44b47c){if(!_0x44b47c)return null;_0x561784[_0xf5c5('0x28')]['agent']=_0x44b47c;return _0x561784;})[_0xf5c5('0x22')](function(_0xe7fb07){if(_0xe7fb07){_0xe7fb07[_0xf5c5('0x28')]['interface']=util[_0xf5c5('0x5d')]('SIP/%s',_0x3661de[_0xf5c5('0x5f')]['name']);_0xe7fb07['message'][_0xf5c5('0x75')]=_0x561784[_0xf5c5('0x75')];_0xe7fb07[_0xf5c5('0x28')][_0xf5c5('0x80')]=_0x561784['channel'];_0xe7fb07[_0xf5c5('0x28')][_0xf5c5('0x81')]=_0xf5c5('0x79');respondWithRpcPromise(_0xf5c5('0x76'),'EventManager',{'event':_0xf5c5('0x82'),'message':_[_0xf5c5('0x4e')](_0x561784[_0xf5c5('0x28')],JSON[_0xf5c5('0x77')](_0x561784[_0xf5c5('0x64')][_0xf5c5('0x78')]))},client9002);return _0x561784;}return null;})[_0xf5c5('0x22')](respondWithResult(_0x500eab,null))['catch'](handleError(_0x500eab,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e099744..296baab 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 _0x98bd=['hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x26f49a,_0x3fcdab){var _0x562a27=function(_0x45bae8){while(--_0x45bae8){_0x26f49a['push'](_0x26f49a['shift']());}};_0x562a27(++_0x3fcdab);}(_0x98bd,0x14c));var _0xd98b=function(_0x3ad23e,_0x1fcf39){_0x3ad23e=_0x3ad23e-0x0;var _0x37365e=_0x98bd[_0x3ad23e];return _0x37365e;};'use strict';var EventEmitter=require(_0xd98b('0x0'));var ChatMessage=require(_0xd98b('0x1'))['db'][_0xd98b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd98b('0x3')](0x0);var events={'afterCreate':_0xd98b('0x4'),'afterUpdate':_0xd98b('0x5'),'afterDestroy':_0xd98b('0x6')};function emitEvent(_0x1225b5){return function(_0x3f17e3,_0x1da299,_0xd8de09){ChatMessageEvents['emit'](_0x1225b5+':'+_0x3f17e3['id'],_0x3f17e3);ChatMessageEvents[_0xd98b('0x7')](_0x1225b5,_0x3f17e3);_0xd8de09(null);};}for(var e in events){if(events[_0xd98b('0x8')](e)){var event=events[e];ChatMessage[_0xd98b('0x9')](e,emitEvent(event));}}module[_0xd98b('0xa')]=ChatMessageEvents; \ No newline at end of file +var _0xa64f=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4090e2,_0x3c77ee){var _0x44b887=function(_0x5eded2){while(--_0x5eded2){_0x4090e2['push'](_0x4090e2['shift']());}};_0x44b887(++_0x3c77ee);}(_0xa64f,0x1a0));var _0xfa64=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa64f[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xfa64('0x0'));var ChatMessage=require(_0xfa64('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfa64('0x2'),'afterUpdate':_0xfa64('0x3'),'afterDestroy':_0xfa64('0x4')};function emitEvent(_0x445d60){return function(_0x2824ea,_0xcd2b17,_0x401250){ChatMessageEvents[_0xfa64('0x5')](_0x445d60+':'+_0x2824ea['id'],_0x2824ea);ChatMessageEvents[_0xfa64('0x5')](_0x445d60,_0x2824ea);_0x401250(null);};}for(var e in events){if(events[_0xfa64('0x6')](e)){var event=events[e];ChatMessage[_0xfa64('0x7')](e,emitEvent(event));}}module[_0xfa64('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9d2ef39..199ca30 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 _0x9fa8=['./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x266900,_0x4a4773){var _0x29467d=function(_0x4599f5){while(--_0x4599f5){_0x266900['push'](_0x266900['shift']());}};_0x29467d(++_0x4a4773);}(_0x9fa8,0x12b));var _0x89fa=function(_0x31864d,_0x2225d9){_0x31864d=_0x31864d-0x0;var _0x42fcc6=_0x9fa8[_0x31864d];return _0x42fcc6;};'use strict';var _=require(_0x89fa('0x0'));var util=require(_0x89fa('0x1'));var logger=require(_0x89fa('0x2'))(_0x89fa('0x3'));var moment=require(_0x89fa('0x4'));var BPromise=require(_0x89fa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89fa('0x6'));var rimraf=require(_0x89fa('0x7'));var config=require(_0x89fa('0x8'));var attributes=require(_0x89fa('0x9'));module[_0x89fa('0xa')]=function(_0x27536a,_0x50fb85){return _0x27536a['define'](_0x89fa('0xb'),attributes,{'tableName':_0x89fa('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x89fa('0xd')],'type':_0x89fa('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d1e26,_0x2f81c9,_0x4a635c){var _0x1fa377=_0x27536a[_0x89fa('0xf')];var _0x419e68=_0x1d1e26['get']({'plain':!![]});if(_0x419e68[_0x89fa('0x10')][_0x89fa('0x11')]()==='in'||_0x419e68[_0x89fa('0x10')]['toLowerCase']()===_0x89fa('0x12')&&!_0x419e68[_0x89fa('0x13')]&&!_[_0x89fa('0x14')](_0x419e68['UserId'])){_0x1fa377[_0x89fa('0x15')][_0x89fa('0x16')]({'where':{'id':_0x419e68['ChatInteractionId']}})[_0x89fa('0x17')](function(_0xa8b64e){if(_0xa8b64e){_0xa8b64e['update']({'lastMsgAt':_0x419e68[_0x89fa('0x18')],'lastMsgDirection':_0x419e68[_0x89fa('0x10')][_0x89fa('0x11')]()});}})[_0x89fa('0x19')](function(_0x17c447){console['error'](_0x17c447);});}_0x4a635c();}},'charset':_0x89fa('0x1a'),'collate':_0x89fa('0x1b')});}; \ No newline at end of file +var _0x299d=['../../config/logger','api','moment','bluebird','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','secret','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x414d4e,_0x289528){var _0x339185=function(_0x3d700a){while(--_0x3d700a){_0x414d4e['push'](_0x414d4e['shift']());}};_0x339185(++_0x289528);}(_0x299d,0x168));var _0xd299=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x299d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd299('0x0'))(_0xd299('0x1'));var moment=require(_0xd299('0x2'));var BPromise=require(_0xd299('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd299('0x4'));module[_0xd299('0x5')]=function(_0x29b113,_0x4a6b4d){return _0x29b113[_0xd299('0x6')](_0xd299('0x7'),attributes,{'tableName':_0xd299('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xd299('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22c04a,_0x311ccc,_0x353215){var _0x26a6f0=_0x29b113[_0xd299('0xa')];var _0x5bef43=_0x22c04a[_0xd299('0xb')]({'plain':!![]});if(_0x5bef43[_0xd299('0xc')]['toLowerCase']()==='in'||_0x5bef43[_0xd299('0xc')][_0xd299('0xd')]()==='out'&&!_0x5bef43[_0xd299('0xe')]&&!_['isNil'](_0x5bef43['UserId'])){_0x26a6f0[_0xd299('0xf')][_0xd299('0x10')]({'where':{'id':_0x5bef43[_0xd299('0x11')]}})[_0xd299('0x12')](function(_0x228361){if(_0x228361){_0x228361[_0xd299('0x13')]({'lastMsgAt':_0x5bef43[_0xd299('0x14')],'lastMsgDirection':_0x5bef43[_0xd299('0xc')]['toLowerCase']()});}})[_0xd299('0x15')](function(_0x265f4e){console['error'](_0x265f4e);});}_0x353215();}},'charset':_0xd299('0x16'),'collate':_0xd299('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index a38a6fe..d455408 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 _0x8711=['client','http','redis','defaults','localhost','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatMessage','ChatMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ba97f,_0x2541fb){var _0x22299f=function(_0x636fb0){while(--_0x636fb0){_0x4ba97f['push'](_0x4ba97f['shift']());}};_0x22299f(++_0x2541fb);}(_0x8711,0x1de));var _0x1871=function(_0xa71605,_0x58763b){_0xa71605=_0xa71605-0x0;var _0x23587c=_0x8711[_0xa71605];return _0x23587c;};'use strict';var _=require(_0x1871('0x0'));var util=require(_0x1871('0x1'));var moment=require(_0x1871('0x2'));var BPromise=require(_0x1871('0x3'));var rs=require(_0x1871('0x4'));var fs=require('fs');var Redis=require(_0x1871('0x5'));var db=require(_0x1871('0x6'))['db'];var utils=require(_0x1871('0x7'));var logger=require(_0x1871('0x8'))(_0x1871('0x9'));var config=require(_0x1871('0xa'));var jayson=require(_0x1871('0xb'));var client=jayson[_0x1871('0xc')][_0x1871('0xd')]({'port':0x232a});config[_0x1871('0xe')]=_[_0x1871('0xf')](config[_0x1871('0xe')],{'host':_0x1871('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1871('0xe')]));require('./chatMessage.socket')[_0x1871('0x11')](socket);function respondWithRpcPromise(_0x14c677,_0x1e9961,_0x52a3b5){return new BPromise(function(_0x410a28,_0x186d1f){return client[_0x1871('0x12')](_0x14c677,_0x52a3b5)['then'](function(_0x4a986a){logger[_0x1871('0x13')](_0x1871('0x14'),_0x1e9961,_0x1871('0x15'));logger[_0x1871('0x16')](_0x1871('0x17'),_0x1e9961,_0x1871('0x15'),JSON[_0x1871('0x18')](_0x4a986a));if(_0x4a986a['error']){if(_0x4a986a[_0x1871('0x19')][_0x1871('0x1a')]===0x1f4){logger[_0x1871('0x19')](_0x1871('0x14'),_0x1e9961,_0x4a986a[_0x1871('0x19')][_0x1871('0x1b')]);return _0x186d1f(_0x4a986a[_0x1871('0x19')][_0x1871('0x1b')]);}logger[_0x1871('0x19')](_0x1871('0x14'),_0x1e9961,_0x4a986a['error'][_0x1871('0x1b')]);return _0x410a28(_0x4a986a[_0x1871('0x19')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x1e9961,'request\x20sent');_0x410a28(_0x4a986a['result'][_0x1871('0x1b')]);}})['catch'](function(_0x277f65){logger[_0x1871('0x19')](_0x1871('0x14'),_0x1e9961,_0x277f65);_0x186d1f(_0x277f65);});});}exports[_0x1871('0x1c')]=function(_0x40b097){var _0x23852f=this;return new Promise(function(_0xf76ec7,_0x5ccf95){return db[_0x1871('0x1d')][_0x1871('0x1e')](_0x40b097[_0x1871('0x1f')],{'raw':_0x40b097['options']?_0x40b097[_0x1871('0x20')][_0x1871('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x1818e3){logger[_0x1871('0x13')](_0x1871('0x1c'),_0x40b097);logger[_0x1871('0x16')]('CreateChatMessage',_0x40b097,JSON[_0x1871('0x18')](_0x1818e3));_0xf76ec7(_0x1818e3);})[_0x1871('0x22')](function(_0x59dd2c){logger['error']('CreateChatMessage',_0x59dd2c[_0x1871('0x1b')],_0x40b097);_0x5ccf95(_0x23852f['error'](0x1f4,_0x59dd2c[_0x1871('0x1b')]));});});}; \ No newline at end of file +var _0xa894=['redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','CreateChatMessage','create','body','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0xa894,0x1d6));var _0x4a89=function(_0x5b445b,_0xd251da){_0x5b445b=_0x5b445b-0x0;var _0x1a40fe=_0xa894[_0x5b445b];return _0x1a40fe;};'use strict';var _=require(_0x4a89('0x0'));var util=require(_0x4a89('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a89('0x2'));var fs=require('fs');var Redis=require(_0x4a89('0x3'));var db=require(_0x4a89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a89('0x5'))(_0x4a89('0x6'));var config=require(_0x4a89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a89('0x8')][_0x4a89('0x9')]({'port':0x232a});config[_0x4a89('0xa')]=_[_0x4a89('0xb')](config[_0x4a89('0xa')],{'host':_0x4a89('0xc'),'port':0x18eb});var socket=require(_0x4a89('0xd'))(new Redis(config[_0x4a89('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x40da1b,_0x72d745,_0x1d21eb){return new BPromise(function(_0xe47002,_0x562940){return client[_0x4a89('0xe')](_0x40da1b,_0x1d21eb)[_0x4a89('0xf')](function(_0x47a212){logger[_0x4a89('0x10')]('ChatMessage,\x20%s,\x20%s',_0x72d745,_0x4a89('0x11'));logger[_0x4a89('0x12')](_0x4a89('0x13'),_0x72d745,_0x4a89('0x11'),JSON[_0x4a89('0x14')](_0x47a212));if(_0x47a212[_0x4a89('0x15')]){if(_0x47a212[_0x4a89('0x15')]['code']===0x1f4){logger['error'](_0x4a89('0x16'),_0x72d745,_0x47a212[_0x4a89('0x15')][_0x4a89('0x17')]);return _0x562940(_0x47a212[_0x4a89('0x15')][_0x4a89('0x17')]);}logger['error'](_0x4a89('0x16'),_0x72d745,_0x47a212[_0x4a89('0x15')]['message']);return _0xe47002(_0x47a212[_0x4a89('0x15')][_0x4a89('0x17')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x72d745,_0x4a89('0x11'));_0xe47002(_0x47a212[_0x4a89('0x18')][_0x4a89('0x17')]);}})[_0x4a89('0x19')](function(_0x71d8c6){logger[_0x4a89('0x15')](_0x4a89('0x16'),_0x72d745,_0x71d8c6);_0x562940(_0x71d8c6);});});}exports[_0x4a89('0x1a')]=function(_0x60dbf8){var _0x512dcd=this;return new Promise(function(_0x24a68d,_0x498ef5){return db['ChatMessage'][_0x4a89('0x1b')](_0x60dbf8[_0x4a89('0x1c')],{'raw':_0x60dbf8[_0x4a89('0x1d')]?_0x60dbf8[_0x4a89('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4a89('0xf')](function(_0x1ef55b){logger[_0x4a89('0x10')]('CreateChatMessage',_0x60dbf8);logger['debug']('CreateChatMessage',_0x60dbf8,JSON['stringify'](_0x1ef55b));_0x24a68d(_0x1ef55b);})[_0x4a89('0x19')](function(_0x36eae0){logger['error'](_0x4a89('0x1a'),_0x36eae0['message'],_0x60dbf8);_0x498ef5(_0x512dcd[_0x4a89('0x15')](0x1f4,_0x36eae0['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2d4a4d0..72d5e24 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 _0x423b=['update','removeListener','length','chatMessage:','save'];(function(_0x34ebbe,_0x3ecc2f){var _0xba74ee=function(_0x1fdcde){while(--_0x1fdcde){_0x34ebbe['push'](_0x34ebbe['shift']());}};_0xba74ee(++_0x3ecc2f);}(_0x423b,0x12b));var _0xb423=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x423b[_0x22b68a];return _0x1ac67a;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xb423('0x0'),'remove',_0xb423('0x1')];function createListener(_0x54e396,_0x3dbb0c){return function(_0x4b4acf){_0x3dbb0c['emit'](_0x54e396,_0x4b4acf);};}function removeListener(_0x50f31a,_0x2fa5da){return function(){ChatMessageEvents[_0xb423('0x2')](_0x50f31a,_0x2fa5da);};}exports['register']=function(_0x1be92e){for(var _0x3e6b18=0x0,_0x49eabb=events[_0xb423('0x3')];_0x3e6b18<_0x49eabb;_0x3e6b18++){var _0x573e95=events[_0x3e6b18];var _0x4119d7=createListener(_0xb423('0x4')+_0x573e95,_0x1be92e);ChatMessageEvents['on'](_0x573e95,_0x4119d7);}}; \ No newline at end of file +var _0xb458=['length','./chatMessage.events','save','remove','emit','removeListener'];(function(_0x3d6294,_0x30bb31){var _0x168eff=function(_0x1d528d){while(--_0x1d528d){_0x3d6294['push'](_0x3d6294['shift']());}};_0x168eff(++_0x30bb31);}(_0xb458,0x103));var _0x8b45=function(_0x2de369,_0x47abbd){_0x2de369=_0x2de369-0x0;var _0xf18da1=_0xb458[_0x2de369];return _0xf18da1;};'use strict';var ChatMessageEvents=require(_0x8b45('0x0'));var events=[_0x8b45('0x1'),_0x8b45('0x2'),'update'];function createListener(_0x58a508,_0xdf89d4){return function(_0x93d9cd){_0xdf89d4[_0x8b45('0x3')](_0x58a508,_0x93d9cd);};}function removeListener(_0x13a8c6,_0x5d51e4){return function(){ChatMessageEvents[_0x8b45('0x4')](_0x13a8c6,_0x5d51e4);};}exports['register']=function(_0x5cc2d5){for(var _0xe8d774=0x0,_0x12bd05=events[_0x8b45('0x5')];_0xe8d774<_0x12bd05;_0xe8d774++){var _0x3a8ccb=events[_0xe8d774];var _0x32342f=createListener('chatMessage:'+_0x3a8ccb,_0x5cc2d5);ChatMessageEvents['on'](_0x3a8ccb,_0x32342f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 572c8ca..71b70f5 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 _0x0425=['show','post','tracked','chat','chatmessage:create','create','put','accept','/:id/reject','reject','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x559a25,_0x181e7d){var _0x4fb485=function(_0xa5546f){while(--_0xa5546f){_0x559a25['push'](_0x559a25['shift']());}};_0x4fb485(++_0x181e7d);}(_0x0425,0x19c));var _0x5042=function(_0x2b819a,_0x5ab9f8){_0x2b819a=_0x2b819a-0x0;var _0x1ba130=_0x0425[_0x2b819a];return _0x1ba130;};'use strict';var multer=require(_0x5042('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5042('0x1'));var express=require(_0x5042('0x2'));var router=express[_0x5042('0x3')]();var fs_extra=require(_0x5042('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5042('0x5'));var config=require(_0x5042('0x6'));var controller=require(_0x5042('0x7'));router['get']('/',auth[_0x5042('0x8')](),controller[_0x5042('0x9')]);router[_0x5042('0xa')]('/describe',auth[_0x5042('0x8')](),controller[_0x5042('0xb')]);router[_0x5042('0xa')](_0x5042('0xc'),auth[_0x5042('0x8')](),controller[_0x5042('0xd')]);router[_0x5042('0xe')]('/',auth[_0x5042('0x8')](),interaction[_0x5042('0xf')](_0x5042('0x10'),_0x5042('0x11')),controller[_0x5042('0x12')]);router[_0x5042('0x13')](_0x5042('0xc'),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x5042('0x14')]);router[_0x5042('0x13')](_0x5042('0x15'),auth[_0x5042('0x8')](),controller[_0x5042('0x16')]);router[_0x5042('0x17')](_0x5042('0xc'),auth[_0x5042('0x8')](),controller['destroy']);module[_0x5042('0x18')]=router; \ No newline at end of file +var _0xff88=['/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put'];(function(_0x16e3ae,_0x56c581){var _0x5dbff6=function(_0x2d098f){while(--_0x2d098f){_0x16e3ae['push'](_0x16e3ae['shift']());}};_0x5dbff6(++_0x56c581);}(_0xff88,0xe1));var _0x8ff8=function(_0xe6b6e7,_0x3dc462){_0xe6b6e7=_0xe6b6e7-0x0;var _0x44c1ae=_0xff88[_0xe6b6e7];return _0x44c1ae;};'use strict';var multer=require(_0x8ff8('0x0'));var util=require(_0x8ff8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ff8('0x2'));var router=express['Router']();var fs_extra=require(_0x8ff8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8ff8('0x4'));var config=require(_0x8ff8('0x5'));var controller=require(_0x8ff8('0x6'));router[_0x8ff8('0x7')]('/',auth[_0x8ff8('0x8')](),controller['index']);router[_0x8ff8('0x7')](_0x8ff8('0x9'),auth[_0x8ff8('0x8')](),controller[_0x8ff8('0xa')]);router[_0x8ff8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8ff8('0xb')]);router[_0x8ff8('0xc')]('/',auth[_0x8ff8('0x8')](),interaction[_0x8ff8('0xd')](_0x8ff8('0xe'),_0x8ff8('0xf')),controller[_0x8ff8('0x10')]);router[_0x8ff8('0x11')](_0x8ff8('0x12'),controller[_0x8ff8('0x13')]);router[_0x8ff8('0x11')](_0x8ff8('0x14'),auth[_0x8ff8('0x8')](),controller[_0x8ff8('0x15')]);router[_0x8ff8('0x11')](_0x8ff8('0x16'),auth[_0x8ff8('0x8')](),controller[_0x8ff8('0x17')]);router[_0x8ff8('0x18')](_0x8ff8('0x12'),auth['isAuthenticated'](),controller[_0x8ff8('0x19')]);module[_0x8ff8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 72db0e9..f8ff8ab 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 _0x757a=['exports','TEXT'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x757a,0xde));var _0xa757=function(_0x4ce22a,_0x49bbc0){_0x4ce22a=_0x4ce22a-0x0;var _0x4add8e=_0x757a[_0x4ce22a];return _0x4add8e;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3529ab,_0x2dff17){var _0x25812d=function(_0x4b8efe){while(--_0x4b8efe){_0x3529ab['push'](_0x3529ab['shift']());}};_0x25812d(++_0x2dff17);}(_0xdb28,0x106));var _0x8db2=function(_0x369509,_0x1b8a2c){_0x369509=_0x369509-0x0;var _0x566b81=_0xdb28[_0x369509];return _0x566b81;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index a315657..8c7ab95 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x14f098,_0x24daca){var _0x305246=function(_0x43aa71){while(--_0x43aa71){_0x14f098['push'](_0x14f098['shift']());}};_0x305246(++_0x24daca);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x318189,_0x4b5b4a){var _0x2ed691=function(_0x594458){while(--_0x594458){_0x318189['push'](_0x318189['shift']());}};_0x2ed691(++_0x4b5b4a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index b9df490..7b56078 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 _0x1f96=['emit','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x1f96,0x108));var _0x61f9=function(_0x4d8d86,_0x528471){_0x4d8d86=_0x4d8d86-0x0;var _0x2736d1=_0x1f96[_0x4d8d86];return _0x2736d1;};'use strict';var EventEmitter=require(_0x61f9('0x0'));var ChatOfflineMessage=require(_0x61f9('0x1'))['db'][_0x61f9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x61f9('0x3')](0x0);var events={'afterCreate':_0x61f9('0x4'),'afterUpdate':'update','afterDestroy':_0x61f9('0x5')};function emitEvent(_0x1939de){return function(_0x29c29f,_0x191d80,_0x524b0a){ChatOfflineMessageEvents[_0x61f9('0x6')](_0x1939de+':'+_0x29c29f['id'],_0x29c29f);ChatOfflineMessageEvents[_0x61f9('0x6')](_0x1939de,_0x29c29f);_0x524b0a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x61f9('0x7')](e,emitEvent(event));}}module[_0x61f9('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8bf3=['ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x18eb0b,_0x11077e){var _0x1ddc58=function(_0x42dffa){while(--_0x42dffa){_0x18eb0b['push'](_0x18eb0b['shift']());}};_0x1ddc58(++_0x11077e);}(_0x8bf3,0x130));var _0x38bf=function(_0x4e1d6a,_0x3e3ec2){_0x4e1d6a=_0x4e1d6a-0x0;var _0x11c465=_0x8bf3[_0x4e1d6a];return _0x11c465;};'use strict';var EventEmitter=require(_0x38bf('0x0'));var ChatOfflineMessage=require(_0x38bf('0x1'))['db'][_0x38bf('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x38bf('0x3')](0x0);var events={'afterCreate':_0x38bf('0x4'),'afterUpdate':_0x38bf('0x5'),'afterDestroy':_0x38bf('0x6')};function emitEvent(_0x364dda){return function(_0xbf6785,_0x47db9b,_0x2e1579){ChatOfflineMessageEvents[_0x38bf('0x7')](_0x364dda+':'+_0xbf6785['id'],_0xbf6785);ChatOfflineMessageEvents[_0x38bf('0x7')](_0x364dda,_0xbf6785);_0x2e1579(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x38bf('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 79a6c8a..75afdd3 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 _0x4208=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x449cf4,_0x59e1b1){var _0x2d8de3=function(_0x5bdc22){while(--_0x5bdc22){_0x449cf4['push'](_0x449cf4['shift']());}};_0x2d8de3(++_0x59e1b1);}(_0x4208,0x6e));var _0x8420=function(_0x1c55f1,_0x3669ca){_0x1c55f1=_0x1c55f1-0x0;var _0x44dd27=_0x4208[_0x1c55f1];return _0x44dd27;};'use strict';var attributes=require(_0x8420('0x0'));module[_0x8420('0x1')]=function(_0x3f13df){return _0x3f13df[_0x8420('0x2')](_0x8420('0x3'),attributes,{'tableName':_0x8420('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8420('0x5'),'collate':_0x8420('0x6')});}; \ No newline at end of file +var _0x428e=['define','ChatOfflineMessage','utf8mb4_unicode_ci'];(function(_0x1f95f4,_0x4dd400){var _0x14e784=function(_0x4c206f){while(--_0x4c206f){_0x1f95f4['push'](_0x1f95f4['shift']());}};_0x14e784(++_0x4dd400);}(_0x428e,0x1c2));var _0xe428=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x428e[_0x71e493];return _0x3d40ab;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x11a3b2){return _0x11a3b2[_0xe428('0x0')](_0xe428('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe428('0x2')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index d18d066..2e916ba 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 _0x63c5=['message','result','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d461f,_0x2638ad){var _0x357f29=function(_0x2f0175){while(--_0x2f0175){_0x3d461f['push'](_0x3d461f['shift']());}};_0x357f29(++_0x2638ad);}(_0x63c5,0xde));var _0x563c=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x63c5[_0x1f6f84];return _0x177f40;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x563c('0x0'));var BPromise=require(_0x563c('0x1'));var rs=require(_0x563c('0x2'));var fs=require('fs');var Redis=require(_0x563c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x563c('0x4'))(_0x563c('0x5'));var config=require('../../config/environment');var jayson=require(_0x563c('0x6'));var client=jayson[_0x563c('0x7')][_0x563c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e0232,_0x4ebfac,_0x117214){return new BPromise(function(_0x48b80e,_0x2594e7){return client[_0x563c('0x9')](_0x2e0232,_0x117214)['then'](function(_0x2afce4){logger[_0x563c('0xa')](_0x563c('0xb'),_0x4ebfac,_0x563c('0xc'));logger[_0x563c('0xd')](_0x563c('0xe'),_0x4ebfac,_0x563c('0xc'),JSON[_0x563c('0xf')](_0x2afce4));if(_0x2afce4[_0x563c('0x10')]){if(_0x2afce4[_0x563c('0x10')][_0x563c('0x11')]===0x1f4){logger['error'](_0x563c('0xb'),_0x4ebfac,_0x2afce4[_0x563c('0x10')][_0x563c('0x12')]);return _0x2594e7(_0x2afce4[_0x563c('0x10')][_0x563c('0x12')]);}logger[_0x563c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4ebfac,_0x2afce4[_0x563c('0x10')][_0x563c('0x12')]);return _0x48b80e(_0x2afce4[_0x563c('0x10')]['message']);}else{logger[_0x563c('0xa')](_0x563c('0xb'),_0x4ebfac,_0x563c('0xc'));_0x48b80e(_0x2afce4[_0x563c('0x13')][_0x563c('0x12')]);}})['catch'](function(_0x539d02){logger[_0x563c('0x10')](_0x563c('0xb'),_0x4ebfac,_0x539d02);_0x2594e7(_0x539d02);});});} \ No newline at end of file +var _0x9ac9=['message','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0xad302d,_0x265208){var _0x2981e5=function(_0x312841){while(--_0x312841){_0xad302d['push'](_0xad302d['shift']());}};_0x2981e5(++_0x265208);}(_0x9ac9,0x1b9));var _0x99ac=function(_0x1bfac7,_0x5ee868){_0x1bfac7=_0x1bfac7-0x0;var _0x54c735=_0x9ac9[_0x1bfac7];return _0x54c735;};'use strict';var _=require(_0x99ac('0x0'));var util=require('util');var moment=require(_0x99ac('0x1'));var BPromise=require(_0x99ac('0x2'));var rs=require(_0x99ac('0x3'));var fs=require('fs');var Redis=require(_0x99ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ac('0x5'));var logger=require('../../config/logger')(_0x99ac('0x6'));var config=require(_0x99ac('0x7'));var jayson=require(_0x99ac('0x8'));var client=jayson[_0x99ac('0x9')][_0x99ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1811ea,_0x2dcad3,_0x4da379){return new BPromise(function(_0x41df2f,_0x3b86ae){return client[_0x99ac('0xb')](_0x1811ea,_0x4da379)[_0x99ac('0xc')](function(_0x463715){logger[_0x99ac('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2dcad3,_0x99ac('0xe'));logger['debug'](_0x99ac('0xf'),_0x2dcad3,_0x99ac('0xe'),JSON['stringify'](_0x463715));if(_0x463715['error']){if(_0x463715[_0x99ac('0x10')][_0x99ac('0x11')]===0x1f4){logger['error'](_0x99ac('0x12'),_0x2dcad3,_0x463715[_0x99ac('0x10')]['message']);return _0x3b86ae(_0x463715[_0x99ac('0x10')]['message']);}logger['error'](_0x99ac('0x12'),_0x2dcad3,_0x463715[_0x99ac('0x10')][_0x99ac('0x13')]);return _0x41df2f(_0x463715[_0x99ac('0x10')][_0x99ac('0x13')]);}else{logger[_0x99ac('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2dcad3,'request\x20sent');_0x41df2f(_0x463715['result'][_0x99ac('0x13')]);}})['catch'](function(_0x5a5e0d){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2dcad3,_0x5a5e0d);_0x3b86ae(_0x5a5e0d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5459dc2..668ef40 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 _0x3b23=['put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x3ae150,_0xd830eb){var _0x4390cc=function(_0x57a1ac){while(--_0x57a1ac){_0x3ae150['push'](_0x3ae150['shift']());}};_0x4390cc(++_0xd830eb);}(_0x3b23,0xf6));var _0x33b2=function(_0x487069,_0x8bb346){_0x487069=_0x487069-0x0;var _0xea151e=_0x3b23[_0x487069];return _0xea151e;};'use strict';var multer=require(_0x33b2('0x0'));var util=require(_0x33b2('0x1'));var path=require(_0x33b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x33b2('0x3'));var router=express[_0x33b2('0x4')]();var fs_extra=require(_0x33b2('0x5'));var auth=require(_0x33b2('0x6'));var interaction=require(_0x33b2('0x7'));var config=require(_0x33b2('0x8'));var controller=require(_0x33b2('0x9'));router[_0x33b2('0xa')]('/',auth[_0x33b2('0xb')](),controller[_0x33b2('0xc')]);router[_0x33b2('0xa')](_0x33b2('0xd'),auth[_0x33b2('0xb')](),controller[_0x33b2('0xe')]);router[_0x33b2('0xa')](_0x33b2('0xf'),auth[_0x33b2('0xb')](),controller['show']);router[_0x33b2('0x10')]('/',auth[_0x33b2('0xb')](),controller[_0x33b2('0x11')]);router[_0x33b2('0x12')](_0x33b2('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x33b2('0x13')](_0x33b2('0xf'),auth['isAuthenticated'](),controller[_0x33b2('0x14')]);module[_0x33b2('0x15')]=router; \ No newline at end of file +var _0xe2b6=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x258f46,_0xd27ae3){var _0x1e2a2f=function(_0x3e8897){while(--_0x3e8897){_0x258f46['push'](_0x258f46['shift']());}};_0x1e2a2f(++_0xd27ae3);}(_0xe2b6,0x135));var _0x6e2b=function(_0x2dbbea,_0x17ffc9){_0x2dbbea=_0x2dbbea-0x0;var _0x496b00=_0xe2b6[_0x2dbbea];return _0x496b00;};'use strict';var multer=require(_0x6e2b('0x0'));var util=require(_0x6e2b('0x1'));var path=require(_0x6e2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e2b('0x3'));var router=express[_0x6e2b('0x4')]();var fs_extra=require(_0x6e2b('0x5'));var auth=require(_0x6e2b('0x6'));var interaction=require(_0x6e2b('0x7'));var config=require('../../config/environment');var controller=require(_0x6e2b('0x8'));router[_0x6e2b('0x9')]('/',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0xb')]);router[_0x6e2b('0x9')](_0x6e2b('0xc'),auth[_0x6e2b('0xa')](),controller['describe']);router[_0x6e2b('0x9')](_0x6e2b('0xd'),auth[_0x6e2b('0xa')](),controller[_0x6e2b('0xe')]);router[_0x6e2b('0xf')]('/',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x10')]);router[_0x6e2b('0x11')]('/:id',auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x12')]);router[_0x6e2b('0x13')](_0x6e2b('0xd'),auth[_0x6e2b('0xa')](),controller[_0x6e2b('0x14')]);module[_0x6e2b('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 84f1b66..b3f1c00 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 _0x7983=['mouseOver','INTEGER','sequelize','exports','STRING','timeout'];(function(_0x26a891,_0x5dcab5){var _0x4d26e6=function(_0x54160c){while(--_0x54160c){_0x26a891['push'](_0x26a891['shift']());}};_0x4d26e6(++_0x5dcab5);}(_0x7983,0x146));var _0x3798=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7983[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x3798('0x0'));module[_0x3798('0x1')]={'name':{'type':Sequelize[_0x3798('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x3798('0x3')),'defaultValue':_0x3798('0x4')},'selector':{'type':Sequelize[_0x3798('0x2')]},'timeout':{'type':Sequelize[_0x3798('0x5')]}}; \ No newline at end of file +var _0x464b=['INTEGER','STRING','mouseOver','timeout'];(function(_0x2f4b07,_0x5c1d23){var _0x10c313=function(_0x52314e){while(--_0x52314e){_0x2f4b07['push'](_0x2f4b07['shift']());}};_0x10c313(++_0x5c1d23);}(_0x464b,0x1f1));var _0xb464=function(_0x1c459f,_0x712186){_0x1c459f=_0x1c459f-0x0;var _0x5b4138=_0x464b[_0x1c459f];return _0x5b4138;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb464('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb464('0x1'),_0xb464('0x2')),'defaultValue':_0xb464('0x1')},'selector':{'type':Sequelize[_0xb464('0x0')]},'timeout':{'type':Sequelize[_0xb464('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f9bee07..16001ea 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 _0x2b83=['path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4fe2cb,_0xd198b0){var _0x424819=function(_0xccd30a){while(--_0xccd30a){_0x4fe2cb['push'](_0x4fe2cb['shift']());}};_0x424819(++_0xd198b0);}(_0x2b83,0x1d3));var _0x32b8=function(_0x3db159,_0x2796f0){_0x3db159=_0x3db159-0x0;var _0x2e926a=_0x2b83[_0x3db159];return _0x2e926a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32b8('0x0'));var zipdir=require(_0x32b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var BPromise=require(_0x32b8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x32b8('0x5'));var sox=require(_0x32b8('0x6'));var csv=require('to-csv');var ejs=require(_0x32b8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32b8('0x8'));var squel=require(_0x32b8('0x9'));var crypto=require(_0x32b8('0xa'));var jsforce=require(_0x32b8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x32b8('0xc'));var querystring=require(_0x32b8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x32b8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x32b8('0xf'));var hardwareService=require(_0x32b8('0x10'));var logger=require(_0x32b8('0x11'))(_0x32b8('0x12'));var utils=require('../../config/utils');var config=require(_0x32b8('0x13'));var licenseUtil=require(_0x32b8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49c337,_0x30d00a){_0x30d00a=_0x30d00a||0xcc;return function(_0x5a0ef2){if(_0x5a0ef2){return _0x49c337[_0x32b8('0x15')](_0x30d00a);}return _0x49c337['status'](_0x30d00a)[_0x32b8('0x16')]();};}function respondWithResult(_0x6b533e,_0x3b0fac){_0x3b0fac=_0x3b0fac||0xc8;return function(_0xdf56fb){if(_0xdf56fb){return _0x6b533e[_0x32b8('0x17')](_0x3b0fac)['json'](_0xdf56fb);}};}function respondWithFilteredResult(_0x4c8fc9,_0x5e7b4f){return function(_0x5e49d1){if(_0x5e49d1){var _0x4e0d7a=typeof _0x5e7b4f['offset']===_0x32b8('0x18')&&typeof _0x5e7b4f['limit']==='undefined';var _0x2828fc=_0x5e49d1[_0x32b8('0x19')];var _0x2ba4eb=_0x4e0d7a?0x0:_0x5e7b4f[_0x32b8('0x1a')];var _0x599bc3=_0x4e0d7a?_0x5e49d1['count']:_0x5e7b4f['offset']+_0x5e7b4f[_0x32b8('0x1b')];var _0x2ffea2;if(_0x599bc3>=_0x2828fc){_0x599bc3=_0x2828fc;_0x2ffea2=0xc8;}else{_0x2ffea2=0xce;}_0x4c8fc9[_0x32b8('0x17')](_0x2ffea2);return _0x4c8fc9[_0x32b8('0x1c')]('Content-Range',_0x2ba4eb+'-'+_0x599bc3+'/'+_0x2828fc)[_0x32b8('0x1d')](_0x5e49d1);}return null;};}function patchUpdates(_0x3ddc5f){return function(_0xb51551){try{jsonpatch[_0x32b8('0x1e')](_0xb51551,_0x3ddc5f,!![]);}catch(_0xb9dd1d){return BPromise[_0x32b8('0x1f')](_0xb9dd1d);}return _0xb51551[_0x32b8('0x20')]();};}function saveUpdates(_0xcd4b26,_0x52347c){return function(_0x567055){if(_0x567055){return _0x567055[_0x32b8('0x21')](_0xcd4b26)['then'](function(_0x1ec58d){return _0x1ec58d;});}return null;};}function removeEntity(_0x4bc4a8,_0x1a4c2b){return function(_0x21ee32){if(_0x21ee32){return _0x21ee32[_0x32b8('0x22')]()[_0x32b8('0x23')](function(){_0x4bc4a8[_0x32b8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1360,_0x25a917){return function(_0x3eea54){if(!_0x3eea54){_0x4e1360[_0x32b8('0x15')](0x194);}return _0x3eea54;};}function handleError(_0x23e195,_0x29988d){_0x29988d=_0x29988d||0x1f4;return function(_0x57a6a3){logger[_0x32b8('0x24')](_0x57a6a3[_0x32b8('0x25')]);if(_0x57a6a3[_0x32b8('0x26')]){delete _0x57a6a3[_0x32b8('0x26')];}_0x23e195[_0x32b8('0x17')](_0x29988d)[_0x32b8('0x27')](_0x57a6a3);};}exports[_0x32b8('0x28')]=function(_0x39ce15,_0x3fa029){var _0xa225ec={'raw':!![],'where':{'id':_0x39ce15[_0x32b8('0x29')]['id']}},_0x3e0548={};_0x3e0548[_0x32b8('0x2a')]=_['keys'](db[_0x32b8('0x2b')][_0x32b8('0x2c')]);_0x3e0548[_0x32b8('0x2d')]=_[_0x32b8('0x2e')](_0x39ce15[_0x32b8('0x2d')]);_0x3e0548[_0x32b8('0x2f')]=_[_0x32b8('0x30')](_0x3e0548[_0x32b8('0x2a')],_0x3e0548[_0x32b8('0x2d')]);_0xa225ec[_0x32b8('0x31')]=_['intersection'](_0x3e0548[_0x32b8('0x2a')],qs[_0x32b8('0x32')](_0x39ce15[_0x32b8('0x2d')][_0x32b8('0x32')]));_0xa225ec['attributes']=_0xa225ec['attributes'][_0x32b8('0x33')]?_0xa225ec[_0x32b8('0x31')]:_0x3e0548[_0x32b8('0x2a')];if(_0x39ce15[_0x32b8('0x2d')]['includeAll']){_0xa225ec[_0x32b8('0x34')]=[{'all':!![]}];}_0xa225ec=_[_0x32b8('0x35')]({},_0xa225ec,_0x39ce15[_0x32b8('0x36')]);return db[_0x32b8('0x2b')][_0x32b8('0x37')](_0xa225ec)[_0x32b8('0x23')](handleEntityNotFound(_0x3fa029,null))[_0x32b8('0x23')](respondWithResult(_0x3fa029,null))[_0x32b8('0x38')](handleError(_0x3fa029,null));};exports['create']=function(_0x10f17e,_0x5e8af2){return db[_0x32b8('0x2b')][_0x32b8('0x39')](_0x10f17e[_0x32b8('0x3a')],{})[_0x32b8('0x23')](respondWithResult(_0x5e8af2,0xc9))[_0x32b8('0x38')](handleError(_0x5e8af2,null));};exports[_0x32b8('0x21')]=function(_0x4c9ab0,_0x152209){if(_0x4c9ab0[_0x32b8('0x3a')]['id']){delete _0x4c9ab0[_0x32b8('0x3a')]['id'];}return db['ChatProactiveAction'][_0x32b8('0x37')]({'where':{'id':_0x4c9ab0['params']['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x152209,null))[_0x32b8('0x23')](saveUpdates(_0x4c9ab0[_0x32b8('0x3a')],null))[_0x32b8('0x23')](respondWithResult(_0x152209,null))['catch'](handleError(_0x152209,null));};exports[_0x32b8('0x22')]=function(_0x10ccf5,_0x2d586f){return db['ChatProactiveAction']['find']({'where':{'id':_0x10ccf5[_0x32b8('0x29')]['id']}})[_0x32b8('0x23')](handleEntityNotFound(_0x2d586f,null))[_0x32b8('0x23')](removeEntity(_0x2d586f,null))['catch'](handleError(_0x2d586f,null));}; \ No newline at end of file +var _0xbdfd=['find','create','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include'];(function(_0x1e6346,_0x57ccbd){var _0x770c06=function(_0x4a9aa9){while(--_0x4a9aa9){_0x1e6346['push'](_0x1e6346['shift']());}};_0x770c06(++_0x57ccbd);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xdbdf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdbdf('0x1'));var rp=require(_0xdbdf('0x2'));var moment=require(_0xdbdf('0x3'));var BPromise=require(_0xdbdf('0x4'));var Mustache=require('mustache');var util=require(_0xdbdf('0x5'));var path=require(_0xdbdf('0x6'));var sox=require('sox');var csv=require(_0xdbdf('0x7'));var ejs=require(_0xdbdf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbdf('0x9'));var squel=require(_0xdbdf('0xa'));var crypto=require(_0xdbdf('0xb'));var jsforce=require(_0xdbdf('0xc'));var deskjs=require(_0xdbdf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdbdf('0xe'));var Papa=require(_0xdbdf('0xf'));var Redis=require(_0xdbdf('0x10'));var authService=require(_0xdbdf('0x11'));var qs=require(_0xdbdf('0x12'));var as=require(_0xdbdf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdbdf('0x14'));var utils=require(_0xdbdf('0x15'));var config=require(_0xdbdf('0x16'));var licenseUtil=require(_0xdbdf('0x17'));var db=require(_0xdbdf('0x18'))['db'];function respondWithStatusCode(_0x244ecd,_0x51212c){_0x51212c=_0x51212c||0xcc;return function(_0x152831){if(_0x152831){return _0x244ecd[_0xdbdf('0x19')](_0x51212c);}return _0x244ecd[_0xdbdf('0x1a')](_0x51212c)[_0xdbdf('0x1b')]();};}function respondWithResult(_0x45b824,_0x24dfde){_0x24dfde=_0x24dfde||0xc8;return function(_0xae4a21){if(_0xae4a21){return _0x45b824['status'](_0x24dfde)[_0xdbdf('0x1c')](_0xae4a21);}};}function respondWithFilteredResult(_0x127060,_0x98c104){return function(_0x173a18){if(_0x173a18){var _0x216c58=typeof _0x98c104['offset']===_0xdbdf('0x1d')&&typeof _0x98c104[_0xdbdf('0x1e')]===_0xdbdf('0x1d');var _0x282e4e=_0x173a18[_0xdbdf('0x1f')];var _0x439f87=_0x216c58?0x0:_0x98c104[_0xdbdf('0x20')];var _0x195c66=_0x216c58?_0x173a18[_0xdbdf('0x1f')]:_0x98c104[_0xdbdf('0x20')]+_0x98c104[_0xdbdf('0x1e')];var _0xe70149;if(_0x195c66>=_0x282e4e){_0x195c66=_0x282e4e;_0xe70149=0xc8;}else{_0xe70149=0xce;}_0x127060['status'](_0xe70149);return _0x127060[_0xdbdf('0x21')](_0xdbdf('0x22'),_0x439f87+'-'+_0x195c66+'/'+_0x282e4e)[_0xdbdf('0x1c')](_0x173a18);}return null;};}function patchUpdates(_0x2b6fe3){return function(_0x1670b3){try{jsonpatch[_0xdbdf('0x23')](_0x1670b3,_0x2b6fe3,!![]);}catch(_0x3dc35a){return BPromise[_0xdbdf('0x24')](_0x3dc35a);}return _0x1670b3['save']();};}function saveUpdates(_0x44d1d2,_0x2737e5){return function(_0x30a9fd){if(_0x30a9fd){return _0x30a9fd[_0xdbdf('0x25')](_0x44d1d2)['then'](function(_0x3b91ea){return _0x3b91ea;});}return null;};}function removeEntity(_0x3f02b8,_0x237d86){return function(_0x563628){if(_0x563628){return _0x563628[_0xdbdf('0x26')]()[_0xdbdf('0x27')](function(){_0x3f02b8[_0xdbdf('0x1a')](0xcc)[_0xdbdf('0x1b')]();});}};}function handleEntityNotFound(_0x5219f9,_0x3446f2){return function(_0x41c6e1){if(!_0x41c6e1){_0x5219f9[_0xdbdf('0x19')](0x194);}return _0x41c6e1;};}function handleError(_0x23b080,_0x1bc27b){_0x1bc27b=_0x1bc27b||0x1f4;return function(_0xcd0ee7){logger[_0xdbdf('0x28')](_0xcd0ee7[_0xdbdf('0x29')]);if(_0xcd0ee7[_0xdbdf('0x2a')]){delete _0xcd0ee7[_0xdbdf('0x2a')];}_0x23b080['status'](_0x1bc27b)['send'](_0xcd0ee7);};}exports[_0xdbdf('0x2b')]=function(_0x501ca8,_0x1995e0){var _0xfa1cd9={'raw':!![],'where':{'id':_0x501ca8[_0xdbdf('0x2c')]['id']}},_0x1ea57e={};_0x1ea57e[_0xdbdf('0x2d')]=_[_0xdbdf('0x2e')](db[_0xdbdf('0x2f')][_0xdbdf('0x30')]);_0x1ea57e[_0xdbdf('0x31')]=_['keys'](_0x501ca8[_0xdbdf('0x31')]);_0x1ea57e[_0xdbdf('0x32')]=_['intersection'](_0x1ea57e[_0xdbdf('0x2d')],_0x1ea57e[_0xdbdf('0x31')]);_0xfa1cd9[_0xdbdf('0x33')]=_[_0xdbdf('0x34')](_0x1ea57e[_0xdbdf('0x2d')],qs['fields'](_0x501ca8[_0xdbdf('0x31')][_0xdbdf('0x35')]));_0xfa1cd9['attributes']=_0xfa1cd9[_0xdbdf('0x33')][_0xdbdf('0x36')]?_0xfa1cd9[_0xdbdf('0x33')]:_0x1ea57e[_0xdbdf('0x2d')];if(_0x501ca8[_0xdbdf('0x31')][_0xdbdf('0x37')]){_0xfa1cd9[_0xdbdf('0x38')]=[{'all':!![]}];}_0xfa1cd9=_['merge']({},_0xfa1cd9,_0x501ca8['options']);return db['ChatProactiveAction'][_0xdbdf('0x39')](_0xfa1cd9)['then'](handleEntityNotFound(_0x1995e0,null))[_0xdbdf('0x27')](respondWithResult(_0x1995e0,null))['catch'](handleError(_0x1995e0,null));};exports['create']=function(_0x35f315,_0xa1a99c){return db[_0xdbdf('0x2f')][_0xdbdf('0x3a')](_0x35f315[_0xdbdf('0x3b')],{})[_0xdbdf('0x27')](respondWithResult(_0xa1a99c,0xc9))[_0xdbdf('0x3c')](handleError(_0xa1a99c,null));};exports['update']=function(_0x1025df,_0x1ae043){if(_0x1025df[_0xdbdf('0x3b')]['id']){delete _0x1025df[_0xdbdf('0x3b')]['id'];}return db[_0xdbdf('0x2f')][_0xdbdf('0x39')]({'where':{'id':_0x1025df[_0xdbdf('0x2c')]['id']}})[_0xdbdf('0x27')](handleEntityNotFound(_0x1ae043,null))['then'](saveUpdates(_0x1025df[_0xdbdf('0x3b')],null))[_0xdbdf('0x27')](respondWithResult(_0x1ae043,null))['catch'](handleError(_0x1ae043,null));};exports[_0xdbdf('0x26')]=function(_0x15f842,_0xf9bcae){return db[_0xdbdf('0x2f')]['find']({'where':{'id':_0x15f842[_0xdbdf('0x2c')]['id']}})['then'](handleEntityNotFound(_0xf9bcae,null))[_0xdbdf('0x27')](removeEntity(_0xf9bcae,null))['catch'](handleError(_0xf9bcae,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ad5ed43..b20bfb4 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 _0xaf3b=['../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3aebed,_0x3c80a7){var _0x138c2d=function(_0x27035f){while(--_0x27035f){_0x3aebed['push'](_0x3aebed['shift']());}};_0x138c2d(++_0x3c80a7);}(_0xaf3b,0x1b2));var _0xbaf3=function(_0x1e3943,_0x39ef8a){_0x1e3943=_0x1e3943-0x0;var _0x41623e=_0xaf3b[_0x1e3943];return _0x41623e;};'use strict';var _=require('lodash');var util=require(_0xbaf3('0x0'));var logger=require(_0xbaf3('0x1'))(_0xbaf3('0x2'));var moment=require('moment');var BPromise=require(_0xbaf3('0x3'));var rp=require(_0xbaf3('0x4'));var fs=require('fs');var path=require(_0xbaf3('0x5'));var rimraf=require('rimraf');var config=require(_0xbaf3('0x6'));var attributes=require(_0xbaf3('0x7'));module[_0xbaf3('0x8')]=function(_0x3c4a57,_0x479bb5){return _0x3c4a57['define'](_0xbaf3('0x9'),attributes,{'tableName':_0xbaf3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x615c=['../../config/logger','api','path','rimraf','./chatProactiveAction.attributes','exports','chat_proactive_actions','lodash','util'];(function(_0x45cc3c,_0x4d1b53){var _0x4d57cc=function(_0x767f7f){while(--_0x767f7f){_0x45cc3c['push'](_0x45cc3c['shift']());}};_0x4d57cc(++_0x4d1b53);}(_0x615c,0x18a));var _0xc615=function(_0x3b0da2,_0x306d66){_0x3b0da2=_0x3b0da2-0x0;var _0x45a240=_0x615c[_0x3b0da2];return _0x45a240;};'use strict';var _=require(_0xc615('0x0'));var util=require(_0xc615('0x1'));var logger=require(_0xc615('0x2'))(_0xc615('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc615('0x4'));var rimraf=require(_0xc615('0x5'));var config=require('../../config/environment');var attributes=require(_0xc615('0x6'));module[_0xc615('0x7')]=function(_0x2b53b6,_0x2b6bed){return _0x2b53b6['define']('ChatProactiveAction',attributes,{'tableName':_0xc615('0x8'),'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 0c96582..ee71c9f 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 _0xc8b4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x41f3c8,_0x5976b4){var _0x58d4f7=function(_0x325cc8){while(--_0x325cc8){_0x41f3c8['push'](_0x41f3c8['shift']());}};_0x58d4f7(++_0x5976b4);}(_0xc8b4,0xbc));var _0x4c8b=function(_0xb4b24d,_0x249f45){_0xb4b24d=_0xb4b24d-0x0;var _0x2e959b=_0xc8b4[_0xb4b24d];return _0x2e959b;};'use strict';var _=require(_0x4c8b('0x0'));var util=require(_0x4c8b('0x1'));var moment=require(_0x4c8b('0x2'));var BPromise=require(_0x4c8b('0x3'));var rs=require(_0x4c8b('0x4'));var fs=require('fs');var Redis=require(_0x4c8b('0x5'));var db=require(_0x4c8b('0x6'))['db'];var utils=require(_0x4c8b('0x7'));var logger=require(_0x4c8b('0x8'))('rpc');var config=require(_0x4c8b('0x9'));var jayson=require(_0x4c8b('0xa'));var client=jayson['client'][_0x4c8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x419cf9,_0x40ce80,_0x254f7f){return new BPromise(function(_0xd2a113,_0x238ac0){return client['request'](_0x419cf9,_0x254f7f)[_0x4c8b('0xc')](function(_0x553930){logger[_0x4c8b('0xd')](_0x4c8b('0xe'),_0x40ce80,_0x4c8b('0xf'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x40ce80,_0x4c8b('0xf'),JSON[_0x4c8b('0x10')](_0x553930));if(_0x553930[_0x4c8b('0x11')]){if(_0x553930['error']['code']===0x1f4){logger[_0x4c8b('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x40ce80,_0x553930[_0x4c8b('0x11')][_0x4c8b('0x12')]);return _0x238ac0(_0x553930['error']['message']);}logger[_0x4c8b('0x11')](_0x4c8b('0xe'),_0x40ce80,_0x553930[_0x4c8b('0x11')][_0x4c8b('0x12')]);return _0xd2a113(_0x553930['error'][_0x4c8b('0x12')]);}else{logger['info'](_0x4c8b('0xe'),_0x40ce80,_0x4c8b('0xf'));_0xd2a113(_0x553930[_0x4c8b('0x13')]['message']);}})[_0x4c8b('0x14')](function(_0x286761){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x40ce80,_0x286761);_0x238ac0(_0x286761);});});} \ No newline at end of file +var _0xd581=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xd581,0x76));var _0x1d58=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xd581[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x1d58('0x0'));var util=require(_0x1d58('0x1'));var moment=require(_0x1d58('0x2'));var BPromise=require(_0x1d58('0x3'));var rs=require(_0x1d58('0x4'));var fs=require('fs');var Redis=require(_0x1d58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d58('0x6'));var logger=require('../../config/logger')(_0x1d58('0x7'));var config=require(_0x1d58('0x8'));var jayson=require(_0x1d58('0x9'));var client=jayson[_0x1d58('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24257c,_0xcbaa77,_0x36e9e6){return new BPromise(function(_0x3d1fcf,_0x4dcf42){return client['request'](_0x24257c,_0x36e9e6)[_0x1d58('0xb')](function(_0x1388a8){logger[_0x1d58('0xc')](_0x1d58('0xd'),_0xcbaa77,'request\x20sent');logger[_0x1d58('0xe')](_0x1d58('0xf'),_0xcbaa77,_0x1d58('0x10'),JSON[_0x1d58('0x11')](_0x1388a8));if(_0x1388a8[_0x1d58('0x12')]){if(_0x1388a8['error'][_0x1d58('0x13')]===0x1f4){logger[_0x1d58('0x12')](_0x1d58('0xd'),_0xcbaa77,_0x1388a8[_0x1d58('0x12')][_0x1d58('0x14')]);return _0x4dcf42(_0x1388a8['error']['message']);}logger[_0x1d58('0x12')](_0x1d58('0xd'),_0xcbaa77,_0x1388a8[_0x1d58('0x12')][_0x1d58('0x14')]);return _0x3d1fcf(_0x1388a8['error']['message']);}else{logger['info'](_0x1d58('0xd'),_0xcbaa77,'request\x20sent');_0x3d1fcf(_0x1388a8[_0x1d58('0x15')][_0x1d58('0x14')]);}})['catch'](function(_0x9831fe){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xcbaa77,_0x9831fe);_0x4dcf42(_0x9831fe);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b870a3f..1001b63 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 _0x24ca=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1a3ea3,_0x938305){var _0x5d1b1f=function(_0x35f6eb){while(--_0x35f6eb){_0x1a3ea3['push'](_0x1a3ea3['shift']());}};_0x5d1b1f(++_0x938305);}(_0x24ca,0x1bc));var _0xa24c=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x24ca[_0x28edda];return _0x21f4a4;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0xc')]);router[_0xa24c('0xd')]('/',auth[_0xa24c('0xb')](),controller['create']);router[_0xa24c('0xe')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller['update']);router[_0xa24c('0xf')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0x10')]);module[_0xa24c('0x11')]=router; \ No newline at end of file +var _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x43c6a6,_0x4e380d){var _0x26e372=function(_0x9c75e8){while(--_0x9c75e8){_0x43c6a6['push'](_0x43c6a6['shift']());}};_0x26e372(++_0x4e380d);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3af270,_0x5675b4){_0x3af270=_0x3af270-0x0;var _0x1dc18a=_0x3f8a[_0x3af270];return _0x1dc18a;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f0b9896..a9f32d9 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 _0x03c0=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03c0,0x8e));var _0x003c=function(_0x3ee5bb,_0x59f1ca){_0x3ee5bb=_0x3ee5bb-0x0;var _0xfe8381=_0x03c0[_0x3ee5bb];return _0xfe8381;};'use strict';var Sequelize=require(_0x003c('0x0'));module[_0x003c('0x1')]={'name':{'type':Sequelize[_0x003c('0x2')],'unique':_0x003c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x003c('0x2')]},'timeout':{'type':Sequelize[_0x003c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x003c('0x5')]('rrmemory',_0x003c('0x6'),_0x003c('0x7'))}}; \ No newline at end of file +var _0x564c=['rrmemory','roundrobin','STRING','name'];(function(_0x6adec3,_0x3d264a){var _0xf68ec2=function(_0x54a2c1){while(--_0x54a2c1){_0x6adec3['push'](_0x6adec3['shift']());}};_0xf68ec2(++_0x3d264a);}(_0x564c,0xea));var _0xc564=function(_0x1433df,_0x1c1ddc){_0x1433df=_0x1433df-0x0;var _0x49fade=_0x564c[_0x1433df];return _0x49fade;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc564('0x0')],'unique':_0xc564('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc564('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc564('0x2'),'beepall',_0xc564('0x3'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9b6f203..795e855 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 _0x6173=['squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','ChatQueue,\x20%s,\x20%s','message','info','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get','ChatQueues','stack','name','send','map','ChatQueue','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','include','catch','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','nolimit','order','ChatQueueId','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','User','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x6173,0x123));var _0x3617=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6173[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x3617('0x0'));var rimraf=require(_0x3617('0x1'));var zipdir=require(_0x3617('0x2'));var jsonpatch=require(_0x3617('0x3'));var rp=require(_0x3617('0x4'));var moment=require(_0x3617('0x5'));var BPromise=require(_0x3617('0x6'));var Mustache=require(_0x3617('0x7'));var util=require(_0x3617('0x8'));var path=require(_0x3617('0x9'));var sox=require('sox');var csv=require(_0x3617('0xa'));var ejs=require(_0x3617('0xb'));var fs=require('fs');var fs_extra=require(_0x3617('0xc'));var _=require('lodash');var squel=require(_0x3617('0xd'));var crypto=require('crypto');var jsforce=require(_0x3617('0xe'));var deskjs=require(_0x3617('0xf'));var toCsv=require(_0x3617('0xa'));var querystring=require(_0x3617('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3617('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3617('0x12'));var hardwareService=require(_0x3617('0x13'));var logger=require(_0x3617('0x14'))(_0x3617('0x15'));var utils=require(_0x3617('0x16'));var config=require(_0x3617('0x17'));var licenseUtil=require(_0x3617('0x18'));var db=require(_0x3617('0x19'))['db'];config['redis']=_[_0x3617('0x1a')](config[_0x3617('0x1b')],{'host':_0x3617('0x1c'),'port':0x18eb});var socket=require(_0x3617('0x1d'))(new Redis(config[_0x3617('0x1b')]));require('./chatQueue.socket')[_0x3617('0x1e')](socket);var jayson=require(_0x3617('0x1f'));var client=jayson['client'][_0x3617('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x448e51,_0x4d4cc3,_0x2ff952,_0x23ecd7){return new BPromise(function(_0x221574,_0x510188){var _0x2dbd1d=_0x23ecd7||client;return _0x2dbd1d[_0x3617('0x21')](_0x448e51,_0x2ff952)[_0x3617('0x22')](function(_0x8ef8f8){logger['info']('ChatQueue,\x20%s,\x20%s',_0x4d4cc3,_0x3617('0x23'));logger[_0x3617('0x24')](_0x3617('0x25'),_0x4d4cc3,'request\x20sent',JSON['stringify'](_0x8ef8f8));if(_0x8ef8f8['error']){if(_0x8ef8f8['error'][_0x3617('0x26')]===0x1f4){logger[_0x3617('0x27')](_0x3617('0x28'),_0x4d4cc3,_0x8ef8f8[_0x3617('0x27')][_0x3617('0x29')]);return _0x510188(_0x8ef8f8['error']['message']);}logger[_0x3617('0x27')](_0x3617('0x28'),_0x4d4cc3,_0x8ef8f8[_0x3617('0x27')][_0x3617('0x29')]);return _0x221574(_0x8ef8f8[_0x3617('0x27')][_0x3617('0x29')]);}else{logger[_0x3617('0x2a')](_0x3617('0x28'),_0x4d4cc3,_0x3617('0x23'));_0x221574(_0x8ef8f8[_0x3617('0x2b')]['message']);}})['catch'](function(_0x274d12){logger[_0x3617('0x27')]('ChatQueue,\x20%s,\x20%s',_0x4d4cc3,_0x274d12);_0x510188(_0x274d12);});});}function respondWithStatusCode(_0x5da2ae,_0x26cc02){_0x26cc02=_0x26cc02||0xcc;return function(_0x387d66){if(_0x387d66){return _0x5da2ae[_0x3617('0x2c')](_0x26cc02);}return _0x5da2ae['status'](_0x26cc02)[_0x3617('0x2d')]();};}function respondWithResult(_0x968016,_0x21d8f6){_0x21d8f6=_0x21d8f6||0xc8;return function(_0x26509b){if(_0x26509b){return _0x968016[_0x3617('0x2e')](_0x21d8f6)[_0x3617('0x2f')](_0x26509b);}};}function respondWithFilteredResult(_0x89fd46,_0x338e81){return function(_0x33af5c){if(_0x33af5c){var _0x1351ae=typeof _0x338e81[_0x3617('0x30')]===_0x3617('0x31')&&typeof _0x338e81[_0x3617('0x32')]==='undefined';var _0x531dbd=_0x33af5c[_0x3617('0x33')];var _0x23a289=_0x1351ae?0x0:_0x338e81['offset'];var _0x378e05=_0x1351ae?_0x33af5c[_0x3617('0x33')]:_0x338e81[_0x3617('0x30')]+_0x338e81[_0x3617('0x32')];var _0x89623c;if(_0x378e05>=_0x531dbd){_0x378e05=_0x531dbd;_0x89623c=0xc8;}else{_0x89623c=0xce;}_0x89fd46[_0x3617('0x2e')](_0x89623c);return _0x89fd46[_0x3617('0x34')](_0x3617('0x35'),_0x23a289+'-'+_0x378e05+'/'+_0x531dbd)['json'](_0x33af5c);}return null;};}function patchUpdates(_0x1dd949){return function(_0x1f2bc0){try{jsonpatch['apply'](_0x1f2bc0,_0x1dd949,!![]);}catch(_0x12a4e9){return BPromise['reject'](_0x12a4e9);}return _0x1f2bc0[_0x3617('0x36')]();};}function saveUpdates(_0x26c010,_0x286ae5){return function(_0x3b6140){if(_0x3b6140){return _0x3b6140[_0x3617('0x37')](_0x26c010)[_0x3617('0x22')](function(_0x2230b3){return _0x2230b3;});}return null;};}function removeEntity(_0x13a1e1,_0x207bdb){return function(_0x107a41){if(_0x107a41){return _0x107a41[_0x3617('0x38')]()[_0x3617('0x22')](function(){var _0x446709=_0x107a41[_0x3617('0x39')]({'plain':!![]});var _0x3229c4=_0x3617('0x3a');return db['UserProfileResource'][_0x3617('0x38')]({'where':{'type':_0x3229c4,'resourceId':_0x446709['id']}})[_0x3617('0x22')](function(){return _0x107a41;});})[_0x3617('0x22')](function(){_0x13a1e1[_0x3617('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x158948,_0x15b3d9){return function(_0x1141bd){if(!_0x1141bd){_0x158948['sendStatus'](0x194);}return _0x1141bd;};}function handleError(_0x27b38b,_0x3089a4){_0x3089a4=_0x3089a4||0x1f4;return function(_0x2e4195){logger[_0x3617('0x27')](_0x2e4195[_0x3617('0x3b')]);if(_0x2e4195['name']){delete _0x2e4195[_0x3617('0x3c')];}_0x27b38b['status'](_0x3089a4)[_0x3617('0x3d')](_0x2e4195);};}exports['index']=function(_0x59f1ea,_0x2036c7){var _0x5991e3={},_0x33da9a={},_0xb027ed={'count':0x0,'rows':[]};var _0x506073=_[_0x3617('0x3e')](db[_0x3617('0x3f')]['rawAttributes'],function(_0x10708e){return{'name':_0x10708e[_0x3617('0x40')],'type':_0x10708e[_0x3617('0x41')][_0x3617('0x42')]};});_0x33da9a[_0x3617('0x43')]=_['map'](_0x506073,'name');_0x33da9a[_0x3617('0x44')]=_[_0x3617('0x45')](_0x59f1ea[_0x3617('0x44')]);_0x33da9a['filters']=_[_0x3617('0x46')](_0x33da9a[_0x3617('0x43')],_0x33da9a[_0x3617('0x44')]);_0x5991e3['attributes']=_[_0x3617('0x46')](_0x33da9a[_0x3617('0x43')],qs[_0x3617('0x47')](_0x59f1ea[_0x3617('0x44')]['fields']));_0x5991e3[_0x3617('0x48')]=_0x5991e3[_0x3617('0x48')][_0x3617('0x49')]?_0x5991e3[_0x3617('0x48')]:_0x33da9a[_0x3617('0x43')];if(!_0x59f1ea['query'][_0x3617('0x4a')]('nolimit')){_0x5991e3[_0x3617('0x32')]=qs[_0x3617('0x32')](_0x59f1ea[_0x3617('0x44')][_0x3617('0x32')]);_0x5991e3['offset']=qs[_0x3617('0x30')](_0x59f1ea[_0x3617('0x44')][_0x3617('0x30')]);}_0x5991e3['order']=qs['sort'](_0x59f1ea['query'][_0x3617('0x4b')]);_0x5991e3['where']=qs[_0x3617('0x4c')](_[_0x3617('0x4d')](_0x59f1ea[_0x3617('0x44')],_0x33da9a[_0x3617('0x4c')]),_0x506073);if(_0x59f1ea['query'][_0x3617('0x4e')]){_0x5991e3['where']=_[_0x3617('0x4f')](_0x5991e3['where'],{'$or':_[_0x3617('0x3e')](_0x506073,function(_0x23bddf){if(_0x23bddf[_0x3617('0x41')]!==_0x3617('0x50')){var _0x33675a={};_0x33675a[_0x23bddf[_0x3617('0x3c')]]={'$like':'%'+_0x59f1ea['query']['filter']+'%'};return _0x33675a;}})});}_0x5991e3=_[_0x3617('0x4f')]({},_0x5991e3,_0x59f1ea[_0x3617('0x51')]);var _0x36e22a={'where':_0x5991e3[_0x3617('0x52')]};return db[_0x3617('0x3f')]['count'](_0x36e22a)[_0x3617('0x22')](function(_0x12f96d){_0xb027ed['count']=_0x12f96d;if(_0x59f1ea[_0x3617('0x44')][_0x3617('0x53')]){_0x5991e3[_0x3617('0x54')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x5991e3);})[_0x3617('0x22')](function(_0x3a66dd){_0xb027ed['rows']=_0x3a66dd;return _0xb027ed;})[_0x3617('0x22')](respondWithFilteredResult(_0x2036c7,_0x5991e3))[_0x3617('0x55')](handleError(_0x2036c7,null));};exports['show']=function(_0x568917,_0x5e4275){var _0x4f972a={'raw':!![],'where':{'id':_0x568917['params']['id']}},_0x2640e0={};_0x2640e0['model']=_[_0x3617('0x45')](db[_0x3617('0x3f')][_0x3617('0x56')]);_0x2640e0[_0x3617('0x44')]=_[_0x3617('0x45')](_0x568917[_0x3617('0x44')]);_0x2640e0[_0x3617('0x4c')]=_[_0x3617('0x46')](_0x2640e0['model'],_0x2640e0[_0x3617('0x44')]);_0x4f972a[_0x3617('0x48')]=_[_0x3617('0x46')](_0x2640e0[_0x3617('0x43')],qs['fields'](_0x568917[_0x3617('0x44')][_0x3617('0x47')]));_0x4f972a['attributes']=_0x4f972a[_0x3617('0x48')]['length']?_0x4f972a[_0x3617('0x48')]:_0x2640e0['model'];if(_0x568917['query'][_0x3617('0x53')]){_0x4f972a[_0x3617('0x54')]=[{'all':!![]}];}_0x4f972a=_[_0x3617('0x4f')]({},_0x4f972a,_0x568917[_0x3617('0x51')]);return db[_0x3617('0x3f')][_0x3617('0x57')](_0x4f972a)[_0x3617('0x22')](handleEntityNotFound(_0x5e4275,null))[_0x3617('0x22')](respondWithResult(_0x5e4275,null))[_0x3617('0x55')](handleError(_0x5e4275,null));};exports[_0x3617('0x58')]=function(_0x2db0a9,_0x5606ef){return db['ChatQueue'][_0x3617('0x58')](_0x2db0a9[_0x3617('0x59')],{})[_0x3617('0x22')](function(_0x54eb1c){var _0x5827d8=_0x2db0a9['user'][_0x3617('0x39')]({'plain':!![]});if(!_0x5827d8)throw new Error(_0x3617('0x5a'));if(_0x5827d8['role']===_0x3617('0x5b')){var _0x3ccad8=_0x54eb1c[_0x3617('0x39')]({'plain':!![]});var _0x18f9a3=_0x3617('0x3a');return db[_0x3617('0x5c')][_0x3617('0x57')]({'where':{'name':_0x18f9a3,'userProfileId':_0x5827d8['userProfileId']},'raw':!![]})['then'](function(_0x58a829){if(_0x58a829&&_0x58a829[_0x3617('0x5d')]===0x0){return db['UserProfileResource'][_0x3617('0x58')]({'name':_0x3ccad8['name'],'resourceId':_0x3ccad8['id'],'type':_0x58a829[_0x3617('0x3c')],'sectionId':_0x58a829['id']},{})['then'](function(){return _0x54eb1c;});}else{return _0x54eb1c;}})[_0x3617('0x55')](function(_0x4e3da7){logger[_0x3617('0x27')](_0x3617('0x5e'),_0x4e3da7);throw _0x4e3da7;});}return _0x54eb1c;})['then'](respondWithResult(_0x5606ef,0xc9))[_0x3617('0x55')](handleError(_0x5606ef,null));};exports['update']=function(_0x5ca879,_0x25d052){if(_0x5ca879[_0x3617('0x59')]['id']){delete _0x5ca879[_0x3617('0x59')]['id'];}return db[_0x3617('0x3f')][_0x3617('0x57')]({'where':{'id':_0x5ca879[_0x3617('0x5f')]['id']}})[_0x3617('0x22')](handleEntityNotFound(_0x25d052,null))[_0x3617('0x22')](saveUpdates(_0x5ca879[_0x3617('0x59')],null))[_0x3617('0x22')](respondWithResult(_0x25d052,null))[_0x3617('0x55')](handleError(_0x25d052,null));};exports[_0x3617('0x38')]=function(_0x25bc19,_0x3fd894){return db[_0x3617('0x3f')][_0x3617('0x57')]({'where':{'id':_0x25bc19['params']['id']}})[_0x3617('0x22')](handleEntityNotFound(_0x3fd894,null))[_0x3617('0x22')](removeEntity(_0x3fd894,null))[_0x3617('0x55')](handleError(_0x3fd894,null));};exports[_0x3617('0x60')]=function(_0x5dff41,_0x5d004e){return db['ChatQueue']['describe']()[_0x3617('0x22')](respondWithResult(_0x5d004e,null))[_0x3617('0x55')](handleError(_0x5d004e,null));};exports[_0x3617('0x61')]=function(_0x50b0aa,_0x581c58,_0x3156e4){var _0x1b9034={'raw':!![],'where':{}},_0x5599e6={},_0x1d655c;return db['ChatQueue'][_0x3617('0x62')]({'where':{'id':_0x50b0aa['params']['id']}})[_0x3617('0x22')](handleEntityNotFound(_0x581c58,null))[_0x3617('0x22')](function(_0x37b4f9){if(_0x37b4f9){_0x1d655c=_0x37b4f9['get']({'plain':!![]});_0x5599e6['model']=_['keys'](db[_0x3617('0x63')][_0x3617('0x56')]);_0x5599e6[_0x3617('0x44')]=_['keys'](_0x50b0aa['query']);_0x5599e6[_0x3617('0x4c')]=_[_0x3617('0x46')](_0x5599e6['model'],_0x5599e6[_0x3617('0x44')]);_0x1b9034[_0x3617('0x48')]=_[_0x3617('0x46')](_0x5599e6['model'],qs[_0x3617('0x47')](_0x50b0aa[_0x3617('0x44')][_0x3617('0x47')]));_0x1b9034[_0x3617('0x48')]=_0x1b9034[_0x3617('0x48')][_0x3617('0x49')]?_0x1b9034['attributes']:_0x5599e6[_0x3617('0x43')];if(!_0x50b0aa['query'][_0x3617('0x4a')](_0x3617('0x64'))){_0x1b9034[_0x3617('0x32')]=qs[_0x3617('0x32')](_0x50b0aa[_0x3617('0x44')]['limit']);_0x1b9034['offset']=qs[_0x3617('0x30')](_0x50b0aa['query'][_0x3617('0x30')]);}_0x1b9034[_0x3617('0x65')]=qs[_0x3617('0x4b')](_0x50b0aa[_0x3617('0x44')][_0x3617('0x4b')]);_0x1b9034['where']=qs['filters'](_[_0x3617('0x4d')](_0x50b0aa[_0x3617('0x44')],_0x5599e6[_0x3617('0x4c')]));_0x1b9034[_0x3617('0x52')][_0x3617('0x66')]=_0x37b4f9['id'];if(_0x50b0aa[_0x3617('0x44')][_0x3617('0x4e')]){_0x1b9034[_0x3617('0x52')]=_[_0x3617('0x4f')](_0x1b9034[_0x3617('0x52')],{'$or':_[_0x3617('0x3e')](_0x1b9034[_0x3617('0x48')],function(_0x2af645){var _0x2512e4={};_0x2512e4[_0x2af645]={'$like':'%'+_0x50b0aa[_0x3617('0x44')][_0x3617('0x4e')]+'%'};return _0x2512e4;})});}_0x1b9034=_[_0x3617('0x4f')]({},_0x1b9034,_0x50b0aa[_0x3617('0x51')]);return db[_0x3617('0x63')][_0x3617('0x67')](_0x1b9034);}})[_0x3617('0x22')](function(_0x377325){if(_0x377325){return db['User'][_0x3617('0x68')]({'where':{'id':_[_0x3617('0x3e')](_0x377325,_0x3617('0x69')),'role':_0x3617('0x6a')},'attributes':['id',_0x3617('0x3c'),_0x3617('0x6b'),_0x3617('0x6c'),_0x3617('0x6d')]});}})['then'](function(_0x4aa6ff){if(_0x4aa6ff){return{'count':_0x4aa6ff['count'],'rows':_[_0x3617('0x3e')](_0x4aa6ff['rows'],function(_0x3e0926){return{'membername':_0x3e0926[_0x3617('0x3c')],'UserId':_0x3e0926['id'],'queue_name':_0x1d655c[_0x3617('0x3c')],'ChatQueueId':_0x1d655c['id'],'interface':util[_0x3617('0x6e')]('%s/%s',_0x3617('0x6f'),_0x3e0926['name']),'penalty':0x0,'paused':_0x3e0926['chatPause'],'createdAt':_0x3e0926[_0x3617('0x6d')],'updatedAt':_0x3e0926[_0x3617('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3617('0x22')](respondWithFilteredResult(_0x581c58,_0x1b9034))[_0x3617('0x55')](handleError(_0x581c58,null));};exports[_0x3617('0x70')]=function(_0x3c231d,_0x445363,_0x580f72){var _0x22b8fd={};var _0x400ce1={};var _0xc7d929;var _0x184dea;return db[_0x3617('0x3f')][_0x3617('0x62')]({'where':{'id':_0x3c231d[_0x3617('0x5f')]['id']}})['then'](handleEntityNotFound(_0x445363,null))[_0x3617('0x22')](function(_0x14852e){if(_0x14852e){_0xc7d929=_0x14852e;_0x400ce1['model']=_[_0x3617('0x45')](db[_0x3617('0x71')][_0x3617('0x56')]);_0x400ce1[_0x3617('0x44')]=_['keys'](_0x3c231d[_0x3617('0x44')]);_0x400ce1[_0x3617('0x4c')]=_['intersection'](_0x400ce1[_0x3617('0x43')],_0x400ce1[_0x3617('0x44')]);_0x22b8fd[_0x3617('0x48')]=_['intersection'](_0x400ce1[_0x3617('0x43')],qs['fields'](_0x3c231d[_0x3617('0x44')]['fields']));_0x22b8fd[_0x3617('0x48')]=_0x22b8fd[_0x3617('0x48')]['length']?_0x22b8fd['attributes']:_0x400ce1[_0x3617('0x43')];_0x22b8fd[_0x3617('0x65')]=qs[_0x3617('0x4b')](_0x3c231d[_0x3617('0x44')][_0x3617('0x4b')]);_0x22b8fd[_0x3617('0x52')]=qs[_0x3617('0x4c')](_[_0x3617('0x4d')](_0x3c231d[_0x3617('0x44')],_0x400ce1[_0x3617('0x4c')]));if(_0x3c231d[_0x3617('0x44')]['filter']){_0x22b8fd[_0x3617('0x52')]=_[_0x3617('0x4f')](_0x22b8fd[_0x3617('0x52')],{'$or':_[_0x3617('0x3e')](_0x22b8fd[_0x3617('0x48')],function(_0x37e91b){var _0x1b43f6={};_0x1b43f6[_0x37e91b]={'$like':'%'+_0x3c231d[_0x3617('0x44')]['filter']+'%'};return _0x1b43f6;})});}_0x22b8fd=_['merge']({},_0x22b8fd,_0x3c231d[_0x3617('0x51')]);return _0xc7d929[_0x3617('0x70')](_0x22b8fd);}})[_0x3617('0x22')](function(_0x225bfc){if(_0x225bfc){_0x184dea=_0x225bfc[_0x3617('0x49')];if(!_0x3c231d[_0x3617('0x44')][_0x3617('0x4a')]('nolimit')){_0x22b8fd[_0x3617('0x32')]=qs[_0x3617('0x32')](_0x3c231d[_0x3617('0x44')][_0x3617('0x32')]);_0x22b8fd[_0x3617('0x30')]=qs[_0x3617('0x30')](_0x3c231d[_0x3617('0x44')][_0x3617('0x30')]);}return _0xc7d929['getTeams'](_0x22b8fd);}})['then'](function(_0x32f20c){if(_0x32f20c){return _0x32f20c?{'count':_0x184dea,'rows':_0x32f20c}:null;}})['then'](respondWithResult(_0x445363,null))[_0x3617('0x55')](handleError(_0x445363,null));};exports[_0x3617('0x72')]=function(_0x531195,_0x36d301,_0x3f9dd1){var _0xdbb19e=_0x531195[_0x3617('0x59')][_0x3617('0x73')];return db[_0x3617('0x71')][_0x3617('0x67')]({'where':{'id':_0xdbb19e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3617('0x74'),'attributes':['id',_0x3617('0x3c'),'online',_0x3617('0x75'),_0x3617('0x76')],'raw':!![]}]})['then'](function(_0x35709c){if(_0x35709c){var _0x2e4eb9=_[_0x3617('0x77')](_0x35709c,function(_0x2acf80){var _0x4da849=_0x2acf80[_0x3617('0x39')]({'plain':!![]});return _0x4da849[_0x3617('0x74')];});return db[_0x3617('0x3f')][_0x3617('0x57')]({'where':{'id':_0x531195[_0x3617('0x5f')]['id']}})[_0x3617('0x22')](function(_0x28515d){return db[_0x3617('0x78')][_0x3617('0x79')](function(_0x2d86f6){return _0x28515d[_0x3617('0x72')](_0xdbb19e,{'transaction':_0x2d86f6})[_0x3617('0x22')](function(){return BPromise[_0x3617('0x7a')](_0x2e4eb9,function(_0x50c8b4){return db[_0x3617('0x63')]['findOrCreate']({'where':{'UserId':_0x50c8b4['id'],'ChatQueueId':_0x531195['params']['id']},'transaction':_0x2d86f6});});})['then'](function(){_0x2e4eb9[_0x3617('0x7b')](function(_0x1a7608){socket[_0x3617('0x7c')]('userChatQueue:save',{'UserId':_0x1a7608['id'],'ChatQueueId':_0x28515d['id']});});});});});}})['then'](respondWithStatusCode(_0x36d301,null))[_0x3617('0x55')](handleError(_0x36d301,null));};exports['removeTeams']=function(_0x5be680,_0xa01f70,_0x3ad502){return db[_0x3617('0x71')][_0x3617('0x67')]({'where':{'id':_0x5be680[_0x3617('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3617('0x7d')],'as':_0x3617('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa01f70,null))[_0x3617('0x22')](function(_0x514381){var _0x4581ec=_[_0x3617('0x3e')](_0x514381,'id');var _0x4c73f9=[];var _0x3a7aec=[];var _0x5cb41a=squel[_0x3617('0x7e')]();_0x5cb41a[_0x3617('0x7f')]('tq.TeamId')['from']('team_has_chat_queues','tq')[_0x3617('0x80')](_0x3617('0x81'),'ut',_0x3617('0x82'))[_0x3617('0x52')](_0x3617('0x83'),_0x5be680[_0x3617('0x5f')]['id']);for(var _0x40abb6=0x0;_0x40abb6<_0x514381[_0x3617('0x49')];_0x40abb6+=0x1){let _0x53e441=_0x514381[_0x40abb6];for(var _0x5201d1=0x0;_0x5201d1<_0x53e441['Agents'][_0x3617('0x49')];_0x5201d1+=0x1){let _0xad2459=_0x53e441[_0x3617('0x74')][_0x5201d1];var _0xcf5341=_0x5cb41a[_0x3617('0x84')]();_0xcf5341[_0x3617('0x52')](_0x3617('0x85'),_0xad2459['id']);_0x3a7aec[_0x3617('0x86')](db['sequelize'][_0x3617('0x44')](_0xcf5341['toString'](),{'type':db[_0x3617('0x78')][_0x3617('0x87')][_0x3617('0x88')]})[_0x3617('0x22')](function(_0x2d6591){if(_0x2d6591[_0x3617('0x49')]===0x1){return _0xad2459['id'];}else{var _0x1fdc2e=_[_0x3617('0x89')](_[_0x3617('0x3e')](_0x2d6591,_0x3617('0x8a')),function(_0x592471){return _[_0x3617('0x8b')](_0x4581ec,_0x592471);});if(_0x1fdc2e){return _0xad2459['id'];}}}));}}return BPromise['all'](_0x3a7aec)[_0x3617('0x22')](function(_0x807730){_0x4c73f9=_(_0x4c73f9)[_0x3617('0x8c')](_0x807730)[_0x3617('0x8d')]()['value']();return db['ChatQueue']['find']({'where':{'id':_0x5be680[_0x3617('0x5f')]['id']}})[_0x3617('0x22')](function(_0x4b8863){return db[_0x3617('0x78')]['transaction'](function(_0x855bbf){return _0x4b8863[_0x3617('0x8e')](_0x5be680['query'][_0x3617('0x73')],{'transaction':_0x855bbf})[_0x3617('0x22')](function(){if(!_[_0x3617('0x8f')](_0x4c73f9)){return _0x4b8863[_0x3617('0x90')](_0x4c73f9,{'transaction':_0x855bbf});}})[_0x3617('0x22')](function(){_0x4c73f9[_0x3617('0x7b')](function(_0x53d363){socket['emit'](_0x3617('0x91'),{'UserId':_0x53d363,'ChatQueueId':_0x4b8863['id']});});});});});});})[_0x3617('0x22')](respondWithStatusCode(_0xa01f70,null))[_0x3617('0x55')](handleError(_0xa01f70,null));};exports[_0x3617('0x92')]=function(_0x52aea7,_0x2b88c3,_0x1481bb){return db[_0x3617('0x3f')][_0x3617('0x57')]({'where':{'id':_0x52aea7['params']['id']}})[_0x3617('0x22')](handleEntityNotFound(_0x2b88c3,null))[_0x3617('0x22')](function(_0x173c35){if(_0x173c35){return _0x173c35[_0x3617('0x92')](_0x52aea7['body'][_0x3617('0x73')],_[_0x3617('0x93')](_0x52aea7['body'],[_0x3617('0x73'),'id'])||{})[_0x3617('0x94')](function(_0x5d9abc){for(var _0x1ac262=0x0;_0x1ac262<_0x52aea7[_0x3617('0x59')][_0x3617('0x73')][_0x3617('0x49')];_0x1ac262+=0x1){socket[_0x3617('0x7c')](_0x3617('0x95'),{'UserId':Number(_0x52aea7[_0x3617('0x59')][_0x3617('0x73')][_0x1ac262]),'ChatQueueId':Number(_0x52aea7['params']['id'])});}return _0x5d9abc;});}})[_0x3617('0x22')](respondWithResult(_0x2b88c3,null))[_0x3617('0x55')](handleError(_0x2b88c3,null));};exports[_0x3617('0x90')]=function(_0x212317,_0x4fcc5e,_0x2c0d9b){return db[_0x3617('0x3f')]['find']({'where':{'id':_0x212317[_0x3617('0x5f')]['id']}})[_0x3617('0x22')](handleEntityNotFound(_0x4fcc5e,null))[_0x3617('0x22')](function(_0x5bddca){if(_0x5bddca){return _0x5bddca[_0x3617('0x90')](_0x212317[_0x3617('0x44')][_0x3617('0x73')])[_0x3617('0x22')](function(){if(_[_0x3617('0x96')](_0x212317[_0x3617('0x44')]['ids'])){for(var _0x1aa1eb=0x0;_0x1aa1eb<_0x212317[_0x3617('0x44')]['ids'][_0x3617('0x49')];_0x1aa1eb+=0x1){socket[_0x3617('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x212317[_0x3617('0x44')]['ids'][_0x1aa1eb]),'ChatQueueId':Number(_0x212317['params']['id'])});}}else{socket[_0x3617('0x7c')](_0x3617('0x91'),{'UserId':Number(_0x212317['query'][_0x3617('0x73')]),'ChatQueueId':Number(_0x212317[_0x3617('0x5f')]['id'])});}});}})[_0x3617('0x22')](respondWithStatusCode(_0x4fcc5e,null))[_0x3617('0x55')](handleError(_0x4fcc5e,null));};exports['getAgents']=function(_0x1af2a2,_0x4d8d71,_0x42c0b6){var _0x386506={};var _0x5920d3={};var _0xff65b8;var _0x2ef4c3;return db[_0x3617('0x3f')][_0x3617('0x62')]({'where':{'id':_0x1af2a2['params']['id']}})['then'](handleEntityNotFound(_0x4d8d71,null))['then'](function(_0x5b2f81){if(_0x5b2f81){_0xff65b8=_0x5b2f81;_0x5920d3[_0x3617('0x43')]=_[_0x3617('0x45')](db['User'][_0x3617('0x56')]);_0x5920d3['query']=_[_0x3617('0x45')](_0x1af2a2[_0x3617('0x44')]);_0x5920d3[_0x3617('0x4c')]=_[_0x3617('0x46')](_0x5920d3[_0x3617('0x43')],_0x5920d3[_0x3617('0x44')]);_0x386506[_0x3617('0x48')]=_[_0x3617('0x46')](_0x5920d3['model'],qs['fields'](_0x1af2a2[_0x3617('0x44')][_0x3617('0x47')]));_0x386506[_0x3617('0x48')]=_0x386506[_0x3617('0x48')][_0x3617('0x49')]?_0x386506['attributes']:_0x5920d3['model'];_0x386506[_0x3617('0x65')]=qs[_0x3617('0x4b')](_0x1af2a2[_0x3617('0x44')]['sort']);_0x386506[_0x3617('0x52')]=qs['filters'](_[_0x3617('0x4d')](_0x1af2a2[_0x3617('0x44')],_0x5920d3['filters']));if(_0x1af2a2[_0x3617('0x44')][_0x3617('0x4e')]){_0x386506[_0x3617('0x52')]=_[_0x3617('0x4f')](_0x386506[_0x3617('0x52')],{'$or':_[_0x3617('0x3e')](_0x386506[_0x3617('0x48')],function(_0x3cdbe4){var _0x5dd745={};_0x5dd745[_0x3cdbe4]={'$like':'%'+_0x1af2a2[_0x3617('0x44')]['filter']+'%'};return _0x5dd745;})});}_0x386506=_['merge']({},_0x386506,_0x1af2a2[_0x3617('0x51')]);return _0xff65b8[_0x3617('0x97')](_0x386506);}})[_0x3617('0x22')](function(_0x4c96c4){if(_0x4c96c4){_0x2ef4c3=_0x4c96c4[_0x3617('0x49')];if(!_0x1af2a2[_0x3617('0x44')][_0x3617('0x4a')](_0x3617('0x64'))){_0x386506['limit']=qs[_0x3617('0x32')](_0x1af2a2[_0x3617('0x44')]['limit']);_0x386506[_0x3617('0x30')]=qs[_0x3617('0x30')](_0x1af2a2[_0x3617('0x44')][_0x3617('0x30')]);}return _0xff65b8[_0x3617('0x97')](_0x386506);}})[_0x3617('0x22')](function(_0x2509e5){if(_0x2509e5){return _0x2509e5?{'count':_0x2ef4c3,'rows':_0x2509e5}:null;}})[_0x3617('0x22')](respondWithResult(_0x4d8d71,null))['catch'](handleError(_0x4d8d71,null));}; \ No newline at end of file +var _0xefab=['../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','ChatQueues','UserProfileResource','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueue','includeAll','include','findAll','rows','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserChatQueue','nolimit','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','ids','Agents','online','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','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','../../components/parsers/advancedSearch','api'];(function(_0xa27be,_0x2970dc){var _0x33d851=function(_0x2fdb0c){while(--_0x2fdb0c){_0xa27be['push'](_0xa27be['shift']());}};_0x33d851(++_0x2970dc);}(_0xefab,0x1a5));var _0xbefa=function(_0x2df2eb,_0x3959a0){_0x2df2eb=_0x2df2eb-0x0;var _0xa5abb9=_0xefab[_0x2df2eb];return _0xa5abb9;};'use strict';var emlformat=require(_0xbefa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbefa('0x1'));var jsonpatch=require(_0xbefa('0x2'));var rp=require('request-promise');var moment=require(_0xbefa('0x3'));var BPromise=require(_0xbefa('0x4'));var Mustache=require(_0xbefa('0x5'));var util=require(_0xbefa('0x6'));var path=require(_0xbefa('0x7'));var sox=require(_0xbefa('0x8'));var csv=require(_0xbefa('0x9'));var ejs=require(_0xbefa('0xa'));var fs=require('fs');var fs_extra=require(_0xbefa('0xb'));var _=require(_0xbefa('0xc'));var squel=require('squel');var crypto=require(_0xbefa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbefa('0xe'));var toCsv=require(_0xbefa('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbefa('0xf'));var authService=require(_0xbefa('0x10'));var qs=require(_0xbefa('0x11'));var as=require(_0xbefa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbefa('0x13'));var utils=require(_0xbefa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbefa('0x15'));var db=require(_0xbefa('0x16'))['db'];config['redis']=_[_0xbefa('0x17')](config[_0xbefa('0x18')],{'host':_0xbefa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbefa('0x18')]));require(_0xbefa('0x1a'))[_0xbefa('0x1b')](socket);var jayson=require(_0xbefa('0x1c'));var client=jayson['client'][_0xbefa('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x10f06a,_0x13b105,_0x23e0a2,_0x381d03){return new BPromise(function(_0x2a1267,_0x249abc){var _0x2962b4=_0x381d03||client;return _0x2962b4[_0xbefa('0x1e')](_0x10f06a,_0x23e0a2)['then'](function(_0x3f339a){logger['info'](_0xbefa('0x1f'),_0x13b105,_0xbefa('0x20'));logger[_0xbefa('0x21')](_0xbefa('0x22'),_0x13b105,_0xbefa('0x20'),JSON[_0xbefa('0x23')](_0x3f339a));if(_0x3f339a[_0xbefa('0x24')]){if(_0x3f339a['error']['code']===0x1f4){logger[_0xbefa('0x24')]('ChatQueue,\x20%s,\x20%s',_0x13b105,_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);return _0x249abc(_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);}logger[_0xbefa('0x24')]('ChatQueue,\x20%s,\x20%s',_0x13b105,_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);return _0x2a1267(_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);}else{logger[_0xbefa('0x26')]('ChatQueue,\x20%s,\x20%s',_0x13b105,'request\x20sent');_0x2a1267(_0x3f339a['result']['message']);}})[_0xbefa('0x27')](function(_0x52ec0f){logger[_0xbefa('0x24')](_0xbefa('0x1f'),_0x13b105,_0x52ec0f);_0x249abc(_0x52ec0f);});});}function respondWithStatusCode(_0x527c51,_0x3c2b51){_0x3c2b51=_0x3c2b51||0xcc;return function(_0xdc1f4e){if(_0xdc1f4e){return _0x527c51['sendStatus'](_0x3c2b51);}return _0x527c51[_0xbefa('0x28')](_0x3c2b51)['end']();};}function respondWithResult(_0x47e7e7,_0x1f19f5){_0x1f19f5=_0x1f19f5||0xc8;return function(_0x54b5c9){if(_0x54b5c9){return _0x47e7e7['status'](_0x1f19f5)['json'](_0x54b5c9);}};}function respondWithFilteredResult(_0x632ecb,_0x1bbeff){return function(_0x4decf8){if(_0x4decf8){var _0xcf584b=typeof _0x1bbeff[_0xbefa('0x29')]==='undefined'&&typeof _0x1bbeff[_0xbefa('0x2a')]===_0xbefa('0x2b');var _0x58e1d6=_0x4decf8['count'];var _0x2f7025=_0xcf584b?0x0:_0x1bbeff[_0xbefa('0x29')];var _0x1109d9=_0xcf584b?_0x4decf8[_0xbefa('0x2c')]:_0x1bbeff[_0xbefa('0x29')]+_0x1bbeff[_0xbefa('0x2a')];var _0x68b5c6;if(_0x1109d9>=_0x58e1d6){_0x1109d9=_0x58e1d6;_0x68b5c6=0xc8;}else{_0x68b5c6=0xce;}_0x632ecb['status'](_0x68b5c6);return _0x632ecb['set'](_0xbefa('0x2d'),_0x2f7025+'-'+_0x1109d9+'/'+_0x58e1d6)['json'](_0x4decf8);}return null;};}function patchUpdates(_0x4f93a3){return function(_0x57f08e){try{jsonpatch[_0xbefa('0x2e')](_0x57f08e,_0x4f93a3,!![]);}catch(_0x288600){return BPromise[_0xbefa('0x2f')](_0x288600);}return _0x57f08e[_0xbefa('0x30')]();};}function saveUpdates(_0x2c4faa,_0x2a611d){return function(_0x209b67){if(_0x209b67){return _0x209b67['update'](_0x2c4faa)['then'](function(_0x302f7a){return _0x302f7a;});}return null;};}function removeEntity(_0x2ecadb,_0x850c8d){return function(_0x56b417){if(_0x56b417){return _0x56b417[_0xbefa('0x31')]()[_0xbefa('0x32')](function(){var _0x52d540=_0x56b417['get']({'plain':!![]});var _0x36b1dc=_0xbefa('0x33');return db[_0xbefa('0x34')]['destroy']({'where':{'type':_0x36b1dc,'resourceId':_0x52d540['id']}})['then'](function(){return _0x56b417;});})['then'](function(){_0x2ecadb[_0xbefa('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0de81,_0x1206a9){return function(_0x4112d4){if(!_0x4112d4){_0xd0de81[_0xbefa('0x35')](0x194);}return _0x4112d4;};}function handleError(_0x39ba45,_0x3af5a3){_0x3af5a3=_0x3af5a3||0x1f4;return function(_0xdfda59){logger[_0xbefa('0x24')](_0xdfda59['stack']);if(_0xdfda59['name']){delete _0xdfda59[_0xbefa('0x36')];}_0x39ba45[_0xbefa('0x28')](_0x3af5a3)[_0xbefa('0x37')](_0xdfda59);};}exports[_0xbefa('0x38')]=function(_0x3d6446,_0x363c0e){var _0x292282={},_0x323dda={},_0x2b5b6d={'count':0x0,'rows':[]};var _0x3eca3e=_[_0xbefa('0x39')](db['ChatQueue'][_0xbefa('0x3a')],function(_0x939e55){return{'name':_0x939e55[_0xbefa('0x3b')],'type':_0x939e55[_0xbefa('0x3c')][_0xbefa('0x3d')]};});_0x323dda['model']=_[_0xbefa('0x39')](_0x3eca3e,_0xbefa('0x36'));_0x323dda['query']=_[_0xbefa('0x3e')](_0x3d6446[_0xbefa('0x3f')]);_0x323dda[_0xbefa('0x40')]=_[_0xbefa('0x41')](_0x323dda[_0xbefa('0x42')],_0x323dda[_0xbefa('0x3f')]);_0x292282[_0xbefa('0x43')]=_['intersection'](_0x323dda[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x44')]));_0x292282[_0xbefa('0x43')]=_0x292282[_0xbefa('0x43')][_0xbefa('0x45')]?_0x292282[_0xbefa('0x43')]:_0x323dda[_0xbefa('0x42')];if(!_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x46')]('nolimit')){_0x292282[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x292282[_0xbefa('0x29')]=qs[_0xbefa('0x29')](_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x29')]);}_0x292282['order']=qs[_0xbefa('0x47')](_0x3d6446['query'][_0xbefa('0x47')]);_0x292282[_0xbefa('0x48')]=qs['filters'](_[_0xbefa('0x49')](_0x3d6446[_0xbefa('0x3f')],_0x323dda[_0xbefa('0x40')]),_0x3eca3e);if(_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x4a')]){_0x292282['where']=_[_0xbefa('0x4b')](_0x292282[_0xbefa('0x48')],{'$or':_[_0xbefa('0x39')](_0x3eca3e,function(_0x5560cf){if(_0x5560cf[_0xbefa('0x3c')]!==_0xbefa('0x4c')){var _0x17f91c={};_0x17f91c[_0x5560cf['name']]={'$like':'%'+_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x4a')]+'%'};return _0x17f91c;}})});}_0x292282=_[_0xbefa('0x4b')]({},_0x292282,_0x3d6446[_0xbefa('0x4d')]);var _0xc44bb3={'where':_0x292282[_0xbefa('0x48')]};return db[_0xbefa('0x4e')][_0xbefa('0x2c')](_0xc44bb3)[_0xbefa('0x32')](function(_0x202653){_0x2b5b6d[_0xbefa('0x2c')]=_0x202653;if(_0x3d6446[_0xbefa('0x3f')][_0xbefa('0x4f')]){_0x292282[_0xbefa('0x50')]=[{'all':!![]}];}return db['ChatQueue'][_0xbefa('0x51')](_0x292282);})[_0xbefa('0x32')](function(_0x261edc){_0x2b5b6d[_0xbefa('0x52')]=_0x261edc;return _0x2b5b6d;})[_0xbefa('0x32')](respondWithFilteredResult(_0x363c0e,_0x292282))[_0xbefa('0x27')](handleError(_0x363c0e,null));};exports[_0xbefa('0x53')]=function(_0x289ee1,_0x40e34b){var _0x3f3ecb={'raw':!![],'where':{'id':_0x289ee1[_0xbefa('0x54')]['id']}},_0x29aebc={};_0x29aebc[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db['ChatQueue'][_0xbefa('0x3a')]);_0x29aebc[_0xbefa('0x3f')]=_[_0xbefa('0x3e')](_0x289ee1['query']);_0x29aebc[_0xbefa('0x40')]=_['intersection'](_0x29aebc[_0xbefa('0x42')],_0x29aebc[_0xbefa('0x3f')]);_0x3f3ecb[_0xbefa('0x43')]=_[_0xbefa('0x41')](_0x29aebc[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x289ee1['query'][_0xbefa('0x44')]));_0x3f3ecb[_0xbefa('0x43')]=_0x3f3ecb[_0xbefa('0x43')]['length']?_0x3f3ecb[_0xbefa('0x43')]:_0x29aebc['model'];if(_0x289ee1[_0xbefa('0x3f')][_0xbefa('0x4f')]){_0x3f3ecb[_0xbefa('0x50')]=[{'all':!![]}];}_0x3f3ecb=_[_0xbefa('0x4b')]({},_0x3f3ecb,_0x289ee1['options']);return db['ChatQueue']['find'](_0x3f3ecb)[_0xbefa('0x32')](handleEntityNotFound(_0x40e34b,null))['then'](respondWithResult(_0x40e34b,null))['catch'](handleError(_0x40e34b,null));};exports[_0xbefa('0x55')]=function(_0x589276,_0xcadaa){return db['ChatQueue']['create'](_0x589276['body'],{})[_0xbefa('0x32')](function(_0x51dbf6){var _0x415b3b=_0x589276[_0xbefa('0x56')][_0xbefa('0x57')]({'plain':!![]});if(!_0x415b3b)throw new Error(_0xbefa('0x58'));if(_0x415b3b[_0xbefa('0x59')]===_0xbefa('0x56')){var _0x39664a=_0x51dbf6[_0xbefa('0x57')]({'plain':!![]});var _0xeb0862=_0xbefa('0x33');return db['UserProfileSection'][_0xbefa('0x5a')]({'where':{'name':_0xeb0862,'userProfileId':_0x415b3b[_0xbefa('0x5b')]},'raw':!![]})[_0xbefa('0x32')](function(_0x107f60){if(_0x107f60&&_0x107f60['autoAssociation']===0x0){return db[_0xbefa('0x34')][_0xbefa('0x55')]({'name':_0x39664a[_0xbefa('0x36')],'resourceId':_0x39664a['id'],'type':_0x107f60[_0xbefa('0x36')],'sectionId':_0x107f60['id']},{})[_0xbefa('0x32')](function(){return _0x51dbf6;});}else{return _0x51dbf6;}})[_0xbefa('0x27')](function(_0x8cf864){logger[_0xbefa('0x24')](_0xbefa('0x5c'),_0x8cf864);throw _0x8cf864;});}return _0x51dbf6;})[_0xbefa('0x32')](respondWithResult(_0xcadaa,0xc9))[_0xbefa('0x27')](handleError(_0xcadaa,null));};exports[_0xbefa('0x5d')]=function(_0x2d3017,_0xb1907b){if(_0x2d3017['body']['id']){delete _0x2d3017[_0xbefa('0x5e')]['id'];}return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x2d3017[_0xbefa('0x54')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0xb1907b,null))[_0xbefa('0x32')](saveUpdates(_0x2d3017[_0xbefa('0x5e')],null))[_0xbefa('0x32')](respondWithResult(_0xb1907b,null))[_0xbefa('0x27')](handleError(_0xb1907b,null));};exports['destroy']=function(_0x5170bd,_0x4a386b){return db[_0xbefa('0x4e')]['find']({'where':{'id':_0x5170bd['params']['id']}})['then'](handleEntityNotFound(_0x4a386b,null))[_0xbefa('0x32')](removeEntity(_0x4a386b,null))[_0xbefa('0x27')](handleError(_0x4a386b,null));};exports['describe']=function(_0x39ec5c,_0x52b931){return db[_0xbefa('0x4e')][_0xbefa('0x5f')]()[_0xbefa('0x32')](respondWithResult(_0x52b931,null))[_0xbefa('0x27')](handleError(_0x52b931,null));};exports[_0xbefa('0x60')]=function(_0x531938,_0x4b3cff,_0x473d37){var _0x38e8d1={'raw':!![],'where':{}},_0x572f3f={},_0x421d7f;return db['ChatQueue']['findOne']({'where':{'id':_0x531938[_0xbefa('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b3cff,null))[_0xbefa('0x32')](function(_0x1c3769){if(_0x1c3769){_0x421d7f=_0x1c3769[_0xbefa('0x57')]({'plain':!![]});_0x572f3f[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db[_0xbefa('0x61')]['rawAttributes']);_0x572f3f[_0xbefa('0x3f')]=_['keys'](_0x531938[_0xbefa('0x3f')]);_0x572f3f[_0xbefa('0x40')]=_[_0xbefa('0x41')](_0x572f3f['model'],_0x572f3f[_0xbefa('0x3f')]);_0x38e8d1[_0xbefa('0x43')]=_[_0xbefa('0x41')](_0x572f3f[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x531938[_0xbefa('0x3f')][_0xbefa('0x44')]));_0x38e8d1['attributes']=_0x38e8d1[_0xbefa('0x43')][_0xbefa('0x45')]?_0x38e8d1[_0xbefa('0x43')]:_0x572f3f[_0xbefa('0x42')];if(!_0x531938[_0xbefa('0x3f')][_0xbefa('0x46')](_0xbefa('0x62'))){_0x38e8d1[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x531938[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x38e8d1[_0xbefa('0x29')]=qs['offset'](_0x531938['query'][_0xbefa('0x29')]);}_0x38e8d1['order']=qs[_0xbefa('0x47')](_0x531938[_0xbefa('0x3f')][_0xbefa('0x47')]);_0x38e8d1[_0xbefa('0x48')]=qs[_0xbefa('0x40')](_[_0xbefa('0x49')](_0x531938[_0xbefa('0x3f')],_0x572f3f[_0xbefa('0x40')]));_0x38e8d1[_0xbefa('0x48')][_0xbefa('0x63')]=_0x1c3769['id'];if(_0x531938[_0xbefa('0x3f')][_0xbefa('0x4a')]){_0x38e8d1['where']=_[_0xbefa('0x4b')](_0x38e8d1[_0xbefa('0x48')],{'$or':_[_0xbefa('0x39')](_0x38e8d1[_0xbefa('0x43')],function(_0x1b06dd){var _0x133525={};_0x133525[_0x1b06dd]={'$like':'%'+_0x531938[_0xbefa('0x3f')][_0xbefa('0x4a')]+'%'};return _0x133525;})});}_0x38e8d1=_[_0xbefa('0x4b')]({},_0x38e8d1,_0x531938['options']);return db[_0xbefa('0x61')][_0xbefa('0x51')](_0x38e8d1);}})[_0xbefa('0x32')](function(_0x3efad2){if(_0x3efad2){return db[_0xbefa('0x64')][_0xbefa('0x65')]({'where':{'id':_['map'](_0x3efad2,_0xbefa('0x66')),'role':_0xbefa('0x67')},'attributes':['id',_0xbefa('0x36'),_0xbefa('0x68'),'updatedAt',_0xbefa('0x69')]});}})['then'](function(_0x47fd0a){if(_0x47fd0a){return{'count':_0x47fd0a[_0xbefa('0x2c')],'rows':_[_0xbefa('0x39')](_0x47fd0a['rows'],function(_0x323093){return{'membername':_0x323093['name'],'UserId':_0x323093['id'],'queue_name':_0x421d7f[_0xbefa('0x36')],'ChatQueueId':_0x421d7f['id'],'interface':util[_0xbefa('0x6a')](_0xbefa('0x6b'),_0xbefa('0x6c'),_0x323093[_0xbefa('0x36')]),'penalty':0x0,'paused':_0x323093[_0xbefa('0x68')],'createdAt':_0x323093['createdAt'],'updatedAt':_0x323093[_0xbefa('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbefa('0x32')](respondWithFilteredResult(_0x4b3cff,_0x38e8d1))['catch'](handleError(_0x4b3cff,null));};exports[_0xbefa('0x6e')]=function(_0x3921d9,_0x11d006,_0x306632){var _0x59f4cb={};var _0xe4ee1={};var _0x5ca1bc;var _0xd1397c;return db[_0xbefa('0x4e')][_0xbefa('0x6f')]({'where':{'id':_0x3921d9[_0xbefa('0x54')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x11d006,null))[_0xbefa('0x32')](function(_0x2d3f51){if(_0x2d3f51){_0x5ca1bc=_0x2d3f51;_0xe4ee1[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db[_0xbefa('0x70')][_0xbefa('0x3a')]);_0xe4ee1[_0xbefa('0x3f')]=_['keys'](_0x3921d9[_0xbefa('0x3f')]);_0xe4ee1[_0xbefa('0x40')]=_[_0xbefa('0x41')](_0xe4ee1['model'],_0xe4ee1['query']);_0x59f4cb['attributes']=_[_0xbefa('0x41')](_0xe4ee1[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x3921d9['query'][_0xbefa('0x44')]));_0x59f4cb[_0xbefa('0x43')]=_0x59f4cb[_0xbefa('0x43')][_0xbefa('0x45')]?_0x59f4cb['attributes']:_0xe4ee1[_0xbefa('0x42')];_0x59f4cb[_0xbefa('0x71')]=qs[_0xbefa('0x47')](_0x3921d9['query'][_0xbefa('0x47')]);_0x59f4cb[_0xbefa('0x48')]=qs[_0xbefa('0x40')](_[_0xbefa('0x49')](_0x3921d9[_0xbefa('0x3f')],_0xe4ee1[_0xbefa('0x40')]));if(_0x3921d9['query'][_0xbefa('0x4a')]){_0x59f4cb[_0xbefa('0x48')]=_[_0xbefa('0x4b')](_0x59f4cb[_0xbefa('0x48')],{'$or':_['map'](_0x59f4cb[_0xbefa('0x43')],function(_0x40b9f1){var _0x181fcd={};_0x181fcd[_0x40b9f1]={'$like':'%'+_0x3921d9['query'][_0xbefa('0x4a')]+'%'};return _0x181fcd;})});}_0x59f4cb=_[_0xbefa('0x4b')]({},_0x59f4cb,_0x3921d9[_0xbefa('0x4d')]);return _0x5ca1bc[_0xbefa('0x6e')](_0x59f4cb);}})[_0xbefa('0x32')](function(_0x1c4303){if(_0x1c4303){_0xd1397c=_0x1c4303[_0xbefa('0x45')];if(!_0x3921d9[_0xbefa('0x3f')][_0xbefa('0x46')]('nolimit')){_0x59f4cb[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x3921d9[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x59f4cb[_0xbefa('0x29')]=qs['offset'](_0x3921d9['query'][_0xbefa('0x29')]);}return _0x5ca1bc['getTeams'](_0x59f4cb);}})[_0xbefa('0x32')](function(_0x126a57){if(_0x126a57){return _0x126a57?{'count':_0xd1397c,'rows':_0x126a57}:null;}})[_0xbefa('0x32')](respondWithResult(_0x11d006,null))[_0xbefa('0x27')](handleError(_0x11d006,null));};exports['addTeams']=function(_0x2e1333,_0x25c6da,_0xe28c8b){var _0x128d0e=_0x2e1333[_0xbefa('0x5e')][_0xbefa('0x72')];return db[_0xbefa('0x70')][_0xbefa('0x51')]({'where':{'id':_0x128d0e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbefa('0x73'),'attributes':['id','name',_0xbefa('0x74'),'voicePause',_0xbefa('0x75')],'raw':!![]}]})[_0xbefa('0x32')](function(_0x1a00bd){if(_0x1a00bd){var _0x4d5a75=_['flatMap'](_0x1a00bd,function(_0x48cd73){var _0x132dff=_0x48cd73[_0xbefa('0x57')]({'plain':!![]});return _0x132dff[_0xbefa('0x73')];});return db['ChatQueue'][_0xbefa('0x5a')]({'where':{'id':_0x2e1333['params']['id']}})[_0xbefa('0x32')](function(_0x54a5a1){return db[_0xbefa('0x76')]['transaction'](function(_0x386aca){return _0x54a5a1[_0xbefa('0x77')](_0x128d0e,{'transaction':_0x386aca})[_0xbefa('0x32')](function(){return BPromise[_0xbefa('0x78')](_0x4d5a75,function(_0x4fbbff){return db[_0xbefa('0x61')][_0xbefa('0x79')]({'where':{'UserId':_0x4fbbff['id'],'ChatQueueId':_0x2e1333['params']['id']},'transaction':_0x386aca});});})[_0xbefa('0x32')](function(){_0x4d5a75[_0xbefa('0x7a')](function(_0x2f4307){socket[_0xbefa('0x7b')](_0xbefa('0x7c'),{'UserId':_0x2f4307['id'],'ChatQueueId':_0x54a5a1['id']});});});});});}})[_0xbefa('0x32')](respondWithStatusCode(_0x25c6da,null))[_0xbefa('0x27')](handleError(_0x25c6da,null));};exports[_0xbefa('0x7d')]=function(_0x4b0651,_0x5540f8,_0x54f438){return db['Team'][_0xbefa('0x51')]({'where':{'id':_0x4b0651[_0xbefa('0x3f')][_0xbefa('0x72')]},'attributes':['id'],'include':[{'model':db[_0xbefa('0x64')],'as':_0xbefa('0x73'),'attributes':['id'],'raw':!![]}]})[_0xbefa('0x32')](handleEntityNotFound(_0x5540f8,null))[_0xbefa('0x32')](function(_0xd66ed0){var _0x1c5249=_[_0xbefa('0x39')](_0xd66ed0,'id');var _0x3bc88f=[];var _0x56d7c1=[];var _0x329e78=squel['select']();_0x329e78['field'](_0xbefa('0x7e'))[_0xbefa('0x7f')](_0xbefa('0x80'),'tq')[_0xbefa('0x81')]('user_has_teams','ut',_0xbefa('0x82'))['where']('ChatQueueId\x20=\x20?',_0x4b0651[_0xbefa('0x54')]['id']);for(var _0x365ef=0x0;_0x365ef<_0xd66ed0[_0xbefa('0x45')];_0x365ef+=0x1){let _0x202800=_0xd66ed0[_0x365ef];for(var _0x21c4e3=0x0;_0x21c4e3<_0x202800[_0xbefa('0x73')][_0xbefa('0x45')];_0x21c4e3+=0x1){let _0x3b0c34=_0x202800['Agents'][_0x21c4e3];var _0x1bf990=_0x329e78[_0xbefa('0x83')]();_0x1bf990[_0xbefa('0x48')]('ut.UserId\x20=\x20?',_0x3b0c34['id']);_0x56d7c1[_0xbefa('0x84')](db['sequelize'][_0xbefa('0x3f')](_0x1bf990[_0xbefa('0x85')](),{'type':db[_0xbefa('0x76')][_0xbefa('0x86')][_0xbefa('0x87')]})[_0xbefa('0x32')](function(_0x13dcfd){if(_0x13dcfd[_0xbefa('0x45')]===0x1){return _0x3b0c34['id'];}else{var _0x274a71=_[_0xbefa('0x88')](_[_0xbefa('0x39')](_0x13dcfd,_0xbefa('0x89')),function(_0x460ec8){return _[_0xbefa('0x8a')](_0x1c5249,_0x460ec8);});if(_0x274a71){return _0x3b0c34['id'];}}}));}}return BPromise[_0xbefa('0x8b')](_0x56d7c1)[_0xbefa('0x32')](function(_0x142930){_0x3bc88f=_(_0x3bc88f)['union'](_0x142930)['compact']()[_0xbefa('0x8c')]();return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x4b0651['params']['id']}})[_0xbefa('0x32')](function(_0x5e01c2){return db[_0xbefa('0x76')][_0xbefa('0x8d')](function(_0x5db332){return _0x5e01c2[_0xbefa('0x7d')](_0x4b0651[_0xbefa('0x3f')][_0xbefa('0x72')],{'transaction':_0x5db332})[_0xbefa('0x32')](function(){if(!_['isEmpty'](_0x3bc88f)){return _0x5e01c2['removeAgents'](_0x3bc88f,{'transaction':_0x5db332});}})[_0xbefa('0x32')](function(){_0x3bc88f[_0xbefa('0x7a')](function(_0x5473cc){socket[_0xbefa('0x7b')](_0xbefa('0x8e'),{'UserId':_0x5473cc,'ChatQueueId':_0x5e01c2['id']});});});});});});})['then'](respondWithStatusCode(_0x5540f8,null))[_0xbefa('0x27')](handleError(_0x5540f8,null));};exports[_0xbefa('0x8f')]=function(_0x32424a,_0x32b336,_0x38a1df){return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x32424a[_0xbefa('0x54')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x32b336,null))['then'](function(_0x5ddff1){if(_0x5ddff1){return _0x5ddff1[_0xbefa('0x8f')](_0x32424a[_0xbefa('0x5e')][_0xbefa('0x72')],_[_0xbefa('0x90')](_0x32424a[_0xbefa('0x5e')],[_0xbefa('0x72'),'id'])||{})['spread'](function(_0x55bdd8){for(var _0x4e5955=0x0;_0x4e5955<_0x32424a[_0xbefa('0x5e')]['ids']['length'];_0x4e5955+=0x1){socket[_0xbefa('0x7b')]('userChatQueue:save',{'UserId':Number(_0x32424a[_0xbefa('0x5e')][_0xbefa('0x72')][_0x4e5955]),'ChatQueueId':Number(_0x32424a[_0xbefa('0x54')]['id'])});}return _0x55bdd8;});}})['then'](respondWithResult(_0x32b336,null))[_0xbefa('0x27')](handleError(_0x32b336,null));};exports[_0xbefa('0x91')]=function(_0x75437,_0xf92b68,_0x4863e2){return db[_0xbefa('0x4e')][_0xbefa('0x5a')]({'where':{'id':_0x75437['params']['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0xf92b68,null))[_0xbefa('0x32')](function(_0x15814d){if(_0x15814d){return _0x15814d[_0xbefa('0x91')](_0x75437['query'][_0xbefa('0x72')])[_0xbefa('0x32')](function(){if(_['isArray'](_0x75437['query'][_0xbefa('0x72')])){for(var _0x2f16b7=0x0;_0x2f16b7<_0x75437['query'][_0xbefa('0x72')][_0xbefa('0x45')];_0x2f16b7+=0x1){socket[_0xbefa('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x75437['query']['ids'][_0x2f16b7]),'ChatQueueId':Number(_0x75437[_0xbefa('0x54')]['id'])});}}else{socket[_0xbefa('0x7b')](_0xbefa('0x8e'),{'UserId':Number(_0x75437['query'][_0xbefa('0x72')]),'ChatQueueId':Number(_0x75437['params']['id'])});}});}})[_0xbefa('0x32')](respondWithStatusCode(_0xf92b68,null))[_0xbefa('0x27')](handleError(_0xf92b68,null));};exports[_0xbefa('0x92')]=function(_0x54b1e2,_0x1af6c3,_0x4d2919){var _0x3afa61={};var _0x5cae95={};var _0x30d7d0;var _0x22e85c;return db['ChatQueue'][_0xbefa('0x6f')]({'where':{'id':_0x54b1e2[_0xbefa('0x54')]['id']}})['then'](handleEntityNotFound(_0x1af6c3,null))[_0xbefa('0x32')](function(_0x304eff){if(_0x304eff){_0x30d7d0=_0x304eff;_0x5cae95[_0xbefa('0x42')]=_[_0xbefa('0x3e')](db[_0xbefa('0x64')]['rawAttributes']);_0x5cae95[_0xbefa('0x3f')]=_[_0xbefa('0x3e')](_0x54b1e2[_0xbefa('0x3f')]);_0x5cae95[_0xbefa('0x40')]=_['intersection'](_0x5cae95[_0xbefa('0x42')],_0x5cae95[_0xbefa('0x3f')]);_0x3afa61[_0xbefa('0x43')]=_[_0xbefa('0x41')](_0x5cae95[_0xbefa('0x42')],qs[_0xbefa('0x44')](_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x44')]));_0x3afa61[_0xbefa('0x43')]=_0x3afa61[_0xbefa('0x43')]['length']?_0x3afa61[_0xbefa('0x43')]:_0x5cae95[_0xbefa('0x42')];_0x3afa61[_0xbefa('0x71')]=qs[_0xbefa('0x47')](_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x47')]);_0x3afa61[_0xbefa('0x48')]=qs[_0xbefa('0x40')](_[_0xbefa('0x49')](_0x54b1e2['query'],_0x5cae95[_0xbefa('0x40')]));if(_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x4a')]){_0x3afa61['where']=_[_0xbefa('0x4b')](_0x3afa61[_0xbefa('0x48')],{'$or':_[_0xbefa('0x39')](_0x3afa61['attributes'],function(_0x301baf){var _0x1c75da={};_0x1c75da[_0x301baf]={'$like':'%'+_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x4a')]+'%'};return _0x1c75da;})});}_0x3afa61=_[_0xbefa('0x4b')]({},_0x3afa61,_0x54b1e2[_0xbefa('0x4d')]);return _0x30d7d0[_0xbefa('0x92')](_0x3afa61);}})['then'](function(_0x5b434b){if(_0x5b434b){_0x22e85c=_0x5b434b[_0xbefa('0x45')];if(!_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x46')](_0xbefa('0x62'))){_0x3afa61[_0xbefa('0x2a')]=qs['limit'](_0x54b1e2[_0xbefa('0x3f')][_0xbefa('0x2a')]);_0x3afa61['offset']=qs['offset'](_0x54b1e2['query'][_0xbefa('0x29')]);}return _0x30d7d0['getAgents'](_0x3afa61);}})['then'](function(_0xf5fcb0){if(_0xf5fcb0){return _0xf5fcb0?{'count':_0x22e85c,'rows':_0xf5fcb0}:null;}})['then'](respondWithResult(_0x1af6c3,null))[_0xbefa('0x27')](handleError(_0x1af6c3,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e0ac8f7..6be82f4 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 _0xefd7=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xefd7,0x154));var _0x7efd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xefd7[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x7efd('0x0'));var ChatQueue=require(_0x7efd('0x1'))['db'][_0x7efd('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7efd('0x3')](0x0);var events={'afterCreate':_0x7efd('0x4'),'afterUpdate':_0x7efd('0x5'),'afterDestroy':_0x7efd('0x6')};function emitEvent(_0x3710a0){return function(_0x361f67,_0x4d12c6,_0x362042){ChatQueueEvents[_0x7efd('0x7')](_0x3710a0+':'+_0x361f67['id'],_0x361f67);ChatQueueEvents[_0x7efd('0x7')](_0x3710a0,_0x361f67);_0x362042(null);};}for(var e in events){if(events[_0x7efd('0x8')](e)){var event=events[e];ChatQueue[_0x7efd('0x9')](e,emitEvent(event));}}module[_0x7efd('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x9cb8=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x9cb8,0x155));var _0x89cb=function(_0x439f63,_0x53dee3){_0x439f63=_0x439f63-0x0;var _0x570d0a=_0x9cb8[_0x439f63];return _0x570d0a;};'use strict';var EventEmitter=require(_0x89cb('0x0'));var ChatQueue=require(_0x89cb('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x89cb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x89cb('0x3'),'afterDestroy':_0x89cb('0x4')};function emitEvent(_0x5cb1ab){return function(_0x108431,_0x299c2d,_0x4d95e3){ChatQueueEvents['emit'](_0x5cb1ab+':'+_0x108431['id'],_0x108431);ChatQueueEvents['emit'](_0x5cb1ab,_0x108431);_0x4d95e3(null);};}for(var e in events){if(events[_0x89cb('0x5')](e)){var event=events[e];ChatQueue[_0x89cb('0x6')](e,emitEvent(event));}}module[_0x89cb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 07e3972..1808236 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 _0xefcf=['rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3a4931,_0x1b4341){var _0x31873b=function(_0x1ff778){while(--_0x1ff778){_0x3a4931['push'](_0x3a4931['shift']());}};_0x31873b(++_0x1b4341);}(_0xefcf,0x17f));var _0xfefc=function(_0x37cc4c,_0x288c26){_0x37cc4c=_0x37cc4c-0x0;var _0x425695=_0xefcf[_0x37cc4c];return _0x425695;};'use strict';var _=require(_0xfefc('0x0'));var util=require(_0xfefc('0x1'));var logger=require(_0xfefc('0x2'))(_0xfefc('0x3'));var moment=require(_0xfefc('0x4'));var BPromise=require(_0xfefc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfefc('0x6'));var rimraf=require(_0xfefc('0x7'));var config=require('../../config/environment');var attributes=require(_0xfefc('0x8'));module[_0xfefc('0x9')]=function(_0x466a06,_0x1f8e2a){return _0x466a06[_0xfefc('0xa')](_0xfefc('0xb'),attributes,{'tableName':_0xfefc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd935=['../../config/logger','api','moment','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x5d1e63,_0x2d5c8f){var _0x408c1d=function(_0x24949a){while(--_0x24949a){_0x5d1e63['push'](_0x5d1e63['shift']());}};_0x408c1d(++_0x2d5c8f);}(_0xd935,0x8d));var _0x5d93=function(_0x498468,_0x4558db){_0x498468=_0x498468-0x0;var _0x57cb61=_0xd935[_0x498468];return _0x57cb61;};'use strict';var _=require(_0x5d93('0x0'));var util=require(_0x5d93('0x1'));var logger=require(_0x5d93('0x2'))(_0x5d93('0x3'));var moment=require(_0x5d93('0x4'));var BPromise=require('bluebird');var rp=require(_0x5d93('0x5'));var fs=require('fs');var path=require(_0x5d93('0x6'));var rimraf=require(_0x5d93('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d93('0x8'));module[_0x5d93('0x9')]=function(_0x4cadde,_0x19185f){return _0x4cadde[_0x5d93('0xa')](_0x5d93('0xb'),attributes,{'tableName':_0x5d93('0xc'),'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 52835d4..b0b88fc 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 _0x80ed=['request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','find','ShowChatQueue','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register'];(function(_0x248dd8,_0x187029){var _0x3fb4b2=function(_0xc16875){while(--_0xc16875){_0x248dd8['push'](_0x248dd8['shift']());}};_0x3fb4b2(++_0x187029);}(_0x80ed,0x11c));var _0xd80e=function(_0xa209e0,_0x58cd40){_0xa209e0=_0xa209e0-0x0;var _0x3a16b1=_0x80ed[_0xa209e0];return _0x3a16b1;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});config['redis']=_[_0xd80e('0xb')](config[_0xd80e('0xc')],{'host':_0xd80e('0xd'),'port':0x18eb});var socket=require(_0xd80e('0xe'))(new Redis(config[_0xd80e('0xc')]));require(_0xd80e('0xf'))[_0xd80e('0x10')](socket);function respondWithRpcPromise(_0x2457f5,_0x68625,_0x7f93b4){return new BPromise(function(_0x4eee08,_0x450b44){return client[_0xd80e('0x11')](_0x2457f5,_0x7f93b4)[_0xd80e('0x12')](function(_0x30c9d0){logger[_0xd80e('0x13')](_0xd80e('0x14'),_0x68625,_0xd80e('0x15'));logger[_0xd80e('0x16')](_0xd80e('0x17'),_0x68625,'request\x20sent',JSON['stringify'](_0x30c9d0));if(_0x30c9d0['error']){if(_0x30c9d0['error'][_0xd80e('0x18')]===0x1f4){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x450b44(_0x30c9d0['error'][_0xd80e('0x1a')]);}logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x4eee08(_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);}else{logger[_0xd80e('0x13')]('ChatQueue,\x20%s,\x20%s',_0x68625,_0xd80e('0x15'));_0x4eee08(_0x30c9d0[_0xd80e('0x1b')][_0xd80e('0x1a')]);}})[_0xd80e('0x1c')](function(_0x593af6){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x593af6);_0x450b44(_0x593af6);});});}exports[_0xd80e('0x1d')]=function(_0x527237){var _0x41417d=this;return new Promise(function(_0x2ef8a1,_0x2765ea){return db[_0xd80e('0x1e')][_0xd80e('0x1f')]({'raw':_0x527237['options']?_0x527237['options'][_0xd80e('0x20')]===undefined?!![]:![]:!![],'where':_0x527237[_0xd80e('0x21')]?_0x527237[_0xd80e('0x21')][_0xd80e('0x22')]||null:null,'attributes':_0x527237[_0xd80e('0x21')]?_0x527237[_0xd80e('0x21')][_0xd80e('0x23')]||null:null,'limit':_0x527237['options']?_0x527237[_0xd80e('0x21')][_0xd80e('0x24')]||null:null,'include':_0x527237[_0xd80e('0x21')]?_0x527237['options'][_0xd80e('0x25')]?_[_0xd80e('0x26')](_0x527237[_0xd80e('0x21')]['include'],function(_0x521aa4){return{'model':db[_0x521aa4['model']],'as':_0x521aa4['as'],'attributes':_0x521aa4[_0xd80e('0x23')],'include':_0x521aa4['include']?_[_0xd80e('0x26')](_0x521aa4[_0xd80e('0x25')],function(_0x4e8ed9){return{'model':db[_0x4e8ed9[_0xd80e('0x27')]],'as':_0x4e8ed9['as'],'attributes':_0x4e8ed9[_0xd80e('0x23')],'include':_0x4e8ed9[_0xd80e('0x25')]?_[_0xd80e('0x26')](_0x4e8ed9['include'],function(_0x15f317){return{'model':db[_0x15f317[_0xd80e('0x27')]],'as':_0x15f317['as'],'attributes':_0x15f317[_0xd80e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd80e('0x12')](function(_0x2b1aaf){logger[_0xd80e('0x13')](_0xd80e('0x1d'),_0x527237);logger[_0xd80e('0x16')]('GetChatQueue',_0x527237,JSON['stringify'](_0x2b1aaf));_0x2ef8a1(_0x2b1aaf);})[_0xd80e('0x1c')](function(_0x1303eb){logger[_0xd80e('0x19')](_0xd80e('0x1d'),_0x1303eb[_0xd80e('0x1a')],_0x527237);_0x2765ea(_0x41417d[_0xd80e('0x19')](0x1f4,_0x1303eb['message']));});});};exports['ShowChatQueue']=function(_0x39c124){var _0x2d6ae5=this;return new Promise(function(_0x380f4f,_0x122a72){return db[_0xd80e('0x1e')][_0xd80e('0x28')]({'raw':_0x39c124[_0xd80e('0x21')]?_0x39c124[_0xd80e('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x39c124['options']?_0x39c124[_0xd80e('0x21')][_0xd80e('0x22')]||null:null,'attributes':_0x39c124[_0xd80e('0x21')]?_0x39c124[_0xd80e('0x21')][_0xd80e('0x23')]||null:null,'include':_0x39c124[_0xd80e('0x21')]?_0x39c124[_0xd80e('0x21')][_0xd80e('0x25')]?_[_0xd80e('0x26')](_0x39c124[_0xd80e('0x21')]['include'],function(_0x36efc2){return{'model':db[_0x36efc2['model']],'as':_0x36efc2['as'],'attributes':_0x36efc2[_0xd80e('0x23')],'include':_0x36efc2[_0xd80e('0x25')]?_[_0xd80e('0x26')](_0x36efc2[_0xd80e('0x25')],function(_0x5a1fda){return{'model':db[_0x5a1fda[_0xd80e('0x27')]],'as':_0x5a1fda['as'],'attributes':_0x5a1fda['attributes'],'include':_0x5a1fda[_0xd80e('0x25')]?_['map'](_0x5a1fda[_0xd80e('0x25')],function(_0x3da220){return{'model':db[_0x3da220['model']],'as':_0x3da220['as'],'attributes':_0x3da220[_0xd80e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd80e('0x12')](function(_0x2fbb7a){logger['info'](_0xd80e('0x29'),_0x39c124);logger[_0xd80e('0x16')](_0xd80e('0x29'),_0x39c124,JSON[_0xd80e('0x2a')](_0x2fbb7a));_0x380f4f(_0x2fbb7a);})[_0xd80e('0x1c')](function(_0x34b8e9){logger[_0xd80e('0x19')](_0xd80e('0x29'),_0x34b8e9[_0xd80e('0x1a')],_0x39c124);_0x122a72(_0x2d6ae5['error'](0x1f4,_0x34b8e9['message']));});});}; \ No newline at end of file +var _0xa81d=['include','map','model','GetChatQueue','ShowChatQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','where','attributes'];(function(_0x14f815,_0x2ee3ce){var _0x1211ae=function(_0x407f7a){while(--_0x407f7a){_0x14f815['push'](_0x14f815['shift']());}};_0x1211ae(++_0x2ee3ce);}(_0xa81d,0x11e));var _0xda81=function(_0x4500b6,_0x29d34f){_0x4500b6=_0x4500b6-0x0;var _0x4b957e=_0xa81d[_0x4500b6];return _0x4b957e;};'use strict';var _=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var moment=require('moment');var BPromise=require(_0xda81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda81('0x3'));var db=require(_0xda81('0x4'))['db'];var utils=require(_0xda81('0x5'));var logger=require(_0xda81('0x6'))(_0xda81('0x7'));var config=require(_0xda81('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xda81('0x9')]({'port':0x232a});config['redis']=_[_0xda81('0xa')](config[_0xda81('0xb')],{'host':_0xda81('0xc'),'port':0x18eb});var socket=require(_0xda81('0xd'))(new Redis(config[_0xda81('0xb')]));require(_0xda81('0xe'))['register'](socket);function respondWithRpcPromise(_0x4db7f3,_0xd1bd2a,_0x5af9c5){return new BPromise(function(_0xb545b5,_0x21afe9){return client[_0xda81('0xf')](_0x4db7f3,_0x5af9c5)[_0xda81('0x10')](function(_0x420c67){logger[_0xda81('0x11')](_0xda81('0x12'),_0xd1bd2a,_0xda81('0x13'));logger[_0xda81('0x14')](_0xda81('0x15'),_0xd1bd2a,'request\x20sent',JSON[_0xda81('0x16')](_0x420c67));if(_0x420c67[_0xda81('0x17')]){if(_0x420c67['error'][_0xda81('0x18')]===0x1f4){logger['error'](_0xda81('0x12'),_0xd1bd2a,_0x420c67['error'][_0xda81('0x19')]);return _0x21afe9(_0x420c67[_0xda81('0x17')][_0xda81('0x19')]);}logger[_0xda81('0x17')](_0xda81('0x12'),_0xd1bd2a,_0x420c67[_0xda81('0x17')]['message']);return _0xb545b5(_0x420c67[_0xda81('0x17')][_0xda81('0x19')]);}else{logger[_0xda81('0x11')](_0xda81('0x12'),_0xd1bd2a,_0xda81('0x13'));_0xb545b5(_0x420c67[_0xda81('0x1a')][_0xda81('0x19')]);}})[_0xda81('0x1b')](function(_0x415465){logger[_0xda81('0x17')](_0xda81('0x12'),_0xd1bd2a,_0x415465);_0x21afe9(_0x415465);});});}exports['GetChatQueue']=function(_0x186539){var _0x50b080=this;return new Promise(function(_0x291b6d,_0x2353bd){return db[_0xda81('0x1c')][_0xda81('0x1d')]({'raw':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x1f')]===undefined?!![]:![]:!![],'where':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x20')]||null:null,'attributes':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x21')]||null:null,'limit':_0x186539[_0xda81('0x1e')]?_0x186539['options']['limit']||null:null,'include':_0x186539[_0xda81('0x1e')]?_0x186539[_0xda81('0x1e')][_0xda81('0x22')]?_[_0xda81('0x23')](_0x186539[_0xda81('0x1e')]['include'],function(_0x2caa71){return{'model':db[_0x2caa71[_0xda81('0x24')]],'as':_0x2caa71['as'],'attributes':_0x2caa71[_0xda81('0x21')],'include':_0x2caa71[_0xda81('0x22')]?_[_0xda81('0x23')](_0x2caa71[_0xda81('0x22')],function(_0x3e8a14){return{'model':db[_0x3e8a14[_0xda81('0x24')]],'as':_0x3e8a14['as'],'attributes':_0x3e8a14[_0xda81('0x21')],'include':_0x3e8a14[_0xda81('0x22')]?_[_0xda81('0x23')](_0x3e8a14['include'],function(_0x3948af){return{'model':db[_0x3948af[_0xda81('0x24')]],'as':_0x3948af['as'],'attributes':_0x3948af[_0xda81('0x21')]};}):[]};}):[]};}):[]:[]})[_0xda81('0x10')](function(_0x3d2e9b){logger[_0xda81('0x11')](_0xda81('0x25'),_0x186539);logger[_0xda81('0x14')](_0xda81('0x25'),_0x186539,JSON[_0xda81('0x16')](_0x3d2e9b));_0x291b6d(_0x3d2e9b);})[_0xda81('0x1b')](function(_0x3337f6){logger[_0xda81('0x17')](_0xda81('0x25'),_0x3337f6['message'],_0x186539);_0x2353bd(_0x50b080[_0xda81('0x17')](0x1f4,_0x3337f6[_0xda81('0x19')]));});});};exports[_0xda81('0x26')]=function(_0x5d939b){var _0x39d43f=this;return new Promise(function(_0x23edc3,_0x3d656c){return db[_0xda81('0x1c')][_0xda81('0x27')]({'raw':_0x5d939b[_0xda81('0x1e')]?_0x5d939b[_0xda81('0x1e')][_0xda81('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d939b['options']?_0x5d939b[_0xda81('0x1e')][_0xda81('0x20')]||null:null,'attributes':_0x5d939b['options']?_0x5d939b['options'][_0xda81('0x21')]||null:null,'include':_0x5d939b['options']?_0x5d939b[_0xda81('0x1e')][_0xda81('0x22')]?_[_0xda81('0x23')](_0x5d939b[_0xda81('0x1e')][_0xda81('0x22')],function(_0x58d4e3){return{'model':db[_0x58d4e3[_0xda81('0x24')]],'as':_0x58d4e3['as'],'attributes':_0x58d4e3[_0xda81('0x21')],'include':_0x58d4e3['include']?_['map'](_0x58d4e3[_0xda81('0x22')],function(_0x46b8b3){return{'model':db[_0x46b8b3[_0xda81('0x24')]],'as':_0x46b8b3['as'],'attributes':_0x46b8b3[_0xda81('0x21')],'include':_0x46b8b3[_0xda81('0x22')]?_[_0xda81('0x23')](_0x46b8b3['include'],function(_0x5acdeb){return{'model':db[_0x5acdeb[_0xda81('0x24')]],'as':_0x5acdeb['as'],'attributes':_0x5acdeb['attributes']};}):[]};}):[]};}):[]:[]})[_0xda81('0x10')](function(_0x3c8648){logger['info'](_0xda81('0x26'),_0x5d939b);logger['debug'](_0xda81('0x26'),_0x5d939b,JSON[_0xda81('0x16')](_0x3c8648));_0x23edc3(_0x3c8648);})[_0xda81('0x1b')](function(_0x1b9090){logger[_0xda81('0x17')](_0xda81('0x26'),_0x1b9090['message'],_0x5d939b);_0x3d656c(_0x39d43f[_0xda81('0x17')](0x1f4,_0x1b9090[_0xda81('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 719f801..37db6a9 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 _0x9b67=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x5481d7,_0x4f5fce){var _0x1751db=function(_0x259316){while(--_0x259316){_0x5481d7['push'](_0x5481d7['shift']());}};_0x1751db(++_0x4f5fce);}(_0x9b67,0xf6));var _0x79b6=function(_0x26e6a4,_0x1f4ce6){_0x26e6a4=_0x26e6a4-0x0;var _0x540929=_0x9b67[_0x26e6a4];return _0x540929;};'use strict';var ChatQueueEvents=require(_0x79b6('0x0'));var events=[_0x79b6('0x1'),_0x79b6('0x2'),_0x79b6('0x3')];function createListener(_0x29728d,_0x5523a1){return function(_0x3ba25a){_0x5523a1[_0x79b6('0x4')](_0x29728d,_0x3ba25a);};}function removeListener(_0x5297d0,_0x4e8794){return function(){ChatQueueEvents[_0x79b6('0x5')](_0x5297d0,_0x4e8794);};}exports[_0x79b6('0x6')]=function(_0x258103){for(var _0xec367e=0x0,_0xfa6a05=events[_0x79b6('0x7')];_0xec367e<_0xfa6a05;_0xec367e++){var _0x34adbe=events[_0xec367e];var _0x58ae2d=createListener(_0x79b6('0x8')+_0x34adbe,_0x258103);ChatQueueEvents['on'](_0x34adbe,_0x58ae2d);}}; \ No newline at end of file +var _0x81bd=['save','remove','update','removeListener','./chatQueue.events'];(function(_0x2868ec,_0x3aef29){var _0x2ad998=function(_0x554d06){while(--_0x554d06){_0x2868ec['push'](_0x2868ec['shift']());}};_0x2ad998(++_0x3aef29);}(_0x81bd,0x7c));var _0xd81b=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x81bd[_0x12d951];return _0x44de17;};'use strict';var ChatQueueEvents=require(_0xd81b('0x0'));var events=[_0xd81b('0x1'),_0xd81b('0x2'),_0xd81b('0x3')];function createListener(_0x2d27cb,_0x2ec03a){return function(_0x111a9c){_0x2ec03a['emit'](_0x2d27cb,_0x111a9c);};}function removeListener(_0x16e8de,_0x2c3d9e){return function(){ChatQueueEvents[_0xd81b('0x4')](_0x16e8de,_0x2c3d9e);};}exports['register']=function(_0x42a0aa){for(var _0x34eb73=0x0,_0x1f3f2c=events['length'];_0x34eb73<_0x1f3f2c;_0x34eb73++){var _0x5e14e8=events[_0x34eb73];var _0xa4cf97=createListener('chatQueue:'+_0x5e14e8,_0x42a0aa);ChatQueueEvents['on'](_0x5e14e8,_0xa4cf97);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 6599098..2a643d8 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x2742a8,_0x47fecd){var _0x2b1b53=function(_0x503bb1){while(--_0x503bb1){_0x2742a8['push'](_0x2742a8['shift']());}};_0x2b1b53(++_0x47fecd);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5fa910,_0x3a7dbc){var _0x3ca597=function(_0xa9c417){while(--_0xa9c417){_0x5fa910['push'](_0x5fa910['shift']());}};_0x3ca597(++_0x3a7dbc);}(_0x008c,0x188));var _0xc008=function(_0x42d41d,_0x17b8ea){_0x42d41d=_0x42d41d-0x0;var _0x2e6184=_0x008c[_0x42d41d];return _0x2e6184;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index ac3a244..f7f18c6 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 _0x88b9=['DATE','STRING','sequelize','exports'];(function(_0x28176b,_0x119ab2){var _0x4c50e5=function(_0xdec0ce){while(--_0xdec0ce){_0x28176b['push'](_0x28176b['shift']());}};_0x4c50e5(++_0x119ab2);}(_0x88b9,0x166));var _0x988b=function(_0x50a295,_0x1fc01c){_0x50a295=_0x50a295-0x0;var _0x364b8b=_0x88b9[_0x50a295];return _0x364b8b;};'use strict';var moment=require('moment');var Sequelize=require(_0x988b('0x0'));module[_0x988b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x988b('0x2')]},'leaveAt':{'type':Sequelize[_0x988b('0x2')]},'acceptAt':{'type':Sequelize[_0x988b('0x2')]},'exitAt':{'type':Sequelize[_0x988b('0x2')]},'reason':{'type':Sequelize[_0x988b('0x3')]}}; \ No newline at end of file +var _0xfa1b=['exports','STRING','DATE','sequelize'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xfa1b,0xaf));var _0xbfa1=function(_0x4a0f12,_0x3986c8){_0x4a0f12=_0x4a0f12-0x0;var _0x597b2c=_0xfa1b[_0x4a0f12];return _0x597b2c;};'use strict';var moment=require('moment');var Sequelize=require(_0xbfa1('0x0'));module[_0xbfa1('0x1')]={'uniqueid':{'type':Sequelize[_0xbfa1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xbfa1('0x2')]},'joinAt':{'type':Sequelize[_0xbfa1('0x3')]},'leaveAt':{'type':Sequelize[_0xbfa1('0x3')]},'acceptAt':{'type':Sequelize[_0xbfa1('0x3')]},'exitAt':{'type':Sequelize[_0xbfa1('0x3')]},'reason':{'type':Sequelize[_0xbfa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 228589f..4d8e19d 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 _0x1f2d=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','error','stack','name','send','index','ChatQueueReport','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','then','include','findAll','catch','show','params','rawAttributes','create','update','body','find','destroy','describe','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','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3d4b5f,_0x3a792d){var _0x3f818a=function(_0x116200){while(--_0x116200){_0x3d4b5f['push'](_0x3d4b5f['shift']());}};_0x3f818a(++_0x3a792d);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x156489,_0x2bbaf2){_0x156489=_0x156489-0x0;var _0x4d2814=_0x1f2d[_0x156489];return _0x4d2814;};'use strict';var emlformat=require(_0xd1f2('0x0'));var rimraf=require(_0xd1f2('0x1'));var zipdir=require(_0xd1f2('0x2'));var jsonpatch=require(_0xd1f2('0x3'));var rp=require('request-promise');var moment=require(_0xd1f2('0x4'));var BPromise=require(_0xd1f2('0x5'));var Mustache=require(_0xd1f2('0x6'));var util=require(_0xd1f2('0x7'));var path=require(_0xd1f2('0x8'));var sox=require(_0xd1f2('0x9'));var csv=require(_0xd1f2('0xa'));var ejs=require(_0xd1f2('0xb'));var fs=require('fs');var fs_extra=require(_0xd1f2('0xc'));var _=require(_0xd1f2('0xd'));var squel=require(_0xd1f2('0xe'));var crypto=require(_0xd1f2('0xf'));var jsforce=require(_0xd1f2('0x10'));var deskjs=require(_0xd1f2('0x11'));var toCsv=require(_0xd1f2('0xa'));var querystring=require(_0xd1f2('0x12'));var Papa=require(_0xd1f2('0x13'));var Redis=require('ioredis');var authService=require(_0xd1f2('0x14'));var qs=require(_0xd1f2('0x15'));var as=require(_0xd1f2('0x16'));var hardwareService=require(_0xd1f2('0x17'));var logger=require('../../config/logger')(_0xd1f2('0x18'));var utils=require(_0xd1f2('0x19'));var config=require(_0xd1f2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1f2('0x1b'))['db'];function respondWithStatusCode(_0x347eba,_0x2ef331){_0x2ef331=_0x2ef331||0xcc;return function(_0x1d09f6){if(_0x1d09f6){return _0x347eba[_0xd1f2('0x1c')](_0x2ef331);}return _0x347eba[_0xd1f2('0x1d')](_0x2ef331)[_0xd1f2('0x1e')]();};}function respondWithResult(_0x596a54,_0x4d71d1){_0x4d71d1=_0x4d71d1||0xc8;return function(_0x5a3c44){if(_0x5a3c44){return _0x596a54['status'](_0x4d71d1)['json'](_0x5a3c44);}};}function respondWithFilteredResult(_0x19eb09,_0x1e0226){return function(_0x20d25d){if(_0x20d25d){var _0x1bd6ac=typeof _0x1e0226[_0xd1f2('0x1f')]===_0xd1f2('0x20')&&typeof _0x1e0226[_0xd1f2('0x21')]==='undefined';var _0x2af2d8=_0x20d25d[_0xd1f2('0x22')];var _0x2cd4fa=_0x1bd6ac?0x0:_0x1e0226[_0xd1f2('0x1f')];var _0x1f05f4=_0x1bd6ac?_0x20d25d[_0xd1f2('0x22')]:_0x1e0226[_0xd1f2('0x1f')]+_0x1e0226['limit'];var _0x12343a;if(_0x1f05f4>=_0x2af2d8){_0x1f05f4=_0x2af2d8;_0x12343a=0xc8;}else{_0x12343a=0xce;}_0x19eb09[_0xd1f2('0x1d')](_0x12343a);return _0x19eb09[_0xd1f2('0x23')](_0xd1f2('0x24'),_0x2cd4fa+'-'+_0x1f05f4+'/'+_0x2af2d8)[_0xd1f2('0x25')](_0x20d25d);}return null;};}function patchUpdates(_0x40b992){return function(_0x2a666f){try{jsonpatch[_0xd1f2('0x26')](_0x2a666f,_0x40b992,!![]);}catch(_0x23250f){return BPromise[_0xd1f2('0x27')](_0x23250f);}return _0x2a666f[_0xd1f2('0x28')]();};}function saveUpdates(_0x4b74ff,_0x3ccd12){return function(_0x779022){if(_0x779022){return _0x779022['update'](_0x4b74ff)['then'](function(_0x36c147){return _0x36c147;});}return null;};}function removeEntity(_0x824485,_0x5a5278){return function(_0x527471){if(_0x527471){return _0x527471['destroy']()['then'](function(){_0x824485['status'](0xcc)[_0xd1f2('0x1e')]();});}};}function handleEntityNotFound(_0x3f181b,_0x2557d0){return function(_0x2c0bbb){if(!_0x2c0bbb){_0x3f181b[_0xd1f2('0x1c')](0x194);}return _0x2c0bbb;};}function handleError(_0x493870,_0xf935fc){_0xf935fc=_0xf935fc||0x1f4;return function(_0x3a99b2){logger[_0xd1f2('0x29')](_0x3a99b2[_0xd1f2('0x2a')]);if(_0x3a99b2[_0xd1f2('0x2b')]){delete _0x3a99b2[_0xd1f2('0x2b')];}_0x493870[_0xd1f2('0x1d')](_0xf935fc)[_0xd1f2('0x2c')](_0x3a99b2);};}exports[_0xd1f2('0x2d')]=function(_0x2c1d0e,_0x3e5e6c){var _0x58dd7c={},_0x4ef315={},_0x174306={'count':0x0,'rows':[]};var _0x409640=_['map'](db[_0xd1f2('0x2e')]['rawAttributes'],function(_0x1b9c0f){return{'name':_0x1b9c0f[_0xd1f2('0x2f')],'type':_0x1b9c0f[_0xd1f2('0x30')]['key']};});_0x4ef315[_0xd1f2('0x31')]=_['map'](_0x409640,'name');_0x4ef315[_0xd1f2('0x32')]=_[_0xd1f2('0x33')](_0x2c1d0e[_0xd1f2('0x32')]);_0x4ef315[_0xd1f2('0x34')]=_['intersection'](_0x4ef315[_0xd1f2('0x31')],_0x4ef315['query']);_0x58dd7c[_0xd1f2('0x35')]=_[_0xd1f2('0x36')](_0x4ef315['model'],qs[_0xd1f2('0x37')](_0x2c1d0e['query'][_0xd1f2('0x37')]));_0x58dd7c[_0xd1f2('0x35')]=_0x58dd7c[_0xd1f2('0x35')][_0xd1f2('0x38')]?_0x58dd7c[_0xd1f2('0x35')]:_0x4ef315[_0xd1f2('0x31')];if(!_0x2c1d0e['query'][_0xd1f2('0x39')](_0xd1f2('0x3a'))){_0x58dd7c[_0xd1f2('0x21')]=qs[_0xd1f2('0x21')](_0x2c1d0e[_0xd1f2('0x32')]['limit']);_0x58dd7c[_0xd1f2('0x1f')]=qs[_0xd1f2('0x1f')](_0x2c1d0e['query'][_0xd1f2('0x1f')]);}_0x58dd7c['order']=qs[_0xd1f2('0x3b')](_0x2c1d0e[_0xd1f2('0x32')][_0xd1f2('0x3b')]);_0x58dd7c[_0xd1f2('0x3c')]=qs['filters'](_[_0xd1f2('0x3d')](_0x2c1d0e[_0xd1f2('0x32')],_0x4ef315[_0xd1f2('0x34')]),_0x409640);if(_0x2c1d0e[_0xd1f2('0x32')][_0xd1f2('0x3e')]){_0x58dd7c[_0xd1f2('0x3c')]=_[_0xd1f2('0x3f')](_0x58dd7c['where'],{'$or':_[_0xd1f2('0x40')](_0x409640,function(_0x5db7f0){if(_0x5db7f0[_0xd1f2('0x30')]!==_0xd1f2('0x41')){var _0x1edc3d={};_0x1edc3d[_0x5db7f0['name']]={'$like':'%'+_0x2c1d0e[_0xd1f2('0x32')]['filter']+'%'};return _0x1edc3d;}})});}_0x58dd7c=_[_0xd1f2('0x3f')]({},_0x58dd7c,_0x2c1d0e[_0xd1f2('0x42')]);var _0x3c4cc1={'where':_0x58dd7c[_0xd1f2('0x3c')]};return db[_0xd1f2('0x2e')]['count'](_0x3c4cc1)[_0xd1f2('0x43')](function(_0x468311){_0x174306['count']=_0x468311;if(_0x2c1d0e[_0xd1f2('0x32')]['includeAll']){_0x58dd7c[_0xd1f2('0x44')]=[{'all':!![]}];}return db[_0xd1f2('0x2e')][_0xd1f2('0x45')](_0x58dd7c);})['then'](function(_0x3af39d){_0x174306['rows']=_0x3af39d;return _0x174306;})[_0xd1f2('0x43')](respondWithFilteredResult(_0x3e5e6c,_0x58dd7c))[_0xd1f2('0x46')](handleError(_0x3e5e6c,null));};exports[_0xd1f2('0x47')]=function(_0x6c46f8,_0x4256b6){var _0x1cca88={'raw':!![],'where':{'id':_0x6c46f8[_0xd1f2('0x48')]['id']}},_0x436b8b={};_0x436b8b['model']=_[_0xd1f2('0x33')](db[_0xd1f2('0x2e')][_0xd1f2('0x49')]);_0x436b8b[_0xd1f2('0x32')]=_[_0xd1f2('0x33')](_0x6c46f8[_0xd1f2('0x32')]);_0x436b8b['filters']=_[_0xd1f2('0x36')](_0x436b8b[_0xd1f2('0x31')],_0x436b8b[_0xd1f2('0x32')]);_0x1cca88['attributes']=_[_0xd1f2('0x36')](_0x436b8b[_0xd1f2('0x31')],qs[_0xd1f2('0x37')](_0x6c46f8[_0xd1f2('0x32')][_0xd1f2('0x37')]));_0x1cca88[_0xd1f2('0x35')]=_0x1cca88['attributes'][_0xd1f2('0x38')]?_0x1cca88[_0xd1f2('0x35')]:_0x436b8b[_0xd1f2('0x31')];if(_0x6c46f8[_0xd1f2('0x32')]['includeAll']){_0x1cca88[_0xd1f2('0x44')]=[{'all':!![]}];}_0x1cca88=_[_0xd1f2('0x3f')]({},_0x1cca88,_0x6c46f8['options']);return db[_0xd1f2('0x2e')]['find'](_0x1cca88)[_0xd1f2('0x43')](handleEntityNotFound(_0x4256b6,null))['then'](respondWithResult(_0x4256b6,null))[_0xd1f2('0x46')](handleError(_0x4256b6,null));};exports[_0xd1f2('0x4a')]=function(_0x45b0c6,_0x1b7b47){return db[_0xd1f2('0x2e')][_0xd1f2('0x4a')](_0x45b0c6['body'],{})[_0xd1f2('0x43')](respondWithResult(_0x1b7b47,0xc9))[_0xd1f2('0x46')](handleError(_0x1b7b47,null));};exports[_0xd1f2('0x4b')]=function(_0x83734e,_0xc33ad5){if(_0x83734e['body']['id']){delete _0x83734e[_0xd1f2('0x4c')]['id'];}return db[_0xd1f2('0x2e')][_0xd1f2('0x4d')]({'where':{'id':_0x83734e[_0xd1f2('0x48')]['id']}})[_0xd1f2('0x43')](handleEntityNotFound(_0xc33ad5,null))['then'](saveUpdates(_0x83734e[_0xd1f2('0x4c')],null))[_0xd1f2('0x43')](respondWithResult(_0xc33ad5,null))[_0xd1f2('0x46')](handleError(_0xc33ad5,null));};exports[_0xd1f2('0x4e')]=function(_0x23b429,_0x1f7d4c){return db[_0xd1f2('0x2e')][_0xd1f2('0x4d')]({'where':{'id':_0x23b429[_0xd1f2('0x48')]['id']}})[_0xd1f2('0x43')](handleEntityNotFound(_0x1f7d4c,null))['then'](removeEntity(_0x1f7d4c,null))['catch'](handleError(_0x1f7d4c,null));};exports[_0xd1f2('0x4f')]=function(_0x11730e,_0x37a3a8){return db[_0xd1f2('0x2e')][_0xd1f2('0x4f')]()['then'](respondWithResult(_0x37a3a8,null))[_0xd1f2('0x46')](handleError(_0x37a3a8,null));}; \ No newline at end of file +var _0xd48e=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','error','name','index','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','ChatQueueReport','count','includeAll','include','rows','catch','show','params','keys','find'];(function(_0x46596f,_0x300967){var _0x5f0981=function(_0x290396){while(--_0x290396){_0x46596f['push'](_0x46596f['shift']());}};_0x5f0981(++_0x300967);}(_0xd48e,0x93));var _0xed48=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xd48e[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed48('0x0'));var zipdir=require(_0xed48('0x1'));var jsonpatch=require(_0xed48('0x2'));var rp=require(_0xed48('0x3'));var moment=require(_0xed48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed48('0x5'));var util=require(_0xed48('0x6'));var path=require(_0xed48('0x7'));var sox=require('sox');var csv=require(_0xed48('0x8'));var ejs=require(_0xed48('0x9'));var fs=require('fs');var fs_extra=require(_0xed48('0xa'));var _=require('lodash');var squel=require(_0xed48('0xb'));var crypto=require(_0xed48('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed48('0xd'));var Papa=require(_0xed48('0xe'));var Redis=require(_0xed48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed48('0x10'));var hardwareService=require(_0xed48('0x11'));var logger=require(_0xed48('0x12'))('api');var utils=require(_0xed48('0x13'));var config=require(_0xed48('0x14'));var licenseUtil=require(_0xed48('0x15'));var db=require(_0xed48('0x16'))['db'];function respondWithStatusCode(_0x7ee238,_0xaf4b6d){_0xaf4b6d=_0xaf4b6d||0xcc;return function(_0x30bb80){if(_0x30bb80){return _0x7ee238[_0xed48('0x17')](_0xaf4b6d);}return _0x7ee238[_0xed48('0x18')](_0xaf4b6d)[_0xed48('0x19')]();};}function respondWithResult(_0x408ce8,_0x24e67c){_0x24e67c=_0x24e67c||0xc8;return function(_0x429024){if(_0x429024){return _0x408ce8['status'](_0x24e67c)[_0xed48('0x1a')](_0x429024);}};}function respondWithFilteredResult(_0x4a0296,_0x3bf0b7){return function(_0x4d23d9){if(_0x4d23d9){var _0x4d896f=typeof _0x3bf0b7[_0xed48('0x1b')]===_0xed48('0x1c')&&typeof _0x3bf0b7[_0xed48('0x1d')]===_0xed48('0x1c');var _0x1d0d94=_0x4d23d9['count'];var _0x355224=_0x4d896f?0x0:_0x3bf0b7['offset'];var _0x10c4a8=_0x4d896f?_0x4d23d9['count']:_0x3bf0b7[_0xed48('0x1b')]+_0x3bf0b7[_0xed48('0x1d')];var _0x122bf1;if(_0x10c4a8>=_0x1d0d94){_0x10c4a8=_0x1d0d94;_0x122bf1=0xc8;}else{_0x122bf1=0xce;}_0x4a0296['status'](_0x122bf1);return _0x4a0296['set'](_0xed48('0x1e'),_0x355224+'-'+_0x10c4a8+'/'+_0x1d0d94)[_0xed48('0x1a')](_0x4d23d9);}return null;};}function patchUpdates(_0x225d0f){return function(_0x54288f){try{jsonpatch[_0xed48('0x1f')](_0x54288f,_0x225d0f,!![]);}catch(_0x35f451){return BPromise[_0xed48('0x20')](_0x35f451);}return _0x54288f['save']();};}function saveUpdates(_0x277efb,_0x1bda45){return function(_0x13cb25){if(_0x13cb25){return _0x13cb25[_0xed48('0x21')](_0x277efb)[_0xed48('0x22')](function(_0x17a39b){return _0x17a39b;});}return null;};}function removeEntity(_0x4a6d93,_0x2683e4){return function(_0x4b829b){if(_0x4b829b){return _0x4b829b[_0xed48('0x23')]()[_0xed48('0x22')](function(){_0x4a6d93[_0xed48('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b460f,_0x51f67f){return function(_0x350c3c){if(!_0x350c3c){_0x4b460f[_0xed48('0x17')](0x194);}return _0x350c3c;};}function handleError(_0x277ef8,_0x26bff5){_0x26bff5=_0x26bff5||0x1f4;return function(_0x28dbf6){logger[_0xed48('0x24')](_0x28dbf6['stack']);if(_0x28dbf6[_0xed48('0x25')]){delete _0x28dbf6[_0xed48('0x25')];}_0x277ef8[_0xed48('0x18')](_0x26bff5)['send'](_0x28dbf6);};}exports[_0xed48('0x26')]=function(_0x2352a4,_0x5c66e4){var _0x2baff3={},_0x5ed24d={},_0x52a315={'count':0x0,'rows':[]};var _0x391e46=_['map'](db['ChatQueueReport'][_0xed48('0x27')],function(_0x982fdd){return{'name':_0x982fdd[_0xed48('0x28')],'type':_0x982fdd['type'][_0xed48('0x29')]};});_0x5ed24d[_0xed48('0x2a')]=_[_0xed48('0x2b')](_0x391e46,_0xed48('0x25'));_0x5ed24d['query']=_['keys'](_0x2352a4[_0xed48('0x2c')]);_0x5ed24d['filters']=_[_0xed48('0x2d')](_0x5ed24d[_0xed48('0x2a')],_0x5ed24d[_0xed48('0x2c')]);_0x2baff3[_0xed48('0x2e')]=_['intersection'](_0x5ed24d['model'],qs[_0xed48('0x2f')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x2f')]));_0x2baff3[_0xed48('0x2e')]=_0x2baff3[_0xed48('0x2e')][_0xed48('0x30')]?_0x2baff3[_0xed48('0x2e')]:_0x5ed24d[_0xed48('0x2a')];if(!_0x2352a4[_0xed48('0x2c')][_0xed48('0x31')](_0xed48('0x32'))){_0x2baff3[_0xed48('0x1d')]=qs['limit'](_0x2352a4[_0xed48('0x2c')][_0xed48('0x1d')]);_0x2baff3[_0xed48('0x1b')]=qs[_0xed48('0x1b')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x1b')]);}_0x2baff3[_0xed48('0x33')]=qs[_0xed48('0x34')](_0x2352a4[_0xed48('0x2c')][_0xed48('0x34')]);_0x2baff3['where']=qs[_0xed48('0x35')](_[_0xed48('0x36')](_0x2352a4[_0xed48('0x2c')],_0x5ed24d[_0xed48('0x35')]),_0x391e46);if(_0x2352a4['query'][_0xed48('0x37')]){_0x2baff3[_0xed48('0x38')]=_['merge'](_0x2baff3[_0xed48('0x38')],{'$or':_[_0xed48('0x2b')](_0x391e46,function(_0x104f65){if(_0x104f65['type']!=='VIRTUAL'){var _0x3281c2={};_0x3281c2[_0x104f65['name']]={'$like':'%'+_0x2352a4[_0xed48('0x2c')][_0xed48('0x37')]+'%'};return _0x3281c2;}})});}_0x2baff3=_[_0xed48('0x39')]({},_0x2baff3,_0x2352a4[_0xed48('0x3a')]);var _0x2a3bfc={'where':_0x2baff3[_0xed48('0x38')]};return db[_0xed48('0x3b')][_0xed48('0x3c')](_0x2a3bfc)[_0xed48('0x22')](function(_0x5b1b8c){_0x52a315[_0xed48('0x3c')]=_0x5b1b8c;if(_0x2352a4[_0xed48('0x2c')][_0xed48('0x3d')]){_0x2baff3[_0xed48('0x3e')]=[{'all':!![]}];}return db[_0xed48('0x3b')]['findAll'](_0x2baff3);})[_0xed48('0x22')](function(_0x1af81d){_0x52a315[_0xed48('0x3f')]=_0x1af81d;return _0x52a315;})[_0xed48('0x22')](respondWithFilteredResult(_0x5c66e4,_0x2baff3))[_0xed48('0x40')](handleError(_0x5c66e4,null));};exports[_0xed48('0x41')]=function(_0x13d84b,_0x1af430){var _0x1d4d1d={'raw':!![],'where':{'id':_0x13d84b[_0xed48('0x42')]['id']}},_0x28014f={};_0x28014f[_0xed48('0x2a')]=_[_0xed48('0x43')](db[_0xed48('0x3b')][_0xed48('0x27')]);_0x28014f[_0xed48('0x2c')]=_[_0xed48('0x43')](_0x13d84b[_0xed48('0x2c')]);_0x28014f['filters']=_[_0xed48('0x2d')](_0x28014f[_0xed48('0x2a')],_0x28014f[_0xed48('0x2c')]);_0x1d4d1d[_0xed48('0x2e')]=_[_0xed48('0x2d')](_0x28014f[_0xed48('0x2a')],qs['fields'](_0x13d84b[_0xed48('0x2c')]['fields']));_0x1d4d1d[_0xed48('0x2e')]=_0x1d4d1d[_0xed48('0x2e')]['length']?_0x1d4d1d['attributes']:_0x28014f[_0xed48('0x2a')];if(_0x13d84b['query'][_0xed48('0x3d')]){_0x1d4d1d['include']=[{'all':!![]}];}_0x1d4d1d=_['merge']({},_0x1d4d1d,_0x13d84b['options']);return db[_0xed48('0x3b')][_0xed48('0x44')](_0x1d4d1d)[_0xed48('0x22')](handleEntityNotFound(_0x1af430,null))[_0xed48('0x22')](respondWithResult(_0x1af430,null))[_0xed48('0x40')](handleError(_0x1af430,null));};exports[_0xed48('0x45')]=function(_0x5b02a0,_0x51d9d6){return db[_0xed48('0x3b')][_0xed48('0x45')](_0x5b02a0[_0xed48('0x46')],{})[_0xed48('0x22')](respondWithResult(_0x51d9d6,0xc9))[_0xed48('0x40')](handleError(_0x51d9d6,null));};exports[_0xed48('0x21')]=function(_0x505ef9,_0x25fee5){if(_0x505ef9['body']['id']){delete _0x505ef9['body']['id'];}return db['ChatQueueReport'][_0xed48('0x44')]({'where':{'id':_0x505ef9[_0xed48('0x42')]['id']}})[_0xed48('0x22')](handleEntityNotFound(_0x25fee5,null))[_0xed48('0x22')](saveUpdates(_0x505ef9[_0xed48('0x46')],null))[_0xed48('0x22')](respondWithResult(_0x25fee5,null))[_0xed48('0x40')](handleError(_0x25fee5,null));};exports[_0xed48('0x23')]=function(_0x16b21e,_0x3d62a2){return db[_0xed48('0x3b')][_0xed48('0x44')]({'where':{'id':_0x16b21e['params']['id']}})[_0xed48('0x22')](handleEntityNotFound(_0x3d62a2,null))[_0xed48('0x22')](removeEntity(_0x3d62a2,null))[_0xed48('0x40')](handleError(_0x3d62a2,null));};exports[_0xed48('0x47')]=function(_0x1f30ec,_0x143920){return db[_0xed48('0x3b')][_0xed48('0x47')]()[_0xed48('0x22')](respondWithResult(_0x143920,null))[_0xed48('0x40')](handleError(_0x143920,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8f2f07c..8569d16 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x445fbc,_0x1a17f9){var _0x5762a9=function(_0xdb41b8){while(--_0xdb41b8){_0x445fbc['push'](_0x445fbc['shift']());}};_0x5762a9(++_0x1a17f9);}(_0xb10b,0x12a));var _0xbb10=function(_0xcbd7ae,_0x60d37d){_0xcbd7ae=_0xcbd7ae-0x0;var _0x334d47=_0xb10b[_0xcbd7ae];return _0x334d47;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18fdee,_0x1660cb){var _0x7c3726=function(_0x16ec2b){while(--_0x16ec2b){_0x18fdee['push'](_0x18fdee['shift']());}};_0x7c3726(++_0x1660cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index d1a9682..3354f9a 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 _0x11b5=['jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x53f3d0,_0x41ca07){var _0x583eb9=function(_0x1f11f8){while(--_0x1f11f8){_0x53f3d0['push'](_0x53f3d0['shift']());}};_0x583eb9(++_0x41ca07);}(_0x11b5,0x16c));var _0x511b=function(_0x21c6c1,_0x217ec7){_0x21c6c1=_0x21c6c1-0x0;var _0x5eb2a6=_0x11b5[_0x21c6c1];return _0x5eb2a6;};'use strict';var _=require(_0x511b('0x0'));var util=require(_0x511b('0x1'));var moment=require('moment');var BPromise=require(_0x511b('0x2'));var rs=require(_0x511b('0x3'));var fs=require('fs');var Redis=require(_0x511b('0x4'));var db=require(_0x511b('0x5'))['db'];var utils=require(_0x511b('0x6'));var logger=require(_0x511b('0x7'))(_0x511b('0x8'));var config=require(_0x511b('0x9'));var jayson=require(_0x511b('0xa'));var client=jayson[_0x511b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d05be,_0x3315e7,_0x2060e0){return new BPromise(function(_0x480785,_0x10593b){return client[_0x511b('0xc')](_0x3d05be,_0x2060e0)[_0x511b('0xd')](function(_0xaf0c5a){logger[_0x511b('0xe')](_0x511b('0xf'),_0x3315e7,_0x511b('0x10'));logger[_0x511b('0x11')](_0x511b('0x12'),_0x3315e7,_0x511b('0x10'),JSON[_0x511b('0x13')](_0xaf0c5a));if(_0xaf0c5a['error']){if(_0xaf0c5a[_0x511b('0x14')][_0x511b('0x15')]===0x1f4){logger['error'](_0x511b('0xf'),_0x3315e7,_0xaf0c5a[_0x511b('0x14')][_0x511b('0x16')]);return _0x10593b(_0xaf0c5a[_0x511b('0x14')][_0x511b('0x16')]);}logger[_0x511b('0x14')](_0x511b('0xf'),_0x3315e7,_0xaf0c5a['error'][_0x511b('0x16')]);return _0x480785(_0xaf0c5a[_0x511b('0x14')][_0x511b('0x16')]);}else{logger[_0x511b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x3315e7,_0x511b('0x10'));_0x480785(_0xaf0c5a[_0x511b('0x17')][_0x511b('0x16')]);}})[_0x511b('0x18')](function(_0x4682e4){logger[_0x511b('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x3315e7,_0x4682e4);_0x10593b(_0x4682e4);});});}exports[_0x511b('0x19')]=function(_0x53c1fa){var _0x331736=this;return new Promise(function(_0x167d16,_0x10a13f){return db[_0x511b('0x1a')][_0x511b('0x1b')](_0x53c1fa['body'],{'raw':_0x53c1fa[_0x511b('0x1c')]?_0x53c1fa[_0x511b('0x1c')][_0x511b('0x1d')]===undefined?!![]:![]:!![]})[_0x511b('0xd')](function(_0x538007){logger[_0x511b('0xe')](_0x511b('0x19'),_0x53c1fa);logger['debug'](_0x511b('0x19'),_0x53c1fa,JSON['stringify'](_0x538007));_0x167d16(_0x538007);})['catch'](function(_0x3a6045){logger[_0x511b('0x14')](_0x511b('0x19'),_0x3a6045[_0x511b('0x16')],_0x53c1fa);_0x10a13f(_0x331736['error'](0x1f4,_0x3a6045['message']));});});};exports[_0x511b('0x1e')]=function(_0x935286){var _0x10fc17=this;return new Promise(function(_0x35eda0,_0xcc2bc9){return db[_0x511b('0x1a')][_0x511b('0x1f')](_0x935286['body'],{'raw':_0x935286['options']?_0x935286['options'][_0x511b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x935286['options']?_0x935286[_0x511b('0x1c')][_0x511b('0x20')]||null:null,'attributes':_0x935286[_0x511b('0x1c')]?_0x935286[_0x511b('0x1c')]['attributes']||null:null,'limit':_0x935286[_0x511b('0x1c')]?_0x935286['options'][_0x511b('0x21')]||null:null})['then'](function(_0x134594){logger[_0x511b('0xe')](_0x511b('0x1e'),_0x935286);logger[_0x511b('0x11')](_0x511b('0x1e'),_0x935286,JSON[_0x511b('0x13')](_0x134594));_0x35eda0(_0x134594);})[_0x511b('0x18')](function(_0x5908b3){logger['error'](_0x511b('0x1e'),_0x5908b3[_0x511b('0x16')],_0x935286);_0xcc2bc9(_0x10fc17[_0x511b('0x14')](0x1f4,_0x5908b3[_0x511b('0x16')]));});});}; \ No newline at end of file +var _0xb545=['stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x9e4d50,_0x35ed2f){var _0x158548=function(_0x24389b){while(--_0x24389b){_0x9e4d50['push'](_0x9e4d50['shift']());}};_0x158548(++_0x35ed2f);}(_0xb545,0x74));var _0x5b54=function(_0x34f690,_0x4e4e7e){_0x34f690=_0x34f690-0x0;var _0x55700b=_0xb545[_0x34f690];return _0x55700b;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var moment=require('moment');var BPromise=require(_0x5b54('0x2'));var rs=require(_0x5b54('0x3'));var fs=require('fs');var Redis=require(_0x5b54('0x4'));var db=require(_0x5b54('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b54('0x6'));var config=require(_0x5b54('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5b54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45472a,_0x3ff15f,_0xce41d6){return new BPromise(function(_0x18debd,_0x82a1f8){return client[_0x5b54('0x9')](_0x45472a,_0xce41d6)[_0x5b54('0xa')](function(_0x3f3cda){logger[_0x5b54('0xb')](_0x5b54('0xc'),_0x3ff15f,'request\x20sent');logger[_0x5b54('0xd')](_0x5b54('0xe'),_0x3ff15f,_0x5b54('0xf'),JSON[_0x5b54('0x10')](_0x3f3cda));if(_0x3f3cda[_0x5b54('0x11')]){if(_0x3f3cda['error'][_0x5b54('0x12')]===0x1f4){logger[_0x5b54('0x11')](_0x5b54('0xc'),_0x3ff15f,_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);return _0x82a1f8(_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x3ff15f,_0x3f3cda[_0x5b54('0x11')]['message']);return _0x18debd(_0x3f3cda[_0x5b54('0x11')][_0x5b54('0x13')]);}else{logger[_0x5b54('0xb')](_0x5b54('0xc'),_0x3ff15f,_0x5b54('0xf'));_0x18debd(_0x3f3cda[_0x5b54('0x14')][_0x5b54('0x13')]);}})[_0x5b54('0x15')](function(_0x3a7080){logger[_0x5b54('0x11')](_0x5b54('0xc'),_0x3ff15f,_0x3a7080);_0x82a1f8(_0x3a7080);});});}exports[_0x5b54('0x16')]=function(_0x41439f){var _0x593cb1=this;return new Promise(function(_0x37c4de,_0x37e937){return db[_0x5b54('0x17')][_0x5b54('0x18')](_0x41439f[_0x5b54('0x19')],{'raw':_0x41439f['options']?_0x41439f[_0x5b54('0x1a')][_0x5b54('0x1b')]===undefined?!![]:![]:!![]})[_0x5b54('0xa')](function(_0x26d1c3){logger[_0x5b54('0xb')](_0x5b54('0x16'),_0x41439f);logger[_0x5b54('0xd')]('CreateChatQueueReport',_0x41439f,JSON[_0x5b54('0x10')](_0x26d1c3));_0x37c4de(_0x26d1c3);})['catch'](function(_0x21c1a5){logger[_0x5b54('0x11')]('CreateChatQueueReport',_0x21c1a5[_0x5b54('0x13')],_0x41439f);_0x37e937(_0x593cb1[_0x5b54('0x11')](0x1f4,_0x21c1a5[_0x5b54('0x13')]));});});};exports[_0x5b54('0x1c')]=function(_0x56035c){var _0x900e54=this;return new Promise(function(_0x333588,_0x369005){return db['ChatQueueReport'][_0x5b54('0x1d')](_0x56035c['body'],{'raw':_0x56035c['options']?_0x56035c['options'][_0x5b54('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56035c[_0x5b54('0x1a')]?_0x56035c[_0x5b54('0x1a')][_0x5b54('0x1e')]||null:null,'attributes':_0x56035c['options']?_0x56035c[_0x5b54('0x1a')][_0x5b54('0x1f')]||null:null,'limit':_0x56035c[_0x5b54('0x1a')]?_0x56035c['options'][_0x5b54('0x20')]||null:null})[_0x5b54('0xa')](function(_0x343ab1){logger[_0x5b54('0xb')]('UpdateChatQueueReport',_0x56035c);logger['debug'](_0x5b54('0x1c'),_0x56035c,JSON[_0x5b54('0x10')](_0x343ab1));_0x333588(_0x343ab1);})[_0x5b54('0x15')](function(_0xb8e7a1){logger['error'](_0x5b54('0x1c'),_0xb8e7a1[_0x5b54('0x13')],_0x56035c);_0x369005(_0x900e54[_0x5b54('0x11')](0x1f4,_0xb8e7a1['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3f02a53..5279bb6 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 _0xb637=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb637,0x1c4));var _0x7b63=function(_0x9230a4,_0xacb7f){_0x9230a4=_0x9230a4-0x0;var _0x280d2c=_0xb637[_0x9230a4];return _0x280d2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b63('0x0'));var timeout=require(_0x7b63('0x1'));var express=require(_0x7b63('0x2'));var router=express[_0x7b63('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7b63('0x4'));var interaction=require(_0x7b63('0x5'));var config=require(_0x7b63('0x6'));var controller=require(_0x7b63('0x7'));router[_0x7b63('0x8')]('/',auth[_0x7b63('0x9')](),controller['index']);router[_0x7b63('0x8')](_0x7b63('0xa'),auth[_0x7b63('0x9')](),controller[_0x7b63('0xb')]);router[_0x7b63('0x8')](_0x7b63('0xc'),auth[_0x7b63('0x9')](),controller[_0x7b63('0xd')]);router[_0x7b63('0xe')]('/',auth[_0x7b63('0x9')](),controller['create']);router['put']('/:id',auth[_0x7b63('0x9')](),controller[_0x7b63('0xf')]);router['delete'](_0x7b63('0xc'),auth[_0x7b63('0x9')](),controller[_0x7b63('0x10')]);module[_0x7b63('0x11')]=router; \ No newline at end of file +var _0xa586=['show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x5de751,_0x1951b7){var _0x2debd1=function(_0x38922e){while(--_0x38922e){_0x5de751['push'](_0x5de751['shift']());}};_0x2debd1(++_0x1951b7);}(_0xa586,0x151));var _0x6a58=function(_0xbf5e16,_0x146ce3){_0xbf5e16=_0xbf5e16-0x0;var _0x5975a5=_0xa586[_0xbf5e16];return _0x5975a5;};'use strict';var multer=require(_0x6a58('0x0'));var util=require(_0x6a58('0x1'));var path=require(_0x6a58('0x2'));var timeout=require(_0x6a58('0x3'));var express=require(_0x6a58('0x4'));var router=express[_0x6a58('0x5')]();var fs_extra=require(_0x6a58('0x6'));var auth=require(_0x6a58('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6a58('0x8'));var controller=require(_0x6a58('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a58('0xa')]);router['get'](_0x6a58('0xb'),auth[_0x6a58('0xc')](),controller[_0x6a58('0xd')]);router[_0x6a58('0xe')]('/:id',auth[_0x6a58('0xc')](),controller[_0x6a58('0xf')]);router[_0x6a58('0x10')]('/',auth[_0x6a58('0xc')](),controller['create']);router['put'](_0x6a58('0x11'),auth['isAuthenticated'](),controller[_0x6a58('0x12')]);router[_0x6a58('0x13')](_0x6a58('0x11'),auth[_0x6a58('0xc')](),controller[_0x6a58('0x14')]);module[_0x6a58('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 94f8b5a..c7da2df 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4fe5c9,_0x2bb9ff){var _0x273abb=function(_0x10b184){while(--_0x10b184){_0x4fe5c9['push'](_0x4fe5c9['shift']());}};_0x273abb(++_0x2bb9ff);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x248bf0,_0x29a685){_0x248bf0=_0x248bf0-0x0;var _0x455c00=_0xf3cd[_0x248bf0];return _0x455c00;};'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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xb3737e,_0x31f04b){var _0x2d9223=function(_0x4afec8){while(--_0x4afec8){_0xb3737e['push'](_0xb3737e['shift']());}};_0x2d9223(++_0x31f04b);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 980d0fb..59489d0 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 _0x6c41=['includeAll','merge','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','apply','reject','update','sendStatus','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','include','then','rows','catch','show','params'];(function(_0x48439c,_0x5147af){var _0x54376f=function(_0x1075b5){while(--_0x1075b5){_0x48439c['push'](_0x48439c['shift']());}};_0x54376f(++_0x5147af);}(_0x6c41,0x1ab));var _0x16c4=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x6c41[_0x492535];return _0x256620;};'use strict';var emlformat=require(_0x16c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16c4('0x2'));var moment=require(_0x16c4('0x3'));var BPromise=require(_0x16c4('0x4'));var Mustache=require(_0x16c4('0x5'));var util=require(_0x16c4('0x6'));var path=require('path');var sox=require(_0x16c4('0x7'));var csv=require('to-csv');var ejs=require(_0x16c4('0x8'));var fs=require('fs');var fs_extra=require(_0x16c4('0x9'));var _=require('lodash');var squel=require(_0x16c4('0xa'));var crypto=require('crypto');var jsforce=require(_0x16c4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x16c4('0xc'));var Redis=require(_0x16c4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x16c4('0xe'));var as=require(_0x16c4('0xf'));var hardwareService=require(_0x16c4('0x10'));var logger=require(_0x16c4('0x11'))('api');var utils=require(_0x16c4('0x12'));var config=require(_0x16c4('0x13'));var licenseUtil=require(_0x16c4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x327dba,_0x16c2d5){_0x16c2d5=_0x16c2d5||0xcc;return function(_0xa6e719){if(_0xa6e719){return _0x327dba['sendStatus'](_0x16c2d5);}return _0x327dba[_0x16c4('0x15')](_0x16c2d5)[_0x16c4('0x16')]();};}function respondWithResult(_0x1397c2,_0x53fe69){_0x53fe69=_0x53fe69||0xc8;return function(_0x3f1fb9){if(_0x3f1fb9){return _0x1397c2[_0x16c4('0x15')](_0x53fe69)[_0x16c4('0x17')](_0x3f1fb9);}};}function respondWithFilteredResult(_0x2d8b3d,_0x4f87db){return function(_0x7b0b1b){if(_0x7b0b1b){var _0x53a516=typeof _0x4f87db['offset']===_0x16c4('0x18')&&typeof _0x4f87db['limit']===_0x16c4('0x18');var _0x4e9240=_0x7b0b1b[_0x16c4('0x19')];var _0x451bc2=_0x53a516?0x0:_0x4f87db[_0x16c4('0x1a')];var _0x2ed4ca=_0x53a516?_0x7b0b1b[_0x16c4('0x19')]:_0x4f87db[_0x16c4('0x1a')]+_0x4f87db['limit'];var _0xf1e291;if(_0x2ed4ca>=_0x4e9240){_0x2ed4ca=_0x4e9240;_0xf1e291=0xc8;}else{_0xf1e291=0xce;}_0x2d8b3d[_0x16c4('0x15')](_0xf1e291);return _0x2d8b3d['set']('Content-Range',_0x451bc2+'-'+_0x2ed4ca+'/'+_0x4e9240)[_0x16c4('0x17')](_0x7b0b1b);}return null;};}function patchUpdates(_0x1add49){return function(_0xa4afdd){try{jsonpatch[_0x16c4('0x1b')](_0xa4afdd,_0x1add49,!![]);}catch(_0x5e7e48){return BPromise[_0x16c4('0x1c')](_0x5e7e48);}return _0xa4afdd['save']();};}function saveUpdates(_0x268893,_0x219c93){return function(_0x297e85){if(_0x297e85){return _0x297e85[_0x16c4('0x1d')](_0x268893)['then'](function(_0x565ede){return _0x565ede;});}return null;};}function removeEntity(_0x21488a,_0x2aa5c8){return function(_0x430252){if(_0x430252){return _0x430252['destroy']()['then'](function(){_0x21488a[_0x16c4('0x15')](0xcc)[_0x16c4('0x16')]();});}};}function handleEntityNotFound(_0x52a2ec,_0x62a9db){return function(_0x89d5b9){if(!_0x89d5b9){_0x52a2ec[_0x16c4('0x1e')](0x194);}return _0x89d5b9;};}function handleError(_0x1f91f7,_0x1ed58c){_0x1ed58c=_0x1ed58c||0x1f4;return function(_0x590498){logger['error'](_0x590498[_0x16c4('0x1f')]);if(_0x590498[_0x16c4('0x20')]){delete _0x590498['name'];}_0x1f91f7[_0x16c4('0x15')](_0x1ed58c)[_0x16c4('0x21')](_0x590498);};}exports[_0x16c4('0x22')]=function(_0x22fd38,_0x39aca6){var _0x5da0e1={},_0x3df669={},_0x46acac={'count':0x0,'rows':[]};var _0x4c6a22=_[_0x16c4('0x23')](db[_0x16c4('0x24')][_0x16c4('0x25')],function(_0x191506){return{'name':_0x191506['fieldName'],'type':_0x191506[_0x16c4('0x26')]['key']};});_0x3df669[_0x16c4('0x27')]=_[_0x16c4('0x23')](_0x4c6a22,'name');_0x3df669['query']=_[_0x16c4('0x28')](_0x22fd38[_0x16c4('0x29')]);_0x3df669[_0x16c4('0x2a')]=_[_0x16c4('0x2b')](_0x3df669[_0x16c4('0x27')],_0x3df669[_0x16c4('0x29')]);_0x5da0e1[_0x16c4('0x2c')]=_['intersection'](_0x3df669[_0x16c4('0x27')],qs[_0x16c4('0x2d')](_0x22fd38[_0x16c4('0x29')][_0x16c4('0x2d')]));_0x5da0e1['attributes']=_0x5da0e1[_0x16c4('0x2c')][_0x16c4('0x2e')]?_0x5da0e1[_0x16c4('0x2c')]:_0x3df669['model'];if(!_0x22fd38[_0x16c4('0x29')][_0x16c4('0x2f')](_0x16c4('0x30'))){_0x5da0e1[_0x16c4('0x31')]=qs[_0x16c4('0x31')](_0x22fd38[_0x16c4('0x29')]['limit']);_0x5da0e1['offset']=qs[_0x16c4('0x1a')](_0x22fd38[_0x16c4('0x29')][_0x16c4('0x1a')]);}_0x5da0e1[_0x16c4('0x32')]=qs[_0x16c4('0x33')](_0x22fd38[_0x16c4('0x29')][_0x16c4('0x33')]);_0x5da0e1['where']=qs['filters'](_[_0x16c4('0x34')](_0x22fd38[_0x16c4('0x29')],_0x3df669['filters']),_0x4c6a22);if(_0x22fd38['query'][_0x16c4('0x35')]){_0x5da0e1['where']=_['merge'](_0x5da0e1[_0x16c4('0x36')],{'$or':_[_0x16c4('0x23')](_0x4c6a22,function(_0x40f0d2){if(_0x40f0d2[_0x16c4('0x26')]!==_0x16c4('0x37')){var _0x2cbb69={};_0x2cbb69[_0x40f0d2[_0x16c4('0x20')]]={'$like':'%'+_0x22fd38[_0x16c4('0x29')]['filter']+'%'};return _0x2cbb69;}})});}_0x5da0e1=_['merge']({},_0x5da0e1,_0x22fd38[_0x16c4('0x38')]);var _0x530eff={'where':_0x5da0e1['where']};return db['ChatTransferReport'][_0x16c4('0x19')](_0x530eff)['then'](function(_0xbdaac3){_0x46acac[_0x16c4('0x19')]=_0xbdaac3;if(_0x22fd38[_0x16c4('0x29')]['includeAll']){_0x5da0e1[_0x16c4('0x39')]=[{'all':!![]}];}return db[_0x16c4('0x24')]['findAll'](_0x5da0e1);})[_0x16c4('0x3a')](function(_0x29c009){_0x46acac[_0x16c4('0x3b')]=_0x29c009;return _0x46acac;})['then'](respondWithFilteredResult(_0x39aca6,_0x5da0e1))[_0x16c4('0x3c')](handleError(_0x39aca6,null));};exports[_0x16c4('0x3d')]=function(_0x1d55e0,_0x42a2e1){var _0x57a97d={'raw':!![],'where':{'id':_0x1d55e0[_0x16c4('0x3e')]['id']}},_0x4a3759={};_0x4a3759[_0x16c4('0x27')]=_[_0x16c4('0x28')](db[_0x16c4('0x24')]['rawAttributes']);_0x4a3759['query']=_[_0x16c4('0x28')](_0x1d55e0[_0x16c4('0x29')]);_0x4a3759[_0x16c4('0x2a')]=_[_0x16c4('0x2b')](_0x4a3759[_0x16c4('0x27')],_0x4a3759[_0x16c4('0x29')]);_0x57a97d[_0x16c4('0x2c')]=_[_0x16c4('0x2b')](_0x4a3759['model'],qs[_0x16c4('0x2d')](_0x1d55e0[_0x16c4('0x29')]['fields']));_0x57a97d['attributes']=_0x57a97d[_0x16c4('0x2c')][_0x16c4('0x2e')]?_0x57a97d[_0x16c4('0x2c')]:_0x4a3759[_0x16c4('0x27')];if(_0x1d55e0[_0x16c4('0x29')][_0x16c4('0x3f')]){_0x57a97d['include']=[{'all':!![]}];}_0x57a97d=_[_0x16c4('0x40')]({},_0x57a97d,_0x1d55e0[_0x16c4('0x38')]);return db[_0x16c4('0x24')][_0x16c4('0x41')](_0x57a97d)[_0x16c4('0x3a')](handleEntityNotFound(_0x42a2e1,null))['then'](respondWithResult(_0x42a2e1,null))['catch'](handleError(_0x42a2e1,null));};exports[_0x16c4('0x42')]=function(_0x1e39ed,_0x28bc0c){return db[_0x16c4('0x24')]['create'](_0x1e39ed[_0x16c4('0x43')],{})[_0x16c4('0x3a')](respondWithResult(_0x28bc0c,0xc9))[_0x16c4('0x3c')](handleError(_0x28bc0c,null));};exports[_0x16c4('0x1d')]=function(_0x2d269b,_0x3cd9cd){if(_0x2d269b[_0x16c4('0x43')]['id']){delete _0x2d269b[_0x16c4('0x43')]['id'];}return db['ChatTransferReport'][_0x16c4('0x41')]({'where':{'id':_0x2d269b['params']['id']}})[_0x16c4('0x3a')](handleEntityNotFound(_0x3cd9cd,null))[_0x16c4('0x3a')](saveUpdates(_0x2d269b['body'],null))[_0x16c4('0x3a')](respondWithResult(_0x3cd9cd,null))['catch'](handleError(_0x3cd9cd,null));};exports[_0x16c4('0x44')]=function(_0x10e8c9,_0x13cfd4){return db[_0x16c4('0x24')][_0x16c4('0x41')]({'where':{'id':_0x10e8c9[_0x16c4('0x3e')]['id']}})[_0x16c4('0x3a')](handleEntityNotFound(_0x13cfd4,null))[_0x16c4('0x3a')](removeEntity(_0x13cfd4,null))[_0x16c4('0x3c')](handleError(_0x13cfd4,null));};exports[_0x16c4('0x45')]=function(_0x55e807,_0x3b3010){return db[_0x16c4('0x24')][_0x16c4('0x45')]()[_0x16c4('0x3a')](respondWithResult(_0x3b3010,null))[_0x16c4('0x3c')](handleError(_0x3b3010,null));}; \ No newline at end of file +var _0x05e1=['ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','then','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','fields','options','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x438ce2,_0x33ba8f){var _0x8cc47a=function(_0x7482a3){while(--_0x7482a3){_0x438ce2['push'](_0x438ce2['shift']());}};_0x8cc47a(++_0x33ba8f);}(_0x05e1,0x1d3));var _0x105e=function(_0x56c91a,_0x21a76f){_0x56c91a=_0x56c91a-0x0;var _0x536659=_0x05e1[_0x56c91a];return _0x536659;};'use strict';var emlformat=require(_0x105e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x105e('0x1'));var jsonpatch=require(_0x105e('0x2'));var rp=require(_0x105e('0x3'));var moment=require('moment');var BPromise=require(_0x105e('0x4'));var Mustache=require(_0x105e('0x5'));var util=require(_0x105e('0x6'));var path=require(_0x105e('0x7'));var sox=require(_0x105e('0x8'));var csv=require('to-csv');var ejs=require(_0x105e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x105e('0xa'));var squel=require('squel');var crypto=require(_0x105e('0xb'));var jsforce=require(_0x105e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x105e('0xd'));var querystring=require(_0x105e('0xe'));var Papa=require(_0x105e('0xf'));var Redis=require(_0x105e('0x10'));var authService=require(_0x105e('0x11'));var qs=require(_0x105e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x105e('0x13'));var logger=require('../../config/logger')(_0x105e('0x14'));var utils=require('../../config/utils');var config=require(_0x105e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x105e('0x16'))['db'];function respondWithStatusCode(_0x597aa1,_0x3d9736){_0x3d9736=_0x3d9736||0xcc;return function(_0x53c391){if(_0x53c391){return _0x597aa1['sendStatus'](_0x3d9736);}return _0x597aa1[_0x105e('0x17')](_0x3d9736)[_0x105e('0x18')]();};}function respondWithResult(_0x47b80c,_0x4e8226){_0x4e8226=_0x4e8226||0xc8;return function(_0x3b4dfc){if(_0x3b4dfc){return _0x47b80c[_0x105e('0x17')](_0x4e8226)[_0x105e('0x19')](_0x3b4dfc);}};}function respondWithFilteredResult(_0x3d3889,_0x283121){return function(_0x2ce37c){if(_0x2ce37c){var _0x4db9e7=typeof _0x283121[_0x105e('0x1a')]===_0x105e('0x1b')&&typeof _0x283121['limit']==='undefined';var _0x1c0dce=_0x2ce37c[_0x105e('0x1c')];var _0xf49c3f=_0x4db9e7?0x0:_0x283121[_0x105e('0x1a')];var _0x5bce69=_0x4db9e7?_0x2ce37c[_0x105e('0x1c')]:_0x283121['offset']+_0x283121[_0x105e('0x1d')];var _0x2cdb5f;if(_0x5bce69>=_0x1c0dce){_0x5bce69=_0x1c0dce;_0x2cdb5f=0xc8;}else{_0x2cdb5f=0xce;}_0x3d3889[_0x105e('0x17')](_0x2cdb5f);return _0x3d3889[_0x105e('0x1e')](_0x105e('0x1f'),_0xf49c3f+'-'+_0x5bce69+'/'+_0x1c0dce)[_0x105e('0x19')](_0x2ce37c);}return null;};}function patchUpdates(_0x2b8c5b){return function(_0x47baa2){try{jsonpatch['apply'](_0x47baa2,_0x2b8c5b,!![]);}catch(_0x53cbd0){return BPromise['reject'](_0x53cbd0);}return _0x47baa2['save']();};}function saveUpdates(_0x533f04,_0x3b54a3){return function(_0x2e00de){if(_0x2e00de){return _0x2e00de['update'](_0x533f04)[_0x105e('0x20')](function(_0x3cd14a){return _0x3cd14a;});}return null;};}function removeEntity(_0x40855a,_0x1b8a92){return function(_0x38f24e){if(_0x38f24e){return _0x38f24e['destroy']()[_0x105e('0x20')](function(){_0x40855a[_0x105e('0x17')](0xcc)[_0x105e('0x18')]();});}};}function handleEntityNotFound(_0x217191,_0x1aa3df){return function(_0x31eebb){if(!_0x31eebb){_0x217191[_0x105e('0x21')](0x194);}return _0x31eebb;};}function handleError(_0x4f014b,_0x468acc){_0x468acc=_0x468acc||0x1f4;return function(_0x12ee60){logger[_0x105e('0x22')](_0x12ee60[_0x105e('0x23')]);if(_0x12ee60[_0x105e('0x24')]){delete _0x12ee60['name'];}_0x4f014b[_0x105e('0x17')](_0x468acc)['send'](_0x12ee60);};}exports[_0x105e('0x25')]=function(_0x18adf5,_0x5e8098){var _0x22c189={},_0x532488={},_0xc1d166={'count':0x0,'rows':[]};var _0x4199e7=_[_0x105e('0x26')](db[_0x105e('0x27')][_0x105e('0x28')],function(_0x1287a1){return{'name':_0x1287a1['fieldName'],'type':_0x1287a1[_0x105e('0x29')][_0x105e('0x2a')]};});_0x532488[_0x105e('0x2b')]=_[_0x105e('0x26')](_0x4199e7,_0x105e('0x24'));_0x532488[_0x105e('0x2c')]=_[_0x105e('0x2d')](_0x18adf5[_0x105e('0x2c')]);_0x532488['filters']=_['intersection'](_0x532488[_0x105e('0x2b')],_0x532488[_0x105e('0x2c')]);_0x22c189[_0x105e('0x2e')]=_[_0x105e('0x2f')](_0x532488[_0x105e('0x2b')],qs['fields'](_0x18adf5[_0x105e('0x2c')]['fields']));_0x22c189[_0x105e('0x2e')]=_0x22c189['attributes'][_0x105e('0x30')]?_0x22c189[_0x105e('0x2e')]:_0x532488[_0x105e('0x2b')];if(!_0x18adf5[_0x105e('0x2c')][_0x105e('0x31')](_0x105e('0x32'))){_0x22c189['limit']=qs[_0x105e('0x1d')](_0x18adf5['query']['limit']);_0x22c189[_0x105e('0x1a')]=qs[_0x105e('0x1a')](_0x18adf5[_0x105e('0x2c')][_0x105e('0x1a')]);}_0x22c189['order']=qs[_0x105e('0x33')](_0x18adf5[_0x105e('0x2c')][_0x105e('0x33')]);_0x22c189[_0x105e('0x34')]=qs[_0x105e('0x35')](_['pick'](_0x18adf5[_0x105e('0x2c')],_0x532488[_0x105e('0x35')]),_0x4199e7);if(_0x18adf5[_0x105e('0x2c')][_0x105e('0x36')]){_0x22c189['where']=_[_0x105e('0x37')](_0x22c189[_0x105e('0x34')],{'$or':_['map'](_0x4199e7,function(_0x1d517a){if(_0x1d517a[_0x105e('0x29')]!==_0x105e('0x38')){var _0x285a43={};_0x285a43[_0x1d517a[_0x105e('0x24')]]={'$like':'%'+_0x18adf5['query'][_0x105e('0x36')]+'%'};return _0x285a43;}})});}_0x22c189=_[_0x105e('0x37')]({},_0x22c189,_0x18adf5['options']);var _0x5648a7={'where':_0x22c189[_0x105e('0x34')]};return db['ChatTransferReport'][_0x105e('0x1c')](_0x5648a7)[_0x105e('0x20')](function(_0x9d0586){_0xc1d166[_0x105e('0x1c')]=_0x9d0586;if(_0x18adf5['query'][_0x105e('0x39')]){_0x22c189[_0x105e('0x3a')]=[{'all':!![]}];}return db[_0x105e('0x27')][_0x105e('0x3b')](_0x22c189);})['then'](function(_0x1dc5cb){_0xc1d166[_0x105e('0x3c')]=_0x1dc5cb;return _0xc1d166;})[_0x105e('0x20')](respondWithFilteredResult(_0x5e8098,_0x22c189))[_0x105e('0x3d')](handleError(_0x5e8098,null));};exports['show']=function(_0x3176c6,_0x2a1324){var _0x15eb20={'raw':!![],'where':{'id':_0x3176c6['params']['id']}},_0x31aa54={};_0x31aa54[_0x105e('0x2b')]=_[_0x105e('0x2d')](db[_0x105e('0x27')][_0x105e('0x28')]);_0x31aa54[_0x105e('0x2c')]=_[_0x105e('0x2d')](_0x3176c6[_0x105e('0x2c')]);_0x31aa54['filters']=_[_0x105e('0x2f')](_0x31aa54[_0x105e('0x2b')],_0x31aa54[_0x105e('0x2c')]);_0x15eb20['attributes']=_[_0x105e('0x2f')](_0x31aa54[_0x105e('0x2b')],qs[_0x105e('0x3e')](_0x3176c6[_0x105e('0x2c')][_0x105e('0x3e')]));_0x15eb20[_0x105e('0x2e')]=_0x15eb20[_0x105e('0x2e')]['length']?_0x15eb20[_0x105e('0x2e')]:_0x31aa54[_0x105e('0x2b')];if(_0x3176c6[_0x105e('0x2c')][_0x105e('0x39')]){_0x15eb20[_0x105e('0x3a')]=[{'all':!![]}];}_0x15eb20=_['merge']({},_0x15eb20,_0x3176c6[_0x105e('0x3f')]);return db[_0x105e('0x27')]['find'](_0x15eb20)[_0x105e('0x20')](handleEntityNotFound(_0x2a1324,null))['then'](respondWithResult(_0x2a1324,null))[_0x105e('0x3d')](handleError(_0x2a1324,null));};exports[_0x105e('0x40')]=function(_0x33ee53,_0x50fd47){return db[_0x105e('0x27')][_0x105e('0x40')](_0x33ee53['body'],{})[_0x105e('0x20')](respondWithResult(_0x50fd47,0xc9))[_0x105e('0x3d')](handleError(_0x50fd47,null));};exports['update']=function(_0x499aa7,_0x3ad513){if(_0x499aa7[_0x105e('0x41')]['id']){delete _0x499aa7[_0x105e('0x41')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x499aa7[_0x105e('0x42')]['id']}})[_0x105e('0x20')](handleEntityNotFound(_0x3ad513,null))[_0x105e('0x20')](saveUpdates(_0x499aa7[_0x105e('0x41')],null))[_0x105e('0x20')](respondWithResult(_0x3ad513,null))[_0x105e('0x3d')](handleError(_0x3ad513,null));};exports['destroy']=function(_0x47838e,_0x40e70a){return db[_0x105e('0x27')]['find']({'where':{'id':_0x47838e[_0x105e('0x42')]['id']}})['then'](handleEntityNotFound(_0x40e70a,null))[_0x105e('0x20')](removeEntity(_0x40e70a,null))[_0x105e('0x3d')](handleError(_0x40e70a,null));};exports[_0x105e('0x43')]=function(_0x478c66,_0x33b9e4){return db['ChatTransferReport'][_0x105e('0x43')]()[_0x105e('0x20')](respondWithResult(_0x33b9e4,null))[_0x105e('0x3d')](handleError(_0x33b9e4,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b18eb6c..68ebd56 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 _0xb563=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','api','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb563,0x168));var _0x3b56=function(_0x5adeff,_0x4279bb){_0x5adeff=_0x5adeff-0x0;var _0x3d89a2=_0xb563[_0x5adeff];return _0x3d89a2;};'use strict';var _=require(_0x3b56('0x0'));var util=require(_0x3b56('0x1'));var logger=require('../../config/logger')(_0x3b56('0x2'));var moment=require(_0x3b56('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b56('0x4'));var fs=require('fs');var path=require(_0x3b56('0x5'));var rimraf=require(_0x3b56('0x6'));var config=require(_0x3b56('0x7'));var attributes=require(_0x3b56('0x8'));module[_0x3b56('0x9')]=function(_0x35a78c,_0x341d86){return _0x35a78c[_0x3b56('0xa')]('ChatTransferReport',attributes,{'tableName':_0x3b56('0xb'),'paranoid':![],'indexes':[{'name':_0x3b56('0xc'),'fields':[_0x3b56('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba32=['bluebird','path','rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','api','moment'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0xba32,0x170));var _0x2ba3=function(_0x3918a3,_0x3e3db8){_0x3918a3=_0x3918a3-0x0;var _0x4f252f=_0xba32[_0x3918a3];return _0x4f252f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2ba3('0x0'));var moment=require(_0x2ba3('0x1'));var BPromise=require(_0x2ba3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ba3('0x3'));var rimraf=require(_0x2ba3('0x4'));var config=require(_0x2ba3('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0x2ba3('0x6')]=function(_0x3dcb11,_0x5d5328){return _0x3dcb11['define'](_0x2ba3('0x7'),attributes,{'tableName':_0x2ba3('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2ba3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e29b8b3..44f48c5 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 _0x3b17=['request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','lodash','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info'];(function(_0x42e055,_0x50d0d5){var _0x5e332f=function(_0x4a557a){while(--_0x4a557a){_0x42e055['push'](_0x42e055['shift']());}};_0x5e332f(++_0x50d0d5);}(_0x3b17,0x1e5));var _0x73b1=function(_0x48cb7a,_0x26bd76){_0x48cb7a=_0x48cb7a-0x0;var _0x144261=_0x3b17[_0x48cb7a];return _0x144261;};'use strict';var _=require(_0x73b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73b1('0x1'))['db'];var utils=require(_0x73b1('0x2'));var logger=require('../../config/logger')(_0x73b1('0x3'));var config=require(_0x73b1('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x73b1('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3de486,_0x41282e,_0x597bc7){return new BPromise(function(_0x163b5b,_0x106b88){return client[_0x73b1('0x6')](_0x3de486,_0x597bc7)['then'](function(_0x16d0a4){logger[_0x73b1('0x7')]('ChatTransferReport,\x20%s,\x20%s',_0x41282e,_0x73b1('0x8'));logger[_0x73b1('0x9')](_0x73b1('0xa'),_0x41282e,_0x73b1('0x8'),JSON[_0x73b1('0xb')](_0x16d0a4));if(_0x16d0a4['error']){if(_0x16d0a4[_0x73b1('0xc')][_0x73b1('0xd')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x41282e,_0x16d0a4[_0x73b1('0xc')][_0x73b1('0xe')]);return _0x106b88(_0x16d0a4[_0x73b1('0xc')][_0x73b1('0xe')]);}logger[_0x73b1('0xc')](_0x73b1('0xf'),_0x41282e,_0x16d0a4[_0x73b1('0xc')][_0x73b1('0xe')]);return _0x163b5b(_0x16d0a4[_0x73b1('0xc')]['message']);}else{logger[_0x73b1('0x7')](_0x73b1('0xf'),_0x41282e,_0x73b1('0x8'));_0x163b5b(_0x16d0a4[_0x73b1('0x10')][_0x73b1('0xe')]);}})['catch'](function(_0x1e2975){logger[_0x73b1('0xc')](_0x73b1('0xf'),_0x41282e,_0x1e2975);_0x106b88(_0x1e2975);});});} \ No newline at end of file +var _0xcf58=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash'];(function(_0x1760f3,_0x6f17b9){var _0x52139b=function(_0x1e7f32){while(--_0x1e7f32){_0x1760f3['push'](_0x1760f3['shift']());}};_0x52139b(++_0x6f17b9);}(_0xcf58,0x175));var _0x8cf5=function(_0x544251,_0x56291e){_0x544251=_0x544251-0x0;var _0x48513f=_0xcf58[_0x544251];return _0x48513f;};'use strict';var _=require(_0x8cf5('0x0'));var util=require('util');var moment=require(_0x8cf5('0x1'));var BPromise=require(_0x8cf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cf5('0x3'));var db=require(_0x8cf5('0x4'))['db'];var utils=require(_0x8cf5('0x5'));var logger=require(_0x8cf5('0x6'))(_0x8cf5('0x7'));var config=require(_0x8cf5('0x8'));var jayson=require(_0x8cf5('0x9'));var client=jayson[_0x8cf5('0xa')][_0x8cf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x587e56,_0x505abb,_0x413ddd){return new BPromise(function(_0x4ccaa4,_0x3767fe){return client[_0x8cf5('0xc')](_0x587e56,_0x413ddd)[_0x8cf5('0xd')](function(_0x60046c){logger['info'](_0x8cf5('0xe'),_0x505abb,_0x8cf5('0xf'));logger[_0x8cf5('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x505abb,'request\x20sent',JSON[_0x8cf5('0x11')](_0x60046c));if(_0x60046c['error']){if(_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x13')]===0x1f4){logger[_0x8cf5('0x12')](_0x8cf5('0xe'),_0x505abb,_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);return _0x3767fe(_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);}logger[_0x8cf5('0x12')](_0x8cf5('0xe'),_0x505abb,_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);return _0x4ccaa4(_0x60046c[_0x8cf5('0x12')][_0x8cf5('0x14')]);}else{logger['info'](_0x8cf5('0xe'),_0x505abb,'request\x20sent');_0x4ccaa4(_0x60046c['result'][_0x8cf5('0x14')]);}})[_0x8cf5('0x15')](function(_0x319f43){logger['error'](_0x8cf5('0xe'),_0x505abb,_0x319f43);_0x3767fe(_0x319f43);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 68c6642..fbe7a8f 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 _0x9f53=['get','/describe','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./chatTransferReport.controller','index'];(function(_0x28b0a4,_0x2ea758){var _0x105ce6=function(_0x6df20f){while(--_0x6df20f){_0x28b0a4['push'](_0x28b0a4['shift']());}};_0x105ce6(++_0x2ea758);}(_0x9f53,0x1ba));var _0x39f5=function(_0x34a8b3,_0x5ad173){_0x34a8b3=_0x34a8b3-0x0;var _0x41ea72=_0x9f53[_0x34a8b3];return _0x41ea72;};'use strict';var multer=require(_0x39f5('0x0'));var util=require(_0x39f5('0x1'));var path=require(_0x39f5('0x2'));var timeout=require(_0x39f5('0x3'));var express=require('express');var router=express[_0x39f5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x39f5('0x5'));var controller=require(_0x39f5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x39f5('0x7')]);router[_0x39f5('0x8')](_0x39f5('0x9'),auth[_0x39f5('0xa')](),controller['describe']);router[_0x39f5('0x8')](_0x39f5('0xb'),auth[_0x39f5('0xa')](),controller[_0x39f5('0xc')]);router[_0x39f5('0xd')]('/',auth['isAuthenticated'](),controller[_0x39f5('0xe')]);router[_0x39f5('0xf')](_0x39f5('0xb'),auth[_0x39f5('0xa')](),controller['update']);router['delete'](_0x39f5('0xb'),auth[_0x39f5('0xa')](),controller[_0x39f5('0x10')]);module[_0x39f5('0x11')]=router; \ No newline at end of file +var _0xdee2=['get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xdee2,0x19b));var _0x2dee=function(_0x21e4fc,_0x3e3020){_0x21e4fc=_0x21e4fc-0x0;var _0x4df40c=_0xdee2[_0x21e4fc];return _0x4df40c;};'use strict';var multer=require(_0x2dee('0x0'));var util=require(_0x2dee('0x1'));var path=require(_0x2dee('0x2'));var timeout=require('connect-timeout');var express=require(_0x2dee('0x3'));var router=express[_0x2dee('0x4')]();var fs_extra=require(_0x2dee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2dee('0x6'));var config=require(_0x2dee('0x7'));var controller=require(_0x2dee('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2dee('0x9')](_0x2dee('0xa'),auth[_0x2dee('0xb')](),controller[_0x2dee('0xc')]);router[_0x2dee('0x9')](_0x2dee('0xd'),auth[_0x2dee('0xb')](),controller[_0x2dee('0xe')]);router[_0x2dee('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2dee('0x10')](_0x2dee('0xd'),auth['isAuthenticated'](),controller[_0x2dee('0x11')]);router[_0x2dee('0x12')](_0x2dee('0xd'),auth[_0x2dee('0xb')](),controller['destroy']);module[_0x2dee('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4266b98..dc70043 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 _0x5aa4=['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}}','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','ENUM','Chat','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x2d3196,_0x4afdcc){var _0x4987d3=function(_0x2e0c2a){while(--_0x2e0c2a){_0x2d3196['push'](_0x2d3196['shift']());}};_0x4987d3(++_0x4afdcc);}(_0x5aa4,0x18b));var _0x45aa=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x5aa4[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require(_0x45aa('0x0'));var rs=require(_0x45aa('0x1'));module[_0x45aa('0x2')]={'name':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x45aa('0x4')},'mapKeyOffline':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x4')},'key':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x5')},'customerAlias':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x45aa('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![],'defaultValue':_0x45aa('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x45aa('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x45aa('0x7')]('rounded','squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x8')},'offline_chat_button':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x45aa('0xa')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0xb')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x45aa('0xc')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x45aa('0xd')},'formSubmitFailureMessage':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0xe')},'noteTitle':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0xf')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x10')},'closingMessageButton':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x11')},'skipMessageButton':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x12')},'conditionAgreement':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x45aa('0x13')},'ratingType':{'type':Sequelize[_0x45aa('0x7')](_0x45aa('0x14'),_0x45aa('0x15')),'defaultValue':_0x45aa('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x45aa('0x16')],'defaultValue':function(){return JSON[_0x45aa('0x17')]({'items':[{'type':_0x45aa('0x18'),'variable':null,'config':{'placeholder':_0x45aa('0x19'),'type':_0x45aa('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x45aa('0x18'),'props':{'title':_0x45aa('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x45aa('0x4'),'type':_0x45aa('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x45aa('0x1b')](_0x45aa('0x1c'))?JSON[_0x45aa('0x1d')](this['getDataValue'](_0x45aa('0x1c'))):{};},'set':function(_0x4320f0){return this[_0x45aa('0x1e')](_0x45aa('0x1c'),JSON[_0x45aa('0x17')](_0x4320f0));}},'offlineForm':{'type':Sequelize[_0x45aa('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x45aa('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x45aa('0x4'),'type':_0x45aa('0x4')},'variable':null},{'type':_0x45aa('0x1f'),'config':{'placeholder':_0x45aa('0x20')},'props':{'title':'Comments','helpText':_0x45aa('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x45aa('0x1b')](_0x45aa('0x22'))?JSON[_0x45aa('0x1d')](this[_0x45aa('0x1b')](_0x45aa('0x22'))):{};},'set':function(_0xbfd453){return this[_0x45aa('0x1e')]('offlineForm',JSON[_0x45aa('0x17')](_0xbfd453));}},'token':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':function(){return rs[_0x45aa('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x45aa('0x3')]},'forwardOffline':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x25')},'offlineMessageBody':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x27')},'skipUnmanaged':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x12')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x45aa('0x11')},'enableCustomerAttachment':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x45aa('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x45aa('0x16')],'defaultValue':function(){return _0x45aa('0x28');}},'notificationSound':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x45aa('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x45aa('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x45aa('0xa')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x45aa('0x3')],'allowNull':![],'defaultValue':_0x45aa('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':_0x45aa('0x2c')},'systemAvatar':{'type':Sequelize[_0x45aa('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![],'comment':_0x45aa('0x2d'),'set':function(_0x1e5b97){if(!_0x1e5b97)this[_0x45aa('0x1e')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x45aa('0x2e'),_0x1e5b97);}},'vidaooEscalation':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x45aa('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x45aa('0x3')],'defaultValue':function(){return _0x45aa('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x45aa('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x45aa('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x45aa('0x16')]}}; \ No newline at end of file +var _0x41ba=['INTEGER','BOOLEAN','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Feedback','ENUM','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff'];(function(_0x1a733e,_0x6cec06){var _0x5a0f2b=function(_0x4c1562){while(--_0x4c1562){_0x1a733e['push'](_0x1a733e['shift']());}};_0x5a0f2b(++_0x6cec06);}(_0x41ba,0x8c));var _0xa41b=function(_0x1c37fb,_0x29f819){_0x1c37fb=_0x1c37fb-0x0;var _0x29d071=_0x41ba[_0x1c37fb];return _0x29d071;};'use strict';var Sequelize=require(_0xa41b('0x0'));var rs=require(_0xa41b('0x1'));module[_0xa41b('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':_0xa41b('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':_0xa41b('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa41b('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa41b('0x3')]},'animation':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xa41b('0x9'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xa')},'start_chat_button':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xb')},'offline_chat_button':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xc')},'header_offline':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa41b('0xf')]},'closingQuestion':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x11')},'noteTitle':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x13')},'ratingType':{'type':Sequelize[_0xa41b('0x14')](_0xa41b('0x15'),_0xa41b('0x16')),'defaultValue':_0xa41b('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xa41b('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa41b('0x17')]({'items':[{'type':_0xa41b('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xa41b('0x19'),'required':!![]},'props':{'title':_0xa41b('0x1a'),'helpText':''}},{'type':_0xa41b('0x18'),'props':{'title':_0xa41b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa41b('0x1b')](_0xa41b('0x1c'))?JSON[_0xa41b('0x1d')](this[_0xa41b('0x1b')]('onlineForm')):{};},'set':function(_0x31ba35){return this[_0xa41b('0x1e')](_0xa41b('0x1c'),JSON[_0xa41b('0x17')](_0x31ba35));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa41b('0x17')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa41b('0x4'),'type':_0xa41b('0x4')},'variable':null},{'type':_0xa41b('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xa41b('0x20'),'helpText':_0xa41b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xa41b('0x1b')](_0xa41b('0x22'))?JSON[_0xa41b('0x1d')](this['getDataValue'](_0xa41b('0x22'))):{};},'set':function(_0xd6dc72){return this[_0xa41b('0x1e')](_0xa41b('0x22'),JSON[_0xa41b('0x17')](_0xd6dc72));}},'token':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':function(){return rs[_0xa41b('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa41b('0x3')]},'forwardOffline':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x27')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa41b('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa41b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa41b('0xf')],'defaultValue':function(){return _0xa41b('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':_0xa41b('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xa41b('0x2a')},'messagesAlignment':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa41b('0x3')]},'customerAvatar':{'type':Sequelize[_0xa41b('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa41b('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa41b('0x3')],'allowNull':![],'defaultValue':_0xa41b('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa41b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa41b('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa41b('0x7')],'comment':_0xa41b('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![],'comment':_0xa41b('0x2d'),'set':function(_0x24d763){if(!_0x24d763)this['setDataValue'](_0xa41b('0x2e'),null);this[_0xa41b('0x1e')](_0xa41b('0x2f'),_0x24d763);}},'vidaooEscalation':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa41b('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xa41b('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xa41b('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa41b('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa41b('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 14933bb..bf91277 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 _0x0b0e=['mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','mimetype','server','files','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','forwardOffline','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','attachments','remove','addInteraction','getInteractions','User','Owner','internal','Tag','Tags','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','getProactiveActions','virtual','License','chatLicenseExceeded','Intervals','all','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','color_button','backgroundColor','addApplications','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','omit','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','http','client','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','ChatWebsiteId','Disposition','getDispositions','rawAttributes','findAll','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','addLogo','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','existsSync','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','chat','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','defaults','ListId','CmContact','contact','customerIp','cf-connecting-ip','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','interaction','ChatInteraction','spread','lastName','messageId','created','push','*,*,*,*','AttachmentId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline'];(function(_0x1fef8c,_0x337373){var _0x33ba2a=function(_0x44490f){while(--_0x44490f){_0x1fef8c['push'](_0x1fef8c['shift']());}};_0x33ba2a(++_0x337373);}(_0x0b0e,0x187));var _0xe0b0=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x0b0e[_0xaa1b3e];return _0x454d7d;};'use strict';var BPromise=require(_0xe0b0('0x0'));var Mustache=require('mustache');var util=require(_0xe0b0('0x1'));var path=require('path');var ejs=require(_0xe0b0('0x2'));var fs=require('fs');var fs_extra=require(_0xe0b0('0x3'));var _=require(_0xe0b0('0x4'));var querystring=require(_0xe0b0('0x5'));var Redis=require(_0xe0b0('0x6'));var qs=require(_0xe0b0('0x7'));var logger=require(_0xe0b0('0x8'))(_0xe0b0('0x9'));var config=require(_0xe0b0('0xa'));var db=require(_0xe0b0('0xb'))['db'];config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);var htmlToText=require(_0xe0b0('0x10'));var jayson=require(_0xe0b0('0x11'));var client=jayson['client'][_0xe0b0('0x12')]({'port':0x232c});var client9002=jayson[_0xe0b0('0x13')]['http']({'port':0x232a});var client9003=jayson[_0xe0b0('0x13')][_0xe0b0('0x12')]({'port':0x232b});var client9001=jayson[_0xe0b0('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3068c0,_0x1c358a,_0x3cc19a,_0x45f914){return new BPromise(function(_0x34fed4,_0x4d2bf7){var _0x3782be=_0x45f914||client;return _0x3782be[_0xe0b0('0x14')](_0x3068c0,_0x3cc19a)[_0xe0b0('0x15')](function(_0x24babd){logger[_0xe0b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0xe0b0('0x17'));logger['debug'](_0xe0b0('0x18'),_0x1c358a,_0xe0b0('0x17'),JSON['stringify'](_0x24babd));if(_0x24babd[_0xe0b0('0x19')]){if(_0x24babd['error'][_0xe0b0('0x1a')]===0x1f4){logger[_0xe0b0('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0x24babd['error'][_0xe0b0('0x1b')]);return _0x4d2bf7(_0x24babd['error']['message']);}logger['error'](_0xe0b0('0x1c'),_0x1c358a,_0x24babd['error']['message']);return _0x34fed4(_0x24babd[_0xe0b0('0x19')]['message']);}else{logger[_0xe0b0('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0xe0b0('0x17'));_0x34fed4(_0x24babd[_0xe0b0('0x1d')][_0xe0b0('0x1b')]);}})[_0xe0b0('0x1e')](function(_0x2cf6a1){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1c358a,_0x2cf6a1);_0x4d2bf7(_0x2cf6a1);});});}function respondWithStatusCode(_0x2fa820,_0x5512bb){_0x5512bb=_0x5512bb||0xcc;return function(_0x12b260){if(_0x12b260){return _0x2fa820[_0xe0b0('0x1f')](_0x5512bb);}return _0x2fa820['status'](_0x5512bb)[_0xe0b0('0x20')]();};}function respondWithResult(_0x503883,_0x2208d0){_0x2208d0=_0x2208d0||0xc8;return function(_0x49a727){if(_0x49a727){return _0x503883[_0xe0b0('0x21')](_0x2208d0)['json'](_0x49a727);}};}function respondWithFilteredResult(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(_0x4700cc){var _0x4aafbe=typeof _0x4de537[_0xe0b0('0x22')]==='undefined'&&typeof _0x4de537[_0xe0b0('0x23')]===_0xe0b0('0x24');var _0x1f1ebd=_0x4700cc[_0xe0b0('0x25')];var _0x3ec2=_0x4aafbe?0x0:_0x4de537[_0xe0b0('0x22')];var _0x5200a6=_0x4aafbe?_0x4700cc[_0xe0b0('0x25')]:_0x4de537[_0xe0b0('0x22')]+_0x4de537['limit'];var _0x15e13b;if(_0x5200a6>=_0x1f1ebd){_0x5200a6=_0x1f1ebd;_0x15e13b=0xc8;}else{_0x15e13b=0xce;}_0x3e5c88[_0xe0b0('0x21')](_0x15e13b);return _0x3e5c88[_0xe0b0('0x26')](_0xe0b0('0x27'),_0x3ec2+'-'+_0x5200a6+'/'+_0x1f1ebd)[_0xe0b0('0x28')](_0x4700cc);}return null;};}function saveUpdates(_0x254cad){return function(_0x136bd4){if(_0x136bd4){return _0x136bd4['update'](_0x254cad)[_0xe0b0('0x15')](function(_0x3c0109){return _0x3c0109;});}return null;};}function removeEntity(_0x48a9b5){return function(_0x4fe400){if(_0x4fe400){return _0x4fe400[_0xe0b0('0x29')]()[_0xe0b0('0x15')](function(){var _0x422575=_0x4fe400[_0xe0b0('0x2a')]({'plain':!![]});var _0x2ab1b1='ChatWebsites';return db[_0xe0b0('0x2b')][_0xe0b0('0x29')]({'where':{'type':_0x2ab1b1,'resourceId':_0x422575['id']}})[_0xe0b0('0x15')](function(){return _0x4fe400;});})[_0xe0b0('0x15')](function(){_0x48a9b5[_0xe0b0('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebf2a){return function(_0x208945){if(!_0x208945){_0x3ebf2a[_0xe0b0('0x1f')](0x194);}return _0x208945;};}function handleError(_0x31c6f5,_0x3575bc){_0x3575bc=_0x3575bc||0x1f4;return function(_0x12eeb8){logger[_0xe0b0('0x19')](_0x12eeb8[_0xe0b0('0x2c')]);if(_0x12eeb8[_0xe0b0('0x2d')]){delete _0x12eeb8[_0xe0b0('0x2d')];}_0x31c6f5[_0xe0b0('0x21')](_0x3575bc)[_0xe0b0('0x2e')](_0x12eeb8);};}exports[_0xe0b0('0x2f')]=function(_0x2a1c44,_0xca25d){var _0x4cf80c={'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]},_0x121608={},_0x135be5={'count':0x0,'rows':[]};var _0x1a2d24=_[_0xe0b0('0x32')](db[_0xe0b0('0x33')]['rawAttributes'],function(_0x521243){return{'name':_0x521243['fieldName'],'type':_0x521243['type'][_0xe0b0('0x34')]};});_0x121608[_0xe0b0('0x35')]=_[_0xe0b0('0x32')](_0x1a2d24,'name');_0x121608[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x2a1c44[_0xe0b0('0x36')]);_0x121608[_0xe0b0('0x38')]=_['intersection'](_0x121608[_0xe0b0('0x35')],_0x121608[_0xe0b0('0x36')]);_0x4cf80c[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x121608[_0xe0b0('0x35')],qs[_0xe0b0('0x3b')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x4cf80c[_0xe0b0('0x39')]=_0x4cf80c['attributes'][_0xe0b0('0x3c')]?_0x4cf80c['attributes']:_0x121608[_0xe0b0('0x35')];if(!_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x4cf80c['limit']=qs[_0xe0b0('0x23')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x4cf80c[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x22')]);}_0x4cf80c[_0xe0b0('0x3f')]=qs['sort'](_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x4cf80c['where']=qs['filters'](_[_0xe0b0('0x41')](_0x2a1c44[_0xe0b0('0x36')],_0x121608['filters']),_0x1a2d24);if(_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x4cf80c[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x4cf80c[_0xe0b0('0x43')],{'$or':_['map'](_0x1a2d24,function(_0x5d2fa2){if(_0x5d2fa2['type']!==_0xe0b0('0x45')){var _0x38e715={};_0x38e715[_0x5d2fa2['name']]={'$like':'%'+_0x2a1c44[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x38e715;}})});}_0x4cf80c=_[_0xe0b0('0x44')]({},_0x4cf80c,_0x2a1c44[_0xe0b0('0x46')]);var _0x16ccca={'where':_0x4cf80c['where']};return db['ChatWebsite'][_0xe0b0('0x25')](_0x16ccca)[_0xe0b0('0x15')](function(_0x393218){_0x135be5[_0xe0b0('0x25')]=_0x393218;if(_0x2a1c44[_0xe0b0('0x36')]['includeAll']){_0x4cf80c[_0xe0b0('0x47')]=[{'all':!![]}];}return db[_0xe0b0('0x33')]['findAll'](_0x4cf80c);})['then'](function(_0x5ddad1){_0x135be5[_0xe0b0('0x48')]=_0x5ddad1;return _0x135be5;})[_0xe0b0('0x15')](respondWithFilteredResult(_0xca25d,_0x4cf80c))[_0xe0b0('0x1e')](handleError(_0xca25d,null));};exports[_0xe0b0('0x49')]=function(_0x5b1756,_0x2e2b10){var _0x87d8f3={'raw':![],'where':{'id':_0x5b1756['params']['id']},'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]},_0x483f12={};_0x483f12['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x33')]['rawAttributes']);_0x483f12['query']=_[_0xe0b0('0x37')](_0x5b1756['query']);_0x483f12[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x483f12[_0xe0b0('0x35')],_0x483f12[_0xe0b0('0x36')]);_0x87d8f3[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x483f12['model'],qs['fields'](_0x5b1756[_0xe0b0('0x36')]['fields']));_0x87d8f3['attributes']=_0x87d8f3[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x87d8f3['attributes']:_0x483f12['model'];if(_0x5b1756[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x87d8f3[_0xe0b0('0x47')]=[{'all':!![]}];}_0x87d8f3=_[_0xe0b0('0x44')]({},_0x87d8f3,_0x5b1756[_0xe0b0('0x46')]);return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x87d8f3)['then'](handleEntityNotFound(_0x2e2b10,null))[_0xe0b0('0x15')](respondWithResult(_0x2e2b10,null))['catch'](handleError(_0x2e2b10,null));};exports[_0xe0b0('0x4c')]=function(_0x54106c,_0x5b2055){return db[_0xe0b0('0x33')][_0xe0b0('0x4c')](_0x54106c[_0xe0b0('0x4d')],{})[_0xe0b0('0x15')](function(_0x3d8013){var _0x2a588d=_0x54106c[_0xe0b0('0x4e')][_0xe0b0('0x2a')]({'plain':!![]});if(!_0x2a588d)throw new Error(_0xe0b0('0x4f'));if(_0x2a588d['role']===_0xe0b0('0x4e')){var _0x57ccc9=_0x3d8013[_0xe0b0('0x2a')]({'plain':!![]});var _0x3ae36e=_0xe0b0('0x50');return db[_0xe0b0('0x51')][_0xe0b0('0x4b')]({'where':{'name':_0x3ae36e,'userProfileId':_0x2a588d[_0xe0b0('0x52')]},'raw':!![]})['then'](function(_0x1a057c){if(_0x1a057c&&_0x1a057c[_0xe0b0('0x53')]===0x0){return db[_0xe0b0('0x2b')][_0xe0b0('0x4c')]({'name':_0x57ccc9[_0xe0b0('0x2d')],'resourceId':_0x57ccc9['id'],'type':_0x1a057c[_0xe0b0('0x2d')],'sectionId':_0x1a057c['id']},{})[_0xe0b0('0x15')](function(){return _0x3d8013;});}else{return _0x3d8013;}})[_0xe0b0('0x1e')](function(_0x85824c){logger[_0xe0b0('0x19')](_0xe0b0('0x54'),_0x85824c);throw _0x85824c;});}return _0x3d8013;})[_0xe0b0('0x15')](respondWithResult(_0x5b2055,0xc9))[_0xe0b0('0x1e')](handleError(_0x5b2055,null));};exports[_0xe0b0('0x55')]=function(_0xcdf97,_0x34c642){if(_0xcdf97[_0xe0b0('0x4d')]['id']){delete _0xcdf97[_0xe0b0('0x4d')]['id'];}return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0xcdf97[_0xe0b0('0x56')]['id']},'include':[{'model':db[_0xe0b0('0x30')],'as':_0xe0b0('0x31')}]})[_0xe0b0('0x15')](handleEntityNotFound(_0x34c642,null))[_0xe0b0('0x15')](saveUpdates(_0xcdf97[_0xe0b0('0x4d')],null))['then'](respondWithResult(_0x34c642,null))['catch'](handleError(_0x34c642,null));};exports[_0xe0b0('0x29')]=function(_0x2a0415,_0x157556){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x2a0415[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x157556,null))[_0xe0b0('0x15')](removeEntity(_0x157556,null))[_0xe0b0('0x1e')](handleError(_0x157556,null));};exports['describe']=function(_0x370f8c,_0x242120){return db[_0xe0b0('0x33')]['describe']()[_0xe0b0('0x15')](respondWithResult(_0x242120,null))[_0xe0b0('0x1e')](handleError(_0x242120,null));};exports['addDisposition']=function(_0x1bd249,_0x4c5478){if(_0x1bd249['body']['id']){delete _0x1bd249[_0xe0b0('0x4d')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1bd249[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x4c5478,null))[_0xe0b0('0x15')](function(_0x1a4fad){if(_0x1a4fad){_0x1bd249['body'][_0xe0b0('0x57')]=_0x1a4fad['id'];return db[_0xe0b0('0x58')][_0xe0b0('0x4c')](_0x1bd249[_0xe0b0('0x4d')]);}})[_0xe0b0('0x15')](respondWithResult(_0x4c5478,null))[_0xe0b0('0x1e')](handleError(_0x4c5478,null));};exports[_0xe0b0('0x59')]=function(_0x224f1e,_0x514df5){var _0x51940f={'raw':![],'where':{}};var _0x4b41a={};var _0x35144f={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')]['findOne']({'where':{'id':_0x224f1e['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x514df5,null))[_0xe0b0('0x15')](function(_0x5d7cf4){if(_0x5d7cf4){_0x4b41a['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x58')][_0xe0b0('0x5a')]);_0x4b41a[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x224f1e[_0xe0b0('0x36')]);_0x4b41a[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x4b41a['model'],_0x4b41a[_0xe0b0('0x36')]);_0x51940f[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x4b41a['model'],qs['fields'](_0x224f1e['query']['fields']));_0x51940f['attributes']=_0x51940f['attributes'][_0xe0b0('0x3c')]?_0x51940f['attributes']:_0x4b41a['model'];if(!_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x51940f[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x51940f[_0xe0b0('0x22')]=qs['offset'](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x22')]);}_0x51940f[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x51940f[_0xe0b0('0x43')]=qs['filters'](_[_0xe0b0('0x41')](_0x224f1e['query'],_0x4b41a[_0xe0b0('0x38')]));_0x51940f[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x5d7cf4['id'];if(_0x224f1e[_0xe0b0('0x36')]['filter']){_0x51940f[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x51940f['where'],{'$or':_['map'](_0x51940f[_0xe0b0('0x39')],function(_0x30adc5){var _0x196625={};_0x196625[_0x30adc5]={'$like':'%'+_0x224f1e[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x196625;})});}_0x51940f=_[_0xe0b0('0x44')]({},_0x51940f,_0x224f1e[_0xe0b0('0x46')]);return db[_0xe0b0('0x58')][_0xe0b0('0x25')]({'where':_0x51940f[_0xe0b0('0x43')]})['then'](function(_0x4c512b){_0x35144f[_0xe0b0('0x25')]=_0x4c512b;if(_0x224f1e['query']['includeAll']){_0x51940f['include']=[{'all':!![]}];}return db['Disposition'][_0xe0b0('0x5b')](_0x51940f);})['then'](function(_0x654d2b){_0x35144f[_0xe0b0('0x48')]=_0x654d2b;return _0x35144f;});}})[_0xe0b0('0x15')](respondWithFilteredResult(_0x514df5,_0x51940f))[_0xe0b0('0x1e')](handleError(_0x514df5,null));};exports['removeDispositions']=function(_0x31b218,_0x948708){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x31b218[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x948708,null))[_0xe0b0('0x15')](function(_0x27af09){if(_0x27af09){return _0x27af09['removeDispositions'](_0x31b218['query']['ids']);}})['then'](respondWithStatusCode(_0x948708,null))['catch'](handleError(_0x948708,null));};exports[_0xe0b0('0x5c')]=function(_0x567e1a,_0x3c09af){if(_0x567e1a['body']['id']){delete _0x567e1a[_0xe0b0('0x4d')]['id'];}return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x567e1a[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x3c09af,null))[_0xe0b0('0x15')](function(_0x58da19){if(_0x58da19){_0x567e1a['body']['ChatWebsiteId']=_0x58da19['id'];return db['CannedAnswer'][_0xe0b0('0x4c')](_0x567e1a[_0xe0b0('0x4d')]);}})[_0xe0b0('0x15')](respondWithResult(_0x3c09af,null))[_0xe0b0('0x1e')](handleError(_0x3c09af,null));};exports[_0xe0b0('0x5d')]=function(_0x534881,_0x234716){var _0x39a07b={'raw':![],'where':{}};var _0xf77616={};var _0xc6090e={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x534881[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x234716,null))[_0xe0b0('0x15')](function(_0x5565ef){if(_0x5565ef){_0xf77616['model']=_[_0xe0b0('0x37')](db[_0xe0b0('0x5f')]['rawAttributes']);_0xf77616[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x534881[_0xe0b0('0x36')]);_0xf77616[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0xf77616[_0xe0b0('0x35')],_0xf77616[_0xe0b0('0x36')]);_0x39a07b[_0xe0b0('0x39')]=_['intersection'](_0xf77616['model'],qs['fields'](_0x534881[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x39a07b['attributes']=_0x39a07b[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x39a07b[_0xe0b0('0x39')]:_0xf77616[_0xe0b0('0x35')];if(!_0x534881['query']['hasOwnProperty']('nolimit')){_0x39a07b[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x534881['query'][_0xe0b0('0x23')]);_0x39a07b[_0xe0b0('0x22')]=qs['offset'](_0x534881['query'][_0xe0b0('0x22')]);}_0x39a07b['order']=qs[_0xe0b0('0x40')](_0x534881['query'][_0xe0b0('0x40')]);_0x39a07b[_0xe0b0('0x43')]=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x534881[_0xe0b0('0x36')],_0xf77616[_0xe0b0('0x38')]));_0x39a07b[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x5565ef['id'];if(_0x534881[_0xe0b0('0x36')]['filter']){_0x39a07b[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x39a07b[_0xe0b0('0x43')],{'$or':_['map'](_0x39a07b[_0xe0b0('0x39')],function(_0x4ad24f){var _0x328c96={};_0x328c96[_0x4ad24f]={'$like':'%'+_0x534881[_0xe0b0('0x36')]['filter']+'%'};return _0x328c96;})});}_0x39a07b=_[_0xe0b0('0x44')]({},_0x39a07b,_0x534881['options']);return db['CannedAnswer'][_0xe0b0('0x25')]({'where':_0x39a07b['where']})['then'](function(_0x4f027c){_0xc6090e[_0xe0b0('0x25')]=_0x4f027c;if(_0x534881[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x39a07b[_0xe0b0('0x47')]=[{'all':!![]}];}return db[_0xe0b0('0x5f')]['findAll'](_0x39a07b);})[_0xe0b0('0x15')](function(_0x4609d5){_0xc6090e[_0xe0b0('0x48')]=_0x4609d5;return _0xc6090e;});}})['then'](respondWithFilteredResult(_0x234716,_0x39a07b))[_0xe0b0('0x1e')](handleError(_0x234716,null));};exports[_0xe0b0('0x60')]=function(_0x5817aa,_0x5854ea){return db[_0xe0b0('0x33')]['find']({'where':{'id':_0x5817aa[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5854ea,null))[_0xe0b0('0x15')](function(_0x7ae597){if(_0x7ae597){return _0x7ae597[_0xe0b0('0x60')](_0x5817aa[_0xe0b0('0x36')][_0xe0b0('0x61')]);}})['then'](respondWithStatusCode(_0x5854ea,null))[_0xe0b0('0x1e')](handleError(_0x5854ea,null));};exports[_0xe0b0('0x62')]=function(_0x135fec,_0x42add7){_0x135fec[_0xe0b0('0x4d')]['sitepic']=_0x135fec['file'][_0xe0b0('0x63')];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x135fec[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x42add7,null))[_0xe0b0('0x15')](saveUpdates(_0x135fec[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x42add7,null))[_0xe0b0('0x1e')](handleError(_0x42add7,null));};exports[_0xe0b0('0x64')]=function(_0x4fe048,_0xac45e6){_0x4fe048[_0xe0b0('0x4d')][_0xe0b0('0x65')]=_0x4fe048[_0xe0b0('0x66')]['filename'];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x4fe048[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0xac45e6,null))[_0xe0b0('0x15')](saveUpdates(_0x4fe048['body'],null))[_0xe0b0('0x15')](respondWithResult(_0xac45e6,null))['catch'](handleError(_0xac45e6,null));};exports[_0xe0b0('0x67')]=function(_0x196ab7,_0x3d8f17){_0x196ab7[_0xe0b0('0x4d')][_0xe0b0('0x68')]=_0x196ab7['file']['filename'];return db[_0xe0b0('0x33')]['find']({'where':{'id':_0x196ab7[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d8f17,null))[_0xe0b0('0x15')](saveUpdates(_0x196ab7[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x3d8f17,null))[_0xe0b0('0x1e')](handleError(_0x3d8f17,null));};exports[_0xe0b0('0x69')]=function(_0x1bb4da,_0x43ff30){_0x1bb4da['body']['systemAvatar']=_0x1bb4da[_0xe0b0('0x66')][_0xe0b0('0x63')];return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x1bb4da[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x43ff30,null))[_0xe0b0('0x15')](saveUpdates(_0x1bb4da[_0xe0b0('0x4d')],null))[_0xe0b0('0x15')](respondWithResult(_0x43ff30,null))[_0xe0b0('0x1e')](handleError(_0x43ff30,null));};exports['getLogo']=function(_0x4a4880,_0x3dd34e){var _0x26caf8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x6c'));var _0x43c2bb={'where':{'id':_0x4a4880[_0xe0b0('0x56')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4c4748=![];return require(_0xe0b0('0x6d'))[_0xe0b0('0x6e')]()[_0xe0b0('0x15')](function(_0x467f0e){if(_0x467f0e){_0x4c4748=_0x467f0e[_0xe0b0('0x6f')];}})[_0xe0b0('0x15')](function(){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x43c2bb);})[_0xe0b0('0x15')](handleEntityNotFound(_0x3dd34e,null))[_0xe0b0('0x15')](function(_0x4cbe35){if(_0x4cbe35){if(!_[_0xe0b0('0x70')](_0x4cbe35[_0xe0b0('0x71')])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x72'),_0x4cbe35[_0xe0b0('0x71')]))&&_0x4c4748){_0x26caf8=path[_0xe0b0('0x6a')](config['root'],_0xe0b0('0x72'),_0x4cbe35[_0xe0b0('0x71')]);}}return _0x3dd34e[_0xe0b0('0x73')](_0x26caf8);}})[_0xe0b0('0x1e')](handleError(_0x3dd34e,null));};exports[_0xe0b0('0x74')]=function(_0x5f1fd3,_0x475404){var _0x58d61b=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x75'));var _0x539a12={'where':{'id':_0x5f1fd3['params']['id']},'attributes':['id',_0xe0b0('0x65')],'raw':!![]};return db[_0xe0b0('0x33')][_0xe0b0('0x4b')](_0x539a12)['then'](handleEntityNotFound(_0x475404,null))['then'](function(_0x5da5eb){if(_0x5da5eb){if(!_['isNil'](_0x5da5eb['agentAvatar'])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x5da5eb[_0xe0b0('0x65')]))){_0x58d61b=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x5da5eb[_0xe0b0('0x65')]);}}return _0x475404['download'](_0x58d61b);}})['catch'](handleError(_0x475404,null));};exports[_0xe0b0('0x77')]=function(_0xd2dd5a,_0x3e592c){var _0x52dfd8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x78'));var _0xd231c4={'where':{'id':_0xd2dd5a[_0xe0b0('0x56')]['id']},'attributes':['id',_0xe0b0('0x68'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0xd231c4)[_0xe0b0('0x15')](handleEntityNotFound(_0x3e592c,null))[_0xe0b0('0x15')](function(_0x9f9d8d){if(_0x9f9d8d){if(!_[_0xe0b0('0x70')](_0x9f9d8d[_0xe0b0('0x68')])){if(fs[_0xe0b0('0x79')](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x9f9d8d['customerAvatar']))&&_0x9f9d8d[_0xe0b0('0x7a')]){_0x52dfd8=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],'server/files/images/avatars/',_0x9f9d8d[_0xe0b0('0x68')]);}}return _0x3e592c[_0xe0b0('0x73')](_0x52dfd8);}})[_0xe0b0('0x1e')](handleError(_0x3e592c,null));};exports['getSystemAvatar']=function(_0x36fa1f,_0x4d2ca9){var _0x74693e=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x7b'));var _0x3b133a={'where':{'id':_0x36fa1f[_0xe0b0('0x56')]['id']},'attributes':['id',_0xe0b0('0x7c')],'raw':!![]};return db['ChatWebsite'][_0xe0b0('0x4b')](_0x3b133a)[_0xe0b0('0x15')](handleEntityNotFound(_0x4d2ca9,null))['then'](function(_0x44e4a8){if(_0x44e4a8){if(!_[_0xe0b0('0x70')](_0x44e4a8[_0xe0b0('0x7c')])){if(fs['existsSync'](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x44e4a8['systemAvatar']))){_0x74693e=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x76'),_0x44e4a8[_0xe0b0('0x7c')]);}}return _0x4d2ca9[_0xe0b0('0x73')](_0x74693e);}})[_0xe0b0('0x1e')](handleError(_0x4d2ca9,null));};exports['notify']=function(_0x44da91,_0x701ba){var _0x21db87=require(_0xe0b0('0x7d'));var _0x11452e=new _0x21db87();var _0xaca03c=_0x11452e[_0xe0b0('0x7e')](_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x80')])[_0xe0b0('0x81')]();var _0xde3bca={'body':_0x44da91['body'],'channel':_0xe0b0('0x82')};var _0x51bab6=[];var _0x56c497=[];var _0x1d1981={};var _0x1c29dd=![];return db['CmContact'][_0xe0b0('0x83')]()[_0xe0b0('0x15')](function(_0x141b38){if(!_0x141b38){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x86'));}_0x51bab6=_[_0xe0b0('0x87')](_[_0xe0b0('0x37')](_0x141b38),[_0xe0b0('0x88'),'updatedAt']);_0x56c497=_[_0xe0b0('0x87')](_[_0xe0b0('0x37')](_0x141b38),[_0xe0b0('0x88'),_0xe0b0('0x89'),'CompanyId','ListId']);if(_0x44da91[_0xe0b0('0x4d')]['id']){delete _0x44da91[_0xe0b0('0x4d')]['id'];}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')])){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8b'));}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')])||_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')]===''){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8c'));}if(_[_0xe0b0('0x70')](_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8d')])){throw new db['Sequelize'][(_0xe0b0('0x85'))](_0xe0b0('0x8e')+_0x56c497);}if(!_[_0xe0b0('0x8f')](_0x56c497,_0x44da91['body'][_0xe0b0('0x8d')])){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x90')+_0x56c497);}_0x1d1981[_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8d')]]=_0x44da91[_0xe0b0('0x4d')]['from'];})[_0xe0b0('0x15')](function(){return db['ChatWebsite'][_0xe0b0('0x4b')]({'where':{'id':_0x44da91['params']['id']},'include':[{'model':db[_0xe0b0('0x91')],'as':_0xe0b0('0x92'),'include':[{'model':db['CmContact'],'as':_0xe0b0('0x93'),'where':_0x1d1981,'limit':0x1,'order':[['updatedAt',_0xe0b0('0x94')]]}]},{'model':db[_0xe0b0('0x95')],'as':_0xe0b0('0x96')}]});})[_0xe0b0('0x15')](handleEntityNotFound(_0x701ba,null))[_0xe0b0('0x15')](function(_0x13199b){if(_0x13199b&&_0x13199b[_0xe0b0('0x92')]){_0xde3bca[_0xe0b0('0x97')]=_0x13199b;_0xde3bca['applications']=_0x13199b[_0xe0b0('0x96')];_0xde3bca['list']=_0x13199b['List'];_0xde3bca[_0xe0b0('0x98')]=_[_0xe0b0('0x99')](_0xde3bca[_0xe0b0('0x98')],['priority'],['asc']);if(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x96')]){delete _0xde3bca['account'][_0xe0b0('0x96')];}if(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')]&&_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')][_0xe0b0('0x93')][_0xe0b0('0x3c')]){return _0xde3bca[_0xe0b0('0x97')][_0xe0b0('0x92')]['Contacts'][0x0];}var _0x569400=_[_0xe0b0('0x9a')](_0x44da91[_0xe0b0('0x4d')],{'firstName':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')],'ListId':_0x13199b[_0xe0b0('0x9b')]});_0x569400[_0x44da91[_0xe0b0('0x4d')]['mapKey']]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x8a')];return db[_0xe0b0('0x9c')][_0xe0b0('0x4c')](_0x569400,{'fields':_0x51bab6,'raw':!![]});}})[_0xe0b0('0x15')](handleEntityNotFound(_0x701ba,null))['then'](function(_0x3ae295){_0xde3bca[_0xe0b0('0x9d')]=_0x3ae295;var _0x321b0b=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x9e')];if(_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x9f')]){_0x321b0b=_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0x9f')];}else if(_0x44da91[_0xe0b0('0x7f')]['x-forwarded-for']){_0x321b0b=_[_0xe0b0('0xa0')](_0x44da91[_0xe0b0('0x7f')]['x-forwarded-for'][_0xe0b0('0xa1')](','));}if(_0x3ae295){var _0x494567={'ContactId':_0x3ae295['id'],'ChatWebsiteId':_0x44da91[_0xe0b0('0x56')]['id'],'from':(_0x3ae295[_0xe0b0('0xa2')]||'')+'\x20'+(_0x3ae295['lastName']||''),'customerIp':_0x321b0b,'customerPort':_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0xa3')]?_0x44da91[_0xe0b0('0x7f')][_0xe0b0('0xa3')]:null,'referer':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xa4')],'browserName':_0xaca03c[_0xe0b0('0xa5')]['name']&&_0xaca03c['browser'][_0xe0b0('0xa6')]?util[_0xe0b0('0xa7')](_0xe0b0('0xa8'),_0xaca03c['browser'][_0xe0b0('0x2d')],_0xaca03c[_0xe0b0('0xa5')][_0xe0b0('0xa6')]):_0xe0b0('0xa9'),'browserVersion':_0xaca03c[_0xe0b0('0xa5')][_0xe0b0('0xa6')]||_0xe0b0('0xa9'),'osName':util[_0xe0b0('0xa7')](_0xe0b0('0xa8'),_0xaca03c['os'][_0xe0b0('0x2d')],_0xaca03c['os']['version']),'osVersion':_0xaca03c['os']['version'],'deviceModel':_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0x35')]&&_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')]?util[_0xe0b0('0xa7')](_0xe0b0('0xac'),_0xaca03c[_0xe0b0('0xaa')]['model'],_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')],_0xaca03c[_0xe0b0('0xaa')]['type']):null,'deviceVendor':_0xaca03c[_0xe0b0('0xaa')][_0xe0b0('0xab')],'deviceType':_0xaca03c['device']['type'],'formData':JSON[_0xe0b0('0xad')](_0x44da91['body'])};var _0x7eef44={'ChatWebsiteId':_0x44da91['params']['id'],'closed':![]};if(_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')]){_0x7eef44['threadId']=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')];return db['ChatInteraction'][_0xe0b0('0x4b')]({'where':_0x7eef44})['then'](function(_0x1395be){if(_0x1395be){return[_0x1395be,![]];}_0x494567[_0xe0b0('0xae')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')];_0x494567[_0xe0b0('0xaf')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xaf')];return db['ChatInteraction'][_0xe0b0('0x4c')](_0x494567)[_0xe0b0('0x15')](function(_0x5e1db2){return[_0x5e1db2,!![]];});});}_0x7eef44['ContactId']=_0x3ae295['id'];if(_0x44da91[_0xe0b0('0x4d')]['interaction']&&_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb0')]['id']){_0x7eef44['id']=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb0')]['id'];return db[_0xe0b0('0xb1')][_0xe0b0('0x4b')]({'where':_0x7eef44})[_0xe0b0('0x15')](function(_0x8364b0){if(_0x8364b0){return[_0x8364b0,![]];}return db[_0xe0b0('0xb1')][_0xe0b0('0x4c')](_0x494567)[_0xe0b0('0x15')](function(_0x3fc0d6){return[_0x3fc0d6,!![]];});});}return db[_0xe0b0('0xb1')][_0xe0b0('0x4c')](_0x494567)['then'](function(_0x180b6c){return[_0x180b6c,!![]];});}})[_0xe0b0('0xb2')](function(_0x2cd15d,_0x3e82b4){if(_0x2cd15d){_0x1c29dd=_0x3e82b4;if(!_0x3e82b4){var _0x3cbf47={'from':(_0xde3bca['contact'][_0xe0b0('0xa2')]||'')+'\x20'+(_0xde3bca[_0xe0b0('0x9d')][_0xe0b0('0xb3')]||'')};if(_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xae')]&&_0x44da91[_0xe0b0('0x4d')]['messageId']&&_0x44da91[_0xe0b0('0x4d')]['threadId']!=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb4')]){_0x3cbf47[_0xe0b0('0xae')]=_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb4')];}return _0x2cd15d[_0xe0b0('0x55')](_0x3cbf47);}else{return _0x2cd15d;}}})['then'](function(_0xe574f1){_0xde3bca[_0xe0b0('0xb0')]=_0xe574f1[_0xe0b0('0x2a')]({'plain':!![]});_0xde3bca[_0xe0b0('0xb0')][_0xe0b0('0xb5')]=_0x1c29dd;if(_0xde3bca[_0xe0b0('0xb0')][_0xe0b0('0xb5')]){if(_0xde3bca[_0xe0b0('0x97')]['autoclose']){_0xde3bca['applications'][_0xe0b0('0xb6')]({'id':0x0,'priority':_0xde3bca['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xe0b0('0xb7')});}}return db['ChatMessage']['create']({'body':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0x4d')],'ChatWebsiteId':_0x44da91[_0xe0b0('0x56')]['id'],'ChatInteractionId':_0xe574f1['id'],'direction':'in','ContactId':_0xde3bca[_0xe0b0('0x9d')]['id'],'AttachmentId':_0x44da91[_0xe0b0('0x4d')][_0xe0b0('0xb8')]});})[_0xe0b0('0x15')](function(_0x450b09){_0xde3bca[_0xe0b0('0x1b')]=_0x450b09;if(_0xde3bca[_0xe0b0('0xb0')]['UserId']){return db['User'][_0xe0b0('0x4b')]({'attributes':['id',_0xe0b0('0x2d')],'where':{'id':_0xde3bca[_0xe0b0('0xb0')]['UserId']}})['then'](function(_0x254691){if(_0x254691){_0xde3bca['applications'][_0xe0b0('0xb9')]({'id':0x0,'priority':0x0,'app':_0xe0b0('0xba'),'appdata':_0x254691['name']+','+(_0xde3bca[_0xe0b0('0x97')][_0xe0b0('0xbb')]||0xa),'interval':_0xe0b0('0xb7')});_0xde3bca[_0xe0b0('0xbc')]=!![];}return respondWithRpcPromise(_0xe0b0('0xbd'),_0xe0b0('0xbe'),_0xde3bca);});}return respondWithRpcPromise(_0xe0b0('0xbd'),'startRouting',_0xde3bca);})[_0xe0b0('0x15')](function(_0xea6b40){respondWithRpcPromise(_0xe0b0('0xbf'),_0xe0b0('0xbf'),{'event':_0xe0b0('0xc0'),'message':_0xea6b40},client9002);return _0xea6b40;})['then'](respondWithResult(_0x701ba,null))['catch'](handleError(_0x701ba,null));};exports[_0xe0b0('0xc1')]=function(_0x4a8dfc,_0x4bfa22){var _0x3df5c8,_0x588a19,_0x36901a;var _0x151da2=[];var _0x330ed5={};var _0x35f5c1=_0x4a8dfc['files']||[];var _0x50b163=[];var _0x42affa;return db[_0xe0b0('0x9c')][_0xe0b0('0x83')]()[_0xe0b0('0x15')](function(_0xbafa53){if(!_0xbafa53){throw new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x86'));}_0x151da2=_['difference'](_[_0xe0b0('0x37')](_0xbafa53),[_0xe0b0('0x88'),_0xe0b0('0x89'),'CompanyId',_0xe0b0('0x9b')]);if(_0x4a8dfc[_0xe0b0('0x4d')]['id']){delete _0x4a8dfc[_0xe0b0('0x4d')]['id'];}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x8a')])){throw _0x4bfa22['status'](0x1f4)[_0xe0b0('0x2e')](new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))]('from\x20is\x20mandatory'));}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x4d')])||_0x4a8dfc[_0xe0b0('0x4d')]['body']===''){throw _0x4bfa22[_0xe0b0('0x21')](0x1f4)[_0xe0b0('0x2e')](new db[(_0xe0b0('0x84'))][(_0xe0b0('0x85'))](_0xe0b0('0x8c')));}if(_[_0xe0b0('0x70')](_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0xc2')])){throw _0x4bfa22['status'](0x1f4)[_0xe0b0('0x2e')](new db['Sequelize']['ValidationError'](_0xe0b0('0xc3')+_0x151da2));}if(!_[_0xe0b0('0x8f')](_0x151da2,_0x4a8dfc[_0xe0b0('0x4d')]['mapKeyOffline'])){throw _0x4bfa22[_0xe0b0('0x21')](0x1f4)['send'](new db[(_0xe0b0('0x84'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x151da2));}_0x330ed5[_0x4a8dfc['body'][_0xe0b0('0xc2')]]=_0x4a8dfc[_0xe0b0('0x4d')]['from'];})[_0xe0b0('0x15')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4a8dfc[_0xe0b0('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xe0b0('0x92')},{'model':db[_0xe0b0('0xc4')],'as':_0xe0b0('0xc4')}]});})[_0xe0b0('0x15')](handleEntityNotFound(_0x4bfa22,null))['then'](function(_0x2fe1ab){if(_0x2fe1ab&&_0x2fe1ab[_0xe0b0('0x92')]){_0x588a19=_0x2fe1ab;var _0x4187aa=_[_0xe0b0('0x9a')](_0x4a8dfc[_0xe0b0('0x4d')],{'firstName':_0x4a8dfc['body'][_0xe0b0('0x8a')],'phone':_0x4a8dfc[_0xe0b0('0x4d')]['from'],'ListId':_0x2fe1ab[_0xe0b0('0x9b')]});_0x4187aa[_0x4a8dfc['body'][_0xe0b0('0xc2')]]=_0x4a8dfc[_0xe0b0('0x4d')][_0xe0b0('0x8a')];return db[_0xe0b0('0x9c')][_0xe0b0('0xc5')]({'where':_0x330ed5,'defaults':_0x4187aa});}})[_0xe0b0('0xb2')](function(_0x403f30){if(_0x403f30){_0x36901a=_0x403f30;var _0x5b7b02=fs['readFileSync'](path[_0xe0b0('0x6a')](config['root'],_0xe0b0('0xc6')),_0xe0b0('0xc7'));var _0xdde041=ejs[_0xe0b0('0xc8')](_0x5b7b02,{'body':_[_0xe0b0('0xc9')](_0x4a8dfc[_0xe0b0('0x4d')]['body']),'bodyTitle':_0x588a19['offlineMessageBody']});return db[_0xe0b0('0xca')][_0xe0b0('0x4c')]({'body':_0xdde041,'plainBody':htmlToText['fromString'](_0xdde041),'ContactId':_0x403f30['id'],'ChatWebsiteId':_0x588a19['id']});}})[_0xe0b0('0x15')](function(_0x2d0ba8){_0x42affa=_0x2d0ba8;if(_0x35f5c1['length']){var _0x2ad35d=_0x35f5c1[_0xe0b0('0x32')](function(_0x337db8){return{'name':_0x337db8['originalname'],'basename':_0x337db8[_0xe0b0('0x63')],'type':_0x337db8[_0xe0b0('0xcb')],'ChatOfflineMessageId':_0x2d0ba8['id']};});_0x50b163=_0x2ad35d[_0xe0b0('0x32')](_0x24d9ee=>{var _0x57e90f={'filename':_0x24d9ee[_0xe0b0('0x2d')],'path':path['join'](config[_0xe0b0('0x6b')],_0xe0b0('0xcc'),_0xe0b0('0xcd'),'attachments',_0xe0b0('0xce'),_0x24d9ee[_0xe0b0('0xcf')])};return _0x57e90f;});if(!_0x588a19[_0xe0b0('0xd0')]){return db[_0xe0b0('0xd1')]['transaction'](function(_0x1266c8){return db[_0xe0b0('0xd2')][_0xe0b0('0xd3')](_0x2ad35d,{'transaction':_0x1266c8});});}}})[_0xe0b0('0x15')](function(){if(_0x42affa){_0x3df5c8=_0x42affa;return db[_0xe0b0('0xc4')][_0xe0b0('0x5e')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x25d3fe){if(_0x25d3fe&&_0x25d3fe['Smtp']&&_0x588a19[_0xe0b0('0xd4')]&&_0x588a19['forwardOfflineAddress']){var _0x47d689={'tls':{'rejectUnauthorized':![]}};if(_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd6')]){_0x47d689[_0xe0b0('0xd6')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd6')];}else{_0x47d689[_0xe0b0('0xd7')]=_0x25d3fe[_0xe0b0('0xd5')]['host'];_0x47d689[_0xe0b0('0xd8')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd8')];_0x47d689[_0xe0b0('0xd9')]=_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xd9')];}if(_0x25d3fe['Smtp']['authentication']){_0x47d689[_0xe0b0('0xda')]={'user':_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0x4e')],'pass':_0x25d3fe[_0xe0b0('0xd5')][_0xe0b0('0xdb')]};}return respondWithRpcPromise(_0xe0b0('0xdc'),_0xe0b0('0xdd'),{'account':_0x47d689,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x25d3fe[_0xe0b0('0x2d')],_0x25d3fe[_0xe0b0('0xde')]||_0x25d3fe[_0xe0b0('0xd5')]['user']),'to':_0x588a19['forwardOfflineAddress'],'subject':_0x588a19[_0xe0b0('0xdf')],'html':_0x3df5c8[_0xe0b0('0x4d')],'attachments':_0x50b163}},client9003)[_0xe0b0('0x15')](function(){return _0x3df5c8;})[_0xe0b0('0x1e')](function(_0x1427a9){console[_0xe0b0('0x19')](_0x1427a9);});}})[_0xe0b0('0x15')](function(){if(_0x588a19&&_0x588a19[_0xe0b0('0xd0')]&&_0x588a19[_0xe0b0('0xe0')]){var _0x233c95=[];if(_0x35f5c1['length']){_0x233c95=_0x35f5c1[_0xe0b0('0x32')](function(_0x4a577b){return{'name':_0x4a577b[_0xe0b0('0xe1')],'basename':_0x4a577b['filename'],'type':_0x4a577b[_0xe0b0('0xcb')],'ChatOfflineMessageId':_0x42affa['id']};});}var _0x326470;if(!_['isNil'](_0x588a19[_0xe0b0('0xe2')])){var _0x41fd0e=_[_0xe0b0('0x32')](_0x4a8dfc['body'],function(_0x172318){return _0x172318;});var _0xb3018b=_['toPairsIn'](_0x41fd0e)[0x0];var _0x34338e=_[_0xe0b0('0xe3')](_0xb3018b,function(_0x50828f){return _0x50828f;});_0x326470=_0x34338e[0x1][_0x588a19['subjectOffline']];}var _0x33c97b={'from':_0x36901a[_0xe0b0('0xde')],'firstName':_0x36901a['firstName'],'lastName':_0x36901a['lastName'],'mapKey':_0xe0b0('0xde'),'message':{'from':_0x36901a['email'],'to':_0x588a19[_0xe0b0('0xc4')][_0xe0b0('0xde')],'cc':'','subject':_[_0xe0b0('0x70')](_0x326470)?_0x588a19[_0xe0b0('0xdf')]:_0x326470,'messageId':'','sentAt':new Date(),'attach':_0x233c95[_0xe0b0('0x3c')],'attachments':_0x233c95,'originChannel':_0xe0b0('0xe4'),'ChatWebsiteId':_0x588a19['id'],'ChatOfflineMessageId':_0x3df5c8['id'],'originTo':_0x588a19[_0xe0b0('0xc4')]['email']},'body':_0x3df5c8[_0xe0b0('0x4d')]};var _0x5f059f={'account':{'id':_0x588a19['MailAccountId']},'body':_0x33c97b,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xe0b0('0xe5'),_0xe0b0('0xe6'),_0x5f059f,client9001)[_0xe0b0('0x15')](function(){return _0x3df5c8;})[_0xe0b0('0x1e')](function(_0x21ccfe){console['error'](_0x21ccfe);});}return;})['then'](function(){if(_0x3df5c8){return _0x3df5c8;}})['then'](respondWithResult(_0x4bfa22,null))['catch'](function(_0x41b52){console[_0xe0b0('0x19')](_0xe0b0('0x1e'),_0x41b52);for(var _0x5d8613 of _0x35f5c1){var _0x2c18b9=path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0xcc'),_0xe0b0('0xcd'),_0xe0b0('0xe7'),_0xe0b0('0xce'),_0x5d8613['filename']);fs_extra[_0xe0b0('0xe8')](_0x2c18b9)[_0xe0b0('0x1e')](function(_0x2bb49d){console[_0xe0b0('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x2c18b9,_0x2bb49d);});}});};exports[_0xe0b0('0xe9')]=function(_0x20f040,_0x3eb643){return db[_0xe0b0('0xb1')]['find']({'where':{'id':_0x20f040['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x3eb643,null))[_0xe0b0('0x15')](function(_0x26bd6c){if(_0x26bd6c){return _0x26bd6c[_0xe0b0('0xe9')](_0x20f040[_0xe0b0('0x4d')][_0xe0b0('0x61')],_['omit'](_0x20f040[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{});}})[_0xe0b0('0x15')](respondWithResult(_0x3eb643,null))[_0xe0b0('0x1e')](handleError(_0x3eb643,null));};exports[_0xe0b0('0xea')]=function(_0x48706b,_0x164b25){var _0x51afab={'raw':![],'where':{}};var _0x49632d={};var _0x257dda={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x48706b[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x164b25,null))['then'](function(_0x5a04c8){if(_0x5a04c8){_0x49632d[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db['ChatInteraction'][_0xe0b0('0x5a')]);_0x49632d['query']=_[_0xe0b0('0x37')](_0x48706b[_0xe0b0('0x36')]);_0x49632d[_0xe0b0('0x38')]=_[_0xe0b0('0x3a')](_0x49632d['model'],_0x49632d['query']);_0x51afab['attributes']=_[_0xe0b0('0x3a')](_0x49632d[_0xe0b0('0x35')],qs['fields'](_0x48706b['query'][_0xe0b0('0x3b')]));_0x51afab[_0xe0b0('0x39')]=_0x51afab[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x51afab['attributes']:_0x49632d['model'];if(!_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x3d')]('nolimit')){_0x51afab[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x48706b['query']['limit']);_0x51afab['offset']=qs[_0xe0b0('0x22')](_0x48706b[_0xe0b0('0x36')]['offset']);}_0x51afab[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x51afab['where']=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x48706b['query'],_0x49632d['filters']));_0x51afab['where'][_0xe0b0('0x57')]=_0x5a04c8['id'];if(_0x48706b['query'][_0xe0b0('0x42')]){_0x51afab['where']=_['merge'](_0x51afab[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x51afab[_0xe0b0('0x39')],function(_0xe1891c){var _0x4cfd4f={};_0x4cfd4f[_0xe1891c]={'$like':'%'+_0x48706b['query']['filter']+'%'};return _0x4cfd4f;})});}_0x51afab=_['merge']({},_0x51afab,_0x48706b[_0xe0b0('0x46')]);return db[_0xe0b0('0xb1')][_0xe0b0('0x25')]({'where':_0x51afab['where']})[_0xe0b0('0x15')](function(_0x1f1133){_0x257dda['count']=_0x1f1133;if(_0x48706b[_0xe0b0('0x36')][_0xe0b0('0x4a')]){_0x51afab[_0xe0b0('0x47')]=[{'model':db[_0xe0b0('0x9c')],'as':'Contact','required':![]},{'model':db[_0xe0b0('0xeb')],'as':_0xe0b0('0xec'),'attributes':[_0xe0b0('0x2d'),'fullname',_0xe0b0('0xed')],'required':![]},{'model':db[_0xe0b0('0xee')],'as':_0xe0b0('0xef'),'attributes':['id',_0xe0b0('0x2d'),'color'],'where':_0x48706b[_0xe0b0('0x36')][_0xe0b0('0xf0')]?{'id':_0x48706b[_0xe0b0('0x36')][_0xe0b0('0xf0')]}:undefined,'required':_0x48706b[_0xe0b0('0x36')]['tag']?!![]:![]}];}return db[_0xe0b0('0xb1')][_0xe0b0('0x5b')](_0x51afab);})['then'](function(_0xb263f6){_0x257dda[_0xe0b0('0x48')]=_0xb263f6;return _0x257dda;});}})[_0xe0b0('0x15')](respondWithFilteredResult(_0x164b25,_0x51afab))[_0xe0b0('0x1e')](handleError(_0x164b25,null));};function iftimePromise(_0x1ffc75,_0x3a39d7){return respondWithRpcPromise('Command',_0xe0b0('0xf1'),{'command':_0x3a39d7[_0xe0b0('0xf2')]?util[_0xe0b0('0xa7')](_0xe0b0('0xf3'),_0x1ffc75[_0xe0b0('0xf4')],_0x3a39d7[_0xe0b0('0xf2')]):util[_0xe0b0('0xa7')](_0xe0b0('0xf5'),_0x1ffc75[_0xe0b0('0xf4')])},client9002)[_0xe0b0('0x15')](function(_0x4d12b2){var _0xeeff22=_0x4d12b2&&_0x4d12b2['indexOf'](_0xe0b0('0xf6'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3a39d7['id'],_0x1ffc75['id'],_0x1ffc75[_0xe0b0('0xf4')],_0xeeff22?_0xe0b0('0xf7'):'OFFLINE',_0x3a39d7['timezone']?_0x3a39d7[_0xe0b0('0xf2')]:_0xe0b0('0xf8'));return _0xeeff22;})['catch'](function(_0x5501c2){logger[_0xe0b0('0x19')](_0xe0b0('0xf9'),_0x3a39d7['id'],_0x1ffc75['id'],_0x1ffc75['interval'],util[_0xe0b0('0xfa')](_0x5501c2,{'showHidden':![],'depth':null}),_0x3a39d7[_0xe0b0('0xf2')]?_0x3a39d7[_0xe0b0('0xf2')]:_0xe0b0('0xf8'));return![];});}exports['getSnippet']=function(_0x230ff2,_0x22d53d){var _0x2251c2=0x0;var _0x24271d=0x0;var _0x385ffb=![];var _0x594eaa;var _0x2932c3;return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x230ff2['params']['id']},'include':[{'model':db[_0xe0b0('0xfb')],'as':_0xe0b0('0xfb'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xe0b0('0xf4')],'raw':!![]}]}]})[_0xe0b0('0x15')](handleEntityNotFound(_0x22d53d,null))[_0xe0b0('0x15')](function(_0x46fbdc){if(_0x46fbdc){_0x594eaa=_0x46fbdc;return _0x46fbdc[_0xe0b0('0xfc')]({'raw':!![]});}})[_0xe0b0('0x15')](function(_0x34e1bf){if(_0x594eaa){if(_0x34e1bf){_0x2932c3=_0x34e1bf;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x5c001a){if(_0x5c001a){_0x24271d=_0x5c001a[_0xe0b0('0xfd')];_0x385ffb=_0x5c001a[_0xe0b0('0x6f')];}})[_0xe0b0('0x15')](function(){return db['ChatInteraction'][_0xe0b0('0x25')]({'where':{'closed':![]}});})[_0xe0b0('0x15')](function(_0x1a5a0f){_0x2251c2=_0x1a5a0f;if(_0x24271d&&_0x1a5a0f>_0x24271d){return db[_0xe0b0('0xfe')][_0xe0b0('0x5e')]({'where':{'id':0x1}})[_0xe0b0('0x15')](function(_0x5910e6){if(_0x5910e6){_0x5910e6['increment'](_0xe0b0('0xff'));}});}})[_0xe0b0('0x15')](function(){if(_0x594eaa[_0xe0b0('0xfb')]&&_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')]){var _0x55e2ba=[];for(var _0x1e4f9d=0x0;_0x1e4f9d<_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')][_0xe0b0('0x3c')];_0x1e4f9d++){var _0x224e67=_0x594eaa[_0xe0b0('0xfb')][_0xe0b0('0x100')][_0x1e4f9d][_0xe0b0('0x2a')]({'plain':!![]});_0x55e2ba[_0xe0b0('0xb6')](iftimePromise(_0x224e67,_0x594eaa));}return BPromise[_0xe0b0('0x101')](_0x55e2ba)['then'](function(_0x5bc9dc){return _['some'](_0x5bc9dc);});}else{return!![];}})[_0xe0b0('0x15')](function(_0x344877){var _0xa604c3=fs[_0xe0b0('0x102')](path[_0xe0b0('0x6a')](config[_0xe0b0('0x6b')],_0xe0b0('0x103')),'utf8');var _0xa6e316={'remote':_0x594eaa[_0xe0b0('0x104')],'query':querystring[_0xe0b0('0xad')](_['merge'](_0x594eaa[_0xe0b0('0x2a')]({'plain':!![]}),{'customerIp':_0x230ff2[_0xe0b0('0x7f')]['x-forwarded-for']||_0x230ff2[_0xe0b0('0x7f')][_0xe0b0('0x105')]||_0x230ff2[_0xe0b0('0x106')][_0xe0b0('0x107')]||_0x230ff2['ip'],'referer':_0x230ff2['headers']['referer'],'openedInteractions':_0x2251c2,'maxInteractions':_0x24271d,'virtual':_0x385ffb[_0xe0b0('0xfd')],'online':_0x344877,'custom':_0x385ffb}))['replace'](/'/g,'\x5c\x27')};_0x22d53d[_0xe0b0('0x2e')](ejs['render'](Mustache[_0xe0b0('0xc8')](_0xa604c3,_0xa6e316),{'proactiveActions':_0x2932c3,'alignment':_0x594eaa[_0xe0b0('0x108')],'verticalAlignment':_0x594eaa[_0xe0b0('0x109')],'div_color':_0x594eaa['color'],'labelText':_0x594eaa[_0xe0b0('0x10a')],'text_color':_0x594eaa['textColor'],'button_color':_0x594eaa[_0xe0b0('0x10b')],'background_color':_0x594eaa[_0xe0b0('0x10c')]}));})['catch'](handleError(_0x22d53d,null));};exports[_0xe0b0('0x10d')]=function(_0x3888d7,_0x2ed835){var _0x8c9efb=_0x3888d7['params']['id'];var _0x161a8c=_0x3888d7[_0xe0b0('0x4d')];var _0x2522f7=0xc8;var _0x523818=null;return db[_0xe0b0('0xd1')]['transaction']({'isolationLevel':db[_0xe0b0('0xd1')]['Transaction'][_0xe0b0('0x10e')][_0xe0b0('0x10f')]},function(_0x18d0eb){return db['ChatWebsite'][_0xe0b0('0x5e')]({'where':{'id':_0x8c9efb},'transaction':_0x18d0eb})[_0xe0b0('0x15')](function(_0x2eb954){if(_0x2eb954){return db[_0xe0b0('0x95')][_0xe0b0('0x29')]({'where':{'ChatWebsiteId':_0x8c9efb},'transaction':_0x18d0eb})[_0xe0b0('0x15')](function(){var _0x2961c1=_['map'](_0x161a8c,function(_0x31063b){_0x31063b['ChatWebsiteId']=_0x8c9efb;return _0x31063b;});return db[_0xe0b0('0x95')]['bulkCreate'](_0x2961c1,{'transaction':_0x18d0eb});});}else{_0x2522f7=0x194;_0x523818=[];}});})[_0xe0b0('0x15')](function(){if(_0x2522f7!==0x194){return db[_0xe0b0('0x95')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x8c9efb},'order':'priority'})[_0xe0b0('0x15')](function(_0x32c330){_0x523818=_0x32c330;});}})[_0xe0b0('0x1e')](function(_0x299f82){_0x2522f7=0x1f4;logger[_0xe0b0('0x19')](_0x299f82[_0xe0b0('0x2c')]);if(_0x299f82['name']){delete _0x299f82[_0xe0b0('0x2d')];}_0x523818=_0x299f82;})[_0xe0b0('0x110')](function(){if(_0x523818===null){_0x2ed835['sendStatus'](_0x2522f7);}else{if(_0x2522f7===0x1f4){_0x2ed835[_0xe0b0('0x21')](_0x2522f7)[_0xe0b0('0x2e')](_0x523818);}else{_0x2ed835[_0xe0b0('0x21')](_0x2522f7)[_0xe0b0('0x28')](_0x523818);}}});};exports[_0xe0b0('0x111')]=function(_0x5ac9af,_0x220bb1){var _0x51fab9={};var _0x2309cf={};var _0x436d2c;var _0x3b6cac;return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x5ac9af['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x220bb1,null))[_0xe0b0('0x15')](function(_0x49da50){if(_0x49da50){_0x436d2c=_0x49da50;_0x2309cf[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0x95')][_0xe0b0('0x5a')]);_0x2309cf[_0xe0b0('0x36')]=_['keys'](_0x5ac9af['query']);_0x2309cf['filters']=_[_0xe0b0('0x3a')](_0x2309cf[_0xe0b0('0x35')],_0x2309cf[_0xe0b0('0x36')]);_0x51fab9['attributes']=_[_0xe0b0('0x3a')](_0x2309cf['model'],qs[_0xe0b0('0x3b')](_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x51fab9[_0xe0b0('0x39')]=_0x51fab9[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x51fab9['attributes']:_0x2309cf[_0xe0b0('0x35')];_0x51fab9[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x5ac9af['query'][_0xe0b0('0x40')]);_0x51fab9[_0xe0b0('0x43')]=qs['filters'](_[_0xe0b0('0x41')](_0x5ac9af['query'],_0x2309cf[_0xe0b0('0x38')]));if(_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x51fab9[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x51fab9[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x51fab9[_0xe0b0('0x39')],function(_0x41e4be){var _0x3338bb={};_0x3338bb[_0x41e4be]={'$like':'%'+_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x3338bb;})});}_0x51fab9=_[_0xe0b0('0x44')]({},_0x51fab9,_0x5ac9af[_0xe0b0('0x46')]);return _0x436d2c['getApplications'](_0x51fab9);}})[_0xe0b0('0x15')](function(_0xce17d3){if(_0xce17d3){_0x3b6cac=_0xce17d3[_0xe0b0('0x3c')];if(!_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x51fab9[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x5ac9af[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x51fab9[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x5ac9af['query'][_0xe0b0('0x22')]);}return _0x436d2c['getApplications'](_0x51fab9);}})['then'](function(_0xd60c40){if(_0xd60c40){return _0xd60c40?{'count':_0x3b6cac,'rows':_0xd60c40}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x220bb1,null))['catch'](handleError(_0x220bb1,null));};exports[_0xe0b0('0x112')]=function(_0x1ebfdc,_0x5d1b30){return db[_0xe0b0('0x113')][_0xe0b0('0x4b')]({'where':{'id':_0x1ebfdc[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5d1b30,null))[_0xe0b0('0x15')](function(_0x4ba58d){if(_0x4ba58d){return _0x4ba58d[_0xe0b0('0x112')](_0x1ebfdc[_0xe0b0('0x4d')][_0xe0b0('0x61')],_['omit'](_0x1ebfdc[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{});}})[_0xe0b0('0x15')](respondWithResult(_0x5d1b30,null))[_0xe0b0('0x1e')](handleError(_0x5d1b30,null));};exports[_0xe0b0('0xfc')]=function(_0x15373d,_0x207b52){var _0x421f85={};var _0x7a18d8={};var _0x245796;var _0x51d6f0;return db['ChatWebsite'][_0xe0b0('0x5e')]({'where':{'id':_0x15373d['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x207b52,null))['then'](function(_0xaad4b4){if(_0xaad4b4){_0x245796=_0xaad4b4;_0x7a18d8[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db['ChatProactiveAction']['rawAttributes']);_0x7a18d8['query']=_[_0xe0b0('0x37')](_0x15373d[_0xe0b0('0x36')]);_0x7a18d8['filters']=_[_0xe0b0('0x3a')](_0x7a18d8[_0xe0b0('0x35')],_0x7a18d8[_0xe0b0('0x36')]);_0x421f85[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x7a18d8[_0xe0b0('0x35')],qs[_0xe0b0('0x3b')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x421f85[_0xe0b0('0x39')]=_0x421f85[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x421f85[_0xe0b0('0x39')]:_0x7a18d8['model'];_0x421f85[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x421f85[_0xe0b0('0x43')]=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x15373d[_0xe0b0('0x36')],_0x7a18d8[_0xe0b0('0x38')]));if(_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x421f85[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x421f85[_0xe0b0('0x43')],{'$or':_['map'](_0x421f85[_0xe0b0('0x39')],function(_0x12fec1){var _0x1fc2ba={};_0x1fc2ba[_0x12fec1]={'$like':'%'+_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x1fc2ba;})});}_0x421f85=_['merge']({},_0x421f85,_0x15373d[_0xe0b0('0x46')]);return _0x245796[_0xe0b0('0xfc')](_0x421f85);}})['then'](function(_0x4ed950){if(_0x4ed950){_0x51d6f0=_0x4ed950['length'];if(!_0x15373d[_0xe0b0('0x36')]['hasOwnProperty'](_0xe0b0('0x3e'))){_0x421f85[_0xe0b0('0x23')]=qs['limit'](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x23')]);_0x421f85['offset']=qs[_0xe0b0('0x22')](_0x15373d[_0xe0b0('0x36')][_0xe0b0('0x22')]);}return _0x245796['getProactiveActions'](_0x421f85);}})[_0xe0b0('0x15')](function(_0xac72b0){if(_0xac72b0){return _0xac72b0?{'count':_0x51d6f0,'rows':_0xac72b0}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x207b52,null))[_0xe0b0('0x1e')](handleError(_0x207b52,null));};exports[_0xe0b0('0x114')]=function(_0x806731,_0x5632cd){var _0x454673=_0x806731[_0xe0b0('0x36')][_0xe0b0('0x115')]===_0xe0b0('0x116')?_0xe0b0('0x117'):_0xe0b0('0x118');return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'attributes':['id',_0x454673],'where':{'id':_0x806731['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x5632cd,null))[_0xe0b0('0x15')](function(_0xc88c18){if(_0xc88c18){var _0x3ea089=_0xc88c18[_0x454673];var _0x30af0e=_0x3ea089&&_0x3ea089[_0xe0b0('0x119')]?_0x3ea089[_0xe0b0('0x119')]:[];_0x5632cd[_0xe0b0('0x2e')]({'fromKey':_['isNil'](_0x3ea089[_0xe0b0('0x11a')])?undefined:_0x3ea089[_0xe0b0('0x11a')],'count':_0x30af0e['length'],'rows':_0x30af0e});}})[_0xe0b0('0x1e')](handleError(_0x5632cd,null));};exports[_0xe0b0('0x11b')]=function(_0x443352,_0x404b24){var _0x1654d4={'raw':![],'where':{}};var _0x1214bd={};var _0x150f88={'count':0x0,'rows':[]};return db[_0xe0b0('0x33')][_0xe0b0('0x5e')]({'where':{'id':_0x443352[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x404b24,null))['then'](function(_0x2bafbe){if(_0x2bafbe){_0x1214bd[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0xca')][_0xe0b0('0x5a')]);_0x1214bd['query']=_[_0xe0b0('0x37')](_0x443352['query']);_0x1214bd['filters']=_[_0xe0b0('0x3a')](_0x1214bd[_0xe0b0('0x35')],_0x1214bd[_0xe0b0('0x36')]);_0x1654d4[_0xe0b0('0x39')]=_[_0xe0b0('0x3a')](_0x1214bd[_0xe0b0('0x35')],qs['fields'](_0x443352[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x1654d4[_0xe0b0('0x39')]=_0x1654d4[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x1654d4[_0xe0b0('0x39')]:_0x1214bd[_0xe0b0('0x35')];if(!_0x443352['query'][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x1654d4[_0xe0b0('0x23')]=qs[_0xe0b0('0x23')](_0x443352['query']['limit']);_0x1654d4[_0xe0b0('0x22')]=qs['offset'](_0x443352[_0xe0b0('0x36')]['offset']);}_0x1654d4[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x443352[_0xe0b0('0x36')]['sort']);_0x1654d4['where']=qs[_0xe0b0('0x38')](_[_0xe0b0('0x41')](_0x443352[_0xe0b0('0x36')],_0x1214bd['filters']));_0x1654d4[_0xe0b0('0x43')][_0xe0b0('0x57')]=_0x2bafbe['id'];if(_0x443352[_0xe0b0('0x36')][_0xe0b0('0x42')]){_0x1654d4[_0xe0b0('0x43')]=_[_0xe0b0('0x44')](_0x1654d4[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x1654d4[_0xe0b0('0x39')],function(_0x5815f5){var _0x1eacdf={};_0x1eacdf[_0x5815f5]={'$like':'%'+_0x443352[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x1eacdf;})});}_0x1654d4=_[_0xe0b0('0x44')]({},_0x1654d4,_0x443352[_0xe0b0('0x46')]);return db[_0xe0b0('0xca')][_0xe0b0('0x25')]({'where':_0x1654d4[_0xe0b0('0x43')]})[_0xe0b0('0x15')](function(_0x4496d0){_0x150f88[_0xe0b0('0x25')]=_0x4496d0;if(_0x443352['query']['includeAll']){_0x1654d4['include']=[{'all':!![]}];}else{_0x1654d4['include']=[{'model':db[_0xe0b0('0x9c')],'as':_0xe0b0('0x11c'),'required':![]},{'model':db[_0xe0b0('0xd2')],'as':_0xe0b0('0x11d'),'required':![]}];}return db[_0xe0b0('0xca')][_0xe0b0('0x5b')](_0x1654d4);})[_0xe0b0('0x15')](function(_0x306f80){_0x150f88[_0xe0b0('0x48')]=_0x306f80;return _0x150f88;});}})['then'](respondWithFilteredResult(_0x404b24,_0x1654d4))['catch'](handleError(_0x404b24,null));};exports[_0xe0b0('0x11e')]=function(_0x2c6de2,_0x49f1df){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x2c6de2[_0xe0b0('0x56')]['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x49f1df,null))['then'](function(_0x1612e9){if(_0x1612e9){return _0x1612e9['addAgents'](_0x2c6de2[_0xe0b0('0x4d')][_0xe0b0('0x61')],_[_0xe0b0('0x11f')](_0x2c6de2[_0xe0b0('0x4d')],[_0xe0b0('0x61'),'id'])||{})[_0xe0b0('0xb2')](function(_0x9d6a15){for(var _0x2601ab=0x0;_0x2601ab<_0x2c6de2[_0xe0b0('0x4d')]['ids']['length'];_0x2601ab+=0x1){socket[_0xe0b0('0x120')]('userChatWebsite:save',{'UserId':Number(_0x2c6de2[_0xe0b0('0x4d')][_0xe0b0('0x61')][_0x2601ab]),'ChatWebsiteId':Number(_0x2c6de2[_0xe0b0('0x56')]['id'])});}return _0x9d6a15;});}})[_0xe0b0('0x15')](respondWithResult(_0x49f1df,null))[_0xe0b0('0x1e')](handleError(_0x49f1df,null));};exports[_0xe0b0('0x121')]=function(_0x3c3bc2,_0x285e1d){return db[_0xe0b0('0x33')][_0xe0b0('0x4b')]({'where':{'id':_0x3c3bc2['params']['id']}})[_0xe0b0('0x15')](handleEntityNotFound(_0x285e1d,null))['then'](function(_0x1a6915){if(_0x1a6915){return _0x1a6915['removeAgents'](_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')])[_0xe0b0('0x15')](function(){if(_[_0xe0b0('0x122')](_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')])){for(var _0x82d32f=0x0;_0x82d32f<_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')][_0xe0b0('0x3c')];_0x82d32f+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')][_0x82d32f]),'ChatWebsiteId':Number(_0x3c3bc2[_0xe0b0('0x56')]['id'])});}}else{socket[_0xe0b0('0x120')](_0xe0b0('0x123'),{'UserId':Number(_0x3c3bc2[_0xe0b0('0x36')][_0xe0b0('0x61')]),'ChatWebsiteId':Number(_0x3c3bc2[_0xe0b0('0x56')]['id'])});}});}})[_0xe0b0('0x15')](respondWithStatusCode(_0x285e1d,null))[_0xe0b0('0x1e')](handleError(_0x285e1d,null));};exports[_0xe0b0('0x124')]=function(_0x54e11c,_0x4d6351){var _0x2e872b={};var _0x1f9b27={};var _0x229485;var _0x21a549;return db[_0xe0b0('0x33')]['findOne']({'where':{'id':_0x54e11c[_0xe0b0('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d6351,null))[_0xe0b0('0x15')](function(_0x4d04bf){if(_0x4d04bf){_0x229485=_0x4d04bf;_0x1f9b27[_0xe0b0('0x35')]=_[_0xe0b0('0x37')](db[_0xe0b0('0xeb')][_0xe0b0('0x5a')]);_0x1f9b27[_0xe0b0('0x36')]=_[_0xe0b0('0x37')](_0x54e11c[_0xe0b0('0x36')]);_0x1f9b27['filters']=_['intersection'](_0x1f9b27['model'],_0x1f9b27['query']);_0x2e872b[_0xe0b0('0x39')]=_['intersection'](_0x1f9b27['model'],qs['fields'](_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x3b')]));_0x2e872b[_0xe0b0('0x39')]=_0x2e872b[_0xe0b0('0x39')][_0xe0b0('0x3c')]?_0x2e872b['attributes']:_0x1f9b27['model'];_0x2e872b[_0xe0b0('0x3f')]=qs[_0xe0b0('0x40')](_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x40')]);_0x2e872b[_0xe0b0('0x43')]=qs['filters'](_['pick'](_0x54e11c[_0xe0b0('0x36')],_0x1f9b27[_0xe0b0('0x38')]));if(_0x54e11c[_0xe0b0('0x36')]['filter']){_0x2e872b['where']=_[_0xe0b0('0x44')](_0x2e872b[_0xe0b0('0x43')],{'$or':_[_0xe0b0('0x32')](_0x2e872b[_0xe0b0('0x39')],function(_0x9a8a0d){var _0x938810={};_0x938810[_0x9a8a0d]={'$like':'%'+_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x42')]+'%'};return _0x938810;})});}_0x2e872b=_['merge']({},_0x2e872b,_0x54e11c['options']);return _0x229485[_0xe0b0('0x124')](_0x2e872b);}})[_0xe0b0('0x15')](function(_0x1717d3){if(_0x1717d3){_0x21a549=_0x1717d3[_0xe0b0('0x3c')];if(!_0x54e11c[_0xe0b0('0x36')][_0xe0b0('0x3d')](_0xe0b0('0x3e'))){_0x2e872b[_0xe0b0('0x23')]=qs['limit'](_0x54e11c[_0xe0b0('0x36')]['limit']);_0x2e872b[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x54e11c[_0xe0b0('0x36')]['offset']);}return _0x229485[_0xe0b0('0x124')](_0x2e872b);}})[_0xe0b0('0x15')](function(_0x7d6993){if(_0x7d6993){return _0x7d6993?{'count':_0x21a549,'rows':_0x7d6993}:null;}})[_0xe0b0('0x15')](respondWithResult(_0x4d6351,null))[_0xe0b0('0x1e')](handleError(_0x4d6351,null));}; \ No newline at end of file +var _0xb10b=['removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','get','UserProfileResource','stack','name','index','map','ChatWebsite','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','findAll','rows','mandatoryDispositionPause','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','Pause','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','filename','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','List','Contacts','ChatApplication','Applications','account','applications','list','orderBy','asc','defaults','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','threadId','ChatInteraction','ContactId','interaction','spread','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','describe','ListId','send','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','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','service','host','port','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','labelText','textColor','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit'];(function(_0x4af806,_0x5fff0a){var _0x5170d2=function(_0x2800b1){while(--_0x2800b1){_0x4af806['push'](_0x4af806['shift']());}};_0x5170d2(++_0x5fff0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x59a3e9,_0x27fb38){_0x59a3e9=_0x59a3e9-0x0;var _0x5179ac=_0xb10b[_0x59a3e9];return _0x5179ac;};'use strict';var BPromise=require(_0xbb10('0x0'));var Mustache=require('mustache');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var ejs=require(_0xbb10('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb10('0x4'));var querystring=require(_0xbb10('0x5'));var Redis=require(_0xbb10('0x6'));var qs=require(_0xbb10('0x7'));var logger=require(_0xbb10('0x8'))(_0xbb10('0x9'));var config=require('../../config/environment');var db=require(_0xbb10('0xa'))['db'];config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);var htmlToText=require(_0xbb10('0x10'));var jayson=require(_0xbb10('0x11'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbb10('0x12')][_0xbb10('0x13')]({'port':0x232a});var client9003=jayson[_0xbb10('0x12')]['http']({'port':0x232b});var client9001=jayson[_0xbb10('0x12')]['http']({'port':0x2329});function respondWithRpcPromise(_0x44fb19,_0x916a32,_0x285009,_0x193a27){return new BPromise(function(_0x442548,_0x147230){var _0x58a612=_0x193a27||client;return _0x58a612[_0xbb10('0x14')](_0x44fb19,_0x285009)[_0xbb10('0x15')](function(_0x45b9d6){logger[_0xbb10('0x16')](_0xbb10('0x17'),_0x916a32,_0xbb10('0x18'));logger[_0xbb10('0x19')](_0xbb10('0x1a'),_0x916a32,_0xbb10('0x18'),JSON[_0xbb10('0x1b')](_0x45b9d6));if(_0x45b9d6['error']){if(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1d')]===0x1f4){logger[_0xbb10('0x1c')](_0xbb10('0x17'),_0x916a32,_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);return _0x147230(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);}logger[_0xbb10('0x1c')](_0xbb10('0x17'),_0x916a32,_0x45b9d6['error'][_0xbb10('0x1e')]);return _0x442548(_0x45b9d6[_0xbb10('0x1c')][_0xbb10('0x1e')]);}else{logger[_0xbb10('0x16')](_0xbb10('0x17'),_0x916a32,_0xbb10('0x18'));_0x442548(_0x45b9d6['result'][_0xbb10('0x1e')]);}})[_0xbb10('0x1f')](function(_0x50aea1){logger['error'](_0xbb10('0x17'),_0x916a32,_0x50aea1);_0x147230(_0x50aea1);});});}function respondWithStatusCode(_0x311abe,_0x2e911d){_0x2e911d=_0x2e911d||0xcc;return function(_0x317da4){if(_0x317da4){return _0x311abe[_0xbb10('0x20')](_0x2e911d);}return _0x311abe[_0xbb10('0x21')](_0x2e911d)[_0xbb10('0x22')]();};}function respondWithResult(_0x436104,_0x7f2377){_0x7f2377=_0x7f2377||0xc8;return function(_0x395404){if(_0x395404){return _0x436104[_0xbb10('0x21')](_0x7f2377)[_0xbb10('0x23')](_0x395404);}};}function respondWithFilteredResult(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(_0x4fb5e0){var _0xc93a04=typeof _0x4fedac[_0xbb10('0x24')]===_0xbb10('0x25')&&typeof _0x4fedac['limit']===_0xbb10('0x25');var _0x24d586=_0x4fb5e0[_0xbb10('0x26')];var _0x1d5e95=_0xc93a04?0x0:_0x4fedac[_0xbb10('0x24')];var _0x20d946=_0xc93a04?_0x4fb5e0[_0xbb10('0x26')]:_0x4fedac['offset']+_0x4fedac[_0xbb10('0x27')];var _0x21ac54;if(_0x20d946>=_0x24d586){_0x20d946=_0x24d586;_0x21ac54=0xc8;}else{_0x21ac54=0xce;}_0x537898[_0xbb10('0x21')](_0x21ac54);return _0x537898[_0xbb10('0x28')](_0xbb10('0x29'),_0x1d5e95+'-'+_0x20d946+'/'+_0x24d586)[_0xbb10('0x23')](_0x4fb5e0);}return null;};}function saveUpdates(_0x5d5c80){return function(_0x221624){if(_0x221624){return _0x221624['update'](_0x5d5c80)[_0xbb10('0x15')](function(_0x56f2da){return _0x56f2da;});}return null;};}function removeEntity(_0x16ad2a){return function(_0x1dcc9c){if(_0x1dcc9c){return _0x1dcc9c[_0xbb10('0x2a')]()['then'](function(){var _0x518d47=_0x1dcc9c[_0xbb10('0x2b')]({'plain':!![]});var _0x34f65e='ChatWebsites';return db[_0xbb10('0x2c')][_0xbb10('0x2a')]({'where':{'type':_0x34f65e,'resourceId':_0x518d47['id']}})[_0xbb10('0x15')](function(){return _0x1dcc9c;});})[_0xbb10('0x15')](function(){_0x16ad2a[_0xbb10('0x21')](0xcc)[_0xbb10('0x22')]();});}};}function handleEntityNotFound(_0xf85197){return function(_0x4975f5){if(!_0x4975f5){_0xf85197[_0xbb10('0x20')](0x194);}return _0x4975f5;};}function handleError(_0x1da9c9,_0x441d15){_0x441d15=_0x441d15||0x1f4;return function(_0x8c1ce6){logger[_0xbb10('0x1c')](_0x8c1ce6[_0xbb10('0x2d')]);if(_0x8c1ce6[_0xbb10('0x2e')]){delete _0x8c1ce6[_0xbb10('0x2e')];}_0x1da9c9[_0xbb10('0x21')](_0x441d15)['send'](_0x8c1ce6);};}exports[_0xbb10('0x2f')]=function(_0x150107,_0x1ddd9e){var _0x3c3c45={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x570f5a={},_0x111762={'count':0x0,'rows':[]};var _0x3eb3cc=_[_0xbb10('0x30')](db[_0xbb10('0x31')][_0xbb10('0x32')],function(_0x15d895){return{'name':_0x15d895[_0xbb10('0x33')],'type':_0x15d895['type'][_0xbb10('0x34')]};});_0x570f5a[_0xbb10('0x35')]=_['map'](_0x3eb3cc,'name');_0x570f5a['query']=_[_0xbb10('0x36')](_0x150107[_0xbb10('0x37')]);_0x570f5a[_0xbb10('0x38')]=_['intersection'](_0x570f5a[_0xbb10('0x35')],_0x570f5a[_0xbb10('0x37')]);_0x3c3c45[_0xbb10('0x39')]=_['intersection'](_0x570f5a[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x150107[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x3c3c45['attributes']=_0x3c3c45[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x3c3c45['attributes']:_0x570f5a[_0xbb10('0x35')];if(!_0x150107[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x3c3c45[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x150107['query'][_0xbb10('0x27')]);_0x3c3c45[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x150107[_0xbb10('0x37')]['offset']);}_0x3c3c45[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x150107[_0xbb10('0x37')][_0xbb10('0x3f')]);_0x3c3c45['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x150107['query'],_0x570f5a['filters']),_0x3eb3cc);if(_0x150107[_0xbb10('0x37')]['filter']){_0x3c3c45[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x3c3c45['where'],{'$or':_[_0xbb10('0x30')](_0x3eb3cc,function(_0x1d82bf){if(_0x1d82bf[_0xbb10('0x43')]!=='VIRTUAL'){var _0x2dd02b={};_0x2dd02b[_0x1d82bf[_0xbb10('0x2e')]]={'$like':'%'+_0x150107[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x2dd02b;}})});}_0x3c3c45=_[_0xbb10('0x42')]({},_0x3c3c45,_0x150107[_0xbb10('0x45')]);var _0x190781={'where':_0x3c3c45[_0xbb10('0x41')]};return db[_0xbb10('0x31')][_0xbb10('0x26')](_0x190781)[_0xbb10('0x15')](function(_0x1eadd2){_0x111762['count']=_0x1eadd2;if(_0x150107[_0xbb10('0x37')][_0xbb10('0x46')]){_0x3c3c45['include']=[{'all':!![]}];}return db[_0xbb10('0x31')][_0xbb10('0x47')](_0x3c3c45);})[_0xbb10('0x15')](function(_0x5a5226){_0x111762[_0xbb10('0x48')]=_0x5a5226;return _0x111762;})[_0xbb10('0x15')](respondWithFilteredResult(_0x1ddd9e,_0x3c3c45))[_0xbb10('0x1f')](handleError(_0x1ddd9e,null));};exports['show']=function(_0x4a9793,_0xcb3354){var _0x76a208={'raw':![],'where':{'id':_0x4a9793['params']['id']},'include':[{'model':db['Pause'],'as':_0xbb10('0x49')}]},_0x2b12bd={};_0x2b12bd[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x31')][_0xbb10('0x32')]);_0x2b12bd[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x4a9793[_0xbb10('0x37')]);_0x2b12bd[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x2b12bd['model'],_0x2b12bd['query']);_0x76a208[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x2b12bd[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x4a9793[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x76a208[_0xbb10('0x39')]=_0x76a208[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x76a208[_0xbb10('0x39')]:_0x2b12bd[_0xbb10('0x35')];if(_0x4a9793[_0xbb10('0x37')][_0xbb10('0x46')]){_0x76a208[_0xbb10('0x4b')]=[{'all':!![]}];}_0x76a208=_[_0xbb10('0x42')]({},_0x76a208,_0x4a9793['options']);return db[_0xbb10('0x31')]['find'](_0x76a208)[_0xbb10('0x15')](handleEntityNotFound(_0xcb3354,null))[_0xbb10('0x15')](respondWithResult(_0xcb3354,null))[_0xbb10('0x1f')](handleError(_0xcb3354,null));};exports[_0xbb10('0x4c')]=function(_0x26e66e,_0x32d8e9){return db[_0xbb10('0x31')][_0xbb10('0x4c')](_0x26e66e[_0xbb10('0x4d')],{})[_0xbb10('0x15')](function(_0x44a056){var _0x1c2dce=_0x26e66e[_0xbb10('0x4e')][_0xbb10('0x2b')]({'plain':!![]});if(!_0x1c2dce)throw new Error(_0xbb10('0x4f'));if(_0x1c2dce['role']===_0xbb10('0x4e')){var _0x466eb7=_0x44a056[_0xbb10('0x2b')]({'plain':!![]});var _0x4ce8e7=_0xbb10('0x50');return db[_0xbb10('0x51')]['find']({'where':{'name':_0x4ce8e7,'userProfileId':_0x1c2dce[_0xbb10('0x52')]},'raw':!![]})[_0xbb10('0x15')](function(_0x2909a1){if(_0x2909a1&&_0x2909a1[_0xbb10('0x53')]===0x0){return db[_0xbb10('0x2c')][_0xbb10('0x4c')]({'name':_0x466eb7[_0xbb10('0x2e')],'resourceId':_0x466eb7['id'],'type':_0x2909a1[_0xbb10('0x2e')],'sectionId':_0x2909a1['id']},{})[_0xbb10('0x15')](function(){return _0x44a056;});}else{return _0x44a056;}})[_0xbb10('0x1f')](function(_0x2eb05a){logger[_0xbb10('0x1c')](_0xbb10('0x54'),_0x2eb05a);throw _0x2eb05a;});}return _0x44a056;})['then'](respondWithResult(_0x32d8e9,0xc9))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x55')]=function(_0x3e6338,_0x3d0cb7){if(_0x3e6338[_0xbb10('0x4d')]['id']){delete _0x3e6338['body']['id'];}return db['ChatWebsite'][_0xbb10('0x56')]({'where':{'id':_0x3e6338[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x58')],'as':_0xbb10('0x49')}]})[_0xbb10('0x15')](handleEntityNotFound(_0x3d0cb7,null))[_0xbb10('0x15')](saveUpdates(_0x3e6338[_0xbb10('0x4d')],null))['then'](respondWithResult(_0x3d0cb7,null))[_0xbb10('0x1f')](handleError(_0x3d0cb7,null));};exports[_0xbb10('0x2a')]=function(_0x4917a5,_0x5e03cb){return db['ChatWebsite'][_0xbb10('0x56')]({'where':{'id':_0x4917a5[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5e03cb,null))['then'](removeEntity(_0x5e03cb,null))['catch'](handleError(_0x5e03cb,null));};exports['describe']=function(_0x3ebc5f,_0x249b33){return db[_0xbb10('0x31')]['describe']()[_0xbb10('0x15')](respondWithResult(_0x249b33,null))[_0xbb10('0x1f')](handleError(_0x249b33,null));};exports['addDisposition']=function(_0x4a560c,_0x27d7b9){if(_0x4a560c[_0xbb10('0x4d')]['id']){delete _0x4a560c[_0xbb10('0x4d')]['id'];}return db[_0xbb10('0x31')]['find']({'where':{'id':_0x4a560c[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x27d7b9,null))[_0xbb10('0x15')](function(_0x5202d7){if(_0x5202d7){_0x4a560c[_0xbb10('0x4d')][_0xbb10('0x59')]=_0x5202d7['id'];return db[_0xbb10('0x5a')]['create'](_0x4a560c[_0xbb10('0x4d')]);}})[_0xbb10('0x15')](respondWithResult(_0x27d7b9,null))[_0xbb10('0x1f')](handleError(_0x27d7b9,null));};exports[_0xbb10('0x5b')]=function(_0x5e4a6e,_0x251417){var _0x258e55={'raw':![],'where':{}};var _0x108e5b={};var _0x2d0f4b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x5e4a6e[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x251417,null))[_0xbb10('0x15')](function(_0x12f750){if(_0x12f750){_0x108e5b[_0xbb10('0x35')]=_[_0xbb10('0x36')](db['Disposition']['rawAttributes']);_0x108e5b['query']=_[_0xbb10('0x36')](_0x5e4a6e[_0xbb10('0x37')]);_0x108e5b[_0xbb10('0x38')]=_['intersection'](_0x108e5b['model'],_0x108e5b[_0xbb10('0x37')]);_0x258e55[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x108e5b[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x5e4a6e[_0xbb10('0x37')]['fields']));_0x258e55[_0xbb10('0x39')]=_0x258e55[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x258e55[_0xbb10('0x39')]:_0x108e5b[_0xbb10('0x35')];if(!_0x5e4a6e['query']['hasOwnProperty']('nolimit')){_0x258e55[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x27')]);_0x258e55[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x5e4a6e['query'][_0xbb10('0x24')]);}_0x258e55['order']=qs['sort'](_0x5e4a6e['query'][_0xbb10('0x3f')]);_0x258e55[_0xbb10('0x41')]=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x5e4a6e['query'],_0x108e5b[_0xbb10('0x38')]));_0x258e55['where']['ChatWebsiteId']=_0x12f750['id'];if(_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x44')]){_0x258e55[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x258e55[_0xbb10('0x41')],{'$or':_['map'](_0x258e55[_0xbb10('0x39')],function(_0x19fcec){var _0x2c6429={};_0x2c6429[_0x19fcec]={'$like':'%'+_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x2c6429;})});}_0x258e55=_[_0xbb10('0x42')]({},_0x258e55,_0x5e4a6e[_0xbb10('0x45')]);return db['Disposition'][_0xbb10('0x26')]({'where':_0x258e55[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x322b41){_0x2d0f4b[_0xbb10('0x26')]=_0x322b41;if(_0x5e4a6e[_0xbb10('0x37')][_0xbb10('0x46')]){_0x258e55[_0xbb10('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0xbb10('0x47')](_0x258e55);})[_0xbb10('0x15')](function(_0x145baf){_0x2d0f4b['rows']=_0x145baf;return _0x2d0f4b;});}})['then'](respondWithFilteredResult(_0x251417,_0x258e55))['catch'](handleError(_0x251417,null));};exports[_0xbb10('0x5d')]=function(_0x5a3c44,_0x4e3d6a){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5a3c44[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x4e3d6a,null))[_0xbb10('0x15')](function(_0x24dca6){if(_0x24dca6){return _0x24dca6[_0xbb10('0x5d')](_0x5a3c44[_0xbb10('0x37')][_0xbb10('0x5e')]);}})['then'](respondWithStatusCode(_0x4e3d6a,null))[_0xbb10('0x1f')](handleError(_0x4e3d6a,null));};exports[_0xbb10('0x5f')]=function(_0x46b6d2,_0x35b811){if(_0x46b6d2['body']['id']){delete _0x46b6d2['body']['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x46b6d2[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x35b811,null))['then'](function(_0x17d596){if(_0x17d596){_0x46b6d2[_0xbb10('0x4d')][_0xbb10('0x59')]=_0x17d596['id'];return db[_0xbb10('0x60')][_0xbb10('0x4c')](_0x46b6d2['body']);}})['then'](respondWithResult(_0x35b811,null))[_0xbb10('0x1f')](handleError(_0x35b811,null));};exports[_0xbb10('0x61')]=function(_0x22c030,_0x5239da){var _0x256b35={'raw':![],'where':{}};var _0x13e2ab={};var _0x50bcc9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x22c030[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5239da,null))['then'](function(_0x32d5a5){if(_0x32d5a5){_0x13e2ab[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x60')][_0xbb10('0x32')]);_0x13e2ab[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x22c030[_0xbb10('0x37')]);_0x13e2ab[_0xbb10('0x38')]=_['intersection'](_0x13e2ab[_0xbb10('0x35')],_0x13e2ab[_0xbb10('0x37')]);_0x256b35[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x13e2ab[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x22c030[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x256b35[_0xbb10('0x39')]=_0x256b35[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x256b35[_0xbb10('0x39')]:_0x13e2ab['model'];if(!_0x22c030['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x256b35[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x22c030[_0xbb10('0x37')]['limit']);_0x256b35[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x22c030[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x256b35[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x22c030['query'][_0xbb10('0x3f')]);_0x256b35[_0xbb10('0x41')]=qs['filters'](_[_0xbb10('0x40')](_0x22c030['query'],_0x13e2ab[_0xbb10('0x38')]));_0x256b35[_0xbb10('0x41')][_0xbb10('0x59')]=_0x32d5a5['id'];if(_0x22c030[_0xbb10('0x37')][_0xbb10('0x44')]){_0x256b35['where']=_[_0xbb10('0x42')](_0x256b35['where'],{'$or':_[_0xbb10('0x30')](_0x256b35[_0xbb10('0x39')],function(_0x5d767f){var _0x5aaa20={};_0x5aaa20[_0x5d767f]={'$like':'%'+_0x22c030[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x5aaa20;})});}_0x256b35=_[_0xbb10('0x42')]({},_0x256b35,_0x22c030[_0xbb10('0x45')]);return db[_0xbb10('0x60')][_0xbb10('0x26')]({'where':_0x256b35[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x252ab8){_0x50bcc9[_0xbb10('0x26')]=_0x252ab8;if(_0x22c030[_0xbb10('0x37')]['includeAll']){_0x256b35[_0xbb10('0x4b')]=[{'all':!![]}];}return db[_0xbb10('0x60')][_0xbb10('0x47')](_0x256b35);})[_0xbb10('0x15')](function(_0xfe02f5){_0x50bcc9[_0xbb10('0x48')]=_0xfe02f5;return _0x50bcc9;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x5239da,_0x256b35))[_0xbb10('0x1f')](handleError(_0x5239da,null));};exports[_0xbb10('0x62')]=function(_0x18a136,_0x1c4235){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x18a136[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x1c4235,null))[_0xbb10('0x15')](function(_0x3675cd){if(_0x3675cd){return _0x3675cd[_0xbb10('0x62')](_0x18a136[_0xbb10('0x37')][_0xbb10('0x5e')]);}})['then'](respondWithStatusCode(_0x1c4235,null))[_0xbb10('0x1f')](handleError(_0x1c4235,null));};exports[_0xbb10('0x63')]=function(_0x44d1d2,_0x12e89d){_0x44d1d2[_0xbb10('0x4d')][_0xbb10('0x64')]=_0x44d1d2['file']['filename'];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x44d1d2[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x12e89d,null))[_0xbb10('0x15')](saveUpdates(_0x44d1d2[_0xbb10('0x4d')],null))['then'](respondWithResult(_0x12e89d,null))[_0xbb10('0x1f')](handleError(_0x12e89d,null));};exports[_0xbb10('0x65')]=function(_0x5642c3,_0xdd3c7e){_0x5642c3['body'][_0xbb10('0x66')]=_0x5642c3[_0xbb10('0x67')]['filename'];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5642c3['params']['id']}})['then'](handleEntityNotFound(_0xdd3c7e,null))[_0xbb10('0x15')](saveUpdates(_0x5642c3[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0xdd3c7e,null))[_0xbb10('0x1f')](handleError(_0xdd3c7e,null));};exports[_0xbb10('0x68')]=function(_0x4c3bdc,_0xe7c0a3){_0x4c3bdc[_0xbb10('0x4d')][_0xbb10('0x69')]=_0x4c3bdc['file'][_0xbb10('0x6a')];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x4c3bdc[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0xe7c0a3,null))[_0xbb10('0x15')](saveUpdates(_0x4c3bdc[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0xe7c0a3,null))[_0xbb10('0x1f')](handleError(_0xe7c0a3,null));};exports['addSystemAvatar']=function(_0x4fc544,_0x37e40c){_0x4fc544[_0xbb10('0x4d')][_0xbb10('0x6b')]=_0x4fc544[_0xbb10('0x67')][_0xbb10('0x6a')];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x4fc544[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x37e40c,null))[_0xbb10('0x15')](saveUpdates(_0x4fc544[_0xbb10('0x4d')],null))[_0xbb10('0x15')](respondWithResult(_0x37e40c,null))[_0xbb10('0x1f')](handleError(_0x37e40c,null));};exports['getLogo']=function(_0x1e022d,_0x123587){var _0x24076a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x6e'));var _0x4258fc={'where':{'id':_0x1e022d[_0xbb10('0x57')]['id']},'attributes':['id',_0xbb10('0x64')],'raw':!![]};var _0x3c92f4=![];return require(_0xbb10('0x6f'))['getLicense']()[_0xbb10('0x15')](function(_0x5e1ac5){if(_0x5e1ac5){_0x3c92f4=_0x5e1ac5[_0xbb10('0x70')];}})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')](_0x4258fc);})[_0xbb10('0x15')](handleEntityNotFound(_0x123587,null))[_0xbb10('0x15')](function(_0x4e9cad){if(_0x4e9cad){if(!_[_0xbb10('0x71')](_0x4e9cad['sitepic'])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x73'),_0x4e9cad[_0xbb10('0x64')]))&&_0x3c92f4){_0x24076a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x73'),_0x4e9cad[_0xbb10('0x64')]);}}return _0x123587[_0xbb10('0x74')](_0x24076a);}})[_0xbb10('0x1f')](handleError(_0x123587,null));};exports[_0xbb10('0x75')]=function(_0x589565,_0x3696b3){var _0x516520=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x76'));var _0x7673a0={'where':{'id':_0x589565[_0xbb10('0x57')]['id']},'attributes':['id',_0xbb10('0x66')],'raw':!![]};return db[_0xbb10('0x31')]['find'](_0x7673a0)[_0xbb10('0x15')](handleEntityNotFound(_0x3696b3,null))['then'](function(_0x51063a){if(_0x51063a){if(!_[_0xbb10('0x71')](_0x51063a[_0xbb10('0x66')])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x51063a['agentAvatar']))){_0x516520=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x51063a[_0xbb10('0x66')]);}}return _0x3696b3[_0xbb10('0x74')](_0x516520);}})[_0xbb10('0x1f')](handleError(_0x3696b3,null));};exports['getCustomerAvatar']=function(_0xdfdc42,_0x4093a4){var _0xb7c454=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x78'));var _0x2764e1={'where':{'id':_0xdfdc42['params']['id']},'attributes':['id',_0xbb10('0x69'),'showCustomerAvatar'],'raw':!![]};return db[_0xbb10('0x31')]['find'](_0x2764e1)['then'](handleEntityNotFound(_0x4093a4,null))[_0xbb10('0x15')](function(_0x225064){if(_0x225064){if(!_[_0xbb10('0x71')](_0x225064[_0xbb10('0x69')])){if(fs[_0xbb10('0x72')](path['join'](config[_0xbb10('0x6d')],'server/files/images/avatars/',_0x225064['customerAvatar']))&&_0x225064['showCustomerAvatar']){_0xb7c454=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x225064[_0xbb10('0x69')]);}}return _0x4093a4[_0xbb10('0x74')](_0xb7c454);}})['catch'](handleError(_0x4093a4,null));};exports[_0xbb10('0x79')]=function(_0x42a2d7,_0x352de4){var _0x1bd1c1=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x7a'));var _0x485c1a={'where':{'id':_0x42a2d7['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xbb10('0x31')][_0xbb10('0x56')](_0x485c1a)[_0xbb10('0x15')](handleEntityNotFound(_0x352de4,null))[_0xbb10('0x15')](function(_0x25cba1){if(_0x25cba1){if(!_[_0xbb10('0x71')](_0x25cba1[_0xbb10('0x6b')])){if(fs[_0xbb10('0x72')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],'server/files/images/avatars/',_0x25cba1['systemAvatar']))){_0x1bd1c1=path['join'](config[_0xbb10('0x6d')],_0xbb10('0x77'),_0x25cba1[_0xbb10('0x6b')]);}}return _0x352de4['download'](_0x1bd1c1);}})[_0xbb10('0x1f')](handleError(_0x352de4,null));};exports[_0xbb10('0x7b')]=function(_0x2c638d,_0x290280){var _0x2a6589=require(_0xbb10('0x7c'));var _0x485f46=new _0x2a6589();var _0x57fe03=_0x485f46[_0xbb10('0x7d')](_0x2c638d['headers'][_0xbb10('0x7e')])[_0xbb10('0x7f')]();var _0x152ca9={'body':_0x2c638d[_0xbb10('0x4d')],'channel':_0xbb10('0x80')};var _0x2dfa04=[];var _0x13a29e=[];var _0x1388f6={};var _0xd3c2c8=![];return db[_0xbb10('0x81')]['describe']()[_0xbb10('0x15')](function(_0x5a9277){if(!_0x5a9277){throw new db[(_0xbb10('0x82'))]['ValidationError'](_0xbb10('0x83'));}_0x2dfa04=_[_0xbb10('0x84')](_[_0xbb10('0x36')](_0x5a9277),[_0xbb10('0x85'),'updatedAt']);_0x13a29e=_[_0xbb10('0x84')](_['keys'](_0x5a9277),[_0xbb10('0x85'),_0xbb10('0x86'),_0xbb10('0x87'),'ListId']);if(_0x2c638d[_0xbb10('0x4d')]['id']){delete _0x2c638d[_0xbb10('0x4d')]['id'];}if(_[_0xbb10('0x71')](_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')])){throw new db[(_0xbb10('0x82'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x2c638d[_0xbb10('0x4d')]['body'])||_0x2c638d[_0xbb10('0x4d')]['body']===''){throw new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))](_0xbb10('0x8a'));}if(_['isNil'](_0x2c638d['body'][_0xbb10('0x8b')])){throw new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a29e);}if(!_[_0xbb10('0x8c')](_0x13a29e,_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x8b')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a29e);}_0x1388f6[_0x2c638d[_0xbb10('0x4d')]['mapKey']]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')];})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x2c638d[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x8d')],'as':_0xbb10('0x8e'),'include':[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0x8f'),'where':_0x1388f6,'limit':0x1,'order':[[_0xbb10('0x86'),'DESC']]}]},{'model':db[_0xbb10('0x90')],'as':_0xbb10('0x91')}]});})['then'](handleEntityNotFound(_0x290280,null))[_0xbb10('0x15')](function(_0x5e3fac){if(_0x5e3fac&&_0x5e3fac['List']){_0x152ca9[_0xbb10('0x92')]=_0x5e3fac;_0x152ca9[_0xbb10('0x93')]=_0x5e3fac[_0xbb10('0x91')];_0x152ca9[_0xbb10('0x94')]=_0x5e3fac[_0xbb10('0x8e')];_0x152ca9['applications']=_[_0xbb10('0x95')](_0x152ca9[_0xbb10('0x93')],['priority'],[_0xbb10('0x96')]);if(_0x152ca9[_0xbb10('0x92')]['Applications']){delete _0x152ca9[_0xbb10('0x92')]['Applications'];}if(_0x152ca9[_0xbb10('0x92')][_0xbb10('0x8e')]&&_0x152ca9[_0xbb10('0x92')][_0xbb10('0x8e')][_0xbb10('0x8f')][_0xbb10('0x3b')]){return _0x152ca9[_0xbb10('0x92')]['List'][_0xbb10('0x8f')][0x0];}var _0x4720a1=_[_0xbb10('0x97')](_0x2c638d[_0xbb10('0x4d')],{'firstName':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')],'ListId':_0x5e3fac['ListId']});_0x4720a1[_0x2c638d['body']['mapKey']]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x88')];return db[_0xbb10('0x81')][_0xbb10('0x4c')](_0x4720a1,{'fields':_0x2dfa04,'raw':!![]});}})['then'](handleEntityNotFound(_0x290280,null))[_0xbb10('0x15')](function(_0x3d7b4d){_0x152ca9[_0xbb10('0x98')]=_0x3d7b4d;var _0x577d27=_0x2c638d['body'][_0xbb10('0x99')];if(_0x2c638d['headers'][_0xbb10('0x9a')]){_0x577d27=_0x2c638d[_0xbb10('0x9b')][_0xbb10('0x9a')];}else if(_0x2c638d[_0xbb10('0x9b')][_0xbb10('0x9c')]){_0x577d27=_[_0xbb10('0x9d')](_0x2c638d[_0xbb10('0x9b')]['x-forwarded-for'][_0xbb10('0x9e')](','));}if(_0x3d7b4d){var _0x1eca6c={'ContactId':_0x3d7b4d['id'],'ChatWebsiteId':_0x2c638d['params']['id'],'from':(_0x3d7b4d[_0xbb10('0x9f')]||'')+'\x20'+(_0x3d7b4d[_0xbb10('0xa0')]||''),'customerIp':_0x577d27,'customerPort':_0x2c638d[_0xbb10('0x9b')]['x-real-port']?_0x2c638d['headers']['x-real-port']:null,'referer':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa1')],'browserName':_0x57fe03['browser'][_0xbb10('0x2e')]&&_0x57fe03[_0xbb10('0xa2')][_0xbb10('0xa3')]?util[_0xbb10('0xa4')](_0xbb10('0xa5'),_0x57fe03[_0xbb10('0xa2')][_0xbb10('0x2e')],_0x57fe03['browser'][_0xbb10('0xa3')]):'unknown','browserVersion':_0x57fe03['browser']['version']||_0xbb10('0xa6'),'osName':util[_0xbb10('0xa4')]('%s\x20%s',_0x57fe03['os'][_0xbb10('0x2e')],_0x57fe03['os']['version']),'osVersion':_0x57fe03['os'][_0xbb10('0xa3')],'deviceModel':_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x35')]&&_0x57fe03['device']['vendor']?util[_0xbb10('0xa4')]('%s\x20%s\x20%s',_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x35')],_0x57fe03['device']['vendor'],_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x43')]):null,'deviceVendor':_0x57fe03[_0xbb10('0xa7')]['vendor'],'deviceType':_0x57fe03[_0xbb10('0xa7')][_0xbb10('0x43')],'formData':JSON[_0xbb10('0x1b')](_0x2c638d['body'])};var _0x414066={'ChatWebsiteId':_0x2c638d[_0xbb10('0x57')]['id'],'closed':![]};if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')]){_0x414066[_0xbb10('0xa8')]=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')];return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':_0x414066})[_0xbb10('0x15')](function(_0x10ca4a){if(_0x10ca4a){return[_0x10ca4a,![]];}_0x1eca6c[_0xbb10('0xa8')]=_0x2c638d[_0xbb10('0x4d')]['threadId'];_0x1eca6c['externalUrl']=_0x2c638d[_0xbb10('0x4d')]['externalUrl'];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1eca6c)[_0xbb10('0x15')](function(_0x4e5236){return[_0x4e5236,!![]];});});}_0x414066[_0xbb10('0xaa')]=_0x3d7b4d['id'];if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xab')]&&_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xab')]['id']){_0x414066['id']=_0x2c638d['body'][_0xbb10('0xab')]['id'];return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':_0x414066})[_0xbb10('0x15')](function(_0x150d4c){if(_0x150d4c){return[_0x150d4c,![]];}return db[_0xbb10('0xa9')]['create'](_0x1eca6c)[_0xbb10('0x15')](function(_0x2f0262){return[_0x2f0262,!![]];});});}return db['ChatInteraction'][_0xbb10('0x4c')](_0x1eca6c)[_0xbb10('0x15')](function(_0x2d0de5){return[_0x2d0de5,!![]];});}})[_0xbb10('0xac')](function(_0x3abc15,_0x43df3c){if(_0x3abc15){_0xd3c2c8=_0x43df3c;if(!_0x43df3c){var _0x45593c={'from':(_0x152ca9[_0xbb10('0x98')][_0xbb10('0x9f')]||'')+'\x20'+(_0x152ca9[_0xbb10('0x98')][_0xbb10('0xa0')]||'')};if(_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xa8')]&&_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xad')]&&_0x2c638d['body'][_0xbb10('0xa8')]!=_0x2c638d[_0xbb10('0x4d')]['messageId']){_0x45593c['threadId']=_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xad')];}return _0x3abc15[_0xbb10('0x55')](_0x45593c);}else{return _0x3abc15;}}})[_0xbb10('0x15')](function(_0x27fb82){_0x152ca9[_0xbb10('0xab')]=_0x27fb82[_0xbb10('0x2b')]({'plain':!![]});_0x152ca9[_0xbb10('0xab')][_0xbb10('0xae')]=_0xd3c2c8;if(_0x152ca9['interaction']['created']){if(_0x152ca9['account']['autoclose']){_0x152ca9['applications']['push']({'id':0x0,'priority':_0x152ca9[_0xbb10('0x93')][_0xbb10('0x3b')]+0x1,'app':_0xbb10('0xaf'),'appdata':_0xbb10('0xb0'),'interval':'*,*,*,*'});}}return db[_0xbb10('0xb1')][_0xbb10('0x4c')]({'body':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0x4d')],'ChatWebsiteId':_0x2c638d['params']['id'],'ChatInteractionId':_0x27fb82['id'],'direction':'in','ContactId':_0x152ca9['contact']['id'],'AttachmentId':_0x2c638d[_0xbb10('0x4d')][_0xbb10('0xb2')]});})['then'](function(_0x581832){_0x152ca9[_0xbb10('0x1e')]=_0x581832;if(_0x152ca9[_0xbb10('0xab')][_0xbb10('0xb3')]){return db[_0xbb10('0xb4')][_0xbb10('0x56')]({'attributes':['id','name'],'where':{'id':_0x152ca9[_0xbb10('0xab')]['UserId']}})['then'](function(_0x9d96e2){if(_0x9d96e2){_0x152ca9[_0xbb10('0x93')][_0xbb10('0xb5')]({'id':0x0,'priority':0x0,'app':_0xbb10('0xb6'),'appdata':_0x9d96e2[_0xbb10('0x2e')]+','+(_0x152ca9[_0xbb10('0x92')]['waitForTheAssignedAgent']||0xa),'interval':_0xbb10('0xb7')});_0x152ca9[_0xbb10('0xb8')]=!![];}return respondWithRpcPromise(_0xbb10('0xb9'),_0xbb10('0xba'),_0x152ca9);});}return respondWithRpcPromise(_0xbb10('0xb9'),_0xbb10('0xba'),_0x152ca9);})[_0xbb10('0x15')](function(_0xce60f4){respondWithRpcPromise(_0xbb10('0xbb'),_0xbb10('0xbb'),{'event':_0xbb10('0x7b'),'message':_0xce60f4},client9002);return _0xce60f4;})[_0xbb10('0x15')](respondWithResult(_0x290280,null))[_0xbb10('0x1f')](handleError(_0x290280,null));};exports[_0xbb10('0xbc')]=function(_0x45b31c,_0x3cf074){var _0x232a1b,_0xbdc520,_0x246ee3;var _0x43a203=[];var _0x1ca43e={};var _0x1f84b0=_0x45b31c['files']||[];var _0x2158e2=[];var _0x47883f;return db[_0xbb10('0x81')][_0xbb10('0xbd')]()[_0xbb10('0x15')](function(_0x2b1f0f){if(!_0x2b1f0f){throw new db[(_0xbb10('0x82'))]['ValidationError']('no\x20available\x20attributes');}_0x43a203=_['difference'](_[_0xbb10('0x36')](_0x2b1f0f),[_0xbb10('0x85'),'updatedAt',_0xbb10('0x87'),_0xbb10('0xbe')]);if(_0x45b31c[_0xbb10('0x4d')]['id']){delete _0x45b31c['body']['id'];}if(_[_0xbb10('0x71')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x88')])){throw _0x3cf074['status'](0x1f4)[_0xbb10('0xbf')](new db['Sequelize'][(_0xbb10('0x89'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x45b31c['body']['body'])||_0x45b31c['body']['body']===''){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xbb10('0x71')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0xc0')])){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))][(_0xbb10('0x89'))](_0xbb10('0xc1')+_0x43a203));}if(!_[_0xbb10('0x8c')](_0x43a203,_0x45b31c[_0xbb10('0x4d')]['mapKeyOffline'])){throw _0x3cf074[_0xbb10('0x21')](0x1f4)[_0xbb10('0xbf')](new db[(_0xbb10('0x82'))]['ValidationError'](_0xbb10('0xc2')+_0x43a203));}_0x1ca43e[_0x45b31c[_0xbb10('0x4d')][_0xbb10('0xc0')]]=_0x45b31c[_0xbb10('0x4d')]['from'];})[_0xbb10('0x15')](function(){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x45b31c[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x8d')],'as':_0xbb10('0x8e')},{'model':db[_0xbb10('0xc3')],'as':_0xbb10('0xc3')}]});})[_0xbb10('0x15')](handleEntityNotFound(_0x3cf074,null))[_0xbb10('0x15')](function(_0x3c01ff){if(_0x3c01ff&&_0x3c01ff['List']){_0xbdc520=_0x3c01ff;var _0x59d917=_[_0xbb10('0x97')](_0x45b31c['body'],{'firstName':_0x45b31c['body'][_0xbb10('0x88')],'phone':_0x45b31c[_0xbb10('0x4d')]['from'],'ListId':_0x3c01ff[_0xbb10('0xbe')]});_0x59d917[_0x45b31c[_0xbb10('0x4d')]['mapKeyOffline']]=_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x88')];return db[_0xbb10('0x81')][_0xbb10('0xc4')]({'where':_0x1ca43e,'defaults':_0x59d917});}})[_0xbb10('0xac')](function(_0x4d2c76){if(_0x4d2c76){_0x246ee3=_0x4d2c76;var _0x4fc260=fs['readFileSync'](path[_0xbb10('0x6c')](config['root'],_0xbb10('0xc5')),'utf8');var _0x510467=ejs[_0xbb10('0xc6')](_0x4fc260,{'body':_[_0xbb10('0xc7')](_0x45b31c[_0xbb10('0x4d')][_0xbb10('0x4d')]),'bodyTitle':_0xbdc520[_0xbb10('0xc8')]});return db[_0xbb10('0xc9')]['create']({'body':_0x510467,'plainBody':htmlToText['fromString'](_0x510467),'ContactId':_0x4d2c76['id'],'ChatWebsiteId':_0xbdc520['id']});}})['then'](function(_0x5ad067){_0x47883f=_0x5ad067;if(_0x1f84b0[_0xbb10('0x3b')]){var _0x18632f=_0x1f84b0[_0xbb10('0x30')](function(_0x26bc1c){return{'name':_0x26bc1c[_0xbb10('0xca')],'basename':_0x26bc1c[_0xbb10('0x6a')],'type':_0x26bc1c['mimetype'],'ChatOfflineMessageId':_0x5ad067['id']};});_0x2158e2=_0x18632f[_0xbb10('0x30')](_0x207bbb=>{var _0x35586a={'filename':_0x207bbb[_0xbb10('0x2e')],'path':path['join'](config[_0xbb10('0x6d')],'server','files',_0xbb10('0xcb'),_0xbb10('0xcc'),_0x207bbb[_0xbb10('0xcd')])};return _0x35586a;});if(!_0xbdc520[_0xbb10('0xce')]){return db[_0xbb10('0xcf')][_0xbb10('0xd0')](function(_0x4b7bf8){return db[_0xbb10('0xd1')][_0xbb10('0xd2')](_0x18632f,{'transaction':_0x4b7bf8});});}}})[_0xbb10('0x15')](function(){if(_0x47883f){_0x232a1b=_0x47883f;return db[_0xbb10('0xc3')][_0xbb10('0x5c')]({'where':{'active':!![]},'include':[{'model':db[_0xbb10('0xd3')],'as':_0xbb10('0xd4'),'raw':!![]}]});}})['then'](function(_0x2cbbb6){if(_0x2cbbb6&&_0x2cbbb6[_0xbb10('0xd4')]&&_0xbdc520[_0xbb10('0xd5')]&&_0xbdc520['forwardOfflineAddress']){var _0x595664={'tls':{'rejectUnauthorized':![]}};if(_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd6')]){_0x595664[_0xbb10('0xd6')]=_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd6')];}else{_0x595664[_0xbb10('0xd7')]=_0x2cbbb6[_0xbb10('0xd4')]['host'];_0x595664[_0xbb10('0xd8')]=_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0xd8')];_0x595664['secure']=_0x2cbbb6['Smtp']['secure'];}if(_0x2cbbb6['Smtp'][_0xbb10('0xd9')]){_0x595664[_0xbb10('0xda')]={'user':_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0x4e')],'pass':_0x2cbbb6['Smtp'][_0xbb10('0xdb')]};}return respondWithRpcPromise('SendMail',_0xbb10('0xdc'),{'account':_0x595664,'message':{'from':util[_0xbb10('0xa4')](_0xbb10('0xdd'),_0x2cbbb6[_0xbb10('0x2e')],_0x2cbbb6[_0xbb10('0xde')]||_0x2cbbb6[_0xbb10('0xd4')][_0xbb10('0x4e')]),'to':_0xbdc520[_0xbb10('0xdf')],'subject':_0xbdc520[_0xbb10('0xe0')],'html':_0x232a1b[_0xbb10('0x4d')],'attachments':_0x2158e2}},client9003)[_0xbb10('0x15')](function(){return _0x232a1b;})[_0xbb10('0x1f')](function(_0x4c969d){console[_0xbb10('0x1c')](_0x4c969d);});}})[_0xbb10('0x15')](function(){if(_0xbdc520&&_0xbdc520[_0xbb10('0xce')]&&_0xbdc520['MailAccountId']){var _0x204ebf=[];if(_0x1f84b0['length']){_0x204ebf=_0x1f84b0[_0xbb10('0x30')](function(_0x446bcf){return{'name':_0x446bcf[_0xbb10('0xca')],'basename':_0x446bcf[_0xbb10('0x6a')],'type':_0x446bcf[_0xbb10('0xe1')],'ChatOfflineMessageId':_0x47883f['id']};});}var _0x533327;if(!_['isNil'](_0xbdc520[_0xbb10('0xe2')])){var _0x4cf5cc=_['map'](_0x45b31c[_0xbb10('0x4d')],function(_0x5621b1){return _0x5621b1;});var _0xa9ed32=_[_0xbb10('0xe3')](_0x4cf5cc)[0x0];var _0x3f0a4e=_[_0xbb10('0xe4')](_0xa9ed32,function(_0x309b4a){return _0x309b4a;});_0x533327=_0x3f0a4e[0x1][_0xbdc520[_0xbb10('0xe2')]];}var _0x3a0940={'from':_0x246ee3[_0xbb10('0xde')],'firstName':_0x246ee3['firstName'],'lastName':_0x246ee3[_0xbb10('0xa0')],'mapKey':'email','message':{'from':_0x246ee3[_0xbb10('0xde')],'to':_0xbdc520['MailAccount'][_0xbb10('0xde')],'cc':'','subject':_[_0xbb10('0x71')](_0x533327)?_0xbdc520['offlineMessageSubject']:_0x533327,'messageId':'','sentAt':new Date(),'attach':_0x204ebf[_0xbb10('0x3b')],'attachments':_0x204ebf,'originChannel':_0xbb10('0xe5'),'ChatWebsiteId':_0xbdc520['id'],'ChatOfflineMessageId':_0x232a1b['id'],'originTo':_0xbdc520[_0xbb10('0xc3')]['email']},'body':_0x232a1b[_0xbb10('0x4d')]};var _0x1a8503={'account':{'id':_0xbdc520[_0xbb10('0xe6')]},'body':_0x3a0940,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xbb10('0xe7'),_0xbb10('0xe8'),_0x1a8503,client9001)[_0xbb10('0x15')](function(){return _0x232a1b;})['catch'](function(_0x3e6756){console['error'](_0x3e6756);});}return;})[_0xbb10('0x15')](function(){if(_0x232a1b){return _0x232a1b;}})[_0xbb10('0x15')](respondWithResult(_0x3cf074,null))[_0xbb10('0x1f')](function(_0xd94118){console[_0xbb10('0x1c')](_0xbb10('0x1f'),_0xd94118);for(var _0x23e592 of _0x1f84b0){var _0x44d28a=path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],'server','files',_0xbb10('0xcb'),_0xbb10('0xcc'),_0x23e592[_0xbb10('0x6a')]);fs_extra['remove'](_0x44d28a)[_0xbb10('0x1f')](function(_0x1067f2){console[_0xbb10('0x1c')](_0xbb10('0xe9'),_0x44d28a,_0x1067f2);});}});};exports[_0xbb10('0xea')]=function(_0x431673,_0x81d970){return db[_0xbb10('0xa9')][_0xbb10('0x56')]({'where':{'id':_0x431673['params']['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x81d970,null))[_0xbb10('0x15')](function(_0x4102af){if(_0x4102af){return _0x4102af[_0xbb10('0xea')](_0x431673['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x431673[_0xbb10('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x81d970,null))[_0xbb10('0x1f')](handleError(_0x81d970,null));};exports['getInteractions']=function(_0x37c688,_0x4874be){var _0x3fd69e={'raw':![],'where':{}};var _0x1aa860={};var _0x28cd8e={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x37c688[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x4874be,null))['then'](function(_0x20c514){if(_0x20c514){_0x1aa860[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xa9')][_0xbb10('0x32')]);_0x1aa860[_0xbb10('0x37')]=_['keys'](_0x37c688[_0xbb10('0x37')]);_0x1aa860[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x1aa860[_0xbb10('0x35')],_0x1aa860[_0xbb10('0x37')]);_0x3fd69e[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x1aa860['model'],qs[_0xbb10('0x3a')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x3fd69e['attributes']=_0x3fd69e[_0xbb10('0x39')]['length']?_0x3fd69e[_0xbb10('0x39')]:_0x1aa860[_0xbb10('0x35')];if(!_0x37c688[_0xbb10('0x37')]['hasOwnProperty']('nolimit')){_0x3fd69e[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x27')]);_0x3fd69e[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x37c688[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x3fd69e[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x37c688[_0xbb10('0x37')]['sort']);_0x3fd69e['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x37c688['query'],_0x1aa860['filters']));_0x3fd69e[_0xbb10('0x41')][_0xbb10('0x59')]=_0x20c514['id'];if(_0x37c688[_0xbb10('0x37')]['filter']){_0x3fd69e[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x3fd69e['where'],{'$or':_[_0xbb10('0x30')](_0x3fd69e[_0xbb10('0x39')],function(_0x544c9c){var _0x5a5349={};_0x5a5349[_0x544c9c]={'$like':'%'+_0x37c688[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x5a5349;})});}_0x3fd69e=_[_0xbb10('0x42')]({},_0x3fd69e,_0x37c688['options']);return db['ChatInteraction'][_0xbb10('0x26')]({'where':_0x3fd69e[_0xbb10('0x41')]})['then'](function(_0x1e9dd2){_0x28cd8e[_0xbb10('0x26')]=_0x1e9dd2;if(_0x37c688['query'][_0xbb10('0x46')]){_0x3fd69e[_0xbb10('0x4b')]=[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0xec'),'required':![]},{'model':db['User'],'as':_0xbb10('0xed'),'attributes':['name',_0xbb10('0xee'),_0xbb10('0xef')],'required':![]},{'model':db[_0xbb10('0xf0')],'as':_0xbb10('0xf1'),'attributes':['id',_0xbb10('0x2e'),_0xbb10('0xf2')],'where':_0x37c688[_0xbb10('0x37')][_0xbb10('0xf3')]?{'id':_0x37c688['query'][_0xbb10('0xf3')]}:undefined,'required':_0x37c688[_0xbb10('0x37')][_0xbb10('0xf3')]?!![]:![]}];}return db[_0xbb10('0xa9')]['findAll'](_0x3fd69e);})['then'](function(_0xd23108){_0x28cd8e[_0xbb10('0x48')]=_0xd23108;return _0x28cd8e;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x4874be,_0x3fd69e))[_0xbb10('0x1f')](handleError(_0x4874be,null));};function iftimePromise(_0x5b2e0b,_0x215028){return respondWithRpcPromise(_0xbb10('0xf4'),'getSnippet',{'command':_0x215028[_0xbb10('0xf5')]?util['format']('iftime\x20%s,%s',_0x5b2e0b[_0xbb10('0xf6')],_0x215028[_0xbb10('0xf5')]):util[_0xbb10('0xa4')](_0xbb10('0xf7'),_0x5b2e0b[_0xbb10('0xf6')])},client9002)['then'](function(_0x38403e){var _0x262078=_0x38403e&&_0x38403e[_0xbb10('0xf8')](_0xbb10('0xf9'))>=0x0?!![]:![];logger[_0xbb10('0x16')](_0xbb10('0xfa'),_0x215028['id'],_0x5b2e0b['id'],_0x5b2e0b[_0xbb10('0xf6')],_0x262078?_0xbb10('0xfb'):_0xbb10('0xfc'),_0x215028[_0xbb10('0xf5')]?_0x215028[_0xbb10('0xf5')]:_0xbb10('0xfd'));return _0x262078;})[_0xbb10('0x1f')](function(_0x9fcc26){logger[_0xbb10('0x1c')](_0xbb10('0xfa'),_0x215028['id'],_0x5b2e0b['id'],_0x5b2e0b[_0xbb10('0xf6')],util[_0xbb10('0xfe')](_0x9fcc26,{'showHidden':![],'depth':null}),_0x215028[_0xbb10('0xf5')]?_0x215028[_0xbb10('0xf5')]:_0xbb10('0xfd'));return![];});}exports[_0xbb10('0xff')]=function(_0x1b4873,_0x1ca72c){var _0x36615e=0x0;var _0x2f38d3=0x0;var _0x5a4d21=![];var _0x57b891;var _0x19eaa2;return db[_0xbb10('0x31')]['find']({'where':{'id':_0x1b4873[_0xbb10('0x57')]['id']},'include':[{'model':db[_0xbb10('0x100')],'as':'Interval','include':[{'model':db[_0xbb10('0x100')],'as':_0xbb10('0x101'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xbb10('0x15')](handleEntityNotFound(_0x1ca72c,null))[_0xbb10('0x15')](function(_0xb4fdea){if(_0xb4fdea){_0x57b891=_0xb4fdea;return _0xb4fdea[_0xbb10('0x102')]({'raw':!![]});}})['then'](function(_0x170061){if(_0x57b891){if(_0x170061){_0x19eaa2=_0x170061;}}return require(_0xbb10('0x6f'))[_0xbb10('0x103')]();})[_0xbb10('0x15')](function(_0x5c0732){if(_0x5c0732){_0x2f38d3=_0x5c0732[_0xbb10('0x104')];_0x5a4d21=_0x5c0732[_0xbb10('0x70')];}})[_0xbb10('0x15')](function(){return db[_0xbb10('0xa9')][_0xbb10('0x26')]({'where':{'closed':![]}});})[_0xbb10('0x15')](function(_0x2f626b){_0x36615e=_0x2f626b;if(_0x2f38d3&&_0x2f626b>_0x2f38d3){return db[_0xbb10('0x105')][_0xbb10('0x5c')]({'where':{'id':0x1}})[_0xbb10('0x15')](function(_0x2fd942){if(_0x2fd942){_0x2fd942['increment'](_0xbb10('0x106'));}});}})[_0xbb10('0x15')](function(){if(_0x57b891[_0xbb10('0x100')]&&_0x57b891[_0xbb10('0x100')]['Intervals']){var _0x5116d8=[];for(var _0x8bfc0f=0x0;_0x8bfc0f<_0x57b891[_0xbb10('0x100')][_0xbb10('0x101')][_0xbb10('0x3b')];_0x8bfc0f++){var _0x5f0576=_0x57b891[_0xbb10('0x100')][_0xbb10('0x101')][_0x8bfc0f][_0xbb10('0x2b')]({'plain':!![]});_0x5116d8['push'](iftimePromise(_0x5f0576,_0x57b891));}return BPromise['all'](_0x5116d8)[_0xbb10('0x15')](function(_0xd6b33){return _['some'](_0xd6b33);});}else{return!![];}})['then'](function(_0x424bb1){var _0x615606=fs[_0xbb10('0x107')](path[_0xbb10('0x6c')](config[_0xbb10('0x6d')],_0xbb10('0x108')),'utf8');var _0x408544={'remote':_0x57b891[_0xbb10('0x109')],'query':querystring[_0xbb10('0x1b')](_[_0xbb10('0x42')](_0x57b891[_0xbb10('0x2b')]({'plain':!![]}),{'customerIp':_0x1b4873[_0xbb10('0x9b')][_0xbb10('0x9c')]||_0x1b4873[_0xbb10('0x9b')][_0xbb10('0x10a')]||_0x1b4873[_0xbb10('0x10b')]['remoteAddress']||_0x1b4873['ip'],'referer':_0x1b4873[_0xbb10('0x9b')][_0xbb10('0xa1')],'openedInteractions':_0x36615e,'maxInteractions':_0x2f38d3,'virtual':_0x5a4d21['virtual'],'online':_0x424bb1,'custom':_0x5a4d21}))['replace'](/'/g,'\x5c\x27')};_0x1ca72c['send'](ejs['render'](Mustache['render'](_0x615606,_0x408544),{'proactiveActions':_0x19eaa2,'alignment':_0x57b891['alignment'],'verticalAlignment':_0x57b891['verticalAlignment'],'div_color':_0x57b891['color'],'labelText':_0x57b891[_0xbb10('0x10c')],'text_color':_0x57b891[_0xbb10('0x10d')],'button_color':_0x57b891['color_button'],'background_color':_0x57b891[_0xbb10('0x10e')]}));})[_0xbb10('0x1f')](handleError(_0x1ca72c,null));};exports[_0xbb10('0x10f')]=function(_0x3b9bec,_0x1d099a){var _0x1d36fa=_0x3b9bec[_0xbb10('0x57')]['id'];var _0x23179d=_0x3b9bec[_0xbb10('0x4d')];var _0x14d9e7=0xc8;var _0x19dfef=null;return db[_0xbb10('0xcf')]['transaction']({'isolationLevel':db[_0xbb10('0xcf')][_0xbb10('0x110')][_0xbb10('0x111')][_0xbb10('0x112')]},function(_0x155f92){return db['ChatWebsite'][_0xbb10('0x5c')]({'where':{'id':_0x1d36fa},'transaction':_0x155f92})['then'](function(_0x52209c){if(_0x52209c){return db[_0xbb10('0x90')][_0xbb10('0x2a')]({'where':{'ChatWebsiteId':_0x1d36fa},'transaction':_0x155f92})['then'](function(){var _0x3e433b=_[_0xbb10('0x30')](_0x23179d,function(_0x201e05){_0x201e05[_0xbb10('0x59')]=_0x1d36fa;return _0x201e05;});return db[_0xbb10('0x90')]['bulkCreate'](_0x3e433b,{'transaction':_0x155f92});});}else{_0x14d9e7=0x194;_0x19dfef=[];}});})['then'](function(){if(_0x14d9e7!==0x194){return db[_0xbb10('0x90')][_0xbb10('0x113')]({'where':{'ChatWebsiteId':_0x1d36fa},'order':'priority'})[_0xbb10('0x15')](function(_0x4cf976){_0x19dfef=_0x4cf976;});}})[_0xbb10('0x1f')](function(_0x1a2f42){_0x14d9e7=0x1f4;logger[_0xbb10('0x1c')](_0x1a2f42[_0xbb10('0x2d')]);if(_0x1a2f42[_0xbb10('0x2e')]){delete _0x1a2f42[_0xbb10('0x2e')];}_0x19dfef=_0x1a2f42;})[_0xbb10('0x114')](function(){if(_0x19dfef===null){_0x1d099a['sendStatus'](_0x14d9e7);}else{if(_0x14d9e7===0x1f4){_0x1d099a[_0xbb10('0x21')](_0x14d9e7)[_0xbb10('0xbf')](_0x19dfef);}else{_0x1d099a[_0xbb10('0x21')](_0x14d9e7)[_0xbb10('0x23')](_0x19dfef);}}});};exports['getApplications']=function(_0x20347b,_0x22ffc6){var _0x530785={};var _0x49ef50={};var _0xeac82d;var _0x5a4de3;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x20347b[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x22ffc6,null))['then'](function(_0x90ab9f){if(_0x90ab9f){_0xeac82d=_0x90ab9f;_0x49ef50['model']=_[_0xbb10('0x36')](db[_0xbb10('0x90')][_0xbb10('0x32')]);_0x49ef50[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x20347b[_0xbb10('0x37')]);_0x49ef50[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x49ef50[_0xbb10('0x35')],_0x49ef50['query']);_0x530785[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x49ef50[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x20347b[_0xbb10('0x37')]['fields']));_0x530785[_0xbb10('0x39')]=_0x530785[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x530785[_0xbb10('0x39')]:_0x49ef50[_0xbb10('0x35')];_0x530785['order']=qs['sort'](_0x20347b['query'][_0xbb10('0x3f')]);_0x530785['where']=qs['filters'](_[_0xbb10('0x40')](_0x20347b['query'],_0x49ef50[_0xbb10('0x38')]));if(_0x20347b[_0xbb10('0x37')]['filter']){_0x530785[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x530785[_0xbb10('0x41')],{'$or':_[_0xbb10('0x30')](_0x530785['attributes'],function(_0x4b08b2){var _0x57abfe={};_0x57abfe[_0x4b08b2]={'$like':'%'+_0x20347b[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x57abfe;})});}_0x530785=_['merge']({},_0x530785,_0x20347b[_0xbb10('0x45')]);return _0xeac82d[_0xbb10('0x115')](_0x530785);}})[_0xbb10('0x15')](function(_0x33a92a){if(_0x33a92a){_0x5a4de3=_0x33a92a[_0xbb10('0x3b')];if(!_0x20347b['query'][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x530785[_0xbb10('0x27')]=qs['limit'](_0x20347b[_0xbb10('0x37')]['limit']);_0x530785[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x20347b[_0xbb10('0x37')]['offset']);}return _0xeac82d[_0xbb10('0x115')](_0x530785);}})[_0xbb10('0x15')](function(_0x4ba58f){if(_0x4ba58f){return _0x4ba58f?{'count':_0x5a4de3,'rows':_0x4ba58f}:null;}})[_0xbb10('0x15')](respondWithResult(_0x22ffc6,null))[_0xbb10('0x1f')](handleError(_0x22ffc6,null));};exports[_0xbb10('0x116')]=function(_0x2e03eb,_0x24e7bc){return db['chatProactiveAction']['find']({'where':{'id':_0x2e03eb[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x24e7bc,null))[_0xbb10('0x15')](function(_0x1b0734){if(_0x1b0734){return _0x1b0734[_0xbb10('0x116')](_0x2e03eb['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x2e03eb[_0xbb10('0x4d')],[_0xbb10('0x5e'),'id'])||{});}})[_0xbb10('0x15')](respondWithResult(_0x24e7bc,null))['catch'](handleError(_0x24e7bc,null));};exports['getProactiveActions']=function(_0x2f675c,_0x18f6b1){var _0x1052f5={};var _0x119e8f={};var _0x5a031b;var _0x4c8e28;return db[_0xbb10('0x31')]['findOne']({'where':{'id':_0x2f675c['params']['id']}})['then'](handleEntityNotFound(_0x18f6b1,null))['then'](function(_0x3758dd){if(_0x3758dd){_0x5a031b=_0x3758dd;_0x119e8f[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0x117')][_0xbb10('0x32')]);_0x119e8f['query']=_[_0xbb10('0x36')](_0x2f675c[_0xbb10('0x37')]);_0x119e8f[_0xbb10('0x38')]=_['intersection'](_0x119e8f[_0xbb10('0x35')],_0x119e8f[_0xbb10('0x37')]);_0x1052f5[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x119e8f[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x2f675c[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x1052f5[_0xbb10('0x39')]=_0x1052f5[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x1052f5[_0xbb10('0x39')]:_0x119e8f[_0xbb10('0x35')];_0x1052f5[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x2f675c['query']['sort']);_0x1052f5['where']=qs[_0xbb10('0x38')](_['pick'](_0x2f675c[_0xbb10('0x37')],_0x119e8f['filters']));if(_0x2f675c[_0xbb10('0x37')]['filter']){_0x1052f5['where']=_[_0xbb10('0x42')](_0x1052f5[_0xbb10('0x41')],{'$or':_['map'](_0x1052f5[_0xbb10('0x39')],function(_0x131d48){var _0x338e7a={};_0x338e7a[_0x131d48]={'$like':'%'+_0x2f675c[_0xbb10('0x37')]['filter']+'%'};return _0x338e7a;})});}_0x1052f5=_['merge']({},_0x1052f5,_0x2f675c[_0xbb10('0x45')]);return _0x5a031b[_0xbb10('0x102')](_0x1052f5);}})[_0xbb10('0x15')](function(_0x53f3c2){if(_0x53f3c2){_0x4c8e28=_0x53f3c2[_0xbb10('0x3b')];if(!_0x2f675c[_0xbb10('0x37')][_0xbb10('0x3c')]('nolimit')){_0x1052f5[_0xbb10('0x27')]=qs['limit'](_0x2f675c['query'][_0xbb10('0x27')]);_0x1052f5['offset']=qs[_0xbb10('0x24')](_0x2f675c[_0xbb10('0x37')][_0xbb10('0x24')]);}return _0x5a031b[_0xbb10('0x102')](_0x1052f5);}})[_0xbb10('0x15')](function(_0x57a6bc){if(_0x57a6bc){return _0x57a6bc?{'count':_0x4c8e28,'rows':_0x57a6bc}:null;}})[_0xbb10('0x15')](respondWithResult(_0x18f6b1,null))[_0xbb10('0x1f')](handleError(_0x18f6b1,null));};exports[_0xbb10('0x118')]=function(_0x2701e8,_0x1b0086){var _0x1c387b=_0x2701e8['query']['online']===_0xbb10('0x119')?_0xbb10('0x11a'):_0xbb10('0x11b');return db[_0xbb10('0x31')][_0xbb10('0x56')]({'attributes':['id',_0x1c387b],'where':{'id':_0x2701e8['params']['id']}})['then'](handleEntityNotFound(_0x1b0086,null))[_0xbb10('0x15')](function(_0x23cbf4){if(_0x23cbf4){var _0x536519=_0x23cbf4[_0x1c387b];var _0x50dde9=_0x536519&&_0x536519[_0xbb10('0x11c')]?_0x536519[_0xbb10('0x11c')]:[];_0x1b0086[_0xbb10('0xbf')]({'fromKey':_[_0xbb10('0x71')](_0x536519[_0xbb10('0x11d')])?undefined:_0x536519[_0xbb10('0x11d')],'count':_0x50dde9['length'],'rows':_0x50dde9});}})[_0xbb10('0x1f')](handleError(_0x1b0086,null));};exports[_0xbb10('0x11e')]=function(_0x261c9b,_0x232794){var _0x35b3f8={'raw':![],'where':{}};var _0x3783d0={};var _0xdd7d5c={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x261c9b['params']['id']}})['then'](handleEntityNotFound(_0x232794,null))['then'](function(_0x111c15){if(_0x111c15){_0x3783d0[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xc9')]['rawAttributes']);_0x3783d0['query']=_['keys'](_0x261c9b[_0xbb10('0x37')]);_0x3783d0[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x3783d0[_0xbb10('0x35')],_0x3783d0[_0xbb10('0x37')]);_0x35b3f8[_0xbb10('0x39')]=_[_0xbb10('0x4a')](_0x3783d0[_0xbb10('0x35')],qs[_0xbb10('0x3a')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x35b3f8[_0xbb10('0x39')]=_0x35b3f8[_0xbb10('0x39')][_0xbb10('0x3b')]?_0x35b3f8['attributes']:_0x3783d0[_0xbb10('0x35')];if(!_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x35b3f8[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x261c9b['query'][_0xbb10('0x27')]);_0x35b3f8[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x24')]);}_0x35b3f8[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x261c9b[_0xbb10('0x37')][_0xbb10('0x3f')]);_0x35b3f8['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x40')](_0x261c9b[_0xbb10('0x37')],_0x3783d0[_0xbb10('0x38')]));_0x35b3f8[_0xbb10('0x41')][_0xbb10('0x59')]=_0x111c15['id'];if(_0x261c9b[_0xbb10('0x37')][_0xbb10('0x44')]){_0x35b3f8[_0xbb10('0x41')]=_['merge'](_0x35b3f8[_0xbb10('0x41')],{'$or':_['map'](_0x35b3f8[_0xbb10('0x39')],function(_0x2cd1b0){var _0x57e0b2={};_0x57e0b2[_0x2cd1b0]={'$like':'%'+_0x261c9b['query'][_0xbb10('0x44')]+'%'};return _0x57e0b2;})});}_0x35b3f8=_[_0xbb10('0x42')]({},_0x35b3f8,_0x261c9b[_0xbb10('0x45')]);return db[_0xbb10('0xc9')][_0xbb10('0x26')]({'where':_0x35b3f8[_0xbb10('0x41')]})[_0xbb10('0x15')](function(_0x40a208){_0xdd7d5c[_0xbb10('0x26')]=_0x40a208;if(_0x261c9b[_0xbb10('0x37')][_0xbb10('0x46')]){_0x35b3f8[_0xbb10('0x4b')]=[{'all':!![]}];}else{_0x35b3f8[_0xbb10('0x4b')]=[{'model':db[_0xbb10('0x81')],'as':_0xbb10('0xec'),'required':![]},{'model':db['Attachment'],'as':_0xbb10('0x11f'),'required':![]}];}return db['ChatOfflineMessage'][_0xbb10('0x47')](_0x35b3f8);})[_0xbb10('0x15')](function(_0x234dc5){_0xdd7d5c[_0xbb10('0x48')]=_0x234dc5;return _0xdd7d5c;});}})[_0xbb10('0x15')](respondWithFilteredResult(_0x232794,_0x35b3f8))[_0xbb10('0x1f')](handleError(_0x232794,null));};exports[_0xbb10('0x120')]=function(_0x45dcaa,_0x5c88bd){return db['ChatWebsite']['find']({'where':{'id':_0x45dcaa[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x5c88bd,null))[_0xbb10('0x15')](function(_0x54c61c){if(_0x54c61c){return _0x54c61c[_0xbb10('0x120')](_0x45dcaa['body'][_0xbb10('0x5e')],_[_0xbb10('0xeb')](_0x45dcaa['body'],[_0xbb10('0x5e'),'id'])||{})[_0xbb10('0xac')](function(_0xa52322){for(var _0xc1691=0x0;_0xc1691<_0x45dcaa[_0xbb10('0x4d')]['ids'][_0xbb10('0x3b')];_0xc1691+=0x1){socket[_0xbb10('0x121')]('userChatWebsite:save',{'UserId':Number(_0x45dcaa[_0xbb10('0x4d')][_0xbb10('0x5e')][_0xc1691]),'ChatWebsiteId':Number(_0x45dcaa['params']['id'])});}return _0xa52322;});}})[_0xbb10('0x15')](respondWithResult(_0x5c88bd,null))[_0xbb10('0x1f')](handleError(_0x5c88bd,null));};exports[_0xbb10('0x122')]=function(_0x24f1d2,_0x481a0a){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x24f1d2[_0xbb10('0x57')]['id']}})['then'](handleEntityNotFound(_0x481a0a,null))['then'](function(_0x284b77){if(_0x284b77){return _0x284b77[_0xbb10('0x122')](_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')])['then'](function(){if(_[_0xbb10('0x123')](_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')])){for(var _0x28c680=0x0;_0x28c680<_0x24f1d2[_0xbb10('0x37')]['ids']['length'];_0x28c680+=0x1){socket[_0xbb10('0x121')](_0xbb10('0x124'),{'UserId':Number(_0x24f1d2['query']['ids'][_0x28c680]),'ChatWebsiteId':Number(_0x24f1d2[_0xbb10('0x57')]['id'])});}}else{socket[_0xbb10('0x121')](_0xbb10('0x124'),{'UserId':Number(_0x24f1d2[_0xbb10('0x37')][_0xbb10('0x5e')]),'ChatWebsiteId':Number(_0x24f1d2[_0xbb10('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x481a0a,null))['catch'](handleError(_0x481a0a,null));};exports[_0xbb10('0x125')]=function(_0x1c3cbc,_0x24bda8){var _0x27ddfc={};var _0x39a047={};var _0x9a80a7;var _0x5e08c5;return db[_0xbb10('0x31')][_0xbb10('0x5c')]({'where':{'id':_0x1c3cbc[_0xbb10('0x57')]['id']}})[_0xbb10('0x15')](handleEntityNotFound(_0x24bda8,null))['then'](function(_0x21ad98){if(_0x21ad98){_0x9a80a7=_0x21ad98;_0x39a047[_0xbb10('0x35')]=_[_0xbb10('0x36')](db[_0xbb10('0xb4')][_0xbb10('0x32')]);_0x39a047[_0xbb10('0x37')]=_[_0xbb10('0x36')](_0x1c3cbc[_0xbb10('0x37')]);_0x39a047[_0xbb10('0x38')]=_[_0xbb10('0x4a')](_0x39a047[_0xbb10('0x35')],_0x39a047[_0xbb10('0x37')]);_0x27ddfc['attributes']=_[_0xbb10('0x4a')](_0x39a047[_0xbb10('0x35')],qs['fields'](_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x3a')]));_0x27ddfc[_0xbb10('0x39')]=_0x27ddfc['attributes'][_0xbb10('0x3b')]?_0x27ddfc[_0xbb10('0x39')]:_0x39a047[_0xbb10('0x35')];_0x27ddfc[_0xbb10('0x3e')]=qs[_0xbb10('0x3f')](_0x1c3cbc[_0xbb10('0x37')]['sort']);_0x27ddfc[_0xbb10('0x41')]=qs['filters'](_[_0xbb10('0x40')](_0x1c3cbc[_0xbb10('0x37')],_0x39a047[_0xbb10('0x38')]));if(_0x1c3cbc[_0xbb10('0x37')]['filter']){_0x27ddfc[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x27ddfc['where'],{'$or':_[_0xbb10('0x30')](_0x27ddfc['attributes'],function(_0x31c086){var _0x40845c={};_0x40845c[_0x31c086]={'$like':'%'+_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x44')]+'%'};return _0x40845c;})});}_0x27ddfc=_[_0xbb10('0x42')]({},_0x27ddfc,_0x1c3cbc[_0xbb10('0x45')]);return _0x9a80a7[_0xbb10('0x125')](_0x27ddfc);}})[_0xbb10('0x15')](function(_0x55ee36){if(_0x55ee36){_0x5e08c5=_0x55ee36['length'];if(!_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x3c')](_0xbb10('0x3d'))){_0x27ddfc[_0xbb10('0x27')]=qs[_0xbb10('0x27')](_0x1c3cbc[_0xbb10('0x37')][_0xbb10('0x27')]);_0x27ddfc[_0xbb10('0x24')]=qs[_0xbb10('0x24')](_0x1c3cbc['query'][_0xbb10('0x24')]);}return _0x9a80a7['getAgents'](_0x27ddfc);}})[_0xbb10('0x15')](function(_0x2a618a){if(_0x2a618a){return _0x2a618a?{'count':_0x5e08c5,'rows':_0x2a618a}:null;}})['then'](respondWithResult(_0x24bda8,null))[_0xbb10('0x1f')](handleError(_0x24bda8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 388121c..8f38ba4 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 _0x50d0=['save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatWebsite','setMaxListeners'];(function(_0x54c889,_0x5a11e7){var _0x5c733c=function(_0x1dced5){while(--_0x1dced5){_0x54c889['push'](_0x54c889['shift']());}};_0x5c733c(++_0x5a11e7);}(_0x50d0,0x101));var _0x050d=function(_0x2dfab4,_0x5655ca){_0x2dfab4=_0x2dfab4-0x0;var _0x43d06e=_0x50d0[_0x2dfab4];return _0x43d06e;};'use strict';var EventEmitter=require(_0x050d('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x050d('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x050d('0x2')](0x0);var events={'afterCreate':_0x050d('0x3'),'afterUpdate':_0x050d('0x4'),'afterDestroy':_0x050d('0x5')};function emitEvent(_0x4d3877){return function(_0x3553e3,_0xd37556,_0x5ea985){ChatWebsiteEvents[_0x050d('0x6')](_0x4d3877+':'+_0x3553e3['id'],_0x3553e3);ChatWebsiteEvents[_0x050d('0x6')](_0x4d3877,_0x3553e3);_0x5ea985(null);};}for(var e in events){if(events[_0x050d('0x7')](e)){var event=events[e];ChatWebsite[_0x050d('0x8')](e,emitEvent(event));}}module[_0x050d('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x25b0=['events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xcee81d,_0xe79deb){var _0x2781f4=function(_0x54cc91){while(--_0x54cc91){_0xcee81d['push'](_0xcee81d['shift']());}};_0x2781f4(++_0xe79deb);}(_0x25b0,0x140));var _0x025b=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x25b0[_0x286726];return _0xcd4fe9;};'use strict';var EventEmitter=require(_0x025b('0x0'));var ChatWebsite=require(_0x025b('0x1'))['db'][_0x025b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x025b('0x3')](0x0);var events={'afterCreate':_0x025b('0x4'),'afterUpdate':_0x025b('0x5'),'afterDestroy':_0x025b('0x6')};function emitEvent(_0x1c2c48){return function(_0x86752b,_0x286601,_0x516a8d){ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48+':'+_0x86752b['id'],_0x86752b);ChatWebsiteEvents[_0x025b('0x7')](_0x1c2c48,_0x86752b);_0x516a8d(null);};}for(var e in events){if(events[_0x025b('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x025b('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ce15222..7e413f8 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 _0x88f5=['chat_websites','lodash','../../config/logger','moment','request-promise','./chatWebsite.attributes','exports','define'];(function(_0x4de33a,_0x69a771){var _0x58dbf8=function(_0x4fb9c9){while(--_0x4fb9c9){_0x4de33a['push'](_0x4de33a['shift']());}};_0x58dbf8(++_0x69a771);}(_0x88f5,0xa9));var _0x588f=function(_0x236e7c,_0x404504){_0x236e7c=_0x236e7c-0x0;var _0x5cc45d=_0x88f5[_0x236e7c];return _0x5cc45d;};'use strict';var _=require(_0x588f('0x0'));var util=require('util');var logger=require(_0x588f('0x1'))('api');var moment=require(_0x588f('0x2'));var BPromise=require('bluebird');var rp=require(_0x588f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x588f('0x4'));module[_0x588f('0x5')]=function(_0x343bf9,_0x520548){return _0x343bf9[_0x588f('0x6')]('ChatWebsite',attributes,{'tableName':_0x588f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb667=['chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','path','ChatWebsite'];(function(_0x1dfa55,_0x1d2007){var _0x893d0e=function(_0x30cace){while(--_0x30cace){_0x1dfa55['push'](_0x1dfa55['shift']());}};_0x893d0e(++_0x1d2007);}(_0xb667,0x121));var _0x7b66=function(_0x5572d5,_0x592da6){_0x5572d5=_0x5572d5-0x0;var _0x2a80fd=_0xb667[_0x5572d5];return _0x2a80fd;};'use strict';var _=require('lodash');var util=require(_0x7b66('0x0'));var logger=require(_0x7b66('0x1'))(_0x7b66('0x2'));var moment=require(_0x7b66('0x3'));var BPromise=require(_0x7b66('0x4'));var rp=require(_0x7b66('0x5'));var fs=require('fs');var path=require(_0x7b66('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x338164,_0x63779d){return _0x338164['define'](_0x7b66('0x7'),attributes,{'tableName':_0x7b66('0x8'),'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 d34b176..91bb3ef 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 _0xd494=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message'];(function(_0x15e2af,_0x21c9e0){var _0x10242f=function(_0x58b1c7){while(--_0x58b1c7){_0x15e2af['push'](_0x15e2af['shift']());}};_0x10242f(++_0x21c9e0);}(_0xd494,0xa2));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x4d49('0x0'));var moment=require(_0x4d49('0x1'));var BPromise=require(_0x4d49('0x2'));var rs=require(_0x4d49('0x3'));var fs=require('fs');var Redis=require(_0x4d49('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d49('0x5'));var logger=require(_0x4d49('0x6'))(_0x4d49('0x7'));var config=require('../../config/environment');var jayson=require(_0x4d49('0x8'));var client=jayson[_0x4d49('0x9')][_0x4d49('0xa')]({'port':0x232a});config[_0x4d49('0xb')]=_[_0x4d49('0xc')](config[_0x4d49('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d49('0xd'))(new Redis(config[_0x4d49('0xb')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x1c1cce,_0x4ec199,_0x225232){return new BPromise(function(_0xa324b8,_0x1dc972){return client[_0x4d49('0xe')](_0x1c1cce,_0x225232)['then'](function(_0x265a7f){logger[_0x4d49('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x4ec199,'request\x20sent');logger['debug'](_0x4d49('0x10'),_0x4ec199,_0x4d49('0x11'),JSON[_0x4d49('0x12')](_0x265a7f));if(_0x265a7f[_0x4d49('0x13')]){if(_0x265a7f[_0x4d49('0x13')]['code']===0x1f4){logger[_0x4d49('0x13')](_0x4d49('0x14'),_0x4ec199,_0x265a7f[_0x4d49('0x13')][_0x4d49('0x15')]);return _0x1dc972(_0x265a7f[_0x4d49('0x13')]['message']);}logger[_0x4d49('0x13')](_0x4d49('0x14'),_0x4ec199,_0x265a7f[_0x4d49('0x13')]['message']);return _0xa324b8(_0x265a7f[_0x4d49('0x13')][_0x4d49('0x15')]);}else{logger[_0x4d49('0xf')](_0x4d49('0x14'),_0x4ec199,_0x4d49('0x11'));_0xa324b8(_0x265a7f['result'][_0x4d49('0x15')]);}})[_0x4d49('0x16')](function(_0xb5588d){logger[_0x4d49('0x13')](_0x4d49('0x14'),_0x4ec199,_0xb5588d);_0x1dc972(_0xb5588d);});});} \ No newline at end of file +var _0x5bb9=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5bb9,0x18d));var _0x95bb=function(_0x138d2e,_0x336360){_0x138d2e=_0x138d2e-0x0;var _0x4e2647=_0x5bb9[_0x138d2e];return _0x4e2647;};'use strict';var _=require(_0x95bb('0x0'));var util=require(_0x95bb('0x1'));var moment=require(_0x95bb('0x2'));var BPromise=require(_0x95bb('0x3'));var rs=require(_0x95bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95bb('0x6'))(_0x95bb('0x7'));var config=require('../../config/environment');var jayson=require(_0x95bb('0x8'));var client=jayson[_0x95bb('0x9')]['http']({'port':0x232a});config[_0x95bb('0xa')]=_[_0x95bb('0xb')](config[_0x95bb('0xa')],{'host':_0x95bb('0xc'),'port':0x18eb});var socket=require(_0x95bb('0xd'))(new Redis(config[_0x95bb('0xa')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x1d8634,_0x55952b,_0x59839d){return new BPromise(function(_0x23debe,_0x4460b7){return client[_0x95bb('0xe')](_0x1d8634,_0x59839d)['then'](function(_0x23380e){logger[_0x95bb('0xf')](_0x95bb('0x10'),_0x55952b,'request\x20sent');logger[_0x95bb('0x11')](_0x95bb('0x12'),_0x55952b,_0x95bb('0x13'),JSON[_0x95bb('0x14')](_0x23380e));if(_0x23380e['error']){if(_0x23380e[_0x95bb('0x15')][_0x95bb('0x16')]===0x1f4){logger[_0x95bb('0x15')](_0x95bb('0x10'),_0x55952b,_0x23380e[_0x95bb('0x15')][_0x95bb('0x17')]);return _0x4460b7(_0x23380e[_0x95bb('0x15')][_0x95bb('0x17')]);}logger[_0x95bb('0x15')](_0x95bb('0x10'),_0x55952b,_0x23380e[_0x95bb('0x15')][_0x95bb('0x17')]);return _0x23debe(_0x23380e[_0x95bb('0x15')]['message']);}else{logger[_0x95bb('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x55952b,_0x95bb('0x13'));_0x23debe(_0x23380e[_0x95bb('0x18')]['message']);}})['catch'](function(_0x230ad7){logger[_0x95bb('0x15')](_0x95bb('0x10'),_0x55952b,_0x230ad7);_0x4460b7(_0x230ad7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2376470..11e8a7b 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 _0x3845=['length','./chatWebsite.events','update','removeListener','register'];(function(_0x1db001,_0xe4c28e){var _0x8fcb30=function(_0x58ee07){while(--_0x58ee07){_0x1db001['push'](_0x1db001['shift']());}};_0x8fcb30(++_0xe4c28e);}(_0x3845,0x10f));var _0x5384=function(_0x383d46,_0x409bc7){_0x383d46=_0x383d46-0x0;var _0x1883a6=_0x3845[_0x383d46];return _0x1883a6;};'use strict';var ChatWebsiteEvents=require(_0x5384('0x0'));var events=['save','remove',_0x5384('0x1')];function createListener(_0xe0d8df,_0x4f2b11){return function(_0x32b8f0){_0x4f2b11['emit'](_0xe0d8df,_0x32b8f0);};}function removeListener(_0x10bf68,_0x1c41bc){return function(){ChatWebsiteEvents[_0x5384('0x2')](_0x10bf68,_0x1c41bc);};}exports[_0x5384('0x3')]=function(_0xa754b8){for(var _0x3d6605=0x0,_0x57d2e5=events[_0x5384('0x4')];_0x3d6605<_0x57d2e5;_0x3d6605++){var _0x41a0ca=events[_0x3d6605];var _0x285c24=createListener('chatWebsite:'+_0x41a0ca,_0xa754b8);ChatWebsiteEvents['on'](_0x41a0ca,_0x285c24);}}; \ No newline at end of file +var _0x74c4=['update','emit','removeListener','length','./chatWebsite.events','save','remove'];(function(_0x2f5d2f,_0x553fc5){var _0x1292e9=function(_0x117d77){while(--_0x117d77){_0x2f5d2f['push'](_0x2f5d2f['shift']());}};_0x1292e9(++_0x553fc5);}(_0x74c4,0x1af));var _0x474c=function(_0x246a86,_0x3bb3e9){_0x246a86=_0x246a86-0x0;var _0x219026=_0x74c4[_0x246a86];return _0x219026;};'use strict';var ChatWebsiteEvents=require(_0x474c('0x0'));var events=[_0x474c('0x1'),_0x474c('0x2'),_0x474c('0x3')];function createListener(_0x28377b,_0x39ca9f){return function(_0x40d89f){_0x39ca9f[_0x474c('0x4')](_0x28377b,_0x40d89f);};}function removeListener(_0x3adcc4,_0xca8fec){return function(){ChatWebsiteEvents[_0x474c('0x5')](_0x3adcc4,_0xca8fec);};}exports['register']=function(_0x52ce54){for(var _0x3b92fe=0x0,_0x587e75=events[_0x474c('0x6')];_0x3b92fe<_0x587e75;_0x3b92fe++){var _0x587578=events[_0x3b92fe];var _0x2893d1=createListener('chatWebsite:'+_0x587578,_0x52ce54);ChatWebsiteEvents['on'](_0x587578,_0x2893d1);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cd13ad3..e569f48 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 _0x2455=['/:id/logo','single','file','addLogo','server/files/images/avatars/','%s-%s','now','addAvatar','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/users','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','originalname'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x2455,0x140));var _0x5245=function(_0x61683d,_0xe7e2d5){_0x61683d=_0x61683d-0x0;var _0xfed21e=_0x2455[_0x61683d];return _0xfed21e;};'use strict';var multer=require('multer');var util=require(_0x5245('0x0'));var path=require('path');var timeout=require(_0x5245('0x1'));var express=require(_0x5245('0x2'));var router=express[_0x5245('0x3')]();var fs_extra=require(_0x5245('0x4'));var auth=require(_0x5245('0x5'));var interaction=require(_0x5245('0x6'));var config=require(_0x5245('0x7'));var controller=require(_0x5245('0x8'));router[_0x5245('0x9')]('/',auth[_0x5245('0xa')](),controller[_0x5245('0xb')]);router[_0x5245('0x9')]('/describe',auth[_0x5245('0xa')](),controller['describe']);router[_0x5245('0x9')]('/:id',auth[_0x5245('0xa')](),controller[_0x5245('0xc')]);router[_0x5245('0x9')](_0x5245('0xd'),auth[_0x5245('0xa')](),controller[_0x5245('0xe')]);router[_0x5245('0x9')](_0x5245('0xf'),auth[_0x5245('0xa')](),controller[_0x5245('0x10')]);router[_0x5245('0x9')]('/:id/logo',controller[_0x5245('0x11')]);router[_0x5245('0x9')](_0x5245('0x12'),controller[_0x5245('0x13')]);router[_0x5245('0x9')]('/:id/customer_avatar',controller[_0x5245('0x14')]);router['get']('/:id/system_avatar',controller[_0x5245('0x15')]);router[_0x5245('0x9')](_0x5245('0x16'),auth['isAuthenticated'](),controller[_0x5245('0x17')]);router[_0x5245('0x9')](_0x5245('0x18'),controller[_0x5245('0x19')]);router['get'](_0x5245('0x1a'),auth[_0x5245('0xa')](),controller[_0x5245('0x1b')]);router['get'](_0x5245('0x1c'),auth['isAuthenticated'](),controller[_0x5245('0x1d')]);router[_0x5245('0x9')]('/:id/fields',controller[_0x5245('0x1e')]);router[_0x5245('0x9')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x5245('0x9')](_0x5245('0x1f'),auth[_0x5245('0xa')](),controller['getAgents']);router[_0x5245('0x20')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5245('0x20')]('/:id/dispositions',auth[_0x5245('0xa')](),controller['addDisposition']);router[_0x5245('0x20')](_0x5245('0xf'),auth['isAuthenticated'](),controller[_0x5245('0x21')]);var upload=multer({'storage':multer[_0x5245('0x22')]({'destination':function(_0x41fa69,_0x2b66a4,_0x4fb4ce){_0x4fb4ce(null,path[_0x5245('0x23')](config[_0x5245('0x24')],_0x5245('0x25')));},'filename':function(_0x5ae5ef,_0x31cc26,_0x3853b5){_0x3853b5(null,util[_0x5245('0x26')]('%s-%s',Date['now'](),_0x31cc26[_0x5245('0x27')]));}})});router[_0x5245('0x20')](_0x5245('0x28'),upload[_0x5245('0x29')](_0x5245('0x2a')),controller[_0x5245('0x2b')]);var upload=multer({'storage':multer[_0x5245('0x22')]({'destination':function(_0x162727,_0x2a10dc,_0x105795){_0x105795(null,path[_0x5245('0x23')](config['root'],_0x5245('0x2c')));},'filename':function(_0x2bae2b,_0x12a5d0,_0x215dcf){_0x215dcf(null,util[_0x5245('0x26')](_0x5245('0x2d'),Date[_0x5245('0x2e')](),_0x12a5d0['originalname']));}})});router[_0x5245('0x20')](_0x5245('0x12'),upload[_0x5245('0x29')](_0x5245('0x2a')),controller[_0x5245('0x2f')]);var upload=multer({'storage':multer[_0x5245('0x22')]({'destination':function(_0x42a506,_0x19ec95,_0x446c9a){_0x446c9a(null,path['join'](config['root'],_0x5245('0x2c')));},'filename':function(_0x9c8c33,_0xc2fcfd,_0x54710e){_0x54710e(null,util['format'](_0x5245('0x2d'),Date[_0x5245('0x2e')](),_0xc2fcfd['originalname']));}})});router['post']('/:id/customer_avatar',upload['single']('file'),controller[_0x5245('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x460187,_0x1d08a6,_0x4cae66){_0x4cae66(null,path[_0x5245('0x23')](config[_0x5245('0x24')],_0x5245('0x2c')));},'filename':function(_0x576a3d,_0x39baf3,_0x41f483){_0x41f483(null,util[_0x5245('0x26')](_0x5245('0x2d'),Date[_0x5245('0x2e')](),_0x39baf3['originalname']));}})});router[_0x5245('0x20')]('/:id/system_avatar',upload[_0x5245('0x29')](_0x5245('0x2a')),controller['addSystemAvatar']);router[_0x5245('0x20')](_0x5245('0x31'),controller[_0x5245('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x30f711,_0x22131c,_0x1b658f){const _0x2a5ca2=path[_0x5245('0x23')](config[_0x5245('0x24')],_0x5245('0x33'),_0x5245('0x34'),_0x5245('0x35'));fs_extra[_0x5245('0x36')](_0x2a5ca2,function(){_0x1b658f(null,_0x2a5ca2);});},'filename':function(_0x425077,_0x1835c2,_0x3d75bf){const _0x809f90=_0x1835c2[_0x5245('0x27')][_0x5245('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15654b=path[_0x5245('0x38')](_0x809f90);const _0x2c1798=Date[_0x5245('0x2e')]()+'-'+_0x809f90['replace'](_0x15654b,'')+_0x15654b;_0x3d75bf(null,_0x2c1798);}})});router[_0x5245('0x20')](_0x5245('0x39'),offlineUploadMulter[_0x5245('0x3a')](),controller['offline']);router[_0x5245('0x20')](_0x5245('0x16'),auth[_0x5245('0xa')](),controller[_0x5245('0x3b')]);router[_0x5245('0x20')](_0x5245('0x1a'),auth[_0x5245('0xa')](),controller[_0x5245('0x3c')]);router[_0x5245('0x20')](_0x5245('0x1c'),auth[_0x5245('0xa')](),controller[_0x5245('0x3d')]);router['post'](_0x5245('0x1f'),auth[_0x5245('0xa')](),controller[_0x5245('0x3e')]);router[_0x5245('0x3f')](_0x5245('0x40'),auth[_0x5245('0xa')](),controller[_0x5245('0x41')]);router[_0x5245('0x42')](_0x5245('0x40'),auth[_0x5245('0xa')](),controller[_0x5245('0x43')]);router['delete'](_0x5245('0xd'),auth['isAuthenticated'](),controller[_0x5245('0x44')]);router[_0x5245('0x42')](_0x5245('0xf'),auth[_0x5245('0xa')](),controller[_0x5245('0x45')]);router['delete'](_0x5245('0x1f'),auth[_0x5245('0xa')](),controller[_0x5245('0x46')]);module[_0x5245('0x47')]=router; \ No newline at end of file +var _0x837d=['removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','root','server/files/images/logos/','now','originalname','single','file','addLogo','diskStorage','format','%s-%s','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addApplications','/:id/proactive_actions','addAgents','put','destroy','delete'];(function(_0x1b40f1,_0x1e2cab){var _0x1950d0=function(_0x2c0011){while(--_0x2c0011){_0x1b40f1['push'](_0x1b40f1['shift']());}};_0x1950d0(++_0x1e2cab);}(_0x837d,0x171));var _0xd837=function(_0x292e18,_0x166e87){_0x292e18=_0x292e18-0x0;var _0x81ec67=_0x837d[_0x292e18];return _0x81ec67;};'use strict';var multer=require(_0xd837('0x0'));var util=require('util');var path=require(_0xd837('0x1'));var timeout=require(_0xd837('0x2'));var express=require(_0xd837('0x3'));var router=express['Router']();var fs_extra=require(_0xd837('0x4'));var auth=require(_0xd837('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd837('0x6'));var controller=require(_0xd837('0x7'));router[_0xd837('0x8')]('/',auth[_0xd837('0x9')](),controller[_0xd837('0xa')]);router[_0xd837('0x8')](_0xd837('0xb'),auth[_0xd837('0x9')](),controller[_0xd837('0xc')]);router[_0xd837('0x8')](_0xd837('0xd'),auth[_0xd837('0x9')](),controller[_0xd837('0xe')]);router[_0xd837('0x8')](_0xd837('0xf'),auth['isAuthenticated'](),controller[_0xd837('0x10')]);router[_0xd837('0x8')](_0xd837('0x11'),auth[_0xd837('0x9')](),controller[_0xd837('0x12')]);router[_0xd837('0x8')](_0xd837('0x13'),controller[_0xd837('0x14')]);router['get'](_0xd837('0x15'),controller[_0xd837('0x16')]);router['get']('/:id/customer_avatar',controller[_0xd837('0x17')]);router[_0xd837('0x8')](_0xd837('0x18'),controller[_0xd837('0x19')]);router[_0xd837('0x8')](_0xd837('0x1a'),auth[_0xd837('0x9')](),controller['getInteractions']);router[_0xd837('0x8')](_0xd837('0x1b'),controller[_0xd837('0x1c')]);router[_0xd837('0x8')](_0xd837('0x1d'),auth[_0xd837('0x9')](),controller['getApplications']);router[_0xd837('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xd837('0x1e')]);router['get'](_0xd837('0x1f'),controller[_0xd837('0x20')]);router[_0xd837('0x8')](_0xd837('0x21'),auth['isAuthenticated'](),controller[_0xd837('0x22')]);router['get'](_0xd837('0x23'),auth[_0xd837('0x9')](),controller[_0xd837('0x24')]);router[_0xd837('0x25')]('/',auth['isAuthenticated'](),controller[_0xd837('0x26')]);router[_0xd837('0x25')]('/:id/dispositions',auth[_0xd837('0x9')](),controller[_0xd837('0x27')]);router[_0xd837('0x25')](_0xd837('0x11'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ba313,_0x4ae0c1,_0x2642e6){_0x2642e6(null,path[_0xd837('0x28')](config[_0xd837('0x29')],_0xd837('0x2a')));},'filename':function(_0x427e62,_0x1e4b8d,_0x193cd6){_0x193cd6(null,util['format']('%s-%s',Date[_0xd837('0x2b')](),_0x1e4b8d[_0xd837('0x2c')]));}})});router[_0xd837('0x25')](_0xd837('0x13'),upload[_0xd837('0x2d')](_0xd837('0x2e')),controller[_0xd837('0x2f')]);var upload=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x35ec9e,_0xe233c,_0x182861){_0x182861(null,path['join'](config[_0xd837('0x29')],'server/files/images/avatars/'));},'filename':function(_0x13c822,_0x967285,_0x3dea01){_0x3dea01(null,util[_0xd837('0x31')](_0xd837('0x32'),Date[_0xd837('0x2b')](),_0x967285[_0xd837('0x2c')]));}})});router[_0xd837('0x25')](_0xd837('0x15'),upload[_0xd837('0x2d')](_0xd837('0x2e')),controller[_0xd837('0x33')]);var upload=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x503bfb,_0x551dff,_0xae0b57){_0xae0b57(null,path[_0xd837('0x28')](config[_0xd837('0x29')],_0xd837('0x34')));},'filename':function(_0x2ec3e6,_0x1d5330,_0x311dab){_0x311dab(null,util[_0xd837('0x31')]('%s-%s',Date[_0xd837('0x2b')](),_0x1d5330[_0xd837('0x2c')]));}})});router['post'](_0xd837('0x35'),upload['single'](_0xd837('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x59d23c,_0x2f6a76,_0x3b2db2){_0x3b2db2(null,path[_0xd837('0x28')](config[_0xd837('0x29')],_0xd837('0x34')));},'filename':function(_0x42c022,_0x2f1540,_0x191079){_0x191079(null,util['format'](_0xd837('0x32'),Date[_0xd837('0x2b')](),_0x2f1540[_0xd837('0x2c')]));}})});router[_0xd837('0x25')](_0xd837('0x18'),upload['single'](_0xd837('0x2e')),controller[_0xd837('0x36')]);router['post'](_0xd837('0x37'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xd837('0x30')]({'destination':function(_0x3c1640,_0x3d7111,_0x9dfd06){const _0x8cef94=path['join'](config[_0xd837('0x29')],_0xd837('0x38'),_0xd837('0x39'),_0xd837('0x3a'));fs_extra['ensureDir'](_0x8cef94,function(){_0x9dfd06(null,_0x8cef94);});},'filename':function(_0x24466f,_0x315061,_0x5c1e09){const _0xb506d5=_0x315061[_0xd837('0x2c')][_0xd837('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1f1c96=path[_0xd837('0x3c')](_0xb506d5);const _0x78d93a=Date[_0xd837('0x2b')]()+'-'+_0xb506d5[_0xd837('0x3b')](_0x1f1c96,'')+_0x1f1c96;_0x5c1e09(null,_0x78d93a);}})});router[_0xd837('0x25')](_0xd837('0x3d'),offlineUploadMulter['any'](),controller[_0xd837('0x3e')]);router['post'](_0xd837('0x1a'),auth[_0xd837('0x9')](),controller['addInteraction']);router['post'](_0xd837('0x1d'),auth[_0xd837('0x9')](),controller[_0xd837('0x3f')]);router[_0xd837('0x25')](_0xd837('0x40'),auth[_0xd837('0x9')](),controller['addProactiveActions']);router[_0xd837('0x25')](_0xd837('0x23'),auth['isAuthenticated'](),controller[_0xd837('0x41')]);router[_0xd837('0x42')](_0xd837('0xd'),auth[_0xd837('0x9')](),controller['update']);router['delete'](_0xd837('0xd'),auth[_0xd837('0x9')](),controller[_0xd837('0x43')]);router[_0xd837('0x44')](_0xd837('0xf'),auth['isAuthenticated'](),controller[_0xd837('0x45')]);router[_0xd837('0x44')](_0xd837('0x11'),auth['isAuthenticated'](),controller[_0xd837('0x46')]);router['delete'](_0xd837('0x23'),auth[_0xd837('0x9')](),controller[_0xd837('0x47')]);module[_0xd837('0x48')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e6b392c..4285759 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 _0xc28f=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','STRING'];(function(_0x4ee075,_0x1eb092){var _0x4dfb79=function(_0x195bc9){while(--_0x195bc9){_0x4ee075['push'](_0x4ee075['shift']());}};_0x4dfb79(++_0x1eb092);}(_0xc28f,0xfd));var _0xfc28=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xc28f[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module[_0xfc28('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfc28('0x1')](_0xfc28('0x2'),_0xfc28('0x3'),_0xfc28('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xfc28('0x1')]('Outlook365',_0xfc28('0x5'))},'data1':{'type':Sequelize[_0xfc28('0x6')],'comment':_0xfc28('0x7')},'data2':{'type':Sequelize[_0xfc28('0x6')],'comment':_0xfc28('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xfc28('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0xfc28('0xa')},'data5':{'type':Sequelize[_0xfc28('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xfc28('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xfc28('0xb')],'comment':_0xfc28('0xc')}}; \ No newline at end of file +var _0x3239=['AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM'];(function(_0x3a03a5,_0x468eb5){var _0x343768=function(_0x1fb9fb){while(--_0x1fb9fb){_0x3a03a5['push'](_0x3a03a5['shift']());}};_0x343768(++_0x468eb5);}(_0x3239,0xcc));var _0x9323=function(_0x4ab341,_0x43b4f8){_0x4ab341=_0x4ab341-0x0;var _0x12eb77=_0x3239[_0x4ab341];return _0x12eb77;};'use strict';var Sequelize=require(_0x9323('0x0'));module[_0x9323('0x1')]={'name':{'type':Sequelize[_0x9323('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9323('0x3')](_0x9323('0x4'),_0x9323('0x5'),_0x9323('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9323('0x7'),_0x9323('0x8'))},'data1':{'type':Sequelize[_0x9323('0x2')],'comment':_0x9323('0x9')},'data2':{'type':Sequelize[_0x9323('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x9323('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x9323('0xa')},'data5':{'type':Sequelize[_0x9323('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x9323('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9323('0xb')],'comment':_0x9323('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 49da892..c660ae7 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 _0x4b5e=['merge','VIRTUAL','options','includeAll','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','keys','find','decryptString','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','create','destroy','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','oauth2Claims','del','code','refresh_token','data5','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter'];(function(_0x1d74f7,_0x28d845){var _0x5e1d69=function(_0x5acde8){while(--_0x5acde8){_0x1d74f7['push'](_0x1d74f7['shift']());}};_0x5e1d69(++_0x28d845);}(_0x4b5e,0x90));var _0xe4b5=function(_0x192fda,_0x3aaeac){_0x192fda=_0x192fda-0x0;var _0x303f29=_0x4b5e[_0x192fda];return _0x303f29;};'use strict';var _=require('lodash');var Redis=require(_0xe4b5('0x0'));var qs=require(_0xe4b5('0x1'));var encryptor=require(_0xe4b5('0x2'));var config=require(_0xe4b5('0x3'));var logger=require(_0xe4b5('0x4'))(_0xe4b5('0x5'));var db=require(_0xe4b5('0x6'))['db'];var oauth=require(_0xe4b5('0x7'));config[_0xe4b5('0x8')]=_[_0xe4b5('0x9')](config['redis'],{'host':_0xe4b5('0xa'),'port':0x18eb});var socket=require(_0xe4b5('0xb'))(new Redis(config[_0xe4b5('0x8')]));var redis=new Redis(config[_0xe4b5('0x8')]);function respondWithStatusCode(_0xde7ce3,_0x58209c){_0x58209c=_0x58209c||0xcc;return function(_0x4e8594){if(_0x4e8594){return _0xde7ce3[_0xe4b5('0xc')](_0x58209c);}return _0xde7ce3[_0xe4b5('0xd')](_0x58209c)[_0xe4b5('0xe')]();};}function respondWithResult(_0x5244a6,_0x352a8a){_0x352a8a=_0x352a8a||0xc8;return function(_0x5e5824){if(_0x5e5824){return _0x5244a6[_0xe4b5('0xd')](_0x352a8a)['json'](_0x5e5824);}};}function respondWithFilteredResult(_0x1b5a2c,_0x417cd8){return function(_0x1e6553){if(_0x1e6553){var _0x18f2e1=typeof _0x417cd8[_0xe4b5('0xf')]===_0xe4b5('0x10')&&typeof _0x417cd8[_0xe4b5('0x11')]===_0xe4b5('0x10');var _0x3bd77f=_0x1e6553['count'];var _0x56cdee=_0x18f2e1?0x0:_0x417cd8[_0xe4b5('0xf')];var _0x396d70=_0x18f2e1?_0x1e6553[_0xe4b5('0x12')]:_0x417cd8['offset']+_0x417cd8[_0xe4b5('0x11')];var _0x401878;if(_0x396d70>=_0x3bd77f){_0x396d70=_0x3bd77f;_0x401878=0xc8;}else{_0x401878=0xce;}_0x1b5a2c['status'](_0x401878);return _0x1b5a2c[_0xe4b5('0x13')]('Content-Range',_0x56cdee+'-'+_0x396d70+'/'+_0x3bd77f)[_0xe4b5('0x14')](_0x1e6553);}return null;};}function saveUpdates(_0x18fde8){return function(_0x4fd254){if(_0x4fd254){return _0x4fd254[_0xe4b5('0x15')](_0x18fde8)[_0xe4b5('0x16')](function(_0x234b83){return _0x234b83;});}return null;};}function removeEntity(_0x532d35){return function(_0x1bcc3a){if(_0x1bcc3a){return _0x1bcc3a['destroy']()[_0xe4b5('0x16')](function(){_0x532d35[_0xe4b5('0xd')](0xcc)[_0xe4b5('0xe')]();});}};}function handleEntityNotFound(_0x301c0b){return function(_0x42b53f){if(!_0x42b53f){_0x301c0b[_0xe4b5('0xc')](0x194);}return _0x42b53f;};}function handleError(_0x233e19,_0xf75b1c){_0xf75b1c=_0xf75b1c||0x1f4;return function(_0x52416d){logger[_0xe4b5('0x17')](_0x52416d[_0xe4b5('0x18')]);if(_0x52416d[_0xe4b5('0x19')]){delete _0x52416d[_0xe4b5('0x19')];}_0x233e19['status'](_0xf75b1c)[_0xe4b5('0x1a')](_0x52416d);};}function maskClientSecret(_0x20906b){return _[_0xe4b5('0x1b')](_0x20906b[_0xe4b5('0x1c')](0x0,0x3),0x14,'*');}exports[_0xe4b5('0x1d')]=function(_0x3d3780,_0x126f6b){var _0x149278={},_0x5264b3={},_0x5724b8={'count':0x0,'rows':[]};var _0x33a739=_[_0xe4b5('0x1e')](db[_0xe4b5('0x1f')][_0xe4b5('0x20')],function(_0x3df4a0){return{'name':_0x3df4a0[_0xe4b5('0x21')],'type':_0x3df4a0[_0xe4b5('0x22')][_0xe4b5('0x23')]};});_0x5264b3[_0xe4b5('0x24')]=_[_0xe4b5('0x1e')](_0x33a739,_0xe4b5('0x19'));_0x5264b3['query']=_['keys'](_0x3d3780[_0xe4b5('0x25')]);_0x5264b3['filters']=_[_0xe4b5('0x26')](_0x5264b3[_0xe4b5('0x24')],_0x5264b3[_0xe4b5('0x25')]);_0x149278[_0xe4b5('0x27')]=_[_0xe4b5('0x26')](_0x5264b3[_0xe4b5('0x24')],qs[_0xe4b5('0x28')](_0x3d3780[_0xe4b5('0x25')][_0xe4b5('0x28')]));_0x149278['attributes']=_0x149278[_0xe4b5('0x27')][_0xe4b5('0x29')]?_0x149278['attributes']:_0x5264b3[_0xe4b5('0x24')];if(!_0x3d3780[_0xe4b5('0x25')][_0xe4b5('0x2a')]('nolimit')){_0x149278[_0xe4b5('0x11')]=qs['limit'](_0x3d3780['query'][_0xe4b5('0x11')]);_0x149278[_0xe4b5('0xf')]=qs[_0xe4b5('0xf')](_0x3d3780['query'][_0xe4b5('0xf')]);}_0x149278[_0xe4b5('0x2b')]=qs[_0xe4b5('0x2c')](_0x3d3780['query'][_0xe4b5('0x2c')]);_0x149278[_0xe4b5('0x2d')]=qs[_0xe4b5('0x2e')](_['pick'](_0x3d3780[_0xe4b5('0x25')],_0x5264b3['filters']),_0x33a739);if(_0x3d3780['query'][_0xe4b5('0x2f')]){_0x149278[_0xe4b5('0x2d')]=_[_0xe4b5('0x30')](_0x149278['where'],{'$or':_[_0xe4b5('0x1e')](_0x33a739,function(_0x12b21e){if(_0x12b21e[_0xe4b5('0x22')]!==_0xe4b5('0x31')){var _0x1ed5e2={};_0x1ed5e2[_0x12b21e[_0xe4b5('0x19')]]={'$like':'%'+_0x3d3780[_0xe4b5('0x25')][_0xe4b5('0x2f')]+'%'};return _0x1ed5e2;}})});}_0x149278=_[_0xe4b5('0x30')]({},_0x149278,_0x3d3780[_0xe4b5('0x32')]);var _0x239a3f={'where':_0x149278[_0xe4b5('0x2d')]};return db[_0xe4b5('0x1f')]['count'](_0x239a3f)[_0xe4b5('0x16')](function(_0x10a784){_0x5724b8['count']=_0x10a784;if(_0x3d3780[_0xe4b5('0x25')][_0xe4b5('0x33')]){_0x149278['include']=[{'all':!![]}];}return db[_0xe4b5('0x1f')][_0xe4b5('0x34')](_0x149278);})['then'](function(_0x49c74d){_0x5724b8[_0xe4b5('0x35')]=_[_0xe4b5('0x1e')](_0x49c74d,function(_0x3a52a0){if(_0x3a52a0[_0xe4b5('0x36')]===_0xe4b5('0x37')){var _0x3e89a1=encryptor['decryptString'](_0x3a52a0[_0xe4b5('0x38')]);_0x3a52a0[_0xe4b5('0x38')]=maskClientSecret(_0x3e89a1);}return _0x3a52a0;});return _0x5724b8;})[_0xe4b5('0x16')](respondWithFilteredResult(_0x126f6b,_0x149278))[_0xe4b5('0x39')](handleError(_0x126f6b,null));};exports[_0xe4b5('0x3a')]=function(_0x215725,_0x5addc8){var _0x2cefc3={'raw':!![],'where':{'id':_0x215725[_0xe4b5('0x3b')]['id']}},_0x4d0d57={};_0x4d0d57[_0xe4b5('0x24')]=_[_0xe4b5('0x3c')](db[_0xe4b5('0x1f')]['rawAttributes']);_0x4d0d57[_0xe4b5('0x25')]=_['keys'](_0x215725[_0xe4b5('0x25')]);_0x4d0d57['filters']=_['intersection'](_0x4d0d57[_0xe4b5('0x24')],_0x4d0d57[_0xe4b5('0x25')]);_0x2cefc3[_0xe4b5('0x27')]=_[_0xe4b5('0x26')](_0x4d0d57[_0xe4b5('0x24')],qs['fields'](_0x215725[_0xe4b5('0x25')][_0xe4b5('0x28')]));_0x2cefc3['attributes']=_0x2cefc3[_0xe4b5('0x27')]['length']?_0x2cefc3['attributes']:_0x4d0d57[_0xe4b5('0x24')];if(_0x215725['query'][_0xe4b5('0x33')]){_0x2cefc3['include']=[{'all':!![]}];}_0x2cefc3=_['merge']({},_0x2cefc3,_0x215725[_0xe4b5('0x32')]);return db['CloudProvider'][_0xe4b5('0x3d')](_0x2cefc3)['then'](handleEntityNotFound(_0x5addc8,null))['then'](function(_0x11ef97){if(_0x11ef97['service']==='MicrosoftAzure'){var _0x27150f=encryptor[_0xe4b5('0x3e')](_0x11ef97[_0xe4b5('0x38')]);_0x11ef97[_0xe4b5('0x38')]=maskClientSecret(_0x27150f);}return _0x11ef97;})[_0xe4b5('0x16')](respondWithResult(_0x5addc8,null))['catch'](handleError(_0x5addc8,null));};exports['create']=function(_0x31748c,_0x4ece0b){if(!_0x31748c[_0xe4b5('0x3f')][_0xe4b5('0x19')])throw new Error(_0xe4b5('0x40'));if(!_0x31748c['body']['service'])throw new Error(_0xe4b5('0x41'));var _0x144a66=db[_0xe4b5('0x1f')][_0xe4b5('0x20')][_0xe4b5('0x36')][_0xe4b5('0x42')];if(!_0x144a66[_0xe4b5('0x43')](_0x31748c['body'][_0xe4b5('0x36')]))throw new Error(_0xe4b5('0x44')+_0x144a66['join'](',\x20'));if(_0x31748c[_0xe4b5('0x3f')][_0xe4b5('0x36')]===_0xe4b5('0x37')&&_0x31748c[_0xe4b5('0x3f')][_0xe4b5('0x38')]){_0x31748c[_0xe4b5('0x3f')][_0xe4b5('0x38')]=encryptor[_0xe4b5('0x45')](_0x31748c[_0xe4b5('0x3f')][_0xe4b5('0x38')]);}return db[_0xe4b5('0x1f')][_0xe4b5('0x46')](_0x31748c[_0xe4b5('0x3f')],{})['then'](respondWithResult(_0x4ece0b,0xc9))[_0xe4b5('0x39')](handleError(_0x4ece0b,null));};exports[_0xe4b5('0x15')]=function(_0x51fab7,_0x454f50){if(_0x51fab7[_0xe4b5('0x3f')]['id']){delete _0x51fab7[_0xe4b5('0x3f')]['id'];}return db[_0xe4b5('0x1f')][_0xe4b5('0x3d')]({'where':{'id':_0x51fab7[_0xe4b5('0x3b')]['id']}})[_0xe4b5('0x16')](handleEntityNotFound(_0x454f50,null))['then'](function(_0x50d337){if(_0x50d337[_0xe4b5('0x36')]===_0xe4b5('0x37')&&_0x51fab7[_0xe4b5('0x3f')]['data3']){_0x51fab7[_0xe4b5('0x3f')][_0xe4b5('0x38')]=encryptor[_0xe4b5('0x45')](_0x51fab7[_0xe4b5('0x3f')][_0xe4b5('0x38')]);}return _0x50d337;})['then'](saveUpdates(_0x51fab7['body'],null))[_0xe4b5('0x16')](respondWithResult(_0x454f50,null))[_0xe4b5('0x39')](handleError(_0x454f50,null));};exports[_0xe4b5('0x47')]=function(_0x4fa954,_0xd6f762){return db[_0xe4b5('0x1f')][_0xe4b5('0x3d')]({'where':{'id':_0x4fa954[_0xe4b5('0x3b')]['id']}})[_0xe4b5('0x16')](handleEntityNotFound(_0xd6f762,null))[_0xe4b5('0x16')](removeEntity(_0xd6f762,null))[_0xe4b5('0x39')](handleError(_0xd6f762,null));};exports[_0xe4b5('0x48')]=function(_0x592c3a,_0x2dad34){return db['CloudProvider']['findOne']({'where':{'id':_0x592c3a[_0xe4b5('0x3b')]['id']},'raw':!![]})['then'](function(_0x302f77){if(!_0x302f77)return _0x2dad34[_0xe4b5('0xc')](0x194);return{'url':oauth[_0xe4b5('0x49')](_0x302f77,_0x592c3a[_0xe4b5('0x4a')]['id'])};})[_0xe4b5('0x16')](respondWithResult(_0x2dad34,null))[_0xe4b5('0x39')](handleError(_0x2dad34,null));};exports[_0xe4b5('0x4b')]=function(_0x4401fb,_0x253d7e){var _0x1c980a=_0x4401fb[_0xe4b5('0x3f')];var _0xdc92af;var _0x3cd606;if(_0x1c980a[_0xe4b5('0x17')])throw _0x1c980a;redis[_0xe4b5('0x4c')](_0x1c980a[_0xe4b5('0x4d')])[_0xe4b5('0x16')](function(_0x3fb5fe){if(!_0x3fb5fe)throw new Error(_0xe4b5('0x4e'));_0xdc92af=JSON[_0xe4b5('0x4f')](_0x3fb5fe);var _0x103d02=Buffer[_0xe4b5('0x50')](_0x1c980a[_0xe4b5('0x4d')],_0xe4b5('0x51'))['toString'](_0xe4b5('0x52'));_0x3cd606=JSON['parse'](_0x103d02);if(!oauth[_0xe4b5('0x53')](_0x1c980a['id_token'],_0xdc92af[_0xe4b5('0x54')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xe4b5('0x55')](_0x1c980a['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x1c980a[_0xe4b5('0x56')],_0xdc92af);})[_0xe4b5('0x16')](function(_0x5778d0){_0xdc92af['data5']=_0x5778d0['access_token'];_0xdc92af['data6']=_0x5778d0[_0xe4b5('0x57')];return db[_0xe4b5('0x1f')][_0xe4b5('0x15')]({'data5':_0xdc92af[_0xe4b5('0x58')],'data6':_0xdc92af[_0xe4b5('0x59')]},{'where':{'id':_0xdc92af['id']}});})['then'](function(){oauth['startRefreshInterval'](_0xdc92af);socket[_0xe4b5('0x5a')](_0xe4b5('0x5b'),{'id':_0x3cd606['id']});return;})[_0xe4b5('0x16')](respondWithStatusCode(_0x253d7e,null))['catch'](function(_0xd649da){if(_0x3cd606){socket['emit'](_0xe4b5('0x5c'),{'id':_0x3cd606['id']});}if(!_0xdc92af){logger[_0xe4b5('0x17')](_0xe4b5('0x5d'),_0xd649da);return _0x253d7e[_0xe4b5('0xd')](0x1f4)['send'](_0xd649da[_0xe4b5('0x5e')]);}logger[_0xe4b5('0x17')](_0xe4b5('0x5f'),_0xdc92af['id'],_0xd649da);});}; \ No newline at end of file +var _0xd552=['Unable\x20to\x20validate\x20id_token','del','code','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','lodash','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','padEnd','slice','map','type','key','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','name','include','CloudProvider','findAll','service','decryptString','data3','catch','rawAttributes','includeAll','options','find','MicrosoftAzure','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','create','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0xd552,0x1b4));var _0x2d55=function(_0x480c29,_0x2051db){_0x480c29=_0x480c29-0x0;var _0x1c5321=_0xd552[_0x480c29];return _0x1c5321;};'use strict';var _=require(_0x2d55('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x2d55('0x1'));var config=require('../../config/environment');var logger=require(_0x2d55('0x2'))(_0x2d55('0x3'));var db=require(_0x2d55('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_['defaults'](config[_0x2d55('0x5')],{'host':_0x2d55('0x6'),'port':0x18eb});var socket=require(_0x2d55('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0x2d55('0x5')]);function respondWithStatusCode(_0x3f5d35,_0x10cb36){_0x10cb36=_0x10cb36||0xcc;return function(_0x2c895f){if(_0x2c895f){return _0x3f5d35[_0x2d55('0x8')](_0x10cb36);}return _0x3f5d35[_0x2d55('0x9')](_0x10cb36)[_0x2d55('0xa')]();};}function respondWithResult(_0x28646f,_0x3fa4bd){_0x3fa4bd=_0x3fa4bd||0xc8;return function(_0x166416){if(_0x166416){return _0x28646f[_0x2d55('0x9')](_0x3fa4bd)[_0x2d55('0xb')](_0x166416);}};}function respondWithFilteredResult(_0x82e8d4,_0x381dd8){return function(_0x1df21a){if(_0x1df21a){var _0x2badd7=typeof _0x381dd8['offset']===_0x2d55('0xc')&&typeof _0x381dd8[_0x2d55('0xd')]==='undefined';var _0x4b7f00=_0x1df21a[_0x2d55('0xe')];var _0xee9d96=_0x2badd7?0x0:_0x381dd8[_0x2d55('0xf')];var _0x28aa8c=_0x2badd7?_0x1df21a[_0x2d55('0xe')]:_0x381dd8[_0x2d55('0xf')]+_0x381dd8[_0x2d55('0xd')];var _0x328f91;if(_0x28aa8c>=_0x4b7f00){_0x28aa8c=_0x4b7f00;_0x328f91=0xc8;}else{_0x328f91=0xce;}_0x82e8d4[_0x2d55('0x9')](_0x328f91);return _0x82e8d4[_0x2d55('0x10')](_0x2d55('0x11'),_0xee9d96+'-'+_0x28aa8c+'/'+_0x4b7f00)[_0x2d55('0xb')](_0x1df21a);}return null;};}function saveUpdates(_0x22c315){return function(_0x466bd4){if(_0x466bd4){return _0x466bd4[_0x2d55('0x12')](_0x22c315)[_0x2d55('0x13')](function(_0x169a00){return _0x169a00;});}return null;};}function removeEntity(_0x138d18){return function(_0x518754){if(_0x518754){return _0x518754[_0x2d55('0x14')]()['then'](function(){_0x138d18[_0x2d55('0x9')](0xcc)[_0x2d55('0xa')]();});}};}function handleEntityNotFound(_0x3de4e6){return function(_0x362cae){if(!_0x362cae){_0x3de4e6[_0x2d55('0x8')](0x194);}return _0x362cae;};}function handleError(_0x18e16e,_0x4e4b55){_0x4e4b55=_0x4e4b55||0x1f4;return function(_0xa62cbe){logger[_0x2d55('0x15')](_0xa62cbe[_0x2d55('0x16')]);if(_0xa62cbe['name']){delete _0xa62cbe['name'];}_0x18e16e[_0x2d55('0x9')](_0x4e4b55)['send'](_0xa62cbe);};}function maskClientSecret(_0x25ec31){return _[_0x2d55('0x17')](_0x25ec31[_0x2d55('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3ff3a8,_0x2e1299){var _0x4bc042={},_0x41d4fb={},_0x18f8fa={'count':0x0,'rows':[]};var _0x12f047=_[_0x2d55('0x19')](db['CloudProvider']['rawAttributes'],function(_0x4e608f){return{'name':_0x4e608f['fieldName'],'type':_0x4e608f[_0x2d55('0x1a')][_0x2d55('0x1b')]};});_0x41d4fb['model']=_['map'](_0x12f047,'name');_0x41d4fb['query']=_[_0x2d55('0x1c')](_0x3ff3a8[_0x2d55('0x1d')]);_0x41d4fb[_0x2d55('0x1e')]=_[_0x2d55('0x1f')](_0x41d4fb[_0x2d55('0x20')],_0x41d4fb[_0x2d55('0x1d')]);_0x4bc042[_0x2d55('0x21')]=_[_0x2d55('0x1f')](_0x41d4fb[_0x2d55('0x20')],qs['fields'](_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x22')]));_0x4bc042[_0x2d55('0x21')]=_0x4bc042[_0x2d55('0x21')][_0x2d55('0x23')]?_0x4bc042[_0x2d55('0x21')]:_0x41d4fb[_0x2d55('0x20')];if(!_0x3ff3a8[_0x2d55('0x1d')]['hasOwnProperty']('nolimit')){_0x4bc042[_0x2d55('0xd')]=qs[_0x2d55('0xd')](_0x3ff3a8['query'][_0x2d55('0xd')]);_0x4bc042[_0x2d55('0xf')]=qs[_0x2d55('0xf')](_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0xf')]);}_0x4bc042[_0x2d55('0x24')]=qs[_0x2d55('0x25')](_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x25')]);_0x4bc042[_0x2d55('0x26')]=qs[_0x2d55('0x1e')](_['pick'](_0x3ff3a8['query'],_0x41d4fb[_0x2d55('0x1e')]),_0x12f047);if(_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x27')]){_0x4bc042[_0x2d55('0x26')]=_[_0x2d55('0x28')](_0x4bc042[_0x2d55('0x26')],{'$or':_[_0x2d55('0x19')](_0x12f047,function(_0x24756d){if(_0x24756d[_0x2d55('0x1a')]!==_0x2d55('0x29')){var _0x2d1553={};_0x2d1553[_0x24756d[_0x2d55('0x2a')]]={'$like':'%'+_0x3ff3a8[_0x2d55('0x1d')][_0x2d55('0x27')]+'%'};return _0x2d1553;}})});}_0x4bc042=_[_0x2d55('0x28')]({},_0x4bc042,_0x3ff3a8['options']);var _0xa0552={'where':_0x4bc042[_0x2d55('0x26')]};return db['CloudProvider'][_0x2d55('0xe')](_0xa0552)['then'](function(_0x543f8d){_0x18f8fa[_0x2d55('0xe')]=_0x543f8d;if(_0x3ff3a8[_0x2d55('0x1d')]['includeAll']){_0x4bc042[_0x2d55('0x2b')]=[{'all':!![]}];}return db[_0x2d55('0x2c')][_0x2d55('0x2d')](_0x4bc042);})[_0x2d55('0x13')](function(_0x5bbaf9){_0x18f8fa['rows']=_[_0x2d55('0x19')](_0x5bbaf9,function(_0x4a0023){if(_0x4a0023[_0x2d55('0x2e')]==='MicrosoftAzure'){var _0x598a83=encryptor[_0x2d55('0x2f')](_0x4a0023[_0x2d55('0x30')]);_0x4a0023[_0x2d55('0x30')]=maskClientSecret(_0x598a83);}return _0x4a0023;});return _0x18f8fa;})[_0x2d55('0x13')](respondWithFilteredResult(_0x2e1299,_0x4bc042))[_0x2d55('0x31')](handleError(_0x2e1299,null));};exports['show']=function(_0x5a9202,_0x29ddb4){var _0x6c9c95={'raw':!![],'where':{'id':_0x5a9202['params']['id']}},_0x1151a2={};_0x1151a2['model']=_[_0x2d55('0x1c')](db[_0x2d55('0x2c')][_0x2d55('0x32')]);_0x1151a2[_0x2d55('0x1d')]=_[_0x2d55('0x1c')](_0x5a9202['query']);_0x1151a2[_0x2d55('0x1e')]=_['intersection'](_0x1151a2[_0x2d55('0x20')],_0x1151a2[_0x2d55('0x1d')]);_0x6c9c95[_0x2d55('0x21')]=_[_0x2d55('0x1f')](_0x1151a2['model'],qs[_0x2d55('0x22')](_0x5a9202['query'][_0x2d55('0x22')]));_0x6c9c95[_0x2d55('0x21')]=_0x6c9c95[_0x2d55('0x21')][_0x2d55('0x23')]?_0x6c9c95[_0x2d55('0x21')]:_0x1151a2[_0x2d55('0x20')];if(_0x5a9202[_0x2d55('0x1d')][_0x2d55('0x33')]){_0x6c9c95['include']=[{'all':!![]}];}_0x6c9c95=_['merge']({},_0x6c9c95,_0x5a9202[_0x2d55('0x34')]);return db[_0x2d55('0x2c')][_0x2d55('0x35')](_0x6c9c95)[_0x2d55('0x13')](handleEntityNotFound(_0x29ddb4,null))[_0x2d55('0x13')](function(_0x27aeb7){if(_0x27aeb7[_0x2d55('0x2e')]===_0x2d55('0x36')){var _0x1005a4=encryptor['decryptString'](_0x27aeb7[_0x2d55('0x30')]);_0x27aeb7[_0x2d55('0x30')]=maskClientSecret(_0x1005a4);}return _0x27aeb7;})[_0x2d55('0x13')](respondWithResult(_0x29ddb4,null))[_0x2d55('0x31')](handleError(_0x29ddb4,null));};exports['create']=function(_0x5b43bb,_0x29ce21){if(!_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x2a')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x5b43bb['body'][_0x2d55('0x2e')])throw new Error(_0x2d55('0x38'));var _0x43ef5e=db[_0x2d55('0x2c')][_0x2d55('0x32')][_0x2d55('0x2e')][_0x2d55('0x39')];if(!_0x43ef5e[_0x2d55('0x3a')](_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x2e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x43ef5e[_0x2d55('0x3b')](',\x20'));if(_0x5b43bb[_0x2d55('0x37')]['service']===_0x2d55('0x36')&&_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x30')]){_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x30')]=encryptor[_0x2d55('0x3c')](_0x5b43bb[_0x2d55('0x37')][_0x2d55('0x30')]);}return db[_0x2d55('0x2c')][_0x2d55('0x3d')](_0x5b43bb[_0x2d55('0x37')],{})[_0x2d55('0x13')](respondWithResult(_0x29ce21,0xc9))[_0x2d55('0x31')](handleError(_0x29ce21,null));};exports[_0x2d55('0x12')]=function(_0x3162f3,_0xc481bf){if(_0x3162f3[_0x2d55('0x37')]['id']){delete _0x3162f3[_0x2d55('0x37')]['id'];}return db[_0x2d55('0x2c')]['find']({'where':{'id':_0x3162f3['params']['id']}})[_0x2d55('0x13')](handleEntityNotFound(_0xc481bf,null))[_0x2d55('0x13')](function(_0x331a1b){if(_0x331a1b[_0x2d55('0x2e')]==='MicrosoftAzure'&&_0x3162f3[_0x2d55('0x37')][_0x2d55('0x30')]){_0x3162f3[_0x2d55('0x37')][_0x2d55('0x30')]=encryptor[_0x2d55('0x3c')](_0x3162f3[_0x2d55('0x37')][_0x2d55('0x30')]);}return _0x331a1b;})[_0x2d55('0x13')](saveUpdates(_0x3162f3['body'],null))[_0x2d55('0x13')](respondWithResult(_0xc481bf,null))[_0x2d55('0x31')](handleError(_0xc481bf,null));};exports['destroy']=function(_0x1b1bbf,_0xe8229){return db['CloudProvider'][_0x2d55('0x35')]({'where':{'id':_0x1b1bbf[_0x2d55('0x3e')]['id']}})[_0x2d55('0x13')](handleEntityNotFound(_0xe8229,null))[_0x2d55('0x13')](removeEntity(_0xe8229,null))[_0x2d55('0x31')](handleError(_0xe8229,null));};exports[_0x2d55('0x3f')]=function(_0x2363b9,_0x1d5d54){return db[_0x2d55('0x2c')][_0x2d55('0x40')]({'where':{'id':_0x2363b9[_0x2d55('0x3e')]['id']},'raw':!![]})[_0x2d55('0x13')](function(_0x4b40b8){if(!_0x4b40b8)return _0x1d5d54['sendStatus'](0x194);return{'url':oauth[_0x2d55('0x41')](_0x4b40b8,_0x2363b9[_0x2d55('0x42')]['id'])};})[_0x2d55('0x13')](respondWithResult(_0x1d5d54,null))[_0x2d55('0x31')](handleError(_0x1d5d54,null));};exports['oauth2MicrosoftCallback']=function(_0x5514a5,_0x2b831d){var _0x5daff6=_0x5514a5[_0x2d55('0x37')];var _0x2b7050;var _0x3e0fcf;if(_0x5daff6['error'])throw _0x5daff6;redis['get'](_0x5daff6[_0x2d55('0x43')])[_0x2d55('0x13')](function(_0x432ceb){if(!_0x432ceb)throw new Error(_0x2d55('0x44'));_0x2b7050=JSON[_0x2d55('0x45')](_0x432ceb);var _0x3bf58b=Buffer[_0x2d55('0x46')](_0x5daff6[_0x2d55('0x43')],'base64')[_0x2d55('0x47')](_0x2d55('0x48'));_0x3e0fcf=JSON[_0x2d55('0x45')](_0x3bf58b);if(!oauth[_0x2d55('0x49')](_0x5daff6['id_token'],_0x2b7050['oauth2Claims']))throw new Error(_0x2d55('0x4a'));redis[_0x2d55('0x4b')](_0x5daff6['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x5daff6[_0x2d55('0x4c')],_0x2b7050);})[_0x2d55('0x13')](function(_0x4449ee){_0x2b7050[_0x2d55('0x4d')]=_0x4449ee['access_token'];_0x2b7050[_0x2d55('0x4e')]=_0x4449ee['refresh_token'];return db[_0x2d55('0x2c')][_0x2d55('0x12')]({'data5':_0x2b7050[_0x2d55('0x4d')],'data6':_0x2b7050[_0x2d55('0x4e')]},{'where':{'id':_0x2b7050['id']}});})['then'](function(){oauth[_0x2d55('0x4f')](_0x2b7050);socket[_0x2d55('0x50')](_0x2d55('0x51'),{'id':_0x3e0fcf['id']});return;})['then'](respondWithStatusCode(_0x2b831d,null))[_0x2d55('0x31')](function(_0x2e206c){if(_0x3e0fcf){socket[_0x2d55('0x50')](_0x2d55('0x52'),{'id':_0x3e0fcf['id']});}if(!_0x2b7050){logger['error'](_0x2d55('0x53'),_0x2e206c);return _0x2b831d[_0x2d55('0x9')](0x1f4)['send'](_0x2e206c[_0x2d55('0x54')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s',_0x2b7050['id'],_0x2e206c);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6f70db2..e4ec0f5 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 _0x41ee=['CloudProvider','cloud_providers','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x41ee,0x1a6));var _0xe41e=function(_0x174af8,_0x4416b5){_0x174af8=_0x174af8-0x0;var _0x56b0a1=_0x41ee[_0x174af8];return _0x56b0a1;};'use strict';var _=require(_0xe41e('0x0'));var util=require(_0xe41e('0x1'));var logger=require('../../config/logger')(_0xe41e('0x2'));var moment=require('moment');var BPromise=require(_0xe41e('0x3'));var rp=require(_0xe41e('0x4'));var fs=require('fs');var path=require(_0xe41e('0x5'));var rimraf=require(_0xe41e('0x6'));var config=require(_0xe41e('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xe41e('0x8')]=function(_0x1dfc12,_0x1966ca){return _0x1dfc12[_0xe41e('0x9')](_0xe41e('0xa'),attributes,{'tableName':_0xe41e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a1=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','util','../../config/logger','moment'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x97a1,0x13c));var _0x197a=function(_0x3d8627,_0x34e543){_0x3d8627=_0x3d8627-0x0;var _0x557c0d=_0x97a1[_0x3d8627];return _0x557c0d;};'use strict';var _=require('lodash');var util=require(_0x197a('0x0'));var logger=require(_0x197a('0x1'))('api');var moment=require(_0x197a('0x2'));var BPromise=require('bluebird');var rp=require(_0x197a('0x3'));var fs=require('fs');var path=require(_0x197a('0x4'));var rimraf=require(_0x197a('0x5'));var config=require(_0x197a('0x6'));var attributes=require(_0x197a('0x7'));module[_0x197a('0x8')]=function(_0x182ef1,_0x2dd313){return _0x182ef1[_0x197a('0x9')]('CloudProvider',attributes,{'tableName':_0x197a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 875e09a..b7f6a9a 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 _0x326f=['../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','type','push','data7','/.default','join','Dynamics365','replace','data2','code','id_token','from','randomBytes','data1','response_type','data4','response_mode','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','stringify','decode','iss','issuer','aud','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','{TENANT_ID}','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','authorization_code','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','lodash','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x4ca9e3,_0x21b7d2){_0x4ca9e3=_0x4ca9e3-0x0;var _0x2433f2=_0x326f[_0x4ca9e3];return _0x2433f2;};'use strict';var _=require(_0xf326('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var util=require(_0xf326('0x4'));var encryptor=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var logger=require(_0xf326('0x7'))(_0xf326('0x8'));var schedule=require(_0xf326('0x9'));var db=require(_0xf326('0xa'))['db'];config['redis']=_[_0xf326('0xb')](config[_0xf326('0xc')],{'host':_0xf326('0xd'),'port':0x18eb});var redis=new Redis(config[_0xf326('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile',_0xf326('0xe'),_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12')],'Dynamics365':['openid',_0xf326('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xf326('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4aaf3a){var _0x2e4b71=_['map'](AZURE_AUTH_SCOPES[_0x4aaf3a[_0xf326('0x14')]]);if(_0x4aaf3a[_0xf326('0x14')]==='Dynamics365')_0x2e4b71[_0xf326('0x15')](_0x4aaf3a[_0xf326('0x16')]+_0xf326('0x17'));return _0x2e4b71[_0xf326('0x18')]('\x20');}function getAccessTokenScope(_0x5c8483){if(_0x5c8483[_0xf326('0x14')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x5c8483[_0xf326('0x14')]===_0xf326('0x19'))return _0x5c8483[_0xf326('0x16')]+_0xf326('0x17');}function generateMicrosoftAuthorizationUrl(_0x292f4b,_0x287a2a){var _0x34128e=MICROSOFT_AUTH_URL[_0xf326('0x1a')]('{TENANT_ID}',_0x292f4b[_0xf326('0x1b')]);var _0x453100=[_0xf326('0x1c'),_0xf326('0x1d')];var _0xcef2b5=Buffer[_0xf326('0x1e')](JSON['stringify']({'id':_0x287a2a}))['toString']('base64');var _0x16e605=crypto[_0xf326('0x1f')](0x10)['toString']('hex');var _0x128c68=getAuthorizationScopes(_0x292f4b);var _0x4dfa76=[{'key':'client_id','value':_0x292f4b[_0xf326('0x20')]},{'key':_0xf326('0x21'),'value':encodeURIComponent(_0x453100['join']('\x20'))},{'key':'redirect_uri','value':_0x292f4b[_0xf326('0x22')]},{'key':_0xf326('0x23'),'value':'form_post'},{'key':_0xf326('0x24'),'value':encodeURIComponent(_0x128c68)},{'key':_0xf326('0x25'),'value':_0xcef2b5},{'key':_0xf326('0x26'),'value':_0x16e605},{'key':_0xf326('0x27'),'value':_0xf326('0x28')}];var _0x2049ec=_0x34128e+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x4dfa76,function(_0x55b9f4){return _0x55b9f4['key']+'='+_0x55b9f4[_0xf326('0x29')];})[_0xf326('0x18')]('&');_0x292f4b[_0xf326('0x2a')]={'issuer':_0x34128e[_0xf326('0x1a')](_0xf326('0x2b'),''),'audience':_0x292f4b[_0xf326('0x20')],'state':_0xcef2b5,'nonce':_0x16e605};redis['set'](_0xcef2b5,JSON[_0xf326('0x2c')](_0x292f4b));return _0x2049ec;}function isValidIdToken(_0xa3c0b,_0x212d5d){try{var _0x581531=jwt[_0xf326('0x2d')](_0xa3c0b,{'complete':!![]});var _0x55ad0f=_0x581531['payload'];if(_0x55ad0f[_0xf326('0x2e')]!==_0x212d5d[_0xf326('0x2f')])return![];if(_0x55ad0f[_0xf326('0x30')]!==_0x212d5d['audience'])return![];if(_0x55ad0f[_0xf326('0x26')]!==_0x212d5d[_0xf326('0x26')])return![];if(moment()['isAfter'](moment[_0xf326('0x31')](_0x55ad0f[_0xf326('0x32')])))return![];return!![];}catch(_0xd77aba){throw _0xd77aba;}}function refreshOauth2MicrosoftAccessToken(_0x18d110){return Promise[_0xf326('0x33')]()[_0xf326('0x34')](function(){if(_0x18d110[_0xf326('0x35')])return _0x18d110;return db[_0xf326('0x36')][_0xf326('0x37')]({'where':{'id':_0x18d110['id']},'raw':!![]});})[_0xf326('0x34')](function(_0x4b52f2){var _0x1035ed={'grant_type':_0xf326('0x38'),'refresh_token':_0x4b52f2[_0xf326('0x39')],'scope':getAccessTokenScope(_0x4b52f2),'redirect_uri':_0x4b52f2['data4'],'client_id':_0x4b52f2[_0xf326('0x20')],'client_secret':encryptor[_0xf326('0x3a')](_0x4b52f2[_0xf326('0x35')])};var _0x4df451={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xf326('0x1a')](_0xf326('0x3b'),_0x4b52f2[_0xf326('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1035ed,'json':!![]};return rp(_0x4df451);})[_0xf326('0x34')](function(_0x30694f){_0x18d110[_0xf326('0x3c')]=_0x30694f[_0xf326('0x3d')];_0x18d110[_0xf326('0x39')]=_0x30694f['refresh_token'];return db[_0xf326('0x36')][_0xf326('0x3e')]({'data5':_0x18d110['data5'],'data6':_0x18d110[_0xf326('0x39')]},{'where':{'id':_0x18d110['id']}});})['then'](function(){return _0x18d110;})[_0xf326('0x3f')](function(_0x481b64){logger['error'](_0xf326('0x40'),_0x18d110['id'],_0x481b64);});}function getOauth2MicrosoftAccessToken(_0x4d8eac,_0x40dcb4){var _0x57aa27={'grant_type':_0xf326('0x41'),'code':_0x4d8eac,'scope':getAccessTokenScope(_0x40dcb4),'redirect_uri':_0x40dcb4[_0xf326('0x22')],'client_id':_0x40dcb4[_0xf326('0x20')],'client_secret':encryptor['decryptString'](_0x40dcb4[_0xf326('0x35')])};var _0x4095e6={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xf326('0x1a')](_0xf326('0x3b'),_0x40dcb4[_0xf326('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57aa27,'json':!![]};return rp(_0x4095e6);}function startRefreshInterval(_0xaf65e0){var _0x51076c=schedule[_0xf326('0x42')];if(_0x51076c[_0xaf65e0['id']])clearInterval(_0x51076c[_0xaf65e0['id']]);_0x51076c[_0xaf65e0['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf326('0x43')](this,{'id':_0xaf65e0['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf326('0x42')]=_0x51076c;}function startAllRefreshIntervals(){return db[_0xf326('0x36')][_0xf326('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3e830d){var _0x1b7bf6=_0x3e830d['map'](function(_0x4dd361){return refreshOauth2MicrosoftAccessToken(_0x4dd361)[_0xf326('0x34')](function(_0x577634){startRefreshInterval(_0x577634);});});return Promise['all'](_0x1b7bf6);})[_0xf326('0x3f')](function(_0x5d6ae2){var _0x3e1e8c=_0x5d6ae2?util[_0xf326('0x45')](_0x5d6ae2,{'showHidden':![],'depth':null}):'';logger[_0xf326('0x46')](_0xf326('0x47'),_0x3e1e8c);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x1261=['toString','randomBytes','data1','response_type','redirect_uri','response_mode','form_post','state','key','value','oauth2Claims','replace','set','stringify','decode','payload','iss','aud','nonce','isAfter','exp','then','data3','CloudProvider','refresh_token','data6','data4','POST','data5','access_token','update','error','decryptString','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','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','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','id_token'];(function(_0x30fd00,_0x33a97f){var _0x2626f2=function(_0x305987){while(--_0x305987){_0x30fd00['push'](_0x30fd00['shift']());}};_0x2626f2(++_0x33a97f);}(_0x1261,0x144));var _0x1126=function(_0x2383bc,_0x2d5ec9){_0x2383bc=_0x2383bc-0x0;var _0x283573=_0x1261[_0x2383bc];return _0x283573;};'use strict';var _=require('lodash');var crypto=require(_0x1126('0x0'));var jwt=require(_0x1126('0x1'));var moment=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var util=require(_0x1126('0x5'));var encryptor=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var logger=require(_0x1126('0x8'))(_0x1126('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x1126('0xa')]=_[_0x1126('0xb')](config['redis'],{'host':_0x1126('0xc'),'port':0x18eb});var redis=new Redis(config[_0x1126('0xa')]);var MICROSOFT_AUTH_URL=_0x1126('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1126('0xe'),_0x1126('0xf'),'email',_0x1126('0x10'),_0x1126('0x11'),_0x1126('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1126('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x1126('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x561b93){var _0x15e89b=_[_0x1126('0x14')](AZURE_AUTH_SCOPES[_0x561b93[_0x1126('0x15')]]);if(_0x561b93[_0x1126('0x15')]===_0x1126('0x16'))_0x15e89b[_0x1126('0x17')](_0x561b93[_0x1126('0x18')]+_0x1126('0x19'));return _0x15e89b[_0x1126('0x1a')]('\x20');}function getAccessTokenScope(_0x53a8f0){if(_0x53a8f0['type']===_0x1126('0x1b'))return _0x1126('0x11');if(_0x53a8f0[_0x1126('0x15')]==='Dynamics365')return _0x53a8f0[_0x1126('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x35fe9f,_0x42f379){var _0x257b5f=MICROSOFT_AUTH_URL['replace'](_0x1126('0x1c'),_0x35fe9f[_0x1126('0x1d')]);var _0x4a7b49=['code',_0x1126('0x1e')];var _0x2b2487=Buffer['from'](JSON['stringify']({'id':_0x42f379}))[_0x1126('0x1f')]('base64');var _0x22ed37=crypto[_0x1126('0x20')](0x10)[_0x1126('0x1f')]('hex');var _0x2a08ba=getAuthorizationScopes(_0x35fe9f);var _0x49d209=[{'key':'client_id','value':_0x35fe9f[_0x1126('0x21')]},{'key':_0x1126('0x22'),'value':encodeURIComponent(_0x4a7b49[_0x1126('0x1a')]('\x20'))},{'key':_0x1126('0x23'),'value':_0x35fe9f['data4']},{'key':_0x1126('0x24'),'value':_0x1126('0x25')},{'key':'scope','value':encodeURIComponent(_0x2a08ba)},{'key':_0x1126('0x26'),'value':_0x2b2487},{'key':'nonce','value':_0x22ed37},{'key':'prompt','value':'login'}];var _0x2199d9=_0x257b5f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1126('0x14')](_0x49d209,function(_0x329914){return _0x329914[_0x1126('0x27')]+'='+_0x329914[_0x1126('0x28')];})[_0x1126('0x1a')]('&');_0x35fe9f[_0x1126('0x29')]={'issuer':_0x257b5f[_0x1126('0x2a')]('oauth2/',''),'audience':_0x35fe9f[_0x1126('0x21')],'state':_0x2b2487,'nonce':_0x22ed37};redis[_0x1126('0x2b')](_0x2b2487,JSON[_0x1126('0x2c')](_0x35fe9f));return _0x2199d9;}function isValidIdToken(_0x5ddf63,_0x541bc9){try{var _0xeb7d89=jwt[_0x1126('0x2d')](_0x5ddf63,{'complete':!![]});var _0x55e195=_0xeb7d89[_0x1126('0x2e')];if(_0x55e195[_0x1126('0x2f')]!==_0x541bc9['issuer'])return![];if(_0x55e195[_0x1126('0x30')]!==_0x541bc9['audience'])return![];if(_0x55e195[_0x1126('0x31')]!==_0x541bc9['nonce'])return![];if(moment()[_0x1126('0x32')](moment['unix'](_0x55e195[_0x1126('0x33')])))return![];return!![];}catch(_0x5f2611){throw _0x5f2611;}}function refreshOauth2MicrosoftAccessToken(_0x5252e0){return Promise['resolve']()[_0x1126('0x34')](function(){if(_0x5252e0[_0x1126('0x35')])return _0x5252e0;return db[_0x1126('0x36')]['findOne']({'where':{'id':_0x5252e0['id']},'raw':!![]});})[_0x1126('0x34')](function(_0x226afb){var _0x56f7f8={'grant_type':_0x1126('0x37'),'refresh_token':_0x226afb[_0x1126('0x38')],'scope':getAccessTokenScope(_0x226afb),'redirect_uri':_0x226afb[_0x1126('0x39')],'client_id':_0x226afb[_0x1126('0x21')],'client_secret':encryptor['decryptString'](_0x226afb['data3'])};var _0x2a7edc={'method':_0x1126('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')](_0x1126('0x1c'),_0x226afb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x56f7f8,'json':!![]};return rp(_0x2a7edc);})[_0x1126('0x34')](function(_0x6f4312){_0x5252e0[_0x1126('0x3b')]=_0x6f4312[_0x1126('0x3c')];_0x5252e0[_0x1126('0x38')]=_0x6f4312['refresh_token'];return db[_0x1126('0x36')][_0x1126('0x3d')]({'data5':_0x5252e0[_0x1126('0x3b')],'data6':_0x5252e0[_0x1126('0x38')]},{'where':{'id':_0x5252e0['id']}});})['then'](function(){return _0x5252e0;})['catch'](function(_0x22827a){logger[_0x1126('0x3e')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s',_0x5252e0['id'],_0x22827a);});}function getOauth2MicrosoftAccessToken(_0xde37cf,_0xf3c21b){var _0x11b0f6={'grant_type':'authorization_code','code':_0xde37cf,'scope':getAccessTokenScope(_0xf3c21b),'redirect_uri':_0xf3c21b['data4'],'client_id':_0xf3c21b[_0x1126('0x21')],'client_secret':encryptor[_0x1126('0x3f')](_0xf3c21b[_0x1126('0x35')])};var _0x156554={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')]('{TENANT_ID}',_0xf3c21b[_0x1126('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11b0f6,'json':!![]};return rp(_0x156554);}function startRefreshInterval(_0x20e43a){var _0xfa96e0=schedule[_0x1126('0x40')];if(_0xfa96e0[_0x20e43a['id']])clearInterval(_0xfa96e0[_0x20e43a['id']]);_0xfa96e0[_0x20e43a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1126('0x41')](this,{'id':_0x20e43a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xfa96e0;}function startAllRefreshIntervals(){return db[_0x1126('0x36')][_0x1126('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1126('0x34')](function(_0x397e3b){var _0x3469a2=_0x397e3b[_0x1126('0x14')](function(_0x3052f9){return refreshOauth2MicrosoftAccessToken(_0x3052f9)['then'](function(_0x1c8d8a){startRefreshInterval(_0x1c8d8a);});});return Promise[_0x1126('0x43')](_0x3469a2);})[_0x1126('0x44')](function(_0xf3a0bd){var _0xcf0483=_0xf3a0bd?util['inspect'](_0xf3a0bd,{'showHidden':![],'depth':null}):'';logger['error'](_0x1126('0x45'),_0xcf0483);});}module[_0x1126('0x46')]={'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 404868a..2a95dc3 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 _0x7d37=['jayson/promise','http','request','then','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x7d37,0x1db));var _0x77d3=function(_0x1ef901,_0x3e39e3){_0x1ef901=_0x1ef901-0x0;var _0x333d2b=_0x7d37[_0x1ef901];return _0x333d2b;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require('bluebird');var rs=require(_0x77d3('0x3'));var fs=require('fs');var Redis=require(_0x77d3('0x4'));var db=require(_0x77d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d3('0x6'))(_0x77d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x77d3('0x8'));var client=jayson['client'][_0x77d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x519c6e,_0x40235d,_0x373da8){return new BPromise(function(_0x5c0108,_0x555390){return client[_0x77d3('0xa')](_0x519c6e,_0x373da8)[_0x77d3('0xb')](function(_0x506caa){logger[_0x77d3('0xc')]('CloudProvider,\x20%s,\x20%s',_0x40235d,_0x77d3('0xd'));logger['debug'](_0x77d3('0xe'),_0x40235d,'request\x20sent',JSON[_0x77d3('0xf')](_0x506caa));if(_0x506caa[_0x77d3('0x10')]){if(_0x506caa[_0x77d3('0x10')][_0x77d3('0x11')]===0x1f4){logger[_0x77d3('0x10')](_0x77d3('0x12'),_0x40235d,_0x506caa[_0x77d3('0x10')][_0x77d3('0x13')]);return _0x555390(_0x506caa[_0x77d3('0x10')]['message']);}logger[_0x77d3('0x10')]('CloudProvider,\x20%s,\x20%s',_0x40235d,_0x506caa['error']['message']);return _0x5c0108(_0x506caa[_0x77d3('0x10')][_0x77d3('0x13')]);}else{logger[_0x77d3('0xc')](_0x77d3('0x12'),_0x40235d,_0x77d3('0xd'));_0x5c0108(_0x506caa['result'][_0x77d3('0x13')]);}})[_0x77d3('0x14')](function(_0x5e92d8){logger['error'](_0x77d3('0x12'),_0x40235d,_0x5e92d8);_0x555390(_0x5e92d8);});});} \ No newline at end of file +var _0x8322=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x41f5ba,_0xd0ffa8){var _0x535e03=function(_0x7b8c37){while(--_0x7b8c37){_0x41f5ba['push'](_0x41f5ba['shift']());}};_0x535e03(++_0xd0ffa8);}(_0x8322,0x186));var _0x2832=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x8322[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var moment=require(_0x2832('0x2'));var BPromise=require(_0x2832('0x3'));var rs=require(_0x2832('0x4'));var fs=require('fs');var Redis=require(_0x2832('0x5'));var db=require(_0x2832('0x6'))['db'];var utils=require(_0x2832('0x7'));var logger=require(_0x2832('0x8'))(_0x2832('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2832('0xa')][_0x2832('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xab2c39,_0x29a788,_0x1488df){return new BPromise(function(_0x4b0ca8,_0xb57a3c){return client[_0x2832('0xc')](_0xab2c39,_0x1488df)[_0x2832('0xd')](function(_0xb1f005){logger['info'](_0x2832('0xe'),_0x29a788,_0x2832('0xf'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'),JSON['stringify'](_0xb1f005));if(_0xb1f005['error']){if(_0xb1f005[_0x2832('0x10')][_0x2832('0x11')]===0x1f4){logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005['error'][_0x2832('0x12')]);return _0xb57a3c(_0xb1f005[_0x2832('0x10')]['message']);}logger[_0x2832('0x10')](_0x2832('0xe'),_0x29a788,_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);return _0x4b0ca8(_0xb1f005[_0x2832('0x10')][_0x2832('0x12')]);}else{logger[_0x2832('0x13')]('CloudProvider,\x20%s,\x20%s',_0x29a788,_0x2832('0xf'));_0x4b0ca8(_0xb1f005[_0x2832('0x14')]['message']);}})[_0x2832('0x15')](function(_0x56d1e6){logger[_0x2832('0x10')]('CloudProvider,\x20%s,\x20%s',_0x29a788,_0x56d1e6);_0xb57a3c(_0x56d1e6);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 18dc879..474dad4 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x52b3ea,_0x55e041){var _0x448a0b=function(_0x569ca3){while(--_0x569ca3){_0x52b3ea['push'](_0x52b3ea['shift']());}};_0x448a0b(++_0x55e041);}(_0xadb5,0xad));var _0x5adb=function(_0x9c3e65,_0x379b8e){_0x9c3e65=_0x9c3e65-0x0;var _0xaf5ffd=_0xadb5[_0x9c3e65];return _0xaf5ffd;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0xda7474,_0x568b1e){var _0x1d582c=function(_0x4564f8){while(--_0x4564f8){_0xda7474['push'](_0xda7474['shift']());}};_0x1d582c(++_0x568b1e);}(_0x2ef3,0xba));var _0x32ef=function(_0x1413b3,_0x366db0){_0x1413b3=_0x1413b3-0x0;var _0x5db7e0=_0x2ef3[_0x1413b3];return _0x5db7e0;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 0ed9dc0..cfd9662 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 _0xcb3d=['exports','STRING','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcb3d,0x71));var _0xdcb3=function(_0x28912f,_0x37ae08){_0x28912f=_0x28912f-0x0;var _0x5c824=_0xcb3d[_0x28912f];return _0x5c824;};'use strict';var Sequelize=require(_0xdcb3('0x0'));module[_0xdcb3('0x1')]={'name':{'type':Sequelize[_0xdcb3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xdcb3('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdcb3('0x2')]},'fax':{'type':Sequelize[_0xdcb3('0x2')]},'type':{'type':Sequelize[_0xdcb3('0x2')]},'street':{'type':Sequelize[_0xdcb3('0x2')]},'postalCode':{'type':Sequelize[_0xdcb3('0x2')]},'city':{'type':Sequelize[_0xdcb3('0x2')]},'country':{'type':Sequelize[_0xdcb3('0x2')]},'email':{'type':Sequelize[_0xdcb3('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xdcb3('0x2')]},'sPostalCode':{'type':Sequelize[_0xdcb3('0x2')]},'sCity':{'type':Sequelize[_0xdcb3('0x2')]},'sCountry':{'type':Sequelize[_0xdcb3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36e1=['sequelize','exports','STRING'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x36e1,0xae));var _0x136e=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x36e1[_0x39780c];return _0x53c19b;};'use strict';var Sequelize=require(_0x136e('0x0'));module[_0x136e('0x1')]={'name':{'type':Sequelize[_0x136e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x136e('0x2')]},'companyId':{'type':Sequelize[_0x136e('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x136e('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x136e('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x136e('0x2')]},'city':{'type':Sequelize[_0x136e('0x2')]},'country':{'type':Sequelize[_0x136e('0x2')]},'email':{'type':Sequelize[_0x136e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x136e('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x136e('0x2')]},'sCity':{'type':Sequelize[_0x136e('0x2')]},'sCountry':{'type':Sequelize[_0x136e('0x2')]},'description':{'type':Sequelize[_0x136e('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fa88f02..5ed3ddf 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 _0x2a51=['getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','CmCompany','includeAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','omit','CmContact','rawAttributes','options'];(function(_0x1e96c9,_0x5f39b4){var _0x1a240c=function(_0x58da21){while(--_0x58da21){_0x1e96c9['push'](_0x1e96c9['shift']());}};_0x1a240c(++_0x5f39b4);}(_0x2a51,0x175));var _0x12a5=function(_0x3b76f0,_0x5043ac){_0x3b76f0=_0x3b76f0-0x0;var _0x1afd7f=_0x2a51[_0x3b76f0];return _0x1afd7f;};'use strict';var emlformat=require(_0x12a5('0x0'));var rimraf=require(_0x12a5('0x1'));var zipdir=require(_0x12a5('0x2'));var jsonpatch=require(_0x12a5('0x3'));var rp=require(_0x12a5('0x4'));var moment=require(_0x12a5('0x5'));var BPromise=require(_0x12a5('0x6'));var Mustache=require(_0x12a5('0x7'));var util=require(_0x12a5('0x8'));var path=require(_0x12a5('0x9'));var sox=require('sox');var csv=require(_0x12a5('0xa'));var ejs=require(_0x12a5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12a5('0xc'));var squel=require(_0x12a5('0xd'));var crypto=require(_0x12a5('0xe'));var jsforce=require(_0x12a5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x12a5('0xa'));var querystring=require(_0x12a5('0x10'));var Papa=require(_0x12a5('0x11'));var Redis=require('ioredis');var authService=require(_0x12a5('0x12'));var qs=require(_0x12a5('0x13'));var as=require(_0x12a5('0x14'));var hardwareService=require(_0x12a5('0x15'));var logger=require(_0x12a5('0x16'))(_0x12a5('0x17'));var utils=require(_0x12a5('0x18'));var config=require(_0x12a5('0x19'));var licenseUtil=require(_0x12a5('0x1a'));var db=require(_0x12a5('0x1b'))['db'];function respondWithStatusCode(_0x411fec,_0x13fe4a){_0x13fe4a=_0x13fe4a||0xcc;return function(_0x2d98b4){if(_0x2d98b4){return _0x411fec[_0x12a5('0x1c')](_0x13fe4a);}return _0x411fec[_0x12a5('0x1d')](_0x13fe4a)[_0x12a5('0x1e')]();};}function respondWithResult(_0x3a1202,_0x39d9f8){_0x39d9f8=_0x39d9f8||0xc8;return function(_0x235983){if(_0x235983){return _0x3a1202['status'](_0x39d9f8)[_0x12a5('0x1f')](_0x235983);}};}function respondWithFilteredResult(_0x303089,_0x419646){return function(_0x5c50a4){if(_0x5c50a4){var _0x1c9a25=typeof _0x419646[_0x12a5('0x20')]==='undefined'&&typeof _0x419646[_0x12a5('0x21')]===_0x12a5('0x22');var _0x16c27b=_0x5c50a4[_0x12a5('0x23')];var _0xb0876=_0x1c9a25?0x0:_0x419646[_0x12a5('0x20')];var _0x344312=_0x1c9a25?_0x5c50a4[_0x12a5('0x23')]:_0x419646[_0x12a5('0x20')]+_0x419646[_0x12a5('0x21')];var _0x17b475;if(_0x344312>=_0x16c27b){_0x344312=_0x16c27b;_0x17b475=0xc8;}else{_0x17b475=0xce;}_0x303089[_0x12a5('0x1d')](_0x17b475);return _0x303089[_0x12a5('0x24')](_0x12a5('0x25'),_0xb0876+'-'+_0x344312+'/'+_0x16c27b)['json'](_0x5c50a4);}return null;};}function patchUpdates(_0x1a1e2d){return function(_0x4072b8){try{jsonpatch[_0x12a5('0x26')](_0x4072b8,_0x1a1e2d,!![]);}catch(_0x35a07d){return BPromise[_0x12a5('0x27')](_0x35a07d);}return _0x4072b8[_0x12a5('0x28')]();};}function saveUpdates(_0x1ea84e,_0x2734ae){return function(_0x3853a9){if(_0x3853a9){return _0x3853a9[_0x12a5('0x29')](_0x1ea84e)[_0x12a5('0x2a')](function(_0x463d6c){return _0x463d6c;});}return null;};}function removeEntity(_0x10c667,_0x34d80f){return function(_0x4f74de){if(_0x4f74de){return _0x4f74de['destroy']()[_0x12a5('0x2a')](function(){var _0x58223a=_0x4f74de[_0x12a5('0x2b')]({'plain':!![]});var _0x1ac8dc=_0x12a5('0x2c');return db[_0x12a5('0x2d')][_0x12a5('0x2e')]({'where':{'type':_0x1ac8dc,'resourceId':_0x58223a['id']}})[_0x12a5('0x2a')](function(){return _0x4f74de;});})['then'](function(){_0x10c667[_0x12a5('0x1d')](0xcc)[_0x12a5('0x1e')]();});}};}function handleEntityNotFound(_0x496e9d,_0x17b716){return function(_0x2fb634){if(!_0x2fb634){_0x496e9d['sendStatus'](0x194);}return _0x2fb634;};}function handleError(_0x32b86d,_0x2cdb85){_0x2cdb85=_0x2cdb85||0x1f4;return function(_0x2ce408){logger[_0x12a5('0x2f')](_0x2ce408[_0x12a5('0x30')]);if(_0x2ce408[_0x12a5('0x31')]){delete _0x2ce408[_0x12a5('0x31')];}_0x32b86d[_0x12a5('0x1d')](_0x2cdb85)[_0x12a5('0x32')](_0x2ce408);};}exports[_0x12a5('0x33')]=function(_0x46e655,_0x1c58f7){var _0xf6dbaf={},_0x190025={},_0x17cc38={'count':0x0,'rows':[]};return db['CmCompany'][_0x12a5('0x34')]()['then'](function(_0x166645){_0x190025[_0x12a5('0x35')]=_['keys'](_0x166645);_0x190025['query']=_[_0x12a5('0x36')](_0x46e655[_0x12a5('0x37')]);_0x190025[_0x12a5('0x38')]=_['intersection'](_0x190025[_0x12a5('0x35')],_0x190025[_0x12a5('0x37')]);_0xf6dbaf['attributes']=_[_0x12a5('0x39')](_0x190025[_0x12a5('0x35')],qs[_0x12a5('0x3a')](_0x46e655[_0x12a5('0x37')][_0x12a5('0x3a')]));_0xf6dbaf[_0x12a5('0x3b')]=_0xf6dbaf[_0x12a5('0x3b')][_0x12a5('0x3c')]?_0xf6dbaf[_0x12a5('0x3b')]:_0x190025['model'];if(!_0x46e655[_0x12a5('0x37')][_0x12a5('0x3d')](_0x12a5('0x3e'))){_0xf6dbaf[_0x12a5('0x21')]=qs[_0x12a5('0x21')](_0x46e655[_0x12a5('0x37')][_0x12a5('0x21')]);_0xf6dbaf[_0x12a5('0x20')]=qs[_0x12a5('0x20')](_0x46e655[_0x12a5('0x37')][_0x12a5('0x20')]);}_0xf6dbaf[_0x12a5('0x3f')]=qs[_0x12a5('0x40')](_0x46e655[_0x12a5('0x37')]['sort']);_0xf6dbaf[_0x12a5('0x41')]=qs['filters'](_[_0x12a5('0x42')](_0x46e655['query'],_0x190025[_0x12a5('0x38')]),_0x166645);if(_0x46e655['query'][_0x12a5('0x43')]){_0xf6dbaf[_0x12a5('0x41')]=_[_0x12a5('0x44')](_0xf6dbaf['where'],{'$or':_[_0x12a5('0x45')](_0xf6dbaf[_0x12a5('0x3b')],function(_0x2f7cda){var _0x1e9b53={};_0x1e9b53[_0x2f7cda]={'$like':'%'+_0x46e655[_0x12a5('0x37')][_0x12a5('0x43')]+'%'};return _0x1e9b53;})});}_0xf6dbaf=_[_0x12a5('0x44')]({},_0xf6dbaf,_0x46e655['options']);var _0x2bce13={'where':_0xf6dbaf[_0x12a5('0x41')]};return db[_0x12a5('0x46')][_0x12a5('0x23')](_0x2bce13)[_0x12a5('0x2a')](function(_0x29b6f8){_0x17cc38['count']=_0x29b6f8;if(_0x46e655[_0x12a5('0x37')][_0x12a5('0x47')]){_0xf6dbaf['include']=[{'all':!![]}];}return db[_0x12a5('0x46')]['findAll'](_0xf6dbaf);})[_0x12a5('0x2a')](function(_0x5812bc){_0x17cc38[_0x12a5('0x48')]=_0x5812bc;return _0x17cc38;})['then'](respondWithFilteredResult(_0x1c58f7,_0xf6dbaf))[_0x12a5('0x49')](handleError(_0x1c58f7,null));})[_0x12a5('0x49')](handleError(_0x1c58f7,null));};exports[_0x12a5('0x4a')]=function(_0x23d203,_0x3ff9ce){var _0xb634ba={'raw':![],'where':{'id':_0x23d203['params']['id']}},_0x3f8019={};_0x3f8019[_0x12a5('0x35')]=_['keys'](db[_0x12a5('0x46')]['rawAttributes']);_0x3f8019['query']=_[_0x12a5('0x36')](_0x23d203[_0x12a5('0x37')]);_0x3f8019[_0x12a5('0x38')]=_[_0x12a5('0x39')](_0x3f8019[_0x12a5('0x35')],_0x3f8019['query']);_0xb634ba[_0x12a5('0x3b')]=_[_0x12a5('0x39')](_0x3f8019[_0x12a5('0x35')],qs[_0x12a5('0x3a')](_0x23d203[_0x12a5('0x37')][_0x12a5('0x3a')]));_0xb634ba[_0x12a5('0x3b')]=_0xb634ba[_0x12a5('0x3b')][_0x12a5('0x3c')]?_0xb634ba[_0x12a5('0x3b')]:_0x3f8019[_0x12a5('0x35')];if(_0x23d203[_0x12a5('0x37')][_0x12a5('0x47')]){_0xb634ba[_0x12a5('0x4b')]=[{'all':!![]}];}_0xb634ba=_['merge']({},_0xb634ba,_0x23d203['options']);return db[_0x12a5('0x46')][_0x12a5('0x4c')](_0xb634ba)[_0x12a5('0x2a')](handleEntityNotFound(_0x3ff9ce,null))[_0x12a5('0x2a')](respondWithResult(_0x3ff9ce,null))['catch'](handleError(_0x3ff9ce,null));};exports[_0x12a5('0x4d')]=function(_0x553718,_0x2869e5){return db['CmCompany'][_0x12a5('0x4d')](_0x553718[_0x12a5('0x4e')],{})[_0x12a5('0x2a')](function(_0xcf5424){var _0xb0be31=_0x553718[_0x12a5('0x4f')][_0x12a5('0x2b')]({'plain':!![]});if(!_0xb0be31)throw new Error(_0x12a5('0x50'));if(_0xb0be31[_0x12a5('0x51')]===_0x12a5('0x4f')){var _0x15c703=_0xcf5424[_0x12a5('0x2b')]({'plain':!![]});var _0x50bbe7=_0x12a5('0x2c');return db[_0x12a5('0x52')][_0x12a5('0x4c')]({'where':{'name':_0x50bbe7,'userProfileId':_0xb0be31['userProfileId']},'raw':!![]})[_0x12a5('0x2a')](function(_0x1edcb7){if(_0x1edcb7&&_0x1edcb7[_0x12a5('0x53')]===0x0){return db[_0x12a5('0x2d')]['create']({'name':_0x15c703[_0x12a5('0x31')],'resourceId':_0x15c703['id'],'type':_0x1edcb7['name'],'sectionId':_0x1edcb7['id']},{})[_0x12a5('0x2a')](function(){return _0xcf5424;});}else{return _0xcf5424;}})[_0x12a5('0x49')](function(_0x52d845){logger['error'](_0x12a5('0x54'),_0x52d845);throw _0x52d845;});}return _0xcf5424;})[_0x12a5('0x2a')](respondWithResult(_0x2869e5,0xc9))[_0x12a5('0x49')](handleError(_0x2869e5,null));};exports[_0x12a5('0x29')]=function(_0x26e13f,_0x397550){if(_0x26e13f['body']['id']){delete _0x26e13f[_0x12a5('0x4e')]['id'];}return db['CmCompany'][_0x12a5('0x4c')]({'where':{'id':_0x26e13f[_0x12a5('0x55')]['id']}})[_0x12a5('0x2a')](handleEntityNotFound(_0x397550,null))[_0x12a5('0x2a')](saveUpdates(_0x26e13f['body'],null))['then'](respondWithResult(_0x397550,null))[_0x12a5('0x49')](handleError(_0x397550,null));};exports[_0x12a5('0x2e')]=function(_0xaa090b,_0x395882){return db['CmCompany'][_0x12a5('0x4c')]({'where':{'id':_0xaa090b[_0x12a5('0x55')]['id']}})[_0x12a5('0x2a')](handleEntityNotFound(_0x395882,null))[_0x12a5('0x2a')](removeEntity(_0x395882,null))['catch'](handleError(_0x395882,null));};exports[_0x12a5('0x34')]=function(_0x403141,_0x8c700d){return db[_0x12a5('0x46')]['describe']()[_0x12a5('0x2a')](respondWithResult(_0x8c700d,null))[_0x12a5('0x49')](handleError(_0x8c700d,null));};exports[_0x12a5('0x56')]=function(_0x290b64,_0x351f55,_0x19725c){return db['CmContact']['find']({'where':{'id':_0x290b64[_0x12a5('0x55')]['id']}})[_0x12a5('0x2a')](handleEntityNotFound(_0x351f55,null))[_0x12a5('0x2a')](function(_0x3468d0){if(_0x3468d0){return _0x3468d0['addContacts'](_0x290b64[_0x12a5('0x4e')][_0x12a5('0x57')],_[_0x12a5('0x58')](_0x290b64[_0x12a5('0x4e')],['ids','id'])||{});}})[_0x12a5('0x2a')](respondWithResult(_0x351f55,null))[_0x12a5('0x49')](handleError(_0x351f55,null));};exports['getContacts']=function(_0x35a47e,_0x20ddca,_0x555a7c){var _0x2ea7a9={};var _0x3d9c88={};var _0x284874;var _0xbd8c95;return db[_0x12a5('0x46')]['findOne']({'where':{'id':_0x35a47e[_0x12a5('0x55')]['id']}})['then'](handleEntityNotFound(_0x20ddca,null))[_0x12a5('0x2a')](function(_0x5bbb30){if(_0x5bbb30){_0x284874=_0x5bbb30;_0x3d9c88[_0x12a5('0x35')]=_['keys'](db[_0x12a5('0x59')][_0x12a5('0x5a')]);_0x3d9c88[_0x12a5('0x37')]=_['keys'](_0x35a47e['query']);_0x3d9c88[_0x12a5('0x38')]=_[_0x12a5('0x39')](_0x3d9c88[_0x12a5('0x35')],_0x3d9c88[_0x12a5('0x37')]);_0x2ea7a9[_0x12a5('0x3b')]=_[_0x12a5('0x39')](_0x3d9c88[_0x12a5('0x35')],qs[_0x12a5('0x3a')](_0x35a47e[_0x12a5('0x37')][_0x12a5('0x3a')]));_0x2ea7a9['attributes']=_0x2ea7a9[_0x12a5('0x3b')][_0x12a5('0x3c')]?_0x2ea7a9[_0x12a5('0x3b')]:_0x3d9c88['model'];_0x2ea7a9['order']=qs['sort'](_0x35a47e['query'][_0x12a5('0x40')]);_0x2ea7a9[_0x12a5('0x41')]=qs[_0x12a5('0x38')](_[_0x12a5('0x42')](_0x35a47e['query'],_0x3d9c88[_0x12a5('0x38')]));if(_0x35a47e['query'][_0x12a5('0x43')]){_0x2ea7a9['where']=_[_0x12a5('0x44')](_0x2ea7a9[_0x12a5('0x41')],{'$or':_[_0x12a5('0x45')](_0x2ea7a9[_0x12a5('0x3b')],function(_0x508249){var _0x20ede8={};_0x20ede8[_0x508249]={'$like':'%'+_0x35a47e[_0x12a5('0x37')][_0x12a5('0x43')]+'%'};return _0x20ede8;})});}_0x2ea7a9=_[_0x12a5('0x44')]({},_0x2ea7a9,_0x35a47e[_0x12a5('0x5b')]);return _0x284874[_0x12a5('0x5c')](_0x2ea7a9);}})[_0x12a5('0x2a')](function(_0x405082){if(_0x405082){_0xbd8c95=_0x405082['length'];if(!_0x35a47e[_0x12a5('0x37')][_0x12a5('0x3d')](_0x12a5('0x3e'))){_0x2ea7a9[_0x12a5('0x21')]=qs[_0x12a5('0x21')](_0x35a47e[_0x12a5('0x37')][_0x12a5('0x21')]);_0x2ea7a9['offset']=qs[_0x12a5('0x20')](_0x35a47e[_0x12a5('0x37')][_0x12a5('0x20')]);}return _0x284874['getContacts'](_0x2ea7a9);}})[_0x12a5('0x2a')](function(_0x193f54){if(_0x193f54){return _0x193f54?{'count':_0xbd8c95,'rows':_0x193f54}:null;}})['then'](respondWithResult(_0x20ddca,null))[_0x12a5('0x49')](handleError(_0x20ddca,null));}; \ No newline at end of file +var _0xb932=['UserProfileSection','userProfileId','autoAssociation','error','update','body','addContacts','CmContact','ids','omit','getContacts','findOne','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','stack','name','send','CmCompany','describe','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','map','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2f33c8,_0x57018c){var _0x2acf21=function(_0x5a8020){while(--_0x5a8020){_0x2f33c8['push'](_0x2f33c8['shift']());}};_0x2acf21(++_0x57018c);}(_0xb932,0x114));var _0x2b93=function(_0x4b9be2,_0x7f791e){_0x4b9be2=_0x4b9be2-0x0;var _0x43093c=_0xb932[_0x4b9be2];return _0x43093c;};'use strict';var emlformat=require(_0x2b93('0x0'));var rimraf=require(_0x2b93('0x1'));var zipdir=require(_0x2b93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b93('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2b93('0x4'));var util=require(_0x2b93('0x5'));var path=require(_0x2b93('0x6'));var sox=require(_0x2b93('0x7'));var csv=require(_0x2b93('0x8'));var ejs=require(_0x2b93('0x9'));var fs=require('fs');var fs_extra=require(_0x2b93('0xa'));var _=require(_0x2b93('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b93('0xc'));var deskjs=require(_0x2b93('0xd'));var toCsv=require(_0x2b93('0x8'));var querystring=require(_0x2b93('0xe'));var Papa=require(_0x2b93('0xf'));var Redis=require('ioredis');var authService=require(_0x2b93('0x10'));var qs=require(_0x2b93('0x11'));var as=require(_0x2b93('0x12'));var hardwareService=require(_0x2b93('0x13'));var logger=require(_0x2b93('0x14'))(_0x2b93('0x15'));var utils=require(_0x2b93('0x16'));var config=require(_0x2b93('0x17'));var licenseUtil=require(_0x2b93('0x18'));var db=require(_0x2b93('0x19'))['db'];function respondWithStatusCode(_0x3b2799,_0x42577c){_0x42577c=_0x42577c||0xcc;return function(_0x3a5cc1){if(_0x3a5cc1){return _0x3b2799[_0x2b93('0x1a')](_0x42577c);}return _0x3b2799['status'](_0x42577c)[_0x2b93('0x1b')]();};}function respondWithResult(_0x5f041f,_0x14c3d2){_0x14c3d2=_0x14c3d2||0xc8;return function(_0x43e7f6){if(_0x43e7f6){return _0x5f041f[_0x2b93('0x1c')](_0x14c3d2)[_0x2b93('0x1d')](_0x43e7f6);}};}function respondWithFilteredResult(_0x40f4e8,_0x14f628){return function(_0x3b0ca5){if(_0x3b0ca5){var _0x5ab0f1=typeof _0x14f628[_0x2b93('0x1e')]==='undefined'&&typeof _0x14f628[_0x2b93('0x1f')]===_0x2b93('0x20');var _0xf21713=_0x3b0ca5['count'];var _0x1630fc=_0x5ab0f1?0x0:_0x14f628['offset'];var _0x26950a=_0x5ab0f1?_0x3b0ca5[_0x2b93('0x21')]:_0x14f628[_0x2b93('0x1e')]+_0x14f628[_0x2b93('0x1f')];var _0x550f5a;if(_0x26950a>=_0xf21713){_0x26950a=_0xf21713;_0x550f5a=0xc8;}else{_0x550f5a=0xce;}_0x40f4e8[_0x2b93('0x1c')](_0x550f5a);return _0x40f4e8[_0x2b93('0x22')](_0x2b93('0x23'),_0x1630fc+'-'+_0x26950a+'/'+_0xf21713)['json'](_0x3b0ca5);}return null;};}function patchUpdates(_0xc1031f){return function(_0x5897e0){try{jsonpatch[_0x2b93('0x24')](_0x5897e0,_0xc1031f,!![]);}catch(_0x3748c0){return BPromise[_0x2b93('0x25')](_0x3748c0);}return _0x5897e0['save']();};}function saveUpdates(_0x36ca7d,_0x375f2a){return function(_0x363208){if(_0x363208){return _0x363208['update'](_0x36ca7d)[_0x2b93('0x26')](function(_0x2b213c){return _0x2b213c;});}return null;};}function removeEntity(_0x3cf9c7,_0x2a787b){return function(_0x33855e){if(_0x33855e){return _0x33855e[_0x2b93('0x27')]()[_0x2b93('0x26')](function(){var _0x1919a0=_0x33855e['get']({'plain':!![]});var _0x3bdb65='Companies';return db[_0x2b93('0x28')]['destroy']({'where':{'type':_0x3bdb65,'resourceId':_0x1919a0['id']}})[_0x2b93('0x26')](function(){return _0x33855e;});})[_0x2b93('0x26')](function(){_0x3cf9c7[_0x2b93('0x1c')](0xcc)[_0x2b93('0x1b')]();});}};}function handleEntityNotFound(_0x29c05b,_0x39289d){return function(_0x5476cf){if(!_0x5476cf){_0x29c05b[_0x2b93('0x1a')](0x194);}return _0x5476cf;};}function handleError(_0x40ea28,_0x5f5b8b){_0x5f5b8b=_0x5f5b8b||0x1f4;return function(_0x1f7a90){logger['error'](_0x1f7a90[_0x2b93('0x29')]);if(_0x1f7a90[_0x2b93('0x2a')]){delete _0x1f7a90['name'];}_0x40ea28[_0x2b93('0x1c')](_0x5f5b8b)[_0x2b93('0x2b')](_0x1f7a90);};}exports['index']=function(_0xafab08,_0xbf6fff){var _0x1d5366={},_0x5c69cb={},_0x205cda={'count':0x0,'rows':[]};return db[_0x2b93('0x2c')][_0x2b93('0x2d')]()[_0x2b93('0x26')](function(_0x40b5f3){_0x5c69cb['model']=_[_0x2b93('0x2e')](_0x40b5f3);_0x5c69cb[_0x2b93('0x2f')]=_[_0x2b93('0x2e')](_0xafab08[_0x2b93('0x2f')]);_0x5c69cb['filters']=_['intersection'](_0x5c69cb[_0x2b93('0x30')],_0x5c69cb['query']);_0x1d5366[_0x2b93('0x31')]=_[_0x2b93('0x32')](_0x5c69cb['model'],qs[_0x2b93('0x33')](_0xafab08[_0x2b93('0x2f')][_0x2b93('0x33')]));_0x1d5366[_0x2b93('0x31')]=_0x1d5366[_0x2b93('0x31')][_0x2b93('0x34')]?_0x1d5366[_0x2b93('0x31')]:_0x5c69cb['model'];if(!_0xafab08[_0x2b93('0x2f')][_0x2b93('0x35')]('nolimit')){_0x1d5366['limit']=qs['limit'](_0xafab08[_0x2b93('0x2f')][_0x2b93('0x1f')]);_0x1d5366[_0x2b93('0x1e')]=qs[_0x2b93('0x1e')](_0xafab08[_0x2b93('0x2f')][_0x2b93('0x1e')]);}_0x1d5366[_0x2b93('0x36')]=qs[_0x2b93('0x37')](_0xafab08[_0x2b93('0x2f')]['sort']);_0x1d5366[_0x2b93('0x38')]=qs['filters'](_[_0x2b93('0x39')](_0xafab08[_0x2b93('0x2f')],_0x5c69cb[_0x2b93('0x3a')]),_0x40b5f3);if(_0xafab08[_0x2b93('0x2f')][_0x2b93('0x3b')]){_0x1d5366[_0x2b93('0x38')]=_['merge'](_0x1d5366[_0x2b93('0x38')],{'$or':_[_0x2b93('0x3c')](_0x1d5366[_0x2b93('0x31')],function(_0x454012){var _0x43fe38={};_0x43fe38[_0x454012]={'$like':'%'+_0xafab08[_0x2b93('0x2f')][_0x2b93('0x3b')]+'%'};return _0x43fe38;})});}_0x1d5366=_['merge']({},_0x1d5366,_0xafab08['options']);var _0x3a1272={'where':_0x1d5366['where']};return db[_0x2b93('0x2c')][_0x2b93('0x21')](_0x3a1272)[_0x2b93('0x26')](function(_0x11d4f1){_0x205cda['count']=_0x11d4f1;if(_0xafab08['query'][_0x2b93('0x3d')]){_0x1d5366[_0x2b93('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0x2b93('0x3f')](_0x1d5366);})[_0x2b93('0x26')](function(_0x4f4962){_0x205cda[_0x2b93('0x40')]=_0x4f4962;return _0x205cda;})[_0x2b93('0x26')](respondWithFilteredResult(_0xbf6fff,_0x1d5366))[_0x2b93('0x41')](handleError(_0xbf6fff,null));})[_0x2b93('0x41')](handleError(_0xbf6fff,null));};exports['show']=function(_0x5bb7e2,_0x39a72c){var _0x43643f={'raw':![],'where':{'id':_0x5bb7e2[_0x2b93('0x42')]['id']}},_0x4a5b16={};_0x4a5b16[_0x2b93('0x30')]=_[_0x2b93('0x2e')](db[_0x2b93('0x2c')][_0x2b93('0x43')]);_0x4a5b16[_0x2b93('0x2f')]=_[_0x2b93('0x2e')](_0x5bb7e2['query']);_0x4a5b16[_0x2b93('0x3a')]=_[_0x2b93('0x32')](_0x4a5b16[_0x2b93('0x30')],_0x4a5b16['query']);_0x43643f[_0x2b93('0x31')]=_[_0x2b93('0x32')](_0x4a5b16[_0x2b93('0x30')],qs[_0x2b93('0x33')](_0x5bb7e2[_0x2b93('0x2f')][_0x2b93('0x33')]));_0x43643f['attributes']=_0x43643f['attributes'][_0x2b93('0x34')]?_0x43643f[_0x2b93('0x31')]:_0x4a5b16[_0x2b93('0x30')];if(_0x5bb7e2[_0x2b93('0x2f')][_0x2b93('0x3d')]){_0x43643f[_0x2b93('0x3e')]=[{'all':!![]}];}_0x43643f=_[_0x2b93('0x44')]({},_0x43643f,_0x5bb7e2[_0x2b93('0x45')]);return db[_0x2b93('0x2c')][_0x2b93('0x46')](_0x43643f)[_0x2b93('0x26')](handleEntityNotFound(_0x39a72c,null))[_0x2b93('0x26')](respondWithResult(_0x39a72c,null))[_0x2b93('0x41')](handleError(_0x39a72c,null));};exports[_0x2b93('0x47')]=function(_0x6a13d5,_0x3bde66){return db[_0x2b93('0x2c')][_0x2b93('0x47')](_0x6a13d5['body'],{})['then'](function(_0x5a0a4d){var _0x349b46=_0x6a13d5[_0x2b93('0x48')][_0x2b93('0x49')]({'plain':!![]});if(!_0x349b46)throw new Error(_0x2b93('0x4a'));if(_0x349b46[_0x2b93('0x4b')]===_0x2b93('0x48')){var _0x1abb52=_0x5a0a4d['get']({'plain':!![]});var _0x535db0='Companies';return db[_0x2b93('0x4c')][_0x2b93('0x46')]({'where':{'name':_0x535db0,'userProfileId':_0x349b46[_0x2b93('0x4d')]},'raw':!![]})[_0x2b93('0x26')](function(_0x1b382a){if(_0x1b382a&&_0x1b382a[_0x2b93('0x4e')]===0x0){return db[_0x2b93('0x28')][_0x2b93('0x47')]({'name':_0x1abb52[_0x2b93('0x2a')],'resourceId':_0x1abb52['id'],'type':_0x1b382a[_0x2b93('0x2a')],'sectionId':_0x1b382a['id']},{})[_0x2b93('0x26')](function(){return _0x5a0a4d;});}else{return _0x5a0a4d;}})['catch'](function(_0x9f81fa){logger[_0x2b93('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9f81fa);throw _0x9f81fa;});}return _0x5a0a4d;})[_0x2b93('0x26')](respondWithResult(_0x3bde66,0xc9))['catch'](handleError(_0x3bde66,null));};exports[_0x2b93('0x50')]=function(_0x97d8a,_0x579ab2){if(_0x97d8a[_0x2b93('0x51')]['id']){delete _0x97d8a[_0x2b93('0x51')]['id'];}return db[_0x2b93('0x2c')][_0x2b93('0x46')]({'where':{'id':_0x97d8a['params']['id']}})[_0x2b93('0x26')](handleEntityNotFound(_0x579ab2,null))[_0x2b93('0x26')](saveUpdates(_0x97d8a[_0x2b93('0x51')],null))['then'](respondWithResult(_0x579ab2,null))[_0x2b93('0x41')](handleError(_0x579ab2,null));};exports[_0x2b93('0x27')]=function(_0xcb6b95,_0x34b1f2){return db[_0x2b93('0x2c')][_0x2b93('0x46')]({'where':{'id':_0xcb6b95[_0x2b93('0x42')]['id']}})['then'](handleEntityNotFound(_0x34b1f2,null))[_0x2b93('0x26')](removeEntity(_0x34b1f2,null))[_0x2b93('0x41')](handleError(_0x34b1f2,null));};exports[_0x2b93('0x2d')]=function(_0x2c68fd,_0x34c129){return db[_0x2b93('0x2c')][_0x2b93('0x2d')]()[_0x2b93('0x26')](respondWithResult(_0x34c129,null))[_0x2b93('0x41')](handleError(_0x34c129,null));};exports[_0x2b93('0x52')]=function(_0x36142d,_0x5e5a0a,_0x46fda9){return db[_0x2b93('0x53')][_0x2b93('0x46')]({'where':{'id':_0x36142d[_0x2b93('0x42')]['id']}})[_0x2b93('0x26')](handleEntityNotFound(_0x5e5a0a,null))['then'](function(_0xeb7351){if(_0xeb7351){return _0xeb7351[_0x2b93('0x52')](_0x36142d[_0x2b93('0x51')][_0x2b93('0x54')],_[_0x2b93('0x55')](_0x36142d[_0x2b93('0x51')],['ids','id'])||{});}})['then'](respondWithResult(_0x5e5a0a,null))[_0x2b93('0x41')](handleError(_0x5e5a0a,null));};exports[_0x2b93('0x56')]=function(_0x1314c5,_0x2c5168,_0x23b72a){var _0x5c49bc={};var _0x356fac={};var _0x21d864;var _0x56ba67;return db['CmCompany'][_0x2b93('0x57')]({'where':{'id':_0x1314c5[_0x2b93('0x42')]['id']}})[_0x2b93('0x26')](handleEntityNotFound(_0x2c5168,null))[_0x2b93('0x26')](function(_0x380534){if(_0x380534){_0x21d864=_0x380534;_0x356fac[_0x2b93('0x30')]=_[_0x2b93('0x2e')](db[_0x2b93('0x53')]['rawAttributes']);_0x356fac[_0x2b93('0x2f')]=_[_0x2b93('0x2e')](_0x1314c5['query']);_0x356fac[_0x2b93('0x3a')]=_[_0x2b93('0x32')](_0x356fac[_0x2b93('0x30')],_0x356fac[_0x2b93('0x2f')]);_0x5c49bc[_0x2b93('0x31')]=_[_0x2b93('0x32')](_0x356fac[_0x2b93('0x30')],qs['fields'](_0x1314c5[_0x2b93('0x2f')]['fields']));_0x5c49bc[_0x2b93('0x31')]=_0x5c49bc['attributes'][_0x2b93('0x34')]?_0x5c49bc[_0x2b93('0x31')]:_0x356fac[_0x2b93('0x30')];_0x5c49bc['order']=qs[_0x2b93('0x37')](_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x37')]);_0x5c49bc[_0x2b93('0x38')]=qs[_0x2b93('0x3a')](_['pick'](_0x1314c5[_0x2b93('0x2f')],_0x356fac[_0x2b93('0x3a')]));if(_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x3b')]){_0x5c49bc[_0x2b93('0x38')]=_[_0x2b93('0x44')](_0x5c49bc['where'],{'$or':_[_0x2b93('0x3c')](_0x5c49bc[_0x2b93('0x31')],function(_0x309c88){var _0x39d218={};_0x39d218[_0x309c88]={'$like':'%'+_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x3b')]+'%'};return _0x39d218;})});}_0x5c49bc=_['merge']({},_0x5c49bc,_0x1314c5[_0x2b93('0x45')]);return _0x21d864[_0x2b93('0x56')](_0x5c49bc);}})[_0x2b93('0x26')](function(_0x48abfc){if(_0x48abfc){_0x56ba67=_0x48abfc[_0x2b93('0x34')];if(!_0x1314c5['query'][_0x2b93('0x35')]('nolimit')){_0x5c49bc[_0x2b93('0x1f')]=qs['limit'](_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x1f')]);_0x5c49bc[_0x2b93('0x1e')]=qs['offset'](_0x1314c5[_0x2b93('0x2f')][_0x2b93('0x1e')]);}return _0x21d864[_0x2b93('0x56')](_0x5c49bc);}})[_0x2b93('0x26')](function(_0x550d87){if(_0x550d87){return _0x550d87?{'count':_0x56ba67,'rows':_0x550d87}:null;}})[_0x2b93('0x26')](respondWithResult(_0x2c5168,null))[_0x2b93('0x41')](handleError(_0x2c5168,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4f22dd0..15d3ff3 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 _0xa66a=['moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','CmCompany','lodash','util','../../config/logger','api'];(function(_0x4e7fc1,_0x100df3){var _0x5db4a4=function(_0x229dde){while(--_0x229dde){_0x4e7fc1['push'](_0x4e7fc1['shift']());}};_0x5db4a4(++_0x100df3);}(_0xa66a,0x110));var _0xaa66=function(_0x53d56d,_0x335d6e){_0x53d56d=_0x53d56d-0x0;var _0xe63b71=_0xa66a[_0x53d56d];return _0xe63b71;};'use strict';var _=require(_0xaa66('0x0'));var util=require(_0xaa66('0x1'));var logger=require(_0xaa66('0x2'))(_0xaa66('0x3'));var moment=require(_0xaa66('0x4'));var BPromise=require(_0xaa66('0x5'));var rp=require(_0xaa66('0x6'));var fs=require('fs');var path=require(_0xaa66('0x7'));var rimraf=require(_0xaa66('0x8'));var config=require('../../config/environment');var attributes=require(_0xaa66('0x9'));module[_0xaa66('0xa')]=function(_0x5edd21,_0x1aaf87){return _0x5edd21['define'](_0xaa66('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5206=['CmCompany','lodash','util','../../config/logger','bluebird','path','rimraf','exports'];(function(_0x5b75ba,_0x22681a){var _0x1b2ced=function(_0x467f78){while(--_0x467f78){_0x5b75ba['push'](_0x5b75ba['shift']());}};_0x1b2ced(++_0x22681a);}(_0x5206,0xc1));var _0x6520=function(_0x557c41,_0x30e964){_0x557c41=_0x557c41-0x0;var _0x141745=_0x5206[_0x557c41];return _0x141745;};'use strict';var _=require(_0x6520('0x0'));var util=require(_0x6520('0x1'));var logger=require(_0x6520('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6520('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6520('0x4'));var rimraf=require(_0x6520('0x5'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x6520('0x6')]=function(_0x19cbe0,_0xfa266c){return _0x19cbe0['define'](_0x6520('0x7'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index b3eadfd..1191c8f 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 _0x521c=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x521c,0x17c));var _0xc521=function(_0x988e85,_0x4cd12f){_0x988e85=_0x988e85-0x0;var _0x49c4f2=_0x521c[_0x988e85];return _0x49c4f2;};'use strict';var _=require(_0xc521('0x0'));var util=require(_0xc521('0x1'));var moment=require('moment');var BPromise=require(_0xc521('0x2'));var rs=require(_0xc521('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc521('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc521('0x5'));var jayson=require(_0xc521('0x6'));var client=jayson['client'][_0xc521('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59f45f,_0x97c03,_0x2f3ca7){return new BPromise(function(_0x1591d6,_0x48adff){return client['request'](_0x59f45f,_0x2f3ca7)['then'](function(_0xaf7f8c){logger[_0xc521('0x8')](_0xc521('0x9'),_0x97c03,_0xc521('0xa'));logger[_0xc521('0xb')](_0xc521('0xc'),_0x97c03,_0xc521('0xa'),JSON[_0xc521('0xd')](_0xaf7f8c));if(_0xaf7f8c[_0xc521('0xe')]){if(_0xaf7f8c[_0xc521('0xe')]['code']===0x1f4){logger[_0xc521('0xe')](_0xc521('0x9'),_0x97c03,_0xaf7f8c[_0xc521('0xe')]['message']);return _0x48adff(_0xaf7f8c['error']['message']);}logger['error'](_0xc521('0x9'),_0x97c03,_0xaf7f8c[_0xc521('0xe')]['message']);return _0x1591d6(_0xaf7f8c[_0xc521('0xe')][_0xc521('0xf')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x97c03,'request\x20sent');_0x1591d6(_0xaf7f8c[_0xc521('0x10')][_0xc521('0xf')]);}})[_0xc521('0x11')](function(_0x12e07a){logger[_0xc521('0xe')]('CmCompany,\x20%s,\x20%s',_0x97c03,_0x12e07a);_0x48adff(_0x12e07a);});});} \ No newline at end of file +var _0x70ad=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','bluebird'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x70ad,0x7b));var _0xd70a=function(_0x306626,_0x425e93){_0x306626=_0x306626-0x0;var _0x466728=_0x70ad[_0x306626];return _0x466728;};'use strict';var _=require(_0xd70a('0x0'));var util=require(_0xd70a('0x1'));var moment=require('moment');var BPromise=require(_0xd70a('0x2'));var rs=require(_0xd70a('0x3'));var fs=require('fs');var Redis=require(_0xd70a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd70a('0x5'));var logger=require('../../config/logger')(_0xd70a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd70a('0x7'));var client=jayson[_0xd70a('0x8')][_0xd70a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x576218,_0x1f33b6,_0x836c5e){return new BPromise(function(_0x5b9120,_0x4298a1){return client[_0xd70a('0xa')](_0x576218,_0x836c5e)[_0xd70a('0xb')](function(_0x536671){logger[_0xd70a('0xc')]('CmCompany,\x20%s,\x20%s',_0x1f33b6,_0xd70a('0xd'));logger[_0xd70a('0xe')](_0xd70a('0xf'),_0x1f33b6,'request\x20sent',JSON[_0xd70a('0x10')](_0x536671));if(_0x536671['error']){if(_0x536671[_0xd70a('0x11')]['code']===0x1f4){logger[_0xd70a('0x11')](_0xd70a('0x12'),_0x1f33b6,_0x536671[_0xd70a('0x11')]['message']);return _0x4298a1(_0x536671['error'][_0xd70a('0x13')]);}logger[_0xd70a('0x11')](_0xd70a('0x12'),_0x1f33b6,_0x536671[_0xd70a('0x11')][_0xd70a('0x13')]);return _0x5b9120(_0x536671[_0xd70a('0x11')][_0xd70a('0x13')]);}else{logger[_0xd70a('0xc')](_0xd70a('0x12'),_0x1f33b6,_0xd70a('0xd'));_0x5b9120(_0x536671['result'][_0xd70a('0x13')]);}})[_0xd70a('0x14')](function(_0x3e480c){logger[_0xd70a('0x11')](_0xd70a('0x12'),_0x1f33b6,_0x3e480c);_0x4298a1(_0x3e480c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index bc59a95..e1877f5 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 _0x41a4=['addContacts','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','post'];(function(_0x181152,_0x33cbbe){var _0x58e3a6=function(_0x58f6f7){while(--_0x58f6f7){_0x181152['push'](_0x181152['shift']());}};_0x58e3a6(++_0x33cbbe);}(_0x41a4,0x155));var _0x441a=function(_0x592722,_0x3db651){_0x592722=_0x592722-0x0;var _0x1eb997=_0x41a4[_0x592722];return _0x1eb997;};'use strict';var multer=require(_0x441a('0x0'));var util=require('util');var path=require(_0x441a('0x1'));var timeout=require(_0x441a('0x2'));var express=require(_0x441a('0x3'));var router=express[_0x441a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x441a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x441a('0x6'));var controller=require(_0x441a('0x7'));router[_0x441a('0x8')]('/',auth[_0x441a('0x9')](),controller[_0x441a('0xa')]);router[_0x441a('0x8')](_0x441a('0xb'),auth[_0x441a('0x9')](),controller[_0x441a('0xc')]);router[_0x441a('0x8')](_0x441a('0xd'),auth[_0x441a('0x9')](),controller['show']);router['get'](_0x441a('0xe'),auth[_0x441a('0x9')](),controller['getContacts']);router[_0x441a('0xf')]('/',auth[_0x441a('0x9')](),controller['create']);router[_0x441a('0xf')]('/:id/contacts',auth[_0x441a('0x9')](),controller[_0x441a('0x10')]);router[_0x441a('0x11')](_0x441a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x441a('0x12')](_0x441a('0xd'),auth[_0x441a('0x9')](),controller[_0x441a('0x13')]);module[_0x441a('0x14')]=router; \ No newline at end of file +var _0xdbcb=['/:id/contacts','post','create','addContacts','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id'];(function(_0x1ef2b0,_0x274ecd){var _0x3d40f4=function(_0x494909){while(--_0x494909){_0x1ef2b0['push'](_0x1ef2b0['shift']());}};_0x3d40f4(++_0x274ecd);}(_0xdbcb,0x1d6));var _0xbdbc=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0xdbcb[_0xfed299];return _0x4ef1f2;};'use strict';var multer=require(_0xbdbc('0x0'));var util=require(_0xbdbc('0x1'));var path=require(_0xbdbc('0x2'));var timeout=require(_0xbdbc('0x3'));var express=require(_0xbdbc('0x4'));var router=express[_0xbdbc('0x5')]();var fs_extra=require(_0xbdbc('0x6'));var auth=require(_0xbdbc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbdbc('0x8'));var controller=require('./cmCompany.controller');router[_0xbdbc('0x9')]('/',auth[_0xbdbc('0xa')](),controller['index']);router[_0xbdbc('0x9')]('/describe',auth[_0xbdbc('0xa')](),controller[_0xbdbc('0xb')]);router[_0xbdbc('0x9')](_0xbdbc('0xc'),auth[_0xbdbc('0xa')](),controller['show']);router[_0xbdbc('0x9')](_0xbdbc('0xd'),auth[_0xbdbc('0xa')](),controller['getContacts']);router[_0xbdbc('0xe')]('/',auth[_0xbdbc('0xa')](),controller[_0xbdbc('0xf')]);router[_0xbdbc('0xe')](_0xbdbc('0xd'),auth['isAuthenticated'](),controller[_0xbdbc('0x10')]);router[_0xbdbc('0x11')](_0xbdbc('0xc'),auth[_0xbdbc('0xa')](),controller[_0xbdbc('0x12')]);router['delete']('/:id',auth[_0xbdbc('0xa')](),controller[_0xbdbc('0x13')]);module[_0xbdbc('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1485a3e..93885dd 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 _0xbf16=['STRING','TEXT','INTEGER','NOW','lodash','sequelize','exports'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0xbf16,0x6d));var _0x6bf1=function(_0xa73c37,_0x10d29f){_0xa73c37=_0xa73c37-0x0;var _0x7edd89=_0xbf16[_0xa73c37];return _0x7edd89;};'use strict';var _=require(_0x6bf1('0x0'));var Sequelize=require(_0x6bf1('0x1'));module[_0x6bf1('0x2')]={'firstName':{'type':Sequelize[_0x6bf1('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6bf1('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6bf1('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6bf1('0x3')]},'dateOfBirth':{'type':Sequelize[_0x6bf1('0x3')]},'description':{'type':Sequelize[_0x6bf1('0x4')]},'phone':{'type':Sequelize[_0x6bf1('0x3')]},'mobile':{'type':Sequelize[_0x6bf1('0x3')]},'fax':{'type':Sequelize[_0x6bf1('0x3')]},'email':{'type':Sequelize[_0x6bf1('0x3')]},'url':{'type':Sequelize[_0x6bf1('0x3')]},'facebook':{'type':Sequelize[_0x6bf1('0x3')]},'fb_data':{'type':Sequelize[_0x6bf1('0x3')]},'twitter':{'type':Sequelize[_0x6bf1('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x6bf1('0x3')]},'line':{'type':Sequelize[_0x6bf1('0x3')]},'wechat':{'type':Sequelize[_0x6bf1('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x6bf1('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x6bf1('0x6')]}}; \ No newline at end of file +var _0x34b4=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x3d7db0,_0x19f465){var _0x10632d=function(_0x1112ec){while(--_0x1112ec){_0x3d7db0['push'](_0x3d7db0['shift']());}};_0x10632d(++_0x19f465);}(_0x34b4,0x135));var _0x434b=function(_0x4e151c,_0x1aec10){_0x4e151c=_0x4e151c-0x0;var _0xe92cdd=_0x34b4[_0x4e151c];return _0xe92cdd;};'use strict';var _=require(_0x434b('0x0'));var Sequelize=require(_0x434b('0x1'));module[_0x434b('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x434b('0x3')]},'postalCode':{'type':Sequelize[_0x434b('0x3')]},'city':{'type':Sequelize[_0x434b('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x434b('0x3')]},'description':{'type':Sequelize[_0x434b('0x4')]},'phone':{'type':Sequelize[_0x434b('0x3')]},'mobile':{'type':Sequelize[_0x434b('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x434b('0x3')]},'url':{'type':Sequelize[_0x434b('0x3')]},'facebook':{'type':Sequelize[_0x434b('0x3')]},'fb_data':{'type':Sequelize[_0x434b('0x3')]},'twitter':{'type':Sequelize[_0x434b('0x3')]},'skype':{'type':Sequelize[_0x434b('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x434b('0x3')]},'line':{'type':Sequelize[_0x434b('0x3')]},'wechat':{'type':Sequelize[_0x434b('0x3')]},'telegram':{'type':Sequelize[_0x434b('0x3')]},'UserId':{'type':Sequelize[_0x434b('0x5')]},'priority':{'type':Sequelize[_0x434b('0x5')](0x2)[_0x434b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x434b('0x7')],'defaultValue':Sequelize[_0x434b('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d980165..d3d40b0 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 _0x857a=['externalUrl','threadId','startCase','Interaction','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','json','limit','undefined','count','offset','status','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','describe','keys','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','find','Tag','value','split','map','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','text','start','hasOwnProperty','Contact','isEmpty','forEach','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','isArray','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','resolve','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','user','role','toString','sequelize','merge','c.firstName','c.lastName','c.phone','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','CmContact','params','columnName','findAll','displayName','custom','type','values','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','each','duplicates','ListId','spread','show','$and','isNil','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','phone','CmHopper','getTags','options','setTags','getHoppers','rawAttributes','includeAll','include','getHopperHistories','ContactId','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','binding_values','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','callerid','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','range','findAndCountAll','Website','Account','closed','note','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','deviceModel','osName','ratingType','referer','subject','substatus'];(function(_0x182134,_0x15289a){var _0x110626=function(_0x4605c1){while(--_0x4605c1){_0x182134['push'](_0x182134['shift']());}};_0x110626(++_0x15289a);}(_0x857a,0x11c));var _0xa857=function(_0x5ce28c,_0x374377){_0x5ce28c=_0x5ce28c-0x0;var _0x31873a=_0x857a[_0x5ce28c];return _0x31873a;};'use strict';var moment=require(_0xa857('0x0'));var BPromise=require(_0xa857('0x1'));var util=require(_0xa857('0x2'));var path=require(_0xa857('0x3'));var fs=require('fs');var _=require(_0xa857('0x4'));var squel=require(_0xa857('0x5'));var Papa=require(_0xa857('0x6'));var Redis=require('ioredis');var qs=require(_0xa857('0x7'));var as=require(_0xa857('0x8'));var logger=require(_0xa857('0x9'))('api');var config=require(_0xa857('0xa'));var db=require(_0xa857('0xb'))['db'];config[_0xa857('0xc')]=_['defaults'](config[_0xa857('0xc')],{'host':_0xa857('0xd'),'port':0x18eb});var socket=require(_0xa857('0xe'))(new Redis(config[_0xa857('0xc')]));require(_0xa857('0xf'))[_0xa857('0x10')](socket);function respondWithResult(_0x3eea43,_0x474b30){_0x474b30=_0x474b30||0xc8;return function(_0x417707){if(_0x417707){return _0x3eea43['status'](_0x474b30)[_0xa857('0x11')](_0x417707);}};}function respondWithFilteredResult(_0x26feb0,_0x37b04f){return function(_0xc26d99){if(_0xc26d99){var _0x50e89f=typeof _0x37b04f['offset']==='undefined'&&typeof _0x37b04f[_0xa857('0x12')]===_0xa857('0x13');var _0x1ab726=_0xc26d99[_0xa857('0x14')];var _0x2eda18=_0x50e89f?0x0:_0x37b04f[_0xa857('0x15')];var _0x457df9=_0x50e89f?_0xc26d99['count']:_0x37b04f[_0xa857('0x15')]+_0x37b04f['limit'];var _0x2f68fb;if(_0x457df9>=_0x1ab726){_0x457df9=_0x1ab726;_0x2f68fb=0xc8;}else{_0x2f68fb=0xce;}_0x26feb0[_0xa857('0x16')](_0x2f68fb);return _0x26feb0[_0xa857('0x17')]('Content-Range',_0x2eda18+'-'+_0x457df9+'/'+_0x1ab726)['json'](_0xc26d99);}return null;};}function saveUpdates(_0x1d0d6d){return function(_0x88e9df){if(_0x88e9df){return _0x88e9df[_0xa857('0x18')](_0x1d0d6d)[_0xa857('0x19')](function(_0x351f31){return _0x351f31;});}return null;};}function removeEntity(_0x2788d2){return function(_0x5dcbdd){if(_0x5dcbdd){return _0x5dcbdd[_0xa857('0x1a')]()[_0xa857('0x19')](function(){_0x2788d2['status'](0xcc)[_0xa857('0x1b')]();});}};}function handleEntityNotFound(_0x3799b9){return function(_0x25fc26){if(!_0x25fc26){_0x3799b9[_0xa857('0x1c')](0x194);}return _0x25fc26;};}function handleError(_0xb1c7ad,_0x45ec03){_0x45ec03=_0x45ec03||0x1f4;return function(_0x5498d2){logger[_0xa857('0x1d')](_0x5498d2[_0xa857('0x1e')]);if(_0x5498d2[_0xa857('0x1f')]){delete _0x5498d2[_0xa857('0x1f')];}_0xb1c7ad[_0xa857('0x16')](_0x45ec03)[_0xa857('0x20')](_0x5498d2);};}exports[_0xa857('0x21')]=function(_0xd9b2f1,_0x9c7d44){var _0x581348={},_0x1ca47a={},_0x558e9d={'count':0x0,'rows':[]};return db['CmContact'][_0xa857('0x22')]()['then'](function(_0x571646){var _0x128c3a=[];for(var _0x30f462=0x0;_0x30f4620x1){_0x351603['or'](_0xa857('0x5d'),qs[_0xa857('0x5e')](_0xe6a266),null);}else{if(qs[_0xa857('0x5f')](_0xe6a266)){_0x351603['or'](_0xa857('0x60'),_0xe6a266+'%');_0x351603['or'](_0xa857('0x61'),_0xe6a266+'%');_0x351603['or'](_0xa857('0x62'),_0xe6a266+'%');_0x351603['or'](_0xa857('0x63'),_0xe6a266+'%');}else if(qs['isEmail'](_0xe6a266)){_0x351603['or'](_0xa857('0x64'),_0xe6a266+'%');}else{_0x351603['or'](_0xa857('0x65'),'%'+_0xe6a266+'%');_0x351603['or']('c.lastName\x20LIKE\x20?','%'+_0xe6a266+'%');_0x351603['or'](_0xa857('0x64'),'%'+_0xe6a266+'%');}}}}_0x3a648a[_0xa857('0x35')](_0x351603);_0x3a648a[_0xa857('0x66')](_0xa857('0x67'));var _0x139e0f={'type':db[_0xa857('0x68')][_0xa857('0x69')][_0xa857('0x6a')],'raw':!![]};var _0x10985c=_0x3a648a[_0xa857('0x6b')]()[_0xa857('0x38')](_0xa857('0x67'));if(_0x581348[_0xa857('0x33')]){_0x581348[_0xa857('0x33')][_0xa857('0x57')](function(_0x21098d){_0x3a648a[_0xa857('0x33')]('c.'+_0x21098d[0x0],_0x21098d[0x1]===_0xa857('0x6c')?![]:!![]);});}if(!_['isEmpty'](_0xce1456)){_0x3a648a[_0xa857('0x6d')](_0x4c5bca);_0x10985c[_0xa857('0x35')]('t.id\x20IN\x20?',_0xce1456);}BPromise[_0xa857('0x6e')]()[_0xa857('0x19')](function(){if(!_0x56b646)return;if(_0xd9b2f1['user']['role']!==_0xa857('0x6f'))return;if(!_[_0xa857('0x70')](_0x56b646[_0xa857('0x46')],[_0xa857('0x38'),'User'])){return _0xd9b2f1['user'][_0xa857('0x71')]({'attributes':['id'],'raw':!![]})['then'](function(_0x7e453e){if(_[_0xa857('0x56')](_0x7e453e)){_0x10985c['where']('c.ListId\x20IS\x20NULL');_0x3a648a[_0xa857('0x35')](_0xa857('0x72'));}else{_0x10985c[_0xa857('0x35')]('c.ListId\x20IN\x20?',_[_0xa857('0x4b')](_0x7e453e,'id'));_0x3a648a[_0xa857('0x35')](_0xa857('0x73'),_['map'](_0x7e453e,'id'));}});}})[_0xa857('0x19')](function(){if(_0xd9b2f1[_0xa857('0x74')][_0xa857('0x75')]==='agent'&&!_0x56b646&&!_0xd9b2f1[_0xa857('0x2c')]['ListId'])return[];return db['sequelize'][_0xa857('0x2c')](_0x10985c[_0xa857('0x76')](),_0x139e0f);})[_0xa857('0x19')](function(_0x140b8e){_0x558e9d[_0xa857('0x14')]=_0x140b8e['length'];if(_0x558e9d[_0xa857('0x14')]===0x0)return[];return db[_0xa857('0x77')][_0xa857('0x2c')](_0x21a632[_0xa857('0x76')](),_0x139e0f)['then'](function(_0x28ab94){_0x378729=_['keyBy'](_0x28ab94,'id');_0x139e0f=_[_0xa857('0x78')](_0x139e0f,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd9b2f1['query'][_0xa857('0x30')]){_0x581348[_0xa857('0x2f')][_0xa857('0x57')](function(_0x58346f){_0x3a648a[_0xa857('0x38')]('c.'+_0x58346f);});}else{_0x3a648a[_0xa857('0x38')](_0xa857('0x67'));_0x3a648a[_0xa857('0x38')](_0xa857('0x79'));_0x3a648a['field'](_0xa857('0x7a'));_0x3a648a[_0xa857('0x38')](_0xa857('0x7b'));_0x3a648a[_0xa857('0x38')]('c.mobile');_0x3a648a[_0xa857('0x38')]('c.fax');_0x3a648a[_0xa857('0x38')](_0xa857('0x7c'));_0x3a648a[_0xa857('0x38')](_0xa857('0x7d'));_0x3a648a['field'](_0xa857('0x7e'));_0x3a648a[_0xa857('0x38')](_0xa857('0x7f'));_0x3a648a[_0xa857('0x38')](_0xa857('0x80'));_0x3a648a['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa857('0x81'));}if(_0x581348[_0xa857('0x12')])_0x3a648a[_0xa857('0x12')](_0x581348[_0xa857('0x12')]);if(_0x581348[_0xa857('0x15')])_0x3a648a[_0xa857('0x15')](_0x581348[_0xa857('0x15')]);return db[_0xa857('0x77')][_0xa857('0x2c')](_0x3a648a[_0xa857('0x76')](),_0x139e0f);});})[_0xa857('0x19')](function(_0x3e80a5){_0x3e80a5[_0xa857('0x57')](function(_0x3e876d){if(_0x3e876d[_0xa857('0x81')]){_0x3e876d[_0xa857('0x82')]=[];_0x3e876d[_0xa857('0x81')][_0xa857('0x4a')](',')[_0xa857('0x57')](function(_0x1b88f0){_0x3e876d[_0xa857('0x82')][_0xa857('0x25')](_0x378729[_0x1b88f0]);});}delete _0x3e876d['TagIds'];});_0x558e9d[_0xa857('0x83')]=_0x3e80a5;return _0x558e9d;})[_0xa857('0x19')](respondWithFilteredResult(_0x9c7d44,_0x581348));})[_0xa857('0x84')](handleError(_0x9c7d44,null));};exports[_0xa857('0x1a')]=function(_0x1cdb7d,_0x275441){return db[_0xa857('0x85')][_0xa857('0x47')]({'where':{'id':_0x1cdb7d[_0xa857('0x86')]['id']}})['then'](handleEntityNotFound(_0x275441,null))['then'](removeEntity(_0x275441,null))[_0xa857('0x84')](handleError(_0x275441,null));};exports[_0xa857('0x22')]=function(_0x1b9937,_0x2b2910){return db[_0xa857('0x85')][_0xa857('0x22')]()[_0xa857('0x19')](function(_0x2e7c09){delete _0x2e7c09['tags'];for(var _0x23d793=0x0;_0x23d793=_0x3e52c2){_0x5e29d2=_0x3e52c2;_0x31fc2a=0xc8;}else{_0x31fc2a=0xce;}_0x4e8404['status'](_0x31fc2a);return _0x4e8404[_0xcd5f('0x14')]('Content-Range',_0x140134+'-'+_0x5e29d2+'/'+_0x3e52c2)['json'](_0x38c78b);}return null;};}function saveUpdates(_0x3cdc1d){return function(_0x4b1768){if(_0x4b1768){return _0x4b1768[_0xcd5f('0x15')](_0x3cdc1d)['then'](function(_0x5dec7b){return _0x5dec7b;});}return null;};}function removeEntity(_0x533fcf){return function(_0x37f635){if(_0x37f635){return _0x37f635[_0xcd5f('0x16')]()[_0xcd5f('0x17')](function(){_0x533fcf[_0xcd5f('0xe')](0xcc)[_0xcd5f('0x18')]();});}};}function handleEntityNotFound(_0x3fedbc){return function(_0x5e8dd1){if(!_0x5e8dd1){_0x3fedbc['sendStatus'](0x194);}return _0x5e8dd1;};}function handleError(_0x397b62,_0x2cd575){_0x2cd575=_0x2cd575||0x1f4;return function(_0x19efb5){logger[_0xcd5f('0x19')](_0x19efb5[_0xcd5f('0x1a')]);if(_0x19efb5[_0xcd5f('0x1b')]){delete _0x19efb5[_0xcd5f('0x1b')];}_0x397b62['status'](_0x2cd575)[_0xcd5f('0x1c')](_0x19efb5);};}exports[_0xcd5f('0x1d')]=function(_0x4bda14,_0x5ecb8d){var _0x20e83c={},_0x329cc0={},_0x47ef18={'count':0x0,'rows':[]};return db[_0xcd5f('0x1e')][_0xcd5f('0x1f')]()[_0xcd5f('0x17')](function(_0x3625d7){var _0x33437b=[];for(var _0x1663d9=0x0;_0x1663d90x1){_0xba6118['or'](_0xcd5f('0x5e'),qs[_0xcd5f('0x5f')](_0x377716),null);}else{if(qs[_0xcd5f('0x60')](_0x377716)){_0xba6118['or'](_0xcd5f('0x61'),_0x377716+'%');_0xba6118['or']('c.phone\x20LIKE\x20?',_0x377716+'%');_0xba6118['or'](_0xcd5f('0x62'),_0x377716+'%');_0xba6118['or']('c.fax\x20LIKE\x20?',_0x377716+'%');}else if(qs['isEmail'](_0x377716)){_0xba6118['or']('c.email\x20LIKE\x20?',_0x377716+'%');}else{_0xba6118['or']('c.firstName\x20LIKE\x20?','%'+_0x377716+'%');_0xba6118['or'](_0xcd5f('0x63'),'%'+_0x377716+'%');_0xba6118['or'](_0xcd5f('0x64'),'%'+_0x377716+'%');}}}}_0x2fe9e6[_0xcd5f('0x32')](_0xba6118);_0x2fe9e6['group'](_0xcd5f('0x65'));var _0x4e9437={'type':db[_0xcd5f('0x66')]['QueryTypes'][_0xcd5f('0x67')],'raw':!![]};var _0x1dcf4b=_0x2fe9e6['clone']()[_0xcd5f('0x36')](_0xcd5f('0x65'));if(_0x20e83c['order']){_0x20e83c[_0xcd5f('0x30')]['forEach'](function(_0x33b629){_0x2fe9e6[_0xcd5f('0x30')]('c.'+_0x33b629[0x0],_0x33b629[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcd5f('0x57')](_0x542461)){_0x2fe9e6[_0xcd5f('0x68')](_0x340532);_0x1dcf4b['where'](_0xcd5f('0x69'),_0x542461);}BPromise[_0xcd5f('0x6a')]()[_0xcd5f('0x17')](function(){if(!_0x28b6a7)return;if(_0x4bda14[_0xcd5f('0x6b')][_0xcd5f('0x6c')]!==_0xcd5f('0x6d'))return;if(!_[_0xcd5f('0x6e')](_0x28b6a7[_0xcd5f('0x45')],[_0xcd5f('0x36'),_0xcd5f('0x4d')])){return _0x4bda14[_0xcd5f('0x6b')][_0xcd5f('0x6f')]({'attributes':['id'],'raw':!![]})[_0xcd5f('0x17')](function(_0x5623c2){if(_['isEmpty'](_0x5623c2)){_0x1dcf4b[_0xcd5f('0x32')](_0xcd5f('0x70'));_0x2fe9e6[_0xcd5f('0x32')]('c.ListId\x20IS\x20NULL');}else{_0x1dcf4b[_0xcd5f('0x32')](_0xcd5f('0x58'),_[_0xcd5f('0x49')](_0x5623c2,'id'));_0x2fe9e6[_0xcd5f('0x32')](_0xcd5f('0x58'),_[_0xcd5f('0x49')](_0x5623c2,'id'));}});}})[_0xcd5f('0x17')](function(){if(_0x4bda14['user'][_0xcd5f('0x6c')]===_0xcd5f('0x6d')&&!_0x28b6a7&&!_0x4bda14[_0xcd5f('0x2b')][_0xcd5f('0x71')])return[];return db[_0xcd5f('0x72')]['query'](_0x1dcf4b[_0xcd5f('0x73')](),_0x4e9437);})[_0xcd5f('0x17')](function(_0x1060f5){_0x47ef18[_0xcd5f('0x13')]=_0x1060f5[_0xcd5f('0x21')];if(_0x47ef18[_0xcd5f('0x13')]===0x0)return[];return db[_0xcd5f('0x72')]['query'](_0x412462[_0xcd5f('0x73')](),_0x4e9437)[_0xcd5f('0x17')](function(_0x2547f6){_0x4c0e65=_[_0xcd5f('0x74')](_0x2547f6,'id');_0x4e9437=_[_0xcd5f('0x75')](_0x4e9437,{'model':db[_0xcd5f('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bda14[_0xcd5f('0x2b')]['fields']){_0x20e83c[_0xcd5f('0x2e')]['forEach'](function(_0x3b5572){_0x2fe9e6[_0xcd5f('0x36')]('c.'+_0x3b5572);});}else{_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x65'));_0x2fe9e6[_0xcd5f('0x36')]('c.firstName');_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x76'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x77'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x78'));_0x2fe9e6[_0xcd5f('0x36')]('c.fax');_0x2fe9e6[_0xcd5f('0x36')]('c.email');_0x2fe9e6['field'](_0xcd5f('0x79'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x7a'));_0x2fe9e6[_0xcd5f('0x36')](_0xcd5f('0x7b'));_0x2fe9e6['field'](_0xcd5f('0x7c'));_0x2fe9e6['field'](_0xcd5f('0x7d'),'TagIds');}if(_0x20e83c['limit'])_0x2fe9e6[_0xcd5f('0x11')](_0x20e83c['limit']);if(_0x20e83c[_0xcd5f('0x10')])_0x2fe9e6[_0xcd5f('0x10')](_0x20e83c['offset']);return db[_0xcd5f('0x72')]['query'](_0x2fe9e6[_0xcd5f('0x73')](),_0x4e9437);});})[_0xcd5f('0x17')](function(_0x28843b){_0x28843b[_0xcd5f('0x4a')](function(_0x3e08b3){if(_0x3e08b3[_0xcd5f('0x7e')]){_0x3e08b3[_0xcd5f('0x7f')]=[];_0x3e08b3[_0xcd5f('0x7e')][_0xcd5f('0x48')](',')[_0xcd5f('0x4a')](function(_0x52c799){_0x3e08b3['Tags'][_0xcd5f('0x23')](_0x4c0e65[_0x52c799]);});}delete _0x3e08b3[_0xcd5f('0x7e')];});_0x47ef18['rows']=_0x28843b;return _0x47ef18;})['then'](respondWithFilteredResult(_0x5ecb8d,_0x20e83c));})[_0xcd5f('0x80')](handleError(_0x5ecb8d,null));};exports['destroy']=function(_0x4a80de,_0x2789a4){return db['CmContact'][_0xcd5f('0x81')]({'where':{'id':_0x4a80de[_0xcd5f('0x82')]['id']}})[_0xcd5f('0x17')](handleEntityNotFound(_0x2789a4,null))[_0xcd5f('0x17')](removeEntity(_0x2789a4,null))['catch'](handleError(_0x2789a4,null));};exports[_0xcd5f('0x1f')]=function(_0x4cbc2a,_0x825980){return db[_0xcd5f('0x1e')][_0xcd5f('0x1f')]()[_0xcd5f('0x17')](function(_0x1888ab){delete _0x1888ab[_0xcd5f('0x83')];for(var _0x563edb=0x0;_0x563edb{}\s\\|]/g,'-');_0x21db33(null,util[_0xd589('0x22')](_0xd589('0x23'),path[_0xd589('0x24')](_0x5e5682[_0xd589('0x20')],path['extname'](_0x5e5682[_0xd589('0x20')])),Date[_0xd589('0x25')](),path[_0xd589('0x26')](_0x5e5682[_0xd589('0x20')])));}})});router['post']('/csv',upload[_0xd589('0x27')](_0xd589('0x28')),controller[_0xd589('0x29')]);var upload=multer({'storage':multer[_0xd589('0x2a')]({'destination':function(_0x31a71d,_0x3174f8,_0x41edb1){_0x41edb1(null,path[_0xd589('0x1d')](config['root'],'server/files/tmp'));},'filename':function(_0x42db73,_0x4b02cb,_0x5ac782){_0x4b02cb['originalname']=_0x4b02cb[_0xd589('0x20')][_0xd589('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ac782(null,util['format'](_0xd589('0x23'),path[_0xd589('0x24')](_0x4b02cb[_0xd589('0x20')],path[_0xd589('0x26')](_0x4b02cb[_0xd589('0x20')])),Date[_0xd589('0x25')](),path[_0xd589('0x26')](_0x4b02cb['originalname'])));}})});router[_0xd589('0x18')](_0xd589('0x2b'),upload[_0xd589('0x27')]('file'),controller[_0xd589('0x2c')]);router[_0xd589('0x18')](_0xd589('0x2d'),auth[_0xd589('0xa')](),controller['import']);router[_0xd589('0x2e')](_0xd589('0xd'),auth[_0xd589('0xa')](),controller[_0xd589('0x2f')]);router[_0xd589('0x30')]('/:id',auth[_0xd589('0xa')](),controller[_0xd589('0x31')]);module[_0xd589('0x32')]=router; \ No newline at end of file +var _0xe7a4=['getJourney','/merge','merge','post','bulkCreate','diskStorage','join','root','originalname','replace','format','extname','now','/csv','single','uploadCsv','server/files/tmp','%s-%s%s','basename','/upload','upload','/upload/:id','import','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey'];(function(_0x4e25c2,_0x28aea6){var _0x42fe9=function(_0x1602b1){while(--_0x1602b1){_0x4e25c2['push'](_0x4e25c2['shift']());}};_0x42fe9(++_0x28aea6);}(_0xe7a4,0x113));var _0x4e7a=function(_0x27fc79,_0xad9f4a){_0x27fc79=_0x27fc79-0x0;var _0x2c5017=_0xe7a4[_0x27fc79];return _0x2c5017;};'use strict';var multer=require(_0x4e7a('0x0'));var util=require(_0x4e7a('0x1'));var path=require(_0x4e7a('0x2'));var timeout=require(_0x4e7a('0x3'));var express=require(_0x4e7a('0x4'));var router=express[_0x4e7a('0x5')]();var fs_extra=require(_0x4e7a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4e7a('0x7'));var config=require('../../config/environment');var controller=require(_0x4e7a('0x8'));router[_0x4e7a('0x9')]('/',auth[_0x4e7a('0xa')](),controller[_0x4e7a('0xb')]);router[_0x4e7a('0x9')](_0x4e7a('0xc'),auth[_0x4e7a('0xa')](),controller[_0x4e7a('0xd')]);router[_0x4e7a('0x9')](_0x4e7a('0xe'),auth['isAuthenticated'](),controller[_0x4e7a('0xf')]);router[_0x4e7a('0x9')](_0x4e7a('0x10'),auth[_0x4e7a('0xa')](),controller[_0x4e7a('0x11')]);router[_0x4e7a('0x9')](_0x4e7a('0x12'),auth['isAuthenticated'](),controller[_0x4e7a('0x13')]);router['get'](_0x4e7a('0x14'),auth[_0x4e7a('0xa')](),controller['getHopperHistories']);router[_0x4e7a('0x9')](_0x4e7a('0x15'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x4e7a('0x9')](_0x4e7a('0x16'),auth[_0x4e7a('0xa')](),controller[_0x4e7a('0x17')]);router[_0x4e7a('0x9')](_0x4e7a('0x18'),auth[_0x4e7a('0xa')](),controller[_0x4e7a('0x19')]);router['post'](_0x4e7a('0x1a'),auth['isAuthenticated'](),controller[_0x4e7a('0x1b')]);router[_0x4e7a('0x1c')]('/',auth[_0x4e7a('0xa')](),controller['create']);router['post']('/create_many',auth[_0x4e7a('0xa')](),controller[_0x4e7a('0x1d')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller['setTags']);var upload=multer({'storage':multer[_0x4e7a('0x1e')]({'destination':function(_0x5ca19e,_0x39a93b,_0x81965b){_0x81965b(null,path[_0x4e7a('0x1f')](config[_0x4e7a('0x20')],'server/files/tmp'));},'filename':function(_0x10df9c,_0x4caa4b,_0x47aafa){_0x4caa4b[_0x4e7a('0x21')]=_0x4caa4b[_0x4e7a('0x21')][_0x4e7a('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47aafa(null,util[_0x4e7a('0x23')]('%s-%s%s',path['basename'](_0x4caa4b[_0x4e7a('0x21')],path[_0x4e7a('0x24')](_0x4caa4b[_0x4e7a('0x21')])),Date[_0x4e7a('0x25')](),path['extname'](_0x4caa4b['originalname'])));}})});router[_0x4e7a('0x1c')](_0x4e7a('0x26'),upload[_0x4e7a('0x27')]('file'),controller[_0x4e7a('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53f650,_0x38dafc,_0x2d277b){_0x2d277b(null,path[_0x4e7a('0x1f')](config[_0x4e7a('0x20')],_0x4e7a('0x29')));},'filename':function(_0x359ace,_0x2d746e,_0x25f822){_0x2d746e['originalname']=_0x2d746e[_0x4e7a('0x21')][_0x4e7a('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25f822(null,util[_0x4e7a('0x23')](_0x4e7a('0x2a'),path[_0x4e7a('0x2b')](_0x2d746e['originalname'],path[_0x4e7a('0x24')](_0x2d746e[_0x4e7a('0x21')])),Date[_0x4e7a('0x25')](),path[_0x4e7a('0x24')](_0x2d746e[_0x4e7a('0x21')])));}})});router['post'](_0x4e7a('0x2c'),upload[_0x4e7a('0x27')]('file'),controller[_0x4e7a('0x2d')]);router['post'](_0x4e7a('0x2e'),auth[_0x4e7a('0xa')](),controller[_0x4e7a('0x2f')]);router['put'](_0x4e7a('0xe'),auth[_0x4e7a('0xa')](),controller['update']);router['delete'](_0x4e7a('0xe'),auth['isAuthenticated'](),controller[_0x4e7a('0x30')]);module[_0x4e7a('0x31')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b2defe0..203cfb9 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 _0xad21=['setDataValue','name','TEXT','long','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad21,0x1a9));var _0x1ad2=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0xad21[_0x1fcf1b];return _0x5d2952;};'use strict';var Sequelize=require(_0x1ad2('0x0'));var _=require(_0x1ad2('0x1'));module[_0x1ad2('0x2')]={'name':{'type':Sequelize[_0x1ad2('0x3')],'get':function(_0x277dd9){return this[_0x1ad2('0x4')](_0x1ad2('0x5'));}},'alias':{'type':Sequelize[_0x1ad2('0x6')],'allowNull':![],'set':function(_0x55a3ea){this[_0x1ad2('0x7')](_0x1ad2('0x5'),_0x55a3ea?_0x55a3ea:this[_0x1ad2('0x4')](_0x1ad2('0x8')));}},'type':{'type':Sequelize[_0x1ad2('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x1ad2('0x9')](_0x1ad2('0xa')),'get':function(){if(this[_0x1ad2('0x4')]('type')==='select'){return JSON[_0x1ad2('0xb')](this[_0x1ad2('0x4')](_0x1ad2('0xc')));}else{return this[_0x1ad2('0x4')](_0x1ad2('0xc'));}},'set':function(_0xfe4426){if(Array[_0x1ad2('0xd')](_0xfe4426)){this['setDataValue'](_0x1ad2('0xc'),JSON[_0x1ad2('0xe')](_0xfe4426));}else{this[_0x1ad2('0x7')](_0x1ad2('0xc'),_0xfe4426);}}},'required':{'type':Sequelize[_0x1ad2('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1ad2('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1ad2('0x10')](_0x1ad2('0x11'))}}; \ No newline at end of file +var _0x9aa9=['getDataValue','name','TEXT','long','type','select','parse','values','isArray','BOOLEAN','voice','lodash','exports','VIRTUAL','alias','STRING','setDataValue'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x9aa9,0xc6));var _0x99aa=function(_0xcf10b8,_0x1c32da){_0xcf10b8=_0xcf10b8-0x0;var _0x12eeb9=_0x9aa9[_0xcf10b8];return _0x12eeb9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x99aa('0x0'));module[_0x99aa('0x1')]={'name':{'type':Sequelize[_0x99aa('0x2')],'get':function(_0x2f4141){return this['getDataValue'](_0x99aa('0x3'));}},'alias':{'type':Sequelize[_0x99aa('0x4')],'allowNull':![],'set':function(_0x105877){this[_0x99aa('0x5')]('alias',_0x105877?_0x105877:this[_0x99aa('0x6')](_0x99aa('0x7')));}},'type':{'type':Sequelize[_0x99aa('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x99aa('0x8')](_0x99aa('0x9')),'get':function(){if(this['getDataValue'](_0x99aa('0xa'))===_0x99aa('0xb')){return JSON[_0x99aa('0xc')](this[_0x99aa('0x6')](_0x99aa('0xd')));}else{return this[_0x99aa('0x6')](_0x99aa('0xd'));}},'set':function(_0x391350){if(Array[_0x99aa('0xe')](_0x391350)){this[_0x99aa('0x5')]('values',JSON['stringify'](_0x391350));}else{this[_0x99aa('0x5')]('values',_0x391350);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x99aa('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x99aa('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 04354c1..05c26a1 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 _0xf0fd=['sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','end','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','body','params'];(function(_0xf78d55,_0x1904a1){var _0x5be011=function(_0x3e6f63){while(--_0x3e6f63){_0xf78d55['push'](_0xf78d55['shift']());}};_0x5be011(++_0x1904a1);}(_0xf0fd,0x11b));var _0xdf0f=function(_0x54c25f,_0x17b3ca){_0x54c25f=_0x54c25f-0x0;var _0x495275=_0xf0fd[_0x54c25f];return _0x495275;};'use strict';var emlformat=require(_0xdf0f('0x0'));var rimraf=require(_0xdf0f('0x1'));var zipdir=require(_0xdf0f('0x2'));var jsonpatch=require(_0xdf0f('0x3'));var rp=require(_0xdf0f('0x4'));var moment=require(_0xdf0f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf0f('0x6'));var util=require('util');var path=require(_0xdf0f('0x7'));var sox=require(_0xdf0f('0x8'));var csv=require(_0xdf0f('0x9'));var ejs=require(_0xdf0f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf0f('0xb'));var crypto=require(_0xdf0f('0xc'));var jsforce=require(_0xdf0f('0xd'));var deskjs=require(_0xdf0f('0xe'));var toCsv=require(_0xdf0f('0x9'));var querystring=require(_0xdf0f('0xf'));var Papa=require(_0xdf0f('0x10'));var Redis=require(_0xdf0f('0x11'));var authService=require(_0xdf0f('0x12'));var qs=require(_0xdf0f('0x13'));var as=require(_0xdf0f('0x14'));var hardwareService=require(_0xdf0f('0x15'));var logger=require(_0xdf0f('0x16'))(_0xdf0f('0x17'));var utils=require('../../config/utils');var config=require(_0xdf0f('0x18'));var licenseUtil=require(_0xdf0f('0x19'));var db=require(_0xdf0f('0x1a'))['db'];function respondWithStatusCode(_0x23c938,_0x5911ee){_0x5911ee=_0x5911ee||0xcc;return function(_0x19ec33){if(_0x19ec33){return _0x23c938[_0xdf0f('0x1b')](_0x5911ee);}return _0x23c938[_0xdf0f('0x1c')](_0x5911ee)['end']();};}function respondWithResult(_0x1cbb9b,_0x5f096a){_0x5f096a=_0x5f096a||0xc8;return function(_0x53c6c1){if(_0x53c6c1){return _0x1cbb9b[_0xdf0f('0x1c')](_0x5f096a)['json'](_0x53c6c1);}};}function respondWithFilteredResult(_0x5e7304,_0x19f694){return function(_0x5b5ebe){if(_0x5b5ebe){var _0x5e1365=typeof _0x19f694[_0xdf0f('0x1d')]==='undefined'&&typeof _0x19f694['limit']===_0xdf0f('0x1e');var _0x4e57a6=_0x5b5ebe['count'];var _0x263843=_0x5e1365?0x0:_0x19f694[_0xdf0f('0x1d')];var _0x5dccf9=_0x5e1365?_0x5b5ebe[_0xdf0f('0x1f')]:_0x19f694[_0xdf0f('0x1d')]+_0x19f694[_0xdf0f('0x20')];var _0x1ee87f;if(_0x5dccf9>=_0x4e57a6){_0x5dccf9=_0x4e57a6;_0x1ee87f=0xc8;}else{_0x1ee87f=0xce;}_0x5e7304[_0xdf0f('0x1c')](_0x1ee87f);return _0x5e7304[_0xdf0f('0x21')]('Content-Range',_0x263843+'-'+_0x5dccf9+'/'+_0x4e57a6)[_0xdf0f('0x22')](_0x5b5ebe);}return null;};}function patchUpdates(_0x4051ff){return function(_0x5064c1){try{jsonpatch[_0xdf0f('0x23')](_0x5064c1,_0x4051ff,!![]);}catch(_0x26fce7){return BPromise['reject'](_0x26fce7);}return _0x5064c1[_0xdf0f('0x24')]();};}function saveUpdates(_0x3f27f3,_0x382154){return function(_0x2c7da3){if(_0x2c7da3){return _0x2c7da3[_0xdf0f('0x25')](_0x3f27f3)[_0xdf0f('0x26')](function(_0x4b0a57){return _0x4b0a57;});}return null;};}function removeEntity(_0x5c2f43,_0x2cf918){return function(_0xe14096){if(_0xe14096){return _0xe14096[_0xdf0f('0x27')]()[_0xdf0f('0x26')](function(){_0x5c2f43[_0xdf0f('0x1c')](0xcc)[_0xdf0f('0x28')]();});}};}function handleEntityNotFound(_0x561314,_0x5e35fa){return function(_0x191b4c){if(!_0x191b4c){_0x561314[_0xdf0f('0x1b')](0x194);}return _0x191b4c;};}function handleError(_0x32aff0,_0x195f39){_0x195f39=_0x195f39||0x1f4;return function(_0x5911c5){logger[_0xdf0f('0x29')](_0x5911c5[_0xdf0f('0x2a')]);if(_0x5911c5[_0xdf0f('0x2b')]){delete _0x5911c5[_0xdf0f('0x2b')];}_0x32aff0[_0xdf0f('0x1c')](_0x195f39)[_0xdf0f('0x2c')](_0x5911c5);};}exports['index']=function(_0x487f0a,_0x3ddf4e){var _0x157e37={},_0x1d4d27={},_0x421855={'count':0x0,'rows':[]};var _0x26e5ee=_[_0xdf0f('0x2d')](db[_0xdf0f('0x2e')][_0xdf0f('0x2f')],function(_0x88a2a){return{'name':_0x88a2a[_0xdf0f('0x30')],'type':_0x88a2a[_0xdf0f('0x31')][_0xdf0f('0x32')]};});_0x1d4d27[_0xdf0f('0x33')]=_[_0xdf0f('0x34')](_[_0xdf0f('0x2d')](_0x26e5ee,_0xdf0f('0x2b')),['name']);_0x1d4d27[_0xdf0f('0x35')]=_[_0xdf0f('0x36')](_0x487f0a['query']);_0x1d4d27['filters']=_[_0xdf0f('0x37')](_0x1d4d27['model'],_0x1d4d27[_0xdf0f('0x35')]);_0x157e37[_0xdf0f('0x38')]=_['intersection'](_0x1d4d27[_0xdf0f('0x33')],qs[_0xdf0f('0x39')](_0x487f0a['query']['fields']));_0x157e37[_0xdf0f('0x38')]=_0x157e37[_0xdf0f('0x38')][_0xdf0f('0x3a')]?_0x157e37[_0xdf0f('0x38')]:_0x1d4d27[_0xdf0f('0x33')];if(!_0x487f0a['query'][_0xdf0f('0x3b')](_0xdf0f('0x3c'))){_0x157e37[_0xdf0f('0x20')]=qs[_0xdf0f('0x20')](_0x487f0a['query'][_0xdf0f('0x20')]);_0x157e37['offset']=qs[_0xdf0f('0x1d')](_0x487f0a[_0xdf0f('0x35')]['offset']);}_0x157e37['order']=qs[_0xdf0f('0x3d')](_0x487f0a[_0xdf0f('0x35')][_0xdf0f('0x3d')]);_0x157e37[_0xdf0f('0x3e')]=qs['filters'](_[_0xdf0f('0x3f')](_0x487f0a[_0xdf0f('0x35')],_0x1d4d27[_0xdf0f('0x40')]),_0x26e5ee);if(_0x487f0a[_0xdf0f('0x35')][_0xdf0f('0x41')]){_0x157e37[_0xdf0f('0x3e')]=_[_0xdf0f('0x42')](_0x157e37['where'],{'$or':_[_0xdf0f('0x2d')](_0x26e5ee,function(_0x2ad195){if(_0x2ad195[_0xdf0f('0x31')]!==_0xdf0f('0x43')){var _0x2e85fe={};_0x2e85fe[_0x2ad195['name']]={'$like':'%'+_0x487f0a[_0xdf0f('0x35')][_0xdf0f('0x41')]+'%'};return _0x2e85fe;}})});}_0x157e37=_[_0xdf0f('0x42')]({},_0x157e37,_0x487f0a[_0xdf0f('0x44')]);var _0x34a616={'where':_0x157e37[_0xdf0f('0x3e')]};return db[_0xdf0f('0x2e')]['count'](_0x34a616)[_0xdf0f('0x26')](function(_0x4356a9){_0x421855[_0xdf0f('0x1f')]=_0x4356a9;if(_0x487f0a[_0xdf0f('0x35')][_0xdf0f('0x45')]){_0x157e37[_0xdf0f('0x46')]=[{'all':!![]}];}return db[_0xdf0f('0x2e')][_0xdf0f('0x47')](_0x157e37);})[_0xdf0f('0x26')](function(_0x87d71a){_0x421855['rows']=_0x87d71a;return _0x421855;})[_0xdf0f('0x26')](respondWithFilteredResult(_0x3ddf4e,_0x157e37))[_0xdf0f('0x48')](handleError(_0x3ddf4e,null));};exports[_0xdf0f('0x49')]=function(_0x5835bc,_0x5a0adf){var _0x29d3c2={'raw':!![],'where':{'id':_0x5835bc['params']['id']}},_0xa13db0={};_0xa13db0[_0xdf0f('0x33')]=_[_0xdf0f('0x36')](db['CmCustomField'][_0xdf0f('0x2f')]);_0xa13db0[_0xdf0f('0x35')]=_['keys'](_0x5835bc[_0xdf0f('0x35')]);_0xa13db0[_0xdf0f('0x40')]=_['intersection'](_0xa13db0[_0xdf0f('0x33')],_0xa13db0[_0xdf0f('0x35')]);_0x29d3c2[_0xdf0f('0x38')]=_[_0xdf0f('0x37')](_0xa13db0[_0xdf0f('0x33')],qs[_0xdf0f('0x39')](_0x5835bc[_0xdf0f('0x35')][_0xdf0f('0x39')]));_0x29d3c2[_0xdf0f('0x38')]=_0x29d3c2['attributes']['length']?_0x29d3c2[_0xdf0f('0x38')]:_0xa13db0[_0xdf0f('0x33')];if(_0x5835bc[_0xdf0f('0x35')][_0xdf0f('0x45')]){_0x29d3c2[_0xdf0f('0x46')]=[{'all':!![]}];}_0x29d3c2=_[_0xdf0f('0x42')]({},_0x29d3c2,_0x5835bc[_0xdf0f('0x44')]);return db[_0xdf0f('0x2e')][_0xdf0f('0x4a')](_0x29d3c2)['then'](handleEntityNotFound(_0x5a0adf,null))[_0xdf0f('0x26')](respondWithResult(_0x5a0adf,null))[_0xdf0f('0x48')](handleError(_0x5a0adf,null));};exports[_0xdf0f('0x25')]=function(_0x16f093,_0x510f7b){if(_0x16f093['body']['id']){delete _0x16f093[_0xdf0f('0x4b')]['id'];}return db[_0xdf0f('0x2e')][_0xdf0f('0x4a')]({'where':{'id':_0x16f093[_0xdf0f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x510f7b,null))['then'](saveUpdates(_0x16f093[_0xdf0f('0x4b')],null))[_0xdf0f('0x26')](respondWithResult(_0x510f7b,null))[_0xdf0f('0x48')](handleError(_0x510f7b,null));};exports[_0xdf0f('0x27')]=function(_0x5939bd,_0x31c383){return db[_0xdf0f('0x2e')][_0xdf0f('0x4a')]({'where':{'id':_0x5939bd[_0xdf0f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31c383,null))[_0xdf0f('0x26')](removeEntity(_0x31c383,null))['catch'](handleError(_0x31c383,null));};exports['create']=function(_0x14dd7a,_0x2f79a7){var _0x4d14fa;return db[_0xdf0f('0x4d')][_0xdf0f('0x4e')](function(_0x3518c3){return db[_0xdf0f('0x2e')]['create'](_0x14dd7a[_0xdf0f('0x4b')],{'transaction':_0x3518c3})['then'](function(_0x5a23c0){_0x4d14fa=_0x5a23c0;var _0x185e71={'type':db[_0xdf0f('0x4f')][_0xdf0f('0x50')],'transaction':_0x3518c3};switch(_0x14dd7a[_0xdf0f('0x4b')][_0xdf0f('0x31')]){case _0xdf0f('0x51'):_0x185e71[_0xdf0f('0x31')]=db[_0xdf0f('0x4f')][_0xdf0f('0x50')];break;case'number':_0x185e71[_0xdf0f('0x31')]=db['Sequelize'][_0xdf0f('0x52')];break;case _0xdf0f('0x53'):_0x185e71[_0xdf0f('0x31')]=db[_0xdf0f('0x4f')][_0xdf0f('0x54')];_0x185e71[_0xdf0f('0x55')]=![];break;default:}return db['sequelize']['queryInterface'][_0xdf0f('0x56')](_0xdf0f('0x57'),util[_0xdf0f('0x58')](_0xdf0f('0x59'),_0x4d14fa['id']),_0x185e71);})[_0xdf0f('0x26')](function(){return _0x4d14fa;});})['then'](respondWithResult(_0x2f79a7,0xc9))[_0xdf0f('0x48')](handleError(_0x2f79a7,null));}; \ No newline at end of file +var _0x6e8b=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','sequelize','transaction','TEXT','text','number','Sequelize','INTEGER','switch','BOOLEAN','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x96acad,_0x38400e){var _0xe3d13e=function(_0x4108f0){while(--_0x4108f0){_0x96acad['push'](_0x96acad['shift']());}};_0xe3d13e(++_0x38400e);}(_0x6e8b,0x156));var _0xb6e8=function(_0x4b9b78,_0x1dc74a){_0x4b9b78=_0x4b9b78-0x0;var _0x330388=_0x6e8b[_0x4b9b78];return _0x330388;};'use strict';var emlformat=require(_0xb6e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb6e8('0x1'));var jsonpatch=require(_0xb6e8('0x2'));var rp=require('request-promise');var moment=require(_0xb6e8('0x3'));var BPromise=require(_0xb6e8('0x4'));var Mustache=require(_0xb6e8('0x5'));var util=require(_0xb6e8('0x6'));var path=require(_0xb6e8('0x7'));var sox=require(_0xb6e8('0x8'));var csv=require(_0xb6e8('0x9'));var ejs=require(_0xb6e8('0xa'));var fs=require('fs');var fs_extra=require(_0xb6e8('0xb'));var _=require(_0xb6e8('0xc'));var squel=require(_0xb6e8('0xd'));var crypto=require(_0xb6e8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb6e8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb6e8('0x10'));var Papa=require(_0xb6e8('0x11'));var Redis=require(_0xb6e8('0x12'));var authService=require(_0xb6e8('0x13'));var qs=require(_0xb6e8('0x14'));var as=require(_0xb6e8('0x15'));var hardwareService=require(_0xb6e8('0x16'));var logger=require(_0xb6e8('0x17'))(_0xb6e8('0x18'));var utils=require('../../config/utils');var config=require(_0xb6e8('0x19'));var licenseUtil=require(_0xb6e8('0x1a'));var db=require(_0xb6e8('0x1b'))['db'];function respondWithStatusCode(_0x4d694d,_0x437da8){_0x437da8=_0x437da8||0xcc;return function(_0xcd21be){if(_0xcd21be){return _0x4d694d[_0xb6e8('0x1c')](_0x437da8);}return _0x4d694d[_0xb6e8('0x1d')](_0x437da8)['end']();};}function respondWithResult(_0x4a7c90,_0x29b68d){_0x29b68d=_0x29b68d||0xc8;return function(_0x104f31){if(_0x104f31){return _0x4a7c90[_0xb6e8('0x1d')](_0x29b68d)['json'](_0x104f31);}};}function respondWithFilteredResult(_0x1da1df,_0x187a01){return function(_0x767b3){if(_0x767b3){var _0x5da63c=typeof _0x187a01[_0xb6e8('0x1e')]===_0xb6e8('0x1f')&&typeof _0x187a01['limit']===_0xb6e8('0x1f');var _0x3be6d7=_0x767b3['count'];var _0x2840e5=_0x5da63c?0x0:_0x187a01['offset'];var _0x2a9178=_0x5da63c?_0x767b3['count']:_0x187a01['offset']+_0x187a01[_0xb6e8('0x20')];var _0x281fe2;if(_0x2a9178>=_0x3be6d7){_0x2a9178=_0x3be6d7;_0x281fe2=0xc8;}else{_0x281fe2=0xce;}_0x1da1df[_0xb6e8('0x1d')](_0x281fe2);return _0x1da1df['set'](_0xb6e8('0x21'),_0x2840e5+'-'+_0x2a9178+'/'+_0x3be6d7)[_0xb6e8('0x22')](_0x767b3);}return null;};}function patchUpdates(_0x234345){return function(_0x403daf){try{jsonpatch[_0xb6e8('0x23')](_0x403daf,_0x234345,!![]);}catch(_0x3562ee){return BPromise['reject'](_0x3562ee);}return _0x403daf[_0xb6e8('0x24')]();};}function saveUpdates(_0xd41b65,_0x21e56c){return function(_0x436cb2){if(_0x436cb2){return _0x436cb2[_0xb6e8('0x25')](_0xd41b65)[_0xb6e8('0x26')](function(_0x4679da){return _0x4679da;});}return null;};}function removeEntity(_0x352550,_0x2bf98e){return function(_0x4cc93c){if(_0x4cc93c){return _0x4cc93c[_0xb6e8('0x27')]()[_0xb6e8('0x26')](function(){_0x352550[_0xb6e8('0x1d')](0xcc)[_0xb6e8('0x28')]();});}};}function handleEntityNotFound(_0x1ef13e,_0x2ab339){return function(_0x2d660f){if(!_0x2d660f){_0x1ef13e[_0xb6e8('0x1c')](0x194);}return _0x2d660f;};}function handleError(_0x521e0d,_0x2595d1){_0x2595d1=_0x2595d1||0x1f4;return function(_0x5c7faf){logger[_0xb6e8('0x29')](_0x5c7faf[_0xb6e8('0x2a')]);if(_0x5c7faf[_0xb6e8('0x2b')]){delete _0x5c7faf['name'];}_0x521e0d[_0xb6e8('0x1d')](_0x2595d1)[_0xb6e8('0x2c')](_0x5c7faf);};}exports[_0xb6e8('0x2d')]=function(_0x4f6962,_0x4c5a8d){var _0x2034eb={},_0x28637e={},_0x2b6ba1={'count':0x0,'rows':[]};var _0x2f9bfe=_['map'](db[_0xb6e8('0x2e')][_0xb6e8('0x2f')],function(_0x312e18){return{'name':_0x312e18[_0xb6e8('0x30')],'type':_0x312e18[_0xb6e8('0x31')][_0xb6e8('0x32')]};});_0x28637e[_0xb6e8('0x33')]=_['differenceBy'](_[_0xb6e8('0x34')](_0x2f9bfe,_0xb6e8('0x2b')),[_0xb6e8('0x2b')]);_0x28637e['query']=_['keys'](_0x4f6962[_0xb6e8('0x35')]);_0x28637e[_0xb6e8('0x36')]=_['intersection'](_0x28637e[_0xb6e8('0x33')],_0x28637e['query']);_0x2034eb[_0xb6e8('0x37')]=_[_0xb6e8('0x38')](_0x28637e['model'],qs[_0xb6e8('0x39')](_0x4f6962[_0xb6e8('0x35')]['fields']));_0x2034eb[_0xb6e8('0x37')]=_0x2034eb[_0xb6e8('0x37')][_0xb6e8('0x3a')]?_0x2034eb[_0xb6e8('0x37')]:_0x28637e['model'];if(!_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x3b')]('nolimit')){_0x2034eb['limit']=qs[_0xb6e8('0x20')](_0x4f6962['query'][_0xb6e8('0x20')]);_0x2034eb[_0xb6e8('0x1e')]=qs[_0xb6e8('0x1e')](_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x1e')]);}_0x2034eb[_0xb6e8('0x3c')]=qs[_0xb6e8('0x3d')](_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x3d')]);_0x2034eb[_0xb6e8('0x3e')]=qs[_0xb6e8('0x36')](_[_0xb6e8('0x3f')](_0x4f6962['query'],_0x28637e[_0xb6e8('0x36')]),_0x2f9bfe);if(_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x40')]){_0x2034eb[_0xb6e8('0x3e')]=_[_0xb6e8('0x41')](_0x2034eb[_0xb6e8('0x3e')],{'$or':_[_0xb6e8('0x34')](_0x2f9bfe,function(_0x5b646d){if(_0x5b646d[_0xb6e8('0x31')]!==_0xb6e8('0x42')){var _0x2ce05f={};_0x2ce05f[_0x5b646d[_0xb6e8('0x2b')]]={'$like':'%'+_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x40')]+'%'};return _0x2ce05f;}})});}_0x2034eb=_[_0xb6e8('0x41')]({},_0x2034eb,_0x4f6962[_0xb6e8('0x43')]);var _0x46c41f={'where':_0x2034eb['where']};return db[_0xb6e8('0x2e')][_0xb6e8('0x44')](_0x46c41f)['then'](function(_0x1ccbe8){_0x2b6ba1['count']=_0x1ccbe8;if(_0x4f6962[_0xb6e8('0x35')][_0xb6e8('0x45')]){_0x2034eb[_0xb6e8('0x46')]=[{'all':!![]}];}return db[_0xb6e8('0x2e')][_0xb6e8('0x47')](_0x2034eb);})[_0xb6e8('0x26')](function(_0x6b2086){_0x2b6ba1[_0xb6e8('0x48')]=_0x6b2086;return _0x2b6ba1;})['then'](respondWithFilteredResult(_0x4c5a8d,_0x2034eb))[_0xb6e8('0x49')](handleError(_0x4c5a8d,null));};exports['show']=function(_0x27e5fc,_0x2e54e0){var _0x476dd9={'raw':!![],'where':{'id':_0x27e5fc[_0xb6e8('0x4a')]['id']}},_0x3c22fa={};_0x3c22fa[_0xb6e8('0x33')]=_[_0xb6e8('0x4b')](db[_0xb6e8('0x2e')][_0xb6e8('0x2f')]);_0x3c22fa[_0xb6e8('0x35')]=_[_0xb6e8('0x4b')](_0x27e5fc[_0xb6e8('0x35')]);_0x3c22fa[_0xb6e8('0x36')]=_[_0xb6e8('0x38')](_0x3c22fa[_0xb6e8('0x33')],_0x3c22fa[_0xb6e8('0x35')]);_0x476dd9[_0xb6e8('0x37')]=_[_0xb6e8('0x38')](_0x3c22fa[_0xb6e8('0x33')],qs[_0xb6e8('0x39')](_0x27e5fc[_0xb6e8('0x35')][_0xb6e8('0x39')]));_0x476dd9[_0xb6e8('0x37')]=_0x476dd9[_0xb6e8('0x37')][_0xb6e8('0x3a')]?_0x476dd9[_0xb6e8('0x37')]:_0x3c22fa[_0xb6e8('0x33')];if(_0x27e5fc[_0xb6e8('0x35')][_0xb6e8('0x45')]){_0x476dd9[_0xb6e8('0x46')]=[{'all':!![]}];}_0x476dd9=_[_0xb6e8('0x41')]({},_0x476dd9,_0x27e5fc['options']);return db[_0xb6e8('0x2e')][_0xb6e8('0x4c')](_0x476dd9)['then'](handleEntityNotFound(_0x2e54e0,null))['then'](respondWithResult(_0x2e54e0,null))[_0xb6e8('0x49')](handleError(_0x2e54e0,null));};exports[_0xb6e8('0x25')]=function(_0x2e98cc,_0x5dd079){if(_0x2e98cc[_0xb6e8('0x4d')]['id']){delete _0x2e98cc[_0xb6e8('0x4d')]['id'];}return db[_0xb6e8('0x2e')][_0xb6e8('0x4c')]({'where':{'id':_0x2e98cc['params']['id']}})['then'](handleEntityNotFound(_0x5dd079,null))[_0xb6e8('0x26')](saveUpdates(_0x2e98cc[_0xb6e8('0x4d')],null))[_0xb6e8('0x26')](respondWithResult(_0x5dd079,null))[_0xb6e8('0x49')](handleError(_0x5dd079,null));};exports[_0xb6e8('0x27')]=function(_0x8c792f,_0x2374f9){return db['CmCustomField'][_0xb6e8('0x4c')]({'where':{'id':_0x8c792f[_0xb6e8('0x4a')]['id']}})[_0xb6e8('0x26')](handleEntityNotFound(_0x2374f9,null))['then'](removeEntity(_0x2374f9,null))[_0xb6e8('0x49')](handleError(_0x2374f9,null));};exports[_0xb6e8('0x4e')]=function(_0x252f56,_0x6f60f9){var _0x15ddc3;return db[_0xb6e8('0x4f')][_0xb6e8('0x50')](function(_0x428566){return db[_0xb6e8('0x2e')][_0xb6e8('0x4e')](_0x252f56['body'],{'transaction':_0x428566})[_0xb6e8('0x26')](function(_0x295371){_0x15ddc3=_0x295371;var _0x783fc3={'type':db['Sequelize'][_0xb6e8('0x51')],'transaction':_0x428566};switch(_0x252f56['body'][_0xb6e8('0x31')]){case _0xb6e8('0x52'):_0x783fc3['type']=db['Sequelize'][_0xb6e8('0x51')];break;case _0xb6e8('0x53'):_0x783fc3[_0xb6e8('0x31')]=db[_0xb6e8('0x54')][_0xb6e8('0x55')];break;case _0xb6e8('0x56'):_0x783fc3['type']=db[_0xb6e8('0x54')][_0xb6e8('0x57')];_0x783fc3['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xb6e8('0x58'),util[_0xb6e8('0x59')](_0xb6e8('0x5a'),_0x15ddc3['id']),_0x783fc3);})[_0xb6e8('0x26')](function(){return _0x15ddc3;});})[_0xb6e8('0x26')](respondWithResult(_0x6f60f9,0xc9))[_0xb6e8('0x49')](handleError(_0x6f60f9,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d927871..a27c5db 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 _0x93dd=['CmCustomField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x93dd,0xdd));var _0xd93d=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x93dd[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0xd93d('0x0'));var logger=require(_0xd93d('0x1'))(_0xd93d('0x2'));var moment=require(_0xd93d('0x3'));var BPromise=require(_0xd93d('0x4'));var rp=require(_0xd93d('0x5'));var fs=require('fs');var path=require(_0xd93d('0x6'));var rimraf=require(_0xd93d('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xd93d('0x8')]=function(_0x3956d9,_0x15990f){return _0x3956d9[_0xd93d('0x9')](_0xd93d('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5586=['cm_custom_fields','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x55109f,_0x51215a){var _0x23a583=function(_0x4762c2){while(--_0x4762c2){_0x55109f['push'](_0x55109f['shift']());}};_0x23a583(++_0x51215a);}(_0x5586,0x121));var _0x6558=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x5586[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x6558('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6558('0x1'));var moment=require('moment');var BPromise=require(_0x6558('0x2'));var rp=require(_0x6558('0x3'));var fs=require('fs');var path=require(_0x6558('0x4'));var rimraf=require(_0x6558('0x5'));var config=require(_0x6558('0x6'));var attributes=require(_0x6558('0x7'));module[_0x6558('0x8')]=function(_0x445a34,_0x116d42){return _0x445a34[_0x6558('0x9')](_0x6558('0xa'),attributes,{'tableName':_0x6558('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 349cfec..04f45a4 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 _0x2a4f=['client','http','request','then','info','request\x20sent','debug','stringify','error','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x656bd3,_0x455abb){var _0x508710=function(_0xe9fd8){while(--_0xe9fd8){_0x656bd3['push'](_0x656bd3['shift']());}};_0x508710(++_0x455abb);}(_0x2a4f,0xfd));var _0xf2a4=function(_0x36b2c5,_0x5eaf9a){_0x36b2c5=_0x36b2c5-0x0;var _0x919462=_0x2a4f[_0x36b2c5];return _0x919462;};'use strict';var _=require(_0xf2a4('0x0'));var util=require('util');var moment=require(_0xf2a4('0x1'));var BPromise=require(_0xf2a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2a4('0x4'));var logger=require('../../config/logger')(_0xf2a4('0x5'));var config=require('../../config/environment');var jayson=require(_0xf2a4('0x6'));var client=jayson[_0xf2a4('0x7')][_0xf2a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d7cfc,_0x5bb1f1,_0x57a67b){return new BPromise(function(_0xfb7671,_0x5b074d){return client[_0xf2a4('0x9')](_0x3d7cfc,_0x57a67b)[_0xf2a4('0xa')](function(_0x5da641){logger[_0xf2a4('0xb')]('CmCustomField,\x20%s,\x20%s',_0x5bb1f1,_0xf2a4('0xc'));logger[_0xf2a4('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5bb1f1,_0xf2a4('0xc'),JSON[_0xf2a4('0xe')](_0x5da641));if(_0x5da641[_0xf2a4('0xf')]){if(_0x5da641[_0xf2a4('0xf')]['code']===0x1f4){logger[_0xf2a4('0xf')]('CmCustomField,\x20%s,\x20%s',_0x5bb1f1,_0x5da641[_0xf2a4('0xf')][_0xf2a4('0x10')]);return _0x5b074d(_0x5da641[_0xf2a4('0xf')][_0xf2a4('0x10')]);}logger[_0xf2a4('0xf')](_0xf2a4('0x11'),_0x5bb1f1,_0x5da641[_0xf2a4('0xf')]['message']);return _0xfb7671(_0x5da641['error']['message']);}else{logger[_0xf2a4('0xb')]('CmCustomField,\x20%s,\x20%s',_0x5bb1f1,_0xf2a4('0xc'));_0xfb7671(_0x5da641[_0xf2a4('0x12')][_0xf2a4('0x10')]);}})[_0xf2a4('0x13')](function(_0x551382){logger[_0xf2a4('0xf')](_0xf2a4('0x11'),_0x5bb1f1,_0x551382);_0x5b074d(_0x551382);});});} \ No newline at end of file +var _0xc0c0=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent'];(function(_0xd719d2,_0x88d330){var _0x2c1995=function(_0x169c0c){while(--_0x169c0c){_0xd719d2['push'](_0xd719d2['shift']());}};_0x2c1995(++_0x88d330);}(_0xc0c0,0x1d1));var _0x0c0c=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xc0c0[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x0c0c('0x0'));var util=require(_0x0c0c('0x1'));var moment=require(_0x0c0c('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c0c('0x3'));var fs=require('fs');var Redis=require(_0x0c0c('0x4'));var db=require(_0x0c0c('0x5'))['db'];var utils=require(_0x0c0c('0x6'));var logger=require(_0x0c0c('0x7'))(_0x0c0c('0x8'));var config=require('../../config/environment');var jayson=require(_0x0c0c('0x9'));var client=jayson[_0x0c0c('0xa')][_0x0c0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd790b6,_0x5bf35b,_0x32ea87){return new BPromise(function(_0xdf8663,_0x4e2914){return client[_0x0c0c('0xc')](_0xd790b6,_0x32ea87)['then'](function(_0x4e30f8){logger[_0x0c0c('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5bf35b,_0x0c0c('0xe'));logger[_0x0c0c('0xf')](_0x0c0c('0x10'),_0x5bf35b,'request\x20sent',JSON[_0x0c0c('0x11')](_0x4e30f8));if(_0x4e30f8[_0x0c0c('0x12')]){if(_0x4e30f8[_0x0c0c('0x12')][_0x0c0c('0x13')]===0x1f4){logger['error'](_0x0c0c('0x14'),_0x5bf35b,_0x4e30f8['error'][_0x0c0c('0x15')]);return _0x4e2914(_0x4e30f8[_0x0c0c('0x12')][_0x0c0c('0x15')]);}logger[_0x0c0c('0x12')](_0x0c0c('0x14'),_0x5bf35b,_0x4e30f8[_0x0c0c('0x12')][_0x0c0c('0x15')]);return _0xdf8663(_0x4e30f8['error'][_0x0c0c('0x15')]);}else{logger[_0x0c0c('0xd')]('CmCustomField,\x20%s,\x20%s',_0x5bf35b,_0x0c0c('0xe'));_0xdf8663(_0x4e30f8[_0x0c0c('0x16')][_0x0c0c('0x15')]);}})[_0x0c0c('0x17')](function(_0x4acb86){logger[_0x0c0c('0x12')](_0x0c0c('0x14'),_0x5bf35b,_0x4acb86);_0x4e2914(_0x4acb86);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 31f279b..bea7d4b 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 _0x1354=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','put','update','exports','multer','util','path','connect-timeout'];(function(_0x7cdaf1,_0x40e620){var _0xf58e9a=function(_0xc05694){while(--_0xc05694){_0x7cdaf1['push'](_0x7cdaf1['shift']());}};_0xf58e9a(++_0x40e620);}(_0x1354,0x95));var _0x4135=function(_0x462729,_0x226b5a){_0x462729=_0x462729-0x0;var _0x107767=_0x1354[_0x462729];return _0x107767;};'use strict';var multer=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var path=require(_0x4135('0x2'));var timeout=require(_0x4135('0x3'));var express=require(_0x4135('0x4'));var router=express[_0x4135('0x5')]();var fs_extra=require(_0x4135('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4135('0x7'));var config=require(_0x4135('0x8'));var controller=require(_0x4135('0x9'));router['get']('/',auth[_0x4135('0xa')](),controller[_0x4135('0xb')]);router['get'](_0x4135('0xc'),auth[_0x4135('0xa')](),controller[_0x4135('0xd')]);router['post']('/',auth[_0x4135('0xa')](),controller['create']);router[_0x4135('0xe')](_0x4135('0xc'),auth[_0x4135('0xa')](),controller[_0x4135('0xf')]);router['delete'](_0x4135('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4135('0x10')]=router; \ No newline at end of file +var _0x2ac4=['isAuthenticated','get','show','post','create','/:id','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller'];(function(_0x5ebf85,_0x598413){var _0x5b175a=function(_0x3b213a){while(--_0x3b213a){_0x5ebf85['push'](_0x5ebf85['shift']());}};_0x5b175a(++_0x598413);}(_0x2ac4,0x68));var _0x42ac=function(_0x3dbd6d,_0x3ee9d7){_0x3dbd6d=_0x3dbd6d-0x0;var _0x1216f1=_0x2ac4[_0x3dbd6d];return _0x1216f1;};'use strict';var multer=require('multer');var util=require(_0x42ac('0x0'));var path=require('path');var timeout=require(_0x42ac('0x1'));var express=require(_0x42ac('0x2'));var router=express[_0x42ac('0x3')]();var fs_extra=require(_0x42ac('0x4'));var auth=require(_0x42ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42ac('0x6'));var controller=require(_0x42ac('0x7'));router['get']('/',auth[_0x42ac('0x8')](),controller['index']);router[_0x42ac('0x9')]('/:id',auth[_0x42ac('0x8')](),controller[_0x42ac('0xa')]);router[_0x42ac('0xb')]('/',auth[_0x42ac('0x8')](),controller[_0x42ac('0xc')]);router['put'](_0x42ac('0xd'),auth[_0x42ac('0x8')](),controller['update']);router[_0x42ac('0xe')](_0x42ac('0xd'),auth[_0x42ac('0x8')](),controller['destroy']);module[_0x42ac('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 205231f..84adf2e 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 _0xa594=['UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','DATE','format','INTEGER','STRING'];(function(_0x5e1e61,_0x51076a){var _0x3152f=function(_0x2c0615){while(--_0x2c0615){_0x5e1e61['push'](_0x5e1e61['shift']());}};_0x3152f(++_0x51076a);}(_0xa594,0x1cd));var _0x4a59=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xa594[_0x172948];return _0x4aeaa9;};'use strict';var moment=require('moment');var Sequelize=require(_0x4a59('0x0'));module[_0x4a59('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4a59('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4a59('0x3')],'defaultValue':moment()[_0x4a59('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4a59('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4a59('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4a59('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4a59('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4a59('0x5')],'unique':_0x4a59('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4a59('0x8')},'UserId':{'type':Sequelize[_0x4a59('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x4a59('0x5')],'unique':_0x4a59('0x8')},'CampaignId':{'type':Sequelize[_0x4a59('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4a59('0x5')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0x4a59('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7e48=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e48,0x1c1));var _0x87e4=function(_0x157085,_0x2f63a6){_0x157085=_0x157085-0x0;var _0xbeb17c=_0x7e48[_0x157085];return _0xbeb17c;};'use strict';var moment=require(_0x87e4('0x0'));var Sequelize=require('sequelize');module[_0x87e4('0x1')]={'phone':{'type':Sequelize[_0x87e4('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x87e4('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x87e4('0x4')],'defaultValue':moment()[_0x87e4('0x5')](_0x87e4('0x6'))},'countbusyretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x87e4('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x87e4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x87e4('0x7')](0x2)[_0x87e4('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x87e4('0x7')],'unique':_0x87e4('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x87e4('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x87e4('0x9')},'CampaignId':{'type':Sequelize[_0x87e4('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x87e4('0x7')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 69c53ca..f8b92e7 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 _0xf49d=['send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','update','describe','find','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','CmCompany','Company','CmList','Queue','dialActive','getPreviewRecall','hopperId','Contact','List','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','reject','save','then','destroy','end','error','stack','name'];(function(_0x1ba1bf,_0x4daaf3){var _0x58fdd0=function(_0x5c8531){while(--_0x5c8531){_0x1ba1bf['push'](_0x1ba1bf['shift']());}};_0x58fdd0(++_0x4daaf3);}(_0xf49d,0x1a9));var _0xdf49=function(_0x3f29c3,_0x149cd4){_0x3f29c3=_0x3f29c3-0x0;var _0x3043d1=_0xf49d[_0x3f29c3];return _0x3043d1;};'use strict';var emlformat=require(_0xdf49('0x0'));var rimraf=require(_0xdf49('0x1'));var zipdir=require(_0xdf49('0x2'));var jsonpatch=require(_0xdf49('0x3'));var rp=require(_0xdf49('0x4'));var moment=require(_0xdf49('0x5'));var BPromise=require(_0xdf49('0x6'));var Mustache=require(_0xdf49('0x7'));var util=require(_0xdf49('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xdf49('0x9'));var ejs=require(_0xdf49('0xa'));var fs=require('fs');var fs_extra=require(_0xdf49('0xb'));var _=require(_0xdf49('0xc'));var squel=require(_0xdf49('0xd'));var crypto=require(_0xdf49('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf49('0xf'));var toCsv=require(_0xdf49('0x9'));var querystring=require('querystring');var Papa=require(_0xdf49('0x10'));var Redis=require(_0xdf49('0x11'));var authService=require(_0xdf49('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf49('0x13'));var logger=require(_0xdf49('0x14'))(_0xdf49('0x15'));var utils=require(_0xdf49('0x16'));var config=require(_0xdf49('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf49('0x18'))['db'];function respondWithStatusCode(_0x4a2d04,_0x171dd1){_0x171dd1=_0x171dd1||0xcc;return function(_0x1a7303){if(_0x1a7303){return _0x4a2d04[_0xdf49('0x19')](_0x171dd1);}return _0x4a2d04[_0xdf49('0x1a')](_0x171dd1)['end']();};}function respondWithResult(_0x269a24,_0x426993){_0x426993=_0x426993||0xc8;return function(_0x5b8ad9){if(_0x5b8ad9){return _0x269a24[_0xdf49('0x1a')](_0x426993)[_0xdf49('0x1b')](_0x5b8ad9);}};}function respondWithFilteredResult(_0x49ae2f,_0x5b98ac){return function(_0xc5894e){if(_0xc5894e){var _0x19c660=typeof _0x5b98ac[_0xdf49('0x1c')]===_0xdf49('0x1d')&&typeof _0x5b98ac['limit']===_0xdf49('0x1d');var _0x202568=_0xc5894e[_0xdf49('0x1e')];var _0x8b38fc=_0x19c660?0x0:_0x5b98ac['offset'];var _0x1d6f03=_0x19c660?_0xc5894e[_0xdf49('0x1e')]:_0x5b98ac['offset']+_0x5b98ac['limit'];var _0x380b2d;if(_0x1d6f03>=_0x202568){_0x1d6f03=_0x202568;_0x380b2d=0xc8;}else{_0x380b2d=0xce;}_0x49ae2f['status'](_0x380b2d);return _0x49ae2f[_0xdf49('0x1f')]('Content-Range',_0x8b38fc+'-'+_0x1d6f03+'/'+_0x202568)[_0xdf49('0x1b')](_0xc5894e);}return null;};}function patchUpdates(_0x527015){return function(_0x49814e){try{jsonpatch['apply'](_0x49814e,_0x527015,!![]);}catch(_0x57a469){return BPromise[_0xdf49('0x20')](_0x57a469);}return _0x49814e[_0xdf49('0x21')]();};}function saveUpdates(_0x17899b,_0x31d728){return function(_0x2800e4){if(_0x2800e4){return _0x2800e4['update'](_0x17899b)[_0xdf49('0x22')](function(_0x723e33){return _0x723e33;});}return null;};}function removeEntity(_0x91e05d,_0xb885bc){return function(_0x33cb83){if(_0x33cb83){return _0x33cb83[_0xdf49('0x23')]()[_0xdf49('0x22')](function(){_0x91e05d[_0xdf49('0x1a')](0xcc)[_0xdf49('0x24')]();});}};}function handleEntityNotFound(_0x59793a,_0x4dec1c){return function(_0x12a9f5){if(!_0x12a9f5){_0x59793a[_0xdf49('0x19')](0x194);}return _0x12a9f5;};}function handleError(_0x502401,_0x5bc1f4){_0x5bc1f4=_0x5bc1f4||0x1f4;return function(_0x1cfaee){logger[_0xdf49('0x25')](_0x1cfaee[_0xdf49('0x26')]);if(_0x1cfaee['name']){delete _0x1cfaee[_0xdf49('0x27')];}_0x502401[_0xdf49('0x1a')](_0x5bc1f4)[_0xdf49('0x28')](_0x1cfaee);};}exports[_0xdf49('0x29')]=function(_0x3c8d80,_0x41e8a2){var _0x1da988={},_0x651943={},_0x5a2b7d={'count':0x0,'rows':[]};var _0x16dad3=_[_0xdf49('0x2a')](db[_0xdf49('0x2b')][_0xdf49('0x2c')],function(_0x2cc0a3){return{'name':_0x2cc0a3[_0xdf49('0x2d')],'type':_0x2cc0a3[_0xdf49('0x2e')][_0xdf49('0x2f')]};});_0x651943[_0xdf49('0x30')]=_['map'](_0x16dad3,_0xdf49('0x27'));_0x651943[_0xdf49('0x31')]=_[_0xdf49('0x32')](_0x3c8d80[_0xdf49('0x31')]);_0x651943[_0xdf49('0x33')]=_['intersection'](_0x651943[_0xdf49('0x30')],_0x651943[_0xdf49('0x31')]);_0x651943['filters']=_[_0xdf49('0x34')](_0x651943[_0xdf49('0x33')],[_0xdf49('0x35'),_0xdf49('0x36'),'$gt',_0xdf49('0x37'),_0xdf49('0x38'),_0xdf49('0x39'),'$ne',_0xdf49('0x3a'),_0xdf49('0x3b'),_0xdf49('0x3c'),_0xdf49('0x3d'),_0xdf49('0x3e'),'$notIn',_0xdf49('0x3f'),'$notLike',_0xdf49('0x40'),_0xdf49('0x41'),_0xdf49('0x3f'),'$overlap',_0xdf49('0x42'),_0xdf49('0x43'),_0xdf49('0x44')]);_0x1da988[_0xdf49('0x45')]=_[_0xdf49('0x46')](_0x651943[_0xdf49('0x30')],qs[_0xdf49('0x47')](_0x3c8d80['query']['fields']));_0x1da988['attributes']=_0x1da988[_0xdf49('0x45')][_0xdf49('0x48')]?_0x1da988[_0xdf49('0x45')]:_0x651943[_0xdf49('0x30')];if(!_0x3c8d80[_0xdf49('0x31')][_0xdf49('0x49')](_0xdf49('0x4a'))){_0x1da988[_0xdf49('0x4b')]=qs[_0xdf49('0x4b')](_0x3c8d80[_0xdf49('0x31')]['limit']);_0x1da988[_0xdf49('0x1c')]=qs[_0xdf49('0x1c')](_0x3c8d80[_0xdf49('0x31')][_0xdf49('0x1c')]);}_0x1da988['order']=qs[_0xdf49('0x4c')](_0x3c8d80['query']['sort']);_0x1da988[_0xdf49('0x4d')]=qs[_0xdf49('0x33')](_[_0xdf49('0x4e')](_0x3c8d80[_0xdf49('0x31')],_0x651943[_0xdf49('0x33')]),_0x16dad3);if(_0x3c8d80['query'][_0xdf49('0x4f')]){_0x1da988[_0xdf49('0x4d')]=_[_0xdf49('0x50')](_0x1da988['where'],{'$or':_['map'](_0x16dad3,function(_0x5ce179){if(_0x5ce179[_0xdf49('0x2e')]!==_0xdf49('0x51')){var _0x394652={};_0x394652[_0x5ce179[_0xdf49('0x27')]]={'$like':'%'+_0x3c8d80['query'][_0xdf49('0x4f')]+'%'};return _0x394652;}})});}_0x1da988=_[_0xdf49('0x50')]({},_0x1da988,_0x3c8d80[_0xdf49('0x52')]);var _0x585d01={'where':_0x1da988[_0xdf49('0x4d')]};return db[_0xdf49('0x2b')][_0xdf49('0x1e')](_0x585d01)[_0xdf49('0x22')](function(_0x2c395c){_0x5a2b7d['count']=_0x2c395c;if(_0x3c8d80[_0xdf49('0x31')][_0xdf49('0x53')]){_0x1da988[_0xdf49('0x54')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1da988);})['then'](function(_0x4ad70f){_0x5a2b7d[_0xdf49('0x55')]=_0x4ad70f;return _0x5a2b7d;})[_0xdf49('0x22')](respondWithFilteredResult(_0x41e8a2,_0x1da988))[_0xdf49('0x56')](handleError(_0x41e8a2,null));};exports[_0xdf49('0x57')]=function(_0x21765f,_0x58ef3b){var _0x5cddd3={'raw':!![],'where':{'id':_0x21765f[_0xdf49('0x58')]['id']}},_0x382a84={};_0x382a84[_0xdf49('0x30')]=_['keys'](db[_0xdf49('0x2b')]['rawAttributes']);_0x382a84[_0xdf49('0x31')]=_[_0xdf49('0x32')](_0x21765f[_0xdf49('0x31')]);_0x382a84[_0xdf49('0x33')]=_[_0xdf49('0x46')](_0x382a84[_0xdf49('0x30')],_0x382a84[_0xdf49('0x31')]);_0x5cddd3[_0xdf49('0x45')]=_[_0xdf49('0x46')](_0x382a84['model'],qs[_0xdf49('0x47')](_0x21765f[_0xdf49('0x31')]['fields']));_0x5cddd3[_0xdf49('0x45')]=_0x5cddd3[_0xdf49('0x45')][_0xdf49('0x48')]?_0x5cddd3[_0xdf49('0x45')]:_0x382a84[_0xdf49('0x30')];if(_0x21765f[_0xdf49('0x31')][_0xdf49('0x53')]){_0x5cddd3[_0xdf49('0x54')]=[{'all':!![]}];}_0x5cddd3=_['merge']({},_0x5cddd3,_0x21765f[_0xdf49('0x52')]);return db[_0xdf49('0x2b')]['find'](_0x5cddd3)[_0xdf49('0x22')](handleEntityNotFound(_0x58ef3b,null))[_0xdf49('0x22')](respondWithResult(_0x58ef3b,null))['catch'](handleError(_0x58ef3b,null));};exports[_0xdf49('0x59')]=function(_0x5458fc,_0x347b7e){return db[_0xdf49('0x2b')][_0xdf49('0x59')](_0x5458fc[_0xdf49('0x5a')],{})[_0xdf49('0x22')](respondWithResult(_0x347b7e,0xc9))[_0xdf49('0x56')](handleError(_0x347b7e,null));};exports[_0xdf49('0x5b')]=function(_0x1cb303,_0x581c3d){if(_0x1cb303[_0xdf49('0x5a')]['id']){delete _0x1cb303[_0xdf49('0x5a')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x1cb303[_0xdf49('0x58')]['id']}})[_0xdf49('0x22')](handleEntityNotFound(_0x581c3d,null))[_0xdf49('0x22')](saveUpdates(_0x1cb303[_0xdf49('0x5a')],null))[_0xdf49('0x22')](respondWithResult(_0x581c3d,null))[_0xdf49('0x56')](handleError(_0x581c3d,null));};exports[_0xdf49('0x5c')]=function(_0x3c1cab,_0x2663e9){return db[_0xdf49('0x2b')][_0xdf49('0x5c')]()[_0xdf49('0x22')](respondWithResult(_0x2663e9,null))[_0xdf49('0x56')](handleError(_0x2663e9,null));};exports[_0xdf49('0x23')]=function(_0x211c5f,_0x52a310){var _0xb5db55;return db[_0xdf49('0x2b')][_0xdf49('0x5d')]({'where':{'id':_0x211c5f['params']['id']}})[_0xdf49('0x22')](handleEntityNotFound(_0x52a310,null))[_0xdf49('0x22')](function(_0x17c0b0){if(_0x17c0b0){return _0x17c0b0[_0xdf49('0x23')]()['then'](function(_0x27051a){return _0x27051a;});}})[_0xdf49('0x22')](function(_0x49f5cd){_0xb5db55=_0x49f5cd;if(_0x49f5cd){if(_0x49f5cd[_0xdf49('0x5e')]||_0x49f5cd[_0xdf49('0x5f')]){return db[_0x49f5cd[_0xdf49('0x5e')]?_0xdf49('0x60'):'Campaign'][_0xdf49('0x5d')]({'where':{'id':_0x49f5cd['VoiceQueueId']?_0x49f5cd[_0xdf49('0x5e')]:_0x49f5cd[_0xdf49('0x5f')]},'attributes':['id',_0xdf49('0x27')],'raw':!![]});}}})[_0xdf49('0x22')](function(_0x52120e){var _0xd6ab36={};if(_0x52120e){_[_0xdf49('0x50')](_0xd6ab36,_[_0xdf49('0x61')](_0xb5db55[_0xdf49('0x62')],[_0xdf49('0x63'),'updatedAt','id']));_0xd6ab36[_0xdf49('0x64')]=0x15;_0xd6ab36[_0xdf49('0x65')]=_0xdf49('0x66');_0xd6ab36[_0xdf49('0x67')]=_0x52120e[_0xdf49('0x27')];_0xd6ab36[_0xdf49('0x68')]=_0x211c5f[_0xdf49('0x69')][_0xdf49('0x27')];_0xd6ab36[_0xdf49('0x6a')]=_0x211c5f[_0xdf49('0x69')]['id'];_0xd6ab36[_0xdf49('0x66')]=!![];_0xd6ab36[_0xdf49('0x6b')]=moment()[_0xdf49('0x6c')](_0xdf49('0x6d'));_0xd6ab36[_0xdf49('0x6e')]=_0xb5db55['phone'];_0xd6ab36[_0xdf49('0x6f')]=_0xb5db55[_0xdf49('0x5e')]?_0xdf49('0x70'):'ivr';return db[_0xdf49('0x71')][_0xdf49('0x5d')]({'where':{'id':_0xd6ab36['ContactId']},'attributes':['firstName',_0xdf49('0x72')]})[_0xdf49('0x22')](function(_0x2e4405){if(!_['isNil'](_0x52a310)&&!_[_0xdf49('0x73')](_0x2e4405[_0xdf49('0x74')])){_0xd6ab36[_0xdf49('0x75')]=_0x2e4405['firstName'];if(!_[_0xdf49('0x73')](_0x2e4405[_0xdf49('0x72')])){_0xd6ab36[_0xdf49('0x75')]+='\x20'+_0x2e4405[_0xdf49('0x72')];}}})[_0xdf49('0x76')](function(){return db[_0xdf49('0x77')][_0xdf49('0x59')](_0xd6ab36);});}})[_0xdf49('0x22')](function(){return _0x52a310['status'](0xcc)[_0xdf49('0x24')]();})[_0xdf49('0x56')](handleError(_0x52a310,null));};exports[_0xdf49('0x78')]=function(_0x27c89a,_0x3a1a72,_0x3db8bf){var _0x3f3ab3=[];return db[_0xdf49('0x71')][_0xdf49('0x5c')]()['then'](function(_0x22e151){_0x3f3ab3=_[_0xdf49('0x32')](_0x22e151);return _0x27c89a['user'][_0xdf49('0x79')]({'where':{'type':_0xdf49('0x7a'),'dialActive':!![],'dialMethod':_0xdf49('0x7b')},'attributes':['id',_0xdf49('0x7c'),_0xdf49('0x7d')],'raw':!![]});})[_0xdf49('0x22')](function(_0x510d90){if(_0x510d90&&_0x510d90[_0xdf49('0x48')]){return db[_0xdf49('0x7e')][_0xdf49('0x7f')](function(_0x1132b0){var _0x1132d7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdf49('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x510d90,'id')},'$or':[{'UserId':null},{'UserId':_0x27c89a[_0xdf49('0x69')]['id']}]};var _0x251c49={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x510d90)[_0xdf49('0x4f')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0xdf49('0x80')]()},'$or':[{'UserId':null},{'UserId':_0x27c89a[_0xdf49('0x69')]['id']}]};var _0x25d94f={'$or':[_0x1132d7,_0x251c49]};var _0x12c3a8=[];if(_0x27c89a['body'][_0xdf49('0x81')]&&_0x27c89a[_0xdf49('0x5a')][_0xdf49('0x81')]===_0xdf49('0x82')){if(!_[_0xdf49('0x83')](_0x27c89a[_0xdf49('0x5a')][_0xdf49('0x84')])){_0x25d94f['id']={'$in':_0x27c89a[_0xdf49('0x5a')]['hopperIds']};}_0x12c3a8=[[_0xdf49('0x85'),_0xdf49('0x86')],['scheduledAt',_0x510d90[0x0]['dialOrderByScheduledAt']===_0xdf49('0x86')?_0xdf49('0x87'):_0xdf49('0x86')],db[_0xdf49('0x7e')][_0xdf49('0x88')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xdf49('0x83')](_0x27c89a[_0xdf49('0x5a')]['hopperIds'])){_0x25d94f['id']={'$notIn':_0x27c89a[_0xdf49('0x5a')]['hopperIds']};}_0x12c3a8=[['priority',_0xdf49('0x87')],[_0xdf49('0x89'),_0x510d90[0x0][_0xdf49('0x7c')]],db[_0xdf49('0x7e')]['literal'](_0xdf49('0x8a')),['id','ASC']];}return db[_0xdf49('0x2b')][_0xdf49('0x8b')]({'attributes':['id',_0xdf49('0x8c'),_0xdf49('0x8d')],'where':_0x25d94f,'order':_0x12c3a8,'transaction':_0x1132b0,'lock':_0x1132b0[_0xdf49('0x8e')]['UPDATE'],'include':[{'model':db[_0xdf49('0x71')],'as':'Contact','attributes':_0x3f3ab3,'include':[{'model':db[_0xdf49('0x8f')],'as':_0xdf49('0x90'),'attributes':['id',_0xdf49('0x27')]}]},{'model':db[_0xdf49('0x91')],'as':'List','attributes':['id',_0xdf49('0x27')]},{'model':db[_0xdf49('0x60')],'as':_0xdf49('0x92'),'attributes':['id',_0xdf49('0x27'),_0xdf49('0x93')]}]})[_0xdf49('0x22')](function(_0x1a9365){if(_0x1a9365){return _0x1a9365[_0xdf49('0x5b')]({'UserId':_0x27c89a[_0xdf49('0x69')]['id']},{'transaction':_0x1132b0});}});});}})[_0xdf49('0x22')](handleEntityNotFound(_0x3a1a72,null))[_0xdf49('0x22')](respondWithResult(_0x3a1a72,null))[_0xdf49('0x56')](handleError(_0x3a1a72,null));};exports[_0xdf49('0x94')]=function(_0x1b34df,_0x29713d,_0x636bf8){var _0x5ed4e4=[];return db[_0xdf49('0x71')][_0xdf49('0x5c')]()['then'](function(_0x127439){_0x5ed4e4=_[_0xdf49('0x32')](_0x127439);return _0x1b34df['user']['getVoiceQueues']({'where':{'type':_0xdf49('0x7a'),'dialActive':!![],'dialMethod':_0xdf49('0x7b')},'attributes':['id',_0xdf49('0x7c'),_0xdf49('0x7d')],'raw':!![]});})[_0xdf49('0x22')](function(_0x3e9769){if(_0x3e9769&&_0x3e9769['length']){return db[_0xdf49('0x7e')][_0xdf49('0x7f')](function(_0x1308a8){var _0x40a690={'active':![],'recallme':!![],'id':_0x1b34df[_0xdf49('0x5a')][_0xdf49('0x95')]};return db[_0xdf49('0x2b')][_0xdf49('0x8b')]({'attributes':['id',_0xdf49('0x8c'),_0xdf49('0x8d')],'where':_0x40a690,'transaction':_0x1308a8,'lock':_0x1308a8['LOCK']['UPDATE'],'include':[{'model':db[_0xdf49('0x71')],'as':_0xdf49('0x96'),'attributes':_0x5ed4e4,'include':[{'model':db[_0xdf49('0x8f')],'as':_0xdf49('0x90'),'attributes':['id',_0xdf49('0x27')]}]},{'model':db[_0xdf49('0x91')],'as':_0xdf49('0x97'),'attributes':['id',_0xdf49('0x27')]},{'model':db[_0xdf49('0x60')],'as':_0xdf49('0x92'),'attributes':['id',_0xdf49('0x27'),'dialActive']}]})[_0xdf49('0x22')](function(_0x3446d9){if(_0x3446d9){return _0x3446d9[_0xdf49('0x5b')]({'UserId':_0x1b34df[_0xdf49('0x69')]['id']},{'transaction':_0x1308a8});}});});}})[_0xdf49('0x22')](handleEntityNotFound(_0x29713d,null))[_0xdf49('0x22')](respondWithResult(_0x29713d,null))['catch'](handleError(_0x29713d,null));};exports[_0xdf49('0x98')]=function(_0x33cc63,_0x725b13,_0x53a71a){return _0x33cc63[_0xdf49('0x69')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xdf49('0x7b')},'attributes':['id'],'raw':!![]})['then'](function(_0x54d228){if(_0x54d228&&_0x54d228[_0xdf49('0x48')]){return db[_0xdf49('0x2b')][_0xdf49('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdf49('0x6c')](_0xdf49('0x6d'))},'VoiceQueueId':{'$in':_[_0xdf49('0x2a')](_0x54d228,'id')},'$or':[{'UserId':null},{'UserId':_0x33cc63[_0xdf49('0x69')]['id']}]}});}return 0x0;})[_0xdf49('0x22')](function(_0x335640){if(!_[_0xdf49('0x73')](_0x335640)&&_['isNumber'](_0x335640)){return _0x725b13[_0xdf49('0x1a')](0xc8)[_0xdf49('0x1b')]({'contacts':_0x335640});}else{logger[_0xdf49('0x25')](_0xdf49('0x99'),_0xdf49('0x98'),0x194,_0xdf49('0x9a'));_0x725b13[_0xdf49('0x19')](0x194);}})[_0xdf49('0x56')](handleError(_0x725b13,null));}; \ No newline at end of file +var _0x86c1=['isEmpty','hopperIds','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getPreviewRecall','getVoiceQueues','preview','dialPreviewAutoRecallMe','length','hopperId','recallme','List','getOpenContacts','outbound','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','error','stack','name','index','map','CmHopper','type','key','query','keys','filters','model','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','rows','catch','show','rawAttributes','fields','find','then','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','deleted','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','create','getPreview','dialOrderByScheduledAt','sequelize','transaction','value','direction','prev'];(function(_0x18721e,_0x59606b){var _0x35929e=function(_0x79db04){while(--_0x79db04){_0x18721e['push'](_0x18721e['shift']());}};_0x35929e(++_0x59606b);}(_0x86c1,0x150));var _0x186c=function(_0x1ea756,_0x11b08f){_0x1ea756=_0x1ea756-0x0;var _0x4ea5b8=_0x86c1[_0x1ea756];return _0x4ea5b8;};'use strict';var emlformat=require(_0x186c('0x0'));var rimraf=require(_0x186c('0x1'));var zipdir=require(_0x186c('0x2'));var jsonpatch=require(_0x186c('0x3'));var rp=require('request-promise');var moment=require(_0x186c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x186c('0x5'));var path=require(_0x186c('0x6'));var sox=require(_0x186c('0x7'));var csv=require(_0x186c('0x8'));var ejs=require(_0x186c('0x9'));var fs=require('fs');var fs_extra=require(_0x186c('0xa'));var _=require(_0x186c('0xb'));var squel=require('squel');var crypto=require(_0x186c('0xc'));var jsforce=require(_0x186c('0xd'));var deskjs=require(_0x186c('0xe'));var toCsv=require(_0x186c('0x8'));var querystring=require('querystring');var Papa=require(_0x186c('0xf'));var Redis=require(_0x186c('0x10'));var authService=require(_0x186c('0x11'));var qs=require(_0x186c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x186c('0x13'));var logger=require(_0x186c('0x14'))(_0x186c('0x15'));var utils=require(_0x186c('0x16'));var config=require(_0x186c('0x17'));var licenseUtil=require(_0x186c('0x18'));var db=require(_0x186c('0x19'))['db'];function respondWithStatusCode(_0x28b892,_0x382ade){_0x382ade=_0x382ade||0xcc;return function(_0x29664f){if(_0x29664f){return _0x28b892[_0x186c('0x1a')](_0x382ade);}return _0x28b892[_0x186c('0x1b')](_0x382ade)['end']();};}function respondWithResult(_0x5de553,_0x4cd49b){_0x4cd49b=_0x4cd49b||0xc8;return function(_0x94f8d0){if(_0x94f8d0){return _0x5de553[_0x186c('0x1b')](_0x4cd49b)[_0x186c('0x1c')](_0x94f8d0);}};}function respondWithFilteredResult(_0x978e9b,_0x31ca11){return function(_0x1e9f99){if(_0x1e9f99){var _0x1ce02f=typeof _0x31ca11[_0x186c('0x1d')]===_0x186c('0x1e')&&typeof _0x31ca11[_0x186c('0x1f')]==='undefined';var _0x41ce54=_0x1e9f99[_0x186c('0x20')];var _0x1a15e5=_0x1ce02f?0x0:_0x31ca11[_0x186c('0x1d')];var _0x4a71cb=_0x1ce02f?_0x1e9f99[_0x186c('0x20')]:_0x31ca11[_0x186c('0x1d')]+_0x31ca11[_0x186c('0x1f')];var _0x3b8388;if(_0x4a71cb>=_0x41ce54){_0x4a71cb=_0x41ce54;_0x3b8388=0xc8;}else{_0x3b8388=0xce;}_0x978e9b[_0x186c('0x1b')](_0x3b8388);return _0x978e9b[_0x186c('0x21')]('Content-Range',_0x1a15e5+'-'+_0x4a71cb+'/'+_0x41ce54)[_0x186c('0x1c')](_0x1e9f99);}return null;};}function patchUpdates(_0x58c311){return function(_0x3abd86){try{jsonpatch[_0x186c('0x22')](_0x3abd86,_0x58c311,!![]);}catch(_0x3138a2){return BPromise['reject'](_0x3138a2);}return _0x3abd86[_0x186c('0x23')]();};}function saveUpdates(_0x4c6069,_0x5ec48e){return function(_0x5107ba){if(_0x5107ba){return _0x5107ba[_0x186c('0x24')](_0x4c6069)['then'](function(_0x6ab11c){return _0x6ab11c;});}return null;};}function removeEntity(_0x5ae042,_0x2b0359){return function(_0x2f2d03){if(_0x2f2d03){return _0x2f2d03[_0x186c('0x25')]()['then'](function(){_0x5ae042[_0x186c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed37c0,_0x1aed92){return function(_0x3d46dd){if(!_0x3d46dd){_0xed37c0[_0x186c('0x1a')](0x194);}return _0x3d46dd;};}function handleError(_0x2ea74d,_0x17f613){_0x17f613=_0x17f613||0x1f4;return function(_0x53f8c7){logger[_0x186c('0x26')](_0x53f8c7[_0x186c('0x27')]);if(_0x53f8c7[_0x186c('0x28')]){delete _0x53f8c7[_0x186c('0x28')];}_0x2ea74d[_0x186c('0x1b')](_0x17f613)['send'](_0x53f8c7);};}exports[_0x186c('0x29')]=function(_0x20abd7,_0x2f508e){var _0xaeaa36={},_0x10eecc={},_0x1df27c={'count':0x0,'rows':[]};var _0x2fd7b0=_[_0x186c('0x2a')](db[_0x186c('0x2b')]['rawAttributes'],function(_0x4894c9){return{'name':_0x4894c9['fieldName'],'type':_0x4894c9[_0x186c('0x2c')][_0x186c('0x2d')]};});_0x10eecc['model']=_[_0x186c('0x2a')](_0x2fd7b0,_0x186c('0x28'));_0x10eecc[_0x186c('0x2e')]=_[_0x186c('0x2f')](_0x20abd7['query']);_0x10eecc[_0x186c('0x30')]=_['intersection'](_0x10eecc[_0x186c('0x31')],_0x10eecc[_0x186c('0x2e')]);_0x10eecc[_0x186c('0x30')]=_['concat'](_0x10eecc['filters'],[_0x186c('0x32'),_0x186c('0x33'),_0x186c('0x34'),_0x186c('0x35'),_0x186c('0x36'),_0x186c('0x37'),_0x186c('0x38'),_0x186c('0x39'),_0x186c('0x3a'),_0x186c('0x3b'),'$notBetween',_0x186c('0x3c'),_0x186c('0x3d'),_0x186c('0x3e'),_0x186c('0x3f'),_0x186c('0x40'),'$notILike',_0x186c('0x3e'),_0x186c('0x41'),'$contains',_0x186c('0x42'),'$any']);_0xaeaa36['attributes']=_[_0x186c('0x43')](_0x10eecc[_0x186c('0x31')],qs['fields'](_0x20abd7[_0x186c('0x2e')]['fields']));_0xaeaa36[_0x186c('0x44')]=_0xaeaa36[_0x186c('0x44')]['length']?_0xaeaa36[_0x186c('0x44')]:_0x10eecc[_0x186c('0x31')];if(!_0x20abd7['query'][_0x186c('0x45')](_0x186c('0x46'))){_0xaeaa36[_0x186c('0x1f')]=qs[_0x186c('0x1f')](_0x20abd7[_0x186c('0x2e')][_0x186c('0x1f')]);_0xaeaa36[_0x186c('0x1d')]=qs[_0x186c('0x1d')](_0x20abd7['query'][_0x186c('0x1d')]);}_0xaeaa36[_0x186c('0x47')]=qs[_0x186c('0x48')](_0x20abd7['query']['sort']);_0xaeaa36[_0x186c('0x49')]=qs[_0x186c('0x30')](_[_0x186c('0x4a')](_0x20abd7[_0x186c('0x2e')],_0x10eecc[_0x186c('0x30')]),_0x2fd7b0);if(_0x20abd7[_0x186c('0x2e')]['filter']){_0xaeaa36['where']=_[_0x186c('0x4b')](_0xaeaa36[_0x186c('0x49')],{'$or':_[_0x186c('0x2a')](_0x2fd7b0,function(_0x1d148b){if(_0x1d148b[_0x186c('0x2c')]!=='VIRTUAL'){var _0x4325c3={};_0x4325c3[_0x1d148b[_0x186c('0x28')]]={'$like':'%'+_0x20abd7[_0x186c('0x2e')]['filter']+'%'};return _0x4325c3;}})});}_0xaeaa36=_['merge']({},_0xaeaa36,_0x20abd7[_0x186c('0x4c')]);var _0x5df014={'where':_0xaeaa36[_0x186c('0x49')]};return db[_0x186c('0x2b')][_0x186c('0x20')](_0x5df014)['then'](function(_0x5456b7){_0x1df27c[_0x186c('0x20')]=_0x5456b7;if(_0x20abd7[_0x186c('0x2e')][_0x186c('0x4d')]){_0xaeaa36[_0x186c('0x4e')]=[{'all':!![]}];}return db[_0x186c('0x2b')]['findAll'](_0xaeaa36);})['then'](function(_0x72f698){_0x1df27c[_0x186c('0x4f')]=_0x72f698;return _0x1df27c;})['then'](respondWithFilteredResult(_0x2f508e,_0xaeaa36))[_0x186c('0x50')](handleError(_0x2f508e,null));};exports[_0x186c('0x51')]=function(_0xac39a2,_0x3cc2fc){var _0x45123e={'raw':!![],'where':{'id':_0xac39a2['params']['id']}},_0x25749b={};_0x25749b['model']=_[_0x186c('0x2f')](db[_0x186c('0x2b')][_0x186c('0x52')]);_0x25749b[_0x186c('0x2e')]=_[_0x186c('0x2f')](_0xac39a2['query']);_0x25749b['filters']=_[_0x186c('0x43')](_0x25749b[_0x186c('0x31')],_0x25749b[_0x186c('0x2e')]);_0x45123e['attributes']=_[_0x186c('0x43')](_0x25749b[_0x186c('0x31')],qs['fields'](_0xac39a2[_0x186c('0x2e')][_0x186c('0x53')]));_0x45123e[_0x186c('0x44')]=_0x45123e[_0x186c('0x44')]['length']?_0x45123e[_0x186c('0x44')]:_0x25749b['model'];if(_0xac39a2[_0x186c('0x2e')][_0x186c('0x4d')]){_0x45123e[_0x186c('0x4e')]=[{'all':!![]}];}_0x45123e=_[_0x186c('0x4b')]({},_0x45123e,_0xac39a2['options']);return db[_0x186c('0x2b')][_0x186c('0x54')](_0x45123e)[_0x186c('0x55')](handleEntityNotFound(_0x3cc2fc,null))[_0x186c('0x55')](respondWithResult(_0x3cc2fc,null))['catch'](handleError(_0x3cc2fc,null));};exports['create']=function(_0x1a5c4d,_0x35fda5){return db[_0x186c('0x2b')]['create'](_0x1a5c4d[_0x186c('0x56')],{})[_0x186c('0x55')](respondWithResult(_0x35fda5,0xc9))[_0x186c('0x50')](handleError(_0x35fda5,null));};exports['update']=function(_0x377a43,_0x4bb0da){if(_0x377a43[_0x186c('0x56')]['id']){delete _0x377a43[_0x186c('0x56')]['id'];}return db[_0x186c('0x2b')]['find']({'where':{'id':_0x377a43[_0x186c('0x57')]['id']}})['then'](handleEntityNotFound(_0x4bb0da,null))['then'](saveUpdates(_0x377a43[_0x186c('0x56')],null))[_0x186c('0x55')](respondWithResult(_0x4bb0da,null))['catch'](handleError(_0x4bb0da,null));};exports[_0x186c('0x58')]=function(_0x56d86f,_0xb01177){return db[_0x186c('0x2b')]['describe']()[_0x186c('0x55')](respondWithResult(_0xb01177,null))[_0x186c('0x50')](handleError(_0xb01177,null));};exports[_0x186c('0x25')]=function(_0x381d35,_0x438e48){var _0x18fc2d;return db[_0x186c('0x2b')]['find']({'where':{'id':_0x381d35[_0x186c('0x57')]['id']}})[_0x186c('0x55')](handleEntityNotFound(_0x438e48,null))[_0x186c('0x55')](function(_0x49abf3){if(_0x49abf3){return _0x49abf3['destroy']()[_0x186c('0x55')](function(_0x10ea74){return _0x10ea74;});}})[_0x186c('0x55')](function(_0x2ff2d7){_0x18fc2d=_0x2ff2d7;if(_0x2ff2d7){if(_0x2ff2d7[_0x186c('0x59')]||_0x2ff2d7[_0x186c('0x5a')]){return db[_0x2ff2d7[_0x186c('0x59')]?_0x186c('0x5b'):_0x186c('0x5c')]['find']({'where':{'id':_0x2ff2d7[_0x186c('0x59')]?_0x2ff2d7['VoiceQueueId']:_0x2ff2d7[_0x186c('0x5a')]},'attributes':['id',_0x186c('0x28')],'raw':!![]});}}})[_0x186c('0x55')](function(_0x2be91d){var _0x36b2aa={};if(_0x2be91d){_[_0x186c('0x4b')](_0x36b2aa,_['omit'](_0x18fc2d[_0x186c('0x5d')],[_0x186c('0x5e'),_0x186c('0x5f'),'id']));_0x36b2aa[_0x186c('0x60')]=0x15;_0x36b2aa['statedesc']=_0x186c('0x61');_0x36b2aa['campaign']=_0x2be91d[_0x186c('0x28')];_0x36b2aa[_0x186c('0x62')]=_0x381d35[_0x186c('0x63')][_0x186c('0x28')];_0x36b2aa[_0x186c('0x64')]=_0x381d35['user']['id'];_0x36b2aa[_0x186c('0x61')]=!![];_0x36b2aa['deletedat']=moment()['format'](_0x186c('0x65'));_0x36b2aa[_0x186c('0x66')]=_0x18fc2d['phone'];_0x36b2aa['campaigntype']=_0x18fc2d[_0x186c('0x59')]?_0x186c('0x67'):'ivr';return db[_0x186c('0x68')][_0x186c('0x54')]({'where':{'id':_0x36b2aa[_0x186c('0x69')]},'attributes':[_0x186c('0x6a'),'lastName']})[_0x186c('0x55')](function(_0x83a482){if(!_[_0x186c('0x6b')](_0x438e48)&&!_['isNil'](_0x83a482[_0x186c('0x6a')])){_0x36b2aa[_0x186c('0x6c')]=_0x83a482[_0x186c('0x6a')];if(!_[_0x186c('0x6b')](_0x83a482[_0x186c('0x6d')])){_0x36b2aa['calleridname']+='\x20'+_0x83a482[_0x186c('0x6d')];}}})[_0x186c('0x6e')](function(){return db[_0x186c('0x6f')][_0x186c('0x70')](_0x36b2aa);});}})[_0x186c('0x55')](function(){return _0x438e48[_0x186c('0x1b')](0xcc)['end']();})[_0x186c('0x50')](handleError(_0x438e48,null));};exports[_0x186c('0x71')]=function(_0x24f19a,_0x3ddf0e,_0x62ff27){var _0x3a94fd=[];return db['CmContact'][_0x186c('0x58')]()[_0x186c('0x55')](function(_0x1eca4b){_0x3a94fd=_['keys'](_0x1eca4b);return _0x24f19a[_0x186c('0x63')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x186c('0x72'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x186c('0x55')](function(_0x2afecc){if(_0x2afecc&&_0x2afecc['length']){return db[_0x186c('0x73')][_0x186c('0x74')](function(_0x12b125){var _0x2b796b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2afecc,'id')},'$or':[{'UserId':null},{'UserId':_0x24f19a[_0x186c('0x63')]['id']}]};var _0x1ca639={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2afecc)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0x186c('0x75')]()},'$or':[{'UserId':null},{'UserId':_0x24f19a[_0x186c('0x63')]['id']}]};var _0x2c9b0f={'$or':[_0x2b796b,_0x1ca639]};var _0x4b8de1=[];if(_0x24f19a[_0x186c('0x56')][_0x186c('0x76')]&&_0x24f19a['body'][_0x186c('0x76')]===_0x186c('0x77')){if(!_[_0x186c('0x78')](_0x24f19a['body'][_0x186c('0x79')])){_0x2c9b0f['id']={'$in':_0x24f19a[_0x186c('0x56')]['hopperIds']};}_0x4b8de1=[['priority',_0x186c('0x7a')],[_0x186c('0x7b'),_0x2afecc[0x0][_0x186c('0x72')]==='ASC'?_0x186c('0x7c'):'ASC'],db[_0x186c('0x73')]['literal'](_0x186c('0x7d')),['id','DESC']];}else{if(!_[_0x186c('0x78')](_0x24f19a[_0x186c('0x56')][_0x186c('0x79')])){_0x2c9b0f['id']={'$notIn':_0x24f19a['body']['hopperIds']};}_0x4b8de1=[[_0x186c('0x7e'),'DESC'],['scheduledAt',_0x2afecc[0x0][_0x186c('0x72')]],db[_0x186c('0x73')]['literal'](_0x186c('0x7f')),['id','ASC']];}return db[_0x186c('0x2b')][_0x186c('0x80')]({'attributes':['id',_0x186c('0x81'),'recallme'],'where':_0x2c9b0f,'order':_0x4b8de1,'transaction':_0x12b125,'lock':_0x12b125[_0x186c('0x82')][_0x186c('0x83')],'include':[{'model':db[_0x186c('0x68')],'as':_0x186c('0x84'),'attributes':_0x3a94fd,'include':[{'model':db[_0x186c('0x85')],'as':_0x186c('0x86'),'attributes':['id',_0x186c('0x28')]}]},{'model':db[_0x186c('0x87')],'as':'List','attributes':['id',_0x186c('0x28')]},{'model':db[_0x186c('0x5b')],'as':_0x186c('0x88'),'attributes':['id',_0x186c('0x28'),_0x186c('0x89')]}]})[_0x186c('0x55')](function(_0x5bc427){if(_0x5bc427){return _0x5bc427[_0x186c('0x24')]({'UserId':_0x24f19a['user']['id']},{'transaction':_0x12b125});}});});}})[_0x186c('0x55')](handleEntityNotFound(_0x3ddf0e,null))[_0x186c('0x55')](respondWithResult(_0x3ddf0e,null))[_0x186c('0x50')](handleError(_0x3ddf0e,null));};exports[_0x186c('0x8a')]=function(_0x14266f,_0x5464f3,_0xfbd3a1){var _0x10a60c=[];return db['CmContact']['describe']()[_0x186c('0x55')](function(_0x434c59){_0x10a60c=_['keys'](_0x434c59);return _0x14266f[_0x186c('0x63')][_0x186c('0x8b')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x186c('0x8c')},'attributes':['id','dialOrderByScheduledAt',_0x186c('0x8d')],'raw':!![]});})[_0x186c('0x55')](function(_0x8c0f45){if(_0x8c0f45&&_0x8c0f45[_0x186c('0x8e')]){return db['sequelize'][_0x186c('0x74')](function(_0x3fcea2){var _0x2c2719={'active':![],'recallme':!![],'id':_0x14266f[_0x186c('0x56')][_0x186c('0x8f')]};return db[_0x186c('0x2b')][_0x186c('0x80')]({'attributes':['id',_0x186c('0x81'),_0x186c('0x90')],'where':_0x2c2719,'transaction':_0x3fcea2,'lock':_0x3fcea2[_0x186c('0x82')][_0x186c('0x83')],'include':[{'model':db[_0x186c('0x68')],'as':_0x186c('0x84'),'attributes':_0x10a60c,'include':[{'model':db[_0x186c('0x85')],'as':'Company','attributes':['id',_0x186c('0x28')]}]},{'model':db[_0x186c('0x87')],'as':_0x186c('0x91'),'attributes':['id',_0x186c('0x28')]},{'model':db[_0x186c('0x5b')],'as':_0x186c('0x88'),'attributes':['id',_0x186c('0x28'),_0x186c('0x89')]}]})[_0x186c('0x55')](function(_0x2373bf){if(_0x2373bf){return _0x2373bf[_0x186c('0x24')]({'UserId':_0x14266f[_0x186c('0x63')]['id']},{'transaction':_0x3fcea2});}});});}})[_0x186c('0x55')](handleEntityNotFound(_0x5464f3,null))[_0x186c('0x55')](respondWithResult(_0x5464f3,null))['catch'](handleError(_0x5464f3,null));};exports[_0x186c('0x92')]=function(_0x3d4038,_0x413281,_0x5028d5){return _0x3d4038[_0x186c('0x63')][_0x186c('0x8b')]({'where':{'type':_0x186c('0x93'),'dialActive':!![],'dialMethod':_0x186c('0x8c')},'attributes':['id'],'raw':!![]})['then'](function(_0x228ccc){if(_0x228ccc&&_0x228ccc[_0x186c('0x8e')]){return db['CmHopper'][_0x186c('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x186c('0x94')](_0x186c('0x65'))},'VoiceQueueId':{'$in':_[_0x186c('0x2a')](_0x228ccc,'id')},'$or':[{'UserId':null},{'UserId':_0x3d4038[_0x186c('0x63')]['id']}]}});}return 0x0;})[_0x186c('0x55')](function(_0xdd9181){if(!_[_0x186c('0x6b')](_0xdd9181)&&_[_0x186c('0x95')](_0xdd9181)){return _0x413281[_0x186c('0x1b')](0xc8)[_0x186c('0x1c')]({'contacts':_0xdd9181});}else{logger[_0x186c('0x26')](_0x186c('0x96'),'getOpenContacts',0x194,_0x186c('0x97'));_0x413281[_0x186c('0x1a')](0x194);}})[_0x186c('0x50')](handleError(_0x413281,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 58e01ac..a21b55c 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 _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x66808a,_0x60f3bd){var _0x760006=function(_0x520c41){while(--_0x520c41){_0x66808a['push'](_0x66808a['shift']());}};_0x760006(++_0x60f3bd);}(_0x4975,0x86));var _0x5497=function(_0x17436a,_0xf92dbc){_0x17436a=_0x17436a-0x0;var _0xc1ad7a=_0x4975[_0x17436a];return _0xc1ad7a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacf4=['define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports'];(function(_0x1a7e89,_0x86bb7e){var _0xc8ebc4=function(_0x3ed474){while(--_0x3ed474){_0x1a7e89['push'](_0x1a7e89['shift']());}};_0xc8ebc4(++_0x86bb7e);}(_0xacf4,0xe7));var _0x4acf=function(_0x4905e6,_0xf1295c){_0x4905e6=_0x4905e6-0x0;var _0x1f7655=_0xacf4[_0x4905e6];return _0x1f7655;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x4acf('0xd')]},{'name':'priority','fields':[_0x4acf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 03986de..074eda0 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 _0x8e08=['request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','include','map','model','attributes','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','User','Agent','name','length','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','CountReScheduled','GetContactRecallMe','order','UserId','GetCmHopperPreview','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s'];(function(_0x202287,_0x236369){var _0x194fff=function(_0x59c116){while(--_0x59c116){_0x202287['push'](_0x202287['shift']());}};_0x194fff(++_0x236369);}(_0x8e08,0x13a));var _0x88e0=function(_0x58fe50,_0x3231c8){_0x58fe50=_0x58fe50-0x0;var _0x564fc4=_0x8e08[_0x58fe50];return _0x564fc4;};'use strict';var _=require(_0x88e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x88e0('0x1'));var rs=require(_0x88e0('0x2'));var fs=require('fs');var Redis=require(_0x88e0('0x3'));var db=require(_0x88e0('0x4'))['db'];var utils=require(_0x88e0('0x5'));var logger=require('../../config/logger')(_0x88e0('0x6'));var config=require(_0x88e0('0x7'));var jayson=require(_0x88e0('0x8'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson['client'][_0x88e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5689f7,_0x39fca3,_0x1eb725){return new BPromise(function(_0x5b9a38,_0x38f62f){return client[_0x88e0('0xa')](_0x5689f7,_0x1eb725)[_0x88e0('0xb')](function(_0xb0a389){logger[_0x88e0('0xc')](_0x88e0('0xd'),_0x39fca3,_0x88e0('0xe'));logger[_0x88e0('0xf')](_0x88e0('0x10'),_0x39fca3,'request\x20sent',JSON[_0x88e0('0x11')](_0xb0a389));if(_0xb0a389[_0x88e0('0x12')]){if(_0xb0a389[_0x88e0('0x12')][_0x88e0('0x13')]===0x1f4){logger[_0x88e0('0x12')]('CmHopper,\x20%s,\x20%s',_0x39fca3,_0xb0a389[_0x88e0('0x12')]['message']);return _0x38f62f(_0xb0a389[_0x88e0('0x12')][_0x88e0('0x14')]);}logger[_0x88e0('0x12')](_0x88e0('0xd'),_0x39fca3,_0xb0a389[_0x88e0('0x12')][_0x88e0('0x14')]);return _0x5b9a38(_0xb0a389[_0x88e0('0x12')][_0x88e0('0x14')]);}else{logger[_0x88e0('0xc')](_0x88e0('0xd'),_0x39fca3,'request\x20sent');_0x5b9a38(_0xb0a389[_0x88e0('0x15')][_0x88e0('0x14')]);}})[_0x88e0('0x16')](function(_0x39342c){logger['error'](_0x88e0('0xd'),_0x39fca3,_0x39342c);_0x38f62f(_0x39342c);});});}exports[_0x88e0('0x17')]=function(_0x579652){var _0x43882e=this;return new Promise(function(_0xe69d38,_0x1832a2){return db[_0x88e0('0x18')][_0x88e0('0x19')]({'raw':_0x579652[_0x88e0('0x1a')]?_0x579652[_0x88e0('0x1a')][_0x88e0('0x1b')]===undefined?!![]:![]:!![],'where':_0x579652[_0x88e0('0x1a')]?_0x579652[_0x88e0('0x1a')][_0x88e0('0x1c')]||null:null,'attributes':_0x579652[_0x88e0('0x1a')]?_0x579652[_0x88e0('0x1a')]['attributes']||null:null,'limit':_0x579652['options']?_0x579652[_0x88e0('0x1a')]['limit']||null:null,'include':_0x579652[_0x88e0('0x1a')]?_0x579652[_0x88e0('0x1a')][_0x88e0('0x1d')]?_[_0x88e0('0x1e')](_0x579652[_0x88e0('0x1a')][_0x88e0('0x1d')],function(_0x296e9e){return{'model':db[_0x296e9e[_0x88e0('0x1f')]],'as':_0x296e9e['as'],'attributes':_0x296e9e[_0x88e0('0x20')],'include':_0x296e9e[_0x88e0('0x1d')]?_['map'](_0x296e9e[_0x88e0('0x1d')],function(_0x1c236f){return{'model':db[_0x1c236f[_0x88e0('0x1f')]],'as':_0x1c236f['as'],'attributes':_0x1c236f[_0x88e0('0x20')],'include':_0x1c236f[_0x88e0('0x1d')]?_[_0x88e0('0x1e')](_0x1c236f['include'],function(_0x273554){return{'model':db[_0x273554[_0x88e0('0x1f')]],'as':_0x273554['as'],'attributes':_0x273554[_0x88e0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x88e0('0xb')](function(_0x3641ff){logger[_0x88e0('0xc')](_0x88e0('0x17'),_0x579652);logger[_0x88e0('0xf')](_0x88e0('0x17'),_0x579652,JSON[_0x88e0('0x11')](_0x3641ff));_0xe69d38(_0x3641ff);})['catch'](function(_0x125808){logger['error'](_0x88e0('0x17'),_0x125808['message'],_0x579652);_0x1832a2(_0x43882e['error'](0x1f4,_0x125808[_0x88e0('0x14')]));});});};exports[_0x88e0('0x21')]=function(_0x96134a){var _0x7ed3e7=this;return new Promise(function(_0xc56ba3,_0x21df3d){return db[_0x88e0('0x18')][_0x88e0('0x22')]({'raw':_0x96134a[_0x88e0('0x1a')]?_0x96134a['options'][_0x88e0('0x1b')]===undefined?!![]:![]:!![],'where':_0x96134a['options']?_0x96134a[_0x88e0('0x1a')]['where']||null:null,'attributes':_0x96134a[_0x88e0('0x1a')]?_0x96134a['options'][_0x88e0('0x20')]||null:null,'include':_0x96134a['options']?_0x96134a[_0x88e0('0x1a')]['include']?_[_0x88e0('0x1e')](_0x96134a[_0x88e0('0x1a')]['include'],function(_0xd38aa8){return{'model':db[_0xd38aa8[_0x88e0('0x1f')]],'as':_0xd38aa8['as'],'attributes':_0xd38aa8['attributes'],'include':_0xd38aa8[_0x88e0('0x1d')]?_[_0x88e0('0x1e')](_0xd38aa8[_0x88e0('0x1d')],function(_0x419422){return{'model':db[_0x419422[_0x88e0('0x1f')]],'as':_0x419422['as'],'attributes':_0x419422['attributes'],'include':_0x419422[_0x88e0('0x1d')]?_['map'](_0x419422[_0x88e0('0x1d')],function(_0x1a76b3){return{'model':db[_0x1a76b3[_0x88e0('0x1f')]],'as':_0x1a76b3['as'],'attributes':_0x1a76b3[_0x88e0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x88e0('0xb')](function(_0x583b4e){logger['info'](_0x88e0('0x21'),_0x96134a);logger[_0x88e0('0xf')](_0x88e0('0x21'),_0x96134a,JSON[_0x88e0('0x11')](_0x583b4e));_0xc56ba3(_0x583b4e);})[_0x88e0('0x16')](function(_0x6df482){logger[_0x88e0('0x12')](_0x88e0('0x21'),_0x6df482[_0x88e0('0x14')],_0x96134a);_0x21df3d(_0x7ed3e7[_0x88e0('0x12')](0x1f4,_0x6df482['message']));});});};exports['CreateCmHopper']=function(_0x4b097d){var _0x32bcf7=this;return new Promise(function(_0x536ede,_0x2e34b0){return db['CmHopper'][_0x88e0('0x23')](_0x4b097d[_0x88e0('0x24')],{'raw':_0x4b097d[_0x88e0('0x1a')]?_0x4b097d[_0x88e0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x88e0('0xb')](function(_0x5e1107){logger[_0x88e0('0xc')](_0x88e0('0x25'),_0x4b097d);logger['debug'](_0x88e0('0x25'),_0x4b097d,JSON[_0x88e0('0x11')](_0x5e1107));_0x536ede(_0x5e1107);})[_0x88e0('0x16')](function(_0x542222){logger[_0x88e0('0x12')](_0x88e0('0x25'),_0x542222['message'],_0x4b097d);_0x2e34b0(_0x32bcf7['error'](0x1f4,_0x542222[_0x88e0('0x14')]));});});};exports[_0x88e0('0x26')]=function(_0x397815){var _0x10511f=this;return new Promise(function(_0x35609f,_0x1a9761){return db[_0x88e0('0x18')][_0x88e0('0x27')](_0x397815[_0x88e0('0x24')],{'raw':_0x397815[_0x88e0('0x1a')]?_0x397815['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x397815['options']?_0x397815['options'][_0x88e0('0x1c')]||null:null,'attributes':_0x397815[_0x88e0('0x1a')]?_0x397815[_0x88e0('0x1a')][_0x88e0('0x20')]||null:null,'limit':_0x397815[_0x88e0('0x1a')]?_0x397815[_0x88e0('0x1a')][_0x88e0('0x28')]||null:null})[_0x88e0('0xb')](function(_0x148748){logger['info'](_0x88e0('0x26'),_0x397815);logger[_0x88e0('0xc')](_0x88e0('0x29'),JSON[_0x88e0('0x11')](_0x397815[_0x88e0('0x1a')][_0x88e0('0x1c')]),_0x397815['body'][_0x88e0('0x2a')]);logger[_0x88e0('0xf')](_0x88e0('0x26'),_0x397815,JSON[_0x88e0('0x11')](_0x148748));_0x35609f(_0x148748);})[_0x88e0('0x16')](function(_0x2cfde3){logger[_0x88e0('0x12')](_0x88e0('0x26'),_0x2cfde3[_0x88e0('0x14')],_0x397815);_0x1a9761(_0x10511f['error'](0x1f4,_0x2cfde3[_0x88e0('0x14')]));});});};exports[_0x88e0('0x2b')]=function(_0xc1ddde){var _0x114cbb=this;return new Promise(function(_0x489989,_0xbe3736){return db['CmHopper'][_0x88e0('0x2c')]({'where':_0xc1ddde['options']?_0xc1ddde[_0x88e0('0x1a')][_0x88e0('0x1c')]||null:null})[_0x88e0('0xb')](function(_0x38b89c){logger['info'](_0x88e0('0x2b'),_0xc1ddde);logger['debug'](_0x88e0('0x2b'),_0xc1ddde,JSON[_0x88e0('0x11')](_0x38b89c));_0x489989(_0x38b89c);})[_0x88e0('0x16')](function(_0x3e5071){logger['error'](_0x88e0('0x2b'),_0x3e5071[_0x88e0('0x14')],_0xc1ddde);_0xbe3736(_0x114cbb[_0x88e0('0x12')](0x1f4,_0x3e5071[_0x88e0('0x14')]));});});};exports['GetContactDialer']=function(_0x39041f){var _0x2ab8f3=this;return new Promise(function(_0x6b82fc,_0x455713){return db[_0x88e0('0x2d')][_0x88e0('0x2e')]()[_0x88e0('0xb')](function(_0x33c592){return db[_0x88e0('0x2f')]['transaction'](function(_0x4747ef){return db[_0x88e0('0x18')][_0x88e0('0x19')]({'where':_0x39041f['options']?_0x39041f[_0x88e0('0x1a')][_0x88e0('0x1c')]||null:null,'attributes':_0x39041f[_0x88e0('0x1a')]?_0x39041f[_0x88e0('0x1a')]['attributes']||null:null,'limit':_0x39041f[_0x88e0('0x1a')]?_0x39041f['options'][_0x88e0('0x28')]||null:null,'order':_0x39041f[_0x88e0('0x1a')]?_0x39041f[_0x88e0('0x1a')]['order']||null:null,'transaction':_0x4747ef,'lock':_0x4747ef[_0x88e0('0x30')][_0x88e0('0x31')],'include':[{'model':db[_0x88e0('0x2d')],'as':_0x88e0('0x32'),'attributes':_[_0x88e0('0x33')](_0x33c592)},{'model':db[_0x88e0('0x34')],'as':_0x88e0('0x35'),'attributes':['id',_0x88e0('0x36'),'voicePause']}]})[_0x88e0('0xb')](function(_0x1a9a60){var _0x27c4e3=[];var _0x5e28f2=[];for(var _0x136018=0x0;_0x136018<_0x1a9a60[_0x88e0('0x37')];_0x136018+=0x1){var _0x27d702=_0x1a9a60[_0x136018]['UserId'];if(_0x27d702===null){_0x27c4e3[_0x88e0('0x38')](_0x1a9a60[_0x136018][_0x88e0('0x27')](_0x39041f[_0x88e0('0x24')],{'transaction':_0x4747ef}));}else if(!_0x5e28f2['includes'](_0x27d702)){_0x5e28f2['push'](_0x27d702);_0x27c4e3[_0x88e0('0x38')](_0x1a9a60[_0x136018]['update'](_0x39041f[_0x88e0('0x24')],{'transaction':_0x4747ef}));}}return BPromise[_0x88e0('0x39')](_0x27c4e3);});})[_0x88e0('0xb')](function(_0x293215){logger['info']('GetContactDialer',_0x39041f);if(_0x293215[_0x88e0('0x37')]>0x0){logger[_0x88e0('0xc')](_0x88e0('0x3a'),_0x293215[0x0][_0x88e0('0x3b')]['id'],_0x293215[0x0]['dataValues'][_0x88e0('0x3c')],_0x293215[0x0][_0x88e0('0x3b')]['active']);}logger[_0x88e0('0xf')]('GetContactDialer',_0x39041f,JSON['stringify'](_0x293215));_0x6b82fc(_0x293215);})[_0x88e0('0x16')](function(_0x3fbaf4){logger['error'](_0x88e0('0x3d'),_0x3fbaf4[_0x88e0('0x14')],_0x39041f);_0x455713(_0x2ab8f3[_0x88e0('0x12')](0x1f4,_0x3fbaf4['message']));});});});};exports['MoveContactManagedDialer']=function(_0x301f40){var _0x1314c6=this;return new Promise(function(_0x116274,_0x33870b){return db[_0x88e0('0x2f')][_0x88e0('0x3e')](function(_0x38f7d6){return db['CmHopperFinal'][_0x88e0('0x23')](_0x301f40[_0x88e0('0x24')],{'raw':_0x301f40[_0x88e0('0x1a')]?_0x301f40['options'][_0x88e0('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x38f7d6})['then'](function(){logger[_0x88e0('0xc')](_0x88e0('0x3f'),JSON[_0x88e0('0x11')](_0x301f40[_0x88e0('0x1a')]['where']),_0x301f40['options'][_0x88e0('0x1c')][_0x88e0('0x2a')]);return db[_0x88e0('0x18')]['destroy']({'where':_0x301f40[_0x88e0('0x1a')]?_0x301f40[_0x88e0('0x1a')]['where']||null:null,'transaction':_0x38f7d6});});})['then'](function(_0x4321d4){logger['info'](_0x88e0('0x40'),_0x301f40);logger[_0x88e0('0xf')](_0x88e0('0x40'),_0x301f40,JSON[_0x88e0('0x11')](_0x4321d4));_0x116274(_0x4321d4);})['catch'](function(_0x58ee19){logger[_0x88e0('0x12')](_0x88e0('0x40'),_0x58ee19['message'],_0x301f40);_0x33870b(_0x1314c6[_0x88e0('0x12')](0x1f4,_0x58ee19[_0x88e0('0x14')]));});});};exports['CountReScheduled']=function(_0x31d8f8){var _0x2f40eb=this;return new Promise(function(_0x1b91fe,_0x5b0628){return db[_0x88e0('0x18')]['findAll']({'raw':_0x31d8f8[_0x88e0('0x1a')]?_0x31d8f8['options'][_0x88e0('0x1b')]===undefined?!![]:![]:!![],'where':_0x31d8f8[_0x88e0('0x1a')]?_0x31d8f8[_0x88e0('0x1a')][_0x88e0('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x88e0('0x41'),db[_0x88e0('0x2f')]['fn']('IF',db[_0x88e0('0x2f')][_0x88e0('0x42')]('`scheduledat`\x20>=\x20'+util[_0x88e0('0x43')](_0x88e0('0x44'),moment()[_0x88e0('0x43')](_0x88e0('0x45')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x47536a){logger[_0x88e0('0xc')]('CountReScheduled',_0x31d8f8);logger[_0x88e0('0xf')](_0x88e0('0x46'),_0x31d8f8,JSON[_0x88e0('0x11')](_0x47536a));_0x1b91fe(_0x47536a);})[_0x88e0('0x16')](function(_0x2782f9){logger[_0x88e0('0x12')](_0x88e0('0x46'),_0x2782f9[_0x88e0('0x14')],_0x31d8f8);_0x5b0628(_0x2f40eb[_0x88e0('0x12')](0x1f4,_0x2782f9[_0x88e0('0x14')]));});});};exports[_0x88e0('0x47')]=function(_0x408a73){var _0x12174c=this;return new Promise(function(_0x53654e,_0x48cbbf){return db[_0x88e0('0x2d')][_0x88e0('0x2e')]()['then'](function(_0x32789c){return db[_0x88e0('0x2f')][_0x88e0('0x3e')](function(_0x3f4bb6){return db[_0x88e0('0x18')][_0x88e0('0x19')]({'where':_0x408a73[_0x88e0('0x1a')]?_0x408a73['options'][_0x88e0('0x1c')]||null:null,'attributes':_0x408a73['options']?_0x408a73[_0x88e0('0x1a')][_0x88e0('0x20')]||null:null,'limit':0x1,'order':_0x408a73['options']?_0x408a73[_0x88e0('0x1a')][_0x88e0('0x48')]||null:null,'group':db[_0x88e0('0x18')][_0x88e0('0x49')],'transaction':_0x3f4bb6,'lock':_0x3f4bb6[_0x88e0('0x30')][_0x88e0('0x31')],'include':_0x408a73[_0x88e0('0x1a')]?_0x408a73['options'][_0x88e0('0x1d')]?_[_0x88e0('0x1e')](_0x408a73[_0x88e0('0x1a')][_0x88e0('0x1d')],function(_0x255aa8){return{'model':db[_0x255aa8[_0x88e0('0x1f')]],'as':_0x255aa8['as'],'attributes':_0x255aa8['attributes'],'include':_0x255aa8[_0x88e0('0x1d')]?_['map'](_0x255aa8['include'],function(_0x637219){return{'model':db[_0x637219[_0x88e0('0x1f')]],'as':_0x637219['as'],'attributes':_0x637219[_0x88e0('0x20')],'include':_0x637219[_0x88e0('0x1d')]?_[_0x88e0('0x1e')](_0x637219['include'],function(_0x499565){return{'model':db[_0x499565[_0x88e0('0x1f')]],'as':_0x499565['as'],'attributes':_0x499565[_0x88e0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x88e0('0xb')](function(_0x5e8062){var _0x58e8f3=[];for(var _0x1aeb83=0x0;_0x1aeb83<_0x5e8062[_0x88e0('0x37')];_0x1aeb83+=0x1){_0x58e8f3[_0x88e0('0x38')](_0x5e8062[_0x1aeb83][_0x88e0('0x27')](_0x408a73['body'],{'transaction':_0x3f4bb6}));}return BPromise[_0x88e0('0x39')](_0x58e8f3);});})[_0x88e0('0xb')](function(_0x292eb0){logger[_0x88e0('0xc')](_0x88e0('0x47'),_0x408a73);logger[_0x88e0('0xf')](_0x88e0('0x47'),_0x408a73,JSON['stringify'](_0x292eb0));_0x53654e(_0x292eb0);})[_0x88e0('0x16')](function(_0x1c5e85){logger[_0x88e0('0x12')](_0x88e0('0x47'),_0x1c5e85[_0x88e0('0x14')],_0x408a73);_0x48cbbf(_0x12174c[_0x88e0('0x12')](0x1f4,_0x1c5e85['message']));});});});};exports[_0x88e0('0x4a')]=function(_0x2c6cc2){var _0x3aeadb=this;return new Promise(function(_0x3d7967,_0x30c7e7){db[_0x88e0('0x2d')][_0x88e0('0x2e')]()[_0x88e0('0xb')](function(_0x5278d0){return db['CmHopper'][_0x88e0('0x19')]({'raw':_0x2c6cc2[_0x88e0('0x1a')]?_0x2c6cc2[_0x88e0('0x1a')][_0x88e0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c6cc2[_0x88e0('0x1a')]?_0x2c6cc2[_0x88e0('0x1a')][_0x88e0('0x1c')]||null:null,'attributes':_0x2c6cc2['options']?_0x2c6cc2[_0x88e0('0x1a')][_0x88e0('0x20')]||null:null,'limit':_0x2c6cc2[_0x88e0('0x1a')]?_0x2c6cc2[_0x88e0('0x1a')]['limit']||null:null,'include':_0x2c6cc2[_0x88e0('0x1a')]?_0x2c6cc2['options'][_0x88e0('0x1d')]?_['map'](_0x2c6cc2[_0x88e0('0x1a')][_0x88e0('0x1d')],function(_0x4224dc){return{'model':db[_0x4224dc['model']],'as':_0x4224dc['as'],'attributes':_0x4224dc['as']==='Contact'?_[_0x88e0('0x33')](_0x5278d0):_0x4224dc[_0x88e0('0x20')],'include':_0x4224dc[_0x88e0('0x1d')]?_[_0x88e0('0x1e')](_0x4224dc[_0x88e0('0x1d')],function(_0xb06f6b){return{'model':db[_0xb06f6b[_0x88e0('0x1f')]],'as':_0xb06f6b['as'],'attributes':_0xb06f6b[_0x88e0('0x20')],'include':_0xb06f6b[_0x88e0('0x1d')]?_['map'](_0xb06f6b[_0x88e0('0x1d')],function(_0x84d22a){return{'model':db[_0x84d22a[_0x88e0('0x1f')]],'as':_0x84d22a['as'],'attributes':_0x84d22a[_0x88e0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x88e0('0xb')](function(_0x29504a){logger[_0x88e0('0xc')](_0x88e0('0x17'),_0x2c6cc2);logger[_0x88e0('0xf')](_0x88e0('0x17'),_0x2c6cc2,JSON[_0x88e0('0x11')](_0x29504a));_0x3d7967(_0x29504a);})[_0x88e0('0x16')](function(_0x265cee){logger[_0x88e0('0x12')](_0x88e0('0x17'),_0x265cee[_0x88e0('0x14')],_0x2c6cc2);_0x30c7e7(_0x3aeadb[_0x88e0('0x12')](0x1f4,_0x265cee[_0x88e0('0x14')]));});});});};exports[_0x88e0('0x4b')]=function(_0x2f8c01){var _0x6e1ee8=this;return new Promise(function(_0x8a8b06,_0x1024d6){return db['sequelize'][_0x88e0('0x3e')](function(_0x394930){return db[_0x88e0('0x18')][_0x88e0('0x27')]({'active':![]},{'where':{},'transaction':_0x394930})[_0x88e0('0xb')](function(_0x5071b8){logger[_0x88e0('0xc')](_0x88e0('0x4b'),_0x2f8c01);logger[_0x88e0('0xf')](_0x88e0('0x4b'),_0x2f8c01,JSON[_0x88e0('0x11')](_0x5071b8));_0x8a8b06(_0x5071b8);})[_0x88e0('0x16')](function(_0x332336){logger['error']('ResetActiveCalls',_0x332336[_0x88e0('0x14')],_0x2f8c01);_0x1024d6(_0x6e1ee8[_0x88e0('0x12')](0x1f4,_0x332336['message']));});});});};exports[_0x88e0('0x4c')]=function(_0x408f61){var _0x3db166=this;var _0x1aa3bf=_0x408f61[_0x88e0('0x24')][_0x88e0('0x1c')][_0x88e0('0x4d')];var _0x53b101=_0x408f61[_0x88e0('0x24')]['where'][_0x88e0('0x4e')];return new Promise(function(_0x5c0ae4,_0xb7479d){return db['CmHopper'][_0x88e0('0x19')]({'where':{'voiceQueueId':_0x1aa3bf,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x88e0('0x2f')][_0x88e0('0x42')](_0x88e0('0x4f')+_0x53b101+_0x88e0('0x50'))}},'include':[{'model':db[_0x88e0('0x2d')],'as':'Contact'},{'model':db['User'],'as':_0x88e0('0x35'),'attributes':['id',_0x88e0('0x36'),'voicePause']},{'model':db[_0x88e0('0x51')],'as':'List'}]})[_0x88e0('0xb')](function(_0x5ef03f){return db[_0x88e0('0x2f')][_0x88e0('0x3e')](function(_0x450b74){return db[_0x88e0('0x18')][_0x88e0('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x1aa3bf,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x88e0('0x2f')]['literal'](_0x88e0('0x4f')+_0x53b101+_0x88e0('0x50'))}},'transaction':_0x450b74})['then'](function(_0x12f9ca){_0x5c0ae4(_0x5ef03f);})['catch'](function(_0x27c033){logger[_0x88e0('0x12')](_0x88e0('0x4c'),_0x27c033[_0x88e0('0x14')],_0x408f61);_0xb7479d(validateExpressRequest);});});})['catch'](function(_0x458634){logger['error'](_0x88e0('0x4c'),_0x458634['message'],_0x408f61);_0xb7479d(_0x3db166[_0x88e0('0x12')](0x1f4,_0x458634[_0x88e0('0x14')]));});});}; \ No newline at end of file +var _0x1eae=['GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','limit','UPDATE','Contact','keys','User','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','List','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x7d4b9d,_0x494c27){var _0x568e19=function(_0x261b13){while(--_0x261b13){_0x7d4b9d['push'](_0x7d4b9d['shift']());}};_0x568e19(++_0x494c27);}(_0x1eae,0x196));var _0xe1ea=function(_0x3315de,_0x75bb88){_0x3315de=_0x3315de-0x0;var _0x4272c5=_0x1eae[_0x3315de];return _0x4272c5;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1ea('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe1ea('0x7'));var jayson=require(_0xe1ea('0x8'));const {validateExpressRequest}=require(_0xe1ea('0x9'));var client=jayson[_0xe1ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe71a,_0x2799bb,_0x14b13c){return new BPromise(function(_0x233105,_0x2be01c){return client[_0xe1ea('0xb')](_0x3fe71a,_0x14b13c)[_0xe1ea('0xc')](function(_0x1ae263){logger[_0xe1ea('0xd')](_0xe1ea('0xe'),_0x2799bb,_0xe1ea('0xf'));logger[_0xe1ea('0x10')](_0xe1ea('0x11'),_0x2799bb,_0xe1ea('0xf'),JSON[_0xe1ea('0x12')](_0x1ae263));if(_0x1ae263[_0xe1ea('0x13')]){if(_0x1ae263['error'][_0xe1ea('0x14')]===0x1f4){logger[_0xe1ea('0x13')]('CmHopper,\x20%s,\x20%s',_0x2799bb,_0x1ae263[_0xe1ea('0x13')][_0xe1ea('0x15')]);return _0x2be01c(_0x1ae263['error'][_0xe1ea('0x15')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x2799bb,_0x1ae263[_0xe1ea('0x13')][_0xe1ea('0x15')]);return _0x233105(_0x1ae263[_0xe1ea('0x13')][_0xe1ea('0x15')]);}else{logger[_0xe1ea('0xd')]('CmHopper,\x20%s,\x20%s',_0x2799bb,_0xe1ea('0xf'));_0x233105(_0x1ae263[_0xe1ea('0x16')][_0xe1ea('0x15')]);}})[_0xe1ea('0x17')](function(_0x46e94e){logger[_0xe1ea('0x13')](_0xe1ea('0xe'),_0x2799bb,_0x46e94e);_0x2be01c(_0x46e94e);});});}exports[_0xe1ea('0x18')]=function(_0x56dc69){var _0x28a6c1=this;return new Promise(function(_0xa4be39,_0x2c438e){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'raw':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x1e')]||null:null,'limit':_0x56dc69['options']?_0x56dc69[_0xe1ea('0x1b')]['limit']||null:null,'include':_0x56dc69[_0xe1ea('0x1b')]?_0x56dc69[_0xe1ea('0x1b')]['include']?_[_0xe1ea('0x1f')](_0x56dc69[_0xe1ea('0x1b')][_0xe1ea('0x20')],function(_0x37a607){return{'model':db[_0x37a607['model']],'as':_0x37a607['as'],'attributes':_0x37a607[_0xe1ea('0x1e')],'include':_0x37a607[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x37a607['include'],function(_0x5729a1){return{'model':db[_0x5729a1[_0xe1ea('0x21')]],'as':_0x5729a1['as'],'attributes':_0x5729a1['attributes'],'include':_0x5729a1[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x5729a1[_0xe1ea('0x20')],function(_0x2e1e1f){return{'model':db[_0x2e1e1f[_0xe1ea('0x21')]],'as':_0x2e1e1f['as'],'attributes':_0x2e1e1f['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x51318e){logger['info'](_0xe1ea('0x18'),_0x56dc69);logger[_0xe1ea('0x10')]('GetCmHopper',_0x56dc69,JSON[_0xe1ea('0x12')](_0x51318e));_0xa4be39(_0x51318e);})[_0xe1ea('0x17')](function(_0x1e3a06){logger[_0xe1ea('0x13')](_0xe1ea('0x18'),_0x1e3a06[_0xe1ea('0x15')],_0x56dc69);_0x2c438e(_0x28a6c1[_0xe1ea('0x13')](0x1f4,_0x1e3a06[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x22')]=function(_0x79f6e0){var _0x98dc8a=this;return new Promise(function(_0x5f30ce,_0x5ebd4d){return db['CmHopper'][_0xe1ea('0x23')]({'raw':_0x79f6e0['options']?_0x79f6e0[_0xe1ea('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x79f6e0['options']?_0x79f6e0['options']['where']||null:null,'attributes':_0x79f6e0[_0xe1ea('0x1b')]?_0x79f6e0[_0xe1ea('0x1b')][_0xe1ea('0x1e')]||null:null,'include':_0x79f6e0[_0xe1ea('0x1b')]?_0x79f6e0[_0xe1ea('0x1b')][_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x79f6e0['options'][_0xe1ea('0x20')],function(_0x255056){return{'model':db[_0x255056[_0xe1ea('0x21')]],'as':_0x255056['as'],'attributes':_0x255056[_0xe1ea('0x1e')],'include':_0x255056[_0xe1ea('0x20')]?_['map'](_0x255056['include'],function(_0x31e24f){return{'model':db[_0x31e24f[_0xe1ea('0x21')]],'as':_0x31e24f['as'],'attributes':_0x31e24f['attributes'],'include':_0x31e24f[_0xe1ea('0x20')]?_['map'](_0x31e24f['include'],function(_0x2e8ab5){return{'model':db[_0x2e8ab5[_0xe1ea('0x21')]],'as':_0x2e8ab5['as'],'attributes':_0x2e8ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x4eb62c){logger[_0xe1ea('0xd')](_0xe1ea('0x22'),_0x79f6e0);logger[_0xe1ea('0x10')](_0xe1ea('0x22'),_0x79f6e0,JSON[_0xe1ea('0x12')](_0x4eb62c));_0x5f30ce(_0x4eb62c);})[_0xe1ea('0x17')](function(_0xc25331){logger[_0xe1ea('0x13')](_0xe1ea('0x22'),_0xc25331['message'],_0x79f6e0);_0x5ebd4d(_0x98dc8a['error'](0x1f4,_0xc25331[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x24')]=function(_0x551550){var _0x268a45=this;return new Promise(function(_0x31dda1,_0x15315d){return db['CmHopper']['create'](_0x551550[_0xe1ea('0x25')],{'raw':_0x551550[_0xe1ea('0x1b')]?_0x551550[_0xe1ea('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1d62e1){logger[_0xe1ea('0xd')](_0xe1ea('0x24'),_0x551550);logger[_0xe1ea('0x10')](_0xe1ea('0x24'),_0x551550,JSON[_0xe1ea('0x12')](_0x1d62e1));_0x31dda1(_0x1d62e1);})[_0xe1ea('0x17')](function(_0x3db84f){logger[_0xe1ea('0x13')](_0xe1ea('0x24'),_0x3db84f[_0xe1ea('0x15')],_0x551550);_0x15315d(_0x268a45[_0xe1ea('0x13')](0x1f4,_0x3db84f[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x26')]=function(_0x447c1f){var _0x43d181=this;return new Promise(function(_0x7a6ff,_0x32d7d5){return db[_0xe1ea('0x19')][_0xe1ea('0x27')](_0x447c1f[_0xe1ea('0x25')],{'raw':_0x447c1f['options']?_0x447c1f['options'][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x447c1f[_0xe1ea('0x1b')]?_0x447c1f[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x447c1f['options']?_0x447c1f[_0xe1ea('0x1b')]['attributes']||null:null,'limit':_0x447c1f[_0xe1ea('0x1b')]?_0x447c1f['options']['limit']||null:null})[_0xe1ea('0xc')](function(_0x1bf4b3){logger[_0xe1ea('0xd')](_0xe1ea('0x26'),_0x447c1f);logger[_0xe1ea('0xd')](_0xe1ea('0x28'),JSON[_0xe1ea('0x12')](_0x447c1f[_0xe1ea('0x1b')][_0xe1ea('0x1d')]),_0x447c1f[_0xe1ea('0x25')][_0xe1ea('0x29')]);logger[_0xe1ea('0x10')](_0xe1ea('0x26'),_0x447c1f,JSON[_0xe1ea('0x12')](_0x1bf4b3));_0x7a6ff(_0x1bf4b3);})['catch'](function(_0x4b6774){logger['error'](_0xe1ea('0x26'),_0x4b6774[_0xe1ea('0x15')],_0x447c1f);_0x32d7d5(_0x43d181['error'](0x1f4,_0x4b6774[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x2a')]=function(_0x4df6da){var _0x299871=this;return new Promise(function(_0x24cc3d,_0x2fa47b){return db[_0xe1ea('0x19')][_0xe1ea('0x2b')]({'where':_0x4df6da[_0xe1ea('0x1b')]?_0x4df6da['options'][_0xe1ea('0x1d')]||null:null})['then'](function(_0x228cda){logger[_0xe1ea('0xd')](_0xe1ea('0x2a'),_0x4df6da);logger[_0xe1ea('0x10')]('DestroyCmHopper',_0x4df6da,JSON[_0xe1ea('0x12')](_0x228cda));_0x24cc3d(_0x228cda);})[_0xe1ea('0x17')](function(_0x1e0554){logger['error'](_0xe1ea('0x2a'),_0x1e0554[_0xe1ea('0x15')],_0x4df6da);_0x2fa47b(_0x299871[_0xe1ea('0x13')](0x1f4,_0x1e0554[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x2c')]=function(_0x20146c){var _0x2e832d=this;return new Promise(function(_0xe517e2,_0x292bb5){return db[_0xe1ea('0x2d')][_0xe1ea('0x2e')]()[_0xe1ea('0xc')](function(_0x4759d2){return db[_0xe1ea('0x2f')][_0xe1ea('0x30')](function(_0x596ceb){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'where':_0x20146c[_0xe1ea('0x1b')]?_0x20146c[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x20146c[_0xe1ea('0x1b')]?_0x20146c['options']['attributes']||null:null,'limit':_0x20146c['options']?_0x20146c[_0xe1ea('0x1b')][_0xe1ea('0x31')]||null:null,'order':_0x20146c[_0xe1ea('0x1b')]?_0x20146c[_0xe1ea('0x1b')]['order']||null:null,'transaction':_0x596ceb,'lock':_0x596ceb['LOCK'][_0xe1ea('0x32')],'include':[{'model':db['CmContact'],'as':_0xe1ea('0x33'),'attributes':_[_0xe1ea('0x34')](_0x4759d2)},{'model':db[_0xe1ea('0x35')],'as':'Agent','attributes':['id',_0xe1ea('0x36'),_0xe1ea('0x37')]}]})[_0xe1ea('0xc')](function(_0x4f64c8){var _0x1bd200=[];var _0x1c5b9c=[];for(var _0x308e3b=0x0;_0x308e3b<_0x4f64c8['length'];_0x308e3b+=0x1){var _0x2f6c72=_0x4f64c8[_0x308e3b][_0xe1ea('0x38')];if(_0x2f6c72===null){_0x1bd200[_0xe1ea('0x39')](_0x4f64c8[_0x308e3b][_0xe1ea('0x27')](_0x20146c[_0xe1ea('0x25')],{'transaction':_0x596ceb}));}else if(!_0x1c5b9c[_0xe1ea('0x3a')](_0x2f6c72)){_0x1c5b9c[_0xe1ea('0x39')](_0x2f6c72);_0x1bd200[_0xe1ea('0x39')](_0x4f64c8[_0x308e3b][_0xe1ea('0x27')](_0x20146c['body'],{'transaction':_0x596ceb}));}}return BPromise[_0xe1ea('0x3b')](_0x1bd200);});})[_0xe1ea('0xc')](function(_0x54eeba){logger[_0xe1ea('0xd')]('GetContactDialer',_0x20146c);if(_0x54eeba[_0xe1ea('0x3c')]>0x0){logger[_0xe1ea('0xd')](_0xe1ea('0x3d'),_0x54eeba[0x0][_0xe1ea('0x3e')]['id'],_0x54eeba[0x0][_0xe1ea('0x3e')][_0xe1ea('0x3f')],_0x54eeba[0x0][_0xe1ea('0x3e')][_0xe1ea('0x29')]);}logger[_0xe1ea('0x10')]('GetContactDialer',_0x20146c,JSON[_0xe1ea('0x12')](_0x54eeba));_0xe517e2(_0x54eeba);})['catch'](function(_0x5d70f2){logger[_0xe1ea('0x13')](_0xe1ea('0x2c'),_0x5d70f2[_0xe1ea('0x15')],_0x20146c);_0x292bb5(_0x2e832d['error'](0x1f4,_0x5d70f2['message']));});});});};exports[_0xe1ea('0x40')]=function(_0x58c37a){var _0x210bc8=this;return new Promise(function(_0x442914,_0x4c32ac){return db['sequelize'][_0xe1ea('0x30')](function(_0x13d995){return db[_0xe1ea('0x41')][_0xe1ea('0x42')](_0x58c37a['body'],{'raw':_0x58c37a[_0xe1ea('0x1b')]?_0x58c37a[_0xe1ea('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x13d995})[_0xe1ea('0xc')](function(){logger[_0xe1ea('0xd')](_0xe1ea('0x43'),JSON['stringify'](_0x58c37a[_0xe1ea('0x1b')][_0xe1ea('0x1d')]),_0x58c37a['options'][_0xe1ea('0x1d')][_0xe1ea('0x29')]);return db['CmHopper']['destroy']({'where':_0x58c37a[_0xe1ea('0x1b')]?_0x58c37a[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'transaction':_0x13d995});});})[_0xe1ea('0xc')](function(_0x45ca23){logger[_0xe1ea('0xd')](_0xe1ea('0x40'),_0x58c37a);logger['debug']('MoveContactManagedDialer',_0x58c37a,JSON[_0xe1ea('0x12')](_0x45ca23));_0x442914(_0x45ca23);})['catch'](function(_0x12d232){logger[_0xe1ea('0x13')](_0xe1ea('0x40'),_0x12d232[_0xe1ea('0x15')],_0x58c37a);_0x4c32ac(_0x210bc8[_0xe1ea('0x13')](0x1f4,_0x12d232[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x44')]=function(_0x4f5b92){var _0x4d4de1=this;return new Promise(function(_0x42c2e8,_0x29f303){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'raw':_0x4f5b92[_0xe1ea('0x1b')]?_0x4f5b92[_0xe1ea('0x1b')][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f5b92[_0xe1ea('0x1b')]?_0x4f5b92[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':[[db[_0xe1ea('0x2f')]['fn'](_0xe1ea('0x45'),db[_0xe1ea('0x2f')]['fn']('IF',db[_0xe1ea('0x2f')][_0xe1ea('0x46')]('`scheduledat`\x20>=\x20'+util[_0xe1ea('0x47')](_0xe1ea('0x48'),moment()[_0xe1ea('0x47')](_0xe1ea('0x49')))+_0xe1ea('0x4a')))),_0xe1ea('0x4b')]]})['then'](function(_0x529d89){logger[_0xe1ea('0xd')](_0xe1ea('0x44'),_0x4f5b92);logger[_0xe1ea('0x10')]('CountReScheduled',_0x4f5b92,JSON['stringify'](_0x529d89));_0x42c2e8(_0x529d89);})[_0xe1ea('0x17')](function(_0x184a96){logger[_0xe1ea('0x13')](_0xe1ea('0x44'),_0x184a96[_0xe1ea('0x15')],_0x4f5b92);_0x29f303(_0x4d4de1[_0xe1ea('0x13')](0x1f4,_0x184a96[_0xe1ea('0x15')]));});});};exports[_0xe1ea('0x4c')]=function(_0x49e85b){var _0x288aee=this;return new Promise(function(_0x5a9b88,_0x3dfd49){return db[_0xe1ea('0x2d')][_0xe1ea('0x2e')]()['then'](function(_0x175e44){return db[_0xe1ea('0x2f')][_0xe1ea('0x30')](function(_0x1d6602){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'where':_0x49e85b[_0xe1ea('0x1b')]?_0x49e85b[_0xe1ea('0x1b')]['where']||null:null,'attributes':_0x49e85b[_0xe1ea('0x1b')]?_0x49e85b[_0xe1ea('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x49e85b[_0xe1ea('0x1b')]?_0x49e85b['options'][_0xe1ea('0x4d')]||null:null,'group':db['CmHopper'][_0xe1ea('0x38')],'transaction':_0x1d6602,'lock':_0x1d6602[_0xe1ea('0x4e')][_0xe1ea('0x32')],'include':_0x49e85b['options']?_0x49e85b[_0xe1ea('0x1b')][_0xe1ea('0x20')]?_['map'](_0x49e85b['options']['include'],function(_0x1460b2){return{'model':db[_0x1460b2['model']],'as':_0x1460b2['as'],'attributes':_0x1460b2[_0xe1ea('0x1e')],'include':_0x1460b2[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x1460b2[_0xe1ea('0x20')],function(_0x536cbb){return{'model':db[_0x536cbb[_0xe1ea('0x21')]],'as':_0x536cbb['as'],'attributes':_0x536cbb[_0xe1ea('0x1e')],'include':_0x536cbb['include']?_['map'](_0x536cbb['include'],function(_0x2630ff){return{'model':db[_0x2630ff['model']],'as':_0x2630ff['as'],'attributes':_0x2630ff['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x140f6e){var _0x5222da=[];for(var _0x10175d=0x0;_0x10175d<_0x140f6e[_0xe1ea('0x3c')];_0x10175d+=0x1){_0x5222da['push'](_0x140f6e[_0x10175d][_0xe1ea('0x27')](_0x49e85b[_0xe1ea('0x25')],{'transaction':_0x1d6602}));}return BPromise[_0xe1ea('0x3b')](_0x5222da);});})[_0xe1ea('0xc')](function(_0x5b26ff){logger['info'](_0xe1ea('0x4c'),_0x49e85b);logger[_0xe1ea('0x10')](_0xe1ea('0x4c'),_0x49e85b,JSON[_0xe1ea('0x12')](_0x5b26ff));_0x5a9b88(_0x5b26ff);})[_0xe1ea('0x17')](function(_0x5a4294){logger[_0xe1ea('0x13')](_0xe1ea('0x4c'),_0x5a4294[_0xe1ea('0x15')],_0x49e85b);_0x3dfd49(_0x288aee[_0xe1ea('0x13')](0x1f4,_0x5a4294['message']));});});});};exports[_0xe1ea('0x4f')]=function(_0x16c406){var _0x3b5403=this;return new Promise(function(_0x4a468f,_0x4708df){db['CmContact'][_0xe1ea('0x2e')]()['then'](function(_0x29ff7a){return db[_0xe1ea('0x19')][_0xe1ea('0x1a')]({'raw':_0x16c406[_0xe1ea('0x1b')]?_0x16c406['options'][_0xe1ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x16c406[_0xe1ea('0x1b')]?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x1d')]||null:null,'attributes':_0x16c406['options']?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x1e')]||null:null,'limit':_0x16c406[_0xe1ea('0x1b')]?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x31')]||null:null,'include':_0x16c406[_0xe1ea('0x1b')]?_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x16c406[_0xe1ea('0x1b')][_0xe1ea('0x20')],function(_0x579100){return{'model':db[_0x579100[_0xe1ea('0x21')]],'as':_0x579100['as'],'attributes':_0x579100['as']===_0xe1ea('0x33')?_[_0xe1ea('0x34')](_0x29ff7a):_0x579100[_0xe1ea('0x1e')],'include':_0x579100[_0xe1ea('0x20')]?_[_0xe1ea('0x1f')](_0x579100['include'],function(_0x1ae3c1){return{'model':db[_0x1ae3c1[_0xe1ea('0x21')]],'as':_0x1ae3c1['as'],'attributes':_0x1ae3c1[_0xe1ea('0x1e')],'include':_0x1ae3c1[_0xe1ea('0x20')]?_['map'](_0x1ae3c1['include'],function(_0x3f3ec2){return{'model':db[_0x3f3ec2[_0xe1ea('0x21')]],'as':_0x3f3ec2['as'],'attributes':_0x3f3ec2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xc')](function(_0x1095c0){logger[_0xe1ea('0xd')](_0xe1ea('0x18'),_0x16c406);logger['debug'](_0xe1ea('0x18'),_0x16c406,JSON['stringify'](_0x1095c0));_0x4a468f(_0x1095c0);})['catch'](function(_0x27aafe){logger['error'](_0xe1ea('0x18'),_0x27aafe[_0xe1ea('0x15')],_0x16c406);_0x4708df(_0x3b5403[_0xe1ea('0x13')](0x1f4,_0x27aafe[_0xe1ea('0x15')]));});});});};exports[_0xe1ea('0x50')]=function(_0x5c9f0e){var _0x4a500e=this;return new Promise(function(_0x447567,_0x436935){return db['sequelize'][_0xe1ea('0x30')](function(_0x1c0d8a){return db[_0xe1ea('0x19')][_0xe1ea('0x27')]({'active':![]},{'where':{},'transaction':_0x1c0d8a})['then'](function(_0x4f9569){logger['info'](_0xe1ea('0x50'),_0x5c9f0e);logger[_0xe1ea('0x10')](_0xe1ea('0x50'),_0x5c9f0e,JSON[_0xe1ea('0x12')](_0x4f9569));_0x447567(_0x4f9569);})[_0xe1ea('0x17')](function(_0x42b59f){logger[_0xe1ea('0x13')](_0xe1ea('0x50'),_0x42b59f['message'],_0x5c9f0e);_0x436935(_0x4a500e['error'](0x1f4,_0x42b59f[_0xe1ea('0x15')]));});});});};exports[_0xe1ea('0x51')]=function(_0x479630){var _0x4ebada=this;var _0x1e90c2=_0x479630['body'][_0xe1ea('0x1d')][_0xe1ea('0x52')];var _0x4140ba=_0x479630[_0xe1ea('0x25')][_0xe1ea('0x1d')][_0xe1ea('0x53')];return new Promise(function(_0x55891c,_0x13a583){return db['CmHopper'][_0xe1ea('0x1a')]({'where':{'voiceQueueId':_0x1e90c2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0xe1ea('0x54')+_0x4140ba+'\x20MINUTE')}},'include':[{'model':db[_0xe1ea('0x2d')],'as':'Contact'},{'model':db[_0xe1ea('0x35')],'as':'Agent','attributes':['id',_0xe1ea('0x36'),'voicePause']},{'model':db['CmList'],'as':_0xe1ea('0x55')}]})['then'](function(_0x4c90c7){return db[_0xe1ea('0x2f')][_0xe1ea('0x30')](function(_0x5d9172){return db['CmHopper'][_0xe1ea('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x1e90c2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xe1ea('0x2f')][_0xe1ea('0x46')](_0xe1ea('0x54')+_0x4140ba+'\x20MINUTE')}},'transaction':_0x5d9172})[_0xe1ea('0xc')](function(_0x40cc34){_0x55891c(_0x4c90c7);})[_0xe1ea('0x17')](function(_0x5b4b0e){logger[_0xe1ea('0x13')](_0xe1ea('0x51'),_0x5b4b0e[_0xe1ea('0x15')],_0x479630);_0x13a583(validateExpressRequest);});});})[_0xe1ea('0x17')](function(_0x298020){logger[_0xe1ea('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x298020['message'],_0x479630);_0x13a583(_0x4ebada['error'](0x1f4,_0x298020[_0xe1ea('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 37dbf69..9034910 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 _0x4d7c=['/preview','getPreviewRecall','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','/describe','describe','get','/opencontacts','getOpenContacts','/:id','show','post','create'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x4d7c,0x1a5));var _0xc4d7=function(_0x543aed,_0x7d8f3f){_0x543aed=_0x543aed-0x0;var _0x4db55d=_0x4d7c[_0x543aed];return _0x4db55d;};'use strict';var multer=require(_0xc4d7('0x0'));var util=require('util');var path=require(_0xc4d7('0x1'));var timeout=require(_0xc4d7('0x2'));var express=require(_0xc4d7('0x3'));var router=express[_0xc4d7('0x4')]();var fs_extra=require(_0xc4d7('0x5'));var auth=require(_0xc4d7('0x6'));var interaction=require(_0xc4d7('0x7'));var config=require(_0xc4d7('0x8'));var controller=require(_0xc4d7('0x9'));router['get']('/',auth[_0xc4d7('0xa')](),controller[_0xc4d7('0xb')]);router['get'](_0xc4d7('0xc'),auth[_0xc4d7('0xa')](),controller[_0xc4d7('0xd')]);router[_0xc4d7('0xe')](_0xc4d7('0xf'),auth[_0xc4d7('0xa')](),controller[_0xc4d7('0x10')]);router[_0xc4d7('0xe')](_0xc4d7('0x11'),auth[_0xc4d7('0xa')](),controller[_0xc4d7('0x12')]);router[_0xc4d7('0x13')]('/',auth[_0xc4d7('0xa')](),controller[_0xc4d7('0x14')]);router[_0xc4d7('0x13')](_0xc4d7('0x15'),auth['isAuthenticated'](),controller['getPreview']);router['post']('/previewrecall',auth['isAuthenticated'](),controller[_0xc4d7('0x16')]);router[_0xc4d7('0x17')](_0xc4d7('0x11'),auth[_0xc4d7('0xa')](),controller[_0xc4d7('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc4d7('0x19')]=router; \ No newline at end of file +var _0xcfda=['getOpenContacts','/:id','isAuthenticated','show','post','create','/preview','getPreview','/previewrecall','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','index','get','/describe','describe','/opencontacts'];(function(_0x43d637,_0x222c15){var _0x2c429b=function(_0x242453){while(--_0x242453){_0x43d637['push'](_0x43d637['shift']());}};_0x2c429b(++_0x222c15);}(_0xcfda,0xca));var _0xacfd=function(_0x5c5233,_0x241813){_0x5c5233=_0x5c5233-0x0;var _0x3b9cbd=_0xcfda[_0x5c5233];return _0x3b9cbd;};'use strict';var multer=require(_0xacfd('0x0'));var util=require(_0xacfd('0x1'));var path=require('path');var timeout=require(_0xacfd('0x2'));var express=require('express');var router=express[_0xacfd('0x3')]();var fs_extra=require(_0xacfd('0x4'));var auth=require(_0xacfd('0x5'));var interaction=require(_0xacfd('0x6'));var config=require(_0xacfd('0x7'));var controller=require(_0xacfd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xacfd('0x9')]);router[_0xacfd('0xa')](_0xacfd('0xb'),auth['isAuthenticated'](),controller[_0xacfd('0xc')]);router['get'](_0xacfd('0xd'),auth['isAuthenticated'](),controller[_0xacfd('0xe')]);router[_0xacfd('0xa')](_0xacfd('0xf'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x11')]);router[_0xacfd('0x12')]('/',auth['isAuthenticated'](),controller[_0xacfd('0x13')]);router[_0xacfd('0x12')](_0xacfd('0x14'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x15')]);router[_0xacfd('0x12')](_0xacfd('0x16'),auth[_0xacfd('0x10')](),controller['getPreviewRecall']);router[_0xacfd('0x17')](_0xacfd('0xf'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x18')]);router[_0xacfd('0x19')](_0xacfd('0xf'),auth[_0xacfd('0x10')](),controller[_0xacfd('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c74ddad..0db264f 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 _0x28ff=['contactListQueue','INTEGER','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x28ff,0x7a));var _0xf28f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x28ff[_0x3bf83f];return _0x22c4a9;};'use strict';var moment=require('moment');var Sequelize=require(_0xf28f('0x0'));module[_0xf28f('0x1')]={'phone':{'type':Sequelize[_0xf28f('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xf28f('0x3')},'ListId':{'type':Sequelize[_0xf28f('0x4')],'unique':_0xf28f('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf28f('0x3')}}; \ No newline at end of file +var _0x5ff9=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x2fec51,_0x480819){var _0x4d2f6f=function(_0xd3f55f){while(--_0xd3f55f){_0x2fec51['push'](_0x2fec51['shift']());}};_0x4d2f6f(++_0x480819);}(_0x5ff9,0xa0));var _0x95ff=function(_0x14e60d,_0x1da9b4){_0x14e60d=_0x14e60d-0x0;var _0x2d93fb=_0x5ff9[_0x14e60d];return _0x2d93fb;};'use strict';var moment=require(_0x95ff('0x0'));var Sequelize=require(_0x95ff('0x1'));module['exports']={'phone':{'type':Sequelize[_0x95ff('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x95ff('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x95ff('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2ef4e07..98f1015 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 _0xdb82=['reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xdb82,0x1dc));var _0x2db8=function(_0x46aa17,_0x40a731){_0x46aa17=_0x46aa17-0x0;var _0xf4bd0f=_0xdb82[_0x46aa17];return _0xf4bd0f;};'use strict';var emlformat=require(_0x2db8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2db8('0x1'));var jsonpatch=require(_0x2db8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2db8('0x3'));var Mustache=require(_0x2db8('0x4'));var util=require(_0x2db8('0x5'));var path=require(_0x2db8('0x6'));var sox=require(_0x2db8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2db8('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2db8('0x9'));var deskjs=require(_0x2db8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2db8('0xb'));var authService=require(_0x2db8('0xc'));var qs=require(_0x2db8('0xd'));var as=require(_0x2db8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2db8('0xf'))(_0x2db8('0x10'));var utils=require(_0x2db8('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2db8('0x12'))['db'];function respondWithStatusCode(_0x21befb,_0x150870){_0x150870=_0x150870||0xcc;return function(_0x200ffe){if(_0x200ffe){return _0x21befb['sendStatus'](_0x150870);}return _0x21befb[_0x2db8('0x13')](_0x150870)[_0x2db8('0x14')]();};}function respondWithResult(_0x1476ba,_0x3285a2){_0x3285a2=_0x3285a2||0xc8;return function(_0x51a9e1){if(_0x51a9e1){return _0x1476ba[_0x2db8('0x13')](_0x3285a2)[_0x2db8('0x15')](_0x51a9e1);}};}function respondWithFilteredResult(_0x2fa4fe,_0x42001e){return function(_0x3d1f5f){if(_0x3d1f5f){var _0x212797=typeof _0x42001e['offset']===_0x2db8('0x16')&&typeof _0x42001e[_0x2db8('0x17')]===_0x2db8('0x16');var _0xbb7ad9=_0x3d1f5f[_0x2db8('0x18')];var _0x251481=_0x212797?0x0:_0x42001e[_0x2db8('0x19')];var _0x3d1f68=_0x212797?_0x3d1f5f[_0x2db8('0x18')]:_0x42001e['offset']+_0x42001e[_0x2db8('0x17')];var _0x5193ce;if(_0x3d1f68>=_0xbb7ad9){_0x3d1f68=_0xbb7ad9;_0x5193ce=0xc8;}else{_0x5193ce=0xce;}_0x2fa4fe['status'](_0x5193ce);return _0x2fa4fe[_0x2db8('0x1a')]('Content-Range',_0x251481+'-'+_0x3d1f68+'/'+_0xbb7ad9)[_0x2db8('0x15')](_0x3d1f5f);}return null;};}function patchUpdates(_0x5764f8){return function(_0x304d6b){try{jsonpatch[_0x2db8('0x1b')](_0x304d6b,_0x5764f8,!![]);}catch(_0x4a5e86){return BPromise[_0x2db8('0x1c')](_0x4a5e86);}return _0x304d6b[_0x2db8('0x1d')]();};}function saveUpdates(_0x140585,_0x6183f3){return function(_0x407b74){if(_0x407b74){return _0x407b74[_0x2db8('0x1e')](_0x140585)['then'](function(_0x5c61d3){return _0x5c61d3;});}return null;};}function removeEntity(_0x3ab9c0,_0xe8d69b){return function(_0x584493){if(_0x584493){return _0x584493[_0x2db8('0x1f')]()[_0x2db8('0x20')](function(){_0x3ab9c0[_0x2db8('0x13')](0xcc)[_0x2db8('0x14')]();});}};}function handleEntityNotFound(_0x1d7ce6,_0x2f71db){return function(_0x1d1fda){if(!_0x1d1fda){_0x1d7ce6[_0x2db8('0x21')](0x194);}return _0x1d1fda;};}function handleError(_0x432a07,_0x25bfe4){_0x25bfe4=_0x25bfe4||0x1f4;return function(_0x58bff1){logger[_0x2db8('0x22')](_0x58bff1[_0x2db8('0x23')]);if(_0x58bff1[_0x2db8('0x24')]){delete _0x58bff1[_0x2db8('0x24')];}_0x432a07[_0x2db8('0x13')](_0x25bfe4)[_0x2db8('0x25')](_0x58bff1);};}exports[_0x2db8('0x26')]=function(_0x8af2e8,_0x3569ae){var _0x3de877={},_0x48c740={},_0x37049d={'count':0x0,'rows':[]};var _0x31335f=_['map'](db[_0x2db8('0x27')][_0x2db8('0x28')],function(_0x3b808c){return{'name':_0x3b808c[_0x2db8('0x29')],'type':_0x3b808c['type'][_0x2db8('0x2a')]};});_0x48c740[_0x2db8('0x2b')]=_[_0x2db8('0x2c')](_0x31335f,_0x2db8('0x24'));_0x48c740[_0x2db8('0x2d')]=_[_0x2db8('0x2e')](_0x8af2e8[_0x2db8('0x2d')]);_0x48c740[_0x2db8('0x2f')]=_[_0x2db8('0x30')](_0x48c740[_0x2db8('0x2b')],_0x48c740['query']);_0x3de877['attributes']=_[_0x2db8('0x30')](_0x48c740[_0x2db8('0x2b')],qs[_0x2db8('0x31')](_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x31')]));_0x3de877[_0x2db8('0x32')]=_0x3de877['attributes']['length']?_0x3de877[_0x2db8('0x32')]:_0x48c740[_0x2db8('0x2b')];if(!_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x33')](_0x2db8('0x34'))){_0x3de877['limit']=qs[_0x2db8('0x17')](_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x17')]);_0x3de877[_0x2db8('0x19')]=qs['offset'](_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x19')]);}_0x3de877['order']=qs['sort'](_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x35')]);_0x3de877['where']=qs[_0x2db8('0x2f')](_[_0x2db8('0x36')](_0x8af2e8[_0x2db8('0x2d')],_0x48c740[_0x2db8('0x2f')]),_0x31335f);if(_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x37')]){_0x3de877[_0x2db8('0x38')]=_[_0x2db8('0x39')](_0x3de877[_0x2db8('0x38')],{'$or':_['map'](_0x31335f,function(_0x34f9f1){if(_0x34f9f1[_0x2db8('0x3a')]!==_0x2db8('0x3b')){var _0x466653={};_0x466653[_0x34f9f1['name']]={'$like':'%'+_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x37')]+'%'};return _0x466653;}})});}_0x3de877=_['merge']({},_0x3de877,_0x8af2e8[_0x2db8('0x3c')]);var _0x540f72={'where':_0x3de877[_0x2db8('0x38')]};return db[_0x2db8('0x27')][_0x2db8('0x18')](_0x540f72)['then'](function(_0x4ca208){_0x37049d[_0x2db8('0x18')]=_0x4ca208;if(_0x8af2e8[_0x2db8('0x2d')][_0x2db8('0x3d')]){_0x3de877[_0x2db8('0x3e')]=[{'all':!![]}];}return db[_0x2db8('0x27')][_0x2db8('0x3f')](_0x3de877);})[_0x2db8('0x20')](function(_0x3e0de0){_0x37049d[_0x2db8('0x40')]=_0x3e0de0;return _0x37049d;})['then'](respondWithFilteredResult(_0x3569ae,_0x3de877))['catch'](handleError(_0x3569ae,null));};exports[_0x2db8('0x41')]=function(_0xf7023b,_0x5e5196){var _0x1e5c35={'raw':!![],'where':{'id':_0xf7023b[_0x2db8('0x42')]['id']}},_0x33d518={};_0x33d518[_0x2db8('0x2b')]=_[_0x2db8('0x2e')](db[_0x2db8('0x27')]['rawAttributes']);_0x33d518[_0x2db8('0x2d')]=_[_0x2db8('0x2e')](_0xf7023b[_0x2db8('0x2d')]);_0x33d518[_0x2db8('0x2f')]=_[_0x2db8('0x30')](_0x33d518[_0x2db8('0x2b')],_0x33d518[_0x2db8('0x2d')]);_0x1e5c35[_0x2db8('0x32')]=_[_0x2db8('0x30')](_0x33d518[_0x2db8('0x2b')],qs['fields'](_0xf7023b[_0x2db8('0x2d')]['fields']));_0x1e5c35[_0x2db8('0x32')]=_0x1e5c35['attributes'][_0x2db8('0x43')]?_0x1e5c35[_0x2db8('0x32')]:_0x33d518[_0x2db8('0x2b')];if(_0xf7023b['query']['includeAll']){_0x1e5c35[_0x2db8('0x3e')]=[{'all':!![]}];}_0x1e5c35=_[_0x2db8('0x39')]({},_0x1e5c35,_0xf7023b[_0x2db8('0x3c')]);return db[_0x2db8('0x27')][_0x2db8('0x44')](_0x1e5c35)[_0x2db8('0x20')](handleEntityNotFound(_0x5e5196,null))[_0x2db8('0x20')](respondWithResult(_0x5e5196,null))[_0x2db8('0x45')](handleError(_0x5e5196,null));};exports['update']=function(_0x20a569,_0x3e20ed){if(_0x20a569[_0x2db8('0x46')]['id']){delete _0x20a569[_0x2db8('0x46')]['id'];}return db[_0x2db8('0x27')][_0x2db8('0x44')]({'where':{'id':_0x20a569[_0x2db8('0x42')]['id']}})[_0x2db8('0x20')](handleEntityNotFound(_0x3e20ed,null))['then'](saveUpdates(_0x20a569[_0x2db8('0x46')],null))[_0x2db8('0x20')](respondWithResult(_0x3e20ed,null))[_0x2db8('0x45')](handleError(_0x3e20ed,null));};exports[_0x2db8('0x1f')]=function(_0x91b421,_0x47a33b){return db[_0x2db8('0x27')][_0x2db8('0x44')]({'where':{'id':_0x91b421[_0x2db8('0x42')]['id']}})[_0x2db8('0x20')](handleEntityNotFound(_0x47a33b,null))[_0x2db8('0x20')](removeEntity(_0x47a33b,null))['catch'](handleError(_0x47a33b,null));};exports[_0x2db8('0x47')]=function(_0x4f1824,_0x3fbcc4){return db[_0x2db8('0x27')]['describe']()[_0x2db8('0x20')](respondWithResult(_0x3fbcc4,null))['catch'](handleError(_0x3fbcc4,null));}; \ No newline at end of file +var _0x3525=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel'];(function(_0x20fe26,_0x4ef59b){var _0x564da2=function(_0x248a3e){while(--_0x248a3e){_0x20fe26['push'](_0x20fe26['shift']());}};_0x564da2(++_0x4ef59b);}(_0x3525,0x16a));var _0x5352=function(_0x5ed8d3,_0x3f149c){_0x5ed8d3=_0x5ed8d3-0x0;var _0x4ae472=_0x3525[_0x5ed8d3];return _0x4ae472;};'use strict';var emlformat=require(_0x5352('0x0'));var rimraf=require(_0x5352('0x1'));var zipdir=require(_0x5352('0x2'));var jsonpatch=require(_0x5352('0x3'));var rp=require(_0x5352('0x4'));var moment=require(_0x5352('0x5'));var BPromise=require(_0x5352('0x6'));var Mustache=require(_0x5352('0x7'));var util=require(_0x5352('0x8'));var path=require('path');var sox=require(_0x5352('0x9'));var csv=require(_0x5352('0xa'));var ejs=require(_0x5352('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5352('0xc'));var crypto=require(_0x5352('0xd'));var jsforce=require(_0x5352('0xe'));var deskjs=require(_0x5352('0xf'));var toCsv=require(_0x5352('0xa'));var querystring=require('querystring');var Papa=require(_0x5352('0x10'));var Redis=require(_0x5352('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5352('0x12'));var as=require(_0x5352('0x13'));var hardwareService=require(_0x5352('0x14'));var logger=require(_0x5352('0x15'))(_0x5352('0x16'));var utils=require(_0x5352('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f0e5,_0x3ccde3){_0x3ccde3=_0x3ccde3||0xcc;return function(_0x11d2c4){if(_0x11d2c4){return _0x45f0e5[_0x5352('0x18')](_0x3ccde3);}return _0x45f0e5[_0x5352('0x19')](_0x3ccde3)[_0x5352('0x1a')]();};}function respondWithResult(_0x213cd1,_0x471186){_0x471186=_0x471186||0xc8;return function(_0x1894dd){if(_0x1894dd){return _0x213cd1['status'](_0x471186)['json'](_0x1894dd);}};}function respondWithFilteredResult(_0x246eb3,_0x5c5be4){return function(_0x343491){if(_0x343491){var _0x27e58f=typeof _0x5c5be4[_0x5352('0x1b')]===_0x5352('0x1c')&&typeof _0x5c5be4[_0x5352('0x1d')]===_0x5352('0x1c');var _0xb5a7a5=_0x343491[_0x5352('0x1e')];var _0x2c076c=_0x27e58f?0x0:_0x5c5be4[_0x5352('0x1b')];var _0x28a8a1=_0x27e58f?_0x343491['count']:_0x5c5be4[_0x5352('0x1b')]+_0x5c5be4['limit'];var _0x39a8f6;if(_0x28a8a1>=_0xb5a7a5){_0x28a8a1=_0xb5a7a5;_0x39a8f6=0xc8;}else{_0x39a8f6=0xce;}_0x246eb3[_0x5352('0x19')](_0x39a8f6);return _0x246eb3[_0x5352('0x1f')](_0x5352('0x20'),_0x2c076c+'-'+_0x28a8a1+'/'+_0xb5a7a5)[_0x5352('0x21')](_0x343491);}return null;};}function patchUpdates(_0x509bf9){return function(_0x57979f){try{jsonpatch[_0x5352('0x22')](_0x57979f,_0x509bf9,!![]);}catch(_0xcc24b6){return BPromise[_0x5352('0x23')](_0xcc24b6);}return _0x57979f[_0x5352('0x24')]();};}function saveUpdates(_0x7a6298,_0x5f1f9d){return function(_0x48fa99){if(_0x48fa99){return _0x48fa99[_0x5352('0x25')](_0x7a6298)['then'](function(_0xda1b27){return _0xda1b27;});}return null;};}function removeEntity(_0x47c896,_0x5e4bdc){return function(_0x5cdd64){if(_0x5cdd64){return _0x5cdd64[_0x5352('0x26')]()['then'](function(){_0x47c896[_0x5352('0x19')](0xcc)[_0x5352('0x1a')]();});}};}function handleEntityNotFound(_0x59da7c,_0x304b17){return function(_0x129bdf){if(!_0x129bdf){_0x59da7c['sendStatus'](0x194);}return _0x129bdf;};}function handleError(_0x532da7,_0x55a5f7){_0x55a5f7=_0x55a5f7||0x1f4;return function(_0x36d758){logger['error'](_0x36d758[_0x5352('0x27')]);if(_0x36d758[_0x5352('0x28')]){delete _0x36d758[_0x5352('0x28')];}_0x532da7[_0x5352('0x19')](_0x55a5f7)[_0x5352('0x29')](_0x36d758);};}exports[_0x5352('0x2a')]=function(_0x31cbb5,_0x29714c){var _0x4189cb={},_0x1f16db={},_0x5d8bb6={'count':0x0,'rows':[]};var _0x2be40e=_[_0x5352('0x2b')](db[_0x5352('0x2c')][_0x5352('0x2d')],function(_0x21ee2d){return{'name':_0x21ee2d[_0x5352('0x2e')],'type':_0x21ee2d[_0x5352('0x2f')][_0x5352('0x30')]};});_0x1f16db[_0x5352('0x31')]=_['map'](_0x2be40e,_0x5352('0x28'));_0x1f16db[_0x5352('0x32')]=_[_0x5352('0x33')](_0x31cbb5[_0x5352('0x32')]);_0x1f16db['filters']=_['intersection'](_0x1f16db[_0x5352('0x31')],_0x1f16db[_0x5352('0x32')]);_0x4189cb[_0x5352('0x34')]=_[_0x5352('0x35')](_0x1f16db[_0x5352('0x31')],qs[_0x5352('0x36')](_0x31cbb5[_0x5352('0x32')]['fields']));_0x4189cb[_0x5352('0x34')]=_0x4189cb['attributes']['length']?_0x4189cb[_0x5352('0x34')]:_0x1f16db[_0x5352('0x31')];if(!_0x31cbb5[_0x5352('0x32')][_0x5352('0x37')](_0x5352('0x38'))){_0x4189cb[_0x5352('0x1d')]=qs['limit'](_0x31cbb5[_0x5352('0x32')][_0x5352('0x1d')]);_0x4189cb[_0x5352('0x1b')]=qs['offset'](_0x31cbb5['query'][_0x5352('0x1b')]);}_0x4189cb[_0x5352('0x39')]=qs[_0x5352('0x3a')](_0x31cbb5[_0x5352('0x32')]['sort']);_0x4189cb[_0x5352('0x3b')]=qs[_0x5352('0x3c')](_['pick'](_0x31cbb5[_0x5352('0x32')],_0x1f16db[_0x5352('0x3c')]),_0x2be40e);if(_0x31cbb5[_0x5352('0x32')]['filter']){_0x4189cb[_0x5352('0x3b')]=_['merge'](_0x4189cb[_0x5352('0x3b')],{'$or':_[_0x5352('0x2b')](_0x2be40e,function(_0x12cb5e){if(_0x12cb5e[_0x5352('0x2f')]!=='VIRTUAL'){var _0x4d1856={};_0x4d1856[_0x12cb5e['name']]={'$like':'%'+_0x31cbb5[_0x5352('0x32')][_0x5352('0x3d')]+'%'};return _0x4d1856;}})});}_0x4189cb=_[_0x5352('0x3e')]({},_0x4189cb,_0x31cbb5[_0x5352('0x3f')]);var _0x361714={'where':_0x4189cb[_0x5352('0x3b')]};return db[_0x5352('0x2c')][_0x5352('0x1e')](_0x361714)['then'](function(_0x3b6266){_0x5d8bb6[_0x5352('0x1e')]=_0x3b6266;if(_0x31cbb5[_0x5352('0x32')][_0x5352('0x40')]){_0x4189cb[_0x5352('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5352('0x42')](_0x4189cb);})[_0x5352('0x43')](function(_0x48bcc2){_0x5d8bb6[_0x5352('0x44')]=_0x48bcc2;return _0x5d8bb6;})[_0x5352('0x43')](respondWithFilteredResult(_0x29714c,_0x4189cb))[_0x5352('0x45')](handleError(_0x29714c,null));};exports[_0x5352('0x46')]=function(_0x29bab4,_0x37c2a4){var _0x5e5c68={'raw':!![],'where':{'id':_0x29bab4[_0x5352('0x47')]['id']}},_0x6e7bd5={};_0x6e7bd5[_0x5352('0x31')]=_[_0x5352('0x33')](db[_0x5352('0x2c')][_0x5352('0x2d')]);_0x6e7bd5['query']=_['keys'](_0x29bab4['query']);_0x6e7bd5[_0x5352('0x3c')]=_['intersection'](_0x6e7bd5[_0x5352('0x31')],_0x6e7bd5['query']);_0x5e5c68[_0x5352('0x34')]=_[_0x5352('0x35')](_0x6e7bd5[_0x5352('0x31')],qs[_0x5352('0x36')](_0x29bab4[_0x5352('0x32')]['fields']));_0x5e5c68[_0x5352('0x34')]=_0x5e5c68[_0x5352('0x34')]['length']?_0x5e5c68[_0x5352('0x34')]:_0x6e7bd5[_0x5352('0x31')];if(_0x29bab4[_0x5352('0x32')][_0x5352('0x40')]){_0x5e5c68['include']=[{'all':!![]}];}_0x5e5c68=_['merge']({},_0x5e5c68,_0x29bab4['options']);return db[_0x5352('0x2c')][_0x5352('0x48')](_0x5e5c68)[_0x5352('0x43')](handleEntityNotFound(_0x37c2a4,null))[_0x5352('0x43')](respondWithResult(_0x37c2a4,null))['catch'](handleError(_0x37c2a4,null));};exports[_0x5352('0x25')]=function(_0x35ef4d,_0x47b5cb){if(_0x35ef4d[_0x5352('0x49')]['id']){delete _0x35ef4d[_0x5352('0x49')]['id'];}return db['CmHopperBlack'][_0x5352('0x48')]({'where':{'id':_0x35ef4d[_0x5352('0x47')]['id']}})[_0x5352('0x43')](handleEntityNotFound(_0x47b5cb,null))[_0x5352('0x43')](saveUpdates(_0x35ef4d[_0x5352('0x49')],null))[_0x5352('0x43')](respondWithResult(_0x47b5cb,null))[_0x5352('0x45')](handleError(_0x47b5cb,null));};exports[_0x5352('0x26')]=function(_0x38274a,_0x1d6b6a){return db[_0x5352('0x2c')]['find']({'where':{'id':_0x38274a[_0x5352('0x47')]['id']}})[_0x5352('0x43')](handleEntityNotFound(_0x1d6b6a,null))['then'](removeEntity(_0x1d6b6a,null))['catch'](handleError(_0x1d6b6a,null));};exports[_0x5352('0x4a')]=function(_0x915810,_0xe3d9f3){return db['CmHopperBlack'][_0x5352('0x4a')]()[_0x5352('0x43')](respondWithResult(_0xe3d9f3,null))[_0x5352('0x45')](handleError(_0xe3d9f3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index af77043..b49733d 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 _0x7202=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x5e17e7,_0x551ed9){var _0x19a417=function(_0x10c981){while(--_0x10c981){_0x5e17e7['push'](_0x5e17e7['shift']());}};_0x19a417(++_0x551ed9);}(_0x7202,0x197));var _0x2720=function(_0xa3a4b8,_0x71017d){_0xa3a4b8=_0xa3a4b8-0x0;var _0x25e5d3=_0x7202[_0xa3a4b8];return _0x25e5d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2720('0x0'))('api');var moment=require(_0x2720('0x1'));var BPromise=require(_0x2720('0x2'));var rp=require(_0x2720('0x3'));var fs=require('fs');var path=require(_0x2720('0x4'));var rimraf=require(_0x2720('0x5'));var config=require(_0x2720('0x6'));var attributes=require(_0x2720('0x7'));module[_0x2720('0x8')]=function(_0x331cd7,_0x4b21c8){return _0x331cd7[_0x2720('0x9')](_0x2720('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x596b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x596b,0x151));var _0xb596=function(_0x36a94d,_0x2f8299){_0x36a94d=_0x36a94d-0x0;var _0x1aa6ec=_0x596b[_0x36a94d];return _0x1aa6ec;};'use strict';var _=require('lodash');var util=require(_0xb596('0x0'));var logger=require(_0xb596('0x1'))(_0xb596('0x2'));var moment=require(_0xb596('0x3'));var BPromise=require(_0xb596('0x4'));var rp=require(_0xb596('0x5'));var fs=require('fs');var path=require(_0xb596('0x6'));var rimraf=require(_0xb596('0x7'));var config=require(_0xb596('0x8'));var attributes=require(_0xb596('0x9'));module['exports']=function(_0x535005,_0x5e19d6){return _0x535005[_0xb596('0xa')](_0xb596('0xb'),attributes,{'tableName':_0xb596('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 4a03108..87120f3 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 _0xf3a7=['error','code','message','info','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x38d22f,_0x204286){var _0x2b643c=function(_0x2fcbc4){while(--_0x2fcbc4){_0x38d22f['push'](_0x38d22f['shift']());}};_0x2b643c(++_0x204286);}(_0xf3a7,0x1bb));var _0x7f3a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7f3a('0x0'));var util=require(_0x7f3a('0x1'));var moment=require(_0x7f3a('0x2'));var BPromise=require(_0x7f3a('0x3'));var rs=require(_0x7f3a('0x4'));var fs=require('fs');var Redis=require(_0x7f3a('0x5'));var db=require(_0x7f3a('0x6'))['db'];var utils=require(_0x7f3a('0x7'));var logger=require(_0x7f3a('0x8'))(_0x7f3a('0x9'));var config=require(_0x7f3a('0xa'));var jayson=require(_0x7f3a('0xb'));var client=jayson[_0x7f3a('0xc')][_0x7f3a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x27ab85,_0x340fd9,_0xc9c8fb){return new BPromise(function(_0x15b257,_0x38fc43){return client[_0x7f3a('0xe')](_0x27ab85,_0xc9c8fb)[_0x7f3a('0xf')](function(_0x19e74b){logger['info'](_0x7f3a('0x10'),_0x340fd9,'request\x20sent');logger[_0x7f3a('0x11')](_0x7f3a('0x12'),_0x340fd9,'request\x20sent',JSON['stringify'](_0x19e74b));if(_0x19e74b[_0x7f3a('0x13')]){if(_0x19e74b[_0x7f3a('0x13')][_0x7f3a('0x14')]===0x1f4){logger[_0x7f3a('0x13')](_0x7f3a('0x10'),_0x340fd9,_0x19e74b[_0x7f3a('0x13')]['message']);return _0x38fc43(_0x19e74b[_0x7f3a('0x13')][_0x7f3a('0x15')]);}logger[_0x7f3a('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x340fd9,_0x19e74b[_0x7f3a('0x13')][_0x7f3a('0x15')]);return _0x15b257(_0x19e74b[_0x7f3a('0x13')][_0x7f3a('0x15')]);}else{logger[_0x7f3a('0x16')](_0x7f3a('0x10'),_0x340fd9,_0x7f3a('0x17'));_0x15b257(_0x19e74b[_0x7f3a('0x18')][_0x7f3a('0x15')]);}})[_0x7f3a('0x19')](function(_0x1ab3e6){logger[_0x7f3a('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x340fd9,_0x1ab3e6);_0x38fc43(_0x1ab3e6);});});}exports[_0x7f3a('0x1a')]=function(_0x349b74){var _0x1e7b5a=this;return new Promise(function(_0x5cfc70,_0x5bd8ed){return db[_0x7f3a('0x1b')][_0x7f3a('0x1c')]({'raw':_0x349b74['options']?_0x349b74[_0x7f3a('0x1d')][_0x7f3a('0x1e')]===undefined?!![]:![]:!![],'where':_0x349b74['options']?_0x349b74[_0x7f3a('0x1d')]['where']||null:null,'attributes':_0x349b74[_0x7f3a('0x1d')]?_0x349b74['options'][_0x7f3a('0x1f')]||null:null,'limit':_0x349b74[_0x7f3a('0x1d')]?_0x349b74[_0x7f3a('0x1d')][_0x7f3a('0x20')]||null:null,'include':_0x349b74[_0x7f3a('0x1d')]?_0x349b74[_0x7f3a('0x1d')][_0x7f3a('0x21')]?_[_0x7f3a('0x22')](_0x349b74[_0x7f3a('0x1d')][_0x7f3a('0x21')],function(_0x17dcc2){return{'model':db[_0x17dcc2['model']],'as':_0x17dcc2['as'],'attributes':_0x17dcc2[_0x7f3a('0x1f')],'include':_0x17dcc2[_0x7f3a('0x21')]?_[_0x7f3a('0x22')](_0x17dcc2[_0x7f3a('0x21')],function(_0x14be64){return{'model':db[_0x14be64[_0x7f3a('0x23')]],'as':_0x14be64['as'],'attributes':_0x14be64['attributes'],'include':_0x14be64[_0x7f3a('0x21')]?_[_0x7f3a('0x22')](_0x14be64[_0x7f3a('0x21')],function(_0x1dbe26){return{'model':db[_0x1dbe26[_0x7f3a('0x23')]],'as':_0x1dbe26['as'],'attributes':_0x1dbe26[_0x7f3a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7f3a('0xf')](function(_0x3ba0f6){logger['info'](_0x7f3a('0x1a'),_0x349b74);logger['debug'](_0x7f3a('0x1a'),_0x349b74,JSON[_0x7f3a('0x24')](_0x3ba0f6));_0x5cfc70(_0x3ba0f6);})[_0x7f3a('0x19')](function(_0x565bbc){logger['error']('GetCmHopperBlack',_0x565bbc[_0x7f3a('0x15')],_0x349b74);_0x5bd8ed(_0x1e7b5a[_0x7f3a('0x13')](0x1f4,_0x565bbc['message']));});});};exports[_0x7f3a('0x25')]=function(_0xd4fd4c){var _0x15f3de=this;return new Promise(function(_0x17e1f6,_0x98d25e){return db['CmHopperBlack'][_0x7f3a('0x26')](_0xd4fd4c['body'],{'raw':_0xd4fd4c[_0x7f3a('0x1d')]?_0xd4fd4c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd4fd4c['options']?_0xd4fd4c[_0x7f3a('0x1d')][_0x7f3a('0x27')]||null:null,'attributes':_0xd4fd4c['options']?_0xd4fd4c[_0x7f3a('0x1d')]['attributes']||null:null,'limit':_0xd4fd4c[_0x7f3a('0x1d')]?_0xd4fd4c[_0x7f3a('0x1d')][_0x7f3a('0x20')]||null:null})[_0x7f3a('0xf')](function(_0x265073){logger[_0x7f3a('0x16')](_0x7f3a('0x25'),_0xd4fd4c);logger[_0x7f3a('0x11')](_0x7f3a('0x25'),_0xd4fd4c,JSON[_0x7f3a('0x24')](_0x265073));_0x17e1f6(_0x265073);})['catch'](function(_0x454039){logger['error']('UpdateCmHopperBlack',_0x454039[_0x7f3a('0x15')],_0xd4fd4c);_0x98d25e(_0x15f3de[_0x7f3a('0x13')](0x1f4,_0x454039[_0x7f3a('0x15')]));});});};exports[_0x7f3a('0x28')]=function(_0x3294a1){var _0xcde9f2=this;return new Promise(function(_0x94e15e,_0x309a87){return db[_0x7f3a('0x1b')][_0x7f3a('0x29')]({'where':_0x3294a1[_0x7f3a('0x1d')]?_0x3294a1['options'][_0x7f3a('0x27')]||null:null})[_0x7f3a('0xf')](function(_0x49a467){logger[_0x7f3a('0x16')](_0x7f3a('0x28'),_0x3294a1);logger[_0x7f3a('0x11')](_0x7f3a('0x28'),_0x3294a1,JSON[_0x7f3a('0x24')](_0x49a467));_0x94e15e(_0x49a467);})['catch'](function(_0x55e873){logger[_0x7f3a('0x13')](_0x7f3a('0x28'),_0x55e873[_0x7f3a('0x15')],_0x3294a1);_0x309a87(_0xcde9f2[_0x7f3a('0x13')](0x1f4,_0x55e873['message']));});});}; \ No newline at end of file +var _0x7dda=['attributes','limit','include','map','model','debug','UpdateCmHopperBlack','body','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7dda,0x114));var _0xa7dd=function(_0x32b0af,_0x3a32b3){_0x32b0af=_0x32b0af-0x0;var _0x42e83e=_0x7dda[_0x32b0af];return _0x42e83e;};'use strict';var _=require('lodash');var util=require(_0xa7dd('0x0'));var moment=require(_0xa7dd('0x1'));var BPromise=require(_0xa7dd('0x2'));var rs=require(_0xa7dd('0x3'));var fs=require('fs');var Redis=require(_0xa7dd('0x4'));var db=require(_0xa7dd('0x5'))['db'];var utils=require(_0xa7dd('0x6'));var logger=require('../../config/logger')(_0xa7dd('0x7'));var config=require(_0xa7dd('0x8'));var jayson=require(_0xa7dd('0x9'));var client=jayson[_0xa7dd('0xa')][_0xa7dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x458121,_0x2581b8,_0xc419b){return new BPromise(function(_0x31903e,_0x3e9f24){return client[_0xa7dd('0xc')](_0x458121,_0xc419b)[_0xa7dd('0xd')](function(_0x4c7444){logger[_0xa7dd('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x2581b8,'request\x20sent');logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2581b8,_0xa7dd('0xf'),JSON[_0xa7dd('0x10')](_0x4c7444));if(_0x4c7444[_0xa7dd('0x11')]){if(_0x4c7444['error'][_0xa7dd('0x12')]===0x1f4){logger[_0xa7dd('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2581b8,_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);return _0x3e9f24(_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);}logger[_0xa7dd('0x11')](_0xa7dd('0x14'),_0x2581b8,_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);return _0x31903e(_0x4c7444[_0xa7dd('0x11')][_0xa7dd('0x13')]);}else{logger['info'](_0xa7dd('0x14'),_0x2581b8,_0xa7dd('0xf'));_0x31903e(_0x4c7444[_0xa7dd('0x15')][_0xa7dd('0x13')]);}})[_0xa7dd('0x16')](function(_0x28e957){logger[_0xa7dd('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x2581b8,_0x28e957);_0x3e9f24(_0x28e957);});});}exports[_0xa7dd('0x17')]=function(_0x1650b2){var _0x53c627=this;return new Promise(function(_0xeb71a2,_0x5adbc1){return db[_0xa7dd('0x18')]['findAll']({'raw':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2['options'][_0xa7dd('0x1a')]===undefined?!![]:![]:!![],'where':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1b')]||null:null,'attributes':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1c')]||null:null,'limit':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1d')]||null:null,'include':_0x1650b2[_0xa7dd('0x19')]?_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1e')]?_['map'](_0x1650b2[_0xa7dd('0x19')][_0xa7dd('0x1e')],function(_0x56489b){return{'model':db[_0x56489b['model']],'as':_0x56489b['as'],'attributes':_0x56489b['attributes'],'include':_0x56489b[_0xa7dd('0x1e')]?_[_0xa7dd('0x1f')](_0x56489b['include'],function(_0x35a081){return{'model':db[_0x35a081[_0xa7dd('0x20')]],'as':_0x35a081['as'],'attributes':_0x35a081['attributes'],'include':_0x35a081['include']?_[_0xa7dd('0x1f')](_0x35a081[_0xa7dd('0x1e')],function(_0x3bca5a){return{'model':db[_0x3bca5a[_0xa7dd('0x20')]],'as':_0x3bca5a['as'],'attributes':_0x3bca5a[_0xa7dd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa7dd('0xd')](function(_0x38cd36){logger['info'](_0xa7dd('0x17'),_0x1650b2);logger[_0xa7dd('0x21')]('GetCmHopperBlack',_0x1650b2,JSON['stringify'](_0x38cd36));_0xeb71a2(_0x38cd36);})[_0xa7dd('0x16')](function(_0x39742c){logger[_0xa7dd('0x11')](_0xa7dd('0x17'),_0x39742c[_0xa7dd('0x13')],_0x1650b2);_0x5adbc1(_0x53c627[_0xa7dd('0x11')](0x1f4,_0x39742c[_0xa7dd('0x13')]));});});};exports[_0xa7dd('0x22')]=function(_0x4a0ef2){var _0x54cd5e=this;return new Promise(function(_0x597a74,_0x2ca660){return db[_0xa7dd('0x18')]['update'](_0x4a0ef2[_0xa7dd('0x23')],{'raw':_0x4a0ef2[_0xa7dd('0x19')]?_0x4a0ef2['options'][_0xa7dd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a0ef2['options']?_0x4a0ef2[_0xa7dd('0x19')][_0xa7dd('0x1b')]||null:null,'attributes':_0x4a0ef2[_0xa7dd('0x19')]?_0x4a0ef2[_0xa7dd('0x19')][_0xa7dd('0x1c')]||null:null,'limit':_0x4a0ef2[_0xa7dd('0x19')]?_0x4a0ef2[_0xa7dd('0x19')][_0xa7dd('0x1d')]||null:null})[_0xa7dd('0xd')](function(_0x412c76){logger['info'](_0xa7dd('0x22'),_0x4a0ef2);logger[_0xa7dd('0x21')](_0xa7dd('0x22'),_0x4a0ef2,JSON[_0xa7dd('0x10')](_0x412c76));_0x597a74(_0x412c76);})[_0xa7dd('0x16')](function(_0x30e032){logger[_0xa7dd('0x11')](_0xa7dd('0x22'),_0x30e032[_0xa7dd('0x13')],_0x4a0ef2);_0x2ca660(_0x54cd5e[_0xa7dd('0x11')](0x1f4,_0x30e032[_0xa7dd('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x213f4e){var _0x4427ca=this;return new Promise(function(_0x127c9f,_0x4ff544){return db[_0xa7dd('0x18')][_0xa7dd('0x24')]({'where':_0x213f4e['options']?_0x213f4e[_0xa7dd('0x19')]['where']||null:null})['then'](function(_0x3c85bb){logger[_0xa7dd('0xe')]('DestroyCmHopperBlack',_0x213f4e);logger[_0xa7dd('0x21')]('DestroyCmHopperBlack',_0x213f4e,JSON[_0xa7dd('0x10')](_0x3c85bb));_0x127c9f(_0x3c85bb);})['catch'](function(_0x2ad1cd){logger[_0xa7dd('0x11')](_0xa7dd('0x25'),_0x2ad1cd[_0xa7dd('0x13')],_0x213f4e);_0x4ff544(_0x4427ca['error'](0x1f4,_0x2ad1cd[_0xa7dd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bc473ac..89fef79 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 _0x3e24=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','/:id','delete','exports','multer'];(function(_0x4e0c5e,_0x356e45){var _0x741c90=function(_0x10b10e){while(--_0x10b10e){_0x4e0c5e['push'](_0x4e0c5e['shift']());}};_0x741c90(++_0x356e45);}(_0x3e24,0x167));var _0x43e2=function(_0x48e75c,_0x261583){_0x48e75c=_0x48e75c-0x0;var _0x27f38f=_0x3e24[_0x48e75c];return _0x27f38f;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require(_0x43e2('0x2'));var timeout=require(_0x43e2('0x3'));var express=require(_0x43e2('0x4'));var router=express['Router']();var fs_extra=require(_0x43e2('0x5'));var auth=require(_0x43e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x43e2('0x7'));var controller=require(_0x43e2('0x8'));router[_0x43e2('0x9')]('/',auth[_0x43e2('0xa')](),controller[_0x43e2('0xb')]);router[_0x43e2('0x9')](_0x43e2('0xc'),auth['isAuthenticated'](),controller[_0x43e2('0xd')]);router[_0x43e2('0x9')]('/:id',auth[_0x43e2('0xa')](),controller[_0x43e2('0xe')]);router['put'](_0x43e2('0xf'),auth[_0x43e2('0xa')](),controller['update']);router[_0x43e2('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x43e2('0x11')]=router; \ No newline at end of file +var _0x7096=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update'];(function(_0x3b18b5,_0x343411){var _0x3e7dcc=function(_0x374aa0){while(--_0x374aa0){_0x3b18b5['push'](_0x3b18b5['shift']());}};_0x3e7dcc(++_0x343411);}(_0x7096,0x10c));var _0x6709=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7096[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0xe')](_0x6709('0xf'),auth[_0x6709('0x9')](),controller[_0x6709('0x10')]);router['delete']('/:id',auth[_0x6709('0x9')](),controller[_0x6709('0x11')]);module[_0x6709('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 0f69e10..46558d9 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 _0x6f2f=['STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','moment','INTEGER'];(function(_0xa32298,_0x4fc2ca){var _0x5609fd=function(_0x1563b2){while(--_0x1563b2){_0xa32298['push'](_0xa32298['shift']());}};_0x5609fd(++_0x4fc2ca);}(_0x6f2f,0x1b6));var _0xf6f2=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x6f2f[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf6f2('0x0'));module['exports']={'state':{'type':Sequelize[_0xf6f2('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf6f2('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf6f2('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xf6f2('0x2')]},'originatecalleridname':{'type':Sequelize[_0xf6f2('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf6f2('0x3')]},'responsetime':{'type':Sequelize[_0xf6f2('0x3')]},'answertime':{'type':Sequelize[_0xf6f2('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf6f2('0x3')]},'ringtime':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xf6f2('0x2')]},'campaigntype':{'type':Sequelize[_0xf6f2('0x2')]},'membername':{'type':Sequelize[_0xf6f2('0x2')]},'reason':{'type':Sequelize[_0xf6f2('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf6f2('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3679a4){var _0x1d4c71=this[_0xf6f2('0x4')](_0xf6f2('0x5'));if(_0x1d4c71&&_0x3679a4){this[_0xf6f2('0x6')]('followuptime',moment(_0x3679a4)[_0xf6f2('0x7')](moment(_0x1d4c71),_0xf6f2('0x8')));}return this[_0xf6f2('0x6')]('dispositionat',_0x3679a4);}},'amd':{'type':Sequelize[_0xf6f2('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf6f2('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf6f2('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf6f2('0x3')]},'callback':{'type':Sequelize[_0xf6f2('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf6f2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf6f2('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf6f2('0x3')]},'recallme':{'type':Sequelize[_0xf6f2('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf6f2('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf6f2('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb00=['getDataValue','endtime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x59c17e,_0x527262){var _0x244753=function(_0x295375){while(--_0x295375){_0x59c17e['push'](_0x59c17e['shift']());}};_0x244753(++_0x527262);}(_0xcb00,0xf6));var _0x0cb0=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xcb00[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x0cb0('0x0'));var moment=require(_0x0cb0('0x1'));module[_0x0cb0('0x2')]={'state':{'type':Sequelize[_0x0cb0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x0cb0('0x4')]},'scheduledat':{'type':Sequelize[_0x0cb0('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0cb0('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x0cb0('0x4')]},'originatecalleridname':{'type':Sequelize[_0x0cb0('0x4')]},'calleridnum':{'type':Sequelize[_0x0cb0('0x4')]},'calleridname':{'type':Sequelize[_0x0cb0('0x4')]},'starttime':{'type':Sequelize[_0x0cb0('0x5')]},'responsetime':{'type':Sequelize[_0x0cb0('0x5')]},'answertime':{'type':Sequelize[_0x0cb0('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0cb0('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0cb0('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0cb0('0x4')]},'reason':{'type':Sequelize[_0x0cb0('0x4')]},'disposition':{'type':Sequelize[_0x0cb0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0cb0('0x4')]},'dispositionat':{'type':Sequelize[_0x0cb0('0x5')],'set':function(_0x1c01c3){var _0x4d4672=this[_0x0cb0('0x6')](_0x0cb0('0x7'));if(_0x4d4672&&_0x1c01c3){this['setDataValue']('followuptime',moment(_0x1c01c3)[_0x0cb0('0x8')](moment(_0x4d4672),'seconds'));}return this[_0x0cb0('0x9')](_0x0cb0('0xa'),_0x1c01c3);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0cb0('0x5')]},'callback':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0cb0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x0cb0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0cb0('0x5')]},'recallme':{'type':Sequelize[_0x0cb0('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0cb0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0cb0('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 0b042b6..bea07b3 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 _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','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','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','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','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x4b4771,_0x494ee2){var _0x238250=function(_0x17cb83){while(--_0x17cb83){_0x4b4771['push'](_0x4b4771['shift']());}};_0x238250(++_0x494ee2);}(_0x5496,0x175));var _0x6549=function(_0x3a08e3,_0x5d062b){_0x3a08e3=_0x3a08e3-0x0;var _0x314393=_0x5496[_0x3a08e3];return _0x314393;};'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')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file +var _0xdb28=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf'];(function(_0x58a7f2,_0x4d788e){var _0x3d839e=function(_0x586199){while(--_0x586199){_0x58a7f2['push'](_0x58a7f2['shift']());}};_0x3d839e(++_0x4d788e);}(_0xdb28,0x106));var _0x8db2=function(_0x4e59b6,_0x2e1abd){_0x4e59b6=_0x4e59b6-0x0;var _0xaad3cc=_0xdb28[_0x4e59b6];return _0xaad3cc;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['describe']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')]()['then'](respondWithResult(_0x2ada52,null))['catch'](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x2e46d4,_0x164020){if(_0x2e46d4['body']['uniqueid']){delete _0x2e46d4['body'][_0x8db2('0x4a')];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'uniqueid':_0x2e46d4[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x164020,null))[_0x8db2('0x24')](saveUpdates(_0x2e46d4[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x164020,null))['catch'](handleError(_0x164020,null));};exports[_0x8db2('0x4c')]=function(_0x18c6ef,_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x18c6ef[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x54')))),_0x8db2('0x55')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x56')))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8db2('0x58')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5d')))),_0x8db2('0x5e')]]})['then'](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x42')](handleError(_0x2908e4,null));};exports[_0x8db2('0x5f')]=function(_0xc27a7e,_0x349db0,_0x53b2dc){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'CampaignId':_0xc27a7e[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db['sequelize'][_0x8db2('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x8db2('0x55')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x60')))),_0x8db2('0x58')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5d')))),'answeringMachine']]})[_0x8db2('0x24')](handleEntityNotFound(_0x349db0,null))[_0x8db2('0x24')](respondWithResult(_0x349db0,null))[_0x8db2('0x42')](handleError(_0x349db0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x26523b,_0x291375,_0x2cf731){return db['VoiceQueue'][_0x8db2('0x48')]({'where':{'id':_0x26523b[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x291375,null))[_0x8db2('0x24')](function(_0x3a0946){var _0x5923b3;if(_0x3a0946){_0x5923b3=squel[_0x8db2('0x61')]()[_0x8db2('0x62')](_0x8db2('0x63'))['fromQuery'](['phone',_0x8db2('0x64'),_0x8db2('0x65'),'ListId',_0x8db2('0x66'),_0x8db2('0x67'),_0x8db2('0x68')],squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))[_0x8db2('0x6a')](_0x8db2('0x6e'),_0x8db2('0x65'))['field'](_0x8db2('0x6f'),'ListId')[_0x8db2('0x6a')](_0x8db2('0x70'),'VoiceQueueId')[_0x8db2('0x6a')](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())['where']('state\x20=\x20?',_0x26523b[_0x8db2('0x4b')]['state'][_0x8db2('0x74')]())[_0x8db2('0x3b')](_0x8db2('0x75'))['where'](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')]('phone')[_0x8db2('0x71')](_0x8db2('0x63'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b['params']['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id']['toString']())[_0x8db2('0x3b')](_0x8db2('0x78')))[_0x8db2('0x79')]('ContactId'))['toString']();return db['sequelize'][_0x8db2('0x30')](_0x5923b3);}return[];})[_0x8db2('0x24')](respondWithResult(_0x291375,null))[_0x8db2('0x42')](handleError(_0x291375,null));};exports[_0x8db2('0x7a')]=function(_0x2ad024,_0x313918,_0x339d09){return db[_0x8db2('0x7b')][_0x8db2('0x48')]({'where':{'id':_0x2ad024[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x313918,null))['then'](function(_0x360a06){var _0xa2e293;if(_0x360a06){_0xa2e293=squel[_0x8db2('0x61')]()[_0x8db2('0x62')]('cm_hopper')['fromQuery']([_0x8db2('0x6c'),_0x8db2('0x64'),'ContactId',_0x8db2('0x7c'),_0x8db2('0x7d'),_0x8db2('0x67'),'updatedAt'],squel['select']()['field'](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))['field'](_0x8db2('0x6e'),'ContactId')[_0x8db2('0x6a')](_0x8db2('0x6f'),_0x8db2('0x7c'))[_0x8db2('0x6a')](_0x8db2('0x7e'),'CampaignId')['field'](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')]('CampaignId\x20=\x20?',_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x20?',_0x2ad024[_0x8db2('0x4b')][_0x8db2('0x7f')]['toString']())[_0x8db2('0x3b')](_0x8db2('0x75'))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6c'))[_0x8db2('0x71')](_0x8db2('0x63'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x204'))[_0x8db2('0x79')](_0x8db2('0x65')))[_0x8db2('0x74')]();return db['sequelize']['query'](_0xa2e293);}return[];})[_0x8db2('0x24')](respondWithResult(_0x313918,null))[_0x8db2('0x42')](handleError(_0x313918,null));};exports[_0x8db2('0x81')]=function(_0xc83913,_0x4f9ce4,_0xaa2661){return db[_0x8db2('0x82')][_0x8db2('0x83')]({'where':{'VoiceQueueId':_0xc83913[_0x8db2('0x4b')]['VoiceQueueId'],'CampaignId':_0xc83913[_0x8db2('0x4b')][_0x8db2('0x7d')],'ContactId':_0xc83913[_0x8db2('0x4b')]['ContactId']}})['then'](handleEntityNotFound(_0x4f9ce4,null))['then'](function(_0x1ba097){if(_0x1ba097){return _0x1ba097;}return null;})[_0x8db2('0x24')](respondWithResult(_0x4f9ce4,null))[_0x8db2('0x42')](handleError(_0x4f9ce4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2ceb4a8..44194db 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 _0x9f30=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final'];(function(_0x211f9b,_0x4011e2){var _0x3db24e=function(_0x257bb5){while(--_0x257bb5){_0x211f9b['push'](_0x211f9b['shift']());}};_0x3db24e(++_0x4011e2);}(_0x9f30,0x1f2));var _0x09f3=function(_0x217028,_0x38876e){_0x217028=_0x217028-0x0;var _0x381d44=_0x9f30[_0x217028];return _0x381d44;};'use strict';var _=require(_0x09f3('0x0'));var util=require(_0x09f3('0x1'));var logger=require(_0x09f3('0x2'))(_0x09f3('0x3'));var moment=require(_0x09f3('0x4'));var BPromise=require(_0x09f3('0x5'));var rp=require(_0x09f3('0x6'));var fs=require('fs');var path=require(_0x09f3('0x7'));var rimraf=require(_0x09f3('0x8'));var config=require(_0x09f3('0x9'));var attributes=require(_0x09f3('0xa'));module['exports']=function(_0x4c7d7e,_0x241e9d){return _0x4c7d7e[_0x09f3('0xb')](_0x09f3('0xc'),attributes,{'tableName':_0x09f3('0xd'),'paranoid':![],'indexes':[{'name':_0x09f3('0xe'),'fields':[_0x09f3('0xe')]},{'name':_0x09f3('0xf'),'fields':[_0x09f3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa83b=['../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','rimraf'];(function(_0x2666f8,_0x5a9495){var _0x56ac67=function(_0x2d1e65){while(--_0x2d1e65){_0x2666f8['push'](_0x2666f8['shift']());}};_0x56ac67(++_0x5a9495);}(_0xa83b,0xa3));var _0xba83=function(_0x982128,_0x24854e){_0x982128=_0x982128-0x0;var _0x44a3e0=_0xa83b[_0x982128];return _0x44a3e0;};'use strict';var _=require(_0xba83('0x0'));var util=require(_0xba83('0x1'));var logger=require(_0xba83('0x2'))(_0xba83('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba83('0x4'));var config=require(_0xba83('0x5'));var attributes=require(_0xba83('0x6'));module[_0xba83('0x7')]=function(_0x59284c,_0xa2c68d){return _0x59284c[_0xba83('0x8')]('CmHopperFinal',attributes,{'tableName':_0xba83('0x9'),'paranoid':![],'indexes':[{'name':_0xba83('0xa'),'fields':[_0xba83('0xa')]},{'name':_0xba83('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 892e58f..28ab283 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(_0x5a8826,_0x491eac){var _0x2aad80=function(_0x5ecfdd){while(--_0x5ecfdd){_0x5a8826['push'](_0x5a8826['shift']());}};_0x2aad80(++_0x491eac);}(_0xb10b,0x12a));var _0xbb10=function(_0x1df378,_0x2c4af3){_0x1df378=_0x1df378-0x0;var _0x2cb9fe=_0xb10b[_0x1df378];return _0x2cb9fe;};'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(_0xb0b7a,_0x165a73){var _0x5efbde=function(_0xa27fdd){while(--_0xa27fdd){_0xb0b7a['push'](_0xb0b7a['shift']());}};_0x5efbde(++_0x165a73);}(_0x7a54,0x106));var _0x47a5=function(_0x1052f9,_0x4b808a){_0x1052f9=_0x1052f9-0x0;var _0x55e3e1=_0x7a54[_0x1052f9];return _0x55e3e1;};'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 806a444..71c1d39 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 _0x4b08=['update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','/:id'];(function(_0x16fe01,_0x5039e1){var _0x56c48a=function(_0x419884){while(--_0x419884){_0x16fe01['push'](_0x16fe01['shift']());}};_0x56c48a(++_0x5039e1);}(_0x4b08,0x179));var _0x84b0=function(_0x21eff2,_0x1a2796){_0x21eff2=_0x21eff2-0x0;var _0x2c9fb3=_0x4b08[_0x21eff2];return _0x2c9fb3;};'use strict';var multer=require(_0x84b0('0x0'));var util=require(_0x84b0('0x1'));var path=require(_0x84b0('0x2'));var timeout=require(_0x84b0('0x3'));var express=require(_0x84b0('0x4'));var router=express['Router']();var fs_extra=require(_0x84b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x84b0('0x6'));var config=require('../../config/environment');var controller=require(_0x84b0('0x7'));router[_0x84b0('0x8')]('/',auth[_0x84b0('0x9')](),controller[_0x84b0('0xa')]);router[_0x84b0('0x8')](_0x84b0('0xb'),auth[_0x84b0('0x9')](),controller[_0x84b0('0xc')]);router[_0x84b0('0x8')]('/:id',auth[_0x84b0('0x9')](),controller['show']);router[_0x84b0('0x8')](_0x84b0('0xd'),auth[_0x84b0('0x9')](),controller[_0x84b0('0xe')]);router[_0x84b0('0x8')](_0x84b0('0xf'),auth['isAuthenticated'](),controller[_0x84b0('0x10')]);router[_0x84b0('0x11')](_0x84b0('0x12'),auth[_0x84b0('0x9')](),controller[_0x84b0('0x13')]);router['post'](_0x84b0('0x14'),auth[_0x84b0('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x84b0('0x11')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x84b0('0x15')]);router['put'](_0x84b0('0x16'),auth[_0x84b0('0x9')](),controller[_0x84b0('0x17')]);module[_0x84b0('0x18')]=router; \ No newline at end of file +var _0x2356=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','describe','/:id','isAuthenticated','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x2356,0x73));var _0x6235=function(_0x31f94d,_0x97563){_0x31f94d=_0x31f94d-0x0;var _0xca77c0=_0x2356[_0x31f94d];return _0xca77c0;};'use strict';var multer=require(_0x6235('0x0'));var util=require(_0x6235('0x1'));var path=require(_0x6235('0x2'));var timeout=require(_0x6235('0x3'));var express=require(_0x6235('0x4'));var router=express[_0x6235('0x5')]();var fs_extra=require(_0x6235('0x6'));var auth=require(_0x6235('0x7'));var interaction=require(_0x6235('0x8'));var config=require(_0x6235('0x9'));var controller=require(_0x6235('0xa'));router[_0x6235('0xb')]('/',auth['isAuthenticated'](),controller[_0x6235('0xc')]);router[_0x6235('0xb')](_0x6235('0xd'),auth['isAuthenticated'](),controller[_0x6235('0xe')]);router['get'](_0x6235('0xf'),auth[_0x6235('0x10')](),controller['show']);router[_0x6235('0xb')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x6235('0x11')]);router[_0x6235('0xb')]('/campaign/countAttributes/:id',auth[_0x6235('0x10')](),controller[_0x6235('0x12')]);router[_0x6235('0x13')](_0x6235('0x14'),auth['isAuthenticated'](),controller[_0x6235('0x15')]);router[_0x6235('0x13')](_0x6235('0x16'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x6235('0x17'),auth['isAuthenticated'](),controller[_0x6235('0x18')]);router[_0x6235('0x19')](_0x6235('0xf'),auth[_0x6235('0x10')](),controller[_0x6235('0x1a')]);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 8821839..a441903 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 _0x9346=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x85bf7c,_0x25c2e8){var _0x382bb1=function(_0x4e475d){while(--_0x4e475d){_0x85bf7c['push'](_0x85bf7c['shift']());}};_0x382bb1(++_0x25c2e8);}(_0x9346,0x74));var _0x6934=function(_0x5a2c27,_0x49c8c6){_0x5a2c27=_0x5a2c27-0x0;var _0x7434de=_0x9346[_0x5a2c27];return _0x7434de;};'use strict';var Sequelize=require(_0x6934('0x0'));module[_0x6934('0x1')]={'state':{'type':Sequelize[_0x6934('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6934('0x3')]},'scheduledat':{'type':Sequelize[_0x6934('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x6934('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6934('0x3')]},'calleridname':{'type':Sequelize[_0x6934('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6934('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6934('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6934('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6934('0x3')]},'membername':{'type':Sequelize[_0x6934('0x3')]},'reason':{'type':Sequelize[_0x6934('0x3')]},'amd':{'type':Sequelize[_0x6934('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6934('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6934('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6934('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6934('0x4')]},'recallme':{'type':Sequelize[_0x6934('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6934('0x4')]},'edited':{'type':Sequelize[_0x6934('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6934('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x74f5=['INTEGER','STRING','DATE','BOOLEAN'];(function(_0x460f4e,_0x1ed514){var _0x51635d=function(_0x38e3ad){while(--_0x38e3ad){_0x460f4e['push'](_0x460f4e['shift']());}};_0x51635d(++_0x1ed514);}(_0x74f5,0x10c));var _0x574f=function(_0x10d07b,_0xa771c5){_0x10d07b=_0x10d07b-0x0;var _0x2c880e=_0x74f5[_0x10d07b];return _0x2c880e;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x574f('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x574f('0x1')]},'scheduledat':{'type':Sequelize[_0x574f('0x2')]},'countbusyretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x574f('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x574f('0x1')]},'originatecalleridname':{'type':Sequelize[_0x574f('0x1')]},'calleridnum':{'type':Sequelize[_0x574f('0x1')]},'calleridname':{'type':Sequelize[_0x574f('0x1')]},'starttime':{'type':Sequelize[_0x574f('0x2')]},'responsetime':{'type':Sequelize[_0x574f('0x2')]},'answertime':{'type':Sequelize[_0x574f('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x574f('0x2')]},'ringtime':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x574f('0x1')]},'membername':{'type':Sequelize[_0x574f('0x1')]},'reason':{'type':Sequelize[_0x574f('0x1')]},'amd':{'type':Sequelize[_0x574f('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x574f('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x574f('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x574f('0x2')]},'recallme':{'type':Sequelize[_0x574f('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x574f('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x574f('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 22eec78..3b87f5f 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 _0x5924=['to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','offset','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','map','type','VIRTUAL','filter','options','include','CmHopperHistory','findAll','params','length','includeAll','merge','find','catch','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x44e78e,_0x5f2ba5){var _0xff1bb2=function(_0x1dc6a8){while(--_0x1dc6a8){_0x44e78e['push'](_0x44e78e['shift']());}};_0xff1bb2(++_0x5f2ba5);}(_0x5924,0xd3));var _0x4592=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x5924[_0x406696];return _0x10e35c;};'use strict';var emlformat=require(_0x4592('0x0'));var rimraf=require(_0x4592('0x1'));var zipdir=require(_0x4592('0x2'));var jsonpatch=require(_0x4592('0x3'));var rp=require(_0x4592('0x4'));var moment=require('moment');var BPromise=require(_0x4592('0x5'));var Mustache=require(_0x4592('0x6'));var util=require('util');var path=require(_0x4592('0x7'));var sox=require('sox');var csv=require(_0x4592('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4592('0x9'));var crypto=require(_0x4592('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4592('0xb'));var toCsv=require(_0x4592('0x8'));var querystring=require(_0x4592('0xc'));var Papa=require(_0x4592('0xd'));var Redis=require(_0x4592('0xe'));var authService=require(_0x4592('0xf'));var qs=require(_0x4592('0x10'));var as=require(_0x4592('0x11'));var hardwareService=require(_0x4592('0x12'));var logger=require(_0x4592('0x13'))(_0x4592('0x14'));var utils=require(_0x4592('0x15'));var config=require(_0x4592('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x353978,_0x4acc04){_0x4acc04=_0x4acc04||0xcc;return function(_0x5bd0eb){if(_0x5bd0eb){return _0x353978[_0x4592('0x17')](_0x4acc04);}return _0x353978[_0x4592('0x18')](_0x4acc04)['end']();};}function respondWithResult(_0x2b07ae,_0x3620e5){_0x3620e5=_0x3620e5||0xc8;return function(_0xaebae1){if(_0xaebae1){return _0x2b07ae['status'](_0x3620e5)[_0x4592('0x19')](_0xaebae1);}};}function respondWithFilteredResult(_0x588993,_0x113950){return function(_0x271622){if(_0x271622){var _0x1fd561=typeof _0x113950['offset']==='undefined'&&typeof _0x113950[_0x4592('0x1a')]===_0x4592('0x1b');var _0x351cd3=_0x271622['count'];var _0x5400c3=_0x1fd561?0x0:_0x113950[_0x4592('0x1c')];var _0x482f03=_0x1fd561?_0x271622[_0x4592('0x1d')]:_0x113950[_0x4592('0x1c')]+_0x113950[_0x4592('0x1a')];var _0x23d3d5;if(_0x482f03>=_0x351cd3){_0x482f03=_0x351cd3;_0x23d3d5=0xc8;}else{_0x23d3d5=0xce;}_0x588993[_0x4592('0x18')](_0x23d3d5);return _0x588993['set'](_0x4592('0x1e'),_0x5400c3+'-'+_0x482f03+'/'+_0x351cd3)[_0x4592('0x19')](_0x271622);}return null;};}function patchUpdates(_0x5a5f65){return function(_0x50cf5d){try{jsonpatch[_0x4592('0x1f')](_0x50cf5d,_0x5a5f65,!![]);}catch(_0xf1b493){return BPromise[_0x4592('0x20')](_0xf1b493);}return _0x50cf5d[_0x4592('0x21')]();};}function saveUpdates(_0x5330ce,_0x539507){return function(_0x53fcc8){if(_0x53fcc8){return _0x53fcc8['update'](_0x5330ce)[_0x4592('0x22')](function(_0x11ad2a){return _0x11ad2a;});}return null;};}function removeEntity(_0x1675ad,_0x422128){return function(_0xf09ceb){if(_0xf09ceb){return _0xf09ceb[_0x4592('0x23')]()[_0x4592('0x22')](function(){_0x1675ad[_0x4592('0x18')](0xcc)[_0x4592('0x24')]();});}};}function handleEntityNotFound(_0x44b528,_0x317284){return function(_0x32dca1){if(!_0x32dca1){_0x44b528[_0x4592('0x17')](0x194);}return _0x32dca1;};}function handleError(_0x17a484,_0x7c50d5){_0x7c50d5=_0x7c50d5||0x1f4;return function(_0x5b84f2){logger[_0x4592('0x25')](_0x5b84f2[_0x4592('0x26')]);if(_0x5b84f2['name']){delete _0x5b84f2[_0x4592('0x27')];}_0x17a484[_0x4592('0x18')](_0x7c50d5)['send'](_0x5b84f2);};}exports[_0x4592('0x28')]=function(_0x128654,_0x145161){var _0x577d35={},_0x11032f={},_0x115131={'count':0x0,'rows':[]};var _0x247b6b=_['map'](db['CmHopperHistory'][_0x4592('0x29')],function(_0x3f3493){return{'name':_0x3f3493[_0x4592('0x2a')],'type':_0x3f3493['type'][_0x4592('0x2b')]};});_0x11032f[_0x4592('0x2c')]=_['map'](_0x247b6b,_0x4592('0x27'));_0x11032f[_0x4592('0x2d')]=_[_0x4592('0x2e')](_0x128654[_0x4592('0x2d')]);_0x11032f[_0x4592('0x2f')]=_[_0x4592('0x30')](_0x11032f[_0x4592('0x2c')],_0x11032f[_0x4592('0x2d')]);_0x577d35['attributes']=_[_0x4592('0x30')](_0x11032f[_0x4592('0x2c')],qs[_0x4592('0x31')](_0x128654['query']['fields']));_0x577d35[_0x4592('0x32')]=_0x577d35[_0x4592('0x32')]['length']?_0x577d35[_0x4592('0x32')]:_0x11032f['model'];if(!_0x128654[_0x4592('0x2d')][_0x4592('0x33')](_0x4592('0x34'))){_0x577d35['limit']=qs[_0x4592('0x1a')](_0x128654[_0x4592('0x2d')][_0x4592('0x1a')]);_0x577d35[_0x4592('0x1c')]=qs[_0x4592('0x1c')](_0x128654[_0x4592('0x2d')][_0x4592('0x1c')]);}_0x577d35['order']=qs['sort'](_0x128654['query'][_0x4592('0x35')]);_0x577d35[_0x4592('0x36')]=qs[_0x4592('0x2f')](_['pick'](_0x128654[_0x4592('0x2d')],_0x11032f[_0x4592('0x2f')]),_0x247b6b);if(_0x128654[_0x4592('0x2d')]['filter']){_0x577d35[_0x4592('0x36')]=_['merge'](_0x577d35['where'],{'$or':_[_0x4592('0x37')](_0x247b6b,function(_0x2f84cf){if(_0x2f84cf[_0x4592('0x38')]!==_0x4592('0x39')){var _0x2df732={};_0x2df732[_0x2f84cf[_0x4592('0x27')]]={'$like':'%'+_0x128654[_0x4592('0x2d')][_0x4592('0x3a')]+'%'};return _0x2df732;}})});}_0x577d35=_['merge']({},_0x577d35,_0x128654[_0x4592('0x3b')]);var _0x45f3a8={'where':_0x577d35[_0x4592('0x36')]};return db['CmHopperHistory'][_0x4592('0x1d')](_0x45f3a8)['then'](function(_0x3595fe){_0x115131[_0x4592('0x1d')]=_0x3595fe;if(_0x128654['query']['includeAll']){_0x577d35[_0x4592('0x3c')]=[{'all':!![]}];}return db[_0x4592('0x3d')][_0x4592('0x3e')](_0x577d35);})[_0x4592('0x22')](function(_0x39eb1d){_0x115131['rows']=_0x39eb1d;return _0x115131;})[_0x4592('0x22')](respondWithFilteredResult(_0x145161,_0x577d35))['catch'](handleError(_0x145161,null));};exports['show']=function(_0x47c000,_0x3838da){var _0x4db921={'raw':!![],'where':{'id':_0x47c000[_0x4592('0x3f')]['id']}},_0x34a95b={};_0x34a95b[_0x4592('0x2c')]=_[_0x4592('0x2e')](db['CmHopperHistory'][_0x4592('0x29')]);_0x34a95b[_0x4592('0x2d')]=_[_0x4592('0x2e')](_0x47c000[_0x4592('0x2d')]);_0x34a95b['filters']=_['intersection'](_0x34a95b[_0x4592('0x2c')],_0x34a95b['query']);_0x4db921[_0x4592('0x32')]=_[_0x4592('0x30')](_0x34a95b[_0x4592('0x2c')],qs['fields'](_0x47c000['query'][_0x4592('0x31')]));_0x4db921[_0x4592('0x32')]=_0x4db921[_0x4592('0x32')][_0x4592('0x40')]?_0x4db921[_0x4592('0x32')]:_0x34a95b[_0x4592('0x2c')];if(_0x47c000[_0x4592('0x2d')][_0x4592('0x41')]){_0x4db921['include']=[{'all':!![]}];}_0x4db921=_[_0x4592('0x42')]({},_0x4db921,_0x47c000[_0x4592('0x3b')]);return db[_0x4592('0x3d')][_0x4592('0x43')](_0x4db921)[_0x4592('0x22')](handleEntityNotFound(_0x3838da,null))['then'](respondWithResult(_0x3838da,null))[_0x4592('0x44')](handleError(_0x3838da,null));};exports['create']=function(_0x556868,_0x59e9ba){return db[_0x4592('0x3d')][_0x4592('0x45')](_0x556868[_0x4592('0x46')],{})[_0x4592('0x22')](respondWithResult(_0x59e9ba,0xc9))[_0x4592('0x44')](handleError(_0x59e9ba,null));};exports[_0x4592('0x47')]=function(_0x465cf9,_0x53b3c9){return db[_0x4592('0x3d')][_0x4592('0x47')]()[_0x4592('0x22')](respondWithResult(_0x53b3c9,null))[_0x4592('0x44')](handleError(_0x53b3c9,null));};exports['update']=function(_0x31c1dd,_0x2704ee){if(_0x31c1dd['body'][_0x4592('0x48')]){delete _0x31c1dd[_0x4592('0x46')][_0x4592('0x48')];}return db[_0x4592('0x3d')][_0x4592('0x43')]({'where':{'uniqueid':_0x31c1dd[_0x4592('0x3f')]['id']}})[_0x4592('0x22')](handleEntityNotFound(_0x2704ee,null))[_0x4592('0x22')](saveUpdates(_0x31c1dd[_0x4592('0x46')],null))[_0x4592('0x22')](respondWithResult(_0x2704ee,null))[_0x4592('0x44')](handleError(_0x2704ee,null));}; \ No newline at end of file +var _0xc6b6=['filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','options','CmHopperHistory','count','includeAll','include','rows','catch','params','length','merge','create','body','describe','update','uniqueid','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x22ebf2,_0x430ca6){var _0x445103=function(_0xe11157){while(--_0xe11157){_0x22ebf2['push'](_0x22ebf2['shift']());}};_0x445103(++_0x430ca6);}(_0xc6b6,0x1a7));var _0x6c6b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc6b6[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x6c6b('0x0'));var rimraf=require(_0x6c6b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c6b('0x2'));var rp=require(_0x6c6b('0x3'));var moment=require(_0x6c6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c6b('0x5'));var util=require(_0x6c6b('0x6'));var path=require(_0x6c6b('0x7'));var sox=require(_0x6c6b('0x8'));var csv=require(_0x6c6b('0x9'));var ejs=require(_0x6c6b('0xa'));var fs=require('fs');var fs_extra=require(_0x6c6b('0xb'));var _=require(_0x6c6b('0xc'));var squel=require('squel');var crypto=require(_0x6c6b('0xd'));var jsforce=require(_0x6c6b('0xe'));var deskjs=require(_0x6c6b('0xf'));var toCsv=require(_0x6c6b('0x9'));var querystring=require(_0x6c6b('0x10'));var Papa=require(_0x6c6b('0x11'));var Redis=require('ioredis');var authService=require(_0x6c6b('0x12'));var qs=require(_0x6c6b('0x13'));var as=require(_0x6c6b('0x14'));var hardwareService=require(_0x6c6b('0x15'));var logger=require(_0x6c6b('0x16'))(_0x6c6b('0x17'));var utils=require(_0x6c6b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6c6b('0x19'));var db=require(_0x6c6b('0x1a'))['db'];function respondWithStatusCode(_0x5d755b,_0x5e332e){_0x5e332e=_0x5e332e||0xcc;return function(_0x5d8361){if(_0x5d8361){return _0x5d755b[_0x6c6b('0x1b')](_0x5e332e);}return _0x5d755b[_0x6c6b('0x1c')](_0x5e332e)['end']();};}function respondWithResult(_0x43e919,_0x4f8332){_0x4f8332=_0x4f8332||0xc8;return function(_0x5dbd2c){if(_0x5dbd2c){return _0x43e919[_0x6c6b('0x1c')](_0x4f8332)['json'](_0x5dbd2c);}};}function respondWithFilteredResult(_0x41426c,_0xcbda28){return function(_0x2b00ac){if(_0x2b00ac){var _0x16e2d5=typeof _0xcbda28['offset']===_0x6c6b('0x1d')&&typeof _0xcbda28[_0x6c6b('0x1e')]===_0x6c6b('0x1d');var _0x55e6fa=_0x2b00ac['count'];var _0x324103=_0x16e2d5?0x0:_0xcbda28['offset'];var _0x28b414=_0x16e2d5?_0x2b00ac['count']:_0xcbda28['offset']+_0xcbda28[_0x6c6b('0x1e')];var _0x292a15;if(_0x28b414>=_0x55e6fa){_0x28b414=_0x55e6fa;_0x292a15=0xc8;}else{_0x292a15=0xce;}_0x41426c['status'](_0x292a15);return _0x41426c[_0x6c6b('0x1f')](_0x6c6b('0x20'),_0x324103+'-'+_0x28b414+'/'+_0x55e6fa)[_0x6c6b('0x21')](_0x2b00ac);}return null;};}function patchUpdates(_0x171790){return function(_0x3a564e){try{jsonpatch[_0x6c6b('0x22')](_0x3a564e,_0x171790,!![]);}catch(_0x10cbc5){return BPromise[_0x6c6b('0x23')](_0x10cbc5);}return _0x3a564e['save']();};}function saveUpdates(_0x4c7ca0,_0x4936a0){return function(_0x1704a7){if(_0x1704a7){return _0x1704a7['update'](_0x4c7ca0)[_0x6c6b('0x24')](function(_0x377bca){return _0x377bca;});}return null;};}function removeEntity(_0x592395,_0x1d13cd){return function(_0x681d3){if(_0x681d3){return _0x681d3[_0x6c6b('0x25')]()[_0x6c6b('0x24')](function(){_0x592395['status'](0xcc)[_0x6c6b('0x26')]();});}};}function handleEntityNotFound(_0xc58331,_0x54a907){return function(_0x4a4896){if(!_0x4a4896){_0xc58331['sendStatus'](0x194);}return _0x4a4896;};}function handleError(_0x43ee5f,_0x52777e){_0x52777e=_0x52777e||0x1f4;return function(_0x37ba2c){logger[_0x6c6b('0x27')](_0x37ba2c[_0x6c6b('0x28')]);if(_0x37ba2c[_0x6c6b('0x29')]){delete _0x37ba2c[_0x6c6b('0x29')];}_0x43ee5f[_0x6c6b('0x1c')](_0x52777e)[_0x6c6b('0x2a')](_0x37ba2c);};}exports['index']=function(_0x33d596,_0xdcb669){var _0x536558={},_0x300980={},_0x39bb2b={'count':0x0,'rows':[]};var _0x4713db=_[_0x6c6b('0x2b')](db['CmHopperHistory'][_0x6c6b('0x2c')],function(_0x55626b){return{'name':_0x55626b[_0x6c6b('0x2d')],'type':_0x55626b[_0x6c6b('0x2e')][_0x6c6b('0x2f')]};});_0x300980[_0x6c6b('0x30')]=_[_0x6c6b('0x2b')](_0x4713db,_0x6c6b('0x29'));_0x300980['query']=_[_0x6c6b('0x31')](_0x33d596[_0x6c6b('0x32')]);_0x300980[_0x6c6b('0x33')]=_[_0x6c6b('0x34')](_0x300980[_0x6c6b('0x30')],_0x300980['query']);_0x536558[_0x6c6b('0x35')]=_[_0x6c6b('0x34')](_0x300980[_0x6c6b('0x30')],qs[_0x6c6b('0x36')](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x36')]));_0x536558[_0x6c6b('0x35')]=_0x536558[_0x6c6b('0x35')]['length']?_0x536558[_0x6c6b('0x35')]:_0x300980[_0x6c6b('0x30')];if(!_0x33d596['query']['hasOwnProperty'](_0x6c6b('0x37'))){_0x536558[_0x6c6b('0x1e')]=qs['limit'](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x1e')]);_0x536558[_0x6c6b('0x38')]=qs['offset'](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x38')]);}_0x536558[_0x6c6b('0x39')]=qs['sort'](_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x3a')]);_0x536558[_0x6c6b('0x3b')]=qs['filters'](_[_0x6c6b('0x3c')](_0x33d596['query'],_0x300980[_0x6c6b('0x33')]),_0x4713db);if(_0x33d596[_0x6c6b('0x32')]['filter']){_0x536558[_0x6c6b('0x3b')]=_['merge'](_0x536558[_0x6c6b('0x3b')],{'$or':_[_0x6c6b('0x2b')](_0x4713db,function(_0x440656){if(_0x440656['type']!==_0x6c6b('0x3d')){var _0x37492b={};_0x37492b[_0x440656[_0x6c6b('0x29')]]={'$like':'%'+_0x33d596[_0x6c6b('0x32')][_0x6c6b('0x3e')]+'%'};return _0x37492b;}})});}_0x536558=_['merge']({},_0x536558,_0x33d596[_0x6c6b('0x3f')]);var _0x364294={'where':_0x536558[_0x6c6b('0x3b')]};return db[_0x6c6b('0x40')][_0x6c6b('0x41')](_0x364294)[_0x6c6b('0x24')](function(_0x183694){_0x39bb2b[_0x6c6b('0x41')]=_0x183694;if(_0x33d596['query'][_0x6c6b('0x42')]){_0x536558[_0x6c6b('0x43')]=[{'all':!![]}];}return db[_0x6c6b('0x40')]['findAll'](_0x536558);})['then'](function(_0x1f6f55){_0x39bb2b[_0x6c6b('0x44')]=_0x1f6f55;return _0x39bb2b;})[_0x6c6b('0x24')](respondWithFilteredResult(_0xdcb669,_0x536558))[_0x6c6b('0x45')](handleError(_0xdcb669,null));};exports['show']=function(_0x22263f,_0x1a2ddd){var _0x1b5e08={'raw':!![],'where':{'id':_0x22263f[_0x6c6b('0x46')]['id']}},_0x5b3e95={};_0x5b3e95[_0x6c6b('0x30')]=_[_0x6c6b('0x31')](db[_0x6c6b('0x40')][_0x6c6b('0x2c')]);_0x5b3e95[_0x6c6b('0x32')]=_[_0x6c6b('0x31')](_0x22263f[_0x6c6b('0x32')]);_0x5b3e95[_0x6c6b('0x33')]=_[_0x6c6b('0x34')](_0x5b3e95['model'],_0x5b3e95[_0x6c6b('0x32')]);_0x1b5e08[_0x6c6b('0x35')]=_[_0x6c6b('0x34')](_0x5b3e95[_0x6c6b('0x30')],qs[_0x6c6b('0x36')](_0x22263f['query']['fields']));_0x1b5e08[_0x6c6b('0x35')]=_0x1b5e08[_0x6c6b('0x35')][_0x6c6b('0x47')]?_0x1b5e08[_0x6c6b('0x35')]:_0x5b3e95[_0x6c6b('0x30')];if(_0x22263f[_0x6c6b('0x32')][_0x6c6b('0x42')]){_0x1b5e08['include']=[{'all':!![]}];}_0x1b5e08=_[_0x6c6b('0x48')]({},_0x1b5e08,_0x22263f[_0x6c6b('0x3f')]);return db[_0x6c6b('0x40')]['find'](_0x1b5e08)[_0x6c6b('0x24')](handleEntityNotFound(_0x1a2ddd,null))['then'](respondWithResult(_0x1a2ddd,null))[_0x6c6b('0x45')](handleError(_0x1a2ddd,null));};exports[_0x6c6b('0x49')]=function(_0x4c7314,_0x3473ac){return db[_0x6c6b('0x40')][_0x6c6b('0x49')](_0x4c7314[_0x6c6b('0x4a')],{})[_0x6c6b('0x24')](respondWithResult(_0x3473ac,0xc9))[_0x6c6b('0x45')](handleError(_0x3473ac,null));};exports[_0x6c6b('0x4b')]=function(_0x5899ba,_0x3ee9bf){return db[_0x6c6b('0x40')][_0x6c6b('0x4b')]()[_0x6c6b('0x24')](respondWithResult(_0x3ee9bf,null))[_0x6c6b('0x45')](handleError(_0x3ee9bf,null));};exports[_0x6c6b('0x4c')]=function(_0x424659,_0x2c54b9){if(_0x424659['body'][_0x6c6b('0x4d')]){delete _0x424659[_0x6c6b('0x4a')][_0x6c6b('0x4d')];}return db['CmHopperHistory'][_0x6c6b('0x4e')]({'where':{'uniqueid':_0x424659['params']['id']}})['then'](handleEntityNotFound(_0x2c54b9,null))[_0x6c6b('0x24')](saveUpdates(_0x424659[_0x6c6b('0x4a')],null))[_0x6c6b('0x24')](respondWithResult(_0x2c54b9,null))[_0x6c6b('0x45')](handleError(_0x2c54b9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 82192d6..639cd33 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 _0xa5c1=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0xe3704,_0x5efb56){var _0x28804f=function(_0x3fc152){while(--_0x3fc152){_0xe3704['push'](_0xe3704['shift']());}};_0x28804f(++_0x5efb56);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x4340f1,_0x59a0a1){_0x4340f1=_0x4340f1-0x0;var _0xef7e7f=_0xa5c1[_0x4340f1];return _0xef7e7f;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('CmHopperHistory',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[{'name':_0x1a5c('0xb'),'fields':[_0x1a5c('0xb')]},{'name':'uniqueid','fields':[_0x1a5c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa613=['cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x2b4909,_0xb81a58){var _0x160be6=function(_0x4fa5a5){while(--_0x4fa5a5){_0x2b4909['push'](_0x2b4909['shift']());}};_0x160be6(++_0xb81a58);}(_0xa613,0x8a));var _0x3a61=function(_0x5d92c2,_0x26d815){_0x5d92c2=_0x5d92c2-0x0;var _0x415601=_0xa613[_0x5d92c2];return _0x415601;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var logger=require(_0x3a61('0x1'))(_0x3a61('0x2'));var moment=require(_0x3a61('0x3'));var BPromise=require(_0x3a61('0x4'));var rp=require(_0x3a61('0x5'));var fs=require('fs');var path=require(_0x3a61('0x6'));var rimraf=require(_0x3a61('0x7'));var config=require(_0x3a61('0x8'));var attributes=require(_0x3a61('0x9'));module[_0x3a61('0xa')]=function(_0x50a744,_0x37904a){return _0x50a744[_0x3a61('0xb')]('CmHopperHistory',attributes,{'tableName':_0x3a61('0xc'),'paranoid':![],'indexes':[{'name':_0x3a61('0xd'),'fields':[_0x3a61('0xd')]},{'name':_0x3a61('0xe'),'fields':[_0x3a61('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2dfe308..19d12ec 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 _0x50c1=['catch','AvgHandleTime','CmHopperHistory','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','raw','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CreateCmHopperHistory','create','options'];(function(_0x3164bc,_0x18d9dd){var _0x857f7=function(_0x190bd9){while(--_0x190bd9){_0x3164bc['push'](_0x3164bc['shift']());}};_0x857f7(++_0x18d9dd);}(_0x50c1,0x1b6));var _0x150c=function(_0xd92b90,_0x529abc){_0xd92b90=_0xd92b90-0x0;var _0x325d68=_0x50c1[_0xd92b90];return _0x325d68;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var moment=require(_0x150c('0x1'));var BPromise=require('bluebird');var rs=require(_0x150c('0x2'));var fs=require('fs');var Redis=require(_0x150c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x150c('0x4'));var logger=require(_0x150c('0x5'))(_0x150c('0x6'));var config=require(_0x150c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x150c('0x8')][_0x150c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ae5a9,_0x244e96,_0x19abd2){return new BPromise(function(_0x316817,_0x337c30){return client['request'](_0x4ae5a9,_0x19abd2)[_0x150c('0xa')](function(_0x155526){logger[_0x150c('0xb')](_0x150c('0xc'),_0x244e96,_0x150c('0xd'));logger[_0x150c('0xe')](_0x150c('0xf'),_0x244e96,'request\x20sent',JSON[_0x150c('0x10')](_0x155526));if(_0x155526['error']){if(_0x155526['error'][_0x150c('0x11')]===0x1f4){logger[_0x150c('0x12')](_0x150c('0xc'),_0x244e96,_0x155526[_0x150c('0x12')][_0x150c('0x13')]);return _0x337c30(_0x155526[_0x150c('0x12')][_0x150c('0x13')]);}logger[_0x150c('0x12')](_0x150c('0xc'),_0x244e96,_0x155526['error']['message']);return _0x316817(_0x155526['error'][_0x150c('0x13')]);}else{logger[_0x150c('0xb')](_0x150c('0xc'),_0x244e96,_0x150c('0xd'));_0x316817(_0x155526[_0x150c('0x14')][_0x150c('0x13')]);}})['catch'](function(_0x338982){logger[_0x150c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x244e96,_0x338982);_0x337c30(_0x338982);});});}exports[_0x150c('0x15')]=function(_0x1b629e){var _0x5bc046=this;return new Promise(function(_0x11ca58,_0x460221){return db['CmHopperHistory'][_0x150c('0x16')](_0x1b629e['body'],{'raw':_0x1b629e[_0x150c('0x17')]?_0x1b629e['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3391c2){logger[_0x150c('0xb')](_0x150c('0x15'),_0x1b629e);logger[_0x150c('0xe')](_0x150c('0x15'),_0x1b629e,JSON[_0x150c('0x10')](_0x3391c2));_0x11ca58(_0x3391c2);})[_0x150c('0x18')](function(_0x3eff82){logger[_0x150c('0x12')](_0x150c('0x15'),_0x3eff82['message'],_0x1b629e);_0x460221(_0x5bc046['error'](0x1f4,_0x3eff82[_0x150c('0x13')]));});});};exports[_0x150c('0x19')]=function(_0x4061c5){var _0x25e31c=this;return new Promise(function(_0x628981,_0x3c6659){return db[_0x150c('0x1a')]['findAll']({'raw':_0x4061c5[_0x150c('0x17')]?_0x4061c5[_0x150c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4061c5[_0x150c('0x17')]?_0x4061c5[_0x150c('0x17')][_0x150c('0x1b')]||null:null,'attributes':[[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db['sequelize'][_0x150c('0x1e')]('id')),_0x150c('0x1f')],[db[_0x150c('0x1c')]['fn']('COUNT',db[_0x150c('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x150c('0x20')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x22')))),_0x150c('0x23')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db['sequelize']['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x150c('0x24')],[db[_0x150c('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x25')))),_0x150c('0x26')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x27'),db['sequelize']['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x28')))),_0x150c('0x29')]]})['then'](function(_0x2258ca){logger['info'](_0x150c('0x19'),_0x4061c5);logger[_0x150c('0xe')](_0x150c('0x19'),_0x4061c5,JSON['stringify'](_0x2258ca));_0x628981(_0x2258ca);})[_0x150c('0x18')](function(_0x3e7d39){logger[_0x150c('0x12')](_0x150c('0x19'),_0x3e7d39[_0x150c('0x13')],_0x4061c5);_0x3c6659(_0x25e31c[_0x150c('0x12')](0x1f4,_0x3e7d39[_0x150c('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2829c3){var _0x38b6f2=this;return new Promise(function(_0x267b8a,_0x3bc427){return db['CmHopperHistory'][_0x150c('0x2a')]({'raw':_0x2829c3[_0x150c('0x17')]?_0x2829c3[_0x150c('0x17')][_0x150c('0x2b')]===undefined?!![]:![]:!![],'where':_0x2829c3[_0x150c('0x17')]?_0x2829c3['options'][_0x150c('0x1b')]||null:null,'attributes':[['campaign','name'],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db['sequelize'][_0x150c('0x21')](_0x150c('0x2c')))),_0x150c('0x2d')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x2e')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')]['literal'](_0x150c('0x20')))),_0x150c('0x2f')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db['sequelize']['fn']('IF',db[_0x150c('0x1c')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x150c('0x30')],[db[_0x150c('0x1c')]['fn']('COUNT',db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x31')))),'outboundCongestionCallsDay'],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x32')))),_0x150c('0x33')],[db['sequelize']['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db['sequelize'][_0x150c('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x150c('0x34')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')]['literal'](_0x150c('0x35')))),_0x150c('0x36')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x37')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x38')))),_0x150c('0x39')],[db[_0x150c('0x1c')]['fn']('COUNT',db[_0x150c('0x1c')]['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x3a')))),_0x150c('0x3b')],[db['sequelize']['fn'](_0x150c('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x150c('0x21')](_0x150c('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')]['fn']('IF',db['sequelize'][_0x150c('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x150c('0x3b')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db['sequelize']['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x150c('0x3d')]],'group':[_0x150c('0x3e')]})[_0x150c('0xa')](function(_0x13f84d){logger['info'](_0x150c('0x3f'),_0x2829c3);logger[_0x150c('0xe')](_0x150c('0x3f'),_0x2829c3,JSON[_0x150c('0x10')](_0x13f84d));_0x267b8a(_0x13f84d);})[_0x150c('0x18')](function(_0x173e8c){logger[_0x150c('0x12')](_0x150c('0x3f'),_0x173e8c['message'],_0x2829c3);_0x3bc427(_0x38b6f2[_0x150c('0x12')](0x1f4,_0x173e8c[_0x150c('0x13')]));});});};exports[_0x150c('0x40')]=function(_0x544ad5){var _0x597d8b=this;return new Promise(function(_0x2d2560,_0x3499f6){return db[_0x150c('0x1a')]['findAll']({'raw':_0x544ad5[_0x150c('0x17')]?_0x544ad5[_0x150c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x544ad5[_0x150c('0x17')]?_0x544ad5[_0x150c('0x17')][_0x150c('0x1b')]||null:null,'attributes':[['campaign','name'],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db[_0x150c('0x1c')][_0x150c('0x1e')]('id')),_0x150c('0x41')],[db[_0x150c('0x1c')]['fn'](_0x150c('0x1d'),db['sequelize']['fn']('IF',db[_0x150c('0x1c')][_0x150c('0x21')](_0x150c('0x20')))),'ivrAnswerCallsDay']],'group':[_0x150c('0x3e')]})[_0x150c('0xa')](function(_0x3f1e43){logger[_0x150c('0xb')](_0x150c('0x40'),_0x544ad5);logger['debug'](_0x150c('0x40'),_0x544ad5,JSON['stringify'](_0x3f1e43));_0x2d2560(_0x3f1e43);})[_0x150c('0x18')](function(_0x57150c){logger[_0x150c('0x12')](_0x150c('0x40'),_0x57150c[_0x150c('0x13')],_0x544ad5);_0x3499f6(_0x597d8b[_0x150c('0x12')](0x1f4,_0x57150c[_0x150c('0x13')]));});});}; \ No newline at end of file +var _0x6ea9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CmHopperHistory','create','body','raw','CreateCmHopperHistory','catch','AvgHandleTime','findAll','options','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','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','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring'];(function(_0x30b1a4,_0x2a3b25){var _0x7da915=function(_0x4e3834){while(--_0x4e3834){_0x30b1a4['push'](_0x30b1a4['shift']());}};_0x7da915(++_0x2a3b25);}(_0x6ea9,0x89));var _0x96ea=function(_0x52885e,_0x3380da){_0x52885e=_0x52885e-0x0;var _0x363e23=_0x6ea9[_0x52885e];return _0x363e23;};'use strict';var _=require(_0x96ea('0x0'));var util=require(_0x96ea('0x1'));var moment=require(_0x96ea('0x2'));var BPromise=require(_0x96ea('0x3'));var rs=require(_0x96ea('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96ea('0x5'))['db'];var utils=require(_0x96ea('0x6'));var logger=require(_0x96ea('0x7'))('rpc');var config=require(_0x96ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x124a0d,_0x5da08c,_0x5cd8f3){return new BPromise(function(_0x1504a9,_0xa73260){return client[_0x96ea('0xa')](_0x124a0d,_0x5cd8f3)[_0x96ea('0xb')](function(_0x34f728){logger['info'](_0x96ea('0xc'),_0x5da08c,_0x96ea('0xd'));logger[_0x96ea('0xe')](_0x96ea('0xf'),_0x5da08c,_0x96ea('0xd'),JSON[_0x96ea('0x10')](_0x34f728));if(_0x34f728[_0x96ea('0x11')]){if(_0x34f728[_0x96ea('0x11')][_0x96ea('0x12')]===0x1f4){logger[_0x96ea('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x5da08c,_0x34f728[_0x96ea('0x11')]['message']);return _0xa73260(_0x34f728[_0x96ea('0x11')][_0x96ea('0x13')]);}logger['error'](_0x96ea('0xc'),_0x5da08c,_0x34f728[_0x96ea('0x11')][_0x96ea('0x13')]);return _0x1504a9(_0x34f728[_0x96ea('0x11')][_0x96ea('0x13')]);}else{logger[_0x96ea('0x14')](_0x96ea('0xc'),_0x5da08c,_0x96ea('0xd'));_0x1504a9(_0x34f728['result'][_0x96ea('0x13')]);}})['catch'](function(_0x5cbeca){logger[_0x96ea('0x11')](_0x96ea('0xc'),_0x5da08c,_0x5cbeca);_0xa73260(_0x5cbeca);});});}exports['CreateCmHopperHistory']=function(_0x47444c){var _0x4476da=this;return new Promise(function(_0x24c940,_0x3b7811){return db[_0x96ea('0x15')][_0x96ea('0x16')](_0x47444c[_0x96ea('0x17')],{'raw':_0x47444c['options']?_0x47444c['options'][_0x96ea('0x18')]===undefined?!![]:![]:!![]})[_0x96ea('0xb')](function(_0xfaec11){logger[_0x96ea('0x14')](_0x96ea('0x19'),_0x47444c);logger[_0x96ea('0xe')](_0x96ea('0x19'),_0x47444c,JSON[_0x96ea('0x10')](_0xfaec11));_0x24c940(_0xfaec11);})[_0x96ea('0x1a')](function(_0x3a618c){logger[_0x96ea('0x11')]('CreateCmHopperHistory',_0x3a618c[_0x96ea('0x13')],_0x47444c);_0x3b7811(_0x4476da[_0x96ea('0x11')](0x1f4,_0x3a618c[_0x96ea('0x13')]));});});};exports[_0x96ea('0x1b')]=function(_0x396117){var _0x1676e7=this;return new Promise(function(_0x56cbc7,_0x33e05b){return db['CmHopperHistory'][_0x96ea('0x1c')]({'raw':_0x396117[_0x96ea('0x1d')]?_0x396117['options']['raw']===undefined?!![]:![]:!![],'where':_0x396117[_0x96ea('0x1d')]?_0x396117[_0x96ea('0x1d')][_0x96ea('0x1e')]||null:null,'attributes':[[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize'][_0x96ea('0x21')]('id')),_0x96ea('0x22')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x24')))),_0x96ea('0x25')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db['sequelize'][_0x96ea('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x27'),db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x28')))),_0x96ea('0x29')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x27'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x2a')))),_0x96ea('0x2b')]]})['then'](function(_0x2547f7){logger[_0x96ea('0x14')](_0x96ea('0x1b'),_0x396117);logger[_0x96ea('0xe')](_0x96ea('0x1b'),_0x396117,JSON[_0x96ea('0x10')](_0x2547f7));_0x56cbc7(_0x2547f7);})[_0x96ea('0x1a')](function(_0x58aede){logger[_0x96ea('0x11')](_0x96ea('0x1b'),_0x58aede[_0x96ea('0x13')],_0x396117);_0x33e05b(_0x1676e7[_0x96ea('0x11')](0x1f4,_0x58aede[_0x96ea('0x13')]));});});};exports[_0x96ea('0x2c')]=function(_0x461540){var _0x2deed9=this;return new Promise(function(_0x27a9d5,_0x1eb16e){return db[_0x96ea('0x15')][_0x96ea('0x1c')]({'raw':_0x461540[_0x96ea('0x1d')]?_0x461540[_0x96ea('0x1d')][_0x96ea('0x18')]===undefined?!![]:![]:!![],'where':_0x461540[_0x96ea('0x1d')]?_0x461540[_0x96ea('0x1d')][_0x96ea('0x1e')]||null:null,'attributes':[[_0x96ea('0x2d'),'name'],[db[_0x96ea('0x1f')]['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x2e')))),_0x96ea('0x2f')],[db['sequelize']['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x30')))),'outboundNoAnswerCallsDay'],[db[_0x96ea('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x24')))),_0x96ea('0x31')],[db['sequelize']['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x32')))),'outboundBusyCallsDay'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x33')))),_0x96ea('0x34')],[db['sequelize']['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x96ea('0x35')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x36')))),_0x96ea('0x37')],[db['sequelize']['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal'](_0x96ea('0x38')))),_0x96ea('0x39')],[db[_0x96ea('0x1f')]['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x3a')))),_0x96ea('0x3b')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x96ea('0x23')](_0x96ea('0x3c')))),_0x96ea('0x3d')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x96ea('0x3e')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x3f')))),'outboundAnswerAgiCallsDay'],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db['sequelize']['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x40')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')](_0x96ea('0x41')))),_0x96ea('0x42')]],'group':[_0x96ea('0x2d')]})['then'](function(_0x3ef29b){logger[_0x96ea('0x14')](_0x96ea('0x2c'),_0x461540);logger['debug'](_0x96ea('0x2c'),_0x461540,JSON[_0x96ea('0x10')](_0x3ef29b));_0x27a9d5(_0x3ef29b);})[_0x96ea('0x1a')](function(_0x28db59){logger[_0x96ea('0x11')](_0x96ea('0x2c'),_0x28db59['message'],_0x461540);_0x1eb16e(_0x2deed9['error'](0x1f4,_0x28db59['message']));});});};exports[_0x96ea('0x43')]=function(_0x5d96fc){var _0x2ff5bf=this;return new Promise(function(_0xcc2876,_0x24c99d){return db[_0x96ea('0x15')][_0x96ea('0x1c')]({'raw':_0x5d96fc['options']?_0x5d96fc[_0x96ea('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5d96fc[_0x96ea('0x1d')]?_0x5d96fc['options'][_0x96ea('0x1e')]||null:null,'attributes':[[_0x96ea('0x2d'),_0x96ea('0x44')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['col']('id')),_0x96ea('0x45')],[db[_0x96ea('0x1f')]['fn'](_0x96ea('0x20'),db[_0x96ea('0x1f')]['fn']('IF',db[_0x96ea('0x1f')][_0x96ea('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x96ea('0x46')]],'group':[_0x96ea('0x2d')]})[_0x96ea('0xb')](function(_0x2b5473){logger['info'](_0x96ea('0x43'),_0x5d96fc);logger[_0x96ea('0xe')](_0x96ea('0x43'),_0x5d96fc,JSON[_0x96ea('0x10')](_0x2b5473));_0xcc2876(_0x2b5473);})[_0x96ea('0x1a')](function(_0x39f934){logger[_0x96ea('0x11')](_0x96ea('0x43'),_0x39f934['message'],_0x5d96fc);_0x24c99d(_0x2ff5bf['error'](0x1f4,_0x39f934[_0x96ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index de966e1..85b2e38 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 _0xeff7=['isAuthenticated','index','get','/:id','show','put','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xeff7,0x1b7));var _0x7eff=function(_0x3ce3eb,_0x3f289f){_0x3ce3eb=_0x3ce3eb-0x0;var _0x4f0ebb=_0xeff7[_0x3ce3eb];return _0x4f0ebb;};'use strict';var multer=require(_0x7eff('0x0'));var util=require(_0x7eff('0x1'));var path=require(_0x7eff('0x2'));var timeout=require('connect-timeout');var express=require(_0x7eff('0x3'));var router=express['Router']();var fs_extra=require(_0x7eff('0x4'));var auth=require(_0x7eff('0x5'));var interaction=require(_0x7eff('0x6'));var config=require(_0x7eff('0x7'));var controller=require(_0x7eff('0x8'));router['get']('/',auth[_0x7eff('0x9')](),controller[_0x7eff('0xa')]);router[_0x7eff('0xb')]('/describe',auth[_0x7eff('0x9')](),controller['describe']);router[_0x7eff('0xb')](_0x7eff('0xc'),auth[_0x7eff('0x9')](),controller[_0x7eff('0xd')]);router['post']('/',auth[_0x7eff('0x9')](),controller['create']);router[_0x7eff('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x7eff('0xf')]=router; \ No newline at end of file +var _0xb772=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x573647,_0x46e315){var _0x3c1fb4=function(_0x2fbd04){while(--_0x2fbd04){_0x573647['push'](_0x573647['shift']());}};_0x3c1fb4(++_0x46e315);}(_0xb772,0x9b));var _0x2b77=function(_0x48caf9,_0x561dcb){_0x48caf9=_0x48caf9-0x0;var _0x42a263=_0xb772[_0x48caf9];return _0x42a263;};'use strict';var multer=require(_0x2b77('0x0'));var util=require(_0x2b77('0x1'));var path=require('path');var timeout=require(_0x2b77('0x2'));var express=require(_0x2b77('0x3'));var router=express[_0x2b77('0x4')]();var fs_extra=require(_0x2b77('0x5'));var auth=require(_0x2b77('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2b77('0x7'));var controller=require(_0x2b77('0x8'));router[_0x2b77('0x9')]('/',auth[_0x2b77('0xa')](),controller[_0x2b77('0xb')]);router[_0x2b77('0x9')](_0x2b77('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2b77('0x9')](_0x2b77('0xd'),auth[_0x2b77('0xa')](),controller[_0x2b77('0xe')]);router[_0x2b77('0xf')]('/',auth['isAuthenticated'](),controller[_0x2b77('0x10')]);router[_0x2b77('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2b77('0x12')]);module[_0x2b77('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 ecf6ac8..77b29ac 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 _0x9335=['exports','name','STRING','sequelize'];(function(_0x5775dd,_0x5f0415){var _0x4603fb=function(_0x1fe1f2){while(--_0x1fe1f2){_0x5775dd['push'](_0x5775dd['shift']());}};_0x4603fb(++_0x5f0415);}(_0x9335,0xab));var _0x5933=function(_0x9c5419,_0x23535c){_0x9c5419=_0x9c5419-0x0;var _0x35eca1=_0x9335[_0x9c5419];return _0x35eca1;};'use strict';var Sequelize=require(_0x5933('0x0'));module[_0x5933('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5933('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5933('0x3')]},'dialPrefix':{'type':Sequelize[_0x5933('0x3')]}}; \ No newline at end of file +var _0xf2ca=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0xf2ca[_0x512e72];return _0x143086;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaf2c('0x2')]},'dialPrefix':{'type':Sequelize[_0xaf2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 672683c..951c33d 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 _0x087e=['save','update','then','destroy','get','Lists','end','stack','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','include','rows','catch','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','getDispositions','findOne','Disposition','nolimit','findAll','removeDispositions','CmContact','isArray','tags','join','push','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','options','getContactsCsv','CmCustomField','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','removeAgents','User','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3f9d52,_0x3b3f19){var _0x2d7381=function(_0x2dbf72){while(--_0x2dbf72){_0x3f9d52['push'](_0x3f9d52['shift']());}};_0x2d7381(++_0x3b3f19);}(_0x087e,0x68));var _0xe087=function(_0x3a1a0b,_0x296c05){_0x3a1a0b=_0x3a1a0b-0x0;var _0xecf8f3=_0x087e[_0x3a1a0b];return _0xecf8f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe087('0x0'));var jsonpatch=require(_0xe087('0x1'));var rp=require(_0xe087('0x2'));var moment=require(_0xe087('0x3'));var BPromise=require(_0xe087('0x4'));var Mustache=require(_0xe087('0x5'));var util=require(_0xe087('0x6'));var path=require('path');var sox=require(_0xe087('0x7'));var csv=require(_0xe087('0x8'));var ejs=require(_0xe087('0x9'));var fs=require('fs');var fs_extra=require(_0xe087('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe087('0xb'));var jsforce=require(_0xe087('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe087('0x8'));var querystring=require(_0xe087('0xd'));var Papa=require('papaparse');var Redis=require(_0xe087('0xe'));var authService=require(_0xe087('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe087('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe087('0x11'))(_0xe087('0x12'));var utils=require(_0xe087('0x13'));var config=require(_0xe087('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe087('0x15'))['db'];config['redis']=_[_0xe087('0x16')](config[_0xe087('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xe087('0x18'))(new Redis(config['redis']));require('./cmList.socket')[_0xe087('0x19')](socket);function respondWithStatusCode(_0x49f9a6,_0x43c8cf){_0x43c8cf=_0x43c8cf||0xcc;return function(_0x37d204){if(_0x37d204){return _0x49f9a6[_0xe087('0x1a')](_0x43c8cf);}return _0x49f9a6[_0xe087('0x1b')](_0x43c8cf)['end']();};}function respondWithResult(_0x3efde2,_0x334b38){_0x334b38=_0x334b38||0xc8;return function(_0x452feb){if(_0x452feb){return _0x3efde2[_0xe087('0x1b')](_0x334b38)[_0xe087('0x1c')](_0x452feb);}};}function respondWithFilteredResult(_0x3c3781,_0x395018){return function(_0x15cfd3){if(_0x15cfd3){var _0x1dbbb7=typeof _0x395018[_0xe087('0x1d')]===_0xe087('0x1e')&&typeof _0x395018[_0xe087('0x1f')]===_0xe087('0x1e');var _0x5a735a=_0x15cfd3[_0xe087('0x20')];var _0x4f6e5c=_0x1dbbb7?0x0:_0x395018[_0xe087('0x1d')];var _0xc269f2=_0x1dbbb7?_0x15cfd3[_0xe087('0x20')]:_0x395018['offset']+_0x395018[_0xe087('0x1f')];var _0x2164bf;if(_0xc269f2>=_0x5a735a){_0xc269f2=_0x5a735a;_0x2164bf=0xc8;}else{_0x2164bf=0xce;}_0x3c3781[_0xe087('0x1b')](_0x2164bf);return _0x3c3781[_0xe087('0x21')](_0xe087('0x22'),_0x4f6e5c+'-'+_0xc269f2+'/'+_0x5a735a)[_0xe087('0x1c')](_0x15cfd3);}return null;};}function patchUpdates(_0x4531a9){return function(_0x5df361){try{jsonpatch[_0xe087('0x23')](_0x5df361,_0x4531a9,!![]);}catch(_0x11e42f){return BPromise[_0xe087('0x24')](_0x11e42f);}return _0x5df361[_0xe087('0x25')]();};}function saveUpdates(_0x53899d,_0x2d2e0a){return function(_0x39f143){if(_0x39f143){return _0x39f143[_0xe087('0x26')](_0x53899d)[_0xe087('0x27')](function(_0x219145){return _0x219145;});}return null;};}function removeEntity(_0x1b528c,_0x361bcc){return function(_0x3cd6af){if(_0x3cd6af){return _0x3cd6af[_0xe087('0x28')]()[_0xe087('0x27')](function(){var _0xb00d64=_0x3cd6af[_0xe087('0x29')]({'plain':!![]});var _0x5ac2ca=_0xe087('0x2a');return db['UserProfileResource'][_0xe087('0x28')]({'where':{'type':_0x5ac2ca,'resourceId':_0xb00d64['id']}})['then'](function(){return _0x3cd6af;});})[_0xe087('0x27')](function(){_0x1b528c[_0xe087('0x1b')](0xcc)[_0xe087('0x2b')]();});}};}function handleEntityNotFound(_0x537702,_0x1c1c9c){return function(_0x91b0fd){if(!_0x91b0fd){_0x537702[_0xe087('0x1a')](0x194);}return _0x91b0fd;};}function handleError(_0x12315d,_0x2e6547){_0x2e6547=_0x2e6547||0x1f4;return function(_0x1d3881){logger['error'](_0x1d3881[_0xe087('0x2c')]);if(_0x1d3881['name']){delete _0x1d3881['name'];}_0x12315d[_0xe087('0x1b')](_0x2e6547)[_0xe087('0x2d')](_0x1d3881);};}exports[_0xe087('0x2e')]=function(_0x3b1194,_0x57470e){var _0x1bbeb4={},_0x5181ac={},_0x39f1b4={'count':0x0,'rows':[]};var _0x27d105=_[_0xe087('0x2f')](db[_0xe087('0x30')][_0xe087('0x31')],function(_0xc50189){return{'name':_0xc50189['fieldName'],'type':_0xc50189[_0xe087('0x32')][_0xe087('0x33')]};});_0x5181ac[_0xe087('0x34')]=_['map'](_0x27d105,'name');_0x5181ac[_0xe087('0x35')]=_[_0xe087('0x36')](_0x3b1194[_0xe087('0x35')]);_0x5181ac[_0xe087('0x37')]=_[_0xe087('0x38')](_0x5181ac[_0xe087('0x34')],_0x5181ac['query']);_0x1bbeb4[_0xe087('0x39')]=_['intersection'](_0x5181ac[_0xe087('0x34')],qs['fields'](_0x3b1194[_0xe087('0x35')]['fields']));_0x1bbeb4[_0xe087('0x39')]=_0x1bbeb4[_0xe087('0x39')][_0xe087('0x3a')]?_0x1bbeb4[_0xe087('0x39')]:_0x5181ac[_0xe087('0x34')];if(!_0x3b1194[_0xe087('0x35')][_0xe087('0x3b')]('nolimit')){_0x1bbeb4[_0xe087('0x1f')]=qs[_0xe087('0x1f')](_0x3b1194['query'][_0xe087('0x1f')]);_0x1bbeb4[_0xe087('0x1d')]=qs[_0xe087('0x1d')](_0x3b1194[_0xe087('0x35')][_0xe087('0x1d')]);}_0x1bbeb4[_0xe087('0x3c')]=qs[_0xe087('0x3d')](_0x3b1194[_0xe087('0x35')][_0xe087('0x3d')]);_0x1bbeb4[_0xe087('0x3e')]=qs[_0xe087('0x37')](_[_0xe087('0x3f')](_0x3b1194['query'],_0x5181ac[_0xe087('0x37')]),_0x27d105);if(_0x3b1194['query'][_0xe087('0x40')]){_0x1bbeb4[_0xe087('0x3e')]=_['merge'](_0x1bbeb4[_0xe087('0x3e')],{'$or':_[_0xe087('0x2f')](_0x27d105,function(_0x3b2d94){if(_0x3b2d94[_0xe087('0x32')]!==_0xe087('0x41')){var _0x1c84a5={};_0x1c84a5[_0x3b2d94[_0xe087('0x42')]]={'$like':'%'+_0x3b1194[_0xe087('0x35')][_0xe087('0x40')]+'%'};return _0x1c84a5;}})});}_0x1bbeb4=_[_0xe087('0x43')]({},_0x1bbeb4,_0x3b1194['options']);var _0x4342bc={'where':_0x1bbeb4['where']};return db[_0xe087('0x30')][_0xe087('0x20')](_0x4342bc)[_0xe087('0x27')](function(_0xddac8d){_0x39f1b4[_0xe087('0x20')]=_0xddac8d;if(_0x3b1194[_0xe087('0x35')][_0xe087('0x44')]){_0x1bbeb4[_0xe087('0x45')]=[{'all':!![]}];}return db[_0xe087('0x30')]['findAll'](_0x1bbeb4);})[_0xe087('0x27')](function(_0x46b432){_0x39f1b4[_0xe087('0x46')]=_0x46b432;return _0x39f1b4;})['then'](respondWithFilteredResult(_0x57470e,_0x1bbeb4))[_0xe087('0x47')](handleError(_0x57470e,null));};exports[_0xe087('0x48')]=function(_0x942e5c,_0x1743f7){var _0x2cfc0a={'raw':![],'where':{'id':_0x942e5c[_0xe087('0x49')]['id']}},_0x42183e={};_0x42183e[_0xe087('0x34')]=_[_0xe087('0x36')](db[_0xe087('0x30')][_0xe087('0x31')]);_0x42183e[_0xe087('0x35')]=_[_0xe087('0x36')](_0x942e5c[_0xe087('0x35')]);_0x42183e['filters']=_['intersection'](_0x42183e[_0xe087('0x34')],_0x42183e[_0xe087('0x35')]);_0x2cfc0a[_0xe087('0x39')]=_[_0xe087('0x38')](_0x42183e[_0xe087('0x34')],qs[_0xe087('0x4a')](_0x942e5c[_0xe087('0x35')]['fields']));_0x2cfc0a['attributes']=_0x2cfc0a['attributes'][_0xe087('0x3a')]?_0x2cfc0a[_0xe087('0x39')]:_0x42183e[_0xe087('0x34')];if(_0x942e5c[_0xe087('0x35')]['includeAll']){_0x2cfc0a['include']=[{'all':!![]}];}_0x2cfc0a=_[_0xe087('0x43')]({},_0x2cfc0a,_0x942e5c['options']);return db['CmList'][_0xe087('0x4b')](_0x2cfc0a)['then'](handleEntityNotFound(_0x1743f7,null))[_0xe087('0x27')](respondWithResult(_0x1743f7,null))[_0xe087('0x47')](handleError(_0x1743f7,null));};exports[_0xe087('0x4c')]=function(_0x571461,_0x2ae159){return db[_0xe087('0x30')][_0xe087('0x4c')](_0x571461['body'],{})[_0xe087('0x27')](function(_0x2ec3b8){var _0x57d0d0=_0x571461[_0xe087('0x4d')][_0xe087('0x29')]({'plain':!![]});if(!_0x57d0d0)throw new Error(_0xe087('0x4e'));if(_0x57d0d0[_0xe087('0x4f')]===_0xe087('0x4d')){var _0x1e3d26=_0x2ec3b8[_0xe087('0x29')]({'plain':!![]});var _0x176355=_0xe087('0x2a');return db['UserProfileSection'][_0xe087('0x4b')]({'where':{'name':_0x176355,'userProfileId':_0x57d0d0[_0xe087('0x50')]},'raw':!![]})[_0xe087('0x27')](function(_0x4497ee){if(_0x4497ee&&_0x4497ee[_0xe087('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e3d26[_0xe087('0x42')],'resourceId':_0x1e3d26['id'],'type':_0x4497ee[_0xe087('0x42')],'sectionId':_0x4497ee['id']},{})[_0xe087('0x27')](function(){return _0x2ec3b8;});}else{return _0x2ec3b8;}})['catch'](function(_0x36ebe){logger[_0xe087('0x52')](_0xe087('0x53'),_0x36ebe);throw _0x36ebe;});}return _0x2ec3b8;})[_0xe087('0x27')](respondWithResult(_0x2ae159,0xc9))[_0xe087('0x47')](handleError(_0x2ae159,null));};exports[_0xe087('0x26')]=function(_0x4899a6,_0x46192d){if(_0x4899a6['body']['id']){delete _0x4899a6[_0xe087('0x54')]['id'];}return db[_0xe087('0x30')][_0xe087('0x4b')]({'where':{'id':_0x4899a6['params']['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x46192d,null))[_0xe087('0x27')](saveUpdates(_0x4899a6[_0xe087('0x54')],null))[_0xe087('0x27')](respondWithResult(_0x46192d,null))[_0xe087('0x47')](handleError(_0x46192d,null));};exports[_0xe087('0x28')]=function(_0x56fec3,_0x28ef13){return db['CmList'][_0xe087('0x4b')]({'where':{'id':_0x56fec3[_0xe087('0x49')]['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x28ef13,null))['then'](removeEntity(_0x28ef13,null))[_0xe087('0x47')](handleError(_0x28ef13,null));};exports[_0xe087('0x55')]=function(_0x53dbf9,_0x1c098f){return db[_0xe087('0x30')]['describe']()[_0xe087('0x27')](respondWithResult(_0x1c098f,null))[_0xe087('0x47')](handleError(_0x1c098f,null));};exports['addDisposition']=function(_0x319b17,_0x38cc36,_0x1c2500){if(_0x319b17['body']['id']){delete _0x319b17[_0xe087('0x54')]['id'];}return db[_0xe087('0x30')][_0xe087('0x4b')]({'where':{'id':_0x319b17['params']['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x38cc36,null))['then'](function(_0x29ed06){if(_0x29ed06){_0x319b17['body'][_0xe087('0x56')]=_0x29ed06['id'];return db['Disposition'][_0xe087('0x4c')](_0x319b17['body']);}})[_0xe087('0x27')](respondWithResult(_0x38cc36,null))[_0xe087('0x47')](handleError(_0x38cc36,null));};exports[_0xe087('0x57')]=function(_0x3bb0f5,_0x24ffae,_0x2a55f6){var _0x2c924f={'raw':![],'where':{}};var _0x233898={};var _0x5b606b={'count':0x0,'rows':[]};return db[_0xe087('0x30')][_0xe087('0x58')]({'where':{'id':_0x3bb0f5[_0xe087('0x49')]['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x24ffae,null))[_0xe087('0x27')](function(_0x20c8b4){if(_0x20c8b4){_0x233898[_0xe087('0x34')]=_['keys'](db[_0xe087('0x59')][_0xe087('0x31')]);_0x233898[_0xe087('0x35')]=_[_0xe087('0x36')](_0x3bb0f5[_0xe087('0x35')]);_0x233898['filters']=_['intersection'](_0x233898[_0xe087('0x34')],_0x233898[_0xe087('0x35')]);_0x2c924f[_0xe087('0x39')]=_[_0xe087('0x38')](_0x233898['model'],qs[_0xe087('0x4a')](_0x3bb0f5[_0xe087('0x35')][_0xe087('0x4a')]));_0x2c924f['attributes']=_0x2c924f['attributes'][_0xe087('0x3a')]?_0x2c924f[_0xe087('0x39')]:_0x233898[_0xe087('0x34')];if(!_0x3bb0f5[_0xe087('0x35')][_0xe087('0x3b')](_0xe087('0x5a'))){_0x2c924f[_0xe087('0x1f')]=qs[_0xe087('0x1f')](_0x3bb0f5['query']['limit']);_0x2c924f[_0xe087('0x1d')]=qs['offset'](_0x3bb0f5[_0xe087('0x35')]['offset']);}_0x2c924f['order']=qs[_0xe087('0x3d')](_0x3bb0f5[_0xe087('0x35')]['sort']);_0x2c924f[_0xe087('0x3e')]=qs[_0xe087('0x37')](_[_0xe087('0x3f')](_0x3bb0f5[_0xe087('0x35')],_0x233898[_0xe087('0x37')]));_0x2c924f[_0xe087('0x3e')]['ListId']=_0x20c8b4['id'];if(_0x3bb0f5['query']['filter']){_0x2c924f['where']=_['merge'](_0x2c924f[_0xe087('0x3e')],{'$or':_['map'](_0x2c924f[_0xe087('0x39')],function(_0x174289){var _0x28ef45={};_0x28ef45[_0x174289]={'$like':'%'+_0x3bb0f5['query'][_0xe087('0x40')]+'%'};return _0x28ef45;})});}_0x2c924f=_[_0xe087('0x43')]({},_0x2c924f,_0x3bb0f5['options']);return db[_0xe087('0x59')]['count']({'where':_0x2c924f[_0xe087('0x3e')]})[_0xe087('0x27')](function(_0x1af33d){_0x5b606b['count']=_0x1af33d;if(_0x3bb0f5[_0xe087('0x35')][_0xe087('0x44')]){_0x2c924f[_0xe087('0x45')]=[{'all':!![]}];}return db[_0xe087('0x59')][_0xe087('0x5b')](_0x2c924f);})[_0xe087('0x27')](function(_0x2ab75e){_0x5b606b[_0xe087('0x46')]=_0x2ab75e;return _0x5b606b;});}})['then'](respondWithFilteredResult(_0x24ffae,_0x2c924f))[_0xe087('0x47')](handleError(_0x24ffae,null));};exports[_0xe087('0x5c')]=function(_0x389c1e,_0x367edf,_0x4a024c){return db[_0xe087('0x30')]['find']({'where':{'id':_0x389c1e[_0xe087('0x49')]['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x367edf,null))[_0xe087('0x27')](function(_0x1d9234){if(_0x1d9234){return _0x1d9234[_0xe087('0x5c')](_0x389c1e[_0xe087('0x35')]['ids']);}})['then'](respondWithStatusCode(_0x367edf,null))[_0xe087('0x47')](handleError(_0x367edf,null));};exports['addContacts']=function(_0x56335f,_0xa5f131,_0x501430){return db[_0xe087('0x30')]['find']({'where':{'id':_0x56335f['params']['id']}})[_0xe087('0x27')](handleEntityNotFound(_0xa5f131,null))[_0xe087('0x27')](function(_0x90bba2){if(_0x90bba2){var _0x2632dc=[];var _0x3e0bb3={'success':[],'errors':[]};return db[_0xe087('0x5d')][_0xe087('0x55')]()['then'](function(_0x9e7957){if(_0x56335f[_0xe087('0x54')]['tags']&&_[_0xe087('0x5e')](_0x56335f[_0xe087('0x54')][_0xe087('0x5f')])){if(_0x56335f[_0xe087('0x54')][_0xe087('0x5f')]['length']){_0x56335f[_0xe087('0x54')][_0xe087('0x5f')]=_0x56335f[_0xe087('0x54')][_0xe087('0x5f')][_0xe087('0x60')](';')+';';}else{_0x56335f[_0xe087('0x54')][_0xe087('0x5f')]=null;}}else{_0x56335f[_0xe087('0x54')][_0xe087('0x5f')]=null;}if(_0x56335f[_0xe087('0x54')]&&_[_0xe087('0x5e')](_0x56335f['body'])){for(var _0x1742ab=0x0;_0x1742ab<_0x56335f['body'][_0xe087('0x3a')];_0x1742ab+=0x1){_0x56335f[_0xe087('0x54')][_0x1742ab]['ListId']=_0x56335f[_0xe087('0x49')]['id'];_0x2632dc[_0xe087('0x61')](_0x56335f[_0xe087('0x54')][_0x1742ab]);}return BPromise['each'](_0x2632dc,function(_0x498b76){return db['CmContact'][_0xe087('0x4c')](_[_0xe087('0x62')](_0x498b76,[_0xe087('0x63'),'id'])||{},{'fields':_[_0xe087('0x36')](_0x9e7957),'raw':!![]})[_0xe087('0x27')](function(_0x388b26){_0x3e0bb3[_0xe087('0x64')][_0xe087('0x61')](_0x388b26[_0xe087('0x65')]);})['catch'](function(_0x496659){_0x3e0bb3['errors'][_0xe087('0x61')]({'data':_0x498b76,'error':_0x496659[_0xe087('0x66')]});});})[_0xe087('0x27')](function(_0x4b1cd0){return _0x3e0bb3;})[_0xe087('0x47')](function(_0x3f6bbf){return _0x3f6bbf;});}else{_0xa5f131[_0xe087('0x1b')](0x190)['json']({'message':_0xe087('0x67')});}});}})[_0xe087('0x27')](respondWithResult(_0xa5f131,null))[_0xe087('0x47')](handleError(_0xa5f131,null));};exports[_0xe087('0x68')]=function(_0x3170b8,_0x1bb2d5,_0x43fe73){var _0x290c3d;return db[_0xe087('0x30')][_0xe087('0x4b')]({'where':{'id':_0x3170b8['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xe087('0x69')}]})[_0xe087('0x27')](handleEntityNotFound(_0x1bb2d5,null))['then'](function(_0x3d5714){if(_0x3d5714){_0x290c3d=_0x3d5714;return db[_0xe087('0x5d')]['rawAttributes'];}})[_0xe087('0x27')](function(_0x2d9a72){if(_0x2d9a72){var _0x5c3da1={};var _0x4e9a7e={};_0x4e9a7e[_0xe087('0x34')]=_[_0xe087('0x6a')](_[_0xe087('0x36')](_0x2d9a72),_['map'](_0x290c3d[_0xe087('0x69')],function(_0x4c570e){return util['format'](_0xe087('0x6b'),_0x4c570e['id']);}));_0x4e9a7e[_0xe087('0x35')]=_[_0xe087('0x36')](_0x3170b8[_0xe087('0x35')]);_0x4e9a7e['filters']=_[_0xe087('0x38')](_0x4e9a7e[_0xe087('0x34')],_0x4e9a7e['query']);_0x5c3da1[_0xe087('0x39')]=_[_0xe087('0x38')](_0x4e9a7e[_0xe087('0x34')],qs[_0xe087('0x4a')](_0x3170b8[_0xe087('0x35')]['fields']));_0x5c3da1[_0xe087('0x39')]=_0x5c3da1[_0xe087('0x39')][_0xe087('0x3a')]?_0x5c3da1[_0xe087('0x39')]:_0x4e9a7e[_0xe087('0x34')];if(!_0x3170b8[_0xe087('0x35')][_0xe087('0x3b')](_0xe087('0x5a'))){_0x5c3da1[_0xe087('0x1f')]=qs['limit'](_0x3170b8[_0xe087('0x35')][_0xe087('0x1f')]);_0x5c3da1['offset']=qs[_0xe087('0x1d')](_0x3170b8[_0xe087('0x35')][_0xe087('0x1d')]);}_0x5c3da1[_0xe087('0x3c')]=qs[_0xe087('0x3d')](_0x3170b8[_0xe087('0x35')][_0xe087('0x3d')]);_0x5c3da1[_0xe087('0x3e')]=qs[_0xe087('0x37')](_[_0xe087('0x3f')](_0x3170b8[_0xe087('0x35')],_0x4e9a7e[_0xe087('0x37')]));_0x5c3da1[_0xe087('0x6c')]=!![];if(_0x3170b8[_0xe087('0x35')][_0xe087('0x40')]){_0x5c3da1['where']=_[_0xe087('0x43')](_0x5c3da1['where'],{'$or':_[_0xe087('0x2f')](_0x5c3da1[_0xe087('0x39')],function(_0x40d037){var _0x14827a={};_0x14827a[_0x40d037]={'$like':'%'+_0x3170b8[_0xe087('0x35')][_0xe087('0x40')]+'%'};return _0x14827a;})});}_0x5c3da1=_['merge']({},_0x5c3da1,_0x3170b8[_0xe087('0x6d')]);return _0x290c3d['getContacts'](_0x5c3da1);}})[_0xe087('0x27')](respondWithResult(_0x1bb2d5,null))[_0xe087('0x47')](handleError(_0x1bb2d5,null));};exports[_0xe087('0x6e')]=function(_0x5ee36d,_0xf71d8,_0x179b41){var _0x165a8a;return db[_0xe087('0x30')][_0xe087('0x4b')]({'where':{'id':_0x5ee36d['params']['id']},'include':[{'model':db[_0xe087('0x6f')],'as':'CustomFields'}]})[_0xe087('0x27')](handleEntityNotFound(_0xf71d8,null))[_0xe087('0x27')](function(_0x4163e3){if(_0x4163e3){_0x165a8a=_0x4163e3;return db[_0xe087('0x5d')][_0xe087('0x31')];}})[_0xe087('0x27')](function(_0x360cdc){if(_0x360cdc){var _0x52c650={};var _0x14439f={};_0x14439f[_0xe087('0x34')]=_[_0xe087('0x6a')](_['keys'](_0x360cdc),_[_0xe087('0x2f')](_0x165a8a[_0xe087('0x69')],function(_0x12bd62){return util[_0xe087('0x70')]('cf_%d',_0x12bd62['id']);}));_0x14439f[_0xe087('0x35')]=_[_0xe087('0x36')](_0x5ee36d[_0xe087('0x35')]);_0x14439f[_0xe087('0x37')]=_[_0xe087('0x38')](_0x14439f[_0xe087('0x34')],_0x14439f['query']);_0x52c650[_0xe087('0x39')]=_[_0xe087('0x38')](_0x14439f[_0xe087('0x34')],qs[_0xe087('0x4a')](_0x5ee36d[_0xe087('0x35')][_0xe087('0x4a')]));_0x52c650['attributes']=_0x52c650[_0xe087('0x39')][_0xe087('0x3a')]?_0x52c650[_0xe087('0x39')]:_0x14439f[_0xe087('0x34')];if(!_0x5ee36d[_0xe087('0x35')]['hasOwnProperty'](_0xe087('0x5a'))){_0x52c650[_0xe087('0x1f')]=qs[_0xe087('0x1f')](_0x5ee36d[_0xe087('0x35')]['limit']);_0x52c650[_0xe087('0x1d')]=qs[_0xe087('0x1d')](_0x5ee36d[_0xe087('0x35')][_0xe087('0x1d')]);}_0x52c650[_0xe087('0x3c')]=qs['sort'](_0x5ee36d[_0xe087('0x35')][_0xe087('0x3d')]);_0x52c650[_0xe087('0x3e')]=qs['filters'](_[_0xe087('0x3f')](_0x5ee36d[_0xe087('0x35')],_0x14439f[_0xe087('0x37')]));_0x52c650[_0xe087('0x6c')]=!![];if(_0x5ee36d['query'][_0xe087('0x40')]){_0x52c650[_0xe087('0x3e')]=_[_0xe087('0x43')](_0x52c650[_0xe087('0x3e')],{'$or':_[_0xe087('0x2f')](_0x52c650[_0xe087('0x39')],function(_0x43b12a){var _0x36833d={};_0x36833d[_0x43b12a]={'$like':'%'+_0x5ee36d[_0xe087('0x35')]['filter']+'%'};return _0x36833d;})});}_0x52c650=_[_0xe087('0x43')]({},_0x52c650,_0x5ee36d['options']);return _0x165a8a[_0xe087('0x68')](_0x52c650);}})['then'](function(_0x146398){if(!_[_0xe087('0x71')](_0x146398)){var _0xaeefee=toCsv(_0x146398);var _0x38cbae=Date[_0xe087('0x72')]();fs[_0xe087('0x73')](util['format'](_0xe087('0x74'),_0x165a8a['id'],_0x38cbae),_0xaeefee);_0xf71d8[_0xe087('0x75')](_0xe087('0x76'),'attachment;\x20filename='+util[_0xe087('0x70')](_0xe087('0x77'),_0x165a8a['id'],_0x38cbae));_0xf71d8[_0xe087('0x75')](_0xe087('0x78'),_0xe087('0x79'));return _0xf71d8['download'](util[_0xe087('0x70')](_0xe087('0x74'),_0x165a8a['id'],_0x38cbae));}else{return _0xf71d8['sendStatus'](0xcc);}})[_0xe087('0x47')](handleError(_0xf71d8,null));};exports[_0xe087('0x7a')]=function(_0x31941a,_0x250b0,_0x2611a7){var _0x147310;delete _0x31941a['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x31941a['params']['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x250b0,null))[_0xe087('0x27')](function(_0x163e38){if(_0x163e38){return db[_0xe087('0x7b')][_0xe087('0x7c')](function(_0x2fde85){return db[_0xe087('0x6f')][_0xe087('0x4c')](_0x31941a[_0xe087('0x54')],{'transaction':_0x2fde85})[_0xe087('0x27')](function(_0x402e95){_0x147310=_0x402e95;return _0x163e38[_0xe087('0x7d')](_0x402e95,{'transaction':_0x2fde85});})[_0xe087('0x27')](function(){var _0x2c3a2c={'type':db[_0xe087('0x7e')][_0xe087('0x7f')],'transaction':_0x2fde85};switch(_0x31941a[_0xe087('0x54')][_0xe087('0x32')]){case'text':_0x2c3a2c[_0xe087('0x32')]=db[_0xe087('0x7e')][_0xe087('0x7f')];break;case'number':_0x2c3a2c[_0xe087('0x32')]=db[_0xe087('0x7e')][_0xe087('0x80')];break;case _0xe087('0x81'):_0x2c3a2c[_0xe087('0x32')]=db[_0xe087('0x7e')][_0xe087('0x82')];_0x2c3a2c['defaultValue']=![];break;default:}return db['sequelize'][_0xe087('0x83')]['addColumn']('cm_contacts',util[_0xe087('0x70')](_0xe087('0x84'),_0x147310['id']),_0x2c3a2c);})[_0xe087('0x27')](function(){return _0x147310;});});}})[_0xe087('0x27')](respondWithResult(_0x250b0,null))[_0xe087('0x47')](handleError(_0x250b0,null));};exports[_0xe087('0x85')]=function(_0x1f0647,_0x4078bb,_0x413bfd){var _0x18a8af={};var _0xe55c18={};var _0x4a3246;var _0x549af7;return db[_0xe087('0x30')][_0xe087('0x58')]({'where':{'id':_0x1f0647[_0xe087('0x49')]['id']}})['then'](handleEntityNotFound(_0x4078bb,null))[_0xe087('0x27')](function(_0x4f546d){if(_0x4f546d){_0x4a3246=_0x4f546d;_0xe55c18[_0xe087('0x34')]=_[_0xe087('0x36')](db[_0xe087('0x6f')]['rawAttributes']);_0xe55c18['query']=_['keys'](_0x1f0647[_0xe087('0x35')]);_0xe55c18['filters']=_['intersection'](_0xe55c18['model'],_0xe55c18[_0xe087('0x35')]);_0x18a8af[_0xe087('0x39')]=_[_0xe087('0x38')](_0xe55c18[_0xe087('0x34')],qs[_0xe087('0x4a')](_0x1f0647[_0xe087('0x35')][_0xe087('0x4a')]));_0x18a8af[_0xe087('0x39')]=_0x18a8af[_0xe087('0x39')][_0xe087('0x3a')]?_0x18a8af['attributes']:_0xe55c18[_0xe087('0x34')];_0x18a8af[_0xe087('0x3c')]=qs[_0xe087('0x3d')](_0x1f0647['query'][_0xe087('0x3d')]);_0x18a8af[_0xe087('0x3e')]=qs[_0xe087('0x37')](_['pick'](_0x1f0647[_0xe087('0x35')],_0xe55c18['filters']));_0x18a8af[_0xe087('0x3e')]=_[_0xe087('0x43')](_0x18a8af['where'],{'$or':[{'ListId':_0x4f546d['id']},{'ListId':null}]});if(_0x1f0647[_0xe087('0x35')][_0xe087('0x40')]){_0x18a8af['where']=_[_0xe087('0x43')](_0x18a8af[_0xe087('0x3e')],{'$or':_['map'](_0x18a8af['attributes'],function(_0x365b34){var _0x2a4b42={};_0x2a4b42[_0x365b34]={'$like':'%'+_0x1f0647[_0xe087('0x35')][_0xe087('0x40')]+'%'};return _0x2a4b42;})});}_0x18a8af=_[_0xe087('0x43')]({},_0x18a8af,_0x1f0647[_0xe087('0x6d')]);return db[_0xe087('0x6f')][_0xe087('0x86')](_0x18a8af);}})[_0xe087('0x27')](respondWithResult(_0x4078bb,null))[_0xe087('0x47')](handleError(_0x4078bb,null));};exports[_0xe087('0x87')]=function(_0x475156,_0x101e22,_0x3407bf){return db[_0xe087('0x30')][_0xe087('0x4b')]({'where':{'id':_0x475156[_0xe087('0x49')]['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x101e22,null))[_0xe087('0x27')](function(_0x5c8bb0){if(_0x5c8bb0){return _0x5c8bb0[_0xe087('0x87')](_0x475156[_0xe087('0x54')]['ids'],_['omit'](_0x475156[_0xe087('0x54')],[_0xe087('0x63'),'id'])||{})[_0xe087('0x88')](function(_0xf9b7e5){for(var _0x35554b=0x0;_0x35554b<_0x475156[_0xe087('0x54')][_0xe087('0x63')][_0xe087('0x3a')];_0x35554b+=0x1){socket[_0xe087('0x89')]('userCmList:save',{'UserId':Number(_0x475156[_0xe087('0x54')]['ids'][_0x35554b]),'CmListId':Number(_0x475156[_0xe087('0x49')]['id'])});}return _0xf9b7e5;});}})[_0xe087('0x27')](respondWithResult(_0x101e22,null))[_0xe087('0x47')](handleError(_0x101e22,null));};exports[_0xe087('0x8a')]=function(_0x2e66ff,_0x3fcd81,_0x1e8d3b){return db[_0xe087('0x30')][_0xe087('0x4b')]({'where':{'id':_0x2e66ff[_0xe087('0x49')]['id']}})[_0xe087('0x27')](handleEntityNotFound(_0x3fcd81,null))[_0xe087('0x27')](function(_0x5a42ea){if(_0x5a42ea){return _0x5a42ea[_0xe087('0x8a')](_0x2e66ff['query'][_0xe087('0x63')])[_0xe087('0x27')](function(){if(_[_0xe087('0x5e')](_0x2e66ff['query'][_0xe087('0x63')])){for(var _0x2f42df=0x0;_0x2f42df<_0x2e66ff[_0xe087('0x35')][_0xe087('0x63')][_0xe087('0x3a')];_0x2f42df+=0x1){socket[_0xe087('0x89')]('userCmList:remove',{'UserId':Number(_0x2e66ff['query'][_0xe087('0x63')][_0x2f42df]),'CmListId':Number(_0x2e66ff[_0xe087('0x49')]['id'])});}}else{socket[_0xe087('0x89')]('userCmList:remove',{'UserId':Number(_0x2e66ff[_0xe087('0x35')][_0xe087('0x63')]),'CmListId':Number(_0x2e66ff['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3fcd81,null))['catch'](handleError(_0x3fcd81,null));};exports['getAgents']=function(_0x2ebdc3,_0xff75,_0x5a44dd){var _0x46f304={};var _0x50f13c={};var _0x3591e8;var _0x3c499a;return db['CmList'][_0xe087('0x58')]({'where':{'id':_0x2ebdc3[_0xe087('0x49')]['id']}})[_0xe087('0x27')](handleEntityNotFound(_0xff75,null))[_0xe087('0x27')](function(_0x5f49c7){if(_0x5f49c7){_0x3591e8=_0x5f49c7;_0x50f13c['model']=_[_0xe087('0x36')](db[_0xe087('0x8b')][_0xe087('0x31')]);_0x50f13c['query']=_['keys'](_0x2ebdc3['query']);_0x50f13c[_0xe087('0x37')]=_[_0xe087('0x38')](_0x50f13c[_0xe087('0x34')],_0x50f13c['query']);_0x46f304[_0xe087('0x39')]=_[_0xe087('0x38')](_0x50f13c[_0xe087('0x34')],qs[_0xe087('0x4a')](_0x2ebdc3[_0xe087('0x35')][_0xe087('0x4a')]));_0x46f304['attributes']=_0x46f304[_0xe087('0x39')][_0xe087('0x3a')]?_0x46f304[_0xe087('0x39')]:_0x50f13c[_0xe087('0x34')];_0x46f304['order']=qs[_0xe087('0x3d')](_0x2ebdc3[_0xe087('0x35')][_0xe087('0x3d')]);_0x46f304[_0xe087('0x3e')]=qs[_0xe087('0x37')](_[_0xe087('0x3f')](_0x2ebdc3['query'],_0x50f13c[_0xe087('0x37')]));if(_0x2ebdc3[_0xe087('0x35')][_0xe087('0x40')]){_0x46f304['where']=_['merge'](_0x46f304['where'],{'$or':_[_0xe087('0x2f')](_0x46f304[_0xe087('0x39')],function(_0x487615){var _0x370b5a={};_0x370b5a[_0x487615]={'$like':'%'+_0x2ebdc3[_0xe087('0x35')]['filter']+'%'};return _0x370b5a;})});}_0x46f304=_['merge']({},_0x46f304,_0x2ebdc3['options']);return _0x3591e8['getAgents'](_0x46f304);}})[_0xe087('0x27')](function(_0x3bdb3f){if(_0x3bdb3f){_0x3c499a=_0x3bdb3f[_0xe087('0x3a')];if(!_0x2ebdc3[_0xe087('0x35')][_0xe087('0x3b')](_0xe087('0x5a'))){_0x46f304[_0xe087('0x1f')]=qs['limit'](_0x2ebdc3[_0xe087('0x35')][_0xe087('0x1f')]);_0x46f304['offset']=qs[_0xe087('0x1d')](_0x2ebdc3[_0xe087('0x35')]['offset']);}return _0x3591e8[_0xe087('0x8c')](_0x46f304);}})['then'](function(_0x580262){if(_0x580262){return _0x580262?{'count':_0x3c499a,'rows':_0x580262}:null;}})[_0xe087('0x27')](respondWithResult(_0xff75,null))['catch'](handleError(_0xff75,null));}; \ No newline at end of file +var _0xd5bb=['defaults','redis','./cmList.socket','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','get','Lists','destroy','end','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','removeDispositions','addContacts','tags','isArray','join','push','CmContact','omit','errors','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','type','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findOne','findAndCountAll','addAgents','ids','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb'];(function(_0x496a7e,_0x11537e){var _0xb10022=function(_0x304389){while(--_0x304389){_0x496a7e['push'](_0x496a7e['shift']());}};_0xb10022(++_0x11537e);}(_0xd5bb,0x73));var _0xbd5b=function(_0xfc23ed,_0x5d7148){_0xfc23ed=_0xfc23ed-0x0;var _0x58d8aa=_0xd5bb[_0xfc23ed];return _0x58d8aa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd5b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd5b('0x1'));var moment=require(_0xbd5b('0x2'));var BPromise=require(_0xbd5b('0x3'));var Mustache=require(_0xbd5b('0x4'));var util=require('util');var path=require(_0xbd5b('0x5'));var sox=require(_0xbd5b('0x6'));var csv=require(_0xbd5b('0x7'));var ejs=require(_0xbd5b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbd5b('0x9'));var crypto=require(_0xbd5b('0xa'));var jsforce=require(_0xbd5b('0xb'));var deskjs=require(_0xbd5b('0xc'));var toCsv=require(_0xbd5b('0x7'));var querystring=require(_0xbd5b('0xd'));var Papa=require('papaparse');var Redis=require(_0xbd5b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbd5b('0xf'));var as=require(_0xbd5b('0x10'));var hardwareService=require(_0xbd5b('0x11'));var logger=require(_0xbd5b('0x12'))(_0xbd5b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbd5b('0x14'))['db'];config['redis']=_[_0xbd5b('0x15')](config[_0xbd5b('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd5b('0x16')]));require(_0xbd5b('0x17'))['register'](socket);function respondWithStatusCode(_0x3da069,_0x43c180){_0x43c180=_0x43c180||0xcc;return function(_0x31b37a){if(_0x31b37a){return _0x3da069[_0xbd5b('0x18')](_0x43c180);}return _0x3da069[_0xbd5b('0x19')](_0x43c180)['end']();};}function respondWithResult(_0x2e120d,_0x31c7e9){_0x31c7e9=_0x31c7e9||0xc8;return function(_0x55a147){if(_0x55a147){return _0x2e120d['status'](_0x31c7e9)[_0xbd5b('0x1a')](_0x55a147);}};}function respondWithFilteredResult(_0x978d8e,_0x2bd29f){return function(_0x48781a){if(_0x48781a){var _0x3d194f=typeof _0x2bd29f['offset']===_0xbd5b('0x1b')&&typeof _0x2bd29f[_0xbd5b('0x1c')]===_0xbd5b('0x1b');var _0x14e3e0=_0x48781a['count'];var _0x2ac9b4=_0x3d194f?0x0:_0x2bd29f[_0xbd5b('0x1d')];var _0x489c24=_0x3d194f?_0x48781a[_0xbd5b('0x1e')]:_0x2bd29f['offset']+_0x2bd29f['limit'];var _0x2a4cd1;if(_0x489c24>=_0x14e3e0){_0x489c24=_0x14e3e0;_0x2a4cd1=0xc8;}else{_0x2a4cd1=0xce;}_0x978d8e['status'](_0x2a4cd1);return _0x978d8e[_0xbd5b('0x1f')](_0xbd5b('0x20'),_0x2ac9b4+'-'+_0x489c24+'/'+_0x14e3e0)['json'](_0x48781a);}return null;};}function patchUpdates(_0x27e386){return function(_0xa2920e){try{jsonpatch[_0xbd5b('0x21')](_0xa2920e,_0x27e386,!![]);}catch(_0x27fbd0){return BPromise['reject'](_0x27fbd0);}return _0xa2920e[_0xbd5b('0x22')]();};}function saveUpdates(_0x4804dd,_0x1f2df6){return function(_0x245265){if(_0x245265){return _0x245265[_0xbd5b('0x23')](_0x4804dd)[_0xbd5b('0x24')](function(_0x3b40a1){return _0x3b40a1;});}return null;};}function removeEntity(_0x16b381,_0x2927d6){return function(_0x25daf9){if(_0x25daf9){return _0x25daf9['destroy']()['then'](function(){var _0x3f6240=_0x25daf9[_0xbd5b('0x25')]({'plain':!![]});var _0x340bd4=_0xbd5b('0x26');return db['UserProfileResource'][_0xbd5b('0x27')]({'where':{'type':_0x340bd4,'resourceId':_0x3f6240['id']}})[_0xbd5b('0x24')](function(){return _0x25daf9;});})[_0xbd5b('0x24')](function(){_0x16b381[_0xbd5b('0x19')](0xcc)[_0xbd5b('0x28')]();});}};}function handleEntityNotFound(_0x22a981,_0x31d1e6){return function(_0x53efb5){if(!_0x53efb5){_0x22a981[_0xbd5b('0x18')](0x194);}return _0x53efb5;};}function handleError(_0x102951,_0x5c9163){_0x5c9163=_0x5c9163||0x1f4;return function(_0x4895aa){logger['error'](_0x4895aa[_0xbd5b('0x29')]);if(_0x4895aa['name']){delete _0x4895aa[_0xbd5b('0x2a')];}_0x102951[_0xbd5b('0x19')](_0x5c9163)[_0xbd5b('0x2b')](_0x4895aa);};}exports[_0xbd5b('0x2c')]=function(_0x27b27a,_0x44cbdd){var _0x8eded2={},_0x215dc8={},_0x468571={'count':0x0,'rows':[]};var _0x19017b=_[_0xbd5b('0x2d')](db[_0xbd5b('0x2e')][_0xbd5b('0x2f')],function(_0x4f2d2f){return{'name':_0x4f2d2f[_0xbd5b('0x30')],'type':_0x4f2d2f['type'][_0xbd5b('0x31')]};});_0x215dc8[_0xbd5b('0x32')]=_[_0xbd5b('0x2d')](_0x19017b,_0xbd5b('0x2a'));_0x215dc8[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x27b27a[_0xbd5b('0x33')]);_0x215dc8[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x215dc8[_0xbd5b('0x32')],_0x215dc8[_0xbd5b('0x33')]);_0x8eded2[_0xbd5b('0x37')]=_[_0xbd5b('0x36')](_0x215dc8[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x27b27a['query'][_0xbd5b('0x38')]));_0x8eded2[_0xbd5b('0x37')]=_0x8eded2['attributes'][_0xbd5b('0x39')]?_0x8eded2[_0xbd5b('0x37')]:_0x215dc8[_0xbd5b('0x32')];if(!_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x3a')](_0xbd5b('0x3b'))){_0x8eded2[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x1c')]);_0x8eded2[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}_0x8eded2[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x27b27a['query'][_0xbd5b('0x3d')]);_0x8eded2[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x27b27a[_0xbd5b('0x33')],_0x215dc8[_0xbd5b('0x35')]),_0x19017b);if(_0x27b27a['query']['filter']){_0x8eded2[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x8eded2['where'],{'$or':_[_0xbd5b('0x2d')](_0x19017b,function(_0x486c61){if(_0x486c61['type']!==_0xbd5b('0x41')){var _0x19e08c={};_0x19e08c[_0x486c61[_0xbd5b('0x2a')]]={'$like':'%'+_0x27b27a['query'][_0xbd5b('0x42')]+'%'};return _0x19e08c;}})});}_0x8eded2=_[_0xbd5b('0x40')]({},_0x8eded2,_0x27b27a[_0xbd5b('0x43')]);var _0x1c96eb={'where':_0x8eded2[_0xbd5b('0x3e')]};return db[_0xbd5b('0x2e')][_0xbd5b('0x1e')](_0x1c96eb)[_0xbd5b('0x24')](function(_0x5a4021){_0x468571['count']=_0x5a4021;if(_0x27b27a[_0xbd5b('0x33')][_0xbd5b('0x44')]){_0x8eded2[_0xbd5b('0x45')]=[{'all':!![]}];}return db[_0xbd5b('0x2e')]['findAll'](_0x8eded2);})['then'](function(_0xa847a5){_0x468571[_0xbd5b('0x46')]=_0xa847a5;return _0x468571;})[_0xbd5b('0x24')](respondWithFilteredResult(_0x44cbdd,_0x8eded2))['catch'](handleError(_0x44cbdd,null));};exports[_0xbd5b('0x47')]=function(_0x2f08e7,_0x5ee595){var _0x419c64={'raw':![],'where':{'id':_0x2f08e7[_0xbd5b('0x48')]['id']}},_0x15268e={};_0x15268e['model']=_[_0xbd5b('0x34')](db[_0xbd5b('0x2e')][_0xbd5b('0x2f')]);_0x15268e[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x2f08e7[_0xbd5b('0x33')]);_0x15268e[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x15268e[_0xbd5b('0x32')],_0x15268e['query']);_0x419c64['attributes']=_[_0xbd5b('0x36')](_0x15268e[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x2f08e7[_0xbd5b('0x33')]['fields']));_0x419c64[_0xbd5b('0x37')]=_0x419c64[_0xbd5b('0x37')]['length']?_0x419c64['attributes']:_0x15268e[_0xbd5b('0x32')];if(_0x2f08e7[_0xbd5b('0x33')]['includeAll']){_0x419c64[_0xbd5b('0x45')]=[{'all':!![]}];}_0x419c64=_[_0xbd5b('0x40')]({},_0x419c64,_0x2f08e7[_0xbd5b('0x43')]);return db['CmList'][_0xbd5b('0x49')](_0x419c64)[_0xbd5b('0x24')](handleEntityNotFound(_0x5ee595,null))[_0xbd5b('0x24')](respondWithResult(_0x5ee595,null))[_0xbd5b('0x4a')](handleError(_0x5ee595,null));};exports['create']=function(_0x2fac26,_0x2b8abe){return db[_0xbd5b('0x2e')][_0xbd5b('0x4b')](_0x2fac26[_0xbd5b('0x4c')],{})['then'](function(_0x230ea6){var _0x2fa6a1=_0x2fac26['user'][_0xbd5b('0x25')]({'plain':!![]});if(!_0x2fa6a1)throw new Error(_0xbd5b('0x4d'));if(_0x2fa6a1['role']==='user'){var _0x1fa862=_0x230ea6['get']({'plain':!![]});var _0x4f2002=_0xbd5b('0x26');return db['UserProfileSection'][_0xbd5b('0x49')]({'where':{'name':_0x4f2002,'userProfileId':_0x2fa6a1[_0xbd5b('0x4e')]},'raw':!![]})[_0xbd5b('0x24')](function(_0x3066f2){if(_0x3066f2&&_0x3066f2['autoAssociation']===0x0){return db[_0xbd5b('0x4f')]['create']({'name':_0x1fa862['name'],'resourceId':_0x1fa862['id'],'type':_0x3066f2[_0xbd5b('0x2a')],'sectionId':_0x3066f2['id']},{})['then'](function(){return _0x230ea6;});}else{return _0x230ea6;}})[_0xbd5b('0x4a')](function(_0x5efa76){logger[_0xbd5b('0x50')](_0xbd5b('0x51'),_0x5efa76);throw _0x5efa76;});}return _0x230ea6;})[_0xbd5b('0x24')](respondWithResult(_0x2b8abe,0xc9))[_0xbd5b('0x4a')](handleError(_0x2b8abe,null));};exports[_0xbd5b('0x23')]=function(_0x3cee50,_0x397299){if(_0x3cee50['body']['id']){delete _0x3cee50[_0xbd5b('0x4c')]['id'];}return db[_0xbd5b('0x2e')][_0xbd5b('0x49')]({'where':{'id':_0x3cee50[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x397299,null))['then'](saveUpdates(_0x3cee50[_0xbd5b('0x4c')],null))[_0xbd5b('0x24')](respondWithResult(_0x397299,null))[_0xbd5b('0x4a')](handleError(_0x397299,null));};exports[_0xbd5b('0x27')]=function(_0x4ec826,_0x576186){return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x4ec826[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x576186,null))[_0xbd5b('0x24')](removeEntity(_0x576186,null))[_0xbd5b('0x4a')](handleError(_0x576186,null));};exports['describe']=function(_0x3a443,_0x5c74e1){return db['CmList'][_0xbd5b('0x52')]()[_0xbd5b('0x24')](respondWithResult(_0x5c74e1,null))[_0xbd5b('0x4a')](handleError(_0x5c74e1,null));};exports[_0xbd5b('0x53')]=function(_0x5ba753,_0x4fbd89,_0x24f253){if(_0x5ba753[_0xbd5b('0x4c')]['id']){delete _0x5ba753[_0xbd5b('0x4c')]['id'];}return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x5ba753[_0xbd5b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fbd89,null))[_0xbd5b('0x24')](function(_0x25589b){if(_0x25589b){_0x5ba753[_0xbd5b('0x4c')][_0xbd5b('0x54')]=_0x25589b['id'];return db[_0xbd5b('0x55')][_0xbd5b('0x4b')](_0x5ba753[_0xbd5b('0x4c')]);}})[_0xbd5b('0x24')](respondWithResult(_0x4fbd89,null))[_0xbd5b('0x4a')](handleError(_0x4fbd89,null));};exports['getDispositions']=function(_0x479af1,_0x3f170e,_0x3c8da6){var _0x30c9b1={'raw':![],'where':{}};var _0x39f16f={};var _0x51724b={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x479af1[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x3f170e,null))[_0xbd5b('0x24')](function(_0x26b2e7){if(_0x26b2e7){_0x39f16f[_0xbd5b('0x32')]=_['keys'](db['Disposition']['rawAttributes']);_0x39f16f[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x479af1[_0xbd5b('0x33')]);_0x39f16f[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x39f16f[_0xbd5b('0x32')],_0x39f16f[_0xbd5b('0x33')]);_0x30c9b1[_0xbd5b('0x37')]=_[_0xbd5b('0x36')](_0x39f16f[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x38')]));_0x30c9b1['attributes']=_0x30c9b1[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x30c9b1[_0xbd5b('0x37')]:_0x39f16f[_0xbd5b('0x32')];if(!_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x3a')](_0xbd5b('0x3b'))){_0x30c9b1['limit']=qs['limit'](_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x1c')]);_0x30c9b1['offset']=qs[_0xbd5b('0x1d')](_0x479af1['query'][_0xbd5b('0x1d')]);}_0x30c9b1[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x479af1[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x30c9b1[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x479af1['query'],_0x39f16f[_0xbd5b('0x35')]));_0x30c9b1[_0xbd5b('0x3e')]['ListId']=_0x26b2e7['id'];if(_0x479af1['query'][_0xbd5b('0x42')]){_0x30c9b1[_0xbd5b('0x3e')]=_['merge'](_0x30c9b1['where'],{'$or':_[_0xbd5b('0x2d')](_0x30c9b1[_0xbd5b('0x37')],function(_0x47a6d4){var _0x292c3c={};_0x292c3c[_0x47a6d4]={'$like':'%'+_0x479af1['query']['filter']+'%'};return _0x292c3c;})});}_0x30c9b1=_[_0xbd5b('0x40')]({},_0x30c9b1,_0x479af1[_0xbd5b('0x43')]);return db[_0xbd5b('0x55')][_0xbd5b('0x1e')]({'where':_0x30c9b1[_0xbd5b('0x3e')]})[_0xbd5b('0x24')](function(_0x4affc1){_0x51724b[_0xbd5b('0x1e')]=_0x4affc1;if(_0x479af1['query'][_0xbd5b('0x44')]){_0x30c9b1[_0xbd5b('0x45')]=[{'all':!![]}];}return db[_0xbd5b('0x55')]['findAll'](_0x30c9b1);})['then'](function(_0x47b433){_0x51724b[_0xbd5b('0x46')]=_0x47b433;return _0x51724b;});}})['then'](respondWithFilteredResult(_0x3f170e,_0x30c9b1))['catch'](handleError(_0x3f170e,null));};exports[_0xbd5b('0x56')]=function(_0x4de281,_0x55c376,_0x40f1ad){return db[_0xbd5b('0x2e')][_0xbd5b('0x49')]({'where':{'id':_0x4de281['params']['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x55c376,null))['then'](function(_0xb578f5){if(_0xb578f5){return _0xb578f5['removeDispositions'](_0x4de281[_0xbd5b('0x33')]['ids']);}})['then'](respondWithStatusCode(_0x55c376,null))[_0xbd5b('0x4a')](handleError(_0x55c376,null));};exports[_0xbd5b('0x57')]=function(_0x3463b3,_0x1d0b79,_0x5d3586){return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x3463b3[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x1d0b79,null))[_0xbd5b('0x24')](function(_0x591ebf){if(_0x591ebf){var _0x27cc2a=[];var _0x33f505={'success':[],'errors':[]};return db['CmContact'][_0xbd5b('0x52')]()[_0xbd5b('0x24')](function(_0x542d0e){if(_0x3463b3['body'][_0xbd5b('0x58')]&&_[_0xbd5b('0x59')](_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')])){if(_0x3463b3['body'][_0xbd5b('0x58')]['length']){_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')]=_0x3463b3[_0xbd5b('0x4c')]['tags'][_0xbd5b('0x5a')](';')+';';}else{_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')]=null;}}else{_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x58')]=null;}if(_0x3463b3[_0xbd5b('0x4c')]&&_[_0xbd5b('0x59')](_0x3463b3[_0xbd5b('0x4c')])){for(var _0x27a9f6=0x0;_0x27a9f6<_0x3463b3[_0xbd5b('0x4c')][_0xbd5b('0x39')];_0x27a9f6+=0x1){_0x3463b3[_0xbd5b('0x4c')][_0x27a9f6][_0xbd5b('0x54')]=_0x3463b3[_0xbd5b('0x48')]['id'];_0x27cc2a[_0xbd5b('0x5b')](_0x3463b3[_0xbd5b('0x4c')][_0x27a9f6]);}return BPromise['each'](_0x27cc2a,function(_0x4a6e7b){return db[_0xbd5b('0x5c')]['create'](_[_0xbd5b('0x5d')](_0x4a6e7b,['ids','id'])||{},{'fields':_['keys'](_0x542d0e),'raw':!![]})['then'](function(_0x191a0c){_0x33f505['success'][_0xbd5b('0x5b')](_0x191a0c['dataValues']);})['catch'](function(_0x44806b){_0x33f505[_0xbd5b('0x5e')][_0xbd5b('0x5b')]({'data':_0x4a6e7b,'error':_0x44806b['message']});});})[_0xbd5b('0x24')](function(_0x51be36){return _0x33f505;})[_0xbd5b('0x4a')](function(_0x5dde7f){return _0x5dde7f;});}else{_0x1d0b79[_0xbd5b('0x19')](0x190)[_0xbd5b('0x1a')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xbd5b('0x24')](respondWithResult(_0x1d0b79,null))[_0xbd5b('0x4a')](handleError(_0x1d0b79,null));};exports['getContacts']=function(_0x219454,_0x4a46c2,_0x371ed2){var _0xb971af;return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x219454[_0xbd5b('0x48')]['id']},'include':[{'model':db[_0xbd5b('0x5f')],'as':_0xbd5b('0x60')}]})['then'](handleEntityNotFound(_0x4a46c2,null))[_0xbd5b('0x24')](function(_0x4d703b){if(_0x4d703b){_0xb971af=_0x4d703b;return db[_0xbd5b('0x5c')][_0xbd5b('0x2f')];}})['then'](function(_0x9ed40e){if(_0x9ed40e){var _0x1224a6={};var _0x11e7f9={};_0x11e7f9[_0xbd5b('0x32')]=_[_0xbd5b('0x61')](_[_0xbd5b('0x34')](_0x9ed40e),_[_0xbd5b('0x2d')](_0xb971af['CustomFields'],function(_0xd992f1){return util[_0xbd5b('0x62')](_0xbd5b('0x63'),_0xd992f1['id']);}));_0x11e7f9[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x219454[_0xbd5b('0x33')]);_0x11e7f9[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x11e7f9[_0xbd5b('0x32')],_0x11e7f9[_0xbd5b('0x33')]);_0x1224a6['attributes']=_[_0xbd5b('0x36')](_0x11e7f9[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x219454[_0xbd5b('0x33')][_0xbd5b('0x38')]));_0x1224a6[_0xbd5b('0x37')]=_0x1224a6[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x1224a6[_0xbd5b('0x37')]:_0x11e7f9['model'];if(!_0x219454['query']['hasOwnProperty'](_0xbd5b('0x3b'))){_0x1224a6[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x219454[_0xbd5b('0x33')]['limit']);_0x1224a6[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x219454[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}_0x1224a6[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x219454[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x1224a6[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x219454[_0xbd5b('0x33')],_0x11e7f9[_0xbd5b('0x35')]));_0x1224a6[_0xbd5b('0x64')]=!![];if(_0x219454[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x1224a6['where']=_[_0xbd5b('0x40')](_0x1224a6['where'],{'$or':_['map'](_0x1224a6[_0xbd5b('0x37')],function(_0x19638d){var _0x3a6445={};_0x3a6445[_0x19638d]={'$like':'%'+_0x219454[_0xbd5b('0x33')]['filter']+'%'};return _0x3a6445;})});}_0x1224a6=_[_0xbd5b('0x40')]({},_0x1224a6,_0x219454[_0xbd5b('0x43')]);return _0xb971af[_0xbd5b('0x65')](_0x1224a6);}})[_0xbd5b('0x24')](respondWithResult(_0x4a46c2,null))[_0xbd5b('0x4a')](handleError(_0x4a46c2,null));};exports['getContactsCsv']=function(_0x3d105b,_0x4df20e,_0x5a9891){var _0x48531d;return db['CmList'][_0xbd5b('0x49')]({'where':{'id':_0x3d105b[_0xbd5b('0x48')]['id']},'include':[{'model':db[_0xbd5b('0x5f')],'as':'CustomFields'}]})[_0xbd5b('0x24')](handleEntityNotFound(_0x4df20e,null))['then'](function(_0x228e7a){if(_0x228e7a){_0x48531d=_0x228e7a;return db[_0xbd5b('0x5c')][_0xbd5b('0x2f')];}})[_0xbd5b('0x24')](function(_0x2e57aa){if(_0x2e57aa){var _0x34fd45={};var _0x591463={};_0x591463['model']=_['concat'](_[_0xbd5b('0x34')](_0x2e57aa),_[_0xbd5b('0x2d')](_0x48531d[_0xbd5b('0x60')],function(_0x4a4555){return util[_0xbd5b('0x62')](_0xbd5b('0x63'),_0x4a4555['id']);}));_0x591463[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x3d105b[_0xbd5b('0x33')]);_0x591463[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x591463[_0xbd5b('0x32')],_0x591463[_0xbd5b('0x33')]);_0x34fd45[_0xbd5b('0x37')]=_[_0xbd5b('0x36')](_0x591463[_0xbd5b('0x32')],qs['fields'](_0x3d105b[_0xbd5b('0x33')]['fields']));_0x34fd45[_0xbd5b('0x37')]=_0x34fd45[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x34fd45[_0xbd5b('0x37')]:_0x591463[_0xbd5b('0x32')];if(!_0x3d105b[_0xbd5b('0x33')]['hasOwnProperty'](_0xbd5b('0x3b'))){_0x34fd45[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x1c')]);_0x34fd45[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}_0x34fd45[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x34fd45['where']=qs[_0xbd5b('0x35')](_['pick'](_0x3d105b['query'],_0x591463['filters']));_0x34fd45['raw']=!![];if(_0x3d105b[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x34fd45[_0xbd5b('0x3e')]=_['merge'](_0x34fd45[_0xbd5b('0x3e')],{'$or':_[_0xbd5b('0x2d')](_0x34fd45[_0xbd5b('0x37')],function(_0xc1cde2){var _0xf43d5e={};_0xf43d5e[_0xc1cde2]={'$like':'%'+_0x3d105b['query'][_0xbd5b('0x42')]+'%'};return _0xf43d5e;})});}_0x34fd45=_[_0xbd5b('0x40')]({},_0x34fd45,_0x3d105b[_0xbd5b('0x43')]);return _0x48531d['getContacts'](_0x34fd45);}})[_0xbd5b('0x24')](function(_0x482aae){if(!_[_0xbd5b('0x66')](_0x482aae)){var _0x2f1b52=toCsv(_0x482aae);var _0x52f1d7=Date['now']();fs['writeFileSync'](util[_0xbd5b('0x62')](_0xbd5b('0x67'),_0x48531d['id'],_0x52f1d7),_0x2f1b52);_0x4df20e[_0xbd5b('0x68')](_0xbd5b('0x69'),_0xbd5b('0x6a')+util['format'](_0xbd5b('0x6b'),_0x48531d['id'],_0x52f1d7));_0x4df20e['setHeader']('Content-type',_0xbd5b('0x6c'));return _0x4df20e[_0xbd5b('0x6d')](util[_0xbd5b('0x62')](_0xbd5b('0x67'),_0x48531d['id'],_0x52f1d7));}else{return _0x4df20e[_0xbd5b('0x18')](0xcc);}})[_0xbd5b('0x4a')](handleError(_0x4df20e,null));};exports[_0xbd5b('0x6e')]=function(_0x5ba480,_0x5bc59d,_0x444783){var _0x569839;delete _0x5ba480['body']['id'];return db['CmList']['findOne']({'where':{'id':_0x5ba480[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x5bc59d,null))[_0xbd5b('0x24')](function(_0x5d66b5){if(_0x5d66b5){return db[_0xbd5b('0x6f')][_0xbd5b('0x70')](function(_0x270487){return db['CmCustomField'][_0xbd5b('0x4b')](_0x5ba480[_0xbd5b('0x4c')],{'transaction':_0x270487})['then'](function(_0x4d73ac){_0x569839=_0x4d73ac;return _0x5d66b5[_0xbd5b('0x71')](_0x4d73ac,{'transaction':_0x270487});})[_0xbd5b('0x24')](function(){var _0x38a2be={'type':db['Sequelize'][_0xbd5b('0x72')],'transaction':_0x270487};switch(_0x5ba480[_0xbd5b('0x4c')][_0xbd5b('0x73')]){case'text':_0x38a2be['type']=db[_0xbd5b('0x74')][_0xbd5b('0x72')];break;case _0xbd5b('0x75'):_0x38a2be['type']=db[_0xbd5b('0x74')][_0xbd5b('0x76')];break;case _0xbd5b('0x77'):_0x38a2be['type']=db[_0xbd5b('0x74')][_0xbd5b('0x78')];_0x38a2be[_0xbd5b('0x79')]=![];break;default:}return db[_0xbd5b('0x6f')][_0xbd5b('0x7a')][_0xbd5b('0x7b')](_0xbd5b('0x7c'),util[_0xbd5b('0x62')]('cf_%s',_0x569839['id']),_0x38a2be);})[_0xbd5b('0x24')](function(){return _0x569839;});});}})[_0xbd5b('0x24')](respondWithResult(_0x5bc59d,null))[_0xbd5b('0x4a')](handleError(_0x5bc59d,null));};exports[_0xbd5b('0x7d')]=function(_0x12cfff,_0x516a1b,_0x24946b){var _0x567b22={};var _0xbab8d5={};var _0x4dc920;var _0x3f8c3b;return db[_0xbd5b('0x2e')][_0xbd5b('0x7e')]({'where':{'id':_0x12cfff[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x516a1b,null))[_0xbd5b('0x24')](function(_0x316f67){if(_0x316f67){_0x4dc920=_0x316f67;_0xbab8d5['model']=_[_0xbd5b('0x34')](db[_0xbd5b('0x5f')][_0xbd5b('0x2f')]);_0xbab8d5[_0xbd5b('0x33')]=_['keys'](_0x12cfff['query']);_0xbab8d5['filters']=_[_0xbd5b('0x36')](_0xbab8d5[_0xbd5b('0x32')],_0xbab8d5[_0xbd5b('0x33')]);_0x567b22['attributes']=_[_0xbd5b('0x36')](_0xbab8d5[_0xbd5b('0x32')],qs[_0xbd5b('0x38')](_0x12cfff['query']['fields']));_0x567b22[_0xbd5b('0x37')]=_0x567b22[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x567b22[_0xbd5b('0x37')]:_0xbab8d5[_0xbd5b('0x32')];_0x567b22[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x12cfff[_0xbd5b('0x33')][_0xbd5b('0x3d')]);_0x567b22[_0xbd5b('0x3e')]=qs[_0xbd5b('0x35')](_[_0xbd5b('0x3f')](_0x12cfff[_0xbd5b('0x33')],_0xbab8d5[_0xbd5b('0x35')]));_0x567b22[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x567b22[_0xbd5b('0x3e')],{'$or':[{'ListId':_0x316f67['id']},{'ListId':null}]});if(_0x12cfff[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x567b22[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x567b22[_0xbd5b('0x3e')],{'$or':_[_0xbd5b('0x2d')](_0x567b22[_0xbd5b('0x37')],function(_0x37cc2b){var _0x19beac={};_0x19beac[_0x37cc2b]={'$like':'%'+_0x12cfff[_0xbd5b('0x33')][_0xbd5b('0x42')]+'%'};return _0x19beac;})});}_0x567b22=_[_0xbd5b('0x40')]({},_0x567b22,_0x12cfff[_0xbd5b('0x43')]);return db[_0xbd5b('0x5f')][_0xbd5b('0x7f')](_0x567b22);}})['then'](respondWithResult(_0x516a1b,null))[_0xbd5b('0x4a')](handleError(_0x516a1b,null));};exports[_0xbd5b('0x80')]=function(_0x12e724,_0x423d01,_0x3a6608){return db[_0xbd5b('0x2e')]['find']({'where':{'id':_0x12e724[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x423d01,null))[_0xbd5b('0x24')](function(_0x3f628f){if(_0x3f628f){return _0x3f628f[_0xbd5b('0x80')](_0x12e724['body']['ids'],_[_0xbd5b('0x5d')](_0x12e724[_0xbd5b('0x4c')],['ids','id'])||{})['spread'](function(_0x5abe47){for(var _0x131ca4=0x0;_0x131ca4<_0x12e724['body'][_0xbd5b('0x81')]['length'];_0x131ca4+=0x1){socket[_0xbd5b('0x82')](_0xbd5b('0x83'),{'UserId':Number(_0x12e724[_0xbd5b('0x4c')]['ids'][_0x131ca4]),'CmListId':Number(_0x12e724[_0xbd5b('0x48')]['id'])});}return _0x5abe47;});}})[_0xbd5b('0x24')](respondWithResult(_0x423d01,null))[_0xbd5b('0x4a')](handleError(_0x423d01,null));};exports[_0xbd5b('0x84')]=function(_0x50dea1,_0x1bf7a7,_0x249dd7){return db[_0xbd5b('0x2e')][_0xbd5b('0x49')]({'where':{'id':_0x50dea1['params']['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x1bf7a7,null))[_0xbd5b('0x24')](function(_0x302b3e){if(_0x302b3e){return _0x302b3e['removeAgents'](_0x50dea1[_0xbd5b('0x33')][_0xbd5b('0x81')])[_0xbd5b('0x24')](function(){if(_[_0xbd5b('0x59')](_0x50dea1[_0xbd5b('0x33')][_0xbd5b('0x81')])){for(var _0x260abe=0x0;_0x260abe<_0x50dea1[_0xbd5b('0x33')]['ids'][_0xbd5b('0x39')];_0x260abe+=0x1){socket[_0xbd5b('0x82')]('userCmList:remove',{'UserId':Number(_0x50dea1['query'][_0xbd5b('0x81')][_0x260abe]),'CmListId':Number(_0x50dea1[_0xbd5b('0x48')]['id'])});}}else{socket[_0xbd5b('0x82')](_0xbd5b('0x85'),{'UserId':Number(_0x50dea1['query']['ids']),'CmListId':Number(_0x50dea1[_0xbd5b('0x48')]['id'])});}});}})[_0xbd5b('0x24')](respondWithStatusCode(_0x1bf7a7,null))[_0xbd5b('0x4a')](handleError(_0x1bf7a7,null));};exports['getAgents']=function(_0x1cd780,_0x301155,_0x36709c){var _0x336344={};var _0x1815c4={};var _0x19ddfd;var _0xdf02cd;return db[_0xbd5b('0x2e')][_0xbd5b('0x7e')]({'where':{'id':_0x1cd780[_0xbd5b('0x48')]['id']}})[_0xbd5b('0x24')](handleEntityNotFound(_0x301155,null))['then'](function(_0x35bcb3){if(_0x35bcb3){_0x19ddfd=_0x35bcb3;_0x1815c4['model']=_[_0xbd5b('0x34')](db[_0xbd5b('0x86')][_0xbd5b('0x2f')]);_0x1815c4[_0xbd5b('0x33')]=_[_0xbd5b('0x34')](_0x1cd780[_0xbd5b('0x33')]);_0x1815c4[_0xbd5b('0x35')]=_[_0xbd5b('0x36')](_0x1815c4[_0xbd5b('0x32')],_0x1815c4[_0xbd5b('0x33')]);_0x336344[_0xbd5b('0x37')]=_['intersection'](_0x1815c4['model'],qs['fields'](_0x1cd780['query']['fields']));_0x336344[_0xbd5b('0x37')]=_0x336344[_0xbd5b('0x37')][_0xbd5b('0x39')]?_0x336344[_0xbd5b('0x37')]:_0x1815c4['model'];_0x336344[_0xbd5b('0x3c')]=qs[_0xbd5b('0x3d')](_0x1cd780['query'][_0xbd5b('0x3d')]);_0x336344[_0xbd5b('0x3e')]=qs['filters'](_[_0xbd5b('0x3f')](_0x1cd780['query'],_0x1815c4[_0xbd5b('0x35')]));if(_0x1cd780[_0xbd5b('0x33')][_0xbd5b('0x42')]){_0x336344[_0xbd5b('0x3e')]=_[_0xbd5b('0x40')](_0x336344[_0xbd5b('0x3e')],{'$or':_[_0xbd5b('0x2d')](_0x336344['attributes'],function(_0x2a02c6){var _0x36c7a8={};_0x36c7a8[_0x2a02c6]={'$like':'%'+_0x1cd780[_0xbd5b('0x33')][_0xbd5b('0x42')]+'%'};return _0x36c7a8;})});}_0x336344=_['merge']({},_0x336344,_0x1cd780['options']);return _0x19ddfd[_0xbd5b('0x87')](_0x336344);}})[_0xbd5b('0x24')](function(_0xfebdf7){if(_0xfebdf7){_0xdf02cd=_0xfebdf7['length'];if(!_0x1cd780['query'][_0xbd5b('0x3a')]('nolimit')){_0x336344[_0xbd5b('0x1c')]=qs[_0xbd5b('0x1c')](_0x1cd780['query'][_0xbd5b('0x1c')]);_0x336344[_0xbd5b('0x1d')]=qs[_0xbd5b('0x1d')](_0x1cd780[_0xbd5b('0x33')][_0xbd5b('0x1d')]);}return _0x19ddfd[_0xbd5b('0x87')](_0x336344);}})['then'](function(_0x1311f6){if(_0x1311f6){return _0x1311f6?{'count':_0xdf02cd,'rows':_0x1311f6}:null;}})[_0xbd5b('0x24')](respondWithResult(_0x301155,null))['catch'](handleError(_0x301155,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 7a72873..1520b90 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x3f6b3e,_0x411dc0){_0x3f6b3e=_0x3f6b3e-0x0;var _0x28548b=_0x3e74[_0x3f6b3e];return _0x28548b;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x16960e,_0x169c9f){var _0x1c24ce=function(_0x58c97){while(--_0x58c97){_0x16960e['push'](_0x16960e['shift']());}};_0x1c24ce(++_0x169c9f);}(_0x814b,0x1a2));var _0xb814=function(_0x36d8d9,_0x17b58a){_0x36d8d9=_0x36d8d9-0x0;var _0x1ac3a2=_0x814b[_0x36d8d9];return _0x1ac3a2;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 2eabc1c..ef21c83 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 _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x55651c,_0x24aae8){var _0xfd2c78=function(_0x422c46){while(--_0x422c46){_0x55651c['push'](_0x55651c['shift']());}};_0xfd2c78(++_0x24aae8);}(_0xb43b,0x1b2));var _0xbb43=function(_0xa15862,_0x1bd439){_0xa15862=_0xa15862-0x0;var _0x5cb41b=_0xb43b[_0xa15862];return _0x5cb41b;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4801c8,_0x470ce5){_0x4801c8=_0x4801c8-0x0;var _0x353fc7=_0x6f0d[_0x4801c8];return _0x353fc7;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('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 b42554f..9802f9c 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 _0xf2f6=['CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then'];(function(_0x53c94d,_0x1dd116){var _0x172b41=function(_0x2ed493){while(--_0x2ed493){_0x53c94d['push'](_0x53c94d['shift']());}};_0x172b41(++_0x1dd116);}(_0xf2f6,0x110));var _0x6f2f=function(_0x4a0345,_0x1e80b2){_0x4a0345=_0x4a0345-0x0;var _0x1cb9a9=_0xf2f6[_0x4a0345];return _0x1cb9a9;};'use strict';var _=require(_0x6f2f('0x0'));var util=require(_0x6f2f('0x1'));var moment=require(_0x6f2f('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f2f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2f('0x4'))['db'];var utils=require(_0x6f2f('0x5'));var logger=require(_0x6f2f('0x6'))('rpc');var config=require(_0x6f2f('0x7'));var jayson=require(_0x6f2f('0x8'));var client=jayson[_0x6f2f('0x9')][_0x6f2f('0xa')]({'port':0x232a});config[_0x6f2f('0xb')]=_[_0x6f2f('0xc')](config['redis'],{'host':_0x6f2f('0xd'),'port':0x18eb});var socket=require(_0x6f2f('0xe'))(new Redis(config[_0x6f2f('0xb')]));require(_0x6f2f('0xf'))['register'](socket);function respondWithRpcPromise(_0x515ace,_0x4b96ca,_0x823a19){return new BPromise(function(_0x4dff45,_0x9c3768){return client[_0x6f2f('0x10')](_0x515ace,_0x823a19)[_0x6f2f('0x11')](function(_0x3745b0){logger['info'](_0x6f2f('0x12'),_0x4b96ca,_0x6f2f('0x13'));logger[_0x6f2f('0x14')](_0x6f2f('0x15'),_0x4b96ca,_0x6f2f('0x13'),JSON[_0x6f2f('0x16')](_0x3745b0));if(_0x3745b0[_0x6f2f('0x17')]){if(_0x3745b0[_0x6f2f('0x17')][_0x6f2f('0x18')]===0x1f4){logger[_0x6f2f('0x17')](_0x6f2f('0x12'),_0x4b96ca,_0x3745b0[_0x6f2f('0x17')][_0x6f2f('0x19')]);return _0x9c3768(_0x3745b0['error'][_0x6f2f('0x19')]);}logger[_0x6f2f('0x17')]('CmList,\x20%s,\x20%s',_0x4b96ca,_0x3745b0[_0x6f2f('0x17')][_0x6f2f('0x19')]);return _0x4dff45(_0x3745b0[_0x6f2f('0x17')]['message']);}else{logger[_0x6f2f('0x1a')](_0x6f2f('0x12'),_0x4b96ca,_0x6f2f('0x13'));_0x4dff45(_0x3745b0[_0x6f2f('0x1b')][_0x6f2f('0x19')]);}})[_0x6f2f('0x1c')](function(_0x3a54c4){logger[_0x6f2f('0x17')]('CmList,\x20%s,\x20%s',_0x4b96ca,_0x3a54c4);_0x9c3768(_0x3a54c4);});});} \ No newline at end of file +var _0x8647=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','stringify','error','code','CmList,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a1c3c,_0x8e95ef){var _0x46da32=function(_0x1c6ce6){while(--_0x1c6ce6){_0x4a1c3c['push'](_0x4a1c3c['shift']());}};_0x46da32(++_0x8e95ef);}(_0x8647,0x18a));var _0x7864=function(_0x47e383,_0x32adc9){_0x47e383=_0x47e383-0x0;var _0x49ac3e=_0x8647[_0x47e383];return _0x49ac3e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7864('0x0'));var rs=require(_0x7864('0x1'));var fs=require('fs');var Redis=require(_0x7864('0x2'));var db=require(_0x7864('0x3'))['db'];var utils=require(_0x7864('0x4'));var logger=require(_0x7864('0x5'))(_0x7864('0x6'));var config=require(_0x7864('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7864('0x8')][_0x7864('0x9')]({'port':0x232a});config[_0x7864('0xa')]=_['defaults'](config[_0x7864('0xa')],{'host':_0x7864('0xb'),'port':0x18eb});var socket=require(_0x7864('0xc'))(new Redis(config[_0x7864('0xa')]));require(_0x7864('0xd'))[_0x7864('0xe')](socket);function respondWithRpcPromise(_0x2b2b35,_0xe82cf,_0x101e8a){return new BPromise(function(_0x2a5157,_0x36a84f){return client['request'](_0x2b2b35,_0x101e8a)[_0x7864('0xf')](function(_0x53722c){logger[_0x7864('0x10')]('CmList,\x20%s,\x20%s',_0xe82cf,_0x7864('0x11'));logger[_0x7864('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0xe82cf,'request\x20sent',JSON[_0x7864('0x13')](_0x53722c));if(_0x53722c[_0x7864('0x14')]){if(_0x53722c[_0x7864('0x14')][_0x7864('0x15')]===0x1f4){logger[_0x7864('0x14')](_0x7864('0x16'),_0xe82cf,_0x53722c['error'][_0x7864('0x17')]);return _0x36a84f(_0x53722c[_0x7864('0x14')][_0x7864('0x17')]);}logger['error'](_0x7864('0x16'),_0xe82cf,_0x53722c['error'][_0x7864('0x17')]);return _0x2a5157(_0x53722c[_0x7864('0x14')][_0x7864('0x17')]);}else{logger[_0x7864('0x10')](_0x7864('0x16'),_0xe82cf,_0x7864('0x11'));_0x2a5157(_0x53722c[_0x7864('0x18')][_0x7864('0x17')]);}})['catch'](function(_0x36d935){logger[_0x7864('0x14')](_0x7864('0x16'),_0xe82cf,_0x36d935);_0x36a84f(_0x36d935);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 11b17ef..7807443 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 _0xc7ec=['removeListener','register','length','save','remove','update','emit'];(function(_0x137da5,_0x2bf6f){var _0x169cd8=function(_0x40a3c5){while(--_0x40a3c5){_0x137da5['push'](_0x137da5['shift']());}};_0x169cd8(++_0x2bf6f);}(_0xc7ec,0xff));var _0xcc7e=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xc7ec[_0x560448];return _0x550276;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xcc7e('0x0'),_0xcc7e('0x1'),_0xcc7e('0x2')];function createListener(_0x1864a9,_0x4026fc){return function(_0x36b506){_0x4026fc[_0xcc7e('0x3')](_0x1864a9,_0x36b506);};}function removeListener(_0x3bb978,_0x14912f){return function(){CmListEvents[_0xcc7e('0x4')](_0x3bb978,_0x14912f);};}exports[_0xcc7e('0x5')]=function(_0xb3f608){for(var _0x32b59f=0x0,_0x23a6d4=events[_0xcc7e('0x6')];_0x32b59f<_0x23a6d4;_0x32b59f++){var _0x33eadd=events[_0x32b59f];var _0x3d4219=createListener('cmList:'+_0x33eadd,_0xb3f608);CmListEvents['on'](_0x33eadd,_0x3d4219);}}; \ No newline at end of file +var _0x7c40=['register','length','cmList:','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x7c40,0x12c));var _0x07c4=function(_0x54d581,_0x2b61f3){_0x54d581=_0x54d581-0x0;var _0x344aea=_0x7c40[_0x54d581];return _0x344aea;};'use strict';var CmListEvents=require(_0x07c4('0x0'));var events=[_0x07c4('0x1'),_0x07c4('0x2'),_0x07c4('0x3')];function createListener(_0x3d0bf2,_0x199855){return function(_0x1fc78e){_0x199855[_0x07c4('0x4')](_0x3d0bf2,_0x1fc78e);};}function removeListener(_0x5c5d98,_0x24651f){return function(){CmListEvents[_0x07c4('0x5')](_0x5c5d98,_0x24651f);};}exports[_0x07c4('0x6')]=function(_0x13ff22){for(var _0x2b6325=0x0,_0x10ba36=events[_0x07c4('0x7')];_0x2b6325<_0x10ba36;_0x2b6325++){var _0x51b844=events[_0x2b6325];var _0x2eaf10=createListener(_0x07c4('0x8')+_0x51b844,_0x13ff22);CmListEvents['on'](_0x51b844,_0x2eaf10);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 323de2c..e51907e 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 _0x21ab=['fs-extra','get','isAuthenticated','describe','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','update','delete','/:id/dispositions','removeDispositions','removeAgents','exports','util','connect-timeout','Router'];(function(_0x51877e,_0x1a1b79){var _0x3a382e=function(_0x274e0d){while(--_0x274e0d){_0x51877e['push'](_0x51877e['shift']());}};_0x3a382e(++_0x1a1b79);}(_0x21ab,0x13c));var _0xb21a=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x21ab[_0x404cde];return _0x139882;};'use strict';var multer=require('multer');var util=require(_0xb21a('0x0'));var path=require('path');var timeout=require(_0xb21a('0x1'));var express=require('express');var router=express[_0xb21a('0x2')]();var fs_extra=require(_0xb21a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xb21a('0x4')]('/',auth[_0xb21a('0x5')](),controller['index']);router[_0xb21a('0x4')]('/describe',auth[_0xb21a('0x5')](),controller[_0xb21a('0x6')]);router['get'](_0xb21a('0x7'),auth[_0xb21a('0x5')](),controller['show']);router[_0xb21a('0x4')]('/:id/dispositions',auth[_0xb21a('0x5')](),controller[_0xb21a('0x8')]);router[_0xb21a('0x4')](_0xb21a('0x9'),auth[_0xb21a('0x5')](),controller[_0xb21a('0xa')]);router[_0xb21a('0x4')](_0xb21a('0xb'),auth[_0xb21a('0x5')](),controller[_0xb21a('0xc')]);router[_0xb21a('0x4')](_0xb21a('0xd'),auth[_0xb21a('0x5')](),controller[_0xb21a('0xe')]);router['get'](_0xb21a('0xf'),auth[_0xb21a('0x5')](),controller[_0xb21a('0x10')]);router[_0xb21a('0x11')]('/',auth['isAuthenticated'](),controller[_0xb21a('0x12')]);router[_0xb21a('0x11')]('/:id/dispositions',auth[_0xb21a('0x5')](),controller[_0xb21a('0x13')]);router[_0xb21a('0x11')](_0xb21a('0x9'),auth[_0xb21a('0x5')](),controller[_0xb21a('0x14')]);router[_0xb21a('0x11')](_0xb21a('0xd'),auth[_0xb21a('0x5')](),controller[_0xb21a('0x15')]);router[_0xb21a('0x11')](_0xb21a('0xf'),auth[_0xb21a('0x5')](),controller[_0xb21a('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb21a('0x17')]);router[_0xb21a('0x18')](_0xb21a('0x7'),auth[_0xb21a('0x5')](),controller['destroy']);router[_0xb21a('0x18')](_0xb21a('0x19'),auth[_0xb21a('0x5')](),controller[_0xb21a('0x1a')]);router[_0xb21a('0x18')](_0xb21a('0xf'),auth[_0xb21a('0x5')](),controller[_0xb21a('0x1b')]);module[_0xb21a('0x1c')]=router; \ No newline at end of file +var _0x33e3=['show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addContacts','addCustomField','/:id/users','addAgents','put','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x33e3,0x1a0));var _0x333e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33e3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x333e('0x0'));var path=require(_0x333e('0x1'));var timeout=require(_0x333e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x333e('0x3'));var auth=require(_0x333e('0x4'));var interaction=require(_0x333e('0x5'));var config=require(_0x333e('0x6'));var controller=require(_0x333e('0x7'));router[_0x333e('0x8')]('/',auth[_0x333e('0x9')](),controller[_0x333e('0xa')]);router[_0x333e('0x8')](_0x333e('0xb'),auth[_0x333e('0x9')](),controller['describe']);router[_0x333e('0x8')](_0x333e('0xc'),auth[_0x333e('0x9')](),controller[_0x333e('0xd')]);router['get'](_0x333e('0xe'),auth['isAuthenticated'](),controller[_0x333e('0xf')]);router[_0x333e('0x8')](_0x333e('0x10'),auth[_0x333e('0x9')](),controller['getContacts']);router[_0x333e('0x8')](_0x333e('0x11'),auth[_0x333e('0x9')](),controller[_0x333e('0x12')]);router[_0x333e('0x8')](_0x333e('0x13'),auth['isAuthenticated'](),controller[_0x333e('0x14')]);router[_0x333e('0x8')]('/:id/users',auth[_0x333e('0x9')](),controller[_0x333e('0x15')]);router[_0x333e('0x16')]('/',auth[_0x333e('0x9')](),controller[_0x333e('0x17')]);router['post'](_0x333e('0xe'),auth[_0x333e('0x9')](),controller['addDisposition']);router[_0x333e('0x16')]('/:id/contacts',auth[_0x333e('0x9')](),controller[_0x333e('0x18')]);router['post'](_0x333e('0x13'),auth[_0x333e('0x9')](),controller[_0x333e('0x19')]);router[_0x333e('0x16')](_0x333e('0x1a'),auth['isAuthenticated'](),controller[_0x333e('0x1b')]);router[_0x333e('0x1c')]('/:id',auth[_0x333e('0x9')](),controller['update']);router[_0x333e('0x1d')](_0x333e('0xc'),auth[_0x333e('0x9')](),controller['destroy']);router[_0x333e('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x333e('0x1e')]);router['delete']('/:id/users',auth[_0x333e('0x9')](),controller[_0x333e('0x1f')]);module[_0x333e('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 65396b5..2e102a8 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 _0xe7d0=['exports','getDataValue','field','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7d0,0x7c));var _0x0e7d=function(_0x14b280,_0x5b530c){_0x14b280=_0x14b280-0x0;var _0x555ac8=_0xe7d0[_0x14b280];return _0x555ac8;};'use strict';var Sequelize=require(_0x0e7d('0x0'));module[_0x0e7d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x209b41){return this[_0x0e7d('0x2')](_0x0e7d('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0e7d('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0e7d('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xe8c8=['getDataValue','field','STRING','sequelize','exports'];(function(_0x40d550,_0x23f9f2){var _0x532ff9=function(_0x54a3a9){while(--_0x54a3a9){_0x40d550['push'](_0x40d550['shift']());}};_0x532ff9(++_0x23f9f2);}(_0xe8c8,0x1c5));var _0x8e8c=function(_0x547637,_0x2d9726){_0x547637=_0x547637-0x0;var _0x54d512=_0xe8c8[_0x547637];return _0x54d512;};'use strict';var Sequelize=require(_0x8e8c('0x0'));module[_0x8e8c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ac41b){return this[_0x8e8c('0x2')](_0x8e8c('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x8e8c('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x8e8c('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 7cdf5f6..46d52fc 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x17f12f,_0x2b5050){var _0x184293=function(_0x5eaa1f){while(--_0x5eaa1f){_0x17f12f['push'](_0x17f12f['shift']());}};_0x184293(++_0x2b5050);}(_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 +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(_0x4c86f7,_0x1472bb){var _0x17fd90=function(_0x2835b1){while(--_0x2835b1){_0x4c86f7['push'](_0x4c86f7['shift']());}};_0x17fd90(++_0x1472bb);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 f661326..a416a2e 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 _0x4b5a=['./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x4b5a,0x139));var _0xa4b5=function(_0x54f5ae,_0x4f71fd){_0x54f5ae=_0x54f5ae-0x0;var _0x3d4016=_0x4b5a[_0x54f5ae];return _0x3d4016;};'use strict';var _=require(_0xa4b5('0x0'));var util=require(_0xa4b5('0x1'));var logger=require(_0xa4b5('0x2'))(_0xa4b5('0x3'));var moment=require('moment');var BPromise=require(_0xa4b5('0x4'));var rp=require(_0xa4b5('0x5'));var fs=require('fs');var path=require(_0xa4b5('0x6'));var rimraf=require(_0xa4b5('0x7'));var config=require(_0xa4b5('0x8'));var attributes=require(_0xa4b5('0x9'));module[_0xa4b5('0xa')]=function(_0x37ffc5,_0x24cef7){return _0x37ffc5[_0xa4b5('0xb')](_0xa4b5('0xc'),attributes,{'tableName':_0xa4b5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0950=['path','rimraf','../../config/environment','./condition.attributes','define','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xba6b88,_0x4f1e92){var _0x575135=function(_0x52cf18){while(--_0x52cf18){_0xba6b88['push'](_0xba6b88['shift']());}};_0x575135(++_0x4f1e92);}(_0x0950,0x7e));var _0x0095=function(_0x41dcdb,_0x4e1a2f){_0x41dcdb=_0x41dcdb-0x0;var _0xce4042=_0x0950[_0x41dcdb];return _0xce4042;};'use strict';var _=require(_0x0095('0x0'));var util=require(_0x0095('0x1'));var logger=require(_0x0095('0x2'))(_0x0095('0x3'));var moment=require('moment');var BPromise=require(_0x0095('0x4'));var rp=require(_0x0095('0x5'));var fs=require('fs');var path=require(_0x0095('0x6'));var rimraf=require(_0x0095('0x7'));var config=require(_0x0095('0x8'));var attributes=require(_0x0095('0x9'));module['exports']=function(_0x5c24e1,_0x2eaa67){return _0x5c24e1[_0x0095('0xa')]('Condition',attributes,{'tableName':_0x0095('0xb'),'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 a7038db..7584f6d 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 _0xfb63=['then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x3ad945,_0x464def){var _0x1ea04c=function(_0x413fd0){while(--_0x413fd0){_0x3ad945['push'](_0x3ad945['shift']());}};_0x1ea04c(++_0x464def);}(_0xfb63,0x1d8));var _0x3fb6=function(_0x36b81c,_0x43de4a){_0x36b81c=_0x36b81c-0x0;var _0x3a28bb=_0xfb63[_0x36b81c];return _0x3a28bb;};'use strict';var _=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fb6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fb6('0x4'))['db'];var utils=require(_0x3fb6('0x5'));var logger=require(_0x3fb6('0x6'))('rpc');var config=require(_0x3fb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3fb6('0x8')][_0x3fb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x411732,_0x1f37c9,_0x2e95f5){return new BPromise(function(_0x4ee2b1,_0x9d7cb7){return client[_0x3fb6('0xa')](_0x411732,_0x2e95f5)[_0x3fb6('0xb')](function(_0xd1ae67){logger[_0x3fb6('0xc')](_0x3fb6('0xd'),_0x1f37c9,_0x3fb6('0xe'));logger['debug'](_0x3fb6('0xf'),_0x1f37c9,_0x3fb6('0xe'),JSON[_0x3fb6('0x10')](_0xd1ae67));if(_0xd1ae67[_0x3fb6('0x11')]){if(_0xd1ae67[_0x3fb6('0x11')]['code']===0x1f4){logger[_0x3fb6('0x11')](_0x3fb6('0xd'),_0x1f37c9,_0xd1ae67[_0x3fb6('0x11')][_0x3fb6('0x12')]);return _0x9d7cb7(_0xd1ae67[_0x3fb6('0x11')][_0x3fb6('0x12')]);}logger[_0x3fb6('0x11')](_0x3fb6('0xd'),_0x1f37c9,_0xd1ae67[_0x3fb6('0x11')][_0x3fb6('0x12')]);return _0x4ee2b1(_0xd1ae67['error']['message']);}else{logger[_0x3fb6('0xc')](_0x3fb6('0xd'),_0x1f37c9,'request\x20sent');_0x4ee2b1(_0xd1ae67[_0x3fb6('0x13')]['message']);}})[_0x3fb6('0x14')](function(_0x1210bd){logger[_0x3fb6('0x11')]('Condition,\x20%s,\x20%s',_0x1f37c9,_0x1210bd);_0x9d7cb7(_0x1210bd);});});} \ No newline at end of file +var _0x40f0=['Condition,\x20%s,\x20%s','message','result','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x46012c,_0x66bacf){var _0x26d30f=function(_0x3a281a){while(--_0x3a281a){_0x46012c['push'](_0x46012c['shift']());}};_0x26d30f(++_0x66bacf);}(_0x40f0,0x81));var _0x040f=function(_0x5062dc,_0x4af19b){_0x5062dc=_0x5062dc-0x0;var _0x1a2945=_0x40f0[_0x5062dc];return _0x1a2945;};'use strict';var _=require('lodash');var util=require(_0x040f('0x0'));var moment=require(_0x040f('0x1'));var BPromise=require('bluebird');var rs=require(_0x040f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x040f('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x040f('0x4'));var jayson=require(_0x040f('0x5'));var client=jayson[_0x040f('0x6')][_0x040f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9c93c2,_0x469838,_0x717aa3){return new BPromise(function(_0x4d0f88,_0x2a4b65){return client['request'](_0x9c93c2,_0x717aa3)[_0x040f('0x8')](function(_0x411596){logger[_0x040f('0x9')]('Condition,\x20%s,\x20%s',_0x469838,'request\x20sent');logger['debug'](_0x040f('0xa'),_0x469838,_0x040f('0xb'),JSON[_0x040f('0xc')](_0x411596));if(_0x411596[_0x040f('0xd')]){if(_0x411596[_0x040f('0xd')][_0x040f('0xe')]===0x1f4){logger[_0x040f('0xd')](_0x040f('0xf'),_0x469838,_0x411596[_0x040f('0xd')][_0x040f('0x10')]);return _0x2a4b65(_0x411596[_0x040f('0xd')][_0x040f('0x10')]);}logger[_0x040f('0xd')](_0x040f('0xf'),_0x469838,_0x411596[_0x040f('0xd')]['message']);return _0x4d0f88(_0x411596[_0x040f('0xd')]['message']);}else{logger[_0x040f('0x9')]('Condition,\x20%s,\x20%s',_0x469838,_0x040f('0xb'));_0x4d0f88(_0x411596[_0x040f('0x11')][_0x040f('0x10')]);}})['catch'](function(_0x163008){logger[_0x040f('0xd')](_0x040f('0xf'),_0x469838,_0x163008);_0x2a4b65(_0x163008);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6de6461..e8bfe07 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 _0x879f=['/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x5d990e,_0x4ba9f5){var _0x36c763=function(_0x52270c){while(--_0x52270c){_0x5d990e['push'](_0x5d990e['shift']());}};_0x36c763(++_0x4ba9f5);}(_0x879f,0x80));var _0xf879=function(_0x2eebab,_0x5d25d3){_0x2eebab=_0x2eebab-0x0;var _0x33c24d=_0x879f[_0x2eebab];return _0x33c24d;};'use strict';var multer=require(_0xf879('0x0'));var util=require(_0xf879('0x1'));var path=require(_0xf879('0x2'));var timeout=require(_0xf879('0x3'));var express=require('express');var router=express[_0xf879('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf879('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf879('0x6'));var controller=require(_0xf879('0x7'));router[_0xf879('0x8')]('/:id',auth[_0xf879('0x9')](),controller[_0xf879('0xa')]);router[_0xf879('0xb')](_0xf879('0xc'),auth[_0xf879('0x9')](),controller['destroy']);module[_0xf879('0xd')]=router; \ No newline at end of file +var _0xac4a=['express','Router','fs-extra','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','exports','multer','path'];(function(_0x57259c,_0x19607c){var _0x5707a1=function(_0x6a88a){while(--_0x6a88a){_0x57259c['push'](_0x57259c['shift']());}};_0x5707a1(++_0x19607c);}(_0xac4a,0x136));var _0xaac4=function(_0x5b3d39,_0x2ee32c){_0x5b3d39=_0x5b3d39-0x0;var _0x46e677=_0xac4a[_0x5b3d39];return _0x46e677;};'use strict';var multer=require(_0xaac4('0x0'));var util=require('util');var path=require(_0xaac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xaac4('0x2'));var router=express[_0xaac4('0x3')]();var fs_extra=require(_0xaac4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaac4('0x5'));var controller=require(_0xaac4('0x6'));router[_0xaac4('0x7')]('/:id',auth[_0xaac4('0x8')](),controller[_0xaac4('0x9')]);router[_0xaac4('0xa')](_0xaac4('0xb'),auth[_0xaac4('0x8')](),controller['destroy']);module[_0xaac4('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 787223e..7f37a84 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 _0xb10b=['name','sequelize','STRING'];(function(_0x53bd4f,_0x2625f4){var _0x1d7833=function(_0x2d5000){while(--_0x2d5000){_0x53bd4f['push'](_0x53bd4f['shift']());}};_0x1d7833(++_0x2625f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c699e,_0x5e9d6c){_0x2c699e=_0x2c699e-0x0;var _0x5844e3=_0xb10b[_0x2c699e];return _0x5844e3;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x439dd5,_0x5615a3){var _0xd2b861=function(_0x14d416){while(--_0x14d416){_0x439dd5['push'](_0x439dd5['shift']());}};_0xd2b861(++_0x5615a3);}(_0x2032,0xd9));var _0x2203=function(_0x158a0a,_0x11138d){_0x158a0a=_0x158a0a-0x0;var _0x33ac05=_0x2032[_0x158a0a];return _0x33ac05;};'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 17eb4bd..cc774f9 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 _0x4643=['fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','map','Dashboard','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','user','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','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','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','pick','getItems','eml-format','rimraf','zip-dir'];(function(_0x384076,_0x491e1c){var _0x1d8f5d=function(_0x594e4c){while(--_0x594e4c){_0x384076['push'](_0x384076['shift']());}};_0x1d8f5d(++_0x491e1c);}(_0x4643,0x7c));var _0x3464=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4643[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x3464('0x0'));var rimraf=require(_0x3464('0x1'));var zipdir=require(_0x3464('0x2'));var jsonpatch=require(_0x3464('0x3'));var rp=require(_0x3464('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3464('0x5'));var util=require('util');var path=require(_0x3464('0x6'));var sox=require(_0x3464('0x7'));var csv=require(_0x3464('0x8'));var ejs=require(_0x3464('0x9'));var fs=require('fs');var fs_extra=require(_0x3464('0xa'));var _=require('lodash');var squel=require(_0x3464('0xb'));var crypto=require(_0x3464('0xc'));var jsforce=require(_0x3464('0xd'));var deskjs=require(_0x3464('0xe'));var toCsv=require(_0x3464('0x8'));var querystring=require(_0x3464('0xf'));var Papa=require('papaparse');var Redis=require(_0x3464('0x10'));var authService=require(_0x3464('0x11'));var qs=require(_0x3464('0x12'));var as=require(_0x3464('0x13'));var hardwareService=require(_0x3464('0x14'));var logger=require(_0x3464('0x15'))(_0x3464('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3464('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3464('0x18')](config['redis'],{'host':_0x3464('0x19'),'port':0x18eb});var socket=require(_0x3464('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0x3464('0x1b')](socket);function respondWithStatusCode(_0x359477,_0x17c2b5){_0x17c2b5=_0x17c2b5||0xcc;return function(_0xf96d72){if(_0xf96d72){return _0x359477[_0x3464('0x1c')](_0x17c2b5);}return _0x359477[_0x3464('0x1d')](_0x17c2b5)[_0x3464('0x1e')]();};}function respondWithResult(_0x356d9e,_0x4d6f28){_0x4d6f28=_0x4d6f28||0xc8;return function(_0x4a5749){if(_0x4a5749){return _0x356d9e['status'](_0x4d6f28)[_0x3464('0x1f')](_0x4a5749);}};}function respondWithFilteredResult(_0x116c6d,_0x2432c6){return function(_0x21113f){if(_0x21113f){var _0xca593=typeof _0x2432c6[_0x3464('0x20')]===_0x3464('0x21')&&typeof _0x2432c6[_0x3464('0x22')]===_0x3464('0x21');var _0xf001d4=_0x21113f[_0x3464('0x23')];var _0x1a8ee4=_0xca593?0x0:_0x2432c6['offset'];var _0x5a5814=_0xca593?_0x21113f[_0x3464('0x23')]:_0x2432c6[_0x3464('0x20')]+_0x2432c6[_0x3464('0x22')];var _0x518b92;if(_0x5a5814>=_0xf001d4){_0x5a5814=_0xf001d4;_0x518b92=0xc8;}else{_0x518b92=0xce;}_0x116c6d[_0x3464('0x1d')](_0x518b92);return _0x116c6d['set'](_0x3464('0x24'),_0x1a8ee4+'-'+_0x5a5814+'/'+_0xf001d4)[_0x3464('0x1f')](_0x21113f);}return null;};}function patchUpdates(_0x4dc718){return function(_0x2e8992){try{jsonpatch[_0x3464('0x25')](_0x2e8992,_0x4dc718,!![]);}catch(_0x574319){return BPromise[_0x3464('0x26')](_0x574319);}return _0x2e8992[_0x3464('0x27')]();};}function saveUpdates(_0x103723,_0x45e07d){return function(_0x41f856){if(_0x41f856){return _0x41f856[_0x3464('0x28')](_0x103723)[_0x3464('0x29')](function(_0x50d34d){return _0x50d34d;});}return null;};}function removeEntity(_0x559c35,_0x37ea47){return function(_0xc21e13){if(_0xc21e13){return _0xc21e13[_0x3464('0x2a')]()[_0x3464('0x29')](function(){var _0x1cf06e=_0xc21e13[_0x3464('0x2b')]({'plain':!![]});var _0x32485a=_0x3464('0x2c');return db[_0x3464('0x2d')][_0x3464('0x2a')]({'where':{'type':_0x32485a,'resourceId':_0x1cf06e['id']}})[_0x3464('0x29')](function(){return _0xc21e13;});})[_0x3464('0x29')](function(){_0x559c35['status'](0xcc)[_0x3464('0x1e')]();});}};}function handleEntityNotFound(_0x247311,_0x29395b){return function(_0x2f8c0c){if(!_0x2f8c0c){_0x247311['sendStatus'](0x194);}return _0x2f8c0c;};}function handleError(_0x5ecd41,_0x2a84d3){_0x2a84d3=_0x2a84d3||0x1f4;return function(_0x35969b){logger['error'](_0x35969b[_0x3464('0x2e')]);if(_0x35969b[_0x3464('0x2f')]){delete _0x35969b['name'];}_0x5ecd41[_0x3464('0x1d')](_0x2a84d3)['send'](_0x35969b);};}exports['index']=function(_0x3ed04f,_0x5bd680){var _0x2165eb={},_0x3ea7d9={},_0x9d9b18={'count':0x0,'rows':[]};var _0xd06526=_[_0x3464('0x30')](db[_0x3464('0x31')][_0x3464('0x32')],function(_0x47f0ac){return{'name':_0x47f0ac['fieldName'],'type':_0x47f0ac[_0x3464('0x33')][_0x3464('0x34')]};});_0x3ea7d9['model']=_[_0x3464('0x30')](_0xd06526,_0x3464('0x2f'));_0x3ea7d9[_0x3464('0x35')]=_[_0x3464('0x36')](_0x3ed04f[_0x3464('0x35')]);_0x3ea7d9[_0x3464('0x37')]=_[_0x3464('0x38')](_0x3ea7d9[_0x3464('0x39')],_0x3ea7d9[_0x3464('0x35')]);_0x2165eb['attributes']=_[_0x3464('0x38')](_0x3ea7d9[_0x3464('0x39')],qs[_0x3464('0x3a')](_0x3ed04f['query'][_0x3464('0x3a')]));_0x2165eb[_0x3464('0x3b')]=_0x2165eb['attributes'][_0x3464('0x3c')]?_0x2165eb[_0x3464('0x3b')]:_0x3ea7d9['model'];if(!_0x3ed04f[_0x3464('0x35')][_0x3464('0x3d')](_0x3464('0x3e'))){_0x2165eb[_0x3464('0x22')]=qs[_0x3464('0x22')](_0x3ed04f['query']['limit']);_0x2165eb['offset']=qs[_0x3464('0x20')](_0x3ed04f[_0x3464('0x35')][_0x3464('0x20')]);}_0x2165eb[_0x3464('0x3f')]=qs[_0x3464('0x40')](_0x3ed04f['query']['sort']);_0x2165eb[_0x3464('0x41')]=qs[_0x3464('0x37')](_['pick'](_0x3ed04f['query'],_0x3ea7d9[_0x3464('0x37')]),_0xd06526);if(_0x3ed04f[_0x3464('0x35')][_0x3464('0x42')]){_0x2165eb[_0x3464('0x41')]=_[_0x3464('0x43')](_0x2165eb[_0x3464('0x41')],{'$or':_[_0x3464('0x30')](_0xd06526,function(_0x1fddfe){if(_0x1fddfe[_0x3464('0x33')]!=='VIRTUAL'){var _0x373e05={};_0x373e05[_0x1fddfe['name']]={'$like':'%'+_0x3ed04f['query'][_0x3464('0x42')]+'%'};return _0x373e05;}})});}_0x2165eb=_[_0x3464('0x43')]({},_0x2165eb,_0x3ed04f[_0x3464('0x44')]);var _0x453b60={'where':_0x2165eb[_0x3464('0x41')]};return db[_0x3464('0x31')][_0x3464('0x23')](_0x453b60)[_0x3464('0x29')](function(_0x53e81b){_0x9d9b18[_0x3464('0x23')]=_0x53e81b;if(_0x3ed04f[_0x3464('0x35')][_0x3464('0x45')]){_0x2165eb[_0x3464('0x46')]=[{'all':!![]}];}return db[_0x3464('0x31')]['findAll'](_0x2165eb);})['then'](function(_0xc2d395){_0x9d9b18[_0x3464('0x47')]=_0xc2d395;return _0x9d9b18;})[_0x3464('0x29')](respondWithFilteredResult(_0x5bd680,_0x2165eb))[_0x3464('0x48')](handleError(_0x5bd680,null));};exports[_0x3464('0x49')]=function(_0x2c02f6,_0x1a7744){var _0x260929={'raw':![],'where':{'id':_0x2c02f6[_0x3464('0x4a')]['id']}},_0x5415fb={};_0x5415fb['model']=_['keys'](db[_0x3464('0x31')]['rawAttributes']);_0x5415fb[_0x3464('0x35')]=_[_0x3464('0x36')](_0x2c02f6[_0x3464('0x35')]);_0x5415fb[_0x3464('0x37')]=_[_0x3464('0x38')](_0x5415fb['model'],_0x5415fb[_0x3464('0x35')]);_0x260929['attributes']=_[_0x3464('0x38')](_0x5415fb[_0x3464('0x39')],qs['fields'](_0x2c02f6['query'][_0x3464('0x3a')]));_0x260929[_0x3464('0x3b')]=_0x260929['attributes'][_0x3464('0x3c')]?_0x260929[_0x3464('0x3b')]:_0x5415fb[_0x3464('0x39')];if(_0x2c02f6['query'][_0x3464('0x45')]){_0x260929[_0x3464('0x46')]=[{'all':!![]}];}_0x260929=_['merge']({},_0x260929,_0x2c02f6['options']);return db[_0x3464('0x31')]['find'](_0x260929)[_0x3464('0x29')](handleEntityNotFound(_0x1a7744,null))[_0x3464('0x29')](respondWithResult(_0x1a7744,null))[_0x3464('0x48')](handleError(_0x1a7744,null));};exports[_0x3464('0x4b')]=function(_0x5406ed,_0xd5fc6f){return db[_0x3464('0x31')][_0x3464('0x4b')](_0x5406ed[_0x3464('0x4c')],{})['then'](function(_0x49d00b){var _0x2b3c3d=_0x5406ed[_0x3464('0x4d')][_0x3464('0x2b')]({'plain':!![]});if(!_0x2b3c3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b3c3d['role']===_0x3464('0x4d')){var _0x177658=_0x49d00b[_0x3464('0x2b')]({'plain':!![]});var _0xa01a53=_0x3464('0x2c');return db['UserProfileSection'][_0x3464('0x4e')]({'where':{'name':_0xa01a53,'userProfileId':_0x2b3c3d['userProfileId']},'raw':!![]})[_0x3464('0x29')](function(_0x20c87d){if(_0x20c87d&&_0x20c87d['autoAssociation']===0x0){return db[_0x3464('0x2d')]['create']({'name':_0x177658[_0x3464('0x2f')],'resourceId':_0x177658['id'],'type':_0x20c87d[_0x3464('0x2f')],'sectionId':_0x20c87d['id']},{})['then'](function(){return _0x49d00b;});}else{return _0x49d00b;}})[_0x3464('0x48')](function(_0x3bb140){logger[_0x3464('0x4f')](_0x3464('0x50'),_0x3bb140);throw _0x3bb140;});}return _0x49d00b;})[_0x3464('0x29')](respondWithResult(_0xd5fc6f,0xc9))[_0x3464('0x48')](handleError(_0xd5fc6f,null));};exports[_0x3464('0x51')]=function(_0x3c394a,_0x5b6595){var _0x31e36b={'where':{'id':_0x3c394a[_0x3464('0x4a')]['id']}},_0x5566e2={};_0x5566e2[_0x3464('0x39')]=_[_0x3464('0x36')](db[_0x3464('0x31')][_0x3464('0x32')]);_0x31e36b[_0x3464('0x3b')]=_[_0x3464('0x38')](_0x5566e2[_0x3464('0x39')],qs[_0x3464('0x3a')](_0x3c394a[_0x3464('0x35')]['fields']));_0x31e36b[_0x3464('0x3b')]=_0x31e36b[_0x3464('0x3b')][_0x3464('0x3c')]?_0x31e36b['attributes']:_0x5566e2[_0x3464('0x39')];if(_0x3c394a[_0x3464('0x35')][_0x3464('0x45')]){_0x31e36b[_0x3464('0x46')]=[{'all':!![]}];}_0x31e36b=_[_0x3464('0x43')]({},_0x31e36b,_0x3c394a[_0x3464('0x44')]);return db[_0x3464('0x31')]['find'](_0x31e36b)[_0x3464('0x29')](handleEntityNotFound(_0x5b6595,null))[_0x3464('0x29')](function(_0x1e9515){if(_0x1e9515){var _0x1966c4=_0x1e9515[_0x3464('0x2b')]({'plain':!![]});_0x1966c4=qs[_0x3464('0x52')](_0x1966c4,['id','createdAt','updatedAt']);_0x3c394a[_0x3464('0x4c')]=_[_0x3464('0x52')](_0x3c394a[_0x3464('0x4c')],['id',_0x3464('0x53'),_0x3464('0x54')]);return db['Dashboard'][_0x3464('0x4b')](_[_0x3464('0x43')](_0x1966c4,_0x3c394a[_0x3464('0x4c')]),{'include':_0x3c394a[_0x3464('0x35')][_0x3464('0x45')]?[{'all':!![]}]:undefined})[_0x3464('0x29')](function(_0x5aceb1){var _0x1ca163=_0x3c394a[_0x3464('0x4d')][_0x3464('0x2b')]({'plain':!![]});if(!_0x1ca163)throw new Error(_0x3464('0x55'));if(_0x1ca163[_0x3464('0x56')]==='user'){var _0x1fef8e=_0x5aceb1['get']({'plain':!![]});var _0x47a703=_0x3464('0x2c');return db[_0x3464('0x57')]['find']({'where':{'name':_0x47a703,'userProfileId':_0x1ca163[_0x3464('0x58')]},'raw':!![]})[_0x3464('0x29')](function(_0x24beee){if(_0x24beee&&_0x24beee[_0x3464('0x59')]===0x0){return db['UserProfileResource'][_0x3464('0x4b')]({'name':_0x1fef8e['name'],'resourceId':_0x1fef8e['id'],'type':_0x24beee[_0x3464('0x2f')],'sectionId':_0x24beee['id']},{})['then'](function(){return _0x5aceb1;});}else{return _0x5aceb1;}})[_0x3464('0x48')](function(_0x41c6c2){logger[_0x3464('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41c6c2);throw _0x41c6c2;});}return _0x5aceb1;});}})[_0x3464('0x29')](respondWithResult(_0x5b6595,0xc9))[_0x3464('0x48')](handleError(_0x5b6595,null));};exports[_0x3464('0x28')]=function(_0x564044,_0x4c7072){if(_0x564044[_0x3464('0x4c')]['id']){delete _0x564044[_0x3464('0x4c')]['id'];}return db[_0x3464('0x31')][_0x3464('0x4e')]({'where':{'id':_0x564044[_0x3464('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c7072,null))['then'](saveUpdates(_0x564044[_0x3464('0x4c')],null))['then'](respondWithResult(_0x4c7072,null))[_0x3464('0x48')](handleError(_0x4c7072,null));};exports[_0x3464('0x2a')]=function(_0x393c21,_0x3491a2){return db[_0x3464('0x31')][_0x3464('0x4e')]({'where':{'id':_0x393c21[_0x3464('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3491a2,null))[_0x3464('0x29')](removeEntity(_0x3491a2,null))[_0x3464('0x48')](handleError(_0x3491a2,null));};function widgetAttributes(_0x5b29d5){try{switch(_0x5b29d5['type']){case _0x3464('0x5a'):return[{'name':_0x3464('0x5b'),'value':_0x5b29d5[_0x3464('0x5b')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0][_0x3464('0x5d')]:undefined)||'https://'}];case'custom':return[{'name':_0x3464('0x5e'),'value':_0x5b29d5[_0x3464('0x5e')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0][_0x3464('0x5d')]:undefined)||''}];case _0x3464('0x5f'):return[{'name':_0x3464('0x60'),'value':_0x5b29d5[_0x3464('0x60')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0][_0x3464('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x3464('0x61'),'value':_0x5b29d5[_0x3464('0x61')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x1]?_0x5b29d5[_0x3464('0x5c')][0x1]['value']:undefined)||_0x3464('0x62')},{'name':_0x3464('0x63'),'value':_0x5b29d5[_0x3464('0x63')]||(_0x5b29d5['attrs']&&_0x5b29d5['attrs'][0x2]?_0x5b29d5[_0x3464('0x5c')][0x2][_0x3464('0x5d')]:undefined)||0xc}];case _0x3464('0x64'):return[{'name':_0x3464('0x65'),'value':_0x5b29d5['attrMetric']||(_0x5b29d5['attrs']&&_0x5b29d5[_0x3464('0x5c')][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0][_0x3464('0x5d')]:undefined)||_0x3464('0x66')},{'name':_0x3464('0x67'),'value':_0x5b29d5[_0x3464('0x67')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x1]?_0x5b29d5[_0x3464('0x5c')][0x1][_0x3464('0x5d')]:undefined)||[]},{'name':_0x3464('0x63'),'value':_0x5b29d5[_0x3464('0x63')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x2]?_0x5b29d5[_0x3464('0x5c')][0x2][_0x3464('0x5d')]:undefined)||0x14},{'name':_0x3464('0x68'),'value':_0x5b29d5[_0x3464('0x68')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x3]?_0x5b29d5['attrs'][0x3]['value']:undefined)||_0x3464('0x69')},{'name':_0x3464('0x6a'),'value':_0x5b29d5['attrEmailAccounts']||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x4]?_0x5b29d5[_0x3464('0x5c')][0x4][_0x3464('0x5d')]:undefined)||''},{'name':_0x3464('0x6b'),'value':_0x5b29d5['attrFaxAccounts']||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x5]?_0x5b29d5[_0x3464('0x5c')][0x5]['value']:undefined)||''},{'name':_0x3464('0x6c'),'value':_0x5b29d5[_0x3464('0x6c')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x6]?_0x5b29d5[_0x3464('0x5c')][0x6][_0x3464('0x5d')]:undefined)||''},{'name':_0x3464('0x6d'),'value':_0x5b29d5[_0x3464('0x6d')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x7]?_0x5b29d5[_0x3464('0x5c')][0x7][_0x3464('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5b29d5[_0x3464('0x6e')]||(_0x5b29d5['attrs']&&_0x5b29d5[_0x3464('0x5c')][0x8]?_0x5b29d5['attrs'][0x8]['value']:undefined)||''},{'name':_0x3464('0x6f'),'value':_0x5b29d5[_0x3464('0x6f')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x9]?_0x5b29d5[_0x3464('0x5c')][0x9][_0x3464('0x5d')]:undefined)||''}];case _0x3464('0x70'):case _0x3464('0x71'):return[{'name':_0x3464('0x72'),'value':_0x5b29d5[_0x3464('0x72')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0][_0x3464('0x5d')]:undefined)||_0x3464('0x66')},{'name':'attrSerie2','value':_0x5b29d5[_0x3464('0x73')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x1]?_0x5b29d5[_0x3464('0x5c')][0x1]['value']:undefined)||null},{'name':_0x3464('0x74'),'value':_0x5b29d5['attrSerie3']||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x2]?_0x5b29d5['attrs'][0x2]['value']:undefined)||null},{'name':_0x3464('0x67'),'value':_0x5b29d5['attrVoiceQueues']||(_0x5b29d5['attrs']&&_0x5b29d5[_0x3464('0x5c')][0x3]?_0x5b29d5[_0x3464('0x5c')][0x3][_0x3464('0x5d')]:undefined)||[]},{'name':_0x3464('0x68'),'value':_0x5b29d5[_0x3464('0x68')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x4]?_0x5b29d5['attrs'][0x4]['value']:undefined)||_0x3464('0x69')},{'name':_0x3464('0x6a'),'value':_0x5b29d5[_0x3464('0x6a')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x5]?_0x5b29d5[_0x3464('0x5c')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5b29d5['attrFaxAccounts']||(_0x5b29d5['attrs']&&_0x5b29d5[_0x3464('0x5c')][0x6]?_0x5b29d5['attrs'][0x6][_0x3464('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5b29d5[_0x3464('0x6c')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x7]?_0x5b29d5['attrs'][0x7][_0x3464('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5b29d5[_0x3464('0x6d')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x8]?_0x5b29d5[_0x3464('0x5c')][0x8]['value']:undefined)||''},{'name':_0x3464('0x6e'),'value':_0x5b29d5[_0x3464('0x6e')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x9]?_0x5b29d5[_0x3464('0x5c')][0x9][_0x3464('0x5d')]:undefined)||''},{'name':_0x3464('0x6f'),'value':_0x5b29d5[_0x3464('0x6f')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0xa]?_0x5b29d5['attrs'][0xa][_0x3464('0x5d')]:undefined)||''}];case _0x3464('0x75'):return[{'name':_0x3464('0x76'),'type':_0x5b29d5[_0x3464('0x77')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5['attrs'][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0][_0x3464('0x33')]:undefined)||null,'value':_0x5b29d5[_0x3464('0x76')]||(_0x5b29d5[_0x3464('0x5c')]&&_0x5b29d5[_0x3464('0x5c')][0x0]?_0x5b29d5[_0x3464('0x5c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x5b29d5['attrRefresh']||(_0x5b29d5['attrs']&&_0x5b29d5['attrs'][0x1]?_0x5b29d5[_0x3464('0x5c')][0x1][_0x3464('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x18344b){logger[_0x3464('0x4f')](_0x3464('0x78'),JSON['stringify'](_0x18344b));return[];}}exports[_0x3464('0x79')]=function(_0x17c7d0,_0x3381b5,_0x52d73a){if(_0x17c7d0[_0x3464('0x4c')]['id']){delete _0x17c7d0['body']['id'];}return db['Dashboard'][_0x3464('0x4e')]({'where':{'id':_0x17c7d0[_0x3464('0x4a')]['id']}})[_0x3464('0x29')](handleEntityNotFound(_0x3381b5,null))['then'](function(_0x45b9a0){if(_0x45b9a0){_0x17c7d0[_0x3464('0x4c')][_0x3464('0x7a')]=_0x45b9a0['id'];_0x17c7d0[_0x3464('0x4c')][_0x3464('0x5c')]=widgetAttributes(_0x17c7d0[_0x3464('0x4c')]);return db[_0x3464('0x7b')][_0x3464('0x4b')](_0x17c7d0['body']);}})[_0x3464('0x29')](respondWithResult(_0x3381b5,null))[_0x3464('0x48')](handleError(_0x3381b5,null));};exports['getItems']=function(_0x3994ca,_0x3efacb,_0x10c917){var _0x450893={};var _0x476a08={};var _0x3874ae;var _0x594177;return db[_0x3464('0x31')][_0x3464('0x7c')]({'where':{'id':_0x3994ca['params']['id']}})[_0x3464('0x29')](handleEntityNotFound(_0x3efacb,null))[_0x3464('0x29')](function(_0x4aceac){if(_0x4aceac){_0x3874ae=_0x4aceac;_0x476a08[_0x3464('0x39')]=_[_0x3464('0x36')](db['DashboardItem']['rawAttributes']);_0x476a08[_0x3464('0x35')]=_[_0x3464('0x36')](_0x3994ca['query']);_0x476a08['filters']=_[_0x3464('0x38')](_0x476a08[_0x3464('0x39')],_0x476a08[_0x3464('0x35')]);_0x450893[_0x3464('0x3b')]=_[_0x3464('0x38')](_0x476a08[_0x3464('0x39')],qs['fields'](_0x3994ca[_0x3464('0x35')][_0x3464('0x3a')]));_0x450893[_0x3464('0x3b')]=_0x450893[_0x3464('0x3b')][_0x3464('0x3c')]?_0x450893['attributes']:_0x476a08[_0x3464('0x39')];_0x450893[_0x3464('0x3f')]=qs[_0x3464('0x40')](_0x3994ca[_0x3464('0x35')][_0x3464('0x40')]);_0x450893[_0x3464('0x41')]=qs[_0x3464('0x37')](_[_0x3464('0x7d')](_0x3994ca[_0x3464('0x35')],_0x476a08[_0x3464('0x37')]));if(_0x3994ca[_0x3464('0x35')][_0x3464('0x42')]){_0x450893[_0x3464('0x41')]=_[_0x3464('0x43')](_0x450893[_0x3464('0x41')],{'$or':_[_0x3464('0x30')](_0x450893[_0x3464('0x3b')],function(_0x19e98e){var _0x31f1aa={};_0x31f1aa[_0x19e98e]={'$like':'%'+_0x3994ca['query'][_0x3464('0x42')]+'%'};return _0x31f1aa;})});}_0x450893=_[_0x3464('0x43')]({},_0x450893,_0x3994ca[_0x3464('0x44')]);return _0x3874ae['getItems'](_0x450893);}})[_0x3464('0x29')](function(_0x3597bb){if(_0x3597bb){_0x594177=_0x3597bb[_0x3464('0x3c')];if(!_0x3994ca[_0x3464('0x35')][_0x3464('0x3d')](_0x3464('0x3e'))){_0x450893[_0x3464('0x22')]=qs['limit'](_0x3994ca[_0x3464('0x35')][_0x3464('0x22')]);_0x450893[_0x3464('0x20')]=qs['offset'](_0x3994ca[_0x3464('0x35')][_0x3464('0x20')]);}return _0x3874ae[_0x3464('0x7e')](_0x450893);}})[_0x3464('0x29')](function(_0xd7a167){if(_0xd7a167){return _0xd7a167?{'count':_0x594177,'rows':_0xd7a167}:null;}})[_0x3464('0x29')](respondWithResult(_0x3efacb,null))[_0x3464('0x48')](handleError(_0x3efacb,null));}; \ No newline at end of file +var _0xa62d=['redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','rawAttributes','pick','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb'];(function(_0x11ddf7,_0x4e3a75){var _0x39bfd7=function(_0x2de089){while(--_0x2de089){_0x11ddf7['push'](_0x11ddf7['shift']());}};_0x39bfd7(++_0x4e3a75);}(_0xa62d,0x170));var _0xda62=function(_0x29b5e4,_0x3ef737){_0x29b5e4=_0x29b5e4-0x0;var _0x46c3c0=_0xa62d[_0x29b5e4];return _0x46c3c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda62('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda62('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xda62('0x2'));var util=require(_0xda62('0x3'));var path=require(_0xda62('0x4'));var sox=require(_0xda62('0x5'));var csv=require(_0xda62('0x6'));var ejs=require(_0xda62('0x7'));var fs=require('fs');var fs_extra=require(_0xda62('0x8'));var _=require(_0xda62('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda62('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xda62('0x6'));var querystring=require('querystring');var Papa=require(_0xda62('0xb'));var Redis=require('ioredis');var authService=require(_0xda62('0xc'));var qs=require(_0xda62('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda62('0xe'));var logger=require(_0xda62('0xf'))(_0xda62('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda62('0x11'));var db=require(_0xda62('0x12'))['db'];config[_0xda62('0x13')]=_[_0xda62('0x14')](config[_0xda62('0x13')],{'host':_0xda62('0x15'),'port':0x18eb});var socket=require(_0xda62('0x16'))(new Redis(config[_0xda62('0x13')]));require(_0xda62('0x17'))[_0xda62('0x18')](socket);function respondWithStatusCode(_0x1e7dcd,_0x25c8b){_0x25c8b=_0x25c8b||0xcc;return function(_0x1665ac){if(_0x1665ac){return _0x1e7dcd[_0xda62('0x19')](_0x25c8b);}return _0x1e7dcd[_0xda62('0x1a')](_0x25c8b)[_0xda62('0x1b')]();};}function respondWithResult(_0x153c17,_0x245956){_0x245956=_0x245956||0xc8;return function(_0x42add1){if(_0x42add1){return _0x153c17[_0xda62('0x1a')](_0x245956)[_0xda62('0x1c')](_0x42add1);}};}function respondWithFilteredResult(_0x5c6f22,_0x4e3d8e){return function(_0x1fa5b1){if(_0x1fa5b1){var _0x648e7a=typeof _0x4e3d8e[_0xda62('0x1d')]===_0xda62('0x1e')&&typeof _0x4e3d8e[_0xda62('0x1f')]==='undefined';var _0x209334=_0x1fa5b1[_0xda62('0x20')];var _0x5b996e=_0x648e7a?0x0:_0x4e3d8e[_0xda62('0x1d')];var _0x22b426=_0x648e7a?_0x1fa5b1[_0xda62('0x20')]:_0x4e3d8e[_0xda62('0x1d')]+_0x4e3d8e['limit'];var _0x3c9fa4;if(_0x22b426>=_0x209334){_0x22b426=_0x209334;_0x3c9fa4=0xc8;}else{_0x3c9fa4=0xce;}_0x5c6f22[_0xda62('0x1a')](_0x3c9fa4);return _0x5c6f22[_0xda62('0x21')](_0xda62('0x22'),_0x5b996e+'-'+_0x22b426+'/'+_0x209334)[_0xda62('0x1c')](_0x1fa5b1);}return null;};}function patchUpdates(_0x49d922){return function(_0x55b6df){try{jsonpatch[_0xda62('0x23')](_0x55b6df,_0x49d922,!![]);}catch(_0xe8771c){return BPromise[_0xda62('0x24')](_0xe8771c);}return _0x55b6df[_0xda62('0x25')]();};}function saveUpdates(_0x3732ef,_0x291b22){return function(_0x1ffbb2){if(_0x1ffbb2){return _0x1ffbb2[_0xda62('0x26')](_0x3732ef)[_0xda62('0x27')](function(_0x19c5c6){return _0x19c5c6;});}return null;};}function removeEntity(_0x6749b2,_0x47a13f){return function(_0x4ae658){if(_0x4ae658){return _0x4ae658[_0xda62('0x28')]()[_0xda62('0x27')](function(){var _0x407606=_0x4ae658['get']({'plain':!![]});var _0xf0a5c4='CustomDashboards';return db[_0xda62('0x29')][_0xda62('0x28')]({'where':{'type':_0xf0a5c4,'resourceId':_0x407606['id']}})[_0xda62('0x27')](function(){return _0x4ae658;});})[_0xda62('0x27')](function(){_0x6749b2[_0xda62('0x1a')](0xcc)[_0xda62('0x1b')]();});}};}function handleEntityNotFound(_0x9744c0,_0x4dfa83){return function(_0x3f564d){if(!_0x3f564d){_0x9744c0['sendStatus'](0x194);}return _0x3f564d;};}function handleError(_0x36c107,_0x46cd35){_0x46cd35=_0x46cd35||0x1f4;return function(_0x236ea2){logger[_0xda62('0x2a')](_0x236ea2[_0xda62('0x2b')]);if(_0x236ea2['name']){delete _0x236ea2[_0xda62('0x2c')];}_0x36c107['status'](_0x46cd35)[_0xda62('0x2d')](_0x236ea2);};}exports[_0xda62('0x2e')]=function(_0x5bbabd,_0x49c88f){var _0x1f1e9d={},_0xb0bc0c={},_0x3e0c4a={'count':0x0,'rows':[]};var _0x3523c8=_[_0xda62('0x2f')](db[_0xda62('0x30')]['rawAttributes'],function(_0x1ee501){return{'name':_0x1ee501[_0xda62('0x31')],'type':_0x1ee501[_0xda62('0x32')][_0xda62('0x33')]};});_0xb0bc0c[_0xda62('0x34')]=_[_0xda62('0x2f')](_0x3523c8,_0xda62('0x2c'));_0xb0bc0c[_0xda62('0x35')]=_[_0xda62('0x36')](_0x5bbabd[_0xda62('0x35')]);_0xb0bc0c[_0xda62('0x37')]=_[_0xda62('0x38')](_0xb0bc0c[_0xda62('0x34')],_0xb0bc0c[_0xda62('0x35')]);_0x1f1e9d[_0xda62('0x39')]=_[_0xda62('0x38')](_0xb0bc0c['model'],qs[_0xda62('0x3a')](_0x5bbabd[_0xda62('0x35')][_0xda62('0x3a')]));_0x1f1e9d[_0xda62('0x39')]=_0x1f1e9d[_0xda62('0x39')]['length']?_0x1f1e9d['attributes']:_0xb0bc0c[_0xda62('0x34')];if(!_0x5bbabd[_0xda62('0x35')][_0xda62('0x3b')](_0xda62('0x3c'))){_0x1f1e9d[_0xda62('0x1f')]=qs['limit'](_0x5bbabd[_0xda62('0x35')][_0xda62('0x1f')]);_0x1f1e9d['offset']=qs[_0xda62('0x1d')](_0x5bbabd[_0xda62('0x35')][_0xda62('0x1d')]);}_0x1f1e9d[_0xda62('0x3d')]=qs[_0xda62('0x3e')](_0x5bbabd[_0xda62('0x35')][_0xda62('0x3e')]);_0x1f1e9d[_0xda62('0x3f')]=qs['filters'](_['pick'](_0x5bbabd[_0xda62('0x35')],_0xb0bc0c[_0xda62('0x37')]),_0x3523c8);if(_0x5bbabd[_0xda62('0x35')][_0xda62('0x40')]){_0x1f1e9d[_0xda62('0x3f')]=_[_0xda62('0x41')](_0x1f1e9d[_0xda62('0x3f')],{'$or':_['map'](_0x3523c8,function(_0x229a99){if(_0x229a99[_0xda62('0x32')]!=='VIRTUAL'){var _0x2a3b15={};_0x2a3b15[_0x229a99[_0xda62('0x2c')]]={'$like':'%'+_0x5bbabd['query'][_0xda62('0x40')]+'%'};return _0x2a3b15;}})});}_0x1f1e9d=_[_0xda62('0x41')]({},_0x1f1e9d,_0x5bbabd[_0xda62('0x42')]);var _0x1ccd8f={'where':_0x1f1e9d['where']};return db[_0xda62('0x30')][_0xda62('0x20')](_0x1ccd8f)[_0xda62('0x27')](function(_0x2fc1f9){_0x3e0c4a[_0xda62('0x20')]=_0x2fc1f9;if(_0x5bbabd['query'][_0xda62('0x43')]){_0x1f1e9d[_0xda62('0x44')]=[{'all':!![]}];}return db[_0xda62('0x30')][_0xda62('0x45')](_0x1f1e9d);})[_0xda62('0x27')](function(_0x265024){_0x3e0c4a[_0xda62('0x46')]=_0x265024;return _0x3e0c4a;})[_0xda62('0x27')](respondWithFilteredResult(_0x49c88f,_0x1f1e9d))['catch'](handleError(_0x49c88f,null));};exports[_0xda62('0x47')]=function(_0x240dc8,_0xf94253){var _0x28891d={'raw':![],'where':{'id':_0x240dc8[_0xda62('0x48')]['id']}},_0x3ff665={};_0x3ff665['model']=_[_0xda62('0x36')](db['Dashboard']['rawAttributes']);_0x3ff665['query']=_['keys'](_0x240dc8[_0xda62('0x35')]);_0x3ff665[_0xda62('0x37')]=_[_0xda62('0x38')](_0x3ff665['model'],_0x3ff665[_0xda62('0x35')]);_0x28891d[_0xda62('0x39')]=_['intersection'](_0x3ff665[_0xda62('0x34')],qs['fields'](_0x240dc8[_0xda62('0x35')][_0xda62('0x3a')]));_0x28891d[_0xda62('0x39')]=_0x28891d[_0xda62('0x39')][_0xda62('0x49')]?_0x28891d[_0xda62('0x39')]:_0x3ff665[_0xda62('0x34')];if(_0x240dc8[_0xda62('0x35')][_0xda62('0x43')]){_0x28891d[_0xda62('0x44')]=[{'all':!![]}];}_0x28891d=_[_0xda62('0x41')]({},_0x28891d,_0x240dc8[_0xda62('0x42')]);return db['Dashboard'][_0xda62('0x4a')](_0x28891d)[_0xda62('0x27')](handleEntityNotFound(_0xf94253,null))[_0xda62('0x27')](respondWithResult(_0xf94253,null))[_0xda62('0x4b')](handleError(_0xf94253,null));};exports[_0xda62('0x4c')]=function(_0x17f032,_0x5ae6d0){return db[_0xda62('0x30')][_0xda62('0x4c')](_0x17f032[_0xda62('0x4d')],{})[_0xda62('0x27')](function(_0x5e5ac6){var _0x526de9=_0x17f032[_0xda62('0x4e')][_0xda62('0x4f')]({'plain':!![]});if(!_0x526de9)throw new Error(_0xda62('0x50'));if(_0x526de9[_0xda62('0x51')]===_0xda62('0x4e')){var _0x45864f=_0x5e5ac6['get']({'plain':!![]});var _0xeefbd1=_0xda62('0x52');return db[_0xda62('0x53')][_0xda62('0x4a')]({'where':{'name':_0xeefbd1,'userProfileId':_0x526de9[_0xda62('0x54')]},'raw':!![]})[_0xda62('0x27')](function(_0x15d6a6){if(_0x15d6a6&&_0x15d6a6[_0xda62('0x55')]===0x0){return db[_0xda62('0x29')][_0xda62('0x4c')]({'name':_0x45864f[_0xda62('0x2c')],'resourceId':_0x45864f['id'],'type':_0x15d6a6['name'],'sectionId':_0x15d6a6['id']},{})[_0xda62('0x27')](function(){return _0x5e5ac6;});}else{return _0x5e5ac6;}})[_0xda62('0x4b')](function(_0x516288){logger['error'](_0xda62('0x56'),_0x516288);throw _0x516288;});}return _0x5e5ac6;})[_0xda62('0x27')](respondWithResult(_0x5ae6d0,0xc9))[_0xda62('0x4b')](handleError(_0x5ae6d0,null));};exports[_0xda62('0x57')]=function(_0xca4f62,_0x520788){var _0x47f97b={'where':{'id':_0xca4f62['params']['id']}},_0x3d84a9={};_0x3d84a9[_0xda62('0x34')]=_['keys'](db[_0xda62('0x30')]['rawAttributes']);_0x47f97b[_0xda62('0x39')]=_[_0xda62('0x38')](_0x3d84a9['model'],qs[_0xda62('0x3a')](_0xca4f62[_0xda62('0x35')][_0xda62('0x3a')]));_0x47f97b[_0xda62('0x39')]=_0x47f97b['attributes'][_0xda62('0x49')]?_0x47f97b[_0xda62('0x39')]:_0x3d84a9['model'];if(_0xca4f62['query']['includeAll']){_0x47f97b[_0xda62('0x44')]=[{'all':!![]}];}_0x47f97b=_['merge']({},_0x47f97b,_0xca4f62[_0xda62('0x42')]);return db['Dashboard'][_0xda62('0x4a')](_0x47f97b)[_0xda62('0x27')](handleEntityNotFound(_0x520788,null))[_0xda62('0x27')](function(_0x428762){if(_0x428762){var _0x17d4b1=_0x428762[_0xda62('0x4f')]({'plain':!![]});_0x17d4b1=qs[_0xda62('0x58')](_0x17d4b1,['id',_0xda62('0x59'),_0xda62('0x5a')]);_0xca4f62['body']=_[_0xda62('0x58')](_0xca4f62[_0xda62('0x4d')],['id',_0xda62('0x59'),_0xda62('0x5a')]);return db[_0xda62('0x30')]['create'](_['merge'](_0x17d4b1,_0xca4f62[_0xda62('0x4d')]),{'include':_0xca4f62[_0xda62('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xda62('0x27')](function(_0x14ed46){var _0x4bcbf8=_0xca4f62[_0xda62('0x4e')][_0xda62('0x4f')]({'plain':!![]});if(!_0x4bcbf8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bcbf8[_0xda62('0x51')]==='user'){var _0x18c6f3=_0x14ed46[_0xda62('0x4f')]({'plain':!![]});var _0x144c15=_0xda62('0x52');return db['UserProfileSection'][_0xda62('0x4a')]({'where':{'name':_0x144c15,'userProfileId':_0x4bcbf8[_0xda62('0x54')]},'raw':!![]})['then'](function(_0x4e94b2){if(_0x4e94b2&&_0x4e94b2[_0xda62('0x55')]===0x0){return db[_0xda62('0x29')][_0xda62('0x4c')]({'name':_0x18c6f3[_0xda62('0x2c')],'resourceId':_0x18c6f3['id'],'type':_0x4e94b2[_0xda62('0x2c')],'sectionId':_0x4e94b2['id']},{})['then'](function(){return _0x14ed46;});}else{return _0x14ed46;}})[_0xda62('0x4b')](function(_0x2767ab){logger[_0xda62('0x2a')](_0xda62('0x56'),_0x2767ab);throw _0x2767ab;});}return _0x14ed46;});}})['then'](respondWithResult(_0x520788,0xc9))[_0xda62('0x4b')](handleError(_0x520788,null));};exports[_0xda62('0x26')]=function(_0xa69ebb,_0x46daee){if(_0xa69ebb['body']['id']){delete _0xa69ebb[_0xda62('0x4d')]['id'];}return db[_0xda62('0x30')][_0xda62('0x4a')]({'where':{'id':_0xa69ebb[_0xda62('0x48')]['id']}})[_0xda62('0x27')](handleEntityNotFound(_0x46daee,null))[_0xda62('0x27')](saveUpdates(_0xa69ebb['body'],null))[_0xda62('0x27')](respondWithResult(_0x46daee,null))['catch'](handleError(_0x46daee,null));};exports[_0xda62('0x28')]=function(_0x4904a1,_0x2fda6a){return db['Dashboard'][_0xda62('0x4a')]({'where':{'id':_0x4904a1[_0xda62('0x48')]['id']}})[_0xda62('0x27')](handleEntityNotFound(_0x2fda6a,null))[_0xda62('0x27')](removeEntity(_0x2fda6a,null))[_0xda62('0x4b')](handleError(_0x2fda6a,null));};function widgetAttributes(_0x4566eb){try{switch(_0x4566eb[_0xda62('0x32')]){case'iframe':return[{'name':_0xda62('0x5b'),'value':_0x4566eb[_0xda62('0x5b')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb['attrs'][0x0][_0xda62('0x5d')]:undefined)||'https://'}];case _0xda62('0x5e'):return[{'name':_0xda62('0x5f'),'value':_0x4566eb[_0xda62('0x5f')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0]['value']:undefined)||''}];case _0xda62('0x60'):return[{'name':_0xda62('0x61'),'value':_0x4566eb['attrHourFormat']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0][_0xda62('0x5d')]:undefined)||_0xda62('0x62')},{'name':_0xda62('0x63'),'value':_0x4566eb['attrTimezone']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||'0.00'},{'name':_0xda62('0x64'),'value':_0x4566eb[_0xda62('0x64')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x2]?_0x4566eb['attrs'][0x2]['value']:undefined)||0xc}];case _0xda62('0x65'):return[{'name':_0xda62('0x66'),'value':_0x4566eb['attrMetric']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb['attrs'][0x0][_0xda62('0x5d')]:undefined)||_0xda62('0x67')},{'name':_0xda62('0x68'),'value':_0x4566eb['attrVoiceQueues']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||[]},{'name':_0xda62('0x64'),'value':_0x4566eb[_0xda62('0x64')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x2]?_0x4566eb[_0xda62('0x5c')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x4566eb[_0xda62('0x69')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x3]?_0x4566eb[_0xda62('0x5c')][0x3]['value']:undefined)||'voice'},{'name':_0xda62('0x6a'),'value':_0x4566eb[_0xda62('0x6a')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x4]?_0x4566eb[_0xda62('0x5c')][0x4][_0xda62('0x5d')]:undefined)||''},{'name':_0xda62('0x6b'),'value':_0x4566eb[_0xda62('0x6b')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x5]?_0x4566eb[_0xda62('0x5c')][0x5][_0xda62('0x5d')]:undefined)||''},{'name':_0xda62('0x6c'),'value':_0x4566eb[_0xda62('0x6c')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x6]?_0x4566eb['attrs'][0x6]['value']:undefined)||''},{'name':_0xda62('0x6d'),'value':_0x4566eb[_0xda62('0x6d')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x7]?_0x4566eb[_0xda62('0x5c')][0x7]['value']:undefined)||''},{'name':_0xda62('0x6e'),'value':_0x4566eb[_0xda62('0x6e')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x8]?_0x4566eb[_0xda62('0x5c')][0x8][_0xda62('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4566eb[_0xda62('0x6f')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x9]?_0x4566eb['attrs'][0x9]['value']:undefined)||''}];case _0xda62('0x70'):case _0xda62('0x71'):return[{'name':'attrSerie1','value':_0x4566eb[_0xda62('0x72')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x0]?_0x4566eb[_0xda62('0x5c')][0x0]['value']:undefined)||'total'},{'name':_0xda62('0x73'),'value':_0x4566eb[_0xda62('0x73')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||null},{'name':_0xda62('0x74'),'value':_0x4566eb[_0xda62('0x74')]||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x2]?_0x4566eb['attrs'][0x2]['value']:undefined)||null},{'name':_0xda62('0x68'),'value':_0x4566eb['attrVoiceQueues']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x3]?_0x4566eb['attrs'][0x3][_0xda62('0x5d')]:undefined)||[]},{'name':_0xda62('0x69'),'value':_0x4566eb['attrChannel']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x4]?_0x4566eb[_0xda62('0x5c')][0x4][_0xda62('0x5d')]:undefined)||_0xda62('0x75')},{'name':'attrEmailAccounts','value':_0x4566eb[_0xda62('0x6a')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x5]?_0x4566eb[_0xda62('0x5c')][0x5][_0xda62('0x5d')]:undefined)||''},{'name':_0xda62('0x6b'),'value':_0x4566eb[_0xda62('0x6b')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x6]?_0x4566eb[_0xda62('0x5c')][0x6][_0xda62('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4566eb[_0xda62('0x6c')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x7]?_0x4566eb[_0xda62('0x5c')][0x7]['value']:undefined)||''},{'name':_0xda62('0x6d'),'value':_0x4566eb[_0xda62('0x6d')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0x8]?_0x4566eb[_0xda62('0x5c')][0x8]['value']:undefined)||''},{'name':_0xda62('0x6e'),'value':_0x4566eb['attrWhatsappAccounts']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x9]?_0x4566eb[_0xda62('0x5c')][0x9]['value']:undefined)||''},{'name':_0xda62('0x6f'),'value':_0x4566eb[_0xda62('0x6f')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb['attrs'][0xa]?_0x4566eb[_0xda62('0x5c')][0xa][_0xda62('0x5d')]:undefined)||''}];case _0xda62('0x76'):return[{'name':_0xda62('0x77'),'type':_0x4566eb['reportType']||(_0x4566eb['attrs']&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0]['type']:undefined)||null,'value':_0x4566eb[_0xda62('0x77')]||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x0]?_0x4566eb[_0xda62('0x5c')][0x0][_0xda62('0x5d')]:undefined)||null},{'name':_0xda62('0x78'),'value':_0x4566eb['attrRefresh']||(_0x4566eb[_0xda62('0x5c')]&&_0x4566eb[_0xda62('0x5c')][0x1]?_0x4566eb[_0xda62('0x5c')][0x1][_0xda62('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x10f985){logger[_0xda62('0x2a')](_0xda62('0x79'),JSON[_0xda62('0x7a')](_0x10f985));return[];}}exports['addItem']=function(_0x529d67,_0x594827,_0x253e7c){if(_0x529d67[_0xda62('0x4d')]['id']){delete _0x529d67[_0xda62('0x4d')]['id'];}return db[_0xda62('0x30')][_0xda62('0x4a')]({'where':{'id':_0x529d67[_0xda62('0x48')]['id']}})[_0xda62('0x27')](handleEntityNotFound(_0x594827,null))['then'](function(_0x289941){if(_0x289941){_0x529d67['body'][_0xda62('0x7b')]=_0x289941['id'];_0x529d67[_0xda62('0x4d')][_0xda62('0x5c')]=widgetAttributes(_0x529d67[_0xda62('0x4d')]);return db[_0xda62('0x7c')][_0xda62('0x4c')](_0x529d67['body']);}})[_0xda62('0x27')](respondWithResult(_0x594827,null))[_0xda62('0x4b')](handleError(_0x594827,null));};exports[_0xda62('0x7d')]=function(_0xc42db6,_0xffdc12,_0x463f65){var _0x27a2dd={};var _0x23eeda={};var _0x3f7b01;var _0x2c0572;return db[_0xda62('0x30')][_0xda62('0x7e')]({'where':{'id':_0xc42db6[_0xda62('0x48')]['id']}})['then'](handleEntityNotFound(_0xffdc12,null))['then'](function(_0x1c3465){if(_0x1c3465){_0x3f7b01=_0x1c3465;_0x23eeda[_0xda62('0x34')]=_[_0xda62('0x36')](db['DashboardItem'][_0xda62('0x7f')]);_0x23eeda[_0xda62('0x35')]=_[_0xda62('0x36')](_0xc42db6[_0xda62('0x35')]);_0x23eeda[_0xda62('0x37')]=_[_0xda62('0x38')](_0x23eeda[_0xda62('0x34')],_0x23eeda[_0xda62('0x35')]);_0x27a2dd[_0xda62('0x39')]=_[_0xda62('0x38')](_0x23eeda[_0xda62('0x34')],qs[_0xda62('0x3a')](_0xc42db6[_0xda62('0x35')][_0xda62('0x3a')]));_0x27a2dd[_0xda62('0x39')]=_0x27a2dd['attributes'][_0xda62('0x49')]?_0x27a2dd[_0xda62('0x39')]:_0x23eeda[_0xda62('0x34')];_0x27a2dd[_0xda62('0x3d')]=qs[_0xda62('0x3e')](_0xc42db6[_0xda62('0x35')][_0xda62('0x3e')]);_0x27a2dd['where']=qs[_0xda62('0x37')](_[_0xda62('0x80')](_0xc42db6[_0xda62('0x35')],_0x23eeda[_0xda62('0x37')]));if(_0xc42db6[_0xda62('0x35')][_0xda62('0x40')]){_0x27a2dd[_0xda62('0x3f')]=_['merge'](_0x27a2dd[_0xda62('0x3f')],{'$or':_[_0xda62('0x2f')](_0x27a2dd[_0xda62('0x39')],function(_0x220234){var _0x1f9405={};_0x1f9405[_0x220234]={'$like':'%'+_0xc42db6[_0xda62('0x35')]['filter']+'%'};return _0x1f9405;})});}_0x27a2dd=_[_0xda62('0x41')]({},_0x27a2dd,_0xc42db6['options']);return _0x3f7b01[_0xda62('0x7d')](_0x27a2dd);}})[_0xda62('0x27')](function(_0x57c301){if(_0x57c301){_0x2c0572=_0x57c301['length'];if(!_0xc42db6[_0xda62('0x35')][_0xda62('0x3b')](_0xda62('0x3c'))){_0x27a2dd[_0xda62('0x1f')]=qs[_0xda62('0x1f')](_0xc42db6[_0xda62('0x35')][_0xda62('0x1f')]);_0x27a2dd[_0xda62('0x1d')]=qs[_0xda62('0x1d')](_0xc42db6['query'][_0xda62('0x1d')]);}return _0x3f7b01['getItems'](_0x27a2dd);}})[_0xda62('0x27')](function(_0x1a962a){if(_0x1a962a){return _0x1a962a?{'count':_0x2c0572,'rows':_0x1a962a}:null;}})['then'](respondWithResult(_0xffdc12,null))[_0xda62('0x4b')](handleError(_0xffdc12,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e232b4f..65d5e67 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 _0xf12f=['emit','hasOwnProperty','exports','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x301342,_0x345fbe){var _0x1a2b18=function(_0x5851ef){while(--_0x5851ef){_0x301342['push'](_0x301342['shift']());}};_0x1a2b18(++_0x345fbe);}(_0xf12f,0x78));var _0xff12=function(_0x4ff374,_0x3ab262){_0x4ff374=_0x4ff374-0x0;var _0x49a4b5=_0xf12f[_0x4ff374];return _0x49a4b5;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xff12('0x0'))['db'][_0xff12('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xff12('0x2')](0x0);var events={'afterCreate':_0xff12('0x3'),'afterUpdate':_0xff12('0x4'),'afterDestroy':_0xff12('0x5')};function emitEvent(_0x1ac709){return function(_0x1a3b9d,_0x21f61e,_0x484c1a){DashboardEvents[_0xff12('0x6')](_0x1ac709+':'+_0x1a3b9d['id'],_0x1a3b9d);DashboardEvents[_0xff12('0x6')](_0x1ac709,_0x1a3b9d);_0x484c1a(null);};}for(var e in events){if(events[_0xff12('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xff12('0x8')]=DashboardEvents; \ No newline at end of file +var _0xe7e4=['setMaxListeners','save','remove','emit','hook','exports','events','Dashboard'];(function(_0x5b45df,_0x2623ba){var _0x1d7de0=function(_0x481a25){while(--_0x481a25){_0x5b45df['push'](_0x5b45df['shift']());}};_0x1d7de0(++_0x2623ba);}(_0xe7e4,0x1be));var _0x4e7e=function(_0x293ac7,_0xb6da39){_0x293ac7=_0x293ac7-0x0;var _0x525884=_0xe7e4[_0x293ac7];return _0x525884;};'use strict';var EventEmitter=require(_0x4e7e('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x4e7e('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4e7e('0x2')](0x0);var events={'afterCreate':_0x4e7e('0x3'),'afterUpdate':'update','afterDestroy':_0x4e7e('0x4')};function emitEvent(_0x2316e6){return function(_0x1afc5d,_0x59fd25,_0x2e4be9){DashboardEvents[_0x4e7e('0x5')](_0x2316e6+':'+_0x1afc5d['id'],_0x1afc5d);DashboardEvents['emit'](_0x2316e6,_0x1afc5d);_0x2e4be9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x4e7e('0x6')](e,emitEvent(event));}}module[_0x4e7e('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 89956bc..8e62bfe 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 _0x7c87=['dashboards','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x65bc87,_0x67eeb6){var _0x245ebc=function(_0x185206){while(--_0x185206){_0x65bc87['push'](_0x65bc87['shift']());}};_0x245ebc(++_0x67eeb6);}(_0x7c87,0x1a1));var _0x77c8=function(_0x563fda,_0x3bdcdc){_0x563fda=_0x563fda-0x0;var _0x1f6ee4=_0x7c87[_0x563fda];return _0x1f6ee4;};'use strict';var _=require(_0x77c8('0x0'));var util=require(_0x77c8('0x1'));var logger=require(_0x77c8('0x2'))(_0x77c8('0x3'));var moment=require(_0x77c8('0x4'));var BPromise=require('bluebird');var rp=require(_0x77c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77c8('0x6'));var config=require(_0x77c8('0x7'));var attributes=require(_0x77c8('0x8'));module[_0x77c8('0x9')]=function(_0x51635f,_0x128c99){return _0x51635f[_0x77c8('0xa')](_0x77c8('0xb'),attributes,{'tableName':_0x77c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33d2=['path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4062ed,_0x1e0bb7){var _0x4d308d=function(_0x1227ab){while(--_0x1227ab){_0x4062ed['push'](_0x4062ed['shift']());}};_0x4d308d(++_0x1e0bb7);}(_0x33d2,0x7f));var _0x233d=function(_0x34c3f3,_0x15f139){_0x34c3f3=_0x34c3f3-0x0;var _0x3ca5cb=_0x33d2[_0x34c3f3];return _0x3ca5cb;};'use strict';var _=require(_0x233d('0x0'));var util=require(_0x233d('0x1'));var logger=require(_0x233d('0x2'))('api');var moment=require(_0x233d('0x3'));var BPromise=require(_0x233d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x233d('0x5'));var rimraf=require(_0x233d('0x6'));var config=require(_0x233d('0x7'));var attributes=require(_0x233d('0x8'));module[_0x233d('0x9')]=function(_0x3f311b,_0x15ba43){return _0x3f311b[_0x233d('0xa')]('Dashboard',attributes,{'tableName':_0x233d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e0f51de..fd4d370 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 _0xe5bc=['jayson/promise','client','redis','localhost','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x356c2b,_0x37af7b){var _0x3e07a4=function(_0x3b5d24){while(--_0x3b5d24){_0x356c2b['push'](_0x356c2b['shift']());}};_0x3e07a4(++_0x37af7b);}(_0xe5bc,0x8c));var _0xce5b=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0xe5bc[_0x55cc58];return _0x26062e;};'use strict';var _=require(_0xce5b('0x0'));var util=require(_0xce5b('0x1'));var moment=require(_0xce5b('0x2'));var BPromise=require(_0xce5b('0x3'));var rs=require(_0xce5b('0x4'));var fs=require('fs');var Redis=require(_0xce5b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xce5b('0x6'));var logger=require(_0xce5b('0x7'))(_0xce5b('0x8'));var config=require(_0xce5b('0x9'));var jayson=require(_0xce5b('0xa'));var client=jayson[_0xce5b('0xb')]['http']({'port':0x232a});config[_0xce5b('0xc')]=_['defaults'](config[_0xce5b('0xc')],{'host':_0xce5b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce5b('0xc')]));require('./dashboard.socket')[_0xce5b('0xe')](socket);function respondWithRpcPromise(_0x2eb030,_0x18ff3a,_0x30de58){return new BPromise(function(_0x438e03,_0x21fde4){return client[_0xce5b('0xf')](_0x2eb030,_0x30de58)[_0xce5b('0x10')](function(_0x27c7ce){logger[_0xce5b('0x11')](_0xce5b('0x12'),_0x18ff3a,_0xce5b('0x13'));logger[_0xce5b('0x14')](_0xce5b('0x15'),_0x18ff3a,'request\x20sent',JSON['stringify'](_0x27c7ce));if(_0x27c7ce[_0xce5b('0x16')]){if(_0x27c7ce[_0xce5b('0x16')]['code']===0x1f4){logger[_0xce5b('0x16')]('Dashboard,\x20%s,\x20%s',_0x18ff3a,_0x27c7ce[_0xce5b('0x16')][_0xce5b('0x17')]);return _0x21fde4(_0x27c7ce['error'][_0xce5b('0x17')]);}logger[_0xce5b('0x16')](_0xce5b('0x12'),_0x18ff3a,_0x27c7ce[_0xce5b('0x16')][_0xce5b('0x17')]);return _0x438e03(_0x27c7ce['error'][_0xce5b('0x17')]);}else{logger[_0xce5b('0x11')](_0xce5b('0x12'),_0x18ff3a,_0xce5b('0x13'));_0x438e03(_0x27c7ce['result']['message']);}})[_0xce5b('0x18')](function(_0x43f674){logger['error'](_0xce5b('0x12'),_0x18ff3a,_0x43f674);_0x21fde4(_0x43f674);});});} \ No newline at end of file +var _0x9547=['./dashboard.socket','request','Dashboard,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x85eeab,_0x367d2a){var _0x5b1338=function(_0x207d98){while(--_0x207d98){_0x85eeab['push'](_0x85eeab['shift']());}};_0x5b1338(++_0x367d2a);}(_0x9547,0xd9));var _0x7954=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x9547[_0x35387d];return _0x3aba56;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7954('0x0'));var BPromise=require(_0x7954('0x1'));var rs=require(_0x7954('0x2'));var fs=require('fs');var Redis=require(_0x7954('0x3'));var db=require(_0x7954('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7954('0x5'))(_0x7954('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7954('0x7')][_0x7954('0x8')]({'port':0x232a});config[_0x7954('0x9')]=_[_0x7954('0xa')](config[_0x7954('0x9')],{'host':_0x7954('0xb'),'port':0x18eb});var socket=require(_0x7954('0xc'))(new Redis(config[_0x7954('0x9')]));require(_0x7954('0xd'))['register'](socket);function respondWithRpcPromise(_0x112b14,_0x4febff,_0x26a18e){return new BPromise(function(_0x1279db,_0x5e3a09){return client[_0x7954('0xe')](_0x112b14,_0x26a18e)['then'](function(_0x3180d0){logger['info'](_0x7954('0xf'),_0x4febff,_0x7954('0x10'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x4febff,_0x7954('0x10'),JSON[_0x7954('0x11')](_0x3180d0));if(_0x3180d0[_0x7954('0x12')]){if(_0x3180d0['error'][_0x7954('0x13')]===0x1f4){logger[_0x7954('0x12')](_0x7954('0xf'),_0x4febff,_0x3180d0['error'][_0x7954('0x14')]);return _0x5e3a09(_0x3180d0[_0x7954('0x12')][_0x7954('0x14')]);}logger[_0x7954('0x12')](_0x7954('0xf'),_0x4febff,_0x3180d0['error'][_0x7954('0x14')]);return _0x1279db(_0x3180d0[_0x7954('0x12')][_0x7954('0x14')]);}else{logger[_0x7954('0x15')](_0x7954('0xf'),_0x4febff,_0x7954('0x10'));_0x1279db(_0x3180d0['result'][_0x7954('0x14')]);}})[_0x7954('0x16')](function(_0x42a840){logger[_0x7954('0x12')]('Dashboard,\x20%s,\x20%s',_0x4febff,_0x42a840);_0x5e3a09(_0x42a840);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2484423..a09a1c0 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 _0xeed7=['./dashboard.events','save','remove','update','emit','removeListener','length','dashboard:'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xeed7,0x188));var _0x7eed=function(_0x828468,_0x11bc0e){_0x828468=_0x828468-0x0;var _0x859765=_0xeed7[_0x828468];return _0x859765;};'use strict';var DashboardEvents=require(_0x7eed('0x0'));var events=[_0x7eed('0x1'),_0x7eed('0x2'),_0x7eed('0x3')];function createListener(_0x34257d,_0x3ca6d9){return function(_0xb6d2ef){_0x3ca6d9[_0x7eed('0x4')](_0x34257d,_0xb6d2ef);};}function removeListener(_0xa43536,_0x24f9b1){return function(){DashboardEvents[_0x7eed('0x5')](_0xa43536,_0x24f9b1);};}exports['register']=function(_0x2ef2d2){for(var _0x112b13=0x0,_0x2c9f47=events[_0x7eed('0x6')];_0x112b13<_0x2c9f47;_0x112b13++){var _0x58747f=events[_0x112b13];var _0x3e50b7=createListener(_0x7eed('0x7')+_0x58747f,_0x2ef2d2);DashboardEvents['on'](_0x58747f,_0x3e50b7);}}; \ No newline at end of file +var _0x6633=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x551322,_0x365709){var _0x2b8cf6=function(_0x3e4d71){while(--_0x3e4d71){_0x551322['push'](_0x551322['shift']());}};_0x2b8cf6(++_0x365709);}(_0x6633,0xd1));var _0x3663=function(_0x36472f,_0x50db34){_0x36472f=_0x36472f-0x0;var _0x5e31b6=_0x6633[_0x36472f];return _0x5e31b6;};'use strict';var DashboardEvents=require(_0x3663('0x0'));var events=[_0x3663('0x1'),_0x3663('0x2'),_0x3663('0x3')];function createListener(_0x30169d,_0x300eea){return function(_0x32bbe2){_0x300eea[_0x3663('0x4')](_0x30169d,_0x32bbe2);};}function removeListener(_0x36a1e6,_0x303627){return function(){DashboardEvents[_0x3663('0x5')](_0x36a1e6,_0x303627);};}exports[_0x3663('0x6')]=function(_0x5f5c65){for(var _0x49985f=0x0,_0x583c1f=events['length'];_0x49985f<_0x583c1f;_0x49985f++){var _0x38f616=events[_0x49985f];var _0x2e3b2d=createListener(_0x3663('0x7')+_0x38f616,_0x5f5c65);DashboardEvents['on'](_0x38f616,_0x2e3b2d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 28f3add..e7de1a9 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 _0xce7d=['index','isAuthenticated','/:id/items','getItems','clone','post','addItem','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x28b930,_0x19b05f){var _0x112256=function(_0x3b3f61){while(--_0x3b3f61){_0x28b930['push'](_0x28b930['shift']());}};_0x112256(++_0x19b05f);}(_0xce7d,0x171));var _0xdce7=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xce7d[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xdce7('0x0'));var util=require(_0xdce7('0x1'));var path=require(_0xdce7('0x2'));var timeout=require('connect-timeout');var express=require(_0xdce7('0x3'));var router=express[_0xdce7('0x4')]();var fs_extra=require(_0xdce7('0x5'));var auth=require(_0xdce7('0x6'));var interaction=require(_0xdce7('0x7'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0xdce7('0x8')]('/',auth['isAuthenticated'](),controller[_0xdce7('0x9')]);router[_0xdce7('0x8')]('/:id',auth[_0xdce7('0xa')](),controller['show']);router[_0xdce7('0x8')](_0xdce7('0xb'),auth['isAuthenticated'](),controller[_0xdce7('0xc')]);router['post']('/',auth[_0xdce7('0xa')](),controller['create']);router['post']('/:id/clone',auth[_0xdce7('0xa')](),controller[_0xdce7('0xd')]);router[_0xdce7('0xe')](_0xdce7('0xb'),auth[_0xdce7('0xa')](),controller[_0xdce7('0xf')]);router[_0xdce7('0x10')](_0xdce7('0x11'),auth[_0xdce7('0xa')](),controller[_0xdce7('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdce7('0x13')]);module[_0xdce7('0x14')]=router; \ No newline at end of file +var _0x9001=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','/:id/clone','put','update','destroy','exports','multer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9001,0x92));var _0x1900=function(_0x1d791b,_0x5797b4){_0x1d791b=_0x1d791b-0x0;var _0x44c2a2=_0x9001[_0x1d791b];return _0x44c2a2;};'use strict';var multer=require(_0x1900('0x0'));var util=require('util');var path=require(_0x1900('0x1'));var timeout=require(_0x1900('0x2'));var express=require(_0x1900('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1900('0x4'));var interaction=require(_0x1900('0x5'));var config=require(_0x1900('0x6'));var controller=require(_0x1900('0x7'));router[_0x1900('0x8')]('/',auth[_0x1900('0x9')](),controller[_0x1900('0xa')]);router['get'](_0x1900('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1900('0x8')](_0x1900('0xc'),auth[_0x1900('0x9')](),controller[_0x1900('0xd')]);router[_0x1900('0xe')]('/',auth[_0x1900('0x9')](),controller[_0x1900('0xf')]);router[_0x1900('0xe')](_0x1900('0x10'),auth['isAuthenticated'](),controller['clone']);router[_0x1900('0xe')](_0x1900('0xc'),auth[_0x1900('0x9')](),controller['addItem']);router[_0x1900('0x11')](_0x1900('0xb'),auth[_0x1900('0x9')](),controller[_0x1900('0x12')]);router['delete'](_0x1900('0xb'),auth['isAuthenticated'](),controller[_0x1900('0x13')]);module[_0x1900('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index fbff78f..24d5a2f 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 _0x90b1=['#2196f3','sequelize','squel','lodash','STRING','TEXT','long','parse','setDataValue','attrs','stringify','INTEGER','#ffffff'];(function(_0x31d707,_0x733c2b){var _0x3ff20d=function(_0x42de7a){while(--_0x42de7a){_0x31d707['push'](_0x31d707['shift']());}};_0x3ff20d(++_0x733c2b);}(_0x90b1,0x1bb));var _0x190b=function(_0x1c0b7c,_0x29c88b){_0x1c0b7c=_0x1c0b7c-0x0;var _0x113efd=_0x90b1[_0x1c0b7c];return _0x113efd;};'use strict';var Sequelize=require(_0x190b('0x0'));var squel=require(_0x190b('0x1'));var _=require(_0x190b('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x190b('0x4')](_0x190b('0x5')),'get':function(){try{return JSON[_0x190b('0x6')](this['getDataValue']('attrs'));}catch(_0x5cbebb){return[];}},'set':function(_0x5da9c1){try{this[_0x190b('0x7')](_0x190b('0x8'),JSON[_0x190b('0x9')](_0x5da9c1));}catch(_0x626aa1){this[_0x190b('0x7')](_0x190b('0x8'),JSON[_0x190b('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x190b('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x190b('0xa')]},'col':{'type':Sequelize[_0x190b('0xa')]},'background':{'type':Sequelize[_0x190b('0x3')],'allowNull':![],'defaultValue':_0x190b('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x190b('0x3')],'allowNull':![],'defaultValue':_0x190b('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x190b('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x46ed=['sequelize','squel','exports','STRING','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0xd46e('0x0'));var squel=require(_0xd46e('0x1'));var _=require('lodash');module[_0xd46e('0x2')]={'title':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd46e('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xd46e('0x4')),'get':function(){try{return JSON[_0xd46e('0x5')](this['getDataValue'](_0xd46e('0x6')));}catch(_0x1926d9){return[];}},'set':function(_0x160bcf){try{this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')](_0x160bcf));}catch(_0x437ea0){this[_0xd46e('0x7')](_0xd46e('0x6'),JSON[_0xd46e('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xd46e('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xd46e('0x9')]},'col':{'type':Sequelize[_0xd46e('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd46e('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xd46e('0x3')],'allowNull':![],'defaultValue':_0xd46e('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xd46e('0x3')]},'titleFontSize':{'type':Sequelize[_0xd46e('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 1236d07..b923b0e 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 _0x22da=['attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','stringify','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','set','reject','update','then','destroy','sendStatus','stack','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','include','merge','catch','find','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22da,0x80));var _0xa22d=function(_0x5f5174,_0x4d8a80){_0x5f5174=_0x5f5174-0x0;var _0x2bc9ea=_0x22da[_0x5f5174];return _0x2bc9ea;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa22d('0x0'));var jsonpatch=require(_0xa22d('0x1'));var rp=require(_0xa22d('0x2'));var moment=require(_0xa22d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa22d('0x4'));var util=require(_0xa22d('0x5'));var path=require(_0xa22d('0x6'));var sox=require(_0xa22d('0x7'));var csv=require('to-csv');var ejs=require(_0xa22d('0x8'));var fs=require('fs');var fs_extra=require(_0xa22d('0x9'));var _=require('lodash');var squel=require(_0xa22d('0xa'));var crypto=require(_0xa22d('0xb'));var jsforce=require(_0xa22d('0xc'));var deskjs=require(_0xa22d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa22d('0xe'));var Redis=require(_0xa22d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa22d('0x10'));var as=require(_0xa22d('0x11'));var hardwareService=require(_0xa22d('0x12'));var logger=require(_0xa22d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa22d('0x14'));var licenseUtil=require(_0xa22d('0x15'));var db=require('../../mysqldb')['db'];config[_0xa22d('0x16')]=_['defaults'](config[_0xa22d('0x16')],{'host':_0xa22d('0x17'),'port':0x18eb});var socket=require(_0xa22d('0x18'))(new Redis(config['redis']));require(_0xa22d('0x19'))[_0xa22d('0x1a')](socket);function respondWithStatusCode(_0xc0d11d,_0x335de0){_0x335de0=_0x335de0||0xcc;return function(_0x41f7a1){if(_0x41f7a1){return _0xc0d11d['sendStatus'](_0x335de0);}return _0xc0d11d[_0xa22d('0x1b')](_0x335de0)[_0xa22d('0x1c')]();};}function respondWithResult(_0x2af5c6,_0x627117){_0x627117=_0x627117||0xc8;return function(_0x14a1a7){if(_0x14a1a7){return _0x2af5c6[_0xa22d('0x1b')](_0x627117)[_0xa22d('0x1d')](_0x14a1a7);}};}function respondWithFilteredResult(_0x5e56a6,_0x34ce60){return function(_0x3d78b9){if(_0x3d78b9){var _0xf50354=typeof _0x34ce60[_0xa22d('0x1e')]===_0xa22d('0x1f')&&typeof _0x34ce60[_0xa22d('0x20')]===_0xa22d('0x1f');var _0x184604=_0x3d78b9['count'];var _0x177a0f=_0xf50354?0x0:_0x34ce60[_0xa22d('0x1e')];var _0xd96a44=_0xf50354?_0x3d78b9['count']:_0x34ce60['offset']+_0x34ce60['limit'];var _0x2cd394;if(_0xd96a44>=_0x184604){_0xd96a44=_0x184604;_0x2cd394=0xc8;}else{_0x2cd394=0xce;}_0x5e56a6[_0xa22d('0x1b')](_0x2cd394);return _0x5e56a6[_0xa22d('0x21')]('Content-Range',_0x177a0f+'-'+_0xd96a44+'/'+_0x184604)[_0xa22d('0x1d')](_0x3d78b9);}return null;};}function patchUpdates(_0x45f528){return function(_0x16404e){try{jsonpatch['apply'](_0x16404e,_0x45f528,!![]);}catch(_0xdb2773){return BPromise[_0xa22d('0x22')](_0xdb2773);}return _0x16404e['save']();};}function saveUpdates(_0x24701d,_0x18a585){return function(_0xf9b2e){if(_0xf9b2e){return _0xf9b2e[_0xa22d('0x23')](_0x24701d)[_0xa22d('0x24')](function(_0x1c83e8){return _0x1c83e8;});}return null;};}function removeEntity(_0x55f1ce,_0x58aa49){return function(_0x47ca5f){if(_0x47ca5f){return _0x47ca5f[_0xa22d('0x25')]()[_0xa22d('0x24')](function(){_0x55f1ce[_0xa22d('0x1b')](0xcc)[_0xa22d('0x1c')]();});}};}function handleEntityNotFound(_0x33b1c9,_0x291763){return function(_0x2ff235){if(!_0x2ff235){_0x33b1c9[_0xa22d('0x26')](0x194);}return _0x2ff235;};}function handleError(_0x447a72,_0x31789f){_0x31789f=_0x31789f||0x1f4;return function(_0x594ac5){logger['error'](_0x594ac5[_0xa22d('0x27')]);if(_0x594ac5['name']){delete _0x594ac5['name'];}_0x447a72[_0xa22d('0x1b')](_0x31789f)[_0xa22d('0x28')](_0x594ac5);};}exports[_0xa22d('0x29')]=function(_0x12a0f6,_0x1614f4){var _0x1892f8={'raw':![],'where':{'id':_0x12a0f6[_0xa22d('0x2a')]['id']}},_0x1ef634={};_0x1ef634['model']=_[_0xa22d('0x2b')](db[_0xa22d('0x2c')][_0xa22d('0x2d')]);_0x1ef634[_0xa22d('0x2e')]=_[_0xa22d('0x2b')](_0x12a0f6[_0xa22d('0x2e')]);_0x1ef634[_0xa22d('0x2f')]=_[_0xa22d('0x30')](_0x1ef634[_0xa22d('0x31')],_0x1ef634[_0xa22d('0x2e')]);_0x1892f8['attributes']=_[_0xa22d('0x30')](_0x1ef634[_0xa22d('0x31')],qs[_0xa22d('0x32')](_0x12a0f6[_0xa22d('0x2e')][_0xa22d('0x32')]));_0x1892f8[_0xa22d('0x33')]=_0x1892f8['attributes'][_0xa22d('0x34')]?_0x1892f8[_0xa22d('0x33')]:_0x1ef634['model'];if(_0x12a0f6[_0xa22d('0x2e')]['includeAll']){_0x1892f8[_0xa22d('0x35')]=[{'all':!![]}];}_0x1892f8=_[_0xa22d('0x36')]({},_0x1892f8,_0x12a0f6['options']);return db[_0xa22d('0x2c')]['find'](_0x1892f8)[_0xa22d('0x24')](handleEntityNotFound(_0x1614f4,null))[_0xa22d('0x24')](respondWithResult(_0x1614f4,null))[_0xa22d('0x37')](handleError(_0x1614f4,null));};exports[_0xa22d('0x25')]=function(_0x2aec5f,_0x4f93fc){return db[_0xa22d('0x2c')][_0xa22d('0x38')]({'where':{'id':_0x2aec5f['params']['id']}})[_0xa22d('0x24')](handleEntityNotFound(_0x4f93fc,null))[_0xa22d('0x24')](removeEntity(_0x4f93fc,null))['catch'](handleError(_0x4f93fc,null));};function widgetAttributes(_0x263ea2){try{switch(_0x263ea2[_0xa22d('0x39')]){case'iframe':return[{'name':'attrUrl','value':_0x263ea2[_0xa22d('0x3a')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x0]?_0x263ea2[_0xa22d('0x3b')][0x0][_0xa22d('0x3c')]:undefined)||_0xa22d('0x3d')}];case _0xa22d('0x3e'):return[{'name':_0xa22d('0x3f'),'value':_0x263ea2[_0xa22d('0x3f')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x0]?_0x263ea2[_0xa22d('0x3b')][0x0][_0xa22d('0x3c')]:undefined)||''}];case _0xa22d('0x40'):return[{'name':_0xa22d('0x41'),'value':_0x263ea2['attrHourFormat']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x0]?_0x263ea2[_0xa22d('0x3b')][0x0][_0xa22d('0x3c')]:undefined)||_0xa22d('0x42')},{'name':_0xa22d('0x43'),'value':_0x263ea2[_0xa22d('0x43')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x1]?_0x263ea2[_0xa22d('0x3b')][0x1][_0xa22d('0x3c')]:undefined)||'0.00'},{'name':_0xa22d('0x44'),'value':_0x263ea2[_0xa22d('0x44')]||(_0x263ea2['attrs']&&_0x263ea2[_0xa22d('0x3b')][0x2]?_0x263ea2['attrs'][0x2][_0xa22d('0x3c')]:undefined)||0xc}];case _0xa22d('0x45'):return[{'name':_0xa22d('0x46'),'value':_0x263ea2['attrMetric']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x0]?_0x263ea2['attrs'][0x0][_0xa22d('0x3c')]:undefined)||_0xa22d('0x47')},{'name':_0xa22d('0x48'),'value':_0x263ea2[_0xa22d('0x48')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x1]?_0x263ea2[_0xa22d('0x3b')][0x1][_0xa22d('0x3c')]:undefined)||[]},{'name':'attrFontSize','value':_0x263ea2['attrFontSize']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x2]?_0x263ea2[_0xa22d('0x3b')][0x2]['value']:undefined)||0x14},{'name':_0xa22d('0x49'),'value':_0x263ea2['attrChannel']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x3]?_0x263ea2[_0xa22d('0x3b')][0x3][_0xa22d('0x3c')]:undefined)||_0xa22d('0x4a')},{'name':_0xa22d('0x4b'),'value':_0x263ea2[_0xa22d('0x4b')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x4]?_0x263ea2[_0xa22d('0x3b')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x263ea2[_0xa22d('0x4c')]||(_0x263ea2['attrs']&&_0x263ea2[_0xa22d('0x3b')][0x5]?_0x263ea2['attrs'][0x5][_0xa22d('0x3c')]:undefined)||''},{'name':_0xa22d('0x4d'),'value':_0x263ea2['attrSmsAccounts']||(_0x263ea2['attrs']&&_0x263ea2[_0xa22d('0x3b')][0x6]?_0x263ea2['attrs'][0x6][_0xa22d('0x3c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x263ea2[_0xa22d('0x4e')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x7]?_0x263ea2[_0xa22d('0x3b')][0x7][_0xa22d('0x3c')]:undefined)||''},{'name':_0xa22d('0x4f'),'value':_0x263ea2[_0xa22d('0x4f')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x8]?_0x263ea2['attrs'][0x8][_0xa22d('0x3c')]:undefined)||''},{'name':_0xa22d('0x50'),'value':_0x263ea2[_0xa22d('0x50')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x9]?_0x263ea2[_0xa22d('0x3b')][0x9][_0xa22d('0x3c')]:undefined)||''}];case _0xa22d('0x51'):case _0xa22d('0x52'):return[{'name':_0xa22d('0x53'),'value':_0x263ea2['attrSerie1']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x0]?_0x263ea2[_0xa22d('0x3b')][0x0][_0xa22d('0x3c')]:undefined)||_0xa22d('0x47')},{'name':_0xa22d('0x54'),'value':_0x263ea2[_0xa22d('0x54')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x1]?_0x263ea2[_0xa22d('0x3b')][0x1]['value']:undefined)||null},{'name':_0xa22d('0x55'),'value':_0x263ea2[_0xa22d('0x55')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x2]?_0x263ea2[_0xa22d('0x3b')][0x2][_0xa22d('0x3c')]:undefined)||null},{'name':_0xa22d('0x48'),'value':_0x263ea2['attrVoiceQueues']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x3]?_0x263ea2['attrs'][0x3][_0xa22d('0x3c')]:undefined)||[]},{'name':'attrChannel','value':_0x263ea2[_0xa22d('0x49')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x4]?_0x263ea2[_0xa22d('0x3b')][0x4][_0xa22d('0x3c')]:undefined)||'voice'},{'name':_0xa22d('0x4b'),'value':_0x263ea2[_0xa22d('0x4b')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x5]?_0x263ea2['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x263ea2['attrFaxAccounts']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x6]?_0x263ea2[_0xa22d('0x3b')][0x6]['value']:undefined)||''},{'name':_0xa22d('0x4d'),'value':_0x263ea2[_0xa22d('0x4d')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x7]?_0x263ea2['attrs'][0x7][_0xa22d('0x3c')]:undefined)||''},{'name':_0xa22d('0x4e'),'value':_0x263ea2['attrOpenchannelAccounts']||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x8]?_0x263ea2[_0xa22d('0x3b')][0x8][_0xa22d('0x3c')]:undefined)||''},{'name':_0xa22d('0x4f'),'value':_0x263ea2[_0xa22d('0x4f')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x9]?_0x263ea2[_0xa22d('0x3b')][0x9][_0xa22d('0x3c')]:undefined)||''},{'name':_0xa22d('0x50'),'value':_0x263ea2[_0xa22d('0x50')]||(_0x263ea2['attrs']&&_0x263ea2['attrs'][0xa]?_0x263ea2[_0xa22d('0x3b')][0xa][_0xa22d('0x3c')]:undefined)||''}];case'web-report':return[{'name':_0xa22d('0x56'),'type':_0x263ea2[_0xa22d('0x57')]||(_0x263ea2['attrs']&&_0x263ea2[_0xa22d('0x3b')][0x0]?_0x263ea2[_0xa22d('0x3b')][0x0][_0xa22d('0x39')]:undefined)||null,'value':_0x263ea2[_0xa22d('0x56')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2['attrs'][0x0]?_0x263ea2[_0xa22d('0x3b')][0x0]['value']:undefined)||null},{'name':_0xa22d('0x58'),'value':_0x263ea2[_0xa22d('0x58')]||(_0x263ea2[_0xa22d('0x3b')]&&_0x263ea2[_0xa22d('0x3b')][0x1]?_0x263ea2[_0xa22d('0x3b')][0x1][_0xa22d('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x7d3fab){logger[_0xa22d('0x59')]('widgetAttributes:\x20%s',JSON[_0xa22d('0x5a')](_0x7d3fab));return[];}}exports[_0xa22d('0x5b')]=function(_0x2f4856,_0x2f844e){if(_0x2f4856[_0xa22d('0x5c')]){_0x2f4856[_0xa22d('0x5c')][_0xa22d('0x3b')]=widgetAttributes(_0x2f4856[_0xa22d('0x5c')]);}return db[_0xa22d('0x2c')]['create'](_0x2f4856[_0xa22d('0x5c')],{})[_0xa22d('0x24')](respondWithResult(_0x2f844e,0xc9))[_0xa22d('0x37')](handleError(_0x2f844e,null));};exports[_0xa22d('0x23')]=function(_0x335d3a,_0x5378e8){if(_0x335d3a[_0xa22d('0x5c')]['id']){delete _0x335d3a[_0xa22d('0x5c')]['id'];}_0x335d3a[_0xa22d('0x5c')]['attrs']=widgetAttributes(_0x335d3a[_0xa22d('0x5c')]);return db['DashboardItem']['find']({'where':{'id':_0x335d3a[_0xa22d('0x2a')]['id']}})[_0xa22d('0x24')](handleEntityNotFound(_0x5378e8,null))[_0xa22d('0x24')](saveUpdates(_0x335d3a[_0xa22d('0x5c')],null))[_0xa22d('0x24')](respondWithResult(_0x5378e8,null))['catch'](handleError(_0x5378e8,null));}; \ No newline at end of file +var _0x0adf=['apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x4f6342,_0x1c54e5){var _0xbb2867=function(_0x39f231){while(--_0x39f231){_0x4f6342['push'](_0x4f6342['shift']());}};_0xbb2867(++_0x1c54e5);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3d20ed,_0x30576e){_0x3d20ed=_0x3d20ed-0x0;var _0x4dbbd2=_0x0adf[_0x3d20ed];return _0x4dbbd2;};'use strict';var emlformat=require(_0xf0ad('0x0'));var rimraf=require(_0xf0ad('0x1'));var zipdir=require(_0xf0ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0ad('0x3'));var moment=require(_0xf0ad('0x4'));var BPromise=require(_0xf0ad('0x5'));var Mustache=require(_0xf0ad('0x6'));var util=require(_0xf0ad('0x7'));var path=require(_0xf0ad('0x8'));var sox=require(_0xf0ad('0x9'));var csv=require('to-csv');var ejs=require(_0xf0ad('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0x10'));var querystring=require(_0xf0ad('0x11'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf0ad('0x13'));var as=require(_0xf0ad('0x14'));var hardwareService=require(_0xf0ad('0x15'));var logger=require(_0xf0ad('0x16'))(_0xf0ad('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ad('0x18'));var db=require(_0xf0ad('0x19'))['db'];config[_0xf0ad('0x1a')]=_[_0xf0ad('0x1b')](config['redis'],{'host':_0xf0ad('0x1c'),'port':0x18eb});var socket=require(_0xf0ad('0x1d'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x221d7b,_0x513237){_0x513237=_0x513237||0xcc;return function(_0x1dad7b){if(_0x1dad7b){return _0x221d7b[_0xf0ad('0x1e')](_0x513237);}return _0x221d7b[_0xf0ad('0x1f')](_0x513237)[_0xf0ad('0x20')]();};}function respondWithResult(_0x237dd9,_0x5c23ff){_0x5c23ff=_0x5c23ff||0xc8;return function(_0x1ad9e0){if(_0x1ad9e0){return _0x237dd9[_0xf0ad('0x1f')](_0x5c23ff)[_0xf0ad('0x21')](_0x1ad9e0);}};}function respondWithFilteredResult(_0x1c9fac,_0x47fa2b){return function(_0x4e9970){if(_0x4e9970){var _0x2466e8=typeof _0x47fa2b[_0xf0ad('0x22')]==='undefined'&&typeof _0x47fa2b[_0xf0ad('0x23')]===_0xf0ad('0x24');var _0x9a95bf=_0x4e9970[_0xf0ad('0x25')];var _0x4cc08a=_0x2466e8?0x0:_0x47fa2b['offset'];var _0x3f8cf3=_0x2466e8?_0x4e9970[_0xf0ad('0x25')]:_0x47fa2b[_0xf0ad('0x22')]+_0x47fa2b[_0xf0ad('0x23')];var _0x2ac8ba;if(_0x3f8cf3>=_0x9a95bf){_0x3f8cf3=_0x9a95bf;_0x2ac8ba=0xc8;}else{_0x2ac8ba=0xce;}_0x1c9fac[_0xf0ad('0x1f')](_0x2ac8ba);return _0x1c9fac['set'](_0xf0ad('0x26'),_0x4cc08a+'-'+_0x3f8cf3+'/'+_0x9a95bf)[_0xf0ad('0x21')](_0x4e9970);}return null;};}function patchUpdates(_0x31635b){return function(_0x3ece1e){try{jsonpatch[_0xf0ad('0x27')](_0x3ece1e,_0x31635b,!![]);}catch(_0x88b47b){return BPromise[_0xf0ad('0x28')](_0x88b47b);}return _0x3ece1e[_0xf0ad('0x29')]();};}function saveUpdates(_0x3fc97e,_0x112f20){return function(_0x39b3e8){if(_0x39b3e8){return _0x39b3e8[_0xf0ad('0x2a')](_0x3fc97e)[_0xf0ad('0x2b')](function(_0x456f81){return _0x456f81;});}return null;};}function removeEntity(_0x879f89,_0x557f90){return function(_0x234bc7){if(_0x234bc7){return _0x234bc7[_0xf0ad('0x2c')]()[_0xf0ad('0x2b')](function(){_0x879f89[_0xf0ad('0x1f')](0xcc)[_0xf0ad('0x20')]();});}};}function handleEntityNotFound(_0x30f8ee,_0x560417){return function(_0x2cbe00){if(!_0x2cbe00){_0x30f8ee[_0xf0ad('0x1e')](0x194);}return _0x2cbe00;};}function handleError(_0x2b62,_0x1e60b1){_0x1e60b1=_0x1e60b1||0x1f4;return function(_0x1b6880){logger[_0xf0ad('0x2d')](_0x1b6880[_0xf0ad('0x2e')]);if(_0x1b6880[_0xf0ad('0x2f')]){delete _0x1b6880[_0xf0ad('0x2f')];}_0x2b62[_0xf0ad('0x1f')](_0x1e60b1)[_0xf0ad('0x30')](_0x1b6880);};}exports['show']=function(_0x1a1e1c,_0x5f5115){var _0x83f211={'raw':![],'where':{'id':_0x1a1e1c[_0xf0ad('0x31')]['id']}},_0x57a1f3={};_0x57a1f3[_0xf0ad('0x32')]=_[_0xf0ad('0x33')](db[_0xf0ad('0x34')][_0xf0ad('0x35')]);_0x57a1f3[_0xf0ad('0x36')]=_[_0xf0ad('0x33')](_0x1a1e1c[_0xf0ad('0x36')]);_0x57a1f3['filters']=_['intersection'](_0x57a1f3[_0xf0ad('0x32')],_0x57a1f3[_0xf0ad('0x36')]);_0x83f211[_0xf0ad('0x37')]=_[_0xf0ad('0x38')](_0x57a1f3['model'],qs[_0xf0ad('0x39')](_0x1a1e1c['query'][_0xf0ad('0x39')]));_0x83f211['attributes']=_0x83f211[_0xf0ad('0x37')]['length']?_0x83f211[_0xf0ad('0x37')]:_0x57a1f3[_0xf0ad('0x32')];if(_0x1a1e1c[_0xf0ad('0x36')][_0xf0ad('0x3a')]){_0x83f211[_0xf0ad('0x3b')]=[{'all':!![]}];}_0x83f211=_[_0xf0ad('0x3c')]({},_0x83f211,_0x1a1e1c[_0xf0ad('0x3d')]);return db[_0xf0ad('0x34')]['find'](_0x83f211)[_0xf0ad('0x2b')](handleEntityNotFound(_0x5f5115,null))['then'](respondWithResult(_0x5f5115,null))[_0xf0ad('0x3e')](handleError(_0x5f5115,null));};exports['destroy']=function(_0x3f7e2b,_0x25246b){return db[_0xf0ad('0x34')][_0xf0ad('0x3f')]({'where':{'id':_0x3f7e2b[_0xf0ad('0x31')]['id']}})['then'](handleEntityNotFound(_0x25246b,null))[_0xf0ad('0x2b')](removeEntity(_0x25246b,null))[_0xf0ad('0x3e')](handleError(_0x25246b,null));};function widgetAttributes(_0x1d57d1){try{switch(_0x1d57d1[_0xf0ad('0x40')]){case _0xf0ad('0x41'):return[{'name':_0xf0ad('0x42'),'value':_0x1d57d1[_0xf0ad('0x42')]||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x45')}];case _0xf0ad('0x46'):return[{'name':_0xf0ad('0x47'),'value':_0x1d57d1[_0xf0ad('0x47')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1['attrs'][0x0][_0xf0ad('0x44')]:undefined)||''}];case _0xf0ad('0x48'):return[{'name':_0xf0ad('0x49'),'value':_0x1d57d1['attrHourFormat']||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4a')},{'name':_0xf0ad('0x4b'),'value':_0x1d57d1[_0xf0ad('0x4b')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4c')},{'name':_0xf0ad('0x4d'),'value':_0x1d57d1['attrFontSize']||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x2]?_0x1d57d1[_0xf0ad('0x43')][0x2][_0xf0ad('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0xf0ad('0x4e'),'value':_0x1d57d1[_0xf0ad('0x4e')]||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4f')},{'name':'attrVoiceQueues','value':_0x1d57d1[_0xf0ad('0x50')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||[]},{'name':_0xf0ad('0x4d'),'value':_0x1d57d1[_0xf0ad('0x4d')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x2]?_0x1d57d1[_0xf0ad('0x43')][0x2][_0xf0ad('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x1d57d1[_0xf0ad('0x51')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x3]?_0x1d57d1['attrs'][0x3]['value']:undefined)||_0xf0ad('0x52')},{'name':_0xf0ad('0x53'),'value':_0x1d57d1[_0xf0ad('0x53')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x4]?_0x1d57d1[_0xf0ad('0x43')][0x4][_0xf0ad('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1d57d1[_0xf0ad('0x54')]||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x5]?_0x1d57d1[_0xf0ad('0x43')][0x5][_0xf0ad('0x44')]:undefined)||''},{'name':_0xf0ad('0x55'),'value':_0x1d57d1[_0xf0ad('0x55')]||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x6]?_0x1d57d1[_0xf0ad('0x43')][0x6][_0xf0ad('0x44')]:undefined)||''},{'name':_0xf0ad('0x56'),'value':_0x1d57d1[_0xf0ad('0x56')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x7]?_0x1d57d1[_0xf0ad('0x43')][0x7]['value']:undefined)||''},{'name':_0xf0ad('0x57'),'value':_0x1d57d1[_0xf0ad('0x57')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x8]?_0x1d57d1[_0xf0ad('0x43')][0x8]['value']:undefined)||''},{'name':_0xf0ad('0x58'),'value':_0x1d57d1[_0xf0ad('0x58')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x9]?_0x1d57d1[_0xf0ad('0x43')][0x9][_0xf0ad('0x44')]:undefined)||''}];case _0xf0ad('0x59'):case'pie-chart':return[{'name':_0xf0ad('0x5a'),'value':_0x1d57d1[_0xf0ad('0x5a')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||_0xf0ad('0x4f')},{'name':_0xf0ad('0x5b'),'value':_0x1d57d1[_0xf0ad('0x5b')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||null},{'name':_0xf0ad('0x5c'),'value':_0x1d57d1[_0xf0ad('0x5c')]||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x2]?_0x1d57d1[_0xf0ad('0x43')][0x2][_0xf0ad('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1d57d1[_0xf0ad('0x50')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x3]?_0x1d57d1['attrs'][0x3][_0xf0ad('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x1d57d1['attrChannel']||(_0x1d57d1['attrs']&&_0x1d57d1[_0xf0ad('0x43')][0x4]?_0x1d57d1['attrs'][0x4]['value']:undefined)||_0xf0ad('0x52')},{'name':_0xf0ad('0x53'),'value':_0x1d57d1[_0xf0ad('0x53')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x5]?_0x1d57d1[_0xf0ad('0x43')][0x5][_0xf0ad('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1d57d1[_0xf0ad('0x54')]||(_0x1d57d1['attrs']&&_0x1d57d1['attrs'][0x6]?_0x1d57d1['attrs'][0x6]['value']:undefined)||''},{'name':_0xf0ad('0x55'),'value':_0x1d57d1[_0xf0ad('0x55')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x7]?_0x1d57d1[_0xf0ad('0x43')][0x7][_0xf0ad('0x44')]:undefined)||''},{'name':_0xf0ad('0x56'),'value':_0x1d57d1[_0xf0ad('0x56')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x8]?_0x1d57d1[_0xf0ad('0x43')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1d57d1[_0xf0ad('0x57')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x9]?_0x1d57d1[_0xf0ad('0x43')][0x9][_0xf0ad('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1d57d1[_0xf0ad('0x58')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0xa]?_0x1d57d1['attrs'][0xa][_0xf0ad('0x44')]:undefined)||''}];case _0xf0ad('0x5d'):return[{'name':_0xf0ad('0x5e'),'type':_0x1d57d1[_0xf0ad('0x5f')]||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1[_0xf0ad('0x43')][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x40')]:undefined)||null,'value':_0x1d57d1['attrReport']||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x0]?_0x1d57d1[_0xf0ad('0x43')][0x0][_0xf0ad('0x44')]:undefined)||null},{'name':_0xf0ad('0x60'),'value':_0x1d57d1['attrRefresh']||(_0x1d57d1[_0xf0ad('0x43')]&&_0x1d57d1['attrs'][0x1]?_0x1d57d1[_0xf0ad('0x43')][0x1][_0xf0ad('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3b2e92){logger[_0xf0ad('0x2d')](_0xf0ad('0x61'),JSON[_0xf0ad('0x62')](_0x3b2e92));return[];}}exports[_0xf0ad('0x63')]=function(_0x53d8e0,_0x1ea760){if(_0x53d8e0[_0xf0ad('0x64')]){_0x53d8e0['body'][_0xf0ad('0x43')]=widgetAttributes(_0x53d8e0[_0xf0ad('0x64')]);}return db[_0xf0ad('0x34')][_0xf0ad('0x63')](_0x53d8e0[_0xf0ad('0x64')],{})[_0xf0ad('0x2b')](respondWithResult(_0x1ea760,0xc9))[_0xf0ad('0x3e')](handleError(_0x1ea760,null));};exports[_0xf0ad('0x2a')]=function(_0x8e1333,_0x3b56d3){if(_0x8e1333[_0xf0ad('0x64')]['id']){delete _0x8e1333[_0xf0ad('0x64')]['id'];}_0x8e1333[_0xf0ad('0x64')]['attrs']=widgetAttributes(_0x8e1333[_0xf0ad('0x64')]);return db[_0xf0ad('0x34')][_0xf0ad('0x3f')]({'where':{'id':_0x8e1333[_0xf0ad('0x31')]['id']}})['then'](handleEntityNotFound(_0x3b56d3,null))[_0xf0ad('0x2b')](saveUpdates(_0x8e1333[_0xf0ad('0x64')],null))[_0xf0ad('0x2b')](respondWithResult(_0x3b56d3,null))['catch'](handleError(_0x3b56d3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index bf639b2..73ffa0d 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 _0xbd6b=['save','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x402768,_0x5db78a){var _0x5c6d55=function(_0x50880c){while(--_0x50880c){_0x402768['push'](_0x402768['shift']());}};_0x5c6d55(++_0x5db78a);}(_0xbd6b,0x1ad));var _0xbbd6=function(_0x337ca8,_0x2a7b60){_0x337ca8=_0x337ca8-0x0;var _0xd50979=_0xbd6b[_0x337ca8];return _0xd50979;};'use strict';var EventEmitter=require(_0xbbd6('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xbbd6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbbd6('0x2')](0x0);var events={'afterCreate':_0xbbd6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x20f44a){return function(_0x22ca57,_0x5c3347,_0x271c98){DashboardItemEvents['emit'](_0x20f44a+':'+_0x22ca57['id'],_0x22ca57);DashboardItemEvents[_0xbbd6('0x4')](_0x20f44a,_0x22ca57);_0x271c98(null);};}for(var e in events){if(events[_0xbbd6('0x5')](e)){var event=events[e];DashboardItem[_0xbbd6('0x6')](e,emitEvent(event));}}module[_0xbbd6('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xe35d=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe35d,0xbe));var _0xde35=function(_0x1bc4cc,_0x4e47c2){_0x1bc4cc=_0x1bc4cc-0x0;var _0x7c6009=_0xe35d[_0x1bc4cc];return _0x7c6009;};'use strict';var EventEmitter=require(_0xde35('0x0'));var DashboardItem=require(_0xde35('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xde35('0x2')](0x0);var events={'afterCreate':_0xde35('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ae282){return function(_0xab808f,_0x1920f0,_0x452949){DashboardItemEvents[_0xde35('0x4')](_0x4ae282+':'+_0xab808f['id'],_0xab808f);DashboardItemEvents[_0xde35('0x4')](_0x4ae282,_0xab808f);_0x452949(null);};}for(var e in events){if(events[_0xde35('0x5')](e)){var event=events[e];DashboardItem[_0xde35('0x6')](e,emitEvent(event));}}module[_0xde35('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index da0ab82..84d1f9a 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 _0x9f7e=['DashboardItem','dashboard_items','util','moment','request-promise','path','exports'];(function(_0x53ce70,_0x310ecb){var _0x5bbf99=function(_0xcd9a80){while(--_0xcd9a80){_0x53ce70['push'](_0x53ce70['shift']());}};_0x5bbf99(++_0x310ecb);}(_0x9f7e,0x19f));var _0xe9f7=function(_0x5cbca4,_0x36ae4f){_0x5cbca4=_0x5cbca4-0x0;var _0x71feee=_0x9f7e[_0x5cbca4];return _0x71feee;};'use strict';var _=require('lodash');var util=require(_0xe9f7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe9f7('0x1'));var BPromise=require('bluebird');var rp=require(_0xe9f7('0x2'));var fs=require('fs');var path=require(_0xe9f7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0xe9f7('0x4')]=function(_0xe2c656,_0x571cc7){return _0xe2c656['define'](_0xe9f7('0x5'),attributes,{'tableName':_0xe9f7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9221=['dashboard_items','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem'];(function(_0x6b113f,_0x5edb4d){var _0x73ccd=function(_0x452d89){while(--_0x452d89){_0x6b113f['push'](_0x6b113f['shift']());}};_0x73ccd(++_0x5edb4d);}(_0x9221,0x64));var _0x1922=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x9221[_0x4a3898];return _0x25ceb0;};'use strict';var _=require('lodash');var util=require(_0x1922('0x0'));var logger=require(_0x1922('0x1'))('api');var moment=require(_0x1922('0x2'));var BPromise=require(_0x1922('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1922('0x4'));var rimraf=require(_0x1922('0x5'));var config=require(_0x1922('0x6'));var attributes=require(_0x1922('0x7'));module[_0x1922('0x8')]=function(_0x1944a5,_0x1351a0){return _0x1944a5['define'](_0x1922('0x9'),attributes,{'tableName':_0x1922('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7c5361c..b5f7e61 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 _0xc074=['DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6d930c,_0x45d2db){var _0x43b62d=function(_0xa717a5){while(--_0xa717a5){_0x6d930c['push'](_0x6d930c['shift']());}};_0x43b62d(++_0x45d2db);}(_0xc074,0x1ce));var _0x4c07=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xc074[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c07('0x0'));var BPromise=require(_0x4c07('0x1'));var rs=require(_0x4c07('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c07('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c07('0x4'))('rpc');var config=require(_0x4c07('0x5'));var jayson=require(_0x4c07('0x6'));var client=jayson[_0x4c07('0x7')][_0x4c07('0x8')]({'port':0x232a});config['redis']=_[_0x4c07('0x9')](config[_0x4c07('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x4c07('0xb')](socket);function respondWithRpcPromise(_0x236572,_0x2d454e,_0x546849){return new BPromise(function(_0x44a8ff,_0x369448){return client[_0x4c07('0xc')](_0x236572,_0x546849)[_0x4c07('0xd')](function(_0x2dff4e){logger[_0x4c07('0xe')](_0x4c07('0xf'),_0x2d454e,_0x4c07('0x10'));logger[_0x4c07('0x11')](_0x4c07('0x12'),_0x2d454e,'request\x20sent',JSON['stringify'](_0x2dff4e));if(_0x2dff4e[_0x4c07('0x13')]){if(_0x2dff4e[_0x4c07('0x13')][_0x4c07('0x14')]===0x1f4){logger[_0x4c07('0x13')](_0x4c07('0xf'),_0x2d454e,_0x2dff4e[_0x4c07('0x13')][_0x4c07('0x15')]);return _0x369448(_0x2dff4e[_0x4c07('0x13')]['message']);}logger[_0x4c07('0x13')](_0x4c07('0xf'),_0x2d454e,_0x2dff4e['error'][_0x4c07('0x15')]);return _0x44a8ff(_0x2dff4e['error'][_0x4c07('0x15')]);}else{logger[_0x4c07('0xe')](_0x4c07('0xf'),_0x2d454e,_0x4c07('0x10'));_0x44a8ff(_0x2dff4e[_0x4c07('0x16')][_0x4c07('0x15')]);}})[_0x4c07('0x17')](function(_0xe4f63b){logger[_0x4c07('0x13')]('DashboardItem,\x20%s,\x20%s',_0x2d454e,_0xe4f63b);_0x369448(_0xe4f63b);});});} \ No newline at end of file +var _0x30c1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','request','then','info','request\x20sent','debug','error','code','DashboardItem,\x20%s,\x20%s','message','catch'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x30c1,0x187));var _0x130c=function(_0x457a2e,_0x5b06e0){_0x457a2e=_0x457a2e-0x0;var _0x1c3b03=_0x30c1[_0x457a2e];return _0x1c3b03;};'use strict';var _=require('lodash');var util=require(_0x130c('0x0'));var moment=require(_0x130c('0x1'));var BPromise=require(_0x130c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x130c('0x3'));var db=require(_0x130c('0x4'))['db'];var utils=require(_0x130c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x130c('0x6'));var jayson=require(_0x130c('0x7'));var client=jayson[_0x130c('0x8')][_0x130c('0x9')]({'port':0x232a});config[_0x130c('0xa')]=_[_0x130c('0xb')](config[_0x130c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x130c('0xa')]));require(_0x130c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1009ea,_0x32e4e5,_0x2f7c67){return new BPromise(function(_0x45a921,_0x12d8a3){return client[_0x130c('0xd')](_0x1009ea,_0x2f7c67)[_0x130c('0xe')](function(_0x2bd65a){logger[_0x130c('0xf')]('DashboardItem,\x20%s,\x20%s',_0x32e4e5,_0x130c('0x10'));logger[_0x130c('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x32e4e5,'request\x20sent',JSON['stringify'](_0x2bd65a));if(_0x2bd65a['error']){if(_0x2bd65a[_0x130c('0x12')][_0x130c('0x13')]===0x1f4){logger[_0x130c('0x12')](_0x130c('0x14'),_0x32e4e5,_0x2bd65a[_0x130c('0x12')][_0x130c('0x15')]);return _0x12d8a3(_0x2bd65a[_0x130c('0x12')]['message']);}logger[_0x130c('0x12')](_0x130c('0x14'),_0x32e4e5,_0x2bd65a[_0x130c('0x12')][_0x130c('0x15')]);return _0x45a921(_0x2bd65a[_0x130c('0x12')][_0x130c('0x15')]);}else{logger[_0x130c('0xf')](_0x130c('0x14'),_0x32e4e5,'request\x20sent');_0x45a921(_0x2bd65a['result']['message']);}})[_0x130c('0x16')](function(_0x5eca9b){logger['error']('DashboardItem,\x20%s,\x20%s',_0x32e4e5,_0x5eca9b);_0x12d8a3(_0x5eca9b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f786341..16ffe0a 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 _0xdedb=['removeListener','register','length','./dashboardItem.events','save','remove','update'];(function(_0x1bb45d,_0xc82252){var _0x7d8175=function(_0x45f2e9){while(--_0x45f2e9){_0x1bb45d['push'](_0x1bb45d['shift']());}};_0x7d8175(++_0xc82252);}(_0xdedb,0xea));var _0xbded=function(_0x22083f,_0x5d7259){_0x22083f=_0x22083f-0x0;var _0x29d47b=_0xdedb[_0x22083f];return _0x29d47b;};'use strict';var DashboardItemEvents=require(_0xbded('0x0'));var events=[_0xbded('0x1'),_0xbded('0x2'),_0xbded('0x3')];function createListener(_0x1092ad,_0x39cef0){return function(_0x4e2d93){_0x39cef0['emit'](_0x1092ad,_0x4e2d93);};}function removeListener(_0x40f647,_0x2bd916){return function(){DashboardItemEvents[_0xbded('0x4')](_0x40f647,_0x2bd916);};}exports[_0xbded('0x5')]=function(_0x5a993b){for(var _0x2bc4ff=0x0,_0x1fa3b7=events[_0xbded('0x6')];_0x2bc4ff<_0x1fa3b7;_0x2bc4ff++){var _0x18f194=events[_0x2bc4ff];var _0x3cdaeb=createListener('dashboardItem:'+_0x18f194,_0x5a993b);DashboardItemEvents['on'](_0x18f194,_0x3cdaeb);}}; \ No newline at end of file +var _0xc02e=['save','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xc02e,0xa4));var _0xec02=function(_0x41980e,_0x527b1d){_0x41980e=_0x41980e-0x0;var _0x1428fc=_0xc02e[_0x41980e];return _0x1428fc;};'use strict';var DashboardItemEvents=require(_0xec02('0x0'));var events=[_0xec02('0x1'),'remove','update'];function createListener(_0x217648,_0x125e1a){return function(_0x320f08){_0x125e1a['emit'](_0x217648,_0x320f08);};}function removeListener(_0x3a4f30,_0x3aded5){return function(){DashboardItemEvents[_0xec02('0x2')](_0x3a4f30,_0x3aded5);};}exports['register']=function(_0x1663dd){for(var _0x1c2b1c=0x0,_0x24d2b4=events[_0xec02('0x3')];_0x1c2b1c<_0x24d2b4;_0x1c2b1c++){var _0x20852c=events[_0x1c2b1c];var _0x39c46b=createListener(_0xec02('0x4')+_0x20852c,_0x1663dd);DashboardItemEvents['on'](_0x20852c,_0x39c46b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c520935..ec38dc6 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 _0xe2eb=['../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x4ee9cd,_0xd375b0){var _0x328a5b=function(_0x3ad1f4){while(--_0x3ad1f4){_0x4ee9cd['push'](_0x4ee9cd['shift']());}};_0x328a5b(++_0xd375b0);}(_0xe2eb,0x9d));var _0xbe2e=function(_0x5ee859,_0x7c6442){_0x5ee859=_0x5ee859-0x0;var _0x285682=_0xe2eb[_0x5ee859];return _0x285682;};'use strict';var multer=require(_0xbe2e('0x0'));var util=require(_0xbe2e('0x1'));var path=require(_0xbe2e('0x2'));var timeout=require(_0xbe2e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe2e('0x4'));var auth=require(_0xbe2e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbe2e('0x6'));var controller=require(_0xbe2e('0x7'));router[_0xbe2e('0x8')](_0xbe2e('0x9'),auth[_0xbe2e('0xa')](),controller[_0xbe2e('0xb')]);router[_0xbe2e('0xc')]('/',auth[_0xbe2e('0xa')](),controller[_0xbe2e('0xd')]);router[_0xbe2e('0xe')](_0xbe2e('0x9'),auth[_0xbe2e('0xa')](),controller['update']);router[_0xbe2e('0xf')]('/:id',auth[_0xbe2e('0xa')](),controller[_0xbe2e('0x10')]);module[_0xbe2e('0x11')]=router; \ No newline at end of file +var _0x272a=['show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','./dashboardItem.controller','get'];(function(_0x2a3844,_0x27530d){var _0x3c725b=function(_0x59ab36){while(--_0x59ab36){_0x2a3844['push'](_0x2a3844['shift']());}};_0x3c725b(++_0x27530d);}(_0x272a,0x129));var _0xa272=function(_0x32af03,_0x4c58bd){_0x32af03=_0x32af03-0x0;var _0x22295=_0x272a[_0x32af03];return _0x22295;};'use strict';var multer=require('multer');var util=require(_0xa272('0x0'));var path=require(_0xa272('0x1'));var timeout=require('connect-timeout');var express=require(_0xa272('0x2'));var router=express[_0xa272('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa272('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa272('0x5'));router[_0xa272('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa272('0x7')]);router['post']('/',auth[_0xa272('0x8')](),controller[_0xa272('0x9')]);router[_0xa272('0xa')](_0xa272('0xb'),auth[_0xa272('0x8')](),controller[_0xa272('0xc')]);router[_0xa272('0xd')](_0xa272('0xb'),auth['isAuthenticated'](),controller[_0xa272('0xe')]);module[_0xa272('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e7f844c..f31c31c 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 _0xed32=['third','exports','STRING','ENUM'];(function(_0x14a17c,_0x2b0151){var _0x8452a2=function(_0x462dac){while(--_0x462dac){_0x14a17c['push'](_0x14a17c['shift']());}};_0x8452a2(++_0x2b0151);}(_0xed32,0x149));var _0x2ed3=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xed32[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require('sequelize');module[_0x2ed3('0x0')]={'name':{'type':Sequelize[_0x2ed3('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x2ed3('0x2')]('first','second',_0x2ed3('0x3')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9e06=['ENUM','first','second','third','exports','STRING'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x9e06,0x1a2));var _0x69e0=function(_0x1f3839,_0x2ca6cf){_0x1f3839=_0x1f3839-0x0;var _0x3d5183=_0x9e06[_0x1f3839];return _0x3d5183;};'use strict';var Sequelize=require('sequelize');module[_0x69e0('0x0')]={'name':{'type':Sequelize[_0x69e0('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x69e0('0x2')](_0x69e0('0x3'),_0x69e0('0x4'),_0x69e0('0x5')),'allowNull':![],'defaultValue':_0x69e0('0x3')},'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 9cf99e9..6cbebcc 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 _0xcd05=['sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','user','role','Dispositions','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','offset','order'];(function(_0x244258,_0x35fb85){var _0x8d30b8=function(_0x5de52e){while(--_0x5de52e){_0x244258['push'](_0x244258['shift']());}};_0x8d30b8(++_0x35fb85);}(_0xcd05,0x163));var _0x5cd0=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0xcd05[_0x2d2ca2];return _0x48489d;};'use strict';var emlformat=require(_0x5cd0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5cd0('0x1'));var moment=require(_0x5cd0('0x2'));var BPromise=require(_0x5cd0('0x3'));var Mustache=require(_0x5cd0('0x4'));var util=require('util');var path=require(_0x5cd0('0x5'));var sox=require(_0x5cd0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cd0('0x7'));var squel=require(_0x5cd0('0x8'));var crypto=require(_0x5cd0('0x9'));var jsforce=require(_0x5cd0('0xa'));var deskjs=require(_0x5cd0('0xb'));var toCsv=require(_0x5cd0('0xc'));var querystring=require(_0x5cd0('0xd'));var Papa=require('papaparse');var Redis=require(_0x5cd0('0xe'));var authService=require(_0x5cd0('0xf'));var qs=require(_0x5cd0('0x10'));var as=require(_0x5cd0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd0('0x12'))(_0x5cd0('0x13'));var utils=require(_0x5cd0('0x14'));var config=require(_0x5cd0('0x15'));var licenseUtil=require(_0x5cd0('0x16'));var db=require(_0x5cd0('0x17'))['db'];function respondWithStatusCode(_0x11577c,_0x3f6bb6){_0x3f6bb6=_0x3f6bb6||0xcc;return function(_0x435d4b){if(_0x435d4b){return _0x11577c[_0x5cd0('0x18')](_0x3f6bb6);}return _0x11577c['status'](_0x3f6bb6)['end']();};}function respondWithResult(_0x51ec30,_0xe9f736){_0xe9f736=_0xe9f736||0xc8;return function(_0x426a68){if(_0x426a68){return _0x51ec30['status'](_0xe9f736)[_0x5cd0('0x19')](_0x426a68);}};}function respondWithFilteredResult(_0x5b1d94,_0x2991d2){return function(_0xd1d12b){if(_0xd1d12b){var _0xf54ddb=typeof _0x2991d2['offset']==='undefined'&&typeof _0x2991d2[_0x5cd0('0x1a')]===_0x5cd0('0x1b');var _0x156947=_0xd1d12b['count'];var _0x57d81d=_0xf54ddb?0x0:_0x2991d2['offset'];var _0x1847dd=_0xf54ddb?_0xd1d12b[_0x5cd0('0x1c')]:_0x2991d2['offset']+_0x2991d2[_0x5cd0('0x1a')];var _0x19554c;if(_0x1847dd>=_0x156947){_0x1847dd=_0x156947;_0x19554c=0xc8;}else{_0x19554c=0xce;}_0x5b1d94[_0x5cd0('0x1d')](_0x19554c);return _0x5b1d94[_0x5cd0('0x1e')](_0x5cd0('0x1f'),_0x57d81d+'-'+_0x1847dd+'/'+_0x156947)[_0x5cd0('0x19')](_0xd1d12b);}return null;};}function patchUpdates(_0x18b907){return function(_0xc5c11c){try{jsonpatch[_0x5cd0('0x20')](_0xc5c11c,_0x18b907,!![]);}catch(_0xd270d8){return BPromise[_0x5cd0('0x21')](_0xd270d8);}return _0xc5c11c[_0x5cd0('0x22')]();};}function saveUpdates(_0x1828ac,_0x1fe052){return function(_0x5c2bd9){if(_0x5c2bd9){return _0x5c2bd9['update'](_0x1828ac)[_0x5cd0('0x23')](function(_0x5bd14d){return _0x5bd14d;});}return null;};}function removeEntity(_0x236fb3,_0x2e01b6){return function(_0x1e8960){if(_0x1e8960){return _0x1e8960[_0x5cd0('0x24')]()[_0x5cd0('0x23')](function(){var _0x2b8516=_0x1e8960[_0x5cd0('0x25')]({'plain':!![]});var _0x5385db='Dispositions';return db[_0x5cd0('0x26')][_0x5cd0('0x24')]({'where':{'type':_0x5385db,'resourceId':_0x2b8516['id']}})[_0x5cd0('0x23')](function(){return _0x1e8960;});})[_0x5cd0('0x23')](function(){_0x236fb3['status'](0xcc)[_0x5cd0('0x27')]();});}};}function handleEntityNotFound(_0x14ab5c,_0x364d53){return function(_0x53a6cf){if(!_0x53a6cf){_0x14ab5c['sendStatus'](0x194);}return _0x53a6cf;};}function handleError(_0x403ff3,_0x24cb51){_0x24cb51=_0x24cb51||0x1f4;return function(_0x5a2123){logger[_0x5cd0('0x28')](_0x5a2123[_0x5cd0('0x29')]);if(_0x5a2123[_0x5cd0('0x2a')]){delete _0x5a2123[_0x5cd0('0x2a')];}_0x403ff3[_0x5cd0('0x1d')](_0x24cb51)[_0x5cd0('0x2b')](_0x5a2123);};}exports[_0x5cd0('0x2c')]=function(_0x55b7a9,_0x412f1e){var _0x1621f9={},_0x1b88ac={},_0x3a4b2f={'count':0x0,'rows':[]};var _0x400148=_[_0x5cd0('0x2d')](db[_0x5cd0('0x2e')][_0x5cd0('0x2f')],function(_0x2e16b1){return{'name':_0x2e16b1[_0x5cd0('0x30')],'type':_0x2e16b1['type'][_0x5cd0('0x31')]};});_0x1b88ac[_0x5cd0('0x32')]=_['map'](_0x400148,_0x5cd0('0x2a'));_0x1b88ac['query']=_[_0x5cd0('0x33')](_0x55b7a9[_0x5cd0('0x34')]);_0x1b88ac['filters']=_[_0x5cd0('0x35')](_0x1b88ac['model'],_0x1b88ac[_0x5cd0('0x34')]);_0x1621f9[_0x5cd0('0x36')]=_[_0x5cd0('0x35')](_0x1b88ac['model'],qs[_0x5cd0('0x37')](_0x55b7a9['query'][_0x5cd0('0x37')]));_0x1621f9[_0x5cd0('0x36')]=_0x1621f9['attributes'][_0x5cd0('0x38')]?_0x1621f9[_0x5cd0('0x36')]:_0x1b88ac[_0x5cd0('0x32')];if(!_0x55b7a9[_0x5cd0('0x34')][_0x5cd0('0x39')]('nolimit')){_0x1621f9['limit']=qs[_0x5cd0('0x1a')](_0x55b7a9[_0x5cd0('0x34')]['limit']);_0x1621f9[_0x5cd0('0x3a')]=qs[_0x5cd0('0x3a')](_0x55b7a9[_0x5cd0('0x34')][_0x5cd0('0x3a')]);}_0x1621f9[_0x5cd0('0x3b')]=qs['sort'](_0x55b7a9[_0x5cd0('0x34')][_0x5cd0('0x3c')]);_0x1621f9[_0x5cd0('0x3d')]=qs[_0x5cd0('0x3e')](_[_0x5cd0('0x3f')](_0x55b7a9[_0x5cd0('0x34')],_0x1b88ac[_0x5cd0('0x3e')]),_0x400148);if(_0x55b7a9[_0x5cd0('0x34')][_0x5cd0('0x40')]){_0x1621f9[_0x5cd0('0x3d')]=_[_0x5cd0('0x41')](_0x1621f9[_0x5cd0('0x3d')],{'$or':_[_0x5cd0('0x2d')](_0x400148,function(_0x271ebf){if(_0x271ebf['type']!=='VIRTUAL'){var _0x348ff6={};_0x348ff6[_0x271ebf['name']]={'$like':'%'+_0x55b7a9[_0x5cd0('0x34')]['filter']+'%'};return _0x348ff6;}})});}_0x1621f9=_[_0x5cd0('0x41')]({},_0x1621f9,_0x55b7a9[_0x5cd0('0x42')]);var _0x1499a7={'where':_0x1621f9[_0x5cd0('0x3d')]};return db[_0x5cd0('0x2e')]['count'](_0x1499a7)[_0x5cd0('0x23')](function(_0x5c7468){_0x3a4b2f['count']=_0x5c7468;if(_0x55b7a9[_0x5cd0('0x34')][_0x5cd0('0x43')]){_0x1621f9[_0x5cd0('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x5cd0('0x45')](_0x1621f9);})['then'](function(_0xe5a6ee){_0x3a4b2f['rows']=_0xe5a6ee;return _0x3a4b2f;})['then'](respondWithFilteredResult(_0x412f1e,_0x1621f9))[_0x5cd0('0x46')](handleError(_0x412f1e,null));};exports[_0x5cd0('0x47')]=function(_0x44e836,_0x3b7785){var _0xc18579={'raw':!![],'where':{'id':_0x44e836[_0x5cd0('0x48')]['id']}},_0x503851={};_0x503851[_0x5cd0('0x32')]=_[_0x5cd0('0x33')](db[_0x5cd0('0x2e')]['rawAttributes']);_0x503851[_0x5cd0('0x34')]=_[_0x5cd0('0x33')](_0x44e836[_0x5cd0('0x34')]);_0x503851[_0x5cd0('0x3e')]=_[_0x5cd0('0x35')](_0x503851['model'],_0x503851[_0x5cd0('0x34')]);_0xc18579[_0x5cd0('0x36')]=_[_0x5cd0('0x35')](_0x503851[_0x5cd0('0x32')],qs[_0x5cd0('0x37')](_0x44e836['query'][_0x5cd0('0x37')]));_0xc18579[_0x5cd0('0x36')]=_0xc18579['attributes']['length']?_0xc18579[_0x5cd0('0x36')]:_0x503851[_0x5cd0('0x32')];if(_0x44e836[_0x5cd0('0x34')][_0x5cd0('0x43')]){_0xc18579[_0x5cd0('0x44')]=[{'all':!![]}];}_0xc18579=_['merge']({},_0xc18579,_0x44e836['options']);return db[_0x5cd0('0x2e')][_0x5cd0('0x49')](_0xc18579)[_0x5cd0('0x23')](handleEntityNotFound(_0x3b7785,null))['then'](respondWithResult(_0x3b7785,null))[_0x5cd0('0x46')](handleError(_0x3b7785,null));};exports['create']=function(_0x589157,_0x37d394){return db[_0x5cd0('0x2e')]['create'](_0x589157[_0x5cd0('0x4a')],{})['then'](function(_0x5602ea){var _0x5089d3=_0x589157[_0x5cd0('0x4b')][_0x5cd0('0x25')]({'plain':!![]});if(!_0x5089d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5089d3[_0x5cd0('0x4c')]==='user'){var _0x3e2015=_0x5602ea[_0x5cd0('0x25')]({'plain':!![]});var _0x1ba52e=_0x5cd0('0x4d');return db['UserProfileSection'][_0x5cd0('0x49')]({'where':{'name':_0x1ba52e,'userProfileId':_0x5089d3[_0x5cd0('0x4e')]},'raw':!![]})['then'](function(_0x524c64){if(_0x524c64&&_0x524c64[_0x5cd0('0x4f')]===0x0){return db[_0x5cd0('0x26')][_0x5cd0('0x50')]({'name':_0x3e2015[_0x5cd0('0x2a')],'resourceId':_0x3e2015['id'],'type':_0x524c64['name'],'sectionId':_0x524c64['id']},{})[_0x5cd0('0x23')](function(){return _0x5602ea;});}else{return _0x5602ea;}})[_0x5cd0('0x46')](function(_0x3d47a3){logger[_0x5cd0('0x28')](_0x5cd0('0x51'),_0x3d47a3);throw _0x3d47a3;});}return _0x5602ea;})[_0x5cd0('0x23')](respondWithResult(_0x37d394,0xc9))[_0x5cd0('0x46')](handleError(_0x37d394,null));};exports[_0x5cd0('0x52')]=function(_0x16aa63,_0x200097){if(_0x16aa63['body']['id']){delete _0x16aa63[_0x5cd0('0x4a')]['id'];}return db['Disposition'][_0x5cd0('0x49')]({'where':{'id':_0x16aa63[_0x5cd0('0x48')]['id']}})[_0x5cd0('0x23')](handleEntityNotFound(_0x200097,null))[_0x5cd0('0x23')](saveUpdates(_0x16aa63[_0x5cd0('0x4a')],null))['then'](respondWithResult(_0x200097,null))[_0x5cd0('0x46')](handleError(_0x200097,null));};exports[_0x5cd0('0x24')]=function(_0x4d4746,_0x131263){return db['Disposition'][_0x5cd0('0x49')]({'where':{'id':_0x4d4746['params']['id']}})[_0x5cd0('0x23')](handleEntityNotFound(_0x131263,null))['then'](removeEntity(_0x131263,null))[_0x5cd0('0x46')](handleError(_0x131263,null));}; \ No newline at end of file +var _0xd5a2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','count','includeAll','include','rows','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js'];(function(_0x5777e4,_0x44f0e7){var _0x46b773=function(_0x2d5bac){while(--_0x2d5bac){_0x5777e4['push'](_0x5777e4['shift']());}};_0x46b773(++_0x44f0e7);}(_0xd5a2,0x93));var _0x2d5a=function(_0x2cf8c5,_0x224e0c){_0x2cf8c5=_0x2cf8c5-0x0;var _0x1cbd5b=_0xd5a2[_0x2cf8c5];return _0x1cbd5b;};'use strict';var emlformat=require(_0x2d5a('0x0'));var rimraf=require(_0x2d5a('0x1'));var zipdir=require(_0x2d5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d5a('0x3'));var BPromise=require(_0x2d5a('0x4'));var Mustache=require(_0x2d5a('0x5'));var util=require(_0x2d5a('0x6'));var path=require(_0x2d5a('0x7'));var sox=require(_0x2d5a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d5a('0x9'));var _=require('lodash');var squel=require(_0x2d5a('0xa'));var crypto=require('crypto');var jsforce=require(_0x2d5a('0xb'));var deskjs=require(_0x2d5a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2d5a('0xd'));var authService=require(_0x2d5a('0xe'));var qs=require(_0x2d5a('0xf'));var as=require(_0x2d5a('0x10'));var hardwareService=require(_0x2d5a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2d5a('0x12'));var config=require(_0x2d5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d5a('0x14'))['db'];function respondWithStatusCode(_0x322604,_0x3be1b6){_0x3be1b6=_0x3be1b6||0xcc;return function(_0x1f5c6c){if(_0x1f5c6c){return _0x322604[_0x2d5a('0x15')](_0x3be1b6);}return _0x322604[_0x2d5a('0x16')](_0x3be1b6)[_0x2d5a('0x17')]();};}function respondWithResult(_0x5a9b45,_0x5551fe){_0x5551fe=_0x5551fe||0xc8;return function(_0x2ba045){if(_0x2ba045){return _0x5a9b45[_0x2d5a('0x16')](_0x5551fe)['json'](_0x2ba045);}};}function respondWithFilteredResult(_0xcad989,_0x4ab0e0){return function(_0x5b4617){if(_0x5b4617){var _0x4ed804=typeof _0x4ab0e0['offset']==='undefined'&&typeof _0x4ab0e0[_0x2d5a('0x18')]===_0x2d5a('0x19');var _0x210485=_0x5b4617['count'];var _0x36baa8=_0x4ed804?0x0:_0x4ab0e0[_0x2d5a('0x1a')];var _0x41094a=_0x4ed804?_0x5b4617['count']:_0x4ab0e0['offset']+_0x4ab0e0[_0x2d5a('0x18')];var _0x3b7043;if(_0x41094a>=_0x210485){_0x41094a=_0x210485;_0x3b7043=0xc8;}else{_0x3b7043=0xce;}_0xcad989[_0x2d5a('0x16')](_0x3b7043);return _0xcad989[_0x2d5a('0x1b')](_0x2d5a('0x1c'),_0x36baa8+'-'+_0x41094a+'/'+_0x210485)['json'](_0x5b4617);}return null;};}function patchUpdates(_0x25b83a){return function(_0x132aa4){try{jsonpatch[_0x2d5a('0x1d')](_0x132aa4,_0x25b83a,!![]);}catch(_0x2a4624){return BPromise[_0x2d5a('0x1e')](_0x2a4624);}return _0x132aa4[_0x2d5a('0x1f')]();};}function saveUpdates(_0x17980b,_0x38bb6f){return function(_0x4ab9bd){if(_0x4ab9bd){return _0x4ab9bd[_0x2d5a('0x20')](_0x17980b)[_0x2d5a('0x21')](function(_0xe24054){return _0xe24054;});}return null;};}function removeEntity(_0x3625ee,_0x44aa06){return function(_0x4c4f0c){if(_0x4c4f0c){return _0x4c4f0c['destroy']()['then'](function(){var _0x13b64c=_0x4c4f0c[_0x2d5a('0x22')]({'plain':!![]});var _0x4a1a0b=_0x2d5a('0x23');return db[_0x2d5a('0x24')]['destroy']({'where':{'type':_0x4a1a0b,'resourceId':_0x13b64c['id']}})[_0x2d5a('0x21')](function(){return _0x4c4f0c;});})[_0x2d5a('0x21')](function(){_0x3625ee[_0x2d5a('0x16')](0xcc)[_0x2d5a('0x17')]();});}};}function handleEntityNotFound(_0x554024,_0x248d86){return function(_0x40e11f){if(!_0x40e11f){_0x554024[_0x2d5a('0x15')](0x194);}return _0x40e11f;};}function handleError(_0x10f52f,_0x36b1ca){_0x36b1ca=_0x36b1ca||0x1f4;return function(_0x472d63){logger[_0x2d5a('0x25')](_0x472d63[_0x2d5a('0x26')]);if(_0x472d63[_0x2d5a('0x27')]){delete _0x472d63[_0x2d5a('0x27')];}_0x10f52f[_0x2d5a('0x16')](_0x36b1ca)[_0x2d5a('0x28')](_0x472d63);};}exports[_0x2d5a('0x29')]=function(_0x103356,_0x1807f5){var _0xb3dee={},_0x331634={},_0x1fe333={'count':0x0,'rows':[]};var _0x2fc75d=_[_0x2d5a('0x2a')](db[_0x2d5a('0x2b')][_0x2d5a('0x2c')],function(_0x472e2c){return{'name':_0x472e2c[_0x2d5a('0x2d')],'type':_0x472e2c[_0x2d5a('0x2e')][_0x2d5a('0x2f')]};});_0x331634['model']=_['map'](_0x2fc75d,_0x2d5a('0x27'));_0x331634[_0x2d5a('0x30')]=_[_0x2d5a('0x31')](_0x103356[_0x2d5a('0x30')]);_0x331634[_0x2d5a('0x32')]=_[_0x2d5a('0x33')](_0x331634[_0x2d5a('0x34')],_0x331634[_0x2d5a('0x30')]);_0xb3dee[_0x2d5a('0x35')]=_['intersection'](_0x331634['model'],qs[_0x2d5a('0x36')](_0x103356[_0x2d5a('0x30')][_0x2d5a('0x36')]));_0xb3dee[_0x2d5a('0x35')]=_0xb3dee[_0x2d5a('0x35')][_0x2d5a('0x37')]?_0xb3dee['attributes']:_0x331634[_0x2d5a('0x34')];if(!_0x103356[_0x2d5a('0x30')][_0x2d5a('0x38')](_0x2d5a('0x39'))){_0xb3dee[_0x2d5a('0x18')]=qs[_0x2d5a('0x18')](_0x103356[_0x2d5a('0x30')][_0x2d5a('0x18')]);_0xb3dee[_0x2d5a('0x1a')]=qs[_0x2d5a('0x1a')](_0x103356[_0x2d5a('0x30')][_0x2d5a('0x1a')]);}_0xb3dee[_0x2d5a('0x3a')]=qs[_0x2d5a('0x3b')](_0x103356[_0x2d5a('0x30')]['sort']);_0xb3dee['where']=qs[_0x2d5a('0x32')](_['pick'](_0x103356[_0x2d5a('0x30')],_0x331634[_0x2d5a('0x32')]),_0x2fc75d);if(_0x103356['query'][_0x2d5a('0x3c')]){_0xb3dee['where']=_[_0x2d5a('0x3d')](_0xb3dee[_0x2d5a('0x3e')],{'$or':_['map'](_0x2fc75d,function(_0x11142f){if(_0x11142f[_0x2d5a('0x2e')]!=='VIRTUAL'){var _0x53ae8c={};_0x53ae8c[_0x11142f[_0x2d5a('0x27')]]={'$like':'%'+_0x103356[_0x2d5a('0x30')][_0x2d5a('0x3c')]+'%'};return _0x53ae8c;}})});}_0xb3dee=_['merge']({},_0xb3dee,_0x103356[_0x2d5a('0x3f')]);var _0x1715f4={'where':_0xb3dee['where']};return db[_0x2d5a('0x2b')][_0x2d5a('0x40')](_0x1715f4)[_0x2d5a('0x21')](function(_0x3c3702){_0x1fe333['count']=_0x3c3702;if(_0x103356[_0x2d5a('0x30')][_0x2d5a('0x41')]){_0xb3dee[_0x2d5a('0x42')]=[{'all':!![]}];}return db[_0x2d5a('0x2b')]['findAll'](_0xb3dee);})[_0x2d5a('0x21')](function(_0x4bfb9a){_0x1fe333[_0x2d5a('0x43')]=_0x4bfb9a;return _0x1fe333;})[_0x2d5a('0x21')](respondWithFilteredResult(_0x1807f5,_0xb3dee))['catch'](handleError(_0x1807f5,null));};exports['show']=function(_0x2202c3,_0x5ca1e4){var _0xd3304d={'raw':!![],'where':{'id':_0x2202c3['params']['id']}},_0xcb49b3={};_0xcb49b3[_0x2d5a('0x34')]=_[_0x2d5a('0x31')](db[_0x2d5a('0x2b')][_0x2d5a('0x2c')]);_0xcb49b3[_0x2d5a('0x30')]=_['keys'](_0x2202c3[_0x2d5a('0x30')]);_0xcb49b3[_0x2d5a('0x32')]=_[_0x2d5a('0x33')](_0xcb49b3[_0x2d5a('0x34')],_0xcb49b3[_0x2d5a('0x30')]);_0xd3304d[_0x2d5a('0x35')]=_[_0x2d5a('0x33')](_0xcb49b3[_0x2d5a('0x34')],qs[_0x2d5a('0x36')](_0x2202c3['query'][_0x2d5a('0x36')]));_0xd3304d[_0x2d5a('0x35')]=_0xd3304d[_0x2d5a('0x35')][_0x2d5a('0x37')]?_0xd3304d['attributes']:_0xcb49b3[_0x2d5a('0x34')];if(_0x2202c3[_0x2d5a('0x30')][_0x2d5a('0x41')]){_0xd3304d[_0x2d5a('0x42')]=[{'all':!![]}];}_0xd3304d=_[_0x2d5a('0x3d')]({},_0xd3304d,_0x2202c3[_0x2d5a('0x3f')]);return db['Disposition'][_0x2d5a('0x44')](_0xd3304d)['then'](handleEntityNotFound(_0x5ca1e4,null))[_0x2d5a('0x21')](respondWithResult(_0x5ca1e4,null))[_0x2d5a('0x45')](handleError(_0x5ca1e4,null));};exports[_0x2d5a('0x46')]=function(_0x541832,_0x2ab7c2){return db[_0x2d5a('0x2b')]['create'](_0x541832['body'],{})['then'](function(_0x1f5bbb){var _0x141006=_0x541832[_0x2d5a('0x47')]['get']({'plain':!![]});if(!_0x141006)throw new Error(_0x2d5a('0x48'));if(_0x141006[_0x2d5a('0x49')]===_0x2d5a('0x47')){var _0x1bcbe8=_0x1f5bbb[_0x2d5a('0x22')]({'plain':!![]});var _0x5c7365=_0x2d5a('0x23');return db[_0x2d5a('0x4a')]['find']({'where':{'name':_0x5c7365,'userProfileId':_0x141006[_0x2d5a('0x4b')]},'raw':!![]})[_0x2d5a('0x21')](function(_0x5d2d3f){if(_0x5d2d3f&&_0x5d2d3f['autoAssociation']===0x0){return db['UserProfileResource'][_0x2d5a('0x46')]({'name':_0x1bcbe8['name'],'resourceId':_0x1bcbe8['id'],'type':_0x5d2d3f[_0x2d5a('0x27')],'sectionId':_0x5d2d3f['id']},{})[_0x2d5a('0x21')](function(){return _0x1f5bbb;});}else{return _0x1f5bbb;}})[_0x2d5a('0x45')](function(_0x4f5436){logger['error'](_0x2d5a('0x4c'),_0x4f5436);throw _0x4f5436;});}return _0x1f5bbb;})['then'](respondWithResult(_0x2ab7c2,0xc9))['catch'](handleError(_0x2ab7c2,null));};exports[_0x2d5a('0x20')]=function(_0x4bb2d0,_0x4dd32a){if(_0x4bb2d0[_0x2d5a('0x4d')]['id']){delete _0x4bb2d0[_0x2d5a('0x4d')]['id'];}return db[_0x2d5a('0x2b')][_0x2d5a('0x44')]({'where':{'id':_0x4bb2d0[_0x2d5a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4dd32a,null))[_0x2d5a('0x21')](saveUpdates(_0x4bb2d0[_0x2d5a('0x4d')],null))[_0x2d5a('0x21')](respondWithResult(_0x4dd32a,null))[_0x2d5a('0x45')](handleError(_0x4dd32a,null));};exports[_0x2d5a('0x4f')]=function(_0x6dafdb,_0x15ae1d){return db['Disposition'][_0x2d5a('0x44')]({'where':{'id':_0x6dafdb[_0x2d5a('0x4e')]['id']}})[_0x2d5a('0x21')](handleEntityNotFound(_0x15ae1d,null))[_0x2d5a('0x21')](removeEntity(_0x15ae1d,null))[_0x2d5a('0x45')](handleError(_0x15ae1d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 6e1799b..28d4c37 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 _0xa4da=['name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions'];(function(_0x14a943,_0x305469){var _0x26e731=function(_0x5b2ac2){while(--_0x5b2ac2){_0x14a943['push'](_0x14a943['shift']());}};_0x26e731(++_0x305469);}(_0xa4da,0xda));var _0xaa4d=function(_0x32917a,_0x3559ea){_0x32917a=_0x32917a-0x0;var _0x1881e1=_0xa4da[_0x32917a];return _0x1881e1;};'use strict';var _=require(_0xaa4d('0x0'));var util=require(_0xaa4d('0x1'));var logger=require(_0xaa4d('0x2'))(_0xaa4d('0x3'));var moment=require('moment');var BPromise=require(_0xaa4d('0x4'));var rp=require(_0xaa4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa4d('0x6'));var config=require(_0xaa4d('0x7'));var attributes=require('./disposition.attributes');module[_0xaa4d('0x8')]=function(_0x223c4c,_0x253a9e){return _0x223c4c[_0xaa4d('0x9')](_0xaa4d('0xa'),attributes,{'tableName':_0xaa4d('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xaa4d('0xc'),_0xaa4d('0xd')]},{'unique':!![],'name':_0xaa4d('0xe'),'fields':[_0xaa4d('0xc'),_0xaa4d('0xf')]},{'unique':!![],'name':_0xaa4d('0x10'),'fields':[_0xaa4d('0xc'),'MailAccountId']},{'unique':!![],'name':_0xaa4d('0x11'),'fields':['name',_0xaa4d('0x12')]},{'unique':!![],'name':_0xaa4d('0x13'),'fields':['name',_0xaa4d('0x14')]},{'unique':!![],'name':_0xaa4d('0x15'),'fields':[_0xaa4d('0xc'),_0xaa4d('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c34=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Disposition','tools_dispositions','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c34,0xef));var _0x44c3=function(_0x155e8f,_0x1a6438){_0x155e8f=_0x155e8f-0x0;var _0x2319f6=_0x4c34[_0x155e8f];return _0x2319f6;};'use strict';var _=require(_0x44c3('0x0'));var util=require('util');var logger=require(_0x44c3('0x1'))('api');var moment=require(_0x44c3('0x2'));var BPromise=require(_0x44c3('0x3'));var rp=require(_0x44c3('0x4'));var fs=require('fs');var path=require(_0x44c3('0x5'));var rimraf=require(_0x44c3('0x6'));var config=require(_0x44c3('0x7'));var attributes=require('./disposition.attributes');module['exports']=function(_0x439191,_0x1d8e88){return _0x439191[_0x44c3('0x8')](_0x44c3('0x9'),attributes,{'tableName':_0x44c3('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x44c3('0xb'),'ListId']},{'unique':!![],'name':_0x44c3('0xc'),'fields':[_0x44c3('0xb'),_0x44c3('0xd')]},{'unique':!![],'name':_0x44c3('0xe'),'fields':[_0x44c3('0xb'),_0x44c3('0xf')]},{'unique':!![],'name':_0x44c3('0x10'),'fields':[_0x44c3('0xb'),_0x44c3('0x11')]},{'unique':!![],'name':_0x44c3('0x12'),'fields':[_0x44c3('0xb'),_0x44c3('0x13')]},{'unique':!![],'name':_0x44c3('0x14'),'fields':['name',_0x44c3('0x15')]},{'unique':!![],'name':_0x44c3('0x16'),'fields':[_0x44c3('0xb'),_0x44c3('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f10772b..4d0cdd9 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(_0x115106,_0x41d4b7){var _0x4c1338=function(_0x194b19){while(--_0x194b19){_0x115106['push'](_0x115106['shift']());}};_0x4c1338(++_0x41d4b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x5c6048,_0x41234f){var _0x319609=function(_0xe0353b){while(--_0xe0353b){_0x5c6048['push'](_0x5c6048['shift']());}};_0x319609(++_0x41234f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 00deaee..93eb458 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 _0x28b9=['Router','fs-extra','../../config/environment','isAuthenticated','get','/:id','create','update','delete','destroy','exports','multer','util','path','express'];(function(_0x4e075b,_0x26c178){var _0x5d44a7=function(_0x46e949){while(--_0x46e949){_0x4e075b['push'](_0x4e075b['shift']());}};_0x5d44a7(++_0x26c178);}(_0x28b9,0xb0));var _0x928b=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0x28b9[_0x2697d9];return _0x25e6ae;};'use strict';var multer=require(_0x928b('0x0'));var util=require(_0x928b('0x1'));var path=require(_0x928b('0x2'));var timeout=require('connect-timeout');var express=require(_0x928b('0x3'));var router=express[_0x928b('0x4')]();var fs_extra=require(_0x928b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x928b('0x6'));var controller=require('./disposition.controller');router['get']('/',auth[_0x928b('0x7')](),controller['index']);router[_0x928b('0x8')](_0x928b('0x9'),auth[_0x928b('0x7')](),controller['show']);router['post']('/',auth[_0x928b('0x7')](),controller[_0x928b('0xa')]);router['put'](_0x928b('0x9'),auth[_0x928b('0x7')](),controller[_0x928b('0xb')]);router[_0x928b('0xc')](_0x928b('0x9'),auth[_0x928b('0x7')](),controller[_0x928b('0xd')]);module[_0x928b('0xe')]=router; \ No newline at end of file +var _0xe147=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','/:id','update','destroy','exports','util','path','express'];(function(_0x50bcb2,_0x33a0e6){var _0x4115e0=function(_0x33ca08){while(--_0x33ca08){_0x50bcb2['push'](_0x50bcb2['shift']());}};_0x4115e0(++_0x33a0e6);}(_0xe147,0x1ec));var _0x7e14=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe147[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x7e14('0x0'));var path=require(_0x7e14('0x1'));var timeout=require('connect-timeout');var express=require(_0x7e14('0x2'));var router=express[_0x7e14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7e14('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7e14('0x5'));var controller=require('./disposition.controller');router[_0x7e14('0x6')]('/',auth[_0x7e14('0x7')](),controller[_0x7e14('0x8')]);router[_0x7e14('0x6')]('/:id',auth[_0x7e14('0x7')](),controller[_0x7e14('0x9')]);router[_0x7e14('0xa')]('/',auth[_0x7e14('0x7')](),controller['create']);router['put'](_0x7e14('0xb'),auth['isAuthenticated'](),controller[_0x7e14('0xc')]);router['delete'](_0x7e14('0xb'),auth[_0x7e14('0x7')](),controller[_0x7e14('0xd')]);module[_0x7e14('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 974b83f..c461065 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 _0x66e2=['KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','ENUM','SIP','IAX'];(function(_0x55755c,_0x32d95c){var _0x26dd31=function(_0x1b04d1){while(--_0x1b04d1){_0x55755c['push'](_0x55755c['shift']());}};_0x26dd31(++_0x32d95c);}(_0x66e2,0x1bb));var _0x266e=function(_0x53bf29,_0x1d05f1){_0x53bf29=_0x53bf29-0x0;var _0xd7eecd=_0x66e2[_0x53bf29];return _0xd7eecd;};'use strict';var Sequelize=require(_0x266e('0x0'));module[_0x266e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x266e('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x266e('0x3'),'no'),'defaultValue':_0x266e('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x266e('0x4')},'localstationid':{'type':Sequelize[_0x266e('0x2')],'unique':_0x266e('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x266e('0x6'),_0x266e('0x7'),_0x266e('0x8'),_0x266e('0x9'),_0x266e('0xa'),_0x266e('0xb')),'defaultValue':_0x266e('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x266e('0x6'),_0x266e('0x7'),_0x266e('0x8'),_0x266e('0x9'),_0x266e('0xa'),_0x266e('0xb')),'defaultValue':_0x266e('0xb')},'modem':{'type':Sequelize[_0x266e('0x2')],'defaultValue':_0x266e('0xc')},'gateway':{'type':Sequelize[_0x266e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x266e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x266e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x266e('0xe')](_0x266e('0xf'),_0x266e('0x10'),'DADHI',_0x266e('0x11')),'defaultValue':_0x266e('0xf')},'key':{'type':Sequelize[_0x266e('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x266e('0x12');}},'notificationSound':{'type':Sequelize[_0x266e('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x266e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x266e('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x266e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x266e('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x266e('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x266e('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x266e('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x450dba){if(!_0x450dba)this[_0x266e('0x15')](_0x266e('0x16'),null);this[_0x266e('0x15')]('mandatoryDisposition',_0x450dba);}}}; \ No newline at end of file +var _0xcf9c=['mandatoryDispositionPauseId','mandatoryDisposition','exports','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','2400','9600','INTEGER','SIP','IAX','DADHI','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xcf9c,0x1e5));var _0xccf9=function(_0x1d7be2,_0x2a38b4){_0x1d7be2=_0x1d7be2-0x0;var _0x19ac2e=_0xcf9c[_0x1d7be2];return _0x19ac2e;};'use strict';var Sequelize=require('sequelize');module[_0xccf9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xccf9('0x1')](_0xccf9('0x2'),'no'),'defaultValue':_0xccf9('0x2')},'headerinfo':{'type':Sequelize[_0xccf9('0x3')],'defaultValue':_0xccf9('0x4')},'localstationid':{'type':Sequelize[_0xccf9('0x3')],'unique':_0xccf9('0x5')},'minrate':{'type':Sequelize[_0xccf9('0x1')]('2400',_0xccf9('0x6'),_0xccf9('0x7'),'9600',_0xccf9('0x8'),_0xccf9('0x9')),'defaultValue':_0xccf9('0x6')},'maxrate':{'type':Sequelize[_0xccf9('0x1')](_0xccf9('0xa'),_0xccf9('0x6'),_0xccf9('0x7'),_0xccf9('0xb'),_0xccf9('0x8'),_0xccf9('0x9')),'defaultValue':_0xccf9('0x9')},'modem':{'type':Sequelize[_0xccf9('0x3')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xccf9('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xccf9('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xccf9('0x1')](_0xccf9('0xd'),_0xccf9('0xe'),_0xccf9('0xf'),_0xccf9('0x10')),'defaultValue':_0xccf9('0xd')},'key':{'type':Sequelize[_0xccf9('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xccf9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xccf9('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xccf9('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xccf9('0x11')],'defaultValue':![],'comment':_0xccf9('0x13'),'set':function(_0xebceef){if(!_0xebceef)this[_0xccf9('0x14')](_0xccf9('0x15'),null);this[_0xccf9('0x14')](_0xccf9('0x16'),_0xebceef);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2ccb85e..fb44896 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 _0x9077=['/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','bulkCreate','transaction','tech','key','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','updatedAt','DESC','attachments','join','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','includeAll','find','create','body','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','update','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Set','Wait'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x9077,0xfc));var _0x7907=function(_0x304320,_0x232a69){_0x304320=_0x304320-0x0;var _0xe607da=_0x9077[_0x304320];return _0xe607da;};'use strict';var emlformat=require(_0x7907('0x0'));var rimraf=require(_0x7907('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7907('0x2'));var rp=require(_0x7907('0x3'));var moment=require('moment');var BPromise=require(_0x7907('0x4'));var Mustache=require(_0x7907('0x5'));var util=require(_0x7907('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7907('0x7'));var ejs=require(_0x7907('0x8'));var fs=require('fs');var fs_extra=require(_0x7907('0x9'));var _=require(_0x7907('0xa'));var squel=require('squel');var crypto=require(_0x7907('0xb'));var jsforce=require(_0x7907('0xc'));var deskjs=require(_0x7907('0xd'));var toCsv=require(_0x7907('0x7'));var querystring=require('querystring');var Papa=require(_0x7907('0xe'));var Redis=require(_0x7907('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7907('0x10'));var as=require(_0x7907('0x11'));var hardwareService=require(_0x7907('0x12'));var logger=require('../../config/logger')(_0x7907('0x13'));var utils=require(_0x7907('0x14'));var config=require(_0x7907('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7907('0x16'))['db'];config[_0x7907('0x17')]=_['defaults'](config[_0x7907('0x17')],{'host':_0x7907('0x18'),'port':0x18eb});var socket=require(_0x7907('0x19'))(new Redis(config[_0x7907('0x17')]));require('./faxAccount.socket')[_0x7907('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7907('0x1b')]({'port':0x232c});var client9002=jayson[_0x7907('0x1c')][_0x7907('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2c1ce6,_0x15d675,_0x16dcb3,_0x3c716e){return new BPromise(function(_0x41291b,_0x585b1b){var _0x18f925=_0x3c716e||client;return _0x18f925[_0x7907('0x1d')](_0x2c1ce6,_0x16dcb3)['then'](function(_0x4b18b9){logger[_0x7907('0x1e')](_0x7907('0x1f'),_0x15d675,_0x7907('0x20'));logger[_0x7907('0x21')](_0x7907('0x22'),_0x15d675,_0x7907('0x20'),JSON[_0x7907('0x23')](_0x4b18b9));if(_0x4b18b9[_0x7907('0x24')]){if(_0x4b18b9['error'][_0x7907('0x25')]===0x1f4){logger['error'](_0x7907('0x1f'),_0x15d675,_0x4b18b9[_0x7907('0x24')][_0x7907('0x26')]);return _0x585b1b(_0x4b18b9['error'][_0x7907('0x26')]);}logger[_0x7907('0x24')](_0x7907('0x1f'),_0x15d675,_0x4b18b9[_0x7907('0x24')][_0x7907('0x26')]);return _0x41291b(_0x4b18b9[_0x7907('0x24')][_0x7907('0x26')]);}else{logger[_0x7907('0x1e')](_0x7907('0x1f'),_0x15d675,'request\x20sent');_0x41291b(_0x4b18b9['result']['message']);}})[_0x7907('0x27')](function(_0x5ad537){logger[_0x7907('0x24')](_0x7907('0x1f'),_0x15d675,_0x5ad537);_0x585b1b(_0x5ad537);});});}function respondWithStatusCode(_0x277fe8,_0xbc1e4a){_0xbc1e4a=_0xbc1e4a||0xcc;return function(_0xe07bfa){if(_0xe07bfa){return _0x277fe8[_0x7907('0x28')](_0xbc1e4a);}return _0x277fe8[_0x7907('0x29')](_0xbc1e4a)[_0x7907('0x2a')]();};}function respondWithResult(_0x433959,_0x553363){_0x553363=_0x553363||0xc8;return function(_0x5b5d96){if(_0x5b5d96){return _0x433959[_0x7907('0x29')](_0x553363)[_0x7907('0x2b')](_0x5b5d96);}};}function respondWithFilteredResult(_0x1220af,_0x499576){return function(_0x2fdd8e){if(_0x2fdd8e){var _0x308661=typeof _0x499576[_0x7907('0x2c')]==='undefined'&&typeof _0x499576[_0x7907('0x2d')]===_0x7907('0x2e');var _0x3a73a9=_0x2fdd8e[_0x7907('0x2f')];var _0x11b6f2=_0x308661?0x0:_0x499576[_0x7907('0x2c')];var _0xb9079c=_0x308661?_0x2fdd8e['count']:_0x499576[_0x7907('0x2c')]+_0x499576[_0x7907('0x2d')];var _0x5c3cbb;if(_0xb9079c>=_0x3a73a9){_0xb9079c=_0x3a73a9;_0x5c3cbb=0xc8;}else{_0x5c3cbb=0xce;}_0x1220af[_0x7907('0x29')](_0x5c3cbb);return _0x1220af[_0x7907('0x30')](_0x7907('0x31'),_0x11b6f2+'-'+_0xb9079c+'/'+_0x3a73a9)[_0x7907('0x2b')](_0x2fdd8e);}return null;};}function patchUpdates(_0x5230da){return function(_0x2a8dd3){try{jsonpatch['apply'](_0x2a8dd3,_0x5230da,!![]);}catch(_0x250cce){return BPromise[_0x7907('0x32')](_0x250cce);}return _0x2a8dd3[_0x7907('0x33')]();};}function saveUpdates(_0x8ad4a7,_0xf5050){return function(_0x13a437){if(_0x13a437){return _0x13a437['update'](_0x8ad4a7)[_0x7907('0x34')](function(_0x461b6e){return _0x461b6e;});}return null;};}function removeEntity(_0x15201c,_0x359d19){return function(_0x3b6ad8){if(_0x3b6ad8){return _0x3b6ad8[_0x7907('0x35')]()[_0x7907('0x34')](function(){var _0x59ab58=_0x3b6ad8[_0x7907('0x36')]({'plain':!![]});var _0x6c7d32='FaxAccounts';return db[_0x7907('0x37')][_0x7907('0x35')]({'where':{'type':_0x6c7d32,'resourceId':_0x59ab58['id']}})[_0x7907('0x34')](function(){return _0x3b6ad8;});})[_0x7907('0x34')](function(){_0x15201c[_0x7907('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6d0f,_0x4f967c){return function(_0x425696){if(!_0x425696){_0x4c6d0f[_0x7907('0x28')](0x194);}return _0x425696;};}function handleError(_0x396954,_0x53d47a){_0x53d47a=_0x53d47a||0x1f4;return function(_0x2abb4c){logger[_0x7907('0x24')](_0x2abb4c[_0x7907('0x38')]);if(_0x2abb4c[_0x7907('0x39')]){delete _0x2abb4c[_0x7907('0x39')];}_0x396954[_0x7907('0x29')](_0x53d47a)[_0x7907('0x3a')](_0x2abb4c);};}exports[_0x7907('0x3b')]=function(_0x5679db,_0xde683d){var _0x56284b={'include':[{'model':db[_0x7907('0x3c')],'as':_0x7907('0x3d')}]},_0x3d5e17={},_0x1005c8={'count':0x0,'rows':[]};var _0x36d138=_[_0x7907('0x3e')](db[_0x7907('0x3f')][_0x7907('0x40')],function(_0x450f18){return{'name':_0x450f18[_0x7907('0x41')],'type':_0x450f18[_0x7907('0x42')]['key']};});_0x3d5e17[_0x7907('0x43')]=_[_0x7907('0x3e')](_0x36d138,_0x7907('0x39'));_0x3d5e17[_0x7907('0x44')]=_[_0x7907('0x45')](_0x5679db[_0x7907('0x44')]);_0x3d5e17[_0x7907('0x46')]=_['intersection'](_0x3d5e17['model'],_0x3d5e17[_0x7907('0x44')]);_0x56284b[_0x7907('0x47')]=_[_0x7907('0x48')](_0x3d5e17['model'],qs[_0x7907('0x49')](_0x5679db['query'][_0x7907('0x49')]));_0x56284b[_0x7907('0x47')]=_0x56284b[_0x7907('0x47')][_0x7907('0x4a')]?_0x56284b[_0x7907('0x47')]:_0x3d5e17[_0x7907('0x43')];if(!_0x5679db[_0x7907('0x44')][_0x7907('0x4b')](_0x7907('0x4c'))){_0x56284b[_0x7907('0x2d')]=qs['limit'](_0x5679db[_0x7907('0x44')]['limit']);_0x56284b[_0x7907('0x2c')]=qs[_0x7907('0x2c')](_0x5679db[_0x7907('0x44')][_0x7907('0x2c')]);}_0x56284b[_0x7907('0x4d')]=qs[_0x7907('0x4e')](_0x5679db[_0x7907('0x44')][_0x7907('0x4e')]);_0x56284b[_0x7907('0x4f')]=qs[_0x7907('0x46')](_['pick'](_0x5679db[_0x7907('0x44')],_0x3d5e17[_0x7907('0x46')]),_0x36d138);if(_0x5679db[_0x7907('0x44')][_0x7907('0x50')]){_0x56284b[_0x7907('0x4f')]=_[_0x7907('0x51')](_0x56284b['where'],{'$or':_[_0x7907('0x3e')](_0x36d138,function(_0x15f67a){if(_0x15f67a['type']!=='VIRTUAL'){var _0x425381={};_0x425381[_0x15f67a[_0x7907('0x39')]]={'$like':'%'+_0x5679db[_0x7907('0x44')][_0x7907('0x50')]+'%'};return _0x425381;}})});}_0x56284b=_['merge']({},_0x56284b,_0x5679db[_0x7907('0x52')]);var _0x227f74={'where':_0x56284b[_0x7907('0x4f')]};return db['FaxAccount'][_0x7907('0x2f')](_0x227f74)[_0x7907('0x34')](function(_0x5395ae){_0x1005c8[_0x7907('0x2f')]=_0x5395ae;if(_0x5679db[_0x7907('0x44')]['includeAll']){_0x56284b[_0x7907('0x53')]=[{'all':!![]}];}return db[_0x7907('0x3f')][_0x7907('0x54')](_0x56284b);})[_0x7907('0x34')](function(_0x4b3b2f){_0x1005c8[_0x7907('0x55')]=_0x4b3b2f;return _0x1005c8;})[_0x7907('0x34')](respondWithFilteredResult(_0xde683d,_0x56284b))[_0x7907('0x27')](handleError(_0xde683d,null));};exports['show']=function(_0x16230f,_0xebe212){var _0x55d329={'raw':![],'where':{'id':_0x16230f['params']['id']},'include':[{'model':db[_0x7907('0x3c')],'as':_0x7907('0x3d')}]},_0x3a5dac={};_0x3a5dac[_0x7907('0x43')]=_[_0x7907('0x45')](db['FaxAccount'][_0x7907('0x40')]);_0x3a5dac[_0x7907('0x44')]=_[_0x7907('0x45')](_0x16230f[_0x7907('0x44')]);_0x3a5dac[_0x7907('0x46')]=_[_0x7907('0x48')](_0x3a5dac[_0x7907('0x43')],_0x3a5dac[_0x7907('0x44')]);_0x55d329[_0x7907('0x47')]=_[_0x7907('0x48')](_0x3a5dac[_0x7907('0x43')],qs['fields'](_0x16230f['query'][_0x7907('0x49')]));_0x55d329[_0x7907('0x47')]=_0x55d329[_0x7907('0x47')][_0x7907('0x4a')]?_0x55d329['attributes']:_0x3a5dac[_0x7907('0x43')];if(_0x16230f[_0x7907('0x44')][_0x7907('0x56')]){_0x55d329[_0x7907('0x53')]=[{'all':!![]}];}_0x55d329=_[_0x7907('0x51')]({},_0x55d329,_0x16230f['options']);return db['FaxAccount'][_0x7907('0x57')](_0x55d329)[_0x7907('0x34')](handleEntityNotFound(_0xebe212,null))[_0x7907('0x34')](respondWithResult(_0xebe212,null))['catch'](handleError(_0xebe212,null));};exports[_0x7907('0x58')]=function(_0x52a26a,_0x148a27){return db['FaxAccount'][_0x7907('0x58')](_0x52a26a[_0x7907('0x59')],{})['then'](function(_0x22bb76){var _0x46e92b=_0x52a26a['user']['get']({'plain':!![]});if(!_0x46e92b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46e92b[_0x7907('0x5a')]==='user'){var _0x203cf3=_0x22bb76[_0x7907('0x36')]({'plain':!![]});var _0x48f577=_0x7907('0x5b');return db[_0x7907('0x5c')][_0x7907('0x57')]({'where':{'name':_0x48f577,'userProfileId':_0x46e92b[_0x7907('0x5d')]},'raw':!![]})[_0x7907('0x34')](function(_0x3f805f){if(_0x3f805f&&_0x3f805f[_0x7907('0x5e')]===0x0){return db[_0x7907('0x37')][_0x7907('0x58')]({'name':_0x203cf3[_0x7907('0x39')],'resourceId':_0x203cf3['id'],'type':_0x3f805f[_0x7907('0x39')],'sectionId':_0x3f805f['id']},{})[_0x7907('0x34')](function(){return _0x22bb76;});}else{return _0x22bb76;}})[_0x7907('0x27')](function(_0x2f70ca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f70ca);throw _0x2f70ca;});}return _0x22bb76;})[_0x7907('0x34')](respondWithResult(_0x148a27,0xc9))[_0x7907('0x27')](handleError(_0x148a27,null));};exports[_0x7907('0x5f')]=function(_0x2e69d7,_0x26457c){if(_0x2e69d7['body']['id']){delete _0x2e69d7[_0x7907('0x59')]['id'];}return db['FaxAccount'][_0x7907('0x57')]({'where':{'id':_0x2e69d7[_0x7907('0x60')]['id']},'include':[{'model':db[_0x7907('0x3c')],'as':_0x7907('0x3d')}]})[_0x7907('0x34')](handleEntityNotFound(_0x26457c,null))[_0x7907('0x34')](saveUpdates(_0x2e69d7[_0x7907('0x59')],null))['then'](respondWithResult(_0x26457c,null))[_0x7907('0x27')](handleError(_0x26457c,null));};exports[_0x7907('0x35')]=function(_0x385a58,_0x436a29){return db[_0x7907('0x3f')][_0x7907('0x57')]({'where':{'id':_0x385a58[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x436a29,null))['then'](removeEntity(_0x436a29,null))[_0x7907('0x27')](handleError(_0x436a29,null));};exports[_0x7907('0x61')]=function(_0x3b023b,_0x1fbb08){return db[_0x7907('0x3f')]['describe']()['then'](respondWithResult(_0x1fbb08,null))[_0x7907('0x27')](handleError(_0x1fbb08,null));};exports[_0x7907('0x62')]=function(_0x19beb8,_0xd1bc2d,_0x2cda89){if(_0x19beb8[_0x7907('0x59')]['id']){delete _0x19beb8[_0x7907('0x59')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x19beb8[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0xd1bc2d,null))[_0x7907('0x34')](function(_0x34572b){if(_0x34572b){_0x19beb8['body'][_0x7907('0x63')]=_0x34572b['id'];return db[_0x7907('0x64')][_0x7907('0x58')](_0x19beb8[_0x7907('0x59')]);}})[_0x7907('0x34')](respondWithResult(_0xd1bc2d,null))['catch'](handleError(_0xd1bc2d,null));};exports[_0x7907('0x65')]=function(_0x55482f,_0x175fde,_0x4c7b29){var _0x814fa={'raw':![],'where':{}};var _0x215a4d={};var _0x108ea4={'count':0x0,'rows':[]};return db[_0x7907('0x3f')]['findOne']({'where':{'id':_0x55482f['params']['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x175fde,null))[_0x7907('0x34')](function(_0x19f4bb){if(_0x19f4bb){_0x215a4d['model']=_[_0x7907('0x45')](db[_0x7907('0x64')]['rawAttributes']);_0x215a4d[_0x7907('0x44')]=_[_0x7907('0x45')](_0x55482f['query']);_0x215a4d[_0x7907('0x46')]=_['intersection'](_0x215a4d['model'],_0x215a4d['query']);_0x814fa[_0x7907('0x47')]=_[_0x7907('0x48')](_0x215a4d[_0x7907('0x43')],qs['fields'](_0x55482f[_0x7907('0x44')][_0x7907('0x49')]));_0x814fa['attributes']=_0x814fa['attributes'][_0x7907('0x4a')]?_0x814fa['attributes']:_0x215a4d[_0x7907('0x43')];if(!_0x55482f[_0x7907('0x44')][_0x7907('0x4b')](_0x7907('0x4c'))){_0x814fa[_0x7907('0x2d')]=qs[_0x7907('0x2d')](_0x55482f['query'][_0x7907('0x2d')]);_0x814fa[_0x7907('0x2c')]=qs[_0x7907('0x2c')](_0x55482f[_0x7907('0x44')][_0x7907('0x2c')]);}_0x814fa[_0x7907('0x4d')]=qs[_0x7907('0x4e')](_0x55482f['query']['sort']);_0x814fa[_0x7907('0x4f')]=qs[_0x7907('0x46')](_[_0x7907('0x66')](_0x55482f[_0x7907('0x44')],_0x215a4d['filters']));_0x814fa[_0x7907('0x4f')]['FaxAccountId']=_0x19f4bb['id'];if(_0x55482f[_0x7907('0x44')][_0x7907('0x50')]){_0x814fa[_0x7907('0x4f')]=_['merge'](_0x814fa['where'],{'$or':_[_0x7907('0x3e')](_0x814fa[_0x7907('0x47')],function(_0x5c4a58){var _0x3b350c={};_0x3b350c[_0x5c4a58]={'$like':'%'+_0x55482f[_0x7907('0x44')][_0x7907('0x50')]+'%'};return _0x3b350c;})});}_0x814fa=_[_0x7907('0x51')]({},_0x814fa,_0x55482f[_0x7907('0x52')]);return db[_0x7907('0x64')][_0x7907('0x2f')]({'where':_0x814fa[_0x7907('0x4f')]})['then'](function(_0x1c95ae){_0x108ea4[_0x7907('0x2f')]=_0x1c95ae;if(_0x55482f[_0x7907('0x44')][_0x7907('0x56')]){_0x814fa[_0x7907('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x7907('0x54')](_0x814fa);})[_0x7907('0x34')](function(_0x287901){_0x108ea4['rows']=_0x287901;return _0x108ea4;});}})[_0x7907('0x34')](respondWithFilteredResult(_0x175fde,_0x814fa))[_0x7907('0x27')](handleError(_0x175fde,null));};exports[_0x7907('0x67')]=function(_0x21f128,_0x3e27c9,_0x5f3f99){return db[_0x7907('0x3f')]['find']({'where':{'id':_0x21f128[_0x7907('0x60')]['id']}})['then'](handleEntityNotFound(_0x3e27c9,null))[_0x7907('0x34')](function(_0x3ca590){if(_0x3ca590){return _0x3ca590[_0x7907('0x67')](_0x21f128['query'][_0x7907('0x68')]);}})[_0x7907('0x34')](respondWithStatusCode(_0x3e27c9,null))[_0x7907('0x27')](handleError(_0x3e27c9,null));};exports[_0x7907('0x69')]=function(_0x3bab8b,_0x5cca5c,_0x312739){if(_0x3bab8b[_0x7907('0x59')]['id']){delete _0x3bab8b[_0x7907('0x59')]['id'];}return db['FaxAccount'][_0x7907('0x57')]({'where':{'id':_0x3bab8b['params']['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x5cca5c,null))[_0x7907('0x34')](function(_0xc16e4f){if(_0xc16e4f){_0x3bab8b[_0x7907('0x59')][_0x7907('0x63')]=_0xc16e4f['id'];return db[_0x7907('0x6a')][_0x7907('0x58')](_0x3bab8b[_0x7907('0x59')]);}})[_0x7907('0x34')](respondWithResult(_0x5cca5c,null))[_0x7907('0x27')](handleError(_0x5cca5c,null));};exports[_0x7907('0x6b')]=function(_0x1e40f1,_0x31dfbf,_0x408cd2){var _0x4e4fd8={'raw':![],'where':{}};var _0x141847={};var _0x208af6={'count':0x0,'rows':[]};return db[_0x7907('0x3f')][_0x7907('0x6c')]({'where':{'id':_0x1e40f1['params']['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x31dfbf,null))[_0x7907('0x34')](function(_0x341b59){if(_0x341b59){_0x141847[_0x7907('0x43')]=_['keys'](db[_0x7907('0x6a')]['rawAttributes']);_0x141847[_0x7907('0x44')]=_[_0x7907('0x45')](_0x1e40f1['query']);_0x141847[_0x7907('0x46')]=_[_0x7907('0x48')](_0x141847[_0x7907('0x43')],_0x141847['query']);_0x4e4fd8['attributes']=_[_0x7907('0x48')](_0x141847[_0x7907('0x43')],qs[_0x7907('0x49')](_0x1e40f1['query']['fields']));_0x4e4fd8[_0x7907('0x47')]=_0x4e4fd8[_0x7907('0x47')][_0x7907('0x4a')]?_0x4e4fd8[_0x7907('0x47')]:_0x141847[_0x7907('0x43')];if(!_0x1e40f1[_0x7907('0x44')][_0x7907('0x4b')]('nolimit')){_0x4e4fd8[_0x7907('0x2d')]=qs[_0x7907('0x2d')](_0x1e40f1[_0x7907('0x44')][_0x7907('0x2d')]);_0x4e4fd8[_0x7907('0x2c')]=qs[_0x7907('0x2c')](_0x1e40f1[_0x7907('0x44')]['offset']);}_0x4e4fd8[_0x7907('0x4d')]=qs[_0x7907('0x4e')](_0x1e40f1[_0x7907('0x44')][_0x7907('0x4e')]);_0x4e4fd8[_0x7907('0x4f')]=qs[_0x7907('0x46')](_[_0x7907('0x66')](_0x1e40f1['query'],_0x141847[_0x7907('0x46')]));_0x4e4fd8['where'][_0x7907('0x63')]=_0x341b59['id'];if(_0x1e40f1[_0x7907('0x44')][_0x7907('0x50')]){_0x4e4fd8[_0x7907('0x4f')]=_[_0x7907('0x51')](_0x4e4fd8[_0x7907('0x4f')],{'$or':_['map'](_0x4e4fd8[_0x7907('0x47')],function(_0x12595e){var _0x447aa4={};_0x447aa4[_0x12595e]={'$like':'%'+_0x1e40f1['query'][_0x7907('0x50')]+'%'};return _0x447aa4;})});}_0x4e4fd8=_['merge']({},_0x4e4fd8,_0x1e40f1[_0x7907('0x52')]);return db[_0x7907('0x6a')]['count']({'where':_0x4e4fd8[_0x7907('0x4f')]})[_0x7907('0x34')](function(_0x25f181){_0x208af6['count']=_0x25f181;if(_0x1e40f1[_0x7907('0x44')][_0x7907('0x56')]){_0x4e4fd8['include']=[{'all':!![]}];}return db[_0x7907('0x6a')]['findAll'](_0x4e4fd8);})[_0x7907('0x34')](function(_0xbe994b){_0x208af6['rows']=_0xbe994b;return _0x208af6;});}})['then'](respondWithFilteredResult(_0x31dfbf,_0x4e4fd8))[_0x7907('0x27')](handleError(_0x31dfbf,null));};exports[_0x7907('0x6d')]=function(_0x1aedbc,_0x268135,_0x2ea7aa){return db[_0x7907('0x3f')][_0x7907('0x57')]({'where':{'id':_0x1aedbc[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x268135,null))['then'](function(_0x3b9fbe){if(_0x3b9fbe){return _0x3b9fbe[_0x7907('0x6d')](_0x1aedbc[_0x7907('0x44')][_0x7907('0x68')]);}})[_0x7907('0x34')](respondWithStatusCode(_0x268135,null))['catch'](handleError(_0x268135,null));};exports[_0x7907('0x6e')]=function(_0x2bf785,_0x50da65,_0x170024){return db[_0x7907('0x6f')][_0x7907('0x57')]({'where':{'id':_0x2bf785['params']['id']}})['then'](handleEntityNotFound(_0x50da65,null))['then'](function(_0x579a72){if(_0x579a72){return _0x579a72[_0x7907('0x6e')](_0x2bf785[_0x7907('0x59')][_0x7907('0x68')],_[_0x7907('0x70')](_0x2bf785[_0x7907('0x59')],['ids','id'])||{});}})[_0x7907('0x34')](respondWithResult(_0x50da65,null))[_0x7907('0x27')](handleError(_0x50da65,null));};exports[_0x7907('0x71')]=function(_0x1c70f0,_0x34bd65,_0x301016){var _0x4f9c89={'raw':![],'where':{}};var _0x2e3c6b={};var _0xa5a453={'count':0x0,'rows':[]};return db[_0x7907('0x3f')][_0x7907('0x6c')]({'where':{'id':_0x1c70f0[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x34bd65,null))['then'](function(_0x20d1d6){if(_0x20d1d6){_0x2e3c6b[_0x7907('0x43')]=_[_0x7907('0x45')](db[_0x7907('0x6f')][_0x7907('0x40')]);_0x2e3c6b[_0x7907('0x44')]=_['keys'](_0x1c70f0[_0x7907('0x44')]);_0x2e3c6b[_0x7907('0x46')]=_[_0x7907('0x48')](_0x2e3c6b[_0x7907('0x43')],_0x2e3c6b[_0x7907('0x44')]);_0x4f9c89[_0x7907('0x47')]=_[_0x7907('0x48')](_0x2e3c6b[_0x7907('0x43')],qs[_0x7907('0x49')](_0x1c70f0[_0x7907('0x44')][_0x7907('0x49')]));_0x4f9c89[_0x7907('0x47')]=_0x4f9c89[_0x7907('0x47')][_0x7907('0x4a')]?_0x4f9c89[_0x7907('0x47')]:_0x2e3c6b[_0x7907('0x43')];if(!_0x1c70f0[_0x7907('0x44')][_0x7907('0x4b')]('nolimit')){_0x4f9c89[_0x7907('0x2d')]=qs[_0x7907('0x2d')](_0x1c70f0[_0x7907('0x44')][_0x7907('0x2d')]);_0x4f9c89[_0x7907('0x2c')]=qs[_0x7907('0x2c')](_0x1c70f0['query'][_0x7907('0x2c')]);}_0x4f9c89[_0x7907('0x4d')]=qs[_0x7907('0x4e')](_0x1c70f0[_0x7907('0x44')]['sort']);_0x4f9c89[_0x7907('0x4f')]=qs[_0x7907('0x46')](_['pick'](_0x1c70f0[_0x7907('0x44')],_0x2e3c6b['filters']));_0x4f9c89[_0x7907('0x4f')]['FaxAccountId']=_0x20d1d6['id'];if(_0x1c70f0[_0x7907('0x44')][_0x7907('0x50')]){_0x4f9c89['where']=_[_0x7907('0x51')](_0x4f9c89[_0x7907('0x4f')],{'$or':_[_0x7907('0x3e')](_0x4f9c89[_0x7907('0x47')],function(_0x257eb8){var _0x25acd7={};_0x25acd7[_0x257eb8]={'$like':'%'+_0x1c70f0[_0x7907('0x44')][_0x7907('0x50')]+'%'};return _0x25acd7;})});}_0x4f9c89=_[_0x7907('0x51')]({},_0x4f9c89,_0x1c70f0[_0x7907('0x52')]);return db[_0x7907('0x6f')]['count']({'where':_0x4f9c89[_0x7907('0x4f')]})[_0x7907('0x34')](function(_0xc89a71){_0xa5a453[_0x7907('0x2f')]=_0xc89a71;if(_0x1c70f0[_0x7907('0x44')][_0x7907('0x56')]){_0x4f9c89[_0x7907('0x53')]=[{'model':db['CmContact'],'as':_0x7907('0x72'),'required':![]},{'model':db[_0x7907('0x73')],'as':_0x7907('0x74'),'attributes':['name','fullname',_0x7907('0x75')],'required':![]},{'model':db[_0x7907('0x76')],'as':_0x7907('0x77'),'attributes':['id',_0x7907('0x39'),_0x7907('0x78')],'where':_0x1c70f0[_0x7907('0x44')][_0x7907('0x79')]?{'id':_0x1c70f0[_0x7907('0x44')][_0x7907('0x79')]}:undefined,'required':_0x1c70f0['query'][_0x7907('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0x7907('0x54')](_0x4f9c89);})[_0x7907('0x34')](function(_0x50cb97){_0xa5a453['rows']=_0x50cb97;return _0xa5a453;});}})['then'](respondWithFilteredResult(_0x34bd65,_0x4f9c89))['catch'](handleError(_0x34bd65,null));};exports[_0x7907('0x7a')]=function(_0x6781bc,_0xd3ea4){var _0x9c8d19=_0x6781bc['params']['id'];var _0x54543f=_0x6781bc[_0x7907('0x59')];var _0xd76a91=0xc8;var _0x1f0fa3=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x7907('0x7b')][_0x7907('0x7c')][_0x7907('0x7d')][_0x7907('0x7e')]},function(_0x43bf8a){return db[_0x7907('0x3f')]['findOne']({'where':{'id':_0x9c8d19},'transaction':_0x43bf8a})[_0x7907('0x34')](function(_0x24d67e){if(_0x24d67e){return db[_0x7907('0x7f')][_0x7907('0x35')]({'where':{'FaxAccountId':_0x9c8d19},'transaction':_0x43bf8a})['then'](function(){var _0x230fe9=_[_0x7907('0x3e')](_0x54543f,function(_0xcf8c0b){_0xcf8c0b['FaxAccountId']=_0x9c8d19;return _0xcf8c0b;});return db[_0x7907('0x7f')]['bulkCreate'](_0x230fe9,{'transaction':_0x43bf8a});});}else{_0xd76a91=0x194;_0x1f0fa3=[];}});})[_0x7907('0x34')](function(){if(_0xd76a91!==0x194){return db['FaxApplication'][_0x7907('0x80')]({'where':{'FaxAccountId':_0x9c8d19},'order':'priority'})['then'](function(_0x34b43f){_0x1f0fa3=_0x34b43f;});}})[_0x7907('0x27')](function(_0x179d5a){_0xd76a91=0x1f4;logger[_0x7907('0x24')](_0x179d5a[_0x7907('0x38')]);if(_0x179d5a[_0x7907('0x39')]){delete _0x179d5a['name'];}_0x1f0fa3=_0x179d5a;})[_0x7907('0x81')](function(){if(_0x1f0fa3===null){_0xd3ea4[_0x7907('0x28')](_0xd76a91);}else{if(_0xd76a91===0x1f4){_0xd3ea4[_0x7907('0x29')](_0xd76a91)['send'](_0x1f0fa3);}else{_0xd3ea4[_0x7907('0x29')](_0xd76a91)[_0x7907('0x2b')](_0x1f0fa3);}}});};exports[_0x7907('0x82')]=function(_0x5a9ad2,_0x23690f,_0x431eab){var _0x57983c={};var _0xb04e4a={};var _0x492190;var _0x750b6;return db[_0x7907('0x3f')][_0x7907('0x6c')]({'where':{'id':_0x5a9ad2[_0x7907('0x60')]['id']}})['then'](handleEntityNotFound(_0x23690f,null))[_0x7907('0x34')](function(_0x28a6ae){if(_0x28a6ae){_0x492190=_0x28a6ae;_0xb04e4a[_0x7907('0x43')]=_[_0x7907('0x45')](db['FaxApplication'][_0x7907('0x40')]);_0xb04e4a['query']=_[_0x7907('0x45')](_0x5a9ad2[_0x7907('0x44')]);_0xb04e4a[_0x7907('0x46')]=_[_0x7907('0x48')](_0xb04e4a[_0x7907('0x43')],_0xb04e4a[_0x7907('0x44')]);_0x57983c[_0x7907('0x47')]=_[_0x7907('0x48')](_0xb04e4a['model'],qs[_0x7907('0x49')](_0x5a9ad2['query']['fields']));_0x57983c['attributes']=_0x57983c[_0x7907('0x47')][_0x7907('0x4a')]?_0x57983c[_0x7907('0x47')]:_0xb04e4a[_0x7907('0x43')];_0x57983c[_0x7907('0x4d')]=qs['sort'](_0x5a9ad2[_0x7907('0x44')]['sort']);_0x57983c[_0x7907('0x4f')]=qs[_0x7907('0x46')](_['pick'](_0x5a9ad2[_0x7907('0x44')],_0xb04e4a[_0x7907('0x46')]));if(_0x5a9ad2[_0x7907('0x44')]['filter']){_0x57983c[_0x7907('0x4f')]=_[_0x7907('0x51')](_0x57983c['where'],{'$or':_[_0x7907('0x3e')](_0x57983c[_0x7907('0x47')],function(_0x491444){var _0x881420={};_0x881420[_0x491444]={'$like':'%'+_0x5a9ad2[_0x7907('0x44')][_0x7907('0x50')]+'%'};return _0x881420;})});}_0x57983c=_[_0x7907('0x51')]({},_0x57983c,_0x5a9ad2[_0x7907('0x52')]);return _0x492190[_0x7907('0x82')](_0x57983c);}})['then'](function(_0x4e6b86){if(_0x4e6b86){_0x750b6=_0x4e6b86[_0x7907('0x4a')];if(!_0x5a9ad2[_0x7907('0x44')][_0x7907('0x4b')](_0x7907('0x4c'))){_0x57983c['limit']=qs[_0x7907('0x2d')](_0x5a9ad2[_0x7907('0x44')][_0x7907('0x2d')]);_0x57983c['offset']=qs[_0x7907('0x2c')](_0x5a9ad2[_0x7907('0x44')][_0x7907('0x2c')]);}return _0x492190[_0x7907('0x82')](_0x57983c);}})[_0x7907('0x34')](function(_0x20883c){if(_0x20883c){return _0x20883c?{'count':_0x750b6,'rows':_0x20883c}:null;}})[_0x7907('0x34')](respondWithResult(_0x23690f,null))['catch'](handleError(_0x23690f,null));};function Extension(_0x59bf33,_0x26bae0,_0x4427d6,_0x136cd4){this['context']=_0x7907('0x83');this[_0x7907('0x84')]=_0x59bf33[_0x7907('0x85')];this[_0x7907('0x86')]=_0x136cd4;this[_0x7907('0x42')]=_0x7907('0x87');this[_0x7907('0x88')]=_0x7907('0x89');this[_0x7907('0x63')]=_0x59bf33['id'];this[_0x7907('0x8a')]=_0x26bae0;this[_0x7907('0x8b')]=_0x4427d6;}function createExtensionsReciveFax(_0x216234){var _0x3c00c5=0x1;var _0x4be0a6=[];_0x4be0a6[_0x7907('0x8c')](new Extension(_0x216234,_0x3c00c5,'',_0x7907('0x8d')));_0x3c00c5+=0x1;_0x4be0a6[_0x7907('0x8c')](new Extension(_0x216234,_0x3c00c5,'CDR(type)=inbound-fax','Set'));_0x3c00c5+=0x1;for(var _0x400f55 in _0x216234){if(_0x216234[_0x7907('0x4b')](_0x400f55)&&(_0x400f55===_0x7907('0x8e')||_0x400f55===_0x7907('0x85')||_0x400f55===_0x7907('0x8f')||_0x400f55===_0x7907('0x90')||_0x400f55===_0x7907('0x91')||_0x400f55===_0x7907('0x92')||_0x400f55===_0x7907('0x93')||_0x400f55===_0x7907('0x94')||_0x400f55==='t38timeout')){_0x4be0a6[_0x7907('0x8c')](new Extension(_0x216234,_0x3c00c5,_0x7907('0x95')+_0x400f55+')='+_0x216234[_0x400f55],_0x7907('0x96')));_0x3c00c5+=0x1;}}_0x4be0a6[_0x7907('0x8c')](new Extension(_0x216234,_0x3c00c5,'6',_0x7907('0x97')));_0x3c00c5+=0x1;_0x4be0a6[_0x7907('0x8c')](new Extension(_0x216234,_0x3c00c5,_0x7907('0x98'),_0x7907('0x99')));_0x3c00c5=0x0;return _0x4be0a6;}exports['addAccountApplications']=function(_0x384c27,_0xe43655,_0x1f6f4f){var _0x1427f9;return db[_0x7907('0x7b')]['transaction'](function(_0x1ba336){return db['FaxAccount'][_0x7907('0x58')](_0x384c27[_0x7907('0x59')],{'transaction':_0x1ba336})[_0x7907('0x34')](function(_0xb5f053){_0x1427f9=_0xb5f053[_0x7907('0x36')]({'plain':!![]});return db[_0x7907('0x9a')][_0x7907('0x9b')](createExtensionsReciveFax(_0x1427f9),{'transaction':_0x1ba336});});})['then'](function(){return _0x1427f9;})[_0x7907('0x34')](respondWithResult(_0xe43655,null))[_0x7907('0x27')](handleError(_0xe43655,null));};exports['updateAccountApplications']=function(_0x254fee,_0x53a88a,_0x3a9bd3){var _0x2edaf2;return db[_0x7907('0x7b')][_0x7907('0x9c')](function(_0x51f23c){return db[_0x7907('0x3f')][_0x7907('0x5f')](_0x254fee[_0x7907('0x59')],{'where':{'id':_0x254fee[_0x7907('0x59')]['id']},'transaction':_0x51f23c})[_0x7907('0x34')](function(_0x5972e0){return db[_0x7907('0x9a')]['destroy']({'where':{'FaxAccountId':_0x254fee['body']['id']},'transaction':_0x51f23c})['then'](function(_0x33cc1b){return db[_0x7907('0x9a')][_0x7907('0x9b')](createExtensionsReciveFax(_[_0x7907('0x70')](_0x254fee['body'],[_0x7907('0x9d'),_0x7907('0x9e'),_0x7907('0x9f'),'updatedAt',_0x7907('0xa0'),_0x7907('0xa1')])),{'transaction':_0x51f23c});});});})[_0x7907('0x34')](function(){return db[_0x7907('0x3f')][_0x7907('0xa2')](_0x254fee['body']['id']);})[_0x7907('0x34')](respondWithResult(_0x53a88a,null))[_0x7907('0x27')](handleError(_0x53a88a,null));};exports[_0x7907('0xa3')]=function(_0x3c01d9,_0x226a1c,_0x385b67){var _0x333fe5={'raw':!![],'where':{}};var _0x265de6={};var _0x4c91f9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7907('0x6c')]({'where':{'id':_0x3c01d9[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x226a1c,null))['then'](function(_0x1187d6){if(_0x1187d6){_0x265de6[_0x7907('0x43')]=_[_0x7907('0x45')](db[_0x7907('0xa4')][_0x7907('0x40')]);_0x265de6[_0x7907('0x44')]=_[_0x7907('0x45')](_0x3c01d9['query']);_0x265de6[_0x7907('0x46')]=_[_0x7907('0x48')](_0x265de6[_0x7907('0x43')],_0x265de6['query']);_0x333fe5['attributes']=_[_0x7907('0x48')](_0x265de6[_0x7907('0x43')],qs[_0x7907('0x49')](_0x3c01d9[_0x7907('0x44')][_0x7907('0x49')]));_0x333fe5[_0x7907('0x47')]=_0x333fe5[_0x7907('0x47')][_0x7907('0x4a')]?_0x333fe5[_0x7907('0x47')]:_0x265de6[_0x7907('0x43')];if(!_0x3c01d9[_0x7907('0x44')]['hasOwnProperty'](_0x7907('0x4c'))){_0x333fe5['limit']=qs[_0x7907('0x2d')](_0x3c01d9[_0x7907('0x44')][_0x7907('0x2d')]);_0x333fe5[_0x7907('0x2c')]=qs[_0x7907('0x2c')](_0x3c01d9['query'][_0x7907('0x2c')]);}_0x333fe5[_0x7907('0x4d')]=qs[_0x7907('0x4e')](_0x3c01d9['query'][_0x7907('0x4e')]);_0x333fe5[_0x7907('0x4f')]=qs[_0x7907('0x46')](_[_0x7907('0x66')](_0x3c01d9[_0x7907('0x44')],_0x265de6[_0x7907('0x46')]));_0x333fe5[_0x7907('0x4f')][_0x7907('0x63')]=_0x1187d6['id'];if(_0x3c01d9[_0x7907('0x44')][_0x7907('0x50')]){_0x333fe5[_0x7907('0x4f')]=_[_0x7907('0x51')](_0x333fe5['where'],{'$or':_[_0x7907('0x3e')](_0x333fe5['attributes'],function(_0x4ae9b0){var _0x108460={};_0x108460[_0x4ae9b0]={'$like':'%'+_0x3c01d9[_0x7907('0x44')][_0x7907('0x50')]+'%'};return _0x108460;})});}if(_0x3c01d9[_0x7907('0x44')][_0x7907('0xa5')]){var _0x3487ff=_0x3c01d9['query'][_0x7907('0xa5')][_0x7907('0xa6')](',');var _0x1f5e18={};_0x1f5e18[_0x3487ff[0x0]]={'$gte':moment(_0x3487ff[0x1])['format'](_0x7907('0xa7'))};_0x333fe5['where']=_[_0x7907('0x51')](_0x333fe5['where'],_0x1f5e18);}_0x333fe5=_[_0x7907('0x51')]({},_0x333fe5,_0x3c01d9[_0x7907('0x52')]);return db['FaxMessage'][_0x7907('0x2f')]({'where':_0x333fe5['where']})[_0x7907('0x34')](function(_0x1c666f){_0x4c91f9[_0x7907('0x2f')]=_0x1c666f;if(_0x3c01d9['query']['includeAll']){_0x333fe5['include']=[{'all':!![]}];}return db[_0x7907('0xa4')]['findAll'](_0x333fe5);})[_0x7907('0x34')](function(_0x387c40){_0x4c91f9[_0x7907('0x55')]=_0x387c40;return _0x4c91f9;});}})[_0x7907('0x34')](respondWithFilteredResult(_0x226a1c,_0x333fe5))['catch'](handleError(_0x226a1c,null));};exports[_0x7907('0x3a')]=function(_0x169de6,_0x3caee9,_0x503498){var _0xe218e6,_0x4e9203={},_0x310eb9;if(_0x169de6['body']['to']){_0x310eb9=_0x169de6[_0x7907('0x59')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x169de6[_0x7907('0x60')]['id']},'include':[{'model':db[_0x7907('0xa8')],'as':'List','include':[{'model':db[_0x7907('0xa9')],'as':_0x7907('0xaa'),'where':{'fax':_0x310eb9},'limit':0x1,'order':[[_0x7907('0xab'),_0x7907('0xac')]]}]}]})[_0x7907('0x34')](handleEntityNotFound(_0x3caee9,null))[_0x7907('0x34')](function(_0x4503d2){_0xe218e6=_0x4503d2;if(_0x169de6[_0x7907('0x59')][_0x7907('0xad')]&&_0x169de6[_0x7907('0x59')][_0x7907('0xad')][_0x7907('0x4a')]){for(var _0xb94e09=0x0;_0xb94e09<_0x169de6['body'][_0x7907('0xad')]['length'];_0xb94e09+=0x1){_0x169de6[_0x7907('0x59')][_0x7907('0xad')][_0xb94e09]={'filename':_0x169de6[_0x7907('0x59')][_0x7907('0xad')][_0xb94e09][_0x7907('0x39')],'id':_0x169de6[_0x7907('0x59')][_0x7907('0xad')][_0xb94e09]['id'],'path':path[_0x7907('0xae')](config['root'],'server/files/attachments',_0x169de6[_0x7907('0x59')][_0x7907('0xad')][_0xb94e09][_0x7907('0xaf')])};}}return respondWithRpcPromise(_0x7907('0xb0'),'CheckAfterSend',{'FaxAccountId':_[_0x7907('0xb1')](_0x169de6[_0x7907('0x60')]['id'])?undefined:_0x169de6[_0x7907('0x60')]['id'],'path':_[_0x7907('0xb1')](_0x169de6['body'][_0x7907('0xad')][0x0][_0x7907('0xb2')])?undefined:_0x169de6['body']['attachments'][0x0]['path'],'fax':_[_0x7907('0xb1')](_0x169de6[_0x7907('0x59')]['to'][0x0])?undefined:_0x169de6[_0x7907('0x59')]['to'][0x0]},client9002);})['then'](function(){if(_0xe218e6){if(_[_0x7907('0xb1')](_0x169de6[_0x7907('0x59')][_0x7907('0xb3')])){_0x169de6[_0x7907('0x59')][_0x7907('0xb3')]=util[_0x7907('0xb4')](_0x7907('0xb5'),_0xe218e6['name'],_0xe218e6[_0x7907('0xb6')]);}if(_0xe218e6[_0x7907('0xb7')]){if(_0xe218e6[_0x7907('0xb7')][_0x7907('0xaa')][_0x7907('0x4a')]){return _0xe218e6['List'][_0x7907('0xaa')][0x0];}else{return db[_0x7907('0xa9')]['create'](_[_0x7907('0xb8')](_0x169de6['body'],{'firstName':_0x169de6['body']['to'][0x0],'phone':_0x169de6[_0x7907('0x59')]['to'][0x0],'fax':_0x169de6[_0x7907('0x59')]['to'][0x0],'ListId':_0xe218e6[_0x7907('0xa1')]}));}}else{throw new Error(_0x7907('0xb9'));}}else{throw new Error(_0x7907('0xba'));}})[_0x7907('0x34')](function(_0x3975ac){if(_0x3975ac){return db[_0x7907('0x6f')][_0x7907('0x57')]({'where':{'ContactId':_0x3975ac['id'],'closed':![],'FaxAccountId':_0xe218e6['id']}})[_0x7907('0x34')](function(_0x5bc8e8){if(_0x5bc8e8){return[_0x5bc8e8,![]];}return db[_0x7907('0x6f')][_0x7907('0x58')]({'UserId':_0x169de6[_0x7907('0xbb')]['id'],'ContactId':_0x3975ac['id'],'FaxAccountId':_0xe218e6['id'],'fax':_0x169de6[_0x7907('0x59')]['to'][0x0],'firstMsgDirection':_0x7907('0xbc'),'Messages':[_[_0x7907('0x51')](_0x169de6[_0x7907('0x59')],{'read':![],'body':_0x169de6[_0x7907('0x59')][_0x7907('0xad')][0x0][_0x7907('0xbd')],'FaxAccountId':_0xe218e6['id'],'UserId':_0x169de6[_0x7907('0xbb')]['id'],'ContactId':_0x3975ac['id'],'AttachmentId':_0x169de6[_0x7907('0x59')][_0x7907('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x7907('0xa4')],'as':_0x7907('0xbe')}]})['then'](function(_0x59431a){return[_0x59431a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7907('0xbf')](function(_0x1e6c24,_0x1d93fa){if(_0x1d93fa){return _0x1e6c24;}return db[_0x7907('0xa4')][_0x7907('0x58')]({'direction':_0x7907('0xbc'),'read':![],'body':_0x169de6[_0x7907('0x59')][_0x7907('0xad')][0x0][_0x7907('0xbd')],'FaxAccountId':_0xe218e6['id'],'FaxInteractionId':_0x1e6c24['id'],'UserId':_0x169de6['user']['id'],'ContactId':_0x1e6c24[_0x7907('0xc0')],'AttachmentId':_0x169de6[_0x7907('0x59')][_0x7907('0xad')][0x0]['id']})[_0x7907('0x34')](function(_0x106122){_0x1e6c24[_0x7907('0xc1')][_0x7907('0xbe')]=[];_0x1e6c24[_0x7907('0xc1')][_0x7907('0xbe')][_0x7907('0x8c')](_0x106122['dataValues']);return _0x1e6c24;});})[_0x7907('0x34')](function(_0x448f64){respondWithRpcPromise(_0x7907('0xc2'),_0x7907('0xc2'),{'FaxAccountId':_[_0x7907('0xb1')](_0x169de6[_0x7907('0x60')]['id'])?undefined:_0x169de6[_0x7907('0x60')]['id'],'path':_[_0x7907('0xb1')](_0x169de6[_0x7907('0x59')][_0x7907('0xad')][0x0][_0x7907('0xb2')])?undefined:_0x169de6[_0x7907('0x59')][_0x7907('0xad')][0x0][_0x7907('0xb2')],'fax':_[_0x7907('0xb1')](_0x169de6[_0x7907('0x59')]['to'][0x0])?undefined:_0x169de6[_0x7907('0x59')]['to'][0x0],'AttachmentId':_0x169de6['body'][_0x7907('0xad')][0x0]['id']},client9002)[_0x7907('0x34')](function(_0x31dabe){logger[_0x7907('0x1e')]('SendFaxRpc,\x20%s',_0x31dabe);})['catch'](function(_0x24308b){logger[_0x7907('0x1e')](_0x7907('0xc3'),_0x24308b);});return _0x448f64;})[_0x7907('0x34')](respondWithResult(_0x3caee9,null))[_0x7907('0x27')](handleError(_0x3caee9,null));};exports[_0x7907('0xc4')]=function(_0x23205d,_0x53fa36,_0x239eda){return db['FaxAccount'][_0x7907('0x57')]({'where':{'id':_0x23205d[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x53fa36,null))[_0x7907('0x34')](function(_0x184b1a){if(_0x184b1a){return _0x184b1a[_0x7907('0xc4')](_0x23205d[_0x7907('0x59')]['ids'],_[_0x7907('0x70')](_0x23205d['body'],['ids','id'])||{})[_0x7907('0xbf')](function(_0x5c294f){for(var _0x2584b5=0x0;_0x2584b5<_0x23205d[_0x7907('0x59')]['ids'][_0x7907('0x4a')];_0x2584b5+=0x1){socket[_0x7907('0xc5')](_0x7907('0xc6'),{'UserId':Number(_0x23205d[_0x7907('0x59')][_0x7907('0x68')][_0x2584b5]),'FaxAccountId':Number(_0x23205d[_0x7907('0x60')]['id'])});}return _0x5c294f;});}})[_0x7907('0x34')](respondWithResult(_0x53fa36,null))['catch'](handleError(_0x53fa36,null));};exports[_0x7907('0xc7')]=function(_0x2834b8,_0x36d583,_0x4695cf){return db[_0x7907('0x3f')][_0x7907('0x57')]({'where':{'id':_0x2834b8[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0x36d583,null))[_0x7907('0x34')](function(_0xd58ee8){if(_0xd58ee8){return _0xd58ee8['removeAgents'](_0x2834b8[_0x7907('0x44')][_0x7907('0x68')])[_0x7907('0x34')](function(){if(_['isArray'](_0x2834b8['query']['ids'])){for(var _0x3ee59d=0x0;_0x3ee59d<_0x2834b8['query'][_0x7907('0x68')][_0x7907('0x4a')];_0x3ee59d+=0x1){socket[_0x7907('0xc5')](_0x7907('0xc8'),{'UserId':Number(_0x2834b8[_0x7907('0x44')][_0x7907('0x68')][_0x3ee59d]),'FaxAccountId':Number(_0x2834b8[_0x7907('0x60')]['id'])});}}else{socket[_0x7907('0xc5')](_0x7907('0xc8'),{'UserId':Number(_0x2834b8[_0x7907('0x44')][_0x7907('0x68')]),'FaxAccountId':Number(_0x2834b8[_0x7907('0x60')]['id'])});}});}})[_0x7907('0x34')](respondWithStatusCode(_0x36d583,null))['catch'](handleError(_0x36d583,null));};exports[_0x7907('0xc9')]=function(_0x83bec4,_0xb0b2c7,_0x25ee16){var _0x2189ad={};var _0x58caee={};var _0x3437c2;var _0x5ac1e3;return db[_0x7907('0x3f')][_0x7907('0x6c')]({'where':{'id':_0x83bec4[_0x7907('0x60')]['id']}})[_0x7907('0x34')](handleEntityNotFound(_0xb0b2c7,null))[_0x7907('0x34')](function(_0x3c6a96){if(_0x3c6a96){_0x3437c2=_0x3c6a96;_0x58caee[_0x7907('0x43')]=_[_0x7907('0x45')](db[_0x7907('0x73')]['rawAttributes']);_0x58caee[_0x7907('0x44')]=_[_0x7907('0x45')](_0x83bec4[_0x7907('0x44')]);_0x58caee[_0x7907('0x46')]=_['intersection'](_0x58caee[_0x7907('0x43')],_0x58caee['query']);_0x2189ad['attributes']=_[_0x7907('0x48')](_0x58caee[_0x7907('0x43')],qs['fields'](_0x83bec4['query']['fields']));_0x2189ad['attributes']=_0x2189ad[_0x7907('0x47')][_0x7907('0x4a')]?_0x2189ad['attributes']:_0x58caee[_0x7907('0x43')];_0x2189ad['order']=qs[_0x7907('0x4e')](_0x83bec4[_0x7907('0x44')][_0x7907('0x4e')]);_0x2189ad[_0x7907('0x4f')]=qs[_0x7907('0x46')](_['pick'](_0x83bec4['query'],_0x58caee[_0x7907('0x46')]));if(_0x83bec4[_0x7907('0x44')][_0x7907('0x50')]){_0x2189ad['where']=_[_0x7907('0x51')](_0x2189ad['where'],{'$or':_[_0x7907('0x3e')](_0x2189ad[_0x7907('0x47')],function(_0x552f49){var _0x1fa7d4={};_0x1fa7d4[_0x552f49]={'$like':'%'+_0x83bec4[_0x7907('0x44')][_0x7907('0x50')]+'%'};return _0x1fa7d4;})});}_0x2189ad=_[_0x7907('0x51')]({},_0x2189ad,_0x83bec4[_0x7907('0x52')]);return _0x3437c2[_0x7907('0xc9')](_0x2189ad);}})[_0x7907('0x34')](function(_0xc66d68){if(_0xc66d68){_0x5ac1e3=_0xc66d68[_0x7907('0x4a')];if(!_0x83bec4[_0x7907('0x44')][_0x7907('0x4b')]('nolimit')){_0x2189ad[_0x7907('0x2d')]=qs[_0x7907('0x2d')](_0x83bec4[_0x7907('0x44')]['limit']);_0x2189ad['offset']=qs[_0x7907('0x2c')](_0x83bec4[_0x7907('0x44')]['offset']);}return _0x3437c2[_0x7907('0xc9')](_0x2189ad);}})['then'](function(_0x5bc95f){if(_0x5bc95f){return _0x5bc95f?{'count':_0x5ac1e3,'rows':_0x5bc95f}:null;}})[_0x7907('0x34')](respondWithResult(_0xb0b2c7,null))[_0x7907('0x27')](handleError(_0xb0b2c7,null));}; \ No newline at end of file +var _0x7d6c=['end','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','UserProfileResource','status','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','describe','Disposition','findOne','FaxAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','addInteraction','FaxInteraction','CmContact','Owner','fullname','internal','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','localstationid','app','system','description','push','Answer','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','info','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','register','jayson/promise','client','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus'];(function(_0x556408,_0x350888){var _0x371c3f=function(_0x28b538){while(--_0x28b538){_0x556408['push'](_0x556408['shift']());}};_0x371c3f(++_0x350888);}(_0x7d6c,0x15a));var _0xc7d6=function(_0x56deaa,_0x521441){_0x56deaa=_0x56deaa-0x0;var _0x31dc54=_0x7d6c[_0x56deaa];return _0x31dc54;};'use strict';var emlformat=require(_0xc7d6('0x0'));var rimraf=require(_0xc7d6('0x1'));var zipdir=require(_0xc7d6('0x2'));var jsonpatch=require(_0xc7d6('0x3'));var rp=require(_0xc7d6('0x4'));var moment=require(_0xc7d6('0x5'));var BPromise=require(_0xc7d6('0x6'));var Mustache=require(_0xc7d6('0x7'));var util=require('util');var path=require(_0xc7d6('0x8'));var sox=require(_0xc7d6('0x9'));var csv=require(_0xc7d6('0xa'));var ejs=require(_0xc7d6('0xb'));var fs=require('fs');var fs_extra=require(_0xc7d6('0xc'));var _=require(_0xc7d6('0xd'));var squel=require(_0xc7d6('0xe'));var crypto=require(_0xc7d6('0xf'));var jsforce=require(_0xc7d6('0x10'));var deskjs=require(_0xc7d6('0x11'));var toCsv=require(_0xc7d6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc7d6('0x12'));var qs=require(_0xc7d6('0x13'));var as=require(_0xc7d6('0x14'));var hardwareService=require(_0xc7d6('0x15'));var logger=require(_0xc7d6('0x16'))(_0xc7d6('0x17'));var utils=require(_0xc7d6('0x18'));var config=require(_0xc7d6('0x19'));var licenseUtil=require(_0xc7d6('0x1a'));var db=require(_0xc7d6('0x1b'))['db'];config['redis']=_[_0xc7d6('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7d6('0x1d')]));require('./faxAccount.socket')[_0xc7d6('0x1e')](socket);var jayson=require(_0xc7d6('0x1f'));var client=jayson[_0xc7d6('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xc7d6('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x699a21,_0x555b38,_0x50c72a,_0x2b8b9b){return new BPromise(function(_0x2a8aff,_0xbf45f){var _0x26f17f=_0x2b8b9b||client;return _0x26f17f[_0xc7d6('0x21')](_0x699a21,_0x50c72a)[_0xc7d6('0x22')](function(_0x1e50ae){logger['info']('FaxAccount,\x20%s,\x20%s',_0x555b38,_0xc7d6('0x23'));logger[_0xc7d6('0x24')](_0xc7d6('0x25'),_0x555b38,_0xc7d6('0x23'),JSON[_0xc7d6('0x26')](_0x1e50ae));if(_0x1e50ae['error']){if(_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x28')]===0x1f4){logger[_0xc7d6('0x27')](_0xc7d6('0x29'),_0x555b38,_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x2a')]);return _0xbf45f(_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x2a')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x555b38,_0x1e50ae[_0xc7d6('0x27')][_0xc7d6('0x2a')]);return _0x2a8aff(_0x1e50ae['error'][_0xc7d6('0x2a')]);}else{logger['info'](_0xc7d6('0x29'),_0x555b38,_0xc7d6('0x23'));_0x2a8aff(_0x1e50ae[_0xc7d6('0x2b')][_0xc7d6('0x2a')]);}})[_0xc7d6('0x2c')](function(_0x1a4545){logger[_0xc7d6('0x27')]('FaxAccount,\x20%s,\x20%s',_0x555b38,_0x1a4545);_0xbf45f(_0x1a4545);});});}function respondWithStatusCode(_0x31b03c,_0x1a6b89){_0x1a6b89=_0x1a6b89||0xcc;return function(_0x6188ba){if(_0x6188ba){return _0x31b03c[_0xc7d6('0x2d')](_0x1a6b89);}return _0x31b03c['status'](_0x1a6b89)[_0xc7d6('0x2e')]();};}function respondWithResult(_0x2e72a9,_0x1ab7d7){_0x1ab7d7=_0x1ab7d7||0xc8;return function(_0x341d3c){if(_0x341d3c){return _0x2e72a9['status'](_0x1ab7d7)[_0xc7d6('0x2f')](_0x341d3c);}};}function respondWithFilteredResult(_0x176751,_0x32f812){return function(_0x5187f6){if(_0x5187f6){var _0x4032a4=typeof _0x32f812[_0xc7d6('0x30')]===_0xc7d6('0x31')&&typeof _0x32f812[_0xc7d6('0x32')]==='undefined';var _0x3d000e=_0x5187f6['count'];var _0x54d0fa=_0x4032a4?0x0:_0x32f812[_0xc7d6('0x30')];var _0xb73a40=_0x4032a4?_0x5187f6[_0xc7d6('0x33')]:_0x32f812['offset']+_0x32f812['limit'];var _0x59e2ba;if(_0xb73a40>=_0x3d000e){_0xb73a40=_0x3d000e;_0x59e2ba=0xc8;}else{_0x59e2ba=0xce;}_0x176751['status'](_0x59e2ba);return _0x176751[_0xc7d6('0x34')]('Content-Range',_0x54d0fa+'-'+_0xb73a40+'/'+_0x3d000e)[_0xc7d6('0x2f')](_0x5187f6);}return null;};}function patchUpdates(_0x53013d){return function(_0x44e03d){try{jsonpatch[_0xc7d6('0x35')](_0x44e03d,_0x53013d,!![]);}catch(_0x39b30c){return BPromise['reject'](_0x39b30c);}return _0x44e03d[_0xc7d6('0x36')]();};}function saveUpdates(_0x190885,_0x19d322){return function(_0x567550){if(_0x567550){return _0x567550[_0xc7d6('0x37')](_0x190885)['then'](function(_0x4c6592){return _0x4c6592;});}return null;};}function removeEntity(_0x162e5e,_0x5150b9){return function(_0x4bb2a1){if(_0x4bb2a1){return _0x4bb2a1[_0xc7d6('0x38')]()[_0xc7d6('0x22')](function(){var _0x72fdf=_0x4bb2a1[_0xc7d6('0x39')]({'plain':!![]});var _0x1f0732='FaxAccounts';return db[_0xc7d6('0x3a')]['destroy']({'where':{'type':_0x1f0732,'resourceId':_0x72fdf['id']}})['then'](function(){return _0x4bb2a1;});})[_0xc7d6('0x22')](function(){_0x162e5e[_0xc7d6('0x3b')](0xcc)[_0xc7d6('0x2e')]();});}};}function handleEntityNotFound(_0x40a99c,_0x5ca1d4){return function(_0x3ea1e8){if(!_0x3ea1e8){_0x40a99c[_0xc7d6('0x2d')](0x194);}return _0x3ea1e8;};}function handleError(_0x2e1b15,_0x311a0a){_0x311a0a=_0x311a0a||0x1f4;return function(_0x51b88c){logger[_0xc7d6('0x27')](_0x51b88c[_0xc7d6('0x3c')]);if(_0x51b88c[_0xc7d6('0x3d')]){delete _0x51b88c['name'];}_0x2e1b15[_0xc7d6('0x3b')](_0x311a0a)[_0xc7d6('0x3e')](_0x51b88c);};}exports[_0xc7d6('0x3f')]=function(_0x3971e3,_0x4adef7){var _0x26ab65={'include':[{'model':db[_0xc7d6('0x40')],'as':_0xc7d6('0x41')}]},_0x1f9092={},_0x509c18={'count':0x0,'rows':[]};var _0x6835fa=_[_0xc7d6('0x42')](db[_0xc7d6('0x43')][_0xc7d6('0x44')],function(_0x5235aa){return{'name':_0x5235aa[_0xc7d6('0x45')],'type':_0x5235aa['type'][_0xc7d6('0x46')]};});_0x1f9092[_0xc7d6('0x47')]=_['map'](_0x6835fa,_0xc7d6('0x3d'));_0x1f9092[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x3971e3[_0xc7d6('0x48')]);_0x1f9092['filters']=_[_0xc7d6('0x4a')](_0x1f9092[_0xc7d6('0x47')],_0x1f9092[_0xc7d6('0x48')]);_0x26ab65['attributes']=_[_0xc7d6('0x4a')](_0x1f9092[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x3971e3[_0xc7d6('0x48')]['fields']));_0x26ab65[_0xc7d6('0x4c')]=_0x26ab65[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x26ab65[_0xc7d6('0x4c')]:_0x1f9092[_0xc7d6('0x47')];if(!_0x3971e3['query'][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x26ab65[_0xc7d6('0x32')]=qs['limit'](_0x3971e3['query'][_0xc7d6('0x32')]);_0x26ab65[_0xc7d6('0x30')]=qs['offset'](_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x26ab65['order']=qs[_0xc7d6('0x50')](_0x3971e3['query'][_0xc7d6('0x50')]);_0x26ab65[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x3971e3[_0xc7d6('0x48')],_0x1f9092[_0xc7d6('0x52')]),_0x6835fa);if(_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x54')]){_0x26ab65[_0xc7d6('0x51')]=_[_0xc7d6('0x55')](_0x26ab65[_0xc7d6('0x51')],{'$or':_[_0xc7d6('0x42')](_0x6835fa,function(_0x116576){if(_0x116576[_0xc7d6('0x56')]!==_0xc7d6('0x57')){var _0x5557ee={};_0x5557ee[_0x116576['name']]={'$like':'%'+_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x5557ee;}})});}_0x26ab65=_[_0xc7d6('0x55')]({},_0x26ab65,_0x3971e3[_0xc7d6('0x58')]);var _0x2bf04a={'where':_0x26ab65[_0xc7d6('0x51')]};return db['FaxAccount'][_0xc7d6('0x33')](_0x2bf04a)[_0xc7d6('0x22')](function(_0x343bae){_0x509c18[_0xc7d6('0x33')]=_0x343bae;if(_0x3971e3[_0xc7d6('0x48')][_0xc7d6('0x59')]){_0x26ab65[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0x43')]['findAll'](_0x26ab65);})[_0xc7d6('0x22')](function(_0xaf2cbf){_0x509c18[_0xc7d6('0x5b')]=_0xaf2cbf;return _0x509c18;})['then'](respondWithFilteredResult(_0x4adef7,_0x26ab65))[_0xc7d6('0x2c')](handleError(_0x4adef7,null));};exports[_0xc7d6('0x5c')]=function(_0x25dc39,_0x45ad04){var _0x595055={'raw':![],'where':{'id':_0x25dc39[_0xc7d6('0x5d')]['id']},'include':[{'model':db[_0xc7d6('0x40')],'as':'mandatoryDispositionPause'}]},_0x384517={};_0x384517[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db['FaxAccount'][_0xc7d6('0x44')]);_0x384517[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x25dc39[_0xc7d6('0x48')]);_0x384517[_0xc7d6('0x52')]=_[_0xc7d6('0x4a')](_0x384517[_0xc7d6('0x47')],_0x384517['query']);_0x595055[_0xc7d6('0x4c')]=_['intersection'](_0x384517['model'],qs[_0xc7d6('0x4b')](_0x25dc39['query'][_0xc7d6('0x4b')]));_0x595055[_0xc7d6('0x4c')]=_0x595055[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x595055[_0xc7d6('0x4c')]:_0x384517[_0xc7d6('0x47')];if(_0x25dc39[_0xc7d6('0x48')]['includeAll']){_0x595055[_0xc7d6('0x5a')]=[{'all':!![]}];}_0x595055=_[_0xc7d6('0x55')]({},_0x595055,_0x25dc39[_0xc7d6('0x58')]);return db[_0xc7d6('0x43')][_0xc7d6('0x5e')](_0x595055)[_0xc7d6('0x22')](handleEntityNotFound(_0x45ad04,null))[_0xc7d6('0x22')](respondWithResult(_0x45ad04,null))[_0xc7d6('0x2c')](handleError(_0x45ad04,null));};exports[_0xc7d6('0x5f')]=function(_0x5ef9d2,_0x4de1d0){return db[_0xc7d6('0x43')][_0xc7d6('0x5f')](_0x5ef9d2[_0xc7d6('0x60')],{})[_0xc7d6('0x22')](function(_0x393471){var _0x46fb48=_0x5ef9d2['user'][_0xc7d6('0x39')]({'plain':!![]});if(!_0x46fb48)throw new Error(_0xc7d6('0x61'));if(_0x46fb48[_0xc7d6('0x62')]===_0xc7d6('0x63')){var _0xbe49c=_0x393471[_0xc7d6('0x39')]({'plain':!![]});var _0x174b39=_0xc7d6('0x64');return db[_0xc7d6('0x65')][_0xc7d6('0x5e')]({'where':{'name':_0x174b39,'userProfileId':_0x46fb48[_0xc7d6('0x66')]},'raw':!![]})[_0xc7d6('0x22')](function(_0x210012){if(_0x210012&&_0x210012[_0xc7d6('0x67')]===0x0){return db[_0xc7d6('0x3a')]['create']({'name':_0xbe49c[_0xc7d6('0x3d')],'resourceId':_0xbe49c['id'],'type':_0x210012[_0xc7d6('0x3d')],'sectionId':_0x210012['id']},{})[_0xc7d6('0x22')](function(){return _0x393471;});}else{return _0x393471;}})[_0xc7d6('0x2c')](function(_0xaefd95){logger[_0xc7d6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaefd95);throw _0xaefd95;});}return _0x393471;})[_0xc7d6('0x22')](respondWithResult(_0x4de1d0,0xc9))[_0xc7d6('0x2c')](handleError(_0x4de1d0,null));};exports['update']=function(_0x3dada3,_0x29f2de){if(_0x3dada3[_0xc7d6('0x60')]['id']){delete _0x3dada3[_0xc7d6('0x60')]['id'];}return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x3dada3[_0xc7d6('0x5d')]['id']},'include':[{'model':db[_0xc7d6('0x40')],'as':_0xc7d6('0x41')}]})[_0xc7d6('0x22')](handleEntityNotFound(_0x29f2de,null))[_0xc7d6('0x22')](saveUpdates(_0x3dada3['body'],null))[_0xc7d6('0x22')](respondWithResult(_0x29f2de,null))['catch'](handleError(_0x29f2de,null));};exports['destroy']=function(_0x22fdb6,_0x155cd4){return db[_0xc7d6('0x43')][_0xc7d6('0x5e')]({'where':{'id':_0x22fdb6[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x155cd4,null))[_0xc7d6('0x22')](removeEntity(_0x155cd4,null))[_0xc7d6('0x2c')](handleError(_0x155cd4,null));};exports[_0xc7d6('0x68')]=function(_0x364b26,_0x52996c){return db[_0xc7d6('0x43')][_0xc7d6('0x68')]()[_0xc7d6('0x22')](respondWithResult(_0x52996c,null))[_0xc7d6('0x2c')](handleError(_0x52996c,null));};exports['addDisposition']=function(_0x5cf9f7,_0x590fe7,_0x18f88c){if(_0x5cf9f7[_0xc7d6('0x60')]['id']){delete _0x5cf9f7['body']['id'];}return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x5cf9f7[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x590fe7,null))['then'](function(_0x3868a1){if(_0x3868a1){_0x5cf9f7[_0xc7d6('0x60')]['FaxAccountId']=_0x3868a1['id'];return db[_0xc7d6('0x69')][_0xc7d6('0x5f')](_0x5cf9f7['body']);}})[_0xc7d6('0x22')](respondWithResult(_0x590fe7,null))[_0xc7d6('0x2c')](handleError(_0x590fe7,null));};exports['getDispositions']=function(_0x500161,_0x2b01b1,_0x44df0e){var _0x1e35c5={'raw':![],'where':{}};var _0x5b6aa2={};var _0x49d311={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc7d6('0x6a')]({'where':{'id':_0x500161[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x2b01b1,null))[_0xc7d6('0x22')](function(_0x47ac54){if(_0x47ac54){_0x5b6aa2['model']=_[_0xc7d6('0x49')](db['Disposition'][_0xc7d6('0x44')]);_0x5b6aa2[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x500161[_0xc7d6('0x48')]);_0x5b6aa2[_0xc7d6('0x52')]=_[_0xc7d6('0x4a')](_0x5b6aa2[_0xc7d6('0x47')],_0x5b6aa2[_0xc7d6('0x48')]);_0x1e35c5[_0xc7d6('0x4c')]=_['intersection'](_0x5b6aa2[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x500161[_0xc7d6('0x48')]['fields']));_0x1e35c5['attributes']=_0x1e35c5[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x1e35c5[_0xc7d6('0x4c')]:_0x5b6aa2[_0xc7d6('0x47')];if(!_0x500161['query'][_0xc7d6('0x4e')]('nolimit')){_0x1e35c5[_0xc7d6('0x32')]=qs[_0xc7d6('0x32')](_0x500161['query']['limit']);_0x1e35c5['offset']=qs[_0xc7d6('0x30')](_0x500161[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x1e35c5['order']=qs[_0xc7d6('0x50')](_0x500161[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x1e35c5[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x500161['query'],_0x5b6aa2['filters']));_0x1e35c5['where'][_0xc7d6('0x6b')]=_0x47ac54['id'];if(_0x500161['query'][_0xc7d6('0x54')]){_0x1e35c5['where']=_['merge'](_0x1e35c5[_0xc7d6('0x51')],{'$or':_['map'](_0x1e35c5['attributes'],function(_0x4eb5d7){var _0x56bd9b={};_0x56bd9b[_0x4eb5d7]={'$like':'%'+_0x500161[_0xc7d6('0x48')]['filter']+'%'};return _0x56bd9b;})});}_0x1e35c5=_['merge']({},_0x1e35c5,_0x500161['options']);return db[_0xc7d6('0x69')][_0xc7d6('0x33')]({'where':_0x1e35c5['where']})[_0xc7d6('0x22')](function(_0x3b79a2){_0x49d311['count']=_0x3b79a2;if(_0x500161[_0xc7d6('0x48')][_0xc7d6('0x59')]){_0x1e35c5[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0x69')][_0xc7d6('0x6c')](_0x1e35c5);})[_0xc7d6('0x22')](function(_0x5eeaa8){_0x49d311[_0xc7d6('0x5b')]=_0x5eeaa8;return _0x49d311;});}})['then'](respondWithFilteredResult(_0x2b01b1,_0x1e35c5))['catch'](handleError(_0x2b01b1,null));};exports[_0xc7d6('0x6d')]=function(_0xac69c5,_0x4b57bc,_0x2daa29){return db[_0xc7d6('0x43')][_0xc7d6('0x5e')]({'where':{'id':_0xac69c5[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x4b57bc,null))[_0xc7d6('0x22')](function(_0x3bb255){if(_0x3bb255){return _0x3bb255[_0xc7d6('0x6d')](_0xac69c5[_0xc7d6('0x48')][_0xc7d6('0x6e')]);}})[_0xc7d6('0x22')](respondWithStatusCode(_0x4b57bc,null))[_0xc7d6('0x2c')](handleError(_0x4b57bc,null));};exports[_0xc7d6('0x6f')]=function(_0x27ff90,_0x148e55,_0x4a1ce2){if(_0x27ff90[_0xc7d6('0x60')]['id']){delete _0x27ff90['body']['id'];}return db[_0xc7d6('0x43')][_0xc7d6('0x5e')]({'where':{'id':_0x27ff90[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x148e55,null))[_0xc7d6('0x22')](function(_0x170e86){if(_0x170e86){_0x27ff90[_0xc7d6('0x60')][_0xc7d6('0x6b')]=_0x170e86['id'];return db[_0xc7d6('0x70')][_0xc7d6('0x5f')](_0x27ff90[_0xc7d6('0x60')]);}})[_0xc7d6('0x22')](respondWithResult(_0x148e55,null))[_0xc7d6('0x2c')](handleError(_0x148e55,null));};exports[_0xc7d6('0x71')]=function(_0x32a922,_0x33bc53,_0x18d761){var _0x4b4423={'raw':![],'where':{}};var _0xfb479c={};var _0x536a9b={'count':0x0,'rows':[]};return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x32a922[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x33bc53,null))[_0xc7d6('0x22')](function(_0x39c9df){if(_0x39c9df){_0xfb479c[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db[_0xc7d6('0x70')][_0xc7d6('0x44')]);_0xfb479c['query']=_[_0xc7d6('0x49')](_0x32a922[_0xc7d6('0x48')]);_0xfb479c['filters']=_[_0xc7d6('0x4a')](_0xfb479c[_0xc7d6('0x47')],_0xfb479c[_0xc7d6('0x48')]);_0x4b4423[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0xfb479c[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x32a922['query'][_0xc7d6('0x4b')]));_0x4b4423[_0xc7d6('0x4c')]=_0x4b4423[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x4b4423[_0xc7d6('0x4c')]:_0xfb479c[_0xc7d6('0x47')];if(!_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x4b4423[_0xc7d6('0x32')]=qs['limit'](_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x4b4423[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x4b4423[_0xc7d6('0x72')]=qs[_0xc7d6('0x50')](_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x4b4423['where']=qs['filters'](_['pick'](_0x32a922[_0xc7d6('0x48')],_0xfb479c[_0xc7d6('0x52')]));_0x4b4423[_0xc7d6('0x51')][_0xc7d6('0x6b')]=_0x39c9df['id'];if(_0x32a922[_0xc7d6('0x48')]['filter']){_0x4b4423[_0xc7d6('0x51')]=_[_0xc7d6('0x55')](_0x4b4423[_0xc7d6('0x51')],{'$or':_[_0xc7d6('0x42')](_0x4b4423[_0xc7d6('0x4c')],function(_0x4af637){var _0x9df0ea={};_0x9df0ea[_0x4af637]={'$like':'%'+_0x32a922[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x9df0ea;})});}_0x4b4423=_[_0xc7d6('0x55')]({},_0x4b4423,_0x32a922[_0xc7d6('0x58')]);return db[_0xc7d6('0x70')][_0xc7d6('0x33')]({'where':_0x4b4423[_0xc7d6('0x51')]})[_0xc7d6('0x22')](function(_0x2b08b9){_0x536a9b[_0xc7d6('0x33')]=_0x2b08b9;if(_0x32a922['query'][_0xc7d6('0x59')]){_0x4b4423[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0x70')][_0xc7d6('0x6c')](_0x4b4423);})[_0xc7d6('0x22')](function(_0x16f497){_0x536a9b[_0xc7d6('0x5b')]=_0x16f497;return _0x536a9b;});}})[_0xc7d6('0x22')](respondWithFilteredResult(_0x33bc53,_0x4b4423))['catch'](handleError(_0x33bc53,null));};exports['removeAnswers']=function(_0xfc0b8e,_0x5edc2f,_0xa5bb0e){return db['FaxAccount'][_0xc7d6('0x5e')]({'where':{'id':_0xfc0b8e[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5edc2f,null))['then'](function(_0x35fd22){if(_0x35fd22){return _0x35fd22['removeAnswers'](_0xfc0b8e['query']['ids']);}})[_0xc7d6('0x22')](respondWithStatusCode(_0x5edc2f,null))[_0xc7d6('0x2c')](handleError(_0x5edc2f,null));};exports[_0xc7d6('0x73')]=function(_0x4f3c4a,_0x2582e9,_0x38e26a){return db['FaxInteraction'][_0xc7d6('0x5e')]({'where':{'id':_0x4f3c4a[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x2582e9,null))[_0xc7d6('0x22')](function(_0x40eedd){if(_0x40eedd){return _0x40eedd[_0xc7d6('0x73')](_0x4f3c4a[_0xc7d6('0x60')][_0xc7d6('0x6e')],_['omit'](_0x4f3c4a[_0xc7d6('0x60')],['ids','id'])||{});}})[_0xc7d6('0x22')](respondWithResult(_0x2582e9,null))[_0xc7d6('0x2c')](handleError(_0x2582e9,null));};exports['getInteractions']=function(_0x47944a,_0x25e3ac,_0x42fd32){var _0x54531a={'raw':![],'where':{}};var _0x588882={};var _0x3fa0c6={'count':0x0,'rows':[]};return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x47944a[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0x25e3ac,null))[_0xc7d6('0x22')](function(_0x10d3f8){if(_0x10d3f8){_0x588882['model']=_['keys'](db[_0xc7d6('0x74')][_0xc7d6('0x44')]);_0x588882[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x47944a[_0xc7d6('0x48')]);_0x588882['filters']=_['intersection'](_0x588882[_0xc7d6('0x47')],_0x588882[_0xc7d6('0x48')]);_0x54531a[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0x588882[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x4b')]));_0x54531a[_0xc7d6('0x4c')]=_0x54531a[_0xc7d6('0x4c')]['length']?_0x54531a[_0xc7d6('0x4c')]:_0x588882[_0xc7d6('0x47')];if(!_0x47944a['query'][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x54531a[_0xc7d6('0x32')]=qs['limit'](_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x54531a[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x54531a[_0xc7d6('0x72')]=qs[_0xc7d6('0x50')](_0x47944a[_0xc7d6('0x48')]['sort']);_0x54531a[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x47944a[_0xc7d6('0x48')],_0x588882[_0xc7d6('0x52')]));_0x54531a[_0xc7d6('0x51')][_0xc7d6('0x6b')]=_0x10d3f8['id'];if(_0x47944a['query'][_0xc7d6('0x54')]){_0x54531a['where']=_[_0xc7d6('0x55')](_0x54531a[_0xc7d6('0x51')],{'$or':_['map'](_0x54531a[_0xc7d6('0x4c')],function(_0x5c2779){var _0xd5ff2b={};_0xd5ff2b[_0x5c2779]={'$like':'%'+_0x47944a['query']['filter']+'%'};return _0xd5ff2b;})});}_0x54531a=_[_0xc7d6('0x55')]({},_0x54531a,_0x47944a['options']);return db[_0xc7d6('0x74')][_0xc7d6('0x33')]({'where':_0x54531a['where']})['then'](function(_0x1ef911){_0x3fa0c6[_0xc7d6('0x33')]=_0x1ef911;if(_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x59')]){_0x54531a['include']=[{'model':db[_0xc7d6('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xc7d6('0x76'),'attributes':[_0xc7d6('0x3d'),_0xc7d6('0x77'),_0xc7d6('0x78')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xc7d6('0x79')],'where':_0x47944a['query'][_0xc7d6('0x7a')]?{'id':_0x47944a[_0xc7d6('0x48')][_0xc7d6('0x7a')]}:undefined,'required':_0x47944a['query']['tag']?!![]:![]}];}return db[_0xc7d6('0x74')]['findAll'](_0x54531a);})[_0xc7d6('0x22')](function(_0x3d76c9){_0x3fa0c6[_0xc7d6('0x5b')]=_0x3d76c9;return _0x3fa0c6;});}})['then'](respondWithFilteredResult(_0x25e3ac,_0x54531a))[_0xc7d6('0x2c')](handleError(_0x25e3ac,null));};exports[_0xc7d6('0x7b')]=function(_0x5d8c1f,_0x19b4d6){var _0x38eaf6=_0x5d8c1f['params']['id'];var _0x292ca1=_0x5d8c1f['body'];var _0x5d4337=0xc8;var _0x26ea59=null;return db['sequelize'][_0xc7d6('0x7c')]({'isolationLevel':db[_0xc7d6('0x7d')][_0xc7d6('0x7e')][_0xc7d6('0x7f')]['READ_COMMITTED']},function(_0x1a4d73){return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x38eaf6},'transaction':_0x1a4d73})['then'](function(_0x244e3d){if(_0x244e3d){return db['FaxApplication'][_0xc7d6('0x38')]({'where':{'FaxAccountId':_0x38eaf6},'transaction':_0x1a4d73})[_0xc7d6('0x22')](function(){var _0x8b998d=_[_0xc7d6('0x42')](_0x292ca1,function(_0xa63180){_0xa63180['FaxAccountId']=_0x38eaf6;return _0xa63180;});return db['FaxApplication'][_0xc7d6('0x80')](_0x8b998d,{'transaction':_0x1a4d73});});}else{_0x5d4337=0x194;_0x26ea59=[];}});})[_0xc7d6('0x22')](function(){if(_0x5d4337!==0x194){return db[_0xc7d6('0x81')][_0xc7d6('0x82')]({'where':{'FaxAccountId':_0x38eaf6},'order':_0xc7d6('0x83')})['then'](function(_0x42106c){_0x26ea59=_0x42106c;});}})[_0xc7d6('0x2c')](function(_0x819e88){_0x5d4337=0x1f4;logger['error'](_0x819e88[_0xc7d6('0x3c')]);if(_0x819e88['name']){delete _0x819e88[_0xc7d6('0x3d')];}_0x26ea59=_0x819e88;})[_0xc7d6('0x84')](function(){if(_0x26ea59===null){_0x19b4d6[_0xc7d6('0x2d')](_0x5d4337);}else{if(_0x5d4337===0x1f4){_0x19b4d6[_0xc7d6('0x3b')](_0x5d4337)[_0xc7d6('0x3e')](_0x26ea59);}else{_0x19b4d6[_0xc7d6('0x3b')](_0x5d4337)[_0xc7d6('0x2f')](_0x26ea59);}}});};exports[_0xc7d6('0x85')]=function(_0xc90819,_0x478881,_0x1c0c94){var _0x5910a5={};var _0x5e4670={};var _0x58624c;var _0x8b7dc0;return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0xc90819['params']['id']}})['then'](handleEntityNotFound(_0x478881,null))['then'](function(_0x44da58){if(_0x44da58){_0x58624c=_0x44da58;_0x5e4670[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db[_0xc7d6('0x81')]['rawAttributes']);_0x5e4670['query']=_['keys'](_0xc90819['query']);_0x5e4670['filters']=_[_0xc7d6('0x4a')](_0x5e4670['model'],_0x5e4670[_0xc7d6('0x48')]);_0x5910a5[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0x5e4670[_0xc7d6('0x47')],qs['fields'](_0xc90819[_0xc7d6('0x48')]['fields']));_0x5910a5[_0xc7d6('0x4c')]=_0x5910a5[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x5910a5['attributes']:_0x5e4670['model'];_0x5910a5['order']=qs[_0xc7d6('0x50')](_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x5910a5['where']=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0xc90819[_0xc7d6('0x48')],_0x5e4670[_0xc7d6('0x52')]));if(_0xc90819['query']['filter']){_0x5910a5['where']=_[_0xc7d6('0x55')](_0x5910a5['where'],{'$or':_['map'](_0x5910a5[_0xc7d6('0x4c')],function(_0x1a47bd){var _0x154653={};_0x154653[_0x1a47bd]={'$like':'%'+_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x154653;})});}_0x5910a5=_[_0xc7d6('0x55')]({},_0x5910a5,_0xc90819[_0xc7d6('0x58')]);return _0x58624c[_0xc7d6('0x85')](_0x5910a5);}})[_0xc7d6('0x22')](function(_0x47a829){if(_0x47a829){_0x8b7dc0=_0x47a829[_0xc7d6('0x4d')];if(!_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x5910a5[_0xc7d6('0x32')]=qs[_0xc7d6('0x32')](_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x5910a5[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0xc90819[_0xc7d6('0x48')][_0xc7d6('0x30')]);}return _0x58624c[_0xc7d6('0x85')](_0x5910a5);}})['then'](function(_0x386313){if(_0x386313){return _0x386313?{'count':_0x8b7dc0,'rows':_0x386313}:null;}})[_0xc7d6('0x22')](respondWithResult(_0x478881,null))['catch'](handleError(_0x478881,null));};function Extension(_0x1fc22f,_0x1cb01b,_0x27b423,_0x4ff7bc){this['context']=_0xc7d6('0x86');this['exten']=_0x1fc22f[_0xc7d6('0x87')];this[_0xc7d6('0x88')]=_0x4ff7bc;this['type']=_0xc7d6('0x89');this[_0xc7d6('0x8a')]='Fax\x20Extension';this[_0xc7d6('0x6b')]=_0x1fc22f['id'];this[_0xc7d6('0x83')]=_0x1cb01b;this['appdata']=_0x27b423;}function createExtensionsReciveFax(_0xd4b212){var _0xbce6de=0x1;var _0x4b5675=[];_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'',_0xc7d6('0x8c')));_0xbce6de+=0x1;_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'CDR(type)=inbound-fax','Set'));_0xbce6de+=0x1;for(var _0x60f44f in _0xd4b212){if(_0xd4b212[_0xc7d6('0x4e')](_0x60f44f)&&(_0x60f44f===_0xc7d6('0x8d')||_0x60f44f===_0xc7d6('0x87')||_0x60f44f===_0xc7d6('0x8e')||_0x60f44f===_0xc7d6('0x8f')||_0x60f44f===_0xc7d6('0x90')||_0x60f44f===_0xc7d6('0x91')||_0x60f44f===_0xc7d6('0x92')||_0x60f44f===_0xc7d6('0x93')||_0x60f44f===_0xc7d6('0x94'))){_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,_0xc7d6('0x95')+_0x60f44f+')='+_0xd4b212[_0x60f44f],'Set'));_0xbce6de+=0x1;}}_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'6',_0xc7d6('0x96')));_0xbce6de+=0x1;_0x4b5675[_0xc7d6('0x8b')](new Extension(_0xd4b212,_0xbce6de,'/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',_0xc7d6('0x97')));_0xbce6de=0x0;return _0x4b5675;}exports[_0xc7d6('0x98')]=function(_0xbcc966,_0x1c36e5,_0x4e5762){var _0x20cc9f;return db['sequelize'][_0xc7d6('0x7c')](function(_0x1cc8b0){return db[_0xc7d6('0x43')]['create'](_0xbcc966['body'],{'transaction':_0x1cc8b0})['then'](function(_0x3db237){_0x20cc9f=_0x3db237[_0xc7d6('0x39')]({'plain':!![]});return db['VoiceExtension'][_0xc7d6('0x80')](createExtensionsReciveFax(_0x20cc9f),{'transaction':_0x1cc8b0});});})[_0xc7d6('0x22')](function(){return _0x20cc9f;})[_0xc7d6('0x22')](respondWithResult(_0x1c36e5,null))['catch'](handleError(_0x1c36e5,null));};exports[_0xc7d6('0x99')]=function(_0x46e9ba,_0x12f9e2,_0x42497d){var _0x5097f4;return db['sequelize'][_0xc7d6('0x7c')](function(_0x28ee3f){return db[_0xc7d6('0x43')]['update'](_0x46e9ba[_0xc7d6('0x60')],{'where':{'id':_0x46e9ba[_0xc7d6('0x60')]['id']},'transaction':_0x28ee3f})[_0xc7d6('0x22')](function(_0x325bac){return db[_0xc7d6('0x9a')][_0xc7d6('0x38')]({'where':{'FaxAccountId':_0x46e9ba['body']['id']},'transaction':_0x28ee3f})[_0xc7d6('0x22')](function(_0x76d31){return db[_0xc7d6('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0xc7d6('0x9b')](_0x46e9ba[_0xc7d6('0x60')],[_0xc7d6('0x9c'),_0xc7d6('0x46'),'createdAt',_0xc7d6('0x9d'),'TrunkId',_0xc7d6('0x9e')])),{'transaction':_0x28ee3f});});});})[_0xc7d6('0x22')](function(){return db[_0xc7d6('0x43')][_0xc7d6('0x9f')](_0x46e9ba[_0xc7d6('0x60')]['id']);})[_0xc7d6('0x22')](respondWithResult(_0x12f9e2,null))[_0xc7d6('0x2c')](handleError(_0x12f9e2,null));};exports[_0xc7d6('0xa0')]=function(_0xac9e1e,_0x12766f,_0xf0858d){var _0x5658ca={'raw':!![],'where':{}};var _0x5864a9={};var _0x120458={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc7d6('0x6a')]({'where':{'id':_0xac9e1e['params']['id']}})['then'](handleEntityNotFound(_0x12766f,null))['then'](function(_0x326f2a){if(_0x326f2a){_0x5864a9[_0xc7d6('0x47')]=_['keys'](db[_0xc7d6('0xa1')][_0xc7d6('0x44')]);_0x5864a9['query']=_[_0xc7d6('0x49')](_0xac9e1e[_0xc7d6('0x48')]);_0x5864a9['filters']=_['intersection'](_0x5864a9['model'],_0x5864a9[_0xc7d6('0x48')]);_0x5658ca[_0xc7d6('0x4c')]=_['intersection'](_0x5864a9[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0xac9e1e[_0xc7d6('0x48')]['fields']));_0x5658ca[_0xc7d6('0x4c')]=_0x5658ca[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x5658ca[_0xc7d6('0x4c')]:_0x5864a9[_0xc7d6('0x47')];if(!_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0x4e')](_0xc7d6('0x4f'))){_0x5658ca[_0xc7d6('0x32')]=qs['limit'](_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0x32')]);_0x5658ca[_0xc7d6('0x30')]=qs[_0xc7d6('0x30')](_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0x30')]);}_0x5658ca[_0xc7d6('0x72')]=qs['sort'](_0xac9e1e[_0xc7d6('0x48')]['sort']);_0x5658ca[_0xc7d6('0x51')]=qs['filters'](_[_0xc7d6('0x53')](_0xac9e1e[_0xc7d6('0x48')],_0x5864a9[_0xc7d6('0x52')]));_0x5658ca[_0xc7d6('0x51')][_0xc7d6('0x6b')]=_0x326f2a['id'];if(_0xac9e1e['query'][_0xc7d6('0x54')]){_0x5658ca[_0xc7d6('0x51')]=_['merge'](_0x5658ca[_0xc7d6('0x51')],{'$or':_['map'](_0x5658ca[_0xc7d6('0x4c')],function(_0x2ad8df){var _0x38f08e={};_0x38f08e[_0x2ad8df]={'$like':'%'+_0xac9e1e['query'][_0xc7d6('0x54')]+'%'};return _0x38f08e;})});}if(_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0xa2')]){var _0xffc116=_0xac9e1e[_0xc7d6('0x48')][_0xc7d6('0xa2')][_0xc7d6('0xa3')](',');var _0xf18fc4={};_0xf18fc4[_0xffc116[0x0]]={'$gte':moment(_0xffc116[0x1])[_0xc7d6('0xa4')](_0xc7d6('0xa5'))};_0x5658ca['where']=_[_0xc7d6('0x55')](_0x5658ca[_0xc7d6('0x51')],_0xf18fc4);}_0x5658ca=_[_0xc7d6('0x55')]({},_0x5658ca,_0xac9e1e[_0xc7d6('0x58')]);return db[_0xc7d6('0xa1')][_0xc7d6('0x33')]({'where':_0x5658ca[_0xc7d6('0x51')]})[_0xc7d6('0x22')](function(_0x35219b){_0x120458[_0xc7d6('0x33')]=_0x35219b;if(_0xac9e1e[_0xc7d6('0x48')]['includeAll']){_0x5658ca[_0xc7d6('0x5a')]=[{'all':!![]}];}return db[_0xc7d6('0xa1')]['findAll'](_0x5658ca);})['then'](function(_0x63576a){_0x120458[_0xc7d6('0x5b')]=_0x63576a;return _0x120458;});}})[_0xc7d6('0x22')](respondWithFilteredResult(_0x12766f,_0x5658ca))[_0xc7d6('0x2c')](handleError(_0x12766f,null));};exports[_0xc7d6('0x3e')]=function(_0x373fa9,_0x1314ab,_0x42d3e9){var _0x546fbc,_0x1663b4={},_0x924c97;if(_0x373fa9[_0xc7d6('0x60')]['to']){_0x924c97=_0x373fa9[_0xc7d6('0x60')]['to'][0x0];}return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x373fa9[_0xc7d6('0x5d')]['id']},'include':[{'model':db[_0xc7d6('0xa6')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc7d6('0xa7'),'where':{'fax':_0x924c97},'limit':0x1,'order':[['updatedAt',_0xc7d6('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x1314ab,null))[_0xc7d6('0x22')](function(_0x4aa1e1){_0x546fbc=_0x4aa1e1;if(_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')]&&_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0xc7d6('0x4d')]){for(var _0x3996ae=0x0;_0x3996ae<_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0xc7d6('0x4d')];_0x3996ae+=0x1){_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0x3996ae]={'filename':_0x373fa9[_0xc7d6('0x60')]['attachments'][_0x3996ae]['name'],'id':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0x3996ae]['id'],'path':path[_0xc7d6('0xaa')](config['root'],_0xc7d6('0xab'),_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][_0x3996ae][_0xc7d6('0xac')])};}}return respondWithRpcPromise(_0xc7d6('0xad'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x373fa9['params']['id'])?undefined:_0x373fa9[_0xc7d6('0x5d')]['id'],'path':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0][_0xc7d6('0x8')])?undefined:_0x373fa9['body']['attachments'][0x0][_0xc7d6('0x8')],'fax':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')]['to'][0x0])?undefined:_0x373fa9[_0xc7d6('0x60')]['to'][0x0]},client9002);})[_0xc7d6('0x22')](function(){if(_0x546fbc){if(_[_0xc7d6('0xae')](_0x373fa9['body'][_0xc7d6('0xaf')])){_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xaf')]=util[_0xc7d6('0xa4')](_0xc7d6('0xb0'),_0x546fbc[_0xc7d6('0x3d')],_0x546fbc[_0xc7d6('0xb1')]);}if(_0x546fbc[_0xc7d6('0xb2')]){if(_0x546fbc[_0xc7d6('0xb2')][_0xc7d6('0xa7')]['length']){return _0x546fbc[_0xc7d6('0xb2')][_0xc7d6('0xa7')][0x0];}else{return db[_0xc7d6('0x75')][_0xc7d6('0x5f')](_[_0xc7d6('0x1c')](_0x373fa9[_0xc7d6('0x60')],{'firstName':_0x373fa9[_0xc7d6('0x60')]['to'][0x0],'phone':_0x373fa9[_0xc7d6('0x60')]['to'][0x0],'fax':_0x373fa9[_0xc7d6('0x60')]['to'][0x0],'ListId':_0x546fbc['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xc7d6('0x22')](function(_0x1ef8f1){if(_0x1ef8f1){return db['FaxInteraction'][_0xc7d6('0x5e')]({'where':{'ContactId':_0x1ef8f1['id'],'closed':![],'FaxAccountId':_0x546fbc['id']}})[_0xc7d6('0x22')](function(_0x33046a){if(_0x33046a){return[_0x33046a,![]];}return db[_0xc7d6('0x74')][_0xc7d6('0x5f')]({'UserId':_0x373fa9[_0xc7d6('0x63')]['id'],'ContactId':_0x1ef8f1['id'],'FaxAccountId':_0x546fbc['id'],'fax':_0x373fa9['body']['to'][0x0],'firstMsgDirection':_0xc7d6('0xb3'),'Messages':[_['merge'](_0x373fa9['body'],{'read':![],'body':_0x373fa9['body']['attachments'][0x0][_0xc7d6('0xb4')],'FaxAccountId':_0x546fbc['id'],'UserId':_0x373fa9[_0xc7d6('0x63')]['id'],'ContactId':_0x1ef8f1['id'],'AttachmentId':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xc7d6('0xa1')],'as':_0xc7d6('0xb5')}]})['then'](function(_0x5a6513){return[_0x5a6513,!![]];});});}else{throw new Error(_0xc7d6('0xb6'));}})['spread'](function(_0x55102b,_0x2754f0){if(_0x2754f0){return _0x55102b;}return db['FaxMessage'][_0xc7d6('0x5f')]({'direction':_0xc7d6('0xb3'),'read':![],'body':_0x373fa9[_0xc7d6('0x60')]['attachments'][0x0][_0xc7d6('0xb4')],'FaxAccountId':_0x546fbc['id'],'FaxInteractionId':_0x55102b['id'],'UserId':_0x373fa9['user']['id'],'ContactId':_0x55102b[_0xc7d6('0xb7')],'AttachmentId':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0]['id']})[_0xc7d6('0x22')](function(_0x549e54){_0x55102b[_0xc7d6('0xb8')]['Messages']=[];_0x55102b[_0xc7d6('0xb8')][_0xc7d6('0xb5')][_0xc7d6('0x8b')](_0x549e54['dataValues']);return _0x55102b;});})[_0xc7d6('0x22')](function(_0x33d085){respondWithRpcPromise('SendFax',_0xc7d6('0xb9'),{'FaxAccountId':_['isNil'](_0x373fa9[_0xc7d6('0x5d')]['id'])?undefined:_0x373fa9[_0xc7d6('0x5d')]['id'],'path':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')]['attachments'][0x0]['path'])?undefined:_0x373fa9['body'][_0xc7d6('0xa9')][0x0]['path'],'fax':_[_0xc7d6('0xae')](_0x373fa9[_0xc7d6('0x60')]['to'][0x0])?undefined:_0x373fa9['body']['to'][0x0],'AttachmentId':_0x373fa9[_0xc7d6('0x60')][_0xc7d6('0xa9')][0x0]['id']},client9002)[_0xc7d6('0x22')](function(_0x53d930){logger[_0xc7d6('0xba')]('SendFaxRpc,\x20%s',_0x53d930);})[_0xc7d6('0x2c')](function(_0x16d0fd){logger[_0xc7d6('0xba')]('SendFaxRpc,\x20%s',_0x16d0fd);});return _0x33d085;})[_0xc7d6('0x22')](respondWithResult(_0x1314ab,null))[_0xc7d6('0x2c')](handleError(_0x1314ab,null));};exports[_0xc7d6('0xbb')]=function(_0x509167,_0xa1796c,_0xe2fb39){return db[_0xc7d6('0x43')]['find']({'where':{'id':_0x509167['params']['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0xa1796c,null))['then'](function(_0x25227f){if(_0x25227f){return _0x25227f['addAgents'](_0x509167['body']['ids'],_[_0xc7d6('0x9b')](_0x509167['body'],[_0xc7d6('0x6e'),'id'])||{})[_0xc7d6('0xbc')](function(_0x3cefb3){for(var _0x250b0e=0x0;_0x250b0e<_0x509167[_0xc7d6('0x60')][_0xc7d6('0x6e')][_0xc7d6('0x4d')];_0x250b0e+=0x1){socket[_0xc7d6('0xbd')](_0xc7d6('0xbe'),{'UserId':Number(_0x509167[_0xc7d6('0x60')]['ids'][_0x250b0e]),'FaxAccountId':Number(_0x509167[_0xc7d6('0x5d')]['id'])});}return _0x3cefb3;});}})['then'](respondWithResult(_0xa1796c,null))[_0xc7d6('0x2c')](handleError(_0xa1796c,null));};exports[_0xc7d6('0xbf')]=function(_0x32631e,_0xda48ae,_0x128eb9){return db['FaxAccount'][_0xc7d6('0x5e')]({'where':{'id':_0x32631e[_0xc7d6('0x5d')]['id']}})['then'](handleEntityNotFound(_0xda48ae,null))['then'](function(_0x328c33){if(_0x328c33){return _0x328c33[_0xc7d6('0xbf')](_0x32631e[_0xc7d6('0x48')]['ids'])['then'](function(){if(_[_0xc7d6('0xc0')](_0x32631e['query'][_0xc7d6('0x6e')])){for(var _0x41ebef=0x0;_0x41ebef<_0x32631e[_0xc7d6('0x48')][_0xc7d6('0x6e')][_0xc7d6('0x4d')];_0x41ebef+=0x1){socket[_0xc7d6('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x32631e[_0xc7d6('0x48')]['ids'][_0x41ebef]),'FaxAccountId':Number(_0x32631e[_0xc7d6('0x5d')]['id'])});}}else{socket[_0xc7d6('0xbd')](_0xc7d6('0xc1'),{'UserId':Number(_0x32631e[_0xc7d6('0x48')][_0xc7d6('0x6e')]),'FaxAccountId':Number(_0x32631e[_0xc7d6('0x5d')]['id'])});}});}})[_0xc7d6('0x22')](respondWithStatusCode(_0xda48ae,null))[_0xc7d6('0x2c')](handleError(_0xda48ae,null));};exports[_0xc7d6('0xc2')]=function(_0x5ec646,_0x366c0b,_0x19b824){var _0x448fc3={};var _0xcce900={};var _0x53d1c5;var _0x25edb7;return db[_0xc7d6('0x43')][_0xc7d6('0x6a')]({'where':{'id':_0x5ec646[_0xc7d6('0x5d')]['id']}})[_0xc7d6('0x22')](handleEntityNotFound(_0x366c0b,null))[_0xc7d6('0x22')](function(_0x429dc7){if(_0x429dc7){_0x53d1c5=_0x429dc7;_0xcce900[_0xc7d6('0x47')]=_[_0xc7d6('0x49')](db[_0xc7d6('0xc3')][_0xc7d6('0x44')]);_0xcce900[_0xc7d6('0x48')]=_[_0xc7d6('0x49')](_0x5ec646[_0xc7d6('0x48')]);_0xcce900['filters']=_[_0xc7d6('0x4a')](_0xcce900[_0xc7d6('0x47')],_0xcce900[_0xc7d6('0x48')]);_0x448fc3[_0xc7d6('0x4c')]=_[_0xc7d6('0x4a')](_0xcce900[_0xc7d6('0x47')],qs[_0xc7d6('0x4b')](_0x5ec646[_0xc7d6('0x48')]['fields']));_0x448fc3[_0xc7d6('0x4c')]=_0x448fc3[_0xc7d6('0x4c')][_0xc7d6('0x4d')]?_0x448fc3[_0xc7d6('0x4c')]:_0xcce900['model'];_0x448fc3['order']=qs['sort'](_0x5ec646[_0xc7d6('0x48')][_0xc7d6('0x50')]);_0x448fc3[_0xc7d6('0x51')]=qs[_0xc7d6('0x52')](_[_0xc7d6('0x53')](_0x5ec646[_0xc7d6('0x48')],_0xcce900['filters']));if(_0x5ec646[_0xc7d6('0x48')][_0xc7d6('0x54')]){_0x448fc3[_0xc7d6('0x51')]=_[_0xc7d6('0x55')](_0x448fc3[_0xc7d6('0x51')],{'$or':_[_0xc7d6('0x42')](_0x448fc3[_0xc7d6('0x4c')],function(_0x40c7e6){var _0x1cfc2f={};_0x1cfc2f[_0x40c7e6]={'$like':'%'+_0x5ec646[_0xc7d6('0x48')][_0xc7d6('0x54')]+'%'};return _0x1cfc2f;})});}_0x448fc3=_['merge']({},_0x448fc3,_0x5ec646[_0xc7d6('0x58')]);return _0x53d1c5[_0xc7d6('0xc2')](_0x448fc3);}})[_0xc7d6('0x22')](function(_0xaffd70){if(_0xaffd70){_0x25edb7=_0xaffd70['length'];if(!_0x5ec646[_0xc7d6('0x48')]['hasOwnProperty'](_0xc7d6('0x4f'))){_0x448fc3[_0xc7d6('0x32')]=qs[_0xc7d6('0x32')](_0x5ec646[_0xc7d6('0x48')]['limit']);_0x448fc3['offset']=qs['offset'](_0x5ec646['query'][_0xc7d6('0x30')]);}return _0x53d1c5[_0xc7d6('0xc2')](_0x448fc3);}})[_0xc7d6('0x22')](function(_0x49930d){if(_0x49930d){return _0x49930d?{'count':_0x25edb7,'rows':_0x49930d}:null;}})['then'](respondWithResult(_0x366c0b,null))['catch'](handleError(_0x366c0b,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4267d1b..1504ec6 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 _0xa8d9=['hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa8d9,0x1f1));var _0x9a8d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa8d9[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x9a8d('0x0'));var FaxAccount=require(_0x9a8d('0x1'))['db'][_0x9a8d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9a8d('0x3')](0x0);var events={'afterCreate':_0x9a8d('0x4'),'afterUpdate':'update','afterDestroy':_0x9a8d('0x5')};function emitEvent(_0x12ee17){return function(_0x5b04d4,_0x258b3a,_0x396732){FaxAccountEvents[_0x9a8d('0x6')](_0x12ee17+':'+_0x5b04d4['id'],_0x5b04d4);FaxAccountEvents[_0x9a8d('0x6')](_0x12ee17,_0x5b04d4);_0x396732(null);};}for(var e in events){if(events[_0x9a8d('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x9a8d('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xdc7e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x10d0bc,_0xa3106b){var _0x632b6e=function(_0x399d1b){while(--_0x399d1b){_0x10d0bc['push'](_0x10d0bc['shift']());}};_0x632b6e(++_0xa3106b);}(_0xdc7e,0x1e9));var _0xedc7=function(_0x5a4243,_0x1a97be){_0x5a4243=_0x5a4243-0x0;var _0x1d6389=_0xdc7e[_0x5a4243];return _0x1d6389;};'use strict';var EventEmitter=require(_0xedc7('0x0'));var FaxAccount=require(_0xedc7('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xedc7('0x2')](0x0);var events={'afterCreate':_0xedc7('0x3'),'afterUpdate':_0xedc7('0x4'),'afterDestroy':_0xedc7('0x5')};function emitEvent(_0x949840){return function(_0x5571b7,_0x2a59a2,_0x5766cc){FaxAccountEvents[_0xedc7('0x6')](_0x949840+':'+_0x5571b7['id'],_0x5571b7);FaxAccountEvents['emit'](_0x949840,_0x5571b7);_0x5766cc(null);};}for(var e in events){if(events[_0xedc7('0x7')](e)){var event=events[e];FaxAccount[_0xedc7('0x8')](e,emitEvent(event));}}module[_0xedc7('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 2543b3b..29c6b9d 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 _0x8789=['../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x1ec4e4,_0x858820){var _0x3cd7d5=function(_0x4c6e3f){while(--_0x4c6e3f){_0x1ec4e4['push'](_0x1ec4e4['shift']());}};_0x3cd7d5(++_0x858820);}(_0x8789,0xdd));var _0x9878=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8789[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x9878('0x0'));var util=require(_0x9878('0x1'));var logger=require('../../config/logger')(_0x9878('0x2'));var moment=require(_0x9878('0x3'));var BPromise=require(_0x9878('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9878('0x5'));var rimraf=require(_0x9878('0x6'));var config=require(_0x9878('0x7'));var attributes=require(_0x9878('0x8'));module[_0x9878('0x9')]=function(_0x2f5258,_0x1f1faa){return _0x2f5258[_0x9878('0xa')]('FaxAccount',attributes,{'tableName':_0x9878('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0992=['fax_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x190b95,_0xfbfcc9){var _0x4d5c92=function(_0x3a00ea){while(--_0x3a00ea){_0x190b95['push'](_0x190b95['shift']());}};_0x4d5c92(++_0xfbfcc9);}(_0x0992,0xb7));var _0x2099=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x0992[_0x23e6bb];return _0x1e3b4c;};'use strict';var _=require(_0x2099('0x0'));var util=require(_0x2099('0x1'));var logger=require('../../config/logger')(_0x2099('0x2'));var moment=require(_0x2099('0x3'));var BPromise=require(_0x2099('0x4'));var rp=require(_0x2099('0x5'));var fs=require('fs');var path=require(_0x2099('0x6'));var rimraf=require('rimraf');var config=require(_0x2099('0x7'));var attributes=require(_0x2099('0x8'));module[_0x2099('0x9')]=function(_0x74728,_0x311969){return _0x74728[_0x2099('0xa')](_0x2099('0xb'),attributes,{'tableName':_0x2099('0xc'),'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 7cb3ca9..e0167e2 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 _0x23fc=['agent','Start','startRouting','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxAccount','findAll','options','where','attributes','include','map','model','GetFaxAccount','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','Applications','get','account','applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift'];(function(_0x1df922,_0x20bf04){var _0x5807ee=function(_0xd57bfd){while(--_0xd57bfd){_0x1df922['push'](_0x1df922['shift']());}};_0x5807ee(++_0x20bf04);}(_0x23fc,0x15f));var _0xc23f=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x23fc[_0x3b87f4];return _0x63d16e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc23f('0x0'));var BPromise=require(_0xc23f('0x1'));var rs=require(_0xc23f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc23f('0x3'))['db'];var utils=require(_0xc23f('0x4'));var logger=require(_0xc23f('0x5'))(_0xc23f('0x6'));var config=require(_0xc23f('0x7'));var jayson=require(_0xc23f('0x8'));var client=jayson[_0xc23f('0x9')][_0xc23f('0xa')]({'port':0x232c});config[_0xc23f('0xb')]=_[_0xc23f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc23f('0xd'))(new Redis(config[_0xc23f('0xb')]));require('./faxAccount.socket')[_0xc23f('0xe')](socket);function respondWithRpcPromise(_0x20f7fa,_0x4fab2d,_0x37284a){return new BPromise(function(_0x44fd03,_0x367025){return client[_0xc23f('0xf')](_0x20f7fa,_0x37284a)[_0xc23f('0x10')](function(_0x90642b){logger['info'](_0xc23f('0x11'),_0x4fab2d,_0xc23f('0x12'));logger[_0xc23f('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4fab2d,_0xc23f('0x12'),JSON[_0xc23f('0x14')](_0x90642b));if(_0x90642b[_0xc23f('0x15')]){if(_0x90642b['error'][_0xc23f('0x16')]===0x1f4){logger['error'](_0xc23f('0x11'),_0x4fab2d,_0x90642b[_0xc23f('0x15')][_0xc23f('0x17')]);return _0x367025(_0x90642b[_0xc23f('0x15')][_0xc23f('0x17')]);}logger[_0xc23f('0x15')](_0xc23f('0x11'),_0x4fab2d,_0x90642b[_0xc23f('0x15')][_0xc23f('0x17')]);return _0x44fd03(_0x90642b[_0xc23f('0x15')][_0xc23f('0x17')]);}else{logger[_0xc23f('0x18')](_0xc23f('0x11'),_0x4fab2d,_0xc23f('0x12'));_0x44fd03(_0x90642b[_0xc23f('0x19')][_0xc23f('0x17')]);}})[_0xc23f('0x1a')](function(_0x14696f){logger[_0xc23f('0x15')](_0xc23f('0x11'),_0x4fab2d,_0x14696f);_0x367025(_0x14696f);});});}exports['GetFaxAccount']=function(_0x218c18){var _0x56a0cf=this;return new Promise(function(_0x1dcb83,_0x34b781){return db[_0xc23f('0x1b')][_0xc23f('0x1c')]({'raw':_0x218c18[_0xc23f('0x1d')]?_0x218c18[_0xc23f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x218c18[_0xc23f('0x1d')]?_0x218c18['options'][_0xc23f('0x1e')]||null:null,'attributes':_0x218c18['options']?_0x218c18[_0xc23f('0x1d')][_0xc23f('0x1f')]||null:null,'limit':_0x218c18[_0xc23f('0x1d')]?_0x218c18['options']['limit']||null:null,'include':_0x218c18[_0xc23f('0x1d')]?_0x218c18['options'][_0xc23f('0x20')]?_[_0xc23f('0x21')](_0x218c18[_0xc23f('0x1d')]['include'],function(_0x19f6f5){return{'model':db[_0x19f6f5[_0xc23f('0x22')]],'as':_0x19f6f5['as'],'attributes':_0x19f6f5[_0xc23f('0x1f')],'include':_0x19f6f5[_0xc23f('0x20')]?_[_0xc23f('0x21')](_0x19f6f5[_0xc23f('0x20')],function(_0x2db05e){return{'model':db[_0x2db05e[_0xc23f('0x22')]],'as':_0x2db05e['as'],'attributes':_0x2db05e['attributes'],'include':_0x2db05e[_0xc23f('0x20')]?_[_0xc23f('0x21')](_0x2db05e[_0xc23f('0x20')],function(_0x66636e){return{'model':db[_0x66636e[_0xc23f('0x22')]],'as':_0x66636e['as'],'attributes':_0x66636e[_0xc23f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc23f('0x10')](function(_0x477a75){logger[_0xc23f('0x18')](_0xc23f('0x23'),_0x218c18);logger['debug'](_0xc23f('0x23'),_0x218c18,JSON['stringify'](_0x477a75));_0x1dcb83(_0x477a75);})['catch'](function(_0xce911e){logger['error'](_0xc23f('0x23'),_0xce911e[_0xc23f('0x17')],_0x218c18);_0x34b781(_0x56a0cf[_0xc23f('0x15')](0x1f4,_0xce911e[_0xc23f('0x17')]));});});};exports[_0xc23f('0x24')]=function(_0x32a7cc,_0x115d35,_0xed8565){var _0x423e22=this;return new Promise(function(_0x4160c0,_0x3b7d0c){var _0x57c885={'body':_0x32a7cc['body'],'channel':_0xc23f('0x25')};var _0x5d2e40=[];var _0x2e3898=[];var _0x39f9d3={};return db[_0xc23f('0x26')][_0xc23f('0x27')]()['then'](function(_0x49cd15){if(!_0x49cd15){throw new db['Sequelize'][(_0xc23f('0x28'))](_0xc23f('0x29'));}_0x5d2e40=_[_0xc23f('0x2a')](_[_0xc23f('0x2b')](_0x49cd15),[_0xc23f('0x2c'),_0xc23f('0x2d')]);_0x2e3898=_['difference'](_[_0xc23f('0x2b')](_0x49cd15),[_0xc23f('0x2c'),_0xc23f('0x2d'),_0xc23f('0x2e'),_0xc23f('0x2f')]);if(_0x32a7cc['body']['id']){delete _0x32a7cc[_0xc23f('0x30')]['id'];}if(_[_0xc23f('0x31')](_0x32a7cc['body'][_0xc23f('0x32')])){throw new db[(_0xc23f('0x33'))]['ValidationError'](_0xc23f('0x34'));}if(_['isNil'](_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x30')])||_0x32a7cc[_0xc23f('0x30')]['body']===''){throw new db[(_0xc23f('0x33'))][(_0xc23f('0x28'))](_0xc23f('0x35'));}if(_[_0xc23f('0x31')](_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x36')])){throw new db[(_0xc23f('0x33'))][(_0xc23f('0x28'))](_0xc23f('0x37')+_0x2e3898);}if(!_['includes'](_0x2e3898,_0x32a7cc[_0xc23f('0x30')]['mapKey'])){throw new db[(_0xc23f('0x33'))]['ValidationError'](_0xc23f('0x38')+_0x2e3898);}_0x39f9d3[_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x36')]]=_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x32')];})[_0xc23f('0x10')](function(){return db['FaxAccount'][_0xc23f('0x39')]({'where':{'id':_0x32a7cc['account']['id']},'include':[{'model':db[_0xc23f('0x3a')],'as':_0xc23f('0x3b'),'include':[{'model':db[_0xc23f('0x26')],'as':_0xc23f('0x3c'),'where':_0x39f9d3,'limit':0x1,'order':[['updatedAt',_0xc23f('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0xc23f('0x3e')}]});})[_0xc23f('0x10')](function(_0x25b9c8){if(_0x25b9c8&&_0x25b9c8['List']){var _0x2a3f6b=_0x25b9c8[_0xc23f('0x3f')]({'plain':!![]});_0x57c885[_0xc23f('0x40')]=_0x2a3f6b;_0x57c885[_0xc23f('0x41')]=_0x2a3f6b[_0xc23f('0x3e')];_0x57c885[_0xc23f('0x42')]=_0x2a3f6b[_0xc23f('0x3b')];_0x57c885[_0xc23f('0x41')]=_[_0xc23f('0x43')](_0x57c885[_0xc23f('0x41')],[_0xc23f('0x44')],[_0xc23f('0x45')]);if(_0x57c885[_0xc23f('0x40')][_0xc23f('0x3e')]){delete _0x57c885[_0xc23f('0x40')][_0xc23f('0x3e')];}if(_0x57c885[_0xc23f('0x40')]['List']&&_0x57c885[_0xc23f('0x40')][_0xc23f('0x3b')][_0xc23f('0x3c')][_0xc23f('0x46')]){return _0x57c885[_0xc23f('0x40')][_0xc23f('0x3b')][_0xc23f('0x3c')][0x0];}var _0x2e81ce=_['defaults'](_0x32a7cc[_0xc23f('0x30')],{'firstName':_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x32')],'ListId':_0x2a3f6b[_0xc23f('0x2f')]});_0x2e81ce[_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x36')]]=_0x32a7cc[_0xc23f('0x30')]['from'];return db[_0xc23f('0x26')][_0xc23f('0x47')](_0x2e81ce,{'fields':_0x5d2e40,'raw':!![]});}})[_0xc23f('0x10')](function(_0x5b1664){_0x57c885[_0xc23f('0x48')]=_0x5b1664;if(_0x5b1664){var _0x3c441f={'ContactId':_0x5b1664['id'],'FaxAccountId':_0x32a7cc['account']['id'],'fax':_0x5b1664[_0xc23f('0x25')]};return db[_0xc23f('0x49')][_0xc23f('0x39')]({'where':{'ContactId':_0x5b1664['id'],'closed':![],'FaxAccountId':_0x32a7cc[_0xc23f('0x40')]['id']}})[_0xc23f('0x10')](function(_0x28939b){if(_0x28939b){return[_0x28939b,![]];}return db['FaxInteraction']['create'](_0x3c441f)[_0xc23f('0x10')](function(_0x472195){return[_0x472195,!![]];});});}else{throw new Error(_0xc23f('0x4a'));}})['spread'](function(_0x3ef194,_0x2c1b99){var _0x30fcf0=_0x3ef194[_0xc23f('0x3f')]({'plain':!![]});if(_0x2c1b99){if(_0x57c885[_0xc23f('0x40')][_0xc23f('0x4b')]){_0x57c885[_0xc23f('0x41')]['push']({'id':0x0,'priority':_0x57c885[_0xc23f('0x41')][_0xc23f('0x46')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x30fcf0['created']=!![];}else{_0x30fcf0['created']=![];}_0x57c885[_0xc23f('0x4c')]=_0x30fcf0;return db[_0xc23f('0x4d')][_0xc23f('0x47')]({'body':_0x32a7cc[_0xc23f('0x30')][_0xc23f('0x30')],'FaxAccountId':_0x32a7cc[_0xc23f('0x40')]['id'],'FaxInteractionId':_0x3ef194['id'],'direction':'in','ContactId':_0x3ef194[_0xc23f('0x4e')],'AttachmentId':_0x32a7cc['body'][_0xc23f('0x4f')]});})['then'](function(_0x393b1){_0x57c885[_0xc23f('0x17')]=_0x393b1;if(_0x57c885['interaction'][_0xc23f('0x50')]){return db[_0xc23f('0x51')][_0xc23f('0x39')]({'attributes':['id',_0xc23f('0x52')],'where':{'id':_0x57c885['interaction'][_0xc23f('0x50')]}})[_0xc23f('0x10')](function(_0x55d9c8){if(_0x55d9c8){_0x57c885[_0xc23f('0x41')][_0xc23f('0x53')]({'id':0x0,'priority':0x0,'app':_0xc23f('0x54'),'appdata':_0x55d9c8['name']+','+(_0x57c885[_0xc23f('0x40')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc23f('0x55'),_0xc23f('0x56'),_0x57c885);});}return respondWithRpcPromise(_0xc23f('0x55'),_0xc23f('0x56'),_0x57c885);})[_0xc23f('0x10')](function(_0x4f4791){_0x4160c0(_0x4f4791);})[_0xc23f('0x1a')](function(_0x3c2315){_0x3b7d0c(_0x423e22['error'](0x1f4,_0x3c2315[_0xc23f('0x17')]));});});}; \ No newline at end of file +var _0x60f9=['DESC','FaxApplication','Applications','applications','list','orderBy','priority','asc','contact','FaxInteraction','create','Contact\x20not\x20found','spread','get','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./faxAccount.socket','register','info','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','map','include','model','then','debug','NotifyFaxAccount','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts'];(function(_0xd3e0b9,_0xd80d4d){var _0x470133=function(_0x1aede8){while(--_0x1aede8){_0xd3e0b9['push'](_0xd3e0b9['shift']());}};_0x470133(++_0xd80d4d);}(_0x60f9,0x1a4));var _0x960f=function(_0x1da72f,_0x443d42){_0x1da72f=_0x1da72f-0x0;var _0x49a2a3=_0x60f9[_0x1da72f];return _0x49a2a3;};'use strict';var _=require(_0x960f('0x0'));var util=require(_0x960f('0x1'));var moment=require(_0x960f('0x2'));var BPromise=require(_0x960f('0x3'));var rs=require(_0x960f('0x4'));var fs=require('fs');var Redis=require(_0x960f('0x5'));var db=require(_0x960f('0x6'))['db'];var utils=require(_0x960f('0x7'));var logger=require(_0x960f('0x8'))(_0x960f('0x9'));var config=require(_0x960f('0xa'));var jayson=require(_0x960f('0xb'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x960f('0xc')](config[_0x960f('0xd')],{'host':_0x960f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x960f('0xd')]));require(_0x960f('0xf'))[_0x960f('0x10')](socket);function respondWithRpcPromise(_0x59e51e,_0x1ed5b7,_0x302f4d){return new BPromise(function(_0x171ab3,_0x3b9582){return client['request'](_0x59e51e,_0x302f4d)['then'](function(_0x568e6f){logger[_0x960f('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1ed5b7,_0x960f('0x12'));logger['debug'](_0x960f('0x13'),_0x1ed5b7,_0x960f('0x12'),JSON[_0x960f('0x14')](_0x568e6f));if(_0x568e6f[_0x960f('0x15')]){if(_0x568e6f[_0x960f('0x15')][_0x960f('0x16')]===0x1f4){logger[_0x960f('0x15')](_0x960f('0x17'),_0x1ed5b7,_0x568e6f[_0x960f('0x15')][_0x960f('0x18')]);return _0x3b9582(_0x568e6f['error'][_0x960f('0x18')]);}logger[_0x960f('0x15')](_0x960f('0x17'),_0x1ed5b7,_0x568e6f[_0x960f('0x15')][_0x960f('0x18')]);return _0x171ab3(_0x568e6f[_0x960f('0x15')][_0x960f('0x18')]);}else{logger[_0x960f('0x11')](_0x960f('0x17'),_0x1ed5b7,_0x960f('0x12'));_0x171ab3(_0x568e6f[_0x960f('0x19')][_0x960f('0x18')]);}})[_0x960f('0x1a')](function(_0x204839){logger[_0x960f('0x15')](_0x960f('0x17'),_0x1ed5b7,_0x204839);_0x3b9582(_0x204839);});});}exports[_0x960f('0x1b')]=function(_0x179e09){var _0x52a52f=this;return new Promise(function(_0x4ae967,_0x3a89b0){return db[_0x960f('0x1c')][_0x960f('0x1d')]({'raw':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')][_0x960f('0x1f')]===undefined?!![]:![]:!![],'where':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')][_0x960f('0x20')]||null:null,'attributes':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')][_0x960f('0x21')]||null:null,'limit':_0x179e09[_0x960f('0x1e')]?_0x179e09[_0x960f('0x1e')]['limit']||null:null,'include':_0x179e09[_0x960f('0x1e')]?_0x179e09['options']['include']?_[_0x960f('0x22')](_0x179e09['options']['include'],function(_0x221f7c){return{'model':db[_0x221f7c['model']],'as':_0x221f7c['as'],'attributes':_0x221f7c['attributes'],'include':_0x221f7c[_0x960f('0x23')]?_['map'](_0x221f7c[_0x960f('0x23')],function(_0x167cb8){return{'model':db[_0x167cb8[_0x960f('0x24')]],'as':_0x167cb8['as'],'attributes':_0x167cb8[_0x960f('0x21')],'include':_0x167cb8[_0x960f('0x23')]?_[_0x960f('0x22')](_0x167cb8[_0x960f('0x23')],function(_0x392791){return{'model':db[_0x392791[_0x960f('0x24')]],'as':_0x392791['as'],'attributes':_0x392791[_0x960f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x960f('0x25')](function(_0x315fcc){logger[_0x960f('0x11')](_0x960f('0x1b'),_0x179e09);logger[_0x960f('0x26')](_0x960f('0x1b'),_0x179e09,JSON[_0x960f('0x14')](_0x315fcc));_0x4ae967(_0x315fcc);})['catch'](function(_0x38483b){logger['error'](_0x960f('0x1b'),_0x38483b['message'],_0x179e09);_0x3a89b0(_0x52a52f[_0x960f('0x15')](0x1f4,_0x38483b[_0x960f('0x18')]));});});};exports[_0x960f('0x27')]=function(_0xf3eee5,_0x3c66a2,_0xd4796a){var _0x5c5d08=this;return new Promise(function(_0x2834b6,_0x45cbb3){var _0x4068fa={'body':_0xf3eee5['body'],'channel':_0x960f('0x28')};var _0x9f1339=[];var _0x4fd52a=[];var _0x4483a8={};return db['CmContact']['describe']()[_0x960f('0x25')](function(_0x344fab){if(!_0x344fab){throw new db[(_0x960f('0x29'))][(_0x960f('0x2a'))](_0x960f('0x2b'));}_0x9f1339=_[_0x960f('0x2c')](_[_0x960f('0x2d')](_0x344fab),[_0x960f('0x2e'),_0x960f('0x2f')]);_0x4fd52a=_['difference'](_[_0x960f('0x2d')](_0x344fab),[_0x960f('0x2e'),_0x960f('0x2f'),_0x960f('0x30'),_0x960f('0x31')]);if(_0xf3eee5[_0x960f('0x32')]['id']){delete _0xf3eee5[_0x960f('0x32')]['id'];}if(_[_0x960f('0x33')](_0xf3eee5['body'][_0x960f('0x34')])){throw new db['Sequelize']['ValidationError'](_0x960f('0x35'));}if(_[_0x960f('0x33')](_0xf3eee5[_0x960f('0x32')][_0x960f('0x32')])||_0xf3eee5[_0x960f('0x32')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x960f('0x36'));}if(_[_0x960f('0x33')](_0xf3eee5[_0x960f('0x32')]['mapKey'])){throw new db[(_0x960f('0x29'))][(_0x960f('0x2a'))](_0x960f('0x37')+_0x4fd52a);}if(!_[_0x960f('0x38')](_0x4fd52a,_0xf3eee5[_0x960f('0x32')][_0x960f('0x39')])){throw new db['Sequelize'][(_0x960f('0x2a'))](_0x960f('0x3a')+_0x4fd52a);}_0x4483a8[_0xf3eee5['body'][_0x960f('0x39')]]=_0xf3eee5[_0x960f('0x32')][_0x960f('0x34')];})[_0x960f('0x25')](function(){return db['FaxAccount'][_0x960f('0x3b')]({'where':{'id':_0xf3eee5[_0x960f('0x3c')]['id']},'include':[{'model':db[_0x960f('0x3d')],'as':_0x960f('0x3e'),'include':[{'model':db[_0x960f('0x3f')],'as':_0x960f('0x40'),'where':_0x4483a8,'limit':0x1,'order':[[_0x960f('0x2f'),_0x960f('0x41')]]}]},{'model':db[_0x960f('0x42')],'as':_0x960f('0x43')}]});})[_0x960f('0x25')](function(_0x481804){if(_0x481804&&_0x481804['List']){var _0xe33657=_0x481804['get']({'plain':!![]});_0x4068fa[_0x960f('0x3c')]=_0xe33657;_0x4068fa[_0x960f('0x44')]=_0xe33657[_0x960f('0x43')];_0x4068fa[_0x960f('0x45')]=_0xe33657['List'];_0x4068fa[_0x960f('0x44')]=_[_0x960f('0x46')](_0x4068fa['applications'],[_0x960f('0x47')],[_0x960f('0x48')]);if(_0x4068fa['account'][_0x960f('0x43')]){delete _0x4068fa[_0x960f('0x3c')][_0x960f('0x43')];}if(_0x4068fa[_0x960f('0x3c')][_0x960f('0x3e')]&&_0x4068fa[_0x960f('0x3c')][_0x960f('0x3e')][_0x960f('0x40')]['length']){return _0x4068fa[_0x960f('0x3c')]['List'][_0x960f('0x40')][0x0];}var _0x1af105=_[_0x960f('0xc')](_0xf3eee5['body'],{'firstName':_0xf3eee5[_0x960f('0x32')][_0x960f('0x34')],'ListId':_0xe33657['ListId']});_0x1af105[_0xf3eee5[_0x960f('0x32')][_0x960f('0x39')]]=_0xf3eee5[_0x960f('0x32')][_0x960f('0x34')];return db[_0x960f('0x3f')]['create'](_0x1af105,{'fields':_0x9f1339,'raw':!![]});}})[_0x960f('0x25')](function(_0x19a474){_0x4068fa[_0x960f('0x49')]=_0x19a474;if(_0x19a474){var _0x2a5321={'ContactId':_0x19a474['id'],'FaxAccountId':_0xf3eee5[_0x960f('0x3c')]['id'],'fax':_0x19a474[_0x960f('0x28')]};return db[_0x960f('0x4a')][_0x960f('0x3b')]({'where':{'ContactId':_0x19a474['id'],'closed':![],'FaxAccountId':_0xf3eee5[_0x960f('0x3c')]['id']}})[_0x960f('0x25')](function(_0xb9b491){if(_0xb9b491){return[_0xb9b491,![]];}return db['FaxInteraction'][_0x960f('0x4b')](_0x2a5321)[_0x960f('0x25')](function(_0x2a113f){return[_0x2a113f,!![]];});});}else{throw new Error(_0x960f('0x4c'));}})[_0x960f('0x4d')](function(_0x302434,_0xd3c9ad){var _0x289570=_0x302434[_0x960f('0x4e')]({'plain':!![]});if(_0xd3c9ad){if(_0x4068fa[_0x960f('0x3c')][_0x960f('0x4f')]){_0x4068fa[_0x960f('0x44')][_0x960f('0x50')]({'id':0x0,'priority':_0x4068fa['applications'][_0x960f('0x51')]+0x1,'app':_0x960f('0x52'),'appdata':_0x960f('0x53'),'interval':_0x960f('0x54')});}_0x289570[_0x960f('0x55')]=!![];}else{_0x289570['created']=![];}_0x4068fa[_0x960f('0x56')]=_0x289570;return db[_0x960f('0x57')][_0x960f('0x4b')]({'body':_0xf3eee5[_0x960f('0x32')][_0x960f('0x32')],'FaxAccountId':_0xf3eee5[_0x960f('0x3c')]['id'],'FaxInteractionId':_0x302434['id'],'direction':'in','ContactId':_0x302434[_0x960f('0x58')],'AttachmentId':_0xf3eee5[_0x960f('0x32')][_0x960f('0x59')]});})[_0x960f('0x25')](function(_0xcbbbb8){_0x4068fa[_0x960f('0x18')]=_0xcbbbb8;if(_0x4068fa['interaction'][_0x960f('0x5a')]){return db[_0x960f('0x5b')][_0x960f('0x3b')]({'attributes':['id',_0x960f('0x5c')],'where':{'id':_0x4068fa[_0x960f('0x56')][_0x960f('0x5a')]}})[_0x960f('0x25')](function(_0x50cd4d){if(_0x50cd4d){_0x4068fa[_0x960f('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0x960f('0x5d'),'appdata':_0x50cd4d[_0x960f('0x5c')]+','+(_0x4068fa['account'][_0x960f('0x5e')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x960f('0x5f'),_0x960f('0x60'),_0x4068fa);});}return respondWithRpcPromise(_0x960f('0x5f'),_0x960f('0x60'),_0x4068fa);})['then'](function(_0x243d9b){_0x2834b6(_0x243d9b);})[_0x960f('0x1a')](function(_0x4ebd7a){_0x45cbb3(_0x5c5d08[_0x960f('0x15')](0x1f4,_0x4ebd7a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0e7aec8..bb0fd8d 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 _0xac80=['remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x3f0ef5,_0x4c3fb5){var _0x4cd560=function(_0x284c35){while(--_0x284c35){_0x3f0ef5['push'](_0x3f0ef5['shift']());}};_0x4cd560(++_0x4c3fb5);}(_0xac80,0xb6));var _0x0ac8=function(_0xc34152,_0x336bc6){_0xc34152=_0xc34152-0x0;var _0x4085a6=_0xac80[_0xc34152];return _0x4085a6;};'use strict';var FaxAccountEvents=require(_0x0ac8('0x0'));var events=[_0x0ac8('0x1'),_0x0ac8('0x2'),'update'];function createListener(_0x257bdd,_0x88e2e5){return function(_0x21c184){_0x88e2e5[_0x0ac8('0x3')](_0x257bdd,_0x21c184);};}function removeListener(_0x4022b1,_0x12cc0c){return function(){FaxAccountEvents[_0x0ac8('0x4')](_0x4022b1,_0x12cc0c);};}exports[_0x0ac8('0x5')]=function(_0x2d65bb){for(var _0x571e46=0x0,_0x541d90=events[_0x0ac8('0x6')];_0x571e46<_0x541d90;_0x571e46++){var _0x4f2c52=events[_0x571e46];var _0x3ada39=createListener(_0x0ac8('0x7')+_0x4f2c52,_0x2d65bb);FaxAccountEvents['on'](_0x4f2c52,_0x3ada39);}}; \ No newline at end of file +var _0x0d0c=['save','remove','update','removeListener','register','length','./faxAccount.events'];(function(_0x865a5b,_0x3ecd1a){var _0x46c374=function(_0x1fa804){while(--_0x1fa804){_0x865a5b['push'](_0x865a5b['shift']());}};_0x46c374(++_0x3ecd1a);}(_0x0d0c,0xb5));var _0xc0d0=function(_0x250d51,_0x289368){_0x250d51=_0x250d51-0x0;var _0x1a882b=_0x0d0c[_0x250d51];return _0x1a882b;};'use strict';var FaxAccountEvents=require(_0xc0d0('0x0'));var events=[_0xc0d0('0x1'),_0xc0d0('0x2'),_0xc0d0('0x3')];function createListener(_0xd597b9,_0x2d3b59){return function(_0x3b1387){_0x2d3b59['emit'](_0xd597b9,_0x3b1387);};}function removeListener(_0x2049c4,_0x567f59){return function(){FaxAccountEvents[_0xc0d0('0x4')](_0x2049c4,_0x567f59);};}exports[_0xc0d0('0x5')]=function(_0x4f5bc0){for(var _0x2afcee=0x0,_0x174713=events[_0xc0d0('0x6')];_0x2afcee<_0x174713;_0x2afcee++){var _0x5adf7b=events[_0x2afcee];var _0x196df5=createListener('faxAccount:'+_0x5adf7b,_0x4f5bc0);FaxAccountEvents['on'](_0x5adf7b,_0x196df5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 64e642c..0709f6a 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(_0x207267,_0x50618f){var _0x4c7d02=function(_0x457385){while(--_0x457385){_0x207267['push'](_0x207267['shift']());}};_0x4c7d02(++_0x50618f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x430298,_0x4a2293){var _0x481e9a=function(_0x1a75b7){while(--_0x1a75b7){_0x430298['push'](_0x430298['shift']());}};_0x481e9a(++_0x4a2293);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 d76bbed..6ad12bf 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 _0x337f=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x42914b,_0xa31137){var _0x354047=function(_0x6fdb96){while(--_0x6fdb96){_0x42914b['push'](_0x42914b['shift']());}};_0x354047(++_0xa31137);}(_0x337f,0x11c));var _0xf337=function(_0x19a4cb,_0x2c2fab){_0x19a4cb=_0x19a4cb-0x0;var _0x14afde=_0x337f[_0x19a4cb];return _0x14afde;};'use strict';var Sequelize=require(_0xf337('0x0'));module[_0xf337('0x1')]={'priority':{'type':Sequelize[_0xf337('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf337('0x3')},'appdata':{'type':Sequelize[_0xf337('0x4')]()},'description':{'type':Sequelize[_0xf337('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf337('0x6')}}; \ No newline at end of file +var _0x5806=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x5732d6,_0x2c9500){var _0x3a1a0f=function(_0x5ae05e){while(--_0x5ae05e){_0x5732d6['push'](_0x5732d6['shift']());}};_0x3a1a0f(++_0x2c9500);}(_0x5806,0x174));var _0x6580=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x5806[_0x291d3f];return _0x242080;};'use strict';var Sequelize=require(_0x6580('0x0'));module[_0x6580('0x1')]={'priority':{'type':Sequelize[_0x6580('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6580('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6580('0x4')]()},'description':{'type':Sequelize[_0x6580('0x3')]},'interval':{'type':Sequelize[_0x6580('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d460687..a6a5a76 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 _0x6f9a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x3231fb,_0x1d7594){var _0xd647d1=function(_0x5f42b2){while(--_0x5f42b2){_0x3231fb['push'](_0x3231fb['shift']());}};_0xd647d1(++_0x1d7594);}(_0x6f9a,0xd3));var _0xa6f9=function(_0x12c62e,_0xfe9465){_0x12c62e=_0x12c62e-0x0;var _0x1e5901=_0x6f9a[_0x12c62e];return _0x1e5901;};'use strict';var emlformat=require(_0xa6f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6f9('0x1'));var jsonpatch=require(_0xa6f9('0x2'));var rp=require(_0xa6f9('0x3'));var moment=require(_0xa6f9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa6f9('0x5'));var path=require(_0xa6f9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa6f9('0x7'));var fs=require('fs');var fs_extra=require(_0xa6f9('0x8'));var _=require(_0xa6f9('0x9'));var squel=require(_0xa6f9('0xa'));var crypto=require('crypto');var jsforce=require(_0xa6f9('0xb'));var deskjs=require(_0xa6f9('0xc'));var toCsv=require(_0xa6f9('0xd'));var querystring=require(_0xa6f9('0xe'));var Papa=require('papaparse');var Redis=require(_0xa6f9('0xf'));var authService=require(_0xa6f9('0x10'));var qs=require(_0xa6f9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6f9('0x12'));var logger=require(_0xa6f9('0x13'))(_0xa6f9('0x14'));var utils=require(_0xa6f9('0x15'));var config=require(_0xa6f9('0x16'));var licenseUtil=require(_0xa6f9('0x17'));var db=require(_0xa6f9('0x18'))['db'];function respondWithStatusCode(_0x1b26f8,_0x1bafe6){_0x1bafe6=_0x1bafe6||0xcc;return function(_0x4cd49e){if(_0x4cd49e){return _0x1b26f8[_0xa6f9('0x19')](_0x1bafe6);}return _0x1b26f8[_0xa6f9('0x1a')](_0x1bafe6)[_0xa6f9('0x1b')]();};}function respondWithResult(_0x2b4806,_0x72a83a){_0x72a83a=_0x72a83a||0xc8;return function(_0x162974){if(_0x162974){return _0x2b4806[_0xa6f9('0x1a')](_0x72a83a)[_0xa6f9('0x1c')](_0x162974);}};}function respondWithFilteredResult(_0x97dbe4,_0x5cf261){return function(_0x195035){if(_0x195035){var _0xa8629=typeof _0x5cf261[_0xa6f9('0x1d')]==='undefined'&&typeof _0x5cf261[_0xa6f9('0x1e')]===_0xa6f9('0x1f');var _0x29ba02=_0x195035['count'];var _0x547a4e=_0xa8629?0x0:_0x5cf261[_0xa6f9('0x1d')];var _0x4b5b6a=_0xa8629?_0x195035[_0xa6f9('0x20')]:_0x5cf261['offset']+_0x5cf261[_0xa6f9('0x1e')];var _0x25c264;if(_0x4b5b6a>=_0x29ba02){_0x4b5b6a=_0x29ba02;_0x25c264=0xc8;}else{_0x25c264=0xce;}_0x97dbe4[_0xa6f9('0x1a')](_0x25c264);return _0x97dbe4[_0xa6f9('0x21')](_0xa6f9('0x22'),_0x547a4e+'-'+_0x4b5b6a+'/'+_0x29ba02)[_0xa6f9('0x1c')](_0x195035);}return null;};}function patchUpdates(_0x4d4807){return function(_0x5b5aea){try{jsonpatch['apply'](_0x5b5aea,_0x4d4807,!![]);}catch(_0x5df93c){return BPromise[_0xa6f9('0x23')](_0x5df93c);}return _0x5b5aea['save']();};}function saveUpdates(_0x5d9c23,_0x3aab9e){return function(_0x1a1902){if(_0x1a1902){return _0x1a1902[_0xa6f9('0x24')](_0x5d9c23)[_0xa6f9('0x25')](function(_0x307048){return _0x307048;});}return null;};}function removeEntity(_0x8cbaf0,_0x3c2f0e){return function(_0x5f48dc){if(_0x5f48dc){return _0x5f48dc['destroy']()['then'](function(){_0x8cbaf0['status'](0xcc)[_0xa6f9('0x1b')]();});}};}function handleEntityNotFound(_0x4b451d,_0x56109a){return function(_0x518e42){if(!_0x518e42){_0x4b451d[_0xa6f9('0x19')](0x194);}return _0x518e42;};}function handleError(_0x299ac3,_0x2ada70){_0x2ada70=_0x2ada70||0x1f4;return function(_0x2c4e39){logger[_0xa6f9('0x26')](_0x2c4e39[_0xa6f9('0x27')]);if(_0x2c4e39[_0xa6f9('0x28')]){delete _0x2c4e39[_0xa6f9('0x28')];}_0x299ac3[_0xa6f9('0x1a')](_0x2ada70)[_0xa6f9('0x29')](_0x2c4e39);};}exports[_0xa6f9('0x2a')]=function(_0x1065dc,_0x2cfccd){var _0x31783c={},_0x443aff={},_0x1aa638={'count':0x0,'rows':[]};var _0x2441d9=_[_0xa6f9('0x2b')](db[_0xa6f9('0x2c')][_0xa6f9('0x2d')],function(_0x21197a){return{'name':_0x21197a[_0xa6f9('0x2e')],'type':_0x21197a['type'][_0xa6f9('0x2f')]};});_0x443aff[_0xa6f9('0x30')]=_[_0xa6f9('0x2b')](_0x2441d9,'name');_0x443aff[_0xa6f9('0x31')]=_['keys'](_0x1065dc[_0xa6f9('0x31')]);_0x443aff['filters']=_[_0xa6f9('0x32')](_0x443aff[_0xa6f9('0x30')],_0x443aff[_0xa6f9('0x31')]);_0x31783c[_0xa6f9('0x33')]=_['intersection'](_0x443aff['model'],qs[_0xa6f9('0x34')](_0x1065dc[_0xa6f9('0x31')][_0xa6f9('0x34')]));_0x31783c['attributes']=_0x31783c[_0xa6f9('0x33')]['length']?_0x31783c[_0xa6f9('0x33')]:_0x443aff[_0xa6f9('0x30')];if(!_0x1065dc[_0xa6f9('0x31')][_0xa6f9('0x35')](_0xa6f9('0x36'))){_0x31783c[_0xa6f9('0x1e')]=qs[_0xa6f9('0x1e')](_0x1065dc[_0xa6f9('0x31')][_0xa6f9('0x1e')]);_0x31783c[_0xa6f9('0x1d')]=qs['offset'](_0x1065dc[_0xa6f9('0x31')][_0xa6f9('0x1d')]);}_0x31783c['order']=qs[_0xa6f9('0x37')](_0x1065dc[_0xa6f9('0x31')]['sort']);_0x31783c[_0xa6f9('0x38')]=qs[_0xa6f9('0x39')](_[_0xa6f9('0x3a')](_0x1065dc[_0xa6f9('0x31')],_0x443aff[_0xa6f9('0x39')]),_0x2441d9);if(_0x1065dc[_0xa6f9('0x31')][_0xa6f9('0x3b')]){_0x31783c[_0xa6f9('0x38')]=_[_0xa6f9('0x3c')](_0x31783c['where'],{'$or':_[_0xa6f9('0x2b')](_0x2441d9,function(_0x464d85){if(_0x464d85[_0xa6f9('0x3d')]!==_0xa6f9('0x3e')){var _0xf021bb={};_0xf021bb[_0x464d85['name']]={'$like':'%'+_0x1065dc[_0xa6f9('0x31')]['filter']+'%'};return _0xf021bb;}})});}_0x31783c=_[_0xa6f9('0x3c')]({},_0x31783c,_0x1065dc[_0xa6f9('0x3f')]);var _0x374c6d={'where':_0x31783c[_0xa6f9('0x38')]};return db['FaxApplication'][_0xa6f9('0x20')](_0x374c6d)[_0xa6f9('0x25')](function(_0x456eac){_0x1aa638['count']=_0x456eac;if(_0x1065dc[_0xa6f9('0x31')][_0xa6f9('0x40')]){_0x31783c[_0xa6f9('0x41')]=[{'all':!![]}];}return db[_0xa6f9('0x2c')]['findAll'](_0x31783c);})[_0xa6f9('0x25')](function(_0x39028){_0x1aa638[_0xa6f9('0x42')]=_0x39028;return _0x1aa638;})[_0xa6f9('0x25')](respondWithFilteredResult(_0x2cfccd,_0x31783c))[_0xa6f9('0x43')](handleError(_0x2cfccd,null));};exports[_0xa6f9('0x44')]=function(_0x57067c,_0x86b155){var _0x163f69={'raw':!![],'where':{'id':_0x57067c[_0xa6f9('0x45')]['id']}},_0x2abdd4={};_0x2abdd4[_0xa6f9('0x30')]=_['keys'](db[_0xa6f9('0x2c')][_0xa6f9('0x2d')]);_0x2abdd4[_0xa6f9('0x31')]=_[_0xa6f9('0x46')](_0x57067c[_0xa6f9('0x31')]);_0x2abdd4[_0xa6f9('0x39')]=_[_0xa6f9('0x32')](_0x2abdd4['model'],_0x2abdd4[_0xa6f9('0x31')]);_0x163f69[_0xa6f9('0x33')]=_[_0xa6f9('0x32')](_0x2abdd4['model'],qs[_0xa6f9('0x34')](_0x57067c[_0xa6f9('0x31')]['fields']));_0x163f69['attributes']=_0x163f69[_0xa6f9('0x33')][_0xa6f9('0x47')]?_0x163f69[_0xa6f9('0x33')]:_0x2abdd4[_0xa6f9('0x30')];if(_0x57067c['query'][_0xa6f9('0x40')]){_0x163f69[_0xa6f9('0x41')]=[{'all':!![]}];}_0x163f69=_['merge']({},_0x163f69,_0x57067c[_0xa6f9('0x3f')]);return db['FaxApplication']['find'](_0x163f69)[_0xa6f9('0x25')](handleEntityNotFound(_0x86b155,null))['then'](respondWithResult(_0x86b155,null))[_0xa6f9('0x43')](handleError(_0x86b155,null));};exports['create']=function(_0xfff64a,_0x559bf9){return db[_0xa6f9('0x2c')][_0xa6f9('0x48')](_0xfff64a[_0xa6f9('0x49')],{})[_0xa6f9('0x25')](respondWithResult(_0x559bf9,0xc9))[_0xa6f9('0x43')](handleError(_0x559bf9,null));};exports[_0xa6f9('0x24')]=function(_0x249cf1,_0x2fa853){if(_0x249cf1[_0xa6f9('0x49')]['id']){delete _0x249cf1[_0xa6f9('0x49')]['id'];}return db['FaxApplication'][_0xa6f9('0x4a')]({'where':{'id':_0x249cf1['params']['id']}})[_0xa6f9('0x25')](handleEntityNotFound(_0x2fa853,null))[_0xa6f9('0x25')](saveUpdates(_0x249cf1[_0xa6f9('0x49')],null))[_0xa6f9('0x25')](respondWithResult(_0x2fa853,null))['catch'](handleError(_0x2fa853,null));};exports[_0xa6f9('0x4b')]=function(_0x1a277a,_0x32e7ec){return db[_0xa6f9('0x2c')][_0xa6f9('0x4a')]({'where':{'id':_0x1a277a[_0xa6f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x32e7ec,null))[_0xa6f9('0x25')](removeEntity(_0x32e7ec,null))[_0xa6f9('0x43')](handleError(_0x32e7ec,null));}; \ No newline at end of file +var _0x53e2=['set','reject','save','update','then','error','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','VIRTUAL','filter','options','include','FaxApplication','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x4dcbec,_0x588b0a){var _0x498a21=function(_0x31edd8){while(--_0x31edd8){_0x4dcbec['push'](_0x4dcbec['shift']());}};_0x498a21(++_0x588b0a);}(_0x53e2,0xc3));var _0x253e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53e2[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x253e('0x0'));var zipdir=require(_0x253e('0x1'));var jsonpatch=require(_0x253e('0x2'));var rp=require(_0x253e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x253e('0x4'));var util=require(_0x253e('0x5'));var path=require('path');var sox=require(_0x253e('0x6'));var csv=require(_0x253e('0x7'));var ejs=require(_0x253e('0x8'));var fs=require('fs');var fs_extra=require(_0x253e('0x9'));var _=require('lodash');var squel=require(_0x253e('0xa'));var crypto=require(_0x253e('0xb'));var jsforce=require(_0x253e('0xc'));var deskjs=require(_0x253e('0xd'));var toCsv=require(_0x253e('0x7'));var querystring=require(_0x253e('0xe'));var Papa=require(_0x253e('0xf'));var Redis=require(_0x253e('0x10'));var authService=require(_0x253e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x253e('0x12'));var hardwareService=require(_0x253e('0x13'));var logger=require(_0x253e('0x14'))(_0x253e('0x15'));var utils=require(_0x253e('0x16'));var config=require(_0x253e('0x17'));var licenseUtil=require(_0x253e('0x18'));var db=require(_0x253e('0x19'))['db'];function respondWithStatusCode(_0x11242d,_0x32db49){_0x32db49=_0x32db49||0xcc;return function(_0x12f5dc){if(_0x12f5dc){return _0x11242d[_0x253e('0x1a')](_0x32db49);}return _0x11242d[_0x253e('0x1b')](_0x32db49)[_0x253e('0x1c')]();};}function respondWithResult(_0x56ae16,_0x194a81){_0x194a81=_0x194a81||0xc8;return function(_0x53a315){if(_0x53a315){return _0x56ae16['status'](_0x194a81)[_0x253e('0x1d')](_0x53a315);}};}function respondWithFilteredResult(_0x5500b1,_0x514f10){return function(_0x30fcab){if(_0x30fcab){var _0x4845a6=typeof _0x514f10[_0x253e('0x1e')]===_0x253e('0x1f')&&typeof _0x514f10['limit']===_0x253e('0x1f');var _0x193bb9=_0x30fcab['count'];var _0x40f1ec=_0x4845a6?0x0:_0x514f10[_0x253e('0x1e')];var _0x53aef9=_0x4845a6?_0x30fcab[_0x253e('0x20')]:_0x514f10[_0x253e('0x1e')]+_0x514f10['limit'];var _0x548b69;if(_0x53aef9>=_0x193bb9){_0x53aef9=_0x193bb9;_0x548b69=0xc8;}else{_0x548b69=0xce;}_0x5500b1[_0x253e('0x1b')](_0x548b69);return _0x5500b1[_0x253e('0x21')]('Content-Range',_0x40f1ec+'-'+_0x53aef9+'/'+_0x193bb9)['json'](_0x30fcab);}return null;};}function patchUpdates(_0x3965ff){return function(_0x49ad09){try{jsonpatch['apply'](_0x49ad09,_0x3965ff,!![]);}catch(_0x129b67){return BPromise[_0x253e('0x22')](_0x129b67);}return _0x49ad09[_0x253e('0x23')]();};}function saveUpdates(_0x5a4182,_0x3f48bd){return function(_0x1d5571){if(_0x1d5571){return _0x1d5571[_0x253e('0x24')](_0x5a4182)[_0x253e('0x25')](function(_0x2a42a8){return _0x2a42a8;});}return null;};}function removeEntity(_0x2c0063,_0x55a1a8){return function(_0x2a4cf9){if(_0x2a4cf9){return _0x2a4cf9['destroy']()[_0x253e('0x25')](function(){_0x2c0063['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x272e6c,_0x55f303){return function(_0x11567f){if(!_0x11567f){_0x272e6c[_0x253e('0x1a')](0x194);}return _0x11567f;};}function handleError(_0x3735e6,_0x56bd8e){_0x56bd8e=_0x56bd8e||0x1f4;return function(_0x204a64){logger[_0x253e('0x26')](_0x204a64[_0x253e('0x27')]);if(_0x204a64[_0x253e('0x28')]){delete _0x204a64['name'];}_0x3735e6[_0x253e('0x1b')](_0x56bd8e)['send'](_0x204a64);};}exports['index']=function(_0x2ad169,_0x254431){var _0x5c7996={},_0x488df9={},_0x1177ef={'count':0x0,'rows':[]};var _0x3603fa=_[_0x253e('0x29')](db['FaxApplication']['rawAttributes'],function(_0x2c7d13){return{'name':_0x2c7d13[_0x253e('0x2a')],'type':_0x2c7d13[_0x253e('0x2b')][_0x253e('0x2c')]};});_0x488df9[_0x253e('0x2d')]=_[_0x253e('0x29')](_0x3603fa,'name');_0x488df9[_0x253e('0x2e')]=_[_0x253e('0x2f')](_0x2ad169[_0x253e('0x2e')]);_0x488df9[_0x253e('0x30')]=_[_0x253e('0x31')](_0x488df9[_0x253e('0x2d')],_0x488df9['query']);_0x5c7996['attributes']=_[_0x253e('0x31')](_0x488df9['model'],qs[_0x253e('0x32')](_0x2ad169[_0x253e('0x2e')][_0x253e('0x32')]));_0x5c7996[_0x253e('0x33')]=_0x5c7996[_0x253e('0x33')][_0x253e('0x34')]?_0x5c7996[_0x253e('0x33')]:_0x488df9[_0x253e('0x2d')];if(!_0x2ad169[_0x253e('0x2e')][_0x253e('0x35')](_0x253e('0x36'))){_0x5c7996[_0x253e('0x37')]=qs[_0x253e('0x37')](_0x2ad169[_0x253e('0x2e')][_0x253e('0x37')]);_0x5c7996[_0x253e('0x1e')]=qs[_0x253e('0x1e')](_0x2ad169['query'][_0x253e('0x1e')]);}_0x5c7996['order']=qs[_0x253e('0x38')](_0x2ad169[_0x253e('0x2e')][_0x253e('0x38')]);_0x5c7996['where']=qs[_0x253e('0x30')](_[_0x253e('0x39')](_0x2ad169['query'],_0x488df9['filters']),_0x3603fa);if(_0x2ad169[_0x253e('0x2e')]['filter']){_0x5c7996['where']=_[_0x253e('0x3a')](_0x5c7996[_0x253e('0x3b')],{'$or':_[_0x253e('0x29')](_0x3603fa,function(_0x3031bd){if(_0x3031bd[_0x253e('0x2b')]!==_0x253e('0x3c')){var _0x3434e8={};_0x3434e8[_0x3031bd[_0x253e('0x28')]]={'$like':'%'+_0x2ad169[_0x253e('0x2e')][_0x253e('0x3d')]+'%'};return _0x3434e8;}})});}_0x5c7996=_['merge']({},_0x5c7996,_0x2ad169[_0x253e('0x3e')]);var _0x355859={'where':_0x5c7996['where']};return db['FaxApplication']['count'](_0x355859)['then'](function(_0x2a9550){_0x1177ef[_0x253e('0x20')]=_0x2a9550;if(_0x2ad169[_0x253e('0x2e')]['includeAll']){_0x5c7996[_0x253e('0x3f')]=[{'all':!![]}];}return db[_0x253e('0x40')][_0x253e('0x41')](_0x5c7996);})[_0x253e('0x25')](function(_0x5e6482){_0x1177ef[_0x253e('0x42')]=_0x5e6482;return _0x1177ef;})[_0x253e('0x25')](respondWithFilteredResult(_0x254431,_0x5c7996))[_0x253e('0x43')](handleError(_0x254431,null));};exports[_0x253e('0x44')]=function(_0x252dfe,_0x2b3438){var _0x28bf19={'raw':!![],'where':{'id':_0x252dfe[_0x253e('0x45')]['id']}},_0x525b8f={};_0x525b8f[_0x253e('0x2d')]=_['keys'](db[_0x253e('0x40')][_0x253e('0x46')]);_0x525b8f[_0x253e('0x2e')]=_[_0x253e('0x2f')](_0x252dfe[_0x253e('0x2e')]);_0x525b8f[_0x253e('0x30')]=_['intersection'](_0x525b8f[_0x253e('0x2d')],_0x525b8f[_0x253e('0x2e')]);_0x28bf19[_0x253e('0x33')]=_[_0x253e('0x31')](_0x525b8f['model'],qs[_0x253e('0x32')](_0x252dfe[_0x253e('0x2e')][_0x253e('0x32')]));_0x28bf19[_0x253e('0x33')]=_0x28bf19[_0x253e('0x33')]['length']?_0x28bf19[_0x253e('0x33')]:_0x525b8f[_0x253e('0x2d')];if(_0x252dfe['query'][_0x253e('0x47')]){_0x28bf19[_0x253e('0x3f')]=[{'all':!![]}];}_0x28bf19=_[_0x253e('0x3a')]({},_0x28bf19,_0x252dfe['options']);return db[_0x253e('0x40')][_0x253e('0x48')](_0x28bf19)[_0x253e('0x25')](handleEntityNotFound(_0x2b3438,null))[_0x253e('0x25')](respondWithResult(_0x2b3438,null))['catch'](handleError(_0x2b3438,null));};exports[_0x253e('0x49')]=function(_0x448215,_0xaae06c){return db[_0x253e('0x40')][_0x253e('0x49')](_0x448215[_0x253e('0x4a')],{})['then'](respondWithResult(_0xaae06c,0xc9))[_0x253e('0x43')](handleError(_0xaae06c,null));};exports[_0x253e('0x24')]=function(_0x2efead,_0x1f9fda){if(_0x2efead[_0x253e('0x4a')]['id']){delete _0x2efead[_0x253e('0x4a')]['id'];}return db[_0x253e('0x40')]['find']({'where':{'id':_0x2efead[_0x253e('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f9fda,null))[_0x253e('0x25')](saveUpdates(_0x2efead[_0x253e('0x4a')],null))[_0x253e('0x25')](respondWithResult(_0x1f9fda,null))[_0x253e('0x43')](handleError(_0x1f9fda,null));};exports[_0x253e('0x4b')]=function(_0x19f6dc,_0x54e9d2){return db[_0x253e('0x40')][_0x253e('0x48')]({'where':{'id':_0x19f6dc[_0x253e('0x45')]['id']}})[_0x253e('0x25')](handleEntityNotFound(_0x54e9d2,null))[_0x253e('0x25')](removeEntity(_0x54e9d2,null))[_0x253e('0x43')](handleError(_0x54e9d2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f347648..437b8ab 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 _0x6e19=['request-promise','path','rimraf','../../config/environment','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x6e19,0x113));var _0x96e1=function(_0x27cd66,_0x3a06fe){_0x27cd66=_0x27cd66-0x0;var _0x3abaf8=_0x6e19[_0x27cd66];return _0x3abaf8;};'use strict';var _=require(_0x96e1('0x0'));var util=require(_0x96e1('0x1'));var logger=require(_0x96e1('0x2'))('api');var moment=require(_0x96e1('0x3'));var BPromise=require(_0x96e1('0x4'));var rp=require(_0x96e1('0x5'));var fs=require('fs');var path=require(_0x96e1('0x6'));var rimraf=require(_0x96e1('0x7'));var config=require(_0x96e1('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x26edb9,_0x36934b){return _0x26edb9[_0x96e1('0x9')](_0x96e1('0xa'),attributes,{'tableName':_0x96e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96e1('0xc'),'collate':_0x96e1('0xd')});}; \ No newline at end of file +var _0x73f8=['lodash','api','moment','bluebird','request-promise','../../config/environment','./faxApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x73f8,0x1f4));var _0x873f=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x73f8[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x873f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x873f('0x1'));var moment=require(_0x873f('0x2'));var BPromise=require(_0x873f('0x3'));var rp=require(_0x873f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x873f('0x5'));var attributes=require(_0x873f('0x6'));module[_0x873f('0x7')]=function(_0x2b91b1,_0x323556){return _0x2b91b1['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x873f('0x8'),'collate':_0x873f('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index bedcf19..76de80c 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 _0x0799=['options','raw','where','limit','stringify','lodash','util','randomstring','rpc','../../config/environment','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','error','message','catch','UpdateFaxApplication','FaxApplication','update','body'];(function(_0x2fcaf6,_0x7b655b){var _0x31b92b=function(_0x2a8b6d){while(--_0x2a8b6d){_0x2fcaf6['push'](_0x2fcaf6['shift']());}};_0x31b92b(++_0x7b655b);}(_0x0799,0x125));var _0x9079=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x0799[_0x1a1b6e];return _0x571e2c;};'use strict';var _=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9079('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9079('0x3'));var config=require(_0x9079('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9079('0x5')][_0x9079('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x490300,_0x220110,_0x2720d1){return new BPromise(function(_0x57d3ff,_0x2fd163){return client[_0x9079('0x7')](_0x490300,_0x2720d1)[_0x9079('0x8')](function(_0x3dd8c8){logger[_0x9079('0x9')](_0x9079('0xa'),_0x220110,'request\x20sent');logger[_0x9079('0xb')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x220110,'request\x20sent',JSON['stringify'](_0x3dd8c8));if(_0x3dd8c8[_0x9079('0xc')]){if(_0x3dd8c8[_0x9079('0xc')]['code']===0x1f4){logger[_0x9079('0xc')]('FaxApplication,\x20%s,\x20%s',_0x220110,_0x3dd8c8[_0x9079('0xc')]['message']);return _0x2fd163(_0x3dd8c8[_0x9079('0xc')][_0x9079('0xd')]);}logger[_0x9079('0xc')]('FaxApplication,\x20%s,\x20%s',_0x220110,_0x3dd8c8[_0x9079('0xc')][_0x9079('0xd')]);return _0x57d3ff(_0x3dd8c8[_0x9079('0xc')][_0x9079('0xd')]);}else{logger[_0x9079('0x9')](_0x9079('0xa'),_0x220110,'request\x20sent');_0x57d3ff(_0x3dd8c8['result'][_0x9079('0xd')]);}})[_0x9079('0xe')](function(_0x584f76){logger[_0x9079('0xc')](_0x9079('0xa'),_0x220110,_0x584f76);_0x2fd163(_0x584f76);});});}exports[_0x9079('0xf')]=function(_0x148676){var _0x3223df=this;return new Promise(function(_0x2a54c8,_0x267278){return db[_0x9079('0x10')][_0x9079('0x11')](_0x148676[_0x9079('0x12')],{'raw':_0x148676['options']?_0x148676[_0x9079('0x13')][_0x9079('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x148676['options']?_0x148676['options'][_0x9079('0x15')]||null:null,'attributes':_0x148676[_0x9079('0x13')]?_0x148676['options']['attributes']||null:null,'limit':_0x148676[_0x9079('0x13')]?_0x148676['options'][_0x9079('0x16')]||null:null})[_0x9079('0x8')](function(_0x37c3e6){logger['info'](_0x9079('0xf'),_0x148676);logger['debug'](_0x9079('0xf'),_0x148676,JSON[_0x9079('0x17')](_0x37c3e6));_0x2a54c8(_0x37c3e6);})[_0x9079('0xe')](function(_0x43bff6){logger[_0x9079('0xc')](_0x9079('0xf'),_0x43bff6[_0x9079('0xd')],_0x148676);_0x267278(_0x3223df[_0x9079('0xc')](0x1f4,_0x43bff6[_0x9079('0xd')]));});});}; \ No newline at end of file +var _0x6b4e=['request','then','info','request\x20sent','debug','error','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','body','options','raw','where','attributes','limit','stringify','UpdateFaxApplication','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x243261,_0x5bdda8){_0x243261=_0x243261-0x0;var _0x1791a6=_0x6b4e[_0x243261];return _0x1791a6;};'use strict';var _=require('lodash');var util=require(_0xe6b4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6b4('0x1'))['db'];var utils=require(_0xe6b4('0x2'));var logger=require(_0xe6b4('0x3'))(_0xe6b4('0x4'));var config=require(_0xe6b4('0x5'));var jayson=require(_0xe6b4('0x6'));var client=jayson['client'][_0xe6b4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3458d8,_0x3391b9,_0x1d062b){return new BPromise(function(_0x15cf31,_0x3e5506){return client[_0xe6b4('0x8')](_0x3458d8,_0x1d062b)[_0xe6b4('0x9')](function(_0x461f53){logger[_0xe6b4('0xa')]('FaxApplication,\x20%s,\x20%s',_0x3391b9,_0xe6b4('0xb'));logger[_0xe6b4('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3391b9,'request\x20sent',JSON['stringify'](_0x461f53));if(_0x461f53[_0xe6b4('0xd')]){if(_0x461f53[_0xe6b4('0xd')]['code']===0x1f4){logger[_0xe6b4('0xd')](_0xe6b4('0xe'),_0x3391b9,_0x461f53[_0xe6b4('0xd')][_0xe6b4('0xf')]);return _0x3e5506(_0x461f53[_0xe6b4('0xd')]['message']);}logger[_0xe6b4('0xd')](_0xe6b4('0xe'),_0x3391b9,_0x461f53[_0xe6b4('0xd')][_0xe6b4('0xf')]);return _0x15cf31(_0x461f53['error'][_0xe6b4('0xf')]);}else{logger[_0xe6b4('0xa')](_0xe6b4('0xe'),_0x3391b9,_0xe6b4('0xb'));_0x15cf31(_0x461f53[_0xe6b4('0x10')]['message']);}})[_0xe6b4('0x11')](function(_0x2c9335){logger[_0xe6b4('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3391b9,_0x2c9335);_0x3e5506(_0x2c9335);});});}exports['UpdateFaxApplication']=function(_0x5e77f2){var _0x3b5ce6=this;return new Promise(function(_0x5877c1,_0x529858){return db[_0xe6b4('0x12')]['update'](_0x5e77f2[_0xe6b4('0x13')],{'raw':_0x5e77f2[_0xe6b4('0x14')]?_0x5e77f2[_0xe6b4('0x14')][_0xe6b4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e77f2[_0xe6b4('0x14')]?_0x5e77f2[_0xe6b4('0x14')][_0xe6b4('0x16')]||null:null,'attributes':_0x5e77f2[_0xe6b4('0x14')]?_0x5e77f2['options'][_0xe6b4('0x17')]||null:null,'limit':_0x5e77f2['options']?_0x5e77f2[_0xe6b4('0x14')][_0xe6b4('0x18')]||null:null})[_0xe6b4('0x9')](function(_0x32ee76){logger[_0xe6b4('0xa')]('UpdateFaxApplication',_0x5e77f2);logger['debug']('UpdateFaxApplication',_0x5e77f2,JSON[_0xe6b4('0x19')](_0x32ee76));_0x5877c1(_0x32ee76);})['catch'](function(_0x3fca0a){logger[_0xe6b4('0xd')](_0xe6b4('0x1a'),_0x3fca0a[_0xe6b4('0xf')],_0x5e77f2);_0x529858(_0x3b5ce6['error'](0x1f4,_0x3fca0a[_0xe6b4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c7f6247..06c2324 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 _0x0972=['isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0xf23cb6,_0x5c51bd){var _0x430e22=function(_0x57cf6e){while(--_0x57cf6e){_0xf23cb6['push'](_0xf23cb6['shift']());}};_0x430e22(++_0x5c51bd);}(_0x0972,0x64));var _0x2097=function(_0x2ed2c5,_0x15d9ff){_0x2ed2c5=_0x2ed2c5-0x0;var _0xf2915a=_0x0972[_0x2ed2c5];return _0xf2915a;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/:id',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0xb')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0xc')]);router['put'](_0x2097('0xd'),auth[_0x2097('0x8')](),controller[_0x2097('0xe')]);router[_0x2097('0xf')](_0x2097('0xd'),auth[_0x2097('0x8')](),controller[_0x2097('0x10')]);module[_0x2097('0x11')]=router; \ No newline at end of file +var _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xed09d9,_0x193b6f){var _0x492860=function(_0x1b01f1){while(--_0x1b01f1){_0xed09d9['push'](_0xed09d9['shift']());}};_0x492860(++_0x193b6f);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b5e8486..4a1a9bd 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 _0xeef1=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x3903ef,_0x54a365){var _0x1c7a6c=function(_0x5277ba){while(--_0x5277ba){_0x3903ef['push'](_0x3903ef['shift']());}};_0x1c7a6c(++_0x54a365);}(_0xeef1,0x15c));var _0x1eef=function(_0x42f4d6,_0xfb09fa){_0x42f4d6=_0x42f4d6-0x0;var _0x1718db=_0xeef1[_0x42f4d6];return _0x1718db;};'use strict';var Sequelize=require(_0x1eef('0x0'));module[_0x1eef('0x1')]={'closed':{'type':Sequelize[_0x1eef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1eef('0x3')]},'disposition':{'type':Sequelize[_0x1eef('0x4')]},'secondDisposition':{'type':Sequelize[_0x1eef('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1eef('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1eef('0x3')]},'fax':{'type':Sequelize[_0x1eef('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1eef('0x5')]('in',_0x1eef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1eef('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1eef('0x5')]('in',_0x1eef('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb238=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x14f2ce,_0x22f9c0){var _0x58db9f=function(_0x2f65f3){while(--_0x2f65f3){_0x14f2ce['push'](_0x14f2ce['shift']());}};_0x58db9f(++_0x22f9c0);}(_0xb238,0x1af));var _0x8b23=function(_0x26c279,_0x1ce9b8){_0x26c279=_0x26c279-0x0;var _0x196f8b=_0xb238[_0x26c279];return _0x196f8b;};'use strict';var Sequelize=require(_0x8b23('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8b23('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8b23('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8b23('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8b23('0x3')]},'note':{'type':Sequelize[_0x8b23('0x3')]},'read1stAt':{'type':Sequelize[_0x8b23('0x2')]},'fax':{'type':Sequelize[_0x8b23('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8b23('0x4')]('in',_0x8b23('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8b23('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8b23('0x4')]('in',_0x8b23('0x5')),'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 8fd2d0c..90bdae8 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 _0x8e20=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','UserId','closed','index','FaxInteraction','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','length','conditions','value','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','buildExpression','some','compact','isEmpty','FaxAccountId','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','having','tag','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','merge','a.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','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','catch','show','rawAttributes','includeAll','include','options','create','body','describe','FaxMessage','params','addMessage','omit','ids','getMessages','FaxInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x190d40,_0x32721f){var _0x207219=function(_0x2df08b){while(--_0x2df08b){_0x190d40['push'](_0x190d40['shift']());}};_0x207219(++_0x32721f);}(_0x8e20,0x1af));var _0x08e2=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x8e20[_0x1acc2d];return _0xabfa6d;};'use strict';var emlformat=require(_0x08e2('0x0'));var rimraf=require(_0x08e2('0x1'));var zipdir=require(_0x08e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08e2('0x3'));var moment=require(_0x08e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x08e2('0x5'));var util=require(_0x08e2('0x6'));var path=require(_0x08e2('0x7'));var sox=require(_0x08e2('0x8'));var csv=require(_0x08e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08e2('0xa'));var _=require(_0x08e2('0xb'));var squel=require('squel');var crypto=require(_0x08e2('0xc'));var jsforce=require(_0x08e2('0xd'));var deskjs=require(_0x08e2('0xe'));var toCsv=require(_0x08e2('0x9'));var querystring=require(_0x08e2('0xf'));var Papa=require(_0x08e2('0x10'));var Redis=require('ioredis');var authService=require(_0x08e2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08e2('0x12'));var logger=require(_0x08e2('0x13'))(_0x08e2('0x14'));var utils=require(_0x08e2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x08e2('0x16'))['db'];config['redis']=_['defaults'](config[_0x08e2('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x08e2('0x18'))(new Redis(config['redis']));require(_0x08e2('0x19'))['register'](socket);function respondWithStatusCode(_0x53a428,_0x4f0f35){_0x4f0f35=_0x4f0f35||0xcc;return function(_0x321f5c){if(_0x321f5c){return _0x53a428[_0x08e2('0x1a')](_0x4f0f35);}return _0x53a428[_0x08e2('0x1b')](_0x4f0f35)['end']();};}function respondWithResult(_0x549025,_0x58996d){_0x58996d=_0x58996d||0xc8;return function(_0x5794c9){if(_0x5794c9){return _0x549025['status'](_0x58996d)['json'](_0x5794c9);}};}function respondWithFilteredResult(_0x38a080,_0x67d949){return function(_0x300934){if(_0x300934){var _0x90db85=typeof _0x67d949[_0x08e2('0x1c')]===_0x08e2('0x1d')&&typeof _0x67d949[_0x08e2('0x1e')]===_0x08e2('0x1d');var _0x2a1c80=_0x300934[_0x08e2('0x1f')];var _0x2384a3=_0x90db85?0x0:_0x67d949['offset'];var _0x5e3cba=_0x90db85?_0x300934['count']:_0x67d949[_0x08e2('0x1c')]+_0x67d949[_0x08e2('0x1e')];var _0x59b200;if(_0x5e3cba>=_0x2a1c80){_0x5e3cba=_0x2a1c80;_0x59b200=0xc8;}else{_0x59b200=0xce;}_0x38a080[_0x08e2('0x1b')](_0x59b200);return _0x38a080['set'](_0x08e2('0x20'),_0x2384a3+'-'+_0x5e3cba+'/'+_0x2a1c80)['json'](_0x300934);}return null;};}function patchUpdates(_0x416e6c){return function(_0x3eab11){try{jsonpatch[_0x08e2('0x21')](_0x3eab11,_0x416e6c,!![]);}catch(_0x3dbd7e){return BPromise[_0x08e2('0x22')](_0x3dbd7e);}return _0x3eab11['save']();};}function saveUpdates(_0x5878a9,_0x5a16ff){return function(_0x24cbc1){if(_0x24cbc1){return _0x24cbc1[_0x08e2('0x23')](_0x5878a9)[_0x08e2('0x24')](function(_0x1ef5ef){return _0x1ef5ef;});}return null;};}function removeEntity(_0x155bea,_0x4dbf2c){return function(_0x4a8102){if(_0x4a8102){return _0x4a8102[_0x08e2('0x25')]()[_0x08e2('0x24')](function(){_0x155bea[_0x08e2('0x1b')](0xcc)[_0x08e2('0x26')]();});}};}function handleEntityNotFound(_0x4d1b29,_0x107ab9){return function(_0x493fad){if(!_0x493fad){_0x4d1b29[_0x08e2('0x1a')](0x194);}return _0x493fad;};}function handleError(_0x8b977,_0x1160b9){_0x1160b9=_0x1160b9||0x1f4;return function(_0x5cdfb2){logger[_0x08e2('0x27')](_0x5cdfb2[_0x08e2('0x28')]);if(_0x5cdfb2[_0x08e2('0x29')]){delete _0x5cdfb2[_0x08e2('0x29')];}_0x8b977['status'](_0x1160b9)[_0x08e2('0x2a')](_0x5cdfb2);};}function getInteractionUsers(_0x245721,_0x30c12b){return new BPromise(function(_0x37d416,_0x4ad0f9){try{if(_0x30c12b[_0x245721['id']]){_0x245721[_0x08e2('0x2b')]=_[_0x08e2('0x2c')](_0x30c12b[_0x245721['id']],function(_0x4b2439){return{'id':_0x4b2439['id'],'fullname':_0x4b2439[_0x08e2('0x2d')]};});}}catch(_0x48b170){_0x4ad0f9(_0x48b170);}_0x37d416(_0x245721);});}function getInteractionTags(_0x492e6b,_0x102b2e){return new BPromise(function(_0x177c98,_0x6fbb42){try{if(_0x492e6b[_0x08e2('0x2e')]){_0x492e6b[_0x08e2('0x2f')]=[];_0x492e6b['TagIds'][_0x08e2('0x30')](',')[_0x08e2('0x31')](function(_0x50a318){_0x492e6b[_0x08e2('0x2f')][_0x08e2('0x32')](_0x102b2e[_0x50a318]);});}delete _0x492e6b['TagIds'];}catch(_0x4398e5){_0x6fbb42(_0x4398e5);}_0x177c98(_0x492e6b);});}function updateFaxInteraction(_0x22b031,_0x51a2a4,_0x144a20){return new BPromise(function(_0x3777dc,_0x157972){return getInteractionUsers(_0x22b031,_0x144a20)[_0x08e2('0x24')](function(_0x35f316){return getInteractionTags(_0x35f316,_0x51a2a4);})['then'](function(_0xaf44c5){return getStateInteraction(_0xaf44c5);})[_0x08e2('0x24')](function(_0x1ac750){_0x3777dc(_0x1ac750);})['catch'](function(_0x24d129){_0x157972(_0x24d129);});});}function getStateInteraction(_0xd5cd85){return new BPromise(function(_0x1c2bf8){_0xd5cd85[_0x08e2('0x33')]=0x0;_0xd5cd85[_0x08e2('0x34')]=0x0;_0xd5cd85[_0x08e2('0x35')]=0x0;_0xd5cd85[_0x08e2('0x36')]=0x0;_0xd5cd85['total']=0x0;if(!_0xd5cd85['closed']&&!_0xd5cd85[_0x08e2('0x37')]){_0xd5cd85[_0x08e2('0x33')]+=0x1;}if(!_0xd5cd85[_0x08e2('0x38')]&&_0xd5cd85[_0x08e2('0x37')]){_0xd5cd85[_0x08e2('0x34')]+=0x1;if(_0xd5cd85[_0x08e2('0x33')]){_0xd5cd85[_0x08e2('0x33')]-=0x1;}}if(_0xd5cd85['closed']&&_0xd5cd85['UserId']){_0xd5cd85[_0x08e2('0x35')]+=0x1;if(_0xd5cd85['talking']){_0xd5cd85[_0x08e2('0x34')]-=0x1;}}if(_0xd5cd85[_0x08e2('0x38')]&&!_0xd5cd85[_0x08e2('0x37')]){_0xd5cd85[_0x08e2('0x36')]+=0x1;if(_0xd5cd85[_0x08e2('0x33')]){_0xd5cd85[_0x08e2('0x33')]-=0x1;}}_0xd5cd85['total']+=0x1;_0x1c2bf8(_0xd5cd85);});}exports[_0x08e2('0x39')]=function(_0x2d338d,_0xd014fc){var _0x55dbb2={},_0x2bf8e0={},_0x5b07c3={'count':0x0,'rows':[]};var _0xb24deb=_[_0x08e2('0x2c')](db[_0x08e2('0x3a')]['rawAttributes'],function(_0x1e649b){return{'name':_0x1e649b['fieldName'],'type':_0x1e649b[_0x08e2('0x3b')][_0x08e2('0x3c')]};});_0x2bf8e0['model']=_[_0x08e2('0x2c')](_0xb24deb,_0x08e2('0x29'));_0x2bf8e0[_0x08e2('0x3d')]=_[_0x08e2('0x3e')](_0x2d338d[_0x08e2('0x3d')]);_0x2bf8e0[_0x08e2('0x3f')]=_[_0x08e2('0x40')](_0x2bf8e0[_0x08e2('0x41')],_0x2bf8e0[_0x08e2('0x3d')]);_0x55dbb2[_0x08e2('0x42')]=_[_0x08e2('0x40')](_0x2bf8e0[_0x08e2('0x41')],qs[_0x08e2('0x43')](_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x43')]));_0x55dbb2[_0x08e2('0x42')]=_0x55dbb2[_0x08e2('0x42')]['length']?_0x55dbb2[_0x08e2('0x42')]:_0x2bf8e0['model'];if(!_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x44')](_0x08e2('0x45'))){_0x55dbb2[_0x08e2('0x1e')]=qs[_0x08e2('0x1e')](_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x1e')]);_0x55dbb2[_0x08e2('0x1c')]=qs['offset'](_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x1c')]);}_0x55dbb2[_0x08e2('0x46')]=qs[_0x08e2('0x47')](_0x2d338d[_0x08e2('0x3d')]['sort']);_0x55dbb2[_0x08e2('0x48')]=qs['filters'](_[_0x08e2('0x49')](_0x2d338d[_0x08e2('0x3d')],_0x2bf8e0[_0x08e2('0x3f')]),_0xb24deb);var _0x1b4118=[];var _0x3f9e3b=squel[_0x08e2('0x4a')]()[_0x08e2('0x4b')]('id')[_0x08e2('0x4b')](_0x08e2('0x29'))[_0x08e2('0x4b')](_0x08e2('0x4c'))[_0x08e2('0x4d')](_0x08e2('0x4e'));var _0x12939f=squel['select']()[_0x08e2('0x4b')](_0x08e2('0x4f'))[_0x08e2('0x4b')](_0x08e2('0x50'))[_0x08e2('0x4b')](_0x08e2('0x51'))[_0x08e2('0x4d')](_0x08e2('0x52'),'ui')[_0x08e2('0x53')](_0x08e2('0x54'),'u',_0x08e2('0x55'));var _0x3f1a98=squel[_0x08e2('0x4a')]()['from'](_0x08e2('0x56'),'i')['left_join'](_0x08e2('0x57'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x08e2('0x53')](_0x08e2('0x54'),'o',_0x08e2('0x58'))['left_join'](_0x08e2('0x59'),'a',_0x08e2('0x5a'))['left_join'](_0x08e2('0x5b'),'me',_0x08e2('0x5c'))[_0x08e2('0x53')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x08e2('0x53')](_0x08e2('0x4e'),'t',_0x08e2('0x5d'));var _0x1066a7=squel[_0x08e2('0x5e')]();var _0x1207f9=[];var _0x3a1ab7=squel['expr']();var _0xacc6a1;if(_0x2d338d[_0x08e2('0x3d')]['search']){_0xacc6a1=as[_0x08e2('0x5f')](_0x2d338d[_0x08e2('0x3d')]['search']);var _0x48c4f7=_0xacc6a1[_0x08e2('0x60')];for(var _0x21f244=0x0;_0x21f244<_0xacc6a1['conditions'][_0x08e2('0x61')];_0x21f244++){var _0x21ba38=_0xacc6a1[_0x08e2('0x62')][_0x21f244];var _0x4e9f74='i';var _0x3cb4aa=_['find'](_0xb24deb,[_0x08e2('0x29'),_0x21ba38[_0x08e2('0x4b')]]);if(!_0x3cb4aa){switch(_0x21ba38['field']){case'unreadMessages':if(_0x21ba38[_0x08e2('0x63')]==0x1){_0x3f1a98['having']('`'+_0x21ba38[_0x08e2('0x4b')]+_0x08e2('0x64'));}else{_0x3f1a98['having']('`'+_0x21ba38[_0x08e2('0x4b')]+_0x08e2('0x65'));}break;case'Contact':if(_0x21ba38[_0x08e2('0x66')]===_0x08e2('0x67')){if(_0x21ba38['value'][_0x08e2('0x30')]('\x20')[_0x08e2('0x61')]>0x1){_0x1066a7[_0x48c4f7](_0x08e2('0x68'),qs[_0x08e2('0x69')](_0x21ba38[_0x08e2('0x63')]),null);}else{var _0x3bf099='%'+_0x21ba38[_0x08e2('0x63')]+'%';_0x1066a7[_0x48c4f7](_0x08e2('0x6a'),_0x3bf099,_0x3bf099,_0x3bf099);}}else{_0x3cb4aa=_[_0x08e2('0x6b')](_0xb24deb,[_0x08e2('0x29'),_0x08e2('0x6c')]);_0x21ba38[_0x08e2('0x4b')]=_0x08e2('0x6c');_0x5506c7=as['buildExpression'](_0x4e9f74,_0x3cb4aa[_0x08e2('0x3b')],_0x21ba38);_0x1066a7[_0x48c4f7](_0x5506c7[_0x08e2('0x6d')],_0x5506c7[_0x08e2('0x63')]['start'],_0x5506c7[_0x08e2('0x63')][_0x08e2('0x26')]);}break;case _0x08e2('0x6e'):var _0x31b8f4=_0x21ba38[_0x08e2('0x63')][_0x08e2('0x30')](',')[_0x08e2('0x2c')](function(_0x320309){return Number(_0x320309);});_0x31b8f4[_0x08e2('0x31')](function(_0x140dcd){_0x3a1ab7['or'](_0x08e2('0x6f'),'%,'+_0x140dcd+',%');});_0x1207f9=_[_0x08e2('0x70')](_0x1207f9,_0x31b8f4);break;case _0x08e2('0x71'):if(_0x21ba38['operator']===_0x08e2('0x67')){_0x1066a7[_0x48c4f7](_0x08e2('0x72'),'%'+_0x21ba38[_0x08e2('0x63')]+'%',null);}else{_0x3cb4aa=_['find'](_0xb24deb,['name','UserId']);_0x21ba38[_0x08e2('0x4b')]='UserId';_0x5506c7=as['buildExpression'](_0x4e9f74,_0x3cb4aa[_0x08e2('0x3b')],_0x21ba38);_0x1066a7[_0x48c4f7](_0x5506c7[_0x08e2('0x6d')],_0x5506c7[_0x08e2('0x63')][_0x08e2('0x73')],_0x5506c7[_0x08e2('0x63')][_0x08e2('0x26')]);}break;case'body':_0x5506c7=as['buildExpression']('me',null,_0x21ba38);_0x1066a7[_0x48c4f7](_0x5506c7[_0x08e2('0x6d')],_0x5506c7[_0x08e2('0x63')][_0x08e2('0x73')],_0x5506c7['value'][_0x08e2('0x26')]);break;}}else{var _0x5506c7=as[_0x08e2('0x74')](_0x4e9f74,_0x3cb4aa[_0x08e2('0x3b')],_0x21ba38);_0x1066a7[_0x48c4f7](_0x5506c7[_0x08e2('0x6d')],_0x5506c7['value'][_0x08e2('0x73')],_0x5506c7[_0x08e2('0x63')]['end']);}}}else{var _0xdc6d00=_(_0x2d338d[_0x08e2('0x3d')])[_0x08e2('0x3e')]()[_0x08e2('0x2c')](function(_0x404e3d){return _[_0x08e2('0x75')](_0xb24deb,[_0x08e2('0x29'),_0x404e3d])?_0x404e3d:undefined;})[_0x08e2('0x76')]()[_0x08e2('0x63')]();if(!_[_0x08e2('0x77')](_0xdc6d00)){_0xdc6d00[_0x08e2('0x31')](function(_0x387ca2){if(_0x387ca2===_0x08e2('0x78')){_0x3f1a98[_0x08e2('0x48')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x2d338d[_0x08e2('0x3d')][_0x387ca2]));}else if(_0x387ca2===_0x08e2('0x79')){var _0x26176f=JSON['parse'](_0x2d338d[_0x08e2('0x3d')][_0x387ca2])[_0x08e2('0x7a')];var _0x5a540c=JSON[_0x08e2('0x7b')](_0x2d338d[_0x08e2('0x3d')][_0x387ca2])[_0x08e2('0x7c')];_0x3f1a98['where'](_0x08e2('0x7d'),_0x26176f,_0x5a540c);}else{if(_0x2d338d['query'][_0x387ca2]==='null'){_0x3f1a98[_0x08e2('0x48')]('i.'+_0x387ca2+'\x20IS\x20NULL');}else{_0x3f1a98[_0x08e2('0x48')]('i.'+_0x387ca2+_0x08e2('0x7e'),_0x2d338d['query'][_0x387ca2]);}}});}if(_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x7f')]){if(_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x7f')]==0x1){_0x3f1a98[_0x08e2('0x80')]('`unreadMessages`\x20=\x200');}else{_0x3f1a98[_0x08e2('0x80')]('`unreadMessages`\x20>\x200');}}if(_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x81')]){_0x1207f9=_['isArray'](_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x81')])?_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x81')]:new Array(_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x81')]);_0x1207f9[_0x08e2('0x31')](function(_0xa3520a){_0x3a1ab7['or'](_0x08e2('0x6f'),'%,'+_0xa3520a+',%');});}if(_0x2d338d[_0x08e2('0x3d')]['filter']){var _0x22f422=_0x2d338d[_0x08e2('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')[_0x08e2('0x82')](/'/g,'\x27\x27');if(qs[_0x08e2('0x83')](_0x22f422)){_0x1066a7['or'](_0x08e2('0x84'),_0x22f422+'%')['or']('i.fax\x20LIKE\x20?',_0x22f422+'%');}_0x1066a7['or'](_0x08e2('0x85'),_0x22f422+'%');}}_0x3f1a98[_0x08e2('0x48')](_0x1066a7);_0x3f1a98[_0x08e2('0x86')](_0x08e2('0x87'));var _0x3467c4={'type':db[_0x08e2('0x88')][_0x08e2('0x89')][_0x08e2('0x8a')],'raw':!![]};var _0x5ad557=_0x3f1a98[_0x08e2('0x8b')]();_0x5ad557[_0x08e2('0x4b')](_0x08e2('0x87'));_0x5ad557['field'](_0x08e2('0x8c'),'unreadMessages');if(_0x55dbb2[_0x08e2('0x46')]){_0x55dbb2['order'][_0x08e2('0x31')](function(_0x5ec0be){var _0x184fa3=_0x5ec0be[0x0]===_0x08e2('0x8d')?_0x5ec0be[0x0]:'i.'+_0x5ec0be[0x0];_0x3f1a98[_0x08e2('0x46')](_0x184fa3,_0x5ec0be[0x1]===_0x08e2('0x8e')?![]:!![]);});}if(!_[_0x08e2('0x77')](_0x1207f9)){_0x3f1a98[_0x08e2('0x80')](_0x3a1ab7);_0x5ad557[_0x08e2('0x48')](_0x08e2('0x8f'),_0x1207f9);}BPromise['resolve']()['then'](function(){if(!_0xacc6a1){if(_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x78')])return;_0x5ad557['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3f1a98['where'](_0x08e2('0x90'));return;}if(_0x2d338d['user'][_0x08e2('0x91')]!==_0x08e2('0x92'))return;return _0x2d338d[_0x08e2('0x93')][_0x08e2('0x94')]({'attributes':['id'],'raw':!![]})[_0x08e2('0x24')](function(_0x35666f){if(_[_0x08e2('0x77')](_0x35666f)){_0x5ad557[_0x08e2('0x48')](_0x08e2('0x95'));_0x3f1a98['where'](_0x08e2('0x95'));}else{_0x5ad557[_0x08e2('0x48')](_0x08e2('0x96'),_[_0x08e2('0x2c')](_0x35666f,'id'));_0x3f1a98['where']('i.FaxAccountId\x20IN\x20?',_[_0x08e2('0x2c')](_0x35666f,'id'));}});})['then'](function(){if(_0x2d338d[_0x08e2('0x93')][_0x08e2('0x91')]==='agent'&&!_0xacc6a1&&!_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x78')])return[];return db[_0x08e2('0x97')][_0x08e2('0x3d')](_0x5ad557[_0x08e2('0x98')](),_0x3467c4);})[_0x08e2('0x24')](function(_0x3bcd14){_0x5b07c3[_0x08e2('0x1f')]=_0x3bcd14['length'];if(_0x5b07c3[_0x08e2('0x1f')]===0x0)return[];return db[_0x08e2('0x97')][_0x08e2('0x3d')](_0x3f9e3b[_0x08e2('0x98')](),_0x3467c4)[_0x08e2('0x24')](function(_0x4f321e){_0x1b4118=_['keyBy'](_0x4f321e,'id');_0x3467c4=_[_0x08e2('0x99')](_0x3467c4,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d338d[_0x08e2('0x3d')][_0x08e2('0x43')]){_0x55dbb2[_0x08e2('0x42')][_0x08e2('0x31')](function(_0x2640d2){_0x3f1a98['field']('i.'+_0x2640d2);});}else{_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0x8c'),'unreadMessages');_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0x9a'),'Account.key');_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0x9b'),_0x08e2('0x9c'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0x9d'),'contactName');_0x3f1a98['field'](_0x08e2('0x9e'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0x9f'),_0x08e2('0xa0'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0xa1'),_0x08e2('0xa2'));_0x3f1a98['field']('c.email',_0x08e2('0xa3'));_0x3f1a98['field'](_0x08e2('0xa4'),_0x08e2('0xa5'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0xa6'),_0x08e2('0xa7'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0xa8'),_0x08e2('0xa9'));_0x3f1a98[_0x08e2('0x4b')]('o.fullname',_0x08e2('0xaa'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0xab'),_0x08e2('0xac'));_0x3f1a98[_0x08e2('0x4b')](_0x08e2('0xad'),_0x08e2('0x2e'));}if(_0x55dbb2[_0x08e2('0x1e')])_0x3f1a98['limit'](_0x55dbb2[_0x08e2('0x1e')]);if(_0x55dbb2[_0x08e2('0x1c')])_0x3f1a98['offset'](_0x55dbb2[_0x08e2('0x1c')]);return db[_0x08e2('0x97')][_0x08e2('0x3d')](_0x3f1a98[_0x08e2('0x98')](),_0x3467c4);})[_0x08e2('0x24')](function(_0x316f6e){if(_0x316f6e['length']>0x0)_0x12939f[_0x08e2('0x48')](_0x08e2('0xae'),_['map'](_0x316f6e,'id'));return db['sequelize']['query'](_0x12939f[_0x08e2('0x98')](),_0x3467c4)[_0x08e2('0x24')](function(_0x5095ca){var _0x18770e=_[_0x08e2('0xaf')](_0x5095ca,'FaxInteractionId');var _0x2a965a=[];_0x316f6e[_0x08e2('0x31')](function(_0x43967c){_0x2a965a['push'](updateFaxInteraction(_0x43967c,_0x1b4118,_0x18770e));});return BPromise[_0x08e2('0xb0')](_0x2a965a);});});})[_0x08e2('0x24')](function(_0xf5d512){_0x5b07c3[_0x08e2('0xb1')]=_0xf5d512;return _0x5b07c3;})['then'](respondWithFilteredResult(_0xd014fc,_0x55dbb2))[_0x08e2('0xb2')](handleError(_0xd014fc,null));};exports[_0x08e2('0xb3')]=function(_0x4e5454,_0x4338ec){var _0x158c28={'raw':![],'where':{'id':_0x4e5454['params']['id']}},_0xd5dc6c={};_0xd5dc6c['model']=_[_0x08e2('0x3e')](db['FaxInteraction'][_0x08e2('0xb4')]);_0xd5dc6c[_0x08e2('0x3d')]=_[_0x08e2('0x3e')](_0x4e5454['query']);_0xd5dc6c[_0x08e2('0x3f')]=_[_0x08e2('0x40')](_0xd5dc6c['model'],_0xd5dc6c[_0x08e2('0x3d')]);_0x158c28[_0x08e2('0x42')]=_['intersection'](_0xd5dc6c[_0x08e2('0x41')],qs[_0x08e2('0x43')](_0x4e5454[_0x08e2('0x3d')][_0x08e2('0x43')]));_0x158c28[_0x08e2('0x42')]=_0x158c28[_0x08e2('0x42')][_0x08e2('0x61')]?_0x158c28[_0x08e2('0x42')]:_0xd5dc6c[_0x08e2('0x41')];if(_0x4e5454[_0x08e2('0x3d')][_0x08e2('0xb5')]){_0x158c28[_0x08e2('0xb6')]=[{'all':!![]}];}_0x158c28=_[_0x08e2('0x99')]({},_0x158c28,_0x4e5454[_0x08e2('0xb7')]);return db[_0x08e2('0x3a')][_0x08e2('0x6b')](_0x158c28)['then'](handleEntityNotFound(_0x4338ec,null))[_0x08e2('0x24')](respondWithResult(_0x4338ec,null))[_0x08e2('0xb2')](handleError(_0x4338ec,null));};exports['create']=function(_0x58485f,_0x336ee4){return db['FaxInteraction'][_0x08e2('0xb8')](_0x58485f['body'],{})['then'](respondWithResult(_0x336ee4,0xc9))[_0x08e2('0xb2')](handleError(_0x336ee4,null));};exports[_0x08e2('0x23')]=function(_0xe03a18,_0x37c62d){if(_0xe03a18[_0x08e2('0xb9')]['id']){delete _0xe03a18[_0x08e2('0xb9')]['id'];}return db[_0x08e2('0x3a')][_0x08e2('0x6b')]({'where':{'id':_0xe03a18['params']['id']}})['then'](handleEntityNotFound(_0x37c62d,null))['then'](saveUpdates(_0xe03a18['body'],null))['then'](respondWithResult(_0x37c62d,null))[_0x08e2('0xb2')](handleError(_0x37c62d,null));};exports[_0x08e2('0x25')]=function(_0x18ffd3,_0x48d5ef){return db[_0x08e2('0x3a')]['find']({'where':{'id':_0x18ffd3['params']['id']}})['then'](handleEntityNotFound(_0x48d5ef,null))[_0x08e2('0x24')](removeEntity(_0x48d5ef,null))[_0x08e2('0xb2')](handleError(_0x48d5ef,null));};exports[_0x08e2('0xba')]=function(_0x4b2268,_0x42e74a){return db[_0x08e2('0x3a')][_0x08e2('0xba')]()[_0x08e2('0x24')](respondWithResult(_0x42e74a,null))[_0x08e2('0xb2')](handleError(_0x42e74a,null));};exports['addMessage']=function(_0x256d42,_0x22efa0,_0x116a89){return db[_0x08e2('0xbb')][_0x08e2('0x6b')]({'where':{'id':_0x256d42[_0x08e2('0xbc')]['id']}})[_0x08e2('0x24')](handleEntityNotFound(_0x22efa0,null))['then'](function(_0x4d22fc){if(_0x4d22fc){return _0x4d22fc[_0x08e2('0xbd')](_0x256d42[_0x08e2('0xb9')]['ids'],_[_0x08e2('0xbe')](_0x256d42[_0x08e2('0xb9')],[_0x08e2('0xbf'),'id'])||{});}})[_0x08e2('0x24')](respondWithResult(_0x22efa0,null))[_0x08e2('0xb2')](handleError(_0x22efa0,null));};exports[_0x08e2('0xc0')]=function(_0x54d3ba,_0x182254,_0x2bff0f){var _0x1f2b74={'raw':![],'where':{}};var _0x434f7b={};var _0x334afb={'count':0x0,'rows':[]};return db[_0x08e2('0x3a')]['findOne']({'where':{'id':_0x54d3ba[_0x08e2('0xbc')]['id']}})[_0x08e2('0x24')](handleEntityNotFound(_0x182254,null))[_0x08e2('0x24')](function(_0x2d0742){if(_0x2d0742){_0x434f7b[_0x08e2('0x41')]=_[_0x08e2('0x3e')](db['FaxMessage'][_0x08e2('0xb4')]);_0x434f7b[_0x08e2('0x3d')]=_[_0x08e2('0x3e')](_0x54d3ba['query']);_0x434f7b[_0x08e2('0x3f')]=_[_0x08e2('0x40')](_0x434f7b['model'],_0x434f7b[_0x08e2('0x3d')]);_0x1f2b74['attributes']=_[_0x08e2('0x40')](_0x434f7b['model'],qs['fields'](_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0x43')]));_0x1f2b74['attributes']=_0x1f2b74[_0x08e2('0x42')][_0x08e2('0x61')]?_0x1f2b74[_0x08e2('0x42')]:_0x434f7b[_0x08e2('0x41')];if(!_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0x44')](_0x08e2('0x45'))){_0x1f2b74['limit']=qs[_0x08e2('0x1e')](_0x54d3ba[_0x08e2('0x3d')]['limit']);_0x1f2b74[_0x08e2('0x1c')]=qs[_0x08e2('0x1c')](_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0x1c')]);}_0x1f2b74[_0x08e2('0x46')]=qs[_0x08e2('0x47')](_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0x47')]);_0x1f2b74[_0x08e2('0x48')]=qs[_0x08e2('0x3f')](_['pick'](_0x54d3ba[_0x08e2('0x3d')],_0x434f7b['filters']));_0x1f2b74[_0x08e2('0x48')][_0x08e2('0xc1')]=_0x2d0742['id'];if(_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0xc2')]){_0x1f2b74['where']=_[_0x08e2('0x99')](_0x1f2b74[_0x08e2('0x48')],{'$or':_[_0x08e2('0x2c')](_0x1f2b74[_0x08e2('0x42')],function(_0x47654e){var _0x7d697b={};_0x7d697b[_0x47654e]={'$like':'%'+_0x54d3ba[_0x08e2('0x3d')]['filter']+'%'};return _0x7d697b;})});}if(_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0x7a')]){var _0x44351a=_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0x7a')][_0x08e2('0x30')](',');var _0x100ecc={};_0x100ecc[_0x44351a[0x0]]={'$gte':moment(_0x44351a[0x1])[_0x08e2('0xc3')](_0x08e2('0xc4'))};_0x1f2b74['where']=_[_0x08e2('0x99')](_0x1f2b74[_0x08e2('0x48')],_0x100ecc);}_0x1f2b74=_['merge']({},_0x1f2b74,_0x54d3ba[_0x08e2('0xb7')]);return db[_0x08e2('0xbb')]['count']({'where':_0x1f2b74[_0x08e2('0x48')]})[_0x08e2('0x24')](function(_0x2591b4){_0x334afb[_0x08e2('0x1f')]=_0x2591b4;if(_0x54d3ba[_0x08e2('0x3d')][_0x08e2('0xb5')]){_0x1f2b74[_0x08e2('0xb6')]=[{'all':!![]}];}return db[_0x08e2('0xbb')][_0x08e2('0xc5')](_0x1f2b74);})[_0x08e2('0x24')](function(_0x491025){_0x334afb[_0x08e2('0xb1')]=_0x491025;return _0x334afb;});}})['then'](respondWithFilteredResult(_0x182254,_0x1f2b74))[_0x08e2('0xb2')](handleError(_0x182254,null));};exports[_0x08e2('0xc6')]=function(_0x42a7db,_0x40b36e,_0x2a1ecf){return db[_0x08e2('0x3a')][_0x08e2('0x6b')]({'where':{'id':_0x42a7db[_0x08e2('0xbc')]['id']}})[_0x08e2('0x24')](handleEntityNotFound(_0x40b36e,null))[_0x08e2('0x24')](function(_0x31b226){if(_0x31b226){return _0x31b226[_0x08e2('0xc7')](_0x42a7db[_0x08e2('0xb9')][_0x08e2('0xbf')],_[_0x08e2('0xbe')](_0x42a7db[_0x08e2('0xb9')],['ids','id'])||{})['spread'](function(){return db[_0x08e2('0x6e')][_0x08e2('0xc5')]({'attributes':['id',_0x08e2('0x29'),_0x08e2('0x4c')],'where':{'id':_0x42a7db[_0x08e2('0xb9')][_0x08e2('0xbf')]}});})['then'](function(_0x7b9451){socket[_0x08e2('0xc8')]('faxInteractionTags:save',{'id':Number(_0x42a7db[_0x08e2('0xbc')]['id']),'tags':_0x7b9451||[]});return{'id':Number(_0x42a7db[_0x08e2('0xbc')]['id']),'tags':_0x7b9451||[]};});}})[_0x08e2('0x24')](respondWithResult(_0x40b36e,null))['catch'](handleError(_0x40b36e,null));};exports[_0x08e2('0xc9')]=function(_0x3b741a,_0x309d3a,_0x4557f2){return db['FaxInteraction'][_0x08e2('0x6b')]({'where':{'id':_0x3b741a[_0x08e2('0xbc')]['id']}})[_0x08e2('0x24')](handleEntityNotFound(_0x309d3a,null))[_0x08e2('0x24')](function(_0x15e430){if(_0x15e430){return _0x15e430['removeTags'](_0x3b741a[_0x08e2('0x3d')][_0x08e2('0xbf')]);}})[_0x08e2('0x24')](respondWithStatusCode(_0x309d3a,null))['catch'](handleError(_0x309d3a,null));};exports[_0x08e2('0xca')]=function(_0x548ae6,_0x18beca){var _0x3ffab0=moment()[_0x08e2('0xcb')]()[_0x08e2('0x98')]();var _0x1608fa=path[_0x08e2('0xcc')](config[_0x08e2('0xcd')],_0x08e2('0xce'),_0x08e2('0xcf'),_0x08e2('0xd0'));var _0x7a3b88=path[_0x08e2('0xcc')](config[_0x08e2('0xcd')],_0x08e2('0xce'),_0x08e2('0xcf'),'attachments');var _0x431ece=path[_0x08e2('0xcc')](_0x1608fa,_0x3ffab0);var _0x5edccd=util[_0x08e2('0xc3')]('transcript-%d-%s.zip',_0x548ae6[_0x08e2('0xbc')]['id'],_0x3ffab0);var _0x2be5ae=path[_0x08e2('0xcc')](_0x1608fa,_0x5edccd);var _0x33cb9e=[];_0x33cb9e[_0x08e2('0x32')]({'model':db[_0x08e2('0xd1')],'as':'Attachment','raw':!![]});var _0x28bf64=[{'model':db['FaxMessage'],'as':_0x08e2('0xd2'),'attributes':['id',_0x08e2('0xb9'),_0x08e2('0x79')],'include':_0x33cb9e}];return db[_0x08e2('0x3a')][_0x08e2('0x6b')]({'where':{'id':_0x548ae6[_0x08e2('0xbc')]['id']},'include':_0x28bf64})[_0x08e2('0x24')](handleEntityNotFound(_0x18beca,null))[_0x08e2('0x24')](function(_0x202fb3){if(_0x202fb3&&_0x202fb3[_0x08e2('0xd2')]){var _0x2fa36d=_0x202fb3[_0x08e2('0xd3')]({'plain':!![]});fs[_0x08e2('0xd4')](_0x431ece);for(var _0x5cc733=0x0;_0x5cc733<_0x2fa36d[_0x08e2('0xd2')]['length'];_0x5cc733++){var _0x787b14=_0x2fa36d[_0x08e2('0xd2')][_0x5cc733][_0x08e2('0xd1')];if(_0x787b14){var _0x3d3fa0=path[_0x08e2('0xcc')](_0x7a3b88,_0x787b14[_0x08e2('0xd5')]);if(fs[_0x08e2('0xd6')](_0x3d3fa0)){fs[_0x08e2('0xd7')](_0x3d3fa0)[_0x08e2('0xd8')](fs[_0x08e2('0xd9')](path[_0x08e2('0xcc')](_0x431ece,_0x787b14[_0x08e2('0xd5')])));}}}return BPromise[_0x08e2('0xda')]()[_0x08e2('0x24')](function(){return new BPromise(function(_0x30c251,_0x13324a){zipdir(_0x431ece,{'saveTo':_0x2be5ae},function(_0x501679,_0x5e5498){if(_0x501679)return _0x13324a(_0x501679);return _0x30c251(_0x5e5498);});})[_0x08e2('0x24')](function(){return new BPromise(function(_0x3d4e05,_0x3acffb){rimraf(_0x431ece,function(_0x5857a6){if(_0x5857a6)_0x3acffb(_0x5857a6);return _0x3d4e05();});});})[_0x08e2('0x24')](function(){return _0x18beca[_0x08e2('0xca')](_0x2be5ae,_0x5edccd,function(_0x563a0b){if(_0x563a0b){console['log'](_0x08e2('0xdb'),_0x563a0b);}else{fs[_0x08e2('0xdc')](_0x2be5ae);}});});});}else{return _0x18beca['sendStatus'](0xc8);}})[_0x08e2('0xb2')](handleError(_0x18beca,null));}; \ No newline at end of file +var _0x2838=['operator','$substring','value','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?','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?','body','some','compact','isEmpty','forEach','i.FaxAccountId\x20IN\x20?','concat','parse','$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.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','FaxInteractionId','all','show','params','keys','includeAll','options','describe','addMessage','FaxMessage','ids','omit','getMessages','intersection','$gte','format','include','findAll','rows','addTags','setTags','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','createReadStream','pipe','createWriteStream','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','Tags','push','TagIds','catch','waiting','talking','unmanaged','total','closed','UserId','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','users','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2838,0x14f));var _0x8283=function(_0x47c89e,_0x18692c){_0x47c89e=_0x47c89e-0x0;var _0x1de51e=_0x2838[_0x47c89e];return _0x1de51e;};'use strict';var emlformat=require(_0x8283('0x0'));var rimraf=require(_0x8283('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8283('0x2'));var rp=require(_0x8283('0x3'));var moment=require(_0x8283('0x4'));var BPromise=require(_0x8283('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8283('0x6'));var csv=require(_0x8283('0x7'));var ejs=require(_0x8283('0x8'));var fs=require('fs');var fs_extra=require(_0x8283('0x9'));var _=require(_0x8283('0xa'));var squel=require(_0x8283('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8283('0xc'));var toCsv=require(_0x8283('0x7'));var querystring=require('querystring');var Papa=require(_0x8283('0xd'));var Redis=require(_0x8283('0xe'));var authService=require(_0x8283('0xf'));var qs=require(_0x8283('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8283('0x11'))(_0x8283('0x12'));var utils=require(_0x8283('0x13'));var config=require(_0x8283('0x14'));var licenseUtil=require(_0x8283('0x15'));var db=require(_0x8283('0x16'))['db'];config[_0x8283('0x17')]=_[_0x8283('0x18')](config[_0x8283('0x17')],{'host':_0x8283('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8283('0x17')]));require(_0x8283('0x1a'))[_0x8283('0x1b')](socket);function respondWithStatusCode(_0x2cef07,_0x1e701c){_0x1e701c=_0x1e701c||0xcc;return function(_0xee42bc){if(_0xee42bc){return _0x2cef07[_0x8283('0x1c')](_0x1e701c);}return _0x2cef07[_0x8283('0x1d')](_0x1e701c)[_0x8283('0x1e')]();};}function respondWithResult(_0x5b9054,_0x47a333){_0x47a333=_0x47a333||0xc8;return function(_0x27605a){if(_0x27605a){return _0x5b9054[_0x8283('0x1d')](_0x47a333)['json'](_0x27605a);}};}function respondWithFilteredResult(_0x401866,_0x551152){return function(_0x456f29){if(_0x456f29){var _0x512af1=typeof _0x551152[_0x8283('0x1f')]===_0x8283('0x20')&&typeof _0x551152[_0x8283('0x21')]==='undefined';var _0x25e6b8=_0x456f29[_0x8283('0x22')];var _0xf8c903=_0x512af1?0x0:_0x551152[_0x8283('0x1f')];var _0x551f4c=_0x512af1?_0x456f29['count']:_0x551152['offset']+_0x551152['limit'];var _0x21551f;if(_0x551f4c>=_0x25e6b8){_0x551f4c=_0x25e6b8;_0x21551f=0xc8;}else{_0x21551f=0xce;}_0x401866[_0x8283('0x1d')](_0x21551f);return _0x401866[_0x8283('0x23')](_0x8283('0x24'),_0xf8c903+'-'+_0x551f4c+'/'+_0x25e6b8)[_0x8283('0x25')](_0x456f29);}return null;};}function patchUpdates(_0x42e5d0){return function(_0x4b4813){try{jsonpatch[_0x8283('0x26')](_0x4b4813,_0x42e5d0,!![]);}catch(_0x23ca1e){return BPromise[_0x8283('0x27')](_0x23ca1e);}return _0x4b4813[_0x8283('0x28')]();};}function saveUpdates(_0x5c8327,_0x561f04){return function(_0x45b069){if(_0x45b069){return _0x45b069[_0x8283('0x29')](_0x5c8327)[_0x8283('0x2a')](function(_0x432de2){return _0x432de2;});}return null;};}function removeEntity(_0x176244,_0x1a4c76){return function(_0x1ebba6){if(_0x1ebba6){return _0x1ebba6[_0x8283('0x2b')]()[_0x8283('0x2a')](function(){_0x176244['status'](0xcc)[_0x8283('0x1e')]();});}};}function handleEntityNotFound(_0x3beabd,_0x843bed){return function(_0x33ce24){if(!_0x33ce24){_0x3beabd[_0x8283('0x1c')](0x194);}return _0x33ce24;};}function handleError(_0x13198f,_0x42e838){_0x42e838=_0x42e838||0x1f4;return function(_0x216f9b){logger[_0x8283('0x2c')](_0x216f9b[_0x8283('0x2d')]);if(_0x216f9b['name']){delete _0x216f9b[_0x8283('0x2e')];}_0x13198f[_0x8283('0x1d')](_0x42e838)[_0x8283('0x2f')](_0x216f9b);};}function getInteractionUsers(_0x1eea2d,_0x18c072){return new BPromise(function(_0x48629d,_0x589cd7){try{if(_0x18c072[_0x1eea2d['id']]){_0x1eea2d[_0x8283('0x30')]=_['map'](_0x18c072[_0x1eea2d['id']],function(_0x1c60b7){return{'id':_0x1c60b7['id'],'fullname':_0x1c60b7[_0x8283('0x31')]};});}}catch(_0x353884){_0x589cd7(_0x353884);}_0x48629d(_0x1eea2d);});}function getInteractionTags(_0x235047,_0x34033d){return new BPromise(function(_0x5554f8,_0x123d9d){try{if(_0x235047['TagIds']){_0x235047[_0x8283('0x32')]=[];_0x235047['TagIds']['split'](',')['forEach'](function(_0x5e2dda){_0x235047[_0x8283('0x32')][_0x8283('0x33')](_0x34033d[_0x5e2dda]);});}delete _0x235047[_0x8283('0x34')];}catch(_0x1a3a72){_0x123d9d(_0x1a3a72);}_0x5554f8(_0x235047);});}function updateFaxInteraction(_0x29a10b,_0x480c5f,_0x21041c){return new BPromise(function(_0x2637e3,_0x51a9c7){return getInteractionUsers(_0x29a10b,_0x21041c)[_0x8283('0x2a')](function(_0x43339b){return getInteractionTags(_0x43339b,_0x480c5f);})['then'](function(_0xe3793e){return getStateInteraction(_0xe3793e);})[_0x8283('0x2a')](function(_0x23069e){_0x2637e3(_0x23069e);})[_0x8283('0x35')](function(_0x5e51c5){_0x51a9c7(_0x5e51c5);});});}function getStateInteraction(_0x250e74){return new BPromise(function(_0x28928e){_0x250e74[_0x8283('0x36')]=0x0;_0x250e74[_0x8283('0x37')]=0x0;_0x250e74['answered']=0x0;_0x250e74[_0x8283('0x38')]=0x0;_0x250e74[_0x8283('0x39')]=0x0;if(!_0x250e74[_0x8283('0x3a')]&&!_0x250e74[_0x8283('0x3b')]){_0x250e74[_0x8283('0x36')]+=0x1;}if(!_0x250e74[_0x8283('0x3a')]&&_0x250e74[_0x8283('0x3b')]){_0x250e74['talking']+=0x1;if(_0x250e74['waiting']){_0x250e74[_0x8283('0x36')]-=0x1;}}if(_0x250e74[_0x8283('0x3a')]&&_0x250e74[_0x8283('0x3b')]){_0x250e74['answered']+=0x1;if(_0x250e74[_0x8283('0x37')]){_0x250e74[_0x8283('0x37')]-=0x1;}}if(_0x250e74[_0x8283('0x3a')]&&!_0x250e74[_0x8283('0x3b')]){_0x250e74[_0x8283('0x38')]+=0x1;if(_0x250e74['waiting']){_0x250e74['waiting']-=0x1;}}_0x250e74[_0x8283('0x39')]+=0x1;_0x28928e(_0x250e74);});}exports[_0x8283('0x3c')]=function(_0x379a7c,_0x5c07f6){var _0x2fc03b={},_0xbdfe9a={},_0x4903bf={'count':0x0,'rows':[]};var _0x2fa02f=_[_0x8283('0x3d')](db[_0x8283('0x3e')][_0x8283('0x3f')],function(_0x2f8ba8){return{'name':_0x2f8ba8[_0x8283('0x40')],'type':_0x2f8ba8[_0x8283('0x41')][_0x8283('0x42')]};});_0xbdfe9a[_0x8283('0x43')]=_['map'](_0x2fa02f,_0x8283('0x2e'));_0xbdfe9a[_0x8283('0x44')]=_['keys'](_0x379a7c[_0x8283('0x44')]);_0xbdfe9a[_0x8283('0x45')]=_['intersection'](_0xbdfe9a[_0x8283('0x43')],_0xbdfe9a[_0x8283('0x44')]);_0x2fc03b['attributes']=_['intersection'](_0xbdfe9a[_0x8283('0x43')],qs[_0x8283('0x46')](_0x379a7c['query']['fields']));_0x2fc03b[_0x8283('0x47')]=_0x2fc03b[_0x8283('0x47')][_0x8283('0x48')]?_0x2fc03b[_0x8283('0x47')]:_0xbdfe9a[_0x8283('0x43')];if(!_0x379a7c[_0x8283('0x44')][_0x8283('0x49')](_0x8283('0x4a'))){_0x2fc03b[_0x8283('0x21')]=qs['limit'](_0x379a7c['query'][_0x8283('0x21')]);_0x2fc03b[_0x8283('0x1f')]=qs[_0x8283('0x1f')](_0x379a7c[_0x8283('0x44')][_0x8283('0x1f')]);}_0x2fc03b['order']=qs[_0x8283('0x4b')](_0x379a7c[_0x8283('0x44')][_0x8283('0x4b')]);_0x2fc03b[_0x8283('0x4c')]=qs['filters'](_[_0x8283('0x4d')](_0x379a7c[_0x8283('0x44')],_0xbdfe9a[_0x8283('0x45')]),_0x2fa02f);var _0x10b2a4=[];var _0x149031=squel[_0x8283('0x4e')]()[_0x8283('0x4f')]('id')[_0x8283('0x4f')](_0x8283('0x2e'))['field'](_0x8283('0x50'))[_0x8283('0x51')]('tools_tags');var _0x44c7b6=squel['select']()[_0x8283('0x4f')]('u.id')[_0x8283('0x4f')](_0x8283('0x52'))[_0x8283('0x4f')](_0x8283('0x53'))[_0x8283('0x51')](_0x8283('0x54'),'ui')[_0x8283('0x55')]('users','u',_0x8283('0x56'));var _0x709b70=squel[_0x8283('0x4e')]()[_0x8283('0x51')](_0x8283('0x57'),'i')[_0x8283('0x55')](_0x8283('0x58'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8283('0x55')](_0x8283('0x59'),'o','o.id\x20=\x20i.UserId')[_0x8283('0x55')](_0x8283('0x5a'),'a','a.id\x20=\x20i.FaxAccountId')[_0x8283('0x55')](_0x8283('0x5b'),'me',_0x8283('0x5c'))[_0x8283('0x55')]('fax_interaction_has_tags','it',_0x8283('0x5d'))[_0x8283('0x55')](_0x8283('0x5e'),'t',_0x8283('0x5f'));var _0x2ec1f8=squel['expr']();var _0x59e0d9=[];var _0x2b713e=squel[_0x8283('0x60')]();var _0x4a0974;if(_0x379a7c[_0x8283('0x44')][_0x8283('0x61')]){_0x4a0974=as[_0x8283('0x62')](_0x379a7c[_0x8283('0x44')]['search']);var _0x288aff=_0x4a0974[_0x8283('0x63')];for(var _0x5243fa=0x0;_0x5243fa<_0x4a0974[_0x8283('0x64')][_0x8283('0x48')];_0x5243fa++){var _0x58df76=_0x4a0974['conditions'][_0x5243fa];var _0x4a9f0b='i';var _0x5494ab=_[_0x8283('0x65')](_0x2fa02f,[_0x8283('0x2e'),_0x58df76[_0x8283('0x4f')]]);if(!_0x5494ab){switch(_0x58df76[_0x8283('0x4f')]){case _0x8283('0x66'):if(_0x58df76['value']==0x1){_0x709b70[_0x8283('0x67')]('`'+_0x58df76['field']+_0x8283('0x68'));}else{_0x709b70['having']('`'+_0x58df76[_0x8283('0x4f')]+_0x8283('0x69'));}break;case _0x8283('0x6a'):if(_0x58df76[_0x8283('0x6b')]===_0x8283('0x6c')){if(_0x58df76[_0x8283('0x6d')][_0x8283('0x6e')]('\x20')[_0x8283('0x48')]>0x1){_0x2ec1f8[_0x288aff](_0x8283('0x6f'),qs[_0x8283('0x70')](_0x58df76['value']),null);}else{var _0x46a486='%'+_0x58df76[_0x8283('0x6d')]+'%';_0x2ec1f8[_0x288aff](_0x8283('0x71'),_0x46a486,_0x46a486,_0x46a486);}}else{_0x5494ab=_[_0x8283('0x65')](_0x2fa02f,['name','ContactId']);_0x58df76['field']='ContactId';_0x193a75=as[_0x8283('0x72')](_0x4a9f0b,_0x5494ab[_0x8283('0x41')],_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75[_0x8283('0x6d')][_0x8283('0x74')],_0x193a75[_0x8283('0x6d')][_0x8283('0x1e')]);}break;case _0x8283('0x75'):var _0x62d7ca=_0x58df76[_0x8283('0x6d')][_0x8283('0x6e')](',')[_0x8283('0x3d')](function(_0xb237b1){return Number(_0xb237b1);});_0x62d7ca['forEach'](function(_0x5a3dfe){_0x2b713e['or'](_0x8283('0x76'),'%,'+_0x5a3dfe+',%');});_0x59e0d9=_['union'](_0x59e0d9,_0x62d7ca);break;case _0x8283('0x77'):if(_0x58df76['operator']==='$substring'){_0x2ec1f8[_0x288aff](_0x8283('0x78'),'%'+_0x58df76[_0x8283('0x6d')]+'%',null);}else{_0x5494ab=_['find'](_0x2fa02f,[_0x8283('0x2e'),'UserId']);_0x58df76['field']=_0x8283('0x3b');_0x193a75=as[_0x8283('0x72')](_0x4a9f0b,_0x5494ab[_0x8283('0x41')],_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75[_0x8283('0x6d')][_0x8283('0x74')],_0x193a75['value'][_0x8283('0x1e')]);}break;case _0x8283('0x79'):_0x193a75=as[_0x8283('0x72')]('me',null,_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75[_0x8283('0x6d')][_0x8283('0x74')],_0x193a75[_0x8283('0x6d')][_0x8283('0x1e')]);break;}}else{var _0x193a75=as[_0x8283('0x72')](_0x4a9f0b,_0x5494ab[_0x8283('0x41')],_0x58df76);_0x2ec1f8[_0x288aff](_0x193a75[_0x8283('0x73')],_0x193a75['value'][_0x8283('0x74')],_0x193a75[_0x8283('0x6d')][_0x8283('0x1e')]);}}}else{var _0x50f868=_(_0x379a7c[_0x8283('0x44')])['keys']()[_0x8283('0x3d')](function(_0x463b83){return _[_0x8283('0x7a')](_0x2fa02f,[_0x8283('0x2e'),_0x463b83])?_0x463b83:undefined;})[_0x8283('0x7b')]()[_0x8283('0x6d')]();if(!_[_0x8283('0x7c')](_0x50f868)){_0x50f868[_0x8283('0x7d')](function(_0x57dad9){if(_0x57dad9==='FaxAccountId'){_0x709b70[_0x8283('0x4c')](_0x8283('0x7e'),[][_0x8283('0x7f')](_0x379a7c[_0x8283('0x44')][_0x57dad9]));}else if(_0x57dad9==='createdAt'){var _0x40bbf2=JSON[_0x8283('0x80')](_0x379a7c[_0x8283('0x44')][_0x57dad9])['$gte'];var _0x5c5887=JSON[_0x8283('0x80')](_0x379a7c[_0x8283('0x44')][_0x57dad9])[_0x8283('0x81')];_0x709b70['where'](_0x8283('0x82'),_0x40bbf2,_0x5c5887);}else{if(_0x379a7c[_0x8283('0x44')][_0x57dad9]===_0x8283('0x83')){_0x709b70[_0x8283('0x4c')]('i.'+_0x57dad9+_0x8283('0x84'));}else{_0x709b70['where']('i.'+_0x57dad9+_0x8283('0x85'),_0x379a7c[_0x8283('0x44')][_0x57dad9]);}}});}if(_0x379a7c[_0x8283('0x44')]['read']){if(_0x379a7c[_0x8283('0x44')][_0x8283('0x86')]==0x1){_0x709b70[_0x8283('0x67')](_0x8283('0x87'));}else{_0x709b70[_0x8283('0x67')](_0x8283('0x88'));}}if(_0x379a7c[_0x8283('0x44')][_0x8283('0x89')]){_0x59e0d9=_[_0x8283('0x8a')](_0x379a7c[_0x8283('0x44')][_0x8283('0x89')])?_0x379a7c['query']['tag']:new Array(_0x379a7c[_0x8283('0x44')]['tag']);_0x59e0d9[_0x8283('0x7d')](function(_0x50bea7){_0x2b713e['or'](_0x8283('0x76'),'%,'+_0x50bea7+',%');});}if(_0x379a7c[_0x8283('0x44')][_0x8283('0x8b')]){var _0x318a02=_0x379a7c[_0x8283('0x44')]['filter'][_0x8283('0x8c')]('\x5c','\x5c\x5c')[_0x8283('0x8c')](/'/g,'\x27\x27');if(qs[_0x8283('0x8d')](_0x318a02)){_0x2ec1f8['or'](_0x8283('0x8e'),_0x318a02+'%')['or']('i.fax\x20LIKE\x20?',_0x318a02+'%');}_0x2ec1f8['or'](_0x8283('0x8f'),_0x318a02+'%');}}_0x709b70[_0x8283('0x4c')](_0x2ec1f8);_0x709b70[_0x8283('0x90')](_0x8283('0x91'));var _0x5b452d={'type':db[_0x8283('0x92')]['QueryTypes'][_0x8283('0x93')],'raw':!![]};var _0x464767=_0x709b70[_0x8283('0x94')]();_0x464767['field'](_0x8283('0x91'));_0x464767[_0x8283('0x4f')](_0x8283('0x95'),_0x8283('0x66'));if(_0x2fc03b['order']){_0x2fc03b[_0x8283('0x96')]['forEach'](function(_0x30a6e9){var _0x16f9e5=_0x30a6e9[0x0]===_0x8283('0x97')?_0x30a6e9[0x0]:'i.'+_0x30a6e9[0x0];_0x709b70[_0x8283('0x96')](_0x16f9e5,_0x30a6e9[0x1]===_0x8283('0x98')?![]:!![]);});}if(!_[_0x8283('0x7c')](_0x59e0d9)){_0x709b70[_0x8283('0x67')](_0x2b713e);_0x464767[_0x8283('0x4c')](_0x8283('0x99'),_0x59e0d9);}BPromise[_0x8283('0x9a')]()[_0x8283('0x2a')](function(){if(!_0x4a0974){if(_0x379a7c['query'][_0x8283('0x9b')])return;_0x464767[_0x8283('0x4c')](_0x8283('0x9c'));_0x709b70[_0x8283('0x4c')](_0x8283('0x9c'));return;}if(_0x379a7c[_0x8283('0x9d')][_0x8283('0x9e')]!==_0x8283('0x9f'))return;return _0x379a7c[_0x8283('0x9d')][_0x8283('0xa0')]({'attributes':['id'],'raw':!![]})[_0x8283('0x2a')](function(_0x5cbe63){if(_[_0x8283('0x7c')](_0x5cbe63)){_0x464767[_0x8283('0x4c')](_0x8283('0xa1'));_0x709b70[_0x8283('0x4c')](_0x8283('0xa1'));}else{_0x464767[_0x8283('0x4c')](_0x8283('0x7e'),_['map'](_0x5cbe63,'id'));_0x709b70[_0x8283('0x4c')]('i.FaxAccountId\x20IN\x20?',_[_0x8283('0x3d')](_0x5cbe63,'id'));}});})[_0x8283('0x2a')](function(){if(_0x379a7c[_0x8283('0x9d')][_0x8283('0x9e')]==='agent'&&!_0x4a0974&&!_0x379a7c[_0x8283('0x44')][_0x8283('0x9b')])return[];return db[_0x8283('0xa2')][_0x8283('0x44')](_0x464767['toString'](),_0x5b452d);})[_0x8283('0x2a')](function(_0x4fdd1d){_0x4903bf[_0x8283('0x22')]=_0x4fdd1d['length'];if(_0x4903bf[_0x8283('0x22')]===0x0)return[];return db[_0x8283('0xa2')]['query'](_0x149031[_0x8283('0xa3')](),_0x5b452d)[_0x8283('0x2a')](function(_0x54fbb6){_0x10b2a4=_[_0x8283('0xa4')](_0x54fbb6,'id');_0x5b452d=_[_0x8283('0xa5')](_0x5b452d,{'model':db[_0x8283('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x379a7c[_0x8283('0x44')][_0x8283('0x46')]){_0x2fc03b['attributes']['forEach'](function(_0x27ad02){_0x709b70[_0x8283('0x4f')]('i.'+_0x27ad02);});}else{_0x709b70[_0x8283('0x4f')](_0x8283('0x95'),_0x8283('0x66'));_0x709b70[_0x8283('0x4f')]('a.key',_0x8283('0xa6'));_0x709b70[_0x8283('0x4f')](_0x8283('0xa7'),_0x8283('0xa8'));_0x709b70[_0x8283('0x4f')](_0x8283('0xa9'),_0x8283('0x97'));_0x709b70[_0x8283('0x4f')](_0x8283('0xaa'));_0x709b70[_0x8283('0x4f')]('c.firstName',_0x8283('0xab'));_0x709b70[_0x8283('0x4f')](_0x8283('0xac'),'Contact.lastName');_0x709b70[_0x8283('0x4f')](_0x8283('0xad'),'Contact.email');_0x709b70[_0x8283('0x4f')](_0x8283('0xae'),'Contact.phone');_0x709b70['field'](_0x8283('0xaf'),_0x8283('0xb0'));_0x709b70[_0x8283('0x4f')]('c.fax',_0x8283('0xb1'));_0x709b70[_0x8283('0x4f')](_0x8283('0xb2'),_0x8283('0xb3'));_0x709b70[_0x8283('0x4f')](_0x8283('0xb4'),_0x8283('0xb5'));_0x709b70['field'](_0x8283('0xb6'),_0x8283('0x34'));}if(_0x2fc03b[_0x8283('0x21')])_0x709b70[_0x8283('0x21')](_0x2fc03b['limit']);if(_0x2fc03b[_0x8283('0x1f')])_0x709b70['offset'](_0x2fc03b['offset']);return db[_0x8283('0xa2')][_0x8283('0x44')](_0x709b70[_0x8283('0xa3')](),_0x5b452d);})[_0x8283('0x2a')](function(_0x3c02dd){if(_0x3c02dd['length']>0x0)_0x44c7b6[_0x8283('0x4c')]('ui.FaxInteractionId\x20IN\x20?',_[_0x8283('0x3d')](_0x3c02dd,'id'));return db['sequelize'][_0x8283('0x44')](_0x44c7b6[_0x8283('0xa3')](),_0x5b452d)[_0x8283('0x2a')](function(_0x38fac7){var _0x159897=_['groupBy'](_0x38fac7,_0x8283('0xb7'));var _0x2d3ceb=[];_0x3c02dd[_0x8283('0x7d')](function(_0x1fb3c8){_0x2d3ceb[_0x8283('0x33')](updateFaxInteraction(_0x1fb3c8,_0x10b2a4,_0x159897));});return BPromise[_0x8283('0xb8')](_0x2d3ceb);});});})['then'](function(_0xb2ce61){_0x4903bf['rows']=_0xb2ce61;return _0x4903bf;})[_0x8283('0x2a')](respondWithFilteredResult(_0x5c07f6,_0x2fc03b))[_0x8283('0x35')](handleError(_0x5c07f6,null));};exports[_0x8283('0xb9')]=function(_0x6893c5,_0x32d39c){var _0x205bce={'raw':![],'where':{'id':_0x6893c5[_0x8283('0xba')]['id']}},_0x5d37f6={};_0x5d37f6[_0x8283('0x43')]=_[_0x8283('0xbb')](db[_0x8283('0x3e')][_0x8283('0x3f')]);_0x5d37f6[_0x8283('0x44')]=_[_0x8283('0xbb')](_0x6893c5['query']);_0x5d37f6['filters']=_['intersection'](_0x5d37f6[_0x8283('0x43')],_0x5d37f6[_0x8283('0x44')]);_0x205bce['attributes']=_['intersection'](_0x5d37f6['model'],qs['fields'](_0x6893c5['query'][_0x8283('0x46')]));_0x205bce[_0x8283('0x47')]=_0x205bce[_0x8283('0x47')][_0x8283('0x48')]?_0x205bce[_0x8283('0x47')]:_0x5d37f6['model'];if(_0x6893c5['query'][_0x8283('0xbc')]){_0x205bce['include']=[{'all':!![]}];}_0x205bce=_['merge']({},_0x205bce,_0x6893c5[_0x8283('0xbd')]);return db[_0x8283('0x3e')][_0x8283('0x65')](_0x205bce)[_0x8283('0x2a')](handleEntityNotFound(_0x32d39c,null))[_0x8283('0x2a')](respondWithResult(_0x32d39c,null))['catch'](handleError(_0x32d39c,null));};exports['create']=function(_0x3438df,_0x214cc8){return db[_0x8283('0x3e')]['create'](_0x3438df[_0x8283('0x79')],{})['then'](respondWithResult(_0x214cc8,0xc9))['catch'](handleError(_0x214cc8,null));};exports[_0x8283('0x29')]=function(_0x129aac,_0x242a7c){if(_0x129aac[_0x8283('0x79')]['id']){delete _0x129aac[_0x8283('0x79')]['id'];}return db[_0x8283('0x3e')]['find']({'where':{'id':_0x129aac[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x242a7c,null))['then'](saveUpdates(_0x129aac[_0x8283('0x79')],null))[_0x8283('0x2a')](respondWithResult(_0x242a7c,null))[_0x8283('0x35')](handleError(_0x242a7c,null));};exports[_0x8283('0x2b')]=function(_0x3f705d,_0x3756f7){return db[_0x8283('0x3e')][_0x8283('0x65')]({'where':{'id':_0x3f705d[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x3756f7,null))[_0x8283('0x2a')](removeEntity(_0x3756f7,null))[_0x8283('0x35')](handleError(_0x3756f7,null));};exports[_0x8283('0xbe')]=function(_0x1b709e,_0x4f93e6){return db['FaxInteraction']['describe']()['then'](respondWithResult(_0x4f93e6,null))[_0x8283('0x35')](handleError(_0x4f93e6,null));};exports[_0x8283('0xbf')]=function(_0x6a34de,_0x108d4c,_0x571d1f){return db[_0x8283('0xc0')]['find']({'where':{'id':_0x6a34de['params']['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x108d4c,null))[_0x8283('0x2a')](function(_0xeb60a6){if(_0xeb60a6){return _0xeb60a6[_0x8283('0xbf')](_0x6a34de[_0x8283('0x79')][_0x8283('0xc1')],_[_0x8283('0xc2')](_0x6a34de[_0x8283('0x79')],[_0x8283('0xc1'),'id'])||{});}})[_0x8283('0x2a')](respondWithResult(_0x108d4c,null))[_0x8283('0x35')](handleError(_0x108d4c,null));};exports[_0x8283('0xc3')]=function(_0x4b8947,_0x35e2de,_0x5b9452){var _0x4fd7e1={'raw':![],'where':{}};var _0x13435b={};var _0x4f2534={'count':0x0,'rows':[]};return db[_0x8283('0x3e')]['findOne']({'where':{'id':_0x4b8947[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x35e2de,null))[_0x8283('0x2a')](function(_0x45858e){if(_0x45858e){_0x13435b['model']=_[_0x8283('0xbb')](db['FaxMessage']['rawAttributes']);_0x13435b['query']=_[_0x8283('0xbb')](_0x4b8947['query']);_0x13435b[_0x8283('0x45')]=_[_0x8283('0xc4')](_0x13435b[_0x8283('0x43')],_0x13435b[_0x8283('0x44')]);_0x4fd7e1['attributes']=_[_0x8283('0xc4')](_0x13435b[_0x8283('0x43')],qs[_0x8283('0x46')](_0x4b8947[_0x8283('0x44')][_0x8283('0x46')]));_0x4fd7e1['attributes']=_0x4fd7e1[_0x8283('0x47')]['length']?_0x4fd7e1[_0x8283('0x47')]:_0x13435b['model'];if(!_0x4b8947[_0x8283('0x44')][_0x8283('0x49')](_0x8283('0x4a'))){_0x4fd7e1['limit']=qs[_0x8283('0x21')](_0x4b8947[_0x8283('0x44')]['limit']);_0x4fd7e1[_0x8283('0x1f')]=qs[_0x8283('0x1f')](_0x4b8947[_0x8283('0x44')][_0x8283('0x1f')]);}_0x4fd7e1[_0x8283('0x96')]=qs[_0x8283('0x4b')](_0x4b8947[_0x8283('0x44')]['sort']);_0x4fd7e1['where']=qs[_0x8283('0x45')](_[_0x8283('0x4d')](_0x4b8947[_0x8283('0x44')],_0x13435b[_0x8283('0x45')]));_0x4fd7e1['where'][_0x8283('0xb7')]=_0x45858e['id'];if(_0x4b8947[_0x8283('0x44')]['filter']){_0x4fd7e1['where']=_[_0x8283('0xa5')](_0x4fd7e1[_0x8283('0x4c')],{'$or':_['map'](_0x4fd7e1[_0x8283('0x47')],function(_0x48d324){var _0x2d3fb7={};_0x2d3fb7[_0x48d324]={'$like':'%'+_0x4b8947[_0x8283('0x44')]['filter']+'%'};return _0x2d3fb7;})});}if(_0x4b8947[_0x8283('0x44')]['$gte']){var _0x5e0ef4=_0x4b8947[_0x8283('0x44')][_0x8283('0xc5')]['split'](',');var _0x4611c6={};_0x4611c6[_0x5e0ef4[0x0]]={'$gte':moment(_0x5e0ef4[0x1])[_0x8283('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4fd7e1[_0x8283('0x4c')]=_[_0x8283('0xa5')](_0x4fd7e1['where'],_0x4611c6);}_0x4fd7e1=_[_0x8283('0xa5')]({},_0x4fd7e1,_0x4b8947[_0x8283('0xbd')]);return db[_0x8283('0xc0')][_0x8283('0x22')]({'where':_0x4fd7e1[_0x8283('0x4c')]})[_0x8283('0x2a')](function(_0x580fe3){_0x4f2534[_0x8283('0x22')]=_0x580fe3;if(_0x4b8947[_0x8283('0x44')][_0x8283('0xbc')]){_0x4fd7e1[_0x8283('0xc7')]=[{'all':!![]}];}return db[_0x8283('0xc0')][_0x8283('0xc8')](_0x4fd7e1);})['then'](function(_0x5c037f){_0x4f2534[_0x8283('0xc9')]=_0x5c037f;return _0x4f2534;});}})['then'](respondWithFilteredResult(_0x35e2de,_0x4fd7e1))[_0x8283('0x35')](handleError(_0x35e2de,null));};exports[_0x8283('0xca')]=function(_0x55b746,_0x44949b,_0x67fad9){return db['FaxInteraction'][_0x8283('0x65')]({'where':{'id':_0x55b746[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x44949b,null))[_0x8283('0x2a')](function(_0x599e8e){if(_0x599e8e){return _0x599e8e[_0x8283('0xcb')](_0x55b746['body'][_0x8283('0xc1')],_[_0x8283('0xc2')](_0x55b746[_0x8283('0x79')],[_0x8283('0xc1'),'id'])||{})['spread'](function(){return db['Tag'][_0x8283('0xc8')]({'attributes':['id',_0x8283('0x2e'),_0x8283('0x50')],'where':{'id':_0x55b746['body'][_0x8283('0xc1')]}});})[_0x8283('0x2a')](function(_0x133886){socket['emit'](_0x8283('0xcc'),{'id':Number(_0x55b746[_0x8283('0xba')]['id']),'tags':_0x133886||[]});return{'id':Number(_0x55b746[_0x8283('0xba')]['id']),'tags':_0x133886||[]};});}})[_0x8283('0x2a')](respondWithResult(_0x44949b,null))['catch'](handleError(_0x44949b,null));};exports[_0x8283('0xcd')]=function(_0x2a45d6,_0x43968c,_0xf43b52){return db[_0x8283('0x3e')][_0x8283('0x65')]({'where':{'id':_0x2a45d6[_0x8283('0xba')]['id']}})[_0x8283('0x2a')](handleEntityNotFound(_0x43968c,null))['then'](function(_0x467d6d){if(_0x467d6d){return _0x467d6d[_0x8283('0xcd')](_0x2a45d6[_0x8283('0x44')]['ids']);}})[_0x8283('0x2a')](respondWithStatusCode(_0x43968c,null))[_0x8283('0x35')](handleError(_0x43968c,null));};exports[_0x8283('0xce')]=function(_0x2a102a,_0x1021ef){var _0xda82=moment()['unix']()[_0x8283('0xa3')]();var _0x3d771d=path[_0x8283('0xcf')](config[_0x8283('0xd0')],_0x8283('0xd1'),_0x8283('0xd2'),_0x8283('0xd3'));var _0x202cc3=path['join'](config[_0x8283('0xd0')],_0x8283('0xd1'),'files',_0x8283('0xd4'));var _0xca8089=path['join'](_0x3d771d,_0xda82);var _0x566921=util['format'](_0x8283('0xd5'),_0x2a102a['params']['id'],_0xda82);var _0x37573a=path[_0x8283('0xcf')](_0x3d771d,_0x566921);var _0x575c5e=[];_0x575c5e[_0x8283('0x33')]({'model':db[_0x8283('0xd6')],'as':_0x8283('0xd6'),'raw':!![]});var _0x27337b=[{'model':db[_0x8283('0xc0')],'as':_0x8283('0xd7'),'attributes':['id',_0x8283('0x79'),'createdAt'],'include':_0x575c5e}];return db[_0x8283('0x3e')][_0x8283('0x65')]({'where':{'id':_0x2a102a[_0x8283('0xba')]['id']},'include':_0x27337b})[_0x8283('0x2a')](handleEntityNotFound(_0x1021ef,null))[_0x8283('0x2a')](function(_0x536d4d){if(_0x536d4d&&_0x536d4d[_0x8283('0xd7')]){var _0x245ecc=_0x536d4d['get']({'plain':!![]});fs['mkdirSync'](_0xca8089);for(var _0x5b0d75=0x0;_0x5b0d75<_0x245ecc[_0x8283('0xd7')][_0x8283('0x48')];_0x5b0d75++){var _0x1338c1=_0x245ecc[_0x8283('0xd7')][_0x5b0d75][_0x8283('0xd6')];if(_0x1338c1){var _0x30f681=path[_0x8283('0xcf')](_0x202cc3,_0x1338c1[_0x8283('0xd8')]);if(fs['existsSync'](_0x30f681)){fs[_0x8283('0xd9')](_0x30f681)[_0x8283('0xda')](fs[_0x8283('0xdb')](path[_0x8283('0xcf')](_0xca8089,_0x1338c1['basename'])));}}}return BPromise[_0x8283('0x9a')]()[_0x8283('0x2a')](function(){return new BPromise(function(_0x5821e5,_0x1f1029){zipdir(_0xca8089,{'saveTo':_0x37573a},function(_0x4128b5,_0x4356a8){if(_0x4128b5)return _0x1f1029(_0x4128b5);return _0x5821e5(_0x4356a8);});})[_0x8283('0x2a')](function(){return new BPromise(function(_0x3dfa25,_0x1b12db){rimraf(_0xca8089,function(_0xd5953c){if(_0xd5953c)_0x1b12db(_0xd5953c);return _0x3dfa25();});});})['then'](function(){return _0x1021ef['download'](_0x37573a,_0x566921,function(_0x424c5e){if(_0x424c5e){console[_0x8283('0xdc')]('err',_0x424c5e);}else{fs['unlinkSync'](_0x37573a);}});});});}else{return _0x1021ef[_0x8283('0x1c')](0xc8);}})[_0x8283('0x35')](handleError(_0x1021ef,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c4ad34d..a0dc7c9 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 _0xdd74=['FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hook','exports','events'];(function(_0x4a77cb,_0x14abf1){var _0x100f80=function(_0x33b3d7){while(--_0x33b3d7){_0x4a77cb['push'](_0x4a77cb['shift']());}};_0x100f80(++_0x14abf1);}(_0xdd74,0x153));var _0x4dd7=function(_0x49a8da,_0x7639bd){_0x49a8da=_0x49a8da-0x0;var _0x42f9d8=_0xdd74[_0x49a8da];return _0x42f9d8;};'use strict';var EventEmitter=require(_0x4dd7('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x4dd7('0x1')];var FaxMessage=require(_0x4dd7('0x2'))['db'][_0x4dd7('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4dd7('0x4')](0x0);var events={'afterCreate':_0x4dd7('0x5'),'afterUpdate':_0x4dd7('0x6'),'afterDestroy':'remove'};function emitEvent(_0x17db8c){return function(_0x546fc5,_0x89bd73,_0x436c6f){_0x546fc5[_0x4dd7('0x7')]({'attributes':['id'],'raw':!![]})[_0x4dd7('0x8')](function(_0x1480ae){_0x546fc5['setDataValue'](_0x4dd7('0x9'),_0x1480ae['map'](function(_0x298319){return{'id':_0x298319['id']};}));return FaxMessage[_0x4dd7('0xa')]({'where':{'FaxInteractionId':_0x546fc5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c83f1){_0x546fc5[_0x4dd7('0xb')](_0x4dd7('0xc'),_0x3c83f1['length']);FaxInteractionEvents[_0x4dd7('0xd')](_0x17db8c+':'+_0x546fc5['id'],_0x546fc5);FaxInteractionEvents[_0x4dd7('0xd')](_0x17db8c,_0x546fc5);_0x436c6f(null);})[_0x4dd7('0xe')](_0x436c6f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x4dd7('0xf')](e,emitEvent(event));}}module[_0x4dd7('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x4eec=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue'];(function(_0x6f3151,_0x406745){var _0x305fb8=function(_0x24e5a8){while(--_0x24e5a8){_0x6f3151['push'](_0x6f3151['shift']());}};_0x305fb8(++_0x406745);}(_0x4eec,0x1e1));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc4ee('0x0'));var FaxInteraction=require(_0xc4ee('0x1'))['db'][_0xc4ee('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xc4ee('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc4ee('0x4')](0x0);var events={'afterCreate':_0xc4ee('0x5'),'afterUpdate':_0xc4ee('0x6'),'afterDestroy':_0xc4ee('0x7')};function emitEvent(_0x127e76){return function(_0x5cc02c,_0x13e773,_0x35bf43){_0x5cc02c[_0xc4ee('0x8')]({'attributes':['id'],'raw':!![]})[_0xc4ee('0x9')](function(_0x4a3faa){_0x5cc02c['setDataValue']('Users',_0x4a3faa[_0xc4ee('0xa')](function(_0x5ea035){return{'id':_0x5ea035['id']};}));return FaxMessage[_0xc4ee('0xb')]({'where':{'FaxInteractionId':_0x5cc02c['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5a547f){_0x5cc02c[_0xc4ee('0xc')](_0xc4ee('0xd'),_0x5a547f['length']);FaxInteractionEvents[_0xc4ee('0xe')](_0x127e76+':'+_0x5cc02c['id'],_0x5cc02c);FaxInteractionEvents['emit'](_0x127e76,_0x5cc02c);_0x35bf43(null);})[_0xc4ee('0xf')](_0x35bf43(null));};}for(var e in events){if(events[_0xc4ee('0x10')](e)){var event=events[e];FaxInteraction[_0xc4ee('0x11')](e,emitEvent(event));}}module[_0xc4ee('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index d45f9e8..4f9c97c 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 _0x7373=['request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7373,0x1db));var _0x3737=function(_0x48ee48,_0x428787){_0x48ee48=_0x48ee48-0x0;var _0x5d2f9b=_0x7373[_0x48ee48];return _0x5d2f9b;};'use strict';var _=require(_0x3737('0x0'));var util=require('util');var logger=require(_0x3737('0x1'))(_0x3737('0x2'));var moment=require(_0x3737('0x3'));var BPromise=require(_0x3737('0x4'));var rp=require(_0x3737('0x5'));var fs=require('fs');var path=require(_0x3737('0x6'));var rimraf=require(_0x3737('0x7'));var config=require('../../config/environment');var attributes=require(_0x3737('0x8'));module[_0x3737('0x9')]=function(_0x4a09e4,_0x161ea0){return _0x4a09e4[_0x3737('0xa')](_0x3737('0xb'),attributes,{'tableName':_0x3737('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x227c95,_0x4c32cb,_0x3eccf4){if(_0x227c95[_0x3737('0xd')]('closed')){_0x227c95['closedAt']=moment()['format'](_0x3737('0xe'));}_0x3eccf4(null,_0x227c95);}}});}; \ No newline at end of file +var _0xf230=['moment','path','rimraf','../../config/environment','exports','define','fax_interactions','changed','closed','format','lodash','util','../../config/logger','api'];(function(_0x11e571,_0x140120){var _0x306e5b=function(_0x263ce7){while(--_0x263ce7){_0x11e571['push'](_0x11e571['shift']());}};_0x306e5b(++_0x140120);}(_0xf230,0xea));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var logger=require(_0x0f23('0x2'))(_0x0f23('0x3'));var moment=require(_0x0f23('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f23('0x5'));var rimraf=require(_0x0f23('0x6'));var config=require(_0x0f23('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x0f23('0x8')]=function(_0x5c78cf,_0x5cb5bf){return _0x5c78cf[_0x0f23('0x9')]('FaxInteraction',attributes,{'tableName':_0x0f23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e4eed,_0x3a2bfe,_0x357270){if(_0x5e4eed[_0x0f23('0xb')](_0x0f23('0xc'))){_0x5e4eed['closedAt']=moment()[_0x0f23('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x357270(null,_0x5e4eed);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index eb3de1e..6187dd1 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 _0x1bad=['UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x1bad,0x191));var _0xd1ba=function(_0x1714bd,_0x57fc75){_0x1714bd=_0x1714bd-0x0;var _0x3015c6=_0x1bad[_0x1714bd];return _0x3015c6;};'use strict';var _=require('lodash');var util=require(_0xd1ba('0x0'));var moment=require('moment');var BPromise=require(_0xd1ba('0x1'));var rs=require(_0xd1ba('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1ba('0x3'))['db'];var utils=require(_0xd1ba('0x4'));var logger=require(_0xd1ba('0x5'))(_0xd1ba('0x6'));var config=require(_0xd1ba('0x7'));var jayson=require(_0xd1ba('0x8'));var client=jayson[_0xd1ba('0x9')][_0xd1ba('0xa')]({'port':0x232a});config[_0xd1ba('0xb')]=_[_0xd1ba('0xc')](config[_0xd1ba('0xb')],{'host':_0xd1ba('0xd'),'port':0x18eb});var socket=require(_0xd1ba('0xe'))(new Redis(config[_0xd1ba('0xb')]));require(_0xd1ba('0xf'))[_0xd1ba('0x10')](socket);function respondWithRpcPromise(_0x15fe62,_0x1e5e2c,_0x16899d){return new BPromise(function(_0x33b491,_0x51b3ca){return client[_0xd1ba('0x11')](_0x15fe62,_0x16899d)[_0xd1ba('0x12')](function(_0x11ebed){logger[_0xd1ba('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x1e5e2c,_0xd1ba('0x14'));logger[_0xd1ba('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1e5e2c,_0xd1ba('0x14'),JSON[_0xd1ba('0x16')](_0x11ebed));if(_0x11ebed['error']){if(_0x11ebed[_0xd1ba('0x17')][_0xd1ba('0x18')]===0x1f4){logger['error'](_0xd1ba('0x19'),_0x1e5e2c,_0x11ebed[_0xd1ba('0x17')][_0xd1ba('0x1a')]);return _0x51b3ca(_0x11ebed['error'][_0xd1ba('0x1a')]);}logger[_0xd1ba('0x17')](_0xd1ba('0x19'),_0x1e5e2c,_0x11ebed['error']['message']);return _0x33b491(_0x11ebed['error']['message']);}else{logger[_0xd1ba('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x1e5e2c,_0xd1ba('0x14'));_0x33b491(_0x11ebed[_0xd1ba('0x1b')][_0xd1ba('0x1a')]);}})[_0xd1ba('0x1c')](function(_0x17a448){logger[_0xd1ba('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x1e5e2c,_0x17a448);_0x51b3ca(_0x17a448);});});}exports[_0xd1ba('0x1d')]=function(_0x335617){var _0xfe0756=this;return new Promise(function(_0x31712b,_0x5b4170){return db[_0xd1ba('0x1e')][_0xd1ba('0x1f')](_0x335617[_0xd1ba('0x20')],{'raw':_0x335617[_0xd1ba('0x21')]?_0x335617[_0xd1ba('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x335617[_0xd1ba('0x21')]?_0x335617[_0xd1ba('0x21')][_0xd1ba('0x22')]||null:null,'attributes':_0x335617[_0xd1ba('0x21')]?_0x335617['options'][_0xd1ba('0x23')]||null:null,'limit':_0x335617[_0xd1ba('0x21')]?_0x335617[_0xd1ba('0x21')][_0xd1ba('0x24')]||null:null})[_0xd1ba('0x12')](function(_0x254d72){logger[_0xd1ba('0x13')]('UpdateFaxInteraction',_0x335617);logger[_0xd1ba('0x15')]('UpdateFaxInteraction',_0x335617,JSON[_0xd1ba('0x16')](_0x254d72));_0x31712b(_0x254d72);})[_0xd1ba('0x1c')](function(_0x47f317){logger[_0xd1ba('0x17')](_0xd1ba('0x1d'),_0x47f317[_0xd1ba('0x1a')],_0x335617);_0x5b4170(_0xfe0756[_0xd1ba('0x17')](0x1f4,_0x47f317[_0xd1ba('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2bad64){return new Promise(function(_0x9626f3,_0x4f198b){return db[_0xd1ba('0x1e')][_0xd1ba('0x25')]({'where':_0x2bad64['options']?_0x2bad64['options']['where']||null:null})['then'](function(_0x3f5b11){if(_0x3f5b11){return _0x3f5b11[_0xd1ba('0x26')](_0x2bad64['body'][_0xd1ba('0x27')],_[_0xd1ba('0x28')](_0x2bad64[_0xd1ba('0x20')],[_0xd1ba('0x27'),'id'])||{});}})[_0xd1ba('0x29')](function(_0xc1ffe9){logger[_0xd1ba('0x13')](_0xd1ba('0x2a'),_0x2bad64);logger[_0xd1ba('0x15')](_0xd1ba('0x2a'),_0x2bad64,JSON['stringify'](_0xc1ffe9));_0x9626f3(_0xc1ffe9);})[_0xd1ba('0x1c')](function(_0x47a3f1){logger['error']('AddTags',_0x47a3f1['message'],_0x2bad64);_0x4f198b(_this[_0xd1ba('0x17')](0x1f4,_0x47a3f1[_0xd1ba('0x1a')]));});});}; \ No newline at end of file +var _0xe13a=['http','redis','defaults','localhost','socket.io-emitter','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','FaxInteraction','update','body','options','raw','where','attributes','limit','UpdateFaxInteraction','catch','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1236df,_0x257758){var _0x21aa07=function(_0x4ab42b){while(--_0x4ab42b){_0x1236df['push'](_0x1236df['shift']());}};_0x21aa07(++_0x257758);}(_0xe13a,0x1ed));var _0xae13=function(_0x275f05,_0x1e581a){_0x275f05=_0x275f05-0x0;var _0xfcf997=_0xe13a[_0x275f05];return _0xfcf997;};'use strict';var _=require(_0xae13('0x0'));var util=require(_0xae13('0x1'));var moment=require(_0xae13('0x2'));var BPromise=require(_0xae13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae13('0x4'));var db=require(_0xae13('0x5'))['db'];var utils=require(_0xae13('0x6'));var logger=require(_0xae13('0x7'))(_0xae13('0x8'));var config=require(_0xae13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});config[_0xae13('0xc')]=_[_0xae13('0xd')](config[_0xae13('0xc')],{'host':_0xae13('0xe'),'port':0x18eb});var socket=require(_0xae13('0xf'))(new Redis(config[_0xae13('0xc')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2ff4bf,_0x590974,_0x54f3a9){return new BPromise(function(_0x502b3f,_0x2e3cad){return client[_0xae13('0x10')](_0x2ff4bf,_0x54f3a9)[_0xae13('0x11')](function(_0x206e04){logger['info'](_0xae13('0x12'),_0x590974,_0xae13('0x13'));logger[_0xae13('0x14')](_0xae13('0x15'),_0x590974,'request\x20sent',JSON[_0xae13('0x16')](_0x206e04));if(_0x206e04[_0xae13('0x17')]){if(_0x206e04[_0xae13('0x17')]['code']===0x1f4){logger[_0xae13('0x17')](_0xae13('0x12'),_0x590974,_0x206e04['error'][_0xae13('0x18')]);return _0x2e3cad(_0x206e04[_0xae13('0x17')][_0xae13('0x18')]);}logger['error'](_0xae13('0x12'),_0x590974,_0x206e04['error'][_0xae13('0x18')]);return _0x502b3f(_0x206e04[_0xae13('0x17')][_0xae13('0x18')]);}else{logger[_0xae13('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x590974,_0xae13('0x13'));_0x502b3f(_0x206e04[_0xae13('0x1a')]['message']);}})['catch'](function(_0x2a1554){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x590974,_0x2a1554);_0x2e3cad(_0x2a1554);});});}exports['UpdateFaxInteraction']=function(_0x460fcd){var _0x41dcbf=this;return new Promise(function(_0x44ede3,_0x4f11e8){return db[_0xae13('0x1b')][_0xae13('0x1c')](_0x460fcd[_0xae13('0x1d')],{'raw':_0x460fcd[_0xae13('0x1e')]?_0x460fcd[_0xae13('0x1e')][_0xae13('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460fcd[_0xae13('0x1e')]?_0x460fcd[_0xae13('0x1e')][_0xae13('0x20')]||null:null,'attributes':_0x460fcd[_0xae13('0x1e')]?_0x460fcd[_0xae13('0x1e')][_0xae13('0x21')]||null:null,'limit':_0x460fcd['options']?_0x460fcd[_0xae13('0x1e')][_0xae13('0x22')]||null:null})[_0xae13('0x11')](function(_0x462951){logger[_0xae13('0x19')](_0xae13('0x23'),_0x460fcd);logger[_0xae13('0x14')](_0xae13('0x23'),_0x460fcd,JSON[_0xae13('0x16')](_0x462951));_0x44ede3(_0x462951);})[_0xae13('0x24')](function(_0x4a8ae2){logger[_0xae13('0x17')](_0xae13('0x23'),_0x4a8ae2['message'],_0x460fcd);_0x4f11e8(_0x41dcbf[_0xae13('0x17')](0x1f4,_0x4a8ae2[_0xae13('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x18f7d0){return new Promise(function(_0x1b728c,_0x3e3e78){return db['FaxInteraction'][_0xae13('0x25')]({'where':_0x18f7d0[_0xae13('0x1e')]?_0x18f7d0[_0xae13('0x1e')][_0xae13('0x20')]||null:null})[_0xae13('0x11')](function(_0x56a4db){if(_0x56a4db){return _0x56a4db[_0xae13('0x26')](_0x18f7d0['body'][_0xae13('0x27')],_['omit'](_0x18f7d0['body'],[_0xae13('0x27'),'id'])||{});}})[_0xae13('0x28')](function(_0x4a65d0){logger['info'](_0xae13('0x29'),_0x18f7d0);logger[_0xae13('0x14')](_0xae13('0x29'),_0x18f7d0,JSON[_0xae13('0x16')](_0x4a65d0));_0x1b728c(_0x4a65d0);})[_0xae13('0x24')](function(_0x139e08){logger[_0xae13('0x17')]('AddTags',_0x139e08[_0xae13('0x18')],_0x18f7d0);_0x3e3e78(_this[_0xae13('0x17')](0x1f4,_0x139e08['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 514e555..a7c878b 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 _0x95c0=['register','faxInteraction:','update','removeListener'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x95c0,0x19a));var _0x095c=function(_0x3af62b,_0x16c9eb){_0x3af62b=_0x3af62b-0x0;var _0x531e92=_0x95c0[_0x3af62b];return _0x531e92;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove',_0x095c('0x0')];function createListener(_0xb26715,_0x21eb70){return function(_0x5f5132){_0x21eb70['emit'](_0xb26715,_0x5f5132);};}function removeListener(_0x58d59e,_0x438e39){return function(){FaxInteractionEvents[_0x095c('0x1')](_0x58d59e,_0x438e39);};}exports[_0x095c('0x2')]=function(_0x336cc1){for(var _0x1f79cc=0x0,_0x3eddb9=events['length'];_0x1f79cc<_0x3eddb9;_0x1f79cc++){var _0x1d498d=events[_0x1f79cc];var _0x4dd539=createListener(_0x095c('0x3')+_0x1d498d,_0x336cc1);FaxInteractionEvents['on'](_0x1d498d,_0x4dd539);}}; \ No newline at end of file +var _0x1dc1=['faxInteraction:','./faxInteraction.events','save','remove','removeListener'];(function(_0xd18983,_0x2b573b){var _0x378278=function(_0x332e5f){while(--_0x332e5f){_0xd18983['push'](_0xd18983['shift']());}};_0x378278(++_0x2b573b);}(_0x1dc1,0xd3));var _0x11dc=function(_0x5f42b4,_0x30a60f){_0x5f42b4=_0x5f42b4-0x0;var _0x28d226=_0x1dc1[_0x5f42b4];return _0x28d226;};'use strict';var FaxInteractionEvents=require(_0x11dc('0x0'));var events=[_0x11dc('0x1'),_0x11dc('0x2'),'update'];function createListener(_0x57f7f2,_0x517007){return function(_0x2b6520){_0x517007['emit'](_0x57f7f2,_0x2b6520);};}function removeListener(_0x390b9b,_0x1c79d4){return function(){FaxInteractionEvents[_0x11dc('0x3')](_0x390b9b,_0x1c79d4);};}exports['register']=function(_0x15d854){for(var _0x20944d=0x0,_0x27dcac=events['length'];_0x20944d<_0x27dcac;_0x20944d++){var _0x132dd7=events[_0x20944d];var _0xaae3ef=createListener(_0x11dc('0x4')+_0x132dd7,_0x15d854);FaxInteractionEvents['on'](_0x132dd7,_0xaae3ef);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 70569e4..025896e 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 _0x3006=['/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','addTags','delete','faxinteraction:destroy','exports','util','express','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x57e76b,_0x4154d2){var _0x3bcafa=function(_0xd585af){while(--_0xd585af){_0x57e76b['push'](_0x57e76b['shift']());}};_0x3bcafa(++_0x4154d2);}(_0x3006,0xff));var _0x6300=function(_0x112a0e,_0x31013c){_0x112a0e=_0x112a0e-0x0;var _0x42824a=_0x3006[_0x112a0e];return _0x42824a;};'use strict';var multer=require('multer');var util=require(_0x6300('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6300('0x1'));var router=express['Router']();var fs_extra=require(_0x6300('0x2'));var auth=require(_0x6300('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6300('0x4'));router[_0x6300('0x5')]('/',auth[_0x6300('0x6')](),controller[_0x6300('0x7')]);router[_0x6300('0x5')](_0x6300('0x8'),auth[_0x6300('0x6')](),controller['describe']);router[_0x6300('0x5')](_0x6300('0x9'),auth[_0x6300('0x6')](),controller['show']);router[_0x6300('0x5')](_0x6300('0xa'),auth[_0x6300('0x6')](),controller[_0x6300('0xb')]);router['get'](_0x6300('0xc'),auth[_0x6300('0x6')](),controller[_0x6300('0xd')]);router[_0x6300('0xe')]('/',auth['isAuthenticated'](),controller[_0x6300('0xf')]);router[_0x6300('0xe')](_0x6300('0xa'),auth[_0x6300('0x6')](),controller[_0x6300('0x10')]);router['post'](_0x6300('0x11'),auth['isAuthenticated'](),interaction[_0x6300('0x12')](_0x6300('0x13'),'faxinteraction:addtags'),controller[_0x6300('0x14')]);router['put'](_0x6300('0x9'),auth['isAuthenticated'](),interaction[_0x6300('0x12')](_0x6300('0x13'),'faxinteraction:update'),controller['update']);router[_0x6300('0x15')](_0x6300('0x9'),auth[_0x6300('0x6')](),interaction[_0x6300('0x12')](_0x6300('0x13'),_0x6300('0x16')),controller['destroy']);router[_0x6300('0x15')](_0x6300('0x11'),auth['isAuthenticated'](),controller['removeTags']);module[_0x6300('0x17')]=router; \ No newline at end of file +var _0xb828=['/:id/tags','tracked','fax','addTags','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/:id','isAuthenticated','show','/:id/messages','getMessages','download','post','create','addMessage'];(function(_0x538380,_0x574b01){var _0xa647cc=function(_0x19ea22){while(--_0x19ea22){_0x538380['push'](_0x538380['shift']());}};_0xa647cc(++_0x574b01);}(_0xb828,0x120));var _0x8b82=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xb828[_0x4b2cc6];return _0x3e0b08;};'use strict';var multer=require(_0x8b82('0x0'));var util=require(_0x8b82('0x1'));var path=require(_0x8b82('0x2'));var timeout=require(_0x8b82('0x3'));var express=require(_0x8b82('0x4'));var router=express[_0x8b82('0x5')]();var fs_extra=require(_0x8b82('0x6'));var auth=require(_0x8b82('0x7'));var interaction=require(_0x8b82('0x8'));var config=require(_0x8b82('0x9'));var controller=require(_0x8b82('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b82('0xb')]);router[_0x8b82('0xc')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8b82('0xc')](_0x8b82('0xd'),auth[_0x8b82('0xe')](),controller[_0x8b82('0xf')]);router[_0x8b82('0xc')](_0x8b82('0x10'),auth[_0x8b82('0xe')](),controller[_0x8b82('0x11')]);router[_0x8b82('0xc')]('/:id/download',auth[_0x8b82('0xe')](),controller[_0x8b82('0x12')]);router[_0x8b82('0x13')]('/',auth['isAuthenticated'](),controller[_0x8b82('0x14')]);router['post'](_0x8b82('0x10'),auth[_0x8b82('0xe')](),controller[_0x8b82('0x15')]);router[_0x8b82('0x13')](_0x8b82('0x16'),auth['isAuthenticated'](),interaction[_0x8b82('0x17')](_0x8b82('0x18'),'faxinteraction:addtags'),controller[_0x8b82('0x19')]);router['put'](_0x8b82('0xd'),auth[_0x8b82('0xe')](),interaction['tracked'](_0x8b82('0x18'),'faxinteraction:update'),controller[_0x8b82('0x1a')]);router[_0x8b82('0x1b')](_0x8b82('0xd'),auth[_0x8b82('0xe')](),interaction[_0x8b82('0x17')](_0x8b82('0x18'),'faxinteraction:destroy'),controller[_0x8b82('0x1c')]);router[_0x8b82('0x1b')](_0x8b82('0x16'),auth['isAuthenticated'](),controller[_0x8b82('0x1d')]);module[_0x8b82('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bc06b0a..8f5a5b6 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 _0xedd9=['exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0xedd9,0xfc));var _0x9edd=function(_0x4836a6,_0x32a746){_0x4836a6=_0x4836a6-0x0;var _0x5bfaf3=_0xedd9[_0x4836a6];return _0x5bfaf3;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'body':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9edd('0x4')]('in',_0x9edd('0x5')),'defaultValue':_0x9edd('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9edd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4a81=['DATE','sequelize','exports','TEXT','medium','out'];(function(_0x42ac20,_0x21a33b){var _0x5a7862=function(_0x36a3ec){while(--_0x36a3ec){_0x42ac20['push'](_0x42ac20['shift']());}};_0x5a7862(++_0x21a33b);}(_0x4a81,0x1b7));var _0x14a8=function(_0x1a8627,_0x534868){_0x1a8627=_0x1a8627-0x0;var _0x33073f=_0x4a81[_0x1a8627];return _0x33073f;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'body':{'type':Sequelize[_0x14a8('0x2')](_0x14a8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14a8('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x14a8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x14a8('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c277355..daf95b7 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 _0x5073=['fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','include','findAll','rows','show','params','options','find','update','body','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','reject','role','rejectMessage','internal','interface','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','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','end','json','limit','count','offset','status','set','Content-Range','apply','save','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x548c46,_0x544328){var _0x475a20=function(_0x1c2254){while(--_0x1c2254){_0x548c46['push'](_0x548c46['shift']());}};_0x475a20(++_0x544328);}(_0x5073,0xda));var _0x3507=function(_0xedad0f,_0xd2a73d){_0xedad0f=_0xedad0f-0x0;var _0x1d657e=_0x5073[_0xedad0f];return _0x1d657e;};'use strict';var emlformat=require(_0x3507('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3507('0x1'));var moment=require(_0x3507('0x2'));var BPromise=require(_0x3507('0x3'));var Mustache=require(_0x3507('0x4'));var util=require(_0x3507('0x5'));var path=require(_0x3507('0x6'));var sox=require(_0x3507('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3507('0x8'));var squel=require(_0x3507('0x9'));var crypto=require(_0x3507('0xa'));var jsforce=require(_0x3507('0xb'));var deskjs=require(_0x3507('0xc'));var toCsv=require(_0x3507('0xd'));var querystring=require('querystring');var Papa=require(_0x3507('0xe'));var Redis=require(_0x3507('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3507('0x10'));var as=require(_0x3507('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3507('0x12'))('api');var utils=require(_0x3507('0x13'));var config=require(_0x3507('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3507('0x15'))['db'];config[_0x3507('0x16')]=_[_0x3507('0x17')](config[_0x3507('0x16')],{'host':_0x3507('0x18'),'port':0x18eb});var socket=require(_0x3507('0x19'))(new Redis(config[_0x3507('0x16')]));require(_0x3507('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3507('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x3507('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4ba228,_0xd1fa1d,_0x5e992f,_0x33baad){return new BPromise(function(_0x101fdb,_0x360e78){var _0x18ddb2=_0x33baad||client;return _0x18ddb2[_0x3507('0x1c')](_0x4ba228,_0x5e992f)[_0x3507('0x1d')](function(_0x2fe29d){logger[_0x3507('0x1e')](_0x3507('0x1f'),_0xd1fa1d,_0x3507('0x20'));logger[_0x3507('0x21')](_0x3507('0x22'),_0xd1fa1d,_0x3507('0x20'),JSON[_0x3507('0x23')](_0x2fe29d));if(_0x2fe29d[_0x3507('0x24')]){if(_0x2fe29d[_0x3507('0x24')][_0x3507('0x25')]===0x1f4){logger[_0x3507('0x24')]('FaxMessage,\x20%s,\x20%s',_0xd1fa1d,_0x2fe29d[_0x3507('0x24')]['message']);return _0x360e78(_0x2fe29d[_0x3507('0x24')]['message']);}logger[_0x3507('0x24')]('FaxMessage,\x20%s,\x20%s',_0xd1fa1d,_0x2fe29d[_0x3507('0x24')][_0x3507('0x26')]);return _0x101fdb(_0x2fe29d['error'][_0x3507('0x26')]);}else{logger[_0x3507('0x1e')](_0x3507('0x1f'),_0xd1fa1d,_0x3507('0x20'));_0x101fdb(_0x2fe29d[_0x3507('0x27')][_0x3507('0x26')]);}})[_0x3507('0x28')](function(_0x5d59bc){logger[_0x3507('0x24')](_0x3507('0x1f'),_0xd1fa1d,_0x5d59bc);_0x360e78(_0x5d59bc);});});}function respondWithStatusCode(_0x72e55d,_0x394fbb){_0x394fbb=_0x394fbb||0xcc;return function(_0x1eb9b5){if(_0x1eb9b5){return _0x72e55d[_0x3507('0x29')](_0x394fbb);}return _0x72e55d['status'](_0x394fbb)[_0x3507('0x2a')]();};}function respondWithResult(_0x5e3e83,_0x3aa5ac){_0x3aa5ac=_0x3aa5ac||0xc8;return function(_0x54299b){if(_0x54299b){return _0x5e3e83['status'](_0x3aa5ac)[_0x3507('0x2b')](_0x54299b);}};}function respondWithFilteredResult(_0x55e95a,_0x26bc3a){return function(_0x3b1219){if(_0x3b1219){var _0x2d8595=typeof _0x26bc3a['offset']==='undefined'&&typeof _0x26bc3a[_0x3507('0x2c')]==='undefined';var _0x57c0e9=_0x3b1219[_0x3507('0x2d')];var _0x275529=_0x2d8595?0x0:_0x26bc3a[_0x3507('0x2e')];var _0x185d06=_0x2d8595?_0x3b1219[_0x3507('0x2d')]:_0x26bc3a[_0x3507('0x2e')]+_0x26bc3a[_0x3507('0x2c')];var _0x31403f;if(_0x185d06>=_0x57c0e9){_0x185d06=_0x57c0e9;_0x31403f=0xc8;}else{_0x31403f=0xce;}_0x55e95a[_0x3507('0x2f')](_0x31403f);return _0x55e95a[_0x3507('0x30')](_0x3507('0x31'),_0x275529+'-'+_0x185d06+'/'+_0x57c0e9)['json'](_0x3b1219);}return null;};}function patchUpdates(_0x58c5bb){return function(_0x1093ac){try{jsonpatch[_0x3507('0x32')](_0x1093ac,_0x58c5bb,!![]);}catch(_0x12b05d){return BPromise['reject'](_0x12b05d);}return _0x1093ac[_0x3507('0x33')]();};}function saveUpdates(_0x7a0d6c,_0x4d7932){return function(_0x56ecec){if(_0x56ecec){return _0x56ecec['update'](_0x7a0d6c)[_0x3507('0x1d')](function(_0x28f921){return _0x28f921;});}return null;};}function removeEntity(_0x168f99,_0x5cd453){return function(_0x42aa72){if(_0x42aa72){return _0x42aa72[_0x3507('0x34')]()[_0x3507('0x1d')](function(){_0x168f99[_0x3507('0x2f')](0xcc)[_0x3507('0x2a')]();});}};}function handleEntityNotFound(_0x39f77a,_0x2c8b2a){return function(_0x5ce71f){if(!_0x5ce71f){_0x39f77a[_0x3507('0x29')](0x194);}return _0x5ce71f;};}function handleError(_0xd71dd1,_0x562a1d){_0x562a1d=_0x562a1d||0x1f4;return function(_0x22f64b){logger['error'](_0x22f64b[_0x3507('0x35')]);if(_0x22f64b[_0x3507('0x36')]){delete _0x22f64b['name'];}_0xd71dd1['status'](_0x562a1d)[_0x3507('0x37')](_0x22f64b);};}exports[_0x3507('0x38')]=function(_0x1e7cf9,_0x4430a6){var _0x11a443={},_0x325bb9={},_0x52a461={'count':0x0,'rows':[]};var _0x2d91fa=_[_0x3507('0x39')](db[_0x3507('0x3a')][_0x3507('0x3b')],function(_0x2c67f4){return{'name':_0x2c67f4['fieldName'],'type':_0x2c67f4[_0x3507('0x3c')][_0x3507('0x3d')]};});_0x325bb9[_0x3507('0x3e')]=_['map'](_0x2d91fa,'name');_0x325bb9[_0x3507('0x3f')]=_[_0x3507('0x40')](_0x1e7cf9['query']);_0x325bb9[_0x3507('0x41')]=_['intersection'](_0x325bb9['model'],_0x325bb9[_0x3507('0x3f')]);_0x11a443[_0x3507('0x42')]=_[_0x3507('0x43')](_0x325bb9[_0x3507('0x3e')],qs['fields'](_0x1e7cf9['query'][_0x3507('0x44')]));_0x11a443['attributes']=_0x11a443['attributes'][_0x3507('0x45')]?_0x11a443[_0x3507('0x42')]:_0x325bb9['model'];if(!_0x1e7cf9['query'][_0x3507('0x46')](_0x3507('0x47'))){_0x11a443['limit']=qs[_0x3507('0x2c')](_0x1e7cf9[_0x3507('0x3f')]['limit']);_0x11a443[_0x3507('0x2e')]=qs['offset'](_0x1e7cf9[_0x3507('0x3f')][_0x3507('0x2e')]);}_0x11a443['order']=qs[_0x3507('0x48')](_0x1e7cf9['query'][_0x3507('0x48')]);_0x11a443['where']=qs['filters'](_[_0x3507('0x49')](_0x1e7cf9[_0x3507('0x3f')],_0x325bb9[_0x3507('0x41')]),_0x2d91fa);if(_0x1e7cf9[_0x3507('0x3f')][_0x3507('0x4a')]){_0x11a443['where']=_[_0x3507('0x4b')](_0x11a443[_0x3507('0x4c')],{'$or':_[_0x3507('0x39')](_0x2d91fa,function(_0x2d3d47){if(_0x2d3d47[_0x3507('0x3c')]!=='VIRTUAL'){var _0x205ca2={};_0x205ca2[_0x2d3d47['name']]={'$like':'%'+_0x1e7cf9[_0x3507('0x3f')]['filter']+'%'};return _0x205ca2;}})});}_0x11a443=_[_0x3507('0x4b')]({},_0x11a443,_0x1e7cf9['options']);var _0x174c42={'where':_0x11a443[_0x3507('0x4c')]};return db[_0x3507('0x3a')][_0x3507('0x2d')](_0x174c42)[_0x3507('0x1d')](function(_0x4d0770){_0x52a461[_0x3507('0x2d')]=_0x4d0770;if(_0x1e7cf9[_0x3507('0x3f')]['includeAll']){_0x11a443[_0x3507('0x4d')]=[{'all':!![]}];}return db[_0x3507('0x3a')][_0x3507('0x4e')](_0x11a443);})[_0x3507('0x1d')](function(_0xc73929){_0x52a461[_0x3507('0x4f')]=_0xc73929;return _0x52a461;})['then'](respondWithFilteredResult(_0x4430a6,_0x11a443))[_0x3507('0x28')](handleError(_0x4430a6,null));};exports[_0x3507('0x50')]=function(_0x3338f0,_0x3e3910){var _0x42f73c={'raw':!![],'where':{'id':_0x3338f0[_0x3507('0x51')]['id']}},_0x4f16f5={};_0x4f16f5[_0x3507('0x3e')]=_[_0x3507('0x40')](db[_0x3507('0x3a')][_0x3507('0x3b')]);_0x4f16f5[_0x3507('0x3f')]=_['keys'](_0x3338f0[_0x3507('0x3f')]);_0x4f16f5['filters']=_[_0x3507('0x43')](_0x4f16f5[_0x3507('0x3e')],_0x4f16f5['query']);_0x42f73c[_0x3507('0x42')]=_[_0x3507('0x43')](_0x4f16f5['model'],qs[_0x3507('0x44')](_0x3338f0['query'][_0x3507('0x44')]));_0x42f73c[_0x3507('0x42')]=_0x42f73c[_0x3507('0x42')]['length']?_0x42f73c[_0x3507('0x42')]:_0x4f16f5[_0x3507('0x3e')];if(_0x3338f0[_0x3507('0x3f')]['includeAll']){_0x42f73c['include']=[{'all':!![]}];}_0x42f73c=_[_0x3507('0x4b')]({},_0x42f73c,_0x3338f0[_0x3507('0x52')]);return db[_0x3507('0x3a')][_0x3507('0x53')](_0x42f73c)[_0x3507('0x1d')](handleEntityNotFound(_0x3e3910,null))[_0x3507('0x1d')](respondWithResult(_0x3e3910,null))[_0x3507('0x28')](handleError(_0x3e3910,null));};exports[_0x3507('0x54')]=function(_0x5069d0,_0x43f941){if(_0x5069d0[_0x3507('0x55')]['id']){delete _0x5069d0['body']['id'];}return db['FaxMessage'][_0x3507('0x53')]({'where':{'id':_0x5069d0[_0x3507('0x51')]['id']}})['then'](handleEntityNotFound(_0x43f941,null))[_0x3507('0x1d')](saveUpdates(_0x5069d0[_0x3507('0x55')],null))[_0x3507('0x1d')](respondWithResult(_0x43f941,null))[_0x3507('0x28')](handleError(_0x43f941,null));};exports[_0x3507('0x34')]=function(_0x518405,_0x323a34){return db['FaxMessage']['find']({'where':{'id':_0x518405[_0x3507('0x51')]['id']}})[_0x3507('0x1d')](handleEntityNotFound(_0x323a34,null))[_0x3507('0x1d')](removeEntity(_0x323a34,null))[_0x3507('0x28')](handleError(_0x323a34,null));};exports[_0x3507('0x56')]=function(_0x40161e,_0x452d95){return db[_0x3507('0x3a')][_0x3507('0x56')]()[_0x3507('0x1d')](respondWithResult(_0x452d95,null))[_0x3507('0x28')](handleError(_0x452d95,null));};var interaction_log=require(_0x3507('0x12'))('fax-interactions');exports[_0x3507('0x57')]=function(_0x549ed3,_0x25b394,_0x22337b){var _0x3cff1e={'agent':{},'channel':_0x3507('0x58')};if(_0x549ed3[_0x3507('0x55')]['id']){delete _0x549ed3[_0x3507('0x55')]['id'];}_0x549ed3[_0x3507('0x55')][_0x3507('0x59')]=!![];_0x549ed3[_0x3507('0x55')][_0x3507('0x5a')]=moment()[_0x3507('0x5b')](_0x3507('0x5c'));_0x549ed3['body'][_0x3507('0x5d')]=_0x549ed3[_0x3507('0x55')][_0x3507('0x5d')]||_0x549ed3[_0x3507('0x5e')]['id'];_0x3cff1e[_0x3507('0x5f')]['id']=_0x549ed3['body'][_0x3507('0x5d')];return db[_0x3507('0x3a')]['find']({'where':{'id':_0x549ed3[_0x3507('0x51')]['id'],'UserId':null}})[_0x3507('0x1d')](handleEntityNotFound(_0x25b394,null))[_0x3507('0x1d')](saveUpdates(_0x549ed3[_0x3507('0x55')],null))['then'](function(_0x1db8a2){if(_0x1db8a2){_0x3cff1e[_0x3507('0x26')]=_0x1db8a2[_0x3507('0x60')]({'plain':!![]});return db[_0x3507('0x61')][_0x3507('0x53')]({'where':{'id':_0x1db8a2[_0x3507('0x62')]}});}return null;})[_0x3507('0x1d')](handleEntityNotFound(_0x25b394,null))[_0x3507('0x1d')](function(_0x263c03){if(_0x263c03){return _0x263c03[_0x3507('0x54')]({'UserId':_0x549ed3['body'][_0x3507('0x5d')],'read1stAt':_[_0x3507('0x63')](_0x263c03[_0x3507('0x64')])?moment()[_0x3507('0x5b')](_0x3507('0x5c')):undefined});}return null;})[_0x3507('0x1d')](function(_0x292836){if(_0x292836){_0x3cff1e['interaction']=_0x292836['get']({'plain':!![]});interaction_log[_0x3507('0x1e')](_0x3507('0x65'),_0x549ed3['user']['id'],_0x549ed3['user'][_0x3507('0x36')],_0x549ed3['user']['role'],_0x3cff1e[_0x3507('0x66')]['id'],_0x549ed3[_0x3507('0x55')]?JSON['stringify'](_0x549ed3[_0x3507('0x55')]):_0x3507('0x67'));return respondWithRpcPromise('AcceptMessage',_0x3507('0x68'),_0x3cff1e);}return null;})[_0x3507('0x1d')](function(_0x34ff7f){var _0x689007=_0x3507('0x69')+_0x34ff7f[_0x3507('0x26')][_0x3507('0x6a')];return db[_0x3507('0x6b')]['query'](_0x689007,{'type':db[_0x3507('0x6c')][_0x3507('0x6d')][_0x3507('0x6e')],'raw':!![]})[_0x3507('0x1d')](function(_0x306ba2){return _0x306ba2;});})[_0x3507('0x1d')](function(_0x3b645c){if(_0x3b645c){_0x3cff1e[_0x3507('0x26')][_0x3507('0x6f')]=_0x3b645c[0x0];if(!_0x549ed3[_0x3507('0x55')]['UserId'])return;return db[_0x3507('0x70')][_0x3507('0x53')]({'where':{'id':_0x549ed3[_0x3507('0x55')][_0x3507('0x5d')],'role':_0x3507('0x5f')},'attributes':['id',_0x3507('0x36'),_0x3507('0x71'),_0x3507('0x72'),'internal'],'raw':!![]});}return null;})[_0x3507('0x1d')](function(_0x3e0ae1){if(!_0x3e0ae1)return null;_0x3cff1e[_0x3507('0x26')][_0x3507('0x5f')]=_0x3e0ae1;return _0x3cff1e;})[_0x3507('0x1d')](function(_0x4f5406){if(_0x4f5406){if(_0x549ed3[_0x3507('0x55')][_0x3507('0x73')]){_0x3cff1e[_0x3507('0x26')]['interface']=util[_0x3507('0x5b')](_0x3507('0x74'),_0x549ed3[_0x3507('0x5e')]['name']);_0x3cff1e['message'][_0x3507('0x75')]=_0x3cff1e[_0x3507('0x75')];_0x3cff1e[_0x3507('0x26')][_0x3507('0x76')]=_0x3cff1e[_0x3507('0x75')];_0x3cff1e[_0x3507('0x26')][_0x3507('0x77')]=_0x3507('0x57');return respondWithRpcPromise(_0x3507('0x78'),_0x3507('0x78'),{'event':_0x3507('0x79'),'message':_0x3cff1e[_0x3507('0x26')]},client9002)[_0x3507('0x1d')](function(){return _0x3cff1e;});}return _0x3cff1e;}return null;})[_0x3507('0x1d')](respondWithResult(_0x25b394,null))[_0x3507('0x28')](handleError(_0x25b394,null));};var interaction_log=require(_0x3507('0x12'))(_0x3507('0x7a'));exports[_0x3507('0x7b')]=function(_0x32fea4,_0x499bf7,_0x2901ef){var _0x19e066={'agent':{},'channel':_0x3507('0x58')};if(_0x32fea4['body']['id']){delete _0x32fea4[_0x3507('0x55')]['id'];}_0x32fea4['body'][_0x3507('0x5d')]=_0x32fea4[_0x3507('0x55')][_0x3507('0x5d')]||_0x32fea4['user']['id'];_0x19e066[_0x3507('0x5f')]['id']=_0x32fea4['body']['UserId'];return db[_0x3507('0x3a')][_0x3507('0x53')]({'where':{'id':_0x32fea4['params']['id'],'UserId':null}})[_0x3507('0x1d')](handleEntityNotFound(_0x499bf7,null))[_0x3507('0x1d')](function(_0xdafbed){if(_0xdafbed){_0x19e066['message']=_0xdafbed['get']({'plain':!![]});return db[_0x3507('0x61')][_0x3507('0x53')]({'where':{'id':_0xdafbed[_0x3507('0x62')]}});}return null;})[_0x3507('0x1d')](handleEntityNotFound(_0x499bf7,null))['then'](function(_0x478027){if(_0x478027){_0x19e066[_0x3507('0x66')]=_0x478027[_0x3507('0x60')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x32fea4['user']['id'],_0x32fea4[_0x3507('0x5e')][_0x3507('0x36')],_0x32fea4[_0x3507('0x5e')][_0x3507('0x7c')],_0x19e066[_0x3507('0x66')]['id'],_0x32fea4['body']?JSON['stringify'](_0x32fea4['body']):_0x3507('0x67'));return respondWithRpcPromise('RejectMessage',_0x3507('0x7d'),_0x19e066);}return null;})[_0x3507('0x1d')](function(_0x1de02d){var _0x319958=_0x3507('0x69')+_0x1de02d[_0x3507('0x26')][_0x3507('0x6a')];return db[_0x3507('0x6b')][_0x3507('0x3f')](_0x319958,{'type':db[_0x3507('0x6c')][_0x3507('0x6d')][_0x3507('0x6e')],'raw':!![]})[_0x3507('0x1d')](function(_0x4e7f24){return _0x4e7f24;});})[_0x3507('0x1d')](function(_0x2bdae8){if(_0x2bdae8){_0x19e066[_0x3507('0x26')]['contact']=_0x2bdae8[0x0];if(!_0x32fea4[_0x3507('0x55')]['UserId'])return;return db[_0x3507('0x70')][_0x3507('0x53')]({'where':{'id':_0x32fea4[_0x3507('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x3507('0x36'),_0x3507('0x71'),_0x3507('0x72'),_0x3507('0x7e')],'raw':!![]});}return null;})[_0x3507('0x1d')](function(_0x2acbf7){if(!_0x2acbf7)return null;_0x19e066[_0x3507('0x26')][_0x3507('0x5f')]=_0x2acbf7;return _0x19e066;})[_0x3507('0x1d')](function(_0x2b1db0){if(_0x2b1db0){_0x2b1db0[_0x3507('0x26')][_0x3507('0x7f')]=util[_0x3507('0x5b')]('SIP/%s',_0x32fea4[_0x3507('0x5e')][_0x3507('0x36')]);_0x2b1db0[_0x3507('0x26')][_0x3507('0x75')]=_0x19e066['channel'];_0x2b1db0[_0x3507('0x26')][_0x3507('0x76')]=_0x19e066['channel'];_0x2b1db0[_0x3507('0x26')][_0x3507('0x77')]=_0x3507('0x7b');respondWithRpcPromise('EventManager',_0x3507('0x78'),{'event':'rejectmessage','message':_0x2b1db0[_0x3507('0x26')]},client9002);return _0x19e066;}return null;})[_0x3507('0x1d')](respondWithResult(_0x499bf7,null))[_0x3507('0x28')](handleError(_0x499bf7,null));};exports[_0x3507('0x80')]=function(_0x3f82de,_0x5c6b4f){var _0x5cff08;return db[_0x3507('0x3a')][_0x3507('0x80')](_0x3f82de[_0x3507('0x55')],{})[_0x3507('0x1d')](function(_0x37b83c){_0x5cff08=_0x37b83c;return db[_0x3507('0x81')]['findOne']({'where':{'id':_0x5cff08[_0x3507('0x6a')]}});})[_0x3507('0x1d')](function(_0x20e269){if(_[_0x3507('0x63')](_0x20e269)){return;}else{_0x5cff08['fax']=_0x20e269[_0x3507('0x58')];return db[_0x3507('0x82')][_0x3507('0x83')]({'where':{'id':_0x5cff08[_0x3507('0x84')]}});}})[_0x3507('0x1d')](function(_0x1789aa){return respondWithRpcPromise(_0x3507('0x85'),'SendFax',{'FaxAccountId':_['isNil'](_0x3f82de[_0x3507('0x55')])?undefined:_0x3f82de['body'][_0x3507('0x86')],'path':_['isNil'](_0x1789aa)?undefined:util[_0x3507('0x5b')](_0x3507('0x87'),_0x1789aa[_0x3507('0x88')]),'fax':_[_0x3507('0x63')](_0x5cff08[_0x3507('0x58')])?undefined:_0x5cff08[_0x3507('0x58')],'AttachmentId':_0x5cff08[_0x3507('0x84')]},client9002);})[_0x3507('0x1d')](respondWithResult(_0x5c6b4f,0xc9))[_0x3507('0x28')](handleError(_0x5c6b4f,null));};exports[_0x3507('0x89')]=function(_0x376bb1,_0x5f2d63){var _0x49ac18=path[_0x3507('0x8a')](config[_0x3507('0x8b')],_0x3507('0x8c'),_0x3507('0x8d'),_0x3507('0x8e'));return db[_0x3507('0x3a')][_0x3507('0x53')]({'where':{'id':_0x376bb1[_0x3507('0x51')]['id']},'include':[{'model':db[_0x3507('0x82')],'as':_0x3507('0x82')}]})['then'](handleEntityNotFound(_0x5f2d63,null))[_0x3507('0x1d')](function(_0x3b000f){if(_0x3b000f){return _0x5f2d63[_0x3507('0x89')](path[_0x3507('0x8a')](_0x49ac18,_0x3b000f['Attachment'][_0x3507('0x88')]));}})[_0x3507('0x28')](handleError(_0x5f2d63,null));}; \ No newline at end of file +var _0xa638=['code','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','stack','name','send','map','FaxMessage','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','show','include','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','find','FaxInteractionId','update','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','sequelize','QueryTypes','SELECT','contact','motionChannel','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','download','join','root','server','files','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3822cc,_0x37bfb0){var _0x17c40a=function(_0x55a670){while(--_0x55a670){_0x3822cc['push'](_0x3822cc['shift']());}};_0x17c40a(++_0x37bfb0);}(_0xa638,0x196));var _0x8a63=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa638[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x8a63('0x0'));var rimraf=require(_0x8a63('0x1'));var zipdir=require(_0x8a63('0x2'));var jsonpatch=require(_0x8a63('0x3'));var rp=require(_0x8a63('0x4'));var moment=require(_0x8a63('0x5'));var BPromise=require(_0x8a63('0x6'));var Mustache=require(_0x8a63('0x7'));var util=require(_0x8a63('0x8'));var path=require(_0x8a63('0x9'));var sox=require(_0x8a63('0xa'));var csv=require(_0x8a63('0xb'));var ejs=require(_0x8a63('0xc'));var fs=require('fs');var fs_extra=require(_0x8a63('0xd'));var _=require('lodash');var squel=require(_0x8a63('0xe'));var crypto=require(_0x8a63('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a63('0x10'));var toCsv=require(_0x8a63('0xb'));var querystring=require(_0x8a63('0x11'));var Papa=require(_0x8a63('0x12'));var Redis=require(_0x8a63('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a63('0x14'));var as=require(_0x8a63('0x15'));var hardwareService=require(_0x8a63('0x16'));var logger=require('../../config/logger')(_0x8a63('0x17'));var utils=require(_0x8a63('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8a63('0x19')]=_[_0x8a63('0x1a')](config[_0x8a63('0x19')],{'host':_0x8a63('0x1b'),'port':0x18eb});var socket=require(_0x8a63('0x1c'))(new Redis(config[_0x8a63('0x19')]));require(_0x8a63('0x1d'))[_0x8a63('0x1e')](socket);var jayson=require(_0x8a63('0x1f'));var client=jayson[_0x8a63('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x8a63('0x20')][_0x8a63('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5c51e3,_0x330208,_0x4c7b59,_0xc74fb6){return new BPromise(function(_0x571c7b,_0x12ca19){var _0x10ef75=_0xc74fb6||client;return _0x10ef75[_0x8a63('0x22')](_0x5c51e3,_0x4c7b59)[_0x8a63('0x23')](function(_0x2979e9){logger[_0x8a63('0x24')]('FaxMessage,\x20%s,\x20%s',_0x330208,_0x8a63('0x25'));logger[_0x8a63('0x26')](_0x8a63('0x27'),_0x330208,_0x8a63('0x25'),JSON[_0x8a63('0x28')](_0x2979e9));if(_0x2979e9['error']){if(_0x2979e9['error'][_0x8a63('0x29')]===0x1f4){logger[_0x8a63('0x2a')](_0x8a63('0x2b'),_0x330208,_0x2979e9[_0x8a63('0x2a')][_0x8a63('0x2c')]);return _0x12ca19(_0x2979e9['error']['message']);}logger[_0x8a63('0x2a')](_0x8a63('0x2b'),_0x330208,_0x2979e9[_0x8a63('0x2a')]['message']);return _0x571c7b(_0x2979e9[_0x8a63('0x2a')][_0x8a63('0x2c')]);}else{logger[_0x8a63('0x24')]('FaxMessage,\x20%s,\x20%s',_0x330208,'request\x20sent');_0x571c7b(_0x2979e9[_0x8a63('0x2d')][_0x8a63('0x2c')]);}})[_0x8a63('0x2e')](function(_0x4878e4){logger[_0x8a63('0x2a')](_0x8a63('0x2b'),_0x330208,_0x4878e4);_0x12ca19(_0x4878e4);});});}function respondWithStatusCode(_0x25165c,_0x3aafc6){_0x3aafc6=_0x3aafc6||0xcc;return function(_0x3d1608){if(_0x3d1608){return _0x25165c[_0x8a63('0x2f')](_0x3aafc6);}return _0x25165c[_0x8a63('0x30')](_0x3aafc6)[_0x8a63('0x31')]();};}function respondWithResult(_0x12c9f3,_0x14310b){_0x14310b=_0x14310b||0xc8;return function(_0x57dbdf){if(_0x57dbdf){return _0x12c9f3[_0x8a63('0x30')](_0x14310b)[_0x8a63('0x32')](_0x57dbdf);}};}function respondWithFilteredResult(_0x52cdc2,_0x1f7c23){return function(_0x1c1240){if(_0x1c1240){var _0x1b985b=typeof _0x1f7c23[_0x8a63('0x33')]===_0x8a63('0x34')&&typeof _0x1f7c23['limit']===_0x8a63('0x34');var _0x2f563b=_0x1c1240[_0x8a63('0x35')];var _0x27a2bb=_0x1b985b?0x0:_0x1f7c23['offset'];var _0x523880=_0x1b985b?_0x1c1240[_0x8a63('0x35')]:_0x1f7c23[_0x8a63('0x33')]+_0x1f7c23[_0x8a63('0x36')];var _0x177072;if(_0x523880>=_0x2f563b){_0x523880=_0x2f563b;_0x177072=0xc8;}else{_0x177072=0xce;}_0x52cdc2[_0x8a63('0x30')](_0x177072);return _0x52cdc2[_0x8a63('0x37')](_0x8a63('0x38'),_0x27a2bb+'-'+_0x523880+'/'+_0x2f563b)['json'](_0x1c1240);}return null;};}function patchUpdates(_0x1375c1){return function(_0x5daef2){try{jsonpatch['apply'](_0x5daef2,_0x1375c1,!![]);}catch(_0x30c646){return BPromise[_0x8a63('0x39')](_0x30c646);}return _0x5daef2[_0x8a63('0x3a')]();};}function saveUpdates(_0x5bef6c,_0x2a9ae5){return function(_0x2f5dcb){if(_0x2f5dcb){return _0x2f5dcb['update'](_0x5bef6c)['then'](function(_0x523e09){return _0x523e09;});}return null;};}function removeEntity(_0x29173f,_0x53d3c4){return function(_0x3a97a1){if(_0x3a97a1){return _0x3a97a1[_0x8a63('0x3b')]()[_0x8a63('0x23')](function(){_0x29173f[_0x8a63('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x321aa2,_0x239ce6){return function(_0x101c9b){if(!_0x101c9b){_0x321aa2['sendStatus'](0x194);}return _0x101c9b;};}function handleError(_0x4c9753,_0x496b40){_0x496b40=_0x496b40||0x1f4;return function(_0x4393d2){logger[_0x8a63('0x2a')](_0x4393d2[_0x8a63('0x3c')]);if(_0x4393d2[_0x8a63('0x3d')]){delete _0x4393d2[_0x8a63('0x3d')];}_0x4c9753['status'](_0x496b40)[_0x8a63('0x3e')](_0x4393d2);};}exports['index']=function(_0x13928d,_0xe72cac){var _0x25e6eb={},_0x250ef2={},_0x2474e5={'count':0x0,'rows':[]};var _0x5db382=_[_0x8a63('0x3f')](db[_0x8a63('0x40')][_0x8a63('0x41')],function(_0x502958){return{'name':_0x502958['fieldName'],'type':_0x502958[_0x8a63('0x42')][_0x8a63('0x43')]};});_0x250ef2[_0x8a63('0x44')]=_['map'](_0x5db382,'name');_0x250ef2['query']=_[_0x8a63('0x45')](_0x13928d[_0x8a63('0x46')]);_0x250ef2['filters']=_[_0x8a63('0x47')](_0x250ef2['model'],_0x250ef2[_0x8a63('0x46')]);_0x25e6eb['attributes']=_[_0x8a63('0x47')](_0x250ef2[_0x8a63('0x44')],qs[_0x8a63('0x48')](_0x13928d[_0x8a63('0x46')][_0x8a63('0x48')]));_0x25e6eb[_0x8a63('0x49')]=_0x25e6eb[_0x8a63('0x49')][_0x8a63('0x4a')]?_0x25e6eb['attributes']:_0x250ef2[_0x8a63('0x44')];if(!_0x13928d[_0x8a63('0x46')][_0x8a63('0x4b')](_0x8a63('0x4c'))){_0x25e6eb[_0x8a63('0x36')]=qs[_0x8a63('0x36')](_0x13928d[_0x8a63('0x46')]['limit']);_0x25e6eb['offset']=qs[_0x8a63('0x33')](_0x13928d['query'][_0x8a63('0x33')]);}_0x25e6eb[_0x8a63('0x4d')]=qs['sort'](_0x13928d[_0x8a63('0x46')][_0x8a63('0x4e')]);_0x25e6eb[_0x8a63('0x4f')]=qs[_0x8a63('0x50')](_[_0x8a63('0x51')](_0x13928d[_0x8a63('0x46')],_0x250ef2[_0x8a63('0x50')]),_0x5db382);if(_0x13928d[_0x8a63('0x46')][_0x8a63('0x52')]){_0x25e6eb[_0x8a63('0x4f')]=_['merge'](_0x25e6eb[_0x8a63('0x4f')],{'$or':_[_0x8a63('0x3f')](_0x5db382,function(_0x4665d6){if(_0x4665d6[_0x8a63('0x42')]!=='VIRTUAL'){var _0x199579={};_0x199579[_0x4665d6[_0x8a63('0x3d')]]={'$like':'%'+_0x13928d[_0x8a63('0x46')]['filter']+'%'};return _0x199579;}})});}_0x25e6eb=_[_0x8a63('0x53')]({},_0x25e6eb,_0x13928d[_0x8a63('0x54')]);var _0x269ad9={'where':_0x25e6eb[_0x8a63('0x4f')]};return db[_0x8a63('0x40')][_0x8a63('0x35')](_0x269ad9)[_0x8a63('0x23')](function(_0x4645e2){_0x2474e5[_0x8a63('0x35')]=_0x4645e2;if(_0x13928d[_0x8a63('0x46')][_0x8a63('0x55')]){_0x25e6eb['include']=[{'all':!![]}];}return db[_0x8a63('0x40')][_0x8a63('0x56')](_0x25e6eb);})[_0x8a63('0x23')](function(_0x3b86eb){_0x2474e5[_0x8a63('0x57')]=_0x3b86eb;return _0x2474e5;})['then'](respondWithFilteredResult(_0xe72cac,_0x25e6eb))[_0x8a63('0x2e')](handleError(_0xe72cac,null));};exports[_0x8a63('0x58')]=function(_0x493386,_0x549da6){var _0x464f45={'raw':!![],'where':{'id':_0x493386['params']['id']}},_0x23de2a={};_0x23de2a['model']=_[_0x8a63('0x45')](db[_0x8a63('0x40')]['rawAttributes']);_0x23de2a[_0x8a63('0x46')]=_[_0x8a63('0x45')](_0x493386['query']);_0x23de2a[_0x8a63('0x50')]=_['intersection'](_0x23de2a[_0x8a63('0x44')],_0x23de2a['query']);_0x464f45['attributes']=_[_0x8a63('0x47')](_0x23de2a[_0x8a63('0x44')],qs[_0x8a63('0x48')](_0x493386[_0x8a63('0x46')][_0x8a63('0x48')]));_0x464f45['attributes']=_0x464f45['attributes'][_0x8a63('0x4a')]?_0x464f45[_0x8a63('0x49')]:_0x23de2a[_0x8a63('0x44')];if(_0x493386[_0x8a63('0x46')][_0x8a63('0x55')]){_0x464f45[_0x8a63('0x59')]=[{'all':!![]}];}_0x464f45=_[_0x8a63('0x53')]({},_0x464f45,_0x493386[_0x8a63('0x54')]);return db['FaxMessage']['find'](_0x464f45)[_0x8a63('0x23')](handleEntityNotFound(_0x549da6,null))[_0x8a63('0x23')](respondWithResult(_0x549da6,null))[_0x8a63('0x2e')](handleError(_0x549da6,null));};exports['update']=function(_0x46a4d8,_0x33edb3){if(_0x46a4d8[_0x8a63('0x5a')]['id']){delete _0x46a4d8['body']['id'];}return db[_0x8a63('0x40')]['find']({'where':{'id':_0x46a4d8[_0x8a63('0x5b')]['id']}})['then'](handleEntityNotFound(_0x33edb3,null))[_0x8a63('0x23')](saveUpdates(_0x46a4d8[_0x8a63('0x5a')],null))[_0x8a63('0x23')](respondWithResult(_0x33edb3,null))[_0x8a63('0x2e')](handleError(_0x33edb3,null));};exports[_0x8a63('0x3b')]=function(_0x53b99f,_0x16aef4){return db[_0x8a63('0x40')]['find']({'where':{'id':_0x53b99f[_0x8a63('0x5b')]['id']}})[_0x8a63('0x23')](handleEntityNotFound(_0x16aef4,null))[_0x8a63('0x23')](removeEntity(_0x16aef4,null))[_0x8a63('0x2e')](handleError(_0x16aef4,null));};exports[_0x8a63('0x5c')]=function(_0x7645d4,_0xa3604b){return db['FaxMessage'][_0x8a63('0x5c')]()[_0x8a63('0x23')](respondWithResult(_0xa3604b,null))[_0x8a63('0x2e')](handleError(_0xa3604b,null));};var interaction_log=require(_0x8a63('0x5d'))(_0x8a63('0x5e'));exports[_0x8a63('0x5f')]=function(_0x947c0c,_0x122e80,_0x36efd7){var _0x3ea8da={'agent':{},'channel':_0x8a63('0x60')};if(_0x947c0c[_0x8a63('0x5a')]['id']){delete _0x947c0c[_0x8a63('0x5a')]['id'];}_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x61')]=!![];_0x947c0c[_0x8a63('0x5a')]['readAt']=moment()[_0x8a63('0x62')](_0x8a63('0x63'));_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')]=_0x947c0c[_0x8a63('0x5a')]['UserId']||_0x947c0c[_0x8a63('0x65')]['id'];_0x3ea8da[_0x8a63('0x66')]['id']=_0x947c0c['body'][_0x8a63('0x64')];return db[_0x8a63('0x40')][_0x8a63('0x67')]({'where':{'id':_0x947c0c[_0x8a63('0x5b')]['id'],'UserId':null}})[_0x8a63('0x23')](handleEntityNotFound(_0x122e80,null))['then'](saveUpdates(_0x947c0c[_0x8a63('0x5a')],null))['then'](function(_0x40521a){if(_0x40521a){_0x3ea8da[_0x8a63('0x2c')]=_0x40521a['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x40521a[_0x8a63('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x122e80,null))[_0x8a63('0x23')](function(_0x20a69f){if(_0x20a69f){return _0x20a69f[_0x8a63('0x69')]({'UserId':_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')],'read1stAt':_['isNil'](_0x20a69f[_0x8a63('0x6a')])?moment()[_0x8a63('0x62')](_0x8a63('0x63')):undefined});}return null;})[_0x8a63('0x23')](function(_0x298431){if(_0x298431){_0x3ea8da[_0x8a63('0x6b')]=_0x298431[_0x8a63('0x6c')]({'plain':!![]});interaction_log[_0x8a63('0x24')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x947c0c[_0x8a63('0x65')]['id'],_0x947c0c['user'][_0x8a63('0x3d')],_0x947c0c[_0x8a63('0x65')][_0x8a63('0x6d')],_0x3ea8da[_0x8a63('0x6b')]['id'],_0x947c0c['body']?JSON[_0x8a63('0x28')](_0x947c0c[_0x8a63('0x5a')]):'null');return respondWithRpcPromise(_0x8a63('0x6e'),_0x8a63('0x6f'),_0x3ea8da);}return null;})[_0x8a63('0x23')](function(_0x4d7fef){var _0xe038f2=_0x8a63('0x70')+_0x4d7fef[_0x8a63('0x2c')][_0x8a63('0x71')];return db['sequelize'][_0x8a63('0x46')](_0xe038f2,{'type':db[_0x8a63('0x72')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x45315e){return _0x45315e;});})[_0x8a63('0x23')](function(_0x1fd250){if(_0x1fd250){_0x3ea8da[_0x8a63('0x2c')]['contact']=_0x1fd250[0x0];if(!_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')])return;return db[_0x8a63('0x73')][_0x8a63('0x67')]({'where':{'id':_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x64')],'role':'agent'},'attributes':['id',_0x8a63('0x3d'),_0x8a63('0x74'),_0x8a63('0x75'),_0x8a63('0x76')],'raw':!![]});}return null;})[_0x8a63('0x23')](function(_0x3887d2){if(!_0x3887d2)return null;_0x3ea8da[_0x8a63('0x2c')]['agent']=_0x3887d2;return _0x3ea8da;})[_0x8a63('0x23')](function(_0x1e0bfa){if(_0x1e0bfa){if(_0x947c0c[_0x8a63('0x5a')][_0x8a63('0x77')]){_0x3ea8da[_0x8a63('0x2c')][_0x8a63('0x78')]=util[_0x8a63('0x62')](_0x8a63('0x79'),_0x947c0c[_0x8a63('0x65')][_0x8a63('0x3d')]);_0x3ea8da[_0x8a63('0x2c')][_0x8a63('0x7a')]=_0x3ea8da['channel'];_0x3ea8da[_0x8a63('0x2c')]['motionChannel']=_0x3ea8da[_0x8a63('0x7a')];_0x3ea8da[_0x8a63('0x2c')][_0x8a63('0x7b')]=_0x8a63('0x5f');return respondWithRpcPromise(_0x8a63('0x7c'),_0x8a63('0x7c'),{'event':_0x8a63('0x7d'),'message':_0x3ea8da[_0x8a63('0x2c')]},client9002)[_0x8a63('0x23')](function(){return _0x3ea8da;});}return _0x3ea8da;}return null;})[_0x8a63('0x23')](respondWithResult(_0x122e80,null))[_0x8a63('0x2e')](handleError(_0x122e80,null));};var interaction_log=require(_0x8a63('0x5d'))(_0x8a63('0x5e'));exports[_0x8a63('0x39')]=function(_0x37216d,_0x278b25,_0x3c4247){var _0x36db6b={'agent':{},'channel':_0x8a63('0x60')};if(_0x37216d[_0x8a63('0x5a')]['id']){delete _0x37216d[_0x8a63('0x5a')]['id'];}_0x37216d[_0x8a63('0x5a')][_0x8a63('0x64')]=_0x37216d['body'][_0x8a63('0x64')]||_0x37216d[_0x8a63('0x65')]['id'];_0x36db6b[_0x8a63('0x66')]['id']=_0x37216d[_0x8a63('0x5a')]['UserId'];return db[_0x8a63('0x40')][_0x8a63('0x67')]({'where':{'id':_0x37216d[_0x8a63('0x5b')]['id'],'UserId':null}})[_0x8a63('0x23')](handleEntityNotFound(_0x278b25,null))[_0x8a63('0x23')](function(_0x314f0c){if(_0x314f0c){_0x36db6b[_0x8a63('0x2c')]=_0x314f0c['get']({'plain':!![]});return db[_0x8a63('0x7e')][_0x8a63('0x67')]({'where':{'id':_0x314f0c[_0x8a63('0x68')]}});}return null;})[_0x8a63('0x23')](handleEntityNotFound(_0x278b25,null))[_0x8a63('0x23')](function(_0x37d378){if(_0x37d378){_0x36db6b[_0x8a63('0x6b')]=_0x37d378[_0x8a63('0x6c')]({'plain':!![]});interaction_log[_0x8a63('0x24')](_0x8a63('0x7f'),_0x37216d[_0x8a63('0x65')]['id'],_0x37216d[_0x8a63('0x65')][_0x8a63('0x3d')],_0x37216d[_0x8a63('0x65')][_0x8a63('0x6d')],_0x36db6b[_0x8a63('0x6b')]['id'],_0x37216d['body']?JSON[_0x8a63('0x28')](_0x37216d[_0x8a63('0x5a')]):_0x8a63('0x80'));return respondWithRpcPromise(_0x8a63('0x81'),'rejectMessage',_0x36db6b);}return null;})[_0x8a63('0x23')](function(_0x56c326){var _0x2f9275='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56c326[_0x8a63('0x2c')][_0x8a63('0x71')];return db[_0x8a63('0x82')][_0x8a63('0x46')](_0x2f9275,{'type':db[_0x8a63('0x72')][_0x8a63('0x83')][_0x8a63('0x84')],'raw':!![]})['then'](function(_0x7a83cf){return _0x7a83cf;});})[_0x8a63('0x23')](function(_0x498fcf){if(_0x498fcf){_0x36db6b[_0x8a63('0x2c')][_0x8a63('0x85')]=_0x498fcf[0x0];if(!_0x37216d[_0x8a63('0x5a')][_0x8a63('0x64')])return;return db[_0x8a63('0x73')][_0x8a63('0x67')]({'where':{'id':_0x37216d[_0x8a63('0x5a')][_0x8a63('0x64')],'role':_0x8a63('0x66')},'attributes':['id',_0x8a63('0x3d'),_0x8a63('0x74'),'email','internal'],'raw':!![]});}return null;})[_0x8a63('0x23')](function(_0x5c5b70){if(!_0x5c5b70)return null;_0x36db6b[_0x8a63('0x2c')]['agent']=_0x5c5b70;return _0x36db6b;})[_0x8a63('0x23')](function(_0x33113f){if(_0x33113f){_0x33113f[_0x8a63('0x2c')]['interface']=util[_0x8a63('0x62')](_0x8a63('0x79'),_0x37216d[_0x8a63('0x65')][_0x8a63('0x3d')]);_0x33113f[_0x8a63('0x2c')][_0x8a63('0x7a')]=_0x36db6b['channel'];_0x33113f[_0x8a63('0x2c')][_0x8a63('0x86')]=_0x36db6b[_0x8a63('0x7a')];_0x33113f[_0x8a63('0x2c')]['event']='reject';respondWithRpcPromise(_0x8a63('0x7c'),'EventManager',{'event':_0x8a63('0x87'),'message':_0x33113f[_0x8a63('0x2c')]},client9002);return _0x36db6b;}return null;})[_0x8a63('0x23')](respondWithResult(_0x278b25,null))['catch'](handleError(_0x278b25,null));};exports[_0x8a63('0x88')]=function(_0xca203d,_0x1a108c){var _0x3f64ff;return db[_0x8a63('0x40')]['create'](_0xca203d[_0x8a63('0x5a')],{})[_0x8a63('0x23')](function(_0x51a64c){_0x3f64ff=_0x51a64c;return db['CmContact'][_0x8a63('0x89')]({'where':{'id':_0x3f64ff[_0x8a63('0x71')]}});})[_0x8a63('0x23')](function(_0x34b651){if(_[_0x8a63('0x8a')](_0x34b651)){return;}else{_0x3f64ff[_0x8a63('0x60')]=_0x34b651[_0x8a63('0x60')];return db[_0x8a63('0x8b')][_0x8a63('0x89')]({'where':{'id':_0x3f64ff[_0x8a63('0x8c')]}});}})[_0x8a63('0x23')](function(_0x956053){return respondWithRpcPromise(_0x8a63('0x8d'),_0x8a63('0x8d'),{'FaxAccountId':_[_0x8a63('0x8a')](_0xca203d['body'])?undefined:_0xca203d['body']['FaxAccountId'],'path':_[_0x8a63('0x8a')](_0x956053)?undefined:util[_0x8a63('0x62')]('/var/opt/motion2/server/files/attachments/%s',_0x956053['basename']),'fax':_[_0x8a63('0x8a')](_0x3f64ff[_0x8a63('0x60')])?undefined:_0x3f64ff['fax'],'AttachmentId':_0x3f64ff[_0x8a63('0x8c')]},client9002);})['then'](respondWithResult(_0x1a108c,0xc9))['catch'](handleError(_0x1a108c,null));};exports[_0x8a63('0x8e')]=function(_0x70df61,_0x140c88){var _0x41e545=path[_0x8a63('0x8f')](config[_0x8a63('0x90')],_0x8a63('0x91'),_0x8a63('0x92'),_0x8a63('0x93'));return db[_0x8a63('0x40')][_0x8a63('0x67')]({'where':{'id':_0x70df61['params']['id']},'include':[{'model':db[_0x8a63('0x8b')],'as':'Attachment'}]})[_0x8a63('0x23')](handleEntityNotFound(_0x140c88,null))[_0x8a63('0x23')](function(_0x2125c3){if(_0x2125c3){return _0x140c88[_0x8a63('0x8e')](path['join'](_0x41e545,_0x2125c3['Attachment'][_0x8a63('0x94')]));}})[_0x8a63('0x2e')](handleError(_0x140c88,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6d85de9..d6c3776 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 _0xbd18=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x18c036,_0x425573){var _0x45e861=function(_0x3a853e){while(--_0x3a853e){_0x18c036['push'](_0x18c036['shift']());}};_0x45e861(++_0x425573);}(_0xbd18,0x195));var _0x8bd1=function(_0x4f11f8,_0xeaea18){_0x4f11f8=_0x4f11f8-0x0;var _0x3d5028=_0xbd18[_0x4f11f8];return _0x3d5028;};'use strict';var EventEmitter=require(_0x8bd1('0x0'));var FaxMessage=require(_0x8bd1('0x1'))['db'][_0x8bd1('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8bd1('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4eb187){return function(_0x2cdea7,_0x113554,_0x5abf07){FaxMessageEvents['emit'](_0x4eb187+':'+_0x2cdea7['id'],_0x2cdea7);FaxMessageEvents[_0x8bd1('0x4')](_0x4eb187,_0x2cdea7);_0x5abf07(null);};}for(var e in events){if(events[_0x8bd1('0x5')](e)){var event=events[e];FaxMessage[_0x8bd1('0x6')](e,emitEvent(event));}}module[_0x8bd1('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x905a=['hasOwnProperty','hook','exports','events','FaxMessage','update','remove','emit'];(function(_0x4454c3,_0x24c130){var _0x195fa6=function(_0x594c1a){while(--_0x594c1a){_0x4454c3['push'](_0x4454c3['shift']());}};_0x195fa6(++_0x24c130);}(_0x905a,0xeb));var _0xa905=function(_0x1e6882,_0x315ed8){_0x1e6882=_0x1e6882-0x0;var _0x1cbdbf=_0x905a[_0x1e6882];return _0x1cbdbf;};'use strict';var EventEmitter=require(_0xa905('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xa905('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa905('0x2'),'afterDestroy':_0xa905('0x3')};function emitEvent(_0x54450f){return function(_0xf28f88,_0x2db00d,_0xb2f96a){FaxMessageEvents[_0xa905('0x4')](_0x54450f+':'+_0xf28f88['id'],_0xf28f88);FaxMessageEvents[_0xa905('0x4')](_0x54450f,_0xf28f88);_0xb2f96a(null);};}for(var e in events){if(events[_0xa905('0x5')](e)){var event=events[e];FaxMessage[_0xa905('0x6')](e,emitEvent(event));}}module[_0xa905('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 526ec8d..36c2b1a 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 _0xf68f=['secret','isNil','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','direction','toLowerCase'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xf68f,0x1bb));var _0xff68=function(_0x2b0228,_0x5ee990){_0x2b0228=_0x2b0228-0x0;var _0x259bfa=_0xf68f[_0x2b0228];return _0x259bfa;};'use strict';var _=require(_0xff68('0x0'));var util=require(_0xff68('0x1'));var logger=require(_0xff68('0x2'))(_0xff68('0x3'));var moment=require(_0xff68('0x4'));var BPromise=require('bluebird');var rp=require(_0xff68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff68('0x6'));var attributes=require(_0xff68('0x7'));module[_0xff68('0x8')]=function(_0x4af94f,_0x2a82ea){return _0x4af94f[_0xff68('0x9')]('FaxMessage',attributes,{'tableName':_0xff68('0xa'),'paranoid':![],'indexes':[{'name':_0xff68('0xb'),'fields':[_0xff68('0xc')],'type':_0xff68('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x167aa5,_0x4af259,_0x3a4000){var _0x2726f0=_0x4af94f['models'];var _0x54bc0e=_0x167aa5['get']({'plain':!![]});if(_0x54bc0e[_0xff68('0xe')]['toLowerCase']()==='in'||_0x54bc0e[_0xff68('0xe')][_0xff68('0xf')]()==='out'&&!_0x54bc0e[_0xff68('0x10')]&&!_[_0xff68('0x11')](_0x54bc0e['UserId'])){_0x2726f0[_0xff68('0x12')]['findOne']({'where':{'id':_0x54bc0e[_0xff68('0x13')]}})[_0xff68('0x14')](function(_0x40c7a2){if(_0x40c7a2){_0x40c7a2[_0xff68('0x15')]({'lastMsgAt':_0x54bc0e[_0xff68('0x16')],'lastMsgDirection':_0x54bc0e[_0xff68('0xe')][_0xff68('0xf')]()});}})[_0xff68('0x17')](function(_0x314d49){console[_0xff68('0x18')](_0x314d49);});}_0x3a4000();}},'charset':_0xff68('0x19'),'collate':_0xff68('0x1a')});}; \ No newline at end of file +var _0xc462=['../../config/logger','api','moment','path','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x2751e8,_0x19ee57){var _0x455c9b=function(_0x481a2d){while(--_0x481a2d){_0x2751e8['push'](_0x2751e8['shift']());}};_0x455c9b(++_0x19ee57);}(_0xc462,0x179));var _0x2c46=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc462[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x2c46('0x0'));var logger=require(_0x2c46('0x1'))(_0x2c46('0x2'));var moment=require(_0x2c46('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c46('0x4'));var rimraf=require(_0x2c46('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c46('0x6'));module[_0x2c46('0x7')]=function(_0x384259,_0x561a08){return _0x384259[_0x2c46('0x8')]('FaxMessage',attributes,{'tableName':_0x2c46('0x9'),'paranoid':![],'indexes':[{'name':_0x2c46('0xa'),'fields':[_0x2c46('0xb')],'type':_0x2c46('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e09c,_0x3bf2fb,_0x15c5d5){var _0x50c453=_0x384259[_0x2c46('0xd')];var _0x39818c=_0x56e09c[_0x2c46('0xe')]({'plain':!![]});if(_0x39818c[_0x2c46('0xf')][_0x2c46('0x10')]()==='in'||_0x39818c[_0x2c46('0xf')]['toLowerCase']()==='out'&&!_0x39818c['secret']&&!_['isNil'](_0x39818c[_0x2c46('0x11')])){_0x50c453[_0x2c46('0x12')][_0x2c46('0x13')]({'where':{'id':_0x39818c[_0x2c46('0x14')]}})[_0x2c46('0x15')](function(_0x246eb3){if(_0x246eb3){_0x246eb3[_0x2c46('0x16')]({'lastMsgAt':_0x39818c[_0x2c46('0x17')],'lastMsgDirection':_0x39818c[_0x2c46('0xf')][_0x2c46('0x10')]()});}})['catch'](function(_0x4db894){console[_0x2c46('0x18')](_0x4db894);});}_0x15c5d5();}},'charset':_0x2c46('0x19'),'collate':_0x2c46('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c3d6388..e729427 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 _0xe5b3=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','info'];(function(_0x5bfd2c,_0x470fe3){var _0x5724d1=function(_0x17dca2){while(--_0x17dca2){_0x5bfd2c['push'](_0x5bfd2c['shift']());}};_0x5724d1(++_0x470fe3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4ffc42,_0x2facd6){_0x4ffc42=_0x4ffc42-0x0;var _0x5882f9=_0xe5b3[_0x4ffc42];return _0x5882f9;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});config[_0x3e5b('0xc')]=_['defaults'](config[_0x3e5b('0xc')],{'host':_0x3e5b('0xd'),'port':0x18eb});var socket=require(_0x3e5b('0xe'))(new Redis(config[_0x3e5b('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1fef54,_0x3d3b6e,_0x22fc1a){return new BPromise(function(_0x17dee7,_0xeeaabc){return client['request'](_0x1fef54,_0x22fc1a)[_0x3e5b('0xf')](function(_0x52efbd){logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,_0x3e5b('0x12'));logger[_0x3e5b('0x13')](_0x3e5b('0x14'),_0x3d3b6e,_0x3e5b('0x12'),JSON[_0x3e5b('0x15')](_0x52efbd));if(_0x52efbd['error']){if(_0x52efbd[_0x3e5b('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd[_0x3e5b('0x16')][_0x3e5b('0x17')]);return _0xeeaabc(_0x52efbd[_0x3e5b('0x16')]['message']);}logger[_0x3e5b('0x16')]('FaxMessage,\x20%s,\x20%s',_0x3d3b6e,_0x52efbd['error'][_0x3e5b('0x17')]);return _0x17dee7(_0x52efbd[_0x3e5b('0x16')]['message']);}else{logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x3d3b6e,'request\x20sent');_0x17dee7(_0x52efbd[_0x3e5b('0x18')][_0x3e5b('0x17')]);}})['catch'](function(_0x4b189d){logger[_0x3e5b('0x16')](_0x3e5b('0x11'),_0x3d3b6e,_0x4b189d);_0xeeaabc(_0x4b189d);});});}exports[_0x3e5b('0x19')]=function(_0xff4aba){var _0x24de5b=this;return new Promise(function(_0x1564b5,_0x447d36){return db[_0x3e5b('0x1a')][_0x3e5b('0x1b')](_0xff4aba[_0x3e5b('0x1c')],{'raw':_0xff4aba[_0x3e5b('0x1d')]?_0xff4aba[_0x3e5b('0x1d')][_0x3e5b('0x1e')]===undefined?!![]:![]:!![]})[_0x3e5b('0xf')](function(_0x5b46d4){logger[_0x3e5b('0x10')](_0x3e5b('0x19'),_0xff4aba);logger[_0x3e5b('0x13')](_0x3e5b('0x19'),_0xff4aba,JSON['stringify'](_0x5b46d4));_0x1564b5(_0x5b46d4);})[_0x3e5b('0x1f')](function(_0x5b33bb){logger[_0x3e5b('0x16')](_0x3e5b('0x19'),_0x5b33bb['message'],_0xff4aba);_0x447d36(_0x24de5b[_0x3e5b('0x16')](0x1f4,_0x5b33bb[_0x3e5b('0x17')]));});});};exports[_0x3e5b('0x20')]=function(_0x3c8965){var _0x3bb749=this;return new Promise(function(_0x26c7f2,_0x160e87){return db[_0x3e5b('0x1a')]['update'](_0x3c8965[_0x3e5b('0x1c')],{'raw':_0x3c8965['options']?_0x3c8965[_0x3e5b('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x21')]||null:null,'attributes':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x22')]||null:null,'limit':_0x3c8965[_0x3e5b('0x1d')]?_0x3c8965[_0x3e5b('0x1d')][_0x3e5b('0x23')]||null:null})[_0x3e5b('0xf')](function(_0x1e1565){logger['info'](_0x3e5b('0x20'),_0x3c8965);logger[_0x3e5b('0x13')](_0x3e5b('0x20'),_0x3c8965,JSON[_0x3e5b('0x15')](_0x1e1565));_0x26c7f2(_0x1e1565);})[_0x3e5b('0x1f')](function(_0x31e9f9){logger[_0x3e5b('0x16')]('UpdateFaxMessage',_0x31e9f9[_0x3e5b('0x17')],_0x3c8965);_0x160e87(_0x3bb749['error'](0x1f4,_0x31e9f9['message']));});});}; \ No newline at end of file +var _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xed1f,0x6a));var _0xfed1=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xed1f[_0x32b542];return _0x554d54;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 0be53f2..825daac 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 _0xf5ac=['remove','update','emit','removeListener','register','faxMessage:','./faxMessage.events'];(function(_0x4347cd,_0x562582){var _0x40c6d7=function(_0xe4c3e7){while(--_0xe4c3e7){_0x4347cd['push'](_0x4347cd['shift']());}};_0x40c6d7(++_0x562582);}(_0xf5ac,0xfb));var _0xcf5a=function(_0x3bd0f9,_0x40e5f8){_0x3bd0f9=_0x3bd0f9-0x0;var _0x439b87=_0xf5ac[_0x3bd0f9];return _0x439b87;};'use strict';var FaxMessageEvents=require(_0xcf5a('0x0'));var events=['save',_0xcf5a('0x1'),_0xcf5a('0x2')];function createListener(_0x23b801,_0x4131bb){return function(_0x266494){_0x4131bb[_0xcf5a('0x3')](_0x23b801,_0x266494);};}function removeListener(_0x47b53f,_0x43d324){return function(){FaxMessageEvents[_0xcf5a('0x4')](_0x47b53f,_0x43d324);};}exports[_0xcf5a('0x5')]=function(_0x106f3e){for(var _0x5bf68c=0x0,_0x3832b9=events['length'];_0x5bf68c<_0x3832b9;_0x5bf68c++){var _0x27a7b0=events[_0x5bf68c];var _0x4dc213=createListener(_0xcf5a('0x6')+_0x27a7b0,_0x106f3e);FaxMessageEvents['on'](_0x27a7b0,_0x4dc213);}}; \ No newline at end of file +var _0xf031=['update','faxMessage:','./faxMessage.events'];(function(_0x193eb3,_0x44e075){var _0x5af017=function(_0x51d8cd){while(--_0x51d8cd){_0x193eb3['push'](_0x193eb3['shift']());}};_0x5af017(++_0x44e075);}(_0xf031,0x1dc));var _0x1f03=function(_0x536b7b,_0x50c100){_0x536b7b=_0x536b7b-0x0;var _0x125583=_0xf031[_0x536b7b];return _0x125583;};'use strict';var FaxMessageEvents=require(_0x1f03('0x0'));var events=['save','remove',_0x1f03('0x1')];function createListener(_0x44f004,_0x29b2f5){return function(_0x33b9f5){_0x29b2f5['emit'](_0x44f004,_0x33b9f5);};}function removeListener(_0x3a47d6,_0x4826eb){return function(){FaxMessageEvents['removeListener'](_0x3a47d6,_0x4826eb);};}exports['register']=function(_0x289a43){for(var _0x323f50=0x0,_0x27f202=events['length'];_0x323f50<_0x27f202;_0x323f50++){var _0x4c94c9=events[_0x323f50];var _0x249093=createListener(_0x1f03('0x2')+_0x4c94c9,_0x289a43);FaxMessageEvents['on'](_0x4c94c9,_0x249093);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b583497..99e0f21 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 _0x9c00=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','isAuthenticated','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','express','Router'];(function(_0x2c6bd8,_0x244cd3){var _0x21bd60=function(_0x4d4443){while(--_0x4d4443){_0x2c6bd8['push'](_0x2c6bd8['shift']());}};_0x21bd60(++_0x244cd3);}(_0x9c00,0x1a0));var _0x09c0=function(_0x21f8a8,_0x1d7071){_0x21f8a8=_0x21f8a8-0x0;var _0x21d3d5=_0x9c00[_0x21f8a8];return _0x21d3d5;};'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('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),interaction[_0x09c0('0x10')](_0x09c0('0x11'),_0x09c0('0x12')),controller[_0x09c0('0x13')]);router[_0x09c0('0x14')](_0x09c0('0x15'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);router[_0x09c0('0x14')](_0x09c0('0x17'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x18')]);router[_0x09c0('0x14')](_0x09c0('0x19'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1a')]);router[_0x09c0('0x1b')](_0x09c0('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdace=['/describe','describe','/:id','show','download','tracked','fax','create','update','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5a1f78,_0x16c0f0){var _0x25366e=function(_0x406fdc){while(--_0x406fdc){_0x5a1f78['push'](_0x5a1f78['shift']());}};_0x25366e(++_0x16c0f0);}(_0xdace,0xc5));var _0xedac=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xdace[_0x1558ab];return _0x53b64a;};'use strict';var multer=require(_0xedac('0x0'));var util=require('util');var path=require(_0xedac('0x1'));var timeout=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express['Router']();var fs_extra=require(_0xedac('0x4'));var auth=require(_0xedac('0x5'));var interaction=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var controller=require('./faxMessage.controller');router[_0xedac('0x8')]('/',auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router['get'](_0xedac('0xb'),auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0xe')]);router['get']('/:id/download',auth[_0xedac('0x9')](),controller[_0xedac('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xedac('0x10')](_0xedac('0x11'),'faxmessage:create'),controller[_0xedac('0x12')]);router['put'](_0xedac('0xd'),auth[_0xedac('0x9')](),controller[_0xedac('0x13')]);router[_0xedac('0x14')](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router[_0xedac('0x14')]('/:id/reject',auth[_0xedac('0x9')](),controller[_0xedac('0x17')]);router[_0xedac('0x18')](_0xedac('0xd'),auth[_0xedac('0x9')](),controller['destroy']);module[_0xedac('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 83675bb..75700cf 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 _0x7d1e=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7d1e,0x111));var _0xe7d1=function(_0x57b28d,_0x4824ae){_0x57b28d=_0x57b28d-0x0;var _0x4e2e17=_0x7d1e[_0x57b28d];return _0x4e2e17;};'use strict';var Sequelize=require(_0xe7d1('0x0'));module[_0xe7d1('0x1')]={'name':{'type':Sequelize[_0xe7d1('0x2')],'unique':_0xe7d1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe7d1('0x2')]},'timeout':{'type':Sequelize[_0xe7d1('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe7d1('0x5')]('rrmemory',_0xe7d1('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe7d1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6083=['exports','name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x52f309,_0x4ea2df){var _0x58ab0d=function(_0x3fa291){while(--_0x3fa291){_0x52f309['push'](_0x52f309['shift']());}};_0x58ab0d(++_0x4ea2df);}(_0x6083,0x9f));var _0x3608=function(_0x47337b,_0x369073){_0x47337b=_0x47337b-0x0;var _0x4bc4dc=_0x6083[_0x47337b];return _0x4bc4dc;};'use strict';var Sequelize=require(_0x3608('0x0'));module[_0x3608('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3608('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3608('0x3')]},'timeout':{'type':Sequelize[_0x3608('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3608('0x5')]('rrmemory',_0x3608('0x6'),_0x3608('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3608('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9975379..21abbe4 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 _0x9cf4=['team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','userFaxQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxQueues','then','end','error','name','index','FaxQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','from'];(function(_0x2a21ff,_0x2aecc9){var _0x1e2d37=function(_0x53f077){while(--_0x53f077){_0x2a21ff['push'](_0x2a21ff['shift']());}};_0x1e2d37(++_0x2aecc9);}(_0x9cf4,0x1b9));var _0x49cf=function(_0x5ea327,_0x59e253){_0x5ea327=_0x5ea327-0x0;var _0x13fb0a=_0x9cf4[_0x5ea327];return _0x13fb0a;};'use strict';var emlformat=require(_0x49cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49cf('0x1'));var jsonpatch=require(_0x49cf('0x2'));var rp=require(_0x49cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x49cf('0x4'));var util=require('util');var path=require(_0x49cf('0x5'));var sox=require(_0x49cf('0x6'));var csv=require(_0x49cf('0x7'));var ejs=require(_0x49cf('0x8'));var fs=require('fs');var fs_extra=require(_0x49cf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x49cf('0xa'));var deskjs=require(_0x49cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0x49cf('0xc'));var Papa=require(_0x49cf('0xd'));var Redis=require(_0x49cf('0xe'));var authService=require(_0x49cf('0xf'));var qs=require(_0x49cf('0x10'));var as=require(_0x49cf('0x11'));var hardwareService=require(_0x49cf('0x12'));var logger=require(_0x49cf('0x13'))(_0x49cf('0x14'));var utils=require(_0x49cf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x49cf('0x16'));var db=require(_0x49cf('0x17'))['db'];config['redis']=_[_0x49cf('0x18')](config[_0x49cf('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x49cf('0x1a'))(new Redis(config[_0x49cf('0x19')]));require(_0x49cf('0x1b'))[_0x49cf('0x1c')](socket);function respondWithStatusCode(_0x2abdb8,_0x239e89){_0x239e89=_0x239e89||0xcc;return function(_0x2d6a71){if(_0x2d6a71){return _0x2abdb8[_0x49cf('0x1d')](_0x239e89);}return _0x2abdb8[_0x49cf('0x1e')](_0x239e89)['end']();};}function respondWithResult(_0x27b4c0,_0x39db59){_0x39db59=_0x39db59||0xc8;return function(_0xa85be6){if(_0xa85be6){return _0x27b4c0[_0x49cf('0x1e')](_0x39db59)[_0x49cf('0x1f')](_0xa85be6);}};}function respondWithFilteredResult(_0x209491,_0x4410da){return function(_0x36d7a3){if(_0x36d7a3){var _0x1c6444=typeof _0x4410da[_0x49cf('0x20')]===_0x49cf('0x21')&&typeof _0x4410da[_0x49cf('0x22')]===_0x49cf('0x21');var _0x2b0eac=_0x36d7a3[_0x49cf('0x23')];var _0x14fb8a=_0x1c6444?0x0:_0x4410da[_0x49cf('0x20')];var _0x5a28aa=_0x1c6444?_0x36d7a3[_0x49cf('0x23')]:_0x4410da[_0x49cf('0x20')]+_0x4410da[_0x49cf('0x22')];var _0x289f17;if(_0x5a28aa>=_0x2b0eac){_0x5a28aa=_0x2b0eac;_0x289f17=0xc8;}else{_0x289f17=0xce;}_0x209491[_0x49cf('0x1e')](_0x289f17);return _0x209491[_0x49cf('0x24')](_0x49cf('0x25'),_0x14fb8a+'-'+_0x5a28aa+'/'+_0x2b0eac)[_0x49cf('0x1f')](_0x36d7a3);}return null;};}function patchUpdates(_0xbed6c2){return function(_0x45d329){try{jsonpatch[_0x49cf('0x26')](_0x45d329,_0xbed6c2,!![]);}catch(_0x45acae){return BPromise[_0x49cf('0x27')](_0x45acae);}return _0x45d329[_0x49cf('0x28')]();};}function saveUpdates(_0x1ac8d6,_0x1eec67){return function(_0x40f5fb){if(_0x40f5fb){return _0x40f5fb[_0x49cf('0x29')](_0x1ac8d6)['then'](function(_0x3f4e73){return _0x3f4e73;});}return null;};}function removeEntity(_0x99363c,_0x12c5ef){return function(_0x58749c){if(_0x58749c){return _0x58749c[_0x49cf('0x2a')]()['then'](function(){var _0x246406=_0x58749c[_0x49cf('0x2b')]({'plain':!![]});var _0x7942be=_0x49cf('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x7942be,'resourceId':_0x246406['id']}})[_0x49cf('0x2d')](function(){return _0x58749c;});})[_0x49cf('0x2d')](function(){_0x99363c[_0x49cf('0x1e')](0xcc)[_0x49cf('0x2e')]();});}};}function handleEntityNotFound(_0x1325ac,_0x437e6b){return function(_0x525c08){if(!_0x525c08){_0x1325ac[_0x49cf('0x1d')](0x194);}return _0x525c08;};}function handleError(_0x44c76b,_0x72ee72){_0x72ee72=_0x72ee72||0x1f4;return function(_0x5b3a38){logger[_0x49cf('0x2f')](_0x5b3a38['stack']);if(_0x5b3a38['name']){delete _0x5b3a38[_0x49cf('0x30')];}_0x44c76b[_0x49cf('0x1e')](_0x72ee72)['send'](_0x5b3a38);};}exports[_0x49cf('0x31')]=function(_0x23c896,_0x546739){var _0x5bbddb={},_0x2bd62d={},_0x32f763={'count':0x0,'rows':[]};var _0x5e537d=_['map'](db[_0x49cf('0x32')][_0x49cf('0x33')],function(_0xfe1cbb){return{'name':_0xfe1cbb[_0x49cf('0x34')],'type':_0xfe1cbb['type'][_0x49cf('0x35')]};});_0x2bd62d[_0x49cf('0x36')]=_[_0x49cf('0x37')](_0x5e537d,_0x49cf('0x30'));_0x2bd62d[_0x49cf('0x38')]=_[_0x49cf('0x39')](_0x23c896[_0x49cf('0x38')]);_0x2bd62d[_0x49cf('0x3a')]=_[_0x49cf('0x3b')](_0x2bd62d[_0x49cf('0x36')],_0x2bd62d[_0x49cf('0x38')]);_0x5bbddb['attributes']=_['intersection'](_0x2bd62d['model'],qs[_0x49cf('0x3c')](_0x23c896['query'][_0x49cf('0x3c')]));_0x5bbddb[_0x49cf('0x3d')]=_0x5bbddb[_0x49cf('0x3d')][_0x49cf('0x3e')]?_0x5bbddb[_0x49cf('0x3d')]:_0x2bd62d[_0x49cf('0x36')];if(!_0x23c896[_0x49cf('0x38')][_0x49cf('0x3f')]('nolimit')){_0x5bbddb[_0x49cf('0x22')]=qs[_0x49cf('0x22')](_0x23c896[_0x49cf('0x38')][_0x49cf('0x22')]);_0x5bbddb[_0x49cf('0x20')]=qs[_0x49cf('0x20')](_0x23c896['query']['offset']);}_0x5bbddb[_0x49cf('0x40')]=qs['sort'](_0x23c896[_0x49cf('0x38')][_0x49cf('0x41')]);_0x5bbddb[_0x49cf('0x42')]=qs[_0x49cf('0x3a')](_[_0x49cf('0x43')](_0x23c896[_0x49cf('0x38')],_0x2bd62d[_0x49cf('0x3a')]),_0x5e537d);if(_0x23c896[_0x49cf('0x38')][_0x49cf('0x44')]){_0x5bbddb[_0x49cf('0x42')]=_[_0x49cf('0x45')](_0x5bbddb[_0x49cf('0x42')],{'$or':_[_0x49cf('0x37')](_0x5e537d,function(_0x5bd009){if(_0x5bd009['type']!==_0x49cf('0x46')){var _0x5665fc={};_0x5665fc[_0x5bd009[_0x49cf('0x30')]]={'$like':'%'+_0x23c896[_0x49cf('0x38')][_0x49cf('0x44')]+'%'};return _0x5665fc;}})});}_0x5bbddb=_[_0x49cf('0x45')]({},_0x5bbddb,_0x23c896[_0x49cf('0x47')]);var _0x2f62f4={'where':_0x5bbddb[_0x49cf('0x42')]};return db[_0x49cf('0x32')][_0x49cf('0x23')](_0x2f62f4)['then'](function(_0x3f85e4){_0x32f763[_0x49cf('0x23')]=_0x3f85e4;if(_0x23c896[_0x49cf('0x38')][_0x49cf('0x48')]){_0x5bbddb[_0x49cf('0x49')]=[{'all':!![]}];}return db['FaxQueue'][_0x49cf('0x4a')](_0x5bbddb);})['then'](function(_0x4851eb){_0x32f763[_0x49cf('0x4b')]=_0x4851eb;return _0x32f763;})[_0x49cf('0x2d')](respondWithFilteredResult(_0x546739,_0x5bbddb))[_0x49cf('0x4c')](handleError(_0x546739,null));};exports[_0x49cf('0x4d')]=function(_0x579237,_0x1d566f){var _0xb44129={'raw':!![],'where':{'id':_0x579237['params']['id']}},_0x39613b={};_0x39613b['model']=_['keys'](db[_0x49cf('0x32')][_0x49cf('0x33')]);_0x39613b['query']=_[_0x49cf('0x39')](_0x579237[_0x49cf('0x38')]);_0x39613b['filters']=_['intersection'](_0x39613b[_0x49cf('0x36')],_0x39613b[_0x49cf('0x38')]);_0xb44129[_0x49cf('0x3d')]=_[_0x49cf('0x3b')](_0x39613b['model'],qs[_0x49cf('0x3c')](_0x579237[_0x49cf('0x38')]['fields']));_0xb44129[_0x49cf('0x3d')]=_0xb44129[_0x49cf('0x3d')]['length']?_0xb44129[_0x49cf('0x3d')]:_0x39613b[_0x49cf('0x36')];if(_0x579237['query']['includeAll']){_0xb44129[_0x49cf('0x49')]=[{'all':!![]}];}_0xb44129=_[_0x49cf('0x45')]({},_0xb44129,_0x579237[_0x49cf('0x47')]);return db[_0x49cf('0x32')]['find'](_0xb44129)[_0x49cf('0x2d')](handleEntityNotFound(_0x1d566f,null))[_0x49cf('0x2d')](respondWithResult(_0x1d566f,null))[_0x49cf('0x4c')](handleError(_0x1d566f,null));};exports[_0x49cf('0x4e')]=function(_0x2a13d7,_0x20a1b4){return db['FaxQueue'][_0x49cf('0x4e')](_0x2a13d7[_0x49cf('0x4f')],{})[_0x49cf('0x2d')](function(_0x39f377){var _0x306aa3=_0x2a13d7[_0x49cf('0x50')]['get']({'plain':!![]});if(!_0x306aa3)throw new Error(_0x49cf('0x51'));if(_0x306aa3['role']===_0x49cf('0x50')){var _0x2d2755=_0x39f377[_0x49cf('0x2b')]({'plain':!![]});var _0x1b1ee5=_0x49cf('0x2c');return db[_0x49cf('0x52')]['find']({'where':{'name':_0x1b1ee5,'userProfileId':_0x306aa3[_0x49cf('0x53')]},'raw':!![]})[_0x49cf('0x2d')](function(_0x2befdf){if(_0x2befdf&&_0x2befdf[_0x49cf('0x54')]===0x0){return db[_0x49cf('0x55')]['create']({'name':_0x2d2755['name'],'resourceId':_0x2d2755['id'],'type':_0x2befdf['name'],'sectionId':_0x2befdf['id']},{})[_0x49cf('0x2d')](function(){return _0x39f377;});}else{return _0x39f377;}})['catch'](function(_0x291d5c){logger['error'](_0x49cf('0x56'),_0x291d5c);throw _0x291d5c;});}return _0x39f377;})[_0x49cf('0x2d')](respondWithResult(_0x20a1b4,0xc9))['catch'](handleError(_0x20a1b4,null));};exports[_0x49cf('0x29')]=function(_0x532041,_0x473575){if(_0x532041[_0x49cf('0x4f')]['id']){delete _0x532041['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x532041[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](handleEntityNotFound(_0x473575,null))[_0x49cf('0x2d')](saveUpdates(_0x532041['body'],null))['then'](respondWithResult(_0x473575,null))[_0x49cf('0x4c')](handleError(_0x473575,null));};exports[_0x49cf('0x2a')]=function(_0x351ac7,_0x411509){return db[_0x49cf('0x32')][_0x49cf('0x58')]({'where':{'id':_0x351ac7['params']['id']}})['then'](handleEntityNotFound(_0x411509,null))['then'](removeEntity(_0x411509,null))[_0x49cf('0x4c')](handleError(_0x411509,null));};exports['describe']=function(_0x129f91,_0x4b9851){return db[_0x49cf('0x32')]['describe']()[_0x49cf('0x2d')](respondWithResult(_0x4b9851,null))[_0x49cf('0x4c')](handleError(_0x4b9851,null));};exports[_0x49cf('0x59')]=function(_0x1c82ab,_0x54f5eb,_0x1c5d92){var _0x3351b2={'raw':!![],'where':{}},_0x304c72={},_0x4c4766;return db['FaxQueue'][_0x49cf('0x5a')]({'where':{'id':_0x1c82ab[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](handleEntityNotFound(_0x54f5eb,null))[_0x49cf('0x2d')](function(_0x2a13cd){if(_0x2a13cd){_0x4c4766=_0x2a13cd[_0x49cf('0x2b')]({'plain':!![]});_0x304c72[_0x49cf('0x36')]=_['keys'](db[_0x49cf('0x5b')]['rawAttributes']);_0x304c72[_0x49cf('0x38')]=_[_0x49cf('0x39')](_0x1c82ab[_0x49cf('0x38')]);_0x304c72[_0x49cf('0x3a')]=_[_0x49cf('0x3b')](_0x304c72['model'],_0x304c72[_0x49cf('0x38')]);_0x3351b2['attributes']=_[_0x49cf('0x3b')](_0x304c72[_0x49cf('0x36')],qs[_0x49cf('0x3c')](_0x1c82ab[_0x49cf('0x38')][_0x49cf('0x3c')]));_0x3351b2[_0x49cf('0x3d')]=_0x3351b2['attributes'][_0x49cf('0x3e')]?_0x3351b2['attributes']:_0x304c72[_0x49cf('0x36')];if(!_0x1c82ab[_0x49cf('0x38')]['hasOwnProperty'](_0x49cf('0x5c'))){_0x3351b2['limit']=qs[_0x49cf('0x22')](_0x1c82ab[_0x49cf('0x38')][_0x49cf('0x22')]);_0x3351b2[_0x49cf('0x20')]=qs[_0x49cf('0x20')](_0x1c82ab['query'][_0x49cf('0x20')]);}_0x3351b2[_0x49cf('0x40')]=qs[_0x49cf('0x41')](_0x1c82ab['query']['sort']);_0x3351b2[_0x49cf('0x42')]=qs['filters'](_['pick'](_0x1c82ab[_0x49cf('0x38')],_0x304c72[_0x49cf('0x3a')]));_0x3351b2[_0x49cf('0x42')][_0x49cf('0x5d')]=_0x2a13cd['id'];if(_0x1c82ab['query'][_0x49cf('0x44')]){_0x3351b2['where']=_[_0x49cf('0x45')](_0x3351b2[_0x49cf('0x42')],{'$or':_[_0x49cf('0x37')](_0x3351b2[_0x49cf('0x3d')],function(_0xe75e24){var _0x2ca6d8={};_0x2ca6d8[_0xe75e24]={'$like':'%'+_0x1c82ab[_0x49cf('0x38')]['filter']+'%'};return _0x2ca6d8;})});}_0x3351b2=_[_0x49cf('0x45')]({},_0x3351b2,_0x1c82ab[_0x49cf('0x47')]);return db['UserFaxQueue'][_0x49cf('0x4a')](_0x3351b2);}})[_0x49cf('0x2d')](function(_0x3d4643){if(_0x3d4643){return db[_0x49cf('0x5e')]['findAndCountAll']({'where':{'id':_[_0x49cf('0x37')](_0x3d4643,'UserId'),'role':_0x49cf('0x5f')},'attributes':['id','name',_0x49cf('0x60'),'updatedAt',_0x49cf('0x61')]});}})[_0x49cf('0x2d')](function(_0x4593b6){if(_0x4593b6){return{'count':_0x4593b6[_0x49cf('0x23')],'rows':_['map'](_0x4593b6[_0x49cf('0x4b')],function(_0x1b3ae3){return{'membername':_0x1b3ae3[_0x49cf('0x30')],'UserId':_0x1b3ae3['id'],'queue_name':_0x4c4766[_0x49cf('0x30')],'FaxQueueId':_0x4c4766['id'],'interface':util[_0x49cf('0x62')](_0x49cf('0x63'),_0x49cf('0x64'),_0x1b3ae3['name']),'penalty':0x0,'paused':_0x1b3ae3[_0x49cf('0x60')],'createdAt':_0x1b3ae3[_0x49cf('0x61')],'updatedAt':_0x1b3ae3[_0x49cf('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x54f5eb,_0x3351b2))[_0x49cf('0x4c')](handleError(_0x54f5eb,null));};exports['getTeams']=function(_0x1dc6c4,_0x2b4102,_0x27821d){var _0x6a11c5={};var _0x3c097b={};var _0x484a0f;var _0x1c7f89;return db[_0x49cf('0x32')][_0x49cf('0x5a')]({'where':{'id':_0x1dc6c4[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](handleEntityNotFound(_0x2b4102,null))[_0x49cf('0x2d')](function(_0x278d6a){if(_0x278d6a){_0x484a0f=_0x278d6a;_0x3c097b[_0x49cf('0x36')]=_[_0x49cf('0x39')](db[_0x49cf('0x66')][_0x49cf('0x33')]);_0x3c097b[_0x49cf('0x38')]=_['keys'](_0x1dc6c4[_0x49cf('0x38')]);_0x3c097b[_0x49cf('0x3a')]=_[_0x49cf('0x3b')](_0x3c097b[_0x49cf('0x36')],_0x3c097b['query']);_0x6a11c5[_0x49cf('0x3d')]=_[_0x49cf('0x3b')](_0x3c097b[_0x49cf('0x36')],qs[_0x49cf('0x3c')](_0x1dc6c4[_0x49cf('0x38')]['fields']));_0x6a11c5['attributes']=_0x6a11c5[_0x49cf('0x3d')]['length']?_0x6a11c5[_0x49cf('0x3d')]:_0x3c097b[_0x49cf('0x36')];_0x6a11c5[_0x49cf('0x40')]=qs[_0x49cf('0x41')](_0x1dc6c4[_0x49cf('0x38')][_0x49cf('0x41')]);_0x6a11c5['where']=qs[_0x49cf('0x3a')](_[_0x49cf('0x43')](_0x1dc6c4[_0x49cf('0x38')],_0x3c097b['filters']));if(_0x1dc6c4[_0x49cf('0x38')]['filter']){_0x6a11c5['where']=_[_0x49cf('0x45')](_0x6a11c5['where'],{'$or':_[_0x49cf('0x37')](_0x6a11c5[_0x49cf('0x3d')],function(_0x51f952){var _0x3f1758={};_0x3f1758[_0x51f952]={'$like':'%'+_0x1dc6c4[_0x49cf('0x38')][_0x49cf('0x44')]+'%'};return _0x3f1758;})});}_0x6a11c5=_[_0x49cf('0x45')]({},_0x6a11c5,_0x1dc6c4[_0x49cf('0x47')]);return _0x484a0f[_0x49cf('0x67')](_0x6a11c5);}})[_0x49cf('0x2d')](function(_0x1a97c3){if(_0x1a97c3){_0x1c7f89=_0x1a97c3[_0x49cf('0x3e')];if(!_0x1dc6c4['query'][_0x49cf('0x3f')](_0x49cf('0x5c'))){_0x6a11c5[_0x49cf('0x22')]=qs[_0x49cf('0x22')](_0x1dc6c4['query'][_0x49cf('0x22')]);_0x6a11c5['offset']=qs[_0x49cf('0x20')](_0x1dc6c4[_0x49cf('0x38')]['offset']);}return _0x484a0f[_0x49cf('0x67')](_0x6a11c5);}})['then'](function(_0x53e2bb){if(_0x53e2bb){return _0x53e2bb?{'count':_0x1c7f89,'rows':_0x53e2bb}:null;}})[_0x49cf('0x2d')](respondWithResult(_0x2b4102,null))[_0x49cf('0x4c')](handleError(_0x2b4102,null));};exports[_0x49cf('0x68')]=function(_0x437254,_0x2d4e1e,_0x16b1ec){var _0x5abcce=_0x437254[_0x49cf('0x4f')]['ids'];return db[_0x49cf('0x66')][_0x49cf('0x4a')]({'where':{'id':_0x5abcce},'attributes':['id'],'include':[{'model':db[_0x49cf('0x5e')],'as':_0x49cf('0x69'),'attributes':['id','name',_0x49cf('0x6a'),_0x49cf('0x6b'),'interface'],'raw':!![]}]})[_0x49cf('0x2d')](function(_0x4bb994){if(_0x4bb994){var _0xbf3ee4=_['flatMap'](_0x4bb994,function(_0x2f2a6b){var _0x10dfe1=_0x2f2a6b['get']({'plain':!![]});return _0x10dfe1['Agents'];});return db[_0x49cf('0x32')][_0x49cf('0x58')]({'where':{'id':_0x437254[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](function(_0x40de94){return db[_0x49cf('0x6c')][_0x49cf('0x6d')](function(_0xc689f7){return _0x40de94[_0x49cf('0x68')](_0x5abcce,{'transaction':_0xc689f7})[_0x49cf('0x2d')](function(){return BPromise[_0x49cf('0x6e')](_0xbf3ee4,function(_0x5777a0){return db['UserFaxQueue'][_0x49cf('0x6f')]({'where':{'UserId':_0x5777a0['id'],'FaxQueueId':_0x437254['params']['id']},'transaction':_0xc689f7});});})['then'](function(){_0xbf3ee4[_0x49cf('0x70')](function(_0x17f658){socket[_0x49cf('0x71')]('userFaxQueue:save',{'UserId':_0x17f658['id'],'FaxQueueId':_0x40de94['id']});});});});});}})[_0x49cf('0x2d')](respondWithStatusCode(_0x2d4e1e,null))[_0x49cf('0x4c')](handleError(_0x2d4e1e,null));};exports[_0x49cf('0x72')]=function(_0x2567bc,_0xb6647d,_0x98baae){return db['Team'][_0x49cf('0x4a')]({'where':{'id':_0x2567bc['query'][_0x49cf('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xb6647d,null))[_0x49cf('0x2d')](function(_0x5bb9c8){var _0x579058=_[_0x49cf('0x37')](_0x5bb9c8,'id');var _0x1d4c96=[];var _0x1bf427=[];var _0x4318be=squel['select']();_0x4318be[_0x49cf('0x74')](_0x49cf('0x75'))[_0x49cf('0x76')](_0x49cf('0x77'),'tq')[_0x49cf('0x78')]('user_has_teams','ut',_0x49cf('0x79'))[_0x49cf('0x42')](_0x49cf('0x7a'),_0x2567bc[_0x49cf('0x57')]['id']);for(var _0x485fd7=0x0;_0x485fd7<_0x5bb9c8[_0x49cf('0x3e')];_0x485fd7+=0x1){let _0x488d0d=_0x5bb9c8[_0x485fd7];for(var _0x23dcb1=0x0;_0x23dcb1<_0x488d0d['Agents'][_0x49cf('0x3e')];_0x23dcb1+=0x1){let _0x16c6e3=_0x488d0d[_0x49cf('0x69')][_0x23dcb1];var _0x408abc=_0x4318be['clone']();_0x408abc[_0x49cf('0x42')](_0x49cf('0x7b'),_0x16c6e3['id']);_0x1bf427[_0x49cf('0x7c')](db['sequelize'][_0x49cf('0x38')](_0x408abc[_0x49cf('0x7d')](),{'type':db[_0x49cf('0x6c')]['QueryTypes']['SELECT']})[_0x49cf('0x2d')](function(_0x32ee4d){if(_0x32ee4d['length']===0x1){return _0x16c6e3['id'];}else{var _0x73997=_[_0x49cf('0x7e')](_[_0x49cf('0x37')](_0x32ee4d,_0x49cf('0x7f')),function(_0x3a8262){return _['includes'](_0x579058,_0x3a8262);});if(_0x73997){return _0x16c6e3['id'];}}}));}}return BPromise[_0x49cf('0x80')](_0x1bf427)[_0x49cf('0x2d')](function(_0x13e65e){_0x1d4c96=_(_0x1d4c96)[_0x49cf('0x81')](_0x13e65e)[_0x49cf('0x82')]()[_0x49cf('0x83')]();return db['FaxQueue'][_0x49cf('0x58')]({'where':{'id':_0x2567bc[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](function(_0x4492e3){return db[_0x49cf('0x6c')][_0x49cf('0x6d')](function(_0x863e5d){return _0x4492e3[_0x49cf('0x72')](_0x2567bc[_0x49cf('0x38')][_0x49cf('0x73')],{'transaction':_0x863e5d})['then'](function(){if(!_[_0x49cf('0x84')](_0x1d4c96)){return _0x4492e3[_0x49cf('0x85')](_0x1d4c96,{'transaction':_0x863e5d});}})['then'](function(){_0x1d4c96['forEach'](function(_0x450dab){socket[_0x49cf('0x71')](_0x49cf('0x86'),{'UserId':_0x450dab,'FaxQueueId':_0x4492e3['id']});});});});});});})['then'](respondWithStatusCode(_0xb6647d,null))[_0x49cf('0x4c')](handleError(_0xb6647d,null));};exports['addAgents']=function(_0x50adfe,_0xaec174,_0x38a09d){return db[_0x49cf('0x32')]['find']({'where':{'id':_0x50adfe[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](handleEntityNotFound(_0xaec174,null))[_0x49cf('0x2d')](function(_0x3fd64e){if(_0x3fd64e){return _0x3fd64e[_0x49cf('0x87')](_0x50adfe[_0x49cf('0x4f')][_0x49cf('0x73')],_[_0x49cf('0x88')](_0x50adfe[_0x49cf('0x4f')],[_0x49cf('0x73'),'id'])||{})['spread'](function(_0x1d9dd4){for(var _0x587316=0x0;_0x587316<_0x50adfe[_0x49cf('0x4f')][_0x49cf('0x73')][_0x49cf('0x3e')];_0x587316+=0x1){socket[_0x49cf('0x71')](_0x49cf('0x89'),{'UserId':Number(_0x50adfe[_0x49cf('0x4f')][_0x49cf('0x73')][_0x587316]),'FaxQueueId':Number(_0x50adfe[_0x49cf('0x57')]['id'])});}return _0x1d9dd4;});}})['then'](respondWithResult(_0xaec174,null))['catch'](handleError(_0xaec174,null));};exports[_0x49cf('0x85')]=function(_0x5b7d7a,_0x514a85,_0x6858a4){return db['FaxQueue'][_0x49cf('0x58')]({'where':{'id':_0x5b7d7a[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](handleEntityNotFound(_0x514a85,null))[_0x49cf('0x2d')](function(_0x3899fb){if(_0x3899fb){return _0x3899fb[_0x49cf('0x85')](_0x5b7d7a[_0x49cf('0x38')][_0x49cf('0x73')])[_0x49cf('0x2d')](function(){if(_[_0x49cf('0x8a')](_0x5b7d7a['query']['ids'])){for(var _0x2878b4=0x0;_0x2878b4<_0x5b7d7a[_0x49cf('0x38')][_0x49cf('0x73')][_0x49cf('0x3e')];_0x2878b4+=0x1){socket[_0x49cf('0x71')](_0x49cf('0x86'),{'UserId':Number(_0x5b7d7a[_0x49cf('0x38')][_0x49cf('0x73')][_0x2878b4]),'FaxQueueId':Number(_0x5b7d7a[_0x49cf('0x57')]['id'])});}}else{socket['emit'](_0x49cf('0x86'),{'UserId':Number(_0x5b7d7a[_0x49cf('0x38')][_0x49cf('0x73')]),'FaxQueueId':Number(_0x5b7d7a['params']['id'])});}});}})[_0x49cf('0x2d')](respondWithStatusCode(_0x514a85,null))[_0x49cf('0x4c')](handleError(_0x514a85,null));};exports[_0x49cf('0x8b')]=function(_0x1cd2c3,_0x3f44f2,_0x177b69){var _0x106a51={};var _0x1f91dc={};var _0x1028c1;var _0x26c919;return db[_0x49cf('0x32')][_0x49cf('0x5a')]({'where':{'id':_0x1cd2c3[_0x49cf('0x57')]['id']}})[_0x49cf('0x2d')](handleEntityNotFound(_0x3f44f2,null))['then'](function(_0x1b7a09){if(_0x1b7a09){_0x1028c1=_0x1b7a09;_0x1f91dc[_0x49cf('0x36')]=_[_0x49cf('0x39')](db[_0x49cf('0x5e')]['rawAttributes']);_0x1f91dc[_0x49cf('0x38')]=_[_0x49cf('0x39')](_0x1cd2c3[_0x49cf('0x38')]);_0x1f91dc[_0x49cf('0x3a')]=_[_0x49cf('0x3b')](_0x1f91dc['model'],_0x1f91dc[_0x49cf('0x38')]);_0x106a51[_0x49cf('0x3d')]=_['intersection'](_0x1f91dc[_0x49cf('0x36')],qs[_0x49cf('0x3c')](_0x1cd2c3[_0x49cf('0x38')][_0x49cf('0x3c')]));_0x106a51[_0x49cf('0x3d')]=_0x106a51['attributes'][_0x49cf('0x3e')]?_0x106a51[_0x49cf('0x3d')]:_0x1f91dc[_0x49cf('0x36')];_0x106a51[_0x49cf('0x40')]=qs['sort'](_0x1cd2c3[_0x49cf('0x38')]['sort']);_0x106a51[_0x49cf('0x42')]=qs[_0x49cf('0x3a')](_['pick'](_0x1cd2c3[_0x49cf('0x38')],_0x1f91dc['filters']));if(_0x1cd2c3[_0x49cf('0x38')][_0x49cf('0x44')]){_0x106a51['where']=_[_0x49cf('0x45')](_0x106a51['where'],{'$or':_[_0x49cf('0x37')](_0x106a51[_0x49cf('0x3d')],function(_0x4243f){var _0x48d3ae={};_0x48d3ae[_0x4243f]={'$like':'%'+_0x1cd2c3['query']['filter']+'%'};return _0x48d3ae;})});}_0x106a51=_['merge']({},_0x106a51,_0x1cd2c3[_0x49cf('0x47')]);return _0x1028c1['getAgents'](_0x106a51);}})[_0x49cf('0x2d')](function(_0x12ecc2){if(_0x12ecc2){_0x26c919=_0x12ecc2[_0x49cf('0x3e')];if(!_0x1cd2c3[_0x49cf('0x38')][_0x49cf('0x3f')]('nolimit')){_0x106a51[_0x49cf('0x22')]=qs[_0x49cf('0x22')](_0x1cd2c3[_0x49cf('0x38')][_0x49cf('0x22')]);_0x106a51['offset']=qs[_0x49cf('0x20')](_0x1cd2c3['query'][_0x49cf('0x20')]);}return _0x1028c1[_0x49cf('0x8b')](_0x106a51);}})[_0x49cf('0x2d')](function(_0x32ccd8){if(_0x32ccd8){return _0x32ccd8?{'count':_0x26c919,'rows':_0x32ccd8}:null;}})[_0x49cf('0x2d')](respondWithResult(_0x3f44f2,null))[_0x49cf('0x4c')](handleError(_0x3f44f2,null));}; \ No newline at end of file +var _0x5105=['from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','includes','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxQueue','include','findAll','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','faxPause','createdAt','updatedAt','findOne','Team','getTeams','addTeams','ids','Agents','flatMap','transaction','each','forEach','emit','removeTeams','select'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x5105,0x122));var _0x5510=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5105[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x5510('0x0'));var rimraf=require(_0x5510('0x1'));var zipdir=require(_0x5510('0x2'));var jsonpatch=require(_0x5510('0x3'));var rp=require('request-promise');var moment=require(_0x5510('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5510('0x5'));var sox=require(_0x5510('0x6'));var csv=require(_0x5510('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5510('0x8'));var _=require(_0x5510('0x9'));var squel=require('squel');var crypto=require(_0x5510('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5510('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5510('0xc'));var Papa=require(_0x5510('0xd'));var Redis=require(_0x5510('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5510('0xf'));var as=require(_0x5510('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5510('0x11'))(_0x5510('0x12'));var utils=require('../../config/utils');var config=require(_0x5510('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5510('0x14'))['db'];config[_0x5510('0x15')]=_[_0x5510('0x16')](config['redis'],{'host':_0x5510('0x17'),'port':0x18eb});var socket=require(_0x5510('0x18'))(new Redis(config[_0x5510('0x15')]));require('./faxQueue.socket')[_0x5510('0x19')](socket);function respondWithStatusCode(_0x873f73,_0x497259){_0x497259=_0x497259||0xcc;return function(_0x31ab07){if(_0x31ab07){return _0x873f73[_0x5510('0x1a')](_0x497259);}return _0x873f73[_0x5510('0x1b')](_0x497259)[_0x5510('0x1c')]();};}function respondWithResult(_0x59e435,_0x465ff4){_0x465ff4=_0x465ff4||0xc8;return function(_0x52c03f){if(_0x52c03f){return _0x59e435[_0x5510('0x1b')](_0x465ff4)['json'](_0x52c03f);}};}function respondWithFilteredResult(_0x59a934,_0x43028a){return function(_0x108b2a){if(_0x108b2a){var _0xb31138=typeof _0x43028a[_0x5510('0x1d')]===_0x5510('0x1e')&&typeof _0x43028a[_0x5510('0x1f')]===_0x5510('0x1e');var _0x5f0e28=_0x108b2a[_0x5510('0x20')];var _0x51d370=_0xb31138?0x0:_0x43028a[_0x5510('0x1d')];var _0x4d1f1b=_0xb31138?_0x108b2a[_0x5510('0x20')]:_0x43028a['offset']+_0x43028a['limit'];var _0x5717f0;if(_0x4d1f1b>=_0x5f0e28){_0x4d1f1b=_0x5f0e28;_0x5717f0=0xc8;}else{_0x5717f0=0xce;}_0x59a934[_0x5510('0x1b')](_0x5717f0);return _0x59a934[_0x5510('0x21')](_0x5510('0x22'),_0x51d370+'-'+_0x4d1f1b+'/'+_0x5f0e28)[_0x5510('0x23')](_0x108b2a);}return null;};}function patchUpdates(_0x22797b){return function(_0x55c19a){try{jsonpatch[_0x5510('0x24')](_0x55c19a,_0x22797b,!![]);}catch(_0x10d625){return BPromise[_0x5510('0x25')](_0x10d625);}return _0x55c19a[_0x5510('0x26')]();};}function saveUpdates(_0x2e7bde,_0x29e8c4){return function(_0x4777ca){if(_0x4777ca){return _0x4777ca['update'](_0x2e7bde)[_0x5510('0x27')](function(_0x4e103c){return _0x4e103c;});}return null;};}function removeEntity(_0x404aa4,_0x57dba2){return function(_0xd17dab){if(_0xd17dab){return _0xd17dab[_0x5510('0x28')]()[_0x5510('0x27')](function(){var _0x4659cf=_0xd17dab[_0x5510('0x29')]({'plain':!![]});var _0x1592be=_0x5510('0x2a');return db[_0x5510('0x2b')][_0x5510('0x28')]({'where':{'type':_0x1592be,'resourceId':_0x4659cf['id']}})[_0x5510('0x27')](function(){return _0xd17dab;});})['then'](function(){_0x404aa4[_0x5510('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x583746,_0x508ce9){return function(_0x2011b3){if(!_0x2011b3){_0x583746[_0x5510('0x1a')](0x194);}return _0x2011b3;};}function handleError(_0x14d8fe,_0x2ae92){_0x2ae92=_0x2ae92||0x1f4;return function(_0x2798f5){logger[_0x5510('0x2c')](_0x2798f5[_0x5510('0x2d')]);if(_0x2798f5[_0x5510('0x2e')]){delete _0x2798f5['name'];}_0x14d8fe[_0x5510('0x1b')](_0x2ae92)[_0x5510('0x2f')](_0x2798f5);};}exports[_0x5510('0x30')]=function(_0x5f4736,_0x44c07c){var _0x802626={},_0x4e75b3={},_0x52d2d9={'count':0x0,'rows':[]};var _0x5d84da=_[_0x5510('0x31')](db['FaxQueue'][_0x5510('0x32')],function(_0x4e3037){return{'name':_0x4e3037[_0x5510('0x33')],'type':_0x4e3037[_0x5510('0x34')]['key']};});_0x4e75b3['model']=_[_0x5510('0x31')](_0x5d84da,_0x5510('0x2e'));_0x4e75b3[_0x5510('0x35')]=_['keys'](_0x5f4736[_0x5510('0x35')]);_0x4e75b3[_0x5510('0x36')]=_[_0x5510('0x37')](_0x4e75b3['model'],_0x4e75b3[_0x5510('0x35')]);_0x802626[_0x5510('0x38')]=_['intersection'](_0x4e75b3['model'],qs[_0x5510('0x39')](_0x5f4736[_0x5510('0x35')][_0x5510('0x39')]));_0x802626[_0x5510('0x38')]=_0x802626[_0x5510('0x38')][_0x5510('0x3a')]?_0x802626[_0x5510('0x38')]:_0x4e75b3[_0x5510('0x3b')];if(!_0x5f4736[_0x5510('0x35')][_0x5510('0x3c')](_0x5510('0x3d'))){_0x802626[_0x5510('0x1f')]=qs[_0x5510('0x1f')](_0x5f4736['query'][_0x5510('0x1f')]);_0x802626[_0x5510('0x1d')]=qs[_0x5510('0x1d')](_0x5f4736[_0x5510('0x35')]['offset']);}_0x802626[_0x5510('0x3e')]=qs[_0x5510('0x3f')](_0x5f4736[_0x5510('0x35')]['sort']);_0x802626[_0x5510('0x40')]=qs[_0x5510('0x36')](_['pick'](_0x5f4736[_0x5510('0x35')],_0x4e75b3['filters']),_0x5d84da);if(_0x5f4736[_0x5510('0x35')][_0x5510('0x41')]){_0x802626['where']=_[_0x5510('0x42')](_0x802626[_0x5510('0x40')],{'$or':_[_0x5510('0x31')](_0x5d84da,function(_0xdd83a4){if(_0xdd83a4['type']!==_0x5510('0x43')){var _0x34aed1={};_0x34aed1[_0xdd83a4[_0x5510('0x2e')]]={'$like':'%'+_0x5f4736[_0x5510('0x35')][_0x5510('0x41')]+'%'};return _0x34aed1;}})});}_0x802626=_[_0x5510('0x42')]({},_0x802626,_0x5f4736[_0x5510('0x44')]);var _0x281e00={'where':_0x802626[_0x5510('0x40')]};return db[_0x5510('0x45')][_0x5510('0x20')](_0x281e00)[_0x5510('0x27')](function(_0x3be8cf){_0x52d2d9[_0x5510('0x20')]=_0x3be8cf;if(_0x5f4736[_0x5510('0x35')]['includeAll']){_0x802626[_0x5510('0x46')]=[{'all':!![]}];}return db[_0x5510('0x45')][_0x5510('0x47')](_0x802626);})[_0x5510('0x27')](function(_0x3c434f){_0x52d2d9[_0x5510('0x48')]=_0x3c434f;return _0x52d2d9;})['then'](respondWithFilteredResult(_0x44c07c,_0x802626))[_0x5510('0x49')](handleError(_0x44c07c,null));};exports[_0x5510('0x4a')]=function(_0x57cf37,_0xd72cde){var _0x1d1c56={'raw':!![],'where':{'id':_0x57cf37[_0x5510('0x4b')]['id']}},_0x198716={};_0x198716[_0x5510('0x3b')]=_[_0x5510('0x4c')](db['FaxQueue'][_0x5510('0x32')]);_0x198716[_0x5510('0x35')]=_[_0x5510('0x4c')](_0x57cf37[_0x5510('0x35')]);_0x198716['filters']=_['intersection'](_0x198716[_0x5510('0x3b')],_0x198716[_0x5510('0x35')]);_0x1d1c56[_0x5510('0x38')]=_[_0x5510('0x37')](_0x198716['model'],qs[_0x5510('0x39')](_0x57cf37[_0x5510('0x35')]['fields']));_0x1d1c56['attributes']=_0x1d1c56[_0x5510('0x38')][_0x5510('0x3a')]?_0x1d1c56[_0x5510('0x38')]:_0x198716[_0x5510('0x3b')];if(_0x57cf37[_0x5510('0x35')][_0x5510('0x4d')]){_0x1d1c56['include']=[{'all':!![]}];}_0x1d1c56=_[_0x5510('0x42')]({},_0x1d1c56,_0x57cf37[_0x5510('0x44')]);return db[_0x5510('0x45')][_0x5510('0x4e')](_0x1d1c56)[_0x5510('0x27')](handleEntityNotFound(_0xd72cde,null))[_0x5510('0x27')](respondWithResult(_0xd72cde,null))[_0x5510('0x49')](handleError(_0xd72cde,null));};exports[_0x5510('0x4f')]=function(_0x436b56,_0x5daaa7){return db[_0x5510('0x45')]['create'](_0x436b56['body'],{})[_0x5510('0x27')](function(_0x4229de){var _0x30f8b8=_0x436b56[_0x5510('0x50')][_0x5510('0x29')]({'plain':!![]});if(!_0x30f8b8)throw new Error(_0x5510('0x51'));if(_0x30f8b8[_0x5510('0x52')]===_0x5510('0x50')){var _0x5cb9a2=_0x4229de[_0x5510('0x29')]({'plain':!![]});var _0x4a1080='FaxQueues';return db[_0x5510('0x53')]['find']({'where':{'name':_0x4a1080,'userProfileId':_0x30f8b8[_0x5510('0x54')]},'raw':!![]})[_0x5510('0x27')](function(_0x558fdd){if(_0x558fdd&&_0x558fdd[_0x5510('0x55')]===0x0){return db[_0x5510('0x2b')][_0x5510('0x4f')]({'name':_0x5cb9a2['name'],'resourceId':_0x5cb9a2['id'],'type':_0x558fdd[_0x5510('0x2e')],'sectionId':_0x558fdd['id']},{})[_0x5510('0x27')](function(){return _0x4229de;});}else{return _0x4229de;}})[_0x5510('0x49')](function(_0x5dc50c){logger[_0x5510('0x2c')](_0x5510('0x56'),_0x5dc50c);throw _0x5dc50c;});}return _0x4229de;})[_0x5510('0x27')](respondWithResult(_0x5daaa7,0xc9))['catch'](handleError(_0x5daaa7,null));};exports[_0x5510('0x57')]=function(_0x133b2b,_0x23b290){if(_0x133b2b[_0x5510('0x58')]['id']){delete _0x133b2b['body']['id'];}return db['FaxQueue'][_0x5510('0x4e')]({'where':{'id':_0x133b2b[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x23b290,null))['then'](saveUpdates(_0x133b2b['body'],null))['then'](respondWithResult(_0x23b290,null))[_0x5510('0x49')](handleError(_0x23b290,null));};exports[_0x5510('0x28')]=function(_0x1761e0,_0x3791a4){return db[_0x5510('0x45')][_0x5510('0x4e')]({'where':{'id':_0x1761e0[_0x5510('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3791a4,null))['then'](removeEntity(_0x3791a4,null))[_0x5510('0x49')](handleError(_0x3791a4,null));};exports['describe']=function(_0x64ee34,_0x2fedd9){return db[_0x5510('0x45')][_0x5510('0x59')]()[_0x5510('0x27')](respondWithResult(_0x2fedd9,null))[_0x5510('0x49')](handleError(_0x2fedd9,null));};exports['getMembers']=function(_0x3682c1,_0x8512f6,_0x50fc7e){var _0x13b1b5={'raw':!![],'where':{}},_0x3f578b={},_0x3167cd;return db[_0x5510('0x45')]['findOne']({'where':{'id':_0x3682c1[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x8512f6,null))[_0x5510('0x27')](function(_0x29f261){if(_0x29f261){_0x3167cd=_0x29f261[_0x5510('0x29')]({'plain':!![]});_0x3f578b['model']=_[_0x5510('0x4c')](db[_0x5510('0x5a')][_0x5510('0x32')]);_0x3f578b[_0x5510('0x35')]=_['keys'](_0x3682c1[_0x5510('0x35')]);_0x3f578b[_0x5510('0x36')]=_[_0x5510('0x37')](_0x3f578b[_0x5510('0x3b')],_0x3f578b[_0x5510('0x35')]);_0x13b1b5['attributes']=_[_0x5510('0x37')](_0x3f578b[_0x5510('0x3b')],qs[_0x5510('0x39')](_0x3682c1['query']['fields']));_0x13b1b5[_0x5510('0x38')]=_0x13b1b5['attributes'][_0x5510('0x3a')]?_0x13b1b5['attributes']:_0x3f578b[_0x5510('0x3b')];if(!_0x3682c1[_0x5510('0x35')][_0x5510('0x3c')](_0x5510('0x3d'))){_0x13b1b5[_0x5510('0x1f')]=qs[_0x5510('0x1f')](_0x3682c1[_0x5510('0x35')]['limit']);_0x13b1b5[_0x5510('0x1d')]=qs[_0x5510('0x1d')](_0x3682c1[_0x5510('0x35')][_0x5510('0x1d')]);}_0x13b1b5[_0x5510('0x3e')]=qs[_0x5510('0x3f')](_0x3682c1['query'][_0x5510('0x3f')]);_0x13b1b5[_0x5510('0x40')]=qs[_0x5510('0x36')](_[_0x5510('0x5b')](_0x3682c1[_0x5510('0x35')],_0x3f578b[_0x5510('0x36')]));_0x13b1b5['where']['FaxQueueId']=_0x29f261['id'];if(_0x3682c1[_0x5510('0x35')][_0x5510('0x41')]){_0x13b1b5['where']=_[_0x5510('0x42')](_0x13b1b5[_0x5510('0x40')],{'$or':_['map'](_0x13b1b5['attributes'],function(_0x4875d7){var _0xeb0184={};_0xeb0184[_0x4875d7]={'$like':'%'+_0x3682c1['query'][_0x5510('0x41')]+'%'};return _0xeb0184;})});}_0x13b1b5=_[_0x5510('0x42')]({},_0x13b1b5,_0x3682c1[_0x5510('0x44')]);return db[_0x5510('0x5a')][_0x5510('0x47')](_0x13b1b5);}})[_0x5510('0x27')](function(_0x4d1c8f){if(_0x4d1c8f){return db[_0x5510('0x5c')][_0x5510('0x5d')]({'where':{'id':_[_0x5510('0x31')](_0x4d1c8f,_0x5510('0x5e')),'role':_0x5510('0x5f')},'attributes':['id',_0x5510('0x2e'),_0x5510('0x60'),'updatedAt','createdAt']});}})[_0x5510('0x27')](function(_0x2b8461){if(_0x2b8461){return{'count':_0x2b8461[_0x5510('0x20')],'rows':_[_0x5510('0x31')](_0x2b8461[_0x5510('0x48')],function(_0x3a23e4){return{'membername':_0x3a23e4[_0x5510('0x2e')],'UserId':_0x3a23e4['id'],'queue_name':_0x3167cd[_0x5510('0x2e')],'FaxQueueId':_0x3167cd['id'],'interface':util['format']('%s/%s','SIP',_0x3a23e4[_0x5510('0x2e')]),'penalty':0x0,'paused':_0x3a23e4[_0x5510('0x60')],'createdAt':_0x3a23e4[_0x5510('0x61')],'updatedAt':_0x3a23e4[_0x5510('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5510('0x27')](respondWithFilteredResult(_0x8512f6,_0x13b1b5))['catch'](handleError(_0x8512f6,null));};exports['getTeams']=function(_0x4d72f4,_0x58c446,_0x2fdfe0){var _0x32d1b6={};var _0x5652b0={};var _0x9683;var _0x5d7df6;return db['FaxQueue'][_0x5510('0x63')]({'where':{'id':_0x4d72f4[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x58c446,null))[_0x5510('0x27')](function(_0x2ef4c5){if(_0x2ef4c5){_0x9683=_0x2ef4c5;_0x5652b0[_0x5510('0x3b')]=_[_0x5510('0x4c')](db[_0x5510('0x64')][_0x5510('0x32')]);_0x5652b0[_0x5510('0x35')]=_[_0x5510('0x4c')](_0x4d72f4[_0x5510('0x35')]);_0x5652b0[_0x5510('0x36')]=_[_0x5510('0x37')](_0x5652b0['model'],_0x5652b0[_0x5510('0x35')]);_0x32d1b6[_0x5510('0x38')]=_[_0x5510('0x37')](_0x5652b0[_0x5510('0x3b')],qs['fields'](_0x4d72f4['query'][_0x5510('0x39')]));_0x32d1b6[_0x5510('0x38')]=_0x32d1b6['attributes'][_0x5510('0x3a')]?_0x32d1b6[_0x5510('0x38')]:_0x5652b0['model'];_0x32d1b6[_0x5510('0x3e')]=qs[_0x5510('0x3f')](_0x4d72f4[_0x5510('0x35')][_0x5510('0x3f')]);_0x32d1b6['where']=qs[_0x5510('0x36')](_['pick'](_0x4d72f4[_0x5510('0x35')],_0x5652b0[_0x5510('0x36')]));if(_0x4d72f4['query'][_0x5510('0x41')]){_0x32d1b6[_0x5510('0x40')]=_[_0x5510('0x42')](_0x32d1b6[_0x5510('0x40')],{'$or':_[_0x5510('0x31')](_0x32d1b6[_0x5510('0x38')],function(_0x568edb){var _0x29428c={};_0x29428c[_0x568edb]={'$like':'%'+_0x4d72f4['query']['filter']+'%'};return _0x29428c;})});}_0x32d1b6=_[_0x5510('0x42')]({},_0x32d1b6,_0x4d72f4[_0x5510('0x44')]);return _0x9683[_0x5510('0x65')](_0x32d1b6);}})['then'](function(_0x32641a){if(_0x32641a){_0x5d7df6=_0x32641a['length'];if(!_0x4d72f4[_0x5510('0x35')][_0x5510('0x3c')](_0x5510('0x3d'))){_0x32d1b6[_0x5510('0x1f')]=qs['limit'](_0x4d72f4[_0x5510('0x35')][_0x5510('0x1f')]);_0x32d1b6['offset']=qs[_0x5510('0x1d')](_0x4d72f4[_0x5510('0x35')][_0x5510('0x1d')]);}return _0x9683[_0x5510('0x65')](_0x32d1b6);}})[_0x5510('0x27')](function(_0x201f51){if(_0x201f51){return _0x201f51?{'count':_0x5d7df6,'rows':_0x201f51}:null;}})[_0x5510('0x27')](respondWithResult(_0x58c446,null))['catch'](handleError(_0x58c446,null));};exports[_0x5510('0x66')]=function(_0x271332,_0x20817e,_0x51f170){var _0x1773d3=_0x271332[_0x5510('0x58')][_0x5510('0x67')];return db[_0x5510('0x64')]['findAll']({'where':{'id':_0x1773d3},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5510('0x68'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x5510('0x27')](function(_0xc340e8){if(_0xc340e8){var _0x3e81af=_[_0x5510('0x69')](_0xc340e8,function(_0x4f4290){var _0x36a6da=_0x4f4290[_0x5510('0x29')]({'plain':!![]});return _0x36a6da[_0x5510('0x68')];});return db[_0x5510('0x45')][_0x5510('0x4e')]({'where':{'id':_0x271332[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](function(_0x2b1751){return db['sequelize'][_0x5510('0x6a')](function(_0x878ce2){return _0x2b1751['addTeams'](_0x1773d3,{'transaction':_0x878ce2})[_0x5510('0x27')](function(){return BPromise[_0x5510('0x6b')](_0x3e81af,function(_0x29ee16){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x29ee16['id'],'FaxQueueId':_0x271332[_0x5510('0x4b')]['id']},'transaction':_0x878ce2});});})[_0x5510('0x27')](function(){_0x3e81af[_0x5510('0x6c')](function(_0x3c2407){socket[_0x5510('0x6d')]('userFaxQueue:save',{'UserId':_0x3c2407['id'],'FaxQueueId':_0x2b1751['id']});});});});});}})['then'](respondWithStatusCode(_0x20817e,null))[_0x5510('0x49')](handleError(_0x20817e,null));};exports[_0x5510('0x6e')]=function(_0x4013cd,_0x239e4e,_0x1c827c){return db[_0x5510('0x64')][_0x5510('0x47')]({'where':{'id':_0x4013cd[_0x5510('0x35')][_0x5510('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5510('0x5c')],'as':_0x5510('0x68'),'attributes':['id'],'raw':!![]}]})[_0x5510('0x27')](handleEntityNotFound(_0x239e4e,null))[_0x5510('0x27')](function(_0x1d921c){var _0x10e1fd=_[_0x5510('0x31')](_0x1d921c,'id');var _0x5db207=[];var _0x25a191=[];var _0x1abf3b=squel[_0x5510('0x6f')]();_0x1abf3b['field']('tq.TeamId')[_0x5510('0x70')]('team_has_fax_queues','tq')['join'](_0x5510('0x71'),'ut',_0x5510('0x72'))[_0x5510('0x40')]('FaxQueueId\x20=\x20?',_0x4013cd[_0x5510('0x4b')]['id']);for(var _0x4c1e84=0x0;_0x4c1e84<_0x1d921c[_0x5510('0x3a')];_0x4c1e84+=0x1){let _0x4f6935=_0x1d921c[_0x4c1e84];for(var _0x28a127=0x0;_0x28a127<_0x4f6935[_0x5510('0x68')]['length'];_0x28a127+=0x1){let _0x1643a9=_0x4f6935[_0x5510('0x68')][_0x28a127];var _0x4ae6c0=_0x1abf3b[_0x5510('0x73')]();_0x4ae6c0[_0x5510('0x40')](_0x5510('0x74'),_0x1643a9['id']);_0x25a191[_0x5510('0x75')](db[_0x5510('0x76')][_0x5510('0x35')](_0x4ae6c0[_0x5510('0x77')](),{'type':db[_0x5510('0x76')][_0x5510('0x78')]['SELECT']})['then'](function(_0x197fe6){if(_0x197fe6[_0x5510('0x3a')]===0x1){return _0x1643a9['id'];}else{var _0x505249=_[_0x5510('0x79')](_['map'](_0x197fe6,'TeamId'),function(_0x4d8f4a){return _[_0x5510('0x7a')](_0x10e1fd,_0x4d8f4a);});if(_0x505249){return _0x1643a9['id'];}}}));}}return BPromise['all'](_0x25a191)['then'](function(_0x10d0c7){_0x5db207=_(_0x5db207)[_0x5510('0x7b')](_0x10d0c7)[_0x5510('0x7c')]()['value']();return db[_0x5510('0x45')][_0x5510('0x4e')]({'where':{'id':_0x4013cd[_0x5510('0x4b')]['id']}})['then'](function(_0x4de32f){return db['sequelize'][_0x5510('0x6a')](function(_0x385a38){return _0x4de32f[_0x5510('0x6e')](_0x4013cd['query']['ids'],{'transaction':_0x385a38})[_0x5510('0x27')](function(){if(!_[_0x5510('0x7d')](_0x5db207)){return _0x4de32f[_0x5510('0x7e')](_0x5db207,{'transaction':_0x385a38});}})[_0x5510('0x27')](function(){_0x5db207['forEach'](function(_0x193d26){socket[_0x5510('0x6d')](_0x5510('0x7f'),{'UserId':_0x193d26,'FaxQueueId':_0x4de32f['id']});});});});});});})[_0x5510('0x27')](respondWithStatusCode(_0x239e4e,null))['catch'](handleError(_0x239e4e,null));};exports[_0x5510('0x80')]=function(_0x92f776,_0x4164ac,_0x357446){return db['FaxQueue'][_0x5510('0x4e')]({'where':{'id':_0x92f776[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x4164ac,null))[_0x5510('0x27')](function(_0x13187b){if(_0x13187b){return _0x13187b[_0x5510('0x80')](_0x92f776[_0x5510('0x58')][_0x5510('0x67')],_[_0x5510('0x81')](_0x92f776[_0x5510('0x58')],[_0x5510('0x67'),'id'])||{})[_0x5510('0x82')](function(_0x5c5760){for(var _0x4d7b65=0x0;_0x4d7b65<_0x92f776[_0x5510('0x58')][_0x5510('0x67')]['length'];_0x4d7b65+=0x1){socket[_0x5510('0x6d')](_0x5510('0x83'),{'UserId':Number(_0x92f776[_0x5510('0x58')]['ids'][_0x4d7b65]),'FaxQueueId':Number(_0x92f776[_0x5510('0x4b')]['id'])});}return _0x5c5760;});}})[_0x5510('0x27')](respondWithResult(_0x4164ac,null))[_0x5510('0x49')](handleError(_0x4164ac,null));};exports['removeAgents']=function(_0x5c3957,_0x20b3d8,_0x24d434){return db['FaxQueue'][_0x5510('0x4e')]({'where':{'id':_0x5c3957['params']['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x20b3d8,null))[_0x5510('0x27')](function(_0x432625){if(_0x432625){return _0x432625[_0x5510('0x7e')](_0x5c3957['query'][_0x5510('0x67')])[_0x5510('0x27')](function(){if(_[_0x5510('0x84')](_0x5c3957['query'][_0x5510('0x67')])){for(var _0x212075=0x0;_0x212075<_0x5c3957[_0x5510('0x35')][_0x5510('0x67')][_0x5510('0x3a')];_0x212075+=0x1){socket[_0x5510('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x5c3957[_0x5510('0x35')][_0x5510('0x67')][_0x212075]),'FaxQueueId':Number(_0x5c3957['params']['id'])});}}else{socket[_0x5510('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x5c3957[_0x5510('0x35')][_0x5510('0x67')]),'FaxQueueId':Number(_0x5c3957['params']['id'])});}});}})['then'](respondWithStatusCode(_0x20b3d8,null))[_0x5510('0x49')](handleError(_0x20b3d8,null));};exports[_0x5510('0x85')]=function(_0xa791cb,_0x4b358d,_0x281162){var _0x493a89={};var _0x453096={};var _0xa11e7b;var _0x4664d4;return db[_0x5510('0x45')][_0x5510('0x63')]({'where':{'id':_0xa791cb[_0x5510('0x4b')]['id']}})[_0x5510('0x27')](handleEntityNotFound(_0x4b358d,null))[_0x5510('0x27')](function(_0x1ec4cb){if(_0x1ec4cb){_0xa11e7b=_0x1ec4cb;_0x453096['model']=_[_0x5510('0x4c')](db[_0x5510('0x5c')][_0x5510('0x32')]);_0x453096[_0x5510('0x35')]=_[_0x5510('0x4c')](_0xa791cb[_0x5510('0x35')]);_0x453096[_0x5510('0x36')]=_[_0x5510('0x37')](_0x453096[_0x5510('0x3b')],_0x453096[_0x5510('0x35')]);_0x493a89['attributes']=_['intersection'](_0x453096['model'],qs[_0x5510('0x39')](_0xa791cb[_0x5510('0x35')][_0x5510('0x39')]));_0x493a89[_0x5510('0x38')]=_0x493a89[_0x5510('0x38')][_0x5510('0x3a')]?_0x493a89[_0x5510('0x38')]:_0x453096['model'];_0x493a89[_0x5510('0x3e')]=qs['sort'](_0xa791cb[_0x5510('0x35')]['sort']);_0x493a89[_0x5510('0x40')]=qs[_0x5510('0x36')](_[_0x5510('0x5b')](_0xa791cb[_0x5510('0x35')],_0x453096['filters']));if(_0xa791cb[_0x5510('0x35')]['filter']){_0x493a89[_0x5510('0x40')]=_[_0x5510('0x42')](_0x493a89[_0x5510('0x40')],{'$or':_['map'](_0x493a89[_0x5510('0x38')],function(_0xdc53f1){var _0x2bc49c={};_0x2bc49c[_0xdc53f1]={'$like':'%'+_0xa791cb[_0x5510('0x35')]['filter']+'%'};return _0x2bc49c;})});}_0x493a89=_[_0x5510('0x42')]({},_0x493a89,_0xa791cb[_0x5510('0x44')]);return _0xa11e7b[_0x5510('0x85')](_0x493a89);}})['then'](function(_0x5d2206){if(_0x5d2206){_0x4664d4=_0x5d2206[_0x5510('0x3a')];if(!_0xa791cb['query']['hasOwnProperty'](_0x5510('0x3d'))){_0x493a89['limit']=qs[_0x5510('0x1f')](_0xa791cb[_0x5510('0x35')][_0x5510('0x1f')]);_0x493a89[_0x5510('0x1d')]=qs[_0x5510('0x1d')](_0xa791cb[_0x5510('0x35')][_0x5510('0x1d')]);}return _0xa11e7b['getAgents'](_0x493a89);}})[_0x5510('0x27')](function(_0x478bbb){if(_0x478bbb){return _0x478bbb?{'count':_0x4664d4,'rows':_0x478bbb}:null;}})[_0x5510('0x27')](respondWithResult(_0x4b358d,null))[_0x5510('0x49')](handleError(_0x4b358d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 90a7990..5ba2235 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 _0xa495=['setMaxListeners','save','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue'];(function(_0x42eaca,_0x1fbbbc){var _0x2832d1=function(_0xa11ed5){while(--_0xa11ed5){_0x42eaca['push'](_0x42eaca['shift']());}};_0x2832d1(++_0x1fbbbc);}(_0xa495,0x19d));var _0x5a49=function(_0x54bc96,_0x20cb68){_0x54bc96=_0x54bc96-0x0;var _0x4685b9=_0xa495[_0x54bc96];return _0x4685b9;};'use strict';var EventEmitter=require(_0x5a49('0x0'));var FaxQueue=require(_0x5a49('0x1'))['db'][_0x5a49('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5a49('0x3')](0x0);var events={'afterCreate':_0x5a49('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x543d01){return function(_0xa6c2d3,_0x35e1ea,_0x28698c){FaxQueueEvents[_0x5a49('0x5')](_0x543d01+':'+_0xa6c2d3['id'],_0xa6c2d3);FaxQueueEvents['emit'](_0x543d01,_0xa6c2d3);_0x28698c(null);};}for(var e in events){if(events[_0x5a49('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x5a49('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x6d5f=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook'];(function(_0x25c454,_0x190f0d){var _0x955617=function(_0x430210){while(--_0x430210){_0x25c454['push'](_0x25c454['shift']());}};_0x955617(++_0x190f0d);}(_0x6d5f,0x1b0));var _0xf6d5=function(_0x396701,_0x1600e2){_0x396701=_0x396701-0x0;var _0x5df190=_0x6d5f[_0x396701];return _0x5df190;};'use strict';var EventEmitter=require(_0xf6d5('0x0'));var FaxQueue=require(_0xf6d5('0x1'))['db'][_0xf6d5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf6d5('0x3')](0x0);var events={'afterCreate':_0xf6d5('0x4'),'afterUpdate':_0xf6d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x28f012){return function(_0xa2df75,_0x3be769,_0x31cc04){FaxQueueEvents[_0xf6d5('0x6')](_0x28f012+':'+_0xa2df75['id'],_0xa2df75);FaxQueueEvents[_0xf6d5('0x6')](_0x28f012,_0xa2df75);_0x31cc04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xf6d5('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 1e0f04e..bed9a26 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 _0x9487=['../../config/environment','./faxQueue.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x2c6b23,_0x36c678){var _0x2c9f7b=function(_0x19e3eb){while(--_0x19e3eb){_0x2c6b23['push'](_0x2c6b23['shift']());}};_0x2c9f7b(++_0x36c678);}(_0x9487,0x122));var _0x7948=function(_0x3d6989,_0xae1e80){_0x3d6989=_0x3d6989-0x0;var _0x55ff42=_0x9487[_0x3d6989];return _0x55ff42;};'use strict';var _=require(_0x7948('0x0'));var util=require(_0x7948('0x1'));var logger=require('../../config/logger')(_0x7948('0x2'));var moment=require(_0x7948('0x3'));var BPromise=require(_0x7948('0x4'));var rp=require(_0x7948('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7948('0x6'));var config=require(_0x7948('0x7'));var attributes=require(_0x7948('0x8'));module[_0x7948('0x9')]=function(_0x41a539,_0x1760b3){return _0x41a539[_0x7948('0xa')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdd9=['rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c20ff,_0x428706){var _0x22c041=function(_0x3f585d){while(--_0x3f585d){_0x3c20ff['push'](_0x3c20ff['shift']());}};_0x22c041(++_0x428706);}(_0xbdd9,0x157));var _0x9bdd=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0xbdd9[_0x1f8053];return _0x174fd8;};'use strict';var _=require('lodash');var util=require(_0x9bdd('0x0'));var logger=require(_0x9bdd('0x1'))(_0x9bdd('0x2'));var moment=require(_0x9bdd('0x3'));var BPromise=require(_0x9bdd('0x4'));var rp=require(_0x9bdd('0x5'));var fs=require('fs');var path=require(_0x9bdd('0x6'));var rimraf=require(_0x9bdd('0x7'));var config=require(_0x9bdd('0x8'));var attributes=require(_0x9bdd('0x9'));module[_0x9bdd('0xa')]=function(_0xf6d219,_0xf059fc){return _0xf6d219[_0x9bdd('0xb')](_0x9bdd('0xc'),attributes,{'tableName':_0x9bdd('0xd'),'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 386e46d..40ed859 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 _0xceec=['redis','defaults','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','stringify','find','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ed7af,_0x422676){var _0x29a495=function(_0x4dd4b6){while(--_0x4dd4b6){_0x5ed7af['push'](_0x5ed7af['shift']());}};_0x29a495(++_0x422676);}(_0xceec,0x1b2));var _0xccee=function(_0xa57536,_0x32f8d5){_0xa57536=_0xa57536-0x0;var _0x4ec343=_0xceec[_0xa57536];return _0x4ec343;};'use strict';var _=require(_0xccee('0x0'));var util=require(_0xccee('0x1'));var moment=require(_0xccee('0x2'));var BPromise=require('bluebird');var rs=require(_0xccee('0x3'));var fs=require('fs');var Redis=require(_0xccee('0x4'));var db=require(_0xccee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xccee('0x6'))(_0xccee('0x7'));var config=require(_0xccee('0x8'));var jayson=require(_0xccee('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xccee('0xa')]=_[_0xccee('0xb')](config[_0xccee('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xccee('0xc'))['register'](socket);function respondWithRpcPromise(_0x4f8b5f,_0x48e1e7,_0x16a10e){return new BPromise(function(_0x3b849e,_0x3363f0){return client['request'](_0x4f8b5f,_0x16a10e)[_0xccee('0xd')](function(_0x3c1562){logger['info'](_0xccee('0xe'),_0x48e1e7,_0xccee('0xf'));logger[_0xccee('0x10')](_0xccee('0x11'),_0x48e1e7,'request\x20sent',JSON['stringify'](_0x3c1562));if(_0x3c1562['error']){if(_0x3c1562['error'][_0xccee('0x12')]===0x1f4){logger[_0xccee('0x13')](_0xccee('0xe'),_0x48e1e7,_0x3c1562[_0xccee('0x13')][_0xccee('0x14')]);return _0x3363f0(_0x3c1562[_0xccee('0x13')][_0xccee('0x14')]);}logger[_0xccee('0x13')](_0xccee('0xe'),_0x48e1e7,_0x3c1562['error'][_0xccee('0x14')]);return _0x3b849e(_0x3c1562[_0xccee('0x13')][_0xccee('0x14')]);}else{logger[_0xccee('0x15')]('FaxQueue,\x20%s,\x20%s',_0x48e1e7,_0xccee('0xf'));_0x3b849e(_0x3c1562[_0xccee('0x16')][_0xccee('0x14')]);}})[_0xccee('0x17')](function(_0x71c775){logger[_0xccee('0x13')]('FaxQueue,\x20%s,\x20%s',_0x48e1e7,_0x71c775);_0x3363f0(_0x71c775);});});}exports[_0xccee('0x18')]=function(_0x30644d){var _0x49ac38=this;return new Promise(function(_0x240063,_0x437f2a){return db[_0xccee('0x19')][_0xccee('0x1a')]({'raw':_0x30644d[_0xccee('0x1b')]?_0x30644d[_0xccee('0x1b')][_0xccee('0x1c')]===undefined?!![]:![]:!![],'where':_0x30644d['options']?_0x30644d[_0xccee('0x1b')][_0xccee('0x1d')]||null:null,'attributes':_0x30644d[_0xccee('0x1b')]?_0x30644d[_0xccee('0x1b')][_0xccee('0x1e')]||null:null,'limit':_0x30644d[_0xccee('0x1b')]?_0x30644d[_0xccee('0x1b')]['limit']||null:null,'include':_0x30644d[_0xccee('0x1b')]?_0x30644d[_0xccee('0x1b')][_0xccee('0x1f')]?_[_0xccee('0x20')](_0x30644d[_0xccee('0x1b')][_0xccee('0x1f')],function(_0x47f538){return{'model':db[_0x47f538[_0xccee('0x21')]],'as':_0x47f538['as'],'attributes':_0x47f538['attributes'],'include':_0x47f538[_0xccee('0x1f')]?_['map'](_0x47f538[_0xccee('0x1f')],function(_0x54ac3a){return{'model':db[_0x54ac3a[_0xccee('0x21')]],'as':_0x54ac3a['as'],'attributes':_0x54ac3a[_0xccee('0x1e')],'include':_0x54ac3a[_0xccee('0x1f')]?_[_0xccee('0x20')](_0x54ac3a[_0xccee('0x1f')],function(_0x28c712){return{'model':db[_0x28c712['model']],'as':_0x28c712['as'],'attributes':_0x28c712[_0xccee('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xccee('0xd')](function(_0x123ae7){logger[_0xccee('0x15')]('GetFaxQueue',_0x30644d);logger['debug'](_0xccee('0x18'),_0x30644d,JSON[_0xccee('0x22')](_0x123ae7));_0x240063(_0x123ae7);})['catch'](function(_0x1f7ffa){logger['error'](_0xccee('0x18'),_0x1f7ffa[_0xccee('0x14')],_0x30644d);_0x437f2a(_0x49ac38[_0xccee('0x13')](0x1f4,_0x1f7ffa[_0xccee('0x14')]));});});};exports['ShowFaxQueue']=function(_0x57c042){var _0x290e0b=this;return new Promise(function(_0x406225,_0x780ab4){return db[_0xccee('0x19')][_0xccee('0x23')]({'raw':_0x57c042[_0xccee('0x1b')]?_0x57c042[_0xccee('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x57c042['options']?_0x57c042[_0xccee('0x1b')][_0xccee('0x1d')]||null:null,'attributes':_0x57c042['options']?_0x57c042[_0xccee('0x1b')]['attributes']||null:null,'include':_0x57c042[_0xccee('0x1b')]?_0x57c042[_0xccee('0x1b')][_0xccee('0x1f')]?_['map'](_0x57c042[_0xccee('0x1b')]['include'],function(_0x19e293){return{'model':db[_0x19e293[_0xccee('0x21')]],'as':_0x19e293['as'],'attributes':_0x19e293[_0xccee('0x1e')],'include':_0x19e293[_0xccee('0x1f')]?_[_0xccee('0x20')](_0x19e293[_0xccee('0x1f')],function(_0x4f14ae){return{'model':db[_0x4f14ae['model']],'as':_0x4f14ae['as'],'attributes':_0x4f14ae[_0xccee('0x1e')],'include':_0x4f14ae[_0xccee('0x1f')]?_[_0xccee('0x20')](_0x4f14ae[_0xccee('0x1f')],function(_0x484290){return{'model':db[_0x484290[_0xccee('0x21')]],'as':_0x484290['as'],'attributes':_0x484290['attributes']};}):[]};}):[]};}):[]:[]})[_0xccee('0xd')](function(_0x4398df){logger[_0xccee('0x15')]('ShowFaxQueue',_0x57c042);logger[_0xccee('0x10')](_0xccee('0x24'),_0x57c042,JSON[_0xccee('0x22')](_0x4398df));_0x406225(_0x4398df);})['catch'](function(_0x22b55c){logger['error'](_0xccee('0x24'),_0x22b55c[_0xccee('0x14')],_0x57c042);_0x780ab4(_0x290e0b[_0xccee('0x13')](0x1f4,_0x22b55c[_0xccee('0x14')]));});});}; \ No newline at end of file +var _0xc21d=['./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','then','ShowFaxQueue','find','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc21d,0x11c));var _0xdc21=function(_0x5959ce,_0xfaac21){_0x5959ce=_0x5959ce-0x0;var _0x250707=_0xc21d[_0x5959ce];return _0x250707;};'use strict';var _=require('lodash');var util=require(_0xdc21('0x0'));var moment=require(_0xdc21('0x1'));var BPromise=require(_0xdc21('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc21('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdc21('0x4'))(_0xdc21('0x5'));var config=require(_0xdc21('0x6'));var jayson=require(_0xdc21('0x7'));var client=jayson['client'][_0xdc21('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xdc21('0x9')],{'host':_0xdc21('0xa'),'port':0x18eb});var socket=require(_0xdc21('0xb'))(new Redis(config[_0xdc21('0x9')]));require(_0xdc21('0xc'))[_0xdc21('0xd')](socket);function respondWithRpcPromise(_0x1414bb,_0x3282ba,_0x1eeb0c){return new BPromise(function(_0x3aba94,_0xd08c5e){return client[_0xdc21('0xe')](_0x1414bb,_0x1eeb0c)['then'](function(_0x2edf3d){logger[_0xdc21('0xf')](_0xdc21('0x10'),_0x3282ba,_0xdc21('0x11'));logger[_0xdc21('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3282ba,_0xdc21('0x11'),JSON[_0xdc21('0x13')](_0x2edf3d));if(_0x2edf3d[_0xdc21('0x14')]){if(_0x2edf3d[_0xdc21('0x14')]['code']===0x1f4){logger[_0xdc21('0x14')](_0xdc21('0x10'),_0x3282ba,_0x2edf3d[_0xdc21('0x14')][_0xdc21('0x15')]);return _0xd08c5e(_0x2edf3d[_0xdc21('0x14')][_0xdc21('0x15')]);}logger[_0xdc21('0x14')](_0xdc21('0x10'),_0x3282ba,_0x2edf3d[_0xdc21('0x14')]['message']);return _0x3aba94(_0x2edf3d[_0xdc21('0x14')][_0xdc21('0x15')]);}else{logger[_0xdc21('0xf')](_0xdc21('0x10'),_0x3282ba,_0xdc21('0x11'));_0x3aba94(_0x2edf3d[_0xdc21('0x16')][_0xdc21('0x15')]);}})[_0xdc21('0x17')](function(_0x4f1033){logger[_0xdc21('0x14')](_0xdc21('0x10'),_0x3282ba,_0x4f1033);_0xd08c5e(_0x4f1033);});});}exports[_0xdc21('0x18')]=function(_0x3eca8d){var _0x57c611=this;return new Promise(function(_0x49d6b4,_0xe8de8a){return db[_0xdc21('0x19')]['findAll']({'raw':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d[_0xdc21('0x1a')][_0xdc21('0x1b')]===undefined?!![]:![]:!![],'where':_0x3eca8d['options']?_0x3eca8d['options'][_0xdc21('0x1c')]||null:null,'attributes':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d['options'][_0xdc21('0x1d')]||null:null,'limit':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d[_0xdc21('0x1a')][_0xdc21('0x1e')]||null:null,'include':_0x3eca8d[_0xdc21('0x1a')]?_0x3eca8d['options'][_0xdc21('0x1f')]?_[_0xdc21('0x20')](_0x3eca8d['options'][_0xdc21('0x1f')],function(_0x154cf9){return{'model':db[_0x154cf9[_0xdc21('0x21')]],'as':_0x154cf9['as'],'attributes':_0x154cf9[_0xdc21('0x1d')],'include':_0x154cf9['include']?_[_0xdc21('0x20')](_0x154cf9[_0xdc21('0x1f')],function(_0x339488){return{'model':db[_0x339488[_0xdc21('0x21')]],'as':_0x339488['as'],'attributes':_0x339488[_0xdc21('0x1d')],'include':_0x339488[_0xdc21('0x1f')]?_[_0xdc21('0x20')](_0x339488[_0xdc21('0x1f')],function(_0x4dbee2){return{'model':db[_0x4dbee2[_0xdc21('0x21')]],'as':_0x4dbee2['as'],'attributes':_0x4dbee2[_0xdc21('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc21('0x22')](function(_0x22f258){logger['info'](_0xdc21('0x18'),_0x3eca8d);logger['debug'](_0xdc21('0x18'),_0x3eca8d,JSON[_0xdc21('0x13')](_0x22f258));_0x49d6b4(_0x22f258);})[_0xdc21('0x17')](function(_0x1ffa21){logger[_0xdc21('0x14')](_0xdc21('0x18'),_0x1ffa21[_0xdc21('0x15')],_0x3eca8d);_0xe8de8a(_0x57c611[_0xdc21('0x14')](0x1f4,_0x1ffa21[_0xdc21('0x15')]));});});};exports[_0xdc21('0x23')]=function(_0x44ada3){var _0x5a4966=this;return new Promise(function(_0xecd078,_0x5d75f1){return db[_0xdc21('0x19')][_0xdc21('0x24')]({'raw':_0x44ada3[_0xdc21('0x1a')]?_0x44ada3[_0xdc21('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x44ada3['options']?_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1c')]||null:null,'attributes':_0x44ada3[_0xdc21('0x1a')]?_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1d')]||null:null,'include':_0x44ada3[_0xdc21('0x1a')]?_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1f')]?_[_0xdc21('0x20')](_0x44ada3[_0xdc21('0x1a')][_0xdc21('0x1f')],function(_0x613bc6){return{'model':db[_0x613bc6[_0xdc21('0x21')]],'as':_0x613bc6['as'],'attributes':_0x613bc6[_0xdc21('0x1d')],'include':_0x613bc6[_0xdc21('0x1f')]?_['map'](_0x613bc6[_0xdc21('0x1f')],function(_0xbb36ac){return{'model':db[_0xbb36ac[_0xdc21('0x21')]],'as':_0xbb36ac['as'],'attributes':_0xbb36ac[_0xdc21('0x1d')],'include':_0xbb36ac['include']?_[_0xdc21('0x20')](_0xbb36ac[_0xdc21('0x1f')],function(_0x502fdf){return{'model':db[_0x502fdf[_0xdc21('0x21')]],'as':_0x502fdf['as'],'attributes':_0x502fdf[_0xdc21('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x486168){logger[_0xdc21('0xf')]('ShowFaxQueue',_0x44ada3);logger[_0xdc21('0x12')]('ShowFaxQueue',_0x44ada3,JSON['stringify'](_0x486168));_0xecd078(_0x486168);})[_0xdc21('0x17')](function(_0x4ccf33){logger[_0xdc21('0x14')]('ShowFaxQueue',_0x4ccf33[_0xdc21('0x15')],_0x44ada3);_0x5d75f1(_0x5a4966['error'](0x1f4,_0x4ccf33[_0xdc21('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 9020a33..b90725d 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 _0x7b1f=['register','length','faxQueue:','./faxQueue.events','save','remove','update','removeListener'];(function(_0x1bf0be,_0x398a43){var _0x4c29f4=function(_0xdc4f51){while(--_0xdc4f51){_0x1bf0be['push'](_0x1bf0be['shift']());}};_0x4c29f4(++_0x398a43);}(_0x7b1f,0xab));var _0xf7b1=function(_0x3c7426,_0x53d4a6){_0x3c7426=_0x3c7426-0x0;var _0xdde032=_0x7b1f[_0x3c7426];return _0xdde032;};'use strict';var FaxQueueEvents=require(_0xf7b1('0x0'));var events=[_0xf7b1('0x1'),_0xf7b1('0x2'),_0xf7b1('0x3')];function createListener(_0x463bc9,_0x1362cc){return function(_0x21a9e8){_0x1362cc['emit'](_0x463bc9,_0x21a9e8);};}function removeListener(_0x5d3aa1,_0x54dd56){return function(){FaxQueueEvents[_0xf7b1('0x4')](_0x5d3aa1,_0x54dd56);};}exports[_0xf7b1('0x5')]=function(_0x2955b7){for(var _0x331cb9=0x0,_0xed3519=events[_0xf7b1('0x6')];_0x331cb9<_0xed3519;_0x331cb9++){var _0x1be49b=events[_0x331cb9];var _0x269e6b=createListener(_0xf7b1('0x7')+_0x1be49b,_0x2955b7);FaxQueueEvents['on'](_0x1be49b,_0x269e6b);}}; \ No newline at end of file +var _0xec30=['update','removeListener','register','length','save'];(function(_0xa9e8cd,_0x399e59){var _0x5ca5c7=function(_0x57ab7b){while(--_0x57ab7b){_0xa9e8cd['push'](_0xa9e8cd['shift']());}};_0x5ca5c7(++_0x399e59);}(_0xec30,0xf9));var _0x0ec3=function(_0x49c1b0,_0x35b033){_0x49c1b0=_0x49c1b0-0x0;var _0x5be831=_0xec30[_0x49c1b0];return _0x5be831;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x0ec3('0x0'),'remove',_0x0ec3('0x1')];function createListener(_0x496b07,_0x1d42c1){return function(_0x16dce0){_0x1d42c1['emit'](_0x496b07,_0x16dce0);};}function removeListener(_0x86436,_0x1a408d){return function(){FaxQueueEvents[_0x0ec3('0x2')](_0x86436,_0x1a408d);};}exports[_0x0ec3('0x3')]=function(_0x1214f2){for(var _0x33b4eb=0x0,_0x434677=events[_0x0ec3('0x4')];_0x33b4eb<_0x434677;_0x33b4eb++){var _0x5eda72=events[_0x33b4eb];var _0x549769=createListener('faxQueue:'+_0x5eda72,_0x1214f2);FaxQueueEvents['on'](_0x5eda72,_0x549769);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 39abc8e..b8882f3 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 _0x7a54=['./faxQueue.controller','get','index','/describe','isAuthenticated','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x16367b,_0x4888ba){_0x16367b=_0x16367b-0x0;var _0x10da01=_0x7a54[_0x16367b];return _0x10da01;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/teams',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x12')](_0x47a5('0x14'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);router[_0x47a5('0x12')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller['addAgents']);router[_0x47a5('0x16')](_0x47a5('0x17'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x18')]);router[_0x47a5('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0x1a')]);router['delete']('/:id/teams',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x19')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);module[_0x47a5('0x1d')]=router; \ No newline at end of file +var _0x4819=['describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','/describe'];(function(_0x299a19,_0xc19020){var _0x293435=function(_0x124b40){while(--_0x124b40){_0x299a19['push'](_0x299a19['shift']());}};_0x293435(++_0xc19020);}(_0x4819,0xcd));var _0x9481=function(_0x1179f3,_0x100df5){_0x1179f3=_0x1179f3-0x0;var _0x8a9a2b=_0x4819[_0x1179f3];return _0x8a9a2b;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var fs_extra=require(_0x9481('0x5'));var auth=require(_0x9481('0x6'));var interaction=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var controller=require(_0x9481('0x9'));router['get']('/',auth[_0x9481('0xa')](),controller['index']);router['get'](_0x9481('0xb'),auth[_0x9481('0xa')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')](_0x9481('0xe'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['get'](_0x9481('0x10'),auth['isAuthenticated'](),controller[_0x9481('0x11')]);router[_0x9481('0xd')](_0x9481('0x12'),auth[_0x9481('0xa')](),controller[_0x9481('0x13')]);router[_0x9481('0xd')](_0x9481('0x14'),auth[_0x9481('0xa')](),controller[_0x9481('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9481('0x16')]);router[_0x9481('0x17')](_0x9481('0x12'),auth[_0x9481('0xa')](),controller[_0x9481('0x18')]);router[_0x9481('0x17')](_0x9481('0x14'),auth['isAuthenticated'](),controller[_0x9481('0x19')]);router[_0x9481('0x1a')]('/:id',auth[_0x9481('0xa')](),controller['update']);router[_0x9481('0x1b')](_0x9481('0xe'),auth[_0x9481('0xa')](),controller[_0x9481('0x1c')]);router['delete']('/:id/teams',auth[_0x9481('0xa')](),controller['removeTeams']);router['delete'](_0x9481('0x14'),auth[_0x9481('0xa')](),controller[_0x9481('0x1d')]);module[_0x9481('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 27f5bc0..087f89c 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 _0x4579=['moment','exports','STRING','DATE'];(function(_0x49923f,_0x671404){var _0x560684=function(_0x5a152b){while(--_0x5a152b){_0x49923f['push'](_0x49923f['shift']());}};_0x560684(++_0x671404);}(_0x4579,0x164));var _0x9457=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4579[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x9457('0x0'));var Sequelize=require('sequelize');module[_0x9457('0x1')]={'uniqueid':{'type':Sequelize[_0x9457('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9457('0x2')]},'joinAt':{'type':Sequelize[_0x9457('0x3')]},'leaveAt':{'type':Sequelize[_0x9457('0x3')]},'acceptAt':{'type':Sequelize[_0x9457('0x3')]},'exitAt':{'type':Sequelize[_0x9457('0x3')]},'reason':{'type':Sequelize[_0x9457('0x2')]}}; \ No newline at end of file +var _0x4111=['moment','sequelize','exports','STRING','DATE'];(function(_0x2a7ccf,_0x6b7008){var _0x3a44b7=function(_0xc84f76){while(--_0xc84f76){_0x2a7ccf['push'](_0x2a7ccf['shift']());}};_0x3a44b7(++_0x6b7008);}(_0x4111,0x91));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x1411('0x0'));var Sequelize=require(_0x1411('0x1'));module[_0x1411('0x2')]={'uniqueid':{'type':Sequelize[_0x1411('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1411('0x4')]},'leaveAt':{'type':Sequelize[_0x1411('0x4')]},'acceptAt':{'type':Sequelize[_0x1411('0x4')]},'exitAt':{'type':Sequelize[_0x1411('0x4')]},'reason':{'type':Sequelize[_0x1411('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 176b6ef..5cef935 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 _0x12cc=['reject','save','then','destroy','status','sendStatus','stack','name','send','index','fieldName','type','key','map','query','keys','filters','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','find','create','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x218815,_0x28fb6e){var _0x52ec8e=function(_0xb2fc5f){while(--_0xb2fc5f){_0x218815['push'](_0x218815['shift']());}};_0x52ec8e(++_0x28fb6e);}(_0x12cc,0xc2));var _0xc12c=function(_0x30ede1,_0x20dbe3){_0x30ede1=_0x30ede1-0x0;var _0x5b036c=_0x12cc[_0x30ede1];return _0x5b036c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc12c('0x0'));var zipdir=require(_0xc12c('0x1'));var jsonpatch=require(_0xc12c('0x2'));var rp=require(_0xc12c('0x3'));var moment=require(_0xc12c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc12c('0x5'));var path=require(_0xc12c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc12c('0x7'));var _=require(_0xc12c('0x8'));var squel=require(_0xc12c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc12c('0xa'));var toCsv=require(_0xc12c('0xb'));var querystring=require(_0xc12c('0xc'));var Papa=require('papaparse');var Redis=require(_0xc12c('0xd'));var authService=require(_0xc12c('0xe'));var qs=require(_0xc12c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc12c('0x10'));var logger=require(_0xc12c('0x11'))(_0xc12c('0x12'));var utils=require(_0xc12c('0x13'));var config=require(_0xc12c('0x14'));var licenseUtil=require(_0xc12c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18dd8b,_0x103ea6){_0x103ea6=_0x103ea6||0xcc;return function(_0x126a25){if(_0x126a25){return _0x18dd8b['sendStatus'](_0x103ea6);}return _0x18dd8b['status'](_0x103ea6)[_0xc12c('0x16')]();};}function respondWithResult(_0x538b3d,_0x2400e7){_0x2400e7=_0x2400e7||0xc8;return function(_0x1a7627){if(_0x1a7627){return _0x538b3d['status'](_0x2400e7)[_0xc12c('0x17')](_0x1a7627);}};}function respondWithFilteredResult(_0x51175b,_0x40c7a1){return function(_0x2134b1){if(_0x2134b1){var _0x505114=typeof _0x40c7a1['offset']===_0xc12c('0x18')&&typeof _0x40c7a1[_0xc12c('0x19')]==='undefined';var _0x3f5828=_0x2134b1[_0xc12c('0x1a')];var _0x5c0c82=_0x505114?0x0:_0x40c7a1[_0xc12c('0x1b')];var _0x19a59a=_0x505114?_0x2134b1['count']:_0x40c7a1[_0xc12c('0x1b')]+_0x40c7a1[_0xc12c('0x19')];var _0x394ad2;if(_0x19a59a>=_0x3f5828){_0x19a59a=_0x3f5828;_0x394ad2=0xc8;}else{_0x394ad2=0xce;}_0x51175b['status'](_0x394ad2);return _0x51175b[_0xc12c('0x1c')](_0xc12c('0x1d'),_0x5c0c82+'-'+_0x19a59a+'/'+_0x3f5828)['json'](_0x2134b1);}return null;};}function patchUpdates(_0x493fe9){return function(_0x498f75){try{jsonpatch[_0xc12c('0x1e')](_0x498f75,_0x493fe9,!![]);}catch(_0x46751b){return BPromise[_0xc12c('0x1f')](_0x46751b);}return _0x498f75[_0xc12c('0x20')]();};}function saveUpdates(_0x222d78,_0xe56d9){return function(_0x2b13db){if(_0x2b13db){return _0x2b13db['update'](_0x222d78)[_0xc12c('0x21')](function(_0x117b9f){return _0x117b9f;});}return null;};}function removeEntity(_0x26cef4,_0x3423f4){return function(_0x41e5f7){if(_0x41e5f7){return _0x41e5f7[_0xc12c('0x22')]()[_0xc12c('0x21')](function(){_0x26cef4[_0xc12c('0x23')](0xcc)[_0xc12c('0x16')]();});}};}function handleEntityNotFound(_0x42d01c,_0x6552e7){return function(_0x8acdfc){if(!_0x8acdfc){_0x42d01c[_0xc12c('0x24')](0x194);}return _0x8acdfc;};}function handleError(_0x1531a3,_0x30bb69){_0x30bb69=_0x30bb69||0x1f4;return function(_0x4c1fc0){logger['error'](_0x4c1fc0[_0xc12c('0x25')]);if(_0x4c1fc0[_0xc12c('0x26')]){delete _0x4c1fc0['name'];}_0x1531a3[_0xc12c('0x23')](_0x30bb69)[_0xc12c('0x27')](_0x4c1fc0);};}exports[_0xc12c('0x28')]=function(_0x330bb9,_0x4e0c48){var _0x9b77d6={},_0x4df374={},_0x1ed467={'count':0x0,'rows':[]};var _0x2de75f=_['map'](db['FaxQueueReport']['rawAttributes'],function(_0x31a70e){return{'name':_0x31a70e[_0xc12c('0x29')],'type':_0x31a70e[_0xc12c('0x2a')][_0xc12c('0x2b')]};});_0x4df374['model']=_[_0xc12c('0x2c')](_0x2de75f,_0xc12c('0x26'));_0x4df374[_0xc12c('0x2d')]=_[_0xc12c('0x2e')](_0x330bb9['query']);_0x4df374[_0xc12c('0x2f')]=_['intersection'](_0x4df374[_0xc12c('0x30')],_0x4df374[_0xc12c('0x2d')]);_0x9b77d6[_0xc12c('0x31')]=_['intersection'](_0x4df374[_0xc12c('0x30')],qs[_0xc12c('0x32')](_0x330bb9[_0xc12c('0x2d')]['fields']));_0x9b77d6[_0xc12c('0x31')]=_0x9b77d6[_0xc12c('0x31')]['length']?_0x9b77d6[_0xc12c('0x31')]:_0x4df374[_0xc12c('0x30')];if(!_0x330bb9['query'][_0xc12c('0x33')]('nolimit')){_0x9b77d6['limit']=qs[_0xc12c('0x19')](_0x330bb9['query'][_0xc12c('0x19')]);_0x9b77d6['offset']=qs[_0xc12c('0x1b')](_0x330bb9[_0xc12c('0x2d')][_0xc12c('0x1b')]);}_0x9b77d6[_0xc12c('0x34')]=qs[_0xc12c('0x35')](_0x330bb9[_0xc12c('0x2d')][_0xc12c('0x35')]);_0x9b77d6[_0xc12c('0x36')]=qs['filters'](_[_0xc12c('0x37')](_0x330bb9['query'],_0x4df374[_0xc12c('0x2f')]),_0x2de75f);if(_0x330bb9['query']['filter']){_0x9b77d6[_0xc12c('0x36')]=_[_0xc12c('0x38')](_0x9b77d6[_0xc12c('0x36')],{'$or':_[_0xc12c('0x2c')](_0x2de75f,function(_0x1c2b01){if(_0x1c2b01[_0xc12c('0x2a')]!==_0xc12c('0x39')){var _0x2cedf4={};_0x2cedf4[_0x1c2b01['name']]={'$like':'%'+_0x330bb9[_0xc12c('0x2d')]['filter']+'%'};return _0x2cedf4;}})});}_0x9b77d6=_[_0xc12c('0x38')]({},_0x9b77d6,_0x330bb9[_0xc12c('0x3a')]);var _0xc15e5d={'where':_0x9b77d6[_0xc12c('0x36')]};return db[_0xc12c('0x3b')][_0xc12c('0x1a')](_0xc15e5d)[_0xc12c('0x21')](function(_0x144269){_0x1ed467['count']=_0x144269;if(_0x330bb9['query'][_0xc12c('0x3c')]){_0x9b77d6[_0xc12c('0x3d')]=[{'all':!![]}];}return db[_0xc12c('0x3b')][_0xc12c('0x3e')](_0x9b77d6);})[_0xc12c('0x21')](function(_0x5a3efb){_0x1ed467[_0xc12c('0x3f')]=_0x5a3efb;return _0x1ed467;})['then'](respondWithFilteredResult(_0x4e0c48,_0x9b77d6))[_0xc12c('0x40')](handleError(_0x4e0c48,null));};exports[_0xc12c('0x41')]=function(_0xe06d41,_0x56f7bc){var _0x431ba0={'raw':!![],'where':{'id':_0xe06d41[_0xc12c('0x42')]['id']}},_0xe2fcc4={};_0xe2fcc4['model']=_[_0xc12c('0x2e')](db[_0xc12c('0x3b')][_0xc12c('0x43')]);_0xe2fcc4[_0xc12c('0x2d')]=_['keys'](_0xe06d41[_0xc12c('0x2d')]);_0xe2fcc4[_0xc12c('0x2f')]=_[_0xc12c('0x44')](_0xe2fcc4['model'],_0xe2fcc4[_0xc12c('0x2d')]);_0x431ba0['attributes']=_[_0xc12c('0x44')](_0xe2fcc4[_0xc12c('0x30')],qs[_0xc12c('0x32')](_0xe06d41['query'][_0xc12c('0x32')]));_0x431ba0[_0xc12c('0x31')]=_0x431ba0[_0xc12c('0x31')][_0xc12c('0x45')]?_0x431ba0[_0xc12c('0x31')]:_0xe2fcc4[_0xc12c('0x30')];if(_0xe06d41['query'][_0xc12c('0x3c')]){_0x431ba0[_0xc12c('0x3d')]=[{'all':!![]}];}_0x431ba0=_[_0xc12c('0x38')]({},_0x431ba0,_0xe06d41[_0xc12c('0x3a')]);return db[_0xc12c('0x3b')][_0xc12c('0x46')](_0x431ba0)['then'](handleEntityNotFound(_0x56f7bc,null))[_0xc12c('0x21')](respondWithResult(_0x56f7bc,null))['catch'](handleError(_0x56f7bc,null));};exports[_0xc12c('0x47')]=function(_0x15bff8,_0x2ddd9f){return db[_0xc12c('0x3b')][_0xc12c('0x47')](_0x15bff8['body'],{})[_0xc12c('0x21')](respondWithResult(_0x2ddd9f,0xc9))[_0xc12c('0x40')](handleError(_0x2ddd9f,null));};exports[_0xc12c('0x48')]=function(_0x5722d1,_0x5d19dc){if(_0x5722d1[_0xc12c('0x49')]['id']){delete _0x5722d1[_0xc12c('0x49')]['id'];}return db[_0xc12c('0x3b')][_0xc12c('0x46')]({'where':{'id':_0x5722d1[_0xc12c('0x42')]['id']}})[_0xc12c('0x21')](handleEntityNotFound(_0x5d19dc,null))[_0xc12c('0x21')](saveUpdates(_0x5722d1[_0xc12c('0x49')],null))['then'](respondWithResult(_0x5d19dc,null))[_0xc12c('0x40')](handleError(_0x5d19dc,null));};exports[_0xc12c('0x22')]=function(_0x5f49ff,_0x38c283){return db[_0xc12c('0x3b')][_0xc12c('0x46')]({'where':{'id':_0x5f49ff[_0xc12c('0x42')]['id']}})[_0xc12c('0x21')](handleEntityNotFound(_0x38c283,null))[_0xc12c('0x21')](removeEntity(_0x38c283,null))[_0xc12c('0x40')](handleError(_0x38c283,null));};exports[_0xc12c('0x4a')]=function(_0x12d366,_0x583361){return db[_0xc12c('0x3b')][_0xc12c('0x4a')]()[_0xc12c('0x21')](respondWithResult(_0x583361,null))[_0xc12c('0x40')](handleError(_0x583361,null));}; \ No newline at end of file +var _0x4d46=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','FaxQueueReport','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x7b3d99,_0x52a6f1){var _0x5da75f=function(_0x154938){while(--_0x154938){_0x7b3d99['push'](_0x7b3d99['shift']());}};_0x5da75f(++_0x52a6f1);}(_0x4d46,0x197));var _0x64d4=function(_0x3ffd5d,_0x159469){_0x3ffd5d=_0x3ffd5d-0x0;var _0x246111=_0x4d46[_0x3ffd5d];return _0x246111;};'use strict';var emlformat=require(_0x64d4('0x0'));var rimraf=require(_0x64d4('0x1'));var zipdir=require(_0x64d4('0x2'));var jsonpatch=require(_0x64d4('0x3'));var rp=require(_0x64d4('0x4'));var moment=require(_0x64d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64d4('0x6'));var util=require(_0x64d4('0x7'));var path=require(_0x64d4('0x8'));var sox=require(_0x64d4('0x9'));var csv=require(_0x64d4('0xa'));var ejs=require(_0x64d4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64d4('0xc'));var squel=require(_0x64d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x64d4('0xe'));var deskjs=require(_0x64d4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64d4('0x10'));var as=require(_0x64d4('0x11'));var hardwareService=require(_0x64d4('0x12'));var logger=require(_0x64d4('0x13'))(_0x64d4('0x14'));var utils=require(_0x64d4('0x15'));var config=require(_0x64d4('0x16'));var licenseUtil=require(_0x64d4('0x17'));var db=require(_0x64d4('0x18'))['db'];function respondWithStatusCode(_0x4a4cbe,_0x3d3b97){_0x3d3b97=_0x3d3b97||0xcc;return function(_0x553f90){if(_0x553f90){return _0x4a4cbe[_0x64d4('0x19')](_0x3d3b97);}return _0x4a4cbe[_0x64d4('0x1a')](_0x3d3b97)[_0x64d4('0x1b')]();};}function respondWithResult(_0x4762a9,_0x13b111){_0x13b111=_0x13b111||0xc8;return function(_0x2b0c39){if(_0x2b0c39){return _0x4762a9['status'](_0x13b111)[_0x64d4('0x1c')](_0x2b0c39);}};}function respondWithFilteredResult(_0x433af8,_0x4574c2){return function(_0x3a25a3){if(_0x3a25a3){var _0x1b005a=typeof _0x4574c2[_0x64d4('0x1d')]===_0x64d4('0x1e')&&typeof _0x4574c2['limit']===_0x64d4('0x1e');var _0x260561=_0x3a25a3['count'];var _0x1bbaf0=_0x1b005a?0x0:_0x4574c2[_0x64d4('0x1d')];var _0x13900e=_0x1b005a?_0x3a25a3[_0x64d4('0x1f')]:_0x4574c2[_0x64d4('0x1d')]+_0x4574c2[_0x64d4('0x20')];var _0x1b2516;if(_0x13900e>=_0x260561){_0x13900e=_0x260561;_0x1b2516=0xc8;}else{_0x1b2516=0xce;}_0x433af8[_0x64d4('0x1a')](_0x1b2516);return _0x433af8['set'](_0x64d4('0x21'),_0x1bbaf0+'-'+_0x13900e+'/'+_0x260561)[_0x64d4('0x1c')](_0x3a25a3);}return null;};}function patchUpdates(_0x35ee04){return function(_0xf6e129){try{jsonpatch['apply'](_0xf6e129,_0x35ee04,!![]);}catch(_0x4d9f29){return BPromise[_0x64d4('0x22')](_0x4d9f29);}return _0xf6e129[_0x64d4('0x23')]();};}function saveUpdates(_0x374119,_0x4c0b0b){return function(_0x3c7a8c){if(_0x3c7a8c){return _0x3c7a8c[_0x64d4('0x24')](_0x374119)[_0x64d4('0x25')](function(_0x3259a0){return _0x3259a0;});}return null;};}function removeEntity(_0x157639,_0x2fec7d){return function(_0x4b8b72){if(_0x4b8b72){return _0x4b8b72[_0x64d4('0x26')]()[_0x64d4('0x25')](function(){_0x157639[_0x64d4('0x1a')](0xcc)[_0x64d4('0x1b')]();});}};}function handleEntityNotFound(_0x4ee0b9,_0x494640){return function(_0x598457){if(!_0x598457){_0x4ee0b9[_0x64d4('0x19')](0x194);}return _0x598457;};}function handleError(_0x58d1e8,_0x24c45e){_0x24c45e=_0x24c45e||0x1f4;return function(_0x512d67){logger[_0x64d4('0x27')](_0x512d67[_0x64d4('0x28')]);if(_0x512d67[_0x64d4('0x29')]){delete _0x512d67[_0x64d4('0x29')];}_0x58d1e8[_0x64d4('0x1a')](_0x24c45e)['send'](_0x512d67);};}exports['index']=function(_0x3865ef,_0x2a38b4){var _0x236691={},_0x18e1b1={},_0x77912e={'count':0x0,'rows':[]};var _0x1c3347=_[_0x64d4('0x2a')](db['FaxQueueReport']['rawAttributes'],function(_0x184813){return{'name':_0x184813[_0x64d4('0x2b')],'type':_0x184813['type'][_0x64d4('0x2c')]};});_0x18e1b1[_0x64d4('0x2d')]=_[_0x64d4('0x2a')](_0x1c3347,_0x64d4('0x29'));_0x18e1b1[_0x64d4('0x2e')]=_['keys'](_0x3865ef[_0x64d4('0x2e')]);_0x18e1b1['filters']=_['intersection'](_0x18e1b1[_0x64d4('0x2d')],_0x18e1b1[_0x64d4('0x2e')]);_0x236691['attributes']=_[_0x64d4('0x2f')](_0x18e1b1['model'],qs[_0x64d4('0x30')](_0x3865ef[_0x64d4('0x2e')]['fields']));_0x236691['attributes']=_0x236691[_0x64d4('0x31')][_0x64d4('0x32')]?_0x236691[_0x64d4('0x31')]:_0x18e1b1[_0x64d4('0x2d')];if(!_0x3865ef[_0x64d4('0x2e')]['hasOwnProperty'](_0x64d4('0x33'))){_0x236691[_0x64d4('0x20')]=qs[_0x64d4('0x20')](_0x3865ef['query']['limit']);_0x236691[_0x64d4('0x1d')]=qs[_0x64d4('0x1d')](_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x1d')]);}_0x236691[_0x64d4('0x34')]=qs[_0x64d4('0x35')](_0x3865ef['query']['sort']);_0x236691[_0x64d4('0x36')]=qs[_0x64d4('0x37')](_['pick'](_0x3865ef['query'],_0x18e1b1[_0x64d4('0x37')]),_0x1c3347);if(_0x3865ef['query']['filter']){_0x236691['where']=_['merge'](_0x236691[_0x64d4('0x36')],{'$or':_[_0x64d4('0x2a')](_0x1c3347,function(_0xa9f459){if(_0xa9f459[_0x64d4('0x38')]!==_0x64d4('0x39')){var _0x130dba={};_0x130dba[_0xa9f459['name']]={'$like':'%'+_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x3a')]+'%'};return _0x130dba;}})});}_0x236691=_[_0x64d4('0x3b')]({},_0x236691,_0x3865ef[_0x64d4('0x3c')]);var _0x2fd846={'where':_0x236691[_0x64d4('0x36')]};return db[_0x64d4('0x3d')][_0x64d4('0x1f')](_0x2fd846)['then'](function(_0x107871){_0x77912e['count']=_0x107871;if(_0x3865ef[_0x64d4('0x2e')]['includeAll']){_0x236691[_0x64d4('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x236691);})[_0x64d4('0x25')](function(_0x463bf0){_0x77912e[_0x64d4('0x3f')]=_0x463bf0;return _0x77912e;})[_0x64d4('0x25')](respondWithFilteredResult(_0x2a38b4,_0x236691))[_0x64d4('0x40')](handleError(_0x2a38b4,null));};exports[_0x64d4('0x41')]=function(_0x11577b,_0xd99afd){var _0x2ccb14={'raw':!![],'where':{'id':_0x11577b[_0x64d4('0x42')]['id']}},_0x5f0213={};_0x5f0213[_0x64d4('0x2d')]=_[_0x64d4('0x43')](db[_0x64d4('0x3d')]['rawAttributes']);_0x5f0213[_0x64d4('0x2e')]=_[_0x64d4('0x43')](_0x11577b['query']);_0x5f0213['filters']=_[_0x64d4('0x2f')](_0x5f0213['model'],_0x5f0213[_0x64d4('0x2e')]);_0x2ccb14['attributes']=_[_0x64d4('0x2f')](_0x5f0213[_0x64d4('0x2d')],qs[_0x64d4('0x30')](_0x11577b['query'][_0x64d4('0x30')]));_0x2ccb14[_0x64d4('0x31')]=_0x2ccb14[_0x64d4('0x31')][_0x64d4('0x32')]?_0x2ccb14[_0x64d4('0x31')]:_0x5f0213[_0x64d4('0x2d')];if(_0x11577b['query'][_0x64d4('0x44')]){_0x2ccb14[_0x64d4('0x3e')]=[{'all':!![]}];}_0x2ccb14=_[_0x64d4('0x3b')]({},_0x2ccb14,_0x11577b[_0x64d4('0x3c')]);return db['FaxQueueReport'][_0x64d4('0x45')](_0x2ccb14)[_0x64d4('0x25')](handleEntityNotFound(_0xd99afd,null))[_0x64d4('0x25')](respondWithResult(_0xd99afd,null))[_0x64d4('0x40')](handleError(_0xd99afd,null));};exports['create']=function(_0x49930e,_0x38d59f){return db[_0x64d4('0x3d')]['create'](_0x49930e[_0x64d4('0x46')],{})[_0x64d4('0x25')](respondWithResult(_0x38d59f,0xc9))[_0x64d4('0x40')](handleError(_0x38d59f,null));};exports[_0x64d4('0x24')]=function(_0x4b3c17,_0x46bd77){if(_0x4b3c17[_0x64d4('0x46')]['id']){delete _0x4b3c17[_0x64d4('0x46')]['id'];}return db[_0x64d4('0x3d')][_0x64d4('0x45')]({'where':{'id':_0x4b3c17['params']['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x46bd77,null))[_0x64d4('0x25')](saveUpdates(_0x4b3c17['body'],null))[_0x64d4('0x25')](respondWithResult(_0x46bd77,null))[_0x64d4('0x40')](handleError(_0x46bd77,null));};exports[_0x64d4('0x26')]=function(_0x5829e6,_0x11ed80){return db['FaxQueueReport'][_0x64d4('0x45')]({'where':{'id':_0x5829e6[_0x64d4('0x42')]['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x11ed80,null))[_0x64d4('0x25')](removeEntity(_0x11ed80,null))[_0x64d4('0x40')](handleError(_0x11ed80,null));};exports[_0x64d4('0x47')]=function(_0x3f228a,_0x5a7677){return db['FaxQueueReport']['describe']()[_0x64d4('0x25')](respondWithResult(_0x5a7677,null))[_0x64d4('0x40')](handleError(_0x5a7677,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c719af5..92483c1 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x814b,0x1a2));var _0xb814=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0x814b[_0x146be0];return _0x1bcc25;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c9152,_0x5e43ca){var _0xaa59fe=function(_0x14b4fc){while(--_0x14b4fc){_0x4c9152['push'](_0x4c9152['shift']());}};_0xaa59fe(++_0x5e43ca);}(_0x53ec,0x192));var _0xc53e=function(_0x154584,_0x421e12){_0x154584=_0x154584-0x0;var _0x969074=_0x53ec[_0x154584];return _0x969074;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 53c71ba..328e58b 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 _0x0f26=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3f30c,_0x34882d){var _0x594c10=function(_0x399ab5){while(--_0x399ab5){_0x3f30c['push'](_0x3f30c['shift']());}};_0x594c10(++_0x34882d);}(_0x0f26,0x193));var _0x60f2=function(_0x34a988,_0x59d087){_0x34a988=_0x34a988-0x0;var _0x5563da=_0x0f26[_0x34a988];return _0x5563da;};'use strict';var _=require(_0x60f2('0x0'));var util=require(_0x60f2('0x1'));var moment=require('moment');var BPromise=require(_0x60f2('0x2'));var rs=require(_0x60f2('0x3'));var fs=require('fs');var Redis=require(_0x60f2('0x4'));var db=require(_0x60f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x60f2('0x6'))(_0x60f2('0x7'));var config=require(_0x60f2('0x8'));var jayson=require(_0x60f2('0x9'));var client=jayson[_0x60f2('0xa')][_0x60f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2141ec,_0x2cc2c1,_0x2d6eb3){return new BPromise(function(_0x3016f7,_0x40a53a){return client[_0x60f2('0xc')](_0x2141ec,_0x2d6eb3)[_0x60f2('0xd')](function(_0x100d6a){logger[_0x60f2('0xe')](_0x60f2('0xf'),_0x2cc2c1,'request\x20sent');logger[_0x60f2('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2cc2c1,'request\x20sent',JSON[_0x60f2('0x11')](_0x100d6a));if(_0x100d6a[_0x60f2('0x12')]){if(_0x100d6a[_0x60f2('0x12')][_0x60f2('0x13')]===0x1f4){logger[_0x60f2('0x12')](_0x60f2('0xf'),_0x2cc2c1,_0x100d6a[_0x60f2('0x12')][_0x60f2('0x14')]);return _0x40a53a(_0x100d6a['error'][_0x60f2('0x14')]);}logger[_0x60f2('0x12')](_0x60f2('0xf'),_0x2cc2c1,_0x100d6a['error'][_0x60f2('0x14')]);return _0x3016f7(_0x100d6a[_0x60f2('0x12')][_0x60f2('0x14')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2cc2c1,_0x60f2('0x15'));_0x3016f7(_0x100d6a[_0x60f2('0x16')][_0x60f2('0x14')]);}})['catch'](function(_0x3a2906){logger[_0x60f2('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2cc2c1,_0x3a2906);_0x40a53a(_0x3a2906);});});}exports['CreateFaxQueueReport']=function(_0x5d61e0){var _0x43c45b=this;return new Promise(function(_0x28afca,_0xf6b0ba){return db[_0x60f2('0x17')][_0x60f2('0x18')](_0x5d61e0[_0x60f2('0x19')],{'raw':_0x5d61e0[_0x60f2('0x1a')]?_0x5d61e0[_0x60f2('0x1a')][_0x60f2('0x1b')]===undefined?!![]:![]:!![]})[_0x60f2('0xd')](function(_0x138ed0){logger[_0x60f2('0xe')](_0x60f2('0x1c'),_0x5d61e0);logger[_0x60f2('0x10')](_0x60f2('0x1c'),_0x5d61e0,JSON[_0x60f2('0x11')](_0x138ed0));_0x28afca(_0x138ed0);})['catch'](function(_0x8139f0){logger[_0x60f2('0x12')]('CreateFaxQueueReport',_0x8139f0[_0x60f2('0x14')],_0x5d61e0);_0xf6b0ba(_0x43c45b['error'](0x1f4,_0x8139f0['message']));});});};exports[_0x60f2('0x1d')]=function(_0x3cc9fa){var _0x3d7cee=this;return new Promise(function(_0x16f2e5,_0x1bb715){return db['FaxQueueReport'][_0x60f2('0x1e')](_0x3cc9fa[_0x60f2('0x19')],{'raw':_0x3cc9fa[_0x60f2('0x1a')]?_0x3cc9fa['options'][_0x60f2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cc9fa[_0x60f2('0x1a')]?_0x3cc9fa['options'][_0x60f2('0x1f')]||null:null,'attributes':_0x3cc9fa[_0x60f2('0x1a')]?_0x3cc9fa[_0x60f2('0x1a')][_0x60f2('0x20')]||null:null,'limit':_0x3cc9fa['options']?_0x3cc9fa[_0x60f2('0x1a')]['limit']||null:null})[_0x60f2('0xd')](function(_0x2088a3){logger[_0x60f2('0xe')]('UpdateFaxQueueReport',_0x3cc9fa);logger[_0x60f2('0x10')](_0x60f2('0x1d'),_0x3cc9fa,JSON[_0x60f2('0x11')](_0x2088a3));_0x16f2e5(_0x2088a3);})[_0x60f2('0x21')](function(_0x4579cd){logger[_0x60f2('0x12')](_0x60f2('0x1d'),_0x4579cd['message'],_0x3cc9fa);_0x1bb715(_0x3d7cee[_0x60f2('0x12')](0x1f4,_0x4579cd[_0x60f2('0x14')]));});});}; \ No newline at end of file +var _0x5f84=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','FaxQueueReport','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','limit','util','moment','bluebird'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0x5f84,0x7d));var _0x45f8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5f84[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x45f8('0x0'));var moment=require(_0x45f8('0x1'));var BPromise=require(_0x45f8('0x2'));var rs=require(_0x45f8('0x3'));var fs=require('fs');var Redis=require(_0x45f8('0x4'));var db=require(_0x45f8('0x5'))['db'];var utils=require(_0x45f8('0x6'));var logger=require(_0x45f8('0x7'))(_0x45f8('0x8'));var config=require(_0x45f8('0x9'));var jayson=require(_0x45f8('0xa'));var client=jayson[_0x45f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c8362,_0x11754f,_0x2a04f9){return new BPromise(function(_0x1e47b9,_0x955e1d){return client[_0x45f8('0xc')](_0x3c8362,_0x2a04f9)[_0x45f8('0xd')](function(_0x6de31a){logger[_0x45f8('0xe')](_0x45f8('0xf'),_0x11754f,_0x45f8('0x10'));logger[_0x45f8('0x11')](_0x45f8('0x12'),_0x11754f,'request\x20sent',JSON['stringify'](_0x6de31a));if(_0x6de31a['error']){if(_0x6de31a['error'][_0x45f8('0x13')]===0x1f4){logger['error'](_0x45f8('0xf'),_0x11754f,_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);return _0x955e1d(_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);}logger[_0x45f8('0x14')](_0x45f8('0xf'),_0x11754f,_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);return _0x1e47b9(_0x6de31a[_0x45f8('0x14')][_0x45f8('0x15')]);}else{logger[_0x45f8('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x11754f,_0x45f8('0x10'));_0x1e47b9(_0x6de31a[_0x45f8('0x16')][_0x45f8('0x15')]);}})[_0x45f8('0x17')](function(_0x2762e2){logger[_0x45f8('0x14')](_0x45f8('0xf'),_0x11754f,_0x2762e2);_0x955e1d(_0x2762e2);});});}exports['CreateFaxQueueReport']=function(_0x13433e){var _0x4c32ea=this;return new Promise(function(_0x1812ef,_0x546cc7){return db[_0x45f8('0x18')]['create'](_0x13433e['body'],{'raw':_0x13433e[_0x45f8('0x19')]?_0x13433e[_0x45f8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x45f8('0xd')](function(_0x318ae4){logger[_0x45f8('0xe')](_0x45f8('0x1a'),_0x13433e);logger[_0x45f8('0x11')](_0x45f8('0x1a'),_0x13433e,JSON['stringify'](_0x318ae4));_0x1812ef(_0x318ae4);})[_0x45f8('0x17')](function(_0x4b00ba){logger[_0x45f8('0x14')](_0x45f8('0x1a'),_0x4b00ba[_0x45f8('0x15')],_0x13433e);_0x546cc7(_0x4c32ea[_0x45f8('0x14')](0x1f4,_0x4b00ba['message']));});});};exports[_0x45f8('0x1b')]=function(_0x3665f1){var _0x2893cf=this;return new Promise(function(_0x5c47fe,_0xf9dfa6){return db[_0x45f8('0x18')][_0x45f8('0x1c')](_0x3665f1[_0x45f8('0x1d')],{'raw':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')][_0x45f8('0x1e')]||null:null,'attributes':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')]['attributes']||null:null,'limit':_0x3665f1[_0x45f8('0x19')]?_0x3665f1[_0x45f8('0x19')][_0x45f8('0x1f')]||null:null})[_0x45f8('0xd')](function(_0x3ca43b){logger[_0x45f8('0xe')]('UpdateFaxQueueReport',_0x3665f1);logger['debug'](_0x45f8('0x1b'),_0x3665f1,JSON['stringify'](_0x3ca43b));_0x5c47fe(_0x3ca43b);})[_0x45f8('0x17')](function(_0x31802a){logger['error'](_0x45f8('0x1b'),_0x31802a[_0x45f8('0x15')],_0x3665f1);_0xf9dfa6(_0x2893cf[_0x45f8('0x14')](0x1f4,_0x31802a[_0x45f8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e979f8e..ab905e9 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 _0x0c59=['create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','index','/describe','describe','get','/:id','isAuthenticated','post'];(function(_0x75802d,_0x423f25){var _0x454dec=function(_0x544faf){while(--_0x544faf){_0x75802d['push'](_0x75802d['shift']());}};_0x454dec(++_0x423f25);}(_0x0c59,0x108));var _0x90c5=function(_0x7538c5,_0xa5d8ac){_0x7538c5=_0x7538c5-0x0;var _0x8b56be=_0x0c59[_0x7538c5];return _0x8b56be;};'use strict';var multer=require(_0x90c5('0x0'));var util=require(_0x90c5('0x1'));var path=require(_0x90c5('0x2'));var timeout=require(_0x90c5('0x3'));var express=require(_0x90c5('0x4'));var router=express['Router']();var fs_extra=require(_0x90c5('0x5'));var auth=require(_0x90c5('0x6'));var interaction=require(_0x90c5('0x7'));var config=require('../../config/environment');var controller=require(_0x90c5('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x90c5('0x9')]);router['get'](_0x90c5('0xa'),auth['isAuthenticated'](),controller[_0x90c5('0xb')]);router[_0x90c5('0xc')](_0x90c5('0xd'),auth[_0x90c5('0xe')](),controller['show']);router[_0x90c5('0xf')]('/',auth['isAuthenticated'](),controller[_0x90c5('0x10')]);router['put'](_0x90c5('0xd'),auth['isAuthenticated'](),controller[_0x90c5('0x11')]);router[_0x90c5('0x12')](_0x90c5('0xd'),auth[_0x90c5('0xe')](),controller['destroy']);module[_0x90c5('0x13')]=router; \ No newline at end of file +var _0x321b=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x192370,_0x3cd5bf){var _0x219e4b=function(_0x62ec75){while(--_0x62ec75){_0x192370['push'](_0x192370['shift']());}};_0x219e4b(++_0x3cd5bf);}(_0x321b,0xb8));var _0xb321=function(_0x424b13,_0x36dd4f){_0x424b13=_0x424b13-0x0;var _0x2863b7=_0x321b[_0x424b13];return _0x2863b7;};'use strict';var multer=require(_0xb321('0x0'));var util=require(_0xb321('0x1'));var path=require(_0xb321('0x2'));var timeout=require(_0xb321('0x3'));var express=require(_0xb321('0x4'));var router=express[_0xb321('0x5')]();var fs_extra=require(_0xb321('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb321('0x7'));var config=require(_0xb321('0x8'));var controller=require('./faxQueueReport.controller');router[_0xb321('0x9')]('/',auth[_0xb321('0xa')](),controller[_0xb321('0xb')]);router[_0xb321('0x9')](_0xb321('0xc'),auth[_0xb321('0xa')](),controller[_0xb321('0xd')]);router['get']('/:id',auth[_0xb321('0xa')](),controller[_0xb321('0xe')]);router[_0xb321('0xf')]('/',auth[_0xb321('0xa')](),controller[_0xb321('0x10')]);router[_0xb321('0x11')]('/:id',auth[_0xb321('0xa')](),controller[_0xb321('0x12')]);router[_0xb321('0x13')]('/:id',auth[_0xb321('0xa')](),controller[_0xb321('0x14')]);module[_0xb321('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 553e9b8..672b085 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x565375,_0x39b86d){var _0x1191b7=function(_0x117875){while(--_0x117875){_0x565375['push'](_0x565375['shift']());}};_0x1191b7(++_0x39b86d);}(_0xe706,0xa3));var _0x6e70=function(_0xe5bf5f,_0x367f5f){_0xe5bf5f=_0xe5bf5f-0x0;var _0x374e81=_0xe706[_0xe5bf5f];return _0x374e81;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x5122b0,_0x5a5779){var _0x28f4e6=function(_0x32e146){while(--_0x32e146){_0x5122b0['push'](_0x5122b0['shift']());}};_0x28f4e6(++_0x5a5779);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x4b84[_0x3c81b5];return _0x5888c4;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 948d2f3..af27836 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 _0x633c=['mustache','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x5d9352,_0x3fa46){var _0x478178=function(_0x4ac9a6){while(--_0x4ac9a6){_0x5d9352['push'](_0x5d9352['shift']());}};_0x478178(++_0x3fa46);}(_0x633c,0x1ac));var _0xc633=function(_0x1fb0cc,_0x267d39){_0x1fb0cc=_0x1fb0cc-0x0;var _0x399373=_0x633c[_0x1fb0cc];return _0x399373;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc633('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc633('0x1'));var rp=require(_0xc633('0x2'));var moment=require('moment');var BPromise=require(_0xc633('0x3'));var Mustache=require(_0xc633('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc633('0x5'));var csv=require('to-csv');var ejs=require(_0xc633('0x6'));var fs=require('fs');var fs_extra=require(_0xc633('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc633('0x8'));var deskjs=require(_0xc633('0x9'));var toCsv=require(_0xc633('0xa'));var querystring=require(_0xc633('0xb'));var Papa=require(_0xc633('0xc'));var Redis=require(_0xc633('0xd'));var authService=require(_0xc633('0xe'));var qs=require(_0xc633('0xf'));var as=require(_0xc633('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc633('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc633('0x12'));var db=require(_0xc633('0x13'))['db'];function respondWithStatusCode(_0x24f879,_0x1e8dc9){_0x1e8dc9=_0x1e8dc9||0xcc;return function(_0xe5ea41){if(_0xe5ea41){return _0x24f879[_0xc633('0x14')](_0x1e8dc9);}return _0x24f879['status'](_0x1e8dc9)['end']();};}function respondWithResult(_0x58ae29,_0x8ab80b){_0x8ab80b=_0x8ab80b||0xc8;return function(_0x59eec5){if(_0x59eec5){return _0x58ae29[_0xc633('0x15')](_0x8ab80b)[_0xc633('0x16')](_0x59eec5);}};}function respondWithFilteredResult(_0x473b79,_0x129cf3){return function(_0x2a709c){if(_0x2a709c){var _0x38d858=typeof _0x129cf3[_0xc633('0x17')]===_0xc633('0x18')&&typeof _0x129cf3[_0xc633('0x19')]==='undefined';var _0x53018d=_0x2a709c[_0xc633('0x1a')];var _0x458f2a=_0x38d858?0x0:_0x129cf3[_0xc633('0x17')];var _0x278c03=_0x38d858?_0x2a709c[_0xc633('0x1a')]:_0x129cf3[_0xc633('0x17')]+_0x129cf3['limit'];var _0x13a572;if(_0x278c03>=_0x53018d){_0x278c03=_0x53018d;_0x13a572=0xc8;}else{_0x13a572=0xce;}_0x473b79[_0xc633('0x15')](_0x13a572);return _0x473b79['set'](_0xc633('0x1b'),_0x458f2a+'-'+_0x278c03+'/'+_0x53018d)[_0xc633('0x16')](_0x2a709c);}return null;};}function patchUpdates(_0x5b1b34){return function(_0x1af893){try{jsonpatch[_0xc633('0x1c')](_0x1af893,_0x5b1b34,!![]);}catch(_0x52adee){return BPromise[_0xc633('0x1d')](_0x52adee);}return _0x1af893[_0xc633('0x1e')]();};}function saveUpdates(_0x5cd3d0,_0x272c16){return function(_0x36fced){if(_0x36fced){return _0x36fced['update'](_0x5cd3d0)[_0xc633('0x1f')](function(_0x331546){return _0x331546;});}return null;};}function removeEntity(_0x376655,_0x78cb80){return function(_0x563a6a){if(_0x563a6a){return _0x563a6a[_0xc633('0x20')]()[_0xc633('0x1f')](function(){_0x376655[_0xc633('0x15')](0xcc)[_0xc633('0x21')]();});}};}function handleEntityNotFound(_0x5c53b8,_0xa29a2d){return function(_0x2cf169){if(!_0x2cf169){_0x5c53b8[_0xc633('0x14')](0x194);}return _0x2cf169;};}function handleError(_0x3c626e,_0x27dbd3){_0x27dbd3=_0x27dbd3||0x1f4;return function(_0x24f584){logger[_0xc633('0x22')](_0x24f584['stack']);if(_0x24f584[_0xc633('0x23')]){delete _0x24f584['name'];}_0x3c626e[_0xc633('0x15')](_0x27dbd3)[_0xc633('0x24')](_0x24f584);};}exports[_0xc633('0x25')]=function(_0x138cec,_0x3438d0){var _0xc43ccb={},_0x126da3={},_0x447189={'count':0x0,'rows':[]};var _0x2eb9e1=_[_0xc633('0x26')](db[_0xc633('0x27')]['rawAttributes'],function(_0x418e7d){return{'name':_0x418e7d[_0xc633('0x28')],'type':_0x418e7d[_0xc633('0x29')][_0xc633('0x2a')]};});_0x126da3[_0xc633('0x2b')]=_[_0xc633('0x26')](_0x2eb9e1,_0xc633('0x23'));_0x126da3[_0xc633('0x2c')]=_[_0xc633('0x2d')](_0x138cec[_0xc633('0x2c')]);_0x126da3['filters']=_[_0xc633('0x2e')](_0x126da3[_0xc633('0x2b')],_0x126da3['query']);_0xc43ccb[_0xc633('0x2f')]=_[_0xc633('0x2e')](_0x126da3[_0xc633('0x2b')],qs['fields'](_0x138cec['query'][_0xc633('0x30')]));_0xc43ccb[_0xc633('0x2f')]=_0xc43ccb[_0xc633('0x2f')][_0xc633('0x31')]?_0xc43ccb[_0xc633('0x2f')]:_0x126da3[_0xc633('0x2b')];if(!_0x138cec[_0xc633('0x2c')][_0xc633('0x32')](_0xc633('0x33'))){_0xc43ccb[_0xc633('0x19')]=qs[_0xc633('0x19')](_0x138cec[_0xc633('0x2c')][_0xc633('0x19')]);_0xc43ccb[_0xc633('0x17')]=qs[_0xc633('0x17')](_0x138cec[_0xc633('0x2c')][_0xc633('0x17')]);}_0xc43ccb[_0xc633('0x34')]=qs[_0xc633('0x35')](_0x138cec['query'][_0xc633('0x35')]);_0xc43ccb[_0xc633('0x36')]=qs[_0xc633('0x37')](_[_0xc633('0x38')](_0x138cec[_0xc633('0x2c')],_0x126da3[_0xc633('0x37')]),_0x2eb9e1);if(_0x138cec[_0xc633('0x2c')][_0xc633('0x39')]){_0xc43ccb[_0xc633('0x36')]=_[_0xc633('0x3a')](_0xc43ccb[_0xc633('0x36')],{'$or':_[_0xc633('0x26')](_0x2eb9e1,function(_0x583948){if(_0x583948[_0xc633('0x29')]!==_0xc633('0x3b')){var _0x528f79={};_0x528f79[_0x583948[_0xc633('0x23')]]={'$like':'%'+_0x138cec[_0xc633('0x2c')][_0xc633('0x39')]+'%'};return _0x528f79;}})});}_0xc43ccb=_[_0xc633('0x3a')]({},_0xc43ccb,_0x138cec[_0xc633('0x3c')]);var _0x496ecd={'where':_0xc43ccb[_0xc633('0x36')]};return db['FaxTransferReport'][_0xc633('0x1a')](_0x496ecd)[_0xc633('0x1f')](function(_0x22edcd){_0x447189[_0xc633('0x1a')]=_0x22edcd;if(_0x138cec[_0xc633('0x2c')][_0xc633('0x3d')]){_0xc43ccb['include']=[{'all':!![]}];}return db[_0xc633('0x27')]['findAll'](_0xc43ccb);})['then'](function(_0xf72b65){_0x447189[_0xc633('0x3e')]=_0xf72b65;return _0x447189;})['then'](respondWithFilteredResult(_0x3438d0,_0xc43ccb))[_0xc633('0x3f')](handleError(_0x3438d0,null));};exports[_0xc633('0x40')]=function(_0x57ec25,_0x4bc552){var _0x2f2c51={'raw':!![],'where':{'id':_0x57ec25[_0xc633('0x41')]['id']}},_0xde633f={};_0xde633f[_0xc633('0x2b')]=_[_0xc633('0x2d')](db[_0xc633('0x27')][_0xc633('0x42')]);_0xde633f[_0xc633('0x2c')]=_['keys'](_0x57ec25['query']);_0xde633f['filters']=_['intersection'](_0xde633f[_0xc633('0x2b')],_0xde633f[_0xc633('0x2c')]);_0x2f2c51[_0xc633('0x2f')]=_[_0xc633('0x2e')](_0xde633f[_0xc633('0x2b')],qs[_0xc633('0x30')](_0x57ec25[_0xc633('0x2c')][_0xc633('0x30')]));_0x2f2c51[_0xc633('0x2f')]=_0x2f2c51[_0xc633('0x2f')][_0xc633('0x31')]?_0x2f2c51[_0xc633('0x2f')]:_0xde633f[_0xc633('0x2b')];if(_0x57ec25[_0xc633('0x2c')][_0xc633('0x3d')]){_0x2f2c51[_0xc633('0x43')]=[{'all':!![]}];}_0x2f2c51=_[_0xc633('0x3a')]({},_0x2f2c51,_0x57ec25[_0xc633('0x3c')]);return db['FaxTransferReport']['find'](_0x2f2c51)[_0xc633('0x1f')](handleEntityNotFound(_0x4bc552,null))['then'](respondWithResult(_0x4bc552,null))[_0xc633('0x3f')](handleError(_0x4bc552,null));};exports[_0xc633('0x44')]=function(_0x138547,_0x9eb0ec){return db[_0xc633('0x27')][_0xc633('0x44')](_0x138547[_0xc633('0x45')],{})['then'](respondWithResult(_0x9eb0ec,0xc9))['catch'](handleError(_0x9eb0ec,null));};exports['update']=function(_0x3095bd,_0x44e232){if(_0x3095bd[_0xc633('0x45')]['id']){delete _0x3095bd[_0xc633('0x45')]['id'];}return db[_0xc633('0x27')][_0xc633('0x46')]({'where':{'id':_0x3095bd[_0xc633('0x41')]['id']}})[_0xc633('0x1f')](handleEntityNotFound(_0x44e232,null))[_0xc633('0x1f')](saveUpdates(_0x3095bd[_0xc633('0x45')],null))[_0xc633('0x1f')](respondWithResult(_0x44e232,null))[_0xc633('0x3f')](handleError(_0x44e232,null));};exports[_0xc633('0x20')]=function(_0x42b5e9,_0x2ee193){return db[_0xc633('0x27')][_0xc633('0x46')]({'where':{'id':_0x42b5e9[_0xc633('0x41')]['id']}})[_0xc633('0x1f')](handleEntityNotFound(_0x2ee193,null))['then'](removeEntity(_0x2ee193,null))[_0xc633('0x3f')](handleError(_0x2ee193,null));};exports[_0xc633('0x47')]=function(_0xf63db1,_0x5970fa){return db['FaxTransferReport'][_0xc633('0x47')]()[_0xc633('0x1f')](respondWithResult(_0x5970fa,null))[_0xc633('0x3f')](handleError(_0x5970fa,null));}; \ No newline at end of file +var _0x8f23=['filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','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','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick'];(function(_0x431cdc,_0x2d55bf){var _0x1dddc9=function(_0x270eaa){while(--_0x270eaa){_0x431cdc['push'](_0x431cdc['shift']());}};_0x1dddc9(++_0x2d55bf);}(_0x8f23,0x1df));var _0x38f2=function(_0x1e5488,_0x1fc2f8){_0x1e5488=_0x1e5488-0x0;var _0x2fd247=_0x8f23[_0x1e5488];return _0x2fd247;};'use strict';var emlformat=require(_0x38f2('0x0'));var rimraf=require(_0x38f2('0x1'));var zipdir=require(_0x38f2('0x2'));var jsonpatch=require(_0x38f2('0x3'));var rp=require('request-promise');var moment=require(_0x38f2('0x4'));var BPromise=require(_0x38f2('0x5'));var Mustache=require(_0x38f2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x38f2('0x7'));var csv=require('to-csv');var ejs=require(_0x38f2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38f2('0x9'));var squel=require(_0x38f2('0xa'));var crypto=require(_0x38f2('0xb'));var jsforce=require(_0x38f2('0xc'));var deskjs=require(_0x38f2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x38f2('0xe'));var Redis=require(_0x38f2('0xf'));var authService=require(_0x38f2('0x10'));var qs=require(_0x38f2('0x11'));var as=require(_0x38f2('0x12'));var hardwareService=require(_0x38f2('0x13'));var logger=require(_0x38f2('0x14'))(_0x38f2('0x15'));var utils=require('../../config/utils');var config=require(_0x38f2('0x16'));var licenseUtil=require(_0x38f2('0x17'));var db=require(_0x38f2('0x18'))['db'];function respondWithStatusCode(_0x54f882,_0x4e7d9f){_0x4e7d9f=_0x4e7d9f||0xcc;return function(_0x487782){if(_0x487782){return _0x54f882[_0x38f2('0x19')](_0x4e7d9f);}return _0x54f882[_0x38f2('0x1a')](_0x4e7d9f)[_0x38f2('0x1b')]();};}function respondWithResult(_0x589cd3,_0xb21d63){_0xb21d63=_0xb21d63||0xc8;return function(_0x2105c4){if(_0x2105c4){return _0x589cd3['status'](_0xb21d63)[_0x38f2('0x1c')](_0x2105c4);}};}function respondWithFilteredResult(_0x50f9bc,_0x577581){return function(_0x26f9fd){if(_0x26f9fd){var _0x28429c=typeof _0x577581[_0x38f2('0x1d')]===_0x38f2('0x1e')&&typeof _0x577581['limit']===_0x38f2('0x1e');var _0x2b66d3=_0x26f9fd[_0x38f2('0x1f')];var _0x393dc7=_0x28429c?0x0:_0x577581[_0x38f2('0x1d')];var _0x22a9d9=_0x28429c?_0x26f9fd['count']:_0x577581[_0x38f2('0x1d')]+_0x577581[_0x38f2('0x20')];var _0xdb16cb;if(_0x22a9d9>=_0x2b66d3){_0x22a9d9=_0x2b66d3;_0xdb16cb=0xc8;}else{_0xdb16cb=0xce;}_0x50f9bc[_0x38f2('0x1a')](_0xdb16cb);return _0x50f9bc[_0x38f2('0x21')]('Content-Range',_0x393dc7+'-'+_0x22a9d9+'/'+_0x2b66d3)[_0x38f2('0x1c')](_0x26f9fd);}return null;};}function patchUpdates(_0x64d988){return function(_0x53f5b9){try{jsonpatch[_0x38f2('0x22')](_0x53f5b9,_0x64d988,!![]);}catch(_0x41e633){return BPromise['reject'](_0x41e633);}return _0x53f5b9[_0x38f2('0x23')]();};}function saveUpdates(_0x320f60,_0xaa4125){return function(_0x295598){if(_0x295598){return _0x295598[_0x38f2('0x24')](_0x320f60)[_0x38f2('0x25')](function(_0x4cc8d0){return _0x4cc8d0;});}return null;};}function removeEntity(_0x16bec8,_0x2ce1af){return function(_0xc80845){if(_0xc80845){return _0xc80845[_0x38f2('0x26')]()[_0x38f2('0x25')](function(){_0x16bec8[_0x38f2('0x1a')](0xcc)[_0x38f2('0x1b')]();});}};}function handleEntityNotFound(_0x5603c5,_0x1eafcc){return function(_0x3c5e96){if(!_0x3c5e96){_0x5603c5[_0x38f2('0x19')](0x194);}return _0x3c5e96;};}function handleError(_0x29ba26,_0x345d1d){_0x345d1d=_0x345d1d||0x1f4;return function(_0x22b548){logger[_0x38f2('0x27')](_0x22b548[_0x38f2('0x28')]);if(_0x22b548[_0x38f2('0x29')]){delete _0x22b548[_0x38f2('0x29')];}_0x29ba26[_0x38f2('0x1a')](_0x345d1d)[_0x38f2('0x2a')](_0x22b548);};}exports[_0x38f2('0x2b')]=function(_0xe5b8d9,_0x5ed4a2){var _0x25d53e={},_0x1d49a3={},_0x48cfbc={'count':0x0,'rows':[]};var _0x5b9dba=_[_0x38f2('0x2c')](db[_0x38f2('0x2d')]['rawAttributes'],function(_0x528c0d){return{'name':_0x528c0d[_0x38f2('0x2e')],'type':_0x528c0d['type'][_0x38f2('0x2f')]};});_0x1d49a3[_0x38f2('0x30')]=_['map'](_0x5b9dba,'name');_0x1d49a3[_0x38f2('0x31')]=_[_0x38f2('0x32')](_0xe5b8d9[_0x38f2('0x31')]);_0x1d49a3[_0x38f2('0x33')]=_[_0x38f2('0x34')](_0x1d49a3[_0x38f2('0x30')],_0x1d49a3[_0x38f2('0x31')]);_0x25d53e[_0x38f2('0x35')]=_['intersection'](_0x1d49a3[_0x38f2('0x30')],qs['fields'](_0xe5b8d9[_0x38f2('0x31')]['fields']));_0x25d53e[_0x38f2('0x35')]=_0x25d53e['attributes'][_0x38f2('0x36')]?_0x25d53e[_0x38f2('0x35')]:_0x1d49a3[_0x38f2('0x30')];if(!_0xe5b8d9['query']['hasOwnProperty'](_0x38f2('0x37'))){_0x25d53e[_0x38f2('0x20')]=qs[_0x38f2('0x20')](_0xe5b8d9['query'][_0x38f2('0x20')]);_0x25d53e['offset']=qs[_0x38f2('0x1d')](_0xe5b8d9[_0x38f2('0x31')]['offset']);}_0x25d53e[_0x38f2('0x38')]=qs[_0x38f2('0x39')](_0xe5b8d9[_0x38f2('0x31')][_0x38f2('0x39')]);_0x25d53e[_0x38f2('0x3a')]=qs[_0x38f2('0x33')](_[_0x38f2('0x3b')](_0xe5b8d9['query'],_0x1d49a3[_0x38f2('0x33')]),_0x5b9dba);if(_0xe5b8d9[_0x38f2('0x31')][_0x38f2('0x3c')]){_0x25d53e['where']=_['merge'](_0x25d53e['where'],{'$or':_[_0x38f2('0x2c')](_0x5b9dba,function(_0x42d6fc){if(_0x42d6fc['type']!==_0x38f2('0x3d')){var _0xbadf3d={};_0xbadf3d[_0x42d6fc['name']]={'$like':'%'+_0xe5b8d9['query'][_0x38f2('0x3c')]+'%'};return _0xbadf3d;}})});}_0x25d53e=_[_0x38f2('0x3e')]({},_0x25d53e,_0xe5b8d9[_0x38f2('0x3f')]);var _0x223141={'where':_0x25d53e[_0x38f2('0x3a')]};return db[_0x38f2('0x2d')][_0x38f2('0x1f')](_0x223141)['then'](function(_0x59542e){_0x48cfbc['count']=_0x59542e;if(_0xe5b8d9[_0x38f2('0x31')][_0x38f2('0x40')]){_0x25d53e['include']=[{'all':!![]}];}return db[_0x38f2('0x2d')][_0x38f2('0x41')](_0x25d53e);})[_0x38f2('0x25')](function(_0x48afe7){_0x48cfbc[_0x38f2('0x42')]=_0x48afe7;return _0x48cfbc;})[_0x38f2('0x25')](respondWithFilteredResult(_0x5ed4a2,_0x25d53e))[_0x38f2('0x43')](handleError(_0x5ed4a2,null));};exports[_0x38f2('0x44')]=function(_0x3d411d,_0x50c5e3){var _0xf52e={'raw':!![],'where':{'id':_0x3d411d[_0x38f2('0x45')]['id']}},_0x44efd1={};_0x44efd1[_0x38f2('0x30')]=_[_0x38f2('0x32')](db[_0x38f2('0x2d')][_0x38f2('0x46')]);_0x44efd1[_0x38f2('0x31')]=_[_0x38f2('0x32')](_0x3d411d[_0x38f2('0x31')]);_0x44efd1[_0x38f2('0x33')]=_[_0x38f2('0x34')](_0x44efd1[_0x38f2('0x30')],_0x44efd1[_0x38f2('0x31')]);_0xf52e[_0x38f2('0x35')]=_[_0x38f2('0x34')](_0x44efd1[_0x38f2('0x30')],qs[_0x38f2('0x47')](_0x3d411d[_0x38f2('0x31')][_0x38f2('0x47')]));_0xf52e[_0x38f2('0x35')]=_0xf52e[_0x38f2('0x35')]['length']?_0xf52e[_0x38f2('0x35')]:_0x44efd1[_0x38f2('0x30')];if(_0x3d411d[_0x38f2('0x31')]['includeAll']){_0xf52e[_0x38f2('0x48')]=[{'all':!![]}];}_0xf52e=_[_0x38f2('0x3e')]({},_0xf52e,_0x3d411d[_0x38f2('0x3f')]);return db['FaxTransferReport']['find'](_0xf52e)['then'](handleEntityNotFound(_0x50c5e3,null))[_0x38f2('0x25')](respondWithResult(_0x50c5e3,null))[_0x38f2('0x43')](handleError(_0x50c5e3,null));};exports['create']=function(_0x114909,_0x2f92e4){return db[_0x38f2('0x2d')][_0x38f2('0x49')](_0x114909['body'],{})['then'](respondWithResult(_0x2f92e4,0xc9))[_0x38f2('0x43')](handleError(_0x2f92e4,null));};exports['update']=function(_0x49e376,_0x2d7e2c){if(_0x49e376[_0x38f2('0x4a')]['id']){delete _0x49e376[_0x38f2('0x4a')]['id'];}return db[_0x38f2('0x2d')][_0x38f2('0x4b')]({'where':{'id':_0x49e376[_0x38f2('0x45')]['id']}})[_0x38f2('0x25')](handleEntityNotFound(_0x2d7e2c,null))['then'](saveUpdates(_0x49e376[_0x38f2('0x4a')],null))[_0x38f2('0x25')](respondWithResult(_0x2d7e2c,null))['catch'](handleError(_0x2d7e2c,null));};exports[_0x38f2('0x26')]=function(_0x404842,_0x4c6169){return db[_0x38f2('0x2d')][_0x38f2('0x4b')]({'where':{'id':_0x404842[_0x38f2('0x45')]['id']}})[_0x38f2('0x25')](handleEntityNotFound(_0x4c6169,null))['then'](removeEntity(_0x4c6169,null))[_0x38f2('0x43')](handleError(_0x4c6169,null));};exports[_0x38f2('0x4c')]=function(_0x58f617,_0x26cb43){return db[_0x38f2('0x2d')][_0x38f2('0x4c')]()[_0x38f2('0x25')](respondWithResult(_0x26cb43,null))[_0x38f2('0x43')](handleError(_0x26cb43,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c4f7089..6ae5902 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 _0xbacd=['moment','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3c29dc,_0x59a7fb){var _0x23d790=function(_0x43b001){while(--_0x43b001){_0x3c29dc['push'](_0x3c29dc['shift']());}};_0x23d790(++_0x59a7fb);}(_0xbacd,0x194));var _0xdbac=function(_0x1854bd,_0x2af947){_0x1854bd=_0x1854bd-0x0;var _0x2e684d=_0xbacd[_0x1854bd];return _0x2e684d;};'use strict';var _=require(_0xdbac('0x0'));var util=require(_0xdbac('0x1'));var logger=require(_0xdbac('0x2'))('api');var moment=require(_0xdbac('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbac('0x4'));var config=require(_0xdbac('0x5'));var attributes=require(_0xdbac('0x6'));module[_0xdbac('0x7')]=function(_0xfa436f,_0x1c0562){return _0xfa436f[_0xdbac('0x8')]('FaxTransferReport',attributes,{'tableName':_0xdbac('0x9'),'paranoid':![],'indexes':[{'name':_0xdbac('0xa'),'fields':[_0xdbac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4786=['request-promise','rimraf','../../config/environment','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x4786,0xa6));var _0x6478=function(_0x3d7007,_0x2a268e){_0x3d7007=_0x3d7007-0x0;var _0x342a83=_0x4786[_0x3d7007];return _0x342a83;};'use strict';var _=require('lodash');var util=require(_0x6478('0x0'));var logger=require(_0x6478('0x1'))('api');var moment=require(_0x6478('0x2'));var BPromise=require(_0x6478('0x3'));var rp=require(_0x6478('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6478('0x5'));var config=require(_0x6478('0x6'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0xec4526,_0x5f02b2){return _0xec4526['define'](_0x6478('0x7'),attributes,{'tableName':_0x6478('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6478('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 557909d..e52f82d 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 _0xec30=['client','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x5d4196,_0x23d61b){var _0x42f880=function(_0x3a8a2c){while(--_0x3a8a2c){_0x5d4196['push'](_0x5d4196['shift']());}};_0x42f880(++_0x23d61b);}(_0xec30,0xfd));var _0x0ec3=function(_0x4b8609,_0x45bfdc){_0x4b8609=_0x4b8609-0x0;var _0x1f2269=_0xec30[_0x4b8609];return _0x1f2269;};'use strict';var _=require('lodash');var util=require(_0x0ec3('0x0'));var moment=require(_0x0ec3('0x1'));var BPromise=require(_0x0ec3('0x2'));var rs=require(_0x0ec3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ec3('0x4'))['db'];var utils=require(_0x0ec3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ec3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0ec3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38bc64,_0x5d7086,_0x39e6be){return new BPromise(function(_0x53b9b0,_0x2c3fc8){return client['request'](_0x38bc64,_0x39e6be)[_0x0ec3('0x8')](function(_0x4f1ca7){logger[_0x0ec3('0x9')](_0x0ec3('0xa'),_0x5d7086,'request\x20sent');logger[_0x0ec3('0xb')](_0x0ec3('0xc'),_0x5d7086,'request\x20sent',JSON[_0x0ec3('0xd')](_0x4f1ca7));if(_0x4f1ca7['error']){if(_0x4f1ca7[_0x0ec3('0xe')][_0x0ec3('0xf')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5d7086,_0x4f1ca7[_0x0ec3('0xe')]['message']);return _0x2c3fc8(_0x4f1ca7['error'][_0x0ec3('0x10')]);}logger[_0x0ec3('0xe')](_0x0ec3('0xa'),_0x5d7086,_0x4f1ca7[_0x0ec3('0xe')][_0x0ec3('0x10')]);return _0x53b9b0(_0x4f1ca7[_0x0ec3('0xe')][_0x0ec3('0x10')]);}else{logger[_0x0ec3('0x9')](_0x0ec3('0xa'),_0x5d7086,_0x0ec3('0x11'));_0x53b9b0(_0x4f1ca7[_0x0ec3('0x12')][_0x0ec3('0x10')]);}})[_0x0ec3('0x13')](function(_0x26b2cc){logger[_0x0ec3('0xe')](_0x0ec3('0xa'),_0x5d7086,_0x26b2cc);_0x2c3fc8(_0x26b2cc);});});} \ No newline at end of file +var _0x32b2=['request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3afd8b,_0x3e8fe1){var _0x461a52=function(_0x54b3d4){while(--_0x54b3d4){_0x3afd8b['push'](_0x3afd8b['shift']());}};_0x461a52(++_0x3e8fe1);}(_0x32b2,0x193));var _0x232b=function(_0x55e724,_0x8f22f1){_0x55e724=_0x55e724-0x0;var _0x1b317c=_0x32b2[_0x55e724];return _0x1b317c;};'use strict';var _=require(_0x232b('0x0'));var util=require(_0x232b('0x1'));var moment=require(_0x232b('0x2'));var BPromise=require('bluebird');var rs=require(_0x232b('0x3'));var fs=require('fs');var Redis=require(_0x232b('0x4'));var db=require(_0x232b('0x5'))['db'];var utils=require(_0x232b('0x6'));var logger=require(_0x232b('0x7'))(_0x232b('0x8'));var config=require(_0x232b('0x9'));var jayson=require(_0x232b('0xa'));var client=jayson[_0x232b('0xb')][_0x232b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c9007,_0x15c9e6,_0x37cb47){return new BPromise(function(_0x52d9e1,_0x3de05e){return client[_0x232b('0xd')](_0x4c9007,_0x37cb47)[_0x232b('0xe')](function(_0x55334a){logger['info'](_0x232b('0xf'),_0x15c9e6,_0x232b('0x10'));logger[_0x232b('0x11')](_0x232b('0x12'),_0x15c9e6,_0x232b('0x10'),JSON[_0x232b('0x13')](_0x55334a));if(_0x55334a[_0x232b('0x14')]){if(_0x55334a[_0x232b('0x14')][_0x232b('0x15')]===0x1f4){logger[_0x232b('0x14')](_0x232b('0xf'),_0x15c9e6,_0x55334a['error'][_0x232b('0x16')]);return _0x3de05e(_0x55334a[_0x232b('0x14')][_0x232b('0x16')]);}logger[_0x232b('0x14')](_0x232b('0xf'),_0x15c9e6,_0x55334a[_0x232b('0x14')][_0x232b('0x16')]);return _0x52d9e1(_0x55334a[_0x232b('0x14')][_0x232b('0x16')]);}else{logger[_0x232b('0x17')]('FaxTransferReport,\x20%s,\x20%s',_0x15c9e6,_0x232b('0x10'));_0x52d9e1(_0x55334a[_0x232b('0x18')][_0x232b('0x16')]);}})[_0x232b('0x19')](function(_0xa62e0c){logger[_0x232b('0x14')](_0x232b('0xf'),_0x15c9e6,_0xa62e0c);_0x3de05e(_0xa62e0c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b0f91ef..c8f5949 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 _0x724d=['index','/describe','describe','/:id','isAuthenticated','post','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x724d,0xac));var _0xd724=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x724d[_0x4629ee];return _0x47fb5b;};'use strict';var multer=require('multer');var util=require(_0xd724('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd724('0x1')]();var fs_extra=require(_0xd724('0x2'));var auth=require(_0xd724('0x3'));var interaction=require(_0xd724('0x4'));var config=require(_0xd724('0x5'));var controller=require(_0xd724('0x6'));router[_0xd724('0x7')]('/',auth['isAuthenticated'](),controller[_0xd724('0x8')]);router['get'](_0xd724('0x9'),auth['isAuthenticated'](),controller[_0xd724('0xa')]);router[_0xd724('0x7')](_0xd724('0xb'),auth[_0xd724('0xc')](),controller['show']);router[_0xd724('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd724('0xb'),auth[_0xd724('0xc')](),controller['update']);router['delete'](_0xd724('0xb'),auth[_0xd724('0xc')](),controller[_0xd724('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0aa6=['../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','exports','multer','util','express','../../components/auth/service'];(function(_0x14d382,_0x54b6bd){var _0x31c6a7=function(_0xc9bb74){while(--_0xc9bb74){_0x14d382['push'](_0x14d382['shift']());}};_0x31c6a7(++_0x54b6bd);}(_0x0aa6,0x1d8));var _0x60aa=function(_0x5ef1f7,_0x1b3ec5){_0x5ef1f7=_0x5ef1f7-0x0;var _0x3d2ffa=_0x0aa6[_0x5ef1f7];return _0x3d2ffa;};'use strict';var multer=require(_0x60aa('0x0'));var util=require(_0x60aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60aa('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x60aa('0x3'));var interaction=require(_0x60aa('0x4'));var config=require('../../config/environment');var controller=require(_0x60aa('0x5'));router[_0x60aa('0x6')]('/',auth[_0x60aa('0x7')](),controller[_0x60aa('0x8')]);router['get']('/describe',auth[_0x60aa('0x7')](),controller[_0x60aa('0x9')]);router['get'](_0x60aa('0xa'),auth[_0x60aa('0x7')](),controller['show']);router[_0x60aa('0xb')]('/',auth[_0x60aa('0x7')](),controller[_0x60aa('0xc')]);router[_0x60aa('0xd')](_0x60aa('0xa'),auth[_0x60aa('0x7')](),controller[_0x60aa('0xe')]);router[_0x60aa('0xf')](_0x60aa('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x60aa('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a7a755f..591505a 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 _0x1313=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x254ae5,_0x44a3de){var _0x217d25=function(_0x3d570d){while(--_0x3d570d){_0x254ae5['push'](_0x254ae5['shift']());}};_0x217d25(++_0x44a3de);}(_0x1313,0xd2));var _0x3131=function(_0x25937b,_0x298d95){_0x25937b=_0x25937b-0x0;var _0x473b69=_0x1313[_0x25937b];return _0x473b69;};'use strict';var multer=require(_0x3131('0x0'));var util=require(_0x3131('0x1'));var path=require('path');var timeout=require(_0x3131('0x2'));var express=require(_0x3131('0x3'));var router=express['Router']();var fs_extra=require(_0x3131('0x4'));var auth=require(_0x3131('0x5'));var interaction=require(_0x3131('0x6'));var config=require(_0x3131('0x7'));var controller=require(_0x3131('0x8'));router[_0x3131('0x9')]('/',auth[_0x3131('0xa')](),controller[_0x3131('0xb')]);router['get'](_0x3131('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3131('0x9')](_0x3131('0xd'),auth[_0x3131('0xa')](),controller[_0x3131('0xe')]);router[_0x3131('0x9')](_0x3131('0xf'),auth[_0x3131('0xa')](),controller[_0x3131('0x10')]);router['post']('/',auth[_0x3131('0xa')](),controller[_0x3131('0x11')]);router['post']('/:id/configurations',auth[_0x3131('0xa')](),controller[_0x3131('0x12')]);router[_0x3131('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3131('0x14')]);router[_0x3131('0x15')](_0x3131('0xc'),auth['isAuthenticated'](),controller[_0x3131('0x16')]);module[_0x3131('0x17')]=router; \ No newline at end of file +var _0x884b=['create','/:id/configurations','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post'];(function(_0x1d2f15,_0x1107c6){var _0x19efd2=function(_0x5e7bf7){while(--_0x5e7bf7){_0x1d2f15['push'](_0x1d2f15['shift']());}};_0x19efd2(++_0x1107c6);}(_0x884b,0x1d3));var _0xb884=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x884b[_0x9307ea];return _0x295554;};'use strict';var multer=require(_0xb884('0x0'));var util=require('util');var path=require(_0xb884('0x1'));var timeout=require('connect-timeout');var express=require(_0xb884('0x2'));var router=express[_0xb884('0x3')]();var fs_extra=require(_0xb884('0x4'));var auth=require(_0xb884('0x5'));var interaction=require(_0xb884('0x6'));var config=require(_0xb884('0x7'));var controller=require(_0xb884('0x8'));router[_0xb884('0x9')]('/',auth[_0xb884('0xa')](),controller[_0xb884('0xb')]);router[_0xb884('0x9')](_0xb884('0xc'),auth['isAuthenticated'](),controller[_0xb884('0xd')]);router[_0xb884('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb884('0x9')](_0xb884('0xe'),auth[_0xb884('0xa')](),controller[_0xb884('0xf')]);router[_0xb884('0x10')]('/',auth[_0xb884('0xa')](),controller[_0xb884('0x11')]);router[_0xb884('0x10')](_0xb884('0x12'),auth[_0xb884('0xa')](),controller['addConfiguration']);router[_0xb884('0x13')](_0xb884('0xc'),auth[_0xb884('0xa')](),controller[_0xb884('0x14')]);router['delete'](_0xb884('0xc'),auth['isAuthenticated'](),controller[_0xb884('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index eb857bf..a16e49b 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 _0x6b8d=['newTab','integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x32a8a8,_0x340cd5){var _0x25837c=function(_0x4c81ec){while(--_0x4c81ec){_0x32a8a8['push'](_0x32a8a8['shift']());}};_0x25837c(++_0x340cd5);}(_0x6b8d,0xdb));var _0xd6b8=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0x6b8d[_0x2c7377];return _0x35e181;};'use strict';var Sequelize=require(_0xd6b8('0x0'));module[_0xd6b8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd6b8('0x2')]},'remoteUri':{'type':Sequelize[_0xd6b8('0x2')]},'authType':{'type':Sequelize[_0xd6b8('0x3')](_0xd6b8('0x4')),'defaultValue':_0xd6b8('0x4')},'password':{'type':Sequelize[_0xd6b8('0x2')]},'consumerKey':{'type':Sequelize[_0xd6b8('0x2')]},'consumerSecret':{'type':Sequelize[_0xd6b8('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xd6b8('0x2')]},'serverUrl':{'type':Sequelize[_0xd6b8('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xd6b8('0x5')),'defaultValue':_0xd6b8('0x6')}}; \ No newline at end of file +var _0x9d0c=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x543ea6,_0x48c1f2){var _0x2fe103=function(_0x10c951){while(--_0x10c951){_0x543ea6['push'](_0x543ea6['shift']());}};_0x2fe103(++_0x48c1f2);}(_0x9d0c,0x1a6));var _0xc9d0=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x9d0c[_0x4322c6];return _0x4e7537;};'use strict';var Sequelize=require(_0xc9d0('0x0'));module[_0xc9d0('0x1')]={'name':{'type':Sequelize[_0xc9d0('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc9d0('0x2')]},'remoteUri':{'type':Sequelize[_0xc9d0('0x2')]},'authType':{'type':Sequelize[_0xc9d0('0x3')](_0xc9d0('0x4')),'defaultValue':_0xc9d0('0x4')},'password':{'type':Sequelize[_0xc9d0('0x2')]},'consumerKey':{'type':Sequelize[_0xc9d0('0x2')]},'consumerSecret':{'type':Sequelize[_0xc9d0('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xc9d0('0x2')]},'serverUrl':{'type':Sequelize[_0xc9d0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc9d0('0x5'),_0xc9d0('0x6')),'defaultValue':_0xc9d0('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index d51dab6..c443a36 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 _0x99ce=['getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskAccount','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','username','password','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','Authorization','Basic\x20%s','%s:%s','toString','_embedded','active','test','statusCode'];(function(_0xd53046,_0x30a03c){var _0x493d79=function(_0x567c09){while(--_0x567c09){_0xd53046['push'](_0xd53046['shift']());}};_0x493d79(++_0x30a03c);}(_0x99ce,0x1b7));var _0xe99c=function(_0x583e74,_0x246491){_0x583e74=_0x583e74-0x0;var _0x5ab784=_0x99ce[_0x583e74];return _0x5ab784;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe99c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe99c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe99c('0x2'));var util=require(_0xe99c('0x3'));var path=require(_0xe99c('0x4'));var sox=require(_0xe99c('0x5'));var csv=require(_0xe99c('0x6'));var ejs=require(_0xe99c('0x7'));var fs=require('fs');var fs_extra=require(_0xe99c('0x8'));var _=require(_0xe99c('0x9'));var squel=require(_0xe99c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe99c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe99c('0x6'));var querystring=require(_0xe99c('0xc'));var Papa=require(_0xe99c('0xd'));var Redis=require(_0xe99c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe99c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe99c('0x10'));var logger=require(_0xe99c('0x11'))(_0xe99c('0x12'));var utils=require(_0xe99c('0x13'));var config=require(_0xe99c('0x14'));var licenseUtil=require(_0xe99c('0x15'));var db=require(_0xe99c('0x16'))['db'];var integrations=require(_0xe99c('0x17'));function respondWithStatusCode(_0x1e912c,_0xa382a){_0xa382a=_0xa382a||0xcc;return function(_0x18e057){if(_0x18e057){return _0x1e912c[_0xe99c('0x18')](_0xa382a);}return _0x1e912c[_0xe99c('0x19')](_0xa382a)[_0xe99c('0x1a')]();};}function respondWithResult(_0x5d08b8,_0x1ba1f5){_0x1ba1f5=_0x1ba1f5||0xc8;return function(_0x194b4b){if(_0x194b4b){return _0x5d08b8[_0xe99c('0x19')](_0x1ba1f5)['json'](_0x194b4b);}};}function respondWithFilteredResult(_0x5af0ab,_0x532ad4){return function(_0x30d87a){if(_0x30d87a){var _0x5ae6c1=typeof _0x532ad4[_0xe99c('0x1b')]===_0xe99c('0x1c')&&typeof _0x532ad4[_0xe99c('0x1d')]===_0xe99c('0x1c');var _0x54fca2=_0x30d87a[_0xe99c('0x1e')];var _0x550e6d=_0x5ae6c1?0x0:_0x532ad4[_0xe99c('0x1b')];var _0x631651=_0x5ae6c1?_0x30d87a[_0xe99c('0x1e')]:_0x532ad4['offset']+_0x532ad4[_0xe99c('0x1d')];var _0x2a5612;if(_0x631651>=_0x54fca2){_0x631651=_0x54fca2;_0x2a5612=0xc8;}else{_0x2a5612=0xce;}_0x5af0ab[_0xe99c('0x19')](_0x2a5612);return _0x5af0ab['set']('Content-Range',_0x550e6d+'-'+_0x631651+'/'+_0x54fca2)[_0xe99c('0x1f')](_0x30d87a);}return null;};}function patchUpdates(_0x4caedf){return function(_0xa42310){try{jsonpatch[_0xe99c('0x20')](_0xa42310,_0x4caedf,!![]);}catch(_0x8e8e90){return BPromise['reject'](_0x8e8e90);}return _0xa42310[_0xe99c('0x21')]();};}function saveUpdates(_0x5e5d55,_0x2991ac){return function(_0x1d5a35){if(_0x1d5a35){return _0x1d5a35[_0xe99c('0x22')](_0x5e5d55)[_0xe99c('0x23')](function(_0x49ae33){return _0x49ae33;});}return null;};}function removeEntity(_0x2ace7f,_0xb61e15){return function(_0x3394eb){if(_0x3394eb){return _0x3394eb[_0xe99c('0x24')]()[_0xe99c('0x23')](function(){_0x2ace7f[_0xe99c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27fd23,_0x298f89){return function(_0x4da181){if(!_0x4da181){_0x27fd23[_0xe99c('0x18')](0x194);}return _0x4da181;};}function handleError(_0x1bd582,_0x14946e){_0x14946e=_0x14946e||0x1f4;return function(_0x33e1b8){logger[_0xe99c('0x25')](_0x33e1b8[_0xe99c('0x26')]);if(_0x33e1b8['name']){delete _0x33e1b8[_0xe99c('0x27')];}_0x1bd582['status'](_0x14946e)[_0xe99c('0x28')](_0x33e1b8);};}exports[_0xe99c('0x29')]=function(_0x39100b,_0x44cbb9){var _0x4c51f5={},_0x154ca9={},_0x5bcc67={'count':0x0,'rows':[]};var _0x27d13e=_[_0xe99c('0x2a')](db[_0xe99c('0x2b')][_0xe99c('0x2c')],function(_0x41d9de){return{'name':_0x41d9de['fieldName'],'type':_0x41d9de['type']['key']};});_0x154ca9[_0xe99c('0x2d')]=_[_0xe99c('0x2a')](_0x27d13e,_0xe99c('0x27'));_0x154ca9[_0xe99c('0x2e')]=_[_0xe99c('0x2f')](_0x39100b['query']);_0x154ca9[_0xe99c('0x30')]=_[_0xe99c('0x31')](_0x154ca9[_0xe99c('0x2d')],_0x154ca9[_0xe99c('0x2e')]);_0x4c51f5[_0xe99c('0x32')]=_[_0xe99c('0x31')](_0x154ca9[_0xe99c('0x2d')],qs[_0xe99c('0x33')](_0x39100b['query'][_0xe99c('0x33')]));_0x4c51f5[_0xe99c('0x32')]=_0x4c51f5[_0xe99c('0x32')][_0xe99c('0x34')]?_0x4c51f5['attributes']:_0x154ca9[_0xe99c('0x2d')];if(!_0x39100b[_0xe99c('0x2e')][_0xe99c('0x35')](_0xe99c('0x36'))){_0x4c51f5[_0xe99c('0x1d')]=qs[_0xe99c('0x1d')](_0x39100b[_0xe99c('0x2e')]['limit']);_0x4c51f5[_0xe99c('0x1b')]=qs[_0xe99c('0x1b')](_0x39100b[_0xe99c('0x2e')][_0xe99c('0x1b')]);}_0x4c51f5[_0xe99c('0x37')]=qs[_0xe99c('0x38')](_0x39100b[_0xe99c('0x2e')][_0xe99c('0x38')]);_0x4c51f5[_0xe99c('0x39')]=qs[_0xe99c('0x30')](_[_0xe99c('0x3a')](_0x39100b[_0xe99c('0x2e')],_0x154ca9[_0xe99c('0x30')]),_0x27d13e);if(_0x39100b[_0xe99c('0x2e')][_0xe99c('0x3b')]){_0x4c51f5[_0xe99c('0x39')]=_[_0xe99c('0x3c')](_0x4c51f5['where'],{'$or':_[_0xe99c('0x2a')](_0x27d13e,function(_0x54cbdf){if(_0x54cbdf[_0xe99c('0x3d')]!==_0xe99c('0x3e')){var _0xb674e3={};_0xb674e3[_0x54cbdf['name']]={'$like':'%'+_0x39100b[_0xe99c('0x2e')][_0xe99c('0x3b')]+'%'};return _0xb674e3;}})});}_0x4c51f5=_[_0xe99c('0x3c')]({},_0x4c51f5,_0x39100b[_0xe99c('0x3f')]);var _0x4219cf={'where':_0x4c51f5[_0xe99c('0x39')]};return db['DeskAccount']['count'](_0x4219cf)['then'](function(_0x1d958c){_0x5bcc67[_0xe99c('0x1e')]=_0x1d958c;if(_0x39100b[_0xe99c('0x2e')][_0xe99c('0x40')]){_0x4c51f5[_0xe99c('0x41')]=[{'all':!![]}];}return db[_0xe99c('0x2b')][_0xe99c('0x42')](_0x4c51f5);})[_0xe99c('0x23')](function(_0x2f2a42){_0x5bcc67[_0xe99c('0x43')]=_0x2f2a42;return _0x5bcc67;})['then'](respondWithFilteredResult(_0x44cbb9,_0x4c51f5))[_0xe99c('0x44')](handleError(_0x44cbb9,null));};exports[_0xe99c('0x45')]=function(_0x515c78,_0x203e70){var _0x20bae0={'raw':![],'where':{'id':_0x515c78[_0xe99c('0x46')]['id']}},_0x2838b3={};_0x2838b3[_0xe99c('0x2d')]=_[_0xe99c('0x2f')](db['DeskAccount'][_0xe99c('0x2c')]);_0x2838b3[_0xe99c('0x2e')]=_[_0xe99c('0x2f')](_0x515c78[_0xe99c('0x2e')]);_0x2838b3[_0xe99c('0x30')]=_[_0xe99c('0x31')](_0x2838b3[_0xe99c('0x2d')],_0x2838b3['query']);_0x20bae0['attributes']=_[_0xe99c('0x31')](_0x2838b3[_0xe99c('0x2d')],qs['fields'](_0x515c78[_0xe99c('0x2e')]['fields']));_0x20bae0['attributes']=_0x20bae0[_0xe99c('0x32')]['length']?_0x20bae0[_0xe99c('0x32')]:_0x2838b3[_0xe99c('0x2d')];if(_0x515c78[_0xe99c('0x2e')]['includeAll']){_0x20bae0['include']=[{'all':!![]}];}_0x20bae0=_['merge']({},_0x20bae0,_0x515c78[_0xe99c('0x3f')]);return db['DeskAccount'][_0xe99c('0x47')](_0x20bae0)[_0xe99c('0x23')](handleEntityNotFound(_0x203e70,null))[_0xe99c('0x23')](respondWithResult(_0x203e70,null))[_0xe99c('0x44')](handleError(_0x203e70,null));};exports[_0xe99c('0x48')]=function(_0x40c03a,_0x497979){return db[_0xe99c('0x2b')][_0xe99c('0x48')](_0x40c03a['body'],{})[_0xe99c('0x23')](respondWithResult(_0x497979,0xc9))['catch'](handleError(_0x497979,null));};exports[_0xe99c('0x22')]=function(_0x2847f0,_0x426801){if(_0x2847f0[_0xe99c('0x49')]['id']){delete _0x2847f0[_0xe99c('0x49')]['id'];}return db['DeskAccount'][_0xe99c('0x47')]({'where':{'id':_0x2847f0[_0xe99c('0x46')]['id']}})[_0xe99c('0x23')](handleEntityNotFound(_0x426801,null))[_0xe99c('0x23')](saveUpdates(_0x2847f0[_0xe99c('0x49')],null))['then'](respondWithResult(_0x426801,null))[_0xe99c('0x44')](handleError(_0x426801,null));};exports[_0xe99c('0x24')]=function(_0x27614b,_0x16e751){return db[_0xe99c('0x2b')][_0xe99c('0x47')]({'where':{'id':_0x27614b['params']['id']}})['then'](handleEntityNotFound(_0x16e751,null))[_0xe99c('0x23')](removeEntity(_0x16e751,null))[_0xe99c('0x44')](handleError(_0x16e751,null));};exports[_0xe99c('0x4a')]=function(_0x3e59c1,_0x30ea41,_0x76ddd8){var _0x35725a={};var _0x568d95={};var _0x3f07f9;var _0x2db044;return db['DeskAccount'][_0xe99c('0x4b')]({'where':{'id':_0x3e59c1['params']['id']}})[_0xe99c('0x23')](handleEntityNotFound(_0x30ea41,null))['then'](function(_0x1c0621){if(_0x1c0621){_0x3f07f9=_0x1c0621;_0x568d95['model']=_[_0xe99c('0x2f')](db[_0xe99c('0x4c')]['rawAttributes']);_0x568d95[_0xe99c('0x2e')]=_[_0xe99c('0x2f')](_0x3e59c1[_0xe99c('0x2e')]);_0x568d95[_0xe99c('0x30')]=_[_0xe99c('0x31')](_0x568d95[_0xe99c('0x2d')],_0x568d95[_0xe99c('0x2e')]);_0x35725a['attributes']=_[_0xe99c('0x31')](_0x568d95[_0xe99c('0x2d')],qs[_0xe99c('0x33')](_0x3e59c1['query']['fields']));_0x35725a[_0xe99c('0x32')]=_0x35725a['attributes']['length']?_0x35725a[_0xe99c('0x32')]:_0x568d95[_0xe99c('0x2d')];_0x35725a[_0xe99c('0x37')]=qs[_0xe99c('0x38')](_0x3e59c1[_0xe99c('0x2e')][_0xe99c('0x38')]);_0x35725a[_0xe99c('0x39')]=qs[_0xe99c('0x30')](_['pick'](_0x3e59c1[_0xe99c('0x2e')],_0x568d95[_0xe99c('0x30')]));if(_0x3e59c1[_0xe99c('0x2e')][_0xe99c('0x3b')]){_0x35725a['where']=_[_0xe99c('0x3c')](_0x35725a[_0xe99c('0x39')],{'$or':_[_0xe99c('0x2a')](_0x35725a[_0xe99c('0x32')],function(_0x1d61b4){var _0x291c6f={};_0x291c6f[_0x1d61b4]={'$like':'%'+_0x3e59c1[_0xe99c('0x2e')][_0xe99c('0x3b')]+'%'};return _0x291c6f;})});}_0x35725a=_[_0xe99c('0x3c')]({},_0x35725a,_0x3e59c1['options']);return _0x3f07f9['getConfigurations'](_0x35725a);}})['then'](function(_0x18f2d4){if(_0x18f2d4){_0x2db044=_0x18f2d4['length'];if(!_0x3e59c1[_0xe99c('0x2e')][_0xe99c('0x35')]('nolimit')){_0x35725a[_0xe99c('0x1d')]=qs[_0xe99c('0x1d')](_0x3e59c1['query']['limit']);_0x35725a['offset']=qs[_0xe99c('0x1b')](_0x3e59c1['query']['offset']);}return _0x3f07f9[_0xe99c('0x4a')](_0x35725a);}})[_0xe99c('0x23')](function(_0x3a498b){if(_0x3a498b){return _0x3a498b?{'count':_0x2db044,'rows':_0x3a498b}:null;}})[_0xe99c('0x23')](respondWithResult(_0x30ea41,null))['catch'](handleError(_0x30ea41,null));};exports['addConfiguration']=function(_0xdfdaa4,_0x4f284c,_0x450312){if(_0xdfdaa4['body']['id']){delete _0xdfdaa4[_0xe99c('0x49')]['id'];}return db[_0xe99c('0x2b')][_0xe99c('0x4b')]({'where':{'id':_0xdfdaa4[_0xe99c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f284c,null))[_0xe99c('0x23')](function(_0x55ba59){if(_0x55ba59){_0xdfdaa4[_0xe99c('0x49')][_0xe99c('0x4d')]=_0x55ba59['id'];_0xdfdaa4[_0xe99c('0x49')][_0xe99c('0x4e')]=integrations['getSubjects'](_0xdfdaa4[_0xe99c('0x49')][_0xe99c('0x4f')],_0xdfdaa4[_0xe99c('0x49')][_0xe99c('0x3d')]);_0xdfdaa4['body']['Descriptions']=integrations['getDescriptions'](_0xdfdaa4[_0xe99c('0x49')][_0xe99c('0x4f')],_0xdfdaa4['body'][_0xe99c('0x3d')]);return db[_0xe99c('0x4c')][_0xe99c('0x48')](_0xdfdaa4[_0xe99c('0x49')],{'include':[{'model':db[_0xe99c('0x50')],'as':_0xe99c('0x4e')},{'model':db['DeskField'],'as':_0xe99c('0x51')}]});}return null;})[_0xe99c('0x23')](respondWithResult(_0x4f284c,null))['catch'](handleError(_0x4f284c,null));};exports[_0xe99c('0x52')]=function(_0x1eb01c,_0x271adb,_0x70d1ea){var _0xb0979e=[{'name':_0xe99c('0x53'),'label':_0xe99c('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x904423='';return db['DeskAccount']['findOne']({'where':{'id':_0x1eb01c[_0xe99c('0x46')]['id']},'attributes':['id',_0xe99c('0x54'),'authType',_0xe99c('0x55'),_0xe99c('0x56'),'consumerKey',_0xe99c('0x57'),'token',_0xe99c('0x58')]})['then'](handleEntityNotFound(_0x271adb,null))['then'](function(_0x2a5686){if(_0x2a5686){_0x904423=_0x2a5686['remoteUri'];var _0x1e6dc8=_0x904423[_0xe99c('0x59')](-0x1);if(_0x1e6dc8==='/'){_0x904423=_0x904423[_0xe99c('0x5a')](0x0,_0x904423[_0xe99c('0x5b')](_0x1e6dc8));}var _0x5f2121={'method':_0xe99c('0x5c'),'uri':util[_0xe99c('0x5d')](_0xe99c('0x5e'),_0x904423),'headers':{'Content-Type':_0xe99c('0x5f'),'Accept':_0xe99c('0x5f')},'json':!![]};if(_0x2a5686[_0xe99c('0x60')]===_0xe99c('0x61')){_0x5f2121['headers'][_0xe99c('0x62')]=util[_0xe99c('0x5d')](_0xe99c('0x63'),new Buffer(util[_0xe99c('0x5d')](_0xe99c('0x64'),_0x2a5686[_0xe99c('0x55')],_0x2a5686[_0xe99c('0x56')]))[_0xe99c('0x65')]('base64'));}return rp(_0x5f2121)[_0xe99c('0x23')](function(_0x904fbd){return _0xb0979e['concat'](_[_0xe99c('0x2a')](_0x904fbd[_0xe99c('0x66')]['entries'],function(_0x3fdee9){return{'id':_0x3fdee9[_0xe99c('0x27')],'name':_0x3fdee9[_0xe99c('0x27')],'type':_0x3fdee9[_0xe99c('0x3d')],'active':_0x3fdee9[_0xe99c('0x67')],'label':_0x3fdee9['label'],'custom':!![]};}));});}})[_0xe99c('0x23')](function(_0x1a50c4){return{'count':_0x1a50c4[_0xe99c('0x34')],'rows':_0x1a50c4};})[_0xe99c('0x23')](respondWithResult(_0x271adb,null))[_0xe99c('0x44')](function(_0x59a66b){var _0x1ae82c=_0x1eb01c[_0xe99c('0x2e')][_0xe99c('0x68')]?0x1f4:_0x59a66b[_0xe99c('0x69')]||0x1f4;logger[_0xe99c('0x25')](_0xe99c('0x6a'),_0xe99c('0x52'),_0x1ae82c,JSON[_0xe99c('0x6b')](_0x59a66b));delete _0x59a66b['name'];if(_0x1ae82c===0x191){_0x1ae82c=0x190;}_0x271adb['status'](_0x1ae82c)[_0xe99c('0x28')](_0x1eb01c[_0xe99c('0x2e')][_0xe99c('0x68')]?{'message':_0xe99c('0x6c'),'statusCode':_0x59a66b['statusCode']}:_0x59a66b);});}; \ No newline at end of file +var _0x78cd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','find','create','body','params','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0xdefbc3,_0x1ea49a){var _0x367798=function(_0x594678){while(--_0x594678){_0xdefbc3['push'](_0xdefbc3['shift']());}};_0x367798(++_0x1ea49a);}(_0x78cd,0x199));var _0xd78c=function(_0x3c4958,_0x450ef9){_0x3c4958=_0x3c4958-0x0;var _0x46bd11=_0x78cd[_0x3c4958];return _0x46bd11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd78c('0x0'));var zipdir=require(_0xd78c('0x1'));var jsonpatch=require(_0xd78c('0x2'));var rp=require('request-promise');var moment=require(_0xd78c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd78c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd78c('0x5'));var csv=require(_0xd78c('0x6'));var ejs=require(_0xd78c('0x7'));var fs=require('fs');var fs_extra=require(_0xd78c('0x8'));var _=require('lodash');var squel=require(_0xd78c('0x9'));var crypto=require(_0xd78c('0xa'));var jsforce=require(_0xd78c('0xb'));var deskjs=require(_0xd78c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd78c('0xd'));var authService=require(_0xd78c('0xe'));var qs=require(_0xd78c('0xf'));var as=require(_0xd78c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd78c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd78c('0x12'));var licenseUtil=require(_0xd78c('0x13'));var db=require(_0xd78c('0x14'))['db'];var integrations=require(_0xd78c('0x15'));function respondWithStatusCode(_0x5454f5,_0x3fe19f){_0x3fe19f=_0x3fe19f||0xcc;return function(_0x58427c){if(_0x58427c){return _0x5454f5[_0xd78c('0x16')](_0x3fe19f);}return _0x5454f5['status'](_0x3fe19f)[_0xd78c('0x17')]();};}function respondWithResult(_0x190267,_0x4d671a){_0x4d671a=_0x4d671a||0xc8;return function(_0x2de4cc){if(_0x2de4cc){return _0x190267[_0xd78c('0x18')](_0x4d671a)['json'](_0x2de4cc);}};}function respondWithFilteredResult(_0x37dd68,_0x2a8e2a){return function(_0x5e2aca){if(_0x5e2aca){var _0x37fd11=typeof _0x2a8e2a[_0xd78c('0x19')]==='undefined'&&typeof _0x2a8e2a[_0xd78c('0x1a')]==='undefined';var _0x485f0d=_0x5e2aca[_0xd78c('0x1b')];var _0x5228d1=_0x37fd11?0x0:_0x2a8e2a['offset'];var _0x2fdbbd=_0x37fd11?_0x5e2aca['count']:_0x2a8e2a[_0xd78c('0x19')]+_0x2a8e2a[_0xd78c('0x1a')];var _0x2ac265;if(_0x2fdbbd>=_0x485f0d){_0x2fdbbd=_0x485f0d;_0x2ac265=0xc8;}else{_0x2ac265=0xce;}_0x37dd68[_0xd78c('0x18')](_0x2ac265);return _0x37dd68['set'](_0xd78c('0x1c'),_0x5228d1+'-'+_0x2fdbbd+'/'+_0x485f0d)[_0xd78c('0x1d')](_0x5e2aca);}return null;};}function patchUpdates(_0x307c52){return function(_0x26ae84){try{jsonpatch[_0xd78c('0x1e')](_0x26ae84,_0x307c52,!![]);}catch(_0x2fee0e){return BPromise[_0xd78c('0x1f')](_0x2fee0e);}return _0x26ae84[_0xd78c('0x20')]();};}function saveUpdates(_0x3719f8,_0x299845){return function(_0x3cf5d8){if(_0x3cf5d8){return _0x3cf5d8['update'](_0x3719f8)[_0xd78c('0x21')](function(_0x269883){return _0x269883;});}return null;};}function removeEntity(_0xb7bfc3,_0x4a34dd){return function(_0x7bf92){if(_0x7bf92){return _0x7bf92[_0xd78c('0x22')]()[_0xd78c('0x21')](function(){_0xb7bfc3[_0xd78c('0x18')](0xcc)[_0xd78c('0x17')]();});}};}function handleEntityNotFound(_0xac5979,_0x189b9f){return function(_0x289453){if(!_0x289453){_0xac5979[_0xd78c('0x16')](0x194);}return _0x289453;};}function handleError(_0x208f44,_0x26fed3){_0x26fed3=_0x26fed3||0x1f4;return function(_0x33ecfb){logger[_0xd78c('0x23')](_0x33ecfb['stack']);if(_0x33ecfb[_0xd78c('0x24')]){delete _0x33ecfb[_0xd78c('0x24')];}_0x208f44[_0xd78c('0x18')](_0x26fed3)[_0xd78c('0x25')](_0x33ecfb);};}exports['index']=function(_0x20431a,_0x32817e){var _0x49ab8a={},_0x18e03b={},_0x49bfa8={'count':0x0,'rows':[]};var _0x67e858=_[_0xd78c('0x26')](db[_0xd78c('0x27')][_0xd78c('0x28')],function(_0x4c979b){return{'name':_0x4c979b[_0xd78c('0x29')],'type':_0x4c979b[_0xd78c('0x2a')][_0xd78c('0x2b')]};});_0x18e03b[_0xd78c('0x2c')]=_[_0xd78c('0x26')](_0x67e858,'name');_0x18e03b[_0xd78c('0x2d')]=_[_0xd78c('0x2e')](_0x20431a[_0xd78c('0x2d')]);_0x18e03b[_0xd78c('0x2f')]=_['intersection'](_0x18e03b['model'],_0x18e03b[_0xd78c('0x2d')]);_0x49ab8a[_0xd78c('0x30')]=_['intersection'](_0x18e03b[_0xd78c('0x2c')],qs[_0xd78c('0x31')](_0x20431a[_0xd78c('0x2d')]['fields']));_0x49ab8a[_0xd78c('0x30')]=_0x49ab8a['attributes'][_0xd78c('0x32')]?_0x49ab8a[_0xd78c('0x30')]:_0x18e03b['model'];if(!_0x20431a[_0xd78c('0x2d')]['hasOwnProperty'](_0xd78c('0x33'))){_0x49ab8a['limit']=qs['limit'](_0x20431a[_0xd78c('0x2d')]['limit']);_0x49ab8a[_0xd78c('0x19')]=qs[_0xd78c('0x19')](_0x20431a[_0xd78c('0x2d')]['offset']);}_0x49ab8a[_0xd78c('0x34')]=qs[_0xd78c('0x35')](_0x20431a[_0xd78c('0x2d')][_0xd78c('0x35')]);_0x49ab8a[_0xd78c('0x36')]=qs[_0xd78c('0x2f')](_[_0xd78c('0x37')](_0x20431a[_0xd78c('0x2d')],_0x18e03b[_0xd78c('0x2f')]),_0x67e858);if(_0x20431a[_0xd78c('0x2d')][_0xd78c('0x38')]){_0x49ab8a[_0xd78c('0x36')]=_[_0xd78c('0x39')](_0x49ab8a[_0xd78c('0x36')],{'$or':_['map'](_0x67e858,function(_0x1cb6cb){if(_0x1cb6cb[_0xd78c('0x2a')]!==_0xd78c('0x3a')){var _0x9a481d={};_0x9a481d[_0x1cb6cb[_0xd78c('0x24')]]={'$like':'%'+_0x20431a[_0xd78c('0x2d')][_0xd78c('0x38')]+'%'};return _0x9a481d;}})});}_0x49ab8a=_['merge']({},_0x49ab8a,_0x20431a[_0xd78c('0x3b')]);var _0x2b570b={'where':_0x49ab8a[_0xd78c('0x36')]};return db['DeskAccount'][_0xd78c('0x1b')](_0x2b570b)[_0xd78c('0x21')](function(_0x552f17){_0x49bfa8['count']=_0x552f17;if(_0x20431a[_0xd78c('0x2d')][_0xd78c('0x3c')]){_0x49ab8a[_0xd78c('0x3d')]=[{'all':!![]}];}return db[_0xd78c('0x27')]['findAll'](_0x49ab8a);})[_0xd78c('0x21')](function(_0x339f82){_0x49bfa8[_0xd78c('0x3e')]=_0x339f82;return _0x49bfa8;})['then'](respondWithFilteredResult(_0x32817e,_0x49ab8a))[_0xd78c('0x3f')](handleError(_0x32817e,null));};exports[_0xd78c('0x40')]=function(_0x2a3c11,_0x42e9f1){var _0x129fef={'raw':![],'where':{'id':_0x2a3c11['params']['id']}},_0x1fc75c={};_0x1fc75c[_0xd78c('0x2c')]=_[_0xd78c('0x2e')](db[_0xd78c('0x27')][_0xd78c('0x28')]);_0x1fc75c[_0xd78c('0x2d')]=_[_0xd78c('0x2e')](_0x2a3c11[_0xd78c('0x2d')]);_0x1fc75c[_0xd78c('0x2f')]=_[_0xd78c('0x41')](_0x1fc75c[_0xd78c('0x2c')],_0x1fc75c['query']);_0x129fef[_0xd78c('0x30')]=_[_0xd78c('0x41')](_0x1fc75c[_0xd78c('0x2c')],qs[_0xd78c('0x31')](_0x2a3c11[_0xd78c('0x2d')][_0xd78c('0x31')]));_0x129fef[_0xd78c('0x30')]=_0x129fef[_0xd78c('0x30')]['length']?_0x129fef['attributes']:_0x1fc75c[_0xd78c('0x2c')];if(_0x2a3c11[_0xd78c('0x2d')]['includeAll']){_0x129fef[_0xd78c('0x3d')]=[{'all':!![]}];}_0x129fef=_[_0xd78c('0x39')]({},_0x129fef,_0x2a3c11[_0xd78c('0x3b')]);return db[_0xd78c('0x27')][_0xd78c('0x42')](_0x129fef)[_0xd78c('0x21')](handleEntityNotFound(_0x42e9f1,null))[_0xd78c('0x21')](respondWithResult(_0x42e9f1,null))['catch'](handleError(_0x42e9f1,null));};exports[_0xd78c('0x43')]=function(_0x191555,_0x2f93e9){return db[_0xd78c('0x27')][_0xd78c('0x43')](_0x191555['body'],{})['then'](respondWithResult(_0x2f93e9,0xc9))[_0xd78c('0x3f')](handleError(_0x2f93e9,null));};exports['update']=function(_0x394687,_0x4f8fec){if(_0x394687[_0xd78c('0x44')]['id']){delete _0x394687[_0xd78c('0x44')]['id'];}return db['DeskAccount'][_0xd78c('0x42')]({'where':{'id':_0x394687[_0xd78c('0x45')]['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x4f8fec,null))[_0xd78c('0x21')](saveUpdates(_0x394687[_0xd78c('0x44')],null))[_0xd78c('0x21')](respondWithResult(_0x4f8fec,null))['catch'](handleError(_0x4f8fec,null));};exports[_0xd78c('0x22')]=function(_0x57ee6c,_0x7ebdbe){return db[_0xd78c('0x27')][_0xd78c('0x42')]({'where':{'id':_0x57ee6c[_0xd78c('0x45')]['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x7ebdbe,null))['then'](removeEntity(_0x7ebdbe,null))[_0xd78c('0x3f')](handleError(_0x7ebdbe,null));};exports[_0xd78c('0x46')]=function(_0x98d58b,_0x15a2e4,_0x1aea1f){var _0x2ee9fc={};var _0x310b76={};var _0x26304f;var _0x3fe1ad;return db[_0xd78c('0x27')][_0xd78c('0x47')]({'where':{'id':_0x98d58b[_0xd78c('0x45')]['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x15a2e4,null))[_0xd78c('0x21')](function(_0x3842f7){if(_0x3842f7){_0x26304f=_0x3842f7;_0x310b76[_0xd78c('0x2c')]=_[_0xd78c('0x2e')](db[_0xd78c('0x48')][_0xd78c('0x28')]);_0x310b76[_0xd78c('0x2d')]=_[_0xd78c('0x2e')](_0x98d58b['query']);_0x310b76[_0xd78c('0x2f')]=_[_0xd78c('0x41')](_0x310b76[_0xd78c('0x2c')],_0x310b76[_0xd78c('0x2d')]);_0x2ee9fc['attributes']=_[_0xd78c('0x41')](_0x310b76[_0xd78c('0x2c')],qs['fields'](_0x98d58b['query'][_0xd78c('0x31')]));_0x2ee9fc[_0xd78c('0x30')]=_0x2ee9fc['attributes'][_0xd78c('0x32')]?_0x2ee9fc[_0xd78c('0x30')]:_0x310b76[_0xd78c('0x2c')];_0x2ee9fc[_0xd78c('0x34')]=qs['sort'](_0x98d58b[_0xd78c('0x2d')][_0xd78c('0x35')]);_0x2ee9fc['where']=qs[_0xd78c('0x2f')](_[_0xd78c('0x37')](_0x98d58b[_0xd78c('0x2d')],_0x310b76['filters']));if(_0x98d58b[_0xd78c('0x2d')]['filter']){_0x2ee9fc['where']=_['merge'](_0x2ee9fc[_0xd78c('0x36')],{'$or':_[_0xd78c('0x26')](_0x2ee9fc[_0xd78c('0x30')],function(_0x11c5a3){var _0x391b8d={};_0x391b8d[_0x11c5a3]={'$like':'%'+_0x98d58b[_0xd78c('0x2d')]['filter']+'%'};return _0x391b8d;})});}_0x2ee9fc=_['merge']({},_0x2ee9fc,_0x98d58b[_0xd78c('0x3b')]);return _0x26304f['getConfigurations'](_0x2ee9fc);}})[_0xd78c('0x21')](function(_0x1869dd){if(_0x1869dd){_0x3fe1ad=_0x1869dd[_0xd78c('0x32')];if(!_0x98d58b[_0xd78c('0x2d')][_0xd78c('0x49')]('nolimit')){_0x2ee9fc[_0xd78c('0x1a')]=qs[_0xd78c('0x1a')](_0x98d58b['query'][_0xd78c('0x1a')]);_0x2ee9fc[_0xd78c('0x19')]=qs[_0xd78c('0x19')](_0x98d58b[_0xd78c('0x2d')][_0xd78c('0x19')]);}return _0x26304f[_0xd78c('0x46')](_0x2ee9fc);}})[_0xd78c('0x21')](function(_0x98b83a){if(_0x98b83a){return _0x98b83a?{'count':_0x3fe1ad,'rows':_0x98b83a}:null;}})['then'](respondWithResult(_0x15a2e4,null))['catch'](handleError(_0x15a2e4,null));};exports[_0xd78c('0x4a')]=function(_0x1e8dcf,_0x5cab39,_0x44432b){if(_0x1e8dcf[_0xd78c('0x44')]['id']){delete _0x1e8dcf[_0xd78c('0x44')]['id'];}return db[_0xd78c('0x27')][_0xd78c('0x47')]({'where':{'id':_0x1e8dcf['params']['id']}})[_0xd78c('0x21')](handleEntityNotFound(_0x5cab39,null))[_0xd78c('0x21')](function(_0x47ff0d){if(_0x47ff0d){_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x4b')]=_0x47ff0d['id'];_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x4c')]=integrations[_0xd78c('0x4d')](_0x1e8dcf[_0xd78c('0x44')]['channel'],_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x2a')]);_0x1e8dcf[_0xd78c('0x44')]['Descriptions']=integrations['getDescriptions'](_0x1e8dcf[_0xd78c('0x44')]['channel'],_0x1e8dcf[_0xd78c('0x44')][_0xd78c('0x2a')]);return db[_0xd78c('0x48')]['create'](_0x1e8dcf['body'],{'include':[{'model':db[_0xd78c('0x4e')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xd78c('0x4f')}]});}return null;})[_0xd78c('0x21')](respondWithResult(_0x5cab39,null))[_0xd78c('0x3f')](handleError(_0x5cab39,null));};exports['getFields']=function(_0x473c06,_0x3bf243,_0x1b7ec3){var _0x3745a2=[{'name':_0xd78c('0x50'),'label':_0xd78c('0x50'),'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 _0x5d63a5='';return db[_0xd78c('0x27')][_0xd78c('0x47')]({'where':{'id':_0x473c06[_0xd78c('0x45')]['id']},'attributes':['id',_0xd78c('0x51'),_0xd78c('0x52'),_0xd78c('0x53'),_0xd78c('0x54'),'consumerKey',_0xd78c('0x55'),_0xd78c('0x56'),_0xd78c('0x57')]})[_0xd78c('0x21')](handleEntityNotFound(_0x3bf243,null))[_0xd78c('0x21')](function(_0x54707a){if(_0x54707a){_0x5d63a5=_0x54707a[_0xd78c('0x51')];var _0x51cbb5=_0x5d63a5[_0xd78c('0x58')](-0x1);if(_0x51cbb5==='/'){_0x5d63a5=_0x5d63a5[_0xd78c('0x59')](0x0,_0x5d63a5[_0xd78c('0x5a')](_0x51cbb5));}var _0x1d6db7={'method':_0xd78c('0x5b'),'uri':util[_0xd78c('0x5c')](_0xd78c('0x5d'),_0x5d63a5),'headers':{'Content-Type':_0xd78c('0x5e'),'Accept':'application/json'},'json':!![]};if(_0x54707a[_0xd78c('0x52')]==='basic'){_0x1d6db7[_0xd78c('0x5f')][_0xd78c('0x60')]=util[_0xd78c('0x5c')](_0xd78c('0x61'),new Buffer(util[_0xd78c('0x5c')](_0xd78c('0x62'),_0x54707a[_0xd78c('0x53')],_0x54707a[_0xd78c('0x54')]))[_0xd78c('0x63')](_0xd78c('0x64')));}return rp(_0x1d6db7)[_0xd78c('0x21')](function(_0x161e62){return _0x3745a2[_0xd78c('0x65')](_[_0xd78c('0x26')](_0x161e62['_embedded'][_0xd78c('0x66')],function(_0x58aecb){return{'id':_0x58aecb[_0xd78c('0x24')],'name':_0x58aecb[_0xd78c('0x24')],'type':_0x58aecb['type'],'active':_0x58aecb[_0xd78c('0x67')],'label':_0x58aecb[_0xd78c('0x68')],'custom':!![]};}));});}})['then'](function(_0x58e45d){return{'count':_0x58e45d['length'],'rows':_0x58e45d};})['then'](respondWithResult(_0x3bf243,null))[_0xd78c('0x3f')](function(_0x34c319){var _0x550929=_0x473c06[_0xd78c('0x2d')][_0xd78c('0x69')]?0x1f4:_0x34c319['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x550929,JSON['stringify'](_0x34c319));delete _0x34c319[_0xd78c('0x24')];if(_0x550929===0x191){_0x550929=0x190;}_0x3bf243[_0xd78c('0x18')](_0x550929)[_0xd78c('0x25')](_0x473c06[_0xd78c('0x2d')][_0xd78c('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x34c319['statusCode']}:_0x34c319);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 07a074a..3372c7e 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 _0xb0a3=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xb0a3,0x1a7));var _0x3b0a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xb0a3[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x3b0a('0x0'));var util=require(_0x3b0a('0x1'));var logger=require(_0x3b0a('0x2'))(_0x3b0a('0x3'));var moment=require(_0x3b0a('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b0a('0x5'));var fs=require('fs');var path=require(_0x3b0a('0x6'));var rimraf=require(_0x3b0a('0x7'));var config=require(_0x3b0a('0x8'));var attributes=require(_0x3b0a('0x9'));var integrations=require(_0x3b0a('0xa'));module['exports']=function(_0x24933f,_0xacade7){return _0x24933f[_0x3b0a('0xb')](_0x3b0a('0xc'),attributes,{'tableName':_0x3b0a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3345=['moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','api'];(function(_0x1d196b,_0x1e4a01){var _0x23b6ae=function(_0x5cf9f1){while(--_0x5cf9f1){_0x1d196b['push'](_0x1d196b['shift']());}};_0x23b6ae(++_0x1e4a01);}(_0x3345,0xb3));var _0x5334=function(_0x52d013,_0x3f3f02){_0x52d013=_0x52d013-0x0;var _0x29b137=_0x3345[_0x52d013];return _0x29b137;};'use strict';var _=require(_0x5334('0x0'));var util=require('util');var logger=require(_0x5334('0x1'))(_0x5334('0x2'));var moment=require(_0x5334('0x3'));var BPromise=require('bluebird');var rp=require(_0x5334('0x4'));var fs=require('fs');var path=require(_0x5334('0x5'));var rimraf=require(_0x5334('0x6'));var config=require(_0x5334('0x7'));var attributes=require(_0x5334('0x8'));var integrations=require(_0x5334('0x9'));module[_0x5334('0xa')]=function(_0x291bc7,_0xbfb340){return _0x291bc7['define'](_0x5334('0xb'),attributes,{'tableName':_0x5334('0xc'),'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 1328003..54a6876 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 _0x99b2=['message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','DeskAccount','find','ShowDeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x18a63d,_0xf428a7){var _0x4bbfb1=function(_0x5af984){while(--_0x5af984){_0x18a63d['push'](_0x18a63d['shift']());}};_0x4bbfb1(++_0xf428a7);}(_0x99b2,0x164));var _0x299b=function(_0x888c9e,_0x4b49fb){_0x888c9e=_0x888c9e-0x0;var _0x242559=_0x99b2[_0x888c9e];return _0x242559;};'use strict';var _=require('lodash');var util=require(_0x299b('0x0'));var moment=require('moment');var BPromise=require(_0x299b('0x1'));var rs=require(_0x299b('0x2'));var fs=require('fs');var Redis=require(_0x299b('0x3'));var db=require(_0x299b('0x4'))['db'];var utils=require(_0x299b('0x5'));var logger=require('../../config/logger')(_0x299b('0x6'));var config=require(_0x299b('0x7'));var jayson=require(_0x299b('0x8'));var client=jayson[_0x299b('0x9')][_0x299b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43c4c8,_0x3a2b6d,_0x58411c){return new BPromise(function(_0x36a9ad,_0x46d40c){return client['request'](_0x43c4c8,_0x58411c)[_0x299b('0xb')](function(_0x18c8ea){logger[_0x299b('0xc')](_0x299b('0xd'),_0x3a2b6d,_0x299b('0xe'));logger[_0x299b('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3a2b6d,_0x299b('0xe'),JSON[_0x299b('0x10')](_0x18c8ea));if(_0x18c8ea[_0x299b('0x11')]){if(_0x18c8ea[_0x299b('0x11')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3a2b6d,_0x18c8ea['error']['message']);return _0x46d40c(_0x18c8ea[_0x299b('0x11')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x3a2b6d,_0x18c8ea[_0x299b('0x11')][_0x299b('0x12')]);return _0x36a9ad(_0x18c8ea[_0x299b('0x11')][_0x299b('0x12')]);}else{logger['info'](_0x299b('0xd'),_0x3a2b6d,'request\x20sent');_0x36a9ad(_0x18c8ea[_0x299b('0x13')][_0x299b('0x12')]);}})[_0x299b('0x14')](function(_0x47559c){logger[_0x299b('0x11')](_0x299b('0xd'),_0x3a2b6d,_0x47559c);_0x46d40c(_0x47559c);});});}exports['GetDeskAccount']=function(_0x46d85b){var _0x21836d=this;return new Promise(function(_0x1ca010,_0x4198c4){return db['DeskAccount'][_0x299b('0x15')]({'raw':_0x46d85b[_0x299b('0x16')]?_0x46d85b[_0x299b('0x16')][_0x299b('0x17')]===undefined?!![]:![]:!![],'where':_0x46d85b['options']?_0x46d85b[_0x299b('0x16')][_0x299b('0x18')]||null:null,'attributes':_0x46d85b[_0x299b('0x16')]?_0x46d85b[_0x299b('0x16')][_0x299b('0x19')]||null:null,'limit':_0x46d85b[_0x299b('0x16')]?_0x46d85b[_0x299b('0x16')][_0x299b('0x1a')]||null:null,'include':_0x46d85b[_0x299b('0x16')]?_0x46d85b['options'][_0x299b('0x1b')]?_[_0x299b('0x1c')](_0x46d85b[_0x299b('0x16')][_0x299b('0x1b')],function(_0x47ef8a){return{'model':db[_0x47ef8a[_0x299b('0x1d')]],'as':_0x47ef8a['as'],'attributes':_0x47ef8a[_0x299b('0x19')],'include':_0x47ef8a[_0x299b('0x1b')]?_[_0x299b('0x1c')](_0x47ef8a['include'],function(_0x2cd288){return{'model':db[_0x2cd288[_0x299b('0x1d')]],'as':_0x2cd288['as'],'attributes':_0x2cd288[_0x299b('0x19')],'include':_0x2cd288['include']?_[_0x299b('0x1c')](_0x2cd288[_0x299b('0x1b')],function(_0x2ca9fb){return{'model':db[_0x2ca9fb[_0x299b('0x1d')]],'as':_0x2ca9fb['as'],'attributes':_0x2ca9fb[_0x299b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x299b('0xb')](function(_0x35e584){logger[_0x299b('0xc')](_0x299b('0x1e'),_0x46d85b);logger[_0x299b('0xf')]('GetDeskAccount',_0x46d85b,JSON[_0x299b('0x10')](_0x35e584));_0x1ca010(_0x35e584);})['catch'](function(_0x19d2cd){logger['error']('GetDeskAccount',_0x19d2cd['message'],_0x46d85b);_0x4198c4(_0x21836d['error'](0x1f4,_0x19d2cd[_0x299b('0x12')]));});});};exports['ShowDeskAccount']=function(_0x1566e4){var _0x22d94a=this;return new Promise(function(_0x3f4418,_0x34f93d){return db[_0x299b('0x1f')][_0x299b('0x20')]({'raw':_0x1566e4[_0x299b('0x16')]?_0x1566e4[_0x299b('0x16')][_0x299b('0x17')]===undefined?!![]:![]:!![],'where':_0x1566e4[_0x299b('0x16')]?_0x1566e4['options'][_0x299b('0x18')]||null:null,'attributes':_0x1566e4[_0x299b('0x16')]?_0x1566e4[_0x299b('0x16')][_0x299b('0x19')]||null:null,'include':_0x1566e4[_0x299b('0x16')]?_0x1566e4[_0x299b('0x16')]['include']?_['map'](_0x1566e4['options'][_0x299b('0x1b')],function(_0x91b949){return{'model':db[_0x91b949[_0x299b('0x1d')]],'as':_0x91b949['as'],'attributes':_0x91b949['attributes'],'include':_0x91b949[_0x299b('0x1b')]?_['map'](_0x91b949['include'],function(_0x81a523){return{'model':db[_0x81a523['model']],'as':_0x81a523['as'],'attributes':_0x81a523[_0x299b('0x19')],'include':_0x81a523[_0x299b('0x1b')]?_[_0x299b('0x1c')](_0x81a523['include'],function(_0x37772d){return{'model':db[_0x37772d[_0x299b('0x1d')]],'as':_0x37772d['as'],'attributes':_0x37772d[_0x299b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x299b('0xb')](function(_0x1f6232){logger[_0x299b('0xc')](_0x299b('0x21'),_0x1566e4);logger['debug']('ShowDeskAccount',_0x1566e4,JSON['stringify'](_0x1f6232));_0x3f4418(_0x1f6232);})['catch'](function(_0x3dd707){logger[_0x299b('0x11')](_0x299b('0x21'),_0x3dd707[_0x299b('0x12')],_0x1566e4);_0x34f93d(_0x22d94a[_0x299b('0x11')](0x1f4,_0x3dd707[_0x299b('0x12')]));});});}; \ No newline at end of file +var _0x5297=['map','model','ShowDeskAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5297,0x1be));var _0x7529=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x5297[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0x7529('0x0'));var util=require('util');var moment=require(_0x7529('0x1'));var BPromise=require(_0x7529('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7529('0x3'));var db=require(_0x7529('0x4'))['db'];var utils=require(_0x7529('0x5'));var logger=require(_0x7529('0x6'))('rpc');var config=require(_0x7529('0x7'));var jayson=require(_0x7529('0x8'));var client=jayson[_0x7529('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x560a5a,_0x4b0f64,_0xa1c8c6){return new BPromise(function(_0x3b2353,_0x1cb187){return client['request'](_0x560a5a,_0xa1c8c6)[_0x7529('0xa')](function(_0x5ab964){logger[_0x7529('0xb')](_0x7529('0xc'),_0x4b0f64,'request\x20sent');logger[_0x7529('0xd')](_0x7529('0xe'),_0x4b0f64,_0x7529('0xf'),JSON[_0x7529('0x10')](_0x5ab964));if(_0x5ab964[_0x7529('0x11')]){if(_0x5ab964[_0x7529('0x11')][_0x7529('0x12')]===0x1f4){logger[_0x7529('0x11')](_0x7529('0xc'),_0x4b0f64,_0x5ab964['error']['message']);return _0x1cb187(_0x5ab964['error'][_0x7529('0x13')]);}logger[_0x7529('0x11')](_0x7529('0xc'),_0x4b0f64,_0x5ab964[_0x7529('0x11')][_0x7529('0x13')]);return _0x3b2353(_0x5ab964[_0x7529('0x11')][_0x7529('0x13')]);}else{logger[_0x7529('0xb')]('DeskAccount,\x20%s,\x20%s',_0x4b0f64,'request\x20sent');_0x3b2353(_0x5ab964[_0x7529('0x14')][_0x7529('0x13')]);}})[_0x7529('0x15')](function(_0x6a5fcc){logger[_0x7529('0x11')]('DeskAccount,\x20%s,\x20%s',_0x4b0f64,_0x6a5fcc);_0x1cb187(_0x6a5fcc);});});}exports[_0x7529('0x16')]=function(_0x5d97e4){var _0x12262d=this;return new Promise(function(_0x55ddcf,_0x3d7ef5){return db[_0x7529('0x17')]['findAll']({'raw':_0x5d97e4[_0x7529('0x18')]?_0x5d97e4[_0x7529('0x18')][_0x7529('0x19')]===undefined?!![]:![]:!![],'where':_0x5d97e4[_0x7529('0x18')]?_0x5d97e4[_0x7529('0x18')][_0x7529('0x1a')]||null:null,'attributes':_0x5d97e4['options']?_0x5d97e4[_0x7529('0x18')][_0x7529('0x1b')]||null:null,'limit':_0x5d97e4[_0x7529('0x18')]?_0x5d97e4[_0x7529('0x18')][_0x7529('0x1c')]||null:null,'include':_0x5d97e4['options']?_0x5d97e4['options'][_0x7529('0x1d')]?_[_0x7529('0x1e')](_0x5d97e4[_0x7529('0x18')]['include'],function(_0x1eed22){return{'model':db[_0x1eed22['model']],'as':_0x1eed22['as'],'attributes':_0x1eed22[_0x7529('0x1b')],'include':_0x1eed22['include']?_[_0x7529('0x1e')](_0x1eed22[_0x7529('0x1d')],function(_0x2ca078){return{'model':db[_0x2ca078[_0x7529('0x1f')]],'as':_0x2ca078['as'],'attributes':_0x2ca078[_0x7529('0x1b')],'include':_0x2ca078['include']?_['map'](_0x2ca078[_0x7529('0x1d')],function(_0x597ecb){return{'model':db[_0x597ecb[_0x7529('0x1f')]],'as':_0x597ecb['as'],'attributes':_0x597ecb[_0x7529('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7529('0xa')](function(_0x284be2){logger[_0x7529('0xb')](_0x7529('0x16'),_0x5d97e4);logger[_0x7529('0xd')](_0x7529('0x16'),_0x5d97e4,JSON[_0x7529('0x10')](_0x284be2));_0x55ddcf(_0x284be2);})[_0x7529('0x15')](function(_0x2994d3){logger[_0x7529('0x11')](_0x7529('0x16'),_0x2994d3['message'],_0x5d97e4);_0x3d7ef5(_0x12262d[_0x7529('0x11')](0x1f4,_0x2994d3['message']));});});};exports[_0x7529('0x20')]=function(_0x45a2ec){var _0x5bb4f9=this;return new Promise(function(_0x1eb027,_0x16d024){return db[_0x7529('0x17')][_0x7529('0x21')]({'raw':_0x45a2ec[_0x7529('0x18')]?_0x45a2ec['options'][_0x7529('0x19')]===undefined?!![]:![]:!![],'where':_0x45a2ec[_0x7529('0x18')]?_0x45a2ec[_0x7529('0x18')][_0x7529('0x1a')]||null:null,'attributes':_0x45a2ec[_0x7529('0x18')]?_0x45a2ec[_0x7529('0x18')][_0x7529('0x1b')]||null:null,'include':_0x45a2ec['options']?_0x45a2ec['options'][_0x7529('0x1d')]?_[_0x7529('0x1e')](_0x45a2ec[_0x7529('0x18')][_0x7529('0x1d')],function(_0x3fad0d){return{'model':db[_0x3fad0d[_0x7529('0x1f')]],'as':_0x3fad0d['as'],'attributes':_0x3fad0d[_0x7529('0x1b')],'include':_0x3fad0d[_0x7529('0x1d')]?_[_0x7529('0x1e')](_0x3fad0d[_0x7529('0x1d')],function(_0x4dbb10){return{'model':db[_0x4dbb10[_0x7529('0x1f')]],'as':_0x4dbb10['as'],'attributes':_0x4dbb10[_0x7529('0x1b')],'include':_0x4dbb10[_0x7529('0x1d')]?_['map'](_0x4dbb10['include'],function(_0x1633b0){return{'model':db[_0x1633b0[_0x7529('0x1f')]],'as':_0x1633b0['as'],'attributes':_0x1633b0[_0x7529('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17ca50){logger[_0x7529('0xb')](_0x7529('0x20'),_0x45a2ec);logger[_0x7529('0xd')](_0x7529('0x20'),_0x45a2ec,JSON['stringify'](_0x17ca50));_0x1eb027(_0x17ca50);})[_0x7529('0x15')](function(_0x47189a){logger['error']('ShowDeskAccount',_0x47189a['message'],_0x45a2ec);_0x16d024(_0x5bb4f9[_0x7529('0x11')](0x1f4,_0x47189a[_0x7529('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bd9da62..adf5acf 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x55ca,0x126));var _0xa55c=function(_0x45bcb1,_0x46cad0){_0x45bcb1=_0x45bcb1-0x0;var _0x4bd6a3=_0x55ca[_0x45bcb1];return _0x4bd6a3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e9d3a,_0x24a218){var _0x17dac8=function(_0x11edaa){while(--_0x11edaa){_0x3e9d3a['push'](_0x3e9d3a['shift']());}};_0x17dac8(++_0x24a218);}(_0x008c,0x188));var _0xc008=function(_0x2e891a,_0xb5a3b5){_0x2e891a=_0x2e891a-0x0;var _0x39f989=_0x008c[_0x2e891a];return _0x39f989;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6d8c2fe..6269630 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 _0xb845=['exports','STRING','sequelize'];(function(_0x14e246,_0x16c4ae){var _0x2e1e90=function(_0x30915e){while(--_0x30915e){_0x14e246['push'](_0x14e246['shift']());}};_0x2e1e90(++_0x16c4ae);}(_0xb845,0x104));var _0x5b84=function(_0x3ff893,_0x53e2bd){_0x3ff893=_0x3ff893-0x0;var _0x246d70=_0xb845[_0x3ff893];return _0x246d70;};'use strict';var Sequelize=require(_0x5b84('0x0'));module[_0x5b84('0x1')]={'name':{'type':Sequelize[_0x5b84('0x2')]},'description':{'type':Sequelize[_0x5b84('0x2')]}}; \ No newline at end of file +var _0x4419=['STRING'];(function(_0x47e0a1,_0x3f3a3e){var _0x3cdf39=function(_0x4b0668){while(--_0x4b0668){_0x47e0a1['push'](_0x47e0a1['shift']());}};_0x3cdf39(++_0x3f3a3e);}(_0x4419,0xb9));var _0x9441=function(_0xb0ea2c,_0x3bfb90){_0xb0ea2c=_0xb0ea2c-0x0;var _0x4c316d=_0x4419[_0xb0ea2c];return _0x4c316d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9441('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1959b66..e0cc2c4 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 _0x04a6=['findAll','show','params','create','body','catch','update','find','findOne','DeskField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','rawAttributes','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','DeskConfiguration','includeAll','include'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x04a6,0x15a));var _0x604a=function(_0x499cc3,_0x29d74b){_0x499cc3=_0x499cc3-0x0;var _0x3a043d=_0x04a6[_0x499cc3];return _0x3a043d;};'use strict';var emlformat=require(_0x604a('0x0'));var rimraf=require(_0x604a('0x1'));var zipdir=require(_0x604a('0x2'));var jsonpatch=require(_0x604a('0x3'));var rp=require(_0x604a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x604a('0x5'));var path=require(_0x604a('0x6'));var sox=require(_0x604a('0x7'));var csv=require(_0x604a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x604a('0x9'));var _=require(_0x604a('0xa'));var squel=require('squel');var crypto=require(_0x604a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x604a('0xc'));var toCsv=require(_0x604a('0x8'));var querystring=require(_0x604a('0xd'));var Papa=require(_0x604a('0xe'));var Redis=require(_0x604a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x604a('0x10'));var as=require(_0x604a('0x11'));var hardwareService=require(_0x604a('0x12'));var logger=require(_0x604a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x604a('0x14'));var db=require(_0x604a('0x15'))['db'];function respondWithStatusCode(_0x26775a,_0x2a0a3e){_0x2a0a3e=_0x2a0a3e||0xcc;return function(_0x887c09){if(_0x887c09){return _0x26775a[_0x604a('0x16')](_0x2a0a3e);}return _0x26775a[_0x604a('0x17')](_0x2a0a3e)[_0x604a('0x18')]();};}function respondWithResult(_0x13db58,_0x1b4989){_0x1b4989=_0x1b4989||0xc8;return function(_0x2714b6){if(_0x2714b6){return _0x13db58['status'](_0x1b4989)[_0x604a('0x19')](_0x2714b6);}};}function respondWithFilteredResult(_0x4502c2,_0x26a1fa){return function(_0x154184){if(_0x154184){var _0x5acdf3=typeof _0x26a1fa[_0x604a('0x1a')]==='undefined'&&typeof _0x26a1fa[_0x604a('0x1b')]===_0x604a('0x1c');var _0x2a13c8=_0x154184[_0x604a('0x1d')];var _0x4d3a4f=_0x5acdf3?0x0:_0x26a1fa[_0x604a('0x1a')];var _0x574562=_0x5acdf3?_0x154184[_0x604a('0x1d')]:_0x26a1fa[_0x604a('0x1a')]+_0x26a1fa[_0x604a('0x1b')];var _0x189653;if(_0x574562>=_0x2a13c8){_0x574562=_0x2a13c8;_0x189653=0xc8;}else{_0x189653=0xce;}_0x4502c2[_0x604a('0x17')](_0x189653);return _0x4502c2[_0x604a('0x1e')](_0x604a('0x1f'),_0x4d3a4f+'-'+_0x574562+'/'+_0x2a13c8)[_0x604a('0x19')](_0x154184);}return null;};}function patchUpdates(_0x298b5e){return function(_0x381091){try{jsonpatch[_0x604a('0x20')](_0x381091,_0x298b5e,!![]);}catch(_0x4a89c4){return BPromise[_0x604a('0x21')](_0x4a89c4);}return _0x381091[_0x604a('0x22')]();};}function saveUpdates(_0x4d9d85,_0x2165ea){return function(_0x431e2d){if(_0x431e2d){return _0x431e2d['update'](_0x4d9d85)['then'](function(_0x72c940){return _0x72c940;});}return null;};}function removeEntity(_0x496464,_0x52b713){return function(_0x46f640){if(_0x46f640){return _0x46f640[_0x604a('0x23')]()[_0x604a('0x24')](function(){_0x496464[_0x604a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310c6f,_0x39fb08){return function(_0x4336f3){if(!_0x4336f3){_0x310c6f[_0x604a('0x16')](0x194);}return _0x4336f3;};}function handleError(_0x20f06f,_0x3f995f){_0x3f995f=_0x3f995f||0x1f4;return function(_0x5d8474){logger[_0x604a('0x25')](_0x5d8474[_0x604a('0x26')]);if(_0x5d8474[_0x604a('0x27')]){delete _0x5d8474[_0x604a('0x27')];}_0x20f06f[_0x604a('0x17')](_0x3f995f)[_0x604a('0x28')](_0x5d8474);};}exports['index']=function(_0x5a3b08,_0x2ca8b2){var _0x339e39={},_0x3f5780={},_0x300347={'count':0x0,'rows':[]};var _0x11c836=_['map'](db['DeskConfiguration'][_0x604a('0x29')],function(_0x3a24ff){return{'name':_0x3a24ff['fieldName'],'type':_0x3a24ff['type'][_0x604a('0x2a')]};});_0x3f5780['model']=_[_0x604a('0x2b')](_0x11c836,_0x604a('0x27'));_0x3f5780[_0x604a('0x2c')]=_[_0x604a('0x2d')](_0x5a3b08[_0x604a('0x2c')]);_0x3f5780[_0x604a('0x2e')]=_[_0x604a('0x2f')](_0x3f5780['model'],_0x3f5780[_0x604a('0x2c')]);_0x339e39['attributes']=_['intersection'](_0x3f5780[_0x604a('0x30')],qs[_0x604a('0x31')](_0x5a3b08['query'][_0x604a('0x31')]));_0x339e39[_0x604a('0x32')]=_0x339e39[_0x604a('0x32')][_0x604a('0x33')]?_0x339e39[_0x604a('0x32')]:_0x3f5780[_0x604a('0x30')];if(!_0x5a3b08[_0x604a('0x2c')]['hasOwnProperty'](_0x604a('0x34'))){_0x339e39['limit']=qs[_0x604a('0x1b')](_0x5a3b08[_0x604a('0x2c')][_0x604a('0x1b')]);_0x339e39['offset']=qs['offset'](_0x5a3b08[_0x604a('0x2c')][_0x604a('0x1a')]);}_0x339e39['order']=qs['sort'](_0x5a3b08[_0x604a('0x2c')][_0x604a('0x35')]);_0x339e39[_0x604a('0x36')]=qs[_0x604a('0x2e')](_[_0x604a('0x37')](_0x5a3b08[_0x604a('0x2c')],_0x3f5780[_0x604a('0x2e')]),_0x11c836);if(_0x5a3b08[_0x604a('0x2c')][_0x604a('0x38')]){_0x339e39[_0x604a('0x36')]=_[_0x604a('0x39')](_0x339e39[_0x604a('0x36')],{'$or':_[_0x604a('0x2b')](_0x11c836,function(_0x36106e){if(_0x36106e[_0x604a('0x3a')]!==_0x604a('0x3b')){var _0x561ce9={};_0x561ce9[_0x36106e[_0x604a('0x27')]]={'$like':'%'+_0x5a3b08[_0x604a('0x2c')][_0x604a('0x38')]+'%'};return _0x561ce9;}})});}_0x339e39=_[_0x604a('0x39')]({},_0x339e39,_0x5a3b08[_0x604a('0x3c')]);var _0x1a8c31={'where':_0x339e39[_0x604a('0x36')]};return db[_0x604a('0x3d')][_0x604a('0x1d')](_0x1a8c31)[_0x604a('0x24')](function(_0x227c8d){_0x300347[_0x604a('0x1d')]=_0x227c8d;if(_0x5a3b08[_0x604a('0x2c')][_0x604a('0x3e')]){_0x339e39[_0x604a('0x3f')]=[{'all':!![]}];}return db[_0x604a('0x3d')][_0x604a('0x40')](_0x339e39);})[_0x604a('0x24')](function(_0x38a4d9){_0x300347['rows']=_0x38a4d9;return _0x300347;})[_0x604a('0x24')](respondWithFilteredResult(_0x2ca8b2,_0x339e39))['catch'](handleError(_0x2ca8b2,null));};exports[_0x604a('0x41')]=function(_0x2c398a,_0x3ea5a3){var _0x42f156={'raw':![],'where':{'id':_0x2c398a[_0x604a('0x42')]['id']}},_0x20a879={};_0x20a879['model']=_[_0x604a('0x2d')](db['DeskConfiguration'][_0x604a('0x29')]);_0x20a879[_0x604a('0x2c')]=_['keys'](_0x2c398a[_0x604a('0x2c')]);_0x20a879[_0x604a('0x2e')]=_[_0x604a('0x2f')](_0x20a879[_0x604a('0x30')],_0x20a879[_0x604a('0x2c')]);_0x42f156[_0x604a('0x32')]=_[_0x604a('0x2f')](_0x20a879[_0x604a('0x30')],qs[_0x604a('0x31')](_0x2c398a['query'][_0x604a('0x31')]));_0x42f156[_0x604a('0x32')]=_0x42f156[_0x604a('0x32')][_0x604a('0x33')]?_0x42f156['attributes']:_0x20a879[_0x604a('0x30')];if(_0x2c398a[_0x604a('0x2c')][_0x604a('0x3e')]){_0x42f156[_0x604a('0x3f')]=[{'all':!![]}];}_0x42f156=_[_0x604a('0x39')]({},_0x42f156,_0x2c398a[_0x604a('0x3c')]);return db[_0x604a('0x3d')]['find'](_0x42f156)['then'](handleEntityNotFound(_0x3ea5a3,null))['then'](respondWithResult(_0x3ea5a3,null))['catch'](handleError(_0x3ea5a3,null));};exports[_0x604a('0x43')]=function(_0x521067,_0x152fcc){return db[_0x604a('0x3d')]['create'](_0x521067[_0x604a('0x44')],{})[_0x604a('0x24')](respondWithResult(_0x152fcc,0xc9))[_0x604a('0x45')](handleError(_0x152fcc,null));};exports[_0x604a('0x46')]=function(_0x5e8b26,_0x5033a3){if(_0x5e8b26[_0x604a('0x44')]['id']){delete _0x5e8b26['body']['id'];}return db[_0x604a('0x3d')][_0x604a('0x47')]({'where':{'id':_0x5e8b26[_0x604a('0x42')]['id']}})['then'](handleEntityNotFound(_0x5033a3,null))[_0x604a('0x24')](saveUpdates(_0x5e8b26[_0x604a('0x44')],null))['then'](respondWithResult(_0x5033a3,null))[_0x604a('0x45')](handleError(_0x5033a3,null));};exports[_0x604a('0x23')]=function(_0x4e27cf,_0x23827e){return db[_0x604a('0x3d')][_0x604a('0x47')]({'where':{'id':_0x4e27cf[_0x604a('0x42')]['id']}})[_0x604a('0x24')](handleEntityNotFound(_0x23827e,null))[_0x604a('0x24')](removeEntity(_0x23827e,null))['catch'](handleError(_0x23827e,null));};exports['getFields']=function(_0x8c80e,_0x1c6acd,_0x1bae3e){var _0x903d22={};var _0x29df94={};var _0xa7de8;var _0x13ad72;return db[_0x604a('0x3d')][_0x604a('0x48')]({'where':{'id':_0x8c80e[_0x604a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c6acd,null))[_0x604a('0x24')](function(_0x54a319){if(_0x54a319){_0xa7de8=_0x54a319;_0x29df94[_0x604a('0x30')]=_[_0x604a('0x2d')](db[_0x604a('0x49')]['rawAttributes']);_0x29df94[_0x604a('0x2c')]=_[_0x604a('0x2d')](_0x8c80e[_0x604a('0x2c')]);_0x29df94[_0x604a('0x2e')]=_[_0x604a('0x2f')](_0x29df94[_0x604a('0x30')],_0x29df94['query']);_0x903d22[_0x604a('0x32')]=_[_0x604a('0x2f')](_0x29df94[_0x604a('0x30')],qs[_0x604a('0x31')](_0x8c80e[_0x604a('0x2c')][_0x604a('0x31')]));_0x903d22['attributes']=_0x903d22[_0x604a('0x32')][_0x604a('0x33')]?_0x903d22['attributes']:_0x29df94[_0x604a('0x30')];_0x903d22[_0x604a('0x4a')]=qs[_0x604a('0x35')](_0x8c80e[_0x604a('0x2c')][_0x604a('0x35')]);_0x903d22[_0x604a('0x36')]=qs[_0x604a('0x2e')](_[_0x604a('0x37')](_0x8c80e[_0x604a('0x2c')],_0x29df94[_0x604a('0x2e')]));if(_0x8c80e[_0x604a('0x2c')][_0x604a('0x38')]){_0x903d22['where']=_[_0x604a('0x39')](_0x903d22['where'],{'$or':_['map'](_0x903d22[_0x604a('0x32')],function(_0x368a85){var _0x3e9ea2={};_0x3e9ea2[_0x368a85]={'$like':'%'+_0x8c80e[_0x604a('0x2c')]['filter']+'%'};return _0x3e9ea2;})});}_0x903d22=_[_0x604a('0x39')]({},_0x903d22,_0x8c80e[_0x604a('0x3c')]);return _0xa7de8[_0x604a('0x4b')](_0x903d22);}})[_0x604a('0x24')](function(_0x47d68c){if(_0x47d68c){_0x13ad72=_0x47d68c[_0x604a('0x33')];if(!_0x8c80e[_0x604a('0x2c')][_0x604a('0x4c')](_0x604a('0x34'))){_0x903d22[_0x604a('0x1b')]=qs[_0x604a('0x1b')](_0x8c80e[_0x604a('0x2c')]['limit']);_0x903d22[_0x604a('0x1a')]=qs['offset'](_0x8c80e[_0x604a('0x2c')]['offset']);}return _0xa7de8['getFields'](_0x903d22);}})[_0x604a('0x24')](function(_0x214785){if(_0x214785){return _0x214785?{'count':_0x13ad72,'rows':_0x214785}:null;}})[_0x604a('0x24')](respondWithResult(_0x1c6acd,null))[_0x604a('0x45')](handleError(_0x1c6acd,null));};exports[_0x604a('0x4d')]=function(_0x1f172b,_0x5ee2b7,_0x1eb726){var _0x4a9521={};var _0x35f133={};var _0xbb0edd;var _0x2c7e57;return db[_0x604a('0x3d')][_0x604a('0x48')]({'where':{'id':_0x1f172b[_0x604a('0x42')]['id']}})[_0x604a('0x24')](handleEntityNotFound(_0x5ee2b7,null))[_0x604a('0x24')](function(_0x35c178){if(_0x35c178){_0xbb0edd=_0x35c178;_0x35f133['model']=_[_0x604a('0x2d')](db['DeskField'][_0x604a('0x29')]);_0x35f133[_0x604a('0x2c')]=_[_0x604a('0x2d')](_0x1f172b[_0x604a('0x2c')]);_0x35f133[_0x604a('0x2e')]=_[_0x604a('0x2f')](_0x35f133['model'],_0x35f133[_0x604a('0x2c')]);_0x4a9521[_0x604a('0x32')]=_[_0x604a('0x2f')](_0x35f133[_0x604a('0x30')],qs['fields'](_0x1f172b[_0x604a('0x2c')][_0x604a('0x31')]));_0x4a9521[_0x604a('0x32')]=_0x4a9521[_0x604a('0x32')][_0x604a('0x33')]?_0x4a9521[_0x604a('0x32')]:_0x35f133[_0x604a('0x30')];_0x4a9521[_0x604a('0x4a')]=qs['sort'](_0x1f172b['query']['sort']);_0x4a9521['where']=qs[_0x604a('0x2e')](_[_0x604a('0x37')](_0x1f172b[_0x604a('0x2c')],_0x35f133[_0x604a('0x2e')]));if(_0x1f172b['query']['filter']){_0x4a9521[_0x604a('0x36')]=_[_0x604a('0x39')](_0x4a9521['where'],{'$or':_[_0x604a('0x2b')](_0x4a9521['attributes'],function(_0x502788){var _0x456362={};_0x456362[_0x502788]={'$like':'%'+_0x1f172b[_0x604a('0x2c')][_0x604a('0x38')]+'%'};return _0x456362;})});}_0x4a9521=_['merge']({},_0x4a9521,_0x1f172b[_0x604a('0x3c')]);return _0xbb0edd['getSubjects'](_0x4a9521);}})['then'](function(_0x2a8459){if(_0x2a8459){_0x2c7e57=_0x2a8459[_0x604a('0x33')];if(!_0x1f172b['query']['hasOwnProperty']('nolimit')){_0x4a9521[_0x604a('0x1b')]=qs[_0x604a('0x1b')](_0x1f172b[_0x604a('0x2c')]['limit']);_0x4a9521[_0x604a('0x1a')]=qs['offset'](_0x1f172b[_0x604a('0x2c')]['offset']);}return _0xbb0edd[_0x604a('0x4d')](_0x4a9521);}})[_0x604a('0x24')](function(_0x59fd60){if(_0x59fd60){return _0x59fd60?{'count':_0x2c7e57,'rows':_0x59fd60}:null;}})[_0x604a('0x24')](respondWithResult(_0x5ee2b7,null))[_0x604a('0x45')](handleError(_0x5ee2b7,null));};exports[_0x604a('0x4e')]=function(_0x1c24cb,_0x358bcc,_0xfb2040){var _0x5038f5={};var _0x515ae4={};var _0x4596d5;var _0x3c044f;return db[_0x604a('0x3d')][_0x604a('0x48')]({'where':{'id':_0x1c24cb[_0x604a('0x42')]['id']}})['then'](handleEntityNotFound(_0x358bcc,null))[_0x604a('0x24')](function(_0x2c509e){if(_0x2c509e){_0x4596d5=_0x2c509e;_0x515ae4[_0x604a('0x30')]=_[_0x604a('0x2d')](db[_0x604a('0x49')][_0x604a('0x29')]);_0x515ae4[_0x604a('0x2c')]=_['keys'](_0x1c24cb[_0x604a('0x2c')]);_0x515ae4[_0x604a('0x2e')]=_[_0x604a('0x2f')](_0x515ae4[_0x604a('0x30')],_0x515ae4[_0x604a('0x2c')]);_0x5038f5[_0x604a('0x32')]=_[_0x604a('0x2f')](_0x515ae4[_0x604a('0x30')],qs['fields'](_0x1c24cb['query'][_0x604a('0x31')]));_0x5038f5[_0x604a('0x32')]=_0x5038f5[_0x604a('0x32')][_0x604a('0x33')]?_0x5038f5['attributes']:_0x515ae4['model'];_0x5038f5[_0x604a('0x4a')]=qs[_0x604a('0x35')](_0x1c24cb[_0x604a('0x2c')]['sort']);_0x5038f5['where']=qs[_0x604a('0x2e')](_[_0x604a('0x37')](_0x1c24cb['query'],_0x515ae4[_0x604a('0x2e')]));if(_0x1c24cb['query'][_0x604a('0x38')]){_0x5038f5[_0x604a('0x36')]=_['merge'](_0x5038f5[_0x604a('0x36')],{'$or':_['map'](_0x5038f5['attributes'],function(_0xa446a1){var _0x326265={};_0x326265[_0xa446a1]={'$like':'%'+_0x1c24cb['query']['filter']+'%'};return _0x326265;})});}_0x5038f5=_[_0x604a('0x39')]({},_0x5038f5,_0x1c24cb[_0x604a('0x3c')]);return _0x4596d5[_0x604a('0x4e')](_0x5038f5);}})[_0x604a('0x24')](function(_0x4d0faa){if(_0x4d0faa){_0x3c044f=_0x4d0faa[_0x604a('0x33')];if(!_0x1c24cb['query'][_0x604a('0x4c')](_0x604a('0x34'))){_0x5038f5[_0x604a('0x1b')]=qs['limit'](_0x1c24cb[_0x604a('0x2c')][_0x604a('0x1b')]);_0x5038f5[_0x604a('0x1a')]=qs[_0x604a('0x1a')](_0x1c24cb[_0x604a('0x2c')][_0x604a('0x1a')]);}return _0x4596d5[_0x604a('0x4e')](_0x5038f5);}})[_0x604a('0x24')](function(_0x3c4ea9){if(_0x3c4ea9){return _0x3c4ea9?{'count':_0x3c044f,'rows':_0x3c4ea9}:null;}})[_0x604a('0x24')](respondWithResult(_0x358bcc,null))[_0x604a('0x45')](handleError(_0x358bcc,null));};exports[_0x604a('0x4f')]=function(_0x4f5259,_0x275375,_0x34e112){var _0x1da1e7={};var _0x1034ab={};var _0x12eb3b;var _0x2147ab;return db[_0x604a('0x3d')][_0x604a('0x48')]({'where':{'id':_0x4f5259[_0x604a('0x42')]['id']}})[_0x604a('0x24')](handleEntityNotFound(_0x275375,null))[_0x604a('0x24')](function(_0x293715){if(_0x293715){_0x12eb3b=_0x293715;_0x1034ab[_0x604a('0x30')]=_[_0x604a('0x2d')](db[_0x604a('0x50')][_0x604a('0x29')]);_0x1034ab[_0x604a('0x2c')]=_['keys'](_0x4f5259[_0x604a('0x2c')]);_0x1034ab[_0x604a('0x2e')]=_['intersection'](_0x1034ab['model'],_0x1034ab['query']);_0x1da1e7[_0x604a('0x32')]=_[_0x604a('0x2f')](_0x1034ab['model'],qs['fields'](_0x4f5259[_0x604a('0x2c')]['fields']));_0x1da1e7['attributes']=_0x1da1e7[_0x604a('0x32')][_0x604a('0x33')]?_0x1da1e7[_0x604a('0x32')]:_0x1034ab[_0x604a('0x30')];_0x1da1e7[_0x604a('0x4a')]=qs[_0x604a('0x35')](_0x4f5259[_0x604a('0x2c')][_0x604a('0x35')]);_0x1da1e7[_0x604a('0x36')]=qs[_0x604a('0x2e')](_[_0x604a('0x37')](_0x4f5259[_0x604a('0x2c')],_0x1034ab['filters']));if(_0x4f5259['query'][_0x604a('0x38')]){_0x1da1e7[_0x604a('0x36')]=_[_0x604a('0x39')](_0x1da1e7['where'],{'$or':_[_0x604a('0x2b')](_0x1da1e7[_0x604a('0x32')],function(_0x550b79){var _0x4a8540={};_0x4a8540[_0x550b79]={'$like':'%'+_0x4f5259['query'][_0x604a('0x38')]+'%'};return _0x4a8540;})});}_0x1da1e7=_['merge']({},_0x1da1e7,_0x4f5259['options']);return _0x12eb3b[_0x604a('0x4f')](_0x1da1e7);}})['then'](function(_0x5e7243){if(_0x5e7243){_0x2147ab=_0x5e7243[_0x604a('0x33')];if(!_0x4f5259[_0x604a('0x2c')][_0x604a('0x4c')]('nolimit')){_0x1da1e7[_0x604a('0x1b')]=qs['limit'](_0x4f5259[_0x604a('0x2c')][_0x604a('0x1b')]);_0x1da1e7[_0x604a('0x1a')]=qs['offset'](_0x4f5259[_0x604a('0x2c')]['offset']);}return _0x12eb3b['getTags'](_0x1da1e7);}})[_0x604a('0x24')](function(_0x3bbe24){if(_0x3bbe24){return _0x3bbe24?{'count':_0x2147ab,'rows':_0x3bbe24}:null;}})[_0x604a('0x24')](respondWithResult(_0x275375,null))['catch'](handleError(_0x275375,null));};exports['setTags']=function(_0x31768c,_0x3ebcb5,_0x168ce7){if(_0x31768c[_0x604a('0x44')]['id']){delete _0x31768c[_0x604a('0x44')]['id'];}return db['DeskConfiguration'][_0x604a('0x48')]({'where':{'id':_0x31768c[_0x604a('0x42')]['id']}})[_0x604a('0x24')](handleEntityNotFound(_0x3ebcb5,null))['then'](function(_0x131845){if(_0x131845){return _0x131845[_0x604a('0x51')](_0x31768c[_0x604a('0x44')]['ids']||[]);}return null;})[_0x604a('0x24')](respondWithResult(_0x3ebcb5,null))[_0x604a('0x45')](handleError(_0x3ebcb5,null));}; \ No newline at end of file +var _0xeaf9=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','DeskConfiguration','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','findOne','DeskField','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0xeaf9,0x1a0));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9eaf('0x0'));var rimraf=require(_0x9eaf('0x1'));var zipdir=require(_0x9eaf('0x2'));var jsonpatch=require(_0x9eaf('0x3'));var rp=require(_0x9eaf('0x4'));var moment=require(_0x9eaf('0x5'));var BPromise=require(_0x9eaf('0x6'));var Mustache=require(_0x9eaf('0x7'));var util=require('util');var path=require(_0x9eaf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9eaf('0x9'));var fs=require('fs');var fs_extra=require(_0x9eaf('0xa'));var _=require('lodash');var squel=require(_0x9eaf('0xb'));var crypto=require(_0x9eaf('0xc'));var jsforce=require(_0x9eaf('0xd'));var deskjs=require(_0x9eaf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9eaf('0xf'));var Papa=require(_0x9eaf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9eaf('0x11'));var as=require(_0x9eaf('0x12'));var hardwareService=require(_0x9eaf('0x13'));var logger=require(_0x9eaf('0x14'))(_0x9eaf('0x15'));var utils=require(_0x9eaf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9eaf('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7cf3,_0x43bedb){_0x43bedb=_0x43bedb||0xcc;return function(_0xfe59a1){if(_0xfe59a1){return _0x1f7cf3[_0x9eaf('0x18')](_0x43bedb);}return _0x1f7cf3['status'](_0x43bedb)['end']();};}function respondWithResult(_0x5dd372,_0x4b22f8){_0x4b22f8=_0x4b22f8||0xc8;return function(_0x4a1798){if(_0x4a1798){return _0x5dd372['status'](_0x4b22f8)[_0x9eaf('0x19')](_0x4a1798);}};}function respondWithFilteredResult(_0x52226d,_0x1fb62a){return function(_0x25f1d0){if(_0x25f1d0){var _0x334e1f=typeof _0x1fb62a[_0x9eaf('0x1a')]===_0x9eaf('0x1b')&&typeof _0x1fb62a[_0x9eaf('0x1c')]===_0x9eaf('0x1b');var _0x4b4ab2=_0x25f1d0[_0x9eaf('0x1d')];var _0x4b23cd=_0x334e1f?0x0:_0x1fb62a['offset'];var _0x28a34c=_0x334e1f?_0x25f1d0['count']:_0x1fb62a[_0x9eaf('0x1a')]+_0x1fb62a[_0x9eaf('0x1c')];var _0x3d51c1;if(_0x28a34c>=_0x4b4ab2){_0x28a34c=_0x4b4ab2;_0x3d51c1=0xc8;}else{_0x3d51c1=0xce;}_0x52226d[_0x9eaf('0x1e')](_0x3d51c1);return _0x52226d[_0x9eaf('0x1f')](_0x9eaf('0x20'),_0x4b23cd+'-'+_0x28a34c+'/'+_0x4b4ab2)[_0x9eaf('0x19')](_0x25f1d0);}return null;};}function patchUpdates(_0x12cd98){return function(_0x16fb69){try{jsonpatch[_0x9eaf('0x21')](_0x16fb69,_0x12cd98,!![]);}catch(_0x1a0a6a){return BPromise[_0x9eaf('0x22')](_0x1a0a6a);}return _0x16fb69[_0x9eaf('0x23')]();};}function saveUpdates(_0x1735b0,_0x1c9876){return function(_0x4feb10){if(_0x4feb10){return _0x4feb10[_0x9eaf('0x24')](_0x1735b0)[_0x9eaf('0x25')](function(_0x5d3afc){return _0x5d3afc;});}return null;};}function removeEntity(_0x308161,_0x57fbf0){return function(_0x551aa7){if(_0x551aa7){return _0x551aa7[_0x9eaf('0x26')]()[_0x9eaf('0x25')](function(){_0x308161[_0x9eaf('0x1e')](0xcc)[_0x9eaf('0x27')]();});}};}function handleEntityNotFound(_0x41db4d,_0x1e88d7){return function(_0x148091){if(!_0x148091){_0x41db4d['sendStatus'](0x194);}return _0x148091;};}function handleError(_0x3d9c74,_0x3fa86c){_0x3fa86c=_0x3fa86c||0x1f4;return function(_0x336d05){logger[_0x9eaf('0x28')](_0x336d05[_0x9eaf('0x29')]);if(_0x336d05[_0x9eaf('0x2a')]){delete _0x336d05[_0x9eaf('0x2a')];}_0x3d9c74['status'](_0x3fa86c)['send'](_0x336d05);};}exports[_0x9eaf('0x2b')]=function(_0xbd78cd,_0x31cf31){var _0x1ce6bd={},_0x4d126d={},_0x5abdfc={'count':0x0,'rows':[]};var _0x4955a7=_[_0x9eaf('0x2c')](db[_0x9eaf('0x2d')][_0x9eaf('0x2e')],function(_0x227e47){return{'name':_0x227e47['fieldName'],'type':_0x227e47[_0x9eaf('0x2f')][_0x9eaf('0x30')]};});_0x4d126d[_0x9eaf('0x31')]=_[_0x9eaf('0x2c')](_0x4955a7,_0x9eaf('0x2a'));_0x4d126d['query']=_['keys'](_0xbd78cd[_0x9eaf('0x32')]);_0x4d126d['filters']=_[_0x9eaf('0x33')](_0x4d126d[_0x9eaf('0x31')],_0x4d126d['query']);_0x1ce6bd[_0x9eaf('0x34')]=_['intersection'](_0x4d126d[_0x9eaf('0x31')],qs[_0x9eaf('0x35')](_0xbd78cd[_0x9eaf('0x32')]['fields']));_0x1ce6bd[_0x9eaf('0x34')]=_0x1ce6bd[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x1ce6bd[_0x9eaf('0x34')]:_0x4d126d[_0x9eaf('0x31')];if(!_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x37')](_0x9eaf('0x38'))){_0x1ce6bd['limit']=qs[_0x9eaf('0x1c')](_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x1c')]);_0x1ce6bd['offset']=qs[_0x9eaf('0x1a')](_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x1a')]);}_0x1ce6bd[_0x9eaf('0x39')]=qs[_0x9eaf('0x3a')](_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x1ce6bd['where']=qs[_0x9eaf('0x3b')](_[_0x9eaf('0x3c')](_0xbd78cd[_0x9eaf('0x32')],_0x4d126d['filters']),_0x4955a7);if(_0xbd78cd['query']['filter']){_0x1ce6bd[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x1ce6bd[_0x9eaf('0x3d')],{'$or':_['map'](_0x4955a7,function(_0x5af3a7){if(_0x5af3a7[_0x9eaf('0x2f')]!==_0x9eaf('0x3f')){var _0x3b467c={};_0x3b467c[_0x5af3a7[_0x9eaf('0x2a')]]={'$like':'%'+_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x40')]+'%'};return _0x3b467c;}})});}_0x1ce6bd=_[_0x9eaf('0x3e')]({},_0x1ce6bd,_0xbd78cd[_0x9eaf('0x41')]);var _0x351e8c={'where':_0x1ce6bd[_0x9eaf('0x3d')]};return db['DeskConfiguration'][_0x9eaf('0x1d')](_0x351e8c)[_0x9eaf('0x25')](function(_0x452e90){_0x5abdfc[_0x9eaf('0x1d')]=_0x452e90;if(_0xbd78cd[_0x9eaf('0x32')][_0x9eaf('0x42')]){_0x1ce6bd[_0x9eaf('0x43')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9eaf('0x44')](_0x1ce6bd);})[_0x9eaf('0x25')](function(_0x561a3f){_0x5abdfc['rows']=_0x561a3f;return _0x5abdfc;})[_0x9eaf('0x25')](respondWithFilteredResult(_0x31cf31,_0x1ce6bd))[_0x9eaf('0x45')](handleError(_0x31cf31,null));};exports[_0x9eaf('0x46')]=function(_0x3339a0,_0x1d5a32){var _0x5aff7a={'raw':![],'where':{'id':_0x3339a0[_0x9eaf('0x47')]['id']}},_0x704cd8={};_0x704cd8[_0x9eaf('0x31')]=_[_0x9eaf('0x48')](db[_0x9eaf('0x2d')][_0x9eaf('0x2e')]);_0x704cd8[_0x9eaf('0x32')]=_[_0x9eaf('0x48')](_0x3339a0['query']);_0x704cd8[_0x9eaf('0x3b')]=_['intersection'](_0x704cd8[_0x9eaf('0x31')],_0x704cd8[_0x9eaf('0x32')]);_0x5aff7a[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x704cd8['model'],qs['fields'](_0x3339a0[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x5aff7a['attributes']=_0x5aff7a[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x5aff7a['attributes']:_0x704cd8[_0x9eaf('0x31')];if(_0x3339a0[_0x9eaf('0x32')][_0x9eaf('0x42')]){_0x5aff7a[_0x9eaf('0x43')]=[{'all':!![]}];}_0x5aff7a=_[_0x9eaf('0x3e')]({},_0x5aff7a,_0x3339a0[_0x9eaf('0x41')]);return db['DeskConfiguration']['find'](_0x5aff7a)[_0x9eaf('0x25')](handleEntityNotFound(_0x1d5a32,null))[_0x9eaf('0x25')](respondWithResult(_0x1d5a32,null))[_0x9eaf('0x45')](handleError(_0x1d5a32,null));};exports['create']=function(_0xb55f8e,_0x41cbf2){return db['DeskConfiguration'][_0x9eaf('0x49')](_0xb55f8e[_0x9eaf('0x4a')],{})[_0x9eaf('0x25')](respondWithResult(_0x41cbf2,0xc9))[_0x9eaf('0x45')](handleError(_0x41cbf2,null));};exports[_0x9eaf('0x24')]=function(_0x1b4dc6,_0x23616b){if(_0x1b4dc6[_0x9eaf('0x4a')]['id']){delete _0x1b4dc6[_0x9eaf('0x4a')]['id'];}return db['DeskConfiguration'][_0x9eaf('0x4b')]({'where':{'id':_0x1b4dc6[_0x9eaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x23616b,null))[_0x9eaf('0x25')](saveUpdates(_0x1b4dc6[_0x9eaf('0x4a')],null))[_0x9eaf('0x25')](respondWithResult(_0x23616b,null))[_0x9eaf('0x45')](handleError(_0x23616b,null));};exports[_0x9eaf('0x26')]=function(_0x25ce42,_0x298965){return db['DeskConfiguration'][_0x9eaf('0x4b')]({'where':{'id':_0x25ce42['params']['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x298965,null))[_0x9eaf('0x25')](removeEntity(_0x298965,null))[_0x9eaf('0x45')](handleError(_0x298965,null));};exports['getFields']=function(_0x557018,_0x383757,_0x5c12e8){var _0x2f5797={};var _0x3d6e72={};var _0x532df2;var _0x4e72e2;return db[_0x9eaf('0x2d')][_0x9eaf('0x4c')]({'where':{'id':_0x557018[_0x9eaf('0x47')]['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x383757,null))[_0x9eaf('0x25')](function(_0x430fc4){if(_0x430fc4){_0x532df2=_0x430fc4;_0x3d6e72['model']=_[_0x9eaf('0x48')](db[_0x9eaf('0x4d')][_0x9eaf('0x2e')]);_0x3d6e72[_0x9eaf('0x32')]=_[_0x9eaf('0x48')](_0x557018[_0x9eaf('0x32')]);_0x3d6e72['filters']=_[_0x9eaf('0x33')](_0x3d6e72[_0x9eaf('0x31')],_0x3d6e72[_0x9eaf('0x32')]);_0x2f5797[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x3d6e72[_0x9eaf('0x31')],qs['fields'](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x2f5797[_0x9eaf('0x34')]=_0x2f5797[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x2f5797[_0x9eaf('0x34')]:_0x3d6e72[_0x9eaf('0x31')];_0x2f5797['order']=qs[_0x9eaf('0x3a')](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x2f5797[_0x9eaf('0x3d')]=qs[_0x9eaf('0x3b')](_[_0x9eaf('0x3c')](_0x557018[_0x9eaf('0x32')],_0x3d6e72[_0x9eaf('0x3b')]));if(_0x557018[_0x9eaf('0x32')][_0x9eaf('0x40')]){_0x2f5797[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x2f5797[_0x9eaf('0x3d')],{'$or':_[_0x9eaf('0x2c')](_0x2f5797[_0x9eaf('0x34')],function(_0x334cf1){var _0x400eeb={};_0x400eeb[_0x334cf1]={'$like':'%'+_0x557018['query'][_0x9eaf('0x40')]+'%'};return _0x400eeb;})});}_0x2f5797=_[_0x9eaf('0x3e')]({},_0x2f5797,_0x557018['options']);return _0x532df2[_0x9eaf('0x4e')](_0x2f5797);}})[_0x9eaf('0x25')](function(_0x401aa3){if(_0x401aa3){_0x4e72e2=_0x401aa3[_0x9eaf('0x36')];if(!_0x557018[_0x9eaf('0x32')][_0x9eaf('0x37')](_0x9eaf('0x38'))){_0x2f5797['limit']=qs[_0x9eaf('0x1c')](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x1c')]);_0x2f5797[_0x9eaf('0x1a')]=qs[_0x9eaf('0x1a')](_0x557018[_0x9eaf('0x32')][_0x9eaf('0x1a')]);}return _0x532df2[_0x9eaf('0x4e')](_0x2f5797);}})[_0x9eaf('0x25')](function(_0x118714){if(_0x118714){return _0x118714?{'count':_0x4e72e2,'rows':_0x118714}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x383757,null))[_0x9eaf('0x45')](handleError(_0x383757,null));};exports['getSubjects']=function(_0x3c56ed,_0x12ccf4,_0x5cc972){var _0x26e7cb={};var _0x2bfd25={};var _0x1e5241;var _0x3e2358;return db[_0x9eaf('0x2d')][_0x9eaf('0x4c')]({'where':{'id':_0x3c56ed[_0x9eaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x12ccf4,null))[_0x9eaf('0x25')](function(_0x3a7b9a){if(_0x3a7b9a){_0x1e5241=_0x3a7b9a;_0x2bfd25['model']=_[_0x9eaf('0x48')](db[_0x9eaf('0x4d')][_0x9eaf('0x2e')]);_0x2bfd25['query']=_[_0x9eaf('0x48')](_0x3c56ed[_0x9eaf('0x32')]);_0x2bfd25['filters']=_[_0x9eaf('0x33')](_0x2bfd25[_0x9eaf('0x31')],_0x2bfd25[_0x9eaf('0x32')]);_0x26e7cb[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x2bfd25[_0x9eaf('0x31')],qs['fields'](_0x3c56ed[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x26e7cb[_0x9eaf('0x34')]=_0x26e7cb[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x26e7cb[_0x9eaf('0x34')]:_0x2bfd25[_0x9eaf('0x31')];_0x26e7cb[_0x9eaf('0x39')]=qs['sort'](_0x3c56ed[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x26e7cb[_0x9eaf('0x3d')]=qs['filters'](_['pick'](_0x3c56ed[_0x9eaf('0x32')],_0x2bfd25['filters']));if(_0x3c56ed['query']['filter']){_0x26e7cb[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x26e7cb[_0x9eaf('0x3d')],{'$or':_['map'](_0x26e7cb[_0x9eaf('0x34')],function(_0x58700d){var _0x4edbce={};_0x4edbce[_0x58700d]={'$like':'%'+_0x3c56ed[_0x9eaf('0x32')]['filter']+'%'};return _0x4edbce;})});}_0x26e7cb=_[_0x9eaf('0x3e')]({},_0x26e7cb,_0x3c56ed[_0x9eaf('0x41')]);return _0x1e5241[_0x9eaf('0x4f')](_0x26e7cb);}})[_0x9eaf('0x25')](function(_0x23c698){if(_0x23c698){_0x3e2358=_0x23c698[_0x9eaf('0x36')];if(!_0x3c56ed[_0x9eaf('0x32')]['hasOwnProperty'](_0x9eaf('0x38'))){_0x26e7cb[_0x9eaf('0x1c')]=qs[_0x9eaf('0x1c')](_0x3c56ed['query'][_0x9eaf('0x1c')]);_0x26e7cb[_0x9eaf('0x1a')]=qs['offset'](_0x3c56ed[_0x9eaf('0x32')]['offset']);}return _0x1e5241[_0x9eaf('0x4f')](_0x26e7cb);}})[_0x9eaf('0x25')](function(_0x386904){if(_0x386904){return _0x386904?{'count':_0x3e2358,'rows':_0x386904}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x12ccf4,null))[_0x9eaf('0x45')](handleError(_0x12ccf4,null));};exports[_0x9eaf('0x50')]=function(_0x3177f4,_0x5d447b,_0x3b1cdf){var _0x2f3f33={};var _0x4ba802={};var _0xe228ff;var _0x15f5d9;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3177f4[_0x9eaf('0x47')]['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x5d447b,null))[_0x9eaf('0x25')](function(_0x14cefc){if(_0x14cefc){_0xe228ff=_0x14cefc;_0x4ba802[_0x9eaf('0x31')]=_[_0x9eaf('0x48')](db[_0x9eaf('0x4d')][_0x9eaf('0x2e')]);_0x4ba802[_0x9eaf('0x32')]=_[_0x9eaf('0x48')](_0x3177f4[_0x9eaf('0x32')]);_0x4ba802[_0x9eaf('0x3b')]=_[_0x9eaf('0x33')](_0x4ba802['model'],_0x4ba802[_0x9eaf('0x32')]);_0x2f3f33[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x4ba802[_0x9eaf('0x31')],qs[_0x9eaf('0x35')](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x2f3f33['attributes']=_0x2f3f33[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x2f3f33[_0x9eaf('0x34')]:_0x4ba802[_0x9eaf('0x31')];_0x2f3f33[_0x9eaf('0x39')]=qs[_0x9eaf('0x3a')](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x2f3f33[_0x9eaf('0x3d')]=qs[_0x9eaf('0x3b')](_['pick'](_0x3177f4[_0x9eaf('0x32')],_0x4ba802['filters']));if(_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x40')]){_0x2f3f33[_0x9eaf('0x3d')]=_['merge'](_0x2f3f33[_0x9eaf('0x3d')],{'$or':_['map'](_0x2f3f33[_0x9eaf('0x34')],function(_0x50928c){var _0x49d05e={};_0x49d05e[_0x50928c]={'$like':'%'+_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x40')]+'%'};return _0x49d05e;})});}_0x2f3f33=_[_0x9eaf('0x3e')]({},_0x2f3f33,_0x3177f4['options']);return _0xe228ff['getDescriptions'](_0x2f3f33);}})[_0x9eaf('0x25')](function(_0x145b91){if(_0x145b91){_0x15f5d9=_0x145b91[_0x9eaf('0x36')];if(!_0x3177f4['query'][_0x9eaf('0x37')]('nolimit')){_0x2f3f33['limit']=qs['limit'](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x1c')]);_0x2f3f33[_0x9eaf('0x1a')]=qs[_0x9eaf('0x1a')](_0x3177f4[_0x9eaf('0x32')][_0x9eaf('0x1a')]);}return _0xe228ff[_0x9eaf('0x50')](_0x2f3f33);}})[_0x9eaf('0x25')](function(_0x1f9ab4){if(_0x1f9ab4){return _0x1f9ab4?{'count':_0x15f5d9,'rows':_0x1f9ab4}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x5d447b,null))[_0x9eaf('0x45')](handleError(_0x5d447b,null));};exports['getTags']=function(_0x20bdd0,_0x11123d,_0x37a4cb){var _0x39b0da={};var _0x7be998={};var _0x4d38a4;var _0x4b698b;return db[_0x9eaf('0x2d')]['findOne']({'where':{'id':_0x20bdd0[_0x9eaf('0x47')]['id']}})[_0x9eaf('0x25')](handleEntityNotFound(_0x11123d,null))[_0x9eaf('0x25')](function(_0x589f6f){if(_0x589f6f){_0x4d38a4=_0x589f6f;_0x7be998[_0x9eaf('0x31')]=_[_0x9eaf('0x48')](db[_0x9eaf('0x51')][_0x9eaf('0x2e')]);_0x7be998['query']=_[_0x9eaf('0x48')](_0x20bdd0[_0x9eaf('0x32')]);_0x7be998['filters']=_[_0x9eaf('0x33')](_0x7be998[_0x9eaf('0x31')],_0x7be998[_0x9eaf('0x32')]);_0x39b0da[_0x9eaf('0x34')]=_[_0x9eaf('0x33')](_0x7be998['model'],qs[_0x9eaf('0x35')](_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x35')]));_0x39b0da['attributes']=_0x39b0da[_0x9eaf('0x34')][_0x9eaf('0x36')]?_0x39b0da['attributes']:_0x7be998[_0x9eaf('0x31')];_0x39b0da['order']=qs[_0x9eaf('0x3a')](_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x3a')]);_0x39b0da[_0x9eaf('0x3d')]=qs['filters'](_[_0x9eaf('0x3c')](_0x20bdd0[_0x9eaf('0x32')],_0x7be998[_0x9eaf('0x3b')]));if(_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x40')]){_0x39b0da[_0x9eaf('0x3d')]=_[_0x9eaf('0x3e')](_0x39b0da[_0x9eaf('0x3d')],{'$or':_[_0x9eaf('0x2c')](_0x39b0da[_0x9eaf('0x34')],function(_0x32ef9f){var _0x5b179e={};_0x5b179e[_0x32ef9f]={'$like':'%'+_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x40')]+'%'};return _0x5b179e;})});}_0x39b0da=_[_0x9eaf('0x3e')]({},_0x39b0da,_0x20bdd0[_0x9eaf('0x41')]);return _0x4d38a4['getTags'](_0x39b0da);}})['then'](function(_0x1b6170){if(_0x1b6170){_0x4b698b=_0x1b6170[_0x9eaf('0x36')];if(!_0x20bdd0[_0x9eaf('0x32')][_0x9eaf('0x37')](_0x9eaf('0x38'))){_0x39b0da[_0x9eaf('0x1c')]=qs[_0x9eaf('0x1c')](_0x20bdd0[_0x9eaf('0x32')]['limit']);_0x39b0da[_0x9eaf('0x1a')]=qs[_0x9eaf('0x1a')](_0x20bdd0[_0x9eaf('0x32')]['offset']);}return _0x4d38a4[_0x9eaf('0x52')](_0x39b0da);}})[_0x9eaf('0x25')](function(_0xd92716){if(_0xd92716){return _0xd92716?{'count':_0x4b698b,'rows':_0xd92716}:null;}})[_0x9eaf('0x25')](respondWithResult(_0x11123d,null))['catch'](handleError(_0x11123d,null));};exports[_0x9eaf('0x53')]=function(_0x219fcb,_0x4737d6,_0x210694){if(_0x219fcb[_0x9eaf('0x4a')]['id']){delete _0x219fcb[_0x9eaf('0x4a')]['id'];}return db[_0x9eaf('0x2d')][_0x9eaf('0x4c')]({'where':{'id':_0x219fcb['params']['id']}})['then'](handleEntityNotFound(_0x4737d6,null))[_0x9eaf('0x25')](function(_0x39e143){if(_0x39e143){return _0x39e143[_0x9eaf('0x53')](_0x219fcb['body'][_0x9eaf('0x54')]||[]);}return null;})[_0x9eaf('0x25')](respondWithResult(_0x4737d6,null))[_0x9eaf('0x45')](handleError(_0x4737d6,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 11472b4..3842685 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 _0x4b5d=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','util','../../config/logger','api','bluebird','request-promise'];(function(_0x326aa7,_0x12dceb){var _0x3955b2=function(_0x1fc290){while(--_0x1fc290){_0x326aa7['push'](_0x326aa7['shift']());}};_0x3955b2(++_0x12dceb);}(_0x4b5d,0x1ab));var _0xd4b5=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x4b5d[_0x2ca2d0];return _0x521c23;};'use strict';var _=require('lodash');var util=require(_0xd4b5('0x0'));var logger=require(_0xd4b5('0x1'))(_0xd4b5('0x2'));var moment=require('moment');var BPromise=require(_0xd4b5('0x3'));var rp=require(_0xd4b5('0x4'));var fs=require('fs');var path=require(_0xd4b5('0x5'));var rimraf=require(_0xd4b5('0x6'));var config=require(_0xd4b5('0x7'));var attributes=require(_0xd4b5('0x8'));module[_0xd4b5('0x9')]=function(_0x28faf2,_0x5b6dda){return _0x28faf2[_0xd4b5('0xa')](_0xd4b5('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x246f=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x41e7cf,_0x268b1b){var _0x312209=function(_0x545003){while(--_0x545003){_0x41e7cf['push'](_0x41e7cf['shift']());}};_0x312209(++_0x268b1b);}(_0x246f,0x1c6));var _0xf246=function(_0x1fdb85,_0x39c0bf){_0x1fdb85=_0x1fdb85-0x0;var _0x58a446=_0x246f[_0x1fdb85];return _0x58a446;};'use strict';var _=require(_0xf246('0x0'));var util=require(_0xf246('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf246('0x2'));var BPromise=require(_0xf246('0x3'));var rp=require(_0xf246('0x4'));var fs=require('fs');var path=require(_0xf246('0x5'));var rimraf=require(_0xf246('0x6'));var config=require(_0xf246('0x7'));var attributes=require(_0xf246('0x8'));module[_0xf246('0x9')]=function(_0x159b9b,_0x3f21e2){return _0x159b9b[_0xf246('0xa')](_0xf246('0xb'),attributes,{'tableName':_0xf246('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 6ef6f39..d51f877 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 _0x5c82=['../../config/environment','jayson/promise','client','http','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25c8('0x0'));var util=require(_0x25c8('0x1'));var moment=require(_0x25c8('0x2'));var BPromise=require(_0x25c8('0x3'));var rs=require(_0x25c8('0x4'));var fs=require('fs');var Redis=require(_0x25c8('0x5'));var db=require(_0x25c8('0x6'))['db'];var utils=require(_0x25c8('0x7'));var logger=require(_0x25c8('0x8'))(_0x25c8('0x9'));var config=require(_0x25c8('0xa'));var jayson=require(_0x25c8('0xb'));var client=jayson[_0x25c8('0xc')][_0x25c8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33f1ba,_0x24d70a,_0x456703){return new BPromise(function(_0x38dc4e,_0x5388af){return client['request'](_0x33f1ba,_0x456703)['then'](function(_0x3195e8){logger['info'](_0x25c8('0xe'),_0x24d70a,_0x25c8('0xf'));logger['debug'](_0x25c8('0x10'),_0x24d70a,'request\x20sent',JSON[_0x25c8('0x11')](_0x3195e8));if(_0x3195e8[_0x25c8('0x12')]){if(_0x3195e8['error']['code']===0x1f4){logger[_0x25c8('0x12')](_0x25c8('0xe'),_0x24d70a,_0x3195e8[_0x25c8('0x12')]['message']);return _0x5388af(_0x3195e8[_0x25c8('0x12')][_0x25c8('0x13')]);}logger[_0x25c8('0x12')](_0x25c8('0xe'),_0x24d70a,_0x3195e8[_0x25c8('0x12')][_0x25c8('0x13')]);return _0x38dc4e(_0x3195e8[_0x25c8('0x12')][_0x25c8('0x13')]);}else{logger[_0x25c8('0x14')](_0x25c8('0xe'),_0x24d70a,_0x25c8('0xf'));_0x38dc4e(_0x3195e8['result']['message']);}})[_0x25c8('0x15')](function(_0x5cecbb){logger[_0x25c8('0x12')](_0x25c8('0xe'),_0x24d70a,_0x5cecbb);_0x5388af(_0x5cecbb);});});} \ No newline at end of file +var _0xccbf=['../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccbf,0x1ef));var _0xfccb=function(_0x2ac8bb,_0x3add43){_0x2ac8bb=_0x2ac8bb-0x0;var _0x526451=_0xccbf[_0x2ac8bb];return _0x526451;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfccb('0x0'));var BPromise=require(_0xfccb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfccb('0x2'));var logger=require(_0xfccb('0x3'))(_0xfccb('0x4'));var config=require(_0xfccb('0x5'));var jayson=require(_0xfccb('0x6'));var client=jayson[_0xfccb('0x7')][_0xfccb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26c7b1,_0xc8c5e4,_0x119afc){return new BPromise(function(_0x5a0fa2,_0x48a3f0){return client[_0xfccb('0x9')](_0x26c7b1,_0x119afc)['then'](function(_0x17a0bb){logger[_0xfccb('0xa')](_0xfccb('0xb'),_0xc8c5e4,_0xfccb('0xc'));logger[_0xfccb('0xd')](_0xfccb('0xe'),_0xc8c5e4,_0xfccb('0xc'),JSON['stringify'](_0x17a0bb));if(_0x17a0bb[_0xfccb('0xf')]){if(_0x17a0bb['error'][_0xfccb('0x10')]===0x1f4){logger[_0xfccb('0xf')](_0xfccb('0xb'),_0xc8c5e4,_0x17a0bb[_0xfccb('0xf')][_0xfccb('0x11')]);return _0x48a3f0(_0x17a0bb['error'][_0xfccb('0x11')]);}logger[_0xfccb('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0xc8c5e4,_0x17a0bb[_0xfccb('0xf')][_0xfccb('0x11')]);return _0x5a0fa2(_0x17a0bb[_0xfccb('0xf')][_0xfccb('0x11')]);}else{logger[_0xfccb('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0xc8c5e4,_0xfccb('0xc'));_0x5a0fa2(_0x17a0bb[_0xfccb('0x12')][_0xfccb('0x11')]);}})[_0xfccb('0x13')](function(_0x56dca0){logger[_0xfccb('0xf')](_0xfccb('0xb'),_0xc8c5e4,_0x56dca0);_0x48a3f0(_0x56dca0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 90c5e52..7d46377 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 _0x6737=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6737,0x11b));var _0x7673=function(_0x22554f,_0x51a1aa){_0x22554f=_0x22554f-0x0;var _0x1bcee5=_0x6737[_0x22554f];return _0x1bcee5;};'use strict';var multer=require(_0x7673('0x0'));var util=require(_0x7673('0x1'));var path=require(_0x7673('0x2'));var timeout=require(_0x7673('0x3'));var express=require('express');var router=express[_0x7673('0x4')]();var fs_extra=require(_0x7673('0x5'));var auth=require(_0x7673('0x6'));var interaction=require(_0x7673('0x7'));var config=require('../../config/environment');var controller=require(_0x7673('0x8'));router[_0x7673('0x9')]('/',auth[_0x7673('0xa')](),controller[_0x7673('0xb')]);router[_0x7673('0x9')](_0x7673('0xc'),auth[_0x7673('0xa')](),controller[_0x7673('0xd')]);router[_0x7673('0xe')]('/',auth[_0x7673('0xa')](),controller[_0x7673('0xf')]);router[_0x7673('0x10')]('/:id',auth[_0x7673('0xa')](),controller[_0x7673('0x11')]);router[_0x7673('0x12')](_0x7673('0xc'),auth[_0x7673('0xa')](),controller[_0x7673('0x13')]);module[_0x7673('0x14')]=router; \ No newline at end of file +var _0x2c79=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index','show'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x2c79,0x66));var _0x92c7=function(_0xb4c49d,_0x2a1140){_0xb4c49d=_0xb4c49d-0x0;var _0x49d235=_0x2c79[_0xb4c49d];return _0x49d235;};'use strict';var multer=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var path=require(_0x92c7('0x2'));var timeout=require(_0x92c7('0x3'));var express=require(_0x92c7('0x4'));var router=express['Router']();var fs_extra=require(_0x92c7('0x5'));var auth=require(_0x92c7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x92c7('0x7'));router[_0x92c7('0x8')]('/',auth[_0x92c7('0x9')](),controller[_0x92c7('0xa')]);router[_0x92c7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x92c7('0xb')]);router[_0x92c7('0xc')]('/',auth[_0x92c7('0x9')](),controller['create']);router[_0x92c7('0xd')](_0x92c7('0xe'),auth[_0x92c7('0x9')](),controller[_0x92c7('0xf')]);router[_0x92c7('0x10')](_0x92c7('0xe'),auth[_0x92c7('0x9')](),controller[_0x92c7('0x11')]);module[_0x92c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index bba1e27..5c96844 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 _0xd706=['variable','customVariable','STRING','sequelize','ENUM','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd706,0x18f));var _0x6d70=function(_0x16891a,_0x946a24){_0x16891a=_0x16891a-0x0;var _0x2a361e=_0xd706[_0x16891a];return _0x2a361e;};'use strict';var Sequelize=require(_0x6d70('0x0'));module['exports']={'type':{'type':Sequelize[_0x6d70('0x1')](_0x6d70('0x2'),_0x6d70('0x3'),_0x6d70('0x4'),'keyValue','picklist'),'defaultValue':_0x6d70('0x2')},'content':{'type':Sequelize[_0x6d70('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6d70('0x1')](_0x6d70('0x2'),_0x6d70('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6d70('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d70('0x5')]}}; \ No newline at end of file +var _0xbe05=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2f8194,_0x50b945){var _0x145a77=function(_0x5ab7b9){while(--_0x5ab7b9){_0x2f8194['push'](_0x2f8194['shift']());}};_0x145a77(++_0x50b945);}(_0xbe05,0x92));var _0x5be0=function(_0x4f4d49,_0x5c8512){_0x4f4d49=_0x4f4d49-0x0;var _0x2813eb=_0xbe05[_0x4f4d49];return _0x2813eb;};'use strict';var Sequelize=require(_0x5be0('0x0'));module[_0x5be0('0x1')]={'type':{'type':Sequelize[_0x5be0('0x2')](_0x5be0('0x3'),_0x5be0('0x4'),_0x5be0('0x5'),_0x5be0('0x6'),_0x5be0('0x7')),'defaultValue':_0x5be0('0x3')},'content':{'type':Sequelize[_0x5be0('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5be0('0x2')](_0x5be0('0x3'),_0x5be0('0x4'),_0x5be0('0x5'))},'keyContent':{'type':Sequelize[_0x5be0('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5be0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5be0('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8e9122e..194a314 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 _0xe581=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','catch','show','intersection','find','create','update','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x2af219,_0x2aba2f){var _0x1b6c44=function(_0x59bcb3){while(--_0x59bcb3){_0x2af219['push'](_0x2af219['shift']());}};_0x1b6c44(++_0x2aba2f);}(_0xe581,0x80));var _0x1e58=function(_0x4a8490,_0x2ebf91){_0x4a8490=_0x4a8490-0x0;var _0x4a8fbe=_0xe581[_0x4a8490];return _0x4a8fbe;};'use strict';var emlformat=require(_0x1e58('0x0'));var rimraf=require(_0x1e58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e58('0x2'));var rp=require(_0x1e58('0x3'));var moment=require(_0x1e58('0x4'));var BPromise=require(_0x1e58('0x5'));var Mustache=require(_0x1e58('0x6'));var util=require(_0x1e58('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e58('0x8'));var squel=require(_0x1e58('0x9'));var crypto=require(_0x1e58('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1e58('0xb'));var toCsv=require(_0x1e58('0xc'));var querystring=require(_0x1e58('0xd'));var Papa=require('papaparse');var Redis=require(_0x1e58('0xe'));var authService=require(_0x1e58('0xf'));var qs=require(_0x1e58('0x10'));var as=require(_0x1e58('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e58('0x12'))(_0x1e58('0x13'));var utils=require(_0x1e58('0x14'));var config=require(_0x1e58('0x15'));var licenseUtil=require(_0x1e58('0x16'));var db=require(_0x1e58('0x17'))['db'];function respondWithStatusCode(_0x51a119,_0x10d9ab){_0x10d9ab=_0x10d9ab||0xcc;return function(_0x45de32){if(_0x45de32){return _0x51a119[_0x1e58('0x18')](_0x10d9ab);}return _0x51a119[_0x1e58('0x19')](_0x10d9ab)[_0x1e58('0x1a')]();};}function respondWithResult(_0x2346c7,_0x52a763){_0x52a763=_0x52a763||0xc8;return function(_0x5714bd){if(_0x5714bd){return _0x2346c7['status'](_0x52a763)[_0x1e58('0x1b')](_0x5714bd);}};}function respondWithFilteredResult(_0x3d01bc,_0x4e68dd){return function(_0x4b2427){if(_0x4b2427){var _0x39fb73=typeof _0x4e68dd['offset']===_0x1e58('0x1c')&&typeof _0x4e68dd[_0x1e58('0x1d')]==='undefined';var _0x1579c3=_0x4b2427[_0x1e58('0x1e')];var _0x80fa62=_0x39fb73?0x0:_0x4e68dd[_0x1e58('0x1f')];var _0x28b32b=_0x39fb73?_0x4b2427['count']:_0x4e68dd[_0x1e58('0x1f')]+_0x4e68dd[_0x1e58('0x1d')];var _0x1e312d;if(_0x28b32b>=_0x1579c3){_0x28b32b=_0x1579c3;_0x1e312d=0xc8;}else{_0x1e312d=0xce;}_0x3d01bc[_0x1e58('0x19')](_0x1e312d);return _0x3d01bc[_0x1e58('0x20')](_0x1e58('0x21'),_0x80fa62+'-'+_0x28b32b+'/'+_0x1579c3)['json'](_0x4b2427);}return null;};}function patchUpdates(_0x22ca8c){return function(_0x125c00){try{jsonpatch[_0x1e58('0x22')](_0x125c00,_0x22ca8c,!![]);}catch(_0x1ced90){return BPromise[_0x1e58('0x23')](_0x1ced90);}return _0x125c00[_0x1e58('0x24')]();};}function saveUpdates(_0x3525af,_0x1e6738){return function(_0x577201){if(_0x577201){return _0x577201['update'](_0x3525af)[_0x1e58('0x25')](function(_0x123ea1){return _0x123ea1;});}return null;};}function removeEntity(_0x86dddf,_0x559339){return function(_0x37a415){if(_0x37a415){return _0x37a415[_0x1e58('0x26')]()[_0x1e58('0x25')](function(){_0x86dddf['status'](0xcc)[_0x1e58('0x1a')]();});}};}function handleEntityNotFound(_0x1ff274,_0x523c28){return function(_0x5664a3){if(!_0x5664a3){_0x1ff274[_0x1e58('0x18')](0x194);}return _0x5664a3;};}function handleError(_0x1cd579,_0x662abe){_0x662abe=_0x662abe||0x1f4;return function(_0x4770ab){logger[_0x1e58('0x27')](_0x4770ab[_0x1e58('0x28')]);if(_0x4770ab['name']){delete _0x4770ab[_0x1e58('0x29')];}_0x1cd579[_0x1e58('0x19')](_0x662abe)[_0x1e58('0x2a')](_0x4770ab);};}exports[_0x1e58('0x2b')]=function(_0x4cb076,_0x1fa681){var _0x3e9af2={},_0x40478c={},_0x1720c0={'count':0x0,'rows':[]};var _0x228f5b=_[_0x1e58('0x2c')](db['DeskField'][_0x1e58('0x2d')],function(_0x1fa2fc){return{'name':_0x1fa2fc[_0x1e58('0x2e')],'type':_0x1fa2fc[_0x1e58('0x2f')][_0x1e58('0x30')]};});_0x40478c[_0x1e58('0x31')]=_[_0x1e58('0x2c')](_0x228f5b,'name');_0x40478c[_0x1e58('0x32')]=_[_0x1e58('0x33')](_0x4cb076[_0x1e58('0x32')]);_0x40478c[_0x1e58('0x34')]=_['intersection'](_0x40478c[_0x1e58('0x31')],_0x40478c[_0x1e58('0x32')]);_0x3e9af2['attributes']=_['intersection'](_0x40478c[_0x1e58('0x31')],qs['fields'](_0x4cb076[_0x1e58('0x32')][_0x1e58('0x35')]));_0x3e9af2[_0x1e58('0x36')]=_0x3e9af2['attributes'][_0x1e58('0x37')]?_0x3e9af2[_0x1e58('0x36')]:_0x40478c[_0x1e58('0x31')];if(!_0x4cb076[_0x1e58('0x32')][_0x1e58('0x38')](_0x1e58('0x39'))){_0x3e9af2['limit']=qs[_0x1e58('0x1d')](_0x4cb076[_0x1e58('0x32')][_0x1e58('0x1d')]);_0x3e9af2[_0x1e58('0x1f')]=qs[_0x1e58('0x1f')](_0x4cb076['query']['offset']);}_0x3e9af2[_0x1e58('0x3a')]=qs[_0x1e58('0x3b')](_0x4cb076[_0x1e58('0x32')][_0x1e58('0x3b')]);_0x3e9af2[_0x1e58('0x3c')]=qs[_0x1e58('0x34')](_[_0x1e58('0x3d')](_0x4cb076[_0x1e58('0x32')],_0x40478c[_0x1e58('0x34')]),_0x228f5b);if(_0x4cb076['query'][_0x1e58('0x3e')]){_0x3e9af2[_0x1e58('0x3c')]=_[_0x1e58('0x3f')](_0x3e9af2[_0x1e58('0x3c')],{'$or':_[_0x1e58('0x2c')](_0x228f5b,function(_0x1503f3){if(_0x1503f3[_0x1e58('0x2f')]!==_0x1e58('0x40')){var _0x110e21={};_0x110e21[_0x1503f3[_0x1e58('0x29')]]={'$like':'%'+_0x4cb076['query'][_0x1e58('0x3e')]+'%'};return _0x110e21;}})});}_0x3e9af2=_[_0x1e58('0x3f')]({},_0x3e9af2,_0x4cb076[_0x1e58('0x41')]);var _0x2b76fd={'where':_0x3e9af2[_0x1e58('0x3c')]};return db[_0x1e58('0x42')][_0x1e58('0x1e')](_0x2b76fd)['then'](function(_0x2f120a){_0x1720c0[_0x1e58('0x1e')]=_0x2f120a;if(_0x4cb076[_0x1e58('0x32')][_0x1e58('0x43')]){_0x3e9af2[_0x1e58('0x44')]=[{'all':!![]}];}return db[_0x1e58('0x42')][_0x1e58('0x45')](_0x3e9af2);})[_0x1e58('0x25')](function(_0xd97da3){_0x1720c0['rows']=_0xd97da3;return _0x1720c0;})[_0x1e58('0x25')](respondWithFilteredResult(_0x1fa681,_0x3e9af2))[_0x1e58('0x46')](handleError(_0x1fa681,null));};exports[_0x1e58('0x47')]=function(_0x35c9d2,_0x3f991f){var _0x4623cf={'raw':!![],'where':{'id':_0x35c9d2['params']['id']}},_0xe7f0c7={};_0xe7f0c7[_0x1e58('0x31')]=_[_0x1e58('0x33')](db[_0x1e58('0x42')][_0x1e58('0x2d')]);_0xe7f0c7[_0x1e58('0x32')]=_[_0x1e58('0x33')](_0x35c9d2['query']);_0xe7f0c7['filters']=_[_0x1e58('0x48')](_0xe7f0c7['model'],_0xe7f0c7[_0x1e58('0x32')]);_0x4623cf[_0x1e58('0x36')]=_[_0x1e58('0x48')](_0xe7f0c7[_0x1e58('0x31')],qs[_0x1e58('0x35')](_0x35c9d2[_0x1e58('0x32')][_0x1e58('0x35')]));_0x4623cf['attributes']=_0x4623cf[_0x1e58('0x36')][_0x1e58('0x37')]?_0x4623cf['attributes']:_0xe7f0c7[_0x1e58('0x31')];if(_0x35c9d2[_0x1e58('0x32')][_0x1e58('0x43')]){_0x4623cf[_0x1e58('0x44')]=[{'all':!![]}];}_0x4623cf=_[_0x1e58('0x3f')]({},_0x4623cf,_0x35c9d2[_0x1e58('0x41')]);return db[_0x1e58('0x42')][_0x1e58('0x49')](_0x4623cf)[_0x1e58('0x25')](handleEntityNotFound(_0x3f991f,null))[_0x1e58('0x25')](respondWithResult(_0x3f991f,null))[_0x1e58('0x46')](handleError(_0x3f991f,null));};exports[_0x1e58('0x4a')]=function(_0x2770f2,_0x11c0d8){return db['DeskField'][_0x1e58('0x4a')](_0x2770f2['body'],{})[_0x1e58('0x25')](respondWithResult(_0x11c0d8,0xc9))[_0x1e58('0x46')](handleError(_0x11c0d8,null));};exports[_0x1e58('0x4b')]=function(_0x25fb39,_0x543d28){if(_0x25fb39[_0x1e58('0x4c')]['id']){delete _0x25fb39[_0x1e58('0x4c')]['id'];}return db[_0x1e58('0x42')]['find']({'where':{'id':_0x25fb39['params']['id']}})[_0x1e58('0x25')](handleEntityNotFound(_0x543d28,null))[_0x1e58('0x25')](saveUpdates(_0x25fb39['body'],null))[_0x1e58('0x25')](respondWithResult(_0x543d28,null))[_0x1e58('0x46')](handleError(_0x543d28,null));};exports[_0x1e58('0x26')]=function(_0x4410da,_0x54bea2){return db[_0x1e58('0x42')][_0x1e58('0x49')]({'where':{'id':_0x4410da[_0x1e58('0x4d')]['id']}})[_0x1e58('0x25')](handleEntityNotFound(_0x54bea2,null))['then'](removeEntity(_0x54bea2,null))[_0x1e58('0x46')](handleError(_0x54bea2,null));}; \ No newline at end of file +var _0xce27=['DeskField','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','map'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xce27,0xef));var _0x7ce2=function(_0x2ce6b5,_0x11c553){_0x2ce6b5=_0x2ce6b5-0x0;var _0x40875d=_0xce27[_0x2ce6b5];return _0x40875d;};'use strict';var emlformat=require(_0x7ce2('0x0'));var rimraf=require(_0x7ce2('0x1'));var zipdir=require(_0x7ce2('0x2'));var jsonpatch=require(_0x7ce2('0x3'));var rp=require(_0x7ce2('0x4'));var moment=require(_0x7ce2('0x5'));var BPromise=require(_0x7ce2('0x6'));var Mustache=require(_0x7ce2('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7ce2('0x8'));var csv=require(_0x7ce2('0x9'));var ejs=require(_0x7ce2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7ce2('0xb'));var crypto=require(_0x7ce2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7ce2('0xd'));var toCsv=require(_0x7ce2('0x9'));var querystring=require('querystring');var Papa=require(_0x7ce2('0xe'));var Redis=require('ioredis');var authService=require(_0x7ce2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7ce2('0x10'));var hardwareService=require(_0x7ce2('0x11'));var logger=require(_0x7ce2('0x12'))(_0x7ce2('0x13'));var utils=require(_0x7ce2('0x14'));var config=require(_0x7ce2('0x15'));var licenseUtil=require(_0x7ce2('0x16'));var db=require(_0x7ce2('0x17'))['db'];function respondWithStatusCode(_0x386a6d,_0x4c6ec0){_0x4c6ec0=_0x4c6ec0||0xcc;return function(_0x3de14f){if(_0x3de14f){return _0x386a6d['sendStatus'](_0x4c6ec0);}return _0x386a6d[_0x7ce2('0x18')](_0x4c6ec0)[_0x7ce2('0x19')]();};}function respondWithResult(_0x4a0138,_0x12559c){_0x12559c=_0x12559c||0xc8;return function(_0x18787f){if(_0x18787f){return _0x4a0138[_0x7ce2('0x18')](_0x12559c)[_0x7ce2('0x1a')](_0x18787f);}};}function respondWithFilteredResult(_0x1ae16a,_0xe7e65e){return function(_0x422c62){if(_0x422c62){var _0x3a1157=typeof _0xe7e65e[_0x7ce2('0x1b')]===_0x7ce2('0x1c')&&typeof _0xe7e65e[_0x7ce2('0x1d')]===_0x7ce2('0x1c');var _0x162e3b=_0x422c62[_0x7ce2('0x1e')];var _0x232ca2=_0x3a1157?0x0:_0xe7e65e[_0x7ce2('0x1b')];var _0x4466a0=_0x3a1157?_0x422c62[_0x7ce2('0x1e')]:_0xe7e65e[_0x7ce2('0x1b')]+_0xe7e65e['limit'];var _0x70a257;if(_0x4466a0>=_0x162e3b){_0x4466a0=_0x162e3b;_0x70a257=0xc8;}else{_0x70a257=0xce;}_0x1ae16a[_0x7ce2('0x18')](_0x70a257);return _0x1ae16a['set'](_0x7ce2('0x1f'),_0x232ca2+'-'+_0x4466a0+'/'+_0x162e3b)['json'](_0x422c62);}return null;};}function patchUpdates(_0x4fbff3){return function(_0x4e3a6d){try{jsonpatch[_0x7ce2('0x20')](_0x4e3a6d,_0x4fbff3,!![]);}catch(_0x4443e2){return BPromise['reject'](_0x4443e2);}return _0x4e3a6d[_0x7ce2('0x21')]();};}function saveUpdates(_0x2fdfa7,_0x1e5697){return function(_0x187cd0){if(_0x187cd0){return _0x187cd0[_0x7ce2('0x22')](_0x2fdfa7)[_0x7ce2('0x23')](function(_0x1a970a){return _0x1a970a;});}return null;};}function removeEntity(_0x25c67e,_0x685ec){return function(_0x216498){if(_0x216498){return _0x216498[_0x7ce2('0x24')]()[_0x7ce2('0x23')](function(){_0x25c67e['status'](0xcc)[_0x7ce2('0x19')]();});}};}function handleEntityNotFound(_0x14bfe4,_0x3940d3){return function(_0x14d111){if(!_0x14d111){_0x14bfe4[_0x7ce2('0x25')](0x194);}return _0x14d111;};}function handleError(_0x32d853,_0x85b772){_0x85b772=_0x85b772||0x1f4;return function(_0x4375b1){logger['error'](_0x4375b1['stack']);if(_0x4375b1[_0x7ce2('0x26')]){delete _0x4375b1[_0x7ce2('0x26')];}_0x32d853['status'](_0x85b772)[_0x7ce2('0x27')](_0x4375b1);};}exports['index']=function(_0x34a59a,_0x24cf96){var _0x3864ed={},_0x134e4f={},_0x54288c={'count':0x0,'rows':[]};var _0x37c8d2=_[_0x7ce2('0x28')](db[_0x7ce2('0x29')][_0x7ce2('0x2a')],function(_0x211541){return{'name':_0x211541['fieldName'],'type':_0x211541[_0x7ce2('0x2b')][_0x7ce2('0x2c')]};});_0x134e4f['model']=_[_0x7ce2('0x28')](_0x37c8d2,_0x7ce2('0x26'));_0x134e4f[_0x7ce2('0x2d')]=_[_0x7ce2('0x2e')](_0x34a59a[_0x7ce2('0x2d')]);_0x134e4f['filters']=_[_0x7ce2('0x2f')](_0x134e4f['model'],_0x134e4f[_0x7ce2('0x2d')]);_0x3864ed[_0x7ce2('0x30')]=_[_0x7ce2('0x2f')](_0x134e4f['model'],qs['fields'](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x31')]));_0x3864ed['attributes']=_0x3864ed[_0x7ce2('0x30')][_0x7ce2('0x32')]?_0x3864ed[_0x7ce2('0x30')]:_0x134e4f[_0x7ce2('0x33')];if(!_0x34a59a['query'][_0x7ce2('0x34')]('nolimit')){_0x3864ed['limit']=qs[_0x7ce2('0x1d')](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x1d')]);_0x3864ed[_0x7ce2('0x1b')]=qs['offset'](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x1b')]);}_0x3864ed['order']=qs['sort'](_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x35')]);_0x3864ed[_0x7ce2('0x36')]=qs[_0x7ce2('0x37')](_[_0x7ce2('0x38')](_0x34a59a['query'],_0x134e4f['filters']),_0x37c8d2);if(_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x39')]){_0x3864ed[_0x7ce2('0x36')]=_[_0x7ce2('0x3a')](_0x3864ed[_0x7ce2('0x36')],{'$or':_[_0x7ce2('0x28')](_0x37c8d2,function(_0x43c080){if(_0x43c080[_0x7ce2('0x2b')]!==_0x7ce2('0x3b')){var _0x4c98b8={};_0x4c98b8[_0x43c080['name']]={'$like':'%'+_0x34a59a['query'][_0x7ce2('0x39')]+'%'};return _0x4c98b8;}})});}_0x3864ed=_[_0x7ce2('0x3a')]({},_0x3864ed,_0x34a59a['options']);var _0x4dbba5={'where':_0x3864ed[_0x7ce2('0x36')]};return db[_0x7ce2('0x29')][_0x7ce2('0x1e')](_0x4dbba5)[_0x7ce2('0x23')](function(_0x4a3247){_0x54288c[_0x7ce2('0x1e')]=_0x4a3247;if(_0x34a59a[_0x7ce2('0x2d')][_0x7ce2('0x3c')]){_0x3864ed[_0x7ce2('0x3d')]=[{'all':!![]}];}return db[_0x7ce2('0x29')][_0x7ce2('0x3e')](_0x3864ed);})[_0x7ce2('0x23')](function(_0xad22de){_0x54288c[_0x7ce2('0x3f')]=_0xad22de;return _0x54288c;})[_0x7ce2('0x23')](respondWithFilteredResult(_0x24cf96,_0x3864ed))[_0x7ce2('0x40')](handleError(_0x24cf96,null));};exports[_0x7ce2('0x41')]=function(_0x2062f9,_0x4c0553){var _0x219c8c={'raw':!![],'where':{'id':_0x2062f9[_0x7ce2('0x42')]['id']}},_0x3665a6={};_0x3665a6['model']=_[_0x7ce2('0x2e')](db[_0x7ce2('0x29')][_0x7ce2('0x2a')]);_0x3665a6['query']=_[_0x7ce2('0x2e')](_0x2062f9['query']);_0x3665a6['filters']=_[_0x7ce2('0x2f')](_0x3665a6[_0x7ce2('0x33')],_0x3665a6[_0x7ce2('0x2d')]);_0x219c8c['attributes']=_[_0x7ce2('0x2f')](_0x3665a6[_0x7ce2('0x33')],qs[_0x7ce2('0x31')](_0x2062f9['query'][_0x7ce2('0x31')]));_0x219c8c[_0x7ce2('0x30')]=_0x219c8c[_0x7ce2('0x30')][_0x7ce2('0x32')]?_0x219c8c['attributes']:_0x3665a6[_0x7ce2('0x33')];if(_0x2062f9[_0x7ce2('0x2d')][_0x7ce2('0x3c')]){_0x219c8c[_0x7ce2('0x3d')]=[{'all':!![]}];}_0x219c8c=_[_0x7ce2('0x3a')]({},_0x219c8c,_0x2062f9['options']);return db['DeskField'][_0x7ce2('0x43')](_0x219c8c)[_0x7ce2('0x23')](handleEntityNotFound(_0x4c0553,null))[_0x7ce2('0x23')](respondWithResult(_0x4c0553,null))[_0x7ce2('0x40')](handleError(_0x4c0553,null));};exports[_0x7ce2('0x44')]=function(_0xbe581e,_0x5b752f){return db[_0x7ce2('0x29')][_0x7ce2('0x44')](_0xbe581e[_0x7ce2('0x45')],{})[_0x7ce2('0x23')](respondWithResult(_0x5b752f,0xc9))[_0x7ce2('0x40')](handleError(_0x5b752f,null));};exports[_0x7ce2('0x22')]=function(_0x6ea087,_0x323daf){if(_0x6ea087[_0x7ce2('0x45')]['id']){delete _0x6ea087[_0x7ce2('0x45')]['id'];}return db[_0x7ce2('0x29')]['find']({'where':{'id':_0x6ea087[_0x7ce2('0x42')]['id']}})['then'](handleEntityNotFound(_0x323daf,null))[_0x7ce2('0x23')](saveUpdates(_0x6ea087[_0x7ce2('0x45')],null))[_0x7ce2('0x23')](respondWithResult(_0x323daf,null))[_0x7ce2('0x40')](handleError(_0x323daf,null));};exports[_0x7ce2('0x24')]=function(_0x44cca5,_0x19e7a2){return db[_0x7ce2('0x29')][_0x7ce2('0x43')]({'where':{'id':_0x44cca5['params']['id']}})['then'](handleEntityNotFound(_0x19e7a2,null))[_0x7ce2('0x23')](removeEntity(_0x19e7a2,null))['catch'](handleError(_0x19e7a2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index dd7a46c..ef6b53b 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 _0xfdf3=['api','moment','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x413445,_0x131b9e){var _0x7c4bc7=function(_0x3768e7){while(--_0x3768e7){_0x413445['push'](_0x413445['shift']());}};_0x7c4bc7(++_0x131b9e);}(_0xfdf3,0x75));var _0x3fdf=function(_0x578cac,_0x59ea50){_0x578cac=_0x578cac-0x0;var _0x4b6629=_0xfdf3[_0x578cac];return _0x4b6629;};'use strict';var _=require(_0x3fdf('0x0'));var util=require(_0x3fdf('0x1'));var logger=require(_0x3fdf('0x2'))(_0x3fdf('0x3'));var moment=require(_0x3fdf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fdf('0x5'));var rimraf=require(_0x3fdf('0x6'));var config=require('../../config/environment');var attributes=require(_0x3fdf('0x7'));module[_0x3fdf('0x8')]=function(_0x519c9a,_0x4225c9){return _0x519c9a[_0x3fdf('0x9')](_0x3fdf('0xa'),attributes,{'tableName':_0x3fdf('0xb'),'paranoid':![],'indexes':[{'name':_0x3fdf('0xc'),'fields':[_0x3fdf('0xd'),_0x3fdf('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3c3=['request-promise','path','rimraf','../../config/environment','exports','define','desk_unique_index','idField','FieldId','../../config/logger','moment','bluebird'];(function(_0x1c841f,_0x41fbc6){var _0x51024d=function(_0x4d3722){while(--_0x4d3722){_0x1c841f['push'](_0x1c841f['shift']());}};_0x51024d(++_0x41fbc6);}(_0xf3c3,0x105));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f3c('0x0'))('api');var moment=require(_0x3f3c('0x1'));var BPromise=require(_0x3f3c('0x2'));var rp=require(_0x3f3c('0x3'));var fs=require('fs');var path=require(_0x3f3c('0x4'));var rimraf=require(_0x3f3c('0x5'));var config=require(_0x3f3c('0x6'));var attributes=require('./intDeskField.attributes');module[_0x3f3c('0x7')]=function(_0x1f7fac,_0x141a02){return _0x1f7fac[_0x3f3c('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3f3c('0x9'),'fields':[_0x3f3c('0xa'),_0x3f3c('0xb')],'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 1eb0c7b..10e3980 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 _0x8cb0=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8cb0,0xda));var _0x08cb=function(_0x7ae8ef,_0x3fe6e9){_0x7ae8ef=_0x7ae8ef-0x0;var _0x24df40=_0x8cb0[_0x7ae8ef];return _0x24df40;};'use strict';var _=require(_0x08cb('0x0'));var util=require(_0x08cb('0x1'));var moment=require('moment');var BPromise=require(_0x08cb('0x2'));var rs=require(_0x08cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08cb('0x4'))['db'];var utils=require(_0x08cb('0x5'));var logger=require(_0x08cb('0x6'))(_0x08cb('0x7'));var config=require(_0x08cb('0x8'));var jayson=require(_0x08cb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46f7dc,_0xcb141a,_0x5e058c){return new BPromise(function(_0x4aa078,_0x316085){return client[_0x08cb('0xa')](_0x46f7dc,_0x5e058c)['then'](function(_0x154223){logger['info'](_0x08cb('0xb'),_0xcb141a,_0x08cb('0xc'));logger[_0x08cb('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0xcb141a,'request\x20sent',JSON['stringify'](_0x154223));if(_0x154223['error']){if(_0x154223[_0x08cb('0xe')][_0x08cb('0xf')]===0x1f4){logger[_0x08cb('0xe')](_0x08cb('0xb'),_0xcb141a,_0x154223['error'][_0x08cb('0x10')]);return _0x316085(_0x154223[_0x08cb('0xe')][_0x08cb('0x10')]);}logger['error']('DeskField,\x20%s,\x20%s',_0xcb141a,_0x154223[_0x08cb('0xe')][_0x08cb('0x10')]);return _0x4aa078(_0x154223[_0x08cb('0xe')]['message']);}else{logger[_0x08cb('0x11')]('DeskField,\x20%s,\x20%s',_0xcb141a,_0x08cb('0xc'));_0x4aa078(_0x154223[_0x08cb('0x12')]['message']);}})[_0x08cb('0x13')](function(_0x2f7b01){logger[_0x08cb('0xe')](_0x08cb('0xb'),_0xcb141a,_0x2f7b01);_0x316085(_0x2f7b01);});});} \ No newline at end of file +var _0x596b=['rpc','../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x701d0c,_0x4dba94){var _0x240681=function(_0x24e5f1){while(--_0x24e5f1){_0x701d0c['push'](_0x701d0c['shift']());}};_0x240681(++_0x4dba94);}(_0x596b,0xca));var _0xb596=function(_0xc9b768,_0x2117ef){_0xc9b768=_0xc9b768-0x0;var _0x56dfa2=_0x596b[_0xc9b768];return _0x56dfa2;};'use strict';var _=require(_0xb596('0x0'));var util=require(_0xb596('0x1'));var moment=require(_0xb596('0x2'));var BPromise=require(_0xb596('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb596('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb596('0x5'));var logger=require(_0xb596('0x6'))(_0xb596('0x7'));var config=require(_0xb596('0x8'));var jayson=require(_0xb596('0x9'));var client=jayson[_0xb596('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22183a,_0x3f5450,_0x31ce88){return new BPromise(function(_0x5d4142,_0x332095){return client[_0xb596('0xb')](_0x22183a,_0x31ce88)['then'](function(_0x3058bb){logger[_0xb596('0xc')](_0xb596('0xd'),_0x3f5450,_0xb596('0xe'));logger['debug'](_0xb596('0xf'),_0x3f5450,_0xb596('0xe'),JSON['stringify'](_0x3058bb));if(_0x3058bb['error']){if(_0x3058bb[_0xb596('0x10')]['code']===0x1f4){logger['error'](_0xb596('0xd'),_0x3f5450,_0x3058bb[_0xb596('0x10')]['message']);return _0x332095(_0x3058bb[_0xb596('0x10')][_0xb596('0x11')]);}logger[_0xb596('0x10')](_0xb596('0xd'),_0x3f5450,_0x3058bb[_0xb596('0x10')][_0xb596('0x11')]);return _0x5d4142(_0x3058bb[_0xb596('0x10')][_0xb596('0x11')]);}else{logger[_0xb596('0xc')](_0xb596('0xd'),_0x3f5450,'request\x20sent');_0x5d4142(_0x3058bb['result'][_0xb596('0x11')]);}})[_0xb596('0x12')](function(_0x4af3b3){logger[_0xb596('0x10')]('DeskField,\x20%s,\x20%s',_0x3f5450,_0x4af3b3);_0x332095(_0x4af3b3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 729d2e8..08739c1 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 _0x6e8a=['get','/:id','show','/:id/configurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated'];(function(_0x5b2e99,_0x588f90){var _0x2a2d31=function(_0x2d0a5c){while(--_0x2d0a5c){_0x5b2e99['push'](_0x5b2e99['shift']());}};_0x2a2d31(++_0x588f90);}(_0x6e8a,0x7a));var _0xa6e8=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6e8a[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xa6e8('0x0'));var util=require('util');var path=require(_0xa6e8('0x1'));var timeout=require(_0xa6e8('0x2'));var express=require(_0xa6e8('0x3'));var router=express[_0xa6e8('0x4')]();var fs_extra=require(_0xa6e8('0x5'));var auth=require(_0xa6e8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa6e8('0x7'));var controller=require(_0xa6e8('0x8'));router['get']('/',auth[_0xa6e8('0x9')](),controller['index']);router[_0xa6e8('0xa')](_0xa6e8('0xb'),auth['isAuthenticated'](),controller[_0xa6e8('0xc')]);router[_0xa6e8('0xa')](_0xa6e8('0xd'),auth[_0xa6e8('0x9')](),controller['getConfigurations']);router[_0xa6e8('0xa')]('/:id/fields',auth[_0xa6e8('0x9')](),controller[_0xa6e8('0xe')]);router['post']('/',auth[_0xa6e8('0x9')](),controller['create']);router[_0xa6e8('0xf')](_0xa6e8('0xd'),auth[_0xa6e8('0x9')](),controller[_0xa6e8('0x10')]);router[_0xa6e8('0x11')](_0xa6e8('0xb'),auth['isAuthenticated'](),controller[_0xa6e8('0x12')]);router[_0xa6e8('0x13')](_0xa6e8('0xb'),auth[_0xa6e8('0x9')](),controller[_0xa6e8('0x14')]);module[_0xa6e8('0x15')]=router; \ No newline at end of file +var _0x19bf=['/:id','show','/:id/fields','getFields','create','addConfiguration','put','update','multer','util','path','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x19bf,0x1a6));var _0xf19b=function(_0x2d935c,_0x413082){_0x2d935c=_0x2d935c-0x0;var _0x50f63b=_0x19bf[_0x2d935c];return _0x50f63b;};'use strict';var multer=require(_0xf19b('0x0'));var util=require(_0xf19b('0x1'));var path=require(_0xf19b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf19b('0x3')]();var fs_extra=require(_0xf19b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf19b('0x5'));var controller=require(_0xf19b('0x6'));router[_0xf19b('0x7')]('/',auth[_0xf19b('0x8')](),controller[_0xf19b('0x9')]);router[_0xf19b('0x7')](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xb')]);router[_0xf19b('0x7')]('/:id/configurations',auth[_0xf19b('0x8')](),controller['getConfigurations']);router[_0xf19b('0x7')](_0xf19b('0xc'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xd')]);router['post']('/',auth[_0xf19b('0x8')](),controller[_0xf19b('0xe')]);router['post']('/:id/configurations',auth[_0xf19b('0x8')](),controller[_0xf19b('0xf')]);router[_0xf19b('0x10')](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller[_0xf19b('0x11')]);router['delete'](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c6a80ca..c92a559 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 _0xfea5=['STRING'];(function(_0x541d01,_0x3c5185){var _0x4112c0=function(_0x52bcb2){while(--_0x52bcb2){_0x541d01['push'](_0x541d01['shift']());}};_0x4112c0(++_0x3c5185);}(_0xfea5,0xc7));var _0x5fea=function(_0x169c98,_0x2a3022){_0x169c98=_0x169c98-0x0;var _0x506890=_0xfea5[_0x169c98];return _0x506890;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5fea('0x0')]},'password':{'type':Sequelize[_0x5fea('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x5fea('0x0')]},'clientSecret':{'type':Sequelize[_0x5fea('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5fea('0x0')]}}; \ No newline at end of file +var _0x7a4b=['sequelize','STRING'];(function(_0x4e029f,_0x177074){var _0x135b7e=function(_0x37caff){while(--_0x37caff){_0x4e029f['push'](_0x4e029f['shift']());}};_0x135b7e(++_0x177074);}(_0x7a4b,0x186));var _0xb7a4=function(_0x505cff,_0x1b16c7){_0x505cff=_0x505cff-0x0;var _0x1eae92=_0x7a4b[_0x505cff];return _0x1eae92;};'use strict';var Sequelize=require(_0xb7a4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb7a4('0x1')]},'remoteUri':{'type':Sequelize[_0xb7a4('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb7a4('0x1')]},'clientSecret':{'type':Sequelize[_0xb7a4('0x1')]},'serverUrl':{'type':Sequelize[_0xb7a4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb7a4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9320ff3..d605a7f 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 _0xea81=['sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','GET','remove','includes','@odata.type','PicklistAttributeMetadata','push','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','then','show','params','length','includeAll','merge','catch','create','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame'];(function(_0x45678c,_0xf7ba35){var _0x271704=function(_0x4174cf){while(--_0x4174cf){_0x45678c['push'](_0x45678c['shift']());}};_0x271704(++_0xf7ba35);}(_0xea81,0x1ed));var _0x1ea8=function(_0x51878b,_0x37e0a4){_0x51878b=_0x51878b-0x0;var _0x786d8d=_0xea81[_0x51878b];return _0x786d8d;};'use strict';var emlformat=require(_0x1ea8('0x0'));var rimraf=require(_0x1ea8('0x1'));var zipdir=require(_0x1ea8('0x2'));var jsonpatch=require(_0x1ea8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1ea8('0x4'));var Mustache=require(_0x1ea8('0x5'));var util=require(_0x1ea8('0x6'));var path=require(_0x1ea8('0x7'));var sox=require(_0x1ea8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ea8('0x9'));var squel=require(_0x1ea8('0xa'));var crypto=require(_0x1ea8('0xb'));var jsforce=require(_0x1ea8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1ea8('0xd'));var querystring=require(_0x1ea8('0xe'));var Papa=require(_0x1ea8('0xf'));var Redis=require(_0x1ea8('0x10'));var authService=require(_0x1ea8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1ea8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ea8('0x13'))(_0x1ea8('0x14'));var utils=require(_0x1ea8('0x15'));var config=require(_0x1ea8('0x16'));var licenseUtil=require(_0x1ea8('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e2c66,_0x2b94da){_0x2b94da=_0x2b94da||0xcc;return function(_0x4f543e){if(_0x4f543e){return _0x2e2c66[_0x1ea8('0x18')](_0x2b94da);}return _0x2e2c66[_0x1ea8('0x19')](_0x2b94da)[_0x1ea8('0x1a')]();};}function respondWithResult(_0x184601,_0x122406){_0x122406=_0x122406||0xc8;return function(_0x5d0ef1){if(_0x5d0ef1){return _0x184601[_0x1ea8('0x19')](_0x122406)[_0x1ea8('0x1b')](_0x5d0ef1);}};}function respondWithFilteredResult(_0x3e072d,_0x4f1197){return function(_0x2d5b07){if(_0x2d5b07){var _0x3a600c=typeof _0x4f1197['offset']==='undefined'&&typeof _0x4f1197[_0x1ea8('0x1c')]==='undefined';var _0x46c78a=_0x2d5b07['count'];var _0x239c3d=_0x3a600c?0x0:_0x4f1197[_0x1ea8('0x1d')];var _0xc9dabd=_0x3a600c?_0x2d5b07[_0x1ea8('0x1e')]:_0x4f1197[_0x1ea8('0x1d')]+_0x4f1197[_0x1ea8('0x1c')];var _0x37361c;if(_0xc9dabd>=_0x46c78a){_0xc9dabd=_0x46c78a;_0x37361c=0xc8;}else{_0x37361c=0xce;}_0x3e072d[_0x1ea8('0x19')](_0x37361c);return _0x3e072d['set'](_0x1ea8('0x1f'),_0x239c3d+'-'+_0xc9dabd+'/'+_0x46c78a)[_0x1ea8('0x1b')](_0x2d5b07);}return null;};}function patchUpdates(_0x1b0148){return function(_0x2cc5e4){try{jsonpatch[_0x1ea8('0x20')](_0x2cc5e4,_0x1b0148,!![]);}catch(_0x39fce5){return BPromise[_0x1ea8('0x21')](_0x39fce5);}return _0x2cc5e4[_0x1ea8('0x22')]();};}function saveUpdates(_0xad7ad3,_0x247a47){return function(_0x4d2e2c){if(_0x4d2e2c){return _0x4d2e2c[_0x1ea8('0x23')](_0xad7ad3)['then'](function(_0x4276f0){return _0x4276f0;});}return null;};}function removeEntity(_0x4e03ee,_0x311e2e){return function(_0x528ede){if(_0x528ede){return _0x528ede[_0x1ea8('0x24')]()['then'](function(){_0x4e03ee['status'](0xcc)[_0x1ea8('0x1a')]();});}};}function handleEntityNotFound(_0x5ea18e,_0x415bc1){return function(_0x51d493){if(!_0x51d493){_0x5ea18e['sendStatus'](0x194);}return _0x51d493;};}function handleError(_0x3a79bf,_0x386dce){_0x386dce=_0x386dce||0x1f4;return function(_0x34e04b){logger[_0x1ea8('0x25')](_0x34e04b[_0x1ea8('0x26')]);if(_0x34e04b[_0x1ea8('0x27')]){delete _0x34e04b[_0x1ea8('0x27')];}_0x3a79bf['status'](_0x386dce)[_0x1ea8('0x28')](_0x34e04b);};}exports['index']=function(_0x6129d4,_0x4e1b56){var _0x28a7e0={},_0x1f605c={},_0x57ca09={'count':0x0,'rows':[]};var _0x271e25=_[_0x1ea8('0x29')](db[_0x1ea8('0x2a')][_0x1ea8('0x2b')],function(_0x2c4a12){return{'name':_0x2c4a12[_0x1ea8('0x2c')],'type':_0x2c4a12[_0x1ea8('0x2d')][_0x1ea8('0x2e')]};});_0x1f605c[_0x1ea8('0x2f')]=_[_0x1ea8('0x29')](_0x271e25,_0x1ea8('0x27'));_0x1f605c[_0x1ea8('0x30')]=_[_0x1ea8('0x31')](_0x6129d4[_0x1ea8('0x30')]);_0x1f605c[_0x1ea8('0x32')]=_['intersection'](_0x1f605c['model'],_0x1f605c[_0x1ea8('0x30')]);_0x28a7e0['attributes']=_[_0x1ea8('0x33')](_0x1f605c[_0x1ea8('0x2f')],qs[_0x1ea8('0x34')](_0x6129d4[_0x1ea8('0x30')]['fields']));_0x28a7e0[_0x1ea8('0x35')]=_0x28a7e0['attributes']['length']?_0x28a7e0[_0x1ea8('0x35')]:_0x1f605c[_0x1ea8('0x2f')];if(!_0x6129d4[_0x1ea8('0x30')][_0x1ea8('0x36')](_0x1ea8('0x37'))){_0x28a7e0[_0x1ea8('0x1c')]=qs[_0x1ea8('0x1c')](_0x6129d4['query'][_0x1ea8('0x1c')]);_0x28a7e0[_0x1ea8('0x1d')]=qs[_0x1ea8('0x1d')](_0x6129d4['query']['offset']);}_0x28a7e0[_0x1ea8('0x38')]=qs[_0x1ea8('0x39')](_0x6129d4[_0x1ea8('0x30')]['sort']);_0x28a7e0[_0x1ea8('0x3a')]=qs[_0x1ea8('0x32')](_[_0x1ea8('0x3b')](_0x6129d4[_0x1ea8('0x30')],_0x1f605c[_0x1ea8('0x32')]),_0x271e25);if(_0x6129d4['query'][_0x1ea8('0x3c')]){_0x28a7e0[_0x1ea8('0x3a')]=_['merge'](_0x28a7e0[_0x1ea8('0x3a')],{'$or':_[_0x1ea8('0x29')](_0x271e25,function(_0x5d7631){if(_0x5d7631[_0x1ea8('0x2d')]!==_0x1ea8('0x3d')){var _0x4ab289={};_0x4ab289[_0x5d7631[_0x1ea8('0x27')]]={'$like':'%'+_0x6129d4[_0x1ea8('0x30')][_0x1ea8('0x3c')]+'%'};return _0x4ab289;}})});}_0x28a7e0=_['merge']({},_0x28a7e0,_0x6129d4[_0x1ea8('0x3e')]);var _0x991a1e={'where':_0x28a7e0[_0x1ea8('0x3a')]};return db['Dynamics365Account'][_0x1ea8('0x1e')](_0x991a1e)['then'](function(_0x14d610){_0x57ca09[_0x1ea8('0x1e')]=_0x14d610;if(_0x6129d4['query']['includeAll']){_0x28a7e0[_0x1ea8('0x3f')]=[{'all':!![]}];}return db[_0x1ea8('0x2a')][_0x1ea8('0x40')](_0x28a7e0);})[_0x1ea8('0x41')](function(_0x5ba38e){_0x57ca09['rows']=_0x5ba38e;return _0x57ca09;})[_0x1ea8('0x41')](respondWithFilteredResult(_0x4e1b56,_0x28a7e0))['catch'](handleError(_0x4e1b56,null));};exports[_0x1ea8('0x42')]=function(_0x19b36f,_0x5378fd){var _0x11fab9={'raw':![],'where':{'id':_0x19b36f[_0x1ea8('0x43')]['id']}},_0x2e701e={};_0x2e701e['model']=_[_0x1ea8('0x31')](db[_0x1ea8('0x2a')][_0x1ea8('0x2b')]);_0x2e701e[_0x1ea8('0x30')]=_[_0x1ea8('0x31')](_0x19b36f[_0x1ea8('0x30')]);_0x2e701e[_0x1ea8('0x32')]=_[_0x1ea8('0x33')](_0x2e701e[_0x1ea8('0x2f')],_0x2e701e[_0x1ea8('0x30')]);_0x11fab9['attributes']=_[_0x1ea8('0x33')](_0x2e701e[_0x1ea8('0x2f')],qs[_0x1ea8('0x34')](_0x19b36f['query'][_0x1ea8('0x34')]));_0x11fab9['attributes']=_0x11fab9[_0x1ea8('0x35')][_0x1ea8('0x44')]?_0x11fab9[_0x1ea8('0x35')]:_0x2e701e[_0x1ea8('0x2f')];if(_0x19b36f[_0x1ea8('0x30')][_0x1ea8('0x45')]){_0x11fab9[_0x1ea8('0x3f')]=[{'all':!![]}];}_0x11fab9=_[_0x1ea8('0x46')]({},_0x11fab9,_0x19b36f[_0x1ea8('0x3e')]);return db['Dynamics365Account']['find'](_0x11fab9)[_0x1ea8('0x41')](handleEntityNotFound(_0x5378fd,null))[_0x1ea8('0x41')](respondWithResult(_0x5378fd,null))[_0x1ea8('0x47')](handleError(_0x5378fd,null));};exports[_0x1ea8('0x48')]=function(_0x30284c,_0x5e2415){return db[_0x1ea8('0x2a')][_0x1ea8('0x48')](_0x30284c[_0x1ea8('0x49')],{})[_0x1ea8('0x41')](respondWithResult(_0x5e2415,0xc9))[_0x1ea8('0x47')](handleError(_0x5e2415,null));};exports[_0x1ea8('0x23')]=function(_0x1d1f66,_0x127de7){if(_0x1d1f66['body']['id']){delete _0x1d1f66[_0x1ea8('0x49')]['id'];}return db['Dynamics365Account'][_0x1ea8('0x4a')]({'where':{'id':_0x1d1f66[_0x1ea8('0x43')]['id']}})[_0x1ea8('0x41')](handleEntityNotFound(_0x127de7,null))['then'](saveUpdates(_0x1d1f66['body'],null))['then'](respondWithResult(_0x127de7,null))[_0x1ea8('0x47')](handleError(_0x127de7,null));};exports[_0x1ea8('0x24')]=function(_0x3bb40c,_0x4b01ab){return db[_0x1ea8('0x2a')][_0x1ea8('0x4a')]({'where':{'id':_0x3bb40c['params']['id']}})[_0x1ea8('0x41')](handleEntityNotFound(_0x4b01ab,null))[_0x1ea8('0x41')](removeEntity(_0x4b01ab,null))[_0x1ea8('0x47')](handleError(_0x4b01ab,null));};exports[_0x1ea8('0x4b')]=function(_0x2df89b,_0x3d3e5a,_0x363856){var _0x3d37e2={};var _0x2bada5={};var _0x33e247;var _0x344527;return db[_0x1ea8('0x2a')][_0x1ea8('0x4c')]({'where':{'id':_0x2df89b[_0x1ea8('0x43')]['id']}})[_0x1ea8('0x41')](handleEntityNotFound(_0x3d3e5a,null))['then'](function(_0x4b3ecc){if(_0x4b3ecc){_0x33e247=_0x4b3ecc;_0x2bada5[_0x1ea8('0x2f')]=_['keys'](db[_0x1ea8('0x4d')][_0x1ea8('0x2b')]);_0x2bada5[_0x1ea8('0x30')]=_[_0x1ea8('0x31')](_0x2df89b[_0x1ea8('0x30')]);_0x2bada5[_0x1ea8('0x32')]=_[_0x1ea8('0x33')](_0x2bada5[_0x1ea8('0x2f')],_0x2bada5[_0x1ea8('0x30')]);_0x3d37e2[_0x1ea8('0x35')]=_[_0x1ea8('0x33')](_0x2bada5['model'],qs[_0x1ea8('0x34')](_0x2df89b[_0x1ea8('0x30')]['fields']));_0x3d37e2[_0x1ea8('0x35')]=_0x3d37e2[_0x1ea8('0x35')][_0x1ea8('0x44')]?_0x3d37e2['attributes']:_0x2bada5[_0x1ea8('0x2f')];_0x3d37e2[_0x1ea8('0x38')]=qs['sort'](_0x2df89b[_0x1ea8('0x30')][_0x1ea8('0x39')]);_0x3d37e2[_0x1ea8('0x3a')]=qs['filters'](_[_0x1ea8('0x3b')](_0x2df89b[_0x1ea8('0x30')],_0x2bada5[_0x1ea8('0x32')]));if(_0x2df89b[_0x1ea8('0x30')][_0x1ea8('0x3c')]){_0x3d37e2[_0x1ea8('0x3a')]=_[_0x1ea8('0x46')](_0x3d37e2[_0x1ea8('0x3a')],{'$or':_[_0x1ea8('0x29')](_0x3d37e2[_0x1ea8('0x35')],function(_0x5623b9){var _0x359a24={};_0x359a24[_0x5623b9]={'$like':'%'+_0x2df89b[_0x1ea8('0x30')][_0x1ea8('0x3c')]+'%'};return _0x359a24;})});}_0x3d37e2=_[_0x1ea8('0x46')]({},_0x3d37e2,_0x2df89b[_0x1ea8('0x3e')]);return _0x33e247['getConfigurations'](_0x3d37e2);}})[_0x1ea8('0x41')](function(_0x57ebe0){if(_0x57ebe0){_0x344527=_0x57ebe0[_0x1ea8('0x44')];if(!_0x2df89b[_0x1ea8('0x30')][_0x1ea8('0x36')](_0x1ea8('0x37'))){_0x3d37e2[_0x1ea8('0x1c')]=qs[_0x1ea8('0x1c')](_0x2df89b[_0x1ea8('0x30')]['limit']);_0x3d37e2[_0x1ea8('0x1d')]=qs[_0x1ea8('0x1d')](_0x2df89b[_0x1ea8('0x30')]['offset']);}return _0x33e247['getConfigurations'](_0x3d37e2);}})[_0x1ea8('0x41')](function(_0x2403f2){if(_0x2403f2){return _0x2403f2?{'count':_0x344527,'rows':_0x2403f2}:null;}})[_0x1ea8('0x41')](respondWithResult(_0x3d3e5a,null))[_0x1ea8('0x47')](handleError(_0x3d3e5a,null));};exports[_0x1ea8('0x4e')]=function(_0x2e476a,_0x1ba2a1,_0x4a1340){if(_0x2e476a[_0x1ea8('0x49')]['id']){delete _0x2e476a[_0x1ea8('0x49')]['id'];}return db['Dynamics365Account'][_0x1ea8('0x4c')]({'where':{'id':_0x2e476a[_0x1ea8('0x43')]['id']}})[_0x1ea8('0x41')](handleEntityNotFound(_0x1ba2a1,null))[_0x1ea8('0x41')](function(_0x10817c){if(_0x10817c){_0x2e476a['body'][_0x1ea8('0x4f')]=_0x10817c['id'];_0x2e476a['body'][_0x1ea8('0x50')]=integrations['getSubjects'](_0x2e476a[_0x1ea8('0x49')][_0x1ea8('0x51')],_0x2e476a[_0x1ea8('0x49')][_0x1ea8('0x2d')]);_0x2e476a[_0x1ea8('0x49')][_0x1ea8('0x52')]=integrations[_0x1ea8('0x53')](_0x2e476a[_0x1ea8('0x49')]['channel'],_0x2e476a[_0x1ea8('0x49')]['type']);return db[_0x1ea8('0x4d')][_0x1ea8('0x48')](_0x2e476a['body'],{'include':[{'model':db[_0x1ea8('0x54')],'as':'Subjects'},{'model':db[_0x1ea8('0x54')],'as':_0x1ea8('0x52')}]});}return null;})[_0x1ea8('0x41')](respondWithResult(_0x1ba2a1,null))[_0x1ea8('0x47')](handleError(_0x1ba2a1,null));};exports[_0x1ea8('0x55')]=function(_0x40fd53,_0x1b4dff,_0x351c6c){var _0x3fd87c=_0x40fd53[_0x1ea8('0x30')][_0x1ea8('0x56')];var _0x503f88=_0x3fd87c===_0x1ea8('0x57')?_0x1ea8('0x58'):_0x1ea8('0x59');var _0x2c36b4='';var _0x16c767='';var _0x48309e='';var _0x34198f='';var _0x3c679d='';var _0x3dd546='';var _0x2c888d='';var _0xbcbf56='';var _0x1f9835=['title',_0x1ea8('0x5a'),_0x1ea8('0x5b'),'ownerid',_0x1ea8('0x5c'),_0x1ea8('0x5d'),_0x1ea8('0x5e'),_0x1ea8('0x5f'),'directioncode',_0x1ea8('0x60')];var _0x5098b1=['accountidname',_0x1ea8('0x61'),_0x1ea8('0x62'),_0x1ea8('0x63'),_0x1ea8('0x64'),_0x1ea8('0x65'),_0x1ea8('0x66'),_0x1ea8('0x67'),_0x1ea8('0x68'),_0x1ea8('0x69'),'createdbyname',_0x1ea8('0x6a'),_0x1ea8('0x6b'),_0x1ea8('0x6c'),_0x1ea8('0x6d'),_0x1ea8('0x6e'),_0x1ea8('0x6f'),_0x1ea8('0x70'),_0x1ea8('0x71'),_0x1ea8('0x72'),_0x1ea8('0x73'),'entityimage_url',_0x1ea8('0x74'),_0x1ea8('0x75'),_0x1ea8('0x76'),_0x1ea8('0x77'),_0x1ea8('0x78'),'influencescore',_0x1ea8('0x79'),_0x1ea8('0x7a'),_0x1ea8('0x7b'),_0x1ea8('0x7c'),_0x1ea8('0x7d'),_0x1ea8('0x7e'),_0x1ea8('0x7f'),_0x1ea8('0x80'),_0x1ea8('0x81'),'modifiedonbehalfbyyominame',_0x1ea8('0x82'),_0x1ea8('0x83'),_0x1ea8('0x84'),_0x1ea8('0x85'),_0x1ea8('0x86'),_0x1ea8('0x87'),'owneridtype',_0x1ea8('0x88'),_0x1ea8('0x89'),_0x1ea8('0x8a'),_0x1ea8('0x8b'),_0x1ea8('0x8c'),_0x1ea8('0x8d'),_0x1ea8('0x8e'),'resolveby',_0x1ea8('0x8f'),_0x1ea8('0x90'),'responsiblecontactidname',_0x1ea8('0x91'),_0x1ea8('0x92'),'slainvokedidname',_0x1ea8('0x93'),_0x1ea8('0x94'),_0x1ea8('0x95'),_0x1ea8('0x96'),'subjectidname',_0x1ea8('0x97'),'timezoneruleversionnumber','transactioncurrencyidname',_0x1ea8('0x98'),'utcconversiontimezonecode',_0x1ea8('0x99')];var _0x4ffc98=_0x1f9835[_0x1ea8('0x9a')](_0x5098b1);return db[_0x1ea8('0x2a')][_0x1ea8('0x4c')]({'where':{'id':_0x40fd53[_0x1ea8('0x43')]['id']},'attributes':['id',_0x1ea8('0x9b'),'password',_0x1ea8('0x9c'),_0x1ea8('0x9d'),_0x1ea8('0x9e'),_0x1ea8('0x9f')]})[_0x1ea8('0x41')](handleEntityNotFound(_0x1b4dff,null))[_0x1ea8('0x41')](function(_0x4276d0){if(_0x4276d0){_0xbcbf56=_0x4276d0['remoteUri'];var _0x401a61=_0xbcbf56[_0x1ea8('0xa0')](-0x1);if(_0x401a61==='/'){_0xbcbf56=_0xbcbf56[_0x1ea8('0xa1')](0x0,_0xbcbf56[_0x1ea8('0xa2')](_0x401a61));}_0x2c888d=util[_0x1ea8('0xa3')]('%s/api/data/v9.0/',_0xbcbf56);var _0x3be3a7={'method':_0x1ea8('0xa4'),'uri':_0x1ea8('0xa5')+_0x4276d0[_0x1ea8('0x9d')]+_0x1ea8('0xa6'),'form':{'client_id':_0x4276d0[_0x1ea8('0x9e')],'resource':_0xbcbf56,'username':_0x4276d0['username'],'password':_0x4276d0[_0x1ea8('0xa7')],'grant_type':_0x1ea8('0xa7'),'client_secret':_0x4276d0[_0x1ea8('0x9f')]},'json':!![]};return rp(_0x3be3a7);}})[_0x1ea8('0x41')](function(_0x193994){_0x3dd546=_0x193994[_0x1ea8('0xa8')];var _0x4b9b2f={'method':'GET','uri':encodeURI(_0x2c888d+_0x1ea8('0xa9')+_0x503f88+'\x27'),'headers':{'Authorization':_0x1ea8('0xaa')+_0x3dd546,'If-None-Match':null,'OData-Version':_0x1ea8('0xab')},'json':!![]};return rp(_0x4b9b2f);})[_0x1ea8('0x41')](function(_0x38c363){var _0x249f06=_0x38c363['value'][0x0];var _0x241ad6=_0x249f06[_0x1ea8('0xac')];var _0x3f6495={'method':_0x1ea8('0xad'),'uri':_0x2c888d+'EntityDefinitions('+_0x241ad6+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x1ea8('0xaa')+_0x3dd546,'If-None-Match':null,'OData-Version':_0x1ea8('0xab')},'json':!![]};return rp(_0x3f6495);})[_0x1ea8('0x41')](function(_0x1b1da0){_0x2c36b4=_0x1b1da0;_0x16c767=_0x2c36b4['Attributes'];_0x16c767=_[_0x1ea8('0xae')](_0x16c767,function(_0x4c6d62){return!_0x4ffc98[_0x1ea8('0xaf')](_0x4c6d62['LogicalName']);});var _0x26b7b8=[];var _0x1daed6=[];_0x16c767['forEach'](function(_0x2c298f){if(_0x2c298f['@odata.type']){var _0x1d851f=_0x2c298f[_0x1ea8('0xb0')][_0x1ea8('0xa1')](_0x2c298f[_0x1ea8('0xb0')]['lastIndexOf']('.')+0x1);if(_0x1d851f===_0x1ea8('0xb1')){_0x26b7b8[_0x1ea8('0xb2')](getSelectList(_0x2c888d,_0x3fd87c,_0x1daed6,_0x2c36b4[_0x1ea8('0xac')],_0x2c298f[_0x1ea8('0xac')],_0x3dd546));}}});return Promise['all'](_0x26b7b8);})[_0x1ea8('0x41')](function(_0x4e17e5){_0x48309e=_0x4e17e5[0x0];var _0x1030eb=[];var _0x64710=[];_0x16c767[_0x1ea8('0xb3')](function(_0x245943){if(!_[_0x1ea8('0xb4')](_0x245943[_0x1ea8('0xb0')])){var _0x43e3ad=_0x245943[_0x1ea8('0xb0')]['substring'](_0x245943[_0x1ea8('0xb0')][_0x1ea8('0xa2')]('.')+0x1);if(_0x43e3ad===_0x1ea8('0xb5')){_0x1030eb[_0x1ea8('0xb2')](getBooleanList(_0x2c888d,_0x3fd87c,_0x64710,_0x2c36b4[_0x1ea8('0xac')],_0x245943[_0x1ea8('0xac')],_0x3dd546));}}});return Promise['all'](_0x1030eb);})['then'](function(_0x214549){_0x34198f=_0x214549[0x0];var _0x3725c7=[];var _0x770a4a=[];_0x16c767[_0x1ea8('0xb3')](function(_0x45872b){if(_0x45872b[_0x1ea8('0xb0')]){var _0x42395c=_0x45872b[_0x1ea8('0xb0')][_0x1ea8('0xa1')](_0x45872b[_0x1ea8('0xb0')][_0x1ea8('0xa2')]('.')+0x1);if(_0x42395c===_0x1ea8('0xb6')||_0x42395c===_0x1ea8('0xb7')||_0x42395c===_0x1ea8('0xb8')||_0x42395c===_0x1ea8('0xb9')||_0x42395c==='MemoAttributeMetadata'||_0x42395c===_0x1ea8('0xba')||_0x42395c===_0x1ea8('0xbb')||_0x42395c===_0x1ea8('0xbc')||_0x42395c===_0x1ea8('0xbd')||_0x42395c===_0x1ea8('0xbe')){_0x3725c7[_0x1ea8('0xb2')](getInputList(_0x2c888d,_0x3fd87c,_0x42395c,_0x770a4a,_0x2c36b4[_0x1ea8('0xac')],_0x45872b[_0x1ea8('0xac')],_0x3dd546));}}});return Promise[_0x1ea8('0xbf')](_0x3725c7);})[_0x1ea8('0x41')](function(_0x3de7a1){_0x3c679d=_0x3de7a1[0x0];var _0x6ed637=_0x48309e[_0x1ea8('0x9a')](_0x34198f)['concat'](_0x3c679d);var _0x1e24e8={'count':_0x6ed637[_0x1ea8('0x44')],'rows':_0x6ed637};return _0x1e24e8;})[_0x1ea8('0x41')](respondWithResult(_0x1b4dff,null))[_0x1ea8('0x47')](function(_0x2e84c1){var _0xc62d2e=_0x40fd53[_0x1ea8('0x30')][_0x1ea8('0xc0')]?0x1f4:_0x2e84c1[_0x1ea8('0xc1')]||0x1f4;logger[_0x1ea8('0x25')](_0x2e84c1[_0x1ea8('0x26')]);delete _0x2e84c1['name'];if(_0xc62d2e===0x191){_0xc62d2e=0x190;}_0x1b4dff[_0x1ea8('0x19')](_0xc62d2e)[_0x1ea8('0x28')](_0x40fd53[_0x1ea8('0x30')][_0x1ea8('0xc0')]?{'message':_0x1ea8('0xc2'),'statusCode':_0x2e84c1[_0x1ea8('0xc1')]}:_0x2e84c1);});};function getSelectList(_0x11f0f2,_0x32242d,_0x3b1cb7,_0x8b83f9,_0x8a14b6,_0x5b904e){var _0x55bc60={'method':'GET','uri':_0x11f0f2+'EntityDefinitions('+_0x8b83f9+_0x1ea8('0xc3')+_0x8a14b6+_0x1ea8('0xc4')+_0x1ea8('0xc5'),'headers':{'Authorization':_0x1ea8('0xaa')+_0x5b904e,'If-None-Match':null,'OData-Version':_0x1ea8('0xab')},'json':!![]};return rp(_0x55bc60)[_0x1ea8('0x41')](function(_0x97b368){var _0xbfe76=[];var _0x327761=_0x97b368[_0x1ea8('0xc6')][_0x1ea8('0xc7')];_0x327761[_0x1ea8('0xb3')](function(_0x11a328){_0xbfe76[_0x1ea8('0xb2')]({'name':_0x11a328[_0x1ea8('0xc8')][_0x1ea8('0xc9')][_0x1ea8('0xc8')],'value':String(_0x11a328[_0x1ea8('0xca')])});});var _0xd29f3={'id':_0x32242d+'_'+_0x97b368[_0x1ea8('0xcb')],'name':_0x97b368[_0x1ea8('0xcc')]['UserLocalizedLabel'][_0x1ea8('0xc8')],'custom':![],'options':_0xbfe76};_0x3b1cb7[_0x1ea8('0xb2')](_0xd29f3);return _0x3b1cb7;});}function getBooleanList(_0x53a0c8,_0x4ad7d8,_0x51f25c,_0x4d21b4,_0x230dc1,_0x429fd3){var _0x2fdd16={'method':_0x1ea8('0xad'),'uri':_0x53a0c8+_0x1ea8('0xcd')+_0x4d21b4+_0x1ea8('0xc3')+_0x230dc1+_0x1ea8('0xce'),'headers':{'Authorization':_0x1ea8('0xaa')+_0x429fd3,'If-None-Match':null,'OData-Version':_0x1ea8('0xab')},'json':!![]};return rp(_0x2fdd16)[_0x1ea8('0x41')](function(_0x2d0330){var _0x5855f2=[];_0x5855f2[_0x1ea8('0xb2')]({'name':_0x2d0330['OptionSet'][_0x1ea8('0xcf')]['Label'][_0x1ea8('0xc9')]['Label'],'value':_0x1ea8('0xd0')},{'name':_0x2d0330[_0x1ea8('0xc6')][_0x1ea8('0xd1')][_0x1ea8('0xc8')][_0x1ea8('0xc9')]['Label'],'value':_0x1ea8('0xd2')});var _0x314bdf={'id':_0x4ad7d8+'_'+_0x2d0330[_0x1ea8('0xcb')],'name':_0x2d0330[_0x1ea8('0xcc')][_0x1ea8('0xc9')][_0x1ea8('0xc8')],'custom':![],'options':_0x5855f2};_0x51f25c['push'](_0x314bdf);return _0x51f25c;});}function getInputList(_0x2f68be,_0x4dcc9a,_0x3dc184,_0x51e735,_0x26e38a,_0x2b578b,_0x2b8028){var _0x4b672c={'method':_0x1ea8('0xad'),'uri':_0x2f68be+_0x1ea8('0xcd')+_0x26e38a+_0x1ea8('0xc3')+_0x2b578b+_0x1ea8('0xd3')+_0x3dc184+_0x1ea8('0xd4'),'headers':{'Authorization':_0x1ea8('0xaa')+_0x2b8028,'If-None-Match':null,'OData-Version':_0x1ea8('0xab')},'json':!![]};return rp(_0x4b672c)[_0x1ea8('0x41')](function(_0x34e51b){var _0xb84007={'id':_0x4dcc9a+'_'+_0x34e51b[_0x1ea8('0xcb')],'name':_0x34e51b['DisplayName'][_0x1ea8('0xc9')]?_0x34e51b[_0x1ea8('0xcc')][_0x1ea8('0xc9')][_0x1ea8('0xc8')]:_0x34e51b[_0x1ea8('0xcb')],'custom':![],'options':[]};_0x51e735[_0x1ea8('0xb2')](_0xb84007);return _0x51e735;});} \ No newline at end of file +var _0x8d97=['params','keys','options','create','body','find','findOne','Dynamics365Configuration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','Incident','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','POST','/oauth2/token','access_token','GET','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Attributes(','TrueOption','true','DisplayName','?$select=DisplayName,LogicalName','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','catch','show'];(function(_0x156696,_0x3a9a2e){var _0x5ab7c4=function(_0x26179a){while(--_0x26179a){_0x156696['push'](_0x156696['shift']());}};_0x5ab7c4(++_0x3a9a2e);}(_0x8d97,0x82));var _0x78d9=function(_0xbf129b,_0x2482d0){_0xbf129b=_0xbf129b-0x0;var _0x4dd642=_0x8d97[_0xbf129b];return _0x4dd642;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78d9('0x2'));var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require(_0x78d9('0x6'));var path=require('path');var sox=require(_0x78d9('0x7'));var csv=require(_0x78d9('0x8'));var ejs=require(_0x78d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x8'));var querystring=require(_0x78d9('0xd'));var Papa=require(_0x78d9('0xe'));var Redis=require('ioredis');var authService=require(_0x78d9('0xf'));var qs=require(_0x78d9('0x10'));var as=require(_0x78d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];var integrations=require(_0x78d9('0x17'));function respondWithStatusCode(_0x528746,_0x8186eb){_0x8186eb=_0x8186eb||0xcc;return function(_0x431199){if(_0x431199){return _0x528746[_0x78d9('0x18')](_0x8186eb);}return _0x528746[_0x78d9('0x19')](_0x8186eb)[_0x78d9('0x1a')]();};}function respondWithResult(_0x2928a8,_0x2b27a9){_0x2b27a9=_0x2b27a9||0xc8;return function(_0x3d8c2f){if(_0x3d8c2f){return _0x2928a8[_0x78d9('0x19')](_0x2b27a9)[_0x78d9('0x1b')](_0x3d8c2f);}};}function respondWithFilteredResult(_0x826882,_0x38aa28){return function(_0x45934d){if(_0x45934d){var _0x3501b5=typeof _0x38aa28[_0x78d9('0x1c')]===_0x78d9('0x1d')&&typeof _0x38aa28[_0x78d9('0x1e')]==='undefined';var _0xfabfde=_0x45934d[_0x78d9('0x1f')];var _0x36f1e4=_0x3501b5?0x0:_0x38aa28[_0x78d9('0x1c')];var _0x43ea59=_0x3501b5?_0x45934d[_0x78d9('0x1f')]:_0x38aa28[_0x78d9('0x1c')]+_0x38aa28[_0x78d9('0x1e')];var _0x3fc3c2;if(_0x43ea59>=_0xfabfde){_0x43ea59=_0xfabfde;_0x3fc3c2=0xc8;}else{_0x3fc3c2=0xce;}_0x826882[_0x78d9('0x19')](_0x3fc3c2);return _0x826882[_0x78d9('0x20')](_0x78d9('0x21'),_0x36f1e4+'-'+_0x43ea59+'/'+_0xfabfde)[_0x78d9('0x1b')](_0x45934d);}return null;};}function patchUpdates(_0x148e30){return function(_0x1e0461){try{jsonpatch[_0x78d9('0x22')](_0x1e0461,_0x148e30,!![]);}catch(_0x4df145){return BPromise[_0x78d9('0x23')](_0x4df145);}return _0x1e0461[_0x78d9('0x24')]();};}function saveUpdates(_0x24d236,_0x18bb18){return function(_0x4d571f){if(_0x4d571f){return _0x4d571f[_0x78d9('0x25')](_0x24d236)[_0x78d9('0x26')](function(_0x45b6f6){return _0x45b6f6;});}return null;};}function removeEntity(_0x51549d,_0x51c4ce){return function(_0x30e434){if(_0x30e434){return _0x30e434['destroy']()['then'](function(){_0x51549d['status'](0xcc)[_0x78d9('0x1a')]();});}};}function handleEntityNotFound(_0x1fa9a1,_0x361a5e){return function(_0xacd80c){if(!_0xacd80c){_0x1fa9a1[_0x78d9('0x18')](0x194);}return _0xacd80c;};}function handleError(_0x17db22,_0x4e87cf){_0x4e87cf=_0x4e87cf||0x1f4;return function(_0x17b928){logger['error'](_0x17b928[_0x78d9('0x27')]);if(_0x17b928[_0x78d9('0x28')]){delete _0x17b928[_0x78d9('0x28')];}_0x17db22['status'](_0x4e87cf)[_0x78d9('0x29')](_0x17b928);};}exports[_0x78d9('0x2a')]=function(_0x59b9d2,_0x47f189){var _0x55617c={},_0x4fce54={},_0x1e4f67={'count':0x0,'rows':[]};var _0xcbb803=_[_0x78d9('0x2b')](db[_0x78d9('0x2c')][_0x78d9('0x2d')],function(_0x3fe42b){return{'name':_0x3fe42b[_0x78d9('0x2e')],'type':_0x3fe42b[_0x78d9('0x2f')][_0x78d9('0x30')]};});_0x4fce54[_0x78d9('0x31')]=_['map'](_0xcbb803,_0x78d9('0x28'));_0x4fce54['query']=_['keys'](_0x59b9d2[_0x78d9('0x32')]);_0x4fce54[_0x78d9('0x33')]=_[_0x78d9('0x34')](_0x4fce54[_0x78d9('0x31')],_0x4fce54[_0x78d9('0x32')]);_0x55617c[_0x78d9('0x35')]=_[_0x78d9('0x34')](_0x4fce54['model'],qs[_0x78d9('0x36')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x36')]));_0x55617c[_0x78d9('0x35')]=_0x55617c['attributes'][_0x78d9('0x37')]?_0x55617c['attributes']:_0x4fce54['model'];if(!_0x59b9d2['query']['hasOwnProperty'](_0x78d9('0x38'))){_0x55617c[_0x78d9('0x1e')]=qs[_0x78d9('0x1e')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x1e')]);_0x55617c[_0x78d9('0x1c')]=qs[_0x78d9('0x1c')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x1c')]);}_0x55617c[_0x78d9('0x39')]=qs[_0x78d9('0x3a')](_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x3a')]);_0x55617c[_0x78d9('0x3b')]=qs[_0x78d9('0x33')](_[_0x78d9('0x3c')](_0x59b9d2[_0x78d9('0x32')],_0x4fce54[_0x78d9('0x33')]),_0xcbb803);if(_0x59b9d2['query']['filter']){_0x55617c[_0x78d9('0x3b')]=_[_0x78d9('0x3d')](_0x55617c[_0x78d9('0x3b')],{'$or':_[_0x78d9('0x2b')](_0xcbb803,function(_0x2cc4eb){if(_0x2cc4eb[_0x78d9('0x2f')]!=='VIRTUAL'){var _0x46802d={};_0x46802d[_0x2cc4eb[_0x78d9('0x28')]]={'$like':'%'+_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x3e')]+'%'};return _0x46802d;}})});}_0x55617c=_[_0x78d9('0x3d')]({},_0x55617c,_0x59b9d2['options']);var _0x283e35={'where':_0x55617c[_0x78d9('0x3b')]};return db[_0x78d9('0x2c')][_0x78d9('0x1f')](_0x283e35)['then'](function(_0x30abd4){_0x1e4f67[_0x78d9('0x1f')]=_0x30abd4;if(_0x59b9d2[_0x78d9('0x32')][_0x78d9('0x3f')]){_0x55617c[_0x78d9('0x40')]=[{'all':!![]}];}return db[_0x78d9('0x2c')][_0x78d9('0x41')](_0x55617c);})[_0x78d9('0x26')](function(_0x403d36){_0x1e4f67['rows']=_0x403d36;return _0x1e4f67;})[_0x78d9('0x26')](respondWithFilteredResult(_0x47f189,_0x55617c))[_0x78d9('0x42')](handleError(_0x47f189,null));};exports[_0x78d9('0x43')]=function(_0xc4e054,_0x2ddb1e){var _0x2d4c80={'raw':![],'where':{'id':_0xc4e054[_0x78d9('0x44')]['id']}},_0x33649b={};_0x33649b[_0x78d9('0x31')]=_[_0x78d9('0x45')](db[_0x78d9('0x2c')]['rawAttributes']);_0x33649b['query']=_[_0x78d9('0x45')](_0xc4e054[_0x78d9('0x32')]);_0x33649b['filters']=_[_0x78d9('0x34')](_0x33649b[_0x78d9('0x31')],_0x33649b[_0x78d9('0x32')]);_0x2d4c80[_0x78d9('0x35')]=_[_0x78d9('0x34')](_0x33649b[_0x78d9('0x31')],qs[_0x78d9('0x36')](_0xc4e054[_0x78d9('0x32')][_0x78d9('0x36')]));_0x2d4c80[_0x78d9('0x35')]=_0x2d4c80['attributes'][_0x78d9('0x37')]?_0x2d4c80[_0x78d9('0x35')]:_0x33649b[_0x78d9('0x31')];if(_0xc4e054[_0x78d9('0x32')][_0x78d9('0x3f')]){_0x2d4c80['include']=[{'all':!![]}];}_0x2d4c80=_['merge']({},_0x2d4c80,_0xc4e054[_0x78d9('0x46')]);return db[_0x78d9('0x2c')]['find'](_0x2d4c80)['then'](handleEntityNotFound(_0x2ddb1e,null))[_0x78d9('0x26')](respondWithResult(_0x2ddb1e,null))['catch'](handleError(_0x2ddb1e,null));};exports[_0x78d9('0x47')]=function(_0x62dd38,_0x285211){return db[_0x78d9('0x2c')][_0x78d9('0x47')](_0x62dd38[_0x78d9('0x48')],{})[_0x78d9('0x26')](respondWithResult(_0x285211,0xc9))[_0x78d9('0x42')](handleError(_0x285211,null));};exports[_0x78d9('0x25')]=function(_0x3cec0a,_0xfeee4a){if(_0x3cec0a['body']['id']){delete _0x3cec0a[_0x78d9('0x48')]['id'];}return db['Dynamics365Account'][_0x78d9('0x49')]({'where':{'id':_0x3cec0a[_0x78d9('0x44')]['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0xfeee4a,null))[_0x78d9('0x26')](saveUpdates(_0x3cec0a['body'],null))[_0x78d9('0x26')](respondWithResult(_0xfeee4a,null))['catch'](handleError(_0xfeee4a,null));};exports['destroy']=function(_0x579c3b,_0x9bba1){return db[_0x78d9('0x2c')][_0x78d9('0x49')]({'where':{'id':_0x579c3b[_0x78d9('0x44')]['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0x9bba1,null))['then'](removeEntity(_0x9bba1,null))[_0x78d9('0x42')](handleError(_0x9bba1,null));};exports['getConfigurations']=function(_0x351d4a,_0x106652,_0x3d8e0d){var _0x30766e={};var _0x540854={};var _0x57a741;var _0x3e6076;return db[_0x78d9('0x2c')][_0x78d9('0x4a')]({'where':{'id':_0x351d4a[_0x78d9('0x44')]['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0x106652,null))[_0x78d9('0x26')](function(_0x28bb8c){if(_0x28bb8c){_0x57a741=_0x28bb8c;_0x540854[_0x78d9('0x31')]=_[_0x78d9('0x45')](db[_0x78d9('0x4b')][_0x78d9('0x2d')]);_0x540854[_0x78d9('0x32')]=_['keys'](_0x351d4a[_0x78d9('0x32')]);_0x540854[_0x78d9('0x33')]=_[_0x78d9('0x34')](_0x540854[_0x78d9('0x31')],_0x540854['query']);_0x30766e[_0x78d9('0x35')]=_[_0x78d9('0x34')](_0x540854['model'],qs[_0x78d9('0x36')](_0x351d4a['query']['fields']));_0x30766e[_0x78d9('0x35')]=_0x30766e[_0x78d9('0x35')][_0x78d9('0x37')]?_0x30766e['attributes']:_0x540854[_0x78d9('0x31')];_0x30766e[_0x78d9('0x39')]=qs[_0x78d9('0x3a')](_0x351d4a['query'][_0x78d9('0x3a')]);_0x30766e['where']=qs[_0x78d9('0x33')](_[_0x78d9('0x3c')](_0x351d4a[_0x78d9('0x32')],_0x540854['filters']));if(_0x351d4a['query'][_0x78d9('0x3e')]){_0x30766e[_0x78d9('0x3b')]=_[_0x78d9('0x3d')](_0x30766e[_0x78d9('0x3b')],{'$or':_['map'](_0x30766e['attributes'],function(_0x2503a2){var _0xe55fe={};_0xe55fe[_0x2503a2]={'$like':'%'+_0x351d4a[_0x78d9('0x32')]['filter']+'%'};return _0xe55fe;})});}_0x30766e=_['merge']({},_0x30766e,_0x351d4a[_0x78d9('0x46')]);return _0x57a741[_0x78d9('0x4c')](_0x30766e);}})[_0x78d9('0x26')](function(_0x3086f1){if(_0x3086f1){_0x3e6076=_0x3086f1[_0x78d9('0x37')];if(!_0x351d4a['query'][_0x78d9('0x4d')](_0x78d9('0x38'))){_0x30766e['limit']=qs[_0x78d9('0x1e')](_0x351d4a[_0x78d9('0x32')][_0x78d9('0x1e')]);_0x30766e[_0x78d9('0x1c')]=qs[_0x78d9('0x1c')](_0x351d4a[_0x78d9('0x32')][_0x78d9('0x1c')]);}return _0x57a741[_0x78d9('0x4c')](_0x30766e);}})[_0x78d9('0x26')](function(_0x457036){if(_0x457036){return _0x457036?{'count':_0x3e6076,'rows':_0x457036}:null;}})[_0x78d9('0x26')](respondWithResult(_0x106652,null))[_0x78d9('0x42')](handleError(_0x106652,null));};exports[_0x78d9('0x4e')]=function(_0x253f81,_0x4e0f9a,_0x28f856){if(_0x253f81[_0x78d9('0x48')]['id']){delete _0x253f81[_0x78d9('0x48')]['id'];}return db[_0x78d9('0x2c')][_0x78d9('0x4a')]({'where':{'id':_0x253f81['params']['id']}})[_0x78d9('0x26')](handleEntityNotFound(_0x4e0f9a,null))[_0x78d9('0x26')](function(_0x4c7ecb){if(_0x4c7ecb){_0x253f81[_0x78d9('0x48')][_0x78d9('0x4f')]=_0x4c7ecb['id'];_0x253f81[_0x78d9('0x48')][_0x78d9('0x50')]=integrations['getSubjects'](_0x253f81[_0x78d9('0x48')]['channel'],_0x253f81[_0x78d9('0x48')][_0x78d9('0x2f')]);_0x253f81[_0x78d9('0x48')][_0x78d9('0x51')]=integrations[_0x78d9('0x52')](_0x253f81[_0x78d9('0x48')][_0x78d9('0x53')],_0x253f81[_0x78d9('0x48')]['type']);return db['Dynamics365Configuration'][_0x78d9('0x47')](_0x253f81['body'],{'include':[{'model':db[_0x78d9('0x54')],'as':'Subjects'},{'model':db[_0x78d9('0x54')],'as':_0x78d9('0x51')}]});}return null;})['then'](respondWithResult(_0x4e0f9a,null))[_0x78d9('0x42')](handleError(_0x4e0f9a,null));};exports[_0x78d9('0x55')]=function(_0x5861b8,_0x5b085b,_0x2aa82b){var _0x18e3d9=_0x5861b8['query'][_0x78d9('0x56')];var _0x46b996=_0x18e3d9===_0x78d9('0x57')?_0x78d9('0x58'):'PhoneCall';var _0x7b79f9='';var _0xbf6eee='';var _0x63a23a='';var _0x1c92ef='';var _0x2252b2='';var _0x1522c5='';var _0x3f33a3='';var _0x1513ab='';var _0x2b6014=['title','description',_0x78d9('0x59'),_0x78d9('0x5a'),_0x78d9('0x5b'),_0x78d9('0x5c'),_0x78d9('0x5d'),_0x78d9('0x5e'),_0x78d9('0x5f'),'phonecall_activity_parties'];var _0x1692da=[_0x78d9('0x60'),_0x78d9('0x61'),_0x78d9('0x62'),_0x78d9('0x63'),_0x78d9('0x64'),_0x78d9('0x65'),_0x78d9('0x66'),_0x78d9('0x67'),'createdbyexternalpartyname',_0x78d9('0x68'),'createdbyname',_0x78d9('0x69'),'createdon','createdonbehalfbyname',_0x78d9('0x6a'),_0x78d9('0x6b'),_0x78d9('0x6c'),_0x78d9('0x6d'),_0x78d9('0x6e'),'entitlementidname',_0x78d9('0x6f'),'entityimage_url',_0x78d9('0x70'),'exchangerate',_0x78d9('0x71'),'followupby',_0x78d9('0x72'),_0x78d9('0x73'),'kbarticleidname','lastonholdtime',_0x78d9('0x74'),_0x78d9('0x75'),_0x78d9('0x76'),_0x78d9('0x77'),'modifiedbyyominame','modifiedon','modifiedonbehalfbyname',_0x78d9('0x78'),_0x78d9('0x79'),_0x78d9('0x7a'),_0x78d9('0x7b'),'onholdtime',_0x78d9('0x7c'),'owneridname','owneridtype',_0x78d9('0x7d'),_0x78d9('0x7e'),_0x78d9('0x7f'),_0x78d9('0x80'),_0x78d9('0x81'),_0x78d9('0x82'),_0x78d9('0x83'),_0x78d9('0x84'),_0x78d9('0x85'),_0x78d9('0x86'),_0x78d9('0x87'),_0x78d9('0x88'),_0x78d9('0x89'),_0x78d9('0x8a'),_0x78d9('0x8b'),_0x78d9('0x8c'),_0x78d9('0x8d'),_0x78d9('0x8e'),_0x78d9('0x8f'),_0x78d9('0x90'),_0x78d9('0x91'),'transactioncurrencyidname',_0x78d9('0x92'),_0x78d9('0x93'),_0x78d9('0x94')];var _0x14eb18=_0x2b6014[_0x78d9('0x95')](_0x1692da);return db[_0x78d9('0x2c')]['findOne']({'where':{'id':_0x5861b8[_0x78d9('0x44')]['id']},'attributes':['id',_0x78d9('0x96'),'password','remoteUri',_0x78d9('0x97'),_0x78d9('0x98'),_0x78d9('0x99')]})[_0x78d9('0x26')](handleEntityNotFound(_0x5b085b,null))['then'](function(_0x83efd1){if(_0x83efd1){_0x1513ab=_0x83efd1['remoteUri'];var _0x378a83=_0x1513ab[_0x78d9('0x9a')](-0x1);if(_0x378a83==='/'){_0x1513ab=_0x1513ab[_0x78d9('0x9b')](0x0,_0x1513ab[_0x78d9('0x9c')](_0x378a83));}_0x3f33a3=util[_0x78d9('0x9d')]('%s/api/data/v9.0/',_0x1513ab);var _0x20438b={'method':_0x78d9('0x9e'),'uri':'https://login.microsoftonline.com/'+_0x83efd1[_0x78d9('0x97')]+_0x78d9('0x9f'),'form':{'client_id':_0x83efd1[_0x78d9('0x98')],'resource':_0x1513ab,'username':_0x83efd1['username'],'password':_0x83efd1['password'],'grant_type':'password','client_secret':_0x83efd1[_0x78d9('0x99')]},'json':!![]};return rp(_0x20438b);}})['then'](function(_0x4dffd1){_0x1522c5=_0x4dffd1[_0x78d9('0xa0')];var _0x633137={'method':_0x78d9('0xa1'),'uri':encodeURI(_0x3f33a3+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x46b996+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1522c5,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x633137);})[_0x78d9('0x26')](function(_0x4fc8a3){var _0xe7d85c=_0x4fc8a3[_0x78d9('0xa3')][0x0];var _0x5bc62f=_0xe7d85c[_0x78d9('0xa4')];var _0x17901e={'method':_0x78d9('0xa1'),'uri':_0x3f33a3+_0x78d9('0xa5')+_0x5bc62f+_0x78d9('0xa6'),'headers':{'Authorization':_0x78d9('0xa7')+_0x1522c5,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x17901e);})[_0x78d9('0x26')](function(_0x200022){_0x7b79f9=_0x200022;_0xbf6eee=_0x7b79f9['Attributes'];_0xbf6eee=_[_0x78d9('0xa8')](_0xbf6eee,function(_0x3126fc){return!_0x14eb18['includes'](_0x3126fc[_0x78d9('0xa9')]);});var _0x3064ec=[];var _0x2a3c40=[];_0xbf6eee[_0x78d9('0xaa')](function(_0x2a0afd){if(_0x2a0afd[_0x78d9('0xab')]){var _0x1bef3e=_0x2a0afd[_0x78d9('0xab')]['substring'](_0x2a0afd[_0x78d9('0xab')]['lastIndexOf']('.')+0x1);if(_0x1bef3e===_0x78d9('0xac')){_0x3064ec[_0x78d9('0xad')](getSelectList(_0x3f33a3,_0x18e3d9,_0x2a3c40,_0x7b79f9[_0x78d9('0xa4')],_0x2a0afd['MetadataId'],_0x1522c5));}}});return Promise[_0x78d9('0xae')](_0x3064ec);})[_0x78d9('0x26')](function(_0x275b4e){_0x63a23a=_0x275b4e[0x0];var _0x2c0bb8=[];var _0x43d91a=[];_0xbf6eee[_0x78d9('0xaa')](function(_0x295d42){if(!_[_0x78d9('0xaf')](_0x295d42[_0x78d9('0xab')])){var _0x12e6da=_0x295d42[_0x78d9('0xab')][_0x78d9('0x9b')](_0x295d42[_0x78d9('0xab')][_0x78d9('0x9c')]('.')+0x1);if(_0x12e6da===_0x78d9('0xb0')){_0x2c0bb8[_0x78d9('0xad')](getBooleanList(_0x3f33a3,_0x18e3d9,_0x43d91a,_0x7b79f9[_0x78d9('0xa4')],_0x295d42[_0x78d9('0xa4')],_0x1522c5));}}});return Promise[_0x78d9('0xae')](_0x2c0bb8);})[_0x78d9('0x26')](function(_0x529af7){_0x1c92ef=_0x529af7[0x0];var _0x558a97=[];var _0x2a0ba8=[];_0xbf6eee[_0x78d9('0xaa')](function(_0x51d692){if(_0x51d692[_0x78d9('0xab')]){var _0x48326b=_0x51d692[_0x78d9('0xab')][_0x78d9('0x9b')](_0x51d692[_0x78d9('0xab')][_0x78d9('0x9c')]('.')+0x1);if(_0x48326b===_0x78d9('0xb1')||_0x48326b==='DoubleAttributeMetadata'||_0x48326b===_0x78d9('0xb2')||_0x48326b===_0x78d9('0xb3')||_0x48326b==='MemoAttributeMetadata'||_0x48326b===_0x78d9('0xb4')||_0x48326b===_0x78d9('0xb5')||_0x48326b===_0x78d9('0xb6')||_0x48326b==='StateAttributeMetadata'||_0x48326b===_0x78d9('0xb7')){_0x558a97[_0x78d9('0xad')](getInputList(_0x3f33a3,_0x18e3d9,_0x48326b,_0x2a0ba8,_0x7b79f9[_0x78d9('0xa4')],_0x51d692['MetadataId'],_0x1522c5));}}});return Promise[_0x78d9('0xae')](_0x558a97);})[_0x78d9('0x26')](function(_0x1740a0){_0x2252b2=_0x1740a0[0x0];var _0x5e6da2=_0x63a23a['concat'](_0x1c92ef)[_0x78d9('0x95')](_0x2252b2);var _0x4112e3={'count':_0x5e6da2[_0x78d9('0x37')],'rows':_0x5e6da2};return _0x4112e3;})[_0x78d9('0x26')](respondWithResult(_0x5b085b,null))[_0x78d9('0x42')](function(_0x132173){var _0x4d76c9=_0x5861b8[_0x78d9('0x32')][_0x78d9('0xb8')]?0x1f4:_0x132173['statusCode']||0x1f4;logger['error'](_0x132173['stack']);delete _0x132173['name'];if(_0x4d76c9===0x191){_0x4d76c9=0x190;}_0x5b085b[_0x78d9('0x19')](_0x4d76c9)[_0x78d9('0x29')](_0x5861b8[_0x78d9('0x32')][_0x78d9('0xb8')]?{'message':_0x78d9('0xb9'),'statusCode':_0x132173[_0x78d9('0xba')]}:_0x132173);});};function getSelectList(_0x15d63a,_0x233999,_0x526f31,_0x1b4a70,_0x5b56aa,_0x424aa8){var _0x4356d3={'method':_0x78d9('0xa1'),'uri':_0x15d63a+_0x78d9('0xa5')+_0x1b4a70+')/Attributes('+_0x5b56aa+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x78d9('0xbb'),'headers':{'Authorization':_0x78d9('0xa7')+_0x424aa8,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x4356d3)['then'](function(_0x268d51){var _0x43e882=[];var _0x202b34=_0x268d51[_0x78d9('0xbc')][_0x78d9('0xbd')];_0x202b34[_0x78d9('0xaa')](function(_0x3c4df0){_0x43e882[_0x78d9('0xad')]({'name':_0x3c4df0[_0x78d9('0xbe')][_0x78d9('0xbf')][_0x78d9('0xbe')],'value':String(_0x3c4df0[_0x78d9('0xc0')])});});var _0xab6210={'id':_0x233999+'_'+_0x268d51[_0x78d9('0xa9')],'name':_0x268d51['DisplayName']['UserLocalizedLabel'][_0x78d9('0xbe')],'custom':![],'options':_0x43e882};_0x526f31[_0x78d9('0xad')](_0xab6210);return _0x526f31;});}function getBooleanList(_0x56df6d,_0x54927f,_0x433384,_0x26e1a0,_0x329d0f,_0x5c2445){var _0x522138={'method':_0x78d9('0xa1'),'uri':_0x56df6d+'EntityDefinitions('+_0x26e1a0+_0x78d9('0xc1')+_0x329d0f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x78d9('0xa7')+_0x5c2445,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x522138)[_0x78d9('0x26')](function(_0x178c87){var _0x432305=[];_0x432305[_0x78d9('0xad')]({'name':_0x178c87[_0x78d9('0xbc')][_0x78d9('0xc2')][_0x78d9('0xbe')][_0x78d9('0xbf')][_0x78d9('0xbe')],'value':_0x78d9('0xc3')},{'name':_0x178c87[_0x78d9('0xbc')]['FalseOption'][_0x78d9('0xbe')]['UserLocalizedLabel']['Label'],'value':'false'});var _0x394826={'id':_0x54927f+'_'+_0x178c87[_0x78d9('0xa9')],'name':_0x178c87[_0x78d9('0xc4')]['UserLocalizedLabel'][_0x78d9('0xbe')],'custom':![],'options':_0x432305};_0x433384[_0x78d9('0xad')](_0x394826);return _0x433384;});}function getInputList(_0x221259,_0x4189dc,_0x5051c7,_0x35e16a,_0x3b43b6,_0x257ef9,_0x5a7b39){var _0x36f6e5={'method':_0x78d9('0xa1'),'uri':_0x221259+'EntityDefinitions('+_0x3b43b6+_0x78d9('0xc1')+_0x257ef9+')/Microsoft.Dynamics.CRM.'+_0x5051c7+_0x78d9('0xc5'),'headers':{'Authorization':_0x78d9('0xa7')+_0x5a7b39,'If-None-Match':null,'OData-Version':_0x78d9('0xa2')},'json':!![]};return rp(_0x36f6e5)[_0x78d9('0x26')](function(_0x5490c0){var _0x29f0b9={'id':_0x4189dc+'_'+_0x5490c0['LogicalName'],'name':_0x5490c0[_0x78d9('0xc4')][_0x78d9('0xbf')]?_0x5490c0[_0x78d9('0xc4')][_0x78d9('0xbf')][_0x78d9('0xbe')]:_0x5490c0[_0x78d9('0xa9')],'custom':![],'options':[]};_0x35e16a[_0x78d9('0xad')](_0x29f0b9);return _0x35e16a;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 03145db..08ccd1e 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d9bd8,_0x24580a){var _0x4c3a94=function(_0x52100e){while(--_0x52100e){_0x5d9bd8['push'](_0x5d9bd8['shift']());}};_0x4c3a94(++_0x24580a);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'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(_0x1a445a,_0x1ab424){var _0x5822a9=function(_0x4ce042){while(--_0x4ce042){_0x1a445a['push'](_0x1a445a['shift']());}};_0x5822a9(++_0x1ab424);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));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 c3bc947..3e1afa1 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 _0x17e8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','attributes','map','model','include','then','ShowDynamics365Account','find','where','lodash','util','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x17e8,0x19f));var _0x817e=function(_0x3f85cb,_0x4e6a8f){_0x3f85cb=_0x3f85cb-0x0;var _0x205635=_0x17e8[_0x3f85cb];return _0x205635;};'use strict';var _=require(_0x817e('0x0'));var util=require(_0x817e('0x1'));var moment=require(_0x817e('0x2'));var BPromise=require(_0x817e('0x3'));var rs=require(_0x817e('0x4'));var fs=require('fs');var Redis=require(_0x817e('0x5'));var db=require(_0x817e('0x6'))['db'];var utils=require(_0x817e('0x7'));var logger=require(_0x817e('0x8'))(_0x817e('0x9'));var config=require(_0x817e('0xa'));var jayson=require(_0x817e('0xb'));var client=jayson[_0x817e('0xc')][_0x817e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f20e8,_0x2a4ad7,_0x439667){return new BPromise(function(_0x461f95,_0x3cc77d){return client[_0x817e('0xe')](_0x4f20e8,_0x439667)['then'](function(_0x20c0f0){logger[_0x817e('0xf')](_0x817e('0x10'),_0x2a4ad7,_0x817e('0x11'));logger[_0x817e('0x12')](_0x817e('0x13'),_0x2a4ad7,_0x817e('0x11'),JSON[_0x817e('0x14')](_0x20c0f0));if(_0x20c0f0[_0x817e('0x15')]){if(_0x20c0f0[_0x817e('0x15')][_0x817e('0x16')]===0x1f4){logger['error'](_0x817e('0x10'),_0x2a4ad7,_0x20c0f0[_0x817e('0x15')][_0x817e('0x17')]);return _0x3cc77d(_0x20c0f0[_0x817e('0x15')][_0x817e('0x17')]);}logger['error'](_0x817e('0x10'),_0x2a4ad7,_0x20c0f0[_0x817e('0x15')]['message']);return _0x461f95(_0x20c0f0[_0x817e('0x15')]['message']);}else{logger[_0x817e('0xf')](_0x817e('0x10'),_0x2a4ad7,_0x817e('0x11'));_0x461f95(_0x20c0f0[_0x817e('0x18')][_0x817e('0x17')]);}})[_0x817e('0x19')](function(_0x584d79){logger['error'](_0x817e('0x10'),_0x2a4ad7,_0x584d79);_0x3cc77d(_0x584d79);});});}exports[_0x817e('0x1a')]=function(_0x214148){var _0x39034c=this;return new Promise(function(_0x3451ff,_0x103887){return db['Dynamics365Account'][_0x817e('0x1b')]({'raw':_0x214148[_0x817e('0x1c')]?_0x214148['options'][_0x817e('0x1d')]===undefined?!![]:![]:!![],'where':_0x214148['options']?_0x214148[_0x817e('0x1c')]['where']||null:null,'attributes':_0x214148[_0x817e('0x1c')]?_0x214148['options'][_0x817e('0x1e')]||null:null,'limit':_0x214148[_0x817e('0x1c')]?_0x214148['options']['limit']||null:null,'include':_0x214148['options']?_0x214148[_0x817e('0x1c')]['include']?_[_0x817e('0x1f')](_0x214148[_0x817e('0x1c')]['include'],function(_0x1c90a3){return{'model':db[_0x1c90a3[_0x817e('0x20')]],'as':_0x1c90a3['as'],'attributes':_0x1c90a3[_0x817e('0x1e')],'include':_0x1c90a3['include']?_[_0x817e('0x1f')](_0x1c90a3['include'],function(_0x771dad){return{'model':db[_0x771dad[_0x817e('0x20')]],'as':_0x771dad['as'],'attributes':_0x771dad['attributes'],'include':_0x771dad['include']?_[_0x817e('0x1f')](_0x771dad[_0x817e('0x21')],function(_0x34a36e){return{'model':db[_0x34a36e['model']],'as':_0x34a36e['as'],'attributes':_0x34a36e[_0x817e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x817e('0x22')](function(_0x97157b){logger[_0x817e('0xf')]('GetDynamics365Account',_0x214148);logger[_0x817e('0x12')]('GetDynamics365Account',_0x214148,JSON['stringify'](_0x97157b));_0x3451ff(_0x97157b);})[_0x817e('0x19')](function(_0x4ff4f9){logger[_0x817e('0x15')](_0x817e('0x1a'),_0x4ff4f9[_0x817e('0x17')],_0x214148);_0x103887(_0x39034c['error'](0x1f4,_0x4ff4f9[_0x817e('0x17')]));});});};exports[_0x817e('0x23')]=function(_0x1dd604){var _0x85f59f=this;return new Promise(function(_0x5b07c8,_0xe802d4){return db['Dynamics365Account'][_0x817e('0x24')]({'raw':_0x1dd604[_0x817e('0x1c')]?_0x1dd604['options'][_0x817e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1dd604[_0x817e('0x1c')]?_0x1dd604[_0x817e('0x1c')][_0x817e('0x25')]||null:null,'attributes':_0x1dd604[_0x817e('0x1c')]?_0x1dd604[_0x817e('0x1c')][_0x817e('0x1e')]||null:null,'include':_0x1dd604['options']?_0x1dd604[_0x817e('0x1c')][_0x817e('0x21')]?_[_0x817e('0x1f')](_0x1dd604[_0x817e('0x1c')]['include'],function(_0x3e6f96){return{'model':db[_0x3e6f96[_0x817e('0x20')]],'as':_0x3e6f96['as'],'attributes':_0x3e6f96[_0x817e('0x1e')],'include':_0x3e6f96[_0x817e('0x21')]?_[_0x817e('0x1f')](_0x3e6f96['include'],function(_0x8577f0){return{'model':db[_0x8577f0[_0x817e('0x20')]],'as':_0x8577f0['as'],'attributes':_0x8577f0[_0x817e('0x1e')],'include':_0x8577f0[_0x817e('0x21')]?_[_0x817e('0x1f')](_0x8577f0[_0x817e('0x21')],function(_0x24a6b9){return{'model':db[_0x24a6b9[_0x817e('0x20')]],'as':_0x24a6b9['as'],'attributes':_0x24a6b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x817e('0x22')](function(_0x105fc7){logger[_0x817e('0xf')](_0x817e('0x23'),_0x1dd604);logger[_0x817e('0x12')](_0x817e('0x23'),_0x1dd604,JSON[_0x817e('0x14')](_0x105fc7));_0x5b07c8(_0x105fc7);})[_0x817e('0x19')](function(_0x2b2cda){logger[_0x817e('0x15')](_0x817e('0x23'),_0x2b2cda[_0x817e('0x17')],_0x1dd604);_0xe802d4(_0x85f59f['error'](0x1f4,_0x2b2cda[_0x817e('0x17')]));});});}; \ No newline at end of file +var _0xca55=['ShowDynamics365Account','where','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','model','map','then','stringify','catch'];(function(_0x37ae2e,_0x35be3a){var _0x19c50f=function(_0x49732a){while(--_0x49732a){_0x37ae2e['push'](_0x37ae2e['shift']());}};_0x19c50f(++_0x35be3a);}(_0xca55,0x10a));var _0x5ca5=function(_0x1b346a,_0x3474da){_0x1b346a=_0x1b346a-0x0;var _0x2f5c0e=_0xca55[_0x1b346a];return _0x2f5c0e;};'use strict';var _=require(_0x5ca5('0x0'));var util=require(_0x5ca5('0x1'));var moment=require(_0x5ca5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ca5('0x3'));var db=require(_0x5ca5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ca5('0x5'))(_0x5ca5('0x6'));var config=require(_0x5ca5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ca5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d0171,_0x385aa3,_0x28cea9){return new BPromise(function(_0x29a6aa,_0x1b6d26){return client[_0x5ca5('0x9')](_0x4d0171,_0x28cea9)['then'](function(_0x127802){logger[_0x5ca5('0xa')](_0x5ca5('0xb'),_0x385aa3,_0x5ca5('0xc'));logger[_0x5ca5('0xd')](_0x5ca5('0xe'),_0x385aa3,_0x5ca5('0xc'),JSON['stringify'](_0x127802));if(_0x127802[_0x5ca5('0xf')]){if(_0x127802['error'][_0x5ca5('0x10')]===0x1f4){logger['error'](_0x5ca5('0xb'),_0x385aa3,_0x127802['error']['message']);return _0x1b6d26(_0x127802[_0x5ca5('0xf')]['message']);}logger[_0x5ca5('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x385aa3,_0x127802[_0x5ca5('0xf')][_0x5ca5('0x11')]);return _0x29a6aa(_0x127802[_0x5ca5('0xf')]['message']);}else{logger[_0x5ca5('0xa')](_0x5ca5('0xb'),_0x385aa3,_0x5ca5('0xc'));_0x29a6aa(_0x127802[_0x5ca5('0x12')][_0x5ca5('0x11')]);}})['catch'](function(_0x12bf33){logger[_0x5ca5('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x385aa3,_0x12bf33);_0x1b6d26(_0x12bf33);});});}exports[_0x5ca5('0x13')]=function(_0x5e50a8){var _0x49687d=this;return new Promise(function(_0x4d9fcb,_0x269f65){return db[_0x5ca5('0x14')][_0x5ca5('0x15')]({'raw':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')][_0x5ca5('0x17')]===undefined?!![]:![]:!![],'where':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')]['where']||null:null,'attributes':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')][_0x5ca5('0x18')]||null:null,'limit':_0x5e50a8['options']?_0x5e50a8['options']['limit']||null:null,'include':_0x5e50a8[_0x5ca5('0x16')]?_0x5e50a8[_0x5ca5('0x16')][_0x5ca5('0x19')]?_['map'](_0x5e50a8[_0x5ca5('0x16')]['include'],function(_0xd780c7){return{'model':db[_0xd780c7[_0x5ca5('0x1a')]],'as':_0xd780c7['as'],'attributes':_0xd780c7[_0x5ca5('0x18')],'include':_0xd780c7['include']?_[_0x5ca5('0x1b')](_0xd780c7['include'],function(_0x40de62){return{'model':db[_0x40de62[_0x5ca5('0x1a')]],'as':_0x40de62['as'],'attributes':_0x40de62['attributes'],'include':_0x40de62['include']?_['map'](_0x40de62['include'],function(_0x249893){return{'model':db[_0x249893[_0x5ca5('0x1a')]],'as':_0x249893['as'],'attributes':_0x249893[_0x5ca5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5ca5('0x1c')](function(_0x14c177){logger[_0x5ca5('0xa')]('GetDynamics365Account',_0x5e50a8);logger[_0x5ca5('0xd')](_0x5ca5('0x13'),_0x5e50a8,JSON[_0x5ca5('0x1d')](_0x14c177));_0x4d9fcb(_0x14c177);})[_0x5ca5('0x1e')](function(_0x3319ae){logger['error'](_0x5ca5('0x13'),_0x3319ae[_0x5ca5('0x11')],_0x5e50a8);_0x269f65(_0x49687d['error'](0x1f4,_0x3319ae[_0x5ca5('0x11')]));});});};exports[_0x5ca5('0x1f')]=function(_0x39a2a5){var _0x5b3513=this;return new Promise(function(_0x87cef5,_0x408dd4){return db[_0x5ca5('0x14')]['find']({'raw':_0x39a2a5['options']?_0x39a2a5[_0x5ca5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x39a2a5[_0x5ca5('0x16')]?_0x39a2a5[_0x5ca5('0x16')][_0x5ca5('0x20')]||null:null,'attributes':_0x39a2a5[_0x5ca5('0x16')]?_0x39a2a5[_0x5ca5('0x16')][_0x5ca5('0x18')]||null:null,'include':_0x39a2a5[_0x5ca5('0x16')]?_0x39a2a5[_0x5ca5('0x16')][_0x5ca5('0x19')]?_[_0x5ca5('0x1b')](_0x39a2a5[_0x5ca5('0x16')]['include'],function(_0x2a96b4){return{'model':db[_0x2a96b4[_0x5ca5('0x1a')]],'as':_0x2a96b4['as'],'attributes':_0x2a96b4['attributes'],'include':_0x2a96b4[_0x5ca5('0x19')]?_[_0x5ca5('0x1b')](_0x2a96b4['include'],function(_0x3e0fd8){return{'model':db[_0x3e0fd8[_0x5ca5('0x1a')]],'as':_0x3e0fd8['as'],'attributes':_0x3e0fd8[_0x5ca5('0x18')],'include':_0x3e0fd8[_0x5ca5('0x19')]?_[_0x5ca5('0x1b')](_0x3e0fd8[_0x5ca5('0x19')],function(_0x1e27bb){return{'model':db[_0x1e27bb[_0x5ca5('0x1a')]],'as':_0x1e27bb['as'],'attributes':_0x1e27bb[_0x5ca5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x274b34){logger[_0x5ca5('0xa')](_0x5ca5('0x1f'),_0x39a2a5);logger[_0x5ca5('0xd')]('ShowDynamics365Account',_0x39a2a5,JSON[_0x5ca5('0x1d')](_0x274b34));_0x87cef5(_0x274b34);})[_0x5ca5('0x1e')](function(_0x72404e){logger[_0x5ca5('0xf')](_0x5ca5('0x1f'),_0x72404e[_0x5ca5('0x11')],_0x39a2a5);_0x408dd4(_0x5b3513[_0x5ca5('0xf')](0x1f4,_0x72404e[_0x5ca5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9f999ac..d18d99c 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 _0x3077=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/fields','getFields'];(function(_0x30f7bc,_0x16df26){var _0x196db6=function(_0x1615a8){while(--_0x1615a8){_0x30f7bc['push'](_0x30f7bc['shift']());}};_0x196db6(++_0x16df26);}(_0x3077,0x144));var _0x7307=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x3077[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x7307('0x0'));var util=require('util');var path=require(_0x7307('0x1'));var timeout=require('connect-timeout');var express=require(_0x7307('0x2'));var router=express['Router']();var fs_extra=require(_0x7307('0x3'));var auth=require(_0x7307('0x4'));var interaction=require(_0x7307('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7307('0x6')](_0x7307('0x7'),auth[_0x7307('0x8')](),controller[_0x7307('0x9')]);router[_0x7307('0x6')](_0x7307('0xa'),auth[_0x7307('0x8')](),controller[_0x7307('0xb')]);router[_0x7307('0x6')](_0x7307('0xc'),auth[_0x7307('0x8')](),controller['getSubjects']);router['get'](_0x7307('0xd'),auth[_0x7307('0x8')](),controller[_0x7307('0xe')]);router[_0x7307('0xf')]('/',auth[_0x7307('0x8')](),controller[_0x7307('0x10')]);router[_0x7307('0x11')](_0x7307('0x7'),auth[_0x7307('0x8')](),controller[_0x7307('0x12')]);router[_0x7307('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7307('0x14')]);module['exports']=router; \ No newline at end of file +var _0x69c5=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5bf80e,_0x3120e2){var _0xd5da57=function(_0x40d795){while(--_0x40d795){_0x5bf80e['push'](_0x5bf80e['shift']());}};_0xd5da57(++_0x3120e2);}(_0x69c5,0xad));var _0x569c=function(_0x3aa16a,_0x433af5){_0x3aa16a=_0x3aa16a-0x0;var _0x5bbd6f=_0x69c5[_0x3aa16a];return _0x5bbd6f;};'use strict';var multer=require(_0x569c('0x0'));var util=require(_0x569c('0x1'));var path=require(_0x569c('0x2'));var timeout=require(_0x569c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x569c('0x4'));var auth=require(_0x569c('0x5'));var interaction=require(_0x569c('0x6'));var config=require(_0x569c('0x7'));var controller=require(_0x569c('0x8'));router[_0x569c('0x9')]('/',auth[_0x569c('0xa')](),controller[_0x569c('0xb')]);router[_0x569c('0x9')]('/:id',auth[_0x569c('0xa')](),controller[_0x569c('0xc')]);router[_0x569c('0x9')](_0x569c('0xd'),auth[_0x569c('0xa')](),controller[_0x569c('0xe')]);router[_0x569c('0x9')]('/:id/subjects',auth[_0x569c('0xa')](),controller[_0x569c('0xf')]);router[_0x569c('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x569c('0x10')]);router[_0x569c('0x11')]('/',auth[_0x569c('0xa')](),controller[_0x569c('0x12')]);router[_0x569c('0x13')](_0x569c('0x14'),auth['isAuthenticated'](),controller[_0x569c('0x15')]);router[_0x569c('0x16')](_0x569c('0x14'),auth['isAuthenticated'](),controller[_0x569c('0x17')]);module[_0x569c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index cbfcbd2..c4a82b1 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 _0x2000=['ENUM','incident','phonecall','contact','sequelize','exports','STRING'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x2000,0x97));var _0x0200=function(_0x1a920b,_0x28bcb4){_0x1a920b=_0x1a920b-0x0;var _0x868d37=_0x2000[_0x1a920b];return _0x868d37;};'use strict';var Sequelize=require(_0x0200('0x0'));module[_0x0200('0x1')]={'name':{'type':Sequelize[_0x0200('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x0200('0x3')](_0x0200('0x4'),_0x0200('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x0200('0x3')](_0x0200('0x6'),'nothing'),'defaultValue':_0x0200('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x91fd=['sequelize','exports','STRING','ENUM','phonecall','incident','nothing','contact'];(function(_0x3b9398,_0x2b384a){var _0x43511d=function(_0x3e8eb2){while(--_0x3e8eb2){_0x3b9398['push'](_0x3b9398['shift']());}};_0x43511d(++_0x2b384a);}(_0x91fd,0x1f0));var _0xd91f=function(_0x552d65,_0xaed719){_0x552d65=_0x552d65-0x0;var _0x52d97c=_0x91fd[_0x552d65];return _0x52d97c;};'use strict';var Sequelize=require(_0xd91f('0x0'));module[_0xd91f('0x1')]={'name':{'type':Sequelize[_0xd91f('0x2')]},'description':{'type':Sequelize[_0xd91f('0x2')]},'ticketType':{'type':Sequelize[_0xd91f('0x3')]('incident',_0xd91f('0x4')),'defaultValue':_0xd91f('0x5')},'moduleCreate':{'type':Sequelize[_0xd91f('0x3')]('contact',_0xd91f('0x6')),'defaultValue':_0xd91f('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c4fe02b..fcf65f5 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 _0x13a4=['find','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','length','create','body'];(function(_0x248928,_0x5c8687){var _0x114776=function(_0xfb9be){while(--_0xfb9be){_0x248928['push'](_0x248928['shift']());}};_0x114776(++_0x5c8687);}(_0x13a4,0x1f3));var _0x413a=function(_0x105de2,_0x296c8b){_0x105de2=_0x105de2-0x0;var _0x13d7a9=_0x13a4[_0x105de2];return _0x13d7a9;};'use strict';var emlformat=require(_0x413a('0x0'));var rimraf=require(_0x413a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x413a('0x2'));var rp=require(_0x413a('0x3'));var moment=require('moment');var BPromise=require(_0x413a('0x4'));var Mustache=require(_0x413a('0x5'));var util=require(_0x413a('0x6'));var path=require(_0x413a('0x7'));var sox=require(_0x413a('0x8'));var csv=require('to-csv');var ejs=require(_0x413a('0x9'));var fs=require('fs');var fs_extra=require(_0x413a('0xa'));var _=require(_0x413a('0xb'));var squel=require(_0x413a('0xc'));var crypto=require(_0x413a('0xd'));var jsforce=require(_0x413a('0xe'));var deskjs=require(_0x413a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x413a('0x10'));var authService=require(_0x413a('0x11'));var qs=require(_0x413a('0x12'));var as=require(_0x413a('0x13'));var hardwareService=require(_0x413a('0x14'));var logger=require(_0x413a('0x15'))(_0x413a('0x16'));var utils=require(_0x413a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x413a('0x18'))['db'];function respondWithStatusCode(_0x52b62a,_0x33a99f){_0x33a99f=_0x33a99f||0xcc;return function(_0x16e5e6){if(_0x16e5e6){return _0x52b62a['sendStatus'](_0x33a99f);}return _0x52b62a[_0x413a('0x19')](_0x33a99f)[_0x413a('0x1a')]();};}function respondWithResult(_0x1728df,_0x25036f){_0x25036f=_0x25036f||0xc8;return function(_0x5d4569){if(_0x5d4569){return _0x1728df[_0x413a('0x19')](_0x25036f)[_0x413a('0x1b')](_0x5d4569);}};}function respondWithFilteredResult(_0x1166b6,_0x5267f9){return function(_0x52e9c7){if(_0x52e9c7){var _0x32f90b=typeof _0x5267f9[_0x413a('0x1c')]==='undefined'&&typeof _0x5267f9[_0x413a('0x1d')]===_0x413a('0x1e');var _0x8f53e2=_0x52e9c7['count'];var _0x534041=_0x32f90b?0x0:_0x5267f9['offset'];var _0x5f3073=_0x32f90b?_0x52e9c7[_0x413a('0x1f')]:_0x5267f9[_0x413a('0x1c')]+_0x5267f9['limit'];var _0x3e4ef4;if(_0x5f3073>=_0x8f53e2){_0x5f3073=_0x8f53e2;_0x3e4ef4=0xc8;}else{_0x3e4ef4=0xce;}_0x1166b6['status'](_0x3e4ef4);return _0x1166b6[_0x413a('0x20')](_0x413a('0x21'),_0x534041+'-'+_0x5f3073+'/'+_0x8f53e2)[_0x413a('0x1b')](_0x52e9c7);}return null;};}function patchUpdates(_0x283d14){return function(_0x39bb1a){try{jsonpatch[_0x413a('0x22')](_0x39bb1a,_0x283d14,!![]);}catch(_0x4c7a6e){return BPromise[_0x413a('0x23')](_0x4c7a6e);}return _0x39bb1a[_0x413a('0x24')]();};}function saveUpdates(_0x32d941,_0x58d9e7){return function(_0x1066cb){if(_0x1066cb){return _0x1066cb[_0x413a('0x25')](_0x32d941)[_0x413a('0x26')](function(_0x3d3352){return _0x3d3352;});}return null;};}function removeEntity(_0x3cce3e,_0x281f04){return function(_0x3dc7a0){if(_0x3dc7a0){return _0x3dc7a0[_0x413a('0x27')]()[_0x413a('0x26')](function(){_0x3cce3e['status'](0xcc)[_0x413a('0x1a')]();});}};}function handleEntityNotFound(_0x59c61d,_0x372aa3){return function(_0x3b20fa){if(!_0x3b20fa){_0x59c61d['sendStatus'](0x194);}return _0x3b20fa;};}function handleError(_0x136cd9,_0x502e9f){_0x502e9f=_0x502e9f||0x1f4;return function(_0x2a110a){logger[_0x413a('0x28')](_0x2a110a[_0x413a('0x29')]);if(_0x2a110a['name']){delete _0x2a110a[_0x413a('0x2a')];}_0x136cd9[_0x413a('0x19')](_0x502e9f)[_0x413a('0x2b')](_0x2a110a);};}exports[_0x413a('0x2c')]=function(_0x41fd5f,_0x55ef0f){var _0x51706f={},_0x320ab3={},_0x5f1591={'count':0x0,'rows':[]};var _0x39a8ee=_['map'](db[_0x413a('0x2d')][_0x413a('0x2e')],function(_0x1455d3){return{'name':_0x1455d3['fieldName'],'type':_0x1455d3['type'][_0x413a('0x2f')]};});_0x320ab3[_0x413a('0x30')]=_['map'](_0x39a8ee,_0x413a('0x2a'));_0x320ab3[_0x413a('0x31')]=_[_0x413a('0x32')](_0x41fd5f[_0x413a('0x31')]);_0x320ab3[_0x413a('0x33')]=_[_0x413a('0x34')](_0x320ab3['model'],_0x320ab3[_0x413a('0x31')]);_0x51706f[_0x413a('0x35')]=_[_0x413a('0x34')](_0x320ab3['model'],qs[_0x413a('0x36')](_0x41fd5f[_0x413a('0x31')][_0x413a('0x36')]));_0x51706f[_0x413a('0x35')]=_0x51706f['attributes']['length']?_0x51706f[_0x413a('0x35')]:_0x320ab3['model'];if(!_0x41fd5f['query'][_0x413a('0x37')](_0x413a('0x38'))){_0x51706f[_0x413a('0x1d')]=qs[_0x413a('0x1d')](_0x41fd5f[_0x413a('0x31')][_0x413a('0x1d')]);_0x51706f['offset']=qs['offset'](_0x41fd5f[_0x413a('0x31')][_0x413a('0x1c')]);}_0x51706f[_0x413a('0x39')]=qs[_0x413a('0x3a')](_0x41fd5f[_0x413a('0x31')][_0x413a('0x3a')]);_0x51706f[_0x413a('0x3b')]=qs[_0x413a('0x33')](_[_0x413a('0x3c')](_0x41fd5f['query'],_0x320ab3[_0x413a('0x33')]),_0x39a8ee);if(_0x41fd5f[_0x413a('0x31')][_0x413a('0x3d')]){_0x51706f['where']=_[_0x413a('0x3e')](_0x51706f[_0x413a('0x3b')],{'$or':_[_0x413a('0x3f')](_0x39a8ee,function(_0x8884b4){if(_0x8884b4[_0x413a('0x40')]!=='VIRTUAL'){var _0x70b848={};_0x70b848[_0x8884b4[_0x413a('0x2a')]]={'$like':'%'+_0x41fd5f[_0x413a('0x31')][_0x413a('0x3d')]+'%'};return _0x70b848;}})});}_0x51706f=_[_0x413a('0x3e')]({},_0x51706f,_0x41fd5f[_0x413a('0x41')]);var _0x5415ff={'where':_0x51706f['where']};return db[_0x413a('0x2d')][_0x413a('0x1f')](_0x5415ff)[_0x413a('0x26')](function(_0x35f26e){_0x5f1591['count']=_0x35f26e;if(_0x41fd5f[_0x413a('0x31')][_0x413a('0x42')]){_0x51706f[_0x413a('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x413a('0x44')](_0x51706f);})['then'](function(_0x258642){_0x5f1591[_0x413a('0x45')]=_0x258642;return _0x5f1591;})['then'](respondWithFilteredResult(_0x55ef0f,_0x51706f))['catch'](handleError(_0x55ef0f,null));};exports[_0x413a('0x46')]=function(_0x4669ec,_0xacb104){var _0x2d9a37={'raw':![],'where':{'id':_0x4669ec[_0x413a('0x47')]['id']}},_0x311fa3={};_0x311fa3[_0x413a('0x30')]=_[_0x413a('0x32')](db[_0x413a('0x2d')]['rawAttributes']);_0x311fa3[_0x413a('0x31')]=_[_0x413a('0x32')](_0x4669ec[_0x413a('0x31')]);_0x311fa3[_0x413a('0x33')]=_[_0x413a('0x34')](_0x311fa3[_0x413a('0x30')],_0x311fa3[_0x413a('0x31')]);_0x2d9a37['attributes']=_[_0x413a('0x34')](_0x311fa3['model'],qs[_0x413a('0x36')](_0x4669ec[_0x413a('0x31')][_0x413a('0x36')]));_0x2d9a37[_0x413a('0x35')]=_0x2d9a37['attributes'][_0x413a('0x48')]?_0x2d9a37[_0x413a('0x35')]:_0x311fa3[_0x413a('0x30')];if(_0x4669ec[_0x413a('0x31')][_0x413a('0x42')]){_0x2d9a37[_0x413a('0x43')]=[{'all':!![]}];}_0x2d9a37=_[_0x413a('0x3e')]({},_0x2d9a37,_0x4669ec[_0x413a('0x41')]);return db[_0x413a('0x2d')]['find'](_0x2d9a37)[_0x413a('0x26')](handleEntityNotFound(_0xacb104,null))[_0x413a('0x26')](respondWithResult(_0xacb104,null))['catch'](handleError(_0xacb104,null));};exports[_0x413a('0x49')]=function(_0x21d4f8,_0x5d84a0){return db[_0x413a('0x2d')][_0x413a('0x49')](_0x21d4f8[_0x413a('0x4a')],{})[_0x413a('0x26')](respondWithResult(_0x5d84a0,0xc9))['catch'](handleError(_0x5d84a0,null));};exports[_0x413a('0x25')]=function(_0x324ea9,_0x3d4841){if(_0x324ea9[_0x413a('0x4a')]['id']){delete _0x324ea9[_0x413a('0x4a')]['id'];}return db[_0x413a('0x2d')][_0x413a('0x4b')]({'where':{'id':_0x324ea9['params']['id']}})['then'](handleEntityNotFound(_0x3d4841,null))[_0x413a('0x26')](saveUpdates(_0x324ea9[_0x413a('0x4a')],null))[_0x413a('0x26')](respondWithResult(_0x3d4841,null))[_0x413a('0x4c')](handleError(_0x3d4841,null));};exports[_0x413a('0x27')]=function(_0x1bb3bb,_0x4ee354){return db[_0x413a('0x2d')]['find']({'where':{'id':_0x1bb3bb['params']['id']}})[_0x413a('0x26')](handleEntityNotFound(_0x4ee354,null))[_0x413a('0x26')](removeEntity(_0x4ee354,null))['catch'](handleError(_0x4ee354,null));};exports[_0x413a('0x4d')]=function(_0x1504db,_0x37c8e5,_0x2cc7f6){var _0x1f802b={};var _0x18241c={};var _0x251c2b;var _0x4ec673;return db[_0x413a('0x2d')][_0x413a('0x4e')]({'where':{'id':_0x1504db[_0x413a('0x47')]['id']}})[_0x413a('0x26')](handleEntityNotFound(_0x37c8e5,null))[_0x413a('0x26')](function(_0x14f08f){if(_0x14f08f){_0x251c2b=_0x14f08f;_0x18241c[_0x413a('0x30')]=_[_0x413a('0x32')](db[_0x413a('0x4f')][_0x413a('0x2e')]);_0x18241c['query']=_['keys'](_0x1504db['query']);_0x18241c['filters']=_[_0x413a('0x34')](_0x18241c[_0x413a('0x30')],_0x18241c[_0x413a('0x31')]);_0x1f802b[_0x413a('0x35')]=_[_0x413a('0x34')](_0x18241c[_0x413a('0x30')],qs[_0x413a('0x36')](_0x1504db[_0x413a('0x31')][_0x413a('0x36')]));_0x1f802b[_0x413a('0x35')]=_0x1f802b[_0x413a('0x35')][_0x413a('0x48')]?_0x1f802b[_0x413a('0x35')]:_0x18241c[_0x413a('0x30')];_0x1f802b[_0x413a('0x39')]=qs[_0x413a('0x3a')](_0x1504db['query'][_0x413a('0x3a')]);_0x1f802b['where']=qs['filters'](_[_0x413a('0x3c')](_0x1504db[_0x413a('0x31')],_0x18241c[_0x413a('0x33')]));if(_0x1504db[_0x413a('0x31')][_0x413a('0x3d')]){_0x1f802b[_0x413a('0x3b')]=_[_0x413a('0x3e')](_0x1f802b[_0x413a('0x3b')],{'$or':_[_0x413a('0x3f')](_0x1f802b[_0x413a('0x35')],function(_0x1311b2){var _0x2280f2={};_0x2280f2[_0x1311b2]={'$like':'%'+_0x1504db[_0x413a('0x31')][_0x413a('0x3d')]+'%'};return _0x2280f2;})});}_0x1f802b=_['merge']({},_0x1f802b,_0x1504db[_0x413a('0x41')]);return _0x251c2b[_0x413a('0x4d')](_0x1f802b);}})[_0x413a('0x26')](function(_0x3240dc){if(_0x3240dc){_0x4ec673=_0x3240dc[_0x413a('0x48')];if(!_0x1504db[_0x413a('0x31')]['hasOwnProperty']('nolimit')){_0x1f802b[_0x413a('0x1d')]=qs[_0x413a('0x1d')](_0x1504db[_0x413a('0x31')][_0x413a('0x1d')]);_0x1f802b['offset']=qs[_0x413a('0x1c')](_0x1504db[_0x413a('0x31')][_0x413a('0x1c')]);}return _0x251c2b[_0x413a('0x4d')](_0x1f802b);}})[_0x413a('0x26')](function(_0x4804ad){if(_0x4804ad){return _0x4804ad?{'count':_0x4ec673,'rows':_0x4804ad}:null;}})[_0x413a('0x26')](respondWithResult(_0x37c8e5,null))['catch'](handleError(_0x37c8e5,null));};exports[_0x413a('0x50')]=function(_0x2f2d22,_0x2d49bc,_0x4bf9fe){var _0x596e38={};var _0x1ea59b={};var _0xbbb8f3;var _0x572ae1;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2f2d22[_0x413a('0x47')]['id']}})[_0x413a('0x26')](handleEntityNotFound(_0x2d49bc,null))['then'](function(_0x36b11a){if(_0x36b11a){_0xbbb8f3=_0x36b11a;_0x1ea59b[_0x413a('0x30')]=_[_0x413a('0x32')](db[_0x413a('0x4f')]['rawAttributes']);_0x1ea59b[_0x413a('0x31')]=_[_0x413a('0x32')](_0x2f2d22[_0x413a('0x31')]);_0x1ea59b[_0x413a('0x33')]=_[_0x413a('0x34')](_0x1ea59b[_0x413a('0x30')],_0x1ea59b[_0x413a('0x31')]);_0x596e38[_0x413a('0x35')]=_[_0x413a('0x34')](_0x1ea59b[_0x413a('0x30')],qs['fields'](_0x2f2d22[_0x413a('0x31')][_0x413a('0x36')]));_0x596e38[_0x413a('0x35')]=_0x596e38['attributes'][_0x413a('0x48')]?_0x596e38[_0x413a('0x35')]:_0x1ea59b[_0x413a('0x30')];_0x596e38['order']=qs['sort'](_0x2f2d22[_0x413a('0x31')][_0x413a('0x3a')]);_0x596e38[_0x413a('0x3b')]=qs[_0x413a('0x33')](_[_0x413a('0x3c')](_0x2f2d22[_0x413a('0x31')],_0x1ea59b[_0x413a('0x33')]));if(_0x2f2d22['query'][_0x413a('0x3d')]){_0x596e38[_0x413a('0x3b')]=_[_0x413a('0x3e')](_0x596e38['where'],{'$or':_[_0x413a('0x3f')](_0x596e38[_0x413a('0x35')],function(_0x20f565){var _0x5e0b29={};_0x5e0b29[_0x20f565]={'$like':'%'+_0x2f2d22['query'][_0x413a('0x3d')]+'%'};return _0x5e0b29;})});}_0x596e38=_[_0x413a('0x3e')]({},_0x596e38,_0x2f2d22[_0x413a('0x41')]);return _0xbbb8f3[_0x413a('0x50')](_0x596e38);}})[_0x413a('0x26')](function(_0x520630){if(_0x520630){_0x572ae1=_0x520630[_0x413a('0x48')];if(!_0x2f2d22['query'][_0x413a('0x37')](_0x413a('0x38'))){_0x596e38[_0x413a('0x1d')]=qs[_0x413a('0x1d')](_0x2f2d22[_0x413a('0x31')][_0x413a('0x1d')]);_0x596e38[_0x413a('0x1c')]=qs[_0x413a('0x1c')](_0x2f2d22[_0x413a('0x31')][_0x413a('0x1c')]);}return _0xbbb8f3['getSubjects'](_0x596e38);}})[_0x413a('0x26')](function(_0x2a8e8b){if(_0x2a8e8b){return _0x2a8e8b?{'count':_0x572ae1,'rows':_0x2a8e8b}:null;}})['then'](respondWithResult(_0x2d49bc,null))['catch'](handleError(_0x2d49bc,null));};exports[_0x413a('0x51')]=function(_0x87cb74,_0x458ad9,_0x52e83a){var _0xc209f5={};var _0x45a8fc={};var _0x56911e;var _0x13d65e;return db[_0x413a('0x2d')][_0x413a('0x4e')]({'where':{'id':_0x87cb74[_0x413a('0x47')]['id']}})[_0x413a('0x26')](handleEntityNotFound(_0x458ad9,null))[_0x413a('0x26')](function(_0x32ccee){if(_0x32ccee){_0x56911e=_0x32ccee;_0x45a8fc[_0x413a('0x30')]=_['keys'](db[_0x413a('0x4f')][_0x413a('0x2e')]);_0x45a8fc[_0x413a('0x31')]=_['keys'](_0x87cb74[_0x413a('0x31')]);_0x45a8fc[_0x413a('0x33')]=_[_0x413a('0x34')](_0x45a8fc[_0x413a('0x30')],_0x45a8fc['query']);_0xc209f5[_0x413a('0x35')]=_[_0x413a('0x34')](_0x45a8fc['model'],qs[_0x413a('0x36')](_0x87cb74[_0x413a('0x31')][_0x413a('0x36')]));_0xc209f5[_0x413a('0x35')]=_0xc209f5['attributes'][_0x413a('0x48')]?_0xc209f5[_0x413a('0x35')]:_0x45a8fc[_0x413a('0x30')];_0xc209f5['order']=qs['sort'](_0x87cb74[_0x413a('0x31')]['sort']);_0xc209f5[_0x413a('0x3b')]=qs['filters'](_[_0x413a('0x3c')](_0x87cb74[_0x413a('0x31')],_0x45a8fc[_0x413a('0x33')]));if(_0x87cb74[_0x413a('0x31')][_0x413a('0x3d')]){_0xc209f5[_0x413a('0x3b')]=_['merge'](_0xc209f5[_0x413a('0x3b')],{'$or':_[_0x413a('0x3f')](_0xc209f5[_0x413a('0x35')],function(_0xdfc15){var _0x43e122={};_0x43e122[_0xdfc15]={'$like':'%'+_0x87cb74[_0x413a('0x31')][_0x413a('0x3d')]+'%'};return _0x43e122;})});}_0xc209f5=_[_0x413a('0x3e')]({},_0xc209f5,_0x87cb74['options']);return _0x56911e[_0x413a('0x51')](_0xc209f5);}})[_0x413a('0x26')](function(_0x546f68){if(_0x546f68){_0x13d65e=_0x546f68[_0x413a('0x48')];if(!_0x87cb74[_0x413a('0x31')][_0x413a('0x37')](_0x413a('0x38'))){_0xc209f5[_0x413a('0x1d')]=qs[_0x413a('0x1d')](_0x87cb74[_0x413a('0x31')][_0x413a('0x1d')]);_0xc209f5[_0x413a('0x1c')]=qs[_0x413a('0x1c')](_0x87cb74[_0x413a('0x31')][_0x413a('0x1c')]);}return _0x56911e[_0x413a('0x51')](_0xc209f5);}})[_0x413a('0x26')](function(_0x13c81b){if(_0x13c81b){return _0x13c81b?{'count':_0x13d65e,'rows':_0x13c81b}:null;}})[_0x413a('0x26')](respondWithResult(_0x458ad9,null))['catch'](handleError(_0x458ad9,null));}; \ No newline at end of file +var _0xbcb0=['attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','update','body','getFields','nolimit','getSubjects','findOne','Dynamics365Field','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcb0,0xb5));var _0x0bcb=function(_0x1886c2,_0x60e968){_0x1886c2=_0x1886c2-0x0;var _0x38d30d=_0xbcb0[_0x1886c2];return _0x38d30d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bcb('0x0'));var zipdir=require(_0x0bcb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bcb('0x2'));var moment=require(_0x0bcb('0x3'));var BPromise=require(_0x0bcb('0x4'));var Mustache=require(_0x0bcb('0x5'));var util=require('util');var path=require(_0x0bcb('0x6'));var sox=require(_0x0bcb('0x7'));var csv=require(_0x0bcb('0x8'));var ejs=require(_0x0bcb('0x9'));var fs=require('fs');var fs_extra=require(_0x0bcb('0xa'));var _=require('lodash');var squel=require(_0x0bcb('0xb'));var crypto=require(_0x0bcb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0bcb('0xd'));var toCsv=require(_0x0bcb('0x8'));var querystring=require(_0x0bcb('0xe'));var Papa=require(_0x0bcb('0xf'));var Redis=require(_0x0bcb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0bcb('0x11'));var licenseUtil=require(_0x0bcb('0x12'));var db=require(_0x0bcb('0x13'))['db'];function respondWithStatusCode(_0x31ab25,_0x4e5016){_0x4e5016=_0x4e5016||0xcc;return function(_0x25a998){if(_0x25a998){return _0x31ab25[_0x0bcb('0x14')](_0x4e5016);}return _0x31ab25['status'](_0x4e5016)[_0x0bcb('0x15')]();};}function respondWithResult(_0x165369,_0x1a38c4){_0x1a38c4=_0x1a38c4||0xc8;return function(_0x3a500e){if(_0x3a500e){return _0x165369['status'](_0x1a38c4)[_0x0bcb('0x16')](_0x3a500e);}};}function respondWithFilteredResult(_0x2f3bec,_0x356a48){return function(_0x2a136d){if(_0x2a136d){var _0x36d82a=typeof _0x356a48[_0x0bcb('0x17')]===_0x0bcb('0x18')&&typeof _0x356a48['limit']===_0x0bcb('0x18');var _0x5e0a16=_0x2a136d['count'];var _0x357c8a=_0x36d82a?0x0:_0x356a48[_0x0bcb('0x17')];var _0x3ce7c3=_0x36d82a?_0x2a136d[_0x0bcb('0x19')]:_0x356a48['offset']+_0x356a48['limit'];var _0x55397f;if(_0x3ce7c3>=_0x5e0a16){_0x3ce7c3=_0x5e0a16;_0x55397f=0xc8;}else{_0x55397f=0xce;}_0x2f3bec['status'](_0x55397f);return _0x2f3bec[_0x0bcb('0x1a')]('Content-Range',_0x357c8a+'-'+_0x3ce7c3+'/'+_0x5e0a16)[_0x0bcb('0x16')](_0x2a136d);}return null;};}function patchUpdates(_0xd6a403){return function(_0x358f66){try{jsonpatch[_0x0bcb('0x1b')](_0x358f66,_0xd6a403,!![]);}catch(_0x165f1f){return BPromise[_0x0bcb('0x1c')](_0x165f1f);}return _0x358f66[_0x0bcb('0x1d')]();};}function saveUpdates(_0x76bc80,_0x263f96){return function(_0x49f68e){if(_0x49f68e){return _0x49f68e['update'](_0x76bc80)[_0x0bcb('0x1e')](function(_0x36d76b){return _0x36d76b;});}return null;};}function removeEntity(_0x2c61b1,_0x586f22){return function(_0x4f2e38){if(_0x4f2e38){return _0x4f2e38[_0x0bcb('0x1f')]()['then'](function(){_0x2c61b1[_0x0bcb('0x20')](0xcc)[_0x0bcb('0x15')]();});}};}function handleEntityNotFound(_0x50d4b2,_0x432113){return function(_0x572a08){if(!_0x572a08){_0x50d4b2[_0x0bcb('0x14')](0x194);}return _0x572a08;};}function handleError(_0x3f32c5,_0x4a73e6){_0x4a73e6=_0x4a73e6||0x1f4;return function(_0x3596ff){logger[_0x0bcb('0x21')](_0x3596ff[_0x0bcb('0x22')]);if(_0x3596ff['name']){delete _0x3596ff[_0x0bcb('0x23')];}_0x3f32c5['status'](_0x4a73e6)[_0x0bcb('0x24')](_0x3596ff);};}exports[_0x0bcb('0x25')]=function(_0x3d1d9c,_0x19b2e4){var _0x4e9c2={},_0x337f3d={},_0x2b008a={'count':0x0,'rows':[]};var _0x464611=_[_0x0bcb('0x26')](db[_0x0bcb('0x27')][_0x0bcb('0x28')],function(_0x18166e){return{'name':_0x18166e[_0x0bcb('0x29')],'type':_0x18166e['type'][_0x0bcb('0x2a')]};});_0x337f3d[_0x0bcb('0x2b')]=_['map'](_0x464611,_0x0bcb('0x23'));_0x337f3d[_0x0bcb('0x2c')]=_[_0x0bcb('0x2d')](_0x3d1d9c['query']);_0x337f3d['filters']=_[_0x0bcb('0x2e')](_0x337f3d['model'],_0x337f3d[_0x0bcb('0x2c')]);_0x4e9c2[_0x0bcb('0x2f')]=_['intersection'](_0x337f3d['model'],qs[_0x0bcb('0x30')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x30')]));_0x4e9c2[_0x0bcb('0x2f')]=_0x4e9c2[_0x0bcb('0x2f')][_0x0bcb('0x31')]?_0x4e9c2[_0x0bcb('0x2f')]:_0x337f3d[_0x0bcb('0x2b')];if(!_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x32')]('nolimit')){_0x4e9c2[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x33')]);_0x4e9c2['offset']=qs[_0x0bcb('0x17')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x17')]);}_0x4e9c2[_0x0bcb('0x34')]=qs[_0x0bcb('0x35')](_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x35')]);_0x4e9c2[_0x0bcb('0x36')]=qs[_0x0bcb('0x37')](_[_0x0bcb('0x38')](_0x3d1d9c[_0x0bcb('0x2c')],_0x337f3d[_0x0bcb('0x37')]),_0x464611);if(_0x3d1d9c['query'][_0x0bcb('0x39')]){_0x4e9c2['where']=_[_0x0bcb('0x3a')](_0x4e9c2[_0x0bcb('0x36')],{'$or':_['map'](_0x464611,function(_0x31a730){if(_0x31a730[_0x0bcb('0x3b')]!==_0x0bcb('0x3c')){var _0x337e8b={};_0x337e8b[_0x31a730[_0x0bcb('0x23')]]={'$like':'%'+_0x3d1d9c['query']['filter']+'%'};return _0x337e8b;}})});}_0x4e9c2=_[_0x0bcb('0x3a')]({},_0x4e9c2,_0x3d1d9c[_0x0bcb('0x3d')]);var _0x52d944={'where':_0x4e9c2[_0x0bcb('0x36')]};return db['Dynamics365Configuration'][_0x0bcb('0x19')](_0x52d944)[_0x0bcb('0x1e')](function(_0x2ddfef){_0x2b008a['count']=_0x2ddfef;if(_0x3d1d9c[_0x0bcb('0x2c')][_0x0bcb('0x3e')]){_0x4e9c2[_0x0bcb('0x3f')]=[{'all':!![]}];}return db[_0x0bcb('0x27')]['findAll'](_0x4e9c2);})['then'](function(_0x39e513){_0x2b008a[_0x0bcb('0x40')]=_0x39e513;return _0x2b008a;})[_0x0bcb('0x1e')](respondWithFilteredResult(_0x19b2e4,_0x4e9c2))[_0x0bcb('0x41')](handleError(_0x19b2e4,null));};exports['show']=function(_0xe80f30,_0x2394f9){var _0x630858={'raw':![],'where':{'id':_0xe80f30[_0x0bcb('0x42')]['id']}},_0x3edcda={};_0x3edcda[_0x0bcb('0x2b')]=_[_0x0bcb('0x2d')](db['Dynamics365Configuration'][_0x0bcb('0x28')]);_0x3edcda['query']=_['keys'](_0xe80f30[_0x0bcb('0x2c')]);_0x3edcda['filters']=_[_0x0bcb('0x2e')](_0x3edcda[_0x0bcb('0x2b')],_0x3edcda['query']);_0x630858[_0x0bcb('0x2f')]=_[_0x0bcb('0x2e')](_0x3edcda['model'],qs[_0x0bcb('0x30')](_0xe80f30['query']['fields']));_0x630858[_0x0bcb('0x2f')]=_0x630858[_0x0bcb('0x2f')]['length']?_0x630858[_0x0bcb('0x2f')]:_0x3edcda[_0x0bcb('0x2b')];if(_0xe80f30['query'][_0x0bcb('0x3e')]){_0x630858['include']=[{'all':!![]}];}_0x630858=_[_0x0bcb('0x3a')]({},_0x630858,_0xe80f30['options']);return db['Dynamics365Configuration'][_0x0bcb('0x43')](_0x630858)[_0x0bcb('0x1e')](handleEntityNotFound(_0x2394f9,null))[_0x0bcb('0x1e')](respondWithResult(_0x2394f9,null))[_0x0bcb('0x41')](handleError(_0x2394f9,null));};exports['create']=function(_0x50a526,_0x225352){return db[_0x0bcb('0x27')]['create'](_0x50a526['body'],{})['then'](respondWithResult(_0x225352,0xc9))[_0x0bcb('0x41')](handleError(_0x225352,null));};exports[_0x0bcb('0x44')]=function(_0x2c7a4c,_0xdf9518){if(_0x2c7a4c[_0x0bcb('0x45')]['id']){delete _0x2c7a4c[_0x0bcb('0x45')]['id'];}return db[_0x0bcb('0x27')][_0x0bcb('0x43')]({'where':{'id':_0x2c7a4c[_0x0bcb('0x42')]['id']}})[_0x0bcb('0x1e')](handleEntityNotFound(_0xdf9518,null))[_0x0bcb('0x1e')](saveUpdates(_0x2c7a4c[_0x0bcb('0x45')],null))[_0x0bcb('0x1e')](respondWithResult(_0xdf9518,null))['catch'](handleError(_0xdf9518,null));};exports[_0x0bcb('0x1f')]=function(_0x5a32e9,_0x5c542a){return db['Dynamics365Configuration'][_0x0bcb('0x43')]({'where':{'id':_0x5a32e9[_0x0bcb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c542a,null))[_0x0bcb('0x1e')](removeEntity(_0x5c542a,null))[_0x0bcb('0x41')](handleError(_0x5c542a,null));};exports['getFields']=function(_0x337820,_0x3733a8,_0x5c40a8){var _0x472bba={};var _0x55b52d={};var _0x4e9f41;var _0x355286;return db[_0x0bcb('0x27')]['findOne']({'where':{'id':_0x337820[_0x0bcb('0x42')]['id']}})['then'](handleEntityNotFound(_0x3733a8,null))['then'](function(_0x171fe7){if(_0x171fe7){_0x4e9f41=_0x171fe7;_0x55b52d['model']=_[_0x0bcb('0x2d')](db['Dynamics365Field'][_0x0bcb('0x28')]);_0x55b52d[_0x0bcb('0x2c')]=_['keys'](_0x337820[_0x0bcb('0x2c')]);_0x55b52d[_0x0bcb('0x37')]=_[_0x0bcb('0x2e')](_0x55b52d[_0x0bcb('0x2b')],_0x55b52d[_0x0bcb('0x2c')]);_0x472bba[_0x0bcb('0x2f')]=_['intersection'](_0x55b52d[_0x0bcb('0x2b')],qs[_0x0bcb('0x30')](_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x30')]));_0x472bba[_0x0bcb('0x2f')]=_0x472bba[_0x0bcb('0x2f')][_0x0bcb('0x31')]?_0x472bba[_0x0bcb('0x2f')]:_0x55b52d[_0x0bcb('0x2b')];_0x472bba[_0x0bcb('0x34')]=qs['sort'](_0x337820['query']['sort']);_0x472bba[_0x0bcb('0x36')]=qs[_0x0bcb('0x37')](_[_0x0bcb('0x38')](_0x337820['query'],_0x55b52d[_0x0bcb('0x37')]));if(_0x337820[_0x0bcb('0x2c')]['filter']){_0x472bba[_0x0bcb('0x36')]=_[_0x0bcb('0x3a')](_0x472bba['where'],{'$or':_[_0x0bcb('0x26')](_0x472bba[_0x0bcb('0x2f')],function(_0x59f897){var _0x3b62ea={};_0x3b62ea[_0x59f897]={'$like':'%'+_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x39')]+'%'};return _0x3b62ea;})});}_0x472bba=_[_0x0bcb('0x3a')]({},_0x472bba,_0x337820[_0x0bcb('0x3d')]);return _0x4e9f41[_0x0bcb('0x46')](_0x472bba);}})[_0x0bcb('0x1e')](function(_0x3d42e6){if(_0x3d42e6){_0x355286=_0x3d42e6[_0x0bcb('0x31')];if(!_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x32')](_0x0bcb('0x47'))){_0x472bba[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x337820[_0x0bcb('0x2c')][_0x0bcb('0x33')]);_0x472bba[_0x0bcb('0x17')]=qs[_0x0bcb('0x17')](_0x337820['query'][_0x0bcb('0x17')]);}return _0x4e9f41[_0x0bcb('0x46')](_0x472bba);}})[_0x0bcb('0x1e')](function(_0x35d8bb){if(_0x35d8bb){return _0x35d8bb?{'count':_0x355286,'rows':_0x35d8bb}:null;}})[_0x0bcb('0x1e')](respondWithResult(_0x3733a8,null))[_0x0bcb('0x41')](handleError(_0x3733a8,null));};exports[_0x0bcb('0x48')]=function(_0x39ee06,_0x7b6d74,_0x25a3d1){var _0xedb4b6={};var _0x54238c={};var _0x3a411d;var _0x4fdc6c;return db['Dynamics365Configuration'][_0x0bcb('0x49')]({'where':{'id':_0x39ee06[_0x0bcb('0x42')]['id']}})[_0x0bcb('0x1e')](handleEntityNotFound(_0x7b6d74,null))['then'](function(_0xda39f8){if(_0xda39f8){_0x3a411d=_0xda39f8;_0x54238c['model']=_[_0x0bcb('0x2d')](db[_0x0bcb('0x4a')][_0x0bcb('0x28')]);_0x54238c['query']=_[_0x0bcb('0x2d')](_0x39ee06[_0x0bcb('0x2c')]);_0x54238c['filters']=_['intersection'](_0x54238c[_0x0bcb('0x2b')],_0x54238c[_0x0bcb('0x2c')]);_0xedb4b6['attributes']=_[_0x0bcb('0x2e')](_0x54238c['model'],qs[_0x0bcb('0x30')](_0x39ee06['query']['fields']));_0xedb4b6[_0x0bcb('0x2f')]=_0xedb4b6[_0x0bcb('0x2f')][_0x0bcb('0x31')]?_0xedb4b6[_0x0bcb('0x2f')]:_0x54238c['model'];_0xedb4b6[_0x0bcb('0x34')]=qs[_0x0bcb('0x35')](_0x39ee06[_0x0bcb('0x2c')]['sort']);_0xedb4b6['where']=qs[_0x0bcb('0x37')](_['pick'](_0x39ee06[_0x0bcb('0x2c')],_0x54238c[_0x0bcb('0x37')]));if(_0x39ee06['query']['filter']){_0xedb4b6[_0x0bcb('0x36')]=_[_0x0bcb('0x3a')](_0xedb4b6[_0x0bcb('0x36')],{'$or':_[_0x0bcb('0x26')](_0xedb4b6[_0x0bcb('0x2f')],function(_0x49d595){var _0xeb794e={};_0xeb794e[_0x49d595]={'$like':'%'+_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x39')]+'%'};return _0xeb794e;})});}_0xedb4b6=_[_0x0bcb('0x3a')]({},_0xedb4b6,_0x39ee06[_0x0bcb('0x3d')]);return _0x3a411d['getSubjects'](_0xedb4b6);}})[_0x0bcb('0x1e')](function(_0x275d1e){if(_0x275d1e){_0x4fdc6c=_0x275d1e[_0x0bcb('0x31')];if(!_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x32')]('nolimit')){_0xedb4b6[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x33')]);_0xedb4b6[_0x0bcb('0x17')]=qs[_0x0bcb('0x17')](_0x39ee06[_0x0bcb('0x2c')][_0x0bcb('0x17')]);}return _0x3a411d[_0x0bcb('0x48')](_0xedb4b6);}})[_0x0bcb('0x1e')](function(_0x1f2e50){if(_0x1f2e50){return _0x1f2e50?{'count':_0x4fdc6c,'rows':_0x1f2e50}:null;}})[_0x0bcb('0x1e')](respondWithResult(_0x7b6d74,null))[_0x0bcb('0x41')](handleError(_0x7b6d74,null));};exports[_0x0bcb('0x4b')]=function(_0x3a80a9,_0x2250a5,_0x1433b0){var _0x1bc6f1={};var _0x6bccb7={};var _0x5a604f;var _0x34bdc7;return db[_0x0bcb('0x27')][_0x0bcb('0x49')]({'where':{'id':_0x3a80a9[_0x0bcb('0x42')]['id']}})[_0x0bcb('0x1e')](handleEntityNotFound(_0x2250a5,null))[_0x0bcb('0x1e')](function(_0x2f9a78){if(_0x2f9a78){_0x5a604f=_0x2f9a78;_0x6bccb7[_0x0bcb('0x2b')]=_[_0x0bcb('0x2d')](db[_0x0bcb('0x4a')][_0x0bcb('0x28')]);_0x6bccb7[_0x0bcb('0x2c')]=_[_0x0bcb('0x2d')](_0x3a80a9[_0x0bcb('0x2c')]);_0x6bccb7[_0x0bcb('0x37')]=_['intersection'](_0x6bccb7[_0x0bcb('0x2b')],_0x6bccb7[_0x0bcb('0x2c')]);_0x1bc6f1[_0x0bcb('0x2f')]=_['intersection'](_0x6bccb7[_0x0bcb('0x2b')],qs[_0x0bcb('0x30')](_0x3a80a9[_0x0bcb('0x2c')][_0x0bcb('0x30')]));_0x1bc6f1[_0x0bcb('0x2f')]=_0x1bc6f1['attributes'][_0x0bcb('0x31')]?_0x1bc6f1[_0x0bcb('0x2f')]:_0x6bccb7[_0x0bcb('0x2b')];_0x1bc6f1[_0x0bcb('0x34')]=qs[_0x0bcb('0x35')](_0x3a80a9[_0x0bcb('0x2c')]['sort']);_0x1bc6f1[_0x0bcb('0x36')]=qs[_0x0bcb('0x37')](_['pick'](_0x3a80a9[_0x0bcb('0x2c')],_0x6bccb7[_0x0bcb('0x37')]));if(_0x3a80a9[_0x0bcb('0x2c')][_0x0bcb('0x39')]){_0x1bc6f1[_0x0bcb('0x36')]=_[_0x0bcb('0x3a')](_0x1bc6f1[_0x0bcb('0x36')],{'$or':_[_0x0bcb('0x26')](_0x1bc6f1[_0x0bcb('0x2f')],function(_0xe0749b){var _0xc39034={};_0xc39034[_0xe0749b]={'$like':'%'+_0x3a80a9['query'][_0x0bcb('0x39')]+'%'};return _0xc39034;})});}_0x1bc6f1=_[_0x0bcb('0x3a')]({},_0x1bc6f1,_0x3a80a9[_0x0bcb('0x3d')]);return _0x5a604f[_0x0bcb('0x4b')](_0x1bc6f1);}})[_0x0bcb('0x1e')](function(_0x7d721b){if(_0x7d721b){_0x34bdc7=_0x7d721b[_0x0bcb('0x31')];if(!_0x3a80a9[_0x0bcb('0x2c')][_0x0bcb('0x32')](_0x0bcb('0x47'))){_0x1bc6f1[_0x0bcb('0x33')]=qs[_0x0bcb('0x33')](_0x3a80a9['query'][_0x0bcb('0x33')]);_0x1bc6f1['offset']=qs[_0x0bcb('0x17')](_0x3a80a9[_0x0bcb('0x2c')]['offset']);}return _0x5a604f[_0x0bcb('0x4b')](_0x1bc6f1);}})[_0x0bcb('0x1e')](function(_0x377793){if(_0x377793){return _0x377793?{'count':_0x34bdc7,'rows':_0x377793}:null;}})[_0x0bcb('0x1e')](respondWithResult(_0x2250a5,null))[_0x0bcb('0x41')](handleError(_0x2250a5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 2b615df..fc5a2e8 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x55fc6b,_0x4f295a){var _0xf055cf=function(_0x1d18af){while(--_0x1d18af){_0x55fc6b['push'](_0x55fc6b['shift']());}};_0xf055cf(++_0x4f295a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3cc66f,_0x4c91d0){_0x3cc66f=_0x3cc66f-0x0;var _0x517b00=_0xb43b[_0x3cc66f];return _0x517b00;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34aaa8,_0x266a37){var _0x1fc9ce=function(_0x5b0475){while(--_0x5b0475){_0x34aaa8['push'](_0x34aaa8['shift']());}};_0x1fc9ce(++_0x266a37);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x31c3be,_0x5e540f){_0x31c3be=_0x31c3be-0x0;var _0x48314d=_0xf3cd[_0x31c3be];return _0x48314d;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('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 ae80700..64061f1 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 _0x1d40=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x467dee,_0x6b22b0){var _0x4406c7=function(_0x39648e){while(--_0x39648e){_0x467dee['push'](_0x467dee['shift']());}};_0x4406c7(++_0x6b22b0);}(_0x1d40,0x1dd));var _0x01d4=function(_0x2c9bf0,_0x4999f1){_0x2c9bf0=_0x2c9bf0-0x0;var _0x14fa8a=_0x1d40[_0x2c9bf0];return _0x14fa8a;};'use strict';var _=require(_0x01d4('0x0'));var util=require(_0x01d4('0x1'));var moment=require(_0x01d4('0x2'));var BPromise=require(_0x01d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x01d4('0x5'));var logger=require(_0x01d4('0x6'))(_0x01d4('0x7'));var config=require(_0x01d4('0x8'));var jayson=require(_0x01d4('0x9'));var client=jayson[_0x01d4('0xa')][_0x01d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f65d1,_0x5ec60d,_0x3d8c1b){return new BPromise(function(_0x372b00,_0x4f5e92){return client['request'](_0x1f65d1,_0x3d8c1b)[_0x01d4('0xc')](function(_0x7690bd){logger[_0x01d4('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ec60d,_0x01d4('0xe'));logger[_0x01d4('0xf')](_0x01d4('0x10'),_0x5ec60d,'request\x20sent',JSON[_0x01d4('0x11')](_0x7690bd));if(_0x7690bd[_0x01d4('0x12')]){if(_0x7690bd[_0x01d4('0x12')]['code']===0x1f4){logger[_0x01d4('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5ec60d,_0x7690bd['error'][_0x01d4('0x13')]);return _0x4f5e92(_0x7690bd[_0x01d4('0x12')][_0x01d4('0x13')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5ec60d,_0x7690bd[_0x01d4('0x12')]['message']);return _0x372b00(_0x7690bd[_0x01d4('0x12')][_0x01d4('0x13')]);}else{logger[_0x01d4('0xd')](_0x01d4('0x14'),_0x5ec60d,_0x01d4('0xe'));_0x372b00(_0x7690bd[_0x01d4('0x15')][_0x01d4('0x13')]);}})[_0x01d4('0x16')](function(_0x39e491){logger[_0x01d4('0x12')](_0x01d4('0x14'),_0x5ec60d,_0x39e491);_0x4f5e92(_0x39e491);});});} \ No newline at end of file +var _0xb958=['../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xb958,0xb0));var _0x8b95=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xb958[_0xf55e73];return _0x116b99;};'use strict';var _=require(_0x8b95('0x0'));var util=require('util');var moment=require(_0x8b95('0x1'));var BPromise=require(_0x8b95('0x2'));var rs=require(_0x8b95('0x3'));var fs=require('fs');var Redis=require(_0x8b95('0x4'));var db=require(_0x8b95('0x5'))['db'];var utils=require(_0x8b95('0x6'));var logger=require(_0x8b95('0x7'))('rpc');var config=require(_0x8b95('0x8'));var jayson=require(_0x8b95('0x9'));var client=jayson[_0x8b95('0xa')][_0x8b95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x202588,_0x5c86e3,_0x209cf4){return new BPromise(function(_0x14f2af,_0x49b3fb){return client['request'](_0x202588,_0x209cf4)[_0x8b95('0xc')](function(_0x672f2c){logger[_0x8b95('0xd')](_0x8b95('0xe'),_0x5c86e3,'request\x20sent');logger[_0x8b95('0xf')](_0x8b95('0x10'),_0x5c86e3,_0x8b95('0x11'),JSON[_0x8b95('0x12')](_0x672f2c));if(_0x672f2c['error']){if(_0x672f2c[_0x8b95('0x13')][_0x8b95('0x14')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5c86e3,_0x672f2c['error'][_0x8b95('0x15')]);return _0x49b3fb(_0x672f2c['error'][_0x8b95('0x15')]);}logger[_0x8b95('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5c86e3,_0x672f2c['error'][_0x8b95('0x15')]);return _0x14f2af(_0x672f2c[_0x8b95('0x13')][_0x8b95('0x15')]);}else{logger[_0x8b95('0xd')](_0x8b95('0xe'),_0x5c86e3,_0x8b95('0x11'));_0x14f2af(_0x672f2c['result'][_0x8b95('0x15')]);}})[_0x8b95('0x16')](function(_0x181f91){logger[_0x8b95('0x13')](_0x8b95('0xe'),_0x5c86e3,_0x181f91);_0x49b3fb(_0x181f91);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 78dd320..2849616 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 _0x4d60=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show'];(function(_0x2f5d03,_0x4d3657){var _0xa5bb29=function(_0x53bd66){while(--_0x53bd66){_0x2f5d03['push'](_0x2f5d03['shift']());}};_0xa5bb29(++_0x4d3657);}(_0x4d60,0x93));var _0x04d6=function(_0x514c17,_0x5f52c7){_0x514c17=_0x514c17-0x0;var _0x321a6f=_0x4d60[_0x514c17];return _0x321a6f;};'use strict';var multer=require('multer');var util=require(_0x04d6('0x0'));var path=require(_0x04d6('0x1'));var timeout=require(_0x04d6('0x2'));var express=require(_0x04d6('0x3'));var router=express[_0x04d6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x04d6('0x5'));var interaction=require(_0x04d6('0x6'));var config=require(_0x04d6('0x7'));var controller=require(_0x04d6('0x8'));router[_0x04d6('0x9')]('/',auth[_0x04d6('0xa')](),controller[_0x04d6('0xb')]);router[_0x04d6('0x9')]('/:id',auth[_0x04d6('0xa')](),controller[_0x04d6('0xc')]);router[_0x04d6('0xd')]('/',auth['isAuthenticated'](),controller[_0x04d6('0xe')]);router['put'](_0x04d6('0xf'),auth[_0x04d6('0xa')](),controller[_0x04d6('0x10')]);router[_0x04d6('0x11')](_0x04d6('0xf'),auth['isAuthenticated'](),controller[_0x04d6('0x12')]);module[_0x04d6('0x13')]=router; \ No newline at end of file +var _0x25ca=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','show','isAuthenticated','create','destroy','exports','multer'];(function(_0x4814d6,_0xd078e6){var _0x46d6f1=function(_0x4e875b){while(--_0x4e875b){_0x4814d6['push'](_0x4814d6['shift']());}};_0x46d6f1(++_0xd078e6);}(_0x25ca,0x143));var _0xa25c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x25ca[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0xa25c('0x0'));var util=require(_0xa25c('0x1'));var path=require(_0xa25c('0x2'));var timeout=require(_0xa25c('0x3'));var express=require(_0xa25c('0x4'));var router=express['Router']();var fs_extra=require(_0xa25c('0x5'));var auth=require(_0xa25c('0x6'));var interaction=require(_0xa25c('0x7'));var config=require(_0xa25c('0x8'));var controller=require(_0xa25c('0x9'));router[_0xa25c('0xa')]('/',auth['isAuthenticated'](),controller[_0xa25c('0xb')]);router[_0xa25c('0xa')](_0xa25c('0xc'),auth['isAuthenticated'](),controller[_0xa25c('0xd')]);router['post']('/',auth[_0xa25c('0xe')](),controller[_0xa25c('0xf')]);router['put']('/:id',auth[_0xa25c('0xe')](),controller['update']);router['delete'](_0xa25c('0xc'),auth['isAuthenticated'](),controller[_0xa25c('0x10')]);module[_0xa25c('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 7a7e6f1..f73eba3 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 _0x867f=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','string','variable'];(function(_0x17616b,_0x2e20d1){var _0x17b948=function(_0x39286a){while(--_0x39286a){_0x17616b['push'](_0x17616b['shift']());}};_0x17b948(++_0x2e20d1);}(_0x867f,0x12c));var _0xf867=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x867f[_0x587dd0];return _0x56f153;};'use strict';var Sequelize=require(_0xf867('0x0'));module[_0xf867('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf867('0x2'),_0xf867('0x3'),_0xf867('0x4'),_0xf867('0x5'),'picklist'),'defaultValue':_0xf867('0x2')},'content':{'type':Sequelize[_0xf867('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xf867('0x2'),'variable',_0xf867('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf867('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf867('0x6')]}}; \ No newline at end of file +var _0x7b40=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x46feab,_0x151ef7){var _0xef099a=function(_0x3a19ed){while(--_0x3a19ed){_0x46feab['push'](_0x46feab['shift']());}};_0xef099a(++_0x151ef7);}(_0x7b40,0x1a2));var _0x07b4=function(_0x204a7e,_0x580a50){_0x204a7e=_0x204a7e-0x0;var _0x1c0e97=_0x7b40[_0x204a7e];return _0x1c0e97;};'use strict';var Sequelize=require('sequelize');module[_0x07b4('0x0')]={'type':{'type':Sequelize[_0x07b4('0x1')](_0x07b4('0x2'),_0x07b4('0x3'),_0x07b4('0x4'),_0x07b4('0x5'),'picklist'),'defaultValue':_0x07b4('0x2')},'content':{'type':Sequelize[_0x07b4('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x07b4('0x1')](_0x07b4('0x2'),_0x07b4('0x3'),_0x07b4('0x4'))},'keyContent':{'type':Sequelize[_0x07b4('0x6')]},'idField':{'type':Sequelize[_0x07b4('0x6')]},'nameField':{'type':Sequelize[_0x07b4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07b4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 126f2b3..d9ebd04 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 _0x9ddd=['util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','Dynamics365Field','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x286176,_0x3d6165){var _0x439cdf=function(_0x1dbf6b){while(--_0x1dbf6b){_0x286176['push'](_0x286176['shift']());}};_0x439cdf(++_0x3d6165);}(_0x9ddd,0x1c1));var _0xd9dd=function(_0x369015,_0x48186d){_0x369015=_0x369015-0x0;var _0x3de4b7=_0x9ddd[_0x369015];return _0x3de4b7;};'use strict';var emlformat=require(_0xd9dd('0x0'));var rimraf=require(_0xd9dd('0x1'));var zipdir=require(_0xd9dd('0x2'));var jsonpatch=require(_0xd9dd('0x3'));var rp=require(_0xd9dd('0x4'));var moment=require('moment');var BPromise=require(_0xd9dd('0x5'));var Mustache=require(_0xd9dd('0x6'));var util=require(_0xd9dd('0x7'));var path=require(_0xd9dd('0x8'));var sox=require(_0xd9dd('0x9'));var csv=require('to-csv');var ejs=require(_0xd9dd('0xa'));var fs=require('fs');var fs_extra=require(_0xd9dd('0xb'));var _=require(_0xd9dd('0xc'));var squel=require(_0xd9dd('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9dd('0xe'));var deskjs=require(_0xd9dd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9dd('0x10'));var Papa=require(_0xd9dd('0x11'));var Redis=require('ioredis');var authService=require(_0xd9dd('0x12'));var qs=require(_0xd9dd('0x13'));var as=require(_0xd9dd('0x14'));var hardwareService=require(_0xd9dd('0x15'));var logger=require(_0xd9dd('0x16'))('api');var utils=require(_0xd9dd('0x17'));var config=require(_0xd9dd('0x18'));var licenseUtil=require(_0xd9dd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3440,_0x379a45){_0x379a45=_0x379a45||0xcc;return function(_0x597d4f){if(_0x597d4f){return _0x5c3440[_0xd9dd('0x1a')](_0x379a45);}return _0x5c3440[_0xd9dd('0x1b')](_0x379a45)['end']();};}function respondWithResult(_0x160014,_0x4977ee){_0x4977ee=_0x4977ee||0xc8;return function(_0xc928f5){if(_0xc928f5){return _0x160014[_0xd9dd('0x1b')](_0x4977ee)[_0xd9dd('0x1c')](_0xc928f5);}};}function respondWithFilteredResult(_0x51c7cf,_0x295c00){return function(_0x6bdc1f){if(_0x6bdc1f){var _0x32ba29=typeof _0x295c00[_0xd9dd('0x1d')]===_0xd9dd('0x1e')&&typeof _0x295c00['limit']===_0xd9dd('0x1e');var _0x5a045c=_0x6bdc1f[_0xd9dd('0x1f')];var _0x2a5235=_0x32ba29?0x0:_0x295c00[_0xd9dd('0x1d')];var _0xa16804=_0x32ba29?_0x6bdc1f[_0xd9dd('0x1f')]:_0x295c00[_0xd9dd('0x1d')]+_0x295c00[_0xd9dd('0x20')];var _0x27bfe0;if(_0xa16804>=_0x5a045c){_0xa16804=_0x5a045c;_0x27bfe0=0xc8;}else{_0x27bfe0=0xce;}_0x51c7cf[_0xd9dd('0x1b')](_0x27bfe0);return _0x51c7cf['set'](_0xd9dd('0x21'),_0x2a5235+'-'+_0xa16804+'/'+_0x5a045c)['json'](_0x6bdc1f);}return null;};}function patchUpdates(_0x1db1e7){return function(_0x17d1f9){try{jsonpatch[_0xd9dd('0x22')](_0x17d1f9,_0x1db1e7,!![]);}catch(_0x1e4483){return BPromise[_0xd9dd('0x23')](_0x1e4483);}return _0x17d1f9[_0xd9dd('0x24')]();};}function saveUpdates(_0x213adc,_0x318785){return function(_0x265fbf){if(_0x265fbf){return _0x265fbf['update'](_0x213adc)[_0xd9dd('0x25')](function(_0x4b5ed3){return _0x4b5ed3;});}return null;};}function removeEntity(_0x50292d,_0x4ed304){return function(_0x2cf0e5){if(_0x2cf0e5){return _0x2cf0e5[_0xd9dd('0x26')]()['then'](function(){_0x50292d['status'](0xcc)[_0xd9dd('0x27')]();});}};}function handleEntityNotFound(_0x29d8fc,_0x189daf){return function(_0x2c4cca){if(!_0x2c4cca){_0x29d8fc[_0xd9dd('0x1a')](0x194);}return _0x2c4cca;};}function handleError(_0x36efd3,_0x5296bb){_0x5296bb=_0x5296bb||0x1f4;return function(_0x4c3b84){logger[_0xd9dd('0x28')](_0x4c3b84[_0xd9dd('0x29')]);if(_0x4c3b84[_0xd9dd('0x2a')]){delete _0x4c3b84[_0xd9dd('0x2a')];}_0x36efd3[_0xd9dd('0x1b')](_0x5296bb)[_0xd9dd('0x2b')](_0x4c3b84);};}exports[_0xd9dd('0x2c')]=function(_0x33c7f5,_0x576512){var _0x106925={},_0x1f8bf4={},_0x4cf301={'count':0x0,'rows':[]};var _0x576de8=_['map'](db[_0xd9dd('0x2d')][_0xd9dd('0x2e')],function(_0x21e21a){return{'name':_0x21e21a['fieldName'],'type':_0x21e21a[_0xd9dd('0x2f')][_0xd9dd('0x30')]};});_0x1f8bf4[_0xd9dd('0x31')]=_[_0xd9dd('0x32')](_0x576de8,_0xd9dd('0x2a'));_0x1f8bf4[_0xd9dd('0x33')]=_[_0xd9dd('0x34')](_0x33c7f5['query']);_0x1f8bf4[_0xd9dd('0x35')]=_[_0xd9dd('0x36')](_0x1f8bf4[_0xd9dd('0x31')],_0x1f8bf4['query']);_0x106925[_0xd9dd('0x37')]=_[_0xd9dd('0x36')](_0x1f8bf4[_0xd9dd('0x31')],qs[_0xd9dd('0x38')](_0x33c7f5[_0xd9dd('0x33')][_0xd9dd('0x38')]));_0x106925['attributes']=_0x106925[_0xd9dd('0x37')][_0xd9dd('0x39')]?_0x106925[_0xd9dd('0x37')]:_0x1f8bf4[_0xd9dd('0x31')];if(!_0x33c7f5[_0xd9dd('0x33')]['hasOwnProperty'](_0xd9dd('0x3a'))){_0x106925['limit']=qs[_0xd9dd('0x20')](_0x33c7f5[_0xd9dd('0x33')][_0xd9dd('0x20')]);_0x106925['offset']=qs['offset'](_0x33c7f5[_0xd9dd('0x33')][_0xd9dd('0x1d')]);}_0x106925[_0xd9dd('0x3b')]=qs[_0xd9dd('0x3c')](_0x33c7f5[_0xd9dd('0x33')]['sort']);_0x106925[_0xd9dd('0x3d')]=qs[_0xd9dd('0x35')](_[_0xd9dd('0x3e')](_0x33c7f5['query'],_0x1f8bf4[_0xd9dd('0x35')]),_0x576de8);if(_0x33c7f5[_0xd9dd('0x33')][_0xd9dd('0x3f')]){_0x106925[_0xd9dd('0x3d')]=_[_0xd9dd('0x40')](_0x106925[_0xd9dd('0x3d')],{'$or':_[_0xd9dd('0x32')](_0x576de8,function(_0x1a3805){if(_0x1a3805[_0xd9dd('0x2f')]!=='VIRTUAL'){var _0x4b4731={};_0x4b4731[_0x1a3805['name']]={'$like':'%'+_0x33c7f5[_0xd9dd('0x33')]['filter']+'%'};return _0x4b4731;}})});}_0x106925=_[_0xd9dd('0x40')]({},_0x106925,_0x33c7f5[_0xd9dd('0x41')]);var _0x5ef26f={'where':_0x106925['where']};return db[_0xd9dd('0x2d')][_0xd9dd('0x1f')](_0x5ef26f)['then'](function(_0x16f426){_0x4cf301[_0xd9dd('0x1f')]=_0x16f426;if(_0x33c7f5[_0xd9dd('0x33')][_0xd9dd('0x42')]){_0x106925[_0xd9dd('0x43')]=[{'all':!![]}];}return db[_0xd9dd('0x2d')][_0xd9dd('0x44')](_0x106925);})['then'](function(_0x1d5ee3){_0x4cf301[_0xd9dd('0x45')]=_0x1d5ee3;return _0x4cf301;})['then'](respondWithFilteredResult(_0x576512,_0x106925))[_0xd9dd('0x46')](handleError(_0x576512,null));};exports[_0xd9dd('0x47')]=function(_0x581a55,_0x58b49e){var _0x5a5828={'raw':!![],'where':{'id':_0x581a55[_0xd9dd('0x48')]['id']}},_0x4429be={};_0x4429be['model']=_[_0xd9dd('0x34')](db[_0xd9dd('0x2d')][_0xd9dd('0x2e')]);_0x4429be[_0xd9dd('0x33')]=_[_0xd9dd('0x34')](_0x581a55[_0xd9dd('0x33')]);_0x4429be[_0xd9dd('0x35')]=_['intersection'](_0x4429be[_0xd9dd('0x31')],_0x4429be[_0xd9dd('0x33')]);_0x5a5828[_0xd9dd('0x37')]=_[_0xd9dd('0x36')](_0x4429be[_0xd9dd('0x31')],qs[_0xd9dd('0x38')](_0x581a55[_0xd9dd('0x33')][_0xd9dd('0x38')]));_0x5a5828[_0xd9dd('0x37')]=_0x5a5828['attributes'][_0xd9dd('0x39')]?_0x5a5828[_0xd9dd('0x37')]:_0x4429be['model'];if(_0x581a55['query'][_0xd9dd('0x42')]){_0x5a5828[_0xd9dd('0x43')]=[{'all':!![]}];}_0x5a5828=_[_0xd9dd('0x40')]({},_0x5a5828,_0x581a55[_0xd9dd('0x41')]);return db[_0xd9dd('0x2d')]['find'](_0x5a5828)['then'](handleEntityNotFound(_0x58b49e,null))[_0xd9dd('0x25')](respondWithResult(_0x58b49e,null))[_0xd9dd('0x46')](handleError(_0x58b49e,null));};exports[_0xd9dd('0x49')]=function(_0x20b32b,_0x449eab){return db[_0xd9dd('0x2d')][_0xd9dd('0x49')](_0x20b32b['body'],{})[_0xd9dd('0x25')](respondWithResult(_0x449eab,0xc9))[_0xd9dd('0x46')](handleError(_0x449eab,null));};exports['update']=function(_0x37446f,_0x5992f7){if(_0x37446f[_0xd9dd('0x4a')]['id']){delete _0x37446f[_0xd9dd('0x4a')]['id'];}return db[_0xd9dd('0x2d')][_0xd9dd('0x4b')]({'where':{'id':_0x37446f[_0xd9dd('0x48')]['id']}})['then'](handleEntityNotFound(_0x5992f7,null))['then'](saveUpdates(_0x37446f[_0xd9dd('0x4a')],null))[_0xd9dd('0x25')](respondWithResult(_0x5992f7,null))[_0xd9dd('0x46')](handleError(_0x5992f7,null));};exports[_0xd9dd('0x26')]=function(_0x1b0ecd,_0x3ee88d){return db['Dynamics365Field']['find']({'where':{'id':_0x1b0ecd['params']['id']}})[_0xd9dd('0x25')](handleEntityNotFound(_0x3ee88d,null))[_0xd9dd('0x25')](removeEntity(_0x3ee88d,null))[_0xd9dd('0x46')](handleError(_0x3ee88d,null));}; \ No newline at end of file +var _0x499e=['include','options','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','json','apply','reject','update','then','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','keys'];(function(_0x9abc2a,_0x27d8dc){var _0x1647f8=function(_0x86be55){while(--_0x86be55){_0x9abc2a['push'](_0x9abc2a['shift']());}};_0x1647f8(++_0x27d8dc);}(_0x499e,0x9e));var _0xe499=function(_0xda8dcb,_0x34e606){_0xda8dcb=_0xda8dcb-0x0;var _0xe5f278=_0x499e[_0xda8dcb];return _0xe5f278;};'use strict';var emlformat=require(_0xe499('0x0'));var rimraf=require(_0xe499('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe499('0x2'));var rp=require(_0xe499('0x3'));var moment=require(_0xe499('0x4'));var BPromise=require(_0xe499('0x5'));var Mustache=require(_0xe499('0x6'));var util=require('util');var path=require(_0xe499('0x7'));var sox=require(_0xe499('0x8'));var csv=require(_0xe499('0x9'));var ejs=require(_0xe499('0xa'));var fs=require('fs');var fs_extra=require(_0xe499('0xb'));var _=require(_0xe499('0xc'));var squel=require(_0xe499('0xd'));var crypto=require(_0xe499('0xe'));var jsforce=require(_0xe499('0xf'));var deskjs=require(_0xe499('0x10'));var toCsv=require(_0xe499('0x9'));var querystring=require(_0xe499('0x11'));var Papa=require('papaparse');var Redis=require(_0xe499('0x12'));var authService=require(_0xe499('0x13'));var qs=require(_0xe499('0x14'));var as=require(_0xe499('0x15'));var hardwareService=require(_0xe499('0x16'));var logger=require('../../config/logger')(_0xe499('0x17'));var utils=require(_0xe499('0x18'));var config=require(_0xe499('0x19'));var licenseUtil=require(_0xe499('0x1a'));var db=require(_0xe499('0x1b'))['db'];function respondWithStatusCode(_0x4345f1,_0x51ab89){_0x51ab89=_0x51ab89||0xcc;return function(_0xb89322){if(_0xb89322){return _0x4345f1[_0xe499('0x1c')](_0x51ab89);}return _0x4345f1['status'](_0x51ab89)[_0xe499('0x1d')]();};}function respondWithResult(_0x276c0c,_0x445e29){_0x445e29=_0x445e29||0xc8;return function(_0x45eb93){if(_0x45eb93){return _0x276c0c['status'](_0x445e29)['json'](_0x45eb93);}};}function respondWithFilteredResult(_0x3ef5e5,_0x1d97c7){return function(_0x53f3d6){if(_0x53f3d6){var _0x47ba0c=typeof _0x1d97c7[_0xe499('0x1e')]===_0xe499('0x1f')&&typeof _0x1d97c7['limit']===_0xe499('0x1f');var _0x33c907=_0x53f3d6[_0xe499('0x20')];var _0x9f065=_0x47ba0c?0x0:_0x1d97c7[_0xe499('0x1e')];var _0x2fc842=_0x47ba0c?_0x53f3d6[_0xe499('0x20')]:_0x1d97c7[_0xe499('0x1e')]+_0x1d97c7[_0xe499('0x21')];var _0x29664f;if(_0x2fc842>=_0x33c907){_0x2fc842=_0x33c907;_0x29664f=0xc8;}else{_0x29664f=0xce;}_0x3ef5e5[_0xe499('0x22')](_0x29664f);return _0x3ef5e5[_0xe499('0x23')]('Content-Range',_0x9f065+'-'+_0x2fc842+'/'+_0x33c907)[_0xe499('0x24')](_0x53f3d6);}return null;};}function patchUpdates(_0x89e11a){return function(_0x269c44){try{jsonpatch[_0xe499('0x25')](_0x269c44,_0x89e11a,!![]);}catch(_0x2d2fbe){return BPromise[_0xe499('0x26')](_0x2d2fbe);}return _0x269c44['save']();};}function saveUpdates(_0x1fee3b,_0x4bf495){return function(_0x2c7822){if(_0x2c7822){return _0x2c7822[_0xe499('0x27')](_0x1fee3b)[_0xe499('0x28')](function(_0xd86492){return _0xd86492;});}return null;};}function removeEntity(_0x58c59b,_0x2e7baf){return function(_0x20d498){if(_0x20d498){return _0x20d498[_0xe499('0x29')]()[_0xe499('0x28')](function(){_0x58c59b[_0xe499('0x22')](0xcc)[_0xe499('0x1d')]();});}};}function handleEntityNotFound(_0x4ddce8,_0x48606b){return function(_0x1514fb){if(!_0x1514fb){_0x4ddce8['sendStatus'](0x194);}return _0x1514fb;};}function handleError(_0x1e7e20,_0x4ffd8c){_0x4ffd8c=_0x4ffd8c||0x1f4;return function(_0x4c4700){logger[_0xe499('0x2a')](_0x4c4700['stack']);if(_0x4c4700[_0xe499('0x2b')]){delete _0x4c4700[_0xe499('0x2b')];}_0x1e7e20[_0xe499('0x22')](_0x4ffd8c)[_0xe499('0x2c')](_0x4c4700);};}exports[_0xe499('0x2d')]=function(_0x2be85c,_0x1fc8eb){var _0x804d77={},_0x55726c={},_0x128881={'count':0x0,'rows':[]};var _0x51265e=_[_0xe499('0x2e')](db[_0xe499('0x2f')][_0xe499('0x30')],function(_0x2e6666){return{'name':_0x2e6666['fieldName'],'type':_0x2e6666[_0xe499('0x31')][_0xe499('0x32')]};});_0x55726c[_0xe499('0x33')]=_['map'](_0x51265e,_0xe499('0x2b'));_0x55726c[_0xe499('0x34')]=_['keys'](_0x2be85c[_0xe499('0x34')]);_0x55726c['filters']=_[_0xe499('0x35')](_0x55726c[_0xe499('0x33')],_0x55726c['query']);_0x804d77[_0xe499('0x36')]=_[_0xe499('0x35')](_0x55726c[_0xe499('0x33')],qs[_0xe499('0x37')](_0x2be85c[_0xe499('0x34')][_0xe499('0x37')]));_0x804d77[_0xe499('0x36')]=_0x804d77['attributes'][_0xe499('0x38')]?_0x804d77[_0xe499('0x36')]:_0x55726c[_0xe499('0x33')];if(!_0x2be85c[_0xe499('0x34')][_0xe499('0x39')](_0xe499('0x3a'))){_0x804d77[_0xe499('0x21')]=qs[_0xe499('0x21')](_0x2be85c[_0xe499('0x34')]['limit']);_0x804d77[_0xe499('0x1e')]=qs[_0xe499('0x1e')](_0x2be85c[_0xe499('0x34')][_0xe499('0x1e')]);}_0x804d77[_0xe499('0x3b')]=qs[_0xe499('0x3c')](_0x2be85c[_0xe499('0x34')][_0xe499('0x3c')]);_0x804d77[_0xe499('0x3d')]=qs[_0xe499('0x3e')](_[_0xe499('0x3f')](_0x2be85c[_0xe499('0x34')],_0x55726c[_0xe499('0x3e')]),_0x51265e);if(_0x2be85c[_0xe499('0x34')][_0xe499('0x40')]){_0x804d77['where']=_[_0xe499('0x41')](_0x804d77[_0xe499('0x3d')],{'$or':_['map'](_0x51265e,function(_0x5e30a1){if(_0x5e30a1[_0xe499('0x31')]!==_0xe499('0x42')){var _0x72ca26={};_0x72ca26[_0x5e30a1[_0xe499('0x2b')]]={'$like':'%'+_0x2be85c[_0xe499('0x34')][_0xe499('0x40')]+'%'};return _0x72ca26;}})});}_0x804d77=_[_0xe499('0x41')]({},_0x804d77,_0x2be85c['options']);var _0x47510a={'where':_0x804d77['where']};return db[_0xe499('0x2f')]['count'](_0x47510a)['then'](function(_0x5457bb){_0x128881[_0xe499('0x20')]=_0x5457bb;if(_0x2be85c[_0xe499('0x34')][_0xe499('0x43')]){_0x804d77['include']=[{'all':!![]}];}return db[_0xe499('0x2f')][_0xe499('0x44')](_0x804d77);})['then'](function(_0x333583){_0x128881['rows']=_0x333583;return _0x128881;})[_0xe499('0x28')](respondWithFilteredResult(_0x1fc8eb,_0x804d77))[_0xe499('0x45')](handleError(_0x1fc8eb,null));};exports[_0xe499('0x46')]=function(_0x2f12d3,_0x5981c7){var _0x433008={'raw':!![],'where':{'id':_0x2f12d3[_0xe499('0x47')]['id']}},_0x1bd532={};_0x1bd532[_0xe499('0x33')]=_[_0xe499('0x48')](db[_0xe499('0x2f')][_0xe499('0x30')]);_0x1bd532[_0xe499('0x34')]=_['keys'](_0x2f12d3[_0xe499('0x34')]);_0x1bd532[_0xe499('0x3e')]=_[_0xe499('0x35')](_0x1bd532[_0xe499('0x33')],_0x1bd532[_0xe499('0x34')]);_0x433008[_0xe499('0x36')]=_[_0xe499('0x35')](_0x1bd532[_0xe499('0x33')],qs[_0xe499('0x37')](_0x2f12d3[_0xe499('0x34')][_0xe499('0x37')]));_0x433008[_0xe499('0x36')]=_0x433008[_0xe499('0x36')][_0xe499('0x38')]?_0x433008[_0xe499('0x36')]:_0x1bd532[_0xe499('0x33')];if(_0x2f12d3[_0xe499('0x34')][_0xe499('0x43')]){_0x433008[_0xe499('0x49')]=[{'all':!![]}];}_0x433008=_[_0xe499('0x41')]({},_0x433008,_0x2f12d3[_0xe499('0x4a')]);return db[_0xe499('0x2f')]['find'](_0x433008)[_0xe499('0x28')](handleEntityNotFound(_0x5981c7,null))['then'](respondWithResult(_0x5981c7,null))[_0xe499('0x45')](handleError(_0x5981c7,null));};exports['create']=function(_0x346f3c,_0x20ab39){return db[_0xe499('0x2f')][_0xe499('0x4b')](_0x346f3c[_0xe499('0x4c')],{})['then'](respondWithResult(_0x20ab39,0xc9))['catch'](handleError(_0x20ab39,null));};exports[_0xe499('0x27')]=function(_0x42b832,_0x45334f){if(_0x42b832[_0xe499('0x4c')]['id']){delete _0x42b832[_0xe499('0x4c')]['id'];}return db[_0xe499('0x2f')]['find']({'where':{'id':_0x42b832[_0xe499('0x47')]['id']}})[_0xe499('0x28')](handleEntityNotFound(_0x45334f,null))[_0xe499('0x28')](saveUpdates(_0x42b832[_0xe499('0x4c')],null))['then'](respondWithResult(_0x45334f,null))[_0xe499('0x45')](handleError(_0x45334f,null));};exports[_0xe499('0x29')]=function(_0x4237a6,_0x3c2c90){return db['Dynamics365Field']['find']({'where':{'id':_0x4237a6[_0xe499('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c2c90,null))['then'](removeEntity(_0x3c2c90,null))['catch'](handleError(_0x3c2c90,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 993a689..c978098 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 _0x1766=['bluebird','request-promise','path','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x20c424,_0xbd153e){var _0xa3a4f6=function(_0x394b3c){while(--_0x394b3c){_0x20c424['push'](_0x20c424['shift']());}};_0xa3a4f6(++_0xbd153e);}(_0x1766,0x1d1));var _0x6176=function(_0x4fbe40,_0x42664e){_0x4fbe40=_0x4fbe40-0x0;var _0x5cb5e3=_0x1766[_0x4fbe40];return _0x5cb5e3;};'use strict';var _=require(_0x6176('0x0'));var util=require('util');var logger=require(_0x6176('0x1'))('api');var moment=require(_0x6176('0x2'));var BPromise=require(_0x6176('0x3'));var rp=require(_0x6176('0x4'));var fs=require('fs');var path=require(_0x6176('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6176('0x6'));module[_0x6176('0x7')]=function(_0xf60568,_0x9bd3e1){return _0xf60568['define'](_0x6176('0x8'),attributes,{'tableName':_0x6176('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x6176('0xa'),_0x6176('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x253a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','FieldId','lodash'];(function(_0x40c5f5,_0x1cfc46){var _0x64d316=function(_0xe1406e){while(--_0xe1406e){_0x40c5f5['push'](_0x40c5f5['shift']());}};_0x64d316(++_0x1cfc46);}(_0x253a,0x117));var _0xa253=function(_0x4244b1,_0x555b5c){_0x4244b1=_0x4244b1-0x0;var _0x25cfac=_0x253a[_0x4244b1];return _0x25cfac;};'use strict';var _=require(_0xa253('0x0'));var util=require('util');var logger=require(_0xa253('0x1'))(_0xa253('0x2'));var moment=require(_0xa253('0x3'));var BPromise=require(_0xa253('0x4'));var rp=require(_0xa253('0x5'));var fs=require('fs');var path=require(_0xa253('0x6'));var rimraf=require('rimraf');var config=require(_0xa253('0x7'));var attributes=require(_0xa253('0x8'));module[_0xa253('0x9')]=function(_0x192e07,_0x5855c2){return _0x192e07[_0xa253('0xa')](_0xa253('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xa253('0xc'),_0xa253('0xd')],'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 3f6b4e8..6bfb2d9 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 _0x7832=['code','message','result','catch','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xfaeb01,_0x580991){var _0x510748=function(_0x115965){while(--_0x115965){_0xfaeb01['push'](_0xfaeb01['shift']());}};_0x510748(++_0x580991);}(_0x7832,0x11c));var _0x2783=function(_0x25d974,_0x3f08de){_0x25d974=_0x25d974-0x0;var _0x331abb=_0x7832[_0x25d974];return _0x331abb;};'use strict';var _=require('lodash');var util=require(_0x2783('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2783('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2783('0x2'))(_0x2783('0x3'));var config=require(_0x2783('0x4'));var jayson=require(_0x2783('0x5'));var client=jayson[_0x2783('0x6')][_0x2783('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4759cd,_0x212efd,_0x3c796d){return new BPromise(function(_0x40134e,_0x3b8052){return client['request'](_0x4759cd,_0x3c796d)[_0x2783('0x8')](function(_0x1f7b6e){logger[_0x2783('0x9')](_0x2783('0xa'),_0x212efd,_0x2783('0xb'));logger[_0x2783('0xc')](_0x2783('0xd'),_0x212efd,'request\x20sent',JSON[_0x2783('0xe')](_0x1f7b6e));if(_0x1f7b6e[_0x2783('0xf')]){if(_0x1f7b6e['error'][_0x2783('0x10')]===0x1f4){logger[_0x2783('0xf')](_0x2783('0xa'),_0x212efd,_0x1f7b6e[_0x2783('0xf')]['message']);return _0x3b8052(_0x1f7b6e[_0x2783('0xf')]['message']);}logger[_0x2783('0xf')](_0x2783('0xa'),_0x212efd,_0x1f7b6e[_0x2783('0xf')][_0x2783('0x11')]);return _0x40134e(_0x1f7b6e['error'][_0x2783('0x11')]);}else{logger['info'](_0x2783('0xa'),_0x212efd,_0x2783('0xb'));_0x40134e(_0x1f7b6e[_0x2783('0x12')][_0x2783('0x11')]);}})[_0x2783('0x13')](function(_0x4e3927){logger[_0x2783('0xf')](_0x2783('0xa'),_0x212efd,_0x4e3927);_0x3b8052(_0x4e3927);});});} \ No newline at end of file +var _0x348d=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482b6c,_0xdf3672){var _0x177bc6=function(_0x18d261){while(--_0x18d261){_0x482b6c['push'](_0x482b6c['shift']());}};_0x177bc6(++_0xdf3672);}(_0x348d,0x15d));var _0xd348=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x348d[_0x3f2fea];return _0x69a4d5;};'use strict';var _=require(_0xd348('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd348('0x1'));var rs=require(_0xd348('0x2'));var fs=require('fs');var Redis=require(_0xd348('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd348('0x4'));var logger=require(_0xd348('0x5'))(_0xd348('0x6'));var config=require(_0xd348('0x7'));var jayson=require(_0xd348('0x8'));var client=jayson[_0xd348('0x9')][_0xd348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367504,_0x10b7df,_0x566ae7){return new BPromise(function(_0x28641c,_0x5c99a7){return client[_0xd348('0xb')](_0x367504,_0x566ae7)[_0xd348('0xc')](function(_0x30b08c){logger[_0xd348('0xd')](_0xd348('0xe'),_0x10b7df,_0xd348('0xf'));logger['debug'](_0xd348('0x10'),_0x10b7df,_0xd348('0xf'),JSON[_0xd348('0x11')](_0x30b08c));if(_0x30b08c['error']){if(_0x30b08c[_0xd348('0x12')][_0xd348('0x13')]===0x1f4){logger[_0xd348('0x12')](_0xd348('0xe'),_0x10b7df,_0x30b08c[_0xd348('0x12')][_0xd348('0x14')]);return _0x5c99a7(_0x30b08c[_0xd348('0x12')]['message']);}logger[_0xd348('0x12')](_0xd348('0xe'),_0x10b7df,_0x30b08c[_0xd348('0x12')][_0xd348('0x14')]);return _0x28641c(_0x30b08c[_0xd348('0x12')][_0xd348('0x14')]);}else{logger['info'](_0xd348('0xe'),_0x10b7df,_0xd348('0xf'));_0x28641c(_0x30b08c[_0xd348('0x15')][_0xd348('0x14')]);}})[_0xd348('0x16')](function(_0x578959){logger[_0xd348('0x12')](_0xd348('0xe'),_0x10b7df,_0x578959);_0x5c99a7(_0x578959);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3995c35..2c98e52 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 _0xe483=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x5522ee,_0x4137e8){var _0x34e787=function(_0x202631){while(--_0x202631){_0x5522ee['push'](_0x5522ee['shift']());}};_0x34e787(++_0x4137e8);}(_0xe483,0xc5));var _0x3e48=function(_0x305d72,_0x1d8545){_0x305d72=_0x305d72-0x0;var _0x3b4567=_0xe483[_0x305d72];return _0x3b4567;};'use strict';var multer=require(_0x3e48('0x0'));var util=require(_0x3e48('0x1'));var path=require(_0x3e48('0x2'));var timeout=require(_0x3e48('0x3'));var express=require(_0x3e48('0x4'));var router=express[_0x3e48('0x5')]();var fs_extra=require(_0x3e48('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e48('0x7'));var controller=require(_0x3e48('0x8'));router[_0x3e48('0x9')]('/',auth[_0x3e48('0xa')](),controller[_0x3e48('0xb')]);router[_0x3e48('0x9')](_0x3e48('0xc'),auth[_0x3e48('0xa')](),controller[_0x3e48('0xd')]);router['get'](_0x3e48('0xe'),auth[_0x3e48('0xa')](),controller[_0x3e48('0xf')]);router[_0x3e48('0x9')](_0x3e48('0x10'),auth[_0x3e48('0xa')](),controller[_0x3e48('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3e48('0x12')]);router['post']('/:id/configurations',auth[_0x3e48('0xa')](),controller['addConfiguration']);router[_0x3e48('0x13')](_0x3e48('0xc'),auth[_0x3e48('0xa')](),controller[_0x3e48('0x14')]);router[_0x3e48('0x15')]('/:id',auth[_0x3e48('0xa')](),controller[_0x3e48('0x16')]);module[_0x3e48('0x17')]=router; \ No newline at end of file +var _0x3acc=['path','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','multer','util'];(function(_0x197234,_0x3d2e7b){var _0xa65185=function(_0x56af94){while(--_0x56af94){_0x197234['push'](_0x197234['shift']());}};_0xa65185(++_0x3d2e7b);}(_0x3acc,0xc6));var _0xc3ac=function(_0x2cc294,_0x17e7cc){_0x2cc294=_0x2cc294-0x0;var _0x39246c=_0x3acc[_0x2cc294];return _0x39246c;};'use strict';var multer=require(_0xc3ac('0x0'));var util=require(_0xc3ac('0x1'));var path=require(_0xc3ac('0x2'));var timeout=require('connect-timeout');var express=require(_0xc3ac('0x3'));var router=express['Router']();var fs_extra=require(_0xc3ac('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3ac('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0xc3ac('0x6')]('/',auth[_0xc3ac('0x7')](),controller[_0xc3ac('0x8')]);router[_0xc3ac('0x6')](_0xc3ac('0x9'),auth[_0xc3ac('0x7')](),controller[_0xc3ac('0xa')]);router[_0xc3ac('0x6')](_0xc3ac('0xb'),auth[_0xc3ac('0x7')](),controller['getConfigurations']);router['get'](_0xc3ac('0xc'),auth[_0xc3ac('0x7')](),controller[_0xc3ac('0xd')]);router[_0xc3ac('0xe')]('/',auth[_0xc3ac('0x7')](),controller[_0xc3ac('0xf')]);router[_0xc3ac('0xe')](_0xc3ac('0xb'),auth['isAuthenticated'](),controller[_0xc3ac('0x10')]);router['put'](_0xc3ac('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc3ac('0x11')](_0xc3ac('0x9'),auth[_0xc3ac('0x7')](),controller[_0xc3ac('0x12')]);module[_0xc3ac('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index bc52fb0..bad64b4 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 _0x5fdc=['sequelize','exports','STRING','username','remoteUri'];(function(_0x5d50d7,_0x339501){var _0x4acb68=function(_0x6bd7a8){while(--_0x6bd7a8){_0x5d50d7['push'](_0x5d50d7['shift']());}};_0x4acb68(++_0x339501);}(_0x5fdc,0x127));var _0xc5fd=function(_0x29b5c5,_0xc65c31){_0x29b5c5=_0x29b5c5-0x0;var _0x2e0cff=_0x5fdc[_0x29b5c5];return _0x2e0cff;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'apiKey':{'type':Sequelize[_0xc5fd('0x2')]},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x4')},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x781d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x12ad1b,_0x106d01){var _0x22efbb=function(_0x468f70){while(--_0x468f70){_0x12ad1b['push'](_0x12ad1b['shift']());}};_0x22efbb(++_0x106d01);}(_0x781d,0x14a));var _0xd781=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x781d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x3')},'apiKey':{'type':Sequelize[_0xd781('0x2')]},'remoteUri':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x4')},'serverUrl':{'type':Sequelize[_0xd781('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 cdcc3fe..d2f4a31 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 _0x0b70=['ticket_type','remove','includes','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','order','findOne','getSubjects','channel','Descriptions','type','FreshdeskConfiguration','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','base64','requester','subject','group'];(function(_0x354a2d,_0x3c7596){var _0x2d28dd=function(_0x5cccd8){while(--_0x5cccd8){_0x354a2d['push'](_0x354a2d['shift']());}};_0x2d28dd(++_0x3c7596);}(_0x0b70,0x159));var _0x00b7=function(_0x4a6c7d,_0x5d71e6){_0x4a6c7d=_0x4a6c7d-0x0;var _0x525c49=_0x0b70[_0x4a6c7d];return _0x525c49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00b7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00b7('0x1'));var rp=require(_0x00b7('0x2'));var moment=require('moment');var BPromise=require(_0x00b7('0x3'));var Mustache=require(_0x00b7('0x4'));var util=require(_0x00b7('0x5'));var path=require('path');var sox=require(_0x00b7('0x6'));var csv=require('to-csv');var ejs=require(_0x00b7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00b7('0x8'));var squel=require('squel');var crypto=require(_0x00b7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x00b7('0xa'));var toCsv=require(_0x00b7('0xb'));var querystring=require(_0x00b7('0xc'));var Papa=require(_0x00b7('0xd'));var Redis=require('ioredis');var authService=require(_0x00b7('0xe'));var qs=require(_0x00b7('0xf'));var as=require(_0x00b7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00b7('0x11'))('api');var utils=require(_0x00b7('0x12'));var config=require(_0x00b7('0x13'));var licenseUtil=require(_0x00b7('0x14'));var db=require(_0x00b7('0x15'))['db'];var integrations=require(_0x00b7('0x16'));function respondWithStatusCode(_0x32e813,_0x14dce6){_0x14dce6=_0x14dce6||0xcc;return function(_0x47edc1){if(_0x47edc1){return _0x32e813[_0x00b7('0x17')](_0x14dce6);}return _0x32e813[_0x00b7('0x18')](_0x14dce6)['end']();};}function respondWithResult(_0x3b03af,_0x2872a5){_0x2872a5=_0x2872a5||0xc8;return function(_0x4c81fe){if(_0x4c81fe){return _0x3b03af['status'](_0x2872a5)[_0x00b7('0x19')](_0x4c81fe);}};}function respondWithFilteredResult(_0x1a06cc,_0x18f7fb){return function(_0x17e0d0){if(_0x17e0d0){var _0x98c186=typeof _0x18f7fb[_0x00b7('0x1a')]===_0x00b7('0x1b')&&typeof _0x18f7fb[_0x00b7('0x1c')]==='undefined';var _0x32b4d1=_0x17e0d0['count'];var _0x16445c=_0x98c186?0x0:_0x18f7fb[_0x00b7('0x1a')];var _0x19a058=_0x98c186?_0x17e0d0[_0x00b7('0x1d')]:_0x18f7fb[_0x00b7('0x1a')]+_0x18f7fb[_0x00b7('0x1c')];var _0xa700bc;if(_0x19a058>=_0x32b4d1){_0x19a058=_0x32b4d1;_0xa700bc=0xc8;}else{_0xa700bc=0xce;}_0x1a06cc[_0x00b7('0x18')](_0xa700bc);return _0x1a06cc[_0x00b7('0x1e')](_0x00b7('0x1f'),_0x16445c+'-'+_0x19a058+'/'+_0x32b4d1)[_0x00b7('0x19')](_0x17e0d0);}return null;};}function patchUpdates(_0x44ed4a){return function(_0x3e19fe){try{jsonpatch[_0x00b7('0x20')](_0x3e19fe,_0x44ed4a,!![]);}catch(_0xd34727){return BPromise[_0x00b7('0x21')](_0xd34727);}return _0x3e19fe[_0x00b7('0x22')]();};}function saveUpdates(_0x54f56c,_0x25a916){return function(_0xe509c4){if(_0xe509c4){return _0xe509c4[_0x00b7('0x23')](_0x54f56c)[_0x00b7('0x24')](function(_0x416946){return _0x416946;});}return null;};}function removeEntity(_0x3a3587,_0x3721df){return function(_0x39b353){if(_0x39b353){return _0x39b353[_0x00b7('0x25')]()[_0x00b7('0x24')](function(){_0x3a3587[_0x00b7('0x18')](0xcc)[_0x00b7('0x26')]();});}};}function handleEntityNotFound(_0xe20017,_0x4fe020){return function(_0x3f8fd8){if(!_0x3f8fd8){_0xe20017['sendStatus'](0x194);}return _0x3f8fd8;};}function handleError(_0x5bd947,_0x45dd9b){_0x45dd9b=_0x45dd9b||0x1f4;return function(_0xedf626){logger[_0x00b7('0x27')](_0xedf626[_0x00b7('0x28')]);if(_0xedf626['name']){delete _0xedf626[_0x00b7('0x29')];}_0x5bd947[_0x00b7('0x18')](_0x45dd9b)[_0x00b7('0x2a')](_0xedf626);};}exports[_0x00b7('0x2b')]=function(_0x6dda2a,_0x246737){var _0x29e998={},_0x47f92={},_0x348cfd={'count':0x0,'rows':[]};var _0x3a9059=_[_0x00b7('0x2c')](db[_0x00b7('0x2d')][_0x00b7('0x2e')],function(_0x5c46cb){return{'name':_0x5c46cb[_0x00b7('0x2f')],'type':_0x5c46cb['type'][_0x00b7('0x30')]};});_0x47f92[_0x00b7('0x31')]=_['map'](_0x3a9059,_0x00b7('0x29'));_0x47f92[_0x00b7('0x32')]=_[_0x00b7('0x33')](_0x6dda2a[_0x00b7('0x32')]);_0x47f92[_0x00b7('0x34')]=_[_0x00b7('0x35')](_0x47f92[_0x00b7('0x31')],_0x47f92[_0x00b7('0x32')]);_0x29e998[_0x00b7('0x36')]=_[_0x00b7('0x35')](_0x47f92[_0x00b7('0x31')],qs[_0x00b7('0x37')](_0x6dda2a[_0x00b7('0x32')][_0x00b7('0x37')]));_0x29e998['attributes']=_0x29e998[_0x00b7('0x36')][_0x00b7('0x38')]?_0x29e998[_0x00b7('0x36')]:_0x47f92[_0x00b7('0x31')];if(!_0x6dda2a['query'][_0x00b7('0x39')](_0x00b7('0x3a'))){_0x29e998[_0x00b7('0x1c')]=qs[_0x00b7('0x1c')](_0x6dda2a['query'][_0x00b7('0x1c')]);_0x29e998[_0x00b7('0x1a')]=qs[_0x00b7('0x1a')](_0x6dda2a[_0x00b7('0x32')][_0x00b7('0x1a')]);}_0x29e998['order']=qs[_0x00b7('0x3b')](_0x6dda2a[_0x00b7('0x32')][_0x00b7('0x3b')]);_0x29e998[_0x00b7('0x3c')]=qs[_0x00b7('0x34')](_[_0x00b7('0x3d')](_0x6dda2a['query'],_0x47f92['filters']),_0x3a9059);if(_0x6dda2a[_0x00b7('0x32')][_0x00b7('0x3e')]){_0x29e998[_0x00b7('0x3c')]=_[_0x00b7('0x3f')](_0x29e998[_0x00b7('0x3c')],{'$or':_[_0x00b7('0x2c')](_0x3a9059,function(_0x651d56){if(_0x651d56['type']!==_0x00b7('0x40')){var _0xd0546e={};_0xd0546e[_0x651d56[_0x00b7('0x29')]]={'$like':'%'+_0x6dda2a['query'][_0x00b7('0x3e')]+'%'};return _0xd0546e;}})});}_0x29e998=_[_0x00b7('0x3f')]({},_0x29e998,_0x6dda2a[_0x00b7('0x41')]);var _0x47af09={'where':_0x29e998['where']};return db[_0x00b7('0x2d')][_0x00b7('0x1d')](_0x47af09)[_0x00b7('0x24')](function(_0x34e371){_0x348cfd['count']=_0x34e371;if(_0x6dda2a[_0x00b7('0x32')][_0x00b7('0x42')]){_0x29e998[_0x00b7('0x43')]=[{'all':!![]}];}return db[_0x00b7('0x2d')][_0x00b7('0x44')](_0x29e998);})[_0x00b7('0x24')](function(_0x39733e){_0x348cfd[_0x00b7('0x45')]=_0x39733e;return _0x348cfd;})[_0x00b7('0x24')](respondWithFilteredResult(_0x246737,_0x29e998))[_0x00b7('0x46')](handleError(_0x246737,null));};exports[_0x00b7('0x47')]=function(_0x32d9d2,_0x547346){var _0x538f40={'raw':![],'where':{'id':_0x32d9d2[_0x00b7('0x48')]['id']}},_0x45d92a={};_0x45d92a[_0x00b7('0x31')]=_[_0x00b7('0x33')](db[_0x00b7('0x2d')][_0x00b7('0x2e')]);_0x45d92a['query']=_['keys'](_0x32d9d2[_0x00b7('0x32')]);_0x45d92a['filters']=_[_0x00b7('0x35')](_0x45d92a[_0x00b7('0x31')],_0x45d92a[_0x00b7('0x32')]);_0x538f40['attributes']=_[_0x00b7('0x35')](_0x45d92a[_0x00b7('0x31')],qs[_0x00b7('0x37')](_0x32d9d2['query'][_0x00b7('0x37')]));_0x538f40[_0x00b7('0x36')]=_0x538f40[_0x00b7('0x36')][_0x00b7('0x38')]?_0x538f40['attributes']:_0x45d92a[_0x00b7('0x31')];if(_0x32d9d2[_0x00b7('0x32')][_0x00b7('0x42')]){_0x538f40[_0x00b7('0x43')]=[{'all':!![]}];}_0x538f40=_[_0x00b7('0x3f')]({},_0x538f40,_0x32d9d2['options']);return db[_0x00b7('0x2d')][_0x00b7('0x49')](_0x538f40)['then'](handleEntityNotFound(_0x547346,null))[_0x00b7('0x24')](respondWithResult(_0x547346,null))['catch'](handleError(_0x547346,null));};exports[_0x00b7('0x4a')]=function(_0x526c05,_0x4d4c4a){return db[_0x00b7('0x2d')][_0x00b7('0x4a')](_0x526c05[_0x00b7('0x4b')],{})[_0x00b7('0x24')](respondWithResult(_0x4d4c4a,0xc9))['catch'](handleError(_0x4d4c4a,null));};exports[_0x00b7('0x23')]=function(_0x115b7d,_0xa07fc7){if(_0x115b7d[_0x00b7('0x4b')]['id']){delete _0x115b7d[_0x00b7('0x4b')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x115b7d[_0x00b7('0x48')]['id']}})[_0x00b7('0x24')](handleEntityNotFound(_0xa07fc7,null))[_0x00b7('0x24')](saveUpdates(_0x115b7d[_0x00b7('0x4b')],null))[_0x00b7('0x24')](respondWithResult(_0xa07fc7,null))[_0x00b7('0x46')](handleError(_0xa07fc7,null));};exports[_0x00b7('0x25')]=function(_0x1389e3,_0x24528f){return db[_0x00b7('0x2d')]['find']({'where':{'id':_0x1389e3[_0x00b7('0x48')]['id']}})[_0x00b7('0x24')](handleEntityNotFound(_0x24528f,null))[_0x00b7('0x24')](removeEntity(_0x24528f,null))[_0x00b7('0x46')](handleError(_0x24528f,null));};exports[_0x00b7('0x4c')]=function(_0x235315,_0x391f36,_0x138acd){var _0x12d138={};var _0xa97bf9={};var _0x415155;var _0x391e3f;return db[_0x00b7('0x2d')]['findOne']({'where':{'id':_0x235315['params']['id']}})[_0x00b7('0x24')](handleEntityNotFound(_0x391f36,null))[_0x00b7('0x24')](function(_0x10c025){if(_0x10c025){_0x415155=_0x10c025;_0xa97bf9[_0x00b7('0x31')]=_[_0x00b7('0x33')](db['FreshdeskConfiguration'][_0x00b7('0x2e')]);_0xa97bf9[_0x00b7('0x32')]=_[_0x00b7('0x33')](_0x235315[_0x00b7('0x32')]);_0xa97bf9['filters']=_[_0x00b7('0x35')](_0xa97bf9[_0x00b7('0x31')],_0xa97bf9[_0x00b7('0x32')]);_0x12d138['attributes']=_[_0x00b7('0x35')](_0xa97bf9[_0x00b7('0x31')],qs['fields'](_0x235315['query'][_0x00b7('0x37')]));_0x12d138[_0x00b7('0x36')]=_0x12d138[_0x00b7('0x36')][_0x00b7('0x38')]?_0x12d138[_0x00b7('0x36')]:_0xa97bf9['model'];_0x12d138[_0x00b7('0x4d')]=qs[_0x00b7('0x3b')](_0x235315[_0x00b7('0x32')][_0x00b7('0x3b')]);_0x12d138[_0x00b7('0x3c')]=qs[_0x00b7('0x34')](_[_0x00b7('0x3d')](_0x235315[_0x00b7('0x32')],_0xa97bf9['filters']));if(_0x235315[_0x00b7('0x32')][_0x00b7('0x3e')]){_0x12d138['where']=_[_0x00b7('0x3f')](_0x12d138[_0x00b7('0x3c')],{'$or':_['map'](_0x12d138[_0x00b7('0x36')],function(_0x145352){var _0x482c6c={};_0x482c6c[_0x145352]={'$like':'%'+_0x235315[_0x00b7('0x32')][_0x00b7('0x3e')]+'%'};return _0x482c6c;})});}_0x12d138=_[_0x00b7('0x3f')]({},_0x12d138,_0x235315[_0x00b7('0x41')]);return _0x415155[_0x00b7('0x4c')](_0x12d138);}})[_0x00b7('0x24')](function(_0x2d9539){if(_0x2d9539){_0x391e3f=_0x2d9539[_0x00b7('0x38')];if(!_0x235315[_0x00b7('0x32')][_0x00b7('0x39')](_0x00b7('0x3a'))){_0x12d138[_0x00b7('0x1c')]=qs[_0x00b7('0x1c')](_0x235315[_0x00b7('0x32')][_0x00b7('0x1c')]);_0x12d138[_0x00b7('0x1a')]=qs[_0x00b7('0x1a')](_0x235315['query'][_0x00b7('0x1a')]);}return _0x415155[_0x00b7('0x4c')](_0x12d138);}})[_0x00b7('0x24')](function(_0x32a17f){if(_0x32a17f){return _0x32a17f?{'count':_0x391e3f,'rows':_0x32a17f}:null;}})['then'](respondWithResult(_0x391f36,null))['catch'](handleError(_0x391f36,null));};exports['addConfiguration']=function(_0x1342e8,_0x2bdfc3,_0x175b8e){if(_0x1342e8[_0x00b7('0x4b')]['id']){delete _0x1342e8[_0x00b7('0x4b')]['id'];}return db['FreshdeskAccount'][_0x00b7('0x4e')]({'where':{'id':_0x1342e8[_0x00b7('0x48')]['id']}})[_0x00b7('0x24')](handleEntityNotFound(_0x2bdfc3,null))['then'](function(_0xe28eb6){if(_0xe28eb6){_0x1342e8[_0x00b7('0x4b')]['AccountId']=_0xe28eb6['id'];_0x1342e8[_0x00b7('0x4b')]['Subjects']=integrations[_0x00b7('0x4f')](_0x1342e8[_0x00b7('0x4b')][_0x00b7('0x50')],_0x1342e8[_0x00b7('0x4b')]['type']);_0x1342e8[_0x00b7('0x4b')][_0x00b7('0x51')]=integrations['getDescriptions'](_0x1342e8[_0x00b7('0x4b')][_0x00b7('0x50')],_0x1342e8['body'][_0x00b7('0x52')]);return db[_0x00b7('0x53')][_0x00b7('0x4a')](_0x1342e8[_0x00b7('0x4b')],{'include':[{'model':db[_0x00b7('0x54')],'as':_0x00b7('0x55')},{'model':db['FreshdeskField'],'as':_0x00b7('0x51')}]});}return null;})[_0x00b7('0x24')](respondWithResult(_0x2bdfc3,null))[_0x00b7('0x46')](handleError(_0x2bdfc3,null));};exports[_0x00b7('0x56')]=function(_0x589929,_0x29e02f,_0x4384b2){var _0x13e6ba='';return db[_0x00b7('0x2d')][_0x00b7('0x4e')]({'where':{'id':_0x589929['params']['id']},'attributes':['id',_0x00b7('0x57'),_0x00b7('0x58')]})[_0x00b7('0x24')](handleEntityNotFound(_0x29e02f,null))[_0x00b7('0x24')](function(_0x5f1a22){if(_0x5f1a22){_0x13e6ba=_0x5f1a22[_0x00b7('0x57')];var _0x1bc0c3=_0x13e6ba[_0x00b7('0x59')](-0x1);if(_0x1bc0c3==='/'){_0x13e6ba=_0x13e6ba[_0x00b7('0x5a')](0x0,_0x13e6ba['lastIndexOf'](_0x1bc0c3));}return rp({'method':_0x00b7('0x5b'),'uri':util[_0x00b7('0x5c')]('%s/%s',_0x13e6ba,_0x00b7('0x5d')),'headers':{'Authorization':util['format'](_0x00b7('0x5e'),new Buffer(util[_0x00b7('0x5c')]('%s:X',_0x5f1a22['apiKey']))['toString'](_0x00b7('0x5f')))},'json':!![]});}})[_0x00b7('0x24')](function(_0x1ecb37){if(_0x1ecb37){var _0x231ae8=[_0x00b7('0x60'),_0x00b7('0x61'),'agent','description','status','priority',_0x00b7('0x62'),'source',_0x00b7('0x63'),_0x00b7('0x62'),'company'];_[_0x00b7('0x64')](_0x1ecb37,function(_0x53c129){return _0x231ae8[_0x00b7('0x65')](_0x53c129[_0x00b7('0x29')])||!_0x53c129['default']&&_0x53c129['type']!=='custom_text'&&_0x53c129[_0x00b7('0x52')]!==_0x00b7('0x66');});return{'count':_0x1ecb37[_0x00b7('0x38')],'rows':_[_0x00b7('0x2c')](_0x1ecb37,function(_0x4f89a6){return{'id':_0x4f89a6[_0x00b7('0x29')],'name':_0x4f89a6[_0x00b7('0x67')],'custom':!_0x4f89a6[_0x00b7('0x68')],'options':_0x4f89a6[_0x00b7('0x69')]?_[_0x00b7('0x2c')](_0x4f89a6[_0x00b7('0x69')],function(_0x3a3933){return{'name':_[_0x00b7('0x6a')](_0x3a3933),'value':_0x3a3933};}):[]};})};}})[_0x00b7('0x24')](respondWithResult(_0x29e02f,null))[_0x00b7('0x46')](function(_0x64ae18){var _0x150e24=_0x589929[_0x00b7('0x32')][_0x00b7('0x6b')]?0x1f4:_0x64ae18[_0x00b7('0x6c')]||0x1f4;logger[_0x00b7('0x27')](_0x00b7('0x6d'),_0x00b7('0x56'),_0x150e24,JSON['stringify'](_0x64ae18));delete _0x64ae18[_0x00b7('0x29')];if(_0x150e24===0x191){_0x150e24=0x190;}_0x29e02f[_0x00b7('0x18')](_0x150e24)[_0x00b7('0x2a')](_0x589929[_0x00b7('0x32')][_0x00b7('0x6b')]?{'message':_0x00b7('0x6e'),'statusCode':_0x64ae18[_0x00b7('0x6c')]}:_0x64ae18);});}; \ No newline at end of file +var _0x153c=['Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','toString','base64','subject','agent','description','priority','group','source','ticket_type','company','remove','custom_text','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','create','body','find','getConfigurations','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField'];(function(_0x308ca4,_0x57770b){var _0x4086a9=function(_0x31014b){while(--_0x31014b){_0x308ca4['push'](_0x308ca4['shift']());}};_0x4086a9(++_0x57770b);}(_0x153c,0x8c));var _0xc153=function(_0x24b2d2,_0x22fd7e){_0x24b2d2=_0x24b2d2-0x0;var _0x14c929=_0x153c[_0x24b2d2];return _0x14c929;};'use strict';var emlformat=require(_0xc153('0x0'));var rimraf=require(_0xc153('0x1'));var zipdir=require(_0xc153('0x2'));var jsonpatch=require(_0xc153('0x3'));var rp=require('request-promise');var moment=require(_0xc153('0x4'));var BPromise=require(_0xc153('0x5'));var Mustache=require(_0xc153('0x6'));var util=require(_0xc153('0x7'));var path=require(_0xc153('0x8'));var sox=require(_0xc153('0x9'));var csv=require(_0xc153('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc153('0xb'));var _=require(_0xc153('0xc'));var squel=require(_0xc153('0xd'));var crypto=require(_0xc153('0xe'));var jsforce=require(_0xc153('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc153('0x10'));var Redis=require(_0xc153('0x11'));var authService=require(_0xc153('0x12'));var qs=require(_0xc153('0x13'));var as=require(_0xc153('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc153('0x15'));var utils=require(_0xc153('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc153('0x17'));var db=require(_0xc153('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x49286f,_0x1c9d09){_0x1c9d09=_0x1c9d09||0xcc;return function(_0x1f7c65){if(_0x1f7c65){return _0x49286f[_0xc153('0x19')](_0x1c9d09);}return _0x49286f['status'](_0x1c9d09)[_0xc153('0x1a')]();};}function respondWithResult(_0xaa835a,_0x1c7d6c){_0x1c7d6c=_0x1c7d6c||0xc8;return function(_0x4e4a09){if(_0x4e4a09){return _0xaa835a[_0xc153('0x1b')](_0x1c7d6c)[_0xc153('0x1c')](_0x4e4a09);}};}function respondWithFilteredResult(_0x5b74a2,_0x51a814){return function(_0x41c1a3){if(_0x41c1a3){var _0x12d901=typeof _0x51a814[_0xc153('0x1d')]===_0xc153('0x1e')&&typeof _0x51a814[_0xc153('0x1f')]===_0xc153('0x1e');var _0x4804bc=_0x41c1a3[_0xc153('0x20')];var _0x54466a=_0x12d901?0x0:_0x51a814[_0xc153('0x1d')];var _0x16cfce=_0x12d901?_0x41c1a3[_0xc153('0x20')]:_0x51a814['offset']+_0x51a814[_0xc153('0x1f')];var _0x4aa563;if(_0x16cfce>=_0x4804bc){_0x16cfce=_0x4804bc;_0x4aa563=0xc8;}else{_0x4aa563=0xce;}_0x5b74a2['status'](_0x4aa563);return _0x5b74a2[_0xc153('0x21')](_0xc153('0x22'),_0x54466a+'-'+_0x16cfce+'/'+_0x4804bc)[_0xc153('0x1c')](_0x41c1a3);}return null;};}function patchUpdates(_0x95a64c){return function(_0x23fbb7){try{jsonpatch[_0xc153('0x23')](_0x23fbb7,_0x95a64c,!![]);}catch(_0x5e858d){return BPromise[_0xc153('0x24')](_0x5e858d);}return _0x23fbb7['save']();};}function saveUpdates(_0x458593,_0x1442a6){return function(_0x35335c){if(_0x35335c){return _0x35335c[_0xc153('0x25')](_0x458593)['then'](function(_0x4ac708){return _0x4ac708;});}return null;};}function removeEntity(_0x166f62,_0x4b20e0){return function(_0x22fa39){if(_0x22fa39){return _0x22fa39[_0xc153('0x26')]()[_0xc153('0x27')](function(){_0x166f62[_0xc153('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47915b,_0x39bbdb){return function(_0x401487){if(!_0x401487){_0x47915b[_0xc153('0x19')](0x194);}return _0x401487;};}function handleError(_0x159823,_0x13c7ff){_0x13c7ff=_0x13c7ff||0x1f4;return function(_0x50ff30){logger[_0xc153('0x28')](_0x50ff30['stack']);if(_0x50ff30[_0xc153('0x29')]){delete _0x50ff30[_0xc153('0x29')];}_0x159823['status'](_0x13c7ff)[_0xc153('0x2a')](_0x50ff30);};}exports[_0xc153('0x2b')]=function(_0x4c0882,_0xec10bf){var _0x919f0a={},_0x27315f={},_0x502182={'count':0x0,'rows':[]};var _0x66e9f6=_[_0xc153('0x2c')](db[_0xc153('0x2d')]['rawAttributes'],function(_0x42da38){return{'name':_0x42da38[_0xc153('0x2e')],'type':_0x42da38[_0xc153('0x2f')][_0xc153('0x30')]};});_0x27315f['model']=_[_0xc153('0x2c')](_0x66e9f6,'name');_0x27315f[_0xc153('0x31')]=_['keys'](_0x4c0882[_0xc153('0x31')]);_0x27315f[_0xc153('0x32')]=_['intersection'](_0x27315f[_0xc153('0x33')],_0x27315f['query']);_0x919f0a['attributes']=_[_0xc153('0x34')](_0x27315f[_0xc153('0x33')],qs[_0xc153('0x35')](_0x4c0882[_0xc153('0x31')][_0xc153('0x35')]));_0x919f0a['attributes']=_0x919f0a[_0xc153('0x36')][_0xc153('0x37')]?_0x919f0a[_0xc153('0x36')]:_0x27315f[_0xc153('0x33')];if(!_0x4c0882[_0xc153('0x31')][_0xc153('0x38')](_0xc153('0x39'))){_0x919f0a[_0xc153('0x1f')]=qs[_0xc153('0x1f')](_0x4c0882[_0xc153('0x31')]['limit']);_0x919f0a['offset']=qs[_0xc153('0x1d')](_0x4c0882['query'][_0xc153('0x1d')]);}_0x919f0a[_0xc153('0x3a')]=qs[_0xc153('0x3b')](_0x4c0882['query'][_0xc153('0x3b')]);_0x919f0a[_0xc153('0x3c')]=qs[_0xc153('0x32')](_[_0xc153('0x3d')](_0x4c0882[_0xc153('0x31')],_0x27315f[_0xc153('0x32')]),_0x66e9f6);if(_0x4c0882[_0xc153('0x31')][_0xc153('0x3e')]){_0x919f0a['where']=_['merge'](_0x919f0a[_0xc153('0x3c')],{'$or':_[_0xc153('0x2c')](_0x66e9f6,function(_0x30017d){if(_0x30017d[_0xc153('0x2f')]!==_0xc153('0x3f')){var _0x226a9e={};_0x226a9e[_0x30017d['name']]={'$like':'%'+_0x4c0882[_0xc153('0x31')][_0xc153('0x3e')]+'%'};return _0x226a9e;}})});}_0x919f0a=_[_0xc153('0x40')]({},_0x919f0a,_0x4c0882['options']);var _0x90a67={'where':_0x919f0a[_0xc153('0x3c')]};return db[_0xc153('0x2d')]['count'](_0x90a67)['then'](function(_0x52d318){_0x502182['count']=_0x52d318;if(_0x4c0882['query'][_0xc153('0x41')]){_0x919f0a['include']=[{'all':!![]}];}return db[_0xc153('0x2d')][_0xc153('0x42')](_0x919f0a);})[_0xc153('0x27')](function(_0x381722){_0x502182[_0xc153('0x43')]=_0x381722;return _0x502182;})[_0xc153('0x27')](respondWithFilteredResult(_0xec10bf,_0x919f0a))[_0xc153('0x44')](handleError(_0xec10bf,null));};exports[_0xc153('0x45')]=function(_0x46b245,_0x711bd0){var _0x34a3b2={'raw':![],'where':{'id':_0x46b245[_0xc153('0x46')]['id']}},_0x1893a1={};_0x1893a1['model']=_[_0xc153('0x47')](db[_0xc153('0x2d')][_0xc153('0x48')]);_0x1893a1[_0xc153('0x31')]=_[_0xc153('0x47')](_0x46b245['query']);_0x1893a1[_0xc153('0x32')]=_[_0xc153('0x34')](_0x1893a1['model'],_0x1893a1['query']);_0x34a3b2[_0xc153('0x36')]=_['intersection'](_0x1893a1['model'],qs['fields'](_0x46b245[_0xc153('0x31')]['fields']));_0x34a3b2[_0xc153('0x36')]=_0x34a3b2[_0xc153('0x36')][_0xc153('0x37')]?_0x34a3b2['attributes']:_0x1893a1['model'];if(_0x46b245[_0xc153('0x31')][_0xc153('0x41')]){_0x34a3b2[_0xc153('0x49')]=[{'all':!![]}];}_0x34a3b2=_[_0xc153('0x40')]({},_0x34a3b2,_0x46b245[_0xc153('0x4a')]);return db['FreshdeskAccount']['find'](_0x34a3b2)[_0xc153('0x27')](handleEntityNotFound(_0x711bd0,null))['then'](respondWithResult(_0x711bd0,null))['catch'](handleError(_0x711bd0,null));};exports['create']=function(_0x5bfb6f,_0x3c5f0c){return db['FreshdeskAccount'][_0xc153('0x4b')](_0x5bfb6f[_0xc153('0x4c')],{})[_0xc153('0x27')](respondWithResult(_0x3c5f0c,0xc9))[_0xc153('0x44')](handleError(_0x3c5f0c,null));};exports[_0xc153('0x25')]=function(_0x4bceb0,_0x101f91){if(_0x4bceb0[_0xc153('0x4c')]['id']){delete _0x4bceb0[_0xc153('0x4c')]['id'];}return db[_0xc153('0x2d')][_0xc153('0x4d')]({'where':{'id':_0x4bceb0['params']['id']}})['then'](handleEntityNotFound(_0x101f91,null))[_0xc153('0x27')](saveUpdates(_0x4bceb0['body'],null))[_0xc153('0x27')](respondWithResult(_0x101f91,null))[_0xc153('0x44')](handleError(_0x101f91,null));};exports[_0xc153('0x26')]=function(_0x41fe1d,_0x89aae1){return db[_0xc153('0x2d')][_0xc153('0x4d')]({'where':{'id':_0x41fe1d['params']['id']}})[_0xc153('0x27')](handleEntityNotFound(_0x89aae1,null))['then'](removeEntity(_0x89aae1,null))['catch'](handleError(_0x89aae1,null));};exports[_0xc153('0x4e')]=function(_0x12bdbc,_0x8b6ec0,_0x35a019){var _0x31c237={};var _0xec4375={};var _0x3aae8f;var _0x39e810;return db[_0xc153('0x2d')][_0xc153('0x4f')]({'where':{'id':_0x12bdbc[_0xc153('0x46')]['id']}})[_0xc153('0x27')](handleEntityNotFound(_0x8b6ec0,null))[_0xc153('0x27')](function(_0x188f75){if(_0x188f75){_0x3aae8f=_0x188f75;_0xec4375[_0xc153('0x33')]=_[_0xc153('0x47')](db['FreshdeskConfiguration'][_0xc153('0x48')]);_0xec4375[_0xc153('0x31')]=_[_0xc153('0x47')](_0x12bdbc[_0xc153('0x31')]);_0xec4375[_0xc153('0x32')]=_[_0xc153('0x34')](_0xec4375[_0xc153('0x33')],_0xec4375[_0xc153('0x31')]);_0x31c237[_0xc153('0x36')]=_[_0xc153('0x34')](_0xec4375['model'],qs['fields'](_0x12bdbc['query'][_0xc153('0x35')]));_0x31c237[_0xc153('0x36')]=_0x31c237[_0xc153('0x36')][_0xc153('0x37')]?_0x31c237['attributes']:_0xec4375[_0xc153('0x33')];_0x31c237[_0xc153('0x3a')]=qs[_0xc153('0x3b')](_0x12bdbc[_0xc153('0x31')][_0xc153('0x3b')]);_0x31c237[_0xc153('0x3c')]=qs[_0xc153('0x32')](_[_0xc153('0x3d')](_0x12bdbc['query'],_0xec4375[_0xc153('0x32')]));if(_0x12bdbc[_0xc153('0x31')][_0xc153('0x3e')]){_0x31c237[_0xc153('0x3c')]=_[_0xc153('0x40')](_0x31c237[_0xc153('0x3c')],{'$or':_[_0xc153('0x2c')](_0x31c237['attributes'],function(_0x2e385e){var _0x7d722={};_0x7d722[_0x2e385e]={'$like':'%'+_0x12bdbc[_0xc153('0x31')][_0xc153('0x3e')]+'%'};return _0x7d722;})});}_0x31c237=_[_0xc153('0x40')]({},_0x31c237,_0x12bdbc[_0xc153('0x4a')]);return _0x3aae8f['getConfigurations'](_0x31c237);}})[_0xc153('0x27')](function(_0x38f484){if(_0x38f484){_0x39e810=_0x38f484[_0xc153('0x37')];if(!_0x12bdbc['query'][_0xc153('0x38')](_0xc153('0x39'))){_0x31c237[_0xc153('0x1f')]=qs[_0xc153('0x1f')](_0x12bdbc[_0xc153('0x31')][_0xc153('0x1f')]);_0x31c237[_0xc153('0x1d')]=qs[_0xc153('0x1d')](_0x12bdbc[_0xc153('0x31')][_0xc153('0x1d')]);}return _0x3aae8f[_0xc153('0x4e')](_0x31c237);}})[_0xc153('0x27')](function(_0x523218){if(_0x523218){return _0x523218?{'count':_0x39e810,'rows':_0x523218}:null;}})[_0xc153('0x27')](respondWithResult(_0x8b6ec0,null))[_0xc153('0x44')](handleError(_0x8b6ec0,null));};exports['addConfiguration']=function(_0x426f91,_0x19ec78,_0xe59c72){if(_0x426f91[_0xc153('0x4c')]['id']){delete _0x426f91[_0xc153('0x4c')]['id'];}return db[_0xc153('0x2d')]['findOne']({'where':{'id':_0x426f91['params']['id']}})[_0xc153('0x27')](handleEntityNotFound(_0x19ec78,null))[_0xc153('0x27')](function(_0x56031f){if(_0x56031f){_0x426f91['body'][_0xc153('0x50')]=_0x56031f['id'];_0x426f91[_0xc153('0x4c')]['Subjects']=integrations[_0xc153('0x51')](_0x426f91[_0xc153('0x4c')][_0xc153('0x52')],_0x426f91['body'][_0xc153('0x2f')]);_0x426f91[_0xc153('0x4c')]['Descriptions']=integrations[_0xc153('0x53')](_0x426f91[_0xc153('0x4c')]['channel'],_0x426f91[_0xc153('0x4c')][_0xc153('0x2f')]);return db[_0xc153('0x54')]['create'](_0x426f91['body'],{'include':[{'model':db[_0xc153('0x55')],'as':'Subjects'},{'model':db[_0xc153('0x55')],'as':_0xc153('0x56')}]});}return null;})[_0xc153('0x27')](respondWithResult(_0x19ec78,null))[_0xc153('0x44')](handleError(_0x19ec78,null));};exports['getFields']=function(_0x5270a0,_0x25c87f,_0x2a1d7c){var _0x251bbd='';return db[_0xc153('0x2d')][_0xc153('0x4f')]({'where':{'id':_0x5270a0[_0xc153('0x46')]['id']},'attributes':['id',_0xc153('0x57'),_0xc153('0x58')]})[_0xc153('0x27')](handleEntityNotFound(_0x25c87f,null))['then'](function(_0xed4a50){if(_0xed4a50){_0x251bbd=_0xed4a50['remoteUri'];var _0xa3886d=_0x251bbd[_0xc153('0x59')](-0x1);if(_0xa3886d==='/'){_0x251bbd=_0x251bbd[_0xc153('0x5a')](0x0,_0x251bbd[_0xc153('0x5b')](_0xa3886d));}return rp({'method':'GET','uri':util[_0xc153('0x5c')](_0xc153('0x5d'),_0x251bbd,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xc153('0x5c')]('Basic\x20%s',new Buffer(util[_0xc153('0x5c')]('%s:X',_0xed4a50[_0xc153('0x58')]))[_0xc153('0x5e')](_0xc153('0x5f')))},'json':!![]});}})[_0xc153('0x27')](function(_0x4104b3){if(_0x4104b3){var _0x3ab4c2=['requester',_0xc153('0x60'),_0xc153('0x61'),_0xc153('0x62'),_0xc153('0x1b'),_0xc153('0x63'),_0xc153('0x64'),_0xc153('0x65'),_0xc153('0x66'),_0xc153('0x64'),_0xc153('0x67')];_[_0xc153('0x68')](_0x4104b3,function(_0x1c4529){return _0x3ab4c2['includes'](_0x1c4529['name'])||!_0x1c4529['default']&&_0x1c4529[_0xc153('0x2f')]!==_0xc153('0x69')&&_0x1c4529[_0xc153('0x2f')]!=='custom_dropdown';});return{'count':_0x4104b3[_0xc153('0x37')],'rows':_[_0xc153('0x2c')](_0x4104b3,function(_0x5c4c3c){return{'id':_0x5c4c3c[_0xc153('0x29')],'name':_0x5c4c3c['label'],'custom':!_0x5c4c3c['default'],'options':_0x5c4c3c[_0xc153('0x6a')]?_[_0xc153('0x2c')](_0x5c4c3c['choices'],function(_0x1c2174){return{'name':_[_0xc153('0x6b')](_0x1c2174),'value':_0x1c2174};}):[]};})};}})[_0xc153('0x27')](respondWithResult(_0x25c87f,null))[_0xc153('0x44')](function(_0x459eeb){var _0xeaaba3=_0x5270a0[_0xc153('0x31')][_0xc153('0x6c')]?0x1f4:_0x459eeb[_0xc153('0x6d')]||0x1f4;logger['error'](_0xc153('0x6e'),'getFields',_0xeaaba3,JSON[_0xc153('0x6f')](_0x459eeb));delete _0x459eeb[_0xc153('0x29')];if(_0xeaaba3===0x191){_0xeaaba3=0x190;}_0x25c87f[_0xc153('0x1b')](_0xeaaba3)[_0xc153('0x2a')](_0x5270a0[_0xc153('0x31')][_0xc153('0x6c')]?{'message':_0xc153('0x70'),'statusCode':_0x459eeb['statusCode']}:_0x459eeb);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index adc04a4..a11221a 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 _0xed61=['define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x2f00a0,_0xa93d21){var _0x7ada08=function(_0x2aa78d){while(--_0x2aa78d){_0x2f00a0['push'](_0x2f00a0['shift']());}};_0x7ada08(++_0xa93d21);}(_0xed61,0x1b4));var _0x1ed6=function(_0x2288e9,_0x15e163){_0x2288e9=_0x2288e9-0x0;var _0x24bec9=_0xed61[_0x2288e9];return _0x24bec9;};'use strict';var _=require(_0x1ed6('0x0'));var util=require(_0x1ed6('0x1'));var logger=require(_0x1ed6('0x2'))(_0x1ed6('0x3'));var moment=require(_0x1ed6('0x4'));var BPromise=require(_0x1ed6('0x5'));var rp=require(_0x1ed6('0x6'));var fs=require('fs');var path=require(_0x1ed6('0x7'));var rimraf=require(_0x1ed6('0x8'));var config=require(_0x1ed6('0x9'));var attributes=require(_0x1ed6('0xa'));var integrations=require(_0x1ed6('0xb'));module['exports']=function(_0x7262c8,_0x120c94){return _0x7262c8[_0x1ed6('0xc')]('FreshdeskAccount',attributes,{'tableName':_0x1ed6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7966=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','exports'];(function(_0x254936,_0x1d1a75){var _0xd81b6e=function(_0x27a8d8){while(--_0x27a8d8){_0x254936['push'](_0x254936['shift']());}};_0xd81b6e(++_0x1d1a75);}(_0x7966,0x9b));var _0x6796=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7966[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6796('0x0'));var util=require(_0x6796('0x1'));var logger=require(_0x6796('0x2'))(_0x6796('0x3'));var moment=require(_0x6796('0x4'));var BPromise=require(_0x6796('0x5'));var rp=require(_0x6796('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6796('0x7'));var config=require('../../config/environment');var attributes=require(_0x6796('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x6796('0x9')]=function(_0x590564,_0x2e2809){return _0x590564['define']('FreshdeskAccount',attributes,{'tableName':_0x6796('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index b10125e..82fb50c 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 _0x9da2=['attributes','include','map','model','then','ShowFreshdeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options'];(function(_0x133f36,_0x5047f5){var _0x1120b1=function(_0x37fe64){while(--_0x37fe64){_0x133f36['push'](_0x133f36['shift']());}};_0x1120b1(++_0x5047f5);}(_0x9da2,0xcd));var _0x29da=function(_0x511112,_0x1fd993){_0x511112=_0x511112-0x0;var _0x6e913b=_0x9da2[_0x511112];return _0x6e913b;};'use strict';var _=require(_0x29da('0x0'));var util=require(_0x29da('0x1'));var moment=require(_0x29da('0x2'));var BPromise=require(_0x29da('0x3'));var rs=require(_0x29da('0x4'));var fs=require('fs');var Redis=require(_0x29da('0x5'));var db=require(_0x29da('0x6'))['db'];var utils=require(_0x29da('0x7'));var logger=require(_0x29da('0x8'))(_0x29da('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x29da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9a4c,_0x4513d0,_0xe67767){return new BPromise(function(_0x47a19e,_0x50e8de){return client[_0x29da('0xb')](_0x2b9a4c,_0xe67767)['then'](function(_0x44ac20){logger[_0x29da('0xc')](_0x29da('0xd'),_0x4513d0,_0x29da('0xe'));logger[_0x29da('0xf')](_0x29da('0x10'),_0x4513d0,'request\x20sent',JSON[_0x29da('0x11')](_0x44ac20));if(_0x44ac20['error']){if(_0x44ac20[_0x29da('0x12')][_0x29da('0x13')]===0x1f4){logger[_0x29da('0x12')](_0x29da('0xd'),_0x4513d0,_0x44ac20[_0x29da('0x12')]['message']);return _0x50e8de(_0x44ac20[_0x29da('0x12')][_0x29da('0x14')]);}logger[_0x29da('0x12')](_0x29da('0xd'),_0x4513d0,_0x44ac20[_0x29da('0x12')][_0x29da('0x14')]);return _0x47a19e(_0x44ac20[_0x29da('0x12')]['message']);}else{logger[_0x29da('0xc')](_0x29da('0xd'),_0x4513d0,_0x29da('0xe'));_0x47a19e(_0x44ac20[_0x29da('0x15')][_0x29da('0x14')]);}})[_0x29da('0x16')](function(_0x581eb6){logger[_0x29da('0x12')](_0x29da('0xd'),_0x4513d0,_0x581eb6);_0x50e8de(_0x581eb6);});});}exports[_0x29da('0x17')]=function(_0x2e98c2){var _0x572e96=this;return new Promise(function(_0x168f94,_0x577386){return db[_0x29da('0x18')]['findAll']({'raw':_0x2e98c2[_0x29da('0x19')]?_0x2e98c2[_0x29da('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2e98c2[_0x29da('0x19')]?_0x2e98c2[_0x29da('0x19')]['where']||null:null,'attributes':_0x2e98c2[_0x29da('0x19')]?_0x2e98c2['options'][_0x29da('0x1a')]||null:null,'limit':_0x2e98c2[_0x29da('0x19')]?_0x2e98c2[_0x29da('0x19')]['limit']||null:null,'include':_0x2e98c2[_0x29da('0x19')]?_0x2e98c2['options'][_0x29da('0x1b')]?_[_0x29da('0x1c')](_0x2e98c2[_0x29da('0x19')][_0x29da('0x1b')],function(_0x14d1df){return{'model':db[_0x14d1df[_0x29da('0x1d')]],'as':_0x14d1df['as'],'attributes':_0x14d1df['attributes'],'include':_0x14d1df['include']?_[_0x29da('0x1c')](_0x14d1df[_0x29da('0x1b')],function(_0x58c19d){return{'model':db[_0x58c19d[_0x29da('0x1d')]],'as':_0x58c19d['as'],'attributes':_0x58c19d[_0x29da('0x1a')],'include':_0x58c19d[_0x29da('0x1b')]?_['map'](_0x58c19d[_0x29da('0x1b')],function(_0x4a59b4){return{'model':db[_0x4a59b4[_0x29da('0x1d')]],'as':_0x4a59b4['as'],'attributes':_0x4a59b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x29da('0x1e')](function(_0xf23a4c){logger['info'](_0x29da('0x17'),_0x2e98c2);logger[_0x29da('0xf')]('GetFreshdeskAccount',_0x2e98c2,JSON['stringify'](_0xf23a4c));_0x168f94(_0xf23a4c);})[_0x29da('0x16')](function(_0x3d3ece){logger[_0x29da('0x12')](_0x29da('0x17'),_0x3d3ece[_0x29da('0x14')],_0x2e98c2);_0x577386(_0x572e96[_0x29da('0x12')](0x1f4,_0x3d3ece[_0x29da('0x14')]));});});};exports[_0x29da('0x1f')]=function(_0x142bf8){var _0x595a91=this;return new Promise(function(_0x28d005,_0x7916ed){return db['FreshdeskAccount']['find']({'raw':_0x142bf8[_0x29da('0x19')]?_0x142bf8[_0x29da('0x19')][_0x29da('0x20')]===undefined?!![]:![]:!![],'where':_0x142bf8[_0x29da('0x19')]?_0x142bf8['options']['where']||null:null,'attributes':_0x142bf8[_0x29da('0x19')]?_0x142bf8[_0x29da('0x19')][_0x29da('0x1a')]||null:null,'include':_0x142bf8['options']?_0x142bf8[_0x29da('0x19')]['include']?_['map'](_0x142bf8[_0x29da('0x19')][_0x29da('0x1b')],function(_0x385803){return{'model':db[_0x385803['model']],'as':_0x385803['as'],'attributes':_0x385803['attributes'],'include':_0x385803['include']?_[_0x29da('0x1c')](_0x385803[_0x29da('0x1b')],function(_0x20c9de){return{'model':db[_0x20c9de[_0x29da('0x1d')]],'as':_0x20c9de['as'],'attributes':_0x20c9de[_0x29da('0x1a')],'include':_0x20c9de[_0x29da('0x1b')]?_[_0x29da('0x1c')](_0x20c9de['include'],function(_0x204c70){return{'model':db[_0x204c70[_0x29da('0x1d')]],'as':_0x204c70['as'],'attributes':_0x204c70[_0x29da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x29da('0x1e')](function(_0x12a758){logger[_0x29da('0xc')](_0x29da('0x1f'),_0x142bf8);logger[_0x29da('0xf')](_0x29da('0x1f'),_0x142bf8,JSON[_0x29da('0x11')](_0x12a758));_0x28d005(_0x12a758);})['catch'](function(_0x1ef0d2){logger[_0x29da('0x12')](_0x29da('0x1f'),_0x1ef0d2[_0x29da('0x14')],_0x142bf8);_0x7916ed(_0x595a91[_0x29da('0x12')](0x1f4,_0x1ef0d2[_0x29da('0x14')]));});});}; \ No newline at end of file +var _0xd4de=['request\x20sent','debug','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','include','map','model','attributes','ShowFreshdeskAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x17e3cf,_0x1103e1){var _0xfecb59=function(_0x4bdda8){while(--_0x4bdda8){_0x17e3cf['push'](_0x17e3cf['shift']());}};_0xfecb59(++_0x1103e1);}(_0xd4de,0x1ac));var _0xed4d=function(_0xd85435,_0x4b5280){_0xd85435=_0xd85435-0x0;var _0x12c20a=_0xd4de[_0xd85435];return _0x12c20a;};'use strict';var _=require(_0xed4d('0x0'));var util=require(_0xed4d('0x1'));var moment=require(_0xed4d('0x2'));var BPromise=require(_0xed4d('0x3'));var rs=require(_0xed4d('0x4'));var fs=require('fs');var Redis=require(_0xed4d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed4d('0x6'));var logger=require(_0xed4d('0x7'))(_0xed4d('0x8'));var config=require(_0xed4d('0x9'));var jayson=require(_0xed4d('0xa'));var client=jayson[_0xed4d('0xb')][_0xed4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1362cc,_0x3b9e70,_0x36ec65){return new BPromise(function(_0xa852ce,_0x2ab2f7){return client[_0xed4d('0xd')](_0x1362cc,_0x36ec65)[_0xed4d('0xe')](function(_0x162f54){logger[_0xed4d('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0xed4d('0x10'));logger[_0xed4d('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3b9e70,_0xed4d('0x10'),JSON[_0xed4d('0x12')](_0x162f54));if(_0x162f54[_0xed4d('0x13')]){if(_0x162f54[_0xed4d('0x13')][_0xed4d('0x14')]===0x1f4){logger[_0xed4d('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0x162f54[_0xed4d('0x13')][_0xed4d('0x15')]);return _0x2ab2f7(_0x162f54[_0xed4d('0x13')][_0xed4d('0x15')]);}logger[_0xed4d('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0x162f54['error'][_0xed4d('0x15')]);return _0xa852ce(_0x162f54[_0xed4d('0x13')][_0xed4d('0x15')]);}else{logger[_0xed4d('0xf')](_0xed4d('0x16'),_0x3b9e70,_0xed4d('0x10'));_0xa852ce(_0x162f54[_0xed4d('0x17')]['message']);}})[_0xed4d('0x18')](function(_0x2bd685){logger[_0xed4d('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b9e70,_0x2bd685);_0x2ab2f7(_0x2bd685);});});}exports[_0xed4d('0x19')]=function(_0x4d1a69){var _0x3fe721=this;return new Promise(function(_0x483799,_0x1f5751){return db[_0xed4d('0x1a')][_0xed4d('0x1b')]({'raw':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['where']||null:null,'attributes':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['attributes']||null:null,'limit':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69[_0xed4d('0x1c')]['limit']||null:null,'include':_0x4d1a69[_0xed4d('0x1c')]?_0x4d1a69['options'][_0xed4d('0x1d')]?_[_0xed4d('0x1e')](_0x4d1a69[_0xed4d('0x1c')]['include'],function(_0x5d63f4){return{'model':db[_0x5d63f4[_0xed4d('0x1f')]],'as':_0x5d63f4['as'],'attributes':_0x5d63f4['attributes'],'include':_0x5d63f4[_0xed4d('0x1d')]?_['map'](_0x5d63f4['include'],function(_0x2a6dde){return{'model':db[_0x2a6dde[_0xed4d('0x1f')]],'as':_0x2a6dde['as'],'attributes':_0x2a6dde['attributes'],'include':_0x2a6dde['include']?_['map'](_0x2a6dde[_0xed4d('0x1d')],function(_0x94c929){return{'model':db[_0x94c929[_0xed4d('0x1f')]],'as':_0x94c929['as'],'attributes':_0x94c929[_0xed4d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xed4d('0xe')](function(_0x59f167){logger[_0xed4d('0xf')](_0xed4d('0x19'),_0x4d1a69);logger[_0xed4d('0x11')](_0xed4d('0x19'),_0x4d1a69,JSON[_0xed4d('0x12')](_0x59f167));_0x483799(_0x59f167);})['catch'](function(_0xaef631){logger[_0xed4d('0x13')]('GetFreshdeskAccount',_0xaef631[_0xed4d('0x15')],_0x4d1a69);_0x1f5751(_0x3fe721[_0xed4d('0x13')](0x1f4,_0xaef631[_0xed4d('0x15')]));});});};exports[_0xed4d('0x21')]=function(_0x576982){var _0x5764c5=this;return new Promise(function(_0x5e4e50,_0x4da1b8){return db[_0xed4d('0x1a')][_0xed4d('0x22')]({'raw':_0x576982[_0xed4d('0x1c')]?_0x576982['options'][_0xed4d('0x23')]===undefined?!![]:![]:!![],'where':_0x576982['options']?_0x576982['options'][_0xed4d('0x24')]||null:null,'attributes':_0x576982[_0xed4d('0x1c')]?_0x576982['options'][_0xed4d('0x20')]||null:null,'include':_0x576982[_0xed4d('0x1c')]?_0x576982[_0xed4d('0x1c')]['include']?_[_0xed4d('0x1e')](_0x576982[_0xed4d('0x1c')][_0xed4d('0x1d')],function(_0x206837){return{'model':db[_0x206837[_0xed4d('0x1f')]],'as':_0x206837['as'],'attributes':_0x206837[_0xed4d('0x20')],'include':_0x206837[_0xed4d('0x1d')]?_[_0xed4d('0x1e')](_0x206837['include'],function(_0x28b6ff){return{'model':db[_0x28b6ff[_0xed4d('0x1f')]],'as':_0x28b6ff['as'],'attributes':_0x28b6ff['attributes'],'include':_0x28b6ff[_0xed4d('0x1d')]?_[_0xed4d('0x1e')](_0x28b6ff['include'],function(_0x2d6289){return{'model':db[_0x2d6289[_0xed4d('0x1f')]],'as':_0x2d6289['as'],'attributes':_0x2d6289['attributes']};}):[]};}):[]};}):[]:[]})[_0xed4d('0xe')](function(_0x531e9b){logger[_0xed4d('0xf')](_0xed4d('0x21'),_0x576982);logger[_0xed4d('0x11')](_0xed4d('0x21'),_0x576982,JSON[_0xed4d('0x12')](_0x531e9b));_0x5e4e50(_0x531e9b);})['catch'](function(_0x25f553){logger[_0xed4d('0x13')]('ShowFreshdeskAccount',_0x25f553['message'],_0x576982);_0x4da1b8(_0x5764c5[_0xed4d('0x13')](0x1f4,_0x25f553[_0xed4d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 21dc9c5..394489a 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 _0x003f=['index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x328e0d,_0x15193b){var _0x5536a8=function(_0x1add65){while(--_0x1add65){_0x328e0d['push'](_0x328e0d['shift']());}};_0x5536a8(++_0x15193b);}(_0x003f,0xf0));var _0xf003=function(_0x30755c,_0x1a347f){_0x30755c=_0x30755c-0x0;var _0x2710f0=_0x003f[_0x30755c];return _0x2710f0;};'use strict';var multer=require(_0xf003('0x0'));var util=require(_0xf003('0x1'));var path=require('path');var timeout=require(_0xf003('0x2'));var express=require('express');var router=express[_0xf003('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf003('0x4'));var interaction=require(_0xf003('0x5'));var config=require(_0xf003('0x6'));var controller=require(_0xf003('0x7'));router[_0xf003('0x8')]('/',auth[_0xf003('0x9')](),controller[_0xf003('0xa')]);router[_0xf003('0x8')](_0xf003('0xb'),auth[_0xf003('0x9')](),controller[_0xf003('0xc')]);router[_0xf003('0x8')]('/:id/fields',auth[_0xf003('0x9')](),controller['getFields']);router[_0xf003('0x8')](_0xf003('0xd'),auth[_0xf003('0x9')](),controller['getSubjects']);router['get'](_0xf003('0xe'),auth['isAuthenticated'](),controller[_0xf003('0xf')]);router[_0xf003('0x8')](_0xf003('0x10'),auth['isAuthenticated'](),controller[_0xf003('0x11')]);router[_0xf003('0x12')]('/',auth[_0xf003('0x9')](),controller[_0xf003('0x13')]);router[_0xf003('0x12')](_0xf003('0x10'),auth[_0xf003('0x9')](),controller['setTags']);router[_0xf003('0x14')](_0xf003('0xb'),auth[_0xf003('0x9')](),controller[_0xf003('0x15')]);router[_0xf003('0x16')](_0xf003('0xb'),auth[_0xf003('0x9')](),controller[_0xf003('0x17')]);module[_0xf003('0x18')]=router; \ No newline at end of file +var _0x5286=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x13883a,_0x59edcf){var _0x2ddd44=function(_0x5561d5){while(--_0x5561d5){_0x13883a['push'](_0x13883a['shift']());}};_0x2ddd44(++_0x59edcf);}(_0x5286,0x172));var _0x6528=function(_0x49a354,_0x5297d4){_0x49a354=_0x49a354-0x0;var _0x4cdf0b=_0x5286[_0x49a354];return _0x4cdf0b;};'use strict';var multer=require(_0x6528('0x0'));var util=require(_0x6528('0x1'));var path=require(_0x6528('0x2'));var timeout=require(_0x6528('0x3'));var express=require(_0x6528('0x4'));var router=express[_0x6528('0x5')]();var fs_extra=require(_0x6528('0x6'));var auth=require(_0x6528('0x7'));var interaction=require(_0x6528('0x8'));var config=require(_0x6528('0x9'));var controller=require(_0x6528('0xa'));router['get']('/',auth[_0x6528('0xb')](),controller[_0x6528('0xc')]);router[_0x6528('0xd')](_0x6528('0xe'),auth[_0x6528('0xb')](),controller[_0x6528('0xf')]);router[_0x6528('0xd')]('/:id/fields',auth[_0x6528('0xb')](),controller[_0x6528('0x10')]);router[_0x6528('0xd')](_0x6528('0x11'),auth[_0x6528('0xb')](),controller[_0x6528('0x12')]);router[_0x6528('0xd')]('/:id/descriptions',auth[_0x6528('0xb')](),controller[_0x6528('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x6528('0x14')]);router[_0x6528('0x15')]('/',auth[_0x6528('0xb')](),controller[_0x6528('0x16')]);router['post'](_0x6528('0x17'),auth[_0x6528('0xb')](),controller[_0x6528('0x18')]);router[_0x6528('0x19')](_0x6528('0xe'),auth[_0x6528('0xb')](),controller[_0x6528('0x1a')]);router[_0x6528('0x1b')]('/:id',auth[_0x6528('0xb')](),controller['destroy']);module[_0x6528('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9019f62..12960de 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 _0xc1c4=['STRING','sequelize','exports'];(function(_0x101d88,_0xad2c85){var _0x3d6cea=function(_0x3df323){while(--_0x3df323){_0x101d88['push'](_0x101d88['shift']());}};_0x3d6cea(++_0xad2c85);}(_0xc1c4,0xd0));var _0x4c1c=function(_0x1c9298,_0x204649){_0x1c9298=_0x1c9298-0x0;var _0x463279=_0xc1c4[_0x1c9298];return _0x463279;};'use strict';var Sequelize=require(_0x4c1c('0x0'));module[_0x4c1c('0x1')]={'name':{'type':Sequelize[_0x4c1c('0x2')]},'description':{'type':Sequelize[_0x4c1c('0x2')]}}; \ No newline at end of file +var _0x51d5=['STRING','exports'];(function(_0xc2dde6,_0x1cccc9){var _0x9fc29c=function(_0x54ba28){while(--_0x54ba28){_0xc2dde6['push'](_0xc2dde6['shift']());}};_0x9fc29c(++_0x1cccc9);}(_0x51d5,0xa9));var _0x551d=function(_0x1e72ba,_0x327a82){_0x1e72ba=_0x1e72ba-0x0;var _0x58f79=_0x51d5[_0x1e72ba];return _0x58f79;};'use strict';var Sequelize=require('sequelize');module[_0x551d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x551d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d150606..e1ebac7 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 _0xb482=['key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','params','keys','includeAll','include','options','find','catch','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type'];(function(_0x16b6c7,_0x45c6b4){var _0x531e4b=function(_0x49e602){while(--_0x49e602){_0x16b6c7['push'](_0x16b6c7['shift']());}};_0x531e4b(++_0x45c6b4);}(_0xb482,0x12a));var _0x2b48=function(_0x30b13c,_0x5ae3d3){_0x30b13c=_0x30b13c-0x0;var _0x493a46=_0xb482[_0x30b13c];return _0x493a46;};'use strict';var emlformat=require(_0x2b48('0x0'));var rimraf=require(_0x2b48('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2b48('0x2'));var moment=require(_0x2b48('0x3'));var BPromise=require(_0x2b48('0x4'));var Mustache=require(_0x2b48('0x5'));var util=require(_0x2b48('0x6'));var path=require(_0x2b48('0x7'));var sox=require(_0x2b48('0x8'));var csv=require(_0x2b48('0x9'));var ejs=require(_0x2b48('0xa'));var fs=require('fs');var fs_extra=require(_0x2b48('0xb'));var _=require(_0x2b48('0xc'));var squel=require(_0x2b48('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b48('0xe'));var deskjs=require(_0x2b48('0xf'));var toCsv=require(_0x2b48('0x9'));var querystring=require(_0x2b48('0x10'));var Papa=require(_0x2b48('0x11'));var Redis=require('ioredis');var authService=require(_0x2b48('0x12'));var qs=require(_0x2b48('0x13'));var as=require(_0x2b48('0x14'));var hardwareService=require(_0x2b48('0x15'));var logger=require(_0x2b48('0x16'))(_0x2b48('0x17'));var utils=require(_0x2b48('0x18'));var config=require(_0x2b48('0x19'));var licenseUtil=require(_0x2b48('0x1a'));var db=require(_0x2b48('0x1b'))['db'];function respondWithStatusCode(_0xa2e6ba,_0x507900){_0x507900=_0x507900||0xcc;return function(_0x501ecf){if(_0x501ecf){return _0xa2e6ba[_0x2b48('0x1c')](_0x507900);}return _0xa2e6ba[_0x2b48('0x1d')](_0x507900)[_0x2b48('0x1e')]();};}function respondWithResult(_0x335487,_0x9650f5){_0x9650f5=_0x9650f5||0xc8;return function(_0x4267b2){if(_0x4267b2){return _0x335487[_0x2b48('0x1d')](_0x9650f5)[_0x2b48('0x1f')](_0x4267b2);}};}function respondWithFilteredResult(_0x1e8e56,_0xfa801c){return function(_0x3dece9){if(_0x3dece9){var _0x2f0ff8=typeof _0xfa801c[_0x2b48('0x20')]===_0x2b48('0x21')&&typeof _0xfa801c[_0x2b48('0x22')]===_0x2b48('0x21');var _0xea7753=_0x3dece9['count'];var _0x5e1408=_0x2f0ff8?0x0:_0xfa801c[_0x2b48('0x20')];var _0x228e98=_0x2f0ff8?_0x3dece9[_0x2b48('0x23')]:_0xfa801c[_0x2b48('0x20')]+_0xfa801c[_0x2b48('0x22')];var _0x246d8e;if(_0x228e98>=_0xea7753){_0x228e98=_0xea7753;_0x246d8e=0xc8;}else{_0x246d8e=0xce;}_0x1e8e56[_0x2b48('0x1d')](_0x246d8e);return _0x1e8e56['set'](_0x2b48('0x24'),_0x5e1408+'-'+_0x228e98+'/'+_0xea7753)[_0x2b48('0x1f')](_0x3dece9);}return null;};}function patchUpdates(_0x1a2b80){return function(_0x2f90de){try{jsonpatch['apply'](_0x2f90de,_0x1a2b80,!![]);}catch(_0x21d4af){return BPromise['reject'](_0x21d4af);}return _0x2f90de[_0x2b48('0x25')]();};}function saveUpdates(_0x522e71,_0x9af3c0){return function(_0x480217){if(_0x480217){return _0x480217[_0x2b48('0x26')](_0x522e71)[_0x2b48('0x27')](function(_0x3ae273){return _0x3ae273;});}return null;};}function removeEntity(_0x443b67,_0x5a03d4){return function(_0x39d197){if(_0x39d197){return _0x39d197['destroy']()[_0x2b48('0x27')](function(){_0x443b67[_0x2b48('0x1d')](0xcc)[_0x2b48('0x1e')]();});}};}function handleEntityNotFound(_0xab6f85,_0x183451){return function(_0x46ab4f){if(!_0x46ab4f){_0xab6f85[_0x2b48('0x1c')](0x194);}return _0x46ab4f;};}function handleError(_0xae7fde,_0x96ac18){_0x96ac18=_0x96ac18||0x1f4;return function(_0x366769){logger[_0x2b48('0x28')](_0x366769[_0x2b48('0x29')]);if(_0x366769[_0x2b48('0x2a')]){delete _0x366769['name'];}_0xae7fde[_0x2b48('0x1d')](_0x96ac18)[_0x2b48('0x2b')](_0x366769);};}exports[_0x2b48('0x2c')]=function(_0x160256,_0x5e3bed){var _0x524640={},_0x3736d4={},_0x3659cd={'count':0x0,'rows':[]};var _0x41d0fd=_[_0x2b48('0x2d')](db[_0x2b48('0x2e')][_0x2b48('0x2f')],function(_0x4643c2){return{'name':_0x4643c2[_0x2b48('0x30')],'type':_0x4643c2[_0x2b48('0x31')][_0x2b48('0x32')]};});_0x3736d4['model']=_[_0x2b48('0x2d')](_0x41d0fd,_0x2b48('0x2a'));_0x3736d4['query']=_['keys'](_0x160256[_0x2b48('0x33')]);_0x3736d4[_0x2b48('0x34')]=_['intersection'](_0x3736d4['model'],_0x3736d4[_0x2b48('0x33')]);_0x524640[_0x2b48('0x35')]=_[_0x2b48('0x36')](_0x3736d4[_0x2b48('0x37')],qs[_0x2b48('0x38')](_0x160256[_0x2b48('0x33')]['fields']));_0x524640['attributes']=_0x524640[_0x2b48('0x35')][_0x2b48('0x39')]?_0x524640[_0x2b48('0x35')]:_0x3736d4['model'];if(!_0x160256[_0x2b48('0x33')][_0x2b48('0x3a')]('nolimit')){_0x524640[_0x2b48('0x22')]=qs[_0x2b48('0x22')](_0x160256[_0x2b48('0x33')][_0x2b48('0x22')]);_0x524640[_0x2b48('0x20')]=qs[_0x2b48('0x20')](_0x160256[_0x2b48('0x33')][_0x2b48('0x20')]);}_0x524640[_0x2b48('0x3b')]=qs[_0x2b48('0x3c')](_0x160256[_0x2b48('0x33')][_0x2b48('0x3c')]);_0x524640[_0x2b48('0x3d')]=qs[_0x2b48('0x34')](_[_0x2b48('0x3e')](_0x160256[_0x2b48('0x33')],_0x3736d4[_0x2b48('0x34')]),_0x41d0fd);if(_0x160256[_0x2b48('0x33')][_0x2b48('0x3f')]){_0x524640[_0x2b48('0x3d')]=_['merge'](_0x524640[_0x2b48('0x3d')],{'$or':_[_0x2b48('0x2d')](_0x41d0fd,function(_0x52c35d){if(_0x52c35d[_0x2b48('0x31')]!==_0x2b48('0x40')){var _0x27a099={};_0x27a099[_0x52c35d[_0x2b48('0x2a')]]={'$like':'%'+_0x160256['query'][_0x2b48('0x3f')]+'%'};return _0x27a099;}})});}_0x524640=_[_0x2b48('0x41')]({},_0x524640,_0x160256['options']);var _0x371af1={'where':_0x524640['where']};return db['FreshdeskConfiguration'][_0x2b48('0x23')](_0x371af1)['then'](function(_0x5a7a7c){_0x3659cd['count']=_0x5a7a7c;if(_0x160256['query']['includeAll']){_0x524640['include']=[{'all':!![]}];}return db[_0x2b48('0x2e')][_0x2b48('0x42')](_0x524640);})[_0x2b48('0x27')](function(_0x43dd47){_0x3659cd[_0x2b48('0x43')]=_0x43dd47;return _0x3659cd;})[_0x2b48('0x27')](respondWithFilteredResult(_0x5e3bed,_0x524640))['catch'](handleError(_0x5e3bed,null));};exports['show']=function(_0x530c47,_0x143338){var _0x5d608f={'raw':![],'where':{'id':_0x530c47[_0x2b48('0x44')]['id']}},_0x2d1b2f={};_0x2d1b2f[_0x2b48('0x37')]=_['keys'](db[_0x2b48('0x2e')][_0x2b48('0x2f')]);_0x2d1b2f[_0x2b48('0x33')]=_[_0x2b48('0x45')](_0x530c47[_0x2b48('0x33')]);_0x2d1b2f[_0x2b48('0x34')]=_[_0x2b48('0x36')](_0x2d1b2f[_0x2b48('0x37')],_0x2d1b2f[_0x2b48('0x33')]);_0x5d608f[_0x2b48('0x35')]=_[_0x2b48('0x36')](_0x2d1b2f[_0x2b48('0x37')],qs[_0x2b48('0x38')](_0x530c47[_0x2b48('0x33')][_0x2b48('0x38')]));_0x5d608f[_0x2b48('0x35')]=_0x5d608f[_0x2b48('0x35')][_0x2b48('0x39')]?_0x5d608f[_0x2b48('0x35')]:_0x2d1b2f[_0x2b48('0x37')];if(_0x530c47[_0x2b48('0x33')][_0x2b48('0x46')]){_0x5d608f[_0x2b48('0x47')]=[{'all':!![]}];}_0x5d608f=_[_0x2b48('0x41')]({},_0x5d608f,_0x530c47[_0x2b48('0x48')]);return db['FreshdeskConfiguration'][_0x2b48('0x49')](_0x5d608f)[_0x2b48('0x27')](handleEntityNotFound(_0x143338,null))[_0x2b48('0x27')](respondWithResult(_0x143338,null))[_0x2b48('0x4a')](handleError(_0x143338,null));};exports[_0x2b48('0x4b')]=function(_0x487112,_0x19fc1b){return db['FreshdeskConfiguration'][_0x2b48('0x4b')](_0x487112[_0x2b48('0x4c')],{})[_0x2b48('0x27')](respondWithResult(_0x19fc1b,0xc9))['catch'](handleError(_0x19fc1b,null));};exports[_0x2b48('0x26')]=function(_0x32c9cc,_0x6086fc){if(_0x32c9cc[_0x2b48('0x4c')]['id']){delete _0x32c9cc[_0x2b48('0x4c')]['id'];}return db[_0x2b48('0x2e')][_0x2b48('0x49')]({'where':{'id':_0x32c9cc[_0x2b48('0x44')]['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0x6086fc,null))[_0x2b48('0x27')](saveUpdates(_0x32c9cc[_0x2b48('0x4c')],null))[_0x2b48('0x27')](respondWithResult(_0x6086fc,null))['catch'](handleError(_0x6086fc,null));};exports['destroy']=function(_0x5647cc,_0x4271af){return db[_0x2b48('0x2e')][_0x2b48('0x49')]({'where':{'id':_0x5647cc[_0x2b48('0x44')]['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0x4271af,null))['then'](removeEntity(_0x4271af,null))['catch'](handleError(_0x4271af,null));};exports[_0x2b48('0x4d')]=function(_0x21421e,_0x42ce4e,_0x20edda){var _0x48686d={};var _0x495a98={};var _0x52bd4c;var _0x436c95;return db[_0x2b48('0x2e')][_0x2b48('0x4e')]({'where':{'id':_0x21421e[_0x2b48('0x44')]['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0x42ce4e,null))['then'](function(_0xf68358){if(_0xf68358){_0x52bd4c=_0xf68358;_0x495a98[_0x2b48('0x37')]=_[_0x2b48('0x45')](db[_0x2b48('0x4f')][_0x2b48('0x2f')]);_0x495a98['query']=_[_0x2b48('0x45')](_0x21421e['query']);_0x495a98[_0x2b48('0x34')]=_[_0x2b48('0x36')](_0x495a98['model'],_0x495a98['query']);_0x48686d[_0x2b48('0x35')]=_[_0x2b48('0x36')](_0x495a98[_0x2b48('0x37')],qs['fields'](_0x21421e[_0x2b48('0x33')][_0x2b48('0x38')]));_0x48686d[_0x2b48('0x35')]=_0x48686d[_0x2b48('0x35')]['length']?_0x48686d[_0x2b48('0x35')]:_0x495a98[_0x2b48('0x37')];_0x48686d['order']=qs[_0x2b48('0x3c')](_0x21421e[_0x2b48('0x33')][_0x2b48('0x3c')]);_0x48686d['where']=qs[_0x2b48('0x34')](_['pick'](_0x21421e['query'],_0x495a98[_0x2b48('0x34')]));if(_0x21421e[_0x2b48('0x33')][_0x2b48('0x3f')]){_0x48686d[_0x2b48('0x3d')]=_[_0x2b48('0x41')](_0x48686d['where'],{'$or':_['map'](_0x48686d[_0x2b48('0x35')],function(_0x2956be){var _0xcc6b4={};_0xcc6b4[_0x2956be]={'$like':'%'+_0x21421e[_0x2b48('0x33')]['filter']+'%'};return _0xcc6b4;})});}_0x48686d=_[_0x2b48('0x41')]({},_0x48686d,_0x21421e[_0x2b48('0x48')]);return _0x52bd4c[_0x2b48('0x4d')](_0x48686d);}})[_0x2b48('0x27')](function(_0x399ddc){if(_0x399ddc){_0x436c95=_0x399ddc[_0x2b48('0x39')];if(!_0x21421e[_0x2b48('0x33')][_0x2b48('0x3a')](_0x2b48('0x50'))){_0x48686d[_0x2b48('0x22')]=qs['limit'](_0x21421e[_0x2b48('0x33')]['limit']);_0x48686d['offset']=qs['offset'](_0x21421e['query'][_0x2b48('0x20')]);}return _0x52bd4c[_0x2b48('0x4d')](_0x48686d);}})[_0x2b48('0x27')](function(_0x49a0cb){if(_0x49a0cb){return _0x49a0cb?{'count':_0x436c95,'rows':_0x49a0cb}:null;}})[_0x2b48('0x27')](respondWithResult(_0x42ce4e,null))[_0x2b48('0x4a')](handleError(_0x42ce4e,null));};exports[_0x2b48('0x51')]=function(_0x4ef91f,_0x3c8be6,_0xa679d9){var _0x4e6f64={};var _0x400ebd={};var _0xd25c08;var _0x5e0a39;return db[_0x2b48('0x2e')][_0x2b48('0x4e')]({'where':{'id':_0x4ef91f[_0x2b48('0x44')]['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0x3c8be6,null))[_0x2b48('0x27')](function(_0xad8eb6){if(_0xad8eb6){_0xd25c08=_0xad8eb6;_0x400ebd[_0x2b48('0x37')]=_['keys'](db[_0x2b48('0x4f')][_0x2b48('0x2f')]);_0x400ebd[_0x2b48('0x33')]=_[_0x2b48('0x45')](_0x4ef91f[_0x2b48('0x33')]);_0x400ebd[_0x2b48('0x34')]=_[_0x2b48('0x36')](_0x400ebd[_0x2b48('0x37')],_0x400ebd['query']);_0x4e6f64['attributes']=_['intersection'](_0x400ebd[_0x2b48('0x37')],qs[_0x2b48('0x38')](_0x4ef91f['query'][_0x2b48('0x38')]));_0x4e6f64[_0x2b48('0x35')]=_0x4e6f64[_0x2b48('0x35')][_0x2b48('0x39')]?_0x4e6f64[_0x2b48('0x35')]:_0x400ebd['model'];_0x4e6f64['order']=qs[_0x2b48('0x3c')](_0x4ef91f['query'][_0x2b48('0x3c')]);_0x4e6f64[_0x2b48('0x3d')]=qs[_0x2b48('0x34')](_[_0x2b48('0x3e')](_0x4ef91f[_0x2b48('0x33')],_0x400ebd[_0x2b48('0x34')]));if(_0x4ef91f['query']['filter']){_0x4e6f64[_0x2b48('0x3d')]=_[_0x2b48('0x41')](_0x4e6f64['where'],{'$or':_[_0x2b48('0x2d')](_0x4e6f64['attributes'],function(_0x443d14){var _0x45ec30={};_0x45ec30[_0x443d14]={'$like':'%'+_0x4ef91f['query'][_0x2b48('0x3f')]+'%'};return _0x45ec30;})});}_0x4e6f64=_[_0x2b48('0x41')]({},_0x4e6f64,_0x4ef91f['options']);return _0xd25c08[_0x2b48('0x51')](_0x4e6f64);}})[_0x2b48('0x27')](function(_0x4bd09c){if(_0x4bd09c){_0x5e0a39=_0x4bd09c['length'];if(!_0x4ef91f[_0x2b48('0x33')]['hasOwnProperty'](_0x2b48('0x50'))){_0x4e6f64[_0x2b48('0x22')]=qs[_0x2b48('0x22')](_0x4ef91f[_0x2b48('0x33')]['limit']);_0x4e6f64[_0x2b48('0x20')]=qs[_0x2b48('0x20')](_0x4ef91f[_0x2b48('0x33')][_0x2b48('0x20')]);}return _0xd25c08[_0x2b48('0x51')](_0x4e6f64);}})['then'](function(_0x2f7617){if(_0x2f7617){return _0x2f7617?{'count':_0x5e0a39,'rows':_0x2f7617}:null;}})[_0x2b48('0x27')](respondWithResult(_0x3c8be6,null))[_0x2b48('0x4a')](handleError(_0x3c8be6,null));};exports[_0x2b48('0x52')]=function(_0x486d8b,_0x15f9c0,_0xc2095a){var _0x233b27={};var _0x562640={};var _0x3077a3;var _0x31d1d3;return db[_0x2b48('0x2e')][_0x2b48('0x4e')]({'where':{'id':_0x486d8b[_0x2b48('0x44')]['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0x15f9c0,null))[_0x2b48('0x27')](function(_0x2c6db9){if(_0x2c6db9){_0x3077a3=_0x2c6db9;_0x562640[_0x2b48('0x37')]=_[_0x2b48('0x45')](db['FreshdeskField']['rawAttributes']);_0x562640[_0x2b48('0x33')]=_[_0x2b48('0x45')](_0x486d8b[_0x2b48('0x33')]);_0x562640[_0x2b48('0x34')]=_['intersection'](_0x562640['model'],_0x562640[_0x2b48('0x33')]);_0x233b27[_0x2b48('0x35')]=_['intersection'](_0x562640['model'],qs[_0x2b48('0x38')](_0x486d8b['query'][_0x2b48('0x38')]));_0x233b27[_0x2b48('0x35')]=_0x233b27[_0x2b48('0x35')]['length']?_0x233b27[_0x2b48('0x35')]:_0x562640[_0x2b48('0x37')];_0x233b27[_0x2b48('0x3b')]=qs[_0x2b48('0x3c')](_0x486d8b[_0x2b48('0x33')][_0x2b48('0x3c')]);_0x233b27[_0x2b48('0x3d')]=qs['filters'](_[_0x2b48('0x3e')](_0x486d8b[_0x2b48('0x33')],_0x562640['filters']));if(_0x486d8b[_0x2b48('0x33')][_0x2b48('0x3f')]){_0x233b27['where']=_[_0x2b48('0x41')](_0x233b27['where'],{'$or':_['map'](_0x233b27['attributes'],function(_0x1b33a3){var _0x2504f0={};_0x2504f0[_0x1b33a3]={'$like':'%'+_0x486d8b['query'][_0x2b48('0x3f')]+'%'};return _0x2504f0;})});}_0x233b27=_[_0x2b48('0x41')]({},_0x233b27,_0x486d8b['options']);return _0x3077a3[_0x2b48('0x52')](_0x233b27);}})[_0x2b48('0x27')](function(_0x2eaf32){if(_0x2eaf32){_0x31d1d3=_0x2eaf32[_0x2b48('0x39')];if(!_0x486d8b['query'][_0x2b48('0x3a')](_0x2b48('0x50'))){_0x233b27['limit']=qs[_0x2b48('0x22')](_0x486d8b[_0x2b48('0x33')][_0x2b48('0x22')]);_0x233b27[_0x2b48('0x20')]=qs[_0x2b48('0x20')](_0x486d8b['query'][_0x2b48('0x20')]);}return _0x3077a3[_0x2b48('0x52')](_0x233b27);}})['then'](function(_0x17ef7f){if(_0x17ef7f){return _0x17ef7f?{'count':_0x31d1d3,'rows':_0x17ef7f}:null;}})['then'](respondWithResult(_0x15f9c0,null))[_0x2b48('0x4a')](handleError(_0x15f9c0,null));};exports[_0x2b48('0x53')]=function(_0x12a85e,_0x4f350a,_0x2cb745){var _0x4afe88={};var _0x3ec26={};var _0x9e2c40;var _0x47157a;return db[_0x2b48('0x2e')][_0x2b48('0x4e')]({'where':{'id':_0x12a85e[_0x2b48('0x44')]['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0x4f350a,null))[_0x2b48('0x27')](function(_0x271d4b){if(_0x271d4b){_0x9e2c40=_0x271d4b;_0x3ec26[_0x2b48('0x37')]=_['keys'](db[_0x2b48('0x54')][_0x2b48('0x2f')]);_0x3ec26[_0x2b48('0x33')]=_[_0x2b48('0x45')](_0x12a85e[_0x2b48('0x33')]);_0x3ec26[_0x2b48('0x34')]=_[_0x2b48('0x36')](_0x3ec26[_0x2b48('0x37')],_0x3ec26['query']);_0x4afe88[_0x2b48('0x35')]=_[_0x2b48('0x36')](_0x3ec26['model'],qs['fields'](_0x12a85e[_0x2b48('0x33')][_0x2b48('0x38')]));_0x4afe88[_0x2b48('0x35')]=_0x4afe88[_0x2b48('0x35')][_0x2b48('0x39')]?_0x4afe88[_0x2b48('0x35')]:_0x3ec26[_0x2b48('0x37')];_0x4afe88['order']=qs[_0x2b48('0x3c')](_0x12a85e[_0x2b48('0x33')][_0x2b48('0x3c')]);_0x4afe88['where']=qs[_0x2b48('0x34')](_[_0x2b48('0x3e')](_0x12a85e[_0x2b48('0x33')],_0x3ec26[_0x2b48('0x34')]));if(_0x12a85e['query'][_0x2b48('0x3f')]){_0x4afe88[_0x2b48('0x3d')]=_['merge'](_0x4afe88['where'],{'$or':_['map'](_0x4afe88['attributes'],function(_0x2004ce){var _0x3f7b23={};_0x3f7b23[_0x2004ce]={'$like':'%'+_0x12a85e[_0x2b48('0x33')]['filter']+'%'};return _0x3f7b23;})});}_0x4afe88=_['merge']({},_0x4afe88,_0x12a85e['options']);return _0x9e2c40[_0x2b48('0x53')](_0x4afe88);}})['then'](function(_0x4b34ee){if(_0x4b34ee){_0x47157a=_0x4b34ee[_0x2b48('0x39')];if(!_0x12a85e[_0x2b48('0x33')][_0x2b48('0x3a')](_0x2b48('0x50'))){_0x4afe88[_0x2b48('0x22')]=qs[_0x2b48('0x22')](_0x12a85e[_0x2b48('0x33')][_0x2b48('0x22')]);_0x4afe88[_0x2b48('0x20')]=qs['offset'](_0x12a85e[_0x2b48('0x33')]['offset']);}return _0x9e2c40[_0x2b48('0x53')](_0x4afe88);}})[_0x2b48('0x27')](function(_0x59d171){if(_0x59d171){return _0x59d171?{'count':_0x47157a,'rows':_0x59d171}:null;}})[_0x2b48('0x27')](respondWithResult(_0x4f350a,null))[_0x2b48('0x4a')](handleError(_0x4f350a,null));};exports[_0x2b48('0x55')]=function(_0x23faf4,_0xc1d5ed,_0x160ec5){if(_0x23faf4['body']['id']){delete _0x23faf4[_0x2b48('0x4c')]['id'];}return db[_0x2b48('0x2e')][_0x2b48('0x4e')]({'where':{'id':_0x23faf4['params']['id']}})[_0x2b48('0x27')](handleEntityNotFound(_0xc1d5ed,null))[_0x2b48('0x27')](function(_0x302994){if(_0x302994){return _0x302994[_0x2b48('0x55')](_0x23faf4[_0x2b48('0x4c')][_0x2b48('0x56')]||[]);}return null;})[_0x2b48('0x27')](respondWithResult(_0xc1d5ed,null))[_0x2b48('0x4a')](handleError(_0xc1d5ed,null));}; \ No newline at end of file +var _0x55eb=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','getSubjects','getDescriptions','FreshdeskField','getTags','Tag','setTags','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x55eb,0xec));var _0xb55e=function(_0x55938a,_0x311fa0){_0x55938a=_0x55938a-0x0;var _0x348fb9=_0x55eb[_0x55938a];return _0x348fb9;};'use strict';var emlformat=require(_0xb55e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb55e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb55e('0x2'));var moment=require(_0xb55e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb55e('0x4'));var path=require(_0xb55e('0x5'));var sox=require(_0xb55e('0x6'));var csv=require('to-csv');var ejs=require(_0xb55e('0x7'));var fs=require('fs');var fs_extra=require(_0xb55e('0x8'));var _=require(_0xb55e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb55e('0xa'));var deskjs=require(_0xb55e('0xb'));var toCsv=require(_0xb55e('0xc'));var querystring=require(_0xb55e('0xd'));var Papa=require(_0xb55e('0xe'));var Redis=require('ioredis');var authService=require(_0xb55e('0xf'));var qs=require(_0xb55e('0x10'));var as=require(_0xb55e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb55e('0x12'))(_0xb55e('0x13'));var utils=require(_0xb55e('0x14'));var config=require(_0xb55e('0x15'));var licenseUtil=require(_0xb55e('0x16'));var db=require(_0xb55e('0x17'))['db'];function respondWithStatusCode(_0x4af3e0,_0x3f2d9a){_0x3f2d9a=_0x3f2d9a||0xcc;return function(_0x59a783){if(_0x59a783){return _0x4af3e0[_0xb55e('0x18')](_0x3f2d9a);}return _0x4af3e0[_0xb55e('0x19')](_0x3f2d9a)[_0xb55e('0x1a')]();};}function respondWithResult(_0x4a6a49,_0x18ab27){_0x18ab27=_0x18ab27||0xc8;return function(_0x58c2bd){if(_0x58c2bd){return _0x4a6a49['status'](_0x18ab27)[_0xb55e('0x1b')](_0x58c2bd);}};}function respondWithFilteredResult(_0x29eaf3,_0x42bf33){return function(_0x3a59e0){if(_0x3a59e0){var _0x3bc24f=typeof _0x42bf33[_0xb55e('0x1c')]===_0xb55e('0x1d')&&typeof _0x42bf33[_0xb55e('0x1e')]===_0xb55e('0x1d');var _0x32f264=_0x3a59e0['count'];var _0x645037=_0x3bc24f?0x0:_0x42bf33[_0xb55e('0x1c')];var _0x8815f8=_0x3bc24f?_0x3a59e0[_0xb55e('0x1f')]:_0x42bf33[_0xb55e('0x1c')]+_0x42bf33[_0xb55e('0x1e')];var _0x4acd45;if(_0x8815f8>=_0x32f264){_0x8815f8=_0x32f264;_0x4acd45=0xc8;}else{_0x4acd45=0xce;}_0x29eaf3[_0xb55e('0x19')](_0x4acd45);return _0x29eaf3[_0xb55e('0x20')](_0xb55e('0x21'),_0x645037+'-'+_0x8815f8+'/'+_0x32f264)['json'](_0x3a59e0);}return null;};}function patchUpdates(_0x4ab8cd){return function(_0x2c6bd1){try{jsonpatch[_0xb55e('0x22')](_0x2c6bd1,_0x4ab8cd,!![]);}catch(_0x26fa2b){return BPromise['reject'](_0x26fa2b);}return _0x2c6bd1[_0xb55e('0x23')]();};}function saveUpdates(_0x160bad,_0x27bae8){return function(_0x1513c6){if(_0x1513c6){return _0x1513c6[_0xb55e('0x24')](_0x160bad)[_0xb55e('0x25')](function(_0x4a090d){return _0x4a090d;});}return null;};}function removeEntity(_0x5b9ede,_0x4ecb75){return function(_0x2f4310){if(_0x2f4310){return _0x2f4310['destroy']()['then'](function(){_0x5b9ede['status'](0xcc)[_0xb55e('0x1a')]();});}};}function handleEntityNotFound(_0xd6e782,_0x476cfa){return function(_0x238754){if(!_0x238754){_0xd6e782[_0xb55e('0x18')](0x194);}return _0x238754;};}function handleError(_0x1555c9,_0x3b83d2){_0x3b83d2=_0x3b83d2||0x1f4;return function(_0xe0a5db){logger[_0xb55e('0x26')](_0xe0a5db[_0xb55e('0x27')]);if(_0xe0a5db[_0xb55e('0x28')]){delete _0xe0a5db['name'];}_0x1555c9[_0xb55e('0x19')](_0x3b83d2)[_0xb55e('0x29')](_0xe0a5db);};}exports[_0xb55e('0x2a')]=function(_0x1bf5ec,_0x20b72d){var _0x249ca4={},_0x1dfa8c={},_0x126b70={'count':0x0,'rows':[]};var _0x4486f1=_[_0xb55e('0x2b')](db['FreshdeskConfiguration'][_0xb55e('0x2c')],function(_0x271305){return{'name':_0x271305[_0xb55e('0x2d')],'type':_0x271305['type'][_0xb55e('0x2e')]};});_0x1dfa8c[_0xb55e('0x2f')]=_[_0xb55e('0x2b')](_0x4486f1,_0xb55e('0x28'));_0x1dfa8c['query']=_[_0xb55e('0x30')](_0x1bf5ec[_0xb55e('0x31')]);_0x1dfa8c[_0xb55e('0x32')]=_[_0xb55e('0x33')](_0x1dfa8c[_0xb55e('0x2f')],_0x1dfa8c[_0xb55e('0x31')]);_0x249ca4[_0xb55e('0x34')]=_['intersection'](_0x1dfa8c[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x35')]));_0x249ca4['attributes']=_0x249ca4[_0xb55e('0x34')][_0xb55e('0x36')]?_0x249ca4['attributes']:_0x1dfa8c[_0xb55e('0x2f')];if(!_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x249ca4['limit']=qs[_0xb55e('0x1e')](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x1e')]);_0x249ca4['offset']=qs['offset'](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x1c')]);}_0x249ca4[_0xb55e('0x39')]=qs['sort'](_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x3a')]);_0x249ca4[_0xb55e('0x3b')]=qs[_0xb55e('0x32')](_[_0xb55e('0x3c')](_0x1bf5ec[_0xb55e('0x31')],_0x1dfa8c[_0xb55e('0x32')]),_0x4486f1);if(_0x1bf5ec[_0xb55e('0x31')]['filter']){_0x249ca4[_0xb55e('0x3b')]=_[_0xb55e('0x3d')](_0x249ca4[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x4486f1,function(_0x437723){if(_0x437723[_0xb55e('0x3e')]!==_0xb55e('0x3f')){var _0xb77ef7={};_0xb77ef7[_0x437723[_0xb55e('0x28')]]={'$like':'%'+_0x1bf5ec[_0xb55e('0x31')][_0xb55e('0x40')]+'%'};return _0xb77ef7;}})});}_0x249ca4=_[_0xb55e('0x3d')]({},_0x249ca4,_0x1bf5ec[_0xb55e('0x41')]);var _0x55cf1a={'where':_0x249ca4[_0xb55e('0x3b')]};return db[_0xb55e('0x42')][_0xb55e('0x1f')](_0x55cf1a)[_0xb55e('0x25')](function(_0x4d3698){_0x126b70[_0xb55e('0x1f')]=_0x4d3698;if(_0x1bf5ec['query'][_0xb55e('0x43')]){_0x249ca4[_0xb55e('0x44')]=[{'all':!![]}];}return db[_0xb55e('0x42')][_0xb55e('0x45')](_0x249ca4);})[_0xb55e('0x25')](function(_0xf6e202){_0x126b70[_0xb55e('0x46')]=_0xf6e202;return _0x126b70;})[_0xb55e('0x25')](respondWithFilteredResult(_0x20b72d,_0x249ca4))[_0xb55e('0x47')](handleError(_0x20b72d,null));};exports[_0xb55e('0x48')]=function(_0x5dbb8f,_0x2d4c3a){var _0x323281={'raw':![],'where':{'id':_0x5dbb8f[_0xb55e('0x49')]['id']}},_0x281c9a={};_0x281c9a[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db[_0xb55e('0x42')]['rawAttributes']);_0x281c9a[_0xb55e('0x31')]=_[_0xb55e('0x30')](_0x5dbb8f[_0xb55e('0x31')]);_0x281c9a[_0xb55e('0x32')]=_['intersection'](_0x281c9a['model'],_0x281c9a[_0xb55e('0x31')]);_0x323281['attributes']=_[_0xb55e('0x33')](_0x281c9a[_0xb55e('0x2f')],qs['fields'](_0x5dbb8f['query']['fields']));_0x323281[_0xb55e('0x34')]=_0x323281[_0xb55e('0x34')][_0xb55e('0x36')]?_0x323281[_0xb55e('0x34')]:_0x281c9a[_0xb55e('0x2f')];if(_0x5dbb8f[_0xb55e('0x31')][_0xb55e('0x43')]){_0x323281[_0xb55e('0x44')]=[{'all':!![]}];}_0x323281=_[_0xb55e('0x3d')]({},_0x323281,_0x5dbb8f['options']);return db[_0xb55e('0x42')][_0xb55e('0x4a')](_0x323281)['then'](handleEntityNotFound(_0x2d4c3a,null))[_0xb55e('0x25')](respondWithResult(_0x2d4c3a,null))[_0xb55e('0x47')](handleError(_0x2d4c3a,null));};exports[_0xb55e('0x4b')]=function(_0x44f952,_0x4d11f2){return db[_0xb55e('0x42')]['create'](_0x44f952[_0xb55e('0x4c')],{})[_0xb55e('0x25')](respondWithResult(_0x4d11f2,0xc9))['catch'](handleError(_0x4d11f2,null));};exports[_0xb55e('0x24')]=function(_0x1aa6c4,_0x101957){if(_0x1aa6c4[_0xb55e('0x4c')]['id']){delete _0x1aa6c4[_0xb55e('0x4c')]['id'];}return db[_0xb55e('0x42')][_0xb55e('0x4a')]({'where':{'id':_0x1aa6c4[_0xb55e('0x49')]['id']}})['then'](handleEntityNotFound(_0x101957,null))[_0xb55e('0x25')](saveUpdates(_0x1aa6c4[_0xb55e('0x4c')],null))[_0xb55e('0x25')](respondWithResult(_0x101957,null))['catch'](handleError(_0x101957,null));};exports['destroy']=function(_0x4a3901,_0x11dc23){return db[_0xb55e('0x42')][_0xb55e('0x4a')]({'where':{'id':_0x4a3901[_0xb55e('0x49')]['id']}})['then'](handleEntityNotFound(_0x11dc23,null))[_0xb55e('0x25')](removeEntity(_0x11dc23,null))[_0xb55e('0x47')](handleError(_0x11dc23,null));};exports[_0xb55e('0x4d')]=function(_0x4a2129,_0x1de8f7,_0x25137b){var _0x1ea461={};var _0x284b81={};var _0x22ca6f;var _0x1cac77;return db['FreshdeskConfiguration'][_0xb55e('0x4e')]({'where':{'id':_0x4a2129[_0xb55e('0x49')]['id']}})[_0xb55e('0x25')](handleEntityNotFound(_0x1de8f7,null))[_0xb55e('0x25')](function(_0xfb10a){if(_0xfb10a){_0x22ca6f=_0xfb10a;_0x284b81[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db['FreshdeskField'][_0xb55e('0x2c')]);_0x284b81[_0xb55e('0x31')]=_[_0xb55e('0x30')](_0x4a2129['query']);_0x284b81['filters']=_[_0xb55e('0x33')](_0x284b81[_0xb55e('0x2f')],_0x284b81['query']);_0x1ea461[_0xb55e('0x34')]=_[_0xb55e('0x33')](_0x284b81[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x4a2129[_0xb55e('0x31')][_0xb55e('0x35')]));_0x1ea461['attributes']=_0x1ea461[_0xb55e('0x34')]['length']?_0x1ea461[_0xb55e('0x34')]:_0x284b81['model'];_0x1ea461[_0xb55e('0x39')]=qs[_0xb55e('0x3a')](_0x4a2129['query'][_0xb55e('0x3a')]);_0x1ea461[_0xb55e('0x3b')]=qs[_0xb55e('0x32')](_[_0xb55e('0x3c')](_0x4a2129[_0xb55e('0x31')],_0x284b81['filters']));if(_0x4a2129[_0xb55e('0x31')][_0xb55e('0x40')]){_0x1ea461[_0xb55e('0x3b')]=_['merge'](_0x1ea461[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x1ea461[_0xb55e('0x34')],function(_0x3111cd){var _0x5e460d={};_0x5e460d[_0x3111cd]={'$like':'%'+_0x4a2129[_0xb55e('0x31')]['filter']+'%'};return _0x5e460d;})});}_0x1ea461=_[_0xb55e('0x3d')]({},_0x1ea461,_0x4a2129[_0xb55e('0x41')]);return _0x22ca6f[_0xb55e('0x4d')](_0x1ea461);}})[_0xb55e('0x25')](function(_0x54bf57){if(_0x54bf57){_0x1cac77=_0x54bf57[_0xb55e('0x36')];if(!_0x4a2129['query'][_0xb55e('0x37')](_0xb55e('0x38'))){_0x1ea461['limit']=qs['limit'](_0x4a2129[_0xb55e('0x31')][_0xb55e('0x1e')]);_0x1ea461[_0xb55e('0x1c')]=qs['offset'](_0x4a2129['query'][_0xb55e('0x1c')]);}return _0x22ca6f[_0xb55e('0x4d')](_0x1ea461);}})[_0xb55e('0x25')](function(_0xfaf351){if(_0xfaf351){return _0xfaf351?{'count':_0x1cac77,'rows':_0xfaf351}:null;}})[_0xb55e('0x25')](respondWithResult(_0x1de8f7,null))[_0xb55e('0x47')](handleError(_0x1de8f7,null));};exports[_0xb55e('0x4f')]=function(_0x55f5f9,_0x1d6bb4,_0x1fedd8){var _0x2c276b={};var _0x4ff9e8={};var _0x31f45d;var _0x15fae6;return db[_0xb55e('0x42')][_0xb55e('0x4e')]({'where':{'id':_0x55f5f9['params']['id']}})[_0xb55e('0x25')](handleEntityNotFound(_0x1d6bb4,null))[_0xb55e('0x25')](function(_0x5e988b){if(_0x5e988b){_0x31f45d=_0x5e988b;_0x4ff9e8[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db['FreshdeskField']['rawAttributes']);_0x4ff9e8['query']=_[_0xb55e('0x30')](_0x55f5f9['query']);_0x4ff9e8[_0xb55e('0x32')]=_[_0xb55e('0x33')](_0x4ff9e8[_0xb55e('0x2f')],_0x4ff9e8[_0xb55e('0x31')]);_0x2c276b[_0xb55e('0x34')]=_[_0xb55e('0x33')](_0x4ff9e8[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x35')]));_0x2c276b['attributes']=_0x2c276b[_0xb55e('0x34')][_0xb55e('0x36')]?_0x2c276b[_0xb55e('0x34')]:_0x4ff9e8[_0xb55e('0x2f')];_0x2c276b['order']=qs[_0xb55e('0x3a')](_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x3a')]);_0x2c276b[_0xb55e('0x3b')]=qs['filters'](_[_0xb55e('0x3c')](_0x55f5f9[_0xb55e('0x31')],_0x4ff9e8[_0xb55e('0x32')]));if(_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x40')]){_0x2c276b[_0xb55e('0x3b')]=_['merge'](_0x2c276b[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x2c276b['attributes'],function(_0x20b14a){var _0x550153={};_0x550153[_0x20b14a]={'$like':'%'+_0x55f5f9[_0xb55e('0x31')]['filter']+'%'};return _0x550153;})});}_0x2c276b=_[_0xb55e('0x3d')]({},_0x2c276b,_0x55f5f9[_0xb55e('0x41')]);return _0x31f45d[_0xb55e('0x4f')](_0x2c276b);}})[_0xb55e('0x25')](function(_0x38dd52){if(_0x38dd52){_0x15fae6=_0x38dd52[_0xb55e('0x36')];if(!_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x2c276b['limit']=qs['limit'](_0x55f5f9[_0xb55e('0x31')]['limit']);_0x2c276b['offset']=qs['offset'](_0x55f5f9[_0xb55e('0x31')][_0xb55e('0x1c')]);}return _0x31f45d[_0xb55e('0x4f')](_0x2c276b);}})[_0xb55e('0x25')](function(_0x1afea3){if(_0x1afea3){return _0x1afea3?{'count':_0x15fae6,'rows':_0x1afea3}:null;}})[_0xb55e('0x25')](respondWithResult(_0x1d6bb4,null))[_0xb55e('0x47')](handleError(_0x1d6bb4,null));};exports[_0xb55e('0x50')]=function(_0x533849,_0x41cf52,_0xcbf73e){var _0x103c0e={};var _0x645da9={};var _0x56a3ec;var _0x158fe1;return db['FreshdeskConfiguration'][_0xb55e('0x4e')]({'where':{'id':_0x533849[_0xb55e('0x49')]['id']}})['then'](handleEntityNotFound(_0x41cf52,null))[_0xb55e('0x25')](function(_0x43c150){if(_0x43c150){_0x56a3ec=_0x43c150;_0x645da9[_0xb55e('0x2f')]=_[_0xb55e('0x30')](db[_0xb55e('0x51')][_0xb55e('0x2c')]);_0x645da9['query']=_[_0xb55e('0x30')](_0x533849[_0xb55e('0x31')]);_0x645da9['filters']=_[_0xb55e('0x33')](_0x645da9[_0xb55e('0x2f')],_0x645da9['query']);_0x103c0e[_0xb55e('0x34')]=_[_0xb55e('0x33')](_0x645da9[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x533849[_0xb55e('0x31')][_0xb55e('0x35')]));_0x103c0e[_0xb55e('0x34')]=_0x103c0e[_0xb55e('0x34')][_0xb55e('0x36')]?_0x103c0e[_0xb55e('0x34')]:_0x645da9[_0xb55e('0x2f')];_0x103c0e['order']=qs[_0xb55e('0x3a')](_0x533849[_0xb55e('0x31')][_0xb55e('0x3a')]);_0x103c0e['where']=qs['filters'](_[_0xb55e('0x3c')](_0x533849[_0xb55e('0x31')],_0x645da9[_0xb55e('0x32')]));if(_0x533849[_0xb55e('0x31')][_0xb55e('0x40')]){_0x103c0e[_0xb55e('0x3b')]=_['merge'](_0x103c0e['where'],{'$or':_[_0xb55e('0x2b')](_0x103c0e[_0xb55e('0x34')],function(_0x95cfc1){var _0x11209c={};_0x11209c[_0x95cfc1]={'$like':'%'+_0x533849[_0xb55e('0x31')][_0xb55e('0x40')]+'%'};return _0x11209c;})});}_0x103c0e=_[_0xb55e('0x3d')]({},_0x103c0e,_0x533849[_0xb55e('0x41')]);return _0x56a3ec['getDescriptions'](_0x103c0e);}})[_0xb55e('0x25')](function(_0x39b51e){if(_0x39b51e){_0x158fe1=_0x39b51e['length'];if(!_0x533849[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x103c0e[_0xb55e('0x1e')]=qs[_0xb55e('0x1e')](_0x533849[_0xb55e('0x31')][_0xb55e('0x1e')]);_0x103c0e[_0xb55e('0x1c')]=qs['offset'](_0x533849['query']['offset']);}return _0x56a3ec['getDescriptions'](_0x103c0e);}})['then'](function(_0x337adf){if(_0x337adf){return _0x337adf?{'count':_0x158fe1,'rows':_0x337adf}:null;}})['then'](respondWithResult(_0x41cf52,null))[_0xb55e('0x47')](handleError(_0x41cf52,null));};exports[_0xb55e('0x52')]=function(_0x4cc5a0,_0x222772,_0x2d1673){var _0x4c1923={};var _0x6f4471={};var _0x5ce36e;var _0x982f75;return db[_0xb55e('0x42')][_0xb55e('0x4e')]({'where':{'id':_0x4cc5a0['params']['id']}})['then'](handleEntityNotFound(_0x222772,null))[_0xb55e('0x25')](function(_0x3d20a0){if(_0x3d20a0){_0x5ce36e=_0x3d20a0;_0x6f4471['model']=_[_0xb55e('0x30')](db[_0xb55e('0x53')][_0xb55e('0x2c')]);_0x6f4471['query']=_[_0xb55e('0x30')](_0x4cc5a0[_0xb55e('0x31')]);_0x6f4471[_0xb55e('0x32')]=_[_0xb55e('0x33')](_0x6f4471[_0xb55e('0x2f')],_0x6f4471[_0xb55e('0x31')]);_0x4c1923['attributes']=_[_0xb55e('0x33')](_0x6f4471[_0xb55e('0x2f')],qs[_0xb55e('0x35')](_0x4cc5a0['query']['fields']));_0x4c1923['attributes']=_0x4c1923['attributes'][_0xb55e('0x36')]?_0x4c1923['attributes']:_0x6f4471[_0xb55e('0x2f')];_0x4c1923[_0xb55e('0x39')]=qs['sort'](_0x4cc5a0['query'][_0xb55e('0x3a')]);_0x4c1923[_0xb55e('0x3b')]=qs[_0xb55e('0x32')](_[_0xb55e('0x3c')](_0x4cc5a0['query'],_0x6f4471[_0xb55e('0x32')]));if(_0x4cc5a0[_0xb55e('0x31')][_0xb55e('0x40')]){_0x4c1923[_0xb55e('0x3b')]=_[_0xb55e('0x3d')](_0x4c1923[_0xb55e('0x3b')],{'$or':_[_0xb55e('0x2b')](_0x4c1923[_0xb55e('0x34')],function(_0x102702){var _0x54fb83={};_0x54fb83[_0x102702]={'$like':'%'+_0x4cc5a0[_0xb55e('0x31')]['filter']+'%'};return _0x54fb83;})});}_0x4c1923=_[_0xb55e('0x3d')]({},_0x4c1923,_0x4cc5a0['options']);return _0x5ce36e[_0xb55e('0x52')](_0x4c1923);}})[_0xb55e('0x25')](function(_0x835ef3){if(_0x835ef3){_0x982f75=_0x835ef3['length'];if(!_0x4cc5a0[_0xb55e('0x31')][_0xb55e('0x37')](_0xb55e('0x38'))){_0x4c1923[_0xb55e('0x1e')]=qs['limit'](_0x4cc5a0['query'][_0xb55e('0x1e')]);_0x4c1923[_0xb55e('0x1c')]=qs['offset'](_0x4cc5a0[_0xb55e('0x31')]['offset']);}return _0x5ce36e['getTags'](_0x4c1923);}})[_0xb55e('0x25')](function(_0x1b1413){if(_0x1b1413){return _0x1b1413?{'count':_0x982f75,'rows':_0x1b1413}:null;}})['then'](respondWithResult(_0x222772,null))[_0xb55e('0x47')](handleError(_0x222772,null));};exports[_0xb55e('0x54')]=function(_0x529b6c,_0x2895d2,_0x53477f){if(_0x529b6c[_0xb55e('0x4c')]['id']){delete _0x529b6c[_0xb55e('0x4c')]['id'];}return db[_0xb55e('0x42')][_0xb55e('0x4e')]({'where':{'id':_0x529b6c[_0xb55e('0x49')]['id']}})[_0xb55e('0x25')](handleEntityNotFound(_0x2895d2,null))[_0xb55e('0x25')](function(_0x4372ee){if(_0x4372ee){return _0x4372ee[_0xb55e('0x54')](_0x529b6c[_0xb55e('0x4c')]['ids']||[]);}return null;})[_0xb55e('0x25')](respondWithResult(_0x2895d2,null))[_0xb55e('0x47')](handleError(_0x2895d2,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ff12f37..f47aa61 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 _0x85f4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x85f4,0x1a0));var _0x485f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x85f4[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x485f('0x0'));var util=require(_0x485f('0x1'));var logger=require(_0x485f('0x2'))(_0x485f('0x3'));var moment=require(_0x485f('0x4'));var BPromise=require(_0x485f('0x5'));var rp=require(_0x485f('0x6'));var fs=require('fs');var path=require(_0x485f('0x7'));var rimraf=require('rimraf');var config=require(_0x485f('0x8'));var attributes=require(_0x485f('0x9'));module[_0x485f('0xa')]=function(_0x3ff193,_0x299e51){return _0x3ff193[_0x485f('0xb')]('FreshdeskConfiguration',attributes,{'tableName':_0x485f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xddb1=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x24cdda,_0x299ba0){var _0x5f0e0d=function(_0x5e5bc8){while(--_0x5e5bc8){_0x24cdda['push'](_0x24cdda['shift']());}};_0x5f0e0d(++_0x299ba0);}(_0xddb1,0x118));var _0x1ddb=function(_0x42e4ca,_0x10313b){_0x42e4ca=_0x42e4ca-0x0;var _0x2585bb=_0xddb1[_0x42e4ca];return _0x2585bb;};'use strict';var _=require(_0x1ddb('0x0'));var util=require('util');var logger=require(_0x1ddb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1ddb('0x2'));var rp=require(_0x1ddb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ddb('0x4'));var config=require(_0x1ddb('0x5'));var attributes=require(_0x1ddb('0x6'));module[_0x1ddb('0x7')]=function(_0x366eed,_0x35c591){return _0x366eed[_0x1ddb('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0x1ddb('0x9'),'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 0f3c35a..686c09f 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 _0x89e7=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4b5193,_0x191baf){var _0x256c47=function(_0x1b5c98){while(--_0x1b5c98){_0x4b5193['push'](_0x4b5193['shift']());}};_0x256c47(++_0x191baf);}(_0x89e7,0x1ba));var _0x789e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x89e7[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x789e('0x0'));var util=require(_0x789e('0x1'));var moment=require(_0x789e('0x2'));var BPromise=require(_0x789e('0x3'));var rs=require(_0x789e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x789e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x789e('0x6'))(_0x789e('0x7'));var config=require(_0x789e('0x8'));var jayson=require(_0x789e('0x9'));var client=jayson[_0x789e('0xa')][_0x789e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x438401,_0xe1b22b,_0x4a735d){return new BPromise(function(_0xa2ff07,_0x4ca6b4){return client[_0x789e('0xc')](_0x438401,_0x4a735d)[_0x789e('0xd')](function(_0x39fb19){logger['info'](_0x789e('0xe'),_0xe1b22b,_0x789e('0xf'));logger[_0x789e('0x10')](_0x789e('0x11'),_0xe1b22b,_0x789e('0xf'),JSON[_0x789e('0x12')](_0x39fb19));if(_0x39fb19[_0x789e('0x13')]){if(_0x39fb19[_0x789e('0x13')][_0x789e('0x14')]===0x1f4){logger[_0x789e('0x13')](_0x789e('0xe'),_0xe1b22b,_0x39fb19[_0x789e('0x13')][_0x789e('0x15')]);return _0x4ca6b4(_0x39fb19[_0x789e('0x13')][_0x789e('0x15')]);}logger['error'](_0x789e('0xe'),_0xe1b22b,_0x39fb19[_0x789e('0x13')][_0x789e('0x15')]);return _0xa2ff07(_0x39fb19['error'][_0x789e('0x15')]);}else{logger['info'](_0x789e('0xe'),_0xe1b22b,_0x789e('0xf'));_0xa2ff07(_0x39fb19[_0x789e('0x16')][_0x789e('0x15')]);}})[_0x789e('0x17')](function(_0x8cc320){logger['error'](_0x789e('0xe'),_0xe1b22b,_0x8cc320);_0x4ca6b4(_0x8cc320);});});} \ No newline at end of file +var _0x9a1a=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','util','bluebird','randomstring'];(function(_0x14c4ba,_0x3b159d){var _0xed71c5=function(_0x5af030){while(--_0x5af030){_0x14c4ba['push'](_0x14c4ba['shift']());}};_0xed71c5(++_0x3b159d);}(_0x9a1a,0x1b5));var _0xa9a1=function(_0x7729f1,_0x3bd1ab){_0x7729f1=_0x7729f1-0x0;var _0x40faf3=_0x9a1a[_0x7729f1];return _0x40faf3;};'use strict';var _=require('lodash');var util=require(_0xa9a1('0x0'));var moment=require('moment');var BPromise=require(_0xa9a1('0x1'));var rs=require(_0xa9a1('0x2'));var fs=require('fs');var Redis=require(_0xa9a1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9a1('0x4'));var logger=require(_0xa9a1('0x5'))('rpc');var config=require(_0xa9a1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa9a1('0x7')][_0xa9a1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bcfdc,_0x255d6b,_0x309267){return new BPromise(function(_0x566e11,_0x4193d8){return client[_0xa9a1('0x9')](_0x2bcfdc,_0x309267)[_0xa9a1('0xa')](function(_0xb7cdf){logger[_0xa9a1('0xb')](_0xa9a1('0xc'),_0x255d6b,'request\x20sent');logger[_0xa9a1('0xd')](_0xa9a1('0xe'),_0x255d6b,'request\x20sent',JSON[_0xa9a1('0xf')](_0xb7cdf));if(_0xb7cdf['error']){if(_0xb7cdf['error'][_0xa9a1('0x10')]===0x1f4){logger[_0xa9a1('0x11')](_0xa9a1('0xc'),_0x255d6b,_0xb7cdf[_0xa9a1('0x11')][_0xa9a1('0x12')]);return _0x4193d8(_0xb7cdf['error'][_0xa9a1('0x12')]);}logger[_0xa9a1('0x11')](_0xa9a1('0xc'),_0x255d6b,_0xb7cdf[_0xa9a1('0x11')][_0xa9a1('0x12')]);return _0x566e11(_0xb7cdf['error'][_0xa9a1('0x12')]);}else{logger['info'](_0xa9a1('0xc'),_0x255d6b,_0xa9a1('0x13'));_0x566e11(_0xb7cdf[_0xa9a1('0x14')][_0xa9a1('0x12')]);}})[_0xa9a1('0x15')](function(_0x195210){logger[_0xa9a1('0x11')](_0xa9a1('0xc'),_0x255d6b,_0x195210);_0x4193d8(_0x195210);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index bc5fde3..d314d6b 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 _0x0d6d=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','util','path','connect-timeout','express'];(function(_0xd269e9,_0xefb543){var _0x3a5ee4=function(_0x303b75){while(--_0x303b75){_0xd269e9['push'](_0xd269e9['shift']());}};_0x3a5ee4(++_0xefb543);}(_0x0d6d,0x8c));var _0xd0d6=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0d6d[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require(_0xd0d6('0x0'));var path=require(_0xd0d6('0x1'));var timeout=require(_0xd0d6('0x2'));var express=require(_0xd0d6('0x3'));var router=express['Router']();var fs_extra=require(_0xd0d6('0x4'));var auth=require(_0xd0d6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd0d6('0x6'));var controller=require('./intFreshdeskField.controller');router[_0xd0d6('0x7')]('/',auth['isAuthenticated'](),controller[_0xd0d6('0x8')]);router[_0xd0d6('0x7')]('/:id',auth[_0xd0d6('0x9')](),controller[_0xd0d6('0xa')]);router['post']('/',auth[_0xd0d6('0x9')](),controller[_0xd0d6('0xb')]);router[_0xd0d6('0xc')](_0xd0d6('0xd'),auth[_0xd0d6('0x9')](),controller['update']);router[_0xd0d6('0xe')]('/:id',auth[_0xd0d6('0x9')](),controller[_0xd0d6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0833=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','create','put','update','exports','multer'];(function(_0x1e7c62,_0x4e8449){var _0x517f43=function(_0x1a5a24){while(--_0x1a5a24){_0x1e7c62['push'](_0x1e7c62['shift']());}};_0x517f43(++_0x4e8449);}(_0x0833,0x1e5));var _0x3083=function(_0x2486c7,_0x1be0ac){_0x2486c7=_0x2486c7-0x0;var _0x4a9e0f=_0x0833[_0x2486c7];return _0x4a9e0f;};'use strict';var multer=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var path=require(_0x3083('0x2'));var timeout=require(_0x3083('0x3'));var express=require(_0x3083('0x4'));var router=express[_0x3083('0x5')]();var fs_extra=require(_0x3083('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3083('0x7'));var config=require(_0x3083('0x8'));var controller=require(_0x3083('0x9'));router[_0x3083('0xa')]('/',auth[_0x3083('0xb')](),controller[_0x3083('0xc')]);router[_0x3083('0xa')](_0x3083('0xd'),auth[_0x3083('0xb')](),controller['show']);router['post']('/',auth[_0x3083('0xb')](),controller[_0x3083('0xe')]);router[_0x3083('0xf')](_0x3083('0xd'),auth['isAuthenticated'](),controller[_0x3083('0x10')]);router['delete'](_0x3083('0xd'),auth[_0x3083('0xb')](),controller['destroy']);module[_0x3083('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3c5209f..0eb16f6 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 _0xf65c=['customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf65c,0x12f));var _0xcf65=function(_0x34789b,_0xcdb10f){_0x34789b=_0x34789b-0x0;var _0x24594a=_0xf65c[_0x34789b];return _0x24594a;};'use strict';var Sequelize=require(_0xcf65('0x0'));module[_0xcf65('0x1')]={'type':{'type':Sequelize[_0xcf65('0x2')]('string','variable',_0xcf65('0x3'),'keyValue',_0xcf65('0x4')),'defaultValue':_0xcf65('0x5')},'content':{'type':Sequelize[_0xcf65('0x6')]},'key':{'type':Sequelize[_0xcf65('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xcf65('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xcf65('0x6')]},'idField':{'type':Sequelize[_0xcf65('0x6')]},'nameField':{'type':Sequelize[_0xcf65('0x6')]},'customField':{'type':Sequelize[_0xcf65('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf65('0x6')]}}; \ No newline at end of file +var _0xfa8d=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x4d039c,_0x3d6309){var _0x51aec3=function(_0x31424d){while(--_0x31424d){_0x4d039c['push'](_0x4d039c['shift']());}};_0x51aec3(++_0x3d6309);}(_0xfa8d,0x1a0));var _0xdfa8=function(_0x893dd7,_0x4117ec){_0x893dd7=_0x893dd7-0x0;var _0x38e4b8=_0xfa8d[_0x893dd7];return _0x38e4b8;};'use strict';var Sequelize=require(_0xdfa8('0x0'));module[_0xdfa8('0x1')]={'type':{'type':Sequelize[_0xdfa8('0x2')](_0xdfa8('0x3'),_0xdfa8('0x4'),_0xdfa8('0x5'),'keyValue',_0xdfa8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdfa8('0x7')]},'key':{'type':Sequelize[_0xdfa8('0x7')]},'keyType':{'type':Sequelize[_0xdfa8('0x2')]('string',_0xdfa8('0x4'),_0xdfa8('0x5'))},'keyContent':{'type':Sequelize[_0xdfa8('0x7')]},'idField':{'type':Sequelize[_0xdfa8('0x7')]},'nameField':{'type':Sequelize[_0xdfa8('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfa8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5581d06..f2a493c 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 _0x9aea=['sox','to-csv','fs-extra','lodash','squel','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','json','offset','limit','undefined','status','Content-Range','apply','reject','destroy','then','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','eml-format','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4ec863,_0x85080a){var _0x2071fc=function(_0x5a49a2){while(--_0x5a49a2){_0x4ec863['push'](_0x4ec863['shift']());}};_0x2071fc(++_0x85080a);}(_0x9aea,0xdd));var _0xa9ae=function(_0x76a4b,_0x4d2cbf){_0x76a4b=_0x76a4b-0x0;var _0xa88eee=_0x9aea[_0x76a4b];return _0xa88eee;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ae('0x2'));var moment=require(_0xa9ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ae('0x4'));var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xe'));var Papa=require(_0xa9ae('0xf'));var Redis=require(_0xa9ae('0x10'));var authService=require(_0xa9ae('0x11'));var qs=require(_0xa9ae('0x12'));var as=require(_0xa9ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x14'))('api');var utils=require(_0xa9ae('0x15'));var config=require(_0xa9ae('0x16'));var licenseUtil=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];function respondWithStatusCode(_0x35f861,_0x33a72f){_0x33a72f=_0x33a72f||0xcc;return function(_0xa34271){if(_0xa34271){return _0x35f861[_0xa9ae('0x19')](_0x33a72f);}return _0x35f861['status'](_0x33a72f)[_0xa9ae('0x1a')]();};}function respondWithResult(_0x365e90,_0x10882e){_0x10882e=_0x10882e||0xc8;return function(_0x3f7f61){if(_0x3f7f61){return _0x365e90['status'](_0x10882e)[_0xa9ae('0x1b')](_0x3f7f61);}};}function respondWithFilteredResult(_0x1ec742,_0x31c03e){return function(_0x40b756){if(_0x40b756){var _0x77b0a4=typeof _0x31c03e[_0xa9ae('0x1c')]==='undefined'&&typeof _0x31c03e[_0xa9ae('0x1d')]===_0xa9ae('0x1e');var _0x3e31d9=_0x40b756['count'];var _0x4dbb30=_0x77b0a4?0x0:_0x31c03e[_0xa9ae('0x1c')];var _0x581345=_0x77b0a4?_0x40b756['count']:_0x31c03e[_0xa9ae('0x1c')]+_0x31c03e[_0xa9ae('0x1d')];var _0xbfd2ff;if(_0x581345>=_0x3e31d9){_0x581345=_0x3e31d9;_0xbfd2ff=0xc8;}else{_0xbfd2ff=0xce;}_0x1ec742[_0xa9ae('0x1f')](_0xbfd2ff);return _0x1ec742['set'](_0xa9ae('0x20'),_0x4dbb30+'-'+_0x581345+'/'+_0x3e31d9)[_0xa9ae('0x1b')](_0x40b756);}return null;};}function patchUpdates(_0x39f133){return function(_0x688153){try{jsonpatch[_0xa9ae('0x21')](_0x688153,_0x39f133,!![]);}catch(_0x2e204d){return BPromise[_0xa9ae('0x22')](_0x2e204d);}return _0x688153['save']();};}function saveUpdates(_0xc021cf,_0x4ca9a9){return function(_0x49dca9){if(_0x49dca9){return _0x49dca9['update'](_0xc021cf)['then'](function(_0x1afd07){return _0x1afd07;});}return null;};}function removeEntity(_0x4edd55,_0x13fb05){return function(_0x5093ad){if(_0x5093ad){return _0x5093ad[_0xa9ae('0x23')]()[_0xa9ae('0x24')](function(){_0x4edd55[_0xa9ae('0x1f')](0xcc)[_0xa9ae('0x1a')]();});}};}function handleEntityNotFound(_0x12b061,_0x3f3f97){return function(_0x23c1ec){if(!_0x23c1ec){_0x12b061['sendStatus'](0x194);}return _0x23c1ec;};}function handleError(_0x3eb591,_0x3873aa){_0x3873aa=_0x3873aa||0x1f4;return function(_0x2aac9e){logger[_0xa9ae('0x25')](_0x2aac9e[_0xa9ae('0x26')]);if(_0x2aac9e[_0xa9ae('0x27')]){delete _0x2aac9e[_0xa9ae('0x27')];}_0x3eb591['status'](_0x3873aa)['send'](_0x2aac9e);};}exports[_0xa9ae('0x28')]=function(_0x3c324e,_0x3d1131){var _0x3d84d7={},_0x74cd94={},_0x54a821={'count':0x0,'rows':[]};var _0x52dd4f=_[_0xa9ae('0x29')](db[_0xa9ae('0x2a')][_0xa9ae('0x2b')],function(_0x3a48b7){return{'name':_0x3a48b7[_0xa9ae('0x2c')],'type':_0x3a48b7[_0xa9ae('0x2d')]['key']};});_0x74cd94['model']=_[_0xa9ae('0x29')](_0x52dd4f,_0xa9ae('0x27'));_0x74cd94[_0xa9ae('0x2e')]=_[_0xa9ae('0x2f')](_0x3c324e[_0xa9ae('0x2e')]);_0x74cd94[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x74cd94[_0xa9ae('0x32')],_0x74cd94['query']);_0x3d84d7[_0xa9ae('0x33')]=_['intersection'](_0x74cd94[_0xa9ae('0x32')],qs[_0xa9ae('0x34')](_0x3c324e[_0xa9ae('0x2e')]['fields']));_0x3d84d7[_0xa9ae('0x33')]=_0x3d84d7[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x3d84d7[_0xa9ae('0x33')]:_0x74cd94[_0xa9ae('0x32')];if(!_0x3c324e['query'][_0xa9ae('0x36')](_0xa9ae('0x37'))){_0x3d84d7[_0xa9ae('0x1d')]=qs['limit'](_0x3c324e['query'][_0xa9ae('0x1d')]);_0x3d84d7[_0xa9ae('0x1c')]=qs[_0xa9ae('0x1c')](_0x3c324e[_0xa9ae('0x2e')]['offset']);}_0x3d84d7[_0xa9ae('0x38')]=qs[_0xa9ae('0x39')](_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x39')]);_0x3d84d7[_0xa9ae('0x3a')]=qs['filters'](_[_0xa9ae('0x3b')](_0x3c324e['query'],_0x74cd94[_0xa9ae('0x30')]),_0x52dd4f);if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x3c')]){_0x3d84d7['where']=_[_0xa9ae('0x3d')](_0x3d84d7[_0xa9ae('0x3a')],{'$or':_[_0xa9ae('0x29')](_0x52dd4f,function(_0x48d36b){if(_0x48d36b[_0xa9ae('0x2d')]!==_0xa9ae('0x3e')){var _0x4e2001={};_0x4e2001[_0x48d36b[_0xa9ae('0x27')]]={'$like':'%'+_0x3c324e['query'][_0xa9ae('0x3c')]+'%'};return _0x4e2001;}})});}_0x3d84d7=_[_0xa9ae('0x3d')]({},_0x3d84d7,_0x3c324e['options']);var _0x37da9b={'where':_0x3d84d7[_0xa9ae('0x3a')]};return db[_0xa9ae('0x2a')][_0xa9ae('0x3f')](_0x37da9b)[_0xa9ae('0x24')](function(_0xf48d22){_0x54a821['count']=_0xf48d22;if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x40')]){_0x3d84d7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xa9ae('0x41')](_0x3d84d7);})[_0xa9ae('0x24')](function(_0xc4f775){_0x54a821[_0xa9ae('0x42')]=_0xc4f775;return _0x54a821;})['then'](respondWithFilteredResult(_0x3d1131,_0x3d84d7))[_0xa9ae('0x43')](handleError(_0x3d1131,null));};exports[_0xa9ae('0x44')]=function(_0x20dd83,_0x42dab2){var _0x23c91d={'raw':!![],'where':{'id':_0x20dd83[_0xa9ae('0x45')]['id']}},_0x2bef06={};_0x2bef06['model']=_[_0xa9ae('0x2f')](db[_0xa9ae('0x2a')]['rawAttributes']);_0x2bef06[_0xa9ae('0x2e')]=_['keys'](_0x20dd83[_0xa9ae('0x2e')]);_0x2bef06[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x2bef06[_0xa9ae('0x32')],_0x2bef06[_0xa9ae('0x2e')]);_0x23c91d[_0xa9ae('0x33')]=_[_0xa9ae('0x31')](_0x2bef06['model'],qs[_0xa9ae('0x34')](_0x20dd83[_0xa9ae('0x2e')]['fields']));_0x23c91d[_0xa9ae('0x33')]=_0x23c91d[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x23c91d[_0xa9ae('0x33')]:_0x2bef06[_0xa9ae('0x32')];if(_0x20dd83[_0xa9ae('0x2e')]['includeAll']){_0x23c91d[_0xa9ae('0x46')]=[{'all':!![]}];}_0x23c91d=_['merge']({},_0x23c91d,_0x20dd83[_0xa9ae('0x47')]);return db[_0xa9ae('0x2a')]['find'](_0x23c91d)['then'](handleEntityNotFound(_0x42dab2,null))[_0xa9ae('0x24')](respondWithResult(_0x42dab2,null))[_0xa9ae('0x43')](handleError(_0x42dab2,null));};exports[_0xa9ae('0x48')]=function(_0x47615f,_0x435c29){return db[_0xa9ae('0x2a')][_0xa9ae('0x48')](_0x47615f[_0xa9ae('0x49')],{})['then'](respondWithResult(_0x435c29,0xc9))['catch'](handleError(_0x435c29,null));};exports[_0xa9ae('0x4a')]=function(_0x3cf89c,_0x4efe55){if(_0x3cf89c[_0xa9ae('0x49')]['id']){delete _0x3cf89c[_0xa9ae('0x49')]['id'];}return db[_0xa9ae('0x2a')][_0xa9ae('0x4b')]({'where':{'id':_0x3cf89c[_0xa9ae('0x45')]['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x4efe55,null))[_0xa9ae('0x24')](saveUpdates(_0x3cf89c[_0xa9ae('0x49')],null))['then'](respondWithResult(_0x4efe55,null))[_0xa9ae('0x43')](handleError(_0x4efe55,null));};exports[_0xa9ae('0x23')]=function(_0x5ea18d,_0x128f88){return db['FreshdeskField']['find']({'where':{'id':_0x5ea18d['params']['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x128f88,null))[_0xa9ae('0x24')](removeEntity(_0x128f88,null))['catch'](handleError(_0x128f88,null));}; \ No newline at end of file +var _0xc6d8=['params','find','create','body','update','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','catch','show'];(function(_0x551723,_0x2c1d4d){var _0x489ad7=function(_0x4f0298){while(--_0x4f0298){_0x551723['push'](_0x551723['shift']());}};_0x489ad7(++_0x2c1d4d);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x57b4cc,_0x2ae50e){_0x57b4cc=_0x57b4cc-0x0;var _0x45ba9d=_0xc6d8[_0x57b4cc];return _0x45ba9d;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9c4,_0x490b46){return function(_0x23c893){if(!_0x23c893){_0x15a9c4[_0x8c6d('0x16')](0x194);}return _0x23c893;};}function handleError(_0x353ba5,_0x2b6d18){_0x2b6d18=_0x2b6d18||0x1f4;return function(_0x1e6755){logger[_0x8c6d('0x22')](_0x1e6755[_0x8c6d('0x23')]);if(_0x1e6755[_0x8c6d('0x24')]){delete _0x1e6755[_0x8c6d('0x24')];}_0x353ba5['status'](_0x2b6d18)['send'](_0x1e6755);};}exports[_0x8c6d('0x25')]=function(_0x93a094,_0xfc6000){var _0x42a7db={},_0x370626={},_0x316ca7={'count':0x0,'rows':[]};var _0x2bc94a=_[_0x8c6d('0x26')](db[_0x8c6d('0x27')][_0x8c6d('0x28')],function(_0x3375dd){return{'name':_0x3375dd[_0x8c6d('0x29')],'type':_0x3375dd['type'][_0x8c6d('0x2a')]};});_0x370626[_0x8c6d('0x2b')]=_[_0x8c6d('0x26')](_0x2bc94a,_0x8c6d('0x24'));_0x370626[_0x8c6d('0x2c')]=_[_0x8c6d('0x2d')](_0x93a094[_0x8c6d('0x2c')]);_0x370626[_0x8c6d('0x2e')]=_[_0x8c6d('0x2f')](_0x370626['model'],_0x370626[_0x8c6d('0x2c')]);_0x42a7db['attributes']=_[_0x8c6d('0x2f')](_0x370626[_0x8c6d('0x2b')],qs[_0x8c6d('0x30')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x30')]));_0x42a7db[_0x8c6d('0x31')]=_0x42a7db['attributes']['length']?_0x42a7db[_0x8c6d('0x31')]:_0x370626[_0x8c6d('0x2b')];if(!_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x32')]('nolimit')){_0x42a7db[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x1c')]);_0x42a7db[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x93a094['query'][_0x8c6d('0x19')]);}_0x42a7db[_0x8c6d('0x33')]=qs[_0x8c6d('0x34')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x34')]);_0x42a7db[_0x8c6d('0x35')]=qs[_0x8c6d('0x2e')](_[_0x8c6d('0x36')](_0x93a094[_0x8c6d('0x2c')],_0x370626[_0x8c6d('0x2e')]),_0x2bc94a);if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x37')]){_0x42a7db['where']=_[_0x8c6d('0x38')](_0x42a7db[_0x8c6d('0x35')],{'$or':_[_0x8c6d('0x26')](_0x2bc94a,function(_0x454e96){if(_0x454e96[_0x8c6d('0x39')]!=='VIRTUAL'){var _0x26027f={};_0x26027f[_0x454e96[_0x8c6d('0x24')]]={'$like':'%'+_0x93a094['query'][_0x8c6d('0x37')]+'%'};return _0x26027f;}})});}_0x42a7db=_[_0x8c6d('0x38')]({},_0x42a7db,_0x93a094[_0x8c6d('0x3a')]);var _0x4869dc={'where':_0x42a7db[_0x8c6d('0x35')]};return db[_0x8c6d('0x27')][_0x8c6d('0x1b')](_0x4869dc)[_0x8c6d('0x3b')](function(_0x2f54a2){_0x316ca7[_0x8c6d('0x1b')]=_0x2f54a2;if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x42a7db[_0x8c6d('0x3d')]=[{'all':!![]}];}return db[_0x8c6d('0x27')][_0x8c6d('0x3e')](_0x42a7db);})['then'](function(_0x58af06){_0x316ca7['rows']=_0x58af06;return _0x316ca7;})[_0x8c6d('0x3b')](respondWithFilteredResult(_0xfc6000,_0x42a7db))[_0x8c6d('0x3f')](handleError(_0xfc6000,null));};exports[_0x8c6d('0x40')]=function(_0x3d69c3,_0x3409eb){var _0x546f04={'raw':!![],'where':{'id':_0x3d69c3[_0x8c6d('0x41')]['id']}},_0x274d01={};_0x274d01[_0x8c6d('0x2b')]=_['keys'](db[_0x8c6d('0x27')][_0x8c6d('0x28')]);_0x274d01['query']=_['keys'](_0x3d69c3['query']);_0x274d01['filters']=_['intersection'](_0x274d01[_0x8c6d('0x2b')],_0x274d01[_0x8c6d('0x2c')]);_0x546f04[_0x8c6d('0x31')]=_[_0x8c6d('0x2f')](_0x274d01[_0x8c6d('0x2b')],qs['fields'](_0x3d69c3['query']['fields']));_0x546f04['attributes']=_0x546f04[_0x8c6d('0x31')]['length']?_0x546f04[_0x8c6d('0x31')]:_0x274d01[_0x8c6d('0x2b')];if(_0x3d69c3[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x546f04[_0x8c6d('0x3d')]=[{'all':!![]}];}_0x546f04=_[_0x8c6d('0x38')]({},_0x546f04,_0x3d69c3['options']);return db[_0x8c6d('0x27')][_0x8c6d('0x42')](_0x546f04)['then'](handleEntityNotFound(_0x3409eb,null))[_0x8c6d('0x3b')](respondWithResult(_0x3409eb,null))[_0x8c6d('0x3f')](handleError(_0x3409eb,null));};exports['create']=function(_0x2fd4ea,_0xb6e94){return db[_0x8c6d('0x27')][_0x8c6d('0x43')](_0x2fd4ea[_0x8c6d('0x44')],{})[_0x8c6d('0x3b')](respondWithResult(_0xb6e94,0xc9))[_0x8c6d('0x3f')](handleError(_0xb6e94,null));};exports[_0x8c6d('0x45')]=function(_0x1f1609,_0x1d6c29){if(_0x1f1609[_0x8c6d('0x44')]['id']){delete _0x1f1609[_0x8c6d('0x44')]['id'];}return db[_0x8c6d('0x27')][_0x8c6d('0x42')]({'where':{'id':_0x1f1609[_0x8c6d('0x41')]['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x1d6c29,null))['then'](saveUpdates(_0x1f1609['body'],null))['then'](respondWithResult(_0x1d6c29,null))[_0x8c6d('0x3f')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x21')]=function(_0x4919b8,_0x574b08){return db['FreshdeskField'][_0x8c6d('0x42')]({'where':{'id':_0x4919b8['params']['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x574b08,null))[_0x8c6d('0x3b')](removeEntity(_0x574b08,null))[_0x8c6d('0x3f')](handleError(_0x574b08,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 58b2952..475ed7b 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 _0x2aec=['request-promise','path','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird'];(function(_0x11ff60,_0x50c040){var _0x18943c=function(_0x1dc24e){while(--_0x1dc24e){_0x11ff60['push'](_0x11ff60['shift']());}};_0x18943c(++_0x50c040);}(_0x2aec,0x1dd));var _0xc2ae=function(_0x3e2ddf,_0x294f72){_0x3e2ddf=_0x3e2ddf-0x0;var _0x5daf5a=_0x2aec[_0x3e2ddf];return _0x5daf5a;};'use strict';var _=require(_0xc2ae('0x0'));var util=require('util');var logger=require(_0xc2ae('0x1'))('api');var moment=require(_0xc2ae('0x2'));var BPromise=require(_0xc2ae('0x3'));var rp=require(_0xc2ae('0x4'));var fs=require('fs');var path=require(_0xc2ae('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc2ae('0x6'));module[_0xc2ae('0x7')]=function(_0x1e8862,_0x24d14a){return _0x1e8862[_0xc2ae('0x8')]('FreshdeskField',attributes,{'tableName':_0xc2ae('0x9'),'paranoid':![],'indexes':[{'name':_0xc2ae('0xa'),'fields':[_0xc2ae('0xb'),_0xc2ae('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0160=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x58af7f,_0x52d3fb){var _0x19d9e6=function(_0xb7a635){while(--_0xb7a635){_0x58af7f['push'](_0x58af7f['shift']());}};_0x19d9e6(++_0x52d3fb);}(_0x0160,0x16c));var _0x0016=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x0160[_0x199c03];return _0x11a7d4;};'use strict';var _=require('lodash');var util=require(_0x0016('0x0'));var logger=require(_0x0016('0x1'))(_0x0016('0x2'));var moment=require(_0x0016('0x3'));var BPromise=require(_0x0016('0x4'));var rp=require(_0x0016('0x5'));var fs=require('fs');var path=require(_0x0016('0x6'));var rimraf=require(_0x0016('0x7'));var config=require(_0x0016('0x8'));var attributes=require(_0x0016('0x9'));module[_0x0016('0xa')]=function(_0x20ffe3,_0x5e54a2){return _0x20ffe3[_0x0016('0xb')](_0x0016('0xc'),attributes,{'tableName':_0x0016('0xd'),'paranoid':![],'indexes':[{'name':_0x0016('0xe'),'fields':[_0x0016('0xf'),_0x0016('0x10')],'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 260f76f..601dcb4 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 _0x6eed=['../../config/environment','client','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x1102f7,_0xd1e02d){var _0x34b529=function(_0x111bff){while(--_0x111bff){_0x1102f7['push'](_0x1102f7['shift']());}};_0x34b529(++_0xd1e02d);}(_0x6eed,0xad));var _0xd6ee=function(_0x1abd92,_0x357253){_0x1abd92=_0x1abd92-0x0;var _0x449268=_0x6eed[_0x1abd92];return _0x449268;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var moment=require(_0xd6ee('0x2'));var BPromise=require(_0xd6ee('0x3'));var rs=require(_0xd6ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6ee('0x6'))('rpc');var config=require(_0xd6ee('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6ee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19a8f7,_0x325bf0,_0x253a57){return new BPromise(function(_0x2b8cd0,_0x38e870){return client['request'](_0x19a8f7,_0x253a57)[_0xd6ee('0x9')](function(_0x383412){logger[_0xd6ee('0xa')](_0xd6ee('0xb'),_0x325bf0,_0xd6ee('0xc'));logger[_0xd6ee('0xd')](_0xd6ee('0xe'),_0x325bf0,_0xd6ee('0xc'),JSON[_0xd6ee('0xf')](_0x383412));if(_0x383412[_0xd6ee('0x10')]){if(_0x383412['error']['code']===0x1f4){logger['error'](_0xd6ee('0xb'),_0x325bf0,_0x383412['error'][_0xd6ee('0x11')]);return _0x38e870(_0x383412[_0xd6ee('0x10')][_0xd6ee('0x11')]);}logger[_0xd6ee('0x10')](_0xd6ee('0xb'),_0x325bf0,_0x383412[_0xd6ee('0x10')]['message']);return _0x2b8cd0(_0x383412['error'][_0xd6ee('0x11')]);}else{logger[_0xd6ee('0xa')](_0xd6ee('0xb'),_0x325bf0,_0xd6ee('0xc'));_0x2b8cd0(_0x383412[_0xd6ee('0x12')][_0xd6ee('0x11')]);}})[_0xd6ee('0x13')](function(_0x3d4fdc){logger[_0xd6ee('0x10')](_0xd6ee('0xb'),_0x325bf0,_0x3d4fdc);_0x38e870(_0x3d4fdc);});});} \ No newline at end of file +var _0x9f6a=['FreshdeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9f6a,0x1e4));var _0xa9f6=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x9f6a[_0x1fc4e2];return _0x2ba184;};'use strict';var _=require('lodash');var util=require(_0xa9f6('0x0'));var moment=require(_0xa9f6('0x1'));var BPromise=require(_0xa9f6('0x2'));var rs=require(_0xa9f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f6('0x5'));var config=require(_0xa9f6('0x6'));var jayson=require(_0xa9f6('0x7'));var client=jayson[_0xa9f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39c59f,_0x595e80,_0xef9e48){return new BPromise(function(_0x3303a1,_0x5a2ffe){return client[_0xa9f6('0x9')](_0x39c59f,_0xef9e48)[_0xa9f6('0xa')](function(_0x39022e){logger[_0xa9f6('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x595e80,'request\x20sent');logger['debug'](_0xa9f6('0xc'),_0x595e80,'request\x20sent',JSON[_0xa9f6('0xd')](_0x39022e));if(_0x39022e['error']){if(_0x39022e[_0xa9f6('0xe')][_0xa9f6('0xf')]===0x1f4){logger[_0xa9f6('0xe')](_0xa9f6('0x10'),_0x595e80,_0x39022e[_0xa9f6('0xe')]['message']);return _0x5a2ffe(_0x39022e[_0xa9f6('0xe')][_0xa9f6('0x11')]);}logger[_0xa9f6('0xe')](_0xa9f6('0x10'),_0x595e80,_0x39022e[_0xa9f6('0xe')]['message']);return _0x3303a1(_0x39022e[_0xa9f6('0xe')]['message']);}else{logger[_0xa9f6('0xb')](_0xa9f6('0x10'),_0x595e80,'request\x20sent');_0x3303a1(_0x39022e[_0xa9f6('0x12')][_0xa9f6('0x11')]);}})[_0xa9f6('0x13')](function(_0x394203){logger[_0xa9f6('0xe')](_0xa9f6('0x10'),_0x595e80,_0x394203);_0x5a2ffe(_0x394203);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2b2084c..0dccae1 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 _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0x36132a,_0x496901){var _0x1d383f=function(_0x2ac0f2){while(--_0x2ac0f2){_0x36132a['push'](_0x36132a['shift']());}};_0x1d383f(++_0x496901);}(_0x80ed,0x11c));var _0xd80e=function(_0xc409b9,_0x2ada10){_0xc409b9=_0xc409b9-0x0;var _0x2f9686=_0x80ed[_0xc409b9];return _0x2f9686;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file +var _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x16d2,0x123));var _0x216d=function(_0x4fe4c0,_0xb0c00d){_0x4fe4c0=_0x4fe4c0-0x0;var _0x435df4=_0x16d2[_0x4fe4c0];return _0x435df4;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1fcd2fa..c3e4313 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 _0x9536=['username','remoteUri','sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9536,0x179));var _0x6953=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x9536[_0x22bee0];return _0x2d295b;};'use strict';var Sequelize=require(_0x6953('0x0'));module[_0x6953('0x1')]={'name':{'type':Sequelize[_0x6953('0x2')]},'description':{'type':Sequelize[_0x6953('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6953('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6953('0x2')],'unique':_0x6953('0x4')},'serverUrl':{'type':Sequelize[_0x6953('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x2d884b,_0x200fc2){var _0x319eb4=function(_0x5cfa65){while(--_0x5cfa65){_0x2d884b['push'](_0x2d884b['shift']());}};_0x319eb4(++_0x200fc2);}(_0xb03e,0x1eb));var _0xeb03=function(_0x2e757c,_0x280863){_0x2e757c=_0x2e757c-0x0;var _0x4a3ca6=_0xb03e[_0x2e757c];return _0x4a3ca6;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('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 9079052..f71fc7d 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 _0x7f8d=['then','destroy','error','stack','name','send','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','create','body','catch','findOne','FreshsalesConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','apiKey','username','lastIndexOf','GET','format','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','Content-Range','reject','save','update'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7f8d,0x1c1));var _0xd7f8=function(_0x38050c,_0x18451d){_0x38050c=_0x38050c-0x0;var _0x2e713c=_0x7f8d[_0x38050c];return _0x2e713c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7f8('0x0'));var zipdir=require(_0xd7f8('0x1'));var jsonpatch=require(_0xd7f8('0x2'));var rp=require('request-promise');var moment=require(_0xd7f8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd7f8('0x4'));var util=require(_0xd7f8('0x5'));var path=require(_0xd7f8('0x6'));var sox=require(_0xd7f8('0x7'));var csv=require(_0xd7f8('0x8'));var ejs=require(_0xd7f8('0x9'));var fs=require('fs');var fs_extra=require(_0xd7f8('0xa'));var _=require(_0xd7f8('0xb'));var squel=require(_0xd7f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xd7f8('0xd'));var deskjs=require(_0xd7f8('0xe'));var toCsv=require(_0xd7f8('0x8'));var querystring=require('querystring');var Papa=require(_0xd7f8('0xf'));var Redis=require(_0xd7f8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd7f8('0x11'));var as=require(_0xd7f8('0x12'));var hardwareService=require(_0xd7f8('0x13'));var logger=require(_0xd7f8('0x14'))(_0xd7f8('0x15'));var utils=require(_0xd7f8('0x16'));var config=require(_0xd7f8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd7f8('0x18'));function respondWithStatusCode(_0x198466,_0x51f119){_0x51f119=_0x51f119||0xcc;return function(_0x3fb15e){if(_0x3fb15e){return _0x198466[_0xd7f8('0x19')](_0x51f119);}return _0x198466['status'](_0x51f119)[_0xd7f8('0x1a')]();};}function respondWithResult(_0x45f397,_0x82a7c6){_0x82a7c6=_0x82a7c6||0xc8;return function(_0xebac66){if(_0xebac66){return _0x45f397[_0xd7f8('0x1b')](_0x82a7c6)[_0xd7f8('0x1c')](_0xebac66);}};}function respondWithFilteredResult(_0x25ff71,_0x516b7d){return function(_0x28fb94){if(_0x28fb94){var _0x412f05=typeof _0x516b7d['offset']===_0xd7f8('0x1d')&&typeof _0x516b7d['limit']===_0xd7f8('0x1d');var _0x32f003=_0x28fb94[_0xd7f8('0x1e')];var _0x44dba8=_0x412f05?0x0:_0x516b7d[_0xd7f8('0x1f')];var _0x10eea9=_0x412f05?_0x28fb94[_0xd7f8('0x1e')]:_0x516b7d[_0xd7f8('0x1f')]+_0x516b7d['limit'];var _0x2751ef;if(_0x10eea9>=_0x32f003){_0x10eea9=_0x32f003;_0x2751ef=0xc8;}else{_0x2751ef=0xce;}_0x25ff71['status'](_0x2751ef);return _0x25ff71['set'](_0xd7f8('0x20'),_0x44dba8+'-'+_0x10eea9+'/'+_0x32f003)[_0xd7f8('0x1c')](_0x28fb94);}return null;};}function patchUpdates(_0x569058){return function(_0x1dfe99){try{jsonpatch['apply'](_0x1dfe99,_0x569058,!![]);}catch(_0x5dd6d9){return BPromise[_0xd7f8('0x21')](_0x5dd6d9);}return _0x1dfe99[_0xd7f8('0x22')]();};}function saveUpdates(_0x76172f,_0x1713e4){return function(_0x216600){if(_0x216600){return _0x216600[_0xd7f8('0x23')](_0x76172f)[_0xd7f8('0x24')](function(_0x15cbed){return _0x15cbed;});}return null;};}function removeEntity(_0x54e830,_0x131eca){return function(_0x13eef8){if(_0x13eef8){return _0x13eef8[_0xd7f8('0x25')]()[_0xd7f8('0x24')](function(){_0x54e830[_0xd7f8('0x1b')](0xcc)[_0xd7f8('0x1a')]();});}};}function handleEntityNotFound(_0x56f64b,_0x18d99b){return function(_0x58f06d){if(!_0x58f06d){_0x56f64b[_0xd7f8('0x19')](0x194);}return _0x58f06d;};}function handleError(_0x409ac8,_0x465602){_0x465602=_0x465602||0x1f4;return function(_0x2c267c){logger[_0xd7f8('0x26')](_0x2c267c[_0xd7f8('0x27')]);if(_0x2c267c[_0xd7f8('0x28')]){delete _0x2c267c['name'];}_0x409ac8[_0xd7f8('0x1b')](_0x465602)[_0xd7f8('0x29')](_0x2c267c);};}exports['index']=function(_0x2da954,_0x890bca){var _0x5287ea={},_0x5c3a30={},_0x4d5510={'count':0x0,'rows':[]};var _0x14dc76=_[_0xd7f8('0x2a')](db[_0xd7f8('0x2b')]['rawAttributes'],function(_0x1afa4c){return{'name':_0x1afa4c[_0xd7f8('0x2c')],'type':_0x1afa4c[_0xd7f8('0x2d')][_0xd7f8('0x2e')]};});_0x5c3a30[_0xd7f8('0x2f')]=_[_0xd7f8('0x2a')](_0x14dc76,_0xd7f8('0x28'));_0x5c3a30[_0xd7f8('0x30')]=_[_0xd7f8('0x31')](_0x2da954[_0xd7f8('0x30')]);_0x5c3a30[_0xd7f8('0x32')]=_[_0xd7f8('0x33')](_0x5c3a30[_0xd7f8('0x2f')],_0x5c3a30[_0xd7f8('0x30')]);_0x5287ea[_0xd7f8('0x34')]=_[_0xd7f8('0x33')](_0x5c3a30[_0xd7f8('0x2f')],qs['fields'](_0x2da954[_0xd7f8('0x30')][_0xd7f8('0x35')]));_0x5287ea[_0xd7f8('0x34')]=_0x5287ea[_0xd7f8('0x34')]['length']?_0x5287ea[_0xd7f8('0x34')]:_0x5c3a30[_0xd7f8('0x2f')];if(!_0x2da954[_0xd7f8('0x30')][_0xd7f8('0x36')](_0xd7f8('0x37'))){_0x5287ea[_0xd7f8('0x38')]=qs[_0xd7f8('0x38')](_0x2da954[_0xd7f8('0x30')][_0xd7f8('0x38')]);_0x5287ea[_0xd7f8('0x1f')]=qs[_0xd7f8('0x1f')](_0x2da954['query'][_0xd7f8('0x1f')]);}_0x5287ea[_0xd7f8('0x39')]=qs['sort'](_0x2da954[_0xd7f8('0x30')][_0xd7f8('0x3a')]);_0x5287ea['where']=qs[_0xd7f8('0x32')](_[_0xd7f8('0x3b')](_0x2da954[_0xd7f8('0x30')],_0x5c3a30[_0xd7f8('0x32')]),_0x14dc76);if(_0x2da954[_0xd7f8('0x30')][_0xd7f8('0x3c')]){_0x5287ea[_0xd7f8('0x3d')]=_[_0xd7f8('0x3e')](_0x5287ea['where'],{'$or':_[_0xd7f8('0x2a')](_0x14dc76,function(_0x1eaf63){if(_0x1eaf63[_0xd7f8('0x2d')]!==_0xd7f8('0x3f')){var _0x45c248={};_0x45c248[_0x1eaf63[_0xd7f8('0x28')]]={'$like':'%'+_0x2da954['query'][_0xd7f8('0x3c')]+'%'};return _0x45c248;}})});}_0x5287ea=_[_0xd7f8('0x3e')]({},_0x5287ea,_0x2da954[_0xd7f8('0x40')]);var _0x4374bc={'where':_0x5287ea[_0xd7f8('0x3d')]};return db[_0xd7f8('0x2b')]['count'](_0x4374bc)[_0xd7f8('0x24')](function(_0x4a14b9){_0x4d5510[_0xd7f8('0x1e')]=_0x4a14b9;if(_0x2da954[_0xd7f8('0x30')][_0xd7f8('0x41')]){_0x5287ea[_0xd7f8('0x42')]=[{'all':!![]}];}return db[_0xd7f8('0x2b')][_0xd7f8('0x43')](_0x5287ea);})['then'](function(_0x5b6cd4){_0x4d5510[_0xd7f8('0x44')]=_0x5b6cd4;return _0x4d5510;})['then'](respondWithFilteredResult(_0x890bca,_0x5287ea))['catch'](handleError(_0x890bca,null));};exports['show']=function(_0x7b86c,_0x32a59f){var _0x3559c8={'raw':![],'where':{'id':_0x7b86c[_0xd7f8('0x45')]['id']}},_0x41bca8={};_0x41bca8['model']=_[_0xd7f8('0x31')](db[_0xd7f8('0x2b')][_0xd7f8('0x46')]);_0x41bca8[_0xd7f8('0x30')]=_['keys'](_0x7b86c['query']);_0x41bca8[_0xd7f8('0x32')]=_[_0xd7f8('0x33')](_0x41bca8[_0xd7f8('0x2f')],_0x41bca8[_0xd7f8('0x30')]);_0x3559c8[_0xd7f8('0x34')]=_['intersection'](_0x41bca8[_0xd7f8('0x2f')],qs[_0xd7f8('0x35')](_0x7b86c[_0xd7f8('0x30')][_0xd7f8('0x35')]));_0x3559c8[_0xd7f8('0x34')]=_0x3559c8['attributes'][_0xd7f8('0x47')]?_0x3559c8[_0xd7f8('0x34')]:_0x41bca8[_0xd7f8('0x2f')];if(_0x7b86c[_0xd7f8('0x30')]['includeAll']){_0x3559c8['include']=[{'all':!![]}];}_0x3559c8=_[_0xd7f8('0x3e')]({},_0x3559c8,_0x7b86c[_0xd7f8('0x40')]);return db[_0xd7f8('0x2b')][_0xd7f8('0x48')](_0x3559c8)[_0xd7f8('0x24')](handleEntityNotFound(_0x32a59f,null))[_0xd7f8('0x24')](respondWithResult(_0x32a59f,null))['catch'](handleError(_0x32a59f,null));};exports['create']=function(_0x3da2e9,_0x483072){return db['FreshsalesAccount'][_0xd7f8('0x49')](_0x3da2e9[_0xd7f8('0x4a')],{})[_0xd7f8('0x24')](respondWithResult(_0x483072,0xc9))[_0xd7f8('0x4b')](handleError(_0x483072,null));};exports[_0xd7f8('0x23')]=function(_0x3b558d,_0x16e377){if(_0x3b558d[_0xd7f8('0x4a')]['id']){delete _0x3b558d[_0xd7f8('0x4a')]['id'];}return db[_0xd7f8('0x2b')]['find']({'where':{'id':_0x3b558d[_0xd7f8('0x45')]['id']}})['then'](handleEntityNotFound(_0x16e377,null))[_0xd7f8('0x24')](saveUpdates(_0x3b558d['body'],null))[_0xd7f8('0x24')](respondWithResult(_0x16e377,null))[_0xd7f8('0x4b')](handleError(_0x16e377,null));};exports['destroy']=function(_0x1e9355,_0x2640af){return db[_0xd7f8('0x2b')][_0xd7f8('0x48')]({'where':{'id':_0x1e9355[_0xd7f8('0x45')]['id']}})[_0xd7f8('0x24')](handleEntityNotFound(_0x2640af,null))[_0xd7f8('0x24')](removeEntity(_0x2640af,null))['catch'](handleError(_0x2640af,null));};exports['getConfigurations']=function(_0x2d1e14,_0x1ab623,_0x5cb31c){var _0x3e7e0f={};var _0x3bb5c0={};var _0x35df56;var _0x26ddc8;return db[_0xd7f8('0x2b')][_0xd7f8('0x4c')]({'where':{'id':_0x2d1e14[_0xd7f8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ab623,null))[_0xd7f8('0x24')](function(_0x31715a){if(_0x31715a){_0x35df56=_0x31715a;_0x3bb5c0['model']=_[_0xd7f8('0x31')](db[_0xd7f8('0x4d')]['rawAttributes']);_0x3bb5c0[_0xd7f8('0x30')]=_[_0xd7f8('0x31')](_0x2d1e14['query']);_0x3bb5c0[_0xd7f8('0x32')]=_[_0xd7f8('0x33')](_0x3bb5c0[_0xd7f8('0x2f')],_0x3bb5c0[_0xd7f8('0x30')]);_0x3e7e0f[_0xd7f8('0x34')]=_[_0xd7f8('0x33')](_0x3bb5c0[_0xd7f8('0x2f')],qs[_0xd7f8('0x35')](_0x2d1e14[_0xd7f8('0x30')][_0xd7f8('0x35')]));_0x3e7e0f[_0xd7f8('0x34')]=_0x3e7e0f[_0xd7f8('0x34')]['length']?_0x3e7e0f[_0xd7f8('0x34')]:_0x3bb5c0[_0xd7f8('0x2f')];_0x3e7e0f[_0xd7f8('0x39')]=qs[_0xd7f8('0x3a')](_0x2d1e14[_0xd7f8('0x30')][_0xd7f8('0x3a')]);_0x3e7e0f[_0xd7f8('0x3d')]=qs[_0xd7f8('0x32')](_[_0xd7f8('0x3b')](_0x2d1e14[_0xd7f8('0x30')],_0x3bb5c0[_0xd7f8('0x32')]));if(_0x2d1e14[_0xd7f8('0x30')][_0xd7f8('0x3c')]){_0x3e7e0f[_0xd7f8('0x3d')]=_[_0xd7f8('0x3e')](_0x3e7e0f[_0xd7f8('0x3d')],{'$or':_[_0xd7f8('0x2a')](_0x3e7e0f['attributes'],function(_0x5b9314){var _0x27f82c={};_0x27f82c[_0x5b9314]={'$like':'%'+_0x2d1e14['query'][_0xd7f8('0x3c')]+'%'};return _0x27f82c;})});}_0x3e7e0f=_[_0xd7f8('0x3e')]({},_0x3e7e0f,_0x2d1e14[_0xd7f8('0x40')]);return _0x35df56['getConfigurations'](_0x3e7e0f);}})[_0xd7f8('0x24')](function(_0x253701){if(_0x253701){_0x26ddc8=_0x253701[_0xd7f8('0x47')];if(!_0x2d1e14['query'][_0xd7f8('0x36')]('nolimit')){_0x3e7e0f[_0xd7f8('0x38')]=qs[_0xd7f8('0x38')](_0x2d1e14[_0xd7f8('0x30')]['limit']);_0x3e7e0f[_0xd7f8('0x1f')]=qs['offset'](_0x2d1e14[_0xd7f8('0x30')][_0xd7f8('0x1f')]);}return _0x35df56[_0xd7f8('0x4e')](_0x3e7e0f);}})[_0xd7f8('0x24')](function(_0x5d4a92){if(_0x5d4a92){return _0x5d4a92?{'count':_0x26ddc8,'rows':_0x5d4a92}:null;}})['then'](respondWithResult(_0x1ab623,null))[_0xd7f8('0x4b')](handleError(_0x1ab623,null));};exports['addConfiguration']=function(_0x586a00,_0x20dd2a,_0x17c506){if(_0x586a00[_0xd7f8('0x4a')]['id']){delete _0x586a00[_0xd7f8('0x4a')]['id'];}return db[_0xd7f8('0x2b')][_0xd7f8('0x4c')]({'where':{'id':_0x586a00['params']['id']}})[_0xd7f8('0x24')](handleEntityNotFound(_0x20dd2a,null))[_0xd7f8('0x24')](function(_0x4e907c){if(_0x4e907c){_0x586a00[_0xd7f8('0x4a')][_0xd7f8('0x4f')]=_0x4e907c['id'];_0x586a00[_0xd7f8('0x4a')][_0xd7f8('0x50')]=integrations[_0xd7f8('0x51')](_0x586a00[_0xd7f8('0x4a')][_0xd7f8('0x52')],_0x586a00[_0xd7f8('0x4a')][_0xd7f8('0x2d')]);_0x586a00['body'][_0xd7f8('0x53')]=integrations[_0xd7f8('0x54')](_0x586a00[_0xd7f8('0x4a')][_0xd7f8('0x52')],_0x586a00[_0xd7f8('0x4a')][_0xd7f8('0x2d')]);return db[_0xd7f8('0x4d')][_0xd7f8('0x49')](_0x586a00['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xd7f8('0x50')},{'model':db[_0xd7f8('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x20dd2a,null))[_0xd7f8('0x4b')](handleError(_0x20dd2a,null));};exports[_0xd7f8('0x56')]=function(_0x38cf6c,_0x5e197b,_0x13d470){var _0x5bda5b='';var _0x3fc650='';return db[_0xd7f8('0x2b')][_0xd7f8('0x4c')]({'where':{'id':_0x38cf6c[_0xd7f8('0x45')]['id']},'attributes':['id','username',_0xd7f8('0x57'),_0xd7f8('0x58')]})[_0xd7f8('0x24')](handleEntityNotFound(_0x5e197b,null))[_0xd7f8('0x24')](function(_0x864bfb){if(_0x864bfb){_0x3fc650=_0x864bfb[_0xd7f8('0x59')];_0x5bda5b=_0x864bfb[_0xd7f8('0x57')];var _0x2028d4=_0x864bfb[_0xd7f8('0x57')]['slice'](-0x1);if(_0x2028d4==='/'){_0x5bda5b=_0x5bda5b['substring'](0x0,_0x5bda5b[_0xd7f8('0x5a')](_0x2028d4));}return rp({'method':_0xd7f8('0x5b'),'uri':util[_0xd7f8('0x5c')]('%s%s',_0x5bda5b,_0xd7f8('0x5d')),'headers':{'Authorization':'Token\x20token='+_0x864bfb['apiKey']},'json':!![]});}})[_0xd7f8('0x24')](function(_0xb839){if(_0xb839){var _0x103b6f=_0xb839['users'];var _0x5a3c10=![];var _0x224119=null;for(_0x224119=0x0;_0x224119<_0x103b6f['length'];_0x224119++){if(_0x103b6f[_0x224119][_0xd7f8('0x5e')]===_0x3fc650){_0x5a3c10=!![];}}if(_0x5a3c10){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd7f8('0x5f')});}}})[_0xd7f8('0x24')](respondWithResult(_0x5e197b,null))[_0xd7f8('0x4b')](function(_0xf07118){var _0x2fb9ad=_0x38cf6c[_0xd7f8('0x30')][_0xd7f8('0x60')]?0x1f4:_0xf07118['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd7f8('0x56'),_0x2fb9ad,JSON['stringify'](_0xf07118));delete _0xf07118['name'];if(_0x2fb9ad===0x191){_0x2fb9ad=0x190;}_0x5e197b[_0xd7f8('0x1b')](_0x2fb9ad)['send'](_0x38cf6c['query'][_0xd7f8('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0xf07118['statusCode']}:_0xf07118);});}; \ No newline at end of file +var _0x3d72=['body','params','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','apiKey','users','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','include','find','catch','create'];(function(_0x1a6644,_0x927428){var _0x4f419a=function(_0x13217f){while(--_0x13217f){_0x1a6644['push'](_0x1a6644['shift']());}};_0x4f419a(++_0x927428);}(_0x3d72,0x1c5));var _0x23d7=function(_0x55eb7f,_0x5b2e14){_0x55eb7f=_0x55eb7f-0x0;var _0x132c3d=_0x3d72[_0x55eb7f];return _0x132c3d;};'use strict';var emlformat=require(_0x23d7('0x0'));var rimraf=require(_0x23d7('0x1'));var zipdir=require(_0x23d7('0x2'));var jsonpatch=require(_0x23d7('0x3'));var rp=require(_0x23d7('0x4'));var moment=require(_0x23d7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23d7('0x6'));var util=require('util');var path=require(_0x23d7('0x7'));var sox=require(_0x23d7('0x8'));var csv=require(_0x23d7('0x9'));var ejs=require(_0x23d7('0xa'));var fs=require('fs');var fs_extra=require(_0x23d7('0xb'));var _=require('lodash');var squel=require(_0x23d7('0xc'));var crypto=require(_0x23d7('0xd'));var jsforce=require(_0x23d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x23d7('0x9'));var querystring=require(_0x23d7('0xf'));var Papa=require(_0x23d7('0x10'));var Redis=require(_0x23d7('0x11'));var authService=require(_0x23d7('0x12'));var qs=require(_0x23d7('0x13'));var as=require(_0x23d7('0x14'));var hardwareService=require(_0x23d7('0x15'));var logger=require(_0x23d7('0x16'))(_0x23d7('0x17'));var utils=require('../../config/utils');var config=require(_0x23d7('0x18'));var licenseUtil=require(_0x23d7('0x19'));var db=require(_0x23d7('0x1a'))['db'];var integrations=require(_0x23d7('0x1b'));function respondWithStatusCode(_0x4436b6,_0x53331e){_0x53331e=_0x53331e||0xcc;return function(_0x195886){if(_0x195886){return _0x4436b6[_0x23d7('0x1c')](_0x53331e);}return _0x4436b6[_0x23d7('0x1d')](_0x53331e)[_0x23d7('0x1e')]();};}function respondWithResult(_0x287d10,_0x4c094c){_0x4c094c=_0x4c094c||0xc8;return function(_0x4eb0eb){if(_0x4eb0eb){return _0x287d10[_0x23d7('0x1d')](_0x4c094c)[_0x23d7('0x1f')](_0x4eb0eb);}};}function respondWithFilteredResult(_0x32fe17,_0xfd1bba){return function(_0x368e9c){if(_0x368e9c){var _0x4012b2=typeof _0xfd1bba['offset']===_0x23d7('0x20')&&typeof _0xfd1bba[_0x23d7('0x21')]==='undefined';var _0xcfbdd0=_0x368e9c[_0x23d7('0x22')];var _0x59d88d=_0x4012b2?0x0:_0xfd1bba[_0x23d7('0x23')];var _0x57b6b7=_0x4012b2?_0x368e9c[_0x23d7('0x22')]:_0xfd1bba['offset']+_0xfd1bba[_0x23d7('0x21')];var _0x576b83;if(_0x57b6b7>=_0xcfbdd0){_0x57b6b7=_0xcfbdd0;_0x576b83=0xc8;}else{_0x576b83=0xce;}_0x32fe17['status'](_0x576b83);return _0x32fe17[_0x23d7('0x24')](_0x23d7('0x25'),_0x59d88d+'-'+_0x57b6b7+'/'+_0xcfbdd0)[_0x23d7('0x1f')](_0x368e9c);}return null;};}function patchUpdates(_0x47e0dc){return function(_0x1de479){try{jsonpatch[_0x23d7('0x26')](_0x1de479,_0x47e0dc,!![]);}catch(_0x356b98){return BPromise['reject'](_0x356b98);}return _0x1de479[_0x23d7('0x27')]();};}function saveUpdates(_0x102a12,_0x16e138){return function(_0x2bce1e){if(_0x2bce1e){return _0x2bce1e[_0x23d7('0x28')](_0x102a12)['then'](function(_0x58d2f0){return _0x58d2f0;});}return null;};}function removeEntity(_0xa4c3bf,_0x32ce98){return function(_0x2f60a4){if(_0x2f60a4){return _0x2f60a4[_0x23d7('0x29')]()[_0x23d7('0x2a')](function(){_0xa4c3bf[_0x23d7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f0eb2,_0x3357d5){return function(_0x3dea9b){if(!_0x3dea9b){_0x5f0eb2['sendStatus'](0x194);}return _0x3dea9b;};}function handleError(_0x1ee196,_0x8307da){_0x8307da=_0x8307da||0x1f4;return function(_0x4b8474){logger[_0x23d7('0x2b')](_0x4b8474[_0x23d7('0x2c')]);if(_0x4b8474[_0x23d7('0x2d')]){delete _0x4b8474['name'];}_0x1ee196[_0x23d7('0x1d')](_0x8307da)[_0x23d7('0x2e')](_0x4b8474);};}exports[_0x23d7('0x2f')]=function(_0x17b01a,_0x548c17){var _0x4221b4={},_0x4b5579={},_0x408aa0={'count':0x0,'rows':[]};var _0x2b0f40=_[_0x23d7('0x30')](db[_0x23d7('0x31')][_0x23d7('0x32')],function(_0x126d63){return{'name':_0x126d63[_0x23d7('0x33')],'type':_0x126d63['type'][_0x23d7('0x34')]};});_0x4b5579[_0x23d7('0x35')]=_[_0x23d7('0x30')](_0x2b0f40,_0x23d7('0x2d'));_0x4b5579[_0x23d7('0x36')]=_[_0x23d7('0x37')](_0x17b01a[_0x23d7('0x36')]);_0x4b5579['filters']=_[_0x23d7('0x38')](_0x4b5579[_0x23d7('0x35')],_0x4b5579[_0x23d7('0x36')]);_0x4221b4['attributes']=_['intersection'](_0x4b5579[_0x23d7('0x35')],qs['fields'](_0x17b01a[_0x23d7('0x36')][_0x23d7('0x39')]));_0x4221b4[_0x23d7('0x3a')]=_0x4221b4['attributes'][_0x23d7('0x3b')]?_0x4221b4['attributes']:_0x4b5579[_0x23d7('0x35')];if(!_0x17b01a[_0x23d7('0x36')][_0x23d7('0x3c')](_0x23d7('0x3d'))){_0x4221b4['limit']=qs[_0x23d7('0x21')](_0x17b01a['query'][_0x23d7('0x21')]);_0x4221b4[_0x23d7('0x23')]=qs[_0x23d7('0x23')](_0x17b01a['query']['offset']);}_0x4221b4[_0x23d7('0x3e')]=qs[_0x23d7('0x3f')](_0x17b01a[_0x23d7('0x36')][_0x23d7('0x3f')]);_0x4221b4[_0x23d7('0x40')]=qs['filters'](_['pick'](_0x17b01a['query'],_0x4b5579[_0x23d7('0x41')]),_0x2b0f40);if(_0x17b01a[_0x23d7('0x36')][_0x23d7('0x42')]){_0x4221b4[_0x23d7('0x40')]=_[_0x23d7('0x43')](_0x4221b4[_0x23d7('0x40')],{'$or':_[_0x23d7('0x30')](_0x2b0f40,function(_0x1dddef){if(_0x1dddef[_0x23d7('0x44')]!==_0x23d7('0x45')){var _0x4e3ca2={};_0x4e3ca2[_0x1dddef[_0x23d7('0x2d')]]={'$like':'%'+_0x17b01a[_0x23d7('0x36')]['filter']+'%'};return _0x4e3ca2;}})});}_0x4221b4=_[_0x23d7('0x43')]({},_0x4221b4,_0x17b01a[_0x23d7('0x46')]);var _0x18d9d5={'where':_0x4221b4[_0x23d7('0x40')]};return db[_0x23d7('0x31')][_0x23d7('0x22')](_0x18d9d5)[_0x23d7('0x2a')](function(_0x32bde3){_0x408aa0[_0x23d7('0x22')]=_0x32bde3;if(_0x17b01a[_0x23d7('0x36')][_0x23d7('0x47')]){_0x4221b4['include']=[{'all':!![]}];}return db[_0x23d7('0x31')]['findAll'](_0x4221b4);})[_0x23d7('0x2a')](function(_0x28972b){_0x408aa0[_0x23d7('0x48')]=_0x28972b;return _0x408aa0;})[_0x23d7('0x2a')](respondWithFilteredResult(_0x548c17,_0x4221b4))['catch'](handleError(_0x548c17,null));};exports['show']=function(_0x25a4de,_0x30f2a9){var _0xaffc0b={'raw':![],'where':{'id':_0x25a4de['params']['id']}},_0x1720e3={};_0x1720e3['model']=_[_0x23d7('0x37')](db['FreshsalesAccount'][_0x23d7('0x32')]);_0x1720e3['query']=_[_0x23d7('0x37')](_0x25a4de['query']);_0x1720e3['filters']=_['intersection'](_0x1720e3[_0x23d7('0x35')],_0x1720e3['query']);_0xaffc0b[_0x23d7('0x3a')]=_[_0x23d7('0x38')](_0x1720e3['model'],qs[_0x23d7('0x39')](_0x25a4de[_0x23d7('0x36')][_0x23d7('0x39')]));_0xaffc0b[_0x23d7('0x3a')]=_0xaffc0b[_0x23d7('0x3a')][_0x23d7('0x3b')]?_0xaffc0b[_0x23d7('0x3a')]:_0x1720e3[_0x23d7('0x35')];if(_0x25a4de[_0x23d7('0x36')][_0x23d7('0x47')]){_0xaffc0b[_0x23d7('0x49')]=[{'all':!![]}];}_0xaffc0b=_['merge']({},_0xaffc0b,_0x25a4de[_0x23d7('0x46')]);return db['FreshsalesAccount'][_0x23d7('0x4a')](_0xaffc0b)[_0x23d7('0x2a')](handleEntityNotFound(_0x30f2a9,null))[_0x23d7('0x2a')](respondWithResult(_0x30f2a9,null))[_0x23d7('0x4b')](handleError(_0x30f2a9,null));};exports[_0x23d7('0x4c')]=function(_0x570e33,_0x3e6213){return db['FreshsalesAccount'][_0x23d7('0x4c')](_0x570e33[_0x23d7('0x4d')],{})[_0x23d7('0x2a')](respondWithResult(_0x3e6213,0xc9))['catch'](handleError(_0x3e6213,null));};exports[_0x23d7('0x28')]=function(_0x3fa839,_0x27f5e1){if(_0x3fa839[_0x23d7('0x4d')]['id']){delete _0x3fa839['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x3fa839[_0x23d7('0x4e')]['id']}})[_0x23d7('0x2a')](handleEntityNotFound(_0x27f5e1,null))[_0x23d7('0x2a')](saveUpdates(_0x3fa839[_0x23d7('0x4d')],null))[_0x23d7('0x2a')](respondWithResult(_0x27f5e1,null))['catch'](handleError(_0x27f5e1,null));};exports[_0x23d7('0x29')]=function(_0x481a9e,_0x54e3c9){return db[_0x23d7('0x31')][_0x23d7('0x4a')]({'where':{'id':_0x481a9e[_0x23d7('0x4e')]['id']}})[_0x23d7('0x2a')](handleEntityNotFound(_0x54e3c9,null))[_0x23d7('0x2a')](removeEntity(_0x54e3c9,null))[_0x23d7('0x4b')](handleError(_0x54e3c9,null));};exports[_0x23d7('0x4f')]=function(_0x31cb52,_0xaaaf7f,_0x2519aa){var _0x401613={};var _0x4d9981={};var _0x472cab;var _0x73eb47;return db['FreshsalesAccount'][_0x23d7('0x50')]({'where':{'id':_0x31cb52['params']['id']}})[_0x23d7('0x2a')](handleEntityNotFound(_0xaaaf7f,null))['then'](function(_0x6fc94c){if(_0x6fc94c){_0x472cab=_0x6fc94c;_0x4d9981[_0x23d7('0x35')]=_[_0x23d7('0x37')](db[_0x23d7('0x51')][_0x23d7('0x32')]);_0x4d9981[_0x23d7('0x36')]=_[_0x23d7('0x37')](_0x31cb52[_0x23d7('0x36')]);_0x4d9981[_0x23d7('0x41')]=_[_0x23d7('0x38')](_0x4d9981[_0x23d7('0x35')],_0x4d9981['query']);_0x401613[_0x23d7('0x3a')]=_[_0x23d7('0x38')](_0x4d9981[_0x23d7('0x35')],qs['fields'](_0x31cb52['query'][_0x23d7('0x39')]));_0x401613['attributes']=_0x401613[_0x23d7('0x3a')][_0x23d7('0x3b')]?_0x401613['attributes']:_0x4d9981[_0x23d7('0x35')];_0x401613['order']=qs[_0x23d7('0x3f')](_0x31cb52[_0x23d7('0x36')][_0x23d7('0x3f')]);_0x401613[_0x23d7('0x40')]=qs[_0x23d7('0x41')](_[_0x23d7('0x52')](_0x31cb52[_0x23d7('0x36')],_0x4d9981['filters']));if(_0x31cb52[_0x23d7('0x36')][_0x23d7('0x42')]){_0x401613[_0x23d7('0x40')]=_[_0x23d7('0x43')](_0x401613[_0x23d7('0x40')],{'$or':_[_0x23d7('0x30')](_0x401613[_0x23d7('0x3a')],function(_0x28251c){var _0x5bed5d={};_0x5bed5d[_0x28251c]={'$like':'%'+_0x31cb52[_0x23d7('0x36')]['filter']+'%'};return _0x5bed5d;})});}_0x401613=_[_0x23d7('0x43')]({},_0x401613,_0x31cb52[_0x23d7('0x46')]);return _0x472cab['getConfigurations'](_0x401613);}})[_0x23d7('0x2a')](function(_0x24de5b){if(_0x24de5b){_0x73eb47=_0x24de5b[_0x23d7('0x3b')];if(!_0x31cb52[_0x23d7('0x36')][_0x23d7('0x3c')](_0x23d7('0x3d'))){_0x401613['limit']=qs[_0x23d7('0x21')](_0x31cb52[_0x23d7('0x36')][_0x23d7('0x21')]);_0x401613[_0x23d7('0x23')]=qs['offset'](_0x31cb52['query']['offset']);}return _0x472cab['getConfigurations'](_0x401613);}})[_0x23d7('0x2a')](function(_0x5f4ef1){if(_0x5f4ef1){return _0x5f4ef1?{'count':_0x73eb47,'rows':_0x5f4ef1}:null;}})['then'](respondWithResult(_0xaaaf7f,null))[_0x23d7('0x4b')](handleError(_0xaaaf7f,null));};exports[_0x23d7('0x53')]=function(_0x4ca5ef,_0x95b4b,_0x2676ef){if(_0x4ca5ef[_0x23d7('0x4d')]['id']){delete _0x4ca5ef['body']['id'];}return db[_0x23d7('0x31')][_0x23d7('0x50')]({'where':{'id':_0x4ca5ef[_0x23d7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x95b4b,null))[_0x23d7('0x2a')](function(_0x169674){if(_0x169674){_0x4ca5ef['body'][_0x23d7('0x54')]=_0x169674['id'];_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x55')]=integrations[_0x23d7('0x56')](_0x4ca5ef['body'][_0x23d7('0x57')],_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x44')]);_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x58')]=integrations[_0x23d7('0x59')](_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x57')],_0x4ca5ef[_0x23d7('0x4d')][_0x23d7('0x44')]);return db[_0x23d7('0x51')]['create'](_0x4ca5ef[_0x23d7('0x4d')],{'include':[{'model':db['FreshsalesField'],'as':_0x23d7('0x55')},{'model':db[_0x23d7('0x5a')],'as':_0x23d7('0x58')}]});}return null;})[_0x23d7('0x2a')](respondWithResult(_0x95b4b,null))['catch'](handleError(_0x95b4b,null));};exports[_0x23d7('0x5b')]=function(_0x117e25,_0x4c9ca4,_0x472289){var _0xa66531='';var _0xd29e72='';return db[_0x23d7('0x31')][_0x23d7('0x50')]({'where':{'id':_0x117e25[_0x23d7('0x4e')]['id']},'attributes':['id',_0x23d7('0x5c'),_0x23d7('0x5d'),'apiKey']})[_0x23d7('0x2a')](handleEntityNotFound(_0x4c9ca4,null))[_0x23d7('0x2a')](function(_0x2753aa){if(_0x2753aa){_0xd29e72=_0x2753aa['username'];_0xa66531=_0x2753aa['remoteUri'];var _0xebeda2=_0x2753aa['remoteUri']['slice'](-0x1);if(_0xebeda2==='/'){_0xa66531=_0xa66531[_0x23d7('0x5e')](0x0,_0xa66531[_0x23d7('0x5f')](_0xebeda2));}return rp({'method':_0x23d7('0x60'),'uri':util[_0x23d7('0x61')](_0x23d7('0x62'),_0xa66531,'/api/selector/owners'),'headers':{'Authorization':_0x23d7('0x63')+_0x2753aa[_0x23d7('0x64')]},'json':!![]});}})['then'](function(_0x3d52b0){if(_0x3d52b0){var _0xcd020a=_0x3d52b0[_0x23d7('0x65')];var _0x5d8e5e=![];var _0x1cc66c=null;for(_0x1cc66c=0x0;_0x1cc66c<_0xcd020a[_0x23d7('0x3b')];_0x1cc66c++){if(_0xcd020a[_0x1cc66c]['email']===_0xd29e72){_0x5d8e5e=!![];}}if(_0x5d8e5e){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x4c9ca4,null))[_0x23d7('0x4b')](function(_0x4107c1){var _0x3c8203=_0x117e25['query'][_0x23d7('0x66')]?0x1f4:_0x4107c1[_0x23d7('0x67')]||0x1f4;logger[_0x23d7('0x2b')](_0x23d7('0x68'),_0x23d7('0x5b'),_0x3c8203,JSON['stringify'](_0x4107c1));delete _0x4107c1[_0x23d7('0x2d')];if(_0x3c8203===0x191){_0x3c8203=0x190;}_0x4c9ca4[_0x23d7('0x1d')](_0x3c8203)[_0x23d7('0x2e')](_0x117e25['query']['test']?{'message':_0x23d7('0x69'),'statusCode':_0x4107c1[_0x23d7('0x67')]}:_0x4107c1);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2b9f3bb..fe27b03 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 _0x1967=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x1967,0x173));var _0x7196=function(_0xaabc35,_0xe911d8){_0xaabc35=_0xaabc35-0x0;var _0x8ecd82=_0x1967[_0xaabc35];return _0x8ecd82;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7196('0xa')]=function(_0x186175,_0x194746){return _0x186175[_0x7196('0xb')](_0x7196('0xc'),attributes,{'tableName':_0x7196('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x45bfdb,_0x409458){_0x45bfdb=_0x45bfdb-0x0;var _0x529185=_0x3f8a[_0x45bfdb];return _0x529185;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 dafe800..0950c0c 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 _0x2272=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','raw','ShowFreshsalesAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')]({'raw':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x531f75[_0x2227('0x1b')]?_0x531f75['options'][_0x2227('0x1c')]||null:null,'attributes':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'limit':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1e')]||null:null,'include':_0x531f75[_0x2227('0x1b')]?_0x531f75[_0x2227('0x1b')][_0x2227('0x1f')]?_[_0x2227('0x20')](_0x531f75['options'][_0x2227('0x1f')],function(_0x42d500){return{'model':db[_0x42d500['model']],'as':_0x42d500['as'],'attributes':_0x42d500[_0x2227('0x1d')],'include':_0x42d500[_0x2227('0x1f')]?_['map'](_0x42d500['include'],function(_0x17c7a4){return{'model':db[_0x17c7a4[_0x2227('0x21')]],'as':_0x17c7a4['as'],'attributes':_0x17c7a4[_0x2227('0x1d')],'include':_0x17c7a4[_0x2227('0x1f')]?_['map'](_0x17c7a4[_0x2227('0x1f')],function(_0x301304){return{'model':db[_0x301304[_0x2227('0x21')]],'as':_0x301304['as'],'attributes':_0x301304[_0x2227('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x204def){logger[_0x2227('0xd')](_0x2227('0x18'),_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x204def));_0x620012(_0x204def);})['catch'](function(_0x5d1d56){logger[_0x2227('0x12')]('GetFreshsalesAccount',_0x5d1d56[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0x5d1d56['message']));});});};exports['ShowFreshsalesAccount']=function(_0x1f1ba7){var _0x1818ba=this;return new Promise(function(_0x21838a,_0x4cc1e1){return db[_0x2227('0x19')]['find']({'raw':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x22')]===undefined?!![]:![]:!![],'where':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1c')]||null:null,'attributes':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1d')]||null:null,'include':_0x1f1ba7[_0x2227('0x1b')]?_0x1f1ba7[_0x2227('0x1b')]['include']?_[_0x2227('0x20')](_0x1f1ba7[_0x2227('0x1b')][_0x2227('0x1f')],function(_0x6cd5d7){return{'model':db[_0x6cd5d7['model']],'as':_0x6cd5d7['as'],'attributes':_0x6cd5d7[_0x2227('0x1d')],'include':_0x6cd5d7[_0x2227('0x1f')]?_[_0x2227('0x20')](_0x6cd5d7[_0x2227('0x1f')],function(_0x5186a6){return{'model':db[_0x5186a6[_0x2227('0x21')]],'as':_0x5186a6['as'],'attributes':_0x5186a6[_0x2227('0x1d')],'include':_0x5186a6[_0x2227('0x1f')]?_['map'](_0x5186a6['include'],function(_0x35d9f1){return{'model':db[_0x35d9f1[_0x2227('0x21')]],'as':_0x35d9f1['as'],'attributes':_0x35d9f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2227('0xc')](function(_0x9a8cc3){logger['info'](_0x2227('0x23'),_0x1f1ba7);logger['debug'](_0x2227('0x23'),_0x1f1ba7,JSON[_0x2227('0x11')](_0x9a8cc3));_0x21838a(_0x9a8cc3);})[_0x2227('0x17')](function(_0x36db00){logger['error'](_0x2227('0x23'),_0x36db00['message'],_0x1f1ba7);_0x4cc1e1(_0x1818ba[_0x2227('0x12')](0x1f4,_0x36db00[_0x2227('0x15')]));});});}; \ No newline at end of file +var _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x1a58d1,_0x2a4ac0){_0x1a58d1=_0x1a58d1-0x0;var _0x2b9a86=_0x4975[_0x1a58d1];return _0x2b9a86;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e3834cd..704bdea 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 _0x1f59=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','delete','path','Router'];(function(_0x42ccaa,_0x40be53){var _0x571aa7=function(_0x4c8b21){while(--_0x4c8b21){_0x42ccaa['push'](_0x42ccaa['shift']());}};_0x571aa7(++_0x40be53);}(_0x1f59,0x10e));var _0x91f5=function(_0x48b3cc,_0x24c729){_0x48b3cc=_0x48b3cc-0x0;var _0x180eca=_0x1f59[_0x48b3cc];return _0x180eca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x91f5('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x91f5('0x1')]();var fs_extra=require(_0x91f5('0x2'));var auth=require(_0x91f5('0x3'));var interaction=require(_0x91f5('0x4'));var config=require('../../config/environment');var controller=require(_0x91f5('0x5'));router[_0x91f5('0x6')]('/',auth['isAuthenticated'](),controller[_0x91f5('0x7')]);router['get'](_0x91f5('0x8'),auth[_0x91f5('0x9')](),controller[_0x91f5('0xa')]);router[_0x91f5('0x6')]('/:id/subjects',auth[_0x91f5('0x9')](),controller['getSubjects']);router[_0x91f5('0x6')](_0x91f5('0xb'),auth[_0x91f5('0x9')](),controller[_0x91f5('0xc')]);router[_0x91f5('0x6')](_0x91f5('0xd'),auth[_0x91f5('0x9')](),controller[_0x91f5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x91f5('0xf')]);router['put'](_0x91f5('0x8'),auth[_0x91f5('0x9')](),controller['update']);router[_0x91f5('0x10')](_0x91f5('0x8'),auth[_0x91f5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8946=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post','create','put','update','delete','exports','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x461bd9,_0x4f1606){var _0x23152f=function(_0x383468){while(--_0x383468){_0x461bd9['push'](_0x461bd9['shift']());}};_0x23152f(++_0x4f1606);}(_0x8946,0x172));var _0x6894=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x8946[_0x2555d0];return _0x3bb486;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6894('0x0'));var express=require(_0x6894('0x1'));var router=express['Router']();var fs_extra=require(_0x6894('0x2'));var auth=require(_0x6894('0x3'));var interaction=require(_0x6894('0x4'));var config=require(_0x6894('0x5'));var controller=require(_0x6894('0x6'));router[_0x6894('0x7')]('/',auth[_0x6894('0x8')](),controller[_0x6894('0x9')]);router['get'](_0x6894('0xa'),auth[_0x6894('0x8')](),controller[_0x6894('0xb')]);router[_0x6894('0x7')](_0x6894('0xc'),auth[_0x6894('0x8')](),controller[_0x6894('0xd')]);router[_0x6894('0x7')]('/:id/descriptions',auth[_0x6894('0x8')](),controller[_0x6894('0xe')]);router[_0x6894('0x7')](_0x6894('0xf'),auth[_0x6894('0x8')](),controller['getFields']);router[_0x6894('0x10')]('/',auth[_0x6894('0x8')](),controller[_0x6894('0x11')]);router[_0x6894('0x12')](_0x6894('0xa'),auth[_0x6894('0x8')](),controller[_0x6894('0x13')]);router[_0x6894('0x14')](_0x6894('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6894('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a8ca198..881642e 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 _0x5b2e=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5b2e,0x1e4));var _0xe5b2=function(_0x5af994,_0x883de){_0x5af994=_0x5af994-0x0;var _0x285b30=_0x5b2e[_0x5af994];return _0x285b30;};'use strict';var Sequelize=require(_0xe5b2('0x0'));module[_0xe5b2('0x1')]={'name':{'type':Sequelize[_0xe5b2('0x2')]},'description':{'type':Sequelize[_0xe5b2('0x2')]}}; \ No newline at end of file +var _0xa430=['exports','STRING'];(function(_0x5a6ee4,_0x2e1727){var _0x5906fa=function(_0x3aacb5){while(--_0x3aacb5){_0x5a6ee4['push'](_0x5a6ee4['shift']());}};_0x5906fa(++_0x2e1727);}(_0xa430,0x1ec));var _0x0a43=function(_0xd888f0,_0x23f066){_0xd888f0=_0xd888f0-0x0;var _0x362f6c=_0xa430[_0xd888f0];return _0x362f6c;};'use strict';var Sequelize=require('sequelize');module[_0x0a43('0x0')]={'name':{'type':Sequelize[_0x0a43('0x1')]},'description':{'type':Sequelize[_0x0a43('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ce1d285..ba64ebc 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 _0x9d03=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','rows','catch','show','params','rawAttributes','includeAll','include','create','body','destroy','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x542edf,_0x5b7b4d){var _0x4639a2=function(_0x5e04f6){while(--_0x5e04f6){_0x542edf['push'](_0x542edf['shift']());}};_0x4639a2(++_0x5b7b4d);}(_0x9d03,0x1d3));var _0x39d0=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x9d03[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require(_0x39d0('0x0'));var rimraf=require(_0x39d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39d0('0x2'));var rp=require(_0x39d0('0x3'));var moment=require(_0x39d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39d0('0x5'));var util=require(_0x39d0('0x6'));var path=require('path');var sox=require(_0x39d0('0x7'));var csv=require('to-csv');var ejs=require(_0x39d0('0x8'));var fs=require('fs');var fs_extra=require(_0x39d0('0x9'));var _=require(_0x39d0('0xa'));var squel=require(_0x39d0('0xb'));var crypto=require(_0x39d0('0xc'));var jsforce=require(_0x39d0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x39d0('0xe'));var querystring=require(_0x39d0('0xf'));var Papa=require(_0x39d0('0x10'));var Redis=require(_0x39d0('0x11'));var authService=require(_0x39d0('0x12'));var qs=require(_0x39d0('0x13'));var as=require(_0x39d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39d0('0x15'))(_0x39d0('0x16'));var utils=require(_0x39d0('0x17'));var config=require(_0x39d0('0x18'));var licenseUtil=require(_0x39d0('0x19'));var db=require(_0x39d0('0x1a'))['db'];function respondWithStatusCode(_0x3f5762,_0x1761dd){_0x1761dd=_0x1761dd||0xcc;return function(_0x5eda2e){if(_0x5eda2e){return _0x3f5762[_0x39d0('0x1b')](_0x1761dd);}return _0x3f5762['status'](_0x1761dd)[_0x39d0('0x1c')]();};}function respondWithResult(_0x365fc2,_0x3aaa5f){_0x3aaa5f=_0x3aaa5f||0xc8;return function(_0x5c76f7){if(_0x5c76f7){return _0x365fc2['status'](_0x3aaa5f)[_0x39d0('0x1d')](_0x5c76f7);}};}function respondWithFilteredResult(_0x33fdf5,_0x143cd0){return function(_0x975f7a){if(_0x975f7a){var _0xa84da7=typeof _0x143cd0[_0x39d0('0x1e')]===_0x39d0('0x1f')&&typeof _0x143cd0[_0x39d0('0x20')]===_0x39d0('0x1f');var _0x3b09be=_0x975f7a[_0x39d0('0x21')];var _0x4521cb=_0xa84da7?0x0:_0x143cd0[_0x39d0('0x1e')];var _0x14852c=_0xa84da7?_0x975f7a[_0x39d0('0x21')]:_0x143cd0[_0x39d0('0x1e')]+_0x143cd0[_0x39d0('0x20')];var _0x189aac;if(_0x14852c>=_0x3b09be){_0x14852c=_0x3b09be;_0x189aac=0xc8;}else{_0x189aac=0xce;}_0x33fdf5[_0x39d0('0x22')](_0x189aac);return _0x33fdf5[_0x39d0('0x23')]('Content-Range',_0x4521cb+'-'+_0x14852c+'/'+_0x3b09be)[_0x39d0('0x1d')](_0x975f7a);}return null;};}function patchUpdates(_0x229bc7){return function(_0x486e58){try{jsonpatch[_0x39d0('0x24')](_0x486e58,_0x229bc7,!![]);}catch(_0x90ea09){return BPromise[_0x39d0('0x25')](_0x90ea09);}return _0x486e58['save']();};}function saveUpdates(_0x19a848,_0x15272a){return function(_0x106f17){if(_0x106f17){return _0x106f17[_0x39d0('0x26')](_0x19a848)[_0x39d0('0x27')](function(_0x404d6f){return _0x404d6f;});}return null;};}function removeEntity(_0xf6d4e6,_0x52c83d){return function(_0x560203){if(_0x560203){return _0x560203['destroy']()[_0x39d0('0x27')](function(){_0xf6d4e6[_0x39d0('0x22')](0xcc)[_0x39d0('0x1c')]();});}};}function handleEntityNotFound(_0x1b30bd,_0x4c1215){return function(_0xfaf0cf){if(!_0xfaf0cf){_0x1b30bd[_0x39d0('0x1b')](0x194);}return _0xfaf0cf;};}function handleError(_0x52c4e1,_0x2cf93f){_0x2cf93f=_0x2cf93f||0x1f4;return function(_0x555acd){logger[_0x39d0('0x28')](_0x555acd[_0x39d0('0x29')]);if(_0x555acd[_0x39d0('0x2a')]){delete _0x555acd[_0x39d0('0x2a')];}_0x52c4e1['status'](_0x2cf93f)[_0x39d0('0x2b')](_0x555acd);};}exports[_0x39d0('0x2c')]=function(_0x1f7f46,_0x52cd96){var _0x300147={},_0x3c7065={},_0x50aeba={'count':0x0,'rows':[]};var _0xc7ca1f=_[_0x39d0('0x2d')](db[_0x39d0('0x2e')]['rawAttributes'],function(_0x55fa5c){return{'name':_0x55fa5c[_0x39d0('0x2f')],'type':_0x55fa5c['type'][_0x39d0('0x30')]};});_0x3c7065[_0x39d0('0x31')]=_['map'](_0xc7ca1f,_0x39d0('0x2a'));_0x3c7065['query']=_[_0x39d0('0x32')](_0x1f7f46['query']);_0x3c7065[_0x39d0('0x33')]=_[_0x39d0('0x34')](_0x3c7065[_0x39d0('0x31')],_0x3c7065[_0x39d0('0x35')]);_0x300147[_0x39d0('0x36')]=_['intersection'](_0x3c7065[_0x39d0('0x31')],qs['fields'](_0x1f7f46[_0x39d0('0x35')][_0x39d0('0x37')]));_0x300147['attributes']=_0x300147[_0x39d0('0x36')][_0x39d0('0x38')]?_0x300147['attributes']:_0x3c7065[_0x39d0('0x31')];if(!_0x1f7f46[_0x39d0('0x35')][_0x39d0('0x39')](_0x39d0('0x3a'))){_0x300147[_0x39d0('0x20')]=qs[_0x39d0('0x20')](_0x1f7f46[_0x39d0('0x35')][_0x39d0('0x20')]);_0x300147[_0x39d0('0x1e')]=qs[_0x39d0('0x1e')](_0x1f7f46[_0x39d0('0x35')][_0x39d0('0x1e')]);}_0x300147[_0x39d0('0x3b')]=qs[_0x39d0('0x3c')](_0x1f7f46[_0x39d0('0x35')][_0x39d0('0x3c')]);_0x300147[_0x39d0('0x3d')]=qs[_0x39d0('0x33')](_[_0x39d0('0x3e')](_0x1f7f46['query'],_0x3c7065[_0x39d0('0x33')]),_0xc7ca1f);if(_0x1f7f46[_0x39d0('0x35')][_0x39d0('0x3f')]){_0x300147['where']=_['merge'](_0x300147[_0x39d0('0x3d')],{'$or':_['map'](_0xc7ca1f,function(_0x53b322){if(_0x53b322[_0x39d0('0x40')]!=='VIRTUAL'){var _0xc42a83={};_0xc42a83[_0x53b322[_0x39d0('0x2a')]]={'$like':'%'+_0x1f7f46[_0x39d0('0x35')]['filter']+'%'};return _0xc42a83;}})});}_0x300147=_[_0x39d0('0x41')]({},_0x300147,_0x1f7f46[_0x39d0('0x42')]);var _0x410fdb={'where':_0x300147[_0x39d0('0x3d')]};return db[_0x39d0('0x2e')][_0x39d0('0x21')](_0x410fdb)[_0x39d0('0x27')](function(_0x326388){_0x50aeba[_0x39d0('0x21')]=_0x326388;if(_0x1f7f46[_0x39d0('0x35')]['includeAll']){_0x300147['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x300147);})[_0x39d0('0x27')](function(_0x226d58){_0x50aeba[_0x39d0('0x43')]=_0x226d58;return _0x50aeba;})[_0x39d0('0x27')](respondWithFilteredResult(_0x52cd96,_0x300147))[_0x39d0('0x44')](handleError(_0x52cd96,null));};exports[_0x39d0('0x45')]=function(_0x4202db,_0x35802c){var _0x18fe35={'raw':![],'where':{'id':_0x4202db[_0x39d0('0x46')]['id']}},_0x4470d0={};_0x4470d0[_0x39d0('0x31')]=_[_0x39d0('0x32')](db[_0x39d0('0x2e')][_0x39d0('0x47')]);_0x4470d0[_0x39d0('0x35')]=_['keys'](_0x4202db['query']);_0x4470d0[_0x39d0('0x33')]=_['intersection'](_0x4470d0[_0x39d0('0x31')],_0x4470d0[_0x39d0('0x35')]);_0x18fe35[_0x39d0('0x36')]=_[_0x39d0('0x34')](_0x4470d0['model'],qs[_0x39d0('0x37')](_0x4202db['query'][_0x39d0('0x37')]));_0x18fe35['attributes']=_0x18fe35[_0x39d0('0x36')][_0x39d0('0x38')]?_0x18fe35[_0x39d0('0x36')]:_0x4470d0[_0x39d0('0x31')];if(_0x4202db[_0x39d0('0x35')][_0x39d0('0x48')]){_0x18fe35[_0x39d0('0x49')]=[{'all':!![]}];}_0x18fe35=_[_0x39d0('0x41')]({},_0x18fe35,_0x4202db[_0x39d0('0x42')]);return db[_0x39d0('0x2e')]['find'](_0x18fe35)['then'](handleEntityNotFound(_0x35802c,null))[_0x39d0('0x27')](respondWithResult(_0x35802c,null))[_0x39d0('0x44')](handleError(_0x35802c,null));};exports[_0x39d0('0x4a')]=function(_0x194f87,_0x24f0b6){return db[_0x39d0('0x2e')][_0x39d0('0x4a')](_0x194f87[_0x39d0('0x4b')],{})[_0x39d0('0x27')](respondWithResult(_0x24f0b6,0xc9))[_0x39d0('0x44')](handleError(_0x24f0b6,null));};exports[_0x39d0('0x26')]=function(_0x28161b,_0x350a3f){if(_0x28161b[_0x39d0('0x4b')]['id']){delete _0x28161b[_0x39d0('0x4b')]['id'];}return db[_0x39d0('0x2e')]['find']({'where':{'id':_0x28161b['params']['id']}})[_0x39d0('0x27')](handleEntityNotFound(_0x350a3f,null))[_0x39d0('0x27')](saveUpdates(_0x28161b[_0x39d0('0x4b')],null))['then'](respondWithResult(_0x350a3f,null))[_0x39d0('0x44')](handleError(_0x350a3f,null));};exports[_0x39d0('0x4c')]=function(_0x48ef10,_0x470a8a){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x48ef10[_0x39d0('0x46')]['id']}})[_0x39d0('0x27')](handleEntityNotFound(_0x470a8a,null))[_0x39d0('0x27')](removeEntity(_0x470a8a,null))['catch'](handleError(_0x470a8a,null));};exports[_0x39d0('0x4d')]=function(_0x50b6dc,_0x2414f2,_0x4aa31f){var _0x5a12de={};var _0x26eba0={};var _0x4315e8;var _0x3942a;return db[_0x39d0('0x2e')]['findOne']({'where':{'id':_0x50b6dc[_0x39d0('0x46')]['id']}})[_0x39d0('0x27')](handleEntityNotFound(_0x2414f2,null))[_0x39d0('0x27')](function(_0x36d2b1){if(_0x36d2b1){_0x4315e8=_0x36d2b1;_0x26eba0[_0x39d0('0x31')]=_[_0x39d0('0x32')](db[_0x39d0('0x4e')][_0x39d0('0x47')]);_0x26eba0[_0x39d0('0x35')]=_['keys'](_0x50b6dc['query']);_0x26eba0[_0x39d0('0x33')]=_[_0x39d0('0x34')](_0x26eba0['model'],_0x26eba0[_0x39d0('0x35')]);_0x5a12de['attributes']=_['intersection'](_0x26eba0['model'],qs[_0x39d0('0x37')](_0x50b6dc[_0x39d0('0x35')][_0x39d0('0x37')]));_0x5a12de[_0x39d0('0x36')]=_0x5a12de['attributes']['length']?_0x5a12de[_0x39d0('0x36')]:_0x26eba0[_0x39d0('0x31')];_0x5a12de[_0x39d0('0x3b')]=qs[_0x39d0('0x3c')](_0x50b6dc[_0x39d0('0x35')][_0x39d0('0x3c')]);_0x5a12de[_0x39d0('0x3d')]=qs['filters'](_[_0x39d0('0x3e')](_0x50b6dc[_0x39d0('0x35')],_0x26eba0['filters']));if(_0x50b6dc['query'][_0x39d0('0x3f')]){_0x5a12de[_0x39d0('0x3d')]=_[_0x39d0('0x41')](_0x5a12de[_0x39d0('0x3d')],{'$or':_[_0x39d0('0x2d')](_0x5a12de['attributes'],function(_0x1882aa){var _0x1f8c4b={};_0x1f8c4b[_0x1882aa]={'$like':'%'+_0x50b6dc[_0x39d0('0x35')][_0x39d0('0x3f')]+'%'};return _0x1f8c4b;})});}_0x5a12de=_[_0x39d0('0x41')]({},_0x5a12de,_0x50b6dc[_0x39d0('0x42')]);return _0x4315e8[_0x39d0('0x4d')](_0x5a12de);}})[_0x39d0('0x27')](function(_0x20f72e){if(_0x20f72e){_0x3942a=_0x20f72e['length'];if(!_0x50b6dc[_0x39d0('0x35')]['hasOwnProperty'](_0x39d0('0x3a'))){_0x5a12de[_0x39d0('0x20')]=qs['limit'](_0x50b6dc['query'][_0x39d0('0x20')]);_0x5a12de[_0x39d0('0x1e')]=qs['offset'](_0x50b6dc[_0x39d0('0x35')][_0x39d0('0x1e')]);}return _0x4315e8[_0x39d0('0x4d')](_0x5a12de);}})[_0x39d0('0x27')](function(_0x4382d3){if(_0x4382d3){return _0x4382d3?{'count':_0x3942a,'rows':_0x4382d3}:null;}})[_0x39d0('0x27')](respondWithResult(_0x2414f2,null))[_0x39d0('0x44')](handleError(_0x2414f2,null));};exports[_0x39d0('0x4f')]=function(_0x8b15b6,_0x1b6f08,_0xc0e8e7){var _0x52436d={};var _0x4c971e={};var _0x367ebc;var _0x30d9a3;return db[_0x39d0('0x2e')][_0x39d0('0x50')]({'where':{'id':_0x8b15b6[_0x39d0('0x46')]['id']}})[_0x39d0('0x27')](handleEntityNotFound(_0x1b6f08,null))[_0x39d0('0x27')](function(_0x144a3b){if(_0x144a3b){_0x367ebc=_0x144a3b;_0x4c971e[_0x39d0('0x31')]=_[_0x39d0('0x32')](db[_0x39d0('0x4e')]['rawAttributes']);_0x4c971e[_0x39d0('0x35')]=_[_0x39d0('0x32')](_0x8b15b6[_0x39d0('0x35')]);_0x4c971e['filters']=_[_0x39d0('0x34')](_0x4c971e[_0x39d0('0x31')],_0x4c971e[_0x39d0('0x35')]);_0x52436d[_0x39d0('0x36')]=_[_0x39d0('0x34')](_0x4c971e[_0x39d0('0x31')],qs[_0x39d0('0x37')](_0x8b15b6['query'][_0x39d0('0x37')]));_0x52436d[_0x39d0('0x36')]=_0x52436d[_0x39d0('0x36')]['length']?_0x52436d[_0x39d0('0x36')]:_0x4c971e[_0x39d0('0x31')];_0x52436d[_0x39d0('0x3b')]=qs[_0x39d0('0x3c')](_0x8b15b6[_0x39d0('0x35')]['sort']);_0x52436d[_0x39d0('0x3d')]=qs[_0x39d0('0x33')](_[_0x39d0('0x3e')](_0x8b15b6['query'],_0x4c971e[_0x39d0('0x33')]));if(_0x8b15b6['query'][_0x39d0('0x3f')]){_0x52436d[_0x39d0('0x3d')]=_[_0x39d0('0x41')](_0x52436d[_0x39d0('0x3d')],{'$or':_[_0x39d0('0x2d')](_0x52436d[_0x39d0('0x36')],function(_0x116fb2){var _0x2fdeca={};_0x2fdeca[_0x116fb2]={'$like':'%'+_0x8b15b6[_0x39d0('0x35')][_0x39d0('0x3f')]+'%'};return _0x2fdeca;})});}_0x52436d=_[_0x39d0('0x41')]({},_0x52436d,_0x8b15b6[_0x39d0('0x42')]);return _0x367ebc[_0x39d0('0x4f')](_0x52436d);}})['then'](function(_0x54aeda){if(_0x54aeda){_0x30d9a3=_0x54aeda[_0x39d0('0x38')];if(!_0x8b15b6[_0x39d0('0x35')][_0x39d0('0x39')]('nolimit')){_0x52436d[_0x39d0('0x20')]=qs[_0x39d0('0x20')](_0x8b15b6['query'][_0x39d0('0x20')]);_0x52436d[_0x39d0('0x1e')]=qs['offset'](_0x8b15b6[_0x39d0('0x35')]['offset']);}return _0x367ebc[_0x39d0('0x4f')](_0x52436d);}})[_0x39d0('0x27')](function(_0x4ef4ff){if(_0x4ef4ff){return _0x4ef4ff?{'count':_0x30d9a3,'rows':_0x4ef4ff}:null;}})[_0x39d0('0x27')](respondWithResult(_0x1b6f08,null))[_0x39d0('0x44')](handleError(_0x1b6f08,null));};exports['getFields']=function(_0x33ce40,_0x551e28,_0x4dbdec){var _0x7184c5={};var _0x33953d={};var _0x184b25;var _0x242641;return db[_0x39d0('0x2e')][_0x39d0('0x50')]({'where':{'id':_0x33ce40[_0x39d0('0x46')]['id']}})[_0x39d0('0x27')](handleEntityNotFound(_0x551e28,null))[_0x39d0('0x27')](function(_0x5c14d9){if(_0x5c14d9){_0x184b25=_0x5c14d9;_0x33953d[_0x39d0('0x31')]=_[_0x39d0('0x32')](db[_0x39d0('0x4e')][_0x39d0('0x47')]);_0x33953d[_0x39d0('0x35')]=_[_0x39d0('0x32')](_0x33ce40[_0x39d0('0x35')]);_0x33953d[_0x39d0('0x33')]=_[_0x39d0('0x34')](_0x33953d['model'],_0x33953d[_0x39d0('0x35')]);_0x7184c5[_0x39d0('0x36')]=_[_0x39d0('0x34')](_0x33953d[_0x39d0('0x31')],qs['fields'](_0x33ce40[_0x39d0('0x35')]['fields']));_0x7184c5['attributes']=_0x7184c5[_0x39d0('0x36')][_0x39d0('0x38')]?_0x7184c5['attributes']:_0x33953d[_0x39d0('0x31')];_0x7184c5[_0x39d0('0x3b')]=qs['sort'](_0x33ce40['query'][_0x39d0('0x3c')]);_0x7184c5['where']=qs[_0x39d0('0x33')](_['pick'](_0x33ce40[_0x39d0('0x35')],_0x33953d[_0x39d0('0x33')]));if(_0x33ce40[_0x39d0('0x35')]['filter']){_0x7184c5[_0x39d0('0x3d')]=_[_0x39d0('0x41')](_0x7184c5[_0x39d0('0x3d')],{'$or':_['map'](_0x7184c5[_0x39d0('0x36')],function(_0x51ce32){var _0x3102fe={};_0x3102fe[_0x51ce32]={'$like':'%'+_0x33ce40[_0x39d0('0x35')][_0x39d0('0x3f')]+'%'};return _0x3102fe;})});}_0x7184c5=_[_0x39d0('0x41')]({},_0x7184c5,_0x33ce40['options']);return _0x184b25[_0x39d0('0x51')](_0x7184c5);}})[_0x39d0('0x27')](function(_0x2f0be4){if(_0x2f0be4){_0x242641=_0x2f0be4['length'];if(!_0x33ce40['query'][_0x39d0('0x39')](_0x39d0('0x3a'))){_0x7184c5[_0x39d0('0x20')]=qs[_0x39d0('0x20')](_0x33ce40['query']['limit']);_0x7184c5[_0x39d0('0x1e')]=qs['offset'](_0x33ce40['query'][_0x39d0('0x1e')]);}return _0x184b25[_0x39d0('0x51')](_0x7184c5);}})[_0x39d0('0x27')](function(_0xaf0566){if(_0xaf0566){return _0xaf0566?{'count':_0x242641,'rows':_0xaf0566}:null;}})[_0x39d0('0x27')](respondWithResult(_0x551e28,null))[_0x39d0('0x44')](handleError(_0x551e28,null));}; \ No newline at end of file +var _0x963a=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','FreshsalesConfiguration'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x963a,0x1c1));var _0xa963=function(_0x2f4223,_0x12ae51){_0x2f4223=_0x2f4223-0x0;var _0xa53d6d=_0x963a[_0x2f4223];return _0xa53d6d;};'use strict';var emlformat=require(_0xa963('0x0'));var rimraf=require(_0xa963('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa963('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa963('0x3'));var util=require(_0xa963('0x4'));var path=require(_0xa963('0x5'));var sox=require(_0xa963('0x6'));var csv=require('to-csv');var ejs=require(_0xa963('0x7'));var fs=require('fs');var fs_extra=require(_0xa963('0x8'));var _=require(_0xa963('0x9'));var squel=require(_0xa963('0xa'));var crypto=require('crypto');var jsforce=require(_0xa963('0xb'));var deskjs=require(_0xa963('0xc'));var toCsv=require(_0xa963('0xd'));var querystring=require(_0xa963('0xe'));var Papa=require(_0xa963('0xf'));var Redis=require(_0xa963('0x10'));var authService=require(_0xa963('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa963('0x12'));var hardwareService=require(_0xa963('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa963('0x14'));var config=require(_0xa963('0x15'));var licenseUtil=require(_0xa963('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5056a0,_0x66ea75){_0x66ea75=_0x66ea75||0xcc;return function(_0x4c209a){if(_0x4c209a){return _0x5056a0[_0xa963('0x17')](_0x66ea75);}return _0x5056a0[_0xa963('0x18')](_0x66ea75)[_0xa963('0x19')]();};}function respondWithResult(_0x1bcb06,_0x29ebfe){_0x29ebfe=_0x29ebfe||0xc8;return function(_0x22886e){if(_0x22886e){return _0x1bcb06[_0xa963('0x18')](_0x29ebfe)[_0xa963('0x1a')](_0x22886e);}};}function respondWithFilteredResult(_0x4f54c1,_0x133ac9){return function(_0x3e7e7c){if(_0x3e7e7c){var _0x10ff21=typeof _0x133ac9[_0xa963('0x1b')]===_0xa963('0x1c')&&typeof _0x133ac9[_0xa963('0x1d')]===_0xa963('0x1c');var _0x3194ec=_0x3e7e7c[_0xa963('0x1e')];var _0x505be2=_0x10ff21?0x0:_0x133ac9[_0xa963('0x1b')];var _0x5662f2=_0x10ff21?_0x3e7e7c[_0xa963('0x1e')]:_0x133ac9[_0xa963('0x1b')]+_0x133ac9[_0xa963('0x1d')];var _0x46750e;if(_0x5662f2>=_0x3194ec){_0x5662f2=_0x3194ec;_0x46750e=0xc8;}else{_0x46750e=0xce;}_0x4f54c1['status'](_0x46750e);return _0x4f54c1[_0xa963('0x1f')](_0xa963('0x20'),_0x505be2+'-'+_0x5662f2+'/'+_0x3194ec)[_0xa963('0x1a')](_0x3e7e7c);}return null;};}function patchUpdates(_0xe8a2a7){return function(_0x470a84){try{jsonpatch[_0xa963('0x21')](_0x470a84,_0xe8a2a7,!![]);}catch(_0x51328d){return BPromise['reject'](_0x51328d);}return _0x470a84[_0xa963('0x22')]();};}function saveUpdates(_0x32310e,_0x429661){return function(_0x33a28d){if(_0x33a28d){return _0x33a28d['update'](_0x32310e)[_0xa963('0x23')](function(_0x3c3e26){return _0x3c3e26;});}return null;};}function removeEntity(_0x33955d,_0x29dc16){return function(_0x206dd8){if(_0x206dd8){return _0x206dd8[_0xa963('0x24')]()['then'](function(){_0x33955d[_0xa963('0x18')](0xcc)[_0xa963('0x19')]();});}};}function handleEntityNotFound(_0x5f0bbc,_0x1414a9){return function(_0x35f302){if(!_0x35f302){_0x5f0bbc[_0xa963('0x17')](0x194);}return _0x35f302;};}function handleError(_0x222baa,_0x331d4e){_0x331d4e=_0x331d4e||0x1f4;return function(_0x12db3c){logger[_0xa963('0x25')](_0x12db3c[_0xa963('0x26')]);if(_0x12db3c[_0xa963('0x27')]){delete _0x12db3c[_0xa963('0x27')];}_0x222baa[_0xa963('0x18')](_0x331d4e)[_0xa963('0x28')](_0x12db3c);};}exports[_0xa963('0x29')]=function(_0x4d945f,_0x6177c9){var _0x578a8={},_0x4c69ed={},_0xba5afa={'count':0x0,'rows':[]};var _0x539f6a=_['map'](db[_0xa963('0x2a')][_0xa963('0x2b')],function(_0x51f294){return{'name':_0x51f294[_0xa963('0x2c')],'type':_0x51f294[_0xa963('0x2d')][_0xa963('0x2e')]};});_0x4c69ed['model']=_[_0xa963('0x2f')](_0x539f6a,_0xa963('0x27'));_0x4c69ed[_0xa963('0x30')]=_[_0xa963('0x31')](_0x4d945f[_0xa963('0x30')]);_0x4c69ed[_0xa963('0x32')]=_[_0xa963('0x33')](_0x4c69ed[_0xa963('0x34')],_0x4c69ed[_0xa963('0x30')]);_0x578a8[_0xa963('0x35')]=_['intersection'](_0x4c69ed[_0xa963('0x34')],qs['fields'](_0x4d945f[_0xa963('0x30')][_0xa963('0x36')]));_0x578a8['attributes']=_0x578a8[_0xa963('0x35')]['length']?_0x578a8[_0xa963('0x35')]:_0x4c69ed[_0xa963('0x34')];if(!_0x4d945f['query'][_0xa963('0x37')]('nolimit')){_0x578a8['limit']=qs[_0xa963('0x1d')](_0x4d945f['query'][_0xa963('0x1d')]);_0x578a8[_0xa963('0x1b')]=qs['offset'](_0x4d945f[_0xa963('0x30')][_0xa963('0x1b')]);}_0x578a8[_0xa963('0x38')]=qs[_0xa963('0x39')](_0x4d945f[_0xa963('0x30')][_0xa963('0x39')]);_0x578a8[_0xa963('0x3a')]=qs['filters'](_[_0xa963('0x3b')](_0x4d945f[_0xa963('0x30')],_0x4c69ed['filters']),_0x539f6a);if(_0x4d945f[_0xa963('0x30')][_0xa963('0x3c')]){_0x578a8[_0xa963('0x3a')]=_[_0xa963('0x3d')](_0x578a8[_0xa963('0x3a')],{'$or':_[_0xa963('0x2f')](_0x539f6a,function(_0x4e4ebd){if(_0x4e4ebd[_0xa963('0x2d')]!==_0xa963('0x3e')){var _0xfd7001={};_0xfd7001[_0x4e4ebd[_0xa963('0x27')]]={'$like':'%'+_0x4d945f[_0xa963('0x30')][_0xa963('0x3c')]+'%'};return _0xfd7001;}})});}_0x578a8=_[_0xa963('0x3d')]({},_0x578a8,_0x4d945f[_0xa963('0x3f')]);var _0x4117cd={'where':_0x578a8[_0xa963('0x3a')]};return db[_0xa963('0x2a')][_0xa963('0x1e')](_0x4117cd)[_0xa963('0x23')](function(_0x4f9952){_0xba5afa[_0xa963('0x1e')]=_0x4f9952;if(_0x4d945f[_0xa963('0x30')][_0xa963('0x40')]){_0x578a8[_0xa963('0x41')]=[{'all':!![]}];}return db[_0xa963('0x2a')][_0xa963('0x42')](_0x578a8);})[_0xa963('0x23')](function(_0x2899ff){_0xba5afa[_0xa963('0x43')]=_0x2899ff;return _0xba5afa;})[_0xa963('0x23')](respondWithFilteredResult(_0x6177c9,_0x578a8))[_0xa963('0x44')](handleError(_0x6177c9,null));};exports[_0xa963('0x45')]=function(_0x4c2c6b,_0x114636){var _0x362f03={'raw':![],'where':{'id':_0x4c2c6b['params']['id']}},_0xb67af6={};_0xb67af6[_0xa963('0x34')]=_[_0xa963('0x31')](db['FreshsalesConfiguration'][_0xa963('0x2b')]);_0xb67af6[_0xa963('0x30')]=_[_0xa963('0x31')](_0x4c2c6b['query']);_0xb67af6[_0xa963('0x32')]=_[_0xa963('0x33')](_0xb67af6[_0xa963('0x34')],_0xb67af6['query']);_0x362f03[_0xa963('0x35')]=_[_0xa963('0x33')](_0xb67af6['model'],qs[_0xa963('0x36')](_0x4c2c6b[_0xa963('0x30')][_0xa963('0x36')]));_0x362f03[_0xa963('0x35')]=_0x362f03[_0xa963('0x35')][_0xa963('0x46')]?_0x362f03[_0xa963('0x35')]:_0xb67af6[_0xa963('0x34')];if(_0x4c2c6b['query']['includeAll']){_0x362f03['include']=[{'all':!![]}];}_0x362f03=_[_0xa963('0x3d')]({},_0x362f03,_0x4c2c6b['options']);return db[_0xa963('0x2a')][_0xa963('0x47')](_0x362f03)[_0xa963('0x23')](handleEntityNotFound(_0x114636,null))[_0xa963('0x23')](respondWithResult(_0x114636,null))[_0xa963('0x44')](handleError(_0x114636,null));};exports[_0xa963('0x48')]=function(_0x479593,_0x41eea6){return db[_0xa963('0x2a')][_0xa963('0x48')](_0x479593[_0xa963('0x49')],{})[_0xa963('0x23')](respondWithResult(_0x41eea6,0xc9))[_0xa963('0x44')](handleError(_0x41eea6,null));};exports[_0xa963('0x4a')]=function(_0x10c93c,_0x2a1eff){if(_0x10c93c['body']['id']){delete _0x10c93c[_0xa963('0x49')]['id'];}return db['FreshsalesConfiguration'][_0xa963('0x47')]({'where':{'id':_0x10c93c[_0xa963('0x4b')]['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x2a1eff,null))[_0xa963('0x23')](saveUpdates(_0x10c93c[_0xa963('0x49')],null))['then'](respondWithResult(_0x2a1eff,null))['catch'](handleError(_0x2a1eff,null));};exports[_0xa963('0x24')]=function(_0x1b79ce,_0x1bb4f6){return db[_0xa963('0x2a')][_0xa963('0x47')]({'where':{'id':_0x1b79ce['params']['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x1bb4f6,null))[_0xa963('0x23')](removeEntity(_0x1bb4f6,null))[_0xa963('0x44')](handleError(_0x1bb4f6,null));};exports[_0xa963('0x4c')]=function(_0x1747db,_0x2b9744,_0x507c34){var _0xe0a6b1={};var _0x3be0f9={};var _0x521a0d;var _0x194119;return db['FreshsalesConfiguration'][_0xa963('0x4d')]({'where':{'id':_0x1747db[_0xa963('0x4b')]['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x2b9744,null))[_0xa963('0x23')](function(_0x194547){if(_0x194547){_0x521a0d=_0x194547;_0x3be0f9[_0xa963('0x34')]=_[_0xa963('0x31')](db[_0xa963('0x4e')][_0xa963('0x2b')]);_0x3be0f9[_0xa963('0x30')]=_[_0xa963('0x31')](_0x1747db[_0xa963('0x30')]);_0x3be0f9[_0xa963('0x32')]=_['intersection'](_0x3be0f9[_0xa963('0x34')],_0x3be0f9[_0xa963('0x30')]);_0xe0a6b1['attributes']=_[_0xa963('0x33')](_0x3be0f9[_0xa963('0x34')],qs['fields'](_0x1747db[_0xa963('0x30')][_0xa963('0x36')]));_0xe0a6b1[_0xa963('0x35')]=_0xe0a6b1['attributes']['length']?_0xe0a6b1[_0xa963('0x35')]:_0x3be0f9[_0xa963('0x34')];_0xe0a6b1[_0xa963('0x38')]=qs['sort'](_0x1747db[_0xa963('0x30')][_0xa963('0x39')]);_0xe0a6b1[_0xa963('0x3a')]=qs[_0xa963('0x32')](_[_0xa963('0x3b')](_0x1747db[_0xa963('0x30')],_0x3be0f9[_0xa963('0x32')]));if(_0x1747db[_0xa963('0x30')][_0xa963('0x3c')]){_0xe0a6b1[_0xa963('0x3a')]=_[_0xa963('0x3d')](_0xe0a6b1[_0xa963('0x3a')],{'$or':_[_0xa963('0x2f')](_0xe0a6b1[_0xa963('0x35')],function(_0x4fe2c2){var _0x1636da={};_0x1636da[_0x4fe2c2]={'$like':'%'+_0x1747db[_0xa963('0x30')][_0xa963('0x3c')]+'%'};return _0x1636da;})});}_0xe0a6b1=_[_0xa963('0x3d')]({},_0xe0a6b1,_0x1747db['options']);return _0x521a0d[_0xa963('0x4c')](_0xe0a6b1);}})[_0xa963('0x23')](function(_0x20bde8){if(_0x20bde8){_0x194119=_0x20bde8[_0xa963('0x46')];if(!_0x1747db[_0xa963('0x30')][_0xa963('0x37')](_0xa963('0x4f'))){_0xe0a6b1['limit']=qs[_0xa963('0x1d')](_0x1747db[_0xa963('0x30')][_0xa963('0x1d')]);_0xe0a6b1[_0xa963('0x1b')]=qs[_0xa963('0x1b')](_0x1747db[_0xa963('0x30')][_0xa963('0x1b')]);}return _0x521a0d[_0xa963('0x4c')](_0xe0a6b1);}})[_0xa963('0x23')](function(_0x30dbc9){if(_0x30dbc9){return _0x30dbc9?{'count':_0x194119,'rows':_0x30dbc9}:null;}})[_0xa963('0x23')](respondWithResult(_0x2b9744,null))['catch'](handleError(_0x2b9744,null));};exports[_0xa963('0x50')]=function(_0x5b2e5f,_0x5ee3bc,_0xa7f665){var _0x5b9af2={};var _0x147516={};var _0xb3d775;var _0xa47e30;return db['FreshsalesConfiguration'][_0xa963('0x4d')]({'where':{'id':_0x5b2e5f['params']['id']}})['then'](handleEntityNotFound(_0x5ee3bc,null))[_0xa963('0x23')](function(_0x5f0ce){if(_0x5f0ce){_0xb3d775=_0x5f0ce;_0x147516[_0xa963('0x34')]=_[_0xa963('0x31')](db[_0xa963('0x4e')][_0xa963('0x2b')]);_0x147516['query']=_[_0xa963('0x31')](_0x5b2e5f[_0xa963('0x30')]);_0x147516['filters']=_[_0xa963('0x33')](_0x147516[_0xa963('0x34')],_0x147516[_0xa963('0x30')]);_0x5b9af2['attributes']=_['intersection'](_0x147516[_0xa963('0x34')],qs[_0xa963('0x36')](_0x5b2e5f['query'][_0xa963('0x36')]));_0x5b9af2[_0xa963('0x35')]=_0x5b9af2['attributes']['length']?_0x5b9af2[_0xa963('0x35')]:_0x147516[_0xa963('0x34')];_0x5b9af2[_0xa963('0x38')]=qs[_0xa963('0x39')](_0x5b2e5f['query'][_0xa963('0x39')]);_0x5b9af2[_0xa963('0x3a')]=qs[_0xa963('0x32')](_[_0xa963('0x3b')](_0x5b2e5f[_0xa963('0x30')],_0x147516[_0xa963('0x32')]));if(_0x5b2e5f['query'][_0xa963('0x3c')]){_0x5b9af2['where']=_['merge'](_0x5b9af2[_0xa963('0x3a')],{'$or':_[_0xa963('0x2f')](_0x5b9af2[_0xa963('0x35')],function(_0x1efedd){var _0x2d8b82={};_0x2d8b82[_0x1efedd]={'$like':'%'+_0x5b2e5f['query'][_0xa963('0x3c')]+'%'};return _0x2d8b82;})});}_0x5b9af2=_[_0xa963('0x3d')]({},_0x5b9af2,_0x5b2e5f[_0xa963('0x3f')]);return _0xb3d775['getDescriptions'](_0x5b9af2);}})[_0xa963('0x23')](function(_0x5c5f53){if(_0x5c5f53){_0xa47e30=_0x5c5f53['length'];if(!_0x5b2e5f['query']['hasOwnProperty'](_0xa963('0x4f'))){_0x5b9af2[_0xa963('0x1d')]=qs[_0xa963('0x1d')](_0x5b2e5f[_0xa963('0x30')][_0xa963('0x1d')]);_0x5b9af2['offset']=qs['offset'](_0x5b2e5f[_0xa963('0x30')][_0xa963('0x1b')]);}return _0xb3d775['getDescriptions'](_0x5b9af2);}})[_0xa963('0x23')](function(_0xa2795b){if(_0xa2795b){return _0xa2795b?{'count':_0xa47e30,'rows':_0xa2795b}:null;}})[_0xa963('0x23')](respondWithResult(_0x5ee3bc,null))[_0xa963('0x44')](handleError(_0x5ee3bc,null));};exports[_0xa963('0x51')]=function(_0x5b7d82,_0x20a453,_0x25771c){var _0x134594={};var _0xe69fee={};var _0x298995;var _0x55f530;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5b7d82['params']['id']}})[_0xa963('0x23')](handleEntityNotFound(_0x20a453,null))[_0xa963('0x23')](function(_0x51172b){if(_0x51172b){_0x298995=_0x51172b;_0xe69fee[_0xa963('0x34')]=_['keys'](db[_0xa963('0x4e')][_0xa963('0x2b')]);_0xe69fee['query']=_[_0xa963('0x31')](_0x5b7d82[_0xa963('0x30')]);_0xe69fee[_0xa963('0x32')]=_['intersection'](_0xe69fee[_0xa963('0x34')],_0xe69fee[_0xa963('0x30')]);_0x134594[_0xa963('0x35')]=_[_0xa963('0x33')](_0xe69fee[_0xa963('0x34')],qs['fields'](_0x5b7d82[_0xa963('0x30')]['fields']));_0x134594[_0xa963('0x35')]=_0x134594[_0xa963('0x35')][_0xa963('0x46')]?_0x134594[_0xa963('0x35')]:_0xe69fee[_0xa963('0x34')];_0x134594[_0xa963('0x38')]=qs[_0xa963('0x39')](_0x5b7d82[_0xa963('0x30')][_0xa963('0x39')]);_0x134594[_0xa963('0x3a')]=qs[_0xa963('0x32')](_[_0xa963('0x3b')](_0x5b7d82[_0xa963('0x30')],_0xe69fee['filters']));if(_0x5b7d82[_0xa963('0x30')]['filter']){_0x134594[_0xa963('0x3a')]=_[_0xa963('0x3d')](_0x134594['where'],{'$or':_[_0xa963('0x2f')](_0x134594['attributes'],function(_0x342c81){var _0x309296={};_0x309296[_0x342c81]={'$like':'%'+_0x5b7d82['query']['filter']+'%'};return _0x309296;})});}_0x134594=_[_0xa963('0x3d')]({},_0x134594,_0x5b7d82[_0xa963('0x3f')]);return _0x298995[_0xa963('0x51')](_0x134594);}})[_0xa963('0x23')](function(_0x472e91){if(_0x472e91){_0x55f530=_0x472e91[_0xa963('0x46')];if(!_0x5b7d82[_0xa963('0x30')][_0xa963('0x37')](_0xa963('0x4f'))){_0x134594[_0xa963('0x1d')]=qs['limit'](_0x5b7d82[_0xa963('0x30')][_0xa963('0x1d')]);_0x134594[_0xa963('0x1b')]=qs['offset'](_0x5b7d82[_0xa963('0x30')]['offset']);}return _0x298995[_0xa963('0x51')](_0x134594);}})[_0xa963('0x23')](function(_0x3936be){if(_0x3936be){return _0x3936be?{'count':_0x55f530,'rows':_0x3936be}:null;}})[_0xa963('0x23')](respondWithResult(_0x20a453,null))[_0xa963('0x44')](handleError(_0x20a453,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 72a400c..9f63673 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 _0xfce2=['int_freshsales_configurations','lodash','../../config/logger','api','request-promise','path','../../config/environment','exports','define','FreshsalesConfiguration'];(function(_0x2b075a,_0x23b253){var _0x40568b=function(_0x223813){while(--_0x223813){_0x2b075a['push'](_0x2b075a['shift']());}};_0x40568b(++_0x23b253);}(_0xfce2,0x6f));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fce('0x0'));var util=require('util');var logger=require(_0x2fce('0x1'))(_0x2fce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2fce('0x3'));var fs=require('fs');var path=require(_0x2fce('0x4'));var rimraf=require('rimraf');var config=require(_0x2fce('0x5'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x2fce('0x6')]=function(_0x27e741,_0x30d5fa){return _0x27e741[_0x2fce('0x7')](_0x2fce('0x8'),attributes,{'tableName':_0x2fce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0214=['rimraf','../../config/environment','exports','define','lodash','util','api','moment','bluebird','path'];(function(_0x3093fe,_0x5a0cff){var _0x31517d=function(_0x4a6eba){while(--_0x4a6eba){_0x3093fe['push'](_0x3093fe['shift']());}};_0x31517d(++_0x5a0cff);}(_0x0214,0x144));var _0x4021=function(_0x5223bf,_0x109da4){_0x5223bf=_0x5223bf-0x0;var _0x181da4=_0x0214[_0x5223bf];return _0x181da4;};'use strict';var _=require(_0x4021('0x0'));var util=require(_0x4021('0x1'));var logger=require('../../config/logger')(_0x4021('0x2'));var moment=require(_0x4021('0x3'));var BPromise=require(_0x4021('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4021('0x5'));var rimraf=require(_0x4021('0x6'));var config=require(_0x4021('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x4021('0x8')]=function(_0x438dc5,_0x49719d){return _0x438dc5[_0x4021('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index f7d7594..99bf67a 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 _0xf1b8=['rpc','jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x1aeeeb,_0xf01382){var _0x2836d2=function(_0x41d90e){while(--_0x41d90e){_0x1aeeeb['push'](_0x1aeeeb['shift']());}};_0x2836d2(++_0xf01382);}(_0xf1b8,0x18a));var _0x8f1b=function(_0x42471a,_0x38b2f1){_0x42471a=_0x42471a-0x0;var _0x5981a8=_0xf1b8[_0x42471a];return _0x5981a8;};'use strict';var _=require('lodash');var util=require(_0x8f1b('0x0'));var moment=require(_0x8f1b('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f1b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f1b('0x3'));var logger=require(_0x8f1b('0x4'))(_0x8f1b('0x5'));var config=require('../../config/environment');var jayson=require(_0x8f1b('0x6'));var client=jayson[_0x8f1b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd5b1,_0x25a945,_0xb69981){return new BPromise(function(_0x4f2f4c,_0xdb7d4b){return client['request'](_0x1fd5b1,_0xb69981)[_0x8f1b('0x8')](function(_0x24d9a2){logger[_0x8f1b('0x9')](_0x8f1b('0xa'),_0x25a945,_0x8f1b('0xb'));logger[_0x8f1b('0xc')](_0x8f1b('0xd'),_0x25a945,_0x8f1b('0xb'),JSON['stringify'](_0x24d9a2));if(_0x24d9a2['error']){if(_0x24d9a2['error'][_0x8f1b('0xe')]===0x1f4){logger[_0x8f1b('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x25a945,_0x24d9a2[_0x8f1b('0xf')][_0x8f1b('0x10')]);return _0xdb7d4b(_0x24d9a2['error'][_0x8f1b('0x10')]);}logger['error'](_0x8f1b('0xa'),_0x25a945,_0x24d9a2[_0x8f1b('0xf')][_0x8f1b('0x10')]);return _0x4f2f4c(_0x24d9a2[_0x8f1b('0xf')]['message']);}else{logger['info'](_0x8f1b('0xa'),_0x25a945,_0x8f1b('0xb'));_0x4f2f4c(_0x24d9a2[_0x8f1b('0x11')][_0x8f1b('0x10')]);}})[_0x8f1b('0x12')](function(_0x1b04c3){logger['error'](_0x8f1b('0xa'),_0x25a945,_0x1b04c3);_0xdb7d4b(_0x1b04c3);});});} \ No newline at end of file +var _0x31ba=['http','request','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','rpc','client'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x31ba,0x9a));var _0xa31b=function(_0x55f122,_0x56edaf){_0x55f122=_0x55f122-0x0;var _0x1a28d6=_0x31ba[_0x55f122];return _0x1a28d6;};'use strict';var _=require(_0xa31b('0x0'));var util=require(_0xa31b('0x1'));var moment=require(_0xa31b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa31b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa31b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa31b('0x5')][_0xa31b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a69e3,_0x4154bd,_0x24c2da){return new BPromise(function(_0x24102e,_0x43f346){return client[_0xa31b('0x7')](_0x4a69e3,_0x24c2da)['then'](function(_0x181de5){logger[_0xa31b('0x8')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4154bd,'request\x20sent');logger[_0xa31b('0x9')](_0xa31b('0xa'),_0x4154bd,_0xa31b('0xb'),JSON['stringify'](_0x181de5));if(_0x181de5[_0xa31b('0xc')]){if(_0x181de5[_0xa31b('0xc')]['code']===0x1f4){logger[_0xa31b('0xc')](_0xa31b('0xd'),_0x4154bd,_0x181de5[_0xa31b('0xc')][_0xa31b('0xe')]);return _0x43f346(_0x181de5['error'][_0xa31b('0xe')]);}logger[_0xa31b('0xc')](_0xa31b('0xd'),_0x4154bd,_0x181de5[_0xa31b('0xc')][_0xa31b('0xe')]);return _0x24102e(_0x181de5[_0xa31b('0xc')][_0xa31b('0xe')]);}else{logger[_0xa31b('0x8')](_0xa31b('0xd'),_0x4154bd,'request\x20sent');_0x24102e(_0x181de5[_0xa31b('0xf')][_0xa31b('0xe')]);}})['catch'](function(_0x3e9aa3){logger[_0xa31b('0xc')](_0xa31b('0xd'),_0x4154bd,_0x3e9aa3);_0x43f346(_0x3e9aa3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3b4cd00..d2ebbd9 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 _0x18e0=['get','isAuthenticated','/:id','post','create','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesField.controller'];(function(_0x318412,_0x238a1b){var _0xd21ab1=function(_0x5d4219){while(--_0x5d4219){_0x318412['push'](_0x318412['shift']());}};_0xd21ab1(++_0x238a1b);}(_0x18e0,0xa2));var _0x018e=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x18e0[_0x580647];return _0x5f0792;};'use strict';var multer=require('multer');var util=require(_0x018e('0x0'));var path=require('path');var timeout=require(_0x018e('0x1'));var express=require(_0x018e('0x2'));var router=express[_0x018e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x018e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x018e('0x5'));router[_0x018e('0x6')]('/',auth[_0x018e('0x7')](),controller['index']);router['get'](_0x018e('0x8'),auth[_0x018e('0x7')](),controller['show']);router[_0x018e('0x9')]('/',auth[_0x018e('0x7')](),controller[_0x018e('0xa')]);router[_0x018e('0xb')](_0x018e('0x8'),auth[_0x018e('0x7')](),controller['update']);router[_0x018e('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x018e('0xd')]=router; \ No newline at end of file +var _0x2bdb=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x2188de,_0x20febe){var _0x39500c=function(_0x594a35){while(--_0x594a35){_0x2188de['push'](_0x2188de['shift']());}};_0x39500c(++_0x20febe);}(_0x2bdb,0x105));var _0xb2bd=function(_0x507ba1,_0x57b3c1){_0x507ba1=_0x507ba1-0x0;var _0x5ab818=_0x2bdb[_0x507ba1];return _0x5ab818;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/:id',auth[_0xb2bd('0x9')](),controller['show']);router[_0xb2bd('0xb')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0xd')](_0xb2bd('0xe'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xf')]);router[_0xb2bd('0x10')](_0xb2bd('0xe'),auth['isAuthenticated'](),controller[_0xb2bd('0x11')]);module[_0xb2bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 754a566..9968d43 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 _0xe1f1=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0xe1f1,0x96));var _0x1e1f=function(_0x2e986c,_0x90e194){_0x2e986c=_0x2e986c-0x0;var _0x165169=_0xe1f1[_0x2e986c];return _0x165169;};'use strict';var Sequelize=require(_0x1e1f('0x0'));module[_0x1e1f('0x1')]={'type':{'type':Sequelize[_0x1e1f('0x2')]('string',_0x1e1f('0x3'),_0x1e1f('0x4'),_0x1e1f('0x5'),_0x1e1f('0x6')),'defaultValue':_0x1e1f('0x7')},'content':{'type':Sequelize[_0x1e1f('0x8')]},'key':{'type':Sequelize[_0x1e1f('0x8')]},'keyType':{'type':Sequelize[_0x1e1f('0x2')](_0x1e1f('0x7'),_0x1e1f('0x3'),_0x1e1f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1e1f('0x8')]},'nameField':{'type':Sequelize[_0x1e1f('0x8')]},'customField':{'type':Sequelize[_0x1e1f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x64a9=['BOOLEAN','sequelize','ENUM','variable','customVariable','string','STRING'];(function(_0x6b1743,_0x1aede4){var _0x8e5295=function(_0x3f4fcf){while(--_0x3f4fcf){_0x6b1743['push'](_0x6b1743['shift']());}};_0x8e5295(++_0x1aede4);}(_0x64a9,0x7f));var _0x964a=function(_0x1f2748,_0x1ffe79){_0x1f2748=_0x1f2748-0x0;var _0x3e9ccf=_0x64a9[_0x1f2748];return _0x3e9ccf;};'use strict';var Sequelize=require(_0x964a('0x0'));module['exports']={'type':{'type':Sequelize[_0x964a('0x1')]('string',_0x964a('0x2'),_0x964a('0x3'),'keyValue','picklist'),'defaultValue':_0x964a('0x4')},'content':{'type':Sequelize[_0x964a('0x5')]},'key':{'type':Sequelize[_0x964a('0x5')]},'keyType':{'type':Sequelize[_0x964a('0x1')](_0x964a('0x4'),_0x964a('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x964a('0x5')]},'idField':{'type':Sequelize[_0x964a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x964a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x964a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 3d89a6e..1f8feaa 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 _0x957d=['offset','limit','set','reject','save','update','then','end','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','FreshsalesField','catch','show','params','keys','includeAll','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x222aaf,_0x54b0b2){var _0x148069=function(_0x106088){while(--_0x106088){_0x222aaf['push'](_0x222aaf['shift']());}};_0x148069(++_0x54b0b2);}(_0x957d,0x16d));var _0xd957=function(_0x5cc9e1,_0x493b4f){_0x5cc9e1=_0x5cc9e1-0x0;var _0x4f915f=_0x957d[_0x5cc9e1];return _0x4f915f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd957('0x0'));var zipdir=require(_0xd957('0x1'));var jsonpatch=require(_0xd957('0x2'));var rp=require(_0xd957('0x3'));var moment=require(_0xd957('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd957('0x5'));var path=require(_0xd957('0x6'));var sox=require(_0xd957('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd957('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd957('0x9'));var toCsv=require(_0xd957('0xa'));var querystring=require(_0xd957('0xb'));var Papa=require('papaparse');var Redis=require(_0xd957('0xc'));var authService=require(_0xd957('0xd'));var qs=require(_0xd957('0xe'));var as=require(_0xd957('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd957('0x10'))('api');var utils=require(_0xd957('0x11'));var config=require(_0xd957('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd957('0x13'))['db'];function respondWithStatusCode(_0x12e675,_0x1468a0){_0x1468a0=_0x1468a0||0xcc;return function(_0x54f389){if(_0x54f389){return _0x12e675[_0xd957('0x14')](_0x1468a0);}return _0x12e675[_0xd957('0x15')](_0x1468a0)['end']();};}function respondWithResult(_0x50021b,_0x3e3114){_0x3e3114=_0x3e3114||0xc8;return function(_0x3a5a66){if(_0x3a5a66){return _0x50021b['status'](_0x3e3114)[_0xd957('0x16')](_0x3a5a66);}};}function respondWithFilteredResult(_0x5a1949,_0x168620){return function(_0x3b6b88){if(_0x3b6b88){var _0x2376b4=typeof _0x168620['offset']===_0xd957('0x17')&&typeof _0x168620['limit']===_0xd957('0x17');var _0x1d7ca4=_0x3b6b88[_0xd957('0x18')];var _0x394f9a=_0x2376b4?0x0:_0x168620[_0xd957('0x19')];var _0x12bc22=_0x2376b4?_0x3b6b88[_0xd957('0x18')]:_0x168620['offset']+_0x168620[_0xd957('0x1a')];var _0xdec9d;if(_0x12bc22>=_0x1d7ca4){_0x12bc22=_0x1d7ca4;_0xdec9d=0xc8;}else{_0xdec9d=0xce;}_0x5a1949['status'](_0xdec9d);return _0x5a1949[_0xd957('0x1b')]('Content-Range',_0x394f9a+'-'+_0x12bc22+'/'+_0x1d7ca4)[_0xd957('0x16')](_0x3b6b88);}return null;};}function patchUpdates(_0x230fae){return function(_0x13c970){try{jsonpatch['apply'](_0x13c970,_0x230fae,!![]);}catch(_0x334b46){return BPromise[_0xd957('0x1c')](_0x334b46);}return _0x13c970[_0xd957('0x1d')]();};}function saveUpdates(_0x659dcf,_0x4ca8b0){return function(_0xf0bc23){if(_0xf0bc23){return _0xf0bc23[_0xd957('0x1e')](_0x659dcf)[_0xd957('0x1f')](function(_0x4fea93){return _0x4fea93;});}return null;};}function removeEntity(_0xaf82d8,_0x2d881d){return function(_0x542816){if(_0x542816){return _0x542816['destroy']()[_0xd957('0x1f')](function(){_0xaf82d8[_0xd957('0x15')](0xcc)[_0xd957('0x20')]();});}};}function handleEntityNotFound(_0x543426,_0x287eb9){return function(_0x59e412){if(!_0x59e412){_0x543426[_0xd957('0x14')](0x194);}return _0x59e412;};}function handleError(_0xd7e3fe,_0x5b479a){_0x5b479a=_0x5b479a||0x1f4;return function(_0x2e8a9a){logger[_0xd957('0x21')](_0x2e8a9a['stack']);if(_0x2e8a9a[_0xd957('0x22')]){delete _0x2e8a9a['name'];}_0xd7e3fe[_0xd957('0x15')](_0x5b479a)[_0xd957('0x23')](_0x2e8a9a);};}exports[_0xd957('0x24')]=function(_0x41a13b,_0x3269d5){var _0x3f63d9={},_0x103a0b={},_0x4a9e6a={'count':0x0,'rows':[]};var _0x1bd19b=_[_0xd957('0x25')](db['FreshsalesField'][_0xd957('0x26')],function(_0x1a2c5a){return{'name':_0x1a2c5a['fieldName'],'type':_0x1a2c5a[_0xd957('0x27')]['key']};});_0x103a0b[_0xd957('0x28')]=_[_0xd957('0x25')](_0x1bd19b,'name');_0x103a0b[_0xd957('0x29')]=_['keys'](_0x41a13b[_0xd957('0x29')]);_0x103a0b[_0xd957('0x2a')]=_[_0xd957('0x2b')](_0x103a0b[_0xd957('0x28')],_0x103a0b[_0xd957('0x29')]);_0x3f63d9[_0xd957('0x2c')]=_[_0xd957('0x2b')](_0x103a0b['model'],qs['fields'](_0x41a13b[_0xd957('0x29')][_0xd957('0x2d')]));_0x3f63d9[_0xd957('0x2c')]=_0x3f63d9[_0xd957('0x2c')][_0xd957('0x2e')]?_0x3f63d9['attributes']:_0x103a0b['model'];if(!_0x41a13b[_0xd957('0x29')][_0xd957('0x2f')](_0xd957('0x30'))){_0x3f63d9[_0xd957('0x1a')]=qs[_0xd957('0x1a')](_0x41a13b['query'][_0xd957('0x1a')]);_0x3f63d9[_0xd957('0x19')]=qs[_0xd957('0x19')](_0x41a13b[_0xd957('0x29')][_0xd957('0x19')]);}_0x3f63d9['order']=qs['sort'](_0x41a13b['query'][_0xd957('0x31')]);_0x3f63d9[_0xd957('0x32')]=qs['filters'](_['pick'](_0x41a13b[_0xd957('0x29')],_0x103a0b[_0xd957('0x2a')]),_0x1bd19b);if(_0x41a13b[_0xd957('0x29')][_0xd957('0x33')]){_0x3f63d9[_0xd957('0x32')]=_[_0xd957('0x34')](_0x3f63d9[_0xd957('0x32')],{'$or':_[_0xd957('0x25')](_0x1bd19b,function(_0x209c1a){if(_0x209c1a[_0xd957('0x27')]!==_0xd957('0x35')){var _0x4d1dde={};_0x4d1dde[_0x209c1a[_0xd957('0x22')]]={'$like':'%'+_0x41a13b[_0xd957('0x29')]['filter']+'%'};return _0x4d1dde;}})});}_0x3f63d9=_[_0xd957('0x34')]({},_0x3f63d9,_0x41a13b[_0xd957('0x36')]);var _0x2fff1a={'where':_0x3f63d9[_0xd957('0x32')]};return db[_0xd957('0x37')][_0xd957('0x18')](_0x2fff1a)[_0xd957('0x1f')](function(_0x119d1f){_0x4a9e6a[_0xd957('0x18')]=_0x119d1f;if(_0x41a13b[_0xd957('0x29')]['includeAll']){_0x3f63d9['include']=[{'all':!![]}];}return db[_0xd957('0x37')]['findAll'](_0x3f63d9);})[_0xd957('0x1f')](function(_0x1d0643){_0x4a9e6a['rows']=_0x1d0643;return _0x4a9e6a;})[_0xd957('0x1f')](respondWithFilteredResult(_0x3269d5,_0x3f63d9))[_0xd957('0x38')](handleError(_0x3269d5,null));};exports[_0xd957('0x39')]=function(_0x2fe836,_0x2a3531){var _0x489219={'raw':!![],'where':{'id':_0x2fe836[_0xd957('0x3a')]['id']}},_0x44c2f9={};_0x44c2f9[_0xd957('0x28')]=_[_0xd957('0x3b')](db[_0xd957('0x37')][_0xd957('0x26')]);_0x44c2f9[_0xd957('0x29')]=_[_0xd957('0x3b')](_0x2fe836['query']);_0x44c2f9['filters']=_['intersection'](_0x44c2f9[_0xd957('0x28')],_0x44c2f9['query']);_0x489219[_0xd957('0x2c')]=_[_0xd957('0x2b')](_0x44c2f9['model'],qs[_0xd957('0x2d')](_0x2fe836['query'][_0xd957('0x2d')]));_0x489219[_0xd957('0x2c')]=_0x489219['attributes'][_0xd957('0x2e')]?_0x489219[_0xd957('0x2c')]:_0x44c2f9[_0xd957('0x28')];if(_0x2fe836[_0xd957('0x29')][_0xd957('0x3c')]){_0x489219['include']=[{'all':!![]}];}_0x489219=_['merge']({},_0x489219,_0x2fe836[_0xd957('0x36')]);return db['FreshsalesField'][_0xd957('0x3d')](_0x489219)['then'](handleEntityNotFound(_0x2a3531,null))[_0xd957('0x1f')](respondWithResult(_0x2a3531,null))[_0xd957('0x38')](handleError(_0x2a3531,null));};exports[_0xd957('0x3e')]=function(_0x2860ee,_0x2ae5b4){return db[_0xd957('0x37')][_0xd957('0x3e')](_0x2860ee['body'],{})[_0xd957('0x1f')](respondWithResult(_0x2ae5b4,0xc9))[_0xd957('0x38')](handleError(_0x2ae5b4,null));};exports['update']=function(_0x4aa7a1,_0x49f468){if(_0x4aa7a1['body']['id']){delete _0x4aa7a1[_0xd957('0x3f')]['id'];}return db[_0xd957('0x37')][_0xd957('0x3d')]({'where':{'id':_0x4aa7a1[_0xd957('0x3a')]['id']}})['then'](handleEntityNotFound(_0x49f468,null))[_0xd957('0x1f')](saveUpdates(_0x4aa7a1[_0xd957('0x3f')],null))[_0xd957('0x1f')](respondWithResult(_0x49f468,null))[_0xd957('0x38')](handleError(_0x49f468,null));};exports[_0xd957('0x40')]=function(_0x3b4d51,_0x20a06a){return db[_0xd957('0x37')][_0xd957('0x3d')]({'where':{'id':_0x3b4d51[_0xd957('0x3a')]['id']}})[_0xd957('0x1f')](handleEntityNotFound(_0x20a06a,null))[_0xd957('0x1f')](removeEntity(_0x20a06a,null))[_0xd957('0x38')](handleError(_0x20a06a,null));}; \ No newline at end of file +var _0x534d=['offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x1dfe96,_0xacd7bf){var _0x23bb8a=function(_0x2f9f1a){while(--_0x2f9f1a){_0x1dfe96['push'](_0x1dfe96['shift']());}};_0x23bb8a(++_0xacd7bf);}(_0x534d,0x115));var _0xd534=function(_0x5aa564,_0x1d2d2e){_0x5aa564=_0x5aa564-0x0;var _0x50fb7c=_0x534d[_0x5aa564];return _0x50fb7c;};'use strict';var emlformat=require(_0xd534('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd534('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd534('0x2'));var moment=require(_0xd534('0x3'));var BPromise=require(_0xd534('0x4'));var Mustache=require(_0xd534('0x5'));var util=require(_0xd534('0x6'));var path=require(_0xd534('0x7'));var sox=require(_0xd534('0x8'));var csv=require('to-csv');var ejs=require(_0xd534('0x9'));var fs=require('fs');var fs_extra=require(_0xd534('0xa'));var _=require(_0xd534('0xb'));var squel=require(_0xd534('0xc'));var crypto=require(_0xd534('0xd'));var jsforce=require(_0xd534('0xe'));var deskjs=require(_0xd534('0xf'));var toCsv=require(_0xd534('0x10'));var querystring=require(_0xd534('0x11'));var Papa=require(_0xd534('0x12'));var Redis=require(_0xd534('0x13'));var authService=require(_0xd534('0x14'));var qs=require(_0xd534('0x15'));var as=require(_0xd534('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd534('0x17'))(_0xd534('0x18'));var utils=require(_0xd534('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd534('0x1a'));var db=require(_0xd534('0x1b'))['db'];function respondWithStatusCode(_0x50a891,_0x56a972){_0x56a972=_0x56a972||0xcc;return function(_0x2a6a34){if(_0x2a6a34){return _0x50a891[_0xd534('0x1c')](_0x56a972);}return _0x50a891[_0xd534('0x1d')](_0x56a972)['end']();};}function respondWithResult(_0x1e5975,_0xbbf37d){_0xbbf37d=_0xbbf37d||0xc8;return function(_0x2ea306){if(_0x2ea306){return _0x1e5975[_0xd534('0x1d')](_0xbbf37d)[_0xd534('0x1e')](_0x2ea306);}};}function respondWithFilteredResult(_0x41a5e8,_0x18a069){return function(_0x3086b8){if(_0x3086b8){var _0x2430ac=typeof _0x18a069[_0xd534('0x1f')]===_0xd534('0x20')&&typeof _0x18a069[_0xd534('0x21')]===_0xd534('0x20');var _0x2320c4=_0x3086b8['count'];var _0x2cc699=_0x2430ac?0x0:_0x18a069[_0xd534('0x1f')];var _0xfe3dfd=_0x2430ac?_0x3086b8[_0xd534('0x22')]:_0x18a069['offset']+_0x18a069[_0xd534('0x21')];var _0x2926d5;if(_0xfe3dfd>=_0x2320c4){_0xfe3dfd=_0x2320c4;_0x2926d5=0xc8;}else{_0x2926d5=0xce;}_0x41a5e8['status'](_0x2926d5);return _0x41a5e8[_0xd534('0x23')](_0xd534('0x24'),_0x2cc699+'-'+_0xfe3dfd+'/'+_0x2320c4)[_0xd534('0x1e')](_0x3086b8);}return null;};}function patchUpdates(_0x6ce7cd){return function(_0x22443f){try{jsonpatch[_0xd534('0x25')](_0x22443f,_0x6ce7cd,!![]);}catch(_0x23fff2){return BPromise['reject'](_0x23fff2);}return _0x22443f['save']();};}function saveUpdates(_0x39d519,_0x1dfa0f){return function(_0x4488c5){if(_0x4488c5){return _0x4488c5[_0xd534('0x26')](_0x39d519)[_0xd534('0x27')](function(_0x295f4a){return _0x295f4a;});}return null;};}function removeEntity(_0x276ea5,_0x104009){return function(_0x2da2df){if(_0x2da2df){return _0x2da2df[_0xd534('0x28')]()['then'](function(){_0x276ea5[_0xd534('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320953,_0x4c1fb5){return function(_0x1ba12c){if(!_0x1ba12c){_0x320953['sendStatus'](0x194);}return _0x1ba12c;};}function handleError(_0x23121f,_0x2c10fa){_0x2c10fa=_0x2c10fa||0x1f4;return function(_0x14690c){logger[_0xd534('0x29')](_0x14690c[_0xd534('0x2a')]);if(_0x14690c[_0xd534('0x2b')]){delete _0x14690c[_0xd534('0x2b')];}_0x23121f['status'](_0x2c10fa)['send'](_0x14690c);};}exports[_0xd534('0x2c')]=function(_0x5ec7ef,_0x318efb){var _0x116b5e={},_0x2ee99b={},_0x40a4f1={'count':0x0,'rows':[]};var _0xe4b5b0=_['map'](db[_0xd534('0x2d')][_0xd534('0x2e')],function(_0x3b5d4f){return{'name':_0x3b5d4f[_0xd534('0x2f')],'type':_0x3b5d4f[_0xd534('0x30')][_0xd534('0x31')]};});_0x2ee99b[_0xd534('0x32')]=_[_0xd534('0x33')](_0xe4b5b0,_0xd534('0x2b'));_0x2ee99b[_0xd534('0x34')]=_[_0xd534('0x35')](_0x5ec7ef['query']);_0x2ee99b['filters']=_['intersection'](_0x2ee99b[_0xd534('0x32')],_0x2ee99b[_0xd534('0x34')]);_0x116b5e[_0xd534('0x36')]=_[_0xd534('0x37')](_0x2ee99b['model'],qs[_0xd534('0x38')](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x38')]));_0x116b5e[_0xd534('0x36')]=_0x116b5e['attributes'][_0xd534('0x39')]?_0x116b5e[_0xd534('0x36')]:_0x2ee99b['model'];if(!_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3a')]('nolimit')){_0x116b5e[_0xd534('0x21')]=qs['limit'](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x21')]);_0x116b5e['offset']=qs[_0xd534('0x1f')](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x1f')]);}_0x116b5e['order']=qs['sort'](_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3b')]);_0x116b5e[_0xd534('0x3c')]=qs['filters'](_[_0xd534('0x3d')](_0x5ec7ef[_0xd534('0x34')],_0x2ee99b[_0xd534('0x3e')]),_0xe4b5b0);if(_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3f')]){_0x116b5e[_0xd534('0x3c')]=_[_0xd534('0x40')](_0x116b5e[_0xd534('0x3c')],{'$or':_['map'](_0xe4b5b0,function(_0x6e264){if(_0x6e264[_0xd534('0x30')]!==_0xd534('0x41')){var _0x43ffac={};_0x43ffac[_0x6e264[_0xd534('0x2b')]]={'$like':'%'+_0x5ec7ef[_0xd534('0x34')][_0xd534('0x3f')]+'%'};return _0x43ffac;}})});}_0x116b5e=_[_0xd534('0x40')]({},_0x116b5e,_0x5ec7ef[_0xd534('0x42')]);var _0x557aa7={'where':_0x116b5e[_0xd534('0x3c')]};return db['FreshsalesField'][_0xd534('0x22')](_0x557aa7)[_0xd534('0x27')](function(_0x384863){_0x40a4f1[_0xd534('0x22')]=_0x384863;if(_0x5ec7ef['query'][_0xd534('0x43')]){_0x116b5e[_0xd534('0x44')]=[{'all':!![]}];}return db[_0xd534('0x2d')][_0xd534('0x45')](_0x116b5e);})[_0xd534('0x27')](function(_0x52dbca){_0x40a4f1[_0xd534('0x46')]=_0x52dbca;return _0x40a4f1;})['then'](respondWithFilteredResult(_0x318efb,_0x116b5e))['catch'](handleError(_0x318efb,null));};exports[_0xd534('0x47')]=function(_0x4858c1,_0x379be5){var _0x21e070={'raw':!![],'where':{'id':_0x4858c1[_0xd534('0x48')]['id']}},_0xac3a46={};_0xac3a46['model']=_[_0xd534('0x35')](db[_0xd534('0x2d')][_0xd534('0x2e')]);_0xac3a46[_0xd534('0x34')]=_['keys'](_0x4858c1[_0xd534('0x34')]);_0xac3a46[_0xd534('0x3e')]=_[_0xd534('0x37')](_0xac3a46[_0xd534('0x32')],_0xac3a46[_0xd534('0x34')]);_0x21e070[_0xd534('0x36')]=_['intersection'](_0xac3a46['model'],qs[_0xd534('0x38')](_0x4858c1[_0xd534('0x34')][_0xd534('0x38')]));_0x21e070[_0xd534('0x36')]=_0x21e070[_0xd534('0x36')][_0xd534('0x39')]?_0x21e070['attributes']:_0xac3a46[_0xd534('0x32')];if(_0x4858c1['query'][_0xd534('0x43')]){_0x21e070[_0xd534('0x44')]=[{'all':!![]}];}_0x21e070=_[_0xd534('0x40')]({},_0x21e070,_0x4858c1[_0xd534('0x42')]);return db['FreshsalesField']['find'](_0x21e070)[_0xd534('0x27')](handleEntityNotFound(_0x379be5,null))[_0xd534('0x27')](respondWithResult(_0x379be5,null))['catch'](handleError(_0x379be5,null));};exports[_0xd534('0x49')]=function(_0x6062a4,_0x59f2a4){return db[_0xd534('0x2d')][_0xd534('0x49')](_0x6062a4[_0xd534('0x4a')],{})[_0xd534('0x27')](respondWithResult(_0x59f2a4,0xc9))[_0xd534('0x4b')](handleError(_0x59f2a4,null));};exports['update']=function(_0x5cb2a1,_0x5006eb){if(_0x5cb2a1['body']['id']){delete _0x5cb2a1[_0xd534('0x4a')]['id'];}return db[_0xd534('0x2d')][_0xd534('0x4c')]({'where':{'id':_0x5cb2a1[_0xd534('0x48')]['id']}})[_0xd534('0x27')](handleEntityNotFound(_0x5006eb,null))['then'](saveUpdates(_0x5cb2a1[_0xd534('0x4a')],null))[_0xd534('0x27')](respondWithResult(_0x5006eb,null))[_0xd534('0x4b')](handleError(_0x5006eb,null));};exports[_0xd534('0x28')]=function(_0x17c055,_0x4f9ba6){return db[_0xd534('0x2d')]['find']({'where':{'id':_0x17c055['params']['id']}})['then'](handleEntityNotFound(_0x4f9ba6,null))['then'](removeEntity(_0x4f9ba6,null))[_0xd534('0x4b')](handleError(_0x4f9ba6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 97ac472..27a8720 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 _0xdd4f=['lodash','moment','bluebird','path','rimraf','../../config/environment','exports','define','FreshsalesField','freshsales_unique_index','FieldId'];(function(_0x34f235,_0x51a088){var _0x4bbd8f=function(_0x1d8952){while(--_0x1d8952){_0x34f235['push'](_0x34f235['shift']());}};_0x4bbd8f(++_0x51a088);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x23465c,_0x2e4d9){_0x23465c=_0x23465c-0x0;var _0x284097=_0xdd4f[_0x23465c];return _0x284097;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xfdd4('0x9'),'fields':['idField',_0xfdd4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab75=['idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xab75,0x11f));var _0x5ab7=function(_0xa49388,_0x10ee55){_0xa49388=_0xa49388-0x0;var _0x3fd080=_0xab75[_0xa49388];return _0x3fd080;};'use strict';var _=require(_0x5ab7('0x0'));var util=require(_0x5ab7('0x1'));var logger=require(_0x5ab7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ab7('0x3'));var rp=require(_0x5ab7('0x4'));var fs=require('fs');var path=require(_0x5ab7('0x5'));var rimraf=require('rimraf');var config=require(_0x5ab7('0x6'));var attributes=require(_0x5ab7('0x7'));module[_0x5ab7('0x8')]=function(_0x3e1c7e,_0x406ca2){return _0x3e1c7e[_0x5ab7('0x9')](_0x5ab7('0xa'),attributes,{'tableName':_0x5ab7('0xb'),'paranoid':![],'indexes':[{'name':_0x5ab7('0xc'),'fields':[_0x5ab7('0xd'),_0x5ab7('0xe')],'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 ec9a339..397e8ae 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0xadb5,0xad));var _0x5adb=function(_0x3cf786,_0x1ffb8b){_0x3cf786=_0x3cf786-0x0;var _0x2ac297=_0xadb5[_0x3cf786];return _0x2ac297;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x20299d,_0xa4c6bc){var _0x15176e=function(_0xa61da0){while(--_0xa61da0){_0x20299d['push'](_0x20299d['shift']());}};_0x15176e(++_0xa4c6bc);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x39317f,_0x3d03ba){_0x39317f=_0x39317f-0x0;var _0x259bb2=_0xdbf5[_0x39317f];return _0x259bb2;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index cee1355..736d7ca 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x323604,_0x48a294){var _0x4531d0=function(_0x1c9793){while(--_0x1c9793){_0x323604['push'](_0x323604['shift']());}};_0x4531d0(++_0x48a294);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x695ac0,_0x2dd007){var _0x241f9e=function(_0x5ec1f7){while(--_0x5ec1f7){_0x695ac0['push'](_0x695ac0['shift']());}};_0x241f9e(++_0x2dd007);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 90232af..cb6da01 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 _0xf90c=['exports','STRING','username','ENUM','newTab','sequelize'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xf90c,0x1a9));var _0xcf90=function(_0xe36907,_0x576722){_0xe36907=_0xe36907-0x0;var _0x2a7694=_0xf90c[_0xe36907];return _0x2a7694;};'use strict';var Sequelize=require(_0xcf90('0x0'));module[_0xcf90('0x1')]={'name':{'type':Sequelize[_0xcf90('0x2')]},'description':{'type':Sequelize[_0xcf90('0x2')]},'username':{'type':Sequelize[_0xcf90('0x2')],'unique':_0xcf90('0x3')},'remoteUri':{'type':Sequelize[_0xcf90('0x2')]},'password':{'type':Sequelize[_0xcf90('0x2')]},'clientId':{'type':Sequelize[_0xcf90('0x2')]},'clientSecret':{'type':Sequelize[_0xcf90('0x2')]},'securityToken':{'type':Sequelize[_0xcf90('0x2')]},'serverUrl':{'type':Sequelize[_0xcf90('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcf90('0x4')]('integrationTab',_0xcf90('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x94ff=['sequelize','STRING','username','ENUM','newTab'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x94ff,0xc3));var _0xf94f=function(_0x3d5fa3,_0x101bc3){_0x3d5fa3=_0x3d5fa3-0x0;var _0x47bc57=_0x94ff[_0x3d5fa3];return _0x47bc57;};'use strict';var Sequelize=require(_0xf94f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf94f('0x1')],'unique':_0xf94f('0x2')},'remoteUri':{'type':Sequelize[_0xf94f('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf94f('0x1')]},'clientSecret':{'type':Sequelize[_0xf94f('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf94f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf94f('0x3')]('integrationTab',_0xf94f('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9ddc128..012f0fa 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 _0x04ca=['SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientSecret','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','True','true','false','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','SalesforceAccount','fieldName','type','query','attributes','intersection','model','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','body','getConfigurations','order','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x49e1d5,_0x30d540){var _0x303960=function(_0x39b8a8){while(--_0x39b8a8){_0x49e1d5['push'](_0x49e1d5['shift']());}};_0x303960(++_0x30d540);}(_0x04ca,0x125));var _0xa04c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x04ca[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa04c('0x0'));var zipdir=require(_0xa04c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa04c('0x2'));var moment=require(_0xa04c('0x3'));var BPromise=require(_0xa04c('0x4'));var Mustache=require(_0xa04c('0x5'));var util=require(_0xa04c('0x6'));var path=require(_0xa04c('0x7'));var sox=require(_0xa04c('0x8'));var csv=require(_0xa04c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa04c('0xa'));var _=require(_0xa04c('0xb'));var squel=require(_0xa04c('0xc'));var crypto=require(_0xa04c('0xd'));var jsforce=require(_0xa04c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa04c('0x9'));var querystring=require(_0xa04c('0xf'));var Papa=require(_0xa04c('0x10'));var Redis=require(_0xa04c('0x11'));var authService=require(_0xa04c('0x12'));var qs=require(_0xa04c('0x13'));var as=require(_0xa04c('0x14'));var hardwareService=require(_0xa04c('0x15'));var logger=require(_0xa04c('0x16'))(_0xa04c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa04c('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xbb512e,_0x2516d2){_0x2516d2=_0x2516d2||0xcc;return function(_0x21c78c){if(_0x21c78c){return _0xbb512e[_0xa04c('0x19')](_0x2516d2);}return _0xbb512e[_0xa04c('0x1a')](_0x2516d2)[_0xa04c('0x1b')]();};}function respondWithResult(_0x18eed2,_0x5bea8c){_0x5bea8c=_0x5bea8c||0xc8;return function(_0x51bed9){if(_0x51bed9){return _0x18eed2[_0xa04c('0x1a')](_0x5bea8c)[_0xa04c('0x1c')](_0x51bed9);}};}function respondWithFilteredResult(_0x278283,_0x2fbf72){return function(_0x515a4d){if(_0x515a4d){var _0xf537db=typeof _0x2fbf72['offset']===_0xa04c('0x1d')&&typeof _0x2fbf72[_0xa04c('0x1e')]===_0xa04c('0x1d');var _0x593913=_0x515a4d[_0xa04c('0x1f')];var _0x147bbb=_0xf537db?0x0:_0x2fbf72[_0xa04c('0x20')];var _0x1c11f9=_0xf537db?_0x515a4d[_0xa04c('0x1f')]:_0x2fbf72[_0xa04c('0x20')]+_0x2fbf72[_0xa04c('0x1e')];var _0x1881b2;if(_0x1c11f9>=_0x593913){_0x1c11f9=_0x593913;_0x1881b2=0xc8;}else{_0x1881b2=0xce;}_0x278283['status'](_0x1881b2);return _0x278283[_0xa04c('0x21')](_0xa04c('0x22'),_0x147bbb+'-'+_0x1c11f9+'/'+_0x593913)[_0xa04c('0x1c')](_0x515a4d);}return null;};}function patchUpdates(_0x4148b0){return function(_0x177df9){try{jsonpatch[_0xa04c('0x23')](_0x177df9,_0x4148b0,!![]);}catch(_0x2785c4){return BPromise[_0xa04c('0x24')](_0x2785c4);}return _0x177df9[_0xa04c('0x25')]();};}function saveUpdates(_0x49acc0,_0x26e9b0){return function(_0x2575e0){if(_0x2575e0){return _0x2575e0[_0xa04c('0x26')](_0x49acc0)[_0xa04c('0x27')](function(_0x465f71){return _0x465f71;});}return null;};}function removeEntity(_0x5e0559,_0x1ad290){return function(_0x2e334d){if(_0x2e334d){return _0x2e334d['destroy']()['then'](function(){_0x5e0559[_0xa04c('0x1a')](0xcc)[_0xa04c('0x1b')]();});}};}function handleEntityNotFound(_0x2c0744,_0x4222b1){return function(_0x53051e){if(!_0x53051e){_0x2c0744[_0xa04c('0x19')](0x194);}return _0x53051e;};}function handleError(_0x177cd8,_0x546e3e){_0x546e3e=_0x546e3e||0x1f4;return function(_0x32db54){logger[_0xa04c('0x28')](_0x32db54['stack']);if(_0x32db54['name']){delete _0x32db54[_0xa04c('0x29')];}_0x177cd8[_0xa04c('0x1a')](_0x546e3e)[_0xa04c('0x2a')](_0x32db54);};}exports[_0xa04c('0x2b')]=function(_0x8facb9,_0x1fac8f){var _0x17d031={},_0x215ab1={},_0x5530ae={'count':0x0,'rows':[]};var _0x48a299=_[_0xa04c('0x2c')](db[_0xa04c('0x2d')]['rawAttributes'],function(_0x1450cc){return{'name':_0x1450cc[_0xa04c('0x2e')],'type':_0x1450cc[_0xa04c('0x2f')]['key']};});_0x215ab1['model']=_[_0xa04c('0x2c')](_0x48a299,_0xa04c('0x29'));_0x215ab1[_0xa04c('0x30')]=_['keys'](_0x8facb9[_0xa04c('0x30')]);_0x215ab1['filters']=_['intersection'](_0x215ab1['model'],_0x215ab1['query']);_0x17d031[_0xa04c('0x31')]=_[_0xa04c('0x32')](_0x215ab1[_0xa04c('0x33')],qs[_0xa04c('0x34')](_0x8facb9[_0xa04c('0x30')][_0xa04c('0x34')]));_0x17d031[_0xa04c('0x31')]=_0x17d031[_0xa04c('0x31')][_0xa04c('0x35')]?_0x17d031[_0xa04c('0x31')]:_0x215ab1['model'];if(!_0x8facb9[_0xa04c('0x30')]['hasOwnProperty']('nolimit')){_0x17d031[_0xa04c('0x1e')]=qs[_0xa04c('0x1e')](_0x8facb9[_0xa04c('0x30')][_0xa04c('0x1e')]);_0x17d031[_0xa04c('0x20')]=qs[_0xa04c('0x20')](_0x8facb9[_0xa04c('0x30')][_0xa04c('0x20')]);}_0x17d031['order']=qs['sort'](_0x8facb9[_0xa04c('0x30')][_0xa04c('0x36')]);_0x17d031[_0xa04c('0x37')]=qs[_0xa04c('0x38')](_[_0xa04c('0x39')](_0x8facb9[_0xa04c('0x30')],_0x215ab1[_0xa04c('0x38')]),_0x48a299);if(_0x8facb9['query'][_0xa04c('0x3a')]){_0x17d031[_0xa04c('0x37')]=_[_0xa04c('0x3b')](_0x17d031[_0xa04c('0x37')],{'$or':_['map'](_0x48a299,function(_0x21515c){if(_0x21515c[_0xa04c('0x2f')]!==_0xa04c('0x3c')){var _0x37cab2={};_0x37cab2[_0x21515c['name']]={'$like':'%'+_0x8facb9[_0xa04c('0x30')][_0xa04c('0x3a')]+'%'};return _0x37cab2;}})});}_0x17d031=_['merge']({},_0x17d031,_0x8facb9['options']);var _0x26e5bf={'where':_0x17d031['where']};return db[_0xa04c('0x2d')][_0xa04c('0x1f')](_0x26e5bf)[_0xa04c('0x27')](function(_0x3751a3){_0x5530ae[_0xa04c('0x1f')]=_0x3751a3;if(_0x8facb9[_0xa04c('0x30')][_0xa04c('0x3d')]){_0x17d031['include']=[{'all':!![]}];}return db[_0xa04c('0x2d')][_0xa04c('0x3e')](_0x17d031);})['then'](function(_0x53c200){_0x5530ae[_0xa04c('0x3f')]=_0x53c200;return _0x5530ae;})[_0xa04c('0x27')](respondWithFilteredResult(_0x1fac8f,_0x17d031))[_0xa04c('0x40')](handleError(_0x1fac8f,null));};exports[_0xa04c('0x41')]=function(_0x4313d5,_0x35018f){var _0x36cdd8={'raw':![],'where':{'id':_0x4313d5[_0xa04c('0x42')]['id']}},_0x349fe4={};_0x349fe4['model']=_[_0xa04c('0x43')](db[_0xa04c('0x2d')][_0xa04c('0x44')]);_0x349fe4[_0xa04c('0x30')]=_[_0xa04c('0x43')](_0x4313d5[_0xa04c('0x30')]);_0x349fe4[_0xa04c('0x38')]=_[_0xa04c('0x32')](_0x349fe4[_0xa04c('0x33')],_0x349fe4[_0xa04c('0x30')]);_0x36cdd8[_0xa04c('0x31')]=_['intersection'](_0x349fe4[_0xa04c('0x33')],qs[_0xa04c('0x34')](_0x4313d5[_0xa04c('0x30')][_0xa04c('0x34')]));_0x36cdd8[_0xa04c('0x31')]=_0x36cdd8['attributes']['length']?_0x36cdd8[_0xa04c('0x31')]:_0x349fe4['model'];if(_0x4313d5[_0xa04c('0x30')]['includeAll']){_0x36cdd8[_0xa04c('0x45')]=[{'all':!![]}];}_0x36cdd8=_[_0xa04c('0x3b')]({},_0x36cdd8,_0x4313d5[_0xa04c('0x46')]);return db[_0xa04c('0x2d')][_0xa04c('0x47')](_0x36cdd8)[_0xa04c('0x27')](handleEntityNotFound(_0x35018f,null))['then'](respondWithResult(_0x35018f,null))[_0xa04c('0x40')](handleError(_0x35018f,null));};exports[_0xa04c('0x48')]=function(_0x55a907,_0x46f271){return db[_0xa04c('0x2d')][_0xa04c('0x48')](_0x55a907['body'],{})['then'](respondWithResult(_0x46f271,0xc9))[_0xa04c('0x40')](handleError(_0x46f271,null));};exports[_0xa04c('0x26')]=function(_0x58452c,_0x3da839){if(_0x58452c[_0xa04c('0x49')]['id']){delete _0x58452c[_0xa04c('0x49')]['id'];}return db[_0xa04c('0x2d')][_0xa04c('0x47')]({'where':{'id':_0x58452c['params']['id']}})[_0xa04c('0x27')](handleEntityNotFound(_0x3da839,null))[_0xa04c('0x27')](saveUpdates(_0x58452c['body'],null))[_0xa04c('0x27')](respondWithResult(_0x3da839,null))[_0xa04c('0x40')](handleError(_0x3da839,null));};exports['destroy']=function(_0x7dc2b8,_0x46e33c){return db[_0xa04c('0x2d')][_0xa04c('0x47')]({'where':{'id':_0x7dc2b8['params']['id']}})[_0xa04c('0x27')](handleEntityNotFound(_0x46e33c,null))['then'](removeEntity(_0x46e33c,null))['catch'](handleError(_0x46e33c,null));};exports[_0xa04c('0x4a')]=function(_0x32ee8e,_0x274d46,_0x1a8f1b){var _0x51f232={};var _0x3b73ea={};var _0x38fc55;var _0x108ec7;return db[_0xa04c('0x2d')]['findOne']({'where':{'id':_0x32ee8e[_0xa04c('0x42')]['id']}})[_0xa04c('0x27')](handleEntityNotFound(_0x274d46,null))[_0xa04c('0x27')](function(_0x4df2c7){if(_0x4df2c7){_0x38fc55=_0x4df2c7;_0x3b73ea[_0xa04c('0x33')]=_['keys'](db['SalesforceConfiguration'][_0xa04c('0x44')]);_0x3b73ea[_0xa04c('0x30')]=_[_0xa04c('0x43')](_0x32ee8e[_0xa04c('0x30')]);_0x3b73ea['filters']=_[_0xa04c('0x32')](_0x3b73ea[_0xa04c('0x33')],_0x3b73ea[_0xa04c('0x30')]);_0x51f232[_0xa04c('0x31')]=_['intersection'](_0x3b73ea[_0xa04c('0x33')],qs[_0xa04c('0x34')](_0x32ee8e[_0xa04c('0x30')][_0xa04c('0x34')]));_0x51f232[_0xa04c('0x31')]=_0x51f232[_0xa04c('0x31')][_0xa04c('0x35')]?_0x51f232[_0xa04c('0x31')]:_0x3b73ea['model'];_0x51f232[_0xa04c('0x4b')]=qs['sort'](_0x32ee8e['query'][_0xa04c('0x36')]);_0x51f232[_0xa04c('0x37')]=qs[_0xa04c('0x38')](_[_0xa04c('0x39')](_0x32ee8e[_0xa04c('0x30')],_0x3b73ea['filters']));if(_0x32ee8e[_0xa04c('0x30')][_0xa04c('0x3a')]){_0x51f232['where']=_[_0xa04c('0x3b')](_0x51f232[_0xa04c('0x37')],{'$or':_[_0xa04c('0x2c')](_0x51f232['attributes'],function(_0x3cf5b7){var _0x680cfa={};_0x680cfa[_0x3cf5b7]={'$like':'%'+_0x32ee8e[_0xa04c('0x30')][_0xa04c('0x3a')]+'%'};return _0x680cfa;})});}_0x51f232=_[_0xa04c('0x3b')]({},_0x51f232,_0x32ee8e[_0xa04c('0x46')]);return _0x38fc55[_0xa04c('0x4a')](_0x51f232);}})['then'](function(_0x89a95){if(_0x89a95){_0x108ec7=_0x89a95[_0xa04c('0x35')];if(!_0x32ee8e['query'][_0xa04c('0x4c')]('nolimit')){_0x51f232[_0xa04c('0x1e')]=qs[_0xa04c('0x1e')](_0x32ee8e[_0xa04c('0x30')]['limit']);_0x51f232[_0xa04c('0x20')]=qs[_0xa04c('0x20')](_0x32ee8e[_0xa04c('0x30')]['offset']);}return _0x38fc55['getConfigurations'](_0x51f232);}})[_0xa04c('0x27')](function(_0xb749c6){if(_0xb749c6){return _0xb749c6?{'count':_0x108ec7,'rows':_0xb749c6}:null;}})[_0xa04c('0x27')](respondWithResult(_0x274d46,null))[_0xa04c('0x40')](handleError(_0x274d46,null));};exports[_0xa04c('0x4d')]=function(_0x4aa6b2,_0x41bda0,_0x20e7e6){if(_0x4aa6b2[_0xa04c('0x49')]['id']){delete _0x4aa6b2[_0xa04c('0x49')]['id'];}return db[_0xa04c('0x2d')][_0xa04c('0x4e')]({'where':{'id':_0x4aa6b2[_0xa04c('0x42')]['id']}})[_0xa04c('0x27')](handleEntityNotFound(_0x41bda0,null))['then'](function(_0x1c66d3){if(_0x1c66d3){_0x4aa6b2[_0xa04c('0x49')][_0xa04c('0x4f')]=_0x1c66d3['id'];_0x4aa6b2[_0xa04c('0x49')][_0xa04c('0x50')]=integrations[_0xa04c('0x51')](_0x4aa6b2[_0xa04c('0x49')][_0xa04c('0x52')],_0x4aa6b2[_0xa04c('0x49')]['type']);_0x4aa6b2['body'][_0xa04c('0x53')]=integrations[_0xa04c('0x54')](_0x4aa6b2[_0xa04c('0x49')][_0xa04c('0x52')],_0x4aa6b2[_0xa04c('0x49')][_0xa04c('0x2f')]);return db[_0xa04c('0x55')][_0xa04c('0x48')](_0x4aa6b2['body'],{'include':[{'model':db[_0xa04c('0x56')],'as':_0xa04c('0x50')},{'model':db[_0xa04c('0x56')],'as':_0xa04c('0x53')}]});}return null;})[_0xa04c('0x27')](respondWithResult(_0x41bda0,null))['catch'](handleError(_0x41bda0,null));};exports[_0xa04c('0x57')]=function(_0x96e55d,_0x560942,_0x138d9a){var _0x22568f;var _0x492e29='';var _0xfcd5ca=_0xa04c('0x58');return db[_0xa04c('0x2d')][_0xa04c('0x4e')]({'where':{'id':_0x96e55d['params']['id']},'attributes':['id',_0xa04c('0x59'),'clientId',_0xa04c('0x5a'),'username',_0xa04c('0x5b'),_0xa04c('0x5c')]})[_0xa04c('0x27')](handleEntityNotFound(_0x560942,null))[_0xa04c('0x27')](function(_0x5e179d){if(_0x5e179d){_0x492e29=_0x5e179d[_0xa04c('0x59')];var _0x3437b4=_0x492e29['slice'](-0x1);if(_0x3437b4==='/'){_0x492e29=_0x492e29[_0xa04c('0x5d')](0x0,_0x492e29[_0xa04c('0x5e')](_0x3437b4));}_0x22568f=new jsforce[(_0xa04c('0x5f'))]({'oauth2':{'loginUrl':_0x492e29,'clientId':_0x5e179d['clientId'],'clientSecret':_0x5e179d[_0xa04c('0x5a')]}});return _0x22568f[_0xa04c('0x60')](_0x5e179d['username'],_0x5e179d[_0xa04c('0x5b')][_0xa04c('0x61')](_0x5e179d[_0xa04c('0x5c')]));}})[_0xa04c('0x27')](function(_0x3e071f){if(_0x3e071f){if(!_[_0xa04c('0x62')](_0x96e55d['query'][_0xa04c('0x63')])){_0xfcd5ca=_0x96e55d['query'][_0xa04c('0x63')];}return _0x22568f[_0xa04c('0x64')](_0xfcd5ca)[_0xa04c('0x65')]();}})[_0xa04c('0x27')](function(_0x5d4065){var _0x2d3088=[_0xa04c('0x66'),'ActivityDate',_0xa04c('0x67'),_0xa04c('0x68'),_0xa04c('0x69'),_0xa04c('0x6a')];var _0x407951=[_0xa04c('0x6b'),_0xa04c('0x6c'),_0xa04c('0x6d'),_0xa04c('0x6e'),_0xa04c('0x6f'),_0xa04c('0x70'),_0xa04c('0x71')];if(_0x5d4065){_[_0xa04c('0x72')](_0x5d4065[_0xa04c('0x34')],function(_0x38d2f9){return _0x2d3088[_0xa04c('0x73')](_0x38d2f9[_0xa04c('0x29')])||!_0x407951[_0xa04c('0x73')](_0x38d2f9[_0xa04c('0x2f')]);});return{'count':_0x5d4065['fields'][_0xa04c('0x35')],'rows':_[_0xa04c('0x2c')](_0x5d4065[_0xa04c('0x34')],function(_0x4a60f5){return{'id':_0x4a60f5['name'],'name':_0x4a60f5['label'],'custom':_0x4a60f5[_0xa04c('0x74')],'options':_0x4a60f5['picklistValues']['length']>0x0?_['map'](_0x4a60f5[_0xa04c('0x75')],function(_0x1b3a57){return{'name':_0x1b3a57[_0xa04c('0x76')],'value':_0x1b3a57['value']};}):_0x4a60f5['type']=='boolean'?[{'name':_0xa04c('0x77'),'value':_0xa04c('0x78')},{'name':'False','value':_0xa04c('0x79')}]:[]};})};}})['then'](respondWithResult(_0x560942,null))['catch'](function(_0x4911e2){var _0x5d0f80=_0x96e55d[_0xa04c('0x30')][_0xa04c('0x7a')]?0x1f4:_0x4911e2[_0xa04c('0x7b')]||0x1f4;logger[_0xa04c('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xa04c('0x57'),_0x5d0f80,JSON[_0xa04c('0x7c')](_0x4911e2));delete _0x4911e2[_0xa04c('0x29')];if(_0x5d0f80===0x191){_0x5d0f80=0x190;}_0x560942[_0xa04c('0x1a')](_0x5d0f80)['send'](_0x96e55d['query'][_0xa04c('0x7a')]?{'message':_0xa04c('0x7d'),'statusCode':_0x4911e2[_0xa04c('0x7b')]}:_0x4911e2);});}; \ No newline at end of file +var _0x49cb=['map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','then','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','filters','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','string','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','boolean','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','end','error','name','send'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x49cb,0x1c3));var _0xb49c=function(_0x11e7b5,_0x43842b){_0x11e7b5=_0x11e7b5-0x0;var _0x16b415=_0x49cb[_0x11e7b5];return _0x16b415;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb49c('0x0'));var zipdir=require(_0xb49c('0x1'));var jsonpatch=require(_0xb49c('0x2'));var rp=require(_0xb49c('0x3'));var moment=require(_0xb49c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb49c('0x5'));var util=require(_0xb49c('0x6'));var path=require(_0xb49c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb49c('0x8'));var fs=require('fs');var fs_extra=require(_0xb49c('0x9'));var _=require('lodash');var squel=require(_0xb49c('0xa'));var crypto=require(_0xb49c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb49c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb49c('0xd'));var Papa=require(_0xb49c('0xe'));var Redis=require(_0xb49c('0xf'));var authService=require(_0xb49c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb49c('0x11'))(_0xb49c('0x12'));var utils=require(_0xb49c('0x13'));var config=require(_0xb49c('0x14'));var licenseUtil=require(_0xb49c('0x15'));var db=require(_0xb49c('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcb4104,_0x3a2e48){_0x3a2e48=_0x3a2e48||0xcc;return function(_0xc49015){if(_0xc49015){return _0xcb4104[_0xb49c('0x17')](_0x3a2e48);}return _0xcb4104[_0xb49c('0x18')](_0x3a2e48)['end']();};}function respondWithResult(_0x497171,_0x4a0a0c){_0x4a0a0c=_0x4a0a0c||0xc8;return function(_0x4bfda5){if(_0x4bfda5){return _0x497171['status'](_0x4a0a0c)['json'](_0x4bfda5);}};}function respondWithFilteredResult(_0x391fca,_0xbf89d9){return function(_0x2dca9a){if(_0x2dca9a){var _0x1381f6=typeof _0xbf89d9[_0xb49c('0x19')]==='undefined'&&typeof _0xbf89d9[_0xb49c('0x1a')]===_0xb49c('0x1b');var _0x393dc9=_0x2dca9a[_0xb49c('0x1c')];var _0x105f03=_0x1381f6?0x0:_0xbf89d9['offset'];var _0x425b20=_0x1381f6?_0x2dca9a[_0xb49c('0x1c')]:_0xbf89d9[_0xb49c('0x19')]+_0xbf89d9['limit'];var _0x2354c5;if(_0x425b20>=_0x393dc9){_0x425b20=_0x393dc9;_0x2354c5=0xc8;}else{_0x2354c5=0xce;}_0x391fca[_0xb49c('0x18')](_0x2354c5);return _0x391fca[_0xb49c('0x1d')](_0xb49c('0x1e'),_0x105f03+'-'+_0x425b20+'/'+_0x393dc9)[_0xb49c('0x1f')](_0x2dca9a);}return null;};}function patchUpdates(_0x28b4de){return function(_0x17b756){try{jsonpatch[_0xb49c('0x20')](_0x17b756,_0x28b4de,!![]);}catch(_0x14c839){return BPromise[_0xb49c('0x21')](_0x14c839);}return _0x17b756[_0xb49c('0x22')]();};}function saveUpdates(_0x138000,_0x400fe1){return function(_0x39f753){if(_0x39f753){return _0x39f753[_0xb49c('0x23')](_0x138000)['then'](function(_0x4c4a60){return _0x4c4a60;});}return null;};}function removeEntity(_0x1519ea,_0x1bcddd){return function(_0x51871e){if(_0x51871e){return _0x51871e[_0xb49c('0x24')]()['then'](function(){_0x1519ea['status'](0xcc)[_0xb49c('0x25')]();});}};}function handleEntityNotFound(_0x40d76b,_0x385040){return function(_0x209c74){if(!_0x209c74){_0x40d76b[_0xb49c('0x17')](0x194);}return _0x209c74;};}function handleError(_0x399df2,_0x52304f){_0x52304f=_0x52304f||0x1f4;return function(_0x1b6e98){logger[_0xb49c('0x26')](_0x1b6e98['stack']);if(_0x1b6e98['name']){delete _0x1b6e98[_0xb49c('0x27')];}_0x399df2[_0xb49c('0x18')](_0x52304f)[_0xb49c('0x28')](_0x1b6e98);};}exports['index']=function(_0x49ec20,_0x4b4e3b){var _0x480ea4={},_0x2b2ee2={},_0x54cb22={'count':0x0,'rows':[]};var _0x1d0018=_[_0xb49c('0x29')](db[_0xb49c('0x2a')][_0xb49c('0x2b')],function(_0x1b8c4f){return{'name':_0x1b8c4f[_0xb49c('0x2c')],'type':_0x1b8c4f[_0xb49c('0x2d')][_0xb49c('0x2e')]};});_0x2b2ee2['model']=_[_0xb49c('0x29')](_0x1d0018,_0xb49c('0x27'));_0x2b2ee2[_0xb49c('0x2f')]=_[_0xb49c('0x30')](_0x49ec20['query']);_0x2b2ee2['filters']=_[_0xb49c('0x31')](_0x2b2ee2[_0xb49c('0x32')],_0x2b2ee2[_0xb49c('0x2f')]);_0x480ea4[_0xb49c('0x33')]=_[_0xb49c('0x31')](_0x2b2ee2[_0xb49c('0x32')],qs[_0xb49c('0x34')](_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x34')]));_0x480ea4[_0xb49c('0x33')]=_0x480ea4['attributes'][_0xb49c('0x35')]?_0x480ea4['attributes']:_0x2b2ee2['model'];if(!_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x36')](_0xb49c('0x37'))){_0x480ea4[_0xb49c('0x1a')]=qs[_0xb49c('0x1a')](_0x49ec20['query'][_0xb49c('0x1a')]);_0x480ea4[_0xb49c('0x19')]=qs[_0xb49c('0x19')](_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x19')]);}_0x480ea4[_0xb49c('0x38')]=qs[_0xb49c('0x39')](_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x39')]);_0x480ea4[_0xb49c('0x3a')]=qs['filters'](_[_0xb49c('0x3b')](_0x49ec20[_0xb49c('0x2f')],_0x2b2ee2['filters']),_0x1d0018);if(_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x3c')]){_0x480ea4[_0xb49c('0x3a')]=_['merge'](_0x480ea4[_0xb49c('0x3a')],{'$or':_[_0xb49c('0x29')](_0x1d0018,function(_0x11400a){if(_0x11400a[_0xb49c('0x2d')]!==_0xb49c('0x3d')){var _0x5bbaeb={};_0x5bbaeb[_0x11400a[_0xb49c('0x27')]]={'$like':'%'+_0x49ec20[_0xb49c('0x2f')]['filter']+'%'};return _0x5bbaeb;}})});}_0x480ea4=_[_0xb49c('0x3e')]({},_0x480ea4,_0x49ec20[_0xb49c('0x3f')]);var _0x29ff35={'where':_0x480ea4['where']};return db[_0xb49c('0x2a')][_0xb49c('0x1c')](_0x29ff35)['then'](function(_0x48a821){_0x54cb22[_0xb49c('0x1c')]=_0x48a821;if(_0x49ec20[_0xb49c('0x2f')][_0xb49c('0x40')]){_0x480ea4[_0xb49c('0x41')]=[{'all':!![]}];}return db[_0xb49c('0x2a')]['findAll'](_0x480ea4);})[_0xb49c('0x42')](function(_0x34df10){_0x54cb22[_0xb49c('0x43')]=_0x34df10;return _0x54cb22;})[_0xb49c('0x42')](respondWithFilteredResult(_0x4b4e3b,_0x480ea4))[_0xb49c('0x44')](handleError(_0x4b4e3b,null));};exports[_0xb49c('0x45')]=function(_0xf3b59d,_0x1241a7){var _0x29ced3={'raw':![],'where':{'id':_0xf3b59d[_0xb49c('0x46')]['id']}},_0x23d1c9={};_0x23d1c9[_0xb49c('0x32')]=_[_0xb49c('0x30')](db[_0xb49c('0x2a')][_0xb49c('0x2b')]);_0x23d1c9[_0xb49c('0x2f')]=_[_0xb49c('0x30')](_0xf3b59d[_0xb49c('0x2f')]);_0x23d1c9['filters']=_[_0xb49c('0x31')](_0x23d1c9[_0xb49c('0x32')],_0x23d1c9['query']);_0x29ced3[_0xb49c('0x33')]=_['intersection'](_0x23d1c9[_0xb49c('0x32')],qs['fields'](_0xf3b59d[_0xb49c('0x2f')]['fields']));_0x29ced3['attributes']=_0x29ced3['attributes'][_0xb49c('0x35')]?_0x29ced3[_0xb49c('0x33')]:_0x23d1c9['model'];if(_0xf3b59d['query'][_0xb49c('0x40')]){_0x29ced3[_0xb49c('0x41')]=[{'all':!![]}];}_0x29ced3=_[_0xb49c('0x3e')]({},_0x29ced3,_0xf3b59d[_0xb49c('0x3f')]);return db[_0xb49c('0x2a')][_0xb49c('0x47')](_0x29ced3)[_0xb49c('0x42')](handleEntityNotFound(_0x1241a7,null))[_0xb49c('0x42')](respondWithResult(_0x1241a7,null))[_0xb49c('0x44')](handleError(_0x1241a7,null));};exports[_0xb49c('0x48')]=function(_0x2357b5,_0x156450){return db['SalesforceAccount'][_0xb49c('0x48')](_0x2357b5[_0xb49c('0x49')],{})[_0xb49c('0x42')](respondWithResult(_0x156450,0xc9))[_0xb49c('0x44')](handleError(_0x156450,null));};exports[_0xb49c('0x23')]=function(_0x10f3cd,_0x3f59e6){if(_0x10f3cd[_0xb49c('0x49')]['id']){delete _0x10f3cd['body']['id'];}return db[_0xb49c('0x2a')][_0xb49c('0x47')]({'where':{'id':_0x10f3cd[_0xb49c('0x46')]['id']}})[_0xb49c('0x42')](handleEntityNotFound(_0x3f59e6,null))[_0xb49c('0x42')](saveUpdates(_0x10f3cd['body'],null))[_0xb49c('0x42')](respondWithResult(_0x3f59e6,null))[_0xb49c('0x44')](handleError(_0x3f59e6,null));};exports[_0xb49c('0x24')]=function(_0x6a8873,_0x5f1b00){return db[_0xb49c('0x2a')][_0xb49c('0x47')]({'where':{'id':_0x6a8873[_0xb49c('0x46')]['id']}})[_0xb49c('0x42')](handleEntityNotFound(_0x5f1b00,null))['then'](removeEntity(_0x5f1b00,null))[_0xb49c('0x44')](handleError(_0x5f1b00,null));};exports[_0xb49c('0x4a')]=function(_0x3af717,_0x42be83,_0x373ecf){var _0x15dea7={};var _0x512bd4={};var _0x21d175;var _0x3dd7ce;return db['SalesforceAccount'][_0xb49c('0x4b')]({'where':{'id':_0x3af717[_0xb49c('0x46')]['id']}})[_0xb49c('0x42')](handleEntityNotFound(_0x42be83,null))[_0xb49c('0x42')](function(_0x3d6cd9){if(_0x3d6cd9){_0x21d175=_0x3d6cd9;_0x512bd4['model']=_[_0xb49c('0x30')](db[_0xb49c('0x4c')][_0xb49c('0x2b')]);_0x512bd4['query']=_[_0xb49c('0x30')](_0x3af717[_0xb49c('0x2f')]);_0x512bd4['filters']=_['intersection'](_0x512bd4['model'],_0x512bd4[_0xb49c('0x2f')]);_0x15dea7[_0xb49c('0x33')]=_[_0xb49c('0x31')](_0x512bd4[_0xb49c('0x32')],qs[_0xb49c('0x34')](_0x3af717[_0xb49c('0x2f')][_0xb49c('0x34')]));_0x15dea7[_0xb49c('0x33')]=_0x15dea7['attributes'][_0xb49c('0x35')]?_0x15dea7[_0xb49c('0x33')]:_0x512bd4[_0xb49c('0x32')];_0x15dea7['order']=qs[_0xb49c('0x39')](_0x3af717[_0xb49c('0x2f')]['sort']);_0x15dea7[_0xb49c('0x3a')]=qs[_0xb49c('0x4d')](_[_0xb49c('0x3b')](_0x3af717[_0xb49c('0x2f')],_0x512bd4[_0xb49c('0x4d')]));if(_0x3af717[_0xb49c('0x2f')][_0xb49c('0x3c')]){_0x15dea7[_0xb49c('0x3a')]=_['merge'](_0x15dea7[_0xb49c('0x3a')],{'$or':_['map'](_0x15dea7[_0xb49c('0x33')],function(_0x45dc52){var _0xb8113b={};_0xb8113b[_0x45dc52]={'$like':'%'+_0x3af717[_0xb49c('0x2f')][_0xb49c('0x3c')]+'%'};return _0xb8113b;})});}_0x15dea7=_[_0xb49c('0x3e')]({},_0x15dea7,_0x3af717[_0xb49c('0x3f')]);return _0x21d175['getConfigurations'](_0x15dea7);}})['then'](function(_0x10ce40){if(_0x10ce40){_0x3dd7ce=_0x10ce40[_0xb49c('0x35')];if(!_0x3af717[_0xb49c('0x2f')]['hasOwnProperty'](_0xb49c('0x37'))){_0x15dea7[_0xb49c('0x1a')]=qs[_0xb49c('0x1a')](_0x3af717[_0xb49c('0x2f')]['limit']);_0x15dea7[_0xb49c('0x19')]=qs[_0xb49c('0x19')](_0x3af717[_0xb49c('0x2f')][_0xb49c('0x19')]);}return _0x21d175[_0xb49c('0x4a')](_0x15dea7);}})[_0xb49c('0x42')](function(_0x403c77){if(_0x403c77){return _0x403c77?{'count':_0x3dd7ce,'rows':_0x403c77}:null;}})[_0xb49c('0x42')](respondWithResult(_0x42be83,null))[_0xb49c('0x44')](handleError(_0x42be83,null));};exports[_0xb49c('0x4e')]=function(_0x3ff239,_0x48a466,_0x31dbc2){if(_0x3ff239[_0xb49c('0x49')]['id']){delete _0x3ff239[_0xb49c('0x49')]['id'];}return db[_0xb49c('0x2a')]['findOne']({'where':{'id':_0x3ff239[_0xb49c('0x46')]['id']}})['then'](handleEntityNotFound(_0x48a466,null))[_0xb49c('0x42')](function(_0x149b2a){if(_0x149b2a){_0x3ff239[_0xb49c('0x49')]['AccountId']=_0x149b2a['id'];_0x3ff239['body']['Subjects']=integrations[_0xb49c('0x4f')](_0x3ff239[_0xb49c('0x49')][_0xb49c('0x50')],_0x3ff239[_0xb49c('0x49')][_0xb49c('0x2d')]);_0x3ff239[_0xb49c('0x49')][_0xb49c('0x51')]=integrations[_0xb49c('0x52')](_0x3ff239[_0xb49c('0x49')][_0xb49c('0x50')],_0x3ff239[_0xb49c('0x49')][_0xb49c('0x2d')]);return db[_0xb49c('0x4c')]['create'](_0x3ff239[_0xb49c('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0xb49c('0x53')},{'model':db[_0xb49c('0x54')],'as':_0xb49c('0x51')}]});}return null;})[_0xb49c('0x42')](respondWithResult(_0x48a466,null))[_0xb49c('0x44')](handleError(_0x48a466,null));};exports[_0xb49c('0x55')]=function(_0x20a50d,_0x14daf0,_0x4535c5){var _0x11f3bb;var _0x5a316b='';var _0x46d6ab=_0xb49c('0x56');return db[_0xb49c('0x2a')][_0xb49c('0x4b')]({'where':{'id':_0x20a50d[_0xb49c('0x46')]['id']},'attributes':['id',_0xb49c('0x57'),_0xb49c('0x58'),_0xb49c('0x59'),_0xb49c('0x5a'),_0xb49c('0x5b'),_0xb49c('0x5c')]})[_0xb49c('0x42')](handleEntityNotFound(_0x14daf0,null))[_0xb49c('0x42')](function(_0x3d048b){if(_0x3d048b){_0x5a316b=_0x3d048b[_0xb49c('0x57')];var _0x3d0e13=_0x5a316b[_0xb49c('0x5d')](-0x1);if(_0x3d0e13==='/'){_0x5a316b=_0x5a316b[_0xb49c('0x5e')](0x0,_0x5a316b['lastIndexOf'](_0x3d0e13));}_0x11f3bb=new jsforce[(_0xb49c('0x5f'))]({'oauth2':{'loginUrl':_0x5a316b,'clientId':_0x3d048b[_0xb49c('0x58')],'clientSecret':_0x3d048b['clientSecret']}});return _0x11f3bb[_0xb49c('0x60')](_0x3d048b[_0xb49c('0x5a')],_0x3d048b[_0xb49c('0x5b')]['concat'](_0x3d048b[_0xb49c('0x5c')]));}})[_0xb49c('0x42')](function(_0x298d6f){if(_0x298d6f){if(!_[_0xb49c('0x61')](_0x20a50d['query']['ticketType'])){_0x46d6ab=_0x20a50d[_0xb49c('0x2f')][_0xb49c('0x62')];}return _0x11f3bb[_0xb49c('0x63')](_0x46d6ab)[_0xb49c('0x64')]();}})['then'](function(_0x42dcab){var _0x263753=['OwnerId',_0xb49c('0x65'),_0xb49c('0x66'),_0xb49c('0x67'),'Subject','Description'];var _0x4191e4=[_0xb49c('0x68'),_0xb49c('0x69'),_0xb49c('0x6a'),'boolean',_0xb49c('0x6b'),_0xb49c('0x6c'),_0xb49c('0x6d')];if(_0x42dcab){_[_0xb49c('0x6e')](_0x42dcab['fields'],function(_0x2b9033){return _0x263753['includes'](_0x2b9033['name'])||!_0x4191e4[_0xb49c('0x6f')](_0x2b9033[_0xb49c('0x2d')]);});return{'count':_0x42dcab[_0xb49c('0x34')][_0xb49c('0x35')],'rows':_['map'](_0x42dcab[_0xb49c('0x34')],function(_0x121cc7){return{'id':_0x121cc7[_0xb49c('0x27')],'name':_0x121cc7[_0xb49c('0x70')],'custom':_0x121cc7[_0xb49c('0x71')],'options':_0x121cc7['picklistValues'][_0xb49c('0x35')]>0x0?_['map'](_0x121cc7[_0xb49c('0x72')],function(_0x41a2ec){return{'name':_0x41a2ec[_0xb49c('0x70')],'value':_0x41a2ec['value']};}):_0x121cc7['type']==_0xb49c('0x73')?[{'name':_0xb49c('0x74'),'value':'true'},{'name':_0xb49c('0x75'),'value':_0xb49c('0x76')}]:[]};})};}})['then'](respondWithResult(_0x14daf0,null))[_0xb49c('0x44')](function(_0x5e1e8f){var _0x105587=_0x20a50d[_0xb49c('0x2f')][_0xb49c('0x77')]?0x1f4:_0x5e1e8f[_0xb49c('0x78')]||0x1f4;logger['error'](_0xb49c('0x79'),_0xb49c('0x55'),_0x105587,JSON['stringify'](_0x5e1e8f));delete _0x5e1e8f[_0xb49c('0x27')];if(_0x105587===0x191){_0x105587=0x190;}_0x14daf0[_0xb49c('0x18')](_0x105587)[_0xb49c('0x28')](_0x20a50d[_0xb49c('0x2f')][_0xb49c('0x77')]?{'message':_0xb49c('0x7a'),'statusCode':_0x5e1e8f[_0xb49c('0x78')]}:_0x5e1e8f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d17625e..b4635ff 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 _0x1b6d=['define','SalesforceAccount','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0xf8afd4,_0x2c642a){var _0x23b690=function(_0x366f14){while(--_0x366f14){_0xf8afd4['push'](_0xf8afd4['shift']());}};_0x23b690(++_0x2c642a);}(_0x1b6d,0x1e6));var _0xd1b6=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b6d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xd1b6('0x0'));var util=require('util');var logger=require(_0xd1b6('0x1'))('api');var moment=require(_0xd1b6('0x2'));var BPromise=require(_0xd1b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1b6('0x4'));var rimraf=require(_0xd1b6('0x5'));var config=require(_0xd1b6('0x6'));var attributes=require(_0xd1b6('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd1b6('0x8')]=function(_0x4c053c,_0x5cabf6){return _0x4c053c[_0xd1b6('0x9')](_0xd1b6('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5216=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','request-promise'];(function(_0x4ceafd,_0x51639a){var _0x358c5c=function(_0x1245bd){while(--_0x1245bd){_0x4ceafd['push'](_0x4ceafd['shift']());}};_0x358c5c(++_0x51639a);}(_0x5216,0x146));var _0x6521=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5216[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6521('0x0'));var logger=require(_0x6521('0x1'))(_0x6521('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6521('0x3'));var fs=require('fs');var path=require(_0x6521('0x4'));var rimraf=require(_0x6521('0x5'));var config=require(_0x6521('0x6'));var attributes=require(_0x6521('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x6521('0x8')]=function(_0x2ccd16,_0x5ea58a){return _0x2ccd16['define'](_0x6521('0x9'),attributes,{'tableName':_0x6521('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 ca578d5..0b86e24 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 _0xdbfd=['request','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','model','map','then','info','ShowSalesforceAccount','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x219b0c,_0xee0c47){var _0x386a53=function(_0x167cb2){while(--_0x167cb2){_0x219b0c['push'](_0x219b0c['shift']());}};_0x386a53(++_0xee0c47);}(_0xdbfd,0x18b));var _0xddbf=function(_0x4d5ed9,_0x5df150){_0x4d5ed9=_0x4d5ed9-0x0;var _0x298524=_0xdbfd[_0x4d5ed9];return _0x298524;};'use strict';var _=require(_0xddbf('0x0'));var util=require(_0xddbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddbf('0x2'));var db=require(_0xddbf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xddbf('0x4'))(_0xddbf('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xddbf('0x6')][_0xddbf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51657b,_0x180b31,_0x16aa4e){return new BPromise(function(_0x2431e9,_0x3459f0){return client[_0xddbf('0x8')](_0x51657b,_0x16aa4e)['then'](function(_0x5ab919){logger['info'](_0xddbf('0x9'),_0x180b31,'request\x20sent');logger[_0xddbf('0xa')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x180b31,_0xddbf('0xb'),JSON[_0xddbf('0xc')](_0x5ab919));if(_0x5ab919['error']){if(_0x5ab919['error'][_0xddbf('0xd')]===0x1f4){logger[_0xddbf('0xe')](_0xddbf('0x9'),_0x180b31,_0x5ab919[_0xddbf('0xe')][_0xddbf('0xf')]);return _0x3459f0(_0x5ab919[_0xddbf('0xe')][_0xddbf('0xf')]);}logger[_0xddbf('0xe')](_0xddbf('0x9'),_0x180b31,_0x5ab919['error']['message']);return _0x2431e9(_0x5ab919[_0xddbf('0xe')][_0xddbf('0xf')]);}else{logger['info'](_0xddbf('0x9'),_0x180b31,_0xddbf('0xb'));_0x2431e9(_0x5ab919[_0xddbf('0x10')][_0xddbf('0xf')]);}})[_0xddbf('0x11')](function(_0x1f31c7){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x180b31,_0x1f31c7);_0x3459f0(_0x1f31c7);});});}exports[_0xddbf('0x12')]=function(_0x45a3f9){var _0x8e0bec=this;return new Promise(function(_0x556e68,_0x472d2e){return db[_0xddbf('0x13')][_0xddbf('0x14')]({'raw':_0x45a3f9[_0xddbf('0x15')]?_0x45a3f9['options'][_0xddbf('0x16')]===undefined?!![]:![]:!![],'where':_0x45a3f9['options']?_0x45a3f9['options'][_0xddbf('0x17')]||null:null,'attributes':_0x45a3f9['options']?_0x45a3f9['options'][_0xddbf('0x18')]||null:null,'limit':_0x45a3f9[_0xddbf('0x15')]?_0x45a3f9[_0xddbf('0x15')]['limit']||null:null,'include':_0x45a3f9[_0xddbf('0x15')]?_0x45a3f9['options'][_0xddbf('0x19')]?_['map'](_0x45a3f9[_0xddbf('0x15')][_0xddbf('0x19')],function(_0x293c33){return{'model':db[_0x293c33[_0xddbf('0x1a')]],'as':_0x293c33['as'],'attributes':_0x293c33[_0xddbf('0x18')],'include':_0x293c33[_0xddbf('0x19')]?_[_0xddbf('0x1b')](_0x293c33[_0xddbf('0x19')],function(_0x1885f5){return{'model':db[_0x1885f5[_0xddbf('0x1a')]],'as':_0x1885f5['as'],'attributes':_0x1885f5['attributes'],'include':_0x1885f5[_0xddbf('0x19')]?_['map'](_0x1885f5[_0xddbf('0x19')],function(_0x37cc7){return{'model':db[_0x37cc7[_0xddbf('0x1a')]],'as':_0x37cc7['as'],'attributes':_0x37cc7[_0xddbf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xddbf('0x1c')](function(_0x197b6d){logger[_0xddbf('0x1d')]('GetSalesforceAccount',_0x45a3f9);logger[_0xddbf('0xa')]('GetSalesforceAccount',_0x45a3f9,JSON[_0xddbf('0xc')](_0x197b6d));_0x556e68(_0x197b6d);})[_0xddbf('0x11')](function(_0x3fea4a){logger[_0xddbf('0xe')](_0xddbf('0x12'),_0x3fea4a[_0xddbf('0xf')],_0x45a3f9);_0x472d2e(_0x8e0bec[_0xddbf('0xe')](0x1f4,_0x3fea4a[_0xddbf('0xf')]));});});};exports[_0xddbf('0x1e')]=function(_0xeb1cd0){var _0x5c1086=this;return new Promise(function(_0x3a6599,_0x54fdbf){return db['SalesforceAccount']['find']({'raw':_0xeb1cd0['options']?_0xeb1cd0['options'][_0xddbf('0x16')]===undefined?!![]:![]:!![],'where':_0xeb1cd0['options']?_0xeb1cd0[_0xddbf('0x15')]['where']||null:null,'attributes':_0xeb1cd0['options']?_0xeb1cd0[_0xddbf('0x15')][_0xddbf('0x18')]||null:null,'include':_0xeb1cd0[_0xddbf('0x15')]?_0xeb1cd0[_0xddbf('0x15')]['include']?_[_0xddbf('0x1b')](_0xeb1cd0[_0xddbf('0x15')]['include'],function(_0x2c60b4){return{'model':db[_0x2c60b4[_0xddbf('0x1a')]],'as':_0x2c60b4['as'],'attributes':_0x2c60b4[_0xddbf('0x18')],'include':_0x2c60b4[_0xddbf('0x19')]?_[_0xddbf('0x1b')](_0x2c60b4[_0xddbf('0x19')],function(_0x5dccc6){return{'model':db[_0x5dccc6[_0xddbf('0x1a')]],'as':_0x5dccc6['as'],'attributes':_0x5dccc6[_0xddbf('0x18')],'include':_0x5dccc6[_0xddbf('0x19')]?_[_0xddbf('0x1b')](_0x5dccc6[_0xddbf('0x19')],function(_0x2faec9){return{'model':db[_0x2faec9[_0xddbf('0x1a')]],'as':_0x2faec9['as'],'attributes':_0x2faec9['attributes']};}):[]};}):[]};}):[]:[]})[_0xddbf('0x1c')](function(_0x5a20fa){logger['info'](_0xddbf('0x1e'),_0xeb1cd0);logger[_0xddbf('0xa')](_0xddbf('0x1e'),_0xeb1cd0,JSON[_0xddbf('0xc')](_0x5a20fa));_0x3a6599(_0x5a20fa);})['catch'](function(_0x44a2bc){logger['error']('ShowSalesforceAccount',_0x44a2bc[_0xddbf('0xf')],_0xeb1cd0);_0x54fdbf(_0x5c1086[_0xddbf('0xe')](0x1f4,_0x44a2bc[_0xddbf('0xf')]));});});}; \ No newline at end of file +var _0x8bdc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','limit','include','attributes','map','model','GetSalesforceAccount','find','where','ShowSalesforceAccount','stringify','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bdc,0x17a));var _0xc8bd=function(_0x19722,_0x4c7b5a){_0x19722=_0x19722-0x0;var _0x2368ef=_0x8bdc[_0x19722];return _0x2368ef;};'use strict';var _=require('lodash');var util=require(_0xc8bd('0x0'));var moment=require(_0xc8bd('0x1'));var BPromise=require(_0xc8bd('0x2'));var rs=require(_0xc8bd('0x3'));var fs=require('fs');var Redis=require(_0xc8bd('0x4'));var db=require(_0xc8bd('0x5'))['db'];var utils=require(_0xc8bd('0x6'));var logger=require(_0xc8bd('0x7'))(_0xc8bd('0x8'));var config=require(_0xc8bd('0x9'));var jayson=require(_0xc8bd('0xa'));var client=jayson[_0xc8bd('0xb')][_0xc8bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41ba4c,_0x451f3f,_0x490a7b){return new BPromise(function(_0x3459c0,_0x40f1d6){return client[_0xc8bd('0xd')](_0x41ba4c,_0x490a7b)[_0xc8bd('0xe')](function(_0x227e28){logger[_0xc8bd('0xf')](_0xc8bd('0x10'),_0x451f3f,'request\x20sent');logger[_0xc8bd('0x11')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x451f3f,_0xc8bd('0x12'),JSON['stringify'](_0x227e28));if(_0x227e28['error']){if(_0x227e28[_0xc8bd('0x13')][_0xc8bd('0x14')]===0x1f4){logger['error'](_0xc8bd('0x10'),_0x451f3f,_0x227e28['error'][_0xc8bd('0x15')]);return _0x40f1d6(_0x227e28[_0xc8bd('0x13')]['message']);}logger[_0xc8bd('0x13')](_0xc8bd('0x10'),_0x451f3f,_0x227e28['error'][_0xc8bd('0x15')]);return _0x3459c0(_0x227e28[_0xc8bd('0x13')][_0xc8bd('0x15')]);}else{logger[_0xc8bd('0xf')](_0xc8bd('0x10'),_0x451f3f,_0xc8bd('0x12'));_0x3459c0(_0x227e28[_0xc8bd('0x16')][_0xc8bd('0x15')]);}})[_0xc8bd('0x17')](function(_0x16ba70){logger[_0xc8bd('0x13')](_0xc8bd('0x10'),_0x451f3f,_0x16ba70);_0x40f1d6(_0x16ba70);});});}exports['GetSalesforceAccount']=function(_0x4b01c7){var _0x3a391b=this;return new Promise(function(_0x1887ab,_0x57fd8d){return db[_0xc8bd('0x18')][_0xc8bd('0x19')]({'raw':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')][_0xc8bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')]['where']||null:null,'attributes':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')]['attributes']||null:null,'limit':_0x4b01c7[_0xc8bd('0x1a')]?_0x4b01c7[_0xc8bd('0x1a')][_0xc8bd('0x1c')]||null:null,'include':_0x4b01c7['options']?_0x4b01c7[_0xc8bd('0x1a')][_0xc8bd('0x1d')]?_['map'](_0x4b01c7['options'][_0xc8bd('0x1d')],function(_0x1fdc7f){return{'model':db[_0x1fdc7f['model']],'as':_0x1fdc7f['as'],'attributes':_0x1fdc7f[_0xc8bd('0x1e')],'include':_0x1fdc7f[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x1fdc7f[_0xc8bd('0x1d')],function(_0x38462a){return{'model':db[_0x38462a[_0xc8bd('0x20')]],'as':_0x38462a['as'],'attributes':_0x38462a['attributes'],'include':_0x38462a[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x38462a[_0xc8bd('0x1d')],function(_0x4ecfb9){return{'model':db[_0x4ecfb9[_0xc8bd('0x20')]],'as':_0x4ecfb9['as'],'attributes':_0x4ecfb9[_0xc8bd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc8bd('0xe')](function(_0x311637){logger[_0xc8bd('0xf')]('GetSalesforceAccount',_0x4b01c7);logger[_0xc8bd('0x11')](_0xc8bd('0x21'),_0x4b01c7,JSON['stringify'](_0x311637));_0x1887ab(_0x311637);})[_0xc8bd('0x17')](function(_0x157be6){logger[_0xc8bd('0x13')](_0xc8bd('0x21'),_0x157be6['message'],_0x4b01c7);_0x57fd8d(_0x3a391b[_0xc8bd('0x13')](0x1f4,_0x157be6['message']));});});};exports['ShowSalesforceAccount']=function(_0x13c476){var _0x50b46f=this;return new Promise(function(_0x65ea4b,_0x2e3b32){return db[_0xc8bd('0x18')][_0xc8bd('0x22')]({'raw':_0x13c476['options']?_0x13c476[_0xc8bd('0x1a')][_0xc8bd('0x1b')]===undefined?!![]:![]:!![],'where':_0x13c476['options']?_0x13c476['options'][_0xc8bd('0x23')]||null:null,'attributes':_0x13c476[_0xc8bd('0x1a')]?_0x13c476[_0xc8bd('0x1a')][_0xc8bd('0x1e')]||null:null,'include':_0x13c476[_0xc8bd('0x1a')]?_0x13c476[_0xc8bd('0x1a')]['include']?_['map'](_0x13c476[_0xc8bd('0x1a')][_0xc8bd('0x1d')],function(_0x1cfcc6){return{'model':db[_0x1cfcc6['model']],'as':_0x1cfcc6['as'],'attributes':_0x1cfcc6[_0xc8bd('0x1e')],'include':_0x1cfcc6[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x1cfcc6[_0xc8bd('0x1d')],function(_0x379eb7){return{'model':db[_0x379eb7[_0xc8bd('0x20')]],'as':_0x379eb7['as'],'attributes':_0x379eb7['attributes'],'include':_0x379eb7[_0xc8bd('0x1d')]?_[_0xc8bd('0x1f')](_0x379eb7[_0xc8bd('0x1d')],function(_0x4aad41){return{'model':db[_0x4aad41['model']],'as':_0x4aad41['as'],'attributes':_0x4aad41[_0xc8bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14d333){logger[_0xc8bd('0xf')](_0xc8bd('0x24'),_0x13c476);logger[_0xc8bd('0x11')]('ShowSalesforceAccount',_0x13c476,JSON[_0xc8bd('0x25')](_0x14d333));_0x65ea4b(_0x14d333);})[_0xc8bd('0x17')](function(_0x4e75cd){logger[_0xc8bd('0x13')]('ShowSalesforceAccount',_0x4e75cd[_0xc8bd('0x15')],_0x13c476);_0x2e3b32(_0x50b46f[_0xc8bd('0x13')](0x1f4,_0x4e75cd[_0xc8bd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 7025957..c2a73ce 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4f84c3,_0x6d094d){_0x4f84c3=_0x4f84c3-0x0;var _0x460f9f=_0x0b0e[_0x4f84c3];return _0x460f9f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x0b0e[_0x1db831];return _0x39ba56;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1bcc1fe..c643542 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 _0x652f=['Task','Case','contact_lead','contact','lead','account_contact_lead','account','sequelize','exports','STRING','ENUM'];(function(_0x648cea,_0x98a9cf){var _0x9c093f=function(_0x3e3026){while(--_0x3e3026){_0x648cea['push'](_0x648cea['shift']());}};_0x9c093f(++_0x98a9cf);}(_0x652f,0x75));var _0xf652=function(_0x29dda1,_0x235e85){_0x29dda1=_0x29dda1-0x0;var _0x24f20b=_0x652f[_0x29dda1];return _0x24f20b;};'use strict';var Sequelize=require(_0xf652('0x0'));module[_0xf652('0x1')]={'name':{'type':Sequelize[_0xf652('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xf652('0x3')](_0xf652('0x4'),_0xf652('0x5')),'defaultValue':_0xf652('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf652('0x6'),_0xf652('0x7'),_0xf652('0x8'),_0xf652('0x9'),_0xf652('0xa')),'defaultValue':_0xf652('0x6')},'moduleCreate':{'type':Sequelize[_0xf652('0x3')]('nothing',_0xf652('0x7'),_0xf652('0x8'),_0xf652('0xa')),'defaultValue':_0xf652('0x8')},'leadId':{'type':Sequelize[_0xf652('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xf652('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xf652('0x2')]}}; \ No newline at end of file +var _0x9901=['contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x1cab41,_0x4bfa57){var _0x511deb=function(_0x3d1a43){while(--_0x3d1a43){_0x1cab41['push'](_0x1cab41['shift']());}};_0x511deb(++_0x4bfa57);}(_0x9901,0x191));var _0x1990=function(_0x2050f7,_0x3833c6){_0x2050f7=_0x2050f7-0x0;var _0x219da1=_0x9901[_0x2050f7];return _0x219da1;};'use strict';var Sequelize=require(_0x1990('0x0'));module[_0x1990('0x1')]={'name':{'type':Sequelize[_0x1990('0x2')]},'description':{'type':Sequelize[_0x1990('0x2')]},'ticketType':{'type':Sequelize[_0x1990('0x3')](_0x1990('0x4'),_0x1990('0x5')),'defaultValue':_0x1990('0x4')},'moduleSearch':{'type':Sequelize[_0x1990('0x3')](_0x1990('0x6'),_0x1990('0x7'),_0x1990('0x8'),_0x1990('0x9'),_0x1990('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x1990('0x3')](_0x1990('0xb'),_0x1990('0x7'),_0x1990('0x8'),'account'),'defaultValue':_0x1990('0x8')},'leadId':{'type':Sequelize[_0x1990('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1990('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x1990('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 1fe57cb..dd440ca 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 _0xe74c=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','sendStatus','error','stack','name','index','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','SalesforceConfiguration','findAll','rows','catch','params','rawAttributes','include','options','find','create','body','destroy','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x574418,_0x2baf3d){var _0x3bb8ed=function(_0x42f88d){while(--_0x42f88d){_0x574418['push'](_0x574418['shift']());}};_0x3bb8ed(++_0x2baf3d);}(_0xe74c,0x1d3));var _0xce74=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe74c[_0x543084];return _0x306a57;};'use strict';var emlformat=require(_0xce74('0x0'));var rimraf=require(_0xce74('0x1'));var zipdir=require(_0xce74('0x2'));var jsonpatch=require(_0xce74('0x3'));var rp=require('request-promise');var moment=require(_0xce74('0x4'));var BPromise=require(_0xce74('0x5'));var Mustache=require(_0xce74('0x6'));var util=require(_0xce74('0x7'));var path=require(_0xce74('0x8'));var sox=require(_0xce74('0x9'));var csv=require(_0xce74('0xa'));var ejs=require(_0xce74('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce74('0xc'));var squel=require(_0xce74('0xd'));var crypto=require('crypto');var jsforce=require(_0xce74('0xe'));var deskjs=require(_0xce74('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce74('0x10'));var Redis=require(_0xce74('0x11'));var authService=require(_0xce74('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xce74('0x13'));var hardwareService=require(_0xce74('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xce74('0x15'));var config=require(_0xce74('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xce74('0x17'))['db'];function respondWithStatusCode(_0x15ea9b,_0x3f884e){_0x3f884e=_0x3f884e||0xcc;return function(_0x25e77f){if(_0x25e77f){return _0x15ea9b['sendStatus'](_0x3f884e);}return _0x15ea9b[_0xce74('0x18')](_0x3f884e)[_0xce74('0x19')]();};}function respondWithResult(_0x53bcc0,_0xa8ab94){_0xa8ab94=_0xa8ab94||0xc8;return function(_0x16e2d0){if(_0x16e2d0){return _0x53bcc0[_0xce74('0x18')](_0xa8ab94)[_0xce74('0x1a')](_0x16e2d0);}};}function respondWithFilteredResult(_0x5b19df,_0x395714){return function(_0xdfda43){if(_0xdfda43){var _0x2280c6=typeof _0x395714[_0xce74('0x1b')]===_0xce74('0x1c')&&typeof _0x395714[_0xce74('0x1d')]==='undefined';var _0x1f564f=_0xdfda43[_0xce74('0x1e')];var _0x239d84=_0x2280c6?0x0:_0x395714['offset'];var _0x475ae8=_0x2280c6?_0xdfda43[_0xce74('0x1e')]:_0x395714[_0xce74('0x1b')]+_0x395714['limit'];var _0x1b45f4;if(_0x475ae8>=_0x1f564f){_0x475ae8=_0x1f564f;_0x1b45f4=0xc8;}else{_0x1b45f4=0xce;}_0x5b19df[_0xce74('0x18')](_0x1b45f4);return _0x5b19df[_0xce74('0x1f')](_0xce74('0x20'),_0x239d84+'-'+_0x475ae8+'/'+_0x1f564f)[_0xce74('0x1a')](_0xdfda43);}return null;};}function patchUpdates(_0x21fd52){return function(_0x4ad6e2){try{jsonpatch[_0xce74('0x21')](_0x4ad6e2,_0x21fd52,!![]);}catch(_0x5417b4){return BPromise['reject'](_0x5417b4);}return _0x4ad6e2['save']();};}function saveUpdates(_0x386958,_0x13361b){return function(_0x3a01a3){if(_0x3a01a3){return _0x3a01a3[_0xce74('0x22')](_0x386958)['then'](function(_0x49b849){return _0x49b849;});}return null;};}function removeEntity(_0x3f13d4,_0x840d7d){return function(_0x55b0be){if(_0x55b0be){return _0x55b0be['destroy']()[_0xce74('0x23')](function(){_0x3f13d4[_0xce74('0x18')](0xcc)[_0xce74('0x19')]();});}};}function handleEntityNotFound(_0x54ee3f,_0x348f78){return function(_0x153bc5){if(!_0x153bc5){_0x54ee3f[_0xce74('0x24')](0x194);}return _0x153bc5;};}function handleError(_0x159915,_0x16b24b){_0x16b24b=_0x16b24b||0x1f4;return function(_0x30e468){logger[_0xce74('0x25')](_0x30e468[_0xce74('0x26')]);if(_0x30e468[_0xce74('0x27')]){delete _0x30e468['name'];}_0x159915['status'](_0x16b24b)['send'](_0x30e468);};}exports[_0xce74('0x28')]=function(_0x41fa12,_0x541745){var _0x2119b2={},_0x45342c={},_0x504577={'count':0x0,'rows':[]};var _0x5cfc21=_['map'](db['SalesforceConfiguration']['rawAttributes'],function(_0x265110){return{'name':_0x265110[_0xce74('0x29')],'type':_0x265110[_0xce74('0x2a')][_0xce74('0x2b')]};});_0x45342c[_0xce74('0x2c')]=_[_0xce74('0x2d')](_0x5cfc21,'name');_0x45342c['query']=_[_0xce74('0x2e')](_0x41fa12[_0xce74('0x2f')]);_0x45342c['filters']=_[_0xce74('0x30')](_0x45342c[_0xce74('0x2c')],_0x45342c[_0xce74('0x2f')]);_0x2119b2[_0xce74('0x31')]=_[_0xce74('0x30')](_0x45342c['model'],qs[_0xce74('0x32')](_0x41fa12[_0xce74('0x2f')][_0xce74('0x32')]));_0x2119b2[_0xce74('0x31')]=_0x2119b2[_0xce74('0x31')][_0xce74('0x33')]?_0x2119b2[_0xce74('0x31')]:_0x45342c[_0xce74('0x2c')];if(!_0x41fa12[_0xce74('0x2f')][_0xce74('0x34')]('nolimit')){_0x2119b2[_0xce74('0x1d')]=qs[_0xce74('0x1d')](_0x41fa12[_0xce74('0x2f')][_0xce74('0x1d')]);_0x2119b2[_0xce74('0x1b')]=qs[_0xce74('0x1b')](_0x41fa12[_0xce74('0x2f')][_0xce74('0x1b')]);}_0x2119b2[_0xce74('0x35')]=qs[_0xce74('0x36')](_0x41fa12[_0xce74('0x2f')][_0xce74('0x36')]);_0x2119b2[_0xce74('0x37')]=qs[_0xce74('0x38')](_[_0xce74('0x39')](_0x41fa12[_0xce74('0x2f')],_0x45342c[_0xce74('0x38')]),_0x5cfc21);if(_0x41fa12[_0xce74('0x2f')][_0xce74('0x3a')]){_0x2119b2[_0xce74('0x37')]=_[_0xce74('0x3b')](_0x2119b2[_0xce74('0x37')],{'$or':_[_0xce74('0x2d')](_0x5cfc21,function(_0xf0751d){if(_0xf0751d[_0xce74('0x2a')]!==_0xce74('0x3c')){var _0x241881={};_0x241881[_0xf0751d[_0xce74('0x27')]]={'$like':'%'+_0x41fa12[_0xce74('0x2f')][_0xce74('0x3a')]+'%'};return _0x241881;}})});}_0x2119b2=_[_0xce74('0x3b')]({},_0x2119b2,_0x41fa12['options']);var _0x438238={'where':_0x2119b2[_0xce74('0x37')]};return db[_0xce74('0x3d')]['count'](_0x438238)[_0xce74('0x23')](function(_0x2105b5){_0x504577['count']=_0x2105b5;if(_0x41fa12[_0xce74('0x2f')]['includeAll']){_0x2119b2['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xce74('0x3e')](_0x2119b2);})[_0xce74('0x23')](function(_0x14eedd){_0x504577[_0xce74('0x3f')]=_0x14eedd;return _0x504577;})[_0xce74('0x23')](respondWithFilteredResult(_0x541745,_0x2119b2))[_0xce74('0x40')](handleError(_0x541745,null));};exports['show']=function(_0x57c0c9,_0x115b34){var _0x3f55be={'raw':![],'where':{'id':_0x57c0c9[_0xce74('0x41')]['id']}},_0x2c9231={};_0x2c9231['model']=_[_0xce74('0x2e')](db[_0xce74('0x3d')][_0xce74('0x42')]);_0x2c9231['query']=_[_0xce74('0x2e')](_0x57c0c9[_0xce74('0x2f')]);_0x2c9231[_0xce74('0x38')]=_[_0xce74('0x30')](_0x2c9231[_0xce74('0x2c')],_0x2c9231[_0xce74('0x2f')]);_0x3f55be[_0xce74('0x31')]=_['intersection'](_0x2c9231[_0xce74('0x2c')],qs['fields'](_0x57c0c9[_0xce74('0x2f')]['fields']));_0x3f55be[_0xce74('0x31')]=_0x3f55be['attributes'][_0xce74('0x33')]?_0x3f55be['attributes']:_0x2c9231['model'];if(_0x57c0c9[_0xce74('0x2f')]['includeAll']){_0x3f55be[_0xce74('0x43')]=[{'all':!![]}];}_0x3f55be=_[_0xce74('0x3b')]({},_0x3f55be,_0x57c0c9[_0xce74('0x44')]);return db[_0xce74('0x3d')][_0xce74('0x45')](_0x3f55be)[_0xce74('0x23')](handleEntityNotFound(_0x115b34,null))[_0xce74('0x23')](respondWithResult(_0x115b34,null))['catch'](handleError(_0x115b34,null));};exports[_0xce74('0x46')]=function(_0x5d6c16,_0x412d07){return db[_0xce74('0x3d')]['create'](_0x5d6c16[_0xce74('0x47')],{})['then'](respondWithResult(_0x412d07,0xc9))[_0xce74('0x40')](handleError(_0x412d07,null));};exports['update']=function(_0x5d75ee,_0x4664fe){if(_0x5d75ee['body']['id']){delete _0x5d75ee[_0xce74('0x47')]['id'];}return db[_0xce74('0x3d')]['find']({'where':{'id':_0x5d75ee[_0xce74('0x41')]['id']}})[_0xce74('0x23')](handleEntityNotFound(_0x4664fe,null))[_0xce74('0x23')](saveUpdates(_0x5d75ee[_0xce74('0x47')],null))[_0xce74('0x23')](respondWithResult(_0x4664fe,null))['catch'](handleError(_0x4664fe,null));};exports[_0xce74('0x48')]=function(_0x40d12b,_0x5e8e03){return db['SalesforceConfiguration'][_0xce74('0x45')]({'where':{'id':_0x40d12b[_0xce74('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e8e03,null))[_0xce74('0x23')](removeEntity(_0x5e8e03,null))[_0xce74('0x40')](handleError(_0x5e8e03,null));};exports[_0xce74('0x49')]=function(_0x2dcea2,_0x4f3413,_0x448fdf){var _0x401580={};var _0x40cb82={};var _0x389d67;var _0x19a0b5;return db[_0xce74('0x3d')][_0xce74('0x4a')]({'where':{'id':_0x2dcea2['params']['id']}})[_0xce74('0x23')](handleEntityNotFound(_0x4f3413,null))[_0xce74('0x23')](function(_0x17ad82){if(_0x17ad82){_0x389d67=_0x17ad82;_0x40cb82[_0xce74('0x2c')]=_[_0xce74('0x2e')](db[_0xce74('0x4b')][_0xce74('0x42')]);_0x40cb82[_0xce74('0x2f')]=_[_0xce74('0x2e')](_0x2dcea2[_0xce74('0x2f')]);_0x40cb82['filters']=_['intersection'](_0x40cb82[_0xce74('0x2c')],_0x40cb82[_0xce74('0x2f')]);_0x401580[_0xce74('0x31')]=_[_0xce74('0x30')](_0x40cb82[_0xce74('0x2c')],qs[_0xce74('0x32')](_0x2dcea2[_0xce74('0x2f')][_0xce74('0x32')]));_0x401580[_0xce74('0x31')]=_0x401580['attributes'][_0xce74('0x33')]?_0x401580['attributes']:_0x40cb82[_0xce74('0x2c')];_0x401580[_0xce74('0x35')]=qs[_0xce74('0x36')](_0x2dcea2['query']['sort']);_0x401580[_0xce74('0x37')]=qs[_0xce74('0x38')](_[_0xce74('0x39')](_0x2dcea2[_0xce74('0x2f')],_0x40cb82['filters']));if(_0x2dcea2[_0xce74('0x2f')][_0xce74('0x3a')]){_0x401580[_0xce74('0x37')]=_[_0xce74('0x3b')](_0x401580['where'],{'$or':_[_0xce74('0x2d')](_0x401580['attributes'],function(_0x23d8b2){var _0x1f0002={};_0x1f0002[_0x23d8b2]={'$like':'%'+_0x2dcea2[_0xce74('0x2f')][_0xce74('0x3a')]+'%'};return _0x1f0002;})});}_0x401580=_['merge']({},_0x401580,_0x2dcea2[_0xce74('0x44')]);return _0x389d67[_0xce74('0x49')](_0x401580);}})['then'](function(_0x516660){if(_0x516660){_0x19a0b5=_0x516660[_0xce74('0x33')];if(!_0x2dcea2['query'][_0xce74('0x34')](_0xce74('0x4c'))){_0x401580[_0xce74('0x1d')]=qs[_0xce74('0x1d')](_0x2dcea2[_0xce74('0x2f')]['limit']);_0x401580[_0xce74('0x1b')]=qs['offset'](_0x2dcea2[_0xce74('0x2f')][_0xce74('0x1b')]);}return _0x389d67['getFields'](_0x401580);}})[_0xce74('0x23')](function(_0x3c3618){if(_0x3c3618){return _0x3c3618?{'count':_0x19a0b5,'rows':_0x3c3618}:null;}})[_0xce74('0x23')](respondWithResult(_0x4f3413,null))[_0xce74('0x40')](handleError(_0x4f3413,null));};exports['getSubjects']=function(_0x57531c,_0x18b17e,_0x22ae91){var _0x1835d8={};var _0x16186b={};var _0x28a841;var _0x54c9c2;return db[_0xce74('0x3d')][_0xce74('0x4a')]({'where':{'id':_0x57531c[_0xce74('0x41')]['id']}})[_0xce74('0x23')](handleEntityNotFound(_0x18b17e,null))[_0xce74('0x23')](function(_0x699a2d){if(_0x699a2d){_0x28a841=_0x699a2d;_0x16186b['model']=_['keys'](db[_0xce74('0x4b')]['rawAttributes']);_0x16186b['query']=_[_0xce74('0x2e')](_0x57531c[_0xce74('0x2f')]);_0x16186b[_0xce74('0x38')]=_[_0xce74('0x30')](_0x16186b[_0xce74('0x2c')],_0x16186b[_0xce74('0x2f')]);_0x1835d8[_0xce74('0x31')]=_[_0xce74('0x30')](_0x16186b[_0xce74('0x2c')],qs[_0xce74('0x32')](_0x57531c[_0xce74('0x2f')]['fields']));_0x1835d8[_0xce74('0x31')]=_0x1835d8['attributes'][_0xce74('0x33')]?_0x1835d8[_0xce74('0x31')]:_0x16186b['model'];_0x1835d8[_0xce74('0x35')]=qs['sort'](_0x57531c[_0xce74('0x2f')]['sort']);_0x1835d8[_0xce74('0x37')]=qs[_0xce74('0x38')](_['pick'](_0x57531c[_0xce74('0x2f')],_0x16186b[_0xce74('0x38')]));if(_0x57531c['query']['filter']){_0x1835d8[_0xce74('0x37')]=_[_0xce74('0x3b')](_0x1835d8[_0xce74('0x37')],{'$or':_[_0xce74('0x2d')](_0x1835d8[_0xce74('0x31')],function(_0x999608){var _0x12d9cf={};_0x12d9cf[_0x999608]={'$like':'%'+_0x57531c[_0xce74('0x2f')][_0xce74('0x3a')]+'%'};return _0x12d9cf;})});}_0x1835d8=_[_0xce74('0x3b')]({},_0x1835d8,_0x57531c[_0xce74('0x44')]);return _0x28a841[_0xce74('0x4d')](_0x1835d8);}})[_0xce74('0x23')](function(_0x305e9d){if(_0x305e9d){_0x54c9c2=_0x305e9d[_0xce74('0x33')];if(!_0x57531c[_0xce74('0x2f')][_0xce74('0x34')](_0xce74('0x4c'))){_0x1835d8['limit']=qs['limit'](_0x57531c[_0xce74('0x2f')][_0xce74('0x1d')]);_0x1835d8[_0xce74('0x1b')]=qs['offset'](_0x57531c[_0xce74('0x2f')]['offset']);}return _0x28a841[_0xce74('0x4d')](_0x1835d8);}})[_0xce74('0x23')](function(_0xb17007){if(_0xb17007){return _0xb17007?{'count':_0x54c9c2,'rows':_0xb17007}:null;}})[_0xce74('0x23')](respondWithResult(_0x18b17e,null))[_0xce74('0x40')](handleError(_0x18b17e,null));};exports[_0xce74('0x4e')]=function(_0x52b70c,_0x43839f,_0x2adf21){var _0x4647c9={};var _0x33f142={};var _0x2a18b3;var _0x13dbd1;return db[_0xce74('0x3d')]['findOne']({'where':{'id':_0x52b70c[_0xce74('0x41')]['id']}})[_0xce74('0x23')](handleEntityNotFound(_0x43839f,null))[_0xce74('0x23')](function(_0x577707){if(_0x577707){_0x2a18b3=_0x577707;_0x33f142[_0xce74('0x2c')]=_[_0xce74('0x2e')](db[_0xce74('0x4b')][_0xce74('0x42')]);_0x33f142[_0xce74('0x2f')]=_['keys'](_0x52b70c[_0xce74('0x2f')]);_0x33f142['filters']=_[_0xce74('0x30')](_0x33f142[_0xce74('0x2c')],_0x33f142[_0xce74('0x2f')]);_0x4647c9['attributes']=_[_0xce74('0x30')](_0x33f142[_0xce74('0x2c')],qs[_0xce74('0x32')](_0x52b70c[_0xce74('0x2f')][_0xce74('0x32')]));_0x4647c9[_0xce74('0x31')]=_0x4647c9[_0xce74('0x31')][_0xce74('0x33')]?_0x4647c9['attributes']:_0x33f142[_0xce74('0x2c')];_0x4647c9['order']=qs[_0xce74('0x36')](_0x52b70c[_0xce74('0x2f')]['sort']);_0x4647c9[_0xce74('0x37')]=qs[_0xce74('0x38')](_[_0xce74('0x39')](_0x52b70c[_0xce74('0x2f')],_0x33f142[_0xce74('0x38')]));if(_0x52b70c[_0xce74('0x2f')]['filter']){_0x4647c9['where']=_['merge'](_0x4647c9[_0xce74('0x37')],{'$or':_[_0xce74('0x2d')](_0x4647c9['attributes'],function(_0x5445ff){var _0x2130b3={};_0x2130b3[_0x5445ff]={'$like':'%'+_0x52b70c['query'][_0xce74('0x3a')]+'%'};return _0x2130b3;})});}_0x4647c9=_[_0xce74('0x3b')]({},_0x4647c9,_0x52b70c[_0xce74('0x44')]);return _0x2a18b3[_0xce74('0x4e')](_0x4647c9);}})['then'](function(_0x44fef2){if(_0x44fef2){_0x13dbd1=_0x44fef2['length'];if(!_0x52b70c['query']['hasOwnProperty'](_0xce74('0x4c'))){_0x4647c9[_0xce74('0x1d')]=qs[_0xce74('0x1d')](_0x52b70c['query'][_0xce74('0x1d')]);_0x4647c9[_0xce74('0x1b')]=qs[_0xce74('0x1b')](_0x52b70c['query'][_0xce74('0x1b')]);}return _0x2a18b3['getDescriptions'](_0x4647c9);}})[_0xce74('0x23')](function(_0x3c8cb9){if(_0x3c8cb9){return _0x3c8cb9?{'count':_0x13dbd1,'rows':_0x3c8cb9}:null;}})[_0xce74('0x23')](respondWithResult(_0x43839f,null))[_0xce74('0x40')](handleError(_0x43839f,null));}; \ No newline at end of file +var _0x693d=['params','findOne','pick','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','rows','catch','length','includeAll','find','body'];(function(_0x3e349c,_0x19ea72){var _0x56b281=function(_0x49757a){while(--_0x49757a){_0x3e349c['push'](_0x3e349c['shift']());}};_0x56b281(++_0x19ea72);}(_0x693d,0x153));var _0xd693=function(_0x2181d2,_0x33ff0e){_0x2181d2=_0x2181d2-0x0;var _0x52e2bb=_0x693d[_0x2181d2];return _0x52e2bb;};'use strict';var emlformat=require(_0xd693('0x0'));var rimraf=require(_0xd693('0x1'));var zipdir=require(_0xd693('0x2'));var jsonpatch=require(_0xd693('0x3'));var rp=require(_0xd693('0x4'));var moment=require(_0xd693('0x5'));var BPromise=require(_0xd693('0x6'));var Mustache=require(_0xd693('0x7'));var util=require(_0xd693('0x8'));var path=require('path');var sox=require(_0xd693('0x9'));var csv=require(_0xd693('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd693('0xb'));var squel=require(_0xd693('0xc'));var crypto=require(_0xd693('0xd'));var jsforce=require(_0xd693('0xe'));var deskjs=require(_0xd693('0xf'));var toCsv=require(_0xd693('0xa'));var querystring=require(_0xd693('0x10'));var Papa=require(_0xd693('0x11'));var Redis=require(_0xd693('0x12'));var authService=require(_0xd693('0x13'));var qs=require(_0xd693('0x14'));var as=require(_0xd693('0x15'));var hardwareService=require(_0xd693('0x16'));var logger=require(_0xd693('0x17'))(_0xd693('0x18'));var utils=require(_0xd693('0x19'));var config=require(_0xd693('0x1a'));var licenseUtil=require(_0xd693('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f6b98,_0x1f436e){_0x1f436e=_0x1f436e||0xcc;return function(_0x511be5){if(_0x511be5){return _0x4f6b98[_0xd693('0x1c')](_0x1f436e);}return _0x4f6b98[_0xd693('0x1d')](_0x1f436e)[_0xd693('0x1e')]();};}function respondWithResult(_0x53b9f1,_0x4b1d5c){_0x4b1d5c=_0x4b1d5c||0xc8;return function(_0x2eac81){if(_0x2eac81){return _0x53b9f1[_0xd693('0x1d')](_0x4b1d5c)[_0xd693('0x1f')](_0x2eac81);}};}function respondWithFilteredResult(_0x1452da,_0x1e3486){return function(_0xc87778){if(_0xc87778){var _0x4241db=typeof _0x1e3486[_0xd693('0x20')]===_0xd693('0x21')&&typeof _0x1e3486[_0xd693('0x22')]==='undefined';var _0x13d16a=_0xc87778[_0xd693('0x23')];var _0x4dca92=_0x4241db?0x0:_0x1e3486[_0xd693('0x20')];var _0x40b3b1=_0x4241db?_0xc87778['count']:_0x1e3486[_0xd693('0x20')]+_0x1e3486[_0xd693('0x22')];var _0x4eac2c;if(_0x40b3b1>=_0x13d16a){_0x40b3b1=_0x13d16a;_0x4eac2c=0xc8;}else{_0x4eac2c=0xce;}_0x1452da[_0xd693('0x1d')](_0x4eac2c);return _0x1452da['set'](_0xd693('0x24'),_0x4dca92+'-'+_0x40b3b1+'/'+_0x13d16a)['json'](_0xc87778);}return null;};}function patchUpdates(_0x5eb350){return function(_0x5ebd13){try{jsonpatch[_0xd693('0x25')](_0x5ebd13,_0x5eb350,!![]);}catch(_0x52e1ee){return BPromise[_0xd693('0x26')](_0x52e1ee);}return _0x5ebd13['save']();};}function saveUpdates(_0x57ba51,_0x51c1b7){return function(_0x5286f5){if(_0x5286f5){return _0x5286f5[_0xd693('0x27')](_0x57ba51)[_0xd693('0x28')](function(_0x17180b){return _0x17180b;});}return null;};}function removeEntity(_0x53fe43,_0x3b847e){return function(_0x479820){if(_0x479820){return _0x479820[_0xd693('0x29')]()[_0xd693('0x28')](function(){_0x53fe43[_0xd693('0x1d')](0xcc)[_0xd693('0x1e')]();});}};}function handleEntityNotFound(_0x272bb4,_0x5f153a){return function(_0x3bb656){if(!_0x3bb656){_0x272bb4['sendStatus'](0x194);}return _0x3bb656;};}function handleError(_0x1b87eb,_0x325845){_0x325845=_0x325845||0x1f4;return function(_0x192fd3){logger[_0xd693('0x2a')](_0x192fd3[_0xd693('0x2b')]);if(_0x192fd3[_0xd693('0x2c')]){delete _0x192fd3[_0xd693('0x2c')];}_0x1b87eb[_0xd693('0x1d')](_0x325845)[_0xd693('0x2d')](_0x192fd3);};}exports[_0xd693('0x2e')]=function(_0x1875f1,_0x2814a8){var _0x5776d4={},_0x2ee501={},_0x44dd4b={'count':0x0,'rows':[]};var _0x57490f=_[_0xd693('0x2f')](db[_0xd693('0x30')][_0xd693('0x31')],function(_0x2106cd){return{'name':_0x2106cd[_0xd693('0x32')],'type':_0x2106cd[_0xd693('0x33')][_0xd693('0x34')]};});_0x2ee501[_0xd693('0x35')]=_[_0xd693('0x2f')](_0x57490f,_0xd693('0x2c'));_0x2ee501[_0xd693('0x36')]=_[_0xd693('0x37')](_0x1875f1[_0xd693('0x36')]);_0x2ee501[_0xd693('0x38')]=_[_0xd693('0x39')](_0x2ee501[_0xd693('0x35')],_0x2ee501[_0xd693('0x36')]);_0x5776d4['attributes']=_[_0xd693('0x39')](_0x2ee501[_0xd693('0x35')],qs['fields'](_0x1875f1[_0xd693('0x36')][_0xd693('0x3a')]));_0x5776d4[_0xd693('0x3b')]=_0x5776d4['attributes']['length']?_0x5776d4[_0xd693('0x3b')]:_0x2ee501[_0xd693('0x35')];if(!_0x1875f1[_0xd693('0x36')][_0xd693('0x3c')](_0xd693('0x3d'))){_0x5776d4[_0xd693('0x22')]=qs[_0xd693('0x22')](_0x1875f1['query'][_0xd693('0x22')]);_0x5776d4[_0xd693('0x20')]=qs[_0xd693('0x20')](_0x1875f1[_0xd693('0x36')][_0xd693('0x20')]);}_0x5776d4[_0xd693('0x3e')]=qs['sort'](_0x1875f1[_0xd693('0x36')][_0xd693('0x3f')]);_0x5776d4['where']=qs['filters'](_['pick'](_0x1875f1[_0xd693('0x36')],_0x2ee501['filters']),_0x57490f);if(_0x1875f1[_0xd693('0x36')][_0xd693('0x40')]){_0x5776d4[_0xd693('0x41')]=_[_0xd693('0x42')](_0x5776d4[_0xd693('0x41')],{'$or':_[_0xd693('0x2f')](_0x57490f,function(_0x6b9a6d){if(_0x6b9a6d[_0xd693('0x33')]!=='VIRTUAL'){var _0x2a024e={};_0x2a024e[_0x6b9a6d[_0xd693('0x2c')]]={'$like':'%'+_0x1875f1['query'][_0xd693('0x40')]+'%'};return _0x2a024e;}})});}_0x5776d4=_['merge']({},_0x5776d4,_0x1875f1[_0xd693('0x43')]);var _0x2514c2={'where':_0x5776d4[_0xd693('0x41')]};return db[_0xd693('0x30')][_0xd693('0x23')](_0x2514c2)[_0xd693('0x28')](function(_0x110de3){_0x44dd4b[_0xd693('0x23')]=_0x110de3;if(_0x1875f1[_0xd693('0x36')]['includeAll']){_0x5776d4[_0xd693('0x44')]=[{'all':!![]}];}return db[_0xd693('0x30')][_0xd693('0x45')](_0x5776d4);})[_0xd693('0x28')](function(_0x30ee49){_0x44dd4b[_0xd693('0x46')]=_0x30ee49;return _0x44dd4b;})[_0xd693('0x28')](respondWithFilteredResult(_0x2814a8,_0x5776d4))[_0xd693('0x47')](handleError(_0x2814a8,null));};exports['show']=function(_0x48e43f,_0x3bf16b){var _0x506c9e={'raw':![],'where':{'id':_0x48e43f['params']['id']}},_0x28397b={};_0x28397b[_0xd693('0x35')]=_[_0xd693('0x37')](db[_0xd693('0x30')][_0xd693('0x31')]);_0x28397b[_0xd693('0x36')]=_[_0xd693('0x37')](_0x48e43f[_0xd693('0x36')]);_0x28397b[_0xd693('0x38')]=_[_0xd693('0x39')](_0x28397b[_0xd693('0x35')],_0x28397b[_0xd693('0x36')]);_0x506c9e[_0xd693('0x3b')]=_['intersection'](_0x28397b[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x48e43f[_0xd693('0x36')][_0xd693('0x3a')]));_0x506c9e[_0xd693('0x3b')]=_0x506c9e[_0xd693('0x3b')][_0xd693('0x48')]?_0x506c9e[_0xd693('0x3b')]:_0x28397b[_0xd693('0x35')];if(_0x48e43f[_0xd693('0x36')][_0xd693('0x49')]){_0x506c9e[_0xd693('0x44')]=[{'all':!![]}];}_0x506c9e=_[_0xd693('0x42')]({},_0x506c9e,_0x48e43f[_0xd693('0x43')]);return db[_0xd693('0x30')][_0xd693('0x4a')](_0x506c9e)['then'](handleEntityNotFound(_0x3bf16b,null))['then'](respondWithResult(_0x3bf16b,null))['catch'](handleError(_0x3bf16b,null));};exports['create']=function(_0x38524b,_0x57333c){return db[_0xd693('0x30')]['create'](_0x38524b['body'],{})[_0xd693('0x28')](respondWithResult(_0x57333c,0xc9))[_0xd693('0x47')](handleError(_0x57333c,null));};exports['update']=function(_0x531a9d,_0x1d1ff4){if(_0x531a9d[_0xd693('0x4b')]['id']){delete _0x531a9d[_0xd693('0x4b')]['id'];}return db['SalesforceConfiguration'][_0xd693('0x4a')]({'where':{'id':_0x531a9d['params']['id']}})['then'](handleEntityNotFound(_0x1d1ff4,null))[_0xd693('0x28')](saveUpdates(_0x531a9d[_0xd693('0x4b')],null))[_0xd693('0x28')](respondWithResult(_0x1d1ff4,null))[_0xd693('0x47')](handleError(_0x1d1ff4,null));};exports[_0xd693('0x29')]=function(_0x590452,_0x567a24){return db['SalesforceConfiguration'][_0xd693('0x4a')]({'where':{'id':_0x590452[_0xd693('0x4c')]['id']}})['then'](handleEntityNotFound(_0x567a24,null))[_0xd693('0x28')](removeEntity(_0x567a24,null))[_0xd693('0x47')](handleError(_0x567a24,null));};exports['getFields']=function(_0x28bd7b,_0x3fac33,_0x557682){var _0x1efdda={};var _0x4dc090={};var _0x244d25;var _0x3e4d92;return db['SalesforceConfiguration'][_0xd693('0x4d')]({'where':{'id':_0x28bd7b[_0xd693('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3fac33,null))[_0xd693('0x28')](function(_0x155c2d){if(_0x155c2d){_0x244d25=_0x155c2d;_0x4dc090[_0xd693('0x35')]=_['keys'](db['SalesforceField'][_0xd693('0x31')]);_0x4dc090[_0xd693('0x36')]=_[_0xd693('0x37')](_0x28bd7b['query']);_0x4dc090[_0xd693('0x38')]=_['intersection'](_0x4dc090[_0xd693('0x35')],_0x4dc090[_0xd693('0x36')]);_0x1efdda[_0xd693('0x3b')]=_[_0xd693('0x39')](_0x4dc090[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x28bd7b[_0xd693('0x36')][_0xd693('0x3a')]));_0x1efdda[_0xd693('0x3b')]=_0x1efdda[_0xd693('0x3b')][_0xd693('0x48')]?_0x1efdda['attributes']:_0x4dc090[_0xd693('0x35')];_0x1efdda[_0xd693('0x3e')]=qs[_0xd693('0x3f')](_0x28bd7b[_0xd693('0x36')][_0xd693('0x3f')]);_0x1efdda['where']=qs[_0xd693('0x38')](_[_0xd693('0x4e')](_0x28bd7b['query'],_0x4dc090['filters']));if(_0x28bd7b[_0xd693('0x36')]['filter']){_0x1efdda[_0xd693('0x41')]=_[_0xd693('0x42')](_0x1efdda['where'],{'$or':_['map'](_0x1efdda[_0xd693('0x3b')],function(_0x56b304){var _0x5c1d47={};_0x5c1d47[_0x56b304]={'$like':'%'+_0x28bd7b[_0xd693('0x36')]['filter']+'%'};return _0x5c1d47;})});}_0x1efdda=_[_0xd693('0x42')]({},_0x1efdda,_0x28bd7b[_0xd693('0x43')]);return _0x244d25[_0xd693('0x4f')](_0x1efdda);}})[_0xd693('0x28')](function(_0x454e21){if(_0x454e21){_0x3e4d92=_0x454e21['length'];if(!_0x28bd7b['query']['hasOwnProperty'](_0xd693('0x3d'))){_0x1efdda[_0xd693('0x22')]=qs[_0xd693('0x22')](_0x28bd7b['query']['limit']);_0x1efdda[_0xd693('0x20')]=qs[_0xd693('0x20')](_0x28bd7b[_0xd693('0x36')][_0xd693('0x20')]);}return _0x244d25[_0xd693('0x4f')](_0x1efdda);}})['then'](function(_0x431c7f){if(_0x431c7f){return _0x431c7f?{'count':_0x3e4d92,'rows':_0x431c7f}:null;}})[_0xd693('0x28')](respondWithResult(_0x3fac33,null))[_0xd693('0x47')](handleError(_0x3fac33,null));};exports['getSubjects']=function(_0x41af01,_0x5974af,_0x468dec){var _0x1ceb55={};var _0x4a66da={};var _0x24ed7a;var _0x42f5cc;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x41af01[_0xd693('0x4c')]['id']}})[_0xd693('0x28')](handleEntityNotFound(_0x5974af,null))[_0xd693('0x28')](function(_0x284ab2){if(_0x284ab2){_0x24ed7a=_0x284ab2;_0x4a66da[_0xd693('0x35')]=_[_0xd693('0x37')](db['SalesforceField'][_0xd693('0x31')]);_0x4a66da[_0xd693('0x36')]=_[_0xd693('0x37')](_0x41af01[_0xd693('0x36')]);_0x4a66da[_0xd693('0x38')]=_[_0xd693('0x39')](_0x4a66da[_0xd693('0x35')],_0x4a66da[_0xd693('0x36')]);_0x1ceb55[_0xd693('0x3b')]=_[_0xd693('0x39')](_0x4a66da[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x41af01[_0xd693('0x36')][_0xd693('0x3a')]));_0x1ceb55[_0xd693('0x3b')]=_0x1ceb55['attributes'][_0xd693('0x48')]?_0x1ceb55[_0xd693('0x3b')]:_0x4a66da[_0xd693('0x35')];_0x1ceb55[_0xd693('0x3e')]=qs[_0xd693('0x3f')](_0x41af01[_0xd693('0x36')][_0xd693('0x3f')]);_0x1ceb55['where']=qs[_0xd693('0x38')](_[_0xd693('0x4e')](_0x41af01[_0xd693('0x36')],_0x4a66da[_0xd693('0x38')]));if(_0x41af01['query'][_0xd693('0x40')]){_0x1ceb55[_0xd693('0x41')]=_['merge'](_0x1ceb55['where'],{'$or':_[_0xd693('0x2f')](_0x1ceb55[_0xd693('0x3b')],function(_0xf32c91){var _0x1259b2={};_0x1259b2[_0xf32c91]={'$like':'%'+_0x41af01['query'][_0xd693('0x40')]+'%'};return _0x1259b2;})});}_0x1ceb55=_[_0xd693('0x42')]({},_0x1ceb55,_0x41af01['options']);return _0x24ed7a[_0xd693('0x50')](_0x1ceb55);}})[_0xd693('0x28')](function(_0x8348fc){if(_0x8348fc){_0x42f5cc=_0x8348fc['length'];if(!_0x41af01[_0xd693('0x36')]['hasOwnProperty'](_0xd693('0x3d'))){_0x1ceb55[_0xd693('0x22')]=qs[_0xd693('0x22')](_0x41af01['query']['limit']);_0x1ceb55[_0xd693('0x20')]=qs[_0xd693('0x20')](_0x41af01[_0xd693('0x36')][_0xd693('0x20')]);}return _0x24ed7a[_0xd693('0x50')](_0x1ceb55);}})['then'](function(_0x649af9){if(_0x649af9){return _0x649af9?{'count':_0x42f5cc,'rows':_0x649af9}:null;}})[_0xd693('0x28')](respondWithResult(_0x5974af,null))[_0xd693('0x47')](handleError(_0x5974af,null));};exports['getDescriptions']=function(_0x23cd37,_0x5281a5,_0x56bebe){var _0xe02841={};var _0xd033cd={};var _0x17775c;var _0x17ae53;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x23cd37['params']['id']}})[_0xd693('0x28')](handleEntityNotFound(_0x5281a5,null))[_0xd693('0x28')](function(_0x58da5f){if(_0x58da5f){_0x17775c=_0x58da5f;_0xd033cd[_0xd693('0x35')]=_[_0xd693('0x37')](db[_0xd693('0x51')][_0xd693('0x31')]);_0xd033cd[_0xd693('0x36')]=_[_0xd693('0x37')](_0x23cd37[_0xd693('0x36')]);_0xd033cd[_0xd693('0x38')]=_[_0xd693('0x39')](_0xd033cd[_0xd693('0x35')],_0xd033cd[_0xd693('0x36')]);_0xe02841[_0xd693('0x3b')]=_['intersection'](_0xd033cd[_0xd693('0x35')],qs[_0xd693('0x3a')](_0x23cd37[_0xd693('0x36')][_0xd693('0x3a')]));_0xe02841[_0xd693('0x3b')]=_0xe02841[_0xd693('0x3b')][_0xd693('0x48')]?_0xe02841[_0xd693('0x3b')]:_0xd033cd['model'];_0xe02841[_0xd693('0x3e')]=qs[_0xd693('0x3f')](_0x23cd37[_0xd693('0x36')][_0xd693('0x3f')]);_0xe02841['where']=qs[_0xd693('0x38')](_[_0xd693('0x4e')](_0x23cd37[_0xd693('0x36')],_0xd033cd[_0xd693('0x38')]));if(_0x23cd37[_0xd693('0x36')][_0xd693('0x40')]){_0xe02841[_0xd693('0x41')]=_[_0xd693('0x42')](_0xe02841[_0xd693('0x41')],{'$or':_[_0xd693('0x2f')](_0xe02841[_0xd693('0x3b')],function(_0x32f7e0){var _0x4b6c9a={};_0x4b6c9a[_0x32f7e0]={'$like':'%'+_0x23cd37['query'][_0xd693('0x40')]+'%'};return _0x4b6c9a;})});}_0xe02841=_[_0xd693('0x42')]({},_0xe02841,_0x23cd37['options']);return _0x17775c[_0xd693('0x52')](_0xe02841);}})[_0xd693('0x28')](function(_0x4a3668){if(_0x4a3668){_0x17ae53=_0x4a3668['length'];if(!_0x23cd37[_0xd693('0x36')][_0xd693('0x3c')](_0xd693('0x3d'))){_0xe02841['limit']=qs[_0xd693('0x22')](_0x23cd37[_0xd693('0x36')]['limit']);_0xe02841['offset']=qs[_0xd693('0x20')](_0x23cd37[_0xd693('0x36')][_0xd693('0x20')]);}return _0x17775c['getDescriptions'](_0xe02841);}})[_0xd693('0x28')](function(_0x2ab139){if(_0x2ab139){return _0x2ab139?{'count':_0x17ae53,'rows':_0x2ab139}:null;}})[_0xd693('0x28')](respondWithResult(_0x5281a5,null))['catch'](handleError(_0x5281a5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 3fdf7b0..b064bd4 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 _0xf7d5=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','util','../../config/logger','api'];(function(_0x3baa05,_0x207228){var _0x3b2b8d=function(_0x51d764){while(--_0x51d764){_0x3baa05['push'](_0x3baa05['shift']());}};_0x3b2b8d(++_0x207228);}(_0xf7d5,0x189));var _0x5f7d=function(_0xff6d6,_0x55c0ea){_0xff6d6=_0xff6d6-0x0;var _0x1d3f22=_0xf7d5[_0xff6d6];return _0x1d3f22;};'use strict';var _=require('lodash');var util=require(_0x5f7d('0x0'));var logger=require(_0x5f7d('0x1'))(_0x5f7d('0x2'));var moment=require(_0x5f7d('0x3'));var BPromise=require(_0x5f7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f7d('0x5'));var rimraf=require(_0x5f7d('0x6'));var config=require(_0x5f7d('0x7'));var attributes=require(_0x5f7d('0x8'));module['exports']=function(_0x355bd8,_0x439161){return _0x355bd8['define']('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c1a=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x26eb4b,_0x18fdbf){var _0x27c89b=function(_0x5087b9){while(--_0x5087b9){_0x26eb4b['push'](_0x26eb4b['shift']());}};_0x27c89b(++_0x18fdbf);}(_0x3c1a,0x1b8));var _0xa3c1=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x3c1a[_0x6e1239];return _0x418150;};'use strict';var _=require(_0xa3c1('0x0'));var util=require(_0xa3c1('0x1'));var logger=require(_0xa3c1('0x2'))(_0xa3c1('0x3'));var moment=require(_0xa3c1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3c1('0x5'));var rimraf=require(_0xa3c1('0x6'));var config=require(_0xa3c1('0x7'));var attributes=require(_0xa3c1('0x8'));module[_0xa3c1('0x9')]=function(_0x2c39a2,_0x295b89){return _0x2c39a2['define'](_0xa3c1('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 798505a..91f07e1 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 _0x3735=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','code','error','SalesforceConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x3735,0x1e4));var _0x5373=function(_0x23ad48,_0x104b01){_0x23ad48=_0x23ad48-0x0;var _0x199a20=_0x3735[_0x23ad48];return _0x199a20;};'use strict';var _=require(_0x5373('0x0'));var util=require(_0x5373('0x1'));var moment=require('moment');var BPromise=require(_0x5373('0x2'));var rs=require(_0x5373('0x3'));var fs=require('fs');var Redis=require(_0x5373('0x4'));var db=require(_0x5373('0x5'))['db'];var utils=require(_0x5373('0x6'));var logger=require(_0x5373('0x7'))(_0x5373('0x8'));var config=require(_0x5373('0x9'));var jayson=require(_0x5373('0xa'));var client=jayson[_0x5373('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b76a0,_0x4ca54d,_0x4f1760){return new BPromise(function(_0x5b8680,_0xd4ae0d){return client[_0x5373('0xc')](_0x5b76a0,_0x4f1760)[_0x5373('0xd')](function(_0x4891ea){logger[_0x5373('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ca54d,_0x5373('0xf'));logger[_0x5373('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4ca54d,'request\x20sent',JSON['stringify'](_0x4891ea));if(_0x4891ea['error']){if(_0x4891ea['error'][_0x5373('0x11')]===0x1f4){logger[_0x5373('0x12')](_0x5373('0x13'),_0x4ca54d,_0x4891ea[_0x5373('0x12')][_0x5373('0x14')]);return _0xd4ae0d(_0x4891ea[_0x5373('0x12')][_0x5373('0x14')]);}logger['error'](_0x5373('0x13'),_0x4ca54d,_0x4891ea[_0x5373('0x12')][_0x5373('0x14')]);return _0x5b8680(_0x4891ea[_0x5373('0x12')][_0x5373('0x14')]);}else{logger[_0x5373('0xe')](_0x5373('0x13'),_0x4ca54d,_0x5373('0xf'));_0x5b8680(_0x4891ea['result'][_0x5373('0x14')]);}})[_0x5373('0x15')](function(_0x4eca41){logger[_0x5373('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4ca54d,_0x4eca41);_0xd4ae0d(_0x4eca41);});});} \ No newline at end of file +var _0x1ea2=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1ae46e,_0x55dd9e){var _0x208f0d=function(_0x498133){while(--_0x498133){_0x1ae46e['push'](_0x1ae46e['shift']());}};_0x208f0d(++_0x55dd9e);}(_0x1ea2,0x160));var _0x21ea=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1ea2[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x21ea('0x0'));var util=require('util');var moment=require(_0x21ea('0x1'));var BPromise=require(_0x21ea('0x2'));var rs=require(_0x21ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21ea('0x4'))['db'];var utils=require(_0x21ea('0x5'));var logger=require(_0x21ea('0x6'))(_0x21ea('0x7'));var config=require(_0x21ea('0x8'));var jayson=require(_0x21ea('0x9'));var client=jayson[_0x21ea('0xa')][_0x21ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d58d5,_0x59d0bf,_0x381a5e){return new BPromise(function(_0x3f7bb3,_0x105344){return client['request'](_0x2d58d5,_0x381a5e)['then'](function(_0x35443a){logger[_0x21ea('0xc')](_0x21ea('0xd'),_0x59d0bf,'request\x20sent');logger['debug'](_0x21ea('0xe'),_0x59d0bf,_0x21ea('0xf'),JSON[_0x21ea('0x10')](_0x35443a));if(_0x35443a[_0x21ea('0x11')]){if(_0x35443a[_0x21ea('0x11')][_0x21ea('0x12')]===0x1f4){logger[_0x21ea('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59d0bf,_0x35443a['error'][_0x21ea('0x13')]);return _0x105344(_0x35443a[_0x21ea('0x11')][_0x21ea('0x13')]);}logger[_0x21ea('0x11')](_0x21ea('0xd'),_0x59d0bf,_0x35443a[_0x21ea('0x11')][_0x21ea('0x13')]);return _0x3f7bb3(_0x35443a[_0x21ea('0x11')][_0x21ea('0x13')]);}else{logger[_0x21ea('0xc')](_0x21ea('0xd'),_0x59d0bf,_0x21ea('0xf'));_0x3f7bb3(_0x35443a[_0x21ea('0x14')]['message']);}})[_0x21ea('0x15')](function(_0x88708f){logger[_0x21ea('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59d0bf,_0x88708f);_0x105344(_0x88708f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b2341da..0d9c27f 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 _0xe221=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xe221,0x1ee));var _0x1e22=function(_0x1aa002,_0x276549){_0x1aa002=_0x1aa002-0x0;var _0x1213fc=_0xe221[_0x1aa002];return _0x1213fc;};'use strict';var multer=require(_0x1e22('0x0'));var util=require('util');var path=require(_0x1e22('0x1'));var timeout=require(_0x1e22('0x2'));var express=require(_0x1e22('0x3'));var router=express[_0x1e22('0x4')]();var fs_extra=require(_0x1e22('0x5'));var auth=require(_0x1e22('0x6'));var interaction=require(_0x1e22('0x7'));var config=require(_0x1e22('0x8'));var controller=require(_0x1e22('0x9'));router[_0x1e22('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e22('0xa')](_0x1e22('0xb'),auth['isAuthenticated'](),controller[_0x1e22('0xc')]);router[_0x1e22('0xd')]('/',auth[_0x1e22('0xe')](),controller[_0x1e22('0xf')]);router[_0x1e22('0x10')](_0x1e22('0xb'),auth[_0x1e22('0xe')](),controller[_0x1e22('0x11')]);router[_0x1e22('0x12')](_0x1e22('0xb'),auth[_0x1e22('0xe')](),controller['destroy']);module[_0x1e22('0x13')]=router; \ No newline at end of file +var _0xbec1=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','create','put','/:id','exports'];(function(_0x3ea022,_0x2d5328){var _0x3b97a2=function(_0x351179){while(--_0x351179){_0x3ea022['push'](_0x3ea022['shift']());}};_0x3b97a2(++_0x2d5328);}(_0xbec1,0x110));var _0x1bec=function(_0x567f89,_0x3db9e3){_0x567f89=_0x567f89-0x0;var _0x124393=_0xbec1[_0x567f89];return _0x124393;};'use strict';var multer=require(_0x1bec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1bec('0x1'));var express=require(_0x1bec('0x2'));var router=express[_0x1bec('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1bec('0x4'));var interaction=require(_0x1bec('0x5'));var config=require(_0x1bec('0x6'));var controller=require(_0x1bec('0x7'));router[_0x1bec('0x8')]('/',auth[_0x1bec('0x9')](),controller[_0x1bec('0xa')]);router[_0x1bec('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1bec('0xb')]);router['post']('/',auth[_0x1bec('0x9')](),controller[_0x1bec('0xc')]);router[_0x1bec('0xd')](_0x1bec('0xe'),auth[_0x1bec('0x9')](),controller['update']);router['delete'](_0x1bec('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x1bec('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e5f559a..4263d49 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 _0xc5eb=['variable','customVariable','keyValue','STRING','ENUM','string'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xc5eb,0x82));var _0xbc5e=function(_0x48e06c,_0x2a2e79){_0x48e06c=_0x48e06c-0x0;var _0x59fa7e=_0xc5eb[_0x48e06c];return _0x59fa7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xbc5e('0x0')](_0xbc5e('0x1'),_0xbc5e('0x2'),_0xbc5e('0x3'),_0xbc5e('0x4'),'picklist'),'defaultValue':_0xbc5e('0x1')},'content':{'type':Sequelize[_0xbc5e('0x5')]},'key':{'type':Sequelize[_0xbc5e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xbc5e('0x1'),_0xbc5e('0x2'),_0xbc5e('0x3'))},'keyContent':{'type':Sequelize[_0xbc5e('0x5')]},'idField':{'type':Sequelize[_0xbc5e('0x5')]},'variableName':{'type':Sequelize[_0xbc5e('0x5')]}}; \ No newline at end of file +var _0xd5d0=['picklist','STRING','ENUM','string','variable','customVariable'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xd5d0,0x1dc));var _0x0d5d=function(_0x5c0c0c,_0x3ff3d6){_0x5c0c0c=_0x5c0c0c-0x0;var _0x17ac13=_0xd5d0[_0x5c0c0c];return _0x17ac13;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0d5d('0x0')](_0x0d5d('0x1'),_0x0d5d('0x2'),_0x0d5d('0x3'),'keyValue',_0x0d5d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0d5d('0x5')]},'keyType':{'type':Sequelize[_0x0d5d('0x0')]('string',_0x0d5d('0x2'),_0x0d5d('0x3'))},'keyContent':{'type':Sequelize[_0x0d5d('0x5')]},'idField':{'type':Sequelize[_0x0d5d('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ca07dfd..b9f62ec 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 _0x6366=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','end','error','stack','name','index','SalesforceField','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','catch','show','params','length','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x44f280,_0x4a1dad){var _0x4ee19d=function(_0xc02f51){while(--_0xc02f51){_0x44f280['push'](_0x44f280['shift']());}};_0x4ee19d(++_0x4a1dad);}(_0x6366,0x198));var _0x6636=function(_0x1df159,_0x2764cd){_0x1df159=_0x1df159-0x0;var _0x46e001=_0x6366[_0x1df159];return _0x46e001;};'use strict';var emlformat=require(_0x6636('0x0'));var rimraf=require(_0x6636('0x1'));var zipdir=require(_0x6636('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6636('0x3'));var moment=require(_0x6636('0x4'));var BPromise=require(_0x6636('0x5'));var Mustache=require(_0x6636('0x6'));var util=require(_0x6636('0x7'));var path=require('path');var sox=require(_0x6636('0x8'));var csv=require(_0x6636('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6636('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6636('0xb'));var jsforce=require(_0x6636('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6636('0x9'));var querystring=require(_0x6636('0xd'));var Papa=require(_0x6636('0xe'));var Redis=require(_0x6636('0xf'));var authService=require(_0x6636('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6636('0x11'));var hardwareService=require(_0x6636('0x12'));var logger=require('../../config/logger')(_0x6636('0x13'));var utils=require(_0x6636('0x14'));var config=require(_0x6636('0x15'));var licenseUtil=require(_0x6636('0x16'));var db=require(_0x6636('0x17'))['db'];function respondWithStatusCode(_0x4d8a30,_0x387786){_0x387786=_0x387786||0xcc;return function(_0x37d43e){if(_0x37d43e){return _0x4d8a30[_0x6636('0x18')](_0x387786);}return _0x4d8a30['status'](_0x387786)['end']();};}function respondWithResult(_0x4f5f6d,_0x387699){_0x387699=_0x387699||0xc8;return function(_0x5bee5b){if(_0x5bee5b){return _0x4f5f6d['status'](_0x387699)[_0x6636('0x19')](_0x5bee5b);}};}function respondWithFilteredResult(_0x218ca4,_0x32d888){return function(_0x569dc7){if(_0x569dc7){var _0x1fe2ca=typeof _0x32d888[_0x6636('0x1a')]===_0x6636('0x1b')&&typeof _0x32d888[_0x6636('0x1c')]===_0x6636('0x1b');var _0x218a89=_0x569dc7[_0x6636('0x1d')];var _0x5cf730=_0x1fe2ca?0x0:_0x32d888[_0x6636('0x1a')];var _0x27d4bf=_0x1fe2ca?_0x569dc7[_0x6636('0x1d')]:_0x32d888[_0x6636('0x1a')]+_0x32d888[_0x6636('0x1c')];var _0x1a0b74;if(_0x27d4bf>=_0x218a89){_0x27d4bf=_0x218a89;_0x1a0b74=0xc8;}else{_0x1a0b74=0xce;}_0x218ca4['status'](_0x1a0b74);return _0x218ca4[_0x6636('0x1e')]('Content-Range',_0x5cf730+'-'+_0x27d4bf+'/'+_0x218a89)['json'](_0x569dc7);}return null;};}function patchUpdates(_0x33bcd9){return function(_0x192f82){try{jsonpatch[_0x6636('0x1f')](_0x192f82,_0x33bcd9,!![]);}catch(_0x12c0d4){return BPromise[_0x6636('0x20')](_0x12c0d4);}return _0x192f82[_0x6636('0x21')]();};}function saveUpdates(_0x36805a,_0x5a39f5){return function(_0x20e3d2){if(_0x20e3d2){return _0x20e3d2[_0x6636('0x22')](_0x36805a)[_0x6636('0x23')](function(_0x5b345e){return _0x5b345e;});}return null;};}function removeEntity(_0x206a6e,_0x26fff9){return function(_0x760822){if(_0x760822){return _0x760822[_0x6636('0x24')]()[_0x6636('0x23')](function(){_0x206a6e[_0x6636('0x25')](0xcc)[_0x6636('0x26')]();});}};}function handleEntityNotFound(_0x4dc477,_0x231d52){return function(_0x48496b){if(!_0x48496b){_0x4dc477['sendStatus'](0x194);}return _0x48496b;};}function handleError(_0x504097,_0x245208){_0x245208=_0x245208||0x1f4;return function(_0x274dbd){logger[_0x6636('0x27')](_0x274dbd[_0x6636('0x28')]);if(_0x274dbd[_0x6636('0x29')]){delete _0x274dbd[_0x6636('0x29')];}_0x504097['status'](_0x245208)['send'](_0x274dbd);};}exports[_0x6636('0x2a')]=function(_0x49fed8,_0x48cafb){var _0x1b848f={},_0x1ccd40={},_0x425f15={'count':0x0,'rows':[]};var _0x3f6f23=_['map'](db[_0x6636('0x2b')][_0x6636('0x2c')],function(_0x115908){return{'name':_0x115908['fieldName'],'type':_0x115908['type']['key']};});_0x1ccd40[_0x6636('0x2d')]=_['map'](_0x3f6f23,'name');_0x1ccd40[_0x6636('0x2e')]=_[_0x6636('0x2f')](_0x49fed8[_0x6636('0x2e')]);_0x1ccd40[_0x6636('0x30')]=_[_0x6636('0x31')](_0x1ccd40['model'],_0x1ccd40['query']);_0x1b848f['attributes']=_['intersection'](_0x1ccd40['model'],qs[_0x6636('0x32')](_0x49fed8[_0x6636('0x2e')][_0x6636('0x32')]));_0x1b848f[_0x6636('0x33')]=_0x1b848f['attributes']['length']?_0x1b848f[_0x6636('0x33')]:_0x1ccd40[_0x6636('0x2d')];if(!_0x49fed8[_0x6636('0x2e')][_0x6636('0x34')](_0x6636('0x35'))){_0x1b848f[_0x6636('0x1c')]=qs[_0x6636('0x1c')](_0x49fed8[_0x6636('0x2e')][_0x6636('0x1c')]);_0x1b848f[_0x6636('0x1a')]=qs['offset'](_0x49fed8[_0x6636('0x2e')]['offset']);}_0x1b848f['order']=qs[_0x6636('0x36')](_0x49fed8['query'][_0x6636('0x36')]);_0x1b848f[_0x6636('0x37')]=qs[_0x6636('0x30')](_[_0x6636('0x38')](_0x49fed8['query'],_0x1ccd40[_0x6636('0x30')]),_0x3f6f23);if(_0x49fed8[_0x6636('0x2e')]['filter']){_0x1b848f['where']=_[_0x6636('0x39')](_0x1b848f['where'],{'$or':_['map'](_0x3f6f23,function(_0x141989){if(_0x141989[_0x6636('0x3a')]!==_0x6636('0x3b')){var _0x200998={};_0x200998[_0x141989[_0x6636('0x29')]]={'$like':'%'+_0x49fed8[_0x6636('0x2e')][_0x6636('0x3c')]+'%'};return _0x200998;}})});}_0x1b848f=_[_0x6636('0x39')]({},_0x1b848f,_0x49fed8['options']);var _0x47a526={'where':_0x1b848f['where']};return db['SalesforceField'][_0x6636('0x1d')](_0x47a526)[_0x6636('0x23')](function(_0x123dbd){_0x425f15[_0x6636('0x1d')]=_0x123dbd;if(_0x49fed8[_0x6636('0x2e')][_0x6636('0x3d')]){_0x1b848f['include']=[{'all':!![]}];}return db[_0x6636('0x2b')]['findAll'](_0x1b848f);})['then'](function(_0x311313){_0x425f15[_0x6636('0x3e')]=_0x311313;return _0x425f15;})['then'](respondWithFilteredResult(_0x48cafb,_0x1b848f))[_0x6636('0x3f')](handleError(_0x48cafb,null));};exports[_0x6636('0x40')]=function(_0x25b484,_0x1d97a6){var _0x4de12a={'raw':!![],'where':{'id':_0x25b484[_0x6636('0x41')]['id']}},_0x595d9f={};_0x595d9f[_0x6636('0x2d')]=_['keys'](db[_0x6636('0x2b')][_0x6636('0x2c')]);_0x595d9f[_0x6636('0x2e')]=_['keys'](_0x25b484[_0x6636('0x2e')]);_0x595d9f[_0x6636('0x30')]=_['intersection'](_0x595d9f[_0x6636('0x2d')],_0x595d9f['query']);_0x4de12a[_0x6636('0x33')]=_[_0x6636('0x31')](_0x595d9f[_0x6636('0x2d')],qs[_0x6636('0x32')](_0x25b484['query']['fields']));_0x4de12a[_0x6636('0x33')]=_0x4de12a['attributes'][_0x6636('0x42')]?_0x4de12a['attributes']:_0x595d9f[_0x6636('0x2d')];if(_0x25b484[_0x6636('0x2e')][_0x6636('0x3d')]){_0x4de12a['include']=[{'all':!![]}];}_0x4de12a=_[_0x6636('0x39')]({},_0x4de12a,_0x25b484[_0x6636('0x43')]);return db[_0x6636('0x2b')]['find'](_0x4de12a)[_0x6636('0x23')](handleEntityNotFound(_0x1d97a6,null))[_0x6636('0x23')](respondWithResult(_0x1d97a6,null))['catch'](handleError(_0x1d97a6,null));};exports[_0x6636('0x44')]=function(_0x31ce2f,_0x9a4f4){return db[_0x6636('0x2b')][_0x6636('0x44')](_0x31ce2f['body'],{})[_0x6636('0x23')](respondWithResult(_0x9a4f4,0xc9))[_0x6636('0x3f')](handleError(_0x9a4f4,null));};exports[_0x6636('0x22')]=function(_0x1d40f5,_0x48a22e){if(_0x1d40f5[_0x6636('0x45')]['id']){delete _0x1d40f5[_0x6636('0x45')]['id'];}return db[_0x6636('0x2b')][_0x6636('0x46')]({'where':{'id':_0x1d40f5['params']['id']}})[_0x6636('0x23')](handleEntityNotFound(_0x48a22e,null))[_0x6636('0x23')](saveUpdates(_0x1d40f5[_0x6636('0x45')],null))['then'](respondWithResult(_0x48a22e,null))[_0x6636('0x3f')](handleError(_0x48a22e,null));};exports[_0x6636('0x24')]=function(_0xe3a249,_0x3ffe16){return db[_0x6636('0x2b')][_0x6636('0x46')]({'where':{'id':_0xe3a249[_0x6636('0x41')]['id']}})[_0x6636('0x23')](handleEntityNotFound(_0x3ffe16,null))[_0x6636('0x23')](removeEntity(_0x3ffe16,null))['catch'](handleError(_0x3ffe16,null));}; \ No newline at end of file +var _0xc332=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x374c68,_0x2b7657){var _0x422141=function(_0x846e89){while(--_0x846e89){_0x374c68['push'](_0x374c68['shift']());}};_0x422141(++_0x2b7657);}(_0xc332,0x123));var _0x2c33=function(_0x504765,_0x5bba77){_0x504765=_0x504765-0x0;var _0x2a192b=_0xc332[_0x504765];return _0x2a192b;};'use strict';var emlformat=require(_0x2c33('0x0'));var rimraf=require(_0x2c33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c33('0x2'));var rp=require(_0x2c33('0x3'));var moment=require(_0x2c33('0x4'));var BPromise=require(_0x2c33('0x5'));var Mustache=require(_0x2c33('0x6'));var util=require('util');var path=require(_0x2c33('0x7'));var sox=require(_0x2c33('0x8'));var csv=require(_0x2c33('0x9'));var ejs=require(_0x2c33('0xa'));var fs=require('fs');var fs_extra=require(_0x2c33('0xb'));var _=require(_0x2c33('0xc'));var squel=require(_0x2c33('0xd'));var crypto=require(_0x2c33('0xe'));var jsforce=require(_0x2c33('0xf'));var deskjs=require(_0x2c33('0x10'));var toCsv=require(_0x2c33('0x9'));var querystring=require(_0x2c33('0x11'));var Papa=require('papaparse');var Redis=require(_0x2c33('0x12'));var authService=require(_0x2c33('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2c33('0x14'));var hardwareService=require(_0x2c33('0x15'));var logger=require('../../config/logger')(_0x2c33('0x16'));var utils=require(_0x2c33('0x17'));var config=require(_0x2c33('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c33('0x19'))['db'];function respondWithStatusCode(_0x292b5b,_0xd188e6){_0xd188e6=_0xd188e6||0xcc;return function(_0x312704){if(_0x312704){return _0x292b5b['sendStatus'](_0xd188e6);}return _0x292b5b[_0x2c33('0x1a')](_0xd188e6)['end']();};}function respondWithResult(_0x3f2e04,_0x285430){_0x285430=_0x285430||0xc8;return function(_0x4a39c0){if(_0x4a39c0){return _0x3f2e04[_0x2c33('0x1a')](_0x285430)['json'](_0x4a39c0);}};}function respondWithFilteredResult(_0x2040dd,_0x40b107){return function(_0x48ca25){if(_0x48ca25){var _0x4ef84a=typeof _0x40b107[_0x2c33('0x1b')]==='undefined'&&typeof _0x40b107[_0x2c33('0x1c')]===_0x2c33('0x1d');var _0x4dcfd7=_0x48ca25[_0x2c33('0x1e')];var _0x23ac94=_0x4ef84a?0x0:_0x40b107[_0x2c33('0x1b')];var _0x592519=_0x4ef84a?_0x48ca25[_0x2c33('0x1e')]:_0x40b107[_0x2c33('0x1b')]+_0x40b107[_0x2c33('0x1c')];var _0x79a48a;if(_0x592519>=_0x4dcfd7){_0x592519=_0x4dcfd7;_0x79a48a=0xc8;}else{_0x79a48a=0xce;}_0x2040dd['status'](_0x79a48a);return _0x2040dd[_0x2c33('0x1f')]('Content-Range',_0x23ac94+'-'+_0x592519+'/'+_0x4dcfd7)['json'](_0x48ca25);}return null;};}function patchUpdates(_0x443a41){return function(_0x4a1cd4){try{jsonpatch[_0x2c33('0x20')](_0x4a1cd4,_0x443a41,!![]);}catch(_0x4211b5){return BPromise[_0x2c33('0x21')](_0x4211b5);}return _0x4a1cd4[_0x2c33('0x22')]();};}function saveUpdates(_0x20540e,_0x24c055){return function(_0xa71229){if(_0xa71229){return _0xa71229[_0x2c33('0x23')](_0x20540e)[_0x2c33('0x24')](function(_0x5f2c42){return _0x5f2c42;});}return null;};}function removeEntity(_0x837ab,_0x3bd892){return function(_0x45df38){if(_0x45df38){return _0x45df38['destroy']()[_0x2c33('0x24')](function(){_0x837ab[_0x2c33('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339a2a,_0x168351){return function(_0x5d5c2a){if(!_0x5d5c2a){_0x339a2a['sendStatus'](0x194);}return _0x5d5c2a;};}function handleError(_0x1d1d19,_0x4b49f6){_0x4b49f6=_0x4b49f6||0x1f4;return function(_0x164061){logger['error'](_0x164061[_0x2c33('0x25')]);if(_0x164061[_0x2c33('0x26')]){delete _0x164061[_0x2c33('0x26')];}_0x1d1d19[_0x2c33('0x1a')](_0x4b49f6)[_0x2c33('0x27')](_0x164061);};}exports[_0x2c33('0x28')]=function(_0x4b6742,_0x1a5e01){var _0x2434aa={},_0x5e2db8={},_0x11d482={'count':0x0,'rows':[]};var _0x176d35=_['map'](db[_0x2c33('0x29')][_0x2c33('0x2a')],function(_0x5f352c){return{'name':_0x5f352c[_0x2c33('0x2b')],'type':_0x5f352c[_0x2c33('0x2c')][_0x2c33('0x2d')]};});_0x5e2db8['model']=_[_0x2c33('0x2e')](_0x176d35,_0x2c33('0x26'));_0x5e2db8[_0x2c33('0x2f')]=_[_0x2c33('0x30')](_0x4b6742[_0x2c33('0x2f')]);_0x5e2db8['filters']=_[_0x2c33('0x31')](_0x5e2db8[_0x2c33('0x32')],_0x5e2db8['query']);_0x2434aa['attributes']=_[_0x2c33('0x31')](_0x5e2db8['model'],qs[_0x2c33('0x33')](_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x33')]));_0x2434aa[_0x2c33('0x34')]=_0x2434aa[_0x2c33('0x34')]['length']?_0x2434aa[_0x2c33('0x34')]:_0x5e2db8[_0x2c33('0x32')];if(!_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x35')](_0x2c33('0x36'))){_0x2434aa[_0x2c33('0x1c')]=qs[_0x2c33('0x1c')](_0x4b6742['query']['limit']);_0x2434aa[_0x2c33('0x1b')]=qs['offset'](_0x4b6742['query'][_0x2c33('0x1b')]);}_0x2434aa[_0x2c33('0x37')]=qs['sort'](_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x38')]);_0x2434aa['where']=qs[_0x2c33('0x39')](_[_0x2c33('0x3a')](_0x4b6742[_0x2c33('0x2f')],_0x5e2db8[_0x2c33('0x39')]),_0x176d35);if(_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x3b')]){_0x2434aa[_0x2c33('0x3c')]=_[_0x2c33('0x3d')](_0x2434aa[_0x2c33('0x3c')],{'$or':_['map'](_0x176d35,function(_0x597cfa){if(_0x597cfa[_0x2c33('0x2c')]!==_0x2c33('0x3e')){var _0x5a449c={};_0x5a449c[_0x597cfa[_0x2c33('0x26')]]={'$like':'%'+_0x4b6742['query'][_0x2c33('0x3b')]+'%'};return _0x5a449c;}})});}_0x2434aa=_[_0x2c33('0x3d')]({},_0x2434aa,_0x4b6742[_0x2c33('0x3f')]);var _0x4da981={'where':_0x2434aa[_0x2c33('0x3c')]};return db[_0x2c33('0x29')][_0x2c33('0x1e')](_0x4da981)[_0x2c33('0x24')](function(_0x37cf55){_0x11d482[_0x2c33('0x1e')]=_0x37cf55;if(_0x4b6742[_0x2c33('0x2f')][_0x2c33('0x40')]){_0x2434aa[_0x2c33('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0x2c33('0x42')](_0x2434aa);})[_0x2c33('0x24')](function(_0xcb5b76){_0x11d482[_0x2c33('0x43')]=_0xcb5b76;return _0x11d482;})['then'](respondWithFilteredResult(_0x1a5e01,_0x2434aa))[_0x2c33('0x44')](handleError(_0x1a5e01,null));};exports['show']=function(_0x2dbdde,_0x2dcb7b){var _0x45a60e={'raw':!![],'where':{'id':_0x2dbdde[_0x2c33('0x45')]['id']}},_0x37e497={};_0x37e497[_0x2c33('0x32')]=_[_0x2c33('0x30')](db[_0x2c33('0x29')][_0x2c33('0x2a')]);_0x37e497['query']=_['keys'](_0x2dbdde[_0x2c33('0x2f')]);_0x37e497[_0x2c33('0x39')]=_['intersection'](_0x37e497[_0x2c33('0x32')],_0x37e497[_0x2c33('0x2f')]);_0x45a60e[_0x2c33('0x34')]=_[_0x2c33('0x31')](_0x37e497[_0x2c33('0x32')],qs['fields'](_0x2dbdde['query']['fields']));_0x45a60e[_0x2c33('0x34')]=_0x45a60e[_0x2c33('0x34')][_0x2c33('0x46')]?_0x45a60e[_0x2c33('0x34')]:_0x37e497[_0x2c33('0x32')];if(_0x2dbdde[_0x2c33('0x2f')][_0x2c33('0x40')]){_0x45a60e[_0x2c33('0x41')]=[{'all':!![]}];}_0x45a60e=_[_0x2c33('0x3d')]({},_0x45a60e,_0x2dbdde[_0x2c33('0x3f')]);return db[_0x2c33('0x29')][_0x2c33('0x47')](_0x45a60e)[_0x2c33('0x24')](handleEntityNotFound(_0x2dcb7b,null))[_0x2c33('0x24')](respondWithResult(_0x2dcb7b,null))[_0x2c33('0x44')](handleError(_0x2dcb7b,null));};exports[_0x2c33('0x48')]=function(_0x3aa80b,_0x2ff05a){return db[_0x2c33('0x29')][_0x2c33('0x48')](_0x3aa80b[_0x2c33('0x49')],{})[_0x2c33('0x24')](respondWithResult(_0x2ff05a,0xc9))[_0x2c33('0x44')](handleError(_0x2ff05a,null));};exports['update']=function(_0x3b66f2,_0x15202d){if(_0x3b66f2[_0x2c33('0x49')]['id']){delete _0x3b66f2['body']['id'];}return db['SalesforceField'][_0x2c33('0x47')]({'where':{'id':_0x3b66f2[_0x2c33('0x45')]['id']}})[_0x2c33('0x24')](handleEntityNotFound(_0x15202d,null))[_0x2c33('0x24')](saveUpdates(_0x3b66f2[_0x2c33('0x49')],null))[_0x2c33('0x24')](respondWithResult(_0x15202d,null))[_0x2c33('0x44')](handleError(_0x15202d,null));};exports[_0x2c33('0x4a')]=function(_0x5c1f41,_0x1d321e){return db[_0x2c33('0x29')]['find']({'where':{'id':_0x5c1f41[_0x2c33('0x45')]['id']}})[_0x2c33('0x24')](handleEntityNotFound(_0x1d321e,null))[_0x2c33('0x24')](removeEntity(_0x1d321e,null))[_0x2c33('0x44')](handleError(_0x1d321e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0dd15b9..7499a78 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 _0x1c46=['request-promise','path','rimraf','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','bluebird'];(function(_0x4c422e,_0x1c5fd8){var _0x34efa8=function(_0xc56036){while(--_0xc56036){_0x4c422e['push'](_0x4c422e['shift']());}};_0x34efa8(++_0x1c5fd8);}(_0x1c46,0xbd));var _0x61c4=function(_0xc2029,_0x569647){_0xc2029=_0xc2029-0x0;var _0x25d5ab=_0x1c46[_0xc2029];return _0x25d5ab;};'use strict';var _=require(_0x61c4('0x0'));var util=require(_0x61c4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x61c4('0x2'));var rp=require(_0x61c4('0x3'));var fs=require('fs');var path=require(_0x61c4('0x4'));var rimraf=require(_0x61c4('0x5'));var config=require('../../config/environment');var attributes=require(_0x61c4('0x6'));module[_0x61c4('0x7')]=function(_0x3c512f,_0x3b68a4){return _0x3c512f['define'](_0x61c4('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x61c4('0x9'),'fields':[_0x61c4('0xa'),_0x61c4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfafd=['./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0xfafd,0x19d));var _0xdfaf=function(_0x14e6cb,_0x2d1471){_0x14e6cb=_0x14e6cb-0x0;var _0x5fa827=_0xfafd[_0x14e6cb];return _0x5fa827;};'use strict';var _=require(_0xdfaf('0x0'));var util=require('util');var logger=require(_0xdfaf('0x1'))('api');var moment=require(_0xdfaf('0x2'));var BPromise=require(_0xdfaf('0x3'));var rp=require(_0xdfaf('0x4'));var fs=require('fs');var path=require(_0xdfaf('0x5'));var rimraf=require('rimraf');var config=require(_0xdfaf('0x6'));var attributes=require(_0xdfaf('0x7'));module[_0xdfaf('0x8')]=function(_0x35d91b,_0x5a6075){return _0x35d91b['define'](_0xdfaf('0x9'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xdfaf('0xa'),'fields':['idField',_0xdfaf('0xb')],'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 a1a7e53..131bcee 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 _0xa30d=['jayson/promise','client','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf6e625,_0x59a843){var _0x16a856=function(_0x29392c){while(--_0x29392c){_0xf6e625['push'](_0xf6e625['shift']());}};_0x16a856(++_0x59a843);}(_0xa30d,0x19a));var _0xda30=function(_0x33ac28,_0xbcde95){_0x33ac28=_0x33ac28-0x0;var _0x263076=_0xa30d[_0x33ac28];return _0x263076;};'use strict';var _=require(_0xda30('0x0'));var util=require(_0xda30('0x1'));var moment=require(_0xda30('0x2'));var BPromise=require(_0xda30('0x3'));var rs=require(_0xda30('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda30('0x5'))['db'];var utils=require(_0xda30('0x6'));var logger=require(_0xda30('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda30('0x8'));var client=jayson[_0xda30('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a26dd,_0x5e70ca,_0x1dae73){return new BPromise(function(_0x596571,_0x173ada){return client[_0xda30('0xa')](_0x2a26dd,_0x1dae73)['then'](function(_0x11c04b){logger[_0xda30('0xb')]('SalesforceField,\x20%s,\x20%s',_0x5e70ca,_0xda30('0xc'));logger[_0xda30('0xd')](_0xda30('0xe'),_0x5e70ca,'request\x20sent',JSON[_0xda30('0xf')](_0x11c04b));if(_0x11c04b[_0xda30('0x10')]){if(_0x11c04b[_0xda30('0x10')][_0xda30('0x11')]===0x1f4){logger[_0xda30('0x10')](_0xda30('0x12'),_0x5e70ca,_0x11c04b[_0xda30('0x10')]['message']);return _0x173ada(_0x11c04b['error'][_0xda30('0x13')]);}logger['error'](_0xda30('0x12'),_0x5e70ca,_0x11c04b[_0xda30('0x10')][_0xda30('0x13')]);return _0x596571(_0x11c04b[_0xda30('0x10')][_0xda30('0x13')]);}else{logger[_0xda30('0xb')](_0xda30('0x12'),_0x5e70ca,'request\x20sent');_0x596571(_0x11c04b[_0xda30('0x14')][_0xda30('0x13')]);}})[_0xda30('0x15')](function(_0xb504d8){logger[_0xda30('0x10')](_0xda30('0x12'),_0x5e70ca,_0xb504d8);_0x173ada(_0xb504d8);});});} \ No newline at end of file +var _0xd766=['message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x46b236,_0x89c2f0){var _0x327855=function(_0x4a612c){while(--_0x4a612c){_0x46b236['push'](_0x46b236['shift']());}};_0x327855(++_0x89c2f0);}(_0xd766,0x17f));var _0x6d76=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xd766[_0x5db313];return _0x36d503;};'use strict';var _=require(_0x6d76('0x0'));var util=require(_0x6d76('0x1'));var moment=require(_0x6d76('0x2'));var BPromise=require(_0x6d76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d76('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d76('0x5'))(_0x6d76('0x6'));var config=require(_0x6d76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d76('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32651d,_0x5afdc8,_0x5a4b4b){return new BPromise(function(_0x4b8013,_0xa22d6a){return client['request'](_0x32651d,_0x5a4b4b)['then'](function(_0x10b24d){logger['info'](_0x6d76('0x9'),_0x5afdc8,_0x6d76('0xa'));logger[_0x6d76('0xb')](_0x6d76('0xc'),_0x5afdc8,_0x6d76('0xa'),JSON[_0x6d76('0xd')](_0x10b24d));if(_0x10b24d['error']){if(_0x10b24d[_0x6d76('0xe')][_0x6d76('0xf')]===0x1f4){logger[_0x6d76('0xe')]('SalesforceField,\x20%s,\x20%s',_0x5afdc8,_0x10b24d[_0x6d76('0xe')][_0x6d76('0x10')]);return _0xa22d6a(_0x10b24d[_0x6d76('0xe')][_0x6d76('0x10')]);}logger[_0x6d76('0xe')](_0x6d76('0x9'),_0x5afdc8,_0x10b24d['error']['message']);return _0x4b8013(_0x10b24d[_0x6d76('0xe')]['message']);}else{logger[_0x6d76('0x11')](_0x6d76('0x9'),_0x5afdc8,_0x6d76('0xa'));_0x4b8013(_0x10b24d['result'][_0x6d76('0x10')]);}})[_0x6d76('0x12')](function(_0x1ed1d6){logger[_0x6d76('0xe')](_0x6d76('0x9'),_0x5afdc8,_0x1ed1d6);_0xa22d6a(_0x1ed1d6);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b3bbdf7..2234702 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 _0x9fca=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x9fca,0x1be));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa9fc('0x0'));var util=require(_0xa9fc('0x1'));var path=require(_0xa9fc('0x2'));var timeout=require(_0xa9fc('0x3'));var express=require(_0xa9fc('0x4'));var router=express['Router']();var fs_extra=require(_0xa9fc('0x5'));var auth=require(_0xa9fc('0x6'));var interaction=require(_0xa9fc('0x7'));var config=require(_0xa9fc('0x8'));var controller=require(_0xa9fc('0x9'));router[_0xa9fc('0xa')]('/',auth[_0xa9fc('0xb')](),controller['index']);router['get'](_0xa9fc('0xc'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0xd')]);router[_0xa9fc('0xa')](_0xa9fc('0xe'),auth['isAuthenticated'](),controller[_0xa9fc('0xf')]);router[_0xa9fc('0xa')](_0xa9fc('0x10'),auth['isAuthenticated'](),controller[_0xa9fc('0x11')]);router['post']('/',auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x12')]);router[_0xa9fc('0x13')](_0xa9fc('0xe'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x14')]);router['put'](_0xa9fc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xa9fc('0x15')]('/:id',auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x16')]);module[_0xa9fc('0x17')]=router; \ No newline at end of file +var _0x0a67=['get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25236c,_0x361f4a){var _0x5b070e=function(_0x2d2408){while(--_0x2d2408){_0x25236c['push'](_0x25236c['shift']());}};_0x5b070e(++_0x361f4a);}(_0x0a67,0x1c4));var _0x70a6=function(_0x2b5128,_0x4b18a5){_0x2b5128=_0x2b5128-0x0;var _0x1ed530=_0x0a67[_0x2b5128];return _0x1ed530;};'use strict';var multer=require(_0x70a6('0x0'));var util=require(_0x70a6('0x1'));var path=require(_0x70a6('0x2'));var timeout=require(_0x70a6('0x3'));var express=require('express');var router=express[_0x70a6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70a6('0x5'));var interaction=require(_0x70a6('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x70a6('0x7')]('/',auth[_0x70a6('0x8')](),controller['index']);router[_0x70a6('0x7')](_0x70a6('0x9'),auth[_0x70a6('0x8')](),controller['show']);router[_0x70a6('0x7')](_0x70a6('0xa'),auth[_0x70a6('0x8')](),controller[_0x70a6('0xb')]);router['get']('/:id/fields',auth[_0x70a6('0x8')](),controller[_0x70a6('0xc')]);router[_0x70a6('0xd')]('/',auth[_0x70a6('0x8')](),controller['create']);router[_0x70a6('0xd')](_0x70a6('0xa'),auth[_0x70a6('0x8')](),controller[_0x70a6('0xe')]);router['put'](_0x70a6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x70a6('0xf')](_0x70a6('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x70a6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 266f67e..1232293 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 _0x2af6=['remoteUri','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2af6,0x184));var _0x62af=function(_0x3055ec,_0x14e0e5){_0x3055ec=_0x3055ec-0x0;var _0x221cd6=_0x2af6[_0x3055ec];return _0x221cd6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x62af('0x0')]},'username':{'type':Sequelize[_0x62af('0x0')],'unique':_0x62af('0x1')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x62af('0x0')]},'remoteUri':{'type':Sequelize[_0x62af('0x0')],'unique':_0x62af('0x2')},'serverUrl':{'type':Sequelize[_0x62af('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x734e=['sequelize','STRING','username','remoteUri'];(function(_0x47375b,_0x41d61c){var _0x3cde7f=function(_0x350c3c){while(--_0x350c3c){_0x47375b['push'](_0x47375b['shift']());}};_0x3cde7f(++_0x41d61c);}(_0x734e,0x184));var _0xe734=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x734e[_0x25662e];return _0x59b7bc;};'use strict';var Sequelize=require(_0xe734('0x0'));module['exports']={'name':{'type':Sequelize[_0xe734('0x1')]},'description':{'type':Sequelize[_0xe734('0x1')]},'username':{'type':Sequelize[_0xe734('0x1')],'unique':_0xe734('0x2')},'password':{'type':Sequelize[_0xe734('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe734('0x1')],'unique':_0xe734('0x3')},'serverUrl':{'type':Sequelize[_0xe734('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index d8db82f..e576c2a 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 _0xa5d5=['sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','activity_due','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','remove','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','save','update','then','stack','name','send','index','ServicenowAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','where','pick','merge','map','filter','options','includeAll','include','findAll','show','params','length','find','create','body','catch','destroy','getConfigurations','findOne','ServicenowConfiguration','order','sort','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','hold_reason','subcategory','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_domain','state','calendar_stc','impact','active','work_notes_list','business_service','rfc','expected_start','opened_at','group_list','reopened_time','resolved_at','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','notify'];(function(_0x2700f2,_0xc9e80a){var _0x46ca08=function(_0x4cc60d){while(--_0x4cc60d){_0x2700f2['push'](_0x2700f2['shift']());}};_0x46ca08(++_0xc9e80a);}(_0xa5d5,0x1a1));var _0x5a5d=function(_0xf78599,_0x239ac2){_0xf78599=_0xf78599-0x0;var _0x1da2fc=_0xa5d5[_0xf78599];return _0x1da2fc;};'use strict';var emlformat=require(_0x5a5d('0x0'));var rimraf=require(_0x5a5d('0x1'));var zipdir=require(_0x5a5d('0x2'));var jsonpatch=require(_0x5a5d('0x3'));var rp=require(_0x5a5d('0x4'));var moment=require(_0x5a5d('0x5'));var BPromise=require(_0x5a5d('0x6'));var Mustache=require(_0x5a5d('0x7'));var util=require(_0x5a5d('0x8'));var path=require(_0x5a5d('0x9'));var sox=require(_0x5a5d('0xa'));var csv=require(_0x5a5d('0xb'));var ejs=require(_0x5a5d('0xc'));var fs=require('fs');var fs_extra=require(_0x5a5d('0xd'));var _=require('lodash');var squel=require(_0x5a5d('0xe'));var crypto=require(_0x5a5d('0xf'));var jsforce=require(_0x5a5d('0x10'));var deskjs=require(_0x5a5d('0x11'));var toCsv=require(_0x5a5d('0xb'));var querystring=require(_0x5a5d('0x12'));var Papa=require(_0x5a5d('0x13'));var Redis=require(_0x5a5d('0x14'));var authService=require(_0x5a5d('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a5d('0x16'));var logger=require(_0x5a5d('0x17'))(_0x5a5d('0x18'));var utils=require('../../config/utils');var config=require(_0x5a5d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a5d('0x1a'))['db'];var integrations=require(_0x5a5d('0x1b'));function respondWithStatusCode(_0x1ebb7b,_0x43bc2b){_0x43bc2b=_0x43bc2b||0xcc;return function(_0x307560){if(_0x307560){return _0x1ebb7b[_0x5a5d('0x1c')](_0x43bc2b);}return _0x1ebb7b[_0x5a5d('0x1d')](_0x43bc2b)[_0x5a5d('0x1e')]();};}function respondWithResult(_0x5575b3,_0x424d83){_0x424d83=_0x424d83||0xc8;return function(_0x2cf9ec){if(_0x2cf9ec){return _0x5575b3['status'](_0x424d83)[_0x5a5d('0x1f')](_0x2cf9ec);}};}function respondWithFilteredResult(_0x5b968a,_0x814181){return function(_0x549b78){if(_0x549b78){var _0x58649c=typeof _0x814181[_0x5a5d('0x20')]===_0x5a5d('0x21')&&typeof _0x814181['limit']===_0x5a5d('0x21');var _0x4c4e11=_0x549b78['count'];var _0x261b9f=_0x58649c?0x0:_0x814181[_0x5a5d('0x20')];var _0x21e4dc=_0x58649c?_0x549b78[_0x5a5d('0x22')]:_0x814181[_0x5a5d('0x20')]+_0x814181['limit'];var _0x5c8321;if(_0x21e4dc>=_0x4c4e11){_0x21e4dc=_0x4c4e11;_0x5c8321=0xc8;}else{_0x5c8321=0xce;}_0x5b968a[_0x5a5d('0x1d')](_0x5c8321);return _0x5b968a['set'](_0x5a5d('0x23'),_0x261b9f+'-'+_0x21e4dc+'/'+_0x4c4e11)[_0x5a5d('0x1f')](_0x549b78);}return null;};}function patchUpdates(_0x3b5929){return function(_0x1a0aae){try{jsonpatch['apply'](_0x1a0aae,_0x3b5929,!![]);}catch(_0x343c17){return BPromise['reject'](_0x343c17);}return _0x1a0aae[_0x5a5d('0x24')]();};}function saveUpdates(_0x22542a,_0x2a0222){return function(_0x400ef2){if(_0x400ef2){return _0x400ef2[_0x5a5d('0x25')](_0x22542a)[_0x5a5d('0x26')](function(_0x18b534){return _0x18b534;});}return null;};}function removeEntity(_0x30516a,_0x8920a8){return function(_0x2f687f){if(_0x2f687f){return _0x2f687f['destroy']()[_0x5a5d('0x26')](function(){_0x30516a[_0x5a5d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e4a4b,_0x365e22){return function(_0x6a48d5){if(!_0x6a48d5){_0x7e4a4b[_0x5a5d('0x1c')](0x194);}return _0x6a48d5;};}function handleError(_0x1fb872,_0x34648e){_0x34648e=_0x34648e||0x1f4;return function(_0x2c078a){logger['error'](_0x2c078a[_0x5a5d('0x27')]);if(_0x2c078a[_0x5a5d('0x28')]){delete _0x2c078a[_0x5a5d('0x28')];}_0x1fb872[_0x5a5d('0x1d')](_0x34648e)[_0x5a5d('0x29')](_0x2c078a);};}exports[_0x5a5d('0x2a')]=function(_0x17dad3,_0x2bc657){var _0x3e8716={},_0x2adeae={},_0x548ddb={'count':0x0,'rows':[]};var _0x27dceb=_['map'](db[_0x5a5d('0x2b')][_0x5a5d('0x2c')],function(_0x8d22b3){return{'name':_0x8d22b3['fieldName'],'type':_0x8d22b3[_0x5a5d('0x2d')][_0x5a5d('0x2e')]};});_0x2adeae[_0x5a5d('0x2f')]=_['map'](_0x27dceb,_0x5a5d('0x28'));_0x2adeae[_0x5a5d('0x30')]=_[_0x5a5d('0x31')](_0x17dad3['query']);_0x2adeae[_0x5a5d('0x32')]=_[_0x5a5d('0x33')](_0x2adeae['model'],_0x2adeae[_0x5a5d('0x30')]);_0x3e8716['attributes']=_[_0x5a5d('0x33')](_0x2adeae['model'],qs[_0x5a5d('0x34')](_0x17dad3[_0x5a5d('0x30')][_0x5a5d('0x34')]));_0x3e8716[_0x5a5d('0x35')]=_0x3e8716[_0x5a5d('0x35')]['length']?_0x3e8716[_0x5a5d('0x35')]:_0x2adeae['model'];if(!_0x17dad3[_0x5a5d('0x30')]['hasOwnProperty'](_0x5a5d('0x36'))){_0x3e8716['limit']=qs[_0x5a5d('0x37')](_0x17dad3[_0x5a5d('0x30')][_0x5a5d('0x37')]);_0x3e8716['offset']=qs[_0x5a5d('0x20')](_0x17dad3[_0x5a5d('0x30')][_0x5a5d('0x20')]);}_0x3e8716['order']=qs['sort'](_0x17dad3[_0x5a5d('0x30')]['sort']);_0x3e8716[_0x5a5d('0x38')]=qs[_0x5a5d('0x32')](_[_0x5a5d('0x39')](_0x17dad3[_0x5a5d('0x30')],_0x2adeae[_0x5a5d('0x32')]),_0x27dceb);if(_0x17dad3[_0x5a5d('0x30')]['filter']){_0x3e8716['where']=_[_0x5a5d('0x3a')](_0x3e8716[_0x5a5d('0x38')],{'$or':_[_0x5a5d('0x3b')](_0x27dceb,function(_0xbebe82){if(_0xbebe82[_0x5a5d('0x2d')]!=='VIRTUAL'){var _0x23e421={};_0x23e421[_0xbebe82[_0x5a5d('0x28')]]={'$like':'%'+_0x17dad3[_0x5a5d('0x30')][_0x5a5d('0x3c')]+'%'};return _0x23e421;}})});}_0x3e8716=_[_0x5a5d('0x3a')]({},_0x3e8716,_0x17dad3[_0x5a5d('0x3d')]);var _0x595e2a={'where':_0x3e8716[_0x5a5d('0x38')]};return db[_0x5a5d('0x2b')][_0x5a5d('0x22')](_0x595e2a)[_0x5a5d('0x26')](function(_0x1fa99d){_0x548ddb['count']=_0x1fa99d;if(_0x17dad3['query'][_0x5a5d('0x3e')]){_0x3e8716[_0x5a5d('0x3f')]=[{'all':!![]}];}return db[_0x5a5d('0x2b')][_0x5a5d('0x40')](_0x3e8716);})[_0x5a5d('0x26')](function(_0x998828){_0x548ddb['rows']=_0x998828;return _0x548ddb;})[_0x5a5d('0x26')](respondWithFilteredResult(_0x2bc657,_0x3e8716))['catch'](handleError(_0x2bc657,null));};exports[_0x5a5d('0x41')]=function(_0x4d2672,_0x1d42ff){var _0x7530c2={'raw':![],'where':{'id':_0x4d2672[_0x5a5d('0x42')]['id']}},_0x51875d={};_0x51875d[_0x5a5d('0x2f')]=_[_0x5a5d('0x31')](db[_0x5a5d('0x2b')][_0x5a5d('0x2c')]);_0x51875d[_0x5a5d('0x30')]=_[_0x5a5d('0x31')](_0x4d2672[_0x5a5d('0x30')]);_0x51875d['filters']=_['intersection'](_0x51875d['model'],_0x51875d[_0x5a5d('0x30')]);_0x7530c2[_0x5a5d('0x35')]=_[_0x5a5d('0x33')](_0x51875d[_0x5a5d('0x2f')],qs[_0x5a5d('0x34')](_0x4d2672[_0x5a5d('0x30')][_0x5a5d('0x34')]));_0x7530c2['attributes']=_0x7530c2[_0x5a5d('0x35')][_0x5a5d('0x43')]?_0x7530c2[_0x5a5d('0x35')]:_0x51875d[_0x5a5d('0x2f')];if(_0x4d2672[_0x5a5d('0x30')]['includeAll']){_0x7530c2['include']=[{'all':!![]}];}_0x7530c2=_[_0x5a5d('0x3a')]({},_0x7530c2,_0x4d2672[_0x5a5d('0x3d')]);return db[_0x5a5d('0x2b')][_0x5a5d('0x44')](_0x7530c2)[_0x5a5d('0x26')](handleEntityNotFound(_0x1d42ff,null))[_0x5a5d('0x26')](respondWithResult(_0x1d42ff,null))['catch'](handleError(_0x1d42ff,null));};exports[_0x5a5d('0x45')]=function(_0x1205b4,_0x12262c){return db['ServicenowAccount'][_0x5a5d('0x45')](_0x1205b4[_0x5a5d('0x46')],{})[_0x5a5d('0x26')](respondWithResult(_0x12262c,0xc9))[_0x5a5d('0x47')](handleError(_0x12262c,null));};exports[_0x5a5d('0x25')]=function(_0x46d15e,_0x4f996f){if(_0x46d15e[_0x5a5d('0x46')]['id']){delete _0x46d15e['body']['id'];}return db[_0x5a5d('0x2b')][_0x5a5d('0x44')]({'where':{'id':_0x46d15e[_0x5a5d('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f996f,null))[_0x5a5d('0x26')](saveUpdates(_0x46d15e[_0x5a5d('0x46')],null))['then'](respondWithResult(_0x4f996f,null))['catch'](handleError(_0x4f996f,null));};exports[_0x5a5d('0x48')]=function(_0x4cbdec,_0x875be4){return db[_0x5a5d('0x2b')][_0x5a5d('0x44')]({'where':{'id':_0x4cbdec[_0x5a5d('0x42')]['id']}})[_0x5a5d('0x26')](handleEntityNotFound(_0x875be4,null))[_0x5a5d('0x26')](removeEntity(_0x875be4,null))[_0x5a5d('0x47')](handleError(_0x875be4,null));};exports[_0x5a5d('0x49')]=function(_0x33a841,_0x38ed53,_0x5d2df9){var _0x2a67de={};var _0x1f3a8b={};var _0x2f4513;var _0x3f921f;return db[_0x5a5d('0x2b')][_0x5a5d('0x4a')]({'where':{'id':_0x33a841[_0x5a5d('0x42')]['id']}})[_0x5a5d('0x26')](handleEntityNotFound(_0x38ed53,null))[_0x5a5d('0x26')](function(_0x7b9e63){if(_0x7b9e63){_0x2f4513=_0x7b9e63;_0x1f3a8b[_0x5a5d('0x2f')]=_[_0x5a5d('0x31')](db[_0x5a5d('0x4b')][_0x5a5d('0x2c')]);_0x1f3a8b[_0x5a5d('0x30')]=_['keys'](_0x33a841[_0x5a5d('0x30')]);_0x1f3a8b[_0x5a5d('0x32')]=_[_0x5a5d('0x33')](_0x1f3a8b[_0x5a5d('0x2f')],_0x1f3a8b['query']);_0x2a67de[_0x5a5d('0x35')]=_[_0x5a5d('0x33')](_0x1f3a8b[_0x5a5d('0x2f')],qs['fields'](_0x33a841['query']['fields']));_0x2a67de['attributes']=_0x2a67de[_0x5a5d('0x35')][_0x5a5d('0x43')]?_0x2a67de['attributes']:_0x1f3a8b[_0x5a5d('0x2f')];_0x2a67de[_0x5a5d('0x4c')]=qs[_0x5a5d('0x4d')](_0x33a841[_0x5a5d('0x30')][_0x5a5d('0x4d')]);_0x2a67de[_0x5a5d('0x38')]=qs[_0x5a5d('0x32')](_[_0x5a5d('0x39')](_0x33a841[_0x5a5d('0x30')],_0x1f3a8b['filters']));if(_0x33a841[_0x5a5d('0x30')]['filter']){_0x2a67de['where']=_['merge'](_0x2a67de[_0x5a5d('0x38')],{'$or':_[_0x5a5d('0x3b')](_0x2a67de[_0x5a5d('0x35')],function(_0x4aa8f4){var _0x1e40e2={};_0x1e40e2[_0x4aa8f4]={'$like':'%'+_0x33a841[_0x5a5d('0x30')][_0x5a5d('0x3c')]+'%'};return _0x1e40e2;})});}_0x2a67de=_[_0x5a5d('0x3a')]({},_0x2a67de,_0x33a841[_0x5a5d('0x3d')]);return _0x2f4513[_0x5a5d('0x49')](_0x2a67de);}})[_0x5a5d('0x26')](function(_0x5203c0){if(_0x5203c0){_0x3f921f=_0x5203c0[_0x5a5d('0x43')];if(!_0x33a841['query']['hasOwnProperty'](_0x5a5d('0x36'))){_0x2a67de[_0x5a5d('0x37')]=qs['limit'](_0x33a841['query'][_0x5a5d('0x37')]);_0x2a67de['offset']=qs[_0x5a5d('0x20')](_0x33a841[_0x5a5d('0x30')][_0x5a5d('0x20')]);}return _0x2f4513[_0x5a5d('0x49')](_0x2a67de);}})[_0x5a5d('0x26')](function(_0x463938){if(_0x463938){return _0x463938?{'count':_0x3f921f,'rows':_0x463938}:null;}})[_0x5a5d('0x26')](respondWithResult(_0x38ed53,null))[_0x5a5d('0x47')](handleError(_0x38ed53,null));};exports[_0x5a5d('0x4e')]=function(_0x4c67cd,_0x2a0ec5,_0x30338c){if(_0x4c67cd[_0x5a5d('0x46')]['id']){delete _0x4c67cd[_0x5a5d('0x46')]['id'];}return db[_0x5a5d('0x2b')][_0x5a5d('0x4a')]({'where':{'id':_0x4c67cd[_0x5a5d('0x42')]['id']}})[_0x5a5d('0x26')](handleEntityNotFound(_0x2a0ec5,null))[_0x5a5d('0x26')](function(_0x2df401){if(_0x2df401){_0x4c67cd[_0x5a5d('0x46')][_0x5a5d('0x4f')]=_0x2df401['id'];_0x4c67cd[_0x5a5d('0x46')]['Subjects']=integrations[_0x5a5d('0x50')](_0x4c67cd['body'][_0x5a5d('0x51')],_0x4c67cd[_0x5a5d('0x46')][_0x5a5d('0x2d')]);_0x4c67cd[_0x5a5d('0x46')][_0x5a5d('0x52')]=integrations[_0x5a5d('0x53')](_0x4c67cd[_0x5a5d('0x46')][_0x5a5d('0x51')],_0x4c67cd['body'][_0x5a5d('0x2d')]);return db[_0x5a5d('0x4b')][_0x5a5d('0x45')](_0x4c67cd[_0x5a5d('0x46')],{'include':[{'model':db[_0x5a5d('0x54')],'as':_0x5a5d('0x55')},{'model':db[_0x5a5d('0x54')],'as':_0x5a5d('0x52')}]});}return null;})['then'](respondWithResult(_0x2a0ec5,null))[_0x5a5d('0x47')](handleError(_0x2a0ec5,null));};exports[_0x5a5d('0x56')]=function(_0x37eaeb,_0x901bff,_0x2f0f0b){var _0x236ca9=['made_sla',_0x5a5d('0x57'),'knowledge',_0x5a5d('0x58'),'close_code','notify',_0x5a5d('0x59'),_0x5a5d('0x5a'),_0x5a5d('0x5b')];var _0x4192a4=[_0x5a5d('0x5c'),_0x5a5d('0x5d'),_0x5a5d('0x5e'),_0x5a5d('0x5f'),_0x5a5d('0x60'),'sys_updated_on',_0x5a5d('0x61'),_0x5a5d('0x57'),_0x5a5d('0x62'),_0x5a5d('0x63'),_0x5a5d('0x64'),_0x5a5d('0x65'),_0x5a5d('0x66'),'user_input','sys_created_on',_0x5a5d('0x67'),_0x5a5d('0x68'),'sys_created_by','knowledge',_0x5a5d('0x4c'),_0x5a5d('0x69'),'closed_at','cmdb_ci','delivery_plan',_0x5a5d('0x6a'),_0x5a5d('0x6b'),_0x5a5d('0x6c'),_0x5a5d('0x6d'),'priority','sys_domain_path',_0x5a5d('0x6e'),'time_worked',_0x5a5d('0x6f'),_0x5a5d('0x70'),'business_duration',_0x5a5d('0x71'),'work_end',_0x5a5d('0x72'),_0x5a5d('0x73'),'caller_id','approval_set','subcategory',_0x5a5d('0x74'),_0x5a5d('0x75'),_0x5a5d('0x76'),_0x5a5d('0x77'),_0x5a5d('0x78'),_0x5a5d('0x79'),_0x5a5d('0x7a'),_0x5a5d('0x7b'),'additional_assignee_list',_0x5a5d('0x7c'),'calendar_duration',_0x5a5d('0x7d'),_0x5a5d('0x7e'),_0x5a5d('0x7f'),_0x5a5d('0x80'),_0x5a5d('0x81'),_0x5a5d('0x82'),_0x5a5d('0x83'),_0x5a5d('0x84'),'reopened_by','incident_state',_0x5a5d('0x85'),'problem_id',_0x5a5d('0x86'),_0x5a5d('0x87'),_0x5a5d('0x88'),_0x5a5d('0x89'),_0x5a5d('0x5a'),_0x5a5d('0x8a'),_0x5a5d('0x8b'),'approval','comments_and_work_notes',_0x5a5d('0x8c'),_0x5a5d('0x8d'),_0x5a5d('0x8e'),_0x5a5d('0x8f'),_0x5a5d('0x90'),_0x5a5d('0x91'),_0x5a5d('0x92'),_0x5a5d('0x93'),_0x5a5d('0x5b')];var _0x4df7b7='';var _0x2245a4='';var _0x15d7ba=[];var _0x40a3a2='';var _0x5eb73a='';var _0x52e10a=[];var _0x5c6163='';var _0x818b87='';var _0x3f1f60={};var _0x266f49='';return db[_0x5a5d('0x2b')][_0x5a5d('0x4a')]({'where':{'id':_0x37eaeb[_0x5a5d('0x42')]['id']},'attributes':['id','username',_0x5a5d('0x94'),'email',_0x5a5d('0x95'),'serverUrl']})[_0x5a5d('0x26')](handleEntityNotFound(_0x901bff,null))['then'](function(_0x49360b){if(_0x49360b){_0x266f49=_0x49360b[_0x5a5d('0x95')];var _0x21d25c=_0x266f49[_0x5a5d('0x96')](-0x1);if(_0x21d25c==='/'){_0x266f49=_0x266f49[_0x5a5d('0x97')](0x0,_0x266f49[_0x5a5d('0x98')](_0x21d25c));}_0x818b87=util[_0x5a5d('0x99')]('%s/api/now/doc/table/schema/',_0x266f49);_0x5c6163=util[_0x5a5d('0x99')](_0x5a5d('0x9a'),_0x266f49);_0x3f1f60={'user':_0x49360b[_0x5a5d('0x9b')],'pass':_0x49360b[_0x5a5d('0x94')]};var _0x28292a={'method':_0x5a5d('0x9c'),'uri':_0x818b87+_0x5a5d('0x9d'),'auth':_0x3f1f60,'json':!![]};return rp(_0x28292a);}})[_0x5a5d('0x26')](function(_0x423b7d){if(_0x423b7d[_0x5a5d('0x9e')]['length']>0x0){_0x4df7b7=_0x423b7d[_0x5a5d('0x9e')];}console[_0x5a5d('0x9f')](_0x5a5d('0xa0'),_0x4df7b7);_0x52e10a=[];_0x2245a4=Object[_0x5a5d('0xa1')]([],_0x4df7b7);_['remove'](_0x2245a4,function(_0x586433){return!_0x236ca9[_0x5a5d('0xa2')](_0x586433[_0x5a5d('0x28')]);});_0x2245a4[_0x5a5d('0xa3')](function(_0x4134aa){var _0x3d0159=createFieldObject(_0x5c6163,_0x3f1f60,_0x4134aa[_0x5a5d('0xa4')],_0x4134aa[_0x5a5d('0x28')],_0x4134aa[_0x5a5d('0xa5')],![]);_0x52e10a[_0x5a5d('0xa6')](_0x3d0159);});return Promise['all'](_0x52e10a);})[_0x5a5d('0x26')](function(_0x208eae){_0x15d7ba=_0x208eae;_0x40a3a2=Object['assign']([],_0x4df7b7);console[_0x5a5d('0x9f')]('TCL:\x20_object',_0x4df7b7);_[_0x5a5d('0xa7')](_0x40a3a2,function(_0x2c55e1){return _0x4192a4[_0x5a5d('0xa2')](_0x2c55e1[_0x5a5d('0x28')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x40a3a2);_0x52e10a=[];_0x40a3a2[_0x5a5d('0xa3')](function(_0x27e992){var _0xfdaed2=createFieldObject(_0x5c6163,_0x3f1f60,_0x27e992[_0x5a5d('0xa4')],_0x27e992[_0x5a5d('0x28')],_0x27e992['label'],!![]);_0x52e10a[_0x5a5d('0xa6')](_0xfdaed2);});return Promise[_0x5a5d('0xa8')](_0x52e10a);})[_0x5a5d('0x26')](function(_0x59fcc8){_0x5eb73a=_0x59fcc8;var _0x5675ab=_0x15d7ba[_0x5a5d('0xa9')](_0x5eb73a);return{'count':_0x5675ab[_0x5a5d('0x43')],'rows':_0x5675ab};})[_0x5a5d('0x26')](respondWithResult(_0x901bff,null))[_0x5a5d('0x47')](function(_0x539db1){console[_0x5a5d('0x9f')](_0x5a5d('0xaa')+_0x539db1);var _0x4ec3b4=_0x37eaeb[_0x5a5d('0x30')][_0x5a5d('0xab')]?0x1f4:_0x539db1[_0x5a5d('0xac')]||0x1f4;logger[_0x5a5d('0xad')](_0x539db1[_0x5a5d('0x27')]);delete _0x539db1['name'];if(_0x4ec3b4===0x191){_0x4ec3b4=0x190;}_0x901bff['status'](_0x4ec3b4)['send'](_0x37eaeb[_0x5a5d('0x30')]['test']?{'message':_0x5a5d('0xae'),'statusCode':_0x539db1['statusCode']}:_0x539db1);});};function createFieldObject(_0x59570a,_0x636b42,_0x502411,_0x5f00c9,_0x379bbe,_0x446601){return new Promise(function(_0x5afc4b,_0x184812){var _0x3fa172={'id':_0x5f00c9,'name':_0x379bbe,'custom':_0x446601};if(_0x502411===_0x5a5d('0xaf')){_0x3fa172[_0x5a5d('0x3d')]=[{'name':'True','value':_0x5a5d('0xb0')},{'name':_0x5a5d('0xb1'),'value':_0x5a5d('0xb2')}];_0x5afc4b(_0x3fa172);}else{var _0x4b0225={'method':_0x5a5d('0x9c'),'uri':_0x59570a+_0x5a5d('0xb3')+_0x5f00c9,'auth':_0x636b42,'json':!![]};return rp(_0x4b0225)[_0x5a5d('0x26')](function(_0x4fb470){var _0x1a76fb=[];if(_0x4fb470[_0x5a5d('0x9e')]['length']>0x0){_0x4fb470['result'][_0x5a5d('0xa3')](function(_0x117a02){if(_0x117a02['inactive']===_0x5a5d('0xb2')){var _0x2fe397={'name':_0x117a02[_0x5a5d('0xa5')],'value':_0x117a02[_0x5a5d('0xb4')]};_0x1a76fb['push'](_0x2fe397);}});}_0x3fa172[_0x5a5d('0x3d')]=_0x1a76fb;if(_0x3fa172[_0x5a5d('0x3d')][_0x5a5d('0x43')]>0x0){_0x5afc4b(_0x3fa172);}else{if(_0x446601==![]){_0x5afc4b();}else{_0x5afc4b(_0x3fa172);}}});}});} \ No newline at end of file +var _0xb752=['sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','category','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','statusCode','send','test','boolean','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','ServicenowAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','order','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','made_sla','hold_reason','knowledge','close_code','severity','parent','caused_by','upon_reject','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','parent_incident','contact_type','reopened_by','incident_state','problem_id','company','reassignment_count','activity_due'];(function(_0xbf2a7a,_0x4d86fb){var _0x491a4a=function(_0x5c4635){while(--_0x5c4635){_0xbf2a7a['push'](_0xbf2a7a['shift']());}};_0x491a4a(++_0x4d86fb);}(_0xb752,0xf3));var _0x2b75=function(_0x38d9fe,_0x38e50e){_0x38d9fe=_0x38d9fe-0x0;var _0x92ed0a=_0xb752[_0x38d9fe];return _0x92ed0a;};'use strict';var emlformat=require(_0x2b75('0x0'));var rimraf=require(_0x2b75('0x1'));var zipdir=require(_0x2b75('0x2'));var jsonpatch=require(_0x2b75('0x3'));var rp=require(_0x2b75('0x4'));var moment=require(_0x2b75('0x5'));var BPromise=require(_0x2b75('0x6'));var Mustache=require(_0x2b75('0x7'));var util=require(_0x2b75('0x8'));var path=require('path');var sox=require(_0x2b75('0x9'));var csv=require(_0x2b75('0xa'));var ejs=require(_0x2b75('0xb'));var fs=require('fs');var fs_extra=require(_0x2b75('0xc'));var _=require(_0x2b75('0xd'));var squel=require(_0x2b75('0xe'));var crypto=require('crypto');var jsforce=require(_0x2b75('0xf'));var deskjs=require(_0x2b75('0x10'));var toCsv=require(_0x2b75('0xa'));var querystring=require(_0x2b75('0x11'));var Papa=require(_0x2b75('0x12'));var Redis=require(_0x2b75('0x13'));var authService=require(_0x2b75('0x14'));var qs=require(_0x2b75('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b75('0x16'));var logger=require(_0x2b75('0x17'))(_0x2b75('0x18'));var utils=require(_0x2b75('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2b75('0x1a'));var db=require(_0x2b75('0x1b'))['db'];var integrations=require(_0x2b75('0x1c'));function respondWithStatusCode(_0x5e0300,_0x335fda){_0x335fda=_0x335fda||0xcc;return function(_0x564160){if(_0x564160){return _0x5e0300[_0x2b75('0x1d')](_0x335fda);}return _0x5e0300[_0x2b75('0x1e')](_0x335fda)['end']();};}function respondWithResult(_0x397adf,_0x42f75e){_0x42f75e=_0x42f75e||0xc8;return function(_0x2c1341){if(_0x2c1341){return _0x397adf[_0x2b75('0x1e')](_0x42f75e)[_0x2b75('0x1f')](_0x2c1341);}};}function respondWithFilteredResult(_0x404818,_0x58c596){return function(_0x5b496c){if(_0x5b496c){var _0x45cce4=typeof _0x58c596['offset']===_0x2b75('0x20')&&typeof _0x58c596['limit']===_0x2b75('0x20');var _0x4d9f10=_0x5b496c['count'];var _0x2f2a84=_0x45cce4?0x0:_0x58c596[_0x2b75('0x21')];var _0x3b9e56=_0x45cce4?_0x5b496c[_0x2b75('0x22')]:_0x58c596[_0x2b75('0x21')]+_0x58c596[_0x2b75('0x23')];var _0x4e9c77;if(_0x3b9e56>=_0x4d9f10){_0x3b9e56=_0x4d9f10;_0x4e9c77=0xc8;}else{_0x4e9c77=0xce;}_0x404818['status'](_0x4e9c77);return _0x404818[_0x2b75('0x24')]('Content-Range',_0x2f2a84+'-'+_0x3b9e56+'/'+_0x4d9f10)[_0x2b75('0x1f')](_0x5b496c);}return null;};}function patchUpdates(_0xe5aec0){return function(_0x460d49){try{jsonpatch[_0x2b75('0x25')](_0x460d49,_0xe5aec0,!![]);}catch(_0xac334b){return BPromise[_0x2b75('0x26')](_0xac334b);}return _0x460d49[_0x2b75('0x27')]();};}function saveUpdates(_0x18e12b,_0x2ffe9c){return function(_0xd2a1e9){if(_0xd2a1e9){return _0xd2a1e9[_0x2b75('0x28')](_0x18e12b)[_0x2b75('0x29')](function(_0x3c800f){return _0x3c800f;});}return null;};}function removeEntity(_0x31b9cc,_0x1be16a){return function(_0x36b528){if(_0x36b528){return _0x36b528[_0x2b75('0x2a')]()[_0x2b75('0x29')](function(){_0x31b9cc[_0x2b75('0x1e')](0xcc)[_0x2b75('0x2b')]();});}};}function handleEntityNotFound(_0x2a73d9,_0x3688ab){return function(_0x49e987){if(!_0x49e987){_0x2a73d9['sendStatus'](0x194);}return _0x49e987;};}function handleError(_0x59df06,_0x48a427){_0x48a427=_0x48a427||0x1f4;return function(_0x43e0a0){logger[_0x2b75('0x2c')](_0x43e0a0[_0x2b75('0x2d')]);if(_0x43e0a0[_0x2b75('0x2e')]){delete _0x43e0a0[_0x2b75('0x2e')];}_0x59df06[_0x2b75('0x1e')](_0x48a427)['send'](_0x43e0a0);};}exports[_0x2b75('0x2f')]=function(_0x304fed,_0x21d43f){var _0x100dbf={},_0x49e6bd={},_0x384b71={'count':0x0,'rows':[]};var _0x5ea031=_[_0x2b75('0x30')](db[_0x2b75('0x31')]['rawAttributes'],function(_0x32adfd){return{'name':_0x32adfd[_0x2b75('0x32')],'type':_0x32adfd[_0x2b75('0x33')][_0x2b75('0x34')]};});_0x49e6bd[_0x2b75('0x35')]=_[_0x2b75('0x30')](_0x5ea031,_0x2b75('0x2e'));_0x49e6bd['query']=_['keys'](_0x304fed[_0x2b75('0x36')]);_0x49e6bd['filters']=_[_0x2b75('0x37')](_0x49e6bd[_0x2b75('0x35')],_0x49e6bd['query']);_0x100dbf[_0x2b75('0x38')]=_[_0x2b75('0x37')](_0x49e6bd[_0x2b75('0x35')],qs[_0x2b75('0x39')](_0x304fed[_0x2b75('0x36')][_0x2b75('0x39')]));_0x100dbf[_0x2b75('0x38')]=_0x100dbf[_0x2b75('0x38')][_0x2b75('0x3a')]?_0x100dbf[_0x2b75('0x38')]:_0x49e6bd[_0x2b75('0x35')];if(!_0x304fed[_0x2b75('0x36')][_0x2b75('0x3b')](_0x2b75('0x3c'))){_0x100dbf['limit']=qs[_0x2b75('0x23')](_0x304fed[_0x2b75('0x36')][_0x2b75('0x23')]);_0x100dbf[_0x2b75('0x21')]=qs['offset'](_0x304fed[_0x2b75('0x36')][_0x2b75('0x21')]);}_0x100dbf['order']=qs[_0x2b75('0x3d')](_0x304fed[_0x2b75('0x36')][_0x2b75('0x3d')]);_0x100dbf[_0x2b75('0x3e')]=qs[_0x2b75('0x3f')](_['pick'](_0x304fed[_0x2b75('0x36')],_0x49e6bd[_0x2b75('0x3f')]),_0x5ea031);if(_0x304fed['query'][_0x2b75('0x40')]){_0x100dbf['where']=_[_0x2b75('0x41')](_0x100dbf[_0x2b75('0x3e')],{'$or':_[_0x2b75('0x30')](_0x5ea031,function(_0x407c9d){if(_0x407c9d['type']!==_0x2b75('0x42')){var _0x5e20e6={};_0x5e20e6[_0x407c9d[_0x2b75('0x2e')]]={'$like':'%'+_0x304fed[_0x2b75('0x36')][_0x2b75('0x40')]+'%'};return _0x5e20e6;}})});}_0x100dbf=_[_0x2b75('0x41')]({},_0x100dbf,_0x304fed[_0x2b75('0x43')]);var _0x5dabf2={'where':_0x100dbf['where']};return db[_0x2b75('0x31')][_0x2b75('0x22')](_0x5dabf2)[_0x2b75('0x29')](function(_0x5bf705){_0x384b71[_0x2b75('0x22')]=_0x5bf705;if(_0x304fed['query'][_0x2b75('0x44')]){_0x100dbf[_0x2b75('0x45')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x2b75('0x46')](_0x100dbf);})['then'](function(_0x25f791){_0x384b71[_0x2b75('0x47')]=_0x25f791;return _0x384b71;})[_0x2b75('0x29')](respondWithFilteredResult(_0x21d43f,_0x100dbf))[_0x2b75('0x48')](handleError(_0x21d43f,null));};exports[_0x2b75('0x49')]=function(_0x39220d,_0x381012){var _0x3e99f6={'raw':![],'where':{'id':_0x39220d[_0x2b75('0x4a')]['id']}},_0x4fd44e={};_0x4fd44e[_0x2b75('0x35')]=_[_0x2b75('0x4b')](db[_0x2b75('0x31')][_0x2b75('0x4c')]);_0x4fd44e[_0x2b75('0x36')]=_[_0x2b75('0x4b')](_0x39220d[_0x2b75('0x36')]);_0x4fd44e['filters']=_['intersection'](_0x4fd44e['model'],_0x4fd44e[_0x2b75('0x36')]);_0x3e99f6[_0x2b75('0x38')]=_[_0x2b75('0x37')](_0x4fd44e['model'],qs[_0x2b75('0x39')](_0x39220d[_0x2b75('0x36')][_0x2b75('0x39')]));_0x3e99f6[_0x2b75('0x38')]=_0x3e99f6[_0x2b75('0x38')]['length']?_0x3e99f6[_0x2b75('0x38')]:_0x4fd44e['model'];if(_0x39220d[_0x2b75('0x36')]['includeAll']){_0x3e99f6[_0x2b75('0x45')]=[{'all':!![]}];}_0x3e99f6=_['merge']({},_0x3e99f6,_0x39220d['options']);return db[_0x2b75('0x31')][_0x2b75('0x4d')](_0x3e99f6)[_0x2b75('0x29')](handleEntityNotFound(_0x381012,null))[_0x2b75('0x29')](respondWithResult(_0x381012,null))['catch'](handleError(_0x381012,null));};exports['create']=function(_0x20b74d,_0x28be8c){return db['ServicenowAccount'][_0x2b75('0x4e')](_0x20b74d[_0x2b75('0x4f')],{})[_0x2b75('0x29')](respondWithResult(_0x28be8c,0xc9))[_0x2b75('0x48')](handleError(_0x28be8c,null));};exports[_0x2b75('0x28')]=function(_0x5ce606,_0x45e468){if(_0x5ce606['body']['id']){delete _0x5ce606[_0x2b75('0x4f')]['id'];}return db[_0x2b75('0x31')][_0x2b75('0x4d')]({'where':{'id':_0x5ce606['params']['id']}})[_0x2b75('0x29')](handleEntityNotFound(_0x45e468,null))[_0x2b75('0x29')](saveUpdates(_0x5ce606[_0x2b75('0x4f')],null))['then'](respondWithResult(_0x45e468,null))[_0x2b75('0x48')](handleError(_0x45e468,null));};exports['destroy']=function(_0x2bab2c,_0x4aefba){return db['ServicenowAccount'][_0x2b75('0x4d')]({'where':{'id':_0x2bab2c[_0x2b75('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aefba,null))[_0x2b75('0x29')](removeEntity(_0x4aefba,null))['catch'](handleError(_0x4aefba,null));};exports[_0x2b75('0x50')]=function(_0x341c9a,_0x288b33,_0x2ae3f3){var _0x567c9e={};var _0x4a46f9={};var _0x4c0f0f;var _0x1ba0a7;return db[_0x2b75('0x31')][_0x2b75('0x51')]({'where':{'id':_0x341c9a[_0x2b75('0x4a')]['id']}})[_0x2b75('0x29')](handleEntityNotFound(_0x288b33,null))['then'](function(_0x2e9b52){if(_0x2e9b52){_0x4c0f0f=_0x2e9b52;_0x4a46f9[_0x2b75('0x35')]=_[_0x2b75('0x4b')](db['ServicenowConfiguration']['rawAttributes']);_0x4a46f9[_0x2b75('0x36')]=_[_0x2b75('0x4b')](_0x341c9a['query']);_0x4a46f9['filters']=_[_0x2b75('0x37')](_0x4a46f9['model'],_0x4a46f9[_0x2b75('0x36')]);_0x567c9e[_0x2b75('0x38')]=_[_0x2b75('0x37')](_0x4a46f9['model'],qs[_0x2b75('0x39')](_0x341c9a[_0x2b75('0x36')]['fields']));_0x567c9e[_0x2b75('0x38')]=_0x567c9e[_0x2b75('0x38')][_0x2b75('0x3a')]?_0x567c9e[_0x2b75('0x38')]:_0x4a46f9[_0x2b75('0x35')];_0x567c9e[_0x2b75('0x52')]=qs['sort'](_0x341c9a['query'][_0x2b75('0x3d')]);_0x567c9e[_0x2b75('0x3e')]=qs['filters'](_[_0x2b75('0x53')](_0x341c9a[_0x2b75('0x36')],_0x4a46f9[_0x2b75('0x3f')]));if(_0x341c9a[_0x2b75('0x36')][_0x2b75('0x40')]){_0x567c9e[_0x2b75('0x3e')]=_[_0x2b75('0x41')](_0x567c9e['where'],{'$or':_[_0x2b75('0x30')](_0x567c9e[_0x2b75('0x38')],function(_0x5339b3){var _0x33e1bc={};_0x33e1bc[_0x5339b3]={'$like':'%'+_0x341c9a[_0x2b75('0x36')][_0x2b75('0x40')]+'%'};return _0x33e1bc;})});}_0x567c9e=_[_0x2b75('0x41')]({},_0x567c9e,_0x341c9a[_0x2b75('0x43')]);return _0x4c0f0f['getConfigurations'](_0x567c9e);}})[_0x2b75('0x29')](function(_0x7cc98d){if(_0x7cc98d){_0x1ba0a7=_0x7cc98d[_0x2b75('0x3a')];if(!_0x341c9a[_0x2b75('0x36')][_0x2b75('0x3b')](_0x2b75('0x3c'))){_0x567c9e['limit']=qs[_0x2b75('0x23')](_0x341c9a['query']['limit']);_0x567c9e[_0x2b75('0x21')]=qs[_0x2b75('0x21')](_0x341c9a['query'][_0x2b75('0x21')]);}return _0x4c0f0f['getConfigurations'](_0x567c9e);}})['then'](function(_0x4ec9c1){if(_0x4ec9c1){return _0x4ec9c1?{'count':_0x1ba0a7,'rows':_0x4ec9c1}:null;}})['then'](respondWithResult(_0x288b33,null))['catch'](handleError(_0x288b33,null));};exports[_0x2b75('0x54')]=function(_0x1608d3,_0x2478d3,_0x46e973){if(_0x1608d3[_0x2b75('0x4f')]['id']){delete _0x1608d3[_0x2b75('0x4f')]['id'];}return db['ServicenowAccount'][_0x2b75('0x51')]({'where':{'id':_0x1608d3[_0x2b75('0x4a')]['id']}})[_0x2b75('0x29')](handleEntityNotFound(_0x2478d3,null))[_0x2b75('0x29')](function(_0x422e71){if(_0x422e71){_0x1608d3['body'][_0x2b75('0x55')]=_0x422e71['id'];_0x1608d3['body']['Subjects']=integrations[_0x2b75('0x56')](_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x57')],_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x33')]);_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x58')]=integrations[_0x2b75('0x59')](_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x57')],_0x1608d3[_0x2b75('0x4f')][_0x2b75('0x33')]);return db[_0x2b75('0x5a')][_0x2b75('0x4e')](_0x1608d3[_0x2b75('0x4f')],{'include':[{'model':db[_0x2b75('0x5b')],'as':_0x2b75('0x5c')},{'model':db[_0x2b75('0x5b')],'as':_0x2b75('0x58')}]});}return null;})[_0x2b75('0x29')](respondWithResult(_0x2478d3,null))[_0x2b75('0x48')](handleError(_0x2478d3,null));};exports['getFields']=function(_0x3418f4,_0x28cfc0,_0xe44816){var _0xcb697d=[_0x2b75('0x5d'),_0x2b75('0x5e'),_0x2b75('0x5f'),'subcategory',_0x2b75('0x60'),'notify','incident_state',_0x2b75('0x61'),'category'];var _0x918db1=[_0x2b75('0x62'),_0x2b75('0x5d'),_0x2b75('0x63'),'watch_list',_0x2b75('0x64'),'sys_updated_on',_0x2b75('0x65'),_0x2b75('0x5e'),'approval_history','number',_0x2b75('0x66'),_0x2b75('0x67'),_0x2b75('0x68'),_0x2b75('0x69'),_0x2b75('0x6a'),_0x2b75('0x6b'),_0x2b75('0x6c'),_0x2b75('0x6d'),_0x2b75('0x5f'),_0x2b75('0x52'),_0x2b75('0x6e'),_0x2b75('0x6f'),_0x2b75('0x70'),_0x2b75('0x71'),_0x2b75('0x72'),'active','work_notes_list',_0x2b75('0x73'),_0x2b75('0x74'),_0x2b75('0x75'),'rfc',_0x2b75('0x76'),_0x2b75('0x77'),_0x2b75('0x78'),_0x2b75('0x79'),_0x2b75('0x7a'),'work_end',_0x2b75('0x7b'),_0x2b75('0x7c'),_0x2b75('0x7d'),_0x2b75('0x7e'),_0x2b75('0x7f'),_0x2b75('0x80'),_0x2b75('0x81'),'close_code',_0x2b75('0x82'),_0x2b75('0x83'),_0x2b75('0x84'),_0x2b75('0x85'),_0x2b75('0x86'),_0x2b75('0x87'),_0x2b75('0x88'),_0x2b75('0x89'),_0x2b75('0x8a'),_0x2b75('0x8b'),_0x2b75('0x8c'),'closed_by','follow_up',_0x2b75('0x8d'),'sys_id',_0x2b75('0x8e'),_0x2b75('0x8f'),_0x2b75('0x90'),'urgency',_0x2b75('0x91'),_0x2b75('0x92'),_0x2b75('0x93'),_0x2b75('0x94'),'assigned_to',_0x2b75('0x61'),'comments',_0x2b75('0x95'),'approval',_0x2b75('0x96'),_0x2b75('0x97'),_0x2b75('0x98'),_0x2b75('0x99'),_0x2b75('0x9a'),_0x2b75('0x9b'),_0x2b75('0x9c'),'correlation_id',_0x2b75('0x9d'),_0x2b75('0x9e')];var _0x5895bf='';var _0x3cbd2f='';var _0x37f4ca=[];var _0x2652af='';var _0x2ab79e='';var _0x3466b5=[];var _0x27beca='';var _0x370fae='';var _0x24267f={};var _0x38ea3e='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x3418f4[_0x2b75('0x4a')]['id']},'attributes':['id',_0x2b75('0x9f'),_0x2b75('0xa0'),'email',_0x2b75('0xa1'),_0x2b75('0xa2')]})['then'](handleEntityNotFound(_0x28cfc0,null))[_0x2b75('0x29')](function(_0x54714e){if(_0x54714e){_0x38ea3e=_0x54714e[_0x2b75('0xa1')];var _0x549289=_0x38ea3e[_0x2b75('0xa3')](-0x1);if(_0x549289==='/'){_0x38ea3e=_0x38ea3e[_0x2b75('0xa4')](0x0,_0x38ea3e[_0x2b75('0xa5')](_0x549289));}_0x370fae=util[_0x2b75('0xa6')](_0x2b75('0xa7'),_0x38ea3e);_0x27beca=util[_0x2b75('0xa6')](_0x2b75('0xa8'),_0x38ea3e);_0x24267f={'user':_0x54714e[_0x2b75('0x9f')],'pass':_0x54714e[_0x2b75('0xa0')]};var _0x54c426={'method':_0x2b75('0xa9'),'uri':_0x370fae+_0x2b75('0xaa'),'auth':_0x24267f,'json':!![]};return rp(_0x54c426);}})['then'](function(_0x523ee1){if(_0x523ee1[_0x2b75('0xab')]['length']>0x0){_0x5895bf=_0x523ee1['result'];}console[_0x2b75('0xac')](_0x2b75('0xad'),_0x5895bf);_0x3466b5=[];_0x3cbd2f=Object[_0x2b75('0xae')]([],_0x5895bf);_[_0x2b75('0xaf')](_0x3cbd2f,function(_0x1c53c2){return!_0xcb697d[_0x2b75('0xb0')](_0x1c53c2['name']);});_0x3cbd2f[_0x2b75('0xb1')](function(_0x1c964b){var _0x272715=createFieldObject(_0x27beca,_0x24267f,_0x1c964b[_0x2b75('0xb2')],_0x1c964b[_0x2b75('0x2e')],_0x1c964b['label'],![]);_0x3466b5[_0x2b75('0xb3')](_0x272715);});return Promise[_0x2b75('0xb4')](_0x3466b5);})[_0x2b75('0x29')](function(_0xdd85f6){_0x37f4ca=_0xdd85f6;_0x2652af=Object[_0x2b75('0xae')]([],_0x5895bf);console[_0x2b75('0xac')](_0x2b75('0xb5'),_0x5895bf);_['remove'](_0x2652af,function(_0x1e7ecb){return _0x918db1[_0x2b75('0xb0')](_0x1e7ecb['name']);});console['log'](_0x2b75('0xb6'),_0x2652af);_0x3466b5=[];_0x2652af[_0x2b75('0xb1')](function(_0x23a82a){var _0x8667df=createFieldObject(_0x27beca,_0x24267f,_0x23a82a[_0x2b75('0xb2')],_0x23a82a['name'],_0x23a82a[_0x2b75('0xb7')],!![]);_0x3466b5[_0x2b75('0xb3')](_0x8667df);});return Promise['all'](_0x3466b5);})['then'](function(_0x4bef2e){_0x2ab79e=_0x4bef2e;var _0x2b28ad=_0x37f4ca[_0x2b75('0xb8')](_0x2ab79e);return{'count':_0x2b28ad[_0x2b75('0x3a')],'rows':_0x2b28ad};})[_0x2b75('0x29')](respondWithResult(_0x28cfc0,null))[_0x2b75('0x48')](function(_0x6d71d1){console['log'](_0x2b75('0xb9')+_0x6d71d1);var _0x480c92=_0x3418f4['query']['test']?0x1f4:_0x6d71d1[_0x2b75('0xba')]||0x1f4;logger['error'](_0x6d71d1['stack']);delete _0x6d71d1['name'];if(_0x480c92===0x191){_0x480c92=0x190;}_0x28cfc0[_0x2b75('0x1e')](_0x480c92)[_0x2b75('0xbb')](_0x3418f4[_0x2b75('0x36')][_0x2b75('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x6d71d1[_0x2b75('0xba')]}:_0x6d71d1);});};function createFieldObject(_0x1cb80d,_0x7f16d7,_0x50d426,_0x547335,_0x1f452c,_0x336cee){return new Promise(function(_0x14f477,_0x538d48){var _0x41e318={'id':_0x547335,'name':_0x1f452c,'custom':_0x336cee};if(_0x50d426===_0x2b75('0xbd')){_0x41e318[_0x2b75('0x43')]=[{'name':_0x2b75('0xbe'),'value':_0x2b75('0xbf')},{'name':'False','value':'false'}];_0x14f477(_0x41e318);}else{var _0x196792={'method':_0x2b75('0xa9'),'uri':_0x1cb80d+_0x2b75('0xc0')+_0x547335,'auth':_0x7f16d7,'json':!![]};return rp(_0x196792)[_0x2b75('0x29')](function(_0x3cdf4d){var _0x588b4f=[];if(_0x3cdf4d[_0x2b75('0xab')][_0x2b75('0x3a')]>0x0){_0x3cdf4d['result'][_0x2b75('0xb1')](function(_0x2ea486){if(_0x2ea486[_0x2b75('0xc1')]===_0x2b75('0xc2')){var _0x9264d5={'name':_0x2ea486[_0x2b75('0xb7')],'value':_0x2ea486[_0x2b75('0xc3')]};_0x588b4f[_0x2b75('0xb3')](_0x9264d5);}});}_0x41e318[_0x2b75('0x43')]=_0x588b4f;if(_0x41e318['options'][_0x2b75('0x3a')]>0x0){_0x14f477(_0x41e318);}else{if(_0x336cee==![]){_0x14f477();}else{_0x14f477(_0x41e318);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 8aa1b95..e6b42c4 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xf494,0x1c6));var _0x4f49=function(_0x5c5fc6,_0x2b3bf8){_0x5c5fc6=_0x5c5fc6-0x0;var _0x5d3a6b=_0xf494[_0x5c5fc6];return _0x5d3a6b;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x5496,0x175));var _0x6549=function(_0x509353,_0x43c577){_0x509353=_0x509353-0x0;var _0x10bb59=_0x5496[_0x509353];return _0x10bb59;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'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 51024d2..88ee9c5 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 _0xb0b8=['result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x4fa5d7,_0x1a0917){var _0x555100=function(_0x5a60a1){while(--_0x5a60a1){_0x4fa5d7['push'](_0x4fa5d7['shift']());}};_0x555100(++_0x1a0917);}(_0xb0b8,0x182));var _0x8b0b=function(_0x500785,_0x15e5ff){_0x500785=_0x500785-0x0;var _0x1f8bcc=_0xb0b8[_0x500785];return _0x1f8bcc;};'use strict';var _=require(_0x8b0b('0x0'));var util=require('util');var moment=require(_0x8b0b('0x1'));var BPromise=require(_0x8b0b('0x2'));var rs=require(_0x8b0b('0x3'));var fs=require('fs');var Redis=require(_0x8b0b('0x4'));var db=require(_0x8b0b('0x5'))['db'];var utils=require(_0x8b0b('0x6'));var logger=require(_0x8b0b('0x7'))(_0x8b0b('0x8'));var config=require('../../config/environment');var jayson=require(_0x8b0b('0x9'));var client=jayson['client'][_0x8b0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350928,_0x8484a8,_0xb46b56){return new BPromise(function(_0x5c43d5,_0x23ec78){return client[_0x8b0b('0xb')](_0x350928,_0xb46b56)[_0x8b0b('0xc')](function(_0x32a4bc){logger['info'](_0x8b0b('0xd'),_0x8484a8,_0x8b0b('0xe'));logger[_0x8b0b('0xf')](_0x8b0b('0x10'),_0x8484a8,'request\x20sent',JSON['stringify'](_0x32a4bc));if(_0x32a4bc[_0x8b0b('0x11')]){if(_0x32a4bc[_0x8b0b('0x11')][_0x8b0b('0x12')]===0x1f4){logger[_0x8b0b('0x11')](_0x8b0b('0xd'),_0x8484a8,_0x32a4bc[_0x8b0b('0x11')]['message']);return _0x23ec78(_0x32a4bc[_0x8b0b('0x11')][_0x8b0b('0x13')]);}logger[_0x8b0b('0x11')](_0x8b0b('0xd'),_0x8484a8,_0x32a4bc['error'][_0x8b0b('0x13')]);return _0x5c43d5(_0x32a4bc['error']['message']);}else{logger[_0x8b0b('0x14')](_0x8b0b('0xd'),_0x8484a8,_0x8b0b('0xe'));_0x5c43d5(_0x32a4bc[_0x8b0b('0x15')]['message']);}})[_0x8b0b('0x16')](function(_0x3232d4){logger[_0x8b0b('0x11')](_0x8b0b('0xd'),_0x8484a8,_0x3232d4);_0x23ec78(_0x3232d4);});});}exports[_0x8b0b('0x17')]=function(_0x697ae7){var _0xbe8f8c=this;return new Promise(function(_0x143ef9,_0x25ed77){return db[_0x8b0b('0x18')][_0x8b0b('0x19')]({'raw':_0x697ae7[_0x8b0b('0x1a')]?_0x697ae7[_0x8b0b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x697ae7[_0x8b0b('0x1a')]?_0x697ae7[_0x8b0b('0x1a')][_0x8b0b('0x1b')]||null:null,'attributes':_0x697ae7[_0x8b0b('0x1a')]?_0x697ae7[_0x8b0b('0x1a')][_0x8b0b('0x1c')]||null:null,'limit':_0x697ae7[_0x8b0b('0x1a')]?_0x697ae7[_0x8b0b('0x1a')][_0x8b0b('0x1d')]||null:null,'include':_0x697ae7[_0x8b0b('0x1a')]?_0x697ae7[_0x8b0b('0x1a')][_0x8b0b('0x1e')]?_[_0x8b0b('0x1f')](_0x697ae7['options'][_0x8b0b('0x1e')],function(_0x5edefe){return{'model':db[_0x5edefe['model']],'as':_0x5edefe['as'],'attributes':_0x5edefe[_0x8b0b('0x1c')],'include':_0x5edefe[_0x8b0b('0x1e')]?_['map'](_0x5edefe[_0x8b0b('0x1e')],function(_0xf4611b){return{'model':db[_0xf4611b[_0x8b0b('0x20')]],'as':_0xf4611b['as'],'attributes':_0xf4611b[_0x8b0b('0x1c')],'include':_0xf4611b[_0x8b0b('0x1e')]?_[_0x8b0b('0x1f')](_0xf4611b[_0x8b0b('0x1e')],function(_0x504285){return{'model':db[_0x504285['model']],'as':_0x504285['as'],'attributes':_0x504285['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b0b('0xc')](function(_0x172339){logger['info'](_0x8b0b('0x17'),_0x697ae7);logger[_0x8b0b('0xf')](_0x8b0b('0x17'),_0x697ae7,JSON[_0x8b0b('0x21')](_0x172339));_0x143ef9(_0x172339);})[_0x8b0b('0x16')](function(_0xfff344){logger[_0x8b0b('0x11')](_0x8b0b('0x17'),_0xfff344[_0x8b0b('0x13')],_0x697ae7);_0x25ed77(_0xbe8f8c[_0x8b0b('0x11')](0x1f4,_0xfff344[_0x8b0b('0x13')]));});});};exports[_0x8b0b('0x22')]=function(_0x11bd75){var _0x3ffe22=this;return new Promise(function(_0x261d55,_0x205eaa){return db[_0x8b0b('0x18')][_0x8b0b('0x23')]({'raw':_0x11bd75[_0x8b0b('0x1a')]?_0x11bd75['options'][_0x8b0b('0x24')]===undefined?!![]:![]:!![],'where':_0x11bd75['options']?_0x11bd75['options'][_0x8b0b('0x1b')]||null:null,'attributes':_0x11bd75[_0x8b0b('0x1a')]?_0x11bd75[_0x8b0b('0x1a')][_0x8b0b('0x1c')]||null:null,'include':_0x11bd75[_0x8b0b('0x1a')]?_0x11bd75[_0x8b0b('0x1a')][_0x8b0b('0x1e')]?_[_0x8b0b('0x1f')](_0x11bd75[_0x8b0b('0x1a')][_0x8b0b('0x1e')],function(_0x39bd03){return{'model':db[_0x39bd03[_0x8b0b('0x20')]],'as':_0x39bd03['as'],'attributes':_0x39bd03[_0x8b0b('0x1c')],'include':_0x39bd03[_0x8b0b('0x1e')]?_[_0x8b0b('0x1f')](_0x39bd03[_0x8b0b('0x1e')],function(_0x52b6c4){return{'model':db[_0x52b6c4[_0x8b0b('0x20')]],'as':_0x52b6c4['as'],'attributes':_0x52b6c4[_0x8b0b('0x1c')],'include':_0x52b6c4[_0x8b0b('0x1e')]?_[_0x8b0b('0x1f')](_0x52b6c4['include'],function(_0x5e5bb1){return{'model':db[_0x5e5bb1[_0x8b0b('0x20')]],'as':_0x5e5bb1['as'],'attributes':_0x5e5bb1[_0x8b0b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8b0b('0xc')](function(_0x4812be){logger[_0x8b0b('0x14')](_0x8b0b('0x22'),_0x11bd75);logger[_0x8b0b('0xf')](_0x8b0b('0x22'),_0x11bd75,JSON[_0x8b0b('0x21')](_0x4812be));_0x261d55(_0x4812be);})[_0x8b0b('0x16')](function(_0x9b129f){logger[_0x8b0b('0x11')](_0x8b0b('0x22'),_0x9b129f[_0x8b0b('0x13')],_0x11bd75);_0x205eaa(_0x3ffe22['error'](0x1f4,_0x9b129f[_0x8b0b('0x13')]));});});}; \ No newline at end of file +var _0xef55=['result','ServicenowAccount','findAll','raw','options','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','catch','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2de56a,_0x2a0373){var _0x39cfab=function(_0x1b3441){while(--_0x1b3441){_0x2de56a['push'](_0x2de56a['shift']());}};_0x39cfab(++_0x2a0373);}(_0xef55,0xa0));var _0x5ef5=function(_0x17d095,_0x281068){_0x17d095=_0x17d095-0x0;var _0x3a51e2=_0xef55[_0x17d095];return _0x3a51e2;};'use strict';var _=require(_0x5ef5('0x0'));var util=require(_0x5ef5('0x1'));var moment=require('moment');var BPromise=require(_0x5ef5('0x2'));var rs=require(_0x5ef5('0x3'));var fs=require('fs');var Redis=require(_0x5ef5('0x4'));var db=require(_0x5ef5('0x5'))['db'];var utils=require(_0x5ef5('0x6'));var logger=require(_0x5ef5('0x7'))(_0x5ef5('0x8'));var config=require(_0x5ef5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5ef5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412b6f,_0x158e93,_0x53f655){return new BPromise(function(_0x4a4b29,_0x134aba){return client[_0x5ef5('0xb')](_0x412b6f,_0x53f655)[_0x5ef5('0xc')](function(_0x500899){logger[_0x5ef5('0xd')](_0x5ef5('0xe'),_0x158e93,'request\x20sent');logger['debug'](_0x5ef5('0xf'),_0x158e93,_0x5ef5('0x10'),JSON['stringify'](_0x500899));if(_0x500899[_0x5ef5('0x11')]){if(_0x500899[_0x5ef5('0x11')][_0x5ef5('0x12')]===0x1f4){logger[_0x5ef5('0x11')](_0x5ef5('0xe'),_0x158e93,_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);return _0x134aba(_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);}logger['error'](_0x5ef5('0xe'),_0x158e93,_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);return _0x4a4b29(_0x500899[_0x5ef5('0x11')][_0x5ef5('0x13')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x158e93,'request\x20sent');_0x4a4b29(_0x500899[_0x5ef5('0x14')][_0x5ef5('0x13')]);}})['catch'](function(_0x2d87d5){logger[_0x5ef5('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x158e93,_0x2d87d5);_0x134aba(_0x2d87d5);});});}exports['GetServicenowAccount']=function(_0x249f67){var _0x45f1db=this;return new Promise(function(_0x40d5dc,_0xb4e734){return db[_0x5ef5('0x15')][_0x5ef5('0x16')]({'raw':_0x249f67['options']?_0x249f67['options'][_0x5ef5('0x17')]===undefined?!![]:![]:!![],'where':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x19')]||null:null,'attributes':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1a')]||null:null,'limit':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1b')]||null:null,'include':_0x249f67[_0x5ef5('0x18')]?_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1c')]?_[_0x5ef5('0x1d')](_0x249f67[_0x5ef5('0x18')][_0x5ef5('0x1c')],function(_0x53e1b1){return{'model':db[_0x53e1b1[_0x5ef5('0x1e')]],'as':_0x53e1b1['as'],'attributes':_0x53e1b1[_0x5ef5('0x1a')],'include':_0x53e1b1[_0x5ef5('0x1c')]?_['map'](_0x53e1b1[_0x5ef5('0x1c')],function(_0x2966fc){return{'model':db[_0x2966fc[_0x5ef5('0x1e')]],'as':_0x2966fc['as'],'attributes':_0x2966fc[_0x5ef5('0x1a')],'include':_0x2966fc[_0x5ef5('0x1c')]?_[_0x5ef5('0x1d')](_0x2966fc[_0x5ef5('0x1c')],function(_0x4c3ce7){return{'model':db[_0x4c3ce7[_0x5ef5('0x1e')]],'as':_0x4c3ce7['as'],'attributes':_0x4c3ce7[_0x5ef5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef5('0xc')](function(_0x1b2e80){logger['info'](_0x5ef5('0x1f'),_0x249f67);logger['debug'](_0x5ef5('0x1f'),_0x249f67,JSON[_0x5ef5('0x20')](_0x1b2e80));_0x40d5dc(_0x1b2e80);})[_0x5ef5('0x21')](function(_0x1f785e){logger[_0x5ef5('0x11')](_0x5ef5('0x1f'),_0x1f785e[_0x5ef5('0x13')],_0x249f67);_0xb4e734(_0x45f1db[_0x5ef5('0x11')](0x1f4,_0x1f785e[_0x5ef5('0x13')]));});});};exports[_0x5ef5('0x22')]=function(_0xc9ba05){var _0x20dee3=this;return new Promise(function(_0x17cf07,_0x3f362b){return db[_0x5ef5('0x15')][_0x5ef5('0x23')]({'raw':_0xc9ba05['options']?_0xc9ba05['options'][_0x5ef5('0x17')]===undefined?!![]:![]:!![],'where':_0xc9ba05[_0x5ef5('0x18')]?_0xc9ba05[_0x5ef5('0x18')]['where']||null:null,'attributes':_0xc9ba05[_0x5ef5('0x18')]?_0xc9ba05[_0x5ef5('0x18')][_0x5ef5('0x1a')]||null:null,'include':_0xc9ba05[_0x5ef5('0x18')]?_0xc9ba05[_0x5ef5('0x18')][_0x5ef5('0x1c')]?_['map'](_0xc9ba05[_0x5ef5('0x18')]['include'],function(_0x342470){return{'model':db[_0x342470['model']],'as':_0x342470['as'],'attributes':_0x342470['attributes'],'include':_0x342470['include']?_['map'](_0x342470['include'],function(_0x36054f){return{'model':db[_0x36054f['model']],'as':_0x36054f['as'],'attributes':_0x36054f[_0x5ef5('0x1a')],'include':_0x36054f[_0x5ef5('0x1c')]?_['map'](_0x36054f[_0x5ef5('0x1c')],function(_0x45181d){return{'model':db[_0x45181d[_0x5ef5('0x1e')]],'as':_0x45181d['as'],'attributes':_0x45181d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c5b79){logger[_0x5ef5('0xd')](_0x5ef5('0x22'),_0xc9ba05);logger['debug'](_0x5ef5('0x22'),_0xc9ba05,JSON['stringify'](_0x5c5b79));_0x17cf07(_0x5c5b79);})['catch'](function(_0x3fb7c1){logger[_0x5ef5('0x11')](_0x5ef5('0x22'),_0x3fb7c1[_0x5ef5('0x13')],_0xc9ba05);_0x3f362b(_0x20dee3[_0x5ef5('0x11')](0x1f4,_0x3fb7c1['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 1cd827c..fc7be22 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 _0x3c1a=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x22fad2,_0x2d1836){var _0x4b07e3=function(_0x172f8e){while(--_0x172f8e){_0x22fad2['push'](_0x22fad2['shift']());}};_0x4b07e3(++_0x2d1836);}(_0x3c1a,0x1a0));var _0xa3c1=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0x3c1a[_0x3181cc];return _0x547a4a;};'use strict';var multer=require(_0xa3c1('0x0'));var util=require('util');var path=require(_0xa3c1('0x1'));var timeout=require(_0xa3c1('0x2'));var express=require(_0xa3c1('0x3'));var router=express[_0xa3c1('0x4')]();var fs_extra=require(_0xa3c1('0x5'));var auth=require(_0xa3c1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa3c1('0x7'));var controller=require(_0xa3c1('0x8'));router[_0xa3c1('0x9')]('/',auth[_0xa3c1('0xa')](),controller[_0xa3c1('0xb')]);router['get'](_0xa3c1('0xc'),auth[_0xa3c1('0xa')](),controller[_0xa3c1('0xd')]);router[_0xa3c1('0x9')](_0xa3c1('0xe'),auth[_0xa3c1('0xa')](),controller['getFields']);router['get'](_0xa3c1('0xf'),auth['isAuthenticated'](),controller[_0xa3c1('0x10')]);router[_0xa3c1('0x9')](_0xa3c1('0x11'),auth[_0xa3c1('0xa')](),controller[_0xa3c1('0x12')]);router[_0xa3c1('0x13')]('/',auth[_0xa3c1('0xa')](),controller['create']);router[_0xa3c1('0x14')](_0xa3c1('0xc'),auth['isAuthenticated'](),controller[_0xa3c1('0x15')]);router['delete'](_0xa3c1('0xc'),auth[_0xa3c1('0xa')](),controller[_0xa3c1('0x16')]);module[_0xa3c1('0x17')]=router; \ No newline at end of file +var _0xc777=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc777,0x1e1));var _0x7c77=function(_0x5cf64f,_0x107ea5){_0x5cf64f=_0x5cf64f-0x0;var _0x137066=_0xc777[_0x5cf64f];return _0x137066;};'use strict';var multer=require(_0x7c77('0x0'));var util=require(_0x7c77('0x1'));var path=require(_0x7c77('0x2'));var timeout=require(_0x7c77('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c77('0x4'));var auth=require(_0x7c77('0x5'));var interaction=require(_0x7c77('0x6'));var config=require(_0x7c77('0x7'));var controller=require(_0x7c77('0x8'));router[_0x7c77('0x9')]('/',auth[_0x7c77('0xa')](),controller['index']);router[_0x7c77('0x9')](_0x7c77('0xb'),auth['isAuthenticated'](),controller[_0x7c77('0xc')]);router[_0x7c77('0x9')](_0x7c77('0xd'),auth[_0x7c77('0xa')](),controller[_0x7c77('0xe')]);router['get'](_0x7c77('0xf'),auth[_0x7c77('0xa')](),controller[_0x7c77('0x10')]);router['get'](_0x7c77('0x11'),auth[_0x7c77('0xa')](),controller['getDescriptions']);router[_0x7c77('0x12')]('/',auth[_0x7c77('0xa')](),controller['create']);router[_0x7c77('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7c77('0x14')]);router[_0x7c77('0x15')](_0x7c77('0xb'),auth['isAuthenticated'](),controller[_0x7c77('0x16')]);module[_0x7c77('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b2ab0ab..3b79a3f 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 _0x0bf3=['STRING','sequelize'];(function(_0x25ea25,_0x1e6541){var _0x150ba9=function(_0x3ba1ee){while(--_0x3ba1ee){_0x25ea25['push'](_0x25ea25['shift']());}};_0x150ba9(++_0x1e6541);}(_0x0bf3,0xb3));var _0x30bf=function(_0x44383d,_0x38b842){_0x44383d=_0x44383d-0x0;var _0x550814=_0x0bf3[_0x44383d];return _0x550814;};'use strict';var Sequelize=require(_0x30bf('0x0'));module['exports']={'name':{'type':Sequelize[_0x30bf('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36d1=['STRING','sequelize'];(function(_0x12f0fd,_0x108a2f){var _0x52542f=function(_0xf20b6f){while(--_0xf20b6f){_0x12f0fd['push'](_0x12f0fd['shift']());}};_0x52542f(++_0x108a2f);}(_0x36d1,0x163));var _0x136d=function(_0x13e2de,_0x1d4869){_0x13e2de=_0x13e2de-0x0;var _0x1d3a0a=_0x36d1[_0x13e2de];return _0x1d3a0a;};'use strict';var Sequelize=require(_0x136d('0x0'));module['exports']={'name':{'type':Sequelize[_0x136d('0x1')]},'description':{'type':Sequelize[_0x136d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e23afdd..1138c89 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 _0xc085=['fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','length','include','options','find','create','body','params','getFields','findOne','pick','nolimit','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowConfiguration','rawAttributes'];(function(_0x3b7093,_0x581899){var _0x456daa=function(_0x500508){while(--_0x500508){_0x3b7093['push'](_0x3b7093['shift']());}};_0x456daa(++_0x581899);}(_0xc085,0x167));var _0x5c08=function(_0x124fa4,_0x5069d8){_0x124fa4=_0x124fa4-0x0;var _0x59a039=_0xc085[_0x124fa4];return _0x59a039;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c08('0x0'));var zipdir=require(_0x5c08('0x1'));var jsonpatch=require(_0x5c08('0x2'));var rp=require(_0x5c08('0x3'));var moment=require(_0x5c08('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5c08('0x5'));var path=require('path');var sox=require(_0x5c08('0x6'));var csv=require(_0x5c08('0x7'));var ejs=require(_0x5c08('0x8'));var fs=require('fs');var fs_extra=require(_0x5c08('0x9'));var _=require(_0x5c08('0xa'));var squel=require(_0x5c08('0xb'));var crypto=require(_0x5c08('0xc'));var jsforce=require(_0x5c08('0xd'));var deskjs=require(_0x5c08('0xe'));var toCsv=require(_0x5c08('0x7'));var querystring=require('querystring');var Papa=require(_0x5c08('0xf'));var Redis=require(_0x5c08('0x10'));var authService=require(_0x5c08('0x11'));var qs=require(_0x5c08('0x12'));var as=require(_0x5c08('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c08('0x14'))('api');var utils=require(_0x5c08('0x15'));var config=require(_0x5c08('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c08('0x17'))['db'];function respondWithStatusCode(_0x1b0204,_0x89938a){_0x89938a=_0x89938a||0xcc;return function(_0x37c447){if(_0x37c447){return _0x1b0204[_0x5c08('0x18')](_0x89938a);}return _0x1b0204['status'](_0x89938a)[_0x5c08('0x19')]();};}function respondWithResult(_0x23ceed,_0x5c368d){_0x5c368d=_0x5c368d||0xc8;return function(_0x1c9d7a){if(_0x1c9d7a){return _0x23ceed[_0x5c08('0x1a')](_0x5c368d)[_0x5c08('0x1b')](_0x1c9d7a);}};}function respondWithFilteredResult(_0x391dc4,_0x5ea984){return function(_0xa35568){if(_0xa35568){var _0x1ffab9=typeof _0x5ea984[_0x5c08('0x1c')]==='undefined'&&typeof _0x5ea984[_0x5c08('0x1d')]==='undefined';var _0x5c7427=_0xa35568[_0x5c08('0x1e')];var _0xf51f0c=_0x1ffab9?0x0:_0x5ea984['offset'];var _0x3d3f36=_0x1ffab9?_0xa35568['count']:_0x5ea984[_0x5c08('0x1c')]+_0x5ea984[_0x5c08('0x1d')];var _0x75133;if(_0x3d3f36>=_0x5c7427){_0x3d3f36=_0x5c7427;_0x75133=0xc8;}else{_0x75133=0xce;}_0x391dc4[_0x5c08('0x1a')](_0x75133);return _0x391dc4[_0x5c08('0x1f')](_0x5c08('0x20'),_0xf51f0c+'-'+_0x3d3f36+'/'+_0x5c7427)[_0x5c08('0x1b')](_0xa35568);}return null;};}function patchUpdates(_0x87fec9){return function(_0x1d2ab2){try{jsonpatch[_0x5c08('0x21')](_0x1d2ab2,_0x87fec9,!![]);}catch(_0x1f75a2){return BPromise[_0x5c08('0x22')](_0x1f75a2);}return _0x1d2ab2[_0x5c08('0x23')]();};}function saveUpdates(_0x97f609,_0x1ba41d){return function(_0x1080e6){if(_0x1080e6){return _0x1080e6[_0x5c08('0x24')](_0x97f609)[_0x5c08('0x25')](function(_0x1793e3){return _0x1793e3;});}return null;};}function removeEntity(_0x4e9f6b,_0x4bd9ae){return function(_0x29688f){if(_0x29688f){return _0x29688f[_0x5c08('0x26')]()[_0x5c08('0x25')](function(){_0x4e9f6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x456f17,_0x54941f){return function(_0x5a2072){if(!_0x5a2072){_0x456f17[_0x5c08('0x18')](0x194);}return _0x5a2072;};}function handleError(_0x4c5b64,_0x4a3279){_0x4a3279=_0x4a3279||0x1f4;return function(_0x22e965){logger[_0x5c08('0x27')](_0x22e965[_0x5c08('0x28')]);if(_0x22e965[_0x5c08('0x29')]){delete _0x22e965[_0x5c08('0x29')];}_0x4c5b64[_0x5c08('0x1a')](_0x4a3279)['send'](_0x22e965);};}exports[_0x5c08('0x2a')]=function(_0x3a4ee8,_0x4cdf38){var _0x528b86={},_0x2cb577={},_0xe61563={'count':0x0,'rows':[]};var _0x1993ab=_[_0x5c08('0x2b')](db[_0x5c08('0x2c')][_0x5c08('0x2d')],function(_0x54d98){return{'name':_0x54d98[_0x5c08('0x2e')],'type':_0x54d98['type']['key']};});_0x2cb577[_0x5c08('0x2f')]=_[_0x5c08('0x2b')](_0x1993ab,'name');_0x2cb577[_0x5c08('0x30')]=_[_0x5c08('0x31')](_0x3a4ee8[_0x5c08('0x30')]);_0x2cb577[_0x5c08('0x32')]=_[_0x5c08('0x33')](_0x2cb577[_0x5c08('0x2f')],_0x2cb577['query']);_0x528b86[_0x5c08('0x34')]=_[_0x5c08('0x33')](_0x2cb577['model'],qs['fields'](_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x35')]));_0x528b86['attributes']=_0x528b86[_0x5c08('0x34')]['length']?_0x528b86['attributes']:_0x2cb577[_0x5c08('0x2f')];if(!_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x36')]('nolimit')){_0x528b86[_0x5c08('0x1d')]=qs[_0x5c08('0x1d')](_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x1d')]);_0x528b86[_0x5c08('0x1c')]=qs[_0x5c08('0x1c')](_0x3a4ee8['query'][_0x5c08('0x1c')]);}_0x528b86[_0x5c08('0x37')]=qs[_0x5c08('0x38')](_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x38')]);_0x528b86[_0x5c08('0x39')]=qs[_0x5c08('0x32')](_['pick'](_0x3a4ee8['query'],_0x2cb577['filters']),_0x1993ab);if(_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x3a')]){_0x528b86[_0x5c08('0x39')]=_[_0x5c08('0x3b')](_0x528b86[_0x5c08('0x39')],{'$or':_[_0x5c08('0x2b')](_0x1993ab,function(_0x10f666){if(_0x10f666[_0x5c08('0x3c')]!==_0x5c08('0x3d')){var _0x24a1d1={};_0x24a1d1[_0x10f666[_0x5c08('0x29')]]={'$like':'%'+_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x3a')]+'%'};return _0x24a1d1;}})});}_0x528b86=_['merge']({},_0x528b86,_0x3a4ee8['options']);var _0x11ec3b={'where':_0x528b86[_0x5c08('0x39')]};return db[_0x5c08('0x2c')]['count'](_0x11ec3b)[_0x5c08('0x25')](function(_0x13b3fd){_0xe61563[_0x5c08('0x1e')]=_0x13b3fd;if(_0x3a4ee8[_0x5c08('0x30')][_0x5c08('0x3e')]){_0x528b86['include']=[{'all':!![]}];}return db[_0x5c08('0x2c')][_0x5c08('0x3f')](_0x528b86);})[_0x5c08('0x25')](function(_0x2a7ac1){_0xe61563[_0x5c08('0x40')]=_0x2a7ac1;return _0xe61563;})[_0x5c08('0x25')](respondWithFilteredResult(_0x4cdf38,_0x528b86))[_0x5c08('0x41')](handleError(_0x4cdf38,null));};exports[_0x5c08('0x42')]=function(_0x50e03b,_0xb8e563){var _0x5ad400={'raw':![],'where':{'id':_0x50e03b['params']['id']}},_0x2573fe={};_0x2573fe[_0x5c08('0x2f')]=_[_0x5c08('0x31')](db[_0x5c08('0x2c')]['rawAttributes']);_0x2573fe[_0x5c08('0x30')]=_['keys'](_0x50e03b['query']);_0x2573fe[_0x5c08('0x32')]=_[_0x5c08('0x33')](_0x2573fe['model'],_0x2573fe[_0x5c08('0x30')]);_0x5ad400[_0x5c08('0x34')]=_[_0x5c08('0x33')](_0x2573fe[_0x5c08('0x2f')],qs[_0x5c08('0x35')](_0x50e03b[_0x5c08('0x30')][_0x5c08('0x35')]));_0x5ad400['attributes']=_0x5ad400[_0x5c08('0x34')][_0x5c08('0x43')]?_0x5ad400['attributes']:_0x2573fe[_0x5c08('0x2f')];if(_0x50e03b[_0x5c08('0x30')]['includeAll']){_0x5ad400[_0x5c08('0x44')]=[{'all':!![]}];}_0x5ad400=_['merge']({},_0x5ad400,_0x50e03b[_0x5c08('0x45')]);return db['ServicenowConfiguration'][_0x5c08('0x46')](_0x5ad400)[_0x5c08('0x25')](handleEntityNotFound(_0xb8e563,null))[_0x5c08('0x25')](respondWithResult(_0xb8e563,null))[_0x5c08('0x41')](handleError(_0xb8e563,null));};exports[_0x5c08('0x47')]=function(_0x3d5b2d,_0x11398b){return db[_0x5c08('0x2c')][_0x5c08('0x47')](_0x3d5b2d[_0x5c08('0x48')],{})['then'](respondWithResult(_0x11398b,0xc9))['catch'](handleError(_0x11398b,null));};exports['update']=function(_0x304cfd,_0x43cc8a){if(_0x304cfd[_0x5c08('0x48')]['id']){delete _0x304cfd[_0x5c08('0x48')]['id'];}return db[_0x5c08('0x2c')][_0x5c08('0x46')]({'where':{'id':_0x304cfd['params']['id']}})[_0x5c08('0x25')](handleEntityNotFound(_0x43cc8a,null))[_0x5c08('0x25')](saveUpdates(_0x304cfd['body'],null))[_0x5c08('0x25')](respondWithResult(_0x43cc8a,null))[_0x5c08('0x41')](handleError(_0x43cc8a,null));};exports[_0x5c08('0x26')]=function(_0x1247fe,_0x1f168a){return db['ServicenowConfiguration'][_0x5c08('0x46')]({'where':{'id':_0x1247fe[_0x5c08('0x49')]['id']}})[_0x5c08('0x25')](handleEntityNotFound(_0x1f168a,null))[_0x5c08('0x25')](removeEntity(_0x1f168a,null))[_0x5c08('0x41')](handleError(_0x1f168a,null));};exports[_0x5c08('0x4a')]=function(_0x28fe0a,_0x6a59c9,_0x587f31){var _0x4ceee9={};var _0x44d978={};var _0x709f4f;var _0x727ee7;return db['ServicenowConfiguration'][_0x5c08('0x4b')]({'where':{'id':_0x28fe0a[_0x5c08('0x49')]['id']}})[_0x5c08('0x25')](handleEntityNotFound(_0x6a59c9,null))[_0x5c08('0x25')](function(_0x4d1b02){if(_0x4d1b02){_0x709f4f=_0x4d1b02;_0x44d978[_0x5c08('0x2f')]=_[_0x5c08('0x31')](db['ServicenowField'][_0x5c08('0x2d')]);_0x44d978['query']=_[_0x5c08('0x31')](_0x28fe0a['query']);_0x44d978['filters']=_[_0x5c08('0x33')](_0x44d978[_0x5c08('0x2f')],_0x44d978['query']);_0x4ceee9[_0x5c08('0x34')]=_[_0x5c08('0x33')](_0x44d978['model'],qs[_0x5c08('0x35')](_0x28fe0a[_0x5c08('0x30')]['fields']));_0x4ceee9[_0x5c08('0x34')]=_0x4ceee9[_0x5c08('0x34')][_0x5c08('0x43')]?_0x4ceee9['attributes']:_0x44d978[_0x5c08('0x2f')];_0x4ceee9[_0x5c08('0x37')]=qs['sort'](_0x28fe0a['query'][_0x5c08('0x38')]);_0x4ceee9['where']=qs['filters'](_[_0x5c08('0x4c')](_0x28fe0a[_0x5c08('0x30')],_0x44d978[_0x5c08('0x32')]));if(_0x28fe0a[_0x5c08('0x30')][_0x5c08('0x3a')]){_0x4ceee9[_0x5c08('0x39')]=_[_0x5c08('0x3b')](_0x4ceee9[_0x5c08('0x39')],{'$or':_[_0x5c08('0x2b')](_0x4ceee9[_0x5c08('0x34')],function(_0x230b4c){var _0x40dacd={};_0x40dacd[_0x230b4c]={'$like':'%'+_0x28fe0a['query'][_0x5c08('0x3a')]+'%'};return _0x40dacd;})});}_0x4ceee9=_[_0x5c08('0x3b')]({},_0x4ceee9,_0x28fe0a[_0x5c08('0x45')]);return _0x709f4f[_0x5c08('0x4a')](_0x4ceee9);}})[_0x5c08('0x25')](function(_0x1ec401){if(_0x1ec401){_0x727ee7=_0x1ec401['length'];if(!_0x28fe0a[_0x5c08('0x30')][_0x5c08('0x36')](_0x5c08('0x4d'))){_0x4ceee9[_0x5c08('0x1d')]=qs[_0x5c08('0x1d')](_0x28fe0a[_0x5c08('0x30')]['limit']);_0x4ceee9[_0x5c08('0x1c')]=qs['offset'](_0x28fe0a[_0x5c08('0x30')][_0x5c08('0x1c')]);}return _0x709f4f[_0x5c08('0x4a')](_0x4ceee9);}})['then'](function(_0x5ebc96){if(_0x5ebc96){return _0x5ebc96?{'count':_0x727ee7,'rows':_0x5ebc96}:null;}})[_0x5c08('0x25')](respondWithResult(_0x6a59c9,null))[_0x5c08('0x41')](handleError(_0x6a59c9,null));};exports['getSubjects']=function(_0x1ba0d8,_0x12437b,_0x4bb6b1){var _0x9c0c77={};var _0x4564ce={};var _0x1107ef;var _0x374b72;return db[_0x5c08('0x2c')][_0x5c08('0x4b')]({'where':{'id':_0x1ba0d8[_0x5c08('0x49')]['id']}})[_0x5c08('0x25')](handleEntityNotFound(_0x12437b,null))[_0x5c08('0x25')](function(_0x1034cc){if(_0x1034cc){_0x1107ef=_0x1034cc;_0x4564ce[_0x5c08('0x2f')]=_[_0x5c08('0x31')](db[_0x5c08('0x4e')][_0x5c08('0x2d')]);_0x4564ce['query']=_[_0x5c08('0x31')](_0x1ba0d8[_0x5c08('0x30')]);_0x4564ce[_0x5c08('0x32')]=_[_0x5c08('0x33')](_0x4564ce['model'],_0x4564ce[_0x5c08('0x30')]);_0x9c0c77[_0x5c08('0x34')]=_[_0x5c08('0x33')](_0x4564ce[_0x5c08('0x2f')],qs[_0x5c08('0x35')](_0x1ba0d8['query'][_0x5c08('0x35')]));_0x9c0c77[_0x5c08('0x34')]=_0x9c0c77[_0x5c08('0x34')]['length']?_0x9c0c77[_0x5c08('0x34')]:_0x4564ce[_0x5c08('0x2f')];_0x9c0c77['order']=qs[_0x5c08('0x38')](_0x1ba0d8[_0x5c08('0x30')][_0x5c08('0x38')]);_0x9c0c77[_0x5c08('0x39')]=qs[_0x5c08('0x32')](_[_0x5c08('0x4c')](_0x1ba0d8['query'],_0x4564ce[_0x5c08('0x32')]));if(_0x1ba0d8[_0x5c08('0x30')]['filter']){_0x9c0c77['where']=_[_0x5c08('0x3b')](_0x9c0c77[_0x5c08('0x39')],{'$or':_['map'](_0x9c0c77['attributes'],function(_0x11a7c7){var _0xbc0a5={};_0xbc0a5[_0x11a7c7]={'$like':'%'+_0x1ba0d8[_0x5c08('0x30')][_0x5c08('0x3a')]+'%'};return _0xbc0a5;})});}_0x9c0c77=_['merge']({},_0x9c0c77,_0x1ba0d8[_0x5c08('0x45')]);return _0x1107ef[_0x5c08('0x4f')](_0x9c0c77);}})[_0x5c08('0x25')](function(_0x607df4){if(_0x607df4){_0x374b72=_0x607df4[_0x5c08('0x43')];if(!_0x1ba0d8[_0x5c08('0x30')][_0x5c08('0x36')](_0x5c08('0x4d'))){_0x9c0c77['limit']=qs[_0x5c08('0x1d')](_0x1ba0d8[_0x5c08('0x30')]['limit']);_0x9c0c77['offset']=qs[_0x5c08('0x1c')](_0x1ba0d8['query']['offset']);}return _0x1107ef[_0x5c08('0x4f')](_0x9c0c77);}})[_0x5c08('0x25')](function(_0x2c4ec9){if(_0x2c4ec9){return _0x2c4ec9?{'count':_0x374b72,'rows':_0x2c4ec9}:null;}})[_0x5c08('0x25')](respondWithResult(_0x12437b,null))[_0x5c08('0x41')](handleError(_0x12437b,null));};exports['getDescriptions']=function(_0x79f11e,_0x12fd0c,_0x514f77){var _0x1a0c2b={};var _0x3864ec={};var _0x4ca195;var _0x5cebf3;return db[_0x5c08('0x2c')][_0x5c08('0x4b')]({'where':{'id':_0x79f11e[_0x5c08('0x49')]['id']}})['then'](handleEntityNotFound(_0x12fd0c,null))['then'](function(_0x1f0749){if(_0x1f0749){_0x4ca195=_0x1f0749;_0x3864ec[_0x5c08('0x2f')]=_[_0x5c08('0x31')](db[_0x5c08('0x4e')][_0x5c08('0x2d')]);_0x3864ec['query']=_[_0x5c08('0x31')](_0x79f11e[_0x5c08('0x30')]);_0x3864ec[_0x5c08('0x32')]=_[_0x5c08('0x33')](_0x3864ec[_0x5c08('0x2f')],_0x3864ec['query']);_0x1a0c2b[_0x5c08('0x34')]=_['intersection'](_0x3864ec['model'],qs[_0x5c08('0x35')](_0x79f11e[_0x5c08('0x30')]['fields']));_0x1a0c2b['attributes']=_0x1a0c2b[_0x5c08('0x34')][_0x5c08('0x43')]?_0x1a0c2b[_0x5c08('0x34')]:_0x3864ec['model'];_0x1a0c2b[_0x5c08('0x37')]=qs[_0x5c08('0x38')](_0x79f11e[_0x5c08('0x30')][_0x5c08('0x38')]);_0x1a0c2b[_0x5c08('0x39')]=qs[_0x5c08('0x32')](_[_0x5c08('0x4c')](_0x79f11e[_0x5c08('0x30')],_0x3864ec[_0x5c08('0x32')]));if(_0x79f11e[_0x5c08('0x30')][_0x5c08('0x3a')]){_0x1a0c2b[_0x5c08('0x39')]=_[_0x5c08('0x3b')](_0x1a0c2b[_0x5c08('0x39')],{'$or':_[_0x5c08('0x2b')](_0x1a0c2b[_0x5c08('0x34')],function(_0xb58039){var _0x55533f={};_0x55533f[_0xb58039]={'$like':'%'+_0x79f11e[_0x5c08('0x30')][_0x5c08('0x3a')]+'%'};return _0x55533f;})});}_0x1a0c2b=_[_0x5c08('0x3b')]({},_0x1a0c2b,_0x79f11e[_0x5c08('0x45')]);return _0x4ca195[_0x5c08('0x50')](_0x1a0c2b);}})[_0x5c08('0x25')](function(_0xb0d184){if(_0xb0d184){_0x5cebf3=_0xb0d184[_0x5c08('0x43')];if(!_0x79f11e[_0x5c08('0x30')][_0x5c08('0x36')](_0x5c08('0x4d'))){_0x1a0c2b[_0x5c08('0x1d')]=qs[_0x5c08('0x1d')](_0x79f11e[_0x5c08('0x30')][_0x5c08('0x1d')]);_0x1a0c2b[_0x5c08('0x1c')]=qs[_0x5c08('0x1c')](_0x79f11e[_0x5c08('0x30')][_0x5c08('0x1c')]);}return _0x4ca195[_0x5c08('0x50')](_0x1a0c2b);}})[_0x5c08('0x25')](function(_0x583d7b){if(_0x583d7b){return _0x583d7b?{'count':_0x5cebf3,'rows':_0x583d7b}:null;}})['then'](respondWithResult(_0x12fd0c,null))[_0x5c08('0x41')](handleError(_0x12fd0c,null));}; \ No newline at end of file +var _0x1f24=['reject','save','destroy','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','getSubjects','ServicenowField','order','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f24,0x1cd));var _0x41f2=function(_0x50890a,_0x14522a){_0x50890a=_0x50890a-0x0;var _0x1fec19=_0x1f24[_0x50890a];return _0x1fec19;};'use strict';var emlformat=require(_0x41f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41f2('0x2'));var moment=require(_0x41f2('0x3'));var BPromise=require(_0x41f2('0x4'));var Mustache=require('mustache');var util=require(_0x41f2('0x5'));var path=require('path');var sox=require(_0x41f2('0x6'));var csv=require(_0x41f2('0x7'));var ejs=require(_0x41f2('0x8'));var fs=require('fs');var fs_extra=require(_0x41f2('0x9'));var _=require(_0x41f2('0xa'));var squel=require('squel');var crypto=require(_0x41f2('0xb'));var jsforce=require(_0x41f2('0xc'));var deskjs=require(_0x41f2('0xd'));var toCsv=require(_0x41f2('0x7'));var querystring=require(_0x41f2('0xe'));var Papa=require(_0x41f2('0xf'));var Redis=require(_0x41f2('0x10'));var authService=require(_0x41f2('0x11'));var qs=require(_0x41f2('0x12'));var as=require(_0x41f2('0x13'));var hardwareService=require(_0x41f2('0x14'));var logger=require(_0x41f2('0x15'))(_0x41f2('0x16'));var utils=require(_0x41f2('0x17'));var config=require(_0x41f2('0x18'));var licenseUtil=require(_0x41f2('0x19'));var db=require(_0x41f2('0x1a'))['db'];function respondWithStatusCode(_0xa8fb21,_0x22d3b8){_0x22d3b8=_0x22d3b8||0xcc;return function(_0x5e5843){if(_0x5e5843){return _0xa8fb21[_0x41f2('0x1b')](_0x22d3b8);}return _0xa8fb21[_0x41f2('0x1c')](_0x22d3b8)[_0x41f2('0x1d')]();};}function respondWithResult(_0x547440,_0x28d91a){_0x28d91a=_0x28d91a||0xc8;return function(_0x33d399){if(_0x33d399){return _0x547440['status'](_0x28d91a)['json'](_0x33d399);}};}function respondWithFilteredResult(_0x48ddee,_0x1d5445){return function(_0x36cc68){if(_0x36cc68){var _0x2b9f84=typeof _0x1d5445[_0x41f2('0x1e')]===_0x41f2('0x1f')&&typeof _0x1d5445[_0x41f2('0x20')]===_0x41f2('0x1f');var _0x4a7ac0=_0x36cc68[_0x41f2('0x21')];var _0x46a1a8=_0x2b9f84?0x0:_0x1d5445[_0x41f2('0x1e')];var _0x5f1674=_0x2b9f84?_0x36cc68[_0x41f2('0x21')]:_0x1d5445[_0x41f2('0x1e')]+_0x1d5445[_0x41f2('0x20')];var _0x3b08a0;if(_0x5f1674>=_0x4a7ac0){_0x5f1674=_0x4a7ac0;_0x3b08a0=0xc8;}else{_0x3b08a0=0xce;}_0x48ddee[_0x41f2('0x1c')](_0x3b08a0);return _0x48ddee['set'](_0x41f2('0x22'),_0x46a1a8+'-'+_0x5f1674+'/'+_0x4a7ac0)[_0x41f2('0x23')](_0x36cc68);}return null;};}function patchUpdates(_0x4e31bc){return function(_0x3e4afb){try{jsonpatch[_0x41f2('0x24')](_0x3e4afb,_0x4e31bc,!![]);}catch(_0x903a80){return BPromise[_0x41f2('0x25')](_0x903a80);}return _0x3e4afb[_0x41f2('0x26')]();};}function saveUpdates(_0x3a255f,_0x3086c5){return function(_0x1a2563){if(_0x1a2563){return _0x1a2563['update'](_0x3a255f)['then'](function(_0x71851f){return _0x71851f;});}return null;};}function removeEntity(_0x3a07b5,_0x581b7d){return function(_0x397704){if(_0x397704){return _0x397704[_0x41f2('0x27')]()[_0x41f2('0x28')](function(){_0x3a07b5[_0x41f2('0x1c')](0xcc)[_0x41f2('0x1d')]();});}};}function handleEntityNotFound(_0x404059,_0xb3ef60){return function(_0x3c4b64){if(!_0x3c4b64){_0x404059['sendStatus'](0x194);}return _0x3c4b64;};}function handleError(_0xda48e0,_0x30e214){_0x30e214=_0x30e214||0x1f4;return function(_0x3b2ddb){logger[_0x41f2('0x29')](_0x3b2ddb[_0x41f2('0x2a')]);if(_0x3b2ddb[_0x41f2('0x2b')]){delete _0x3b2ddb['name'];}_0xda48e0[_0x41f2('0x1c')](_0x30e214)[_0x41f2('0x2c')](_0x3b2ddb);};}exports[_0x41f2('0x2d')]=function(_0x44695a,_0x24a1e6){var _0x540e6a={},_0x268bb2={},_0x47f7d9={'count':0x0,'rows':[]};var _0x432fd1=_['map'](db[_0x41f2('0x2e')][_0x41f2('0x2f')],function(_0x1b3e03){return{'name':_0x1b3e03[_0x41f2('0x30')],'type':_0x1b3e03[_0x41f2('0x31')][_0x41f2('0x32')]};});_0x268bb2[_0x41f2('0x33')]=_[_0x41f2('0x34')](_0x432fd1,_0x41f2('0x2b'));_0x268bb2['query']=_[_0x41f2('0x35')](_0x44695a[_0x41f2('0x36')]);_0x268bb2[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x268bb2[_0x41f2('0x33')],_0x268bb2[_0x41f2('0x36')]);_0x540e6a[_0x41f2('0x39')]=_['intersection'](_0x268bb2[_0x41f2('0x33')],qs[_0x41f2('0x3a')](_0x44695a[_0x41f2('0x36')][_0x41f2('0x3a')]));_0x540e6a['attributes']=_0x540e6a[_0x41f2('0x39')][_0x41f2('0x3b')]?_0x540e6a[_0x41f2('0x39')]:_0x268bb2[_0x41f2('0x33')];if(!_0x44695a[_0x41f2('0x36')][_0x41f2('0x3c')](_0x41f2('0x3d'))){_0x540e6a[_0x41f2('0x20')]=qs[_0x41f2('0x20')](_0x44695a[_0x41f2('0x36')]['limit']);_0x540e6a[_0x41f2('0x1e')]=qs['offset'](_0x44695a[_0x41f2('0x36')][_0x41f2('0x1e')]);}_0x540e6a['order']=qs[_0x41f2('0x3e')](_0x44695a[_0x41f2('0x36')]['sort']);_0x540e6a['where']=qs[_0x41f2('0x37')](_[_0x41f2('0x3f')](_0x44695a[_0x41f2('0x36')],_0x268bb2['filters']),_0x432fd1);if(_0x44695a['query']['filter']){_0x540e6a[_0x41f2('0x40')]=_[_0x41f2('0x41')](_0x540e6a[_0x41f2('0x40')],{'$or':_['map'](_0x432fd1,function(_0xe81a74){if(_0xe81a74[_0x41f2('0x31')]!=='VIRTUAL'){var _0x27a9f4={};_0x27a9f4[_0xe81a74[_0x41f2('0x2b')]]={'$like':'%'+_0x44695a[_0x41f2('0x36')][_0x41f2('0x42')]+'%'};return _0x27a9f4;}})});}_0x540e6a=_[_0x41f2('0x41')]({},_0x540e6a,_0x44695a[_0x41f2('0x43')]);var _0x2bc340={'where':_0x540e6a['where']};return db[_0x41f2('0x2e')][_0x41f2('0x21')](_0x2bc340)['then'](function(_0x2fd85d){_0x47f7d9[_0x41f2('0x21')]=_0x2fd85d;if(_0x44695a[_0x41f2('0x36')][_0x41f2('0x44')]){_0x540e6a[_0x41f2('0x45')]=[{'all':!![]}];}return db[_0x41f2('0x2e')]['findAll'](_0x540e6a);})[_0x41f2('0x28')](function(_0x487ba4){_0x47f7d9[_0x41f2('0x46')]=_0x487ba4;return _0x47f7d9;})[_0x41f2('0x28')](respondWithFilteredResult(_0x24a1e6,_0x540e6a))[_0x41f2('0x47')](handleError(_0x24a1e6,null));};exports[_0x41f2('0x48')]=function(_0x3a61b6,_0xa63e2c){var _0x1e74b7={'raw':![],'where':{'id':_0x3a61b6[_0x41f2('0x49')]['id']}},_0x5ea025={};_0x5ea025['model']=_[_0x41f2('0x35')](db[_0x41f2('0x2e')][_0x41f2('0x2f')]);_0x5ea025[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x3a61b6[_0x41f2('0x36')]);_0x5ea025[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x5ea025[_0x41f2('0x33')],_0x5ea025[_0x41f2('0x36')]);_0x1e74b7[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x5ea025[_0x41f2('0x33')],qs['fields'](_0x3a61b6[_0x41f2('0x36')]['fields']));_0x1e74b7['attributes']=_0x1e74b7[_0x41f2('0x39')]['length']?_0x1e74b7[_0x41f2('0x39')]:_0x5ea025['model'];if(_0x3a61b6[_0x41f2('0x36')]['includeAll']){_0x1e74b7[_0x41f2('0x45')]=[{'all':!![]}];}_0x1e74b7=_[_0x41f2('0x41')]({},_0x1e74b7,_0x3a61b6[_0x41f2('0x43')]);return db[_0x41f2('0x2e')][_0x41f2('0x4a')](_0x1e74b7)['then'](handleEntityNotFound(_0xa63e2c,null))['then'](respondWithResult(_0xa63e2c,null))[_0x41f2('0x47')](handleError(_0xa63e2c,null));};exports[_0x41f2('0x4b')]=function(_0x238c6c,_0x1cc316){return db[_0x41f2('0x2e')][_0x41f2('0x4b')](_0x238c6c[_0x41f2('0x4c')],{})[_0x41f2('0x28')](respondWithResult(_0x1cc316,0xc9))[_0x41f2('0x47')](handleError(_0x1cc316,null));};exports['update']=function(_0x423fb2,_0x3c8648){if(_0x423fb2[_0x41f2('0x4c')]['id']){delete _0x423fb2[_0x41f2('0x4c')]['id'];}return db[_0x41f2('0x2e')][_0x41f2('0x4a')]({'where':{'id':_0x423fb2[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x3c8648,null))[_0x41f2('0x28')](saveUpdates(_0x423fb2[_0x41f2('0x4c')],null))[_0x41f2('0x28')](respondWithResult(_0x3c8648,null))[_0x41f2('0x47')](handleError(_0x3c8648,null));};exports[_0x41f2('0x27')]=function(_0x5c7223,_0x5938ec){return db[_0x41f2('0x2e')][_0x41f2('0x4a')]({'where':{'id':_0x5c7223[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x5938ec,null))[_0x41f2('0x28')](removeEntity(_0x5938ec,null))[_0x41f2('0x47')](handleError(_0x5938ec,null));};exports[_0x41f2('0x4d')]=function(_0x4afffb,_0x4ea831,_0x555bf9){var _0x5ea600={};var _0x42a50d={};var _0x48120f;var _0x3de83f;return db[_0x41f2('0x2e')][_0x41f2('0x4e')]({'where':{'id':_0x4afffb[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x4ea831,null))[_0x41f2('0x28')](function(_0x490eee){if(_0x490eee){_0x48120f=_0x490eee;_0x42a50d[_0x41f2('0x33')]=_['keys'](db['ServicenowField'][_0x41f2('0x2f')]);_0x42a50d[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x4afffb['query']);_0x42a50d[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x42a50d[_0x41f2('0x33')],_0x42a50d[_0x41f2('0x36')]);_0x5ea600[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x42a50d[_0x41f2('0x33')],qs[_0x41f2('0x3a')](_0x4afffb['query']['fields']));_0x5ea600[_0x41f2('0x39')]=_0x5ea600[_0x41f2('0x39')][_0x41f2('0x3b')]?_0x5ea600[_0x41f2('0x39')]:_0x42a50d[_0x41f2('0x33')];_0x5ea600['order']=qs['sort'](_0x4afffb[_0x41f2('0x36')]['sort']);_0x5ea600[_0x41f2('0x40')]=qs['filters'](_['pick'](_0x4afffb[_0x41f2('0x36')],_0x42a50d[_0x41f2('0x37')]));if(_0x4afffb[_0x41f2('0x36')]['filter']){_0x5ea600[_0x41f2('0x40')]=_[_0x41f2('0x41')](_0x5ea600[_0x41f2('0x40')],{'$or':_['map'](_0x5ea600['attributes'],function(_0x1bea45){var _0x5970e1={};_0x5970e1[_0x1bea45]={'$like':'%'+_0x4afffb[_0x41f2('0x36')][_0x41f2('0x42')]+'%'};return _0x5970e1;})});}_0x5ea600=_[_0x41f2('0x41')]({},_0x5ea600,_0x4afffb[_0x41f2('0x43')]);return _0x48120f['getFields'](_0x5ea600);}})[_0x41f2('0x28')](function(_0x4dfb4c){if(_0x4dfb4c){_0x3de83f=_0x4dfb4c[_0x41f2('0x3b')];if(!_0x4afffb[_0x41f2('0x36')][_0x41f2('0x3c')]('nolimit')){_0x5ea600[_0x41f2('0x20')]=qs[_0x41f2('0x20')](_0x4afffb['query']['limit']);_0x5ea600[_0x41f2('0x1e')]=qs[_0x41f2('0x1e')](_0x4afffb[_0x41f2('0x36')][_0x41f2('0x1e')]);}return _0x48120f['getFields'](_0x5ea600);}})[_0x41f2('0x28')](function(_0x416ad1){if(_0x416ad1){return _0x416ad1?{'count':_0x3de83f,'rows':_0x416ad1}:null;}})[_0x41f2('0x28')](respondWithResult(_0x4ea831,null))['catch'](handleError(_0x4ea831,null));};exports[_0x41f2('0x4f')]=function(_0x503e2a,_0x527fd0,_0x403f59){var _0x245867={};var _0x40bf77={};var _0x2a3bc4;var _0x11e6e2;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x503e2a[_0x41f2('0x49')]['id']}})[_0x41f2('0x28')](handleEntityNotFound(_0x527fd0,null))['then'](function(_0xc16125){if(_0xc16125){_0x2a3bc4=_0xc16125;_0x40bf77['model']=_['keys'](db[_0x41f2('0x50')][_0x41f2('0x2f')]);_0x40bf77[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x503e2a['query']);_0x40bf77[_0x41f2('0x37')]=_[_0x41f2('0x38')](_0x40bf77[_0x41f2('0x33')],_0x40bf77[_0x41f2('0x36')]);_0x245867[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x40bf77['model'],qs[_0x41f2('0x3a')](_0x503e2a['query'][_0x41f2('0x3a')]));_0x245867[_0x41f2('0x39')]=_0x245867['attributes']['length']?_0x245867[_0x41f2('0x39')]:_0x40bf77[_0x41f2('0x33')];_0x245867[_0x41f2('0x51')]=qs[_0x41f2('0x3e')](_0x503e2a['query']['sort']);_0x245867['where']=qs[_0x41f2('0x37')](_[_0x41f2('0x3f')](_0x503e2a[_0x41f2('0x36')],_0x40bf77['filters']));if(_0x503e2a[_0x41f2('0x36')][_0x41f2('0x42')]){_0x245867[_0x41f2('0x40')]=_[_0x41f2('0x41')](_0x245867[_0x41f2('0x40')],{'$or':_[_0x41f2('0x34')](_0x245867[_0x41f2('0x39')],function(_0x581d30){var _0x707a6c={};_0x707a6c[_0x581d30]={'$like':'%'+_0x503e2a[_0x41f2('0x36')][_0x41f2('0x42')]+'%'};return _0x707a6c;})});}_0x245867=_[_0x41f2('0x41')]({},_0x245867,_0x503e2a[_0x41f2('0x43')]);return _0x2a3bc4[_0x41f2('0x4f')](_0x245867);}})['then'](function(_0x289390){if(_0x289390){_0x11e6e2=_0x289390['length'];if(!_0x503e2a[_0x41f2('0x36')]['hasOwnProperty'](_0x41f2('0x3d'))){_0x245867['limit']=qs[_0x41f2('0x20')](_0x503e2a[_0x41f2('0x36')]['limit']);_0x245867[_0x41f2('0x1e')]=qs[_0x41f2('0x1e')](_0x503e2a[_0x41f2('0x36')][_0x41f2('0x1e')]);}return _0x2a3bc4[_0x41f2('0x4f')](_0x245867);}})[_0x41f2('0x28')](function(_0x571e36){if(_0x571e36){return _0x571e36?{'count':_0x11e6e2,'rows':_0x571e36}:null;}})['then'](respondWithResult(_0x527fd0,null))[_0x41f2('0x47')](handleError(_0x527fd0,null));};exports[_0x41f2('0x52')]=function(_0x5dff5c,_0x57a7f1,_0x1047be){var _0x5c7018={};var _0x20289a={};var _0x1c9bef;var _0x3391dc;return db['ServicenowConfiguration'][_0x41f2('0x4e')]({'where':{'id':_0x5dff5c[_0x41f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x57a7f1,null))[_0x41f2('0x28')](function(_0x566502){if(_0x566502){_0x1c9bef=_0x566502;_0x20289a['model']=_[_0x41f2('0x35')](db['ServicenowField'][_0x41f2('0x2f')]);_0x20289a[_0x41f2('0x36')]=_[_0x41f2('0x35')](_0x5dff5c['query']);_0x20289a['filters']=_[_0x41f2('0x38')](_0x20289a[_0x41f2('0x33')],_0x20289a['query']);_0x5c7018[_0x41f2('0x39')]=_[_0x41f2('0x38')](_0x20289a[_0x41f2('0x33')],qs[_0x41f2('0x3a')](_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x3a')]));_0x5c7018[_0x41f2('0x39')]=_0x5c7018[_0x41f2('0x39')][_0x41f2('0x3b')]?_0x5c7018[_0x41f2('0x39')]:_0x20289a[_0x41f2('0x33')];_0x5c7018[_0x41f2('0x51')]=qs[_0x41f2('0x3e')](_0x5dff5c[_0x41f2('0x36')]['sort']);_0x5c7018[_0x41f2('0x40')]=qs[_0x41f2('0x37')](_[_0x41f2('0x3f')](_0x5dff5c[_0x41f2('0x36')],_0x20289a['filters']));if(_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x42')]){_0x5c7018['where']=_[_0x41f2('0x41')](_0x5c7018[_0x41f2('0x40')],{'$or':_[_0x41f2('0x34')](_0x5c7018[_0x41f2('0x39')],function(_0xf7e90b){var _0x20e43e={};_0x20e43e[_0xf7e90b]={'$like':'%'+_0x5dff5c['query']['filter']+'%'};return _0x20e43e;})});}_0x5c7018=_[_0x41f2('0x41')]({},_0x5c7018,_0x5dff5c[_0x41f2('0x43')]);return _0x1c9bef[_0x41f2('0x52')](_0x5c7018);}})[_0x41f2('0x28')](function(_0x3ea762){if(_0x3ea762){_0x3391dc=_0x3ea762[_0x41f2('0x3b')];if(!_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x3c')]('nolimit')){_0x5c7018[_0x41f2('0x20')]=qs['limit'](_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x20')]);_0x5c7018[_0x41f2('0x1e')]=qs[_0x41f2('0x1e')](_0x5dff5c[_0x41f2('0x36')][_0x41f2('0x1e')]);}return _0x1c9bef[_0x41f2('0x52')](_0x5c7018);}})[_0x41f2('0x28')](function(_0x4462c4){if(_0x4462c4){return _0x4462c4?{'count':_0x3391dc,'rows':_0x4462c4}:null;}})['then'](respondWithResult(_0x57a7f1,null))['catch'](handleError(_0x57a7f1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 879f54a..f0900af 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 _0x7d06=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0x7d06,0x158));var _0x67d0=function(_0x1ed8d9,_0x4e1db1){_0x1ed8d9=_0x1ed8d9-0x0;var _0x2dea54=_0x7d06[_0x1ed8d9];return _0x2dea54;};'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 +var _0xf65d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','int_servicenow_configurations','lodash'];(function(_0x353904,_0x5e57c3){var _0x3d1870=function(_0x258b82){while(--_0x258b82){_0x353904['push'](_0x353904['shift']());}};_0x3d1870(++_0x5e57c3);}(_0xf65d,0x9f));var _0xdf65=function(_0x3938d2,_0x8e9793){_0x3938d2=_0x3938d2-0x0;var _0x45513c=_0xf65d[_0x3938d2];return _0x45513c;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xdf65('0x9'),'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 8048916..e05a580 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 _0x06cc=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x06cc,0x18e));var _0xc06c=function(_0x251fdc,_0x59d38a){_0x251fdc=_0x251fdc-0x0;var _0x7d70b4=_0x06cc[_0x251fdc];return _0x7d70b4;};'use strict';var _=require(_0xc06c('0x0'));var util=require(_0xc06c('0x1'));var moment=require(_0xc06c('0x2'));var BPromise=require(_0xc06c('0x3'));var rs=require(_0xc06c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc06c('0x5'))['db'];var utils=require(_0xc06c('0x6'));var logger=require(_0xc06c('0x7'))(_0xc06c('0x8'));var config=require('../../config/environment');var jayson=require(_0xc06c('0x9'));var client=jayson[_0xc06c('0xa')][_0xc06c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x708d4d,_0x461520,_0x32650d){return new BPromise(function(_0x2e290c,_0x2390bf){return client[_0xc06c('0xc')](_0x708d4d,_0x32650d)[_0xc06c('0xd')](function(_0x4ca4ec){logger[_0xc06c('0xe')](_0xc06c('0xf'),_0x461520,'request\x20sent');logger['debug'](_0xc06c('0x10'),_0x461520,_0xc06c('0x11'),JSON['stringify'](_0x4ca4ec));if(_0x4ca4ec[_0xc06c('0x12')]){if(_0x4ca4ec['error'][_0xc06c('0x13')]===0x1f4){logger[_0xc06c('0x12')](_0xc06c('0xf'),_0x461520,_0x4ca4ec['error'][_0xc06c('0x14')]);return _0x2390bf(_0x4ca4ec[_0xc06c('0x12')][_0xc06c('0x14')]);}logger[_0xc06c('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x461520,_0x4ca4ec[_0xc06c('0x12')][_0xc06c('0x14')]);return _0x2e290c(_0x4ca4ec[_0xc06c('0x12')][_0xc06c('0x14')]);}else{logger['info'](_0xc06c('0xf'),_0x461520,_0xc06c('0x11'));_0x2e290c(_0x4ca4ec['result'][_0xc06c('0x14')]);}})['catch'](function(_0x5a48f3){logger[_0xc06c('0x12')](_0xc06c('0xf'),_0x461520,_0x5a48f3);_0x2390bf(_0x5a48f3);});});} \ No newline at end of file +var _0x1279=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1279,0x1b9));var _0x9127=function(_0x3b57ed,_0x23679f){_0x3b57ed=_0x3b57ed-0x0;var _0x197a5a=_0x1279[_0x3b57ed];return _0x197a5a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9127('0x0'));var BPromise=require(_0x9127('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9127('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9127('0x3'));var logger=require(_0x9127('0x4'))(_0x9127('0x5'));var config=require(_0x9127('0x6'));var jayson=require(_0x9127('0x7'));var client=jayson[_0x9127('0x8')][_0x9127('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x837d13,_0x5ce665,_0x4fb892){return new BPromise(function(_0x4be4e9,_0x23f7b0){return client[_0x9127('0xa')](_0x837d13,_0x4fb892)[_0x9127('0xb')](function(_0x39f174){logger[_0x9127('0xc')](_0x9127('0xd'),_0x5ce665,_0x9127('0xe'));logger[_0x9127('0xf')](_0x9127('0x10'),_0x5ce665,_0x9127('0xe'),JSON['stringify'](_0x39f174));if(_0x39f174[_0x9127('0x11')]){if(_0x39f174[_0x9127('0x11')][_0x9127('0x12')]===0x1f4){logger[_0x9127('0x11')](_0x9127('0xd'),_0x5ce665,_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);return _0x23f7b0(_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5ce665,_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);return _0x4be4e9(_0x39f174[_0x9127('0x11')][_0x9127('0x13')]);}else{logger[_0x9127('0xc')](_0x9127('0xd'),_0x5ce665,_0x9127('0xe'));_0x4be4e9(_0x39f174['result'][_0x9127('0x13')]);}})[_0x9127('0x14')](function(_0x246f56){logger[_0x9127('0x11')](_0x9127('0xd'),_0x5ce665,_0x246f56);_0x23f7b0(_0x246f56);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a87f65f..a4c6244 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 _0x020f=['get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0x020f,0x1e5));var _0xf020=function(_0x29fab1,_0x423dad){_0x29fab1=_0x29fab1-0x0;var _0x14f75e=_0x020f[_0x29fab1];return _0x14f75e;};'use strict';var multer=require(_0xf020('0x0'));var util=require(_0xf020('0x1'));var path=require('path');var timeout=require(_0xf020('0x2'));var express=require(_0xf020('0x3'));var router=express[_0xf020('0x4')]();var fs_extra=require(_0xf020('0x5'));var auth=require(_0xf020('0x6'));var interaction=require(_0xf020('0x7'));var config=require('../../config/environment');var controller=require(_0xf020('0x8'));router[_0xf020('0x9')]('/',auth[_0xf020('0xa')](),controller['index']);router[_0xf020('0x9')](_0xf020('0xb'),auth[_0xf020('0xa')](),controller[_0xf020('0xc')]);router[_0xf020('0xd')]('/',auth[_0xf020('0xa')](),controller[_0xf020('0xe')]);router[_0xf020('0xf')](_0xf020('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf020('0x10')](_0xf020('0xb'),auth['isAuthenticated'](),controller[_0xf020('0x11')]);module[_0xf020('0x12')]=router; \ No newline at end of file +var _0xdcf7=['../../components/auth/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xdcf7,0x16b));var _0x7dcf=function(_0x576d1d,_0x44b457){_0x576d1d=_0x576d1d-0x0;var _0x56ad86=_0xdcf7[_0x576d1d];return _0x56ad86;};'use strict';var multer=require(_0x7dcf('0x0'));var util=require('util');var path=require(_0x7dcf('0x1'));var timeout=require(_0x7dcf('0x2'));var express=require(_0x7dcf('0x3'));var router=express['Router']();var fs_extra=require(_0x7dcf('0x4'));var auth=require(_0x7dcf('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7dcf('0x6'));router['get']('/',auth[_0x7dcf('0x7')](),controller[_0x7dcf('0x8')]);router[_0x7dcf('0x9')](_0x7dcf('0xa'),auth['isAuthenticated'](),controller[_0x7dcf('0xb')]);router[_0x7dcf('0xc')]('/',auth[_0x7dcf('0x7')](),controller[_0x7dcf('0xd')]);router['put'](_0x7dcf('0xa'),auth[_0x7dcf('0x7')](),controller['update']);router['delete'](_0x7dcf('0xa'),auth[_0x7dcf('0x7')](),controller[_0x7dcf('0xe')]);module[_0x7dcf('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 602ce16..b2627d6 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 _0x81fd=['BOOLEAN','sequelize','string','variable','customVariable','STRING','ENUM'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x81fd,0x166));var _0xd81f=function(_0x468484,_0x694a64){_0x468484=_0x468484-0x0;var _0x3a06a3=_0x81fd[_0x468484];return _0x3a06a3;};'use strict';var Sequelize=require(_0xd81f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xd81f('0x1'),_0xd81f('0x2'),_0xd81f('0x3'),'keyValue','picklist'),'defaultValue':_0xd81f('0x1')},'content':{'type':Sequelize[_0xd81f('0x4')]},'key':{'type':Sequelize[_0xd81f('0x4')]},'keyType':{'type':Sequelize[_0xd81f('0x5')](_0xd81f('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xd81f('0x4')]},'idField':{'type':Sequelize[_0xd81f('0x4')]},'nameField':{'type':Sequelize[_0xd81f('0x4')]},'customField':{'type':Sequelize[_0xd81f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd81f('0x4')]}}; \ No newline at end of file +var _0x73e5=['exports','ENUM','variable','keyValue','picklist','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x73e5,0x1d3));var _0x573e=function(_0x38f86b,_0x45b662){_0x38f86b=_0x38f86b-0x0;var _0x10832f=_0x73e5[_0x38f86b];return _0x10832f;};'use strict';var Sequelize=require(_0x573e('0x0'));module[_0x573e('0x1')]={'type':{'type':Sequelize[_0x573e('0x2')]('string',_0x573e('0x3'),'customVariable',_0x573e('0x4'),_0x573e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x573e('0x3'),_0x573e('0x6'))},'keyContent':{'type':Sequelize[_0x573e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x573e('0x7')]},'customField':{'type':Sequelize[_0x573e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x573e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 8a4309f..d9ef009 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 _0x08af=['fields','attributes','length','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','then','end','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x08af,0xea));var _0xf08a=function(_0x40bdb3,_0x5a81f2){_0x40bdb3=_0x40bdb3-0x0;var _0xeac086=_0x08af[_0x40bdb3];return _0xeac086;};'use strict';var emlformat=require(_0xf08a('0x0'));var rimraf=require(_0xf08a('0x1'));var zipdir=require(_0xf08a('0x2'));var jsonpatch=require(_0xf08a('0x3'));var rp=require(_0xf08a('0x4'));var moment=require(_0xf08a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf08a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf08a('0x7'));var ejs=require(_0xf08a('0x8'));var fs=require('fs');var fs_extra=require(_0xf08a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf08a('0xa'));var jsforce=require(_0xf08a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf08a('0x7'));var querystring=require(_0xf08a('0xc'));var Papa=require(_0xf08a('0xd'));var Redis=require(_0xf08a('0xe'));var authService=require(_0xf08a('0xf'));var qs=require(_0xf08a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf08a('0x11'));var logger=require('../../config/logger')(_0xf08a('0x12'));var utils=require(_0xf08a('0x13'));var config=require(_0xf08a('0x14'));var licenseUtil=require(_0xf08a('0x15'));var db=require(_0xf08a('0x16'))['db'];function respondWithStatusCode(_0x2e9c47,_0x4df082){_0x4df082=_0x4df082||0xcc;return function(_0x246246){if(_0x246246){return _0x2e9c47[_0xf08a('0x17')](_0x4df082);}return _0x2e9c47[_0xf08a('0x18')](_0x4df082)['end']();};}function respondWithResult(_0x538859,_0x437b97){_0x437b97=_0x437b97||0xc8;return function(_0x48fbe5){if(_0x48fbe5){return _0x538859[_0xf08a('0x18')](_0x437b97)[_0xf08a('0x19')](_0x48fbe5);}};}function respondWithFilteredResult(_0xb89014,_0xc15e2b){return function(_0x1abda2){if(_0x1abda2){var _0x54ab30=typeof _0xc15e2b[_0xf08a('0x1a')]===_0xf08a('0x1b')&&typeof _0xc15e2b[_0xf08a('0x1c')]===_0xf08a('0x1b');var _0x78f2c4=_0x1abda2[_0xf08a('0x1d')];var _0x5462aa=_0x54ab30?0x0:_0xc15e2b['offset'];var _0x2be504=_0x54ab30?_0x1abda2['count']:_0xc15e2b[_0xf08a('0x1a')]+_0xc15e2b[_0xf08a('0x1c')];var _0x30d90d;if(_0x2be504>=_0x78f2c4){_0x2be504=_0x78f2c4;_0x30d90d=0xc8;}else{_0x30d90d=0xce;}_0xb89014[_0xf08a('0x18')](_0x30d90d);return _0xb89014['set'](_0xf08a('0x1e'),_0x5462aa+'-'+_0x2be504+'/'+_0x78f2c4)[_0xf08a('0x19')](_0x1abda2);}return null;};}function patchUpdates(_0x2a4e84){return function(_0x52f547){try{jsonpatch['apply'](_0x52f547,_0x2a4e84,!![]);}catch(_0x5452c7){return BPromise[_0xf08a('0x1f')](_0x5452c7);}return _0x52f547['save']();};}function saveUpdates(_0x1c81c8,_0x4c1061){return function(_0x3bc08a){if(_0x3bc08a){return _0x3bc08a['update'](_0x1c81c8)[_0xf08a('0x20')](function(_0x518830){return _0x518830;});}return null;};}function removeEntity(_0x59b747,_0xd1bf16){return function(_0x1a2a6b){if(_0x1a2a6b){return _0x1a2a6b['destroy']()[_0xf08a('0x20')](function(){_0x59b747[_0xf08a('0x18')](0xcc)[_0xf08a('0x21')]();});}};}function handleEntityNotFound(_0x524a99,_0x3713e5){return function(_0x502be1){if(!_0x502be1){_0x524a99[_0xf08a('0x17')](0x194);}return _0x502be1;};}function handleError(_0x7f8296,_0x4b6cfb){_0x4b6cfb=_0x4b6cfb||0x1f4;return function(_0x232cd8){logger[_0xf08a('0x22')](_0x232cd8[_0xf08a('0x23')]);if(_0x232cd8[_0xf08a('0x24')]){delete _0x232cd8['name'];}_0x7f8296['status'](_0x4b6cfb)[_0xf08a('0x25')](_0x232cd8);};}exports[_0xf08a('0x26')]=function(_0x221100,_0x4c5aec){var _0x4a3d21={},_0x4dd415={},_0x422032={'count':0x0,'rows':[]};var _0x105c3a=_[_0xf08a('0x27')](db[_0xf08a('0x28')][_0xf08a('0x29')],function(_0x2f33eb){return{'name':_0x2f33eb[_0xf08a('0x2a')],'type':_0x2f33eb[_0xf08a('0x2b')][_0xf08a('0x2c')]};});_0x4dd415['model']=_[_0xf08a('0x27')](_0x105c3a,_0xf08a('0x24'));_0x4dd415['query']=_[_0xf08a('0x2d')](_0x221100['query']);_0x4dd415[_0xf08a('0x2e')]=_[_0xf08a('0x2f')](_0x4dd415[_0xf08a('0x30')],_0x4dd415[_0xf08a('0x31')]);_0x4a3d21['attributes']=_[_0xf08a('0x2f')](_0x4dd415['model'],qs[_0xf08a('0x32')](_0x221100[_0xf08a('0x31')][_0xf08a('0x32')]));_0x4a3d21[_0xf08a('0x33')]=_0x4a3d21[_0xf08a('0x33')][_0xf08a('0x34')]?_0x4a3d21[_0xf08a('0x33')]:_0x4dd415[_0xf08a('0x30')];if(!_0x221100[_0xf08a('0x31')]['hasOwnProperty']('nolimit')){_0x4a3d21[_0xf08a('0x1c')]=qs['limit'](_0x221100['query'][_0xf08a('0x1c')]);_0x4a3d21[_0xf08a('0x1a')]=qs[_0xf08a('0x1a')](_0x221100['query']['offset']);}_0x4a3d21[_0xf08a('0x35')]=qs[_0xf08a('0x36')](_0x221100[_0xf08a('0x31')]['sort']);_0x4a3d21[_0xf08a('0x37')]=qs[_0xf08a('0x2e')](_[_0xf08a('0x38')](_0x221100[_0xf08a('0x31')],_0x4dd415['filters']),_0x105c3a);if(_0x221100[_0xf08a('0x31')][_0xf08a('0x39')]){_0x4a3d21[_0xf08a('0x37')]=_[_0xf08a('0x3a')](_0x4a3d21[_0xf08a('0x37')],{'$or':_[_0xf08a('0x27')](_0x105c3a,function(_0x2df70b){if(_0x2df70b[_0xf08a('0x2b')]!=='VIRTUAL'){var _0x1f26a5={};_0x1f26a5[_0x2df70b[_0xf08a('0x24')]]={'$like':'%'+_0x221100[_0xf08a('0x31')][_0xf08a('0x39')]+'%'};return _0x1f26a5;}})});}_0x4a3d21=_[_0xf08a('0x3a')]({},_0x4a3d21,_0x221100[_0xf08a('0x3b')]);var _0x3b1139={'where':_0x4a3d21[_0xf08a('0x37')]};return db['ServicenowField'][_0xf08a('0x1d')](_0x3b1139)['then'](function(_0x2c4150){_0x422032[_0xf08a('0x1d')]=_0x2c4150;if(_0x221100[_0xf08a('0x31')][_0xf08a('0x3c')]){_0x4a3d21['include']=[{'all':!![]}];}return db['ServicenowField'][_0xf08a('0x3d')](_0x4a3d21);})[_0xf08a('0x20')](function(_0x487398){_0x422032[_0xf08a('0x3e')]=_0x487398;return _0x422032;})['then'](respondWithFilteredResult(_0x4c5aec,_0x4a3d21))[_0xf08a('0x3f')](handleError(_0x4c5aec,null));};exports[_0xf08a('0x40')]=function(_0x496655,_0x4dfdf5){var _0x30c6f0={'raw':!![],'where':{'id':_0x496655[_0xf08a('0x41')]['id']}},_0x14c5e5={};_0x14c5e5[_0xf08a('0x30')]=_[_0xf08a('0x2d')](db['ServicenowField'][_0xf08a('0x29')]);_0x14c5e5['query']=_['keys'](_0x496655[_0xf08a('0x31')]);_0x14c5e5['filters']=_[_0xf08a('0x2f')](_0x14c5e5['model'],_0x14c5e5['query']);_0x30c6f0[_0xf08a('0x33')]=_[_0xf08a('0x2f')](_0x14c5e5['model'],qs[_0xf08a('0x32')](_0x496655[_0xf08a('0x31')][_0xf08a('0x32')]));_0x30c6f0['attributes']=_0x30c6f0[_0xf08a('0x33')][_0xf08a('0x34')]?_0x30c6f0[_0xf08a('0x33')]:_0x14c5e5[_0xf08a('0x30')];if(_0x496655['query']['includeAll']){_0x30c6f0[_0xf08a('0x42')]=[{'all':!![]}];}_0x30c6f0=_[_0xf08a('0x3a')]({},_0x30c6f0,_0x496655[_0xf08a('0x3b')]);return db['ServicenowField']['find'](_0x30c6f0)[_0xf08a('0x20')](handleEntityNotFound(_0x4dfdf5,null))[_0xf08a('0x20')](respondWithResult(_0x4dfdf5,null))[_0xf08a('0x3f')](handleError(_0x4dfdf5,null));};exports[_0xf08a('0x43')]=function(_0x20a87f,_0x3e1d65){return db['ServicenowField'][_0xf08a('0x43')](_0x20a87f[_0xf08a('0x44')],{})[_0xf08a('0x20')](respondWithResult(_0x3e1d65,0xc9))['catch'](handleError(_0x3e1d65,null));};exports['update']=function(_0x135e60,_0x37cb7c){if(_0x135e60['body']['id']){delete _0x135e60[_0xf08a('0x44')]['id'];}return db['ServicenowField'][_0xf08a('0x45')]({'where':{'id':_0x135e60['params']['id']}})[_0xf08a('0x20')](handleEntityNotFound(_0x37cb7c,null))[_0xf08a('0x20')](saveUpdates(_0x135e60[_0xf08a('0x44')],null))[_0xf08a('0x20')](respondWithResult(_0x37cb7c,null))['catch'](handleError(_0x37cb7c,null));};exports[_0xf08a('0x46')]=function(_0x4e9099,_0x5eff39){return db['ServicenowField'][_0xf08a('0x45')]({'where':{'id':_0x4e9099[_0xf08a('0x41')]['id']}})[_0xf08a('0x20')](handleEntityNotFound(_0x5eff39,null))[_0xf08a('0x20')](removeEntity(_0x5eff39,null))[_0xf08a('0x3f')](handleError(_0x5eff39,null));}; \ No newline at end of file +var _0xdcc5=['include','findAll','catch','show','params','rawAttributes','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','sendStatus','error','stack','name','send','map','ServicenowField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xdcc5,0x121));var _0x5dcc=function(_0x528ca6,_0x19d493){_0x528ca6=_0x528ca6-0x0;var _0x44f41c=_0xdcc5[_0x528ca6];return _0x44f41c;};'use strict';var emlformat=require(_0x5dcc('0x0'));var rimraf=require(_0x5dcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dcc('0x2'));var rp=require(_0x5dcc('0x3'));var moment=require(_0x5dcc('0x4'));var BPromise=require(_0x5dcc('0x5'));var Mustache=require(_0x5dcc('0x6'));var util=require(_0x5dcc('0x7'));var path=require('path');var sox=require(_0x5dcc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5dcc('0x9'));var squel=require(_0x5dcc('0xa'));var crypto=require(_0x5dcc('0xb'));var jsforce=require(_0x5dcc('0xc'));var deskjs=require(_0x5dcc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5dcc('0xe'));var Papa=require(_0x5dcc('0xf'));var Redis=require(_0x5dcc('0x10'));var authService=require(_0x5dcc('0x11'));var qs=require(_0x5dcc('0x12'));var as=require(_0x5dcc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dcc('0x14'))(_0x5dcc('0x15'));var utils=require('../../config/utils');var config=require(_0x5dcc('0x16'));var licenseUtil=require(_0x5dcc('0x17'));var db=require(_0x5dcc('0x18'))['db'];function respondWithStatusCode(_0x2280c2,_0x5b5d27){_0x5b5d27=_0x5b5d27||0xcc;return function(_0x29fc6f){if(_0x29fc6f){return _0x2280c2['sendStatus'](_0x5b5d27);}return _0x2280c2[_0x5dcc('0x19')](_0x5b5d27)[_0x5dcc('0x1a')]();};}function respondWithResult(_0x3c1d69,_0x56a12f){_0x56a12f=_0x56a12f||0xc8;return function(_0x1915ed){if(_0x1915ed){return _0x3c1d69[_0x5dcc('0x19')](_0x56a12f)[_0x5dcc('0x1b')](_0x1915ed);}};}function respondWithFilteredResult(_0x5b241e,_0x28f6a9){return function(_0x3fa20a){if(_0x3fa20a){var _0x1218ce=typeof _0x28f6a9['offset']===_0x5dcc('0x1c')&&typeof _0x28f6a9[_0x5dcc('0x1d')]==='undefined';var _0x1b0e9f=_0x3fa20a[_0x5dcc('0x1e')];var _0x59f779=_0x1218ce?0x0:_0x28f6a9[_0x5dcc('0x1f')];var _0x27277f=_0x1218ce?_0x3fa20a['count']:_0x28f6a9[_0x5dcc('0x1f')]+_0x28f6a9[_0x5dcc('0x1d')];var _0x9b9d17;if(_0x27277f>=_0x1b0e9f){_0x27277f=_0x1b0e9f;_0x9b9d17=0xc8;}else{_0x9b9d17=0xce;}_0x5b241e[_0x5dcc('0x19')](_0x9b9d17);return _0x5b241e[_0x5dcc('0x20')](_0x5dcc('0x21'),_0x59f779+'-'+_0x27277f+'/'+_0x1b0e9f)[_0x5dcc('0x1b')](_0x3fa20a);}return null;};}function patchUpdates(_0x4f5922){return function(_0x424e0c){try{jsonpatch[_0x5dcc('0x22')](_0x424e0c,_0x4f5922,!![]);}catch(_0x4254d6){return BPromise['reject'](_0x4254d6);}return _0x424e0c['save']();};}function saveUpdates(_0x34698b,_0x4c7df2){return function(_0x2d9405){if(_0x2d9405){return _0x2d9405['update'](_0x34698b)[_0x5dcc('0x23')](function(_0x1f5f22){return _0x1f5f22;});}return null;};}function removeEntity(_0x6955f6,_0xe621f3){return function(_0x17dcd3){if(_0x17dcd3){return _0x17dcd3['destroy']()[_0x5dcc('0x23')](function(){_0x6955f6[_0x5dcc('0x19')](0xcc)[_0x5dcc('0x1a')]();});}};}function handleEntityNotFound(_0xfa19d7,_0x1fb430){return function(_0x12f4c8){if(!_0x12f4c8){_0xfa19d7[_0x5dcc('0x24')](0x194);}return _0x12f4c8;};}function handleError(_0x305c13,_0x198688){_0x198688=_0x198688||0x1f4;return function(_0x5aaae2){logger[_0x5dcc('0x25')](_0x5aaae2[_0x5dcc('0x26')]);if(_0x5aaae2['name']){delete _0x5aaae2[_0x5dcc('0x27')];}_0x305c13[_0x5dcc('0x19')](_0x198688)[_0x5dcc('0x28')](_0x5aaae2);};}exports['index']=function(_0x5b157e,_0x4d9202){var _0x3f8739={},_0x3dacbd={},_0xcd65d3={'count':0x0,'rows':[]};var _0x18458f=_[_0x5dcc('0x29')](db[_0x5dcc('0x2a')]['rawAttributes'],function(_0x40351c){return{'name':_0x40351c[_0x5dcc('0x2b')],'type':_0x40351c[_0x5dcc('0x2c')]['key']};});_0x3dacbd[_0x5dcc('0x2d')]=_['map'](_0x18458f,_0x5dcc('0x27'));_0x3dacbd[_0x5dcc('0x2e')]=_[_0x5dcc('0x2f')](_0x5b157e[_0x5dcc('0x2e')]);_0x3dacbd[_0x5dcc('0x30')]=_[_0x5dcc('0x31')](_0x3dacbd[_0x5dcc('0x2d')],_0x3dacbd[_0x5dcc('0x2e')]);_0x3f8739[_0x5dcc('0x32')]=_['intersection'](_0x3dacbd[_0x5dcc('0x2d')],qs[_0x5dcc('0x33')](_0x5b157e[_0x5dcc('0x2e')][_0x5dcc('0x33')]));_0x3f8739[_0x5dcc('0x32')]=_0x3f8739[_0x5dcc('0x32')][_0x5dcc('0x34')]?_0x3f8739[_0x5dcc('0x32')]:_0x3dacbd[_0x5dcc('0x2d')];if(!_0x5b157e[_0x5dcc('0x2e')][_0x5dcc('0x35')](_0x5dcc('0x36'))){_0x3f8739[_0x5dcc('0x1d')]=qs[_0x5dcc('0x1d')](_0x5b157e['query'][_0x5dcc('0x1d')]);_0x3f8739['offset']=qs[_0x5dcc('0x1f')](_0x5b157e['query'][_0x5dcc('0x1f')]);}_0x3f8739['order']=qs[_0x5dcc('0x37')](_0x5b157e[_0x5dcc('0x2e')]['sort']);_0x3f8739[_0x5dcc('0x38')]=qs['filters'](_['pick'](_0x5b157e[_0x5dcc('0x2e')],_0x3dacbd['filters']),_0x18458f);if(_0x5b157e['query'][_0x5dcc('0x39')]){_0x3f8739[_0x5dcc('0x38')]=_[_0x5dcc('0x3a')](_0x3f8739[_0x5dcc('0x38')],{'$or':_[_0x5dcc('0x29')](_0x18458f,function(_0x431b21){if(_0x431b21[_0x5dcc('0x2c')]!=='VIRTUAL'){var _0xbc76bd={};_0xbc76bd[_0x431b21[_0x5dcc('0x27')]]={'$like':'%'+_0x5b157e['query'][_0x5dcc('0x39')]+'%'};return _0xbc76bd;}})});}_0x3f8739=_[_0x5dcc('0x3a')]({},_0x3f8739,_0x5b157e[_0x5dcc('0x3b')]);var _0x18b477={'where':_0x3f8739[_0x5dcc('0x38')]};return db[_0x5dcc('0x2a')][_0x5dcc('0x1e')](_0x18b477)[_0x5dcc('0x23')](function(_0x419e05){_0xcd65d3[_0x5dcc('0x1e')]=_0x419e05;if(_0x5b157e[_0x5dcc('0x2e')][_0x5dcc('0x3c')]){_0x3f8739[_0x5dcc('0x3d')]=[{'all':!![]}];}return db[_0x5dcc('0x2a')][_0x5dcc('0x3e')](_0x3f8739);})[_0x5dcc('0x23')](function(_0x83ad5d){_0xcd65d3['rows']=_0x83ad5d;return _0xcd65d3;})[_0x5dcc('0x23')](respondWithFilteredResult(_0x4d9202,_0x3f8739))[_0x5dcc('0x3f')](handleError(_0x4d9202,null));};exports[_0x5dcc('0x40')]=function(_0x207ae8,_0x2e1778){var _0x34d615={'raw':!![],'where':{'id':_0x207ae8[_0x5dcc('0x41')]['id']}},_0x40b8e={};_0x40b8e[_0x5dcc('0x2d')]=_[_0x5dcc('0x2f')](db[_0x5dcc('0x2a')][_0x5dcc('0x42')]);_0x40b8e[_0x5dcc('0x2e')]=_[_0x5dcc('0x2f')](_0x207ae8[_0x5dcc('0x2e')]);_0x40b8e[_0x5dcc('0x30')]=_['intersection'](_0x40b8e[_0x5dcc('0x2d')],_0x40b8e[_0x5dcc('0x2e')]);_0x34d615[_0x5dcc('0x32')]=_[_0x5dcc('0x31')](_0x40b8e[_0x5dcc('0x2d')],qs[_0x5dcc('0x33')](_0x207ae8[_0x5dcc('0x2e')]['fields']));_0x34d615[_0x5dcc('0x32')]=_0x34d615[_0x5dcc('0x32')]['length']?_0x34d615[_0x5dcc('0x32')]:_0x40b8e[_0x5dcc('0x2d')];if(_0x207ae8[_0x5dcc('0x2e')][_0x5dcc('0x3c')]){_0x34d615[_0x5dcc('0x3d')]=[{'all':!![]}];}_0x34d615=_[_0x5dcc('0x3a')]({},_0x34d615,_0x207ae8[_0x5dcc('0x3b')]);return db[_0x5dcc('0x2a')]['find'](_0x34d615)[_0x5dcc('0x23')](handleEntityNotFound(_0x2e1778,null))[_0x5dcc('0x23')](respondWithResult(_0x2e1778,null))['catch'](handleError(_0x2e1778,null));};exports[_0x5dcc('0x43')]=function(_0xeef390,_0x2d2ed3){return db[_0x5dcc('0x2a')][_0x5dcc('0x43')](_0xeef390[_0x5dcc('0x44')],{})[_0x5dcc('0x23')](respondWithResult(_0x2d2ed3,0xc9))['catch'](handleError(_0x2d2ed3,null));};exports['update']=function(_0x2fb3dd,_0x1fedc5){if(_0x2fb3dd[_0x5dcc('0x44')]['id']){delete _0x2fb3dd[_0x5dcc('0x44')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x2fb3dd[_0x5dcc('0x41')]['id']}})[_0x5dcc('0x23')](handleEntityNotFound(_0x1fedc5,null))[_0x5dcc('0x23')](saveUpdates(_0x2fb3dd[_0x5dcc('0x44')],null))['then'](respondWithResult(_0x1fedc5,null))['catch'](handleError(_0x1fedc5,null));};exports[_0x5dcc('0x45')]=function(_0x14bc5f,_0xe7c336){return db[_0x5dcc('0x2a')]['find']({'where':{'id':_0x14bc5f['params']['id']}})[_0x5dcc('0x23')](handleEntityNotFound(_0xe7c336,null))[_0x5dcc('0x23')](removeEntity(_0xe7c336,null))[_0x5dcc('0x3f')](handleError(_0xe7c336,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 91f7b39..fc2776c 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 _0x24a4=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define'];(function(_0x27a8b5,_0x3434b1){var _0x1d3258=function(_0x3949a7){while(--_0x3949a7){_0x27a8b5['push'](_0x27a8b5['shift']());}};_0x1d3258(++_0x3434b1);}(_0x24a4,0xe5));var _0x424a=function(_0x4be3b3,_0x18089f){_0x4be3b3=_0x4be3b3-0x0;var _0xe313c8=_0x24a4[_0x4be3b3];return _0xe313c8;};'use strict';var _=require(_0x424a('0x0'));var util=require(_0x424a('0x1'));var logger=require(_0x424a('0x2'))('api');var moment=require(_0x424a('0x3'));var BPromise=require(_0x424a('0x4'));var rp=require(_0x424a('0x5'));var fs=require('fs');var path=require(_0x424a('0x6'));var rimraf=require(_0x424a('0x7'));var config=require(_0x424a('0x8'));var attributes=require(_0x424a('0x9'));module['exports']=function(_0x3a5554,_0x2c87c7){return _0x3a5554[_0x424a('0xa')]('ServicenowField',attributes,{'tableName':_0x424a('0xb'),'paranoid':![],'indexes':[{'name':_0x424a('0xc'),'fields':[_0x424a('0xd'),_0x424a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74c9=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','api','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x273061,_0x3502f2){var _0x420c22=function(_0x4697c0){while(--_0x4697c0){_0x273061['push'](_0x273061['shift']());}};_0x420c22(++_0x3502f2);}(_0x74c9,0x157));var _0x974c=function(_0x302ce4,_0x53f6d7){_0x302ce4=_0x302ce4-0x0;var _0x4a1c0d=_0x74c9[_0x302ce4];return _0x4a1c0d;};'use strict';var _=require(_0x974c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x974c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x974c('0x2'));var fs=require('fs');var path=require(_0x974c('0x3'));var rimraf=require(_0x974c('0x4'));var config=require(_0x974c('0x5'));var attributes=require(_0x974c('0x6'));module[_0x974c('0x7')]=function(_0x78da32,_0x288410){return _0x78da32[_0x974c('0x8')](_0x974c('0x9'),attributes,{'tableName':_0x974c('0xa'),'paranoid':![],'indexes':[{'name':_0x974c('0xb'),'fields':['idField',_0x974c('0xc')],'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 98bfab4..36cd7d6 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5cedbc,_0x48fc4d){var _0x5d73a0=function(_0x2aa9b7){while(--_0x2aa9b7){_0x5cedbc['push'](_0x5cedbc['shift']());}};_0x5d73a0(++_0x48fc4d);}(_0xaa88,0x137));var _0x8aa8=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xaa88[_0x51ac09];return _0x3f827d;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xda3f,0xec));var _0xfda3=function(_0x15e493,_0x3fdc9a){_0x15e493=_0x15e493-0x0;var _0x46d28c=_0xda3f[_0x15e493];return _0x46d28c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7a4e203..0854e78 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3617fe,_0x126f7c){var _0x26cbe4=function(_0x19f5c1){while(--_0x19f5c1){_0x3617fe['push'](_0x3617fe['shift']());}};_0x26cbe4(++_0x126f7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x12ffd6,_0x4763ee){var _0x230d47=function(_0x39069e){while(--_0x39069e){_0x12ffd6['push'](_0x12ffd6['shift']());}};_0x230d47(++_0x4763ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index ba733bc..b43805a 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(_0x556e32,_0x597369){var _0x14fd56=function(_0xc6212a){while(--_0xc6212a){_0x556e32['push'](_0x556e32['shift']());}};_0x14fd56(++_0x597369);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x430b7c,_0x3e73e0){var _0x5e7226=function(_0xa18ff6){while(--_0xa18ff6){_0x430b7c['push'](_0x430b7c['shift']());}};_0x5e7226(++_0x3e73e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 b328886..636951f 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 _0x0aa7=['../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','SugarcrmAccount','include','rows','catch','show','params','length','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','POST','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','remove','includes','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3a62ae,_0x2c7b35){var _0xcaa1de=function(_0x1d52be){while(--_0x1d52be){_0x3a62ae['push'](_0x3a62ae['shift']());}};_0xcaa1de(++_0x2c7b35);}(_0x0aa7,0x150));var _0x70aa=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0aa7[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x70aa('0x0'));var rimraf=require(_0x70aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x70aa('0x2'));var moment=require(_0x70aa('0x3'));var BPromise=require(_0x70aa('0x4'));var Mustache=require(_0x70aa('0x5'));var util=require(_0x70aa('0x6'));var path=require(_0x70aa('0x7'));var sox=require(_0x70aa('0x8'));var csv=require(_0x70aa('0x9'));var ejs=require(_0x70aa('0xa'));var fs=require('fs');var fs_extra=require(_0x70aa('0xb'));var _=require(_0x70aa('0xc'));var squel=require(_0x70aa('0xd'));var crypto=require(_0x70aa('0xe'));var jsforce=require(_0x70aa('0xf'));var deskjs=require(_0x70aa('0x10'));var toCsv=require('to-csv');var querystring=require(_0x70aa('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70aa('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70aa('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x70aa('0x14'));var config=require(_0x70aa('0x15'));var licenseUtil=require(_0x70aa('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x70aa('0x17'));function respondWithStatusCode(_0x3acc06,_0x517682){_0x517682=_0x517682||0xcc;return function(_0x15fd4d){if(_0x15fd4d){return _0x3acc06[_0x70aa('0x18')](_0x517682);}return _0x3acc06[_0x70aa('0x19')](_0x517682)[_0x70aa('0x1a')]();};}function respondWithResult(_0x58de66,_0x407215){_0x407215=_0x407215||0xc8;return function(_0x275a74){if(_0x275a74){return _0x58de66[_0x70aa('0x19')](_0x407215)[_0x70aa('0x1b')](_0x275a74);}};}function respondWithFilteredResult(_0x3ea076,_0x20fcb7){return function(_0xb203b3){if(_0xb203b3){var _0x26bd7e=typeof _0x20fcb7[_0x70aa('0x1c')]===_0x70aa('0x1d')&&typeof _0x20fcb7[_0x70aa('0x1e')]===_0x70aa('0x1d');var _0x1baae0=_0xb203b3['count'];var _0x1c530d=_0x26bd7e?0x0:_0x20fcb7[_0x70aa('0x1c')];var _0x47e0e9=_0x26bd7e?_0xb203b3[_0x70aa('0x1f')]:_0x20fcb7['offset']+_0x20fcb7['limit'];var _0x191542;if(_0x47e0e9>=_0x1baae0){_0x47e0e9=_0x1baae0;_0x191542=0xc8;}else{_0x191542=0xce;}_0x3ea076[_0x70aa('0x19')](_0x191542);return _0x3ea076[_0x70aa('0x20')](_0x70aa('0x21'),_0x1c530d+'-'+_0x47e0e9+'/'+_0x1baae0)[_0x70aa('0x1b')](_0xb203b3);}return null;};}function patchUpdates(_0x104627){return function(_0x326aab){try{jsonpatch['apply'](_0x326aab,_0x104627,!![]);}catch(_0x5bcc15){return BPromise[_0x70aa('0x22')](_0x5bcc15);}return _0x326aab[_0x70aa('0x23')]();};}function saveUpdates(_0x54ac07,_0x43e041){return function(_0x5a71eb){if(_0x5a71eb){return _0x5a71eb[_0x70aa('0x24')](_0x54ac07)['then'](function(_0xc6b8fb){return _0xc6b8fb;});}return null;};}function removeEntity(_0x33cb3e,_0x5b3d58){return function(_0x148b26){if(_0x148b26){return _0x148b26['destroy']()[_0x70aa('0x25')](function(){_0x33cb3e[_0x70aa('0x19')](0xcc)[_0x70aa('0x1a')]();});}};}function handleEntityNotFound(_0xe39700,_0x527aaa){return function(_0x304663){if(!_0x304663){_0xe39700['sendStatus'](0x194);}return _0x304663;};}function handleError(_0x132df4,_0x5b447f){_0x5b447f=_0x5b447f||0x1f4;return function(_0x3979d1){logger[_0x70aa('0x26')](_0x3979d1[_0x70aa('0x27')]);if(_0x3979d1[_0x70aa('0x28')]){delete _0x3979d1[_0x70aa('0x28')];}_0x132df4[_0x70aa('0x19')](_0x5b447f)['send'](_0x3979d1);};}exports['index']=function(_0x5061ee,_0x536fe9){var _0x4116b5={},_0x1eca83={},_0x3b039a={'count':0x0,'rows':[]};var _0x37f3a9=_[_0x70aa('0x29')](db['SugarcrmAccount'][_0x70aa('0x2a')],function(_0x4a44ef){return{'name':_0x4a44ef['fieldName'],'type':_0x4a44ef['type'][_0x70aa('0x2b')]};});_0x1eca83[_0x70aa('0x2c')]=_[_0x70aa('0x29')](_0x37f3a9,_0x70aa('0x28'));_0x1eca83[_0x70aa('0x2d')]=_[_0x70aa('0x2e')](_0x5061ee[_0x70aa('0x2d')]);_0x1eca83['filters']=_['intersection'](_0x1eca83[_0x70aa('0x2c')],_0x1eca83['query']);_0x4116b5['attributes']=_[_0x70aa('0x2f')](_0x1eca83[_0x70aa('0x2c')],qs['fields'](_0x5061ee['query'][_0x70aa('0x30')]));_0x4116b5[_0x70aa('0x31')]=_0x4116b5[_0x70aa('0x31')]['length']?_0x4116b5[_0x70aa('0x31')]:_0x1eca83[_0x70aa('0x2c')];if(!_0x5061ee[_0x70aa('0x2d')][_0x70aa('0x32')](_0x70aa('0x33'))){_0x4116b5[_0x70aa('0x1e')]=qs['limit'](_0x5061ee[_0x70aa('0x2d')][_0x70aa('0x1e')]);_0x4116b5[_0x70aa('0x1c')]=qs[_0x70aa('0x1c')](_0x5061ee[_0x70aa('0x2d')][_0x70aa('0x1c')]);}_0x4116b5[_0x70aa('0x34')]=qs[_0x70aa('0x35')](_0x5061ee[_0x70aa('0x2d')]['sort']);_0x4116b5[_0x70aa('0x36')]=qs[_0x70aa('0x37')](_[_0x70aa('0x38')](_0x5061ee[_0x70aa('0x2d')],_0x1eca83[_0x70aa('0x37')]),_0x37f3a9);if(_0x5061ee[_0x70aa('0x2d')]['filter']){_0x4116b5[_0x70aa('0x36')]=_[_0x70aa('0x39')](_0x4116b5['where'],{'$or':_[_0x70aa('0x29')](_0x37f3a9,function(_0x45b4d9){if(_0x45b4d9[_0x70aa('0x3a')]!==_0x70aa('0x3b')){var _0x5a2c00={};_0x5a2c00[_0x45b4d9[_0x70aa('0x28')]]={'$like':'%'+_0x5061ee[_0x70aa('0x2d')][_0x70aa('0x3c')]+'%'};return _0x5a2c00;}})});}_0x4116b5=_['merge']({},_0x4116b5,_0x5061ee[_0x70aa('0x3d')]);var _0x4a7394={'where':_0x4116b5[_0x70aa('0x36')]};return db[_0x70aa('0x3e')][_0x70aa('0x1f')](_0x4a7394)['then'](function(_0x243379){_0x3b039a[_0x70aa('0x1f')]=_0x243379;if(_0x5061ee[_0x70aa('0x2d')]['includeAll']){_0x4116b5[_0x70aa('0x3f')]=[{'all':!![]}];}return db[_0x70aa('0x3e')]['findAll'](_0x4116b5);})[_0x70aa('0x25')](function(_0x294ee6){_0x3b039a[_0x70aa('0x40')]=_0x294ee6;return _0x3b039a;})['then'](respondWithFilteredResult(_0x536fe9,_0x4116b5))[_0x70aa('0x41')](handleError(_0x536fe9,null));};exports[_0x70aa('0x42')]=function(_0x1e6a2c,_0xfc251f){var _0x5f4dc3={'raw':![],'where':{'id':_0x1e6a2c[_0x70aa('0x43')]['id']}},_0x38a8d1={};_0x38a8d1[_0x70aa('0x2c')]=_[_0x70aa('0x2e')](db[_0x70aa('0x3e')][_0x70aa('0x2a')]);_0x38a8d1[_0x70aa('0x2d')]=_[_0x70aa('0x2e')](_0x1e6a2c[_0x70aa('0x2d')]);_0x38a8d1[_0x70aa('0x37')]=_[_0x70aa('0x2f')](_0x38a8d1[_0x70aa('0x2c')],_0x38a8d1['query']);_0x5f4dc3[_0x70aa('0x31')]=_[_0x70aa('0x2f')](_0x38a8d1[_0x70aa('0x2c')],qs[_0x70aa('0x30')](_0x1e6a2c['query']['fields']));_0x5f4dc3['attributes']=_0x5f4dc3[_0x70aa('0x31')][_0x70aa('0x44')]?_0x5f4dc3['attributes']:_0x38a8d1[_0x70aa('0x2c')];if(_0x1e6a2c[_0x70aa('0x2d')][_0x70aa('0x45')]){_0x5f4dc3['include']=[{'all':!![]}];}_0x5f4dc3=_['merge']({},_0x5f4dc3,_0x1e6a2c[_0x70aa('0x3d')]);return db['SugarcrmAccount'][_0x70aa('0x46')](_0x5f4dc3)['then'](handleEntityNotFound(_0xfc251f,null))['then'](respondWithResult(_0xfc251f,null))[_0x70aa('0x41')](handleError(_0xfc251f,null));};exports['create']=function(_0x2d3ae5,_0x9edf5a){return db[_0x70aa('0x3e')][_0x70aa('0x47')](_0x2d3ae5[_0x70aa('0x48')],{})[_0x70aa('0x25')](respondWithResult(_0x9edf5a,0xc9))[_0x70aa('0x41')](handleError(_0x9edf5a,null));};exports['update']=function(_0x2b3a79,_0x392a89){if(_0x2b3a79[_0x70aa('0x48')]['id']){delete _0x2b3a79[_0x70aa('0x48')]['id'];}return db[_0x70aa('0x3e')][_0x70aa('0x46')]({'where':{'id':_0x2b3a79[_0x70aa('0x43')]['id']}})[_0x70aa('0x25')](handleEntityNotFound(_0x392a89,null))[_0x70aa('0x25')](saveUpdates(_0x2b3a79[_0x70aa('0x48')],null))[_0x70aa('0x25')](respondWithResult(_0x392a89,null))['catch'](handleError(_0x392a89,null));};exports['destroy']=function(_0x28de5d,_0x829494){return db[_0x70aa('0x3e')][_0x70aa('0x46')]({'where':{'id':_0x28de5d['params']['id']}})['then'](handleEntityNotFound(_0x829494,null))[_0x70aa('0x25')](removeEntity(_0x829494,null))[_0x70aa('0x41')](handleError(_0x829494,null));};exports[_0x70aa('0x49')]=function(_0x385751,_0x41cae1,_0x4f4bea){var _0x381e5e={};var _0x3f9fd4={};var _0x108819;var _0xf4adc0;return db['SugarcrmAccount'][_0x70aa('0x4a')]({'where':{'id':_0x385751[_0x70aa('0x43')]['id']}})[_0x70aa('0x25')](handleEntityNotFound(_0x41cae1,null))[_0x70aa('0x25')](function(_0x1c3cfc){if(_0x1c3cfc){_0x108819=_0x1c3cfc;_0x3f9fd4['model']=_[_0x70aa('0x2e')](db[_0x70aa('0x4b')][_0x70aa('0x2a')]);_0x3f9fd4[_0x70aa('0x2d')]=_[_0x70aa('0x2e')](_0x385751[_0x70aa('0x2d')]);_0x3f9fd4[_0x70aa('0x37')]=_['intersection'](_0x3f9fd4[_0x70aa('0x2c')],_0x3f9fd4['query']);_0x381e5e[_0x70aa('0x31')]=_['intersection'](_0x3f9fd4[_0x70aa('0x2c')],qs['fields'](_0x385751[_0x70aa('0x2d')][_0x70aa('0x30')]));_0x381e5e['attributes']=_0x381e5e[_0x70aa('0x31')][_0x70aa('0x44')]?_0x381e5e[_0x70aa('0x31')]:_0x3f9fd4[_0x70aa('0x2c')];_0x381e5e[_0x70aa('0x34')]=qs[_0x70aa('0x35')](_0x385751['query'][_0x70aa('0x35')]);_0x381e5e[_0x70aa('0x36')]=qs[_0x70aa('0x37')](_[_0x70aa('0x38')](_0x385751[_0x70aa('0x2d')],_0x3f9fd4[_0x70aa('0x37')]));if(_0x385751['query'][_0x70aa('0x3c')]){_0x381e5e[_0x70aa('0x36')]=_[_0x70aa('0x39')](_0x381e5e[_0x70aa('0x36')],{'$or':_[_0x70aa('0x29')](_0x381e5e[_0x70aa('0x31')],function(_0x3e6489){var _0x2b3d2c={};_0x2b3d2c[_0x3e6489]={'$like':'%'+_0x385751['query']['filter']+'%'};return _0x2b3d2c;})});}_0x381e5e=_[_0x70aa('0x39')]({},_0x381e5e,_0x385751[_0x70aa('0x3d')]);return _0x108819[_0x70aa('0x49')](_0x381e5e);}})[_0x70aa('0x25')](function(_0x4c9a80){if(_0x4c9a80){_0xf4adc0=_0x4c9a80[_0x70aa('0x44')];if(!_0x385751['query'][_0x70aa('0x32')](_0x70aa('0x33'))){_0x381e5e['limit']=qs[_0x70aa('0x1e')](_0x385751[_0x70aa('0x2d')][_0x70aa('0x1e')]);_0x381e5e[_0x70aa('0x1c')]=qs['offset'](_0x385751[_0x70aa('0x2d')][_0x70aa('0x1c')]);}return _0x108819[_0x70aa('0x49')](_0x381e5e);}})[_0x70aa('0x25')](function(_0x44a62c){if(_0x44a62c){return _0x44a62c?{'count':_0xf4adc0,'rows':_0x44a62c}:null;}})[_0x70aa('0x25')](respondWithResult(_0x41cae1,null))[_0x70aa('0x41')](handleError(_0x41cae1,null));};exports[_0x70aa('0x4c')]=function(_0x29188d,_0xa26e1,_0x274567){if(_0x29188d[_0x70aa('0x48')]['id']){delete _0x29188d[_0x70aa('0x48')]['id'];}return db[_0x70aa('0x3e')][_0x70aa('0x4a')]({'where':{'id':_0x29188d[_0x70aa('0x43')]['id']}})[_0x70aa('0x25')](handleEntityNotFound(_0xa26e1,null))[_0x70aa('0x25')](function(_0x5bcef){if(_0x5bcef){_0x29188d[_0x70aa('0x48')]['AccountId']=_0x5bcef['id'];_0x29188d['body']['Subjects']=integrations[_0x70aa('0x4d')](_0x29188d[_0x70aa('0x48')][_0x70aa('0x4e')],_0x29188d['body'][_0x70aa('0x3a')]);_0x29188d['body'][_0x70aa('0x4f')]=integrations[_0x70aa('0x50')](_0x29188d[_0x70aa('0x48')]['channel'],_0x29188d['body']['type']);return db['SugarcrmConfiguration']['create'](_0x29188d[_0x70aa('0x48')],{'include':[{'model':db[_0x70aa('0x51')],'as':_0x70aa('0x52')},{'model':db[_0x70aa('0x51')],'as':_0x70aa('0x4f')}]});}return null;})[_0x70aa('0x25')](respondWithResult(_0xa26e1,null))[_0x70aa('0x41')](handleError(_0xa26e1,null));};exports['getFields']=function(_0xda355e,_0x5d1458,_0x1789f7){var _0x1fb00c='';var _0xb57a90=['id',_0x70aa('0x28'),'assigned_user_id',_0x70aa('0x53'),_0x70aa('0x54'),_0x70aa('0x55'),_0x70aa('0x56'),'duration_minutes',_0x70aa('0x57'),_0x70aa('0x58'),_0x70aa('0x59'),_0x70aa('0x5a')];return db[_0x70aa('0x3e')][_0x70aa('0x4a')]({'where':{'id':_0xda355e[_0x70aa('0x43')]['id']},'attributes':['id','username',_0x70aa('0x5b'),'remoteUri']})['then'](handleEntityNotFound(_0x5d1458,null))['then'](function(_0x3bc294){if(_0x3bc294){_0x1fb00c=_0x3bc294[_0x70aa('0x5c')];var _0x1d01b9=_0x1fb00c[_0x70aa('0x5d')](-0x1);if(_0x1d01b9==='/'){_0x1fb00c=_0x1fb00c['substring'](0x0,_0x1fb00c['lastIndexOf'](_0x1d01b9));}return rp({'method':_0x70aa('0x5e'),'uri':util['format']('%s%s',_0x1fb00c,_0x70aa('0x5f')),'json':!![],'form':{'method':_0x70aa('0x60'),'input_type':_0x70aa('0x61'),'response_type':_0x70aa('0x61'),'rest_data':JSON[_0x70aa('0x62')]({'user_auth':{'user_name':_0x3bc294[_0x70aa('0x63')],'password':_0x3bc294['password'],'encryption':_0x70aa('0x64')},'application':_0x70aa('0x65')})}});}})[_0x70aa('0x25')](function(_0x149095){if(_0x149095&&_0x149095['name']!==_0x70aa('0x66')&&_0x149095[_0x70aa('0x28')]!==_0x70aa('0x67')){return rp({'method':_0x70aa('0x5e'),'uri':util[_0x70aa('0x68')]('%s%s',_0x1fb00c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x70aa('0x69'),'input_type':_0x70aa('0x61'),'response_type':_0x70aa('0x61'),'rest_data':JSON[_0x70aa('0x62')]({'session':_0x149095['id'],'module_name':_0x70aa('0x6a')})}})['then'](function(_0x195974){if(_0x195974){var _0x47924e=_[_0x70aa('0x6b')](_0x195974[_0x70aa('0x6c')]);_[_0x70aa('0x6d')](_0x47924e,function(_0x528aa8){return _0xb57a90[_0x70aa('0x6e')](_0x528aa8['name']);});return{'count':_0x47924e[_0x70aa('0x44')],'rows':_[_0x70aa('0x29')](_0x47924e,function(_0x160d09){return{'id':_0x160d09[_0x70aa('0x28')],'name':_0x160d09['label'],'custom':_['endsWith'](_0x160d09['name'],'_c')?!![]:![],'options':_0x160d09[_0x70aa('0x3d')]?_[_0x70aa('0x29')](_[_0x70aa('0x6b')](_0x160d09['options']),function(_0x2100dd){return{'name':_0x2100dd[_0x70aa('0x6f')],'value':_0x2100dd[_0x70aa('0x28')]};}):[]};})};}})[_0x70aa('0x25')](respondWithResult(_0x5d1458,null))[_0x70aa('0x41')](function(_0x267076){var _0x9b61b0=_0xda355e['query'][_0x70aa('0x70')]?0x1f4:_0x267076[_0x70aa('0x71')]||0x1f4;logger[_0x70aa('0x26')](_0x70aa('0x72'),_0x70aa('0x73'),_0x9b61b0,JSON[_0x70aa('0x62')](_0x267076));delete _0x267076['name'];if(_0x9b61b0===0x191){_0x9b61b0=0x190;}_0x5d1458[_0x70aa('0x19')](_0x9b61b0)[_0x70aa('0x74')](_0xda355e['query']['test']?{'message':_0x70aa('0x75'),'statusCode':_0x267076['statusCode']}:_0x267076);});}else{var _0x515d4d=0x1f4;_0x5d1458[_0x70aa('0x19')](_0x515d4d)['send']({'message':_0x70aa('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb1d2=['get_module_fields','Calls','values','remove','label','endsWith','value','statusCode','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','update','find','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','Password\x20Expired'];(function(_0xe61ebf,_0x5719b4){var _0x4203b4=function(_0x113831){while(--_0x113831){_0xe61ebf['push'](_0xe61ebf['shift']());}};_0x4203b4(++_0x5719b4);}(_0xb1d2,0x87));var _0x2b1d=function(_0x54c350,_0x2a05d0){_0x54c350=_0x54c350-0x0;var _0x30237e=_0xb1d2[_0x54c350];return _0x30237e;};'use strict';var emlformat=require(_0x2b1d('0x0'));var rimraf=require(_0x2b1d('0x1'));var zipdir=require(_0x2b1d('0x2'));var jsonpatch=require(_0x2b1d('0x3'));var rp=require(_0x2b1d('0x4'));var moment=require(_0x2b1d('0x5'));var BPromise=require(_0x2b1d('0x6'));var Mustache=require(_0x2b1d('0x7'));var util=require(_0x2b1d('0x8'));var path=require(_0x2b1d('0x9'));var sox=require(_0x2b1d('0xa'));var csv=require(_0x2b1d('0xb'));var ejs=require(_0x2b1d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b1d('0xd'));var squel=require(_0x2b1d('0xe'));var crypto=require(_0x2b1d('0xf'));var jsforce=require(_0x2b1d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2b1d('0xb'));var querystring=require('querystring');var Papa=require(_0x2b1d('0x11'));var Redis=require(_0x2b1d('0x12'));var authService=require(_0x2b1d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2b1d('0x14'));var hardwareService=require(_0x2b1d('0x15'));var logger=require(_0x2b1d('0x16'))(_0x2b1d('0x17'));var utils=require(_0x2b1d('0x18'));var config=require(_0x2b1d('0x19'));var licenseUtil=require(_0x2b1d('0x1a'));var db=require(_0x2b1d('0x1b'))['db'];var integrations=require(_0x2b1d('0x1c'));function respondWithStatusCode(_0x261849,_0x3e02d0){_0x3e02d0=_0x3e02d0||0xcc;return function(_0x37b60b){if(_0x37b60b){return _0x261849[_0x2b1d('0x1d')](_0x3e02d0);}return _0x261849[_0x2b1d('0x1e')](_0x3e02d0)['end']();};}function respondWithResult(_0x1a7c27,_0x51cc72){_0x51cc72=_0x51cc72||0xc8;return function(_0x5673f8){if(_0x5673f8){return _0x1a7c27[_0x2b1d('0x1e')](_0x51cc72)[_0x2b1d('0x1f')](_0x5673f8);}};}function respondWithFilteredResult(_0x375ef9,_0x329a16){return function(_0x11f806){if(_0x11f806){var _0x2809a0=typeof _0x329a16[_0x2b1d('0x20')]===_0x2b1d('0x21')&&typeof _0x329a16[_0x2b1d('0x22')]===_0x2b1d('0x21');var _0x61ff9f=_0x11f806[_0x2b1d('0x23')];var _0x206b5a=_0x2809a0?0x0:_0x329a16['offset'];var _0x37b300=_0x2809a0?_0x11f806[_0x2b1d('0x23')]:_0x329a16[_0x2b1d('0x20')]+_0x329a16['limit'];var _0x4243d9;if(_0x37b300>=_0x61ff9f){_0x37b300=_0x61ff9f;_0x4243d9=0xc8;}else{_0x4243d9=0xce;}_0x375ef9[_0x2b1d('0x1e')](_0x4243d9);return _0x375ef9['set'](_0x2b1d('0x24'),_0x206b5a+'-'+_0x37b300+'/'+_0x61ff9f)[_0x2b1d('0x1f')](_0x11f806);}return null;};}function patchUpdates(_0x2eaf26){return function(_0x3aebb1){try{jsonpatch[_0x2b1d('0x25')](_0x3aebb1,_0x2eaf26,!![]);}catch(_0x11af33){return BPromise[_0x2b1d('0x26')](_0x11af33);}return _0x3aebb1[_0x2b1d('0x27')]();};}function saveUpdates(_0x281f86,_0x5bd0f8){return function(_0x40332b){if(_0x40332b){return _0x40332b['update'](_0x281f86)[_0x2b1d('0x28')](function(_0x51ea7){return _0x51ea7;});}return null;};}function removeEntity(_0x1b1db3,_0x221dd1){return function(_0x4c7c3f){if(_0x4c7c3f){return _0x4c7c3f[_0x2b1d('0x29')]()[_0x2b1d('0x28')](function(){_0x1b1db3['status'](0xcc)[_0x2b1d('0x2a')]();});}};}function handleEntityNotFound(_0x38ac81,_0x5ebf97){return function(_0x4c060a){if(!_0x4c060a){_0x38ac81[_0x2b1d('0x1d')](0x194);}return _0x4c060a;};}function handleError(_0x5f34ae,_0x945e5e){_0x945e5e=_0x945e5e||0x1f4;return function(_0x1a3c6f){logger[_0x2b1d('0x2b')](_0x1a3c6f[_0x2b1d('0x2c')]);if(_0x1a3c6f['name']){delete _0x1a3c6f[_0x2b1d('0x2d')];}_0x5f34ae[_0x2b1d('0x1e')](_0x945e5e)[_0x2b1d('0x2e')](_0x1a3c6f);};}exports[_0x2b1d('0x2f')]=function(_0x599939,_0x4ed990){var _0xa2d7a1={},_0x16fa9f={},_0x525cd3={'count':0x0,'rows':[]};var _0x488a56=_['map'](db[_0x2b1d('0x30')][_0x2b1d('0x31')],function(_0x327c6f){return{'name':_0x327c6f[_0x2b1d('0x32')],'type':_0x327c6f[_0x2b1d('0x33')][_0x2b1d('0x34')]};});_0x16fa9f[_0x2b1d('0x35')]=_[_0x2b1d('0x36')](_0x488a56,_0x2b1d('0x2d'));_0x16fa9f[_0x2b1d('0x37')]=_[_0x2b1d('0x38')](_0x599939['query']);_0x16fa9f['filters']=_[_0x2b1d('0x39')](_0x16fa9f[_0x2b1d('0x35')],_0x16fa9f[_0x2b1d('0x37')]);_0xa2d7a1['attributes']=_[_0x2b1d('0x39')](_0x16fa9f[_0x2b1d('0x35')],qs[_0x2b1d('0x3a')](_0x599939['query'][_0x2b1d('0x3a')]));_0xa2d7a1[_0x2b1d('0x3b')]=_0xa2d7a1[_0x2b1d('0x3b')][_0x2b1d('0x3c')]?_0xa2d7a1[_0x2b1d('0x3b')]:_0x16fa9f[_0x2b1d('0x35')];if(!_0x599939[_0x2b1d('0x37')][_0x2b1d('0x3d')](_0x2b1d('0x3e'))){_0xa2d7a1[_0x2b1d('0x22')]=qs[_0x2b1d('0x22')](_0x599939[_0x2b1d('0x37')][_0x2b1d('0x22')]);_0xa2d7a1['offset']=qs[_0x2b1d('0x20')](_0x599939[_0x2b1d('0x37')][_0x2b1d('0x20')]);}_0xa2d7a1[_0x2b1d('0x3f')]=qs[_0x2b1d('0x40')](_0x599939[_0x2b1d('0x37')][_0x2b1d('0x40')]);_0xa2d7a1[_0x2b1d('0x41')]=qs[_0x2b1d('0x42')](_['pick'](_0x599939['query'],_0x16fa9f[_0x2b1d('0x42')]),_0x488a56);if(_0x599939['query'][_0x2b1d('0x43')]){_0xa2d7a1['where']=_[_0x2b1d('0x44')](_0xa2d7a1['where'],{'$or':_[_0x2b1d('0x36')](_0x488a56,function(_0xb78518){if(_0xb78518[_0x2b1d('0x33')]!==_0x2b1d('0x45')){var _0x2b5832={};_0x2b5832[_0xb78518[_0x2b1d('0x2d')]]={'$like':'%'+_0x599939[_0x2b1d('0x37')]['filter']+'%'};return _0x2b5832;}})});}_0xa2d7a1=_[_0x2b1d('0x44')]({},_0xa2d7a1,_0x599939['options']);var _0x525412={'where':_0xa2d7a1[_0x2b1d('0x41')]};return db['SugarcrmAccount']['count'](_0x525412)[_0x2b1d('0x28')](function(_0x2f32e8){_0x525cd3['count']=_0x2f32e8;if(_0x599939[_0x2b1d('0x37')][_0x2b1d('0x46')]){_0xa2d7a1[_0x2b1d('0x47')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2b1d('0x48')](_0xa2d7a1);})[_0x2b1d('0x28')](function(_0x51a475){_0x525cd3[_0x2b1d('0x49')]=_0x51a475;return _0x525cd3;})[_0x2b1d('0x28')](respondWithFilteredResult(_0x4ed990,_0xa2d7a1))[_0x2b1d('0x4a')](handleError(_0x4ed990,null));};exports[_0x2b1d('0x4b')]=function(_0x199eb1,_0x101739){var _0x3935ac={'raw':![],'where':{'id':_0x199eb1[_0x2b1d('0x4c')]['id']}},_0x4adb42={};_0x4adb42[_0x2b1d('0x35')]=_[_0x2b1d('0x38')](db[_0x2b1d('0x30')][_0x2b1d('0x31')]);_0x4adb42[_0x2b1d('0x37')]=_[_0x2b1d('0x38')](_0x199eb1[_0x2b1d('0x37')]);_0x4adb42[_0x2b1d('0x42')]=_[_0x2b1d('0x39')](_0x4adb42[_0x2b1d('0x35')],_0x4adb42[_0x2b1d('0x37')]);_0x3935ac[_0x2b1d('0x3b')]=_[_0x2b1d('0x39')](_0x4adb42[_0x2b1d('0x35')],qs[_0x2b1d('0x3a')](_0x199eb1['query']['fields']));_0x3935ac[_0x2b1d('0x3b')]=_0x3935ac[_0x2b1d('0x3b')][_0x2b1d('0x3c')]?_0x3935ac['attributes']:_0x4adb42['model'];if(_0x199eb1[_0x2b1d('0x37')][_0x2b1d('0x46')]){_0x3935ac['include']=[{'all':!![]}];}_0x3935ac=_[_0x2b1d('0x44')]({},_0x3935ac,_0x199eb1[_0x2b1d('0x4d')]);return db[_0x2b1d('0x30')]['find'](_0x3935ac)['then'](handleEntityNotFound(_0x101739,null))[_0x2b1d('0x28')](respondWithResult(_0x101739,null))[_0x2b1d('0x4a')](handleError(_0x101739,null));};exports[_0x2b1d('0x4e')]=function(_0x2378e7,_0x40dd89){return db['SugarcrmAccount'][_0x2b1d('0x4e')](_0x2378e7[_0x2b1d('0x4f')],{})['then'](respondWithResult(_0x40dd89,0xc9))[_0x2b1d('0x4a')](handleError(_0x40dd89,null));};exports[_0x2b1d('0x50')]=function(_0x5167f4,_0xe5a1c4){if(_0x5167f4['body']['id']){delete _0x5167f4['body']['id'];}return db[_0x2b1d('0x30')][_0x2b1d('0x51')]({'where':{'id':_0x5167f4['params']['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0xe5a1c4,null))[_0x2b1d('0x28')](saveUpdates(_0x5167f4[_0x2b1d('0x4f')],null))['then'](respondWithResult(_0xe5a1c4,null))[_0x2b1d('0x4a')](handleError(_0xe5a1c4,null));};exports[_0x2b1d('0x29')]=function(_0x1034b7,_0x2e3f25){return db['SugarcrmAccount'][_0x2b1d('0x51')]({'where':{'id':_0x1034b7['params']['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0x2e3f25,null))['then'](removeEntity(_0x2e3f25,null))[_0x2b1d('0x4a')](handleError(_0x2e3f25,null));};exports[_0x2b1d('0x52')]=function(_0x47bfb3,_0x26756,_0x10278a){var _0x2ff627={};var _0xa78f2={};var _0x56f593;var _0x5c5711;return db[_0x2b1d('0x30')][_0x2b1d('0x53')]({'where':{'id':_0x47bfb3[_0x2b1d('0x4c')]['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0x26756,null))['then'](function(_0x6e5d7b){if(_0x6e5d7b){_0x56f593=_0x6e5d7b;_0xa78f2[_0x2b1d('0x35')]=_[_0x2b1d('0x38')](db['SugarcrmConfiguration'][_0x2b1d('0x31')]);_0xa78f2[_0x2b1d('0x37')]=_['keys'](_0x47bfb3[_0x2b1d('0x37')]);_0xa78f2[_0x2b1d('0x42')]=_['intersection'](_0xa78f2[_0x2b1d('0x35')],_0xa78f2[_0x2b1d('0x37')]);_0x2ff627[_0x2b1d('0x3b')]=_[_0x2b1d('0x39')](_0xa78f2[_0x2b1d('0x35')],qs[_0x2b1d('0x3a')](_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x3a')]));_0x2ff627[_0x2b1d('0x3b')]=_0x2ff627[_0x2b1d('0x3b')][_0x2b1d('0x3c')]?_0x2ff627[_0x2b1d('0x3b')]:_0xa78f2['model'];_0x2ff627[_0x2b1d('0x3f')]=qs[_0x2b1d('0x40')](_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x40')]);_0x2ff627[_0x2b1d('0x41')]=qs[_0x2b1d('0x42')](_[_0x2b1d('0x54')](_0x47bfb3['query'],_0xa78f2[_0x2b1d('0x42')]));if(_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x43')]){_0x2ff627[_0x2b1d('0x41')]=_[_0x2b1d('0x44')](_0x2ff627[_0x2b1d('0x41')],{'$or':_[_0x2b1d('0x36')](_0x2ff627[_0x2b1d('0x3b')],function(_0x14c925){var _0x2ee493={};_0x2ee493[_0x14c925]={'$like':'%'+_0x47bfb3['query']['filter']+'%'};return _0x2ee493;})});}_0x2ff627=_['merge']({},_0x2ff627,_0x47bfb3[_0x2b1d('0x4d')]);return _0x56f593[_0x2b1d('0x52')](_0x2ff627);}})['then'](function(_0x4c31f8){if(_0x4c31f8){_0x5c5711=_0x4c31f8[_0x2b1d('0x3c')];if(!_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x3d')](_0x2b1d('0x3e'))){_0x2ff627['limit']=qs[_0x2b1d('0x22')](_0x47bfb3[_0x2b1d('0x37')]['limit']);_0x2ff627['offset']=qs[_0x2b1d('0x20')](_0x47bfb3[_0x2b1d('0x37')][_0x2b1d('0x20')]);}return _0x56f593[_0x2b1d('0x52')](_0x2ff627);}})[_0x2b1d('0x28')](function(_0xcae9c0){if(_0xcae9c0){return _0xcae9c0?{'count':_0x5c5711,'rows':_0xcae9c0}:null;}})[_0x2b1d('0x28')](respondWithResult(_0x26756,null))['catch'](handleError(_0x26756,null));};exports[_0x2b1d('0x55')]=function(_0x58e62e,_0xd00252,_0x5550a0){if(_0x58e62e[_0x2b1d('0x4f')]['id']){delete _0x58e62e[_0x2b1d('0x4f')]['id'];}return db[_0x2b1d('0x30')][_0x2b1d('0x53')]({'where':{'id':_0x58e62e['params']['id']}})[_0x2b1d('0x28')](handleEntityNotFound(_0xd00252,null))[_0x2b1d('0x28')](function(_0x8f2b32){if(_0x8f2b32){_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x56')]=_0x8f2b32['id'];_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x57')]=integrations[_0x2b1d('0x58')](_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x59')],_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x33')]);_0x58e62e['body'][_0x2b1d('0x5a')]=integrations['getDescriptions'](_0x58e62e['body'][_0x2b1d('0x59')],_0x58e62e[_0x2b1d('0x4f')][_0x2b1d('0x33')]);return db['SugarcrmConfiguration']['create'](_0x58e62e['body'],{'include':[{'model':db[_0x2b1d('0x5b')],'as':'Subjects'},{'model':db[_0x2b1d('0x5b')],'as':_0x2b1d('0x5a')}]});}return null;})['then'](respondWithResult(_0xd00252,null))[_0x2b1d('0x4a')](handleError(_0xd00252,null));};exports[_0x2b1d('0x5c')]=function(_0x5260d1,_0x4d7b00,_0x1ea629){var _0x234618='';var _0x199c32=['id','name',_0x2b1d('0x5d'),'created_by',_0x2b1d('0x5e'),_0x2b1d('0x5f'),_0x2b1d('0x60'),_0x2b1d('0x61'),_0x2b1d('0x62'),_0x2b1d('0x63'),_0x2b1d('0x64'),_0x2b1d('0x65')];return db[_0x2b1d('0x30')][_0x2b1d('0x53')]({'where':{'id':_0x5260d1[_0x2b1d('0x4c')]['id']},'attributes':['id',_0x2b1d('0x66'),_0x2b1d('0x67'),_0x2b1d('0x68')]})['then'](handleEntityNotFound(_0x4d7b00,null))[_0x2b1d('0x28')](function(_0x38c615){if(_0x38c615){_0x234618=_0x38c615[_0x2b1d('0x68')];var _0x967623=_0x234618[_0x2b1d('0x69')](-0x1);if(_0x967623==='/'){_0x234618=_0x234618[_0x2b1d('0x6a')](0x0,_0x234618['lastIndexOf'](_0x967623));}return rp({'method':_0x2b1d('0x6b'),'uri':util[_0x2b1d('0x6c')](_0x2b1d('0x6d'),_0x234618,_0x2b1d('0x6e')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0x2b1d('0x6f'),'rest_data':JSON[_0x2b1d('0x70')]({'user_auth':{'user_name':_0x38c615['username'],'password':_0x38c615[_0x2b1d('0x67')],'encryption':_0x2b1d('0x71')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x2b1d('0x28')](function(_0x514197){if(_0x514197&&_0x514197[_0x2b1d('0x2d')]!=='Invalid\x20Login'&&_0x514197[_0x2b1d('0x2d')]!==_0x2b1d('0x72')){return rp({'method':_0x2b1d('0x6b'),'uri':util[_0x2b1d('0x6c')](_0x2b1d('0x6d'),_0x234618,_0x2b1d('0x6e')),'json':!![],'form':{'method':_0x2b1d('0x73'),'input_type':'JSON','response_type':_0x2b1d('0x6f'),'rest_data':JSON[_0x2b1d('0x70')]({'session':_0x514197['id'],'module_name':_0x2b1d('0x74')})}})['then'](function(_0x1143d5){if(_0x1143d5){var _0x43c27f=_[_0x2b1d('0x75')](_0x1143d5['module_fields']);_[_0x2b1d('0x76')](_0x43c27f,function(_0x21c757){return _0x199c32['includes'](_0x21c757['name']);});return{'count':_0x43c27f['length'],'rows':_['map'](_0x43c27f,function(_0x233daa){return{'id':_0x233daa[_0x2b1d('0x2d')],'name':_0x233daa[_0x2b1d('0x77')],'custom':_[_0x2b1d('0x78')](_0x233daa['name'],'_c')?!![]:![],'options':_0x233daa[_0x2b1d('0x4d')]?_[_0x2b1d('0x36')](_[_0x2b1d('0x75')](_0x233daa[_0x2b1d('0x4d')]),function(_0x503f80){return{'name':_0x503f80[_0x2b1d('0x79')],'value':_0x503f80[_0x2b1d('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x4d7b00,null))[_0x2b1d('0x4a')](function(_0x4dfa46){var _0x1e5fa0=_0x5260d1[_0x2b1d('0x37')]['test']?0x1f4:_0x4dfa46[_0x2b1d('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2b1d('0x5c'),_0x1e5fa0,JSON[_0x2b1d('0x70')](_0x4dfa46));delete _0x4dfa46[_0x2b1d('0x2d')];if(_0x1e5fa0===0x191){_0x1e5fa0=0x190;}_0x4d7b00['status'](_0x1e5fa0)[_0x2b1d('0x2e')](_0x5260d1[_0x2b1d('0x37')][_0x2b1d('0x7b')]?{'message':_0x2b1d('0x7c'),'statusCode':_0x4dfa46['statusCode']}:_0x4dfa46);});}else{var _0x168d5a=0x1f4;_0x4d7b00[_0x2b1d('0x1e')](_0x168d5a)['send']({'message':_0x2b1d('0x7c'),'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 a7e39b8..5a7181d 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 _0xf8c7=['define','SugarcrmAccount','util','../../config/logger','moment','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8c7,0x70));var _0x7f8c=function(_0x2ed2f0,_0x1f75c2){_0x2ed2f0=_0x2ed2f0-0x0;var _0x4a4969=_0xf8c7[_0x2ed2f0];return _0x4a4969;};'use strict';var _=require('lodash');var util=require(_0x7f8c('0x0'));var logger=require(_0x7f8c('0x1'))('api');var moment=require(_0x7f8c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f8c('0x3'));var rimraf=require(_0x7f8c('0x4'));var config=require(_0x7f8c('0x5'));var attributes=require(_0x7f8c('0x6'));var integrations=require(_0x7f8c('0x7'));module[_0x7f8c('0x8')]=function(_0x27fbf7,_0x5d5134){return _0x27fbf7[_0x7f8c('0x9')](_0x7f8c('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd1c=['./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1ef179,_0x4fac6a){var _0x5923ad=function(_0x5ae6d4){while(--_0x5ae6d4){_0x1ef179['push'](_0x1ef179['shift']());}};_0x5923ad(++_0x4fac6a);}(_0xbd1c,0x144));var _0xcbd1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbd1c[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xcbd1('0x0'));var logger=require(_0xcbd1('0x1'))(_0xcbd1('0x2'));var moment=require('moment');var BPromise=require(_0xcbd1('0x3'));var rp=require(_0xcbd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbd1('0x5'));var config=require('../../config/environment');var attributes=require(_0xcbd1('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xcbd1('0x7')]=function(_0x47b36f,_0x22b9e5){return _0x47b36f[_0xcbd1('0x8')](_0xcbd1('0x9'),attributes,{'tableName':_0xcbd1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 925bd57..a9102cf 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 _0x3b5d=['ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug'];(function(_0x3823b8,_0x42f762){var _0x10e5bb=function(_0x33d531){while(--_0x33d531){_0x3823b8['push'](_0x3823b8['shift']());}};_0x10e5bb(++_0x42f762);}(_0x3b5d,0x146));var _0xd3b5=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x3b5d[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0xd3b5('0x0'));var util=require(_0xd3b5('0x1'));var moment=require(_0xd3b5('0x2'));var BPromise=require(_0xd3b5('0x3'));var rs=require(_0xd3b5('0x4'));var fs=require('fs');var Redis=require(_0xd3b5('0x5'));var db=require(_0xd3b5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3b5('0x7'));var config=require(_0xd3b5('0x8'));var jayson=require(_0xd3b5('0x9'));var client=jayson[_0xd3b5('0xa')][_0xd3b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31c107,_0x269c6f,_0x3a60db){return new BPromise(function(_0x2da117,_0x49ef37){return client[_0xd3b5('0xc')](_0x31c107,_0x3a60db)[_0xd3b5('0xd')](function(_0x462a73){logger[_0xd3b5('0xe')](_0xd3b5('0xf'),_0x269c6f,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x269c6f,_0xd3b5('0x10'),JSON[_0xd3b5('0x11')](_0x462a73));if(_0x462a73[_0xd3b5('0x12')]){if(_0x462a73[_0xd3b5('0x12')][_0xd3b5('0x13')]===0x1f4){logger[_0xd3b5('0x12')](_0xd3b5('0xf'),_0x269c6f,_0x462a73[_0xd3b5('0x12')][_0xd3b5('0x14')]);return _0x49ef37(_0x462a73[_0xd3b5('0x12')][_0xd3b5('0x14')]);}logger[_0xd3b5('0x12')](_0xd3b5('0xf'),_0x269c6f,_0x462a73[_0xd3b5('0x12')]['message']);return _0x2da117(_0x462a73['error']['message']);}else{logger['info'](_0xd3b5('0xf'),_0x269c6f,'request\x20sent');_0x2da117(_0x462a73['result'][_0xd3b5('0x14')]);}})[_0xd3b5('0x15')](function(_0x5193e0){logger[_0xd3b5('0x12')](_0xd3b5('0xf'),_0x269c6f,_0x5193e0);_0x49ef37(_0x5193e0);});});}exports[_0xd3b5('0x16')]=function(_0x6bc772){var _0x49b887=this;return new Promise(function(_0x4b2c8d,_0x10dd2d){return db[_0xd3b5('0x17')][_0xd3b5('0x18')]({'raw':_0x6bc772[_0xd3b5('0x19')]?_0x6bc772[_0xd3b5('0x19')][_0xd3b5('0x1a')]===undefined?!![]:![]:!![],'where':_0x6bc772['options']?_0x6bc772['options'][_0xd3b5('0x1b')]||null:null,'attributes':_0x6bc772['options']?_0x6bc772[_0xd3b5('0x19')][_0xd3b5('0x1c')]||null:null,'limit':_0x6bc772['options']?_0x6bc772[_0xd3b5('0x19')][_0xd3b5('0x1d')]||null:null,'include':_0x6bc772[_0xd3b5('0x19')]?_0x6bc772[_0xd3b5('0x19')]['include']?_[_0xd3b5('0x1e')](_0x6bc772['options'][_0xd3b5('0x1f')],function(_0x3fcbc5){return{'model':db[_0x3fcbc5[_0xd3b5('0x20')]],'as':_0x3fcbc5['as'],'attributes':_0x3fcbc5['attributes'],'include':_0x3fcbc5[_0xd3b5('0x1f')]?_[_0xd3b5('0x1e')](_0x3fcbc5[_0xd3b5('0x1f')],function(_0x18a52d){return{'model':db[_0x18a52d[_0xd3b5('0x20')]],'as':_0x18a52d['as'],'attributes':_0x18a52d[_0xd3b5('0x1c')],'include':_0x18a52d['include']?_[_0xd3b5('0x1e')](_0x18a52d['include'],function(_0x44cd9b){return{'model':db[_0x44cd9b[_0xd3b5('0x20')]],'as':_0x44cd9b['as'],'attributes':_0x44cd9b[_0xd3b5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd3b5('0xd')](function(_0x41e993){logger[_0xd3b5('0xe')](_0xd3b5('0x16'),_0x6bc772);logger[_0xd3b5('0x21')]('GetSugarcrmAccount',_0x6bc772,JSON[_0xd3b5('0x11')](_0x41e993));_0x4b2c8d(_0x41e993);})['catch'](function(_0x726f82){logger['error'](_0xd3b5('0x16'),_0x726f82['message'],_0x6bc772);_0x10dd2d(_0x49b887['error'](0x1f4,_0x726f82[_0xd3b5('0x14')]));});});};exports[_0xd3b5('0x22')]=function(_0x5a69b6){var _0x5cf782=this;return new Promise(function(_0x9a1952,_0x5ddd76){return db[_0xd3b5('0x17')][_0xd3b5('0x23')]({'raw':_0x5a69b6[_0xd3b5('0x19')]?_0x5a69b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a69b6[_0xd3b5('0x19')]?_0x5a69b6['options'][_0xd3b5('0x1b')]||null:null,'attributes':_0x5a69b6[_0xd3b5('0x19')]?_0x5a69b6[_0xd3b5('0x19')][_0xd3b5('0x1c')]||null:null,'include':_0x5a69b6[_0xd3b5('0x19')]?_0x5a69b6[_0xd3b5('0x19')][_0xd3b5('0x1f')]?_['map'](_0x5a69b6[_0xd3b5('0x19')][_0xd3b5('0x1f')],function(_0x308112){return{'model':db[_0x308112[_0xd3b5('0x20')]],'as':_0x308112['as'],'attributes':_0x308112[_0xd3b5('0x1c')],'include':_0x308112['include']?_[_0xd3b5('0x1e')](_0x308112[_0xd3b5('0x1f')],function(_0x4ac581){return{'model':db[_0x4ac581[_0xd3b5('0x20')]],'as':_0x4ac581['as'],'attributes':_0x4ac581['attributes'],'include':_0x4ac581[_0xd3b5('0x1f')]?_[_0xd3b5('0x1e')](_0x4ac581['include'],function(_0x2c99c7){return{'model':db[_0x2c99c7[_0xd3b5('0x20')]],'as':_0x2c99c7['as'],'attributes':_0x2c99c7[_0xd3b5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22be7c){logger[_0xd3b5('0xe')](_0xd3b5('0x22'),_0x5a69b6);logger[_0xd3b5('0x21')](_0xd3b5('0x22'),_0x5a69b6,JSON['stringify'](_0x22be7c));_0x9a1952(_0x22be7c);})['catch'](function(_0x4019f5){logger[_0xd3b5('0x12')](_0xd3b5('0x22'),_0x4019f5['message'],_0x5a69b6);_0x5ddd76(_0x5cf782[_0xd3b5('0x12')](0x1f4,_0x4019f5[_0xd3b5('0x14')]));});});}; \ No newline at end of file +var _0xebe4=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5ce4f8,_0x1dca0b){var _0x156126=function(_0x1abf41){while(--_0x1abf41){_0x5ce4f8['push'](_0x5ce4f8['shift']());}};_0x156126(++_0x1dca0b);}(_0xebe4,0x12d));var _0x4ebe=function(_0x357708,_0x372ca2){_0x357708=_0x357708-0x0;var _0x55b071=_0xebe4[_0x357708];return _0x55b071;};'use strict';var _=require('lodash');var util=require(_0x4ebe('0x0'));var moment=require(_0x4ebe('0x1'));var BPromise=require(_0x4ebe('0x2'));var rs=require(_0x4ebe('0x3'));var fs=require('fs');var Redis=require(_0x4ebe('0x4'));var db=require(_0x4ebe('0x5'))['db'];var utils=require(_0x4ebe('0x6'));var logger=require(_0x4ebe('0x7'))(_0x4ebe('0x8'));var config=require(_0x4ebe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ebe('0xa')][_0x4ebe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa107a1,_0x2592bc,_0x4fa4ef){return new BPromise(function(_0x582b55,_0x4f5486){return client[_0x4ebe('0xc')](_0xa107a1,_0x4fa4ef)[_0x4ebe('0xd')](function(_0xf8bfea){logger[_0x4ebe('0xe')](_0x4ebe('0xf'),_0x2592bc,_0x4ebe('0x10'));logger[_0x4ebe('0x11')](_0x4ebe('0x12'),_0x2592bc,_0x4ebe('0x10'),JSON[_0x4ebe('0x13')](_0xf8bfea));if(_0xf8bfea['error']){if(_0xf8bfea['error'][_0x4ebe('0x14')]===0x1f4){logger['error'](_0x4ebe('0xf'),_0x2592bc,_0xf8bfea['error'][_0x4ebe('0x15')]);return _0x4f5486(_0xf8bfea[_0x4ebe('0x16')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2592bc,_0xf8bfea[_0x4ebe('0x16')]['message']);return _0x582b55(_0xf8bfea['error'][_0x4ebe('0x15')]);}else{logger[_0x4ebe('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x2592bc,_0x4ebe('0x10'));_0x582b55(_0xf8bfea['result'][_0x4ebe('0x15')]);}})[_0x4ebe('0x17')](function(_0x50de8f){logger['error'](_0x4ebe('0xf'),_0x2592bc,_0x50de8f);_0x4f5486(_0x50de8f);});});}exports[_0x4ebe('0x18')]=function(_0x484df3){var _0x5a5017=this;return new Promise(function(_0x13cabf,_0x1d86bb){return db[_0x4ebe('0x19')]['findAll']({'raw':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1c')]||null:null,'attributes':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1d')]||null:null,'limit':_0x484df3[_0x4ebe('0x1a')]?_0x484df3['options'][_0x4ebe('0x1e')]||null:null,'include':_0x484df3[_0x4ebe('0x1a')]?_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x484df3[_0x4ebe('0x1a')][_0x4ebe('0x1f')],function(_0x84e76b){return{'model':db[_0x84e76b[_0x4ebe('0x21')]],'as':_0x84e76b['as'],'attributes':_0x84e76b[_0x4ebe('0x1d')],'include':_0x84e76b[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x84e76b[_0x4ebe('0x1f')],function(_0x2c1489){return{'model':db[_0x2c1489[_0x4ebe('0x21')]],'as':_0x2c1489['as'],'attributes':_0x2c1489[_0x4ebe('0x1d')],'include':_0x2c1489[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x2c1489['include'],function(_0x51ae49){return{'model':db[_0x51ae49[_0x4ebe('0x21')]],'as':_0x51ae49['as'],'attributes':_0x51ae49[_0x4ebe('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ebe('0xd')](function(_0x251250){logger['info']('GetSugarcrmAccount',_0x484df3);logger[_0x4ebe('0x11')](_0x4ebe('0x18'),_0x484df3,JSON['stringify'](_0x251250));_0x13cabf(_0x251250);})['catch'](function(_0x183421){logger['error'](_0x4ebe('0x18'),_0x183421[_0x4ebe('0x15')],_0x484df3);_0x1d86bb(_0x5a5017[_0x4ebe('0x16')](0x1f4,_0x183421[_0x4ebe('0x15')]));});});};exports[_0x4ebe('0x22')]=function(_0x25c7ec){var _0x4f2127=this;return new Promise(function(_0x5e4adc,_0xdfefd4){return db['SugarcrmAccount']['find']({'raw':_0x25c7ec['options']?_0x25c7ec['options'][_0x4ebe('0x1b')]===undefined?!![]:![]:!![],'where':_0x25c7ec['options']?_0x25c7ec['options']['where']||null:null,'attributes':_0x25c7ec[_0x4ebe('0x1a')]?_0x25c7ec[_0x4ebe('0x1a')]['attributes']||null:null,'include':_0x25c7ec['options']?_0x25c7ec[_0x4ebe('0x1a')][_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x25c7ec[_0x4ebe('0x1a')][_0x4ebe('0x1f')],function(_0x10cabc){return{'model':db[_0x10cabc['model']],'as':_0x10cabc['as'],'attributes':_0x10cabc[_0x4ebe('0x1d')],'include':_0x10cabc[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x10cabc[_0x4ebe('0x1f')],function(_0x1593f0){return{'model':db[_0x1593f0['model']],'as':_0x1593f0['as'],'attributes':_0x1593f0[_0x4ebe('0x1d')],'include':_0x1593f0[_0x4ebe('0x1f')]?_[_0x4ebe('0x20')](_0x1593f0[_0x4ebe('0x1f')],function(_0x4b04cc){return{'model':db[_0x4b04cc[_0x4ebe('0x21')]],'as':_0x4b04cc['as'],'attributes':_0x4b04cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ebe('0xd')](function(_0x40c2ff){logger[_0x4ebe('0xe')](_0x4ebe('0x22'),_0x25c7ec);logger[_0x4ebe('0x11')]('ShowSugarcrmAccount',_0x25c7ec,JSON[_0x4ebe('0x13')](_0x40c2ff));_0x5e4adc(_0x40c2ff);})['catch'](function(_0xa829d6){logger['error'](_0x4ebe('0x22'),_0xa829d6[_0x4ebe('0x15')],_0x25c7ec);_0xdfefd4(_0x4f2127['error'](0x1f4,_0xa829d6['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index db57c56..7d9ed94 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 _0xe507=['put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','post'];(function(_0x37e756,_0x2a85b9){var _0x20e9fc=function(_0x336bd7){while(--_0x336bd7){_0x37e756['push'](_0x37e756['shift']());}};_0x20e9fc(++_0x2a85b9);}(_0xe507,0x192));var _0x7e50=function(_0x9ac89b,_0x25b61d){_0x9ac89b=_0x9ac89b-0x0;var _0x40da74=_0xe507[_0x9ac89b];return _0x40da74;};'use strict';var multer=require(_0x7e50('0x0'));var util=require(_0x7e50('0x1'));var path=require('path');var timeout=require(_0x7e50('0x2'));var express=require(_0x7e50('0x3'));var router=express[_0x7e50('0x4')]();var fs_extra=require(_0x7e50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e50('0x6'));var config=require(_0x7e50('0x7'));var controller=require(_0x7e50('0x8'));router[_0x7e50('0x9')]('/',auth[_0x7e50('0xa')](),controller[_0x7e50('0xb')]);router[_0x7e50('0x9')](_0x7e50('0xc'),auth['isAuthenticated'](),controller[_0x7e50('0xd')]);router[_0x7e50('0x9')](_0x7e50('0xe'),auth[_0x7e50('0xa')](),controller[_0x7e50('0xf')]);router[_0x7e50('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7e50('0x10')]);router[_0x7e50('0x9')]('/:id/descriptions',auth[_0x7e50('0xa')](),controller['getDescriptions']);router[_0x7e50('0x11')]('/',auth[_0x7e50('0xa')](),controller['create']);router[_0x7e50('0x12')](_0x7e50('0xc'),auth[_0x7e50('0xa')](),controller['update']);router[_0x7e50('0x13')](_0x7e50('0xc'),auth[_0x7e50('0xa')](),controller['destroy']);module[_0x7e50('0x14')]=router; \ No newline at end of file +var _0xd400=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update'];(function(_0x51d4db,_0x10908c){var _0x2e4eaf=function(_0x256caa){while(--_0x256caa){_0x51d4db['push'](_0x51d4db['shift']());}};_0x2e4eaf(++_0x10908c);}(_0xd400,0x15b));var _0x0d40=function(_0x13bea0,_0x210a0c){_0x13bea0=_0x13bea0-0x0;var _0x3f12df=_0xd400[_0x13bea0];return _0x3f12df;};'use strict';var multer=require(_0x0d40('0x0'));var util=require(_0x0d40('0x1'));var path=require(_0x0d40('0x2'));var timeout=require(_0x0d40('0x3'));var express=require(_0x0d40('0x4'));var router=express['Router']();var fs_extra=require(_0x0d40('0x5'));var auth=require(_0x0d40('0x6'));var interaction=require(_0x0d40('0x7'));var config=require(_0x0d40('0x8'));var controller=require(_0x0d40('0x9'));router[_0x0d40('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d40('0xb')]);router['get'](_0x0d40('0xc'),auth[_0x0d40('0xd')](),controller['show']);router[_0x0d40('0xa')](_0x0d40('0xe'),auth[_0x0d40('0xd')](),controller[_0x0d40('0xf')]);router[_0x0d40('0xa')](_0x0d40('0x10'),auth[_0x0d40('0xd')](),controller[_0x0d40('0x11')]);router[_0x0d40('0xa')]('/:id/descriptions',auth[_0x0d40('0xd')](),controller[_0x0d40('0x12')]);router['post']('/',auth[_0x0d40('0xd')](),controller[_0x0d40('0x13')]);router['put'](_0x0d40('0xc'),auth[_0x0d40('0xd')](),controller[_0x0d40('0x14')]);router[_0x0d40('0x15')](_0x0d40('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d40('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5c8cf89..5a0f094 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 _0xa15e=['sequelize','exports'];(function(_0x112d20,_0x4bd3b6){var _0x48c4ce=function(_0x4715da){while(--_0x4715da){_0x112d20['push'](_0x112d20['shift']());}};_0x48c4ce(++_0x4bd3b6);}(_0xa15e,0x98));var _0xea15=function(_0x4968de,_0x31fdd0){_0x4968de=_0x4968de-0x0;var _0x2d856b=_0xa15e[_0x4968de];return _0x2d856b;};'use strict';var Sequelize=require(_0xea15('0x0'));module[_0xea15('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x550b=['sequelize','exports','STRING'];(function(_0x31dff4,_0x206ac7){var _0x1a3245=function(_0xe70c42){while(--_0xe70c42){_0x31dff4['push'](_0x31dff4['shift']());}};_0x1a3245(++_0x206ac7);}(_0x550b,0x189));var _0xb550=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x550b[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0xb550('0x0'));module[_0xb550('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb550('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 02b5164..de56ce5 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 _0x95b0=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','SugarcrmConfiguration','findAll','rows','catch','show','params','find','create','body','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x5ab846,_0x2ef42a){var _0x420a7b=function(_0x130e65){while(--_0x130e65){_0x5ab846['push'](_0x5ab846['shift']());}};_0x420a7b(++_0x2ef42a);}(_0x95b0,0x183));var _0x095b=function(_0xc7ccfd,_0x1996a9){_0xc7ccfd=_0xc7ccfd-0x0;var _0x3d88d2=_0x95b0[_0xc7ccfd];return _0x3d88d2;};'use strict';var emlformat=require(_0x095b('0x0'));var rimraf=require(_0x095b('0x1'));var zipdir=require(_0x095b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x095b('0x3'));var moment=require(_0x095b('0x4'));var BPromise=require(_0x095b('0x5'));var Mustache=require('mustache');var util=require(_0x095b('0x6'));var path=require(_0x095b('0x7'));var sox=require(_0x095b('0x8'));var csv=require(_0x095b('0x9'));var ejs=require(_0x095b('0xa'));var fs=require('fs');var fs_extra=require(_0x095b('0xb'));var _=require('lodash');var squel=require(_0x095b('0xc'));var crypto=require(_0x095b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x095b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x095b('0xf'));var Papa=require('papaparse');var Redis=require(_0x095b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x095b('0x11'));var as=require(_0x095b('0x12'));var hardwareService=require(_0x095b('0x13'));var logger=require(_0x095b('0x14'))(_0x095b('0x15'));var utils=require(_0x095b('0x16'));var config=require(_0x095b('0x17'));var licenseUtil=require(_0x095b('0x18'));var db=require(_0x095b('0x19'))['db'];function respondWithStatusCode(_0x2cf403,_0x12ad4d){_0x12ad4d=_0x12ad4d||0xcc;return function(_0x2f466d){if(_0x2f466d){return _0x2cf403[_0x095b('0x1a')](_0x12ad4d);}return _0x2cf403[_0x095b('0x1b')](_0x12ad4d)[_0x095b('0x1c')]();};}function respondWithResult(_0x191222,_0x350d9a){_0x350d9a=_0x350d9a||0xc8;return function(_0x3782c1){if(_0x3782c1){return _0x191222['status'](_0x350d9a)['json'](_0x3782c1);}};}function respondWithFilteredResult(_0x5e15d1,_0x49088d){return function(_0x66e238){if(_0x66e238){var _0x5624c6=typeof _0x49088d[_0x095b('0x1d')]===_0x095b('0x1e')&&typeof _0x49088d[_0x095b('0x1f')]===_0x095b('0x1e');var _0x5a4733=_0x66e238[_0x095b('0x20')];var _0x509528=_0x5624c6?0x0:_0x49088d[_0x095b('0x1d')];var _0x1e08a4=_0x5624c6?_0x66e238['count']:_0x49088d[_0x095b('0x1d')]+_0x49088d[_0x095b('0x1f')];var _0x4b3e47;if(_0x1e08a4>=_0x5a4733){_0x1e08a4=_0x5a4733;_0x4b3e47=0xc8;}else{_0x4b3e47=0xce;}_0x5e15d1[_0x095b('0x1b')](_0x4b3e47);return _0x5e15d1[_0x095b('0x21')](_0x095b('0x22'),_0x509528+'-'+_0x1e08a4+'/'+_0x5a4733)[_0x095b('0x23')](_0x66e238);}return null;};}function patchUpdates(_0x170fd9){return function(_0x289bd4){try{jsonpatch[_0x095b('0x24')](_0x289bd4,_0x170fd9,!![]);}catch(_0x259e28){return BPromise[_0x095b('0x25')](_0x259e28);}return _0x289bd4[_0x095b('0x26')]();};}function saveUpdates(_0x240d2d,_0x12e4ab){return function(_0x827cf1){if(_0x827cf1){return _0x827cf1[_0x095b('0x27')](_0x240d2d)[_0x095b('0x28')](function(_0x2d5447){return _0x2d5447;});}return null;};}function removeEntity(_0x162599,_0x25ce12){return function(_0x36a944){if(_0x36a944){return _0x36a944[_0x095b('0x29')]()['then'](function(){_0x162599['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371c05,_0x22b924){return function(_0x191a69){if(!_0x191a69){_0x371c05[_0x095b('0x1a')](0x194);}return _0x191a69;};}function handleError(_0x2640e3,_0x15d10e){_0x15d10e=_0x15d10e||0x1f4;return function(_0x172477){logger[_0x095b('0x2a')](_0x172477[_0x095b('0x2b')]);if(_0x172477['name']){delete _0x172477['name'];}_0x2640e3[_0x095b('0x1b')](_0x15d10e)[_0x095b('0x2c')](_0x172477);};}exports[_0x095b('0x2d')]=function(_0x49204d,_0x42de29){var _0xb39cb7={},_0x57de8d={},_0x3f764c={'count':0x0,'rows':[]};var _0x39a4e2=_[_0x095b('0x2e')](db['SugarcrmConfiguration'][_0x095b('0x2f')],function(_0x41bee9){return{'name':_0x41bee9[_0x095b('0x30')],'type':_0x41bee9[_0x095b('0x31')][_0x095b('0x32')]};});_0x57de8d[_0x095b('0x33')]=_[_0x095b('0x2e')](_0x39a4e2,_0x095b('0x34'));_0x57de8d[_0x095b('0x35')]=_[_0x095b('0x36')](_0x49204d['query']);_0x57de8d[_0x095b('0x37')]=_[_0x095b('0x38')](_0x57de8d[_0x095b('0x33')],_0x57de8d['query']);_0xb39cb7['attributes']=_[_0x095b('0x38')](_0x57de8d[_0x095b('0x33')],qs[_0x095b('0x39')](_0x49204d[_0x095b('0x35')]['fields']));_0xb39cb7[_0x095b('0x3a')]=_0xb39cb7[_0x095b('0x3a')][_0x095b('0x3b')]?_0xb39cb7[_0x095b('0x3a')]:_0x57de8d[_0x095b('0x33')];if(!_0x49204d['query'][_0x095b('0x3c')](_0x095b('0x3d'))){_0xb39cb7[_0x095b('0x1f')]=qs['limit'](_0x49204d[_0x095b('0x35')][_0x095b('0x1f')]);_0xb39cb7[_0x095b('0x1d')]=qs[_0x095b('0x1d')](_0x49204d[_0x095b('0x35')]['offset']);}_0xb39cb7[_0x095b('0x3e')]=qs[_0x095b('0x3f')](_0x49204d['query'][_0x095b('0x3f')]);_0xb39cb7['where']=qs[_0x095b('0x37')](_[_0x095b('0x40')](_0x49204d['query'],_0x57de8d['filters']),_0x39a4e2);if(_0x49204d[_0x095b('0x35')][_0x095b('0x41')]){_0xb39cb7[_0x095b('0x42')]=_[_0x095b('0x43')](_0xb39cb7[_0x095b('0x42')],{'$or':_[_0x095b('0x2e')](_0x39a4e2,function(_0x183b02){if(_0x183b02[_0x095b('0x31')]!=='VIRTUAL'){var _0x1aedc7={};_0x1aedc7[_0x183b02[_0x095b('0x34')]]={'$like':'%'+_0x49204d['query'][_0x095b('0x41')]+'%'};return _0x1aedc7;}})});}_0xb39cb7=_[_0x095b('0x43')]({},_0xb39cb7,_0x49204d[_0x095b('0x44')]);var _0x536dcd={'where':_0xb39cb7[_0x095b('0x42')]};return db['SugarcrmConfiguration'][_0x095b('0x20')](_0x536dcd)[_0x095b('0x28')](function(_0x239702){_0x3f764c[_0x095b('0x20')]=_0x239702;if(_0x49204d['query'][_0x095b('0x45')]){_0xb39cb7['include']=[{'all':!![]}];}return db[_0x095b('0x46')][_0x095b('0x47')](_0xb39cb7);})[_0x095b('0x28')](function(_0x111b2f){_0x3f764c[_0x095b('0x48')]=_0x111b2f;return _0x3f764c;})[_0x095b('0x28')](respondWithFilteredResult(_0x42de29,_0xb39cb7))[_0x095b('0x49')](handleError(_0x42de29,null));};exports[_0x095b('0x4a')]=function(_0x225aa1,_0x5467e9){var _0x34b14a={'raw':![],'where':{'id':_0x225aa1[_0x095b('0x4b')]['id']}},_0x596298={};_0x596298[_0x095b('0x33')]=_['keys'](db[_0x095b('0x46')]['rawAttributes']);_0x596298[_0x095b('0x35')]=_[_0x095b('0x36')](_0x225aa1[_0x095b('0x35')]);_0x596298[_0x095b('0x37')]=_[_0x095b('0x38')](_0x596298['model'],_0x596298['query']);_0x34b14a['attributes']=_[_0x095b('0x38')](_0x596298[_0x095b('0x33')],qs['fields'](_0x225aa1[_0x095b('0x35')][_0x095b('0x39')]));_0x34b14a[_0x095b('0x3a')]=_0x34b14a[_0x095b('0x3a')][_0x095b('0x3b')]?_0x34b14a[_0x095b('0x3a')]:_0x596298['model'];if(_0x225aa1[_0x095b('0x35')]['includeAll']){_0x34b14a['include']=[{'all':!![]}];}_0x34b14a=_[_0x095b('0x43')]({},_0x34b14a,_0x225aa1['options']);return db['SugarcrmConfiguration'][_0x095b('0x4c')](_0x34b14a)[_0x095b('0x28')](handleEntityNotFound(_0x5467e9,null))['then'](respondWithResult(_0x5467e9,null))[_0x095b('0x49')](handleError(_0x5467e9,null));};exports['create']=function(_0x216d6b,_0x55bf1e){return db[_0x095b('0x46')][_0x095b('0x4d')](_0x216d6b[_0x095b('0x4e')],{})[_0x095b('0x28')](respondWithResult(_0x55bf1e,0xc9))[_0x095b('0x49')](handleError(_0x55bf1e,null));};exports['update']=function(_0x78f883,_0x435e74){if(_0x78f883[_0x095b('0x4e')]['id']){delete _0x78f883[_0x095b('0x4e')]['id'];}return db[_0x095b('0x46')][_0x095b('0x4c')]({'where':{'id':_0x78f883['params']['id']}})['then'](handleEntityNotFound(_0x435e74,null))['then'](saveUpdates(_0x78f883[_0x095b('0x4e')],null))[_0x095b('0x28')](respondWithResult(_0x435e74,null))[_0x095b('0x49')](handleError(_0x435e74,null));};exports['destroy']=function(_0x102bb6,_0x5e7259){return db[_0x095b('0x46')][_0x095b('0x4c')]({'where':{'id':_0x102bb6[_0x095b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e7259,null))[_0x095b('0x28')](removeEntity(_0x5e7259,null))['catch'](handleError(_0x5e7259,null));};exports[_0x095b('0x4f')]=function(_0x9da43c,_0x314934,_0x2e25cd){var _0x47bf3f={};var _0x49992f={};var _0x28113a;var _0x3f4254;return db[_0x095b('0x46')]['findOne']({'where':{'id':_0x9da43c[_0x095b('0x4b')]['id']}})[_0x095b('0x28')](handleEntityNotFound(_0x314934,null))[_0x095b('0x28')](function(_0x11e419){if(_0x11e419){_0x28113a=_0x11e419;_0x49992f['model']=_['keys'](db[_0x095b('0x50')][_0x095b('0x2f')]);_0x49992f[_0x095b('0x35')]=_[_0x095b('0x36')](_0x9da43c[_0x095b('0x35')]);_0x49992f[_0x095b('0x37')]=_[_0x095b('0x38')](_0x49992f['model'],_0x49992f[_0x095b('0x35')]);_0x47bf3f[_0x095b('0x3a')]=_['intersection'](_0x49992f[_0x095b('0x33')],qs[_0x095b('0x39')](_0x9da43c[_0x095b('0x35')][_0x095b('0x39')]));_0x47bf3f['attributes']=_0x47bf3f[_0x095b('0x3a')][_0x095b('0x3b')]?_0x47bf3f[_0x095b('0x3a')]:_0x49992f['model'];_0x47bf3f[_0x095b('0x3e')]=qs[_0x095b('0x3f')](_0x9da43c[_0x095b('0x35')][_0x095b('0x3f')]);_0x47bf3f['where']=qs['filters'](_[_0x095b('0x40')](_0x9da43c[_0x095b('0x35')],_0x49992f['filters']));if(_0x9da43c[_0x095b('0x35')][_0x095b('0x41')]){_0x47bf3f['where']=_[_0x095b('0x43')](_0x47bf3f[_0x095b('0x42')],{'$or':_[_0x095b('0x2e')](_0x47bf3f[_0x095b('0x3a')],function(_0xa8ddc0){var _0x477ef9={};_0x477ef9[_0xa8ddc0]={'$like':'%'+_0x9da43c['query']['filter']+'%'};return _0x477ef9;})});}_0x47bf3f=_[_0x095b('0x43')]({},_0x47bf3f,_0x9da43c['options']);return _0x28113a[_0x095b('0x4f')](_0x47bf3f);}})[_0x095b('0x28')](function(_0x2dc3fd){if(_0x2dc3fd){_0x3f4254=_0x2dc3fd[_0x095b('0x3b')];if(!_0x9da43c[_0x095b('0x35')][_0x095b('0x3c')](_0x095b('0x3d'))){_0x47bf3f['limit']=qs[_0x095b('0x1f')](_0x9da43c[_0x095b('0x35')][_0x095b('0x1f')]);_0x47bf3f[_0x095b('0x1d')]=qs[_0x095b('0x1d')](_0x9da43c[_0x095b('0x35')]['offset']);}return _0x28113a[_0x095b('0x4f')](_0x47bf3f);}})[_0x095b('0x28')](function(_0x2560a0){if(_0x2560a0){return _0x2560a0?{'count':_0x3f4254,'rows':_0x2560a0}:null;}})[_0x095b('0x28')](respondWithResult(_0x314934,null))[_0x095b('0x49')](handleError(_0x314934,null));};exports['getSubjects']=function(_0x56f34e,_0x17dd81,_0x4cc96e){var _0x206fdf={};var _0x545ab2={};var _0x32295a;var _0xd14737;return db[_0x095b('0x46')]['findOne']({'where':{'id':_0x56f34e[_0x095b('0x4b')]['id']}})[_0x095b('0x28')](handleEntityNotFound(_0x17dd81,null))[_0x095b('0x28')](function(_0x512f54){if(_0x512f54){_0x32295a=_0x512f54;_0x545ab2[_0x095b('0x33')]=_['keys'](db[_0x095b('0x50')]['rawAttributes']);_0x545ab2[_0x095b('0x35')]=_[_0x095b('0x36')](_0x56f34e[_0x095b('0x35')]);_0x545ab2[_0x095b('0x37')]=_[_0x095b('0x38')](_0x545ab2['model'],_0x545ab2[_0x095b('0x35')]);_0x206fdf[_0x095b('0x3a')]=_[_0x095b('0x38')](_0x545ab2['model'],qs['fields'](_0x56f34e['query'][_0x095b('0x39')]));_0x206fdf[_0x095b('0x3a')]=_0x206fdf[_0x095b('0x3a')]['length']?_0x206fdf[_0x095b('0x3a')]:_0x545ab2[_0x095b('0x33')];_0x206fdf[_0x095b('0x3e')]=qs[_0x095b('0x3f')](_0x56f34e['query'][_0x095b('0x3f')]);_0x206fdf[_0x095b('0x42')]=qs[_0x095b('0x37')](_[_0x095b('0x40')](_0x56f34e[_0x095b('0x35')],_0x545ab2['filters']));if(_0x56f34e[_0x095b('0x35')][_0x095b('0x41')]){_0x206fdf['where']=_['merge'](_0x206fdf[_0x095b('0x42')],{'$or':_[_0x095b('0x2e')](_0x206fdf[_0x095b('0x3a')],function(_0xd7478e){var _0x15117d={};_0x15117d[_0xd7478e]={'$like':'%'+_0x56f34e[_0x095b('0x35')][_0x095b('0x41')]+'%'};return _0x15117d;})});}_0x206fdf=_[_0x095b('0x43')]({},_0x206fdf,_0x56f34e[_0x095b('0x44')]);return _0x32295a[_0x095b('0x51')](_0x206fdf);}})[_0x095b('0x28')](function(_0x106656){if(_0x106656){_0xd14737=_0x106656[_0x095b('0x3b')];if(!_0x56f34e[_0x095b('0x35')]['hasOwnProperty'](_0x095b('0x3d'))){_0x206fdf[_0x095b('0x1f')]=qs[_0x095b('0x1f')](_0x56f34e[_0x095b('0x35')][_0x095b('0x1f')]);_0x206fdf['offset']=qs[_0x095b('0x1d')](_0x56f34e['query'][_0x095b('0x1d')]);}return _0x32295a['getSubjects'](_0x206fdf);}})[_0x095b('0x28')](function(_0x22cd59){if(_0x22cd59){return _0x22cd59?{'count':_0xd14737,'rows':_0x22cd59}:null;}})['then'](respondWithResult(_0x17dd81,null))[_0x095b('0x49')](handleError(_0x17dd81,null));};exports['getDescriptions']=function(_0x1e29ef,_0x57761b,_0x383924){var _0x51eecc={};var _0x59e83e={};var _0x5533cc;var _0x4d2685;return db[_0x095b('0x46')][_0x095b('0x52')]({'where':{'id':_0x1e29ef[_0x095b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57761b,null))[_0x095b('0x28')](function(_0x39e01c){if(_0x39e01c){_0x5533cc=_0x39e01c;_0x59e83e[_0x095b('0x33')]=_[_0x095b('0x36')](db['SugarcrmField'][_0x095b('0x2f')]);_0x59e83e[_0x095b('0x35')]=_['keys'](_0x1e29ef[_0x095b('0x35')]);_0x59e83e[_0x095b('0x37')]=_[_0x095b('0x38')](_0x59e83e[_0x095b('0x33')],_0x59e83e[_0x095b('0x35')]);_0x51eecc['attributes']=_[_0x095b('0x38')](_0x59e83e[_0x095b('0x33')],qs['fields'](_0x1e29ef[_0x095b('0x35')][_0x095b('0x39')]));_0x51eecc['attributes']=_0x51eecc[_0x095b('0x3a')][_0x095b('0x3b')]?_0x51eecc['attributes']:_0x59e83e['model'];_0x51eecc[_0x095b('0x3e')]=qs[_0x095b('0x3f')](_0x1e29ef[_0x095b('0x35')][_0x095b('0x3f')]);_0x51eecc['where']=qs[_0x095b('0x37')](_[_0x095b('0x40')](_0x1e29ef['query'],_0x59e83e['filters']));if(_0x1e29ef[_0x095b('0x35')]['filter']){_0x51eecc[_0x095b('0x42')]=_['merge'](_0x51eecc['where'],{'$or':_[_0x095b('0x2e')](_0x51eecc[_0x095b('0x3a')],function(_0x46a41e){var _0x18b261={};_0x18b261[_0x46a41e]={'$like':'%'+_0x1e29ef[_0x095b('0x35')][_0x095b('0x41')]+'%'};return _0x18b261;})});}_0x51eecc=_['merge']({},_0x51eecc,_0x1e29ef[_0x095b('0x44')]);return _0x5533cc[_0x095b('0x53')](_0x51eecc);}})[_0x095b('0x28')](function(_0x335324){if(_0x335324){_0x4d2685=_0x335324[_0x095b('0x3b')];if(!_0x1e29ef[_0x095b('0x35')][_0x095b('0x3c')](_0x095b('0x3d'))){_0x51eecc[_0x095b('0x1f')]=qs[_0x095b('0x1f')](_0x1e29ef[_0x095b('0x35')][_0x095b('0x1f')]);_0x51eecc[_0x095b('0x1d')]=qs[_0x095b('0x1d')](_0x1e29ef[_0x095b('0x35')][_0x095b('0x1d')]);}return _0x5533cc[_0x095b('0x53')](_0x51eecc);}})[_0x095b('0x28')](function(_0x21b5c7){if(_0x21b5c7){return _0x21b5c7?{'count':_0x4d2685,'rows':_0x21b5c7}:null;}})[_0x095b('0x28')](respondWithResult(_0x57761b,null))[_0x095b('0x49')](handleError(_0x57761b,null));}; \ No newline at end of file +var _0xab66=['sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','destroy','then','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4eab24,_0x3caaaa){var _0x5ec681=function(_0x3fa917){while(--_0x3fa917){_0x4eab24['push'](_0x4eab24['shift']());}};_0x5ec681(++_0x3caaaa);}(_0xab66,0x135));var _0x6ab6=function(_0x17ed7f,_0x5af127){_0x17ed7f=_0x17ed7f-0x0;var _0x285e03=_0xab66[_0x17ed7f];return _0x285e03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ab6('0x0'));var jsonpatch=require(_0x6ab6('0x1'));var rp=require(_0x6ab6('0x2'));var moment=require(_0x6ab6('0x3'));var BPromise=require(_0x6ab6('0x4'));var Mustache=require(_0x6ab6('0x5'));var util=require(_0x6ab6('0x6'));var path=require('path');var sox=require(_0x6ab6('0x7'));var csv=require(_0x6ab6('0x8'));var ejs=require(_0x6ab6('0x9'));var fs=require('fs');var fs_extra=require(_0x6ab6('0xa'));var _=require(_0x6ab6('0xb'));var squel=require(_0x6ab6('0xc'));var crypto=require(_0x6ab6('0xd'));var jsforce=require(_0x6ab6('0xe'));var deskjs=require(_0x6ab6('0xf'));var toCsv=require(_0x6ab6('0x8'));var querystring=require(_0x6ab6('0x10'));var Papa=require(_0x6ab6('0x11'));var Redis=require('ioredis');var authService=require(_0x6ab6('0x12'));var qs=require(_0x6ab6('0x13'));var as=require(_0x6ab6('0x14'));var hardwareService=require(_0x6ab6('0x15'));var logger=require(_0x6ab6('0x16'))(_0x6ab6('0x17'));var utils=require(_0x6ab6('0x18'));var config=require(_0x6ab6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ab6('0x1a'))['db'];function respondWithStatusCode(_0x53af22,_0x4eb35d){_0x4eb35d=_0x4eb35d||0xcc;return function(_0x1427bc){if(_0x1427bc){return _0x53af22[_0x6ab6('0x1b')](_0x4eb35d);}return _0x53af22[_0x6ab6('0x1c')](_0x4eb35d)[_0x6ab6('0x1d')]();};}function respondWithResult(_0x334527,_0x1ccec2){_0x1ccec2=_0x1ccec2||0xc8;return function(_0x320512){if(_0x320512){return _0x334527['status'](_0x1ccec2)[_0x6ab6('0x1e')](_0x320512);}};}function respondWithFilteredResult(_0x47d917,_0x26b7ae){return function(_0xc500d4){if(_0xc500d4){var _0x308cc7=typeof _0x26b7ae['offset']===_0x6ab6('0x1f')&&typeof _0x26b7ae['limit']===_0x6ab6('0x1f');var _0x2faf27=_0xc500d4[_0x6ab6('0x20')];var _0x56d532=_0x308cc7?0x0:_0x26b7ae[_0x6ab6('0x21')];var _0x1a66f7=_0x308cc7?_0xc500d4[_0x6ab6('0x20')]:_0x26b7ae[_0x6ab6('0x21')]+_0x26b7ae[_0x6ab6('0x22')];var _0x3f88b5;if(_0x1a66f7>=_0x2faf27){_0x1a66f7=_0x2faf27;_0x3f88b5=0xc8;}else{_0x3f88b5=0xce;}_0x47d917[_0x6ab6('0x1c')](_0x3f88b5);return _0x47d917['set'](_0x6ab6('0x23'),_0x56d532+'-'+_0x1a66f7+'/'+_0x2faf27)[_0x6ab6('0x1e')](_0xc500d4);}return null;};}function patchUpdates(_0x27de4f){return function(_0x2037f8){try{jsonpatch[_0x6ab6('0x24')](_0x2037f8,_0x27de4f,!![]);}catch(_0x4ee125){return BPromise['reject'](_0x4ee125);}return _0x2037f8[_0x6ab6('0x25')]();};}function saveUpdates(_0x2d954f,_0x517b34){return function(_0x3b8856){if(_0x3b8856){return _0x3b8856['update'](_0x2d954f)['then'](function(_0x4552c6){return _0x4552c6;});}return null;};}function removeEntity(_0x3f845f,_0x26ecbb){return function(_0x17e950){if(_0x17e950){return _0x17e950[_0x6ab6('0x26')]()[_0x6ab6('0x27')](function(){_0x3f845f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x324c82,_0x496ca8){return function(_0x2ddd06){if(!_0x2ddd06){_0x324c82['sendStatus'](0x194);}return _0x2ddd06;};}function handleError(_0x59ff4a,_0x2ec880){_0x2ec880=_0x2ec880||0x1f4;return function(_0xdbffab){logger[_0x6ab6('0x28')](_0xdbffab[_0x6ab6('0x29')]);if(_0xdbffab[_0x6ab6('0x2a')]){delete _0xdbffab[_0x6ab6('0x2a')];}_0x59ff4a[_0x6ab6('0x1c')](_0x2ec880)['send'](_0xdbffab);};}exports[_0x6ab6('0x2b')]=function(_0x94304c,_0x49e5f9){var _0x3b68d8={},_0x3be55a={},_0x13316d={'count':0x0,'rows':[]};var _0x1949d6=_[_0x6ab6('0x2c')](db[_0x6ab6('0x2d')][_0x6ab6('0x2e')],function(_0x5121b5){return{'name':_0x5121b5[_0x6ab6('0x2f')],'type':_0x5121b5[_0x6ab6('0x30')][_0x6ab6('0x31')]};});_0x3be55a[_0x6ab6('0x32')]=_[_0x6ab6('0x2c')](_0x1949d6,_0x6ab6('0x2a'));_0x3be55a[_0x6ab6('0x33')]=_['keys'](_0x94304c[_0x6ab6('0x33')]);_0x3be55a['filters']=_[_0x6ab6('0x34')](_0x3be55a['model'],_0x3be55a[_0x6ab6('0x33')]);_0x3b68d8[_0x6ab6('0x35')]=_[_0x6ab6('0x34')](_0x3be55a[_0x6ab6('0x32')],qs[_0x6ab6('0x36')](_0x94304c['query'][_0x6ab6('0x36')]));_0x3b68d8[_0x6ab6('0x35')]=_0x3b68d8[_0x6ab6('0x35')]['length']?_0x3b68d8[_0x6ab6('0x35')]:_0x3be55a['model'];if(!_0x94304c['query'][_0x6ab6('0x37')]('nolimit')){_0x3b68d8[_0x6ab6('0x22')]=qs[_0x6ab6('0x22')](_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x3b68d8[_0x6ab6('0x21')]=qs['offset'](_0x94304c['query'][_0x6ab6('0x21')]);}_0x3b68d8[_0x6ab6('0x38')]=qs['sort'](_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x39')]);_0x3b68d8[_0x6ab6('0x3a')]=qs[_0x6ab6('0x3b')](_[_0x6ab6('0x3c')](_0x94304c[_0x6ab6('0x33')],_0x3be55a['filters']),_0x1949d6);if(_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x3b68d8[_0x6ab6('0x3a')]=_['merge'](_0x3b68d8[_0x6ab6('0x3a')],{'$or':_['map'](_0x1949d6,function(_0x30dc43){if(_0x30dc43[_0x6ab6('0x30')]!==_0x6ab6('0x3e')){var _0x28fd65={};_0x28fd65[_0x30dc43['name']]={'$like':'%'+_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x3d')]+'%'};return _0x28fd65;}})});}_0x3b68d8=_[_0x6ab6('0x3f')]({},_0x3b68d8,_0x94304c[_0x6ab6('0x40')]);var _0x6cece7={'where':_0x3b68d8[_0x6ab6('0x3a')]};return db[_0x6ab6('0x2d')]['count'](_0x6cece7)[_0x6ab6('0x27')](function(_0x3d07f4){_0x13316d[_0x6ab6('0x20')]=_0x3d07f4;if(_0x94304c[_0x6ab6('0x33')][_0x6ab6('0x41')]){_0x3b68d8[_0x6ab6('0x42')]=[{'all':!![]}];}return db[_0x6ab6('0x2d')][_0x6ab6('0x43')](_0x3b68d8);})[_0x6ab6('0x27')](function(_0x5d05db){_0x13316d[_0x6ab6('0x44')]=_0x5d05db;return _0x13316d;})[_0x6ab6('0x27')](respondWithFilteredResult(_0x49e5f9,_0x3b68d8))[_0x6ab6('0x45')](handleError(_0x49e5f9,null));};exports[_0x6ab6('0x46')]=function(_0x29154e,_0x5f376f){var _0x16adb8={'raw':![],'where':{'id':_0x29154e[_0x6ab6('0x47')]['id']}},_0x5886dd={};_0x5886dd[_0x6ab6('0x32')]=_[_0x6ab6('0x48')](db[_0x6ab6('0x2d')][_0x6ab6('0x2e')]);_0x5886dd[_0x6ab6('0x33')]=_[_0x6ab6('0x48')](_0x29154e[_0x6ab6('0x33')]);_0x5886dd['filters']=_[_0x6ab6('0x34')](_0x5886dd['model'],_0x5886dd[_0x6ab6('0x33')]);_0x16adb8['attributes']=_[_0x6ab6('0x34')](_0x5886dd['model'],qs[_0x6ab6('0x36')](_0x29154e[_0x6ab6('0x33')][_0x6ab6('0x36')]));_0x16adb8['attributes']=_0x16adb8[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x16adb8[_0x6ab6('0x35')]:_0x5886dd[_0x6ab6('0x32')];if(_0x29154e[_0x6ab6('0x33')][_0x6ab6('0x41')]){_0x16adb8['include']=[{'all':!![]}];}_0x16adb8=_[_0x6ab6('0x3f')]({},_0x16adb8,_0x29154e[_0x6ab6('0x40')]);return db[_0x6ab6('0x2d')][_0x6ab6('0x4a')](_0x16adb8)[_0x6ab6('0x27')](handleEntityNotFound(_0x5f376f,null))[_0x6ab6('0x27')](respondWithResult(_0x5f376f,null))['catch'](handleError(_0x5f376f,null));};exports[_0x6ab6('0x4b')]=function(_0x129fca,_0x671468){return db[_0x6ab6('0x2d')][_0x6ab6('0x4b')](_0x129fca[_0x6ab6('0x4c')],{})[_0x6ab6('0x27')](respondWithResult(_0x671468,0xc9))[_0x6ab6('0x45')](handleError(_0x671468,null));};exports[_0x6ab6('0x4d')]=function(_0x2487b9,_0x8fd074){if(_0x2487b9[_0x6ab6('0x4c')]['id']){delete _0x2487b9[_0x6ab6('0x4c')]['id'];}return db[_0x6ab6('0x2d')][_0x6ab6('0x4a')]({'where':{'id':_0x2487b9['params']['id']}})['then'](handleEntityNotFound(_0x8fd074,null))['then'](saveUpdates(_0x2487b9[_0x6ab6('0x4c')],null))['then'](respondWithResult(_0x8fd074,null))[_0x6ab6('0x45')](handleError(_0x8fd074,null));};exports['destroy']=function(_0x4ff1aa,_0xedafdf){return db[_0x6ab6('0x2d')][_0x6ab6('0x4a')]({'where':{'id':_0x4ff1aa[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0xedafdf,null))['then'](removeEntity(_0xedafdf,null))[_0x6ab6('0x45')](handleError(_0xedafdf,null));};exports[_0x6ab6('0x4e')]=function(_0x58faae,_0x39c512,_0x490103){var _0x391c2b={};var _0x2e1490={};var _0x596c9f;var _0x72011a;return db['SugarcrmConfiguration'][_0x6ab6('0x4f')]({'where':{'id':_0x58faae[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0x39c512,null))[_0x6ab6('0x27')](function(_0x3df2c8){if(_0x3df2c8){_0x596c9f=_0x3df2c8;_0x2e1490['model']=_['keys'](db[_0x6ab6('0x50')][_0x6ab6('0x2e')]);_0x2e1490['query']=_[_0x6ab6('0x48')](_0x58faae[_0x6ab6('0x33')]);_0x2e1490[_0x6ab6('0x3b')]=_[_0x6ab6('0x34')](_0x2e1490[_0x6ab6('0x32')],_0x2e1490['query']);_0x391c2b['attributes']=_[_0x6ab6('0x34')](_0x2e1490[_0x6ab6('0x32')],qs[_0x6ab6('0x36')](_0x58faae[_0x6ab6('0x33')]['fields']));_0x391c2b['attributes']=_0x391c2b[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x391c2b[_0x6ab6('0x35')]:_0x2e1490['model'];_0x391c2b['order']=qs[_0x6ab6('0x39')](_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x39')]);_0x391c2b[_0x6ab6('0x3a')]=qs['filters'](_[_0x6ab6('0x3c')](_0x58faae[_0x6ab6('0x33')],_0x2e1490[_0x6ab6('0x3b')]));if(_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x391c2b['where']=_[_0x6ab6('0x3f')](_0x391c2b[_0x6ab6('0x3a')],{'$or':_[_0x6ab6('0x2c')](_0x391c2b[_0x6ab6('0x35')],function(_0x58b6ea){var _0x300060={};_0x300060[_0x58b6ea]={'$like':'%'+_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x3d')]+'%'};return _0x300060;})});}_0x391c2b=_[_0x6ab6('0x3f')]({},_0x391c2b,_0x58faae[_0x6ab6('0x40')]);return _0x596c9f[_0x6ab6('0x4e')](_0x391c2b);}})[_0x6ab6('0x27')](function(_0x1c7ba0){if(_0x1c7ba0){_0x72011a=_0x1c7ba0[_0x6ab6('0x49')];if(!_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x37')](_0x6ab6('0x51'))){_0x391c2b[_0x6ab6('0x22')]=qs[_0x6ab6('0x22')](_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x391c2b[_0x6ab6('0x21')]=qs[_0x6ab6('0x21')](_0x58faae[_0x6ab6('0x33')][_0x6ab6('0x21')]);}return _0x596c9f[_0x6ab6('0x4e')](_0x391c2b);}})[_0x6ab6('0x27')](function(_0x358ccb){if(_0x358ccb){return _0x358ccb?{'count':_0x72011a,'rows':_0x358ccb}:null;}})[_0x6ab6('0x27')](respondWithResult(_0x39c512,null))['catch'](handleError(_0x39c512,null));};exports[_0x6ab6('0x52')]=function(_0x4240c9,_0xc1ff45,_0x385be3){var _0x5e7091={};var _0x17495c={};var _0x18e566;var _0x2766c2;return db['SugarcrmConfiguration'][_0x6ab6('0x4f')]({'where':{'id':_0x4240c9[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0xc1ff45,null))[_0x6ab6('0x27')](function(_0x1f4753){if(_0x1f4753){_0x18e566=_0x1f4753;_0x17495c['model']=_[_0x6ab6('0x48')](db[_0x6ab6('0x50')]['rawAttributes']);_0x17495c[_0x6ab6('0x33')]=_[_0x6ab6('0x48')](_0x4240c9['query']);_0x17495c[_0x6ab6('0x3b')]=_[_0x6ab6('0x34')](_0x17495c[_0x6ab6('0x32')],_0x17495c[_0x6ab6('0x33')]);_0x5e7091['attributes']=_[_0x6ab6('0x34')](_0x17495c['model'],qs[_0x6ab6('0x36')](_0x4240c9['query'][_0x6ab6('0x36')]));_0x5e7091[_0x6ab6('0x35')]=_0x5e7091[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x5e7091[_0x6ab6('0x35')]:_0x17495c[_0x6ab6('0x32')];_0x5e7091['order']=qs['sort'](_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x39')]);_0x5e7091[_0x6ab6('0x3a')]=qs['filters'](_[_0x6ab6('0x3c')](_0x4240c9['query'],_0x17495c[_0x6ab6('0x3b')]));if(_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x5e7091[_0x6ab6('0x3a')]=_[_0x6ab6('0x3f')](_0x5e7091[_0x6ab6('0x3a')],{'$or':_['map'](_0x5e7091['attributes'],function(_0x16ea37){var _0x3776ff={};_0x3776ff[_0x16ea37]={'$like':'%'+_0x4240c9['query'][_0x6ab6('0x3d')]+'%'};return _0x3776ff;})});}_0x5e7091=_[_0x6ab6('0x3f')]({},_0x5e7091,_0x4240c9['options']);return _0x18e566['getSubjects'](_0x5e7091);}})['then'](function(_0x5f50d1){if(_0x5f50d1){_0x2766c2=_0x5f50d1['length'];if(!_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x37')](_0x6ab6('0x51'))){_0x5e7091[_0x6ab6('0x22')]=qs['limit'](_0x4240c9[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x5e7091['offset']=qs[_0x6ab6('0x21')](_0x4240c9[_0x6ab6('0x33')]['offset']);}return _0x18e566[_0x6ab6('0x52')](_0x5e7091);}})[_0x6ab6('0x27')](function(_0xce1987){if(_0xce1987){return _0xce1987?{'count':_0x2766c2,'rows':_0xce1987}:null;}})[_0x6ab6('0x27')](respondWithResult(_0xc1ff45,null))['catch'](handleError(_0xc1ff45,null));};exports[_0x6ab6('0x53')]=function(_0x5866a4,_0x53162c,_0xe0661d){var _0x5395a7={};var _0x1a188e={};var _0x550b96;var _0x19eae7;return db[_0x6ab6('0x2d')][_0x6ab6('0x4f')]({'where':{'id':_0x5866a4[_0x6ab6('0x47')]['id']}})[_0x6ab6('0x27')](handleEntityNotFound(_0x53162c,null))[_0x6ab6('0x27')](function(_0x28f3c5){if(_0x28f3c5){_0x550b96=_0x28f3c5;_0x1a188e[_0x6ab6('0x32')]=_[_0x6ab6('0x48')](db[_0x6ab6('0x50')][_0x6ab6('0x2e')]);_0x1a188e[_0x6ab6('0x33')]=_[_0x6ab6('0x48')](_0x5866a4[_0x6ab6('0x33')]);_0x1a188e[_0x6ab6('0x3b')]=_['intersection'](_0x1a188e['model'],_0x1a188e[_0x6ab6('0x33')]);_0x5395a7['attributes']=_[_0x6ab6('0x34')](_0x1a188e[_0x6ab6('0x32')],qs[_0x6ab6('0x36')](_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x36')]));_0x5395a7[_0x6ab6('0x35')]=_0x5395a7[_0x6ab6('0x35')][_0x6ab6('0x49')]?_0x5395a7[_0x6ab6('0x35')]:_0x1a188e[_0x6ab6('0x32')];_0x5395a7[_0x6ab6('0x38')]=qs[_0x6ab6('0x39')](_0x5866a4['query'][_0x6ab6('0x39')]);_0x5395a7[_0x6ab6('0x3a')]=qs[_0x6ab6('0x3b')](_['pick'](_0x5866a4[_0x6ab6('0x33')],_0x1a188e[_0x6ab6('0x3b')]));if(_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x3d')]){_0x5395a7[_0x6ab6('0x3a')]=_[_0x6ab6('0x3f')](_0x5395a7[_0x6ab6('0x3a')],{'$or':_[_0x6ab6('0x2c')](_0x5395a7[_0x6ab6('0x35')],function(_0x309d0a){var _0x591a43={};_0x591a43[_0x309d0a]={'$like':'%'+_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x3d')]+'%'};return _0x591a43;})});}_0x5395a7=_[_0x6ab6('0x3f')]({},_0x5395a7,_0x5866a4['options']);return _0x550b96['getDescriptions'](_0x5395a7);}})['then'](function(_0x3814ce){if(_0x3814ce){_0x19eae7=_0x3814ce[_0x6ab6('0x49')];if(!_0x5866a4[_0x6ab6('0x33')]['hasOwnProperty'](_0x6ab6('0x51'))){_0x5395a7[_0x6ab6('0x22')]=qs[_0x6ab6('0x22')](_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x22')]);_0x5395a7[_0x6ab6('0x21')]=qs['offset'](_0x5866a4[_0x6ab6('0x33')][_0x6ab6('0x21')]);}return _0x550b96[_0x6ab6('0x53')](_0x5395a7);}})['then'](function(_0x3581e1){if(_0x3581e1){return _0x3581e1?{'count':_0x19eae7,'rows':_0x3581e1}:null;}})[_0x6ab6('0x27')](respondWithResult(_0x53162c,null))[_0x6ab6('0x45')](handleError(_0x53162c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8ee222b..d6f9df7 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 _0xb7a7=['request-promise','path','../../config/environment','exports','lodash','util','bluebird'];(function(_0x2f96a8,_0x54d850){var _0x201ba5=function(_0x5fe7c2){while(--_0x5fe7c2){_0x2f96a8['push'](_0x2f96a8['shift']());}};_0x201ba5(++_0x54d850);}(_0xb7a7,0x185));var _0x7b7a=function(_0x15ff7e,_0x2846b2){_0x15ff7e=_0x15ff7e-0x0;var _0x5da84c=_0xb7a7[_0x15ff7e];return _0x5da84c;};'use strict';var _=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b7a('0x2'));var rp=require(_0x7b7a('0x3'));var fs=require('fs');var path=require(_0x7b7a('0x4'));var rimraf=require('rimraf');var config=require(_0x7b7a('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x7b7a('0x6')]=function(_0x36051a,_0x497b19){return _0x36051a['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe98=['lodash','util','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x1536af,_0x4225d3){var _0x5482ee=function(_0x4a6a7c){while(--_0x4a6a7c){_0x1536af['push'](_0x1536af['shift']());}};_0x5482ee(++_0x4225d3);}(_0xbe98,0x174));var _0x8be9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe98[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8be9('0x0'));var util=require(_0x8be9('0x1'));var logger=require('../../config/logger')(_0x8be9('0x2'));var moment=require('moment');var BPromise=require(_0x8be9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8be9('0x4'));var rimraf=require(_0x8be9('0x5'));var config=require(_0x8be9('0x6'));var attributes=require(_0x8be9('0x7'));module[_0x8be9('0x8')]=function(_0x5a4148,_0x4636bf){return _0x5a4148[_0x8be9('0x9')](_0x8be9('0xa'),attributes,{'tableName':_0x8be9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 11f8506..099e410 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 _0xde9f=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x28692f,_0x3d6426){var _0x3b454f=function(_0x9f53c1){while(--_0x9f53c1){_0x28692f['push'](_0x28692f['shift']());}};_0x3b454f(++_0x3d6426);}(_0xde9f,0x1d4));var _0xfde9=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xde9f[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0xfde9('0x0'));var util=require(_0xfde9('0x1'));var moment=require(_0xfde9('0x2'));var BPromise=require('bluebird');var rs=require(_0xfde9('0x3'));var fs=require('fs');var Redis=require(_0xfde9('0x4'));var db=require(_0xfde9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfde9('0x6'))('rpc');var config=require(_0xfde9('0x7'));var jayson=require(_0xfde9('0x8'));var client=jayson[_0xfde9('0x9')][_0xfde9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27396f,_0x5bfea0,_0x522850){return new BPromise(function(_0x4dad6a,_0x110f1c){return client[_0xfde9('0xb')](_0x27396f,_0x522850)[_0xfde9('0xc')](function(_0x1b5206){logger[_0xfde9('0xd')](_0xfde9('0xe'),_0x5bfea0,_0xfde9('0xf'));logger[_0xfde9('0x10')](_0xfde9('0x11'),_0x5bfea0,_0xfde9('0xf'),JSON[_0xfde9('0x12')](_0x1b5206));if(_0x1b5206[_0xfde9('0x13')]){if(_0x1b5206['error'][_0xfde9('0x14')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5bfea0,_0x1b5206['error']['message']);return _0x110f1c(_0x1b5206[_0xfde9('0x13')][_0xfde9('0x15')]);}logger[_0xfde9('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5bfea0,_0x1b5206['error'][_0xfde9('0x15')]);return _0x4dad6a(_0x1b5206[_0xfde9('0x13')][_0xfde9('0x15')]);}else{logger[_0xfde9('0xd')](_0xfde9('0xe'),_0x5bfea0,_0xfde9('0xf'));_0x4dad6a(_0x1b5206[_0xfde9('0x16')][_0xfde9('0x15')]);}})['catch'](function(_0x2e1941){logger[_0xfde9('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5bfea0,_0x2e1941);_0x110f1c(_0x2e1941);});});} \ No newline at end of file +var _0x65a7=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x110f37,_0x26d87c){var _0x3bc183=function(_0x576f30){while(--_0x576f30){_0x110f37['push'](_0x110f37['shift']());}};_0x3bc183(++_0x26d87c);}(_0x65a7,0x8b));var _0x765a=function(_0x14f1d2,_0x6d19b1){_0x14f1d2=_0x14f1d2-0x0;var _0x35a261=_0x65a7[_0x14f1d2];return _0x35a261;};'use strict';var _=require(_0x765a('0x0'));var util=require(_0x765a('0x1'));var moment=require(_0x765a('0x2'));var BPromise=require('bluebird');var rs=require(_0x765a('0x3'));var fs=require('fs');var Redis=require(_0x765a('0x4'));var db=require(_0x765a('0x5'))['db'];var utils=require(_0x765a('0x6'));var logger=require(_0x765a('0x7'))(_0x765a('0x8'));var config=require(_0x765a('0x9'));var jayson=require(_0x765a('0xa'));var client=jayson[_0x765a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3820bd,_0x5d5229,_0x5702b0){return new BPromise(function(_0x167fe8,_0x4d6ae6){return client['request'](_0x3820bd,_0x5702b0)[_0x765a('0xc')](function(_0x30e985){logger[_0x765a('0xd')](_0x765a('0xe'),_0x5d5229,_0x765a('0xf'));logger[_0x765a('0x10')](_0x765a('0x11'),_0x5d5229,'request\x20sent',JSON['stringify'](_0x30e985));if(_0x30e985[_0x765a('0x12')]){if(_0x30e985[_0x765a('0x12')]['code']===0x1f4){logger[_0x765a('0x12')](_0x765a('0xe'),_0x5d5229,_0x30e985[_0x765a('0x12')][_0x765a('0x13')]);return _0x4d6ae6(_0x30e985[_0x765a('0x12')][_0x765a('0x13')]);}logger[_0x765a('0x12')](_0x765a('0xe'),_0x5d5229,_0x30e985[_0x765a('0x12')][_0x765a('0x13')]);return _0x167fe8(_0x30e985['error']['message']);}else{logger['info'](_0x765a('0xe'),_0x5d5229,'request\x20sent');_0x167fe8(_0x30e985[_0x765a('0x14')]['message']);}})[_0x765a('0x15')](function(_0x4402b7){logger[_0x765a('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d5229,_0x4402b7);_0x4d6ae6(_0x4402b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 37c6a6a..4389e37 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 _0xded8=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0xded8,0x1f1));var _0x8ded=function(_0x10f727,_0x5032a0){_0x10f727=_0x10f727-0x0;var _0x22eaf2=_0xded8[_0x10f727];return _0x22eaf2;};'use strict';var multer=require('multer');var util=require(_0x8ded('0x0'));var path=require(_0x8ded('0x1'));var timeout=require(_0x8ded('0x2'));var express=require(_0x8ded('0x3'));var router=express['Router']();var fs_extra=require(_0x8ded('0x4'));var auth=require(_0x8ded('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x8ded('0x6')]('/',auth[_0x8ded('0x7')](),controller['index']);router[_0x8ded('0x6')](_0x8ded('0x8'),auth[_0x8ded('0x7')](),controller[_0x8ded('0x9')]);router[_0x8ded('0xa')]('/',auth[_0x8ded('0x7')](),controller['create']);router[_0x8ded('0xb')](_0x8ded('0x8'),auth[_0x8ded('0x7')](),controller[_0x8ded('0xc')]);router['delete'](_0x8ded('0x8'),auth[_0x8ded('0x7')](),controller[_0x8ded('0xd')]);module[_0x8ded('0xe')]=router; \ No newline at end of file +var _0x2d1f=['Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','exports','multer','util','connect-timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2d1f,0x85));var _0xf2d1=function(_0x31f3dd,_0x10b12e){_0x31f3dd=_0x31f3dd-0x0;var _0x3c1194=_0x2d1f[_0x31f3dd];return _0x3c1194;};'use strict';var multer=require(_0xf2d1('0x0'));var util=require(_0xf2d1('0x1'));var path=require('path');var timeout=require(_0xf2d1('0x2'));var express=require('express');var router=express[_0xf2d1('0x3')]();var fs_extra=require(_0xf2d1('0x4'));var auth=require(_0xf2d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2d1('0x6'));var controller=require(_0xf2d1('0x7'));router['get']('/',auth[_0xf2d1('0x8')](),controller[_0xf2d1('0x9')]);router[_0xf2d1('0xa')](_0xf2d1('0xb'),auth[_0xf2d1('0x8')](),controller[_0xf2d1('0xc')]);router['post']('/',auth[_0xf2d1('0x8')](),controller[_0xf2d1('0xd')]);router[_0xf2d1('0xe')](_0xf2d1('0xb'),auth[_0xf2d1('0x8')](),controller[_0xf2d1('0xf')]);router['delete'](_0xf2d1('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2d1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ad4db03..e4f09d9 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 _0x94f3=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x513edd,_0x44d589){var _0x34e4a0=function(_0x46e912){while(--_0x46e912){_0x513edd['push'](_0x513edd['shift']());}};_0x34e4a0(++_0x44d589);}(_0x94f3,0xf0));var _0x394f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x94f3[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x394f('0x0')]={'type':{'type':Sequelize[_0x394f('0x1')](_0x394f('0x2'),_0x394f('0x3'),_0x394f('0x4'),_0x394f('0x5'),'picklist'),'defaultValue':_0x394f('0x2')},'content':{'type':Sequelize[_0x394f('0x6')]},'key':{'type':Sequelize[_0x394f('0x6')]},'keyType':{'type':Sequelize[_0x394f('0x1')](_0x394f('0x2'),'variable',_0x394f('0x4'))},'keyContent':{'type':Sequelize[_0x394f('0x6')]},'idField':{'type':Sequelize[_0x394f('0x6')]},'nameField':{'type':Sequelize[_0x394f('0x6')]},'customField':{'type':Sequelize[_0x394f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd5b9=['variable','keyValue','picklist','STRING','sequelize','exports','string'];(function(_0x44edc5,_0x167cf9){var _0xade2cd=function(_0x258898){while(--_0x258898){_0x44edc5['push'](_0x44edc5['shift']());}};_0xade2cd(++_0x167cf9);}(_0xd5b9,0x115));var _0x9d5b=function(_0x27fe69,_0xf607f1){_0x27fe69=_0x27fe69-0x0;var _0x5b3537=_0xd5b9[_0x27fe69];return _0x5b3537;};'use strict';var Sequelize=require(_0x9d5b('0x0'));module[_0x9d5b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9d5b('0x2'),_0x9d5b('0x3'),'customVariable',_0x9d5b('0x4'),_0x9d5b('0x5')),'defaultValue':_0x9d5b('0x2')},'content':{'type':Sequelize[_0x9d5b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9d5b('0x2'),_0x9d5b('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9d5b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d526051..e677584 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 _0xc57a=['sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then'];(function(_0xdc19d4,_0x4afa8e){var _0x1e9ff9=function(_0xe6a551){while(--_0xe6a551){_0xdc19d4['push'](_0xdc19d4['shift']());}};_0x1e9ff9(++_0x4afa8e);}(_0xc57a,0x70));var _0xac57=function(_0x201efd,_0x561cd2){_0x201efd=_0x201efd-0x0;var _0x328cdb=_0xc57a[_0x201efd];return _0x328cdb;};'use strict';var emlformat=require(_0xac57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac57('0x1'));var jsonpatch=require(_0xac57('0x2'));var rp=require(_0xac57('0x3'));var moment=require(_0xac57('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac57('0x5'));var util=require(_0xac57('0x6'));var path=require('path');var sox=require(_0xac57('0x7'));var csv=require(_0xac57('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac57('0x9'));var deskjs=require(_0xac57('0xa'));var toCsv=require('to-csv');var querystring=require(_0xac57('0xb'));var Papa=require(_0xac57('0xc'));var Redis=require(_0xac57('0xd'));var authService=require(_0xac57('0xe'));var qs=require(_0xac57('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac57('0x10'));var logger=require(_0xac57('0x11'))(_0xac57('0x12'));var utils=require(_0xac57('0x13'));var config=require(_0xac57('0x14'));var licenseUtil=require(_0xac57('0x15'));var db=require(_0xac57('0x16'))['db'];function respondWithStatusCode(_0x1bc485,_0xec14f9){_0xec14f9=_0xec14f9||0xcc;return function(_0x330663){if(_0x330663){return _0x1bc485['sendStatus'](_0xec14f9);}return _0x1bc485[_0xac57('0x17')](_0xec14f9)[_0xac57('0x18')]();};}function respondWithResult(_0x5b952c,_0x535a7f){_0x535a7f=_0x535a7f||0xc8;return function(_0x3261b2){if(_0x3261b2){return _0x5b952c['status'](_0x535a7f)['json'](_0x3261b2);}};}function respondWithFilteredResult(_0x1b36d9,_0x358bf6){return function(_0x1a3d04){if(_0x1a3d04){var _0x448ddc=typeof _0x358bf6[_0xac57('0x19')]===_0xac57('0x1a')&&typeof _0x358bf6[_0xac57('0x1b')]===_0xac57('0x1a');var _0x1c1395=_0x1a3d04[_0xac57('0x1c')];var _0x42d350=_0x448ddc?0x0:_0x358bf6[_0xac57('0x19')];var _0x5d10eb=_0x448ddc?_0x1a3d04[_0xac57('0x1c')]:_0x358bf6[_0xac57('0x19')]+_0x358bf6[_0xac57('0x1b')];var _0x31554b;if(_0x5d10eb>=_0x1c1395){_0x5d10eb=_0x1c1395;_0x31554b=0xc8;}else{_0x31554b=0xce;}_0x1b36d9[_0xac57('0x17')](_0x31554b);return _0x1b36d9[_0xac57('0x1d')](_0xac57('0x1e'),_0x42d350+'-'+_0x5d10eb+'/'+_0x1c1395)[_0xac57('0x1f')](_0x1a3d04);}return null;};}function patchUpdates(_0x3d0da0){return function(_0x1b78b0){try{jsonpatch[_0xac57('0x20')](_0x1b78b0,_0x3d0da0,!![]);}catch(_0x3847b5){return BPromise[_0xac57('0x21')](_0x3847b5);}return _0x1b78b0[_0xac57('0x22')]();};}function saveUpdates(_0x330f87,_0x168273){return function(_0x1e10b4){if(_0x1e10b4){return _0x1e10b4[_0xac57('0x23')](_0x330f87)['then'](function(_0x533df2){return _0x533df2;});}return null;};}function removeEntity(_0x288d8a,_0x282dde){return function(_0x1a2a08){if(_0x1a2a08){return _0x1a2a08[_0xac57('0x24')]()[_0xac57('0x25')](function(){_0x288d8a[_0xac57('0x17')](0xcc)[_0xac57('0x18')]();});}};}function handleEntityNotFound(_0x4f2db3,_0x21eaea){return function(_0x52db9b){if(!_0x52db9b){_0x4f2db3[_0xac57('0x26')](0x194);}return _0x52db9b;};}function handleError(_0x46e3a0,_0x5acdce){_0x5acdce=_0x5acdce||0x1f4;return function(_0x259272){logger[_0xac57('0x27')](_0x259272[_0xac57('0x28')]);if(_0x259272[_0xac57('0x29')]){delete _0x259272[_0xac57('0x29')];}_0x46e3a0[_0xac57('0x17')](_0x5acdce)[_0xac57('0x2a')](_0x259272);};}exports[_0xac57('0x2b')]=function(_0x1e3056,_0x4a0854){var _0x1a8d7d={},_0x2998f9={},_0x3c74b1={'count':0x0,'rows':[]};var _0x1d29c5=_[_0xac57('0x2c')](db[_0xac57('0x2d')][_0xac57('0x2e')],function(_0xe5c720){return{'name':_0xe5c720[_0xac57('0x2f')],'type':_0xe5c720[_0xac57('0x30')][_0xac57('0x31')]};});_0x2998f9[_0xac57('0x32')]=_[_0xac57('0x2c')](_0x1d29c5,_0xac57('0x29'));_0x2998f9['query']=_[_0xac57('0x33')](_0x1e3056[_0xac57('0x34')]);_0x2998f9['filters']=_[_0xac57('0x35')](_0x2998f9[_0xac57('0x32')],_0x2998f9[_0xac57('0x34')]);_0x1a8d7d[_0xac57('0x36')]=_[_0xac57('0x35')](_0x2998f9[_0xac57('0x32')],qs[_0xac57('0x37')](_0x1e3056[_0xac57('0x34')][_0xac57('0x37')]));_0x1a8d7d[_0xac57('0x36')]=_0x1a8d7d[_0xac57('0x36')][_0xac57('0x38')]?_0x1a8d7d['attributes']:_0x2998f9[_0xac57('0x32')];if(!_0x1e3056[_0xac57('0x34')]['hasOwnProperty'](_0xac57('0x39'))){_0x1a8d7d[_0xac57('0x1b')]=qs['limit'](_0x1e3056[_0xac57('0x34')][_0xac57('0x1b')]);_0x1a8d7d[_0xac57('0x19')]=qs[_0xac57('0x19')](_0x1e3056[_0xac57('0x34')]['offset']);}_0x1a8d7d[_0xac57('0x3a')]=qs['sort'](_0x1e3056[_0xac57('0x34')]['sort']);_0x1a8d7d[_0xac57('0x3b')]=qs['filters'](_[_0xac57('0x3c')](_0x1e3056['query'],_0x2998f9[_0xac57('0x3d')]),_0x1d29c5);if(_0x1e3056['query'][_0xac57('0x3e')]){_0x1a8d7d['where']=_['merge'](_0x1a8d7d[_0xac57('0x3b')],{'$or':_[_0xac57('0x2c')](_0x1d29c5,function(_0x30b880){if(_0x30b880[_0xac57('0x30')]!==_0xac57('0x3f')){var _0x5556c7={};_0x5556c7[_0x30b880[_0xac57('0x29')]]={'$like':'%'+_0x1e3056['query']['filter']+'%'};return _0x5556c7;}})});}_0x1a8d7d=_[_0xac57('0x40')]({},_0x1a8d7d,_0x1e3056[_0xac57('0x41')]);var _0x1a948f={'where':_0x1a8d7d['where']};return db[_0xac57('0x2d')]['count'](_0x1a948f)[_0xac57('0x25')](function(_0x278de3){_0x3c74b1['count']=_0x278de3;if(_0x1e3056[_0xac57('0x34')][_0xac57('0x42')]){_0x1a8d7d[_0xac57('0x43')]=[{'all':!![]}];}return db[_0xac57('0x2d')][_0xac57('0x44')](_0x1a8d7d);})[_0xac57('0x25')](function(_0x5e7b68){_0x3c74b1['rows']=_0x5e7b68;return _0x3c74b1;})[_0xac57('0x25')](respondWithFilteredResult(_0x4a0854,_0x1a8d7d))[_0xac57('0x45')](handleError(_0x4a0854,null));};exports[_0xac57('0x46')]=function(_0x4ba9fa,_0x370be0){var _0x93d49c={'raw':!![],'where':{'id':_0x4ba9fa[_0xac57('0x47')]['id']}},_0x5e2a60={};_0x5e2a60[_0xac57('0x32')]=_[_0xac57('0x33')](db[_0xac57('0x2d')][_0xac57('0x2e')]);_0x5e2a60[_0xac57('0x34')]=_[_0xac57('0x33')](_0x4ba9fa[_0xac57('0x34')]);_0x5e2a60[_0xac57('0x3d')]=_[_0xac57('0x35')](_0x5e2a60[_0xac57('0x32')],_0x5e2a60['query']);_0x93d49c[_0xac57('0x36')]=_[_0xac57('0x35')](_0x5e2a60[_0xac57('0x32')],qs['fields'](_0x4ba9fa[_0xac57('0x34')][_0xac57('0x37')]));_0x93d49c['attributes']=_0x93d49c['attributes'][_0xac57('0x38')]?_0x93d49c[_0xac57('0x36')]:_0x5e2a60['model'];if(_0x4ba9fa['query'][_0xac57('0x42')]){_0x93d49c[_0xac57('0x43')]=[{'all':!![]}];}_0x93d49c=_['merge']({},_0x93d49c,_0x4ba9fa[_0xac57('0x41')]);return db[_0xac57('0x2d')][_0xac57('0x48')](_0x93d49c)[_0xac57('0x25')](handleEntityNotFound(_0x370be0,null))[_0xac57('0x25')](respondWithResult(_0x370be0,null))[_0xac57('0x45')](handleError(_0x370be0,null));};exports[_0xac57('0x49')]=function(_0x3fd2e3,_0x9a8597){return db[_0xac57('0x2d')][_0xac57('0x49')](_0x3fd2e3[_0xac57('0x4a')],{})[_0xac57('0x25')](respondWithResult(_0x9a8597,0xc9))[_0xac57('0x45')](handleError(_0x9a8597,null));};exports[_0xac57('0x23')]=function(_0x2795d4,_0x3e1024){if(_0x2795d4[_0xac57('0x4a')]['id']){delete _0x2795d4[_0xac57('0x4a')]['id'];}return db[_0xac57('0x2d')][_0xac57('0x48')]({'where':{'id':_0x2795d4[_0xac57('0x47')]['id']}})[_0xac57('0x25')](handleEntityNotFound(_0x3e1024,null))[_0xac57('0x25')](saveUpdates(_0x2795d4[_0xac57('0x4a')],null))['then'](respondWithResult(_0x3e1024,null))[_0xac57('0x45')](handleError(_0x3e1024,null));};exports['destroy']=function(_0x3ef064,_0x3affda){return db[_0xac57('0x2d')][_0xac57('0x48')]({'where':{'id':_0x3ef064[_0xac57('0x47')]['id']}})['then'](handleEntityNotFound(_0x3affda,null))[_0xac57('0x25')](removeEntity(_0x3affda,null))['catch'](handleError(_0x3affda,null));}; \ No newline at end of file +var _0x1b59=['desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','merge','where','VIRTUAL','options','findAll','catch','params','includeAll','include','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x51c4f3,_0x1ce048){var _0x2d46be=function(_0x2f2163){while(--_0x2f2163){_0x51c4f3['push'](_0x51c4f3['shift']());}};_0x2d46be(++_0x1ce048);}(_0x1b59,0x19b));var _0x91b5=function(_0x2d1451,_0x5c5cf9){_0x2d1451=_0x2d1451-0x0;var _0x231908=_0x1b59[_0x2d1451];return _0x231908;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x91b5('0x0'));var zipdir=require(_0x91b5('0x1'));var jsonpatch=require(_0x91b5('0x2'));var rp=require(_0x91b5('0x3'));var moment=require(_0x91b5('0x4'));var BPromise=require(_0x91b5('0x5'));var Mustache=require(_0x91b5('0x6'));var util=require(_0x91b5('0x7'));var path=require(_0x91b5('0x8'));var sox=require(_0x91b5('0x9'));var csv=require(_0x91b5('0xa'));var ejs=require(_0x91b5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91b5('0xc'));var squel=require('squel');var crypto=require(_0x91b5('0xd'));var jsforce=require(_0x91b5('0xe'));var deskjs=require(_0x91b5('0xf'));var toCsv=require(_0x91b5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91b5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x91b5('0x11'));var hardwareService=require(_0x91b5('0x12'));var logger=require(_0x91b5('0x13'))(_0x91b5('0x14'));var utils=require(_0x91b5('0x15'));var config=require(_0x91b5('0x16'));var licenseUtil=require(_0x91b5('0x17'));var db=require(_0x91b5('0x18'))['db'];function respondWithStatusCode(_0x27d150,_0x55bd5a){_0x55bd5a=_0x55bd5a||0xcc;return function(_0x5baea6){if(_0x5baea6){return _0x27d150[_0x91b5('0x19')](_0x55bd5a);}return _0x27d150[_0x91b5('0x1a')](_0x55bd5a)[_0x91b5('0x1b')]();};}function respondWithResult(_0x4a2600,_0x3aa417){_0x3aa417=_0x3aa417||0xc8;return function(_0xb3e1da){if(_0xb3e1da){return _0x4a2600[_0x91b5('0x1a')](_0x3aa417)[_0x91b5('0x1c')](_0xb3e1da);}};}function respondWithFilteredResult(_0x13854c,_0x52e20a){return function(_0x52df06){if(_0x52df06){var _0x376991=typeof _0x52e20a[_0x91b5('0x1d')]==='undefined'&&typeof _0x52e20a['limit']===_0x91b5('0x1e');var _0x51b79a=_0x52df06[_0x91b5('0x1f')];var _0x58583e=_0x376991?0x0:_0x52e20a[_0x91b5('0x1d')];var _0x14fee0=_0x376991?_0x52df06[_0x91b5('0x1f')]:_0x52e20a[_0x91b5('0x1d')]+_0x52e20a[_0x91b5('0x20')];var _0xd03d0;if(_0x14fee0>=_0x51b79a){_0x14fee0=_0x51b79a;_0xd03d0=0xc8;}else{_0xd03d0=0xce;}_0x13854c[_0x91b5('0x1a')](_0xd03d0);return _0x13854c[_0x91b5('0x21')]('Content-Range',_0x58583e+'-'+_0x14fee0+'/'+_0x51b79a)[_0x91b5('0x1c')](_0x52df06);}return null;};}function patchUpdates(_0x1e9520){return function(_0xff2010){try{jsonpatch[_0x91b5('0x22')](_0xff2010,_0x1e9520,!![]);}catch(_0x218129){return BPromise[_0x91b5('0x23')](_0x218129);}return _0xff2010[_0x91b5('0x24')]();};}function saveUpdates(_0x378919,_0x3c32e3){return function(_0xc9f16){if(_0xc9f16){return _0xc9f16['update'](_0x378919)[_0x91b5('0x25')](function(_0x5b1058){return _0x5b1058;});}return null;};}function removeEntity(_0x42f0b0,_0x5c1a08){return function(_0x2bfe0d){if(_0x2bfe0d){return _0x2bfe0d['destroy']()[_0x91b5('0x25')](function(){_0x42f0b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52230f,_0x14fcb8){return function(_0x17c885){if(!_0x17c885){_0x52230f[_0x91b5('0x19')](0x194);}return _0x17c885;};}function handleError(_0x2fc599,_0x5f0171){_0x5f0171=_0x5f0171||0x1f4;return function(_0x3ee54c){logger[_0x91b5('0x26')](_0x3ee54c['stack']);if(_0x3ee54c[_0x91b5('0x27')]){delete _0x3ee54c[_0x91b5('0x27')];}_0x2fc599[_0x91b5('0x1a')](_0x5f0171)[_0x91b5('0x28')](_0x3ee54c);};}exports['index']=function(_0x60c7b7,_0x586f70){var _0x570a0c={},_0x52b865={},_0x5a345d={'count':0x0,'rows':[]};var _0x555990=_[_0x91b5('0x29')](db[_0x91b5('0x2a')][_0x91b5('0x2b')],function(_0x16e28e){return{'name':_0x16e28e[_0x91b5('0x2c')],'type':_0x16e28e[_0x91b5('0x2d')][_0x91b5('0x2e')]};});_0x52b865[_0x91b5('0x2f')]=_['map'](_0x555990,'name');_0x52b865[_0x91b5('0x30')]=_[_0x91b5('0x31')](_0x60c7b7[_0x91b5('0x30')]);_0x52b865[_0x91b5('0x32')]=_[_0x91b5('0x33')](_0x52b865[_0x91b5('0x2f')],_0x52b865[_0x91b5('0x30')]);_0x570a0c['attributes']=_[_0x91b5('0x33')](_0x52b865[_0x91b5('0x2f')],qs['fields'](_0x60c7b7[_0x91b5('0x30')][_0x91b5('0x34')]));_0x570a0c[_0x91b5('0x35')]=_0x570a0c[_0x91b5('0x35')][_0x91b5('0x36')]?_0x570a0c[_0x91b5('0x35')]:_0x52b865[_0x91b5('0x2f')];if(!_0x60c7b7[_0x91b5('0x30')]['hasOwnProperty'](_0x91b5('0x37'))){_0x570a0c[_0x91b5('0x20')]=qs[_0x91b5('0x20')](_0x60c7b7[_0x91b5('0x30')][_0x91b5('0x20')]);_0x570a0c[_0x91b5('0x1d')]=qs[_0x91b5('0x1d')](_0x60c7b7['query'][_0x91b5('0x1d')]);}_0x570a0c['order']=qs['sort'](_0x60c7b7[_0x91b5('0x30')][_0x91b5('0x38')]);_0x570a0c['where']=qs[_0x91b5('0x32')](_['pick'](_0x60c7b7[_0x91b5('0x30')],_0x52b865[_0x91b5('0x32')]),_0x555990);if(_0x60c7b7['query']['filter']){_0x570a0c['where']=_[_0x91b5('0x39')](_0x570a0c[_0x91b5('0x3a')],{'$or':_[_0x91b5('0x29')](_0x555990,function(_0xbe9751){if(_0xbe9751['type']!==_0x91b5('0x3b')){var _0x3f9b63={};_0x3f9b63[_0xbe9751[_0x91b5('0x27')]]={'$like':'%'+_0x60c7b7[_0x91b5('0x30')]['filter']+'%'};return _0x3f9b63;}})});}_0x570a0c=_[_0x91b5('0x39')]({},_0x570a0c,_0x60c7b7[_0x91b5('0x3c')]);var _0x4f8808={'where':_0x570a0c[_0x91b5('0x3a')]};return db[_0x91b5('0x2a')][_0x91b5('0x1f')](_0x4f8808)[_0x91b5('0x25')](function(_0x2036f0){_0x5a345d[_0x91b5('0x1f')]=_0x2036f0;if(_0x60c7b7['query']['includeAll']){_0x570a0c['include']=[{'all':!![]}];}return db[_0x91b5('0x2a')][_0x91b5('0x3d')](_0x570a0c);})[_0x91b5('0x25')](function(_0x4070cb){_0x5a345d['rows']=_0x4070cb;return _0x5a345d;})[_0x91b5('0x25')](respondWithFilteredResult(_0x586f70,_0x570a0c))[_0x91b5('0x3e')](handleError(_0x586f70,null));};exports['show']=function(_0x9bd416,_0x368a4c){var _0x59da37={'raw':!![],'where':{'id':_0x9bd416[_0x91b5('0x3f')]['id']}},_0x4c8ccb={};_0x4c8ccb[_0x91b5('0x2f')]=_[_0x91b5('0x31')](db['SugarcrmField'][_0x91b5('0x2b')]);_0x4c8ccb[_0x91b5('0x30')]=_[_0x91b5('0x31')](_0x9bd416[_0x91b5('0x30')]);_0x4c8ccb['filters']=_[_0x91b5('0x33')](_0x4c8ccb['model'],_0x4c8ccb[_0x91b5('0x30')]);_0x59da37[_0x91b5('0x35')]=_['intersection'](_0x4c8ccb[_0x91b5('0x2f')],qs['fields'](_0x9bd416[_0x91b5('0x30')][_0x91b5('0x34')]));_0x59da37[_0x91b5('0x35')]=_0x59da37['attributes'][_0x91b5('0x36')]?_0x59da37['attributes']:_0x4c8ccb[_0x91b5('0x2f')];if(_0x9bd416['query'][_0x91b5('0x40')]){_0x59da37[_0x91b5('0x41')]=[{'all':!![]}];}_0x59da37=_[_0x91b5('0x39')]({},_0x59da37,_0x9bd416[_0x91b5('0x3c')]);return db['SugarcrmField'][_0x91b5('0x42')](_0x59da37)['then'](handleEntityNotFound(_0x368a4c,null))['then'](respondWithResult(_0x368a4c,null))[_0x91b5('0x3e')](handleError(_0x368a4c,null));};exports[_0x91b5('0x43')]=function(_0x1b2353,_0x247ea7){return db['SugarcrmField']['create'](_0x1b2353[_0x91b5('0x44')],{})['then'](respondWithResult(_0x247ea7,0xc9))[_0x91b5('0x3e')](handleError(_0x247ea7,null));};exports[_0x91b5('0x45')]=function(_0x473ae3,_0x574131){if(_0x473ae3['body']['id']){delete _0x473ae3[_0x91b5('0x44')]['id'];}return db['SugarcrmField'][_0x91b5('0x42')]({'where':{'id':_0x473ae3['params']['id']}})[_0x91b5('0x25')](handleEntityNotFound(_0x574131,null))[_0x91b5('0x25')](saveUpdates(_0x473ae3[_0x91b5('0x44')],null))['then'](respondWithResult(_0x574131,null))[_0x91b5('0x3e')](handleError(_0x574131,null));};exports[_0x91b5('0x46')]=function(_0x81906c,_0x4dc3e7){return db[_0x91b5('0x2a')][_0x91b5('0x42')]({'where':{'id':_0x81906c[_0x91b5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4dc3e7,null))[_0x91b5('0x25')](removeEntity(_0x4dc3e7,null))[_0x91b5('0x3e')](handleError(_0x4dc3e7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 89ef622..3064dd3 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 _0x1429=['exports','SugarcrmField','sugarcrm_unique_index','lodash','api','bluebird','rimraf','./intSugarcrmField.attributes'];(function(_0x48c7c8,_0x4e5788){var _0x109389=function(_0x2cf519){while(--_0x2cf519){_0x48c7c8['push'](_0x48c7c8['shift']());}};_0x109389(++_0x4e5788);}(_0x1429,0xcb));var _0x9142=function(_0x3122e4,_0x245f66){_0x3122e4=_0x3122e4-0x0;var _0x66e755=_0x1429[_0x3122e4];return _0x66e755;};'use strict';var _=require(_0x9142('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9142('0x1'));var moment=require('moment');var BPromise=require(_0x9142('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9142('0x3'));var config=require('../../config/environment');var attributes=require(_0x9142('0x4'));module[_0x9142('0x5')]=function(_0x567a69,_0x2f9f80){return _0x567a69['define'](_0x9142('0x6'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x9142('0x7'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e65=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmField','idField','util'];(function(_0x2cac2e,_0x59d4c3){var _0x19ffe8=function(_0x5c52b1){while(--_0x5c52b1){_0x2cac2e['push'](_0x2cac2e['shift']());}};_0x19ffe8(++_0x59d4c3);}(_0x5e65,0xf1));var _0x55e6=function(_0x4dd4cc,_0x1c0a8f){_0x4dd4cc=_0x4dd4cc-0x0;var _0x3fe24a=_0x5e65[_0x4dd4cc];return _0x3fe24a;};'use strict';var _=require('lodash');var util=require(_0x55e6('0x0'));var logger=require(_0x55e6('0x1'))('api');var moment=require(_0x55e6('0x2'));var BPromise=require(_0x55e6('0x3'));var rp=require(_0x55e6('0x4'));var fs=require('fs');var path=require(_0x55e6('0x5'));var rimraf=require(_0x55e6('0x6'));var config=require(_0x55e6('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x55e6('0x8')]=function(_0x3f23e,_0xbef612){return _0x3f23e['define'](_0x55e6('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x55e6('0xa'),'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 0353bc8..1108cef 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 _0xfc40=['http','request','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0xfc40,0xc9));var _0x0fc4=function(_0x4cd0ed,_0x4cbd74){_0x4cd0ed=_0x4cd0ed-0x0;var _0x3cce45=_0xfc40[_0x4cd0ed];return _0x3cce45;};'use strict';var _=require(_0x0fc4('0x0'));var util=require(_0x0fc4('0x1'));var moment=require(_0x0fc4('0x2'));var BPromise=require(_0x0fc4('0x3'));var rs=require(_0x0fc4('0x4'));var fs=require('fs');var Redis=require(_0x0fc4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fc4('0x6'));var logger=require(_0x0fc4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fc4('0x8')][_0x0fc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43dcbc,_0x2630f6,_0x16ce94){return new BPromise(function(_0x392437,_0x34095f){return client[_0x0fc4('0xa')](_0x43dcbc,_0x16ce94)['then'](function(_0x52bf9e){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2630f6,_0x0fc4('0xb'));logger[_0x0fc4('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2630f6,'request\x20sent',JSON[_0x0fc4('0xd')](_0x52bf9e));if(_0x52bf9e[_0x0fc4('0xe')]){if(_0x52bf9e['error'][_0x0fc4('0xf')]===0x1f4){logger['error'](_0x0fc4('0x10'),_0x2630f6,_0x52bf9e[_0x0fc4('0xe')][_0x0fc4('0x11')]);return _0x34095f(_0x52bf9e[_0x0fc4('0xe')][_0x0fc4('0x11')]);}logger[_0x0fc4('0xe')](_0x0fc4('0x10'),_0x2630f6,_0x52bf9e[_0x0fc4('0xe')][_0x0fc4('0x11')]);return _0x392437(_0x52bf9e['error'][_0x0fc4('0x11')]);}else{logger[_0x0fc4('0x12')](_0x0fc4('0x10'),_0x2630f6,_0x0fc4('0xb'));_0x392437(_0x52bf9e[_0x0fc4('0x13')]['message']);}})[_0x0fc4('0x14')](function(_0x47efb3){logger[_0x0fc4('0xe')](_0x0fc4('0x10'),_0x2630f6,_0x47efb3);_0x34095f(_0x47efb3);});});} \ No newline at end of file +var _0xf437=['SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2db267,_0x26998e){var _0x3ee03a=function(_0xe6001d){while(--_0xe6001d){_0x2db267['push'](_0x2db267['shift']());}};_0x3ee03a(++_0x26998e);}(_0xf437,0x129));var _0x7f43=function(_0x205e56,_0x366e77){_0x205e56=_0x205e56-0x0;var _0x489d5d=_0xf437[_0x205e56];return _0x489d5d;};'use strict';var _=require(_0x7f43('0x0'));var util=require(_0x7f43('0x1'));var moment=require('moment');var BPromise=require(_0x7f43('0x2'));var rs=require(_0x7f43('0x3'));var fs=require('fs');var Redis=require(_0x7f43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f43('0x5'));var logger=require(_0x7f43('0x6'))(_0x7f43('0x7'));var config=require(_0x7f43('0x8'));var jayson=require(_0x7f43('0x9'));var client=jayson[_0x7f43('0xa')][_0x7f43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x201a55,_0x1eb8f2,_0xdfd238){return new BPromise(function(_0x56dfa9,_0x9c6743){return client[_0x7f43('0xc')](_0x201a55,_0xdfd238)[_0x7f43('0xd')](function(_0x212d03){logger[_0x7f43('0xe')](_0x7f43('0xf'),_0x1eb8f2,'request\x20sent');logger[_0x7f43('0x10')](_0x7f43('0x11'),_0x1eb8f2,'request\x20sent',JSON[_0x7f43('0x12')](_0x212d03));if(_0x212d03[_0x7f43('0x13')]){if(_0x212d03[_0x7f43('0x13')][_0x7f43('0x14')]===0x1f4){logger[_0x7f43('0x13')](_0x7f43('0xf'),_0x1eb8f2,_0x212d03[_0x7f43('0x13')]['message']);return _0x9c6743(_0x212d03[_0x7f43('0x13')][_0x7f43('0x15')]);}logger[_0x7f43('0x13')](_0x7f43('0xf'),_0x1eb8f2,_0x212d03['error'][_0x7f43('0x15')]);return _0x56dfa9(_0x212d03[_0x7f43('0x13')][_0x7f43('0x15')]);}else{logger[_0x7f43('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x1eb8f2,_0x7f43('0x16'));_0x56dfa9(_0x212d03['result'][_0x7f43('0x15')]);}})[_0x7f43('0x17')](function(_0x295bee){logger[_0x7f43('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1eb8f2,_0x295bee);_0x9c6743(_0x295bee);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index adcde23..4f4b83a 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 _0x4ef1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0xe64a80,_0xfbbc4f){var _0x1d781d=function(_0x3697bc){while(--_0x3697bc){_0xe64a80['push'](_0xe64a80['shift']());}};_0x1d781d(++_0xfbbc4f);}(_0x4ef1,0xeb));var _0x14ef=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x4ef1[_0x1030ce];return _0x3367fd;};'use strict';var multer=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var path=require('path');var timeout=require(_0x14ef('0x2'));var express=require(_0x14ef('0x3'));var router=express[_0x14ef('0x4')]();var fs_extra=require(_0x14ef('0x5'));var auth=require(_0x14ef('0x6'));var interaction=require(_0x14ef('0x7'));var config=require(_0x14ef('0x8'));var controller=require(_0x14ef('0x9'));router[_0x14ef('0xa')]('/',auth[_0x14ef('0xb')](),controller['index']);router[_0x14ef('0xa')](_0x14ef('0xc'),auth['isAuthenticated'](),controller[_0x14ef('0xd')]);router[_0x14ef('0xa')](_0x14ef('0xe'),auth[_0x14ef('0xb')](),controller[_0x14ef('0xf')]);router['get'](_0x14ef('0x10'),auth['isAuthenticated'](),controller[_0x14ef('0x11')]);router[_0x14ef('0x12')]('/',auth[_0x14ef('0xb')](),controller[_0x14ef('0x13')]);router['post']('/:id/configurations',auth[_0x14ef('0xb')](),controller[_0x14ef('0x14')]);router['put'](_0x14ef('0xc'),auth[_0x14ef('0xb')](),controller[_0x14ef('0x15')]);router['delete'](_0x14ef('0xc'),auth[_0x14ef('0xb')](),controller[_0x14ef('0x16')]);module[_0x14ef('0x17')]=router; \ No newline at end of file +var _0x207c=['addConfiguration','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post'];(function(_0x4a82ed,_0x5a6aeb){var _0x528635=function(_0x4d75eb){while(--_0x4d75eb){_0x4a82ed['push'](_0x4a82ed['shift']());}};_0x528635(++_0x5a6aeb);}(_0x207c,0x1e8));var _0xc207=function(_0x3c0cd6,_0x5ba428){_0x3c0cd6=_0x3c0cd6-0x0;var _0x4381ec=_0x207c[_0x3c0cd6];return _0x4381ec;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0x9')](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0xd')]);router[_0xc207('0x9')](_0xc207('0xe'),auth[_0xc207('0xf')](),controller[_0xc207('0x10')]);router[_0xc207('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0x12')]);router[_0xc207('0x13')]('/:id',auth[_0xc207('0xf')](),controller[_0xc207('0x14')]);router[_0xc207('0x15')](_0xc207('0xa'),auth[_0xc207('0xf')](),controller['destroy']);module[_0xc207('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cfbd5e1..196dbba 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 _0x3c18=['STRING','sequelize','exports'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x3c18,0x136));var _0x83c1=function(_0x51970f,_0x5d6ba0){_0x51970f=_0x51970f-0x0;var _0x53364f=_0x3c18[_0x51970f];return _0x53364f;};'use strict';var Sequelize=require(_0x83c1('0x0'));module[_0x83c1('0x1')]={'name':{'type':Sequelize[_0x83c1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x83c1('0x2')]},'username':{'type':Sequelize[_0x83c1('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x83c1('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x83c1('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x83c1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb134=['sequelize','STRING','HelpDesk'];(function(_0x47f5e8,_0x3e460d){var _0x482ae7=function(_0x5c41e4){while(--_0x5c41e4){_0x47f5e8['push'](_0x47f5e8['shift']());}};_0x482ae7(++_0x3e460d);}(_0xb134,0x126));var _0x4b13=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xb134[_0x4bc4c8];return _0x3bb121;};'use strict';var Sequelize=require(_0x4b13('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4b13('0x1')]},'username':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![],'defaultValue':_0x4b13('0x2')},'remoteUri':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4b13('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c09ae0e..fbea171 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 _0x8cfb=['false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','count','Content-Range','json','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','limit','filter','where','VIRTUAL','merge','then','includeAll','include','findAll','catch','rawAttributes','options','find','update','body','params','getConfigurations','VtigerConfiguration','order','sort','pick','nolimit','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','autogenerated','reference','owner','remove','includes','editable'];(function(_0x58d5c3,_0x15c603){var _0x429aa6=function(_0x3e56ed){while(--_0x3e56ed){_0x58d5c3['push'](_0x58d5c3['shift']());}};_0x429aa6(++_0x15c603);}(_0x8cfb,0x17b));var _0xb8cf=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x8cfb[_0x5dfc2a];return _0x3f1a71;};'use strict';var emlformat=require(_0xb8cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8cf('0x1'));var jsonpatch=require(_0xb8cf('0x2'));var rp=require(_0xb8cf('0x3'));var moment=require('moment');var BPromise=require(_0xb8cf('0x4'));var Mustache=require('mustache');var util=require(_0xb8cf('0x5'));var path=require(_0xb8cf('0x6'));var sox=require(_0xb8cf('0x7'));var csv=require(_0xb8cf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8cf('0x9'));var squel=require(_0xb8cf('0xa'));var crypto=require(_0xb8cf('0xb'));var jsforce=require(_0xb8cf('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb8cf('0x8'));var querystring=require(_0xb8cf('0xd'));var Papa=require('papaparse');var Redis=require(_0xb8cf('0xe'));var authService=require(_0xb8cf('0xf'));var qs=require(_0xb8cf('0x10'));var as=require(_0xb8cf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8cf('0x12'))(_0xb8cf('0x13'));var utils=require(_0xb8cf('0x14'));var config=require(_0xb8cf('0x15'));var licenseUtil=require(_0xb8cf('0x16'));var db=require(_0xb8cf('0x17'))['db'];var integrations=require(_0xb8cf('0x18'));function respondWithStatusCode(_0x470977,_0x523a8b){_0x523a8b=_0x523a8b||0xcc;return function(_0x19cee5){if(_0x19cee5){return _0x470977['sendStatus'](_0x523a8b);}return _0x470977['status'](_0x523a8b)[_0xb8cf('0x19')]();};}function respondWithResult(_0x485b5b,_0x38203c){_0x38203c=_0x38203c||0xc8;return function(_0x1d05c9){if(_0x1d05c9){return _0x485b5b[_0xb8cf('0x1a')](_0x38203c)['json'](_0x1d05c9);}};}function respondWithFilteredResult(_0x36e0b1,_0x5cfda7){return function(_0x3f0b3f){if(_0x3f0b3f){var _0x13c81c=typeof _0x5cfda7[_0xb8cf('0x1b')]==='undefined'&&typeof _0x5cfda7['limit']===_0xb8cf('0x1c');var _0x444573=_0x3f0b3f['count'];var _0x135056=_0x13c81c?0x0:_0x5cfda7['offset'];var _0x58635a=_0x13c81c?_0x3f0b3f[_0xb8cf('0x1d')]:_0x5cfda7[_0xb8cf('0x1b')]+_0x5cfda7['limit'];var _0x255fa6;if(_0x58635a>=_0x444573){_0x58635a=_0x444573;_0x255fa6=0xc8;}else{_0x255fa6=0xce;}_0x36e0b1['status'](_0x255fa6);return _0x36e0b1['set'](_0xb8cf('0x1e'),_0x135056+'-'+_0x58635a+'/'+_0x444573)[_0xb8cf('0x1f')](_0x3f0b3f);}return null;};}function patchUpdates(_0x17fcd7){return function(_0x5733b6){try{jsonpatch[_0xb8cf('0x20')](_0x5733b6,_0x17fcd7,!![]);}catch(_0x5901d0){return BPromise[_0xb8cf('0x21')](_0x5901d0);}return _0x5733b6[_0xb8cf('0x22')]();};}function saveUpdates(_0x8b7430,_0x4a6d5f){return function(_0x2de275){if(_0x2de275){return _0x2de275['update'](_0x8b7430)['then'](function(_0x55fddc){return _0x55fddc;});}return null;};}function removeEntity(_0x23b7b4,_0x59dabc){return function(_0x3a4ae8){if(_0x3a4ae8){return _0x3a4ae8[_0xb8cf('0x23')]()['then'](function(){_0x23b7b4['status'](0xcc)[_0xb8cf('0x19')]();});}};}function handleEntityNotFound(_0x238bec,_0x34b573){return function(_0x48c45e){if(!_0x48c45e){_0x238bec[_0xb8cf('0x24')](0x194);}return _0x48c45e;};}function handleError(_0x417a80,_0x4f8757){_0x4f8757=_0x4f8757||0x1f4;return function(_0x13a292){logger[_0xb8cf('0x25')](_0x13a292[_0xb8cf('0x26')]);if(_0x13a292['name']){delete _0x13a292[_0xb8cf('0x27')];}_0x417a80[_0xb8cf('0x1a')](_0x4f8757)[_0xb8cf('0x28')](_0x13a292);};}exports[_0xb8cf('0x29')]=function(_0x3056d7,_0x1b5486){var _0x5ee303={},_0x53c8b7={},_0x38626c={'count':0x0,'rows':[]};var _0x301da5=_[_0xb8cf('0x2a')](db[_0xb8cf('0x2b')]['rawAttributes'],function(_0x5f05ab){return{'name':_0x5f05ab[_0xb8cf('0x2c')],'type':_0x5f05ab[_0xb8cf('0x2d')][_0xb8cf('0x2e')]};});_0x53c8b7['model']=_[_0xb8cf('0x2a')](_0x301da5,_0xb8cf('0x27'));_0x53c8b7[_0xb8cf('0x2f')]=_[_0xb8cf('0x30')](_0x3056d7[_0xb8cf('0x2f')]);_0x53c8b7[_0xb8cf('0x31')]=_[_0xb8cf('0x32')](_0x53c8b7[_0xb8cf('0x33')],_0x53c8b7['query']);_0x5ee303['attributes']=_['intersection'](_0x53c8b7[_0xb8cf('0x33')],qs['fields'](_0x3056d7[_0xb8cf('0x2f')][_0xb8cf('0x34')]));_0x5ee303[_0xb8cf('0x35')]=_0x5ee303[_0xb8cf('0x35')][_0xb8cf('0x36')]?_0x5ee303[_0xb8cf('0x35')]:_0x53c8b7[_0xb8cf('0x33')];if(!_0x3056d7['query']['hasOwnProperty']('nolimit')){_0x5ee303[_0xb8cf('0x37')]=qs['limit'](_0x3056d7[_0xb8cf('0x2f')][_0xb8cf('0x37')]);_0x5ee303['offset']=qs[_0xb8cf('0x1b')](_0x3056d7[_0xb8cf('0x2f')]['offset']);}_0x5ee303['order']=qs['sort'](_0x3056d7['query']['sort']);_0x5ee303['where']=qs[_0xb8cf('0x31')](_['pick'](_0x3056d7[_0xb8cf('0x2f')],_0x53c8b7[_0xb8cf('0x31')]),_0x301da5);if(_0x3056d7[_0xb8cf('0x2f')][_0xb8cf('0x38')]){_0x5ee303['where']=_['merge'](_0x5ee303[_0xb8cf('0x39')],{'$or':_[_0xb8cf('0x2a')](_0x301da5,function(_0x37a7bf){if(_0x37a7bf[_0xb8cf('0x2d')]!==_0xb8cf('0x3a')){var _0x4fc04b={};_0x4fc04b[_0x37a7bf[_0xb8cf('0x27')]]={'$like':'%'+_0x3056d7[_0xb8cf('0x2f')][_0xb8cf('0x38')]+'%'};return _0x4fc04b;}})});}_0x5ee303=_[_0xb8cf('0x3b')]({},_0x5ee303,_0x3056d7['options']);var _0x2e1b84={'where':_0x5ee303['where']};return db[_0xb8cf('0x2b')][_0xb8cf('0x1d')](_0x2e1b84)[_0xb8cf('0x3c')](function(_0xf18033){_0x38626c[_0xb8cf('0x1d')]=_0xf18033;if(_0x3056d7[_0xb8cf('0x2f')][_0xb8cf('0x3d')]){_0x5ee303[_0xb8cf('0x3e')]=[{'all':!![]}];}return db[_0xb8cf('0x2b')][_0xb8cf('0x3f')](_0x5ee303);})[_0xb8cf('0x3c')](function(_0x2c6e7c){_0x38626c['rows']=_0x2c6e7c;return _0x38626c;})[_0xb8cf('0x3c')](respondWithFilteredResult(_0x1b5486,_0x5ee303))[_0xb8cf('0x40')](handleError(_0x1b5486,null));};exports['show']=function(_0x5b9eb8,_0x525a06){var _0x3406b3={'raw':![],'where':{'id':_0x5b9eb8['params']['id']}},_0x2ed9a8={};_0x2ed9a8[_0xb8cf('0x33')]=_[_0xb8cf('0x30')](db[_0xb8cf('0x2b')][_0xb8cf('0x41')]);_0x2ed9a8[_0xb8cf('0x2f')]=_[_0xb8cf('0x30')](_0x5b9eb8[_0xb8cf('0x2f')]);_0x2ed9a8['filters']=_[_0xb8cf('0x32')](_0x2ed9a8['model'],_0x2ed9a8['query']);_0x3406b3[_0xb8cf('0x35')]=_[_0xb8cf('0x32')](_0x2ed9a8['model'],qs[_0xb8cf('0x34')](_0x5b9eb8[_0xb8cf('0x2f')][_0xb8cf('0x34')]));_0x3406b3[_0xb8cf('0x35')]=_0x3406b3[_0xb8cf('0x35')][_0xb8cf('0x36')]?_0x3406b3['attributes']:_0x2ed9a8[_0xb8cf('0x33')];if(_0x5b9eb8[_0xb8cf('0x2f')][_0xb8cf('0x3d')]){_0x3406b3[_0xb8cf('0x3e')]=[{'all':!![]}];}_0x3406b3=_['merge']({},_0x3406b3,_0x5b9eb8[_0xb8cf('0x42')]);return db[_0xb8cf('0x2b')][_0xb8cf('0x43')](_0x3406b3)[_0xb8cf('0x3c')](handleEntityNotFound(_0x525a06,null))[_0xb8cf('0x3c')](respondWithResult(_0x525a06,null))[_0xb8cf('0x40')](handleError(_0x525a06,null));};exports['create']=function(_0x548bba,_0x383c42){return db[_0xb8cf('0x2b')]['create'](_0x548bba['body'],{})[_0xb8cf('0x3c')](respondWithResult(_0x383c42,0xc9))[_0xb8cf('0x40')](handleError(_0x383c42,null));};exports[_0xb8cf('0x44')]=function(_0x4bb641,_0x28cbb0){if(_0x4bb641[_0xb8cf('0x45')]['id']){delete _0x4bb641[_0xb8cf('0x45')]['id'];}return db[_0xb8cf('0x2b')][_0xb8cf('0x43')]({'where':{'id':_0x4bb641[_0xb8cf('0x46')]['id']}})[_0xb8cf('0x3c')](handleEntityNotFound(_0x28cbb0,null))['then'](saveUpdates(_0x4bb641[_0xb8cf('0x45')],null))[_0xb8cf('0x3c')](respondWithResult(_0x28cbb0,null))[_0xb8cf('0x40')](handleError(_0x28cbb0,null));};exports[_0xb8cf('0x23')]=function(_0x2e825f,_0x2642b4){return db['VtigerAccount'][_0xb8cf('0x43')]({'where':{'id':_0x2e825f[_0xb8cf('0x46')]['id']}})[_0xb8cf('0x3c')](handleEntityNotFound(_0x2642b4,null))[_0xb8cf('0x3c')](removeEntity(_0x2642b4,null))['catch'](handleError(_0x2642b4,null));};exports[_0xb8cf('0x47')]=function(_0x5850cd,_0x3552cb,_0x2c43e8){var _0x37bcf7={};var _0x10c435={};var _0x5ea581;var _0x4e735e;return db[_0xb8cf('0x2b')]['findOne']({'where':{'id':_0x5850cd[_0xb8cf('0x46')]['id']}})[_0xb8cf('0x3c')](handleEntityNotFound(_0x3552cb,null))[_0xb8cf('0x3c')](function(_0x359870){if(_0x359870){_0x5ea581=_0x359870;_0x10c435['model']=_[_0xb8cf('0x30')](db[_0xb8cf('0x48')][_0xb8cf('0x41')]);_0x10c435[_0xb8cf('0x2f')]=_[_0xb8cf('0x30')](_0x5850cd[_0xb8cf('0x2f')]);_0x10c435[_0xb8cf('0x31')]=_[_0xb8cf('0x32')](_0x10c435[_0xb8cf('0x33')],_0x10c435[_0xb8cf('0x2f')]);_0x37bcf7[_0xb8cf('0x35')]=_[_0xb8cf('0x32')](_0x10c435[_0xb8cf('0x33')],qs[_0xb8cf('0x34')](_0x5850cd[_0xb8cf('0x2f')][_0xb8cf('0x34')]));_0x37bcf7[_0xb8cf('0x35')]=_0x37bcf7[_0xb8cf('0x35')][_0xb8cf('0x36')]?_0x37bcf7[_0xb8cf('0x35')]:_0x10c435[_0xb8cf('0x33')];_0x37bcf7[_0xb8cf('0x49')]=qs[_0xb8cf('0x4a')](_0x5850cd[_0xb8cf('0x2f')]['sort']);_0x37bcf7[_0xb8cf('0x39')]=qs[_0xb8cf('0x31')](_[_0xb8cf('0x4b')](_0x5850cd[_0xb8cf('0x2f')],_0x10c435['filters']));if(_0x5850cd[_0xb8cf('0x2f')][_0xb8cf('0x38')]){_0x37bcf7[_0xb8cf('0x39')]=_[_0xb8cf('0x3b')](_0x37bcf7[_0xb8cf('0x39')],{'$or':_[_0xb8cf('0x2a')](_0x37bcf7[_0xb8cf('0x35')],function(_0x54533e){var _0x192597={};_0x192597[_0x54533e]={'$like':'%'+_0x5850cd['query']['filter']+'%'};return _0x192597;})});}_0x37bcf7=_[_0xb8cf('0x3b')]({},_0x37bcf7,_0x5850cd['options']);return _0x5ea581[_0xb8cf('0x47')](_0x37bcf7);}})[_0xb8cf('0x3c')](function(_0x2d1557){if(_0x2d1557){_0x4e735e=_0x2d1557[_0xb8cf('0x36')];if(!_0x5850cd['query']['hasOwnProperty'](_0xb8cf('0x4c'))){_0x37bcf7[_0xb8cf('0x37')]=qs['limit'](_0x5850cd['query'][_0xb8cf('0x37')]);_0x37bcf7['offset']=qs[_0xb8cf('0x1b')](_0x5850cd[_0xb8cf('0x2f')][_0xb8cf('0x1b')]);}return _0x5ea581[_0xb8cf('0x47')](_0x37bcf7);}})['then'](function(_0x98e669){if(_0x98e669){return _0x98e669?{'count':_0x4e735e,'rows':_0x98e669}:null;}})['then'](respondWithResult(_0x3552cb,null))['catch'](handleError(_0x3552cb,null));};exports[_0xb8cf('0x4d')]=function(_0x5cf6d4,_0x572251,_0x4eb20c){if(_0x5cf6d4[_0xb8cf('0x45')]['id']){delete _0x5cf6d4['body']['id'];}return db[_0xb8cf('0x2b')][_0xb8cf('0x4e')]({'where':{'id':_0x5cf6d4[_0xb8cf('0x46')]['id']}})[_0xb8cf('0x3c')](handleEntityNotFound(_0x572251,null))['then'](function(_0x1d1890){if(_0x1d1890){_0x5cf6d4[_0xb8cf('0x45')]['AccountId']=_0x1d1890['id'];_0x5cf6d4[_0xb8cf('0x45')][_0xb8cf('0x4f')]=integrations['getSubjects'](_0x5cf6d4['body'][_0xb8cf('0x50')],_0x5cf6d4[_0xb8cf('0x45')][_0xb8cf('0x2d')]);_0x5cf6d4[_0xb8cf('0x45')][_0xb8cf('0x51')]=integrations[_0xb8cf('0x52')](_0x5cf6d4[_0xb8cf('0x45')]['channel'],_0x5cf6d4[_0xb8cf('0x45')][_0xb8cf('0x2d')]);return db['VtigerConfiguration'][_0xb8cf('0x53')](_0x5cf6d4[_0xb8cf('0x45')],{'include':[{'model':db[_0xb8cf('0x54')],'as':_0xb8cf('0x4f')},{'model':db['VtigerField'],'as':_0xb8cf('0x51')}]});}return null;})['then'](respondWithResult(_0x572251,null))[_0xb8cf('0x40')](handleError(_0x572251,null));};var md5=require(_0xb8cf('0x55'));exports[_0xb8cf('0x56')]=function(_0x6e1015,_0x32de3f,_0xc2e43b){var _0x237af8=null;var _0x493d1f=null;var _0x49383e=null;var _0x5729b4=null;var _0x5e5190='';return db[_0xb8cf('0x2b')][_0xb8cf('0x4e')]({'where':{'id':_0x6e1015['params']['id']},'attributes':['id','name',_0xb8cf('0x57'),_0xb8cf('0x58'),_0xb8cf('0x59'),'remoteUri',_0xb8cf('0x5a'),_0xb8cf('0x5b')]})[_0xb8cf('0x3c')](handleEntityNotFound(_0x32de3f,null))[_0xb8cf('0x3c')](function(_0x3c6739){if(_0x3c6739){_0x237af8=_0x3c6739[_0xb8cf('0x57')];_0x493d1f=_0x3c6739['accessKey'];_0x49383e=_0x3c6739[_0xb8cf('0x59')];_0x5e5190=_0x3c6739[_0xb8cf('0x5c')];var _0x1eb8cf=_0x5e5190[_0xb8cf('0x5d')](-0x1);if(_0x1eb8cf==='/'){_0x5e5190=_0x5e5190['substring'](0x0,_0x5e5190[_0xb8cf('0x5e')](_0x1eb8cf));}_0x5729b4=util['format'](_0xb8cf('0x5f'),_0x5e5190);var _0x8c1255={'method':_0xb8cf('0x60'),'uri':_0x5729b4,'qs':{'operation':_0xb8cf('0x61'),'username':_0x3c6739[_0xb8cf('0x57')]},'json':!![]};return rp(_0x8c1255);}})[_0xb8cf('0x3c')](function(_0x41bf96){if(_0x41bf96[_0xb8cf('0x62')]){var _0x17f56f={'method':_0xb8cf('0x63'),'uri':_0x5729b4,'form':{'operation':_0xb8cf('0x64'),'username':_0x237af8,'accessKey':md5(_0x41bf96[_0xb8cf('0x65')]['token']+_0x493d1f)},'json':!![]};return rp(_0x17f56f);}})[_0xb8cf('0x3c')](function(_0x40db48){if(_0x40db48[_0xb8cf('0x62')]){var _0x54fa31={'method':_0xb8cf('0x60'),'uri':_0x5729b4,'qs':{'operation':_0xb8cf('0x66'),'username':_0x237af8,'sessionName':_0x40db48[_0xb8cf('0x65')]['sessionName'],'elementType':_0x49383e},'json':!![]};return rp(_0x54fa31);}})[_0xb8cf('0x3c')](function(_0x347b6f){if(_0x347b6f[_0xb8cf('0x62')]){var _0x460a95=[_0xb8cf('0x67'),_0xb8cf('0x68'),_0xb8cf('0x69')];_[_0xb8cf('0x6a')](_0x347b6f['result'][_0xb8cf('0x34')],function(_0x28c091){return _0x460a95[_0xb8cf('0x6b')](_0x28c091[_0xb8cf('0x2d')][_0xb8cf('0x27')]);});_['remove'](_0x347b6f[_0xb8cf('0x65')][_0xb8cf('0x34')],function(_0x51aede){return _0x51aede[_0xb8cf('0x6c')]===_0xb8cf('0x6d');});return{'count':_0x347b6f[_0xb8cf('0x65')][_0xb8cf('0x34')]['length'],'rows':_['map'](_0x347b6f[_0xb8cf('0x65')][_0xb8cf('0x34')],function(_0x1b1134){return{'id':_0x1b1134[_0xb8cf('0x27')],'name':_0x1b1134[_0xb8cf('0x6e')],'custom':_[_0xb8cf('0x6f')](_0x1b1134[_0xb8cf('0x27')],_0xb8cf('0x70'))?!![]:![],'options':_0x1b1134[_0xb8cf('0x2d')][_0xb8cf('0x27')]===_0xb8cf('0x71')&&_0x1b1134['type'][_0xb8cf('0x72')][_0xb8cf('0x36')]>0x0?_[_0xb8cf('0x2a')](_0x1b1134[_0xb8cf('0x2d')]['picklistValues'],function(_0x5cfd17){return{'name':_0x5cfd17[_0xb8cf('0x6e')],'value':_0x5cfd17[_0xb8cf('0x73')]};}):[]};})};}})[_0xb8cf('0x3c')](respondWithResult(_0x32de3f,null))['catch'](function(_0x30232b){console[_0xb8cf('0x74')](_0xb8cf('0x75')+_0x30232b);var _0x27b40b=_0x6e1015['query']['test']?0x1f4:_0x30232b[_0xb8cf('0x76')]||0x1f4;logger[_0xb8cf('0x25')](_0xb8cf('0x77'),'getFields',_0x27b40b,JSON['stringify'](_0x30232b));delete _0x30232b[_0xb8cf('0x27')];if(_0x27b40b===0x191){_0x27b40b=0x190;}_0x32de3f[_0xb8cf('0x1a')](_0x27b40b)[_0xb8cf('0x28')](_0x6e1015[_0xb8cf('0x2f')][_0xb8cf('0x78')]?{'message':_0xb8cf('0x79'),'statusCode':_0x30232b['statusCode']}:_0x30232b);});}; \ No newline at end of file +var _0xd9c6=['ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerAccount','count','include','findAll','rows','catch','params','includeAll','create','body','find','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','getSubjects','channel','getDescriptions','VtigerField','Subjects','Descriptions','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','GET','getchallenge','login','token','describe','result','sessionName','success','autogenerated','remove','includes','editable','false','label','cf_','picklist','picklistValues','log','test','statusCode','error','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x30186f,_0x4ff4c2){var _0x276b91=function(_0x2456a9){while(--_0x2456a9){_0x30186f['push'](_0x30186f['shift']());}};_0x276b91(++_0x4ff4c2);}(_0xd9c6,0xe4));var _0x6d9c=function(_0x3d57df,_0x39ca35){_0x3d57df=_0x3d57df-0x0;var _0x50bb75=_0xd9c6[_0x3d57df];return _0x50bb75;};'use strict';var emlformat=require(_0x6d9c('0x0'));var rimraf=require(_0x6d9c('0x1'));var zipdir=require(_0x6d9c('0x2'));var jsonpatch=require(_0x6d9c('0x3'));var rp=require(_0x6d9c('0x4'));var moment=require(_0x6d9c('0x5'));var BPromise=require(_0x6d9c('0x6'));var Mustache=require(_0x6d9c('0x7'));var util=require(_0x6d9c('0x8'));var path=require(_0x6d9c('0x9'));var sox=require(_0x6d9c('0xa'));var csv=require(_0x6d9c('0xb'));var ejs=require(_0x6d9c('0xc'));var fs=require('fs');var fs_extra=require(_0x6d9c('0xd'));var _=require(_0x6d9c('0xe'));var squel=require(_0x6d9c('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d9c('0x10'));var toCsv=require(_0x6d9c('0xb'));var querystring=require('querystring');var Papa=require(_0x6d9c('0x11'));var Redis=require(_0x6d9c('0x12'));var authService=require(_0x6d9c('0x13'));var qs=require(_0x6d9c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d9c('0x15'))(_0x6d9c('0x16'));var utils=require(_0x6d9c('0x17'));var config=require(_0x6d9c('0x18'));var licenseUtil=require(_0x6d9c('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6d9c('0x1a'));function respondWithStatusCode(_0x8325e,_0x5859bd){_0x5859bd=_0x5859bd||0xcc;return function(_0x530060){if(_0x530060){return _0x8325e['sendStatus'](_0x5859bd);}return _0x8325e[_0x6d9c('0x1b')](_0x5859bd)[_0x6d9c('0x1c')]();};}function respondWithResult(_0x3a605c,_0xd680be){_0xd680be=_0xd680be||0xc8;return function(_0x1d43c4){if(_0x1d43c4){return _0x3a605c[_0x6d9c('0x1b')](_0xd680be)[_0x6d9c('0x1d')](_0x1d43c4);}};}function respondWithFilteredResult(_0x5dfdd0,_0x5522c6){return function(_0x845cb3){if(_0x845cb3){var _0x187d31=typeof _0x5522c6[_0x6d9c('0x1e')]===_0x6d9c('0x1f')&&typeof _0x5522c6[_0x6d9c('0x20')]===_0x6d9c('0x1f');var _0x12d52a=_0x845cb3['count'];var _0x5a53b0=_0x187d31?0x0:_0x5522c6[_0x6d9c('0x1e')];var _0x3bd33e=_0x187d31?_0x845cb3['count']:_0x5522c6[_0x6d9c('0x1e')]+_0x5522c6['limit'];var _0x4620ff;if(_0x3bd33e>=_0x12d52a){_0x3bd33e=_0x12d52a;_0x4620ff=0xc8;}else{_0x4620ff=0xce;}_0x5dfdd0[_0x6d9c('0x1b')](_0x4620ff);return _0x5dfdd0[_0x6d9c('0x21')](_0x6d9c('0x22'),_0x5a53b0+'-'+_0x3bd33e+'/'+_0x12d52a)['json'](_0x845cb3);}return null;};}function patchUpdates(_0xf9512e){return function(_0x1e4c18){try{jsonpatch['apply'](_0x1e4c18,_0xf9512e,!![]);}catch(_0x708c0){return BPromise[_0x6d9c('0x23')](_0x708c0);}return _0x1e4c18['save']();};}function saveUpdates(_0x21120b,_0x656188){return function(_0x1e8f21){if(_0x1e8f21){return _0x1e8f21[_0x6d9c('0x24')](_0x21120b)[_0x6d9c('0x25')](function(_0x47ac2e){return _0x47ac2e;});}return null;};}function removeEntity(_0x5f3278,_0x20eaf0){return function(_0x5952eb){if(_0x5952eb){return _0x5952eb[_0x6d9c('0x26')]()[_0x6d9c('0x25')](function(){_0x5f3278[_0x6d9c('0x1b')](0xcc)[_0x6d9c('0x1c')]();});}};}function handleEntityNotFound(_0x920b23,_0x256aea){return function(_0x52a1b5){if(!_0x52a1b5){_0x920b23[_0x6d9c('0x27')](0x194);}return _0x52a1b5;};}function handleError(_0x3ae432,_0x1b322c){_0x1b322c=_0x1b322c||0x1f4;return function(_0x46151a){logger['error'](_0x46151a['stack']);if(_0x46151a[_0x6d9c('0x28')]){delete _0x46151a['name'];}_0x3ae432['status'](_0x1b322c)[_0x6d9c('0x29')](_0x46151a);};}exports['index']=function(_0x186fe2,_0x49ba79){var _0x16137b={},_0x54e8ea={},_0x1a890e={'count':0x0,'rows':[]};var _0x4fb9bc=_[_0x6d9c('0x2a')](db['VtigerAccount'][_0x6d9c('0x2b')],function(_0x4923eb){return{'name':_0x4923eb[_0x6d9c('0x2c')],'type':_0x4923eb[_0x6d9c('0x2d')][_0x6d9c('0x2e')]};});_0x54e8ea[_0x6d9c('0x2f')]=_[_0x6d9c('0x2a')](_0x4fb9bc,'name');_0x54e8ea[_0x6d9c('0x30')]=_[_0x6d9c('0x31')](_0x186fe2['query']);_0x54e8ea[_0x6d9c('0x32')]=_[_0x6d9c('0x33')](_0x54e8ea[_0x6d9c('0x2f')],_0x54e8ea[_0x6d9c('0x30')]);_0x16137b[_0x6d9c('0x34')]=_['intersection'](_0x54e8ea[_0x6d9c('0x2f')],qs['fields'](_0x186fe2['query'][_0x6d9c('0x35')]));_0x16137b[_0x6d9c('0x34')]=_0x16137b[_0x6d9c('0x34')][_0x6d9c('0x36')]?_0x16137b[_0x6d9c('0x34')]:_0x54e8ea[_0x6d9c('0x2f')];if(!_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x37')](_0x6d9c('0x38'))){_0x16137b['limit']=qs[_0x6d9c('0x20')](_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x20')]);_0x16137b['offset']=qs[_0x6d9c('0x1e')](_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x1e')]);}_0x16137b[_0x6d9c('0x39')]=qs[_0x6d9c('0x3a')](_0x186fe2['query']['sort']);_0x16137b[_0x6d9c('0x3b')]=qs[_0x6d9c('0x32')](_['pick'](_0x186fe2[_0x6d9c('0x30')],_0x54e8ea[_0x6d9c('0x32')]),_0x4fb9bc);if(_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x3c')]){_0x16137b['where']=_['merge'](_0x16137b[_0x6d9c('0x3b')],{'$or':_[_0x6d9c('0x2a')](_0x4fb9bc,function(_0x29f3ea){if(_0x29f3ea['type']!=='VIRTUAL'){var _0x154ba0={};_0x154ba0[_0x29f3ea[_0x6d9c('0x28')]]={'$like':'%'+_0x186fe2[_0x6d9c('0x30')][_0x6d9c('0x3c')]+'%'};return _0x154ba0;}})});}_0x16137b=_[_0x6d9c('0x3d')]({},_0x16137b,_0x186fe2[_0x6d9c('0x3e')]);var _0x429106={'where':_0x16137b[_0x6d9c('0x3b')]};return db[_0x6d9c('0x3f')][_0x6d9c('0x40')](_0x429106)['then'](function(_0x3b5981){_0x1a890e[_0x6d9c('0x40')]=_0x3b5981;if(_0x186fe2[_0x6d9c('0x30')]['includeAll']){_0x16137b[_0x6d9c('0x41')]=[{'all':!![]}];}return db[_0x6d9c('0x3f')][_0x6d9c('0x42')](_0x16137b);})[_0x6d9c('0x25')](function(_0x116c72){_0x1a890e[_0x6d9c('0x43')]=_0x116c72;return _0x1a890e;})[_0x6d9c('0x25')](respondWithFilteredResult(_0x49ba79,_0x16137b))[_0x6d9c('0x44')](handleError(_0x49ba79,null));};exports['show']=function(_0x3f561a,_0x164071){var _0xcbf591={'raw':![],'where':{'id':_0x3f561a[_0x6d9c('0x45')]['id']}},_0x34bce0={};_0x34bce0[_0x6d9c('0x2f')]=_[_0x6d9c('0x31')](db[_0x6d9c('0x3f')][_0x6d9c('0x2b')]);_0x34bce0[_0x6d9c('0x30')]=_['keys'](_0x3f561a[_0x6d9c('0x30')]);_0x34bce0['filters']=_[_0x6d9c('0x33')](_0x34bce0[_0x6d9c('0x2f')],_0x34bce0[_0x6d9c('0x30')]);_0xcbf591[_0x6d9c('0x34')]=_[_0x6d9c('0x33')](_0x34bce0[_0x6d9c('0x2f')],qs[_0x6d9c('0x35')](_0x3f561a[_0x6d9c('0x30')][_0x6d9c('0x35')]));_0xcbf591['attributes']=_0xcbf591[_0x6d9c('0x34')][_0x6d9c('0x36')]?_0xcbf591[_0x6d9c('0x34')]:_0x34bce0['model'];if(_0x3f561a[_0x6d9c('0x30')][_0x6d9c('0x46')]){_0xcbf591[_0x6d9c('0x41')]=[{'all':!![]}];}_0xcbf591=_[_0x6d9c('0x3d')]({},_0xcbf591,_0x3f561a['options']);return db[_0x6d9c('0x3f')]['find'](_0xcbf591)[_0x6d9c('0x25')](handleEntityNotFound(_0x164071,null))[_0x6d9c('0x25')](respondWithResult(_0x164071,null))[_0x6d9c('0x44')](handleError(_0x164071,null));};exports[_0x6d9c('0x47')]=function(_0x223cc,_0x1d7595){return db[_0x6d9c('0x3f')][_0x6d9c('0x47')](_0x223cc[_0x6d9c('0x48')],{})[_0x6d9c('0x25')](respondWithResult(_0x1d7595,0xc9))[_0x6d9c('0x44')](handleError(_0x1d7595,null));};exports[_0x6d9c('0x24')]=function(_0x339bd6,_0x161254){if(_0x339bd6[_0x6d9c('0x48')]['id']){delete _0x339bd6[_0x6d9c('0x48')]['id'];}return db[_0x6d9c('0x3f')][_0x6d9c('0x49')]({'where':{'id':_0x339bd6[_0x6d9c('0x45')]['id']}})[_0x6d9c('0x25')](handleEntityNotFound(_0x161254,null))[_0x6d9c('0x25')](saveUpdates(_0x339bd6[_0x6d9c('0x48')],null))[_0x6d9c('0x25')](respondWithResult(_0x161254,null))[_0x6d9c('0x44')](handleError(_0x161254,null));};exports[_0x6d9c('0x26')]=function(_0x473943,_0x4032cd){return db[_0x6d9c('0x3f')]['find']({'where':{'id':_0x473943[_0x6d9c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4032cd,null))[_0x6d9c('0x25')](removeEntity(_0x4032cd,null))[_0x6d9c('0x44')](handleError(_0x4032cd,null));};exports[_0x6d9c('0x4a')]=function(_0x2526e5,_0x2b0a4e,_0x32f1a0){var _0x4d750c={};var _0x2df285={};var _0x4d82f6;var _0x43873a;return db[_0x6d9c('0x3f')][_0x6d9c('0x4b')]({'where':{'id':_0x2526e5[_0x6d9c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b0a4e,null))[_0x6d9c('0x25')](function(_0x4ced50){if(_0x4ced50){_0x4d82f6=_0x4ced50;_0x2df285[_0x6d9c('0x2f')]=_[_0x6d9c('0x31')](db[_0x6d9c('0x4c')][_0x6d9c('0x2b')]);_0x2df285[_0x6d9c('0x30')]=_[_0x6d9c('0x31')](_0x2526e5['query']);_0x2df285['filters']=_['intersection'](_0x2df285['model'],_0x2df285[_0x6d9c('0x30')]);_0x4d750c['attributes']=_[_0x6d9c('0x33')](_0x2df285[_0x6d9c('0x2f')],qs['fields'](_0x2526e5[_0x6d9c('0x30')]['fields']));_0x4d750c['attributes']=_0x4d750c[_0x6d9c('0x34')][_0x6d9c('0x36')]?_0x4d750c[_0x6d9c('0x34')]:_0x2df285[_0x6d9c('0x2f')];_0x4d750c[_0x6d9c('0x39')]=qs[_0x6d9c('0x3a')](_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x3a')]);_0x4d750c['where']=qs[_0x6d9c('0x32')](_[_0x6d9c('0x4d')](_0x2526e5[_0x6d9c('0x30')],_0x2df285[_0x6d9c('0x32')]));if(_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x3c')]){_0x4d750c[_0x6d9c('0x3b')]=_[_0x6d9c('0x3d')](_0x4d750c['where'],{'$or':_['map'](_0x4d750c[_0x6d9c('0x34')],function(_0x1f6a29){var _0x17327e={};_0x17327e[_0x1f6a29]={'$like':'%'+_0x2526e5[_0x6d9c('0x30')]['filter']+'%'};return _0x17327e;})});}_0x4d750c=_[_0x6d9c('0x3d')]({},_0x4d750c,_0x2526e5[_0x6d9c('0x3e')]);return _0x4d82f6[_0x6d9c('0x4a')](_0x4d750c);}})[_0x6d9c('0x25')](function(_0x421222){if(_0x421222){_0x43873a=_0x421222['length'];if(!_0x2526e5[_0x6d9c('0x30')]['hasOwnProperty'](_0x6d9c('0x38'))){_0x4d750c[_0x6d9c('0x20')]=qs[_0x6d9c('0x20')](_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x20')]);_0x4d750c['offset']=qs[_0x6d9c('0x1e')](_0x2526e5[_0x6d9c('0x30')][_0x6d9c('0x1e')]);}return _0x4d82f6['getConfigurations'](_0x4d750c);}})['then'](function(_0x1277f1){if(_0x1277f1){return _0x1277f1?{'count':_0x43873a,'rows':_0x1277f1}:null;}})[_0x6d9c('0x25')](respondWithResult(_0x2b0a4e,null))['catch'](handleError(_0x2b0a4e,null));};exports[_0x6d9c('0x4e')]=function(_0x4ac04f,_0x294b83,_0x44aa72){if(_0x4ac04f['body']['id']){delete _0x4ac04f['body']['id'];}return db[_0x6d9c('0x3f')][_0x6d9c('0x4b')]({'where':{'id':_0x4ac04f[_0x6d9c('0x45')]['id']}})[_0x6d9c('0x25')](handleEntityNotFound(_0x294b83,null))[_0x6d9c('0x25')](function(_0x32b1d4){if(_0x32b1d4){_0x4ac04f[_0x6d9c('0x48')][_0x6d9c('0x4f')]=_0x32b1d4['id'];_0x4ac04f[_0x6d9c('0x48')]['Subjects']=integrations[_0x6d9c('0x50')](_0x4ac04f['body'][_0x6d9c('0x51')],_0x4ac04f[_0x6d9c('0x48')]['type']);_0x4ac04f[_0x6d9c('0x48')]['Descriptions']=integrations[_0x6d9c('0x52')](_0x4ac04f[_0x6d9c('0x48')][_0x6d9c('0x51')],_0x4ac04f[_0x6d9c('0x48')]['type']);return db[_0x6d9c('0x4c')][_0x6d9c('0x47')](_0x4ac04f[_0x6d9c('0x48')],{'include':[{'model':db[_0x6d9c('0x53')],'as':_0x6d9c('0x54')},{'model':db[_0x6d9c('0x53')],'as':_0x6d9c('0x55')}]});}return null;})[_0x6d9c('0x25')](respondWithResult(_0x294b83,null))[_0x6d9c('0x44')](handleError(_0x294b83,null));};var md5=require(_0x6d9c('0x56'));exports['getFields']=function(_0x3b8925,_0x16b412,_0x86086a){var _0x58881c=null;var _0x58e09c=null;var _0x1fc600=null;var _0x587a3b=null;var _0x17293f='';return db[_0x6d9c('0x3f')][_0x6d9c('0x4b')]({'where':{'id':_0x3b8925[_0x6d9c('0x45')]['id']},'attributes':['id',_0x6d9c('0x28'),_0x6d9c('0x57'),_0x6d9c('0x58'),_0x6d9c('0x59'),_0x6d9c('0x5a'),_0x6d9c('0x5b'),_0x6d9c('0x5c')]})[_0x6d9c('0x25')](handleEntityNotFound(_0x16b412,null))[_0x6d9c('0x25')](function(_0x1cd20f){if(_0x1cd20f){_0x58881c=_0x1cd20f[_0x6d9c('0x57')];_0x58e09c=_0x1cd20f[_0x6d9c('0x5c')];_0x1fc600=_0x1cd20f['moduleName'];_0x17293f=_0x1cd20f[_0x6d9c('0x5a')];var _0x22b220=_0x17293f[_0x6d9c('0x5d')](-0x1);if(_0x22b220==='/'){_0x17293f=_0x17293f[_0x6d9c('0x5e')](0x0,_0x17293f['lastIndexOf'](_0x22b220));}_0x587a3b=util[_0x6d9c('0x5f')]('%s/webservice.php',_0x17293f);var _0x17e098={'method':_0x6d9c('0x60'),'uri':_0x587a3b,'qs':{'operation':_0x6d9c('0x61'),'username':_0x1cd20f[_0x6d9c('0x57')]},'json':!![]};return rp(_0x17e098);}})[_0x6d9c('0x25')](function(_0x3254ef){if(_0x3254ef['success']){var _0x5705d1={'method':'POST','uri':_0x587a3b,'form':{'operation':_0x6d9c('0x62'),'username':_0x58881c,'accessKey':md5(_0x3254ef['result'][_0x6d9c('0x63')]+_0x58e09c)},'json':!![]};return rp(_0x5705d1);}})[_0x6d9c('0x25')](function(_0x2f18ed){if(_0x2f18ed['success']){var _0x16976a={'method':_0x6d9c('0x60'),'uri':_0x587a3b,'qs':{'operation':_0x6d9c('0x64'),'username':_0x58881c,'sessionName':_0x2f18ed[_0x6d9c('0x65')][_0x6d9c('0x66')],'elementType':_0x1fc600},'json':!![]};return rp(_0x16976a);}})[_0x6d9c('0x25')](function(_0x453bd1){if(_0x453bd1[_0x6d9c('0x67')]){var _0x1e008a=[_0x6d9c('0x68'),'reference','owner'];_[_0x6d9c('0x69')](_0x453bd1[_0x6d9c('0x65')][_0x6d9c('0x35')],function(_0x6da60){return _0x1e008a[_0x6d9c('0x6a')](_0x6da60['type'][_0x6d9c('0x28')]);});_[_0x6d9c('0x69')](_0x453bd1['result'][_0x6d9c('0x35')],function(_0x3ade87){return _0x3ade87[_0x6d9c('0x6b')]===_0x6d9c('0x6c');});return{'count':_0x453bd1['result']['fields'][_0x6d9c('0x36')],'rows':_[_0x6d9c('0x2a')](_0x453bd1[_0x6d9c('0x65')][_0x6d9c('0x35')],function(_0x4563e7){return{'id':_0x4563e7[_0x6d9c('0x28')],'name':_0x4563e7[_0x6d9c('0x6d')],'custom':_['startsWith'](_0x4563e7[_0x6d9c('0x28')],_0x6d9c('0x6e'))?!![]:![],'options':_0x4563e7[_0x6d9c('0x2d')]['name']===_0x6d9c('0x6f')&&_0x4563e7[_0x6d9c('0x2d')][_0x6d9c('0x70')]['length']>0x0?_[_0x6d9c('0x2a')](_0x4563e7['type'][_0x6d9c('0x70')],function(_0x5c27b0){return{'name':_0x5c27b0[_0x6d9c('0x6d')],'value':_0x5c27b0['value']};}):[]};})};}})[_0x6d9c('0x25')](respondWithResult(_0x16b412,null))[_0x6d9c('0x44')](function(_0x316d65){console[_0x6d9c('0x71')]('vTiger\x20error:\x20'+_0x316d65);var _0x4534c7=_0x3b8925[_0x6d9c('0x30')][_0x6d9c('0x72')]?0x1f4:_0x316d65[_0x6d9c('0x73')]||0x1f4;logger[_0x6d9c('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0x6d9c('0x75'),_0x4534c7,JSON[_0x6d9c('0x76')](_0x316d65));delete _0x316d65[_0x6d9c('0x28')];if(_0x4534c7===0x191){_0x4534c7=0x190;}_0x16b412['status'](_0x4534c7)['send'](_0x3b8925[_0x6d9c('0x30')][_0x6d9c('0x72')]?{'message':_0x6d9c('0x77'),'statusCode':_0x316d65[_0x6d9c('0x73')]}:_0x316d65);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5755e93..43e21cb 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 _0x214e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x1b7640,_0x57636b){var _0x4e872b=function(_0x1fd24e){while(--_0x1fd24e){_0x1b7640['push'](_0x1b7640['shift']());}};_0x4e872b(++_0x57636b);}(_0x214e,0xda));var _0xe214=function(_0x286602,_0xa5e242){_0x286602=_0x286602-0x0;var _0x5a28a2=_0x214e[_0x286602];return _0x5a28a2;};'use strict';var _=require(_0xe214('0x0'));var util=require(_0xe214('0x1'));var logger=require(_0xe214('0x2'))(_0xe214('0x3'));var moment=require(_0xe214('0x4'));var BPromise=require(_0xe214('0x5'));var rp=require(_0xe214('0x6'));var fs=require('fs');var path=require(_0xe214('0x7'));var rimraf=require(_0xe214('0x8'));var config=require(_0xe214('0x9'));var attributes=require(_0xe214('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1a888e,_0x4d2b37){return _0x1a888e[_0xe214('0xb')]('VtigerAccount',attributes,{'tableName':_0xe214('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e17=['util','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','lodash'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0x2e17,0x98));var _0x72e1=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x2e17[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0x72e1('0x0'));var util=require(_0x72e1('0x1'));var logger=require('../../config/logger')(_0x72e1('0x2'));var moment=require('moment');var BPromise=require(_0x72e1('0x3'));var rp=require(_0x72e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72e1('0x5'));var config=require(_0x72e1('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x72e1('0x7'));module['exports']=function(_0x26f444,_0x2fe2f1){return _0x26f444[_0x72e1('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','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 c31f0bc..39722c9 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 _0xb688=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','GetVtigerAccount','stringify','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0xb688,0xcf));var _0x8b68=function(_0x57bea8,_0x54795a){_0x57bea8=_0x57bea8-0x0;var _0x3d8850=_0xb688[_0x57bea8];return _0x3d8850;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var rs=require(_0x8b68('0x3'));var fs=require('fs');var Redis=require(_0x8b68('0x4'));var db=require(_0x8b68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b68('0x6'))(_0x8b68('0x7'));var config=require(_0x8b68('0x8'));var jayson=require(_0x8b68('0x9'));var client=jayson['client'][_0x8b68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ee56,_0x37677d,_0x2bbffd){return new BPromise(function(_0x130892,_0xa5571b){return client[_0x8b68('0xb')](_0x57ee56,_0x2bbffd)[_0x8b68('0xc')](function(_0x261753){logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x37677d,_0x8b68('0xf'));logger[_0x8b68('0x10')](_0x8b68('0x11'),_0x37677d,_0x8b68('0xf'),JSON['stringify'](_0x261753));if(_0x261753[_0x8b68('0x12')]){if(_0x261753[_0x8b68('0x12')][_0x8b68('0x13')]===0x1f4){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);return _0xa5571b(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}logger['error'](_0x8b68('0xe'),_0x37677d,_0x261753['error']['message']);return _0x130892(_0x261753[_0x8b68('0x12')][_0x8b68('0x14')]);}else{logger[_0x8b68('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x37677d,'request\x20sent');_0x130892(_0x261753[_0x8b68('0x15')]['message']);}})[_0x8b68('0x16')](function(_0xb44923){logger[_0x8b68('0x12')](_0x8b68('0xe'),_0x37677d,_0xb44923);_0xa5571b(_0xb44923);});});}exports['GetVtigerAccount']=function(_0xd17693){var _0x203dd4=this;return new Promise(function(_0x4a68c7,_0x42b3bd){return db[_0x8b68('0x17')][_0x8b68('0x18')]({'raw':_0xd17693[_0x8b68('0x19')]?_0xd17693[_0x8b68('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd17693[_0x8b68('0x19')]?_0xd17693[_0x8b68('0x19')][_0x8b68('0x1a')]||null:null,'attributes':_0xd17693[_0x8b68('0x19')]?_0xd17693[_0x8b68('0x19')][_0x8b68('0x1b')]||null:null,'limit':_0xd17693['options']?_0xd17693['options'][_0x8b68('0x1c')]||null:null,'include':_0xd17693['options']?_0xd17693[_0x8b68('0x19')][_0x8b68('0x1d')]?_[_0x8b68('0x1e')](_0xd17693[_0x8b68('0x19')][_0x8b68('0x1d')],function(_0x173524){return{'model':db[_0x173524['model']],'as':_0x173524['as'],'attributes':_0x173524[_0x8b68('0x1b')],'include':_0x173524[_0x8b68('0x1d')]?_['map'](_0x173524[_0x8b68('0x1d')],function(_0x3cf8d2){return{'model':db[_0x3cf8d2[_0x8b68('0x1f')]],'as':_0x3cf8d2['as'],'attributes':_0x3cf8d2['attributes'],'include':_0x3cf8d2['include']?_['map'](_0x3cf8d2[_0x8b68('0x1d')],function(_0x448e43){return{'model':db[_0x448e43[_0x8b68('0x1f')]],'as':_0x448e43['as'],'attributes':_0x448e43['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b68('0xc')](function(_0x53aaa2){logger['info'](_0x8b68('0x20'),_0xd17693);logger['debug'](_0x8b68('0x20'),_0xd17693,JSON[_0x8b68('0x21')](_0x53aaa2));_0x4a68c7(_0x53aaa2);})['catch'](function(_0x494ce4){logger[_0x8b68('0x12')](_0x8b68('0x20'),_0x494ce4[_0x8b68('0x14')],_0xd17693);_0x42b3bd(_0x203dd4[_0x8b68('0x12')](0x1f4,_0x494ce4[_0x8b68('0x14')]));});});};exports[_0x8b68('0x22')]=function(_0x460c37){var _0x5b7ed1=this;return new Promise(function(_0x3b6d1b,_0x50a1e9){return db[_0x8b68('0x17')][_0x8b68('0x23')]({'raw':_0x460c37['options']?_0x460c37[_0x8b68('0x19')][_0x8b68('0x24')]===undefined?!![]:![]:!![],'where':_0x460c37[_0x8b68('0x19')]?_0x460c37['options']['where']||null:null,'attributes':_0x460c37[_0x8b68('0x19')]?_0x460c37[_0x8b68('0x19')][_0x8b68('0x1b')]||null:null,'include':_0x460c37[_0x8b68('0x19')]?_0x460c37[_0x8b68('0x19')][_0x8b68('0x1d')]?_[_0x8b68('0x1e')](_0x460c37[_0x8b68('0x19')][_0x8b68('0x1d')],function(_0x7fe301){return{'model':db[_0x7fe301[_0x8b68('0x1f')]],'as':_0x7fe301['as'],'attributes':_0x7fe301[_0x8b68('0x1b')],'include':_0x7fe301[_0x8b68('0x1d')]?_[_0x8b68('0x1e')](_0x7fe301[_0x8b68('0x1d')],function(_0x151277){return{'model':db[_0x151277[_0x8b68('0x1f')]],'as':_0x151277['as'],'attributes':_0x151277[_0x8b68('0x1b')],'include':_0x151277[_0x8b68('0x1d')]?_[_0x8b68('0x1e')](_0x151277[_0x8b68('0x1d')],function(_0x43b971){return{'model':db[_0x43b971['model']],'as':_0x43b971['as'],'attributes':_0x43b971['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b68('0xc')](function(_0x262d6c){logger[_0x8b68('0xd')](_0x8b68('0x22'),_0x460c37);logger[_0x8b68('0x10')](_0x8b68('0x22'),_0x460c37,JSON[_0x8b68('0x21')](_0x262d6c));_0x3b6d1b(_0x262d6c);})[_0x8b68('0x16')](function(_0x5b628e){logger[_0x8b68('0x12')](_0x8b68('0x22'),_0x5b628e[_0x8b68('0x14')],_0x460c37);_0x50a1e9(_0x5b7ed1[_0x8b68('0x12')](0x1f4,_0x5b628e[_0x8b68('0x14')]));});});}; \ No newline at end of file +var _0x593e=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount'];(function(_0x4839d0,_0x1f5c36){var _0xefa7c4=function(_0x37c902){while(--_0x37c902){_0x4839d0['push'](_0x4839d0['shift']());}};_0xefa7c4(++_0x1f5c36);}(_0x593e,0xcb));var _0xe593=function(_0x56d3ea,_0x723b5b){_0x56d3ea=_0x56d3ea-0x0;var _0x5ab25a=_0x593e[_0x56d3ea];return _0x5ab25a;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});}exports[_0xe593('0x18')]=function(_0x470d07){var _0x5f57ce=this;return new Promise(function(_0xd1020e,_0x28b5ed){return db['VtigerAccount'][_0xe593('0x19')]({'raw':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x470d07[_0xe593('0x1a')]?_0x470d07[_0xe593('0x1a')][_0xe593('0x1c')]||null:null,'attributes':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1d')]||null:null,'limit':_0x470d07['options']?_0x470d07['options'][_0xe593('0x1e')]||null:null,'include':_0x470d07[_0xe593('0x1a')]?_0x470d07['options'][_0xe593('0x1f')]?_['map'](_0x470d07[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x185cea){return{'model':db[_0x185cea[_0xe593('0x20')]],'as':_0x185cea['as'],'attributes':_0x185cea[_0xe593('0x1d')],'include':_0x185cea[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x185cea[_0xe593('0x1f')],function(_0x4fc483){return{'model':db[_0x4fc483[_0xe593('0x20')]],'as':_0x4fc483['as'],'attributes':_0x4fc483[_0xe593('0x1d')],'include':_0x4fc483['include']?_['map'](_0x4fc483[_0xe593('0x1f')],function(_0x25238f){return{'model':db[_0x25238f[_0xe593('0x20')]],'as':_0x25238f['as'],'attributes':_0x25238f[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x27a3d2){logger['info'](_0xe593('0x18'),_0x470d07);logger['debug'](_0xe593('0x18'),_0x470d07,JSON[_0xe593('0x22')](_0x27a3d2));_0xd1020e(_0x27a3d2);})['catch'](function(_0x337ee0){logger['error'](_0xe593('0x18'),_0x337ee0[_0xe593('0x15')],_0x470d07);_0x28b5ed(_0x5f57ce[_0xe593('0x12')](0x1f4,_0x337ee0['message']));});});};exports[_0xe593('0x23')]=function(_0x13f44){var _0x3066ed=this;return new Promise(function(_0x338222,_0x2588be){return db[_0xe593('0x24')][_0xe593('0x25')]({'raw':_0x13f44['options']?_0x13f44[_0xe593('0x1a')][_0xe593('0x1b')]===undefined?!![]:![]:!![],'where':_0x13f44['options']?_0x13f44[_0xe593('0x1a')]['where']||null:null,'attributes':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1d')]||null:null,'include':_0x13f44[_0xe593('0x1a')]?_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')]?_[_0xe593('0x21')](_0x13f44[_0xe593('0x1a')][_0xe593('0x1f')],function(_0x4305de){return{'model':db[_0x4305de['model']],'as':_0x4305de['as'],'attributes':_0x4305de[_0xe593('0x1d')],'include':_0x4305de[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4305de['include'],function(_0x4fefb3){return{'model':db[_0x4fefb3[_0xe593('0x20')]],'as':_0x4fefb3['as'],'attributes':_0x4fefb3['attributes'],'include':_0x4fefb3[_0xe593('0x1f')]?_[_0xe593('0x21')](_0x4fefb3[_0xe593('0x1f')],function(_0x30511c){return{'model':db[_0x30511c[_0xe593('0x20')]],'as':_0x30511c['as'],'attributes':_0x30511c[_0xe593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe593('0xd')](function(_0x4889cc){logger['info'](_0xe593('0x23'),_0x13f44);logger['debug'](_0xe593('0x23'),_0x13f44,JSON['stringify'](_0x4889cc));_0x338222(_0x4889cc);})[_0xe593('0x17')](function(_0x5b9589){logger['error'](_0xe593('0x23'),_0x5b9589[_0xe593('0x15')],_0x13f44);_0x2588be(_0x3066ed[_0xe593('0x12')](0x1f4,_0x5b9589['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 25e8d83..7d26fbe 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 _0xfe97=['/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x3ccde6,_0x18bee9){var _0x58d054=function(_0x2a48a5){while(--_0x2a48a5){_0x3ccde6['push'](_0x3ccde6['shift']());}};_0x58d054(++_0x18bee9);}(_0xfe97,0x1a9));var _0x7fe9=function(_0x58d028,_0x351692){_0x58d028=_0x58d028-0x0;var _0x412f40=_0xfe97[_0x58d028];return _0x412f40;};'use strict';var multer=require('multer');var util=require(_0x7fe9('0x0'));var path=require(_0x7fe9('0x1'));var timeout=require(_0x7fe9('0x2'));var express=require('express');var router=express[_0x7fe9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7fe9('0x4'));var interaction=require(_0x7fe9('0x5'));var config=require(_0x7fe9('0x6'));var controller=require(_0x7fe9('0x7'));router[_0x7fe9('0x8')]('/',auth[_0x7fe9('0x9')](),controller[_0x7fe9('0xa')]);router[_0x7fe9('0x8')](_0x7fe9('0xb'),auth[_0x7fe9('0x9')](),controller['show']);router['get'](_0x7fe9('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x7fe9('0x8')](_0x7fe9('0xd'),auth[_0x7fe9('0x9')](),controller['getSubjects']);router[_0x7fe9('0x8')](_0x7fe9('0xe'),auth[_0x7fe9('0x9')](),controller[_0x7fe9('0xf')]);router[_0x7fe9('0x10')]('/',auth[_0x7fe9('0x9')](),controller[_0x7fe9('0x11')]);router[_0x7fe9('0x12')]('/:id',auth[_0x7fe9('0x9')](),controller[_0x7fe9('0x13')]);router[_0x7fe9('0x14')](_0x7fe9('0xb'),auth[_0x7fe9('0x9')](),controller[_0x7fe9('0x15')]);module[_0x7fe9('0x16')]=router; \ No newline at end of file +var _0x8a18=['isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get'];(function(_0x2efc5b,_0x2c9384){var _0x5f49c6=function(_0x26ce5b){while(--_0x26ce5b){_0x2efc5b['push'](_0x2efc5b['shift']());}};_0x5f49c6(++_0x2c9384);}(_0x8a18,0x70));var _0x88a1=function(_0x3d7608,_0x3d61a4){_0x3d7608=_0x3d7608-0x0;var _0x49303b=_0x8a18[_0x3d7608];return _0x49303b;};'use strict';var multer=require('multer');var util=require(_0x88a1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x88a1('0x1'));var router=express[_0x88a1('0x2')]();var fs_extra=require(_0x88a1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x88a1('0x4'));var config=require(_0x88a1('0x5'));var controller=require(_0x88a1('0x6'));router[_0x88a1('0x7')]('/',auth[_0x88a1('0x8')](),controller['index']);router[_0x88a1('0x7')](_0x88a1('0x9'),auth[_0x88a1('0x8')](),controller[_0x88a1('0xa')]);router[_0x88a1('0x7')](_0x88a1('0xb'),auth[_0x88a1('0x8')](),controller[_0x88a1('0xc')]);router[_0x88a1('0x7')](_0x88a1('0xd'),auth[_0x88a1('0x8')](),controller['getSubjects']);router[_0x88a1('0x7')](_0x88a1('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x88a1('0x8')](),controller[_0x88a1('0xf')]);router['put'](_0x88a1('0x9'),auth[_0x88a1('0x8')](),controller[_0x88a1('0x10')]);router[_0x88a1('0x11')](_0x88a1('0x9'),auth['isAuthenticated'](),controller[_0x88a1('0x12')]);module[_0x88a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 85f4670..78cf753 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 _0x2785=['STRING','sequelize'];(function(_0x473663,_0x4a3832){var _0xcf7f87=function(_0x4def40){while(--_0x4def40){_0x473663['push'](_0x473663['shift']());}};_0xcf7f87(++_0x4a3832);}(_0x2785,0x167));var _0x5278=function(_0x4ab4a2,_0x41b416){_0x4ab4a2=_0x4ab4a2-0x0;var _0x57f331=_0x2785[_0x4ab4a2];return _0x57f331;};'use strict';var Sequelize=require(_0x5278('0x0'));module['exports']={'name':{'type':Sequelize[_0x5278('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9d2c=['sequelize','exports','STRING'];(function(_0x5c7158,_0x40146f){var _0x526bc4=function(_0x58260f){while(--_0x58260f){_0x5c7158['push'](_0x5c7158['shift']());}};_0x526bc4(++_0x40146f);}(_0x9d2c,0x6c));var _0xc9d2=function(_0xa91256,_0x35e0dc){_0xa91256=_0xa91256-0x0;var _0x8661cb=_0x9d2c[_0xa91256];return _0x8661cb;};'use strict';var Sequelize=require(_0xc9d2('0x0'));module[_0xc9d2('0x1')]={'name':{'type':Sequelize[_0xc9d2('0x2')]},'description':{'type':Sequelize[_0xc9d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 21c74c6..8ad0471 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 _0xa9f3=['create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find'];(function(_0x598384,_0x31184b){var _0x13aaa9=function(_0x432cc3){while(--_0x432cc3){_0x598384['push'](_0x598384['shift']());}};_0x13aaa9(++_0x31184b);}(_0xa9f3,0x1e8));var _0x3a9f=function(_0x11b474,_0x350d60){_0x11b474=_0x11b474-0x0;var _0x193f36=_0xa9f3[_0x11b474];return _0x193f36;};'use strict';var emlformat=require(_0x3a9f('0x0'));var rimraf=require(_0x3a9f('0x1'));var zipdir=require(_0x3a9f('0x2'));var jsonpatch=require(_0x3a9f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3a9f('0x4'));var Mustache=require('mustache');var util=require(_0x3a9f('0x5'));var path=require(_0x3a9f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3a9f('0x7'));var fs=require('fs');var fs_extra=require(_0x3a9f('0x8'));var _=require('lodash');var squel=require(_0x3a9f('0x9'));var crypto=require(_0x3a9f('0xa'));var jsforce=require(_0x3a9f('0xb'));var deskjs=require(_0x3a9f('0xc'));var toCsv=require(_0x3a9f('0xd'));var querystring=require(_0x3a9f('0xe'));var Papa=require(_0x3a9f('0xf'));var Redis=require(_0x3a9f('0x10'));var authService=require(_0x3a9f('0x11'));var qs=require(_0x3a9f('0x12'));var as=require(_0x3a9f('0x13'));var hardwareService=require(_0x3a9f('0x14'));var logger=require(_0x3a9f('0x15'))(_0x3a9f('0x16'));var utils=require(_0x3a9f('0x17'));var config=require(_0x3a9f('0x18'));var licenseUtil=require(_0x3a9f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7fc8,_0x14709b){_0x14709b=_0x14709b||0xcc;return function(_0x875e6a){if(_0x875e6a){return _0x4f7fc8[_0x3a9f('0x1a')](_0x14709b);}return _0x4f7fc8[_0x3a9f('0x1b')](_0x14709b)[_0x3a9f('0x1c')]();};}function respondWithResult(_0x5a299b,_0x3341e6){_0x3341e6=_0x3341e6||0xc8;return function(_0x5d57db){if(_0x5d57db){return _0x5a299b['status'](_0x3341e6)[_0x3a9f('0x1d')](_0x5d57db);}};}function respondWithFilteredResult(_0x5d66aa,_0xeb81c6){return function(_0x1d60c8){if(_0x1d60c8){var _0x299c50=typeof _0xeb81c6[_0x3a9f('0x1e')]==='undefined'&&typeof _0xeb81c6[_0x3a9f('0x1f')]===_0x3a9f('0x20');var _0xc853cd=_0x1d60c8[_0x3a9f('0x21')];var _0x4a0c6e=_0x299c50?0x0:_0xeb81c6[_0x3a9f('0x1e')];var _0x99fc9d=_0x299c50?_0x1d60c8[_0x3a9f('0x21')]:_0xeb81c6[_0x3a9f('0x1e')]+_0xeb81c6['limit'];var _0x368144;if(_0x99fc9d>=_0xc853cd){_0x99fc9d=_0xc853cd;_0x368144=0xc8;}else{_0x368144=0xce;}_0x5d66aa[_0x3a9f('0x1b')](_0x368144);return _0x5d66aa['set'](_0x3a9f('0x22'),_0x4a0c6e+'-'+_0x99fc9d+'/'+_0xc853cd)[_0x3a9f('0x1d')](_0x1d60c8);}return null;};}function patchUpdates(_0x4e105b){return function(_0x47f38e){try{jsonpatch[_0x3a9f('0x23')](_0x47f38e,_0x4e105b,!![]);}catch(_0x3b7fe5){return BPromise[_0x3a9f('0x24')](_0x3b7fe5);}return _0x47f38e['save']();};}function saveUpdates(_0x4dccb3,_0x48f352){return function(_0x40945d){if(_0x40945d){return _0x40945d[_0x3a9f('0x25')](_0x4dccb3)[_0x3a9f('0x26')](function(_0x5c1d62){return _0x5c1d62;});}return null;};}function removeEntity(_0xf78ef2,_0x712cf0){return function(_0x31f0e3){if(_0x31f0e3){return _0x31f0e3['destroy']()[_0x3a9f('0x26')](function(){_0xf78ef2[_0x3a9f('0x1b')](0xcc)[_0x3a9f('0x1c')]();});}};}function handleEntityNotFound(_0x1e5d39,_0x3acb0f){return function(_0x41d910){if(!_0x41d910){_0x1e5d39[_0x3a9f('0x1a')](0x194);}return _0x41d910;};}function handleError(_0x53a2cb,_0x3c3119){_0x3c3119=_0x3c3119||0x1f4;return function(_0x4c73c4){logger[_0x3a9f('0x27')](_0x4c73c4['stack']);if(_0x4c73c4[_0x3a9f('0x28')]){delete _0x4c73c4[_0x3a9f('0x28')];}_0x53a2cb[_0x3a9f('0x1b')](_0x3c3119)[_0x3a9f('0x29')](_0x4c73c4);};}exports[_0x3a9f('0x2a')]=function(_0x22f709,_0x191860){var _0x46c652={},_0x101fde={},_0x5b8457={'count':0x0,'rows':[]};var _0x32f8f2=_[_0x3a9f('0x2b')](db[_0x3a9f('0x2c')][_0x3a9f('0x2d')],function(_0x11f766){return{'name':_0x11f766[_0x3a9f('0x2e')],'type':_0x11f766[_0x3a9f('0x2f')]['key']};});_0x101fde[_0x3a9f('0x30')]=_[_0x3a9f('0x2b')](_0x32f8f2,_0x3a9f('0x28'));_0x101fde[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x22f709['query']);_0x101fde[_0x3a9f('0x33')]=_['intersection'](_0x101fde['model'],_0x101fde['query']);_0x46c652[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0x101fde[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x46c652[_0x3a9f('0x34')]=_0x46c652[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x46c652[_0x3a9f('0x34')]:_0x101fde['model'];if(!_0x22f709['query'][_0x3a9f('0x38')](_0x3a9f('0x39'))){_0x46c652[_0x3a9f('0x1f')]=qs['limit'](_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x1f')]);_0x46c652[_0x3a9f('0x1e')]=qs['offset'](_0x22f709[_0x3a9f('0x31')]['offset']);}_0x46c652[_0x3a9f('0x3a')]=qs[_0x3a9f('0x3b')](_0x22f709['query'][_0x3a9f('0x3b')]);_0x46c652[_0x3a9f('0x3c')]=qs[_0x3a9f('0x33')](_[_0x3a9f('0x3d')](_0x22f709[_0x3a9f('0x31')],_0x101fde[_0x3a9f('0x33')]),_0x32f8f2);if(_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x3e')]){_0x46c652[_0x3a9f('0x3c')]=_[_0x3a9f('0x3f')](_0x46c652[_0x3a9f('0x3c')],{'$or':_[_0x3a9f('0x2b')](_0x32f8f2,function(_0xec6c6f){if(_0xec6c6f[_0x3a9f('0x2f')]!=='VIRTUAL'){var _0x3c7467={};_0x3c7467[_0xec6c6f['name']]={'$like':'%'+_0x22f709[_0x3a9f('0x31')]['filter']+'%'};return _0x3c7467;}})});}_0x46c652=_[_0x3a9f('0x3f')]({},_0x46c652,_0x22f709[_0x3a9f('0x40')]);var _0x33e4a2={'where':_0x46c652['where']};return db[_0x3a9f('0x2c')][_0x3a9f('0x21')](_0x33e4a2)['then'](function(_0x36da40){_0x5b8457[_0x3a9f('0x21')]=_0x36da40;if(_0x22f709[_0x3a9f('0x31')][_0x3a9f('0x41')]){_0x46c652[_0x3a9f('0x42')]=[{'all':!![]}];}return db[_0x3a9f('0x2c')][_0x3a9f('0x43')](_0x46c652);})[_0x3a9f('0x26')](function(_0x1669ea){_0x5b8457['rows']=_0x1669ea;return _0x5b8457;})[_0x3a9f('0x26')](respondWithFilteredResult(_0x191860,_0x46c652))[_0x3a9f('0x44')](handleError(_0x191860,null));};exports[_0x3a9f('0x45')]=function(_0x380a5d,_0x219210){var _0x317653={'raw':![],'where':{'id':_0x380a5d[_0x3a9f('0x46')]['id']}},_0xf83f4b={};_0xf83f4b[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db[_0x3a9f('0x2c')][_0x3a9f('0x2d')]);_0xf83f4b[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x380a5d['query']);_0xf83f4b[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0xf83f4b[_0x3a9f('0x30')],_0xf83f4b[_0x3a9f('0x31')]);_0x317653[_0x3a9f('0x34')]=_['intersection'](_0xf83f4b[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x380a5d['query'][_0x3a9f('0x36')]));_0x317653[_0x3a9f('0x34')]=_0x317653[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x317653[_0x3a9f('0x34')]:_0xf83f4b[_0x3a9f('0x30')];if(_0x380a5d['query'][_0x3a9f('0x41')]){_0x317653[_0x3a9f('0x42')]=[{'all':!![]}];}_0x317653=_[_0x3a9f('0x3f')]({},_0x317653,_0x380a5d[_0x3a9f('0x40')]);return db['VtigerConfiguration'][_0x3a9f('0x47')](_0x317653)['then'](handleEntityNotFound(_0x219210,null))[_0x3a9f('0x26')](respondWithResult(_0x219210,null))[_0x3a9f('0x44')](handleError(_0x219210,null));};exports[_0x3a9f('0x48')]=function(_0x1a38f0,_0x27214c){return db[_0x3a9f('0x2c')][_0x3a9f('0x48')](_0x1a38f0[_0x3a9f('0x49')],{})[_0x3a9f('0x26')](respondWithResult(_0x27214c,0xc9))[_0x3a9f('0x44')](handleError(_0x27214c,null));};exports[_0x3a9f('0x25')]=function(_0x46e5d2,_0x28279a){if(_0x46e5d2[_0x3a9f('0x49')]['id']){delete _0x46e5d2[_0x3a9f('0x49')]['id'];}return db['VtigerConfiguration'][_0x3a9f('0x47')]({'where':{'id':_0x46e5d2['params']['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x28279a,null))[_0x3a9f('0x26')](saveUpdates(_0x46e5d2[_0x3a9f('0x49')],null))[_0x3a9f('0x26')](respondWithResult(_0x28279a,null))[_0x3a9f('0x44')](handleError(_0x28279a,null));};exports[_0x3a9f('0x4a')]=function(_0x3c668a,_0x1fcc30){return db[_0x3a9f('0x2c')]['find']({'where':{'id':_0x3c668a[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x1fcc30,null))['then'](removeEntity(_0x1fcc30,null))['catch'](handleError(_0x1fcc30,null));};exports[_0x3a9f('0x4b')]=function(_0x4b161d,_0x3a60e2,_0x6af96d){var _0x54f13f={};var _0x516cff={};var _0x3d9287;var _0xedf346;return db[_0x3a9f('0x2c')][_0x3a9f('0x4c')]({'where':{'id':_0x4b161d[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x3a60e2,null))[_0x3a9f('0x26')](function(_0x541f27){if(_0x541f27){_0x3d9287=_0x541f27;_0x516cff[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db[_0x3a9f('0x4d')]['rawAttributes']);_0x516cff[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x4b161d[_0x3a9f('0x31')]);_0x516cff[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0x516cff[_0x3a9f('0x30')],_0x516cff[_0x3a9f('0x31')]);_0x54f13f[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0x516cff[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x4b161d[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x54f13f[_0x3a9f('0x34')]=_0x54f13f['attributes'][_0x3a9f('0x37')]?_0x54f13f[_0x3a9f('0x34')]:_0x516cff['model'];_0x54f13f[_0x3a9f('0x3a')]=qs[_0x3a9f('0x3b')](_0x4b161d[_0x3a9f('0x31')]['sort']);_0x54f13f[_0x3a9f('0x3c')]=qs[_0x3a9f('0x33')](_[_0x3a9f('0x3d')](_0x4b161d[_0x3a9f('0x31')],_0x516cff[_0x3a9f('0x33')]));if(_0x4b161d['query']['filter']){_0x54f13f['where']=_[_0x3a9f('0x3f')](_0x54f13f[_0x3a9f('0x3c')],{'$or':_['map'](_0x54f13f[_0x3a9f('0x34')],function(_0x2019b3){var _0x99679f={};_0x99679f[_0x2019b3]={'$like':'%'+_0x4b161d[_0x3a9f('0x31')][_0x3a9f('0x3e')]+'%'};return _0x99679f;})});}_0x54f13f=_[_0x3a9f('0x3f')]({},_0x54f13f,_0x4b161d[_0x3a9f('0x40')]);return _0x3d9287['getFields'](_0x54f13f);}})[_0x3a9f('0x26')](function(_0x5f7df5){if(_0x5f7df5){_0xedf346=_0x5f7df5[_0x3a9f('0x37')];if(!_0x4b161d['query'][_0x3a9f('0x38')](_0x3a9f('0x39'))){_0x54f13f[_0x3a9f('0x1f')]=qs[_0x3a9f('0x1f')](_0x4b161d[_0x3a9f('0x31')]['limit']);_0x54f13f[_0x3a9f('0x1e')]=qs[_0x3a9f('0x1e')](_0x4b161d[_0x3a9f('0x31')][_0x3a9f('0x1e')]);}return _0x3d9287[_0x3a9f('0x4b')](_0x54f13f);}})[_0x3a9f('0x26')](function(_0x588d58){if(_0x588d58){return _0x588d58?{'count':_0xedf346,'rows':_0x588d58}:null;}})['then'](respondWithResult(_0x3a60e2,null))['catch'](handleError(_0x3a60e2,null));};exports['getSubjects']=function(_0x4539ab,_0x36b0a7,_0x471691){var _0x5d64e3={};var _0x84029d={};var _0x18b332;var _0x41e744;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x4539ab[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x36b0a7,null))[_0x3a9f('0x26')](function(_0x408df5){if(_0x408df5){_0x18b332=_0x408df5;_0x84029d[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db['VtigerField'][_0x3a9f('0x2d')]);_0x84029d['query']=_[_0x3a9f('0x32')](_0x4539ab[_0x3a9f('0x31')]);_0x84029d[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0x84029d[_0x3a9f('0x30')],_0x84029d['query']);_0x5d64e3[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0x84029d[_0x3a9f('0x30')],qs['fields'](_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x5d64e3['attributes']=_0x5d64e3[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x5d64e3['attributes']:_0x84029d[_0x3a9f('0x30')];_0x5d64e3[_0x3a9f('0x3a')]=qs[_0x3a9f('0x3b')](_0x4539ab['query']['sort']);_0x5d64e3['where']=qs[_0x3a9f('0x33')](_[_0x3a9f('0x3d')](_0x4539ab[_0x3a9f('0x31')],_0x84029d[_0x3a9f('0x33')]));if(_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x3e')]){_0x5d64e3[_0x3a9f('0x3c')]=_[_0x3a9f('0x3f')](_0x5d64e3[_0x3a9f('0x3c')],{'$or':_[_0x3a9f('0x2b')](_0x5d64e3[_0x3a9f('0x34')],function(_0x4561e3){var _0x5ed001={};_0x5ed001[_0x4561e3]={'$like':'%'+_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x3e')]+'%'};return _0x5ed001;})});}_0x5d64e3=_['merge']({},_0x5d64e3,_0x4539ab[_0x3a9f('0x40')]);return _0x18b332[_0x3a9f('0x4e')](_0x5d64e3);}})[_0x3a9f('0x26')](function(_0x303c11){if(_0x303c11){_0x41e744=_0x303c11[_0x3a9f('0x37')];if(!_0x4539ab['query']['hasOwnProperty'](_0x3a9f('0x39'))){_0x5d64e3[_0x3a9f('0x1f')]=qs[_0x3a9f('0x1f')](_0x4539ab[_0x3a9f('0x31')][_0x3a9f('0x1f')]);_0x5d64e3[_0x3a9f('0x1e')]=qs['offset'](_0x4539ab['query'][_0x3a9f('0x1e')]);}return _0x18b332[_0x3a9f('0x4e')](_0x5d64e3);}})[_0x3a9f('0x26')](function(_0x24dabf){if(_0x24dabf){return _0x24dabf?{'count':_0x41e744,'rows':_0x24dabf}:null;}})[_0x3a9f('0x26')](respondWithResult(_0x36b0a7,null))[_0x3a9f('0x44')](handleError(_0x36b0a7,null));};exports[_0x3a9f('0x4f')]=function(_0x2ce31a,_0x1692ed,_0x48ff50){var _0x36cbc0={};var _0xae8e70={};var _0x14fe0d;var _0x351105;return db[_0x3a9f('0x2c')][_0x3a9f('0x4c')]({'where':{'id':_0x2ce31a[_0x3a9f('0x46')]['id']}})[_0x3a9f('0x26')](handleEntityNotFound(_0x1692ed,null))['then'](function(_0x525c00){if(_0x525c00){_0x14fe0d=_0x525c00;_0xae8e70[_0x3a9f('0x30')]=_[_0x3a9f('0x32')](db[_0x3a9f('0x4d')][_0x3a9f('0x2d')]);_0xae8e70[_0x3a9f('0x31')]=_[_0x3a9f('0x32')](_0x2ce31a[_0x3a9f('0x31')]);_0xae8e70[_0x3a9f('0x33')]=_[_0x3a9f('0x35')](_0xae8e70[_0x3a9f('0x30')],_0xae8e70[_0x3a9f('0x31')]);_0x36cbc0[_0x3a9f('0x34')]=_[_0x3a9f('0x35')](_0xae8e70[_0x3a9f('0x30')],qs[_0x3a9f('0x36')](_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x36')]));_0x36cbc0[_0x3a9f('0x34')]=_0x36cbc0[_0x3a9f('0x34')][_0x3a9f('0x37')]?_0x36cbc0[_0x3a9f('0x34')]:_0xae8e70['model'];_0x36cbc0['order']=qs[_0x3a9f('0x3b')](_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x3b')]);_0x36cbc0[_0x3a9f('0x3c')]=qs['filters'](_['pick'](_0x2ce31a[_0x3a9f('0x31')],_0xae8e70[_0x3a9f('0x33')]));if(_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x3e')]){_0x36cbc0[_0x3a9f('0x3c')]=_[_0x3a9f('0x3f')](_0x36cbc0[_0x3a9f('0x3c')],{'$or':_[_0x3a9f('0x2b')](_0x36cbc0[_0x3a9f('0x34')],function(_0x418da2){var _0x289a62={};_0x289a62[_0x418da2]={'$like':'%'+_0x2ce31a['query'][_0x3a9f('0x3e')]+'%'};return _0x289a62;})});}_0x36cbc0=_[_0x3a9f('0x3f')]({},_0x36cbc0,_0x2ce31a['options']);return _0x14fe0d[_0x3a9f('0x4f')](_0x36cbc0);}})['then'](function(_0x3008bf){if(_0x3008bf){_0x351105=_0x3008bf['length'];if(!_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x38')](_0x3a9f('0x39'))){_0x36cbc0[_0x3a9f('0x1f')]=qs[_0x3a9f('0x1f')](_0x2ce31a['query'][_0x3a9f('0x1f')]);_0x36cbc0[_0x3a9f('0x1e')]=qs[_0x3a9f('0x1e')](_0x2ce31a[_0x3a9f('0x31')][_0x3a9f('0x1e')]);}return _0x14fe0d[_0x3a9f('0x4f')](_0x36cbc0);}})[_0x3a9f('0x26')](function(_0xd30ee1){if(_0xd30ee1){return _0xd30ee1?{'count':_0x351105,'rows':_0xd30ee1}:null;}})[_0x3a9f('0x26')](respondWithResult(_0x1692ed,null))[_0x3a9f('0x44')](handleError(_0x1692ed,null));}; \ No newline at end of file +var _0x5fb0=['mustache','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../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','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','pick','getSubjects','VtigerField','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x290c43,_0x3764d6){var _0x3155bc=function(_0x2f4919){while(--_0x2f4919){_0x290c43['push'](_0x290c43['shift']());}};_0x3155bc(++_0x3764d6);}(_0x5fb0,0x134));var _0x05fb=function(_0x5232bb,_0x4fcb6c){_0x5232bb=_0x5232bb-0x0;var _0x2ba6d1=_0x5fb0[_0x5232bb];return _0x2ba6d1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05fb('0x0'));var jsonpatch=require(_0x05fb('0x1'));var rp=require(_0x05fb('0x2'));var moment=require('moment');var BPromise=require(_0x05fb('0x3'));var Mustache=require(_0x05fb('0x4'));var util=require('util');var path=require(_0x05fb('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05fb('0x6'));var _=require(_0x05fb('0x7'));var squel=require(_0x05fb('0x8'));var crypto=require('crypto');var jsforce=require(_0x05fb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x05fb('0xa'));var querystring=require(_0x05fb('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x05fb('0xc'));var qs=require(_0x05fb('0xd'));var as=require(_0x05fb('0xe'));var hardwareService=require(_0x05fb('0xf'));var logger=require('../../config/logger')(_0x05fb('0x10'));var utils=require(_0x05fb('0x11'));var config=require(_0x05fb('0x12'));var licenseUtil=require(_0x05fb('0x13'));var db=require(_0x05fb('0x14'))['db'];function respondWithStatusCode(_0x35749a,_0x2b7794){_0x2b7794=_0x2b7794||0xcc;return function(_0x30f52d){if(_0x30f52d){return _0x35749a[_0x05fb('0x15')](_0x2b7794);}return _0x35749a['status'](_0x2b7794)[_0x05fb('0x16')]();};}function respondWithResult(_0x293a77,_0xf12952){_0xf12952=_0xf12952||0xc8;return function(_0x58625f){if(_0x58625f){return _0x293a77[_0x05fb('0x17')](_0xf12952)[_0x05fb('0x18')](_0x58625f);}};}function respondWithFilteredResult(_0x1eeef2,_0x570d23){return function(_0x514709){if(_0x514709){var _0x1e89e7=typeof _0x570d23[_0x05fb('0x19')]===_0x05fb('0x1a')&&typeof _0x570d23['limit']===_0x05fb('0x1a');var _0x5ed2b1=_0x514709[_0x05fb('0x1b')];var _0x35bdba=_0x1e89e7?0x0:_0x570d23[_0x05fb('0x19')];var _0xd59cb8=_0x1e89e7?_0x514709['count']:_0x570d23[_0x05fb('0x19')]+_0x570d23[_0x05fb('0x1c')];var _0x1d2187;if(_0xd59cb8>=_0x5ed2b1){_0xd59cb8=_0x5ed2b1;_0x1d2187=0xc8;}else{_0x1d2187=0xce;}_0x1eeef2['status'](_0x1d2187);return _0x1eeef2[_0x05fb('0x1d')](_0x05fb('0x1e'),_0x35bdba+'-'+_0xd59cb8+'/'+_0x5ed2b1)[_0x05fb('0x18')](_0x514709);}return null;};}function patchUpdates(_0x356e55){return function(_0xf50d4){try{jsonpatch['apply'](_0xf50d4,_0x356e55,!![]);}catch(_0xe3e9cc){return BPromise[_0x05fb('0x1f')](_0xe3e9cc);}return _0xf50d4[_0x05fb('0x20')]();};}function saveUpdates(_0x3924b,_0x3b02f9){return function(_0x57cd80){if(_0x57cd80){return _0x57cd80[_0x05fb('0x21')](_0x3924b)[_0x05fb('0x22')](function(_0x218862){return _0x218862;});}return null;};}function removeEntity(_0x631d95,_0x45bdc7){return function(_0x5d99f3){if(_0x5d99f3){return _0x5d99f3[_0x05fb('0x23')]()['then'](function(){_0x631d95[_0x05fb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x616311,_0x4e855d){return function(_0x5b94ef){if(!_0x5b94ef){_0x616311[_0x05fb('0x15')](0x194);}return _0x5b94ef;};}function handleError(_0x1b7e9a,_0x4b53ef){_0x4b53ef=_0x4b53ef||0x1f4;return function(_0x3c1913){logger[_0x05fb('0x24')](_0x3c1913[_0x05fb('0x25')]);if(_0x3c1913['name']){delete _0x3c1913[_0x05fb('0x26')];}_0x1b7e9a[_0x05fb('0x17')](_0x4b53ef)[_0x05fb('0x27')](_0x3c1913);};}exports['index']=function(_0x4df881,_0x563bf9){var _0x47d1ae={},_0x19d710={},_0x4e9a4c={'count':0x0,'rows':[]};var _0x476ea1=_[_0x05fb('0x28')](db[_0x05fb('0x29')][_0x05fb('0x2a')],function(_0x47488e){return{'name':_0x47488e[_0x05fb('0x2b')],'type':_0x47488e[_0x05fb('0x2c')]['key']};});_0x19d710[_0x05fb('0x2d')]=_['map'](_0x476ea1,_0x05fb('0x26'));_0x19d710['query']=_[_0x05fb('0x2e')](_0x4df881[_0x05fb('0x2f')]);_0x19d710[_0x05fb('0x30')]=_['intersection'](_0x19d710[_0x05fb('0x2d')],_0x19d710[_0x05fb('0x2f')]);_0x47d1ae[_0x05fb('0x31')]=_[_0x05fb('0x32')](_0x19d710['model'],qs[_0x05fb('0x33')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x47d1ae[_0x05fb('0x31')]=_0x47d1ae[_0x05fb('0x31')][_0x05fb('0x34')]?_0x47d1ae[_0x05fb('0x31')]:_0x19d710[_0x05fb('0x2d')];if(!_0x4df881['query'][_0x05fb('0x35')](_0x05fb('0x36'))){_0x47d1ae['limit']=qs[_0x05fb('0x1c')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x1c')]);_0x47d1ae[_0x05fb('0x19')]=qs[_0x05fb('0x19')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x19')]);}_0x47d1ae[_0x05fb('0x37')]=qs[_0x05fb('0x38')](_0x4df881[_0x05fb('0x2f')][_0x05fb('0x38')]);_0x47d1ae[_0x05fb('0x39')]=qs['filters'](_['pick'](_0x4df881['query'],_0x19d710['filters']),_0x476ea1);if(_0x4df881[_0x05fb('0x2f')][_0x05fb('0x3a')]){_0x47d1ae[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x47d1ae['where'],{'$or':_[_0x05fb('0x28')](_0x476ea1,function(_0x52754f){if(_0x52754f['type']!==_0x05fb('0x3c')){var _0x38ba17={};_0x38ba17[_0x52754f[_0x05fb('0x26')]]={'$like':'%'+_0x4df881[_0x05fb('0x2f')]['filter']+'%'};return _0x38ba17;}})});}_0x47d1ae=_['merge']({},_0x47d1ae,_0x4df881['options']);var _0x3e0299={'where':_0x47d1ae[_0x05fb('0x39')]};return db[_0x05fb('0x29')][_0x05fb('0x1b')](_0x3e0299)['then'](function(_0x461253){_0x4e9a4c[_0x05fb('0x1b')]=_0x461253;if(_0x4df881[_0x05fb('0x2f')][_0x05fb('0x3d')]){_0x47d1ae[_0x05fb('0x3e')]=[{'all':!![]}];}return db[_0x05fb('0x29')][_0x05fb('0x3f')](_0x47d1ae);})[_0x05fb('0x22')](function(_0x16ed09){_0x4e9a4c[_0x05fb('0x40')]=_0x16ed09;return _0x4e9a4c;})[_0x05fb('0x22')](respondWithFilteredResult(_0x563bf9,_0x47d1ae))[_0x05fb('0x41')](handleError(_0x563bf9,null));};exports[_0x05fb('0x42')]=function(_0x232fca,_0x3545cf){var _0x3f56f8={'raw':![],'where':{'id':_0x232fca[_0x05fb('0x43')]['id']}},_0x4db1c0={};_0x4db1c0[_0x05fb('0x2d')]=_[_0x05fb('0x2e')](db[_0x05fb('0x29')]['rawAttributes']);_0x4db1c0[_0x05fb('0x2f')]=_[_0x05fb('0x2e')](_0x232fca[_0x05fb('0x2f')]);_0x4db1c0['filters']=_[_0x05fb('0x32')](_0x4db1c0[_0x05fb('0x2d')],_0x4db1c0['query']);_0x3f56f8[_0x05fb('0x31')]=_[_0x05fb('0x32')](_0x4db1c0[_0x05fb('0x2d')],qs['fields'](_0x232fca[_0x05fb('0x2f')]['fields']));_0x3f56f8[_0x05fb('0x31')]=_0x3f56f8['attributes'][_0x05fb('0x34')]?_0x3f56f8[_0x05fb('0x31')]:_0x4db1c0[_0x05fb('0x2d')];if(_0x232fca[_0x05fb('0x2f')][_0x05fb('0x3d')]){_0x3f56f8['include']=[{'all':!![]}];}_0x3f56f8=_[_0x05fb('0x3b')]({},_0x3f56f8,_0x232fca[_0x05fb('0x44')]);return db[_0x05fb('0x29')][_0x05fb('0x45')](_0x3f56f8)[_0x05fb('0x22')](handleEntityNotFound(_0x3545cf,null))[_0x05fb('0x22')](respondWithResult(_0x3545cf,null))[_0x05fb('0x41')](handleError(_0x3545cf,null));};exports[_0x05fb('0x46')]=function(_0x3eff24,_0x3bc1fa){return db[_0x05fb('0x29')][_0x05fb('0x46')](_0x3eff24[_0x05fb('0x47')],{})['then'](respondWithResult(_0x3bc1fa,0xc9))[_0x05fb('0x41')](handleError(_0x3bc1fa,null));};exports[_0x05fb('0x21')]=function(_0x7b6b5d,_0xdb5adb){if(_0x7b6b5d[_0x05fb('0x47')]['id']){delete _0x7b6b5d[_0x05fb('0x47')]['id'];}return db[_0x05fb('0x29')][_0x05fb('0x45')]({'where':{'id':_0x7b6b5d[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0xdb5adb,null))['then'](saveUpdates(_0x7b6b5d[_0x05fb('0x47')],null))[_0x05fb('0x22')](respondWithResult(_0xdb5adb,null))[_0x05fb('0x41')](handleError(_0xdb5adb,null));};exports[_0x05fb('0x23')]=function(_0x52c5fe,_0x5993ad){return db[_0x05fb('0x29')][_0x05fb('0x45')]({'where':{'id':_0x52c5fe[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0x5993ad,null))[_0x05fb('0x22')](removeEntity(_0x5993ad,null))[_0x05fb('0x41')](handleError(_0x5993ad,null));};exports[_0x05fb('0x48')]=function(_0x189caf,_0x423fec,_0x2e6602){var _0x4bc480={};var _0x3d6729={};var _0x170797;var _0x37f321;return db[_0x05fb('0x29')][_0x05fb('0x49')]({'where':{'id':_0x189caf[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0x423fec,null))[_0x05fb('0x22')](function(_0x50f71d){if(_0x50f71d){_0x170797=_0x50f71d;_0x3d6729['model']=_['keys'](db['VtigerField'][_0x05fb('0x2a')]);_0x3d6729[_0x05fb('0x2f')]=_['keys'](_0x189caf[_0x05fb('0x2f')]);_0x3d6729[_0x05fb('0x30')]=_['intersection'](_0x3d6729[_0x05fb('0x2d')],_0x3d6729['query']);_0x4bc480['attributes']=_['intersection'](_0x3d6729[_0x05fb('0x2d')],qs[_0x05fb('0x33')](_0x189caf[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x4bc480['attributes']=_0x4bc480[_0x05fb('0x31')]['length']?_0x4bc480['attributes']:_0x3d6729['model'];_0x4bc480[_0x05fb('0x37')]=qs[_0x05fb('0x38')](_0x189caf[_0x05fb('0x2f')]['sort']);_0x4bc480[_0x05fb('0x39')]=qs['filters'](_[_0x05fb('0x4a')](_0x189caf['query'],_0x3d6729['filters']));if(_0x189caf[_0x05fb('0x2f')][_0x05fb('0x3a')]){_0x4bc480[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x4bc480['where'],{'$or':_[_0x05fb('0x28')](_0x4bc480['attributes'],function(_0x48ae50){var _0x438fe5={};_0x438fe5[_0x48ae50]={'$like':'%'+_0x189caf[_0x05fb('0x2f')]['filter']+'%'};return _0x438fe5;})});}_0x4bc480=_['merge']({},_0x4bc480,_0x189caf[_0x05fb('0x44')]);return _0x170797[_0x05fb('0x48')](_0x4bc480);}})['then'](function(_0x84472f){if(_0x84472f){_0x37f321=_0x84472f['length'];if(!_0x189caf[_0x05fb('0x2f')][_0x05fb('0x35')]('nolimit')){_0x4bc480[_0x05fb('0x1c')]=qs[_0x05fb('0x1c')](_0x189caf[_0x05fb('0x2f')][_0x05fb('0x1c')]);_0x4bc480[_0x05fb('0x19')]=qs['offset'](_0x189caf[_0x05fb('0x2f')][_0x05fb('0x19')]);}return _0x170797[_0x05fb('0x48')](_0x4bc480);}})[_0x05fb('0x22')](function(_0xb693b4){if(_0xb693b4){return _0xb693b4?{'count':_0x37f321,'rows':_0xb693b4}:null;}})['then'](respondWithResult(_0x423fec,null))[_0x05fb('0x41')](handleError(_0x423fec,null));};exports[_0x05fb('0x4b')]=function(_0x4ab56f,_0xe33f4d,_0xfb9a65){var _0x300f2d={};var _0x4c0986={};var _0x12ea63;var _0x49f6db;return db['VtigerConfiguration'][_0x05fb('0x49')]({'where':{'id':_0x4ab56f[_0x05fb('0x43')]['id']}})[_0x05fb('0x22')](handleEntityNotFound(_0xe33f4d,null))[_0x05fb('0x22')](function(_0x53b071){if(_0x53b071){_0x12ea63=_0x53b071;_0x4c0986[_0x05fb('0x2d')]=_[_0x05fb('0x2e')](db[_0x05fb('0x4c')]['rawAttributes']);_0x4c0986[_0x05fb('0x2f')]=_[_0x05fb('0x2e')](_0x4ab56f[_0x05fb('0x2f')]);_0x4c0986[_0x05fb('0x30')]=_[_0x05fb('0x32')](_0x4c0986[_0x05fb('0x2d')],_0x4c0986[_0x05fb('0x2f')]);_0x300f2d['attributes']=_[_0x05fb('0x32')](_0x4c0986[_0x05fb('0x2d')],qs[_0x05fb('0x33')](_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x300f2d['attributes']=_0x300f2d[_0x05fb('0x31')]['length']?_0x300f2d[_0x05fb('0x31')]:_0x4c0986[_0x05fb('0x2d')];_0x300f2d['order']=qs[_0x05fb('0x38')](_0x4ab56f['query'][_0x05fb('0x38')]);_0x300f2d['where']=qs[_0x05fb('0x30')](_['pick'](_0x4ab56f['query'],_0x4c0986[_0x05fb('0x30')]));if(_0x4ab56f['query'][_0x05fb('0x3a')]){_0x300f2d[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x300f2d[_0x05fb('0x39')],{'$or':_[_0x05fb('0x28')](_0x300f2d[_0x05fb('0x31')],function(_0x2ea6fe){var _0x244d7e={};_0x244d7e[_0x2ea6fe]={'$like':'%'+_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x3a')]+'%'};return _0x244d7e;})});}_0x300f2d=_[_0x05fb('0x3b')]({},_0x300f2d,_0x4ab56f['options']);return _0x12ea63[_0x05fb('0x4b')](_0x300f2d);}})[_0x05fb('0x22')](function(_0x3c7a2c){if(_0x3c7a2c){_0x49f6db=_0x3c7a2c['length'];if(!_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x35')](_0x05fb('0x36'))){_0x300f2d[_0x05fb('0x1c')]=qs[_0x05fb('0x1c')](_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x1c')]);_0x300f2d[_0x05fb('0x19')]=qs[_0x05fb('0x19')](_0x4ab56f[_0x05fb('0x2f')][_0x05fb('0x19')]);}return _0x12ea63[_0x05fb('0x4b')](_0x300f2d);}})[_0x05fb('0x22')](function(_0xf23c68){if(_0xf23c68){return _0xf23c68?{'count':_0x49f6db,'rows':_0xf23c68}:null;}})['then'](respondWithResult(_0xe33f4d,null))[_0x05fb('0x41')](handleError(_0xe33f4d,null));};exports[_0x05fb('0x4d')]=function(_0x30a0c4,_0x25bc39,_0x395f80){var _0x16c462={};var _0x41d857={};var _0xff0a6d;var _0x2725ab;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x30a0c4[_0x05fb('0x43')]['id']}})['then'](handleEntityNotFound(_0x25bc39,null))[_0x05fb('0x22')](function(_0x5c50ee){if(_0x5c50ee){_0xff0a6d=_0x5c50ee;_0x41d857[_0x05fb('0x2d')]=_[_0x05fb('0x2e')](db[_0x05fb('0x4c')][_0x05fb('0x2a')]);_0x41d857[_0x05fb('0x2f')]=_['keys'](_0x30a0c4[_0x05fb('0x2f')]);_0x41d857[_0x05fb('0x30')]=_[_0x05fb('0x32')](_0x41d857[_0x05fb('0x2d')],_0x41d857[_0x05fb('0x2f')]);_0x16c462[_0x05fb('0x31')]=_[_0x05fb('0x32')](_0x41d857[_0x05fb('0x2d')],qs[_0x05fb('0x33')](_0x30a0c4[_0x05fb('0x2f')][_0x05fb('0x33')]));_0x16c462[_0x05fb('0x31')]=_0x16c462[_0x05fb('0x31')]['length']?_0x16c462[_0x05fb('0x31')]:_0x41d857[_0x05fb('0x2d')];_0x16c462[_0x05fb('0x37')]=qs[_0x05fb('0x38')](_0x30a0c4[_0x05fb('0x2f')][_0x05fb('0x38')]);_0x16c462[_0x05fb('0x39')]=qs[_0x05fb('0x30')](_['pick'](_0x30a0c4[_0x05fb('0x2f')],_0x41d857['filters']));if(_0x30a0c4[_0x05fb('0x2f')][_0x05fb('0x3a')]){_0x16c462[_0x05fb('0x39')]=_[_0x05fb('0x3b')](_0x16c462['where'],{'$or':_[_0x05fb('0x28')](_0x16c462[_0x05fb('0x31')],function(_0x387462){var _0x3568de={};_0x3568de[_0x387462]={'$like':'%'+_0x30a0c4['query'][_0x05fb('0x3a')]+'%'};return _0x3568de;})});}_0x16c462=_['merge']({},_0x16c462,_0x30a0c4[_0x05fb('0x44')]);return _0xff0a6d[_0x05fb('0x4d')](_0x16c462);}})[_0x05fb('0x22')](function(_0x444259){if(_0x444259){_0x2725ab=_0x444259[_0x05fb('0x34')];if(!_0x30a0c4['query']['hasOwnProperty'](_0x05fb('0x36'))){_0x16c462['limit']=qs[_0x05fb('0x1c')](_0x30a0c4[_0x05fb('0x2f')]['limit']);_0x16c462[_0x05fb('0x19')]=qs[_0x05fb('0x19')](_0x30a0c4['query'][_0x05fb('0x19')]);}return _0xff0a6d[_0x05fb('0x4d')](_0x16c462);}})[_0x05fb('0x22')](function(_0x3cfb7b){if(_0x3cfb7b){return _0x3cfb7b?{'count':_0x2725ab,'rows':_0x3cfb7b}:null;}})['then'](respondWithResult(_0x25bc39,null))[_0x05fb('0x41')](handleError(_0x25bc39,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f88a9ca..4037ab4 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 _0xf7b9=['api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x3812a4,_0xee8400){var _0x1415c2=function(_0x33ece0){while(--_0x33ece0){_0x3812a4['push'](_0x3812a4['shift']());}};_0x1415c2(++_0xee8400);}(_0xf7b9,0xe7));var _0x9f7b=function(_0x1ca915,_0x162aba){_0x1ca915=_0x1ca915-0x0;var _0x58e8dd=_0xf7b9[_0x1ca915];return _0x58e8dd;};'use strict';var _=require(_0x9f7b('0x0'));var util=require(_0x9f7b('0x1'));var logger=require(_0x9f7b('0x2'))(_0x9f7b('0x3'));var moment=require(_0x9f7b('0x4'));var BPromise=require(_0x9f7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f7b('0x6'));var rimraf=require(_0x9f7b('0x7'));var config=require(_0x9f7b('0x8'));var attributes=require(_0x9f7b('0x9'));module[_0x9f7b('0xa')]=function(_0x274305,_0x42b045){return _0x274305[_0x9f7b('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x9f7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b07=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash'];(function(_0x5282cd,_0xb65881){var _0xe5b28e=function(_0x2882d9){while(--_0x2882d9){_0x5282cd['push'](_0x5282cd['shift']());}};_0xe5b28e(++_0xb65881);}(_0x1b07,0x153));var _0x71b0=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x1b07[_0x26f1b2];return _0x1624a4;};'use strict';var _=require(_0x71b0('0x0'));var util=require('util');var logger=require(_0x71b0('0x1'))('api');var moment=require(_0x71b0('0x2'));var BPromise=require(_0x71b0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71b0('0x4'));var rimraf=require(_0x71b0('0x5'));var config=require(_0x71b0('0x6'));var attributes=require(_0x71b0('0x7'));module['exports']=function(_0x25518e,_0x6578ca){return _0x25518e[_0x71b0('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x71b0('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 ad04a2c..b2822c2 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 _0xedf0=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','debug'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xedf0,0x143));var _0x0edf=function(_0x3eb4ae,_0x493c5b){_0x3eb4ae=_0x3eb4ae-0x0;var _0x1aa0d4=_0xedf0[_0x3eb4ae];return _0x1aa0d4;};'use strict';var _=require(_0x0edf('0x0'));var util=require(_0x0edf('0x1'));var moment=require(_0x0edf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0edf('0x3'))['db'];var utils=require(_0x0edf('0x4'));var logger=require('../../config/logger')(_0x0edf('0x5'));var config=require(_0x0edf('0x6'));var jayson=require(_0x0edf('0x7'));var client=jayson['client'][_0x0edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x414b8d,_0x28557e,_0x12619c){return new BPromise(function(_0x41559f,_0x2aad2a){return client['request'](_0x414b8d,_0x12619c)[_0x0edf('0x9')](function(_0xfdb37a){logger[_0x0edf('0xa')](_0x0edf('0xb'),_0x28557e,'request\x20sent');logger[_0x0edf('0xc')](_0x0edf('0xd'),_0x28557e,_0x0edf('0xe'),JSON[_0x0edf('0xf')](_0xfdb37a));if(_0xfdb37a[_0x0edf('0x10')]){if(_0xfdb37a[_0x0edf('0x10')][_0x0edf('0x11')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x28557e,_0xfdb37a['error'][_0x0edf('0x12')]);return _0x2aad2a(_0xfdb37a[_0x0edf('0x10')]['message']);}logger[_0x0edf('0x10')](_0x0edf('0xb'),_0x28557e,_0xfdb37a[_0x0edf('0x10')]['message']);return _0x41559f(_0xfdb37a[_0x0edf('0x10')][_0x0edf('0x12')]);}else{logger[_0x0edf('0xa')](_0x0edf('0xb'),_0x28557e,_0x0edf('0xe'));_0x41559f(_0xfdb37a[_0x0edf('0x13')][_0x0edf('0x12')]);}})[_0x0edf('0x14')](function(_0x440df3){logger['error'](_0x0edf('0xb'),_0x28557e,_0x440df3);_0x2aad2a(_0x440df3);});});} \ No newline at end of file +var _0xa92d=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xa92d,0x1c7));var _0xda92=function(_0xd684fd,_0x62eef1){_0xd684fd=_0xd684fd-0x0;var _0x2cb8eb=_0xa92d[_0xd684fd];return _0x2cb8eb;};'use strict';var _=require(_0xda92('0x0'));var util=require(_0xda92('0x1'));var moment=require(_0xda92('0x2'));var BPromise=require(_0xda92('0x3'));var rs=require(_0xda92('0x4'));var fs=require('fs');var Redis=require(_0xda92('0x5'));var db=require(_0xda92('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda92('0x7'))('rpc');var config=require(_0xda92('0x8'));var jayson=require(_0xda92('0x9'));var client=jayson[_0xda92('0xa')][_0xda92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b2219,_0x49d386,_0x52131d){return new BPromise(function(_0x34d4e6,_0x176529){return client[_0xda92('0xc')](_0x4b2219,_0x52131d)['then'](function(_0x27f622){logger[_0xda92('0xd')](_0xda92('0xe'),_0x49d386,'request\x20sent');logger['debug'](_0xda92('0xf'),_0x49d386,_0xda92('0x10'),JSON[_0xda92('0x11')](_0x27f622));if(_0x27f622[_0xda92('0x12')]){if(_0x27f622['error'][_0xda92('0x13')]===0x1f4){logger[_0xda92('0x12')](_0xda92('0xe'),_0x49d386,_0x27f622[_0xda92('0x12')]['message']);return _0x176529(_0x27f622[_0xda92('0x12')][_0xda92('0x14')]);}logger[_0xda92('0x12')](_0xda92('0xe'),_0x49d386,_0x27f622['error'][_0xda92('0x14')]);return _0x34d4e6(_0x27f622[_0xda92('0x12')][_0xda92('0x14')]);}else{logger['info'](_0xda92('0xe'),_0x49d386,_0xda92('0x10'));_0x34d4e6(_0x27f622[_0xda92('0x15')][_0xda92('0x14')]);}})[_0xda92('0x16')](function(_0x1a7a7f){logger[_0xda92('0x12')](_0xda92('0xe'),_0x49d386,_0x1a7a7f);_0x176529(_0x1a7a7f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5c7b15f..234ccf0 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 _0x875b=['post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x593a37,_0x20ac5b){var _0x4bde96=function(_0x236f2d){while(--_0x236f2d){_0x593a37['push'](_0x593a37['shift']());}};_0x4bde96(++_0x20ac5b);}(_0x875b,0x6a));var _0xb875=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0x875b[_0x3a5648];return _0x34126d;};'use strict';var multer=require('multer');var util=require(_0xb875('0x0'));var path=require(_0xb875('0x1'));var timeout=require(_0xb875('0x2'));var express=require(_0xb875('0x3'));var router=express[_0xb875('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb875('0x5'));var interaction=require(_0xb875('0x6'));var config=require(_0xb875('0x7'));var controller=require(_0xb875('0x8'));router[_0xb875('0x9')]('/',auth[_0xb875('0xa')](),controller[_0xb875('0xb')]);router[_0xb875('0x9')](_0xb875('0xc'),auth[_0xb875('0xa')](),controller[_0xb875('0xd')]);router[_0xb875('0xe')]('/',auth['isAuthenticated'](),controller[_0xb875('0xf')]);router[_0xb875('0x10')](_0xb875('0xc'),auth['isAuthenticated'](),controller[_0xb875('0x11')]);router[_0xb875('0x12')](_0xb875('0xc'),auth['isAuthenticated'](),controller[_0xb875('0x13')]);module['exports']=router; \ No newline at end of file +var _0xaa5f=['get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./intVtigerField.controller'];(function(_0x5d7299,_0x544bc0){var _0x3125ea=function(_0x464bbd){while(--_0x464bbd){_0x5d7299['push'](_0x5d7299['shift']());}};_0x3125ea(++_0x544bc0);}(_0xaa5f,0x1ba));var _0xfaa5=function(_0x4b97da,_0x2ea8c4){_0x4b97da=_0x4b97da-0x0;var _0x32457c=_0xaa5f[_0x4b97da];return _0x32457c;};'use strict';var multer=require('multer');var util=require(_0xfaa5('0x0'));var path=require(_0xfaa5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfaa5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfaa5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfaa5('0x4'));var controller=require(_0xfaa5('0x5'));router[_0xfaa5('0x6')]('/',auth[_0xfaa5('0x7')](),controller[_0xfaa5('0x8')]);router['get'](_0xfaa5('0x9'),auth['isAuthenticated'](),controller[_0xfaa5('0xa')]);router[_0xfaa5('0xb')]('/',auth[_0xfaa5('0x7')](),controller['create']);router['put'](_0xfaa5('0x9'),auth['isAuthenticated'](),controller[_0xfaa5('0xc')]);router[_0xfaa5('0xd')](_0xfaa5('0x9'),auth['isAuthenticated'](),controller[_0xfaa5('0xe')]);module[_0xfaa5('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 3d7a45b..32945cf 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 _0x6b96=['sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b96,0x14a));var _0x66b9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6b96[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x66b9('0x0'));module[_0x66b9('0x1')]={'type':{'type':Sequelize[_0x66b9('0x2')]('string','variable',_0x66b9('0x3'),_0x66b9('0x4'),_0x66b9('0x5')),'defaultValue':_0x66b9('0x6')},'content':{'type':Sequelize[_0x66b9('0x7')]},'key':{'type':Sequelize[_0x66b9('0x7')]},'keyType':{'type':Sequelize[_0x66b9('0x2')]('string',_0x66b9('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x66b9('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x66b9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x84c7=['exports','variable','customVariable','picklist','string','STRING','ENUM','sequelize'];(function(_0x43379c,_0x271d36){var _0x495648=function(_0x3f4652){while(--_0x3f4652){_0x43379c['push'](_0x43379c['shift']());}};_0x495648(++_0x271d36);}(_0x84c7,0x14f));var _0x784c=function(_0x2c5f35,_0x52cfec){_0x2c5f35=_0x2c5f35-0x0;var _0x537dcd=_0x84c7[_0x2c5f35];return _0x537dcd;};'use strict';var Sequelize=require(_0x784c('0x0'));module[_0x784c('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x784c('0x2'),_0x784c('0x3'),'keyValue',_0x784c('0x4')),'defaultValue':_0x784c('0x5')},'content':{'type':Sequelize[_0x784c('0x6')]},'key':{'type':Sequelize[_0x784c('0x6')]},'keyType':{'type':Sequelize[_0x784c('0x7')](_0x784c('0x5'),_0x784c('0x2'),_0x784c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x784c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a4c79dd..2cbb49b 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 _0x4754=['fields','attributes','length','hasOwnProperty','nolimit','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','end','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x4cda69,_0x5187b5){var _0x5060f4=function(_0x4de2be){while(--_0x4de2be){_0x4cda69['push'](_0x4cda69['shift']());}};_0x5060f4(++_0x5187b5);}(_0x4754,0x135));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4475('0x0'));var rimraf=require(_0x4475('0x1'));var zipdir=require(_0x4475('0x2'));var jsonpatch=require(_0x4475('0x3'));var rp=require('request-promise');var moment=require(_0x4475('0x4'));var BPromise=require(_0x4475('0x5'));var Mustache=require(_0x4475('0x6'));var util=require('util');var path=require(_0x4475('0x7'));var sox=require(_0x4475('0x8'));var csv=require(_0x4475('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4475('0xa'));var squel=require(_0x4475('0xb'));var crypto=require('crypto');var jsforce=require(_0x4475('0xc'));var deskjs=require(_0x4475('0xd'));var toCsv=require(_0x4475('0x9'));var querystring=require(_0x4475('0xe'));var Papa=require(_0x4475('0xf'));var Redis=require('ioredis');var authService=require(_0x4475('0x10'));var qs=require(_0x4475('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4475('0x12'));var logger=require(_0x4475('0x13'))(_0x4475('0x14'));var utils=require(_0x4475('0x15'));var config=require(_0x4475('0x16'));var licenseUtil=require(_0x4475('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fb542,_0x593405){_0x593405=_0x593405||0xcc;return function(_0x23e92c){if(_0x23e92c){return _0x2fb542[_0x4475('0x18')](_0x593405);}return _0x2fb542['status'](_0x593405)['end']();};}function respondWithResult(_0x1588a8,_0x23690a){_0x23690a=_0x23690a||0xc8;return function(_0x596007){if(_0x596007){return _0x1588a8[_0x4475('0x19')](_0x23690a)['json'](_0x596007);}};}function respondWithFilteredResult(_0x1c65af,_0x3da95d){return function(_0x238004){if(_0x238004){var _0x1a5a6f=typeof _0x3da95d[_0x4475('0x1a')]===_0x4475('0x1b')&&typeof _0x3da95d[_0x4475('0x1c')]===_0x4475('0x1b');var _0x5cd8c4=_0x238004[_0x4475('0x1d')];var _0x4879e2=_0x1a5a6f?0x0:_0x3da95d[_0x4475('0x1a')];var _0x1ce4dd=_0x1a5a6f?_0x238004[_0x4475('0x1d')]:_0x3da95d['offset']+_0x3da95d['limit'];var _0x1ef82d;if(_0x1ce4dd>=_0x5cd8c4){_0x1ce4dd=_0x5cd8c4;_0x1ef82d=0xc8;}else{_0x1ef82d=0xce;}_0x1c65af['status'](_0x1ef82d);return _0x1c65af[_0x4475('0x1e')](_0x4475('0x1f'),_0x4879e2+'-'+_0x1ce4dd+'/'+_0x5cd8c4)[_0x4475('0x20')](_0x238004);}return null;};}function patchUpdates(_0x425218){return function(_0x4282d5){try{jsonpatch['apply'](_0x4282d5,_0x425218,!![]);}catch(_0x301678){return BPromise[_0x4475('0x21')](_0x301678);}return _0x4282d5[_0x4475('0x22')]();};}function saveUpdates(_0x332b99,_0x1fa9f0){return function(_0x4b01d5){if(_0x4b01d5){return _0x4b01d5['update'](_0x332b99)['then'](function(_0x2dae9b){return _0x2dae9b;});}return null;};}function removeEntity(_0x56845b,_0x22c4a9){return function(_0x37e34b){if(_0x37e34b){return _0x37e34b[_0x4475('0x23')]()[_0x4475('0x24')](function(){_0x56845b[_0x4475('0x19')](0xcc)[_0x4475('0x25')]();});}};}function handleEntityNotFound(_0x508f26,_0x569f82){return function(_0xf73bcc){if(!_0xf73bcc){_0x508f26[_0x4475('0x18')](0x194);}return _0xf73bcc;};}function handleError(_0x4569f3,_0x149582){_0x149582=_0x149582||0x1f4;return function(_0x36ee7c){logger[_0x4475('0x26')](_0x36ee7c[_0x4475('0x27')]);if(_0x36ee7c[_0x4475('0x28')]){delete _0x36ee7c[_0x4475('0x28')];}_0x4569f3[_0x4475('0x19')](_0x149582)[_0x4475('0x29')](_0x36ee7c);};}exports['index']=function(_0x430024,_0x16fa3e){var _0xa6b4e7={},_0x726936={},_0x5be3ef={'count':0x0,'rows':[]};var _0x5d2d11=_[_0x4475('0x2a')](db[_0x4475('0x2b')][_0x4475('0x2c')],function(_0x569816){return{'name':_0x569816[_0x4475('0x2d')],'type':_0x569816['type'][_0x4475('0x2e')]};});_0x726936[_0x4475('0x2f')]=_[_0x4475('0x2a')](_0x5d2d11,_0x4475('0x28'));_0x726936[_0x4475('0x30')]=_[_0x4475('0x31')](_0x430024[_0x4475('0x30')]);_0x726936['filters']=_[_0x4475('0x32')](_0x726936[_0x4475('0x2f')],_0x726936['query']);_0xa6b4e7['attributes']=_[_0x4475('0x32')](_0x726936[_0x4475('0x2f')],qs[_0x4475('0x33')](_0x430024[_0x4475('0x30')][_0x4475('0x33')]));_0xa6b4e7['attributes']=_0xa6b4e7[_0x4475('0x34')][_0x4475('0x35')]?_0xa6b4e7['attributes']:_0x726936['model'];if(!_0x430024['query'][_0x4475('0x36')](_0x4475('0x37'))){_0xa6b4e7[_0x4475('0x1c')]=qs['limit'](_0x430024[_0x4475('0x30')][_0x4475('0x1c')]);_0xa6b4e7[_0x4475('0x1a')]=qs[_0x4475('0x1a')](_0x430024['query']['offset']);}_0xa6b4e7['order']=qs['sort'](_0x430024[_0x4475('0x30')]['sort']);_0xa6b4e7[_0x4475('0x38')]=qs[_0x4475('0x39')](_['pick'](_0x430024[_0x4475('0x30')],_0x726936['filters']),_0x5d2d11);if(_0x430024['query'][_0x4475('0x3a')]){_0xa6b4e7[_0x4475('0x38')]=_[_0x4475('0x3b')](_0xa6b4e7[_0x4475('0x38')],{'$or':_['map'](_0x5d2d11,function(_0x598c60){if(_0x598c60['type']!=='VIRTUAL'){var _0x546780={};_0x546780[_0x598c60[_0x4475('0x28')]]={'$like':'%'+_0x430024[_0x4475('0x30')][_0x4475('0x3a')]+'%'};return _0x546780;}})});}_0xa6b4e7=_[_0x4475('0x3b')]({},_0xa6b4e7,_0x430024[_0x4475('0x3c')]);var _0x19e6b7={'where':_0xa6b4e7[_0x4475('0x38')]};return db[_0x4475('0x2b')][_0x4475('0x1d')](_0x19e6b7)[_0x4475('0x24')](function(_0x38cf42){_0x5be3ef[_0x4475('0x1d')]=_0x38cf42;if(_0x430024[_0x4475('0x30')]['includeAll']){_0xa6b4e7[_0x4475('0x3d')]=[{'all':!![]}];}return db[_0x4475('0x2b')][_0x4475('0x3e')](_0xa6b4e7);})[_0x4475('0x24')](function(_0xb323d8){_0x5be3ef[_0x4475('0x3f')]=_0xb323d8;return _0x5be3ef;})[_0x4475('0x24')](respondWithFilteredResult(_0x16fa3e,_0xa6b4e7))[_0x4475('0x40')](handleError(_0x16fa3e,null));};exports[_0x4475('0x41')]=function(_0x23ad83,_0x2dc0f){var _0x4e2c10={'raw':!![],'where':{'id':_0x23ad83[_0x4475('0x42')]['id']}},_0x405285={};_0x405285[_0x4475('0x2f')]=_[_0x4475('0x31')](db['VtigerField'][_0x4475('0x2c')]);_0x405285[_0x4475('0x30')]=_[_0x4475('0x31')](_0x23ad83['query']);_0x405285['filters']=_['intersection'](_0x405285[_0x4475('0x2f')],_0x405285[_0x4475('0x30')]);_0x4e2c10[_0x4475('0x34')]=_['intersection'](_0x405285[_0x4475('0x2f')],qs[_0x4475('0x33')](_0x23ad83['query'][_0x4475('0x33')]));_0x4e2c10[_0x4475('0x34')]=_0x4e2c10['attributes'][_0x4475('0x35')]?_0x4e2c10[_0x4475('0x34')]:_0x405285[_0x4475('0x2f')];if(_0x23ad83['query'][_0x4475('0x43')]){_0x4e2c10[_0x4475('0x3d')]=[{'all':!![]}];}_0x4e2c10=_[_0x4475('0x3b')]({},_0x4e2c10,_0x23ad83[_0x4475('0x3c')]);return db['VtigerField'][_0x4475('0x44')](_0x4e2c10)['then'](handleEntityNotFound(_0x2dc0f,null))[_0x4475('0x24')](respondWithResult(_0x2dc0f,null))[_0x4475('0x40')](handleError(_0x2dc0f,null));};exports[_0x4475('0x45')]=function(_0x397543,_0x400f58){return db[_0x4475('0x2b')][_0x4475('0x45')](_0x397543['body'],{})[_0x4475('0x24')](respondWithResult(_0x400f58,0xc9))[_0x4475('0x40')](handleError(_0x400f58,null));};exports[_0x4475('0x46')]=function(_0x1730c5,_0x3f9749){if(_0x1730c5['body']['id']){delete _0x1730c5[_0x4475('0x47')]['id'];}return db[_0x4475('0x2b')][_0x4475('0x44')]({'where':{'id':_0x1730c5[_0x4475('0x42')]['id']}})[_0x4475('0x24')](handleEntityNotFound(_0x3f9749,null))[_0x4475('0x24')](saveUpdates(_0x1730c5[_0x4475('0x47')],null))[_0x4475('0x24')](respondWithResult(_0x3f9749,null))['catch'](handleError(_0x3f9749,null));};exports[_0x4475('0x23')]=function(_0xd4b1db,_0xb30962){return db[_0x4475('0x2b')][_0x4475('0x44')]({'where':{'id':_0xd4b1db[_0x4475('0x42')]['id']}})['then'](handleEntityNotFound(_0xb30962,null))[_0x4475('0x24')](removeEntity(_0xb30962,null))[_0x4475('0x40')](handleError(_0xb30962,null));}; \ No newline at end of file +var _0x3024=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x3024,0x1ec));var _0x4302=function(_0x4f58c7,_0x5317df){_0x4f58c7=_0x4f58c7-0x0;var _0x1ef57c=_0x3024[_0x4f58c7];return _0x1ef57c;};'use strict';var emlformat=require(_0x4302('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4302('0x1'));var rp=require(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require(_0x4302('0x4'));var Mustache=require(_0x4302('0x5'));var util=require(_0x4302('0x6'));var path=require('path');var sox=require(_0x4302('0x7'));var csv=require(_0x4302('0x8'));var ejs=require(_0x4302('0x9'));var fs=require('fs');var fs_extra=require(_0x4302('0xa'));var _=require(_0x4302('0xb'));var squel=require(_0x4302('0xc'));var crypto=require(_0x4302('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4302('0x8'));var querystring=require(_0x4302('0xe'));var Papa=require(_0x4302('0xf'));var Redis=require(_0x4302('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4302('0x11'));var as=require(_0x4302('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4302('0x13'))('api');var utils=require(_0x4302('0x14'));var config=require(_0x4302('0x15'));var licenseUtil=require(_0x4302('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1967df,_0x480b37){_0x480b37=_0x480b37||0xcc;return function(_0x2f87e5){if(_0x2f87e5){return _0x1967df[_0x4302('0x17')](_0x480b37);}return _0x1967df['status'](_0x480b37)['end']();};}function respondWithResult(_0x168609,_0x25c93b){_0x25c93b=_0x25c93b||0xc8;return function(_0xa9f1b9){if(_0xa9f1b9){return _0x168609[_0x4302('0x18')](_0x25c93b)[_0x4302('0x19')](_0xa9f1b9);}};}function respondWithFilteredResult(_0x6a339d,_0x4428aa){return function(_0x485a7f){if(_0x485a7f){var _0x1b4f9b=typeof _0x4428aa[_0x4302('0x1a')]===_0x4302('0x1b')&&typeof _0x4428aa[_0x4302('0x1c')]===_0x4302('0x1b');var _0x41eff9=_0x485a7f['count'];var _0x3d0116=_0x1b4f9b?0x0:_0x4428aa[_0x4302('0x1a')];var _0x34914b=_0x1b4f9b?_0x485a7f['count']:_0x4428aa[_0x4302('0x1a')]+_0x4428aa[_0x4302('0x1c')];var _0x5247be;if(_0x34914b>=_0x41eff9){_0x34914b=_0x41eff9;_0x5247be=0xc8;}else{_0x5247be=0xce;}_0x6a339d[_0x4302('0x18')](_0x5247be);return _0x6a339d[_0x4302('0x1d')](_0x4302('0x1e'),_0x3d0116+'-'+_0x34914b+'/'+_0x41eff9)[_0x4302('0x19')](_0x485a7f);}return null;};}function patchUpdates(_0x17544a){return function(_0x9a9266){try{jsonpatch[_0x4302('0x1f')](_0x9a9266,_0x17544a,!![]);}catch(_0x5a4f5b){return BPromise[_0x4302('0x20')](_0x5a4f5b);}return _0x9a9266[_0x4302('0x21')]();};}function saveUpdates(_0x270d64,_0x5d98bc){return function(_0xf2e875){if(_0xf2e875){return _0xf2e875[_0x4302('0x22')](_0x270d64)[_0x4302('0x23')](function(_0x535669){return _0x535669;});}return null;};}function removeEntity(_0x38962d,_0x229ecc){return function(_0x3c4fdb){if(_0x3c4fdb){return _0x3c4fdb['destroy']()[_0x4302('0x23')](function(){_0x38962d[_0x4302('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137e59,_0x290403){return function(_0x152f0b){if(!_0x152f0b){_0x137e59[_0x4302('0x17')](0x194);}return _0x152f0b;};}function handleError(_0x17e257,_0x39c10f){_0x39c10f=_0x39c10f||0x1f4;return function(_0x4d18c2){logger[_0x4302('0x24')](_0x4d18c2[_0x4302('0x25')]);if(_0x4d18c2[_0x4302('0x26')]){delete _0x4d18c2[_0x4302('0x26')];}_0x17e257[_0x4302('0x18')](_0x39c10f)['send'](_0x4d18c2);};}exports[_0x4302('0x27')]=function(_0x528ae8,_0x2ac4ca){var _0x556cf5={},_0x16d7e7={},_0x4eebf0={'count':0x0,'rows':[]};var _0x324db2=_[_0x4302('0x28')](db[_0x4302('0x29')][_0x4302('0x2a')],function(_0x104583){return{'name':_0x104583[_0x4302('0x2b')],'type':_0x104583[_0x4302('0x2c')]['key']};});_0x16d7e7[_0x4302('0x2d')]=_[_0x4302('0x28')](_0x324db2,_0x4302('0x26'));_0x16d7e7['query']=_[_0x4302('0x2e')](_0x528ae8[_0x4302('0x2f')]);_0x16d7e7[_0x4302('0x30')]=_[_0x4302('0x31')](_0x16d7e7[_0x4302('0x2d')],_0x16d7e7['query']);_0x556cf5[_0x4302('0x32')]=_[_0x4302('0x31')](_0x16d7e7[_0x4302('0x2d')],qs[_0x4302('0x33')](_0x528ae8[_0x4302('0x2f')]['fields']));_0x556cf5['attributes']=_0x556cf5[_0x4302('0x32')][_0x4302('0x34')]?_0x556cf5[_0x4302('0x32')]:_0x16d7e7[_0x4302('0x2d')];if(!_0x528ae8['query'][_0x4302('0x35')](_0x4302('0x36'))){_0x556cf5[_0x4302('0x1c')]=qs[_0x4302('0x1c')](_0x528ae8['query']['limit']);_0x556cf5['offset']=qs[_0x4302('0x1a')](_0x528ae8['query'][_0x4302('0x1a')]);}_0x556cf5[_0x4302('0x37')]=qs[_0x4302('0x38')](_0x528ae8[_0x4302('0x2f')][_0x4302('0x38')]);_0x556cf5[_0x4302('0x39')]=qs[_0x4302('0x30')](_[_0x4302('0x3a')](_0x528ae8['query'],_0x16d7e7[_0x4302('0x30')]),_0x324db2);if(_0x528ae8[_0x4302('0x2f')][_0x4302('0x3b')]){_0x556cf5[_0x4302('0x39')]=_[_0x4302('0x3c')](_0x556cf5[_0x4302('0x39')],{'$or':_['map'](_0x324db2,function(_0x479e1b){if(_0x479e1b['type']!==_0x4302('0x3d')){var _0x5c3afc={};_0x5c3afc[_0x479e1b['name']]={'$like':'%'+_0x528ae8[_0x4302('0x2f')][_0x4302('0x3b')]+'%'};return _0x5c3afc;}})});}_0x556cf5=_[_0x4302('0x3c')]({},_0x556cf5,_0x528ae8[_0x4302('0x3e')]);var _0x1fa4e3={'where':_0x556cf5[_0x4302('0x39')]};return db[_0x4302('0x29')][_0x4302('0x3f')](_0x1fa4e3)[_0x4302('0x23')](function(_0x48f994){_0x4eebf0[_0x4302('0x3f')]=_0x48f994;if(_0x528ae8[_0x4302('0x2f')][_0x4302('0x40')]){_0x556cf5[_0x4302('0x41')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x556cf5);})[_0x4302('0x23')](function(_0x36c135){_0x4eebf0[_0x4302('0x42')]=_0x36c135;return _0x4eebf0;})[_0x4302('0x23')](respondWithFilteredResult(_0x2ac4ca,_0x556cf5))[_0x4302('0x43')](handleError(_0x2ac4ca,null));};exports[_0x4302('0x44')]=function(_0x5393c9,_0x377d97){var _0x4142b4={'raw':!![],'where':{'id':_0x5393c9[_0x4302('0x45')]['id']}},_0x59f00e={};_0x59f00e['model']=_[_0x4302('0x2e')](db['VtigerField'][_0x4302('0x2a')]);_0x59f00e['query']=_['keys'](_0x5393c9[_0x4302('0x2f')]);_0x59f00e[_0x4302('0x30')]=_['intersection'](_0x59f00e['model'],_0x59f00e[_0x4302('0x2f')]);_0x4142b4[_0x4302('0x32')]=_['intersection'](_0x59f00e[_0x4302('0x2d')],qs[_0x4302('0x33')](_0x5393c9[_0x4302('0x2f')][_0x4302('0x33')]));_0x4142b4['attributes']=_0x4142b4[_0x4302('0x32')][_0x4302('0x34')]?_0x4142b4[_0x4302('0x32')]:_0x59f00e['model'];if(_0x5393c9[_0x4302('0x2f')][_0x4302('0x40')]){_0x4142b4[_0x4302('0x41')]=[{'all':!![]}];}_0x4142b4=_[_0x4302('0x3c')]({},_0x4142b4,_0x5393c9[_0x4302('0x3e')]);return db[_0x4302('0x29')][_0x4302('0x46')](_0x4142b4)[_0x4302('0x23')](handleEntityNotFound(_0x377d97,null))[_0x4302('0x23')](respondWithResult(_0x377d97,null))[_0x4302('0x43')](handleError(_0x377d97,null));};exports['create']=function(_0x261d9b,_0x428dbb){return db[_0x4302('0x29')]['create'](_0x261d9b['body'],{})['then'](respondWithResult(_0x428dbb,0xc9))[_0x4302('0x43')](handleError(_0x428dbb,null));};exports[_0x4302('0x22')]=function(_0x355d68,_0x563980){if(_0x355d68[_0x4302('0x47')]['id']){delete _0x355d68['body']['id'];}return db['VtigerField'][_0x4302('0x46')]({'where':{'id':_0x355d68[_0x4302('0x45')]['id']}})[_0x4302('0x23')](handleEntityNotFound(_0x563980,null))[_0x4302('0x23')](saveUpdates(_0x355d68[_0x4302('0x47')],null))[_0x4302('0x23')](respondWithResult(_0x563980,null))[_0x4302('0x43')](handleError(_0x563980,null));};exports[_0x4302('0x48')]=function(_0x1a5f6f,_0x47c8e3){return db[_0x4302('0x29')]['find']({'where':{'id':_0x1a5f6f[_0x4302('0x45')]['id']}})[_0x4302('0x23')](handleEntityNotFound(_0x47c8e3,null))[_0x4302('0x23')](removeEntity(_0x47c8e3,null))[_0x4302('0x43')](handleError(_0x47c8e3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f8daa23..65fa91f 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 _0x3be5=['exports','define','int_vtiger_fields','vtiger_unique_index','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3be5,0x1cb));var _0x53be=function(_0x4a0bfb,_0x2a749b){_0x4a0bfb=_0x4a0bfb-0x0;var _0x212e38=_0x3be5[_0x4a0bfb];return _0x212e38;};'use strict';var _=require('lodash');var util=require(_0x53be('0x0'));var logger=require(_0x53be('0x1'))('api');var moment=require(_0x53be('0x2'));var BPromise=require(_0x53be('0x3'));var rp=require(_0x53be('0x4'));var fs=require('fs');var path=require(_0x53be('0x5'));var rimraf=require(_0x53be('0x6'));var config=require(_0x53be('0x7'));var attributes=require(_0x53be('0x8'));module[_0x53be('0x9')]=function(_0x512cd5,_0x2cf47a){return _0x512cd5[_0x53be('0xa')]('VtigerField',attributes,{'tableName':_0x53be('0xb'),'paranoid':![],'indexes':[{'name':_0x53be('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0940=['bluebird','request-promise','path','exports','vtiger_unique_index','idField','lodash','util','../../config/logger','moment'];(function(_0x1a8891,_0xebc65){var _0x71ddf=function(_0x5427e4){while(--_0x5427e4){_0x1a8891['push'](_0x1a8891['shift']());}};_0x71ddf(++_0xebc65);}(_0x0940,0x88));var _0x0094=function(_0x3e93c1,_0x30839b){_0x3e93c1=_0x3e93c1-0x0;var _0x1c29f7=_0x0940[_0x3e93c1];return _0x1c29f7;};'use strict';var _=require(_0x0094('0x0'));var util=require(_0x0094('0x1'));var logger=require(_0x0094('0x2'))('api');var moment=require(_0x0094('0x3'));var BPromise=require(_0x0094('0x4'));var rp=require(_0x0094('0x5'));var fs=require('fs');var path=require(_0x0094('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x0094('0x7')]=function(_0x20504d,_0x368cd5){return _0x20504d['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x0094('0x8'),'fields':[_0x0094('0x9'),'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 6e473c1..fd491b6 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 _0x4322=['../../config/utils','../../config/logger','client','http','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1321df,_0x56df75){var _0x4a050d=function(_0x4d6cb7){while(--_0x4d6cb7){_0x1321df['push'](_0x1321df['shift']());}};_0x4a050d(++_0x56df75);}(_0x4322,0x174));var _0x2432=function(_0x3364fc,_0x559233){_0x3364fc=_0x3364fc-0x0;var _0x10df36=_0x4322[_0x3364fc];return _0x10df36;};'use strict';var _=require(_0x2432('0x0'));var util=require('util');var moment=require(_0x2432('0x1'));var BPromise=require(_0x2432('0x2'));var rs=require(_0x2432('0x3'));var fs=require('fs');var Redis=require(_0x2432('0x4'));var db=require(_0x2432('0x5'))['db'];var utils=require(_0x2432('0x6'));var logger=require(_0x2432('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2432('0x8')][_0x2432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50447b,_0x21ce1f,_0x1c87c6){return new BPromise(function(_0xa4dcf5,_0x29c7e6){return client['request'](_0x50447b,_0x1c87c6)['then'](function(_0x3726be){logger['info'](_0x2432('0xa'),_0x21ce1f,'request\x20sent');logger[_0x2432('0xb')](_0x2432('0xc'),_0x21ce1f,_0x2432('0xd'),JSON[_0x2432('0xe')](_0x3726be));if(_0x3726be['error']){if(_0x3726be[_0x2432('0xf')][_0x2432('0x10')]===0x1f4){logger['error'](_0x2432('0xa'),_0x21ce1f,_0x3726be[_0x2432('0xf')][_0x2432('0x11')]);return _0x29c7e6(_0x3726be[_0x2432('0xf')]['message']);}logger[_0x2432('0xf')]('VtigerField,\x20%s,\x20%s',_0x21ce1f,_0x3726be[_0x2432('0xf')][_0x2432('0x11')]);return _0xa4dcf5(_0x3726be['error'][_0x2432('0x11')]);}else{logger[_0x2432('0x12')]('VtigerField,\x20%s,\x20%s',_0x21ce1f,_0x2432('0xd'));_0xa4dcf5(_0x3726be[_0x2432('0x13')][_0x2432('0x11')]);}})[_0x2432('0x14')](function(_0x372f84){logger['error'](_0x2432('0xa'),_0x21ce1f,_0x372f84);_0x29c7e6(_0x372f84);});});} \ No newline at end of file +var _0x09d8=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4fcb16,_0xb47497){var _0x5c0ff5=function(_0x211392){while(--_0x211392){_0x4fcb16['push'](_0x4fcb16['shift']());}};_0x5c0ff5(++_0xb47497);}(_0x09d8,0xe4));var _0x809d=function(_0x57a668,_0x85bfaf){_0x57a668=_0x57a668-0x0;var _0x33ce1e=_0x09d8[_0x57a668];return _0x33ce1e;};'use strict';var _=require(_0x809d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x809d('0x1'));var rs=require(_0x809d('0x2'));var fs=require('fs');var Redis=require(_0x809d('0x3'));var db=require(_0x809d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x809d('0x5'))(_0x809d('0x6'));var config=require(_0x809d('0x7'));var jayson=require(_0x809d('0x8'));var client=jayson[_0x809d('0x9')][_0x809d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fde82,_0x40742f,_0x262599){return new BPromise(function(_0x51a6b3,_0x1dbad3){return client[_0x809d('0xb')](_0x1fde82,_0x262599)[_0x809d('0xc')](function(_0x41b026){logger[_0x809d('0xd')]('VtigerField,\x20%s,\x20%s',_0x40742f,'request\x20sent');logger[_0x809d('0xe')](_0x809d('0xf'),_0x40742f,_0x809d('0x10'),JSON['stringify'](_0x41b026));if(_0x41b026[_0x809d('0x11')]){if(_0x41b026[_0x809d('0x11')]['code']===0x1f4){logger[_0x809d('0x11')](_0x809d('0x12'),_0x40742f,_0x41b026[_0x809d('0x11')][_0x809d('0x13')]);return _0x1dbad3(_0x41b026[_0x809d('0x11')][_0x809d('0x13')]);}logger[_0x809d('0x11')](_0x809d('0x12'),_0x40742f,_0x41b026[_0x809d('0x11')][_0x809d('0x13')]);return _0x51a6b3(_0x41b026['error']['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x40742f,_0x809d('0x10'));_0x51a6b3(_0x41b026[_0x809d('0x14')][_0x809d('0x13')]);}})[_0x809d('0x15')](function(_0x71d0c0){logger[_0x809d('0x11')](_0x809d('0x12'),_0x40742f,_0x71d0c0);_0x1dbad3(_0x71d0c0);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a4c83b7..757911a 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 _0xbfa2=['/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x3d44bc,_0x42a607){var _0x5a28fa=function(_0x3184ef){while(--_0x3184ef){_0x3d44bc['push'](_0x3d44bc['shift']());}};_0x5a28fa(++_0x42a607);}(_0xbfa2,0xf1));var _0x2bfa=function(_0x2d2b8,_0x19df01){_0x2d2b8=_0x2d2b8-0x0;var _0x15f4f1=_0xbfa2[_0x2d2b8];return _0x15f4f1;};'use strict';var multer=require(_0x2bfa('0x0'));var util=require(_0x2bfa('0x1'));var path=require(_0x2bfa('0x2'));var timeout=require(_0x2bfa('0x3'));var express=require('express');var router=express[_0x2bfa('0x4')]();var fs_extra=require(_0x2bfa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2bfa('0x6'));var config=require(_0x2bfa('0x7'));var controller=require(_0x2bfa('0x8'));router[_0x2bfa('0x9')]('/',auth[_0x2bfa('0xa')](),controller['index']);router[_0x2bfa('0x9')](_0x2bfa('0xb'),auth[_0x2bfa('0xa')](),controller[_0x2bfa('0xc')]);router[_0x2bfa('0x9')](_0x2bfa('0xd'),auth[_0x2bfa('0xa')](),controller['getConfigurations']);router[_0x2bfa('0x9')](_0x2bfa('0xe'),auth['isAuthenticated'](),controller[_0x2bfa('0xf')]);router[_0x2bfa('0x10')]('/',auth[_0x2bfa('0xa')](),controller[_0x2bfa('0x11')]);router[_0x2bfa('0x10')](_0x2bfa('0xd'),auth[_0x2bfa('0xa')](),controller['addConfiguration']);router[_0x2bfa('0x12')](_0x2bfa('0xb'),auth[_0x2bfa('0xa')](),controller[_0x2bfa('0x13')]);router[_0x2bfa('0x14')](_0x2bfa('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0221=['/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0221,0xc5));var _0x1022=function(_0x14031e,_0x2f33aa){_0x14031e=_0x14031e-0x0;var _0x22d420=_0x0221[_0x14031e];return _0x22d420;};'use strict';var multer=require(_0x1022('0x0'));var util=require(_0x1022('0x1'));var path=require(_0x1022('0x2'));var timeout=require(_0x1022('0x3'));var express=require('express');var router=express[_0x1022('0x4')]();var fs_extra=require(_0x1022('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1022('0x6'));router['get']('/',auth[_0x1022('0x7')](),controller[_0x1022('0x8')]);router[_0x1022('0x9')](_0x1022('0xa'),auth[_0x1022('0x7')](),controller['show']);router[_0x1022('0x9')](_0x1022('0xb'),auth[_0x1022('0x7')](),controller[_0x1022('0xc')]);router[_0x1022('0x9')](_0x1022('0xd'),auth['isAuthenticated'](),controller[_0x1022('0xe')]);router[_0x1022('0xf')]('/',auth[_0x1022('0x7')](),controller[_0x1022('0x10')]);router[_0x1022('0xf')](_0x1022('0xb'),auth[_0x1022('0x7')](),controller['addConfiguration']);router[_0x1022('0x11')](_0x1022('0xa'),auth['isAuthenticated'](),controller[_0x1022('0x12')]);router[_0x1022('0x13')](_0x1022('0xa'),auth['isAuthenticated'](),controller[_0x1022('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 118d62f..c06fce6 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 _0xc359=['remoteUri','password','integrationTab','newTab','exports','STRING','username'];(function(_0x598653,_0x272cb2){var _0x1c9106=function(_0x1fbe8b){while(--_0x1fbe8b){_0x598653['push'](_0x598653['shift']());}};_0x1c9106(++_0x272cb2);}(_0xc359,0x1d9));var _0x9c35=function(_0x4b5c23,_0x101faa){_0x4b5c23=_0x4b5c23-0x0;var _0x262cfd=_0xc359[_0x4b5c23];return _0x262cfd;};'use strict';var Sequelize=require('sequelize');module[_0x9c35('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c35('0x1')]},'username':{'type':Sequelize[_0x9c35('0x1')],'unique':_0x9c35('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9c35('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9c35('0x3')},'authType':{'type':Sequelize['ENUM'](_0x9c35('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9c35('0x5'),_0x9c35('0x6')),'defaultValue':_0x9c35('0x5')}}; \ No newline at end of file +var _0x7bd0=['password','token','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x137e07,_0x440f1e){var _0x584972=function(_0x16932f){while(--_0x16932f){_0x137e07['push'](_0x137e07['shift']());}};_0x584972(++_0x440f1e);}(_0x7bd0,0x111));var _0x07bd=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0x7bd0[_0x21cb7f];return _0x5a079a;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')]},'description':{'type':Sequelize[_0x07bd('0x2')]},'username':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x3')},'password':{'type':Sequelize[_0x07bd('0x2')]},'token':{'type':Sequelize[_0x07bd('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x07bd('0x4')},'authType':{'type':Sequelize[_0x07bd('0x5')](_0x07bd('0x6'),_0x07bd('0x7')),'defaultValue':_0x07bd('0x6')},'serverUrl':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x07bd('0x5')]('integrationTab',_0x07bd('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9b22ba4..66df80b 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 _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x3cd3b1,_0x1a8441){var _0x3985e8=function(_0x54cc76){while(--_0x54cc76){_0x3cd3b1['push'](_0x3cd3b1['shift']());}};_0x3985e8(++_0x1a8441);}(_0xe511,0x16f));var _0x1e51=function(_0x1fdeb4,_0x354b6b){_0x1fdeb4=_0x1fdeb4-0x0;var _0x1e99e8=_0xe511[_0x1fdeb4];return _0x1e99e8;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file +var _0xcb91=['ZendeskAccount','rawAttributes','fieldName','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create','body','params','catch','destroy','getConfigurations','keys','ZendeskConfiguration','addConfiguration','AccountId','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','findOne','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','subject','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','error','stack','name','send','index'];(function(_0x141380,_0x39a064){var _0x184ed8=function(_0x3d0dee){while(--_0x3d0dee){_0x141380['push'](_0x141380['shift']());}};_0x184ed8(++_0x39a064);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0xcb91[_0x2d994d];return _0xd54be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5e3c19,_0x59dec3){_0x59dec3=_0x59dec3||0xcc;return function(_0x358866){if(_0x358866){return _0x5e3c19[_0x1cb9('0x16')](_0x59dec3);}return _0x5e3c19[_0x1cb9('0x17')](_0x59dec3)[_0x1cb9('0x18')]();};}function respondWithResult(_0x56884d,_0x397727){_0x397727=_0x397727||0xc8;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x17')](_0x397727)[_0x1cb9('0x19')](_0x6ef389);}};}function respondWithFilteredResult(_0x3e2d11,_0x5806d8){return function(_0x5572cb){if(_0x5572cb){var _0xd446a3=typeof _0x5806d8[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x5806d8[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0xf22920=_0x5572cb[_0x1cb9('0x1d')];var _0x4e1340=_0xd446a3?0x0:_0x5806d8['offset'];var _0x1b2fa6=_0xd446a3?_0x5572cb[_0x1cb9('0x1d')]:_0x5806d8[_0x1cb9('0x1a')]+_0x5806d8[_0x1cb9('0x1c')];var _0x280a84;if(_0x1b2fa6>=_0xf22920){_0x1b2fa6=_0xf22920;_0x280a84=0xc8;}else{_0x280a84=0xce;}_0x3e2d11[_0x1cb9('0x17')](_0x280a84);return _0x3e2d11[_0x1cb9('0x1e')]('Content-Range',_0x4e1340+'-'+_0x1b2fa6+'/'+_0xf22920)['json'](_0x5572cb);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x1f')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x20')](_0x2e3854)[_0x1cb9('0x21')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x21')](function(){_0x59ebea[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x44d3c4,_0x43a100){return function(_0x53f9fa){if(!_0x53f9fa){_0x44d3c4[_0x1cb9('0x16')](0x194);}return _0x53f9fa;};}function handleError(_0x9df250,_0x4c8d76){_0x4c8d76=_0x4c8d76||0x1f4;return function(_0xd6891c){logger[_0x1cb9('0x22')](_0xd6891c[_0x1cb9('0x23')]);if(_0xd6891c[_0x1cb9('0x24')]){delete _0xd6891c[_0x1cb9('0x24')];}_0x9df250[_0x1cb9('0x17')](_0x4c8d76)[_0x1cb9('0x25')](_0xd6891c);};}exports[_0x1cb9('0x26')]=function(_0x41e5c2,_0x9de64b){var _0x48888d={},_0x405a2f={},_0x536635={'count':0x0,'rows':[]};var _0x110282=_['map'](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x3cd7f5){return{'name':_0x3cd7f5[_0x1cb9('0x29')],'type':_0x3cd7f5['type'][_0x1cb9('0x2a')]};});_0x405a2f['model']=_[_0x1cb9('0x2b')](_0x110282,_0x1cb9('0x24'));_0x405a2f[_0x1cb9('0x2c')]=_['keys'](_0x41e5c2[_0x1cb9('0x2c')]);_0x405a2f['filters']=_[_0x1cb9('0x2d')](_0x405a2f['model'],_0x405a2f[_0x1cb9('0x2c')]);_0x48888d[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x405a2f[_0x1cb9('0x2f')],qs['fields'](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x30')]));_0x48888d[_0x1cb9('0x2e')]=_0x48888d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x48888d[_0x1cb9('0x2e')]:_0x405a2f[_0x1cb9('0x2f')];if(!_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x48888d[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x41e5c2[_0x1cb9('0x2c')]['limit']);_0x48888d['offset']=qs[_0x1cb9('0x1a')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x1a')]);}_0x48888d[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x41e5c2[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x48888d[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x41e5c2[_0x1cb9('0x2c')],_0x405a2f[_0x1cb9('0x38')]),_0x110282);if(_0x41e5c2['query'][_0x1cb9('0x39')]){_0x48888d['where']=_[_0x1cb9('0x3a')](_0x48888d['where'],{'$or':_[_0x1cb9('0x2b')](_0x110282,function(_0x13d4fd){if(_0x13d4fd[_0x1cb9('0x3b')]!==_0x1cb9('0x3c')){var _0x34ada2={};_0x34ada2[_0x13d4fd[_0x1cb9('0x24')]]={'$like':'%'+_0x41e5c2[_0x1cb9('0x2c')]['filter']+'%'};return _0x34ada2;}})});}_0x48888d=_['merge']({},_0x48888d,_0x41e5c2[_0x1cb9('0x3d')]);var _0x1d2723={'where':_0x48888d[_0x1cb9('0x36')]};return db[_0x1cb9('0x27')][_0x1cb9('0x1d')](_0x1d2723)[_0x1cb9('0x21')](function(_0x32130b){_0x536635['count']=_0x32130b;if(_0x41e5c2[_0x1cb9('0x2c')]['includeAll']){_0x48888d['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x1cb9('0x3e')](_0x48888d);})[_0x1cb9('0x21')](function(_0x1bf51c){_0x536635[_0x1cb9('0x3f')]=_0x1bf51c;return _0x536635;})[_0x1cb9('0x21')](respondWithFilteredResult(_0x9de64b,_0x48888d))['catch'](handleError(_0x9de64b,null));};exports[_0x1cb9('0x40')]=function(_0x523866,_0x91121){var _0x71db9d={'raw':![],'where':{'id':_0x523866['params']['id']}},_0x38d973={};_0x38d973[_0x1cb9('0x2f')]=_['keys'](db[_0x1cb9('0x27')][_0x1cb9('0x28')]);_0x38d973['query']=_['keys'](_0x523866[_0x1cb9('0x2c')]);_0x38d973[_0x1cb9('0x38')]=_[_0x1cb9('0x2d')](_0x38d973[_0x1cb9('0x2f')],_0x38d973[_0x1cb9('0x2c')]);_0x71db9d['attributes']=_[_0x1cb9('0x2d')](_0x38d973['model'],qs['fields'](_0x523866['query'][_0x1cb9('0x30')]));_0x71db9d[_0x1cb9('0x2e')]=_0x71db9d[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x71db9d[_0x1cb9('0x2e')]:_0x38d973[_0x1cb9('0x2f')];if(_0x523866[_0x1cb9('0x2c')][_0x1cb9('0x41')]){_0x71db9d[_0x1cb9('0x42')]=[{'all':!![]}];}_0x71db9d=_[_0x1cb9('0x3a')]({},_0x71db9d,_0x523866[_0x1cb9('0x3d')]);return db['ZendeskAccount'][_0x1cb9('0x43')](_0x71db9d)[_0x1cb9('0x21')](handleEntityNotFound(_0x91121,null))[_0x1cb9('0x21')](respondWithResult(_0x91121,null))['catch'](handleError(_0x91121,null));};exports[_0x1cb9('0x44')]=function(_0x57251,_0x3c6044){return db[_0x1cb9('0x27')][_0x1cb9('0x44')](_0x57251['body'],{})[_0x1cb9('0x21')](respondWithResult(_0x3c6044,0xc9))['catch'](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x4ac483,_0x1cf2ee){if(_0x4ac483[_0x1cb9('0x45')]['id']){delete _0x4ac483[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x4ac483[_0x1cb9('0x46')]['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x1cf2ee,null))[_0x1cb9('0x21')](saveUpdates(_0x4ac483[_0x1cb9('0x45')],null))[_0x1cb9('0x21')](respondWithResult(_0x1cf2ee,null))[_0x1cb9('0x47')](handleError(_0x1cf2ee,null));};exports[_0x1cb9('0x48')]=function(_0x3b6a92,_0xbb500e){return db[_0x1cb9('0x27')]['find']({'where':{'id':_0x3b6a92['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0xbb500e,null))[_0x1cb9('0x21')](removeEntity(_0xbb500e,null))[_0x1cb9('0x47')](handleError(_0xbb500e,null));};exports[_0x1cb9('0x49')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={};var _0x36c53a={};var _0x166ca2;var _0x4a4b87;return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x20b253[_0x1cb9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d076b,null))[_0x1cb9('0x21')](function(_0x53c002){if(_0x53c002){_0x166ca2=_0x53c002;_0x36c53a['model']=_[_0x1cb9('0x4a')](db[_0x1cb9('0x4b')][_0x1cb9('0x28')]);_0x36c53a['query']=_[_0x1cb9('0x4a')](_0x20b253[_0x1cb9('0x2c')]);_0x36c53a['filters']=_['intersection'](_0x36c53a[_0x1cb9('0x2f')],_0x36c53a[_0x1cb9('0x2c')]);_0x1c4ff6[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x36c53a[_0x1cb9('0x2f')],qs[_0x1cb9('0x30')](_0x20b253[_0x1cb9('0x2c')]['fields']));_0x1c4ff6[_0x1cb9('0x2e')]=_0x1c4ff6[_0x1cb9('0x2e')][_0x1cb9('0x31')]?_0x1c4ff6['attributes']:_0x36c53a[_0x1cb9('0x2f')];_0x1c4ff6[_0x1cb9('0x34')]=qs[_0x1cb9('0x35')](_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x35')]);_0x1c4ff6[_0x1cb9('0x36')]=qs['filters'](_[_0x1cb9('0x37')](_0x20b253[_0x1cb9('0x2c')],_0x36c53a[_0x1cb9('0x38')]));if(_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]){_0x1c4ff6[_0x1cb9('0x36')]=_[_0x1cb9('0x3a')](_0x1c4ff6[_0x1cb9('0x36')],{'$or':_[_0x1cb9('0x2b')](_0x1c4ff6[_0x1cb9('0x2e')],function(_0x370c97){var _0x55fb51={};_0x55fb51[_0x370c97]={'$like':'%'+_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x39')]+'%'};return _0x55fb51;})});}_0x1c4ff6=_[_0x1cb9('0x3a')]({},_0x1c4ff6,_0x20b253[_0x1cb9('0x3d')]);return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x319358){if(_0x319358){_0x4a4b87=_0x319358[_0x1cb9('0x31')];if(!_0x20b253[_0x1cb9('0x2c')][_0x1cb9('0x32')](_0x1cb9('0x33'))){_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2c')]['limit']);_0x1c4ff6['offset']=qs[_0x1cb9('0x1a')](_0x20b253['query']['offset']);}return _0x166ca2['getConfigurations'](_0x1c4ff6);}})['then'](function(_0x5d349b){if(_0x5d349b){return _0x5d349b?{'count':_0x4a4b87,'rows':_0x5d349b}:null;}})[_0x1cb9('0x21')](respondWithResult(_0x2d076b,null))[_0x1cb9('0x47')](handleError(_0x2d076b,null));};exports[_0x1cb9('0x4c')]=function(_0x43bafc,_0x23d435,_0xccbee3){if(_0x43bafc['body']['id']){delete _0x43bafc[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x27')]['findOne']({'where':{'id':_0x43bafc['params']['id']}})[_0x1cb9('0x21')](handleEntityNotFound(_0x23d435,null))[_0x1cb9('0x21')](function(_0x2e818f){if(_0x2e818f){_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4d')]=_0x2e818f['id'];_0x43bafc['body']['Subjects']=integrations['getSubjects'](_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x4e')],_0x43bafc[_0x1cb9('0x45')][_0x1cb9('0x3b')]);_0x43bafc[_0x1cb9('0x45')]['Descriptions']=integrations[_0x1cb9('0x4f')](_0x43bafc[_0x1cb9('0x45')]['channel'],_0x43bafc['body'][_0x1cb9('0x3b')]);return db['ZendeskConfiguration'][_0x1cb9('0x44')](_0x43bafc[_0x1cb9('0x45')],{'include':[{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x51')},{'model':db[_0x1cb9('0x50')],'as':_0x1cb9('0x52')}]});}return null;})['then'](respondWithResult(_0x23d435,null))[_0x1cb9('0x47')](handleError(_0x23d435,null));};exports[_0x1cb9('0x53')]=function(_0x330fc1,_0x17c361,_0x5b5f0d){var _0x520d98='';return db[_0x1cb9('0x27')][_0x1cb9('0x54')]({'where':{'id':_0x330fc1[_0x1cb9('0x46')]['id']},'attributes':['id',_0x1cb9('0x55'),_0x1cb9('0x56'),_0x1cb9('0x57'),'authType',_0x1cb9('0x58')]})['then'](handleEntityNotFound(_0x17c361,null))[_0x1cb9('0x21')](function(_0x26dae9){if(_0x26dae9){_0x520d98=_0x26dae9['remoteUri'];var _0xf5b006=_0x520d98[_0x1cb9('0x59')](-0x1);if(_0xf5b006==='/'){_0x520d98=_0x520d98[_0x1cb9('0x5a')](0x0,_0x520d98['lastIndexOf'](_0xf5b006));}var _0x1b4878={'method':_0x1cb9('0x5b'),'uri':util[_0x1cb9('0x5c')](_0x1cb9('0x5d'),_0x520d98,_0x1cb9('0x5e')),'json':!![]};switch(_0x26dae9[_0x1cb9('0x5f')]){case'password':_0x1b4878[_0x1cb9('0x60')]={'Authorization':util[_0x1cb9('0x5c')](_0x1cb9('0x61'),new Buffer(util[_0x1cb9('0x5c')](_0x1cb9('0x62'),_0x26dae9[_0x1cb9('0x55')],_0x26dae9[_0x1cb9('0x56')]))[_0x1cb9('0x63')]('base64'))};break;case _0x1cb9('0x57'):_0x1b4878[_0x1cb9('0x60')]={'Authorization':util['format'](_0x1cb9('0x61'),new Buffer(util['format'](_0x1cb9('0x64'),_0x26dae9['username'],_0x26dae9['token']))[_0x1cb9('0x63')](_0x1cb9('0x65')))};break;default:throw new db['Sequelize'][(_0x1cb9('0x66'))]('Unknown\x20authentication\x20type');}return rp(_0x1b4878);}})[_0x1cb9('0x21')](function(_0x7ecb4e){if(_0x7ecb4e){var _0x399986=[_0x1cb9('0x67'),'description',_0x1cb9('0x68'),_0x1cb9('0x69')];_[_0x1cb9('0x6a')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x4f8d74){return _0x399986[_0x1cb9('0x6b')](_0x4f8d74['type']);});return{'count':_0x7ecb4e[_0x1cb9('0x5e')][_0x1cb9('0x31')],'rows':_[_0x1cb9('0x2b')](_0x7ecb4e[_0x1cb9('0x5e')],function(_0x102f2c){return{'id':_0x102f2c['id'],'name':_0x102f2c[_0x1cb9('0x6c')]>0x7?_0x102f2c['title']:_0x102f2c[_0x1cb9('0x3b')],'custom':_0x102f2c[_0x1cb9('0x6c')]>0x7?!![]:![],'options':_0x102f2c['system_field_options']?_0x102f2c[_0x1cb9('0x6d')]:_0x102f2c[_0x1cb9('0x6e')]?_0x102f2c[_0x1cb9('0x6e')]:[]};})};}})[_0x1cb9('0x21')](respondWithResult(_0x17c361,null))[_0x1cb9('0x47')](function(_0x209dc7){var _0x423aae=_0x330fc1['query'][_0x1cb9('0x6f')]?0x1f4:_0x209dc7['statusCode']||0x1f4;logger[_0x1cb9('0x22')](_0x1cb9('0x70'),'getFields',_0x423aae,JSON[_0x1cb9('0x71')](_0x209dc7));delete _0x209dc7[_0x1cb9('0x24')];if(_0x423aae===0x191){_0x423aae=0x190;}_0x17c361[_0x1cb9('0x17')](_0x423aae)[_0x1cb9('0x25')](_0x330fc1['query'][_0x1cb9('0x6f')]?{'message':_0x1cb9('0x72'),'statusCode':_0x209dc7[_0x1cb9('0x73')]}:_0x209dc7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 057c12a..e792945 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 _0x21b3=['ZendeskAccount','lodash','api','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x36c5cc,_0x2470f5){var _0x45ba04=function(_0x2ecfb4){while(--_0x2ecfb4){_0x36c5cc['push'](_0x36c5cc['shift']());}};_0x45ba04(++_0x2470f5);}(_0x21b3,0x157));var _0x321b=function(_0xc81713,_0x40e788){_0xc81713=_0xc81713-0x0;var _0x3c220f=_0x21b3[_0xc81713];return _0x3c220f;};'use strict';var _=require(_0x321b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x321b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x321b('0x2'));var fs=require('fs');var path=require(_0x321b('0x3'));var rimraf=require(_0x321b('0x4'));var config=require(_0x321b('0x5'));var attributes=require(_0x321b('0x6'));var integrations=require(_0x321b('0x7'));module['exports']=function(_0x180b60,_0x28114d){return _0x180b60['define'](_0x321b('0x8'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4524=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0xc355,_0xba7c6f){var _0x395931=function(_0xd3777a){while(--_0xd3777a){_0xc355['push'](_0xc355['shift']());}};_0x395931(++_0xba7c6f);}(_0x4524,0x11d));var _0x4452=function(_0xc02e1d,_0x37520d){_0xc02e1d=_0xc02e1d-0x0;var _0xe460e4=_0x4524[_0xc02e1d];return _0xe460e4;};'use strict';var _=require(_0x4452('0x0'));var util=require(_0x4452('0x1'));var logger=require(_0x4452('0x2'))(_0x4452('0x3'));var moment=require(_0x4452('0x4'));var BPromise=require(_0x4452('0x5'));var rp=require(_0x4452('0x6'));var fs=require('fs');var path=require(_0x4452('0x7'));var rimraf=require('rimraf');var config=require(_0x4452('0x8'));var attributes=require(_0x4452('0x9'));var integrations=require(_0x4452('0xa'));module[_0x4452('0xb')]=function(_0x4d045b,_0x35fbac){return _0x4d045b[_0x4452('0xc')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','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 08ef22f..dd6df92 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 _0x9303=['then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowZendeskAccount','find','raw','lodash','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9303,0xd7));var _0x3930=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x9303[_0x284807];return _0x50c774;};'use strict';var _=require(_0x3930('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3930('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3930('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3930('0x3'))(_0x3930('0x4'));var config=require(_0x3930('0x5'));var jayson=require(_0x3930('0x6'));var client=jayson['client'][_0x3930('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55af25,_0x47d206,_0x20f2d8){return new BPromise(function(_0x4397b0,_0x20ba32){return client[_0x3930('0x8')](_0x55af25,_0x20f2d8)[_0x3930('0x9')](function(_0x58e723){logger['info'](_0x3930('0xa'),_0x47d206,'request\x20sent');logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x47d206,_0x3930('0xb'),JSON[_0x3930('0xc')](_0x58e723));if(_0x58e723[_0x3930('0xd')]){if(_0x58e723[_0x3930('0xd')][_0x3930('0xe')]===0x1f4){logger['error'](_0x3930('0xa'),_0x47d206,_0x58e723['error'][_0x3930('0xf')]);return _0x20ba32(_0x58e723[_0x3930('0xd')][_0x3930('0xf')]);}logger['error'](_0x3930('0xa'),_0x47d206,_0x58e723[_0x3930('0xd')]['message']);return _0x4397b0(_0x58e723[_0x3930('0xd')][_0x3930('0xf')]);}else{logger[_0x3930('0x10')](_0x3930('0xa'),_0x47d206,'request\x20sent');_0x4397b0(_0x58e723['result'][_0x3930('0xf')]);}})['catch'](function(_0x2a2562){logger['error'](_0x3930('0xa'),_0x47d206,_0x2a2562);_0x20ba32(_0x2a2562);});});}exports[_0x3930('0x11')]=function(_0x5a1c39){var _0x4a1405=this;return new Promise(function(_0x4b02b6,_0x1427f6){return db[_0x3930('0x12')][_0x3930('0x13')]({'raw':_0x5a1c39['options']?_0x5a1c39['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a1c39['options']?_0x5a1c39[_0x3930('0x14')][_0x3930('0x15')]||null:null,'attributes':_0x5a1c39[_0x3930('0x14')]?_0x5a1c39[_0x3930('0x14')][_0x3930('0x16')]||null:null,'limit':_0x5a1c39['options']?_0x5a1c39[_0x3930('0x14')][_0x3930('0x17')]||null:null,'include':_0x5a1c39[_0x3930('0x14')]?_0x5a1c39['options'][_0x3930('0x18')]?_[_0x3930('0x19')](_0x5a1c39[_0x3930('0x14')][_0x3930('0x18')],function(_0x2bcc3b){return{'model':db[_0x2bcc3b[_0x3930('0x1a')]],'as':_0x2bcc3b['as'],'attributes':_0x2bcc3b[_0x3930('0x16')],'include':_0x2bcc3b[_0x3930('0x18')]?_['map'](_0x2bcc3b[_0x3930('0x18')],function(_0x1dcdcd){return{'model':db[_0x1dcdcd[_0x3930('0x1a')]],'as':_0x1dcdcd['as'],'attributes':_0x1dcdcd[_0x3930('0x16')],'include':_0x1dcdcd[_0x3930('0x18')]?_['map'](_0x1dcdcd[_0x3930('0x18')],function(_0x7b6825){return{'model':db[_0x7b6825[_0x3930('0x1a')]],'as':_0x7b6825['as'],'attributes':_0x7b6825['attributes']};}):[]};}):[]};}):[]:[]})[_0x3930('0x9')](function(_0x306d5b){logger[_0x3930('0x10')](_0x3930('0x11'),_0x5a1c39);logger[_0x3930('0x1b')]('GetZendeskAccount',_0x5a1c39,JSON[_0x3930('0xc')](_0x306d5b));_0x4b02b6(_0x306d5b);})[_0x3930('0x1c')](function(_0xca904a){logger['error'](_0x3930('0x11'),_0xca904a[_0x3930('0xf')],_0x5a1c39);_0x1427f6(_0x4a1405[_0x3930('0xd')](0x1f4,_0xca904a[_0x3930('0xf')]));});});};exports[_0x3930('0x1d')]=function(_0x8fdd26){var _0xcd21b7=this;return new Promise(function(_0xc4a53e,_0x148f4e){return db[_0x3930('0x12')][_0x3930('0x1e')]({'raw':_0x8fdd26[_0x3930('0x14')]?_0x8fdd26[_0x3930('0x14')][_0x3930('0x1f')]===undefined?!![]:![]:!![],'where':_0x8fdd26[_0x3930('0x14')]?_0x8fdd26[_0x3930('0x14')][_0x3930('0x15')]||null:null,'attributes':_0x8fdd26[_0x3930('0x14')]?_0x8fdd26[_0x3930('0x14')][_0x3930('0x16')]||null:null,'include':_0x8fdd26['options']?_0x8fdd26['options']['include']?_[_0x3930('0x19')](_0x8fdd26[_0x3930('0x14')]['include'],function(_0x349868){return{'model':db[_0x349868[_0x3930('0x1a')]],'as':_0x349868['as'],'attributes':_0x349868['attributes'],'include':_0x349868[_0x3930('0x18')]?_['map'](_0x349868[_0x3930('0x18')],function(_0x3aee1f){return{'model':db[_0x3aee1f[_0x3930('0x1a')]],'as':_0x3aee1f['as'],'attributes':_0x3aee1f[_0x3930('0x16')],'include':_0x3aee1f[_0x3930('0x18')]?_[_0x3930('0x19')](_0x3aee1f[_0x3930('0x18')],function(_0x28f47b){return{'model':db[_0x28f47b[_0x3930('0x1a')]],'as':_0x28f47b['as'],'attributes':_0x28f47b[_0x3930('0x16')]};}):[]};}):[]};}):[]:[]})[_0x3930('0x9')](function(_0x2e9694){logger[_0x3930('0x10')](_0x3930('0x1d'),_0x8fdd26);logger[_0x3930('0x1b')](_0x3930('0x1d'),_0x8fdd26,JSON['stringify'](_0x2e9694));_0xc4a53e(_0x2e9694);})[_0x3930('0x1c')](function(_0x533d69){logger[_0x3930('0xd')]('ShowZendeskAccount',_0x533d69[_0x3930('0xf')],_0x8fdd26);_0x148f4e(_0xcd21b7['error'](0x1f4,_0x533d69['message']));});});}; \ No newline at end of file +var _0x855e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','include','map','model','attributes','catch','ShowZendeskAccount','lodash'];(function(_0xce0b2b,_0x355d55){var _0x4ebc58=function(_0x205a0f){while(--_0x205a0f){_0xce0b2b['push'](_0xce0b2b['shift']());}};_0x4ebc58(++_0x355d55);}(_0x855e,0x1af));var _0xe855=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x855e[_0x8b8564];return _0x360c61;};'use strict';var _=require(_0xe855('0x0'));var util=require(_0xe855('0x1'));var moment=require(_0xe855('0x2'));var BPromise=require(_0xe855('0x3'));var rs=require(_0xe855('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe855('0x5'))['db'];var utils=require(_0xe855('0x6'));var logger=require(_0xe855('0x7'))(_0xe855('0x8'));var config=require(_0xe855('0x9'));var jayson=require(_0xe855('0xa'));var client=jayson[_0xe855('0xb')][_0xe855('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58be7e,_0x3a598e,_0x127739){return new BPromise(function(_0x812b79,_0x3cf2b2){return client[_0xe855('0xd')](_0x58be7e,_0x127739)[_0xe855('0xe')](function(_0x27b04c){logger[_0xe855('0xf')](_0xe855('0x10'),_0x3a598e,_0xe855('0x11'));logger[_0xe855('0x12')](_0xe855('0x13'),_0x3a598e,_0xe855('0x11'),JSON[_0xe855('0x14')](_0x27b04c));if(_0x27b04c[_0xe855('0x15')]){if(_0x27b04c[_0xe855('0x15')][_0xe855('0x16')]===0x1f4){logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x27b04c[_0xe855('0x15')]['message']);return _0x3cf2b2(_0x27b04c[_0xe855('0x15')][_0xe855('0x17')]);}logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x27b04c['error']['message']);return _0x812b79(_0x27b04c[_0xe855('0x15')]['message']);}else{logger[_0xe855('0xf')](_0xe855('0x10'),_0x3a598e,_0xe855('0x11'));_0x812b79(_0x27b04c['result']['message']);}})['catch'](function(_0x312920){logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x312920);_0x3cf2b2(_0x312920);});});}exports[_0xe855('0x18')]=function(_0xfca61b){var _0x3a96ac=this;return new Promise(function(_0x4e25db,_0x9c91e2){return db[_0xe855('0x19')][_0xe855('0x1a')]({'raw':_0xfca61b['options']?_0xfca61b[_0xe855('0x1b')][_0xe855('0x1c')]===undefined?!![]:![]:!![],'where':_0xfca61b[_0xe855('0x1b')]?_0xfca61b['options'][_0xe855('0x1d')]||null:null,'attributes':_0xfca61b[_0xe855('0x1b')]?_0xfca61b['options']['attributes']||null:null,'limit':_0xfca61b[_0xe855('0x1b')]?_0xfca61b[_0xe855('0x1b')]['limit']||null:null,'include':_0xfca61b[_0xe855('0x1b')]?_0xfca61b[_0xe855('0x1b')][_0xe855('0x1e')]?_[_0xe855('0x1f')](_0xfca61b[_0xe855('0x1b')]['include'],function(_0x1600b9){return{'model':db[_0x1600b9[_0xe855('0x20')]],'as':_0x1600b9['as'],'attributes':_0x1600b9[_0xe855('0x21')],'include':_0x1600b9['include']?_[_0xe855('0x1f')](_0x1600b9['include'],function(_0x21779b){return{'model':db[_0x21779b[_0xe855('0x20')]],'as':_0x21779b['as'],'attributes':_0x21779b[_0xe855('0x21')],'include':_0x21779b[_0xe855('0x1e')]?_[_0xe855('0x1f')](_0x21779b[_0xe855('0x1e')],function(_0x4bf7ee){return{'model':db[_0x4bf7ee[_0xe855('0x20')]],'as':_0x4bf7ee['as'],'attributes':_0x4bf7ee[_0xe855('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe855('0xe')](function(_0x22f43b){logger[_0xe855('0xf')](_0xe855('0x18'),_0xfca61b);logger[_0xe855('0x12')](_0xe855('0x18'),_0xfca61b,JSON['stringify'](_0x22f43b));_0x4e25db(_0x22f43b);})[_0xe855('0x22')](function(_0x24c5a7){logger[_0xe855('0x15')](_0xe855('0x18'),_0x24c5a7[_0xe855('0x17')],_0xfca61b);_0x9c91e2(_0x3a96ac[_0xe855('0x15')](0x1f4,_0x24c5a7[_0xe855('0x17')]));});});};exports[_0xe855('0x23')]=function(_0x3cd756){var _0x558bdf=this;return new Promise(function(_0xabbe95,_0x53dfd5){return db['ZendeskAccount']['find']({'raw':_0x3cd756['options']?_0x3cd756[_0xe855('0x1b')][_0xe855('0x1c')]===undefined?!![]:![]:!![],'where':_0x3cd756[_0xe855('0x1b')]?_0x3cd756[_0xe855('0x1b')][_0xe855('0x1d')]||null:null,'attributes':_0x3cd756[_0xe855('0x1b')]?_0x3cd756[_0xe855('0x1b')][_0xe855('0x21')]||null:null,'include':_0x3cd756[_0xe855('0x1b')]?_0x3cd756['options']['include']?_['map'](_0x3cd756['options']['include'],function(_0x5d1223){return{'model':db[_0x5d1223[_0xe855('0x20')]],'as':_0x5d1223['as'],'attributes':_0x5d1223[_0xe855('0x21')],'include':_0x5d1223[_0xe855('0x1e')]?_[_0xe855('0x1f')](_0x5d1223[_0xe855('0x1e')],function(_0x5f448d){return{'model':db[_0x5f448d[_0xe855('0x20')]],'as':_0x5f448d['as'],'attributes':_0x5f448d[_0xe855('0x21')],'include':_0x5f448d[_0xe855('0x1e')]?_[_0xe855('0x1f')](_0x5f448d[_0xe855('0x1e')],function(_0x473b5a){return{'model':db[_0x473b5a['model']],'as':_0x473b5a['as'],'attributes':_0x473b5a[_0xe855('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1619c7){logger['info']('ShowZendeskAccount',_0x3cd756);logger[_0xe855('0x12')](_0xe855('0x23'),_0x3cd756,JSON[_0xe855('0x14')](_0x1619c7));_0xabbe95(_0x1619c7);})[_0xe855('0x22')](function(_0x55b9a0){logger[_0xe855('0x15')](_0xe855('0x23'),_0x55b9a0['message'],_0x3cd756);_0x53dfd5(_0x558bdf[_0xe855('0x15')](0x1f4,_0x55b9a0['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 69475ff..8f8d81c 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 _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x430469,_0x20e783){var _0x1ca55e=function(_0x42e6e6){while(--_0x42e6e6){_0x430469['push'](_0x430469['shift']());}};_0x1ca55e(++_0x20e783);}(_0x4483,0x1a3));var _0x3448=function(_0x360187,_0x3a1596){_0x360187=_0x360187-0x0;var _0x16af1f=_0x4483[_0x360187];return _0x16af1f;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a35b193..dcbf8df 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 _0xde97=['sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xde97,0x153));var _0x7de9=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xde97[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require(_0x7de9('0x0'));module[_0x7de9('0x1')]={'name':{'type':Sequelize[_0x7de9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xabc9=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabc9,0x153));var _0x9abc=function(_0x394c84,_0x52270e){_0x394c84=_0x394c84-0x0;var _0x43c051=_0xabc9[_0x394c84];return _0x43c051;};'use strict';var Sequelize=require('sequelize');module[_0x9abc('0x0')]={'name':{'type':Sequelize[_0x9abc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 81d0f67..f9c579f 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 _0x0420=['sort','where','filters','pick','filter','VIRTUAL','merge','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','ZendeskField','order','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','destroy','then','stack','name','send','index','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1c7a19,_0x1a87aa){var _0xd88e57=function(_0x4a57e7){while(--_0x4a57e7){_0x1c7a19['push'](_0x1c7a19['shift']());}};_0xd88e57(++_0x1a87aa);}(_0x0420,0x6d));var _0x0042=function(_0x4b6643,_0x9e4308){_0x4b6643=_0x4b6643-0x0;var _0x3dc376=_0x0420[_0x4b6643];return _0x3dc376;};'use strict';var emlformat=require(_0x0042('0x0'));var rimraf=require(_0x0042('0x1'));var zipdir=require(_0x0042('0x2'));var jsonpatch=require(_0x0042('0x3'));var rp=require(_0x0042('0x4'));var moment=require('moment');var BPromise=require(_0x0042('0x5'));var Mustache=require(_0x0042('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0042('0x7'));var csv=require(_0x0042('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0042('0x9'));var _=require(_0x0042('0xa'));var squel=require(_0x0042('0xb'));var crypto=require(_0x0042('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0042('0xd'));var toCsv=require(_0x0042('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0042('0xe'));var authService=require(_0x0042('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0042('0x10'));var hardwareService=require(_0x0042('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0042('0x12'));var config=require(_0x0042('0x13'));var licenseUtil=require(_0x0042('0x14'));var db=require(_0x0042('0x15'))['db'];function respondWithStatusCode(_0x14b297,_0x2782ef){_0x2782ef=_0x2782ef||0xcc;return function(_0x12dfe8){if(_0x12dfe8){return _0x14b297[_0x0042('0x16')](_0x2782ef);}return _0x14b297[_0x0042('0x17')](_0x2782ef)[_0x0042('0x18')]();};}function respondWithResult(_0x1a6826,_0x2c0fa7){_0x2c0fa7=_0x2c0fa7||0xc8;return function(_0x171c93){if(_0x171c93){return _0x1a6826['status'](_0x2c0fa7)['json'](_0x171c93);}};}function respondWithFilteredResult(_0x713526,_0x17ab62){return function(_0x5c878b){if(_0x5c878b){var _0x5df8f0=typeof _0x17ab62[_0x0042('0x19')]===_0x0042('0x1a')&&typeof _0x17ab62[_0x0042('0x1b')]==='undefined';var _0x1a8d89=_0x5c878b[_0x0042('0x1c')];var _0x3ecccf=_0x5df8f0?0x0:_0x17ab62[_0x0042('0x19')];var _0x56f68a=_0x5df8f0?_0x5c878b[_0x0042('0x1c')]:_0x17ab62[_0x0042('0x19')]+_0x17ab62['limit'];var _0x525e59;if(_0x56f68a>=_0x1a8d89){_0x56f68a=_0x1a8d89;_0x525e59=0xc8;}else{_0x525e59=0xce;}_0x713526[_0x0042('0x17')](_0x525e59);return _0x713526['set']('Content-Range',_0x3ecccf+'-'+_0x56f68a+'/'+_0x1a8d89)['json'](_0x5c878b);}return null;};}function patchUpdates(_0x18e9d7){return function(_0x36bb72){try{jsonpatch[_0x0042('0x1d')](_0x36bb72,_0x18e9d7,!![]);}catch(_0x45becb){return BPromise[_0x0042('0x1e')](_0x45becb);}return _0x36bb72[_0x0042('0x1f')]();};}function saveUpdates(_0x19641c,_0x322b3d){return function(_0x8a3b1f){if(_0x8a3b1f){return _0x8a3b1f[_0x0042('0x20')](_0x19641c)['then'](function(_0x1ad2f0){return _0x1ad2f0;});}return null;};}function removeEntity(_0x46fa1e,_0x30b7ff){return function(_0x3275f0){if(_0x3275f0){return _0x3275f0[_0x0042('0x21')]()[_0x0042('0x22')](function(){_0x46fa1e[_0x0042('0x17')](0xcc)[_0x0042('0x18')]();});}};}function handleEntityNotFound(_0x3641c1,_0x46dac3){return function(_0x43748f){if(!_0x43748f){_0x3641c1[_0x0042('0x16')](0x194);}return _0x43748f;};}function handleError(_0x465f93,_0x4526f4){_0x4526f4=_0x4526f4||0x1f4;return function(_0x3117b9){logger['error'](_0x3117b9[_0x0042('0x23')]);if(_0x3117b9['name']){delete _0x3117b9[_0x0042('0x24')];}_0x465f93[_0x0042('0x17')](_0x4526f4)[_0x0042('0x25')](_0x3117b9);};}exports[_0x0042('0x26')]=function(_0x52f971,_0x19efe5){var _0x25bb46={},_0x5c72ca={},_0x57162a={'count':0x0,'rows':[]};var _0x1c89f3=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x38810b){return{'name':_0x38810b['fieldName'],'type':_0x38810b[_0x0042('0x27')][_0x0042('0x28')]};});_0x5c72ca['model']=_[_0x0042('0x29')](_0x1c89f3,'name');_0x5c72ca['query']=_[_0x0042('0x2a')](_0x52f971[_0x0042('0x2b')]);_0x5c72ca['filters']=_[_0x0042('0x2c')](_0x5c72ca[_0x0042('0x2d')],_0x5c72ca[_0x0042('0x2b')]);_0x25bb46[_0x0042('0x2e')]=_[_0x0042('0x2c')](_0x5c72ca[_0x0042('0x2d')],qs[_0x0042('0x2f')](_0x52f971[_0x0042('0x2b')][_0x0042('0x2f')]));_0x25bb46['attributes']=_0x25bb46[_0x0042('0x2e')][_0x0042('0x30')]?_0x25bb46[_0x0042('0x2e')]:_0x5c72ca[_0x0042('0x2d')];if(!_0x52f971[_0x0042('0x2b')][_0x0042('0x31')](_0x0042('0x32'))){_0x25bb46[_0x0042('0x1b')]=qs[_0x0042('0x1b')](_0x52f971['query'][_0x0042('0x1b')]);_0x25bb46[_0x0042('0x19')]=qs[_0x0042('0x19')](_0x52f971[_0x0042('0x2b')]['offset']);}_0x25bb46['order']=qs['sort'](_0x52f971[_0x0042('0x2b')][_0x0042('0x33')]);_0x25bb46[_0x0042('0x34')]=qs[_0x0042('0x35')](_[_0x0042('0x36')](_0x52f971[_0x0042('0x2b')],_0x5c72ca[_0x0042('0x35')]),_0x1c89f3);if(_0x52f971[_0x0042('0x2b')][_0x0042('0x37')]){_0x25bb46[_0x0042('0x34')]=_['merge'](_0x25bb46[_0x0042('0x34')],{'$or':_[_0x0042('0x29')](_0x1c89f3,function(_0x153334){if(_0x153334['type']!==_0x0042('0x38')){var _0x220f7f={};_0x220f7f[_0x153334['name']]={'$like':'%'+_0x52f971['query']['filter']+'%'};return _0x220f7f;}})});}_0x25bb46=_[_0x0042('0x39')]({},_0x25bb46,_0x52f971['options']);var _0x287cbf={'where':_0x25bb46[_0x0042('0x34')]};return db[_0x0042('0x3a')][_0x0042('0x1c')](_0x287cbf)[_0x0042('0x22')](function(_0x155d44){_0x57162a['count']=_0x155d44;if(_0x52f971[_0x0042('0x2b')][_0x0042('0x3b')]){_0x25bb46[_0x0042('0x3c')]=[{'all':!![]}];}return db[_0x0042('0x3a')][_0x0042('0x3d')](_0x25bb46);})['then'](function(_0x170976){_0x57162a[_0x0042('0x3e')]=_0x170976;return _0x57162a;})[_0x0042('0x22')](respondWithFilteredResult(_0x19efe5,_0x25bb46))[_0x0042('0x3f')](handleError(_0x19efe5,null));};exports[_0x0042('0x40')]=function(_0x3d6f96,_0x3d2279){var _0x5da6ce={'raw':![],'where':{'id':_0x3d6f96[_0x0042('0x41')]['id']}},_0x347f26={};_0x347f26[_0x0042('0x2d')]=_[_0x0042('0x2a')](db[_0x0042('0x3a')][_0x0042('0x42')]);_0x347f26[_0x0042('0x2b')]=_[_0x0042('0x2a')](_0x3d6f96[_0x0042('0x2b')]);_0x347f26[_0x0042('0x35')]=_[_0x0042('0x2c')](_0x347f26['model'],_0x347f26[_0x0042('0x2b')]);_0x5da6ce['attributes']=_['intersection'](_0x347f26[_0x0042('0x2d')],qs[_0x0042('0x2f')](_0x3d6f96['query'][_0x0042('0x2f')]));_0x5da6ce[_0x0042('0x2e')]=_0x5da6ce[_0x0042('0x2e')][_0x0042('0x30')]?_0x5da6ce[_0x0042('0x2e')]:_0x347f26[_0x0042('0x2d')];if(_0x3d6f96['query'][_0x0042('0x3b')]){_0x5da6ce[_0x0042('0x3c')]=[{'all':!![]}];}_0x5da6ce=_[_0x0042('0x39')]({},_0x5da6ce,_0x3d6f96[_0x0042('0x43')]);return db[_0x0042('0x3a')][_0x0042('0x44')](_0x5da6ce)[_0x0042('0x22')](handleEntityNotFound(_0x3d2279,null))['then'](respondWithResult(_0x3d2279,null))['catch'](handleError(_0x3d2279,null));};exports['create']=function(_0x81dc6e,_0x1a3b35){return db['ZendeskConfiguration'][_0x0042('0x45')](_0x81dc6e[_0x0042('0x46')],{})[_0x0042('0x22')](respondWithResult(_0x1a3b35,0xc9))[_0x0042('0x3f')](handleError(_0x1a3b35,null));};exports['update']=function(_0x2e1007,_0x5aadce){if(_0x2e1007[_0x0042('0x46')]['id']){delete _0x2e1007['body']['id'];}return db[_0x0042('0x3a')][_0x0042('0x44')]({'where':{'id':_0x2e1007[_0x0042('0x41')]['id']}})['then'](handleEntityNotFound(_0x5aadce,null))[_0x0042('0x22')](saveUpdates(_0x2e1007[_0x0042('0x46')],null))[_0x0042('0x22')](respondWithResult(_0x5aadce,null))['catch'](handleError(_0x5aadce,null));};exports[_0x0042('0x21')]=function(_0x11ca20,_0x22023c){return db[_0x0042('0x3a')][_0x0042('0x44')]({'where':{'id':_0x11ca20[_0x0042('0x41')]['id']}})[_0x0042('0x22')](handleEntityNotFound(_0x22023c,null))['then'](removeEntity(_0x22023c,null))[_0x0042('0x3f')](handleError(_0x22023c,null));};exports[_0x0042('0x47')]=function(_0x358653,_0x50ff5c,_0x23d6cb){var _0x2fd922={};var _0x525b1b={};var _0xa78983;var _0xec12aa;return db[_0x0042('0x3a')]['findOne']({'where':{'id':_0x358653[_0x0042('0x41')]['id']}})['then'](handleEntityNotFound(_0x50ff5c,null))[_0x0042('0x22')](function(_0x21b4f4){if(_0x21b4f4){_0xa78983=_0x21b4f4;_0x525b1b[_0x0042('0x2d')]=_['keys'](db[_0x0042('0x48')][_0x0042('0x42')]);_0x525b1b[_0x0042('0x2b')]=_[_0x0042('0x2a')](_0x358653[_0x0042('0x2b')]);_0x525b1b['filters']=_['intersection'](_0x525b1b[_0x0042('0x2d')],_0x525b1b[_0x0042('0x2b')]);_0x2fd922['attributes']=_[_0x0042('0x2c')](_0x525b1b[_0x0042('0x2d')],qs[_0x0042('0x2f')](_0x358653['query']['fields']));_0x2fd922[_0x0042('0x2e')]=_0x2fd922[_0x0042('0x2e')][_0x0042('0x30')]?_0x2fd922[_0x0042('0x2e')]:_0x525b1b[_0x0042('0x2d')];_0x2fd922['order']=qs[_0x0042('0x33')](_0x358653[_0x0042('0x2b')]['sort']);_0x2fd922[_0x0042('0x34')]=qs['filters'](_[_0x0042('0x36')](_0x358653['query'],_0x525b1b[_0x0042('0x35')]));if(_0x358653[_0x0042('0x2b')]['filter']){_0x2fd922[_0x0042('0x34')]=_[_0x0042('0x39')](_0x2fd922[_0x0042('0x34')],{'$or':_[_0x0042('0x29')](_0x2fd922[_0x0042('0x2e')],function(_0x186138){var _0x463e2c={};_0x463e2c[_0x186138]={'$like':'%'+_0x358653[_0x0042('0x2b')][_0x0042('0x37')]+'%'};return _0x463e2c;})});}_0x2fd922=_[_0x0042('0x39')]({},_0x2fd922,_0x358653[_0x0042('0x43')]);return _0xa78983[_0x0042('0x47')](_0x2fd922);}})[_0x0042('0x22')](function(_0x3513bf){if(_0x3513bf){_0xec12aa=_0x3513bf[_0x0042('0x30')];if(!_0x358653['query'][_0x0042('0x31')](_0x0042('0x32'))){_0x2fd922[_0x0042('0x1b')]=qs[_0x0042('0x1b')](_0x358653['query'][_0x0042('0x1b')]);_0x2fd922[_0x0042('0x19')]=qs[_0x0042('0x19')](_0x358653[_0x0042('0x2b')][_0x0042('0x19')]);}return _0xa78983[_0x0042('0x47')](_0x2fd922);}})[_0x0042('0x22')](function(_0x1266d9){if(_0x1266d9){return _0x1266d9?{'count':_0xec12aa,'rows':_0x1266d9}:null;}})[_0x0042('0x22')](respondWithResult(_0x50ff5c,null))[_0x0042('0x3f')](handleError(_0x50ff5c,null));};exports['getSubjects']=function(_0x4a9531,_0x46f67b,_0x19fd48){var _0x4404b9={};var _0x5dbaa0={};var _0x3b667f;var _0x1aab44;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4a9531[_0x0042('0x41')]['id']}})[_0x0042('0x22')](handleEntityNotFound(_0x46f67b,null))['then'](function(_0x33b956){if(_0x33b956){_0x3b667f=_0x33b956;_0x5dbaa0[_0x0042('0x2d')]=_[_0x0042('0x2a')](db[_0x0042('0x48')][_0x0042('0x42')]);_0x5dbaa0[_0x0042('0x2b')]=_[_0x0042('0x2a')](_0x4a9531[_0x0042('0x2b')]);_0x5dbaa0[_0x0042('0x35')]=_['intersection'](_0x5dbaa0['model'],_0x5dbaa0['query']);_0x4404b9['attributes']=_['intersection'](_0x5dbaa0[_0x0042('0x2d')],qs[_0x0042('0x2f')](_0x4a9531[_0x0042('0x2b')]['fields']));_0x4404b9[_0x0042('0x2e')]=_0x4404b9['attributes']['length']?_0x4404b9[_0x0042('0x2e')]:_0x5dbaa0['model'];_0x4404b9[_0x0042('0x49')]=qs['sort'](_0x4a9531[_0x0042('0x2b')]['sort']);_0x4404b9[_0x0042('0x34')]=qs[_0x0042('0x35')](_[_0x0042('0x36')](_0x4a9531[_0x0042('0x2b')],_0x5dbaa0['filters']));if(_0x4a9531['query']['filter']){_0x4404b9[_0x0042('0x34')]=_[_0x0042('0x39')](_0x4404b9['where'],{'$or':_[_0x0042('0x29')](_0x4404b9['attributes'],function(_0x36b636){var _0x44823={};_0x44823[_0x36b636]={'$like':'%'+_0x4a9531[_0x0042('0x2b')][_0x0042('0x37')]+'%'};return _0x44823;})});}_0x4404b9=_['merge']({},_0x4404b9,_0x4a9531[_0x0042('0x43')]);return _0x3b667f[_0x0042('0x4a')](_0x4404b9);}})['then'](function(_0xef65e8){if(_0xef65e8){_0x1aab44=_0xef65e8[_0x0042('0x30')];if(!_0x4a9531[_0x0042('0x2b')][_0x0042('0x31')](_0x0042('0x32'))){_0x4404b9[_0x0042('0x1b')]=qs[_0x0042('0x1b')](_0x4a9531[_0x0042('0x2b')]['limit']);_0x4404b9[_0x0042('0x19')]=qs[_0x0042('0x19')](_0x4a9531[_0x0042('0x2b')][_0x0042('0x19')]);}return _0x3b667f[_0x0042('0x4a')](_0x4404b9);}})['then'](function(_0x46782f){if(_0x46782f){return _0x46782f?{'count':_0x1aab44,'rows':_0x46782f}:null;}})[_0x0042('0x22')](respondWithResult(_0x46f67b,null))[_0x0042('0x3f')](handleError(_0x46f67b,null));};exports['getDescriptions']=function(_0x40b391,_0x338261,_0x5a727f){var _0x49d1ef={};var _0x596914={};var _0x1921c5;var _0x5e922d;return db[_0x0042('0x3a')][_0x0042('0x4b')]({'where':{'id':_0x40b391[_0x0042('0x41')]['id']}})[_0x0042('0x22')](handleEntityNotFound(_0x338261,null))[_0x0042('0x22')](function(_0x337895){if(_0x337895){_0x1921c5=_0x337895;_0x596914[_0x0042('0x2d')]=_[_0x0042('0x2a')](db[_0x0042('0x48')][_0x0042('0x42')]);_0x596914[_0x0042('0x2b')]=_[_0x0042('0x2a')](_0x40b391[_0x0042('0x2b')]);_0x596914[_0x0042('0x35')]=_[_0x0042('0x2c')](_0x596914[_0x0042('0x2d')],_0x596914[_0x0042('0x2b')]);_0x49d1ef[_0x0042('0x2e')]=_['intersection'](_0x596914[_0x0042('0x2d')],qs[_0x0042('0x2f')](_0x40b391[_0x0042('0x2b')][_0x0042('0x2f')]));_0x49d1ef[_0x0042('0x2e')]=_0x49d1ef[_0x0042('0x2e')][_0x0042('0x30')]?_0x49d1ef['attributes']:_0x596914[_0x0042('0x2d')];_0x49d1ef[_0x0042('0x49')]=qs[_0x0042('0x33')](_0x40b391[_0x0042('0x2b')][_0x0042('0x33')]);_0x49d1ef['where']=qs[_0x0042('0x35')](_[_0x0042('0x36')](_0x40b391[_0x0042('0x2b')],_0x596914[_0x0042('0x35')]));if(_0x40b391['query'][_0x0042('0x37')]){_0x49d1ef[_0x0042('0x34')]=_[_0x0042('0x39')](_0x49d1ef[_0x0042('0x34')],{'$or':_['map'](_0x49d1ef[_0x0042('0x2e')],function(_0x13767a){var _0x1c739f={};_0x1c739f[_0x13767a]={'$like':'%'+_0x40b391[_0x0042('0x2b')][_0x0042('0x37')]+'%'};return _0x1c739f;})});}_0x49d1ef=_[_0x0042('0x39')]({},_0x49d1ef,_0x40b391[_0x0042('0x43')]);return _0x1921c5[_0x0042('0x4c')](_0x49d1ef);}})[_0x0042('0x22')](function(_0x424d41){if(_0x424d41){_0x5e922d=_0x424d41[_0x0042('0x30')];if(!_0x40b391[_0x0042('0x2b')][_0x0042('0x31')]('nolimit')){_0x49d1ef['limit']=qs['limit'](_0x40b391[_0x0042('0x2b')][_0x0042('0x1b')]);_0x49d1ef[_0x0042('0x19')]=qs[_0x0042('0x19')](_0x40b391[_0x0042('0x2b')][_0x0042('0x19')]);}return _0x1921c5[_0x0042('0x4c')](_0x49d1ef);}})[_0x0042('0x22')](function(_0x1a7dd1){if(_0x1a7dd1){return _0x1a7dd1?{'count':_0x5e922d,'rows':_0x1a7dd1}:null;}})[_0x0042('0x22')](respondWithResult(_0x338261,null))['catch'](handleError(_0x338261,null));};exports[_0x0042('0x4d')]=function(_0x34e46c,_0x5af433,_0x255361){var _0x251ff1={};var _0x3ccb9e={};var _0x42a427;var _0x265ffa;return db[_0x0042('0x3a')]['findOne']({'where':{'id':_0x34e46c[_0x0042('0x41')]['id']}})[_0x0042('0x22')](handleEntityNotFound(_0x5af433,null))[_0x0042('0x22')](function(_0x1deb21){if(_0x1deb21){_0x42a427=_0x1deb21;_0x3ccb9e[_0x0042('0x2d')]=_['keys'](db['Tag'][_0x0042('0x42')]);_0x3ccb9e[_0x0042('0x2b')]=_[_0x0042('0x2a')](_0x34e46c[_0x0042('0x2b')]);_0x3ccb9e['filters']=_[_0x0042('0x2c')](_0x3ccb9e['model'],_0x3ccb9e[_0x0042('0x2b')]);_0x251ff1['attributes']=_[_0x0042('0x2c')](_0x3ccb9e[_0x0042('0x2d')],qs[_0x0042('0x2f')](_0x34e46c['query'][_0x0042('0x2f')]));_0x251ff1[_0x0042('0x2e')]=_0x251ff1[_0x0042('0x2e')][_0x0042('0x30')]?_0x251ff1[_0x0042('0x2e')]:_0x3ccb9e[_0x0042('0x2d')];_0x251ff1[_0x0042('0x49')]=qs['sort'](_0x34e46c[_0x0042('0x2b')][_0x0042('0x33')]);_0x251ff1[_0x0042('0x34')]=qs[_0x0042('0x35')](_[_0x0042('0x36')](_0x34e46c[_0x0042('0x2b')],_0x3ccb9e[_0x0042('0x35')]));if(_0x34e46c[_0x0042('0x2b')][_0x0042('0x37')]){_0x251ff1[_0x0042('0x34')]=_[_0x0042('0x39')](_0x251ff1[_0x0042('0x34')],{'$or':_[_0x0042('0x29')](_0x251ff1[_0x0042('0x2e')],function(_0x42ccde){var _0x6ac337={};_0x6ac337[_0x42ccde]={'$like':'%'+_0x34e46c['query']['filter']+'%'};return _0x6ac337;})});}_0x251ff1=_[_0x0042('0x39')]({},_0x251ff1,_0x34e46c[_0x0042('0x43')]);return _0x42a427[_0x0042('0x4d')](_0x251ff1);}})[_0x0042('0x22')](function(_0x3e2434){if(_0x3e2434){_0x265ffa=_0x3e2434[_0x0042('0x30')];if(!_0x34e46c[_0x0042('0x2b')]['hasOwnProperty'](_0x0042('0x32'))){_0x251ff1[_0x0042('0x1b')]=qs[_0x0042('0x1b')](_0x34e46c[_0x0042('0x2b')][_0x0042('0x1b')]);_0x251ff1[_0x0042('0x19')]=qs[_0x0042('0x19')](_0x34e46c[_0x0042('0x2b')][_0x0042('0x19')]);}return _0x42a427[_0x0042('0x4d')](_0x251ff1);}})[_0x0042('0x22')](function(_0x30303a){if(_0x30303a){return _0x30303a?{'count':_0x265ffa,'rows':_0x30303a}:null;}})[_0x0042('0x22')](respondWithResult(_0x5af433,null))[_0x0042('0x3f')](handleError(_0x5af433,null));};exports[_0x0042('0x4e')]=function(_0xa89672,_0x588729,_0xfee409){if(_0xa89672['body']['id']){delete _0xa89672[_0x0042('0x46')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xa89672['params']['id']}})[_0x0042('0x22')](handleEntityNotFound(_0x588729,null))[_0x0042('0x22')](function(_0x212b84){if(_0x212b84){return _0x212b84[_0x0042('0x4e')](_0xa89672[_0x0042('0x46')][_0x0042('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x588729,null))[_0x0042('0x3f')](handleError(_0x588729,null));}; \ No newline at end of file +var _0x9272=['ZendeskConfiguration','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','catch','destroy','params','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x9272,0xbd));var _0x2927=function(_0x30f3d7,_0x3848a7){_0x30f3d7=_0x30f3d7-0x0;var _0x5db7d6=_0x9272[_0x30f3d7];return _0x5db7d6;};'use strict';var emlformat=require(_0x2927('0x0'));var rimraf=require(_0x2927('0x1'));var zipdir=require(_0x2927('0x2'));var jsonpatch=require(_0x2927('0x3'));var rp=require(_0x2927('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2927('0x5'));var util=require(_0x2927('0x6'));var path=require('path');var sox=require(_0x2927('0x7'));var csv=require(_0x2927('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2927('0x9'));var _=require(_0x2927('0xa'));var squel=require(_0x2927('0xb'));var crypto=require(_0x2927('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2927('0xd'));var toCsv=require(_0x2927('0x8'));var querystring=require('querystring');var Papa=require(_0x2927('0xe'));var Redis=require(_0x2927('0xf'));var authService=require(_0x2927('0x10'));var qs=require(_0x2927('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2927('0x12'));var logger=require(_0x2927('0x13'))(_0x2927('0x14'));var utils=require('../../config/utils');var config=require(_0x2927('0x15'));var licenseUtil=require(_0x2927('0x16'));var db=require(_0x2927('0x17'))['db'];function respondWithStatusCode(_0x4f2313,_0xb417a0){_0xb417a0=_0xb417a0||0xcc;return function(_0x58ef90){if(_0x58ef90){return _0x4f2313[_0x2927('0x18')](_0xb417a0);}return _0x4f2313[_0x2927('0x19')](_0xb417a0)[_0x2927('0x1a')]();};}function respondWithResult(_0x374cdb,_0x48cd5c){_0x48cd5c=_0x48cd5c||0xc8;return function(_0x16221c){if(_0x16221c){return _0x374cdb[_0x2927('0x19')](_0x48cd5c)[_0x2927('0x1b')](_0x16221c);}};}function respondWithFilteredResult(_0x17ea84,_0x397754){return function(_0x25ecd6){if(_0x25ecd6){var _0x39a570=typeof _0x397754[_0x2927('0x1c')]===_0x2927('0x1d')&&typeof _0x397754[_0x2927('0x1e')]===_0x2927('0x1d');var _0x482a33=_0x25ecd6['count'];var _0x1569c8=_0x39a570?0x0:_0x397754[_0x2927('0x1c')];var _0x5bdaa8=_0x39a570?_0x25ecd6[_0x2927('0x1f')]:_0x397754[_0x2927('0x1c')]+_0x397754['limit'];var _0x2e23f0;if(_0x5bdaa8>=_0x482a33){_0x5bdaa8=_0x482a33;_0x2e23f0=0xc8;}else{_0x2e23f0=0xce;}_0x17ea84[_0x2927('0x19')](_0x2e23f0);return _0x17ea84[_0x2927('0x20')](_0x2927('0x21'),_0x1569c8+'-'+_0x5bdaa8+'/'+_0x482a33)[_0x2927('0x1b')](_0x25ecd6);}return null;};}function patchUpdates(_0x4b754d){return function(_0x5d9ef4){try{jsonpatch['apply'](_0x5d9ef4,_0x4b754d,!![]);}catch(_0x39965a){return BPromise[_0x2927('0x22')](_0x39965a);}return _0x5d9ef4['save']();};}function saveUpdates(_0x5439f7,_0x1abea3){return function(_0x57aa1d){if(_0x57aa1d){return _0x57aa1d[_0x2927('0x23')](_0x5439f7)['then'](function(_0x42176a){return _0x42176a;});}return null;};}function removeEntity(_0x3c553f,_0x25226f){return function(_0x786441){if(_0x786441){return _0x786441['destroy']()[_0x2927('0x24')](function(){_0x3c553f['status'](0xcc)[_0x2927('0x1a')]();});}};}function handleEntityNotFound(_0x4991df,_0x340321){return function(_0x4b360b){if(!_0x4b360b){_0x4991df[_0x2927('0x18')](0x194);}return _0x4b360b;};}function handleError(_0x511b5c,_0x3e6565){_0x3e6565=_0x3e6565||0x1f4;return function(_0x237ec2){logger[_0x2927('0x25')](_0x237ec2[_0x2927('0x26')]);if(_0x237ec2['name']){delete _0x237ec2[_0x2927('0x27')];}_0x511b5c[_0x2927('0x19')](_0x3e6565)[_0x2927('0x28')](_0x237ec2);};}exports[_0x2927('0x29')]=function(_0x79161c,_0x3929c5){var _0x43b23a={},_0xfdd52e={},_0x3cc455={'count':0x0,'rows':[]};var _0x4efdd4=_[_0x2927('0x2a')](db['ZendeskConfiguration']['rawAttributes'],function(_0x10fbad){return{'name':_0x10fbad['fieldName'],'type':_0x10fbad['type'][_0x2927('0x2b')]};});_0xfdd52e[_0x2927('0x2c')]=_[_0x2927('0x2a')](_0x4efdd4,_0x2927('0x27'));_0xfdd52e[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x79161c[_0x2927('0x2d')]);_0xfdd52e['filters']=_[_0x2927('0x2f')](_0xfdd52e[_0x2927('0x2c')],_0xfdd52e[_0x2927('0x2d')]);_0x43b23a[_0x2927('0x30')]=_[_0x2927('0x2f')](_0xfdd52e[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x79161c[_0x2927('0x2d')][_0x2927('0x31')]));_0x43b23a[_0x2927('0x30')]=_0x43b23a[_0x2927('0x30')][_0x2927('0x32')]?_0x43b23a[_0x2927('0x30')]:_0xfdd52e[_0x2927('0x2c')];if(!_0x79161c[_0x2927('0x2d')]['hasOwnProperty'](_0x2927('0x33'))){_0x43b23a['limit']=qs[_0x2927('0x1e')](_0x79161c[_0x2927('0x2d')][_0x2927('0x1e')]);_0x43b23a['offset']=qs[_0x2927('0x1c')](_0x79161c[_0x2927('0x2d')][_0x2927('0x1c')]);}_0x43b23a[_0x2927('0x34')]=qs[_0x2927('0x35')](_0x79161c['query'][_0x2927('0x35')]);_0x43b23a[_0x2927('0x36')]=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x79161c[_0x2927('0x2d')],_0xfdd52e[_0x2927('0x37')]),_0x4efdd4);if(_0x79161c[_0x2927('0x2d')][_0x2927('0x39')]){_0x43b23a['where']=_[_0x2927('0x3a')](_0x43b23a[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x4efdd4,function(_0x22ee24){if(_0x22ee24['type']!=='VIRTUAL'){var _0x4854fa={};_0x4854fa[_0x22ee24[_0x2927('0x27')]]={'$like':'%'+_0x79161c[_0x2927('0x2d')][_0x2927('0x39')]+'%'};return _0x4854fa;}})});}_0x43b23a=_['merge']({},_0x43b23a,_0x79161c[_0x2927('0x3b')]);var _0x3b2541={'where':_0x43b23a[_0x2927('0x36')]};return db[_0x2927('0x3c')][_0x2927('0x1f')](_0x3b2541)[_0x2927('0x24')](function(_0x41ee55){_0x3cc455[_0x2927('0x1f')]=_0x41ee55;if(_0x79161c[_0x2927('0x2d')]['includeAll']){_0x43b23a[_0x2927('0x3d')]=[{'all':!![]}];}return db[_0x2927('0x3c')][_0x2927('0x3e')](_0x43b23a);})[_0x2927('0x24')](function(_0x106469){_0x3cc455[_0x2927('0x3f')]=_0x106469;return _0x3cc455;})[_0x2927('0x24')](respondWithFilteredResult(_0x3929c5,_0x43b23a))['catch'](handleError(_0x3929c5,null));};exports[_0x2927('0x40')]=function(_0x252d54,_0x51f4aa){var _0x142b5b={'raw':![],'where':{'id':_0x252d54['params']['id']}},_0xf31bca={};_0xf31bca[_0x2927('0x2c')]=_[_0x2927('0x2e')](db[_0x2927('0x3c')][_0x2927('0x41')]);_0xf31bca[_0x2927('0x2d')]=_['keys'](_0x252d54[_0x2927('0x2d')]);_0xf31bca[_0x2927('0x37')]=_[_0x2927('0x2f')](_0xf31bca[_0x2927('0x2c')],_0xf31bca[_0x2927('0x2d')]);_0x142b5b[_0x2927('0x30')]=_[_0x2927('0x2f')](_0xf31bca['model'],qs['fields'](_0x252d54[_0x2927('0x2d')][_0x2927('0x31')]));_0x142b5b['attributes']=_0x142b5b[_0x2927('0x30')][_0x2927('0x32')]?_0x142b5b['attributes']:_0xf31bca[_0x2927('0x2c')];if(_0x252d54['query'][_0x2927('0x42')]){_0x142b5b[_0x2927('0x3d')]=[{'all':!![]}];}_0x142b5b=_[_0x2927('0x3a')]({},_0x142b5b,_0x252d54[_0x2927('0x3b')]);return db[_0x2927('0x3c')][_0x2927('0x43')](_0x142b5b)['then'](handleEntityNotFound(_0x51f4aa,null))[_0x2927('0x24')](respondWithResult(_0x51f4aa,null))['catch'](handleError(_0x51f4aa,null));};exports[_0x2927('0x44')]=function(_0x4eaff6,_0x47e49b){return db[_0x2927('0x3c')][_0x2927('0x44')](_0x4eaff6[_0x2927('0x45')],{})[_0x2927('0x24')](respondWithResult(_0x47e49b,0xc9))[_0x2927('0x46')](handleError(_0x47e49b,null));};exports['update']=function(_0x4025a0,_0x487f4a){if(_0x4025a0[_0x2927('0x45')]['id']){delete _0x4025a0[_0x2927('0x45')]['id'];}return db[_0x2927('0x3c')][_0x2927('0x43')]({'where':{'id':_0x4025a0['params']['id']}})['then'](handleEntityNotFound(_0x487f4a,null))['then'](saveUpdates(_0x4025a0[_0x2927('0x45')],null))[_0x2927('0x24')](respondWithResult(_0x487f4a,null))[_0x2927('0x46')](handleError(_0x487f4a,null));};exports[_0x2927('0x47')]=function(_0x3b6286,_0x2f949e){return db[_0x2927('0x3c')][_0x2927('0x43')]({'where':{'id':_0x3b6286[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x2f949e,null))[_0x2927('0x24')](removeEntity(_0x2f949e,null))[_0x2927('0x46')](handleError(_0x2f949e,null));};exports[_0x2927('0x49')]=function(_0x3badf9,_0x4e3663,_0x5eecf6){var _0x79b8dd={};var _0x5c187a={};var _0x59e2e7;var _0x1b9960;return db[_0x2927('0x3c')][_0x2927('0x4a')]({'where':{'id':_0x3badf9['params']['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x4e3663,null))[_0x2927('0x24')](function(_0x5d4c40){if(_0x5d4c40){_0x59e2e7=_0x5d4c40;_0x5c187a[_0x2927('0x2c')]=_['keys'](db[_0x2927('0x4b')]['rawAttributes']);_0x5c187a[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x3badf9[_0x2927('0x2d')]);_0x5c187a[_0x2927('0x37')]=_[_0x2927('0x2f')](_0x5c187a[_0x2927('0x2c')],_0x5c187a['query']);_0x79b8dd['attributes']=_[_0x2927('0x2f')](_0x5c187a[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x3badf9[_0x2927('0x2d')][_0x2927('0x31')]));_0x79b8dd[_0x2927('0x30')]=_0x79b8dd[_0x2927('0x30')]['length']?_0x79b8dd['attributes']:_0x5c187a[_0x2927('0x2c')];_0x79b8dd[_0x2927('0x34')]=qs[_0x2927('0x35')](_0x3badf9['query'][_0x2927('0x35')]);_0x79b8dd['where']=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x3badf9['query'],_0x5c187a[_0x2927('0x37')]));if(_0x3badf9['query']['filter']){_0x79b8dd['where']=_['merge'](_0x79b8dd[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x79b8dd[_0x2927('0x30')],function(_0x2cd399){var _0x39d939={};_0x39d939[_0x2cd399]={'$like':'%'+_0x3badf9[_0x2927('0x2d')][_0x2927('0x39')]+'%'};return _0x39d939;})});}_0x79b8dd=_[_0x2927('0x3a')]({},_0x79b8dd,_0x3badf9[_0x2927('0x3b')]);return _0x59e2e7['getFields'](_0x79b8dd);}})[_0x2927('0x24')](function(_0xab7b60){if(_0xab7b60){_0x1b9960=_0xab7b60[_0x2927('0x32')];if(!_0x3badf9['query'][_0x2927('0x4c')](_0x2927('0x33'))){_0x79b8dd[_0x2927('0x1e')]=qs['limit'](_0x3badf9['query'][_0x2927('0x1e')]);_0x79b8dd['offset']=qs['offset'](_0x3badf9[_0x2927('0x2d')][_0x2927('0x1c')]);}return _0x59e2e7[_0x2927('0x49')](_0x79b8dd);}})[_0x2927('0x24')](function(_0x36d368){if(_0x36d368){return _0x36d368?{'count':_0x1b9960,'rows':_0x36d368}:null;}})[_0x2927('0x24')](respondWithResult(_0x4e3663,null))[_0x2927('0x46')](handleError(_0x4e3663,null));};exports[_0x2927('0x4d')]=function(_0x1e0925,_0x2cbd84,_0x2b214e){var _0x3504db={};var _0x2e59f7={};var _0x40b394;var _0x22e182;return db['ZendeskConfiguration'][_0x2927('0x4a')]({'where':{'id':_0x1e0925[_0x2927('0x48')]['id']}})['then'](handleEntityNotFound(_0x2cbd84,null))['then'](function(_0x5dd783){if(_0x5dd783){_0x40b394=_0x5dd783;_0x2e59f7[_0x2927('0x2c')]=_[_0x2927('0x2e')](db[_0x2927('0x4b')][_0x2927('0x41')]);_0x2e59f7[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x1e0925['query']);_0x2e59f7[_0x2927('0x37')]=_[_0x2927('0x2f')](_0x2e59f7[_0x2927('0x2c')],_0x2e59f7[_0x2927('0x2d')]);_0x3504db['attributes']=_[_0x2927('0x2f')](_0x2e59f7[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x1e0925['query']['fields']));_0x3504db[_0x2927('0x30')]=_0x3504db[_0x2927('0x30')][_0x2927('0x32')]?_0x3504db[_0x2927('0x30')]:_0x2e59f7[_0x2927('0x2c')];_0x3504db[_0x2927('0x34')]=qs[_0x2927('0x35')](_0x1e0925['query'][_0x2927('0x35')]);_0x3504db[_0x2927('0x36')]=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x1e0925[_0x2927('0x2d')],_0x2e59f7[_0x2927('0x37')]));if(_0x1e0925[_0x2927('0x2d')][_0x2927('0x39')]){_0x3504db[_0x2927('0x36')]=_[_0x2927('0x3a')](_0x3504db[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x3504db[_0x2927('0x30')],function(_0x5f5d6c){var _0x17bad0={};_0x17bad0[_0x5f5d6c]={'$like':'%'+_0x1e0925[_0x2927('0x2d')]['filter']+'%'};return _0x17bad0;})});}_0x3504db=_['merge']({},_0x3504db,_0x1e0925[_0x2927('0x3b')]);return _0x40b394[_0x2927('0x4d')](_0x3504db);}})[_0x2927('0x24')](function(_0xafe105){if(_0xafe105){_0x22e182=_0xafe105['length'];if(!_0x1e0925[_0x2927('0x2d')]['hasOwnProperty'](_0x2927('0x33'))){_0x3504db[_0x2927('0x1e')]=qs[_0x2927('0x1e')](_0x1e0925[_0x2927('0x2d')][_0x2927('0x1e')]);_0x3504db['offset']=qs[_0x2927('0x1c')](_0x1e0925[_0x2927('0x2d')]['offset']);}return _0x40b394[_0x2927('0x4d')](_0x3504db);}})['then'](function(_0x4bacc1){if(_0x4bacc1){return _0x4bacc1?{'count':_0x22e182,'rows':_0x4bacc1}:null;}})[_0x2927('0x24')](respondWithResult(_0x2cbd84,null))[_0x2927('0x46')](handleError(_0x2cbd84,null));};exports[_0x2927('0x4e')]=function(_0x55561e,_0x31b075,_0x393e08){var _0x34e998={};var _0x25a881={};var _0x381f4a;var _0xf09bad;return db[_0x2927('0x3c')][_0x2927('0x4a')]({'where':{'id':_0x55561e[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x31b075,null))[_0x2927('0x24')](function(_0x5029cb){if(_0x5029cb){_0x381f4a=_0x5029cb;_0x25a881[_0x2927('0x2c')]=_[_0x2927('0x2e')](db[_0x2927('0x4b')][_0x2927('0x41')]);_0x25a881[_0x2927('0x2d')]=_['keys'](_0x55561e[_0x2927('0x2d')]);_0x25a881[_0x2927('0x37')]=_['intersection'](_0x25a881[_0x2927('0x2c')],_0x25a881[_0x2927('0x2d')]);_0x34e998[_0x2927('0x30')]=_[_0x2927('0x2f')](_0x25a881[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x55561e[_0x2927('0x2d')][_0x2927('0x31')]));_0x34e998[_0x2927('0x30')]=_0x34e998[_0x2927('0x30')][_0x2927('0x32')]?_0x34e998[_0x2927('0x30')]:_0x25a881['model'];_0x34e998[_0x2927('0x34')]=qs['sort'](_0x55561e[_0x2927('0x2d')]['sort']);_0x34e998['where']=qs[_0x2927('0x37')](_['pick'](_0x55561e['query'],_0x25a881[_0x2927('0x37')]));if(_0x55561e['query'][_0x2927('0x39')]){_0x34e998['where']=_[_0x2927('0x3a')](_0x34e998[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x34e998[_0x2927('0x30')],function(_0x3f324b){var _0x75b74e={};_0x75b74e[_0x3f324b]={'$like':'%'+_0x55561e[_0x2927('0x2d')][_0x2927('0x39')]+'%'};return _0x75b74e;})});}_0x34e998=_['merge']({},_0x34e998,_0x55561e[_0x2927('0x3b')]);return _0x381f4a[_0x2927('0x4e')](_0x34e998);}})[_0x2927('0x24')](function(_0x4a3d37){if(_0x4a3d37){_0xf09bad=_0x4a3d37[_0x2927('0x32')];if(!_0x55561e[_0x2927('0x2d')][_0x2927('0x4c')](_0x2927('0x33'))){_0x34e998[_0x2927('0x1e')]=qs[_0x2927('0x1e')](_0x55561e[_0x2927('0x2d')][_0x2927('0x1e')]);_0x34e998[_0x2927('0x1c')]=qs[_0x2927('0x1c')](_0x55561e[_0x2927('0x2d')]['offset']);}return _0x381f4a[_0x2927('0x4e')](_0x34e998);}})[_0x2927('0x24')](function(_0x3c7dd5){if(_0x3c7dd5){return _0x3c7dd5?{'count':_0xf09bad,'rows':_0x3c7dd5}:null;}})[_0x2927('0x24')](respondWithResult(_0x31b075,null))[_0x2927('0x46')](handleError(_0x31b075,null));};exports[_0x2927('0x4f')]=function(_0x2e86d6,_0x4531a4,_0x30f6ae){var _0x1dea70={};var _0x115292={};var _0x3f6917;var _0x56152c;return db[_0x2927('0x3c')]['findOne']({'where':{'id':_0x2e86d6[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x4531a4,null))['then'](function(_0x27e4c5){if(_0x27e4c5){_0x3f6917=_0x27e4c5;_0x115292['model']=_[_0x2927('0x2e')](db[_0x2927('0x50')][_0x2927('0x41')]);_0x115292[_0x2927('0x2d')]=_[_0x2927('0x2e')](_0x2e86d6[_0x2927('0x2d')]);_0x115292[_0x2927('0x37')]=_[_0x2927('0x2f')](_0x115292[_0x2927('0x2c')],_0x115292[_0x2927('0x2d')]);_0x1dea70[_0x2927('0x30')]=_[_0x2927('0x2f')](_0x115292[_0x2927('0x2c')],qs[_0x2927('0x31')](_0x2e86d6[_0x2927('0x2d')][_0x2927('0x31')]));_0x1dea70['attributes']=_0x1dea70['attributes'][_0x2927('0x32')]?_0x1dea70[_0x2927('0x30')]:_0x115292[_0x2927('0x2c')];_0x1dea70[_0x2927('0x34')]=qs['sort'](_0x2e86d6['query'][_0x2927('0x35')]);_0x1dea70['where']=qs[_0x2927('0x37')](_[_0x2927('0x38')](_0x2e86d6[_0x2927('0x2d')],_0x115292[_0x2927('0x37')]));if(_0x2e86d6[_0x2927('0x2d')]['filter']){_0x1dea70[_0x2927('0x36')]=_[_0x2927('0x3a')](_0x1dea70[_0x2927('0x36')],{'$or':_[_0x2927('0x2a')](_0x1dea70[_0x2927('0x30')],function(_0x576114){var _0x3057c8={};_0x3057c8[_0x576114]={'$like':'%'+_0x2e86d6['query']['filter']+'%'};return _0x3057c8;})});}_0x1dea70=_[_0x2927('0x3a')]({},_0x1dea70,_0x2e86d6['options']);return _0x3f6917[_0x2927('0x4f')](_0x1dea70);}})[_0x2927('0x24')](function(_0x2169bc){if(_0x2169bc){_0x56152c=_0x2169bc[_0x2927('0x32')];if(!_0x2e86d6[_0x2927('0x2d')][_0x2927('0x4c')](_0x2927('0x33'))){_0x1dea70[_0x2927('0x1e')]=qs[_0x2927('0x1e')](_0x2e86d6[_0x2927('0x2d')][_0x2927('0x1e')]);_0x1dea70[_0x2927('0x1c')]=qs['offset'](_0x2e86d6[_0x2927('0x2d')][_0x2927('0x1c')]);}return _0x3f6917[_0x2927('0x4f')](_0x1dea70);}})[_0x2927('0x24')](function(_0x323e38){if(_0x323e38){return _0x323e38?{'count':_0x56152c,'rows':_0x323e38}:null;}})[_0x2927('0x24')](respondWithResult(_0x4531a4,null))[_0x2927('0x46')](handleError(_0x4531a4,null));};exports[_0x2927('0x51')]=function(_0x4abcb6,_0x3f9a3a,_0x2f1158){if(_0x4abcb6[_0x2927('0x45')]['id']){delete _0x4abcb6[_0x2927('0x45')]['id'];}return db[_0x2927('0x3c')]['findOne']({'where':{'id':_0x4abcb6[_0x2927('0x48')]['id']}})[_0x2927('0x24')](handleEntityNotFound(_0x3f9a3a,null))[_0x2927('0x24')](function(_0x32027c){if(_0x32027c){return _0x32027c['setTags'](_0x4abcb6['body'][_0x2927('0x52')]||[]);}return null;})['then'](respondWithResult(_0x3f9a3a,null))[_0x2927('0x46')](handleError(_0x3f9a3a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index bca50c0..bea0f6e 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 _0xd8b0=['define','int_zendesk_configurations','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x353242,_0x287160){var _0x19c4b9=function(_0x2080c3){while(--_0x2080c3){_0x353242['push'](_0x353242['shift']());}};_0x19c4b9(++_0x287160);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ZendeskConfiguration',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./intZendeskConfiguration.attributes','ZendeskConfiguration'];(function(_0x4aacc7,_0x3e3ea7){var _0x2758ea=function(_0x5ad1b3){while(--_0x5ad1b3){_0x4aacc7['push'](_0x4aacc7['shift']());}};_0x2758ea(++_0x3e3ea7);}(_0xdb94,0xab));var _0x4db9=function(_0x17d96b,_0x346ba7){_0x17d96b=_0x17d96b-0x0;var _0x949d6f=_0xdb94[_0x17d96b];return _0x949d6f;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'int_zendesk_configurations','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 7e528de..36f7c8c 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 _0x0c94=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug'];(function(_0x5df3ab,_0x4a0a7e){var _0x42cce5=function(_0x430d0a){while(--_0x430d0a){_0x5df3ab['push'](_0x5df3ab['shift']());}};_0x42cce5(++_0x4a0a7e);}(_0x0c94,0x1d7));var _0x40c9=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x0c94[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x40c9('0x0'));var util=require(_0x40c9('0x1'));var moment=require(_0x40c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x40c9('0x3'));var fs=require('fs');var Redis=require(_0x40c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40c9('0x5'));var logger=require(_0x40c9('0x6'))('rpc');var config=require(_0x40c9('0x7'));var jayson=require(_0x40c9('0x8'));var client=jayson[_0x40c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5110,_0x5ec116,_0x3b574d){return new BPromise(function(_0x14c0f1,_0x5e7a9a){return client[_0x40c9('0xa')](_0x4b5110,_0x3b574d)['then'](function(_0x84941c){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5ec116,_0x40c9('0xb'));logger[_0x40c9('0xc')](_0x40c9('0xd'),_0x5ec116,_0x40c9('0xb'),JSON[_0x40c9('0xe')](_0x84941c));if(_0x84941c[_0x40c9('0xf')]){if(_0x84941c[_0x40c9('0xf')][_0x40c9('0x10')]===0x1f4){logger[_0x40c9('0xf')](_0x40c9('0x11'),_0x5ec116,_0x84941c[_0x40c9('0xf')][_0x40c9('0x12')]);return _0x5e7a9a(_0x84941c[_0x40c9('0xf')][_0x40c9('0x12')]);}logger['error'](_0x40c9('0x11'),_0x5ec116,_0x84941c[_0x40c9('0xf')][_0x40c9('0x12')]);return _0x14c0f1(_0x84941c[_0x40c9('0xf')][_0x40c9('0x12')]);}else{logger[_0x40c9('0x13')](_0x40c9('0x11'),_0x5ec116,_0x40c9('0xb'));_0x14c0f1(_0x84941c[_0x40c9('0x14')][_0x40c9('0x12')]);}})[_0x40c9('0x15')](function(_0x152fc3){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5ec116,_0x152fc3);_0x5e7a9a(_0x152fc3);});});} \ No newline at end of file +var _0x5e5d=['ZendeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36a204,_0x286bde){var _0x2a95a9=function(_0x4eea48){while(--_0x4eea48){_0x36a204['push'](_0x36a204['shift']());}};_0x2a95a9(++_0x286bde);}(_0x5e5d,0x1bb));var _0xd5e5=function(_0x16756f,_0xee4f17){_0x16756f=_0x16756f-0x0;var _0x4942ec=_0x5e5d[_0x16756f];return _0x4942ec;};'use strict';var _=require(_0xd5e5('0x0'));var util=require(_0xd5e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd5e5('0x2'));var fs=require('fs');var Redis=require(_0xd5e5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd5e5('0x4'))(_0xd5e5('0x5'));var config=require(_0xd5e5('0x6'));var jayson=require(_0xd5e5('0x7'));var client=jayson[_0xd5e5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36c57b,_0x238f4a,_0x3745f8){return new BPromise(function(_0x4f9ab8,_0xf8b1f1){return client[_0xd5e5('0x9')](_0x36c57b,_0x3745f8)[_0xd5e5('0xa')](function(_0x3d245a){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x238f4a,_0xd5e5('0xb'));logger[_0xd5e5('0xc')](_0xd5e5('0xd'),_0x238f4a,'request\x20sent',JSON[_0xd5e5('0xe')](_0x3d245a));if(_0x3d245a['error']){if(_0x3d245a[_0xd5e5('0xf')][_0xd5e5('0x10')]===0x1f4){logger[_0xd5e5('0xf')](_0xd5e5('0x11'),_0x238f4a,_0x3d245a[_0xd5e5('0xf')]['message']);return _0xf8b1f1(_0x3d245a[_0xd5e5('0xf')]['message']);}logger['error'](_0xd5e5('0x11'),_0x238f4a,_0x3d245a['error']['message']);return _0x4f9ab8(_0x3d245a[_0xd5e5('0xf')]['message']);}else{logger['info'](_0xd5e5('0x11'),_0x238f4a,_0xd5e5('0xb'));_0x4f9ab8(_0x3d245a['result'][_0xd5e5('0x12')]);}})[_0xd5e5('0x13')](function(_0x153997){logger[_0xd5e5('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x238f4a,_0x153997);_0xf8b1f1(_0x153997);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 88c2495..ffeaf00 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 _0x85cf=['fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x85cf,0x1e8));var _0xf85c=function(_0x1cf0b2,_0x28a5a7){_0x1cf0b2=_0x1cf0b2-0x0;var _0x55d20e=_0x85cf[_0x1cf0b2];return _0x55d20e;};'use strict';var multer=require(_0xf85c('0x0'));var util=require(_0xf85c('0x1'));var path=require(_0xf85c('0x2'));var timeout=require(_0xf85c('0x3'));var express=require(_0xf85c('0x4'));var router=express[_0xf85c('0x5')]();var fs_extra=require(_0xf85c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf85c('0x7'));var config=require('../../config/environment');var controller=require(_0xf85c('0x8'));router[_0xf85c('0x9')]('/',auth[_0xf85c('0xa')](),controller[_0xf85c('0xb')]);router['get'](_0xf85c('0xc'),auth[_0xf85c('0xa')](),controller['show']);router[_0xf85c('0xd')]('/',auth['isAuthenticated'](),controller[_0xf85c('0xe')]);router[_0xf85c('0xf')]('/:id',auth[_0xf85c('0xa')](),controller[_0xf85c('0x10')]);router[_0xf85c('0x11')]('/:id',auth[_0xf85c('0xa')](),controller[_0xf85c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2250=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x28237e,_0x2a7f11){var _0x1c014b=function(_0xaa0d6d){while(--_0xaa0d6d){_0x28237e['push'](_0x28237e['shift']());}};_0x1c014b(++_0x2a7f11);}(_0x2250,0xec));var _0x0225=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x2250[_0x44ae0b];return _0x69232a;};'use strict';var multer=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var path=require(_0x0225('0x2'));var timeout=require(_0x0225('0x3'));var express=require(_0x0225('0x4'));var router=express[_0x0225('0x5')]();var fs_extra=require(_0x0225('0x6'));var auth=require(_0x0225('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0225('0x8'));var controller=require(_0x0225('0x9'));router[_0x0225('0xa')]('/',auth[_0x0225('0xb')](),controller[_0x0225('0xc')]);router['get'](_0x0225('0xd'),auth[_0x0225('0xb')](),controller[_0x0225('0xe')]);router[_0x0225('0xf')]('/',auth['isAuthenticated'](),controller[_0x0225('0x10')]);router[_0x0225('0x11')]('/:id',auth[_0x0225('0xb')](),controller[_0x0225('0x12')]);router['delete'](_0x0225('0xd'),auth[_0x0225('0xb')](),controller[_0x0225('0x13')]);module[_0x0225('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1f57ede..7bb7735 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 _0x173b=['customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM','string'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x173b,0x113));var _0xb173=function(_0x279de4,_0x5d552d){_0x279de4=_0x279de4-0x0;var _0x104a16=_0x173b[_0x279de4];return _0x104a16;};'use strict';var Sequelize=require(_0xb173('0x0'));module[_0xb173('0x1')]={'type':{'type':Sequelize[_0xb173('0x2')](_0xb173('0x3'),'variable',_0xb173('0x4'),_0xb173('0x5'),_0xb173('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb173('0x7')]},'keyType':{'type':Sequelize[_0xb173('0x2')](_0xb173('0x3'),_0xb173('0x8'),_0xb173('0x4'))},'keyContent':{'type':Sequelize[_0xb173('0x7')]},'idField':{'type':Sequelize[_0xb173('0x7')]},'nameField':{'type':Sequelize[_0xb173('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb173('0x7')]}}; \ No newline at end of file +var _0x3a84=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x5d365d,_0x479ca2){var _0x220ba4=function(_0x36e328){while(--_0x36e328){_0x5d365d['push'](_0x5d365d['shift']());}};_0x220ba4(++_0x479ca2);}(_0x3a84,0x12f));var _0x43a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a84[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x43a8('0x0'));module[_0x43a8('0x1')]={'type':{'type':Sequelize[_0x43a8('0x2')]('string',_0x43a8('0x3'),'customVariable',_0x43a8('0x4'),_0x43a8('0x5')),'defaultValue':_0x43a8('0x6')},'content':{'type':Sequelize[_0x43a8('0x7')]},'key':{'type':Sequelize[_0x43a8('0x7')]},'keyType':{'type':Sequelize[_0x43a8('0x2')](_0x43a8('0x6'),_0x43a8('0x3'),_0x43a8('0x8'))},'keyContent':{'type':Sequelize[_0x43a8('0x7')]},'idField':{'type':Sequelize[_0x43a8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x43a8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43a8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 3df122c..8f66ca8 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 _0xa9dc=['offset','status','set','apply','save','update','then','destroy','error','name','send','map','ZendeskField','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','rawAttributes','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0xa9dc,0x71));var _0xca9d=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0xa9dc[_0x158da6];return _0x429c30;};'use strict';var emlformat=require(_0xca9d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca9d('0x1'));var jsonpatch=require(_0xca9d('0x2'));var rp=require(_0xca9d('0x3'));var moment=require(_0xca9d('0x4'));var BPromise=require(_0xca9d('0x5'));var Mustache=require(_0xca9d('0x6'));var util=require(_0xca9d('0x7'));var path=require(_0xca9d('0x8'));var sox=require(_0xca9d('0x9'));var csv=require(_0xca9d('0xa'));var ejs=require(_0xca9d('0xb'));var fs=require('fs');var fs_extra=require(_0xca9d('0xc'));var _=require(_0xca9d('0xd'));var squel=require(_0xca9d('0xe'));var crypto=require(_0xca9d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xca9d('0x10'));var toCsv=require(_0xca9d('0xa'));var querystring=require(_0xca9d('0x11'));var Papa=require(_0xca9d('0x12'));var Redis=require(_0xca9d('0x13'));var authService=require(_0xca9d('0x14'));var qs=require(_0xca9d('0x15'));var as=require(_0xca9d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca9d('0x17'))(_0xca9d('0x18'));var utils=require('../../config/utils');var config=require(_0xca9d('0x19'));var licenseUtil=require(_0xca9d('0x1a'));var db=require(_0xca9d('0x1b'))['db'];function respondWithStatusCode(_0x1c08f8,_0xe004b3){_0xe004b3=_0xe004b3||0xcc;return function(_0x375e2e){if(_0x375e2e){return _0x1c08f8[_0xca9d('0x1c')](_0xe004b3);}return _0x1c08f8['status'](_0xe004b3)[_0xca9d('0x1d')]();};}function respondWithResult(_0x3c2a3,_0x55e8f1){_0x55e8f1=_0x55e8f1||0xc8;return function(_0x165a14){if(_0x165a14){return _0x3c2a3['status'](_0x55e8f1)[_0xca9d('0x1e')](_0x165a14);}};}function respondWithFilteredResult(_0x4dd55c,_0x27fe11){return function(_0x4d63dc){if(_0x4d63dc){var _0x145964=typeof _0x27fe11['offset']==='undefined'&&typeof _0x27fe11[_0xca9d('0x1f')]==='undefined';var _0x3ec247=_0x4d63dc[_0xca9d('0x20')];var _0x4ee5cf=_0x145964?0x0:_0x27fe11[_0xca9d('0x21')];var _0x6ad3f0=_0x145964?_0x4d63dc['count']:_0x27fe11[_0xca9d('0x21')]+_0x27fe11[_0xca9d('0x1f')];var _0x3b0035;if(_0x6ad3f0>=_0x3ec247){_0x6ad3f0=_0x3ec247;_0x3b0035=0xc8;}else{_0x3b0035=0xce;}_0x4dd55c[_0xca9d('0x22')](_0x3b0035);return _0x4dd55c[_0xca9d('0x23')]('Content-Range',_0x4ee5cf+'-'+_0x6ad3f0+'/'+_0x3ec247)[_0xca9d('0x1e')](_0x4d63dc);}return null;};}function patchUpdates(_0x133b5d){return function(_0x278e53){try{jsonpatch[_0xca9d('0x24')](_0x278e53,_0x133b5d,!![]);}catch(_0x51a65f){return BPromise['reject'](_0x51a65f);}return _0x278e53[_0xca9d('0x25')]();};}function saveUpdates(_0x4a523e,_0xa36be2){return function(_0x35ff7d){if(_0x35ff7d){return _0x35ff7d[_0xca9d('0x26')](_0x4a523e)[_0xca9d('0x27')](function(_0x4a16cb){return _0x4a16cb;});}return null;};}function removeEntity(_0x400392,_0x15b9ff){return function(_0x59d821){if(_0x59d821){return _0x59d821[_0xca9d('0x28')]()[_0xca9d('0x27')](function(){_0x400392[_0xca9d('0x22')](0xcc)[_0xca9d('0x1d')]();});}};}function handleEntityNotFound(_0x59a06b,_0x3de20d){return function(_0x47d36f){if(!_0x47d36f){_0x59a06b['sendStatus'](0x194);}return _0x47d36f;};}function handleError(_0x7f7431,_0x55da9a){_0x55da9a=_0x55da9a||0x1f4;return function(_0x446e0d){logger[_0xca9d('0x29')](_0x446e0d['stack']);if(_0x446e0d[_0xca9d('0x2a')]){delete _0x446e0d[_0xca9d('0x2a')];}_0x7f7431[_0xca9d('0x22')](_0x55da9a)[_0xca9d('0x2b')](_0x446e0d);};}exports['index']=function(_0x5861e6,_0xb86e09){var _0x860885={},_0x41c304={},_0x1cdd73={'count':0x0,'rows':[]};var _0x3484b5=_[_0xca9d('0x2c')](db[_0xca9d('0x2d')]['rawAttributes'],function(_0x57aad0){return{'name':_0x57aad0['fieldName'],'type':_0x57aad0[_0xca9d('0x2e')][_0xca9d('0x2f')]};});_0x41c304['model']=_[_0xca9d('0x2c')](_0x3484b5,_0xca9d('0x2a'));_0x41c304[_0xca9d('0x30')]=_[_0xca9d('0x31')](_0x5861e6[_0xca9d('0x30')]);_0x41c304['filters']=_[_0xca9d('0x32')](_0x41c304[_0xca9d('0x33')],_0x41c304[_0xca9d('0x30')]);_0x860885[_0xca9d('0x34')]=_[_0xca9d('0x32')](_0x41c304[_0xca9d('0x33')],qs[_0xca9d('0x35')](_0x5861e6[_0xca9d('0x30')][_0xca9d('0x35')]));_0x860885['attributes']=_0x860885['attributes']['length']?_0x860885[_0xca9d('0x34')]:_0x41c304[_0xca9d('0x33')];if(!_0x5861e6[_0xca9d('0x30')][_0xca9d('0x36')](_0xca9d('0x37'))){_0x860885[_0xca9d('0x1f')]=qs[_0xca9d('0x1f')](_0x5861e6[_0xca9d('0x30')][_0xca9d('0x1f')]);_0x860885[_0xca9d('0x21')]=qs['offset'](_0x5861e6[_0xca9d('0x30')][_0xca9d('0x21')]);}_0x860885[_0xca9d('0x38')]=qs[_0xca9d('0x39')](_0x5861e6[_0xca9d('0x30')][_0xca9d('0x39')]);_0x860885['where']=qs[_0xca9d('0x3a')](_[_0xca9d('0x3b')](_0x5861e6['query'],_0x41c304[_0xca9d('0x3a')]),_0x3484b5);if(_0x5861e6[_0xca9d('0x30')][_0xca9d('0x3c')]){_0x860885['where']=_['merge'](_0x860885['where'],{'$or':_[_0xca9d('0x2c')](_0x3484b5,function(_0x4acb07){if(_0x4acb07[_0xca9d('0x2e')]!==_0xca9d('0x3d')){var _0x225a49={};_0x225a49[_0x4acb07['name']]={'$like':'%'+_0x5861e6['query'][_0xca9d('0x3c')]+'%'};return _0x225a49;}})});}_0x860885=_[_0xca9d('0x3e')]({},_0x860885,_0x5861e6['options']);var _0x198e35={'where':_0x860885['where']};return db['ZendeskField'][_0xca9d('0x20')](_0x198e35)['then'](function(_0x3d5e44){_0x1cdd73[_0xca9d('0x20')]=_0x3d5e44;if(_0x5861e6['query']['includeAll']){_0x860885[_0xca9d('0x3f')]=[{'all':!![]}];}return db[_0xca9d('0x2d')][_0xca9d('0x40')](_0x860885);})['then'](function(_0x4b4f57){_0x1cdd73['rows']=_0x4b4f57;return _0x1cdd73;})['then'](respondWithFilteredResult(_0xb86e09,_0x860885))[_0xca9d('0x41')](handleError(_0xb86e09,null));};exports[_0xca9d('0x42')]=function(_0x3e771c,_0x2a8271){var _0x4aec46={'raw':!![],'where':{'id':_0x3e771c[_0xca9d('0x43')]['id']}},_0xbf74e1={};_0xbf74e1[_0xca9d('0x33')]=_[_0xca9d('0x31')](db[_0xca9d('0x2d')][_0xca9d('0x44')]);_0xbf74e1[_0xca9d('0x30')]=_[_0xca9d('0x31')](_0x3e771c[_0xca9d('0x30')]);_0xbf74e1[_0xca9d('0x3a')]=_[_0xca9d('0x32')](_0xbf74e1[_0xca9d('0x33')],_0xbf74e1[_0xca9d('0x30')]);_0x4aec46['attributes']=_[_0xca9d('0x32')](_0xbf74e1[_0xca9d('0x33')],qs['fields'](_0x3e771c['query'][_0xca9d('0x35')]));_0x4aec46[_0xca9d('0x34')]=_0x4aec46['attributes']['length']?_0x4aec46[_0xca9d('0x34')]:_0xbf74e1[_0xca9d('0x33')];if(_0x3e771c[_0xca9d('0x30')][_0xca9d('0x45')]){_0x4aec46['include']=[{'all':!![]}];}_0x4aec46=_[_0xca9d('0x3e')]({},_0x4aec46,_0x3e771c['options']);return db['ZendeskField']['find'](_0x4aec46)[_0xca9d('0x27')](handleEntityNotFound(_0x2a8271,null))[_0xca9d('0x27')](respondWithResult(_0x2a8271,null))['catch'](handleError(_0x2a8271,null));};exports['create']=function(_0x5050e3,_0x1d2225){return db['ZendeskField'][_0xca9d('0x46')](_0x5050e3[_0xca9d('0x47')],{})[_0xca9d('0x27')](respondWithResult(_0x1d2225,0xc9))[_0xca9d('0x41')](handleError(_0x1d2225,null));};exports[_0xca9d('0x26')]=function(_0x5f4d86,_0x240218){if(_0x5f4d86['body']['id']){delete _0x5f4d86[_0xca9d('0x47')]['id'];}return db[_0xca9d('0x2d')][_0xca9d('0x48')]({'where':{'id':_0x5f4d86[_0xca9d('0x43')]['id']}})[_0xca9d('0x27')](handleEntityNotFound(_0x240218,null))[_0xca9d('0x27')](saveUpdates(_0x5f4d86[_0xca9d('0x47')],null))[_0xca9d('0x27')](respondWithResult(_0x240218,null))[_0xca9d('0x41')](handleError(_0x240218,null));};exports[_0xca9d('0x28')]=function(_0x4b21bf,_0x3e19b9){return db[_0xca9d('0x2d')][_0xca9d('0x48')]({'where':{'id':_0x4b21bf['params']['id']}})[_0xca9d('0x27')](handleEntityNotFound(_0x3e19b9,null))[_0xca9d('0x27')](removeEntity(_0x3e19b9,null))[_0xca9d('0x41')](handleError(_0x3e19b9,null));}; \ No newline at end of file +var _0x9ef1=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','name','send','ZendeskField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','then','includeAll','include','findAll','rows','show','params','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce'];(function(_0x40e3f7,_0x361929){var _0x457173=function(_0x5d8158){while(--_0x5d8158){_0x40e3f7['push'](_0x40e3f7['shift']());}};_0x457173(++_0x361929);}(_0x9ef1,0x1b4));var _0x19ef=function(_0x4c9858,_0x1c1118){_0x4c9858=_0x4c9858-0x0;var _0x3dbcb3=_0x9ef1[_0x4c9858];return _0x3dbcb3;};'use strict';var emlformat=require(_0x19ef('0x0'));var rimraf=require(_0x19ef('0x1'));var zipdir=require(_0x19ef('0x2'));var jsonpatch=require(_0x19ef('0x3'));var rp=require(_0x19ef('0x4'));var moment=require(_0x19ef('0x5'));var BPromise=require(_0x19ef('0x6'));var Mustache=require(_0x19ef('0x7'));var util=require(_0x19ef('0x8'));var path=require(_0x19ef('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x19ef('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19ef('0xb'));var crypto=require(_0x19ef('0xc'));var jsforce=require(_0x19ef('0xd'));var deskjs=require(_0x19ef('0xe'));var toCsv=require(_0x19ef('0xf'));var querystring=require(_0x19ef('0x10'));var Papa=require(_0x19ef('0x11'));var Redis=require(_0x19ef('0x12'));var authService=require(_0x19ef('0x13'));var qs=require(_0x19ef('0x14'));var as=require(_0x19ef('0x15'));var hardwareService=require(_0x19ef('0x16'));var logger=require(_0x19ef('0x17'))(_0x19ef('0x18'));var utils=require(_0x19ef('0x19'));var config=require(_0x19ef('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x19ef('0x1b'))['db'];function respondWithStatusCode(_0x2a3187,_0x2eb849){_0x2eb849=_0x2eb849||0xcc;return function(_0x4c5cab){if(_0x4c5cab){return _0x2a3187[_0x19ef('0x1c')](_0x2eb849);}return _0x2a3187[_0x19ef('0x1d')](_0x2eb849)[_0x19ef('0x1e')]();};}function respondWithResult(_0x5dfbe9,_0x36804e){_0x36804e=_0x36804e||0xc8;return function(_0x4b9aba){if(_0x4b9aba){return _0x5dfbe9['status'](_0x36804e)[_0x19ef('0x1f')](_0x4b9aba);}};}function respondWithFilteredResult(_0x5b7a48,_0x171638){return function(_0x2bc7c1){if(_0x2bc7c1){var _0x5df50d=typeof _0x171638[_0x19ef('0x20')]===_0x19ef('0x21')&&typeof _0x171638[_0x19ef('0x22')]===_0x19ef('0x21');var _0x3c93e0=_0x2bc7c1[_0x19ef('0x23')];var _0x29ea78=_0x5df50d?0x0:_0x171638['offset'];var _0x184691=_0x5df50d?_0x2bc7c1[_0x19ef('0x23')]:_0x171638[_0x19ef('0x20')]+_0x171638[_0x19ef('0x22')];var _0x321152;if(_0x184691>=_0x3c93e0){_0x184691=_0x3c93e0;_0x321152=0xc8;}else{_0x321152=0xce;}_0x5b7a48[_0x19ef('0x1d')](_0x321152);return _0x5b7a48[_0x19ef('0x24')]('Content-Range',_0x29ea78+'-'+_0x184691+'/'+_0x3c93e0)[_0x19ef('0x1f')](_0x2bc7c1);}return null;};}function patchUpdates(_0x51317d){return function(_0x87a2d9){try{jsonpatch[_0x19ef('0x25')](_0x87a2d9,_0x51317d,!![]);}catch(_0x4129e2){return BPromise[_0x19ef('0x26')](_0x4129e2);}return _0x87a2d9[_0x19ef('0x27')]();};}function saveUpdates(_0x4bbc8d,_0x4e6d5a){return function(_0xf76242){if(_0xf76242){return _0xf76242[_0x19ef('0x28')](_0x4bbc8d)['then'](function(_0x35cbc2){return _0x35cbc2;});}return null;};}function removeEntity(_0x159e6d,_0x31a915){return function(_0x26abbf){if(_0x26abbf){return _0x26abbf[_0x19ef('0x29')]()['then'](function(){_0x159e6d[_0x19ef('0x1d')](0xcc)[_0x19ef('0x1e')]();});}};}function handleEntityNotFound(_0x558c31,_0x215991){return function(_0x2899e3){if(!_0x2899e3){_0x558c31[_0x19ef('0x1c')](0x194);}return _0x2899e3;};}function handleError(_0x2fe0fd,_0x4eca1b){_0x4eca1b=_0x4eca1b||0x1f4;return function(_0x262085){logger['error'](_0x262085['stack']);if(_0x262085[_0x19ef('0x2a')]){delete _0x262085[_0x19ef('0x2a')];}_0x2fe0fd['status'](_0x4eca1b)[_0x19ef('0x2b')](_0x262085);};}exports['index']=function(_0x3d8e81,_0x3c26b1){var _0x4b5fd2={},_0x17ffe5={},_0x510750={'count':0x0,'rows':[]};var _0x9719e0=_['map'](db[_0x19ef('0x2c')][_0x19ef('0x2d')],function(_0x52efdb){return{'name':_0x52efdb['fieldName'],'type':_0x52efdb[_0x19ef('0x2e')][_0x19ef('0x2f')]};});_0x17ffe5[_0x19ef('0x30')]=_[_0x19ef('0x31')](_0x9719e0,_0x19ef('0x2a'));_0x17ffe5[_0x19ef('0x32')]=_[_0x19ef('0x33')](_0x3d8e81[_0x19ef('0x32')]);_0x17ffe5[_0x19ef('0x34')]=_[_0x19ef('0x35')](_0x17ffe5['model'],_0x17ffe5[_0x19ef('0x32')]);_0x4b5fd2[_0x19ef('0x36')]=_[_0x19ef('0x35')](_0x17ffe5['model'],qs[_0x19ef('0x37')](_0x3d8e81['query'][_0x19ef('0x37')]));_0x4b5fd2[_0x19ef('0x36')]=_0x4b5fd2[_0x19ef('0x36')][_0x19ef('0x38')]?_0x4b5fd2[_0x19ef('0x36')]:_0x17ffe5[_0x19ef('0x30')];if(!_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x39')](_0x19ef('0x3a'))){_0x4b5fd2['limit']=qs[_0x19ef('0x22')](_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x22')]);_0x4b5fd2[_0x19ef('0x20')]=qs[_0x19ef('0x20')](_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x20')]);}_0x4b5fd2[_0x19ef('0x3b')]=qs[_0x19ef('0x3c')](_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x3c')]);_0x4b5fd2['where']=qs[_0x19ef('0x34')](_['pick'](_0x3d8e81[_0x19ef('0x32')],_0x17ffe5[_0x19ef('0x34')]),_0x9719e0);if(_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x3d')]){_0x4b5fd2[_0x19ef('0x3e')]=_[_0x19ef('0x3f')](_0x4b5fd2['where'],{'$or':_[_0x19ef('0x31')](_0x9719e0,function(_0x147bee){if(_0x147bee['type']!=='VIRTUAL'){var _0x13b98a={};_0x13b98a[_0x147bee['name']]={'$like':'%'+_0x3d8e81['query'][_0x19ef('0x3d')]+'%'};return _0x13b98a;}})});}_0x4b5fd2=_['merge']({},_0x4b5fd2,_0x3d8e81['options']);var _0x321e98={'where':_0x4b5fd2[_0x19ef('0x3e')]};return db['ZendeskField'][_0x19ef('0x23')](_0x321e98)[_0x19ef('0x40')](function(_0x4c0a10){_0x510750[_0x19ef('0x23')]=_0x4c0a10;if(_0x3d8e81[_0x19ef('0x32')][_0x19ef('0x41')]){_0x4b5fd2[_0x19ef('0x42')]=[{'all':!![]}];}return db[_0x19ef('0x2c')][_0x19ef('0x43')](_0x4b5fd2);})[_0x19ef('0x40')](function(_0x410e73){_0x510750[_0x19ef('0x44')]=_0x410e73;return _0x510750;})[_0x19ef('0x40')](respondWithFilteredResult(_0x3c26b1,_0x4b5fd2))['catch'](handleError(_0x3c26b1,null));};exports[_0x19ef('0x45')]=function(_0xca1105,_0x7b44e1){var _0x157a91={'raw':!![],'where':{'id':_0xca1105[_0x19ef('0x46')]['id']}},_0x12463d={};_0x12463d[_0x19ef('0x30')]=_[_0x19ef('0x33')](db[_0x19ef('0x2c')]['rawAttributes']);_0x12463d[_0x19ef('0x32')]=_['keys'](_0xca1105[_0x19ef('0x32')]);_0x12463d['filters']=_['intersection'](_0x12463d[_0x19ef('0x30')],_0x12463d[_0x19ef('0x32')]);_0x157a91[_0x19ef('0x36')]=_['intersection'](_0x12463d[_0x19ef('0x30')],qs['fields'](_0xca1105[_0x19ef('0x32')]['fields']));_0x157a91[_0x19ef('0x36')]=_0x157a91[_0x19ef('0x36')][_0x19ef('0x38')]?_0x157a91[_0x19ef('0x36')]:_0x12463d[_0x19ef('0x30')];if(_0xca1105[_0x19ef('0x32')]['includeAll']){_0x157a91[_0x19ef('0x42')]=[{'all':!![]}];}_0x157a91=_[_0x19ef('0x3f')]({},_0x157a91,_0xca1105[_0x19ef('0x47')]);return db[_0x19ef('0x2c')][_0x19ef('0x48')](_0x157a91)[_0x19ef('0x40')](handleEntityNotFound(_0x7b44e1,null))['then'](respondWithResult(_0x7b44e1,null))[_0x19ef('0x49')](handleError(_0x7b44e1,null));};exports['create']=function(_0x8879d5,_0x3c591e){return db[_0x19ef('0x2c')]['create'](_0x8879d5[_0x19ef('0x4a')],{})[_0x19ef('0x40')](respondWithResult(_0x3c591e,0xc9))[_0x19ef('0x49')](handleError(_0x3c591e,null));};exports['update']=function(_0x365e9d,_0x491377){if(_0x365e9d[_0x19ef('0x4a')]['id']){delete _0x365e9d[_0x19ef('0x4a')]['id'];}return db[_0x19ef('0x2c')]['find']({'where':{'id':_0x365e9d[_0x19ef('0x46')]['id']}})['then'](handleEntityNotFound(_0x491377,null))[_0x19ef('0x40')](saveUpdates(_0x365e9d['body'],null))[_0x19ef('0x40')](respondWithResult(_0x491377,null))[_0x19ef('0x49')](handleError(_0x491377,null));};exports['destroy']=function(_0x4ae674,_0x2da5ff){return db[_0x19ef('0x2c')][_0x19ef('0x48')]({'where':{'id':_0x4ae674[_0x19ef('0x46')]['id']}})[_0x19ef('0x40')](handleEntityNotFound(_0x2da5ff,null))['then'](removeEntity(_0x2da5ff,null))[_0x19ef('0x49')](handleError(_0x2da5ff,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7dd6e90..76ed5e8 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 _0xb367=['define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x898dc4,_0x522440){var _0x5775e1=function(_0xd095b4){while(--_0xd095b4){_0x898dc4['push'](_0x898dc4['shift']());}};_0x5775e1(++_0x522440);}(_0xb367,0x1d9));var _0x7b36=function(_0x3eae20,_0x3078d9){_0x3eae20=_0x3eae20-0x0;var _0x58921b=_0xb367[_0x3eae20];return _0x58921b;};'use strict';var _=require(_0x7b36('0x0'));var util=require(_0x7b36('0x1'));var logger=require('../../config/logger')(_0x7b36('0x2'));var moment=require(_0x7b36('0x3'));var BPromise=require(_0x7b36('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7b36('0x5'));var config=require(_0x7b36('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x5c3a2c,_0x10d20b){return _0x5c3a2c[_0x7b36('0x7')](_0x7b36('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x7b36('0x9'),'fields':[_0x7b36('0xa'),_0x7b36('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb259=['FieldId','lodash','api','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0x4410e8,_0x45a516){var _0x5b7b19=function(_0x228d54){while(--_0x228d54){_0x4410e8['push'](_0x4410e8['shift']());}};_0x5b7b19(++_0x45a516);}(_0xb259,0xc1));var _0x9b25=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0xb259[_0x47041d];return _0x5022bd;};'use strict';var _=require(_0x9b25('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9b25('0x1'));var moment=require('moment');var BPromise=require(_0x9b25('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b25('0x3'));var rimraf=require(_0x9b25('0x4'));var config=require(_0x9b25('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x9b25('0x6')]=function(_0xe419d,_0x382add){return _0xe419d[_0x9b25('0x7')](_0x9b25('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x9b25('0x9'),'fields':[_0x9b25('0xa'),_0x9b25('0xb')],'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 ce45f75..e58be2b 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 _0x3f31=['client','http','request','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ZendeskField,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4ac4dd,_0x32f8e3){var _0x2212ff=function(_0x585943){while(--_0x585943){_0x4ac4dd['push'](_0x4ac4dd['shift']());}};_0x2212ff(++_0x32f8e3);}(_0x3f31,0xe7));var _0x13f3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3f31[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x13f3('0x0'));var BPromise=require('bluebird');var rs=require(_0x13f3('0x1'));var fs=require('fs');var Redis=require(_0x13f3('0x2'));var db=require(_0x13f3('0x3'))['db'];var utils=require(_0x13f3('0x4'));var logger=require(_0x13f3('0x5'))(_0x13f3('0x6'));var config=require(_0x13f3('0x7'));var jayson=require(_0x13f3('0x8'));var client=jayson[_0x13f3('0x9')][_0x13f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d6546,_0x57fd9a,_0x23c912){return new BPromise(function(_0x14d3cc,_0x2ebf80){return client[_0x13f3('0xb')](_0x4d6546,_0x23c912)[_0x13f3('0xc')](function(_0x319884){logger[_0x13f3('0xd')]('ZendeskField,\x20%s,\x20%s',_0x57fd9a,'request\x20sent');logger[_0x13f3('0xe')](_0x13f3('0xf'),_0x57fd9a,_0x13f3('0x10'),JSON[_0x13f3('0x11')](_0x319884));if(_0x319884['error']){if(_0x319884['error'][_0x13f3('0x12')]===0x1f4){logger[_0x13f3('0x13')](_0x13f3('0x14'),_0x57fd9a,_0x319884[_0x13f3('0x13')][_0x13f3('0x15')]);return _0x2ebf80(_0x319884[_0x13f3('0x13')][_0x13f3('0x15')]);}logger['error'](_0x13f3('0x14'),_0x57fd9a,_0x319884[_0x13f3('0x13')][_0x13f3('0x15')]);return _0x14d3cc(_0x319884[_0x13f3('0x13')][_0x13f3('0x15')]);}else{logger[_0x13f3('0xd')](_0x13f3('0x14'),_0x57fd9a,_0x13f3('0x10'));_0x14d3cc(_0x319884[_0x13f3('0x16')][_0x13f3('0x15')]);}})[_0x13f3('0x17')](function(_0x18ba65){logger[_0x13f3('0x13')](_0x13f3('0x14'),_0x57fd9a,_0x18ba65);_0x2ebf80(_0x18ba65);});});} \ No newline at end of file +var _0xf06f=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf06f,0x67));var _0xff06=function(_0x37244c,_0x372877){_0x37244c=_0x37244c-0x0;var _0x445fff=_0xf06f[_0x37244c];return _0x445fff;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff06('0x4'));var db=require(_0xff06('0x5'))['db'];var utils=require(_0xff06('0x6'));var logger=require('../../config/logger')(_0xff06('0x7'));var config=require(_0xff06('0x8'));var jayson=require(_0xff06('0x9'));var client=jayson[_0xff06('0xa')][_0xff06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3958a4,_0x533261,_0x54cbaa){return new BPromise(function(_0x17f212,_0x455674){return client[_0xff06('0xc')](_0x3958a4,_0x54cbaa)['then'](function(_0x34f1c3){logger[_0xff06('0xd')]('ZendeskField,\x20%s,\x20%s',_0x533261,_0xff06('0xe'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x533261,_0xff06('0xe'),JSON[_0xff06('0xf')](_0x34f1c3));if(_0x34f1c3[_0xff06('0x10')]){if(_0x34f1c3[_0xff06('0x10')][_0xff06('0x11')]===0x1f4){logger[_0xff06('0x10')](_0xff06('0x12'),_0x533261,_0x34f1c3['error'][_0xff06('0x13')]);return _0x455674(_0x34f1c3[_0xff06('0x10')][_0xff06('0x13')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x533261,_0x34f1c3['error'][_0xff06('0x13')]);return _0x17f212(_0x34f1c3[_0xff06('0x10')][_0xff06('0x13')]);}else{logger['info'](_0xff06('0x12'),_0x533261,_0xff06('0xe'));_0x17f212(_0x34f1c3[_0xff06('0x14')][_0xff06('0x13')]);}})[_0xff06('0x15')](function(_0x229130){logger['error']('ZendeskField,\x20%s,\x20%s',_0x533261,_0x229130);_0x455674(_0x229130);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 66fa718..70f4ef1 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 _0x71fe=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x71fe,0x1c1));var _0xe71f=function(_0x4009c4,_0x3f7222){_0x4009c4=_0x4009c4-0x0;var _0x4e8ef7=_0x71fe[_0x4009c4];return _0x4e8ef7;};'use strict';var multer=require(_0xe71f('0x0'));var util=require(_0xe71f('0x1'));var path=require(_0xe71f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe71f('0x3'));var router=express[_0xe71f('0x4')]();var fs_extra=require(_0xe71f('0x5'));var auth=require(_0xe71f('0x6'));var interaction=require(_0xe71f('0x7'));var config=require(_0xe71f('0x8'));var controller=require(_0xe71f('0x9'));router[_0xe71f('0xa')]('/',auth[_0xe71f('0xb')](),controller[_0xe71f('0xc')]);router['get'](_0xe71f('0xd'),auth['isAuthenticated'](),controller[_0xe71f('0xe')]);router['get'](_0xe71f('0xf'),auth['isAuthenticated'](),controller[_0xe71f('0x10')]);router[_0xe71f('0xa')]('/:id/fields',auth[_0xe71f('0xb')](),controller[_0xe71f('0x11')]);router[_0xe71f('0x12')]('/',auth[_0xe71f('0xb')](),controller[_0xe71f('0x13')]);router[_0xe71f('0x12')]('/:id/configurations',auth[_0xe71f('0xb')](),controller[_0xe71f('0x14')]);router[_0xe71f('0x15')]('/:id',auth[_0xe71f('0xb')](),controller['update']);router[_0xe71f('0x16')](_0xe71f('0xd'),auth[_0xe71f('0xb')](),controller[_0xe71f('0x17')]);module[_0xe71f('0x18')]=router; \ No newline at end of file +var _0x12bf=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update'];(function(_0xc14a52,_0x5b84b9){var _0x2e5227=function(_0x580348){while(--_0x580348){_0xc14a52['push'](_0xc14a52['shift']());}};_0x2e5227(++_0x5b84b9);}(_0x12bf,0x1e7));var _0xf12b=function(_0x3d8288,_0x1060d8){_0x3d8288=_0x3d8288-0x0;var _0x2fca2f=_0x12bf[_0x3d8288];return _0x2fca2f;};'use strict';var multer=require(_0xf12b('0x0'));var util=require(_0xf12b('0x1'));var path=require(_0xf12b('0x2'));var timeout=require('connect-timeout');var express=require(_0xf12b('0x3'));var router=express[_0xf12b('0x4')]();var fs_extra=require(_0xf12b('0x5'));var auth=require(_0xf12b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf12b('0x7'));router[_0xf12b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf12b('0x8')](_0xf12b('0x9'),auth[_0xf12b('0xa')](),controller[_0xf12b('0xb')]);router['get'](_0xf12b('0xc'),auth[_0xf12b('0xa')](),controller[_0xf12b('0xd')]);router[_0xf12b('0x8')](_0xf12b('0xe'),auth[_0xf12b('0xa')](),controller[_0xf12b('0xf')]);router[_0xf12b('0x10')]('/',auth[_0xf12b('0xa')](),controller[_0xf12b('0x11')]);router[_0xf12b('0x10')](_0xf12b('0xc'),auth[_0xf12b('0xa')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf12b('0x12')]);router[_0xf12b('0x13')](_0xf12b('0x9'),auth[_0xf12b('0xa')](),controller[_0xf12b('0x14')]);module[_0xf12b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index c63efe3..26fd75e 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 _0xdace=['STRING','sequelize'];(function(_0x44d476,_0x290113){var _0xba03e=function(_0x2c54d0){while(--_0x2c54d0){_0x44d476['push'](_0x44d476['shift']());}};_0xba03e(++_0x290113);}(_0xdace,0xc5));var _0xedac=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdace[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa8a8=['exports','STRING','sequelize'];(function(_0xb1aeb,_0x2ec92d){var _0x2d1e43=function(_0x4087bf){while(--_0x4087bf){_0xb1aeb['push'](_0xb1aeb['shift']());}};_0x2d1e43(++_0x2ec92d);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3e4aaa,_0x26075c){_0x3e4aaa=_0x3e4aaa-0x0;var _0x19387e=_0xa8a8[_0x3e4aaa];return _0x19387e;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index eea6cc5..7b80012 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 _0x42c7=['zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZohoAccount','findAll','show','params','filters','options','find','catch','create','body','getConfigurations','findOne','order','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','zoho.eu','lastIndexOf','GET','format','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format'];(function(_0x22eeb5,_0x448ad3){var _0x36b148=function(_0x115ccd){while(--_0x115ccd){_0x22eeb5['push'](_0x22eeb5['shift']());}};_0x36b148(++_0x448ad3);}(_0x42c7,0xf7));var _0x742c=function(_0x3b3f67,_0x26c2a0){_0x3b3f67=_0x3b3f67-0x0;var _0x3374e5=_0x42c7[_0x3b3f67];return _0x3374e5;};'use strict';var emlformat=require(_0x742c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x742c('0x1'));var jsonpatch=require(_0x742c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x742c('0x3'));var Mustache=require(_0x742c('0x4'));var util=require(_0x742c('0x5'));var path=require(_0x742c('0x6'));var sox=require('sox');var csv=require(_0x742c('0x7'));var ejs=require(_0x742c('0x8'));var fs=require('fs');var fs_extra=require(_0x742c('0x9'));var _=require(_0x742c('0xa'));var squel=require('squel');var crypto=require(_0x742c('0xb'));var jsforce=require(_0x742c('0xc'));var deskjs=require(_0x742c('0xd'));var toCsv=require(_0x742c('0x7'));var querystring=require(_0x742c('0xe'));var Papa=require(_0x742c('0xf'));var Redis=require(_0x742c('0x10'));var authService=require(_0x742c('0x11'));var qs=require(_0x742c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x742c('0x13'));var logger=require('../../config/logger')(_0x742c('0x14'));var utils=require('../../config/utils');var config=require(_0x742c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x742c('0x16'))['db'];var integrations=require(_0x742c('0x17'));function respondWithStatusCode(_0x199284,_0x508d7f){_0x508d7f=_0x508d7f||0xcc;return function(_0x1d32ca){if(_0x1d32ca){return _0x199284[_0x742c('0x18')](_0x508d7f);}return _0x199284['status'](_0x508d7f)['end']();};}function respondWithResult(_0x22c8a2,_0x309c92){_0x309c92=_0x309c92||0xc8;return function(_0x27b0f0){if(_0x27b0f0){return _0x22c8a2[_0x742c('0x19')](_0x309c92)[_0x742c('0x1a')](_0x27b0f0);}};}function respondWithFilteredResult(_0x3d7abd,_0x101bc7){return function(_0x596f5a){if(_0x596f5a){var _0x30f663=typeof _0x101bc7[_0x742c('0x1b')]==='undefined'&&typeof _0x101bc7[_0x742c('0x1c')]==='undefined';var _0x3e96f5=_0x596f5a[_0x742c('0x1d')];var _0x16d4e1=_0x30f663?0x0:_0x101bc7[_0x742c('0x1b')];var _0x22f209=_0x30f663?_0x596f5a['count']:_0x101bc7[_0x742c('0x1b')]+_0x101bc7[_0x742c('0x1c')];var _0x165712;if(_0x22f209>=_0x3e96f5){_0x22f209=_0x3e96f5;_0x165712=0xc8;}else{_0x165712=0xce;}_0x3d7abd[_0x742c('0x19')](_0x165712);return _0x3d7abd['set'](_0x742c('0x1e'),_0x16d4e1+'-'+_0x22f209+'/'+_0x3e96f5)[_0x742c('0x1a')](_0x596f5a);}return null;};}function patchUpdates(_0x2d1a5c){return function(_0x4bbd86){try{jsonpatch[_0x742c('0x1f')](_0x4bbd86,_0x2d1a5c,!![]);}catch(_0x52b3f4){return BPromise[_0x742c('0x20')](_0x52b3f4);}return _0x4bbd86[_0x742c('0x21')]();};}function saveUpdates(_0xb8e64a,_0x40f399){return function(_0x399bff){if(_0x399bff){return _0x399bff[_0x742c('0x22')](_0xb8e64a)['then'](function(_0x406041){return _0x406041;});}return null;};}function removeEntity(_0x424215,_0xa40c3d){return function(_0x3a4ae6){if(_0x3a4ae6){return _0x3a4ae6[_0x742c('0x23')]()[_0x742c('0x24')](function(){_0x424215['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260321,_0x185db3){return function(_0x854e3e){if(!_0x854e3e){_0x260321[_0x742c('0x18')](0x194);}return _0x854e3e;};}function handleError(_0x18a600,_0x1c75ba){_0x1c75ba=_0x1c75ba||0x1f4;return function(_0x26e683){logger[_0x742c('0x25')](_0x26e683['stack']);if(_0x26e683['name']){delete _0x26e683[_0x742c('0x26')];}_0x18a600[_0x742c('0x19')](_0x1c75ba)[_0x742c('0x27')](_0x26e683);};}exports[_0x742c('0x28')]=function(_0x55cc7a,_0x466014){var _0x29525c={},_0x201fc7={},_0x6169f9={'count':0x0,'rows':[]};var _0xad1f8d=_['map'](db['ZohoAccount'][_0x742c('0x29')],function(_0x357ff0){return{'name':_0x357ff0[_0x742c('0x2a')],'type':_0x357ff0[_0x742c('0x2b')]['key']};});_0x201fc7[_0x742c('0x2c')]=_[_0x742c('0x2d')](_0xad1f8d,_0x742c('0x26'));_0x201fc7['query']=_[_0x742c('0x2e')](_0x55cc7a['query']);_0x201fc7['filters']=_[_0x742c('0x2f')](_0x201fc7['model'],_0x201fc7[_0x742c('0x30')]);_0x29525c[_0x742c('0x31')]=_['intersection'](_0x201fc7['model'],qs['fields'](_0x55cc7a[_0x742c('0x30')][_0x742c('0x32')]));_0x29525c['attributes']=_0x29525c[_0x742c('0x31')][_0x742c('0x33')]?_0x29525c[_0x742c('0x31')]:_0x201fc7[_0x742c('0x2c')];if(!_0x55cc7a[_0x742c('0x30')]['hasOwnProperty'](_0x742c('0x34'))){_0x29525c['limit']=qs[_0x742c('0x1c')](_0x55cc7a[_0x742c('0x30')][_0x742c('0x1c')]);_0x29525c['offset']=qs[_0x742c('0x1b')](_0x55cc7a[_0x742c('0x30')][_0x742c('0x1b')]);}_0x29525c['order']=qs[_0x742c('0x35')](_0x55cc7a['query'][_0x742c('0x35')]);_0x29525c[_0x742c('0x36')]=qs['filters'](_[_0x742c('0x37')](_0x55cc7a[_0x742c('0x30')],_0x201fc7['filters']),_0xad1f8d);if(_0x55cc7a[_0x742c('0x30')][_0x742c('0x38')]){_0x29525c['where']=_[_0x742c('0x39')](_0x29525c[_0x742c('0x36')],{'$or':_[_0x742c('0x2d')](_0xad1f8d,function(_0x4a351d){if(_0x4a351d['type']!==_0x742c('0x3a')){var _0xa8dfa7={};_0xa8dfa7[_0x4a351d[_0x742c('0x26')]]={'$like':'%'+_0x55cc7a[_0x742c('0x30')][_0x742c('0x38')]+'%'};return _0xa8dfa7;}})});}_0x29525c=_['merge']({},_0x29525c,_0x55cc7a['options']);var _0x34d5df={'where':_0x29525c[_0x742c('0x36')]};return db['ZohoAccount'][_0x742c('0x1d')](_0x34d5df)[_0x742c('0x24')](function(_0x5c6051){_0x6169f9[_0x742c('0x1d')]=_0x5c6051;if(_0x55cc7a['query'][_0x742c('0x3b')]){_0x29525c[_0x742c('0x3c')]=[{'all':!![]}];}return db[_0x742c('0x3d')][_0x742c('0x3e')](_0x29525c);})[_0x742c('0x24')](function(_0x324aee){_0x6169f9['rows']=_0x324aee;return _0x6169f9;})[_0x742c('0x24')](respondWithFilteredResult(_0x466014,_0x29525c))['catch'](handleError(_0x466014,null));};exports[_0x742c('0x3f')]=function(_0x1bb48f,_0x246e44){var _0x217ae6={'raw':![],'where':{'id':_0x1bb48f[_0x742c('0x40')]['id']}},_0x46fda5={};_0x46fda5[_0x742c('0x2c')]=_['keys'](db[_0x742c('0x3d')]['rawAttributes']);_0x46fda5[_0x742c('0x30')]=_[_0x742c('0x2e')](_0x1bb48f['query']);_0x46fda5[_0x742c('0x41')]=_[_0x742c('0x2f')](_0x46fda5[_0x742c('0x2c')],_0x46fda5[_0x742c('0x30')]);_0x217ae6[_0x742c('0x31')]=_[_0x742c('0x2f')](_0x46fda5[_0x742c('0x2c')],qs['fields'](_0x1bb48f[_0x742c('0x30')]['fields']));_0x217ae6[_0x742c('0x31')]=_0x217ae6[_0x742c('0x31')]['length']?_0x217ae6['attributes']:_0x46fda5[_0x742c('0x2c')];if(_0x1bb48f[_0x742c('0x30')][_0x742c('0x3b')]){_0x217ae6[_0x742c('0x3c')]=[{'all':!![]}];}_0x217ae6=_['merge']({},_0x217ae6,_0x1bb48f[_0x742c('0x42')]);return db[_0x742c('0x3d')][_0x742c('0x43')](_0x217ae6)[_0x742c('0x24')](handleEntityNotFound(_0x246e44,null))['then'](respondWithResult(_0x246e44,null))[_0x742c('0x44')](handleError(_0x246e44,null));};exports[_0x742c('0x45')]=function(_0x558dfa,_0x382507){return db[_0x742c('0x3d')][_0x742c('0x45')](_0x558dfa[_0x742c('0x46')],{})[_0x742c('0x24')](respondWithResult(_0x382507,0xc9))['catch'](handleError(_0x382507,null));};exports[_0x742c('0x22')]=function(_0x5e59ba,_0x4b09e1){if(_0x5e59ba[_0x742c('0x46')]['id']){delete _0x5e59ba[_0x742c('0x46')]['id'];}return db[_0x742c('0x3d')]['find']({'where':{'id':_0x5e59ba[_0x742c('0x40')]['id']}})[_0x742c('0x24')](handleEntityNotFound(_0x4b09e1,null))['then'](saveUpdates(_0x5e59ba[_0x742c('0x46')],null))[_0x742c('0x24')](respondWithResult(_0x4b09e1,null))[_0x742c('0x44')](handleError(_0x4b09e1,null));};exports[_0x742c('0x23')]=function(_0x494a03,_0x1d9c2b){return db['ZohoAccount'][_0x742c('0x43')]({'where':{'id':_0x494a03[_0x742c('0x40')]['id']}})[_0x742c('0x24')](handleEntityNotFound(_0x1d9c2b,null))[_0x742c('0x24')](removeEntity(_0x1d9c2b,null))[_0x742c('0x44')](handleError(_0x1d9c2b,null));};exports[_0x742c('0x47')]=function(_0x14c1de,_0x3af04e,_0x5f7ecf){var _0x407dff={};var _0x3e12c9={};var _0x209a51;var _0x4c0a20;return db[_0x742c('0x3d')][_0x742c('0x48')]({'where':{'id':_0x14c1de['params']['id']}})['then'](handleEntityNotFound(_0x3af04e,null))[_0x742c('0x24')](function(_0x16b4db){if(_0x16b4db){_0x209a51=_0x16b4db;_0x3e12c9[_0x742c('0x2c')]=_[_0x742c('0x2e')](db['ZohoConfiguration'][_0x742c('0x29')]);_0x3e12c9[_0x742c('0x30')]=_[_0x742c('0x2e')](_0x14c1de[_0x742c('0x30')]);_0x3e12c9[_0x742c('0x41')]=_['intersection'](_0x3e12c9['model'],_0x3e12c9['query']);_0x407dff[_0x742c('0x31')]=_['intersection'](_0x3e12c9['model'],qs[_0x742c('0x32')](_0x14c1de['query']['fields']));_0x407dff[_0x742c('0x31')]=_0x407dff[_0x742c('0x31')][_0x742c('0x33')]?_0x407dff[_0x742c('0x31')]:_0x3e12c9[_0x742c('0x2c')];_0x407dff[_0x742c('0x49')]=qs[_0x742c('0x35')](_0x14c1de[_0x742c('0x30')]['sort']);_0x407dff[_0x742c('0x36')]=qs['filters'](_['pick'](_0x14c1de[_0x742c('0x30')],_0x3e12c9['filters']));if(_0x14c1de[_0x742c('0x30')][_0x742c('0x38')]){_0x407dff[_0x742c('0x36')]=_['merge'](_0x407dff[_0x742c('0x36')],{'$or':_[_0x742c('0x2d')](_0x407dff[_0x742c('0x31')],function(_0xec7d){var _0x5cfa4a={};_0x5cfa4a[_0xec7d]={'$like':'%'+_0x14c1de[_0x742c('0x30')][_0x742c('0x38')]+'%'};return _0x5cfa4a;})});}_0x407dff=_[_0x742c('0x39')]({},_0x407dff,_0x14c1de[_0x742c('0x42')]);return _0x209a51['getConfigurations'](_0x407dff);}})[_0x742c('0x24')](function(_0x1a9c18){if(_0x1a9c18){_0x4c0a20=_0x1a9c18['length'];if(!_0x14c1de['query'][_0x742c('0x4a')](_0x742c('0x34'))){_0x407dff['limit']=qs[_0x742c('0x1c')](_0x14c1de['query'][_0x742c('0x1c')]);_0x407dff[_0x742c('0x1b')]=qs[_0x742c('0x1b')](_0x14c1de[_0x742c('0x30')][_0x742c('0x1b')]);}return _0x209a51[_0x742c('0x47')](_0x407dff);}})['then'](function(_0x154e97){if(_0x154e97){return _0x154e97?{'count':_0x4c0a20,'rows':_0x154e97}:null;}})[_0x742c('0x24')](respondWithResult(_0x3af04e,null))[_0x742c('0x44')](handleError(_0x3af04e,null));};exports['addConfiguration']=function(_0x161011,_0x52dd68,_0x26eda7){if(_0x161011[_0x742c('0x46')]['id']){delete _0x161011[_0x742c('0x46')]['id'];}return db[_0x742c('0x3d')][_0x742c('0x48')]({'where':{'id':_0x161011[_0x742c('0x40')]['id']}})[_0x742c('0x24')](handleEntityNotFound(_0x52dd68,null))[_0x742c('0x24')](function(_0x29e324){if(_0x29e324){_0x161011[_0x742c('0x46')][_0x742c('0x4b')]=_0x29e324['id'];_0x161011[_0x742c('0x46')][_0x742c('0x4c')]=integrations[_0x742c('0x4d')](_0x161011[_0x742c('0x46')][_0x742c('0x4e')],_0x161011[_0x742c('0x46')][_0x742c('0x2b')]);_0x161011[_0x742c('0x46')]['Descriptions']=integrations[_0x742c('0x4f')](_0x161011[_0x742c('0x46')]['channel'],_0x161011[_0x742c('0x46')]['type']);return db[_0x742c('0x50')]['create'](_0x161011[_0x742c('0x46')],{'include':[{'model':db['ZohoField'],'as':_0x742c('0x4c')},{'model':db[_0x742c('0x51')],'as':_0x742c('0x52')}]});}return null;})['then'](respondWithResult(_0x52dd68,null))[_0x742c('0x44')](handleError(_0x52dd68,null));};function getAccessToken(_0x29e69b){return new Promise(function(_0x3c66d8,_0x2a9ec2){var _0x527c2c;switch(_0x29e69b['zone']){case'US':_0x527c2c=_0x742c('0x53');break;case'AU':_0x527c2c=_0x742c('0x54');break;case'EU':_0x527c2c=_0x742c('0x55');break;case'IN':_0x527c2c=_0x742c('0x56');break;case'CN':_0x527c2c=_0x742c('0x57');break;default:_0x527c2c=_0x742c('0x55');break;}var _0x367ad2={'method':_0x742c('0x58'),'uri':_0x527c2c+_0x742c('0x59'),'qs':{'refresh_token':_0x29e69b[_0x742c('0x5a')],'client_id':_0x29e69b[_0x742c('0x5b')],'client_secret':_0x29e69b[_0x742c('0x5c')],'grant_type':_0x742c('0x5d')},'json':!![]};return rp(_0x367ad2)['then'](function(_0x3ffea3){if(_0x3ffea3[_0x742c('0x5e')]){_0x3c66d8(_0x3ffea3[_0x742c('0x5e')]);}else{_0x2a9ec2(_0x742c('0x5f'));}})[_0x742c('0x44')](function(_0x4e4c9e){_0x2a9ec2(_0x4e4c9e);});});}exports[_0x742c('0x60')]=function(_0x4a98f5,_0x1a18e3,_0x1739de){var _0x201562,_0x4586f3,_0x291bac,_0x495d60,_0x1dd1d0;return db[_0x742c('0x3d')][_0x742c('0x48')]({'where':{'id':_0x4a98f5['params']['id']},'attributes':['id',_0x742c('0x61'),_0x742c('0x62'),'clientId',_0x742c('0x5c'),_0x742c('0x63'),'code',_0x742c('0x5a')]})[_0x742c('0x24')](handleEntityNotFound(_0x1a18e3,null))[_0x742c('0x24')](function(_0x6f941d){_0x1dd1d0=_0x6f941d;_0x201562=_0x1dd1d0[_0x742c('0x61')];_0x4586f3=_0x201562===_0x742c('0x64')?'eu':'com';_0x291bac=_0x1dd1d0[_0x742c('0x63')];var _0x37dd64=_0x291bac['slice'](-0x1);if(_0x37dd64==='/'||_0x37dd64==='\x5c'||_0x37dd64===':'){_0x291bac=_0x291bac['substring'](0x0,_0x291bac[_0x742c('0x65')](_0x37dd64));}if(!_0x1dd1d0[_0x742c('0x5a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x1dd1d0);})[_0x742c('0x24')](function(_0xbef515){if(_0xbef515){return rp({'method':_0x742c('0x66'),'uri':util[_0x742c('0x67')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4586f3),'qs':{'module':'Calls'},'headers':{'Authorization':_0x742c('0x68')+_0xbef515},'json':!![]});}})['then'](function(_0x5afecd){if(_0x5afecd){if(_0x5afecd['response']&&_0x5afecd[_0x742c('0x69')][_0x742c('0x25')]){throw new Error(_0x5afecd[_0x742c('0x69')]['error']['message']);}var _0xf45c60=[];var _0x47c4b4=[];var _0x5e3ba0=['Owner',_0x742c('0x6a'),'Description',_0x742c('0x6b'),'Call_Duration',_0x742c('0x6c'),_0x742c('0x6d'),'Call_Type'];_0x47c4b4=_[_0x742c('0x6e')](_0x5afecd[_0x742c('0x32')],function(_0x435ac5){return _0x5e3ba0[_0x742c('0x6f')](_0x435ac5[_0x742c('0x70')]);});for(var _0x53bef6=0x0;_0x53bef6<_0x47c4b4[_0x742c('0x33')];_0x53bef6++){if(_0x47c4b4[_0x53bef6]['system_mandatory']===![]){_0xf45c60[_0x742c('0x71')]({'id':_0x47c4b4[_0x53bef6]['id'],'name':_0x47c4b4[_0x53bef6][_0x742c('0x72')],'custom':_0x47c4b4[_0x53bef6][_0x742c('0x73')],'options':_0x47c4b4[_0x53bef6][_0x742c('0x74')]===_0x742c('0x75')&&_0x47c4b4[_0x53bef6]['pick_list_values'][_0x742c('0x33')]>-0x1?_[_0x742c('0x2d')](_0x47c4b4[_0x53bef6][_0x742c('0x76')],function(_0x4f56e){return{'name':_0x4f56e,'value':_0x4f56e};}):[]});}}return{'count':_0xf45c60[_0x742c('0x33')],'rows':_0xf45c60};}else{return{'count':0x0,'rows':[]};}})[_0x742c('0x24')](respondWithResult(_0x1a18e3,null))[_0x742c('0x44')](function(_0x4f57f9){var _0x4c4939=_0x4a98f5[_0x742c('0x30')][_0x742c('0x77')]?0x1f4:_0x4f57f9['statusCode']||0x1f4;logger[_0x742c('0x25')](_0x742c('0x78'),'getFields',_0x4c4939,JSON[_0x742c('0x79')](_0x4f57f9));delete _0x4f57f9['name'];if(_0x4c4939===0x191){_0x4c4939=0x190;}_0x1a18e3[_0x742c('0x19')](_0x4c4939)[_0x742c('0x27')](_0x4a98f5[_0x742c('0x30')][_0x742c('0x77')]?{'message':_0x742c('0x7a'),'statusCode':_0x4f57f9[_0x742c('0x7b')]}:_0x4f57f9);});}; \ No newline at end of file +var _0xe799=['getConfigurations','findOne','keys','addConfiguration','body','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Subject','WhoId','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','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','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','find','create','params'];(function(_0x168b3c,_0x28e65e){var _0x4de1f3=function(_0x134360){while(--_0x134360){_0x168b3c['push'](_0x168b3c['shift']());}};_0x4de1f3(++_0x28e65e);}(_0xe799,0x131));var _0x9e79=function(_0x59debc,_0x1aac5c){_0x59debc=_0x59debc-0x0;var _0x57c910=_0xe799[_0x59debc];return _0x57c910;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e79('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e79('0x1'));var rp=require(_0x9e79('0x2'));var moment=require(_0x9e79('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9e79('0x4'));var sox=require(_0x9e79('0x5'));var csv=require('to-csv');var ejs=require(_0x9e79('0x6'));var fs=require('fs');var fs_extra=require(_0x9e79('0x7'));var _=require(_0x9e79('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e79('0x9'));var deskjs=require(_0x9e79('0xa'));var toCsv=require(_0x9e79('0xb'));var querystring=require(_0x9e79('0xc'));var Papa=require(_0x9e79('0xd'));var Redis=require(_0x9e79('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9e79('0xf'));var as=require(_0x9e79('0x10'));var hardwareService=require(_0x9e79('0x11'));var logger=require(_0x9e79('0x12'))(_0x9e79('0x13'));var utils=require(_0x9e79('0x14'));var config=require(_0x9e79('0x15'));var licenseUtil=require(_0x9e79('0x16'));var db=require(_0x9e79('0x17'))['db'];var integrations=require(_0x9e79('0x18'));function respondWithStatusCode(_0x2c991e,_0x2a9065){_0x2a9065=_0x2a9065||0xcc;return function(_0x2a7888){if(_0x2a7888){return _0x2c991e['sendStatus'](_0x2a9065);}return _0x2c991e[_0x9e79('0x19')](_0x2a9065)[_0x9e79('0x1a')]();};}function respondWithResult(_0x4033b5,_0x53b9a1){_0x53b9a1=_0x53b9a1||0xc8;return function(_0x579bbd){if(_0x579bbd){return _0x4033b5['status'](_0x53b9a1)[_0x9e79('0x1b')](_0x579bbd);}};}function respondWithFilteredResult(_0x45f351,_0x2b3c96){return function(_0x2cbe9f){if(_0x2cbe9f){var _0x106ff6=typeof _0x2b3c96[_0x9e79('0x1c')]===_0x9e79('0x1d')&&typeof _0x2b3c96['limit']===_0x9e79('0x1d');var _0x5c119e=_0x2cbe9f['count'];var _0x4f1d1e=_0x106ff6?0x0:_0x2b3c96[_0x9e79('0x1c')];var _0x232ede=_0x106ff6?_0x2cbe9f[_0x9e79('0x1e')]:_0x2b3c96[_0x9e79('0x1c')]+_0x2b3c96[_0x9e79('0x1f')];var _0x1b37d6;if(_0x232ede>=_0x5c119e){_0x232ede=_0x5c119e;_0x1b37d6=0xc8;}else{_0x1b37d6=0xce;}_0x45f351[_0x9e79('0x19')](_0x1b37d6);return _0x45f351[_0x9e79('0x20')]('Content-Range',_0x4f1d1e+'-'+_0x232ede+'/'+_0x5c119e)[_0x9e79('0x1b')](_0x2cbe9f);}return null;};}function patchUpdates(_0x3a9325){return function(_0x3e5cd7){try{jsonpatch[_0x9e79('0x21')](_0x3e5cd7,_0x3a9325,!![]);}catch(_0x363951){return BPromise[_0x9e79('0x22')](_0x363951);}return _0x3e5cd7[_0x9e79('0x23')]();};}function saveUpdates(_0x18d518,_0x492bf6){return function(_0x580dfd){if(_0x580dfd){return _0x580dfd[_0x9e79('0x24')](_0x18d518)[_0x9e79('0x25')](function(_0x506ab2){return _0x506ab2;});}return null;};}function removeEntity(_0x7b8807,_0x1bc7fc){return function(_0x3ca653){if(_0x3ca653){return _0x3ca653['destroy']()['then'](function(){_0x7b8807['status'](0xcc)[_0x9e79('0x1a')]();});}};}function handleEntityNotFound(_0x1ff656,_0x2f15dd){return function(_0x2c9629){if(!_0x2c9629){_0x1ff656[_0x9e79('0x26')](0x194);}return _0x2c9629;};}function handleError(_0x15a9b0,_0x7cf80d){_0x7cf80d=_0x7cf80d||0x1f4;return function(_0x38a147){logger[_0x9e79('0x27')](_0x38a147[_0x9e79('0x28')]);if(_0x38a147[_0x9e79('0x29')]){delete _0x38a147['name'];}_0x15a9b0['status'](_0x7cf80d)['send'](_0x38a147);};}exports[_0x9e79('0x2a')]=function(_0x3ef563,_0xcf914a){var _0x5c01fd={},_0x14f5e5={},_0x3be46={'count':0x0,'rows':[]};var _0x4f8d24=_[_0x9e79('0x2b')](db[_0x9e79('0x2c')][_0x9e79('0x2d')],function(_0x335a77){return{'name':_0x335a77[_0x9e79('0x2e')],'type':_0x335a77[_0x9e79('0x2f')]['key']};});_0x14f5e5[_0x9e79('0x30')]=_[_0x9e79('0x2b')](_0x4f8d24,'name');_0x14f5e5[_0x9e79('0x31')]=_['keys'](_0x3ef563[_0x9e79('0x31')]);_0x14f5e5[_0x9e79('0x32')]=_[_0x9e79('0x33')](_0x14f5e5[_0x9e79('0x30')],_0x14f5e5[_0x9e79('0x31')]);_0x5c01fd['attributes']=_[_0x9e79('0x33')](_0x14f5e5[_0x9e79('0x30')],qs[_0x9e79('0x34')](_0x3ef563['query'][_0x9e79('0x34')]));_0x5c01fd[_0x9e79('0x35')]=_0x5c01fd[_0x9e79('0x35')][_0x9e79('0x36')]?_0x5c01fd['attributes']:_0x14f5e5[_0x9e79('0x30')];if(!_0x3ef563[_0x9e79('0x31')][_0x9e79('0x37')](_0x9e79('0x38'))){_0x5c01fd['limit']=qs['limit'](_0x3ef563[_0x9e79('0x31')][_0x9e79('0x1f')]);_0x5c01fd['offset']=qs[_0x9e79('0x1c')](_0x3ef563['query'][_0x9e79('0x1c')]);}_0x5c01fd[_0x9e79('0x39')]=qs['sort'](_0x3ef563[_0x9e79('0x31')][_0x9e79('0x3a')]);_0x5c01fd[_0x9e79('0x3b')]=qs[_0x9e79('0x32')](_[_0x9e79('0x3c')](_0x3ef563[_0x9e79('0x31')],_0x14f5e5[_0x9e79('0x32')]),_0x4f8d24);if(_0x3ef563[_0x9e79('0x31')][_0x9e79('0x3d')]){_0x5c01fd['where']=_['merge'](_0x5c01fd[_0x9e79('0x3b')],{'$or':_[_0x9e79('0x2b')](_0x4f8d24,function(_0x26a9d5){if(_0x26a9d5[_0x9e79('0x2f')]!==_0x9e79('0x3e')){var _0x33caa0={};_0x33caa0[_0x26a9d5[_0x9e79('0x29')]]={'$like':'%'+_0x3ef563[_0x9e79('0x31')]['filter']+'%'};return _0x33caa0;}})});}_0x5c01fd=_[_0x9e79('0x3f')]({},_0x5c01fd,_0x3ef563[_0x9e79('0x40')]);var _0x59368b={'where':_0x5c01fd[_0x9e79('0x3b')]};return db[_0x9e79('0x2c')][_0x9e79('0x1e')](_0x59368b)['then'](function(_0x86540f){_0x3be46[_0x9e79('0x1e')]=_0x86540f;if(_0x3ef563[_0x9e79('0x31')]['includeAll']){_0x5c01fd[_0x9e79('0x41')]=[{'all':!![]}];}return db[_0x9e79('0x2c')][_0x9e79('0x42')](_0x5c01fd);})['then'](function(_0x51685d){_0x3be46[_0x9e79('0x43')]=_0x51685d;return _0x3be46;})[_0x9e79('0x25')](respondWithFilteredResult(_0xcf914a,_0x5c01fd))[_0x9e79('0x44')](handleError(_0xcf914a,null));};exports[_0x9e79('0x45')]=function(_0x15d640,_0x5dc6b1){var _0x51a88e={'raw':![],'where':{'id':_0x15d640['params']['id']}},_0x2f33a9={};_0x2f33a9[_0x9e79('0x30')]=_['keys'](db[_0x9e79('0x2c')][_0x9e79('0x2d')]);_0x2f33a9['query']=_['keys'](_0x15d640[_0x9e79('0x31')]);_0x2f33a9[_0x9e79('0x32')]=_[_0x9e79('0x33')](_0x2f33a9[_0x9e79('0x30')],_0x2f33a9[_0x9e79('0x31')]);_0x51a88e[_0x9e79('0x35')]=_['intersection'](_0x2f33a9[_0x9e79('0x30')],qs[_0x9e79('0x34')](_0x15d640[_0x9e79('0x31')][_0x9e79('0x34')]));_0x51a88e[_0x9e79('0x35')]=_0x51a88e['attributes']['length']?_0x51a88e['attributes']:_0x2f33a9[_0x9e79('0x30')];if(_0x15d640[_0x9e79('0x31')]['includeAll']){_0x51a88e[_0x9e79('0x41')]=[{'all':!![]}];}_0x51a88e=_[_0x9e79('0x3f')]({},_0x51a88e,_0x15d640[_0x9e79('0x40')]);return db[_0x9e79('0x2c')][_0x9e79('0x46')](_0x51a88e)[_0x9e79('0x25')](handleEntityNotFound(_0x5dc6b1,null))[_0x9e79('0x25')](respondWithResult(_0x5dc6b1,null))[_0x9e79('0x44')](handleError(_0x5dc6b1,null));};exports[_0x9e79('0x47')]=function(_0x5dc08e,_0x3b2eae){return db[_0x9e79('0x2c')][_0x9e79('0x47')](_0x5dc08e['body'],{})[_0x9e79('0x25')](respondWithResult(_0x3b2eae,0xc9))['catch'](handleError(_0x3b2eae,null));};exports['update']=function(_0x537bd8,_0x53252b){if(_0x537bd8['body']['id']){delete _0x537bd8['body']['id'];}return db[_0x9e79('0x2c')][_0x9e79('0x46')]({'where':{'id':_0x537bd8[_0x9e79('0x48')]['id']}})['then'](handleEntityNotFound(_0x53252b,null))[_0x9e79('0x25')](saveUpdates(_0x537bd8['body'],null))[_0x9e79('0x25')](respondWithResult(_0x53252b,null))['catch'](handleError(_0x53252b,null));};exports['destroy']=function(_0x402e0b,_0x3d252c){return db[_0x9e79('0x2c')]['find']({'where':{'id':_0x402e0b[_0x9e79('0x48')]['id']}})[_0x9e79('0x25')](handleEntityNotFound(_0x3d252c,null))['then'](removeEntity(_0x3d252c,null))[_0x9e79('0x44')](handleError(_0x3d252c,null));};exports[_0x9e79('0x49')]=function(_0x3c7f80,_0xfff6ca,_0x50dcab){var _0xcedc0d={};var _0x312897={};var _0x24c56e;var _0x2a60e6;return db[_0x9e79('0x2c')][_0x9e79('0x4a')]({'where':{'id':_0x3c7f80[_0x9e79('0x48')]['id']}})['then'](handleEntityNotFound(_0xfff6ca,null))[_0x9e79('0x25')](function(_0x99d8e0){if(_0x99d8e0){_0x24c56e=_0x99d8e0;_0x312897[_0x9e79('0x30')]=_[_0x9e79('0x4b')](db['ZohoConfiguration'][_0x9e79('0x2d')]);_0x312897[_0x9e79('0x31')]=_[_0x9e79('0x4b')](_0x3c7f80['query']);_0x312897[_0x9e79('0x32')]=_[_0x9e79('0x33')](_0x312897[_0x9e79('0x30')],_0x312897['query']);_0xcedc0d[_0x9e79('0x35')]=_[_0x9e79('0x33')](_0x312897[_0x9e79('0x30')],qs[_0x9e79('0x34')](_0x3c7f80['query'][_0x9e79('0x34')]));_0xcedc0d['attributes']=_0xcedc0d[_0x9e79('0x35')]['length']?_0xcedc0d[_0x9e79('0x35')]:_0x312897[_0x9e79('0x30')];_0xcedc0d[_0x9e79('0x39')]=qs[_0x9e79('0x3a')](_0x3c7f80[_0x9e79('0x31')][_0x9e79('0x3a')]);_0xcedc0d[_0x9e79('0x3b')]=qs[_0x9e79('0x32')](_['pick'](_0x3c7f80['query'],_0x312897['filters']));if(_0x3c7f80[_0x9e79('0x31')]['filter']){_0xcedc0d[_0x9e79('0x3b')]=_[_0x9e79('0x3f')](_0xcedc0d['where'],{'$or':_[_0x9e79('0x2b')](_0xcedc0d['attributes'],function(_0x50e2c3){var _0x13c654={};_0x13c654[_0x50e2c3]={'$like':'%'+_0x3c7f80[_0x9e79('0x31')]['filter']+'%'};return _0x13c654;})});}_0xcedc0d=_[_0x9e79('0x3f')]({},_0xcedc0d,_0x3c7f80['options']);return _0x24c56e['getConfigurations'](_0xcedc0d);}})[_0x9e79('0x25')](function(_0x12c9e1){if(_0x12c9e1){_0x2a60e6=_0x12c9e1[_0x9e79('0x36')];if(!_0x3c7f80[_0x9e79('0x31')]['hasOwnProperty'](_0x9e79('0x38'))){_0xcedc0d[_0x9e79('0x1f')]=qs[_0x9e79('0x1f')](_0x3c7f80[_0x9e79('0x31')]['limit']);_0xcedc0d['offset']=qs[_0x9e79('0x1c')](_0x3c7f80['query'][_0x9e79('0x1c')]);}return _0x24c56e[_0x9e79('0x49')](_0xcedc0d);}})[_0x9e79('0x25')](function(_0x464eb7){if(_0x464eb7){return _0x464eb7?{'count':_0x2a60e6,'rows':_0x464eb7}:null;}})[_0x9e79('0x25')](respondWithResult(_0xfff6ca,null))[_0x9e79('0x44')](handleError(_0xfff6ca,null));};exports[_0x9e79('0x4c')]=function(_0x8a9f3a,_0x3c19a8,_0x5a25c8){if(_0x8a9f3a[_0x9e79('0x4d')]['id']){delete _0x8a9f3a['body']['id'];}return db[_0x9e79('0x2c')][_0x9e79('0x4a')]({'where':{'id':_0x8a9f3a['params']['id']}})[_0x9e79('0x25')](handleEntityNotFound(_0x3c19a8,null))['then'](function(_0x19ec83){if(_0x19ec83){_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x4e')]=_0x19ec83['id'];_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x4f')]=integrations[_0x9e79('0x50')](_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x51')],_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x2f')]);_0x8a9f3a['body'][_0x9e79('0x52')]=integrations['getDescriptions'](_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x51')],_0x8a9f3a[_0x9e79('0x4d')][_0x9e79('0x2f')]);return db[_0x9e79('0x53')][_0x9e79('0x47')](_0x8a9f3a['body'],{'include':[{'model':db[_0x9e79('0x54')],'as':'Subjects'},{'model':db[_0x9e79('0x54')],'as':_0x9e79('0x52')}]});}return null;})['then'](respondWithResult(_0x3c19a8,null))[_0x9e79('0x44')](handleError(_0x3c19a8,null));};function getAccessToken(_0x32fa6f){return new Promise(function(_0x42bec4,_0x1865c9){var _0x2c2b06;switch(_0x32fa6f[_0x9e79('0x55')]){case'US':_0x2c2b06=_0x9e79('0x56');break;case'AU':_0x2c2b06=_0x9e79('0x57');break;case'EU':_0x2c2b06='https://accounts.zoho.eu';break;case'IN':_0x2c2b06=_0x9e79('0x58');break;case'CN':_0x2c2b06='https://accounts.zoho.com.cn';break;default:_0x2c2b06=_0x9e79('0x59');break;}var _0x3a971d={'method':'POST','uri':_0x2c2b06+_0x9e79('0x5a'),'qs':{'refresh_token':_0x32fa6f[_0x9e79('0x5b')],'client_id':_0x32fa6f[_0x9e79('0x5c')],'client_secret':_0x32fa6f['clientSecret'],'grant_type':_0x9e79('0x5d')},'json':!![]};return rp(_0x3a971d)[_0x9e79('0x25')](function(_0x56fef5){if(_0x56fef5['access_token']){_0x42bec4(_0x56fef5['access_token']);}else{_0x1865c9(_0x9e79('0x5e'));}})[_0x9e79('0x44')](function(_0x3dd00a){_0x1865c9(_0x3dd00a);});});}exports['getFields']=function(_0x4e016e,_0x281194,_0xf32223){var _0xb00821,_0x22eeeb,_0x5e367a,_0x345af9,_0x1c6598;return db[_0x9e79('0x2c')]['findOne']({'where':{'id':_0x4e016e[_0x9e79('0x48')]['id']},'attributes':['id',_0x9e79('0x5f'),_0x9e79('0x55'),_0x9e79('0x5c'),'clientSecret',_0x9e79('0x60'),_0x9e79('0x61'),_0x9e79('0x5b')]})['then'](handleEntityNotFound(_0x281194,null))[_0x9e79('0x25')](function(_0x311236){_0x1c6598=_0x311236;_0xb00821=_0x1c6598['host'];_0x22eeeb=_0xb00821===_0x9e79('0x62')?'eu':'com';_0x5e367a=_0x1c6598[_0x9e79('0x60')];var _0x55ee49=_0x5e367a[_0x9e79('0x63')](-0x1);if(_0x55ee49==='/'||_0x55ee49==='\x5c'||_0x55ee49===':'){_0x5e367a=_0x5e367a[_0x9e79('0x64')](0x0,_0x5e367a[_0x9e79('0x65')](_0x55ee49));}if(!_0x1c6598['refreshToken']){throw new Error(_0x9e79('0x66'));}return getAccessToken(_0x1c6598);})['then'](function(_0x45917f){if(_0x45917f){return rp({'method':_0x9e79('0x67'),'uri':util['format'](_0x9e79('0x68'),_0x22eeeb),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45917f},'json':!![]});}})['then'](function(_0x409358){if(_0x409358){if(_0x409358[_0x9e79('0x69')]&&_0x409358[_0x9e79('0x69')][_0x9e79('0x27')]){throw new Error(_0x409358[_0x9e79('0x69')][_0x9e79('0x27')][_0x9e79('0x6a')]);}var _0x3b9bfc=[];var _0x2eb6f1=[];var _0x2a51e8=['Owner',_0x9e79('0x6b'),'Description',_0x9e79('0x6c'),'Call_Duration','Call_Result','Call_Start_Time',_0x9e79('0x6d')];_0x2eb6f1=_[_0x9e79('0x6e')](_0x409358[_0x9e79('0x34')],function(_0x4129a3){return _0x2a51e8[_0x9e79('0x6f')](_0x4129a3[_0x9e79('0x70')]);});for(var _0x5cee7b=0x0;_0x5cee7b<_0x2eb6f1[_0x9e79('0x36')];_0x5cee7b++){if(_0x2eb6f1[_0x5cee7b][_0x9e79('0x71')]===![]){_0x3b9bfc[_0x9e79('0x72')]({'id':_0x2eb6f1[_0x5cee7b]['id'],'name':_0x2eb6f1[_0x5cee7b][_0x9e79('0x73')],'custom':_0x2eb6f1[_0x5cee7b][_0x9e79('0x74')],'options':_0x2eb6f1[_0x5cee7b][_0x9e79('0x75')]===_0x9e79('0x76')&&_0x2eb6f1[_0x5cee7b][_0x9e79('0x77')][_0x9e79('0x36')]>-0x1?_[_0x9e79('0x2b')](_0x2eb6f1[_0x5cee7b][_0x9e79('0x77')],function(_0x3c1eec){return{'name':_0x3c1eec,'value':_0x3c1eec};}):[]});}}return{'count':_0x3b9bfc[_0x9e79('0x36')],'rows':_0x3b9bfc};}else{return{'count':0x0,'rows':[]};}})[_0x9e79('0x25')](respondWithResult(_0x281194,null))['catch'](function(_0x3c6cf5){var _0x44c17e=_0x4e016e[_0x9e79('0x31')][_0x9e79('0x78')]?0x1f4:_0x3c6cf5[_0x9e79('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9e79('0x7a'),_0x44c17e,JSON[_0x9e79('0x7b')](_0x3c6cf5));delete _0x3c6cf5[_0x9e79('0x29')];if(_0x44c17e===0x191){_0x44c17e=0x190;}_0x281194[_0x9e79('0x19')](_0x44c17e)[_0x9e79('0x7c')](_0x4e016e[_0x9e79('0x31')]['test']?{'message':_0x9e79('0x7d'),'statusCode':_0x3c6cf5[_0x9e79('0x79')]}:_0x3c6cf5);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4c15eac..aed67f0 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 _0x554a=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','serverUrl','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','info','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','slice','substring'];(function(_0x4f0458,_0x40da8d){var _0xe51e3d=function(_0xb0569b){while(--_0xb0569b){_0x4f0458['push'](_0x4f0458['shift']());}};_0xe51e3d(++_0x40da8d);}(_0x554a,0x167));var _0xa554=function(_0x439ea4,_0x5179a8){_0x439ea4=_0x439ea4-0x0;var _0x461b5d=_0x554a[_0x439ea4];return _0x461b5d;};'use strict';var _=require('lodash');var util=require(_0xa554('0x0'));var logger=require(_0xa554('0x1'))('api');var moment=require(_0xa554('0x2'));var BPromise=require(_0xa554('0x3'));var rp=require(_0xa554('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa554('0x5'));var config=require(_0xa554('0x6'));var attributes=require(_0xa554('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa554('0x8')]=function(_0x3338f9,_0xeb788f){return _0x3338f9[_0xa554('0x9')]('ZohoAccount',attributes,{'tableName':_0xa554('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a39f0,_0x58b79b,_0x35de4b){if(_0x3a39f0[_0xa554('0xb')](_0xa554('0xc'))||_0x3a39f0['changed']('serverUrl')||_0x3a39f0[_0xa554('0xb')](_0xa554('0xd'))||_0x3a39f0[_0xa554('0xb')](_0xa554('0xe'))||_0x3a39f0[_0xa554('0xb')](_0xa554('0xf'))||_0x3a39f0[_0xa554('0xb')](_0xa554('0x10'))){var _0x160804,_0x370cfa;_0x160804=_0x3a39f0['serverUrl'];var _0x4bd7a6=_0x160804[_0xa554('0x11')](-0x1);if(_0x4bd7a6==='/'||_0x4bd7a6==='\x5c'||_0x4bd7a6===':'){_0x160804=_0x160804[_0xa554('0x12')](0x0,_0x160804[_0xa554('0x13')](_0x4bd7a6));}switch(_0x3a39f0[_0xa554('0xc')]){case'US':_0x370cfa=_0xa554('0x14');break;case'AU':_0x370cfa=_0xa554('0x15');break;case'IN':_0x370cfa=_0xa554('0x16');break;case'CN':_0x370cfa='https://accounts.zoho.com.cn';break;default:_0x370cfa=_0xa554('0x17');break;}var _0x12b93f={'method':_0xa554('0x18'),'uri':_0x370cfa+_0xa554('0x19'),'form':{'grant_type':_0xa554('0x1a'),'client_id':_0x3a39f0[_0xa554('0xd')],'client_secret':_0x3a39f0['clientSecret'],'redirect_uri':_0x3a39f0[_0xa554('0x1b')],'code':_0x3a39f0[_0xa554('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x12b93f)[_0xa554('0x1c')](function(_0x1406da){var _0x429491=JSON[_0xa554('0x1d')](_0x1406da);if(_0x429491[_0xa554('0x1e')]){_0x3a39f0[_0xa554('0x1f')]=_0x429491[_0xa554('0x1e')];logger['info'](util[_0xa554('0x20')](_0xa554('0x21'),_0x3a39f0[_0xa554('0x22')],_0x3a39f0['id']));}else{logger[_0xa554('0x23')](util[_0xa554('0x20')](_0xa554('0x24'),_0x3a39f0[_0xa554('0x22')],_0x3a39f0['id']),util[_0xa554('0x25')](_0x429491,{'showHidden':![],'depth':null}));}return _0x35de4b(null,_0x58b79b);})[_0xa554('0x26')](function(_0x29fb03){logger[_0xa554('0x23')](util[_0xa554('0x20')](_0xa554('0x24'),_0x3a39f0[_0xa554('0x22')],_0x3a39f0['id']),util[_0xa554('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x35de4b(_0x29fb03);});}else{return _0x35de4b(null,_0x58b79b);}},'beforeUpdate':function(_0x17845c,_0x100966,_0x561343){if(_0x17845c[_0xa554('0xb')](_0xa554('0xc'))||_0x17845c[_0xa554('0xb')](_0xa554('0x1b'))||_0x17845c['changed'](_0xa554('0xd'))||_0x17845c[_0xa554('0xb')](_0xa554('0xe'))||_0x17845c[_0xa554('0xb')](_0xa554('0xf'))||_0x17845c['changed'](_0xa554('0x10'))){var _0x13d826,_0x237e30;_0x13d826=_0x17845c[_0xa554('0x1b')];var _0x3e316e=_0x13d826[_0xa554('0x11')](-0x1);if(_0x3e316e==='/'||_0x3e316e==='\x5c'||_0x3e316e===':'){_0x13d826=_0x13d826[_0xa554('0x12')](0x0,_0x13d826[_0xa554('0x13')](_0x3e316e));}switch(_0x17845c[_0xa554('0xc')]){case'US':_0x237e30='https://accounts.zoho.com';break;case'AU':_0x237e30=_0xa554('0x15');break;case'IN':_0x237e30=_0xa554('0x16');break;case'CN':_0x237e30=_0xa554('0x27');break;default:_0x237e30=_0xa554('0x17');break;}var _0x4db6f0={'method':_0xa554('0x18'),'uri':_0x237e30+_0xa554('0x19'),'form':{'grant_type':_0xa554('0x1a'),'client_id':_0x17845c['clientId'],'client_secret':_0x17845c[_0xa554('0xe')],'redirect_uri':_0x17845c[_0xa554('0x1b')],'code':_0x17845c[_0xa554('0xf')]},'headers':{'Content-Type':_0xa554('0x28')}};return rp(_0x4db6f0)[_0xa554('0x1c')](function(_0x5323fd){var _0x502821=JSON[_0xa554('0x1d')](_0x5323fd);if(_0x502821[_0xa554('0x1e')]){_0x17845c[_0xa554('0x1f')]=_0x502821[_0xa554('0x1e')];logger[_0xa554('0x29')](util[_0xa554('0x20')](_0xa554('0x21'),_0x17845c[_0xa554('0x22')],_0x17845c['id']));}else{logger['error'](util[_0xa554('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x17845c[_0xa554('0x22')],_0x17845c['id']),util[_0xa554('0x25')](_0x502821,{'showHidden':![],'depth':null}));}return _0x561343(null,_0x100966);})['catch'](function(_0x35fede){logger[_0xa554('0x23')](util[_0xa554('0x20')](_0xa554('0x24'),_0x17845c['name'],_0x17845c['id']),util[_0xa554('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x561343(_0x35fede);});}else{return _0x561343(null,_0x100966);}}}});}; \ No newline at end of file +var _0xa7af=['refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','format','inspect','https://accounts.zoho.com','https://accounts.zoho.eu','POST','name','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','refresh_token'];(function(_0x5d76e0,_0x5621c3){var _0x646f77=function(_0x453870){while(--_0x453870){_0x5d76e0['push'](_0x5d76e0['shift']());}};_0x646f77(++_0x5621c3);}(_0xa7af,0x1a6));var _0xfa7a=function(_0x203b5c,_0x2384f1){_0x203b5c=_0x203b5c-0x0;var _0x20a057=_0xa7af[_0x203b5c];return _0x20a057;};'use strict';var _=require(_0xfa7a('0x0'));var util=require(_0xfa7a('0x1'));var logger=require(_0xfa7a('0x2'))(_0xfa7a('0x3'));var moment=require(_0xfa7a('0x4'));var BPromise=require(_0xfa7a('0x5'));var rp=require(_0xfa7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfa7a('0x7'));var integrations=require(_0xfa7a('0x8'));module[_0xfa7a('0x9')]=function(_0x159a3b,_0x5d7694){return _0x159a3b[_0xfa7a('0xa')]('ZohoAccount',attributes,{'tableName':_0xfa7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5ef398,_0x2c7893,_0x5a029b){if(_0x5ef398[_0xfa7a('0xc')]('zone')||_0x5ef398[_0xfa7a('0xc')](_0xfa7a('0xd'))||_0x5ef398[_0xfa7a('0xc')]('clientId')||_0x5ef398['changed'](_0xfa7a('0xe'))||_0x5ef398['changed'](_0xfa7a('0xf'))||_0x5ef398['changed'](_0xfa7a('0x10'))){var _0x33ec1c,_0x2a9506;_0x33ec1c=_0x5ef398['serverUrl'];var _0x351aab=_0x33ec1c[_0xfa7a('0x11')](-0x1);if(_0x351aab==='/'||_0x351aab==='\x5c'||_0x351aab===':'){_0x33ec1c=_0x33ec1c[_0xfa7a('0x12')](0x0,_0x33ec1c[_0xfa7a('0x13')](_0x351aab));}switch(_0x5ef398[_0xfa7a('0x14')]){case'US':_0x2a9506='https://accounts.zoho.com';break;case'AU':_0x2a9506=_0xfa7a('0x15');break;case'IN':_0x2a9506='https://accounts.zoho.in';break;case'CN':_0x2a9506=_0xfa7a('0x16');break;default:_0x2a9506='https://accounts.zoho.eu';break;}var _0x38ef9d={'method':'POST','uri':_0x2a9506+_0xfa7a('0x17'),'form':{'grant_type':_0xfa7a('0x18'),'client_id':_0x5ef398[_0xfa7a('0x19')],'client_secret':_0x5ef398[_0xfa7a('0xe')],'redirect_uri':_0x5ef398[_0xfa7a('0xd')],'code':_0x5ef398[_0xfa7a('0xf')]},'headers':{'Content-Type':_0xfa7a('0x1a')}};return rp(_0x38ef9d)[_0xfa7a('0x1b')](function(_0x42d6ae){var _0x3faf9e=JSON['parse'](_0x42d6ae);if(_0x3faf9e[_0xfa7a('0x1c')]){_0x5ef398[_0xfa7a('0x1d')]=_0x3faf9e[_0xfa7a('0x1c')];logger[_0xfa7a('0x1e')](util['format'](_0xfa7a('0x1f'),_0x5ef398['name'],_0x5ef398['id']));}else{logger[_0xfa7a('0x20')](util['format'](_0xfa7a('0x21'),_0x5ef398['name'],_0x5ef398['id']),util['inspect'](_0x3faf9e,{'showHidden':![],'depth':null}));}return _0x5a029b(null,_0x2c7893);})[_0xfa7a('0x22')](function(_0x2d0b1b){logger[_0xfa7a('0x20')](util[_0xfa7a('0x23')](_0xfa7a('0x21'),_0x5ef398['name'],_0x5ef398['id']),util[_0xfa7a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a029b(_0x2d0b1b);});}else{return _0x5a029b(null,_0x2c7893);}},'beforeUpdate':function(_0x56bf80,_0x622c2b,_0x55eb38){if(_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0x14'))||_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0xd'))||_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0x19'))||_0x56bf80[_0xfa7a('0xc')](_0xfa7a('0xe'))||_0x56bf80['changed']('code')||_0x56bf80[_0xfa7a('0xc')]('host')){var _0x134fdc,_0x439ecd;_0x134fdc=_0x56bf80['serverUrl'];var _0x122255=_0x134fdc[_0xfa7a('0x11')](-0x1);if(_0x122255==='/'||_0x122255==='\x5c'||_0x122255===':'){_0x134fdc=_0x134fdc[_0xfa7a('0x12')](0x0,_0x134fdc['lastIndexOf'](_0x122255));}switch(_0x56bf80['zone']){case'US':_0x439ecd=_0xfa7a('0x25');break;case'AU':_0x439ecd='https://accounts.zoho.com.au';break;case'IN':_0x439ecd='https://accounts.zoho.in';break;case'CN':_0x439ecd='https://accounts.zoho.com.cn';break;default:_0x439ecd=_0xfa7a('0x26');break;}var _0x323b59={'method':_0xfa7a('0x27'),'uri':_0x439ecd+_0xfa7a('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x56bf80[_0xfa7a('0x19')],'client_secret':_0x56bf80[_0xfa7a('0xe')],'redirect_uri':_0x56bf80[_0xfa7a('0xd')],'code':_0x56bf80[_0xfa7a('0xf')]},'headers':{'Content-Type':_0xfa7a('0x1a')}};return rp(_0x323b59)['then'](function(_0x465ef1){var _0x3e0e2a=JSON['parse'](_0x465ef1);if(_0x3e0e2a[_0xfa7a('0x1c')]){_0x56bf80['refreshToken']=_0x3e0e2a[_0xfa7a('0x1c')];logger[_0xfa7a('0x1e')](util[_0xfa7a('0x23')](_0xfa7a('0x1f'),_0x56bf80['name'],_0x56bf80['id']));}else{logger['error'](util[_0xfa7a('0x23')](_0xfa7a('0x21'),_0x56bf80[_0xfa7a('0x28')],_0x56bf80['id']),util[_0xfa7a('0x24')](_0x3e0e2a,{'showHidden':![],'depth':null}));}return _0x55eb38(null,_0x622c2b);})[_0xfa7a('0x22')](function(_0x13cc31){logger['error'](util[_0xfa7a('0x23')](_0xfa7a('0x21'),_0x56bf80['name'],_0x56bf80['id']),util[_0xfa7a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x55eb38(_0x13cc31);});}else{return _0x55eb38(null,_0x622c2b);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index cf16b2f..c42c7c9 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 _0xd301=['options','where','attributes','limit','include','map','model','ShowZohoAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0xd1dd2e,_0x1f9321){var _0x51467e=function(_0x598f6b){while(--_0x598f6b){_0xd1dd2e['push'](_0xd1dd2e['shift']());}};_0x51467e(++_0x1f9321);}(_0xd301,0x145));var _0x1d30=function(_0x3252b1,_0x54e32d){_0x3252b1=_0x3252b1-0x0;var _0x5f189d=_0xd301[_0x3252b1];return _0x5f189d;};'use strict';var _=require(_0x1d30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d30('0x1'));var fs=require('fs');var Redis=require(_0x1d30('0x2'));var db=require(_0x1d30('0x3'))['db'];var utils=require(_0x1d30('0x4'));var logger=require(_0x1d30('0x5'))(_0x1d30('0x6'));var config=require(_0x1d30('0x7'));var jayson=require(_0x1d30('0x8'));var client=jayson[_0x1d30('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fe945,_0x375cee,_0x41e079){return new BPromise(function(_0x54320e,_0x40cb9d){return client[_0x1d30('0xa')](_0x2fe945,_0x41e079)[_0x1d30('0xb')](function(_0x18d077){logger[_0x1d30('0xc')](_0x1d30('0xd'),_0x375cee,_0x1d30('0xe'));logger['debug'](_0x1d30('0xf'),_0x375cee,_0x1d30('0xe'),JSON[_0x1d30('0x10')](_0x18d077));if(_0x18d077['error']){if(_0x18d077[_0x1d30('0x11')][_0x1d30('0x12')]===0x1f4){logger[_0x1d30('0x11')](_0x1d30('0xd'),_0x375cee,_0x18d077[_0x1d30('0x11')][_0x1d30('0x13')]);return _0x40cb9d(_0x18d077[_0x1d30('0x11')][_0x1d30('0x13')]);}logger[_0x1d30('0x11')](_0x1d30('0xd'),_0x375cee,_0x18d077[_0x1d30('0x11')][_0x1d30('0x13')]);return _0x54320e(_0x18d077[_0x1d30('0x11')][_0x1d30('0x13')]);}else{logger[_0x1d30('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x375cee,_0x1d30('0xe'));_0x54320e(_0x18d077[_0x1d30('0x14')][_0x1d30('0x13')]);}})[_0x1d30('0x15')](function(_0x40f4b5){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x375cee,_0x40f4b5);_0x40cb9d(_0x40f4b5);});});}exports[_0x1d30('0x16')]=function(_0x2fb9a9){var _0x1785eb=this;return new Promise(function(_0x2cf80e,_0x26e73a){return db[_0x1d30('0x17')][_0x1d30('0x18')]({'raw':_0x2fb9a9[_0x1d30('0x19')]?_0x2fb9a9[_0x1d30('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2fb9a9[_0x1d30('0x19')]?_0x2fb9a9[_0x1d30('0x19')][_0x1d30('0x1a')]||null:null,'attributes':_0x2fb9a9[_0x1d30('0x19')]?_0x2fb9a9[_0x1d30('0x19')][_0x1d30('0x1b')]||null:null,'limit':_0x2fb9a9[_0x1d30('0x19')]?_0x2fb9a9[_0x1d30('0x19')][_0x1d30('0x1c')]||null:null,'include':_0x2fb9a9[_0x1d30('0x19')]?_0x2fb9a9[_0x1d30('0x19')][_0x1d30('0x1d')]?_[_0x1d30('0x1e')](_0x2fb9a9[_0x1d30('0x19')][_0x1d30('0x1d')],function(_0x3e20ac){return{'model':db[_0x3e20ac['model']],'as':_0x3e20ac['as'],'attributes':_0x3e20ac[_0x1d30('0x1b')],'include':_0x3e20ac[_0x1d30('0x1d')]?_[_0x1d30('0x1e')](_0x3e20ac[_0x1d30('0x1d')],function(_0x57c66d){return{'model':db[_0x57c66d['model']],'as':_0x57c66d['as'],'attributes':_0x57c66d[_0x1d30('0x1b')],'include':_0x57c66d[_0x1d30('0x1d')]?_[_0x1d30('0x1e')](_0x57c66d['include'],function(_0x135083){return{'model':db[_0x135083[_0x1d30('0x1f')]],'as':_0x135083['as'],'attributes':_0x135083[_0x1d30('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1d30('0xb')](function(_0x35f599){logger[_0x1d30('0xc')](_0x1d30('0x16'),_0x2fb9a9);logger['debug'](_0x1d30('0x16'),_0x2fb9a9,JSON['stringify'](_0x35f599));_0x2cf80e(_0x35f599);})['catch'](function(_0x5cfde8){logger['error'](_0x1d30('0x16'),_0x5cfde8[_0x1d30('0x13')],_0x2fb9a9);_0x26e73a(_0x1785eb[_0x1d30('0x11')](0x1f4,_0x5cfde8[_0x1d30('0x13')]));});});};exports[_0x1d30('0x20')]=function(_0x319dd0){var _0x5e45ec=this;return new Promise(function(_0x2ca32f,_0xac2396){return db['ZohoAccount'][_0x1d30('0x21')]({'raw':_0x319dd0[_0x1d30('0x19')]?_0x319dd0[_0x1d30('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x319dd0[_0x1d30('0x19')]?_0x319dd0[_0x1d30('0x19')]['where']||null:null,'attributes':_0x319dd0[_0x1d30('0x19')]?_0x319dd0['options'][_0x1d30('0x1b')]||null:null,'include':_0x319dd0[_0x1d30('0x19')]?_0x319dd0['options']['include']?_[_0x1d30('0x1e')](_0x319dd0[_0x1d30('0x19')][_0x1d30('0x1d')],function(_0x22765f){return{'model':db[_0x22765f['model']],'as':_0x22765f['as'],'attributes':_0x22765f['attributes'],'include':_0x22765f['include']?_['map'](_0x22765f[_0x1d30('0x1d')],function(_0xb9f76c){return{'model':db[_0xb9f76c[_0x1d30('0x1f')]],'as':_0xb9f76c['as'],'attributes':_0xb9f76c[_0x1d30('0x1b')],'include':_0xb9f76c[_0x1d30('0x1d')]?_[_0x1d30('0x1e')](_0xb9f76c['include'],function(_0x19f408){return{'model':db[_0x19f408['model']],'as':_0x19f408['as'],'attributes':_0x19f408[_0x1d30('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1d30('0xb')](function(_0x4227c9){logger['info']('ShowZohoAccount',_0x319dd0);logger[_0x1d30('0x22')](_0x1d30('0x20'),_0x319dd0,JSON['stringify'](_0x4227c9));_0x2ca32f(_0x4227c9);})[_0x1d30('0x15')](function(_0x512bfd){logger[_0x1d30('0x11')](_0x1d30('0x20'),_0x512bfd[_0x1d30('0x13')],_0x319dd0);_0xac2396(_0x5e45ec[_0x1d30('0x11')](0x1f4,_0x512bfd['message']));});});}; \ No newline at end of file +var _0x14a0=['limit','include','model','map','find','ShowZohoAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes'];(function(_0x123876,_0x322dc8){var _0xefb957=function(_0x5582cc){while(--_0x5582cc){_0x123876['push'](_0x123876['shift']());}};_0xefb957(++_0x322dc8);}(_0x14a0,0x8e));var _0x014a=function(_0x561025,_0xa3e8d2){_0x561025=_0x561025-0x0;var _0x162c11=_0x14a0[_0x561025];return _0x162c11;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetZohoAccount',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowZohoAccount']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowZohoAccount',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 91a97ff..30b74c4 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 _0x8057=['isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x24f6f7,_0x41b132){var _0x214fec=function(_0x945ac){while(--_0x945ac){_0x24f6f7['push'](_0x24f6f7['shift']());}};_0x214fec(++_0x41b132);}(_0x8057,0x97));var _0x7805=function(_0x10f614,_0x1c45ef){_0x10f614=_0x10f614-0x0;var _0x379e92=_0x8057[_0x10f614];return _0x379e92;};'use strict';var multer=require(_0x7805('0x0'));var util=require(_0x7805('0x1'));var path=require(_0x7805('0x2'));var timeout=require(_0x7805('0x3'));var express=require(_0x7805('0x4'));var router=express[_0x7805('0x5')]();var fs_extra=require(_0x7805('0x6'));var auth=require(_0x7805('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7805('0x8'));var controller=require(_0x7805('0x9'));router[_0x7805('0xa')]('/',auth[_0x7805('0xb')](),controller[_0x7805('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7805('0xd')]);router[_0x7805('0xa')](_0x7805('0xe'),auth['isAuthenticated'](),controller[_0x7805('0xf')]);router[_0x7805('0xa')](_0x7805('0x10'),auth[_0x7805('0xb')](),controller[_0x7805('0x11')]);router['get'](_0x7805('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x7805('0x13')]('/',auth[_0x7805('0xb')](),controller[_0x7805('0x14')]);router[_0x7805('0x15')](_0x7805('0x16'),auth[_0x7805('0xb')](),controller[_0x7805('0x17')]);router[_0x7805('0x18')](_0x7805('0x16'),auth['isAuthenticated'](),controller[_0x7805('0x19')]);module[_0x7805('0x1a')]=router; \ No newline at end of file +var _0x9ca7=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','delete','destroy','exports'];(function(_0x381d3c,_0x4bc7d0){var _0x12542e=function(_0xc3e0c7){while(--_0xc3e0c7){_0x381d3c['push'](_0x381d3c['shift']());}};_0x12542e(++_0x4bc7d0);}(_0x9ca7,0x93));var _0x79ca=function(_0x37f5e4,_0xc6e1d6){_0x37f5e4=_0x37f5e4-0x0;var _0x463310=_0x9ca7[_0x37f5e4];return _0x463310;};'use strict';var multer=require('multer');var util=require(_0x79ca('0x0'));var path=require(_0x79ca('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x79ca('0x2')]();var fs_extra=require(_0x79ca('0x3'));var auth=require(_0x79ca('0x4'));var interaction=require(_0x79ca('0x5'));var config=require(_0x79ca('0x6'));var controller=require(_0x79ca('0x7'));router[_0x79ca('0x8')]('/',auth[_0x79ca('0x9')](),controller[_0x79ca('0xa')]);router['get'](_0x79ca('0xb'),auth[_0x79ca('0x9')](),controller['show']);router[_0x79ca('0x8')](_0x79ca('0xc'),auth[_0x79ca('0x9')](),controller[_0x79ca('0xd')]);router[_0x79ca('0x8')]('/:id/subjects',auth[_0x79ca('0x9')](),controller[_0x79ca('0xe')]);router['get'](_0x79ca('0xf'),auth[_0x79ca('0x9')](),controller['getDescriptions']);router[_0x79ca('0x10')]('/',auth[_0x79ca('0x9')](),controller[_0x79ca('0x11')]);router['put'](_0x79ca('0xb'),auth[_0x79ca('0x9')](),controller['update']);router[_0x79ca('0x12')](_0x79ca('0xb'),auth[_0x79ca('0x9')](),controller[_0x79ca('0x13')]);module[_0x79ca('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6c694c1..be0a055 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 _0x20ec=['exports','STRING','ENUM','nothing','lead','contact_lead','contact','sequelize'];(function(_0x50a6fa,_0x32d2aa){var _0xcd1b83=function(_0x1c1d96){while(--_0x1c1d96){_0x50a6fa['push'](_0x50a6fa['shift']());}};_0xcd1b83(++_0x32d2aa);}(_0x20ec,0x12f));var _0xc20e=function(_0x211b9c,_0x3e4a38){_0x211b9c=_0x211b9c-0x0;var _0x5be03d=_0x20ec[_0x211b9c];return _0x5be03d;};'use strict';var Sequelize=require(_0xc20e('0x0'));module[_0xc20e('0x1')]={'name':{'type':Sequelize[_0xc20e('0x2')]},'moduleCreate':{'type':Sequelize[_0xc20e('0x3')]('lead','contact',_0xc20e('0x4')),'defaultValue':_0xc20e('0x5')},'moduleSearch':{'type':Sequelize[_0xc20e('0x3')](_0xc20e('0x6'),_0xc20e('0x7'),_0xc20e('0x5')),'defaultValue':_0xc20e('0x6')},'description':{'type':Sequelize[_0xc20e('0x2')]}}; \ No newline at end of file +var _0xadb8=['ENUM','contact_lead','STRING','lead','contact','nothing'];(function(_0x51be34,_0x24e7d6){var _0x12a2a8=function(_0x571b95){while(--_0x571b95){_0x51be34['push'](_0x51be34['shift']());}};_0x12a2a8(++_0x24e7d6);}(_0xadb8,0x1d0));var _0x8adb=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xadb8[_0x358806];return _0x19fdcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8adb('0x0')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x8adb('0x1'),_0x8adb('0x2'),_0x8adb('0x3')),'defaultValue':_0x8adb('0x1')},'moduleSearch':{'type':Sequelize[_0x8adb('0x4')](_0x8adb('0x5'),_0x8adb('0x2'),'lead'),'defaultValue':_0x8adb('0x5')},'description':{'type':Sequelize[_0x8adb('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 221a507..00432e0 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 _0x97c2=['catch','create','body','findOne','ZohoField','getFields','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','apply','reject','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','ZohoConfiguration','findAll','rows','show','params','model','includeAll','find'];(function(_0x390143,_0x2b54ac){var _0x11361b=function(_0x3666c3){while(--_0x3666c3){_0x390143['push'](_0x390143['shift']());}};_0x11361b(++_0x2b54ac);}(_0x97c2,0x138));var _0x297c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x97c2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x297c('0x0'));var rimraf=require(_0x297c('0x1'));var zipdir=require(_0x297c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x297c('0x3'));var moment=require(_0x297c('0x4'));var BPromise=require(_0x297c('0x5'));var Mustache=require('mustache');var util=require(_0x297c('0x6'));var path=require(_0x297c('0x7'));var sox=require(_0x297c('0x8'));var csv=require(_0x297c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x297c('0xa'));var _=require('lodash');var squel=require(_0x297c('0xb'));var crypto=require(_0x297c('0xc'));var jsforce=require(_0x297c('0xd'));var deskjs=require(_0x297c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x297c('0xf'));var Papa=require(_0x297c('0x10'));var Redis=require(_0x297c('0x11'));var authService=require(_0x297c('0x12'));var qs=require(_0x297c('0x13'));var as=require(_0x297c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x297c('0x15'));var utils=require(_0x297c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x297c('0x17'));var db=require(_0x297c('0x18'))['db'];function respondWithStatusCode(_0x41efdd,_0x17cc6a){_0x17cc6a=_0x17cc6a||0xcc;return function(_0x473a66){if(_0x473a66){return _0x41efdd[_0x297c('0x19')](_0x17cc6a);}return _0x41efdd[_0x297c('0x1a')](_0x17cc6a)[_0x297c('0x1b')]();};}function respondWithResult(_0x269247,_0x233028){_0x233028=_0x233028||0xc8;return function(_0x5e65f2){if(_0x5e65f2){return _0x269247['status'](_0x233028)['json'](_0x5e65f2);}};}function respondWithFilteredResult(_0x1e787c,_0x1d9ca6){return function(_0x20fd6b){if(_0x20fd6b){var _0x1545a0=typeof _0x1d9ca6[_0x297c('0x1c')]===_0x297c('0x1d')&&typeof _0x1d9ca6['limit']===_0x297c('0x1d');var _0x6ac54d=_0x20fd6b[_0x297c('0x1e')];var _0x34b4d5=_0x1545a0?0x0:_0x1d9ca6[_0x297c('0x1c')];var _0x2d884a=_0x1545a0?_0x20fd6b[_0x297c('0x1e')]:_0x1d9ca6[_0x297c('0x1c')]+_0x1d9ca6[_0x297c('0x1f')];var _0x424f9d;if(_0x2d884a>=_0x6ac54d){_0x2d884a=_0x6ac54d;_0x424f9d=0xc8;}else{_0x424f9d=0xce;}_0x1e787c['status'](_0x424f9d);return _0x1e787c['set']('Content-Range',_0x34b4d5+'-'+_0x2d884a+'/'+_0x6ac54d)['json'](_0x20fd6b);}return null;};}function patchUpdates(_0x317db7){return function(_0xd55458){try{jsonpatch[_0x297c('0x20')](_0xd55458,_0x317db7,!![]);}catch(_0x5f2ee3){return BPromise[_0x297c('0x21')](_0x5f2ee3);}return _0xd55458['save']();};}function saveUpdates(_0x200167,_0x5a94b4){return function(_0x59b364){if(_0x59b364){return _0x59b364[_0x297c('0x22')](_0x200167)[_0x297c('0x23')](function(_0x167828){return _0x167828;});}return null;};}function removeEntity(_0x18086b,_0x4151e9){return function(_0x4db9d1){if(_0x4db9d1){return _0x4db9d1[_0x297c('0x24')]()[_0x297c('0x23')](function(){_0x18086b[_0x297c('0x1a')](0xcc)[_0x297c('0x1b')]();});}};}function handleEntityNotFound(_0x3394eb,_0x4970dc){return function(_0x512e9a){if(!_0x512e9a){_0x3394eb[_0x297c('0x19')](0x194);}return _0x512e9a;};}function handleError(_0x4b50b2,_0x13900b){_0x13900b=_0x13900b||0x1f4;return function(_0x3268c8){logger[_0x297c('0x25')](_0x3268c8[_0x297c('0x26')]);if(_0x3268c8[_0x297c('0x27')]){delete _0x3268c8[_0x297c('0x27')];}_0x4b50b2[_0x297c('0x1a')](_0x13900b)['send'](_0x3268c8);};}exports['index']=function(_0xfb9244,_0x1d5c8b){var _0x22e491={},_0x4c3fff={},_0x1c82c6={'count':0x0,'rows':[]};var _0x220e7f=_[_0x297c('0x28')](db['ZohoConfiguration'][_0x297c('0x29')],function(_0x21eef3){return{'name':_0x21eef3[_0x297c('0x2a')],'type':_0x21eef3[_0x297c('0x2b')]['key']};});_0x4c3fff['model']=_[_0x297c('0x28')](_0x220e7f,'name');_0x4c3fff[_0x297c('0x2c')]=_[_0x297c('0x2d')](_0xfb9244[_0x297c('0x2c')]);_0x4c3fff[_0x297c('0x2e')]=_[_0x297c('0x2f')](_0x4c3fff['model'],_0x4c3fff[_0x297c('0x2c')]);_0x22e491[_0x297c('0x30')]=_[_0x297c('0x2f')](_0x4c3fff['model'],qs[_0x297c('0x31')](_0xfb9244['query'][_0x297c('0x31')]));_0x22e491['attributes']=_0x22e491[_0x297c('0x30')][_0x297c('0x32')]?_0x22e491[_0x297c('0x30')]:_0x4c3fff['model'];if(!_0xfb9244[_0x297c('0x2c')]['hasOwnProperty'](_0x297c('0x33'))){_0x22e491[_0x297c('0x1f')]=qs[_0x297c('0x1f')](_0xfb9244[_0x297c('0x2c')][_0x297c('0x1f')]);_0x22e491['offset']=qs[_0x297c('0x1c')](_0xfb9244[_0x297c('0x2c')][_0x297c('0x1c')]);}_0x22e491[_0x297c('0x34')]=qs['sort'](_0xfb9244['query'][_0x297c('0x35')]);_0x22e491['where']=qs[_0x297c('0x2e')](_[_0x297c('0x36')](_0xfb9244['query'],_0x4c3fff[_0x297c('0x2e')]),_0x220e7f);if(_0xfb9244[_0x297c('0x2c')]['filter']){_0x22e491[_0x297c('0x37')]=_[_0x297c('0x38')](_0x22e491[_0x297c('0x37')],{'$or':_[_0x297c('0x28')](_0x220e7f,function(_0x36f1a8){if(_0x36f1a8[_0x297c('0x2b')]!==_0x297c('0x39')){var _0x509b55={};_0x509b55[_0x36f1a8['name']]={'$like':'%'+_0xfb9244[_0x297c('0x2c')][_0x297c('0x3a')]+'%'};return _0x509b55;}})});}_0x22e491=_[_0x297c('0x38')]({},_0x22e491,_0xfb9244[_0x297c('0x3b')]);var _0x3288e8={'where':_0x22e491[_0x297c('0x37')]};return db[_0x297c('0x3c')][_0x297c('0x1e')](_0x3288e8)[_0x297c('0x23')](function(_0x350861){_0x1c82c6[_0x297c('0x1e')]=_0x350861;if(_0xfb9244[_0x297c('0x2c')]['includeAll']){_0x22e491['include']=[{'all':!![]}];}return db[_0x297c('0x3c')][_0x297c('0x3d')](_0x22e491);})[_0x297c('0x23')](function(_0x46b49b){_0x1c82c6[_0x297c('0x3e')]=_0x46b49b;return _0x1c82c6;})[_0x297c('0x23')](respondWithFilteredResult(_0x1d5c8b,_0x22e491))['catch'](handleError(_0x1d5c8b,null));};exports[_0x297c('0x3f')]=function(_0x5aaf8f,_0x160cb7){var _0x2e9079={'raw':![],'where':{'id':_0x5aaf8f[_0x297c('0x40')]['id']}},_0x25cd23={};_0x25cd23['model']=_[_0x297c('0x2d')](db[_0x297c('0x3c')][_0x297c('0x29')]);_0x25cd23[_0x297c('0x2c')]=_[_0x297c('0x2d')](_0x5aaf8f[_0x297c('0x2c')]);_0x25cd23[_0x297c('0x2e')]=_[_0x297c('0x2f')](_0x25cd23['model'],_0x25cd23[_0x297c('0x2c')]);_0x2e9079['attributes']=_['intersection'](_0x25cd23[_0x297c('0x41')],qs[_0x297c('0x31')](_0x5aaf8f[_0x297c('0x2c')][_0x297c('0x31')]));_0x2e9079[_0x297c('0x30')]=_0x2e9079[_0x297c('0x30')][_0x297c('0x32')]?_0x2e9079[_0x297c('0x30')]:_0x25cd23['model'];if(_0x5aaf8f['query'][_0x297c('0x42')]){_0x2e9079['include']=[{'all':!![]}];}_0x2e9079=_[_0x297c('0x38')]({},_0x2e9079,_0x5aaf8f[_0x297c('0x3b')]);return db[_0x297c('0x3c')][_0x297c('0x43')](_0x2e9079)[_0x297c('0x23')](handleEntityNotFound(_0x160cb7,null))[_0x297c('0x23')](respondWithResult(_0x160cb7,null))[_0x297c('0x44')](handleError(_0x160cb7,null));};exports['create']=function(_0x1cf480,_0x1ff8ac){return db['ZohoConfiguration'][_0x297c('0x45')](_0x1cf480[_0x297c('0x46')],{})['then'](respondWithResult(_0x1ff8ac,0xc9))[_0x297c('0x44')](handleError(_0x1ff8ac,null));};exports['update']=function(_0x5b65f9,_0x15f4db){if(_0x5b65f9[_0x297c('0x46')]['id']){delete _0x5b65f9['body']['id'];}return db['ZohoConfiguration'][_0x297c('0x43')]({'where':{'id':_0x5b65f9['params']['id']}})[_0x297c('0x23')](handleEntityNotFound(_0x15f4db,null))[_0x297c('0x23')](saveUpdates(_0x5b65f9[_0x297c('0x46')],null))['then'](respondWithResult(_0x15f4db,null))['catch'](handleError(_0x15f4db,null));};exports[_0x297c('0x24')]=function(_0x36d165,_0x663a16){return db[_0x297c('0x3c')][_0x297c('0x43')]({'where':{'id':_0x36d165[_0x297c('0x40')]['id']}})[_0x297c('0x23')](handleEntityNotFound(_0x663a16,null))['then'](removeEntity(_0x663a16,null))[_0x297c('0x44')](handleError(_0x663a16,null));};exports['getFields']=function(_0x1428fc,_0x5daf39,_0x3abc6f){var _0x5a93c2={};var _0x24de12={};var _0x52fec0;var _0x404987;return db[_0x297c('0x3c')][_0x297c('0x47')]({'where':{'id':_0x1428fc['params']['id']}})[_0x297c('0x23')](handleEntityNotFound(_0x5daf39,null))[_0x297c('0x23')](function(_0x16c550){if(_0x16c550){_0x52fec0=_0x16c550;_0x24de12[_0x297c('0x41')]=_[_0x297c('0x2d')](db[_0x297c('0x48')][_0x297c('0x29')]);_0x24de12[_0x297c('0x2c')]=_[_0x297c('0x2d')](_0x1428fc['query']);_0x24de12['filters']=_[_0x297c('0x2f')](_0x24de12[_0x297c('0x41')],_0x24de12[_0x297c('0x2c')]);_0x5a93c2['attributes']=_[_0x297c('0x2f')](_0x24de12[_0x297c('0x41')],qs[_0x297c('0x31')](_0x1428fc[_0x297c('0x2c')][_0x297c('0x31')]));_0x5a93c2[_0x297c('0x30')]=_0x5a93c2[_0x297c('0x30')][_0x297c('0x32')]?_0x5a93c2[_0x297c('0x30')]:_0x24de12[_0x297c('0x41')];_0x5a93c2[_0x297c('0x34')]=qs[_0x297c('0x35')](_0x1428fc[_0x297c('0x2c')][_0x297c('0x35')]);_0x5a93c2[_0x297c('0x37')]=qs[_0x297c('0x2e')](_[_0x297c('0x36')](_0x1428fc[_0x297c('0x2c')],_0x24de12[_0x297c('0x2e')]));if(_0x1428fc[_0x297c('0x2c')][_0x297c('0x3a')]){_0x5a93c2[_0x297c('0x37')]=_['merge'](_0x5a93c2['where'],{'$or':_['map'](_0x5a93c2[_0x297c('0x30')],function(_0x170d1f){var _0x590644={};_0x590644[_0x170d1f]={'$like':'%'+_0x1428fc[_0x297c('0x2c')]['filter']+'%'};return _0x590644;})});}_0x5a93c2=_[_0x297c('0x38')]({},_0x5a93c2,_0x1428fc['options']);return _0x52fec0[_0x297c('0x49')](_0x5a93c2);}})['then'](function(_0x24e2de){if(_0x24e2de){_0x404987=_0x24e2de[_0x297c('0x32')];if(!_0x1428fc['query']['hasOwnProperty']('nolimit')){_0x5a93c2[_0x297c('0x1f')]=qs[_0x297c('0x1f')](_0x1428fc[_0x297c('0x2c')][_0x297c('0x1f')]);_0x5a93c2[_0x297c('0x1c')]=qs[_0x297c('0x1c')](_0x1428fc[_0x297c('0x2c')]['offset']);}return _0x52fec0[_0x297c('0x49')](_0x5a93c2);}})[_0x297c('0x23')](function(_0x2f10ff){if(_0x2f10ff){return _0x2f10ff?{'count':_0x404987,'rows':_0x2f10ff}:null;}})['then'](respondWithResult(_0x5daf39,null))[_0x297c('0x44')](handleError(_0x5daf39,null));};exports['getSubjects']=function(_0x215650,_0x5767b3,_0x15ef03){var _0x1460e5={};var _0x35806d={};var _0x4d8424;var _0x285116;return db['ZohoConfiguration'][_0x297c('0x47')]({'where':{'id':_0x215650[_0x297c('0x40')]['id']}})[_0x297c('0x23')](handleEntityNotFound(_0x5767b3,null))[_0x297c('0x23')](function(_0x1ae328){if(_0x1ae328){_0x4d8424=_0x1ae328;_0x35806d['model']=_[_0x297c('0x2d')](db['ZohoField'][_0x297c('0x29')]);_0x35806d[_0x297c('0x2c')]=_[_0x297c('0x2d')](_0x215650['query']);_0x35806d[_0x297c('0x2e')]=_[_0x297c('0x2f')](_0x35806d[_0x297c('0x41')],_0x35806d[_0x297c('0x2c')]);_0x1460e5['attributes']=_[_0x297c('0x2f')](_0x35806d['model'],qs[_0x297c('0x31')](_0x215650[_0x297c('0x2c')]['fields']));_0x1460e5[_0x297c('0x30')]=_0x1460e5[_0x297c('0x30')][_0x297c('0x32')]?_0x1460e5['attributes']:_0x35806d[_0x297c('0x41')];_0x1460e5[_0x297c('0x34')]=qs['sort'](_0x215650[_0x297c('0x2c')][_0x297c('0x35')]);_0x1460e5[_0x297c('0x37')]=qs[_0x297c('0x2e')](_[_0x297c('0x36')](_0x215650[_0x297c('0x2c')],_0x35806d[_0x297c('0x2e')]));if(_0x215650[_0x297c('0x2c')][_0x297c('0x3a')]){_0x1460e5['where']=_[_0x297c('0x38')](_0x1460e5[_0x297c('0x37')],{'$or':_['map'](_0x1460e5[_0x297c('0x30')],function(_0x5a0fc8){var _0x5f2293={};_0x5f2293[_0x5a0fc8]={'$like':'%'+_0x215650['query'][_0x297c('0x3a')]+'%'};return _0x5f2293;})});}_0x1460e5=_[_0x297c('0x38')]({},_0x1460e5,_0x215650[_0x297c('0x3b')]);return _0x4d8424['getSubjects'](_0x1460e5);}})[_0x297c('0x23')](function(_0x190534){if(_0x190534){_0x285116=_0x190534[_0x297c('0x32')];if(!_0x215650[_0x297c('0x2c')][_0x297c('0x4a')](_0x297c('0x33'))){_0x1460e5['limit']=qs['limit'](_0x215650[_0x297c('0x2c')][_0x297c('0x1f')]);_0x1460e5[_0x297c('0x1c')]=qs['offset'](_0x215650[_0x297c('0x2c')][_0x297c('0x1c')]);}return _0x4d8424['getSubjects'](_0x1460e5);}})[_0x297c('0x23')](function(_0x3b6c5c){if(_0x3b6c5c){return _0x3b6c5c?{'count':_0x285116,'rows':_0x3b6c5c}:null;}})[_0x297c('0x23')](respondWithResult(_0x5767b3,null))['catch'](handleError(_0x5767b3,null));};exports[_0x297c('0x4b')]=function(_0x146e0b,_0x304914,_0x597811){var _0x39bf38={};var _0x5836c5={};var _0x5964bf;var _0x40d107;return db['ZohoConfiguration'][_0x297c('0x47')]({'where':{'id':_0x146e0b[_0x297c('0x40')]['id']}})[_0x297c('0x23')](handleEntityNotFound(_0x304914,null))[_0x297c('0x23')](function(_0x7497c0){if(_0x7497c0){_0x5964bf=_0x7497c0;_0x5836c5[_0x297c('0x41')]=_['keys'](db[_0x297c('0x48')]['rawAttributes']);_0x5836c5[_0x297c('0x2c')]=_[_0x297c('0x2d')](_0x146e0b['query']);_0x5836c5[_0x297c('0x2e')]=_[_0x297c('0x2f')](_0x5836c5[_0x297c('0x41')],_0x5836c5[_0x297c('0x2c')]);_0x39bf38[_0x297c('0x30')]=_[_0x297c('0x2f')](_0x5836c5[_0x297c('0x41')],qs[_0x297c('0x31')](_0x146e0b[_0x297c('0x2c')][_0x297c('0x31')]));_0x39bf38[_0x297c('0x30')]=_0x39bf38[_0x297c('0x30')][_0x297c('0x32')]?_0x39bf38[_0x297c('0x30')]:_0x5836c5[_0x297c('0x41')];_0x39bf38[_0x297c('0x34')]=qs[_0x297c('0x35')](_0x146e0b[_0x297c('0x2c')][_0x297c('0x35')]);_0x39bf38[_0x297c('0x37')]=qs[_0x297c('0x2e')](_[_0x297c('0x36')](_0x146e0b[_0x297c('0x2c')],_0x5836c5[_0x297c('0x2e')]));if(_0x146e0b[_0x297c('0x2c')]['filter']){_0x39bf38[_0x297c('0x37')]=_[_0x297c('0x38')](_0x39bf38['where'],{'$or':_[_0x297c('0x28')](_0x39bf38['attributes'],function(_0x273d0d){var _0x565a71={};_0x565a71[_0x273d0d]={'$like':'%'+_0x146e0b[_0x297c('0x2c')][_0x297c('0x3a')]+'%'};return _0x565a71;})});}_0x39bf38=_['merge']({},_0x39bf38,_0x146e0b[_0x297c('0x3b')]);return _0x5964bf['getDescriptions'](_0x39bf38);}})['then'](function(_0x18cc4c){if(_0x18cc4c){_0x40d107=_0x18cc4c[_0x297c('0x32')];if(!_0x146e0b[_0x297c('0x2c')][_0x297c('0x4a')](_0x297c('0x33'))){_0x39bf38['limit']=qs[_0x297c('0x1f')](_0x146e0b[_0x297c('0x2c')][_0x297c('0x1f')]);_0x39bf38['offset']=qs['offset'](_0x146e0b[_0x297c('0x2c')][_0x297c('0x1c')]);}return _0x5964bf[_0x297c('0x4b')](_0x39bf38);}})['then'](function(_0x324d71){if(_0x324d71){return _0x324d71?{'count':_0x40d107,'rows':_0x324d71}:null;}})[_0x297c('0x23')](respondWithResult(_0x304914,null))[_0x297c('0x44')](handleError(_0x304914,null));}; \ No newline at end of file +var _0xd116=['../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','pick','where','merge','filter','options','include','ZohoConfiguration','rows','show','keys','rawAttributes','includeAll','find','create','catch','body','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd116,0x165));var _0x6d11=function(_0xcbbe61,_0x4e3a05){_0xcbbe61=_0xcbbe61-0x0;var _0x3ce57e=_0xd116[_0xcbbe61];return _0x3ce57e;};'use strict';var emlformat=require(_0x6d11('0x0'));var rimraf=require(_0x6d11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d11('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6d11('0x3'));var Mustache=require(_0x6d11('0x4'));var util=require('util');var path=require(_0x6d11('0x5'));var sox=require(_0x6d11('0x6'));var csv=require('to-csv');var ejs=require(_0x6d11('0x7'));var fs=require('fs');var fs_extra=require(_0x6d11('0x8'));var _=require(_0x6d11('0x9'));var squel=require(_0x6d11('0xa'));var crypto=require(_0x6d11('0xb'));var jsforce=require(_0x6d11('0xc'));var deskjs=require(_0x6d11('0xd'));var toCsv=require(_0x6d11('0xe'));var querystring=require(_0x6d11('0xf'));var Papa=require(_0x6d11('0x10'));var Redis=require(_0x6d11('0x11'));var authService=require(_0x6d11('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6d11('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d11('0x14'))(_0x6d11('0x15'));var utils=require('../../config/utils');var config=require(_0x6d11('0x16'));var licenseUtil=require(_0x6d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a08af,_0x2025ef){_0x2025ef=_0x2025ef||0xcc;return function(_0x3113f2){if(_0x3113f2){return _0x4a08af[_0x6d11('0x18')](_0x2025ef);}return _0x4a08af[_0x6d11('0x19')](_0x2025ef)['end']();};}function respondWithResult(_0x95be08,_0x156b80){_0x156b80=_0x156b80||0xc8;return function(_0x20da04){if(_0x20da04){return _0x95be08[_0x6d11('0x19')](_0x156b80)[_0x6d11('0x1a')](_0x20da04);}};}function respondWithFilteredResult(_0x48f4a1,_0x117b3d){return function(_0x10328f){if(_0x10328f){var _0x1e5d6d=typeof _0x117b3d['offset']===_0x6d11('0x1b')&&typeof _0x117b3d[_0x6d11('0x1c')]==='undefined';var _0x290601=_0x10328f[_0x6d11('0x1d')];var _0x3a63c3=_0x1e5d6d?0x0:_0x117b3d[_0x6d11('0x1e')];var _0x1b33c0=_0x1e5d6d?_0x10328f[_0x6d11('0x1d')]:_0x117b3d[_0x6d11('0x1e')]+_0x117b3d[_0x6d11('0x1c')];var _0x25b90c;if(_0x1b33c0>=_0x290601){_0x1b33c0=_0x290601;_0x25b90c=0xc8;}else{_0x25b90c=0xce;}_0x48f4a1[_0x6d11('0x19')](_0x25b90c);return _0x48f4a1['set'](_0x6d11('0x1f'),_0x3a63c3+'-'+_0x1b33c0+'/'+_0x290601)['json'](_0x10328f);}return null;};}function patchUpdates(_0x295756){return function(_0x171563){try{jsonpatch[_0x6d11('0x20')](_0x171563,_0x295756,!![]);}catch(_0x6a72b4){return BPromise['reject'](_0x6a72b4);}return _0x171563[_0x6d11('0x21')]();};}function saveUpdates(_0x4f2dab,_0xfb77db){return function(_0x34548b){if(_0x34548b){return _0x34548b[_0x6d11('0x22')](_0x4f2dab)[_0x6d11('0x23')](function(_0x4dc623){return _0x4dc623;});}return null;};}function removeEntity(_0x45375f,_0x24cc26){return function(_0x5831c2){if(_0x5831c2){return _0x5831c2[_0x6d11('0x24')]()['then'](function(){_0x45375f[_0x6d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159302,_0x3c9309){return function(_0xf5bba1){if(!_0xf5bba1){_0x159302[_0x6d11('0x18')](0x194);}return _0xf5bba1;};}function handleError(_0x14559a,_0x260502){_0x260502=_0x260502||0x1f4;return function(_0x3f314c){logger[_0x6d11('0x25')](_0x3f314c[_0x6d11('0x26')]);if(_0x3f314c[_0x6d11('0x27')]){delete _0x3f314c['name'];}_0x14559a[_0x6d11('0x19')](_0x260502)['send'](_0x3f314c);};}exports[_0x6d11('0x28')]=function(_0x335b2d,_0x1fa758){var _0x37a40e={},_0x299178={},_0x4e75cf={'count':0x0,'rows':[]};var _0x35bd5e=_[_0x6d11('0x29')](db['ZohoConfiguration']['rawAttributes'],function(_0x2c59f7){return{'name':_0x2c59f7['fieldName'],'type':_0x2c59f7['type'][_0x6d11('0x2a')]};});_0x299178['model']=_['map'](_0x35bd5e,'name');_0x299178[_0x6d11('0x2b')]=_['keys'](_0x335b2d[_0x6d11('0x2b')]);_0x299178[_0x6d11('0x2c')]=_['intersection'](_0x299178['model'],_0x299178[_0x6d11('0x2b')]);_0x37a40e[_0x6d11('0x2d')]=_[_0x6d11('0x2e')](_0x299178[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x335b2d[_0x6d11('0x2b')]['fields']));_0x37a40e[_0x6d11('0x2d')]=_0x37a40e[_0x6d11('0x2d')][_0x6d11('0x31')]?_0x37a40e['attributes']:_0x299178[_0x6d11('0x2f')];if(!_0x335b2d[_0x6d11('0x2b')]['hasOwnProperty'](_0x6d11('0x32'))){_0x37a40e[_0x6d11('0x1c')]=qs[_0x6d11('0x1c')](_0x335b2d['query'][_0x6d11('0x1c')]);_0x37a40e[_0x6d11('0x1e')]=qs[_0x6d11('0x1e')](_0x335b2d[_0x6d11('0x2b')]['offset']);}_0x37a40e[_0x6d11('0x33')]=qs[_0x6d11('0x34')](_0x335b2d[_0x6d11('0x2b')]['sort']);_0x37a40e['where']=qs[_0x6d11('0x2c')](_[_0x6d11('0x35')](_0x335b2d[_0x6d11('0x2b')],_0x299178[_0x6d11('0x2c')]),_0x35bd5e);if(_0x335b2d[_0x6d11('0x2b')]['filter']){_0x37a40e[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x37a40e[_0x6d11('0x36')],{'$or':_[_0x6d11('0x29')](_0x35bd5e,function(_0x257033){if(_0x257033['type']!=='VIRTUAL'){var _0x426065={};_0x426065[_0x257033[_0x6d11('0x27')]]={'$like':'%'+_0x335b2d[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x426065;}})});}_0x37a40e=_[_0x6d11('0x37')]({},_0x37a40e,_0x335b2d[_0x6d11('0x39')]);var _0x514bb1={'where':_0x37a40e[_0x6d11('0x36')]};return db['ZohoConfiguration']['count'](_0x514bb1)['then'](function(_0x47e303){_0x4e75cf[_0x6d11('0x1d')]=_0x47e303;if(_0x335b2d['query']['includeAll']){_0x37a40e[_0x6d11('0x3a')]=[{'all':!![]}];}return db[_0x6d11('0x3b')]['findAll'](_0x37a40e);})[_0x6d11('0x23')](function(_0x5cf10b){_0x4e75cf[_0x6d11('0x3c')]=_0x5cf10b;return _0x4e75cf;})[_0x6d11('0x23')](respondWithFilteredResult(_0x1fa758,_0x37a40e))['catch'](handleError(_0x1fa758,null));};exports[_0x6d11('0x3d')]=function(_0x1c005e,_0x4562e5){var _0xb1fa91={'raw':![],'where':{'id':_0x1c005e['params']['id']}},_0x1b6b19={};_0x1b6b19[_0x6d11('0x2f')]=_[_0x6d11('0x3e')](db[_0x6d11('0x3b')][_0x6d11('0x3f')]);_0x1b6b19[_0x6d11('0x2b')]=_[_0x6d11('0x3e')](_0x1c005e['query']);_0x1b6b19[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x1b6b19[_0x6d11('0x2f')],_0x1b6b19[_0x6d11('0x2b')]);_0xb1fa91['attributes']=_[_0x6d11('0x2e')](_0x1b6b19[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x1c005e['query']['fields']));_0xb1fa91[_0x6d11('0x2d')]=_0xb1fa91[_0x6d11('0x2d')][_0x6d11('0x31')]?_0xb1fa91[_0x6d11('0x2d')]:_0x1b6b19[_0x6d11('0x2f')];if(_0x1c005e[_0x6d11('0x2b')][_0x6d11('0x40')]){_0xb1fa91['include']=[{'all':!![]}];}_0xb1fa91=_['merge']({},_0xb1fa91,_0x1c005e[_0x6d11('0x39')]);return db[_0x6d11('0x3b')][_0x6d11('0x41')](_0xb1fa91)[_0x6d11('0x23')](handleEntityNotFound(_0x4562e5,null))[_0x6d11('0x23')](respondWithResult(_0x4562e5,null))['catch'](handleError(_0x4562e5,null));};exports[_0x6d11('0x42')]=function(_0x9bc79,_0x5df1c4){return db[_0x6d11('0x3b')][_0x6d11('0x42')](_0x9bc79['body'],{})[_0x6d11('0x23')](respondWithResult(_0x5df1c4,0xc9))[_0x6d11('0x43')](handleError(_0x5df1c4,null));};exports[_0x6d11('0x22')]=function(_0x46e46b,_0x3b218b){if(_0x46e46b[_0x6d11('0x44')]['id']){delete _0x46e46b[_0x6d11('0x44')]['id'];}return db[_0x6d11('0x3b')][_0x6d11('0x41')]({'where':{'id':_0x46e46b[_0x6d11('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b218b,null))['then'](saveUpdates(_0x46e46b[_0x6d11('0x44')],null))[_0x6d11('0x23')](respondWithResult(_0x3b218b,null))[_0x6d11('0x43')](handleError(_0x3b218b,null));};exports[_0x6d11('0x24')]=function(_0x1f37b4,_0x55dfa2){return db['ZohoConfiguration']['find']({'where':{'id':_0x1f37b4[_0x6d11('0x45')]['id']}})['then'](handleEntityNotFound(_0x55dfa2,null))[_0x6d11('0x23')](removeEntity(_0x55dfa2,null))[_0x6d11('0x43')](handleError(_0x55dfa2,null));};exports[_0x6d11('0x46')]=function(_0x5336c9,_0x13cf80,_0x1c9c53){var _0x8a62ac={};var _0x1be78e={};var _0x4e1965;var _0x16d48a;return db[_0x6d11('0x3b')][_0x6d11('0x47')]({'where':{'id':_0x5336c9[_0x6d11('0x45')]['id']}})[_0x6d11('0x23')](handleEntityNotFound(_0x13cf80,null))[_0x6d11('0x23')](function(_0xf5d8c4){if(_0xf5d8c4){_0x4e1965=_0xf5d8c4;_0x1be78e[_0x6d11('0x2f')]=_[_0x6d11('0x3e')](db[_0x6d11('0x48')]['rawAttributes']);_0x1be78e[_0x6d11('0x2b')]=_[_0x6d11('0x3e')](_0x5336c9[_0x6d11('0x2b')]);_0x1be78e[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x1be78e['model'],_0x1be78e[_0x6d11('0x2b')]);_0x8a62ac[_0x6d11('0x2d')]=_[_0x6d11('0x2e')](_0x1be78e[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x5336c9[_0x6d11('0x2b')]['fields']));_0x8a62ac['attributes']=_0x8a62ac['attributes']['length']?_0x8a62ac['attributes']:_0x1be78e[_0x6d11('0x2f')];_0x8a62ac[_0x6d11('0x33')]=qs[_0x6d11('0x34')](_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x34')]);_0x8a62ac[_0x6d11('0x36')]=qs['filters'](_['pick'](_0x5336c9[_0x6d11('0x2b')],_0x1be78e[_0x6d11('0x2c')]));if(_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x38')]){_0x8a62ac[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x8a62ac[_0x6d11('0x36')],{'$or':_['map'](_0x8a62ac[_0x6d11('0x2d')],function(_0x21e195){var _0x5e1555={};_0x5e1555[_0x21e195]={'$like':'%'+_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x5e1555;})});}_0x8a62ac=_[_0x6d11('0x37')]({},_0x8a62ac,_0x5336c9[_0x6d11('0x39')]);return _0x4e1965['getFields'](_0x8a62ac);}})[_0x6d11('0x23')](function(_0x202c84){if(_0x202c84){_0x16d48a=_0x202c84[_0x6d11('0x31')];if(!_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x49')](_0x6d11('0x32'))){_0x8a62ac[_0x6d11('0x1c')]=qs[_0x6d11('0x1c')](_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x1c')]);_0x8a62ac[_0x6d11('0x1e')]=qs[_0x6d11('0x1e')](_0x5336c9[_0x6d11('0x2b')][_0x6d11('0x1e')]);}return _0x4e1965[_0x6d11('0x46')](_0x8a62ac);}})[_0x6d11('0x23')](function(_0x2450d3){if(_0x2450d3){return _0x2450d3?{'count':_0x16d48a,'rows':_0x2450d3}:null;}})[_0x6d11('0x23')](respondWithResult(_0x13cf80,null))[_0x6d11('0x43')](handleError(_0x13cf80,null));};exports['getSubjects']=function(_0x17ec1f,_0x358ff2,_0x103537){var _0x294c6c={};var _0x5085bb={};var _0x3ccf2e;var _0x14fd7d;return db[_0x6d11('0x3b')][_0x6d11('0x47')]({'where':{'id':_0x17ec1f[_0x6d11('0x45')]['id']}})[_0x6d11('0x23')](handleEntityNotFound(_0x358ff2,null))['then'](function(_0x52efe2){if(_0x52efe2){_0x3ccf2e=_0x52efe2;_0x5085bb['model']=_[_0x6d11('0x3e')](db[_0x6d11('0x48')][_0x6d11('0x3f')]);_0x5085bb[_0x6d11('0x2b')]=_['keys'](_0x17ec1f[_0x6d11('0x2b')]);_0x5085bb[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x5085bb[_0x6d11('0x2f')],_0x5085bb['query']);_0x294c6c[_0x6d11('0x2d')]=_[_0x6d11('0x2e')](_0x5085bb[_0x6d11('0x2f')],qs[_0x6d11('0x30')](_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x30')]));_0x294c6c['attributes']=_0x294c6c['attributes'][_0x6d11('0x31')]?_0x294c6c[_0x6d11('0x2d')]:_0x5085bb[_0x6d11('0x2f')];_0x294c6c[_0x6d11('0x33')]=qs['sort'](_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x34')]);_0x294c6c[_0x6d11('0x36')]=qs[_0x6d11('0x2c')](_[_0x6d11('0x35')](_0x17ec1f[_0x6d11('0x2b')],_0x5085bb[_0x6d11('0x2c')]));if(_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x38')]){_0x294c6c[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x294c6c[_0x6d11('0x36')],{'$or':_['map'](_0x294c6c['attributes'],function(_0x29c694){var _0x4faea4={};_0x4faea4[_0x29c694]={'$like':'%'+_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x4faea4;})});}_0x294c6c=_[_0x6d11('0x37')]({},_0x294c6c,_0x17ec1f[_0x6d11('0x39')]);return _0x3ccf2e['getSubjects'](_0x294c6c);}})[_0x6d11('0x23')](function(_0x516205){if(_0x516205){_0x14fd7d=_0x516205[_0x6d11('0x31')];if(!_0x17ec1f[_0x6d11('0x2b')][_0x6d11('0x49')](_0x6d11('0x32'))){_0x294c6c['limit']=qs[_0x6d11('0x1c')](_0x17ec1f[_0x6d11('0x2b')]['limit']);_0x294c6c[_0x6d11('0x1e')]=qs[_0x6d11('0x1e')](_0x17ec1f[_0x6d11('0x2b')]['offset']);}return _0x3ccf2e[_0x6d11('0x4a')](_0x294c6c);}})['then'](function(_0x53fd7b){if(_0x53fd7b){return _0x53fd7b?{'count':_0x14fd7d,'rows':_0x53fd7b}:null;}})['then'](respondWithResult(_0x358ff2,null))[_0x6d11('0x43')](handleError(_0x358ff2,null));};exports[_0x6d11('0x4b')]=function(_0x56f319,_0x2992a2,_0x591703){var _0x4b51bb={};var _0x4682ee={};var _0xe71cc0;var _0x779a7f;return db[_0x6d11('0x3b')]['findOne']({'where':{'id':_0x56f319[_0x6d11('0x45')]['id']}})[_0x6d11('0x23')](handleEntityNotFound(_0x2992a2,null))[_0x6d11('0x23')](function(_0x56fd12){if(_0x56fd12){_0xe71cc0=_0x56fd12;_0x4682ee[_0x6d11('0x2f')]=_[_0x6d11('0x3e')](db['ZohoField'][_0x6d11('0x3f')]);_0x4682ee[_0x6d11('0x2b')]=_[_0x6d11('0x3e')](_0x56f319['query']);_0x4682ee[_0x6d11('0x2c')]=_[_0x6d11('0x2e')](_0x4682ee[_0x6d11('0x2f')],_0x4682ee[_0x6d11('0x2b')]);_0x4b51bb['attributes']=_[_0x6d11('0x2e')](_0x4682ee['model'],qs[_0x6d11('0x30')](_0x56f319[_0x6d11('0x2b')][_0x6d11('0x30')]));_0x4b51bb[_0x6d11('0x2d')]=_0x4b51bb[_0x6d11('0x2d')][_0x6d11('0x31')]?_0x4b51bb['attributes']:_0x4682ee['model'];_0x4b51bb[_0x6d11('0x33')]=qs['sort'](_0x56f319[_0x6d11('0x2b')][_0x6d11('0x34')]);_0x4b51bb[_0x6d11('0x36')]=qs[_0x6d11('0x2c')](_[_0x6d11('0x35')](_0x56f319[_0x6d11('0x2b')],_0x4682ee['filters']));if(_0x56f319['query'][_0x6d11('0x38')]){_0x4b51bb[_0x6d11('0x36')]=_[_0x6d11('0x37')](_0x4b51bb[_0x6d11('0x36')],{'$or':_['map'](_0x4b51bb[_0x6d11('0x2d')],function(_0x477174){var _0x5aa48e={};_0x5aa48e[_0x477174]={'$like':'%'+_0x56f319[_0x6d11('0x2b')][_0x6d11('0x38')]+'%'};return _0x5aa48e;})});}_0x4b51bb=_['merge']({},_0x4b51bb,_0x56f319[_0x6d11('0x39')]);return _0xe71cc0[_0x6d11('0x4b')](_0x4b51bb);}})[_0x6d11('0x23')](function(_0x432a5b){if(_0x432a5b){_0x779a7f=_0x432a5b['length'];if(!_0x56f319[_0x6d11('0x2b')][_0x6d11('0x49')](_0x6d11('0x32'))){_0x4b51bb[_0x6d11('0x1c')]=qs[_0x6d11('0x1c')](_0x56f319[_0x6d11('0x2b')]['limit']);_0x4b51bb[_0x6d11('0x1e')]=qs['offset'](_0x56f319[_0x6d11('0x2b')][_0x6d11('0x1e')]);}return _0xe71cc0[_0x6d11('0x4b')](_0x4b51bb);}})[_0x6d11('0x23')](function(_0x33704a){if(_0x33704a){return _0x33704a?{'count':_0x779a7f,'rows':_0x33704a}:null;}})[_0x6d11('0x23')](respondWithResult(_0x2992a2,null))[_0x6d11('0x43')](handleError(_0x2992a2,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8bad49c..be2c449 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 _0xb20f=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb20f,0x176));var _0xfb20=function(_0x2270c0,_0x12976a){_0x2270c0=_0x2270c0-0x0;var _0x35731d=_0xb20f[_0x2270c0];return _0x35731d;};'use strict';var _=require(_0xfb20('0x0'));var util=require(_0xfb20('0x1'));var logger=require('../../config/logger')(_0xfb20('0x2'));var moment=require(_0xfb20('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb20('0x4'));var fs=require('fs');var path=require(_0xfb20('0x5'));var rimraf=require(_0xfb20('0x6'));var config=require(_0xfb20('0x7'));var attributes=require(_0xfb20('0x8'));module['exports']=function(_0x3531ff,_0x1afc51){return _0x3531ff['define'](_0xfb20('0x9'),attributes,{'tableName':_0xfb20('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1425=['int_zoho_configurations','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x5bca59,_0x18a7bf){var _0x2fe97e=function(_0x390a1b){while(--_0x390a1b){_0x5bca59['push'](_0x5bca59['shift']());}};_0x2fe97e(++_0x18a7bf);}(_0x1425,0x90));var _0x5142=function(_0x10d570,_0x1012dd){_0x10d570=_0x10d570-0x0;var _0x46e8a0=_0x1425[_0x10d570];return _0x46e8a0;};'use strict';var _=require(_0x5142('0x0'));var util=require('util');var logger=require(_0x5142('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5142('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5142('0x3'));var rimraf=require(_0x5142('0x4'));var config=require(_0x5142('0x5'));var attributes=require(_0x5142('0x6'));module[_0x5142('0x7')]=function(_0x36a8d5,_0x38d75c){return _0x36a8d5[_0x5142('0x8')](_0x5142('0x9'),attributes,{'tableName':_0x5142('0xa'),'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 d6ab668..31216d5 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 _0xeeaf=['http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xeeaf,0x194));var _0xfeea=function(_0x5aa119,_0x29ecc0){_0x5aa119=_0x5aa119-0x0;var _0x32847d=_0xeeaf[_0x5aa119];return _0x32847d;};'use strict';var _=require('lodash');var util=require(_0xfeea('0x0'));var moment=require(_0xfeea('0x1'));var BPromise=require(_0xfeea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeea('0x3'));var db=require(_0xfeea('0x4'))['db'];var utils=require(_0xfeea('0x5'));var logger=require(_0xfeea('0x6'))(_0xfeea('0x7'));var config=require(_0xfeea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfeea('0x9')][_0xfeea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d01bc,_0x4588a2,_0x2225b8){return new BPromise(function(_0x4cc9d9,_0x23c5b1){return client[_0xfeea('0xb')](_0x3d01bc,_0x2225b8)[_0xfeea('0xc')](function(_0x13e04a){logger[_0xfeea('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x4588a2,_0xfeea('0xe'));logger[_0xfeea('0xf')](_0xfeea('0x10'),_0x4588a2,_0xfeea('0xe'),JSON[_0xfeea('0x11')](_0x13e04a));if(_0x13e04a[_0xfeea('0x12')]){if(_0x13e04a[_0xfeea('0x12')]['code']===0x1f4){logger[_0xfeea('0x12')](_0xfeea('0x13'),_0x4588a2,_0x13e04a[_0xfeea('0x12')][_0xfeea('0x14')]);return _0x23c5b1(_0x13e04a[_0xfeea('0x12')][_0xfeea('0x14')]);}logger[_0xfeea('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4588a2,_0x13e04a[_0xfeea('0x12')][_0xfeea('0x14')]);return _0x4cc9d9(_0x13e04a[_0xfeea('0x12')][_0xfeea('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x4588a2,_0xfeea('0xe'));_0x4cc9d9(_0x13e04a[_0xfeea('0x15')][_0xfeea('0x14')]);}})[_0xfeea('0x16')](function(_0x3c93d2){logger[_0xfeea('0x12')](_0xfeea('0x13'),_0x4588a2,_0x3c93d2);_0x23c5b1(_0x3c93d2);});});} \ No newline at end of file +var _0xecf9=['../../config/environment','jayson/promise','http','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x2822c3,_0x4adbd8){var _0x263e6e=function(_0x213e8a){while(--_0x213e8a){_0x2822c3['push'](_0x2822c3['shift']());}};_0x263e6e(++_0x4adbd8);}(_0xecf9,0x185));var _0x9ecf=function(_0x36e37c,_0x234700){_0x36e37c=_0x36e37c-0x0;var _0x198565=_0xecf9[_0x36e37c];return _0x198565;};'use strict';var _=require(_0x9ecf('0x0'));var util=require(_0x9ecf('0x1'));var moment=require('moment');var BPromise=require(_0x9ecf('0x2'));var rs=require(_0x9ecf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ecf('0x4'))['db'];var utils=require(_0x9ecf('0x5'));var logger=require('../../config/logger')(_0x9ecf('0x6'));var config=require(_0x9ecf('0x7'));var jayson=require(_0x9ecf('0x8'));var client=jayson['client'][_0x9ecf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d6bc2,_0x5c78bb,_0x46b80a){return new BPromise(function(_0x4f06d7,_0xdfcf7c){return client['request'](_0x4d6bc2,_0x46b80a)['then'](function(_0x4f0d8c){logger[_0x9ecf('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c78bb,_0x9ecf('0xb'));logger['debug'](_0x9ecf('0xc'),_0x5c78bb,'request\x20sent',JSON[_0x9ecf('0xd')](_0x4f0d8c));if(_0x4f0d8c[_0x9ecf('0xe')]){if(_0x4f0d8c[_0x9ecf('0xe')]['code']===0x1f4){logger['error'](_0x9ecf('0xf'),_0x5c78bb,_0x4f0d8c[_0x9ecf('0xe')]['message']);return _0xdfcf7c(_0x4f0d8c[_0x9ecf('0xe')][_0x9ecf('0x10')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x5c78bb,_0x4f0d8c[_0x9ecf('0xe')]['message']);return _0x4f06d7(_0x4f0d8c[_0x9ecf('0xe')][_0x9ecf('0x10')]);}else{logger[_0x9ecf('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c78bb,_0x9ecf('0xb'));_0x4f06d7(_0x4f0d8c['result'][_0x9ecf('0x10')]);}})[_0x9ecf('0x11')](function(_0x180748){logger[_0x9ecf('0xe')](_0x9ecf('0xf'),_0x5c78bb,_0x180748);_0xdfcf7c(_0x180748);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9aeb8d0..98c15af 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 _0x2cc1=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2832f5,_0x4e58da){var _0x483878=function(_0x4667fc){while(--_0x4667fc){_0x2832f5['push'](_0x2832f5['shift']());}};_0x483878(++_0x4e58da);}(_0x2cc1,0xad));var _0x12cc=function(_0x4baac3,_0x481c9a){_0x4baac3=_0x4baac3-0x0;var _0x4fb4bc=_0x2cc1[_0x4baac3];return _0x4fb4bc;};'use strict';var multer=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var path=require('path');var timeout=require(_0x12cc('0x2'));var express=require(_0x12cc('0x3'));var router=express[_0x12cc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x12cc('0x5'));var interaction=require(_0x12cc('0x6'));var config=require(_0x12cc('0x7'));var controller=require(_0x12cc('0x8'));router[_0x12cc('0x9')]('/',auth[_0x12cc('0xa')](),controller[_0x12cc('0xb')]);router[_0x12cc('0x9')](_0x12cc('0xc'),auth[_0x12cc('0xa')](),controller['show']);router[_0x12cc('0xd')]('/',auth['isAuthenticated'](),controller[_0x12cc('0xe')]);router[_0x12cc('0xf')](_0x12cc('0xc'),auth['isAuthenticated'](),controller[_0x12cc('0x10')]);router[_0x12cc('0x11')]('/:id',auth[_0x12cc('0xa')](),controller[_0x12cc('0x12')]);module[_0x12cc('0x13')]=router; \ No newline at end of file +var _0x4b66=['/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','show','create'];(function(_0x142f9b,_0x904a81){var _0x57eba6=function(_0xcfe723){while(--_0xcfe723){_0x142f9b['push'](_0x142f9b['shift']());}};_0x57eba6(++_0x904a81);}(_0x4b66,0x1c3));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x64b6('0x0'));var util=require(_0x64b6('0x1'));var path=require(_0x64b6('0x2'));var timeout=require(_0x64b6('0x3'));var express=require(_0x64b6('0x4'));var router=express[_0x64b6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x64b6('0x6'));var config=require('../../config/environment');var controller=require(_0x64b6('0x7'));router[_0x64b6('0x8')]('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0xa')]);router[_0x64b6('0x8')]('/:id',auth[_0x64b6('0x9')](),controller[_0x64b6('0xb')]);router['post']('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0xc')]);router['put'](_0x64b6('0xd'),auth[_0x64b6('0x9')](),controller[_0x64b6('0xe')]);router['delete'](_0x64b6('0xd'),auth['isAuthenticated'](),controller[_0x64b6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 01c31c6..671c7dd 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 _0x1301=['keyValue','STRING','ENUM','variable','sequelize','exports','string','customVariable'];(function(_0x5a3db0,_0x485309){var _0x526236=function(_0x22e24a){while(--_0x22e24a){_0x5a3db0['push'](_0x5a3db0['shift']());}};_0x526236(++_0x485309);}(_0x1301,0x74));var _0x1130=function(_0x12f805,_0x9cb58){_0x12f805=_0x12f805-0x0;var _0x3d05e6=_0x1301[_0x12f805];return _0x3d05e6;};'use strict';var Sequelize=require(_0x1130('0x0'));module[_0x1130('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1130('0x2'),'variable',_0x1130('0x3'),_0x1130('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x1130('0x5')]},'key':{'type':Sequelize[_0x1130('0x5')]},'keyType':{'type':Sequelize[_0x1130('0x6')](_0x1130('0x2'),_0x1130('0x7'),_0x1130('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1130('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1130('0x5')]}}; \ No newline at end of file +var _0xf503=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xf503,0xc8));var _0x3f50=function(_0x536595,_0x10ebd2){_0x536595=_0x536595-0x0;var _0x24fc8e=_0xf503[_0x536595];return _0x24fc8e;};'use strict';var Sequelize=require(_0x3f50('0x0'));module[_0x3f50('0x1')]={'type':{'type':Sequelize[_0x3f50('0x2')]('string',_0x3f50('0x3'),_0x3f50('0x4'),_0x3f50('0x5'),'picklist'),'defaultValue':_0x3f50('0x6')},'content':{'type':Sequelize[_0x3f50('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3f50('0x2')](_0x3f50('0x6'),_0x3f50('0x3'),_0x3f50('0x4'))},'keyContent':{'type':Sequelize[_0x3f50('0x7')]},'idField':{'type':Sequelize[_0x3f50('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3f50('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f50('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 24f8aa6..c3b2b41 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 _0x5351=['sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','ZohoField','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x450ef2,_0xd1d531){var _0xadfc6f=function(_0x166373){while(--_0x166373){_0x450ef2['push'](_0x450ef2['shift']());}};_0xadfc6f(++_0xd1d531);}(_0x5351,0x140));var _0x1535=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5351[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x1535('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1535('0x1'));var rp=require(_0x1535('0x2'));var moment=require('moment');var BPromise=require(_0x1535('0x3'));var Mustache=require(_0x1535('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1535('0x5'));var ejs=require(_0x1535('0x6'));var fs=require('fs');var fs_extra=require(_0x1535('0x7'));var _=require(_0x1535('0x8'));var squel=require(_0x1535('0x9'));var crypto=require('crypto');var jsforce=require(_0x1535('0xa'));var deskjs=require(_0x1535('0xb'));var toCsv=require(_0x1535('0x5'));var querystring=require(_0x1535('0xc'));var Papa=require(_0x1535('0xd'));var Redis=require('ioredis');var authService=require(_0x1535('0xe'));var qs=require(_0x1535('0xf'));var as=require(_0x1535('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1535('0x11'));var utils=require(_0x1535('0x12'));var config=require(_0x1535('0x13'));var licenseUtil=require(_0x1535('0x14'));var db=require(_0x1535('0x15'))['db'];function respondWithStatusCode(_0xcf2266,_0x5a04e9){_0x5a04e9=_0x5a04e9||0xcc;return function(_0x25b621){if(_0x25b621){return _0xcf2266['sendStatus'](_0x5a04e9);}return _0xcf2266['status'](_0x5a04e9)[_0x1535('0x16')]();};}function respondWithResult(_0x1e473a,_0x81cced){_0x81cced=_0x81cced||0xc8;return function(_0xbc9f9d){if(_0xbc9f9d){return _0x1e473a[_0x1535('0x17')](_0x81cced)[_0x1535('0x18')](_0xbc9f9d);}};}function respondWithFilteredResult(_0x458c42,_0x1aa3e6){return function(_0x3fc9f0){if(_0x3fc9f0){var _0x34a46f=typeof _0x1aa3e6[_0x1535('0x19')]==='undefined'&&typeof _0x1aa3e6[_0x1535('0x1a')]===_0x1535('0x1b');var _0x4c0a1e=_0x3fc9f0['count'];var _0x355943=_0x34a46f?0x0:_0x1aa3e6['offset'];var _0x139d38=_0x34a46f?_0x3fc9f0[_0x1535('0x1c')]:_0x1aa3e6['offset']+_0x1aa3e6[_0x1535('0x1a')];var _0x12162d;if(_0x139d38>=_0x4c0a1e){_0x139d38=_0x4c0a1e;_0x12162d=0xc8;}else{_0x12162d=0xce;}_0x458c42[_0x1535('0x17')](_0x12162d);return _0x458c42[_0x1535('0x1d')](_0x1535('0x1e'),_0x355943+'-'+_0x139d38+'/'+_0x4c0a1e)[_0x1535('0x18')](_0x3fc9f0);}return null;};}function patchUpdates(_0x161fd7){return function(_0x4df84a){try{jsonpatch[_0x1535('0x1f')](_0x4df84a,_0x161fd7,!![]);}catch(_0x4ae098){return BPromise[_0x1535('0x20')](_0x4ae098);}return _0x4df84a[_0x1535('0x21')]();};}function saveUpdates(_0x182f99,_0x323603){return function(_0xb2f795){if(_0xb2f795){return _0xb2f795[_0x1535('0x22')](_0x182f99)['then'](function(_0x40b359){return _0x40b359;});}return null;};}function removeEntity(_0x3c0474,_0x1ad2dc){return function(_0x226999){if(_0x226999){return _0x226999[_0x1535('0x23')]()['then'](function(){_0x3c0474[_0x1535('0x17')](0xcc)[_0x1535('0x16')]();});}};}function handleEntityNotFound(_0x14b60d,_0x446dc0){return function(_0x10e7fb){if(!_0x10e7fb){_0x14b60d['sendStatus'](0x194);}return _0x10e7fb;};}function handleError(_0x242e19,_0x18ad65){_0x18ad65=_0x18ad65||0x1f4;return function(_0xc6d3ad){logger[_0x1535('0x24')](_0xc6d3ad[_0x1535('0x25')]);if(_0xc6d3ad[_0x1535('0x26')]){delete _0xc6d3ad['name'];}_0x242e19[_0x1535('0x17')](_0x18ad65)[_0x1535('0x27')](_0xc6d3ad);};}exports[_0x1535('0x28')]=function(_0x956c4f,_0x5105ad){var _0xb6bf6f={},_0x1ffbf4={},_0x45f55c={'count':0x0,'rows':[]};var _0x383ed2=_['map'](db[_0x1535('0x29')]['rawAttributes'],function(_0x4ab3be){return{'name':_0x4ab3be[_0x1535('0x2a')],'type':_0x4ab3be[_0x1535('0x2b')][_0x1535('0x2c')]};});_0x1ffbf4[_0x1535('0x2d')]=_[_0x1535('0x2e')](_0x383ed2,_0x1535('0x26'));_0x1ffbf4['query']=_['keys'](_0x956c4f[_0x1535('0x2f')]);_0x1ffbf4['filters']=_[_0x1535('0x30')](_0x1ffbf4[_0x1535('0x2d')],_0x1ffbf4[_0x1535('0x2f')]);_0xb6bf6f['attributes']=_[_0x1535('0x30')](_0x1ffbf4[_0x1535('0x2d')],qs[_0x1535('0x31')](_0x956c4f[_0x1535('0x2f')][_0x1535('0x31')]));_0xb6bf6f['attributes']=_0xb6bf6f[_0x1535('0x32')][_0x1535('0x33')]?_0xb6bf6f[_0x1535('0x32')]:_0x1ffbf4['model'];if(!_0x956c4f[_0x1535('0x2f')][_0x1535('0x34')](_0x1535('0x35'))){_0xb6bf6f[_0x1535('0x1a')]=qs[_0x1535('0x1a')](_0x956c4f['query'][_0x1535('0x1a')]);_0xb6bf6f[_0x1535('0x19')]=qs[_0x1535('0x19')](_0x956c4f[_0x1535('0x2f')][_0x1535('0x19')]);}_0xb6bf6f[_0x1535('0x36')]=qs[_0x1535('0x37')](_0x956c4f['query'][_0x1535('0x37')]);_0xb6bf6f[_0x1535('0x38')]=qs[_0x1535('0x39')](_[_0x1535('0x3a')](_0x956c4f[_0x1535('0x2f')],_0x1ffbf4['filters']),_0x383ed2);if(_0x956c4f[_0x1535('0x2f')][_0x1535('0x3b')]){_0xb6bf6f[_0x1535('0x38')]=_[_0x1535('0x3c')](_0xb6bf6f[_0x1535('0x38')],{'$or':_['map'](_0x383ed2,function(_0x36e1e6){if(_0x36e1e6[_0x1535('0x2b')]!==_0x1535('0x3d')){var _0xaaaea1={};_0xaaaea1[_0x36e1e6[_0x1535('0x26')]]={'$like':'%'+_0x956c4f[_0x1535('0x2f')][_0x1535('0x3b')]+'%'};return _0xaaaea1;}})});}_0xb6bf6f=_['merge']({},_0xb6bf6f,_0x956c4f[_0x1535('0x3e')]);var _0x3e95e8={'where':_0xb6bf6f[_0x1535('0x38')]};return db['ZohoField'][_0x1535('0x1c')](_0x3e95e8)[_0x1535('0x3f')](function(_0x3d2186){_0x45f55c['count']=_0x3d2186;if(_0x956c4f[_0x1535('0x2f')][_0x1535('0x40')]){_0xb6bf6f[_0x1535('0x41')]=[{'all':!![]}];}return db[_0x1535('0x29')][_0x1535('0x42')](_0xb6bf6f);})[_0x1535('0x3f')](function(_0x2112e0){_0x45f55c['rows']=_0x2112e0;return _0x45f55c;})[_0x1535('0x3f')](respondWithFilteredResult(_0x5105ad,_0xb6bf6f))[_0x1535('0x43')](handleError(_0x5105ad,null));};exports[_0x1535('0x44')]=function(_0x109cd9,_0x5e8ff2){var _0x26463d={'raw':!![],'where':{'id':_0x109cd9[_0x1535('0x45')]['id']}},_0xf6e8c5={};_0xf6e8c5[_0x1535('0x2d')]=_[_0x1535('0x46')](db[_0x1535('0x29')][_0x1535('0x47')]);_0xf6e8c5[_0x1535('0x2f')]=_[_0x1535('0x46')](_0x109cd9['query']);_0xf6e8c5['filters']=_[_0x1535('0x30')](_0xf6e8c5[_0x1535('0x2d')],_0xf6e8c5[_0x1535('0x2f')]);_0x26463d[_0x1535('0x32')]=_[_0x1535('0x30')](_0xf6e8c5[_0x1535('0x2d')],qs['fields'](_0x109cd9[_0x1535('0x2f')]['fields']));_0x26463d[_0x1535('0x32')]=_0x26463d[_0x1535('0x32')][_0x1535('0x33')]?_0x26463d[_0x1535('0x32')]:_0xf6e8c5[_0x1535('0x2d')];if(_0x109cd9[_0x1535('0x2f')][_0x1535('0x40')]){_0x26463d[_0x1535('0x41')]=[{'all':!![]}];}_0x26463d=_[_0x1535('0x3c')]({},_0x26463d,_0x109cd9[_0x1535('0x3e')]);return db[_0x1535('0x29')][_0x1535('0x48')](_0x26463d)[_0x1535('0x3f')](handleEntityNotFound(_0x5e8ff2,null))[_0x1535('0x3f')](respondWithResult(_0x5e8ff2,null))[_0x1535('0x43')](handleError(_0x5e8ff2,null));};exports[_0x1535('0x49')]=function(_0x3fb0e2,_0x465ced){return db[_0x1535('0x29')][_0x1535('0x49')](_0x3fb0e2['body'],{})[_0x1535('0x3f')](respondWithResult(_0x465ced,0xc9))[_0x1535('0x43')](handleError(_0x465ced,null));};exports[_0x1535('0x22')]=function(_0x420c56,_0x2fd885){if(_0x420c56[_0x1535('0x4a')]['id']){delete _0x420c56[_0x1535('0x4a')]['id'];}return db[_0x1535('0x29')][_0x1535('0x48')]({'where':{'id':_0x420c56[_0x1535('0x45')]['id']}})[_0x1535('0x3f')](handleEntityNotFound(_0x2fd885,null))[_0x1535('0x3f')](saveUpdates(_0x420c56[_0x1535('0x4a')],null))[_0x1535('0x3f')](respondWithResult(_0x2fd885,null))['catch'](handleError(_0x2fd885,null));};exports[_0x1535('0x23')]=function(_0x800fec,_0x5728e1){return db[_0x1535('0x29')]['find']({'where':{'id':_0x800fec[_0x1535('0x45')]['id']}})[_0x1535('0x3f')](handleEntityNotFound(_0x5728e1,null))[_0x1535('0x3f')](removeEntity(_0x5728e1,null))[_0x1535('0x43')](handleError(_0x5728e1,null));}; \ No newline at end of file +var _0x5b53=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ZohoField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit'];(function(_0x318256,_0xa773f3){var _0xb1e352=function(_0x4bb14e){while(--_0x4bb14e){_0x318256['push'](_0x318256['shift']());}};_0xb1e352(++_0xa773f3);}(_0x5b53,0x1a2));var _0x35b5=function(_0xda3f86,_0x32c86c){_0xda3f86=_0xda3f86-0x0;var _0x1bcc40=_0x5b53[_0xda3f86];return _0x1bcc40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35b5('0x0'));var zipdir=require(_0x35b5('0x1'));var jsonpatch=require(_0x35b5('0x2'));var rp=require(_0x35b5('0x3'));var moment=require(_0x35b5('0x4'));var BPromise=require(_0x35b5('0x5'));var Mustache=require(_0x35b5('0x6'));var util=require(_0x35b5('0x7'));var path=require(_0x35b5('0x8'));var sox=require('sox');var csv=require(_0x35b5('0x9'));var ejs=require(_0x35b5('0xa'));var fs=require('fs');var fs_extra=require(_0x35b5('0xb'));var _=require(_0x35b5('0xc'));var squel=require(_0x35b5('0xd'));var crypto=require(_0x35b5('0xe'));var jsforce=require(_0x35b5('0xf'));var deskjs=require(_0x35b5('0x10'));var toCsv=require(_0x35b5('0x9'));var querystring=require(_0x35b5('0x11'));var Papa=require(_0x35b5('0x12'));var Redis=require(_0x35b5('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x35b5('0x14'));var hardwareService=require(_0x35b5('0x15'));var logger=require(_0x35b5('0x16'))(_0x35b5('0x17'));var utils=require(_0x35b5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x35b5('0x19'));var db=require(_0x35b5('0x1a'))['db'];function respondWithStatusCode(_0x6c1e92,_0x5d3ae6){_0x5d3ae6=_0x5d3ae6||0xcc;return function(_0x3bb799){if(_0x3bb799){return _0x6c1e92['sendStatus'](_0x5d3ae6);}return _0x6c1e92[_0x35b5('0x1b')](_0x5d3ae6)[_0x35b5('0x1c')]();};}function respondWithResult(_0x215583,_0x8c9739){_0x8c9739=_0x8c9739||0xc8;return function(_0x269e17){if(_0x269e17){return _0x215583[_0x35b5('0x1b')](_0x8c9739)['json'](_0x269e17);}};}function respondWithFilteredResult(_0x4ca74c,_0x55b44e){return function(_0x5c6ff3){if(_0x5c6ff3){var _0x106c01=typeof _0x55b44e[_0x35b5('0x1d')]===_0x35b5('0x1e')&&typeof _0x55b44e[_0x35b5('0x1f')]===_0x35b5('0x1e');var _0x4abd0c=_0x5c6ff3['count'];var _0x510ec2=_0x106c01?0x0:_0x55b44e[_0x35b5('0x1d')];var _0x2e3513=_0x106c01?_0x5c6ff3['count']:_0x55b44e['offset']+_0x55b44e['limit'];var _0x27f315;if(_0x2e3513>=_0x4abd0c){_0x2e3513=_0x4abd0c;_0x27f315=0xc8;}else{_0x27f315=0xce;}_0x4ca74c['status'](_0x27f315);return _0x4ca74c[_0x35b5('0x20')](_0x35b5('0x21'),_0x510ec2+'-'+_0x2e3513+'/'+_0x4abd0c)['json'](_0x5c6ff3);}return null;};}function patchUpdates(_0x2d36aa){return function(_0x5aa98c){try{jsonpatch[_0x35b5('0x22')](_0x5aa98c,_0x2d36aa,!![]);}catch(_0x2f8259){return BPromise[_0x35b5('0x23')](_0x2f8259);}return _0x5aa98c[_0x35b5('0x24')]();};}function saveUpdates(_0x440b1e,_0x4d2f4d){return function(_0x3bb552){if(_0x3bb552){return _0x3bb552[_0x35b5('0x25')](_0x440b1e)[_0x35b5('0x26')](function(_0x1c43cc){return _0x1c43cc;});}return null;};}function removeEntity(_0x3111d4,_0x5b3dd7){return function(_0x28f71d){if(_0x28f71d){return _0x28f71d[_0x35b5('0x27')]()[_0x35b5('0x26')](function(){_0x3111d4[_0x35b5('0x1b')](0xcc)[_0x35b5('0x1c')]();});}};}function handleEntityNotFound(_0x370cb4,_0x1b5382){return function(_0x482801){if(!_0x482801){_0x370cb4['sendStatus'](0x194);}return _0x482801;};}function handleError(_0x5d0c14,_0x5e9ced){_0x5e9ced=_0x5e9ced||0x1f4;return function(_0x40f65e){logger['error'](_0x40f65e[_0x35b5('0x28')]);if(_0x40f65e[_0x35b5('0x29')]){delete _0x40f65e['name'];}_0x5d0c14['status'](_0x5e9ced)['send'](_0x40f65e);};}exports[_0x35b5('0x2a')]=function(_0x3da7a4,_0x5e0b1a){var _0x1032c9={},_0x181e1d={},_0x4f92dd={'count':0x0,'rows':[]};var _0x214606=_[_0x35b5('0x2b')](db[_0x35b5('0x2c')][_0x35b5('0x2d')],function(_0x4f23a6){return{'name':_0x4f23a6['fieldName'],'type':_0x4f23a6[_0x35b5('0x2e')]['key']};});_0x181e1d[_0x35b5('0x2f')]=_['map'](_0x214606,_0x35b5('0x29'));_0x181e1d[_0x35b5('0x30')]=_[_0x35b5('0x31')](_0x3da7a4[_0x35b5('0x30')]);_0x181e1d[_0x35b5('0x32')]=_[_0x35b5('0x33')](_0x181e1d['model'],_0x181e1d[_0x35b5('0x30')]);_0x1032c9['attributes']=_[_0x35b5('0x33')](_0x181e1d[_0x35b5('0x2f')],qs['fields'](_0x3da7a4['query'][_0x35b5('0x34')]));_0x1032c9[_0x35b5('0x35')]=_0x1032c9[_0x35b5('0x35')][_0x35b5('0x36')]?_0x1032c9[_0x35b5('0x35')]:_0x181e1d[_0x35b5('0x2f')];if(!_0x3da7a4[_0x35b5('0x30')][_0x35b5('0x37')](_0x35b5('0x38'))){_0x1032c9[_0x35b5('0x1f')]=qs[_0x35b5('0x1f')](_0x3da7a4[_0x35b5('0x30')][_0x35b5('0x1f')]);_0x1032c9['offset']=qs[_0x35b5('0x1d')](_0x3da7a4['query']['offset']);}_0x1032c9[_0x35b5('0x39')]=qs[_0x35b5('0x3a')](_0x3da7a4[_0x35b5('0x30')]['sort']);_0x1032c9[_0x35b5('0x3b')]=qs['filters'](_[_0x35b5('0x3c')](_0x3da7a4[_0x35b5('0x30')],_0x181e1d['filters']),_0x214606);if(_0x3da7a4[_0x35b5('0x30')][_0x35b5('0x3d')]){_0x1032c9[_0x35b5('0x3b')]=_[_0x35b5('0x3e')](_0x1032c9[_0x35b5('0x3b')],{'$or':_[_0x35b5('0x2b')](_0x214606,function(_0x4f6bca){if(_0x4f6bca[_0x35b5('0x2e')]!==_0x35b5('0x3f')){var _0x11fc41={};_0x11fc41[_0x4f6bca[_0x35b5('0x29')]]={'$like':'%'+_0x3da7a4['query']['filter']+'%'};return _0x11fc41;}})});}_0x1032c9=_[_0x35b5('0x3e')]({},_0x1032c9,_0x3da7a4[_0x35b5('0x40')]);var _0x4b814d={'where':_0x1032c9[_0x35b5('0x3b')]};return db[_0x35b5('0x2c')][_0x35b5('0x41')](_0x4b814d)[_0x35b5('0x26')](function(_0x4a3ca5){_0x4f92dd[_0x35b5('0x41')]=_0x4a3ca5;if(_0x3da7a4['query'][_0x35b5('0x42')]){_0x1032c9[_0x35b5('0x43')]=[{'all':!![]}];}return db['ZohoField'][_0x35b5('0x44')](_0x1032c9);})['then'](function(_0x361fa2){_0x4f92dd[_0x35b5('0x45')]=_0x361fa2;return _0x4f92dd;})[_0x35b5('0x26')](respondWithFilteredResult(_0x5e0b1a,_0x1032c9))[_0x35b5('0x46')](handleError(_0x5e0b1a,null));};exports['show']=function(_0x2da7d3,_0x347a5c){var _0x41403a={'raw':!![],'where':{'id':_0x2da7d3[_0x35b5('0x47')]['id']}},_0x19d5a8={};_0x19d5a8[_0x35b5('0x2f')]=_['keys'](db[_0x35b5('0x2c')][_0x35b5('0x2d')]);_0x19d5a8[_0x35b5('0x30')]=_['keys'](_0x2da7d3[_0x35b5('0x30')]);_0x19d5a8[_0x35b5('0x32')]=_[_0x35b5('0x33')](_0x19d5a8[_0x35b5('0x2f')],_0x19d5a8[_0x35b5('0x30')]);_0x41403a[_0x35b5('0x35')]=_['intersection'](_0x19d5a8[_0x35b5('0x2f')],qs[_0x35b5('0x34')](_0x2da7d3[_0x35b5('0x30')][_0x35b5('0x34')]));_0x41403a[_0x35b5('0x35')]=_0x41403a[_0x35b5('0x35')][_0x35b5('0x36')]?_0x41403a[_0x35b5('0x35')]:_0x19d5a8[_0x35b5('0x2f')];if(_0x2da7d3[_0x35b5('0x30')][_0x35b5('0x42')]){_0x41403a['include']=[{'all':!![]}];}_0x41403a=_[_0x35b5('0x3e')]({},_0x41403a,_0x2da7d3[_0x35b5('0x40')]);return db[_0x35b5('0x2c')][_0x35b5('0x48')](_0x41403a)[_0x35b5('0x26')](handleEntityNotFound(_0x347a5c,null))['then'](respondWithResult(_0x347a5c,null))[_0x35b5('0x46')](handleError(_0x347a5c,null));};exports[_0x35b5('0x49')]=function(_0x15a4af,_0x2cc93f){return db[_0x35b5('0x2c')][_0x35b5('0x49')](_0x15a4af[_0x35b5('0x4a')],{})[_0x35b5('0x26')](respondWithResult(_0x2cc93f,0xc9))[_0x35b5('0x46')](handleError(_0x2cc93f,null));};exports[_0x35b5('0x25')]=function(_0x130a5f,_0x3996db){if(_0x130a5f['body']['id']){delete _0x130a5f[_0x35b5('0x4a')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x130a5f['params']['id']}})[_0x35b5('0x26')](handleEntityNotFound(_0x3996db,null))[_0x35b5('0x26')](saveUpdates(_0x130a5f[_0x35b5('0x4a')],null))[_0x35b5('0x26')](respondWithResult(_0x3996db,null))[_0x35b5('0x46')](handleError(_0x3996db,null));};exports['destroy']=function(_0x5853de,_0x1914af){return db[_0x35b5('0x2c')][_0x35b5('0x48')]({'where':{'id':_0x5853de['params']['id']}})[_0x35b5('0x26')](handleEntityNotFound(_0x1914af,null))['then'](removeEntity(_0x1914af,null))['catch'](handleError(_0x1914af,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 66b2cd7..a1ab83d 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82c4=['moment','bluebird','request-promise','rimraf','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x298d4b,_0x2c34fa){var _0x57e113=function(_0x4f288b){while(--_0x4f288b){_0x298d4b['push'](_0x298d4b['shift']());}};_0x57e113(++_0x2c34fa);}(_0x82c4,0x1ca));var _0x482c=function(_0x3de421,_0x1b6a9e){_0x3de421=_0x3de421-0x0;var _0x13a3b8=_0x82c4[_0x3de421];return _0x13a3b8;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[{'name':_0x482c('0xc'),'fields':[_0x482c('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4137=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c3107,_0x3d1516){var _0x4773b8=function(_0x508ef1){while(--_0x508ef1){_0x5c3107['push'](_0x5c3107['shift']());}};_0x4773b8(++_0x3d1516);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x7413('0xf'),_0x7413('0x10')],'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 f20784b..7fd8963 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 _0x29fc=['rpc','../../config/environment','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x291f00,_0x222387){var _0x466ea2=function(_0x5eb693){while(--_0x5eb693){_0x291f00['push'](_0x291f00['shift']());}};_0x466ea2(++_0x222387);}(_0x29fc,0x11f));var _0xc29f=function(_0x3d0db9,_0x1bd377){_0x3d0db9=_0x3d0db9-0x0;var _0x4dc1dc=_0x29fc[_0x3d0db9];return _0x4dc1dc;};'use strict';var _=require(_0xc29f('0x0'));var util=require('util');var moment=require(_0xc29f('0x1'));var BPromise=require(_0xc29f('0x2'));var rs=require(_0xc29f('0x3'));var fs=require('fs');var Redis=require(_0xc29f('0x4'));var db=require(_0xc29f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc29f('0x6'))(_0xc29f('0x7'));var config=require(_0xc29f('0x8'));var jayson=require(_0xc29f('0x9'));var client=jayson[_0xc29f('0xa')][_0xc29f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55c673,_0x3cb275,_0x2b8a20){return new BPromise(function(_0x2150ae,_0x3fe69b){return client[_0xc29f('0xc')](_0x55c673,_0x2b8a20)['then'](function(_0x3e4532){logger['info'](_0xc29f('0xd'),_0x3cb275,'request\x20sent');logger[_0xc29f('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3cb275,_0xc29f('0xf'),JSON[_0xc29f('0x10')](_0x3e4532));if(_0x3e4532['error']){if(_0x3e4532['error']['code']===0x1f4){logger[_0xc29f('0x11')]('ZohoField,\x20%s,\x20%s',_0x3cb275,_0x3e4532['error'][_0xc29f('0x12')]);return _0x3fe69b(_0x3e4532[_0xc29f('0x11')][_0xc29f('0x12')]);}logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x3cb275,_0x3e4532[_0xc29f('0x11')][_0xc29f('0x12')]);return _0x2150ae(_0x3e4532['error'][_0xc29f('0x12')]);}else{logger['info'](_0xc29f('0xd'),_0x3cb275,_0xc29f('0xf'));_0x2150ae(_0x3e4532[_0xc29f('0x13')][_0xc29f('0x12')]);}})[_0xc29f('0x14')](function(_0x524f93){logger[_0xc29f('0x11')](_0xc29f('0xd'),_0x3cb275,_0x524f93);_0x3fe69b(_0x524f93);});});} \ No newline at end of file +var _0xa348=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x3ace3d,_0x371b58){var _0x490103=function(_0x43aca0){while(--_0x43aca0){_0x3ace3d['push'](_0x3ace3d['shift']());}};_0x490103(++_0x371b58);}(_0xa348,0x1b8));var _0x8a34=function(_0x2a9787,_0xa6645d){_0x2a9787=_0x2a9787-0x0;var _0x3a0ba6=_0xa348[_0x2a9787];return _0x3a0ba6;};'use strict';var _=require('lodash');var util=require(_0x8a34('0x0'));var moment=require(_0x8a34('0x1'));var BPromise=require(_0x8a34('0x2'));var rs=require(_0x8a34('0x3'));var fs=require('fs');var Redis=require(_0x8a34('0x4'));var db=require(_0x8a34('0x5'))['db'];var utils=require(_0x8a34('0x6'));var logger=require(_0x8a34('0x7'))(_0x8a34('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a34('0x9'));var client=jayson[_0x8a34('0xa')][_0x8a34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2be307,_0x1e45a6,_0x3e8d5c){return new BPromise(function(_0x574597,_0x5428c9){return client[_0x8a34('0xc')](_0x2be307,_0x3e8d5c)['then'](function(_0x37f0a1){logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x1e45a6,_0x8a34('0xf'));logger[_0x8a34('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1e45a6,'request\x20sent',JSON[_0x8a34('0x11')](_0x37f0a1));if(_0x37f0a1[_0x8a34('0x12')]){if(_0x37f0a1[_0x8a34('0x12')]['code']===0x1f4){logger[_0x8a34('0x12')](_0x8a34('0xe'),_0x1e45a6,_0x37f0a1[_0x8a34('0x12')][_0x8a34('0x13')]);return _0x5428c9(_0x37f0a1['error']['message']);}logger['error'](_0x8a34('0xe'),_0x1e45a6,_0x37f0a1[_0x8a34('0x12')][_0x8a34('0x13')]);return _0x574597(_0x37f0a1['error'][_0x8a34('0x13')]);}else{logger[_0x8a34('0xd')](_0x8a34('0xe'),_0x1e45a6,_0x8a34('0xf'));_0x574597(_0x37f0a1[_0x8a34('0x14')][_0x8a34('0x13')]);}})[_0x8a34('0x15')](function(_0x413ad8){logger[_0x8a34('0x12')](_0x8a34('0xe'),_0x1e45a6,_0x413ad8);_0x5428c9(_0x413ad8);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 230fa21..542fa69 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3ad56e,_0xbaecd7){var _0x3de0a3=function(_0x2f712c){while(--_0x2f712c){_0x3ad56e['push'](_0x3ad56e['shift']());}};_0x3de0a3(++_0xbaecd7);}(_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(_0x48fec7,_0x30b839){var _0x4f43de=function(_0xe29b75){while(--_0xe29b75){_0x48fec7['push'](_0x48fec7['shift']());}};_0x4f43de(++_0x30b839);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3e0c8fb..c5dbdbe 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 _0x4cdf=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x24db58,_0x55f6db){var _0x33a15d=function(_0x1b7c4a){while(--_0x1b7c4a){_0x24db58['push'](_0x24db58['shift']());}};_0x33a15d(++_0x55f6db);}(_0x4cdf,0x180));var _0xf4cd=function(_0x2f51df,_0x50017c){_0x2f51df=_0x2f51df-0x0;var _0x12cf38=_0x4cdf[_0x2f51df];return _0x12cf38;};'use strict';var Sequelize=require(_0xf4cd('0x0'));module[_0xf4cd('0x1')]={'name':{'type':Sequelize[_0xf4cd('0x2')],'allowNull':![],'unique':_0xf4cd('0x3')},'version':{'type':Sequelize[_0xf4cd('0x2')],'allowNull':![],'unique':_0xf4cd('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xf4cd('0x4')},'filename':{'type':Sequelize[_0xf4cd('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf4cd('0x2')]},'size':{'type':Sequelize[_0xf4cd('0x5')]},'active':{'type':Sequelize[_0xf4cd('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xf4cd('0x2')]},'logo':{'type':Sequelize[_0xf4cd('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xf4cd('0x7')},'description':{'type':Sequelize[_0xf4cd('0x2')]},'title':{'type':Sequelize[_0xf4cd('0x2')]},'remoteUri':{'type':Sequelize[_0xf4cd('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x20ff=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x59c185,_0x590908){var _0x3bdb89=function(_0x47559f){while(--_0x47559f){_0x59c185['push'](_0x59c185['shift']());}};_0x3bdb89(++_0x590908);}(_0x20ff,0x16e));var _0xf20f=function(_0x5dc62d,_0x2e71c7){_0x5dc62d=_0x5dc62d-0x0;var _0x4ef393=_0x20ff[_0x5dc62d];return _0x4ef393;};'use strict';var Sequelize=require(_0xf20f('0x0'));module[_0xf20f('0x1')]={'name':{'type':Sequelize[_0xf20f('0x2')],'allowNull':![],'unique':_0xf20f('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xf20f('0x2')],'defaultValue':_0xf20f('0x4')},'filename':{'type':Sequelize[_0xf20f('0x2')]},'path':{'type':Sequelize[_0xf20f('0x2')]},'type':{'type':Sequelize[_0xf20f('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf20f('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xf20f('0x2')]},'state':{'type':Sequelize[_0xf20f('0x2')],'unique':_0xf20f('0x6')},'description':{'type':Sequelize[_0xf20f('0x2')]},'title':{'type':Sequelize[_0xf20f('0x2')]},'remoteUri':{'type':Sequelize[_0xf20f('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9844933..b029da3 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 _0x4975=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5e315d,_0x2d42e3){var _0x3e56e9=function(_0x3abd9e){while(--_0x3abd9e){_0x5e315d['push'](_0x5e315d['shift']());}};_0x3e56e9(++_0x2d42e3);}(_0x4975,0x86));var _0x5497=function(_0x3e1766,_0x455e9c){_0x3e1766=_0x3e1766-0x0;var _0x14f23b=_0x4975[_0x3e1766];return _0x14f23b;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file +var _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','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','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3a7d0b,_0x5afcb0){var _0x251fe2=function(_0x3026f7){while(--_0x3026f7){_0x3a7d0b['push'](_0x3a7d0b['shift']());}};_0x251fe2(++_0x5afcb0);}(_0x1883,0xab));var _0x3188=function(_0x5c9f40,_0x19203f){_0x5c9f40=_0x5c9f40-0x0;var _0x51f8ea=_0x1883[_0x5c9f40];return _0x51f8ea;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['Integration'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['Integration'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b833552..59a7019 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 _0x48d4=['util','api','path','./integration.attributes','exports','Integration','integrations','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x48d4,0xd7));var _0x448d=function(_0x1d3f66,_0x39c781){_0x1d3f66=_0x1d3f66-0x0;var _0x3ef9ad=_0x48d4[_0x1d3f66];return _0x3ef9ad;};'use strict';var _=require(_0x448d('0x0'));var util=require(_0x448d('0x1'));var logger=require('../../config/logger')(_0x448d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x448d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x448d('0x4'));module[_0x448d('0x5')]=function(_0x1fb410,_0x2422be){return _0x1fb410['define'](_0x448d('0x6'),attributes,{'tableName':_0x448d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a51=['../../config/environment','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a51,0x7a));var _0x12a5=function(_0x59ba9a,_0x3c0ca2){_0x59ba9a=_0x59ba9a-0x0;var _0x4de024=_0x2a51[_0x59ba9a];return _0x4de024;};'use strict';var _=require(_0x12a5('0x0'));var util=require(_0x12a5('0x1'));var logger=require(_0x12a5('0x2'))(_0x12a5('0x3'));var moment=require(_0x12a5('0x4'));var BPromise=require(_0x12a5('0x5'));var rp=require(_0x12a5('0x6'));var fs=require('fs');var path=require(_0x12a5('0x7'));var rimraf=require('rimraf');var config=require(_0x12a5('0x8'));var attributes=require(_0x12a5('0x9'));module['exports']=function(_0xf2e3ad,_0x3fd909){return _0xf2e3ad[_0x12a5('0xa')](_0x12a5('0xb'),attributes,{'tableName':_0x12a5('0xc'),'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 b69bcbd..37f6b49 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc2c7,0x134));var _0x7c2c=function(_0x1401f6,_0x40423b){_0x1401f6=_0x1401f6-0x0;var _0x5d2a36=_0xc2c7[_0x1401f6];return _0x5d2a36;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0xadb5,0xad));var _0x5adb=function(_0x4b8d56,_0x3e56d9){_0x4b8d56=_0x4b8d56-0x0;var _0x554063=_0xadb5[_0x4b8d56];return _0x554063;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index cab634e..213ff6a 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x4b0a13,_0x9f30e0){var _0x4d11bf=function(_0x1cc6cc){while(--_0x1cc6cc){_0x4b0a13['push'](_0x4b0a13['shift']());}};_0x4d11bf(++_0x9f30e0);}(_0x9f0e,0x116));var _0xe9f0=function(_0x29a637,_0x2da6a6){_0x29a637=_0x29a637-0x0;var _0x1131e6=_0x9f0e[_0x29a637];return _0x1131e6;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x57225c,_0x30e251){var _0x3065a5=function(_0x1a686e){while(--_0x1a686e){_0x57225c['push'](_0x57225c['shift']());}};_0x3065a5(++_0x30e251);}(_0x1261,0x144));var _0x1126=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0x1261[_0x4ec3ab];return _0x229613;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index b805912..b7cbbfb 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 _0xd140=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd140,0x1d4));var _0x0d14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd140[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0d14('0x0'));module['exports']={'integration':{'type':Sequelize[_0x0d14('0x1')]},'eventChannel':{'type':Sequelize[_0x0d14('0x1')]},'exitStatus':{'type':Sequelize[_0x0d14('0x1')]},'ticketId':{'type':Sequelize[_0x0d14('0x1')]},'integrationId':{'type':Sequelize[_0x0d14('0x2')]},'contacts':{'type':Sequelize[_0x0d14('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d14('0x1')]},'calleridname':{'type':Sequelize[_0x0d14('0x1')]},'queue':{'type':Sequelize[_0x0d14('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0d14('0x1')]},'agentcalledAt':{'type':Sequelize[_0x0d14('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0d14('0x3')]},'holdtime':{'type':Sequelize[_0x0d14('0x2')]},'agentcomplete':{'type':Sequelize[_0x0d14('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0d14('0x3')]},'talktime':{'type':Sequelize[_0x0d14('0x2')]},'agentacw':{'type':Sequelize[_0x0d14('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0d14('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0d14('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x0d14('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0d14('0x3')]},'lastevent':{'type':Sequelize[_0x0d14('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0d14('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0d14('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0d14('0x1')]},'connectedlinename':{'type':Sequelize[_0x0d14('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0d14('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0d14('0x1')]},'priority':{'type':Sequelize[_0x0d14('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x0d14('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0d14('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0d14('0x1')]},'destlanguage':{'type':Sequelize[_0x0d14('0x1')]},'destaccountcode':{'type':Sequelize[_0x0d14('0x1')]},'destcontext':{'type':Sequelize[_0x0d14('0x1')]},'destexten':{'type':Sequelize[_0x0d14('0x1')]},'destpriority':{'type':Sequelize[_0x0d14('0x1')]},'destuniqueid':{'type':Sequelize[_0x0d14('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0d14('0x1')]},'subject':{'type':Sequelize[_0x0d14('0x1')]},'from':{'type':Sequelize[_0x0d14('0x1')]},'to':{'type':Sequelize[_0x0d14('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x0d14('0x5')]},'html':{'type':Sequelize[_0x0d14('0x5')]},'text':{'type':Sequelize[_0x0d14('0x5')]},'status':{'type':Sequelize[_0x0d14('0x6')](_0x0d14('0x7'),'SENDING',_0x0d14('0x8'),_0x0d14('0x9'))},'url':{'type':Sequelize[_0x0d14('0x1')]},'app':{'type':Sequelize[_0x0d14('0x1')]},'appdata':{'type':Sequelize[_0x0d14('0x1')]},'projectId':{'type':Sequelize[_0x0d14('0x2')]}}; \ No newline at end of file +var _0x52b6=['sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED'];(function(_0x28f296,_0x3f7820){var _0x439cb7=function(_0x42d1fc){while(--_0x42d1fc){_0x28f296['push'](_0x28f296['shift']());}};_0x439cb7(++_0x3f7820);}(_0x52b6,0xd2));var _0x652b=function(_0x59943d,_0x2e751b){_0x59943d=_0x59943d-0x0;var _0x46ace9=_0x52b6[_0x59943d];return _0x46ace9;};'use strict';var Sequelize=require(_0x652b('0x0'));module['exports']={'integration':{'type':Sequelize[_0x652b('0x1')]},'eventChannel':{'type':Sequelize[_0x652b('0x1')]},'exitStatus':{'type':Sequelize[_0x652b('0x1')]},'ticketId':{'type':Sequelize[_0x652b('0x1')]},'integrationId':{'type':Sequelize[_0x652b('0x2')]},'contacts':{'type':Sequelize[_0x652b('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x652b('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x652b('0x1')]},'membername':{'type':Sequelize[_0x652b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x652b('0x3')]},'holdtime':{'type':Sequelize[_0x652b('0x2')]},'agentcomplete':{'type':Sequelize[_0x652b('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x652b('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x652b('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x652b('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x652b('0x3')]},'agentdump':{'type':Sequelize[_0x652b('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x652b('0x3')]},'lastevent':{'type':Sequelize[_0x652b('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x652b('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x652b('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x652b('0x1')]},'exten':{'type':Sequelize[_0x652b('0x1')]},'priority':{'type':Sequelize[_0x652b('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x652b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x652b('0x1')]},'destcalleridnum':{'type':Sequelize[_0x652b('0x1')]},'destcalleridname':{'type':Sequelize[_0x652b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x652b('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x652b('0x1')]},'destaccountcode':{'type':Sequelize[_0x652b('0x1')]},'destcontext':{'type':Sequelize[_0x652b('0x1')]},'destexten':{'type':Sequelize[_0x652b('0x1')]},'destpriority':{'type':Sequelize[_0x652b('0x1')]},'destuniqueid':{'type':Sequelize[_0x652b('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x652b('0x1')]},'subject':{'type':Sequelize[_0x652b('0x1')]},'from':{'type':Sequelize[_0x652b('0x1')]},'to':{'type':Sequelize[_0x652b('0x1')]},'cc':{'type':Sequelize[_0x652b('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x652b('0x5')]},'text':{'type':Sequelize[_0x652b('0x5')]},'status':{'type':Sequelize[_0x652b('0x6')](_0x652b('0x7'),_0x652b('0x8'),'RECEIVED',_0x652b('0x9'))},'url':{'type':Sequelize[_0x652b('0x1')]},'app':{'type':Sequelize[_0x652b('0x1')]},'appdata':{'type':Sequelize[_0x652b('0x1')]},'projectId':{'type':Sequelize[_0x652b('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index cbe7f62..4862a59 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 _0x50b5=['show','params','options','find','create','body','update','describe','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','then','includeAll','include','findAll','rows','catch'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x50b5,0x184));var _0x550b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x50b5[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0x550b('0x0'));var rimraf=require(_0x550b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x550b('0x2'));var moment=require(_0x550b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x550b('0x4'));var path=require(_0x550b('0x5'));var sox=require(_0x550b('0x6'));var csv=require(_0x550b('0x7'));var ejs=require(_0x550b('0x8'));var fs=require('fs');var fs_extra=require(_0x550b('0x9'));var _=require('lodash');var squel=require(_0x550b('0xa'));var crypto=require(_0x550b('0xb'));var jsforce=require(_0x550b('0xc'));var deskjs=require(_0x550b('0xd'));var toCsv=require(_0x550b('0x7'));var querystring=require(_0x550b('0xe'));var Papa=require(_0x550b('0xf'));var Redis=require(_0x550b('0x10'));var authService=require(_0x550b('0x11'));var qs=require(_0x550b('0x12'));var as=require(_0x550b('0x13'));var hardwareService=require(_0x550b('0x14'));var logger=require(_0x550b('0x15'))(_0x550b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x550b('0x17'));var db=require(_0x550b('0x18'))['db'];function respondWithStatusCode(_0x395efe,_0x212b3f){_0x212b3f=_0x212b3f||0xcc;return function(_0x33aed2){if(_0x33aed2){return _0x395efe[_0x550b('0x19')](_0x212b3f);}return _0x395efe[_0x550b('0x1a')](_0x212b3f)[_0x550b('0x1b')]();};}function respondWithResult(_0x5e5c2c,_0x17367f){_0x17367f=_0x17367f||0xc8;return function(_0x55dad2){if(_0x55dad2){return _0x5e5c2c[_0x550b('0x1a')](_0x17367f)[_0x550b('0x1c')](_0x55dad2);}};}function respondWithFilteredResult(_0x4db217,_0x209aec){return function(_0x3e4002){if(_0x3e4002){var _0x40d2f6=typeof _0x209aec[_0x550b('0x1d')]===_0x550b('0x1e')&&typeof _0x209aec['limit']===_0x550b('0x1e');var _0x44a324=_0x3e4002['count'];var _0x2e0867=_0x40d2f6?0x0:_0x209aec[_0x550b('0x1d')];var _0x2063ec=_0x40d2f6?_0x3e4002[_0x550b('0x1f')]:_0x209aec[_0x550b('0x1d')]+_0x209aec[_0x550b('0x20')];var _0x2bb2ca;if(_0x2063ec>=_0x44a324){_0x2063ec=_0x44a324;_0x2bb2ca=0xc8;}else{_0x2bb2ca=0xce;}_0x4db217['status'](_0x2bb2ca);return _0x4db217[_0x550b('0x21')](_0x550b('0x22'),_0x2e0867+'-'+_0x2063ec+'/'+_0x44a324)[_0x550b('0x1c')](_0x3e4002);}return null;};}function patchUpdates(_0x326419){return function(_0x635b9){try{jsonpatch[_0x550b('0x23')](_0x635b9,_0x326419,!![]);}catch(_0x69fd88){return BPromise['reject'](_0x69fd88);}return _0x635b9[_0x550b('0x24')]();};}function saveUpdates(_0x500ed0,_0x49e574){return function(_0x3dd87c){if(_0x3dd87c){return _0x3dd87c['update'](_0x500ed0)['then'](function(_0x53cb7e){return _0x53cb7e;});}return null;};}function removeEntity(_0x4daaed,_0x1c0b5d){return function(_0x3b7bf7){if(_0x3b7bf7){return _0x3b7bf7[_0x550b('0x25')]()['then'](function(){_0x4daaed[_0x550b('0x1a')](0xcc)[_0x550b('0x1b')]();});}};}function handleEntityNotFound(_0xc228d0,_0x18d6ed){return function(_0x17224c){if(!_0x17224c){_0xc228d0['sendStatus'](0x194);}return _0x17224c;};}function handleError(_0x2abf04,_0x19b154){_0x19b154=_0x19b154||0x1f4;return function(_0x67270c){logger['error'](_0x67270c[_0x550b('0x26')]);if(_0x67270c[_0x550b('0x27')]){delete _0x67270c['name'];}_0x2abf04[_0x550b('0x1a')](_0x19b154)[_0x550b('0x28')](_0x67270c);};}exports[_0x550b('0x29')]=function(_0x58516f,_0x2d4aca){var _0x33481e={},_0x16d2cf={},_0x1d8b72={'count':0x0,'rows':[]};var _0x2b49bb=_[_0x550b('0x2a')](db[_0x550b('0x2b')][_0x550b('0x2c')],function(_0x33b8a8){return{'name':_0x33b8a8[_0x550b('0x2d')],'type':_0x33b8a8['type']['key']};});_0x16d2cf[_0x550b('0x2e')]=_['map'](_0x2b49bb,_0x550b('0x27'));_0x16d2cf[_0x550b('0x2f')]=_[_0x550b('0x30')](_0x58516f[_0x550b('0x2f')]);_0x16d2cf[_0x550b('0x31')]=_['intersection'](_0x16d2cf['model'],_0x16d2cf[_0x550b('0x2f')]);_0x33481e[_0x550b('0x32')]=_[_0x550b('0x33')](_0x16d2cf[_0x550b('0x2e')],qs[_0x550b('0x34')](_0x58516f[_0x550b('0x2f')]['fields']));_0x33481e[_0x550b('0x32')]=_0x33481e[_0x550b('0x32')][_0x550b('0x35')]?_0x33481e[_0x550b('0x32')]:_0x16d2cf[_0x550b('0x2e')];if(!_0x58516f[_0x550b('0x2f')][_0x550b('0x36')](_0x550b('0x37'))){_0x33481e[_0x550b('0x20')]=qs[_0x550b('0x20')](_0x58516f['query']['limit']);_0x33481e[_0x550b('0x1d')]=qs[_0x550b('0x1d')](_0x58516f[_0x550b('0x2f')][_0x550b('0x1d')]);}_0x33481e[_0x550b('0x38')]=qs[_0x550b('0x39')](_0x58516f[_0x550b('0x2f')][_0x550b('0x39')]);_0x33481e[_0x550b('0x3a')]=qs['filters'](_['pick'](_0x58516f[_0x550b('0x2f')],_0x16d2cf[_0x550b('0x31')]),_0x2b49bb);if(_0x58516f[_0x550b('0x2f')][_0x550b('0x3b')]){_0x33481e[_0x550b('0x3a')]=_[_0x550b('0x3c')](_0x33481e['where'],{'$or':_['map'](_0x2b49bb,function(_0x15c837){if(_0x15c837[_0x550b('0x3d')]!=='VIRTUAL'){var _0x4fb788={};_0x4fb788[_0x15c837[_0x550b('0x27')]]={'$like':'%'+_0x58516f['query']['filter']+'%'};return _0x4fb788;}})});}_0x33481e=_[_0x550b('0x3c')]({},_0x33481e,_0x58516f['options']);var _0x140684={'where':_0x33481e[_0x550b('0x3a')]};return db[_0x550b('0x2b')][_0x550b('0x1f')](_0x140684)[_0x550b('0x3e')](function(_0x373e48){_0x1d8b72[_0x550b('0x1f')]=_0x373e48;if(_0x58516f[_0x550b('0x2f')][_0x550b('0x3f')]){_0x33481e[_0x550b('0x40')]=[{'all':!![]}];}return db[_0x550b('0x2b')][_0x550b('0x41')](_0x33481e);})['then'](function(_0x1ee99a){_0x1d8b72[_0x550b('0x42')]=_0x1ee99a;return _0x1d8b72;})[_0x550b('0x3e')](respondWithFilteredResult(_0x2d4aca,_0x33481e))[_0x550b('0x43')](handleError(_0x2d4aca,null));};exports[_0x550b('0x44')]=function(_0x2a1d29,_0x16d73e){var _0x5edd1c={'raw':![],'where':{'id':_0x2a1d29[_0x550b('0x45')]['id']}},_0x5702c1={};_0x5702c1['model']=_['keys'](db[_0x550b('0x2b')][_0x550b('0x2c')]);_0x5702c1['query']=_[_0x550b('0x30')](_0x2a1d29[_0x550b('0x2f')]);_0x5702c1[_0x550b('0x31')]=_[_0x550b('0x33')](_0x5702c1[_0x550b('0x2e')],_0x5702c1[_0x550b('0x2f')]);_0x5edd1c[_0x550b('0x32')]=_[_0x550b('0x33')](_0x5702c1['model'],qs[_0x550b('0x34')](_0x2a1d29['query'][_0x550b('0x34')]));_0x5edd1c[_0x550b('0x32')]=_0x5edd1c[_0x550b('0x32')][_0x550b('0x35')]?_0x5edd1c[_0x550b('0x32')]:_0x5702c1[_0x550b('0x2e')];if(_0x2a1d29[_0x550b('0x2f')][_0x550b('0x3f')]){_0x5edd1c[_0x550b('0x40')]=[{'all':!![]}];}_0x5edd1c=_[_0x550b('0x3c')]({},_0x5edd1c,_0x2a1d29[_0x550b('0x46')]);return db[_0x550b('0x2b')][_0x550b('0x47')](_0x5edd1c)['then'](handleEntityNotFound(_0x16d73e,null))['then'](respondWithResult(_0x16d73e,null))[_0x550b('0x43')](handleError(_0x16d73e,null));};exports[_0x550b('0x48')]=function(_0x542c90,_0x5cb0ff){return db[_0x550b('0x2b')][_0x550b('0x48')](_0x542c90[_0x550b('0x49')],{})['then'](respondWithResult(_0x5cb0ff,0xc9))[_0x550b('0x43')](handleError(_0x5cb0ff,null));};exports[_0x550b('0x4a')]=function(_0x27dc28,_0x4a87d9){if(_0x27dc28[_0x550b('0x49')]['id']){delete _0x27dc28[_0x550b('0x49')]['id'];}return db[_0x550b('0x2b')][_0x550b('0x47')]({'where':{'id':_0x27dc28[_0x550b('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a87d9,null))['then'](saveUpdates(_0x27dc28['body'],null))[_0x550b('0x3e')](respondWithResult(_0x4a87d9,null))['catch'](handleError(_0x4a87d9,null));};exports[_0x550b('0x25')]=function(_0x52e98d,_0xd2f9c8){return db['IntegrationReport']['find']({'where':{'id':_0x52e98d['params']['id']}})[_0x550b('0x3e')](handleEntityNotFound(_0xd2f9c8,null))['then'](removeEntity(_0xd2f9c8,null))['catch'](handleError(_0xd2f9c8,null));};exports[_0x550b('0x4b')]=function(_0x3dc17f,_0x4d5374){return db['IntegrationReport'][_0x550b('0x4b')]()['then'](respondWithResult(_0x4d5374,null))[_0x550b('0x43')](handleError(_0x4d5374,null));}; \ No newline at end of file +var _0x1747=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x1747,0x157));var _0x7174=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1747[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0x7174('0x0'));var rimraf=require(_0x7174('0x1'));var zipdir=require(_0x7174('0x2'));var jsonpatch=require(_0x7174('0x3'));var rp=require(_0x7174('0x4'));var moment=require(_0x7174('0x5'));var BPromise=require(_0x7174('0x6'));var Mustache=require(_0x7174('0x7'));var util=require(_0x7174('0x8'));var path=require(_0x7174('0x9'));var sox=require('sox');var csv=require(_0x7174('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7174('0xb'));var squel=require(_0x7174('0xc'));var crypto=require('crypto');var jsforce=require(_0x7174('0xd'));var deskjs=require(_0x7174('0xe'));var toCsv=require(_0x7174('0xa'));var querystring=require(_0x7174('0xf'));var Papa=require('papaparse');var Redis=require(_0x7174('0x10'));var authService=require(_0x7174('0x11'));var qs=require(_0x7174('0x12'));var as=require(_0x7174('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7174('0x14'))('api');var utils=require(_0x7174('0x15'));var config=require(_0x7174('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7174('0x17'))['db'];function respondWithStatusCode(_0x1f50e7,_0x4d2eda){_0x4d2eda=_0x4d2eda||0xcc;return function(_0x497734){if(_0x497734){return _0x1f50e7[_0x7174('0x18')](_0x4d2eda);}return _0x1f50e7[_0x7174('0x19')](_0x4d2eda)[_0x7174('0x1a')]();};}function respondWithResult(_0x3a7033,_0x3b0751){_0x3b0751=_0x3b0751||0xc8;return function(_0x37e3f2){if(_0x37e3f2){return _0x3a7033['status'](_0x3b0751)[_0x7174('0x1b')](_0x37e3f2);}};}function respondWithFilteredResult(_0x3100df,_0x2ff80b){return function(_0x395f86){if(_0x395f86){var _0xfb5250=typeof _0x2ff80b[_0x7174('0x1c')]===_0x7174('0x1d')&&typeof _0x2ff80b[_0x7174('0x1e')]==='undefined';var _0x4878dc=_0x395f86[_0x7174('0x1f')];var _0x27b746=_0xfb5250?0x0:_0x2ff80b[_0x7174('0x1c')];var _0x437615=_0xfb5250?_0x395f86[_0x7174('0x1f')]:_0x2ff80b[_0x7174('0x1c')]+_0x2ff80b[_0x7174('0x1e')];var _0x4cade9;if(_0x437615>=_0x4878dc){_0x437615=_0x4878dc;_0x4cade9=0xc8;}else{_0x4cade9=0xce;}_0x3100df[_0x7174('0x19')](_0x4cade9);return _0x3100df[_0x7174('0x20')](_0x7174('0x21'),_0x27b746+'-'+_0x437615+'/'+_0x4878dc)['json'](_0x395f86);}return null;};}function patchUpdates(_0x568a83){return function(_0x38ff87){try{jsonpatch['apply'](_0x38ff87,_0x568a83,!![]);}catch(_0x1ae035){return BPromise['reject'](_0x1ae035);}return _0x38ff87[_0x7174('0x22')]();};}function saveUpdates(_0x3cb54f,_0x4076e0){return function(_0x2897d0){if(_0x2897d0){return _0x2897d0[_0x7174('0x23')](_0x3cb54f)[_0x7174('0x24')](function(_0x4f7f4a){return _0x4f7f4a;});}return null;};}function removeEntity(_0x5eec1d,_0x20c525){return function(_0x3fbe87){if(_0x3fbe87){return _0x3fbe87[_0x7174('0x25')]()[_0x7174('0x24')](function(){_0x5eec1d[_0x7174('0x19')](0xcc)[_0x7174('0x1a')]();});}};}function handleEntityNotFound(_0x568f00,_0x33881e){return function(_0x3e7e1f){if(!_0x3e7e1f){_0x568f00['sendStatus'](0x194);}return _0x3e7e1f;};}function handleError(_0x1a15e3,_0x17f012){_0x17f012=_0x17f012||0x1f4;return function(_0x1b1502){logger[_0x7174('0x26')](_0x1b1502['stack']);if(_0x1b1502[_0x7174('0x27')]){delete _0x1b1502[_0x7174('0x27')];}_0x1a15e3['status'](_0x17f012)[_0x7174('0x28')](_0x1b1502);};}exports[_0x7174('0x29')]=function(_0x133a67,_0x45db91){var _0x5ac78a={},_0x4fa4bf={},_0x5aeaa3={'count':0x0,'rows':[]};var _0x5c4bc0=_[_0x7174('0x2a')](db[_0x7174('0x2b')][_0x7174('0x2c')],function(_0x3dcd56){return{'name':_0x3dcd56[_0x7174('0x2d')],'type':_0x3dcd56['type'][_0x7174('0x2e')]};});_0x4fa4bf['model']=_[_0x7174('0x2a')](_0x5c4bc0,_0x7174('0x27'));_0x4fa4bf[_0x7174('0x2f')]=_['keys'](_0x133a67['query']);_0x4fa4bf[_0x7174('0x30')]=_[_0x7174('0x31')](_0x4fa4bf['model'],_0x4fa4bf[_0x7174('0x2f')]);_0x5ac78a['attributes']=_[_0x7174('0x31')](_0x4fa4bf[_0x7174('0x32')],qs[_0x7174('0x33')](_0x133a67[_0x7174('0x2f')]['fields']));_0x5ac78a[_0x7174('0x34')]=_0x5ac78a['attributes']['length']?_0x5ac78a[_0x7174('0x34')]:_0x4fa4bf[_0x7174('0x32')];if(!_0x133a67[_0x7174('0x2f')][_0x7174('0x35')](_0x7174('0x36'))){_0x5ac78a[_0x7174('0x1e')]=qs[_0x7174('0x1e')](_0x133a67['query'][_0x7174('0x1e')]);_0x5ac78a[_0x7174('0x1c')]=qs['offset'](_0x133a67[_0x7174('0x2f')][_0x7174('0x1c')]);}_0x5ac78a[_0x7174('0x37')]=qs[_0x7174('0x38')](_0x133a67[_0x7174('0x2f')][_0x7174('0x38')]);_0x5ac78a[_0x7174('0x39')]=qs[_0x7174('0x30')](_[_0x7174('0x3a')](_0x133a67[_0x7174('0x2f')],_0x4fa4bf[_0x7174('0x30')]),_0x5c4bc0);if(_0x133a67[_0x7174('0x2f')]['filter']){_0x5ac78a['where']=_[_0x7174('0x3b')](_0x5ac78a['where'],{'$or':_[_0x7174('0x2a')](_0x5c4bc0,function(_0x4e7352){if(_0x4e7352['type']!==_0x7174('0x3c')){var _0x4b575c={};_0x4b575c[_0x4e7352[_0x7174('0x27')]]={'$like':'%'+_0x133a67[_0x7174('0x2f')]['filter']+'%'};return _0x4b575c;}})});}_0x5ac78a=_[_0x7174('0x3b')]({},_0x5ac78a,_0x133a67[_0x7174('0x3d')]);var _0x564113={'where':_0x5ac78a[_0x7174('0x39')]};return db[_0x7174('0x2b')]['count'](_0x564113)[_0x7174('0x24')](function(_0x1ac300){_0x5aeaa3[_0x7174('0x1f')]=_0x1ac300;if(_0x133a67[_0x7174('0x2f')][_0x7174('0x3e')]){_0x5ac78a[_0x7174('0x3f')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x5ac78a);})[_0x7174('0x24')](function(_0xc1b028){_0x5aeaa3[_0x7174('0x40')]=_0xc1b028;return _0x5aeaa3;})['then'](respondWithFilteredResult(_0x45db91,_0x5ac78a))[_0x7174('0x41')](handleError(_0x45db91,null));};exports[_0x7174('0x42')]=function(_0x45e871,_0xbc27b8){var _0x1ddf19={'raw':![],'where':{'id':_0x45e871['params']['id']}},_0x4e7c3d={};_0x4e7c3d[_0x7174('0x32')]=_[_0x7174('0x43')](db[_0x7174('0x2b')]['rawAttributes']);_0x4e7c3d[_0x7174('0x2f')]=_[_0x7174('0x43')](_0x45e871['query']);_0x4e7c3d[_0x7174('0x30')]=_[_0x7174('0x31')](_0x4e7c3d['model'],_0x4e7c3d['query']);_0x1ddf19[_0x7174('0x34')]=_[_0x7174('0x31')](_0x4e7c3d[_0x7174('0x32')],qs['fields'](_0x45e871[_0x7174('0x2f')]['fields']));_0x1ddf19[_0x7174('0x34')]=_0x1ddf19[_0x7174('0x34')]['length']?_0x1ddf19['attributes']:_0x4e7c3d[_0x7174('0x32')];if(_0x45e871[_0x7174('0x2f')]['includeAll']){_0x1ddf19['include']=[{'all':!![]}];}_0x1ddf19=_[_0x7174('0x3b')]({},_0x1ddf19,_0x45e871[_0x7174('0x3d')]);return db[_0x7174('0x2b')]['find'](_0x1ddf19)[_0x7174('0x24')](handleEntityNotFound(_0xbc27b8,null))[_0x7174('0x24')](respondWithResult(_0xbc27b8,null))[_0x7174('0x41')](handleError(_0xbc27b8,null));};exports[_0x7174('0x44')]=function(_0x164d38,_0x29b47f){return db[_0x7174('0x2b')][_0x7174('0x44')](_0x164d38[_0x7174('0x45')],{})['then'](respondWithResult(_0x29b47f,0xc9))[_0x7174('0x41')](handleError(_0x29b47f,null));};exports[_0x7174('0x23')]=function(_0x388514,_0xd7db6){if(_0x388514[_0x7174('0x45')]['id']){delete _0x388514[_0x7174('0x45')]['id'];}return db[_0x7174('0x2b')]['find']({'where':{'id':_0x388514[_0x7174('0x46')]['id']}})['then'](handleEntityNotFound(_0xd7db6,null))[_0x7174('0x24')](saveUpdates(_0x388514[_0x7174('0x45')],null))[_0x7174('0x24')](respondWithResult(_0xd7db6,null))[_0x7174('0x41')](handleError(_0xd7db6,null));};exports['destroy']=function(_0x5b6945,_0x310869){return db[_0x7174('0x2b')][_0x7174('0x47')]({'where':{'id':_0x5b6945[_0x7174('0x46')]['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x310869,null))[_0x7174('0x24')](removeEntity(_0x310869,null))[_0x7174('0x41')](handleError(_0x310869,null));};exports[_0x7174('0x48')]=function(_0x197781,_0x133d07){return db[_0x7174('0x2b')]['describe']()[_0x7174('0x24')](respondWithResult(_0x133d07,null))['catch'](handleError(_0x133d07,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f9d97ed..3567799 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 _0x062d=['rimraf','./integrationReport.attributes','report_integration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x19f34f,_0xcce396){var _0x4d8d78=function(_0x2a087e){while(--_0x2a087e){_0x19f34f['push'](_0x19f34f['shift']());}};_0x4d8d78(++_0xcce396);}(_0x062d,0x111));var _0xd062=function(_0x33c638,_0x462bff){_0x33c638=_0x33c638-0x0;var _0x18a079=_0x062d[_0x33c638];return _0x18a079;};'use strict';var _=require(_0xd062('0x0'));var util=require(_0xd062('0x1'));var logger=require(_0xd062('0x2'))('api');var moment=require(_0xd062('0x3'));var BPromise=require(_0xd062('0x4'));var rp=require(_0xd062('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd062('0x6'));var config=require('../../config/environment');var attributes=require(_0xd062('0x7'));module['exports']=function(_0x5caa5b,_0x54c9f2){return _0x5caa5b['define']('IntegrationReport',attributes,{'tableName':_0xd062('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92f0=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2532a3,_0x1d1fac){var _0x53e3e2=function(_0xb8a9ed){while(--_0xb8a9ed){_0x2532a3['push'](_0x2532a3['shift']());}};_0x53e3e2(++_0x1d1fac);}(_0x92f0,0x173));var _0x092f=function(_0x5c4178,_0x11471c){_0x5c4178=_0x5c4178-0x0;var _0x384e71=_0x92f0[_0x5c4178];return _0x384e71;};'use strict';var _=require(_0x092f('0x0'));var util=require(_0x092f('0x1'));var logger=require(_0x092f('0x2'))(_0x092f('0x3'));var moment=require('moment');var BPromise=require(_0x092f('0x4'));var rp=require(_0x092f('0x5'));var fs=require('fs');var path=require(_0x092f('0x6'));var rimraf=require(_0x092f('0x7'));var config=require(_0x092f('0x8'));var attributes=require(_0x092f('0x9'));module[_0x092f('0xa')]=function(_0x1e5195,_0x27623f){return _0x1e5195[_0x092f('0xb')](_0x092f('0xc'),attributes,{'tableName':_0x092f('0xd'),'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 721bbe0..8492425 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0xe4cd7d,_0x3c7064){var _0x2ff977=function(_0x27db03){while(--_0x27db03){_0xe4cd7d['push'](_0xe4cd7d['shift']());}};_0x2ff977(++_0x3c7064);}(_0x2ef3,0xba));var _0x32ef=function(_0x2dd6ce,_0x36b833){_0x2dd6ce=_0x2dd6ce-0x0;var _0x9ec581=_0x2ef3[_0x2dd6ce];return _0x9ec581;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3627de,_0x3e3cb6){var _0x873f81=function(_0x51f7ee){while(--_0x51f7ee){_0x3627de['push'](_0x3627de['shift']());}};_0x873f81(++_0x3e3cb6);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x17ea3f,_0x739ac5){_0x17ea3f=_0x17ea3f-0x0;var _0x4164a8=_0xc6ac[_0x17ea3f];return _0x4164a8;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 295225f..afdf071 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 _0x4453=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x297661,_0x18bd85){var _0xefd391=function(_0xc7d087){while(--_0xc7d087){_0x297661['push'](_0x297661['shift']());}};_0xefd391(++_0x18bd85);}(_0x4453,0x9c));var _0x3445=function(_0x2351c6,_0x13d107){_0x2351c6=_0x2351c6-0x0;var _0x2c46e4=_0x4453[_0x2351c6];return _0x2c46e4;};'use strict';var multer=require(_0x3445('0x0'));var util=require(_0x3445('0x1'));var path=require('path');var timeout=require(_0x3445('0x2'));var express=require(_0x3445('0x3'));var router=express['Router']();var fs_extra=require(_0x3445('0x4'));var auth=require(_0x3445('0x5'));var interaction=require(_0x3445('0x6'));var config=require(_0x3445('0x7'));var controller=require(_0x3445('0x8'));router[_0x3445('0x9')]('/',auth[_0x3445('0xa')](),controller[_0x3445('0xb')]);router[_0x3445('0x9')](_0x3445('0xc'),auth['isAuthenticated'](),controller[_0x3445('0xd')]);router[_0x3445('0x9')](_0x3445('0xe'),auth[_0x3445('0xa')](),controller[_0x3445('0xf')]);router[_0x3445('0x10')]('/',auth[_0x3445('0xa')](),controller['create']);router[_0x3445('0x10')](_0x3445('0xe'),auth[_0x3445('0xa')](),controller[_0x3445('0x11')]);router['post'](_0x3445('0x12'),auth[_0x3445('0xa')](),controller[_0x3445('0x13')]);router[_0x3445('0x14')](_0x3445('0xc'),auth[_0x3445('0xa')](),controller[_0x3445('0x15')]);router['delete']('/:id',auth[_0x3445('0xa')](),controller['destroy']);module[_0x3445('0x16')]=router; \ No newline at end of file +var _0x42b0=['create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x42b0,0xbc));var _0x042b=function(_0x44a59b,_0x18f8a5){_0x44a59b=_0x44a59b-0x0;var _0x5382c5=_0x42b0[_0x44a59b];return _0x5382c5;};'use strict';var multer=require(_0x042b('0x0'));var util=require(_0x042b('0x1'));var path=require('path');var timeout=require(_0x042b('0x2'));var express=require('express');var router=express[_0x042b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x042b('0x4'));var config=require(_0x042b('0x5'));var controller=require(_0x042b('0x6'));router[_0x042b('0x7')]('/',auth[_0x042b('0x8')](),controller['index']);router['get'](_0x042b('0x9'),auth[_0x042b('0x8')](),controller['show']);router['get'](_0x042b('0xa'),auth['isAuthenticated'](),controller[_0x042b('0xb')]);router['post']('/',auth[_0x042b('0x8')](),controller[_0x042b('0xc')]);router[_0x042b('0xd')](_0x042b('0xa'),auth[_0x042b('0x8')](),controller[_0x042b('0xe')]);router[_0x042b('0xd')](_0x042b('0xf'),auth[_0x042b('0x8')](),controller[_0x042b('0x10')]);router[_0x042b('0x11')](_0x042b('0x9'),auth[_0x042b('0x8')](),controller['update']);router[_0x042b('0x12')]('/:id',auth[_0x042b('0x8')](),controller['destroy']);module[_0x042b('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 1e21bba..db9d8ef 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 _0x3c3f=['sequelize','exports','STRING'];(function(_0x4bc957,_0x36b3db){var _0x318dee=function(_0xcec6a9){while(--_0xcec6a9){_0x4bc957['push'](_0x4bc957['shift']());}};_0x318dee(++_0x36b3db);}(_0x3c3f,0x141));var _0xf3c3=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x3c3f[_0x39cf70];return _0x580424;};'use strict';var Sequelize=require(_0xf3c3('0x0'));module[_0xf3c3('0x1')]={'name':{'type':Sequelize[_0xf3c3('0x2')]},'description':{'type':Sequelize[_0xf3c3('0x2')]},'interval':{'type':Sequelize[_0xf3c3('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb905=['STRING','sequelize'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb905,0x6d));var _0x5b90=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb905[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x5b90('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b90('0x1')]},'description':{'type':Sequelize[_0x5b90('0x1')]},'interval':{'type':Sequelize[_0x5b90('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 377ac52..9de78ff 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 _0xd526=['get','Intervals','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Interval','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','options','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then'];(function(_0x3f9f9c,_0x5d6cc6){var _0x5bbd13=function(_0x5b2eb5){while(--_0x5b2eb5){_0x3f9f9c['push'](_0x3f9f9c['shift']());}};_0x5bbd13(++_0x5d6cc6);}(_0xd526,0xee));var _0x6d52=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd526[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x6d52('0x0'));var rimraf=require(_0x6d52('0x1'));var zipdir=require(_0x6d52('0x2'));var jsonpatch=require(_0x6d52('0x3'));var rp=require(_0x6d52('0x4'));var moment=require(_0x6d52('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6d52('0x6'));var util=require(_0x6d52('0x7'));var path=require(_0x6d52('0x8'));var sox=require(_0x6d52('0x9'));var csv=require(_0x6d52('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d52('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6d52('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6d52('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d52('0xe'));var Redis=require(_0x6d52('0xf'));var authService=require(_0x6d52('0x10'));var qs=require(_0x6d52('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d52('0x12'));var logger=require(_0x6d52('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6d52('0x14'));var licenseUtil=require(_0x6d52('0x15'));var db=require(_0x6d52('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4b0c00,_0x1bc9a4){_0x1bc9a4=_0x1bc9a4||0xcc;return function(_0xbe547b){if(_0xbe547b){return _0x4b0c00['sendStatus'](_0x1bc9a4);}return _0x4b0c00[_0x6d52('0x17')](_0x1bc9a4)[_0x6d52('0x18')]();};}function respondWithResult(_0x52b05c,_0x2afc6f){_0x2afc6f=_0x2afc6f||0xc8;return function(_0x20b136){if(_0x20b136){return _0x52b05c[_0x6d52('0x17')](_0x2afc6f)[_0x6d52('0x19')](_0x20b136);}};}function respondWithFilteredResult(_0x420cb2,_0x30ef52){return function(_0x3fbd61){if(_0x3fbd61){var _0x2953cf=typeof _0x30ef52[_0x6d52('0x1a')]===_0x6d52('0x1b')&&typeof _0x30ef52[_0x6d52('0x1c')]===_0x6d52('0x1b');var _0x1d4c45=_0x3fbd61[_0x6d52('0x1d')];var _0x9a8894=_0x2953cf?0x0:_0x30ef52[_0x6d52('0x1a')];var _0x110811=_0x2953cf?_0x3fbd61[_0x6d52('0x1d')]:_0x30ef52['offset']+_0x30ef52[_0x6d52('0x1c')];var _0x1fd9fd;if(_0x110811>=_0x1d4c45){_0x110811=_0x1d4c45;_0x1fd9fd=0xc8;}else{_0x1fd9fd=0xce;}_0x420cb2[_0x6d52('0x17')](_0x1fd9fd);return _0x420cb2[_0x6d52('0x1e')](_0x6d52('0x1f'),_0x9a8894+'-'+_0x110811+'/'+_0x1d4c45)['json'](_0x3fbd61);}return null;};}function patchUpdates(_0x42140f){return function(_0x9f01f6){try{jsonpatch['apply'](_0x9f01f6,_0x42140f,!![]);}catch(_0x12bcd9){return BPromise[_0x6d52('0x20')](_0x12bcd9);}return _0x9f01f6['save']();};}function saveUpdates(_0x1b5b0d,_0xff8124){return function(_0x2d95d4){if(_0x2d95d4){return _0x2d95d4['update'](_0x1b5b0d)['then'](function(_0x2e5521){return _0x2e5521;});}return null;};}function removeEntity(_0x2ed108,_0x1ff1a5){return function(_0xa4e80b){if(_0xa4e80b){return _0xa4e80b[_0x6d52('0x21')]()[_0x6d52('0x22')](function(){var _0x529def=_0xa4e80b[_0x6d52('0x23')]({'plain':!![]});var _0x25c310=_0x6d52('0x24');return db[_0x6d52('0x25')][_0x6d52('0x21')]({'where':{'type':_0x25c310,'resourceId':_0x529def['id']}})[_0x6d52('0x22')](function(){return _0xa4e80b;});})[_0x6d52('0x22')](function(){_0x2ed108[_0x6d52('0x17')](0xcc)[_0x6d52('0x18')]();});}};}function handleEntityNotFound(_0x2d1ac1,_0x27056f){return function(_0x5b44f6){if(!_0x5b44f6){_0x2d1ac1[_0x6d52('0x26')](0x194);}return _0x5b44f6;};}function handleError(_0x29863e,_0x27b7ed){_0x27b7ed=_0x27b7ed||0x1f4;return function(_0xdb35d2){logger[_0x6d52('0x27')](_0xdb35d2['stack']);if(_0xdb35d2[_0x6d52('0x28')]){delete _0xdb35d2['name'];}_0x29863e['status'](_0x27b7ed)[_0x6d52('0x29')](_0xdb35d2);};}exports[_0x6d52('0x2a')]=function(_0x3718d8,_0x5d983e){var _0x488427={},_0x5cccb5={},_0x17b8b7={'count':0x0,'rows':[]};var _0x21eeb2=_[_0x6d52('0x2b')](db['Interval'][_0x6d52('0x2c')],function(_0x131781){return{'name':_0x131781[_0x6d52('0x2d')],'type':_0x131781[_0x6d52('0x2e')][_0x6d52('0x2f')]};});_0x5cccb5[_0x6d52('0x30')]=_[_0x6d52('0x2b')](_0x21eeb2,'name');_0x5cccb5[_0x6d52('0x31')]=_[_0x6d52('0x32')](_0x3718d8['query']);_0x5cccb5[_0x6d52('0x33')]=_[_0x6d52('0x34')](_0x5cccb5['model'],_0x5cccb5['query']);_0x488427['attributes']=_[_0x6d52('0x34')](_0x5cccb5[_0x6d52('0x30')],qs[_0x6d52('0x35')](_0x3718d8[_0x6d52('0x31')][_0x6d52('0x35')]));_0x488427[_0x6d52('0x36')]=_0x488427[_0x6d52('0x36')][_0x6d52('0x37')]?_0x488427[_0x6d52('0x36')]:_0x5cccb5[_0x6d52('0x30')];if(!_0x3718d8['query']['hasOwnProperty'](_0x6d52('0x38'))){_0x488427['limit']=qs[_0x6d52('0x1c')](_0x3718d8[_0x6d52('0x31')][_0x6d52('0x1c')]);_0x488427[_0x6d52('0x1a')]=qs['offset'](_0x3718d8['query'][_0x6d52('0x1a')]);}_0x488427[_0x6d52('0x39')]=qs[_0x6d52('0x3a')](_0x3718d8['query'][_0x6d52('0x3a')]);_0x488427[_0x6d52('0x3b')]=qs[_0x6d52('0x33')](_[_0x6d52('0x3c')](_0x3718d8['query'],_0x5cccb5[_0x6d52('0x33')]),_0x21eeb2);if(_0x3718d8[_0x6d52('0x31')][_0x6d52('0x3d')]){_0x488427[_0x6d52('0x3b')]=_[_0x6d52('0x3e')](_0x488427[_0x6d52('0x3b')],{'$or':_[_0x6d52('0x2b')](_0x21eeb2,function(_0x61138b){if(_0x61138b['type']!==_0x6d52('0x3f')){var _0x570de4={};_0x570de4[_0x61138b[_0x6d52('0x28')]]={'$like':'%'+_0x3718d8[_0x6d52('0x31')]['filter']+'%'};return _0x570de4;}})});}_0x488427=_[_0x6d52('0x3e')]({},_0x488427,_0x3718d8['options']);var _0x1c1cf8={'where':_0x488427[_0x6d52('0x3b')]};return db[_0x6d52('0x40')]['count'](_0x1c1cf8)[_0x6d52('0x22')](function(_0x4f5903){_0x17b8b7['count']=_0x4f5903;if(_0x3718d8['query']['includeAll']){_0x488427[_0x6d52('0x41')]=[{'all':!![]}];}return db[_0x6d52('0x40')][_0x6d52('0x42')](_0x488427);})[_0x6d52('0x22')](function(_0x1d35ff){_0x17b8b7[_0x6d52('0x43')]=_0x1d35ff;return _0x17b8b7;})['then'](respondWithFilteredResult(_0x5d983e,_0x488427))[_0x6d52('0x44')](handleError(_0x5d983e,null));};exports[_0x6d52('0x45')]=function(_0x5b42a1,_0x22f6e7){var _0x27a3bc={'raw':!![],'where':{'id':_0x5b42a1[_0x6d52('0x46')]['id']}},_0x591bb6={};_0x591bb6[_0x6d52('0x30')]=_[_0x6d52('0x32')](db[_0x6d52('0x40')][_0x6d52('0x2c')]);_0x591bb6[_0x6d52('0x31')]=_[_0x6d52('0x32')](_0x5b42a1[_0x6d52('0x31')]);_0x591bb6[_0x6d52('0x33')]=_[_0x6d52('0x34')](_0x591bb6['model'],_0x591bb6[_0x6d52('0x31')]);_0x27a3bc[_0x6d52('0x36')]=_[_0x6d52('0x34')](_0x591bb6[_0x6d52('0x30')],qs[_0x6d52('0x35')](_0x5b42a1[_0x6d52('0x31')][_0x6d52('0x35')]));_0x27a3bc['attributes']=_0x27a3bc[_0x6d52('0x36')][_0x6d52('0x37')]?_0x27a3bc[_0x6d52('0x36')]:_0x591bb6[_0x6d52('0x30')];if(_0x5b42a1[_0x6d52('0x31')][_0x6d52('0x47')]){_0x27a3bc['include']=[{'all':!![]}];}_0x27a3bc=_[_0x6d52('0x3e')]({},_0x27a3bc,_0x5b42a1['options']);return db[_0x6d52('0x40')][_0x6d52('0x48')](_0x27a3bc)[_0x6d52('0x22')](handleEntityNotFound(_0x22f6e7,null))[_0x6d52('0x22')](respondWithResult(_0x22f6e7,null))[_0x6d52('0x44')](handleError(_0x22f6e7,null));};exports[_0x6d52('0x49')]=function(_0x50e9b7,_0x55327e){return db[_0x6d52('0x40')][_0x6d52('0x49')](_0x50e9b7[_0x6d52('0x4a')],{})['then'](function(_0x112a3d){var _0x305c8a=_0x50e9b7['user'][_0x6d52('0x23')]({'plain':!![]});if(!_0x305c8a)throw new Error(_0x6d52('0x4b'));if(_0x305c8a['role']===_0x6d52('0x4c')){var _0x35f8a6=_0x112a3d[_0x6d52('0x23')]({'plain':!![]});var _0x5b6a7c=_0x6d52('0x24');return db[_0x6d52('0x4d')][_0x6d52('0x48')]({'where':{'name':_0x5b6a7c,'userProfileId':_0x305c8a[_0x6d52('0x4e')]},'raw':!![]})[_0x6d52('0x22')](function(_0x175392){if(_0x175392&&_0x175392[_0x6d52('0x4f')]===0x0){return db[_0x6d52('0x25')][_0x6d52('0x49')]({'name':_0x35f8a6['name'],'resourceId':_0x35f8a6['id'],'type':_0x175392[_0x6d52('0x28')],'sectionId':_0x175392['id']},{})['then'](function(){return _0x112a3d;});}else{return _0x112a3d;}})[_0x6d52('0x44')](function(_0x44523a){logger[_0x6d52('0x27')](_0x6d52('0x50'),_0x44523a);throw _0x44523a;});}return _0x112a3d;})[_0x6d52('0x22')](respondWithResult(_0x55327e,0xc9))[_0x6d52('0x44')](handleError(_0x55327e,null));};exports[_0x6d52('0x51')]=function(_0x49d5d9,_0x1f1ccc){if(_0x49d5d9['body']['id']){delete _0x49d5d9[_0x6d52('0x4a')]['id'];}return db[_0x6d52('0x40')][_0x6d52('0x48')]({'where':{'id':_0x49d5d9['params']['id']}})[_0x6d52('0x22')](handleEntityNotFound(_0x1f1ccc,null))[_0x6d52('0x22')](saveUpdates(_0x49d5d9[_0x6d52('0x4a')],null))[_0x6d52('0x22')](respondWithResult(_0x1f1ccc,null))[_0x6d52('0x44')](handleError(_0x1f1ccc,null));};exports['destroy']=function(_0x34b0be,_0x2d43ce){return db[_0x6d52('0x40')][_0x6d52('0x48')]({'where':{'id':_0x34b0be[_0x6d52('0x46')]['id']}})[_0x6d52('0x22')](handleEntityNotFound(_0x2d43ce,null))['then'](removeEntity(_0x2d43ce,null))[_0x6d52('0x44')](handleError(_0x2d43ce,null));};exports[_0x6d52('0x52')]=function(_0x2e4adc,_0x2f6c01,_0x2497b5){if(_0x2e4adc[_0x6d52('0x4a')]['id']){delete _0x2e4adc['body']['id'];}return db[_0x6d52('0x40')]['find']({'where':{'id':_0x2e4adc[_0x6d52('0x46')]['id']}})[_0x6d52('0x22')](handleEntityNotFound(_0x2f6c01,null))['then'](function(_0x3c8161){if(_0x3c8161){_0x2e4adc[_0x6d52('0x4a')][_0x6d52('0x53')]=_0x3c8161['id'];return db[_0x6d52('0x40')]['create'](_0x2e4adc['body']);}})['then'](respondWithResult(_0x2f6c01,null))[_0x6d52('0x44')](handleError(_0x2f6c01,null));};exports[_0x6d52('0x54')]=function(_0x120b63,_0x69e336,_0x32c75f){var _0x68124f={};var _0x2b016a={};var _0x939114;var _0x379fc6;return db[_0x6d52('0x40')][_0x6d52('0x55')]({'where':{'id':_0x120b63[_0x6d52('0x46')]['id']}})['then'](handleEntityNotFound(_0x69e336,null))[_0x6d52('0x22')](function(_0x5bfede){if(_0x5bfede){_0x939114=_0x5bfede;_0x2b016a[_0x6d52('0x30')]=_[_0x6d52('0x32')](db['Interval'][_0x6d52('0x2c')]);_0x2b016a[_0x6d52('0x31')]=_[_0x6d52('0x32')](_0x120b63['query']);_0x2b016a[_0x6d52('0x33')]=_[_0x6d52('0x34')](_0x2b016a[_0x6d52('0x30')],_0x2b016a[_0x6d52('0x31')]);_0x68124f[_0x6d52('0x36')]=_['intersection'](_0x2b016a['model'],qs[_0x6d52('0x35')](_0x120b63[_0x6d52('0x31')][_0x6d52('0x35')]));_0x68124f[_0x6d52('0x36')]=_0x68124f[_0x6d52('0x36')]['length']?_0x68124f[_0x6d52('0x36')]:_0x2b016a['model'];_0x68124f[_0x6d52('0x39')]=qs[_0x6d52('0x3a')](_0x120b63['query'][_0x6d52('0x3a')]);_0x68124f[_0x6d52('0x3b')]=qs[_0x6d52('0x33')](_[_0x6d52('0x3c')](_0x120b63[_0x6d52('0x31')],_0x2b016a[_0x6d52('0x33')]));if(_0x120b63['query'][_0x6d52('0x3d')]){_0x68124f[_0x6d52('0x3b')]=_[_0x6d52('0x3e')](_0x68124f[_0x6d52('0x3b')],{'$or':_[_0x6d52('0x2b')](_0x68124f[_0x6d52('0x36')],function(_0x180062){var _0xe83232={};_0xe83232[_0x180062]={'$like':'%'+_0x120b63['query'][_0x6d52('0x3d')]+'%'};return _0xe83232;})});}_0x68124f=_[_0x6d52('0x3e')]({},_0x68124f,_0x120b63[_0x6d52('0x56')]);return _0x939114[_0x6d52('0x54')](_0x68124f);}})[_0x6d52('0x22')](function(_0x45dc7b){if(_0x45dc7b){_0x379fc6=_0x45dc7b['length'];if(!_0x120b63[_0x6d52('0x31')]['hasOwnProperty'](_0x6d52('0x38'))){_0x68124f[_0x6d52('0x1c')]=qs[_0x6d52('0x1c')](_0x120b63[_0x6d52('0x31')][_0x6d52('0x1c')]);_0x68124f[_0x6d52('0x1a')]=qs[_0x6d52('0x1a')](_0x120b63[_0x6d52('0x31')][_0x6d52('0x1a')]);}return _0x939114[_0x6d52('0x54')](_0x68124f);}})[_0x6d52('0x22')](function(_0x3ff74a){if(_0x3ff74a){return _0x3ff74a?{'count':_0x379fc6,'rows':_0x3ff74a}:null;}})[_0x6d52('0x22')](respondWithResult(_0x69e336,null))[_0x6d52('0x44')](handleError(_0x69e336,null));};exports[_0x6d52('0x57')]=function(_0x312470,_0x5298ec,_0x57bc78){return db[_0x6d52('0x40')]['findOne']({'where':{'id':_0x312470[_0x6d52('0x46')]['id']}})['then'](handleEntityNotFound(_0x5298ec,null))[_0x6d52('0x22')](function(_0x1f52b2){if(_0x1f52b2){return db[_0x6d52('0x58')][_0x6d52('0x59')](function(_0x3e09f6){return db['Interval'][_0x6d52('0x21')]({'where':{'IntervalId':_0x312470[_0x6d52('0x46')]['id']},'transaction':_0x3e09f6})[_0x6d52('0x22')](function(_0x147770){var _0x6a3477=_['map'](_0x312470[_0x6d52('0x4a')],function(_0x4c874a){delete _0x4c874a['id'];_0x4c874a[_0x6d52('0x53')]=_0x312470[_0x6d52('0x46')]['id'];return _0x4c874a;});return db[_0x6d52('0x40')][_0x6d52('0x5a')](_0x6a3477,{'transaction':_0x3e09f6});});})[_0x6d52('0x22')](function(){return db[_0x6d52('0x40')]['findAll']({'where':{'IntervalId':_0x312470[_0x6d52('0x46')]['id']}});});}})['then'](respondWithResult(_0x5298ec,null))['catch'](handleError(_0x5298ec,null));}; \ No newline at end of file +var _0x4b9f=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','pick','getIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','rows','catch','show','params','merge'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x4b9f,0xc2));var _0xf4b9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4b9f[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xf4b9('0x0'));var rimraf=require(_0xf4b9('0x1'));var zipdir=require(_0xf4b9('0x2'));var jsonpatch=require(_0xf4b9('0x3'));var rp=require(_0xf4b9('0x4'));var moment=require(_0xf4b9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4b9('0x6'));var path=require(_0xf4b9('0x7'));var sox=require(_0xf4b9('0x8'));var csv=require(_0xf4b9('0x9'));var ejs=require(_0xf4b9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf4b9('0xb'));var jsforce=require(_0xf4b9('0xc'));var deskjs=require(_0xf4b9('0xd'));var toCsv=require(_0xf4b9('0x9'));var querystring=require('querystring');var Papa=require(_0xf4b9('0xe'));var Redis=require('ioredis');var authService=require(_0xf4b9('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4b9('0x10'));var logger=require('../../config/logger')(_0xf4b9('0x11'));var utils=require(_0xf4b9('0x12'));var config=require(_0xf4b9('0x13'));var licenseUtil=require(_0xf4b9('0x14'));var db=require(_0xf4b9('0x15'))['db'];var extensions=require(_0xf4b9('0x16'));function respondWithStatusCode(_0x148c30,_0x5aaa98){_0x5aaa98=_0x5aaa98||0xcc;return function(_0x3fe9d7){if(_0x3fe9d7){return _0x148c30[_0xf4b9('0x17')](_0x5aaa98);}return _0x148c30['status'](_0x5aaa98)[_0xf4b9('0x18')]();};}function respondWithResult(_0x44b621,_0x598383){_0x598383=_0x598383||0xc8;return function(_0x4c908a){if(_0x4c908a){return _0x44b621['status'](_0x598383)[_0xf4b9('0x19')](_0x4c908a);}};}function respondWithFilteredResult(_0x1e344b,_0x34d204){return function(_0x38818a){if(_0x38818a){var _0x56197a=typeof _0x34d204[_0xf4b9('0x1a')]===_0xf4b9('0x1b')&&typeof _0x34d204[_0xf4b9('0x1c')]===_0xf4b9('0x1b');var _0x10e50c=_0x38818a[_0xf4b9('0x1d')];var _0xdb8ac8=_0x56197a?0x0:_0x34d204['offset'];var _0x1f5e68=_0x56197a?_0x38818a[_0xf4b9('0x1d')]:_0x34d204[_0xf4b9('0x1a')]+_0x34d204[_0xf4b9('0x1c')];var _0x495d29;if(_0x1f5e68>=_0x10e50c){_0x1f5e68=_0x10e50c;_0x495d29=0xc8;}else{_0x495d29=0xce;}_0x1e344b[_0xf4b9('0x1e')](_0x495d29);return _0x1e344b['set'](_0xf4b9('0x1f'),_0xdb8ac8+'-'+_0x1f5e68+'/'+_0x10e50c)[_0xf4b9('0x19')](_0x38818a);}return null;};}function patchUpdates(_0x27af55){return function(_0x115808){try{jsonpatch[_0xf4b9('0x20')](_0x115808,_0x27af55,!![]);}catch(_0x1d599e){return BPromise[_0xf4b9('0x21')](_0x1d599e);}return _0x115808['save']();};}function saveUpdates(_0x44f677,_0x331ab5){return function(_0x54b4a6){if(_0x54b4a6){return _0x54b4a6[_0xf4b9('0x22')](_0x44f677)[_0xf4b9('0x23')](function(_0xb9ce1b){return _0xb9ce1b;});}return null;};}function removeEntity(_0x2d61e3,_0x294693){return function(_0x24c7c8){if(_0x24c7c8){return _0x24c7c8[_0xf4b9('0x24')]()[_0xf4b9('0x23')](function(){var _0x1c05f0=_0x24c7c8[_0xf4b9('0x25')]({'plain':!![]});var _0xe6c9b2=_0xf4b9('0x26');return db[_0xf4b9('0x27')]['destroy']({'where':{'type':_0xe6c9b2,'resourceId':_0x1c05f0['id']}})[_0xf4b9('0x23')](function(){return _0x24c7c8;});})[_0xf4b9('0x23')](function(){_0x2d61e3['status'](0xcc)[_0xf4b9('0x18')]();});}};}function handleEntityNotFound(_0x3c2728,_0x3795f4){return function(_0x2b6b1f){if(!_0x2b6b1f){_0x3c2728[_0xf4b9('0x17')](0x194);}return _0x2b6b1f;};}function handleError(_0x4a4731,_0x28cf9f){_0x28cf9f=_0x28cf9f||0x1f4;return function(_0x177b2c){logger[_0xf4b9('0x28')](_0x177b2c[_0xf4b9('0x29')]);if(_0x177b2c[_0xf4b9('0x2a')]){delete _0x177b2c['name'];}_0x4a4731[_0xf4b9('0x1e')](_0x28cf9f)[_0xf4b9('0x2b')](_0x177b2c);};}exports[_0xf4b9('0x2c')]=function(_0x10fcdd,_0x23d155){var _0x38d1bf={},_0x296a9c={},_0xa96ec0={'count':0x0,'rows':[]};var _0x312c5d=_[_0xf4b9('0x2d')](db[_0xf4b9('0x2e')][_0xf4b9('0x2f')],function(_0x37186b){return{'name':_0x37186b[_0xf4b9('0x30')],'type':_0x37186b[_0xf4b9('0x31')]['key']};});_0x296a9c['model']=_['map'](_0x312c5d,_0xf4b9('0x2a'));_0x296a9c['query']=_[_0xf4b9('0x32')](_0x10fcdd[_0xf4b9('0x33')]);_0x296a9c[_0xf4b9('0x34')]=_[_0xf4b9('0x35')](_0x296a9c[_0xf4b9('0x36')],_0x296a9c[_0xf4b9('0x33')]);_0x38d1bf[_0xf4b9('0x37')]=_[_0xf4b9('0x35')](_0x296a9c[_0xf4b9('0x36')],qs['fields'](_0x10fcdd['query'][_0xf4b9('0x38')]));_0x38d1bf[_0xf4b9('0x37')]=_0x38d1bf[_0xf4b9('0x37')][_0xf4b9('0x39')]?_0x38d1bf[_0xf4b9('0x37')]:_0x296a9c[_0xf4b9('0x36')];if(!_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3a')](_0xf4b9('0x3b'))){_0x38d1bf['limit']=qs[_0xf4b9('0x1c')](_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x1c')]);_0x38d1bf['offset']=qs[_0xf4b9('0x1a')](_0x10fcdd[_0xf4b9('0x33')]['offset']);}_0x38d1bf[_0xf4b9('0x3c')]=qs['sort'](_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3d')]);_0x38d1bf[_0xf4b9('0x3e')]=qs[_0xf4b9('0x34')](_['pick'](_0x10fcdd['query'],_0x296a9c[_0xf4b9('0x34')]),_0x312c5d);if(_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3f')]){_0x38d1bf['where']=_['merge'](_0x38d1bf[_0xf4b9('0x3e')],{'$or':_[_0xf4b9('0x2d')](_0x312c5d,function(_0x1e52d4){if(_0x1e52d4[_0xf4b9('0x31')]!=='VIRTUAL'){var _0x2a63aa={};_0x2a63aa[_0x1e52d4[_0xf4b9('0x2a')]]={'$like':'%'+_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x3f')]+'%'};return _0x2a63aa;}})});}_0x38d1bf=_['merge']({},_0x38d1bf,_0x10fcdd[_0xf4b9('0x40')]);var _0x279dc2={'where':_0x38d1bf[_0xf4b9('0x3e')]};return db[_0xf4b9('0x2e')][_0xf4b9('0x1d')](_0x279dc2)[_0xf4b9('0x23')](function(_0x182fb2){_0xa96ec0[_0xf4b9('0x1d')]=_0x182fb2;if(_0x10fcdd[_0xf4b9('0x33')][_0xf4b9('0x41')]){_0x38d1bf[_0xf4b9('0x42')]=[{'all':!![]}];}return db[_0xf4b9('0x2e')][_0xf4b9('0x43')](_0x38d1bf);})['then'](function(_0x5d74a){_0xa96ec0[_0xf4b9('0x44')]=_0x5d74a;return _0xa96ec0;})[_0xf4b9('0x23')](respondWithFilteredResult(_0x23d155,_0x38d1bf))[_0xf4b9('0x45')](handleError(_0x23d155,null));};exports[_0xf4b9('0x46')]=function(_0x1a8223,_0x5f284e){var _0x2b611d={'raw':!![],'where':{'id':_0x1a8223[_0xf4b9('0x47')]['id']}},_0x287a51={};_0x287a51['model']=_[_0xf4b9('0x32')](db[_0xf4b9('0x2e')][_0xf4b9('0x2f')]);_0x287a51[_0xf4b9('0x33')]=_['keys'](_0x1a8223[_0xf4b9('0x33')]);_0x287a51[_0xf4b9('0x34')]=_[_0xf4b9('0x35')](_0x287a51[_0xf4b9('0x36')],_0x287a51[_0xf4b9('0x33')]);_0x2b611d['attributes']=_[_0xf4b9('0x35')](_0x287a51[_0xf4b9('0x36')],qs[_0xf4b9('0x38')](_0x1a8223[_0xf4b9('0x33')][_0xf4b9('0x38')]));_0x2b611d[_0xf4b9('0x37')]=_0x2b611d[_0xf4b9('0x37')][_0xf4b9('0x39')]?_0x2b611d[_0xf4b9('0x37')]:_0x287a51[_0xf4b9('0x36')];if(_0x1a8223[_0xf4b9('0x33')][_0xf4b9('0x41')]){_0x2b611d[_0xf4b9('0x42')]=[{'all':!![]}];}_0x2b611d=_[_0xf4b9('0x48')]({},_0x2b611d,_0x1a8223[_0xf4b9('0x40')]);return db['Interval'][_0xf4b9('0x49')](_0x2b611d)[_0xf4b9('0x23')](handleEntityNotFound(_0x5f284e,null))[_0xf4b9('0x23')](respondWithResult(_0x5f284e,null))[_0xf4b9('0x45')](handleError(_0x5f284e,null));};exports[_0xf4b9('0x4a')]=function(_0x13ae85,_0x21a8a6){return db[_0xf4b9('0x2e')][_0xf4b9('0x4a')](_0x13ae85[_0xf4b9('0x4b')],{})['then'](function(_0x2fff52){var _0x2b502e=_0x13ae85[_0xf4b9('0x4c')][_0xf4b9('0x25')]({'plain':!![]});if(!_0x2b502e)throw new Error(_0xf4b9('0x4d'));if(_0x2b502e['role']===_0xf4b9('0x4c')){var _0x139ed6=_0x2fff52[_0xf4b9('0x25')]({'plain':!![]});var _0x2dde80=_0xf4b9('0x26');return db[_0xf4b9('0x4e')][_0xf4b9('0x49')]({'where':{'name':_0x2dde80,'userProfileId':_0x2b502e[_0xf4b9('0x4f')]},'raw':!![]})['then'](function(_0x175965){if(_0x175965&&_0x175965[_0xf4b9('0x50')]===0x0){return db[_0xf4b9('0x27')]['create']({'name':_0x139ed6[_0xf4b9('0x2a')],'resourceId':_0x139ed6['id'],'type':_0x175965[_0xf4b9('0x2a')],'sectionId':_0x175965['id']},{})[_0xf4b9('0x23')](function(){return _0x2fff52;});}else{return _0x2fff52;}})[_0xf4b9('0x45')](function(_0x1204ea){logger[_0xf4b9('0x28')](_0xf4b9('0x51'),_0x1204ea);throw _0x1204ea;});}return _0x2fff52;})[_0xf4b9('0x23')](respondWithResult(_0x21a8a6,0xc9))[_0xf4b9('0x45')](handleError(_0x21a8a6,null));};exports[_0xf4b9('0x22')]=function(_0x30622b,_0x4ff42b){if(_0x30622b[_0xf4b9('0x4b')]['id']){delete _0x30622b[_0xf4b9('0x4b')]['id'];}return db[_0xf4b9('0x2e')]['find']({'where':{'id':_0x30622b[_0xf4b9('0x47')]['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x4ff42b,null))[_0xf4b9('0x23')](saveUpdates(_0x30622b[_0xf4b9('0x4b')],null))[_0xf4b9('0x23')](respondWithResult(_0x4ff42b,null))[_0xf4b9('0x45')](handleError(_0x4ff42b,null));};exports[_0xf4b9('0x24')]=function(_0x4dd1b9,_0x378e40){return db[_0xf4b9('0x2e')][_0xf4b9('0x49')]({'where':{'id':_0x4dd1b9[_0xf4b9('0x47')]['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x378e40,null))[_0xf4b9('0x23')](removeEntity(_0x378e40,null))['catch'](handleError(_0x378e40,null));};exports[_0xf4b9('0x52')]=function(_0x2792f9,_0x513f7c,_0x105f09){if(_0x2792f9[_0xf4b9('0x4b')]['id']){delete _0x2792f9['body']['id'];}return db[_0xf4b9('0x2e')]['find']({'where':{'id':_0x2792f9[_0xf4b9('0x47')]['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x513f7c,null))[_0xf4b9('0x23')](function(_0x4f37be){if(_0x4f37be){_0x2792f9['body'][_0xf4b9('0x53')]=_0x4f37be['id'];return db[_0xf4b9('0x2e')][_0xf4b9('0x4a')](_0x2792f9[_0xf4b9('0x4b')]);}})[_0xf4b9('0x23')](respondWithResult(_0x513f7c,null))[_0xf4b9('0x45')](handleError(_0x513f7c,null));};exports['getIntervals']=function(_0x320cce,_0x321c6c,_0x1305a0){var _0x462979={};var _0x414033={};var _0x4dba7b;var _0x32b10c;return db['Interval'][_0xf4b9('0x54')]({'where':{'id':_0x320cce[_0xf4b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x321c6c,null))[_0xf4b9('0x23')](function(_0xee1404){if(_0xee1404){_0x4dba7b=_0xee1404;_0x414033[_0xf4b9('0x36')]=_[_0xf4b9('0x32')](db[_0xf4b9('0x2e')][_0xf4b9('0x2f')]);_0x414033[_0xf4b9('0x33')]=_[_0xf4b9('0x32')](_0x320cce['query']);_0x414033[_0xf4b9('0x34')]=_['intersection'](_0x414033[_0xf4b9('0x36')],_0x414033[_0xf4b9('0x33')]);_0x462979[_0xf4b9('0x37')]=_[_0xf4b9('0x35')](_0x414033['model'],qs[_0xf4b9('0x38')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x38')]));_0x462979[_0xf4b9('0x37')]=_0x462979[_0xf4b9('0x37')][_0xf4b9('0x39')]?_0x462979[_0xf4b9('0x37')]:_0x414033['model'];_0x462979[_0xf4b9('0x3c')]=qs[_0xf4b9('0x3d')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3d')]);_0x462979['where']=qs[_0xf4b9('0x34')](_[_0xf4b9('0x55')](_0x320cce[_0xf4b9('0x33')],_0x414033['filters']));if(_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3f')]){_0x462979[_0xf4b9('0x3e')]=_[_0xf4b9('0x48')](_0x462979[_0xf4b9('0x3e')],{'$or':_[_0xf4b9('0x2d')](_0x462979[_0xf4b9('0x37')],function(_0x306dd4){var _0x39d442={};_0x39d442[_0x306dd4]={'$like':'%'+_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3f')]+'%'};return _0x39d442;})});}_0x462979=_['merge']({},_0x462979,_0x320cce[_0xf4b9('0x40')]);return _0x4dba7b[_0xf4b9('0x56')](_0x462979);}})[_0xf4b9('0x23')](function(_0x26c24a){if(_0x26c24a){_0x32b10c=_0x26c24a['length'];if(!_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x3a')](_0xf4b9('0x3b'))){_0x462979[_0xf4b9('0x1c')]=qs[_0xf4b9('0x1c')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x1c')]);_0x462979[_0xf4b9('0x1a')]=qs[_0xf4b9('0x1a')](_0x320cce[_0xf4b9('0x33')][_0xf4b9('0x1a')]);}return _0x4dba7b['getIntervals'](_0x462979);}})[_0xf4b9('0x23')](function(_0x5ca525){if(_0x5ca525){return _0x5ca525?{'count':_0x32b10c,'rows':_0x5ca525}:null;}})[_0xf4b9('0x23')](respondWithResult(_0x321c6c,null))[_0xf4b9('0x45')](handleError(_0x321c6c,null));};exports['addIntervals']=function(_0x2b94d5,_0x5a052e,_0x5c84f6){return db['Interval'][_0xf4b9('0x54')]({'where':{'id':_0x2b94d5['params']['id']}})[_0xf4b9('0x23')](handleEntityNotFound(_0x5a052e,null))[_0xf4b9('0x23')](function(_0x5a73ef){if(_0x5a73ef){return db[_0xf4b9('0x57')]['transaction'](function(_0x2d7752){return db[_0xf4b9('0x2e')][_0xf4b9('0x24')]({'where':{'IntervalId':_0x2b94d5[_0xf4b9('0x47')]['id']},'transaction':_0x2d7752})[_0xf4b9('0x23')](function(_0x14c411){var _0x2be81b=_[_0xf4b9('0x2d')](_0x2b94d5[_0xf4b9('0x4b')],function(_0x1b5f00){delete _0x1b5f00['id'];_0x1b5f00['IntervalId']=_0x2b94d5[_0xf4b9('0x47')]['id'];return _0x1b5f00;});return db['Interval'][_0xf4b9('0x58')](_0x2be81b,{'transaction':_0x2d7752});});})['then'](function(){return db[_0xf4b9('0x2e')][_0xf4b9('0x43')]({'where':{'IntervalId':_0x2b94d5[_0xf4b9('0x47')]['id']}});});}})[_0xf4b9('0x23')](respondWithResult(_0x5a052e,null))[_0xf4b9('0x45')](handleError(_0x5a052e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index dfeeb95..23026a4 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 _0x9b67=['bluebird','path','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','../../config/logger','api'];(function(_0x14e00a,_0x50dcc0){var _0x3f57fb=function(_0x23a236){while(--_0x23a236){_0x14e00a['push'](_0x14e00a['shift']());}};_0x3f57fb(++_0x50dcc0);}(_0x9b67,0xed));var _0x79b6=function(_0x17837c,_0x54ecb4){_0x17837c=_0x17837c-0x0;var _0x5e2e9b=_0x9b67[_0x17837c];return _0x5e2e9b;};'use strict';var _=require(_0x79b6('0x0'));var util=require('util');var logger=require(_0x79b6('0x1'))(_0x79b6('0x2'));var moment=require('moment');var BPromise=require(_0x79b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79b6('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79b6('0x5'));var extensions=require(_0x79b6('0x6'));module['exports']=function(_0x461710,_0x32ae66){return _0x461710['define'](_0x79b6('0x7'),attributes,{'tableName':_0x79b6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x36f443,_0x312585){extensions[_0x79b6('0x9')](_0x461710,_0x36f443);},'afterBulkCreate':function(_0x2add60,_0x5d43f7,_0x33c27a){_0x33c27a();extensions['rewrite'](_0x461710,_0x2add60[0x0]);},'afterUpdate':function(_0x4acefa,_0x4c2947){extensions[_0x79b6('0x9')](_0x461710,_0x4acefa);},'afterDestroy':function(_0x4178ad,_0x44b5c6){extensions[_0x79b6('0x9')](_0x461710,_0x4178ad);}}});}; \ No newline at end of file +var _0xe4e2=['define','rewrite','lodash','api','moment','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe4e2,0x65));var _0x2e4e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe4e2[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x2e4e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2e4e('0x1'));var moment=require(_0x2e4e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e4e('0x3'));var rimraf=require(_0x2e4e('0x4'));var config=require(_0x2e4e('0x5'));var attributes=require(_0x2e4e('0x6'));var extensions=require(_0x2e4e('0x7'));module[_0x2e4e('0x8')]=function(_0x2a77ca,_0x566be6){return _0x2a77ca[_0x2e4e('0x9')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c5b74,_0x58102c){extensions[_0x2e4e('0xa')](_0x2a77ca,_0x2c5b74);},'afterBulkCreate':function(_0x4fcc73,_0x488844,_0x3199bc){_0x3199bc();extensions[_0x2e4e('0xa')](_0x2a77ca,_0x4fcc73[0x0]);},'afterUpdate':function(_0x20abe7,_0x1f5b88){extensions['rewrite'](_0x2a77ca,_0x20abe7);},'afterDestroy':function(_0x4ec192,_0x1762a8){extensions[_0x2e4e('0xa')](_0x2a77ca,_0x4ec192);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 175ee38..b127eb3 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(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_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 +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(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 3b40f6e..82b0f40 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x4e6b5e,_0x17b2f1){var _0x4c9460=function(_0x3cf400){while(--_0x3cf400){_0x4e6b5e['push'](_0x4e6b5e['shift']());}};_0x4c9460(++_0x17b2f1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x128633,_0x25c545){_0x128633=_0x128633-0x0;var _0x3e3923=_0x5f2f[_0x128633];return _0x3e3923;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 4f6b1fe..226caa9 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 _0xb862=['application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','parse','error','status','write','end','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','POST'];(function(_0x1010b3,_0x36a95d){var _0x2ce521=function(_0xe25254){while(--_0xe25254){_0x1010b3['push'](_0x1010b3['shift']());}};_0x2ce521(++_0x36a95d);}(_0xb862,0xc4));var _0x2b86=function(_0x2d910d,_0x11fc5e){_0x2d910d=_0x2d910d-0x0;var _0x56f94a=_0xb862[_0x2d910d];return _0x56f94a;};'use strict';var BPromise=require(_0x2b86('0x0'));var https=require(_0x2b86('0x1'));var logger=require(_0x2b86('0x2'))('api');var USERNAME=_0x2b86('0x3');var PASSWORD=_0x2b86('0x4');function openIssue(_0x4a1033,_0x60e224){var _0x228d80={'fields':{'project':{'key':_0x4a1033[_0x2b86('0x5')]||_0x2b86('0x6')},'summary':(_0x4a1033['summary']||_0x2b86('0x7'))+_0x2b86('0x8')+_0x4a1033['ip'],'description':_0x4a1033[_0x2b86('0x9')]||JSON[_0x2b86('0xa')](_0x4a1033),'issuetype':{'name':_0x4a1033[_0x2b86('0xb')]||_0x2b86('0xc')}}};_0x228d80['fields']['customfield_11500']=_0x4a1033[_0x2b86('0xd')];_0x228d80[_0x2b86('0xe')][_0x2b86('0xf')]=_0x4a1033['oldToken'];_0x228d80[_0x2b86('0xe')][_0x2b86('0x10')]=_0x4a1033[_0x2b86('0x11')];_0x228d80['fields'][_0x2b86('0x12')]=_0x4a1033[_0x2b86('0x13')];_0x228d80[_0x2b86('0xe')][_0x2b86('0x14')]=_0x4a1033[_0x2b86('0x15')];_0x228d80[_0x2b86('0xe')][_0x2b86('0x16')]=_0x4a1033['ip'];var _0x22425c={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x2b86('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x2b86('0x18'),'Authorization':_0x2b86('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x2b86('0x1a')](_0x2b86('0x1b'))}};var _0x237e29=JSON[_0x2b86('0xa')](_0x228d80);var _0x353ede=https[_0x2b86('0x1c')](_0x22425c,function(_0x41a066){_0x41a066[_0x2b86('0x1d')](_0x2b86('0x1e'));var _0x5bc9cc='';_0x41a066['on'](_0x2b86('0x1f'),function(_0x2257fc){_0x5bc9cc+=_0x2257fc;});_0x41a066['on']('end',function(){if(_0x60e224){return _0x60e224['status'](_0x41a066['statusCode'])['json'](JSON[_0x2b86('0x20')](_0x5bc9cc));}});});_0x353ede['on'](_0x2b86('0x21'),function(_0xf83a03){if(_0x60e224){return _0x60e224[_0x2b86('0x22')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x353ede[_0x2b86('0x23')](_0x237e29);_0x353ede[_0x2b86('0x24')]();}exports['openIssue']=openIssue;exports[_0x2b86('0x25')]=function(_0x55a378,_0x3a8d75){_0x55a378[_0x2b86('0x26')]['ip']=_0x55a378[_0x2b86('0x27')][_0x2b86('0x28')]||_0x55a378[_0x2b86('0x29')][_0x2b86('0x2a')]||_0x55a378[_0x2b86('0x2b')][_0x2b86('0x2a')]||_0x55a378[_0x2b86('0x29')]['socket'][_0x2b86('0x2a')];return openIssue(_0x55a378[_0x2b86('0x26')],_0x3a8d75);}; \ No newline at end of file +var _0xe71c=['api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','utf8','data','status','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','../../config/logger'];(function(_0x1d49d2,_0x4ab5b5){var _0x106fbf=function(_0x1ae539){while(--_0x1ae539){_0x1d49d2['push'](_0x1d49d2['shift']());}};_0x106fbf(++_0x4ab5b5);}(_0xe71c,0x1b6));var _0xce71=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xe71c[_0xadde88];return _0x3b8eb6;};'use strict';var BPromise=require(_0xce71('0x0'));var https=require('https');var logger=require(_0xce71('0x1'))(_0xce71('0x2'));var USERNAME=_0xce71('0x3');var PASSWORD=_0xce71('0x4');function openIssue(_0x5e87b4,_0x26e5fc){var _0x2e1174={'fields':{'project':{'key':_0x5e87b4[_0xce71('0x5')]||_0xce71('0x6')},'summary':(_0x5e87b4[_0xce71('0x7')]||_0xce71('0x8'))+'\x20from\x20'+_0x5e87b4['ip'],'description':_0x5e87b4[_0xce71('0x9')]||JSON[_0xce71('0xa')](_0x5e87b4),'issuetype':{'name':_0x5e87b4[_0xce71('0xb')]||_0xce71('0xc')}}};_0x2e1174[_0xce71('0xd')][_0xce71('0xe')]=_0x5e87b4[_0xce71('0xf')];_0x2e1174[_0xce71('0xd')][_0xce71('0x10')]=_0x5e87b4[_0xce71('0x11')];_0x2e1174[_0xce71('0xd')][_0xce71('0x12')]=_0x5e87b4['newToken'];_0x2e1174[_0xce71('0xd')]['customfield_11503']=_0x5e87b4[_0xce71('0x13')];_0x2e1174[_0xce71('0xd')][_0xce71('0x14')]=_0x5e87b4['reason'];_0x2e1174[_0xce71('0xd')][_0xce71('0x15')]=_0x5e87b4['ip'];var _0x36ae87={'host':_0xce71('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xce71('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xce71('0x18'),'Authorization':_0xce71('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xce71('0x1a')](_0xce71('0x1b'))}};var _0x46482b=JSON['stringify'](_0x2e1174);var _0x541004=https[_0xce71('0x1c')](_0x36ae87,function(_0x43450c){_0x43450c['setEncoding'](_0xce71('0x1d'));var _0xf333c8='';_0x43450c['on'](_0xce71('0x1e'),function(_0x542070){_0xf333c8+=_0x542070;});_0x43450c['on']('end',function(){if(_0x26e5fc){return _0x26e5fc[_0xce71('0x1f')](_0x43450c['statusCode'])[_0xce71('0x20')](JSON['parse'](_0xf333c8));}});});_0x541004['on']('error',function(_0x2656d8){if(_0x26e5fc){return _0x26e5fc[_0xce71('0x1f')](0x1f4)[_0xce71('0x20')]({'errors':[{'message':_0xce71('0x21'),'type':'api.jira'}]});}});_0x541004[_0xce71('0x22')](_0x46482b);_0x541004[_0xce71('0x23')]();}exports[_0xce71('0x24')]=openIssue;exports[_0xce71('0x25')]=function(_0x1af25a,_0x30168a){_0x1af25a['body']['ip']=_0x1af25a[_0xce71('0x26')][_0xce71('0x27')]||_0x1af25a[_0xce71('0x28')][_0xce71('0x29')]||_0x1af25a[_0xce71('0x2a')][_0xce71('0x29')]||_0x1af25a[_0xce71('0x28')][_0xce71('0x2a')][_0xce71('0x29')];return openIssue(_0x1af25a[_0xce71('0x2b')],_0x30168a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f0f741c..d4281b3 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0xac4a,0x13f));var _0xaac4=function(_0x48f3b6,_0x41cddf){_0x48f3b6=_0x48f3b6-0x0;var _0x270960=_0xac4a[_0x48f3b6];return _0x270960;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaac4('0xd')](_0xaac4('0xe'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);module[_0xaac4('0x12')]=router; \ No newline at end of file +var _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x42200d,_0x3609d4){var _0x1162ad=function(_0x5e6001){while(--_0x5e6001){_0x42200d['push'](_0x42200d['shift']());}};_0x1162ad(++_0x3609d4);}(_0x99e9,0xb4));var _0x999e=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0x99e9[_0x2be104];return _0x31c115;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f34775b..87f2225 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x17aba3,_0x1feeab){_0x17aba3=_0x17aba3-0x0;var _0x4cb57d=_0x7a54[_0x17aba3];return _0x4cb57d;};'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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x1e616b,_0x3915ce){_0x1e616b=_0x1e616b-0x0;var _0x30eab7=_0x7a54[_0x1e616b];return _0x30eab7;};'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 314f212..3aab0a9 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 _0xc474=['fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes'];(function(_0x28dfa7,_0x4dccac){var _0x1e1f6c=function(_0x179198){while(--_0x179198){_0x28dfa7['push'](_0x28dfa7['shift']());}};_0x1e1f6c(++_0x4dccac);}(_0xc474,0xfc));var _0x4c47=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc474[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x4c47('0x0'));var rimraf=require(_0x4c47('0x1'));var zipdir=require(_0x4c47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c47('0x3'));var moment=require(_0x4c47('0x4'));var BPromise=require(_0x4c47('0x5'));var Mustache=require(_0x4c47('0x6'));var util=require(_0x4c47('0x7'));var path=require(_0x4c47('0x8'));var sox=require(_0x4c47('0x9'));var csv=require(_0x4c47('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require(_0x4c47('0xd'));var jsforce=require(_0x4c47('0xe'));var deskjs=require(_0x4c47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c47('0x10'));var Papa=require(_0x4c47('0x11'));var Redis=require('ioredis');var authService=require(_0x4c47('0x12'));var qs=require(_0x4c47('0x13'));var as=require(_0x4c47('0x14'));var hardwareService=require(_0x4c47('0x15'));var logger=require('../../config/logger')(_0x4c47('0x16'));var utils=require('../../config/utils');var config=require(_0x4c47('0x17'));var licenseUtil=require(_0x4c47('0x18'));var db=require(_0x4c47('0x19'))['db'];function respondWithStatusCode(_0x496e7b,_0x429553){_0x429553=_0x429553||0xcc;return function(_0x16a4fd){if(_0x16a4fd){return _0x496e7b['sendStatus'](_0x429553);}return _0x496e7b[_0x4c47('0x1a')](_0x429553)['end']();};}function respondWithResult(_0x3d1b6a,_0x121f9e){_0x121f9e=_0x121f9e||0xc8;return function(_0x25d4dc){if(_0x25d4dc){return _0x3d1b6a[_0x4c47('0x1a')](_0x121f9e)['json'](_0x25d4dc);}};}function respondWithFilteredResult(_0xb53c24,_0x78f26b){return function(_0x16c7a9){if(_0x16c7a9){var _0xd162cc=typeof _0x78f26b['offset']==='undefined'&&typeof _0x78f26b['limit']===_0x4c47('0x1b');var _0x92a444=_0x16c7a9[_0x4c47('0x1c')];var _0x5727cf=_0xd162cc?0x0:_0x78f26b[_0x4c47('0x1d')];var _0x254dfc=_0xd162cc?_0x16c7a9[_0x4c47('0x1c')]:_0x78f26b[_0x4c47('0x1d')]+_0x78f26b['limit'];var _0x4cc984;if(_0x254dfc>=_0x92a444){_0x254dfc=_0x92a444;_0x4cc984=0xc8;}else{_0x4cc984=0xce;}_0xb53c24['status'](_0x4cc984);return _0xb53c24[_0x4c47('0x1e')](_0x4c47('0x1f'),_0x5727cf+'-'+_0x254dfc+'/'+_0x92a444)[_0x4c47('0x20')](_0x16c7a9);}return null;};}function patchUpdates(_0x3b156f){return function(_0x52de60){try{jsonpatch[_0x4c47('0x21')](_0x52de60,_0x3b156f,!![]);}catch(_0x27b61a){return BPromise[_0x4c47('0x22')](_0x27b61a);}return _0x52de60[_0x4c47('0x23')]();};}function saveUpdates(_0x20950c,_0x40a984){return function(_0x4d56eb){if(_0x4d56eb){return _0x4d56eb['update'](_0x20950c)['then'](function(_0x1a575a){return _0x1a575a;});}return null;};}function removeEntity(_0x275a10,_0x4d110d){return function(_0x3037a2){if(_0x3037a2){return _0x3037a2['destroy']()[_0x4c47('0x24')](function(){_0x275a10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592469,_0x3bacc9){return function(_0x3bd199){if(!_0x3bd199){_0x592469[_0x4c47('0x25')](0x194);}return _0x3bd199;};}function handleError(_0x4eff26,_0x33f440){_0x33f440=_0x33f440||0x1f4;return function(_0x2c0367){logger[_0x4c47('0x26')](_0x2c0367[_0x4c47('0x27')]);if(_0x2c0367[_0x4c47('0x28')]){delete _0x2c0367[_0x4c47('0x28')];}_0x4eff26[_0x4c47('0x1a')](_0x33f440)[_0x4c47('0x29')](_0x2c0367);};}exports['index']=function(_0x36e82b,_0x344a7d){var _0x590b56={},_0x491638={},_0x3b977d={'count':0x0,'rows':[]};var _0x56c130=_['map'](db[_0x4c47('0x2a')][_0x4c47('0x2b')],function(_0x12462a){return{'name':_0x12462a[_0x4c47('0x2c')],'type':_0x12462a[_0x4c47('0x2d')]['key']};});_0x491638[_0x4c47('0x2e')]=_['map'](_0x56c130,_0x4c47('0x28'));_0x491638[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x36e82b['query']);_0x491638['filters']=_['intersection'](_0x491638['model'],_0x491638[_0x4c47('0x2f')]);_0x590b56[_0x4c47('0x31')]=_[_0x4c47('0x32')](_0x491638['model'],qs[_0x4c47('0x33')](_0x36e82b['query'][_0x4c47('0x33')]));_0x590b56[_0x4c47('0x31')]=_0x590b56[_0x4c47('0x31')][_0x4c47('0x34')]?_0x590b56[_0x4c47('0x31')]:_0x491638[_0x4c47('0x2e')];if(!_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x35')]('nolimit')){_0x590b56[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x590b56['offset']=qs['offset'](_0x36e82b['query'][_0x4c47('0x1d')]);}_0x590b56[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x36e82b['query']['sort']);_0x590b56['where']=qs['filters'](_[_0x4c47('0x39')](_0x36e82b[_0x4c47('0x2f')],_0x491638[_0x4c47('0x3a')]),_0x56c130);if(_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x3b')]){_0x590b56['where']=_[_0x4c47('0x3c')](_0x590b56[_0x4c47('0x3d')],{'$or':_['map'](_0x56c130,function(_0x1c309b){if(_0x1c309b[_0x4c47('0x2d')]!==_0x4c47('0x3e')){var _0x418098={};_0x418098[_0x1c309b[_0x4c47('0x28')]]={'$like':'%'+_0x36e82b['query'][_0x4c47('0x3b')]+'%'};return _0x418098;}})});}_0x590b56=_[_0x4c47('0x3c')]({},_0x590b56,_0x36e82b[_0x4c47('0x3f')]);var _0x291666={'where':_0x590b56[_0x4c47('0x3d')]};return db['JscriptyAnswerReport'][_0x4c47('0x1c')](_0x291666)[_0x4c47('0x24')](function(_0x5a7135){_0x3b977d[_0x4c47('0x1c')]=_0x5a7135;if(_0x36e82b['query'][_0x4c47('0x40')]){_0x590b56[_0x4c47('0x41')]=[{'all':!![]}];}return db[_0x4c47('0x2a')]['findAll'](_0x590b56);})['then'](function(_0x164105){_0x3b977d[_0x4c47('0x42')]=_0x164105;return _0x3b977d;})[_0x4c47('0x24')](respondWithFilteredResult(_0x344a7d,_0x590b56))['catch'](handleError(_0x344a7d,null));};exports[_0x4c47('0x43')]=function(_0x10669d,_0x40057e){var _0x5a0b1f={'raw':!![],'where':{'id':_0x10669d[_0x4c47('0x44')]['id']}},_0x274596={};_0x274596[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x2a')][_0x4c47('0x2b')]);_0x274596[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x10669d[_0x4c47('0x2f')]);_0x274596[_0x4c47('0x3a')]=_['intersection'](_0x274596[_0x4c47('0x2e')],_0x274596[_0x4c47('0x2f')]);_0x5a0b1f['attributes']=_['intersection'](_0x274596[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x10669d['query'][_0x4c47('0x33')]));_0x5a0b1f[_0x4c47('0x31')]=_0x5a0b1f[_0x4c47('0x31')][_0x4c47('0x34')]?_0x5a0b1f[_0x4c47('0x31')]:_0x274596['model'];if(_0x10669d['query'][_0x4c47('0x40')]){_0x5a0b1f[_0x4c47('0x41')]=[{'all':!![]}];}_0x5a0b1f=_[_0x4c47('0x3c')]({},_0x5a0b1f,_0x10669d[_0x4c47('0x3f')]);return db[_0x4c47('0x2a')][_0x4c47('0x45')](_0x5a0b1f)[_0x4c47('0x24')](handleEntityNotFound(_0x40057e,null))['then'](respondWithResult(_0x40057e,null))[_0x4c47('0x46')](handleError(_0x40057e,null));};exports['create']=function(_0x40bbec,_0x460fef){return db[_0x4c47('0x2a')]['create'](_0x40bbec[_0x4c47('0x47')],{})[_0x4c47('0x24')](respondWithResult(_0x460fef,0xc9))[_0x4c47('0x46')](handleError(_0x460fef,null));};exports['update']=function(_0x125b18,_0x4ccb67){if(_0x125b18[_0x4c47('0x47')]['id']){delete _0x125b18['body']['id'];}return db[_0x4c47('0x2a')]['find']({'where':{'id':_0x125b18[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x4ccb67,null))[_0x4c47('0x24')](saveUpdates(_0x125b18[_0x4c47('0x47')],null))['then'](respondWithResult(_0x4ccb67,null))['catch'](handleError(_0x4ccb67,null));};exports[_0x4c47('0x48')]=function(_0x48ba62,_0x419ee3){return db[_0x4c47('0x2a')][_0x4c47('0x45')]({'where':{'id':_0x48ba62['params']['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x419ee3,null))[_0x4c47('0x24')](removeEntity(_0x419ee3,null))['catch'](handleError(_0x419ee3,null));};exports['describe']=function(_0x59d746,_0x479332){return db[_0x4c47('0x2a')][_0x4c47('0x49')]()[_0x4c47('0x24')](respondWithResult(_0x479332,null))[_0x4c47('0x46')](handleError(_0x479332,null));}; \ No newline at end of file +var _0x294b=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','catch','params','rawAttributes','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters'];(function(_0x297916,_0x354444){var _0x2b1b09=function(_0x349061){while(--_0x349061){_0x297916['push'](_0x297916['shift']());}};_0x2b1b09(++_0x354444);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb294('0x1'));var jsonpatch=require(_0xb294('0x2'));var rp=require(_0xb294('0x3'));var moment=require(_0xb294('0x4'));var BPromise=require(_0xb294('0x5'));var Mustache=require(_0xb294('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb294('0x7'));var csv=require(_0xb294('0x8'));var ejs=require(_0xb294('0x9'));var fs=require('fs');var fs_extra=require(_0xb294('0xa'));var _=require(_0xb294('0xb'));var squel=require('squel');var crypto=require(_0xb294('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb294('0xd'));var Papa=require(_0xb294('0xe'));var Redis=require(_0xb294('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb294('0x10'));var logger=require(_0xb294('0x11'))(_0xb294('0x12'));var utils=require(_0xb294('0x13'));var config=require(_0xb294('0x14'));var licenseUtil=require(_0xb294('0x15'));var db=require(_0xb294('0x16'))['db'];function respondWithStatusCode(_0x13a3fc,_0x2b2bb5){_0x2b2bb5=_0x2b2bb5||0xcc;return function(_0x3e0fe5){if(_0x3e0fe5){return _0x13a3fc['sendStatus'](_0x2b2bb5);}return _0x13a3fc['status'](_0x2b2bb5)[_0xb294('0x17')]();};}function respondWithResult(_0x4c0959,_0x4b5996){_0x4b5996=_0x4b5996||0xc8;return function(_0x22beca){if(_0x22beca){return _0x4c0959[_0xb294('0x18')](_0x4b5996)[_0xb294('0x19')](_0x22beca);}};}function respondWithFilteredResult(_0x366f8f,_0x3f7323){return function(_0x2f3b62){if(_0x2f3b62){var _0x1a4089=typeof _0x3f7323[_0xb294('0x1a')]===_0xb294('0x1b')&&typeof _0x3f7323[_0xb294('0x1c')]===_0xb294('0x1b');var _0x51110b=_0x2f3b62[_0xb294('0x1d')];var _0x1ecc68=_0x1a4089?0x0:_0x3f7323['offset'];var _0x5e8ce6=_0x1a4089?_0x2f3b62[_0xb294('0x1d')]:_0x3f7323[_0xb294('0x1a')]+_0x3f7323[_0xb294('0x1c')];var _0x449e81;if(_0x5e8ce6>=_0x51110b){_0x5e8ce6=_0x51110b;_0x449e81=0xc8;}else{_0x449e81=0xce;}_0x366f8f[_0xb294('0x18')](_0x449e81);return _0x366f8f['set']('Content-Range',_0x1ecc68+'-'+_0x5e8ce6+'/'+_0x51110b)[_0xb294('0x19')](_0x2f3b62);}return null;};}function patchUpdates(_0x46b2ac){return function(_0x526914){try{jsonpatch[_0xb294('0x1e')](_0x526914,_0x46b2ac,!![]);}catch(_0x18e7dd){return BPromise['reject'](_0x18e7dd);}return _0x526914[_0xb294('0x1f')]();};}function saveUpdates(_0x21b9b2,_0x33c416){return function(_0x4afd48){if(_0x4afd48){return _0x4afd48['update'](_0x21b9b2)[_0xb294('0x20')](function(_0x5bdc68){return _0x5bdc68;});}return null;};}function removeEntity(_0x36b173,_0x5be6d5){return function(_0x101339){if(_0x101339){return _0x101339['destroy']()[_0xb294('0x20')](function(){_0x36b173['status'](0xcc)[_0xb294('0x17')]();});}};}function handleEntityNotFound(_0x405b66,_0x2d0c62){return function(_0xabcb26){if(!_0xabcb26){_0x405b66[_0xb294('0x21')](0x194);}return _0xabcb26;};}function handleError(_0x469647,_0x2fe3a9){_0x2fe3a9=_0x2fe3a9||0x1f4;return function(_0x52853){logger[_0xb294('0x22')](_0x52853['stack']);if(_0x52853['name']){delete _0x52853[_0xb294('0x23')];}_0x469647[_0xb294('0x18')](_0x2fe3a9)[_0xb294('0x24')](_0x52853);};}exports[_0xb294('0x25')]=function(_0x47fca9,_0x59fbde){var _0x1167e5={},_0x3c2aa5={},_0x1efdb6={'count':0x0,'rows':[]};var _0x127ddd=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0xbb4a10){return{'name':_0xbb4a10[_0xb294('0x26')],'type':_0xbb4a10[_0xb294('0x27')][_0xb294('0x28')]};});_0x3c2aa5[_0xb294('0x29')]=_[_0xb294('0x2a')](_0x127ddd,_0xb294('0x23'));_0x3c2aa5[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x47fca9[_0xb294('0x2b')]);_0x3c2aa5[_0xb294('0x2d')]=_[_0xb294('0x2e')](_0x3c2aa5[_0xb294('0x29')],_0x3c2aa5['query']);_0x1167e5['attributes']=_[_0xb294('0x2e')](_0x3c2aa5['model'],qs[_0xb294('0x2f')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x2f')]));_0x1167e5[_0xb294('0x30')]=_0x1167e5['attributes'][_0xb294('0x31')]?_0x1167e5[_0xb294('0x30')]:_0x3c2aa5[_0xb294('0x29')];if(!_0x47fca9[_0xb294('0x2b')][_0xb294('0x32')]('nolimit')){_0x1167e5['limit']=qs['limit'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1c')]);_0x1167e5[_0xb294('0x1a')]=qs[_0xb294('0x1a')](_0x47fca9[_0xb294('0x2b')][_0xb294('0x1a')]);}_0x1167e5[_0xb294('0x33')]=qs['sort'](_0x47fca9[_0xb294('0x2b')][_0xb294('0x34')]);_0x1167e5[_0xb294('0x35')]=qs[_0xb294('0x2d')](_[_0xb294('0x36')](_0x47fca9[_0xb294('0x2b')],_0x3c2aa5[_0xb294('0x2d')]),_0x127ddd);if(_0x47fca9[_0xb294('0x2b')]['filter']){_0x1167e5['where']=_[_0xb294('0x37')](_0x1167e5['where'],{'$or':_[_0xb294('0x2a')](_0x127ddd,function(_0x565546){if(_0x565546[_0xb294('0x27')]!==_0xb294('0x38')){var _0x2c92cb={};_0x2c92cb[_0x565546[_0xb294('0x23')]]={'$like':'%'+_0x47fca9[_0xb294('0x2b')]['filter']+'%'};return _0x2c92cb;}})});}_0x1167e5=_['merge']({},_0x1167e5,_0x47fca9[_0xb294('0x39')]);var _0x2693ec={'where':_0x1167e5[_0xb294('0x35')]};return db[_0xb294('0x3a')][_0xb294('0x1d')](_0x2693ec)[_0xb294('0x20')](function(_0x4ef87e){_0x1efdb6['count']=_0x4ef87e;if(_0x47fca9[_0xb294('0x2b')][_0xb294('0x3b')]){_0x1167e5[_0xb294('0x3c')]=[{'all':!![]}];}return db[_0xb294('0x3a')]['findAll'](_0x1167e5);})['then'](function(_0x1da557){_0x1efdb6['rows']=_0x1da557;return _0x1efdb6;})[_0xb294('0x20')](respondWithFilteredResult(_0x59fbde,_0x1167e5))[_0xb294('0x3d')](handleError(_0x59fbde,null));};exports['show']=function(_0x572e98,_0x4c1f43){var _0x20b1a2={'raw':!![],'where':{'id':_0x572e98[_0xb294('0x3e')]['id']}},_0x164556={};_0x164556['model']=_[_0xb294('0x2c')](db[_0xb294('0x3a')][_0xb294('0x3f')]);_0x164556[_0xb294('0x2b')]=_[_0xb294('0x2c')](_0x572e98[_0xb294('0x2b')]);_0x164556[_0xb294('0x2d')]=_['intersection'](_0x164556['model'],_0x164556[_0xb294('0x2b')]);_0x20b1a2[_0xb294('0x30')]=_['intersection'](_0x164556['model'],qs[_0xb294('0x2f')](_0x572e98[_0xb294('0x2b')][_0xb294('0x2f')]));_0x20b1a2[_0xb294('0x30')]=_0x20b1a2['attributes'][_0xb294('0x31')]?_0x20b1a2['attributes']:_0x164556['model'];if(_0x572e98[_0xb294('0x2b')][_0xb294('0x3b')]){_0x20b1a2[_0xb294('0x3c')]=[{'all':!![]}];}_0x20b1a2=_[_0xb294('0x37')]({},_0x20b1a2,_0x572e98[_0xb294('0x39')]);return db['JscriptyAnswerReport'][_0xb294('0x40')](_0x20b1a2)[_0xb294('0x20')](handleEntityNotFound(_0x4c1f43,null))[_0xb294('0x20')](respondWithResult(_0x4c1f43,null))['catch'](handleError(_0x4c1f43,null));};exports['create']=function(_0xce4f4,_0x3cdc29){return db[_0xb294('0x3a')][_0xb294('0x41')](_0xce4f4[_0xb294('0x42')],{})['then'](respondWithResult(_0x3cdc29,0xc9))[_0xb294('0x3d')](handleError(_0x3cdc29,null));};exports[_0xb294('0x43')]=function(_0x459a69,_0x3156e2){if(_0x459a69[_0xb294('0x42')]['id']){delete _0x459a69[_0xb294('0x42')]['id'];}return db[_0xb294('0x3a')][_0xb294('0x40')]({'where':{'id':_0x459a69[_0xb294('0x3e')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x3156e2,null))['then'](saveUpdates(_0x459a69[_0xb294('0x42')],null))['then'](respondWithResult(_0x3156e2,null))[_0xb294('0x3d')](handleError(_0x3156e2,null));};exports[_0xb294('0x44')]=function(_0x249b59,_0xd64380){return db[_0xb294('0x3a')]['find']({'where':{'id':_0x249b59['params']['id']}})[_0xb294('0x20')](handleEntityNotFound(_0xd64380,null))[_0xb294('0x20')](removeEntity(_0xd64380,null))[_0xb294('0x3d')](handleError(_0xd64380,null));};exports[_0xb294('0x45')]=function(_0x5589c3,_0x10b068){return db[_0xb294('0x3a')][_0xb294('0x45')]()[_0xb294('0x20')](respondWithResult(_0x10b068,null))[_0xb294('0x3d')](handleError(_0x10b068,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9a6ddb5..96324d5 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 _0x32e8=['define','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x301385,_0x4fe4fe){var _0x4c8827=function(_0x17f5ba){while(--_0x17f5ba){_0x301385['push'](_0x301385['shift']());}};_0x4c8827(++_0x4fe4fe);}(_0x32e8,0xd2));var _0x832e=function(_0x4cb1c6,_0x1792a9){_0x4cb1c6=_0x4cb1c6-0x0;var _0x326aca=_0x32e8[_0x4cb1c6];return _0x326aca;};'use strict';var _=require(_0x832e('0x0'));var util=require(_0x832e('0x1'));var logger=require('../../config/logger')(_0x832e('0x2'));var moment=require(_0x832e('0x3'));var BPromise=require(_0x832e('0x4'));var rp=require(_0x832e('0x5'));var fs=require('fs');var path=require(_0x832e('0x6'));var rimraf=require(_0x832e('0x7'));var config=require(_0x832e('0x8'));var attributes=require(_0x832e('0x9'));module[_0x832e('0xa')]=function(_0x3e8b73,_0x1e8330){return _0x3e8b73[_0x832e('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0x832e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b50=['report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x284190,_0x13ed15){var _0x2ee544=function(_0x4bd36a){while(--_0x4bd36a){_0x284190['push'](_0x284190['shift']());}};_0x2ee544(++_0x13ed15);}(_0x7b50,0x151));var _0x07b5=function(_0x2ed7c2,_0x17d15b){_0x2ed7c2=_0x2ed7c2-0x0;var _0x3dc111=_0x7b50[_0x2ed7c2];return _0x3dc111;};'use strict';var _=require(_0x07b5('0x0'));var util=require(_0x07b5('0x1'));var logger=require(_0x07b5('0x2'))(_0x07b5('0x3'));var moment=require(_0x07b5('0x4'));var BPromise=require(_0x07b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x07b5('0x6'));var config=require(_0x07b5('0x7'));var attributes=require(_0x07b5('0x8'));module[_0x07b5('0x9')]=function(_0x3f9422,_0x28b7b5){return _0x3f9422['define'](_0x07b5('0xa'),attributes,{'tableName':_0x07b5('0xb'),'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 8d34ba0..039d606 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 _0x1dcd=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x328a3a,_0x5513cd){var _0x5eb6ef=function(_0x44d1ad){while(--_0x44d1ad){_0x328a3a['push'](_0x328a3a['shift']());}};_0x5eb6ef(++_0x5513cd);}(_0x1dcd,0x100));var _0xd1dc=function(_0x19df8e,_0xc8482){_0x19df8e=_0x19df8e-0x0;var _0x378598=_0x1dcd[_0x19df8e];return _0x378598;};'use strict';var _=require(_0xd1dc('0x0'));var util=require(_0xd1dc('0x1'));var moment=require(_0xd1dc('0x2'));var BPromise=require(_0xd1dc('0x3'));var rs=require(_0xd1dc('0x4'));var fs=require('fs');var Redis=require(_0xd1dc('0x5'));var db=require(_0xd1dc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1dc('0x7'))(_0xd1dc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd1dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57ed28,_0x35516d,_0x4184fe){return new BPromise(function(_0x3a2309,_0x556af5){return client['request'](_0x57ed28,_0x4184fe)[_0xd1dc('0xa')](function(_0x3b2316){logger[_0xd1dc('0xb')](_0xd1dc('0xc'),_0x35516d,_0xd1dc('0xd'));logger[_0xd1dc('0xe')](_0xd1dc('0xf'),_0x35516d,_0xd1dc('0xd'),JSON['stringify'](_0x3b2316));if(_0x3b2316['error']){if(_0x3b2316[_0xd1dc('0x10')]['code']===0x1f4){logger[_0xd1dc('0x10')](_0xd1dc('0xc'),_0x35516d,_0x3b2316[_0xd1dc('0x10')][_0xd1dc('0x11')]);return _0x556af5(_0x3b2316[_0xd1dc('0x10')][_0xd1dc('0x11')]);}logger[_0xd1dc('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x35516d,_0x3b2316[_0xd1dc('0x10')][_0xd1dc('0x11')]);return _0x3a2309(_0x3b2316[_0xd1dc('0x10')][_0xd1dc('0x11')]);}else{logger[_0xd1dc('0xb')](_0xd1dc('0xc'),_0x35516d,_0xd1dc('0xd'));_0x3a2309(_0x3b2316[_0xd1dc('0x12')][_0xd1dc('0x11')]);}})[_0xd1dc('0x13')](function(_0x4d2665){logger[_0xd1dc('0x10')](_0xd1dc('0xc'),_0x35516d,_0x4d2665);_0x556af5(_0x4d2665);});});} \ No newline at end of file +var _0x721b=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x721b,0x18d));var _0xb721=function(_0x4a070c,_0x55d6d5){_0x4a070c=_0x4a070c-0x0;var _0x169426=_0x721b[_0x4a070c];return _0x169426;};'use strict';var _=require(_0xb721('0x0'));var util=require('util');var moment=require(_0xb721('0x1'));var BPromise=require(_0xb721('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb721('0x3'));var db=require(_0xb721('0x4'))['db'];var utils=require(_0xb721('0x5'));var logger=require(_0xb721('0x6'))(_0xb721('0x7'));var config=require(_0xb721('0x8'));var jayson=require(_0xb721('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d064c,_0x2e8463,_0x31134d){return new BPromise(function(_0x5ee34a,_0x215a9d){return client[_0xb721('0xa')](_0x1d064c,_0x31134d)[_0xb721('0xb')](function(_0x4f468b){logger[_0xb721('0xc')](_0xb721('0xd'),_0x2e8463,_0xb721('0xe'));logger[_0xb721('0xf')](_0xb721('0x10'),_0x2e8463,_0xb721('0xe'),JSON[_0xb721('0x11')](_0x4f468b));if(_0x4f468b[_0xb721('0x12')]){if(_0x4f468b[_0xb721('0x12')][_0xb721('0x13')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e8463,_0x4f468b[_0xb721('0x12')][_0xb721('0x14')]);return _0x215a9d(_0x4f468b['error'][_0xb721('0x14')]);}logger['error'](_0xb721('0xd'),_0x2e8463,_0x4f468b[_0xb721('0x12')][_0xb721('0x14')]);return _0x5ee34a(_0x4f468b[_0xb721('0x12')][_0xb721('0x14')]);}else{logger['info'](_0xb721('0xd'),_0x2e8463,_0xb721('0xe'));_0x5ee34a(_0x4f468b[_0xb721('0x15')][_0xb721('0x14')]);}})[_0xb721('0x16')](function(_0xdb60f3){logger[_0xb721('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2e8463,_0xdb60f3);_0x215a9d(_0xdb60f3);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 86bdaf3..50a7d59 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 _0xabd8=['create','post','clone','put','update','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabd8,0xa0));var _0x8abd=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xabd8[_0x40bffc];return _0x3007e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8abd('0x0'));var timeout=require(_0x8abd('0x1'));var express=require(_0x8abd('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8abd('0x3'));var config=require(_0x8abd('0x4'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x8abd('0x5')](),controller[_0x8abd('0x6')]);router[_0x8abd('0x7')](_0x8abd('0x8'),auth[_0x8abd('0x5')](),controller[_0x8abd('0x9')]);router['get'](_0x8abd('0xa'),auth[_0x8abd('0x5')](),controller[_0x8abd('0xb')]);router[_0x8abd('0x7')](_0x8abd('0xc'),auth['isAuthenticated'](),controller[_0x8abd('0xd')]);router[_0x8abd('0x7')](_0x8abd('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0x8abd('0xf')]);router['post']('/',auth[_0x8abd('0x5')](),controller[_0x8abd('0x10')]);router[_0x8abd('0x11')]('/:id/clone',auth[_0x8abd('0x5')](),controller[_0x8abd('0x12')]);router[_0x8abd('0x13')](_0x8abd('0x8'),auth[_0x8abd('0x5')](),controller[_0x8abd('0x14')]);router['delete']('/:id',auth[_0x8abd('0x5')](),controller[_0x8abd('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb285=['getSessions','/:id/summary','post','create','clone','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','index','get','isAuthenticated','show','/:id/sessions'];(function(_0xf5535c,_0x53e0f6){var _0x5b28d8=function(_0x444569){while(--_0x444569){_0xf5535c['push'](_0xf5535c['shift']());}};_0x5b28d8(++_0x53e0f6);}(_0xb285,0xe6));var _0x5b28=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xb285[_0x59bcb1];return _0x4a737f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5b28('0x0'));var timeout=require(_0x5b28('0x1'));var express=require(_0x5b28('0x2'));var router=express[_0x5b28('0x3')]();var fs_extra=require(_0x5b28('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b28('0x5'));var controller=require(_0x5b28('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5b28('0x7')]);router[_0x5b28('0x8')]('/:id',auth[_0x5b28('0x9')](),controller[_0x5b28('0xa')]);router[_0x5b28('0x8')](_0x5b28('0xb'),auth[_0x5b28('0x9')](),controller[_0x5b28('0xc')]);router[_0x5b28('0x8')]('/:id/answers',auth[_0x5b28('0x9')](),controller['getAnswers']);router[_0x5b28('0x8')](_0x5b28('0xd'),auth[_0x5b28('0x9')](),timeout('30s'),controller['getSummary']);router[_0x5b28('0xe')]('/',auth[_0x5b28('0x9')](),controller[_0x5b28('0xf')]);router[_0x5b28('0xe')]('/:id/clone',auth[_0x5b28('0x9')](),controller[_0x5b28('0x10')]);router['put'](_0x5b28('0x11'),auth[_0x5b28('0x9')](),controller[_0x5b28('0x12')]);router[_0x5b28('0x13')](_0x5b28('0x11'),auth['isAuthenticated'](),controller[_0x5b28('0x14')]);module[_0x5b28('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e75c007..98bdde4 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 _0xc317=['sequelize','lodash','util','exports','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x324691,_0x5102ee){var _0xb80da3=function(_0x3a576e){while(--_0x3a576e){_0x324691['push'](_0x324691['shift']());}};_0xb80da3(++_0x5102ee);}(_0xc317,0x1a4));var _0x7c31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc317[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7c31('0x0'));var _=require(_0x7c31('0x1'));var util=require(_0x7c31('0x2'));module[_0x7c31('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7c31('0x4')](_0x7c31('0x5')),'set':function(_0x2ac201){if(_[_0x7c31('0x6')](_0x2ac201)){this[_0x7c31('0x7')](_0x7c31('0x8'),JSON['stringify'](_0x2ac201));}else if(_['isString'](_0x2ac201)){this['setDataValue'](_0x7c31('0x8'),_0x2ac201);}else{this[_0x7c31('0x7')](_0x7c31('0x8'),util[_0x7c31('0x9')](_0x7c31('0xa'),this[_0x7c31('0xb')]('name')||'',this[_0x7c31('0xb')](_0x7c31('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7c31('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7c31('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xf572=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','long','isObjectLike','setDataValue'];(function(_0x52a1c3,_0x2e34a0){var _0x43c896=function(_0x2fc232){while(--_0x2fc232){_0x52a1c3['push'](_0x52a1c3['shift']());}};_0x43c896(++_0x2e34a0);}(_0xf572,0x1b7));var _0x2f57=function(_0x4d78b4,_0x591ac0){_0x4d78b4=_0x4d78b4-0x0;var _0x1316f2=_0xf572[_0x4d78b4];return _0x1316f2;};'use strict';var Sequelize=require(_0x2f57('0x0'));var _=require(_0x2f57('0x1'));var util=require(_0x2f57('0x2'));module[_0x2f57('0x3')]={'name':{'type':Sequelize[_0x2f57('0x4')],'unique':_0x2f57('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x2f57('0x6')),'set':function(_0x31b420){if(_[_0x2f57('0x7')](_0x31b420)){this[_0x2f57('0x8')](_0x2f57('0x9'),JSON[_0x2f57('0xa')](_0x31b420));}else if(_[_0x2f57('0xb')](_0x31b420)){this[_0x2f57('0x8')](_0x2f57('0x9'),_0x31b420);}else{this[_0x2f57('0x8')](_0x2f57('0x9'),util[_0x2f57('0xc')](_0x2f57('0xd'),this[_0x2f57('0xe')](_0x2f57('0x5'))||'',this[_0x2f57('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2f57('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2f57('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 21ad843..d8a3d07 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 _0xb6fa=['../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','Projects','UserProfileResource','destroy','stack','map','JscriptyProject','rawAttributes','fieldName','type','key','name','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','params','length','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','clone','createdAt','updatedAt','omit','UserProfileSection','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','keys','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','eml-format','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x612bb6,_0x157ef4){var _0x59790b=function(_0x4e2008){while(--_0x4e2008){_0x612bb6['push'](_0x612bb6['shift']());}};_0x59790b(++_0x157ef4);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0xb6fa[_0x4358f5];return _0x4d8104;};'use strict';var emlformat=require(_0xab6f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab6f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab6f('0x2'));var Mustache=require(_0xab6f('0x3'));var util=require('util');var path=require(_0xab6f('0x4'));var sox=require(_0xab6f('0x5'));var csv=require(_0xab6f('0x6'));var ejs=require(_0xab6f('0x7'));var fs=require('fs');var fs_extra=require(_0xab6f('0x8'));var _=require(_0xab6f('0x9'));var squel=require(_0xab6f('0xa'));var crypto=require(_0xab6f('0xb'));var jsforce=require(_0xab6f('0xc'));var deskjs=require(_0xab6f('0xd'));var toCsv=require(_0xab6f('0x6'));var querystring=require(_0xab6f('0xe'));var Papa=require(_0xab6f('0xf'));var Redis=require(_0xab6f('0x10'));var authService=require(_0xab6f('0x11'));var qs=require(_0xab6f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab6f('0x13'))(_0xab6f('0x14'));var utils=require('../../config/utils');var config=require(_0xab6f('0x15'));var licenseUtil=require(_0xab6f('0x16'));var db=require(_0xab6f('0x17'))['db'];function respondWithStatusCode(_0x437b32,_0x139fcf){_0x139fcf=_0x139fcf||0xcc;return function(_0x245ac9){if(_0x245ac9){return _0x437b32[_0xab6f('0x18')](_0x139fcf);}return _0x437b32['status'](_0x139fcf)[_0xab6f('0x19')]();};}function respondWithResult(_0x17d180,_0x3b5791){_0x3b5791=_0x3b5791||0xc8;return function(_0x4df7a8){if(_0x4df7a8){return _0x17d180[_0xab6f('0x1a')](_0x3b5791)['json'](_0x4df7a8);}};}function respondWithFilteredResult(_0x49d9f1,_0x2a6aac){return function(_0x5eed74){if(_0x5eed74){var _0x422850=typeof _0x2a6aac[_0xab6f('0x1b')]===_0xab6f('0x1c')&&typeof _0x2a6aac['limit']===_0xab6f('0x1c');var _0x4ede75=_0x5eed74[_0xab6f('0x1d')];var _0x439b73=_0x422850?0x0:_0x2a6aac[_0xab6f('0x1b')];var _0x2f75c1=_0x422850?_0x5eed74[_0xab6f('0x1d')]:_0x2a6aac[_0xab6f('0x1b')]+_0x2a6aac[_0xab6f('0x1e')];var _0x48601f;if(_0x2f75c1>=_0x4ede75){_0x2f75c1=_0x4ede75;_0x48601f=0xc8;}else{_0x48601f=0xce;}_0x49d9f1[_0xab6f('0x1a')](_0x48601f);return _0x49d9f1[_0xab6f('0x1f')](_0xab6f('0x20'),_0x439b73+'-'+_0x2f75c1+'/'+_0x4ede75)['json'](_0x5eed74);}return null;};}function patchUpdates(_0x43eda0){return function(_0x375e68){try{jsonpatch[_0xab6f('0x21')](_0x375e68,_0x43eda0,!![]);}catch(_0x2c63dc){return BPromise[_0xab6f('0x22')](_0x2c63dc);}return _0x375e68[_0xab6f('0x23')]();};}function saveUpdates(_0x47fead,_0x4dc7c1){return function(_0x21194b){if(_0x21194b){return _0x21194b[_0xab6f('0x24')](_0x47fead)[_0xab6f('0x25')](function(_0x83e273){return _0x83e273;});}return null;};}function removeEntity(_0x15c3e6,_0x149321){return function(_0xb1ef77){if(_0xb1ef77){return _0xb1ef77['destroy']()[_0xab6f('0x25')](function(){var _0xf849b5=_0xb1ef77['get']({'plain':!![]});var _0x1f8db7=_0xab6f('0x26');return db[_0xab6f('0x27')][_0xab6f('0x28')]({'where':{'type':_0x1f8db7,'resourceId':_0xf849b5['id']}})[_0xab6f('0x25')](function(){return _0xb1ef77;});})['then'](function(){_0x15c3e6[_0xab6f('0x1a')](0xcc)[_0xab6f('0x19')]();});}};}function handleEntityNotFound(_0x4bcedd,_0x149fad){return function(_0x30e0fa){if(!_0x30e0fa){_0x4bcedd[_0xab6f('0x18')](0x194);}return _0x30e0fa;};}function handleError(_0x2f8ebc,_0x475703){_0x475703=_0x475703||0x1f4;return function(_0x181bab){logger['error'](_0x181bab[_0xab6f('0x29')]);if(_0x181bab['name']){delete _0x181bab['name'];}_0x2f8ebc['status'](_0x475703)['send'](_0x181bab);};}exports['index']=function(_0x14af68,_0xd58fdf){var _0x4110dd={},_0x3206b8={},_0x39b6b5={'count':0x0,'rows':[]};var _0x4b5a4d=_[_0xab6f('0x2a')](db[_0xab6f('0x2b')][_0xab6f('0x2c')],function(_0x26c62b){return{'name':_0x26c62b[_0xab6f('0x2d')],'type':_0x26c62b[_0xab6f('0x2e')][_0xab6f('0x2f')]};});_0x3206b8['model']=_[_0xab6f('0x2a')](_0x4b5a4d,_0xab6f('0x30'));_0x3206b8[_0xab6f('0x31')]=_['keys'](_0x14af68[_0xab6f('0x31')]);_0x3206b8['filters']=_[_0xab6f('0x32')](_0x3206b8[_0xab6f('0x33')],_0x3206b8[_0xab6f('0x31')]);_0x4110dd[_0xab6f('0x34')]=_[_0xab6f('0x32')](_0x3206b8[_0xab6f('0x33')],qs[_0xab6f('0x35')](_0x14af68[_0xab6f('0x31')][_0xab6f('0x35')]));_0x4110dd['attributes']=_0x4110dd[_0xab6f('0x34')]['length']?_0x4110dd['attributes']:_0x3206b8[_0xab6f('0x33')];if(!_0x14af68[_0xab6f('0x31')][_0xab6f('0x36')](_0xab6f('0x37'))){_0x4110dd[_0xab6f('0x1e')]=qs[_0xab6f('0x1e')](_0x14af68['query']['limit']);_0x4110dd['offset']=qs[_0xab6f('0x1b')](_0x14af68[_0xab6f('0x31')][_0xab6f('0x1b')]);}_0x4110dd[_0xab6f('0x38')]=qs['sort'](_0x14af68[_0xab6f('0x31')][_0xab6f('0x39')]);_0x4110dd['where']=qs['filters'](_[_0xab6f('0x3a')](_0x14af68[_0xab6f('0x31')],_0x3206b8[_0xab6f('0x3b')]),_0x4b5a4d);if(_0x14af68[_0xab6f('0x31')]['filter']){_0x4110dd['where']=_[_0xab6f('0x3c')](_0x4110dd[_0xab6f('0x3d')],{'$or':_[_0xab6f('0x2a')](_0x4b5a4d,function(_0x159c99){if(_0x159c99[_0xab6f('0x2e')]!==_0xab6f('0x3e')){var _0x4e835f={};_0x4e835f[_0x159c99[_0xab6f('0x30')]]={'$like':'%'+_0x14af68[_0xab6f('0x31')][_0xab6f('0x3f')]+'%'};return _0x4e835f;}})});}_0x4110dd=_[_0xab6f('0x3c')]({},_0x4110dd,_0x14af68[_0xab6f('0x40')]);var _0x53377b={'where':_0x4110dd[_0xab6f('0x3d')]};return db[_0xab6f('0x2b')][_0xab6f('0x1d')](_0x53377b)[_0xab6f('0x25')](function(_0x3df7f1){_0x39b6b5[_0xab6f('0x1d')]=_0x3df7f1;if(_0x14af68[_0xab6f('0x31')][_0xab6f('0x41')]){_0x4110dd[_0xab6f('0x42')]=[{'all':!![]}];}return db[_0xab6f('0x2b')]['findAll'](_0x4110dd);})[_0xab6f('0x25')](function(_0x44ca1b){_0x39b6b5[_0xab6f('0x43')]=_0x44ca1b;return _0x39b6b5;})[_0xab6f('0x25')](respondWithFilteredResult(_0xd58fdf,_0x4110dd))[_0xab6f('0x44')](handleError(_0xd58fdf,null));};exports['show']=function(_0x4da669,_0x3ed9b2){var _0x2afa4a={'raw':![],'where':{'id':_0x4da669[_0xab6f('0x45')]['id']}},_0x2a9183={};_0x2a9183[_0xab6f('0x33')]=_['keys'](db[_0xab6f('0x2b')][_0xab6f('0x2c')]);_0x2a9183['query']=_['keys'](_0x4da669[_0xab6f('0x31')]);_0x2a9183[_0xab6f('0x3b')]=_['intersection'](_0x2a9183[_0xab6f('0x33')],_0x2a9183[_0xab6f('0x31')]);_0x2afa4a[_0xab6f('0x34')]=_[_0xab6f('0x32')](_0x2a9183[_0xab6f('0x33')],qs[_0xab6f('0x35')](_0x4da669['query'][_0xab6f('0x35')]));_0x2afa4a[_0xab6f('0x34')]=_0x2afa4a[_0xab6f('0x34')][_0xab6f('0x46')]?_0x2afa4a[_0xab6f('0x34')]:_0x2a9183[_0xab6f('0x33')];if(_0x4da669[_0xab6f('0x31')][_0xab6f('0x41')]){_0x2afa4a[_0xab6f('0x42')]=[{'all':!![]}];}_0x2afa4a=_[_0xab6f('0x3c')]({},_0x2afa4a,_0x4da669[_0xab6f('0x40')]);return db[_0xab6f('0x2b')][_0xab6f('0x47')](_0x2afa4a)['then'](handleEntityNotFound(_0x3ed9b2,null))[_0xab6f('0x25')](respondWithResult(_0x3ed9b2,null))[_0xab6f('0x44')](handleError(_0x3ed9b2,null));};exports['create']=function(_0x30cbc0,_0x1a4a0e){return db[_0xab6f('0x2b')][_0xab6f('0x48')](_0x30cbc0[_0xab6f('0x49')],{})[_0xab6f('0x25')](function(_0x12e1f8){var _0x438ca4=_0x30cbc0[_0xab6f('0x4a')][_0xab6f('0x4b')]({'plain':!![]});if(!_0x438ca4)throw new Error(_0xab6f('0x4c'));if(_0x438ca4[_0xab6f('0x4d')]===_0xab6f('0x4a')){var _0xe8727d=_0x12e1f8['get']({'plain':!![]});var _0x2a7966='Projects';return db['UserProfileSection'][_0xab6f('0x47')]({'where':{'name':_0x2a7966,'userProfileId':_0x438ca4[_0xab6f('0x4e')]},'raw':!![]})['then'](function(_0xad6aae){if(_0xad6aae&&_0xad6aae[_0xab6f('0x4f')]===0x0){return db[_0xab6f('0x27')][_0xab6f('0x48')]({'name':_0xe8727d['name'],'resourceId':_0xe8727d['id'],'type':_0xad6aae[_0xab6f('0x30')],'sectionId':_0xad6aae['id']},{})[_0xab6f('0x25')](function(){return _0x12e1f8;});}else{return _0x12e1f8;}})['catch'](function(_0x5ee28d){logger[_0xab6f('0x50')](_0xab6f('0x51'),_0x5ee28d);throw _0x5ee28d;});}return _0x12e1f8;})['then'](respondWithResult(_0x1a4a0e,0xc9))[_0xab6f('0x44')](handleError(_0x1a4a0e,null));};exports[_0xab6f('0x52')]=function(_0x41e8c2,_0x1a73d7){var _0x4ad321={'where':{'id':_0x41e8c2[_0xab6f('0x45')]['id']}},_0xe55593={};_0xe55593[_0xab6f('0x33')]=_['keys'](db[_0xab6f('0x2b')][_0xab6f('0x2c')]);_0x4ad321['attributes']=_[_0xab6f('0x32')](_0xe55593['model'],qs[_0xab6f('0x35')](_0x41e8c2[_0xab6f('0x31')][_0xab6f('0x35')]));_0x4ad321[_0xab6f('0x34')]=_0x4ad321[_0xab6f('0x34')][_0xab6f('0x46')]?_0x4ad321[_0xab6f('0x34')]:_0xe55593[_0xab6f('0x33')];if(_0x41e8c2[_0xab6f('0x31')]['includeAll']){_0x4ad321[_0xab6f('0x42')]=[{'all':!![]}];}_0x4ad321=_[_0xab6f('0x3c')]({},_0x4ad321,_0x41e8c2[_0xab6f('0x40')]);return db[_0xab6f('0x2b')][_0xab6f('0x47')](_0x4ad321)[_0xab6f('0x25')](handleEntityNotFound(_0x1a73d7,null))['then'](function(_0x46a56c){if(_0x46a56c){var _0x162eee=_0x46a56c[_0xab6f('0x4b')]({'plain':!![]});_0x162eee=qs['omit'](_0x162eee,['id',_0xab6f('0x53'),_0xab6f('0x54')]);_0x41e8c2[_0xab6f('0x49')]=_[_0xab6f('0x55')](_0x41e8c2[_0xab6f('0x49')],['id',_0xab6f('0x53'),_0xab6f('0x54')]);return db[_0xab6f('0x2b')][_0xab6f('0x48')](_[_0xab6f('0x3c')](_0x162eee,_0x41e8c2['body']),{'include':_0x41e8c2[_0xab6f('0x31')][_0xab6f('0x41')]?[{'all':!![]}]:undefined})[_0xab6f('0x25')](function(_0x178365){var _0x22b4c9=_0x41e8c2[_0xab6f('0x4a')][_0xab6f('0x4b')]({'plain':!![]});if(!_0x22b4c9)throw new Error(_0xab6f('0x4c'));if(_0x22b4c9['role']==='user'){var _0x5afe88=_0x178365[_0xab6f('0x4b')]({'plain':!![]});var _0x28d3d8=_0xab6f('0x26');return db[_0xab6f('0x56')][_0xab6f('0x47')]({'where':{'name':_0x28d3d8,'userProfileId':_0x22b4c9[_0xab6f('0x4e')]},'raw':!![]})['then'](function(_0x4283df){if(_0x4283df&&_0x4283df[_0xab6f('0x4f')]===0x0){return db['UserProfileResource'][_0xab6f('0x48')]({'name':_0x5afe88[_0xab6f('0x30')],'resourceId':_0x5afe88['id'],'type':_0x4283df[_0xab6f('0x30')],'sectionId':_0x4283df['id']},{})[_0xab6f('0x25')](function(){return _0x178365;});}else{return _0x178365;}})[_0xab6f('0x44')](function(_0x4df8e7){logger[_0xab6f('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4df8e7);throw _0x4df8e7;});}return _0x178365;});}})[_0xab6f('0x25')](respondWithResult(_0x1a73d7,0xc9))[_0xab6f('0x44')](handleError(_0x1a73d7,null));};exports['update']=function(_0x2c0de1,_0x4aa9b8){if(_0x2c0de1[_0xab6f('0x49')]['id']){delete _0x2c0de1[_0xab6f('0x49')]['id'];}return db[_0xab6f('0x2b')][_0xab6f('0x47')]({'where':{'id':_0x2c0de1[_0xab6f('0x45')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x4aa9b8,null))[_0xab6f('0x25')](saveUpdates(_0x2c0de1['body'],null))['then'](respondWithResult(_0x4aa9b8,null))[_0xab6f('0x44')](handleError(_0x4aa9b8,null));};exports['destroy']=function(_0x30d781,_0x2d0431){return db[_0xab6f('0x2b')]['find']({'where':{'id':_0x30d781[_0xab6f('0x45')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x2d0431,null))[_0xab6f('0x25')](removeEntity(_0x2d0431,null))[_0xab6f('0x44')](handleError(_0x2d0431,null));};exports[_0xab6f('0x57')]=function(_0x12e06e,_0x250843,_0x7b221a){var _0x1eeb37={'raw':!![],'where':{}};var _0x5bc140={};var _0x59d0b5={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xab6f('0x58')]({'where':{'id':_0x12e06e[_0xab6f('0x45')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x250843,null))[_0xab6f('0x25')](function(_0x391038){if(_0x391038){_0x5bc140[_0xab6f('0x33')]=_['keys'](db[_0xab6f('0x59')][_0xab6f('0x2c')]);_0x5bc140[_0xab6f('0x31')]=_['keys'](_0x12e06e[_0xab6f('0x31')]);_0x5bc140[_0xab6f('0x3b')]=_[_0xab6f('0x32')](_0x5bc140['model'],_0x5bc140[_0xab6f('0x31')]);_0x1eeb37[_0xab6f('0x34')]=_[_0xab6f('0x32')](_0x5bc140[_0xab6f('0x33')],qs[_0xab6f('0x35')](_0x12e06e[_0xab6f('0x31')]['fields']));_0x1eeb37[_0xab6f('0x34')]=_0x1eeb37['attributes'][_0xab6f('0x46')]?_0x1eeb37[_0xab6f('0x34')]:_0x5bc140['model'];if(!_0x12e06e[_0xab6f('0x31')][_0xab6f('0x36')](_0xab6f('0x37'))){_0x1eeb37[_0xab6f('0x1e')]=qs['limit'](_0x12e06e[_0xab6f('0x31')]['limit']);_0x1eeb37[_0xab6f('0x1b')]=qs[_0xab6f('0x1b')](_0x12e06e[_0xab6f('0x31')][_0xab6f('0x1b')]);}_0x1eeb37[_0xab6f('0x38')]=qs['sort'](_0x12e06e['query'][_0xab6f('0x39')]);_0x1eeb37[_0xab6f('0x3d')]=qs[_0xab6f('0x3b')](_[_0xab6f('0x3a')](_0x12e06e[_0xab6f('0x31')],_0x5bc140[_0xab6f('0x3b')]));_0x1eeb37['where'][_0xab6f('0x5a')]=_0x391038['id'];if(_0x12e06e[_0xab6f('0x31')][_0xab6f('0x3f')]){_0x1eeb37[_0xab6f('0x3d')]=_[_0xab6f('0x3c')](_0x1eeb37[_0xab6f('0x3d')],{'$or':_['map'](_0x1eeb37['attributes'],function(_0x4a39dc){var _0x2748a5={};_0x2748a5[_0x4a39dc]={'$like':'%'+_0x12e06e[_0xab6f('0x31')][_0xab6f('0x3f')]+'%'};return _0x2748a5;})});}_0x1eeb37=_[_0xab6f('0x3c')]({},_0x1eeb37,_0x12e06e[_0xab6f('0x40')]);return db[_0xab6f('0x59')][_0xab6f('0x1d')]({'where':_0x1eeb37[_0xab6f('0x3d')]})['then'](function(_0x1a7012){_0x59d0b5[_0xab6f('0x1d')]=_0x1a7012;if(_0x12e06e[_0xab6f('0x31')][_0xab6f('0x41')]){_0x1eeb37[_0xab6f('0x42')]=[{'all':!![]}];}return db[_0xab6f('0x59')][_0xab6f('0x5b')](_0x1eeb37);})[_0xab6f('0x25')](function(_0x39f950){_0x59d0b5[_0xab6f('0x43')]=_0x39f950;return _0x59d0b5;});}})[_0xab6f('0x25')](respondWithFilteredResult(_0x250843,_0x1eeb37))[_0xab6f('0x44')](handleError(_0x250843,null));};exports[_0xab6f('0x5c')]=function(_0x5a00ae,_0x1fb8c6,_0x388001){var _0x2d8e34={'raw':!![],'where':{}};var _0x34f200={};var _0x2328d8={'count':0x0,'rows':[]};return db[_0xab6f('0x2b')][_0xab6f('0x58')]({'where':{'id':_0x5a00ae[_0xab6f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fb8c6,null))[_0xab6f('0x25')](function(_0x21c62c){if(_0x21c62c){_0x34f200[_0xab6f('0x33')]=_[_0xab6f('0x5d')](db[_0xab6f('0x5e')][_0xab6f('0x2c')]);_0x34f200[_0xab6f('0x31')]=_['keys'](_0x5a00ae['query']);_0x34f200[_0xab6f('0x3b')]=_[_0xab6f('0x32')](_0x34f200[_0xab6f('0x33')],_0x34f200[_0xab6f('0x31')]);_0x2d8e34[_0xab6f('0x34')]=_[_0xab6f('0x32')](_0x34f200[_0xab6f('0x33')],qs[_0xab6f('0x35')](_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x35')]));_0x2d8e34['attributes']=_0x2d8e34[_0xab6f('0x34')][_0xab6f('0x46')]?_0x2d8e34[_0xab6f('0x34')]:_0x34f200[_0xab6f('0x33')];if(!_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x36')](_0xab6f('0x37'))){_0x2d8e34[_0xab6f('0x1e')]=qs['limit'](_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x1e')]);_0x2d8e34[_0xab6f('0x1b')]=qs[_0xab6f('0x1b')](_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x1b')]);}_0x2d8e34[_0xab6f('0x38')]=qs['sort'](_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x39')]);_0x2d8e34[_0xab6f('0x3d')]=qs['filters'](_[_0xab6f('0x3a')](_0x5a00ae[_0xab6f('0x31')],_0x34f200[_0xab6f('0x3b')]));_0x2d8e34[_0xab6f('0x3d')][_0xab6f('0x5a')]=_0x21c62c['id'];if(_0x5a00ae['query']['filter']){_0x2d8e34['where']=_[_0xab6f('0x3c')](_0x2d8e34[_0xab6f('0x3d')],{'$or':_[_0xab6f('0x2a')](_0x2d8e34[_0xab6f('0x34')],function(_0x21b809){var _0x4f51fa={};_0x4f51fa[_0x21b809]={'$like':'%'+_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x3f')]+'%'};return _0x4f51fa;})});}_0x2d8e34=_['merge']({},_0x2d8e34,_0x5a00ae['options']);return db[_0xab6f('0x5e')][_0xab6f('0x1d')]({'where':_0x2d8e34['where']})[_0xab6f('0x25')](function(_0x1091eb){_0x2328d8[_0xab6f('0x1d')]=_0x1091eb;if(_0x5a00ae[_0xab6f('0x31')][_0xab6f('0x41')]){_0x2d8e34[_0xab6f('0x42')]=[{'all':!![]}];}return db[_0xab6f('0x5e')][_0xab6f('0x5b')](_0x2d8e34);})['then'](function(_0x1a1ecd){_0x2328d8[_0xab6f('0x43')]=_0x1a1ecd;return _0x2328d8;});}})[_0xab6f('0x25')](respondWithFilteredResult(_0x1fb8c6,_0x2d8e34))[_0xab6f('0x44')](handleError(_0x1fb8c6,null));};function char(_0x687c56){return _0xab6f('0x5f')===typeof _0x687c56?String['fromCharCode'][_0xab6f('0x21')](null,arguments):_0x687c56;}function needsEncapsulation(_0x2f73d8){return!!_0x2f73d8&&(_0x2f73d8[_0xab6f('0x60')]()[_0xab6f('0x61')](char(0xd))>=0x0||_0x2f73d8[_0xab6f('0x60')]()['indexOf'](char(0xa))>=0x0||_0x2f73d8['toString']()[_0xab6f('0x61')](char(0x2c))>=0x0||_0x2f73d8[_0xab6f('0x60')]()[_0xab6f('0x61')](char(0x22))>=0x0);}function encapsulate(_0x4378e7){var _0x40ba76=char(0x22),_0x4142a0='\x5c'+char(0x22),_0x3b6d78=_0x4378e7['toString']()['replace'](new RegExp(_0x40ba76,'g'),_0x4142a0);return _0x40ba76+_0x3b6d78+_0x40ba76;}exports[_0xab6f('0x62')]=function(_0x16be00,_0x531c8d,_0x3aabed){var _0x372db6,_0xf3e2be;var _0x5e8aa7={'where':{'ProjectId':_0x16be00[_0xab6f('0x45')]['id']}};if(_0x16be00[_0xab6f('0x31')][_0xab6f('0x63')]){_0x5e8aa7[_0xab6f('0x3d')][_0xab6f('0x64')]=JSON[_0xab6f('0x65')](_0x16be00[_0xab6f('0x31')][_0xab6f('0x63')]);}return db[_0xab6f('0x59')]['findAll'](_0x5e8aa7)[_0xab6f('0x25')](handleEntityNotFound(_0x531c8d,null))[_0xab6f('0x25')](function(_0x1f857f){if(_0x1f857f){_0x372db6=_0x1f857f;return db[_0xab6f('0x66')]['findAll']({'where':{'SessionId':{'$in':_[_0xab6f('0x2a')](_0x372db6,'id')},'ProjectId':_0x16be00['params']['id']},'order':'-createdAt'});}})[_0xab6f('0x25')](handleEntityNotFound(_0x531c8d,null))[_0xab6f('0x25')](function(_0x4ff2af){if(_0x4ff2af){_0xf3e2be=_0x4ff2af;var _0x23aad4={};for(var _0x234194=0x0,_0x1f3913=_0xf3e2be['length'];_0x234194<_0x1f3913;_0x234194++){if(!_0x23aad4['hasOwnProperty'](_0xf3e2be[_0x234194]['questionId'])){_0x23aad4[_0xf3e2be[_0x234194][_0xab6f('0x67')]]=needsEncapsulation(_0xf3e2be[_0x234194][_0xab6f('0x68')])?encapsulate(_0xf3e2be[_0x234194]['question']):_0xf3e2be[_0x234194][_0xab6f('0x68')];}}var _0x1b5675=[],_0x522c2f={};for(var _0xc2ec7e=0x0,_0xd9d83a=_0x372db6[_0xab6f('0x46')];_0xc2ec7e<_0xd9d83a;_0xc2ec7e++){_0x522c2f={'ProjectId':_0x16be00[_0xab6f('0x45')]['id'],'SessionId':_0x372db6[_0xc2ec7e]['id'],'StartTime':moment(_0x372db6[_0xc2ec7e][_0xab6f('0x64')])[_0xab6f('0x69')](_0xab6f('0x6a'))};for(var _0x14edcb=0x0,_0x14aaaa=_0xf3e2be[_0xab6f('0x46')];_0x14edcb<_0x14aaaa;_0x14edcb++){if(_0xf3e2be[_0x14edcb][_0xab6f('0x6b')]==_0x372db6[_0xc2ec7e]['id']&&_0x23aad4[_0xab6f('0x36')](_0xf3e2be[_0x14edcb][_0xab6f('0x67')])){_0x522c2f[_0x23aad4[_0xf3e2be[_0x14edcb][_0xab6f('0x67')]]]=_0xf3e2be[_0x14edcb]['answer'];}}for(var _0x2606cf in _0x23aad4){if(!_0x522c2f[_0xab6f('0x36')](_0x23aad4[_0x2606cf])){_0x522c2f[_0x23aad4[_0x2606cf]]=null;}}_0x1b5675[_0xab6f('0x6c')](_0x522c2f);}return _0x1b5675;}})[_0xab6f('0x25')](function(_0x49bf3b){if(!_[_0xab6f('0x6d')](_0x49bf3b)){var _0x43c444=toCsv(_0x49bf3b);var _0x2de817=Date[_0xab6f('0x6e')]();fs[_0xab6f('0x6f')](util[_0xab6f('0x69')](_0xab6f('0x70'),_0x16be00[_0xab6f('0x45')]['id'],_0x2de817),_0x43c444);_0x531c8d[_0xab6f('0x71')](_0xab6f('0x72'),_0xab6f('0x73')+util[_0xab6f('0x69')](_0xab6f('0x74'),_0x16be00[_0xab6f('0x45')]['id'],_0x2de817));_0x531c8d['setHeader']('Content-type',_0xab6f('0x75'));return _0x531c8d['download'](util['format'](_0xab6f('0x70'),_0x16be00['params']['id'],_0x2de817));}else{return _0x531c8d[_0xab6f('0x18')](0xcc);}})['catch'](handleError(_0x531c8d,null));}; \ No newline at end of file +var _0xfc61=['download','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','includeAll','omit','createdAt','updatedAt','body','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv'];(function(_0x18fbaa,_0x26e6bd){var _0x30688e=function(_0x5da6a4){while(--_0x5da6a4){_0x18fbaa['push'](_0x18fbaa['shift']());}};_0x30688e(++_0x26e6bd);}(_0xfc61,0x78));var _0x1fc6=function(_0x4dbc10,_0x3abbf3){_0x4dbc10=_0x4dbc10-0x0;var _0x511d83=_0xfc61[_0x4dbc10];return _0x511d83;};'use strict';var emlformat=require(_0x1fc6('0x0'));var rimraf=require(_0x1fc6('0x1'));var zipdir=require(_0x1fc6('0x2'));var jsonpatch=require(_0x1fc6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fc6('0x4'));var util=require(_0x1fc6('0x5'));var path=require(_0x1fc6('0x6'));var sox=require(_0x1fc6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fc6('0x8'));var _=require(_0x1fc6('0x9'));var squel=require(_0x1fc6('0xa'));var crypto=require(_0x1fc6('0xb'));var jsforce=require(_0x1fc6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0xd'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fc6('0x11'));var as=require(_0x1fc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fc6('0x13'))(_0x1fc6('0x14'));var utils=require(_0x1fc6('0x15'));var config=require(_0x1fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a1b5b,_0x475b16){_0x475b16=_0x475b16||0xcc;return function(_0xa08740){if(_0xa08740){return _0x2a1b5b['sendStatus'](_0x475b16);}return _0x2a1b5b['status'](_0x475b16)[_0x1fc6('0x17')]();};}function respondWithResult(_0x55da92,_0x2833ef){_0x2833ef=_0x2833ef||0xc8;return function(_0x35ecb5){if(_0x35ecb5){return _0x55da92[_0x1fc6('0x18')](_0x2833ef)[_0x1fc6('0x19')](_0x35ecb5);}};}function respondWithFilteredResult(_0x2bcb91,_0x624be2){return function(_0x324fa7){if(_0x324fa7){var _0x141d3e=typeof _0x624be2['offset']===_0x1fc6('0x1a')&&typeof _0x624be2[_0x1fc6('0x1b')]===_0x1fc6('0x1a');var _0xcde85e=_0x324fa7[_0x1fc6('0x1c')];var _0x2b0294=_0x141d3e?0x0:_0x624be2[_0x1fc6('0x1d')];var _0x5f3b49=_0x141d3e?_0x324fa7[_0x1fc6('0x1c')]:_0x624be2[_0x1fc6('0x1d')]+_0x624be2[_0x1fc6('0x1b')];var _0x3d4fd8;if(_0x5f3b49>=_0xcde85e){_0x5f3b49=_0xcde85e;_0x3d4fd8=0xc8;}else{_0x3d4fd8=0xce;}_0x2bcb91[_0x1fc6('0x18')](_0x3d4fd8);return _0x2bcb91[_0x1fc6('0x1e')](_0x1fc6('0x1f'),_0x2b0294+'-'+_0x5f3b49+'/'+_0xcde85e)['json'](_0x324fa7);}return null;};}function patchUpdates(_0x56a853){return function(_0x53b17d){try{jsonpatch[_0x1fc6('0x20')](_0x53b17d,_0x56a853,!![]);}catch(_0x3ae4a3){return BPromise['reject'](_0x3ae4a3);}return _0x53b17d[_0x1fc6('0x21')]();};}function saveUpdates(_0x2b7acb,_0x2d0fe0){return function(_0x38a792){if(_0x38a792){return _0x38a792[_0x1fc6('0x22')](_0x2b7acb)[_0x1fc6('0x23')](function(_0x1209a4){return _0x1209a4;});}return null;};}function removeEntity(_0x3fc788,_0x891eba){return function(_0xc6965f){if(_0xc6965f){return _0xc6965f[_0x1fc6('0x24')]()[_0x1fc6('0x23')](function(){var _0x358d3a=_0xc6965f['get']({'plain':!![]});var _0x2975ca=_0x1fc6('0x25');return db[_0x1fc6('0x26')][_0x1fc6('0x24')]({'where':{'type':_0x2975ca,'resourceId':_0x358d3a['id']}})[_0x1fc6('0x23')](function(){return _0xc6965f;});})[_0x1fc6('0x23')](function(){_0x3fc788[_0x1fc6('0x18')](0xcc)[_0x1fc6('0x17')]();});}};}function handleEntityNotFound(_0x343b89,_0x3de90e){return function(_0x1dc319){if(!_0x1dc319){_0x343b89[_0x1fc6('0x27')](0x194);}return _0x1dc319;};}function handleError(_0x2be9f8,_0xeda672){_0xeda672=_0xeda672||0x1f4;return function(_0x481c38){logger[_0x1fc6('0x28')](_0x481c38[_0x1fc6('0x29')]);if(_0x481c38[_0x1fc6('0x2a')]){delete _0x481c38['name'];}_0x2be9f8[_0x1fc6('0x18')](_0xeda672)[_0x1fc6('0x2b')](_0x481c38);};}exports[_0x1fc6('0x2c')]=function(_0x730883,_0x1ff069){var _0x41886c={},_0x39612c={},_0x37cc93={'count':0x0,'rows':[]};var _0x56720a=_[_0x1fc6('0x2d')](db[_0x1fc6('0x2e')][_0x1fc6('0x2f')],function(_0x45ec08){return{'name':_0x45ec08[_0x1fc6('0x30')],'type':_0x45ec08[_0x1fc6('0x31')][_0x1fc6('0x32')]};});_0x39612c['model']=_[_0x1fc6('0x2d')](_0x56720a,_0x1fc6('0x2a'));_0x39612c[_0x1fc6('0x33')]=_[_0x1fc6('0x34')](_0x730883[_0x1fc6('0x33')]);_0x39612c['filters']=_['intersection'](_0x39612c[_0x1fc6('0x35')],_0x39612c[_0x1fc6('0x33')]);_0x41886c[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x39612c['model'],qs[_0x1fc6('0x38')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x38')]));_0x41886c[_0x1fc6('0x36')]=_0x41886c[_0x1fc6('0x36')]['length']?_0x41886c[_0x1fc6('0x36')]:_0x39612c[_0x1fc6('0x35')];if(!_0x730883[_0x1fc6('0x33')][_0x1fc6('0x39')](_0x1fc6('0x3a'))){_0x41886c[_0x1fc6('0x1b')]=qs[_0x1fc6('0x1b')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x1b')]);_0x41886c[_0x1fc6('0x1d')]=qs[_0x1fc6('0x1d')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x1d')]);}_0x41886c[_0x1fc6('0x3b')]=qs[_0x1fc6('0x3c')](_0x730883[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x41886c[_0x1fc6('0x3d')]=qs[_0x1fc6('0x3e')](_['pick'](_0x730883[_0x1fc6('0x33')],_0x39612c[_0x1fc6('0x3e')]),_0x56720a);if(_0x730883[_0x1fc6('0x33')][_0x1fc6('0x3f')]){_0x41886c['where']=_[_0x1fc6('0x40')](_0x41886c[_0x1fc6('0x3d')],{'$or':_[_0x1fc6('0x2d')](_0x56720a,function(_0x374b51){if(_0x374b51[_0x1fc6('0x31')]!==_0x1fc6('0x41')){var _0x51dc5b={};_0x51dc5b[_0x374b51[_0x1fc6('0x2a')]]={'$like':'%'+_0x730883['query'][_0x1fc6('0x3f')]+'%'};return _0x51dc5b;}})});}_0x41886c=_[_0x1fc6('0x40')]({},_0x41886c,_0x730883[_0x1fc6('0x42')]);var _0x22ca27={'where':_0x41886c[_0x1fc6('0x3d')]};return db['JscriptyProject'][_0x1fc6('0x1c')](_0x22ca27)[_0x1fc6('0x23')](function(_0x29e2be){_0x37cc93[_0x1fc6('0x1c')]=_0x29e2be;if(_0x730883[_0x1fc6('0x33')]['includeAll']){_0x41886c[_0x1fc6('0x43')]=[{'all':!![]}];}return db[_0x1fc6('0x2e')][_0x1fc6('0x44')](_0x41886c);})[_0x1fc6('0x23')](function(_0x49f335){_0x37cc93[_0x1fc6('0x45')]=_0x49f335;return _0x37cc93;})[_0x1fc6('0x23')](respondWithFilteredResult(_0x1ff069,_0x41886c))[_0x1fc6('0x46')](handleError(_0x1ff069,null));};exports[_0x1fc6('0x47')]=function(_0x4248d8,_0x44ab2b){var _0x13e630={'raw':![],'where':{'id':_0x4248d8[_0x1fc6('0x48')]['id']}},_0x18db1a={};_0x18db1a[_0x1fc6('0x35')]=_[_0x1fc6('0x34')](db['JscriptyProject'][_0x1fc6('0x2f')]);_0x18db1a[_0x1fc6('0x33')]=_[_0x1fc6('0x34')](_0x4248d8[_0x1fc6('0x33')]);_0x18db1a['filters']=_['intersection'](_0x18db1a[_0x1fc6('0x35')],_0x18db1a[_0x1fc6('0x33')]);_0x13e630[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x18db1a['model'],qs['fields'](_0x4248d8[_0x1fc6('0x33')]['fields']));_0x13e630[_0x1fc6('0x36')]=_0x13e630[_0x1fc6('0x36')]['length']?_0x13e630[_0x1fc6('0x36')]:_0x18db1a[_0x1fc6('0x35')];if(_0x4248d8['query']['includeAll']){_0x13e630[_0x1fc6('0x43')]=[{'all':!![]}];}_0x13e630=_['merge']({},_0x13e630,_0x4248d8['options']);return db[_0x1fc6('0x2e')][_0x1fc6('0x49')](_0x13e630)[_0x1fc6('0x23')](handleEntityNotFound(_0x44ab2b,null))[_0x1fc6('0x23')](respondWithResult(_0x44ab2b,null))['catch'](handleError(_0x44ab2b,null));};exports[_0x1fc6('0x4a')]=function(_0xa849a4,_0x48062c){return db['JscriptyProject'][_0x1fc6('0x4a')](_0xa849a4['body'],{})[_0x1fc6('0x23')](function(_0x28af6f){var _0x4ed3ae=_0xa849a4[_0x1fc6('0x4b')][_0x1fc6('0x4c')]({'plain':!![]});if(!_0x4ed3ae)throw new Error(_0x1fc6('0x4d'));if(_0x4ed3ae[_0x1fc6('0x4e')]==='user'){var _0x45a8fc=_0x28af6f['get']({'plain':!![]});var _0x7a66ba='Projects';return db[_0x1fc6('0x4f')][_0x1fc6('0x49')]({'where':{'name':_0x7a66ba,'userProfileId':_0x4ed3ae[_0x1fc6('0x50')]},'raw':!![]})['then'](function(_0x214ee3){if(_0x214ee3&&_0x214ee3[_0x1fc6('0x51')]===0x0){return db[_0x1fc6('0x26')]['create']({'name':_0x45a8fc[_0x1fc6('0x2a')],'resourceId':_0x45a8fc['id'],'type':_0x214ee3['name'],'sectionId':_0x214ee3['id']},{})[_0x1fc6('0x23')](function(){return _0x28af6f;});}else{return _0x28af6f;}})['catch'](function(_0x5790a9){logger[_0x1fc6('0x28')](_0x1fc6('0x52'),_0x5790a9);throw _0x5790a9;});}return _0x28af6f;})['then'](respondWithResult(_0x48062c,0xc9))['catch'](handleError(_0x48062c,null));};exports['clone']=function(_0x2f203c,_0x2478fd){var _0x331634={'where':{'id':_0x2f203c[_0x1fc6('0x48')]['id']}},_0x28f058={};_0x28f058[_0x1fc6('0x35')]=_[_0x1fc6('0x34')](db[_0x1fc6('0x2e')][_0x1fc6('0x2f')]);_0x331634[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x28f058['model'],qs[_0x1fc6('0x38')](_0x2f203c[_0x1fc6('0x33')][_0x1fc6('0x38')]));_0x331634[_0x1fc6('0x36')]=_0x331634[_0x1fc6('0x36')][_0x1fc6('0x53')]?_0x331634[_0x1fc6('0x36')]:_0x28f058[_0x1fc6('0x35')];if(_0x2f203c[_0x1fc6('0x33')][_0x1fc6('0x54')]){_0x331634[_0x1fc6('0x43')]=[{'all':!![]}];}_0x331634=_[_0x1fc6('0x40')]({},_0x331634,_0x2f203c['options']);return db[_0x1fc6('0x2e')][_0x1fc6('0x49')](_0x331634)[_0x1fc6('0x23')](handleEntityNotFound(_0x2478fd,null))[_0x1fc6('0x23')](function(_0x4b5f29){if(_0x4b5f29){var _0x403a7b=_0x4b5f29[_0x1fc6('0x4c')]({'plain':!![]});_0x403a7b=qs[_0x1fc6('0x55')](_0x403a7b,['id',_0x1fc6('0x56'),_0x1fc6('0x57')]);_0x2f203c[_0x1fc6('0x58')]=_['omit'](_0x2f203c[_0x1fc6('0x58')],['id','createdAt',_0x1fc6('0x57')]);return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')](_[_0x1fc6('0x40')](_0x403a7b,_0x2f203c[_0x1fc6('0x58')]),{'include':_0x2f203c[_0x1fc6('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x1fc6('0x23')](function(_0x706f1f){var _0x33b08c=_0x2f203c[_0x1fc6('0x4b')][_0x1fc6('0x4c')]({'plain':!![]});if(!_0x33b08c)throw new Error(_0x1fc6('0x4d'));if(_0x33b08c[_0x1fc6('0x4e')]===_0x1fc6('0x4b')){var _0x40349b=_0x706f1f[_0x1fc6('0x4c')]({'plain':!![]});var _0x229338=_0x1fc6('0x25');return db['UserProfileSection'][_0x1fc6('0x49')]({'where':{'name':_0x229338,'userProfileId':_0x33b08c[_0x1fc6('0x50')]},'raw':!![]})[_0x1fc6('0x23')](function(_0x1c34ef){if(_0x1c34ef&&_0x1c34ef['autoAssociation']===0x0){return db[_0x1fc6('0x26')][_0x1fc6('0x4a')]({'name':_0x40349b[_0x1fc6('0x2a')],'resourceId':_0x40349b['id'],'type':_0x1c34ef[_0x1fc6('0x2a')],'sectionId':_0x1c34ef['id']},{})[_0x1fc6('0x23')](function(){return _0x706f1f;});}else{return _0x706f1f;}})[_0x1fc6('0x46')](function(_0x2e81cf){logger[_0x1fc6('0x28')](_0x1fc6('0x52'),_0x2e81cf);throw _0x2e81cf;});}return _0x706f1f;});}})[_0x1fc6('0x23')](respondWithResult(_0x2478fd,0xc9))[_0x1fc6('0x46')](handleError(_0x2478fd,null));};exports[_0x1fc6('0x22')]=function(_0x52d8b0,_0x53301a){if(_0x52d8b0[_0x1fc6('0x58')]['id']){delete _0x52d8b0[_0x1fc6('0x58')]['id'];}return db['JscriptyProject'][_0x1fc6('0x49')]({'where':{'id':_0x52d8b0['params']['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x53301a,null))[_0x1fc6('0x23')](saveUpdates(_0x52d8b0['body'],null))[_0x1fc6('0x23')](respondWithResult(_0x53301a,null))[_0x1fc6('0x46')](handleError(_0x53301a,null));};exports[_0x1fc6('0x24')]=function(_0x1d1afc,_0x5e354f){return db[_0x1fc6('0x2e')]['find']({'where':{'id':_0x1d1afc[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x5e354f,null))['then'](removeEntity(_0x5e354f,null))[_0x1fc6('0x46')](handleError(_0x5e354f,null));};exports['getSessions']=function(_0x3c6ae6,_0x5646ef,_0x28ecaa){var _0x10b8da={'raw':!![],'where':{}};var _0x3700db={};var _0x1abb38={'count':0x0,'rows':[]};return db[_0x1fc6('0x2e')][_0x1fc6('0x59')]({'where':{'id':_0x3c6ae6[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x5646ef,null))[_0x1fc6('0x23')](function(_0x24e94f){if(_0x24e94f){_0x3700db['model']=_[_0x1fc6('0x34')](db[_0x1fc6('0x5a')][_0x1fc6('0x2f')]);_0x3700db[_0x1fc6('0x33')]=_['keys'](_0x3c6ae6[_0x1fc6('0x33')]);_0x3700db[_0x1fc6('0x3e')]=_[_0x1fc6('0x37')](_0x3700db['model'],_0x3700db[_0x1fc6('0x33')]);_0x10b8da[_0x1fc6('0x36')]=_[_0x1fc6('0x37')](_0x3700db[_0x1fc6('0x35')],qs[_0x1fc6('0x38')](_0x3c6ae6['query'][_0x1fc6('0x38')]));_0x10b8da[_0x1fc6('0x36')]=_0x10b8da[_0x1fc6('0x36')][_0x1fc6('0x53')]?_0x10b8da[_0x1fc6('0x36')]:_0x3700db[_0x1fc6('0x35')];if(!_0x3c6ae6[_0x1fc6('0x33')][_0x1fc6('0x39')]('nolimit')){_0x10b8da['limit']=qs[_0x1fc6('0x1b')](_0x3c6ae6[_0x1fc6('0x33')]['limit']);_0x10b8da[_0x1fc6('0x1d')]=qs[_0x1fc6('0x1d')](_0x3c6ae6['query'][_0x1fc6('0x1d')]);}_0x10b8da[_0x1fc6('0x3b')]=qs[_0x1fc6('0x3c')](_0x3c6ae6[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x10b8da['where']=qs[_0x1fc6('0x3e')](_['pick'](_0x3c6ae6[_0x1fc6('0x33')],_0x3700db[_0x1fc6('0x3e')]));_0x10b8da['where'][_0x1fc6('0x5b')]=_0x24e94f['id'];if(_0x3c6ae6['query'][_0x1fc6('0x3f')]){_0x10b8da[_0x1fc6('0x3d')]=_[_0x1fc6('0x40')](_0x10b8da['where'],{'$or':_[_0x1fc6('0x2d')](_0x10b8da['attributes'],function(_0x3ab90d){var _0x1719f2={};_0x1719f2[_0x3ab90d]={'$like':'%'+_0x3c6ae6['query'][_0x1fc6('0x3f')]+'%'};return _0x1719f2;})});}_0x10b8da=_[_0x1fc6('0x40')]({},_0x10b8da,_0x3c6ae6[_0x1fc6('0x42')]);return db['JscriptySessionReport']['count']({'where':_0x10b8da[_0x1fc6('0x3d')]})[_0x1fc6('0x23')](function(_0x4266c1){_0x1abb38[_0x1fc6('0x1c')]=_0x4266c1;if(_0x3c6ae6[_0x1fc6('0x33')][_0x1fc6('0x54')]){_0x10b8da[_0x1fc6('0x43')]=[{'all':!![]}];}return db[_0x1fc6('0x5a')][_0x1fc6('0x44')](_0x10b8da);})['then'](function(_0x76ae9d){_0x1abb38['rows']=_0x76ae9d;return _0x1abb38;});}})['then'](respondWithFilteredResult(_0x5646ef,_0x10b8da))[_0x1fc6('0x46')](handleError(_0x5646ef,null));};exports[_0x1fc6('0x5c')]=function(_0x5e8a5c,_0x30b2b5,_0x1c0dd2){var _0x33a6fc={'raw':!![],'where':{}};var _0x13aa81={};var _0x5d0197={'count':0x0,'rows':[]};return db[_0x1fc6('0x2e')][_0x1fc6('0x59')]({'where':{'id':_0x5e8a5c[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x23')](handleEntityNotFound(_0x30b2b5,null))['then'](function(_0x58ac6d){if(_0x58ac6d){_0x13aa81['model']=_['keys'](db[_0x1fc6('0x5d')][_0x1fc6('0x2f')]);_0x13aa81[_0x1fc6('0x33')]=_['keys'](_0x5e8a5c['query']);_0x13aa81['filters']=_[_0x1fc6('0x37')](_0x13aa81[_0x1fc6('0x35')],_0x13aa81[_0x1fc6('0x33')]);_0x33a6fc['attributes']=_['intersection'](_0x13aa81[_0x1fc6('0x35')],qs[_0x1fc6('0x38')](_0x5e8a5c[_0x1fc6('0x33')][_0x1fc6('0x38')]));_0x33a6fc['attributes']=_0x33a6fc[_0x1fc6('0x36')][_0x1fc6('0x53')]?_0x33a6fc['attributes']:_0x13aa81[_0x1fc6('0x35')];if(!_0x5e8a5c['query'][_0x1fc6('0x39')]('nolimit')){_0x33a6fc['limit']=qs[_0x1fc6('0x1b')](_0x5e8a5c['query'][_0x1fc6('0x1b')]);_0x33a6fc[_0x1fc6('0x1d')]=qs[_0x1fc6('0x1d')](_0x5e8a5c['query'][_0x1fc6('0x1d')]);}_0x33a6fc[_0x1fc6('0x3b')]=qs['sort'](_0x5e8a5c[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x33a6fc['where']=qs[_0x1fc6('0x3e')](_['pick'](_0x5e8a5c[_0x1fc6('0x33')],_0x13aa81[_0x1fc6('0x3e')]));_0x33a6fc[_0x1fc6('0x3d')]['ProjectId']=_0x58ac6d['id'];if(_0x5e8a5c[_0x1fc6('0x33')]['filter']){_0x33a6fc[_0x1fc6('0x3d')]=_[_0x1fc6('0x40')](_0x33a6fc[_0x1fc6('0x3d')],{'$or':_['map'](_0x33a6fc[_0x1fc6('0x36')],function(_0x28cefa){var _0x1c59e9={};_0x1c59e9[_0x28cefa]={'$like':'%'+_0x5e8a5c['query'][_0x1fc6('0x3f')]+'%'};return _0x1c59e9;})});}_0x33a6fc=_[_0x1fc6('0x40')]({},_0x33a6fc,_0x5e8a5c[_0x1fc6('0x42')]);return db[_0x1fc6('0x5d')][_0x1fc6('0x1c')]({'where':_0x33a6fc['where']})[_0x1fc6('0x23')](function(_0x2cb884){_0x5d0197[_0x1fc6('0x1c')]=_0x2cb884;if(_0x5e8a5c[_0x1fc6('0x33')][_0x1fc6('0x54')]){_0x33a6fc['include']=[{'all':!![]}];}return db[_0x1fc6('0x5d')]['findAll'](_0x33a6fc);})['then'](function(_0x3da6dc){_0x5d0197[_0x1fc6('0x45')]=_0x3da6dc;return _0x5d0197;});}})['then'](respondWithFilteredResult(_0x30b2b5,_0x33a6fc))[_0x1fc6('0x46')](handleError(_0x30b2b5,null));};function char(_0x1f7eb1){return _0x1fc6('0x5e')===typeof _0x1f7eb1?String[_0x1fc6('0x5f')][_0x1fc6('0x20')](null,arguments):_0x1f7eb1;}function needsEncapsulation(_0x2b054e){return!!_0x2b054e&&(_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0xd))>=0x0||_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0xa))>=0x0||_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0x2c))>=0x0||_0x2b054e[_0x1fc6('0x60')]()[_0x1fc6('0x61')](char(0x22))>=0x0);}function encapsulate(_0x5505ca){var _0xe5aefe=char(0x22),_0x37e144='\x5c'+char(0x22),_0x397362=_0x5505ca[_0x1fc6('0x60')]()[_0x1fc6('0x62')](new RegExp(_0xe5aefe,'g'),_0x37e144);return _0xe5aefe+_0x397362+_0xe5aefe;}exports['getSummary']=function(_0x583a30,_0x222bb7,_0x173d1e){var _0x5dfe61,_0x3ee757;var _0x3df03d={'where':{'ProjectId':_0x583a30[_0x1fc6('0x48')]['id']}};if(_0x583a30[_0x1fc6('0x33')][_0x1fc6('0x63')]){_0x3df03d[_0x1fc6('0x3d')]['starttime']=JSON[_0x1fc6('0x64')](_0x583a30[_0x1fc6('0x33')][_0x1fc6('0x63')]);}return db['JscriptySessionReport'][_0x1fc6('0x44')](_0x3df03d)[_0x1fc6('0x23')](handleEntityNotFound(_0x222bb7,null))['then'](function(_0x26b14f){if(_0x26b14f){_0x5dfe61=_0x26b14f;return db['JscriptyQuestionReport'][_0x1fc6('0x44')]({'where':{'SessionId':{'$in':_[_0x1fc6('0x2d')](_0x5dfe61,'id')},'ProjectId':_0x583a30[_0x1fc6('0x48')]['id']},'order':_0x1fc6('0x65')});}})[_0x1fc6('0x23')](handleEntityNotFound(_0x222bb7,null))[_0x1fc6('0x23')](function(_0x4e09a1){if(_0x4e09a1){_0x3ee757=_0x4e09a1;var _0x1c01a6={};for(var _0x305437=0x0,_0x4746e0=_0x3ee757[_0x1fc6('0x53')];_0x305437<_0x4746e0;_0x305437++){if(!_0x1c01a6[_0x1fc6('0x39')](_0x3ee757[_0x305437][_0x1fc6('0x66')])){_0x1c01a6[_0x3ee757[_0x305437][_0x1fc6('0x66')]]=needsEncapsulation(_0x3ee757[_0x305437][_0x1fc6('0x67')])?encapsulate(_0x3ee757[_0x305437]['question']):_0x3ee757[_0x305437]['question'];}}var _0x153e9d=[],_0x4c1226={};for(var _0x2a9db9=0x0,_0x5ccb33=_0x5dfe61[_0x1fc6('0x53')];_0x2a9db9<_0x5ccb33;_0x2a9db9++){_0x4c1226={'ProjectId':_0x583a30[_0x1fc6('0x48')]['id'],'SessionId':_0x5dfe61[_0x2a9db9]['id'],'StartTime':moment(_0x5dfe61[_0x2a9db9]['starttime'])[_0x1fc6('0x68')](_0x1fc6('0x69'))};for(var _0x282e5d=0x0,_0x427e93=_0x3ee757[_0x1fc6('0x53')];_0x282e5d<_0x427e93;_0x282e5d++){if(_0x3ee757[_0x282e5d]['SessionId']==_0x5dfe61[_0x2a9db9]['id']&&_0x1c01a6[_0x1fc6('0x39')](_0x3ee757[_0x282e5d][_0x1fc6('0x66')])){_0x4c1226[_0x1c01a6[_0x3ee757[_0x282e5d][_0x1fc6('0x66')]]]=_0x3ee757[_0x282e5d][_0x1fc6('0x6a')];}}for(var _0x280170 in _0x1c01a6){if(!_0x4c1226['hasOwnProperty'](_0x1c01a6[_0x280170])){_0x4c1226[_0x1c01a6[_0x280170]]=null;}}_0x153e9d[_0x1fc6('0x6b')](_0x4c1226);}return _0x153e9d;}})[_0x1fc6('0x23')](function(_0x215dd0){if(!_[_0x1fc6('0x6c')](_0x215dd0)){var _0x43a282=toCsv(_0x215dd0);var _0x1ca20c=Date[_0x1fc6('0x6d')]();fs[_0x1fc6('0x6e')](util['format'](_0x1fc6('0x6f'),_0x583a30[_0x1fc6('0x48')]['id'],_0x1ca20c),_0x43a282);_0x222bb7[_0x1fc6('0x70')](_0x1fc6('0x71'),_0x1fc6('0x72')+util[_0x1fc6('0x68')](_0x1fc6('0x73'),_0x583a30[_0x1fc6('0x48')]['id'],_0x1ca20c));_0x222bb7['setHeader'](_0x1fc6('0x74'),_0x1fc6('0x75'));return _0x222bb7[_0x1fc6('0x76')](util['format'](_0x1fc6('0x6f'),_0x583a30[_0x1fc6('0x48')]['id'],_0x1ca20c));}else{return _0x222bb7[_0x1fc6('0x27')](0xcc);}})[_0x1fc6('0x46')](handleError(_0x222bb7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5f1d301..b5d5f53 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 _0xa23f=['../../config/environment','exports','define','jscripty_projects','lodash','util','moment','bluebird','request-promise','path'];(function(_0x51e9cc,_0x5e7bc8){var _0x12c1d2=function(_0x1a9f54){while(--_0x1a9f54){_0x51e9cc['push'](_0x51e9cc['shift']());}};_0x12c1d2(++_0x5e7bc8);}(_0xa23f,0x7c));var _0xfa23=function(_0x237356,_0x1e2b49){_0x237356=_0x237356-0x0;var _0x324c15=_0xa23f[_0x237356];return _0x324c15;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa23('0x2'));var BPromise=require(_0xfa23('0x3'));var rp=require(_0xfa23('0x4'));var fs=require('fs');var path=require(_0xfa23('0x5'));var rimraf=require('rimraf');var config=require(_0xfa23('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xfa23('0x7')]=function(_0x2df2f5,_0x4c3f4){return _0x2df2f5[_0xfa23('0x8')]('JscriptyProject',attributes,{'tableName':_0xfa23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d8=['path','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45b1aa,_0x5e290d){var _0x218b80=function(_0x26909b){while(--_0x26909b){_0x45b1aa['push'](_0x45b1aa['shift']());}};_0x218b80(++_0x5e290d);}(_0x16d8,0xa3));var _0x816d=function(_0x257ad7,_0x1c2ed8){_0x257ad7=_0x257ad7-0x0;var _0x437174=_0x16d8[_0x257ad7];return _0x437174;};'use strict';var _=require('lodash');var util=require(_0x816d('0x0'));var logger=require(_0x816d('0x1'))(_0x816d('0x2'));var moment=require(_0x816d('0x3'));var BPromise=require(_0x816d('0x4'));var rp=require(_0x816d('0x5'));var fs=require('fs');var path=require(_0x816d('0x6'));var rimraf=require(_0x816d('0x7'));var config=require(_0x816d('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x816d('0x9')]=function(_0x58d744,_0x39c8dc){return _0x58d744[_0x816d('0xa')](_0x816d('0xb'),attributes,{'tableName':_0x816d('0xc'),'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 4e1dbe9..2da664b 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x549e49,_0x94ee2f){var _0x53fdd3=function(_0x3a7710){while(--_0x3a7710){_0x549e49['push'](_0x549e49['shift']());}};_0x53fdd3(++_0x94ee2f);}(_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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3987ed,_0x2c7c9d){var _0x4ce590=function(_0x48a1bc){while(--_0x48a1bc){_0x3987ed['push'](_0x3987ed['shift']());}};_0x4ce590(++_0x2c7c9d);}(_0x70e0,0x17b));var _0x070e=function(_0xefa64b,_0x394b8a){_0xefa64b=_0xefa64b-0x0;var _0x2e4901=_0x70e0[_0xefa64b];return _0x2e4901;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 04e0e93..19c2543 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 _0xd4e5=['destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','describe','/:id','put','isAuthenticated','update','delete'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd4e5,0x122));var _0x5d4e=function(_0x36d94f,_0x5e30f4){_0x36d94f=_0x36d94f-0x0;var _0x467193=_0xd4e5[_0x36d94f];return _0x467193;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d4e('0x0'));var timeout=require(_0x5d4e('0x1'));var express=require('express');var router=express[_0x5d4e('0x2')]();var fs_extra=require(_0x5d4e('0x3'));var auth=require(_0x5d4e('0x4'));var interaction=require(_0x5d4e('0x5'));var config=require(_0x5d4e('0x6'));var controller=require(_0x5d4e('0x7'));router[_0x5d4e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5d4e('0x8')](_0x5d4e('0x9'),auth['isAuthenticated'](),controller[_0x5d4e('0xa')]);router[_0x5d4e('0x8')](_0x5d4e('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5d4e('0xc')](_0x5d4e('0xb'),auth[_0x5d4e('0xd')](),controller[_0x5d4e('0xe')]);router[_0x5d4e('0xf')]('/:id',auth[_0x5d4e('0xd')](),controller[_0x5d4e('0x10')]);module[_0x5d4e('0x11')]=router; \ No newline at end of file +var _0xa993=['post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe'];(function(_0x1308d4,_0x459abf){var _0x143718=function(_0x5f0478){while(--_0x5f0478){_0x1308d4['push'](_0x1308d4['shift']());}};_0x143718(++_0x459abf);}(_0xa993,0x142));var _0x3a99=function(_0x2c5d2b,_0x3067e0){_0x2c5d2b=_0x2c5d2b-0x0;var _0x4fedd3=_0xa993[_0x2c5d2b];return _0x4fedd3;};'use strict';var multer=require(_0x3a99('0x0'));var util=require(_0x3a99('0x1'));var path=require(_0x3a99('0x2'));var timeout=require(_0x3a99('0x3'));var express=require(_0x3a99('0x4'));var router=express[_0x3a99('0x5')]();var fs_extra=require(_0x3a99('0x6'));var auth=require(_0x3a99('0x7'));var interaction=require(_0x3a99('0x8'));var config=require(_0x3a99('0x9'));var controller=require(_0x3a99('0xa'));router['get']('/',auth[_0x3a99('0xb')](),controller['index']);router[_0x3a99('0xc')](_0x3a99('0xd'),auth[_0x3a99('0xb')](),controller['describe']);router['get']('/:id',auth[_0x3a99('0xb')](),controller['show']);router[_0x3a99('0xe')]('/',auth[_0x3a99('0xb')](),controller[_0x3a99('0xf')]);router['put']('/:id',auth[_0x3a99('0xb')](),controller[_0x3a99('0x10')]);router[_0x3a99('0x11')](_0x3a99('0x12'),auth['isAuthenticated'](),controller[_0x3a99('0x13')]);module[_0x3a99('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 45c362d..264db30 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x378682,_0x29a755){_0x378682=_0x378682-0x0;var _0x5a9583=_0x7a54[_0x378682];return _0x5a9583;};'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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x1a854f,_0xe870ee){_0x1a854f=_0x1a854f-0x0;var _0x5e3743=_0x7a54[_0x1a854f];return _0x5e3743;};'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 6492027..97f15b0 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 _0x7a5f=['lodash','squel','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','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra'];(function(_0x5ddee5,_0x404f9c){var _0x5c399d=function(_0x41ad91){while(--_0x41ad91){_0x5ddee5['push'](_0x5ddee5['shift']());}};_0x5c399d(++_0x404f9c);}(_0x7a5f,0x1e1));var _0xf7a5=function(_0x27c24e,_0x5db1c7){_0x27c24e=_0x27c24e-0x0;var _0x39004a=_0x7a5f[_0x27c24e];return _0x39004a;};'use strict';var emlformat=require(_0xf7a5('0x0'));var rimraf=require(_0xf7a5('0x1'));var zipdir=require(_0xf7a5('0x2'));var jsonpatch=require(_0xf7a5('0x3'));var rp=require(_0xf7a5('0x4'));var moment=require(_0xf7a5('0x5'));var BPromise=require(_0xf7a5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf7a5('0x7'));var sox=require(_0xf7a5('0x8'));var csv=require('to-csv');var ejs=require(_0xf7a5('0x9'));var fs=require('fs');var fs_extra=require(_0xf7a5('0xa'));var _=require(_0xf7a5('0xb'));var squel=require(_0xf7a5('0xc'));var crypto=require(_0xf7a5('0xd'));var jsforce=require(_0xf7a5('0xe'));var deskjs=require(_0xf7a5('0xf'));var toCsv=require(_0xf7a5('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf7a5('0x11'));var authService=require(_0xf7a5('0x12'));var qs=require(_0xf7a5('0x13'));var as=require(_0xf7a5('0x14'));var hardwareService=require(_0xf7a5('0x15'));var logger=require(_0xf7a5('0x16'))(_0xf7a5('0x17'));var utils=require('../../config/utils');var config=require(_0xf7a5('0x18'));var licenseUtil=require(_0xf7a5('0x19'));var db=require(_0xf7a5('0x1a'))['db'];function respondWithStatusCode(_0x568baa,_0x57879e){_0x57879e=_0x57879e||0xcc;return function(_0x3dc17b){if(_0x3dc17b){return _0x568baa[_0xf7a5('0x1b')](_0x57879e);}return _0x568baa[_0xf7a5('0x1c')](_0x57879e)['end']();};}function respondWithResult(_0x590b8d,_0x4abade){_0x4abade=_0x4abade||0xc8;return function(_0x5cf878){if(_0x5cf878){return _0x590b8d[_0xf7a5('0x1c')](_0x4abade)[_0xf7a5('0x1d')](_0x5cf878);}};}function respondWithFilteredResult(_0x3dac8e,_0x313e7e){return function(_0x6d5f98){if(_0x6d5f98){var _0x23bb5f=typeof _0x313e7e[_0xf7a5('0x1e')]===_0xf7a5('0x1f')&&typeof _0x313e7e['limit']==='undefined';var _0x426829=_0x6d5f98['count'];var _0x15e654=_0x23bb5f?0x0:_0x313e7e[_0xf7a5('0x1e')];var _0x450b2e=_0x23bb5f?_0x6d5f98[_0xf7a5('0x20')]:_0x313e7e[_0xf7a5('0x1e')]+_0x313e7e[_0xf7a5('0x21')];var _0x2757fa;if(_0x450b2e>=_0x426829){_0x450b2e=_0x426829;_0x2757fa=0xc8;}else{_0x2757fa=0xce;}_0x3dac8e[_0xf7a5('0x1c')](_0x2757fa);return _0x3dac8e['set'](_0xf7a5('0x22'),_0x15e654+'-'+_0x450b2e+'/'+_0x426829)['json'](_0x6d5f98);}return null;};}function patchUpdates(_0x3e7890){return function(_0x5b9c68){try{jsonpatch[_0xf7a5('0x23')](_0x5b9c68,_0x3e7890,!![]);}catch(_0x22cdf5){return BPromise[_0xf7a5('0x24')](_0x22cdf5);}return _0x5b9c68[_0xf7a5('0x25')]();};}function saveUpdates(_0xa9859b,_0x506e4b){return function(_0x5197bb){if(_0x5197bb){return _0x5197bb[_0xf7a5('0x26')](_0xa9859b)[_0xf7a5('0x27')](function(_0x4916c6){return _0x4916c6;});}return null;};}function removeEntity(_0x5ee375,_0x4bec2c){return function(_0x218922){if(_0x218922){return _0x218922['destroy']()[_0xf7a5('0x27')](function(){_0x5ee375[_0xf7a5('0x1c')](0xcc)[_0xf7a5('0x28')]();});}};}function handleEntityNotFound(_0x29534a,_0x306d8d){return function(_0x126d7a){if(!_0x126d7a){_0x29534a['sendStatus'](0x194);}return _0x126d7a;};}function handleError(_0x47931b,_0x1717bc){_0x1717bc=_0x1717bc||0x1f4;return function(_0x571117){logger[_0xf7a5('0x29')](_0x571117[_0xf7a5('0x2a')]);if(_0x571117[_0xf7a5('0x2b')]){delete _0x571117[_0xf7a5('0x2b')];}_0x47931b['status'](_0x1717bc)[_0xf7a5('0x2c')](_0x571117);};}exports[_0xf7a5('0x2d')]=function(_0x30e0a9,_0x5d9775){var _0x49df4c={},_0x31bc8e={},_0xa533bd={'count':0x0,'rows':[]};var _0x261a91=_[_0xf7a5('0x2e')](db[_0xf7a5('0x2f')][_0xf7a5('0x30')],function(_0x56be45){return{'name':_0x56be45[_0xf7a5('0x31')],'type':_0x56be45[_0xf7a5('0x32')][_0xf7a5('0x33')]};});_0x31bc8e[_0xf7a5('0x34')]=_['map'](_0x261a91,_0xf7a5('0x2b'));_0x31bc8e[_0xf7a5('0x35')]=_['keys'](_0x30e0a9['query']);_0x31bc8e[_0xf7a5('0x36')]=_[_0xf7a5('0x37')](_0x31bc8e['model'],_0x31bc8e[_0xf7a5('0x35')]);_0x49df4c['attributes']=_[_0xf7a5('0x37')](_0x31bc8e[_0xf7a5('0x34')],qs[_0xf7a5('0x38')](_0x30e0a9['query'][_0xf7a5('0x38')]));_0x49df4c[_0xf7a5('0x39')]=_0x49df4c[_0xf7a5('0x39')][_0xf7a5('0x3a')]?_0x49df4c[_0xf7a5('0x39')]:_0x31bc8e[_0xf7a5('0x34')];if(!_0x30e0a9['query'][_0xf7a5('0x3b')](_0xf7a5('0x3c'))){_0x49df4c[_0xf7a5('0x21')]=qs['limit'](_0x30e0a9[_0xf7a5('0x35')][_0xf7a5('0x21')]);_0x49df4c['offset']=qs[_0xf7a5('0x1e')](_0x30e0a9[_0xf7a5('0x35')][_0xf7a5('0x1e')]);}_0x49df4c[_0xf7a5('0x3d')]=qs[_0xf7a5('0x3e')](_0x30e0a9[_0xf7a5('0x35')][_0xf7a5('0x3e')]);_0x49df4c[_0xf7a5('0x3f')]=qs['filters'](_[_0xf7a5('0x40')](_0x30e0a9['query'],_0x31bc8e[_0xf7a5('0x36')]),_0x261a91);if(_0x30e0a9[_0xf7a5('0x35')][_0xf7a5('0x41')]){_0x49df4c[_0xf7a5('0x3f')]=_[_0xf7a5('0x42')](_0x49df4c['where'],{'$or':_[_0xf7a5('0x2e')](_0x261a91,function(_0x45d831){if(_0x45d831[_0xf7a5('0x32')]!==_0xf7a5('0x43')){var _0x324e6e={};_0x324e6e[_0x45d831['name']]={'$like':'%'+_0x30e0a9[_0xf7a5('0x35')][_0xf7a5('0x41')]+'%'};return _0x324e6e;}})});}_0x49df4c=_[_0xf7a5('0x42')]({},_0x49df4c,_0x30e0a9['options']);var _0x2c5070={'where':_0x49df4c['where']};return db[_0xf7a5('0x2f')]['count'](_0x2c5070)[_0xf7a5('0x27')](function(_0x4537bc){_0xa533bd['count']=_0x4537bc;if(_0x30e0a9[_0xf7a5('0x35')]['includeAll']){_0x49df4c[_0xf7a5('0x44')]=[{'all':!![]}];}return db[_0xf7a5('0x2f')][_0xf7a5('0x45')](_0x49df4c);})[_0xf7a5('0x27')](function(_0x2f184b){_0xa533bd[_0xf7a5('0x46')]=_0x2f184b;return _0xa533bd;})[_0xf7a5('0x27')](respondWithFilteredResult(_0x5d9775,_0x49df4c))[_0xf7a5('0x47')](handleError(_0x5d9775,null));};exports[_0xf7a5('0x48')]=function(_0xf5578a,_0x12ec2d){var _0x17affe={'raw':!![],'where':{'id':_0xf5578a[_0xf7a5('0x49')]['id']}},_0x49b815={};_0x49b815[_0xf7a5('0x34')]=_[_0xf7a5('0x4a')](db[_0xf7a5('0x2f')][_0xf7a5('0x30')]);_0x49b815['query']=_['keys'](_0xf5578a[_0xf7a5('0x35')]);_0x49b815['filters']=_[_0xf7a5('0x37')](_0x49b815[_0xf7a5('0x34')],_0x49b815['query']);_0x17affe[_0xf7a5('0x39')]=_[_0xf7a5('0x37')](_0x49b815[_0xf7a5('0x34')],qs[_0xf7a5('0x38')](_0xf5578a[_0xf7a5('0x35')][_0xf7a5('0x38')]));_0x17affe[_0xf7a5('0x39')]=_0x17affe['attributes'][_0xf7a5('0x3a')]?_0x17affe['attributes']:_0x49b815['model'];if(_0xf5578a['query'][_0xf7a5('0x4b')]){_0x17affe['include']=[{'all':!![]}];}_0x17affe=_[_0xf7a5('0x42')]({},_0x17affe,_0xf5578a[_0xf7a5('0x4c')]);return db[_0xf7a5('0x2f')][_0xf7a5('0x4d')](_0x17affe)[_0xf7a5('0x27')](handleEntityNotFound(_0x12ec2d,null))[_0xf7a5('0x27')](respondWithResult(_0x12ec2d,null))['catch'](handleError(_0x12ec2d,null));};exports[_0xf7a5('0x4e')]=function(_0x46e39c,_0x1d5ef3){return db[_0xf7a5('0x2f')]['create'](_0x46e39c[_0xf7a5('0x4f')],{})[_0xf7a5('0x27')](respondWithResult(_0x1d5ef3,0xc9))[_0xf7a5('0x47')](handleError(_0x1d5ef3,null));};exports['update']=function(_0xfbbf16,_0x23e733){if(_0xfbbf16[_0xf7a5('0x4f')]['id']){delete _0xfbbf16[_0xf7a5('0x4f')]['id'];}return db[_0xf7a5('0x2f')]['find']({'where':{'id':_0xfbbf16[_0xf7a5('0x49')]['id']}})[_0xf7a5('0x27')](handleEntityNotFound(_0x23e733,null))[_0xf7a5('0x27')](saveUpdates(_0xfbbf16[_0xf7a5('0x4f')],null))[_0xf7a5('0x27')](respondWithResult(_0x23e733,null))[_0xf7a5('0x47')](handleError(_0x23e733,null));};exports[_0xf7a5('0x50')]=function(_0x5bfc87,_0x5286fc){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x5bfc87[_0xf7a5('0x49')]['id']}})[_0xf7a5('0x27')](handleEntityNotFound(_0x5286fc,null))[_0xf7a5('0x27')](removeEntity(_0x5286fc,null))['catch'](handleError(_0x5286fc,null));};exports[_0xf7a5('0x51')]=function(_0x4ebadf,_0x59ba7f){return db[_0xf7a5('0x2f')][_0xf7a5('0x51')]()[_0xf7a5('0x27')](respondWithResult(_0x59ba7f,null))[_0xf7a5('0x47')](handleError(_0x59ba7f,null));}; \ No newline at end of file +var _0xe787=['update','destroy','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','name','filter','options','then','includeAll','include','findAll','rows','find','create','body','params','describe','catch','eml-format','rimraf','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x4e4a9c,_0x425697){var _0x3405c7=function(_0x2a5d61){while(--_0x2a5d61){_0x4e4a9c['push'](_0x4e4a9c['shift']());}};_0x3405c7(++_0x425697);}(_0xe787,0x153));var _0x7e78=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xe787[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x7e78('0x0'));var rimraf=require(_0x7e78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e78('0x2'));var rp=require(_0x7e78('0x3'));var moment=require(_0x7e78('0x4'));var BPromise=require(_0x7e78('0x5'));var Mustache=require('mustache');var util=require(_0x7e78('0x6'));var path=require('path');var sox=require(_0x7e78('0x7'));var csv=require(_0x7e78('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e78('0x9'));var _=require(_0x7e78('0xa'));var squel=require(_0x7e78('0xb'));var crypto=require(_0x7e78('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7e78('0xd'));var toCsv=require(_0x7e78('0x8'));var querystring=require(_0x7e78('0xe'));var Papa=require(_0x7e78('0xf'));var Redis=require('ioredis');var authService=require(_0x7e78('0x10'));var qs=require(_0x7e78('0x11'));var as=require(_0x7e78('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e78('0x13'))(_0x7e78('0x14'));var utils=require(_0x7e78('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7e78('0x16'));var db=require(_0x7e78('0x17'))['db'];function respondWithStatusCode(_0x282c15,_0x1dd9ba){_0x1dd9ba=_0x1dd9ba||0xcc;return function(_0x2d0840){if(_0x2d0840){return _0x282c15[_0x7e78('0x18')](_0x1dd9ba);}return _0x282c15[_0x7e78('0x19')](_0x1dd9ba)[_0x7e78('0x1a')]();};}function respondWithResult(_0x47db97,_0x1d5e95){_0x1d5e95=_0x1d5e95||0xc8;return function(_0x6259a6){if(_0x6259a6){return _0x47db97[_0x7e78('0x19')](_0x1d5e95)['json'](_0x6259a6);}};}function respondWithFilteredResult(_0x4286e9,_0x53e22c){return function(_0x4b6f77){if(_0x4b6f77){var _0x4ff55e=typeof _0x53e22c[_0x7e78('0x1b')]==='undefined'&&typeof _0x53e22c['limit']===_0x7e78('0x1c');var _0x1b0322=_0x4b6f77['count'];var _0x5c2558=_0x4ff55e?0x0:_0x53e22c[_0x7e78('0x1b')];var _0x541572=_0x4ff55e?_0x4b6f77[_0x7e78('0x1d')]:_0x53e22c[_0x7e78('0x1b')]+_0x53e22c[_0x7e78('0x1e')];var _0x4f381f;if(_0x541572>=_0x1b0322){_0x541572=_0x1b0322;_0x4f381f=0xc8;}else{_0x4f381f=0xce;}_0x4286e9[_0x7e78('0x19')](_0x4f381f);return _0x4286e9[_0x7e78('0x1f')](_0x7e78('0x20'),_0x5c2558+'-'+_0x541572+'/'+_0x1b0322)['json'](_0x4b6f77);}return null;};}function patchUpdates(_0xbd5a53){return function(_0x5077cd){try{jsonpatch[_0x7e78('0x21')](_0x5077cd,_0xbd5a53,!![]);}catch(_0x164c63){return BPromise[_0x7e78('0x22')](_0x164c63);}return _0x5077cd[_0x7e78('0x23')]();};}function saveUpdates(_0x8a4a76,_0x1333c2){return function(_0x4f6ba3){if(_0x4f6ba3){return _0x4f6ba3[_0x7e78('0x24')](_0x8a4a76)['then'](function(_0x11be76){return _0x11be76;});}return null;};}function removeEntity(_0x5274c2,_0x4fd7be){return function(_0x5efc4b){if(_0x5efc4b){return _0x5efc4b[_0x7e78('0x25')]()['then'](function(){_0x5274c2[_0x7e78('0x19')](0xcc)[_0x7e78('0x1a')]();});}};}function handleEntityNotFound(_0x149d87,_0x529035){return function(_0x21abf9){if(!_0x21abf9){_0x149d87['sendStatus'](0x194);}return _0x21abf9;};}function handleError(_0x4566ad,_0x13cba6){_0x13cba6=_0x13cba6||0x1f4;return function(_0x5d7f4e){logger[_0x7e78('0x26')](_0x5d7f4e[_0x7e78('0x27')]);if(_0x5d7f4e['name']){delete _0x5d7f4e['name'];}_0x4566ad[_0x7e78('0x19')](_0x13cba6)[_0x7e78('0x28')](_0x5d7f4e);};}exports[_0x7e78('0x29')]=function(_0x16e19d,_0x115851){var _0x36e2ae={},_0x1ee59d={},_0x313f7a={'count':0x0,'rows':[]};var _0x424d07=_[_0x7e78('0x2a')](db[_0x7e78('0x2b')][_0x7e78('0x2c')],function(_0x4b44be){return{'name':_0x4b44be[_0x7e78('0x2d')],'type':_0x4b44be[_0x7e78('0x2e')][_0x7e78('0x2f')]};});_0x1ee59d[_0x7e78('0x30')]=_[_0x7e78('0x2a')](_0x424d07,'name');_0x1ee59d[_0x7e78('0x31')]=_[_0x7e78('0x32')](_0x16e19d[_0x7e78('0x31')]);_0x1ee59d[_0x7e78('0x33')]=_[_0x7e78('0x34')](_0x1ee59d[_0x7e78('0x30')],_0x1ee59d['query']);_0x36e2ae['attributes']=_[_0x7e78('0x34')](_0x1ee59d[_0x7e78('0x30')],qs['fields'](_0x16e19d['query'][_0x7e78('0x35')]));_0x36e2ae['attributes']=_0x36e2ae[_0x7e78('0x36')][_0x7e78('0x37')]?_0x36e2ae[_0x7e78('0x36')]:_0x1ee59d[_0x7e78('0x30')];if(!_0x16e19d[_0x7e78('0x31')]['hasOwnProperty'](_0x7e78('0x38'))){_0x36e2ae[_0x7e78('0x1e')]=qs[_0x7e78('0x1e')](_0x16e19d[_0x7e78('0x31')]['limit']);_0x36e2ae['offset']=qs[_0x7e78('0x1b')](_0x16e19d['query'][_0x7e78('0x1b')]);}_0x36e2ae[_0x7e78('0x39')]=qs[_0x7e78('0x3a')](_0x16e19d[_0x7e78('0x31')][_0x7e78('0x3a')]);_0x36e2ae[_0x7e78('0x3b')]=qs['filters'](_['pick'](_0x16e19d['query'],_0x1ee59d[_0x7e78('0x33')]),_0x424d07);if(_0x16e19d[_0x7e78('0x31')]['filter']){_0x36e2ae[_0x7e78('0x3b')]=_[_0x7e78('0x3c')](_0x36e2ae[_0x7e78('0x3b')],{'$or':_[_0x7e78('0x2a')](_0x424d07,function(_0x3fa492){if(_0x3fa492['type']!=='VIRTUAL'){var _0x4230bd={};_0x4230bd[_0x3fa492[_0x7e78('0x3d')]]={'$like':'%'+_0x16e19d[_0x7e78('0x31')][_0x7e78('0x3e')]+'%'};return _0x4230bd;}})});}_0x36e2ae=_[_0x7e78('0x3c')]({},_0x36e2ae,_0x16e19d[_0x7e78('0x3f')]);var _0x52bc15={'where':_0x36e2ae[_0x7e78('0x3b')]};return db[_0x7e78('0x2b')][_0x7e78('0x1d')](_0x52bc15)[_0x7e78('0x40')](function(_0x1cc69a){_0x313f7a[_0x7e78('0x1d')]=_0x1cc69a;if(_0x16e19d['query'][_0x7e78('0x41')]){_0x36e2ae[_0x7e78('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7e78('0x43')](_0x36e2ae);})['then'](function(_0x5a77b6){_0x313f7a[_0x7e78('0x44')]=_0x5a77b6;return _0x313f7a;})[_0x7e78('0x40')](respondWithFilteredResult(_0x115851,_0x36e2ae))['catch'](handleError(_0x115851,null));};exports['show']=function(_0x552c8e,_0x69b233){var _0x5219ab={'raw':!![],'where':{'id':_0x552c8e['params']['id']}},_0x1ab118={};_0x1ab118['model']=_[_0x7e78('0x32')](db[_0x7e78('0x2b')][_0x7e78('0x2c')]);_0x1ab118[_0x7e78('0x31')]=_[_0x7e78('0x32')](_0x552c8e['query']);_0x1ab118[_0x7e78('0x33')]=_['intersection'](_0x1ab118[_0x7e78('0x30')],_0x1ab118['query']);_0x5219ab[_0x7e78('0x36')]=_['intersection'](_0x1ab118[_0x7e78('0x30')],qs[_0x7e78('0x35')](_0x552c8e[_0x7e78('0x31')][_0x7e78('0x35')]));_0x5219ab[_0x7e78('0x36')]=_0x5219ab[_0x7e78('0x36')][_0x7e78('0x37')]?_0x5219ab[_0x7e78('0x36')]:_0x1ab118[_0x7e78('0x30')];if(_0x552c8e[_0x7e78('0x31')]['includeAll']){_0x5219ab[_0x7e78('0x42')]=[{'all':!![]}];}_0x5219ab=_[_0x7e78('0x3c')]({},_0x5219ab,_0x552c8e[_0x7e78('0x3f')]);return db[_0x7e78('0x2b')][_0x7e78('0x45')](_0x5219ab)[_0x7e78('0x40')](handleEntityNotFound(_0x69b233,null))['then'](respondWithResult(_0x69b233,null))['catch'](handleError(_0x69b233,null));};exports[_0x7e78('0x46')]=function(_0x119df6,_0x3f8922){return db['JscriptyQuestionReport'][_0x7e78('0x46')](_0x119df6[_0x7e78('0x47')],{})[_0x7e78('0x40')](respondWithResult(_0x3f8922,0xc9))['catch'](handleError(_0x3f8922,null));};exports[_0x7e78('0x24')]=function(_0x27a80a,_0x28e07e){if(_0x27a80a[_0x7e78('0x47')]['id']){delete _0x27a80a[_0x7e78('0x47')]['id'];}return db[_0x7e78('0x2b')]['find']({'where':{'id':_0x27a80a[_0x7e78('0x48')]['id']}})[_0x7e78('0x40')](handleEntityNotFound(_0x28e07e,null))[_0x7e78('0x40')](saveUpdates(_0x27a80a[_0x7e78('0x47')],null))[_0x7e78('0x40')](respondWithResult(_0x28e07e,null))['catch'](handleError(_0x28e07e,null));};exports[_0x7e78('0x25')]=function(_0x1509ff,_0x2b4aac){return db[_0x7e78('0x2b')][_0x7e78('0x45')]({'where':{'id':_0x1509ff[_0x7e78('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b4aac,null))[_0x7e78('0x40')](removeEntity(_0x2b4aac,null))['catch'](handleError(_0x2b4aac,null));};exports[_0x7e78('0x49')]=function(_0x428575,_0xf8d57b){return db['JscriptyQuestionReport'][_0x7e78('0x49')]()['then'](respondWithResult(_0xf8d57b,null))[_0x7e78('0x4a')](handleError(_0xf8d57b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 1658692..9cf3f1a 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 _0x73ac=['rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util','moment','bluebird','request-promise'];(function(_0x3657c4,_0xd44051){var _0x1047b3=function(_0x4da30f){while(--_0x4da30f){_0x3657c4['push'](_0x3657c4['shift']());}};_0x1047b3(++_0xd44051);}(_0x73ac,0x163));var _0xc73a=function(_0x4d6d99,_0x24f7db){_0x4d6d99=_0x4d6d99-0x0;var _0xe1cfc9=_0x73ac[_0x4d6d99];return _0xe1cfc9;};'use strict';var _=require(_0xc73a('0x0'));var util=require(_0xc73a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc73a('0x2'));var BPromise=require(_0xc73a('0x3'));var rp=require(_0xc73a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc73a('0x5'));var config=require('../../config/environment');var attributes=require(_0xc73a('0x6'));module[_0xc73a('0x7')]=function(_0x28f55c,_0x4c2024){return _0x28f55c[_0xc73a('0x8')](_0xc73a('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8732=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x8732,0x181));var _0x2873=function(_0x2f8125,_0x260435){_0x2f8125=_0x2f8125-0x0;var _0x332dfb=_0x8732[_0x2f8125];return _0x332dfb;};'use strict';var _=require(_0x2873('0x0'));var util=require(_0x2873('0x1'));var logger=require(_0x2873('0x2'))(_0x2873('0x3'));var moment=require(_0x2873('0x4'));var BPromise=require(_0x2873('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2873('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2873('0x7'));module[_0x2873('0x8')]=function(_0x6a7c6a,_0x59d16c){return _0x6a7c6a[_0x2873('0x9')](_0x2873('0xa'),attributes,{'tableName':_0x2873('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 9ccbb57..d13df0c 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 _0x60fa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x60fa,0xbb));var _0xa60f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa60f('0x0'));var util=require(_0xa60f('0x1'));var moment=require(_0xa60f('0x2'));var BPromise=require(_0xa60f('0x3'));var rs=require(_0xa60f('0x4'));var fs=require('fs');var Redis=require(_0xa60f('0x5'));var db=require(_0xa60f('0x6'))['db'];var utils=require(_0xa60f('0x7'));var logger=require(_0xa60f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa60f('0x9'));var client=jayson[_0xa60f('0xa')][_0xa60f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a55e4,_0xdf3ddc,_0xa90ca4){return new BPromise(function(_0x17b24b,_0x37a3ea){return client[_0xa60f('0xc')](_0x2a55e4,_0xa90ca4)['then'](function(_0x5438c5){logger[_0xa60f('0xd')](_0xa60f('0xe'),_0xdf3ddc,_0xa60f('0xf'));logger[_0xa60f('0x10')](_0xa60f('0x11'),_0xdf3ddc,_0xa60f('0xf'),JSON[_0xa60f('0x12')](_0x5438c5));if(_0x5438c5[_0xa60f('0x13')]){if(_0x5438c5[_0xa60f('0x13')][_0xa60f('0x14')]===0x1f4){logger[_0xa60f('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xdf3ddc,_0x5438c5[_0xa60f('0x13')]['message']);return _0x37a3ea(_0x5438c5[_0xa60f('0x13')][_0xa60f('0x15')]);}logger[_0xa60f('0x13')](_0xa60f('0xe'),_0xdf3ddc,_0x5438c5[_0xa60f('0x13')][_0xa60f('0x15')]);return _0x17b24b(_0x5438c5['error'][_0xa60f('0x15')]);}else{logger['info'](_0xa60f('0xe'),_0xdf3ddc,_0xa60f('0xf'));_0x17b24b(_0x5438c5[_0xa60f('0x16')][_0xa60f('0x15')]);}})[_0xa60f('0x17')](function(_0x5152ef){logger[_0xa60f('0x13')](_0xa60f('0xe'),_0xdf3ddc,_0x5152ef);_0x37a3ea(_0x5152ef);});});} \ No newline at end of file +var _0x91e2=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91e2,0x1e6));var _0x291e=function(_0x1ee942,_0x819591){_0x1ee942=_0x1ee942-0x0;var _0x6b6770=_0x91e2[_0x1ee942];return _0x6b6770;};'use strict';var _=require(_0x291e('0x0'));var util=require(_0x291e('0x1'));var moment=require('moment');var BPromise=require(_0x291e('0x2'));var rs=require(_0x291e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x291e('0x4'));var logger=require(_0x291e('0x5'))(_0x291e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x291e('0x7')][_0x291e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b0360,_0x42cd45,_0x2aadb0){return new BPromise(function(_0x5e1de4,_0x1670af){return client[_0x291e('0x9')](_0x3b0360,_0x2aadb0)[_0x291e('0xa')](function(_0xbc49a9){logger['info'](_0x291e('0xb'),_0x42cd45,_0x291e('0xc'));logger[_0x291e('0xd')](_0x291e('0xe'),_0x42cd45,'request\x20sent',JSON[_0x291e('0xf')](_0xbc49a9));if(_0xbc49a9[_0x291e('0x10')]){if(_0xbc49a9[_0x291e('0x10')]['code']===0x1f4){logger[_0x291e('0x10')](_0x291e('0xb'),_0x42cd45,_0xbc49a9['error'][_0x291e('0x11')]);return _0x1670af(_0xbc49a9['error'][_0x291e('0x11')]);}logger['error'](_0x291e('0xb'),_0x42cd45,_0xbc49a9[_0x291e('0x10')][_0x291e('0x11')]);return _0x5e1de4(_0xbc49a9['error'][_0x291e('0x11')]);}else{logger[_0x291e('0x12')](_0x291e('0xb'),_0x42cd45,'request\x20sent');_0x5e1de4(_0xbc49a9['result'][_0x291e('0x11')]);}})[_0x291e('0x13')](function(_0x83225c){logger['error'](_0x291e('0xb'),_0x42cd45,_0x83225c);_0x1670af(_0x83225c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2c7e82c..871fd0f 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 _0x9b4f=['../../config/environment','get','isAuthenticated','describe','show','/:id/questions','post','create','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9b4f,0x10a));var _0xf9b4=function(_0x342f92,_0x5d1c5e){_0x342f92=_0x342f92-0x0;var _0x5f4e01=_0x9b4f[_0x342f92];return _0x5f4e01;};'use strict';var multer=require(_0xf9b4('0x0'));var util=require('util');var path=require(_0xf9b4('0x1'));var timeout=require(_0xf9b4('0x2'));var express=require(_0xf9b4('0x3'));var router=express[_0xf9b4('0x4')]();var fs_extra=require(_0xf9b4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf9b4('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0xf9b4('0x7')]('/',auth[_0xf9b4('0x8')](),controller['index']);router['get']('/describe',auth[_0xf9b4('0x8')](),controller[_0xf9b4('0x9')]);router[_0xf9b4('0x7')]('/:id',auth[_0xf9b4('0x8')](),controller[_0xf9b4('0xa')]);router[_0xf9b4('0x7')](_0xf9b4('0xb'),auth['isAuthenticated'](),controller['getQuestions']);router[_0xf9b4('0xc')]('/',auth[_0xf9b4('0x8')](),controller[_0xf9b4('0xd')]);router['put'](_0xf9b4('0xe'),auth[_0xf9b4('0x8')](),controller['update']);router[_0xf9b4('0xf')](_0xf9b4('0xe'),auth[_0xf9b4('0x8')](),controller['destroy']);module[_0xf9b4('0x10')]=router; \ No newline at end of file +var _0x449d=['util','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','/:id/questions','create','put','delete','destroy','exports','multer'];(function(_0x43a341,_0x51f9ef){var _0x48234e=function(_0xe5176b){while(--_0xe5176b){_0x43a341['push'](_0x43a341['shift']());}};_0x48234e(++_0x51f9ef);}(_0x449d,0x1d3));var _0xd449=function(_0x5c2eac,_0x566843){_0x5c2eac=_0x5c2eac-0x0;var _0x7f47f9=_0x449d[_0x5c2eac];return _0x7f47f9;};'use strict';var multer=require(_0xd449('0x0'));var util=require(_0xd449('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd449('0x2'));var router=express['Router']();var fs_extra=require(_0xd449('0x3'));var auth=require(_0xd449('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd449('0x5'));var controller=require(_0xd449('0x6'));router[_0xd449('0x7')]('/',auth[_0xd449('0x8')](),controller['index']);router[_0xd449('0x7')](_0xd449('0x9'),auth[_0xd449('0x8')](),controller[_0xd449('0xa')]);router[_0xd449('0x7')](_0xd449('0xb'),auth[_0xd449('0x8')](),controller['show']);router['get'](_0xd449('0xc'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth['isAuthenticated'](),controller[_0xd449('0xd')]);router[_0xd449('0xe')](_0xd449('0xb'),auth[_0xd449('0x8')](),controller['update']);router[_0xd449('0xf')](_0xd449('0xb'),auth[_0xd449('0x8')](),controller[_0xd449('0x10')]);module[_0xd449('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 1a502da..de462ac 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 _0x11e3=['BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','STRING'];(function(_0xee7152,_0x2f5b9f){var _0x53d570=function(_0x54eb47){while(--_0x54eb47){_0xee7152['push'](_0xee7152['shift']());}};_0x53d570(++_0x2f5b9f);}(_0x11e3,0x6f));var _0x311e=function(_0x1f206d,_0x589ba7){_0x1f206d=_0x1f206d-0x0;var _0xa99e4c=_0x11e3[_0x1f206d];return _0xa99e4c;};'use strict';var moment=require(_0x311e('0x0'));var Sequelize=require(_0x311e('0x1'));module[_0x311e('0x2')]={'starttime':{'type':Sequelize[_0x311e('0x3')],'set':function(_0x4b29b7){this[_0x311e('0x4')](_0x311e('0x5'),_0x4b29b7);this['setDataValue'](_0x311e('0x6'),moment()[_0x311e('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x311e('0x8')]},'projectname':{'type':Sequelize[_0x311e('0x8')]},'queue':{'type':Sequelize[_0x311e('0x8')]},'uniqueid':{'type':Sequelize[_0x311e('0x8')]},'calleridname':{'type':Sequelize[_0x311e('0x8')]},'calleridnum':{'type':Sequelize[_0x311e('0x8')]},'completed':{'type':Sequelize[_0x311e('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b0a=['exports','DATE','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x20dc17,_0xa28a0f){var _0x1260c5=function(_0x2d0fad){while(--_0x2d0fad){_0x20dc17['push'](_0x20dc17['shift']());}};_0x1260c5(++_0xa28a0f);}(_0x5b0a,0xcd));var _0xa5b0=function(_0x5c9eb9,_0x310556){_0x5c9eb9=_0x5c9eb9-0x0;var _0x4a983f=_0x5b0a[_0x5c9eb9];return _0x4a983f;};'use strict';var moment=require(_0xa5b0('0x0'));var Sequelize=require(_0xa5b0('0x1'));module[_0xa5b0('0x2')]={'starttime':{'type':Sequelize[_0xa5b0('0x3')],'set':function(_0x243b81){this[_0xa5b0('0x4')]('starttime',_0x243b81);this[_0xa5b0('0x4')]('endtime',moment()[_0xa5b0('0x5')](_0xa5b0('0x6')));}},'endtime':{'type':Sequelize[_0xa5b0('0x3')]},'membername':{'type':Sequelize[_0xa5b0('0x7')]},'projectname':{'type':Sequelize[_0xa5b0('0x7')]},'queue':{'type':Sequelize[_0xa5b0('0x7')]},'uniqueid':{'type':Sequelize[_0xa5b0('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa5b0('0x7')]},'completed':{'type':Sequelize[_0xa5b0('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 290a3b0..21816eb 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 _0xbe49=['order','filter','merge','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','catch','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','sort','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','status','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x5da464,_0x1312c7){var _0x168d46=function(_0x51dcc1){while(--_0x51dcc1){_0x5da464['push'](_0x5da464['shift']());}};_0x168d46(++_0x1312c7);}(_0xbe49,0x162));var _0x9be4=function(_0x5ebd99,_0x1e0bca){_0x5ebd99=_0x5ebd99-0x0;var _0x9e7b93=_0xbe49[_0x5ebd99];return _0x9e7b93;};'use strict';var emlformat=require(_0x9be4('0x0'));var rimraf=require(_0x9be4('0x1'));var zipdir=require(_0x9be4('0x2'));var jsonpatch=require(_0x9be4('0x3'));var rp=require(_0x9be4('0x4'));var moment=require(_0x9be4('0x5'));var BPromise=require(_0x9be4('0x6'));var Mustache=require(_0x9be4('0x7'));var util=require(_0x9be4('0x8'));var path=require(_0x9be4('0x9'));var sox=require('sox');var csv=require(_0x9be4('0xa'));var ejs=require(_0x9be4('0xb'));var fs=require('fs');var fs_extra=require(_0x9be4('0xc'));var _=require(_0x9be4('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9be4('0xe'));var toCsv=require(_0x9be4('0xa'));var querystring=require('querystring');var Papa=require(_0x9be4('0xf'));var Redis=require(_0x9be4('0x10'));var authService=require(_0x9be4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9be4('0x12'));var hardwareService=require(_0x9be4('0x13'));var logger=require('../../config/logger')(_0x9be4('0x14'));var utils=require(_0x9be4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9be4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e886d,_0xae4020){_0xae4020=_0xae4020||0xcc;return function(_0x35d863){if(_0x35d863){return _0x2e886d[_0x9be4('0x17')](_0xae4020);}return _0x2e886d['status'](_0xae4020)[_0x9be4('0x18')]();};}function respondWithResult(_0x4b2e4c,_0x40e9ea){_0x40e9ea=_0x40e9ea||0xc8;return function(_0xe81d4e){if(_0xe81d4e){return _0x4b2e4c['status'](_0x40e9ea)[_0x9be4('0x19')](_0xe81d4e);}};}function respondWithFilteredResult(_0x1b74e6,_0x3d6e33){return function(_0x52d428){if(_0x52d428){var _0x4be25c=typeof _0x3d6e33[_0x9be4('0x1a')]==='undefined'&&typeof _0x3d6e33[_0x9be4('0x1b')]===_0x9be4('0x1c');var _0x3efdde=_0x52d428['count'];var _0x42a5f5=_0x4be25c?0x0:_0x3d6e33[_0x9be4('0x1a')];var _0x800da=_0x4be25c?_0x52d428[_0x9be4('0x1d')]:_0x3d6e33[_0x9be4('0x1a')]+_0x3d6e33['limit'];var _0x14e9f0;if(_0x800da>=_0x3efdde){_0x800da=_0x3efdde;_0x14e9f0=0xc8;}else{_0x14e9f0=0xce;}_0x1b74e6['status'](_0x14e9f0);return _0x1b74e6[_0x9be4('0x1e')](_0x9be4('0x1f'),_0x42a5f5+'-'+_0x800da+'/'+_0x3efdde)[_0x9be4('0x19')](_0x52d428);}return null;};}function patchUpdates(_0x56c502){return function(_0x3fd1bd){try{jsonpatch[_0x9be4('0x20')](_0x3fd1bd,_0x56c502,!![]);}catch(_0x4db873){return BPromise[_0x9be4('0x21')](_0x4db873);}return _0x3fd1bd[_0x9be4('0x22')]();};}function saveUpdates(_0x254bcb,_0x1d7a41){return function(_0x2285c4){if(_0x2285c4){return _0x2285c4[_0x9be4('0x23')](_0x254bcb)[_0x9be4('0x24')](function(_0x15a238){return _0x15a238;});}return null;};}function removeEntity(_0x129b9e,_0x4ba0d8){return function(_0x3624d5){if(_0x3624d5){return _0x3624d5[_0x9be4('0x25')]()[_0x9be4('0x24')](function(){_0x129b9e[_0x9be4('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x251258,_0x45ac6a){return function(_0xcc8bba){if(!_0xcc8bba){_0x251258[_0x9be4('0x17')](0x194);}return _0xcc8bba;};}function handleError(_0x576fab,_0x285446){_0x285446=_0x285446||0x1f4;return function(_0x226b7e){logger['error'](_0x226b7e[_0x9be4('0x27')]);if(_0x226b7e[_0x9be4('0x28')]){delete _0x226b7e['name'];}_0x576fab[_0x9be4('0x26')](_0x285446)[_0x9be4('0x29')](_0x226b7e);};}exports[_0x9be4('0x2a')]=function(_0x292e37,_0x2e3ac0){var _0xcae1f9={},_0x361d2f={},_0x496736={'count':0x0,'rows':[]};var _0x2e75eb=_['map'](db[_0x9be4('0x2b')][_0x9be4('0x2c')],function(_0x10bcd0){return{'name':_0x10bcd0[_0x9be4('0x2d')],'type':_0x10bcd0[_0x9be4('0x2e')][_0x9be4('0x2f')]};});_0x361d2f['model']=_['map'](_0x2e75eb,_0x9be4('0x28'));_0x361d2f[_0x9be4('0x30')]=_[_0x9be4('0x31')](_0x292e37['query']);_0x361d2f[_0x9be4('0x32')]=_[_0x9be4('0x33')](_0x361d2f[_0x9be4('0x34')],_0x361d2f[_0x9be4('0x30')]);_0xcae1f9[_0x9be4('0x35')]=_[_0x9be4('0x33')](_0x361d2f['model'],qs[_0x9be4('0x36')](_0x292e37['query'][_0x9be4('0x36')]));_0xcae1f9[_0x9be4('0x35')]=_0xcae1f9[_0x9be4('0x35')]['length']?_0xcae1f9['attributes']:_0x361d2f[_0x9be4('0x34')];if(!_0x292e37[_0x9be4('0x30')][_0x9be4('0x37')]('nolimit')){_0xcae1f9[_0x9be4('0x1b')]=qs[_0x9be4('0x1b')](_0x292e37[_0x9be4('0x30')][_0x9be4('0x1b')]);_0xcae1f9['offset']=qs['offset'](_0x292e37[_0x9be4('0x30')][_0x9be4('0x1a')]);}_0xcae1f9[_0x9be4('0x38')]=qs['sort'](_0x292e37[_0x9be4('0x30')]['sort']);_0xcae1f9['where']=qs[_0x9be4('0x32')](_['pick'](_0x292e37[_0x9be4('0x30')],_0x361d2f['filters']),_0x2e75eb);if(_0x292e37[_0x9be4('0x30')][_0x9be4('0x39')]){_0xcae1f9['where']=_[_0x9be4('0x3a')](_0xcae1f9[_0x9be4('0x3b')],{'$or':_[_0x9be4('0x3c')](_0x2e75eb,function(_0x5dfa55){if(_0x5dfa55[_0x9be4('0x2e')]!==_0x9be4('0x3d')){var _0xd0def9={};_0xd0def9[_0x5dfa55['name']]={'$like':'%'+_0x292e37['query'][_0x9be4('0x39')]+'%'};return _0xd0def9;}})});}_0xcae1f9=_[_0x9be4('0x3a')]({},_0xcae1f9,_0x292e37[_0x9be4('0x3e')]);var _0x41e197={'where':_0xcae1f9[_0x9be4('0x3b')]};return db['JscriptySessionReport'][_0x9be4('0x1d')](_0x41e197)[_0x9be4('0x24')](function(_0x212bc9){_0x496736['count']=_0x212bc9;if(_0x292e37[_0x9be4('0x30')][_0x9be4('0x3f')]){_0xcae1f9[_0x9be4('0x40')]=[{'all':!![]}];}return db[_0x9be4('0x2b')][_0x9be4('0x41')](_0xcae1f9);})[_0x9be4('0x24')](function(_0x20c7ec){_0x496736[_0x9be4('0x42')]=_0x20c7ec;return _0x496736;})[_0x9be4('0x24')](respondWithFilteredResult(_0x2e3ac0,_0xcae1f9))['catch'](handleError(_0x2e3ac0,null));};exports[_0x9be4('0x43')]=function(_0x3bffca,_0x4c6d8a){var _0x48f1c1={'raw':!![],'where':{'id':_0x3bffca[_0x9be4('0x44')]['id']}},_0x503738={};_0x503738[_0x9be4('0x34')]=_[_0x9be4('0x31')](db['JscriptySessionReport'][_0x9be4('0x2c')]);_0x503738[_0x9be4('0x30')]=_['keys'](_0x3bffca['query']);_0x503738[_0x9be4('0x32')]=_['intersection'](_0x503738[_0x9be4('0x34')],_0x503738[_0x9be4('0x30')]);_0x48f1c1[_0x9be4('0x35')]=_[_0x9be4('0x33')](_0x503738['model'],qs[_0x9be4('0x36')](_0x3bffca[_0x9be4('0x30')][_0x9be4('0x36')]));_0x48f1c1[_0x9be4('0x35')]=_0x48f1c1[_0x9be4('0x35')][_0x9be4('0x45')]?_0x48f1c1['attributes']:_0x503738[_0x9be4('0x34')];if(_0x3bffca[_0x9be4('0x30')][_0x9be4('0x3f')]){_0x48f1c1[_0x9be4('0x40')]=[{'all':!![]}];}_0x48f1c1=_[_0x9be4('0x3a')]({},_0x48f1c1,_0x3bffca['options']);return db[_0x9be4('0x2b')]['find'](_0x48f1c1)[_0x9be4('0x24')](handleEntityNotFound(_0x4c6d8a,null))[_0x9be4('0x24')](respondWithResult(_0x4c6d8a,null))['catch'](handleError(_0x4c6d8a,null));};exports[_0x9be4('0x46')]=function(_0x4778ef,_0x206499){return db[_0x9be4('0x2b')]['create'](_0x4778ef['body'],{})[_0x9be4('0x24')](respondWithResult(_0x206499,0xc9))[_0x9be4('0x47')](handleError(_0x206499,null));};exports[_0x9be4('0x23')]=function(_0x4c04cc,_0x30757e){if(_0x4c04cc[_0x9be4('0x48')]['id']){delete _0x4c04cc['body']['id'];}return db[_0x9be4('0x2b')][_0x9be4('0x49')]({'where':{'id':_0x4c04cc[_0x9be4('0x44')]['id']}})[_0x9be4('0x24')](handleEntityNotFound(_0x30757e,null))['then'](saveUpdates(_0x4c04cc[_0x9be4('0x48')],null))[_0x9be4('0x24')](respondWithResult(_0x30757e,null))[_0x9be4('0x47')](handleError(_0x30757e,null));};exports[_0x9be4('0x25')]=function(_0x1007d3,_0x4bafd6){return db[_0x9be4('0x2b')][_0x9be4('0x49')]({'where':{'id':_0x1007d3[_0x9be4('0x44')]['id']}})[_0x9be4('0x24')](handleEntityNotFound(_0x4bafd6,null))[_0x9be4('0x24')](removeEntity(_0x4bafd6,null))[_0x9be4('0x47')](handleError(_0x4bafd6,null));};exports[_0x9be4('0x4a')]=function(_0x587bd4,_0x1eb610){return db[_0x9be4('0x2b')]['describe']()[_0x9be4('0x24')](respondWithResult(_0x1eb610,null))[_0x9be4('0x47')](handleError(_0x1eb610,null));};exports[_0x9be4('0x4b')]=function(_0xfde631,_0x33fe2b,_0x5d93e4){var _0x59d47b={'raw':!![],'where':{}};var _0x5f4bb4={};var _0x15e870={'count':0x0,'rows':[]};return db[_0x9be4('0x2b')][_0x9be4('0x4c')]({'where':{'id':_0xfde631[_0x9be4('0x44')]['id']}})[_0x9be4('0x24')](handleEntityNotFound(_0x33fe2b,null))['then'](function(_0x21aa68){if(_0x21aa68){_0x5f4bb4[_0x9be4('0x34')]=_[_0x9be4('0x31')](db[_0x9be4('0x4d')][_0x9be4('0x2c')]);_0x5f4bb4[_0x9be4('0x30')]=_[_0x9be4('0x31')](_0xfde631[_0x9be4('0x30')]);_0x5f4bb4[_0x9be4('0x32')]=_['intersection'](_0x5f4bb4[_0x9be4('0x34')],_0x5f4bb4[_0x9be4('0x30')]);_0x59d47b[_0x9be4('0x35')]=_['intersection'](_0x5f4bb4[_0x9be4('0x34')],qs[_0x9be4('0x36')](_0xfde631[_0x9be4('0x30')][_0x9be4('0x36')]));_0x59d47b[_0x9be4('0x35')]=_0x59d47b['attributes'][_0x9be4('0x45')]?_0x59d47b[_0x9be4('0x35')]:_0x5f4bb4[_0x9be4('0x34')];if(!_0xfde631[_0x9be4('0x30')]['hasOwnProperty'](_0x9be4('0x4e'))){_0x59d47b[_0x9be4('0x1b')]=qs[_0x9be4('0x1b')](_0xfde631[_0x9be4('0x30')][_0x9be4('0x1b')]);_0x59d47b[_0x9be4('0x1a')]=qs[_0x9be4('0x1a')](_0xfde631[_0x9be4('0x30')]['offset']);}_0x59d47b[_0x9be4('0x38')]=qs[_0x9be4('0x4f')](_0xfde631[_0x9be4('0x30')]['sort']);_0x59d47b[_0x9be4('0x3b')]=qs['filters'](_[_0x9be4('0x50')](_0xfde631[_0x9be4('0x30')],_0x5f4bb4[_0x9be4('0x32')]));_0x59d47b[_0x9be4('0x3b')][_0x9be4('0x51')]=_0x21aa68['id'];if(_0xfde631[_0x9be4('0x30')][_0x9be4('0x39')]){_0x59d47b['where']=_[_0x9be4('0x3a')](_0x59d47b[_0x9be4('0x3b')],{'$or':_[_0x9be4('0x3c')](_0x59d47b['attributes'],function(_0x2e7d89){var _0x268d34={};_0x268d34[_0x2e7d89]={'$like':'%'+_0xfde631[_0x9be4('0x30')][_0x9be4('0x39')]+'%'};return _0x268d34;})});}_0x59d47b=_[_0x9be4('0x3a')]({},_0x59d47b,_0xfde631['options']);return db['JscriptyQuestionReport'][_0x9be4('0x1d')]({'where':_0x59d47b[_0x9be4('0x3b')]})['then'](function(_0x296dc3){_0x15e870[_0x9be4('0x1d')]=_0x296dc3;if(_0xfde631[_0x9be4('0x30')][_0x9be4('0x3f')]){_0x59d47b['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x59d47b);})['then'](function(_0x5c4ab3){_0x15e870[_0x9be4('0x42')]=_0x5c4ab3;return _0x15e870;});}})[_0x9be4('0x24')](respondWithFilteredResult(_0x33fe2b,_0x59d47b))[_0x9be4('0x47')](handleError(_0x33fe2b,null));}; \ No newline at end of file +var _0xcc23=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','VIRTUAL','options','JscriptySessionReport','includeAll','rows','show','params','length','include','merge','catch','create','body','find','describe','getQuestions','findOne','pick','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs'];(function(_0xc3887d,_0x2e4625){var _0x56cc94=function(_0x2bc252){while(--_0x2bc252){_0xc3887d['push'](_0xc3887d['shift']());}};_0x56cc94(++_0x2e4625);}(_0xcc23,0x94));var _0x3cc2=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcc23[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x3cc2('0x0'));var rimraf=require(_0x3cc2('0x1'));var zipdir=require(_0x3cc2('0x2'));var jsonpatch=require(_0x3cc2('0x3'));var rp=require(_0x3cc2('0x4'));var moment=require(_0x3cc2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3cc2('0x6'));var sox=require(_0x3cc2('0x7'));var csv=require(_0x3cc2('0x8'));var ejs=require(_0x3cc2('0x9'));var fs=require('fs');var fs_extra=require(_0x3cc2('0xa'));var _=require(_0x3cc2('0xb'));var squel=require(_0x3cc2('0xc'));var crypto=require(_0x3cc2('0xd'));var jsforce=require(_0x3cc2('0xe'));var deskjs=require(_0x3cc2('0xf'));var toCsv=require(_0x3cc2('0x8'));var querystring=require('querystring');var Papa=require(_0x3cc2('0x10'));var Redis=require(_0x3cc2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3cc2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cc2('0x13'))(_0x3cc2('0x14'));var utils=require(_0x3cc2('0x15'));var config=require(_0x3cc2('0x16'));var licenseUtil=require(_0x3cc2('0x17'));var db=require(_0x3cc2('0x18'))['db'];function respondWithStatusCode(_0x4dab21,_0x4f45d0){_0x4f45d0=_0x4f45d0||0xcc;return function(_0x706cb7){if(_0x706cb7){return _0x4dab21[_0x3cc2('0x19')](_0x4f45d0);}return _0x4dab21[_0x3cc2('0x1a')](_0x4f45d0)[_0x3cc2('0x1b')]();};}function respondWithResult(_0x52a262,_0x57db15){_0x57db15=_0x57db15||0xc8;return function(_0x4f974){if(_0x4f974){return _0x52a262['status'](_0x57db15)[_0x3cc2('0x1c')](_0x4f974);}};}function respondWithFilteredResult(_0xcd7652,_0x5857e6){return function(_0x1e1a70){if(_0x1e1a70){var _0x37945f=typeof _0x5857e6[_0x3cc2('0x1d')]===_0x3cc2('0x1e')&&typeof _0x5857e6[_0x3cc2('0x1f')]===_0x3cc2('0x1e');var _0x6bcaf=_0x1e1a70[_0x3cc2('0x20')];var _0x911d81=_0x37945f?0x0:_0x5857e6[_0x3cc2('0x1d')];var _0x17e4d8=_0x37945f?_0x1e1a70['count']:_0x5857e6['offset']+_0x5857e6[_0x3cc2('0x1f')];var _0x2a94b4;if(_0x17e4d8>=_0x6bcaf){_0x17e4d8=_0x6bcaf;_0x2a94b4=0xc8;}else{_0x2a94b4=0xce;}_0xcd7652[_0x3cc2('0x1a')](_0x2a94b4);return _0xcd7652['set'](_0x3cc2('0x21'),_0x911d81+'-'+_0x17e4d8+'/'+_0x6bcaf)[_0x3cc2('0x1c')](_0x1e1a70);}return null;};}function patchUpdates(_0xe4e93){return function(_0x54ace7){try{jsonpatch['apply'](_0x54ace7,_0xe4e93,!![]);}catch(_0x22e255){return BPromise[_0x3cc2('0x22')](_0x22e255);}return _0x54ace7['save']();};}function saveUpdates(_0x14785f,_0xdfcd46){return function(_0x462daf){if(_0x462daf){return _0x462daf[_0x3cc2('0x23')](_0x14785f)[_0x3cc2('0x24')](function(_0x139c1d){return _0x139c1d;});}return null;};}function removeEntity(_0x153e21,_0x29676d){return function(_0xa367f5){if(_0xa367f5){return _0xa367f5[_0x3cc2('0x25')]()[_0x3cc2('0x24')](function(){_0x153e21[_0x3cc2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430e2c,_0x2cc04a){return function(_0x41e52b){if(!_0x41e52b){_0x430e2c['sendStatus'](0x194);}return _0x41e52b;};}function handleError(_0x5a40a8,_0x44f6fa){_0x44f6fa=_0x44f6fa||0x1f4;return function(_0x2bca6a){logger[_0x3cc2('0x26')](_0x2bca6a[_0x3cc2('0x27')]);if(_0x2bca6a[_0x3cc2('0x28')]){delete _0x2bca6a[_0x3cc2('0x28')];}_0x5a40a8[_0x3cc2('0x1a')](_0x44f6fa)[_0x3cc2('0x29')](_0x2bca6a);};}exports['index']=function(_0xa7fd53,_0x26a083){var _0x377ca7={},_0x4f54fd={},_0x366289={'count':0x0,'rows':[]};var _0x5df6d7=_[_0x3cc2('0x2a')](db['JscriptySessionReport'][_0x3cc2('0x2b')],function(_0x32638c){return{'name':_0x32638c[_0x3cc2('0x2c')],'type':_0x32638c[_0x3cc2('0x2d')][_0x3cc2('0x2e')]};});_0x4f54fd[_0x3cc2('0x2f')]=_[_0x3cc2('0x2a')](_0x5df6d7,'name');_0x4f54fd[_0x3cc2('0x30')]=_[_0x3cc2('0x31')](_0xa7fd53[_0x3cc2('0x30')]);_0x4f54fd[_0x3cc2('0x32')]=_[_0x3cc2('0x33')](_0x4f54fd[_0x3cc2('0x2f')],_0x4f54fd[_0x3cc2('0x30')]);_0x377ca7['attributes']=_[_0x3cc2('0x33')](_0x4f54fd[_0x3cc2('0x2f')],qs[_0x3cc2('0x34')](_0xa7fd53['query']['fields']));_0x377ca7['attributes']=_0x377ca7['attributes']['length']?_0x377ca7[_0x3cc2('0x35')]:_0x4f54fd[_0x3cc2('0x2f')];if(!_0xa7fd53['query']['hasOwnProperty'](_0x3cc2('0x36'))){_0x377ca7[_0x3cc2('0x1f')]=qs[_0x3cc2('0x1f')](_0xa7fd53['query'][_0x3cc2('0x1f')]);_0x377ca7[_0x3cc2('0x1d')]=qs['offset'](_0xa7fd53['query'][_0x3cc2('0x1d')]);}_0x377ca7[_0x3cc2('0x37')]=qs[_0x3cc2('0x38')](_0xa7fd53['query'][_0x3cc2('0x38')]);_0x377ca7[_0x3cc2('0x39')]=qs['filters'](_['pick'](_0xa7fd53[_0x3cc2('0x30')],_0x4f54fd[_0x3cc2('0x32')]),_0x5df6d7);if(_0xa7fd53[_0x3cc2('0x30')][_0x3cc2('0x3a')]){_0x377ca7['where']=_['merge'](_0x377ca7[_0x3cc2('0x39')],{'$or':_['map'](_0x5df6d7,function(_0x5cfe95){if(_0x5cfe95[_0x3cc2('0x2d')]!==_0x3cc2('0x3b')){var _0x1329f6={};_0x1329f6[_0x5cfe95[_0x3cc2('0x28')]]={'$like':'%'+_0xa7fd53[_0x3cc2('0x30')][_0x3cc2('0x3a')]+'%'};return _0x1329f6;}})});}_0x377ca7=_['merge']({},_0x377ca7,_0xa7fd53[_0x3cc2('0x3c')]);var _0xfc18bf={'where':_0x377ca7['where']};return db[_0x3cc2('0x3d')][_0x3cc2('0x20')](_0xfc18bf)['then'](function(_0x3a4a96){_0x366289['count']=_0x3a4a96;if(_0xa7fd53[_0x3cc2('0x30')][_0x3cc2('0x3e')]){_0x377ca7['include']=[{'all':!![]}];}return db[_0x3cc2('0x3d')]['findAll'](_0x377ca7);})[_0x3cc2('0x24')](function(_0x1fab44){_0x366289[_0x3cc2('0x3f')]=_0x1fab44;return _0x366289;})[_0x3cc2('0x24')](respondWithFilteredResult(_0x26a083,_0x377ca7))['catch'](handleError(_0x26a083,null));};exports[_0x3cc2('0x40')]=function(_0x366f95,_0x20f0e8){var _0x287ff0={'raw':!![],'where':{'id':_0x366f95[_0x3cc2('0x41')]['id']}},_0xccf982={};_0xccf982['model']=_[_0x3cc2('0x31')](db['JscriptySessionReport'][_0x3cc2('0x2b')]);_0xccf982[_0x3cc2('0x30')]=_[_0x3cc2('0x31')](_0x366f95['query']);_0xccf982[_0x3cc2('0x32')]=_[_0x3cc2('0x33')](_0xccf982[_0x3cc2('0x2f')],_0xccf982[_0x3cc2('0x30')]);_0x287ff0['attributes']=_[_0x3cc2('0x33')](_0xccf982[_0x3cc2('0x2f')],qs[_0x3cc2('0x34')](_0x366f95['query']['fields']));_0x287ff0[_0x3cc2('0x35')]=_0x287ff0[_0x3cc2('0x35')][_0x3cc2('0x42')]?_0x287ff0[_0x3cc2('0x35')]:_0xccf982[_0x3cc2('0x2f')];if(_0x366f95[_0x3cc2('0x30')][_0x3cc2('0x3e')]){_0x287ff0[_0x3cc2('0x43')]=[{'all':!![]}];}_0x287ff0=_[_0x3cc2('0x44')]({},_0x287ff0,_0x366f95[_0x3cc2('0x3c')]);return db['JscriptySessionReport']['find'](_0x287ff0)[_0x3cc2('0x24')](handleEntityNotFound(_0x20f0e8,null))[_0x3cc2('0x24')](respondWithResult(_0x20f0e8,null))[_0x3cc2('0x45')](handleError(_0x20f0e8,null));};exports[_0x3cc2('0x46')]=function(_0x31a105,_0x13512d){return db[_0x3cc2('0x3d')][_0x3cc2('0x46')](_0x31a105[_0x3cc2('0x47')],{})['then'](respondWithResult(_0x13512d,0xc9))[_0x3cc2('0x45')](handleError(_0x13512d,null));};exports['update']=function(_0x4b77e4,_0x1989dc){if(_0x4b77e4['body']['id']){delete _0x4b77e4[_0x3cc2('0x47')]['id'];}return db[_0x3cc2('0x3d')]['find']({'where':{'id':_0x4b77e4['params']['id']}})[_0x3cc2('0x24')](handleEntityNotFound(_0x1989dc,null))[_0x3cc2('0x24')](saveUpdates(_0x4b77e4['body'],null))[_0x3cc2('0x24')](respondWithResult(_0x1989dc,null))['catch'](handleError(_0x1989dc,null));};exports[_0x3cc2('0x25')]=function(_0x2478ab,_0x26dd95){return db[_0x3cc2('0x3d')][_0x3cc2('0x48')]({'where':{'id':_0x2478ab[_0x3cc2('0x41')]['id']}})[_0x3cc2('0x24')](handleEntityNotFound(_0x26dd95,null))['then'](removeEntity(_0x26dd95,null))[_0x3cc2('0x45')](handleError(_0x26dd95,null));};exports[_0x3cc2('0x49')]=function(_0x2c94bc,_0x3c2224){return db['JscriptySessionReport'][_0x3cc2('0x49')]()['then'](respondWithResult(_0x3c2224,null))[_0x3cc2('0x45')](handleError(_0x3c2224,null));};exports[_0x3cc2('0x4a')]=function(_0x56e872,_0x3038f0,_0x482dcb){var _0x2e0b34={'raw':!![],'where':{}};var _0x3fa52c={};var _0x18bc1d={'count':0x0,'rows':[]};return db[_0x3cc2('0x3d')][_0x3cc2('0x4b')]({'where':{'id':_0x56e872[_0x3cc2('0x41')]['id']}})[_0x3cc2('0x24')](handleEntityNotFound(_0x3038f0,null))['then'](function(_0x242b97){if(_0x242b97){_0x3fa52c[_0x3cc2('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0x3cc2('0x2b')]);_0x3fa52c[_0x3cc2('0x30')]=_['keys'](_0x56e872[_0x3cc2('0x30')]);_0x3fa52c['filters']=_['intersection'](_0x3fa52c[_0x3cc2('0x2f')],_0x3fa52c[_0x3cc2('0x30')]);_0x2e0b34[_0x3cc2('0x35')]=_[_0x3cc2('0x33')](_0x3fa52c[_0x3cc2('0x2f')],qs[_0x3cc2('0x34')](_0x56e872[_0x3cc2('0x30')]['fields']));_0x2e0b34[_0x3cc2('0x35')]=_0x2e0b34[_0x3cc2('0x35')][_0x3cc2('0x42')]?_0x2e0b34[_0x3cc2('0x35')]:_0x3fa52c[_0x3cc2('0x2f')];if(!_0x56e872[_0x3cc2('0x30')]['hasOwnProperty'](_0x3cc2('0x36'))){_0x2e0b34['limit']=qs[_0x3cc2('0x1f')](_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x1f')]);_0x2e0b34[_0x3cc2('0x1d')]=qs['offset'](_0x56e872['query'][_0x3cc2('0x1d')]);}_0x2e0b34[_0x3cc2('0x37')]=qs[_0x3cc2('0x38')](_0x56e872[_0x3cc2('0x30')]['sort']);_0x2e0b34[_0x3cc2('0x39')]=qs[_0x3cc2('0x32')](_[_0x3cc2('0x4c')](_0x56e872[_0x3cc2('0x30')],_0x3fa52c['filters']));_0x2e0b34[_0x3cc2('0x39')]['SessionId']=_0x242b97['id'];if(_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x3a')]){_0x2e0b34[_0x3cc2('0x39')]=_[_0x3cc2('0x44')](_0x2e0b34[_0x3cc2('0x39')],{'$or':_['map'](_0x2e0b34[_0x3cc2('0x35')],function(_0x71b7ff){var _0x4f8bd0={};_0x4f8bd0[_0x71b7ff]={'$like':'%'+_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x3a')]+'%'};return _0x4f8bd0;})});}_0x2e0b34=_['merge']({},_0x2e0b34,_0x56e872[_0x3cc2('0x3c')]);return db['JscriptyQuestionReport']['count']({'where':_0x2e0b34[_0x3cc2('0x39')]})['then'](function(_0x311c4b){_0x18bc1d[_0x3cc2('0x20')]=_0x311c4b;if(_0x56e872[_0x3cc2('0x30')][_0x3cc2('0x3e')]){_0x2e0b34['include']=[{'all':!![]}];}return db[_0x3cc2('0x4d')][_0x3cc2('0x4e')](_0x2e0b34);})['then'](function(_0x378158){_0x18bc1d[_0x3cc2('0x3f')]=_0x378158;return _0x18bc1d;});}})['then'](respondWithFilteredResult(_0x3038f0,_0x2e0b34))['catch'](handleError(_0x3038f0,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e991501..80125cb 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 _0xc949=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x4a7c1b,_0x1c8608){var _0x24efcb=function(_0x5aee2b){while(--_0x5aee2b){_0x4a7c1b['push'](_0x4a7c1b['shift']());}};_0x24efcb(++_0x1c8608);}(_0xc949,0x181));var _0x9c94=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc949[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var logger=require(_0x9c94('0x1'))(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var BPromise=require(_0x9c94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c94('0x5'));var rimraf=require(_0x9c94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c94('0x7'));module[_0x9c94('0x8')]=function(_0x46d560,_0x1357ac){return _0x46d560['define'](_0x9c94('0x9'),attributes,{'tableName':_0x9c94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x723e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x1f75e8,_0x7fa97f){var _0x120699=function(_0x4d817b){while(--_0x4d817b){_0x1f75e8['push'](_0x1f75e8['shift']());}};_0x120699(++_0x7fa97f);}(_0x723e,0x179));var _0xe723=function(_0x24df34,_0x50aa1a){_0x24df34=_0x24df34-0x0;var _0x3980e8=_0x723e[_0x24df34];return _0x3980e8;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'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 32dc083..d2fe15d 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 _0x47c5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x47c5,0x165));var _0x547c=function(_0x5e02e4,_0x253a7f){_0x5e02e4=_0x5e02e4-0x0;var _0x83e136=_0x47c5[_0x5e02e4];return _0x83e136;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});} \ No newline at end of file +var _0xf2e3=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x37d894,_0xb55bf9){var _0x58c2e6=function(_0x129166){while(--_0x129166){_0x37d894['push'](_0x37d894['shift']());}};_0x58c2e6(++_0xb55bf9);}(_0xf2e3,0x9b));var _0x3f2e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xf2e3[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c0864,_0xdf499f,_0x12c6e7){return new BPromise(function(_0x11067d,_0x3636f6){return client[_0x3f2e('0xc')](_0x3c0864,_0x12c6e7)[_0x3f2e('0xd')](function(_0x29a6cc){logger[_0x3f2e('0xe')](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));logger[_0x3f2e('0x11')](_0x3f2e('0x12'),_0xdf499f,_0x3f2e('0x10'),JSON[_0x3f2e('0x13')](_0x29a6cc));if(_0x29a6cc[_0x3f2e('0x14')]){if(_0x29a6cc[_0x3f2e('0x14')]['code']===0x1f4){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x3636f6(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x29a6cc['error'][_0x3f2e('0x15')]);return _0x11067d(_0x29a6cc[_0x3f2e('0x14')][_0x3f2e('0x15')]);}else{logger['info'](_0x3f2e('0xf'),_0xdf499f,_0x3f2e('0x10'));_0x11067d(_0x29a6cc[_0x3f2e('0x16')][_0x3f2e('0x15')]);}})[_0x3f2e('0x17')](function(_0x2fef73){logger[_0x3f2e('0x14')](_0x3f2e('0xf'),_0xdf499f,_0x2fef73);_0x3636f6(_0x2fef73);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cff4bb4..9879d65 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 _0xeb24=['index','put','/:id','update','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./license.controller','get'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xeb24,0xd8));var _0x4eb2=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xeb24[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x4eb2('0x0'));var util=require(_0x4eb2('0x1'));var path=require(_0x4eb2('0x2'));var timeout=require(_0x4eb2('0x3'));var express=require(_0x4eb2('0x4'));var router=express['Router']();var fs_extra=require(_0x4eb2('0x5'));var auth=require(_0x4eb2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4eb2('0x7'));router[_0x4eb2('0x8')]('/',controller[_0x4eb2('0x9')]);router[_0x4eb2('0xa')](_0x4eb2('0xb'),auth['isAuthenticated'](),controller[_0x4eb2('0xc')]);router['get']('/download_log_file',auth[_0x4eb2('0xd')](),controller['downloadLogFile']);module[_0x4eb2('0xe')]=router; \ No newline at end of file +var _0x849d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer'];(function(_0x10bf3f,_0x370961){var _0x1fb0b6=function(_0x17794c){while(--_0x17794c){_0x10bf3f['push'](_0x10bf3f['shift']());}};_0x1fb0b6(++_0x370961);}(_0x849d,0x11f));var _0xd849=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x849d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd849('0x0'));var util=require(_0xd849('0x1'));var path=require(_0xd849('0x2'));var timeout=require(_0xd849('0x3'));var express=require(_0xd849('0x4'));var router=express['Router']();var fs_extra=require(_0xd849('0x5'));var auth=require(_0xd849('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd849('0x7'));var controller=require('./license.controller');router[_0xd849('0x8')]('/',controller[_0xd849('0x9')]);router['put'](_0xd849('0xa'),auth['isAuthenticated'](),controller[_0xd849('0xb')]);router[_0xd849('0x8')](_0xd849('0xc'),auth[_0xd849('0xd')](),controller[_0xd849('0xe')]);module[_0xd849('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 4f9a0b5..fdfdfb4 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 _0x80b8=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x608124,_0xccbf43){var _0x2c5242=function(_0x47d879){while(--_0x47d879){_0x608124['push'](_0x608124['shift']());}};_0x2c5242(++_0xccbf43);}(_0x80b8,0x114));var _0x880b=function(_0x398ae4,_0x55718e){_0x398ae4=_0x398ae4-0x0;var _0x6220ba=_0x80b8[_0x398ae4];return _0x6220ba;};'use strict';var Sequelize=require(_0x880b('0x0'));module[_0x880b('0x1')]={'license':{'type':Sequelize[_0x880b('0x2')]},'data1':{'type':Sequelize[_0x880b('0x3')]},'data2':{'type':Sequelize[_0x880b('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x880b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb329=['exports','TEXT','sequelize'];(function(_0x17b736,_0x40ce0f){var _0x147c4c=function(_0x2970c9){while(--_0x2970c9){_0x17b736['push'](_0x17b736['shift']());}};_0x147c4c(++_0x40ce0f);}(_0xb329,0x98));var _0x9b32=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xb329[_0x28669c];return _0x4a3af6;};'use strict';var Sequelize=require(_0x9b32('0x0'));module[_0x9b32('0x1')]={'license':{'type':Sequelize[_0x9b32('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'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 67e1d98..1744db1 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 _0x45b3=['model','License','rawAttributes','query','keys','filters','intersection','fields','attributes','length','merge','getLicense','body','find','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack','name'];(function(_0x1f9862,_0x1047d7){var _0x5c41b0=function(_0x4790a3){while(--_0x4790a3){_0x1f9862['push'](_0x1f9862['shift']());}};_0x5c41b0(++_0x1047d7);}(_0x45b3,0x1f2));var _0x345b=function(_0x532972,_0x23f2da){_0x532972=_0x532972-0x0;var _0x308435=_0x45b3[_0x532972];return _0x308435;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x345b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x345b('0x1'));var rp=require(_0x345b('0x2'));var moment=require(_0x345b('0x3'));var BPromise=require(_0x345b('0x4'));var Mustache=require(_0x345b('0x5'));var util=require('util');var path=require(_0x345b('0x6'));var sox=require(_0x345b('0x7'));var csv=require(_0x345b('0x8'));var ejs=require(_0x345b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x345b('0xa'));var squel=require(_0x345b('0xb'));var crypto=require('crypto');var jsforce=require(_0x345b('0xc'));var deskjs=require(_0x345b('0xd'));var toCsv=require(_0x345b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x345b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x345b('0xf'));var as=require(_0x345b('0x10'));var hardwareService=require(_0x345b('0x11'));var logger=require(_0x345b('0x12'))('api');var utils=require(_0x345b('0x13'));var config=require(_0x345b('0x14'));var licenseUtil=require(_0x345b('0x15'));var db=require(_0x345b('0x16'))['db'];function respondWithStatusCode(_0x53270c,_0x161868){_0x161868=_0x161868||0xcc;return function(_0x4001f6){if(_0x4001f6){return _0x53270c[_0x345b('0x17')](_0x161868);}return _0x53270c['status'](_0x161868)['end']();};}function respondWithResult(_0x5dfc57,_0x525e81){_0x525e81=_0x525e81||0xc8;return function(_0x3aed21){if(_0x3aed21){return _0x5dfc57[_0x345b('0x18')](_0x525e81)[_0x345b('0x19')](_0x3aed21);}};}function respondWithFilteredResult(_0x331c5c,_0x440765){return function(_0x1c0776){if(_0x1c0776){var _0x19c45d=typeof _0x440765['offset']===_0x345b('0x1a')&&typeof _0x440765[_0x345b('0x1b')]===_0x345b('0x1a');var _0x1c4c12=_0x1c0776[_0x345b('0x1c')];var _0x2c457d=_0x19c45d?0x0:_0x440765[_0x345b('0x1d')];var _0x89c017=_0x19c45d?_0x1c0776[_0x345b('0x1c')]:_0x440765[_0x345b('0x1d')]+_0x440765[_0x345b('0x1b')];var _0x2eb698;if(_0x89c017>=_0x1c4c12){_0x89c017=_0x1c4c12;_0x2eb698=0xc8;}else{_0x2eb698=0xce;}_0x331c5c['status'](_0x2eb698);return _0x331c5c[_0x345b('0x1e')](_0x345b('0x1f'),_0x2c457d+'-'+_0x89c017+'/'+_0x1c4c12)[_0x345b('0x19')](_0x1c0776);}return null;};}function patchUpdates(_0x212f9a){return function(_0x1e0feb){try{jsonpatch['apply'](_0x1e0feb,_0x212f9a,!![]);}catch(_0x29e6a9){return BPromise[_0x345b('0x20')](_0x29e6a9);}return _0x1e0feb[_0x345b('0x21')]();};}function saveUpdates(_0xdc2f3f,_0x5df346){return function(_0x3e7d21){if(_0x3e7d21){return _0x3e7d21[_0x345b('0x22')](_0xdc2f3f)['then'](function(_0x35f1f3){return _0x35f1f3;});}return null;};}function removeEntity(_0x37584f,_0x2c8788){return function(_0x3d60bc){if(_0x3d60bc){return _0x3d60bc['destroy']()[_0x345b('0x23')](function(){_0x37584f[_0x345b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1026f7,_0x4843ed){return function(_0x3fc408){if(!_0x3fc408){_0x1026f7[_0x345b('0x17')](0x194);}return _0x3fc408;};}function handleError(_0x554735,_0x39b378){_0x39b378=_0x39b378||0x1f4;return function(_0x3329df){logger['error'](_0x3329df[_0x345b('0x24')]);if(_0x3329df[_0x345b('0x25')]){delete _0x3329df[_0x345b('0x25')];}_0x554735[_0x345b('0x18')](_0x39b378)['send'](_0x3329df);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x2ff1c5,_0x58a5ea){var _0x5277d4={'raw':!![],'where':{'id':0x1}},_0x4bc1a0={};_0x4bc1a0[_0x345b('0x26')]=_['keys'](db[_0x345b('0x27')][_0x345b('0x28')]);_0x4bc1a0[_0x345b('0x29')]=_[_0x345b('0x2a')](_0x2ff1c5['query']);_0x4bc1a0[_0x345b('0x2b')]=_['intersection'](_0x4bc1a0['model'],_0x4bc1a0['query']);_0x5277d4['attributes']=_[_0x345b('0x2c')](_0x4bc1a0[_0x345b('0x26')],qs[_0x345b('0x2d')](_0x2ff1c5[_0x345b('0x29')][_0x345b('0x2d')]));_0x5277d4[_0x345b('0x2e')]=_0x5277d4[_0x345b('0x2e')][_0x345b('0x2f')]?_0x5277d4[_0x345b('0x2e')]:_0x4bc1a0[_0x345b('0x26')];_0x5277d4=_[_0x345b('0x30')]({},_0x5277d4,_0x2ff1c5['options']);return utilLicense[_0x345b('0x31')](_0x5277d4)[_0x345b('0x23')](respondWithResult(_0x58a5ea,null))['catch'](handleError(_0x58a5ea,null));};exports['update']=function(_0x14664a,_0x13e238){if(_0x14664a[_0x345b('0x32')]['id']){delete _0x14664a[_0x345b('0x32')]['id'];}return db['License'][_0x345b('0x33')]({'where':{'id':_0x14664a['params']['id']}})[_0x345b('0x23')](handleEntityNotFound(_0x13e238,null))[_0x345b('0x23')](function(_0x4ce83e){var _0x49784c=_0x4ce83e[_0x345b('0x34')]({'plain':!![]});return utilLicense[_0x345b('0x35')](_0x49784c,_0x14664a[_0x345b('0x32')][_0x345b('0x36')]);})[_0x345b('0x23')](function(_0x3eb7ca){if(!_0x3eb7ca[_0x345b('0x37')]){return saveUpdates(_0x14664a['body'],null);}return _0x3eb7ca;})[_0x345b('0x23')](respondWithResult(_0x13e238,null))[_0x345b('0x38')](handleError(_0x13e238,null));};exports[_0x345b('0x39')]=function(_0x1d8796,_0x300df9){var _0x28e7a9=_0x345b('0x3a');var _0x3af32f=path[_0x345b('0x3b')]('/var',_0x345b('0x3c'),_0x345b('0x3d'),_0x28e7a9);_0x300df9[_0x345b('0x3e')](_0x345b('0x3f'),_0x345b('0x40')+_0x28e7a9);_0x300df9[_0x345b('0x1e')]('Content-Type',_0x345b('0x41'));_0x300df9[_0x345b('0x42')](_0x3af32f);}; \ No newline at end of file +var _0xe103=['query','filters','intersection','attributes','fields','length','options','getLicense','update','body','find','get','key','demo','catch','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes'];(function(_0x3e1226,_0x4199d6){var _0x1ff634=function(_0x4dbed0){while(--_0x4dbed0){_0x3e1226['push'](_0x3e1226['shift']());}};_0x1ff634(++_0x4199d6);}(_0xe103,0x191));var _0x3e10=function(_0x1d75bd,_0x17c831){_0x1d75bd=_0x1d75bd-0x0;var _0x16028f=_0xe103[_0x1d75bd];return _0x16028f;};'use strict';var emlformat=require(_0x3e10('0x0'));var rimraf=require(_0x3e10('0x1'));var zipdir=require(_0x3e10('0x2'));var jsonpatch=require(_0x3e10('0x3'));var rp=require(_0x3e10('0x4'));var moment=require(_0x3e10('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3e10('0x6'));var util=require('util');var path=require(_0x3e10('0x7'));var sox=require('sox');var csv=require(_0x3e10('0x8'));var ejs=require(_0x3e10('0x9'));var fs=require('fs');var fs_extra=require(_0x3e10('0xa'));var _=require('lodash');var squel=require(_0x3e10('0xb'));var crypto=require(_0x3e10('0xc'));var jsforce=require(_0x3e10('0xd'));var deskjs=require(_0x3e10('0xe'));var toCsv=require(_0x3e10('0x8'));var querystring=require('querystring');var Papa=require(_0x3e10('0xf'));var Redis=require(_0x3e10('0x10'));var authService=require(_0x3e10('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3e10('0x12'));var hardwareService=require(_0x3e10('0x13'));var logger=require(_0x3e10('0x14'))(_0x3e10('0x15'));var utils=require('../../config/utils');var config=require(_0x3e10('0x16'));var licenseUtil=require(_0x3e10('0x17'));var db=require(_0x3e10('0x18'))['db'];function respondWithStatusCode(_0x21f573,_0x5171d9){_0x5171d9=_0x5171d9||0xcc;return function(_0x2e68c0){if(_0x2e68c0){return _0x21f573[_0x3e10('0x19')](_0x5171d9);}return _0x21f573[_0x3e10('0x1a')](_0x5171d9)[_0x3e10('0x1b')]();};}function respondWithResult(_0x33af43,_0x1e856a){_0x1e856a=_0x1e856a||0xc8;return function(_0x11bc34){if(_0x11bc34){return _0x33af43['status'](_0x1e856a)['json'](_0x11bc34);}};}function respondWithFilteredResult(_0x3e1cef,_0x268e9b){return function(_0x3db73c){if(_0x3db73c){var _0x32bdd6=typeof _0x268e9b[_0x3e10('0x1c')]==='undefined'&&typeof _0x268e9b[_0x3e10('0x1d')]===_0x3e10('0x1e');var _0x1fe6b8=_0x3db73c['count'];var _0x14a9a0=_0x32bdd6?0x0:_0x268e9b['offset'];var _0x5bc07a=_0x32bdd6?_0x3db73c[_0x3e10('0x1f')]:_0x268e9b[_0x3e10('0x1c')]+_0x268e9b[_0x3e10('0x1d')];var _0x563217;if(_0x5bc07a>=_0x1fe6b8){_0x5bc07a=_0x1fe6b8;_0x563217=0xc8;}else{_0x563217=0xce;}_0x3e1cef[_0x3e10('0x1a')](_0x563217);return _0x3e1cef[_0x3e10('0x20')](_0x3e10('0x21'),_0x14a9a0+'-'+_0x5bc07a+'/'+_0x1fe6b8)[_0x3e10('0x22')](_0x3db73c);}return null;};}function patchUpdates(_0x113657){return function(_0x5db31e){try{jsonpatch[_0x3e10('0x23')](_0x5db31e,_0x113657,!![]);}catch(_0x57e88d){return BPromise[_0x3e10('0x24')](_0x57e88d);}return _0x5db31e[_0x3e10('0x25')]();};}function saveUpdates(_0x324185,_0x3716ff){return function(_0x269c95){if(_0x269c95){return _0x269c95['update'](_0x324185)[_0x3e10('0x26')](function(_0x5ca1a4){return _0x5ca1a4;});}return null;};}function removeEntity(_0x5202d4,_0x1179cd){return function(_0x2667dc){if(_0x2667dc){return _0x2667dc[_0x3e10('0x27')]()['then'](function(){_0x5202d4['status'](0xcc)[_0x3e10('0x1b')]();});}};}function handleEntityNotFound(_0x1519c0,_0x28d9a3){return function(_0x27d5e2){if(!_0x27d5e2){_0x1519c0['sendStatus'](0x194);}return _0x27d5e2;};}function handleError(_0x8e0bb3,_0x54cd14){_0x54cd14=_0x54cd14||0x1f4;return function(_0x51cb3d){logger[_0x3e10('0x28')](_0x51cb3d[_0x3e10('0x29')]);if(_0x51cb3d['name']){delete _0x51cb3d[_0x3e10('0x2a')];}_0x8e0bb3[_0x3e10('0x1a')](_0x54cd14)[_0x3e10('0x2b')](_0x51cb3d);};}var utilLicense=require('../../config/license/util');exports[_0x3e10('0x2c')]=function(_0x463f32,_0x4f4ae2){var _0x53652f={'raw':!![],'where':{'id':0x1}},_0x47556b={};_0x47556b[_0x3e10('0x2d')]=_[_0x3e10('0x2e')](db[_0x3e10('0x2f')][_0x3e10('0x30')]);_0x47556b[_0x3e10('0x31')]=_[_0x3e10('0x2e')](_0x463f32['query']);_0x47556b[_0x3e10('0x32')]=_[_0x3e10('0x33')](_0x47556b[_0x3e10('0x2d')],_0x47556b[_0x3e10('0x31')]);_0x53652f[_0x3e10('0x34')]=_[_0x3e10('0x33')](_0x47556b[_0x3e10('0x2d')],qs[_0x3e10('0x35')](_0x463f32[_0x3e10('0x31')][_0x3e10('0x35')]));_0x53652f[_0x3e10('0x34')]=_0x53652f[_0x3e10('0x34')][_0x3e10('0x36')]?_0x53652f['attributes']:_0x47556b['model'];_0x53652f=_['merge']({},_0x53652f,_0x463f32[_0x3e10('0x37')]);return utilLicense[_0x3e10('0x38')](_0x53652f)[_0x3e10('0x26')](respondWithResult(_0x4f4ae2,null))['catch'](handleError(_0x4f4ae2,null));};exports[_0x3e10('0x39')]=function(_0x502cd1,_0x5d0b7b){if(_0x502cd1[_0x3e10('0x3a')]['id']){delete _0x502cd1[_0x3e10('0x3a')]['id'];}return db[_0x3e10('0x2f')][_0x3e10('0x3b')]({'where':{'id':_0x502cd1['params']['id']}})[_0x3e10('0x26')](handleEntityNotFound(_0x5d0b7b,null))['then'](function(_0x280b7b){var _0x4e6075=_0x280b7b[_0x3e10('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x4e6075,_0x502cd1[_0x3e10('0x3a')][_0x3e10('0x3d')]);})[_0x3e10('0x26')](function(_0x49257e){if(!_0x49257e[_0x3e10('0x3e')]){return saveUpdates(_0x502cd1[_0x3e10('0x3a')],null);}return _0x49257e;})[_0x3e10('0x26')](respondWithResult(_0x5d0b7b,null))[_0x3e10('0x3f')](handleError(_0x5d0b7b,null));};exports[_0x3e10('0x40')]=function(_0xa75a9d,_0x1919fa){var _0x21a25e=_0x3e10('0x41');var _0x54915b=path[_0x3e10('0x42')](_0x3e10('0x43'),_0x3e10('0x44'),_0x3e10('0x45'),_0x21a25e);_0x1919fa['setHeader'](_0x3e10('0x46'),_0x3e10('0x47')+_0x21a25e);_0x1919fa['set'](_0x3e10('0x48'),_0x3e10('0x49'));_0x1919fa[_0x3e10('0x4a')](_0x54915b);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6e2e054..ed28a41 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 _0x17df=['api','moment','request-promise','path','rimraf','../../config/environment','license','lodash','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x17df,0x7c));var _0xf17d=function(_0x10b5c6,_0x5156e4){_0x10b5c6=_0x10b5c6-0x0;var _0x1ac71e=_0x17df[_0x10b5c6];return _0x1ac71e;};'use strict';var _=require(_0xf17d('0x0'));var util=require(_0xf17d('0x1'));var logger=require('../../config/logger')(_0xf17d('0x2'));var moment=require(_0xf17d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf17d('0x4'));var fs=require('fs');var path=require(_0xf17d('0x5'));var rimraf=require(_0xf17d('0x6'));var config=require(_0xf17d('0x7'));var attributes=require('./license.attributes');module['exports']=function(_0x5a8249,_0x20dcb3){return _0x5a8249['define']('License',attributes,{'tableName':_0xf17d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cfe=['request-promise','rimraf','./license.attributes','exports','License','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1bc40c,_0x520d21){var _0x4e33b9=function(_0xaf99a5){while(--_0xaf99a5){_0x1bc40c['push'](_0x1bc40c['shift']());}};_0x4e33b9(++_0x520d21);}(_0x8cfe,0x16e));var _0xe8cf=function(_0x37b6e4,_0x1ee0f2){_0x37b6e4=_0x37b6e4-0x0;var _0x54f442=_0x8cfe[_0x37b6e4];return _0x54f442;};'use strict';var _=require(_0xe8cf('0x0'));var util=require(_0xe8cf('0x1'));var logger=require(_0xe8cf('0x2'))(_0xe8cf('0x3'));var moment=require(_0xe8cf('0x4'));var BPromise=require(_0xe8cf('0x5'));var rp=require(_0xe8cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xe8cf('0x8'));module[_0xe8cf('0x9')]=function(_0x2873cc,_0x495074){return _0x2873cc['define'](_0xe8cf('0xa'),attributes,{'tableName':_0xe8cf('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 1dd1d91..2ad1964 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 _0x5363=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util'];(function(_0x48a3d0,_0x2d1d05){var _0x552a27=function(_0x2e07fe){while(--_0x2e07fe){_0x48a3d0['push'](_0x48a3d0['shift']());}};_0x552a27(++_0x2d1d05);}(_0x5363,0xda));var _0x3536=function(_0x155ce1,_0x51fc97){_0x155ce1=_0x155ce1-0x0;var _0x279a74=_0x5363[_0x155ce1];return _0x279a74;};'use strict';var _=require(_0x3536('0x0'));var util=require(_0x3536('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3536('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3536('0x3'))['db'];var utils=require(_0x3536('0x4'));var logger=require('../../config/logger')(_0x3536('0x5'));var config=require('../../config/environment');var jayson=require(_0x3536('0x6'));var client=jayson[_0x3536('0x7')][_0x3536('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x311537,_0x36846b,_0xb86fce){return new BPromise(function(_0x332188,_0x491e7d){return client[_0x3536('0x9')](_0x311537,_0xb86fce)[_0x3536('0xa')](function(_0x2398b0){logger[_0x3536('0xb')](_0x3536('0xc'),_0x36846b,'request\x20sent');logger[_0x3536('0xd')](_0x3536('0xe'),_0x36846b,'request\x20sent',JSON[_0x3536('0xf')](_0x2398b0));if(_0x2398b0[_0x3536('0x10')]){if(_0x2398b0[_0x3536('0x10')][_0x3536('0x11')]===0x1f4){logger['error'](_0x3536('0xc'),_0x36846b,_0x2398b0['error']['message']);return _0x491e7d(_0x2398b0['error'][_0x3536('0x12')]);}logger[_0x3536('0x10')](_0x3536('0xc'),_0x36846b,_0x2398b0['error']['message']);return _0x332188(_0x2398b0[_0x3536('0x10')]['message']);}else{logger[_0x3536('0xb')]('License,\x20%s,\x20%s',_0x36846b,_0x3536('0x13'));_0x332188(_0x2398b0[_0x3536('0x14')][_0x3536('0x12')]);}})[_0x3536('0x15')](function(_0x559a49){logger['error']('License,\x20%s,\x20%s',_0x36846b,_0x559a49);_0x491e7d(_0x559a49);});});} \ No newline at end of file +var _0xba3c=['http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','code','License,\x20%s,\x20%s','message','error','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x13573c,_0x585238){var _0x37bc6e=function(_0x3e5a4f){while(--_0x3e5a4f){_0x13573c['push'](_0x13573c['shift']());}};_0x37bc6e(++_0x585238);}(_0xba3c,0x175));var _0xcba3=function(_0x174301,_0xf474a){_0x174301=_0x174301-0x0;var _0xa39294=_0xba3c[_0x174301];return _0xa39294;};'use strict';var _=require(_0xcba3('0x0'));var util=require('util');var moment=require(_0xcba3('0x1'));var BPromise=require(_0xcba3('0x2'));var rs=require(_0xcba3('0x3'));var fs=require('fs');var Redis=require(_0xcba3('0x4'));var db=require(_0xcba3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcba3('0x6'))(_0xcba3('0x7'));var config=require(_0xcba3('0x8'));var jayson=require(_0xcba3('0x9'));var client=jayson[_0xcba3('0xa')][_0xcba3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a9ed5,_0x511fa5,_0x2c4503){return new BPromise(function(_0x7facf1,_0x3b4f66){return client[_0xcba3('0xc')](_0x5a9ed5,_0x2c4503)[_0xcba3('0xd')](function(_0x4c2f24){logger[_0xcba3('0xe')]('License,\x20%s,\x20%s',_0x511fa5,_0xcba3('0xf'));logger[_0xcba3('0x10')](_0xcba3('0x11'),_0x511fa5,_0xcba3('0xf'),JSON['stringify'](_0x4c2f24));if(_0x4c2f24['error']){if(_0x4c2f24['error'][_0xcba3('0x12')]===0x1f4){logger['error'](_0xcba3('0x13'),_0x511fa5,_0x4c2f24['error'][_0xcba3('0x14')]);return _0x3b4f66(_0x4c2f24[_0xcba3('0x15')][_0xcba3('0x14')]);}logger[_0xcba3('0x15')]('License,\x20%s,\x20%s',_0x511fa5,_0x4c2f24[_0xcba3('0x15')]['message']);return _0x7facf1(_0x4c2f24[_0xcba3('0x15')][_0xcba3('0x14')]);}else{logger[_0xcba3('0xe')]('License,\x20%s,\x20%s',_0x511fa5,'request\x20sent');_0x7facf1(_0x4c2f24[_0xcba3('0x16')][_0xcba3('0x14')]);}})[_0xcba3('0x17')](function(_0x8ad9d8){logger[_0xcba3('0x15')]('License,\x20%s,\x20%s',_0x511fa5,_0x8ad9d8);_0x3b4f66(_0x8ad9d8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index bbbff15..039ddd6 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 _0x823f=['addInteraction','/:id/applications','addApplications','/:id/send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','/:id/dispositions','addAnswer','create','addImap','addSmtp'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x823f,0xf4));var _0xf823=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x823f[_0x284807];return _0x50c774;};'use strict';var multer=require(_0xf823('0x0'));var util=require('util');var path=require(_0xf823('0x1'));var timeout=require(_0xf823('0x2'));var express=require(_0xf823('0x3'));var router=express[_0xf823('0x4')]();var fs_extra=require(_0xf823('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf823('0x6'));var controller=require('./mailAccount.controller');router[_0xf823('0x7')]('/',auth[_0xf823('0x8')](),controller[_0xf823('0x9')]);router[_0xf823('0x7')](_0xf823('0xa'),auth[_0xf823('0x8')](),controller['describe']);router[_0xf823('0x7')](_0xf823('0xb'),auth[_0xf823('0x8')](),controller[_0xf823('0xc')]);router[_0xf823('0x7')]('/:id/dispositions',auth[_0xf823('0x8')](),controller[_0xf823('0xd')]);router['get'](_0xf823('0xe'),auth[_0xf823('0x8')](),controller[_0xf823('0xf')]);router[_0xf823('0x7')](_0xf823('0x10'),auth[_0xf823('0x8')](),controller[_0xf823('0x11')]);router[_0xf823('0x7')](_0xf823('0x12'),auth[_0xf823('0x8')](),controller['getSmtp']);router[_0xf823('0x7')](_0xf823('0x13'),auth['isAuthenticated'](),controller[_0xf823('0x14')]);router['get']('/:id/applications',auth[_0xf823('0x8')](),controller[_0xf823('0x15')]);router['get'](_0xf823('0x16'),auth[_0xf823('0x8')](),controller[_0xf823('0x17')]);router['get'](_0xf823('0x18'),auth[_0xf823('0x8')](),controller[_0xf823('0x19')]);router[_0xf823('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xf823('0x1a')](_0xf823('0x1b'),auth[_0xf823('0x8')](),controller['addDisposition']);router[_0xf823('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf823('0x1c')]);router[_0xf823('0x1a')]('/',auth['isAuthenticated'](),controller[_0xf823('0x1d')]);router[_0xf823('0x1a')](_0xf823('0x10'),auth[_0xf823('0x8')](),controller[_0xf823('0x1e')]);router['post'](_0xf823('0x12'),auth[_0xf823('0x8')](),controller[_0xf823('0x1f')]);router['post'](_0xf823('0x13'),auth[_0xf823('0x8')](),controller[_0xf823('0x20')]);router[_0xf823('0x1a')](_0xf823('0x21'),auth[_0xf823('0x8')](),controller[_0xf823('0x22')]);router[_0xf823('0x1a')](_0xf823('0x23'),auth[_0xf823('0x8')](),controller['send']);router[_0xf823('0x1a')](_0xf823('0x24'),auth[_0xf823('0x8')](),controller[_0xf823('0x25')]);router[_0xf823('0x26')](_0xf823('0xb'),auth[_0xf823('0x8')](),controller[_0xf823('0x27')]);router[_0xf823('0x28')](_0xf823('0x1b'),auth[_0xf823('0x8')](),controller[_0xf823('0x29')]);router[_0xf823('0x28')](_0xf823('0xe'),auth[_0xf823('0x8')](),controller[_0xf823('0x2a')]);router[_0xf823('0x28')](_0xf823('0x10'),auth[_0xf823('0x8')](),controller[_0xf823('0x2b')]);router[_0xf823('0x28')](_0xf823('0x12'),auth[_0xf823('0x8')](),controller[_0xf823('0x2c')]);router[_0xf823('0x28')](_0xf823('0xb'),auth[_0xf823('0x8')](),controller['destroy']);router['delete'](_0xf823('0x24'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xf823('0x2d')]=router; \ No newline at end of file +var _0x6434=['/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeSmtp','destroy','removeAgents','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x113828,_0x377874){var _0x3a930a=function(_0x4fa6a5){while(--_0x4fa6a5){_0x113828['push'](_0x113828['shift']());}};_0x3a930a(++_0x377874);}(_0x6434,0xf0));var _0x4643=function(_0x331faf,_0x5d2471){_0x331faf=_0x331faf-0x0;var _0x1f65f0=_0x6434[_0x331faf];return _0x1f65f0;};'use strict';var multer=require(_0x4643('0x0'));var util=require(_0x4643('0x1'));var path=require('path');var timeout=require(_0x4643('0x2'));var express=require(_0x4643('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4643('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4643('0x5'));var controller=require(_0x4643('0x6'));router['get']('/',auth[_0x4643('0x7')](),controller[_0x4643('0x8')]);router[_0x4643('0x9')](_0x4643('0xa'),auth[_0x4643('0x7')](),controller[_0x4643('0xb')]);router['get'](_0x4643('0xc'),auth[_0x4643('0x7')](),controller[_0x4643('0xd')]);router[_0x4643('0x9')](_0x4643('0xe'),auth['isAuthenticated'](),controller[_0x4643('0xf')]);router[_0x4643('0x9')](_0x4643('0x10'),auth['isAuthenticated'](),controller[_0x4643('0x11')]);router[_0x4643('0x9')](_0x4643('0x12'),auth['isAuthenticated'](),controller[_0x4643('0x13')]);router[_0x4643('0x9')]('/:id/out_servers',auth[_0x4643('0x7')](),controller[_0x4643('0x14')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x4643('0x15')]);router[_0x4643('0x9')](_0x4643('0x16'),auth[_0x4643('0x7')](),controller[_0x4643('0x17')]);router[_0x4643('0x9')](_0x4643('0x18'),auth['isAuthenticated'](),controller[_0x4643('0x19')]);router[_0x4643('0x9')]('/:id/verify',auth[_0x4643('0x7')](),controller[_0x4643('0x1a')]);router['get'](_0x4643('0x1b'),auth[_0x4643('0x7')](),controller['getAgents']);router[_0x4643('0x1c')]('/:id/dispositions',auth[_0x4643('0x7')](),controller[_0x4643('0x1d')]);router[_0x4643('0x1c')](_0x4643('0x10'),auth[_0x4643('0x7')](),controller['addAnswer']);router[_0x4643('0x1c')]('/',auth[_0x4643('0x7')](),controller['create']);router[_0x4643('0x1c')](_0x4643('0x12'),auth[_0x4643('0x7')](),controller[_0x4643('0x1e')]);router['post']('/:id/out_servers',auth[_0x4643('0x7')](),controller[_0x4643('0x1f')]);router[_0x4643('0x1c')](_0x4643('0x20'),auth[_0x4643('0x7')](),controller[_0x4643('0x21')]);router['post'](_0x4643('0x16'),auth[_0x4643('0x7')](),controller[_0x4643('0x22')]);router[_0x4643('0x1c')]('/:id/send',auth[_0x4643('0x7')](),controller['send']);router[_0x4643('0x1c')]('/:id/users',auth[_0x4643('0x7')](),controller[_0x4643('0x23')]);router[_0x4643('0x24')](_0x4643('0xc'),auth[_0x4643('0x7')](),controller[_0x4643('0x25')]);router[_0x4643('0x26')](_0x4643('0xe'),auth[_0x4643('0x7')](),controller[_0x4643('0x27')]);router[_0x4643('0x26')]('/:id/canned_answers',auth[_0x4643('0x7')](),controller['removeAnswers']);router[_0x4643('0x26')](_0x4643('0x12'),auth['isAuthenticated'](),controller['removeImap']);router[_0x4643('0x26')]('/:id/out_servers',auth[_0x4643('0x7')](),controller[_0x4643('0x28')]);router[_0x4643('0x26')]('/:id',auth[_0x4643('0x7')](),controller[_0x4643('0x29')]);router[_0x4643('0x26')](_0x4643('0x1b'),auth['isAuthenticated'](),controller[_0x4643('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b343589..66f1e3c 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 _0xfa40=['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','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x258b39,_0x53097f){var _0x4bf0f8=function(_0x4ecea5){while(--_0x4ecea5){_0x258b39['push'](_0x258b39['shift']());}};_0x4bf0f8(++_0x53097f);}(_0xfa40,0x107));var _0x0fa4=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xfa40[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x0fa4('0x0'));module[_0x0fa4('0x1')]={'description':{'type':Sequelize[_0x0fa4('0x2')]},'name':{'type':Sequelize[_0x0fa4('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x0fa4('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0fa4('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0fa4('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x0fa4('0x4')]},'markAsUnread':{'type':Sequelize[_0x0fa4('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fa4('0x5')},'fontSize':{'type':Sequelize[_0x0fa4('0x6')](0x2)[_0x0fa4('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0fa4('0x4')],'defaultValue':function(){return _0x0fa4('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fa4('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0fa4('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fa4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fa4('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0fa4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0fa4('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc8a27f){if(!_0xc8a27f)this[_0x0fa4('0xa')](_0x0fa4('0xb'),null);this[_0x0fa4('0xa')]('mandatoryDisposition',_0xc8a27f);}},'provider':{'type':Sequelize[_0x0fa4('0xc')](_0x0fa4('0xd'),_0x0fa4('0xe'),_0x0fa4('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x0fa4('0x10')](_0x0fa4('0x11')))return'custom';return this[_0x0fa4('0x10')](_0x0fa4('0x11'));},'set':function(_0x4d3336){if(_0x4d3336==='custom')_0x4d3336=null;return this['setDataValue'](_0x0fa4('0x11'),_0x4d3336);}}}; \ No newline at end of file +var _0x2ff5=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','ENUM','gmail','hotmail','provider','getDataValue','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x50e6f2,_0x2eee84){var _0x35b544=function(_0xec6d84){while(--_0xec6d84){_0x50e6f2['push'](_0x50e6f2['shift']());}};_0x35b544(++_0x2eee84);}(_0x2ff5,0xed));var _0x52ff=function(_0x25f2d0,_0x3106c5){_0x25f2d0=_0x25f2d0-0x0;var _0x3b9544=_0x2ff5[_0x25f2d0];return _0x3b9544;};'use strict';var Sequelize=require(_0x52ff('0x0'));module[_0x52ff('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x52ff('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x52ff('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x52ff('0x4')]},'markAsUnread':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x52ff('0x2')],'allowNull':![],'defaultValue':_0x52ff('0x5')},'fontSize':{'type':Sequelize[_0x52ff('0x6')](0x2)[_0x52ff('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x52ff('0x4')],'defaultValue':function(){return _0x52ff('0x8');}},'notificationSound':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x52ff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x52ff('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x52ff('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x52ff('0x3')],'defaultValue':![],'comment':_0x52ff('0xa'),'set':function(_0x1f8710){if(!_0x1f8710)this['setDataValue'](_0x52ff('0xb'),null);this[_0x52ff('0xc')]('mandatoryDisposition',_0x1f8710);}},'provider':{'type':Sequelize[_0x52ff('0xd')](_0x52ff('0xe'),_0x52ff('0xf'),'yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x52ff('0x10')))return'custom';return this[_0x52ff('0x11')](_0x52ff('0x10'));},'set':function(_0x182eb8){if(_0x182eb8===_0x52ff('0x12'))_0x182eb8=null;return this[_0x52ff('0xc')]('provider',_0x182eb8);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 877fd7c..c94d2c8 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 _0x03f3=['MailServerIn','Pause','length','find','update','body','CloudProviderId','modernAuthentication','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','nolimit','pick','include','ids','addAnswer','CannedAnswer','create','getAnswers','order','removeAnswers','custom','email','description','provider','user','pass','password','host','port','authentication','username','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','addImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','color','tag','MailInteraction','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','CmContact','Contacts','isNil','from','format','attachments','join','root','basename','service','secure','auth','SendMail','sendMail','List\x20not\x20found','ListId','messageId','out','Interaction','verifySmtp','CloudProvider','OAuth2','data5','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','model','hasOwnProperty','sort','filters','where','merge','filter','options','MailAccount','includeAll','findAll','rows','show','params'];(function(_0x563069,_0xea9144){var _0x6456f8=function(_0x3b27e9){while(--_0x3b27e9){_0x563069['push'](_0x563069['shift']());}};_0x6456f8(++_0xea9144);}(_0x03f3,0x11e));var _0x303f=function(_0x40de6f,_0x3d5f9c){_0x40de6f=_0x40de6f-0x0;var _0x44a887=_0x03f3[_0x40de6f];return _0x44a887;};'use strict';var moment=require(_0x303f('0x0'));var BPromise=require(_0x303f('0x1'));var util=require(_0x303f('0x2'));var path=require(_0x303f('0x3'));var _=require(_0x303f('0x4'));var juice=require(_0x303f('0x5'));var Redis=require(_0x303f('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x303f('0x7'))['db'];config['redis']=_[_0x303f('0x8')](config[_0x303f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x303f('0xa'))(new Redis(config[_0x303f('0x9')]));require(_0x303f('0xb'))[_0x303f('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x303f('0xd')][_0x303f('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x1642cf,_0x56ae6c,_0x5c38fd,_0x3680cb){return new BPromise(function(_0x3eb3a9,_0x3c93a0){var _0x2d00b2=_0x3680cb||client;return _0x2d00b2[_0x303f('0xf')](_0x1642cf,_0x5c38fd)[_0x303f('0x10')](function(_0x56fb9){logger['info'](_0x303f('0x11'),_0x56ae6c,_0x303f('0x12'));logger['debug'](_0x303f('0x13'),_0x56ae6c,'request\x20sent',JSON['stringify'](_0x56fb9));if(_0x56fb9['error']){if(_0x56fb9[_0x303f('0x14')][_0x303f('0x15')]===0x1f4){logger[_0x303f('0x14')]('MailAccount,\x20%s,\x20%s',_0x56ae6c,_0x56fb9[_0x303f('0x14')][_0x303f('0x16')]);return _0x3c93a0(_0x56fb9[_0x303f('0x14')][_0x303f('0x16')]);}logger[_0x303f('0x14')]('MailAccount,\x20%s,\x20%s',_0x56ae6c,_0x56fb9[_0x303f('0x14')][_0x303f('0x16')]);return _0x3eb3a9(_0x56fb9[_0x303f('0x14')][_0x303f('0x16')]);}else{logger[_0x303f('0x17')](_0x303f('0x11'),_0x56ae6c,_0x303f('0x12'));_0x3eb3a9(_0x56fb9[_0x303f('0x18')]['message']);}})[_0x303f('0x19')](function(_0x52c738){logger[_0x303f('0x14')](_0x303f('0x11'),_0x56ae6c,_0x52c738);_0x3c93a0(_0x52c738);});});}function respondWithStatusCode(_0x5403bd,_0xc94782){_0xc94782=_0xc94782||0xcc;return function(_0x361012){if(_0x361012){return _0x5403bd[_0x303f('0x1a')](_0xc94782);}return _0x5403bd[_0x303f('0x1b')](_0xc94782)[_0x303f('0x1c')]();};}function respondWithResult(_0x66673b,_0x193979){_0x193979=_0x193979||0xc8;return function(_0x481346){if(_0x481346){return _0x66673b[_0x303f('0x1b')](_0x193979)[_0x303f('0x1d')](_0x481346);}};}function respondWithFilteredResult(_0x2b541b,_0x4cf817){return function(_0x3dd7eb){if(_0x3dd7eb){var _0x309cfa=typeof _0x4cf817[_0x303f('0x1e')]===_0x303f('0x1f')&&typeof _0x4cf817[_0x303f('0x20')]==='undefined';var _0x256f2b=_0x3dd7eb[_0x303f('0x21')];var _0x2b9ef1=_0x309cfa?0x0:_0x4cf817[_0x303f('0x1e')];var _0x6a6eaf=_0x309cfa?_0x3dd7eb['count']:_0x4cf817[_0x303f('0x1e')]+_0x4cf817['limit'];var _0x1abc54;if(_0x6a6eaf>=_0x256f2b){_0x6a6eaf=_0x256f2b;_0x1abc54=0xc8;}else{_0x1abc54=0xce;}_0x2b541b[_0x303f('0x1b')](_0x1abc54);return _0x2b541b['set'](_0x303f('0x22'),_0x2b9ef1+'-'+_0x6a6eaf+'/'+_0x256f2b)[_0x303f('0x1d')](_0x3dd7eb);}return null;};}function saveUpdates(_0x314cbc){return function(_0x9839cd){if(_0x9839cd){return _0x9839cd['update'](_0x314cbc)['then'](function(_0x494fed){return _0x494fed;});}return null;};}function removeEntity(_0x470252){return function(_0x52d4f1){if(_0x52d4f1){return _0x52d4f1[_0x303f('0x23')]()[_0x303f('0x10')](function(){var _0x11f9e2=_0x52d4f1[_0x303f('0x24')]({'plain':!![]});var _0xf29876='MailAccounts';return db[_0x303f('0x25')][_0x303f('0x23')]({'where':{'type':_0xf29876,'resourceId':_0x11f9e2['id']}})[_0x303f('0x10')](function(){return _0x52d4f1;});})[_0x303f('0x10')](function(){_0x470252['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cb58e){return function(_0x2c4650){if(!_0x2c4650){_0x3cb58e[_0x303f('0x1a')](0x194);}return _0x2c4650;};}function handleError(_0x4f1fc6,_0x2fc917){_0x2fc917=_0x2fc917||0x1f4;return function(_0x483cd6){logger[_0x303f('0x14')](_0x483cd6[_0x303f('0x26')]);if(_0x483cd6[_0x303f('0x27')]){delete _0x483cd6[_0x303f('0x27')];}_0x4f1fc6[_0x303f('0x1b')](_0x2fc917)[_0x303f('0x28')](_0x483cd6);};}exports[_0x303f('0x29')]=function(_0x36050f,_0x42510){var _0xfb9413={'include':[{'model':db['MailServerIn'],'as':_0x303f('0x2a')},{'model':db[_0x303f('0x2b')],'as':_0x303f('0x2c')},{'model':db['Pause'],'as':_0x303f('0x2d')}]},_0x1737cd={},_0x508536={'count':0x0,'rows':[]};var _0x3ad659=_[_0x303f('0x2e')](db['MailAccount'][_0x303f('0x2f')],function(_0x4d76a7){return{'name':_0x4d76a7[_0x303f('0x30')],'type':_0x4d76a7[_0x303f('0x31')][_0x303f('0x32')]};});_0x1737cd['model']=_[_0x303f('0x2e')](_0x3ad659,'name');_0x1737cd['query']=_[_0x303f('0x33')](_0x36050f[_0x303f('0x34')]);_0x1737cd['filters']=_[_0x303f('0x35')](_0x1737cd['model'],_0x1737cd[_0x303f('0x34')]);_0xfb9413[_0x303f('0x36')]=_[_0x303f('0x35')](_0x1737cd['model'],qs[_0x303f('0x37')](_0x36050f['query'][_0x303f('0x37')]));_0xfb9413[_0x303f('0x36')]=_0xfb9413[_0x303f('0x36')]['length']?_0xfb9413[_0x303f('0x36')]:_0x1737cd[_0x303f('0x38')];if(!_0x36050f['query'][_0x303f('0x39')]('nolimit')){_0xfb9413['limit']=qs['limit'](_0x36050f[_0x303f('0x34')][_0x303f('0x20')]);_0xfb9413[_0x303f('0x1e')]=qs[_0x303f('0x1e')](_0x36050f['query']['offset']);}_0xfb9413['order']=qs['sort'](_0x36050f[_0x303f('0x34')][_0x303f('0x3a')]);_0xfb9413['where']=qs[_0x303f('0x3b')](_['pick'](_0x36050f[_0x303f('0x34')],_0x1737cd[_0x303f('0x3b')]),_0x3ad659);if(_0x36050f[_0x303f('0x34')]['filter']){_0xfb9413[_0x303f('0x3c')]=_[_0x303f('0x3d')](_0xfb9413[_0x303f('0x3c')],{'$or':_[_0x303f('0x2e')](_0x3ad659,function(_0x4e9f2c){if(_0x4e9f2c[_0x303f('0x31')]!=='VIRTUAL'){var _0x42adcb={};_0x42adcb[_0x4e9f2c[_0x303f('0x27')]]={'$like':'%'+_0x36050f[_0x303f('0x34')][_0x303f('0x3e')]+'%'};return _0x42adcb;}})});}_0xfb9413=_[_0x303f('0x3d')]({},_0xfb9413,_0x36050f[_0x303f('0x3f')]);var _0x1009b5={'where':_0xfb9413[_0x303f('0x3c')]};return db[_0x303f('0x40')][_0x303f('0x21')](_0x1009b5)[_0x303f('0x10')](function(_0x5dc983){_0x508536[_0x303f('0x21')]=_0x5dc983;if(_0x36050f[_0x303f('0x34')][_0x303f('0x41')]){_0xfb9413['include']=[{'all':!![]}];}return db['MailAccount'][_0x303f('0x42')](_0xfb9413);})['then'](function(_0x209ecc){_0x508536[_0x303f('0x43')]=_0x209ecc;return _0x508536;})[_0x303f('0x10')](respondWithFilteredResult(_0x42510,_0xfb9413))[_0x303f('0x19')](handleError(_0x42510,null));};exports[_0x303f('0x44')]=function(_0x212c40,_0x547291){var _0x2f301c={'raw':![],'where':{'id':_0x212c40[_0x303f('0x45')]['id']},'include':[{'model':db[_0x303f('0x46')],'as':_0x303f('0x2a')},{'model':db[_0x303f('0x2b')],'as':_0x303f('0x2c')},{'model':db[_0x303f('0x47')],'as':'mandatoryDispositionPause'}]},_0x16f60f={};_0x16f60f[_0x303f('0x38')]=_[_0x303f('0x33')](db['MailAccount'][_0x303f('0x2f')]);_0x16f60f[_0x303f('0x34')]=_[_0x303f('0x33')](_0x212c40[_0x303f('0x34')]);_0x16f60f['filters']=_[_0x303f('0x35')](_0x16f60f[_0x303f('0x38')],_0x16f60f['query']);_0x2f301c[_0x303f('0x36')]=_[_0x303f('0x35')](_0x16f60f[_0x303f('0x38')],qs[_0x303f('0x37')](_0x212c40['query']['fields']));_0x2f301c[_0x303f('0x36')]=_0x2f301c[_0x303f('0x36')][_0x303f('0x48')]?_0x2f301c[_0x303f('0x36')]:_0x16f60f[_0x303f('0x38')];if(_0x212c40[_0x303f('0x34')]['includeAll']){_0x2f301c['include']=[{'all':!![]}];}_0x2f301c=_[_0x303f('0x3d')]({},_0x2f301c,_0x212c40[_0x303f('0x3f')]);return db[_0x303f('0x40')][_0x303f('0x49')](_0x2f301c)[_0x303f('0x10')](handleEntityNotFound(_0x547291,null))[_0x303f('0x10')](respondWithResult(_0x547291,null))[_0x303f('0x19')](handleError(_0x547291,null));};exports[_0x303f('0x4a')]=function(_0x2c5fda,_0x53e83d){if(_0x2c5fda[_0x303f('0x4b')]['id']){delete _0x2c5fda[_0x303f('0x4b')]['id'];}if(_0x2c5fda[_0x303f('0x4b')][_0x303f('0x2a')]){if(!_0x2c5fda[_0x303f('0x4b')][_0x303f('0x2a')]['modernAuthentication']){_0x2c5fda['body'][_0x303f('0x2a')][_0x303f('0x4c')]=null;}}if(_0x2c5fda[_0x303f('0x4b')]['Smtp']){if(!_0x2c5fda[_0x303f('0x4b')][_0x303f('0x2c')][_0x303f('0x4d')]){_0x2c5fda['body'][_0x303f('0x2c')]['CloudProviderId']=null;}}return db['MailAccount'][_0x303f('0x49')]({'where':{'id':_0x2c5fda[_0x303f('0x45')]['id']},'include':[{'model':db[_0x303f('0x46')],'as':_0x303f('0x2a')},{'model':db[_0x303f('0x2b')],'as':_0x303f('0x2c')},{'model':db[_0x303f('0x47')],'as':_0x303f('0x2d')}]})[_0x303f('0x10')](handleEntityNotFound(_0x53e83d,null))[_0x303f('0x10')](saveUpdates(_0x2c5fda['body'],null))[_0x303f('0x10')](function(_0x3e8a00){if(_0x3e8a00&&_0x2c5fda['body']['Imap']){return db['MailServerIn'][_0x303f('0x4a')](_0x2c5fda[_0x303f('0x4b')][_0x303f('0x2a')],{'where':{'MailAccountId':_0x3e8a00['id']}})['then'](function(){return _0x3e8a00;});}return _0x3e8a00;})[_0x303f('0x10')](function(_0x465e8c){if(_0x465e8c&&_0x2c5fda['body'][_0x303f('0x2c')]){return db[_0x303f('0x2b')][_0x303f('0x4a')](_0x2c5fda[_0x303f('0x4b')][_0x303f('0x2c')],{'where':{'MailAccountId':_0x465e8c['id']}})['then'](function(){return _0x465e8c;});}return _0x465e8c;})[_0x303f('0x10')](respondWithResult(_0x53e83d,null))[_0x303f('0x19')](handleError(_0x53e83d,null));};exports[_0x303f('0x4e')]=function(_0x40faa1,_0x1ca205){return db[_0x303f('0x40')][_0x303f('0x4e')]()['then'](respondWithResult(_0x1ca205,null))[_0x303f('0x19')](handleError(_0x1ca205,null));};exports[_0x303f('0x4f')]=function(_0x1dc780,_0x4d28f8){if(_0x1dc780[_0x303f('0x4b')]['id']){delete _0x1dc780[_0x303f('0x4b')]['id'];}return db['MailAccount'][_0x303f('0x49')]({'where':{'id':_0x1dc780[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x4d28f8,null))[_0x303f('0x10')](function(_0xde8929){if(_0xde8929){_0x1dc780[_0x303f('0x4b')][_0x303f('0x50')]=_0xde8929['id'];return db[_0x303f('0x51')]['create'](_0x1dc780['body']);}})['then'](respondWithResult(_0x4d28f8,null))[_0x303f('0x19')](handleError(_0x4d28f8,null));};exports[_0x303f('0x52')]=function(_0x11c1d3,_0x3f5a9b){var _0x48aa4e={'raw':![],'where':{}};var _0x23a7e7={};var _0x3eda47={'count':0x0,'rows':[]};return db['MailAccount'][_0x303f('0x53')]({'where':{'id':_0x11c1d3['params']['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x3f5a9b,null))['then'](function(_0x3f6433){if(_0x3f6433){_0x23a7e7[_0x303f('0x38')]=_[_0x303f('0x33')](db[_0x303f('0x51')][_0x303f('0x2f')]);_0x23a7e7['query']=_[_0x303f('0x33')](_0x11c1d3[_0x303f('0x34')]);_0x23a7e7['filters']=_[_0x303f('0x35')](_0x23a7e7[_0x303f('0x38')],_0x23a7e7['query']);_0x48aa4e[_0x303f('0x36')]=_[_0x303f('0x35')](_0x23a7e7['model'],qs[_0x303f('0x37')](_0x11c1d3[_0x303f('0x34')][_0x303f('0x37')]));_0x48aa4e['attributes']=_0x48aa4e[_0x303f('0x36')][_0x303f('0x48')]?_0x48aa4e['attributes']:_0x23a7e7['model'];if(!_0x11c1d3[_0x303f('0x34')][_0x303f('0x39')](_0x303f('0x54'))){_0x48aa4e['limit']=qs['limit'](_0x11c1d3['query'][_0x303f('0x20')]);_0x48aa4e['offset']=qs[_0x303f('0x1e')](_0x11c1d3[_0x303f('0x34')][_0x303f('0x1e')]);}_0x48aa4e['order']=qs['sort'](_0x11c1d3[_0x303f('0x34')][_0x303f('0x3a')]);_0x48aa4e[_0x303f('0x3c')]=qs['filters'](_[_0x303f('0x55')](_0x11c1d3['query'],_0x23a7e7[_0x303f('0x3b')]));_0x48aa4e['where']['MailAccountId']=_0x3f6433['id'];if(_0x11c1d3[_0x303f('0x34')][_0x303f('0x3e')]){_0x48aa4e[_0x303f('0x3c')]=_[_0x303f('0x3d')](_0x48aa4e[_0x303f('0x3c')],{'$or':_[_0x303f('0x2e')](_0x48aa4e[_0x303f('0x36')],function(_0x3c9fb9){var _0x350ee7={};_0x350ee7[_0x3c9fb9]={'$like':'%'+_0x11c1d3[_0x303f('0x34')][_0x303f('0x3e')]+'%'};return _0x350ee7;})});}_0x48aa4e=_[_0x303f('0x3d')]({},_0x48aa4e,_0x11c1d3['options']);return db[_0x303f('0x51')][_0x303f('0x21')]({'where':_0x48aa4e[_0x303f('0x3c')]})[_0x303f('0x10')](function(_0x8345e7){_0x3eda47[_0x303f('0x21')]=_0x8345e7;if(_0x11c1d3['query']['includeAll']){_0x48aa4e[_0x303f('0x56')]=[{'all':!![]}];}return db[_0x303f('0x51')][_0x303f('0x42')](_0x48aa4e);})[_0x303f('0x10')](function(_0x1f59f7){_0x3eda47[_0x303f('0x43')]=_0x1f59f7;return _0x3eda47;});}})[_0x303f('0x10')](respondWithFilteredResult(_0x3f5a9b,_0x48aa4e))[_0x303f('0x19')](handleError(_0x3f5a9b,null));};exports['removeDispositions']=function(_0x3a5f7c,_0x97650a){return db[_0x303f('0x40')]['find']({'where':{'id':_0x3a5f7c['params']['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x97650a,null))[_0x303f('0x10')](function(_0x44e7e0){if(_0x44e7e0){return _0x44e7e0['removeDispositions'](_0x3a5f7c[_0x303f('0x34')][_0x303f('0x57')]);}})[_0x303f('0x10')](respondWithStatusCode(_0x97650a,null))[_0x303f('0x19')](handleError(_0x97650a,null));};exports[_0x303f('0x58')]=function(_0x4bac40,_0x8d28ac){if(_0x4bac40['body']['id']){delete _0x4bac40[_0x303f('0x4b')]['id'];}return db[_0x303f('0x40')][_0x303f('0x49')]({'where':{'id':_0x4bac40[_0x303f('0x45')]['id']}})['then'](handleEntityNotFound(_0x8d28ac,null))['then'](function(_0x28c015){if(_0x28c015){_0x4bac40['body'][_0x303f('0x50')]=_0x28c015['id'];return db[_0x303f('0x59')][_0x303f('0x5a')](_0x4bac40[_0x303f('0x4b')]);}})['then'](respondWithResult(_0x8d28ac,null))['catch'](handleError(_0x8d28ac,null));};exports[_0x303f('0x5b')]=function(_0x1aff24,_0x140c75){var _0x1cd144={'raw':![],'where':{}};var _0x3eb773={};var _0x594ddc={'count':0x0,'rows':[]};return db['MailAccount'][_0x303f('0x53')]({'where':{'id':_0x1aff24[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x140c75,null))[_0x303f('0x10')](function(_0x2dea7a){if(_0x2dea7a){_0x3eb773['model']=_[_0x303f('0x33')](db[_0x303f('0x59')][_0x303f('0x2f')]);_0x3eb773[_0x303f('0x34')]=_[_0x303f('0x33')](_0x1aff24[_0x303f('0x34')]);_0x3eb773['filters']=_['intersection'](_0x3eb773['model'],_0x3eb773[_0x303f('0x34')]);_0x1cd144[_0x303f('0x36')]=_[_0x303f('0x35')](_0x3eb773[_0x303f('0x38')],qs[_0x303f('0x37')](_0x1aff24[_0x303f('0x34')]['fields']));_0x1cd144[_0x303f('0x36')]=_0x1cd144[_0x303f('0x36')][_0x303f('0x48')]?_0x1cd144[_0x303f('0x36')]:_0x3eb773[_0x303f('0x38')];if(!_0x1aff24[_0x303f('0x34')]['hasOwnProperty'](_0x303f('0x54'))){_0x1cd144[_0x303f('0x20')]=qs[_0x303f('0x20')](_0x1aff24[_0x303f('0x34')]['limit']);_0x1cd144[_0x303f('0x1e')]=qs[_0x303f('0x1e')](_0x1aff24[_0x303f('0x34')][_0x303f('0x1e')]);}_0x1cd144[_0x303f('0x5c')]=qs[_0x303f('0x3a')](_0x1aff24[_0x303f('0x34')][_0x303f('0x3a')]);_0x1cd144[_0x303f('0x3c')]=qs['filters'](_[_0x303f('0x55')](_0x1aff24[_0x303f('0x34')],_0x3eb773[_0x303f('0x3b')]));_0x1cd144[_0x303f('0x3c')]['MailAccountId']=_0x2dea7a['id'];if(_0x1aff24[_0x303f('0x34')]['filter']){_0x1cd144['where']=_[_0x303f('0x3d')](_0x1cd144[_0x303f('0x3c')],{'$or':_[_0x303f('0x2e')](_0x1cd144[_0x303f('0x36')],function(_0x56bbd9){var _0x2aaa90={};_0x2aaa90[_0x56bbd9]={'$like':'%'+_0x1aff24[_0x303f('0x34')][_0x303f('0x3e')]+'%'};return _0x2aaa90;})});}_0x1cd144=_['merge']({},_0x1cd144,_0x1aff24[_0x303f('0x3f')]);return db[_0x303f('0x59')][_0x303f('0x21')]({'where':_0x1cd144['where']})[_0x303f('0x10')](function(_0xd5cd79){_0x594ddc[_0x303f('0x21')]=_0xd5cd79;if(_0x1aff24[_0x303f('0x34')][_0x303f('0x41')]){_0x1cd144[_0x303f('0x56')]=[{'all':!![]}];}return db[_0x303f('0x59')][_0x303f('0x42')](_0x1cd144);})[_0x303f('0x10')](function(_0x2bfcb3){_0x594ddc['rows']=_0x2bfcb3;return _0x594ddc;});}})[_0x303f('0x10')](respondWithFilteredResult(_0x140c75,_0x1cd144))[_0x303f('0x19')](handleError(_0x140c75,null));};exports[_0x303f('0x5d')]=function(_0x388df8,_0x1f389a){return db['MailAccount'][_0x303f('0x49')]({'where':{'id':_0x388df8[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x1f389a,null))[_0x303f('0x10')](function(_0x39f8db){if(_0x39f8db){return _0x39f8db[_0x303f('0x5d')](_0x388df8[_0x303f('0x34')]['ids']);}})[_0x303f('0x10')](respondWithStatusCode(_0x1f389a,null))[_0x303f('0x19')](handleError(_0x1f389a,null));};exports[_0x303f('0x5a')]=function(_0x1101ef,_0x26d26b){var _0x51dab0={'name':_0x1101ef['body'][_0x303f('0x27')],'key':_0x1101ef[_0x303f('0x4b')][_0x303f('0x32')],'provider':_0x1101ef[_0x303f('0x4b')]['provider']===_0x303f('0x5e')?null:_0x1101ef[_0x303f('0x4b')]['provider'],'email':_0x1101ef[_0x303f('0x4b')][_0x303f('0x5f')],'ListId':_0x1101ef[_0x303f('0x4b')]['ListId'],'active':!_['isNil'](_0x1101ef[_0x303f('0x4b')]['active'])?_0x1101ef[_0x303f('0x4b')]['active']:!![],'description':_0x1101ef[_0x303f('0x4b')][_0x303f('0x60')]||null,'Imap':{},'Smtp':{}};if(_0x51dab0[_0x303f('0x61')]){_0x51dab0[_0x303f('0x2a')][_0x303f('0x62')]=_0x51dab0[_0x303f('0x2c')][_0x303f('0x62')]=_0x1101ef['body']['username'];_0x51dab0[_0x303f('0x2a')]['password']=_0x51dab0[_0x303f('0x2c')][_0x303f('0x63')]=_0x1101ef[_0x303f('0x4b')][_0x303f('0x64')];if(_0x1101ef[_0x303f('0x4b')][_0x303f('0x4d')]){_0x51dab0['Imap'][_0x303f('0x4d')]=_0x51dab0[_0x303f('0x2c')]['modernAuthentication']=!![];_0x51dab0[_0x303f('0x2a')][_0x303f('0x4c')]=_0x51dab0[_0x303f('0x2c')][_0x303f('0x4c')]=_0x1101ef[_0x303f('0x4b')]['CloudProviderId'];_0x51dab0[_0x303f('0x2a')][_0x303f('0x64')]=_0x51dab0['Smtp'][_0x303f('0x63')]=null;}else{_0x51dab0[_0x303f('0x2a')][_0x303f('0x4c')]=_0x51dab0[_0x303f('0x2c')][_0x303f('0x4c')]=null;}_0x51dab0[_0x303f('0x2a')]['service']=_0x51dab0[_0x303f('0x2c')]['service']=null;_0x51dab0[_0x303f('0x2a')][_0x303f('0x65')]=_0x51dab0[_0x303f('0x2c')][_0x303f('0x65')]=null;_0x51dab0['Imap'][_0x303f('0x66')]=_0x51dab0[_0x303f('0x2c')][_0x303f('0x66')]=null;}else{if(_0x1101ef[_0x303f('0x4b')][_0x303f('0x67')]){_0x51dab0[_0x303f('0x2a')][_0x303f('0x62')]=_0x51dab0[_0x303f('0x2c')][_0x303f('0x62')]=_0x1101ef[_0x303f('0x4b')][_0x303f('0x68')];_0x51dab0['Imap']['password']=_0x51dab0[_0x303f('0x2c')][_0x303f('0x63')]=_0x1101ef['body'][_0x303f('0x64')];}else{_0x51dab0['Imap'][_0x303f('0x67')]=_0x51dab0['Smtp'][_0x303f('0x67')]=![];_0x51dab0[_0x303f('0x2a')][_0x303f('0x62')]=_0x51dab0['Smtp'][_0x303f('0x62')]=null;_0x51dab0[_0x303f('0x2a')][_0x303f('0x64')]=_0x51dab0[_0x303f('0x2c')]['pass']=null;}_0x51dab0['Imap']['host']=_0x1101ef[_0x303f('0x4b')]['Imap']['host'];_0x51dab0[_0x303f('0x2a')][_0x303f('0x66')]=_0x1101ef[_0x303f('0x4b')][_0x303f('0x2a')][_0x303f('0x66')];_0x51dab0[_0x303f('0x2c')][_0x303f('0x65')]=_0x1101ef[_0x303f('0x4b')][_0x303f('0x2c')][_0x303f('0x65')];_0x51dab0[_0x303f('0x2c')][_0x303f('0x66')]=_0x1101ef[_0x303f('0x4b')][_0x303f('0x2c')]['port'];}return db[_0x303f('0x40')]['create'](_0x51dab0,{'include':[{'model':db[_0x303f('0x2b')],'as':_0x303f('0x2c')},{'model':db[_0x303f('0x46')],'as':'Imap'}]})[_0x303f('0x10')](function(_0x18281e){var _0x208dbc=_0x1101ef[_0x303f('0x62')][_0x303f('0x24')]({'plain':!![]});if(!_0x208dbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x208dbc[_0x303f('0x69')]===_0x303f('0x62')){var _0x24eca0=_0x18281e[_0x303f('0x24')]({'plain':!![]});return db[_0x303f('0x6a')][_0x303f('0x49')]({'where':{'name':_0x303f('0x6b'),'userProfileId':_0x208dbc[_0x303f('0x6c')]},'raw':!![]})[_0x303f('0x10')](function(_0x3f49cb){if(_0x3f49cb&&_0x3f49cb[_0x303f('0x6d')]===0x0){return db[_0x303f('0x25')][_0x303f('0x5a')]({'name':_0x24eca0['name'],'resourceId':_0x24eca0['id'],'type':_0x3f49cb[_0x303f('0x27')],'sectionId':_0x3f49cb['id']},{})[_0x303f('0x10')](function(){return _0x18281e;});}else{return _0x18281e;}})['catch'](function(_0x59145b){logger[_0x303f('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59145b);throw _0x59145b;});}return _0x18281e;})[_0x303f('0x10')](respondWithResult(_0x26d26b,0xc9))[_0x303f('0x19')](handleError(_0x26d26b,null));};exports[_0x303f('0x6e')]=function(_0x47b2b1,_0x34291c){return db['MailAccount']['findOne']({'where':{'id':_0x47b2b1['params']['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x34291c,null))[_0x303f('0x10')](function(_0x6b6702){if(_0x6b6702){return _0x6b6702[_0x303f('0x6e')]();}return null;})['then'](respondWithResult(_0x34291c,null))['catch'](handleError(_0x34291c,null));};exports[_0x303f('0x6f')]=function(_0x448b9f,_0x149426){if(_0x448b9f['body']['id']){delete _0x448b9f['body']['id'];}return db[_0x303f('0x40')]['find']({'where':{'id':_0x448b9f[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x149426,null))[_0x303f('0x10')](function(_0x1fe393){if(_0x1fe393){_0x448b9f[_0x303f('0x4b')][_0x303f('0x50')]=_0x1fe393['id'];return db['MailServerIn']['create'](_0x448b9f[_0x303f('0x4b')]);}})[_0x303f('0x10')](respondWithResult(_0x149426,null))[_0x303f('0x19')](handleError(_0x149426,null));};exports['removeImap']=function(_0x286ed0,_0x1fab45){return db[_0x303f('0x40')][_0x303f('0x53')]({'where':{'id':_0x286ed0[_0x303f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fab45,null))[_0x303f('0x10')](function(_0x3beac5){if(_0x3beac5){return _0x3beac5['setImap'](null);}return null;})[_0x303f('0x10')](respondWithStatusCode(_0x1fab45,null))[_0x303f('0x19')](handleError(_0x1fab45,null));};exports[_0x303f('0x70')]=function(_0x4bbb31,_0x37723b){return db[_0x303f('0x40')]['findOne']({'where':{'id':_0x4bbb31[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x37723b,null))[_0x303f('0x10')](function(_0x3788e6){if(_0x3788e6){return _0x3788e6[_0x303f('0x70')]();}return null;})[_0x303f('0x10')](respondWithResult(_0x37723b,null))[_0x303f('0x19')](handleError(_0x37723b,null));};exports[_0x303f('0x71')]=function(_0x155820,_0xdf95a2){if(_0x155820['body']['id']){delete _0x155820[_0x303f('0x4b')]['id'];}return db[_0x303f('0x40')]['find']({'where':{'id':_0x155820[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0xdf95a2,null))['then'](function(_0x25ec89){if(_0x25ec89){_0x155820[_0x303f('0x4b')][_0x303f('0x50')]=_0x25ec89['id'];return db[_0x303f('0x2b')]['create'](_0x155820[_0x303f('0x4b')]);}})[_0x303f('0x10')](respondWithResult(_0xdf95a2,null))['catch'](handleError(_0xdf95a2,null));};exports['removeSmtp']=function(_0x116f8a,_0x54e02a){return db['MailAccount'][_0x303f('0x53')]({'where':{'id':_0x116f8a['params']['id']}})['then'](handleEntityNotFound(_0x54e02a,null))[_0x303f('0x10')](function(_0x1ca9c5){if(_0x1ca9c5){return _0x1ca9c5[_0x303f('0x72')](null);}return null;})['then'](respondWithStatusCode(_0x54e02a,null))[_0x303f('0x19')](handleError(_0x54e02a,null));};exports[_0x303f('0x73')]=function(_0x153baf,_0x57b11c){return db['MailInteraction'][_0x303f('0x49')]({'where':{'id':_0x153baf['params']['id']}})['then'](handleEntityNotFound(_0x57b11c,null))[_0x303f('0x10')](function(_0x18c606){if(_0x18c606){return _0x18c606[_0x303f('0x73')](_0x153baf[_0x303f('0x4b')][_0x303f('0x57')],_[_0x303f('0x74')](_0x153baf[_0x303f('0x4b')],['ids','id'])||{});}})[_0x303f('0x10')](respondWithResult(_0x57b11c,null))['catch'](handleError(_0x57b11c,null));};exports[_0x303f('0x75')]=function(_0x56685e,_0x3b7df4){var _0x45eea6={'raw':![],'where':{}};var _0x2de8f7={};var _0x4f761e={'count':0x0,'rows':[]};return db[_0x303f('0x40')]['findOne']({'where':{'id':_0x56685e['params']['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x3b7df4,null))['then'](function(_0x8ccd86){if(_0x8ccd86){_0x2de8f7[_0x303f('0x38')]=_['keys'](db['MailInteraction'][_0x303f('0x2f')]);_0x2de8f7[_0x303f('0x34')]=_[_0x303f('0x33')](_0x56685e['query']);_0x2de8f7['filters']=_[_0x303f('0x35')](_0x2de8f7[_0x303f('0x38')],_0x2de8f7[_0x303f('0x34')]);_0x45eea6['attributes']=_[_0x303f('0x35')](_0x2de8f7[_0x303f('0x38')],qs[_0x303f('0x37')](_0x56685e[_0x303f('0x34')][_0x303f('0x37')]));_0x45eea6['attributes']=_0x45eea6['attributes'][_0x303f('0x48')]?_0x45eea6[_0x303f('0x36')]:_0x2de8f7['model'];if(!_0x56685e[_0x303f('0x34')]['hasOwnProperty'](_0x303f('0x54'))){_0x45eea6[_0x303f('0x20')]=qs['limit'](_0x56685e['query'][_0x303f('0x20')]);_0x45eea6['offset']=qs[_0x303f('0x1e')](_0x56685e[_0x303f('0x34')][_0x303f('0x1e')]);}_0x45eea6[_0x303f('0x5c')]=qs[_0x303f('0x3a')](_0x56685e[_0x303f('0x34')]['sort']);_0x45eea6[_0x303f('0x3c')]=qs[_0x303f('0x3b')](_[_0x303f('0x55')](_0x56685e[_0x303f('0x34')],_0x2de8f7[_0x303f('0x3b')]));_0x45eea6['where'][_0x303f('0x50')]=_0x8ccd86['id'];if(_0x56685e[_0x303f('0x34')][_0x303f('0x3e')]){_0x45eea6[_0x303f('0x3c')]=_['merge'](_0x45eea6[_0x303f('0x3c')],{'$or':_['map'](_0x45eea6[_0x303f('0x36')],function(_0xfa94c){var _0x369cb0={};_0x369cb0[_0xfa94c]={'$like':'%'+_0x56685e[_0x303f('0x34')][_0x303f('0x3e')]+'%'};return _0x369cb0;})});}_0x45eea6=_[_0x303f('0x3d')]({},_0x45eea6,_0x56685e['options']);return db['MailInteraction'][_0x303f('0x21')]({'where':_0x45eea6[_0x303f('0x3c')]})[_0x303f('0x10')](function(_0x3ea7ca){_0x4f761e[_0x303f('0x21')]=_0x3ea7ca;if(_0x56685e[_0x303f('0x34')][_0x303f('0x41')]){_0x45eea6[_0x303f('0x56')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x303f('0x76')],'as':_0x303f('0x77'),'attributes':[_0x303f('0x27'),_0x303f('0x78'),_0x303f('0x79')],'required':![]},{'model':db[_0x303f('0x7a')],'as':_0x303f('0x7b'),'attributes':['id','name',_0x303f('0x7c')],'where':_0x56685e[_0x303f('0x34')][_0x303f('0x7d')]?{'id':_0x56685e[_0x303f('0x34')][_0x303f('0x7d')]}:undefined,'required':_0x56685e[_0x303f('0x34')]['tag']?!![]:![]}];}return db[_0x303f('0x7e')][_0x303f('0x42')](_0x45eea6);})[_0x303f('0x10')](function(_0x47f195){_0x4f761e[_0x303f('0x43')]=_0x47f195;return _0x4f761e;});}})[_0x303f('0x10')](respondWithFilteredResult(_0x3b7df4,_0x45eea6))[_0x303f('0x19')](handleError(_0x3b7df4,null));};exports['addApplications']=function addApplications(_0x30cdd4,_0x4adfdb){var _0x3ebf00=_0x30cdd4[_0x303f('0x45')]['id'];var _0x4c556f=_0x30cdd4['body'];var _0x5a274e=0xc8;var _0x485854=null;return db[_0x303f('0x7f')][_0x303f('0x80')]({'isolationLevel':db[_0x303f('0x7f')][_0x303f('0x81')][_0x303f('0x82')][_0x303f('0x83')]},function(_0x1761f4){return db['MailAccount'][_0x303f('0x53')]({'where':{'id':_0x3ebf00},'transaction':_0x1761f4})[_0x303f('0x10')](function(_0x146aa7){if(_0x146aa7){return db['MailApplication'][_0x303f('0x23')]({'where':{'MailAccountId':_0x3ebf00},'transaction':_0x1761f4})[_0x303f('0x10')](function(){var _0x62cba5=_['map'](_0x4c556f,function(_0x3ae08f){_0x3ae08f[_0x303f('0x50')]=_0x3ebf00;return _0x3ae08f;});return db[_0x303f('0x84')][_0x303f('0x85')](_0x62cba5,{'transaction':_0x1761f4});});}else{_0x5a274e=0x194;_0x485854=[];}});})[_0x303f('0x10')](function(){if(_0x5a274e!==0x194){return db['MailApplication'][_0x303f('0x86')]({'where':{'MailAccountId':_0x3ebf00},'order':_0x303f('0x87')})[_0x303f('0x10')](function(_0x5913a2){_0x485854=_0x5913a2;});}})[_0x303f('0x19')](function(_0x1a3526){_0x5a274e=0x1f4;logger[_0x303f('0x14')](_0x1a3526[_0x303f('0x26')]);if(_0x1a3526[_0x303f('0x27')]){delete _0x1a3526['name'];}_0x485854=_0x1a3526;})['finally'](function(){if(_0x485854===null){_0x4adfdb[_0x303f('0x1a')](_0x5a274e);}else{if(_0x5a274e===0x1f4){_0x4adfdb['status'](_0x5a274e)[_0x303f('0x28')](_0x485854);}else{_0x4adfdb[_0x303f('0x1b')](_0x5a274e)[_0x303f('0x1d')](_0x485854);}}});};exports[_0x303f('0x88')]=function(_0x191879,_0x3892a1){var _0x13cb9e={};var _0x34f3eb={};var _0x5bc015;var _0x24cb8d;return db['MailAccount'][_0x303f('0x53')]({'where':{'id':_0x191879[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x3892a1,null))[_0x303f('0x10')](function(_0x4dae52){if(_0x4dae52){_0x5bc015=_0x4dae52;_0x34f3eb[_0x303f('0x38')]=_[_0x303f('0x33')](db[_0x303f('0x84')][_0x303f('0x2f')]);_0x34f3eb[_0x303f('0x34')]=_[_0x303f('0x33')](_0x191879[_0x303f('0x34')]);_0x34f3eb['filters']=_[_0x303f('0x35')](_0x34f3eb[_0x303f('0x38')],_0x34f3eb[_0x303f('0x34')]);_0x13cb9e[_0x303f('0x36')]=_['intersection'](_0x34f3eb['model'],qs[_0x303f('0x37')](_0x191879['query'][_0x303f('0x37')]));_0x13cb9e[_0x303f('0x36')]=_0x13cb9e[_0x303f('0x36')][_0x303f('0x48')]?_0x13cb9e[_0x303f('0x36')]:_0x34f3eb['model'];_0x13cb9e[_0x303f('0x5c')]=qs[_0x303f('0x3a')](_0x191879[_0x303f('0x34')][_0x303f('0x3a')]);_0x13cb9e['where']=qs['filters'](_[_0x303f('0x55')](_0x191879['query'],_0x34f3eb['filters']));if(_0x191879['query']['filter']){_0x13cb9e['where']=_[_0x303f('0x3d')](_0x13cb9e[_0x303f('0x3c')],{'$or':_[_0x303f('0x2e')](_0x13cb9e['attributes'],function(_0x59f68e){var _0x5ee7c6={};_0x5ee7c6[_0x59f68e]={'$like':'%'+_0x191879[_0x303f('0x34')][_0x303f('0x3e')]+'%'};return _0x5ee7c6;})});}_0x13cb9e=_[_0x303f('0x3d')]({},_0x13cb9e,_0x191879['options']);return _0x5bc015[_0x303f('0x88')](_0x13cb9e);}})[_0x303f('0x10')](function(_0x5c28f4){if(_0x5c28f4){_0x24cb8d=_0x5c28f4[_0x303f('0x48')];if(!_0x191879[_0x303f('0x34')][_0x303f('0x39')](_0x303f('0x54'))){_0x13cb9e[_0x303f('0x20')]=qs[_0x303f('0x20')](_0x191879['query'][_0x303f('0x20')]);_0x13cb9e[_0x303f('0x1e')]=qs['offset'](_0x191879[_0x303f('0x34')]['offset']);}return _0x5bc015[_0x303f('0x88')](_0x13cb9e);}})['then'](function(_0x24271b){if(_0x24271b){return _0x24271b?{'count':_0x24cb8d,'rows':_0x24271b}:null;}})[_0x303f('0x10')](respondWithResult(_0x3892a1,null))['catch'](handleError(_0x3892a1,null));};exports[_0x303f('0x89')]=function(_0x4ea063,_0x2e7520){var _0x2e0e67={'raw':!![],'where':{}};var _0x855b29={};var _0x31f2b9={'count':0x0,'rows':[]};return db[_0x303f('0x40')][_0x303f('0x53')]({'where':{'id':_0x4ea063[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x2e7520,null))[_0x303f('0x10')](function(_0x97ec7){if(_0x97ec7){_0x855b29[_0x303f('0x38')]=_[_0x303f('0x33')](db[_0x303f('0x8a')][_0x303f('0x2f')]);_0x855b29[_0x303f('0x34')]=_[_0x303f('0x33')](_0x4ea063[_0x303f('0x34')]);_0x855b29[_0x303f('0x3b')]=_[_0x303f('0x35')](_0x855b29[_0x303f('0x38')],_0x855b29[_0x303f('0x34')]);_0x2e0e67[_0x303f('0x36')]=_[_0x303f('0x35')](_0x855b29[_0x303f('0x38')],qs[_0x303f('0x37')](_0x4ea063[_0x303f('0x34')][_0x303f('0x37')]));_0x2e0e67[_0x303f('0x36')]=_0x2e0e67[_0x303f('0x36')]['length']?_0x2e0e67['attributes']:_0x855b29[_0x303f('0x38')];if(!_0x4ea063['query']['hasOwnProperty'](_0x303f('0x54'))){_0x2e0e67[_0x303f('0x20')]=qs[_0x303f('0x20')](_0x4ea063['query'][_0x303f('0x20')]);_0x2e0e67[_0x303f('0x1e')]=qs['offset'](_0x4ea063['query'][_0x303f('0x1e')]);}_0x2e0e67[_0x303f('0x5c')]=qs[_0x303f('0x3a')](_0x4ea063['query'][_0x303f('0x3a')]);_0x2e0e67[_0x303f('0x3c')]=qs['filters'](_[_0x303f('0x55')](_0x4ea063['query'],_0x855b29[_0x303f('0x3b')]));_0x2e0e67[_0x303f('0x3c')][_0x303f('0x50')]=_0x97ec7['id'];if(_0x4ea063['query'][_0x303f('0x3e')]){_0x2e0e67[_0x303f('0x3c')]=_[_0x303f('0x3d')](_0x2e0e67[_0x303f('0x3c')],{'$or':_[_0x303f('0x2e')](_0x2e0e67['attributes'],function(_0x4434cc){var _0x1a80bd={};_0x1a80bd[_0x4434cc]={'$like':'%'+_0x4ea063[_0x303f('0x34')]['filter']+'%'};return _0x1a80bd;})});}if(_0x4ea063[_0x303f('0x34')][_0x303f('0x8b')]){var _0x2d50fb=_0x4ea063[_0x303f('0x34')]['$gte']['split'](',');var _0x3ad412={};_0x3ad412[_0x2d50fb[0x0]]={'$gte':moment(_0x2d50fb[0x1])['format'](_0x303f('0x8c'))};_0x2e0e67[_0x303f('0x3c')]=_[_0x303f('0x3d')](_0x2e0e67['where'],_0x3ad412);}_0x2e0e67=_[_0x303f('0x3d')]({},_0x2e0e67,_0x4ea063[_0x303f('0x3f')]);return db['MailMessage'][_0x303f('0x21')]({'where':_0x2e0e67['where']})[_0x303f('0x10')](function(_0x3fce4f){_0x31f2b9['count']=_0x3fce4f;if(_0x4ea063['query'][_0x303f('0x41')]){_0x2e0e67[_0x303f('0x56')]=[{'all':!![]}];}return db[_0x303f('0x8a')][_0x303f('0x42')](_0x2e0e67);})[_0x303f('0x10')](function(_0x1e3c7c){if(_0x4ea063[_0x303f('0x34')][_0x303f('0x8d')]===_0x303f('0x8e')){for(var _0x4c5b1d=0x0;_0x4c5b1d<_0x1e3c7c[_0x303f('0x48')];_0x4c5b1d++){_0x1e3c7c[_0x4c5b1d][_0x303f('0x4b')]=juice(_0x1e3c7c[_0x4c5b1d]['body']);}}_0x31f2b9['rows']=_0x1e3c7c;return _0x31f2b9;});}})[_0x303f('0x10')](respondWithFilteredResult(_0x2e7520,_0x2e0e67))[_0x303f('0x19')](handleError(_0x2e7520,null));};exports[_0x303f('0x28')]=function(_0x38c7c4,_0x31bd0d){var _0x4564a3,_0x1b7434={},_0x168df5;if(_0x38c7c4['body']['to']){_0x168df5=_0x38c7c4[_0x303f('0x4b')]['to']['split'](',')[0x0];}return db[_0x303f('0x40')][_0x303f('0x49')]({'where':{'id':_0x38c7c4['params']['id']},'include':[{'model':db['CmList'],'as':_0x303f('0x8f'),'include':[{'model':db[_0x303f('0x90')],'as':_0x303f('0x91'),'where':{'email':_0x168df5},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x303f('0x10')](handleEntityNotFound(_0x31bd0d,null))[_0x303f('0x10')](function(_0x28cf11){if(_0x28cf11){_0x4564a3=_0x28cf11;if(_0x28cf11[_0x303f('0x2c')]){if(_[_0x303f('0x92')](_0x38c7c4['body'][_0x303f('0x93')])){_0x38c7c4[_0x303f('0x4b')][_0x303f('0x93')]=util[_0x303f('0x94')]('%s\x20<%s>',_0x28cf11[_0x303f('0x27')],_0x28cf11[_0x303f('0x5f')]||_0x28cf11['Smtp']['user']);}if(_0x38c7c4[_0x303f('0x4b')]['attachments']&&_0x38c7c4[_0x303f('0x4b')][_0x303f('0x95')][_0x303f('0x48')]){for(var _0x381d02=0x0;_0x381d02<_0x38c7c4[_0x303f('0x4b')]['attachments']['length'];_0x381d02+=0x1){_0x38c7c4[_0x303f('0x4b')][_0x303f('0x95')][_0x381d02]={'filename':_0x38c7c4[_0x303f('0x4b')][_0x303f('0x95')][_0x381d02][_0x303f('0x27')],'path':path[_0x303f('0x96')](config[_0x303f('0x97')],'server/files/attachments',_0x38c7c4[_0x303f('0x4b')][_0x303f('0x95')][_0x381d02][_0x303f('0x98')])};}}var _0x4ff27d={'tls':{'rejectUnauthorized':![]}};if(_[_0x303f('0x92')](_0x28cf11[_0x303f('0x2c')][_0x303f('0x99')])){if(_0x28cf11[_0x303f('0x2c')][_0x303f('0x67')]){_0x4ff27d['auth']={'user':_0x28cf11[_0x303f('0x2c')][_0x303f('0x62')],'pass':_0x28cf11[_0x303f('0x2c')][_0x303f('0x63')]};}_0x4ff27d['host']=_0x28cf11['Smtp'][_0x303f('0x65')];_0x4ff27d['port']=_0x28cf11[_0x303f('0x2c')][_0x303f('0x66')];_0x4ff27d[_0x303f('0x9a')]=_0x28cf11[_0x303f('0x2c')][_0x303f('0x9a')];}else{_0x4ff27d[_0x303f('0x99')]=_0x28cf11['Smtp'][_0x303f('0x99')];_0x4ff27d[_0x303f('0x9b')]={'user':_0x28cf11[_0x303f('0x2c')][_0x303f('0x62')],'pass':_0x28cf11[_0x303f('0x2c')]['pass']};}return respondWithRpcPromise(_0x303f('0x9c'),_0x303f('0x9d'),{'account':_0x4ff27d,'message':_0x38c7c4[_0x303f('0x4b')]});}else{throw new Error(_0x303f('0x9e'));}}})[_0x303f('0x10')](function(_0x4f4a6c){if(_0x4f4a6c){_0x1b7434=_0x4f4a6c;if(_0x4564a3[_0x303f('0x8f')]){if(_0x4564a3[_0x303f('0x8f')][_0x303f('0x91')][_0x303f('0x48')]){return _0x4564a3[_0x303f('0x8f')][_0x303f('0x91')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x38c7c4[_0x303f('0x4b')],{'firstName':_0x38c7c4[_0x303f('0x4b')]['to'],'email':_0x38c7c4[_0x303f('0x4b')]['to'],'phone':_0x38c7c4['body']['to'],'ListId':_0x4564a3[_0x303f('0x9f')]}));}}else{throw new Error(_0x303f('0x9e'));}}})['then'](function(_0x28467a){if(_0x28467a){var _0x3a4546={'UserId':_0x38c7c4['user']['id'],'ContactId':_0x28467a['id'],'MailAccountId':_0x4564a3['id'],'inReplyTo':_0x1b7434[_0x303f('0xa0')],'to':_0x38c7c4['body'][_0x303f('0x93')],'cc':_0x38c7c4[_0x303f('0x4b')]['cc'],'subject':_0x38c7c4[_0x303f('0x4b')]['subject'],'attach':_0x38c7c4['body']['attach'],'firstMsgDirection':_0x303f('0xa1'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x303f('0xa1'),'Messages':[_['merge'](_0x38c7c4[_0x303f('0x4b')],{'messageId':_0x1b7434[_0x303f('0xa0')],'sentAt':moment()[_0x303f('0x94')](_0x303f('0x8c')),'read':!![],'MailAccountId':_0x4564a3['id'],'UserId':_0x38c7c4[_0x303f('0x62')]['id'],'ContactId':_0x28467a['id']})]};if(_0x38c7c4['body'][_0x303f('0xa2')]){_0x3a4546=_[_0x303f('0x3d')](_0x3a4546,_0x38c7c4[_0x303f('0x4b')]['Interaction']);}return db[_0x303f('0x7e')]['create'](_0x3a4546,{'include':[{'model':db[_0x303f('0x8a')],'as':'Messages'}]});}})[_0x303f('0x10')](respondWithResult(_0x31bd0d,null))['catch'](handleError(_0x31bd0d,null));};exports[_0x303f('0xa3')]=function(_0xf581e6,_0x342197){return db[_0x303f('0x40')][_0x303f('0x49')]({'where':{'id':_0xf581e6[_0x303f('0x45')]['id']},'include':[{'model':db[_0x303f('0x2b')],'as':_0x303f('0x2c'),'raw':!![],'include':[{'model':db[_0x303f('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x303f('0x10')](handleEntityNotFound(_0x342197,null))['then'](function(_0x36eda4){if(!_0x36eda4[_0x303f('0x2c')])return;var _0x3f458f={'id':_0x36eda4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x36eda4[_0x303f('0x61')]!==_0x303f('0x5e')){_0x3f458f[_0x303f('0x99')]=_0x36eda4[_0x303f('0x61')];}else{_0x3f458f[_0x303f('0x65')]=_0x36eda4[_0x303f('0x2c')][_0x303f('0x65')];_0x3f458f['port']=_0x36eda4[_0x303f('0x2c')][_0x303f('0x66')];_0x3f458f[_0x303f('0x9a')]=_0x36eda4['Smtp'][_0x303f('0x9a')];}if(_0x36eda4[_0x303f('0x2c')]['authentication']){if(_0x36eda4[_0x303f('0x2c')][_0x303f('0x4d')]){_0x3f458f['auth']={'type':_0x303f('0xa5'),'user':_0x36eda4[_0x303f('0x2c')][_0x303f('0x62')],'accessToken':_0x36eda4['Smtp'][_0x303f('0xa4')][_0x303f('0xa6')]};}else{_0x3f458f[_0x303f('0x9b')]={'user':_0x36eda4[_0x303f('0x2c')][_0x303f('0x62')],'pass':_0x36eda4[_0x303f('0x2c')][_0x303f('0x63')]};}}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x3f458f});})['then'](respondWithResult(_0x342197,null))[_0x303f('0x19')](handleError(_0x342197,null));};exports[_0x303f('0x23')]=function(_0xe7cf7f,_0x18dc54){return db['MailAccount'][_0x303f('0x49')]({'where':{'id':_0xe7cf7f[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x18dc54,null))['then'](function(_0x11698e){if(_0x11698e&&_0x11698e[_0x303f('0x99')]){throw new db[(_0x303f('0xa7'))][(_0x303f('0xa8'))](_0x303f('0xa9'));}return _0x11698e;})[_0x303f('0x10')](removeEntity(_0x18dc54,null))['catch'](handleError(_0x18dc54,null));};exports[_0x303f('0xaa')]=function(_0x50148a,_0x256a97){return db[_0x303f('0x40')][_0x303f('0x49')]({'where':{'id':_0x50148a[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x256a97,null))[_0x303f('0x10')](function(_0x5794f4){if(_0x5794f4){return _0x5794f4[_0x303f('0xaa')](_0x50148a[_0x303f('0x4b')][_0x303f('0x57')],_[_0x303f('0x74')](_0x50148a['body'],['ids','id'])||{})[_0x303f('0xab')](function(_0xb30439){for(var _0x4278b6=0x0;_0x4278b6<_0x50148a['body'][_0x303f('0x57')][_0x303f('0x48')];_0x4278b6+=0x1){socket[_0x303f('0xac')](_0x303f('0xad'),{'UserId':Number(_0x50148a[_0x303f('0x4b')][_0x303f('0x57')][_0x4278b6]),'MailAccountId':Number(_0x50148a[_0x303f('0x45')]['id'])});}return _0xb30439;});}})[_0x303f('0x10')](respondWithResult(_0x256a97,null))[_0x303f('0x19')](handleError(_0x256a97,null));};exports['removeAgents']=function(_0x2d16eb,_0x25b53e){return db[_0x303f('0x40')][_0x303f('0x49')]({'where':{'id':_0x2d16eb[_0x303f('0x45')]['id']}})[_0x303f('0x10')](handleEntityNotFound(_0x25b53e,null))[_0x303f('0x10')](function(_0x4df851){if(_0x4df851){return _0x4df851[_0x303f('0xae')](_0x2d16eb[_0x303f('0x34')][_0x303f('0x57')])[_0x303f('0x10')](function(){if(_[_0x303f('0xaf')](_0x2d16eb['query']['ids'])){for(var _0x16be69=0x0;_0x16be69<_0x2d16eb[_0x303f('0x34')][_0x303f('0x57')][_0x303f('0x48')];_0x16be69+=0x1){socket['emit'](_0x303f('0xb0'),{'UserId':Number(_0x2d16eb['query'][_0x303f('0x57')][_0x16be69]),'MailAccountId':Number(_0x2d16eb['params']['id'])});}}else{socket['emit'](_0x303f('0xb0'),{'UserId':Number(_0x2d16eb['query'][_0x303f('0x57')]),'MailAccountId':Number(_0x2d16eb[_0x303f('0x45')]['id'])});}});}})[_0x303f('0x10')](respondWithStatusCode(_0x25b53e,null))['catch'](handleError(_0x25b53e,null));};exports[_0x303f('0xb1')]=function(_0xca0b63,_0x4259d0){var _0x2c551a={};var _0x3fd949={};var _0x3ffb0e;var _0x5a9945;return db['MailAccount']['findOne']({'where':{'id':_0xca0b63[_0x303f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4259d0,null))[_0x303f('0x10')](function(_0x57a310){if(_0x57a310){_0x3ffb0e=_0x57a310;_0x3fd949[_0x303f('0x38')]=_[_0x303f('0x33')](db[_0x303f('0x76')][_0x303f('0x2f')]);_0x3fd949[_0x303f('0x34')]=_[_0x303f('0x33')](_0xca0b63[_0x303f('0x34')]);_0x3fd949['filters']=_[_0x303f('0x35')](_0x3fd949['model'],_0x3fd949[_0x303f('0x34')]);_0x2c551a[_0x303f('0x36')]=_['intersection'](_0x3fd949['model'],qs['fields'](_0xca0b63[_0x303f('0x34')][_0x303f('0x37')]));_0x2c551a[_0x303f('0x36')]=_0x2c551a['attributes'][_0x303f('0x48')]?_0x2c551a[_0x303f('0x36')]:_0x3fd949[_0x303f('0x38')];_0x2c551a[_0x303f('0x5c')]=qs[_0x303f('0x3a')](_0xca0b63[_0x303f('0x34')][_0x303f('0x3a')]);_0x2c551a[_0x303f('0x3c')]=qs[_0x303f('0x3b')](_['pick'](_0xca0b63['query'],_0x3fd949['filters']));if(_0xca0b63[_0x303f('0x34')]['filter']){_0x2c551a['where']=_[_0x303f('0x3d')](_0x2c551a[_0x303f('0x3c')],{'$or':_[_0x303f('0x2e')](_0x2c551a[_0x303f('0x36')],function(_0x1d5a09){var _0x418080={};_0x418080[_0x1d5a09]={'$like':'%'+_0xca0b63['query']['filter']+'%'};return _0x418080;})});}_0x2c551a=_[_0x303f('0x3d')]({},_0x2c551a,_0xca0b63['options']);return _0x3ffb0e[_0x303f('0xb1')](_0x2c551a);}})[_0x303f('0x10')](function(_0x459016){if(_0x459016){_0x5a9945=_0x459016[_0x303f('0x48')];if(!_0xca0b63[_0x303f('0x34')][_0x303f('0x39')](_0x303f('0x54'))){_0x2c551a[_0x303f('0x20')]=qs[_0x303f('0x20')](_0xca0b63[_0x303f('0x34')][_0x303f('0x20')]);_0x2c551a['offset']=qs[_0x303f('0x1e')](_0xca0b63[_0x303f('0x34')]['offset']);}return _0x3ffb0e[_0x303f('0xb1')](_0x2c551a);}})[_0x303f('0x10')](function(_0x37bfef){if(_0x37bfef){return _0x37bfef?{'count':_0x5a9945,'rows':_0x37bfef}:null;}})[_0x303f('0x10')](respondWithResult(_0x4259d0,null))['catch'](handleError(_0x4259d0,null));}; \ No newline at end of file +var _0xcd00=['email','ListId','isNil','active','description','user','password','pass','service','host','port','authentication','username','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','true','split','CmList','Contacts','updatedAt','from','format','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','CmContact','messageId','subject','out','Interaction','Messages','CloudProvider','OAuth2','data5','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','get','MailAccounts','UserProfileResource','destroy','stack','name','send','MailServerIn','MailServerOut','Pause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','Imap','mandatoryDispositionPause','find','body','modernAuthentication','Smtp','CloudProviderId','describe','addDisposition','Disposition','getDispositions','findOne','pick','MailAccountId','rows','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','key','provider','custom'];(function(_0x33a40f,_0x55a84e){var _0x7ebcd2=function(_0x4669dd){while(--_0x4669dd){_0x33a40f['push'](_0x33a40f['shift']());}};_0x7ebcd2(++_0x55a84e);}(_0xcd00,0x1d3));var _0x0cd0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcd00[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0x0cd0('0x0'));var BPromise=require(_0x0cd0('0x1'));var util=require(_0x0cd0('0x2'));var path=require(_0x0cd0('0x3'));var _=require(_0x0cd0('0x4'));var juice=require(_0x0cd0('0x5'));var Redis=require('ioredis');var qs=require(_0x0cd0('0x6'));var logger=require(_0x0cd0('0x7'))(_0x0cd0('0x8'));var config=require(_0x0cd0('0x9'));var db=require('../../mysqldb')['db'];config[_0x0cd0('0xa')]=_[_0x0cd0('0xb')](config['redis'],{'host':_0x0cd0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cd0('0xa')]));require(_0x0cd0('0xd'))['register'](socket);var jayson=require(_0x0cd0('0xe'));var client=jayson[_0x0cd0('0xf')][_0x0cd0('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x386b5d,_0x36b10e,_0x4d9129,_0x42e33f){return new BPromise(function(_0x3bb808,_0x459935){var _0x27818c=_0x42e33f||client;return _0x27818c['request'](_0x386b5d,_0x4d9129)[_0x0cd0('0x11')](function(_0x509d90){logger[_0x0cd0('0x12')]('MailAccount,\x20%s,\x20%s',_0x36b10e,_0x0cd0('0x13'));logger[_0x0cd0('0x14')](_0x0cd0('0x15'),_0x36b10e,_0x0cd0('0x13'),JSON['stringify'](_0x509d90));if(_0x509d90[_0x0cd0('0x16')]){if(_0x509d90[_0x0cd0('0x16')][_0x0cd0('0x17')]===0x1f4){logger[_0x0cd0('0x16')](_0x0cd0('0x18'),_0x36b10e,_0x509d90[_0x0cd0('0x16')]['message']);return _0x459935(_0x509d90[_0x0cd0('0x16')]['message']);}logger['error'](_0x0cd0('0x18'),_0x36b10e,_0x509d90[_0x0cd0('0x16')][_0x0cd0('0x19')]);return _0x3bb808(_0x509d90[_0x0cd0('0x16')][_0x0cd0('0x19')]);}else{logger[_0x0cd0('0x12')](_0x0cd0('0x18'),_0x36b10e,_0x0cd0('0x13'));_0x3bb808(_0x509d90[_0x0cd0('0x1a')]['message']);}})['catch'](function(_0x237168){logger[_0x0cd0('0x16')](_0x0cd0('0x18'),_0x36b10e,_0x237168);_0x459935(_0x237168);});});}function respondWithStatusCode(_0x2d3d5d,_0x27f7b5){_0x27f7b5=_0x27f7b5||0xcc;return function(_0xf1f91d){if(_0xf1f91d){return _0x2d3d5d[_0x0cd0('0x1b')](_0x27f7b5);}return _0x2d3d5d[_0x0cd0('0x1c')](_0x27f7b5)[_0x0cd0('0x1d')]();};}function respondWithResult(_0x182ea3,_0x508f00){_0x508f00=_0x508f00||0xc8;return function(_0x1b20d0){if(_0x1b20d0){return _0x182ea3[_0x0cd0('0x1c')](_0x508f00)[_0x0cd0('0x1e')](_0x1b20d0);}};}function respondWithFilteredResult(_0x30a18b,_0x37eeae){return function(_0x6f8e1d){if(_0x6f8e1d){var _0x18f284=typeof _0x37eeae[_0x0cd0('0x1f')]==='undefined'&&typeof _0x37eeae[_0x0cd0('0x20')]===_0x0cd0('0x21');var _0x1a6084=_0x6f8e1d[_0x0cd0('0x22')];var _0x246303=_0x18f284?0x0:_0x37eeae['offset'];var _0x118e8a=_0x18f284?_0x6f8e1d[_0x0cd0('0x22')]:_0x37eeae[_0x0cd0('0x1f')]+_0x37eeae[_0x0cd0('0x20')];var _0x2731b3;if(_0x118e8a>=_0x1a6084){_0x118e8a=_0x1a6084;_0x2731b3=0xc8;}else{_0x2731b3=0xce;}_0x30a18b['status'](_0x2731b3);return _0x30a18b[_0x0cd0('0x23')](_0x0cd0('0x24'),_0x246303+'-'+_0x118e8a+'/'+_0x1a6084)[_0x0cd0('0x1e')](_0x6f8e1d);}return null;};}function saveUpdates(_0x19caa5){return function(_0x260ef3){if(_0x260ef3){return _0x260ef3[_0x0cd0('0x25')](_0x19caa5)[_0x0cd0('0x11')](function(_0x244413){return _0x244413;});}return null;};}function removeEntity(_0x2f7c6e){return function(_0x9db4e0){if(_0x9db4e0){return _0x9db4e0['destroy']()[_0x0cd0('0x11')](function(){var _0x2b5289=_0x9db4e0[_0x0cd0('0x26')]({'plain':!![]});var _0xbdb67a=_0x0cd0('0x27');return db[_0x0cd0('0x28')][_0x0cd0('0x29')]({'where':{'type':_0xbdb67a,'resourceId':_0x2b5289['id']}})[_0x0cd0('0x11')](function(){return _0x9db4e0;});})[_0x0cd0('0x11')](function(){_0x2f7c6e[_0x0cd0('0x1c')](0xcc)[_0x0cd0('0x1d')]();});}};}function handleEntityNotFound(_0x294eaf){return function(_0x538405){if(!_0x538405){_0x294eaf['sendStatus'](0x194);}return _0x538405;};}function handleError(_0x227034,_0x5a2591){_0x5a2591=_0x5a2591||0x1f4;return function(_0x1ff61f){logger['error'](_0x1ff61f[_0x0cd0('0x2a')]);if(_0x1ff61f[_0x0cd0('0x2b')]){delete _0x1ff61f[_0x0cd0('0x2b')];}_0x227034[_0x0cd0('0x1c')](_0x5a2591)[_0x0cd0('0x2c')](_0x1ff61f);};}exports['index']=function(_0x5388ff,_0xd9687c){var _0x30691a={'include':[{'model':db[_0x0cd0('0x2d')],'as':'Imap'},{'model':db[_0x0cd0('0x2e')],'as':'Smtp'},{'model':db[_0x0cd0('0x2f')],'as':'mandatoryDispositionPause'}]},_0x1e2286={},_0x578758={'count':0x0,'rows':[]};var _0x5cde77=_['map'](db[_0x0cd0('0x30')][_0x0cd0('0x31')],function(_0x33b61c){return{'name':_0x33b61c[_0x0cd0('0x32')],'type':_0x33b61c[_0x0cd0('0x33')]['key']};});_0x1e2286[_0x0cd0('0x34')]=_[_0x0cd0('0x35')](_0x5cde77,_0x0cd0('0x2b'));_0x1e2286[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x5388ff[_0x0cd0('0x36')]);_0x1e2286[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x1e2286[_0x0cd0('0x34')],_0x1e2286['query']);_0x30691a[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x1e2286[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x5388ff[_0x0cd0('0x36')]['fields']));_0x30691a[_0x0cd0('0x3a')]=_0x30691a['attributes'][_0x0cd0('0x3c')]?_0x30691a['attributes']:_0x1e2286[_0x0cd0('0x34')];if(!_0x5388ff[_0x0cd0('0x36')][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x30691a['limit']=qs['limit'](_0x5388ff['query']['limit']);_0x30691a[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x5388ff['query']['offset']);}_0x30691a[_0x0cd0('0x3f')]=qs['sort'](_0x5388ff[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x30691a[_0x0cd0('0x41')]=qs['filters'](_['pick'](_0x5388ff[_0x0cd0('0x36')],_0x1e2286['filters']),_0x5cde77);if(_0x5388ff[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x30691a[_0x0cd0('0x41')]=_['merge'](_0x30691a[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x5cde77,function(_0x55d2f7){if(_0x55d2f7[_0x0cd0('0x33')]!=='VIRTUAL'){var _0x4f5366={};_0x4f5366[_0x55d2f7[_0x0cd0('0x2b')]]={'$like':'%'+_0x5388ff['query']['filter']+'%'};return _0x4f5366;}})});}_0x30691a=_[_0x0cd0('0x43')]({},_0x30691a,_0x5388ff[_0x0cd0('0x44')]);var _0x3bbe19={'where':_0x30691a['where']};return db['MailAccount']['count'](_0x3bbe19)[_0x0cd0('0x11')](function(_0x532bb7){_0x578758[_0x0cd0('0x22')]=_0x532bb7;if(_0x5388ff['query'][_0x0cd0('0x45')]){_0x30691a[_0x0cd0('0x46')]=[{'all':!![]}];}return db[_0x0cd0('0x30')][_0x0cd0('0x47')](_0x30691a);})['then'](function(_0x19493c){_0x578758['rows']=_0x19493c;return _0x578758;})[_0x0cd0('0x11')](respondWithFilteredResult(_0xd9687c,_0x30691a))[_0x0cd0('0x48')](handleError(_0xd9687c,null));};exports[_0x0cd0('0x49')]=function(_0xc5233d,_0x47291f){var _0xfa86c9={'raw':![],'where':{'id':_0xc5233d[_0x0cd0('0x4a')]['id']},'include':[{'model':db[_0x0cd0('0x2d')],'as':_0x0cd0('0x4b')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x0cd0('0x2f')],'as':_0x0cd0('0x4c')}]},_0x500806={};_0x500806[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db['MailAccount'][_0x0cd0('0x31')]);_0x500806[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0xc5233d['query']);_0x500806[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x500806[_0x0cd0('0x34')],_0x500806[_0x0cd0('0x36')]);_0xfa86c9[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x500806[_0x0cd0('0x34')],qs['fields'](_0xc5233d[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0xfa86c9[_0x0cd0('0x3a')]=_0xfa86c9[_0x0cd0('0x3a')]['length']?_0xfa86c9[_0x0cd0('0x3a')]:_0x500806['model'];if(_0xc5233d['query'][_0x0cd0('0x45')]){_0xfa86c9['include']=[{'all':!![]}];}_0xfa86c9=_[_0x0cd0('0x43')]({},_0xfa86c9,_0xc5233d['options']);return db[_0x0cd0('0x30')][_0x0cd0('0x4d')](_0xfa86c9)[_0x0cd0('0x11')](handleEntityNotFound(_0x47291f,null))[_0x0cd0('0x11')](respondWithResult(_0x47291f,null))['catch'](handleError(_0x47291f,null));};exports[_0x0cd0('0x25')]=function(_0x396d1d,_0x318546){if(_0x396d1d[_0x0cd0('0x4e')]['id']){delete _0x396d1d[_0x0cd0('0x4e')]['id'];}if(_0x396d1d['body'][_0x0cd0('0x4b')]){if(!_0x396d1d['body'][_0x0cd0('0x4b')][_0x0cd0('0x4f')]){_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x4b')]['CloudProviderId']=null;}}if(_0x396d1d['body'][_0x0cd0('0x50')]){if(!_0x396d1d[_0x0cd0('0x4e')]['Smtp'][_0x0cd0('0x4f')]){_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x50')][_0x0cd0('0x51')]=null;}}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x396d1d['params']['id']},'include':[{'model':db[_0x0cd0('0x2d')],'as':_0x0cd0('0x4b')},{'model':db[_0x0cd0('0x2e')],'as':'Smtp'},{'model':db[_0x0cd0('0x2f')],'as':_0x0cd0('0x4c')}]})['then'](handleEntityNotFound(_0x318546,null))[_0x0cd0('0x11')](saveUpdates(_0x396d1d['body'],null))[_0x0cd0('0x11')](function(_0x137fde){if(_0x137fde&&_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x4b')]){return db[_0x0cd0('0x2d')][_0x0cd0('0x25')](_0x396d1d[_0x0cd0('0x4e')][_0x0cd0('0x4b')],{'where':{'MailAccountId':_0x137fde['id']}})[_0x0cd0('0x11')](function(){return _0x137fde;});}return _0x137fde;})['then'](function(_0x5a766f){if(_0x5a766f&&_0x396d1d['body'][_0x0cd0('0x50')]){return db[_0x0cd0('0x2e')][_0x0cd0('0x25')](_0x396d1d['body']['Smtp'],{'where':{'MailAccountId':_0x5a766f['id']}})[_0x0cd0('0x11')](function(){return _0x5a766f;});}return _0x5a766f;})[_0x0cd0('0x11')](respondWithResult(_0x318546,null))[_0x0cd0('0x48')](handleError(_0x318546,null));};exports[_0x0cd0('0x52')]=function(_0x5d4885,_0x1ead78){return db[_0x0cd0('0x30')]['describe']()[_0x0cd0('0x11')](respondWithResult(_0x1ead78,null))[_0x0cd0('0x48')](handleError(_0x1ead78,null));};exports[_0x0cd0('0x53')]=function(_0x6b4c20,_0x32fd41){if(_0x6b4c20['body']['id']){delete _0x6b4c20['body']['id'];}return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x6b4c20['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x32fd41,null))[_0x0cd0('0x11')](function(_0x29398c){if(_0x29398c){_0x6b4c20[_0x0cd0('0x4e')]['MailAccountId']=_0x29398c['id'];return db[_0x0cd0('0x54')]['create'](_0x6b4c20[_0x0cd0('0x4e')]);}})[_0x0cd0('0x11')](respondWithResult(_0x32fd41,null))[_0x0cd0('0x48')](handleError(_0x32fd41,null));};exports[_0x0cd0('0x55')]=function(_0x370047,_0x83e309){var _0x563fc5={'raw':![],'where':{}};var _0x5e20e4={};var _0x424bca={'count':0x0,'rows':[]};return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x370047[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x83e309,null))[_0x0cd0('0x11')](function(_0x416eaf){if(_0x416eaf){_0x5e20e4[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x54')][_0x0cd0('0x31')]);_0x5e20e4['query']=_[_0x0cd0('0x37')](_0x370047[_0x0cd0('0x36')]);_0x5e20e4[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x5e20e4[_0x0cd0('0x34')],_0x5e20e4['query']);_0x563fc5[_0x0cd0('0x3a')]=_['intersection'](_0x5e20e4[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x370047['query'][_0x0cd0('0x3b')]));_0x563fc5[_0x0cd0('0x3a')]=_0x563fc5[_0x0cd0('0x3a')][_0x0cd0('0x3c')]?_0x563fc5[_0x0cd0('0x3a')]:_0x5e20e4[_0x0cd0('0x34')];if(!_0x370047[_0x0cd0('0x36')]['hasOwnProperty']('nolimit')){_0x563fc5[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x370047[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x563fc5[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x370047[_0x0cd0('0x36')]['offset']);}_0x563fc5[_0x0cd0('0x3f')]=qs['sort'](_0x370047[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x563fc5[_0x0cd0('0x41')]=qs['filters'](_[_0x0cd0('0x57')](_0x370047[_0x0cd0('0x36')],_0x5e20e4['filters']));_0x563fc5[_0x0cd0('0x41')][_0x0cd0('0x58')]=_0x416eaf['id'];if(_0x370047[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x563fc5[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x563fc5['where'],{'$or':_['map'](_0x563fc5[_0x0cd0('0x3a')],function(_0x5df713){var _0x525f72={};_0x525f72[_0x5df713]={'$like':'%'+_0x370047[_0x0cd0('0x36')][_0x0cd0('0x42')]+'%'};return _0x525f72;})});}_0x563fc5=_[_0x0cd0('0x43')]({},_0x563fc5,_0x370047[_0x0cd0('0x44')]);return db['Disposition'][_0x0cd0('0x22')]({'where':_0x563fc5[_0x0cd0('0x41')]})[_0x0cd0('0x11')](function(_0x78310e){_0x424bca[_0x0cd0('0x22')]=_0x78310e;if(_0x370047[_0x0cd0('0x36')][_0x0cd0('0x45')]){_0x563fc5['include']=[{'all':!![]}];}return db[_0x0cd0('0x54')][_0x0cd0('0x47')](_0x563fc5);})[_0x0cd0('0x11')](function(_0x238726){_0x424bca[_0x0cd0('0x59')]=_0x238726;return _0x424bca;});}})['then'](respondWithFilteredResult(_0x83e309,_0x563fc5))['catch'](handleError(_0x83e309,null));};exports[_0x0cd0('0x5a')]=function(_0x192abb,_0x31f4fc){return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x192abb['params']['id']}})['then'](handleEntityNotFound(_0x31f4fc,null))[_0x0cd0('0x11')](function(_0xb915ef){if(_0xb915ef){return _0xb915ef[_0x0cd0('0x5a')](_0x192abb[_0x0cd0('0x36')][_0x0cd0('0x5b')]);}})[_0x0cd0('0x11')](respondWithStatusCode(_0x31f4fc,null))[_0x0cd0('0x48')](handleError(_0x31f4fc,null));};exports[_0x0cd0('0x5c')]=function(_0x56a5ee,_0x558948){if(_0x56a5ee[_0x0cd0('0x4e')]['id']){delete _0x56a5ee[_0x0cd0('0x4e')]['id'];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x56a5ee[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x558948,null))[_0x0cd0('0x11')](function(_0x26eb1d){if(_0x26eb1d){_0x56a5ee[_0x0cd0('0x4e')][_0x0cd0('0x58')]=_0x26eb1d['id'];return db['CannedAnswer'][_0x0cd0('0x5d')](_0x56a5ee[_0x0cd0('0x4e')]);}})[_0x0cd0('0x11')](respondWithResult(_0x558948,null))[_0x0cd0('0x48')](handleError(_0x558948,null));};exports[_0x0cd0('0x5e')]=function(_0x400572,_0x25c929){var _0x5c5cd7={'raw':![],'where':{}};var _0x4ae2ea={};var _0x1ecbe6={'count':0x0,'rows':[]};return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x400572[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x25c929,null))[_0x0cd0('0x11')](function(_0x28068b){if(_0x28068b){_0x4ae2ea['model']=_[_0x0cd0('0x37')](db[_0x0cd0('0x5f')][_0x0cd0('0x31')]);_0x4ae2ea[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x400572[_0x0cd0('0x36')]);_0x4ae2ea[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x4ae2ea[_0x0cd0('0x34')],_0x4ae2ea[_0x0cd0('0x36')]);_0x5c5cd7['attributes']=_[_0x0cd0('0x39')](_0x4ae2ea[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x400572[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x5c5cd7['attributes']=_0x5c5cd7['attributes'][_0x0cd0('0x3c')]?_0x5c5cd7[_0x0cd0('0x3a')]:_0x4ae2ea[_0x0cd0('0x34')];if(!_0x400572['query'][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x5c5cd7[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x400572[_0x0cd0('0x36')]['limit']);_0x5c5cd7['offset']=qs[_0x0cd0('0x1f')](_0x400572[_0x0cd0('0x36')][_0x0cd0('0x1f')]);}_0x5c5cd7[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x400572['query'][_0x0cd0('0x40')]);_0x5c5cd7['where']=qs[_0x0cd0('0x38')](_[_0x0cd0('0x57')](_0x400572[_0x0cd0('0x36')],_0x4ae2ea[_0x0cd0('0x38')]));_0x5c5cd7[_0x0cd0('0x41')][_0x0cd0('0x58')]=_0x28068b['id'];if(_0x400572[_0x0cd0('0x36')]['filter']){_0x5c5cd7[_0x0cd0('0x41')]=_['merge'](_0x5c5cd7[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x5c5cd7[_0x0cd0('0x3a')],function(_0x1559f1){var _0x142b87={};_0x142b87[_0x1559f1]={'$like':'%'+_0x400572[_0x0cd0('0x36')][_0x0cd0('0x42')]+'%'};return _0x142b87;})});}_0x5c5cd7=_[_0x0cd0('0x43')]({},_0x5c5cd7,_0x400572[_0x0cd0('0x44')]);return db[_0x0cd0('0x5f')][_0x0cd0('0x22')]({'where':_0x5c5cd7[_0x0cd0('0x41')]})[_0x0cd0('0x11')](function(_0x7cfbf0){_0x1ecbe6[_0x0cd0('0x22')]=_0x7cfbf0;if(_0x400572['query']['includeAll']){_0x5c5cd7[_0x0cd0('0x46')]=[{'all':!![]}];}return db[_0x0cd0('0x5f')][_0x0cd0('0x47')](_0x5c5cd7);})[_0x0cd0('0x11')](function(_0x57bf92){_0x1ecbe6['rows']=_0x57bf92;return _0x1ecbe6;});}})[_0x0cd0('0x11')](respondWithFilteredResult(_0x25c929,_0x5c5cd7))['catch'](handleError(_0x25c929,null));};exports[_0x0cd0('0x60')]=function(_0x209df3,_0x2e9d9e){return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x209df3['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2e9d9e,null))[_0x0cd0('0x11')](function(_0x13c451){if(_0x13c451){return _0x13c451['removeAnswers'](_0x209df3[_0x0cd0('0x36')][_0x0cd0('0x5b')]);}})['then'](respondWithStatusCode(_0x2e9d9e,null))['catch'](handleError(_0x2e9d9e,null));};exports[_0x0cd0('0x5d')]=function(_0x2bd78c,_0x3a2a92){var _0xe599b9={'name':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x2b')],'key':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x61')],'provider':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x62')]===_0x0cd0('0x63')?null:_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x62')],'email':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x64')],'ListId':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x65')],'active':!_[_0x0cd0('0x66')](_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x67')])?_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x67')]:!![],'description':_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x68')]||null,'Imap':{},'Smtp':{}};if(_0xe599b9[_0x0cd0('0x62')]){_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x69')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x69')]=_0x2bd78c[_0x0cd0('0x4e')]['username'];_0xe599b9['Imap'][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')]['pass']=_0x2bd78c['body']['password'];if(_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x4f')]){_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x4f')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x4f')]=!![];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x51')]=_0xe599b9[_0x0cd0('0x50')]['CloudProviderId']=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x51')];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x6b')]=null;}else{_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x51')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x51')]=null;}_0xe599b9['Imap'][_0x0cd0('0x6c')]=_0xe599b9['Smtp'][_0x0cd0('0x6c')]=null;_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6d')]=_0xe599b9[_0x0cd0('0x50')]['host']=null;_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6e')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x6e')]=null;}else{if(_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x6f')]){_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x69')]=_0xe599b9['Smtp'][_0x0cd0('0x69')]=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x70')];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x6b')]=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x6a')];}else{_0xe599b9[_0x0cd0('0x4b')]['authentication']=_0xe599b9['Smtp'][_0x0cd0('0x6f')]=![];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x69')]=_0xe599b9[_0x0cd0('0x50')][_0x0cd0('0x69')]=null;_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6a')]=_0xe599b9[_0x0cd0('0x50')]['pass']=null;}_0xe599b9[_0x0cd0('0x4b')]['host']=_0x2bd78c['body']['Imap'][_0x0cd0('0x6d')];_0xe599b9[_0x0cd0('0x4b')][_0x0cd0('0x6e')]=_0x2bd78c[_0x0cd0('0x4e')][_0x0cd0('0x4b')]['port'];_0xe599b9[_0x0cd0('0x50')]['host']=_0x2bd78c['body'][_0x0cd0('0x50')][_0x0cd0('0x6d')];_0xe599b9['Smtp'][_0x0cd0('0x6e')]=_0x2bd78c['body'][_0x0cd0('0x50')]['port'];}return db[_0x0cd0('0x30')][_0x0cd0('0x5d')](_0xe599b9,{'include':[{'model':db[_0x0cd0('0x2e')],'as':'Smtp'},{'model':db[_0x0cd0('0x2d')],'as':_0x0cd0('0x4b')}]})[_0x0cd0('0x11')](function(_0x416a15){var _0x34794e=_0x2bd78c['user'][_0x0cd0('0x26')]({'plain':!![]});if(!_0x34794e)throw new Error(_0x0cd0('0x71'));if(_0x34794e[_0x0cd0('0x72')]===_0x0cd0('0x69')){var _0x39e091=_0x416a15[_0x0cd0('0x26')]({'plain':!![]});return db[_0x0cd0('0x73')][_0x0cd0('0x4d')]({'where':{'name':'MailAccounts','userProfileId':_0x34794e['userProfileId']},'raw':!![]})[_0x0cd0('0x11')](function(_0xd8129e){if(_0xd8129e&&_0xd8129e[_0x0cd0('0x74')]===0x0){return db['UserProfileResource'][_0x0cd0('0x5d')]({'name':_0x39e091['name'],'resourceId':_0x39e091['id'],'type':_0xd8129e[_0x0cd0('0x2b')],'sectionId':_0xd8129e['id']},{})[_0x0cd0('0x11')](function(){return _0x416a15;});}else{return _0x416a15;}})[_0x0cd0('0x48')](function(_0x5b175b){logger[_0x0cd0('0x16')](_0x0cd0('0x75'),_0x5b175b);throw _0x5b175b;});}return _0x416a15;})[_0x0cd0('0x11')](respondWithResult(_0x3a2a92,0xc9))[_0x0cd0('0x48')](handleError(_0x3a2a92,null));};exports['getImap']=function(_0x49342f,_0xc819b4){return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x49342f[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0xc819b4,null))[_0x0cd0('0x11')](function(_0x2db46b){if(_0x2db46b){return _0x2db46b['getImap']();}return null;})['then'](respondWithResult(_0xc819b4,null))[_0x0cd0('0x48')](handleError(_0xc819b4,null));};exports[_0x0cd0('0x76')]=function(_0x2d34de,_0x244e82){if(_0x2d34de[_0x0cd0('0x4e')]['id']){delete _0x2d34de['body']['id'];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x2d34de[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x244e82,null))['then'](function(_0x36d733){if(_0x36d733){_0x2d34de[_0x0cd0('0x4e')]['MailAccountId']=_0x36d733['id'];return db[_0x0cd0('0x2d')][_0x0cd0('0x5d')](_0x2d34de['body']);}})[_0x0cd0('0x11')](respondWithResult(_0x244e82,null))['catch'](handleError(_0x244e82,null));};exports[_0x0cd0('0x77')]=function(_0x507d70,_0x2bb321){return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x507d70['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2bb321,null))[_0x0cd0('0x11')](function(_0x4fd0dc){if(_0x4fd0dc){return _0x4fd0dc[_0x0cd0('0x78')](null);}return null;})[_0x0cd0('0x11')](respondWithStatusCode(_0x2bb321,null))[_0x0cd0('0x48')](handleError(_0x2bb321,null));};exports[_0x0cd0('0x79')]=function(_0x488a26,_0x443551){return db[_0x0cd0('0x30')]['findOne']({'where':{'id':_0x488a26['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x443551,null))[_0x0cd0('0x11')](function(_0x336835){if(_0x336835){return _0x336835[_0x0cd0('0x79')]();}return null;})[_0x0cd0('0x11')](respondWithResult(_0x443551,null))[_0x0cd0('0x48')](handleError(_0x443551,null));};exports[_0x0cd0('0x7a')]=function(_0x2ed04,_0x62882d){if(_0x2ed04[_0x0cd0('0x4e')]['id']){delete _0x2ed04[_0x0cd0('0x4e')]['id'];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x2ed04[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x62882d,null))[_0x0cd0('0x11')](function(_0x168346){if(_0x168346){_0x2ed04[_0x0cd0('0x4e')][_0x0cd0('0x58')]=_0x168346['id'];return db[_0x0cd0('0x2e')][_0x0cd0('0x5d')](_0x2ed04[_0x0cd0('0x4e')]);}})[_0x0cd0('0x11')](respondWithResult(_0x62882d,null))['catch'](handleError(_0x62882d,null));};exports[_0x0cd0('0x7b')]=function(_0xa85ccb,_0x1d6e63){return db[_0x0cd0('0x30')]['findOne']({'where':{'id':_0xa85ccb['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x1d6e63,null))[_0x0cd0('0x11')](function(_0x1216db){if(_0x1216db){return _0x1216db[_0x0cd0('0x7c')](null);}return null;})['then'](respondWithStatusCode(_0x1d6e63,null))['catch'](handleError(_0x1d6e63,null));};exports[_0x0cd0('0x7d')]=function(_0x41dd05,_0x4e3be5){return db[_0x0cd0('0x7e')][_0x0cd0('0x4d')]({'where':{'id':_0x41dd05[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x4e3be5,null))['then'](function(_0x3eecc1){if(_0x3eecc1){return _0x3eecc1[_0x0cd0('0x7d')](_0x41dd05[_0x0cd0('0x4e')][_0x0cd0('0x5b')],_[_0x0cd0('0x7f')](_0x41dd05[_0x0cd0('0x4e')],['ids','id'])||{});}})['then'](respondWithResult(_0x4e3be5,null))[_0x0cd0('0x48')](handleError(_0x4e3be5,null));};exports[_0x0cd0('0x80')]=function(_0x58d8e3,_0x38c06e){var _0x138155={'raw':![],'where':{}};var _0x14c212={};var _0x11edbb={'count':0x0,'rows':[]};return db['MailAccount'][_0x0cd0('0x56')]({'where':{'id':_0x58d8e3[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38c06e,null))[_0x0cd0('0x11')](function(_0x2f65eb){if(_0x2f65eb){_0x14c212[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x7e')][_0x0cd0('0x31')]);_0x14c212['query']=_['keys'](_0x58d8e3['query']);_0x14c212[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x14c212[_0x0cd0('0x34')],_0x14c212[_0x0cd0('0x36')]);_0x138155[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x14c212[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x138155[_0x0cd0('0x3a')]=_0x138155[_0x0cd0('0x3a')]['length']?_0x138155[_0x0cd0('0x3a')]:_0x14c212[_0x0cd0('0x34')];if(!_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x138155[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x58d8e3['query']['limit']);_0x138155[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x1f')]);}_0x138155['order']=qs[_0x0cd0('0x40')](_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x138155[_0x0cd0('0x41')]=qs[_0x0cd0('0x38')](_['pick'](_0x58d8e3[_0x0cd0('0x36')],_0x14c212[_0x0cd0('0x38')]));_0x138155['where'][_0x0cd0('0x58')]=_0x2f65eb['id'];if(_0x58d8e3[_0x0cd0('0x36')]['filter']){_0x138155[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x138155[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x138155['attributes'],function(_0x5c47bf){var _0x2f94b3={};_0x2f94b3[_0x5c47bf]={'$like':'%'+_0x58d8e3[_0x0cd0('0x36')]['filter']+'%'};return _0x2f94b3;})});}_0x138155=_[_0x0cd0('0x43')]({},_0x138155,_0x58d8e3[_0x0cd0('0x44')]);return db[_0x0cd0('0x7e')]['count']({'where':_0x138155[_0x0cd0('0x41')]})[_0x0cd0('0x11')](function(_0x43d979){_0x11edbb[_0x0cd0('0x22')]=_0x43d979;if(_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x45')]){_0x138155[_0x0cd0('0x46')]=[{'model':db['CmContact'],'as':_0x0cd0('0x81'),'required':![]},{'model':db[_0x0cd0('0x82')],'as':_0x0cd0('0x83'),'attributes':['name',_0x0cd0('0x84'),_0x0cd0('0x85')],'required':![]},{'model':db['Tag'],'as':_0x0cd0('0x86'),'attributes':['id',_0x0cd0('0x2b'),_0x0cd0('0x87')],'where':_0x58d8e3['query'][_0x0cd0('0x88')]?{'id':_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x88')]}:undefined,'required':_0x58d8e3[_0x0cd0('0x36')][_0x0cd0('0x88')]?!![]:![]}];}return db[_0x0cd0('0x7e')][_0x0cd0('0x47')](_0x138155);})['then'](function(_0x10c12f){_0x11edbb[_0x0cd0('0x59')]=_0x10c12f;return _0x11edbb;});}})[_0x0cd0('0x11')](respondWithFilteredResult(_0x38c06e,_0x138155))[_0x0cd0('0x48')](handleError(_0x38c06e,null));};exports[_0x0cd0('0x89')]=function addApplications(_0x34d534,_0x41a466){var _0x1addd7=_0x34d534['params']['id'];var _0x57f312=_0x34d534[_0x0cd0('0x4e')];var _0x27d97d=0xc8;var _0x279ca0=null;return db['sequelize'][_0x0cd0('0x8a')]({'isolationLevel':db[_0x0cd0('0x8b')][_0x0cd0('0x8c')]['ISOLATION_LEVELS'][_0x0cd0('0x8d')]},function(_0x3f3fa7){return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x1addd7},'transaction':_0x3f3fa7})[_0x0cd0('0x11')](function(_0x75b272){if(_0x75b272){return db[_0x0cd0('0x8e')][_0x0cd0('0x29')]({'where':{'MailAccountId':_0x1addd7},'transaction':_0x3f3fa7})[_0x0cd0('0x11')](function(){var _0x150c44=_[_0x0cd0('0x35')](_0x57f312,function(_0x2a83d9){_0x2a83d9[_0x0cd0('0x58')]=_0x1addd7;return _0x2a83d9;});return db[_0x0cd0('0x8e')][_0x0cd0('0x8f')](_0x150c44,{'transaction':_0x3f3fa7});});}else{_0x27d97d=0x194;_0x279ca0=[];}});})['then'](function(){if(_0x27d97d!==0x194){return db[_0x0cd0('0x8e')][_0x0cd0('0x90')]({'where':{'MailAccountId':_0x1addd7},'order':_0x0cd0('0x91')})[_0x0cd0('0x11')](function(_0x5b4163){_0x279ca0=_0x5b4163;});}})['catch'](function(_0x42ab22){_0x27d97d=0x1f4;logger['error'](_0x42ab22[_0x0cd0('0x2a')]);if(_0x42ab22['name']){delete _0x42ab22[_0x0cd0('0x2b')];}_0x279ca0=_0x42ab22;})[_0x0cd0('0x92')](function(){if(_0x279ca0===null){_0x41a466[_0x0cd0('0x1b')](_0x27d97d);}else{if(_0x27d97d===0x1f4){_0x41a466[_0x0cd0('0x1c')](_0x27d97d)[_0x0cd0('0x2c')](_0x279ca0);}else{_0x41a466[_0x0cd0('0x1c')](_0x27d97d)[_0x0cd0('0x1e')](_0x279ca0);}}});};exports[_0x0cd0('0x93')]=function(_0x259d9b,_0x3237b6){var _0x1df975={};var _0x347117={};var _0x575a9f;var _0x19bc53;return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x259d9b['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x3237b6,null))['then'](function(_0x524446){if(_0x524446){_0x575a9f=_0x524446;_0x347117[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x8e')]['rawAttributes']);_0x347117['query']=_[_0x0cd0('0x37')](_0x259d9b['query']);_0x347117[_0x0cd0('0x38')]=_['intersection'](_0x347117[_0x0cd0('0x34')],_0x347117[_0x0cd0('0x36')]);_0x1df975['attributes']=_[_0x0cd0('0x39')](_0x347117[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x1df975[_0x0cd0('0x3a')]=_0x1df975[_0x0cd0('0x3a')][_0x0cd0('0x3c')]?_0x1df975[_0x0cd0('0x3a')]:_0x347117['model'];_0x1df975[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x1df975['where']=qs[_0x0cd0('0x38')](_[_0x0cd0('0x57')](_0x259d9b[_0x0cd0('0x36')],_0x347117['filters']));if(_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x1df975[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x1df975[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x1df975['attributes'],function(_0x245ed8){var _0x3e6cfb={};_0x3e6cfb[_0x245ed8]={'$like':'%'+_0x259d9b['query'][_0x0cd0('0x42')]+'%'};return _0x3e6cfb;})});}_0x1df975=_[_0x0cd0('0x43')]({},_0x1df975,_0x259d9b['options']);return _0x575a9f[_0x0cd0('0x93')](_0x1df975);}})[_0x0cd0('0x11')](function(_0x1ba3af){if(_0x1ba3af){_0x19bc53=_0x1ba3af[_0x0cd0('0x3c')];if(!_0x259d9b[_0x0cd0('0x36')]['hasOwnProperty'](_0x0cd0('0x3e'))){_0x1df975[_0x0cd0('0x20')]=qs['limit'](_0x259d9b[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x1df975[_0x0cd0('0x1f')]=qs['offset'](_0x259d9b['query']['offset']);}return _0x575a9f[_0x0cd0('0x93')](_0x1df975);}})[_0x0cd0('0x11')](function(_0x344954){if(_0x344954){return _0x344954?{'count':_0x19bc53,'rows':_0x344954}:null;}})['then'](respondWithResult(_0x3237b6,null))[_0x0cd0('0x48')](handleError(_0x3237b6,null));};exports[_0x0cd0('0x94')]=function(_0x275994,_0x357054){var _0x4fd0ca={'raw':!![],'where':{}};var _0x463bfd={};var _0x476fc5={'count':0x0,'rows':[]};return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x275994[_0x0cd0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x357054,null))[_0x0cd0('0x11')](function(_0x4f15d1){if(_0x4f15d1){_0x463bfd[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x95')][_0x0cd0('0x31')]);_0x463bfd[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x275994['query']);_0x463bfd[_0x0cd0('0x38')]=_[_0x0cd0('0x39')](_0x463bfd[_0x0cd0('0x34')],_0x463bfd[_0x0cd0('0x36')]);_0x4fd0ca[_0x0cd0('0x3a')]=_[_0x0cd0('0x39')](_0x463bfd[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x275994[_0x0cd0('0x36')]['fields']));_0x4fd0ca[_0x0cd0('0x3a')]=_0x4fd0ca[_0x0cd0('0x3a')][_0x0cd0('0x3c')]?_0x4fd0ca[_0x0cd0('0x3a')]:_0x463bfd[_0x0cd0('0x34')];if(!_0x275994[_0x0cd0('0x36')][_0x0cd0('0x3d')]('nolimit')){_0x4fd0ca[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x275994[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x4fd0ca[_0x0cd0('0x1f')]=qs[_0x0cd0('0x1f')](_0x275994[_0x0cd0('0x36')]['offset']);}_0x4fd0ca[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x275994[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x4fd0ca[_0x0cd0('0x41')]=qs[_0x0cd0('0x38')](_[_0x0cd0('0x57')](_0x275994[_0x0cd0('0x36')],_0x463bfd[_0x0cd0('0x38')]));_0x4fd0ca[_0x0cd0('0x41')][_0x0cd0('0x58')]=_0x4f15d1['id'];if(_0x275994[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x4fd0ca[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x4fd0ca[_0x0cd0('0x41')],{'$or':_['map'](_0x4fd0ca[_0x0cd0('0x3a')],function(_0x1e122f){var _0x4158c6={};_0x4158c6[_0x1e122f]={'$like':'%'+_0x275994['query']['filter']+'%'};return _0x4158c6;})});}if(_0x275994[_0x0cd0('0x36')][_0x0cd0('0x96')]){var _0x5b5fff=_0x275994[_0x0cd0('0x36')][_0x0cd0('0x96')]['split'](',');var _0x28bc70={};_0x28bc70[_0x5b5fff[0x0]]={'$gte':moment(_0x5b5fff[0x1])['format'](_0x0cd0('0x97'))};_0x4fd0ca[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x4fd0ca[_0x0cd0('0x41')],_0x28bc70);}_0x4fd0ca=_[_0x0cd0('0x43')]({},_0x4fd0ca,_0x275994['options']);return db[_0x0cd0('0x95')][_0x0cd0('0x22')]({'where':_0x4fd0ca['where']})[_0x0cd0('0x11')](function(_0x3beb5e){_0x476fc5[_0x0cd0('0x22')]=_0x3beb5e;if(_0x275994[_0x0cd0('0x36')][_0x0cd0('0x45')]){_0x4fd0ca[_0x0cd0('0x46')]=[{'all':!![]}];}return db[_0x0cd0('0x95')][_0x0cd0('0x47')](_0x4fd0ca);})[_0x0cd0('0x11')](function(_0x5ae6a8){if(_0x275994[_0x0cd0('0x36')]['inlineCss']===_0x0cd0('0x98')){for(var _0x107503=0x0;_0x107503<_0x5ae6a8[_0x0cd0('0x3c')];_0x107503++){_0x5ae6a8[_0x107503][_0x0cd0('0x4e')]=juice(_0x5ae6a8[_0x107503][_0x0cd0('0x4e')]);}}_0x476fc5['rows']=_0x5ae6a8;return _0x476fc5;});}})['then'](respondWithFilteredResult(_0x357054,_0x4fd0ca))[_0x0cd0('0x48')](handleError(_0x357054,null));};exports['send']=function(_0x3fd06a,_0x248584){var _0x48d682,_0x18fbbd={},_0x40d610;if(_0x3fd06a['body']['to']){_0x40d610=_0x3fd06a[_0x0cd0('0x4e')]['to'][_0x0cd0('0x99')](',')[0x0];}return db[_0x0cd0('0x30')][_0x0cd0('0x4d')]({'where':{'id':_0x3fd06a[_0x0cd0('0x4a')]['id']},'include':[{'model':db[_0x0cd0('0x9a')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0cd0('0x9b'),'where':{'email':_0x40d610},'limit':0x1,'order':[[_0x0cd0('0x9c'),'DESC']]}]},{'model':db[_0x0cd0('0x2e')],'as':_0x0cd0('0x50'),'raw':!![]}]})[_0x0cd0('0x11')](handleEntityNotFound(_0x248584,null))[_0x0cd0('0x11')](function(_0x4f9f15){if(_0x4f9f15){_0x48d682=_0x4f9f15;if(_0x4f9f15[_0x0cd0('0x50')]){if(_[_0x0cd0('0x66')](_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9d')])){_0x3fd06a['body'][_0x0cd0('0x9d')]=util[_0x0cd0('0x9e')]('%s\x20<%s>',_0x4f9f15[_0x0cd0('0x2b')],_0x4f9f15[_0x0cd0('0x64')]||_0x4f9f15['Smtp'][_0x0cd0('0x69')]);}if(_0x3fd06a[_0x0cd0('0x4e')]['attachments']&&_0x3fd06a['body'][_0x0cd0('0x9f')][_0x0cd0('0x3c')]){for(var _0x424a87=0x0;_0x424a87<_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9f')][_0x0cd0('0x3c')];_0x424a87+=0x1){_0x3fd06a['body'][_0x0cd0('0x9f')][_0x424a87]={'filename':_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9f')][_0x424a87][_0x0cd0('0x2b')],'path':path[_0x0cd0('0xa0')](config[_0x0cd0('0xa1')],_0x0cd0('0xa2'),_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9f')][_0x424a87][_0x0cd0('0xa3')])};}}var _0x51cebe={'tls':{'rejectUnauthorized':![]}};if(_[_0x0cd0('0x66')](_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0x6c')])){if(_0x4f9f15['Smtp']['authentication']){_0x51cebe[_0x0cd0('0xa4')]={'user':_0x4f9f15['Smtp'][_0x0cd0('0x69')],'pass':_0x4f9f15[_0x0cd0('0x50')]['pass']};}_0x51cebe[_0x0cd0('0x6d')]=_0x4f9f15[_0x0cd0('0x50')]['host'];_0x51cebe[_0x0cd0('0x6e')]=_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0x6e')];_0x51cebe[_0x0cd0('0xa5')]=_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0xa5')];}else{_0x51cebe['service']=_0x4f9f15['Smtp'][_0x0cd0('0x6c')];_0x51cebe[_0x0cd0('0xa4')]={'user':_0x4f9f15[_0x0cd0('0x50')][_0x0cd0('0x69')],'pass':_0x4f9f15[_0x0cd0('0x50')]['pass']};}return respondWithRpcPromise(_0x0cd0('0xa6'),_0x0cd0('0xa7'),{'account':_0x51cebe,'message':_0x3fd06a['body']});}else{throw new Error(_0x0cd0('0xa8'));}}})[_0x0cd0('0x11')](function(_0x174d63){if(_0x174d63){_0x18fbbd=_0x174d63;if(_0x48d682[_0x0cd0('0xa9')]){if(_0x48d682[_0x0cd0('0xa9')][_0x0cd0('0x9b')][_0x0cd0('0x3c')]){return _0x48d682[_0x0cd0('0xa9')][_0x0cd0('0x9b')][0x0];}else{return db[_0x0cd0('0xaa')][_0x0cd0('0x5d')](_['defaults'](_0x3fd06a['body'],{'firstName':_0x3fd06a[_0x0cd0('0x4e')]['to'],'email':_0x3fd06a[_0x0cd0('0x4e')]['to'],'phone':_0x3fd06a[_0x0cd0('0x4e')]['to'],'ListId':_0x48d682[_0x0cd0('0x65')]}));}}else{throw new Error(_0x0cd0('0xa8'));}}})[_0x0cd0('0x11')](function(_0x293dd){if(_0x293dd){var _0x4385c8={'UserId':_0x3fd06a[_0x0cd0('0x69')]['id'],'ContactId':_0x293dd['id'],'MailAccountId':_0x48d682['id'],'inReplyTo':_0x18fbbd[_0x0cd0('0xab')],'to':_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0x9d')],'cc':_0x3fd06a[_0x0cd0('0x4e')]['cc'],'subject':_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0xac')],'attach':_0x3fd06a[_0x0cd0('0x4e')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0cd0('0x9e')](_0x0cd0('0x97')),'lastMsgDirection':_0x0cd0('0xad'),'Messages':[_[_0x0cd0('0x43')](_0x3fd06a[_0x0cd0('0x4e')],{'messageId':_0x18fbbd[_0x0cd0('0xab')],'sentAt':moment()[_0x0cd0('0x9e')](_0x0cd0('0x97')),'read':!![],'MailAccountId':_0x48d682['id'],'UserId':_0x3fd06a['user']['id'],'ContactId':_0x293dd['id']})]};if(_0x3fd06a[_0x0cd0('0x4e')][_0x0cd0('0xae')]){_0x4385c8=_[_0x0cd0('0x43')](_0x4385c8,_0x3fd06a['body']['Interaction']);}return db[_0x0cd0('0x7e')]['create'](_0x4385c8,{'include':[{'model':db[_0x0cd0('0x95')],'as':_0x0cd0('0xaf')}]});}})[_0x0cd0('0x11')](respondWithResult(_0x248584,null))['catch'](handleError(_0x248584,null));};exports['verifySmtp']=function(_0x45e9df,_0x57afaf){return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x45e9df[_0x0cd0('0x4a')]['id']},'include':[{'model':db[_0x0cd0('0x2e')],'as':_0x0cd0('0x50'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0cd0('0xb0'),'raw':!![]}]}]})[_0x0cd0('0x11')](handleEntityNotFound(_0x57afaf,null))[_0x0cd0('0x11')](function(_0x3b2e0c){if(!_0x3b2e0c[_0x0cd0('0x50')])return;var _0x5a15f5={'id':_0x3b2e0c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3b2e0c[_0x0cd0('0x62')]!==_0x0cd0('0x63')){_0x5a15f5[_0x0cd0('0x6c')]=_0x3b2e0c[_0x0cd0('0x62')];}else{_0x5a15f5['host']=_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x6d')];_0x5a15f5[_0x0cd0('0x6e')]=_0x3b2e0c['Smtp'][_0x0cd0('0x6e')];_0x5a15f5[_0x0cd0('0xa5')]=_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0xa5')];}if(_0x3b2e0c['Smtp']['authentication']){if(_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x4f')]){_0x5a15f5['auth']={'type':_0x0cd0('0xb1'),'user':_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x69')],'accessToken':_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0xb0')][_0x0cd0('0xb2')]};}else{_0x5a15f5['auth']={'user':_0x3b2e0c[_0x0cd0('0x50')][_0x0cd0('0x69')],'pass':_0x3b2e0c[_0x0cd0('0x50')]['pass']};}}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x5a15f5});})[_0x0cd0('0x11')](respondWithResult(_0x57afaf,null))[_0x0cd0('0x48')](handleError(_0x57afaf,null));};exports[_0x0cd0('0x29')]=function(_0x466761,_0x2c44bc){return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x466761[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2c44bc,null))[_0x0cd0('0x11')](function(_0x4d8c7a){if(_0x4d8c7a&&_0x4d8c7a[_0x0cd0('0x6c')]){throw new db[(_0x0cd0('0xb3'))][(_0x0cd0('0xb4'))](_0x0cd0('0xb5'));}return _0x4d8c7a;})['then'](removeEntity(_0x2c44bc,null))[_0x0cd0('0x48')](handleError(_0x2c44bc,null));};exports[_0x0cd0('0xb6')]=function(_0x1247de,_0x2a0146){return db[_0x0cd0('0x30')]['find']({'where':{'id':_0x1247de[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x2a0146,null))[_0x0cd0('0x11')](function(_0x2b9365){if(_0x2b9365){return _0x2b9365[_0x0cd0('0xb6')](_0x1247de[_0x0cd0('0x4e')][_0x0cd0('0x5b')],_[_0x0cd0('0x7f')](_0x1247de[_0x0cd0('0x4e')],[_0x0cd0('0x5b'),'id'])||{})[_0x0cd0('0xb7')](function(_0x1fcbda){for(var _0x396e6a=0x0;_0x396e6a<_0x1247de[_0x0cd0('0x4e')][_0x0cd0('0x5b')][_0x0cd0('0x3c')];_0x396e6a+=0x1){socket[_0x0cd0('0xb8')](_0x0cd0('0xb9'),{'UserId':Number(_0x1247de['body'][_0x0cd0('0x5b')][_0x396e6a]),'MailAccountId':Number(_0x1247de[_0x0cd0('0x4a')]['id'])});}return _0x1fcbda;});}})['then'](respondWithResult(_0x2a0146,null))[_0x0cd0('0x48')](handleError(_0x2a0146,null));};exports[_0x0cd0('0xba')]=function(_0x178912,_0xb06b2a){return db['MailAccount'][_0x0cd0('0x4d')]({'where':{'id':_0x178912[_0x0cd0('0x4a')]['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0xb06b2a,null))[_0x0cd0('0x11')](function(_0x12b2b5){if(_0x12b2b5){return _0x12b2b5['removeAgents'](_0x178912[_0x0cd0('0x36')][_0x0cd0('0x5b')])[_0x0cd0('0x11')](function(){if(_['isArray'](_0x178912['query'][_0x0cd0('0x5b')])){for(var _0x166956=0x0;_0x166956<_0x178912[_0x0cd0('0x36')][_0x0cd0('0x5b')][_0x0cd0('0x3c')];_0x166956+=0x1){socket['emit'](_0x0cd0('0xbb'),{'UserId':Number(_0x178912['query']['ids'][_0x166956]),'MailAccountId':Number(_0x178912[_0x0cd0('0x4a')]['id'])});}}else{socket[_0x0cd0('0xb8')](_0x0cd0('0xbb'),{'UserId':Number(_0x178912[_0x0cd0('0x36')][_0x0cd0('0x5b')]),'MailAccountId':Number(_0x178912[_0x0cd0('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0xb06b2a,null))[_0x0cd0('0x48')](handleError(_0xb06b2a,null));};exports[_0x0cd0('0xbc')]=function(_0x42b25,_0x4abb21){var _0x3178a5={};var _0x394ab8={};var _0x493bf5;var _0x124a26;return db[_0x0cd0('0x30')][_0x0cd0('0x56')]({'where':{'id':_0x42b25['params']['id']}})[_0x0cd0('0x11')](handleEntityNotFound(_0x4abb21,null))['then'](function(_0x1da35c){if(_0x1da35c){_0x493bf5=_0x1da35c;_0x394ab8[_0x0cd0('0x34')]=_[_0x0cd0('0x37')](db[_0x0cd0('0x82')][_0x0cd0('0x31')]);_0x394ab8[_0x0cd0('0x36')]=_[_0x0cd0('0x37')](_0x42b25[_0x0cd0('0x36')]);_0x394ab8['filters']=_[_0x0cd0('0x39')](_0x394ab8[_0x0cd0('0x34')],_0x394ab8[_0x0cd0('0x36')]);_0x3178a5['attributes']=_['intersection'](_0x394ab8[_0x0cd0('0x34')],qs[_0x0cd0('0x3b')](_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x3b')]));_0x3178a5['attributes']=_0x3178a5['attributes'][_0x0cd0('0x3c')]?_0x3178a5[_0x0cd0('0x3a')]:_0x394ab8[_0x0cd0('0x34')];_0x3178a5[_0x0cd0('0x3f')]=qs[_0x0cd0('0x40')](_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x40')]);_0x3178a5[_0x0cd0('0x41')]=qs['filters'](_[_0x0cd0('0x57')](_0x42b25[_0x0cd0('0x36')],_0x394ab8[_0x0cd0('0x38')]));if(_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x42')]){_0x3178a5[_0x0cd0('0x41')]=_[_0x0cd0('0x43')](_0x3178a5[_0x0cd0('0x41')],{'$or':_[_0x0cd0('0x35')](_0x3178a5[_0x0cd0('0x3a')],function(_0x194833){var _0x50b75a={};_0x50b75a[_0x194833]={'$like':'%'+_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x42')]+'%'};return _0x50b75a;})});}_0x3178a5=_[_0x0cd0('0x43')]({},_0x3178a5,_0x42b25[_0x0cd0('0x44')]);return _0x493bf5[_0x0cd0('0xbc')](_0x3178a5);}})[_0x0cd0('0x11')](function(_0x4bbeb5){if(_0x4bbeb5){_0x124a26=_0x4bbeb5[_0x0cd0('0x3c')];if(!_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x3d')](_0x0cd0('0x3e'))){_0x3178a5[_0x0cd0('0x20')]=qs[_0x0cd0('0x20')](_0x42b25[_0x0cd0('0x36')][_0x0cd0('0x20')]);_0x3178a5['offset']=qs['offset'](_0x42b25['query']['offset']);}return _0x493bf5[_0x0cd0('0xbc')](_0x3178a5);}})[_0x0cd0('0x11')](function(_0x24f4f7){if(_0x24f4f7){return _0x24f4f7?{'count':_0x124a26,'rows':_0x24f4f7}:null;}})[_0x0cd0('0x11')](respondWithResult(_0x4abb21,null))[_0x0cd0('0x48')](handleError(_0x4abb21,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c90ab89..10a30df 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 _0x2709=['exports','events','MailAccount','setMaxListeners','update','emit','hook'];(function(_0x557acb,_0x1865c0){var _0x558f13=function(_0x25951b){while(--_0x25951b){_0x557acb['push'](_0x557acb['shift']());}};_0x558f13(++_0x1865c0);}(_0x2709,0x189));var _0x9270=function(_0x3fd2c7,_0x41aaf0){_0x3fd2c7=_0x3fd2c7-0x0;var _0x3279d5=_0x2709[_0x3fd2c7];return _0x3279d5;};'use strict';var EventEmitter=require(_0x9270('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x9270('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9270('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9270('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd5780b){return function(_0x26bdf5,_0x326c2a,_0x2c09b6){MailAccountEvents[_0x9270('0x4')](_0xd5780b+':'+_0x26bdf5['id'],_0x26bdf5);MailAccountEvents[_0x9270('0x4')](_0xd5780b,_0x26bdf5);_0x2c09b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x9270('0x5')](e,emitEvent(event));}}module[_0x9270('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x9aac=['hook','events','MailAccount','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xd2a568,_0x4e8606){var _0x4cf0ba=function(_0x1f9dfc){while(--_0x1f9dfc){_0xd2a568['push'](_0xd2a568['shift']());}};_0x4cf0ba(++_0x4e8606);}(_0x9aac,0x135));var _0xc9aa=function(_0x5d6ecc,_0x3b77ee){_0x5d6ecc=_0x5d6ecc-0x0;var _0x1e0aab=_0x9aac[_0x5d6ecc];return _0x1e0aab;};'use strict';var EventEmitter=require(_0xc9aa('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xc9aa('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc9aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8ca086){return function(_0x5c8ce2,_0x28c49c,_0x267772){MailAccountEvents['emit'](_0x8ca086+':'+_0x5c8ce2['id'],_0x5c8ce2);MailAccountEvents[_0xc9aa('0x4')](_0x8ca086,_0x5c8ce2);_0x267772(null);};}for(var e in events){if(events[_0xc9aa('0x5')](e)){var event=events[e];MailAccount[_0xc9aa('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1c36fe8..0c64d9a 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 _0x4640=['mail_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailAccount.attributes','define','MailAccount'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x4640,0x1a3));var _0x0464=function(_0x272cb6,_0x134ed0){_0x272cb6=_0x272cb6-0x0;var _0x1be756=_0x4640[_0x272cb6];return _0x1be756;};'use strict';var _=require(_0x0464('0x0'));var util=require(_0x0464('0x1'));var logger=require(_0x0464('0x2'))('api');var moment=require(_0x0464('0x3'));var BPromise=require(_0x0464('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0464('0x5'));var rimraf=require(_0x0464('0x6'));var config=require('../../config/environment');var attributes=require(_0x0464('0x7'));module['exports']=function(_0x11c8a8,_0x3cd6f9){return _0x11c8a8[_0x0464('0x8')](_0x0464('0x9'),attributes,{'tableName':_0x0464('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cda=['../../config/environment','define','MailAccount','mail_accounts','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x257017,_0x330627){var _0x38536d=function(_0xdf92e){while(--_0xdf92e){_0x257017['push'](_0x257017['shift']());}};_0x38536d(++_0x330627);}(_0x7cda,0x7c));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa7cd('0x0'));var util=require(_0xa7cd('0x1'));var logger=require(_0xa7cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa7cd('0x3'));var rp=require(_0xa7cd('0x4'));var fs=require('fs');var path=require(_0xa7cd('0x5'));var rimraf=require('rimraf');var config=require(_0xa7cd('0x6'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x29155d,_0x4cd399){return _0x29155d[_0xa7cd('0x7')](_0xa7cd('0x8'),attributes,{'tableName':_0xa7cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9120289..9cb0e76 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 _0x8670=['list','orderBy','asc','account','push','length','close','autoclose','*,*,*,*','from','create','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','find','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailAccount','MailAccount','options','raw','where','attributes','map','include','model','debug','catch','ShowMailAccount','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','Applications','MailServerOut','Smtp','List','get','omit','applications'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8670,0x95));var _0x0867=function(_0x1979d8,_0x10d8f2){_0x1979d8=_0x1979d8-0x0;var _0x1d5bb3=_0x8670[_0x1979d8];return _0x1d5bb3;};'use strict';var _=require(_0x0867('0x0'));var util=require(_0x0867('0x1'));var moment=require('moment');var BPromise=require(_0x0867('0x2'));var rs=require(_0x0867('0x3'));var fs=require('fs');var Redis=require(_0x0867('0x4'));var db=require(_0x0867('0x5'))['db'];var utils=require(_0x0867('0x6'));var logger=require(_0x0867('0x7'))('rpc');var config=require(_0x0867('0x8'));var jayson=require(_0x0867('0x9'));var client=jayson[_0x0867('0xa')]['http']({'port':0x232c});config[_0x0867('0xb')]=_['defaults'](config[_0x0867('0xb')],{'host':_0x0867('0xc'),'port':0x18eb});var socket=require(_0x0867('0xd'))(new Redis(config[_0x0867('0xb')]));require(_0x0867('0xe'))[_0x0867('0xf')](socket);function respondWithRpcPromise(_0x34a880,_0x4432e4,_0x583ef8){return new BPromise(function(_0x51d6f7,_0x45cf63){return client[_0x0867('0x10')](_0x34a880,_0x583ef8)[_0x0867('0x11')](function(_0x3cada5){logger[_0x0867('0x12')](_0x0867('0x13'),_0x4432e4,'request\x20sent');logger['debug'](_0x0867('0x14'),_0x4432e4,_0x0867('0x15'),JSON[_0x0867('0x16')](_0x3cada5));if(_0x3cada5[_0x0867('0x17')]){if(_0x3cada5['error'][_0x0867('0x18')]===0x1f4){logger[_0x0867('0x17')](_0x0867('0x13'),_0x4432e4,_0x3cada5[_0x0867('0x17')][_0x0867('0x19')]);return _0x45cf63(_0x3cada5[_0x0867('0x17')]['message']);}logger[_0x0867('0x17')](_0x0867('0x13'),_0x4432e4,_0x3cada5[_0x0867('0x17')][_0x0867('0x19')]);return _0x51d6f7(_0x3cada5[_0x0867('0x17')][_0x0867('0x19')]);}else{logger[_0x0867('0x12')](_0x0867('0x13'),_0x4432e4,'request\x20sent');_0x51d6f7(_0x3cada5[_0x0867('0x1a')][_0x0867('0x19')]);}})['catch'](function(_0x41f41b){logger['error'](_0x0867('0x13'),_0x4432e4,_0x41f41b);_0x45cf63(_0x41f41b);});});}exports[_0x0867('0x1b')]=function(_0x274a91){var _0x2ea848=this;return new Promise(function(_0x5bae69,_0x11bfd2){return db[_0x0867('0x1c')]['findAll']({'raw':_0x274a91[_0x0867('0x1d')]?_0x274a91[_0x0867('0x1d')][_0x0867('0x1e')]===undefined?!![]:![]:!![],'where':_0x274a91[_0x0867('0x1d')]?_0x274a91['options'][_0x0867('0x1f')]||null:null,'attributes':_0x274a91[_0x0867('0x1d')]?_0x274a91[_0x0867('0x1d')][_0x0867('0x20')]||null:null,'limit':_0x274a91[_0x0867('0x1d')]?_0x274a91[_0x0867('0x1d')]['limit']||null:null,'include':_0x274a91[_0x0867('0x1d')]?_0x274a91[_0x0867('0x1d')]['include']?_[_0x0867('0x21')](_0x274a91[_0x0867('0x1d')][_0x0867('0x22')],function(_0x5ebed2){return{'model':db[_0x5ebed2[_0x0867('0x23')]],'as':_0x5ebed2['as'],'attributes':_0x5ebed2[_0x0867('0x20')],'include':_0x5ebed2[_0x0867('0x22')]?_[_0x0867('0x21')](_0x5ebed2[_0x0867('0x22')],function(_0x54bb98){return{'model':db[_0x54bb98[_0x0867('0x23')]],'as':_0x54bb98['as'],'attributes':_0x54bb98['attributes'],'include':_0x54bb98[_0x0867('0x22')]?_[_0x0867('0x21')](_0x54bb98['include'],function(_0x3b880f){return{'model':db[_0x3b880f[_0x0867('0x23')]],'as':_0x3b880f['as'],'attributes':_0x3b880f[_0x0867('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0867('0x11')](function(_0x304946){logger[_0x0867('0x12')](_0x0867('0x1b'),_0x274a91);logger[_0x0867('0x24')](_0x0867('0x1b'),_0x274a91,JSON[_0x0867('0x16')](_0x304946));_0x5bae69(_0x304946);})[_0x0867('0x25')](function(_0x10b7ef){logger['error'](_0x0867('0x1b'),_0x10b7ef[_0x0867('0x19')],_0x274a91);_0x11bfd2(_0x2ea848[_0x0867('0x17')](0x1f4,_0x10b7ef['message']));});});};exports['ShowMailAccount']=function(_0x45bae4){var _0x1c7e35=this;return new Promise(function(_0x2a8855,_0x38a4af){return db['MailAccount']['find']({'raw':_0x45bae4[_0x0867('0x1d')]?_0x45bae4[_0x0867('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x45bae4[_0x0867('0x1d')]?_0x45bae4[_0x0867('0x1d')][_0x0867('0x1f')]||null:null,'attributes':_0x45bae4[_0x0867('0x1d')]?_0x45bae4[_0x0867('0x1d')][_0x0867('0x20')]||null:null,'include':_0x45bae4[_0x0867('0x1d')]?_0x45bae4[_0x0867('0x1d')]['include']?_['map'](_0x45bae4[_0x0867('0x1d')][_0x0867('0x22')],function(_0x4a2ef0){return{'model':db[_0x4a2ef0[_0x0867('0x23')]],'as':_0x4a2ef0['as'],'attributes':_0x4a2ef0[_0x0867('0x20')],'include':_0x4a2ef0['include']?_[_0x0867('0x21')](_0x4a2ef0[_0x0867('0x22')],function(_0x2fa794){return{'model':db[_0x2fa794['model']],'as':_0x2fa794['as'],'attributes':_0x2fa794[_0x0867('0x20')],'include':_0x2fa794[_0x0867('0x22')]?_['map'](_0x2fa794[_0x0867('0x22')],function(_0x2e6be9){return{'model':db[_0x2e6be9[_0x0867('0x23')]],'as':_0x2e6be9['as'],'attributes':_0x2e6be9[_0x0867('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26ab96){logger[_0x0867('0x12')](_0x0867('0x26'),_0x45bae4);logger['debug'](_0x0867('0x26'),_0x45bae4,JSON['stringify'](_0x26ab96));_0x2a8855(_0x26ab96);})['catch'](function(_0x4cd8dd){logger[_0x0867('0x17')](_0x0867('0x26'),_0x4cd8dd[_0x0867('0x19')],_0x45bae4);_0x38a4af(_0x1c7e35[_0x0867('0x17')](0x1f4,_0x4cd8dd['message']));});});};exports[_0x0867('0x27')]=function(_0x52b183){var _0x2f2c16=this;return new Promise(function(_0x4dc75c,_0x5ac241){var _0xab22bb={'body':_0x52b183[_0x0867('0x28')],'channel':'mail'};var _0x1252a0=_[_0x0867('0x29')](_[_0x0867('0x2a')](db[_0x0867('0x2b')][_0x0867('0x2c')]),['createdAt','updatedAt',_0x0867('0x2d'),_0x0867('0x2e')]);var _0x5b83cb=![];if(_0x52b183[_0x0867('0x28')]['id']){delete _0x52b183[_0x0867('0x28')]['id'];}if(_[_0x0867('0x2f')](_0x52b183[_0x0867('0x28')]['from'])){return _0x5ac241(_0x2f2c16[_0x0867('0x17')](0x1f4,_0x0867('0x30')));}if(_[_0x0867('0x2f')](_0x52b183[_0x0867('0x28')][_0x0867('0x28')])||_0x52b183[_0x0867('0x28')][_0x0867('0x28')]===''){return _0x5ac241(_0x2f2c16[_0x0867('0x17')](0x1f4,_0x0867('0x31')));}if(_['isNil'](_0x52b183[_0x0867('0x28')]['mapKey'])){return _0x5ac241(_0x2f2c16[_0x0867('0x17')](0x1f4,_0x0867('0x32')+_0x1252a0));}if(!_['includes'](_0x1252a0,_0x52b183[_0x0867('0x28')]['mapKey'])){return _0x5ac241(_0x2f2c16[_0x0867('0x17')](0x1f4,_0x0867('0x33')+_0x1252a0));}var _0x496da1={};_0x496da1[_0x52b183[_0x0867('0x28')][_0x0867('0x34')]]=_0x52b183[_0x0867('0x28')]['from'];return db[_0x0867('0x1c')]['find']({'where':{'id':_0x52b183['account']['id']},'include':[{'model':db[_0x0867('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0867('0x36'),'where':_0x496da1,'limit':0x1,'order':[['updatedAt',_0x0867('0x37')]]}]},{'model':db['MailApplication'],'as':_0x0867('0x38')},{'model':db[_0x0867('0x39')],'as':_0x0867('0x3a')}]})[_0x0867('0x11')](function(_0x20b379){if(_0x20b379&&_0x20b379[_0x0867('0x3b')]){var _0x369308=_0x20b379[_0x0867('0x3c')]({'plain':!![]});_0xab22bb['account']=_[_0x0867('0x3d')](_0x369308,[_0x0867('0x38'),'List']);_0xab22bb[_0x0867('0x3e')]=_0x369308[_0x0867('0x38')];_0xab22bb[_0x0867('0x3f')]=_0x369308['List'];_0xab22bb[_0x0867('0x3e')]=_[_0x0867('0x40')](_0xab22bb[_0x0867('0x3e')],['priority'],[_0x0867('0x41')]);if(_0xab22bb[_0x0867('0x42')]&&_0xab22bb[_0x0867('0x42')]['autoclose']){_0xab22bb['applications'][_0x0867('0x43')]({'id':0x0,'priority':_0xab22bb[_0x0867('0x3e')][_0x0867('0x44')]+0x1,'app':_0x0867('0x45'),'appdata':_0x0867('0x46'),'interval':_0x0867('0x47')});}if(_0xab22bb[_0x0867('0x42')][_0x0867('0x38')]){delete _0xab22bb[_0x0867('0x42')][_0x0867('0x38')];}if(_0xab22bb['account'][_0x0867('0x3b')]){delete _0xab22bb[_0x0867('0x42')][_0x0867('0x3b')];}if(_0x369308['List'][_0x0867('0x36')]['length']){return _0x369308['List']['Contacts'][0x0];}var _0x4306ed=_['defaults'](_0x52b183[_0x0867('0x28')],{'firstName':_0x52b183[_0x0867('0x28')][_0x0867('0x48')],'ListId':_0x369308[_0x0867('0x2e')]});_0x4306ed[_0x52b183[_0x0867('0x28')][_0x0867('0x34')]]=_0x52b183[_0x0867('0x28')]['from'];return db[_0x0867('0x2b')][_0x0867('0x49')](_0x4306ed);}else{throw new Error('List\x20not\x20found');}})[_0x0867('0x11')](function(_0x5bc658){_0xab22bb['contact']=_0x5bc658;if(_0x5bc658){if(!_0x52b183[_0x0867('0x28')]['message'][_0x0867('0x4a')]){_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x4a')]=rs[_0x0867('0x4b')]()+'\x20'+_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['from'];}var _0x33fdba={'ContactId':_0x5bc658['id'],'MailAccountId':_0x52b183[_0x0867('0x42')]['id'],'inReplyTo':_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['messageId'],'to':_0x52b183[_0x0867('0x28')]['message'][_0x0867('0x48')],'cc':_0x52b183[_0x0867('0x28')]['message']['cc'],'subject':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x4c')],'attach':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x4d')],'lastMsgAt':moment()[_0x0867('0x4e')](_0x0867('0x4f')),'lastMsgDirection':'in'};return db[_0x0867('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0x52b183['account']['id']},'include':[{'model':db[_0x0867('0x51')],'as':_0x0867('0x52'),'attributes':['messageId'],'where':{'messageId':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x53')]}}]})[_0x0867('0x11')](function(_0xe74a73){if(_0xe74a73){return[_0xe74a73,![]];}return db['MailInteraction']['create'](_0x33fdba)['then'](function(_0xe4c52c){return[_0xe4c52c,!![]];});});}else{throw new Error(_0x0867('0x54'));}})[_0x0867('0x55')](function(_0x4641c1,_0x32f328){if(_0x4641c1){_0x5b83cb=_0x32f328;if(!_0x32f328){return _0x4641c1[_0x0867('0x56')]({'inReplyTo':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x4a')],'to':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x48')],'cc':_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['cc'],'subject':_0x52b183['body']['message'][_0x0867('0x4c')],'attach':_0x4641c1['attach']?_0x4641c1['attach']:_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['attach'],'substatus':null,'substatusAt':moment()[_0x0867('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0867('0x4e')](_0x0867('0x4f')),'lastMsgDirection':'in'});}else{return _0x4641c1;}}})[_0x0867('0x11')](function(_0x510891){_0xab22bb[_0x0867('0x57')]=_0x510891[_0x0867('0x3c')]({'plain':!![]});_0xab22bb[_0x0867('0x57')][_0x0867('0x58')]=_0x5b83cb;return db[_0x0867('0x51')]['create']({'body':_0x52b183[_0x0867('0x28')]['body'],'MailAccountId':_0x52b183[_0x0867('0x42')]['id'],'MailInteractionId':_0x510891['id'],'direction':'in','ContactId':_0xab22bb['contact']['id'],'messageId':_0x52b183['body'][_0x0867('0x19')][_0x0867('0x4a')],'from':_0x52b183[_0x0867('0x28')]['message'][_0x0867('0x48')],'to':_0x52b183['body'][_0x0867('0x19')]['to'],'cc':_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['cc'],'subject':_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['subject'],'attach':_0x52b183['body'][_0x0867('0x19')][_0x0867('0x4d')],'Attachments':_0x52b183[_0x0867('0x28')][_0x0867('0x19')]['attachments'],'originTo':_0x52b183['body'][_0x0867('0x19')][_0x0867('0x59')],'originCc':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x5a')],'bcc':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x5b')],'ChatWebsiteId':_0x52b183[_0x0867('0x28')]['message']['ChatWebsiteId']||null,'originChannel':_0x52b183['body'][_0x0867('0x19')][_0x0867('0x5c')]||_0x0867('0x5d'),'ChatOfflineMessageId':_0x52b183[_0x0867('0x28')][_0x0867('0x19')][_0x0867('0x5e')]||null},{'include':[{'model':db[_0x0867('0x5f')],'as':_0x0867('0x60')}]});})['then'](function(_0x25feeb){_0xab22bb['message']=_0x25feeb;if(_0xab22bb[_0x0867('0x57')][_0x0867('0x61')]){return db[_0x0867('0x62')][_0x0867('0x63')]({'attributes':['id',_0x0867('0x64')],'where':{'id':_0xab22bb['interaction'][_0x0867('0x61')]}})[_0x0867('0x11')](function(_0xbf61e){if(_0xbf61e){_0xab22bb[_0x0867('0x3e')][_0x0867('0x65')]({'id':0x0,'priority':0x0,'app':_0x0867('0x66'),'appdata':_0xbf61e[_0x0867('0x64')]+','+(_0xab22bb['account'][_0x0867('0x67')]||0xa),'interval':_0x0867('0x47')});}return respondWithRpcPromise('Start','startRouting',_0xab22bb);});}return respondWithRpcPromise(_0x0867('0x68'),_0x0867('0x69'),_0xab22bb);})[_0x0867('0x11')](function(_0x171e7a){_0x4dc75c(_0x171e7a);})[_0x0867('0x25')](function(_0x173c8f){_0x5ac241(_0x2f2c16[_0x0867('0x17')](0x1f4,_0x173c8f['message']));});});}; \ No newline at end of file +var _0x041e=['create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetMailAccount','findAll','options','raw','attributes','limit','include','model','map','stringify','ShowMailAccount','MailAccount','where','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','Smtp','get','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts'];(function(_0xf8a82b,_0x35ae8d){var _0x2ca34d=function(_0x21e754){while(--_0x21e754){_0xf8a82b['push'](_0xf8a82b['shift']());}};_0x2ca34d(++_0x35ae8d);}(_0x041e,0xfb));var _0xe041=function(_0x1341b0,_0x4ca920){_0x1341b0=_0x1341b0-0x0;var _0x2bcfc3=_0x041e[_0x1341b0];return _0x2bcfc3;};'use strict';var _=require('lodash');var util=require(_0xe041('0x0'));var moment=require(_0xe041('0x1'));var BPromise=require('bluebird');var rs=require(_0xe041('0x2'));var fs=require('fs');var Redis=require(_0xe041('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe041('0x4'));var logger=require(_0xe041('0x5'))(_0xe041('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe041('0x7')][_0xe041('0x8')]({'port':0x232c});config[_0xe041('0x9')]=_[_0xe041('0xa')](config['redis'],{'host':_0xe041('0xb'),'port':0x18eb});var socket=require(_0xe041('0xc'))(new Redis(config[_0xe041('0x9')]));require(_0xe041('0xd'))[_0xe041('0xe')](socket);function respondWithRpcPromise(_0x2467cd,_0x5cc12b,_0x1b6e0f){return new BPromise(function(_0x2be40e,_0xe32a06){return client[_0xe041('0xf')](_0x2467cd,_0x1b6e0f)[_0xe041('0x10')](function(_0x22e245){logger[_0xe041('0x11')](_0xe041('0x12'),_0x5cc12b,_0xe041('0x13'));logger[_0xe041('0x14')](_0xe041('0x15'),_0x5cc12b,_0xe041('0x13'),JSON['stringify'](_0x22e245));if(_0x22e245['error']){if(_0x22e245['error'][_0xe041('0x16')]===0x1f4){logger[_0xe041('0x17')]('MailAccount,\x20%s,\x20%s',_0x5cc12b,_0x22e245[_0xe041('0x17')][_0xe041('0x18')]);return _0xe32a06(_0x22e245[_0xe041('0x17')]['message']);}logger['error'](_0xe041('0x12'),_0x5cc12b,_0x22e245[_0xe041('0x17')][_0xe041('0x18')]);return _0x2be40e(_0x22e245[_0xe041('0x17')][_0xe041('0x18')]);}else{logger['info'](_0xe041('0x12'),_0x5cc12b,'request\x20sent');_0x2be40e(_0x22e245['result'][_0xe041('0x18')]);}})[_0xe041('0x19')](function(_0x40c62d){logger[_0xe041('0x17')]('MailAccount,\x20%s,\x20%s',_0x5cc12b,_0x40c62d);_0xe32a06(_0x40c62d);});});}exports[_0xe041('0x1a')]=function(_0x272f48){var _0x55bdfe=this;return new Promise(function(_0x5c9bbc,_0x367c7a){return db['MailAccount'][_0xe041('0x1b')]({'raw':_0x272f48['options']?_0x272f48[_0xe041('0x1c')][_0xe041('0x1d')]===undefined?!![]:![]:!![],'where':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')]['where']||null:null,'attributes':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')][_0xe041('0x1e')]||null:null,'limit':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')][_0xe041('0x1f')]||null:null,'include':_0x272f48[_0xe041('0x1c')]?_0x272f48[_0xe041('0x1c')][_0xe041('0x20')]?_['map'](_0x272f48[_0xe041('0x1c')]['include'],function(_0x5996a7){return{'model':db[_0x5996a7[_0xe041('0x21')]],'as':_0x5996a7['as'],'attributes':_0x5996a7['attributes'],'include':_0x5996a7['include']?_['map'](_0x5996a7[_0xe041('0x20')],function(_0x388d01){return{'model':db[_0x388d01['model']],'as':_0x388d01['as'],'attributes':_0x388d01[_0xe041('0x1e')],'include':_0x388d01['include']?_[_0xe041('0x22')](_0x388d01[_0xe041('0x20')],function(_0x14c34c){return{'model':db[_0x14c34c['model']],'as':_0x14c34c['as'],'attributes':_0x14c34c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe041('0x10')](function(_0x2d27f3){logger[_0xe041('0x11')](_0xe041('0x1a'),_0x272f48);logger[_0xe041('0x14')](_0xe041('0x1a'),_0x272f48,JSON[_0xe041('0x23')](_0x2d27f3));_0x5c9bbc(_0x2d27f3);})[_0xe041('0x19')](function(_0x28d963){logger[_0xe041('0x17')](_0xe041('0x1a'),_0x28d963[_0xe041('0x18')],_0x272f48);_0x367c7a(_0x55bdfe[_0xe041('0x17')](0x1f4,_0x28d963['message']));});});};exports[_0xe041('0x24')]=function(_0x306c46){var _0xd5edf3=this;return new Promise(function(_0x4a4901,_0xb0bb09){return db[_0xe041('0x25')]['find']({'raw':_0x306c46[_0xe041('0x1c')]?_0x306c46['options']['raw']===undefined?!![]:![]:!![],'where':_0x306c46[_0xe041('0x1c')]?_0x306c46[_0xe041('0x1c')][_0xe041('0x26')]||null:null,'attributes':_0x306c46[_0xe041('0x1c')]?_0x306c46['options'][_0xe041('0x1e')]||null:null,'include':_0x306c46['options']?_0x306c46[_0xe041('0x1c')]['include']?_[_0xe041('0x22')](_0x306c46[_0xe041('0x1c')][_0xe041('0x20')],function(_0x50ff91){return{'model':db[_0x50ff91[_0xe041('0x21')]],'as':_0x50ff91['as'],'attributes':_0x50ff91['attributes'],'include':_0x50ff91[_0xe041('0x20')]?_['map'](_0x50ff91['include'],function(_0x332d51){return{'model':db[_0x332d51[_0xe041('0x21')]],'as':_0x332d51['as'],'attributes':_0x332d51[_0xe041('0x1e')],'include':_0x332d51[_0xe041('0x20')]?_['map'](_0x332d51[_0xe041('0x20')],function(_0xa3bb81){return{'model':db[_0xa3bb81['model']],'as':_0xa3bb81['as'],'attributes':_0xa3bb81[_0xe041('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe041('0x10')](function(_0x3ac88a){logger[_0xe041('0x11')](_0xe041('0x24'),_0x306c46);logger[_0xe041('0x14')]('ShowMailAccount',_0x306c46,JSON[_0xe041('0x23')](_0x3ac88a));_0x4a4901(_0x3ac88a);})[_0xe041('0x19')](function(_0x1d605a){logger[_0xe041('0x17')](_0xe041('0x24'),_0x1d605a[_0xe041('0x18')],_0x306c46);_0xb0bb09(_0xd5edf3[_0xe041('0x17')](0x1f4,_0x1d605a[_0xe041('0x18')]));});});};exports[_0xe041('0x27')]=function(_0x318897){var _0x45cffb=this;return new Promise(function(_0x3e99ea,_0x42a356){var _0x5e5743={'body':_0x318897[_0xe041('0x28')],'channel':_0xe041('0x29')};var _0x54c359=_['difference'](_[_0xe041('0x2a')](db[_0xe041('0x2b')][_0xe041('0x2c')]),[_0xe041('0x2d'),_0xe041('0x2e'),_0xe041('0x2f'),_0xe041('0x30')]);var _0x2eb863=![];if(_0x318897[_0xe041('0x28')]['id']){delete _0x318897[_0xe041('0x28')]['id'];}if(_[_0xe041('0x31')](_0x318897['body'][_0xe041('0x32')])){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0xe041('0x33')));}if(_[_0xe041('0x31')](_0x318897[_0xe041('0x28')][_0xe041('0x28')])||_0x318897[_0xe041('0x28')][_0xe041('0x28')]===''){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0xe041('0x34')));}if(_[_0xe041('0x31')](_0x318897['body']['mapKey'])){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54c359));}if(!_[_0xe041('0x35')](_0x54c359,_0x318897[_0xe041('0x28')][_0xe041('0x36')])){return _0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0xe041('0x37')+_0x54c359));}var _0x431234={};_0x431234[_0x318897['body'][_0xe041('0x36')]]=_0x318897[_0xe041('0x28')][_0xe041('0x32')];return db[_0xe041('0x25')][_0xe041('0x38')]({'where':{'id':_0x318897[_0xe041('0x39')]['id']},'include':[{'model':db[_0xe041('0x3a')],'as':_0xe041('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x431234,'limit':0x1,'order':[[_0xe041('0x2e'),_0xe041('0x3c')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xe041('0x3d')}]})['then'](function(_0x316180){if(_0x316180&&_0x316180[_0xe041('0x3b')]){var _0x4cfff3=_0x316180[_0xe041('0x3e')]({'plain':!![]});_0x5e5743['account']=_[_0xe041('0x3f')](_0x4cfff3,[_0xe041('0x40'),_0xe041('0x3b')]);_0x5e5743[_0xe041('0x41')]=_0x4cfff3[_0xe041('0x40')];_0x5e5743[_0xe041('0x42')]=_0x4cfff3[_0xe041('0x3b')];_0x5e5743[_0xe041('0x41')]=_[_0xe041('0x43')](_0x5e5743[_0xe041('0x41')],[_0xe041('0x44')],[_0xe041('0x45')]);if(_0x5e5743[_0xe041('0x39')]&&_0x5e5743[_0xe041('0x39')][_0xe041('0x46')]){_0x5e5743['applications'][_0xe041('0x47')]({'id':0x0,'priority':_0x5e5743[_0xe041('0x41')][_0xe041('0x48')]+0x1,'app':_0xe041('0x49'),'appdata':_0xe041('0x46'),'interval':_0xe041('0x4a')});}if(_0x5e5743[_0xe041('0x39')][_0xe041('0x40')]){delete _0x5e5743['account'][_0xe041('0x40')];}if(_0x5e5743[_0xe041('0x39')][_0xe041('0x3b')]){delete _0x5e5743[_0xe041('0x39')][_0xe041('0x3b')];}if(_0x4cfff3[_0xe041('0x3b')][_0xe041('0x4b')][_0xe041('0x48')]){return _0x4cfff3['List'][_0xe041('0x4b')][0x0];}var _0x55435e=_[_0xe041('0xa')](_0x318897['body'],{'firstName':_0x318897[_0xe041('0x28')][_0xe041('0x32')],'ListId':_0x4cfff3['ListId']});_0x55435e[_0x318897[_0xe041('0x28')][_0xe041('0x36')]]=_0x318897['body'][_0xe041('0x32')];return db[_0xe041('0x2b')][_0xe041('0x4c')](_0x55435e);}else{throw new Error(_0xe041('0x4d'));}})[_0xe041('0x10')](function(_0x20addb){_0x5e5743[_0xe041('0x4e')]=_0x20addb;if(_0x20addb){if(!_0x318897['body'][_0xe041('0x18')][_0xe041('0x4f')]){_0x318897['body']['message'][_0xe041('0x4f')]=rs[_0xe041('0x50')]()+'\x20'+_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x32')];}var _0x213f85={'ContactId':_0x20addb['id'],'MailAccountId':_0x318897[_0xe041('0x39')]['id'],'inReplyTo':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x4f')],'to':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['from'],'cc':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['cc'],'subject':_0x318897['body']['message'][_0xe041('0x51')],'attach':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x52')],'lastMsgAt':moment()['format'](_0xe041('0x53')),'lastMsgDirection':'in'};return db[_0xe041('0x54')][_0xe041('0x38')]({'where':{'closed':![],'MailAccountId':_0x318897['account']['id']},'include':[{'model':db[_0xe041('0x55')],'as':_0xe041('0x56'),'attributes':[_0xe041('0x4f')],'where':{'messageId':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x57')]}}]})[_0xe041('0x10')](function(_0x3f4d51){if(_0x3f4d51){return[_0x3f4d51,![]];}return db['MailInteraction'][_0xe041('0x4c')](_0x213f85)[_0xe041('0x10')](function(_0x390658){return[_0x390658,!![]];});});}else{throw new Error(_0xe041('0x58'));}})[_0xe041('0x59')](function(_0xd6fc85,_0x2ec85e){if(_0xd6fc85){_0x2eb863=_0x2ec85e;if(!_0x2ec85e){return _0xd6fc85[_0xe041('0x5a')]({'inReplyTo':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x4f')],'to':_0x318897['body']['message'][_0xe041('0x32')],'cc':_0x318897['body']['message']['cc'],'subject':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x51')],'attach':_0xd6fc85[_0xe041('0x52')]?_0xd6fc85[_0xe041('0x52')]:_0x318897['body']['message']['attach'],'substatus':null,'substatusAt':moment()[_0xe041('0x5b')](_0xe041('0x53')),'lastMsgAt':moment()[_0xe041('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xd6fc85;}}})[_0xe041('0x10')](function(_0x42134b){_0x5e5743[_0xe041('0x5c')]=_0x42134b[_0xe041('0x3e')]({'plain':!![]});_0x5e5743[_0xe041('0x5c')][_0xe041('0x5d')]=_0x2eb863;return db[_0xe041('0x55')][_0xe041('0x4c')]({'body':_0x318897['body'][_0xe041('0x28')],'MailAccountId':_0x318897[_0xe041('0x39')]['id'],'MailInteractionId':_0x42134b['id'],'direction':'in','ContactId':_0x5e5743['contact']['id'],'messageId':_0x318897['body'][_0xe041('0x18')]['messageId'],'from':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x32')],'to':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['to'],'cc':_0x318897[_0xe041('0x28')][_0xe041('0x18')]['cc'],'subject':_0x318897['body'][_0xe041('0x18')]['subject'],'attach':_0x318897[_0xe041('0x28')]['message'][_0xe041('0x52')],'Attachments':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x5e')],'originTo':_0x318897['body']['message'][_0xe041('0x5f')],'originCc':_0x318897['body'][_0xe041('0x18')]['originCc'],'bcc':_0x318897['body'][_0xe041('0x18')][_0xe041('0x60')],'ChatWebsiteId':_0x318897[_0xe041('0x28')]['message'][_0xe041('0x61')]||null,'originChannel':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x62')]||'Email','ChatOfflineMessageId':_0x318897[_0xe041('0x28')][_0xe041('0x18')][_0xe041('0x63')]||null},{'include':[{'model':db[_0xe041('0x64')],'as':_0xe041('0x65')}]});})['then'](function(_0x36066e){_0x5e5743[_0xe041('0x18')]=_0x36066e;if(_0x5e5743['interaction'][_0xe041('0x66')]){return db['User'][_0xe041('0x38')]({'attributes':['id','name'],'where':{'id':_0x5e5743[_0xe041('0x5c')][_0xe041('0x66')]}})[_0xe041('0x10')](function(_0x131a59){if(_0x131a59){_0x5e5743[_0xe041('0x41')][_0xe041('0x67')]({'id':0x0,'priority':0x0,'app':_0xe041('0x68'),'appdata':_0x131a59[_0xe041('0x69')]+','+(_0x5e5743[_0xe041('0x39')][_0xe041('0x6a')]||0xa),'interval':_0xe041('0x4a')});}return respondWithRpcPromise(_0xe041('0x6b'),_0xe041('0x6c'),_0x5e5743);});}return respondWithRpcPromise(_0xe041('0x6b'),_0xe041('0x6c'),_0x5e5743);})[_0xe041('0x10')](function(_0x3a4a77){_0x3e99ea(_0x3a4a77);})['catch'](function(_0x36161e){_0x42a356(_0x45cffb[_0xe041('0x17')](0x1f4,_0x36161e[_0xe041('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a0782e6..5764619 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 _0x1ae0=['save','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x822939,_0x34bc67){var _0x476773=function(_0x5e2a68){while(--_0x5e2a68){_0x822939['push'](_0x822939['shift']());}};_0x476773(++_0x34bc67);}(_0x1ae0,0xb8));var _0x01ae=function(_0x2ebd19,_0x4666e4){_0x2ebd19=_0x2ebd19-0x0;var _0x1ec212=_0x1ae0[_0x2ebd19];return _0x1ec212;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x01ae('0x0'),_0x01ae('0x1'),_0x01ae('0x2')];function createListener(_0x26e264,_0xd73285){return function(_0x553e7a){_0xd73285[_0x01ae('0x3')](_0x26e264,_0x553e7a);};}function removeListener(_0x45ede9,_0x3d8540){return function(){MailAccountEvents[_0x01ae('0x4')](_0x45ede9,_0x3d8540);};}exports[_0x01ae('0x5')]=function(_0x43745f){for(var _0x18d656=0x0,_0x723cf=events[_0x01ae('0x6')];_0x18d656<_0x723cf;_0x18d656++){var _0x4c4dc9=events[_0x18d656];var _0x49d461=createListener(_0x01ae('0x7')+_0x4c4dc9,_0x43745f);MailAccountEvents['on'](_0x4c4dc9,_0x49d461);}}; \ No newline at end of file +var _0xe265=['emit','removeListener','mailAccount:','./mailAccount.events','save','update'];(function(_0x2b0d57,_0x5706e6){var _0x56556d=function(_0x43b89f){while(--_0x43b89f){_0x2b0d57['push'](_0x2b0d57['shift']());}};_0x56556d(++_0x5706e6);}(_0xe265,0x111));var _0x5e26=function(_0x55ee65,_0x1d32a0){_0x55ee65=_0x55ee65-0x0;var _0x28bf74=_0xe265[_0x55ee65];return _0x28bf74;};'use strict';var MailAccountEvents=require(_0x5e26('0x0'));var events=[_0x5e26('0x1'),'remove',_0x5e26('0x2')];function createListener(_0x328c0f,_0xcc77d7){return function(_0x19cb33){_0xcc77d7[_0x5e26('0x3')](_0x328c0f,_0x19cb33);};}function removeListener(_0x59e306,_0x244ea1){return function(){MailAccountEvents[_0x5e26('0x4')](_0x59e306,_0x244ea1);};}exports['register']=function(_0x1067a){for(var _0x4999f4=0x0,_0x1d4b28=events['length'];_0x4999f4<_0x1d4b28;_0x4999f4++){var _0x11b07=events[_0x4999f4];var _0x423519=createListener(_0x5e26('0x5')+_0x11b07,_0x1067a);MailAccountEvents['on'](_0x11b07,_0x423519);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5e39f05..8b981a6 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 _0x9221=['../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x28b5fb,_0xf50dea){var _0x23fd25=function(_0x4adebe){while(--_0x4adebe){_0x28b5fb['push'](_0x28b5fb['shift']());}};_0x23fd25(++_0xf50dea);}(_0x9221,0xa1));var _0x1922=function(_0x362c1f,_0x4fccd9){_0x362c1f=_0x362c1f-0x0;var _0x32bd2a=_0x9221[_0x362c1f];return _0x32bd2a;};'use strict';var multer=require(_0x1922('0x0'));var util=require('util');var path=require(_0x1922('0x1'));var timeout=require('connect-timeout');var express=require(_0x1922('0x2'));var router=express['Router']();var fs_extra=require(_0x1922('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1922('0x4'));var config=require(_0x1922('0x5'));var controller=require(_0x1922('0x6'));router[_0x1922('0x7')](_0x1922('0x8'),auth[_0x1922('0x9')](),controller[_0x1922('0xa')]);router[_0x1922('0xb')](_0x1922('0x8'),auth[_0x1922('0x9')](),controller['update']);router[_0x1922('0xc')]('/:id',auth[_0x1922('0x9')](),controller[_0x1922('0xd')]);module[_0x1922('0xe')]=router; \ No newline at end of file +var _0x0293=['show','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x25d68d,_0x69adf9){var _0x3f5c89=function(_0x27791a){while(--_0x27791a){_0x25d68d['push'](_0x25d68d['shift']());}};_0x3f5c89(++_0x69adf9);}(_0x0293,0x86));var _0x3029=function(_0x3cba86,_0x543b89){_0x3cba86=_0x3cba86-0x0;var _0x349320=_0x0293[_0x3cba86];return _0x349320;};'use strict';var multer=require(_0x3029('0x0'));var util=require(_0x3029('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3029('0x2')]();var fs_extra=require(_0x3029('0x3'));var auth=require(_0x3029('0x4'));var interaction=require(_0x3029('0x5'));var config=require('../../config/environment');var controller=require(_0x3029('0x6'));router[_0x3029('0x7')](_0x3029('0x8'),auth[_0x3029('0x9')](),controller[_0x3029('0xa')]);router[_0x3029('0xb')](_0x3029('0x8'),auth[_0x3029('0x9')](),controller[_0x3029('0xc')]);router[_0x3029('0xd')]('/:id',auth[_0x3029('0x9')](),controller[_0x3029('0xe')]);module[_0x3029('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 54ef8e9..66846c2 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 _0xc9cd=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9cd,0x16f));var _0xdc9c=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0xc9cd[_0x1b745b];return _0x120a9d;};'use strict';var Sequelize=require(_0xdc9c('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdc9c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdc9c('0x2')],'allowNull':![],'defaultValue':_0xdc9c('0x3')},'appdata':{'type':Sequelize[_0xdc9c('0x4')]()},'description':{'type':Sequelize[_0xdc9c('0x2')]},'interval':{'type':Sequelize[_0xdc9c('0x2')],'defaultValue':_0xdc9c('0x5')}}; \ No newline at end of file +var _0xdcc6=['exports','INTEGER','noop','STRING','sequelize'];(function(_0x28b371,_0x1504e5){var _0x4e3740=function(_0x598035){while(--_0x598035){_0x28b371['push'](_0x28b371['shift']());}};_0x4e3740(++_0x1504e5);}(_0xdcc6,0x6d));var _0x6dcc=function(_0x15d6de,_0x5807c6){_0x15d6de=_0x15d6de-0x0;var _0x51e84a=_0xdcc6[_0x15d6de];return _0x51e84a;};'use strict';var Sequelize=require(_0x6dcc('0x0'));module[_0x6dcc('0x1')]={'priority':{'type':Sequelize[_0x6dcc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6dcc('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6dcc('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 02f7eb6..e93e96b 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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2e5563,_0x6a7f69){var _0x1ca161=function(_0x460bca){while(--_0x460bca){_0x2e5563['push'](_0x2e5563['shift']());}};_0x1ca161(++_0x6a7f69);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x21004b,_0x588678){var _0x5f4088=function(_0x230e9d){while(--_0x230e9d){_0x21004b['push'](_0x21004b['shift']());}};_0x5f4088(++_0x588678);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xcb91[_0x4c4037];return _0x357862;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 87fbcaf..6f76766 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 _0x4cde=['MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x308c6e,_0x100d21){var _0x2eb3f8=function(_0x52f307){while(--_0x52f307){_0x308c6e['push'](_0x308c6e['shift']());}};_0x2eb3f8(++_0x100d21);}(_0x4cde,0xc7));var _0xe4cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe4cd('0x0'));var util=require('util');var logger=require(_0xe4cd('0x1'))('api');var moment=require(_0xe4cd('0x2'));var BPromise=require(_0xe4cd('0x3'));var rp=require(_0xe4cd('0x4'));var fs=require('fs');var path=require(_0xe4cd('0x5'));var rimraf=require(_0xe4cd('0x6'));var config=require(_0xe4cd('0x7'));var attributes=require(_0xe4cd('0x8'));module[_0xe4cd('0x9')]=function(_0x11cafe,_0x484476){return _0x11cafe[_0xe4cd('0xa')](_0xe4cd('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4cd('0xc'),'collate':_0xe4cd('0xd')});}; \ No newline at end of file +var _0x59da=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xc0e537,_0x3c0cff){var _0x263cd9=function(_0x41774d){while(--_0x41774d){_0xc0e537['push'](_0xc0e537['shift']());}};_0x263cd9(++_0x3c0cff);}(_0x59da,0x1c8));var _0xa59d=function(_0x34d5d9,_0x2572f5){_0x34d5d9=_0x34d5d9-0x0;var _0xd7b3c0=_0x59da[_0x34d5d9];return _0xd7b3c0;};'use strict';var _=require(_0xa59d('0x0'));var util=require(_0xa59d('0x1'));var logger=require(_0xa59d('0x2'))(_0xa59d('0x3'));var moment=require(_0xa59d('0x4'));var BPromise=require(_0xa59d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa59d('0x6'));var rimraf=require('rimraf');var config=require(_0xa59d('0x7'));var attributes=require('./mailApplication.attributes');module[_0xa59d('0x8')]=function(_0x1deb73,_0x1b9ea2){return _0x1deb73['define']('MailApplication',attributes,{'tableName':_0xa59d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa59d('0xa'),'collate':_0xa59d('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index becd406..43613db 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 _0xe916=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','where','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x5f0ad0,_0x18b7fc){var _0x5078e4=function(_0x53f14e){while(--_0x53f14e){_0x5f0ad0['push'](_0x5f0ad0['shift']());}};_0x5078e4(++_0x18b7fc);}(_0xe916,0x91));var _0x6e91=function(_0x411944,_0x16b251){_0x411944=_0x411944-0x0;var _0x11ca6d=_0xe916[_0x411944];return _0x11ca6d;};'use strict';var _=require(_0x6e91('0x0'));var util=require(_0x6e91('0x1'));var moment=require(_0x6e91('0x2'));var BPromise=require(_0x6e91('0x3'));var rs=require(_0x6e91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e91('0x5'))['db'];var utils=require(_0x6e91('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e91('0x7'));var jayson=require(_0x6e91('0x8'));var client=jayson[_0x6e91('0x9')][_0x6e91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3293e3,_0x145904,_0xbaca72){return new BPromise(function(_0x4be97c,_0x4d54ae){return client[_0x6e91('0xb')](_0x3293e3,_0xbaca72)[_0x6e91('0xc')](function(_0x1e8c64){logger[_0x6e91('0xd')](_0x6e91('0xe'),_0x145904,'request\x20sent');logger[_0x6e91('0xf')](_0x6e91('0x10'),_0x145904,_0x6e91('0x11'),JSON[_0x6e91('0x12')](_0x1e8c64));if(_0x1e8c64[_0x6e91('0x13')]){if(_0x1e8c64['error'][_0x6e91('0x14')]===0x1f4){logger[_0x6e91('0x13')](_0x6e91('0xe'),_0x145904,_0x1e8c64[_0x6e91('0x13')][_0x6e91('0x15')]);return _0x4d54ae(_0x1e8c64[_0x6e91('0x13')][_0x6e91('0x15')]);}logger['error'](_0x6e91('0xe'),_0x145904,_0x1e8c64[_0x6e91('0x13')]['message']);return _0x4be97c(_0x1e8c64['error'][_0x6e91('0x15')]);}else{logger[_0x6e91('0xd')]('MailApplication,\x20%s,\x20%s',_0x145904,'request\x20sent');_0x4be97c(_0x1e8c64[_0x6e91('0x16')][_0x6e91('0x15')]);}})[_0x6e91('0x17')](function(_0x440f02){logger['error']('MailApplication,\x20%s,\x20%s',_0x145904,_0x440f02);_0x4d54ae(_0x440f02);});});}exports[_0x6e91('0x18')]=function(_0x1f631a){var _0x338439=this;return new Promise(function(_0x2867b1,_0x4750da){return db['MailApplication'][_0x6e91('0x19')](_0x1f631a['body'],{'raw':_0x1f631a[_0x6e91('0x1a')]?_0x1f631a[_0x6e91('0x1a')][_0x6e91('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f631a[_0x6e91('0x1a')]?_0x1f631a['options'][_0x6e91('0x1c')]||null:null,'attributes':_0x1f631a[_0x6e91('0x1a')]?_0x1f631a[_0x6e91('0x1a')]['attributes']||null:null,'limit':_0x1f631a['options']?_0x1f631a[_0x6e91('0x1a')][_0x6e91('0x1d')]||null:null})[_0x6e91('0xc')](function(_0x35e6ed){logger['info']('UpdateMailApplication',_0x1f631a);logger['debug'](_0x6e91('0x18'),_0x1f631a,JSON[_0x6e91('0x12')](_0x35e6ed));_0x2867b1(_0x35e6ed);})[_0x6e91('0x17')](function(_0x34e5cf){logger[_0x6e91('0x13')](_0x6e91('0x18'),_0x34e5cf[_0x6e91('0x15')],_0x1f631a);_0x4750da(_0x338439[_0x6e91('0x13')](0x1f4,_0x34e5cf[_0x6e91('0x15')]));});});}; \ No newline at end of file +var _0xeb4c=['message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xca1091,_0x539dbf){var _0xd3019c=function(_0xd629e0){while(--_0xd629e0){_0xca1091['push'](_0xca1091['shift']());}};_0xd3019c(++_0x539dbf);}(_0xeb4c,0xc1));var _0xceb4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xeb4c[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xceb4('0x0'));var util=require(_0xceb4('0x1'));var moment=require(_0xceb4('0x2'));var BPromise=require(_0xceb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb4('0x4'))['db'];var utils=require(_0xceb4('0x5'));var logger=require('../../config/logger')(_0xceb4('0x6'));var config=require(_0xceb4('0x7'));var jayson=require(_0xceb4('0x8'));var client=jayson[_0xceb4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b147,_0x105e50,_0x41a06c){return new BPromise(function(_0x80f169,_0x3ea3db){return client['request'](_0x10b147,_0x41a06c)['then'](function(_0x1cc98e){logger[_0xceb4('0xa')](_0xceb4('0xb'),_0x105e50,_0xceb4('0xc'));logger[_0xceb4('0xd')](_0xceb4('0xe'),_0x105e50,_0xceb4('0xc'),JSON['stringify'](_0x1cc98e));if(_0x1cc98e[_0xceb4('0xf')]){if(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x10')]===0x1f4){logger[_0xceb4('0xf')]('MailApplication,\x20%s,\x20%s',_0x105e50,_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);return _0x3ea3db(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);}logger[_0xceb4('0xf')](_0xceb4('0xb'),_0x105e50,_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);return _0x80f169(_0x1cc98e[_0xceb4('0xf')][_0xceb4('0x11')]);}else{logger[_0xceb4('0xa')](_0xceb4('0xb'),_0x105e50,_0xceb4('0xc'));_0x80f169(_0x1cc98e[_0xceb4('0x12')][_0xceb4('0x11')]);}})[_0xceb4('0x13')](function(_0x5cc4ff){logger[_0xceb4('0xf')](_0xceb4('0xb'),_0x105e50,_0x5cc4ff);_0x3ea3db(_0x5cc4ff);});});}exports[_0xceb4('0x14')]=function(_0x4baa5a){var _0x23ebd8=this;return new Promise(function(_0x1c95b8,_0x5b1ca6){return db['MailApplication'][_0xceb4('0x15')](_0x4baa5a[_0xceb4('0x16')],{'raw':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x19')]||null:null,'attributes':_0x4baa5a[_0xceb4('0x17')]?_0x4baa5a['options'][_0xceb4('0x1a')]||null:null,'limit':_0x4baa5a['options']?_0x4baa5a[_0xceb4('0x17')][_0xceb4('0x1b')]||null:null})[_0xceb4('0x1c')](function(_0x57dc62){logger[_0xceb4('0xa')](_0xceb4('0x14'),_0x4baa5a);logger[_0xceb4('0xd')](_0xceb4('0x14'),_0x4baa5a,JSON[_0xceb4('0x1d')](_0x57dc62));_0x1c95b8(_0x57dc62);})[_0xceb4('0x13')](function(_0x5bd9c0){logger[_0xceb4('0xf')]('UpdateMailApplication',_0x5bd9c0['message'],_0x4baa5a);_0x5b1ca6(_0x23ebd8['error'](0x1f4,_0x5bd9c0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0c9b11d..a1c7779 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 _0x6ea4=['isAuthenticated','index','get','/describe','describe','/:id','show','getMessages','download','post','addMessage','/:id/tags','tracked','put','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller'];(function(_0x59bca2,_0x4936e9){var _0x435b36=function(_0x5c2924){while(--_0x5c2924){_0x59bca2['push'](_0x59bca2['shift']());}};_0x435b36(++_0x4936e9);}(_0x6ea4,0xf6));var _0x46ea=function(_0x46ac13,_0x38c214){_0x46ac13=_0x46ac13-0x0;var _0x2ffe09=_0x6ea4[_0x46ac13];return _0x2ffe09;};'use strict';var express=require(_0x46ea('0x0'));var router=express['Router']();var auth=require(_0x46ea('0x1'));var interaction=require(_0x46ea('0x2'));var controller=require(_0x46ea('0x3'));router['get']('/',auth[_0x46ea('0x4')](),controller[_0x46ea('0x5')]);router[_0x46ea('0x6')](_0x46ea('0x7'),auth[_0x46ea('0x4')](),controller[_0x46ea('0x8')]);router[_0x46ea('0x6')](_0x46ea('0x9'),auth[_0x46ea('0x4')](),controller[_0x46ea('0xa')]);router['get']('/:id/messages',auth[_0x46ea('0x4')](),controller[_0x46ea('0xb')]);router[_0x46ea('0x6')]('/:id/download',auth[_0x46ea('0x4')](),controller[_0x46ea('0xc')]);router['post']('/',auth[_0x46ea('0x4')](),controller['create']);router[_0x46ea('0xd')]('/:id/messages',auth[_0x46ea('0x4')](),controller[_0x46ea('0xe')]);router['post'](_0x46ea('0xf'),auth[_0x46ea('0x4')](),interaction[_0x46ea('0x10')]('mail','mailinteraction:addtags'),controller['addTags']);router[_0x46ea('0x11')](_0x46ea('0x9'),auth[_0x46ea('0x4')](),interaction[_0x46ea('0x10')](_0x46ea('0x12'),_0x46ea('0x13')),controller[_0x46ea('0x14')]);router['delete'](_0x46ea('0x9'),auth[_0x46ea('0x4')](),interaction[_0x46ea('0x10')](_0x46ea('0x12'),_0x46ea('0x15')),controller[_0x46ea('0x16')]);router[_0x46ea('0x17')](_0x46ea('0xf'),auth[_0x46ea('0x4')](),controller[_0x46ea('0x18')]);module['exports']=router; \ No newline at end of file +var _0x686b=['/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x18e9a3,_0x276495){var _0x214569=function(_0x16ba45){while(--_0x16ba45){_0x18e9a3['push'](_0x18e9a3['shift']());}};_0x214569(++_0x276495);}(_0x686b,0xc2));var _0xb686=function(_0x46917f,_0x746c06){_0x46917f=_0x46917f-0x0;var _0x49b6fb=_0x686b[_0x46917f];return _0x49b6fb;};'use strict';var express=require(_0xb686('0x0'));var router=express['Router']();var auth=require(_0xb686('0x1'));var interaction=require(_0xb686('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb686('0x3')]);router[_0xb686('0x4')](_0xb686('0x5'),auth[_0xb686('0x6')](),controller['describe']);router['get'](_0xb686('0x7'),auth[_0xb686('0x6')](),controller['show']);router[_0xb686('0x4')](_0xb686('0x8'),auth['isAuthenticated'](),controller[_0xb686('0x9')]);router[_0xb686('0x4')](_0xb686('0xa'),auth[_0xb686('0x6')](),controller[_0xb686('0xb')]);router[_0xb686('0xc')]('/',auth['isAuthenticated'](),controller[_0xb686('0xd')]);router[_0xb686('0xc')](_0xb686('0x8'),auth[_0xb686('0x6')](),controller['addMessage']);router[_0xb686('0xc')](_0xb686('0xe'),auth[_0xb686('0x6')](),interaction[_0xb686('0xf')](_0xb686('0x10'),_0xb686('0x11')),controller[_0xb686('0x12')]);router[_0xb686('0x13')](_0xb686('0x7'),auth[_0xb686('0x6')](),interaction['tracked'](_0xb686('0x10'),_0xb686('0x14')),controller[_0xb686('0x15')]);router[_0xb686('0x16')]('/:id',auth[_0xb686('0x6')](),interaction[_0xb686('0xf')](_0xb686('0x10'),_0xb686('0x17')),controller[_0xb686('0x18')]);router['delete']('/:id/tags',auth[_0xb686('0x6')](),controller[_0xb686('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 87a4bbd..e171397 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 _0xe1b7=['long','DATE','out','sequelize','exports','BOOLEAN','STRING','TEXT'];(function(_0x33b8d6,_0x4d39c9){var _0x31f42c=function(_0x4bea9d){while(--_0x4bea9d){_0x33b8d6['push'](_0x33b8d6['shift']());}};_0x31f42c(++_0x4d39c9);}(_0xe1b7,0x1bb));var _0x7e1b=function(_0xc6e4ea,_0x35edbe){_0xc6e4ea=_0xc6e4ea-0x0;var _0x76c775=_0xe1b7[_0xc6e4ea];return _0x76c775;};'use strict';var Sequelize=require(_0x7e1b('0x0'));var iconv=require('iconv');module[_0x7e1b('0x1')]={'closed':{'type':Sequelize[_0x7e1b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7e1b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7e1b('0x3')]},'note':{'type':Sequelize[_0x7e1b('0x3')]},'inReplyTo':{'type':Sequelize[_0x7e1b('0x3')](0x1fe)},'to':{'type':Sequelize[_0x7e1b('0x3')]},'cc':{'type':Sequelize[_0x7e1b('0x4')](_0x7e1b('0x5'))},'subject':{'type':Sequelize[_0x7e1b('0x4')]()},'attach':{'type':Sequelize[_0x7e1b('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7e1b('0x6')]},'substatus':{'type':Sequelize[_0x7e1b('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x7e1b('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7e1b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7e1b('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7e1b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7e1b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x63be=['BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','exports'];(function(_0x38c18b,_0x2871fe){var _0x32ff9a=function(_0x408252){while(--_0x408252){_0x38c18b['push'](_0x38c18b['shift']());}};_0x32ff9a(++_0x2871fe);}(_0x63be,0xd7));var _0xe63b=function(_0xef073e,_0x3d69c7){_0xef073e=_0xef073e-0x0;var _0x56ddf9=_0x63be[_0xef073e];return _0x56ddf9;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xe63b('0x0')]={'closed':{'type':Sequelize[_0xe63b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe63b('0x2')]},'secondDisposition':{'type':Sequelize[_0xe63b('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe63b('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe63b('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe63b('0x3')](_0xe63b('0x4'))},'subject':{'type':Sequelize[_0xe63b('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe63b('0x5')]},'substatus':{'type':Sequelize[_0xe63b('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xe63b('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xe63b('0x6')]('in',_0xe63b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe63b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xe63b('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe63b('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f6e62ab..acbe5d6 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 _0xa0a1=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','params','filters','includeAll','include','merge','options','create','body','describe','addMessage','ids','getMessages','nolimit','pick','inlineCss','true','rows','setTags','spread','findAll','emit','mailInteractionTags:save','removeTags','unix','join','server','files','attachments','Attachments','Messages','bcc','createdAt','get','each','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','zip-dir','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','trimStart','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','MailInteraction','rawAttributes','fieldName','type','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','mail_interactions','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','value','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring'];(function(_0x400203,_0x1a9927){var _0xc4345=function(_0x3ba29e){while(--_0x3ba29e){_0x400203['push'](_0x400203['shift']());}};_0xc4345(++_0x1a9927);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x49c2e5,_0x550528){_0x49c2e5=_0x49c2e5-0x0;var _0xf208df=_0xa0a1[_0x49c2e5];return _0xf208df;};'use strict';var emlformat=require(_0x1a0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0a('0x1'));var moment=require(_0x1a0a('0x2'));var BPromise=require(_0x1a0a('0x3'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x1a0a('0x4'));var squel=require(_0x1a0a('0x5'));var juice=require('juice');var Redis=require(_0x1a0a('0x6'));var qs=require(_0x1a0a('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x1a0a('0x8'))(_0x1a0a('0x9'));var config=require(_0x1a0a('0xa'));var db=require(_0x1a0a('0xb'))['db'];var htmlEntities=require(_0x1a0a('0xc'));config['redis']=_[_0x1a0a('0xd')](config[_0x1a0a('0xe')],{'host':_0x1a0a('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailInteraction.socket')[_0x1a0a('0x10')](socket);function respondWithStatusCode(_0xf92e83,_0x283534){_0x283534=_0x283534||0xcc;return function(_0x490625){if(_0x490625){return _0xf92e83[_0x1a0a('0x11')](_0x283534);}return _0xf92e83['status'](_0x283534)[_0x1a0a('0x12')]();};}function respondWithResult(_0x111e90,_0x461b36){_0x461b36=_0x461b36||0xc8;return function(_0x1877bf){if(_0x1877bf){return _0x111e90[_0x1a0a('0x13')](_0x461b36)[_0x1a0a('0x14')](_0x1877bf);}};}function respondWithFilteredResult(_0x3f34d2,_0x4f2b35){return function(_0x88d191){if(_0x88d191){var _0x3b0b2d=typeof _0x4f2b35[_0x1a0a('0x15')]===_0x1a0a('0x16')&&typeof _0x4f2b35[_0x1a0a('0x17')]==='undefined';var _0x16b8c9=_0x88d191[_0x1a0a('0x18')];var _0x157b74=_0x3b0b2d?0x0:_0x4f2b35['offset'];var _0x326e59=_0x3b0b2d?_0x88d191['count']:_0x4f2b35[_0x1a0a('0x15')]+_0x4f2b35['limit'];var _0x54bfbe;if(_0x326e59>=_0x16b8c9){_0x326e59=_0x16b8c9;_0x54bfbe=0xc8;}else{_0x54bfbe=0xce;}_0x3f34d2[_0x1a0a('0x13')](_0x54bfbe);return _0x3f34d2[_0x1a0a('0x19')](_0x1a0a('0x1a'),_0x157b74+'-'+_0x326e59+'/'+_0x16b8c9)[_0x1a0a('0x14')](_0x88d191);}return null;};}function saveUpdates(_0x4d11a4){return function(_0x56b8a5){if(_0x56b8a5){return _0x56b8a5[_0x1a0a('0x1b')](_0x4d11a4)[_0x1a0a('0x1c')](function(_0xfa74ce){return _0xfa74ce;});}return null;};}function removeEntity(_0x5b2884){return function(_0x1976ba){if(_0x1976ba){return _0x1976ba[_0x1a0a('0x1d')]()['then'](function(){_0x5b2884[_0x1a0a('0x13')](0xcc)[_0x1a0a('0x12')]();});}};}function handleEntityNotFound(_0x316ae3){return function(_0x53e569){if(!_0x53e569){_0x316ae3[_0x1a0a('0x11')](0x194);}return _0x53e569;};}function handleError(_0xc33284,_0x1f4083){_0x1f4083=_0x1f4083||0x1f4;return function(_0x54e64e){logger[_0x1a0a('0x1e')](_0x54e64e['stack']);if(_0x54e64e[_0x1a0a('0x1f')]){delete _0x54e64e[_0x1a0a('0x1f')];}_0xc33284[_0x1a0a('0x13')](_0x1f4083)[_0x1a0a('0x20')](_0x54e64e);};}function getInteractionUsers(_0x35e411,_0x578995){return new BPromise(function(_0x1e2b28,_0x8e4151){try{if(_0x578995[_0x35e411['id']]){_0x35e411['Users']=_['map'](_0x578995[_0x35e411['id']],function(_0x55065f){return{'id':_0x55065f['id'],'fullname':_0x55065f[_0x1a0a('0x21')]};});}}catch(_0x3f61e4){_0x8e4151(_0x3f61e4);}_0x1e2b28(_0x35e411);});}function getInteractionTags(_0x365ab5,_0x4483a3){return new BPromise(function(_0x244bbf,_0x338e8c){try{if(_0x365ab5[_0x1a0a('0x22')]){_0x365ab5[_0x1a0a('0x23')]=[];_0x365ab5[_0x1a0a('0x22')][_0x1a0a('0x24')](',')[_0x1a0a('0x25')](function(_0x354d89){_0x365ab5[_0x1a0a('0x23')][_0x1a0a('0x26')](_0x4483a3[_0x354d89]);});}delete _0x365ab5[_0x1a0a('0x22')];}catch(_0x297b12){_0x338e8c(_0x297b12);}_0x244bbf(_0x365ab5);});}function getLastMessageText(_0x4d44b0){return new BPromise(function(_0x2efcbc,_0x40916e){return db[_0x1a0a('0x27')][_0x1a0a('0x28')]({'where':{'$and':[{'MailInteractionId':_0x4d44b0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1a0a('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1a0a('0x2a')],'order':_0x1a0a('0x2b'),'raw':!![]})[_0x1a0a('0x1c')](function(_0x16a862){if(_0x16a862&&_0x16a862[_0x1a0a('0x2a')]){_0x4d44b0['lastMsgText']=_[_0x1a0a('0x2c')](_0x16a862[_0x1a0a('0x2a')]);}_0x2efcbc(_0x4d44b0);})['catch'](function(_0x14cdbf){_0x40916e(_0x14cdbf);});});}function updateMailInteraction(_0x4e6fb3,_0x5cab26,_0x2a811c,_0x38c7f3){return new BPromise(function(_0x4fd7b9,_0xe9727d){return getInteractionUsers(_0x4e6fb3,_0x2a811c)[_0x1a0a('0x1c')](function(_0x193861){return getInteractionTags(_0x193861,_0x5cab26);})['then'](function(_0x3b5440){return getStateInteraction(_0x3b5440);})[_0x1a0a('0x1c')](function(_0x4a995e){if(_0x38c7f3){_0x4fd7b9(getLastMessageText(_0x4a995e));}else{_0x4fd7b9(_0x4a995e);}})[_0x1a0a('0x2d')](function(_0x20084d){_0xe9727d(_0x20084d);});});}function getStateInteraction(_0x5e8da2){return new BPromise(function(_0x87d28e){_0x5e8da2[_0x1a0a('0x2e')]=0x0;_0x5e8da2[_0x1a0a('0x2f')]=0x0;_0x5e8da2[_0x1a0a('0x30')]=0x0;_0x5e8da2['unmanaged']=0x0;_0x5e8da2[_0x1a0a('0x31')]=0x0;if(!_0x5e8da2[_0x1a0a('0x32')]&&!_0x5e8da2[_0x1a0a('0x33')]){_0x5e8da2[_0x1a0a('0x2e')]+=0x1;}if(!_0x5e8da2[_0x1a0a('0x32')]&&_0x5e8da2[_0x1a0a('0x33')]){_0x5e8da2[_0x1a0a('0x2f')]+=0x1;if(_0x5e8da2[_0x1a0a('0x2e')]){_0x5e8da2[_0x1a0a('0x2e')]-=0x1;}}if(_0x5e8da2['closed']&&_0x5e8da2['UserId']){_0x5e8da2['answered']+=0x1;if(_0x5e8da2['talking']){_0x5e8da2[_0x1a0a('0x2f')]-=0x1;}}if(_0x5e8da2['closed']&&!_0x5e8da2[_0x1a0a('0x33')]){_0x5e8da2[_0x1a0a('0x34')]+=0x1;if(_0x5e8da2['waiting']){_0x5e8da2['waiting']-=0x1;}}_0x5e8da2[_0x1a0a('0x31')]+=0x1;_0x87d28e(_0x5e8da2);});}exports[_0x1a0a('0x35')]=function(_0x13042e,_0x230ed3){var _0x4e3960={},_0x250dd5={},_0x5ea169={'count':0x0,'rows':[]};var _0x5aff39=_['map'](db[_0x1a0a('0x36')][_0x1a0a('0x37')],function(_0x543cc9){return{'name':_0x543cc9[_0x1a0a('0x38')],'type':_0x543cc9[_0x1a0a('0x39')]['key']};});_0x250dd5['model']=_[_0x1a0a('0x3a')](_0x5aff39,_0x1a0a('0x1f'));_0x250dd5['query']=_[_0x1a0a('0x3b')](_0x13042e[_0x1a0a('0x3c')]);_0x250dd5['filters']=_[_0x1a0a('0x3d')](_0x250dd5['model'],_0x250dd5[_0x1a0a('0x3c')]);_0x4e3960['attributes']=_[_0x1a0a('0x3d')](_0x250dd5[_0x1a0a('0x3e')],qs[_0x1a0a('0x3f')](_0x13042e[_0x1a0a('0x3c')]['fields']));_0x4e3960[_0x1a0a('0x40')]=_0x4e3960[_0x1a0a('0x40')][_0x1a0a('0x41')]?_0x4e3960[_0x1a0a('0x40')]:_0x250dd5['model'];if(!_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x42')]('nolimit')){_0x4e3960[_0x1a0a('0x17')]=qs[_0x1a0a('0x17')](_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x17')]);_0x4e3960[_0x1a0a('0x15')]=qs[_0x1a0a('0x15')](_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x15')]);}_0x4e3960[_0x1a0a('0x43')]=qs[_0x1a0a('0x44')](_0x13042e['query'][_0x1a0a('0x44')]);_0x4e3960[_0x1a0a('0x45')]=qs['filters'](_['pick'](_0x13042e['query'],_0x250dd5['filters']),_0x5aff39);var _0x455f57=[];var _0x190bf9=squel['select']()['field']('id')['field'](_0x1a0a('0x1f'))[_0x1a0a('0x46')](_0x1a0a('0x47'))[_0x1a0a('0x48')](_0x1a0a('0x49'));var _0x167a5e=squel[_0x1a0a('0x4a')]()[_0x1a0a('0x46')](_0x1a0a('0x4b'))[_0x1a0a('0x46')](_0x1a0a('0x4c'))[_0x1a0a('0x46')](_0x1a0a('0x4d'))['from'](_0x1a0a('0x4e'),'ui')[_0x1a0a('0x4f')](_0x1a0a('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x14b07a=squel[_0x1a0a('0x4a')]()['from'](_0x1a0a('0x51'),'i')[_0x1a0a('0x4f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1a0a('0x4f')]('users','o','o.id\x20=\x20i.UserId')[_0x1a0a('0x4f')]('mail_accounts','a',_0x1a0a('0x52'))[_0x1a0a('0x4f')](_0x1a0a('0x53'),'me',_0x1a0a('0x54'))[_0x1a0a('0x4f')](_0x1a0a('0x55'),'it',_0x1a0a('0x56'))[_0x1a0a('0x4f')](_0x1a0a('0x49'),'t',_0x1a0a('0x57'));var _0x5c833a=squel[_0x1a0a('0x58')]();var _0x5bf33b=[];var _0x9e897f=squel[_0x1a0a('0x58')]();var _0x4883ca;if(_0x13042e['query'][_0x1a0a('0x59')]){_0x4883ca=as[_0x1a0a('0x5a')](_0x13042e['query']['search']);var _0x9d335e=_0x4883ca['sqlOperator'];for(var _0x339b6c=0x0;_0x339b6c<_0x4883ca[_0x1a0a('0x5b')]['length'];_0x339b6c++){var _0x33cbcd=_0x4883ca['conditions'][_0x339b6c];var _0x243a40='i';var _0x405d56=_['find'](_0x5aff39,[_0x1a0a('0x1f'),_0x33cbcd[_0x1a0a('0x46')]]);if(!_0x405d56){switch(_0x33cbcd[_0x1a0a('0x46')]){case'unreadMessages':if(_0x33cbcd[_0x1a0a('0x5c')]==0x1){_0x14b07a[_0x1a0a('0x5d')]('`'+_0x33cbcd['field']+'`\x20=\x200');}else{_0x14b07a[_0x1a0a('0x5d')]('`'+_0x33cbcd[_0x1a0a('0x46')]+_0x1a0a('0x5e'));}break;case _0x1a0a('0x5f'):if(_0x33cbcd['operator']==='$substring'){if(_0x33cbcd['value'][_0x1a0a('0x24')]('\x20')['length']>0x1){_0x5c833a[_0x9d335e](_0x1a0a('0x60'),qs[_0x1a0a('0x61')](_0x33cbcd[_0x1a0a('0x5c')]),null);}else{var _0x1f9746='%'+_0x33cbcd[_0x1a0a('0x5c')]+'%';_0x5c833a[_0x9d335e](_0x1a0a('0x62'),_0x1f9746,_0x1f9746,_0x1f9746);}}else{_0x405d56=_[_0x1a0a('0x63')](_0x5aff39,[_0x1a0a('0x1f'),_0x1a0a('0x64')]);_0x33cbcd[_0x1a0a('0x46')]=_0x1a0a('0x64');_0x2347a9=as[_0x1a0a('0x65')](_0x243a40,_0x405d56[_0x1a0a('0x39')],_0x33cbcd);_0x5c833a[_0x9d335e](_0x2347a9[_0x1a0a('0x66')],_0x2347a9[_0x1a0a('0x5c')]['start'],_0x2347a9[_0x1a0a('0x5c')][_0x1a0a('0x12')]);}break;case _0x1a0a('0x67'):var _0x12c628=_0x33cbcd['value'][_0x1a0a('0x24')](',')[_0x1a0a('0x3a')](function(_0x436c2c){return Number(_0x436c2c);});_0x12c628[_0x1a0a('0x25')](function(_0x228151){_0x9e897f['or'](_0x1a0a('0x68'),'%,'+_0x228151+',%');});_0x5bf33b=_[_0x1a0a('0x69')](_0x5bf33b,_0x12c628);break;case _0x1a0a('0x6a'):if(_0x33cbcd[_0x1a0a('0x6b')]===_0x1a0a('0x6c')){_0x5c833a[_0x9d335e](_0x1a0a('0x6d'),'%'+_0x33cbcd['value']+'%',null);}else{_0x405d56=_[_0x1a0a('0x63')](_0x5aff39,['name',_0x1a0a('0x33')]);_0x33cbcd['field']=_0x1a0a('0x33');_0x2347a9=as[_0x1a0a('0x65')](_0x243a40,_0x405d56[_0x1a0a('0x39')],_0x33cbcd);_0x5c833a[_0x9d335e](_0x2347a9[_0x1a0a('0x66')],_0x2347a9[_0x1a0a('0x5c')]['start'],_0x2347a9[_0x1a0a('0x5c')][_0x1a0a('0x12')]);}break;case _0x1a0a('0x2a'):_0x2347a9=as[_0x1a0a('0x65')]('me',null,_0x33cbcd);_0x5c833a[_0x9d335e](_0x2347a9[_0x1a0a('0x66')],_0x2347a9[_0x1a0a('0x5c')][_0x1a0a('0x6e')],_0x2347a9['value'][_0x1a0a('0x12')]);break;}}else{var _0x2347a9=as[_0x1a0a('0x65')](_0x243a40,_0x405d56['type'],_0x33cbcd);_0x5c833a[_0x9d335e](_0x2347a9['text'],_0x2347a9[_0x1a0a('0x5c')][_0x1a0a('0x6e')],_0x2347a9[_0x1a0a('0x5c')][_0x1a0a('0x12')]);}}}else{var _0x3e30a8=_(_0x13042e['query'])[_0x1a0a('0x3b')]()[_0x1a0a('0x3a')](function(_0x21b267){return _['some'](_0x5aff39,[_0x1a0a('0x1f'),_0x21b267])?_0x21b267:undefined;})[_0x1a0a('0x6f')]()[_0x1a0a('0x5c')]();if(!_[_0x1a0a('0x70')](_0x3e30a8)){_0x3e30a8[_0x1a0a('0x25')](function(_0x26246f){if(_0x26246f===_0x1a0a('0x71')){_0x14b07a['where'](_0x1a0a('0x72'),[][_0x1a0a('0x73')](_0x13042e[_0x1a0a('0x3c')][_0x26246f]));}else if(_0x26246f==='createdAt'){var _0x823c0e=JSON[_0x1a0a('0x74')](_0x13042e[_0x1a0a('0x3c')][_0x26246f])[_0x1a0a('0x75')];var _0xec020d=JSON[_0x1a0a('0x74')](_0x13042e[_0x1a0a('0x3c')][_0x26246f])['$lte'];_0x14b07a[_0x1a0a('0x45')](_0x1a0a('0x76'),_0x823c0e,_0xec020d);}else{if(_0x13042e[_0x1a0a('0x3c')][_0x26246f]===_0x1a0a('0x77')){_0x14b07a[_0x1a0a('0x45')]('i.'+_0x26246f+_0x1a0a('0x78'));}else{_0x14b07a[_0x1a0a('0x45')]('i.'+_0x26246f+_0x1a0a('0x79'),_0x13042e[_0x1a0a('0x3c')][_0x26246f]);}}});}if(_0x13042e['query'][_0x1a0a('0x7a')]){if(_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x7a')]==0x1){_0x14b07a[_0x1a0a('0x5d')](_0x1a0a('0x7b'));}else{_0x14b07a['having'](_0x1a0a('0x7c'));}}if(_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x7d')]){_0x5bf33b=_[_0x1a0a('0x7e')](_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x7d')])?_0x13042e['query']['tag']:new Array(_0x13042e['query'][_0x1a0a('0x7d')]);_0x5bf33b[_0x1a0a('0x25')](function(_0x3746d5){_0x9e897f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3746d5+',%');});}if(_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x7f')]){var _0x727fa3=_0x13042e['query'][_0x1a0a('0x7f')][_0x1a0a('0x80')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1a0a('0x81')](_0x727fa3)){_0x5c833a['or']('i.id\x20LIKE\x20?',_0x727fa3+'%');}else if(qs['isEmail'](_0x727fa3)){_0x5c833a['or'](_0x1a0a('0x82'),_0x727fa3+'%');}else{_0x5c833a['or'](_0x1a0a('0x83'),qs[_0x1a0a('0x61')](_0x727fa3))['or'](_0x1a0a('0x84'),qs[_0x1a0a('0x61')](_0x727fa3));}}}_0x14b07a[_0x1a0a('0x45')](_0x5c833a);_0x14b07a[_0x1a0a('0x85')](_0x1a0a('0x86'));var _0x51d91f={'type':db[_0x1a0a('0x87')][_0x1a0a('0x88')][_0x1a0a('0x89')],'raw':!![]};var _0x5420cc=_0x14b07a[_0x1a0a('0x8a')]();_0x5420cc[_0x1a0a('0x46')](_0x1a0a('0x86'));_0x5420cc[_0x1a0a('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1a0a('0x8b'));if(_0x4e3960['order']){_0x4e3960[_0x1a0a('0x43')]['forEach'](function(_0x5dc51a){var _0x17071b=_0x5dc51a[0x0]===_0x1a0a('0x8c')?_0x5dc51a[0x0]:'i.'+_0x5dc51a[0x0];_0x14b07a[_0x1a0a('0x43')](_0x17071b,_0x5dc51a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1a0a('0x70')](_0x5bf33b)){_0x14b07a[_0x1a0a('0x5d')](_0x9e897f);_0x5420cc[_0x1a0a('0x45')](_0x1a0a('0x8d'),_0x5bf33b);}BPromise['resolve']()[_0x1a0a('0x1c')](function(){if(!_0x4883ca){if(_0x13042e[_0x1a0a('0x3c')][_0x1a0a('0x71')])return;_0x5420cc['where'](_0x1a0a('0x8e'));_0x14b07a[_0x1a0a('0x45')](_0x1a0a('0x8e'));return;}if(_0x13042e[_0x1a0a('0x8f')][_0x1a0a('0x90')]!==_0x1a0a('0x91'))return;return _0x13042e[_0x1a0a('0x8f')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x1a0a('0x1c')](function(_0x4ded44){if(_[_0x1a0a('0x70')](_0x4ded44)){_0x5420cc[_0x1a0a('0x45')]('i.MailAccountId\x20IS\x20NULL');_0x14b07a['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x5420cc[_0x1a0a('0x45')]('i.MailAccountId\x20IN\x20?',_[_0x1a0a('0x3a')](_0x4ded44,'id'));_0x14b07a[_0x1a0a('0x45')](_0x1a0a('0x72'),_['map'](_0x4ded44,'id'));}});})['then'](function(){if(_0x13042e[_0x1a0a('0x8f')][_0x1a0a('0x90')]==='agent'&&!_0x4883ca&&!_0x13042e['query'][_0x1a0a('0x71')])return[];return db[_0x1a0a('0x92')][_0x1a0a('0x3c')](_0x5420cc[_0x1a0a('0x93')](),_0x51d91f);})[_0x1a0a('0x1c')](function(_0x13457d){_0x5ea169['count']=_0x13457d[_0x1a0a('0x41')];if(_0x5ea169[_0x1a0a('0x18')]===0x0)return[];return db['sequelize'][_0x1a0a('0x3c')](_0x190bf9['toString'](),_0x51d91f)[_0x1a0a('0x1c')](function(_0x48c39f){_0x455f57=_['keyBy'](_0x48c39f,'id');_0x51d91f=_['merge'](_0x51d91f,{'model':db[_0x1a0a('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13042e['query']['fields']){_0x4e3960[_0x1a0a('0x40')][_0x1a0a('0x25')](function(_0x5f3fe6){_0x14b07a[_0x1a0a('0x46')]('i.'+_0x5f3fe6);});}else{_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x94'),_0x1a0a('0x8b'));_0x14b07a['field'](_0x1a0a('0x95'),'Account.key');_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x96'),_0x1a0a('0x97'));_0x14b07a['field']('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',_0x1a0a('0x8c'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x86'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x98'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x99'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x9a'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x9b'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x9c'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x9d'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x9e'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0x9f'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xa0'));_0x14b07a[_0x1a0a('0x46')]('i.secondDisposition');_0x14b07a[_0x1a0a('0x46')]('i.thirdDisposition');_0x14b07a[_0x1a0a('0x46')]('i.substatus');_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xa1'));_0x14b07a['field']('i.ContactId');_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xa2'));_0x14b07a[_0x1a0a('0x46')]('i.UserId');_0x14b07a['field'](_0x1a0a('0xa3'),_0x1a0a('0xa4'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xa5'),'Contact.lastName');_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xa6'),_0x1a0a('0xa7'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xa8'),_0x1a0a('0xa9'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xaa'),_0x1a0a('0xab'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xac'),_0x1a0a('0xad'));_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xae'),_0x1a0a('0xaf'));_0x14b07a[_0x1a0a('0x46')]('o.internal','Owner.internal');_0x14b07a[_0x1a0a('0x46')](_0x1a0a('0xb0'),'TagIds');}if(_0x4e3960[_0x1a0a('0x17')])_0x14b07a[_0x1a0a('0x17')](_0x4e3960[_0x1a0a('0x17')]);if(_0x4e3960[_0x1a0a('0x15')])_0x14b07a[_0x1a0a('0x15')](_0x4e3960['offset']);return db[_0x1a0a('0x92')][_0x1a0a('0x3c')](_0x14b07a[_0x1a0a('0x93')](),_0x51d91f);})[_0x1a0a('0x1c')](function(_0x43b67d){if(_0x43b67d['length']>0x0)_0x167a5e['where'](_0x1a0a('0xb1'),_[_0x1a0a('0x3a')](_0x43b67d,'id'));return db[_0x1a0a('0x92')]['query'](_0x167a5e['toString'](),_0x51d91f)[_0x1a0a('0x1c')](function(_0x123321){var _0x13a713=_[_0x1a0a('0xb2')](_0x123321,_0x1a0a('0xb3'));var _0x2462dd=[];return db[_0x1a0a('0xb4')][_0x1a0a('0x28')]({'attributes':[_0x1a0a('0xb5')],'raw':!![]})[_0x1a0a('0x1c')](function(_0x29f6f4){var _0x577bfe=_0x29f6f4['enableEmailPreview'];_0x43b67d['forEach'](function(_0x28898a){_0x2462dd[_0x1a0a('0x26')](updateMailInteraction(_0x28898a,_0x455f57,_0x13a713,_0x577bfe));});return BPromise[_0x1a0a('0xb6')](_0x2462dd);});});});})[_0x1a0a('0x1c')](function(_0x31d7ce){_0x5ea169['rows']=_0x31d7ce;return _0x5ea169;})[_0x1a0a('0x1c')](respondWithFilteredResult(_0x230ed3,_0x4e3960))[_0x1a0a('0x2d')](handleError(_0x230ed3,null));};exports['show']=function(_0x1d17ac,_0x1d243a){var _0x2f7108={'raw':![],'where':{'id':_0x1d17ac[_0x1a0a('0xb7')]['id']}},_0x2e3800={};_0x2e3800[_0x1a0a('0x3e')]=_[_0x1a0a('0x3b')](db['MailInteraction']['rawAttributes']);_0x2e3800[_0x1a0a('0x3c')]=_[_0x1a0a('0x3b')](_0x1d17ac['query']);_0x2e3800[_0x1a0a('0xb8')]=_[_0x1a0a('0x3d')](_0x2e3800[_0x1a0a('0x3e')],_0x2e3800[_0x1a0a('0x3c')]);_0x2f7108[_0x1a0a('0x40')]=_[_0x1a0a('0x3d')](_0x2e3800['model'],qs[_0x1a0a('0x3f')](_0x1d17ac[_0x1a0a('0x3c')]['fields']));_0x2f7108[_0x1a0a('0x40')]=_0x2f7108[_0x1a0a('0x40')][_0x1a0a('0x41')]?_0x2f7108[_0x1a0a('0x40')]:_0x2e3800[_0x1a0a('0x3e')];if(_0x1d17ac[_0x1a0a('0x3c')][_0x1a0a('0xb9')]){_0x2f7108[_0x1a0a('0xba')]=[{'all':!![]}];}_0x2f7108=_[_0x1a0a('0xbb')]({},_0x2f7108,_0x1d17ac[_0x1a0a('0xbc')]);return db[_0x1a0a('0x36')][_0x1a0a('0x63')](_0x2f7108)[_0x1a0a('0x1c')](handleEntityNotFound(_0x1d243a,null))[_0x1a0a('0x1c')](respondWithResult(_0x1d243a,null))[_0x1a0a('0x2d')](handleError(_0x1d243a,null));};exports[_0x1a0a('0xbd')]=function(_0x14a384,_0x1dd96b){return db['MailInteraction'][_0x1a0a('0xbd')](_0x14a384[_0x1a0a('0xbe')],{})[_0x1a0a('0x1c')](respondWithResult(_0x1dd96b,0xc9))[_0x1a0a('0x2d')](handleError(_0x1dd96b,null));};exports['update']=function(_0x46efd6,_0xf22d59){if(_0x46efd6['body']['id']){delete _0x46efd6['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x46efd6[_0x1a0a('0xb7')]['id']}})[_0x1a0a('0x1c')](handleEntityNotFound(_0xf22d59,null))[_0x1a0a('0x1c')](saveUpdates(_0x46efd6[_0x1a0a('0xbe')],null))[_0x1a0a('0x1c')](respondWithResult(_0xf22d59,null))[_0x1a0a('0x2d')](handleError(_0xf22d59,null));};exports[_0x1a0a('0x1d')]=function(_0x1ffdfd,_0x281077){return db[_0x1a0a('0x36')][_0x1a0a('0x63')]({'where':{'id':_0x1ffdfd[_0x1a0a('0xb7')]['id']}})[_0x1a0a('0x1c')](handleEntityNotFound(_0x281077,null))[_0x1a0a('0x1c')](removeEntity(_0x281077,null))['catch'](handleError(_0x281077,null));};exports['describe']=function(_0x354ebf,_0x3e0c53){return db[_0x1a0a('0x36')][_0x1a0a('0xbf')]()[_0x1a0a('0x1c')](respondWithResult(_0x3e0c53,null))[_0x1a0a('0x2d')](handleError(_0x3e0c53,null));};exports[_0x1a0a('0xc0')]=function(_0xa97abe,_0x44720c){return db[_0x1a0a('0x27')]['find']({'where':{'id':_0xa97abe[_0x1a0a('0xb7')]['id']}})['then'](handleEntityNotFound(_0x44720c,null))[_0x1a0a('0x1c')](function(_0x403c50){if(_0x403c50){return _0x403c50[_0x1a0a('0xc0')](_0xa97abe[_0x1a0a('0xbe')][_0x1a0a('0xc1')],_['omit'](_0xa97abe[_0x1a0a('0xbe')],[_0x1a0a('0xc1'),'id'])||{});}})[_0x1a0a('0x1c')](respondWithResult(_0x44720c,null))[_0x1a0a('0x2d')](handleError(_0x44720c,null));};exports[_0x1a0a('0xc2')]=function(_0x3cb740,_0x10dff2){var _0x486ba2={'raw':![],'where':{}};var _0xb4bf33={};var _0xb1dcc0={'count':0x0,'rows':[]};return db[_0x1a0a('0x36')]['findOne']({'where':{'id':_0x3cb740['params']['id']}})[_0x1a0a('0x1c')](handleEntityNotFound(_0x10dff2,null))[_0x1a0a('0x1c')](function(_0x55645c){if(_0x55645c){_0xb4bf33[_0x1a0a('0x3e')]=_[_0x1a0a('0x3b')](db['MailMessage'][_0x1a0a('0x37')]);_0xb4bf33['query']=_[_0x1a0a('0x3b')](_0x3cb740[_0x1a0a('0x3c')]);_0xb4bf33['filters']=_['intersection'](_0xb4bf33[_0x1a0a('0x3e')],_0xb4bf33[_0x1a0a('0x3c')]);_0x486ba2[_0x1a0a('0x40')]=_['intersection'](_0xb4bf33[_0x1a0a('0x3e')],qs['fields'](_0x3cb740[_0x1a0a('0x3c')][_0x1a0a('0x3f')]));_0x486ba2[_0x1a0a('0x40')]=_0x486ba2[_0x1a0a('0x40')]['length']?_0x486ba2[_0x1a0a('0x40')]:_0xb4bf33[_0x1a0a('0x3e')];if(!_0x3cb740[_0x1a0a('0x3c')]['hasOwnProperty'](_0x1a0a('0xc3'))){_0x486ba2[_0x1a0a('0x17')]=qs['limit'](_0x3cb740[_0x1a0a('0x3c')][_0x1a0a('0x17')]);_0x486ba2[_0x1a0a('0x15')]=qs[_0x1a0a('0x15')](_0x3cb740[_0x1a0a('0x3c')]['offset']);}_0x486ba2[_0x1a0a('0x43')]=qs[_0x1a0a('0x44')](_0x3cb740[_0x1a0a('0x3c')][_0x1a0a('0x44')]);_0x486ba2[_0x1a0a('0x45')]=qs[_0x1a0a('0xb8')](_[_0x1a0a('0xc4')](_0x3cb740[_0x1a0a('0x3c')],_0xb4bf33[_0x1a0a('0xb8')]));_0x486ba2[_0x1a0a('0x45')][_0x1a0a('0xb3')]=_0x55645c['id'];if(_0x3cb740['query']['filter']){_0x486ba2[_0x1a0a('0x45')]=_[_0x1a0a('0xbb')](_0x486ba2[_0x1a0a('0x45')],{'$or':_['map'](_0x486ba2[_0x1a0a('0x40')],function(_0x5b98d7){var _0x425389={};_0x425389[_0x5b98d7]={'$like':'%'+_0x3cb740['query'][_0x1a0a('0x7f')]+'%'};return _0x425389;})});}if(_0x3cb740[_0x1a0a('0x3c')]['$gte']){var _0x2c9feb=_0x3cb740[_0x1a0a('0x3c')]['$gte'][_0x1a0a('0x24')](',');var _0x598241={};_0x598241[_0x2c9feb[0x0]]={'$gte':moment(_0x2c9feb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x486ba2[_0x1a0a('0x45')]=_[_0x1a0a('0xbb')](_0x486ba2[_0x1a0a('0x45')],_0x598241);}_0x486ba2=_['merge']({},_0x486ba2,_0x3cb740[_0x1a0a('0xbc')]);return db[_0x1a0a('0x27')][_0x1a0a('0x18')]({'where':_0x486ba2[_0x1a0a('0x45')]})['then'](function(_0xedef1d){_0xb1dcc0['count']=_0xedef1d;if(_0x3cb740['query'][_0x1a0a('0xb9')]){_0x486ba2[_0x1a0a('0xba')]=[{'all':!![]}];}return db[_0x1a0a('0x27')]['findAll'](_0x486ba2);})[_0x1a0a('0x1c')](function(_0x3b095e){if(_0x3cb740[_0x1a0a('0x3c')][_0x1a0a('0xc5')]===_0x1a0a('0xc6')){for(var _0x1b03a3=0x0;_0x1b03a3<_0x3b095e[_0x1a0a('0x41')];_0x1b03a3++){_0x3b095e[_0x1b03a3][_0x1a0a('0xbe')]=juice(_0x3b095e[_0x1b03a3][_0x1a0a('0xbe')]);}}_0xb1dcc0[_0x1a0a('0xc7')]=_0x3b095e;return _0xb1dcc0;});}})[_0x1a0a('0x1c')](respondWithFilteredResult(_0x10dff2,_0x486ba2))[_0x1a0a('0x2d')](handleError(_0x10dff2,null));};exports['addTags']=function(_0x13c381,_0x247e9b){return db[_0x1a0a('0x36')][_0x1a0a('0x63')]({'where':{'id':_0x13c381[_0x1a0a('0xb7')]['id']}})[_0x1a0a('0x1c')](handleEntityNotFound(_0x247e9b,null))[_0x1a0a('0x1c')](function(_0x12bb1d){if(_0x12bb1d){return _0x12bb1d[_0x1a0a('0xc8')](_0x13c381['body'][_0x1a0a('0xc1')],_['omit'](_0x13c381['body'],['ids','id'])||{})[_0x1a0a('0xc9')](function(){return db[_0x1a0a('0x67')][_0x1a0a('0xca')]({'attributes':['id','name',_0x1a0a('0x47')],'where':{'id':_0x13c381[_0x1a0a('0xbe')][_0x1a0a('0xc1')]}});})[_0x1a0a('0x1c')](function(_0x54c144){socket[_0x1a0a('0xcb')](_0x1a0a('0xcc'),{'id':Number(_0x13c381[_0x1a0a('0xb7')]['id']),'tags':_0x54c144||[]});return{'id':Number(_0x13c381[_0x1a0a('0xb7')]['id']),'tags':_0x54c144||[]};});}})[_0x1a0a('0x1c')](respondWithResult(_0x247e9b,null))[_0x1a0a('0x2d')](handleError(_0x247e9b,null));};exports[_0x1a0a('0xcd')]=function(_0x2b0597,_0x211b58){return db[_0x1a0a('0x36')][_0x1a0a('0x63')]({'where':{'id':_0x2b0597[_0x1a0a('0xb7')]['id']}})[_0x1a0a('0x1c')](handleEntityNotFound(_0x211b58,null))[_0x1a0a('0x1c')](function(_0x4b0cdf){if(_0x4b0cdf){return _0x4b0cdf[_0x1a0a('0xcd')](_0x2b0597[_0x1a0a('0x3c')]['ids']);}})[_0x1a0a('0x1c')](respondWithStatusCode(_0x211b58,null))['catch'](handleError(_0x211b58,null));};exports['download']=function(_0x4bcc81,_0x3bc2c3){var _0x5079b7=moment()[_0x1a0a('0xce')]()[_0x1a0a('0x93')]();var _0xe2406e=path[_0x1a0a('0xcf')](config['root'],_0x1a0a('0xd0'),_0x1a0a('0xd1'),'tmp');var _0xecedb9=path[_0x1a0a('0xcf')](config['root'],'server',_0x1a0a('0xd1'),_0x1a0a('0xd2'));var _0x1958f5=path[_0x1a0a('0xcf')](_0xe2406e,_0x5079b7);var _0x4ca21c=util['format']('transcript-%d-%s.zip',_0x4bcc81[_0x1a0a('0xb7')]['id'],_0x5079b7);var _0x28b17a=path[_0x1a0a('0xcf')](_0xe2406e,_0x4ca21c);var _0x48ee31=[];if(_0x4bcc81[_0x1a0a('0x3c')][_0x1a0a('0xd2')]){_0x48ee31[_0x1a0a('0x26')]({'model':db['Attachment'],'as':_0x1a0a('0xd3'),'raw':!![]});}var _0x4b8cc9=[{'model':db[_0x1a0a('0x27')],'as':_0x1a0a('0xd4'),'attributes':['id',_0x1a0a('0xbe'),_0x1a0a('0x48'),'to','cc',_0x1a0a('0xd5'),'subject',_0x1a0a('0xd6')],'where':{'secret':![]},'order':qs[_0x1a0a('0x44')]('id'),'include':_0x48ee31}];return db['MailInteraction'][_0x1a0a('0x63')]({'where':{'id':_0x4bcc81[_0x1a0a('0xb7')]['id']},'include':_0x4b8cc9})['then'](handleEntityNotFound(_0x3bc2c3,null))[_0x1a0a('0x1c')](function(_0x31dce9){if(_0x31dce9&&_0x31dce9[_0x1a0a('0xd4')]){var _0x43006a=_0x31dce9[_0x1a0a('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x1958f5);return BPromise[_0x1a0a('0xd8')](_0x43006a[_0x1a0a('0xd4')],function(_0x9cf27a,_0x1c0da5){var _0xf9539a={'from':_0x9cf27a[_0x1a0a('0x48')],'to':_0x9cf27a['to'],'subject':_0x9cf27a['subject'],'html':htmlEntities[_0x1a0a('0xd9')](_0x9cf27a[_0x1a0a('0xbe')]),'headers':{'Date':moment(_0x9cf27a[_0x1a0a('0xd6')])[_0x1a0a('0xda')](_0x1a0a('0xdb'))},'attachments':[]};if(_0x9cf27a['cc']){_0xf9539a[_0x1a0a('0xdc')]['Cc']=_0x9cf27a['cc'];}if(_0x9cf27a[_0x1a0a('0xd5')]){_0xf9539a[_0x1a0a('0xdc')][_0x1a0a('0xdd')]=_0x9cf27a['bcc'];}return new BPromise(function(_0x13aa7c,_0x8ef099){if(_0x9cf27a[_0x1a0a('0xd3')]){for(var _0x3011a4=0x0;_0x3011a4<_0x9cf27a['Attachments'][_0x1a0a('0x41')];_0x3011a4++){var _0xa9f20a=_0x9cf27a[_0x1a0a('0xd3')][_0x3011a4];var _0x31ee9e=path[_0x1a0a('0xcf')](_0xecedb9,_0xa9f20a[_0x1a0a('0xde')]);if(fs[_0x1a0a('0xdf')](_0x31ee9e)){_0xf9539a[_0x1a0a('0xd2')]['push']({'name':_0xa9f20a[_0x1a0a('0x1f')],'contentType':_0xa9f20a[_0x1a0a('0x39')],'data':fs[_0x1a0a('0xe0')](_0x31ee9e)});}}}emlformat[_0x1a0a('0xe1')](_0xf9539a,function(_0x34869b,_0x5da722){if(_0x34869b)return _0x8ef099(_0x34869b);fs[_0x1a0a('0xe2')](path[_0x1a0a('0xcf')](_0x1958f5,util[_0x1a0a('0xda')](_0x1a0a('0xe3'),_0x1c0da5)),_0x5da722);return _0x13aa7c(_0x5da722);});});})[_0x1a0a('0x1c')](function(){return new BPromise(function(_0x586047,_0xaea2dc){zipdir(_0x1958f5,{'saveTo':_0x28b17a},function(_0x94963b,_0x5b6837){if(_0x94963b)return _0xaea2dc(_0x94963b);return _0x586047(_0x5b6837);});})['then'](function(){return new BPromise(function(_0x385aa6,_0x361ec5){rimraf(_0x1958f5,function(_0x34e947){if(_0x34e947)_0x361ec5(_0x34e947);return _0x385aa6();});});})[_0x1a0a('0x1c')](function(){return _0x3bc2c3['download'](_0x28b17a,_0x4ca21c,function(_0x44a5e0){if(!_0x44a5e0)fs['unlinkSync'](_0x28b17a);});});});}else{return _0x3bc2c3[_0x1a0a('0x11')](0xc8);}})[_0x1a0a('0x2d')](handleError(_0x3bc2c3,null));}; \ No newline at end of file +var _0x9b09=['TagIds','Tags','split','forEach','push','MailMessage','findOne','plainBody','-id','lastMsgText','catch','answered','unmanaged','closed','waiting','UserId','talking','fieldName','type','filters','intersection','query','model','fields','length','attributes','sort','select','field','tools_tags','u.id','u.fullname','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','from','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','i.MailAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','Setting','enableEmailPreview','all','rows','show','params','keys','MailInteraction','rawAttributes','includeAll','options','create','body','describe','addMessage','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','true','addTags','setTags','ids','omit','spread','color','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','path','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','fullname'];(function(_0x4eb4ad,_0x183488){var _0x1312b2=function(_0x19aabe){while(--_0x19aabe){_0x4eb4ad['push'](_0x4eb4ad['shift']());}};_0x1312b2(++_0x183488);}(_0x9b09,0x1ad));var _0x99b0=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0x9b09[_0x5cca9f];return _0x55edda;};'use strict';var emlformat=require(_0x99b0('0x0'));var rimraf=require(_0x99b0('0x1'));var zipdir=require('zip-dir');var moment=require(_0x99b0('0x2'));var BPromise=require(_0x99b0('0x3'));var util=require('util');var path=require(_0x99b0('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0x99b0('0x5'));var juice=require('juice');var Redis=require(_0x99b0('0x6'));var qs=require(_0x99b0('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x99b0('0x8'))(_0x99b0('0x9'));var config=require('../../config/environment');var db=require(_0x99b0('0xa'))['db'];var htmlEntities=require(_0x99b0('0xb'));config[_0x99b0('0xc')]=_[_0x99b0('0xd')](config[_0x99b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x99b0('0xe'))(new Redis(config[_0x99b0('0xc')]));require(_0x99b0('0xf'))[_0x99b0('0x10')](socket);function respondWithStatusCode(_0xff8662,_0x521de5){_0x521de5=_0x521de5||0xcc;return function(_0x1ce363){if(_0x1ce363){return _0xff8662[_0x99b0('0x11')](_0x521de5);}return _0xff8662[_0x99b0('0x12')](_0x521de5)[_0x99b0('0x13')]();};}function respondWithResult(_0x415ff4,_0x42be76){_0x42be76=_0x42be76||0xc8;return function(_0x57d64d){if(_0x57d64d){return _0x415ff4[_0x99b0('0x12')](_0x42be76)['json'](_0x57d64d);}};}function respondWithFilteredResult(_0x46e300,_0x2f93e7){return function(_0x5baf0c){if(_0x5baf0c){var _0x5bba73=typeof _0x2f93e7[_0x99b0('0x14')]===_0x99b0('0x15')&&typeof _0x2f93e7[_0x99b0('0x16')]==='undefined';var _0x4cfd10=_0x5baf0c['count'];var _0x2e176f=_0x5bba73?0x0:_0x2f93e7[_0x99b0('0x14')];var _0x4d40ea=_0x5bba73?_0x5baf0c[_0x99b0('0x17')]:_0x2f93e7[_0x99b0('0x14')]+_0x2f93e7[_0x99b0('0x16')];var _0x7bbb89;if(_0x4d40ea>=_0x4cfd10){_0x4d40ea=_0x4cfd10;_0x7bbb89=0xc8;}else{_0x7bbb89=0xce;}_0x46e300[_0x99b0('0x12')](_0x7bbb89);return _0x46e300[_0x99b0('0x18')](_0x99b0('0x19'),_0x2e176f+'-'+_0x4d40ea+'/'+_0x4cfd10)['json'](_0x5baf0c);}return null;};}function saveUpdates(_0x1a2521){return function(_0x3a7529){if(_0x3a7529){return _0x3a7529[_0x99b0('0x1a')](_0x1a2521)[_0x99b0('0x1b')](function(_0x1a5863){return _0x1a5863;});}return null;};}function removeEntity(_0x15b7fd){return function(_0x3b303b){if(_0x3b303b){return _0x3b303b[_0x99b0('0x1c')]()[_0x99b0('0x1b')](function(){_0x15b7fd[_0x99b0('0x12')](0xcc)[_0x99b0('0x13')]();});}};}function handleEntityNotFound(_0x2b27ac){return function(_0x44c5ae){if(!_0x44c5ae){_0x2b27ac[_0x99b0('0x11')](0x194);}return _0x44c5ae;};}function handleError(_0x462af1,_0x93dcb1){_0x93dcb1=_0x93dcb1||0x1f4;return function(_0xa469fa){logger[_0x99b0('0x1d')](_0xa469fa[_0x99b0('0x1e')]);if(_0xa469fa[_0x99b0('0x1f')]){delete _0xa469fa[_0x99b0('0x1f')];}_0x462af1[_0x99b0('0x12')](_0x93dcb1)[_0x99b0('0x20')](_0xa469fa);};}function getInteractionUsers(_0x21e7e3,_0x4b2aa4){return new BPromise(function(_0x299cbf,_0x4a6c0f){try{if(_0x4b2aa4[_0x21e7e3['id']]){_0x21e7e3['Users']=_[_0x99b0('0x21')](_0x4b2aa4[_0x21e7e3['id']],function(_0x3efaab){return{'id':_0x3efaab['id'],'fullname':_0x3efaab[_0x99b0('0x22')]};});}}catch(_0x8df666){_0x4a6c0f(_0x8df666);}_0x299cbf(_0x21e7e3);});}function getInteractionTags(_0x3ba9c1,_0x5ebaa5){return new BPromise(function(_0x128b0e,_0x154dec){try{if(_0x3ba9c1[_0x99b0('0x23')]){_0x3ba9c1[_0x99b0('0x24')]=[];_0x3ba9c1['TagIds'][_0x99b0('0x25')](',')[_0x99b0('0x26')](function(_0x5429cd){_0x3ba9c1[_0x99b0('0x24')][_0x99b0('0x27')](_0x5ebaa5[_0x5429cd]);});}delete _0x3ba9c1[_0x99b0('0x23')];}catch(_0x22a098){_0x154dec(_0x22a098);}_0x128b0e(_0x3ba9c1);});}function getLastMessageText(_0x5de317){return new BPromise(function(_0x2a282e,_0x233eb6){return db[_0x99b0('0x28')][_0x99b0('0x29')]({'where':{'$and':[{'MailInteractionId':_0x5de317['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x99b0('0x2a')],'order':_0x99b0('0x2b'),'raw':!![]})[_0x99b0('0x1b')](function(_0x334b6d){if(_0x334b6d&&_0x334b6d[_0x99b0('0x2a')]){_0x5de317[_0x99b0('0x2c')]=_['trimStart'](_0x334b6d[_0x99b0('0x2a')]);}_0x2a282e(_0x5de317);})[_0x99b0('0x2d')](function(_0x4426a3){_0x233eb6(_0x4426a3);});});}function updateMailInteraction(_0x78f028,_0x2ed0a5,_0x1a524e,_0x402b11){return new BPromise(function(_0x2b249e,_0x56c3e5){return getInteractionUsers(_0x78f028,_0x1a524e)[_0x99b0('0x1b')](function(_0x4a296b){return getInteractionTags(_0x4a296b,_0x2ed0a5);})[_0x99b0('0x1b')](function(_0x3f1c4c){return getStateInteraction(_0x3f1c4c);})['then'](function(_0x421be7){if(_0x402b11){_0x2b249e(getLastMessageText(_0x421be7));}else{_0x2b249e(_0x421be7);}})['catch'](function(_0x4e32b2){_0x56c3e5(_0x4e32b2);});});}function getStateInteraction(_0x3c7cbf){return new BPromise(function(_0x42648d){_0x3c7cbf['waiting']=0x0;_0x3c7cbf['talking']=0x0;_0x3c7cbf[_0x99b0('0x2e')]=0x0;_0x3c7cbf[_0x99b0('0x2f')]=0x0;_0x3c7cbf['total']=0x0;if(!_0x3c7cbf[_0x99b0('0x30')]&&!_0x3c7cbf['UserId']){_0x3c7cbf[_0x99b0('0x31')]+=0x1;}if(!_0x3c7cbf['closed']&&_0x3c7cbf[_0x99b0('0x32')]){_0x3c7cbf[_0x99b0('0x33')]+=0x1;if(_0x3c7cbf[_0x99b0('0x31')]){_0x3c7cbf['waiting']-=0x1;}}if(_0x3c7cbf[_0x99b0('0x30')]&&_0x3c7cbf['UserId']){_0x3c7cbf[_0x99b0('0x2e')]+=0x1;if(_0x3c7cbf['talking']){_0x3c7cbf[_0x99b0('0x33')]-=0x1;}}if(_0x3c7cbf[_0x99b0('0x30')]&&!_0x3c7cbf[_0x99b0('0x32')]){_0x3c7cbf[_0x99b0('0x2f')]+=0x1;if(_0x3c7cbf[_0x99b0('0x31')]){_0x3c7cbf[_0x99b0('0x31')]-=0x1;}}_0x3c7cbf['total']+=0x1;_0x42648d(_0x3c7cbf);});}exports['index']=function(_0xb9e8a9,_0x21636c){var _0x28278b={},_0x3ecb5c={},_0x24a060={'count':0x0,'rows':[]};var _0x4f2762=_[_0x99b0('0x21')](db['MailInteraction']['rawAttributes'],function(_0xc01419){return{'name':_0xc01419[_0x99b0('0x34')],'type':_0xc01419[_0x99b0('0x35')]['key']};});_0x3ecb5c['model']=_[_0x99b0('0x21')](_0x4f2762,'name');_0x3ecb5c['query']=_['keys'](_0xb9e8a9['query']);_0x3ecb5c[_0x99b0('0x36')]=_[_0x99b0('0x37')](_0x3ecb5c['model'],_0x3ecb5c[_0x99b0('0x38')]);_0x28278b['attributes']=_[_0x99b0('0x37')](_0x3ecb5c[_0x99b0('0x39')],qs[_0x99b0('0x3a')](_0xb9e8a9[_0x99b0('0x38')]['fields']));_0x28278b['attributes']=_0x28278b['attributes'][_0x99b0('0x3b')]?_0x28278b[_0x99b0('0x3c')]:_0x3ecb5c[_0x99b0('0x39')];if(!_0xb9e8a9[_0x99b0('0x38')]['hasOwnProperty']('nolimit')){_0x28278b[_0x99b0('0x16')]=qs[_0x99b0('0x16')](_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x16')]);_0x28278b['offset']=qs[_0x99b0('0x14')](_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x14')]);}_0x28278b['order']=qs[_0x99b0('0x3d')](_0xb9e8a9[_0x99b0('0x38')]['sort']);_0x28278b['where']=qs[_0x99b0('0x36')](_['pick'](_0xb9e8a9[_0x99b0('0x38')],_0x3ecb5c[_0x99b0('0x36')]),_0x4f2762);var _0x2fca57=[];var _0x48ca98=squel[_0x99b0('0x3e')]()[_0x99b0('0x3f')]('id')[_0x99b0('0x3f')](_0x99b0('0x1f'))['field']('color')['from'](_0x99b0('0x40'));var _0x5f0f4c=squel[_0x99b0('0x3e')]()[_0x99b0('0x3f')](_0x99b0('0x41'))[_0x99b0('0x3f')](_0x99b0('0x42'))[_0x99b0('0x3f')]('ui.MailInteractionId')['from'](_0x99b0('0x43'),'ui')['left_join'](_0x99b0('0x44'),'u',_0x99b0('0x45'));var _0x2000b6=squel[_0x99b0('0x3e')]()[_0x99b0('0x46')](_0x99b0('0x47'),'i')[_0x99b0('0x48')](_0x99b0('0x49'),'c',_0x99b0('0x4a'))['left_join'](_0x99b0('0x44'),'o',_0x99b0('0x4b'))[_0x99b0('0x48')](_0x99b0('0x4c'),'a',_0x99b0('0x4d'))[_0x99b0('0x48')](_0x99b0('0x4e'),'me',_0x99b0('0x4f'))[_0x99b0('0x48')](_0x99b0('0x50'),'it',_0x99b0('0x51'))[_0x99b0('0x48')](_0x99b0('0x40'),'t',_0x99b0('0x52'));var _0x4be973=squel[_0x99b0('0x53')]();var _0x25d9d0=[];var _0x5c95fa=squel[_0x99b0('0x53')]();var _0x36679b;if(_0xb9e8a9[_0x99b0('0x38')]['search']){_0x36679b=as[_0x99b0('0x54')](_0xb9e8a9['query']['search']);var _0x15acd2=_0x36679b['sqlOperator'];for(var _0x5ee59c=0x0;_0x5ee59c<_0x36679b[_0x99b0('0x55')]['length'];_0x5ee59c++){var _0x5caa94=_0x36679b[_0x99b0('0x55')][_0x5ee59c];var _0x39108d='i';var _0x2424e1=_['find'](_0x4f2762,[_0x99b0('0x1f'),_0x5caa94[_0x99b0('0x3f')]]);if(!_0x2424e1){switch(_0x5caa94[_0x99b0('0x3f')]){case _0x99b0('0x56'):if(_0x5caa94[_0x99b0('0x57')]==0x1){_0x2000b6[_0x99b0('0x58')]('`'+_0x5caa94[_0x99b0('0x3f')]+_0x99b0('0x59'));}else{_0x2000b6[_0x99b0('0x58')]('`'+_0x5caa94[_0x99b0('0x3f')]+_0x99b0('0x5a'));}break;case _0x99b0('0x5b'):if(_0x5caa94[_0x99b0('0x5c')]===_0x99b0('0x5d')){if(_0x5caa94[_0x99b0('0x57')]['split']('\x20')['length']>0x1){_0x4be973[_0x15acd2](_0x99b0('0x5e'),qs[_0x99b0('0x5f')](_0x5caa94['value']),null);}else{var _0x5af9ee='%'+_0x5caa94[_0x99b0('0x57')]+'%';_0x4be973[_0x15acd2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5af9ee,_0x5af9ee,_0x5af9ee);}}else{_0x2424e1=_[_0x99b0('0x60')](_0x4f2762,[_0x99b0('0x1f'),_0x99b0('0x61')]);_0x5caa94[_0x99b0('0x3f')]=_0x99b0('0x61');_0x4ad131=as[_0x99b0('0x62')](_0x39108d,_0x2424e1['type'],_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131[_0x99b0('0x57')]['start'],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x13')]);}break;case _0x99b0('0x64'):var _0x5be8ca=_0x5caa94[_0x99b0('0x57')][_0x99b0('0x25')](',')['map'](function(_0x462348){return Number(_0x462348);});_0x5be8ca[_0x99b0('0x26')](function(_0x2989c6){_0x5c95fa['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2989c6+',%');});_0x25d9d0=_['union'](_0x25d9d0,_0x5be8ca);break;case _0x99b0('0x65'):if(_0x5caa94[_0x99b0('0x5c')]===_0x99b0('0x5d')){_0x4be973[_0x15acd2](_0x99b0('0x66'),'%'+_0x5caa94[_0x99b0('0x57')]+'%',null);}else{_0x2424e1=_['find'](_0x4f2762,[_0x99b0('0x1f'),'UserId']);_0x5caa94[_0x99b0('0x3f')]='UserId';_0x4ad131=as[_0x99b0('0x62')](_0x39108d,_0x2424e1[_0x99b0('0x35')],_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131['value'][_0x99b0('0x67')],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x13')]);}break;case _0x99b0('0x2a'):_0x4ad131=as[_0x99b0('0x62')]('me',null,_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x67')],_0x4ad131[_0x99b0('0x57')][_0x99b0('0x13')]);break;}}else{var _0x4ad131=as[_0x99b0('0x62')](_0x39108d,_0x2424e1[_0x99b0('0x35')],_0x5caa94);_0x4be973[_0x15acd2](_0x4ad131[_0x99b0('0x63')],_0x4ad131[_0x99b0('0x57')]['start'],_0x4ad131[_0x99b0('0x57')]['end']);}}}else{var _0x5ae1ae=_(_0xb9e8a9[_0x99b0('0x38')])['keys']()[_0x99b0('0x21')](function(_0x33bbf6){return _[_0x99b0('0x68')](_0x4f2762,['name',_0x33bbf6])?_0x33bbf6:undefined;})[_0x99b0('0x69')]()[_0x99b0('0x57')]();if(!_['isEmpty'](_0x5ae1ae)){_0x5ae1ae[_0x99b0('0x26')](function(_0x169d87){if(_0x169d87===_0x99b0('0x6a')){_0x2000b6['where'](_0x99b0('0x6b'),[][_0x99b0('0x6c')](_0xb9e8a9[_0x99b0('0x38')][_0x169d87]));}else if(_0x169d87==='createdAt'){var _0x333de5=JSON[_0x99b0('0x6d')](_0xb9e8a9['query'][_0x169d87])[_0x99b0('0x6e')];var _0x2bd6bf=JSON['parse'](_0xb9e8a9[_0x99b0('0x38')][_0x169d87])[_0x99b0('0x6f')];_0x2000b6[_0x99b0('0x70')](_0x99b0('0x71'),_0x333de5,_0x2bd6bf);}else{if(_0xb9e8a9[_0x99b0('0x38')][_0x169d87]===_0x99b0('0x72')){_0x2000b6[_0x99b0('0x70')]('i.'+_0x169d87+_0x99b0('0x73'));}else{_0x2000b6[_0x99b0('0x70')]('i.'+_0x169d87+_0x99b0('0x74'),_0xb9e8a9[_0x99b0('0x38')][_0x169d87]);}}});}if(_0xb9e8a9['query']['read']){if(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x75')]==0x1){_0x2000b6[_0x99b0('0x58')](_0x99b0('0x76'));}else{_0x2000b6[_0x99b0('0x58')](_0x99b0('0x77'));}}if(_0xb9e8a9[_0x99b0('0x38')]['tag']){_0x25d9d0=_[_0x99b0('0x78')](_0xb9e8a9[_0x99b0('0x38')]['tag'])?_0xb9e8a9['query'][_0x99b0('0x79')]:new Array(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x79')]);_0x25d9d0['forEach'](function(_0x3caebc){_0x5c95fa['or'](_0x99b0('0x7a'),'%,'+_0x3caebc+',%');});}if(_0xb9e8a9[_0x99b0('0x38')]['filter']){var _0x2942d1=_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x7b')][_0x99b0('0x7c')]('\x5c','\x5c\x5c')[_0x99b0('0x7c')](/'/g,'\x27\x27');if(qs[_0x99b0('0x7d')](_0x2942d1)){_0x4be973['or']('i.id\x20LIKE\x20?',_0x2942d1+'%');}else if(qs[_0x99b0('0x7e')](_0x2942d1)){_0x4be973['or'](_0x99b0('0x7f'),_0x2942d1+'%');}else{_0x4be973['or'](_0x99b0('0x80'),qs[_0x99b0('0x5f')](_0x2942d1))['or'](_0x99b0('0x81'),qs[_0x99b0('0x5f')](_0x2942d1));}}}_0x2000b6[_0x99b0('0x70')](_0x4be973);_0x2000b6[_0x99b0('0x82')](_0x99b0('0x83'));var _0x7bc896={'type':db[_0x99b0('0x84')][_0x99b0('0x85')][_0x99b0('0x86')],'raw':!![]};var _0x123867=_0x2000b6['clone']();_0x123867[_0x99b0('0x3f')](_0x99b0('0x83'));_0x123867[_0x99b0('0x3f')](_0x99b0('0x87'),'unreadMessages');if(_0x28278b[_0x99b0('0x88')]){_0x28278b['order'][_0x99b0('0x26')](function(_0x495384){var _0x25f9de=_0x495384[0x0]===_0x99b0('0x89')?_0x495384[0x0]:'i.'+_0x495384[0x0];_0x2000b6[_0x99b0('0x88')](_0x25f9de,_0x495384[0x1]===_0x99b0('0x8a')?![]:!![]);});}if(!_[_0x99b0('0x8b')](_0x25d9d0)){_0x2000b6[_0x99b0('0x58')](_0x5c95fa);_0x123867['where'](_0x99b0('0x8c'),_0x25d9d0);}BPromise[_0x99b0('0x8d')]()['then'](function(){if(!_0x36679b){if(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x6a')])return;_0x123867['where'](_0x99b0('0x8e'));_0x2000b6[_0x99b0('0x70')](_0x99b0('0x8e'));return;}if(_0xb9e8a9[_0x99b0('0x8f')]['role']!==_0x99b0('0x90'))return;return _0xb9e8a9[_0x99b0('0x8f')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x99b0('0x1b')](function(_0x41cb4d){if(_[_0x99b0('0x8b')](_0x41cb4d)){_0x123867[_0x99b0('0x70')](_0x99b0('0x91'));_0x2000b6[_0x99b0('0x70')](_0x99b0('0x91'));}else{_0x123867[_0x99b0('0x70')](_0x99b0('0x6b'),_[_0x99b0('0x21')](_0x41cb4d,'id'));_0x2000b6['where'](_0x99b0('0x6b'),_['map'](_0x41cb4d,'id'));}});})[_0x99b0('0x1b')](function(){if(_0xb9e8a9['user']['role']===_0x99b0('0x90')&&!_0x36679b&&!_0xb9e8a9['query']['MailAccountId'])return[];return db['sequelize'][_0x99b0('0x38')](_0x123867[_0x99b0('0x92')](),_0x7bc896);})[_0x99b0('0x1b')](function(_0x2556a3){_0x24a060['count']=_0x2556a3[_0x99b0('0x3b')];if(_0x24a060[_0x99b0('0x17')]===0x0)return[];return db['sequelize'][_0x99b0('0x38')](_0x48ca98[_0x99b0('0x92')](),_0x7bc896)[_0x99b0('0x1b')](function(_0x478a30){_0x2fca57=_[_0x99b0('0x93')](_0x478a30,'id');_0x7bc896=_[_0x99b0('0x94')](_0x7bc896,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb9e8a9[_0x99b0('0x38')][_0x99b0('0x3a')]){_0x28278b['attributes'][_0x99b0('0x26')](function(_0x27ad92){_0x2000b6['field']('i.'+_0x27ad92);});}else{_0x2000b6['field'](_0x99b0('0x87'),_0x99b0('0x56'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x95'),_0x99b0('0x96'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x97'),_0x99b0('0x98'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x99'),_0x99b0('0x89'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x83'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9a'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9b'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9c'));_0x2000b6[_0x99b0('0x3f')]('i.closedAt');_0x2000b6['field']('i.attach');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0x9d'));_0x2000b6[_0x99b0('0x3f')]('i.lastMsgDirection');_0x2000b6['field'](_0x99b0('0x9e'));_0x2000b6['field'](_0x99b0('0x9f'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa0'));_0x2000b6[_0x99b0('0x3f')]('i.thirdDisposition');_0x2000b6['field']('i.substatus');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa1'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa2'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa3'));_0x2000b6['field'](_0x99b0('0xa4'));_0x2000b6[_0x99b0('0x3f')]('c.firstName','Contact.firstName');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa5'),_0x99b0('0xa6'));_0x2000b6[_0x99b0('0x3f')]('c.email',_0x99b0('0xa7'));_0x2000b6['field']('c.phone',_0x99b0('0xa8'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xa9'),_0x99b0('0xaa'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xab'),'Contact.fax');_0x2000b6[_0x99b0('0x3f')]('o.fullname','Owner.fullname');_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xac'),_0x99b0('0xad'));_0x2000b6[_0x99b0('0x3f')](_0x99b0('0xae'),_0x99b0('0x23'));}if(_0x28278b[_0x99b0('0x16')])_0x2000b6[_0x99b0('0x16')](_0x28278b[_0x99b0('0x16')]);if(_0x28278b[_0x99b0('0x14')])_0x2000b6['offset'](_0x28278b[_0x99b0('0x14')]);return db[_0x99b0('0xaf')][_0x99b0('0x38')](_0x2000b6['toString'](),_0x7bc896);})[_0x99b0('0x1b')](function(_0x28ae03){if(_0x28ae03['length']>0x0)_0x5f0f4c[_0x99b0('0x70')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x28ae03,'id'));return db[_0x99b0('0xaf')][_0x99b0('0x38')](_0x5f0f4c[_0x99b0('0x92')](),_0x7bc896)[_0x99b0('0x1b')](function(_0x2a6b2e){var _0x1e56f9=_['groupBy'](_0x2a6b2e,'MailInteractionId');var _0x25d10f=[];return db[_0x99b0('0xb0')][_0x99b0('0x29')]({'attributes':[_0x99b0('0xb1')],'raw':!![]})[_0x99b0('0x1b')](function(_0x206bc4){var _0x1f9fa6=_0x206bc4[_0x99b0('0xb1')];_0x28ae03[_0x99b0('0x26')](function(_0x4b00da){_0x25d10f[_0x99b0('0x27')](updateMailInteraction(_0x4b00da,_0x2fca57,_0x1e56f9,_0x1f9fa6));});return BPromise[_0x99b0('0xb2')](_0x25d10f);});});});})[_0x99b0('0x1b')](function(_0x4cc801){_0x24a060[_0x99b0('0xb3')]=_0x4cc801;return _0x24a060;})[_0x99b0('0x1b')](respondWithFilteredResult(_0x21636c,_0x28278b))[_0x99b0('0x2d')](handleError(_0x21636c,null));};exports[_0x99b0('0xb4')]=function(_0xd0f1cb,_0x3e748c){var _0x1f3f0d={'raw':![],'where':{'id':_0xd0f1cb[_0x99b0('0xb5')]['id']}},_0x403e91={};_0x403e91[_0x99b0('0x39')]=_[_0x99b0('0xb6')](db[_0x99b0('0xb7')][_0x99b0('0xb8')]);_0x403e91['query']=_[_0x99b0('0xb6')](_0xd0f1cb[_0x99b0('0x38')]);_0x403e91[_0x99b0('0x36')]=_[_0x99b0('0x37')](_0x403e91[_0x99b0('0x39')],_0x403e91[_0x99b0('0x38')]);_0x1f3f0d['attributes']=_[_0x99b0('0x37')](_0x403e91[_0x99b0('0x39')],qs[_0x99b0('0x3a')](_0xd0f1cb[_0x99b0('0x38')][_0x99b0('0x3a')]));_0x1f3f0d[_0x99b0('0x3c')]=_0x1f3f0d[_0x99b0('0x3c')][_0x99b0('0x3b')]?_0x1f3f0d[_0x99b0('0x3c')]:_0x403e91[_0x99b0('0x39')];if(_0xd0f1cb[_0x99b0('0x38')][_0x99b0('0xb9')]){_0x1f3f0d['include']=[{'all':!![]}];}_0x1f3f0d=_[_0x99b0('0x94')]({},_0x1f3f0d,_0xd0f1cb[_0x99b0('0xba')]);return db['MailInteraction']['find'](_0x1f3f0d)[_0x99b0('0x1b')](handleEntityNotFound(_0x3e748c,null))[_0x99b0('0x1b')](respondWithResult(_0x3e748c,null))[_0x99b0('0x2d')](handleError(_0x3e748c,null));};exports[_0x99b0('0xbb')]=function(_0x520a99,_0x415f0b){return db[_0x99b0('0xb7')][_0x99b0('0xbb')](_0x520a99['body'],{})['then'](respondWithResult(_0x415f0b,0xc9))[_0x99b0('0x2d')](handleError(_0x415f0b,null));};exports['update']=function(_0x136cab,_0x32e40f){if(_0x136cab[_0x99b0('0xbc')]['id']){delete _0x136cab[_0x99b0('0xbc')]['id'];}return db[_0x99b0('0xb7')][_0x99b0('0x60')]({'where':{'id':_0x136cab[_0x99b0('0xb5')]['id']}})[_0x99b0('0x1b')](handleEntityNotFound(_0x32e40f,null))['then'](saveUpdates(_0x136cab['body'],null))[_0x99b0('0x1b')](respondWithResult(_0x32e40f,null))[_0x99b0('0x2d')](handleError(_0x32e40f,null));};exports[_0x99b0('0x1c')]=function(_0x54be6e,_0x5cc51f){return db[_0x99b0('0xb7')]['find']({'where':{'id':_0x54be6e[_0x99b0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5cc51f,null))[_0x99b0('0x1b')](removeEntity(_0x5cc51f,null))[_0x99b0('0x2d')](handleError(_0x5cc51f,null));};exports['describe']=function(_0x155095,_0x46c315){return db[_0x99b0('0xb7')][_0x99b0('0xbd')]()[_0x99b0('0x1b')](respondWithResult(_0x46c315,null))[_0x99b0('0x2d')](handleError(_0x46c315,null));};exports[_0x99b0('0xbe')]=function(_0x418ac0,_0x23e1f6){return db[_0x99b0('0x28')][_0x99b0('0x60')]({'where':{'id':_0x418ac0[_0x99b0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x23e1f6,null))['then'](function(_0x352b44){if(_0x352b44){return _0x352b44[_0x99b0('0xbe')](_0x418ac0['body']['ids'],_['omit'](_0x418ac0['body'],['ids','id'])||{});}})[_0x99b0('0x1b')](respondWithResult(_0x23e1f6,null))[_0x99b0('0x2d')](handleError(_0x23e1f6,null));};exports[_0x99b0('0xbf')]=function(_0x3b82b5,_0x3440f5){var _0xb1cef6={'raw':![],'where':{}};var _0x2949ee={};var _0x47b830={'count':0x0,'rows':[]};return db[_0x99b0('0xb7')][_0x99b0('0x29')]({'where':{'id':_0x3b82b5[_0x99b0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x3440f5,null))[_0x99b0('0x1b')](function(_0x3df711){if(_0x3df711){_0x2949ee[_0x99b0('0x39')]=_[_0x99b0('0xb6')](db[_0x99b0('0x28')]['rawAttributes']);_0x2949ee[_0x99b0('0x38')]=_['keys'](_0x3b82b5[_0x99b0('0x38')]);_0x2949ee[_0x99b0('0x36')]=_[_0x99b0('0x37')](_0x2949ee[_0x99b0('0x39')],_0x2949ee[_0x99b0('0x38')]);_0xb1cef6[_0x99b0('0x3c')]=_[_0x99b0('0x37')](_0x2949ee[_0x99b0('0x39')],qs['fields'](_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x3a')]));_0xb1cef6[_0x99b0('0x3c')]=_0xb1cef6[_0x99b0('0x3c')][_0x99b0('0x3b')]?_0xb1cef6[_0x99b0('0x3c')]:_0x2949ee[_0x99b0('0x39')];if(!_0x3b82b5['query']['hasOwnProperty'](_0x99b0('0xc0'))){_0xb1cef6[_0x99b0('0x16')]=qs[_0x99b0('0x16')](_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x16')]);_0xb1cef6[_0x99b0('0x14')]=qs[_0x99b0('0x14')](_0x3b82b5[_0x99b0('0x38')]['offset']);}_0xb1cef6[_0x99b0('0x88')]=qs[_0x99b0('0x3d')](_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x3d')]);_0xb1cef6[_0x99b0('0x70')]=qs['filters'](_['pick'](_0x3b82b5[_0x99b0('0x38')],_0x2949ee[_0x99b0('0x36')]));_0xb1cef6[_0x99b0('0x70')][_0x99b0('0xc1')]=_0x3df711['id'];if(_0x3b82b5['query'][_0x99b0('0x7b')]){_0xb1cef6[_0x99b0('0x70')]=_[_0x99b0('0x94')](_0xb1cef6[_0x99b0('0x70')],{'$or':_['map'](_0xb1cef6['attributes'],function(_0x4f2b89){var _0x17073e={};_0x17073e[_0x4f2b89]={'$like':'%'+_0x3b82b5[_0x99b0('0x38')][_0x99b0('0x7b')]+'%'};return _0x17073e;})});}if(_0x3b82b5['query'][_0x99b0('0x6e')]){var _0x406f16=_0x3b82b5['query'][_0x99b0('0x6e')][_0x99b0('0x25')](',');var _0x4f4295={};_0x4f4295[_0x406f16[0x0]]={'$gte':moment(_0x406f16[0x1])[_0x99b0('0xc2')](_0x99b0('0xc3'))};_0xb1cef6[_0x99b0('0x70')]=_[_0x99b0('0x94')](_0xb1cef6[_0x99b0('0x70')],_0x4f4295);}_0xb1cef6=_[_0x99b0('0x94')]({},_0xb1cef6,_0x3b82b5[_0x99b0('0xba')]);return db[_0x99b0('0x28')]['count']({'where':_0xb1cef6[_0x99b0('0x70')]})[_0x99b0('0x1b')](function(_0x17f64f){_0x47b830[_0x99b0('0x17')]=_0x17f64f;if(_0x3b82b5[_0x99b0('0x38')]['includeAll']){_0xb1cef6[_0x99b0('0xc4')]=[{'all':!![]}];}return db[_0x99b0('0x28')][_0x99b0('0xc5')](_0xb1cef6);})['then'](function(_0x2ea722){if(_0x3b82b5[_0x99b0('0x38')]['inlineCss']===_0x99b0('0xc6')){for(var _0x268565=0x0;_0x268565<_0x2ea722[_0x99b0('0x3b')];_0x268565++){_0x2ea722[_0x268565]['body']=juice(_0x2ea722[_0x268565]['body']);}}_0x47b830[_0x99b0('0xb3')]=_0x2ea722;return _0x47b830;});}})[_0x99b0('0x1b')](respondWithFilteredResult(_0x3440f5,_0xb1cef6))[_0x99b0('0x2d')](handleError(_0x3440f5,null));};exports[_0x99b0('0xc7')]=function(_0x40ea41,_0x30fb68){return db['MailInteraction'][_0x99b0('0x60')]({'where':{'id':_0x40ea41['params']['id']}})[_0x99b0('0x1b')](handleEntityNotFound(_0x30fb68,null))['then'](function(_0x33a043){if(_0x33a043){return _0x33a043[_0x99b0('0xc8')](_0x40ea41[_0x99b0('0xbc')][_0x99b0('0xc9')],_[_0x99b0('0xca')](_0x40ea41['body'],[_0x99b0('0xc9'),'id'])||{})[_0x99b0('0xcb')](function(){return db[_0x99b0('0x64')][_0x99b0('0xc5')]({'attributes':['id',_0x99b0('0x1f'),_0x99b0('0xcc')],'where':{'id':_0x40ea41[_0x99b0('0xbc')][_0x99b0('0xc9')]}});})[_0x99b0('0x1b')](function(_0x4392f3){socket[_0x99b0('0xcd')](_0x99b0('0xce'),{'id':Number(_0x40ea41[_0x99b0('0xb5')]['id']),'tags':_0x4392f3||[]});return{'id':Number(_0x40ea41[_0x99b0('0xb5')]['id']),'tags':_0x4392f3||[]};});}})[_0x99b0('0x1b')](respondWithResult(_0x30fb68,null))[_0x99b0('0x2d')](handleError(_0x30fb68,null));};exports['removeTags']=function(_0x15acaa,_0x109c9a){return db[_0x99b0('0xb7')][_0x99b0('0x60')]({'where':{'id':_0x15acaa[_0x99b0('0xb5')]['id']}})[_0x99b0('0x1b')](handleEntityNotFound(_0x109c9a,null))[_0x99b0('0x1b')](function(_0x483965){if(_0x483965){return _0x483965[_0x99b0('0xcf')](_0x15acaa[_0x99b0('0x38')][_0x99b0('0xc9')]);}})[_0x99b0('0x1b')](respondWithStatusCode(_0x109c9a,null))[_0x99b0('0x2d')](handleError(_0x109c9a,null));};exports['download']=function(_0x3b7533,_0x5220bc){var _0x29211f=moment()[_0x99b0('0xd0')]()[_0x99b0('0x92')]();var _0x2675a0=path[_0x99b0('0xd1')](config[_0x99b0('0xd2')],_0x99b0('0xd3'),_0x99b0('0xd4'),_0x99b0('0xd5'));var _0x2be2bd=path[_0x99b0('0xd1')](config[_0x99b0('0xd2')],'server',_0x99b0('0xd4'),_0x99b0('0xd6'));var _0x5cc012=path[_0x99b0('0xd1')](_0x2675a0,_0x29211f);var _0x6dd15b=util['format'](_0x99b0('0xd7'),_0x3b7533[_0x99b0('0xb5')]['id'],_0x29211f);var _0x534c52=path['join'](_0x2675a0,_0x6dd15b);var _0x40bb30=[];if(_0x3b7533[_0x99b0('0x38')][_0x99b0('0xd6')]){_0x40bb30[_0x99b0('0x27')]({'model':db['Attachment'],'as':_0x99b0('0xd8'),'raw':!![]});}var _0x4f585c=[{'model':db[_0x99b0('0x28')],'as':_0x99b0('0xd9'),'attributes':['id',_0x99b0('0xbc'),_0x99b0('0x46'),'to','cc',_0x99b0('0xda'),_0x99b0('0xdb'),_0x99b0('0xdc')],'where':{'secret':![]},'order':qs[_0x99b0('0x3d')]('id'),'include':_0x40bb30}];return db['MailInteraction'][_0x99b0('0x60')]({'where':{'id':_0x3b7533[_0x99b0('0xb5')]['id']},'include':_0x4f585c})[_0x99b0('0x1b')](handleEntityNotFound(_0x5220bc,null))[_0x99b0('0x1b')](function(_0x3510e3){if(_0x3510e3&&_0x3510e3[_0x99b0('0xd9')]){var _0x103075=_0x3510e3[_0x99b0('0xdd')]({'plain':!![]});fs[_0x99b0('0xde')](_0x5cc012);return BPromise[_0x99b0('0xdf')](_0x103075[_0x99b0('0xd9')],function(_0xd3b410,_0x10ac00){var _0x4eaff5={'from':_0xd3b410[_0x99b0('0x46')],'to':_0xd3b410['to'],'subject':_0xd3b410[_0x99b0('0xdb')],'html':htmlEntities[_0x99b0('0xe0')](_0xd3b410[_0x99b0('0xbc')]),'headers':{'Date':moment(_0xd3b410['createdAt'])[_0x99b0('0xc2')](_0x99b0('0xe1'))},'attachments':[]};if(_0xd3b410['cc']){_0x4eaff5[_0x99b0('0xe2')]['Cc']=_0xd3b410['cc'];}if(_0xd3b410[_0x99b0('0xda')]){_0x4eaff5[_0x99b0('0xe2')][_0x99b0('0xe3')]=_0xd3b410['bcc'];}return new BPromise(function(_0x3176e9,_0x5e05cf){if(_0xd3b410[_0x99b0('0xd8')]){for(var _0x276c63=0x0;_0x276c63<_0xd3b410[_0x99b0('0xd8')][_0x99b0('0x3b')];_0x276c63++){var _0xe7d3be=_0xd3b410[_0x99b0('0xd8')][_0x276c63];var _0x5786a4=path[_0x99b0('0xd1')](_0x2be2bd,_0xe7d3be['basename']);if(fs[_0x99b0('0xe4')](_0x5786a4)){_0x4eaff5[_0x99b0('0xd6')]['push']({'name':_0xe7d3be[_0x99b0('0x1f')],'contentType':_0xe7d3be['type'],'data':fs['readFileSync'](_0x5786a4)});}}}emlformat['build'](_0x4eaff5,function(_0xf06c04,_0x5903a9){if(_0xf06c04)return _0x5e05cf(_0xf06c04);fs['writeFileSync'](path[_0x99b0('0xd1')](_0x5cc012,util['format'](_0x99b0('0xe5'),_0x10ac00)),_0x5903a9);return _0x3176e9(_0x5903a9);});});})[_0x99b0('0x1b')](function(){return new BPromise(function(_0x16738e,_0x3f0265){zipdir(_0x5cc012,{'saveTo':_0x534c52},function(_0x36f1be,_0x47d338){if(_0x36f1be)return _0x3f0265(_0x36f1be);return _0x16738e(_0x47d338);});})[_0x99b0('0x1b')](function(){return new BPromise(function(_0x297ca0,_0x2a791b){rimraf(_0x5cc012,function(_0x3b3de7){if(_0x3b3de7)_0x2a791b(_0x3b3de7);return _0x297ca0();});});})[_0x99b0('0x1b')](function(){return _0x5220bc[_0x99b0('0xe6')](_0x534c52,_0x6dd15b,function(_0x5116aa){if(!_0x5116aa)fs[_0x99b0('0xe7')](_0x534c52);});});});}else{return _0x5220bc[_0x99b0('0x11')](0xc8);}})[_0x99b0('0x2d')](handleError(_0x5220bc,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index adea9b7..3b2310b 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 _0x681f=['setDataValue','Users','map','findAll','then','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x47bd2f,_0x181a40){var _0x2024d8=function(_0x2cca1f){while(--_0x2cca1f){_0x47bd2f['push'](_0x47bd2f['shift']());}};_0x2024d8(++_0x181a40);}(_0x681f,0x8f));var _0xf681=function(_0x1ed796,_0x301e1f){_0x1ed796=_0x1ed796-0x0;var _0x10597e=_0x681f[_0x1ed796];return _0x10597e;};'use strict';var EventEmitter=require(_0xf681('0x0'));var MailInteraction=require(_0xf681('0x1'))['db'][_0xf681('0x2')];var MailMessage=require(_0xf681('0x1'))['db'][_0xf681('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf681('0x4')](0x0);var events={'afterCreate':_0xf681('0x5'),'afterUpdate':_0xf681('0x6'),'afterDestroy':_0xf681('0x7')};function emitEvent(_0x93a5f){return function(_0x66e9d,_0x8b1dd6,_0x589bfa){_0x66e9d[_0xf681('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x23c4d3){_0x66e9d[_0xf681('0x9')](_0xf681('0xa'),_0x23c4d3[_0xf681('0xb')](function(_0x160284){return{'id':_0x160284['id']};}));return MailMessage[_0xf681('0xc')]({'where':{'MailInteractionId':_0x66e9d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf681('0xd')](function(_0xf11782){_0x66e9d[_0xf681('0x9')]('unreadMessages',_0xf11782['length']);MailInteractionEvents['emit'](_0x93a5f+':'+_0x66e9d['id'],_0x66e9d);MailInteractionEvents[_0xf681('0xe')](_0x93a5f,_0x66e9d);_0x589bfa(null);})[_0xf681('0xf')](_0x589bfa(null));};}for(var e in events){if(events[_0xf681('0x10')](e)){var event=events[e];MailInteraction[_0xf681('0x11')](e,emitEvent(event));}}module[_0xf681('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x27c5=['save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','MailInteraction','../../mysqldb','MailMessage'];(function(_0x21cfe4,_0x5ff11d){var _0x43834d=function(_0x26ec9d){while(--_0x26ec9d){_0x21cfe4['push'](_0x21cfe4['shift']());}};_0x43834d(++_0x5ff11d);}(_0x27c5,0x173));var _0x527c=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x27c5[_0x556927];return _0x5f1235;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x527c('0x0')];var MailMessage=require(_0x527c('0x1'))['db'][_0x527c('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x527c('0x3'),'afterUpdate':_0x527c('0x4'),'afterDestroy':_0x527c('0x5')};function emitEvent(_0x45478a){return function(_0x5164a0,_0x2bb668,_0x37bd95){_0x5164a0['getUsers']({'attributes':['id'],'raw':!![]})[_0x527c('0x6')](function(_0x5a68e8){_0x5164a0[_0x527c('0x7')]('Users',_0x5a68e8[_0x527c('0x8')](function(_0x38f876){return{'id':_0x38f876['id']};}));return MailMessage[_0x527c('0x9')]({'where':{'MailInteractionId':_0x5164a0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x36be3a){_0x5164a0[_0x527c('0x7')](_0x527c('0xa'),_0x36be3a[_0x527c('0xb')]);MailInteractionEvents[_0x527c('0xc')](_0x45478a+':'+_0x5164a0['id'],_0x5164a0);MailInteractionEvents[_0x527c('0xc')](_0x45478a,_0x5164a0);_0x37bd95(null);})[_0x527c('0xd')](_0x37bd95(null));};}for(var e in events){if(events[_0x527c('0xe')](e)){var event=events[e];MailInteraction[_0x527c('0xf')](e,emitEvent(event));}}module[_0x527c('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 66c784a..707af2f 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 _0xa906=['update','catch','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','substatusAt','closed','closedAt','models','get','MailMessage'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0xa906,0x6f));var _0x6a90=function(_0x2964bb,_0x3e8dcc){_0x2964bb=_0x2964bb-0x0;var _0x308d21=_0xa906[_0x2964bb];return _0x308d21;};'use strict';var _=require('lodash');var util=require(_0x6a90('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6a90('0x1'));var BPromise=require(_0x6a90('0x2'));var rp=require(_0x6a90('0x3'));var fs=require('fs');var path=require(_0x6a90('0x4'));var rimraf=require(_0x6a90('0x5'));var config=require(_0x6a90('0x6'));var attributes=require(_0x6a90('0x7'));module['exports']=function(_0x1837d2,_0x1a643a){return _0x1837d2[_0x6a90('0x8')](_0x6a90('0x9'),attributes,{'tableName':_0x6a90('0xa'),'paranoid':![],'indexes':[{'name':_0x6a90('0xb'),'fields':[_0x6a90('0xc'),'to'],'type':_0x6a90('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x221232,_0x5ade47,_0x34d20c){if(_0x221232['substatus']){_0x221232['substatusAt']=moment()[_0x6a90('0xe')](_0x6a90('0xf'));}if(_0x221232['closed']){_0x221232['closedAt']=moment()[_0x6a90('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34d20c(null,_0x5ade47);},'beforeUpdate':function(_0x19f95b,_0x4488e9,_0x3888df){if(_0x19f95b[_0x6a90('0x10')](_0x6a90('0x11'))){_0x19f95b[_0x6a90('0x12')]=_0x19f95b[_0x6a90('0x11')]?moment()['format'](_0x6a90('0xf')):null;}if(_0x19f95b[_0x6a90('0x10')](_0x6a90('0x13'))){_0x19f95b[_0x6a90('0x14')]=moment()['format'](_0x6a90('0xf'));_0x19f95b[_0x6a90('0x11')]=null;_0x19f95b[_0x6a90('0x12')]=null;}_0x3888df(null,_0x19f95b);},'afterUpdate':function(_0x547664,_0x29a2d1,_0x315605){var _0x3061fb=_0x1837d2[_0x6a90('0x15')];var _0x52889a=_0x547664[_0x6a90('0x16')]({'plain':!![]});if(_0x52889a[_0x6a90('0x13')]){return _0x3061fb[_0x6a90('0x17')][_0x6a90('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x52889a['id']}})['then'](function(){_0x315605();})[_0x6a90('0x19')](function(_0x5d2894){_0x315605(_0x5d2894);});}else{_0x315605();}}},'charset':'utf8mb4','collate':_0x6a90('0x1a')});}; \ No newline at end of file +var _0x2336=['subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','get','MailMessage','then','catch','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2336,0x160));var _0x6233=function(_0x27fedb,_0x31c693){_0x27fedb=_0x27fedb-0x0;var _0x58ab78=_0x2336[_0x27fedb];return _0x58ab78;};'use strict';var _=require(_0x6233('0x0'));var util=require(_0x6233('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6233('0x2'));var BPromise=require(_0x6233('0x3'));var rp=require(_0x6233('0x4'));var fs=require('fs');var path=require(_0x6233('0x5'));var rimraf=require(_0x6233('0x6'));var config=require('../../config/environment');var attributes=require(_0x6233('0x7'));module[_0x6233('0x8')]=function(_0x36b8ad,_0x3491bd){return _0x36b8ad[_0x6233('0x9')](_0x6233('0xa'),attributes,{'tableName':_0x6233('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x6233('0xc'),'to'],'type':_0x6233('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x39bf22,_0x4fba5c,_0x560708){if(_0x39bf22['substatus']){_0x39bf22[_0x6233('0xe')]=moment()[_0x6233('0xf')](_0x6233('0x10'));}if(_0x39bf22[_0x6233('0x11')]){_0x39bf22['closedAt']=moment()[_0x6233('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x560708(null,_0x4fba5c);},'beforeUpdate':function(_0x2ae774,_0x402e5a,_0x3638b2){if(_0x2ae774[_0x6233('0x12')](_0x6233('0x13'))){_0x2ae774[_0x6233('0xe')]=_0x2ae774[_0x6233('0x13')]?moment()[_0x6233('0xf')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2ae774[_0x6233('0x12')]('closed')){_0x2ae774[_0x6233('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2ae774[_0x6233('0x13')]=null;_0x2ae774[_0x6233('0xe')]=null;}_0x3638b2(null,_0x2ae774);},'afterUpdate':function(_0x5e8fe3,_0x172d05,_0xc36a69){var _0x31e091=_0x36b8ad['models'];var _0xe6b49e=_0x5e8fe3[_0x6233('0x15')]({'plain':!![]});if(_0xe6b49e[_0x6233('0x11')]){return _0x31e091[_0x6233('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xe6b49e['id']}})[_0x6233('0x17')](function(){_0xc36a69();})[_0x6233('0x18')](function(_0x582544){_0xc36a69(_0x582544);});}else{_0xc36a69();}}},'charset':'utf8mb4','collate':_0x6233('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8b11f0d..8210ad8 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 _0x8861=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','addTags','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x5b7019,_0x21e173){var _0x41f491=function(_0x3715b5){while(--_0x3715b5){_0x5b7019['push'](_0x5b7019['shift']());}};_0x41f491(++_0x21e173);}(_0x8861,0x6d));var _0x1886=function(_0x444913,_0x1bc7e9){_0x444913=_0x444913-0x0;var _0x9fec66=_0x8861[_0x444913];return _0x9fec66;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1886('0x0'));var BPromise=require(_0x1886('0x1'));var rs=require(_0x1886('0x2'));var fs=require('fs');var Redis=require(_0x1886('0x3'));var db=require(_0x1886('0x4'))['db'];var utils=require(_0x1886('0x5'));var logger=require(_0x1886('0x6'))(_0x1886('0x7'));var config=require(_0x1886('0x8'));var jayson=require(_0x1886('0x9'));var client=jayson[_0x1886('0xa')][_0x1886('0xb')]({'port':0x232a});config[_0x1886('0xc')]=_[_0x1886('0xd')](config[_0x1886('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1886('0xe'))(new Redis(config['redis']));require(_0x1886('0xf'))['register'](socket);function respondWithRpcPromise(_0x283141,_0x5b0abd,_0x2dc46f){return new BPromise(function(_0x2b1f4a,_0x30acc7){return client[_0x1886('0x10')](_0x283141,_0x2dc46f)[_0x1886('0x11')](function(_0x2e21ee){logger['info'](_0x1886('0x12'),_0x5b0abd,_0x1886('0x13'));logger[_0x1886('0x14')](_0x1886('0x15'),_0x5b0abd,_0x1886('0x13'),JSON[_0x1886('0x16')](_0x2e21ee));if(_0x2e21ee['error']){if(_0x2e21ee['error'][_0x1886('0x17')]===0x1f4){logger[_0x1886('0x18')](_0x1886('0x12'),_0x5b0abd,_0x2e21ee['error'][_0x1886('0x19')]);return _0x30acc7(_0x2e21ee[_0x1886('0x18')][_0x1886('0x19')]);}logger['error'](_0x1886('0x12'),_0x5b0abd,_0x2e21ee[_0x1886('0x18')]['message']);return _0x2b1f4a(_0x2e21ee[_0x1886('0x18')]['message']);}else{logger[_0x1886('0x1a')]('MailInteraction,\x20%s,\x20%s',_0x5b0abd,'request\x20sent');_0x2b1f4a(_0x2e21ee[_0x1886('0x1b')][_0x1886('0x19')]);}})[_0x1886('0x1c')](function(_0x3ce4ea){logger[_0x1886('0x18')](_0x1886('0x12'),_0x5b0abd,_0x3ce4ea);_0x30acc7(_0x3ce4ea);});});}exports[_0x1886('0x1d')]=function(_0x59ef24){var _0x2a4f0a=this;return new Promise(function(_0x183579,_0x49dc6c){return db[_0x1886('0x1e')][_0x1886('0x1f')](_0x59ef24[_0x1886('0x20')],{'raw':_0x59ef24['options']?_0x59ef24[_0x1886('0x21')][_0x1886('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ef24[_0x1886('0x21')]?_0x59ef24[_0x1886('0x21')][_0x1886('0x23')]||null:null,'attributes':_0x59ef24['options']?_0x59ef24['options'][_0x1886('0x24')]||null:null,'limit':_0x59ef24[_0x1886('0x21')]?_0x59ef24[_0x1886('0x21')][_0x1886('0x25')]||null:null})[_0x1886('0x11')](function(_0x5081b0){logger['info'](_0x1886('0x1d'),_0x59ef24);logger[_0x1886('0x14')](_0x1886('0x1d'),_0x59ef24,JSON['stringify'](_0x5081b0));_0x183579(_0x5081b0);})[_0x1886('0x1c')](function(_0x188ab5){logger[_0x1886('0x18')](_0x1886('0x1d'),_0x188ab5[_0x1886('0x19')],_0x59ef24);_0x49dc6c(_0x2a4f0a[_0x1886('0x18')](0x1f4,_0x188ab5[_0x1886('0x19')]));});});};exports[_0x1886('0x26')]=function(_0x8bcaf7){return new Promise(function(_0x1cd80d,_0x13fe64){return db[_0x1886('0x1e')]['find']({'where':_0x8bcaf7[_0x1886('0x21')]?_0x8bcaf7[_0x1886('0x21')][_0x1886('0x23')]||null:null})['then'](function(_0xa0700a){if(_0xa0700a){return _0xa0700a[_0x1886('0x27')](_0x8bcaf7[_0x1886('0x20')]['ids'],_['omit'](_0x8bcaf7['body'],[_0x1886('0x28'),'id'])||{});}})[_0x1886('0x29')](function(_0x301ccd){logger[_0x1886('0x1a')](_0x1886('0x2a'),_0x8bcaf7);logger[_0x1886('0x14')]('AddTags',_0x8bcaf7,JSON[_0x1886('0x16')](_0x301ccd));_0x1cd80d(_0x301ccd);})[_0x1886('0x1c')](function(_0x4b0589){logger[_0x1886('0x18')]('AddTags',_0x4b0589['message'],_0x8bcaf7);_0x13fe64(_this[_0x1886('0x18')](0x1f4,_0x4b0589[_0x1886('0x19')]));});});}; \ No newline at end of file +var _0x0810=['update','body','options','raw','where','attributes','debug','AddTagsToMailInteraction','ids','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailInteraction.socket','then','info','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction'];(function(_0x3ddbcc,_0x54be6b){var _0x381b48=function(_0x467e7d){while(--_0x467e7d){_0x3ddbcc['push'](_0x3ddbcc['shift']());}};_0x381b48(++_0x54be6b);}(_0x0810,0x1e6));var _0x0081=function(_0x51c0f1,_0x41cc0f){_0x51c0f1=_0x51c0f1-0x0;var _0x5134b1=_0x0810[_0x51c0f1];return _0x5134b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0081('0x0'));var BPromise=require('bluebird');var rs=require(_0x0081('0x1'));var fs=require('fs');var Redis=require(_0x0081('0x2'));var db=require(_0x0081('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0081('0x4'))(_0x0081('0x5'));var config=require(_0x0081('0x6'));var jayson=require(_0x0081('0x7'));var client=jayson[_0x0081('0x8')][_0x0081('0x9')]({'port':0x232a});config[_0x0081('0xa')]=_[_0x0081('0xb')](config[_0x0081('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0081('0xc'))['register'](socket);function respondWithRpcPromise(_0xc05d42,_0x5f171e,_0x2fe57d){return new BPromise(function(_0x752491,_0x3e6229){return client['request'](_0xc05d42,_0x2fe57d)[_0x0081('0xd')](function(_0x4610a7){logger[_0x0081('0xe')]('MailInteraction,\x20%s,\x20%s',_0x5f171e,_0x0081('0xf'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5f171e,'request\x20sent',JSON[_0x0081('0x10')](_0x4610a7));if(_0x4610a7[_0x0081('0x11')]){if(_0x4610a7['error']['code']===0x1f4){logger[_0x0081('0x11')](_0x0081('0x12'),_0x5f171e,_0x4610a7[_0x0081('0x11')]['message']);return _0x3e6229(_0x4610a7[_0x0081('0x11')]['message']);}logger[_0x0081('0x11')](_0x0081('0x12'),_0x5f171e,_0x4610a7['error']['message']);return _0x752491(_0x4610a7[_0x0081('0x11')][_0x0081('0x13')]);}else{logger[_0x0081('0xe')](_0x0081('0x12'),_0x5f171e,_0x0081('0xf'));_0x752491(_0x4610a7[_0x0081('0x14')][_0x0081('0x13')]);}})[_0x0081('0x15')](function(_0x100564){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5f171e,_0x100564);_0x3e6229(_0x100564);});});}exports[_0x0081('0x16')]=function(_0xeff3d){var _0x1a6732=this;return new Promise(function(_0x2ffaf2,_0x78abe5){return db[_0x0081('0x17')][_0x0081('0x18')](_0xeff3d[_0x0081('0x19')],{'raw':_0xeff3d[_0x0081('0x1a')]?_0xeff3d[_0x0081('0x1a')][_0x0081('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xeff3d[_0x0081('0x1a')]?_0xeff3d['options'][_0x0081('0x1c')]||null:null,'attributes':_0xeff3d['options']?_0xeff3d[_0x0081('0x1a')][_0x0081('0x1d')]||null:null,'limit':_0xeff3d['options']?_0xeff3d[_0x0081('0x1a')]['limit']||null:null})[_0x0081('0xd')](function(_0x29fbc4){logger['info']('UpdateMailInteraction',_0xeff3d);logger[_0x0081('0x1e')](_0x0081('0x16'),_0xeff3d,JSON[_0x0081('0x10')](_0x29fbc4));_0x2ffaf2(_0x29fbc4);})[_0x0081('0x15')](function(_0x2d6a54){logger[_0x0081('0x11')](_0x0081('0x16'),_0x2d6a54[_0x0081('0x13')],_0xeff3d);_0x78abe5(_0x1a6732[_0x0081('0x11')](0x1f4,_0x2d6a54[_0x0081('0x13')]));});});};exports[_0x0081('0x1f')]=function(_0x3c2758){return new Promise(function(_0xc278f9,_0x19ec78){return db[_0x0081('0x17')]['find']({'where':_0x3c2758[_0x0081('0x1a')]?_0x3c2758[_0x0081('0x1a')][_0x0081('0x1c')]||null:null})['then'](function(_0xc5edbd){if(_0xc5edbd){return _0xc5edbd['addTags'](_0x3c2758[_0x0081('0x19')][_0x0081('0x20')],_['omit'](_0x3c2758[_0x0081('0x19')],[_0x0081('0x20'),'id'])||{});}})['spread'](function(_0x34c2dc){logger[_0x0081('0xe')](_0x0081('0x21'),_0x3c2758);logger[_0x0081('0x1e')]('AddTags',_0x3c2758,JSON['stringify'](_0x34c2dc));_0xc278f9(_0x34c2dc);})[_0x0081('0x15')](function(_0x51f912){logger[_0x0081('0x11')](_0x0081('0x21'),_0x51f912[_0x0081('0x13')],_0x3c2758);_0x19ec78(_this[_0x0081('0x11')](0x1f4,_0x51f912[_0x0081('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c874339..d9efa56 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 _0xa6cf=['update','register','length','save','remove'];(function(_0x550eeb,_0x1aae4a){var _0x523abc=function(_0x5ef790){while(--_0x5ef790){_0x550eeb['push'](_0x550eeb['shift']());}};_0x523abc(++_0x1aae4a);}(_0xa6cf,0x16b));var _0xfa6c=function(_0x2ab798,_0x2cc167){_0x2ab798=_0x2ab798-0x0;var _0x1a7746=_0xa6cf[_0x2ab798];return _0x1a7746;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xfa6c('0x0'),_0xfa6c('0x1'),_0xfa6c('0x2')];function createListener(_0x440f76,_0x8c8208){return function(_0x1b3443){_0x8c8208['emit'](_0x440f76,_0x1b3443);};}function removeListener(_0x3802ad,_0x4cd38e){return function(){MailInteractionEvents['removeListener'](_0x3802ad,_0x4cd38e);};}exports[_0xfa6c('0x3')]=function(_0x1658fa){for(var _0x5cbe58=0x0,_0x4872d3=events[_0xfa6c('0x4')];_0x5cbe58<_0x4872d3;_0x5cbe58++){var _0x4efb1d=events[_0x5cbe58];var _0x528427=createListener('mailInteraction:'+_0x4efb1d,_0x1658fa);MailInteractionEvents['on'](_0x4efb1d,_0x528427);}}; \ No newline at end of file +var _0x417e=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x417e,0x134));var _0xe417=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x417e[_0x118139];return _0x2fece9;};'use strict';var MailInteractionEvents=require(_0xe417('0x0'));var events=[_0xe417('0x1'),_0xe417('0x2'),_0xe417('0x3')];function createListener(_0x525b2c,_0x158b81){return function(_0x1d5ee2){_0x158b81[_0xe417('0x4')](_0x525b2c,_0x1d5ee2);};}function removeListener(_0x3d5e7f,_0x562f00){return function(){MailInteractionEvents[_0xe417('0x5')](_0x3d5e7f,_0x562f00);};}exports[_0xe417('0x6')]=function(_0x2876bf){for(var _0x2b0d29=0x0,_0x15b745=events[_0xe417('0x7')];_0x2b0d29<_0x15b745;_0x2b0d29++){var _0x4af204=events[_0x2b0d29];var _0x128867=createListener(_0xe417('0x8')+_0x4af204,_0x2876bf);MailInteractionEvents['on'](_0x4af204,_0x128867);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4b61113..1a56a12 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 _0xc8f8=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','download','mailmessage:create','update','put','/:id/accept','/:id/reject','reject','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc8f8,0x1cc));var _0x8c8f=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xc8f8[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x8c8f('0x0'));var util=require(_0x8c8f('0x1'));var path=require(_0x8c8f('0x2'));var timeout=require(_0x8c8f('0x3'));var express=require('express');var router=express[_0x8c8f('0x4')]();var fs_extra=require(_0x8c8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8c8f('0x6'));var config=require(_0x8c8f('0x7'));var controller=require(_0x8c8f('0x8'));router[_0x8c8f('0x9')]('/',auth[_0x8c8f('0xa')](),controller[_0x8c8f('0xb')]);router[_0x8c8f('0x9')](_0x8c8f('0xc'),auth[_0x8c8f('0xa')](),controller[_0x8c8f('0xd')]);router[_0x8c8f('0x9')](_0x8c8f('0xe'),auth[_0x8c8f('0xa')](),controller['show']);router[_0x8c8f('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x8c8f('0xf')]);router['post']('/',auth[_0x8c8f('0xa')](),interaction['tracked']('mail',_0x8c8f('0x10')),controller['create']);router['put'](_0x8c8f('0xe'),auth['isAuthenticated'](),controller[_0x8c8f('0x11')]);router[_0x8c8f('0x12')](_0x8c8f('0x13'),auth[_0x8c8f('0xa')](),controller['accept']);router['put'](_0x8c8f('0x14'),auth[_0x8c8f('0xa')](),controller[_0x8c8f('0x15')]);router['delete'](_0x8c8f('0xe'),auth[_0x8c8f('0xa')](),controller['destroy']);module[_0x8c8f('0x16')]=router; \ No newline at end of file +var _0xb5f8=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','describe','get','/:id','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','accept','reject','delete','destroy'];(function(_0x2796b2,_0x35c20b){var _0x10f065=function(_0x36f182){while(--_0x36f182){_0x2796b2['push'](_0x2796b2['shift']());}};_0x10f065(++_0x35c20b);}(_0xb5f8,0x88));var _0x8b5f=function(_0x28ab1e,_0x2de7fd){_0x28ab1e=_0x28ab1e-0x0;var _0xdda130=_0xb5f8[_0x28ab1e];return _0xdda130;};'use strict';var multer=require(_0x8b5f('0x0'));var util=require(_0x8b5f('0x1'));var path=require(_0x8b5f('0x2'));var timeout=require(_0x8b5f('0x3'));var express=require(_0x8b5f('0x4'));var router=express['Router']();var fs_extra=require(_0x8b5f('0x5'));var auth=require(_0x8b5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b5f('0x7'));var controller=require(_0x8b5f('0x8'));router['get']('/',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0xa')]);router['get']('/describe',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0xb')]);router[_0x8b5f('0xc')](_0x8b5f('0xd'),auth[_0x8b5f('0x9')](),controller['show']);router[_0x8b5f('0xc')](_0x8b5f('0xe'),auth[_0x8b5f('0x9')](),controller['download']);router[_0x8b5f('0xf')]('/',auth[_0x8b5f('0x9')](),interaction[_0x8b5f('0x10')](_0x8b5f('0x11'),_0x8b5f('0x12')),controller[_0x8b5f('0x13')]);router[_0x8b5f('0x14')](_0x8b5f('0xd'),auth[_0x8b5f('0x9')](),controller[_0x8b5f('0x15')]);router[_0x8b5f('0x14')]('/:id/accept',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0x16')]);router['put']('/:id/reject',auth[_0x8b5f('0x9')](),controller[_0x8b5f('0x17')]);router[_0x8b5f('0x18')](_0x8b5f('0xd'),auth['isAuthenticated'](),controller[_0x8b5f('0x19')]);module[_0x8b5f('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 3acf1c4..b3bc5eb 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 _0x32e3=['long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM','Chat','Email','sequelize','lodash','exports','TEXT'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0x32e3,0x1d8));var _0x332e=function(_0x3cdb97,_0x32020b){_0x3cdb97=_0x3cdb97-0x0;var _0x1a7329=_0x32e3[_0x3cdb97];return _0x1a7329;};'use strict';var Sequelize=require(_0x332e('0x0'));var _=require(_0x332e('0x1'));module[_0x332e('0x2')]={'body':{'type':Sequelize[_0x332e('0x3')](_0x332e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x332e('0x3')](_0x332e('0x5'))},'read':{'type':Sequelize[_0x332e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x332e('0x7')),'defaultValue':_0x332e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x332e('0x8')](0x1fe)},'from':{'type':Sequelize[_0x332e('0x8')]},'to':{'type':Sequelize['TEXT'](_0x332e('0x4'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x332e('0x3')](_0x332e('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x332e('0x9')]},'attach':{'type':Sequelize[_0x332e('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x332e('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x332e('0x4'))},'originCc':{'type':Sequelize[_0x332e('0x3')]('long')},'originChannel':{'type':Sequelize[_0x332e('0xb')]('Email',_0x332e('0xc')),'defaultValue':_0x332e('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0x9ec9=['ENUM','STRING','long','DATE','INTEGER','Email','lodash','TEXT','BOOLEAN'];(function(_0x267208,_0x461c7d){var _0x369452=function(_0x50f9e1){while(--_0x50f9e1){_0x267208['push'](_0x267208['shift']());}};_0x369452(++_0x461c7d);}(_0x9ec9,0x8d));var _0x99ec=function(_0x3f096b,_0x1a864f){_0x3f096b=_0x3f096b-0x0;var _0x204ba4=_0x9ec9[_0x3f096b];return _0x204ba4;};'use strict';var Sequelize=require('sequelize');var _=require(_0x99ec('0x0'));module['exports']={'body':{'type':Sequelize[_0x99ec('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x99ec('0x1')]('medium')},'read':{'type':Sequelize[_0x99ec('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x99ec('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x99ec('0x4')](0x1fe)},'from':{'type':Sequelize[_0x99ec('0x4')]},'to':{'type':Sequelize[_0x99ec('0x1')]('long')},'cc':{'type':Sequelize[_0x99ec('0x1')]('long')},'bcc':{'type':Sequelize[_0x99ec('0x1')](_0x99ec('0x5'))},'subject':{'type':Sequelize[_0x99ec('0x1')]},'sentAt':{'type':Sequelize[_0x99ec('0x6')]},'attach':{'type':Sequelize[_0x99ec('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x99ec('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x99ec('0x1')](_0x99ec('0x5'))},'originCc':{'type':Sequelize['TEXT'](_0x99ec('0x5'))},'originChannel':{'type':Sequelize[_0x99ec('0x3')](_0x99ec('0x8'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0a3ead6..5e260fb 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 _0x3f8e=['status','json','offset','undefined','limit','count','set','end','sendStatus','stack','index','map','MailMessage','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','keys','rawAttributes','find','catch','update','body','destroy','describe','create','direction','split','MailAccount','findOne','CmList','List','CmContact','updatedAt','Smtp','isNil','service','host','port','secure','pass','user','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','null','RejectMessage','rejectMessage','sequelize','QueryTypes','User','SIP/%s','rejectmessage','download','root','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Attachments','existsSync','push','type','build','writeFileSync','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4bacd2,_0x59b861){var _0x290ba7=function(_0x299ad6){while(--_0x299ad6){_0x4bacd2['push'](_0x4bacd2['shift']());}};_0x290ba7(++_0x59b861);}(_0x3f8e,0x124));var _0xe3f8=function(_0x18448c,_0x78a9b2){_0x18448c=_0x18448c-0x0;var _0x3ed2c8=_0x3f8e[_0x18448c];return _0x3ed2c8;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xe3f8('0x0'));var util=require(_0xe3f8('0x1'));var path=require(_0xe3f8('0x2'));var fs=require('fs');var _=require(_0xe3f8('0x3'));var Redis=require(_0xe3f8('0x4'));var htmlToText=require(_0xe3f8('0x5'));var qs=require(_0xe3f8('0x6'));var logger=require(_0xe3f8('0x7'))('api');var interaction_log=require(_0xe3f8('0x7'))(_0xe3f8('0x8'));var config=require(_0xe3f8('0x9'));var db=require(_0xe3f8('0xa'))['db'];config[_0xe3f8('0xb')]=_[_0xe3f8('0xc')](config['redis'],{'host':_0xe3f8('0xd'),'port':0x18eb});var socket=require(_0xe3f8('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0xe3f8('0xf'));require(_0xe3f8('0x10'))[_0xe3f8('0x11')](socket);var jayson=require(_0xe3f8('0x12'));var client=jayson[_0xe3f8('0x13')][_0xe3f8('0x14')]({'port':0x232c});var client9003=jayson[_0xe3f8('0x13')][_0xe3f8('0x14')]({'port':0x232b});var client9002=jayson[_0xe3f8('0x13')][_0xe3f8('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x240a8a,_0x23fde3,_0x509759,_0x30becb){return new BPromise(function(_0x6c0976,_0x22a472){var _0x38b5c2=_0x30becb||client;return _0x38b5c2['request'](_0x240a8a,_0x509759)[_0xe3f8('0x15')](function(_0x140404){logger[_0xe3f8('0x16')](_0xe3f8('0x17'),_0x23fde3,_0xe3f8('0x18'));logger[_0xe3f8('0x19')](_0xe3f8('0x1a'),_0x23fde3,_0xe3f8('0x18'),JSON[_0xe3f8('0x1b')](_0x140404));if(_0x140404[_0xe3f8('0x1c')]){if(_0x140404['error'][_0xe3f8('0x1d')]===0x1f4){logger[_0xe3f8('0x1c')]('MailMessage,\x20%s,\x20%s',_0x23fde3,_0x140404[_0xe3f8('0x1c')][_0xe3f8('0x1e')]);return _0x22a472(_0x140404['error'][_0xe3f8('0x1e')]);}logger[_0xe3f8('0x1c')](_0xe3f8('0x17'),_0x23fde3,_0x140404[_0xe3f8('0x1c')]['message']);return _0x6c0976(_0x140404[_0xe3f8('0x1c')]['message']);}else{logger['info'](_0xe3f8('0x17'),_0x23fde3,_0xe3f8('0x18'));_0x6c0976(_0x140404[_0xe3f8('0x1f')][_0xe3f8('0x1e')]);}})['catch'](function(_0x1c52fe){logger[_0xe3f8('0x1c')]('MailMessage,\x20%s,\x20%s',_0x23fde3,_0x1c52fe);_0x22a472(_0x1c52fe);});});}function respondWithResult(_0x2f806b,_0x372721){_0x372721=_0x372721||0xc8;return function(_0x239ef2){if(_0x239ef2){return _0x2f806b[_0xe3f8('0x20')](_0x372721)[_0xe3f8('0x21')](_0x239ef2);}};}function respondWithFilteredResult(_0x3a46dd,_0x2c311b){return function(_0x220f15){if(_0x220f15){var _0x3946c8=typeof _0x2c311b[_0xe3f8('0x22')]===_0xe3f8('0x23')&&typeof _0x2c311b[_0xe3f8('0x24')]===_0xe3f8('0x23');var _0x2abb91=_0x220f15[_0xe3f8('0x25')];var _0x4a4bb0=_0x3946c8?0x0:_0x2c311b['offset'];var _0x58d465=_0x3946c8?_0x220f15[_0xe3f8('0x25')]:_0x2c311b[_0xe3f8('0x22')]+_0x2c311b['limit'];var _0x2600d1;if(_0x58d465>=_0x2abb91){_0x58d465=_0x2abb91;_0x2600d1=0xc8;}else{_0x2600d1=0xce;}_0x3a46dd[_0xe3f8('0x20')](_0x2600d1);return _0x3a46dd[_0xe3f8('0x26')]('Content-Range',_0x4a4bb0+'-'+_0x58d465+'/'+_0x2abb91)[_0xe3f8('0x21')](_0x220f15);}return null;};}function saveUpdates(_0x1e0be6){return function(_0x32264a){if(_0x32264a){return _0x32264a['update'](_0x1e0be6)[_0xe3f8('0x15')](function(_0x3b380e){return _0x3b380e;});}return null;};}function removeEntity(_0xf6a4bc){return function(_0x6281a1){if(_0x6281a1){return _0x6281a1['destroy']()['then'](function(){_0xf6a4bc[_0xe3f8('0x20')](0xcc)[_0xe3f8('0x27')]();});}};}function handleEntityNotFound(_0x52ba9f){return function(_0x2b5b40){if(!_0x2b5b40){_0x52ba9f[_0xe3f8('0x28')](0x194);}return _0x2b5b40;};}function handleError(_0x5f351e,_0x27321b){_0x27321b=_0x27321b||0x1f4;return function(_0xdec9){logger[_0xe3f8('0x1c')](_0xdec9[_0xe3f8('0x29')]);if(_0xdec9['name']){delete _0xdec9['name'];}_0x5f351e['status'](_0x27321b)['send'](_0xdec9);};}exports[_0xe3f8('0x2a')]=function(_0x5f34b3,_0x244984){var _0x3fdb8d={},_0xdfda70={},_0x506c50={'count':0x0,'rows':[]};var _0x361610=_[_0xe3f8('0x2b')](db[_0xe3f8('0x2c')]['rawAttributes'],function(_0x12068c){return{'name':_0x12068c[_0xe3f8('0x2d')],'type':_0x12068c['type'][_0xe3f8('0x2e')]};});_0xdfda70[_0xe3f8('0x2f')]=_[_0xe3f8('0x2b')](_0x361610,_0xe3f8('0x30'));_0xdfda70[_0xe3f8('0x31')]=_['keys'](_0x5f34b3['query']);_0xdfda70[_0xe3f8('0x32')]=_[_0xe3f8('0x33')](_0xdfda70[_0xe3f8('0x2f')],_0xdfda70[_0xe3f8('0x31')]);_0x3fdb8d[_0xe3f8('0x34')]=_['intersection'](_0xdfda70[_0xe3f8('0x2f')],qs[_0xe3f8('0x35')](_0x5f34b3['query']['fields']));_0x3fdb8d[_0xe3f8('0x34')]=_0x3fdb8d[_0xe3f8('0x34')][_0xe3f8('0x36')]?_0x3fdb8d['attributes']:_0xdfda70[_0xe3f8('0x2f')];if(!_0x5f34b3[_0xe3f8('0x31')][_0xe3f8('0x37')](_0xe3f8('0x38'))){_0x3fdb8d[_0xe3f8('0x24')]=qs[_0xe3f8('0x24')](_0x5f34b3[_0xe3f8('0x31')][_0xe3f8('0x24')]);_0x3fdb8d[_0xe3f8('0x22')]=qs[_0xe3f8('0x22')](_0x5f34b3['query']['offset']);}_0x3fdb8d[_0xe3f8('0x39')]=qs[_0xe3f8('0x3a')](_0x5f34b3['query'][_0xe3f8('0x3a')]);_0x3fdb8d[_0xe3f8('0x3b')]=qs[_0xe3f8('0x32')](_[_0xe3f8('0x3c')](_0x5f34b3['query'],_0xdfda70[_0xe3f8('0x32')]),_0x361610);if(_0x5f34b3[_0xe3f8('0x31')]['filter']){_0x3fdb8d['where']=_['merge'](_0x3fdb8d['where'],{'$or':_[_0xe3f8('0x2b')](_0x361610,function(_0x2ac9){if(_0x2ac9['type']!==_0xe3f8('0x3d')){var _0x24011e={};_0x24011e[_0x2ac9[_0xe3f8('0x30')]]={'$like':'%'+_0x5f34b3['query'][_0xe3f8('0x3e')]+'%'};return _0x24011e;}})});}_0x3fdb8d=_[_0xe3f8('0x3f')]({},_0x3fdb8d,_0x5f34b3[_0xe3f8('0x40')]);var _0x2f8d03={'where':_0x3fdb8d[_0xe3f8('0x3b')]};return db[_0xe3f8('0x2c')]['count'](_0x2f8d03)['then'](function(_0xb097c9){_0x506c50[_0xe3f8('0x25')]=_0xb097c9;if(_0x5f34b3[_0xe3f8('0x31')]['includeAll']){_0x3fdb8d[_0xe3f8('0x41')]=[{'all':!![]}];}return db[_0xe3f8('0x2c')][_0xe3f8('0x42')](_0x3fdb8d);})['then'](function(_0x5a038a){_0x506c50[_0xe3f8('0x43')]=_0x5a038a;return _0x506c50;})[_0xe3f8('0x15')](respondWithFilteredResult(_0x244984,_0x3fdb8d))['catch'](handleError(_0x244984,null));};exports[_0xe3f8('0x44')]=function(_0x52d9ba,_0x3f421e){var _0x5c8572={'raw':!![],'where':{'id':_0x52d9ba[_0xe3f8('0x45')]['id']}},_0x45998d={};_0x45998d[_0xe3f8('0x2f')]=_[_0xe3f8('0x46')](db['MailMessage'][_0xe3f8('0x47')]);_0x45998d[_0xe3f8('0x31')]=_[_0xe3f8('0x46')](_0x52d9ba['query']);_0x45998d['filters']=_[_0xe3f8('0x33')](_0x45998d[_0xe3f8('0x2f')],_0x45998d['query']);_0x5c8572[_0xe3f8('0x34')]=_[_0xe3f8('0x33')](_0x45998d[_0xe3f8('0x2f')],qs[_0xe3f8('0x35')](_0x52d9ba['query']['fields']));_0x5c8572[_0xe3f8('0x34')]=_0x5c8572[_0xe3f8('0x34')][_0xe3f8('0x36')]?_0x5c8572['attributes']:_0x45998d[_0xe3f8('0x2f')];if(_0x52d9ba[_0xe3f8('0x31')]['includeAll']){_0x5c8572[_0xe3f8('0x41')]=[{'all':!![]}];}_0x5c8572=_[_0xe3f8('0x3f')]({},_0x5c8572,_0x52d9ba['options']);return db['MailMessage'][_0xe3f8('0x48')](_0x5c8572)['then'](handleEntityNotFound(_0x3f421e,null))[_0xe3f8('0x15')](respondWithResult(_0x3f421e,null))[_0xe3f8('0x49')](handleError(_0x3f421e,null));};exports[_0xe3f8('0x4a')]=function(_0x499c53,_0xef012a){if(_0x499c53[_0xe3f8('0x4b')]['id']){delete _0x499c53[_0xe3f8('0x4b')]['id'];}return db['MailMessage'][_0xe3f8('0x48')]({'where':{'id':_0x499c53[_0xe3f8('0x45')]['id']}})[_0xe3f8('0x15')](handleEntityNotFound(_0xef012a,null))[_0xe3f8('0x15')](saveUpdates(_0x499c53[_0xe3f8('0x4b')],null))[_0xe3f8('0x15')](respondWithResult(_0xef012a,null))[_0xe3f8('0x49')](handleError(_0xef012a,null));};exports[_0xe3f8('0x4c')]=function(_0x54f682,_0x2408ea){return db[_0xe3f8('0x2c')][_0xe3f8('0x48')]({'where':{'id':_0x54f682[_0xe3f8('0x45')]['id']}})[_0xe3f8('0x15')](handleEntityNotFound(_0x2408ea,null))['then'](removeEntity(_0x2408ea,null))[_0xe3f8('0x49')](handleError(_0x2408ea,null));};exports[_0xe3f8('0x4d')]=function(_0x536b48,_0x28f9a8){return db['MailMessage'][_0xe3f8('0x4d')]()[_0xe3f8('0x15')](respondWithResult(_0x28f9a8,null))['catch'](handleError(_0x28f9a8,null));};exports[_0xe3f8('0x4e')]=function(_0x222dd9,_0x287238){return db[_0xe3f8('0x2c')][_0xe3f8('0x4e')](_0x222dd9[_0xe3f8('0x4b')])[_0xe3f8('0x15')](function(_0x50c516){if(_0x50c516){if(_0x50c516[_0xe3f8('0x4f')]==='out'&&!_0x50c516['secret']){var _0x542692,_0x1c3ec,_0x51694d;if(_0x222dd9['body']['to']){_0x1c3ec=_0x222dd9[_0xe3f8('0x4b')]['to'][_0xe3f8('0x50')](',')[0x0];}return db[_0xe3f8('0x51')][_0xe3f8('0x52')]({'where':{'id':_0x50c516['MailAccountId']},'include':[{'model':db[_0xe3f8('0x53')],'as':_0xe3f8('0x54'),'include':[{'model':db[_0xe3f8('0x55')],'as':'Contacts','where':{'email':_0x1c3ec},'limit':0x1,'order':[[_0xe3f8('0x56'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](function(_0x46c565){_0x542692=_0x46c565;if(_0x542692&&_0x542692[_0xe3f8('0x57')]){var _0x27914d={'tls':{'rejectUnauthorized':![]}};if(_[_0xe3f8('0x58')](_0x542692[_0xe3f8('0x57')][_0xe3f8('0x59')])){_0x27914d[_0xe3f8('0x5a')]=_0x542692[_0xe3f8('0x57')][_0xe3f8('0x5a')];_0x27914d[_0xe3f8('0x5b')]=_0x542692[_0xe3f8('0x57')][_0xe3f8('0x5b')];_0x27914d['secure']=_0x542692[_0xe3f8('0x57')][_0xe3f8('0x5c')];if(_0x542692[_0xe3f8('0x57')]['authentication']){_0x27914d['auth']={'user':_0x542692['Smtp']['user'],'pass':_0x542692['Smtp'][_0xe3f8('0x5d')]};}}else{_0x27914d[_0xe3f8('0x59')]=_0x542692[_0xe3f8('0x57')]['service'];_0x27914d['auth']={'user':_0x542692[_0xe3f8('0x57')][_0xe3f8('0x5e')],'pass':_0x542692[_0xe3f8('0x57')][_0xe3f8('0x5d')]};_0x27914d[_0xe3f8('0x5c')]=_0x542692[_0xe3f8('0x57')][_0xe3f8('0x5c')];}if(_0x222dd9[_0xe3f8('0x4b')][_0xe3f8('0x5f')]&&_0x222dd9[_0xe3f8('0x4b')]['attachments'][_0xe3f8('0x36')]){for(var _0x326072=0x0;_0x326072<_0x222dd9['body'][_0xe3f8('0x5f')][_0xe3f8('0x36')];_0x326072+=0x1){_0x222dd9[_0xe3f8('0x4b')]['attachments'][_0x326072]={'filename':_0x222dd9['body'][_0xe3f8('0x5f')][_0x326072][_0xe3f8('0x30')],'path':path[_0xe3f8('0x60')](config['root'],_0xe3f8('0x61'),_0x222dd9['body'][_0xe3f8('0x5f')][_0x326072][_0xe3f8('0x62')])};}}_0x51694d={'account':_0x27914d,'message':_0x222dd9[_0xe3f8('0x4b')]};return;}})[_0xe3f8('0x15')](function(){if(_0x542692[_0xe3f8('0x54')]){if(_0x542692['List'][_0xe3f8('0x63')][_0xe3f8('0x36')]){return _0x542692[_0xe3f8('0x54')][_0xe3f8('0x63')][0x0];}else{return db[_0xe3f8('0x55')][_0xe3f8('0x4e')](_['defaults'](_0x222dd9['body'],{'firstName':_0x222dd9[_0xe3f8('0x4b')]['to'],'email':_0x222dd9[_0xe3f8('0x4b')]['to'],'phone':_0x222dd9[_0xe3f8('0x4b')]['to'],'ListId':_0x542692[_0xe3f8('0x64')]}));}}else{throw new Error(_0xe3f8('0x65'));}})['then'](function(){if(_0x51694d){return respondWithRpcPromise('SendMail',_0xe3f8('0x66'),_0x51694d,client9003)[_0xe3f8('0x15')](function(_0x478388){return _0x50c516[_0xe3f8('0x4a')]({'read':!![],'messageId':_0x478388[_0xe3f8('0x67')],'sentAt':moment()[_0xe3f8('0x68')](_0xe3f8('0x69'))});})[_0xe3f8('0x49')](function(_0x4b347b){logger[_0xe3f8('0x1c')]('%s',JSON[_0xe3f8('0x1b')](_0x4b347b));return _0x50c516;});}return _0x50c516;});}return _0x50c516;}})[_0xe3f8('0x15')](respondWithResult(_0x287238,0xc9))['catch'](handleError(_0x287238,null));};exports[_0xe3f8('0x6a')]=function(_0x575c18,_0x54bdcd){var _0xd566f3={'agent':{},'channel':_0xe3f8('0x6b')};if(_0x575c18['body']['id']){delete _0x575c18[_0xe3f8('0x4b')]['id'];}_0x575c18[_0xe3f8('0x4b')][_0xe3f8('0x6c')]=!![];_0x575c18[_0xe3f8('0x4b')][_0xe3f8('0x6d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x575c18['body'][_0xe3f8('0x6e')]=_0x575c18['body']['UserId']||_0x575c18[_0xe3f8('0x5e')]['id'];_0xd566f3[_0xe3f8('0x6f')]['id']=_0x575c18[_0xe3f8('0x4b')][_0xe3f8('0x6e')];return db['MailMessage']['find']({'where':{'id':_0x575c18[_0xe3f8('0x45')]['id'],'UserId':null}})[_0xe3f8('0x15')](handleEntityNotFound(_0x54bdcd,null))['then'](saveUpdates(_0x575c18['body'],null))['then'](function(_0x27cac0){if(_0x27cac0){_0xd566f3[_0xe3f8('0x1e')]=_0x27cac0[_0xe3f8('0x70')]({'plain':!![]});return db['MailInteraction'][_0xe3f8('0x48')]({'where':{'id':_0x27cac0['MailInteractionId']}});}return null;})[_0xe3f8('0x15')](handleEntityNotFound(_0x54bdcd,null))[_0xe3f8('0x15')](function(_0x126fa8){if(_0x126fa8){return _0x126fa8[_0xe3f8('0x4a')]({'UserId':_0x575c18[_0xe3f8('0x4b')][_0xe3f8('0x6e')],'read1stAt':_[_0xe3f8('0x58')](_0x126fa8[_0xe3f8('0x71')])?moment()[_0xe3f8('0x68')](_0xe3f8('0x69')):undefined});}return null;})[_0xe3f8('0x15')](function(_0x263c20){if(_0x263c20){_0xd566f3[_0xe3f8('0x72')]=_0x263c20[_0xe3f8('0x70')]({'plain':!![]});interaction_log[_0xe3f8('0x16')](_0xe3f8('0x73'),_0x575c18['user']['id'],_0x575c18[_0xe3f8('0x5e')][_0xe3f8('0x30')],_0x575c18['user'][_0xe3f8('0x74')],_0xd566f3['interaction']['id'],_0x575c18[_0xe3f8('0x4b')]?JSON[_0xe3f8('0x1b')](_0x575c18['body']):'null');return respondWithRpcPromise(_0xe3f8('0x75'),_0xe3f8('0x76'),_0xd566f3);}return null;})[_0xe3f8('0x15')](function(_0x3252d6){var _0x508b40='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3252d6[_0xe3f8('0x1e')][_0xe3f8('0x77')];return db['sequelize'][_0xe3f8('0x31')](_0x508b40,{'type':db[_0xe3f8('0x78')]['QueryTypes'][_0xe3f8('0x79')],'raw':!![]})[_0xe3f8('0x15')](function(_0x1ff38b){return _0x1ff38b;});})[_0xe3f8('0x15')](function(_0x32a339){if(_0x32a339){_0xd566f3[_0xe3f8('0x1e')][_0xe3f8('0x7a')]=_0x32a339[0x0];if(!_0x575c18[_0xe3f8('0x4b')][_0xe3f8('0x6e')])return;return db['User'][_0xe3f8('0x48')]({'where':{'id':_0x575c18[_0xe3f8('0x4b')][_0xe3f8('0x6e')],'role':_0xe3f8('0x6f')},'attributes':['id',_0xe3f8('0x30'),_0xe3f8('0x7b'),_0xe3f8('0x7c'),_0xe3f8('0x7d')],'raw':!![]});}return null;})['then'](function(_0x5103b4){if(!_0x5103b4)return null;_0xd566f3[_0xe3f8('0x1e')]['agent']=_0x5103b4;return _0xd566f3;})[_0xe3f8('0x15')](function(_0x22f836){if(_0x22f836){if(_0x575c18['body'][_0xe3f8('0x7e')]){_0xd566f3[_0xe3f8('0x1e')][_0xe3f8('0x7f')]=util[_0xe3f8('0x68')]('SIP/%s',_0x575c18[_0xe3f8('0x5e')][_0xe3f8('0x30')]);_0xd566f3[_0xe3f8('0x1e')][_0xe3f8('0x80')]=_0xd566f3[_0xe3f8('0x80')];_0xd566f3[_0xe3f8('0x1e')][_0xe3f8('0x81')]=_0xd566f3[_0xe3f8('0x80')];_0xd566f3['message'][_0xe3f8('0x82')]=_0xe3f8('0x6a');_0xd566f3[_0xe3f8('0x1e')]['body']=htmlToText[_0xe3f8('0x83')](_0xd566f3[_0xe3f8('0x1e')][_0xe3f8('0x4b')]);return respondWithRpcPromise(_0xe3f8('0x84'),_0xe3f8('0x84'),{'event':_0xe3f8('0x85'),'message':_0xd566f3['message']},client9002)[_0xe3f8('0x15')](function(){return _0xd566f3;});}return _0xd566f3;}return null;})[_0xe3f8('0x15')](respondWithResult(_0x54bdcd,null))[_0xe3f8('0x49')](handleError(_0x54bdcd,null));};exports[_0xe3f8('0x86')]=function(_0x2cf491,_0x13de35){var _0x34c9f5={'agent':{},'channel':_0xe3f8('0x6b')};if(_0x2cf491[_0xe3f8('0x4b')]['id']){delete _0x2cf491['body']['id'];}_0x2cf491[_0xe3f8('0x4b')][_0xe3f8('0x6e')]=_0x2cf491[_0xe3f8('0x4b')][_0xe3f8('0x6e')]||_0x2cf491[_0xe3f8('0x5e')]['id'];_0x34c9f5[_0xe3f8('0x6f')]['id']=_0x2cf491[_0xe3f8('0x4b')][_0xe3f8('0x6e')];return db[_0xe3f8('0x2c')][_0xe3f8('0x48')]({'where':{'id':_0x2cf491['params']['id'],'UserId':null}})[_0xe3f8('0x15')](handleEntityNotFound(_0x13de35,null))[_0xe3f8('0x15')](function(_0xfd52eb){if(_0xfd52eb){_0x34c9f5[_0xe3f8('0x1e')]=_0xfd52eb[_0xe3f8('0x70')]({'plain':!![]});return db['MailInteraction'][_0xe3f8('0x48')]({'where':{'id':_0xfd52eb[_0xe3f8('0x87')]}});}return null;})[_0xe3f8('0x15')](handleEntityNotFound(_0x13de35,null))[_0xe3f8('0x15')](function(_0x2d2303){if(_0x2d2303){_0x34c9f5[_0xe3f8('0x72')]=_0x2d2303[_0xe3f8('0x70')]({'plain':!![]});interaction_log[_0xe3f8('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cf491[_0xe3f8('0x5e')]['id'],_0x2cf491[_0xe3f8('0x5e')]['name'],_0x2cf491['user']['role'],_0x34c9f5[_0xe3f8('0x72')]['id'],_0x2cf491['body']?JSON[_0xe3f8('0x1b')](_0x2cf491[_0xe3f8('0x4b')]):_0xe3f8('0x88'));return respondWithRpcPromise(_0xe3f8('0x89'),_0xe3f8('0x8a'),_0x34c9f5);}return null;})[_0xe3f8('0x15')](function(_0x2ca1a3){var _0x540a88='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ca1a3[_0xe3f8('0x1e')][_0xe3f8('0x77')];return db[_0xe3f8('0x8b')][_0xe3f8('0x31')](_0x540a88,{'type':db[_0xe3f8('0x78')][_0xe3f8('0x8c')]['SELECT'],'raw':!![]})[_0xe3f8('0x15')](function(_0x36b243){return _0x36b243;});})['then'](function(_0x3e3a43){if(_0x3e3a43){_0x34c9f5[_0xe3f8('0x1e')][_0xe3f8('0x7a')]=_0x3e3a43[0x0];if(!_0x2cf491[_0xe3f8('0x4b')][_0xe3f8('0x6e')])return;return db[_0xe3f8('0x8d')][_0xe3f8('0x48')]({'where':{'id':_0x2cf491[_0xe3f8('0x4b')][_0xe3f8('0x6e')],'role':_0xe3f8('0x6f')},'attributes':['id','name',_0xe3f8('0x7b'),'email',_0xe3f8('0x7d')],'raw':!![]});}return null;})['then'](function(_0x170014){if(!_0x170014)return null;_0x34c9f5[_0xe3f8('0x1e')][_0xe3f8('0x6f')]=_0x170014;return _0x34c9f5;})['then'](function(_0x520403){if(_0x520403){_0x520403[_0xe3f8('0x1e')][_0xe3f8('0x7f')]=util['format'](_0xe3f8('0x8e'),_0x2cf491[_0xe3f8('0x5e')][_0xe3f8('0x30')]);_0x520403[_0xe3f8('0x1e')]['channel']=_0x34c9f5[_0xe3f8('0x80')];_0x520403[_0xe3f8('0x1e')][_0xe3f8('0x81')]=_0x34c9f5['channel'];_0x520403['message'][_0xe3f8('0x82')]=_0xe3f8('0x86');_0x520403[_0xe3f8('0x1e')][_0xe3f8('0x4b')]=htmlToText[_0xe3f8('0x83')](_0x34c9f5['message'][_0xe3f8('0x4b')]);respondWithRpcPromise(_0xe3f8('0x84'),'EventManager',{'event':_0xe3f8('0x8f'),'message':_0x520403['message']},client9002);return _0x34c9f5;}return null;})['then'](respondWithResult(_0x13de35,null))[_0xe3f8('0x49')](handleError(_0x13de35,null));};exports[_0xe3f8('0x90')]=function(_0x411177,_0x549c5a){var _0x1f1c70=moment()['unix']()['toString']();var _0x72342f=path['join'](config[_0xe3f8('0x91')],_0xe3f8('0x92'),_0xe3f8('0x93'),'tmp');var _0x13be34=path[_0xe3f8('0x60')](config[_0xe3f8('0x91')],_0xe3f8('0x92'),_0xe3f8('0x93'),_0xe3f8('0x5f'));var _0x45ddd6=util[_0xe3f8('0x68')](_0xe3f8('0x94'),_0x1f1c70);return db[_0xe3f8('0x2c')][_0xe3f8('0x48')]({'where':{'id':_0x411177['params']['id']},'attributes':['id','body','from','to','cc',_0xe3f8('0x95'),_0xe3f8('0x96'),_0xe3f8('0x97')],'include':_0x411177[_0xe3f8('0x31')][_0xe3f8('0x5f')]?[{'model':db[_0xe3f8('0x98')],'as':'Attachments'}]:undefined})[_0xe3f8('0x15')](handleEntityNotFound(_0x549c5a,null))[_0xe3f8('0x15')](function(_0x54c1b8){if(_0x54c1b8){var _0x29e745=_0x54c1b8;var _0x2c9e4d={'from':_0x29e745[_0xe3f8('0x99')],'to':_0x29e745['to'],'subject':_0x29e745[_0xe3f8('0x96')],'html':htmlEntities[_0xe3f8('0x9a')](_0x29e745[_0xe3f8('0x4b')]),'headers':{'Date':moment(_0x29e745['createdAt'])['format'](_0xe3f8('0x9b'))},'attachments':[]};if(_0x54c1b8['cc']){_0x2c9e4d['headers']['Cc']=_0x54c1b8['cc'];}if(_0x54c1b8['bcc']){_0x2c9e4d['headers']['Bcc']=_0x54c1b8['bcc'];}return new BPromise(function(_0x5d9885,_0x2d0c9d){if(_0x54c1b8[_0xe3f8('0x9c')]){for(var _0x182288=0x0;_0x182288<_0x54c1b8['Attachments'][_0xe3f8('0x36')];_0x182288++){var _0x4693dd=_0x54c1b8[_0xe3f8('0x9c')][_0x182288];var _0x4b8a9c=path[_0xe3f8('0x60')](_0x13be34,_0x4693dd[_0xe3f8('0x62')]);if(fs[_0xe3f8('0x9d')](_0x4b8a9c)){_0x2c9e4d[_0xe3f8('0x5f')][_0xe3f8('0x9e')]({'name':_0x4693dd[_0xe3f8('0x30')],'contentType':_0x4693dd[_0xe3f8('0x9f')],'data':fs['readFileSync'](_0x4b8a9c)});}}}emlformat[_0xe3f8('0xa0')](_0x2c9e4d,function(_0x3e9222,_0x537383){if(_0x3e9222)return _0x2d0c9d(_0x3e9222);fs[_0xe3f8('0xa1')](path[_0xe3f8('0x60')](_0x72342f,_0x45ddd6),_0x537383);return _0x5d9885(_0x537383);});});}})['then'](function(_0x4b4613){if(_0x4b4613){return _0x549c5a['download'](path[_0xe3f8('0x60')](_0x72342f,_0x45ddd6),_0x45ddd6,function(_0x24c991){if(!_0x24c991)fs['unlinkSync'](path[_0xe3f8('0x60')](_0x72342f,_0x45ddd6));});}})[_0xe3f8('0x49')](handleError(_0x549c5a,null));}; \ No newline at end of file +var _0x493c=['error','message','result','status','offset','count','limit','set','Content-Range','json','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','MailMessage','findAll','show','params','find','catch','body','destroy','describe','create','direction','out','secret','split','findOne','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','internal','interface','rejectmessage','download','join','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','register','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x52c167,_0x195e96){var _0x3d1e3f=function(_0x5d3f61){while(--_0x5d3f61){_0x52c167['push'](_0x52c167['shift']());}};_0x3d1e3f(++_0x195e96);}(_0x493c,0x8b));var _0xc493=function(_0x15730a,_0x232a9e){_0x15730a=_0x15730a-0x0;var _0xc9030d=_0x493c[_0x15730a];return _0xc9030d;};'use strict';var emlformat=require(_0xc493('0x0'));var moment=require('moment');var BPromise=require(_0xc493('0x1'));var util=require(_0xc493('0x2'));var path=require(_0xc493('0x3'));var fs=require('fs');var _=require(_0xc493('0x4'));var Redis=require(_0xc493('0x5'));var htmlToText=require(_0xc493('0x6'));var qs=require(_0xc493('0x7'));var logger=require(_0xc493('0x8'))(_0xc493('0x9'));var interaction_log=require(_0xc493('0x8'))(_0xc493('0xa'));var config=require(_0xc493('0xb'));var db=require('../../mysqldb')['db'];config[_0xc493('0xc')]=_[_0xc493('0xd')](config['redis'],{'host':_0xc493('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xc493('0xf')](socket);var jayson=require(_0xc493('0x10'));var client=jayson['client'][_0xc493('0x11')]({'port':0x232c});var client9003=jayson[_0xc493('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xc493('0x12')][_0xc493('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4d396f,_0x409b8b,_0x56dc1b,_0x2ca966){return new BPromise(function(_0xef4f8b,_0x27a28e){var _0x9ebc39=_0x2ca966||client;return _0x9ebc39['request'](_0x4d396f,_0x56dc1b)[_0xc493('0x13')](function(_0xe7bc4){logger[_0xc493('0x14')](_0xc493('0x15'),_0x409b8b,_0xc493('0x16'));logger['debug'](_0xc493('0x17'),_0x409b8b,_0xc493('0x16'),JSON[_0xc493('0x18')](_0xe7bc4));if(_0xe7bc4[_0xc493('0x19')]){if(_0xe7bc4[_0xc493('0x19')]['code']===0x1f4){logger['error'](_0xc493('0x15'),_0x409b8b,_0xe7bc4['error'][_0xc493('0x1a')]);return _0x27a28e(_0xe7bc4[_0xc493('0x19')][_0xc493('0x1a')]);}logger[_0xc493('0x19')](_0xc493('0x15'),_0x409b8b,_0xe7bc4[_0xc493('0x19')][_0xc493('0x1a')]);return _0xef4f8b(_0xe7bc4[_0xc493('0x19')][_0xc493('0x1a')]);}else{logger[_0xc493('0x14')](_0xc493('0x15'),_0x409b8b,'request\x20sent');_0xef4f8b(_0xe7bc4[_0xc493('0x1b')][_0xc493('0x1a')]);}})['catch'](function(_0x455117){logger[_0xc493('0x19')]('MailMessage,\x20%s,\x20%s',_0x409b8b,_0x455117);_0x27a28e(_0x455117);});});}function respondWithResult(_0xaa91cd,_0x320f29){_0x320f29=_0x320f29||0xc8;return function(_0x247823){if(_0x247823){return _0xaa91cd[_0xc493('0x1c')](_0x320f29)['json'](_0x247823);}};}function respondWithFilteredResult(_0x655e13,_0x1999b2){return function(_0x549df4){if(_0x549df4){var _0x3eae2f=typeof _0x1999b2[_0xc493('0x1d')]==='undefined'&&typeof _0x1999b2['limit']==='undefined';var _0x39fa2b=_0x549df4[_0xc493('0x1e')];var _0x8bb747=_0x3eae2f?0x0:_0x1999b2[_0xc493('0x1d')];var _0x3fdbee=_0x3eae2f?_0x549df4['count']:_0x1999b2[_0xc493('0x1d')]+_0x1999b2[_0xc493('0x1f')];var _0x2bd3ef;if(_0x3fdbee>=_0x39fa2b){_0x3fdbee=_0x39fa2b;_0x2bd3ef=0xc8;}else{_0x2bd3ef=0xce;}_0x655e13[_0xc493('0x1c')](_0x2bd3ef);return _0x655e13[_0xc493('0x20')](_0xc493('0x21'),_0x8bb747+'-'+_0x3fdbee+'/'+_0x39fa2b)[_0xc493('0x22')](_0x549df4);}return null;};}function saveUpdates(_0x271794){return function(_0x291bba){if(_0x291bba){return _0x291bba['update'](_0x271794)[_0xc493('0x13')](function(_0x1fbf58){return _0x1fbf58;});}return null;};}function removeEntity(_0x1332db){return function(_0x1978f1){if(_0x1978f1){return _0x1978f1['destroy']()[_0xc493('0x13')](function(){_0x1332db[_0xc493('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf18444){return function(_0x4ee280){if(!_0x4ee280){_0xf18444['sendStatus'](0x194);}return _0x4ee280;};}function handleError(_0x204c13,_0x499c7c){_0x499c7c=_0x499c7c||0x1f4;return function(_0x3a7a7e){logger[_0xc493('0x19')](_0x3a7a7e[_0xc493('0x23')]);if(_0x3a7a7e[_0xc493('0x24')]){delete _0x3a7a7e[_0xc493('0x24')];}_0x204c13[_0xc493('0x1c')](_0x499c7c)[_0xc493('0x25')](_0x3a7a7e);};}exports[_0xc493('0x26')]=function(_0x2a5bfc,_0x2e0df0){var _0x54a614={},_0x3f53ef={},_0x5021d6={'count':0x0,'rows':[]};var _0x2d71da=_[_0xc493('0x27')](db['MailMessage'][_0xc493('0x28')],function(_0x2b246a){return{'name':_0x2b246a[_0xc493('0x29')],'type':_0x2b246a['type']['key']};});_0x3f53ef[_0xc493('0x2a')]=_[_0xc493('0x27')](_0x2d71da,_0xc493('0x24'));_0x3f53ef[_0xc493('0x2b')]=_[_0xc493('0x2c')](_0x2a5bfc[_0xc493('0x2b')]);_0x3f53ef[_0xc493('0x2d')]=_['intersection'](_0x3f53ef['model'],_0x3f53ef['query']);_0x54a614[_0xc493('0x2e')]=_[_0xc493('0x2f')](_0x3f53ef[_0xc493('0x2a')],qs[_0xc493('0x30')](_0x2a5bfc['query'][_0xc493('0x30')]));_0x54a614['attributes']=_0x54a614['attributes'][_0xc493('0x31')]?_0x54a614[_0xc493('0x2e')]:_0x3f53ef[_0xc493('0x2a')];if(!_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x32')](_0xc493('0x33'))){_0x54a614[_0xc493('0x1f')]=qs[_0xc493('0x1f')](_0x2a5bfc['query'][_0xc493('0x1f')]);_0x54a614[_0xc493('0x1d')]=qs[_0xc493('0x1d')](_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x1d')]);}_0x54a614[_0xc493('0x34')]=qs['sort'](_0x2a5bfc['query'][_0xc493('0x35')]);_0x54a614['where']=qs[_0xc493('0x2d')](_[_0xc493('0x36')](_0x2a5bfc['query'],_0x3f53ef[_0xc493('0x2d')]),_0x2d71da);if(_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x37')]){_0x54a614['where']=_[_0xc493('0x38')](_0x54a614[_0xc493('0x39')],{'$or':_['map'](_0x2d71da,function(_0xbcb9b5){if(_0xbcb9b5[_0xc493('0x3a')]!==_0xc493('0x3b')){var _0x39873c={};_0x39873c[_0xbcb9b5['name']]={'$like':'%'+_0x2a5bfc['query'][_0xc493('0x37')]+'%'};return _0x39873c;}})});}_0x54a614=_[_0xc493('0x38')]({},_0x54a614,_0x2a5bfc[_0xc493('0x3c')]);var _0x11c728={'where':_0x54a614[_0xc493('0x39')]};return db['MailMessage'][_0xc493('0x1e')](_0x11c728)['then'](function(_0x311192){_0x5021d6[_0xc493('0x1e')]=_0x311192;if(_0x2a5bfc[_0xc493('0x2b')][_0xc493('0x3d')]){_0x54a614[_0xc493('0x3e')]=[{'all':!![]}];}return db[_0xc493('0x3f')][_0xc493('0x40')](_0x54a614);})[_0xc493('0x13')](function(_0x16b224){_0x5021d6['rows']=_0x16b224;return _0x5021d6;})[_0xc493('0x13')](respondWithFilteredResult(_0x2e0df0,_0x54a614))['catch'](handleError(_0x2e0df0,null));};exports[_0xc493('0x41')]=function(_0x4011e1,_0x345976){var _0x5c66e5={'raw':!![],'where':{'id':_0x4011e1[_0xc493('0x42')]['id']}},_0x2dcbd8={};_0x2dcbd8[_0xc493('0x2a')]=_['keys'](db[_0xc493('0x3f')][_0xc493('0x28')]);_0x2dcbd8[_0xc493('0x2b')]=_['keys'](_0x4011e1[_0xc493('0x2b')]);_0x2dcbd8[_0xc493('0x2d')]=_[_0xc493('0x2f')](_0x2dcbd8['model'],_0x2dcbd8['query']);_0x5c66e5['attributes']=_['intersection'](_0x2dcbd8['model'],qs[_0xc493('0x30')](_0x4011e1['query'][_0xc493('0x30')]));_0x5c66e5[_0xc493('0x2e')]=_0x5c66e5[_0xc493('0x2e')][_0xc493('0x31')]?_0x5c66e5['attributes']:_0x2dcbd8[_0xc493('0x2a')];if(_0x4011e1['query'][_0xc493('0x3d')]){_0x5c66e5[_0xc493('0x3e')]=[{'all':!![]}];}_0x5c66e5=_[_0xc493('0x38')]({},_0x5c66e5,_0x4011e1[_0xc493('0x3c')]);return db[_0xc493('0x3f')][_0xc493('0x43')](_0x5c66e5)[_0xc493('0x13')](handleEntityNotFound(_0x345976,null))['then'](respondWithResult(_0x345976,null))[_0xc493('0x44')](handleError(_0x345976,null));};exports['update']=function(_0x2c6f2f,_0x2be73f){if(_0x2c6f2f['body']['id']){delete _0x2c6f2f[_0xc493('0x45')]['id'];}return db['MailMessage'][_0xc493('0x43')]({'where':{'id':_0x2c6f2f[_0xc493('0x42')]['id']}})[_0xc493('0x13')](handleEntityNotFound(_0x2be73f,null))[_0xc493('0x13')](saveUpdates(_0x2c6f2f[_0xc493('0x45')],null))['then'](respondWithResult(_0x2be73f,null))[_0xc493('0x44')](handleError(_0x2be73f,null));};exports[_0xc493('0x46')]=function(_0x59b7bf,_0x1c6221){return db[_0xc493('0x3f')][_0xc493('0x43')]({'where':{'id':_0x59b7bf[_0xc493('0x42')]['id']}})[_0xc493('0x13')](handleEntityNotFound(_0x1c6221,null))[_0xc493('0x13')](removeEntity(_0x1c6221,null))['catch'](handleError(_0x1c6221,null));};exports[_0xc493('0x47')]=function(_0x573bde,_0xebb0fa){return db[_0xc493('0x3f')][_0xc493('0x47')]()[_0xc493('0x13')](respondWithResult(_0xebb0fa,null))[_0xc493('0x44')](handleError(_0xebb0fa,null));};exports[_0xc493('0x48')]=function(_0x301252,_0x3f73c2){return db['MailMessage'][_0xc493('0x48')](_0x301252[_0xc493('0x45')])[_0xc493('0x13')](function(_0x95f5b9){if(_0x95f5b9){if(_0x95f5b9[_0xc493('0x49')]===_0xc493('0x4a')&&!_0x95f5b9[_0xc493('0x4b')]){var _0x147e9f,_0x21b02c,_0x4d64c6;if(_0x301252[_0xc493('0x45')]['to']){_0x21b02c=_0x301252['body']['to'][_0xc493('0x4c')](',')[0x0];}return db['MailAccount'][_0xc493('0x4d')]({'where':{'id':_0x95f5b9[_0xc493('0x4e')]},'include':[{'model':db['CmList'],'as':_0xc493('0x4f'),'include':[{'model':db['CmContact'],'as':_0xc493('0x50'),'where':{'email':_0x21b02c},'limit':0x1,'order':[[_0xc493('0x51'),_0xc493('0x52')]]}]},{'model':db[_0xc493('0x53')],'as':_0xc493('0x54'),'raw':!![]}]})[_0xc493('0x13')](function(_0x1b94d1){_0x147e9f=_0x1b94d1;if(_0x147e9f&&_0x147e9f[_0xc493('0x54')]){var _0x4cc2bb={'tls':{'rejectUnauthorized':![]}};if(_[_0xc493('0x55')](_0x147e9f[_0xc493('0x54')][_0xc493('0x56')])){_0x4cc2bb['host']=_0x147e9f['Smtp'][_0xc493('0x57')];_0x4cc2bb[_0xc493('0x58')]=_0x147e9f[_0xc493('0x54')][_0xc493('0x58')];_0x4cc2bb[_0xc493('0x59')]=_0x147e9f['Smtp'][_0xc493('0x59')];if(_0x147e9f['Smtp'][_0xc493('0x5a')]){_0x4cc2bb[_0xc493('0x5b')]={'user':_0x147e9f[_0xc493('0x54')][_0xc493('0x5c')],'pass':_0x147e9f[_0xc493('0x54')][_0xc493('0x5d')]};}}else{_0x4cc2bb[_0xc493('0x56')]=_0x147e9f[_0xc493('0x54')][_0xc493('0x56')];_0x4cc2bb[_0xc493('0x5b')]={'user':_0x147e9f['Smtp']['user'],'pass':_0x147e9f[_0xc493('0x54')][_0xc493('0x5d')]};_0x4cc2bb[_0xc493('0x59')]=_0x147e9f[_0xc493('0x54')]['secure'];}if(_0x301252[_0xc493('0x45')][_0xc493('0x5e')]&&_0x301252['body'][_0xc493('0x5e')]['length']){for(var _0x2370e1=0x0;_0x2370e1<_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0xc493('0x31')];_0x2370e1+=0x1){_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0x2370e1]={'filename':_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0x2370e1][_0xc493('0x24')],'path':path['join'](config[_0xc493('0x5f')],_0xc493('0x60'),_0x301252[_0xc493('0x45')][_0xc493('0x5e')][_0x2370e1][_0xc493('0x61')])};}}_0x4d64c6={'account':_0x4cc2bb,'message':_0x301252[_0xc493('0x45')]};return;}})[_0xc493('0x13')](function(){if(_0x147e9f[_0xc493('0x4f')]){if(_0x147e9f[_0xc493('0x4f')][_0xc493('0x50')][_0xc493('0x31')]){return _0x147e9f[_0xc493('0x4f')][_0xc493('0x50')][0x0];}else{return db['CmContact']['create'](_[_0xc493('0xd')](_0x301252[_0xc493('0x45')],{'firstName':_0x301252[_0xc493('0x45')]['to'],'email':_0x301252['body']['to'],'phone':_0x301252['body']['to'],'ListId':_0x147e9f[_0xc493('0x62')]}));}}else{throw new Error(_0xc493('0x63'));}})[_0xc493('0x13')](function(){if(_0x4d64c6){return respondWithRpcPromise(_0xc493('0x64'),_0xc493('0x65'),_0x4d64c6,client9003)[_0xc493('0x13')](function(_0x369d77){return _0x95f5b9[_0xc493('0x66')]({'read':!![],'messageId':_0x369d77[_0xc493('0x67')],'sentAt':moment()[_0xc493('0x68')](_0xc493('0x69'))});})[_0xc493('0x44')](function(_0x278050){logger[_0xc493('0x19')]('%s',JSON[_0xc493('0x18')](_0x278050));return _0x95f5b9;});}return _0x95f5b9;});}return _0x95f5b9;}})[_0xc493('0x13')](respondWithResult(_0x3f73c2,0xc9))[_0xc493('0x44')](handleError(_0x3f73c2,null));};exports[_0xc493('0x6a')]=function(_0x37bb00,_0x3f4d88){var _0x1041c6={'agent':{},'channel':'mail'};if(_0x37bb00[_0xc493('0x45')]['id']){delete _0x37bb00['body']['id'];}_0x37bb00['body'][_0xc493('0x6b')]=!![];_0x37bb00[_0xc493('0x45')][_0xc493('0x6c')]=moment()['format'](_0xc493('0x69'));_0x37bb00['body'][_0xc493('0x6d')]=_0x37bb00['body'][_0xc493('0x6d')]||_0x37bb00[_0xc493('0x5c')]['id'];_0x1041c6[_0xc493('0x6e')]['id']=_0x37bb00[_0xc493('0x45')]['UserId'];return db[_0xc493('0x3f')][_0xc493('0x43')]({'where':{'id':_0x37bb00[_0xc493('0x42')]['id'],'UserId':null}})[_0xc493('0x13')](handleEntityNotFound(_0x3f4d88,null))[_0xc493('0x13')](saveUpdates(_0x37bb00[_0xc493('0x45')],null))[_0xc493('0x13')](function(_0x33d713){if(_0x33d713){_0x1041c6['message']=_0x33d713[_0xc493('0x6f')]({'plain':!![]});return db[_0xc493('0x70')][_0xc493('0x43')]({'where':{'id':_0x33d713[_0xc493('0x71')]}});}return null;})[_0xc493('0x13')](handleEntityNotFound(_0x3f4d88,null))[_0xc493('0x13')](function(_0x3af029){if(_0x3af029){return _0x3af029[_0xc493('0x66')]({'UserId':_0x37bb00[_0xc493('0x45')][_0xc493('0x6d')],'read1stAt':_[_0xc493('0x55')](_0x3af029['read1stAt'])?moment()[_0xc493('0x68')](_0xc493('0x69')):undefined});}return null;})[_0xc493('0x13')](function(_0x1631ae){if(_0x1631ae){_0x1041c6[_0xc493('0x72')]=_0x1631ae['get']({'plain':!![]});interaction_log[_0xc493('0x14')](_0xc493('0x73'),_0x37bb00[_0xc493('0x5c')]['id'],_0x37bb00[_0xc493('0x5c')][_0xc493('0x24')],_0x37bb00[_0xc493('0x5c')]['role'],_0x1041c6[_0xc493('0x72')]['id'],_0x37bb00[_0xc493('0x45')]?JSON[_0xc493('0x18')](_0x37bb00[_0xc493('0x45')]):'null');return respondWithRpcPromise(_0xc493('0x74'),_0xc493('0x75'),_0x1041c6);}return null;})[_0xc493('0x13')](function(_0x1b6c8d){var _0x388622=_0xc493('0x76')+_0x1b6c8d[_0xc493('0x1a')][_0xc493('0x77')];return db[_0xc493('0x78')][_0xc493('0x2b')](_0x388622,{'type':db[_0xc493('0x79')][_0xc493('0x7a')][_0xc493('0x7b')],'raw':!![]})[_0xc493('0x13')](function(_0x18aae0){return _0x18aae0;});})[_0xc493('0x13')](function(_0xc2a5e2){if(_0xc2a5e2){_0x1041c6[_0xc493('0x1a')][_0xc493('0x7c')]=_0xc2a5e2[0x0];if(!_0x37bb00[_0xc493('0x45')][_0xc493('0x6d')])return;return db[_0xc493('0x7d')][_0xc493('0x43')]({'where':{'id':_0x37bb00[_0xc493('0x45')]['UserId'],'role':_0xc493('0x6e')},'attributes':['id',_0xc493('0x24'),_0xc493('0x7e'),_0xc493('0x7f'),'internal'],'raw':!![]});}return null;})[_0xc493('0x13')](function(_0x186979){if(!_0x186979)return null;_0x1041c6['message'][_0xc493('0x6e')]=_0x186979;return _0x1041c6;})['then'](function(_0x3c30ac){if(_0x3c30ac){if(_0x37bb00[_0xc493('0x45')]['manual']){_0x1041c6[_0xc493('0x1a')]['interface']=util[_0xc493('0x68')](_0xc493('0x80'),_0x37bb00[_0xc493('0x5c')][_0xc493('0x24')]);_0x1041c6[_0xc493('0x1a')][_0xc493('0x81')]=_0x1041c6['channel'];_0x1041c6[_0xc493('0x1a')][_0xc493('0x82')]=_0x1041c6[_0xc493('0x81')];_0x1041c6[_0xc493('0x1a')][_0xc493('0x83')]=_0xc493('0x6a');_0x1041c6['message'][_0xc493('0x45')]=htmlToText[_0xc493('0x84')](_0x1041c6['message'][_0xc493('0x45')]);return respondWithRpcPromise(_0xc493('0x85'),_0xc493('0x85'),{'event':_0xc493('0x86'),'message':_0x1041c6[_0xc493('0x1a')]},client9002)[_0xc493('0x13')](function(){return _0x1041c6;});}return _0x1041c6;}return null;})[_0xc493('0x13')](respondWithResult(_0x3f4d88,null))['catch'](handleError(_0x3f4d88,null));};exports[_0xc493('0x87')]=function(_0x4a065f,_0x1ded54){var _0x141e75={'agent':{},'channel':_0xc493('0x88')};if(_0x4a065f['body']['id']){delete _0x4a065f[_0xc493('0x45')]['id'];}_0x4a065f['body']['UserId']=_0x4a065f[_0xc493('0x45')]['UserId']||_0x4a065f[_0xc493('0x5c')]['id'];_0x141e75[_0xc493('0x6e')]['id']=_0x4a065f['body'][_0xc493('0x6d')];return db[_0xc493('0x3f')]['find']({'where':{'id':_0x4a065f[_0xc493('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ded54,null))[_0xc493('0x13')](function(_0x48b6d6){if(_0x48b6d6){_0x141e75[_0xc493('0x1a')]=_0x48b6d6['get']({'plain':!![]});return db['MailInteraction'][_0xc493('0x43')]({'where':{'id':_0x48b6d6[_0xc493('0x71')]}});}return null;})[_0xc493('0x13')](handleEntityNotFound(_0x1ded54,null))[_0xc493('0x13')](function(_0x43a383){if(_0x43a383){_0x141e75[_0xc493('0x72')]=_0x43a383[_0xc493('0x6f')]({'plain':!![]});interaction_log[_0xc493('0x14')](_0xc493('0x89'),_0x4a065f[_0xc493('0x5c')]['id'],_0x4a065f['user'][_0xc493('0x24')],_0x4a065f[_0xc493('0x5c')]['role'],_0x141e75[_0xc493('0x72')]['id'],_0x4a065f[_0xc493('0x45')]?JSON[_0xc493('0x18')](_0x4a065f['body']):_0xc493('0x8a'));return respondWithRpcPromise(_0xc493('0x8b'),'rejectMessage',_0x141e75);}return null;})['then'](function(_0x2f3ac7){var _0x21ebe1=_0xc493('0x76')+_0x2f3ac7[_0xc493('0x1a')][_0xc493('0x77')];return db[_0xc493('0x78')]['query'](_0x21ebe1,{'type':db[_0xc493('0x79')][_0xc493('0x7a')][_0xc493('0x7b')],'raw':!![]})['then'](function(_0x1854ab){return _0x1854ab;});})[_0xc493('0x13')](function(_0x50f431){if(_0x50f431){_0x141e75[_0xc493('0x1a')]['contact']=_0x50f431[0x0];if(!_0x4a065f[_0xc493('0x45')][_0xc493('0x6d')])return;return db[_0xc493('0x7d')]['find']({'where':{'id':_0x4a065f[_0xc493('0x45')][_0xc493('0x6d')],'role':_0xc493('0x6e')},'attributes':['id','name','fullname',_0xc493('0x7f'),_0xc493('0x8c')],'raw':!![]});}return null;})['then'](function(_0x54d8a0){if(!_0x54d8a0)return null;_0x141e75[_0xc493('0x1a')]['agent']=_0x54d8a0;return _0x141e75;})['then'](function(_0x38c5a8){if(_0x38c5a8){_0x38c5a8[_0xc493('0x1a')][_0xc493('0x8d')]=util[_0xc493('0x68')](_0xc493('0x80'),_0x4a065f[_0xc493('0x5c')]['name']);_0x38c5a8['message'][_0xc493('0x81')]=_0x141e75[_0xc493('0x81')];_0x38c5a8[_0xc493('0x1a')]['motionChannel']=_0x141e75[_0xc493('0x81')];_0x38c5a8[_0xc493('0x1a')][_0xc493('0x83')]='reject';_0x38c5a8[_0xc493('0x1a')]['body']=htmlToText['fromString'](_0x141e75[_0xc493('0x1a')][_0xc493('0x45')]);respondWithRpcPromise(_0xc493('0x85'),_0xc493('0x85'),{'event':_0xc493('0x8e'),'message':_0x38c5a8['message']},client9002);return _0x141e75;}return null;})['then'](respondWithResult(_0x1ded54,null))[_0xc493('0x44')](handleError(_0x1ded54,null));};exports[_0xc493('0x8f')]=function(_0x11e2e9,_0x2d4b88){var _0x45f41b=moment()['unix']()['toString']();var _0x2adb6f=path[_0xc493('0x90')](config[_0xc493('0x5f')],_0xc493('0x91'),_0xc493('0x92'),_0xc493('0x93'));var _0x401d12=path['join'](config[_0xc493('0x5f')],_0xc493('0x91'),_0xc493('0x92'),'attachments');var _0x2e8d3b=util[_0xc493('0x68')](_0xc493('0x94'),_0x45f41b);return db[_0xc493('0x3f')][_0xc493('0x43')]({'where':{'id':_0x11e2e9['params']['id']},'attributes':['id','body','from','to','cc',_0xc493('0x95'),_0xc493('0x96'),_0xc493('0x97')],'include':_0x11e2e9[_0xc493('0x2b')][_0xc493('0x5e')]?[{'model':db[_0xc493('0x98')],'as':'Attachments'}]:undefined})[_0xc493('0x13')](handleEntityNotFound(_0x2d4b88,null))[_0xc493('0x13')](function(_0x26c34b){if(_0x26c34b){var _0x48a2af=_0x26c34b;var _0x1891ea={'from':_0x48a2af[_0xc493('0x99')],'to':_0x48a2af['to'],'subject':_0x48a2af['subject'],'html':htmlEntities[_0xc493('0x9a')](_0x48a2af['body']),'headers':{'Date':moment(_0x48a2af[_0xc493('0x97')])[_0xc493('0x68')](_0xc493('0x9b'))},'attachments':[]};if(_0x26c34b['cc']){_0x1891ea[_0xc493('0x9c')]['Cc']=_0x26c34b['cc'];}if(_0x26c34b[_0xc493('0x95')]){_0x1891ea['headers']['Bcc']=_0x26c34b[_0xc493('0x95')];}return new BPromise(function(_0x5ce58a,_0xbd9ecd){if(_0x26c34b['Attachments']){for(var _0x1f3dff=0x0;_0x1f3dff<_0x26c34b[_0xc493('0x9d')][_0xc493('0x31')];_0x1f3dff++){var _0x282f0f=_0x26c34b[_0xc493('0x9d')][_0x1f3dff];var _0x228fd0=path[_0xc493('0x90')](_0x401d12,_0x282f0f['basename']);if(fs[_0xc493('0x9e')](_0x228fd0)){_0x1891ea[_0xc493('0x5e')][_0xc493('0x9f')]({'name':_0x282f0f[_0xc493('0x24')],'contentType':_0x282f0f[_0xc493('0x3a')],'data':fs[_0xc493('0xa0')](_0x228fd0)});}}}emlformat[_0xc493('0xa1')](_0x1891ea,function(_0x3e66ab,_0x5e7872){if(_0x3e66ab)return _0xbd9ecd(_0x3e66ab);fs[_0xc493('0xa2')](path[_0xc493('0x90')](_0x2adb6f,_0x2e8d3b),_0x5e7872);return _0x5ce58a(_0x5e7872);});});}})[_0xc493('0x13')](function(_0x1dff26){if(_0x1dff26){return _0x2d4b88[_0xc493('0x8f')](path[_0xc493('0x90')](_0x2adb6f,_0x2e8d3b),_0x2e8d3b,function(_0x2971fc){if(!_0x2971fc)fs[_0xc493('0xa3')](path[_0xc493('0x90')](_0x2adb6f,_0x2e8d3b));});}})['catch'](handleError(_0x2d4b88,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 626e9fe..b87634f 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 _0x0814=['events','../../mysqldb','save','remove','emit','exports'];(function(_0x3724cb,_0x373f97){var _0x24e9d9=function(_0x1c847c){while(--_0x1c847c){_0x3724cb['push'](_0x3724cb['shift']());}};_0x24e9d9(++_0x373f97);}(_0x0814,0x15c));var _0x4081=function(_0x355f57,_0x525da4){_0x355f57=_0x355f57-0x0;var _0x1fa8e2=_0x0814[_0x355f57];return _0x1fa8e2;};'use strict';var EventEmitter=require(_0x4081('0x0'));var MailMessage=require(_0x4081('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4081('0x2'),'afterUpdate':'update','afterDestroy':_0x4081('0x3')};function emitEvent(_0x56febd){return function(_0x40a999,_0xa815bb,_0x48d44e){MailMessageEvents['emit'](_0x56febd+':'+_0x40a999['id'],_0x40a999);MailMessageEvents[_0x4081('0x4')](_0x56febd,_0x40a999);_0x48d44e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x4081('0x5')]=MailMessageEvents; \ No newline at end of file +var _0xdfd4=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0xdfd4,0x147));var _0x4dfd=function(_0x7c85a,_0x276371){_0x7c85a=_0x7c85a-0x0;var _0x17822a=_0xdfd4[_0x7c85a];return _0x17822a;};'use strict';var EventEmitter=require(_0x4dfd('0x0'));var MailMessage=require(_0x4dfd('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4dfd('0x2'),'afterDestroy':'remove'};function emitEvent(_0x40e70d){return function(_0x2ac37a,_0x11a019,_0x54cd1d){MailMessageEvents[_0x4dfd('0x3')](_0x40e70d+':'+_0x2ac37a['id'],_0x2ac37a);MailMessageEvents[_0x4dfd('0x3')](_0x40e70d,_0x2ac37a);_0x54cd1d(null);};}for(var e in events){if(events[_0x4dfd('0x4')](e)){var event=events[e];MailMessage[_0x4dfd('0x5')](e,emitEvent(event));}}module[_0x4dfd('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1844b20..11f4dd3 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 _0x2deb=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','mail_messages','fti_mail_messages','subject','body','plainBody','fromString','toLowerCase','direction','out','secret','isNil','UserId','then','update','catch'];(function(_0x2b8bbe,_0x37eb6a){var _0x1bb210=function(_0x116173){while(--_0x116173){_0x2b8bbe['push'](_0x2b8bbe['shift']());}};_0x1bb210(++_0x37eb6a);}(_0x2deb,0x99));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))('api');var moment=require(_0xb2de('0x3'));var BPromise=require(_0xb2de('0x4'));var rp=require(_0xb2de('0x5'));var htmlToText=require(_0xb2de('0x6'));var fs=require('fs');var path=require(_0xb2de('0x7'));var rimraf=require(_0xb2de('0x8'));var config=require(_0xb2de('0x9'));var attributes=require(_0xb2de('0xa'));module['exports']=function(_0x385692,_0x3fd779){return _0x385692[_0xb2de('0xb')]('MailMessage',attributes,{'tableName':_0xb2de('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xb2de('0xd'),'fields':['plainBody',_0xb2de('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x295174,_0x324f57,_0x5ceae1){if(_0x295174[_0xb2de('0xf')]){_0x295174[_0xb2de('0x10')]=htmlToText[_0xb2de('0x11')](_0x295174['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5ceae1(null,_0x324f57);},'afterCreate':function(_0x4706fe,_0x39a596,_0x98c600){var _0x1d954d=_0x385692['models'];var _0x42369c=_0x4706fe['get']({'plain':!![]});if(_0x42369c['direction'][_0xb2de('0x12')]()==='in'||_0x42369c[_0xb2de('0x13')][_0xb2de('0x12')]()===_0xb2de('0x14')&&!_0x42369c[_0xb2de('0x15')]&&!_[_0xb2de('0x16')](_0x42369c[_0xb2de('0x17')])){_0x1d954d['MailInteraction']['findOne']({'where':{'id':_0x42369c['MailInteractionId']}})[_0xb2de('0x18')](function(_0x58e606){if(_0x58e606){_0x58e606[_0xb2de('0x19')]({'lastMsgAt':_0x42369c['createdAt'],'lastMsgDirection':_0x42369c[_0xb2de('0x13')]['toLowerCase']()});}})[_0xb2de('0x1a')](function(_0x508f84){console[_0xb2de('0x1b')](_0x508f84);});}_0x98c600();}},'charset':_0xb2de('0x1c'),'collate':_0xb2de('0x1d')});}; \ No newline at end of file +var _0x1043=['../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2c22af,_0x2eb697){var _0x152f58=function(_0x4d61ac){while(--_0x4d61ac){_0x2c22af['push'](_0x2c22af['shift']());}};_0x152f58(++_0x2eb697);}(_0x1043,0x108));var _0x3104=function(_0x1ae532,_0x258187){_0x1ae532=_0x1ae532-0x0;var _0x4aa099=_0x1043[_0x1ae532];return _0x4aa099;};'use strict';var _=require(_0x3104('0x0'));var util=require(_0x3104('0x1'));var logger=require(_0x3104('0x2'))(_0x3104('0x3'));var moment=require(_0x3104('0x4'));var BPromise=require(_0x3104('0x5'));var rp=require('request-promise');var htmlToText=require(_0x3104('0x6'));var fs=require('fs');var path=require(_0x3104('0x7'));var rimraf=require(_0x3104('0x8'));var config=require(_0x3104('0x9'));var attributes=require(_0x3104('0xa'));module['exports']=function(_0x34d9fb,_0x151e6e){return _0x34d9fb[_0x3104('0xb')](_0x3104('0xc'),attributes,{'tableName':_0x3104('0xd'),'paranoid':![],'indexes':[{'name':_0x3104('0xe'),'fields':[_0x3104('0xe')]},{'name':_0x3104('0xf'),'fields':[_0x3104('0x10'),_0x3104('0x11')],'type':_0x3104('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3cc962,_0x50738f,_0x2d7a25){if(_0x3cc962[_0x3104('0x13')]){_0x3cc962[_0x3104('0x10')]=htmlToText[_0x3104('0x14')](_0x3cc962['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2d7a25(null,_0x50738f);},'afterCreate':function(_0x34354e,_0x4c8095,_0x54b7f1){var _0x321199=_0x34d9fb[_0x3104('0x15')];var _0x4b9cb4=_0x34354e[_0x3104('0x16')]({'plain':!![]});if(_0x4b9cb4['direction'][_0x3104('0x17')]()==='in'||_0x4b9cb4[_0x3104('0x18')][_0x3104('0x17')]()===_0x3104('0x19')&&!_0x4b9cb4[_0x3104('0x1a')]&&!_[_0x3104('0x1b')](_0x4b9cb4[_0x3104('0x1c')])){_0x321199['MailInteraction'][_0x3104('0x1d')]({'where':{'id':_0x4b9cb4[_0x3104('0x1e')]}})[_0x3104('0x1f')](function(_0x3b3d7a){if(_0x3b3d7a){_0x3b3d7a[_0x3104('0x20')]({'lastMsgAt':_0x4b9cb4[_0x3104('0x21')],'lastMsgDirection':_0x4b9cb4[_0x3104('0x18')][_0x3104('0x17')]()});}})[_0x3104('0x22')](function(_0x4b9a69){console[_0x3104('0x23')](_0x4b9a69);});}_0x54b7f1();}},'charset':_0x3104('0x24'),'collate':_0x3104('0x25')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 3db5226..a546dde 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 _0x4325=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','util'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});config['redis']=_[_0x5432('0xa')](config['redis'],{'host':_0x5432('0xb'),'port':0x18eb});var socket=require(_0x5432('0xc'))(new Redis(config[_0x5432('0xd')]));require(_0x5432('0xe'))[_0x5432('0xf')](socket);function respondWithRpcPromise(_0x4a9a51,_0xcc52a,_0x58348a){return new BPromise(function(_0x28ff19,_0x35faac){return client[_0x5432('0x10')](_0x4a9a51,_0x58348a)[_0x5432('0x11')](function(_0x4ac11f){logger['info'](_0x5432('0x12'),_0xcc52a,_0x5432('0x13'));logger['debug'](_0x5432('0x14'),_0xcc52a,_0x5432('0x13'),JSON[_0x5432('0x15')](_0x4ac11f));if(_0x4ac11f[_0x5432('0x16')]){if(_0x4ac11f[_0x5432('0x16')][_0x5432('0x17')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xcc52a,_0x4ac11f[_0x5432('0x16')][_0x5432('0x18')]);return _0x35faac(_0x4ac11f[_0x5432('0x16')][_0x5432('0x18')]);}logger[_0x5432('0x16')](_0x5432('0x12'),_0xcc52a,_0x4ac11f['error'][_0x5432('0x18')]);return _0x28ff19(_0x4ac11f['error'][_0x5432('0x18')]);}else{logger[_0x5432('0x19')](_0x5432('0x12'),_0xcc52a,_0x5432('0x13'));_0x28ff19(_0x4ac11f[_0x5432('0x1a')]['message']);}})[_0x5432('0x1b')](function(_0x22f030){logger[_0x5432('0x16')](_0x5432('0x12'),_0xcc52a,_0x22f030);_0x35faac(_0x22f030);});});}exports[_0x5432('0x1c')]=function(_0x451de4){var _0x29e699=this;return new Promise(function(_0x5da6ea,_0x66911a){return db[_0x5432('0x1d')][_0x5432('0x1e')](_0x451de4[_0x5432('0x1f')],{'raw':_0x451de4[_0x5432('0x20')]?_0x451de4['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x61827e){logger[_0x5432('0x19')](_0x5432('0x1c'),_0x451de4);logger[_0x5432('0x21')]('CreateMailMessage',_0x451de4,JSON['stringify'](_0x61827e));_0x5da6ea(_0x61827e);})[_0x5432('0x1b')](function(_0x8ed74b){logger['error'](_0x5432('0x1c'),_0x8ed74b[_0x5432('0x18')],_0x451de4);_0x66911a(_0x29e699[_0x5432('0x16')](0x1f4,_0x8ed74b['message']));});});}; \ No newline at end of file +var _0xf2e3=['info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then'];(function(_0x375f9e,_0x2217c7){var _0x4a0e71=function(_0x166af5){while(--_0x166af5){_0x375f9e['push'](_0x375f9e['shift']());}};_0x4a0e71(++_0x2217c7);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xf2e3[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var moment=require(_0x3f2e('0x1'));var BPromise=require(_0x3f2e('0x2'));var rs=require(_0x3f2e('0x3'));var fs=require('fs');var Redis=require(_0x3f2e('0x4'));var db=require(_0x3f2e('0x5'))['db'];var utils=require(_0x3f2e('0x6'));var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3f2e('0xa')][_0x3f2e('0xb')]({'port':0x232a});config[_0x3f2e('0xc')]=_[_0x3f2e('0xd')](config[_0x3f2e('0xc')],{'host':_0x3f2e('0xe'),'port':0x18eb});var socket=require(_0x3f2e('0xf'))(new Redis(config[_0x3f2e('0xc')]));require(_0x3f2e('0x10'))[_0x3f2e('0x11')](socket);function respondWithRpcPromise(_0x21f22b,_0x32902a,_0x1dd9d0){return new BPromise(function(_0x10a392,_0x1bb1dd){return client[_0x3f2e('0x12')](_0x21f22b,_0x1dd9d0)[_0x3f2e('0x13')](function(_0x475cd2){logger[_0x3f2e('0x14')]('MailMessage,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'));logger[_0x3f2e('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x32902a,_0x3f2e('0x15'),JSON[_0x3f2e('0x17')](_0x475cd2));if(_0x475cd2[_0x3f2e('0x18')]){if(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x19')]===0x1f4){logger['error'](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x1bb1dd(_0x475cd2['error'][_0x3f2e('0x1b')]);}logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);return _0x10a392(_0x475cd2[_0x3f2e('0x18')][_0x3f2e('0x1b')]);}else{logger[_0x3f2e('0x14')](_0x3f2e('0x1a'),_0x32902a,_0x3f2e('0x15'));_0x10a392(_0x475cd2[_0x3f2e('0x1c')]['message']);}})[_0x3f2e('0x1d')](function(_0x243822){logger[_0x3f2e('0x18')](_0x3f2e('0x1a'),_0x32902a,_0x243822);_0x1bb1dd(_0x243822);});});}exports[_0x3f2e('0x1e')]=function(_0x4eb1e7){var _0x4ba868=this;return new Promise(function(_0x904d94,_0x11f84c){return db[_0x3f2e('0x1f')][_0x3f2e('0x20')](_0x4eb1e7[_0x3f2e('0x21')],{'raw':_0x4eb1e7[_0x3f2e('0x22')]?_0x4eb1e7['options']['raw']===undefined?!![]:![]:!![]})[_0x3f2e('0x13')](function(_0x37dab2){logger['info']('CreateMailMessage',_0x4eb1e7);logger[_0x3f2e('0x16')]('CreateMailMessage',_0x4eb1e7,JSON[_0x3f2e('0x17')](_0x37dab2));_0x904d94(_0x37dab2);})[_0x3f2e('0x1d')](function(_0x515e32){logger['error']('CreateMailMessage',_0x515e32[_0x3f2e('0x1b')],_0x4eb1e7);_0x11f84c(_0x4ba868[_0x3f2e('0x18')](0x1f4,_0x515e32['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 60d00b8..04dea0f 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 _0xc38d=['length','mailMessage:','./mailMessage.events','save','emit','removeListener'];(function(_0x28f870,_0x5d9fe3){var _0xa6e86e=function(_0xcc4f6c){while(--_0xcc4f6c){_0x28f870['push'](_0x28f870['shift']());}};_0xa6e86e(++_0x5d9fe3);}(_0xc38d,0x110));var _0xdc38=function(_0x32a1e1,_0x2f7fc4){_0x32a1e1=_0x32a1e1-0x0;var _0x57504f=_0xc38d[_0x32a1e1];return _0x57504f;};'use strict';var MailMessageEvents=require(_0xdc38('0x0'));var events=[_0xdc38('0x1'),'remove','update'];function createListener(_0x474c28,_0x293ab6){return function(_0x37de20){_0x293ab6[_0xdc38('0x2')](_0x474c28,_0x37de20);};}function removeListener(_0x289247,_0x130bf6){return function(){MailMessageEvents[_0xdc38('0x3')](_0x289247,_0x130bf6);};}exports['register']=function(_0x33fa3f){for(var _0x36835d=0x0,_0x58809b=events[_0xdc38('0x4')];_0x36835d<_0x58809b;_0x36835d++){var _0x4b5f47=events[_0x36835d];var _0x1b952a=createListener(_0xdc38('0x5')+_0x4b5f47,_0x33fa3f);MailMessageEvents['on'](_0x4b5f47,_0x1b952a);}}; \ No newline at end of file +var _0x7399=['./mailMessage.events','save','remove','update','emit','removeListener'];(function(_0x378fc7,_0x5181a3){var _0x44dfec=function(_0x2e0f62){while(--_0x2e0f62){_0x378fc7['push'](_0x378fc7['shift']());}};_0x44dfec(++_0x5181a3);}(_0x7399,0x13e));var _0x9739=function(_0x2a0ad3,_0x3e5795){_0x2a0ad3=_0x2a0ad3-0x0;var _0x1e501b=_0x7399[_0x2a0ad3];return _0x1e501b;};'use strict';var MailMessageEvents=require(_0x9739('0x0'));var events=[_0x9739('0x1'),_0x9739('0x2'),_0x9739('0x3')];function createListener(_0x1f5f1d,_0x14164e){return function(_0x25ead4){_0x14164e[_0x9739('0x4')](_0x1f5f1d,_0x25ead4);};}function removeListener(_0x1fdd94,_0x22b083){return function(){MailMessageEvents[_0x9739('0x5')](_0x1fdd94,_0x22b083);};}exports['register']=function(_0x5f4e38){for(var _0x4eb9a2=0x0,_0x352b32=events['length'];_0x4eb9a2<_0x352b32;_0x4eb9a2++){var _0x31ed10=events[_0x4eb9a2];var _0x5b3564=createListener('mailMessage:'+_0x31ed10,_0x5f4e38);MailMessageEvents['on'](_0x31ed10,_0x5b3564);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 50cb085..fb1f145 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 _0xfc9c=['addAgents','update','delete','removeTeams','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users'];(function(_0xa81926,_0x38e368){var _0x8177ef=function(_0x2b3726){while(--_0x2b3726){_0xa81926['push'](_0xa81926['shift']());}};_0x8177ef(++_0x38e368);}(_0xfc9c,0xd0));var _0xcfc9=function(_0x5bae5f,_0x3dee66){_0x5bae5f=_0x5bae5f-0x0;var _0x1742e1=_0xfc9c[_0x5bae5f];return _0x1742e1;};'use strict';var multer=require(_0xcfc9('0x0'));var util=require(_0xcfc9('0x1'));var path=require('path');var timeout=require(_0xcfc9('0x2'));var express=require('express');var router=express[_0xcfc9('0x3')]();var fs_extra=require(_0xcfc9('0x4'));var auth=require(_0xcfc9('0x5'));var interaction=require(_0xcfc9('0x6'));var config=require(_0xcfc9('0x7'));var controller=require(_0xcfc9('0x8'));router[_0xcfc9('0x9')]('/',auth[_0xcfc9('0xa')](),controller[_0xcfc9('0xb')]);router[_0xcfc9('0x9')](_0xcfc9('0xc'),auth['isAuthenticated'](),controller[_0xcfc9('0xd')]);router['get'](_0xcfc9('0xe'),auth[_0xcfc9('0xa')](),controller[_0xcfc9('0xf')]);router[_0xcfc9('0x9')](_0xcfc9('0x10'),auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x11')]);router['get'](_0xcfc9('0x12'),auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x13')]);router[_0xcfc9('0x9')]('/:id/users',auth[_0xcfc9('0xa')](),controller['getAgents']);router[_0xcfc9('0x14')]('/',auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x15')]);router[_0xcfc9('0x14')]('/:id/teams',auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x16')]);router['post'](_0xcfc9('0x17'),auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x18')]);router['put'](_0xcfc9('0xe'),auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x19')]);router[_0xcfc9('0x1a')](_0xcfc9('0xe'),auth[_0xcfc9('0xa')](),controller['destroy']);router[_0xcfc9('0x1a')](_0xcfc9('0x12'),auth[_0xcfc9('0xa')](),controller[_0xcfc9('0x1b')]);router[_0xcfc9('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xcfc9('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xaea8=['multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x119055,_0x2a0dc6){var _0x4de03e=function(_0x2031e4){while(--_0x2031e4){_0x119055['push'](_0x119055['shift']());}};_0x4de03e(++_0x2a0dc6);}(_0xaea8,0x134));var _0x8aea=function(_0x40ee65,_0x2bee9d){_0x40ee65=_0x40ee65-0x0;var _0x3355d6=_0xaea8[_0x40ee65];return _0x3355d6;};'use strict';var multer=require(_0x8aea('0x0'));var util=require('util');var path=require(_0x8aea('0x1'));var timeout=require('connect-timeout');var express=require(_0x8aea('0x2'));var router=express['Router']();var fs_extra=require(_0x8aea('0x3'));var auth=require(_0x8aea('0x4'));var interaction=require(_0x8aea('0x5'));var config=require(_0x8aea('0x6'));var controller=require(_0x8aea('0x7'));router[_0x8aea('0x8')]('/',auth[_0x8aea('0x9')](),controller['index']);router['get'](_0x8aea('0xa'),auth['isAuthenticated'](),controller[_0x8aea('0xb')]);router['get']('/:id',auth[_0x8aea('0x9')](),controller[_0x8aea('0xc')]);router['get']('/:id/members',auth[_0x8aea('0x9')](),controller[_0x8aea('0xd')]);router[_0x8aea('0x8')](_0x8aea('0xe'),auth['isAuthenticated'](),controller[_0x8aea('0xf')]);router[_0x8aea('0x8')](_0x8aea('0x10'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x11')]);router[_0x8aea('0x12')]('/',auth[_0x8aea('0x9')](),controller[_0x8aea('0x13')]);router[_0x8aea('0x12')]('/:id/teams',auth[_0x8aea('0x9')](),controller['addTeams']);router[_0x8aea('0x12')](_0x8aea('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x8aea('0x14')](_0x8aea('0x15'),auth['isAuthenticated'](),controller[_0x8aea('0x16')]);router[_0x8aea('0x17')](_0x8aea('0x15'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x18')]);router[_0x8aea('0x17')]('/:id/teams',auth[_0x8aea('0x9')](),controller[_0x8aea('0x19')]);router[_0x8aea('0x17')](_0x8aea('0x10'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x1a')]);module[_0x8aea('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2c7ab11..ad25c86 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 _0x0382=['ENUM','rrmemory','beepall','sequelize','STRING','name','INTEGER'];(function(_0x44cf8a,_0x25b667){var _0x41d2e3=function(_0xe5e566){while(--_0xe5e566){_0x44cf8a['push'](_0x44cf8a['shift']());}};_0x41d2e3(++_0x25b667);}(_0x0382,0xa4));var _0x2038=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x0382[_0x5ddaac];return _0x2a9c58;};'use strict';var Sequelize=require(_0x2038('0x0'));module['exports']={'name':{'type':Sequelize[_0x2038('0x1')],'unique':_0x2038('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2038('0x1')]},'timeout':{'type':Sequelize[_0x2038('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2038('0x4')](_0x2038('0x5'),_0x2038('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xbe6b=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0xbe6b,0xa3));var _0xbbe6=function(_0x570510,_0x29ce42){_0x570510=_0x570510-0x0;var _0x5390be=_0xbe6b[_0x570510];return _0x5390be;};'use strict';var Sequelize=require(_0xbbe6('0x0'));module[_0xbbe6('0x1')]={'name':{'type':Sequelize[_0xbbe6('0x2')],'unique':_0xbbe6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbbe6('0x2')]},'timeout':{'type':Sequelize[_0xbbe6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbe6('0x5')](_0xbbe6('0x6'),_0xbbe6('0x7'),_0xbbe6('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0150f44..66383aa 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 _0x7ebf=['sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','MailQueueId','UserMailQueue','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','Agents','online','voicePause','sequelize','each','findOrCreate','emit','userMailQueue:save','ids','select','field','from','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../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','update','then','MailQueues','UserProfileResource','destroy','error','name','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x41ca25,_0x325c5f){var _0x37c6ad=function(_0x2b7221){while(--_0x2b7221){_0x41ca25['push'](_0x41ca25['shift']());}};_0x37c6ad(++_0x325c5f);}(_0x7ebf,0x1da));var _0xf7eb=function(_0x438cd1,_0x13c857){_0x438cd1=_0x438cd1-0x0;var _0x11b977=_0x7ebf[_0x438cd1];return _0x11b977;};'use strict';var emlformat=require(_0xf7eb('0x0'));var rimraf=require(_0xf7eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7eb('0x2'));var rp=require(_0xf7eb('0x3'));var moment=require(_0xf7eb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7eb('0x5'));var util=require(_0xf7eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf7eb('0x7'));var ejs=require(_0xf7eb('0x8'));var fs=require('fs');var fs_extra=require(_0xf7eb('0x9'));var _=require(_0xf7eb('0xa'));var squel=require(_0xf7eb('0xb'));var crypto=require(_0xf7eb('0xc'));var jsforce=require(_0xf7eb('0xd'));var deskjs=require(_0xf7eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf7eb('0xf'));var Papa=require(_0xf7eb('0x10'));var Redis=require('ioredis');var authService=require(_0xf7eb('0x11'));var qs=require(_0xf7eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7eb('0x13'));var logger=require(_0xf7eb('0x14'))('api');var utils=require(_0xf7eb('0x15'));var config=require(_0xf7eb('0x16'));var licenseUtil=require(_0xf7eb('0x17'));var db=require('../../mysqldb')['db'];config[_0xf7eb('0x18')]=_[_0xf7eb('0x19')](config[_0xf7eb('0x18')],{'host':_0xf7eb('0x1a'),'port':0x18eb});var socket=require(_0xf7eb('0x1b'))(new Redis(config[_0xf7eb('0x18')]));require('./mailQueue.socket')[_0xf7eb('0x1c')](socket);function respondWithStatusCode(_0x5945f8,_0x2ef00d){_0x2ef00d=_0x2ef00d||0xcc;return function(_0x388bf4){if(_0x388bf4){return _0x5945f8[_0xf7eb('0x1d')](_0x2ef00d);}return _0x5945f8[_0xf7eb('0x1e')](_0x2ef00d)[_0xf7eb('0x1f')]();};}function respondWithResult(_0xa7860c,_0x2d8db6){_0x2d8db6=_0x2d8db6||0xc8;return function(_0xedd313){if(_0xedd313){return _0xa7860c[_0xf7eb('0x1e')](_0x2d8db6)[_0xf7eb('0x20')](_0xedd313);}};}function respondWithFilteredResult(_0x502fdc,_0x480618){return function(_0x4422c2){if(_0x4422c2){var _0x4abb9d=typeof _0x480618[_0xf7eb('0x21')]===_0xf7eb('0x22')&&typeof _0x480618[_0xf7eb('0x23')]===_0xf7eb('0x22');var _0x260120=_0x4422c2[_0xf7eb('0x24')];var _0x45290c=_0x4abb9d?0x0:_0x480618[_0xf7eb('0x21')];var _0x45e863=_0x4abb9d?_0x4422c2[_0xf7eb('0x24')]:_0x480618[_0xf7eb('0x21')]+_0x480618[_0xf7eb('0x23')];var _0x1dd28f;if(_0x45e863>=_0x260120){_0x45e863=_0x260120;_0x1dd28f=0xc8;}else{_0x1dd28f=0xce;}_0x502fdc['status'](_0x1dd28f);return _0x502fdc[_0xf7eb('0x25')](_0xf7eb('0x26'),_0x45290c+'-'+_0x45e863+'/'+_0x260120)[_0xf7eb('0x20')](_0x4422c2);}return null;};}function patchUpdates(_0x49cea6){return function(_0x358f01){try{jsonpatch['apply'](_0x358f01,_0x49cea6,!![]);}catch(_0x248d35){return BPromise['reject'](_0x248d35);}return _0x358f01['save']();};}function saveUpdates(_0x2bc165,_0x298404){return function(_0x3ce299){if(_0x3ce299){return _0x3ce299[_0xf7eb('0x27')](_0x2bc165)['then'](function(_0x2b4ba1){return _0x2b4ba1;});}return null;};}function removeEntity(_0x50c197,_0x2ca767){return function(_0x2d78c7){if(_0x2d78c7){return _0x2d78c7['destroy']()[_0xf7eb('0x28')](function(){var _0x9abdea=_0x2d78c7['get']({'plain':!![]});var _0x273ea8=_0xf7eb('0x29');return db[_0xf7eb('0x2a')][_0xf7eb('0x2b')]({'where':{'type':_0x273ea8,'resourceId':_0x9abdea['id']}})[_0xf7eb('0x28')](function(){return _0x2d78c7;});})[_0xf7eb('0x28')](function(){_0x50c197[_0xf7eb('0x1e')](0xcc)[_0xf7eb('0x1f')]();});}};}function handleEntityNotFound(_0x19318d,_0x2ba9bb){return function(_0x475257){if(!_0x475257){_0x19318d[_0xf7eb('0x1d')](0x194);}return _0x475257;};}function handleError(_0x5bf10f,_0x3aa08a){_0x3aa08a=_0x3aa08a||0x1f4;return function(_0x27ee8f){logger[_0xf7eb('0x2c')](_0x27ee8f['stack']);if(_0x27ee8f[_0xf7eb('0x2d')]){delete _0x27ee8f[_0xf7eb('0x2d')];}_0x5bf10f['status'](_0x3aa08a)['send'](_0x27ee8f);};}exports[_0xf7eb('0x2e')]=function(_0x4a257b,_0x11805f){var _0x13dc4c={},_0x3a82a3={},_0x31d224={'count':0x0,'rows':[]};var _0x19b814=_[_0xf7eb('0x2f')](db[_0xf7eb('0x30')][_0xf7eb('0x31')],function(_0x58d0b0){return{'name':_0x58d0b0[_0xf7eb('0x32')],'type':_0x58d0b0[_0xf7eb('0x33')][_0xf7eb('0x34')]};});_0x3a82a3[_0xf7eb('0x35')]=_[_0xf7eb('0x2f')](_0x19b814,_0xf7eb('0x2d'));_0x3a82a3[_0xf7eb('0x36')]=_[_0xf7eb('0x37')](_0x4a257b[_0xf7eb('0x36')]);_0x3a82a3['filters']=_[_0xf7eb('0x38')](_0x3a82a3[_0xf7eb('0x35')],_0x3a82a3['query']);_0x13dc4c[_0xf7eb('0x39')]=_[_0xf7eb('0x38')](_0x3a82a3[_0xf7eb('0x35')],qs[_0xf7eb('0x3a')](_0x4a257b['query'][_0xf7eb('0x3a')]));_0x13dc4c[_0xf7eb('0x39')]=_0x13dc4c[_0xf7eb('0x39')]['length']?_0x13dc4c[_0xf7eb('0x39')]:_0x3a82a3[_0xf7eb('0x35')];if(!_0x4a257b['query'][_0xf7eb('0x3b')](_0xf7eb('0x3c'))){_0x13dc4c[_0xf7eb('0x23')]=qs['limit'](_0x4a257b[_0xf7eb('0x36')]['limit']);_0x13dc4c[_0xf7eb('0x21')]=qs[_0xf7eb('0x21')](_0x4a257b['query'][_0xf7eb('0x21')]);}_0x13dc4c[_0xf7eb('0x3d')]=qs[_0xf7eb('0x3e')](_0x4a257b[_0xf7eb('0x36')][_0xf7eb('0x3e')]);_0x13dc4c[_0xf7eb('0x3f')]=qs[_0xf7eb('0x40')](_[_0xf7eb('0x41')](_0x4a257b[_0xf7eb('0x36')],_0x3a82a3[_0xf7eb('0x40')]),_0x19b814);if(_0x4a257b[_0xf7eb('0x36')][_0xf7eb('0x42')]){_0x13dc4c[_0xf7eb('0x3f')]=_[_0xf7eb('0x43')](_0x13dc4c[_0xf7eb('0x3f')],{'$or':_[_0xf7eb('0x2f')](_0x19b814,function(_0x4be352){if(_0x4be352[_0xf7eb('0x33')]!==_0xf7eb('0x44')){var _0x17143f={};_0x17143f[_0x4be352[_0xf7eb('0x2d')]]={'$like':'%'+_0x4a257b[_0xf7eb('0x36')][_0xf7eb('0x42')]+'%'};return _0x17143f;}})});}_0x13dc4c=_[_0xf7eb('0x43')]({},_0x13dc4c,_0x4a257b[_0xf7eb('0x45')]);var _0x1a444e={'where':_0x13dc4c[_0xf7eb('0x3f')]};return db[_0xf7eb('0x30')][_0xf7eb('0x24')](_0x1a444e)[_0xf7eb('0x28')](function(_0x4d5140){_0x31d224[_0xf7eb('0x24')]=_0x4d5140;if(_0x4a257b['query'][_0xf7eb('0x46')]){_0x13dc4c['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x13dc4c);})[_0xf7eb('0x28')](function(_0x43dbe6){_0x31d224[_0xf7eb('0x47')]=_0x43dbe6;return _0x31d224;})[_0xf7eb('0x28')](respondWithFilteredResult(_0x11805f,_0x13dc4c))[_0xf7eb('0x48')](handleError(_0x11805f,null));};exports[_0xf7eb('0x49')]=function(_0x6bfe04,_0x89a168){var _0x3289b9={'raw':!![],'where':{'id':_0x6bfe04[_0xf7eb('0x4a')]['id']}},_0x5024f6={};_0x5024f6[_0xf7eb('0x35')]=_[_0xf7eb('0x37')](db[_0xf7eb('0x30')][_0xf7eb('0x31')]);_0x5024f6[_0xf7eb('0x36')]=_[_0xf7eb('0x37')](_0x6bfe04['query']);_0x5024f6[_0xf7eb('0x40')]=_[_0xf7eb('0x38')](_0x5024f6['model'],_0x5024f6['query']);_0x3289b9[_0xf7eb('0x39')]=_[_0xf7eb('0x38')](_0x5024f6['model'],qs[_0xf7eb('0x3a')](_0x6bfe04[_0xf7eb('0x36')][_0xf7eb('0x3a')]));_0x3289b9[_0xf7eb('0x39')]=_0x3289b9[_0xf7eb('0x39')][_0xf7eb('0x4b')]?_0x3289b9[_0xf7eb('0x39')]:_0x5024f6[_0xf7eb('0x35')];if(_0x6bfe04[_0xf7eb('0x36')][_0xf7eb('0x46')]){_0x3289b9[_0xf7eb('0x4c')]=[{'all':!![]}];}_0x3289b9=_[_0xf7eb('0x43')]({},_0x3289b9,_0x6bfe04[_0xf7eb('0x45')]);return db[_0xf7eb('0x30')][_0xf7eb('0x4d')](_0x3289b9)[_0xf7eb('0x28')](handleEntityNotFound(_0x89a168,null))[_0xf7eb('0x28')](respondWithResult(_0x89a168,null))['catch'](handleError(_0x89a168,null));};exports[_0xf7eb('0x4e')]=function(_0x5c14ab,_0x4b233d){return db['MailQueue'][_0xf7eb('0x4e')](_0x5c14ab[_0xf7eb('0x4f')],{})[_0xf7eb('0x28')](function(_0x2488bb){var _0x5d70eb=_0x5c14ab[_0xf7eb('0x50')][_0xf7eb('0x51')]({'plain':!![]});if(!_0x5d70eb)throw new Error(_0xf7eb('0x52'));if(_0x5d70eb[_0xf7eb('0x53')]===_0xf7eb('0x50')){var _0x401fc2=_0x2488bb[_0xf7eb('0x51')]({'plain':!![]});var _0x640210=_0xf7eb('0x29');return db[_0xf7eb('0x54')][_0xf7eb('0x4d')]({'where':{'name':_0x640210,'userProfileId':_0x5d70eb[_0xf7eb('0x55')]},'raw':!![]})['then'](function(_0x2fc77e){if(_0x2fc77e&&_0x2fc77e[_0xf7eb('0x56')]===0x0){return db['UserProfileResource'][_0xf7eb('0x4e')]({'name':_0x401fc2[_0xf7eb('0x2d')],'resourceId':_0x401fc2['id'],'type':_0x2fc77e['name'],'sectionId':_0x2fc77e['id']},{})[_0xf7eb('0x28')](function(){return _0x2488bb;});}else{return _0x2488bb;}})[_0xf7eb('0x48')](function(_0x139e15){logger[_0xf7eb('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x139e15);throw _0x139e15;});}return _0x2488bb;})['then'](respondWithResult(_0x4b233d,0xc9))[_0xf7eb('0x48')](handleError(_0x4b233d,null));};exports['update']=function(_0x31f524,_0x27fffa){if(_0x31f524[_0xf7eb('0x4f')]['id']){delete _0x31f524['body']['id'];}return db[_0xf7eb('0x30')][_0xf7eb('0x4d')]({'where':{'id':_0x31f524[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x27fffa,null))[_0xf7eb('0x28')](saveUpdates(_0x31f524[_0xf7eb('0x4f')],null))['then'](respondWithResult(_0x27fffa,null))['catch'](handleError(_0x27fffa,null));};exports[_0xf7eb('0x2b')]=function(_0x381237,_0x2931f5){return db['MailQueue'][_0xf7eb('0x4d')]({'where':{'id':_0x381237[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x2931f5,null))[_0xf7eb('0x28')](removeEntity(_0x2931f5,null))[_0xf7eb('0x48')](handleError(_0x2931f5,null));};exports[_0xf7eb('0x57')]=function(_0x1dbe0e,_0x1ee5da){return db[_0xf7eb('0x30')][_0xf7eb('0x57')]()[_0xf7eb('0x28')](respondWithResult(_0x1ee5da,null))[_0xf7eb('0x48')](handleError(_0x1ee5da,null));};exports[_0xf7eb('0x58')]=function(_0xbe66f8,_0x154a83,_0xdc9441){var _0x40c342={'raw':!![],'where':{}},_0x2649ed={},_0x4c48be;return db[_0xf7eb('0x30')][_0xf7eb('0x59')]({'where':{'id':_0xbe66f8[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x154a83,null))['then'](function(_0x255ed6){if(_0x255ed6){_0x4c48be=_0x255ed6[_0xf7eb('0x51')]({'plain':!![]});_0x2649ed[_0xf7eb('0x35')]=_[_0xf7eb('0x37')](db['UserMailQueue'][_0xf7eb('0x31')]);_0x2649ed[_0xf7eb('0x36')]=_[_0xf7eb('0x37')](_0xbe66f8[_0xf7eb('0x36')]);_0x2649ed[_0xf7eb('0x40')]=_['intersection'](_0x2649ed[_0xf7eb('0x35')],_0x2649ed[_0xf7eb('0x36')]);_0x40c342[_0xf7eb('0x39')]=_[_0xf7eb('0x38')](_0x2649ed[_0xf7eb('0x35')],qs[_0xf7eb('0x3a')](_0xbe66f8[_0xf7eb('0x36')][_0xf7eb('0x3a')]));_0x40c342['attributes']=_0x40c342[_0xf7eb('0x39')]['length']?_0x40c342[_0xf7eb('0x39')]:_0x2649ed[_0xf7eb('0x35')];if(!_0xbe66f8['query'][_0xf7eb('0x3b')]('nolimit')){_0x40c342['limit']=qs['limit'](_0xbe66f8[_0xf7eb('0x36')][_0xf7eb('0x23')]);_0x40c342[_0xf7eb('0x21')]=qs[_0xf7eb('0x21')](_0xbe66f8[_0xf7eb('0x36')][_0xf7eb('0x21')]);}_0x40c342[_0xf7eb('0x3d')]=qs[_0xf7eb('0x3e')](_0xbe66f8['query'][_0xf7eb('0x3e')]);_0x40c342['where']=qs['filters'](_[_0xf7eb('0x41')](_0xbe66f8[_0xf7eb('0x36')],_0x2649ed['filters']));_0x40c342['where'][_0xf7eb('0x5a')]=_0x255ed6['id'];if(_0xbe66f8['query']['filter']){_0x40c342[_0xf7eb('0x3f')]=_[_0xf7eb('0x43')](_0x40c342['where'],{'$or':_['map'](_0x40c342[_0xf7eb('0x39')],function(_0x31fd7a){var _0x5c9d4b={};_0x5c9d4b[_0x31fd7a]={'$like':'%'+_0xbe66f8['query']['filter']+'%'};return _0x5c9d4b;})});}_0x40c342=_[_0xf7eb('0x43')]({},_0x40c342,_0xbe66f8[_0xf7eb('0x45')]);return db[_0xf7eb('0x5b')][_0xf7eb('0x5c')](_0x40c342);}})[_0xf7eb('0x28')](function(_0xbe6550){if(_0xbe6550){return db[_0xf7eb('0x5d')][_0xf7eb('0x5e')]({'where':{'id':_[_0xf7eb('0x2f')](_0xbe6550,'UserId'),'role':_0xf7eb('0x5f')},'attributes':['id',_0xf7eb('0x2d'),_0xf7eb('0x60'),_0xf7eb('0x61'),_0xf7eb('0x62')]});}})[_0xf7eb('0x28')](function(_0x2fe336){if(_0x2fe336){return{'count':_0x2fe336['count'],'rows':_[_0xf7eb('0x2f')](_0x2fe336['rows'],function(_0x1b0dde){return{'membername':_0x1b0dde[_0xf7eb('0x2d')],'UserId':_0x1b0dde['id'],'queue_name':_0x4c48be[_0xf7eb('0x2d')],'MailQueueId':_0x4c48be['id'],'interface':util[_0xf7eb('0x63')](_0xf7eb('0x64'),_0xf7eb('0x65'),_0x1b0dde['name']),'penalty':0x0,'paused':_0x1b0dde[_0xf7eb('0x60')],'createdAt':_0x1b0dde[_0xf7eb('0x62')],'updatedAt':_0x1b0dde[_0xf7eb('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf7eb('0x28')](respondWithFilteredResult(_0x154a83,_0x40c342))['catch'](handleError(_0x154a83,null));};exports['getTeams']=function(_0x1778bd,_0x36424c,_0x1a5c3f){var _0x1d9217={};var _0x2eaf46={};var _0x111165;var _0x3a2d4c;return db[_0xf7eb('0x30')][_0xf7eb('0x59')]({'where':{'id':_0x1778bd['params']['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x36424c,null))[_0xf7eb('0x28')](function(_0x4f8a56){if(_0x4f8a56){_0x111165=_0x4f8a56;_0x2eaf46[_0xf7eb('0x35')]=_[_0xf7eb('0x37')](db[_0xf7eb('0x66')][_0xf7eb('0x31')]);_0x2eaf46[_0xf7eb('0x36')]=_[_0xf7eb('0x37')](_0x1778bd[_0xf7eb('0x36')]);_0x2eaf46[_0xf7eb('0x40')]=_['intersection'](_0x2eaf46['model'],_0x2eaf46[_0xf7eb('0x36')]);_0x1d9217[_0xf7eb('0x39')]=_[_0xf7eb('0x38')](_0x2eaf46[_0xf7eb('0x35')],qs[_0xf7eb('0x3a')](_0x1778bd[_0xf7eb('0x36')]['fields']));_0x1d9217['attributes']=_0x1d9217[_0xf7eb('0x39')][_0xf7eb('0x4b')]?_0x1d9217[_0xf7eb('0x39')]:_0x2eaf46[_0xf7eb('0x35')];_0x1d9217[_0xf7eb('0x3d')]=qs[_0xf7eb('0x3e')](_0x1778bd[_0xf7eb('0x36')][_0xf7eb('0x3e')]);_0x1d9217[_0xf7eb('0x3f')]=qs[_0xf7eb('0x40')](_[_0xf7eb('0x41')](_0x1778bd['query'],_0x2eaf46[_0xf7eb('0x40')]));if(_0x1778bd[_0xf7eb('0x36')]['filter']){_0x1d9217[_0xf7eb('0x3f')]=_[_0xf7eb('0x43')](_0x1d9217['where'],{'$or':_[_0xf7eb('0x2f')](_0x1d9217[_0xf7eb('0x39')],function(_0xc283f4){var _0x3cebc1={};_0x3cebc1[_0xc283f4]={'$like':'%'+_0x1778bd['query'][_0xf7eb('0x42')]+'%'};return _0x3cebc1;})});}_0x1d9217=_[_0xf7eb('0x43')]({},_0x1d9217,_0x1778bd[_0xf7eb('0x45')]);return _0x111165['getTeams'](_0x1d9217);}})[_0xf7eb('0x28')](function(_0x3bb882){if(_0x3bb882){_0x3a2d4c=_0x3bb882['length'];if(!_0x1778bd[_0xf7eb('0x36')][_0xf7eb('0x3b')](_0xf7eb('0x3c'))){_0x1d9217[_0xf7eb('0x23')]=qs[_0xf7eb('0x23')](_0x1778bd[_0xf7eb('0x36')][_0xf7eb('0x23')]);_0x1d9217[_0xf7eb('0x21')]=qs[_0xf7eb('0x21')](_0x1778bd[_0xf7eb('0x36')][_0xf7eb('0x21')]);}return _0x111165[_0xf7eb('0x67')](_0x1d9217);}})[_0xf7eb('0x28')](function(_0x1b5477){if(_0x1b5477){return _0x1b5477?{'count':_0x3a2d4c,'rows':_0x1b5477}:null;}})[_0xf7eb('0x28')](respondWithResult(_0x36424c,null))[_0xf7eb('0x48')](handleError(_0x36424c,null));};exports[_0xf7eb('0x68')]=function(_0x374961,_0x47a8fe,_0x228128){var _0xf80936=_0x374961[_0xf7eb('0x4f')]['ids'];return db[_0xf7eb('0x66')][_0xf7eb('0x5c')]({'where':{'id':_0xf80936},'attributes':['id'],'include':[{'model':db[_0xf7eb('0x5d')],'as':_0xf7eb('0x69'),'attributes':['id',_0xf7eb('0x2d'),_0xf7eb('0x6a'),_0xf7eb('0x6b'),'interface'],'raw':!![]}]})[_0xf7eb('0x28')](function(_0x4e25b6){if(_0x4e25b6){var _0x26ef25=_['flatMap'](_0x4e25b6,function(_0x1ed118){var _0x5b66bf=_0x1ed118[_0xf7eb('0x51')]({'plain':!![]});return _0x5b66bf['Agents'];});return db[_0xf7eb('0x30')][_0xf7eb('0x4d')]({'where':{'id':_0x374961[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](function(_0x6bb9a1){return db[_0xf7eb('0x6c')]['transaction'](function(_0x133a3a){return _0x6bb9a1[_0xf7eb('0x68')](_0xf80936,{'transaction':_0x133a3a})[_0xf7eb('0x28')](function(){return BPromise[_0xf7eb('0x6d')](_0x26ef25,function(_0x55144e){return db[_0xf7eb('0x5b')][_0xf7eb('0x6e')]({'where':{'UserId':_0x55144e['id'],'MailQueueId':_0x374961['params']['id']},'transaction':_0x133a3a});});})[_0xf7eb('0x28')](function(){_0x26ef25['forEach'](function(_0xcd82ee){socket[_0xf7eb('0x6f')](_0xf7eb('0x70'),{'UserId':_0xcd82ee['id'],'MailQueueId':_0x6bb9a1['id']});});});});});}})[_0xf7eb('0x28')](respondWithStatusCode(_0x47a8fe,null))[_0xf7eb('0x48')](handleError(_0x47a8fe,null));};exports['removeTeams']=function(_0x532368,_0x4e23b8,_0x30db58){return db['Team'][_0xf7eb('0x5c')]({'where':{'id':_0x532368[_0xf7eb('0x36')][_0xf7eb('0x71')]},'attributes':['id'],'include':[{'model':db[_0xf7eb('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf7eb('0x28')](handleEntityNotFound(_0x4e23b8,null))[_0xf7eb('0x28')](function(_0x539e02){var _0x37122=_[_0xf7eb('0x2f')](_0x539e02,'id');var _0x50e2bf=[];var _0x5c9900=[];var _0x3bf2cd=squel[_0xf7eb('0x72')]();_0x3bf2cd[_0xf7eb('0x73')]('tq.TeamId')[_0xf7eb('0x74')]('team_has_mail_queues','tq')['join'](_0xf7eb('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf7eb('0x3f')]('MailQueueId\x20=\x20?',_0x532368[_0xf7eb('0x4a')]['id']);for(var _0x5678ee=0x0;_0x5678ee<_0x539e02[_0xf7eb('0x4b')];_0x5678ee+=0x1){let _0x1228b0=_0x539e02[_0x5678ee];for(var _0x55ed7c=0x0;_0x55ed7c<_0x1228b0[_0xf7eb('0x69')]['length'];_0x55ed7c+=0x1){let _0x34883c=_0x1228b0[_0xf7eb('0x69')][_0x55ed7c];var _0x550ca5=_0x3bf2cd[_0xf7eb('0x76')]();_0x550ca5[_0xf7eb('0x3f')](_0xf7eb('0x77'),_0x34883c['id']);_0x5c9900[_0xf7eb('0x78')](db[_0xf7eb('0x6c')]['query'](_0x550ca5[_0xf7eb('0x79')](),{'type':db[_0xf7eb('0x6c')]['QueryTypes']['SELECT']})[_0xf7eb('0x28')](function(_0x10e4d6){if(_0x10e4d6[_0xf7eb('0x4b')]===0x1){return _0x34883c['id'];}else{var _0x573264=_[_0xf7eb('0x7a')](_['map'](_0x10e4d6,_0xf7eb('0x7b')),function(_0x2fd8ac){return _['includes'](_0x37122,_0x2fd8ac);});if(_0x573264){return _0x34883c['id'];}}}));}}return BPromise[_0xf7eb('0x7c')](_0x5c9900)[_0xf7eb('0x28')](function(_0x1e551e){_0x50e2bf=_(_0x50e2bf)['union'](_0x1e551e)['compact']()[_0xf7eb('0x7d')]();return db[_0xf7eb('0x30')][_0xf7eb('0x4d')]({'where':{'id':_0x532368[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](function(_0x22897c){return db[_0xf7eb('0x6c')]['transaction'](function(_0x4f4223){return _0x22897c[_0xf7eb('0x7e')](_0x532368[_0xf7eb('0x36')][_0xf7eb('0x71')],{'transaction':_0x4f4223})[_0xf7eb('0x28')](function(){if(!_[_0xf7eb('0x7f')](_0x50e2bf)){return _0x22897c[_0xf7eb('0x80')](_0x50e2bf,{'transaction':_0x4f4223});}})[_0xf7eb('0x28')](function(){_0x50e2bf['forEach'](function(_0x1f7738){socket[_0xf7eb('0x6f')](_0xf7eb('0x81'),{'UserId':_0x1f7738,'MailQueueId':_0x22897c['id']});});});});});});})[_0xf7eb('0x28')](respondWithStatusCode(_0x4e23b8,null))[_0xf7eb('0x48')](handleError(_0x4e23b8,null));};exports['addAgents']=function(_0x4143da,_0x3cfa7a,_0x1d6315){return db[_0xf7eb('0x30')][_0xf7eb('0x4d')]({'where':{'id':_0x4143da[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x3cfa7a,null))['then'](function(_0x42023e){if(_0x42023e){return _0x42023e[_0xf7eb('0x82')](_0x4143da[_0xf7eb('0x4f')][_0xf7eb('0x71')],_['omit'](_0x4143da['body'],['ids','id'])||{})[_0xf7eb('0x83')](function(_0x37a0e6){for(var _0x250505=0x0;_0x250505<_0x4143da['body'][_0xf7eb('0x71')][_0xf7eb('0x4b')];_0x250505+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x4143da['body'][_0xf7eb('0x71')][_0x250505]),'MailQueueId':Number(_0x4143da[_0xf7eb('0x4a')]['id'])});}return _0x37a0e6;});}})[_0xf7eb('0x28')](respondWithResult(_0x3cfa7a,null))[_0xf7eb('0x48')](handleError(_0x3cfa7a,null));};exports['removeAgents']=function(_0x4d42ab,_0x2ee64c,_0x11ac76){return db[_0xf7eb('0x30')][_0xf7eb('0x4d')]({'where':{'id':_0x4d42ab[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x2ee64c,null))[_0xf7eb('0x28')](function(_0x294480){if(_0x294480){return _0x294480[_0xf7eb('0x80')](_0x4d42ab[_0xf7eb('0x36')][_0xf7eb('0x71')])[_0xf7eb('0x28')](function(){if(_[_0xf7eb('0x84')](_0x4d42ab[_0xf7eb('0x36')]['ids'])){for(var _0x1229dc=0x0;_0x1229dc<_0x4d42ab[_0xf7eb('0x36')][_0xf7eb('0x71')][_0xf7eb('0x4b')];_0x1229dc+=0x1){socket[_0xf7eb('0x6f')](_0xf7eb('0x81'),{'UserId':Number(_0x4d42ab[_0xf7eb('0x36')][_0xf7eb('0x71')][_0x1229dc]),'MailQueueId':Number(_0x4d42ab[_0xf7eb('0x4a')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4d42ab['query'][_0xf7eb('0x71')]),'MailQueueId':Number(_0x4d42ab[_0xf7eb('0x4a')]['id'])});}});}})[_0xf7eb('0x28')](respondWithStatusCode(_0x2ee64c,null))['catch'](handleError(_0x2ee64c,null));};exports['getAgents']=function(_0x1be483,_0x3fac4d,_0x1ffb2e){var _0x69d442={};var _0x2ef7cb={};var _0x54aa2e;var _0x3a20cd;return db['MailQueue'][_0xf7eb('0x59')]({'where':{'id':_0x1be483[_0xf7eb('0x4a')]['id']}})[_0xf7eb('0x28')](handleEntityNotFound(_0x3fac4d,null))[_0xf7eb('0x28')](function(_0x18e998){if(_0x18e998){_0x54aa2e=_0x18e998;_0x2ef7cb[_0xf7eb('0x35')]=_['keys'](db[_0xf7eb('0x5d')][_0xf7eb('0x31')]);_0x2ef7cb[_0xf7eb('0x36')]=_[_0xf7eb('0x37')](_0x1be483[_0xf7eb('0x36')]);_0x2ef7cb[_0xf7eb('0x40')]=_[_0xf7eb('0x38')](_0x2ef7cb['model'],_0x2ef7cb[_0xf7eb('0x36')]);_0x69d442[_0xf7eb('0x39')]=_[_0xf7eb('0x38')](_0x2ef7cb[_0xf7eb('0x35')],qs[_0xf7eb('0x3a')](_0x1be483[_0xf7eb('0x36')][_0xf7eb('0x3a')]));_0x69d442[_0xf7eb('0x39')]=_0x69d442[_0xf7eb('0x39')][_0xf7eb('0x4b')]?_0x69d442['attributes']:_0x2ef7cb[_0xf7eb('0x35')];_0x69d442[_0xf7eb('0x3d')]=qs[_0xf7eb('0x3e')](_0x1be483[_0xf7eb('0x36')][_0xf7eb('0x3e')]);_0x69d442['where']=qs[_0xf7eb('0x40')](_[_0xf7eb('0x41')](_0x1be483[_0xf7eb('0x36')],_0x2ef7cb[_0xf7eb('0x40')]));if(_0x1be483[_0xf7eb('0x36')][_0xf7eb('0x42')]){_0x69d442[_0xf7eb('0x3f')]=_[_0xf7eb('0x43')](_0x69d442[_0xf7eb('0x3f')],{'$or':_[_0xf7eb('0x2f')](_0x69d442[_0xf7eb('0x39')],function(_0xec2790){var _0x238db9={};_0x238db9[_0xec2790]={'$like':'%'+_0x1be483[_0xf7eb('0x36')][_0xf7eb('0x42')]+'%'};return _0x238db9;})});}_0x69d442=_['merge']({},_0x69d442,_0x1be483['options']);return _0x54aa2e['getAgents'](_0x69d442);}})['then'](function(_0x4a7d4b){if(_0x4a7d4b){_0x3a20cd=_0x4a7d4b[_0xf7eb('0x4b')];if(!_0x1be483[_0xf7eb('0x36')]['hasOwnProperty'](_0xf7eb('0x3c'))){_0x69d442['limit']=qs[_0xf7eb('0x23')](_0x1be483[_0xf7eb('0x36')][_0xf7eb('0x23')]);_0x69d442[_0xf7eb('0x21')]=qs[_0xf7eb('0x21')](_0x1be483[_0xf7eb('0x36')]['offset']);}return _0x54aa2e[_0xf7eb('0x85')](_0x69d442);}})[_0xf7eb('0x28')](function(_0xcff93a){if(_0xcff93a){return _0xcff93a?{'count':_0x3a20cd,'rows':_0xcff93a}:null;}})['then'](respondWithResult(_0x3fac4d,null))[_0xf7eb('0x48')](handleError(_0x3fac4d,null));}; \ No newline at end of file +var _0x1271=['field','tq.TeamId','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','removeAgents','userMailQueue:remove','addAgents','ids','omit','getAgents','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','localhost','socket.io-emitter','./mailQueue.socket','register','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','count','includeAll','findAll','params','keys','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','order','User','agent','mailPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userMailQueue:save','select'];(function(_0x6196c7,_0x1ec1c4){var _0x5e4b71=function(_0x33b326){while(--_0x33b326){_0x6196c7['push'](_0x6196c7['shift']());}};_0x5e4b71(++_0x1ec1c4);}(_0x1271,0x9a));var _0x1127=function(_0x5ad455,_0x232e39){_0x5ad455=_0x5ad455-0x0;var _0x3e7efe=_0x1271[_0x5ad455];return _0x3e7efe;};'use strict';var emlformat=require(_0x1127('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1127('0x1'));var jsonpatch=require(_0x1127('0x2'));var rp=require(_0x1127('0x3'));var moment=require(_0x1127('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1127('0x5'));var util=require('util');var path=require(_0x1127('0x6'));var sox=require(_0x1127('0x7'));var csv=require('to-csv');var ejs=require(_0x1127('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1127('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1127('0xa'));var deskjs=require(_0x1127('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1127('0xc'));var Papa=require('papaparse');var Redis=require(_0x1127('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1127('0xe'));var as=require(_0x1127('0xf'));var hardwareService=require(_0x1127('0x10'));var logger=require(_0x1127('0x11'))(_0x1127('0x12'));var utils=require(_0x1127('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1127('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1127('0x15'),'port':0x18eb});var socket=require(_0x1127('0x16'))(new Redis(config['redis']));require(_0x1127('0x17'))[_0x1127('0x18')](socket);function respondWithStatusCode(_0x51b315,_0x207eff){_0x207eff=_0x207eff||0xcc;return function(_0x396aa7){if(_0x396aa7){return _0x51b315['sendStatus'](_0x207eff);}return _0x51b315[_0x1127('0x19')](_0x207eff)['end']();};}function respondWithResult(_0x3fdeb8,_0x4ff890){_0x4ff890=_0x4ff890||0xc8;return function(_0xe42d18){if(_0xe42d18){return _0x3fdeb8['status'](_0x4ff890)['json'](_0xe42d18);}};}function respondWithFilteredResult(_0x554717,_0x1fcc62){return function(_0x5dd9e7){if(_0x5dd9e7){var _0x1123ab=typeof _0x1fcc62[_0x1127('0x1a')]===_0x1127('0x1b')&&typeof _0x1fcc62['limit']===_0x1127('0x1b');var _0xd089d8=_0x5dd9e7['count'];var _0xb808ac=_0x1123ab?0x0:_0x1fcc62[_0x1127('0x1a')];var _0x908741=_0x1123ab?_0x5dd9e7['count']:_0x1fcc62['offset']+_0x1fcc62[_0x1127('0x1c')];var _0xde501d;if(_0x908741>=_0xd089d8){_0x908741=_0xd089d8;_0xde501d=0xc8;}else{_0xde501d=0xce;}_0x554717[_0x1127('0x19')](_0xde501d);return _0x554717[_0x1127('0x1d')](_0x1127('0x1e'),_0xb808ac+'-'+_0x908741+'/'+_0xd089d8)['json'](_0x5dd9e7);}return null;};}function patchUpdates(_0x4ef9c4){return function(_0x4d45d9){try{jsonpatch[_0x1127('0x1f')](_0x4d45d9,_0x4ef9c4,!![]);}catch(_0x110113){return BPromise[_0x1127('0x20')](_0x110113);}return _0x4d45d9[_0x1127('0x21')]();};}function saveUpdates(_0x5ddc1e,_0x271eca){return function(_0x49a835){if(_0x49a835){return _0x49a835[_0x1127('0x22')](_0x5ddc1e)[_0x1127('0x23')](function(_0x56506a){return _0x56506a;});}return null;};}function removeEntity(_0x214714,_0x5a2518){return function(_0x74d474){if(_0x74d474){return _0x74d474[_0x1127('0x24')]()['then'](function(){var _0x1bced4=_0x74d474[_0x1127('0x25')]({'plain':!![]});var _0x11a320=_0x1127('0x26');return db[_0x1127('0x27')][_0x1127('0x24')]({'where':{'type':_0x11a320,'resourceId':_0x1bced4['id']}})[_0x1127('0x23')](function(){return _0x74d474;});})[_0x1127('0x23')](function(){_0x214714['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3876fe,_0x2b5175){return function(_0x3d0290){if(!_0x3d0290){_0x3876fe[_0x1127('0x28')](0x194);}return _0x3d0290;};}function handleError(_0x503151,_0x2d44e5){_0x2d44e5=_0x2d44e5||0x1f4;return function(_0x5bb4c7){logger[_0x1127('0x29')](_0x5bb4c7[_0x1127('0x2a')]);if(_0x5bb4c7[_0x1127('0x2b')]){delete _0x5bb4c7[_0x1127('0x2b')];}_0x503151['status'](_0x2d44e5)[_0x1127('0x2c')](_0x5bb4c7);};}exports[_0x1127('0x2d')]=function(_0x27494f,_0x5c0e10){var _0x23c0b4={},_0x3ca19e={},_0x4e8bcd={'count':0x0,'rows':[]};var _0x1a44a1=_[_0x1127('0x2e')](db[_0x1127('0x2f')][_0x1127('0x30')],function(_0xe14a28){return{'name':_0xe14a28[_0x1127('0x31')],'type':_0xe14a28[_0x1127('0x32')][_0x1127('0x33')]};});_0x3ca19e['model']=_[_0x1127('0x2e')](_0x1a44a1,'name');_0x3ca19e[_0x1127('0x34')]=_['keys'](_0x27494f[_0x1127('0x34')]);_0x3ca19e['filters']=_[_0x1127('0x35')](_0x3ca19e[_0x1127('0x36')],_0x3ca19e[_0x1127('0x34')]);_0x23c0b4['attributes']=_[_0x1127('0x35')](_0x3ca19e[_0x1127('0x36')],qs['fields'](_0x27494f['query'][_0x1127('0x37')]));_0x23c0b4['attributes']=_0x23c0b4[_0x1127('0x38')][_0x1127('0x39')]?_0x23c0b4[_0x1127('0x38')]:_0x3ca19e[_0x1127('0x36')];if(!_0x27494f['query'][_0x1127('0x3a')](_0x1127('0x3b'))){_0x23c0b4[_0x1127('0x1c')]=qs['limit'](_0x27494f[_0x1127('0x34')][_0x1127('0x1c')]);_0x23c0b4[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x27494f[_0x1127('0x34')][_0x1127('0x1a')]);}_0x23c0b4['order']=qs[_0x1127('0x3c')](_0x27494f[_0x1127('0x34')][_0x1127('0x3c')]);_0x23c0b4[_0x1127('0x3d')]=qs[_0x1127('0x3e')](_[_0x1127('0x3f')](_0x27494f[_0x1127('0x34')],_0x3ca19e[_0x1127('0x3e')]),_0x1a44a1);if(_0x27494f[_0x1127('0x34')][_0x1127('0x40')]){_0x23c0b4[_0x1127('0x3d')]=_[_0x1127('0x41')](_0x23c0b4['where'],{'$or':_[_0x1127('0x2e')](_0x1a44a1,function(_0x23551b){if(_0x23551b[_0x1127('0x32')]!=='VIRTUAL'){var _0x3fe002={};_0x3fe002[_0x23551b[_0x1127('0x2b')]]={'$like':'%'+_0x27494f[_0x1127('0x34')][_0x1127('0x40')]+'%'};return _0x3fe002;}})});}_0x23c0b4=_[_0x1127('0x41')]({},_0x23c0b4,_0x27494f[_0x1127('0x42')]);var _0x4e8196={'where':_0x23c0b4[_0x1127('0x3d')]};return db['MailQueue'][_0x1127('0x43')](_0x4e8196)['then'](function(_0x37db08){_0x4e8bcd[_0x1127('0x43')]=_0x37db08;if(_0x27494f[_0x1127('0x34')][_0x1127('0x44')]){_0x23c0b4['include']=[{'all':!![]}];}return db['MailQueue'][_0x1127('0x45')](_0x23c0b4);})[_0x1127('0x23')](function(_0x2c9da2){_0x4e8bcd['rows']=_0x2c9da2;return _0x4e8bcd;})[_0x1127('0x23')](respondWithFilteredResult(_0x5c0e10,_0x23c0b4))['catch'](handleError(_0x5c0e10,null));};exports['show']=function(_0x550060,_0x2c757a){var _0x12b73f={'raw':!![],'where':{'id':_0x550060[_0x1127('0x46')]['id']}},_0x1dab42={};_0x1dab42[_0x1127('0x36')]=_[_0x1127('0x47')](db[_0x1127('0x2f')][_0x1127('0x30')]);_0x1dab42[_0x1127('0x34')]=_[_0x1127('0x47')](_0x550060[_0x1127('0x34')]);_0x1dab42[_0x1127('0x3e')]=_[_0x1127('0x35')](_0x1dab42[_0x1127('0x36')],_0x1dab42[_0x1127('0x34')]);_0x12b73f[_0x1127('0x38')]=_[_0x1127('0x35')](_0x1dab42[_0x1127('0x36')],qs[_0x1127('0x37')](_0x550060['query']['fields']));_0x12b73f['attributes']=_0x12b73f[_0x1127('0x38')][_0x1127('0x39')]?_0x12b73f['attributes']:_0x1dab42[_0x1127('0x36')];if(_0x550060[_0x1127('0x34')][_0x1127('0x44')]){_0x12b73f[_0x1127('0x48')]=[{'all':!![]}];}_0x12b73f=_[_0x1127('0x41')]({},_0x12b73f,_0x550060[_0x1127('0x42')]);return db[_0x1127('0x2f')]['find'](_0x12b73f)[_0x1127('0x23')](handleEntityNotFound(_0x2c757a,null))['then'](respondWithResult(_0x2c757a,null))['catch'](handleError(_0x2c757a,null));};exports[_0x1127('0x49')]=function(_0x6c8a4f,_0x11f242){return db[_0x1127('0x2f')]['create'](_0x6c8a4f[_0x1127('0x4a')],{})[_0x1127('0x23')](function(_0x35024a){var _0x508b94=_0x6c8a4f['user'][_0x1127('0x25')]({'plain':!![]});if(!_0x508b94)throw new Error(_0x1127('0x4b'));if(_0x508b94[_0x1127('0x4c')]==='user'){var _0x296e0a=_0x35024a[_0x1127('0x25')]({'plain':!![]});var _0x26211b=_0x1127('0x26');return db[_0x1127('0x4d')][_0x1127('0x4e')]({'where':{'name':_0x26211b,'userProfileId':_0x508b94['userProfileId']},'raw':!![]})[_0x1127('0x23')](function(_0x100cae){if(_0x100cae&&_0x100cae[_0x1127('0x4f')]===0x0){return db['UserProfileResource'][_0x1127('0x49')]({'name':_0x296e0a[_0x1127('0x2b')],'resourceId':_0x296e0a['id'],'type':_0x100cae[_0x1127('0x2b')],'sectionId':_0x100cae['id']},{})[_0x1127('0x23')](function(){return _0x35024a;});}else{return _0x35024a;}})[_0x1127('0x50')](function(_0x23f0d4){logger[_0x1127('0x29')](_0x1127('0x51'),_0x23f0d4);throw _0x23f0d4;});}return _0x35024a;})[_0x1127('0x23')](respondWithResult(_0x11f242,0xc9))['catch'](handleError(_0x11f242,null));};exports[_0x1127('0x22')]=function(_0xf3c5dd,_0x42a1e6){if(_0xf3c5dd[_0x1127('0x4a')]['id']){delete _0xf3c5dd[_0x1127('0x4a')]['id'];}return db[_0x1127('0x2f')]['find']({'where':{'id':_0xf3c5dd[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x42a1e6,null))['then'](saveUpdates(_0xf3c5dd[_0x1127('0x4a')],null))[_0x1127('0x23')](respondWithResult(_0x42a1e6,null))[_0x1127('0x50')](handleError(_0x42a1e6,null));};exports[_0x1127('0x24')]=function(_0x5c2c4e,_0x3bad59){return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x5c2c4e['params']['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x3bad59,null))[_0x1127('0x23')](removeEntity(_0x3bad59,null))[_0x1127('0x50')](handleError(_0x3bad59,null));};exports[_0x1127('0x52')]=function(_0x42b2ad,_0x1a98b7){return db[_0x1127('0x2f')][_0x1127('0x52')]()[_0x1127('0x23')](respondWithResult(_0x1a98b7,null))[_0x1127('0x50')](handleError(_0x1a98b7,null));};exports[_0x1127('0x53')]=function(_0x4ef71a,_0x18386b,_0x41f095){var _0x14c3a0={'raw':!![],'where':{}},_0x2581e1={},_0x14152c;return db[_0x1127('0x2f')]['findOne']({'where':{'id':_0x4ef71a[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x18386b,null))[_0x1127('0x23')](function(_0x3f2c9c){if(_0x3f2c9c){_0x14152c=_0x3f2c9c[_0x1127('0x25')]({'plain':!![]});_0x2581e1['model']=_[_0x1127('0x47')](db[_0x1127('0x54')]['rawAttributes']);_0x2581e1['query']=_[_0x1127('0x47')](_0x4ef71a[_0x1127('0x34')]);_0x2581e1[_0x1127('0x3e')]=_['intersection'](_0x2581e1[_0x1127('0x36')],_0x2581e1[_0x1127('0x34')]);_0x14c3a0[_0x1127('0x38')]=_[_0x1127('0x35')](_0x2581e1[_0x1127('0x36')],qs[_0x1127('0x37')](_0x4ef71a[_0x1127('0x34')][_0x1127('0x37')]));_0x14c3a0[_0x1127('0x38')]=_0x14c3a0[_0x1127('0x38')][_0x1127('0x39')]?_0x14c3a0[_0x1127('0x38')]:_0x2581e1[_0x1127('0x36')];if(!_0x4ef71a[_0x1127('0x34')][_0x1127('0x3a')](_0x1127('0x3b'))){_0x14c3a0[_0x1127('0x1c')]=qs[_0x1127('0x1c')](_0x4ef71a['query'][_0x1127('0x1c')]);_0x14c3a0[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x4ef71a[_0x1127('0x34')]['offset']);}_0x14c3a0[_0x1127('0x55')]=qs['sort'](_0x4ef71a[_0x1127('0x34')][_0x1127('0x3c')]);_0x14c3a0[_0x1127('0x3d')]=qs[_0x1127('0x3e')](_['pick'](_0x4ef71a[_0x1127('0x34')],_0x2581e1['filters']));_0x14c3a0[_0x1127('0x3d')]['MailQueueId']=_0x3f2c9c['id'];if(_0x4ef71a[_0x1127('0x34')][_0x1127('0x40')]){_0x14c3a0['where']=_['merge'](_0x14c3a0[_0x1127('0x3d')],{'$or':_[_0x1127('0x2e')](_0x14c3a0[_0x1127('0x38')],function(_0x1fc5e5){var _0x243e41={};_0x243e41[_0x1fc5e5]={'$like':'%'+_0x4ef71a[_0x1127('0x34')]['filter']+'%'};return _0x243e41;})});}_0x14c3a0=_[_0x1127('0x41')]({},_0x14c3a0,_0x4ef71a[_0x1127('0x42')]);return db[_0x1127('0x54')]['findAll'](_0x14c3a0);}})[_0x1127('0x23')](function(_0x1a73f3){if(_0x1a73f3){return db[_0x1127('0x56')]['findAndCountAll']({'where':{'id':_[_0x1127('0x2e')](_0x1a73f3,'UserId'),'role':_0x1127('0x57')},'attributes':['id',_0x1127('0x2b'),_0x1127('0x58'),_0x1127('0x59'),_0x1127('0x5a')]});}})['then'](function(_0x1e6b1f){if(_0x1e6b1f){return{'count':_0x1e6b1f[_0x1127('0x43')],'rows':_[_0x1127('0x2e')](_0x1e6b1f['rows'],function(_0x53ac01){return{'membername':_0x53ac01[_0x1127('0x2b')],'UserId':_0x53ac01['id'],'queue_name':_0x14152c[_0x1127('0x2b')],'MailQueueId':_0x14152c['id'],'interface':util['format']('%s/%s',_0x1127('0x5b'),_0x53ac01['name']),'penalty':0x0,'paused':_0x53ac01[_0x1127('0x58')],'createdAt':_0x53ac01[_0x1127('0x5a')],'updatedAt':_0x53ac01[_0x1127('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x18386b,_0x14c3a0))[_0x1127('0x50')](handleError(_0x18386b,null));};exports['getTeams']=function(_0x790ff3,_0x30fc3e,_0x18454d){var _0x486d6e={};var _0x162540={};var _0x7b52e6;var _0x790cf5;return db[_0x1127('0x2f')]['findOne']({'where':{'id':_0x790ff3[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x30fc3e,null))[_0x1127('0x23')](function(_0x4b8fa6){if(_0x4b8fa6){_0x7b52e6=_0x4b8fa6;_0x162540[_0x1127('0x36')]=_[_0x1127('0x47')](db[_0x1127('0x5c')][_0x1127('0x30')]);_0x162540[_0x1127('0x34')]=_[_0x1127('0x47')](_0x790ff3[_0x1127('0x34')]);_0x162540['filters']=_['intersection'](_0x162540[_0x1127('0x36')],_0x162540[_0x1127('0x34')]);_0x486d6e[_0x1127('0x38')]=_['intersection'](_0x162540[_0x1127('0x36')],qs[_0x1127('0x37')](_0x790ff3[_0x1127('0x34')][_0x1127('0x37')]));_0x486d6e[_0x1127('0x38')]=_0x486d6e[_0x1127('0x38')][_0x1127('0x39')]?_0x486d6e[_0x1127('0x38')]:_0x162540[_0x1127('0x36')];_0x486d6e[_0x1127('0x55')]=qs[_0x1127('0x3c')](_0x790ff3[_0x1127('0x34')][_0x1127('0x3c')]);_0x486d6e[_0x1127('0x3d')]=qs['filters'](_[_0x1127('0x3f')](_0x790ff3[_0x1127('0x34')],_0x162540['filters']));if(_0x790ff3[_0x1127('0x34')][_0x1127('0x40')]){_0x486d6e['where']=_[_0x1127('0x41')](_0x486d6e[_0x1127('0x3d')],{'$or':_[_0x1127('0x2e')](_0x486d6e['attributes'],function(_0x7e5700){var _0x3cbcf2={};_0x3cbcf2[_0x7e5700]={'$like':'%'+_0x790ff3['query'][_0x1127('0x40')]+'%'};return _0x3cbcf2;})});}_0x486d6e=_[_0x1127('0x41')]({},_0x486d6e,_0x790ff3[_0x1127('0x42')]);return _0x7b52e6[_0x1127('0x5d')](_0x486d6e);}})[_0x1127('0x23')](function(_0x494eca){if(_0x494eca){_0x790cf5=_0x494eca['length'];if(!_0x790ff3[_0x1127('0x34')][_0x1127('0x3a')]('nolimit')){_0x486d6e[_0x1127('0x1c')]=qs[_0x1127('0x1c')](_0x790ff3[_0x1127('0x34')]['limit']);_0x486d6e[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x790ff3[_0x1127('0x34')][_0x1127('0x1a')]);}return _0x7b52e6[_0x1127('0x5d')](_0x486d6e);}})[_0x1127('0x23')](function(_0x177fac){if(_0x177fac){return _0x177fac?{'count':_0x790cf5,'rows':_0x177fac}:null;}})[_0x1127('0x23')](respondWithResult(_0x30fc3e,null))[_0x1127('0x50')](handleError(_0x30fc3e,null));};exports[_0x1127('0x5e')]=function(_0x216253,_0x163b3d,_0x4edd77){var _0x45c1ac=_0x216253[_0x1127('0x4a')]['ids'];return db[_0x1127('0x5c')][_0x1127('0x45')]({'where':{'id':_0x45c1ac},'attributes':['id'],'include':[{'model':db[_0x1127('0x56')],'as':_0x1127('0x5f'),'attributes':['id',_0x1127('0x2b'),_0x1127('0x60'),_0x1127('0x61'),_0x1127('0x62')],'raw':!![]}]})[_0x1127('0x23')](function(_0x46622d){if(_0x46622d){var _0x40e07f=_['flatMap'](_0x46622d,function(_0xd7a358){var _0x3f26bf=_0xd7a358[_0x1127('0x25')]({'plain':!![]});return _0x3f26bf['Agents'];});return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x216253[_0x1127('0x46')]['id']}})[_0x1127('0x23')](function(_0x588862){return db[_0x1127('0x63')][_0x1127('0x64')](function(_0x3115a2){return _0x588862[_0x1127('0x5e')](_0x45c1ac,{'transaction':_0x3115a2})[_0x1127('0x23')](function(){return BPromise[_0x1127('0x65')](_0x40e07f,function(_0x1f1f0a){return db[_0x1127('0x54')]['findOrCreate']({'where':{'UserId':_0x1f1f0a['id'],'MailQueueId':_0x216253[_0x1127('0x46')]['id']},'transaction':_0x3115a2});});})['then'](function(){_0x40e07f[_0x1127('0x66')](function(_0x126a9c){socket[_0x1127('0x67')](_0x1127('0x68'),{'UserId':_0x126a9c['id'],'MailQueueId':_0x588862['id']});});});});});}})[_0x1127('0x23')](respondWithStatusCode(_0x163b3d,null))['catch'](handleError(_0x163b3d,null));};exports['removeTeams']=function(_0x4f74fc,_0x22d56e,_0x2490f9){return db[_0x1127('0x5c')][_0x1127('0x45')]({'where':{'id':_0x4f74fc[_0x1127('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1127('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1127('0x23')](handleEntityNotFound(_0x22d56e,null))[_0x1127('0x23')](function(_0x3aae52){var _0x1d69fb=_[_0x1127('0x2e')](_0x3aae52,'id');var _0x9c6b74=[];var _0x5083bd=[];var _0x22fcf8=squel[_0x1127('0x69')]();_0x22fcf8[_0x1127('0x6a')](_0x1127('0x6b'))['from'](_0x1127('0x6c'),'tq')[_0x1127('0x6d')]('user_has_teams','ut',_0x1127('0x6e'))['where'](_0x1127('0x6f'),_0x4f74fc[_0x1127('0x46')]['id']);for(var _0x8084e8=0x0;_0x8084e8<_0x3aae52['length'];_0x8084e8+=0x1){let _0xdde129=_0x3aae52[_0x8084e8];for(var _0x2b3912=0x0;_0x2b3912<_0xdde129[_0x1127('0x5f')]['length'];_0x2b3912+=0x1){let _0x53efa2=_0xdde129['Agents'][_0x2b3912];var _0x34c950=_0x22fcf8[_0x1127('0x70')]();_0x34c950[_0x1127('0x3d')](_0x1127('0x71'),_0x53efa2['id']);_0x5083bd[_0x1127('0x72')](db['sequelize']['query'](_0x34c950[_0x1127('0x73')](),{'type':db[_0x1127('0x63')][_0x1127('0x74')][_0x1127('0x75')]})[_0x1127('0x23')](function(_0x19efb8){if(_0x19efb8[_0x1127('0x39')]===0x1){return _0x53efa2['id'];}else{var _0x355185=_['every'](_[_0x1127('0x2e')](_0x19efb8,_0x1127('0x76')),function(_0xdff4be){return _['includes'](_0x1d69fb,_0xdff4be);});if(_0x355185){return _0x53efa2['id'];}}}));}}return BPromise[_0x1127('0x77')](_0x5083bd)[_0x1127('0x23')](function(_0x44dffd){_0x9c6b74=_(_0x9c6b74)[_0x1127('0x78')](_0x44dffd)['compact']()[_0x1127('0x79')]();return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x4f74fc[_0x1127('0x46')]['id']}})['then'](function(_0x3e1ccb){return db[_0x1127('0x63')][_0x1127('0x64')](function(_0x9c6fc2){return _0x3e1ccb[_0x1127('0x7a')](_0x4f74fc['query']['ids'],{'transaction':_0x9c6fc2})[_0x1127('0x23')](function(){if(!_['isEmpty'](_0x9c6b74)){return _0x3e1ccb[_0x1127('0x7b')](_0x9c6b74,{'transaction':_0x9c6fc2});}})['then'](function(){_0x9c6b74[_0x1127('0x66')](function(_0x3cabde){socket[_0x1127('0x67')](_0x1127('0x7c'),{'UserId':_0x3cabde,'MailQueueId':_0x3e1ccb['id']});});});});});});})[_0x1127('0x23')](respondWithStatusCode(_0x22d56e,null))['catch'](handleError(_0x22d56e,null));};exports['addAgents']=function(_0x3d9aae,_0xb5a1d2,_0x3b4685){return db['MailQueue'][_0x1127('0x4e')]({'where':{'id':_0x3d9aae[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0xb5a1d2,null))[_0x1127('0x23')](function(_0xf4f872){if(_0xf4f872){return _0xf4f872[_0x1127('0x7d')](_0x3d9aae['body'][_0x1127('0x7e')],_[_0x1127('0x7f')](_0x3d9aae[_0x1127('0x4a')],[_0x1127('0x7e'),'id'])||{})['spread'](function(_0x1c8867){for(var _0x351e6c=0x0;_0x351e6c<_0x3d9aae[_0x1127('0x4a')][_0x1127('0x7e')]['length'];_0x351e6c+=0x1){socket[_0x1127('0x67')](_0x1127('0x68'),{'UserId':Number(_0x3d9aae['body'][_0x1127('0x7e')][_0x351e6c]),'MailQueueId':Number(_0x3d9aae[_0x1127('0x46')]['id'])});}return _0x1c8867;});}})[_0x1127('0x23')](respondWithResult(_0xb5a1d2,null))[_0x1127('0x50')](handleError(_0xb5a1d2,null));};exports['removeAgents']=function(_0x31a971,_0x44a3d9,_0x246fb7){return db[_0x1127('0x2f')][_0x1127('0x4e')]({'where':{'id':_0x31a971[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x44a3d9,null))[_0x1127('0x23')](function(_0x173bd4){if(_0x173bd4){return _0x173bd4['removeAgents'](_0x31a971[_0x1127('0x34')][_0x1127('0x7e')])[_0x1127('0x23')](function(){if(_['isArray'](_0x31a971[_0x1127('0x34')][_0x1127('0x7e')])){for(var _0x48d37b=0x0;_0x48d37b<_0x31a971[_0x1127('0x34')][_0x1127('0x7e')][_0x1127('0x39')];_0x48d37b+=0x1){socket[_0x1127('0x67')](_0x1127('0x7c'),{'UserId':Number(_0x31a971[_0x1127('0x34')][_0x1127('0x7e')][_0x48d37b]),'MailQueueId':Number(_0x31a971[_0x1127('0x46')]['id'])});}}else{socket['emit'](_0x1127('0x7c'),{'UserId':Number(_0x31a971[_0x1127('0x34')][_0x1127('0x7e')]),'MailQueueId':Number(_0x31a971['params']['id'])});}});}})[_0x1127('0x23')](respondWithStatusCode(_0x44a3d9,null))['catch'](handleError(_0x44a3d9,null));};exports[_0x1127('0x80')]=function(_0x57d110,_0x2e99d2,_0x306c13){var _0x910404={};var _0x3656a5={};var _0xdd40b2;var _0x4e8bae;return db[_0x1127('0x2f')][_0x1127('0x81')]({'where':{'id':_0x57d110[_0x1127('0x46')]['id']}})[_0x1127('0x23')](handleEntityNotFound(_0x2e99d2,null))['then'](function(_0x4e95fb){if(_0x4e95fb){_0xdd40b2=_0x4e95fb;_0x3656a5[_0x1127('0x36')]=_['keys'](db[_0x1127('0x56')][_0x1127('0x30')]);_0x3656a5['query']=_['keys'](_0x57d110[_0x1127('0x34')]);_0x3656a5[_0x1127('0x3e')]=_[_0x1127('0x35')](_0x3656a5[_0x1127('0x36')],_0x3656a5[_0x1127('0x34')]);_0x910404[_0x1127('0x38')]=_['intersection'](_0x3656a5['model'],qs['fields'](_0x57d110[_0x1127('0x34')]['fields']));_0x910404[_0x1127('0x38')]=_0x910404[_0x1127('0x38')]['length']?_0x910404[_0x1127('0x38')]:_0x3656a5[_0x1127('0x36')];_0x910404[_0x1127('0x55')]=qs['sort'](_0x57d110[_0x1127('0x34')][_0x1127('0x3c')]);_0x910404[_0x1127('0x3d')]=qs['filters'](_['pick'](_0x57d110['query'],_0x3656a5[_0x1127('0x3e')]));if(_0x57d110['query'][_0x1127('0x40')]){_0x910404[_0x1127('0x3d')]=_[_0x1127('0x41')](_0x910404['where'],{'$or':_[_0x1127('0x2e')](_0x910404[_0x1127('0x38')],function(_0x251d09){var _0x423739={};_0x423739[_0x251d09]={'$like':'%'+_0x57d110[_0x1127('0x34')][_0x1127('0x40')]+'%'};return _0x423739;})});}_0x910404=_[_0x1127('0x41')]({},_0x910404,_0x57d110[_0x1127('0x42')]);return _0xdd40b2[_0x1127('0x80')](_0x910404);}})['then'](function(_0x2228aa){if(_0x2228aa){_0x4e8bae=_0x2228aa['length'];if(!_0x57d110[_0x1127('0x34')][_0x1127('0x3a')](_0x1127('0x3b'))){_0x910404[_0x1127('0x1c')]=qs[_0x1127('0x1c')](_0x57d110['query'][_0x1127('0x1c')]);_0x910404[_0x1127('0x1a')]=qs[_0x1127('0x1a')](_0x57d110[_0x1127('0x34')]['offset']);}return _0xdd40b2['getAgents'](_0x910404);}})[_0x1127('0x23')](function(_0xa04a8e){if(_0xa04a8e){return _0xa04a8e?{'count':_0x4e8bae,'rows':_0xa04a8e}:null;}})[_0x1127('0x23')](respondWithResult(_0x2e99d2,null))[_0x1127('0x50')](handleError(_0x2e99d2,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c24a24c..b6d01e6 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 _0x530e=['MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x520ed6,_0x595a23){var _0x1cbfb5=function(_0x42057c){while(--_0x42057c){_0x520ed6['push'](_0x520ed6['shift']());}};_0x1cbfb5(++_0x595a23);}(_0x530e,0x17f));var _0xe530=function(_0x2c4c82,_0x590fc5){_0x2c4c82=_0x2c4c82-0x0;var _0x31a434=_0x530e[_0x2c4c82];return _0x31a434;};'use strict';var EventEmitter=require(_0xe530('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xe530('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe530('0x2')](0x0);var events={'afterCreate':_0xe530('0x3'),'afterUpdate':'update','afterDestroy':_0xe530('0x4')};function emitEvent(_0x2d27ea){return function(_0x3880db,_0x43a93d,_0x297101){MailQueueEvents[_0xe530('0x5')](_0x2d27ea+':'+_0x3880db['id'],_0x3880db);MailQueueEvents['emit'](_0x2d27ea,_0x3880db);_0x297101(null);};}for(var e in events){if(events[_0xe530('0x6')](e)){var event=events[e];MailQueue[_0xe530('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x16dd=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xa902cb,_0x26f055){var _0x301a0c=function(_0x45f23c){while(--_0x45f23c){_0xa902cb['push'](_0xa902cb['shift']());}};_0x301a0c(++_0x26f055);}(_0x16dd,0xf6));var _0xd16d=function(_0x1677cc,_0x2cf11c){_0x1677cc=_0x1677cc-0x0;var _0x24ed92=_0x16dd[_0x1677cc];return _0x24ed92;};'use strict';var EventEmitter=require(_0xd16d('0x0'));var MailQueue=require(_0xd16d('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd16d('0x2')](0x0);var events={'afterCreate':_0xd16d('0x3'),'afterUpdate':'update','afterDestroy':_0xd16d('0x4')};function emitEvent(_0x2a0c77){return function(_0x3f41d0,_0x7a7da8,_0x144136){MailQueueEvents[_0xd16d('0x5')](_0x2a0c77+':'+_0x3f41d0['id'],_0x3f41d0);MailQueueEvents[_0xd16d('0x5')](_0x2a0c77,_0x3f41d0);_0x144136(null);};}for(var e in events){if(events[_0xd16d('0x6')](e)){var event=events[e];MailQueue[_0xd16d('0x7')](e,emitEvent(event));}}module[_0xd16d('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 184774c..38c03f8 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 _0xb54d=['path','../../config/environment','./mailQueue.attributes','define','MailQueue','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xb54d,0x1bd));var _0xdb54=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xb54d[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xdb54('0x0'));var util=require('util');var logger=require(_0xdb54('0x1'))(_0xdb54('0x2'));var moment=require(_0xdb54('0x3'));var BPromise=require(_0xdb54('0x4'));var rp=require(_0xdb54('0x5'));var fs=require('fs');var path=require(_0xdb54('0x6'));var rimraf=require('rimraf');var config=require(_0xdb54('0x7'));var attributes=require(_0xdb54('0x8'));module['exports']=function(_0x1b6332,_0x1a51b5){return _0x1b6332[_0xdb54('0x9')](_0xdb54('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabd5=['rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d0a4f,_0x88c2f9){var _0x6abede=function(_0x1a7b8f){while(--_0x1a7b8f){_0x2d0a4f['push'](_0x2d0a4f['shift']());}};_0x6abede(++_0x88c2f9);}(_0xabd5,0x6e));var _0x5abd=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xabd5[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x5abd('0x0'));var util=require('util');var logger=require(_0x5abd('0x1'))(_0x5abd('0x2'));var moment=require(_0x5abd('0x3'));var BPromise=require(_0x5abd('0x4'));var rp=require(_0x5abd('0x5'));var fs=require('fs');var path=require(_0x5abd('0x6'));var rimraf=require(_0x5abd('0x7'));var config=require(_0x5abd('0x8'));var attributes=require('./mailQueue.attributes');module[_0x5abd('0x9')]=function(_0x24bfa0,_0x41693c){return _0x24bfa0[_0x5abd('0xa')](_0x5abd('0xb'),attributes,{'tableName':_0x5abd('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 6b72e0c..9b079f5 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 _0x88f4=['http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','map','model','ShowMailQueue','find','raw','where','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x88f4,0x17d));var _0x488f=function(_0x2238e8,_0x16ee32){_0x2238e8=_0x2238e8-0x0;var _0x4254f9=_0x88f4[_0x2238e8];return _0x4254f9;};'use strict';var _=require(_0x488f('0x0'));var util=require(_0x488f('0x1'));var moment=require(_0x488f('0x2'));var BPromise=require('bluebird');var rs=require(_0x488f('0x3'));var fs=require('fs');var Redis=require(_0x488f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x488f('0x5'));var logger=require('../../config/logger')(_0x488f('0x6'));var config=require('../../config/environment');var jayson=require(_0x488f('0x7'));var client=jayson[_0x488f('0x8')][_0x488f('0x9')]({'port':0x232a});config[_0x488f('0xa')]=_[_0x488f('0xb')](config[_0x488f('0xa')],{'host':_0x488f('0xc'),'port':0x18eb});var socket=require(_0x488f('0xd'))(new Redis(config[_0x488f('0xa')]));require(_0x488f('0xe'))[_0x488f('0xf')](socket);function respondWithRpcPromise(_0x10b1dc,_0x457e5c,_0x4fc1f9){return new BPromise(function(_0x838a12,_0x4c9fc1){return client[_0x488f('0x10')](_0x10b1dc,_0x4fc1f9)['then'](function(_0x1f6d08){logger['info'](_0x488f('0x11'),_0x457e5c,_0x488f('0x12'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x457e5c,_0x488f('0x12'),JSON[_0x488f('0x13')](_0x1f6d08));if(_0x1f6d08[_0x488f('0x14')]){if(_0x1f6d08[_0x488f('0x14')]['code']===0x1f4){logger[_0x488f('0x14')](_0x488f('0x11'),_0x457e5c,_0x1f6d08[_0x488f('0x14')][_0x488f('0x15')]);return _0x4c9fc1(_0x1f6d08[_0x488f('0x14')][_0x488f('0x15')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x457e5c,_0x1f6d08['error'][_0x488f('0x15')]);return _0x838a12(_0x1f6d08[_0x488f('0x14')][_0x488f('0x15')]);}else{logger[_0x488f('0x16')](_0x488f('0x11'),_0x457e5c,'request\x20sent');_0x838a12(_0x1f6d08[_0x488f('0x17')]['message']);}})[_0x488f('0x18')](function(_0xb475e4){logger[_0x488f('0x14')]('MailQueue,\x20%s,\x20%s',_0x457e5c,_0xb475e4);_0x4c9fc1(_0xb475e4);});});}exports[_0x488f('0x19')]=function(_0x832057){var _0x1e38b4=this;return new Promise(function(_0x1031e4,_0x4ab567){return db[_0x488f('0x1a')][_0x488f('0x1b')]({'raw':_0x832057['options']?_0x832057['options']['raw']===undefined?!![]:![]:!![],'where':_0x832057[_0x488f('0x1c')]?_0x832057[_0x488f('0x1c')]['where']||null:null,'attributes':_0x832057[_0x488f('0x1c')]?_0x832057[_0x488f('0x1c')][_0x488f('0x1d')]||null:null,'limit':_0x832057[_0x488f('0x1c')]?_0x832057[_0x488f('0x1c')][_0x488f('0x1e')]||null:null,'include':_0x832057[_0x488f('0x1c')]?_0x832057[_0x488f('0x1c')][_0x488f('0x1f')]?_[_0x488f('0x20')](_0x832057[_0x488f('0x1c')][_0x488f('0x1f')],function(_0x10156e){return{'model':db[_0x10156e['model']],'as':_0x10156e['as'],'attributes':_0x10156e['attributes'],'include':_0x10156e[_0x488f('0x1f')]?_['map'](_0x10156e[_0x488f('0x1f')],function(_0x1d985f){return{'model':db[_0x1d985f[_0x488f('0x21')]],'as':_0x1d985f['as'],'attributes':_0x1d985f[_0x488f('0x1d')],'include':_0x1d985f[_0x488f('0x1f')]?_[_0x488f('0x20')](_0x1d985f[_0x488f('0x1f')],function(_0x10dfc2){return{'model':db[_0x10dfc2['model']],'as':_0x10dfc2['as'],'attributes':_0x10dfc2[_0x488f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1075){logger[_0x488f('0x16')](_0x488f('0x19'),_0x832057);logger['debug']('GetMailQueue',_0x832057,JSON[_0x488f('0x13')](_0x4b1075));_0x1031e4(_0x4b1075);})[_0x488f('0x18')](function(_0x2f084f){logger[_0x488f('0x14')](_0x488f('0x19'),_0x2f084f[_0x488f('0x15')],_0x832057);_0x4ab567(_0x1e38b4['error'](0x1f4,_0x2f084f[_0x488f('0x15')]));});});};exports[_0x488f('0x22')]=function(_0x1dee2d){var _0x1c25a8=this;return new Promise(function(_0x23e9a5,_0x417c3d){return db[_0x488f('0x1a')][_0x488f('0x23')]({'raw':_0x1dee2d['options']?_0x1dee2d[_0x488f('0x1c')][_0x488f('0x24')]===undefined?!![]:![]:!![],'where':_0x1dee2d[_0x488f('0x1c')]?_0x1dee2d[_0x488f('0x1c')][_0x488f('0x25')]||null:null,'attributes':_0x1dee2d['options']?_0x1dee2d[_0x488f('0x1c')]['attributes']||null:null,'include':_0x1dee2d['options']?_0x1dee2d[_0x488f('0x1c')][_0x488f('0x1f')]?_[_0x488f('0x20')](_0x1dee2d[_0x488f('0x1c')][_0x488f('0x1f')],function(_0x43d65e){return{'model':db[_0x43d65e[_0x488f('0x21')]],'as':_0x43d65e['as'],'attributes':_0x43d65e[_0x488f('0x1d')],'include':_0x43d65e[_0x488f('0x1f')]?_[_0x488f('0x20')](_0x43d65e[_0x488f('0x1f')],function(_0x14f24a){return{'model':db[_0x14f24a[_0x488f('0x21')]],'as':_0x14f24a['as'],'attributes':_0x14f24a[_0x488f('0x1d')],'include':_0x14f24a[_0x488f('0x1f')]?_[_0x488f('0x20')](_0x14f24a['include'],function(_0x20249a){return{'model':db[_0x20249a[_0x488f('0x21')]],'as':_0x20249a['as'],'attributes':_0x20249a[_0x488f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3939b){logger['info'](_0x488f('0x22'),_0x1dee2d);logger[_0x488f('0x26')]('ShowMailQueue',_0x1dee2d,JSON['stringify'](_0xc3939b));_0x23e9a5(_0xc3939b);})[_0x488f('0x18')](function(_0x40320f){logger[_0x488f('0x14')]('ShowMailQueue',_0x40320f[_0x488f('0x15')],_0x1dee2d);_0x417c3d(_0x1c25a8[_0x488f('0x14')](0x1f4,_0x40320f[_0x488f('0x15')]));});});}; \ No newline at end of file +var _0x767e=['attributes','limit','include','model','map','GetMailQueue','ShowMailQueue','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','MailQueue','options','raw'];(function(_0x20e79f,_0x1633b6){var _0x1a846b=function(_0x1d9320){while(--_0x1d9320){_0x20e79f['push'](_0x20e79f['shift']());}};_0x1a846b(++_0x1633b6);}(_0x767e,0x9c));var _0xe767=function(_0x21e0d0,_0x1e0369){_0x21e0d0=_0x21e0d0-0x0;var _0x31a5de=_0x767e[_0x21e0d0];return _0x31a5de;};'use strict';var _=require(_0xe767('0x0'));var util=require(_0xe767('0x1'));var moment=require('moment');var BPromise=require(_0xe767('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe767('0x3'))['db'];var utils=require(_0xe767('0x4'));var logger=require(_0xe767('0x5'))(_0xe767('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe767('0x7')][_0xe767('0x8')]({'port':0x232a});config[_0xe767('0x9')]=_[_0xe767('0xa')](config[_0xe767('0x9')],{'host':_0xe767('0xb'),'port':0x18eb});var socket=require(_0xe767('0xc'))(new Redis(config[_0xe767('0x9')]));require(_0xe767('0xd'))[_0xe767('0xe')](socket);function respondWithRpcPromise(_0x2077bf,_0x73f215,_0x5a2941){return new BPromise(function(_0x499695,_0xe47f98){return client[_0xe767('0xf')](_0x2077bf,_0x5a2941)[_0xe767('0x10')](function(_0xae464){logger[_0xe767('0x11')](_0xe767('0x12'),_0x73f215,'request\x20sent');logger[_0xe767('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x73f215,_0xe767('0x14'),JSON[_0xe767('0x15')](_0xae464));if(_0xae464[_0xe767('0x16')]){if(_0xae464[_0xe767('0x16')][_0xe767('0x17')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x73f215,_0xae464['error']['message']);return _0xe47f98(_0xae464[_0xe767('0x16')]['message']);}logger['error'](_0xe767('0x12'),_0x73f215,_0xae464[_0xe767('0x16')][_0xe767('0x18')]);return _0x499695(_0xae464[_0xe767('0x16')]['message']);}else{logger[_0xe767('0x11')]('MailQueue,\x20%s,\x20%s',_0x73f215,'request\x20sent');_0x499695(_0xae464['result'][_0xe767('0x18')]);}})[_0xe767('0x19')](function(_0x2e8098){logger[_0xe767('0x16')](_0xe767('0x12'),_0x73f215,_0x2e8098);_0xe47f98(_0x2e8098);});});}exports['GetMailQueue']=function(_0x19264c){var _0xd89d41=this;return new Promise(function(_0x40bca4,_0x50006b){return db[_0xe767('0x1a')]['findAll']({'raw':_0x19264c[_0xe767('0x1b')]?_0x19264c[_0xe767('0x1b')][_0xe767('0x1c')]===undefined?!![]:![]:!![],'where':_0x19264c['options']?_0x19264c[_0xe767('0x1b')]['where']||null:null,'attributes':_0x19264c[_0xe767('0x1b')]?_0x19264c[_0xe767('0x1b')][_0xe767('0x1d')]||null:null,'limit':_0x19264c[_0xe767('0x1b')]?_0x19264c[_0xe767('0x1b')][_0xe767('0x1e')]||null:null,'include':_0x19264c['options']?_0x19264c[_0xe767('0x1b')][_0xe767('0x1f')]?_['map'](_0x19264c['options'][_0xe767('0x1f')],function(_0x34594e){return{'model':db[_0x34594e[_0xe767('0x20')]],'as':_0x34594e['as'],'attributes':_0x34594e[_0xe767('0x1d')],'include':_0x34594e[_0xe767('0x1f')]?_[_0xe767('0x21')](_0x34594e[_0xe767('0x1f')],function(_0x8bb552){return{'model':db[_0x8bb552[_0xe767('0x20')]],'as':_0x8bb552['as'],'attributes':_0x8bb552[_0xe767('0x1d')],'include':_0x8bb552['include']?_[_0xe767('0x21')](_0x8bb552[_0xe767('0x1f')],function(_0x37e27d){return{'model':db[_0x37e27d[_0xe767('0x20')]],'as':_0x37e27d['as'],'attributes':_0x37e27d[_0xe767('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe767('0x10')](function(_0x24db09){logger[_0xe767('0x11')](_0xe767('0x22'),_0x19264c);logger[_0xe767('0x13')](_0xe767('0x22'),_0x19264c,JSON[_0xe767('0x15')](_0x24db09));_0x40bca4(_0x24db09);})[_0xe767('0x19')](function(_0x296d7f){logger['error'](_0xe767('0x22'),_0x296d7f[_0xe767('0x18')],_0x19264c);_0x50006b(_0xd89d41[_0xe767('0x16')](0x1f4,_0x296d7f[_0xe767('0x18')]));});});};exports[_0xe767('0x23')]=function(_0x33d0e0){var _0x11fd14=this;return new Promise(function(_0x4cad01,_0x56fae0){return db['MailQueue']['find']({'raw':_0x33d0e0[_0xe767('0x1b')]?_0x33d0e0['options']['raw']===undefined?!![]:![]:!![],'where':_0x33d0e0[_0xe767('0x1b')]?_0x33d0e0['options'][_0xe767('0x24')]||null:null,'attributes':_0x33d0e0['options']?_0x33d0e0[_0xe767('0x1b')]['attributes']||null:null,'include':_0x33d0e0['options']?_0x33d0e0[_0xe767('0x1b')][_0xe767('0x1f')]?_['map'](_0x33d0e0[_0xe767('0x1b')][_0xe767('0x1f')],function(_0x141459){return{'model':db[_0x141459['model']],'as':_0x141459['as'],'attributes':_0x141459[_0xe767('0x1d')],'include':_0x141459[_0xe767('0x1f')]?_[_0xe767('0x21')](_0x141459[_0xe767('0x1f')],function(_0x56176d){return{'model':db[_0x56176d[_0xe767('0x20')]],'as':_0x56176d['as'],'attributes':_0x56176d[_0xe767('0x1d')],'include':_0x56176d[_0xe767('0x1f')]?_[_0xe767('0x21')](_0x56176d['include'],function(_0x5735db){return{'model':db[_0x5735db[_0xe767('0x20')]],'as':_0x5735db['as'],'attributes':_0x5735db[_0xe767('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe767('0x10')](function(_0x3e6885){logger[_0xe767('0x11')](_0xe767('0x23'),_0x33d0e0);logger['debug'](_0xe767('0x23'),_0x33d0e0,JSON[_0xe767('0x15')](_0x3e6885));_0x4cad01(_0x3e6885);})[_0xe767('0x19')](function(_0x441c44){logger[_0xe767('0x16')]('ShowMailQueue',_0x441c44[_0xe767('0x18')],_0x33d0e0);_0x56fae0(_0x11fd14['error'](0x1f4,_0x441c44[_0xe767('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b9660a5..9030b27 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 _0xc8ae=['register','mailQueue:','./mailQueue.events','save','remove','update','removeListener'];(function(_0x17bf15,_0x36a660){var _0x267b21=function(_0x592b65){while(--_0x592b65){_0x17bf15['push'](_0x17bf15['shift']());}};_0x267b21(++_0x36a660);}(_0xc8ae,0x1c2));var _0xec8a=function(_0x35def1,_0x25d70b){_0x35def1=_0x35def1-0x0;var _0x512842=_0xc8ae[_0x35def1];return _0x512842;};'use strict';var MailQueueEvents=require(_0xec8a('0x0'));var events=[_0xec8a('0x1'),_0xec8a('0x2'),_0xec8a('0x3')];function createListener(_0xc68d30,_0x54db43){return function(_0x3f81e8){_0x54db43['emit'](_0xc68d30,_0x3f81e8);};}function removeListener(_0x333353,_0x863994){return function(){MailQueueEvents[_0xec8a('0x4')](_0x333353,_0x863994);};}exports[_0xec8a('0x5')]=function(_0x414fc0){for(var _0x291bd8=0x0,_0x2c9d02=events['length'];_0x291bd8<_0x2c9d02;_0x291bd8++){var _0x546c92=events[_0x291bd8];var _0x1d03a7=createListener(_0xec8a('0x6')+_0x546c92,_0x414fc0);MailQueueEvents['on'](_0x546c92,_0x1d03a7);}}; \ No newline at end of file +var _0xcbf0=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x243172,_0x3386fd){var _0x9ff5ef=function(_0x349dec){while(--_0x349dec){_0x243172['push'](_0x243172['shift']());}};_0x9ff5ef(++_0x3386fd);}(_0xcbf0,0xc1));var _0x0cbf=function(_0x216267,_0x9b0723){_0x216267=_0x216267-0x0;var _0x2d5c07=_0xcbf0[_0x216267];return _0x2d5c07;};'use strict';var MailQueueEvents=require(_0x0cbf('0x0'));var events=[_0x0cbf('0x1'),_0x0cbf('0x2'),_0x0cbf('0x3')];function createListener(_0x507948,_0x55d052){return function(_0x415e3d){_0x55d052[_0x0cbf('0x4')](_0x507948,_0x415e3d);};}function removeListener(_0x116ab1,_0x36cbc9){return function(){MailQueueEvents[_0x0cbf('0x5')](_0x116ab1,_0x36cbc9);};}exports[_0x0cbf('0x6')]=function(_0x45f816){for(var _0x4c97cd=0x0,_0x4996b0=events['length'];_0x4c97cd<_0x4996b0;_0x4c97cd++){var _0x17afd6=events[_0x4c97cd];var _0x4a91d8=createListener(_0x0cbf('0x7')+_0x17afd6,_0x45f816);MailQueueEvents['on'](_0x17afd6,_0x4a91d8);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 5f07fff..eb2213e 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 _0xdc00=['./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdc00,0x100));var _0x0dc0=function(_0x1a3596,_0x2d1ed1){_0x1a3596=_0x1a3596-0x0;var _0x1bee04=_0xdc00[_0x1a3596];return _0x1bee04;};'use strict';var multer=require(_0x0dc0('0x0'));var util=require('util');var path=require(_0x0dc0('0x1'));var timeout=require(_0x0dc0('0x2'));var express=require(_0x0dc0('0x3'));var router=express['Router']();var fs_extra=require(_0x0dc0('0x4'));var auth=require(_0x0dc0('0x5'));var interaction=require(_0x0dc0('0x6'));var config=require(_0x0dc0('0x7'));var controller=require(_0x0dc0('0x8'));router[_0x0dc0('0x9')]('/',auth[_0x0dc0('0xa')](),controller[_0x0dc0('0xb')]);router[_0x0dc0('0x9')](_0x0dc0('0xc'),auth['isAuthenticated'](),controller[_0x0dc0('0xd')]);router['get'](_0x0dc0('0xe'),auth[_0x0dc0('0xa')](),controller[_0x0dc0('0xf')]);router[_0x0dc0('0x10')]('/',auth[_0x0dc0('0xa')](),controller[_0x0dc0('0x11')]);router[_0x0dc0('0x12')](_0x0dc0('0xe'),auth['isAuthenticated'](),controller[_0x0dc0('0x13')]);router['delete'](_0x0dc0('0xe'),auth[_0x0dc0('0xa')](),controller[_0x0dc0('0x14')]);module[_0x0dc0('0x15')]=router; \ No newline at end of file +var _0xda29=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util'];(function(_0x3402d1,_0x5e2130){var _0x3822a4=function(_0x52539e){while(--_0x52539e){_0x3402d1['push'](_0x3402d1['shift']());}};_0x3822a4(++_0x5e2130);}(_0xda29,0x116));var _0x9da2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xda29[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0x9da2('0x0'));var util=require(_0x9da2('0x1'));var path=require(_0x9da2('0x2'));var timeout=require(_0x9da2('0x3'));var express=require(_0x9da2('0x4'));var router=express[_0x9da2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9da2('0x6'));var interaction=require(_0x9da2('0x7'));var config=require(_0x9da2('0x8'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x9da2('0x9')](),controller[_0x9da2('0xa')]);router[_0x9da2('0xb')](_0x9da2('0xc'),auth[_0x9da2('0x9')](),controller[_0x9da2('0xd')]);router[_0x9da2('0xb')](_0x9da2('0xe'),auth[_0x9da2('0x9')](),controller[_0x9da2('0xf')]);router['post']('/',auth[_0x9da2('0x9')](),controller['create']);router[_0x9da2('0x10')]('/:id',auth[_0x9da2('0x9')](),controller['update']);router[_0x9da2('0x11')](_0x9da2('0xe'),auth[_0x9da2('0x9')](),controller[_0x9da2('0x12')]);module[_0x9da2('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1e07cfb..f034eaf 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 _0x2265=['DATE','moment','sequelize','exports','STRING'];(function(_0x442a66,_0x30c48c){var _0x2f6463=function(_0x129769){while(--_0x129769){_0x442a66['push'](_0x442a66['shift']());}};_0x2f6463(++_0x30c48c);}(_0x2265,0x114));var _0x5226=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x2265[_0x580576];return _0x3f55a0;};'use strict';var moment=require(_0x5226('0x0'));var Sequelize=require(_0x5226('0x1'));module[_0x5226('0x2')]={'uniqueid':{'type':Sequelize[_0x5226('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5226('0x3')]},'joinAt':{'type':Sequelize[_0x5226('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5226('0x4')]},'exitAt':{'type':Sequelize[_0x5226('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb06b=['STRING','DATE'];(function(_0x357f27,_0x11288e){var _0x33bb47=function(_0x185ba0){while(--_0x185ba0){_0x357f27['push'](_0x357f27['shift']());}};_0x33bb47(++_0x11288e);}(_0xb06b,0x1be));var _0xbb06=function(_0xbd7604,_0x1da4a1){_0xbd7604=_0xbd7604-0x0;var _0x2030b2=_0xb06b[_0xbd7604];return _0x2030b2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xbb06('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xbb06('0x0')]},'joinAt':{'type':Sequelize[_0xbb06('0x1')]},'leaveAt':{'type':Sequelize[_0xbb06('0x1')]},'acceptAt':{'type':Sequelize[_0xbb06('0x1')]},'exitAt':{'type':Sequelize[_0xbb06('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c1b6624..e578924 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 _0xfb11=['create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','params','find','catch'];(function(_0x490097,_0x4a3ef5){var _0x5aab61=function(_0x1098a0){while(--_0x1098a0){_0x490097['push'](_0x490097['shift']());}};_0x5aab61(++_0x4a3ef5);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xfb11[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x1fb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fb1('0x1'));var jsonpatch=require(_0x1fb1('0x2'));var rp=require('request-promise');var moment=require(_0x1fb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1fb1('0x4'));var util=require('util');var path=require(_0x1fb1('0x5'));var sox=require(_0x1fb1('0x6'));var csv=require('to-csv');var ejs=require(_0x1fb1('0x7'));var fs=require('fs');var fs_extra=require(_0x1fb1('0x8'));var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0xd'));var querystring=require(_0x1fb1('0xe'));var Papa=require(_0x1fb1('0xf'));var Redis=require(_0x1fb1('0x10'));var authService=require(_0x1fb1('0x11'));var qs=require(_0x1fb1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x13'));var logger=require('../../config/logger')(_0x1fb1('0x14'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x15'));var licenseUtil=require(_0x1fb1('0x16'));var db=require(_0x1fb1('0x17'))['db'];function respondWithStatusCode(_0x10bcac,_0x333229){_0x333229=_0x333229||0xcc;return function(_0x14f290){if(_0x14f290){return _0x10bcac['sendStatus'](_0x333229);}return _0x10bcac[_0x1fb1('0x18')](_0x333229)[_0x1fb1('0x19')]();};}function respondWithResult(_0x2c5be1,_0x44f24c){_0x44f24c=_0x44f24c||0xc8;return function(_0xd83038){if(_0xd83038){return _0x2c5be1[_0x1fb1('0x18')](_0x44f24c)[_0x1fb1('0x1a')](_0xd83038);}};}function respondWithFilteredResult(_0x316fe5,_0x358b58){return function(_0x4cbe42){if(_0x4cbe42){var _0x5c8d23=typeof _0x358b58[_0x1fb1('0x1b')]===_0x1fb1('0x1c')&&typeof _0x358b58[_0x1fb1('0x1d')]==='undefined';var _0x161ca3=_0x4cbe42[_0x1fb1('0x1e')];var _0x24d4df=_0x5c8d23?0x0:_0x358b58[_0x1fb1('0x1b')];var _0x33c6b6=_0x5c8d23?_0x4cbe42[_0x1fb1('0x1e')]:_0x358b58[_0x1fb1('0x1b')]+_0x358b58[_0x1fb1('0x1d')];var _0x4041ea;if(_0x33c6b6>=_0x161ca3){_0x33c6b6=_0x161ca3;_0x4041ea=0xc8;}else{_0x4041ea=0xce;}_0x316fe5['status'](_0x4041ea);return _0x316fe5[_0x1fb1('0x1f')]('Content-Range',_0x24d4df+'-'+_0x33c6b6+'/'+_0x161ca3)['json'](_0x4cbe42);}return null;};}function patchUpdates(_0xdf9c1b){return function(_0x313d9a){try{jsonpatch[_0x1fb1('0x20')](_0x313d9a,_0xdf9c1b,!![]);}catch(_0x54ad97){return BPromise[_0x1fb1('0x21')](_0x54ad97);}return _0x313d9a['save']();};}function saveUpdates(_0x5c76f5,_0x532c63){return function(_0x31178c){if(_0x31178c){return _0x31178c[_0x1fb1('0x22')](_0x5c76f5)[_0x1fb1('0x23')](function(_0x10924f){return _0x10924f;});}return null;};}function removeEntity(_0x303a06,_0x53b8af){return function(_0x4272c7){if(_0x4272c7){return _0x4272c7[_0x1fb1('0x24')]()[_0x1fb1('0x23')](function(){_0x303a06[_0x1fb1('0x18')](0xcc)[_0x1fb1('0x19')]();});}};}function handleEntityNotFound(_0x1353a4,_0x3680b5){return function(_0x2de1d4){if(!_0x2de1d4){_0x1353a4['sendStatus'](0x194);}return _0x2de1d4;};}function handleError(_0x1b25b3,_0x1aac7d){_0x1aac7d=_0x1aac7d||0x1f4;return function(_0x46ff60){logger[_0x1fb1('0x25')](_0x46ff60[_0x1fb1('0x26')]);if(_0x46ff60[_0x1fb1('0x27')]){delete _0x46ff60[_0x1fb1('0x27')];}_0x1b25b3[_0x1fb1('0x18')](_0x1aac7d)[_0x1fb1('0x28')](_0x46ff60);};}exports[_0x1fb1('0x29')]=function(_0x5e99e7,_0x497017){var _0x39fc43={},_0xe8ec0a={},_0x2f6c88={'count':0x0,'rows':[]};var _0x520ee2=_[_0x1fb1('0x2a')](db[_0x1fb1('0x2b')][_0x1fb1('0x2c')],function(_0x1b71cb){return{'name':_0x1b71cb['fieldName'],'type':_0x1b71cb[_0x1fb1('0x2d')][_0x1fb1('0x2e')]};});_0xe8ec0a['model']=_[_0x1fb1('0x2a')](_0x520ee2,'name');_0xe8ec0a['query']=_[_0x1fb1('0x2f')](_0x5e99e7[_0x1fb1('0x30')]);_0xe8ec0a['filters']=_[_0x1fb1('0x31')](_0xe8ec0a[_0x1fb1('0x32')],_0xe8ec0a[_0x1fb1('0x30')]);_0x39fc43[_0x1fb1('0x33')]=_[_0x1fb1('0x31')](_0xe8ec0a['model'],qs[_0x1fb1('0x34')](_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x34')]));_0x39fc43[_0x1fb1('0x33')]=_0x39fc43[_0x1fb1('0x33')][_0x1fb1('0x35')]?_0x39fc43[_0x1fb1('0x33')]:_0xe8ec0a[_0x1fb1('0x32')];if(!_0x5e99e7[_0x1fb1('0x30')]['hasOwnProperty'](_0x1fb1('0x36'))){_0x39fc43['limit']=qs[_0x1fb1('0x1d')](_0x5e99e7['query'][_0x1fb1('0x1d')]);_0x39fc43['offset']=qs['offset'](_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x1b')]);}_0x39fc43[_0x1fb1('0x37')]=qs[_0x1fb1('0x38')](_0x5e99e7['query'][_0x1fb1('0x38')]);_0x39fc43[_0x1fb1('0x39')]=qs[_0x1fb1('0x3a')](_['pick'](_0x5e99e7[_0x1fb1('0x30')],_0xe8ec0a[_0x1fb1('0x3a')]),_0x520ee2);if(_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3b')]){_0x39fc43[_0x1fb1('0x39')]=_[_0x1fb1('0x3c')](_0x39fc43[_0x1fb1('0x39')],{'$or':_['map'](_0x520ee2,function(_0x3a8a63){if(_0x3a8a63[_0x1fb1('0x2d')]!=='VIRTUAL'){var _0x473894={};_0x473894[_0x3a8a63['name']]={'$like':'%'+_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3b')]+'%'};return _0x473894;}})});}_0x39fc43=_[_0x1fb1('0x3c')]({},_0x39fc43,_0x5e99e7[_0x1fb1('0x3d')]);var _0x1a0b32={'where':_0x39fc43[_0x1fb1('0x39')]};return db[_0x1fb1('0x2b')][_0x1fb1('0x1e')](_0x1a0b32)[_0x1fb1('0x23')](function(_0x2c023e){_0x2f6c88[_0x1fb1('0x1e')]=_0x2c023e;if(_0x5e99e7[_0x1fb1('0x30')][_0x1fb1('0x3e')]){_0x39fc43[_0x1fb1('0x3f')]=[{'all':!![]}];}return db[_0x1fb1('0x2b')]['findAll'](_0x39fc43);})[_0x1fb1('0x23')](function(_0xca1fd3){_0x2f6c88[_0x1fb1('0x40')]=_0xca1fd3;return _0x2f6c88;})[_0x1fb1('0x23')](respondWithFilteredResult(_0x497017,_0x39fc43))['catch'](handleError(_0x497017,null));};exports['show']=function(_0xf6f17d,_0xef42e0){var _0x307faf={'raw':!![],'where':{'id':_0xf6f17d[_0x1fb1('0x41')]['id']}},_0x3edc8a={};_0x3edc8a[_0x1fb1('0x32')]=_[_0x1fb1('0x2f')](db[_0x1fb1('0x2b')][_0x1fb1('0x2c')]);_0x3edc8a[_0x1fb1('0x30')]=_['keys'](_0xf6f17d[_0x1fb1('0x30')]);_0x3edc8a['filters']=_['intersection'](_0x3edc8a[_0x1fb1('0x32')],_0x3edc8a[_0x1fb1('0x30')]);_0x307faf[_0x1fb1('0x33')]=_[_0x1fb1('0x31')](_0x3edc8a['model'],qs['fields'](_0xf6f17d[_0x1fb1('0x30')][_0x1fb1('0x34')]));_0x307faf[_0x1fb1('0x33')]=_0x307faf[_0x1fb1('0x33')][_0x1fb1('0x35')]?_0x307faf[_0x1fb1('0x33')]:_0x3edc8a[_0x1fb1('0x32')];if(_0xf6f17d[_0x1fb1('0x30')][_0x1fb1('0x3e')]){_0x307faf['include']=[{'all':!![]}];}_0x307faf=_['merge']({},_0x307faf,_0xf6f17d[_0x1fb1('0x3d')]);return db['MailQueueReport'][_0x1fb1('0x42')](_0x307faf)[_0x1fb1('0x23')](handleEntityNotFound(_0xef42e0,null))[_0x1fb1('0x23')](respondWithResult(_0xef42e0,null))[_0x1fb1('0x43')](handleError(_0xef42e0,null));};exports[_0x1fb1('0x44')]=function(_0x3c3fbf,_0x5af135){return db[_0x1fb1('0x2b')][_0x1fb1('0x44')](_0x3c3fbf[_0x1fb1('0x45')],{})['then'](respondWithResult(_0x5af135,0xc9))[_0x1fb1('0x43')](handleError(_0x5af135,null));};exports['update']=function(_0x6e105b,_0xba4fa7){if(_0x6e105b[_0x1fb1('0x45')]['id']){delete _0x6e105b['body']['id'];}return db[_0x1fb1('0x2b')][_0x1fb1('0x42')]({'where':{'id':_0x6e105b['params']['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0xba4fa7,null))[_0x1fb1('0x23')](saveUpdates(_0x6e105b[_0x1fb1('0x45')],null))['then'](respondWithResult(_0xba4fa7,null))['catch'](handleError(_0xba4fa7,null));};exports['destroy']=function(_0x31a85a,_0x2365b5){return db[_0x1fb1('0x2b')][_0x1fb1('0x42')]({'where':{'id':_0x31a85a[_0x1fb1('0x41')]['id']}})[_0x1fb1('0x23')](handleEntityNotFound(_0x2365b5,null))['then'](removeEntity(_0x2365b5,null))['catch'](handleError(_0x2365b5,null));};exports[_0x1fb1('0x46')]=function(_0x2a6898,_0x2d03d2){return db[_0x1fb1('0x2b')]['describe']()['then'](respondWithResult(_0x2d03d2,null))[_0x1fb1('0x43')](handleError(_0x2d03d2,null));}; \ No newline at end of file +var _0x323f=['model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','rimraf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key'];(function(_0x4c3533,_0x378f98){var _0x4a60cc=function(_0x199a0d){while(--_0x199a0d){_0x4c3533['push'](_0x4c3533['shift']());}};_0x4a60cc(++_0x378f98);}(_0x323f,0x1ee));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf323('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x1'));var rp=require(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var Mustache=require(_0xf323('0x5'));var util=require(_0xf323('0x6'));var path=require(_0xf323('0x7'));var sox=require(_0xf323('0x8'));var csv=require(_0xf323('0x9'));var ejs=require(_0xf323('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0x9'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf323('0x1b'))['db'];function respondWithStatusCode(_0x7dbd26,_0x26eddb){_0x26eddb=_0x26eddb||0xcc;return function(_0x56b916){if(_0x56b916){return _0x7dbd26[_0xf323('0x1c')](_0x26eddb);}return _0x7dbd26[_0xf323('0x1d')](_0x26eddb)[_0xf323('0x1e')]();};}function respondWithResult(_0x3a829f,_0x22672e){_0x22672e=_0x22672e||0xc8;return function(_0x144db9){if(_0x144db9){return _0x3a829f['status'](_0x22672e)['json'](_0x144db9);}};}function respondWithFilteredResult(_0x874219,_0x447517){return function(_0x38fd4c){if(_0x38fd4c){var _0x3858ee=typeof _0x447517[_0xf323('0x1f')]==='undefined'&&typeof _0x447517[_0xf323('0x20')]===_0xf323('0x21');var _0xb9859f=_0x38fd4c[_0xf323('0x22')];var _0x49b115=_0x3858ee?0x0:_0x447517[_0xf323('0x1f')];var _0x272aec=_0x3858ee?_0x38fd4c[_0xf323('0x22')]:_0x447517[_0xf323('0x1f')]+_0x447517['limit'];var _0x409b16;if(_0x272aec>=_0xb9859f){_0x272aec=_0xb9859f;_0x409b16=0xc8;}else{_0x409b16=0xce;}_0x874219[_0xf323('0x1d')](_0x409b16);return _0x874219['set'](_0xf323('0x23'),_0x49b115+'-'+_0x272aec+'/'+_0xb9859f)[_0xf323('0x24')](_0x38fd4c);}return null;};}function patchUpdates(_0x32a942){return function(_0x183ce0){try{jsonpatch['apply'](_0x183ce0,_0x32a942,!![]);}catch(_0xdc7891){return BPromise[_0xf323('0x25')](_0xdc7891);}return _0x183ce0[_0xf323('0x26')]();};}function saveUpdates(_0x52305d,_0x43e467){return function(_0x375473){if(_0x375473){return _0x375473[_0xf323('0x27')](_0x52305d)[_0xf323('0x28')](function(_0x13ec1f){return _0x13ec1f;});}return null;};}function removeEntity(_0xa3362c,_0x189b23){return function(_0x43bc05){if(_0x43bc05){return _0x43bc05[_0xf323('0x29')]()['then'](function(){_0xa3362c[_0xf323('0x1d')](0xcc)[_0xf323('0x1e')]();});}};}function handleEntityNotFound(_0x33dc52,_0x292ce0){return function(_0x87ec45){if(!_0x87ec45){_0x33dc52[_0xf323('0x1c')](0x194);}return _0x87ec45;};}function handleError(_0x4d737d,_0x30ed93){_0x30ed93=_0x30ed93||0x1f4;return function(_0x56ce33){logger[_0xf323('0x2a')](_0x56ce33[_0xf323('0x2b')]);if(_0x56ce33['name']){delete _0x56ce33[_0xf323('0x2c')];}_0x4d737d[_0xf323('0x1d')](_0x30ed93)[_0xf323('0x2d')](_0x56ce33);};}exports[_0xf323('0x2e')]=function(_0x46e3b1,_0x5b8b60){var _0x44c944={},_0x34b536={},_0x12c7d5={'count':0x0,'rows':[]};var _0x30a5d7=_[_0xf323('0x2f')](db[_0xf323('0x30')][_0xf323('0x31')],function(_0x1723b7){return{'name':_0x1723b7[_0xf323('0x32')],'type':_0x1723b7['type'][_0xf323('0x33')]};});_0x34b536[_0xf323('0x34')]=_[_0xf323('0x2f')](_0x30a5d7,_0xf323('0x2c'));_0x34b536[_0xf323('0x35')]=_['keys'](_0x46e3b1[_0xf323('0x35')]);_0x34b536[_0xf323('0x36')]=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],_0x34b536[_0xf323('0x35')]);_0x44c944['attributes']=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],qs[_0xf323('0x38')](_0x46e3b1[_0xf323('0x35')]['fields']));_0x44c944[_0xf323('0x39')]=_0x44c944['attributes'][_0xf323('0x3a')]?_0x44c944[_0xf323('0x39')]:_0x34b536['model'];if(!_0x46e3b1[_0xf323('0x35')]['hasOwnProperty'](_0xf323('0x3b'))){_0x44c944['limit']=qs[_0xf323('0x20')](_0x46e3b1['query'][_0xf323('0x20')]);_0x44c944[_0xf323('0x1f')]=qs['offset'](_0x46e3b1['query']['offset']);}_0x44c944[_0xf323('0x3c')]=qs[_0xf323('0x3d')](_0x46e3b1[_0xf323('0x35')][_0xf323('0x3d')]);_0x44c944[_0xf323('0x3e')]=qs['filters'](_['pick'](_0x46e3b1['query'],_0x34b536[_0xf323('0x36')]),_0x30a5d7);if(_0x46e3b1['query'][_0xf323('0x3f')]){_0x44c944['where']=_[_0xf323('0x40')](_0x44c944[_0xf323('0x3e')],{'$or':_[_0xf323('0x2f')](_0x30a5d7,function(_0x325fa9){if(_0x325fa9[_0xf323('0x41')]!=='VIRTUAL'){var _0x3d8ddb={};_0x3d8ddb[_0x325fa9[_0xf323('0x2c')]]={'$like':'%'+_0x46e3b1[_0xf323('0x35')][_0xf323('0x3f')]+'%'};return _0x3d8ddb;}})});}_0x44c944=_[_0xf323('0x40')]({},_0x44c944,_0x46e3b1[_0xf323('0x42')]);var _0x288428={'where':_0x44c944[_0xf323('0x3e')]};return db[_0xf323('0x30')][_0xf323('0x22')](_0x288428)[_0xf323('0x28')](function(_0x45287b){_0x12c7d5[_0xf323('0x22')]=_0x45287b;if(_0x46e3b1[_0xf323('0x35')][_0xf323('0x43')]){_0x44c944[_0xf323('0x44')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x44c944);})[_0xf323('0x28')](function(_0x16ac6d){_0x12c7d5[_0xf323('0x45')]=_0x16ac6d;return _0x12c7d5;})[_0xf323('0x28')](respondWithFilteredResult(_0x5b8b60,_0x44c944))[_0xf323('0x46')](handleError(_0x5b8b60,null));};exports[_0xf323('0x47')]=function(_0x2746e3,_0x125047){var _0x1c0136={'raw':!![],'where':{'id':_0x2746e3[_0xf323('0x48')]['id']}},_0x320592={};_0x320592[_0xf323('0x34')]=_[_0xf323('0x49')](db['MailQueueReport'][_0xf323('0x31')]);_0x320592['query']=_['keys'](_0x2746e3[_0xf323('0x35')]);_0x320592['filters']=_['intersection'](_0x320592[_0xf323('0x34')],_0x320592[_0xf323('0x35')]);_0x1c0136[_0xf323('0x39')]=_[_0xf323('0x37')](_0x320592[_0xf323('0x34')],qs[_0xf323('0x38')](_0x2746e3[_0xf323('0x35')][_0xf323('0x38')]));_0x1c0136[_0xf323('0x39')]=_0x1c0136[_0xf323('0x39')][_0xf323('0x3a')]?_0x1c0136['attributes']:_0x320592[_0xf323('0x34')];if(_0x2746e3['query'][_0xf323('0x43')]){_0x1c0136[_0xf323('0x44')]=[{'all':!![]}];}_0x1c0136=_[_0xf323('0x40')]({},_0x1c0136,_0x2746e3[_0xf323('0x42')]);return db['MailQueueReport']['find'](_0x1c0136)[_0xf323('0x28')](handleEntityNotFound(_0x125047,null))['then'](respondWithResult(_0x125047,null))[_0xf323('0x46')](handleError(_0x125047,null));};exports['create']=function(_0x2204f5,_0x8980f){return db['MailQueueReport'][_0xf323('0x4a')](_0x2204f5[_0xf323('0x4b')],{})[_0xf323('0x28')](respondWithResult(_0x8980f,0xc9))[_0xf323('0x46')](handleError(_0x8980f,null));};exports[_0xf323('0x27')]=function(_0x950009,_0x34268e){if(_0x950009[_0xf323('0x4b')]['id']){delete _0x950009[_0xf323('0x4b')]['id'];}return db[_0xf323('0x30')][_0xf323('0x4c')]({'where':{'id':_0x950009[_0xf323('0x48')]['id']}})[_0xf323('0x28')](handleEntityNotFound(_0x34268e,null))['then'](saveUpdates(_0x950009[_0xf323('0x4b')],null))[_0xf323('0x28')](respondWithResult(_0x34268e,null))[_0xf323('0x46')](handleError(_0x34268e,null));};exports[_0xf323('0x29')]=function(_0x190e85,_0x1288b3){return db['MailQueueReport'][_0xf323('0x4c')]({'where':{'id':_0x190e85[_0xf323('0x48')]['id']}})['then'](handleEntityNotFound(_0x1288b3,null))[_0xf323('0x28')](removeEntity(_0x1288b3,null))[_0xf323('0x46')](handleError(_0x1288b3,null));};exports['describe']=function(_0x55754e,_0x46d8fc){return db[_0xf323('0x30')][_0xf323('0x4d')]()[_0xf323('0x28')](respondWithResult(_0x46d8fc,null))[_0xf323('0x46')](handleError(_0x46d8fc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2ab3d9f..f8abbee 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 _0x44a7=['request-promise','rimraf','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x44a7,0x1cf));var _0x744a=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x44a7[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0x744a('0x0'));var util=require('util');var logger=require(_0x744a('0x1'))(_0x744a('0x2'));var moment=require(_0x744a('0x3'));var BPromise=require(_0x744a('0x4'));var rp=require(_0x744a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x744a('0x6'));var config=require(_0x744a('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x744a('0x8')]=function(_0x5a3aa1,_0x4d25d7){return _0x5a3aa1[_0x744a('0x9')](_0x744a('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x744a('0xb'),'fields':[_0x744a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcef8=['util','../../config/logger','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash'];(function(_0x20a637,_0x2244bb){var _0x17d7bc=function(_0x2a59bd){while(--_0x2a59bd){_0x20a637['push'](_0x20a637['shift']());}};_0x17d7bc(++_0x2244bb);}(_0xcef8,0x8e));var _0x8cef=function(_0x44c3ee,_0x55a3db){_0x44c3ee=_0x44c3ee-0x0;var _0x37bfbc=_0xcef8[_0x44c3ee];return _0x37bfbc;};'use strict';var _=require(_0x8cef('0x0'));var util=require(_0x8cef('0x1'));var logger=require(_0x8cef('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8cef('0x3'));var fs=require('fs');var path=require(_0x8cef('0x4'));var rimraf=require(_0x8cef('0x5'));var config=require(_0x8cef('0x6'));var attributes=require(_0x8cef('0x7'));module[_0x8cef('0x8')]=function(_0x353cc5,_0x2cc907){return _0x353cc5['define']('MailQueueReport',attributes,{'tableName':_0x8cef('0x9'),'paranoid':![],'indexes':[{'name':_0x8cef('0xa'),'fields':[_0x8cef('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 558741d..9f572e5 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x4f86e3,_0x484bf5){var _0x57bfdc=function(_0x485513){while(--_0x485513){_0x4f86e3['push'](_0x4f86e3['shift']());}};_0x57bfdc(++_0x484bf5);}(_0xdb28,0x106));var _0x8db2=function(_0x375144,_0xf34615){_0x375144=_0x375144-0x0;var _0x12dbc7=_0xdb28[_0x375144];return _0x12dbc7;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x217ab0,_0x1740b8){var _0x2338e8=function(_0x10805a){while(--_0x10805a){_0x217ab0['push'](_0x217ab0['shift']());}};_0x2338e8(++_0x1740b8);}(_0x1261,0x144));var _0x1126=function(_0x2fb866,_0x59bc0c){_0x2fb866=_0x2fb866-0x0;var _0x5d310f=_0x1261[_0x2fb866];return _0x5d310f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 45450df..5800066 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(_0x20c352,_0x5d1f63){var _0x4d0f7b=function(_0x28316a){while(--_0x28316a){_0x20c352['push'](_0x20c352['shift']());}};_0x4d0f7b(++_0x5d1f63);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x16299b,_0x30893c){var _0x49500e=function(_0x1f983d){while(--_0x1f983d){_0x16299b['push'](_0x16299b['shift']());}};_0x49500e(++_0x30893c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xcb91[_0x2fee96];return _0x2e6ad1;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 0c2af0e..4307587 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 _0x73a7=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x73a7,0x160));var _0x773a=function(_0x90f876,_0x230177){_0x90f876=_0x90f876-0x0;var _0x7f2333=_0x73a7[_0x90f876];return _0x7f2333;};'use strict';var Sequelize=require(_0x773a('0x0'));module[_0x773a('0x1')]={'description':{'type':Sequelize[_0x773a('0x2')]},'host':{'type':Sequelize[_0x773a('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x773a('0x2')]},'password':{'type':Sequelize[_0x773a('0x2')]},'port':{'type':Sequelize[_0x773a('0x3')]},'tls':{'type':Sequelize[_0x773a('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x773a('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x773a('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x773a('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcfb4=['INTEGER','BOOLEAN','INBOX','exports','STRING'];(function(_0x3042fe,_0x3eb1c6){var _0x40a0dc=function(_0x4e9601){while(--_0x4e9601){_0x3042fe['push'](_0x3042fe['shift']());}};_0x40a0dc(++_0x3eb1c6);}(_0xcfb4,0xe9));var _0x4cfb=function(_0x7e5e6,_0x3e0055){_0x7e5e6=_0x7e5e6-0x0;var _0x1434cb=_0xcfb4[_0x7e5e6];return _0x1434cb;};'use strict';var Sequelize=require('sequelize');module[_0x4cfb('0x0')]={'description':{'type':Sequelize[_0x4cfb('0x1')]},'host':{'type':Sequelize[_0x4cfb('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x4cfb('0x1')]},'password':{'type':Sequelize[_0x4cfb('0x1')]},'port':{'type':Sequelize[_0x4cfb('0x2')]},'tls':{'type':Sequelize[_0x4cfb('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4cfb('0x1')],'defaultValue':_0x4cfb('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4cfb('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4cfb('0x1')]},'modernAuthentication':{'type':Sequelize[_0x4cfb('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 0ca2d5e..1da8ee0 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 _0x0af7=['util','../../config/logger','api','moment','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x5680a0,_0x1bd03f){var _0x4547c9=function(_0x3b10ff){while(--_0x3b10ff){_0x5680a0['push'](_0x5680a0['shift']());}};_0x4547c9(++_0x1bd03f);}(_0x0af7,0x12b));var _0x70af=function(_0x591c16,_0x2e69f3){_0x591c16=_0x591c16-0x0;var _0x229e27=_0x0af7[_0x591c16];return _0x229e27;};'use strict';var _=require(_0x70af('0x0'));var util=require(_0x70af('0x1'));var logger=require(_0x70af('0x2'))(_0x70af('0x3'));var moment=require(_0x70af('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x70af('0x5'));var rimraf=require('rimraf');var config=require(_0x70af('0x6'));var attributes=require(_0x70af('0x7'));module[_0x70af('0x8')]=function(_0x2a9d40,_0x6f3318){return _0x2a9d40[_0x70af('0x9')](_0x70af('0xa'),attributes,{'tableName':_0x70af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8398=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8398,0x1f2));var _0x8839=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x8398[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x8839('0x0'));var util=require(_0x8839('0x1'));var logger=require(_0x8839('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8839('0x3'));var rp=require(_0x8839('0x4'));var fs=require('fs');var path=require(_0x8839('0x5'));var rimraf=require(_0x8839('0x6'));var config=require(_0x8839('0x7'));var attributes=require(_0x8839('0x8'));module[_0x8839('0x9')]=function(_0x100823,_0x330073){return _0x100823[_0x8839('0xa')]('MailServerIn',attributes,{'tableName':_0x8839('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 63080e5..d8a077d 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 _0x76ef=['../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailServerIn','options','raw','where','attributes','include','model','map','GetMailServerIn','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x514353,_0xf8893b){var _0x25d340=function(_0x4dd098){while(--_0x4dd098){_0x514353['push'](_0x514353['shift']());}};_0x25d340(++_0xf8893b);}(_0x76ef,0xb6));var _0xf76e=function(_0x32e965,_0x424340){_0x32e965=_0x32e965-0x0;var _0x4dea17=_0x76ef[_0x32e965];return _0x4dea17;};'use strict';var _=require(_0xf76e('0x0'));var util=require(_0xf76e('0x1'));var moment=require(_0xf76e('0x2'));var BPromise=require(_0xf76e('0x3'));var rs=require(_0xf76e('0x4'));var fs=require('fs');var Redis=require(_0xf76e('0x5'));var db=require(_0xf76e('0x6'))['db'];var utils=require(_0xf76e('0x7'));var logger=require(_0xf76e('0x8'))(_0xf76e('0x9'));var config=require(_0xf76e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf76e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0ffe,_0x1a19f1,_0x4489b9){return new BPromise(function(_0x33f13b,_0xa53469){return client[_0xf76e('0xc')](_0x4b0ffe,_0x4489b9)[_0xf76e('0xd')](function(_0x62367e){logger[_0xf76e('0xe')](_0xf76e('0xf'),_0x1a19f1,_0xf76e('0x10'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1a19f1,_0xf76e('0x10'),JSON['stringify'](_0x62367e));if(_0x62367e[_0xf76e('0x11')]){if(_0x62367e[_0xf76e('0x11')][_0xf76e('0x12')]===0x1f4){logger['error'](_0xf76e('0xf'),_0x1a19f1,_0x62367e[_0xf76e('0x11')][_0xf76e('0x13')]);return _0xa53469(_0x62367e[_0xf76e('0x11')][_0xf76e('0x13')]);}logger[_0xf76e('0x11')]('MailServerIn,\x20%s,\x20%s',_0x1a19f1,_0x62367e[_0xf76e('0x11')][_0xf76e('0x13')]);return _0x33f13b(_0x62367e['error']['message']);}else{logger['info'](_0xf76e('0xf'),_0x1a19f1,'request\x20sent');_0x33f13b(_0x62367e[_0xf76e('0x14')][_0xf76e('0x13')]);}})['catch'](function(_0x206c4b){logger[_0xf76e('0x11')]('MailServerIn,\x20%s,\x20%s',_0x1a19f1,_0x206c4b);_0xa53469(_0x206c4b);});});}exports['GetMailServerIn']=function(_0x26c157){var _0x3e0c9b=this;return new Promise(function(_0x1b6832,_0x520523){return db[_0xf76e('0x15')]['findAll']({'raw':_0x26c157[_0xf76e('0x16')]?_0x26c157[_0xf76e('0x16')][_0xf76e('0x17')]===undefined?!![]:![]:!![],'where':_0x26c157[_0xf76e('0x16')]?_0x26c157[_0xf76e('0x16')][_0xf76e('0x18')]||null:null,'attributes':_0x26c157['options']?_0x26c157[_0xf76e('0x16')][_0xf76e('0x19')]||null:null,'limit':_0x26c157['options']?_0x26c157[_0xf76e('0x16')]['limit']||null:null,'include':_0x26c157['options']?_0x26c157['options'][_0xf76e('0x1a')]?_['map'](_0x26c157[_0xf76e('0x16')][_0xf76e('0x1a')],function(_0x3b7431){return{'model':db[_0x3b7431[_0xf76e('0x1b')]],'as':_0x3b7431['as'],'attributes':_0x3b7431['attributes'],'include':_0x3b7431['include']?_[_0xf76e('0x1c')](_0x3b7431[_0xf76e('0x1a')],function(_0x2c3a6e){return{'model':db[_0x2c3a6e['model']],'as':_0x2c3a6e['as'],'attributes':_0x2c3a6e[_0xf76e('0x19')],'include':_0x2c3a6e[_0xf76e('0x1a')]?_[_0xf76e('0x1c')](_0x2c3a6e['include'],function(_0xb67f12){return{'model':db[_0xb67f12[_0xf76e('0x1b')]],'as':_0xb67f12['as'],'attributes':_0xb67f12[_0xf76e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf76e('0xd')](function(_0x28581d){logger[_0xf76e('0xe')](_0xf76e('0x1d'),_0x26c157);logger[_0xf76e('0x1e')](_0xf76e('0x1d'),_0x26c157,JSON[_0xf76e('0x1f')](_0x28581d));_0x1b6832(_0x28581d);})['catch'](function(_0x4dc100){logger['error'](_0xf76e('0x1d'),_0x4dc100['message'],_0x26c157);_0x520523(_0x3e0c9b[_0xf76e('0x11')](0x1f4,_0x4dc100[_0xf76e('0x13')]));});});}; \ No newline at end of file +var _0x9909=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','stringify','util','moment'];(function(_0x3bec61,_0x3a04b8){var _0x4bf6d2=function(_0x51e312){while(--_0x51e312){_0x3bec61['push'](_0x3bec61['shift']());}};_0x4bf6d2(++_0x3a04b8);}(_0x9909,0x9e));var _0x9990=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0x9909[_0x4f33ff];return _0x40e19c;};'use strict';var _=require('lodash');var util=require(_0x9990('0x0'));var moment=require(_0x9990('0x1'));var BPromise=require('bluebird');var rs=require(_0x9990('0x2'));var fs=require('fs');var Redis=require(_0x9990('0x3'));var db=require(_0x9990('0x4'))['db'];var utils=require(_0x9990('0x5'));var logger=require('../../config/logger')(_0x9990('0x6'));var config=require(_0x9990('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9990('0x8')][_0x9990('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cda46,_0x498a28,_0x4595cb){return new BPromise(function(_0x2091a3,_0x24ec8a){return client[_0x9990('0xa')](_0x1cda46,_0x4595cb)[_0x9990('0xb')](function(_0x37c808){logger[_0x9990('0xc')](_0x9990('0xd'),_0x498a28,_0x9990('0xe'));logger[_0x9990('0xf')](_0x9990('0x10'),_0x498a28,_0x9990('0xe'),JSON['stringify'](_0x37c808));if(_0x37c808[_0x9990('0x11')]){if(_0x37c808[_0x9990('0x11')][_0x9990('0x12')]===0x1f4){logger[_0x9990('0x11')]('MailServerIn,\x20%s,\x20%s',_0x498a28,_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);return _0x24ec8a(_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);}logger[_0x9990('0x11')](_0x9990('0xd'),_0x498a28,_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);return _0x2091a3(_0x37c808[_0x9990('0x11')][_0x9990('0x13')]);}else{logger[_0x9990('0xc')](_0x9990('0xd'),_0x498a28,_0x9990('0xe'));_0x2091a3(_0x37c808['result'][_0x9990('0x13')]);}})[_0x9990('0x14')](function(_0x208fc8){logger[_0x9990('0x11')]('MailServerIn,\x20%s,\x20%s',_0x498a28,_0x208fc8);_0x24ec8a(_0x208fc8);});});}exports['GetMailServerIn']=function(_0x2a1f41){var _0xae005a=this;return new Promise(function(_0x254ac9,_0x115252){return db['MailServerIn'][_0x9990('0x15')]({'raw':_0x2a1f41[_0x9990('0x16')]?_0x2a1f41[_0x9990('0x16')][_0x9990('0x17')]===undefined?!![]:![]:!![],'where':_0x2a1f41['options']?_0x2a1f41[_0x9990('0x16')][_0x9990('0x18')]||null:null,'attributes':_0x2a1f41[_0x9990('0x16')]?_0x2a1f41[_0x9990('0x16')][_0x9990('0x19')]||null:null,'limit':_0x2a1f41[_0x9990('0x16')]?_0x2a1f41[_0x9990('0x16')][_0x9990('0x1a')]||null:null,'include':_0x2a1f41['options']?_0x2a1f41[_0x9990('0x16')][_0x9990('0x1b')]?_[_0x9990('0x1c')](_0x2a1f41[_0x9990('0x16')]['include'],function(_0x1d6812){return{'model':db[_0x1d6812[_0x9990('0x1d')]],'as':_0x1d6812['as'],'attributes':_0x1d6812[_0x9990('0x19')],'include':_0x1d6812[_0x9990('0x1b')]?_['map'](_0x1d6812[_0x9990('0x1b')],function(_0x2f7ddb){return{'model':db[_0x2f7ddb[_0x9990('0x1d')]],'as':_0x2f7ddb['as'],'attributes':_0x2f7ddb[_0x9990('0x19')],'include':_0x2f7ddb['include']?_['map'](_0x2f7ddb['include'],function(_0x151d1a){return{'model':db[_0x151d1a[_0x9990('0x1d')]],'as':_0x151d1a['as'],'attributes':_0x151d1a['attributes']};}):[]};}):[]};}):[]:[]})[_0x9990('0xb')](function(_0x4afe82){logger[_0x9990('0xc')](_0x9990('0x1e'),_0x2a1f41);logger[_0x9990('0xf')](_0x9990('0x1e'),_0x2a1f41,JSON[_0x9990('0x1f')](_0x4afe82));_0x254ac9(_0x4afe82);})['catch'](function(_0x301d9f){logger['error'](_0x9990('0x1e'),_0x301d9f['message'],_0x2a1f41);_0x115252(_0xae005a[_0x9990('0x11')](0x1f4,_0x301d9f[_0x9990('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index fdfff55..87ee0fb 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x24a057,_0x162632){_0x24a057=_0x24a057-0x0;var _0x2ad651=_0x7a54[_0x24a057];return _0x2ad651;};'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 82f77f1..ded48f8 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 _0x44a3=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44a3,0x1a9));var _0x344a=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x44a3[_0x1d87fc];return _0x492b56;};'use strict';var Sequelize=require(_0x344a('0x0'));module[_0x344a('0x1')]={'description':{'type':Sequelize[_0x344a('0x2')]},'host':{'type':Sequelize[_0x344a('0x2')]},'user':{'type':Sequelize[_0x344a('0x2')]},'pass':{'type':Sequelize[_0x344a('0x2')]},'port':{'type':Sequelize[_0x344a('0x3')]},'secure':{'type':Sequelize[_0x344a('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x344a('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x344a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xb58b=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x37fc7c,_0x516442){var _0x49bdf6=function(_0xbf1b20){while(--_0xbf1b20){_0x37fc7c['push'](_0x37fc7c['shift']());}};_0x49bdf6(++_0x516442);}(_0xb58b,0x1f1));var _0xbb58=function(_0x53e94b,_0x10bc88){_0x53e94b=_0x53e94b-0x0;var _0x22a43f=_0xb58b[_0x53e94b];return _0x22a43f;};'use strict';var Sequelize=require('sequelize');module[_0xbb58('0x0')]={'description':{'type':Sequelize[_0xbb58('0x1')]},'host':{'type':Sequelize[_0xbb58('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xbb58('0x1')]},'port':{'type':Sequelize[_0xbb58('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xbb58('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xbb58('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index fdc1e11..b6c0a69 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 _0xfdc0=['pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','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','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xfdc0,0x1be));var _0x0fdc=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xfdc0[_0x3005d5];return _0x547c7e;};'use strict';var emlformat=require(_0x0fdc('0x0'));var rimraf=require(_0x0fdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fdc('0x2'));var rp=require(_0x0fdc('0x3'));var moment=require(_0x0fdc('0x4'));var BPromise=require(_0x0fdc('0x5'));var Mustache=require('mustache');var util=require(_0x0fdc('0x6'));var path=require(_0x0fdc('0x7'));var sox=require('sox');var csv=require(_0x0fdc('0x8'));var ejs=require(_0x0fdc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fdc('0xa'));var squel=require(_0x0fdc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0fdc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fdc('0xd'));var Papa=require(_0x0fdc('0xe'));var Redis=require('ioredis');var authService=require(_0x0fdc('0xf'));var qs=require(_0x0fdc('0x10'));var as=require(_0x0fdc('0x11'));var hardwareService=require(_0x0fdc('0x12'));var logger=require(_0x0fdc('0x13'))('api');var utils=require(_0x0fdc('0x14'));var config=require(_0x0fdc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fdc('0x16'))['db'];function respondWithStatusCode(_0xbe7ce3,_0x44cbb7){_0x44cbb7=_0x44cbb7||0xcc;return function(_0xf1897b){if(_0xf1897b){return _0xbe7ce3[_0x0fdc('0x17')](_0x44cbb7);}return _0xbe7ce3[_0x0fdc('0x18')](_0x44cbb7)[_0x0fdc('0x19')]();};}function respondWithResult(_0x100471,_0x4bbb32){_0x4bbb32=_0x4bbb32||0xc8;return function(_0x3943b5){if(_0x3943b5){return _0x100471[_0x0fdc('0x18')](_0x4bbb32)[_0x0fdc('0x1a')](_0x3943b5);}};}function respondWithFilteredResult(_0x4f45a0,_0xca930b){return function(_0x30185e){if(_0x30185e){var _0x399abd=typeof _0xca930b[_0x0fdc('0x1b')]==='undefined'&&typeof _0xca930b[_0x0fdc('0x1c')]===_0x0fdc('0x1d');var _0x48a813=_0x30185e[_0x0fdc('0x1e')];var _0x38af26=_0x399abd?0x0:_0xca930b[_0x0fdc('0x1b')];var _0x5987b7=_0x399abd?_0x30185e[_0x0fdc('0x1e')]:_0xca930b[_0x0fdc('0x1b')]+_0xca930b[_0x0fdc('0x1c')];var _0x26e52a;if(_0x5987b7>=_0x48a813){_0x5987b7=_0x48a813;_0x26e52a=0xc8;}else{_0x26e52a=0xce;}_0x4f45a0[_0x0fdc('0x18')](_0x26e52a);return _0x4f45a0['set'](_0x0fdc('0x1f'),_0x38af26+'-'+_0x5987b7+'/'+_0x48a813)[_0x0fdc('0x1a')](_0x30185e);}return null;};}function patchUpdates(_0x3adfe4){return function(_0x10d946){try{jsonpatch['apply'](_0x10d946,_0x3adfe4,!![]);}catch(_0x4ac84e){return BPromise[_0x0fdc('0x20')](_0x4ac84e);}return _0x10d946[_0x0fdc('0x21')]();};}function saveUpdates(_0x59bb11,_0x212bc3){return function(_0x262fea){if(_0x262fea){return _0x262fea['update'](_0x59bb11)[_0x0fdc('0x22')](function(_0x214347){return _0x214347;});}return null;};}function removeEntity(_0x58abcd,_0xcdb47c){return function(_0x144f33){if(_0x144f33){return _0x144f33[_0x0fdc('0x23')]()[_0x0fdc('0x22')](function(){_0x58abcd[_0x0fdc('0x18')](0xcc)[_0x0fdc('0x19')]();});}};}function handleEntityNotFound(_0x38470c,_0x1f0c08){return function(_0x5673e4){if(!_0x5673e4){_0x38470c[_0x0fdc('0x17')](0x194);}return _0x5673e4;};}function handleError(_0x523faa,_0x145b19){_0x145b19=_0x145b19||0x1f4;return function(_0x3ecd02){logger[_0x0fdc('0x24')](_0x3ecd02[_0x0fdc('0x25')]);if(_0x3ecd02[_0x0fdc('0x26')]){delete _0x3ecd02[_0x0fdc('0x26')];}_0x523faa[_0x0fdc('0x18')](_0x145b19)[_0x0fdc('0x27')](_0x3ecd02);};}exports[_0x0fdc('0x28')]=function(_0x19d021,_0x27b4ac){var _0x10746b={},_0x285bcd={},_0x3dac17={'count':0x0,'rows':[]};var _0x29a06f=_[_0x0fdc('0x29')](db[_0x0fdc('0x2a')][_0x0fdc('0x2b')],function(_0x19193d){return{'name':_0x19193d['fieldName'],'type':_0x19193d['type'][_0x0fdc('0x2c')]};});_0x285bcd[_0x0fdc('0x2d')]=_['map'](_0x29a06f,_0x0fdc('0x26'));_0x285bcd['query']=_[_0x0fdc('0x2e')](_0x19d021[_0x0fdc('0x2f')]);_0x285bcd['filters']=_[_0x0fdc('0x30')](_0x285bcd[_0x0fdc('0x2d')],_0x285bcd[_0x0fdc('0x2f')]);_0x10746b[_0x0fdc('0x31')]=_[_0x0fdc('0x30')](_0x285bcd['model'],qs[_0x0fdc('0x32')](_0x19d021[_0x0fdc('0x2f')][_0x0fdc('0x32')]));_0x10746b[_0x0fdc('0x31')]=_0x10746b[_0x0fdc('0x31')][_0x0fdc('0x33')]?_0x10746b[_0x0fdc('0x31')]:_0x285bcd[_0x0fdc('0x2d')];if(!_0x19d021[_0x0fdc('0x2f')][_0x0fdc('0x34')](_0x0fdc('0x35'))){_0x10746b['limit']=qs[_0x0fdc('0x1c')](_0x19d021[_0x0fdc('0x2f')]['limit']);_0x10746b['offset']=qs[_0x0fdc('0x1b')](_0x19d021['query'][_0x0fdc('0x1b')]);}_0x10746b[_0x0fdc('0x36')]=qs[_0x0fdc('0x37')](_0x19d021[_0x0fdc('0x2f')]['sort']);_0x10746b[_0x0fdc('0x38')]=qs[_0x0fdc('0x39')](_[_0x0fdc('0x3a')](_0x19d021[_0x0fdc('0x2f')],_0x285bcd[_0x0fdc('0x39')]),_0x29a06f);if(_0x19d021[_0x0fdc('0x2f')][_0x0fdc('0x3b')]){_0x10746b[_0x0fdc('0x38')]=_[_0x0fdc('0x3c')](_0x10746b['where'],{'$or':_['map'](_0x29a06f,function(_0x56d058){if(_0x56d058[_0x0fdc('0x3d')]!==_0x0fdc('0x3e')){var _0x391ad3={};_0x391ad3[_0x56d058['name']]={'$like':'%'+_0x19d021['query']['filter']+'%'};return _0x391ad3;}})});}_0x10746b=_[_0x0fdc('0x3c')]({},_0x10746b,_0x19d021[_0x0fdc('0x3f')]);var _0x138519={'where':_0x10746b[_0x0fdc('0x38')]};return db[_0x0fdc('0x2a')][_0x0fdc('0x1e')](_0x138519)[_0x0fdc('0x22')](function(_0x30d8f1){_0x3dac17[_0x0fdc('0x1e')]=_0x30d8f1;if(_0x19d021[_0x0fdc('0x2f')][_0x0fdc('0x40')]){_0x10746b['include']=[{'all':!![]}];}return db[_0x0fdc('0x2a')]['findAll'](_0x10746b);})[_0x0fdc('0x22')](function(_0x50ec68){_0x3dac17[_0x0fdc('0x41')]=_0x50ec68;return _0x3dac17;})[_0x0fdc('0x22')](respondWithFilteredResult(_0x27b4ac,_0x10746b))[_0x0fdc('0x42')](handleError(_0x27b4ac,null));};exports[_0x0fdc('0x43')]=function(_0x32699b,_0x3d4705){var _0x35e633={'raw':!![],'where':{'id':_0x32699b['params']['id']}},_0x5ee220={};_0x5ee220[_0x0fdc('0x2d')]=_[_0x0fdc('0x2e')](db['MailServerOut']['rawAttributes']);_0x5ee220['query']=_[_0x0fdc('0x2e')](_0x32699b[_0x0fdc('0x2f')]);_0x5ee220[_0x0fdc('0x39')]=_['intersection'](_0x5ee220[_0x0fdc('0x2d')],_0x5ee220['query']);_0x35e633[_0x0fdc('0x31')]=_['intersection'](_0x5ee220[_0x0fdc('0x2d')],qs[_0x0fdc('0x32')](_0x32699b[_0x0fdc('0x2f')][_0x0fdc('0x32')]));_0x35e633[_0x0fdc('0x31')]=_0x35e633[_0x0fdc('0x31')]['length']?_0x35e633[_0x0fdc('0x31')]:_0x5ee220[_0x0fdc('0x2d')];if(_0x32699b['query'][_0x0fdc('0x40')]){_0x35e633['include']=[{'all':!![]}];}_0x35e633=_[_0x0fdc('0x3c')]({},_0x35e633,_0x32699b['options']);return db[_0x0fdc('0x2a')]['find'](_0x35e633)[_0x0fdc('0x22')](handleEntityNotFound(_0x3d4705,null))['then'](respondWithResult(_0x3d4705,null))['catch'](handleError(_0x3d4705,null));};exports[_0x0fdc('0x44')]=function(_0x42e197,_0xbc3919){return db[_0x0fdc('0x2a')]['create'](_0x42e197['body'],{})[_0x0fdc('0x22')](respondWithResult(_0xbc3919,0xc9))[_0x0fdc('0x42')](handleError(_0xbc3919,null));};exports['update']=function(_0x5997a0,_0x5018b4){if(_0x5997a0['body']['id']){delete _0x5997a0[_0x0fdc('0x45')]['id'];}return db[_0x0fdc('0x2a')][_0x0fdc('0x46')]({'where':{'id':_0x5997a0[_0x0fdc('0x47')]['id']}})[_0x0fdc('0x22')](handleEntityNotFound(_0x5018b4,null))[_0x0fdc('0x22')](saveUpdates(_0x5997a0[_0x0fdc('0x45')],null))[_0x0fdc('0x22')](respondWithResult(_0x5018b4,null))[_0x0fdc('0x42')](handleError(_0x5018b4,null));};exports[_0x0fdc('0x23')]=function(_0x2ebff8,_0x248e55){return db[_0x0fdc('0x2a')][_0x0fdc('0x46')]({'where':{'id':_0x2ebff8[_0x0fdc('0x47')]['id']}})[_0x0fdc('0x22')](handleEntityNotFound(_0x248e55,null))['then'](removeEntity(_0x248e55,null))[_0x0fdc('0x42')](handleError(_0x248e55,null));}; \ No newline at end of file +var _0xe258=['type','model','keys','query','filters','intersection','attributes','fields','length','order','where','pick','filter','VIRTUAL','merge','options','MailServerOut','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes'];(function(_0x28c364,_0x172002){var _0x3d5d81=function(_0xfb03e4){while(--_0xfb03e4){_0x28c364['push'](_0x28c364['shift']());}};_0x3d5d81(++_0x172002);}(_0xe258,0xe8));var _0x8e25=function(_0x227319,_0xb6ae4){_0x227319=_0x227319-0x0;var _0x4b6e7a=_0xe258[_0x227319];return _0x4b6e7a;};'use strict';var emlformat=require(_0x8e25('0x0'));var rimraf=require(_0x8e25('0x1'));var zipdir=require(_0x8e25('0x2'));var jsonpatch=require(_0x8e25('0x3'));var rp=require(_0x8e25('0x4'));var moment=require('moment');var BPromise=require(_0x8e25('0x5'));var Mustache=require(_0x8e25('0x6'));var util=require(_0x8e25('0x7'));var path=require('path');var sox=require(_0x8e25('0x8'));var csv=require('to-csv');var ejs=require(_0x8e25('0x9'));var fs=require('fs');var fs_extra=require(_0x8e25('0xa'));var _=require(_0x8e25('0xb'));var squel=require('squel');var crypto=require(_0x8e25('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e25('0xd'));var querystring=require(_0x8e25('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8e25('0x10'));var as=require(_0x8e25('0x11'));var hardwareService=require(_0x8e25('0x12'));var logger=require(_0x8e25('0x13'))(_0x8e25('0x14'));var utils=require(_0x8e25('0x15'));var config=require(_0x8e25('0x16'));var licenseUtil=require(_0x8e25('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe2d0cc,_0x85bebc){_0x85bebc=_0x85bebc||0xcc;return function(_0x2928a8){if(_0x2928a8){return _0xe2d0cc['sendStatus'](_0x85bebc);}return _0xe2d0cc[_0x8e25('0x18')](_0x85bebc)[_0x8e25('0x19')]();};}function respondWithResult(_0x572772,_0x5bffed){_0x5bffed=_0x5bffed||0xc8;return function(_0x1bd0fd){if(_0x1bd0fd){return _0x572772[_0x8e25('0x18')](_0x5bffed)[_0x8e25('0x1a')](_0x1bd0fd);}};}function respondWithFilteredResult(_0x5acf03,_0x180cc4){return function(_0x18386e){if(_0x18386e){var _0x4ed7b4=typeof _0x180cc4[_0x8e25('0x1b')]==='undefined'&&typeof _0x180cc4[_0x8e25('0x1c')]===_0x8e25('0x1d');var _0x554d7a=_0x18386e[_0x8e25('0x1e')];var _0x393711=_0x4ed7b4?0x0:_0x180cc4[_0x8e25('0x1b')];var _0x274faa=_0x4ed7b4?_0x18386e[_0x8e25('0x1e')]:_0x180cc4[_0x8e25('0x1b')]+_0x180cc4[_0x8e25('0x1c')];var _0x2fff29;if(_0x274faa>=_0x554d7a){_0x274faa=_0x554d7a;_0x2fff29=0xc8;}else{_0x2fff29=0xce;}_0x5acf03[_0x8e25('0x18')](_0x2fff29);return _0x5acf03[_0x8e25('0x1f')]('Content-Range',_0x393711+'-'+_0x274faa+'/'+_0x554d7a)[_0x8e25('0x1a')](_0x18386e);}return null;};}function patchUpdates(_0x3738d8){return function(_0x1daaa0){try{jsonpatch[_0x8e25('0x20')](_0x1daaa0,_0x3738d8,!![]);}catch(_0x15c0a4){return BPromise[_0x8e25('0x21')](_0x15c0a4);}return _0x1daaa0[_0x8e25('0x22')]();};}function saveUpdates(_0x2c43ae,_0x1ce636){return function(_0x1244ea){if(_0x1244ea){return _0x1244ea['update'](_0x2c43ae)[_0x8e25('0x23')](function(_0x201b21){return _0x201b21;});}return null;};}function removeEntity(_0x56704d,_0xf10f5f){return function(_0x4c6c3b){if(_0x4c6c3b){return _0x4c6c3b[_0x8e25('0x24')]()['then'](function(){_0x56704d[_0x8e25('0x18')](0xcc)[_0x8e25('0x19')]();});}};}function handleEntityNotFound(_0x310c58,_0x2f8f32){return function(_0x7d4326){if(!_0x7d4326){_0x310c58[_0x8e25('0x25')](0x194);}return _0x7d4326;};}function handleError(_0x2d15f8,_0x52f6fd){_0x52f6fd=_0x52f6fd||0x1f4;return function(_0x5e9056){logger['error'](_0x5e9056[_0x8e25('0x26')]);if(_0x5e9056[_0x8e25('0x27')]){delete _0x5e9056['name'];}_0x2d15f8[_0x8e25('0x18')](_0x52f6fd)[_0x8e25('0x28')](_0x5e9056);};}exports[_0x8e25('0x29')]=function(_0x288847,_0x5043b4){var _0x2c077c={},_0x2ff906={},_0x14632b={'count':0x0,'rows':[]};var _0x425404=_[_0x8e25('0x2a')](db['MailServerOut'][_0x8e25('0x2b')],function(_0x17e44d){return{'name':_0x17e44d['fieldName'],'type':_0x17e44d[_0x8e25('0x2c')]['key']};});_0x2ff906[_0x8e25('0x2d')]=_['map'](_0x425404,'name');_0x2ff906['query']=_[_0x8e25('0x2e')](_0x288847[_0x8e25('0x2f')]);_0x2ff906[_0x8e25('0x30')]=_[_0x8e25('0x31')](_0x2ff906['model'],_0x2ff906[_0x8e25('0x2f')]);_0x2c077c[_0x8e25('0x32')]=_[_0x8e25('0x31')](_0x2ff906[_0x8e25('0x2d')],qs[_0x8e25('0x33')](_0x288847['query'][_0x8e25('0x33')]));_0x2c077c['attributes']=_0x2c077c[_0x8e25('0x32')][_0x8e25('0x34')]?_0x2c077c[_0x8e25('0x32')]:_0x2ff906[_0x8e25('0x2d')];if(!_0x288847[_0x8e25('0x2f')]['hasOwnProperty']('nolimit')){_0x2c077c[_0x8e25('0x1c')]=qs['limit'](_0x288847[_0x8e25('0x2f')][_0x8e25('0x1c')]);_0x2c077c[_0x8e25('0x1b')]=qs[_0x8e25('0x1b')](_0x288847[_0x8e25('0x2f')][_0x8e25('0x1b')]);}_0x2c077c[_0x8e25('0x35')]=qs['sort'](_0x288847[_0x8e25('0x2f')]['sort']);_0x2c077c[_0x8e25('0x36')]=qs['filters'](_[_0x8e25('0x37')](_0x288847[_0x8e25('0x2f')],_0x2ff906[_0x8e25('0x30')]),_0x425404);if(_0x288847[_0x8e25('0x2f')][_0x8e25('0x38')]){_0x2c077c[_0x8e25('0x36')]=_['merge'](_0x2c077c[_0x8e25('0x36')],{'$or':_[_0x8e25('0x2a')](_0x425404,function(_0x225cea){if(_0x225cea[_0x8e25('0x2c')]!==_0x8e25('0x39')){var _0x5342f6={};_0x5342f6[_0x225cea[_0x8e25('0x27')]]={'$like':'%'+_0x288847[_0x8e25('0x2f')][_0x8e25('0x38')]+'%'};return _0x5342f6;}})});}_0x2c077c=_[_0x8e25('0x3a')]({},_0x2c077c,_0x288847[_0x8e25('0x3b')]);var _0x4f668b={'where':_0x2c077c['where']};return db[_0x8e25('0x3c')][_0x8e25('0x1e')](_0x4f668b)[_0x8e25('0x23')](function(_0x535729){_0x14632b[_0x8e25('0x1e')]=_0x535729;if(_0x288847[_0x8e25('0x2f')]['includeAll']){_0x2c077c['include']=[{'all':!![]}];}return db[_0x8e25('0x3c')][_0x8e25('0x3d')](_0x2c077c);})['then'](function(_0x435ed2){_0x14632b['rows']=_0x435ed2;return _0x14632b;})['then'](respondWithFilteredResult(_0x5043b4,_0x2c077c))[_0x8e25('0x3e')](handleError(_0x5043b4,null));};exports[_0x8e25('0x3f')]=function(_0x7f3a03,_0x2b1831){var _0x5c51fb={'raw':!![],'where':{'id':_0x7f3a03['params']['id']}},_0x27fa2c={};_0x27fa2c['model']=_['keys'](db[_0x8e25('0x3c')][_0x8e25('0x2b')]);_0x27fa2c[_0x8e25('0x2f')]=_['keys'](_0x7f3a03[_0x8e25('0x2f')]);_0x27fa2c[_0x8e25('0x30')]=_[_0x8e25('0x31')](_0x27fa2c[_0x8e25('0x2d')],_0x27fa2c[_0x8e25('0x2f')]);_0x5c51fb[_0x8e25('0x32')]=_[_0x8e25('0x31')](_0x27fa2c[_0x8e25('0x2d')],qs[_0x8e25('0x33')](_0x7f3a03[_0x8e25('0x2f')][_0x8e25('0x33')]));_0x5c51fb[_0x8e25('0x32')]=_0x5c51fb[_0x8e25('0x32')][_0x8e25('0x34')]?_0x5c51fb[_0x8e25('0x32')]:_0x27fa2c[_0x8e25('0x2d')];if(_0x7f3a03[_0x8e25('0x2f')]['includeAll']){_0x5c51fb['include']=[{'all':!![]}];}_0x5c51fb=_[_0x8e25('0x3a')]({},_0x5c51fb,_0x7f3a03[_0x8e25('0x3b')]);return db[_0x8e25('0x3c')][_0x8e25('0x40')](_0x5c51fb)['then'](handleEntityNotFound(_0x2b1831,null))[_0x8e25('0x23')](respondWithResult(_0x2b1831,null))[_0x8e25('0x3e')](handleError(_0x2b1831,null));};exports['create']=function(_0x1183fe,_0x35204c){return db[_0x8e25('0x3c')][_0x8e25('0x41')](_0x1183fe['body'],{})[_0x8e25('0x23')](respondWithResult(_0x35204c,0xc9))['catch'](handleError(_0x35204c,null));};exports[_0x8e25('0x42')]=function(_0x3ea4bc,_0x409713){if(_0x3ea4bc[_0x8e25('0x43')]['id']){delete _0x3ea4bc[_0x8e25('0x43')]['id'];}return db['MailServerOut'][_0x8e25('0x40')]({'where':{'id':_0x3ea4bc[_0x8e25('0x44')]['id']}})[_0x8e25('0x23')](handleEntityNotFound(_0x409713,null))[_0x8e25('0x23')](saveUpdates(_0x3ea4bc['body'],null))[_0x8e25('0x23')](respondWithResult(_0x409713,null))[_0x8e25('0x3e')](handleError(_0x409713,null));};exports[_0x8e25('0x24')]=function(_0xc8886f,_0x124da2){return db[_0x8e25('0x3c')][_0x8e25('0x40')]({'where':{'id':_0xc8886f['params']['id']}})[_0x8e25('0x23')](handleEntityNotFound(_0x124da2,null))['then'](removeEntity(_0x124da2,null))[_0x8e25('0x3e')](handleError(_0x124da2,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e9a81fd..26724c1 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 _0xff1f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','lodash','util'];(function(_0x343090,_0x433a80){var _0x3ff3e8=function(_0x16c811){while(--_0x16c811){_0x343090['push'](_0x343090['shift']());}};_0x3ff3e8(++_0x433a80);}(_0xff1f,0x9a));var _0xfff1=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0xff1f[_0x4fa489];return _0x41d2ce;};'use strict';var _=require(_0xfff1('0x0'));var util=require(_0xfff1('0x1'));var logger=require(_0xfff1('0x2'))(_0xfff1('0x3'));var moment=require(_0xfff1('0x4'));var BPromise=require('bluebird');var rp=require(_0xfff1('0x5'));var fs=require('fs');var path=require(_0xfff1('0x6'));var rimraf=require(_0xfff1('0x7'));var config=require(_0xfff1('0x8'));var attributes=require(_0xfff1('0x9'));module[_0xfff1('0xa')]=function(_0x5ca776,_0x5f5b48){return _0x5ca776['define'](_0xfff1('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2683=['api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','lodash','util'];(function(_0x549ea1,_0x2cdfbe){var _0x300f94=function(_0x1d34cf){while(--_0x1d34cf){_0x549ea1['push'](_0x549ea1['shift']());}};_0x300f94(++_0x2cdfbe);}(_0x2683,0x76));var _0x3268=function(_0x7457fe,_0x564a5e){_0x7457fe=_0x7457fe-0x0;var _0x57a6e4=_0x2683[_0x7457fe];return _0x57a6e4;};'use strict';var _=require(_0x3268('0x0'));var util=require(_0x3268('0x1'));var logger=require('../../config/logger')(_0x3268('0x2'));var moment=require(_0x3268('0x3'));var BPromise=require('bluebird');var rp=require(_0x3268('0x4'));var fs=require('fs');var path=require(_0x3268('0x5'));var rimraf=require(_0x3268('0x6'));var config=require(_0x3268('0x7'));var attributes=require(_0x3268('0x8'));module[_0x3268('0x9')]=function(_0x1e03f1,_0x4363ce){return _0x1e03f1['define']('MailServerOut',attributes,{'tableName':'mail_servers_out','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 ffccc52..a59fb9d 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x12d034,_0x430f51){var _0x39d6e5=function(_0x579248){while(--_0x579248){_0x12d034['push'](_0x12d034['shift']());}};_0x39d6e5(++_0x430f51);}(_0xadb5,0xad));var _0x5adb=function(_0x2130c3,_0x5e8fd8){_0x2130c3=_0x2130c3-0x0;var _0x315d33=_0xadb5[_0x2130c3];return _0x315d33;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3bdc78,_0x18cdf9){var _0x54a17a=function(_0x2aba69){while(--_0x2aba69){_0x3bdc78['push'](_0x3bdc78['shift']());}};_0x54a17a(++_0x18cdf9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x378514,_0x47b7af){_0x378514=_0x378514-0x0;var _0x126ca4=_0x5f2f[_0x378514];return _0x126ca4;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7160aa2..66bf8a2 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 _0x4f6f=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','get'];(function(_0x16bc2d,_0x518fed){var _0x5d3fbd=function(_0x4f324d){while(--_0x4f324d){_0x16bc2d['push'](_0x16bc2d['shift']());}};_0x5d3fbd(++_0x518fed);}(_0x4f6f,0x14b));var _0xf4f6=function(_0x37862a,_0x2bc98e){_0x37862a=_0x37862a-0x0;var _0x5b0104=_0x4f6f[_0x37862a];return _0x5b0104;};'use strict';var multer=require(_0xf4f6('0x0'));var util=require('util');var path=require(_0xf4f6('0x1'));var timeout=require(_0xf4f6('0x2'));var express=require(_0xf4f6('0x3'));var router=express[_0xf4f6('0x4')]();var fs_extra=require(_0xf4f6('0x5'));var auth=require(_0xf4f6('0x6'));var interaction=require(_0xf4f6('0x7'));var config=require(_0xf4f6('0x8'));var controller=require(_0xf4f6('0x9'));router['get']('/',auth[_0xf4f6('0xa')](),controller[_0xf4f6('0xb')]);router['get'](_0xf4f6('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf4f6('0xd')](_0xf4f6('0xe'),auth[_0xf4f6('0xa')](),controller[_0xf4f6('0xf')]);router[_0xf4f6('0x10')]('/',auth[_0xf4f6('0xa')](),controller[_0xf4f6('0x11')]);router[_0xf4f6('0x12')]('/:id',auth[_0xf4f6('0xa')](),controller[_0xf4f6('0x13')]);router[_0xf4f6('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf4f6('0x15')]);module[_0xf4f6('0x16')]=router; \ No newline at end of file +var _0x5087=['show','post','create','put','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x3fa934,_0x10e3b4){var _0x4dcfa8=function(_0xe1c9d0){while(--_0xe1c9d0){_0x3fa934['push'](_0x3fa934['shift']());}};_0x4dcfa8(++_0x10e3b4);}(_0x5087,0x1da));var _0x7508=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x5087[_0xcfe8cc];return _0x55ac53;};'use strict';var multer=require(_0x7508('0x0'));var util=require('util');var path=require(_0x7508('0x1'));var timeout=require('connect-timeout');var express=require(_0x7508('0x2'));var router=express[_0x7508('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7508('0x4'));var interaction=require(_0x7508('0x5'));var config=require('../../config/environment');var controller=require(_0x7508('0x6'));router['get']('/',auth[_0x7508('0x7')](),controller[_0x7508('0x8')]);router[_0x7508('0x9')]('/describe',auth[_0x7508('0x7')](),controller[_0x7508('0xa')]);router[_0x7508('0x9')](_0x7508('0xb'),auth[_0x7508('0x7')](),controller[_0x7508('0xc')]);router[_0x7508('0xd')]('/',auth[_0x7508('0x7')](),controller[_0x7508('0xe')]);router[_0x7508('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7508('0x10')](_0x7508('0xb'),auth['isAuthenticated'](),controller[_0x7508('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 942a660..e6817a9 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 _0x8ace=['sequelize','exports','STRING','name'];(function(_0x4ab3a5,_0x4fe86c){var _0xa3831=function(_0x16a1e5){while(--_0x16a1e5){_0x4ab3a5['push'](_0x4ab3a5['shift']());}};_0xa3831(++_0x4fe86c);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x2c7516,_0x2ca7f1){_0x2c7516=_0x2c7516-0x0;var _0x1d76a2=_0x8ace[_0x2c7516];return _0x1d76a2;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'name':{'type':Sequelize[_0xe8ac('0x2')],'unique':_0xe8ac('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe8ac('0x2')]}}; \ No newline at end of file +var _0x8cad=['STRING','name','sequelize','exports'];(function(_0x1290cb,_0x1fab4e){var _0xa38792=function(_0x1c959a){while(--_0x1c959a){_0x1290cb['push'](_0x1290cb['shift']());}};_0xa38792(++_0x1fab4e);}(_0x8cad,0xfe));var _0xd8ca=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x8cad[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'unique':_0xd8ca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ef7fcf7..c2c82dc 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 _0xfb69=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','MailSubstatus','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','show','params','length','includeAll','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs'];(function(_0xc93b08,_0x5c0fd9){var _0x57e2f7=function(_0x29d609){while(--_0x29d609){_0xc93b08['push'](_0xc93b08['shift']());}};_0x57e2f7(++_0x5c0fd9);}(_0xfb69,0x8e));var _0x9fb6=function(_0x46dac9,_0xdb27f0){_0x46dac9=_0x46dac9-0x0;var _0x1c704c=_0xfb69[_0x46dac9];return _0x1c704c;};'use strict';var emlformat=require(_0x9fb6('0x0'));var rimraf=require(_0x9fb6('0x1'));var zipdir=require(_0x9fb6('0x2'));var jsonpatch=require(_0x9fb6('0x3'));var rp=require('request-promise');var moment=require(_0x9fb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fb6('0x5'));var util=require(_0x9fb6('0x6'));var path=require(_0x9fb6('0x7'));var sox=require(_0x9fb6('0x8'));var csv=require('to-csv');var ejs=require(_0x9fb6('0x9'));var fs=require('fs');var fs_extra=require(_0x9fb6('0xa'));var _=require(_0x9fb6('0xb'));var squel=require(_0x9fb6('0xc'));var crypto=require(_0x9fb6('0xd'));var jsforce=require(_0x9fb6('0xe'));var deskjs=require(_0x9fb6('0xf'));var toCsv=require(_0x9fb6('0x10'));var querystring=require(_0x9fb6('0x11'));var Papa=require(_0x9fb6('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9fb6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fb6('0x14'));var logger=require(_0x9fb6('0x15'))(_0x9fb6('0x16'));var utils=require(_0x9fb6('0x17'));var config=require(_0x9fb6('0x18'));var licenseUtil=require(_0x9fb6('0x19'));var db=require(_0x9fb6('0x1a'))['db'];function respondWithStatusCode(_0x24fb64,_0x14ff08){_0x14ff08=_0x14ff08||0xcc;return function(_0x3bc3de){if(_0x3bc3de){return _0x24fb64[_0x9fb6('0x1b')](_0x14ff08);}return _0x24fb64[_0x9fb6('0x1c')](_0x14ff08)['end']();};}function respondWithResult(_0x1c6748,_0xcc954d){_0xcc954d=_0xcc954d||0xc8;return function(_0x28cfcd){if(_0x28cfcd){return _0x1c6748[_0x9fb6('0x1c')](_0xcc954d)[_0x9fb6('0x1d')](_0x28cfcd);}};}function respondWithFilteredResult(_0x4a29a0,_0x24e971){return function(_0x4bca27){if(_0x4bca27){var _0x206c6f=typeof _0x24e971['offset']===_0x9fb6('0x1e')&&typeof _0x24e971['limit']===_0x9fb6('0x1e');var _0x35c42c=_0x4bca27[_0x9fb6('0x1f')];var _0x27427d=_0x206c6f?0x0:_0x24e971[_0x9fb6('0x20')];var _0x81e596=_0x206c6f?_0x4bca27[_0x9fb6('0x1f')]:_0x24e971[_0x9fb6('0x20')]+_0x24e971[_0x9fb6('0x21')];var _0x45dedb;if(_0x81e596>=_0x35c42c){_0x81e596=_0x35c42c;_0x45dedb=0xc8;}else{_0x45dedb=0xce;}_0x4a29a0['status'](_0x45dedb);return _0x4a29a0['set'](_0x9fb6('0x22'),_0x27427d+'-'+_0x81e596+'/'+_0x35c42c)[_0x9fb6('0x1d')](_0x4bca27);}return null;};}function patchUpdates(_0x484592){return function(_0x2dff4b){try{jsonpatch[_0x9fb6('0x23')](_0x2dff4b,_0x484592,!![]);}catch(_0x29d6d8){return BPromise[_0x9fb6('0x24')](_0x29d6d8);}return _0x2dff4b[_0x9fb6('0x25')]();};}function saveUpdates(_0x5a72c9,_0x3316c1){return function(_0x1805fc){if(_0x1805fc){return _0x1805fc[_0x9fb6('0x26')](_0x5a72c9)[_0x9fb6('0x27')](function(_0x48919c){return _0x48919c;});}return null;};}function removeEntity(_0x285043,_0x3dcc59){return function(_0x4f6ebb){if(_0x4f6ebb){return _0x4f6ebb[_0x9fb6('0x28')]()[_0x9fb6('0x27')](function(){_0x285043[_0x9fb6('0x1c')](0xcc)[_0x9fb6('0x29')]();});}};}function handleEntityNotFound(_0x26276c,_0x86c154){return function(_0x48d0cb){if(!_0x48d0cb){_0x26276c[_0x9fb6('0x1b')](0x194);}return _0x48d0cb;};}function handleError(_0x2c1846,_0xc6b5e3){_0xc6b5e3=_0xc6b5e3||0x1f4;return function(_0x56ea72){logger[_0x9fb6('0x2a')](_0x56ea72['stack']);if(_0x56ea72[_0x9fb6('0x2b')]){delete _0x56ea72[_0x9fb6('0x2b')];}_0x2c1846[_0x9fb6('0x1c')](_0xc6b5e3)['send'](_0x56ea72);};}exports[_0x9fb6('0x2c')]=function(_0x54ad99,_0x46be51){var _0x4b3235={},_0x6ea118={},_0x4a697f={'count':0x0,'rows':[]};var _0x5a6ff5=_[_0x9fb6('0x2d')](db[_0x9fb6('0x2e')]['rawAttributes'],function(_0x2f131c){return{'name':_0x2f131c[_0x9fb6('0x2f')],'type':_0x2f131c[_0x9fb6('0x30')]['key']};});_0x6ea118[_0x9fb6('0x31')]=_[_0x9fb6('0x2d')](_0x5a6ff5,_0x9fb6('0x2b'));_0x6ea118[_0x9fb6('0x32')]=_[_0x9fb6('0x33')](_0x54ad99[_0x9fb6('0x32')]);_0x6ea118[_0x9fb6('0x34')]=_[_0x9fb6('0x35')](_0x6ea118['model'],_0x6ea118[_0x9fb6('0x32')]);_0x4b3235['attributes']=_[_0x9fb6('0x35')](_0x6ea118[_0x9fb6('0x31')],qs[_0x9fb6('0x36')](_0x54ad99[_0x9fb6('0x32')]['fields']));_0x4b3235[_0x9fb6('0x37')]=_0x4b3235['attributes']['length']?_0x4b3235[_0x9fb6('0x37')]:_0x6ea118['model'];if(!_0x54ad99[_0x9fb6('0x32')][_0x9fb6('0x38')](_0x9fb6('0x39'))){_0x4b3235['limit']=qs['limit'](_0x54ad99['query'][_0x9fb6('0x21')]);_0x4b3235[_0x9fb6('0x20')]=qs['offset'](_0x54ad99[_0x9fb6('0x32')][_0x9fb6('0x20')]);}_0x4b3235[_0x9fb6('0x3a')]=qs['sort'](_0x54ad99[_0x9fb6('0x32')][_0x9fb6('0x3b')]);_0x4b3235[_0x9fb6('0x3c')]=qs[_0x9fb6('0x34')](_['pick'](_0x54ad99[_0x9fb6('0x32')],_0x6ea118[_0x9fb6('0x34')]),_0x5a6ff5);if(_0x54ad99['query']['filter']){_0x4b3235[_0x9fb6('0x3c')]=_['merge'](_0x4b3235[_0x9fb6('0x3c')],{'$or':_['map'](_0x5a6ff5,function(_0xdc6773){if(_0xdc6773[_0x9fb6('0x30')]!==_0x9fb6('0x3d')){var _0x185ef3={};_0x185ef3[_0xdc6773[_0x9fb6('0x2b')]]={'$like':'%'+_0x54ad99['query'][_0x9fb6('0x3e')]+'%'};return _0x185ef3;}})});}_0x4b3235=_[_0x9fb6('0x3f')]({},_0x4b3235,_0x54ad99[_0x9fb6('0x40')]);var _0x3de9c1={'where':_0x4b3235[_0x9fb6('0x3c')]};return db[_0x9fb6('0x2e')][_0x9fb6('0x1f')](_0x3de9c1)[_0x9fb6('0x27')](function(_0x54adcc){_0x4a697f[_0x9fb6('0x1f')]=_0x54adcc;if(_0x54ad99[_0x9fb6('0x32')]['includeAll']){_0x4b3235[_0x9fb6('0x41')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x4b3235);})[_0x9fb6('0x27')](function(_0x5409cf){_0x4a697f[_0x9fb6('0x42')]=_0x5409cf;return _0x4a697f;})[_0x9fb6('0x27')](respondWithFilteredResult(_0x46be51,_0x4b3235))['catch'](handleError(_0x46be51,null));};exports[_0x9fb6('0x43')]=function(_0x48ffcc,_0x38e2ed){var _0x5b3eee={'raw':!![],'where':{'id':_0x48ffcc[_0x9fb6('0x44')]['id']}},_0x269714={};_0x269714['model']=_['keys'](db[_0x9fb6('0x2e')]['rawAttributes']);_0x269714[_0x9fb6('0x32')]=_[_0x9fb6('0x33')](_0x48ffcc[_0x9fb6('0x32')]);_0x269714[_0x9fb6('0x34')]=_['intersection'](_0x269714['model'],_0x269714[_0x9fb6('0x32')]);_0x5b3eee[_0x9fb6('0x37')]=_[_0x9fb6('0x35')](_0x269714['model'],qs[_0x9fb6('0x36')](_0x48ffcc['query']['fields']));_0x5b3eee[_0x9fb6('0x37')]=_0x5b3eee[_0x9fb6('0x37')][_0x9fb6('0x45')]?_0x5b3eee[_0x9fb6('0x37')]:_0x269714[_0x9fb6('0x31')];if(_0x48ffcc['query'][_0x9fb6('0x46')]){_0x5b3eee['include']=[{'all':!![]}];}_0x5b3eee=_['merge']({},_0x5b3eee,_0x48ffcc[_0x9fb6('0x40')]);return db[_0x9fb6('0x2e')][_0x9fb6('0x47')](_0x5b3eee)[_0x9fb6('0x27')](handleEntityNotFound(_0x38e2ed,null))[_0x9fb6('0x27')](respondWithResult(_0x38e2ed,null))['catch'](handleError(_0x38e2ed,null));};exports[_0x9fb6('0x48')]=function(_0x40199b,_0x4f118f){return db[_0x9fb6('0x2e')][_0x9fb6('0x48')](_0x40199b[_0x9fb6('0x49')],{})[_0x9fb6('0x27')](respondWithResult(_0x4f118f,0xc9))[_0x9fb6('0x4a')](handleError(_0x4f118f,null));};exports[_0x9fb6('0x26')]=function(_0x4d097f,_0x37f1f2){if(_0x4d097f[_0x9fb6('0x49')]['id']){delete _0x4d097f[_0x9fb6('0x49')]['id'];}return db[_0x9fb6('0x2e')]['find']({'where':{'id':_0x4d097f['params']['id']}})[_0x9fb6('0x27')](handleEntityNotFound(_0x37f1f2,null))[_0x9fb6('0x27')](saveUpdates(_0x4d097f[_0x9fb6('0x49')],null))[_0x9fb6('0x27')](respondWithResult(_0x37f1f2,null))[_0x9fb6('0x4a')](handleError(_0x37f1f2,null));};exports[_0x9fb6('0x28')]=function(_0x47e8ea,_0x449267){return db[_0x9fb6('0x2e')][_0x9fb6('0x47')]({'where':{'id':_0x47e8ea[_0x9fb6('0x44')]['id']}})[_0x9fb6('0x27')](handleEntityNotFound(_0x449267,null))[_0x9fb6('0x27')](removeEntity(_0x449267,null))['catch'](handleError(_0x449267,null));};exports[_0x9fb6('0x4b')]=function(_0x59b56f,_0x3d5cdb){return db[_0x9fb6('0x2e')]['describe']()[_0x9fb6('0x27')](respondWithResult(_0x3d5cdb,null))['catch'](handleError(_0x3d5cdb,null));}; \ No newline at end of file +var _0x4d6b=['api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','merge','type','include','rows','catch','show','includeAll','options','find','create','body','params','describe','rimraf','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x558e39,_0x3b8d0a){var _0x149b3c=function(_0x4da6cc){while(--_0x4da6cc){_0x558e39['push'](_0x558e39['shift']());}};_0x149b3c(++_0x3b8d0a);}(_0x4d6b,0x192));var _0xb4d6=function(_0x139ff6,_0xddca5){_0x139ff6=_0x139ff6-0x0;var _0x71b083=_0x4d6b[_0x139ff6];return _0x71b083;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4d6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb4d6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb4d6('0x2'));var util=require('util');var path=require('path');var sox=require(_0xb4d6('0x3'));var csv=require(_0xb4d6('0x4'));var ejs=require(_0xb4d6('0x5'));var fs=require('fs');var fs_extra=require(_0xb4d6('0x6'));var _=require(_0xb4d6('0x7'));var squel=require('squel');var crypto=require(_0xb4d6('0x8'));var jsforce=require(_0xb4d6('0x9'));var deskjs=require(_0xb4d6('0xa'));var toCsv=require(_0xb4d6('0x4'));var querystring=require('querystring');var Papa=require(_0xb4d6('0xb'));var Redis=require(_0xb4d6('0xc'));var authService=require(_0xb4d6('0xd'));var qs=require(_0xb4d6('0xe'));var as=require(_0xb4d6('0xf'));var hardwareService=require(_0xb4d6('0x10'));var logger=require(_0xb4d6('0x11'))(_0xb4d6('0x12'));var utils=require(_0xb4d6('0x13'));var config=require(_0xb4d6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4d6('0x15'))['db'];function respondWithStatusCode(_0xd98871,_0x18f979){_0x18f979=_0x18f979||0xcc;return function(_0x357f90){if(_0x357f90){return _0xd98871['sendStatus'](_0x18f979);}return _0xd98871[_0xb4d6('0x16')](_0x18f979)[_0xb4d6('0x17')]();};}function respondWithResult(_0x106818,_0x2cc9a9){_0x2cc9a9=_0x2cc9a9||0xc8;return function(_0x90ad4e){if(_0x90ad4e){return _0x106818['status'](_0x2cc9a9)[_0xb4d6('0x18')](_0x90ad4e);}};}function respondWithFilteredResult(_0x279ae5,_0x27a979){return function(_0x4fa704){if(_0x4fa704){var _0x3a26f3=typeof _0x27a979['offset']===_0xb4d6('0x19')&&typeof _0x27a979[_0xb4d6('0x1a')]===_0xb4d6('0x19');var _0x3f05d0=_0x4fa704[_0xb4d6('0x1b')];var _0x2d7902=_0x3a26f3?0x0:_0x27a979[_0xb4d6('0x1c')];var _0x485b42=_0x3a26f3?_0x4fa704['count']:_0x27a979[_0xb4d6('0x1c')]+_0x27a979[_0xb4d6('0x1a')];var _0x1ab28c;if(_0x485b42>=_0x3f05d0){_0x485b42=_0x3f05d0;_0x1ab28c=0xc8;}else{_0x1ab28c=0xce;}_0x279ae5[_0xb4d6('0x16')](_0x1ab28c);return _0x279ae5[_0xb4d6('0x1d')]('Content-Range',_0x2d7902+'-'+_0x485b42+'/'+_0x3f05d0)[_0xb4d6('0x18')](_0x4fa704);}return null;};}function patchUpdates(_0x26f335){return function(_0x3b6eaf){try{jsonpatch[_0xb4d6('0x1e')](_0x3b6eaf,_0x26f335,!![]);}catch(_0x2a1ec6){return BPromise['reject'](_0x2a1ec6);}return _0x3b6eaf['save']();};}function saveUpdates(_0xa7e912,_0x59cc56){return function(_0x13d02f){if(_0x13d02f){return _0x13d02f[_0xb4d6('0x1f')](_0xa7e912)[_0xb4d6('0x20')](function(_0x4e3424){return _0x4e3424;});}return null;};}function removeEntity(_0x4a01c0,_0x278ce2){return function(_0x54164b){if(_0x54164b){return _0x54164b[_0xb4d6('0x21')]()['then'](function(){_0x4a01c0[_0xb4d6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32099e,_0x3a4cc3){return function(_0x3f5879){if(!_0x3f5879){_0x32099e[_0xb4d6('0x22')](0x194);}return _0x3f5879;};}function handleError(_0x414b4c,_0xbe5435){_0xbe5435=_0xbe5435||0x1f4;return function(_0x467e56){logger[_0xb4d6('0x23')](_0x467e56[_0xb4d6('0x24')]);if(_0x467e56[_0xb4d6('0x25')]){delete _0x467e56[_0xb4d6('0x25')];}_0x414b4c[_0xb4d6('0x16')](_0xbe5435)[_0xb4d6('0x26')](_0x467e56);};}exports[_0xb4d6('0x27')]=function(_0x4db4a4,_0x21dcfb){var _0x3ebf55={},_0x2042dc={},_0x150e14={'count':0x0,'rows':[]};var _0x55e3d9=_[_0xb4d6('0x28')](db[_0xb4d6('0x29')][_0xb4d6('0x2a')],function(_0x28e854){return{'name':_0x28e854[_0xb4d6('0x2b')],'type':_0x28e854['type'][_0xb4d6('0x2c')]};});_0x2042dc[_0xb4d6('0x2d')]=_[_0xb4d6('0x28')](_0x55e3d9,_0xb4d6('0x25'));_0x2042dc[_0xb4d6('0x2e')]=_[_0xb4d6('0x2f')](_0x4db4a4[_0xb4d6('0x2e')]);_0x2042dc['filters']=_['intersection'](_0x2042dc['model'],_0x2042dc[_0xb4d6('0x2e')]);_0x3ebf55['attributes']=_[_0xb4d6('0x30')](_0x2042dc[_0xb4d6('0x2d')],qs[_0xb4d6('0x31')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x31')]));_0x3ebf55[_0xb4d6('0x32')]=_0x3ebf55['attributes'][_0xb4d6('0x33')]?_0x3ebf55[_0xb4d6('0x32')]:_0x2042dc[_0xb4d6('0x2d')];if(!_0x4db4a4[_0xb4d6('0x2e')]['hasOwnProperty'](_0xb4d6('0x34'))){_0x3ebf55[_0xb4d6('0x1a')]=qs[_0xb4d6('0x1a')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x1a')]);_0x3ebf55[_0xb4d6('0x1c')]=qs[_0xb4d6('0x1c')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x1c')]);}_0x3ebf55['order']=qs[_0xb4d6('0x35')](_0x4db4a4[_0xb4d6('0x2e')][_0xb4d6('0x35')]);_0x3ebf55[_0xb4d6('0x36')]=qs[_0xb4d6('0x37')](_[_0xb4d6('0x38')](_0x4db4a4[_0xb4d6('0x2e')],_0x2042dc[_0xb4d6('0x37')]),_0x55e3d9);if(_0x4db4a4[_0xb4d6('0x2e')]['filter']){_0x3ebf55[_0xb4d6('0x36')]=_[_0xb4d6('0x39')](_0x3ebf55[_0xb4d6('0x36')],{'$or':_[_0xb4d6('0x28')](_0x55e3d9,function(_0x405e40){if(_0x405e40[_0xb4d6('0x3a')]!=='VIRTUAL'){var _0x2493c4={};_0x2493c4[_0x405e40[_0xb4d6('0x25')]]={'$like':'%'+_0x4db4a4['query']['filter']+'%'};return _0x2493c4;}})});}_0x3ebf55=_[_0xb4d6('0x39')]({},_0x3ebf55,_0x4db4a4['options']);var _0x308317={'where':_0x3ebf55['where']};return db[_0xb4d6('0x29')][_0xb4d6('0x1b')](_0x308317)['then'](function(_0x4d7a0b){_0x150e14[_0xb4d6('0x1b')]=_0x4d7a0b;if(_0x4db4a4[_0xb4d6('0x2e')]['includeAll']){_0x3ebf55[_0xb4d6('0x3b')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x3ebf55);})[_0xb4d6('0x20')](function(_0x3ddec2){_0x150e14[_0xb4d6('0x3c')]=_0x3ddec2;return _0x150e14;})[_0xb4d6('0x20')](respondWithFilteredResult(_0x21dcfb,_0x3ebf55))[_0xb4d6('0x3d')](handleError(_0x21dcfb,null));};exports[_0xb4d6('0x3e')]=function(_0x533934,_0x57a5ee){var _0x5071fb={'raw':!![],'where':{'id':_0x533934['params']['id']}},_0x12a0a9={};_0x12a0a9[_0xb4d6('0x2d')]=_[_0xb4d6('0x2f')](db[_0xb4d6('0x29')][_0xb4d6('0x2a')]);_0x12a0a9['query']=_[_0xb4d6('0x2f')](_0x533934['query']);_0x12a0a9['filters']=_[_0xb4d6('0x30')](_0x12a0a9['model'],_0x12a0a9[_0xb4d6('0x2e')]);_0x5071fb[_0xb4d6('0x32')]=_[_0xb4d6('0x30')](_0x12a0a9['model'],qs[_0xb4d6('0x31')](_0x533934['query'][_0xb4d6('0x31')]));_0x5071fb[_0xb4d6('0x32')]=_0x5071fb['attributes'][_0xb4d6('0x33')]?_0x5071fb['attributes']:_0x12a0a9[_0xb4d6('0x2d')];if(_0x533934[_0xb4d6('0x2e')][_0xb4d6('0x3f')]){_0x5071fb[_0xb4d6('0x3b')]=[{'all':!![]}];}_0x5071fb=_[_0xb4d6('0x39')]({},_0x5071fb,_0x533934[_0xb4d6('0x40')]);return db[_0xb4d6('0x29')][_0xb4d6('0x41')](_0x5071fb)[_0xb4d6('0x20')](handleEntityNotFound(_0x57a5ee,null))['then'](respondWithResult(_0x57a5ee,null))[_0xb4d6('0x3d')](handleError(_0x57a5ee,null));};exports[_0xb4d6('0x42')]=function(_0x5880dd,_0x4beea1){return db[_0xb4d6('0x29')][_0xb4d6('0x42')](_0x5880dd['body'],{})[_0xb4d6('0x20')](respondWithResult(_0x4beea1,0xc9))[_0xb4d6('0x3d')](handleError(_0x4beea1,null));};exports[_0xb4d6('0x1f')]=function(_0x4f6492,_0x2965cf){if(_0x4f6492[_0xb4d6('0x43')]['id']){delete _0x4f6492[_0xb4d6('0x43')]['id'];}return db[_0xb4d6('0x29')]['find']({'where':{'id':_0x4f6492[_0xb4d6('0x44')]['id']}})[_0xb4d6('0x20')](handleEntityNotFound(_0x2965cf,null))[_0xb4d6('0x20')](saveUpdates(_0x4f6492['body'],null))['then'](respondWithResult(_0x2965cf,null))[_0xb4d6('0x3d')](handleError(_0x2965cf,null));};exports[_0xb4d6('0x21')]=function(_0x15dd45,_0x2af6ac){return db[_0xb4d6('0x29')]['find']({'where':{'id':_0x15dd45['params']['id']}})[_0xb4d6('0x20')](handleEntityNotFound(_0x2af6ac,null))[_0xb4d6('0x20')](removeEntity(_0x2af6ac,null))[_0xb4d6('0x3d')](handleError(_0x2af6ac,null));};exports[_0xb4d6('0x45')]=function(_0x3c48ae,_0x416fa5){return db[_0xb4d6('0x29')][_0xb4d6('0x45')]()[_0xb4d6('0x20')](respondWithResult(_0x416fa5,null))[_0xb4d6('0x3d')](handleError(_0x416fa5,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b2d5e93..f7e0001 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 _0xe6a1=['update','emit','hasOwnProperty','exports','events','../../mysqldb','MailSubstatus'];(function(_0x392477,_0x4682df){var _0x46a689=function(_0x766f38){while(--_0x766f38){_0x392477['push'](_0x392477['shift']());}};_0x46a689(++_0x4682df);}(_0xe6a1,0xd6));var _0x1e6a=function(_0x229e8b,_0x5a277d){_0x229e8b=_0x229e8b-0x0;var _0x2155db=_0xe6a1[_0x229e8b];return _0x2155db;};'use strict';var EventEmitter=require(_0x1e6a('0x0'));var MailSubstatus=require(_0x1e6a('0x1'))['db'][_0x1e6a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x1e6a('0x3')};function emitEvent(_0x305fe4){return function(_0x19cc80,_0x24b0a9,_0x536472){MailSubstatusEvents[_0x1e6a('0x4')](_0x305fe4+':'+_0x19cc80['id'],_0x19cc80);MailSubstatusEvents[_0x1e6a('0x4')](_0x305fe4,_0x19cc80);_0x536472(null);};}for(var e in events){if(events[_0x1e6a('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x1e6a('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x99e4=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x552c8b,_0x2b3b8b){var _0x5302c0=function(_0x480706){while(--_0x480706){_0x552c8b['push'](_0x552c8b['shift']());}};_0x5302c0(++_0x2b3b8b);}(_0x99e4,0xe4));var _0x499e=function(_0x8821ca,_0x243e11){_0x8821ca=_0x8821ca-0x0;var _0x5a6088=_0x99e4[_0x8821ca];return _0x5a6088;};'use strict';var EventEmitter=require(_0x499e('0x0'));var MailSubstatus=require(_0x499e('0x1'))['db'][_0x499e('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x499e('0x3')](0x0);var events={'afterUpdate':_0x499e('0x4')};function emitEvent(_0x18dead){return function(_0x4b25cc,_0x29c629,_0x2f2419){MailSubstatusEvents[_0x499e('0x5')](_0x18dead+':'+_0x4b25cc['id'],_0x4b25cc);MailSubstatusEvents['emit'](_0x18dead,_0x4b25cc);_0x2f2419(null);};}for(var e in events){if(events[_0x499e('0x6')](e)){var event=events[e];MailSubstatus[_0x499e('0x7')](e,emitEvent(event));}}module[_0x499e('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f4e81e4..c32d1c9 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 _0xdab0=['mail_substatuses','name','mailSubstatus','_previousDataValues','then','exports','MailSubstatus'];(function(_0x2cb631,_0x45bde2){var _0x23b343=function(_0x4f2ae5){while(--_0x4f2ae5){_0x2cb631['push'](_0x2cb631['shift']());}};_0x23b343(++_0x45bde2);}(_0xdab0,0x139));var _0x0dab=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdab0[_0x502c7d];return _0x30b7ed;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x0dab('0x0')]=function(_0x5ae680){var _0x28f408=_0x5ae680['models'];return _0x5ae680['define'](_0x0dab('0x1'),attributes,{'tableName':_0x0dab('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x10ba77,_0x1bedf5,_0x4c2407){return _0x28f408['Condition']['update']({'value':_0x10ba77[_0x0dab('0x3')]},{'where':{'field':_0x0dab('0x4'),'value':_0x10ba77[_0x0dab('0x5')][_0x0dab('0x3')]}})[_0x0dab('0x6')](function(){_0x4c2407();})['catch'](function(_0x3857c5){_0x4c2407(_0x3857c5);});}}});}; \ No newline at end of file +var _0xa04f=['update','name','mailSubstatus','_previousDataValues','then','catch','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x37bc7c,_0x192045){var _0x41775a=function(_0x2d8cf0){while(--_0x2d8cf0){_0x37bc7c['push'](_0x37bc7c['shift']());}};_0x41775a(++_0x192045);}(_0xa04f,0xa0));var _0xfa04=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xa04f[_0x58dc25];return _0x21b0a7;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xfa04('0x0')]=function(_0x3049af){var _0x4911af=_0x3049af[_0xfa04('0x1')];return _0x3049af[_0xfa04('0x2')](_0xfa04('0x3'),attributes,{'tableName':_0xfa04('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3da39d,_0x41152a,_0x31c972){return _0x4911af['Condition'][_0xfa04('0x5')]({'value':_0x3da39d[_0xfa04('0x6')]},{'where':{'field':_0xfa04('0x7'),'value':_0x3da39d[_0xfa04('0x8')][_0xfa04('0x6')]}})[_0xfa04('0x9')](function(){_0x31c972();})[_0xfa04('0xa')](function(_0x2c96b6){_0x31c972(_0x2c96b6);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index be8932f..f59c1b6 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 _0x5582=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x178daf,_0x4c9aa5){var _0x42ad44=function(_0x333f7c){while(--_0x333f7c){_0x178daf['push'](_0x178daf['shift']());}};_0x42ad44(++_0x4c9aa5);}(_0x5582,0x118));var _0x2558=function(_0x3e7710,_0x179e80){_0x3e7710=_0x3e7710-0x0;var _0x1e6269=_0x5582[_0x3e7710];return _0x1e6269;};'use strict';var _=require(_0x2558('0x0'));var util=require(_0x2558('0x1'));var moment=require(_0x2558('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2558('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2558('0x4'))(_0x2558('0x5'));var config=require(_0x2558('0x6'));var jayson=require(_0x2558('0x7'));var client=jayson['client'][_0x2558('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4df128,_0x231b76,_0xa51643){return new BPromise(function(_0x7ae199,_0xfea872){return client[_0x2558('0x9')](_0x4df128,_0xa51643)[_0x2558('0xa')](function(_0x4d0c8a){logger[_0x2558('0xb')](_0x2558('0xc'),_0x231b76,'request\x20sent');logger['debug'](_0x2558('0xd'),_0x231b76,'request\x20sent',JSON[_0x2558('0xe')](_0x4d0c8a));if(_0x4d0c8a[_0x2558('0xf')]){if(_0x4d0c8a['error'][_0x2558('0x10')]===0x1f4){logger[_0x2558('0xf')](_0x2558('0xc'),_0x231b76,_0x4d0c8a[_0x2558('0xf')][_0x2558('0x11')]);return _0xfea872(_0x4d0c8a['error']['message']);}logger['error'](_0x2558('0xc'),_0x231b76,_0x4d0c8a[_0x2558('0xf')][_0x2558('0x11')]);return _0x7ae199(_0x4d0c8a['error']['message']);}else{logger[_0x2558('0xb')](_0x2558('0xc'),_0x231b76,_0x2558('0x12'));_0x7ae199(_0x4d0c8a[_0x2558('0x13')]['message']);}})[_0x2558('0x14')](function(_0x5332f9){logger[_0x2558('0xf')](_0x2558('0xc'),_0x231b76,_0x5332f9);_0xfea872(_0x5332f9);});});} \ No newline at end of file +var _0x3714=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x555132,_0x1b2e95){var _0x2c9499=function(_0x1214ad){while(--_0x1214ad){_0x555132['push'](_0x555132['shift']());}};_0x2c9499(++_0x1b2e95);}(_0x3714,0x95));var _0x4371=function(_0x39c8db,_0x4378b9){_0x39c8db=_0x39c8db-0x0;var _0x1d9407=_0x3714[_0x39c8db];return _0x1d9407;};'use strict';var _=require(_0x4371('0x0'));var util=require(_0x4371('0x1'));var moment=require('moment');var BPromise=require(_0x4371('0x2'));var rs=require(_0x4371('0x3'));var fs=require('fs');var Redis=require(_0x4371('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4371('0x5'));var logger=require(_0x4371('0x6'))(_0x4371('0x7'));var config=require('../../config/environment');var jayson=require(_0x4371('0x8'));var client=jayson['client'][_0x4371('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2280c1,_0x49778e,_0x31a32f){return new BPromise(function(_0x37af33,_0x43a2b4){return client[_0x4371('0xa')](_0x2280c1,_0x31a32f)['then'](function(_0x21fad3){logger['info'](_0x4371('0xb'),_0x49778e,_0x4371('0xc'));logger[_0x4371('0xd')](_0x4371('0xe'),_0x49778e,'request\x20sent',JSON[_0x4371('0xf')](_0x21fad3));if(_0x21fad3[_0x4371('0x10')]){if(_0x21fad3['error'][_0x4371('0x11')]===0x1f4){logger[_0x4371('0x10')](_0x4371('0xb'),_0x49778e,_0x21fad3[_0x4371('0x10')][_0x4371('0x12')]);return _0x43a2b4(_0x21fad3[_0x4371('0x10')][_0x4371('0x12')]);}logger[_0x4371('0x10')](_0x4371('0xb'),_0x49778e,_0x21fad3[_0x4371('0x10')][_0x4371('0x12')]);return _0x37af33(_0x21fad3['error'][_0x4371('0x12')]);}else{logger[_0x4371('0x13')](_0x4371('0xb'),_0x49778e,'request\x20sent');_0x37af33(_0x21fad3[_0x4371('0x14')][_0x4371('0x12')]);}})[_0x4371('0x15')](function(_0xa229c4){logger[_0x4371('0x10')](_0x4371('0xb'),_0x49778e,_0xa229c4);_0x43a2b4(_0xa229c4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3661565..fc58bbd 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 _0x76f3=['../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','path','express','fs-extra'];(function(_0x54ecef,_0x2b78c1){var _0x56c320=function(_0x39d0f7){while(--_0x39d0f7){_0x54ecef['push'](_0x54ecef['shift']());}};_0x56c320(++_0x2b78c1);}(_0x76f3,0x140));var _0x376f=function(_0x311687,_0x35abf7){_0x311687=_0x311687-0x0;var _0x146f26=_0x76f3[_0x311687];return _0x146f26;};'use strict';var multer=require(_0x376f('0x0'));var util=require('util');var path=require(_0x376f('0x1'));var timeout=require('connect-timeout');var express=require(_0x376f('0x2'));var router=express['Router']();var fs_extra=require(_0x376f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x376f('0x4'));var config=require('../../config/environment');var controller=require(_0x376f('0x5'));router[_0x376f('0x6')]('/',auth[_0x376f('0x7')](),controller[_0x376f('0x8')]);router[_0x376f('0x6')](_0x376f('0x9'),auth[_0x376f('0x7')](),controller['describe']);router[_0x376f('0x6')](_0x376f('0xa'),auth[_0x376f('0x7')](),controller[_0x376f('0xb')]);router[_0x376f('0xc')]('/',auth[_0x376f('0x7')](),controller[_0x376f('0xd')]);router[_0x376f('0xe')](_0x376f('0xa'),auth[_0x376f('0x7')](),controller[_0x376f('0xf')]);router[_0x376f('0x10')](_0x376f('0xa'),auth[_0x376f('0x7')](),controller['destroy']);module[_0x376f('0x11')]=router; \ No newline at end of file +var _0x67e9=['util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','multer'];(function(_0x206a64,_0x508189){var _0x293ceb=function(_0x47f36a){while(--_0x47f36a){_0x206a64['push'](_0x206a64['shift']());}};_0x293ceb(++_0x508189);}(_0x67e9,0x120));var _0x967e=function(_0x48b88f,_0x2e1e94){_0x48b88f=_0x48b88f-0x0;var _0x34d441=_0x67e9[_0x48b88f];return _0x34d441;};'use strict';var multer=require(_0x967e('0x0'));var util=require(_0x967e('0x1'));var path=require(_0x967e('0x2'));var timeout=require(_0x967e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x967e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x967e('0x5'));var controller=require('./mailTransferReport.controller');router[_0x967e('0x6')]('/',auth[_0x967e('0x7')](),controller[_0x967e('0x8')]);router[_0x967e('0x6')]('/describe',auth[_0x967e('0x7')](),controller[_0x967e('0x9')]);router[_0x967e('0x6')](_0x967e('0xa'),auth[_0x967e('0x7')](),controller[_0x967e('0xb')]);router[_0x967e('0xc')]('/',auth[_0x967e('0x7')](),controller[_0x967e('0xd')]);router[_0x967e('0xe')](_0x967e('0xa'),auth[_0x967e('0x7')](),controller[_0x967e('0xf')]);router[_0x967e('0x10')]('/:id',auth[_0x967e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 64abcb1..65c49a1 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xcab15c,_0x44f526){var _0x469bd9=function(_0x57a7a3){while(--_0x57a7a3){_0xcab15c['push'](_0xcab15c['shift']());}};_0x469bd9(++_0x44f526);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0xf3cd[_0x4e5552];return _0x60a338;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0xdfb3c3,_0x59788d){var _0x4f9a74=function(_0x2f1544){while(--_0x2f1544){_0xdfb3c3['push'](_0xdfb3c3['shift']());}};_0x4f9a74(++_0x59788d);}(_0x54ef,0x112));var _0xf54e=function(_0x234c54,_0x6788d0){_0x234c54=_0x234c54-0x0;var _0x281132=_0x54ef[_0x234c54];return _0x281132;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cd834cf..da46662 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 _0xd0e9=['options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','filters','pick','merge','where','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd0e9,0x182));var _0x9d0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd0e9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9d0e('0x0'));var rimraf=require(_0x9d0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d0e('0x2'));var rp=require(_0x9d0e('0x3'));var moment=require(_0x9d0e('0x4'));var BPromise=require(_0x9d0e('0x5'));var Mustache=require(_0x9d0e('0x6'));var util=require('util');var path=require(_0x9d0e('0x7'));var sox=require(_0x9d0e('0x8'));var csv=require(_0x9d0e('0x9'));var ejs=require(_0x9d0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9d0e('0xb'));var crypto=require(_0x9d0e('0xc'));var jsforce=require(_0x9d0e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d0e('0xe'));var Redis=require(_0x9d0e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9d0e('0x10'));var as=require(_0x9d0e('0x11'));var hardwareService=require(_0x9d0e('0x12'));var logger=require(_0x9d0e('0x13'))('api');var utils=require(_0x9d0e('0x14'));var config=require(_0x9d0e('0x15'));var licenseUtil=require(_0x9d0e('0x16'));var db=require(_0x9d0e('0x17'))['db'];function respondWithStatusCode(_0x218791,_0x560a54){_0x560a54=_0x560a54||0xcc;return function(_0x2de13d){if(_0x2de13d){return _0x218791[_0x9d0e('0x18')](_0x560a54);}return _0x218791[_0x9d0e('0x19')](_0x560a54)['end']();};}function respondWithResult(_0x5cde67,_0x1a4629){_0x1a4629=_0x1a4629||0xc8;return function(_0x572e5b){if(_0x572e5b){return _0x5cde67[_0x9d0e('0x19')](_0x1a4629)[_0x9d0e('0x1a')](_0x572e5b);}};}function respondWithFilteredResult(_0x258a91,_0x233497){return function(_0x5dff64){if(_0x5dff64){var _0x2c62f1=typeof _0x233497[_0x9d0e('0x1b')]===_0x9d0e('0x1c')&&typeof _0x233497['limit']===_0x9d0e('0x1c');var _0x23f1c5=_0x5dff64[_0x9d0e('0x1d')];var _0x2d8bcf=_0x2c62f1?0x0:_0x233497[_0x9d0e('0x1b')];var _0x3f3da6=_0x2c62f1?_0x5dff64[_0x9d0e('0x1d')]:_0x233497[_0x9d0e('0x1b')]+_0x233497['limit'];var _0x42d189;if(_0x3f3da6>=_0x23f1c5){_0x3f3da6=_0x23f1c5;_0x42d189=0xc8;}else{_0x42d189=0xce;}_0x258a91['status'](_0x42d189);return _0x258a91[_0x9d0e('0x1e')](_0x9d0e('0x1f'),_0x2d8bcf+'-'+_0x3f3da6+'/'+_0x23f1c5)[_0x9d0e('0x1a')](_0x5dff64);}return null;};}function patchUpdates(_0x176fb5){return function(_0x44745f){try{jsonpatch[_0x9d0e('0x20')](_0x44745f,_0x176fb5,!![]);}catch(_0x10668f){return BPromise['reject'](_0x10668f);}return _0x44745f[_0x9d0e('0x21')]();};}function saveUpdates(_0x4be5f0,_0x3e2861){return function(_0x2e5777){if(_0x2e5777){return _0x2e5777[_0x9d0e('0x22')](_0x4be5f0)[_0x9d0e('0x23')](function(_0x381ade){return _0x381ade;});}return null;};}function removeEntity(_0x5e3838,_0xbbacab){return function(_0x1385ba){if(_0x1385ba){return _0x1385ba[_0x9d0e('0x24')]()[_0x9d0e('0x23')](function(){_0x5e3838[_0x9d0e('0x19')](0xcc)[_0x9d0e('0x25')]();});}};}function handleEntityNotFound(_0x1ab0b4,_0x23e4ba){return function(_0xf8a8f8){if(!_0xf8a8f8){_0x1ab0b4[_0x9d0e('0x18')](0x194);}return _0xf8a8f8;};}function handleError(_0x1c00c9,_0x1a1d95){_0x1a1d95=_0x1a1d95||0x1f4;return function(_0x1c62bd){logger[_0x9d0e('0x26')](_0x1c62bd[_0x9d0e('0x27')]);if(_0x1c62bd[_0x9d0e('0x28')]){delete _0x1c62bd[_0x9d0e('0x28')];}_0x1c00c9[_0x9d0e('0x19')](_0x1a1d95)[_0x9d0e('0x29')](_0x1c62bd);};}exports['index']=function(_0x8fdb12,_0x47d1d7){var _0x39f81a={},_0xc7f113={},_0x149289={'count':0x0,'rows':[]};var _0x49d194=_[_0x9d0e('0x2a')](db[_0x9d0e('0x2b')][_0x9d0e('0x2c')],function(_0x2ba9ad){return{'name':_0x2ba9ad[_0x9d0e('0x2d')],'type':_0x2ba9ad[_0x9d0e('0x2e')][_0x9d0e('0x2f')]};});_0xc7f113[_0x9d0e('0x30')]=_[_0x9d0e('0x2a')](_0x49d194,_0x9d0e('0x28'));_0xc7f113[_0x9d0e('0x31')]=_[_0x9d0e('0x32')](_0x8fdb12['query']);_0xc7f113['filters']=_['intersection'](_0xc7f113[_0x9d0e('0x30')],_0xc7f113[_0x9d0e('0x31')]);_0x39f81a[_0x9d0e('0x33')]=_[_0x9d0e('0x34')](_0xc7f113[_0x9d0e('0x30')],qs[_0x9d0e('0x35')](_0x8fdb12['query']['fields']));_0x39f81a['attributes']=_0x39f81a[_0x9d0e('0x33')][_0x9d0e('0x36')]?_0x39f81a[_0x9d0e('0x33')]:_0xc7f113['model'];if(!_0x8fdb12[_0x9d0e('0x31')]['hasOwnProperty'](_0x9d0e('0x37'))){_0x39f81a[_0x9d0e('0x38')]=qs[_0x9d0e('0x38')](_0x8fdb12[_0x9d0e('0x31')]['limit']);_0x39f81a[_0x9d0e('0x1b')]=qs[_0x9d0e('0x1b')](_0x8fdb12['query']['offset']);}_0x39f81a[_0x9d0e('0x39')]=qs[_0x9d0e('0x3a')](_0x8fdb12['query'][_0x9d0e('0x3a')]);_0x39f81a['where']=qs[_0x9d0e('0x3b')](_[_0x9d0e('0x3c')](_0x8fdb12['query'],_0xc7f113[_0x9d0e('0x3b')]),_0x49d194);if(_0x8fdb12['query']['filter']){_0x39f81a['where']=_[_0x9d0e('0x3d')](_0x39f81a[_0x9d0e('0x3e')],{'$or':_[_0x9d0e('0x2a')](_0x49d194,function(_0xe515de){if(_0xe515de[_0x9d0e('0x2e')]!=='VIRTUAL'){var _0x3dcbd3={};_0x3dcbd3[_0xe515de['name']]={'$like':'%'+_0x8fdb12[_0x9d0e('0x31')][_0x9d0e('0x3f')]+'%'};return _0x3dcbd3;}})});}_0x39f81a=_[_0x9d0e('0x3d')]({},_0x39f81a,_0x8fdb12[_0x9d0e('0x40')]);var _0x288f7b={'where':_0x39f81a[_0x9d0e('0x3e')]};return db[_0x9d0e('0x2b')]['count'](_0x288f7b)[_0x9d0e('0x23')](function(_0x5c60ec){_0x149289[_0x9d0e('0x1d')]=_0x5c60ec;if(_0x8fdb12[_0x9d0e('0x31')][_0x9d0e('0x41')]){_0x39f81a[_0x9d0e('0x42')]=[{'all':!![]}];}return db[_0x9d0e('0x2b')][_0x9d0e('0x43')](_0x39f81a);})[_0x9d0e('0x23')](function(_0x4d7155){_0x149289['rows']=_0x4d7155;return _0x149289;})[_0x9d0e('0x23')](respondWithFilteredResult(_0x47d1d7,_0x39f81a))[_0x9d0e('0x44')](handleError(_0x47d1d7,null));};exports[_0x9d0e('0x45')]=function(_0x3647a5,_0x5a8ab6){var _0xa76f91={'raw':!![],'where':{'id':_0x3647a5[_0x9d0e('0x46')]['id']}},_0x26c3b6={};_0x26c3b6['model']=_[_0x9d0e('0x32')](db[_0x9d0e('0x2b')]['rawAttributes']);_0x26c3b6['query']=_['keys'](_0x3647a5['query']);_0x26c3b6['filters']=_['intersection'](_0x26c3b6[_0x9d0e('0x30')],_0x26c3b6[_0x9d0e('0x31')]);_0xa76f91[_0x9d0e('0x33')]=_['intersection'](_0x26c3b6[_0x9d0e('0x30')],qs[_0x9d0e('0x35')](_0x3647a5[_0x9d0e('0x31')][_0x9d0e('0x35')]));_0xa76f91['attributes']=_0xa76f91[_0x9d0e('0x33')][_0x9d0e('0x36')]?_0xa76f91[_0x9d0e('0x33')]:_0x26c3b6[_0x9d0e('0x30')];if(_0x3647a5[_0x9d0e('0x31')][_0x9d0e('0x41')]){_0xa76f91['include']=[{'all':!![]}];}_0xa76f91=_['merge']({},_0xa76f91,_0x3647a5['options']);return db[_0x9d0e('0x2b')]['find'](_0xa76f91)['then'](handleEntityNotFound(_0x5a8ab6,null))['then'](respondWithResult(_0x5a8ab6,null))['catch'](handleError(_0x5a8ab6,null));};exports[_0x9d0e('0x47')]=function(_0x199b27,_0xee19e2){return db[_0x9d0e('0x2b')][_0x9d0e('0x47')](_0x199b27[_0x9d0e('0x48')],{})[_0x9d0e('0x23')](respondWithResult(_0xee19e2,0xc9))['catch'](handleError(_0xee19e2,null));};exports[_0x9d0e('0x22')]=function(_0x5b9da0,_0x2d414b){if(_0x5b9da0[_0x9d0e('0x48')]['id']){delete _0x5b9da0[_0x9d0e('0x48')]['id'];}return db[_0x9d0e('0x2b')]['find']({'where':{'id':_0x5b9da0[_0x9d0e('0x46')]['id']}})[_0x9d0e('0x23')](handleEntityNotFound(_0x2d414b,null))[_0x9d0e('0x23')](saveUpdates(_0x5b9da0[_0x9d0e('0x48')],null))[_0x9d0e('0x23')](respondWithResult(_0x2d414b,null))[_0x9d0e('0x44')](handleError(_0x2d414b,null));};exports['destroy']=function(_0x228460,_0x5aecc0){return db[_0x9d0e('0x2b')][_0x9d0e('0x49')]({'where':{'id':_0x228460[_0x9d0e('0x46')]['id']}})[_0x9d0e('0x23')](handleEntityNotFound(_0x5aecc0,null))[_0x9d0e('0x23')](removeEntity(_0x5aecc0,null))[_0x9d0e('0x44')](handleError(_0x5aecc0,null));};exports[_0x9d0e('0x4a')]=function(_0x5d99a8,_0x4c7e8c){return db[_0x9d0e('0x2b')]['describe']()[_0x9d0e('0x23')](respondWithResult(_0x4c7e8c,null))[_0x9d0e('0x44')](handleError(_0x4c7e8c,null));}; \ No newline at end of file +var _0x72b6=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','map','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x1cb0ac,_0x2755d7){var _0x3d51d6=function(_0x1dacd5){while(--_0x1dacd5){_0x1cb0ac['push'](_0x1cb0ac['shift']());}};_0x3d51d6(++_0x2755d7);}(_0x72b6,0x15d));var _0x672b=function(_0x22c85e,_0x45d421){_0x22c85e=_0x22c85e-0x0;var _0x3f8d11=_0x72b6[_0x22c85e];return _0x3f8d11;};'use strict';var emlformat=require(_0x672b('0x0'));var rimraf=require(_0x672b('0x1'));var zipdir=require(_0x672b('0x2'));var jsonpatch=require(_0x672b('0x3'));var rp=require('request-promise');var moment=require(_0x672b('0x4'));var BPromise=require(_0x672b('0x5'));var Mustache=require(_0x672b('0x6'));var util=require(_0x672b('0x7'));var path=require(_0x672b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x672b('0x9'));var fs=require('fs');var fs_extra=require(_0x672b('0xa'));var _=require('lodash');var squel=require(_0x672b('0xb'));var crypto=require(_0x672b('0xc'));var jsforce=require(_0x672b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x672b('0xe'));var Papa=require(_0x672b('0xf'));var Redis=require(_0x672b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x672b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x672b('0x12'));var logger=require(_0x672b('0x13'))(_0x672b('0x14'));var utils=require('../../config/utils');var config=require(_0x672b('0x15'));var licenseUtil=require(_0x672b('0x16'));var db=require(_0x672b('0x17'))['db'];function respondWithStatusCode(_0x3e64da,_0x2cb302){_0x2cb302=_0x2cb302||0xcc;return function(_0x6c307f){if(_0x6c307f){return _0x3e64da[_0x672b('0x18')](_0x2cb302);}return _0x3e64da[_0x672b('0x19')](_0x2cb302)[_0x672b('0x1a')]();};}function respondWithResult(_0x57b00c,_0x33f3b5){_0x33f3b5=_0x33f3b5||0xc8;return function(_0xeef0f3){if(_0xeef0f3){return _0x57b00c[_0x672b('0x19')](_0x33f3b5)['json'](_0xeef0f3);}};}function respondWithFilteredResult(_0x54771f,_0x4fd7f7){return function(_0x134f23){if(_0x134f23){var _0x447fab=typeof _0x4fd7f7[_0x672b('0x1b')]===_0x672b('0x1c')&&typeof _0x4fd7f7['limit']===_0x672b('0x1c');var _0x13d4d1=_0x134f23[_0x672b('0x1d')];var _0x457876=_0x447fab?0x0:_0x4fd7f7['offset'];var _0x21de31=_0x447fab?_0x134f23['count']:_0x4fd7f7[_0x672b('0x1b')]+_0x4fd7f7[_0x672b('0x1e')];var _0x8e6945;if(_0x21de31>=_0x13d4d1){_0x21de31=_0x13d4d1;_0x8e6945=0xc8;}else{_0x8e6945=0xce;}_0x54771f[_0x672b('0x19')](_0x8e6945);return _0x54771f[_0x672b('0x1f')](_0x672b('0x20'),_0x457876+'-'+_0x21de31+'/'+_0x13d4d1)[_0x672b('0x21')](_0x134f23);}return null;};}function patchUpdates(_0x19d50b){return function(_0x56a2fe){try{jsonpatch[_0x672b('0x22')](_0x56a2fe,_0x19d50b,!![]);}catch(_0x4f57b2){return BPromise[_0x672b('0x23')](_0x4f57b2);}return _0x56a2fe[_0x672b('0x24')]();};}function saveUpdates(_0x278f62,_0x5a87f9){return function(_0x104064){if(_0x104064){return _0x104064[_0x672b('0x25')](_0x278f62)[_0x672b('0x26')](function(_0x228b67){return _0x228b67;});}return null;};}function removeEntity(_0x3f692c,_0x46c2c0){return function(_0x2c0b21){if(_0x2c0b21){return _0x2c0b21[_0x672b('0x27')]()['then'](function(){_0x3f692c[_0x672b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x676fae,_0x55ab45){return function(_0x28c47d){if(!_0x28c47d){_0x676fae['sendStatus'](0x194);}return _0x28c47d;};}function handleError(_0x34c358,_0x4d8f3d){_0x4d8f3d=_0x4d8f3d||0x1f4;return function(_0x1ad8c5){logger[_0x672b('0x28')](_0x1ad8c5['stack']);if(_0x1ad8c5[_0x672b('0x29')]){delete _0x1ad8c5[_0x672b('0x29')];}_0x34c358['status'](_0x4d8f3d)[_0x672b('0x2a')](_0x1ad8c5);};}exports['index']=function(_0x5023f5,_0x13b8ec){var _0x1247af={},_0x17bf65={},_0xfdea0={'count':0x0,'rows':[]};var _0x1660bc=_[_0x672b('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x39ba84){return{'name':_0x39ba84['fieldName'],'type':_0x39ba84[_0x672b('0x2c')]['key']};});_0x17bf65[_0x672b('0x2d')]=_[_0x672b('0x2b')](_0x1660bc,_0x672b('0x29'));_0x17bf65[_0x672b('0x2e')]=_[_0x672b('0x2f')](_0x5023f5[_0x672b('0x2e')]);_0x17bf65['filters']=_[_0x672b('0x30')](_0x17bf65[_0x672b('0x2d')],_0x17bf65['query']);_0x1247af['attributes']=_['intersection'](_0x17bf65[_0x672b('0x2d')],qs[_0x672b('0x31')](_0x5023f5[_0x672b('0x2e')][_0x672b('0x31')]));_0x1247af[_0x672b('0x32')]=_0x1247af['attributes'][_0x672b('0x33')]?_0x1247af[_0x672b('0x32')]:_0x17bf65[_0x672b('0x2d')];if(!_0x5023f5[_0x672b('0x2e')][_0x672b('0x34')](_0x672b('0x35'))){_0x1247af['limit']=qs[_0x672b('0x1e')](_0x5023f5['query']['limit']);_0x1247af[_0x672b('0x1b')]=qs[_0x672b('0x1b')](_0x5023f5[_0x672b('0x2e')][_0x672b('0x1b')]);}_0x1247af['order']=qs[_0x672b('0x36')](_0x5023f5[_0x672b('0x2e')][_0x672b('0x36')]);_0x1247af[_0x672b('0x37')]=qs['filters'](_['pick'](_0x5023f5[_0x672b('0x2e')],_0x17bf65[_0x672b('0x38')]),_0x1660bc);if(_0x5023f5[_0x672b('0x2e')][_0x672b('0x39')]){_0x1247af[_0x672b('0x37')]=_[_0x672b('0x3a')](_0x1247af['where'],{'$or':_['map'](_0x1660bc,function(_0x3c321d){if(_0x3c321d[_0x672b('0x2c')]!==_0x672b('0x3b')){var _0xab0a9d={};_0xab0a9d[_0x3c321d[_0x672b('0x29')]]={'$like':'%'+_0x5023f5['query'][_0x672b('0x39')]+'%'};return _0xab0a9d;}})});}_0x1247af=_[_0x672b('0x3a')]({},_0x1247af,_0x5023f5[_0x672b('0x3c')]);var _0x477335={'where':_0x1247af[_0x672b('0x37')]};return db[_0x672b('0x3d')][_0x672b('0x1d')](_0x477335)[_0x672b('0x26')](function(_0xd9f2e6){_0xfdea0[_0x672b('0x1d')]=_0xd9f2e6;if(_0x5023f5['query'][_0x672b('0x3e')]){_0x1247af['include']=[{'all':!![]}];}return db[_0x672b('0x3d')][_0x672b('0x3f')](_0x1247af);})[_0x672b('0x26')](function(_0x36005e){_0xfdea0['rows']=_0x36005e;return _0xfdea0;})[_0x672b('0x26')](respondWithFilteredResult(_0x13b8ec,_0x1247af))[_0x672b('0x40')](handleError(_0x13b8ec,null));};exports[_0x672b('0x41')]=function(_0x17e36f,_0x20ac0b){var _0x3dbef3={'raw':!![],'where':{'id':_0x17e36f['params']['id']}},_0x15b232={};_0x15b232[_0x672b('0x2d')]=_[_0x672b('0x2f')](db['MailTransferReport'][_0x672b('0x42')]);_0x15b232[_0x672b('0x2e')]=_['keys'](_0x17e36f['query']);_0x15b232[_0x672b('0x38')]=_[_0x672b('0x30')](_0x15b232[_0x672b('0x2d')],_0x15b232[_0x672b('0x2e')]);_0x3dbef3[_0x672b('0x32')]=_[_0x672b('0x30')](_0x15b232['model'],qs['fields'](_0x17e36f['query'][_0x672b('0x31')]));_0x3dbef3[_0x672b('0x32')]=_0x3dbef3[_0x672b('0x32')][_0x672b('0x33')]?_0x3dbef3[_0x672b('0x32')]:_0x15b232[_0x672b('0x2d')];if(_0x17e36f[_0x672b('0x2e')]['includeAll']){_0x3dbef3[_0x672b('0x43')]=[{'all':!![]}];}_0x3dbef3=_[_0x672b('0x3a')]({},_0x3dbef3,_0x17e36f['options']);return db[_0x672b('0x3d')][_0x672b('0x44')](_0x3dbef3)['then'](handleEntityNotFound(_0x20ac0b,null))['then'](respondWithResult(_0x20ac0b,null))[_0x672b('0x40')](handleError(_0x20ac0b,null));};exports[_0x672b('0x45')]=function(_0x4fd384,_0x361eec){return db[_0x672b('0x3d')][_0x672b('0x45')](_0x4fd384['body'],{})[_0x672b('0x26')](respondWithResult(_0x361eec,0xc9))[_0x672b('0x40')](handleError(_0x361eec,null));};exports[_0x672b('0x25')]=function(_0x2f3277,_0x5ee09a){if(_0x2f3277['body']['id']){delete _0x2f3277[_0x672b('0x46')]['id'];}return db['MailTransferReport'][_0x672b('0x44')]({'where':{'id':_0x2f3277['params']['id']}})[_0x672b('0x26')](handleEntityNotFound(_0x5ee09a,null))['then'](saveUpdates(_0x2f3277[_0x672b('0x46')],null))['then'](respondWithResult(_0x5ee09a,null))[_0x672b('0x40')](handleError(_0x5ee09a,null));};exports[_0x672b('0x27')]=function(_0x3ce607,_0x34b3b9){return db[_0x672b('0x3d')][_0x672b('0x44')]({'where':{'id':_0x3ce607['params']['id']}})['then'](handleEntityNotFound(_0x34b3b9,null))[_0x672b('0x26')](removeEntity(_0x34b3b9,null))[_0x672b('0x40')](handleError(_0x34b3b9,null));};exports[_0x672b('0x47')]=function(_0x16811e,_0x1d8f91){return db[_0x672b('0x3d')][_0x672b('0x47')]()[_0x672b('0x26')](respondWithResult(_0x1d8f91,null))['catch'](handleError(_0x1d8f91,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 814dffb..24e8c2b 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 _0xc4a1=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x4726a0,_0x5b5979){_0x4726a0=_0x4726a0-0x0;var _0x2fa2a1=_0xc4a1[_0x4726a0];return _0x2fa2a1;};'use strict';var _=require(_0x1c4a('0x0'));var util=require('util');var logger=require(_0x1c4a('0x1'))(_0x1c4a('0x2'));var moment=require(_0x1c4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c4a('0x4'));var fs=require('fs');var path=require(_0x1c4a('0x5'));var rimraf=require(_0x1c4a('0x6'));var config=require(_0x1c4a('0x7'));var attributes=require(_0x1c4a('0x8'));module[_0x1c4a('0x9')]=function(_0x2685b1,_0x4732b2){return _0x2685b1[_0x1c4a('0xa')](_0x1c4a('0xb'),attributes,{'tableName':_0x1c4a('0xc'),'paranoid':![],'indexes':[{'name':_0x1c4a('0xd'),'fields':[_0x1c4a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fed=['../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x29dc09,_0x4951ba){var _0x4bb079=function(_0xee975e){while(--_0xee975e){_0x29dc09['push'](_0x29dc09['shift']());}};_0x4bb079(++_0x4951ba);}(_0x8fed,0xab));var _0xd8fe=function(_0x5d1216,_0x4a576b){_0x5d1216=_0x5d1216-0x0;var _0x143a48=_0x8fed[_0x5d1216];return _0x143a48;};'use strict';var _=require(_0xd8fe('0x0'));var util=require(_0xd8fe('0x1'));var logger=require(_0xd8fe('0x2'))(_0xd8fe('0x3'));var moment=require(_0xd8fe('0x4'));var BPromise=require(_0xd8fe('0x5'));var rp=require(_0xd8fe('0x6'));var fs=require('fs');var path=require(_0xd8fe('0x7'));var rimraf=require(_0xd8fe('0x8'));var config=require(_0xd8fe('0x9'));var attributes=require(_0xd8fe('0xa'));module[_0xd8fe('0xb')]=function(_0x343d98,_0x143f41){return _0x343d98['define'](_0xd8fe('0xc'),attributes,{'tableName':_0xd8fe('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd8fe('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 311601d..8a2ec45 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 _0x6a4a=['client','http','request','then','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','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a4a,0x14f));var _0xa6a4=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x6a4a[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0xa6a4('0x0'));var util=require(_0xa6a4('0x1'));var moment=require(_0xa6a4('0x2'));var BPromise=require(_0xa6a4('0x3'));var rs=require(_0xa6a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6a4('0x5'))['db'];var utils=require(_0xa6a4('0x6'));var logger=require(_0xa6a4('0x7'))(_0xa6a4('0x8'));var config=require(_0xa6a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa6a4('0xa')][_0xa6a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b36d,_0x4e0ddb,_0x5f5782){return new BPromise(function(_0x5d78a9,_0x12a33d){return client[_0xa6a4('0xc')](_0x56b36d,_0x5f5782)[_0xa6a4('0xd')](function(_0x202dc5){logger['info'](_0xa6a4('0xe'),_0x4e0ddb,_0xa6a4('0xf'));logger[_0xa6a4('0x10')](_0xa6a4('0x11'),_0x4e0ddb,_0xa6a4('0xf'),JSON[_0xa6a4('0x12')](_0x202dc5));if(_0x202dc5[_0xa6a4('0x13')]){if(_0x202dc5[_0xa6a4('0x13')][_0xa6a4('0x14')]===0x1f4){logger[_0xa6a4('0x13')](_0xa6a4('0xe'),_0x4e0ddb,_0x202dc5[_0xa6a4('0x13')][_0xa6a4('0x15')]);return _0x12a33d(_0x202dc5[_0xa6a4('0x13')][_0xa6a4('0x15')]);}logger['error'](_0xa6a4('0xe'),_0x4e0ddb,_0x202dc5['error'][_0xa6a4('0x15')]);return _0x5d78a9(_0x202dc5['error']['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x4e0ddb,_0xa6a4('0xf'));_0x5d78a9(_0x202dc5[_0xa6a4('0x16')][_0xa6a4('0x15')]);}})['catch'](function(_0x153fc7){logger[_0xa6a4('0x13')](_0xa6a4('0xe'),_0x4e0ddb,_0x153fc7);_0x12a33d(_0x153fc7);});});} \ No newline at end of file +var _0x0b2a=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment','randomstring','ioredis'];(function(_0x4a4378,_0x1c7b85){var _0x7cc462=function(_0x4b4486){while(--_0x4b4486){_0x4a4378['push'](_0x4a4378['shift']());}};_0x7cc462(++_0x1c7b85);}(_0x0b2a,0x88));var _0xa0b2=function(_0x2b50fa,_0x193c01){_0x2b50fa=_0x2b50fa-0x0;var _0x34ffc2=_0x0b2a[_0x2b50fa];return _0x34ffc2;};'use strict';var _=require(_0xa0b2('0x0'));var util=require('util');var moment=require(_0xa0b2('0x1'));var BPromise=require('bluebird');var rs=require(_0xa0b2('0x2'));var fs=require('fs');var Redis=require(_0xa0b2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0b2('0x4'));var logger=require(_0xa0b2('0x5'))(_0xa0b2('0x6'));var config=require(_0xa0b2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa0b2('0x8')][_0xa0b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5937a7,_0x98ef88,_0x146ae9){return new BPromise(function(_0x4553bd,_0xe1082f){return client[_0xa0b2('0xa')](_0x5937a7,_0x146ae9)[_0xa0b2('0xb')](function(_0x50b5dd){logger[_0xa0b2('0xc')](_0xa0b2('0xd'),_0x98ef88,_0xa0b2('0xe'));logger[_0xa0b2('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x98ef88,_0xa0b2('0xe'),JSON['stringify'](_0x50b5dd));if(_0x50b5dd[_0xa0b2('0x10')]){if(_0x50b5dd['error'][_0xa0b2('0x11')]===0x1f4){logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x50b5dd[_0xa0b2('0x10')][_0xa0b2('0x12')]);return _0xe1082f(_0x50b5dd['error'][_0xa0b2('0x12')]);}logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x50b5dd['error']['message']);return _0x4553bd(_0x50b5dd[_0xa0b2('0x10')][_0xa0b2('0x12')]);}else{logger['info'](_0xa0b2('0xd'),_0x98ef88,_0xa0b2('0xe'));_0x4553bd(_0x50b5dd['result']['message']);}})[_0xa0b2('0x13')](function(_0x2506d3){logger[_0xa0b2('0x10')](_0xa0b2('0xd'),_0x98ef88,_0x2506d3);_0xe1082f(_0x2506d3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index fe41bdb..1654fca 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 _0x7a53=['get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','/describe','describe'];(function(_0x22d5e5,_0x34205f){var _0x2cd8f9=function(_0x558f6c){while(--_0x558f6c){_0x22d5e5['push'](_0x22d5e5['shift']());}};_0x2cd8f9(++_0x34205f);}(_0x7a53,0x78));var _0x37a5=function(_0x23ff50,_0x4f9eea){_0x23ff50=_0x23ff50-0x0;var _0x41b613=_0x7a53[_0x23ff50];return _0x41b613;};'use strict';var multer=require(_0x37a5('0x0'));var util=require(_0x37a5('0x1'));var path=require('path');var timeout=require(_0x37a5('0x2'));var express=require(_0x37a5('0x3'));var router=express[_0x37a5('0x4')]();var fs_extra=require(_0x37a5('0x5'));var auth=require(_0x37a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x37a5('0x7'));var controller=require(_0x37a5('0x8'));router['get']('/',auth[_0x37a5('0x9')](),controller['index']);router['get'](_0x37a5('0xa'),auth['isAuthenticated'](),controller[_0x37a5('0xb')]);router[_0x37a5('0xc')](_0x37a5('0xd'),auth[_0x37a5('0x9')](),controller[_0x37a5('0xe')]);router[_0x37a5('0xf')]('/',auth[_0x37a5('0x9')](),controller[_0x37a5('0x10')]);router[_0x37a5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x37a5('0x12')]);router[_0x37a5('0x13')]('/:id',auth[_0x37a5('0x9')](),controller[_0x37a5('0x14')]);module[_0x37a5('0x15')]=router; \ No newline at end of file +var _0xb67c=['get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x4be15e,_0x55144f){var _0x1014c6=function(_0x332ffa){while(--_0x332ffa){_0x4be15e['push'](_0x4be15e['shift']());}};_0x1014c6(++_0x55144f);}(_0xb67c,0x1ec));var _0xcb67=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0xb67c[_0x14363e];return _0x17c56d;};'use strict';var multer=require('multer');var util=require(_0xcb67('0x0'));var path=require('path');var timeout=require(_0xcb67('0x1'));var express=require(_0xcb67('0x2'));var router=express['Router']();var fs_extra=require(_0xcb67('0x3'));var auth=require(_0xcb67('0x4'));var interaction=require(_0xcb67('0x5'));var config=require(_0xcb67('0x6'));var controller=require(_0xcb67('0x7'));router[_0xcb67('0x8')]('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xa')]);router[_0xcb67('0x8')](_0xcb67('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcb67('0xc')]);router[_0xcb67('0xd')]('/',auth[_0xcb67('0x9')](),controller[_0xcb67('0xe')]);router[_0xcb67('0xf')](_0xcb67('0x10'),auth[_0xcb67('0x9')](),controller[_0xcb67('0x11')]);router[_0xcb67('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcb67('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 886e546..e0c0ef8 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 _0x69e9=['DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x32cb8a,_0x4543b9){var _0x228c3c=function(_0x4dd2ec){while(--_0x4dd2ec){_0x32cb8a['push'](_0x32cb8a['shift']());}};_0x228c3c(++_0x4543b9);}(_0x69e9,0x145));var _0x969e=function(_0x1d0fee,_0x37de69){_0x1d0fee=_0x1d0fee-0x0;var _0x199c29=_0x69e9[_0x1d0fee];return _0x199c29;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x969e('0x0'));module[_0x969e('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x969e('0x2')]},'interface':{'type':Sequelize[_0x969e('0x2')]},'type':{'type':Sequelize[_0x969e('0x2')],'defaultValue':_0x969e('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x969e('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x969e('0x5')],'set':function(_0x15133c){var _0x4b6354=moment(_0x15133c);var _0x57910f=moment(this[_0x969e('0x6')](_0x969e('0x7')));var _0xf88d39=_0x4b6354[_0x969e('0x8')](_0x57910f,'seconds');this[_0x969e('0x9')]('exitAt',_0x15133c);this['setDataValue'](_0x969e('0xa'),_0xf88d39>=0x0?_0xf88d39:null);}},'data1':{'type':Sequelize[_0x969e('0x2')],'comment':_0x969e('0xb')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x969e('0x2')],'comment':_0x969e('0xc')},'data4':{'type':Sequelize[_0x969e('0x2')],'comment':_0x969e('0xd')},'data5':{'type':Sequelize[_0x969e('0x2')],'comment':_0x969e('0xe')},'role':{'type':Sequelize[_0x969e('0x2')]},'internal':{'type':Sequelize[_0x969e('0x4')]},'uniqueid':{'type':Sequelize[_0x969e('0x2')]}}; \ No newline at end of file +var _0xc529=['getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4d110c,_0x41eeb4){var _0x5bdf52=function(_0x5d4fb5){while(--_0x5d4fb5){_0x4d110c['push'](_0x4d110c['shift']());}};_0x5bdf52(++_0x41eeb4);}(_0xc529,0x109));var _0x9c52=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xc529[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x9c52('0x0'));var moment=require(_0x9c52('0x1'));module[_0x9c52('0x2')]={'channel':{'type':Sequelize[_0x9c52('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9c52('0x3')]},'type':{'type':Sequelize[_0x9c52('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x9c52('0x4')},'duration':{'type':Sequelize[_0x9c52('0x5')]},'enterAt':{'type':Sequelize[_0x9c52('0x6')]},'exitAt':{'type':Sequelize[_0x9c52('0x6')],'set':function(_0x3d470f){var _0x59fbe2=moment(_0x3d470f);var _0x564844=moment(this[_0x9c52('0x7')](_0x9c52('0x8')));var _0x316c5a=_0x59fbe2['diff'](_0x564844,_0x9c52('0x9'));this[_0x9c52('0xa')](_0x9c52('0xb'),_0x3d470f);this[_0x9c52('0xa')]('duration',_0x316c5a>=0x0?_0x316c5a:null);}},'data1':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xc')},'data2':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xd')},'data3':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xe')},'data4':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0xf')},'data5':{'type':Sequelize[_0x9c52('0x3')],'comment':_0x9c52('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9c52('0x5')]},'uniqueid':{'type':Sequelize[_0x9c52('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 88cf266..007f80e 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x248246,_0x2afdfe){var _0x51870f=function(_0x1f22ce){while(--_0x1f22ce){_0x248246['push'](_0x248246['shift']());}};_0x51870f(++_0x2afdfe);}(_0x3e74,0x175));var _0x43e7=function(_0x19b8b8,_0x458692){_0x19b8b8=_0x19b8b8-0x0;var _0x4d536e=_0x3e74[_0x19b8b8];return _0x4d536e;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _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(_0x57b5db,_0x1b29e8){var _0x2141e5=function(_0x127576){while(--_0x127576){_0x57b5db['push'](_0x57b5db['shift']());}};_0x2141e5(++_0x1b29e8);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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 f7e2469..1f80485 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 _0xaef4=['membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaef4,0x197));var _0x4aef=function(_0x3908ce,_0x16b18e){_0x3908ce=_0x3908ce-0x0;var _0x5be885=_0xaef4[_0x3908ce];return _0x5be885;};'use strict';var _=require(_0x4aef('0x0'));var util=require(_0x4aef('0x1'));var logger=require(_0x4aef('0x2'))(_0x4aef('0x3'));var moment=require(_0x4aef('0x4'));var BPromise=require(_0x4aef('0x5'));var rp=require(_0x4aef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4aef('0x7'));var attributes=require(_0x4aef('0x8'));module[_0x4aef('0x9')]=function(_0x2fb653,_0x39d51a){return _0x2fb653[_0x4aef('0xa')]('MemberReport',attributes,{'tableName':_0x4aef('0xb'),'paranoid':![],'indexes':[{'name':_0x4aef('0xc'),'fields':[_0x4aef('0xd'),_0x4aef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x861a=['request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','../../config/logger','api','moment'];(function(_0x277a5c,_0x5c8937){var _0x1b7138=function(_0x929069){while(--_0x929069){_0x277a5c['push'](_0x277a5c['shift']());}};_0x1b7138(++_0x5c8937);}(_0x861a,0xcd));var _0xa861=function(_0x36951e,_0x19be68){_0x36951e=_0x36951e-0x0;var _0x11bbd2=_0x861a[_0x36951e];return _0x11bbd2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa861('0x0'))(_0xa861('0x1'));var moment=require(_0xa861('0x2'));var BPromise=require('bluebird');var rp=require(_0xa861('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa861('0x4'));var config=require(_0xa861('0x5'));var attributes=require(_0xa861('0x6'));module[_0xa861('0x7')]=function(_0x5165fe,_0x58e201){return _0x5165fe[_0xa861('0x8')](_0xa861('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xa861('0xa'),'fields':[_0xa861('0xb'),_0xa861('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 9009c69..927f927 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 _0xbf4e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','create','body','UpdateMemberReport'];(function(_0x1c6aac,_0x4f2400){var _0x220a85=function(_0x3d79e9){while(--_0x3d79e9){_0x1c6aac['push'](_0x1c6aac['shift']());}};_0x220a85(++_0x4f2400);}(_0xbf4e,0x172));var _0xebf4=function(_0x5c9fcf,_0x20e61e){_0x5c9fcf=_0x5c9fcf-0x0;var _0x2c1e9e=_0xbf4e[_0x5c9fcf];return _0x2c1e9e;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var moment=require(_0xebf4('0x2'));var BPromise=require(_0xebf4('0x3'));var rs=require(_0xebf4('0x4'));var fs=require('fs');var Redis=require(_0xebf4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebf4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xebf4('0x7'));var jayson=require(_0xebf4('0x8'));var client=jayson['client'][_0xebf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x995254,_0x33ff2b,_0x48764f){return new BPromise(function(_0x2f17c0,_0xcfaf52){return client[_0xebf4('0xa')](_0x995254,_0x48764f)[_0xebf4('0xb')](function(_0x50df01){logger[_0xebf4('0xc')](_0xebf4('0xd'),_0x33ff2b,_0xebf4('0xe'));logger[_0xebf4('0xf')](_0xebf4('0x10'),_0x33ff2b,_0xebf4('0xe'),JSON[_0xebf4('0x11')](_0x50df01));if(_0x50df01[_0xebf4('0x12')]){if(_0x50df01[_0xebf4('0x12')]['code']===0x1f4){logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x50df01[_0xebf4('0x12')]['message']);return _0xcfaf52(_0x50df01['error'][_0xebf4('0x13')]);}logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x50df01[_0xebf4('0x12')][_0xebf4('0x13')]);return _0x2f17c0(_0x50df01[_0xebf4('0x12')][_0xebf4('0x13')]);}else{logger[_0xebf4('0xc')](_0xebf4('0xd'),_0x33ff2b,_0xebf4('0xe'));_0x2f17c0(_0x50df01[_0xebf4('0x14')][_0xebf4('0x13')]);}})[_0xebf4('0x15')](function(_0x2b0259){logger[_0xebf4('0x12')](_0xebf4('0xd'),_0x33ff2b,_0x2b0259);_0xcfaf52(_0x2b0259);});});}exports[_0xebf4('0x16')]=function(_0x4e83a8){var _0x5e1b61=this;return new Promise(function(_0x5db628,_0x4256a3){return db[_0xebf4('0x17')][_0xebf4('0x18')]({'raw':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1b')]||null:null,'attributes':_0x4e83a8['options']?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1c')]||null:null,'limit':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')][_0xebf4('0x1d')]||null:null,'include':_0x4e83a8[_0xebf4('0x19')]?_0x4e83a8[_0xebf4('0x19')]['include']?_[_0xebf4('0x1e')](_0x4e83a8[_0xebf4('0x19')]['include'],function(_0x526034){return{'model':db[_0x526034['model']],'as':_0x526034['as'],'attributes':_0x526034['attributes'],'include':_0x526034[_0xebf4('0x1f')]?_[_0xebf4('0x1e')](_0x526034[_0xebf4('0x1f')],function(_0x31c070){return{'model':db[_0x31c070[_0xebf4('0x20')]],'as':_0x31c070['as'],'attributes':_0x31c070[_0xebf4('0x1c')],'include':_0x31c070[_0xebf4('0x1f')]?_[_0xebf4('0x1e')](_0x31c070['include'],function(_0x19527e){return{'model':db[_0x19527e['model']],'as':_0x19527e['as'],'attributes':_0x19527e[_0xebf4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xebf4('0xb')](function(_0x534272){logger[_0xebf4('0xc')](_0xebf4('0x16'),_0x4e83a8);logger['debug'](_0xebf4('0x16'),_0x4e83a8,JSON['stringify'](_0x534272));_0x5db628(_0x534272);})[_0xebf4('0x15')](function(_0x3632c9){logger['error'](_0xebf4('0x16'),_0x3632c9['message'],_0x4e83a8);_0x4256a3(_0x5e1b61['error'](0x1f4,_0x3632c9['message']));});});};exports[_0xebf4('0x21')]=function(_0x329804){var _0x4a3b36=this;return new Promise(function(_0x416b66,_0x24f35a){return db['MemberReport'][_0xebf4('0x22')](_0x329804[_0xebf4('0x23')],{'raw':_0x329804[_0xebf4('0x19')]?_0x329804[_0xebf4('0x19')][_0xebf4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1580ea){logger[_0xebf4('0xc')](_0xebf4('0x21'),_0x329804);logger[_0xebf4('0xf')](_0xebf4('0x21'),_0x329804,JSON[_0xebf4('0x11')](_0x1580ea));_0x416b66(_0x1580ea);})[_0xebf4('0x15')](function(_0x1e253d){logger['error'](_0xebf4('0x21'),_0x1e253d[_0xebf4('0x13')],_0x329804);_0x24f35a(_0x4a3b36[_0xebf4('0x12')](0x1f4,_0x1e253d[_0xebf4('0x13')]));});});};exports['UpdateMemberReport']=function(_0x4b2a98){var _0x2e84e1=this;return new Promise(function(_0x8bd741,_0xd982a0){return db['MemberReport']['update'](_0x4b2a98[_0xebf4('0x23')],{'raw':_0x4b2a98[_0xebf4('0x19')]?_0x4b2a98['options'][_0xebf4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b2a98['options']?_0x4b2a98[_0xebf4('0x19')][_0xebf4('0x1b')]||null:null,'attributes':_0x4b2a98[_0xebf4('0x19')]?_0x4b2a98['options'][_0xebf4('0x1c')]||null:null,'limit':_0x4b2a98['options']?_0x4b2a98[_0xebf4('0x19')][_0xebf4('0x1d')]||null:null})[_0xebf4('0xb')](function(_0xf6da9a){logger[_0xebf4('0xc')](_0xebf4('0x24'),_0x4b2a98);logger[_0xebf4('0xf')](_0xebf4('0x24'),_0x4b2a98,JSON[_0xebf4('0x11')](_0xf6da9a));_0x8bd741(_0xf6da9a);})['catch'](function(_0x5b8d85){logger[_0xebf4('0x12')](_0xebf4('0x24'),_0x5b8d85[_0xebf4('0x13')],_0x4b2a98);_0xd982a0(_0x2e84e1['error'](0x1f4,_0x5b8d85[_0xebf4('0x13')]));});});}; \ No newline at end of file +var _0xee3c=['where','attributes','limit','include','model','map','CreateMemberReport','create','update','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0xaec0f0,_0x40a3b1){var _0x148af9=function(_0x1841fd){while(--_0x1841fd){_0xaec0f0['push'](_0xaec0f0['shift']());}};_0x148af9(++_0x40a3b1);}(_0xee3c,0x14a));var _0xcee3=function(_0x434298,_0x5c1c2c){_0x434298=_0x434298-0x0;var _0x6e2c13=_0xee3c[_0x434298];return _0x6e2c13;};'use strict';var _=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var moment=require(_0xcee3('0x2'));var BPromise=require(_0xcee3('0x3'));var rs=require(_0xcee3('0x4'));var fs=require('fs');var Redis=require(_0xcee3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcee3('0x6'))(_0xcee3('0x7'));var config=require(_0xcee3('0x8'));var jayson=require(_0xcee3('0x9'));var client=jayson[_0xcee3('0xa')][_0xcee3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8ffe,_0x97f00e,_0x22953c){return new BPromise(function(_0x364eb2,_0x4770ed){return client[_0xcee3('0xc')](_0x3b8ffe,_0x22953c)[_0xcee3('0xd')](function(_0x81de8e){logger[_0xcee3('0xe')]('MemberReport,\x20%s,\x20%s',_0x97f00e,_0xcee3('0xf'));logger[_0xcee3('0x10')](_0xcee3('0x11'),_0x97f00e,_0xcee3('0xf'),JSON[_0xcee3('0x12')](_0x81de8e));if(_0x81de8e[_0xcee3('0x13')]){if(_0x81de8e['error'][_0xcee3('0x14')]===0x1f4){logger[_0xcee3('0x13')](_0xcee3('0x15'),_0x97f00e,_0x81de8e[_0xcee3('0x13')][_0xcee3('0x16')]);return _0x4770ed(_0x81de8e['error'][_0xcee3('0x16')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x97f00e,_0x81de8e['error'][_0xcee3('0x16')]);return _0x364eb2(_0x81de8e[_0xcee3('0x13')]['message']);}else{logger['info'](_0xcee3('0x15'),_0x97f00e,'request\x20sent');_0x364eb2(_0x81de8e[_0xcee3('0x17')]['message']);}})[_0xcee3('0x18')](function(_0x952a21){logger['error'](_0xcee3('0x15'),_0x97f00e,_0x952a21);_0x4770ed(_0x952a21);});});}exports[_0xcee3('0x19')]=function(_0x40cb8b){var _0x2295c=this;return new Promise(function(_0x50bf6e,_0x164073){return db[_0xcee3('0x1a')][_0xcee3('0x1b')]({'raw':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b['options'][_0xcee3('0x1d')]===undefined?!![]:![]:!![],'where':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x1e')]||null:null,'attributes':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x1f')]||null:null,'limit':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x20')]||null:null,'include':_0x40cb8b[_0xcee3('0x1c')]?_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x21')]?_['map'](_0x40cb8b[_0xcee3('0x1c')][_0xcee3('0x21')],function(_0x240736){return{'model':db[_0x240736[_0xcee3('0x22')]],'as':_0x240736['as'],'attributes':_0x240736[_0xcee3('0x1f')],'include':_0x240736['include']?_['map'](_0x240736[_0xcee3('0x21')],function(_0x5b92ba){return{'model':db[_0x5b92ba['model']],'as':_0x5b92ba['as'],'attributes':_0x5b92ba[_0xcee3('0x1f')],'include':_0x5b92ba['include']?_[_0xcee3('0x23')](_0x5b92ba[_0xcee3('0x21')],function(_0x19a15e){return{'model':db[_0x19a15e['model']],'as':_0x19a15e['as'],'attributes':_0x19a15e[_0xcee3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f457d){logger['info'](_0xcee3('0x19'),_0x40cb8b);logger[_0xcee3('0x10')]('GetMemberReport',_0x40cb8b,JSON[_0xcee3('0x12')](_0x4f457d));_0x50bf6e(_0x4f457d);})[_0xcee3('0x18')](function(_0x5c1a32){logger[_0xcee3('0x13')]('GetMemberReport',_0x5c1a32['message'],_0x40cb8b);_0x164073(_0x2295c[_0xcee3('0x13')](0x1f4,_0x5c1a32['message']));});});};exports[_0xcee3('0x24')]=function(_0x1da1e6){var _0x375cab=this;return new Promise(function(_0x1b9087,_0x331290){return db[_0xcee3('0x1a')][_0xcee3('0x25')](_0x1da1e6['body'],{'raw':_0x1da1e6[_0xcee3('0x1c')]?_0x1da1e6['options'][_0xcee3('0x1d')]===undefined?!![]:![]:!![]})[_0xcee3('0xd')](function(_0x272ac8){logger[_0xcee3('0xe')](_0xcee3('0x24'),_0x1da1e6);logger[_0xcee3('0x10')](_0xcee3('0x24'),_0x1da1e6,JSON[_0xcee3('0x12')](_0x272ac8));_0x1b9087(_0x272ac8);})['catch'](function(_0x220867){logger[_0xcee3('0x13')](_0xcee3('0x24'),_0x220867['message'],_0x1da1e6);_0x331290(_0x375cab[_0xcee3('0x13')](0x1f4,_0x220867[_0xcee3('0x16')]));});});};exports['UpdateMemberReport']=function(_0x35c415){var _0x509ca6=this;return new Promise(function(_0x2a4996,_0x4b5c41){return db['MemberReport'][_0xcee3('0x26')](_0x35c415['body'],{'raw':_0x35c415[_0xcee3('0x1c')]?_0x35c415[_0xcee3('0x1c')][_0xcee3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35c415[_0xcee3('0x1c')]?_0x35c415['options']['where']||null:null,'attributes':_0x35c415[_0xcee3('0x1c')]?_0x35c415[_0xcee3('0x1c')]['attributes']||null:null,'limit':_0x35c415[_0xcee3('0x1c')]?_0x35c415[_0xcee3('0x1c')]['limit']||null:null})[_0xcee3('0xd')](function(_0x20df38){logger[_0xcee3('0xe')](_0xcee3('0x27'),_0x35c415);logger[_0xcee3('0x10')](_0xcee3('0x27'),_0x35c415,JSON['stringify'](_0x20df38));_0x2a4996(_0x20df38);})[_0xcee3('0x18')](function(_0x149b93){logger[_0xcee3('0x13')](_0xcee3('0x27'),_0x149b93[_0xcee3('0x16')],_0x35c415);_0x4b5c41(_0x509ca6[_0xcee3('0x13')](0x1f4,_0x149b93[_0xcee3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 186e3ac..7119503 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 _0x43d7=['express','../../components/auth/service','../../components/interaction/service','get','index','exports','multer','util','path'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x43d7,0x7b));var _0x743d=function(_0x5dd679,_0x2e0e6c){_0x5dd679=_0x5dd679-0x0;var _0x57fb83=_0x43d7[_0x5dd679];return _0x57fb83;};'use strict';var multer=require(_0x743d('0x0'));var util=require(_0x743d('0x1'));var path=require(_0x743d('0x2'));var timeout=require('connect-timeout');var express=require(_0x743d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x743d('0x4'));var interaction=require(_0x743d('0x5'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x743d('0x6')]('/',controller[_0x743d('0x7')]);module[_0x743d('0x8')]=router; \ No newline at end of file +var _0xec37=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports'];(function(_0x280f80,_0x57ad7f){var _0x2e7beb=function(_0x67b522){while(--_0x67b522){_0x280f80['push'](_0x280f80['shift']());}};_0x2e7beb(++_0x57ad7f);}(_0xec37,0xd2));var _0x7ec3=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xec37[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x7ec3('0x0'));var util=require(_0x7ec3('0x1'));var path=require('path');var timeout=require(_0x7ec3('0x2'));var express=require('express');var router=express[_0x7ec3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7ec3('0x4'));var interaction=require(_0x7ec3('0x5'));var config=require(_0x7ec3('0x6'));var controller=require('./migration.controller');router[_0x7ec3('0x7')]('/',controller[_0x7ec3('0x8')]);module[_0x7ec3('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 bd408aa..d4db341 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 _0xc037=['exports','STRING','version','sequelize'];(function(_0x50227f,_0x1d47cc){var _0x127366=function(_0x2e3525){while(--_0x2e3525){_0x50227f['push'](_0x50227f['shift']());}};_0x127366(++_0x1d47cc);}(_0xc037,0x1a3));var _0x7c03=function(_0x41e897,_0xed153c){_0x41e897=_0x41e897-0x0;var _0x13f47f=_0xc037[_0x41e897];return _0x13f47f;};'use strict';var Sequelize=require(_0x7c03('0x0'));module[_0x7c03('0x1')]={'version':{'type':Sequelize[_0x7c03('0x2')],'unique':_0x7c03('0x3')}}; \ No newline at end of file +var _0x3b78=['STRING','version','sequelize','exports'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x3b78,0x15e));var _0x83b7=function(_0x3a3500,_0x37c562){_0x3a3500=_0x3a3500-0x0;var _0x84a50d=_0x3b78[_0x3a3500];return _0x84a50d;};'use strict';var Sequelize=require(_0x83b7('0x0'));module[_0x83b7('0x1')]={'version':{'type':Sequelize[_0x83b7('0x2')],'unique':_0x83b7('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1ad80e8..9f28b09 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 _0x2ebf=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','Migration','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils'];(function(_0x3838e8,_0x458431){var _0x1599e2=function(_0x55ffef){while(--_0x55ffef){_0x3838e8['push'](_0x3838e8['shift']());}};_0x1599e2(++_0x458431);}(_0x2ebf,0x179));var _0xf2eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ebf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf2eb('0x0'));var rimraf=require(_0xf2eb('0x1'));var zipdir=require(_0xf2eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2eb('0x3'));var moment=require(_0xf2eb('0x4'));var BPromise=require(_0xf2eb('0x5'));var Mustache=require(_0xf2eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf2eb('0x7'));var csv=require(_0xf2eb('0x8'));var ejs=require(_0xf2eb('0x9'));var fs=require('fs');var fs_extra=require(_0xf2eb('0xa'));var _=require('lodash');var squel=require(_0xf2eb('0xb'));var crypto=require('crypto');var jsforce=require(_0xf2eb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf2eb('0x8'));var querystring=require('querystring');var Papa=require(_0xf2eb('0xd'));var Redis=require(_0xf2eb('0xe'));var authService=require(_0xf2eb('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2eb('0x10'))(_0xf2eb('0x11'));var utils=require(_0xf2eb('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf2eb('0x13'));var db=require(_0xf2eb('0x14'))['db'];function respondWithStatusCode(_0x488b41,_0xd94b87){_0xd94b87=_0xd94b87||0xcc;return function(_0x42d9ba){if(_0x42d9ba){return _0x488b41[_0xf2eb('0x15')](_0xd94b87);}return _0x488b41[_0xf2eb('0x16')](_0xd94b87)[_0xf2eb('0x17')]();};}function respondWithResult(_0x311b64,_0x25d342){_0x25d342=_0x25d342||0xc8;return function(_0x27ba9b){if(_0x27ba9b){return _0x311b64[_0xf2eb('0x16')](_0x25d342)[_0xf2eb('0x18')](_0x27ba9b);}};}function respondWithFilteredResult(_0x45a24d,_0x2b4155){return function(_0x595c39){if(_0x595c39){var _0x2addd1=typeof _0x2b4155['offset']==='undefined'&&typeof _0x2b4155[_0xf2eb('0x19')]===_0xf2eb('0x1a');var _0x5edee9=_0x595c39[_0xf2eb('0x1b')];var _0x12c200=_0x2addd1?0x0:_0x2b4155[_0xf2eb('0x1c')];var _0x5a216d=_0x2addd1?_0x595c39[_0xf2eb('0x1b')]:_0x2b4155['offset']+_0x2b4155[_0xf2eb('0x19')];var _0x5b0352;if(_0x5a216d>=_0x5edee9){_0x5a216d=_0x5edee9;_0x5b0352=0xc8;}else{_0x5b0352=0xce;}_0x45a24d[_0xf2eb('0x16')](_0x5b0352);return _0x45a24d['set'](_0xf2eb('0x1d'),_0x12c200+'-'+_0x5a216d+'/'+_0x5edee9)[_0xf2eb('0x18')](_0x595c39);}return null;};}function patchUpdates(_0xbf8a62){return function(_0x1bdc4c){try{jsonpatch[_0xf2eb('0x1e')](_0x1bdc4c,_0xbf8a62,!![]);}catch(_0x10ce27){return BPromise['reject'](_0x10ce27);}return _0x1bdc4c[_0xf2eb('0x1f')]();};}function saveUpdates(_0x4ac6d5,_0x3ad932){return function(_0x261047){if(_0x261047){return _0x261047[_0xf2eb('0x20')](_0x4ac6d5)['then'](function(_0x366fc0){return _0x366fc0;});}return null;};}function removeEntity(_0xe8d802,_0x1fd29f){return function(_0x4c6e40){if(_0x4c6e40){return _0x4c6e40[_0xf2eb('0x21')]()[_0xf2eb('0x22')](function(){_0xe8d802[_0xf2eb('0x16')](0xcc)[_0xf2eb('0x17')]();});}};}function handleEntityNotFound(_0x45592a,_0x48c348){return function(_0x1f1943){if(!_0x1f1943){_0x45592a[_0xf2eb('0x15')](0x194);}return _0x1f1943;};}function handleError(_0x4d4d8f,_0x46f479){_0x46f479=_0x46f479||0x1f4;return function(_0x48013b){logger[_0xf2eb('0x23')](_0x48013b[_0xf2eb('0x24')]);if(_0x48013b[_0xf2eb('0x25')]){delete _0x48013b['name'];}_0x4d4d8f[_0xf2eb('0x16')](_0x46f479)[_0xf2eb('0x26')](_0x48013b);};}exports[_0xf2eb('0x27')]=function(_0x2f721f,_0x3faf5a){var _0x1c904d={},_0x33529e={},_0x3d6710={'count':0x0,'rows':[]};var _0x152225=_['map'](db[_0xf2eb('0x28')]['rawAttributes'],function(_0x255d55){return{'name':_0x255d55[_0xf2eb('0x29')],'type':_0x255d55[_0xf2eb('0x2a')][_0xf2eb('0x2b')]};});_0x33529e['model']=_[_0xf2eb('0x2c')](_0x152225,_0xf2eb('0x25'));_0x33529e[_0xf2eb('0x2d')]=_['keys'](_0x2f721f['query']);_0x33529e[_0xf2eb('0x2e')]=_[_0xf2eb('0x2f')](_0x33529e[_0xf2eb('0x30')],_0x33529e['query']);_0x1c904d[_0xf2eb('0x31')]=_[_0xf2eb('0x2f')](_0x33529e[_0xf2eb('0x30')],qs[_0xf2eb('0x32')](_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x32')]));_0x1c904d[_0xf2eb('0x31')]=_0x1c904d['attributes'][_0xf2eb('0x33')]?_0x1c904d[_0xf2eb('0x31')]:_0x33529e['model'];if(!_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x34')](_0xf2eb('0x35'))){_0x1c904d[_0xf2eb('0x19')]=qs['limit'](_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x19')]);_0x1c904d[_0xf2eb('0x1c')]=qs[_0xf2eb('0x1c')](_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x1c')]);}_0x1c904d[_0xf2eb('0x36')]=qs[_0xf2eb('0x37')](_0x2f721f['query'][_0xf2eb('0x37')]);_0x1c904d['where']=qs['filters'](_[_0xf2eb('0x38')](_0x2f721f[_0xf2eb('0x2d')],_0x33529e[_0xf2eb('0x2e')]),_0x152225);if(_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x39')]){_0x1c904d[_0xf2eb('0x3a')]=_['merge'](_0x1c904d[_0xf2eb('0x3a')],{'$or':_[_0xf2eb('0x2c')](_0x152225,function(_0x464edd){if(_0x464edd[_0xf2eb('0x2a')]!==_0xf2eb('0x3b')){var _0x21b8e6={};_0x21b8e6[_0x464edd[_0xf2eb('0x25')]]={'$like':'%'+_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x39')]+'%'};return _0x21b8e6;}})});}_0x1c904d=_[_0xf2eb('0x3c')]({},_0x1c904d,_0x2f721f[_0xf2eb('0x3d')]);var _0x4d0e49={'where':_0x1c904d[_0xf2eb('0x3a')]};return db['Migration'][_0xf2eb('0x1b')](_0x4d0e49)['then'](function(_0x52a30d){_0x3d6710[_0xf2eb('0x1b')]=_0x52a30d;if(_0x2f721f[_0xf2eb('0x2d')][_0xf2eb('0x3e')]){_0x1c904d['include']=[{'all':!![]}];}return db['Migration'][_0xf2eb('0x3f')](_0x1c904d);})[_0xf2eb('0x22')](function(_0x1d31c2){_0x3d6710[_0xf2eb('0x40')]=_0x1d31c2;return _0x3d6710;})[_0xf2eb('0x22')](respondWithFilteredResult(_0x3faf5a,_0x1c904d))[_0xf2eb('0x41')](handleError(_0x3faf5a,null));}; \ No newline at end of file +var _0xc208=['query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','index','map','Migration','fieldName','type','key','model'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xc208,0x148));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c20('0x0'));var zipdir=require(_0x8c20('0x1'));var jsonpatch=require(_0x8c20('0x2'));var rp=require(_0x8c20('0x3'));var moment=require(_0x8c20('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8c20('0x5'));var util=require('util');var path=require(_0x8c20('0x6'));var sox=require('sox');var csv=require(_0x8c20('0x7'));var ejs=require(_0x8c20('0x8'));var fs=require('fs');var fs_extra=require(_0x8c20('0x9'));var _=require(_0x8c20('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8c20('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c20('0xd'));var qs=require(_0x8c20('0xe'));var as=require(_0x8c20('0xf'));var hardwareService=require(_0x8c20('0x10'));var logger=require(_0x8c20('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x8c20('0x12'));var licenseUtil=require(_0x8c20('0x13'));var db=require(_0x8c20('0x14'))['db'];function respondWithStatusCode(_0x2ed77e,_0x31eca0){_0x31eca0=_0x31eca0||0xcc;return function(_0x475695){if(_0x475695){return _0x2ed77e[_0x8c20('0x15')](_0x31eca0);}return _0x2ed77e[_0x8c20('0x16')](_0x31eca0)[_0x8c20('0x17')]();};}function respondWithResult(_0x1d375f,_0x33943f){_0x33943f=_0x33943f||0xc8;return function(_0x86c0de){if(_0x86c0de){return _0x1d375f['status'](_0x33943f)[_0x8c20('0x18')](_0x86c0de);}};}function respondWithFilteredResult(_0x53b0ad,_0x523774){return function(_0x51cd9c){if(_0x51cd9c){var _0x293b84=typeof _0x523774['offset']===_0x8c20('0x19')&&typeof _0x523774[_0x8c20('0x1a')]===_0x8c20('0x19');var _0x1a5789=_0x51cd9c[_0x8c20('0x1b')];var _0x12b376=_0x293b84?0x0:_0x523774[_0x8c20('0x1c')];var _0x3dcee0=_0x293b84?_0x51cd9c[_0x8c20('0x1b')]:_0x523774[_0x8c20('0x1c')]+_0x523774[_0x8c20('0x1a')];var _0x34efff;if(_0x3dcee0>=_0x1a5789){_0x3dcee0=_0x1a5789;_0x34efff=0xc8;}else{_0x34efff=0xce;}_0x53b0ad[_0x8c20('0x16')](_0x34efff);return _0x53b0ad['set'](_0x8c20('0x1d'),_0x12b376+'-'+_0x3dcee0+'/'+_0x1a5789)[_0x8c20('0x18')](_0x51cd9c);}return null;};}function patchUpdates(_0x12a4e8){return function(_0x3b939f){try{jsonpatch[_0x8c20('0x1e')](_0x3b939f,_0x12a4e8,!![]);}catch(_0x13cbaf){return BPromise['reject'](_0x13cbaf);}return _0x3b939f[_0x8c20('0x1f')]();};}function saveUpdates(_0x175347,_0x5db8df){return function(_0x89e6f5){if(_0x89e6f5){return _0x89e6f5[_0x8c20('0x20')](_0x175347)[_0x8c20('0x21')](function(_0x3f6d62){return _0x3f6d62;});}return null;};}function removeEntity(_0x5b3a39,_0x17a113){return function(_0x41af6a){if(_0x41af6a){return _0x41af6a[_0x8c20('0x22')]()[_0x8c20('0x21')](function(){_0x5b3a39[_0x8c20('0x16')](0xcc)[_0x8c20('0x17')]();});}};}function handleEntityNotFound(_0x10d1b4,_0x438f62){return function(_0x342dc0){if(!_0x342dc0){_0x10d1b4[_0x8c20('0x15')](0x194);}return _0x342dc0;};}function handleError(_0x4c0343,_0x1c18ab){_0x1c18ab=_0x1c18ab||0x1f4;return function(_0x566d65){logger['error'](_0x566d65[_0x8c20('0x23')]);if(_0x566d65[_0x8c20('0x24')]){delete _0x566d65[_0x8c20('0x24')];}_0x4c0343['status'](_0x1c18ab)['send'](_0x566d65);};}exports[_0x8c20('0x25')]=function(_0x1e2a66,_0x5e0a28){var _0x5aac56={},_0x27b396={},_0xcb2833={'count':0x0,'rows':[]};var _0x31430a=_[_0x8c20('0x26')](db[_0x8c20('0x27')]['rawAttributes'],function(_0x294ae5){return{'name':_0x294ae5[_0x8c20('0x28')],'type':_0x294ae5[_0x8c20('0x29')][_0x8c20('0x2a')]};});_0x27b396[_0x8c20('0x2b')]=_[_0x8c20('0x26')](_0x31430a,_0x8c20('0x24'));_0x27b396[_0x8c20('0x2c')]=_['keys'](_0x1e2a66[_0x8c20('0x2c')]);_0x27b396['filters']=_[_0x8c20('0x2d')](_0x27b396[_0x8c20('0x2b')],_0x27b396[_0x8c20('0x2c')]);_0x5aac56[_0x8c20('0x2e')]=_[_0x8c20('0x2d')](_0x27b396[_0x8c20('0x2b')],qs[_0x8c20('0x2f')](_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x2f')]));_0x5aac56['attributes']=_0x5aac56[_0x8c20('0x2e')][_0x8c20('0x30')]?_0x5aac56[_0x8c20('0x2e')]:_0x27b396[_0x8c20('0x2b')];if(!_0x1e2a66[_0x8c20('0x2c')]['hasOwnProperty'](_0x8c20('0x31'))){_0x5aac56['limit']=qs[_0x8c20('0x1a')](_0x1e2a66['query']['limit']);_0x5aac56[_0x8c20('0x1c')]=qs[_0x8c20('0x1c')](_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x1c')]);}_0x5aac56[_0x8c20('0x32')]=qs[_0x8c20('0x33')](_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x33')]);_0x5aac56[_0x8c20('0x34')]=qs[_0x8c20('0x35')](_[_0x8c20('0x36')](_0x1e2a66[_0x8c20('0x2c')],_0x27b396[_0x8c20('0x35')]),_0x31430a);if(_0x1e2a66['query'][_0x8c20('0x37')]){_0x5aac56[_0x8c20('0x34')]=_[_0x8c20('0x38')](_0x5aac56[_0x8c20('0x34')],{'$or':_[_0x8c20('0x26')](_0x31430a,function(_0x153ea2){if(_0x153ea2[_0x8c20('0x29')]!==_0x8c20('0x39')){var _0x550c20={};_0x550c20[_0x153ea2[_0x8c20('0x24')]]={'$like':'%'+_0x1e2a66[_0x8c20('0x2c')][_0x8c20('0x37')]+'%'};return _0x550c20;}})});}_0x5aac56=_[_0x8c20('0x38')]({},_0x5aac56,_0x1e2a66[_0x8c20('0x3a')]);var _0x365976={'where':_0x5aac56[_0x8c20('0x34')]};return db[_0x8c20('0x27')][_0x8c20('0x1b')](_0x365976)[_0x8c20('0x21')](function(_0x594dc0){_0xcb2833[_0x8c20('0x1b')]=_0x594dc0;if(_0x1e2a66['query'][_0x8c20('0x3b')]){_0x5aac56[_0x8c20('0x3c')]=[{'all':!![]}];}return db['Migration'][_0x8c20('0x3d')](_0x5aac56);})[_0x8c20('0x21')](function(_0x548a7a){_0xcb2833['rows']=_0x548a7a;return _0xcb2833;})[_0x8c20('0x21')](respondWithFilteredResult(_0x5e0a28,_0x5aac56))['catch'](handleError(_0x5e0a28,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 782cdc4..a4bd009 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 _0xd846=['rimraf','../../config/environment','exports','define','Migration','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0xd846,0x12e));var _0x6d84=function(_0x3c8e84,_0x2cb6a2){_0x3c8e84=_0x3c8e84-0x0;var _0x1b0f7c=_0xd846[_0x3c8e84];return _0x1b0f7c;};'use strict';var _=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var logger=require(_0x6d84('0x2'))(_0x6d84('0x3'));var moment=require(_0x6d84('0x4'));var BPromise=require('bluebird');var rp=require(_0x6d84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d84('0x6'));var config=require(_0x6d84('0x7'));var attributes=require('./migration.attributes');module[_0x6d84('0x8')]=function(_0x1838dc,_0x16bced){return _0x1838dc[_0x6d84('0x9')](_0x6d84('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03fc=['define','Migration','migrations','util','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0x03fc,0x121));var _0xc03f=function(_0x53dee9,_0x1dc404){_0x53dee9=_0x53dee9-0x0;var _0x4c5da0=_0x03fc[_0x53dee9];return _0x4c5da0;};'use strict';var _=require('lodash');var util=require(_0xc03f('0x0'));var logger=require('../../config/logger')(_0xc03f('0x1'));var moment=require(_0xc03f('0x2'));var BPromise=require(_0xc03f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc03f('0x4'));var rimraf=require(_0xc03f('0x5'));var config=require(_0xc03f('0x6'));var attributes=require('./migration.attributes');module[_0xc03f('0x7')]=function(_0x30218d,_0x4be7af){return _0x30218d[_0xc03f('0x8')](_0xc03f('0x9'),attributes,{'tableName':_0xc03f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 50f98ac..f02801f 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 _0xbc8b=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0xbc8b[_0x3e8cae];return _0x45c4d6;};'use strict';var _=require('lodash');var util=require(_0xbbc8('0x0'));var moment=require('moment');var BPromise=require(_0xbbc8('0x1'));var rs=require(_0xbbc8('0x2'));var fs=require('fs');var Redis=require(_0xbbc8('0x3'));var db=require(_0xbbc8('0x4'))['db'];var utils=require(_0xbbc8('0x5'));var logger=require(_0xbbc8('0x6'))('rpc');var config=require(_0xbbc8('0x7'));var jayson=require(_0xbbc8('0x8'));var client=jayson[_0xbbc8('0x9')][_0xbbc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c3d7,_0x5dee88,_0x396aa2){return new BPromise(function(_0x313a01,_0x515917){return client[_0xbbc8('0xb')](_0x18c3d7,_0x396aa2)[_0xbbc8('0xc')](function(_0x255dd2){logger[_0xbbc8('0xd')](_0xbbc8('0xe'),_0x5dee88,_0xbbc8('0xf'));logger[_0xbbc8('0x10')](_0xbbc8('0x11'),_0x5dee88,_0xbbc8('0xf'),JSON[_0xbbc8('0x12')](_0x255dd2));if(_0x255dd2[_0xbbc8('0x13')]){if(_0x255dd2[_0xbbc8('0x13')]['code']===0x1f4){logger[_0xbbc8('0x13')](_0xbbc8('0xe'),_0x5dee88,_0x255dd2[_0xbbc8('0x13')]['message']);return _0x515917(_0x255dd2['error'][_0xbbc8('0x14')]);}logger['error'](_0xbbc8('0xe'),_0x5dee88,_0x255dd2[_0xbbc8('0x13')][_0xbbc8('0x14')]);return _0x313a01(_0x255dd2[_0xbbc8('0x13')][_0xbbc8('0x14')]);}else{logger[_0xbbc8('0xd')](_0xbbc8('0xe'),_0x5dee88,_0xbbc8('0xf'));_0x313a01(_0x255dd2[_0xbbc8('0x15')][_0xbbc8('0x14')]);}})[_0xbbc8('0x16')](function(_0x2438f){logger[_0xbbc8('0x13')](_0xbbc8('0xe'),_0x5dee88,_0x2438f);_0x515917(_0x2438f);});});} \ No newline at end of file +var _0x8aa7=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x203dc4,_0x588f8e){var _0x58e84b=function(_0x4d00de){while(--_0x4d00de){_0x203dc4['push'](_0x203dc4['shift']());}};_0x58e84b(++_0x588f8e);}(_0x8aa7,0xb6));var _0x78aa=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x8aa7[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Migration,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index dce7c6d..f9c31eb 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 _0x6b1b=['get','isAuthenticated','index','/:id','show','create','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x5ea5a9,_0x4217ec){var _0x33f6e9=function(_0x4b1e74){while(--_0x4b1e74){_0x5ea5a9['push'](_0x5ea5a9['shift']());}};_0x33f6e9(++_0x4217ec);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6b1b[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var timeout=require(_0xb6b1('0x2'));var express=require('express');var router=express[_0xb6b1('0x3')]();var fs_extra=require(_0xb6b1('0x4'));var auth=require(_0xb6b1('0x5'));var interaction=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var controller=require(_0xb6b1('0x8'));router[_0xb6b1('0x9')]('/',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0xb')]);router[_0xb6b1('0x9')](_0xb6b1('0xc'),auth['isAuthenticated'](),controller[_0xb6b1('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb6b1('0xe')]);router['put'](_0xb6b1('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xb6b1('0xa')](),controller[_0xb6b1('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9906=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','update','destroy'];(function(_0x5ae409,_0x133671){var _0x2761a9=function(_0xa0f33b){while(--_0xa0f33b){_0x5ae409['push'](_0x5ae409['shift']());}};_0x2761a9(++_0x133671);}(_0x9906,0x1f1));var _0x6990=function(_0xe8bfe9,_0x54e593){_0xe8bfe9=_0xe8bfe9-0x0;var _0x2781a7=_0x9906[_0xe8bfe9];return _0x2781a7;};'use strict';var multer=require(_0x6990('0x0'));var util=require(_0x6990('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6990('0x2'));var router=express[_0x6990('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6990('0x4'));var interaction=require(_0x6990('0x5'));var config=require(_0x6990('0x6'));var controller=require('./network.controller');router[_0x6990('0x7')]('/',auth[_0x6990('0x8')](),controller[_0x6990('0x9')]);router['get'](_0x6990('0xa'),auth[_0x6990('0x8')](),controller['show']);router[_0x6990('0xb')]('/',auth[_0x6990('0x8')](),controller[_0x6990('0xc')]);router['put'](_0x6990('0xa'),auth['isAuthenticated'](),controller[_0x6990('0xd')]);router['delete'](_0x6990('0xa'),auth[_0x6990('0x8')](),controller[_0x6990('0xe')]);module[_0x6990('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 20d2b1b..05ab560 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 _0x7ec0=['sequelize','ENUM','stun','turn','STRING'];(function(_0x4c692d,_0x421e58){var _0xa81cd1=function(_0x20a6ea){while(--_0x20a6ea){_0x4c692d['push'](_0x4c692d['shift']());}};_0xa81cd1(++_0x421e58);}(_0x7ec0,0xe1));var _0x07ec=function(_0x4bdf32,_0x3155c7){_0x4bdf32=_0x4bdf32-0x0;var _0x21f5fa=_0x7ec0[_0x4bdf32];return _0x21f5fa;};'use strict';var Sequelize=require(_0x07ec('0x0'));module['exports']={'type':{'type':Sequelize[_0x07ec('0x1')]('localnet','externip',_0x07ec('0x2'),_0x07ec('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x07ec('0x4')]},'password':{'type':Sequelize[_0x07ec('0x4')]}}; \ No newline at end of file +var _0x8e57=['sequelize','exports','STRING'];(function(_0x54ecdb,_0x26d783){var _0x572726=function(_0x8c160){while(--_0x8c160){_0x54ecdb['push'](_0x54ecdb['shift']());}};_0x572726(++_0x26d783);}(_0x8e57,0x171));var _0x78e5=function(_0x262510,_0x484630){_0x262510=_0x262510-0x0;var _0xdb8479=_0x8e57[_0x262510];return _0xdb8479;};'use strict';var Sequelize=require(_0x78e5('0x0'));module[_0x78e5('0x1')]={'type':{'type':Sequelize['ENUM']('localnet','externip','stun','turn')},'value':{'type':Sequelize[_0x78e5('0x2')]},'username':{'type':Sequelize[_0x78e5('0x2')]},'password':{'type':Sequelize[_0x78e5('0x2')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index da94165..b6645a2 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 _0x541f=['offset','status','Content-Range','apply','reject','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Network','findAll','rows','show','keys','find','catch','transaction','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','sequelize','params','/etc/asterisk/stun_xcally.conf','update','toLowerCase','rimraf','fast-json-patch','request-promise','bluebird','util','path','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','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','json','undefined','limit','count'];(function(_0xd637a3,_0x19b904){var _0x180a84=function(_0x2fc05a){while(--_0x2fc05a){_0xd637a3['push'](_0xd637a3['shift']());}};_0x180a84(++_0x19b904);}(_0x541f,0x1f2));var _0xf541=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x541f[_0xef8146];return _0x5a6cb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf541('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf541('0x1'));var rp=require(_0xf541('0x2'));var moment=require('moment');var BPromise=require(_0xf541('0x3'));var Mustache=require('mustache');var util=require(_0xf541('0x4'));var path=require(_0xf541('0x5'));var sox=require('sox');var csv=require(_0xf541('0x6'));var ejs=require(_0xf541('0x7'));var fs=require('fs');var fs_extra=require(_0xf541('0x8'));var _=require(_0xf541('0x9'));var squel=require(_0xf541('0xa'));var crypto=require(_0xf541('0xb'));var jsforce=require(_0xf541('0xc'));var deskjs=require(_0xf541('0xd'));var toCsv=require(_0xf541('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf541('0xe'));var authService=require(_0xf541('0xf'));var qs=require(_0xf541('0x10'));var as=require(_0xf541('0x11'));var hardwareService=require(_0xf541('0x12'));var logger=require(_0xf541('0x13'))(_0xf541('0x14'));var utils=require(_0xf541('0x15'));var config=require(_0xf541('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf541('0x17'))['db'];var jayson=require(_0xf541('0x18'));var client=jayson[_0xf541('0x19')][_0xf541('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1a381b,_0x45b6ba,_0x4c4e60,_0x496383){return new BPromise(function(_0x4d932a,_0xd7d686){var _0x10be55=_0x496383||client;return _0x10be55[_0xf541('0x1b')](_0x1a381b,_0x4c4e60)[_0xf541('0x1c')](function(_0x508346){logger[_0xf541('0x1d')](_0xf541('0x1e'),_0x45b6ba,'request\x20sent');logger['debug'](_0xf541('0x1f'),_0x45b6ba,_0xf541('0x20'),JSON['stringify'](_0x508346));if(_0x508346[_0xf541('0x21')]){if(_0x508346[_0xf541('0x21')][_0xf541('0x22')]===0x1f4){logger[_0xf541('0x21')]('Network,\x20%s,\x20%s',_0x45b6ba,_0x508346['error'][_0xf541('0x23')]);return _0xd7d686(_0x508346[_0xf541('0x21')]['message']);}logger[_0xf541('0x21')](_0xf541('0x1e'),_0x45b6ba,_0x508346[_0xf541('0x21')]['message']);return _0x4d932a(_0x508346[_0xf541('0x21')][_0xf541('0x23')]);}else{logger[_0xf541('0x1d')](_0xf541('0x1e'),_0x45b6ba,_0xf541('0x20'));_0x4d932a(_0x508346[_0xf541('0x24')][_0xf541('0x23')]);}})['catch'](function(_0x53104c){logger['error'](_0xf541('0x1e'),_0x45b6ba,_0x53104c);_0xd7d686(_0x53104c);});});}function respondWithStatusCode(_0x247ff8,_0x5e969f){_0x5e969f=_0x5e969f||0xcc;return function(_0x112f35){if(_0x112f35){return _0x247ff8[_0xf541('0x25')](_0x5e969f);}return _0x247ff8['status'](_0x5e969f)['end']();};}function respondWithResult(_0x3b1184,_0x19a6a2){_0x19a6a2=_0x19a6a2||0xc8;return function(_0x3e9416){if(_0x3e9416){return _0x3b1184['status'](_0x19a6a2)[_0xf541('0x26')](_0x3e9416);}};}function respondWithFilteredResult(_0x4b6ffb,_0x4c9a1){return function(_0x94c018){if(_0x94c018){var _0x146b31=typeof _0x4c9a1['offset']===_0xf541('0x27')&&typeof _0x4c9a1[_0xf541('0x28')]===_0xf541('0x27');var _0x13c38f=_0x94c018[_0xf541('0x29')];var _0x27a81f=_0x146b31?0x0:_0x4c9a1[_0xf541('0x2a')];var _0x263a86=_0x146b31?_0x94c018[_0xf541('0x29')]:_0x4c9a1[_0xf541('0x2a')]+_0x4c9a1['limit'];var _0x29b05e;if(_0x263a86>=_0x13c38f){_0x263a86=_0x13c38f;_0x29b05e=0xc8;}else{_0x29b05e=0xce;}_0x4b6ffb[_0xf541('0x2b')](_0x29b05e);return _0x4b6ffb['set'](_0xf541('0x2c'),_0x27a81f+'-'+_0x263a86+'/'+_0x13c38f)[_0xf541('0x26')](_0x94c018);}return null;};}function patchUpdates(_0x12a1af){return function(_0x55579a){try{jsonpatch[_0xf541('0x2d')](_0x55579a,_0x12a1af,!![]);}catch(_0x11985d){return BPromise[_0xf541('0x2e')](_0x11985d);}return _0x55579a['save']();};}function saveUpdates(_0x296e0f,_0x3ee0b1){return function(_0x409788){if(_0x409788){return _0x409788['update'](_0x296e0f)[_0xf541('0x1c')](function(_0x1dd3ed){return _0x1dd3ed;});}return null;};}function removeEntity(_0x2fae86,_0x3bceb7){return function(_0x388417){if(_0x388417){return _0x388417[_0xf541('0x2f')]()[_0xf541('0x1c')](function(){_0x2fae86[_0xf541('0x2b')](0xcc)[_0xf541('0x30')]();});}};}function handleEntityNotFound(_0x3de183,_0x3aa768){return function(_0x49209a){if(!_0x49209a){_0x3de183[_0xf541('0x25')](0x194);}return _0x49209a;};}function handleError(_0x2047bb,_0x539a25){_0x539a25=_0x539a25||0x1f4;return function(_0x3cb7f1){logger[_0xf541('0x21')](_0x3cb7f1['stack']);if(_0x3cb7f1['name']){delete _0x3cb7f1[_0xf541('0x31')];}_0x2047bb[_0xf541('0x2b')](_0x539a25)[_0xf541('0x32')](_0x3cb7f1);};}exports[_0xf541('0x33')]=function(_0x43faa0,_0x3cd36b){var _0x105184={},_0x3bb15e={},_0x536edc={'count':0x0,'rows':[]};var _0x4eb415=_['map'](db['Network'][_0xf541('0x34')],function(_0x34869d){return{'name':_0x34869d[_0xf541('0x35')],'type':_0x34869d[_0xf541('0x36')][_0xf541('0x37')]};});_0x3bb15e[_0xf541('0x38')]=_[_0xf541('0x39')](_0x4eb415,'name');_0x3bb15e['query']=_['keys'](_0x43faa0[_0xf541('0x3a')]);_0x3bb15e[_0xf541('0x3b')]=_['intersection'](_0x3bb15e['model'],_0x3bb15e['query']);_0x105184[_0xf541('0x3c')]=_[_0xf541('0x3d')](_0x3bb15e[_0xf541('0x38')],qs[_0xf541('0x3e')](_0x43faa0[_0xf541('0x3a')][_0xf541('0x3e')]));_0x105184['attributes']=_0x105184[_0xf541('0x3c')][_0xf541('0x3f')]?_0x105184[_0xf541('0x3c')]:_0x3bb15e[_0xf541('0x38')];if(!_0x43faa0[_0xf541('0x3a')][_0xf541('0x40')](_0xf541('0x41'))){_0x105184[_0xf541('0x28')]=qs[_0xf541('0x28')](_0x43faa0[_0xf541('0x3a')][_0xf541('0x28')]);_0x105184[_0xf541('0x2a')]=qs[_0xf541('0x2a')](_0x43faa0[_0xf541('0x3a')][_0xf541('0x2a')]);}_0x105184[_0xf541('0x42')]=qs[_0xf541('0x43')](_0x43faa0[_0xf541('0x3a')][_0xf541('0x43')]);_0x105184[_0xf541('0x44')]=qs[_0xf541('0x3b')](_[_0xf541('0x45')](_0x43faa0['query'],_0x3bb15e[_0xf541('0x3b')]),_0x4eb415);if(_0x43faa0[_0xf541('0x3a')][_0xf541('0x46')]){_0x105184[_0xf541('0x44')]=_[_0xf541('0x47')](_0x105184['where'],{'$or':_['map'](_0x4eb415,function(_0x5558f0){if(_0x5558f0['type']!=='VIRTUAL'){var _0x15a1fe={};_0x15a1fe[_0x5558f0[_0xf541('0x31')]]={'$like':'%'+_0x43faa0[_0xf541('0x3a')][_0xf541('0x46')]+'%'};return _0x15a1fe;}})});}_0x105184=_[_0xf541('0x47')]({},_0x105184,_0x43faa0[_0xf541('0x48')]);var _0x489f57={'where':_0x105184['where']};return db['Network'][_0xf541('0x29')](_0x489f57)[_0xf541('0x1c')](function(_0x1d3164){_0x536edc[_0xf541('0x29')]=_0x1d3164;if(_0x43faa0[_0xf541('0x3a')][_0xf541('0x49')]){_0x105184[_0xf541('0x4a')]=[{'all':!![]}];}return db[_0xf541('0x4b')][_0xf541('0x4c')](_0x105184);})['then'](function(_0x4caf4f){_0x536edc[_0xf541('0x4d')]=_0x4caf4f;return _0x536edc;})['then'](respondWithFilteredResult(_0x3cd36b,_0x105184))['catch'](handleError(_0x3cd36b,null));};exports[_0xf541('0x4e')]=function(_0xf4fad4,_0x145176){var _0x2d60f8={'raw':!![],'where':{'id':_0xf4fad4['params']['id']}},_0x28a9d3={};_0x28a9d3[_0xf541('0x38')]=_[_0xf541('0x4f')](db[_0xf541('0x4b')][_0xf541('0x34')]);_0x28a9d3['query']=_[_0xf541('0x4f')](_0xf4fad4[_0xf541('0x3a')]);_0x28a9d3[_0xf541('0x3b')]=_['intersection'](_0x28a9d3[_0xf541('0x38')],_0x28a9d3['query']);_0x2d60f8[_0xf541('0x3c')]=_[_0xf541('0x3d')](_0x28a9d3[_0xf541('0x38')],qs[_0xf541('0x3e')](_0xf4fad4['query'][_0xf541('0x3e')]));_0x2d60f8['attributes']=_0x2d60f8['attributes'][_0xf541('0x3f')]?_0x2d60f8[_0xf541('0x3c')]:_0x28a9d3[_0xf541('0x38')];if(_0xf4fad4[_0xf541('0x3a')][_0xf541('0x49')]){_0x2d60f8[_0xf541('0x4a')]=[{'all':!![]}];}_0x2d60f8=_[_0xf541('0x47')]({},_0x2d60f8,_0xf4fad4[_0xf541('0x48')]);return db['Network'][_0xf541('0x50')](_0x2d60f8)['then'](handleEntityNotFound(_0x145176,null))[_0xf541('0x1c')](respondWithResult(_0x145176,null))[_0xf541('0x51')](handleError(_0x145176,null));};exports['create']=function(_0x36e3ad,_0x599987,_0x481310){var _0x31033d;return db['sequelize'][_0xf541('0x52')](function(_0x3d5867){return db['Network'][_0xf541('0x53')](_0x36e3ad[_0xf541('0x54')],{'raw':!![]})[_0xf541('0x1c')](function(_0x40fe8f){_0x31033d=_0x40fe8f;return db[_0xf541('0x4b')][_0xf541('0x4c')]({'where':{'type':_0x36e3ad[_0xf541('0x54')][_0xf541('0x36')]},'raw':!![]});})[_0xf541('0x1c')](function(_0x2e4f6f){if(_0x31033d[_0xf541('0x36')][_0xf541('0x55')]()==_0xf541('0x56')){var _0x170239=fs[_0xf541('0x57')](path[_0xf541('0x58')](config[_0xf541('0x59')],_0xf541('0x5a')),_0xf541('0x5b'));var _0x515fce=ejs[_0xf541('0x5c')](_0x170239,{'networks':_0x2e4f6f||[]});fs[_0xf541('0x5d')]('/etc/asterisk/stun_xcally.conf',_0x515fce);return respondWithRpcPromise(_0xf541('0x5e'),_0xf541('0x53'),{'module':_0xf541('0x5f')});}else if(_0x31033d[_0xf541('0x36')][_0xf541('0x55')]()==_0xf541('0x60')){var _0x1647f7=fs['readFileSync'](path['join'](config[_0xf541('0x59')],_0xf541('0x61')),_0xf541('0x5b'));var _0x26de46=ejs[_0xf541('0x5c')](_0x1647f7,{'networks':_0x2e4f6f||[]});fs['writeFileSync'](_0xf541('0x62'),_0x26de46);return respondWithRpcPromise('Reload',_0xf541('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x3363a4=fs[_0xf541('0x57')](path[_0xf541('0x58')](config[_0xf541('0x59')],_0xf541('0x63')),'utf8');var _0x4a817d=ejs[_0xf541('0x5c')](_0x3363a4,{'networks':_0x2e4f6f||[]});fs[_0xf541('0x5d')](util[_0xf541('0x64')](_0xf541('0x65'),_0x36e3ad[_0xf541('0x54')][_0xf541('0x36')]['toLowerCase']()),_0x4a817d);return respondWithRpcPromise('Reload',_0xf541('0x53'),{'module':_0xf541('0x66')});}return null;})['then'](function(){return _0x31033d;});})['then'](respondWithResult(_0x599987,0xc9))[_0xf541('0x51')](handleError(_0x599987,null));};exports['update']=function(_0x2efeb9,_0x20087e,_0x43a67d){var _0x623bdd;return db[_0xf541('0x67')][_0xf541('0x52')](function(_0x76ad6){return db[_0xf541('0x4b')][_0xf541('0x50')]({'where':{'id':_0x2efeb9[_0xf541('0x68')]['id']}})[_0xf541('0x1c')](handleEntityNotFound(_0x20087e,null))[_0xf541('0x1c')](saveUpdates(_0x2efeb9[_0xf541('0x54')],null))[_0xf541('0x1c')](function(_0x461014){if(_0x461014){_0x623bdd=_0x461014;return db[_0xf541('0x4b')][_0xf541('0x4c')]({'where':{'type':_0x623bdd[_0xf541('0x36')]},'raw':!![]});}return null;})[_0xf541('0x1c')](function(_0x46d500){if(_0x623bdd[_0xf541('0x36')]['toUpperCase']()==_0xf541('0x56')){var _0x3b85c9=fs[_0xf541('0x57')](path[_0xf541('0x58')](config[_0xf541('0x59')],'server/files/templates/stun_multiple.ejs'),_0xf541('0x5b'));var _0x5d6589=ejs['render'](_0x3b85c9,{'networks':_0x46d500||[]});fs[_0xf541('0x5d')](_0xf541('0x69'),_0x5d6589);return respondWithRpcPromise(_0xf541('0x5e'),_0xf541('0x6a'),{'module':_0xf541('0x5f')});}else if(_0x623bdd[_0xf541('0x36')][_0xf541('0x55')]()=='TURN'){var _0x1aedc0=fs[_0xf541('0x57')](path[_0xf541('0x58')](config['root'],_0xf541('0x61')),_0xf541('0x5b'));var _0x12a423=ejs[_0xf541('0x5c')](_0x1aedc0,{'networks':_0x46d500||[]});fs[_0xf541('0x5d')](_0xf541('0x62'),_0x12a423);return respondWithRpcPromise(_0xf541('0x5e'),_0xf541('0x6a'),{'module':_0xf541('0x5f')});}else{var _0x1a1b48=fs[_0xf541('0x57')](path[_0xf541('0x58')](config[_0xf541('0x59')],_0xf541('0x63')),_0xf541('0x5b'));var _0x59b0f8=ejs[_0xf541('0x5c')](_0x1a1b48,{'networks':_0x46d500||[]});fs[_0xf541('0x5d')](util[_0xf541('0x64')](_0xf541('0x65'),_0x2efeb9['body'][_0xf541('0x36')][_0xf541('0x6b')]()),_0x59b0f8);return respondWithRpcPromise(_0xf541('0x5e'),_0xf541('0x6a'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x23d461){if(_0x23d461){return _0x623bdd;}return null;});})['then'](respondWithResult(_0x20087e,null))[_0xf541('0x51')](handleError(_0x20087e,null));};exports['destroy']=function(_0x26eddf,_0x382c03,_0x39f621){var _0x3758ca;return db[_0xf541('0x4b')][_0xf541('0x50')]({'where':{'id':_0x26eddf[_0xf541('0x68')]['id']}})[_0xf541('0x1c')](function(_0x324261){_0x3758ca=_0x324261;return _0x324261;})[_0xf541('0x1c')](handleEntityNotFound(_0x382c03,null))[_0xf541('0x1c')](removeEntity(_0x382c03,null))[_0xf541('0x1c')](function(){if(_0x3758ca){return db[_0xf541('0x4b')]['findAll']({'where':{'type':_0x3758ca[_0xf541('0x36')]},'raw':!![]});}})[_0xf541('0x1c')](function(_0x263d17){if(_0x3758ca[_0xf541('0x36')][_0xf541('0x55')]()==_0xf541('0x56')){var _0x2a9889=fs['readFileSync'](path[_0xf541('0x58')](config['root'],_0xf541('0x5a')),'utf8');var _0x3d4f1f=ejs[_0xf541('0x5c')](_0x2a9889,{'networks':_0x263d17||[]});fs['writeFileSync'](_0xf541('0x69'),_0x3d4f1f);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else if(_0x3758ca[_0xf541('0x36')][_0xf541('0x55')]()==_0xf541('0x60')){var _0x104144=fs[_0xf541('0x57')](path['join'](config[_0xf541('0x59')],_0xf541('0x61')),_0xf541('0x5b'));var _0x52a96f=ejs['render'](_0x104144,{'networks':_0x263d17||[]});fs[_0xf541('0x5d')](_0xf541('0x62'),_0x52a96f);return respondWithRpcPromise('Reload',_0xf541('0x2f'),{'module':_0xf541('0x5f')});}else{var _0x3f2fb0=fs[_0xf541('0x57')](path[_0xf541('0x58')](config[_0xf541('0x59')],_0xf541('0x63')),_0xf541('0x5b'));var _0x386536=ejs[_0xf541('0x5c')](_0x3f2fb0,{'networks':_0x263d17||[]});fs['writeFileSync'](util[_0xf541('0x64')](_0xf541('0x65'),_0x26eddf[_0xf541('0x54')]['type'][_0xf541('0x6b')]()),_0x386536);return respondWithRpcPromise('Reload',_0xf541('0x2f'),{'module':'chan_sip.so'});}return null;})[_0xf541('0x51')](handleError(_0x382c03,null));}; \ No newline at end of file +var _0x46a7=['jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','Network','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','create','sequelize','transaction','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','format','chan_sip.so','find','params','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x30517b,_0x4c9a51){var _0x577725=function(_0x4adee1){while(--_0x4adee1){_0x30517b['push'](_0x30517b['shift']());}};_0x577725(++_0x4c9a51);}(_0x46a7,0x138));var _0x746a=function(_0x31e346,_0x21d10d){_0x31e346=_0x31e346-0x0;var _0x4872be=_0x46a7[_0x31e346];return _0x4872be;};'use strict';var emlformat=require(_0x746a('0x0'));var rimraf=require(_0x746a('0x1'));var zipdir=require(_0x746a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x746a('0x3'));var moment=require(_0x746a('0x4'));var BPromise=require(_0x746a('0x5'));var Mustache=require(_0x746a('0x6'));var util=require(_0x746a('0x7'));var path=require(_0x746a('0x8'));var sox=require(_0x746a('0x9'));var csv=require(_0x746a('0xa'));var ejs=require(_0x746a('0xb'));var fs=require('fs');var fs_extra=require(_0x746a('0xc'));var _=require(_0x746a('0xd'));var squel=require(_0x746a('0xe'));var crypto=require(_0x746a('0xf'));var jsforce=require(_0x746a('0x10'));var deskjs=require(_0x746a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x746a('0x12'));var Papa=require(_0x746a('0x13'));var Redis=require(_0x746a('0x14'));var authService=require(_0x746a('0x15'));var qs=require(_0x746a('0x16'));var as=require(_0x746a('0x17'));var hardwareService=require(_0x746a('0x18'));var logger=require(_0x746a('0x19'))(_0x746a('0x1a'));var utils=require('../../config/utils');var config=require(_0x746a('0x1b'));var licenseUtil=require(_0x746a('0x1c'));var db=require(_0x746a('0x1d'))['db'];var jayson=require(_0x746a('0x1e'));var client=jayson[_0x746a('0x1f')][_0x746a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x16d0c5,_0x102fa2,_0xed7a4,_0x3b0a40){return new BPromise(function(_0x172f5b,_0x24e56e){var _0x58acd8=_0x3b0a40||client;return _0x58acd8['request'](_0x16d0c5,_0xed7a4)[_0x746a('0x21')](function(_0x3976d2){logger[_0x746a('0x22')](_0x746a('0x23'),_0x102fa2,_0x746a('0x24'));logger[_0x746a('0x25')](_0x746a('0x26'),_0x102fa2,_0x746a('0x24'),JSON[_0x746a('0x27')](_0x3976d2));if(_0x3976d2['error']){if(_0x3976d2['error']['code']===0x1f4){logger[_0x746a('0x28')](_0x746a('0x23'),_0x102fa2,_0x3976d2[_0x746a('0x28')][_0x746a('0x29')]);return _0x24e56e(_0x3976d2[_0x746a('0x28')][_0x746a('0x29')]);}logger['error'](_0x746a('0x23'),_0x102fa2,_0x3976d2['error'][_0x746a('0x29')]);return _0x172f5b(_0x3976d2[_0x746a('0x28')][_0x746a('0x29')]);}else{logger[_0x746a('0x22')]('Network,\x20%s,\x20%s',_0x102fa2,_0x746a('0x24'));_0x172f5b(_0x3976d2[_0x746a('0x2a')][_0x746a('0x29')]);}})[_0x746a('0x2b')](function(_0x4940b3){logger[_0x746a('0x28')](_0x746a('0x23'),_0x102fa2,_0x4940b3);_0x24e56e(_0x4940b3);});});}function respondWithStatusCode(_0x53a44e,_0x4f33cc){_0x4f33cc=_0x4f33cc||0xcc;return function(_0x222edf){if(_0x222edf){return _0x53a44e[_0x746a('0x2c')](_0x4f33cc);}return _0x53a44e['status'](_0x4f33cc)[_0x746a('0x2d')]();};}function respondWithResult(_0xfb318d,_0x10cc56){_0x10cc56=_0x10cc56||0xc8;return function(_0x295752){if(_0x295752){return _0xfb318d[_0x746a('0x2e')](_0x10cc56)[_0x746a('0x2f')](_0x295752);}};}function respondWithFilteredResult(_0x2b91a0,_0x3016b5){return function(_0x46bfc0){if(_0x46bfc0){var _0x3f1bfa=typeof _0x3016b5[_0x746a('0x30')]===_0x746a('0x31')&&typeof _0x3016b5['limit']==='undefined';var _0x2d80a0=_0x46bfc0[_0x746a('0x32')];var _0x491250=_0x3f1bfa?0x0:_0x3016b5[_0x746a('0x30')];var _0x953e4e=_0x3f1bfa?_0x46bfc0[_0x746a('0x32')]:_0x3016b5[_0x746a('0x30')]+_0x3016b5['limit'];var _0x241508;if(_0x953e4e>=_0x2d80a0){_0x953e4e=_0x2d80a0;_0x241508=0xc8;}else{_0x241508=0xce;}_0x2b91a0['status'](_0x241508);return _0x2b91a0[_0x746a('0x33')](_0x746a('0x34'),_0x491250+'-'+_0x953e4e+'/'+_0x2d80a0)[_0x746a('0x2f')](_0x46bfc0);}return null;};}function patchUpdates(_0x17ad36){return function(_0x4d67f9){try{jsonpatch[_0x746a('0x35')](_0x4d67f9,_0x17ad36,!![]);}catch(_0x5bf350){return BPromise[_0x746a('0x36')](_0x5bf350);}return _0x4d67f9['save']();};}function saveUpdates(_0x2e6625,_0x28ea3a){return function(_0x4da4a1){if(_0x4da4a1){return _0x4da4a1[_0x746a('0x37')](_0x2e6625)[_0x746a('0x21')](function(_0x3d8853){return _0x3d8853;});}return null;};}function removeEntity(_0x5643f1,_0x2b4003){return function(_0x19de6e){if(_0x19de6e){return _0x19de6e[_0x746a('0x38')]()[_0x746a('0x21')](function(){_0x5643f1[_0x746a('0x2e')](0xcc)[_0x746a('0x2d')]();});}};}function handleEntityNotFound(_0x9c858e,_0x39044b){return function(_0x1d1ce4){if(!_0x1d1ce4){_0x9c858e[_0x746a('0x2c')](0x194);}return _0x1d1ce4;};}function handleError(_0x3c1173,_0x1b9dc0){_0x1b9dc0=_0x1b9dc0||0x1f4;return function(_0x57e467){logger['error'](_0x57e467[_0x746a('0x39')]);if(_0x57e467[_0x746a('0x3a')]){delete _0x57e467['name'];}_0x3c1173[_0x746a('0x2e')](_0x1b9dc0)[_0x746a('0x3b')](_0x57e467);};}exports[_0x746a('0x3c')]=function(_0x10e97c,_0x4b5bb2){var _0x32e5ee={},_0x157a75={},_0x58a510={'count':0x0,'rows':[]};var _0x3d3f9e=_[_0x746a('0x3d')](db[_0x746a('0x3e')]['rawAttributes'],function(_0x2b02f5){return{'name':_0x2b02f5[_0x746a('0x3f')],'type':_0x2b02f5[_0x746a('0x40')]['key']};});_0x157a75['model']=_[_0x746a('0x3d')](_0x3d3f9e,_0x746a('0x3a'));_0x157a75[_0x746a('0x41')]=_[_0x746a('0x42')](_0x10e97c[_0x746a('0x41')]);_0x157a75['filters']=_['intersection'](_0x157a75['model'],_0x157a75[_0x746a('0x41')]);_0x32e5ee['attributes']=_[_0x746a('0x43')](_0x157a75[_0x746a('0x44')],qs[_0x746a('0x45')](_0x10e97c[_0x746a('0x41')][_0x746a('0x45')]));_0x32e5ee[_0x746a('0x46')]=_0x32e5ee[_0x746a('0x46')]['length']?_0x32e5ee[_0x746a('0x46')]:_0x157a75[_0x746a('0x44')];if(!_0x10e97c[_0x746a('0x41')][_0x746a('0x47')](_0x746a('0x48'))){_0x32e5ee[_0x746a('0x49')]=qs[_0x746a('0x49')](_0x10e97c[_0x746a('0x41')][_0x746a('0x49')]);_0x32e5ee[_0x746a('0x30')]=qs[_0x746a('0x30')](_0x10e97c[_0x746a('0x41')][_0x746a('0x30')]);}_0x32e5ee['order']=qs['sort'](_0x10e97c['query'][_0x746a('0x4a')]);_0x32e5ee[_0x746a('0x4b')]=qs[_0x746a('0x4c')](_[_0x746a('0x4d')](_0x10e97c[_0x746a('0x41')],_0x157a75[_0x746a('0x4c')]),_0x3d3f9e);if(_0x10e97c['query'][_0x746a('0x4e')]){_0x32e5ee[_0x746a('0x4b')]=_[_0x746a('0x4f')](_0x32e5ee[_0x746a('0x4b')],{'$or':_[_0x746a('0x3d')](_0x3d3f9e,function(_0x514390){if(_0x514390[_0x746a('0x40')]!==_0x746a('0x50')){var _0x515263={};_0x515263[_0x514390[_0x746a('0x3a')]]={'$like':'%'+_0x10e97c[_0x746a('0x41')]['filter']+'%'};return _0x515263;}})});}_0x32e5ee=_[_0x746a('0x4f')]({},_0x32e5ee,_0x10e97c[_0x746a('0x51')]);var _0x2b033b={'where':_0x32e5ee[_0x746a('0x4b')]};return db[_0x746a('0x3e')][_0x746a('0x32')](_0x2b033b)[_0x746a('0x21')](function(_0x5290a1){_0x58a510['count']=_0x5290a1;if(_0x10e97c[_0x746a('0x41')][_0x746a('0x52')]){_0x32e5ee[_0x746a('0x53')]=[{'all':!![]}];}return db[_0x746a('0x3e')][_0x746a('0x54')](_0x32e5ee);})[_0x746a('0x21')](function(_0x5f1f89){_0x58a510[_0x746a('0x55')]=_0x5f1f89;return _0x58a510;})['then'](respondWithFilteredResult(_0x4b5bb2,_0x32e5ee))['catch'](handleError(_0x4b5bb2,null));};exports['show']=function(_0x37de8a,_0x306b42){var _0x361f88={'raw':!![],'where':{'id':_0x37de8a['params']['id']}},_0x58cefc={};_0x58cefc[_0x746a('0x44')]=_['keys'](db[_0x746a('0x3e')][_0x746a('0x56')]);_0x58cefc[_0x746a('0x41')]=_[_0x746a('0x42')](_0x37de8a[_0x746a('0x41')]);_0x58cefc['filters']=_[_0x746a('0x43')](_0x58cefc[_0x746a('0x44')],_0x58cefc['query']);_0x361f88[_0x746a('0x46')]=_[_0x746a('0x43')](_0x58cefc[_0x746a('0x44')],qs[_0x746a('0x45')](_0x37de8a[_0x746a('0x41')][_0x746a('0x45')]));_0x361f88[_0x746a('0x46')]=_0x361f88[_0x746a('0x46')][_0x746a('0x57')]?_0x361f88[_0x746a('0x46')]:_0x58cefc[_0x746a('0x44')];if(_0x37de8a[_0x746a('0x41')][_0x746a('0x52')]){_0x361f88[_0x746a('0x53')]=[{'all':!![]}];}_0x361f88=_[_0x746a('0x4f')]({},_0x361f88,_0x37de8a[_0x746a('0x51')]);return db['Network']['find'](_0x361f88)['then'](handleEntityNotFound(_0x306b42,null))['then'](respondWithResult(_0x306b42,null))[_0x746a('0x2b')](handleError(_0x306b42,null));};exports[_0x746a('0x58')]=function(_0x3a377b,_0xf6b8ec,_0x218cd3){var _0xa9e552;return db[_0x746a('0x59')][_0x746a('0x5a')](function(_0x18899c){return db[_0x746a('0x3e')]['create'](_0x3a377b[_0x746a('0x5b')],{'raw':!![]})[_0x746a('0x21')](function(_0x3d1b9d){_0xa9e552=_0x3d1b9d;return db[_0x746a('0x3e')][_0x746a('0x54')]({'where':{'type':_0x3a377b[_0x746a('0x5b')][_0x746a('0x40')]},'raw':!![]});})[_0x746a('0x21')](function(_0x5e870d){if(_0xa9e552['type'][_0x746a('0x5c')]()==_0x746a('0x5d')){var _0x5e8cbe=fs['readFileSync'](path[_0x746a('0x5e')](config['root'],_0x746a('0x5f')),'utf8');var _0x571123=ejs[_0x746a('0x60')](_0x5e8cbe,{'networks':_0x5e870d||[]});fs['writeFileSync'](_0x746a('0x61'),_0x571123);return respondWithRpcPromise(_0x746a('0x62'),'create',{'module':'res_stun_monitor.so'});}else if(_0xa9e552[_0x746a('0x40')][_0x746a('0x5c')]()==_0x746a('0x63')){var _0x2144c4=fs[_0x746a('0x64')](path['join'](config['root'],_0x746a('0x65')),_0x746a('0x66'));var _0x38cd1d=ejs[_0x746a('0x60')](_0x2144c4,{'networks':_0x5e870d||[]});fs[_0x746a('0x67')](_0x746a('0x68'),_0x38cd1d);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x58'),{'module':_0x746a('0x69')});}else{var _0x3bb501=fs['readFileSync'](path['join'](config[_0x746a('0x6a')],_0x746a('0x6b')),_0x746a('0x66'));var _0x230fb0=ejs[_0x746a('0x60')](_0x3bb501,{'networks':_0x5e870d||[]});fs[_0x746a('0x67')](util[_0x746a('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x3a377b['body'][_0x746a('0x40')]['toLowerCase']()),_0x230fb0);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x58'),{'module':_0x746a('0x6d')});}return null;})[_0x746a('0x21')](function(){return _0xa9e552;});})[_0x746a('0x21')](respondWithResult(_0xf6b8ec,0xc9))[_0x746a('0x2b')](handleError(_0xf6b8ec,null));};exports[_0x746a('0x37')]=function(_0x1d672b,_0xbad13b,_0x213d54){var _0x5b4ff8;return db[_0x746a('0x59')]['transaction'](function(_0x3daa80){return db['Network'][_0x746a('0x6e')]({'where':{'id':_0x1d672b[_0x746a('0x6f')]['id']}})[_0x746a('0x21')](handleEntityNotFound(_0xbad13b,null))[_0x746a('0x21')](saveUpdates(_0x1d672b['body'],null))[_0x746a('0x21')](function(_0x525fe7){if(_0x525fe7){_0x5b4ff8=_0x525fe7;return db[_0x746a('0x3e')][_0x746a('0x54')]({'where':{'type':_0x5b4ff8['type']},'raw':!![]});}return null;})['then'](function(_0x3eb331){if(_0x5b4ff8['type'][_0x746a('0x5c')]()==_0x746a('0x5d')){var _0x567dae=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],'server/files/templates/stun_multiple.ejs'),_0x746a('0x66'));var _0x43c6c5=ejs[_0x746a('0x60')](_0x567dae,{'networks':_0x3eb331||[]});fs[_0x746a('0x67')]('/etc/asterisk/stun_xcally.conf',_0x43c6c5);return respondWithRpcPromise('Reload',_0x746a('0x37'),{'module':_0x746a('0x69')});}else if(_0x5b4ff8[_0x746a('0x40')][_0x746a('0x5c')]()=='TURN'){var _0x5691d9=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config['root'],_0x746a('0x65')),_0x746a('0x66'));var _0x2ced57=ejs[_0x746a('0x60')](_0x5691d9,{'networks':_0x3eb331||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2ced57);return respondWithRpcPromise(_0x746a('0x62'),'update',{'module':_0x746a('0x69')});}else{var _0x137833=fs['readFileSync'](path[_0x746a('0x5e')](config[_0x746a('0x6a')],'server/files/templates/network.ejs'),_0x746a('0x66'));var _0x43db13=ejs[_0x746a('0x60')](_0x137833,{'networks':_0x3eb331||[]});fs[_0x746a('0x67')](util['format'](_0x746a('0x70'),_0x1d672b[_0x746a('0x5b')][_0x746a('0x40')][_0x746a('0x71')]()),_0x43db13);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x37'),{'module':_0x746a('0x6d')});}return null;})['then'](function(_0x3221a7){if(_0x3221a7){return _0x5b4ff8;}return null;});})[_0x746a('0x21')](respondWithResult(_0xbad13b,null))[_0x746a('0x2b')](handleError(_0xbad13b,null));};exports[_0x746a('0x38')]=function(_0x4a518d,_0x4d4c0f,_0x4afa2b){var _0xeac725;return db[_0x746a('0x3e')]['find']({'where':{'id':_0x4a518d[_0x746a('0x6f')]['id']}})[_0x746a('0x21')](function(_0x2e87ce){_0xeac725=_0x2e87ce;return _0x2e87ce;})[_0x746a('0x21')](handleEntityNotFound(_0x4d4c0f,null))[_0x746a('0x21')](removeEntity(_0x4d4c0f,null))[_0x746a('0x21')](function(){if(_0xeac725){return db['Network']['findAll']({'where':{'type':_0xeac725['type']},'raw':!![]});}})[_0x746a('0x21')](function(_0x160da3){if(_0xeac725[_0x746a('0x40')][_0x746a('0x5c')]()==_0x746a('0x5d')){var _0x78b89a=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x40b325=ejs[_0x746a('0x60')](_0x78b89a,{'networks':_0x160da3||[]});fs[_0x746a('0x67')](_0x746a('0x61'),_0x40b325);return respondWithRpcPromise('Reload',_0x746a('0x38'),{'module':_0x746a('0x69')});}else if(_0xeac725['type'][_0x746a('0x5c')]()=='TURN'){var _0x4b4f36=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],_0x746a('0x65')),_0x746a('0x66'));var _0x4a1515=ejs[_0x746a('0x60')](_0x4b4f36,{'networks':_0x160da3||[]});fs[_0x746a('0x67')](_0x746a('0x68'),_0x4a1515);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x38'),{'module':_0x746a('0x69')});}else{var _0x10f2cb=fs[_0x746a('0x64')](path[_0x746a('0x5e')](config[_0x746a('0x6a')],_0x746a('0x6b')),_0x746a('0x66'));var _0x37c6e5=ejs['render'](_0x10f2cb,{'networks':_0x160da3||[]});fs[_0x746a('0x67')](util[_0x746a('0x6c')](_0x746a('0x70'),_0x4a518d[_0x746a('0x5b')]['type'][_0x746a('0x71')]()),_0x37c6e5);return respondWithRpcPromise(_0x746a('0x62'),_0x746a('0x38'),{'module':'chan_sip.so'});}return null;})[_0x746a('0x2b')](handleError(_0x4d4c0f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 763d754..7cfebbf 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 _0x80df=['../../config/environment','./network.attributes','exports','define','network','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var logger=require(_0xf80d('0x2'))(_0xf80d('0x3'));var moment=require('moment');var BPromise=require(_0xf80d('0x4'));var rp=require(_0xf80d('0x5'));var fs=require('fs');var path=require(_0xf80d('0x6'));var rimraf=require(_0xf80d('0x7'));var config=require(_0xf80d('0x8'));var attributes=require(_0xf80d('0x9'));module[_0xf80d('0xa')]=function(_0xeffeb7,_0x1c9b19){return _0xeffeb7[_0xf80d('0xb')]('Network',attributes,{'tableName':_0xf80d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4746=['rimraf','../../config/environment','exports','define','Network','network','lodash','util','api','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4746,0xc6));var _0x6474=function(_0xec205f,_0x4387f2){_0xec205f=_0xec205f-0x0;var _0x4fef32=_0x4746[_0xec205f];return _0x4fef32;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require('../../config/logger')(_0x6474('0x2'));var moment=require('moment');var BPromise=require(_0x6474('0x3'));var rp=require(_0x6474('0x4'));var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./network.attributes');module[_0x6474('0x8')]=function(_0x2bcf7c,_0x4cadd7){return _0x2bcf7c[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'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 c99aa07..c0efd2d 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x303659,_0xb0f3b){_0x303659=_0x303659-0x0;var _0x5080ad=_0x7a54[_0x303659];return _0x5080ad;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e22c3,_0x39d0a6){var _0x2314ae=function(_0x4c2663){while(--_0x4c2663){_0x4e22c3['push'](_0x4e22c3['shift']());}};_0x2314ae(++_0x39d0a6);}(_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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c095a49..8e9fa38 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 _0xd3d1=['/:id/interactions','create','post','addDisposition','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0xd3d1,0x1d5));var _0x1d3d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd3d1[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require(_0x1d3d('0x2'));var timeout=require(_0x1d3d('0x3'));var express=require(_0x1d3d('0x4'));var router=express[_0x1d3d('0x5')]();var fs_extra=require(_0x1d3d('0x6'));var auth=require(_0x1d3d('0x7'));var interaction=require(_0x1d3d('0x8'));var config=require(_0x1d3d('0x9'));var controller=require('./openchannelAccount.controller');router[_0x1d3d('0xa')]('/',auth[_0x1d3d('0xb')](),controller[_0x1d3d('0xc')]);router['get'](_0x1d3d('0xd'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0xe')]);router[_0x1d3d('0xa')](_0x1d3d('0xf'),auth['isAuthenticated'](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0xa')](_0x1d3d('0x11'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x12')]);router['get'](_0x1d3d('0x13'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x14')]);router[_0x1d3d('0xa')](_0x1d3d('0x15'),auth['isAuthenticated'](),controller[_0x1d3d('0x16')]);router[_0x1d3d('0xa')](_0x1d3d('0x17'),auth[_0x1d3d('0xb')](),controller['getInteractions']);router[_0x1d3d('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x19')](_0x1d3d('0x11'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x1a')]);router[_0x1d3d('0x19')](_0x1d3d('0x13'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x1d3d('0x1b')]);router[_0x1d3d('0x19')](_0x1d3d('0x15'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x1c')]);router[_0x1d3d('0x19')](_0x1d3d('0x1d'),auth['isAuthenticated'](),controller[_0x1d3d('0x1e')]);router[_0x1d3d('0x19')](_0x1d3d('0x1f'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x20')]);router[_0x1d3d('0x21')](_0x1d3d('0xf'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x22')]);router['delete']('/:id',auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x23')]);router[_0x1d3d('0x24')](_0x1d3d('0x11'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x25')]);router[_0x1d3d('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1d3d('0x26')]);router[_0x1d3d('0x24')](_0x1d3d('0x1d'),auth[_0x1d3d('0xb')](),controller[_0x1d3d('0x27')]);module[_0x1d3d('0x28')]=router; \ No newline at end of file +var _0x75c0=['post','addDisposition','/:id/canned_answers','notify','addApplications','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents'];(function(_0x4fa738,_0x2a491c){var _0x55bf55=function(_0x185d53){while(--_0x185d53){_0x4fa738['push'](_0x4fa738['shift']());}};_0x55bf55(++_0x2a491c);}(_0x75c0,0x16c));var _0x075c=function(_0x89de20,_0x182ee0){_0x89de20=_0x89de20-0x0;var _0x457d64=_0x75c0[_0x89de20];return _0x457d64;};'use strict';var multer=require(_0x075c('0x0'));var util=require(_0x075c('0x1'));var path=require(_0x075c('0x2'));var timeout=require(_0x075c('0x3'));var express=require('express');var router=express[_0x075c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x075c('0x5'));var interaction=require(_0x075c('0x6'));var config=require(_0x075c('0x7'));var controller=require(_0x075c('0x8'));router[_0x075c('0x9')]('/',auth[_0x075c('0xa')](),controller[_0x075c('0xb')]);router[_0x075c('0x9')]('/describe',auth[_0x075c('0xa')](),controller[_0x075c('0xc')]);router[_0x075c('0x9')]('/:id',auth[_0x075c('0xa')](),controller[_0x075c('0xd')]);router['get'](_0x075c('0xe'),auth[_0x075c('0xa')](),controller[_0x075c('0xf')]);router[_0x075c('0x9')]('/:id/canned_answers',auth[_0x075c('0xa')](),controller[_0x075c('0x10')]);router[_0x075c('0x9')](_0x075c('0x11'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x075c('0x12')]);router[_0x075c('0x9')](_0x075c('0x13'),auth['isAuthenticated'](),controller[_0x075c('0x14')]);router[_0x075c('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x075c('0x15')]('/:id/dispositions',auth[_0x075c('0xa')](),controller[_0x075c('0x16')]);router[_0x075c('0x15')](_0x075c('0x17'),auth[_0x075c('0xa')](),controller['addAnswer']);router[_0x075c('0x15')]('/:id/notify',controller[_0x075c('0x18')]);router[_0x075c('0x15')](_0x075c('0x11'),auth[_0x075c('0xa')](),controller[_0x075c('0x19')]);router[_0x075c('0x15')](_0x075c('0x13'),auth['isAuthenticated'](),controller[_0x075c('0x1a')]);router[_0x075c('0x15')](_0x075c('0x1b'),auth[_0x075c('0xa')](),controller[_0x075c('0x1c')]);router[_0x075c('0x1d')](_0x075c('0x1e'),auth[_0x075c('0xa')](),controller[_0x075c('0x1f')]);router[_0x075c('0x20')](_0x075c('0x1e'),auth[_0x075c('0xa')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x075c('0x21')]);router['delete'](_0x075c('0x17'),auth[_0x075c('0xa')](),controller['removeAnswers']);router['delete'](_0x075c('0x13'),auth[_0x075c('0xa')](),controller[_0x075c('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 33735aa..2524723 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 _0x2fdb=['mandatoryDisposition','exports','STRING','name','generate','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'];(function(_0xc0b2cb,_0x39eb74){var _0x5968ec=function(_0x4d906d){while(--_0x4d906d){_0xc0b2cb['push'](_0xc0b2cb['shift']());}};_0x5968ec(++_0x39eb74);}(_0x2fdb,0xf8));var _0xb2fd=function(_0x48b8dd,_0x37a7a){_0x48b8dd=_0x48b8dd-0x0;var _0x474ab6=_0x2fdb[_0x48b8dd];return _0x474ab6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb2fd('0x0')]={'name':{'type':Sequelize[_0xb2fd('0x1')],'unique':_0xb2fd('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb2fd('0x1')]},'token':{'type':Sequelize[_0xb2fd('0x1')],'defaultValue':function(){return rs[_0xb2fd('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb2fd('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb2fd('0x4')],'defaultValue':function(){return _0xb2fd('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb2fd('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb2fd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb2fd('0x1')]},'queueTransfer':{'type':Sequelize[_0xb2fd('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb2fd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb2fd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb2fd('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb2fd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb2fd('0x6')],'defaultValue':![],'comment':_0xb2fd('0x9'),'set':function(_0x44b699){if(!_0x44b699)this['setDataValue'](_0xb2fd('0xa'),null);this[_0xb2fd('0xb')](_0xb2fd('0xc'),_0x44b699);}}}; \ No newline at end of file +var _0xbf53=['name','generate','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','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbf53,0x10d));var _0x3bf5=function(_0x225740,_0x339d2b){_0x225740=_0x225740-0x0;var _0x183a4a=_0xbf53[_0x225740];return _0x183a4a;};'use strict';var Sequelize=require(_0x3bf5('0x0'));var rs=require(_0x3bf5('0x1'));module[_0x3bf5('0x2')]={'name':{'type':Sequelize[_0x3bf5('0x3')],'unique':_0x3bf5('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x3bf5('0x3')]},'token':{'type':Sequelize[_0x3bf5('0x3')],'defaultValue':function(){return rs[_0x3bf5('0x5')]();}},'replyUri':{'type':Sequelize[_0x3bf5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3bf5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3bf5('0x6')],'defaultValue':function(){return _0x3bf5('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3bf5('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3bf5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3bf5('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3bf5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3bf5('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3bf5('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x3bf5('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3966c7){if(!_0x3966c7)this[_0x3bf5('0xb')](_0x3bf5('0xc'),null);this['setDataValue']('mandatoryDisposition',_0x3966c7);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b26cfec..7701b38 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 _0xc16e=['UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','mandatoryDispositionPause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','pick','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','List','applications','Applications','orderBy','asc','account','defaults','contact','lastName','threadId','externalUrl','OpenchannelInteraction','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','sendStatus','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','spread','dataValues','Messages','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','redis','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','OpenchannelAccounts','end','stack','name','send','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','Pause','create','body','get','user'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc16e,0x122));var _0xec16=function(_0x200f89,_0x32c5b4){_0x200f89=_0x200f89-0x0;var _0x37219a=_0xc16e[_0x200f89];return _0x37219a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec16('0x0'));var zipdir=require(_0xec16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec16('0x2'));var moment=require(_0xec16('0x3'));var BPromise=require(_0xec16('0x4'));var Mustache=require(_0xec16('0x5'));var util=require(_0xec16('0x6'));var path=require(_0xec16('0x7'));var sox=require(_0xec16('0x8'));var csv=require(_0xec16('0x9'));var ejs=require(_0xec16('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec16('0xb'));var squel=require(_0xec16('0xc'));var crypto=require(_0xec16('0xd'));var jsforce=require(_0xec16('0xe'));var deskjs=require(_0xec16('0xf'));var toCsv=require(_0xec16('0x9'));var querystring=require(_0xec16('0x10'));var Papa=require(_0xec16('0x11'));var Redis=require(_0xec16('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xec16('0x13'));var as=require(_0xec16('0x14'));var hardwareService=require(_0xec16('0x15'));var logger=require(_0xec16('0x16'))(_0xec16('0x17'));var utils=require(_0xec16('0x18'));var config=require(_0xec16('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xec16('0x1a'))['db'];config[_0xec16('0x1b')]=_['defaults'](config[_0xec16('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xec16('0x1c'))(new Redis(config[_0xec16('0x1b')]));require(_0xec16('0x1d'))['register'](socket);var jayson=require(_0xec16('0x1e'));var client=jayson[_0xec16('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xec16('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x171154,_0x2ead0a,_0x2b9140,_0x27dd28){return new BPromise(function(_0x240346,_0x1db031){var _0x3b29bb=_0x27dd28||client;return _0x3b29bb[_0xec16('0x21')](_0x171154,_0x2b9140)[_0xec16('0x22')](function(_0x566bd9){logger[_0xec16('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x2ead0a,_0xec16('0x24'));logger[_0xec16('0x25')](_0xec16('0x26'),_0x2ead0a,_0xec16('0x24'),JSON[_0xec16('0x27')](_0x566bd9));if(_0x566bd9[_0xec16('0x28')]){if(_0x566bd9[_0xec16('0x28')][_0xec16('0x29')]===0x1f4){logger[_0xec16('0x28')](_0xec16('0x2a'),_0x2ead0a,_0x566bd9[_0xec16('0x28')]['message']);return _0x1db031(_0x566bd9['error']['message']);}logger[_0xec16('0x28')](_0xec16('0x2a'),_0x2ead0a,_0x566bd9['error']['message']);return _0x240346(_0x566bd9[_0xec16('0x28')][_0xec16('0x2b')]);}else{logger[_0xec16('0x23')](_0xec16('0x2a'),_0x2ead0a,_0xec16('0x24'));_0x240346(_0x566bd9[_0xec16('0x2c')][_0xec16('0x2b')]);}})[_0xec16('0x2d')](function(_0x477ad5){logger[_0xec16('0x28')](_0xec16('0x2a'),_0x2ead0a,_0x477ad5);_0x1db031(_0x477ad5);});});}function respondWithStatusCode(_0x1c36fd,_0x38140b){_0x38140b=_0x38140b||0xcc;return function(_0x4c04a2){if(_0x4c04a2){return _0x1c36fd['sendStatus'](_0x38140b);}return _0x1c36fd[_0xec16('0x2e')](_0x38140b)['end']();};}function respondWithResult(_0x2b093b,_0x5695d8){_0x5695d8=_0x5695d8||0xc8;return function(_0x562e91){if(_0x562e91){return _0x2b093b[_0xec16('0x2e')](_0x5695d8)[_0xec16('0x2f')](_0x562e91);}};}function respondWithFilteredResult(_0xd01e20,_0x55557f){return function(_0x433225){if(_0x433225){var _0x111089=typeof _0x55557f[_0xec16('0x30')]===_0xec16('0x31')&&typeof _0x55557f[_0xec16('0x32')]==='undefined';var _0x1c5ced=_0x433225[_0xec16('0x33')];var _0x1ab3cc=_0x111089?0x0:_0x55557f[_0xec16('0x30')];var _0x7e92f2=_0x111089?_0x433225[_0xec16('0x33')]:_0x55557f[_0xec16('0x30')]+_0x55557f['limit'];var _0x316592;if(_0x7e92f2>=_0x1c5ced){_0x7e92f2=_0x1c5ced;_0x316592=0xc8;}else{_0x316592=0xce;}_0xd01e20[_0xec16('0x2e')](_0x316592);return _0xd01e20[_0xec16('0x34')]('Content-Range',_0x1ab3cc+'-'+_0x7e92f2+'/'+_0x1c5ced)[_0xec16('0x2f')](_0x433225);}return null;};}function patchUpdates(_0x455388){return function(_0x1333ab){try{jsonpatch[_0xec16('0x35')](_0x1333ab,_0x455388,!![]);}catch(_0x424ae5){return BPromise[_0xec16('0x36')](_0x424ae5);}return _0x1333ab[_0xec16('0x37')]();};}function saveUpdates(_0x3856ea,_0x5eea09){return function(_0xe9ae3b){if(_0xe9ae3b){return _0xe9ae3b[_0xec16('0x38')](_0x3856ea)[_0xec16('0x22')](function(_0x411f20){return _0x411f20;});}return null;};}function removeEntity(_0x574f0a,_0x4be09b){return function(_0x143ef2){if(_0x143ef2){return _0x143ef2[_0xec16('0x39')]()['then'](function(){var _0xaaf005=_0x143ef2['get']({'plain':!![]});var _0x1b2b40=_0xec16('0x3a');return db['UserProfileResource'][_0xec16('0x39')]({'where':{'type':_0x1b2b40,'resourceId':_0xaaf005['id']}})[_0xec16('0x22')](function(){return _0x143ef2;});})[_0xec16('0x22')](function(){_0x574f0a[_0xec16('0x2e')](0xcc)[_0xec16('0x3b')]();});}};}function handleEntityNotFound(_0x18abcc,_0xfcbc5a){return function(_0x48fe8d){if(!_0x48fe8d){_0x18abcc['sendStatus'](0x194);}return _0x48fe8d;};}function handleError(_0x40fa6b,_0x125e6a){_0x125e6a=_0x125e6a||0x1f4;return function(_0x242bc4){logger[_0xec16('0x28')](_0x242bc4[_0xec16('0x3c')]);if(_0x242bc4[_0xec16('0x3d')]){delete _0x242bc4[_0xec16('0x3d')];}_0x40fa6b[_0xec16('0x2e')](_0x125e6a)[_0xec16('0x3e')](_0x242bc4);};}exports['index']=function(_0x45653c,_0xe39f00){var _0x56b249={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1ea92a={},_0x3d38ec={'count':0x0,'rows':[]};var _0x3b2463=_[_0xec16('0x3f')](db[_0xec16('0x40')][_0xec16('0x41')],function(_0x54d236){return{'name':_0x54d236[_0xec16('0x42')],'type':_0x54d236[_0xec16('0x43')][_0xec16('0x44')]};});_0x1ea92a[_0xec16('0x45')]=_['map'](_0x3b2463,'name');_0x1ea92a[_0xec16('0x46')]=_[_0xec16('0x47')](_0x45653c[_0xec16('0x46')]);_0x1ea92a['filters']=_['intersection'](_0x1ea92a[_0xec16('0x45')],_0x1ea92a[_0xec16('0x46')]);_0x56b249[_0xec16('0x48')]=_[_0xec16('0x49')](_0x1ea92a[_0xec16('0x45')],qs['fields'](_0x45653c[_0xec16('0x46')][_0xec16('0x4a')]));_0x56b249[_0xec16('0x48')]=_0x56b249[_0xec16('0x48')][_0xec16('0x4b')]?_0x56b249[_0xec16('0x48')]:_0x1ea92a[_0xec16('0x45')];if(!_0x45653c[_0xec16('0x46')]['hasOwnProperty']('nolimit')){_0x56b249[_0xec16('0x32')]=qs[_0xec16('0x32')](_0x45653c['query']['limit']);_0x56b249[_0xec16('0x30')]=qs[_0xec16('0x30')](_0x45653c[_0xec16('0x46')][_0xec16('0x30')]);}_0x56b249[_0xec16('0x4c')]=qs[_0xec16('0x4d')](_0x45653c[_0xec16('0x46')][_0xec16('0x4d')]);_0x56b249[_0xec16('0x4e')]=qs[_0xec16('0x4f')](_['pick'](_0x45653c[_0xec16('0x46')],_0x1ea92a[_0xec16('0x4f')]),_0x3b2463);if(_0x45653c[_0xec16('0x46')]['filter']){_0x56b249['where']=_[_0xec16('0x50')](_0x56b249[_0xec16('0x4e')],{'$or':_[_0xec16('0x3f')](_0x3b2463,function(_0x40c2fe){if(_0x40c2fe[_0xec16('0x43')]!==_0xec16('0x51')){var _0x160c8f={};_0x160c8f[_0x40c2fe[_0xec16('0x3d')]]={'$like':'%'+_0x45653c['query'][_0xec16('0x52')]+'%'};return _0x160c8f;}})});}_0x56b249=_[_0xec16('0x50')]({},_0x56b249,_0x45653c['options']);var _0x3d6fe9={'where':_0x56b249['where']};return db[_0xec16('0x40')][_0xec16('0x33')](_0x3d6fe9)[_0xec16('0x22')](function(_0x7803ef){_0x3d38ec[_0xec16('0x33')]=_0x7803ef;if(_0x45653c[_0xec16('0x46')][_0xec16('0x53')]){_0x56b249[_0xec16('0x54')]=[{'all':!![]}];}return db[_0xec16('0x40')][_0xec16('0x55')](_0x56b249);})[_0xec16('0x22')](function(_0x111a5b){_0x3d38ec[_0xec16('0x56')]=_0x111a5b;return _0x3d38ec;})['then'](respondWithFilteredResult(_0xe39f00,_0x56b249))[_0xec16('0x2d')](handleError(_0xe39f00,null));};exports[_0xec16('0x57')]=function(_0x40a834,_0x97ae47){var _0x33a6b0={'raw':![],'where':{'id':_0x40a834[_0xec16('0x58')]['id']},'include':[{'model':db[_0xec16('0x59')],'as':'mandatoryDispositionPause'}]},_0xbca9b={};_0xbca9b[_0xec16('0x45')]=_[_0xec16('0x47')](db[_0xec16('0x40')][_0xec16('0x41')]);_0xbca9b[_0xec16('0x46')]=_[_0xec16('0x47')](_0x40a834['query']);_0xbca9b[_0xec16('0x4f')]=_[_0xec16('0x49')](_0xbca9b[_0xec16('0x45')],_0xbca9b['query']);_0x33a6b0[_0xec16('0x48')]=_[_0xec16('0x49')](_0xbca9b[_0xec16('0x45')],qs[_0xec16('0x4a')](_0x40a834[_0xec16('0x46')][_0xec16('0x4a')]));_0x33a6b0['attributes']=_0x33a6b0[_0xec16('0x48')][_0xec16('0x4b')]?_0x33a6b0[_0xec16('0x48')]:_0xbca9b['model'];if(_0x40a834[_0xec16('0x46')][_0xec16('0x53')]){_0x33a6b0[_0xec16('0x54')]=[{'all':!![]}];}_0x33a6b0=_[_0xec16('0x50')]({},_0x33a6b0,_0x40a834['options']);return db[_0xec16('0x40')]['find'](_0x33a6b0)[_0xec16('0x22')](handleEntityNotFound(_0x97ae47,null))['then'](respondWithResult(_0x97ae47,null))['catch'](handleError(_0x97ae47,null));};exports[_0xec16('0x5a')]=function(_0x5808dc,_0x19151a){return db[_0xec16('0x40')][_0xec16('0x5a')](_0x5808dc[_0xec16('0x5b')],{})[_0xec16('0x22')](function(_0x47fb45){var _0x3a23ef=_0x5808dc['user'][_0xec16('0x5c')]({'plain':!![]});if(!_0x3a23ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a23ef['role']===_0xec16('0x5d')){var _0x2f2023=_0x47fb45[_0xec16('0x5c')]({'plain':!![]});var _0x2271f2=_0xec16('0x3a');return db[_0xec16('0x5e')][_0xec16('0x5f')]({'where':{'name':_0x2271f2,'userProfileId':_0x3a23ef[_0xec16('0x60')]},'raw':!![]})[_0xec16('0x22')](function(_0x29fba6){if(_0x29fba6&&_0x29fba6[_0xec16('0x61')]===0x0){return db[_0xec16('0x62')][_0xec16('0x5a')]({'name':_0x2f2023[_0xec16('0x3d')],'resourceId':_0x2f2023['id'],'type':_0x29fba6['name'],'sectionId':_0x29fba6['id']},{})[_0xec16('0x22')](function(){return _0x47fb45;});}else{return _0x47fb45;}})[_0xec16('0x2d')](function(_0x105c06){logger[_0xec16('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x105c06);throw _0x105c06;});}return _0x47fb45;})[_0xec16('0x22')](respondWithResult(_0x19151a,0xc9))['catch'](handleError(_0x19151a,null));};exports[_0xec16('0x38')]=function(_0x39414b,_0x2aec60){if(_0x39414b[_0xec16('0x5b')]['id']){delete _0x39414b[_0xec16('0x5b')]['id'];}return db[_0xec16('0x40')][_0xec16('0x5f')]({'where':{'id':_0x39414b[_0xec16('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xec16('0x63')}]})[_0xec16('0x22')](handleEntityNotFound(_0x2aec60,null))[_0xec16('0x22')](saveUpdates(_0x39414b[_0xec16('0x5b')],null))[_0xec16('0x22')](respondWithResult(_0x2aec60,null))[_0xec16('0x2d')](handleError(_0x2aec60,null));};exports[_0xec16('0x39')]=function(_0x1e54fb,_0x2cd8e8){return db[_0xec16('0x40')][_0xec16('0x5f')]({'where':{'id':_0x1e54fb[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x2cd8e8,null))[_0xec16('0x22')](removeEntity(_0x2cd8e8,null))['catch'](handleError(_0x2cd8e8,null));};exports[_0xec16('0x64')]=function(_0x3fb59a,_0x1dac4a){return db[_0xec16('0x40')][_0xec16('0x64')]()[_0xec16('0x22')](respondWithResult(_0x1dac4a,null))[_0xec16('0x2d')](handleError(_0x1dac4a,null));};exports[_0xec16('0x65')]=function(_0x47dd74,_0x4967eb,_0x54956d){if(_0x47dd74[_0xec16('0x5b')]['id']){delete _0x47dd74[_0xec16('0x5b')]['id'];}return db['OpenchannelAccount'][_0xec16('0x5f')]({'where':{'id':_0x47dd74['params']['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x4967eb,null))[_0xec16('0x22')](function(_0x84c882){if(_0x84c882){_0x47dd74[_0xec16('0x5b')][_0xec16('0x66')]=_0x84c882['id'];return db[_0xec16('0x67')]['create'](_0x47dd74[_0xec16('0x5b')]);}})['then'](respondWithResult(_0x4967eb,null))[_0xec16('0x2d')](handleError(_0x4967eb,null));};exports[_0xec16('0x68')]=function(_0x208b9c,_0x380dcc,_0x340ea0){var _0x47eb8a={'raw':![],'where':{}};var _0xca1847={};var _0x17f5dd={'count':0x0,'rows':[]};return db[_0xec16('0x40')][_0xec16('0x69')]({'where':{'id':_0x208b9c[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x380dcc,null))[_0xec16('0x22')](function(_0x57555a){if(_0x57555a){_0xca1847[_0xec16('0x45')]=_[_0xec16('0x47')](db[_0xec16('0x67')][_0xec16('0x41')]);_0xca1847[_0xec16('0x46')]=_[_0xec16('0x47')](_0x208b9c[_0xec16('0x46')]);_0xca1847[_0xec16('0x4f')]=_['intersection'](_0xca1847[_0xec16('0x45')],_0xca1847[_0xec16('0x46')]);_0x47eb8a[_0xec16('0x48')]=_['intersection'](_0xca1847[_0xec16('0x45')],qs[_0xec16('0x4a')](_0x208b9c[_0xec16('0x46')][_0xec16('0x4a')]));_0x47eb8a[_0xec16('0x48')]=_0x47eb8a[_0xec16('0x48')]['length']?_0x47eb8a['attributes']:_0xca1847[_0xec16('0x45')];if(!_0x208b9c[_0xec16('0x46')][_0xec16('0x6a')](_0xec16('0x6b'))){_0x47eb8a[_0xec16('0x32')]=qs[_0xec16('0x32')](_0x208b9c[_0xec16('0x46')][_0xec16('0x32')]);_0x47eb8a['offset']=qs[_0xec16('0x30')](_0x208b9c[_0xec16('0x46')]['offset']);}_0x47eb8a[_0xec16('0x4c')]=qs[_0xec16('0x4d')](_0x208b9c['query'][_0xec16('0x4d')]);_0x47eb8a[_0xec16('0x4e')]=qs[_0xec16('0x4f')](_[_0xec16('0x6c')](_0x208b9c[_0xec16('0x46')],_0xca1847[_0xec16('0x4f')]));_0x47eb8a[_0xec16('0x4e')][_0xec16('0x66')]=_0x57555a['id'];if(_0x208b9c['query'][_0xec16('0x52')]){_0x47eb8a[_0xec16('0x4e')]=_['merge'](_0x47eb8a['where'],{'$or':_[_0xec16('0x3f')](_0x47eb8a[_0xec16('0x48')],function(_0x1d0bac){var _0x57f0ae={};_0x57f0ae[_0x1d0bac]={'$like':'%'+_0x208b9c['query'][_0xec16('0x52')]+'%'};return _0x57f0ae;})});}_0x47eb8a=_[_0xec16('0x50')]({},_0x47eb8a,_0x208b9c[_0xec16('0x6d')]);return db[_0xec16('0x67')][_0xec16('0x33')]({'where':_0x47eb8a[_0xec16('0x4e')]})[_0xec16('0x22')](function(_0x5488cd){_0x17f5dd[_0xec16('0x33')]=_0x5488cd;if(_0x208b9c['query'][_0xec16('0x53')]){_0x47eb8a['include']=[{'all':!![]}];}return db[_0xec16('0x67')][_0xec16('0x55')](_0x47eb8a);})['then'](function(_0x925f){_0x17f5dd['rows']=_0x925f;return _0x17f5dd;});}})[_0xec16('0x22')](respondWithFilteredResult(_0x380dcc,_0x47eb8a))['catch'](handleError(_0x380dcc,null));};exports['removeDispositions']=function(_0x37c51c,_0x4e033b,_0x2b13cb){return db[_0xec16('0x40')]['find']({'where':{'id':_0x37c51c[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x4e033b,null))['then'](function(_0x313a86){if(_0x313a86){return _0x313a86[_0xec16('0x6e')](_0x37c51c[_0xec16('0x46')][_0xec16('0x6f')]);}})[_0xec16('0x22')](respondWithStatusCode(_0x4e033b,null))[_0xec16('0x2d')](handleError(_0x4e033b,null));};exports[_0xec16('0x70')]=function(_0xa5e7e6,_0x3f320f,_0x33b38d){if(_0xa5e7e6['body']['id']){delete _0xa5e7e6[_0xec16('0x5b')]['id'];}return db[_0xec16('0x40')][_0xec16('0x5f')]({'where':{'id':_0xa5e7e6[_0xec16('0x58')]['id']}})['then'](handleEntityNotFound(_0x3f320f,null))[_0xec16('0x22')](function(_0x1f26d8){if(_0x1f26d8){_0xa5e7e6[_0xec16('0x5b')][_0xec16('0x66')]=_0x1f26d8['id'];return db[_0xec16('0x71')]['create'](_0xa5e7e6[_0xec16('0x5b')]);}})['then'](respondWithResult(_0x3f320f,null))[_0xec16('0x2d')](handleError(_0x3f320f,null));};exports[_0xec16('0x72')]=function(_0x38b434,_0x437363,_0x3bb07c){var _0xb46e90={'raw':![],'where':{}};var _0x31528d={};var _0x1e8f14={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xec16('0x69')]({'where':{'id':_0x38b434[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x437363,null))[_0xec16('0x22')](function(_0x5983a7){if(_0x5983a7){_0x31528d[_0xec16('0x45')]=_[_0xec16('0x47')](db[_0xec16('0x71')][_0xec16('0x41')]);_0x31528d['query']=_[_0xec16('0x47')](_0x38b434[_0xec16('0x46')]);_0x31528d[_0xec16('0x4f')]=_['intersection'](_0x31528d['model'],_0x31528d[_0xec16('0x46')]);_0xb46e90[_0xec16('0x48')]=_[_0xec16('0x49')](_0x31528d['model'],qs[_0xec16('0x4a')](_0x38b434[_0xec16('0x46')][_0xec16('0x4a')]));_0xb46e90[_0xec16('0x48')]=_0xb46e90[_0xec16('0x48')][_0xec16('0x4b')]?_0xb46e90[_0xec16('0x48')]:_0x31528d['model'];if(!_0x38b434[_0xec16('0x46')][_0xec16('0x6a')]('nolimit')){_0xb46e90[_0xec16('0x32')]=qs[_0xec16('0x32')](_0x38b434[_0xec16('0x46')][_0xec16('0x32')]);_0xb46e90[_0xec16('0x30')]=qs['offset'](_0x38b434[_0xec16('0x46')]['offset']);}_0xb46e90[_0xec16('0x4c')]=qs[_0xec16('0x4d')](_0x38b434[_0xec16('0x46')][_0xec16('0x4d')]);_0xb46e90[_0xec16('0x4e')]=qs[_0xec16('0x4f')](_[_0xec16('0x6c')](_0x38b434[_0xec16('0x46')],_0x31528d[_0xec16('0x4f')]));_0xb46e90['where'][_0xec16('0x66')]=_0x5983a7['id'];if(_0x38b434[_0xec16('0x46')][_0xec16('0x52')]){_0xb46e90[_0xec16('0x4e')]=_[_0xec16('0x50')](_0xb46e90[_0xec16('0x4e')],{'$or':_[_0xec16('0x3f')](_0xb46e90[_0xec16('0x48')],function(_0xf6e0d4){var _0x36e7b5={};_0x36e7b5[_0xf6e0d4]={'$like':'%'+_0x38b434[_0xec16('0x46')]['filter']+'%'};return _0x36e7b5;})});}_0xb46e90=_['merge']({},_0xb46e90,_0x38b434['options']);return db[_0xec16('0x71')]['count']({'where':_0xb46e90[_0xec16('0x4e')]})[_0xec16('0x22')](function(_0x238498){_0x1e8f14[_0xec16('0x33')]=_0x238498;if(_0x38b434[_0xec16('0x46')][_0xec16('0x53')]){_0xb46e90[_0xec16('0x54')]=[{'all':!![]}];}return db[_0xec16('0x71')][_0xec16('0x55')](_0xb46e90);})[_0xec16('0x22')](function(_0x3c48bd){_0x1e8f14['rows']=_0x3c48bd;return _0x1e8f14;});}})['then'](respondWithFilteredResult(_0x437363,_0xb46e90))['catch'](handleError(_0x437363,null));};exports[_0xec16('0x73')]=function(_0x43e428,_0x192eb9,_0x2f6f97){return db[_0xec16('0x40')][_0xec16('0x5f')]({'where':{'id':_0x43e428[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x192eb9,null))['then'](function(_0x429a60){if(_0x429a60){return _0x429a60[_0xec16('0x73')](_0x43e428[_0xec16('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x192eb9,null))['catch'](handleError(_0x192eb9,null));};exports['notify']=function(_0x55d29d,_0x346887,_0x5c9013){var _0x56b14c={'body':_0x55d29d[_0xec16('0x5b')],'channel':_0xec16('0x74')};var _0x4b1465=[];var _0x58506b=[];var _0x293efd={};var _0x495637=![];return db[_0xec16('0x75')][_0xec16('0x64')]()[_0xec16('0x22')](function(_0x370ecd){if(!_0x370ecd){throw new db[(_0xec16('0x76'))]['ValidationError']('no\x20available\x20attributes');}_0x4b1465=_[_0xec16('0x77')](_[_0xec16('0x47')](_0x370ecd),[_0xec16('0x78'),_0xec16('0x79')]);_0x58506b=_['difference'](_[_0xec16('0x47')](_0x370ecd),['createdAt',_0xec16('0x79'),'CompanyId',_0xec16('0x7a')]);if(_0x55d29d[_0xec16('0x5b')]['id']){delete _0x55d29d[_0xec16('0x5b')]['id'];}if(_[_0xec16('0x7b')](_0x55d29d[_0xec16('0x5b')][_0xec16('0x7c')])){throw new db[(_0xec16('0x76'))][(_0xec16('0x7d'))](_0xec16('0x7e'));}if(_[_0xec16('0x7b')](_0x55d29d[_0xec16('0x5b')]['body'])||_0x55d29d[_0xec16('0x5b')]['body']===''){throw new db['Sequelize'][(_0xec16('0x7d'))](_0xec16('0x7f'));}if(_[_0xec16('0x7b')](_0x55d29d[_0xec16('0x5b')][_0xec16('0x80')])){throw new db[(_0xec16('0x76'))][(_0xec16('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58506b);}if(!_[_0xec16('0x81')](_0x58506b,_0x55d29d[_0xec16('0x5b')][_0xec16('0x80')])){throw new db[(_0xec16('0x76'))][(_0xec16('0x7d'))](_0xec16('0x82')+_0x58506b);}_0x293efd[_0x55d29d[_0xec16('0x5b')][_0xec16('0x80')]]=_0x55d29d['body'][_0xec16('0x7c')];})[_0xec16('0x22')](function(){return db[_0xec16('0x40')]['find']({'where':{'id':_0x55d29d[_0xec16('0x58')]['id']},'include':[{'model':db[_0xec16('0x83')],'as':'List','include':[{'model':db[_0xec16('0x75')],'as':_0xec16('0x84'),'where':_0x293efd,'limit':0x1,'order':[[_0xec16('0x79'),_0xec16('0x85')]]}]},{'model':db[_0xec16('0x86')],'as':'Applications'}]});})[_0xec16('0x22')](handleEntityNotFound(_0x346887,null))[_0xec16('0x22')](function(_0x3cf474){if(_0x3cf474&&_0x3cf474[_0xec16('0x87')]){_0x56b14c['account']=_0x3cf474;_0x56b14c[_0xec16('0x88')]=_0x3cf474[_0xec16('0x89')];_0x56b14c['list']=_0x3cf474[_0xec16('0x87')];_0x56b14c['applications']=_[_0xec16('0x8a')](_0x56b14c[_0xec16('0x88')],['priority'],[_0xec16('0x8b')]);if(_0x56b14c[_0xec16('0x8c')][_0xec16('0x89')]){delete _0x56b14c[_0xec16('0x8c')][_0xec16('0x89')];}if(_0x56b14c[_0xec16('0x8c')]['List']&&_0x56b14c[_0xec16('0x8c')]['List'][_0xec16('0x84')][_0xec16('0x4b')]){return _0x56b14c[_0xec16('0x8c')]['List'][_0xec16('0x84')][0x0];}var _0x14059b=_[_0xec16('0x8d')](_0x55d29d[_0xec16('0x5b')],{'firstName':_0x55d29d['body']['from'],'ListId':_0x3cf474[_0xec16('0x7a')]});_0x14059b[_0x55d29d['body']['mapKey']]=_0x55d29d['body'][_0xec16('0x7c')];return db[_0xec16('0x75')][_0xec16('0x5a')](_0x14059b,{'fields':_0x4b1465,'raw':!![]});}})['then'](handleEntityNotFound(_0x346887,null))['then'](function(_0x4e188a){_0x56b14c[_0xec16('0x8e')]=_0x4e188a;if(_0x4e188a){var _0x57c8ab={'ContactId':_0x4e188a['id'],'OpenchannelAccountId':_0x55d29d[_0xec16('0x58')]['id'],'from':(_0x4e188a['firstName']||'')+'\x20'+(_0x4e188a[_0xec16('0x8f')]||'')};var _0xbe7257={'OpenchannelAccountId':_0x55d29d[_0xec16('0x58')]['id'],'closed':![]};if(_0x55d29d['body'][_0xec16('0x90')]){_0xbe7257[_0xec16('0x90')]=_0x55d29d[_0xec16('0x5b')][_0xec16('0x90')];return db['OpenchannelInteraction'][_0xec16('0x5f')]({'where':_0xbe7257})['then'](function(_0x116110){if(_0x116110){return[_0x116110,![]];}_0x57c8ab[_0xec16('0x90')]=_0x55d29d['body'][_0xec16('0x90')];_0x57c8ab[_0xec16('0x91')]=_0x55d29d['body'][_0xec16('0x91')];return db[_0xec16('0x92')]['create'](_0x57c8ab)[_0xec16('0x22')](function(_0x3ff6bb){return[_0x3ff6bb,!![]];});});}else{_0xbe7257[_0xec16('0x90')]=null;}_0xbe7257['ContactId']=_0x4e188a['id'];return db[_0xec16('0x92')][_0xec16('0x5f')]({'where':_0xbe7257})[_0xec16('0x22')](function(_0x3535c4){if(_0x3535c4){return[_0x3535c4,![]];}return db['OpenchannelInteraction'][_0xec16('0x5a')](_0x57c8ab)['then'](function(_0x21743f){return[_0x21743f,!![]];});});}})['spread'](function(_0x3df6dd,_0x6089a8){if(_0x3df6dd){_0x495637=_0x6089a8;if(!_0x6089a8){var _0x3acca1={'from':(_0x56b14c[_0xec16('0x8e')]['firstName']||'')+'\x20'+(_0x56b14c[_0xec16('0x8e')]['lastName']||'')};if(_0x55d29d[_0xec16('0x5b')][_0xec16('0x90')]&&_0x55d29d['body'][_0xec16('0x93')]&&_0x55d29d[_0xec16('0x5b')]['threadId']!=_0x55d29d[_0xec16('0x5b')][_0xec16('0x93')]){_0x3acca1[_0xec16('0x90')]=_0x55d29d[_0xec16('0x5b')]['messageId'];}return _0x3df6dd['update'](_0x3acca1);}else{return _0x3df6dd;}}})['then'](function(_0x31eb41){_0x56b14c['interaction']=_0x31eb41[_0xec16('0x5c')]({'plain':!![]});_0x56b14c[_0xec16('0x94')][_0xec16('0x95')]=_0x495637;if(_0x56b14c[_0xec16('0x94')][_0xec16('0x95')]){if(_0x56b14c[_0xec16('0x8c')][_0xec16('0x96')]){_0x56b14c[_0xec16('0x88')][_0xec16('0x97')]({'id':0x0,'priority':_0x56b14c[_0xec16('0x88')][_0xec16('0x4b')]+0x1,'app':_0xec16('0x98'),'appdata':_0xec16('0x99'),'interval':'*,*,*,*'});}}return db[_0xec16('0x9a')]['create']({'body':_0x55d29d[_0xec16('0x5b')][_0xec16('0x5b')],'OpenchannelAccountId':_0x55d29d[_0xec16('0x58')]['id'],'OpenchannelInteractionId':_0x31eb41['id'],'direction':'in','ContactId':_0x56b14c[_0xec16('0x8e')]['id'],'AttachmentId':_0x55d29d['body'][_0xec16('0x9b')]});})['then'](function(_0x26c3a4){_0x56b14c[_0xec16('0x2b')]=_0x26c3a4;if(_0x56b14c[_0xec16('0x94')][_0xec16('0x9c')]){return db[_0xec16('0x9d')][_0xec16('0x5f')]({'attributes':['id',_0xec16('0x3d')],'where':{'id':_0x56b14c[_0xec16('0x94')][_0xec16('0x9c')]}})[_0xec16('0x22')](function(_0x56cd8b){if(_0x56cd8b){_0x56b14c[_0xec16('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0xec16('0x9e'),'appdata':_0x56cd8b[_0xec16('0x3d')]+','+(_0x56b14c[_0xec16('0x8c')]['waitForTheAssignedAgent']||0xa),'interval':_0xec16('0x9f')});_0x56b14c[_0xec16('0xa0')]=![];}return respondWithRpcPromise(_0xec16('0xa1'),_0xec16('0xa2'),_0x56b14c);});}return respondWithRpcPromise(_0xec16('0xa1'),_0xec16('0xa2'),_0x56b14c);})[_0xec16('0x22')](function(_0xa5e18a){respondWithRpcPromise(_0xec16('0xa3'),'EventManager',{'event':_0xec16('0xa4'),'message':_0xa5e18a},client9002);return _0xa5e18a;})['then'](respondWithResult(_0x346887,null))[_0xec16('0x2d')](handleError(_0x346887,null));};exports[_0xec16('0xa5')]=function(_0x16656e,_0x177a38){var _0x2fd074=_0x16656e[_0xec16('0x58')]['id'];var _0xea633a=_0x16656e['body'];var _0x242e40=0xc8;var _0x6418fd=null;return db[_0xec16('0xa6')][_0xec16('0xa7')]({'isolationLevel':db[_0xec16('0xa6')]['Transaction'][_0xec16('0xa8')][_0xec16('0xa9')]},function(_0x5c5b73){return db[_0xec16('0x40')][_0xec16('0x69')]({'where':{'id':_0x2fd074},'transaction':_0x5c5b73})['then'](function(_0x45af62){if(_0x45af62){return db[_0xec16('0x86')][_0xec16('0x39')]({'where':{'OpenchannelAccountId':_0x2fd074},'transaction':_0x5c5b73})[_0xec16('0x22')](function(){var _0x391a92=_[_0xec16('0x3f')](_0xea633a,function(_0x4d41eb){_0x4d41eb[_0xec16('0x66')]=_0x2fd074;return _0x4d41eb;});return db['OpenchannelApplication'][_0xec16('0xaa')](_0x391a92,{'transaction':_0x5c5b73});});}else{_0x242e40=0x194;_0x6418fd=[];}});})[_0xec16('0x22')](function(){if(_0x242e40!==0x194){return db['OpenchannelApplication'][_0xec16('0xab')]({'where':{'OpenchannelAccountId':_0x2fd074},'order':'priority'})[_0xec16('0x22')](function(_0x6eabeb){_0x6418fd=_0x6eabeb;});}})[_0xec16('0x2d')](function(_0x5a89c1){_0x242e40=0x1f4;logger[_0xec16('0x28')](_0x5a89c1[_0xec16('0x3c')]);if(_0x5a89c1[_0xec16('0x3d')]){delete _0x5a89c1[_0xec16('0x3d')];}_0x6418fd=_0x5a89c1;})['finally'](function(){if(_0x6418fd===null){_0x177a38[_0xec16('0xac')](_0x242e40);}else{if(_0x242e40===0x1f4){_0x177a38[_0xec16('0x2e')](_0x242e40)[_0xec16('0x3e')](_0x6418fd);}else{_0x177a38[_0xec16('0x2e')](_0x242e40)[_0xec16('0x2f')](_0x6418fd);}}});};exports['getApplications']=function(_0x150d71,_0x1a1fed,_0x190db2){var _0x506d62={};var _0x44ba58={};var _0x44409d;var _0x57fdf5;return db[_0xec16('0x40')][_0xec16('0x69')]({'where':{'id':_0x150d71[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x1a1fed,null))[_0xec16('0x22')](function(_0x5e8712){if(_0x5e8712){_0x44409d=_0x5e8712;_0x44ba58['model']=_[_0xec16('0x47')](db[_0xec16('0x86')][_0xec16('0x41')]);_0x44ba58[_0xec16('0x46')]=_[_0xec16('0x47')](_0x150d71[_0xec16('0x46')]);_0x44ba58['filters']=_[_0xec16('0x49')](_0x44ba58[_0xec16('0x45')],_0x44ba58[_0xec16('0x46')]);_0x506d62[_0xec16('0x48')]=_[_0xec16('0x49')](_0x44ba58[_0xec16('0x45')],qs[_0xec16('0x4a')](_0x150d71[_0xec16('0x46')]['fields']));_0x506d62[_0xec16('0x48')]=_0x506d62['attributes'][_0xec16('0x4b')]?_0x506d62['attributes']:_0x44ba58[_0xec16('0x45')];_0x506d62[_0xec16('0x4c')]=qs['sort'](_0x150d71[_0xec16('0x46')][_0xec16('0x4d')]);_0x506d62['where']=qs[_0xec16('0x4f')](_[_0xec16('0x6c')](_0x150d71[_0xec16('0x46')],_0x44ba58[_0xec16('0x4f')]));if(_0x150d71[_0xec16('0x46')]['filter']){_0x506d62[_0xec16('0x4e')]=_[_0xec16('0x50')](_0x506d62[_0xec16('0x4e')],{'$or':_[_0xec16('0x3f')](_0x506d62[_0xec16('0x48')],function(_0x58fdd9){var _0x2cbb88={};_0x2cbb88[_0x58fdd9]={'$like':'%'+_0x150d71[_0xec16('0x46')][_0xec16('0x52')]+'%'};return _0x2cbb88;})});}_0x506d62=_[_0xec16('0x50')]({},_0x506d62,_0x150d71[_0xec16('0x6d')]);return _0x44409d[_0xec16('0xad')](_0x506d62);}})['then'](function(_0x40d760){if(_0x40d760){_0x57fdf5=_0x40d760[_0xec16('0x4b')];if(!_0x150d71[_0xec16('0x46')]['hasOwnProperty'](_0xec16('0x6b'))){_0x506d62[_0xec16('0x32')]=qs['limit'](_0x150d71[_0xec16('0x46')][_0xec16('0x32')]);_0x506d62[_0xec16('0x30')]=qs['offset'](_0x150d71[_0xec16('0x46')][_0xec16('0x30')]);}return _0x44409d['getApplications'](_0x506d62);}})[_0xec16('0x22')](function(_0x1aa80f){if(_0x1aa80f){return _0x1aa80f?{'count':_0x57fdf5,'rows':_0x1aa80f}:null;}})[_0xec16('0x22')](respondWithResult(_0x1a1fed,null))[_0xec16('0x2d')](handleError(_0x1a1fed,null));};exports[_0xec16('0xae')]=function(_0x18c813,_0x559682,_0x287034){var _0x5411a0={'raw':![],'where':{}};var _0x1fb388={};var _0x27470b={'count':0x0,'rows':[]};return db[_0xec16('0x40')][_0xec16('0x69')]({'where':{'id':_0x18c813[_0xec16('0x58')]['id']}})['then'](handleEntityNotFound(_0x559682,null))[_0xec16('0x22')](function(_0xb3de3b){if(_0xb3de3b){_0x1fb388[_0xec16('0x45')]=_['keys'](db['OpenchannelInteraction'][_0xec16('0x41')]);_0x1fb388[_0xec16('0x46')]=_[_0xec16('0x47')](_0x18c813[_0xec16('0x46')]);_0x1fb388['filters']=_['intersection'](_0x1fb388[_0xec16('0x45')],_0x1fb388[_0xec16('0x46')]);_0x5411a0[_0xec16('0x48')]=_[_0xec16('0x49')](_0x1fb388[_0xec16('0x45')],qs[_0xec16('0x4a')](_0x18c813[_0xec16('0x46')][_0xec16('0x4a')]));_0x5411a0[_0xec16('0x48')]=_0x5411a0[_0xec16('0x48')][_0xec16('0x4b')]?_0x5411a0[_0xec16('0x48')]:_0x1fb388['model'];if(!_0x18c813[_0xec16('0x46')]['hasOwnProperty']('nolimit')){_0x5411a0[_0xec16('0x32')]=qs['limit'](_0x18c813[_0xec16('0x46')][_0xec16('0x32')]);_0x5411a0['offset']=qs[_0xec16('0x30')](_0x18c813['query'][_0xec16('0x30')]);}_0x5411a0['order']=qs[_0xec16('0x4d')](_0x18c813['query']['sort']);_0x5411a0[_0xec16('0x4e')]=qs[_0xec16('0x4f')](_[_0xec16('0x6c')](_0x18c813[_0xec16('0x46')],_0x1fb388[_0xec16('0x4f')]));_0x5411a0[_0xec16('0x4e')]['OpenchannelAccountId']=_0xb3de3b['id'];if(_0x18c813[_0xec16('0x46')]['filter']){_0x5411a0[_0xec16('0x4e')]=_[_0xec16('0x50')](_0x5411a0[_0xec16('0x4e')],{'$or':_[_0xec16('0x3f')](_0x5411a0['attributes'],function(_0x2c155c){var _0x5cab75={};_0x5cab75[_0x2c155c]={'$like':'%'+_0x18c813[_0xec16('0x46')][_0xec16('0x52')]+'%'};return _0x5cab75;})});}_0x5411a0=_[_0xec16('0x50')]({},_0x5411a0,_0x18c813[_0xec16('0x6d')]);return db[_0xec16('0x92')]['count']({'where':_0x5411a0[_0xec16('0x4e')]})['then'](function(_0x398332){_0x27470b['count']=_0x398332;if(_0x18c813['query'][_0xec16('0x53')]){_0x5411a0[_0xec16('0x54')]=[{'model':db[_0xec16('0x75')],'as':_0xec16('0xaf'),'required':![]},{'model':db[_0xec16('0x9d')],'as':_0xec16('0xb0'),'attributes':['name',_0xec16('0xb1'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xec16('0xb2'),'attributes':['id',_0xec16('0x3d'),_0xec16('0xb3')],'where':_0x18c813[_0xec16('0x46')][_0xec16('0xb4')]?{'id':_0x18c813[_0xec16('0x46')]['tag']}:undefined,'required':_0x18c813[_0xec16('0x46')][_0xec16('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xec16('0x55')](_0x5411a0);})[_0xec16('0x22')](function(_0x175b04){_0x27470b[_0xec16('0x56')]=_0x175b04;return _0x27470b;});}})[_0xec16('0x22')](respondWithFilteredResult(_0x559682,_0x5411a0))[_0xec16('0x2d')](handleError(_0x559682,null));};exports[_0xec16('0xb5')]=function(_0x9d1129,_0x40e240,_0x5883cf){return db[_0xec16('0x40')][_0xec16('0x5f')]({'where':{'id':_0x9d1129[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x40e240,null))[_0xec16('0x22')](function(_0x488eab){if(_0x488eab){return _0x488eab[_0xec16('0xb5')](_0x9d1129[_0xec16('0x5b')]['ids'],_[_0xec16('0xb6')](_0x9d1129[_0xec16('0x5b')],[_0xec16('0x6f'),'id'])||{})['spread'](function(_0x4984f7){for(var _0x385333=0x0;_0x385333<_0x9d1129[_0xec16('0x5b')][_0xec16('0x6f')][_0xec16('0x4b')];_0x385333+=0x1){socket['emit'](_0xec16('0xb7'),{'UserId':Number(_0x9d1129[_0xec16('0x5b')]['ids'][_0x385333]),'OpenchannelAccountId':Number(_0x9d1129[_0xec16('0x58')]['id'])});}return _0x4984f7;});}})['then'](respondWithResult(_0x40e240,null))[_0xec16('0x2d')](handleError(_0x40e240,null));};exports[_0xec16('0xb8')]=function(_0x1f3b77,_0x4414a5,_0x5aa832){return db[_0xec16('0x40')][_0xec16('0x5f')]({'where':{'id':_0x1f3b77[_0xec16('0x58')]['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x4414a5,null))[_0xec16('0x22')](function(_0x2cd243){if(_0x2cd243){return _0x2cd243['removeAgents'](_0x1f3b77[_0xec16('0x46')][_0xec16('0x6f')])[_0xec16('0x22')](function(){if(_[_0xec16('0xb9')](_0x1f3b77[_0xec16('0x46')]['ids'])){for(var _0x3d9b4c=0x0;_0x3d9b4c<_0x1f3b77['query'][_0xec16('0x6f')][_0xec16('0x4b')];_0x3d9b4c+=0x1){socket[_0xec16('0xba')](_0xec16('0xbb'),{'UserId':Number(_0x1f3b77[_0xec16('0x46')][_0xec16('0x6f')][_0x3d9b4c]),'OpenchannelAccountId':Number(_0x1f3b77[_0xec16('0x58')]['id'])});}}else{socket['emit'](_0xec16('0xbb'),{'UserId':Number(_0x1f3b77[_0xec16('0x46')][_0xec16('0x6f')]),'OpenchannelAccountId':Number(_0x1f3b77[_0xec16('0x58')]['id'])});}});}})[_0xec16('0x22')](respondWithStatusCode(_0x4414a5,null))[_0xec16('0x2d')](handleError(_0x4414a5,null));};exports[_0xec16('0xbc')]=function(_0x2f05c5,_0x452f73,_0x57d2d5){var _0x188f4e={};var _0x28b0dc={};var _0x5d5fb1;var _0x598120;return db['OpenchannelAccount'][_0xec16('0x69')]({'where':{'id':_0x2f05c5['params']['id']}})[_0xec16('0x22')](handleEntityNotFound(_0x452f73,null))[_0xec16('0x22')](function(_0x1e9e0f){if(_0x1e9e0f){_0x5d5fb1=_0x1e9e0f;_0x28b0dc['model']=_['keys'](db[_0xec16('0x9d')][_0xec16('0x41')]);_0x28b0dc[_0xec16('0x46')]=_[_0xec16('0x47')](_0x2f05c5[_0xec16('0x46')]);_0x28b0dc[_0xec16('0x4f')]=_[_0xec16('0x49')](_0x28b0dc[_0xec16('0x45')],_0x28b0dc[_0xec16('0x46')]);_0x188f4e[_0xec16('0x48')]=_['intersection'](_0x28b0dc[_0xec16('0x45')],qs[_0xec16('0x4a')](_0x2f05c5[_0xec16('0x46')][_0xec16('0x4a')]));_0x188f4e['attributes']=_0x188f4e[_0xec16('0x48')][_0xec16('0x4b')]?_0x188f4e['attributes']:_0x28b0dc[_0xec16('0x45')];_0x188f4e['order']=qs['sort'](_0x2f05c5[_0xec16('0x46')][_0xec16('0x4d')]);_0x188f4e['where']=qs[_0xec16('0x4f')](_[_0xec16('0x6c')](_0x2f05c5[_0xec16('0x46')],_0x28b0dc['filters']));if(_0x2f05c5[_0xec16('0x46')][_0xec16('0x52')]){_0x188f4e['where']=_[_0xec16('0x50')](_0x188f4e[_0xec16('0x4e')],{'$or':_[_0xec16('0x3f')](_0x188f4e[_0xec16('0x48')],function(_0x3babcb){var _0x13eae2={};_0x13eae2[_0x3babcb]={'$like':'%'+_0x2f05c5['query'][_0xec16('0x52')]+'%'};return _0x13eae2;})});}_0x188f4e=_[_0xec16('0x50')]({},_0x188f4e,_0x2f05c5[_0xec16('0x6d')]);return _0x5d5fb1[_0xec16('0xbc')](_0x188f4e);}})[_0xec16('0x22')](function(_0x11f7d1){if(_0x11f7d1){_0x598120=_0x11f7d1[_0xec16('0x4b')];if(!_0x2f05c5[_0xec16('0x46')][_0xec16('0x6a')]('nolimit')){_0x188f4e[_0xec16('0x32')]=qs[_0xec16('0x32')](_0x2f05c5[_0xec16('0x46')][_0xec16('0x32')]);_0x188f4e[_0xec16('0x30')]=qs[_0xec16('0x30')](_0x2f05c5[_0xec16('0x46')][_0xec16('0x30')]);}return _0x5d5fb1[_0xec16('0xbc')](_0x188f4e);}})[_0xec16('0x22')](function(_0x4e50fa){if(_0x4e50fa){return _0x4e50fa?{'count':_0x598120,'rows':_0x4e50fa}:null;}})[_0xec16('0x22')](respondWithResult(_0x452f73,null))[_0xec16('0x2d')](handleError(_0x452f73,null));};exports[_0xec16('0x3e')]=function(_0x7958f7,_0x5147ac,_0x19438c){var _0x544d3c,_0x3263aa,_0xb66efe;if(_[_0xec16('0x7b')](_0x7958f7[_0xec16('0x5b')][_0xec16('0x5b')])||_0x7958f7[_0xec16('0x5b')][_0xec16('0x5b')]===''){throw new db[(_0xec16('0x76'))][(_0xec16('0x7d'))](_0xec16('0x7f'));}if(_[_0xec16('0x7b')](_0x7958f7[_0xec16('0x5b')]['to'])){}_0x544d3c=_0x7958f7[_0xec16('0x5b')]['to'];return db[_0xec16('0x40')][_0xec16('0x69')]({'where':{'id':_0x7958f7['params']['id']}})['then'](handleEntityNotFound(_0x5147ac,null))['then'](function(_0x2f2ad4){if(_0x2f2ad4){return db['OpenchannelAccount'][_0xec16('0x5f')]({'where':{'id':_0x2f2ad4['id']},'include':[{'model':db[_0xec16('0x83')],'as':'List','include':[{'model':db[_0xec16('0x75')],'as':_0xec16('0x84'),'where':{[_0x2f2ad4['mapKey']]:_0x544d3c},'limit':0x1,'order':[[_0xec16('0x79'),_0xec16('0x85')]]}]}]})[_0xec16('0x22')](handleEntityNotFound(_0x5147ac,null))[_0xec16('0x22')](function(_0x58ba2f){if(_0x58ba2f&&_0x58ba2f[_0xec16('0x87')]){_0x3263aa=_0x58ba2f[_0xec16('0x5c')]({'plain':!![]});if(_0x3263aa['List']&&_0x3263aa[_0xec16('0x87')]['Contacts']['length']){return _0x3263aa[_0xec16('0x87')][_0xec16('0x84')][0x0];}return db[_0xec16('0x75')][_0xec16('0x5a')](_[_0xec16('0x8d')](_0x7958f7[_0xec16('0x5b')],{'firstName':_0x544d3c,[_0x58ba2f[_0xec16('0x80')]]:_0x544d3c,'phone':_0x544d3c,'ListId':_0x3263aa[_0xec16('0x7a')]}));}})[_0xec16('0x22')](handleEntityNotFound(_0x5147ac,null))[_0xec16('0x22')](function(_0x51c536){if(_0x51c536){_0xb66efe=_0x51c536;return db[_0xec16('0x92')][_0xec16('0x5f')]({'where':{'ContactId':_0xb66efe['id'],'closed':![],'OpenchannelAccountId':_0x3263aa['id']}})[_0xec16('0x22')](function(_0x5511fa){if(_0x5511fa){return[_0x5511fa,![]];}return db[_0xec16('0x92')][_0xec16('0x5a')]({'UserId':_0x7958f7[_0xec16('0x5d')]['id'],'ContactId':_0xb66efe['id'],'OpenchannelAccountId':_0x3263aa['id'],'lastMsgDirection':'out','Messages':[_[_0xec16('0x50')](_0x7958f7[_0xec16('0x5b')],{'read':![],'body':_0x7958f7[_0xec16('0x5b')][_0xec16('0x5b')],'OpenchannelAccountId':_0x3263aa['id'],'UserId':_0x7958f7['user']['id'],'ContactId':_0xb66efe['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0xec16('0x22')](function(_0x564042){return[_0x564042,!![]];});});}})[_0xec16('0xbd')](function(_0x3e4f2a,_0x30e608){if(_0x30e608){return _0x3e4f2a;}return db[_0xec16('0x9a')][_0xec16('0x5a')](_[_0xec16('0x50')](_0x7958f7['body'],{'read':![],'body':_0x7958f7['body']['body'],'OpenchannelAccountId':_0x3263aa['id'],'OpenchannelInteractionId':_0x3e4f2a['id'],'UserId':_0x7958f7['user']['id'],'ContactId':_0xb66efe['id']}))[_0xec16('0x22')](function(_0x235909){_0x3e4f2a[_0xec16('0xbe')][_0xec16('0xbf')]=[];_0x3e4f2a[_0xec16('0xbe')][_0xec16('0xbf')][_0xec16('0x97')](_0x235909[_0xec16('0xbe')]);return _0x3e4f2a;});});}})[_0xec16('0x22')](respondWithResult(_0x5147ac,null))[_0xec16('0x2d')](handleError(_0x5147ac,null));}; \ No newline at end of file +var _0x18dd=['*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','rawAttributes','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','getAnswers','CannedAnswer','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','asc','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','update','interaction','created','autoclose','close','unmanaged'];(function(_0x2387ea,_0x3b8f13){var _0x1b053d=function(_0x4c7c70){while(--_0x4c7c70){_0x2387ea['push'](_0x2387ea['shift']());}};_0x1b053d(++_0x3b8f13);}(_0x18dd,0x1a0));var _0xd18d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x18dd[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xd18d('0x0'));var rimraf=require(_0xd18d('0x1'));var zipdir=require(_0xd18d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd18d('0x3'));var moment=require(_0xd18d('0x4'));var BPromise=require(_0xd18d('0x5'));var Mustache=require(_0xd18d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd18d('0x7'));var csv=require(_0xd18d('0x8'));var ejs=require(_0xd18d('0x9'));var fs=require('fs');var fs_extra=require(_0xd18d('0xa'));var _=require(_0xd18d('0xb'));var squel=require(_0xd18d('0xc'));var crypto=require(_0xd18d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd18d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd18d('0xf'));var authService=require(_0xd18d('0x10'));var qs=require(_0xd18d('0x11'));var as=require(_0xd18d('0x12'));var hardwareService=require(_0xd18d('0x13'));var logger=require(_0xd18d('0x14'))('api');var utils=require(_0xd18d('0x15'));var config=require(_0xd18d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd18d('0x17')]=_[_0xd18d('0x18')](config[_0xd18d('0x17')],{'host':_0xd18d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xd18d('0x1a'));var client=jayson[_0xd18d('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xd18d('0x1b')][_0xd18d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x34ce42,_0x582f0e,_0x3b7006,_0x235832){return new BPromise(function(_0x182f8d,_0x4b76fe){var _0x71bf4e=_0x235832||client;return _0x71bf4e[_0xd18d('0x1d')](_0x34ce42,_0x3b7006)['then'](function(_0x48ba88){logger[_0xd18d('0x1e')](_0xd18d('0x1f'),_0x582f0e,'request\x20sent');logger[_0xd18d('0x20')](_0xd18d('0x21'),_0x582f0e,_0xd18d('0x22'),JSON[_0xd18d('0x23')](_0x48ba88));if(_0x48ba88[_0xd18d('0x24')]){if(_0x48ba88[_0xd18d('0x24')][_0xd18d('0x25')]===0x1f4){logger[_0xd18d('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x582f0e,_0x48ba88[_0xd18d('0x24')][_0xd18d('0x26')]);return _0x4b76fe(_0x48ba88[_0xd18d('0x24')][_0xd18d('0x26')]);}logger[_0xd18d('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x582f0e,_0x48ba88['error'][_0xd18d('0x26')]);return _0x182f8d(_0x48ba88['error'][_0xd18d('0x26')]);}else{logger[_0xd18d('0x1e')](_0xd18d('0x1f'),_0x582f0e,_0xd18d('0x22'));_0x182f8d(_0x48ba88[_0xd18d('0x27')][_0xd18d('0x26')]);}})[_0xd18d('0x28')](function(_0x4917d2){logger['error'](_0xd18d('0x1f'),_0x582f0e,_0x4917d2);_0x4b76fe(_0x4917d2);});});}function respondWithStatusCode(_0x462780,_0xc8f862){_0xc8f862=_0xc8f862||0xcc;return function(_0x1d4f25){if(_0x1d4f25){return _0x462780[_0xd18d('0x29')](_0xc8f862);}return _0x462780[_0xd18d('0x2a')](_0xc8f862)[_0xd18d('0x2b')]();};}function respondWithResult(_0x392706,_0x326d22){_0x326d22=_0x326d22||0xc8;return function(_0x3546bc){if(_0x3546bc){return _0x392706[_0xd18d('0x2a')](_0x326d22)[_0xd18d('0x2c')](_0x3546bc);}};}function respondWithFilteredResult(_0xde0533,_0x366cd8){return function(_0x1b83ae){if(_0x1b83ae){var _0x53be64=typeof _0x366cd8[_0xd18d('0x2d')]===_0xd18d('0x2e')&&typeof _0x366cd8['limit']==='undefined';var _0x4b4edf=_0x1b83ae['count'];var _0x37c40f=_0x53be64?0x0:_0x366cd8[_0xd18d('0x2d')];var _0x4971c4=_0x53be64?_0x1b83ae[_0xd18d('0x2f')]:_0x366cd8['offset']+_0x366cd8[_0xd18d('0x30')];var _0x3e5742;if(_0x4971c4>=_0x4b4edf){_0x4971c4=_0x4b4edf;_0x3e5742=0xc8;}else{_0x3e5742=0xce;}_0xde0533[_0xd18d('0x2a')](_0x3e5742);return _0xde0533[_0xd18d('0x31')](_0xd18d('0x32'),_0x37c40f+'-'+_0x4971c4+'/'+_0x4b4edf)['json'](_0x1b83ae);}return null;};}function patchUpdates(_0x4debc1){return function(_0x5cd1b7){try{jsonpatch[_0xd18d('0x33')](_0x5cd1b7,_0x4debc1,!![]);}catch(_0x1abac9){return BPromise[_0xd18d('0x34')](_0x1abac9);}return _0x5cd1b7[_0xd18d('0x35')]();};}function saveUpdates(_0x588886,_0x85b59a){return function(_0x999d34){if(_0x999d34){return _0x999d34['update'](_0x588886)[_0xd18d('0x36')](function(_0x5ccbf0){return _0x5ccbf0;});}return null;};}function removeEntity(_0x158d96,_0x5b148d){return function(_0x1c1f3a){if(_0x1c1f3a){return _0x1c1f3a[_0xd18d('0x37')]()['then'](function(){var _0x1cd640=_0x1c1f3a[_0xd18d('0x38')]({'plain':!![]});var _0x40f68d=_0xd18d('0x39');return db[_0xd18d('0x3a')][_0xd18d('0x37')]({'where':{'type':_0x40f68d,'resourceId':_0x1cd640['id']}})[_0xd18d('0x36')](function(){return _0x1c1f3a;});})[_0xd18d('0x36')](function(){_0x158d96[_0xd18d('0x2a')](0xcc)[_0xd18d('0x2b')]();});}};}function handleEntityNotFound(_0x29da0c,_0xfb1e58){return function(_0xa88bcf){if(!_0xa88bcf){_0x29da0c[_0xd18d('0x29')](0x194);}return _0xa88bcf;};}function handleError(_0x61fc24,_0x9e9237){_0x9e9237=_0x9e9237||0x1f4;return function(_0x37add4){logger[_0xd18d('0x24')](_0x37add4['stack']);if(_0x37add4[_0xd18d('0x3b')]){delete _0x37add4[_0xd18d('0x3b')];}_0x61fc24[_0xd18d('0x2a')](_0x9e9237)[_0xd18d('0x3c')](_0x37add4);};}exports['index']=function(_0x55cc51,_0x3790cd){var _0x1d76de={'include':[{'model':db[_0xd18d('0x3d')],'as':_0xd18d('0x3e')}]},_0x509d17={},_0x47c7c9={'count':0x0,'rows':[]};var _0xf4ad7a=_[_0xd18d('0x3f')](db[_0xd18d('0x40')]['rawAttributes'],function(_0x9d0a1){return{'name':_0x9d0a1['fieldName'],'type':_0x9d0a1[_0xd18d('0x41')][_0xd18d('0x42')]};});_0x509d17[_0xd18d('0x43')]=_[_0xd18d('0x3f')](_0xf4ad7a,'name');_0x509d17[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x55cc51[_0xd18d('0x44')]);_0x509d17[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x509d17[_0xd18d('0x43')],_0x509d17['query']);_0x1d76de[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x509d17['model'],qs[_0xd18d('0x49')](_0x55cc51['query'][_0xd18d('0x49')]));_0x1d76de[_0xd18d('0x48')]=_0x1d76de['attributes']['length']?_0x1d76de[_0xd18d('0x48')]:_0x509d17[_0xd18d('0x43')];if(!_0x55cc51[_0xd18d('0x44')][_0xd18d('0x4a')](_0xd18d('0x4b'))){_0x1d76de[_0xd18d('0x30')]=qs[_0xd18d('0x30')](_0x55cc51[_0xd18d('0x44')]['limit']);_0x1d76de[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0x55cc51[_0xd18d('0x44')][_0xd18d('0x2d')]);}_0x1d76de['order']=qs['sort'](_0x55cc51['query'][_0xd18d('0x4c')]);_0x1d76de[_0xd18d('0x4d')]=qs['filters'](_[_0xd18d('0x4e')](_0x55cc51[_0xd18d('0x44')],_0x509d17[_0xd18d('0x46')]),_0xf4ad7a);if(_0x55cc51['query'][_0xd18d('0x4f')]){_0x1d76de[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x1d76de['where'],{'$or':_['map'](_0xf4ad7a,function(_0x296846){if(_0x296846[_0xd18d('0x41')]!=='VIRTUAL'){var _0x2df0db={};_0x2df0db[_0x296846[_0xd18d('0x3b')]]={'$like':'%'+_0x55cc51[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x2df0db;}})});}_0x1d76de=_[_0xd18d('0x50')]({},_0x1d76de,_0x55cc51['options']);var _0x262527={'where':_0x1d76de['where']};return db[_0xd18d('0x40')][_0xd18d('0x2f')](_0x262527)['then'](function(_0x5527e1){_0x47c7c9['count']=_0x5527e1;if(_0x55cc51[_0xd18d('0x44')][_0xd18d('0x51')]){_0x1d76de[_0xd18d('0x52')]=[{'all':!![]}];}return db[_0xd18d('0x40')][_0xd18d('0x53')](_0x1d76de);})[_0xd18d('0x36')](function(_0x375a61){_0x47c7c9[_0xd18d('0x54')]=_0x375a61;return _0x47c7c9;})['then'](respondWithFilteredResult(_0x3790cd,_0x1d76de))[_0xd18d('0x28')](handleError(_0x3790cd,null));};exports['show']=function(_0xa55110,_0x53d0e8){var _0x250849={'raw':![],'where':{'id':_0xa55110[_0xd18d('0x55')]['id']},'include':[{'model':db[_0xd18d('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5a7abe={};_0x5a7abe[_0xd18d('0x43')]=_['keys'](db[_0xd18d('0x40')][_0xd18d('0x56')]);_0x5a7abe[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0xa55110[_0xd18d('0x44')]);_0x5a7abe[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x5a7abe[_0xd18d('0x43')],_0x5a7abe['query']);_0x250849[_0xd18d('0x48')]=_['intersection'](_0x5a7abe[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0xa55110[_0xd18d('0x44')][_0xd18d('0x49')]));_0x250849['attributes']=_0x250849['attributes'][_0xd18d('0x57')]?_0x250849[_0xd18d('0x48')]:_0x5a7abe[_0xd18d('0x43')];if(_0xa55110[_0xd18d('0x44')]['includeAll']){_0x250849[_0xd18d('0x52')]=[{'all':!![]}];}_0x250849=_['merge']({},_0x250849,_0xa55110[_0xd18d('0x58')]);return db[_0xd18d('0x40')]['find'](_0x250849)[_0xd18d('0x36')](handleEntityNotFound(_0x53d0e8,null))[_0xd18d('0x36')](respondWithResult(_0x53d0e8,null))[_0xd18d('0x28')](handleError(_0x53d0e8,null));};exports[_0xd18d('0x59')]=function(_0x814179,_0x5c59db){return db[_0xd18d('0x40')][_0xd18d('0x59')](_0x814179[_0xd18d('0x5a')],{})[_0xd18d('0x36')](function(_0x315f23){var _0x51bb24=_0x814179['user']['get']({'plain':!![]});if(!_0x51bb24)throw new Error(_0xd18d('0x5b'));if(_0x51bb24[_0xd18d('0x5c')]===_0xd18d('0x5d')){var _0x4c1b9a=_0x315f23[_0xd18d('0x38')]({'plain':!![]});var _0x186ea0='OpenchannelAccounts';return db[_0xd18d('0x5e')][_0xd18d('0x5f')]({'where':{'name':_0x186ea0,'userProfileId':_0x51bb24['userProfileId']},'raw':!![]})['then'](function(_0x54e2fe){if(_0x54e2fe&&_0x54e2fe['autoAssociation']===0x0){return db[_0xd18d('0x3a')][_0xd18d('0x59')]({'name':_0x4c1b9a['name'],'resourceId':_0x4c1b9a['id'],'type':_0x54e2fe['name'],'sectionId':_0x54e2fe['id']},{})[_0xd18d('0x36')](function(){return _0x315f23;});}else{return _0x315f23;}})[_0xd18d('0x28')](function(_0x48abbe){logger[_0xd18d('0x24')](_0xd18d('0x60'),_0x48abbe);throw _0x48abbe;});}return _0x315f23;})[_0xd18d('0x36')](respondWithResult(_0x5c59db,0xc9))[_0xd18d('0x28')](handleError(_0x5c59db,null));};exports['update']=function(_0x2f36ed,_0x1deb7f){if(_0x2f36ed['body']['id']){delete _0x2f36ed[_0xd18d('0x5a')]['id'];}return db['OpenchannelAccount'][_0xd18d('0x5f')]({'where':{'id':_0x2f36ed[_0xd18d('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xd18d('0x3e')}]})[_0xd18d('0x36')](handleEntityNotFound(_0x1deb7f,null))[_0xd18d('0x36')](saveUpdates(_0x2f36ed['body'],null))[_0xd18d('0x36')](respondWithResult(_0x1deb7f,null))['catch'](handleError(_0x1deb7f,null));};exports['destroy']=function(_0x2195ac,_0x38f59c){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x2195ac[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x38f59c,null))[_0xd18d('0x36')](removeEntity(_0x38f59c,null))[_0xd18d('0x28')](handleError(_0x38f59c,null));};exports['describe']=function(_0x331a37,_0x2c640a){return db[_0xd18d('0x40')][_0xd18d('0x61')]()['then'](respondWithResult(_0x2c640a,null))[_0xd18d('0x28')](handleError(_0x2c640a,null));};exports['addDisposition']=function(_0xd93c05,_0x519933,_0x4315fa){if(_0xd93c05['body']['id']){delete _0xd93c05[_0xd18d('0x5a')]['id'];}return db[_0xd18d('0x40')]['find']({'where':{'id':_0xd93c05[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x519933,null))[_0xd18d('0x36')](function(_0x439295){if(_0x439295){_0xd93c05[_0xd18d('0x5a')][_0xd18d('0x62')]=_0x439295['id'];return db[_0xd18d('0x63')]['create'](_0xd93c05[_0xd18d('0x5a')]);}})[_0xd18d('0x36')](respondWithResult(_0x519933,null))['catch'](handleError(_0x519933,null));};exports[_0xd18d('0x64')]=function(_0x810ef9,_0x4af5f1,_0x2b0b84){var _0x530e34={'raw':![],'where':{}};var _0x22413f={};var _0x5abfcf={'count':0x0,'rows':[]};return db[_0xd18d('0x40')][_0xd18d('0x65')]({'where':{'id':_0x810ef9[_0xd18d('0x55')]['id']}})['then'](handleEntityNotFound(_0x4af5f1,null))['then'](function(_0x23c6b0){if(_0x23c6b0){_0x22413f[_0xd18d('0x43')]=_['keys'](db[_0xd18d('0x63')][_0xd18d('0x56')]);_0x22413f[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x810ef9['query']);_0x22413f[_0xd18d('0x46')]=_['intersection'](_0x22413f['model'],_0x22413f[_0xd18d('0x44')]);_0x530e34[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x22413f[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x810ef9[_0xd18d('0x44')][_0xd18d('0x49')]));_0x530e34[_0xd18d('0x48')]=_0x530e34[_0xd18d('0x48')][_0xd18d('0x57')]?_0x530e34['attributes']:_0x22413f[_0xd18d('0x43')];if(!_0x810ef9[_0xd18d('0x44')]['hasOwnProperty'](_0xd18d('0x4b'))){_0x530e34['limit']=qs[_0xd18d('0x30')](_0x810ef9['query']['limit']);_0x530e34[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0x810ef9[_0xd18d('0x44')][_0xd18d('0x2d')]);}_0x530e34[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0x810ef9[_0xd18d('0x44')][_0xd18d('0x4c')]);_0x530e34[_0xd18d('0x4d')]=qs[_0xd18d('0x46')](_[_0xd18d('0x4e')](_0x810ef9['query'],_0x22413f[_0xd18d('0x46')]));_0x530e34[_0xd18d('0x4d')][_0xd18d('0x62')]=_0x23c6b0['id'];if(_0x810ef9[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x530e34[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x530e34[_0xd18d('0x4d')],{'$or':_[_0xd18d('0x3f')](_0x530e34[_0xd18d('0x48')],function(_0x173f33){var _0x2a2933={};_0x2a2933[_0x173f33]={'$like':'%'+_0x810ef9['query'][_0xd18d('0x4f')]+'%'};return _0x2a2933;})});}_0x530e34=_[_0xd18d('0x50')]({},_0x530e34,_0x810ef9[_0xd18d('0x58')]);return db[_0xd18d('0x63')][_0xd18d('0x2f')]({'where':_0x530e34[_0xd18d('0x4d')]})['then'](function(_0x2398d6){_0x5abfcf[_0xd18d('0x2f')]=_0x2398d6;if(_0x810ef9[_0xd18d('0x44')][_0xd18d('0x51')]){_0x530e34[_0xd18d('0x52')]=[{'all':!![]}];}return db[_0xd18d('0x63')][_0xd18d('0x53')](_0x530e34);})[_0xd18d('0x36')](function(_0x3d9367){_0x5abfcf[_0xd18d('0x54')]=_0x3d9367;return _0x5abfcf;});}})[_0xd18d('0x36')](respondWithFilteredResult(_0x4af5f1,_0x530e34))[_0xd18d('0x28')](handleError(_0x4af5f1,null));};exports['removeDispositions']=function(_0x8003a,_0x274c0d,_0x3a1996){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x8003a[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x274c0d,null))['then'](function(_0x1ba2f7){if(_0x1ba2f7){return _0x1ba2f7[_0xd18d('0x67')](_0x8003a[_0xd18d('0x44')][_0xd18d('0x68')]);}})['then'](respondWithStatusCode(_0x274c0d,null))[_0xd18d('0x28')](handleError(_0x274c0d,null));};exports['addAnswer']=function(_0x57566b,_0x2b133b,_0x2da740){if(_0x57566b[_0xd18d('0x5a')]['id']){delete _0x57566b['body']['id'];}return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x57566b[_0xd18d('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b133b,null))[_0xd18d('0x36')](function(_0x318aa1){if(_0x318aa1){_0x57566b[_0xd18d('0x5a')]['OpenchannelAccountId']=_0x318aa1['id'];return db['CannedAnswer']['create'](_0x57566b[_0xd18d('0x5a')]);}})[_0xd18d('0x36')](respondWithResult(_0x2b133b,null))['catch'](handleError(_0x2b133b,null));};exports[_0xd18d('0x69')]=function(_0x14ed4d,_0x137a5c,_0x414711){var _0x569650={'raw':![],'where':{}};var _0x48e5a5={};var _0xef7b71={'count':0x0,'rows':[]};return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0x14ed4d[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x137a5c,null))[_0xd18d('0x36')](function(_0x2bdbe2){if(_0x2bdbe2){_0x48e5a5[_0xd18d('0x43')]=_['keys'](db['CannedAnswer'][_0xd18d('0x56')]);_0x48e5a5['query']=_['keys'](_0x14ed4d[_0xd18d('0x44')]);_0x48e5a5['filters']=_[_0xd18d('0x47')](_0x48e5a5[_0xd18d('0x43')],_0x48e5a5[_0xd18d('0x44')]);_0x569650[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x48e5a5[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x14ed4d['query']['fields']));_0x569650[_0xd18d('0x48')]=_0x569650[_0xd18d('0x48')]['length']?_0x569650[_0xd18d('0x48')]:_0x48e5a5[_0xd18d('0x43')];if(!_0x14ed4d[_0xd18d('0x44')][_0xd18d('0x4a')](_0xd18d('0x4b'))){_0x569650[_0xd18d('0x30')]=qs['limit'](_0x14ed4d[_0xd18d('0x44')]['limit']);_0x569650['offset']=qs[_0xd18d('0x2d')](_0x14ed4d[_0xd18d('0x44')]['offset']);}_0x569650[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0x14ed4d[_0xd18d('0x44')][_0xd18d('0x4c')]);_0x569650[_0xd18d('0x4d')]=qs[_0xd18d('0x46')](_['pick'](_0x14ed4d[_0xd18d('0x44')],_0x48e5a5[_0xd18d('0x46')]));_0x569650[_0xd18d('0x4d')][_0xd18d('0x62')]=_0x2bdbe2['id'];if(_0x14ed4d['query'][_0xd18d('0x4f')]){_0x569650[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x569650[_0xd18d('0x4d')],{'$or':_[_0xd18d('0x3f')](_0x569650[_0xd18d('0x48')],function(_0x9b65ab){var _0x4834b4={};_0x4834b4[_0x9b65ab]={'$like':'%'+_0x14ed4d[_0xd18d('0x44')]['filter']+'%'};return _0x4834b4;})});}_0x569650=_[_0xd18d('0x50')]({},_0x569650,_0x14ed4d[_0xd18d('0x58')]);return db[_0xd18d('0x6a')][_0xd18d('0x2f')]({'where':_0x569650[_0xd18d('0x4d')]})['then'](function(_0x5eebfd){_0xef7b71[_0xd18d('0x2f')]=_0x5eebfd;if(_0x14ed4d[_0xd18d('0x44')][_0xd18d('0x51')]){_0x569650['include']=[{'all':!![]}];}return db[_0xd18d('0x6a')][_0xd18d('0x53')](_0x569650);})[_0xd18d('0x36')](function(_0x3ca378){_0xef7b71['rows']=_0x3ca378;return _0xef7b71;});}})[_0xd18d('0x36')](respondWithFilteredResult(_0x137a5c,_0x569650))['catch'](handleError(_0x137a5c,null));};exports['removeAnswers']=function(_0x2f5c30,_0x814154,_0x1bbbb1){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x2f5c30['params']['id']}})['then'](handleEntityNotFound(_0x814154,null))[_0xd18d('0x36')](function(_0x377fe0){if(_0x377fe0){return _0x377fe0['removeAnswers'](_0x2f5c30[_0xd18d('0x44')][_0xd18d('0x68')]);}})[_0xd18d('0x36')](respondWithStatusCode(_0x814154,null))['catch'](handleError(_0x814154,null));};exports[_0xd18d('0x6b')]=function(_0x54683d,_0x3c776c,_0xaed682){var _0x14f6aa={'body':_0x54683d[_0xd18d('0x5a')],'channel':_0xd18d('0x6c')};var _0x3f16ed=[];var _0x67edc0=[];var _0x51e55a={};var _0x28cc05=![];return db[_0xd18d('0x6d')][_0xd18d('0x61')]()[_0xd18d('0x36')](function(_0x1836d2){if(!_0x1836d2){throw new db['Sequelize']['ValidationError'](_0xd18d('0x6e'));}_0x3f16ed=_[_0xd18d('0x6f')](_[_0xd18d('0x45')](_0x1836d2),[_0xd18d('0x70'),_0xd18d('0x71')]);_0x67edc0=_[_0xd18d('0x6f')](_[_0xd18d('0x45')](_0x1836d2),[_0xd18d('0x70'),_0xd18d('0x71'),_0xd18d('0x72'),_0xd18d('0x73')]);if(_0x54683d[_0xd18d('0x5a')]['id']){delete _0x54683d[_0xd18d('0x5a')]['id'];}if(_[_0xd18d('0x74')](_0x54683d[_0xd18d('0x5a')][_0xd18d('0x75')])){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))](_0xd18d('0x78'));}if(_[_0xd18d('0x74')](_0x54683d[_0xd18d('0x5a')][_0xd18d('0x5a')])||_0x54683d['body']['body']===''){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))](_0xd18d('0x79'));}if(_[_0xd18d('0x74')](_0x54683d[_0xd18d('0x5a')][_0xd18d('0x7a')])){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))](_0xd18d('0x7b')+_0x67edc0);}if(!_[_0xd18d('0x7c')](_0x67edc0,_0x54683d['body'][_0xd18d('0x7a')])){throw new db[(_0xd18d('0x76'))]['ValidationError'](_0xd18d('0x7d')+_0x67edc0);}_0x51e55a[_0x54683d[_0xd18d('0x5a')][_0xd18d('0x7a')]]=_0x54683d['body']['from'];})[_0xd18d('0x36')](function(){return db[_0xd18d('0x40')]['find']({'where':{'id':_0x54683d['params']['id']},'include':[{'model':db['CmList'],'as':_0xd18d('0x7e'),'include':[{'model':db[_0xd18d('0x6d')],'as':'Contacts','where':_0x51e55a,'limit':0x1,'order':[['updatedAt',_0xd18d('0x7f')]]}]},{'model':db[_0xd18d('0x80')],'as':_0xd18d('0x81')}]});})[_0xd18d('0x36')](handleEntityNotFound(_0x3c776c,null))[_0xd18d('0x36')](function(_0x35d91d){if(_0x35d91d&&_0x35d91d['List']){_0x14f6aa[_0xd18d('0x82')]=_0x35d91d;_0x14f6aa['applications']=_0x35d91d[_0xd18d('0x81')];_0x14f6aa[_0xd18d('0x83')]=_0x35d91d[_0xd18d('0x7e')];_0x14f6aa[_0xd18d('0x84')]=_[_0xd18d('0x85')](_0x14f6aa[_0xd18d('0x84')],[_0xd18d('0x86')],[_0xd18d('0x87')]);if(_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x81')]){delete _0x14f6aa[_0xd18d('0x82')]['Applications'];}if(_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x7e')]&&_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x7e')][_0xd18d('0x88')][_0xd18d('0x57')]){return _0x14f6aa[_0xd18d('0x82')][_0xd18d('0x7e')][_0xd18d('0x88')][0x0];}var _0x1592c8=_[_0xd18d('0x18')](_0x54683d[_0xd18d('0x5a')],{'firstName':_0x54683d[_0xd18d('0x5a')]['from'],'ListId':_0x35d91d[_0xd18d('0x73')]});_0x1592c8[_0x54683d[_0xd18d('0x5a')][_0xd18d('0x7a')]]=_0x54683d['body'][_0xd18d('0x75')];return db['CmContact']['create'](_0x1592c8,{'fields':_0x3f16ed,'raw':!![]});}})[_0xd18d('0x36')](handleEntityNotFound(_0x3c776c,null))[_0xd18d('0x36')](function(_0x29f305){_0x14f6aa[_0xd18d('0x89')]=_0x29f305;if(_0x29f305){var _0x43b9cd={'ContactId':_0x29f305['id'],'OpenchannelAccountId':_0x54683d[_0xd18d('0x55')]['id'],'from':(_0x29f305[_0xd18d('0x8a')]||'')+'\x20'+(_0x29f305['lastName']||'')};var _0x35b4a8={'OpenchannelAccountId':_0x54683d[_0xd18d('0x55')]['id'],'closed':![]};if(_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8b')]){_0x35b4a8[_0xd18d('0x8b')]=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8b')];return db[_0xd18d('0x8c')][_0xd18d('0x5f')]({'where':_0x35b4a8})[_0xd18d('0x36')](function(_0x480d3b){if(_0x480d3b){return[_0x480d3b,![]];}_0x43b9cd[_0xd18d('0x8b')]=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8b')];_0x43b9cd[_0xd18d('0x8d')]=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x8d')];return db[_0xd18d('0x8c')][_0xd18d('0x59')](_0x43b9cd)[_0xd18d('0x36')](function(_0xadf14){return[_0xadf14,!![]];});});}else{_0x35b4a8['threadId']=null;}_0x35b4a8[_0xd18d('0x8e')]=_0x29f305['id'];return db[_0xd18d('0x8c')][_0xd18d('0x5f')]({'where':_0x35b4a8})['then'](function(_0x2941af){if(_0x2941af){return[_0x2941af,![]];}return db['OpenchannelInteraction'][_0xd18d('0x59')](_0x43b9cd)[_0xd18d('0x36')](function(_0x1237a6){return[_0x1237a6,!![]];});});}})[_0xd18d('0x8f')](function(_0x80ce3c,_0x2fba5b){if(_0x80ce3c){_0x28cc05=_0x2fba5b;if(!_0x2fba5b){var _0x1ba3f2={'from':(_0x14f6aa[_0xd18d('0x89')]['firstName']||'')+'\x20'+(_0x14f6aa[_0xd18d('0x89')]['lastName']||'')};if(_0x54683d['body']['threadId']&&_0x54683d[_0xd18d('0x5a')][_0xd18d('0x90')]&&_0x54683d[_0xd18d('0x5a')]['threadId']!=_0x54683d['body'][_0xd18d('0x90')]){_0x1ba3f2['threadId']=_0x54683d[_0xd18d('0x5a')][_0xd18d('0x90')];}return _0x80ce3c[_0xd18d('0x91')](_0x1ba3f2);}else{return _0x80ce3c;}}})[_0xd18d('0x36')](function(_0x3d5f83){_0x14f6aa[_0xd18d('0x92')]=_0x3d5f83[_0xd18d('0x38')]({'plain':!![]});_0x14f6aa[_0xd18d('0x92')][_0xd18d('0x93')]=_0x28cc05;if(_0x14f6aa[_0xd18d('0x92')][_0xd18d('0x93')]){if(_0x14f6aa[_0xd18d('0x82')][_0xd18d('0x94')]){_0x14f6aa[_0xd18d('0x84')]['push']({'id':0x0,'priority':_0x14f6aa[_0xd18d('0x84')]['length']+0x1,'app':_0xd18d('0x95'),'appdata':_0xd18d('0x96'),'interval':_0xd18d('0x97')});}}return db[_0xd18d('0x98')][_0xd18d('0x59')]({'body':_0x54683d[_0xd18d('0x5a')][_0xd18d('0x5a')],'OpenchannelAccountId':_0x54683d[_0xd18d('0x55')]['id'],'OpenchannelInteractionId':_0x3d5f83['id'],'direction':'in','ContactId':_0x14f6aa[_0xd18d('0x89')]['id'],'AttachmentId':_0x54683d[_0xd18d('0x5a')][_0xd18d('0x99')]});})[_0xd18d('0x36')](function(_0x8b54a7){_0x14f6aa['message']=_0x8b54a7;if(_0x14f6aa[_0xd18d('0x92')][_0xd18d('0x9a')]){return db[_0xd18d('0x9b')][_0xd18d('0x5f')]({'attributes':['id','name'],'where':{'id':_0x14f6aa[_0xd18d('0x92')]['UserId']}})[_0xd18d('0x36')](function(_0x491d98){if(_0x491d98){_0x14f6aa[_0xd18d('0x84')][_0xd18d('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x491d98[_0xd18d('0x3b')]+','+(_0x14f6aa['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd18d('0x97')});_0x14f6aa['forcedOwnership']=![];}return respondWithRpcPromise(_0xd18d('0x9d'),_0xd18d('0x9e'),_0x14f6aa);});}return respondWithRpcPromise(_0xd18d('0x9d'),_0xd18d('0x9e'),_0x14f6aa);})['then'](function(_0x3025a3){respondWithRpcPromise(_0xd18d('0x9f'),_0xd18d('0x9f'),{'event':_0xd18d('0x6b'),'message':_0x3025a3},client9002);return _0x3025a3;})[_0xd18d('0x36')](respondWithResult(_0x3c776c,null))[_0xd18d('0x28')](handleError(_0x3c776c,null));};exports[_0xd18d('0xa0')]=function(_0x10c6ba,_0x37bc11){var _0x386eff=_0x10c6ba[_0xd18d('0x55')]['id'];var _0x17bc95=_0x10c6ba['body'];var _0x553857=0xc8;var _0x36af41=null;return db[_0xd18d('0xa1')][_0xd18d('0xa2')]({'isolationLevel':db[_0xd18d('0xa1')][_0xd18d('0xa3')][_0xd18d('0xa4')][_0xd18d('0xa5')]},function(_0x375afd){return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0x386eff},'transaction':_0x375afd})[_0xd18d('0x36')](function(_0x49eb84){if(_0x49eb84){return db[_0xd18d('0x80')][_0xd18d('0x37')]({'where':{'OpenchannelAccountId':_0x386eff},'transaction':_0x375afd})[_0xd18d('0x36')](function(){var _0x3e5806=_[_0xd18d('0x3f')](_0x17bc95,function(_0x1e2776){_0x1e2776['OpenchannelAccountId']=_0x386eff;return _0x1e2776;});return db[_0xd18d('0x80')][_0xd18d('0xa6')](_0x3e5806,{'transaction':_0x375afd});});}else{_0x553857=0x194;_0x36af41=[];}});})[_0xd18d('0x36')](function(){if(_0x553857!==0x194){return db[_0xd18d('0x80')][_0xd18d('0xa7')]({'where':{'OpenchannelAccountId':_0x386eff},'order':_0xd18d('0x86')})['then'](function(_0x49a993){_0x36af41=_0x49a993;});}})['catch'](function(_0x2cabbf){_0x553857=0x1f4;logger[_0xd18d('0x24')](_0x2cabbf[_0xd18d('0xa8')]);if(_0x2cabbf['name']){delete _0x2cabbf[_0xd18d('0x3b')];}_0x36af41=_0x2cabbf;})[_0xd18d('0xa9')](function(){if(_0x36af41===null){_0x37bc11[_0xd18d('0x29')](_0x553857);}else{if(_0x553857===0x1f4){_0x37bc11[_0xd18d('0x2a')](_0x553857)[_0xd18d('0x3c')](_0x36af41);}else{_0x37bc11[_0xd18d('0x2a')](_0x553857)[_0xd18d('0x2c')](_0x36af41);}}});};exports[_0xd18d('0xaa')]=function(_0xd43956,_0x41a3a9,_0x39586a){var _0x3e4276={};var _0x4fad45={};var _0x1eb4d8;var _0x165443;return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0xd43956[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x41a3a9,null))[_0xd18d('0x36')](function(_0x15f27a){if(_0x15f27a){_0x1eb4d8=_0x15f27a;_0x4fad45[_0xd18d('0x43')]=_[_0xd18d('0x45')](db[_0xd18d('0x80')][_0xd18d('0x56')]);_0x4fad45[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0xd43956[_0xd18d('0x44')]);_0x4fad45[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x4fad45[_0xd18d('0x43')],_0x4fad45[_0xd18d('0x44')]);_0x3e4276[_0xd18d('0x48')]=_[_0xd18d('0x47')](_0x4fad45['model'],qs[_0xd18d('0x49')](_0xd43956[_0xd18d('0x44')][_0xd18d('0x49')]));_0x3e4276['attributes']=_0x3e4276[_0xd18d('0x48')][_0xd18d('0x57')]?_0x3e4276[_0xd18d('0x48')]:_0x4fad45[_0xd18d('0x43')];_0x3e4276[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0xd43956['query']['sort']);_0x3e4276[_0xd18d('0x4d')]=qs['filters'](_[_0xd18d('0x4e')](_0xd43956[_0xd18d('0x44')],_0x4fad45[_0xd18d('0x46')]));if(_0xd43956[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x3e4276[_0xd18d('0x4d')]=_[_0xd18d('0x50')](_0x3e4276['where'],{'$or':_[_0xd18d('0x3f')](_0x3e4276['attributes'],function(_0x4fa703){var _0x4930c5={};_0x4930c5[_0x4fa703]={'$like':'%'+_0xd43956[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x4930c5;})});}_0x3e4276=_[_0xd18d('0x50')]({},_0x3e4276,_0xd43956[_0xd18d('0x58')]);return _0x1eb4d8[_0xd18d('0xaa')](_0x3e4276);}})[_0xd18d('0x36')](function(_0x25fc5a){if(_0x25fc5a){_0x165443=_0x25fc5a['length'];if(!_0xd43956['query']['hasOwnProperty'](_0xd18d('0x4b'))){_0x3e4276[_0xd18d('0x30')]=qs['limit'](_0xd43956[_0xd18d('0x44')][_0xd18d('0x30')]);_0x3e4276[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0xd43956[_0xd18d('0x44')][_0xd18d('0x2d')]);}return _0x1eb4d8[_0xd18d('0xaa')](_0x3e4276);}})['then'](function(_0x22111b){if(_0x22111b){return _0x22111b?{'count':_0x165443,'rows':_0x22111b}:null;}})[_0xd18d('0x36')](respondWithResult(_0x41a3a9,null))[_0xd18d('0x28')](handleError(_0x41a3a9,null));};exports[_0xd18d('0xab')]=function(_0x131ce9,_0x1ed597,_0x3912cf){var _0x3721ee={'raw':![],'where':{}};var _0x4596c1={};var _0x22fbdd={'count':0x0,'rows':[]};return db[_0xd18d('0x40')]['findOne']({'where':{'id':_0x131ce9['params']['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x1ed597,null))[_0xd18d('0x36')](function(_0x236ba8){if(_0x236ba8){_0x4596c1['model']=_['keys'](db['OpenchannelInteraction'][_0xd18d('0x56')]);_0x4596c1[_0xd18d('0x44')]=_[_0xd18d('0x45')](_0x131ce9[_0xd18d('0x44')]);_0x4596c1[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x4596c1['model'],_0x4596c1['query']);_0x3721ee['attributes']=_['intersection'](_0x4596c1[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x131ce9[_0xd18d('0x44')]['fields']));_0x3721ee[_0xd18d('0x48')]=_0x3721ee[_0xd18d('0x48')][_0xd18d('0x57')]?_0x3721ee[_0xd18d('0x48')]:_0x4596c1['model'];if(!_0x131ce9[_0xd18d('0x44')][_0xd18d('0x4a')]('nolimit')){_0x3721ee[_0xd18d('0x30')]=qs[_0xd18d('0x30')](_0x131ce9[_0xd18d('0x44')][_0xd18d('0x30')]);_0x3721ee['offset']=qs[_0xd18d('0x2d')](_0x131ce9[_0xd18d('0x44')][_0xd18d('0x2d')]);}_0x3721ee[_0xd18d('0x66')]=qs[_0xd18d('0x4c')](_0x131ce9['query']['sort']);_0x3721ee[_0xd18d('0x4d')]=qs[_0xd18d('0x46')](_[_0xd18d('0x4e')](_0x131ce9[_0xd18d('0x44')],_0x4596c1['filters']));_0x3721ee[_0xd18d('0x4d')]['OpenchannelAccountId']=_0x236ba8['id'];if(_0x131ce9[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x3721ee['where']=_[_0xd18d('0x50')](_0x3721ee['where'],{'$or':_['map'](_0x3721ee[_0xd18d('0x48')],function(_0x5a46a0){var _0x132b1d={};_0x132b1d[_0x5a46a0]={'$like':'%'+_0x131ce9[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x132b1d;})});}_0x3721ee=_['merge']({},_0x3721ee,_0x131ce9[_0xd18d('0x58')]);return db[_0xd18d('0x8c')][_0xd18d('0x2f')]({'where':_0x3721ee['where']})[_0xd18d('0x36')](function(_0x6f8ca2){_0x22fbdd[_0xd18d('0x2f')]=_0x6f8ca2;if(_0x131ce9['query'][_0xd18d('0x51')]){_0x3721ee[_0xd18d('0x52')]=[{'model':db[_0xd18d('0x6d')],'as':'Contact','required':![]},{'model':db[_0xd18d('0x9b')],'as':_0xd18d('0xac'),'attributes':[_0xd18d('0x3b'),'fullname',_0xd18d('0xad')],'required':![]},{'model':db[_0xd18d('0xae')],'as':_0xd18d('0xaf'),'attributes':['id',_0xd18d('0x3b'),_0xd18d('0xb0')],'where':_0x131ce9['query'][_0xd18d('0xb1')]?{'id':_0x131ce9[_0xd18d('0x44')][_0xd18d('0xb1')]}:undefined,'required':_0x131ce9[_0xd18d('0x44')][_0xd18d('0xb1')]?!![]:![]}];}return db[_0xd18d('0x8c')][_0xd18d('0x53')](_0x3721ee);})[_0xd18d('0x36')](function(_0x2bdf2e){_0x22fbdd[_0xd18d('0x54')]=_0x2bdf2e;return _0x22fbdd;});}})[_0xd18d('0x36')](respondWithFilteredResult(_0x1ed597,_0x3721ee))[_0xd18d('0x28')](handleError(_0x1ed597,null));};exports[_0xd18d('0xb2')]=function(_0x5ee8e5,_0x3c2625,_0x24f9ef){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x5ee8e5[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x3c2625,null))[_0xd18d('0x36')](function(_0x20f1ae){if(_0x20f1ae){return _0x20f1ae['addAgents'](_0x5ee8e5[_0xd18d('0x5a')][_0xd18d('0x68')],_[_0xd18d('0xb3')](_0x5ee8e5[_0xd18d('0x5a')],[_0xd18d('0x68'),'id'])||{})[_0xd18d('0x8f')](function(_0x563be5){for(var _0x30f0e9=0x0;_0x30f0e9<_0x5ee8e5['body']['ids'][_0xd18d('0x57')];_0x30f0e9+=0x1){socket[_0xd18d('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x5ee8e5['body'][_0xd18d('0x68')][_0x30f0e9]),'OpenchannelAccountId':Number(_0x5ee8e5[_0xd18d('0x55')]['id'])});}return _0x563be5;});}})[_0xd18d('0x36')](respondWithResult(_0x3c2625,null))[_0xd18d('0x28')](handleError(_0x3c2625,null));};exports[_0xd18d('0xb5')]=function(_0x325642,_0x2c7194,_0x376d52){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x325642[_0xd18d('0x55')]['id']}})['then'](handleEntityNotFound(_0x2c7194,null))[_0xd18d('0x36')](function(_0x1df12d){if(_0x1df12d){return _0x1df12d['removeAgents'](_0x325642[_0xd18d('0x44')][_0xd18d('0x68')])[_0xd18d('0x36')](function(){if(_[_0xd18d('0xb6')](_0x325642[_0xd18d('0x44')][_0xd18d('0x68')])){for(var _0x2abadc=0x0;_0x2abadc<_0x325642[_0xd18d('0x44')][_0xd18d('0x68')][_0xd18d('0x57')];_0x2abadc+=0x1){socket[_0xd18d('0xb4')](_0xd18d('0xb7'),{'UserId':Number(_0x325642[_0xd18d('0x44')]['ids'][_0x2abadc]),'OpenchannelAccountId':Number(_0x325642['params']['id'])});}}else{socket['emit'](_0xd18d('0xb7'),{'UserId':Number(_0x325642[_0xd18d('0x44')][_0xd18d('0x68')]),'OpenchannelAccountId':Number(_0x325642[_0xd18d('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c7194,null))[_0xd18d('0x28')](handleError(_0x2c7194,null));};exports[_0xd18d('0xb8')]=function(_0x3ad62d,_0x2bb348,_0x35f3e3){var _0x256238={};var _0x50e6ce={};var _0xb2f73;var _0x5a00f1;return db[_0xd18d('0x40')][_0xd18d('0x65')]({'where':{'id':_0x3ad62d[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x2bb348,null))[_0xd18d('0x36')](function(_0x233571){if(_0x233571){_0xb2f73=_0x233571;_0x50e6ce[_0xd18d('0x43')]=_[_0xd18d('0x45')](db['User'][_0xd18d('0x56')]);_0x50e6ce['query']=_['keys'](_0x3ad62d[_0xd18d('0x44')]);_0x50e6ce[_0xd18d('0x46')]=_[_0xd18d('0x47')](_0x50e6ce[_0xd18d('0x43')],_0x50e6ce[_0xd18d('0x44')]);_0x256238[_0xd18d('0x48')]=_['intersection'](_0x50e6ce[_0xd18d('0x43')],qs[_0xd18d('0x49')](_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x49')]));_0x256238[_0xd18d('0x48')]=_0x256238[_0xd18d('0x48')][_0xd18d('0x57')]?_0x256238[_0xd18d('0x48')]:_0x50e6ce[_0xd18d('0x43')];_0x256238['order']=qs[_0xd18d('0x4c')](_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4c')]);_0x256238[_0xd18d('0x4d')]=qs['filters'](_[_0xd18d('0x4e')](_0x3ad62d[_0xd18d('0x44')],_0x50e6ce[_0xd18d('0x46')]));if(_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4f')]){_0x256238[_0xd18d('0x4d')]=_['merge'](_0x256238[_0xd18d('0x4d')],{'$or':_[_0xd18d('0x3f')](_0x256238[_0xd18d('0x48')],function(_0x44914a){var _0x158ecf={};_0x158ecf[_0x44914a]={'$like':'%'+_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4f')]+'%'};return _0x158ecf;})});}_0x256238=_['merge']({},_0x256238,_0x3ad62d[_0xd18d('0x58')]);return _0xb2f73[_0xd18d('0xb8')](_0x256238);}})[_0xd18d('0x36')](function(_0x50aceb){if(_0x50aceb){_0x5a00f1=_0x50aceb[_0xd18d('0x57')];if(!_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x4a')](_0xd18d('0x4b'))){_0x256238[_0xd18d('0x30')]=qs[_0xd18d('0x30')](_0x3ad62d['query'][_0xd18d('0x30')]);_0x256238[_0xd18d('0x2d')]=qs[_0xd18d('0x2d')](_0x3ad62d[_0xd18d('0x44')][_0xd18d('0x2d')]);}return _0xb2f73[_0xd18d('0xb8')](_0x256238);}})[_0xd18d('0x36')](function(_0x261b92){if(_0x261b92){return _0x261b92?{'count':_0x5a00f1,'rows':_0x261b92}:null;}})[_0xd18d('0x36')](respondWithResult(_0x2bb348,null))[_0xd18d('0x28')](handleError(_0x2bb348,null));};exports[_0xd18d('0x3c')]=function(_0x36f5c7,_0x2209b5,_0x5256cd){var _0x1ee0dd,_0x1ece0a,_0x332f23;if(_[_0xd18d('0x74')](_0x36f5c7[_0xd18d('0x5a')][_0xd18d('0x5a')])||_0x36f5c7['body'][_0xd18d('0x5a')]===''){throw new db[(_0xd18d('0x76'))][(_0xd18d('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd18d('0x74')](_0x36f5c7[_0xd18d('0x5a')]['to'])){}_0x1ee0dd=_0x36f5c7[_0xd18d('0x5a')]['to'];return db[_0xd18d('0x40')][_0xd18d('0x65')]({'where':{'id':_0x36f5c7[_0xd18d('0x55')]['id']}})[_0xd18d('0x36')](handleEntityNotFound(_0x2209b5,null))['then'](function(_0x29918e){if(_0x29918e){return db[_0xd18d('0x40')][_0xd18d('0x5f')]({'where':{'id':_0x29918e['id']},'include':[{'model':db[_0xd18d('0xb9')],'as':'List','include':[{'model':db[_0xd18d('0x6d')],'as':_0xd18d('0x88'),'where':{[_0x29918e['mapKey']]:_0x1ee0dd},'limit':0x1,'order':[[_0xd18d('0x71'),_0xd18d('0x7f')]]}]}]})[_0xd18d('0x36')](handleEntityNotFound(_0x2209b5,null))['then'](function(_0xd03ef5){if(_0xd03ef5&&_0xd03ef5['List']){_0x1ece0a=_0xd03ef5[_0xd18d('0x38')]({'plain':!![]});if(_0x1ece0a['List']&&_0x1ece0a[_0xd18d('0x7e')][_0xd18d('0x88')][_0xd18d('0x57')]){return _0x1ece0a[_0xd18d('0x7e')]['Contacts'][0x0];}return db[_0xd18d('0x6d')][_0xd18d('0x59')](_['defaults'](_0x36f5c7[_0xd18d('0x5a')],{'firstName':_0x1ee0dd,[_0xd03ef5['mapKey']]:_0x1ee0dd,'phone':_0x1ee0dd,'ListId':_0x1ece0a['ListId']}));}})[_0xd18d('0x36')](handleEntityNotFound(_0x2209b5,null))[_0xd18d('0x36')](function(_0x1c1d03){if(_0x1c1d03){_0x332f23=_0x1c1d03;return db[_0xd18d('0x8c')][_0xd18d('0x5f')]({'where':{'ContactId':_0x332f23['id'],'closed':![],'OpenchannelAccountId':_0x1ece0a['id']}})[_0xd18d('0x36')](function(_0x4410fe){if(_0x4410fe){return[_0x4410fe,![]];}return db[_0xd18d('0x8c')]['create']({'UserId':_0x36f5c7[_0xd18d('0x5d')]['id'],'ContactId':_0x332f23['id'],'OpenchannelAccountId':_0x1ece0a['id'],'lastMsgDirection':'out','Messages':[_[_0xd18d('0x50')](_0x36f5c7[_0xd18d('0x5a')],{'read':![],'body':_0x36f5c7[_0xd18d('0x5a')]['body'],'OpenchannelAccountId':_0x1ece0a['id'],'UserId':_0x36f5c7[_0xd18d('0x5d')]['id'],'ContactId':_0x332f23['id']})]},{'include':[{'model':db[_0xd18d('0x98')],'as':_0xd18d('0xba')}]})[_0xd18d('0x36')](function(_0x53f205){return[_0x53f205,!![]];});});}})[_0xd18d('0x8f')](function(_0x20b4bd,_0x33b321){if(_0x33b321){return _0x20b4bd;}return db[_0xd18d('0x98')][_0xd18d('0x59')](_[_0xd18d('0x50')](_0x36f5c7[_0xd18d('0x5a')],{'read':![],'body':_0x36f5c7[_0xd18d('0x5a')]['body'],'OpenchannelAccountId':_0x1ece0a['id'],'OpenchannelInteractionId':_0x20b4bd['id'],'UserId':_0x36f5c7[_0xd18d('0x5d')]['id'],'ContactId':_0x332f23['id']}))['then'](function(_0x11c915){_0x20b4bd[_0xd18d('0xbb')]['Messages']=[];_0x20b4bd[_0xd18d('0xbb')][_0xd18d('0xba')][_0xd18d('0xbc')](_0x11c915[_0xd18d('0xbb')]);return _0x20b4bd;});});}})[_0xd18d('0x36')](respondWithResult(_0x2209b5,null))[_0xd18d('0x28')](handleError(_0x2209b5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8ba84df..320d053 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 _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x91a7,0xe7));var _0x791a=function(_0x3b155d,_0x1035ac){_0x3b155d=_0x3b155d-0x0;var _0x373c0f=_0x91a7[_0x3b155d];return _0x373c0f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xda55,0x6d));var _0x5da5=function(_0x5c38a2,_0x40e4e4){_0x5c38a2=_0x5c38a2-0x0;var _0x22869c=_0xda55[_0x5c38a2];return _0x22869c;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('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 44dd535..e099542 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(_0x43ed41,_0x23c6ec){var _0x2363a2=function(_0x45b60e){while(--_0x45b60e){_0x43ed41['push'](_0x43ed41['shift']());}};_0x2363a2(++_0x23c6ec);}(_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'));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(_0x482a70,_0x3d475e){var _0x49e568=function(_0x4e47be){while(--_0x4e47be){_0x482a70['push'](_0x482a70['shift']());}};_0x49e568(++_0x3d475e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 bfdd905..48d33cd 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 _0xb62e=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});config[_0xeb62('0xc')]=_['defaults'](config[_0xeb62('0xc')],{'host':_0xeb62('0xd'),'port':0x18eb});var socket=require(_0xeb62('0xe'))(new Redis(config[_0xeb62('0xc')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4693c9,_0x40584b,_0x6d5e94){return new BPromise(function(_0xf93c21,_0x2fe923){return client[_0xeb62('0xf')](_0x4693c9,_0x6d5e94)[_0xeb62('0x10')](function(_0x3a826a){logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,'request\x20sent');logger[_0xeb62('0x13')](_0xeb62('0x14'),_0x40584b,_0xeb62('0x15'),JSON[_0xeb62('0x16')](_0x3a826a));if(_0x3a826a['error']){if(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x18')]===0x1f4){logger[_0xeb62('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0x2fe923(_0x3a826a[_0xeb62('0x17')]['message']);}logger[_0xeb62('0x17')](_0xeb62('0x12'),_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0xf93c21(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);}else{logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,_0xeb62('0x15'));_0xf93c21(_0x3a826a[_0xeb62('0x1a')][_0xeb62('0x19')]);}})[_0xeb62('0x1b')](function(_0x3cdf76){logger['error'](_0xeb62('0x12'),_0x40584b,_0x3cdf76);_0x2fe923(_0x3cdf76);});});} \ No newline at end of file +var _0x1b32=['http','redis','defaults','localhost','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c2417,_0x465c1e){var _0x4a935d=function(_0x4237b6){while(--_0x4237b6){_0x4c2417['push'](_0x4c2417['shift']());}};_0x4a935d(++_0x465c1e);}(_0x1b32,0x85));var _0x21b3=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x1b32[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var moment=require(_0x21b3('0x1'));var BPromise=require(_0x21b3('0x2'));var rs=require(_0x21b3('0x3'));var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require(_0x21b3('0x9'));var jayson=require(_0x21b3('0xa'));var client=jayson[_0x21b3('0xb')][_0x21b3('0xc')]({'port':0x232a});config[_0x21b3('0xd')]=_[_0x21b3('0xe')](config['redis'],{'host':_0x21b3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x21b3('0x10')](socket);function respondWithRpcPromise(_0x36b2a1,_0x56009d,_0x4aa0d7){return new BPromise(function(_0x253f2b,_0x270969){return client[_0x21b3('0x11')](_0x36b2a1,_0x4aa0d7)['then'](function(_0x370338){logger[_0x21b3('0x12')](_0x21b3('0x13'),_0x56009d,_0x21b3('0x14'));logger[_0x21b3('0x15')](_0x21b3('0x16'),_0x56009d,_0x21b3('0x14'),JSON[_0x21b3('0x17')](_0x370338));if(_0x370338[_0x21b3('0x18')]){if(_0x370338['error'][_0x21b3('0x19')]===0x1f4){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x370338['error'][_0x21b3('0x1a')]);return _0x270969(_0x370338['error'][_0x21b3('0x1a')]);}logger['error'](_0x21b3('0x13'),_0x56009d,_0x370338[_0x21b3('0x18')][_0x21b3('0x1a')]);return _0x253f2b(_0x370338[_0x21b3('0x18')]['message']);}else{logger[_0x21b3('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x56009d,_0x21b3('0x14'));_0x253f2b(_0x370338[_0x21b3('0x1b')][_0x21b3('0x1a')]);}})[_0x21b3('0x1c')](function(_0x513c32){logger[_0x21b3('0x18')](_0x21b3('0x13'),_0x56009d,_0x513c32);_0x270969(_0x513c32);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0490eaf..8e84e8c 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 _0xc6fe=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0xc6fe,0xbc));var _0xec6f=function(_0x1d0e4e,_0x5cace4){_0x1d0e4e=_0x1d0e4e-0x0;var _0x2006e0=_0xc6fe[_0x1d0e4e];return _0x2006e0;};'use strict';var OpenchannelAccountEvents=require(_0xec6f('0x0'));var events=[_0xec6f('0x1'),'remove',_0xec6f('0x2')];function createListener(_0x1ae099,_0x1c05f1){return function(_0x50a1e9){_0x1c05f1[_0xec6f('0x3')](_0x1ae099,_0x50a1e9);};}function removeListener(_0x540732,_0x113ee0){return function(){OpenchannelAccountEvents[_0xec6f('0x4')](_0x540732,_0x113ee0);};}exports[_0xec6f('0x5')]=function(_0x2f64ea){for(var _0x4adbb8=0x0,_0x29fa2c=events[_0xec6f('0x6')];_0x4adbb8<_0x29fa2c;_0x4adbb8++){var _0x219264=events[_0x4adbb8];var _0x7bcb13=createListener(_0xec6f('0x7')+_0x219264,_0x2f64ea);OpenchannelAccountEvents['on'](_0x219264,_0x7bcb13);}}; \ No newline at end of file +var _0x928c=['emit','register','openchannelAccount:','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x928c,0x17f));var _0xc928=function(_0x5b10d9,_0x41ad7c){_0x5b10d9=_0x5b10d9-0x0;var _0x14d33d=_0x928c[_0x5b10d9];return _0x14d33d;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xc928('0x0'),_0xc928('0x1')];function createListener(_0x597d43,_0x24354b){return function(_0x29bd30){_0x24354b[_0xc928('0x2')](_0x597d43,_0x29bd30);};}function removeListener(_0x3e4e60,_0x1dd54b){return function(){OpenchannelAccountEvents['removeListener'](_0x3e4e60,_0x1dd54b);};}exports[_0xc928('0x3')]=function(_0x4704bc){for(var _0x8c0fa5=0x0,_0x4ff9e6=events['length'];_0x8c0fa5<_0x4ff9e6;_0x8c0fa5++){var _0x5e433b=events[_0x8c0fa5];var _0x445248=createListener(_0xc928('0x4')+_0x5e433b,_0x4704bc);OpenchannelAccountEvents['on'](_0x5e433b,_0x445248);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3fd282b..fa658c7 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 _0x3e4b=['post','create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show'];(function(_0xa59e7b,_0x4e65c6){var _0x5316af=function(_0x552e7f){while(--_0x552e7f){_0xa59e7b['push'](_0xa59e7b['shift']());}};_0x5316af(++_0x4e65c6);}(_0x3e4b,0x14b));var _0xb3e4=function(_0x46dd21,_0x158408){_0x46dd21=_0x46dd21-0x0;var _0x35566e=_0x3e4b[_0x46dd21];return _0x35566e;};'use strict';var multer=require(_0xb3e4('0x0'));var util=require('util');var path=require(_0xb3e4('0x1'));var timeout=require('connect-timeout');var express=require(_0xb3e4('0x2'));var router=express['Router']();var fs_extra=require(_0xb3e4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb3e4('0x4'));var config=require(_0xb3e4('0x5'));var controller=require(_0xb3e4('0x6'));router[_0xb3e4('0x7')]('/',auth[_0xb3e4('0x8')](),controller[_0xb3e4('0x9')]);router[_0xb3e4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb3e4('0xa')]);router[_0xb3e4('0xb')]('/',auth[_0xb3e4('0x8')](),controller[_0xb3e4('0xc')]);router[_0xb3e4('0xd')](_0xb3e4('0xe'),auth[_0xb3e4('0x8')](),controller[_0xb3e4('0xf')]);router[_0xb3e4('0x10')](_0xb3e4('0xe'),auth['isAuthenticated'](),controller[_0xb3e4('0x11')]);module[_0xb3e4('0x12')]=router; \ No newline at end of file +var _0x449f=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x39375e,_0x4c171b){var _0x3ff062=function(_0x3a8a7f){while(--_0x3a8a7f){_0x39375e['push'](_0x39375e['shift']());}};_0x3ff062(++_0x4c171b);}(_0x449f,0x7e));var _0xf449=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x449f[_0xae282f];return _0x5f46d4;};'use strict';var multer=require(_0xf449('0x0'));var util=require(_0xf449('0x1'));var path=require(_0xf449('0x2'));var timeout=require('connect-timeout');var express=require(_0xf449('0x3'));var router=express[_0xf449('0x4')]();var fs_extra=require(_0xf449('0x5'));var auth=require(_0xf449('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf449('0x7'));var controller=require(_0xf449('0x8'));router['get']('/',auth[_0xf449('0x9')](),controller[_0xf449('0xa')]);router[_0xf449('0xb')](_0xf449('0xc'),auth['isAuthenticated'](),controller[_0xf449('0xd')]);router[_0xf449('0xe')]('/',auth[_0xf449('0x9')](),controller[_0xf449('0xf')]);router[_0xf449('0x10')](_0xf449('0xc'),auth[_0xf449('0x9')](),controller[_0xf449('0x11')]);router[_0xf449('0x12')](_0xf449('0xc'),auth[_0xf449('0x9')](),controller[_0xf449('0x13')]);module[_0xf449('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 b7d8b7a..ab27286 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 _0xb8c2=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xcc4b0c,_0xb1d3b5){var _0x24abcf=function(_0x3508b3){while(--_0x3508b3){_0xcc4b0c['push'](_0xcc4b0c['shift']());}};_0x24abcf(++_0xb1d3b5);}(_0xb8c2,0xcf));var _0x2b8c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb8c2[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x2b8c('0x0')]={'priority':{'type':Sequelize[_0x2b8c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2b8c('0x2')],'allowNull':![],'defaultValue':_0x2b8c('0x3')},'appdata':{'type':Sequelize[_0x2b8c('0x4')]()},'description':{'type':Sequelize[_0x2b8c('0x2')]},'interval':{'type':Sequelize[_0x2b8c('0x2')],'defaultValue':_0x2b8c('0x5')}}; \ No newline at end of file +var _0x9f6e=['STRING','noop','TEXT'];(function(_0xb2e3bd,_0x1703c8){var _0x306c02=function(_0x3c00cc){while(--_0x3c00cc){_0xb2e3bd['push'](_0xb2e3bd['shift']());}};_0x306c02(++_0x1703c8);}(_0x9f6e,0x1d4));var _0xe9f6=function(_0x1d52bf,_0x4de8dc){_0x1d52bf=_0x1d52bf-0x0;var _0x229c5e=_0x9f6e[_0x1d52bf];return _0x229c5e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe9f6('0x0')],'allowNull':![],'defaultValue':_0xe9f6('0x1')},'appdata':{'type':Sequelize[_0xe9f6('0x2')]()},'description':{'type':Sequelize[_0xe9f6('0x0')]},'interval':{'type':Sequelize[_0xe9f6('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d4b0c86..42e0339 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 _0x7243=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x2d2b91,_0x49bdce){var _0x1658b7=function(_0x444a21){while(--_0x444a21){_0x2d2b91['push'](_0x2d2b91['shift']());}};_0x1658b7(++_0x49bdce);}(_0x7243,0x103));var _0x3724=function(_0x6fb065,_0x14773d){_0x6fb065=_0x6fb065-0x0;var _0x575a63=_0x7243[_0x6fb065];return _0x575a63;};'use strict';var emlformat=require(_0x3724('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3724('0x1'));var jsonpatch=require(_0x3724('0x2'));var rp=require(_0x3724('0x3'));var moment=require(_0x3724('0x4'));var BPromise=require(_0x3724('0x5'));var Mustache=require(_0x3724('0x6'));var util=require(_0x3724('0x7'));var path=require(_0x3724('0x8'));var sox=require(_0x3724('0x9'));var csv=require(_0x3724('0xa'));var ejs=require(_0x3724('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3724('0xc'));var squel=require('squel');var crypto=require(_0x3724('0xd'));var jsforce=require(_0x3724('0xe'));var deskjs=require(_0x3724('0xf'));var toCsv=require(_0x3724('0xa'));var querystring=require('querystring');var Papa=require(_0x3724('0x10'));var Redis=require(_0x3724('0x11'));var authService=require(_0x3724('0x12'));var qs=require(_0x3724('0x13'));var as=require(_0x3724('0x14'));var hardwareService=require(_0x3724('0x15'));var logger=require(_0x3724('0x16'))(_0x3724('0x17'));var utils=require('../../config/utils');var config=require(_0x3724('0x18'));var licenseUtil=require(_0x3724('0x19'));var db=require(_0x3724('0x1a'))['db'];function respondWithStatusCode(_0x424f57,_0x38af55){_0x38af55=_0x38af55||0xcc;return function(_0x1b543a){if(_0x1b543a){return _0x424f57[_0x3724('0x1b')](_0x38af55);}return _0x424f57['status'](_0x38af55)['end']();};}function respondWithResult(_0x16d2de,_0x547a68){_0x547a68=_0x547a68||0xc8;return function(_0x1bea42){if(_0x1bea42){return _0x16d2de[_0x3724('0x1c')](_0x547a68)[_0x3724('0x1d')](_0x1bea42);}};}function respondWithFilteredResult(_0x2e2396,_0x7f400){return function(_0x1e5edf){if(_0x1e5edf){var _0x5f01af=typeof _0x7f400['offset']==='undefined'&&typeof _0x7f400[_0x3724('0x1e')]===_0x3724('0x1f');var _0x13958e=_0x1e5edf[_0x3724('0x20')];var _0x2a5305=_0x5f01af?0x0:_0x7f400[_0x3724('0x21')];var _0x31b50a=_0x5f01af?_0x1e5edf[_0x3724('0x20')]:_0x7f400['offset']+_0x7f400[_0x3724('0x1e')];var _0xb4d492;if(_0x31b50a>=_0x13958e){_0x31b50a=_0x13958e;_0xb4d492=0xc8;}else{_0xb4d492=0xce;}_0x2e2396[_0x3724('0x1c')](_0xb4d492);return _0x2e2396[_0x3724('0x22')](_0x3724('0x23'),_0x2a5305+'-'+_0x31b50a+'/'+_0x13958e)[_0x3724('0x1d')](_0x1e5edf);}return null;};}function patchUpdates(_0x24d4ae){return function(_0x439d47){try{jsonpatch[_0x3724('0x24')](_0x439d47,_0x24d4ae,!![]);}catch(_0x320354){return BPromise[_0x3724('0x25')](_0x320354);}return _0x439d47['save']();};}function saveUpdates(_0x4986df,_0x325ef9){return function(_0xec4269){if(_0xec4269){return _0xec4269['update'](_0x4986df)['then'](function(_0x44ee2f){return _0x44ee2f;});}return null;};}function removeEntity(_0x50d26d,_0x5a072c){return function(_0x18edcf){if(_0x18edcf){return _0x18edcf[_0x3724('0x26')]()[_0x3724('0x27')](function(){_0x50d26d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x438534,_0x541e30){return function(_0x4e2879){if(!_0x4e2879){_0x438534[_0x3724('0x1b')](0x194);}return _0x4e2879;};}function handleError(_0x6b55dc,_0x46006e){_0x46006e=_0x46006e||0x1f4;return function(_0x4eccbc){logger[_0x3724('0x28')](_0x4eccbc[_0x3724('0x29')]);if(_0x4eccbc[_0x3724('0x2a')]){delete _0x4eccbc[_0x3724('0x2a')];}_0x6b55dc[_0x3724('0x1c')](_0x46006e)[_0x3724('0x2b')](_0x4eccbc);};}exports['index']=function(_0x5a7831,_0x18d625){var _0x27e1f8={},_0x3269b9={},_0x1e8565={'count':0x0,'rows':[]};var _0x268e87=_[_0x3724('0x2c')](db[_0x3724('0x2d')][_0x3724('0x2e')],function(_0x45c08d){return{'name':_0x45c08d[_0x3724('0x2f')],'type':_0x45c08d['type'][_0x3724('0x30')]};});_0x3269b9[_0x3724('0x31')]=_[_0x3724('0x2c')](_0x268e87,'name');_0x3269b9[_0x3724('0x32')]=_[_0x3724('0x33')](_0x5a7831['query']);_0x3269b9['filters']=_['intersection'](_0x3269b9[_0x3724('0x31')],_0x3269b9['query']);_0x27e1f8['attributes']=_[_0x3724('0x34')](_0x3269b9[_0x3724('0x31')],qs[_0x3724('0x35')](_0x5a7831['query'][_0x3724('0x35')]));_0x27e1f8['attributes']=_0x27e1f8[_0x3724('0x36')][_0x3724('0x37')]?_0x27e1f8[_0x3724('0x36')]:_0x3269b9[_0x3724('0x31')];if(!_0x5a7831[_0x3724('0x32')][_0x3724('0x38')](_0x3724('0x39'))){_0x27e1f8[_0x3724('0x1e')]=qs[_0x3724('0x1e')](_0x5a7831[_0x3724('0x32')][_0x3724('0x1e')]);_0x27e1f8[_0x3724('0x21')]=qs['offset'](_0x5a7831[_0x3724('0x32')][_0x3724('0x21')]);}_0x27e1f8[_0x3724('0x3a')]=qs[_0x3724('0x3b')](_0x5a7831[_0x3724('0x32')][_0x3724('0x3b')]);_0x27e1f8[_0x3724('0x3c')]=qs[_0x3724('0x3d')](_[_0x3724('0x3e')](_0x5a7831[_0x3724('0x32')],_0x3269b9[_0x3724('0x3d')]),_0x268e87);if(_0x5a7831[_0x3724('0x32')][_0x3724('0x3f')]){_0x27e1f8['where']=_[_0x3724('0x40')](_0x27e1f8[_0x3724('0x3c')],{'$or':_['map'](_0x268e87,function(_0x4037f1){if(_0x4037f1[_0x3724('0x41')]!==_0x3724('0x42')){var _0x70ed4b={};_0x70ed4b[_0x4037f1['name']]={'$like':'%'+_0x5a7831['query'][_0x3724('0x3f')]+'%'};return _0x70ed4b;}})});}_0x27e1f8=_['merge']({},_0x27e1f8,_0x5a7831['options']);var _0x3e770f={'where':_0x27e1f8['where']};return db['OpenchannelApplication'][_0x3724('0x20')](_0x3e770f)['then'](function(_0x1d13f3){_0x1e8565[_0x3724('0x20')]=_0x1d13f3;if(_0x5a7831[_0x3724('0x32')][_0x3724('0x43')]){_0x27e1f8[_0x3724('0x44')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x3724('0x45')](_0x27e1f8);})['then'](function(_0x3c7ae8){_0x1e8565[_0x3724('0x46')]=_0x3c7ae8;return _0x1e8565;})[_0x3724('0x27')](respondWithFilteredResult(_0x18d625,_0x27e1f8))[_0x3724('0x47')](handleError(_0x18d625,null));};exports['show']=function(_0x5778b4,_0x257443){var _0x2b683={'raw':!![],'where':{'id':_0x5778b4[_0x3724('0x48')]['id']}},_0x31df20={};_0x31df20[_0x3724('0x31')]=_[_0x3724('0x33')](db[_0x3724('0x2d')]['rawAttributes']);_0x31df20[_0x3724('0x32')]=_[_0x3724('0x33')](_0x5778b4[_0x3724('0x32')]);_0x31df20[_0x3724('0x3d')]=_['intersection'](_0x31df20['model'],_0x31df20[_0x3724('0x32')]);_0x2b683[_0x3724('0x36')]=_[_0x3724('0x34')](_0x31df20[_0x3724('0x31')],qs['fields'](_0x5778b4[_0x3724('0x32')]['fields']));_0x2b683[_0x3724('0x36')]=_0x2b683['attributes']['length']?_0x2b683['attributes']:_0x31df20[_0x3724('0x31')];if(_0x5778b4[_0x3724('0x32')][_0x3724('0x43')]){_0x2b683[_0x3724('0x44')]=[{'all':!![]}];}_0x2b683=_[_0x3724('0x40')]({},_0x2b683,_0x5778b4[_0x3724('0x49')]);return db[_0x3724('0x2d')][_0x3724('0x4a')](_0x2b683)['then'](handleEntityNotFound(_0x257443,null))[_0x3724('0x27')](respondWithResult(_0x257443,null))[_0x3724('0x47')](handleError(_0x257443,null));};exports[_0x3724('0x4b')]=function(_0x1e90ca,_0x54fd55){return db['OpenchannelApplication'][_0x3724('0x4b')](_0x1e90ca[_0x3724('0x4c')],{})[_0x3724('0x27')](respondWithResult(_0x54fd55,0xc9))[_0x3724('0x47')](handleError(_0x54fd55,null));};exports[_0x3724('0x4d')]=function(_0x4eca69,_0x405fdc){if(_0x4eca69[_0x3724('0x4c')]['id']){delete _0x4eca69[_0x3724('0x4c')]['id'];}return db[_0x3724('0x2d')][_0x3724('0x4a')]({'where':{'id':_0x4eca69[_0x3724('0x48')]['id']}})[_0x3724('0x27')](handleEntityNotFound(_0x405fdc,null))[_0x3724('0x27')](saveUpdates(_0x4eca69[_0x3724('0x4c')],null))['then'](respondWithResult(_0x405fdc,null))[_0x3724('0x47')](handleError(_0x405fdc,null));};exports[_0x3724('0x26')]=function(_0xd1527,_0x2bc208){return db[_0x3724('0x2d')][_0x3724('0x4a')]({'where':{'id':_0xd1527[_0x3724('0x48')]['id']}})['then'](handleEntityNotFound(_0x2bc208,null))['then'](removeEntity(_0x2bc208,null))[_0x3724('0x47')](handleError(_0x2bc208,null));}; \ No newline at end of file +var _0x7c9e=['intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','attributes'];(function(_0xa18665,_0x5d6110){var _0x521a06=function(_0xfc6c56){while(--_0xfc6c56){_0xa18665['push'](_0xa18665['shift']());}};_0x521a06(++_0x5d6110);}(_0x7c9e,0x12b));var _0xe7c9=function(_0x54d3c4,_0x4c172b){_0x54d3c4=_0x54d3c4-0x0;var _0x33d16c=_0x7c9e[_0x54d3c4];return _0x33d16c;};'use strict';var emlformat=require(_0xe7c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7c9('0x1'));var jsonpatch=require(_0xe7c9('0x2'));var rp=require('request-promise');var moment=require(_0xe7c9('0x3'));var BPromise=require(_0xe7c9('0x4'));var Mustache=require(_0xe7c9('0x5'));var util=require('util');var path=require(_0xe7c9('0x6'));var sox=require(_0xe7c9('0x7'));var csv=require(_0xe7c9('0x8'));var ejs=require(_0xe7c9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7c9('0xa'));var squel=require('squel');var crypto=require(_0xe7c9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe7c9('0x8'));var querystring=require('querystring');var Papa=require(_0xe7c9('0xc'));var Redis=require(_0xe7c9('0xd'));var authService=require(_0xe7c9('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7c9('0xf'));var logger=require(_0xe7c9('0x10'))(_0xe7c9('0x11'));var utils=require(_0xe7c9('0x12'));var config=require(_0xe7c9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7c9('0x14'))['db'];function respondWithStatusCode(_0x585675,_0x56032f){_0x56032f=_0x56032f||0xcc;return function(_0x385901){if(_0x385901){return _0x585675[_0xe7c9('0x15')](_0x56032f);}return _0x585675[_0xe7c9('0x16')](_0x56032f)[_0xe7c9('0x17')]();};}function respondWithResult(_0x50ea03,_0x30b4a6){_0x30b4a6=_0x30b4a6||0xc8;return function(_0x40428f){if(_0x40428f){return _0x50ea03['status'](_0x30b4a6)['json'](_0x40428f);}};}function respondWithFilteredResult(_0x323d36,_0x16e992){return function(_0x396c53){if(_0x396c53){var _0x58bdd9=typeof _0x16e992[_0xe7c9('0x18')]===_0xe7c9('0x19')&&typeof _0x16e992[_0xe7c9('0x1a')]===_0xe7c9('0x19');var _0x4ed399=_0x396c53[_0xe7c9('0x1b')];var _0x45d2b0=_0x58bdd9?0x0:_0x16e992['offset'];var _0x4b4c41=_0x58bdd9?_0x396c53[_0xe7c9('0x1b')]:_0x16e992[_0xe7c9('0x18')]+_0x16e992[_0xe7c9('0x1a')];var _0x196731;if(_0x4b4c41>=_0x4ed399){_0x4b4c41=_0x4ed399;_0x196731=0xc8;}else{_0x196731=0xce;}_0x323d36[_0xe7c9('0x16')](_0x196731);return _0x323d36[_0xe7c9('0x1c')](_0xe7c9('0x1d'),_0x45d2b0+'-'+_0x4b4c41+'/'+_0x4ed399)[_0xe7c9('0x1e')](_0x396c53);}return null;};}function patchUpdates(_0x2e2f3c){return function(_0x5aa0d9){try{jsonpatch[_0xe7c9('0x1f')](_0x5aa0d9,_0x2e2f3c,!![]);}catch(_0x1ab0d7){return BPromise[_0xe7c9('0x20')](_0x1ab0d7);}return _0x5aa0d9[_0xe7c9('0x21')]();};}function saveUpdates(_0x322b7b,_0x266ec3){return function(_0x3d1157){if(_0x3d1157){return _0x3d1157[_0xe7c9('0x22')](_0x322b7b)['then'](function(_0x653d5){return _0x653d5;});}return null;};}function removeEntity(_0x12b1d8,_0x3b35a7){return function(_0x33b9e6){if(_0x33b9e6){return _0x33b9e6[_0xe7c9('0x23')]()[_0xe7c9('0x24')](function(){_0x12b1d8[_0xe7c9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2e04,_0x4ed7a0){return function(_0x3d59eb){if(!_0x3d59eb){_0x1e2e04['sendStatus'](0x194);}return _0x3d59eb;};}function handleError(_0x5a9e61,_0x22d639){_0x22d639=_0x22d639||0x1f4;return function(_0x5c0981){logger[_0xe7c9('0x25')](_0x5c0981[_0xe7c9('0x26')]);if(_0x5c0981[_0xe7c9('0x27')]){delete _0x5c0981['name'];}_0x5a9e61[_0xe7c9('0x16')](_0x22d639)[_0xe7c9('0x28')](_0x5c0981);};}exports[_0xe7c9('0x29')]=function(_0x566738,_0x4a6416){var _0x143c96={},_0x5c93d7={},_0x15ccf7={'count':0x0,'rows':[]};var _0x4adf0b=_[_0xe7c9('0x2a')](db[_0xe7c9('0x2b')][_0xe7c9('0x2c')],function(_0xc839c3){return{'name':_0xc839c3['fieldName'],'type':_0xc839c3['type'][_0xe7c9('0x2d')]};});_0x5c93d7[_0xe7c9('0x2e')]=_[_0xe7c9('0x2a')](_0x4adf0b,'name');_0x5c93d7[_0xe7c9('0x2f')]=_[_0xe7c9('0x30')](_0x566738[_0xe7c9('0x2f')]);_0x5c93d7[_0xe7c9('0x31')]=_['intersection'](_0x5c93d7['model'],_0x5c93d7[_0xe7c9('0x2f')]);_0x143c96[_0xe7c9('0x32')]=_[_0xe7c9('0x33')](_0x5c93d7['model'],qs['fields'](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x34')]));_0x143c96[_0xe7c9('0x32')]=_0x143c96[_0xe7c9('0x32')][_0xe7c9('0x35')]?_0x143c96[_0xe7c9('0x32')]:_0x5c93d7[_0xe7c9('0x2e')];if(!_0x566738['query'][_0xe7c9('0x36')]('nolimit')){_0x143c96[_0xe7c9('0x1a')]=qs[_0xe7c9('0x1a')](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x1a')]);_0x143c96['offset']=qs[_0xe7c9('0x18')](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x18')]);}_0x143c96[_0xe7c9('0x37')]=qs[_0xe7c9('0x38')](_0x566738[_0xe7c9('0x2f')][_0xe7c9('0x38')]);_0x143c96[_0xe7c9('0x39')]=qs[_0xe7c9('0x31')](_['pick'](_0x566738[_0xe7c9('0x2f')],_0x5c93d7[_0xe7c9('0x31')]),_0x4adf0b);if(_0x566738[_0xe7c9('0x2f')]['filter']){_0x143c96[_0xe7c9('0x39')]=_[_0xe7c9('0x3a')](_0x143c96[_0xe7c9('0x39')],{'$or':_[_0xe7c9('0x2a')](_0x4adf0b,function(_0x8a07e8){if(_0x8a07e8['type']!==_0xe7c9('0x3b')){var _0x5baf5e={};_0x5baf5e[_0x8a07e8['name']]={'$like':'%'+_0x566738['query']['filter']+'%'};return _0x5baf5e;}})});}_0x143c96=_[_0xe7c9('0x3a')]({},_0x143c96,_0x566738[_0xe7c9('0x3c')]);var _0x3e3f36={'where':_0x143c96[_0xe7c9('0x39')]};return db[_0xe7c9('0x2b')][_0xe7c9('0x1b')](_0x3e3f36)['then'](function(_0x521640){_0x15ccf7['count']=_0x521640;if(_0x566738['query'][_0xe7c9('0x3d')]){_0x143c96[_0xe7c9('0x3e')]=[{'all':!![]}];}return db[_0xe7c9('0x2b')][_0xe7c9('0x3f')](_0x143c96);})[_0xe7c9('0x24')](function(_0x171a40){_0x15ccf7[_0xe7c9('0x40')]=_0x171a40;return _0x15ccf7;})[_0xe7c9('0x24')](respondWithFilteredResult(_0x4a6416,_0x143c96))[_0xe7c9('0x41')](handleError(_0x4a6416,null));};exports['show']=function(_0x4b11c9,_0x50d10d){var _0x180502={'raw':!![],'where':{'id':_0x4b11c9[_0xe7c9('0x42')]['id']}},_0x13ee70={};_0x13ee70[_0xe7c9('0x2e')]=_['keys'](db[_0xe7c9('0x2b')]['rawAttributes']);_0x13ee70[_0xe7c9('0x2f')]=_[_0xe7c9('0x30')](_0x4b11c9[_0xe7c9('0x2f')]);_0x13ee70['filters']=_[_0xe7c9('0x33')](_0x13ee70[_0xe7c9('0x2e')],_0x13ee70[_0xe7c9('0x2f')]);_0x180502[_0xe7c9('0x32')]=_[_0xe7c9('0x33')](_0x13ee70['model'],qs[_0xe7c9('0x34')](_0x4b11c9['query']['fields']));_0x180502[_0xe7c9('0x32')]=_0x180502[_0xe7c9('0x32')][_0xe7c9('0x35')]?_0x180502[_0xe7c9('0x32')]:_0x13ee70[_0xe7c9('0x2e')];if(_0x4b11c9['query'][_0xe7c9('0x3d')]){_0x180502['include']=[{'all':!![]}];}_0x180502=_[_0xe7c9('0x3a')]({},_0x180502,_0x4b11c9[_0xe7c9('0x3c')]);return db['OpenchannelApplication'][_0xe7c9('0x43')](_0x180502)['then'](handleEntityNotFound(_0x50d10d,null))[_0xe7c9('0x24')](respondWithResult(_0x50d10d,null))[_0xe7c9('0x41')](handleError(_0x50d10d,null));};exports[_0xe7c9('0x44')]=function(_0x52e4f8,_0x30d529){return db[_0xe7c9('0x2b')]['create'](_0x52e4f8[_0xe7c9('0x45')],{})[_0xe7c9('0x24')](respondWithResult(_0x30d529,0xc9))[_0xe7c9('0x41')](handleError(_0x30d529,null));};exports[_0xe7c9('0x22')]=function(_0x3a793a,_0x4f73aa){if(_0x3a793a[_0xe7c9('0x45')]['id']){delete _0x3a793a[_0xe7c9('0x45')]['id'];}return db[_0xe7c9('0x2b')][_0xe7c9('0x43')]({'where':{'id':_0x3a793a[_0xe7c9('0x42')]['id']}})[_0xe7c9('0x24')](handleEntityNotFound(_0x4f73aa,null))[_0xe7c9('0x24')](saveUpdates(_0x3a793a[_0xe7c9('0x45')],null))['then'](respondWithResult(_0x4f73aa,null))[_0xe7c9('0x41')](handleError(_0x4f73aa,null));};exports[_0xe7c9('0x23')]=function(_0x56204a,_0x2065f1){return db['OpenchannelApplication']['find']({'where':{'id':_0x56204a['params']['id']}})['then'](handleEntityNotFound(_0x2065f1,null))[_0xe7c9('0x24')](removeEntity(_0x2065f1,null))[_0xe7c9('0x41')](handleError(_0x2065f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e8f4c98..0ecee37 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 _0x5985=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications'];(function(_0x20cb5f,_0x3ce05a){var _0x4339b2=function(_0x31af1d){while(--_0x31af1d){_0x20cb5f['push'](_0x20cb5f['shift']());}};_0x4339b2(++_0x3ce05a);}(_0x5985,0x1ca));var _0x5598=function(_0x274c36,_0x440306){_0x274c36=_0x274c36-0x0;var _0x3df5da=_0x5985[_0x274c36];return _0x3df5da;};'use strict';var _=require(_0x5598('0x0'));var util=require(_0x5598('0x1'));var logger=require(_0x5598('0x2'))('api');var moment=require(_0x5598('0x3'));var BPromise=require(_0x5598('0x4'));var rp=require(_0x5598('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5598('0x6'));var attributes=require(_0x5598('0x7'));module['exports']=function(_0x4c7400,_0x115bef){return _0x4c7400['define'](_0x5598('0x8'),attributes,{'tableName':_0x5598('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5598('0xa'),'collate':_0x5598('0xb')});}; \ No newline at end of file +var _0x57a1=['rimraf','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path'];(function(_0x20554f,_0x249e0f){var _0x1f36b3=function(_0x2fcb98){while(--_0x2fcb98){_0x20554f['push'](_0x20554f['shift']());}};_0x1f36b3(++_0x249e0f);}(_0x57a1,0x1c1));var _0x157a=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0x57a1[_0x12f59c];return _0x2db43e;};'use strict';var _=require(_0x157a('0x0'));var util=require(_0x157a('0x1'));var logger=require('../../config/logger')(_0x157a('0x2'));var moment=require(_0x157a('0x3'));var BPromise=require('bluebird');var rp=require(_0x157a('0x4'));var fs=require('fs');var path=require(_0x157a('0x5'));var rimraf=require(_0x157a('0x6'));var config=require(_0x157a('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x2e9d67,_0x1554b6){return _0x2e9d67[_0x157a('0x8')](_0x157a('0x9'),attributes,{'tableName':_0x157a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x157a('0xb'),'collate':_0x157a('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f2b4cd1..7798f92 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 _0x7a50=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','OpenchannelApplication','update','body','options','where','attributes','UpdateOpenchannelApplication','lodash','moment','bluebird','randomstring'];(function(_0x132edb,_0x54e052){var _0x294aab=function(_0x3630cf){while(--_0x3630cf){_0x132edb['push'](_0x132edb['shift']());}};_0x294aab(++_0x54e052);}(_0x7a50,0x1e9));var _0x07a5=function(_0x482556,_0x5c9485){_0x482556=_0x482556-0x0;var _0x4fef46=_0x7a50[_0x482556];return _0x4fef46;};'use strict';var _=require(_0x07a5('0x0'));var util=require('util');var moment=require(_0x07a5('0x1'));var BPromise=require(_0x07a5('0x2'));var rs=require(_0x07a5('0x3'));var fs=require('fs');var Redis=require(_0x07a5('0x4'));var db=require(_0x07a5('0x5'))['db'];var utils=require(_0x07a5('0x6'));var logger=require(_0x07a5('0x7'))(_0x07a5('0x8'));var config=require(_0x07a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x07a5('0xa')][_0x07a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d3bd,_0x315b8d,_0x5d01cb){return new BPromise(function(_0x6b07f9,_0x2b06d9){return client['request'](_0x38d3bd,_0x5d01cb)[_0x07a5('0xc')](function(_0x51ba8c){logger[_0x07a5('0xd')](_0x07a5('0xe'),_0x315b8d,_0x07a5('0xf'));logger[_0x07a5('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x315b8d,_0x07a5('0xf'),JSON[_0x07a5('0x11')](_0x51ba8c));if(_0x51ba8c['error']){if(_0x51ba8c['error']['code']===0x1f4){logger[_0x07a5('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x315b8d,_0x51ba8c[_0x07a5('0x12')]['message']);return _0x2b06d9(_0x51ba8c[_0x07a5('0x12')]['message']);}logger[_0x07a5('0x12')](_0x07a5('0xe'),_0x315b8d,_0x51ba8c['error']['message']);return _0x6b07f9(_0x51ba8c[_0x07a5('0x12')][_0x07a5('0x13')]);}else{logger[_0x07a5('0xd')](_0x07a5('0xe'),_0x315b8d,_0x07a5('0xf'));_0x6b07f9(_0x51ba8c[_0x07a5('0x14')][_0x07a5('0x13')]);}})[_0x07a5('0x15')](function(_0x43ead2){logger[_0x07a5('0x12')](_0x07a5('0xe'),_0x315b8d,_0x43ead2);_0x2b06d9(_0x43ead2);});});}exports['UpdateOpenchannelApplication']=function(_0x423fd4){var _0x5eddbe=this;return new Promise(function(_0x607855,_0x122069){return db[_0x07a5('0x16')][_0x07a5('0x17')](_0x423fd4[_0x07a5('0x18')],{'raw':_0x423fd4['options']?_0x423fd4[_0x07a5('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x423fd4['options']?_0x423fd4[_0x07a5('0x19')][_0x07a5('0x1a')]||null:null,'attributes':_0x423fd4[_0x07a5('0x19')]?_0x423fd4[_0x07a5('0x19')][_0x07a5('0x1b')]||null:null,'limit':_0x423fd4['options']?_0x423fd4['options']['limit']||null:null})[_0x07a5('0xc')](function(_0x269cd5){logger[_0x07a5('0xd')]('UpdateOpenchannelApplication',_0x423fd4);logger[_0x07a5('0x10')](_0x07a5('0x1c'),_0x423fd4,JSON[_0x07a5('0x11')](_0x269cd5));_0x607855(_0x269cd5);})['catch'](function(_0xdad634){logger[_0x07a5('0x12')]('UpdateOpenchannelApplication',_0xdad634[_0x07a5('0x13')],_0x423fd4);_0x122069(_0x5eddbe['error'](0x1f4,_0xdad634['message']));});});}; \ No newline at end of file +var _0xe407=['options','raw','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','body'];(function(_0x3fbb81,_0x2529c5){var _0x220e6d=function(_0x150c14){while(--_0x150c14){_0x3fbb81['push'](_0x3fbb81['shift']());}};_0x220e6d(++_0x2529c5);}(_0xe407,0x156));var _0x7e40=function(_0x37897a,_0x1a355a){_0x37897a=_0x37897a-0x0;var _0x2701fb=_0xe407[_0x37897a];return _0x2701fb;};'use strict';var _=require(_0x7e40('0x0'));var util=require('util');var moment=require(_0x7e40('0x1'));var BPromise=require(_0x7e40('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e40('0x3'));var db=require(_0x7e40('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e40('0x5'))(_0x7e40('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e40('0x7')][_0x7e40('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e692f,_0x2ba0ba,_0x1c74d4){return new BPromise(function(_0x3e6a68,_0x3a05aa){return client[_0x7e40('0x9')](_0x2e692f,_0x1c74d4)[_0x7e40('0xa')](function(_0x1afa54){logger['info'](_0x7e40('0xb'),_0x2ba0ba,'request\x20sent');logger[_0x7e40('0xc')](_0x7e40('0xd'),_0x2ba0ba,'request\x20sent',JSON[_0x7e40('0xe')](_0x1afa54));if(_0x1afa54['error']){if(_0x1afa54[_0x7e40('0xf')]['code']===0x1f4){logger['error'](_0x7e40('0xb'),_0x2ba0ba,_0x1afa54[_0x7e40('0xf')][_0x7e40('0x10')]);return _0x3a05aa(_0x1afa54['error'][_0x7e40('0x10')]);}logger[_0x7e40('0xf')](_0x7e40('0xb'),_0x2ba0ba,_0x1afa54['error']['message']);return _0x3e6a68(_0x1afa54[_0x7e40('0xf')][_0x7e40('0x10')]);}else{logger[_0x7e40('0x11')](_0x7e40('0xb'),_0x2ba0ba,'request\x20sent');_0x3e6a68(_0x1afa54['result'][_0x7e40('0x10')]);}})[_0x7e40('0x12')](function(_0x463d3d){logger[_0x7e40('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x2ba0ba,_0x463d3d);_0x3a05aa(_0x463d3d);});});}exports[_0x7e40('0x13')]=function(_0x5d8b0c){var _0x3f09a1=this;return new Promise(function(_0x2310fc,_0x1caf25){return db[_0x7e40('0x14')]['update'](_0x5d8b0c[_0x7e40('0x15')],{'raw':_0x5d8b0c['options']?_0x5d8b0c[_0x7e40('0x16')][_0x7e40('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d8b0c[_0x7e40('0x16')]?_0x5d8b0c[_0x7e40('0x16')][_0x7e40('0x18')]||null:null,'attributes':_0x5d8b0c[_0x7e40('0x16')]?_0x5d8b0c[_0x7e40('0x16')][_0x7e40('0x19')]||null:null,'limit':_0x5d8b0c[_0x7e40('0x16')]?_0x5d8b0c[_0x7e40('0x16')]['limit']||null:null})[_0x7e40('0xa')](function(_0x2801fd){logger[_0x7e40('0x11')](_0x7e40('0x13'),_0x5d8b0c);logger['debug'](_0x7e40('0x13'),_0x5d8b0c,JSON[_0x7e40('0xe')](_0x2801fd));_0x2310fc(_0x2801fd);})[_0x7e40('0x12')](function(_0xec2d5f){logger[_0x7e40('0xf')]('UpdateOpenchannelApplication',_0xec2d5f[_0x7e40('0x10')],_0x5d8b0c);_0x1caf25(_0x3f09a1['error'](0x1f4,_0xec2d5f[_0x7e40('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index f66069c..709e2ca 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 _0x2c98=['update','delete','destroy','/:id/tags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','create','tracked','openchannel','openchannelinteraction:addtags','addTags','put'];(function(_0xb725e1,_0x3c02c9){var _0x11f88d=function(_0x5cd26b){while(--_0x5cd26b){_0xb725e1['push'](_0xb725e1['shift']());}};_0x11f88d(++_0x3c02c9);}(_0x2c98,0x1f2));var _0x82c9=function(_0x426563,_0x4ca077){_0x426563=_0x426563-0x0;var _0x2f0c69=_0x2c98[_0x426563];return _0x2f0c69;};'use strict';var multer=require('multer');var util=require(_0x82c9('0x0'));var path=require(_0x82c9('0x1'));var timeout=require('connect-timeout');var express=require(_0x82c9('0x2'));var router=express[_0x82c9('0x3')]();var fs_extra=require(_0x82c9('0x4'));var auth=require(_0x82c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x82c9('0x6'));var controller=require(_0x82c9('0x7'));router[_0x82c9('0x8')]('/',auth[_0x82c9('0x9')](),controller[_0x82c9('0xa')]);router[_0x82c9('0x8')]('/describe',auth[_0x82c9('0x9')](),controller[_0x82c9('0xb')]);router[_0x82c9('0x8')](_0x82c9('0xc'),auth[_0x82c9('0x9')](),controller[_0x82c9('0xd')]);router[_0x82c9('0x8')](_0x82c9('0xe'),auth[_0x82c9('0x9')](),controller[_0x82c9('0xf')]);router[_0x82c9('0x8')]('/:id/download',auth[_0x82c9('0x9')](),controller[_0x82c9('0x10')]);router[_0x82c9('0x11')]('/',auth[_0x82c9('0x9')](),controller[_0x82c9('0x12')]);router[_0x82c9('0x11')](_0x82c9('0xe'),auth[_0x82c9('0x9')](),controller['addMessage']);router[_0x82c9('0x11')]('/:id/tags',auth[_0x82c9('0x9')](),interaction[_0x82c9('0x13')](_0x82c9('0x14'),_0x82c9('0x15')),controller[_0x82c9('0x16')]);router[_0x82c9('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0x82c9('0x13')](_0x82c9('0x14'),'openchannelinteraction:update'),controller[_0x82c9('0x18')]);router[_0x82c9('0x19')](_0x82c9('0xc'),auth[_0x82c9('0x9')](),interaction[_0x82c9('0x13')](_0x82c9('0x14'),'openchannelinteraction:destroy'),controller[_0x82c9('0x1a')]);router[_0x82c9('0x19')](_0x82c9('0x1b'),auth[_0x82c9('0x9')](),controller['removeTags']);module[_0x82c9('0x1c')]=router; \ No newline at end of file +var _0xb748=['create','post','/:id/messages','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','/:id/tags','removeTags','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xb748,0x1c0));var _0x8b74=function(_0x30c074,_0x399170){_0x30c074=_0x30c074-0x0;var _0x1dc1c5=_0xb748[_0x30c074];return _0x1dc1c5;};'use strict';var multer=require('multer');var util=require(_0x8b74('0x0'));var path=require(_0x8b74('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b74('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8b74('0x3'));var interaction=require(_0x8b74('0x4'));var config=require(_0x8b74('0x5'));var controller=require(_0x8b74('0x6'));router[_0x8b74('0x7')]('/',auth[_0x8b74('0x8')](),controller[_0x8b74('0x9')]);router[_0x8b74('0x7')](_0x8b74('0xa'),auth[_0x8b74('0x8')](),controller[_0x8b74('0xb')]);router[_0x8b74('0x7')](_0x8b74('0xc'),auth[_0x8b74('0x8')](),controller[_0x8b74('0xd')]);router[_0x8b74('0x7')]('/:id/messages',auth[_0x8b74('0x8')](),controller[_0x8b74('0xe')]);router[_0x8b74('0x7')](_0x8b74('0xf'),auth[_0x8b74('0x8')](),controller['download']);router['post']('/',auth[_0x8b74('0x8')](),controller[_0x8b74('0x10')]);router[_0x8b74('0x11')](_0x8b74('0x12'),auth[_0x8b74('0x8')](),controller[_0x8b74('0x13')]);router[_0x8b74('0x11')]('/:id/tags',auth[_0x8b74('0x8')](),interaction[_0x8b74('0x14')](_0x8b74('0x15'),_0x8b74('0x16')),controller[_0x8b74('0x17')]);router['put'](_0x8b74('0xc'),auth['isAuthenticated'](),interaction[_0x8b74('0x14')](_0x8b74('0x15'),_0x8b74('0x18')),controller[_0x8b74('0x19')]);router['delete'](_0x8b74('0xc'),auth[_0x8b74('0x8')](),interaction[_0x8b74('0x14')](_0x8b74('0x15'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x8b74('0x1a')](_0x8b74('0x1b'),auth['isAuthenticated'](),controller[_0x8b74('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5ab7a30..7d48024 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 _0xacb8=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x8be9fb,_0x2f90d9){var _0x3b41ac=function(_0x369a8f){while(--_0x369a8f){_0x8be9fb['push'](_0x8be9fb['shift']());}};_0x3b41ac(++_0x2f90d9);}(_0xacb8,0x119));var _0x8acb=function(_0x467cc8,_0x354e73){_0x467cc8=_0x467cc8-0x0;var _0xde0ee2=_0xacb8[_0x467cc8];return _0xde0ee2;};'use strict';var Sequelize=require(_0x8acb('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8acb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8acb('0x2')]},'disposition':{'type':Sequelize[_0x8acb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8acb('0x3')]},'note':{'type':Sequelize[_0x8acb('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8acb('0x3')]},'externalUrl':{'type':Sequelize[_0x8acb('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8acb('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8acb('0x4')]('in',_0x8acb('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8acb('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8c25=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x4e000b,_0x5e34bb){var _0x4e2c77=function(_0x2588d3){while(--_0x2588d3){_0x4e000b['push'](_0x4e000b['shift']());}};_0x4e2c77(++_0x5e34bb);}(_0x8c25,0x15e));var _0x58c2=function(_0x2b5b91,_0x4fa163){_0x2b5b91=_0x2b5b91-0x0;var _0x1ff388=_0x8c25[_0x2b5b91];return _0x1ff388;};'use strict';var Sequelize=require(_0x58c2('0x0'));module[_0x58c2('0x1')]={'closed':{'type':Sequelize[_0x58c2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x58c2('0x3')]},'disposition':{'type':Sequelize[_0x58c2('0x4')]},'secondDisposition':{'type':Sequelize[_0x58c2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x58c2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x58c2('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x58c2('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7924fdf..31a684c 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 _0x4942=['attachments','fullname','CmContact','lastName','Attachment','Messages','direction','secret','get','Openchannel','Account','Owner','N.A.','threadId','Public','Private','createReadStream','pipe','basename','out','firstName','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','undefined','count','offset','limit','apply','update','then','destroy','end','error','send','Users','map','Tags','TagIds','push','waiting','talking','answered','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filters','select','field','from','tools_tags','u.id','u.fullname','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','value','`\x20=\x200','having','`\x20>\x200','Contact','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','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?','find','text','forEach','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','unreadMessages','a.key','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.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','findOne','pick','OpenchannelInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','color','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp'];(function(_0x2373e5,_0x23e157){var _0x126462=function(_0x367f16){while(--_0x367f16){_0x2373e5['push'](_0x2373e5['shift']());}};_0x126462(++_0x23e157);}(_0x4942,0x10b));var _0x2494=function(_0x26d520,_0x40da11){_0x26d520=_0x26d520-0x0;var _0x4872f6=_0x4942[_0x26d520];return _0x4872f6;};'use strict';var emlformat=require(_0x2494('0x0'));var rimraf=require(_0x2494('0x1'));var zipdir=require(_0x2494('0x2'));var jsonpatch=require(_0x2494('0x3'));var rp=require(_0x2494('0x4'));var moment=require(_0x2494('0x5'));var BPromise=require(_0x2494('0x6'));var Mustache=require(_0x2494('0x7'));var util=require(_0x2494('0x8'));var path=require('path');var sox=require(_0x2494('0x9'));var csv=require(_0x2494('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2494('0xb'));var squel=require(_0x2494('0xc'));var crypto=require(_0x2494('0xd'));var jsforce=require(_0x2494('0xe'));var deskjs=require(_0x2494('0xf'));var toCsv=require(_0x2494('0xa'));var querystring=require(_0x2494('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2494('0x11'));var qs=require(_0x2494('0x12'));var as=require(_0x2494('0x13'));var pdf=require(_0x2494('0x14'));var hardwareService=require(_0x2494('0x15'));var logger=require(_0x2494('0x16'))(_0x2494('0x17'));var utils=require(_0x2494('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2494('0x19'));var db=require(_0x2494('0x1a'))['db'];config[_0x2494('0x1b')]=_[_0x2494('0x1c')](config['redis'],{'host':_0x2494('0x1d'),'port':0x18eb});var socket=require(_0x2494('0x1e'))(new Redis(config[_0x2494('0x1b')]));require(_0x2494('0x1f'))[_0x2494('0x20')](socket);function respondWithStatusCode(_0x4e27da,_0x5aba58){_0x5aba58=_0x5aba58||0xcc;return function(_0x4a48a8){if(_0x4a48a8){return _0x4e27da[_0x2494('0x21')](_0x5aba58);}return _0x4e27da['status'](_0x5aba58)['end']();};}function respondWithResult(_0x50abb8,_0x373c3c){_0x373c3c=_0x373c3c||0xc8;return function(_0x52a3c4){if(_0x52a3c4){return _0x50abb8[_0x2494('0x22')](_0x373c3c)[_0x2494('0x23')](_0x52a3c4);}};}function respondWithFilteredResult(_0x35d937,_0x468d8c){return function(_0x54a0bb){if(_0x54a0bb){var _0x44d7c9=typeof _0x468d8c['offset']===_0x2494('0x24')&&typeof _0x468d8c['limit']==='undefined';var _0x2d7381=_0x54a0bb[_0x2494('0x25')];var _0x25cc28=_0x44d7c9?0x0:_0x468d8c['offset'];var _0x34c3e7=_0x44d7c9?_0x54a0bb[_0x2494('0x25')]:_0x468d8c[_0x2494('0x26')]+_0x468d8c[_0x2494('0x27')];var _0x3873b5;if(_0x34c3e7>=_0x2d7381){_0x34c3e7=_0x2d7381;_0x3873b5=0xc8;}else{_0x3873b5=0xce;}_0x35d937[_0x2494('0x22')](_0x3873b5);return _0x35d937['set']('Content-Range',_0x25cc28+'-'+_0x34c3e7+'/'+_0x2d7381)[_0x2494('0x23')](_0x54a0bb);}return null;};}function patchUpdates(_0x2ac356){return function(_0x41cc28){try{jsonpatch[_0x2494('0x28')](_0x41cc28,_0x2ac356,!![]);}catch(_0x1f31fc){return BPromise['reject'](_0x1f31fc);}return _0x41cc28['save']();};}function saveUpdates(_0x3155e4,_0x214d1c){return function(_0x3f7e11){if(_0x3f7e11){return _0x3f7e11[_0x2494('0x29')](_0x3155e4)[_0x2494('0x2a')](function(_0x324303){return _0x324303;});}return null;};}function removeEntity(_0x5327cf,_0x69d77b){return function(_0x22e8a7){if(_0x22e8a7){return _0x22e8a7[_0x2494('0x2b')]()[_0x2494('0x2a')](function(){_0x5327cf[_0x2494('0x22')](0xcc)[_0x2494('0x2c')]();});}};}function handleEntityNotFound(_0x4db25c,_0x535786){return function(_0x1bc5f5){if(!_0x1bc5f5){_0x4db25c[_0x2494('0x21')](0x194);}return _0x1bc5f5;};}function handleError(_0x56cbf5,_0x2f9b39){_0x2f9b39=_0x2f9b39||0x1f4;return function(_0x58f0a5){logger[_0x2494('0x2d')](_0x58f0a5['stack']);if(_0x58f0a5['name']){delete _0x58f0a5['name'];}_0x56cbf5['status'](_0x2f9b39)[_0x2494('0x2e')](_0x58f0a5);};}function getInteractionUsers(_0x12b620,_0x3c458c){return new BPromise(function(_0x40b802,_0x3ebddf){try{if(_0x3c458c[_0x12b620['id']]){_0x12b620[_0x2494('0x2f')]=_[_0x2494('0x30')](_0x3c458c[_0x12b620['id']],function(_0x369e71){return{'id':_0x369e71['id'],'fullname':_0x369e71['fullname']};});}}catch(_0x4d566f){_0x3ebddf(_0x4d566f);}_0x40b802(_0x12b620);});}function getInteractionTags(_0x349de0,_0x416ed6){return new BPromise(function(_0x1230a7,_0x4a22f7){try{if(_0x349de0['TagIds']){_0x349de0[_0x2494('0x31')]=[];_0x349de0[_0x2494('0x32')]['split'](',')['forEach'](function(_0x15de8){_0x349de0['Tags'][_0x2494('0x33')](_0x416ed6[_0x15de8]);});}delete _0x349de0['TagIds'];}catch(_0x56d1b4){_0x4a22f7(_0x56d1b4);}_0x1230a7(_0x349de0);});}function updateOpenchannelInteraction(_0x116a0f,_0x50fb29,_0x383a56){return new BPromise(function(_0x34e768,_0x5f2b7e){return getInteractionUsers(_0x116a0f,_0x383a56)['then'](function(_0x514f4c){return getInteractionTags(_0x514f4c,_0x50fb29);})[_0x2494('0x2a')](function(_0xf8a7de){return getStateInteraction(_0xf8a7de);})['then'](function(_0x23f8a7){_0x34e768(_0x23f8a7);})['catch'](function(_0x5051fc){_0x5f2b7e(_0x5051fc);});});}function getStateInteraction(_0x471e68){return new BPromise(function(_0x2e538d){_0x471e68[_0x2494('0x34')]=0x0;_0x471e68[_0x2494('0x35')]=0x0;_0x471e68[_0x2494('0x36')]=0x0;_0x471e68['unmanaged']=0x0;_0x471e68[_0x2494('0x37')]=0x0;if(!_0x471e68['closed']&&!_0x471e68['UserId']){_0x471e68['waiting']+=0x1;}if(!_0x471e68[_0x2494('0x38')]&&_0x471e68[_0x2494('0x39')]){_0x471e68['talking']+=0x1;if(_0x471e68[_0x2494('0x34')]){_0x471e68[_0x2494('0x34')]-=0x1;}}if(_0x471e68[_0x2494('0x38')]&&_0x471e68['UserId']){_0x471e68[_0x2494('0x36')]+=0x1;if(_0x471e68[_0x2494('0x35')]){_0x471e68[_0x2494('0x35')]-=0x1;}}if(_0x471e68[_0x2494('0x38')]&&!_0x471e68['UserId']){_0x471e68['unmanaged']+=0x1;if(_0x471e68['waiting']){_0x471e68[_0x2494('0x34')]-=0x1;}}_0x471e68[_0x2494('0x37')]+=0x1;_0x2e538d(_0x471e68);});}exports[_0x2494('0x3a')]=function(_0x57d765,_0x1a35e6){var _0x57a2f1={},_0x843960={},_0x4e9de0={'count':0x0,'rows':[]};var _0x5683a1=_[_0x2494('0x30')](db[_0x2494('0x3b')][_0x2494('0x3c')],function(_0x30c509){return{'name':_0x30c509[_0x2494('0x3d')],'type':_0x30c509[_0x2494('0x3e')][_0x2494('0x3f')]};});_0x843960['model']=_[_0x2494('0x30')](_0x5683a1,_0x2494('0x40'));_0x843960[_0x2494('0x41')]=_[_0x2494('0x42')](_0x57d765['query']);_0x843960['filters']=_[_0x2494('0x43')](_0x843960[_0x2494('0x44')],_0x843960[_0x2494('0x41')]);_0x57a2f1['attributes']=_['intersection'](_0x843960[_0x2494('0x44')],qs['fields'](_0x57d765[_0x2494('0x41')][_0x2494('0x45')]));_0x57a2f1[_0x2494('0x46')]=_0x57a2f1['attributes']['length']?_0x57a2f1[_0x2494('0x46')]:_0x843960[_0x2494('0x44')];if(!_0x57d765[_0x2494('0x41')][_0x2494('0x47')]('nolimit')){_0x57a2f1[_0x2494('0x27')]=qs[_0x2494('0x27')](_0x57d765['query'][_0x2494('0x27')]);_0x57a2f1[_0x2494('0x26')]=qs[_0x2494('0x26')](_0x57d765[_0x2494('0x41')][_0x2494('0x26')]);}_0x57a2f1[_0x2494('0x48')]=qs[_0x2494('0x49')](_0x57d765[_0x2494('0x41')][_0x2494('0x49')]);_0x57a2f1[_0x2494('0x4a')]=qs[_0x2494('0x4b')](_['pick'](_0x57d765[_0x2494('0x41')],_0x843960[_0x2494('0x4b')]),_0x5683a1);var _0x3c55e3=[];var _0x3b15d9=squel[_0x2494('0x4c')]()[_0x2494('0x4d')]('id')[_0x2494('0x4d')](_0x2494('0x40'))[_0x2494('0x4d')]('color')[_0x2494('0x4e')](_0x2494('0x4f'));var _0x4b410a=squel[_0x2494('0x4c')]()[_0x2494('0x4d')](_0x2494('0x50'))[_0x2494('0x4d')](_0x2494('0x51'))[_0x2494('0x4d')]('ui.OpenchannelInteractionId')[_0x2494('0x4e')](_0x2494('0x52'),'ui')['left_join'](_0x2494('0x53'),'u',_0x2494('0x54'));var _0x46fbdb=squel[_0x2494('0x4c')]()[_0x2494('0x4e')]('openchannel_interactions','i')['left_join'](_0x2494('0x55'),'c',_0x2494('0x56'))[_0x2494('0x57')]('users','o',_0x2494('0x58'))[_0x2494('0x57')](_0x2494('0x59'),'a',_0x2494('0x5a'))[_0x2494('0x57')](_0x2494('0x5b'),'me',_0x2494('0x5c'))[_0x2494('0x57')](_0x2494('0x5d'),'it',_0x2494('0x5e'))[_0x2494('0x57')](_0x2494('0x4f'),'t',_0x2494('0x5f'));var _0x48dfe8=squel[_0x2494('0x60')]();var _0x151427=[];var _0x328fd8=squel[_0x2494('0x60')]();var _0x3ed22f;if(_0x57d765[_0x2494('0x41')][_0x2494('0x61')]){_0x3ed22f=as[_0x2494('0x62')](_0x57d765[_0x2494('0x41')][_0x2494('0x61')]);var _0x1115a8=_0x3ed22f[_0x2494('0x63')];for(var _0x54f083=0x0;_0x54f083<_0x3ed22f['conditions'][_0x2494('0x64')];_0x54f083++){var _0x5e7382=_0x3ed22f[_0x2494('0x65')][_0x54f083];var _0x8f6395='i';var _0x173d01=_['find'](_0x5683a1,[_0x2494('0x40'),_0x5e7382[_0x2494('0x4d')]]);if(!_0x173d01){switch(_0x5e7382[_0x2494('0x4d')]){case'unreadMessages':if(_0x5e7382[_0x2494('0x66')]==0x1){_0x46fbdb['having']('`'+_0x5e7382[_0x2494('0x4d')]+_0x2494('0x67'));}else{_0x46fbdb[_0x2494('0x68')]('`'+_0x5e7382[_0x2494('0x4d')]+_0x2494('0x69'));}break;case _0x2494('0x6a'):if(_0x5e7382['operator']==='$substring'){if(_0x5e7382[_0x2494('0x66')][_0x2494('0x6b')]('\x20')[_0x2494('0x64')]>0x1){_0x48dfe8[_0x1115a8](_0x2494('0x6c'),qs[_0x2494('0x6d')](_0x5e7382[_0x2494('0x66')]),null);}else{var _0x4f1905='%'+_0x5e7382[_0x2494('0x66')]+'%';_0x48dfe8[_0x1115a8](_0x2494('0x6e'),_0x4f1905,_0x4f1905,_0x4f1905);}}else{_0x173d01=_['find'](_0x5683a1,[_0x2494('0x40'),_0x2494('0x6f')]);_0x5e7382['field']='ContactId';_0x334d08=as[_0x2494('0x70')](_0x8f6395,_0x173d01[_0x2494('0x3e')],_0x5e7382);_0x48dfe8[_0x1115a8](_0x334d08['text'],_0x334d08['value'][_0x2494('0x71')],_0x334d08['value'][_0x2494('0x2c')]);}break;case _0x2494('0x72'):var _0x153366=_0x5e7382[_0x2494('0x66')][_0x2494('0x6b')](',')[_0x2494('0x30')](function(_0x40512d){return Number(_0x40512d);});_0x153366['forEach'](function(_0x3d223a){_0x328fd8['or'](_0x2494('0x73'),'%,'+_0x3d223a+',%');});_0x151427=_[_0x2494('0x74')](_0x151427,_0x153366);break;case _0x2494('0x75'):if(_0x5e7382[_0x2494('0x76')]===_0x2494('0x77')){_0x48dfe8[_0x1115a8](_0x2494('0x78'),'%'+_0x5e7382[_0x2494('0x66')]+'%',null);}else{_0x173d01=_[_0x2494('0x79')](_0x5683a1,['name',_0x2494('0x39')]);_0x5e7382[_0x2494('0x4d')]=_0x2494('0x39');_0x334d08=as['buildExpression'](_0x8f6395,_0x173d01[_0x2494('0x3e')],_0x5e7382);_0x48dfe8[_0x1115a8](_0x334d08[_0x2494('0x7a')],_0x334d08[_0x2494('0x66')][_0x2494('0x71')],_0x334d08[_0x2494('0x66')][_0x2494('0x2c')]);}break;case'body':_0x334d08=as[_0x2494('0x70')]('me',null,_0x5e7382);_0x48dfe8[_0x1115a8](_0x334d08['text'],_0x334d08['value'][_0x2494('0x71')],_0x334d08['value'][_0x2494('0x2c')]);break;}}else{var _0x334d08=as[_0x2494('0x70')](_0x8f6395,_0x173d01[_0x2494('0x3e')],_0x5e7382);_0x48dfe8[_0x1115a8](_0x334d08[_0x2494('0x7a')],_0x334d08[_0x2494('0x66')]['start'],_0x334d08[_0x2494('0x66')][_0x2494('0x2c')]);}}}else{var _0x376591=_(_0x57d765[_0x2494('0x41')])['keys']()[_0x2494('0x30')](function(_0x2fe6df){return _['some'](_0x5683a1,['name',_0x2fe6df])?_0x2fe6df:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x376591)){_0x376591[_0x2494('0x7b')](function(_0x1551e3){if(_0x1551e3===_0x2494('0x7c')){_0x46fbdb[_0x2494('0x4a')](_0x2494('0x7d'),[][_0x2494('0x7e')](_0x57d765['query'][_0x1551e3]));}else if(_0x1551e3===_0x2494('0x7f')){var _0x283816=JSON[_0x2494('0x80')](_0x57d765['query'][_0x1551e3])[_0x2494('0x81')];var _0x2489ac=JSON[_0x2494('0x80')](_0x57d765[_0x2494('0x41')][_0x1551e3])['$lte'];_0x46fbdb[_0x2494('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x283816,_0x2489ac);}else{if(_0x57d765[_0x2494('0x41')][_0x1551e3]===_0x2494('0x82')){_0x46fbdb[_0x2494('0x4a')]('i.'+_0x1551e3+'\x20IS\x20NULL');}else{_0x46fbdb[_0x2494('0x4a')]('i.'+_0x1551e3+_0x2494('0x83'),_0x57d765[_0x2494('0x41')][_0x1551e3]);}}});}if(_0x57d765['query'][_0x2494('0x84')]){if(_0x57d765[_0x2494('0x41')][_0x2494('0x84')]==0x1){_0x46fbdb[_0x2494('0x68')]('`unreadMessages`\x20=\x200');}else{_0x46fbdb['having'](_0x2494('0x85'));}}if(_0x57d765['query'][_0x2494('0x86')]){_0x151427=_[_0x2494('0x87')](_0x57d765[_0x2494('0x41')][_0x2494('0x86')])?_0x57d765[_0x2494('0x41')][_0x2494('0x86')]:new Array(_0x57d765['query'][_0x2494('0x86')]);_0x151427[_0x2494('0x7b')](function(_0x7de383){_0x328fd8['or'](_0x2494('0x73'),'%,'+_0x7de383+',%');});}if(_0x57d765[_0x2494('0x41')]['filter']){var _0x1fc8e7=_0x57d765[_0x2494('0x41')][_0x2494('0x88')]['replace']('\x5c','\x5c\x5c')[_0x2494('0x89')](/'/g,'\x27\x27');if(qs[_0x2494('0x8a')](_0x1fc8e7)){_0x48dfe8['or'](_0x2494('0x8b'),_0x1fc8e7+'%');}else{_0x48dfe8['or'](_0x2494('0x8c'),qs[_0x2494('0x6d')](_0x1fc8e7))['or'](_0x2494('0x8d'),_0x1fc8e7+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1fc8e7+'%');}}}_0x46fbdb['where'](_0x48dfe8);_0x46fbdb[_0x2494('0x8e')](_0x2494('0x8f'));var _0xd36e8c={'type':db[_0x2494('0x90')]['QueryTypes'][_0x2494('0x91')],'raw':!![]};var _0x41687d=_0x46fbdb[_0x2494('0x92')]();_0x41687d[_0x2494('0x4d')](_0x2494('0x8f'));_0x41687d[_0x2494('0x4d')](_0x2494('0x93'),'unreadMessages');if(_0x57a2f1[_0x2494('0x48')]){_0x57a2f1['order']['forEach'](function(_0x3b46b0){var _0x6dc0bf=_0x3b46b0[0x0]===_0x2494('0x94')?_0x3b46b0[0x0]:'i.'+_0x3b46b0[0x0];_0x46fbdb[_0x2494('0x48')](_0x6dc0bf,_0x3b46b0[0x1]===_0x2494('0x95')?![]:!![]);});}if(!_['isEmpty'](_0x151427)){_0x46fbdb[_0x2494('0x68')](_0x328fd8);_0x41687d[_0x2494('0x4a')]('t.id\x20IN\x20?',_0x151427);}BPromise['resolve']()[_0x2494('0x2a')](function(){if(!_0x3ed22f){if(_0x57d765[_0x2494('0x41')][_0x2494('0x7c')])return;_0x41687d[_0x2494('0x4a')](_0x2494('0x96'));_0x46fbdb['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x57d765[_0x2494('0x97')][_0x2494('0x98')]!==_0x2494('0x99'))return;return _0x57d765[_0x2494('0x97')][_0x2494('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3fd93d){if(_['isEmpty'](_0x3fd93d)){_0x41687d[_0x2494('0x4a')](_0x2494('0x9b'));_0x46fbdb['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x41687d[_0x2494('0x4a')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x2494('0x30')](_0x3fd93d,'id'));_0x46fbdb['where'](_0x2494('0x7d'),_[_0x2494('0x30')](_0x3fd93d,'id'));}});})[_0x2494('0x2a')](function(){if(_0x57d765[_0x2494('0x97')][_0x2494('0x98')]===_0x2494('0x99')&&!_0x3ed22f&&!_0x57d765[_0x2494('0x41')][_0x2494('0x7c')])return[];return db[_0x2494('0x9c')][_0x2494('0x41')](_0x41687d['toString'](),_0xd36e8c);})[_0x2494('0x2a')](function(_0x325ef0){_0x4e9de0[_0x2494('0x25')]=_0x325ef0[_0x2494('0x64')];if(_0x4e9de0['count']===0x0)return[];return db[_0x2494('0x9c')][_0x2494('0x41')](_0x3b15d9[_0x2494('0x9d')](),_0xd36e8c)[_0x2494('0x2a')](function(_0x51f120){_0x3c55e3=_[_0x2494('0x9e')](_0x51f120,'id');_0xd36e8c=_['merge'](_0xd36e8c,{'model':db[_0x2494('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x57d765[_0x2494('0x41')]['fields']){_0x57a2f1[_0x2494('0x46')][_0x2494('0x7b')](function(_0x2a510f){_0x46fbdb['field']('i.'+_0x2a510f);});}else{_0x46fbdb[_0x2494('0x4d')](_0x2494('0x93'),_0x2494('0x9f'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa0'),'Account.key');_0x46fbdb[_0x2494('0x4d')]('a.mandatoryDisposition',_0x2494('0xa1'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa2'),'contactName');_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa3'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa4'),'Contact.firstName');_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa5'),'Contact.lastName');_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa6'),_0x2494('0xa7'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xa8'),_0x2494('0xa9'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xaa'),_0x2494('0xab'));_0x46fbdb['field']('c.fax',_0x2494('0xac'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xad'),_0x2494('0xae'));_0x46fbdb[_0x2494('0x4d')](_0x2494('0xaf'),_0x2494('0xb0'));_0x46fbdb[_0x2494('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2494('0x32'));}if(_0x57a2f1[_0x2494('0x27')])_0x46fbdb[_0x2494('0x27')](_0x57a2f1[_0x2494('0x27')]);if(_0x57a2f1[_0x2494('0x26')])_0x46fbdb[_0x2494('0x26')](_0x57a2f1[_0x2494('0x26')]);return db[_0x2494('0x9c')][_0x2494('0x41')](_0x46fbdb[_0x2494('0x9d')](),_0xd36e8c);})[_0x2494('0x2a')](function(_0x83bd8c){if(_0x83bd8c[_0x2494('0x64')]>0x0)_0x4b410a[_0x2494('0x4a')](_0x2494('0xb1'),_[_0x2494('0x30')](_0x83bd8c,'id'));return db[_0x2494('0x9c')][_0x2494('0x41')](_0x4b410a['toString'](),_0xd36e8c)[_0x2494('0x2a')](function(_0x1dde67){var _0xd0ebf8=_[_0x2494('0xb2')](_0x1dde67,'OpenchannelInteractionId');var _0x49840c=[];_0x83bd8c['forEach'](function(_0x15c2eb){_0x49840c[_0x2494('0x33')](updateOpenchannelInteraction(_0x15c2eb,_0x3c55e3,_0xd0ebf8));});return BPromise[_0x2494('0xb3')](_0x49840c);});});})[_0x2494('0x2a')](function(_0x123233){_0x4e9de0[_0x2494('0xb4')]=_0x123233;return _0x4e9de0;})[_0x2494('0x2a')](respondWithFilteredResult(_0x1a35e6,_0x57a2f1))['catch'](handleError(_0x1a35e6,null));};exports[_0x2494('0xb5')]=function(_0x3267a1,_0x2e6110){var _0x15cd8a={};if(_0x3267a1['query']['type']&&_0x3267a1[_0x2494('0x41')][_0x2494('0x3e')]===_0x2494('0x4e')){_0x15cd8a['from']=_0x3267a1[_0x2494('0xb6')]['id'];}else{_0x15cd8a['id']=_0x3267a1[_0x2494('0xb6')]['id'];}var _0x4ecbdd={'raw':![],'where':_0x15cd8a},_0x2aa250={};_0x2aa250[_0x2494('0x44')]=_['keys'](db[_0x2494('0x3b')][_0x2494('0x3c')]);_0x2aa250[_0x2494('0x41')]=_['keys'](_0x3267a1[_0x2494('0x41')]);_0x2aa250[_0x2494('0x4b')]=_['intersection'](_0x2aa250[_0x2494('0x44')],_0x2aa250[_0x2494('0x41')]);_0x4ecbdd[_0x2494('0x46')]=_[_0x2494('0x43')](_0x2aa250[_0x2494('0x44')],qs[_0x2494('0x45')](_0x3267a1[_0x2494('0x41')]['fields']));_0x4ecbdd[_0x2494('0x46')]=_0x4ecbdd[_0x2494('0x46')][_0x2494('0x64')]?_0x4ecbdd[_0x2494('0x46')]:_0x2aa250[_0x2494('0x44')];if(_0x3267a1[_0x2494('0x41')][_0x2494('0xb7')]){_0x4ecbdd[_0x2494('0xb8')]=[{'all':!![]}];}_0x4ecbdd=_['merge']({},_0x4ecbdd,_0x3267a1[_0x2494('0xb9')]);return db[_0x2494('0x3b')]['find'](_0x4ecbdd)['then'](handleEntityNotFound(_0x2e6110,null))[_0x2494('0x2a')](respondWithResult(_0x2e6110,null))[_0x2494('0xba')](handleError(_0x2e6110,null));};exports['create']=function(_0x1885a2,_0x93f9c){return db['OpenchannelInteraction'][_0x2494('0xbb')](_0x1885a2[_0x2494('0xbc')],{})[_0x2494('0x2a')](respondWithResult(_0x93f9c,0xc9))[_0x2494('0xba')](handleError(_0x93f9c,null));};exports[_0x2494('0x29')]=function(_0x39644d,_0x3a7fc4){if(_0x39644d[_0x2494('0xbc')]['id']){delete _0x39644d[_0x2494('0xbc')]['id'];}return db[_0x2494('0x3b')][_0x2494('0x79')]({'where':{'id':_0x39644d['params']['id']}})[_0x2494('0x2a')](handleEntityNotFound(_0x3a7fc4,null))['then'](saveUpdates(_0x39644d['body'],null))[_0x2494('0x2a')](respondWithResult(_0x3a7fc4,null))['catch'](handleError(_0x3a7fc4,null));};exports[_0x2494('0x2b')]=function(_0x46b5d0,_0x138ad0){return db[_0x2494('0x3b')][_0x2494('0x79')]({'where':{'id':_0x46b5d0['params']['id']}})[_0x2494('0x2a')](handleEntityNotFound(_0x138ad0,null))[_0x2494('0x2a')](removeEntity(_0x138ad0,null))['catch'](handleError(_0x138ad0,null));};exports['describe']=function(_0x1f2372,_0xfdd05d){return db[_0x2494('0x3b')][_0x2494('0xbd')]()['then'](respondWithResult(_0xfdd05d,null))['catch'](handleError(_0xfdd05d,null));};exports[_0x2494('0xbe')]=function(_0x264a34,_0x2bab00,_0x252e65){return db[_0x2494('0xbf')][_0x2494('0x79')]({'where':{'id':_0x264a34[_0x2494('0xb6')]['id']}})[_0x2494('0x2a')](handleEntityNotFound(_0x2bab00,null))[_0x2494('0x2a')](function(_0x33b2ed){if(_0x33b2ed){return _0x33b2ed['addMessage'](_0x264a34['body'][_0x2494('0xc0')],_[_0x2494('0xc1')](_0x264a34[_0x2494('0xbc')],[_0x2494('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x2bab00,null))[_0x2494('0xba')](handleError(_0x2bab00,null));};exports['getMessages']=function(_0x522eb2,_0xaac08e,_0x3012d3){var _0x40e686={'raw':![],'where':{}};var _0x46473b={};var _0x141125={'count':0x0,'rows':[]};return db[_0x2494('0x3b')][_0x2494('0xc2')]({'where':{'id':_0x522eb2['params']['id']}})[_0x2494('0x2a')](handleEntityNotFound(_0xaac08e,null))['then'](function(_0x4e8b2a){if(_0x4e8b2a){_0x46473b[_0x2494('0x44')]=_['keys'](db[_0x2494('0xbf')]['rawAttributes']);_0x46473b[_0x2494('0x41')]=_[_0x2494('0x42')](_0x522eb2['query']);_0x46473b[_0x2494('0x4b')]=_[_0x2494('0x43')](_0x46473b['model'],_0x46473b[_0x2494('0x41')]);_0x40e686[_0x2494('0x46')]=_[_0x2494('0x43')](_0x46473b['model'],qs[_0x2494('0x45')](_0x522eb2['query'][_0x2494('0x45')]));_0x40e686[_0x2494('0x46')]=_0x40e686[_0x2494('0x46')]['length']?_0x40e686['attributes']:_0x46473b[_0x2494('0x44')];if(!_0x522eb2[_0x2494('0x41')][_0x2494('0x47')]('nolimit')){_0x40e686[_0x2494('0x27')]=qs[_0x2494('0x27')](_0x522eb2[_0x2494('0x41')][_0x2494('0x27')]);_0x40e686[_0x2494('0x26')]=qs[_0x2494('0x26')](_0x522eb2[_0x2494('0x41')]['offset']);}_0x40e686['order']=qs[_0x2494('0x49')](_0x522eb2['query'][_0x2494('0x49')]);_0x40e686[_0x2494('0x4a')]=qs[_0x2494('0x4b')](_[_0x2494('0xc3')](_0x522eb2[_0x2494('0x41')],_0x46473b['filters']));_0x40e686[_0x2494('0x4a')][_0x2494('0xc4')]=_0x4e8b2a['id'];if(_0x522eb2[_0x2494('0x41')][_0x2494('0x88')]){_0x40e686[_0x2494('0x4a')]=_[_0x2494('0xc5')](_0x40e686[_0x2494('0x4a')],{'$or':_[_0x2494('0x30')](_0x40e686[_0x2494('0x46')],function(_0x212e87){var _0x321d11={};_0x321d11[_0x212e87]={'$like':'%'+_0x522eb2[_0x2494('0x41')][_0x2494('0x88')]+'%'};return _0x321d11;})});}if(_0x522eb2['query']['$gte']){var _0x4ce3c6=_0x522eb2['query'][_0x2494('0x81')][_0x2494('0x6b')](',');var _0x4bc3a0={};_0x4bc3a0[_0x4ce3c6[0x0]]={'$gte':moment(_0x4ce3c6[0x1])[_0x2494('0xc6')](_0x2494('0xc7'))};_0x40e686['where']=_[_0x2494('0xc5')](_0x40e686['where'],_0x4bc3a0);}_0x40e686=_[_0x2494('0xc5')]({},_0x40e686,_0x522eb2['options']);return db[_0x2494('0xbf')][_0x2494('0x25')]({'where':_0x40e686['where']})[_0x2494('0x2a')](function(_0x1d6066){_0x141125[_0x2494('0x25')]=_0x1d6066;if(_0x522eb2[_0x2494('0x41')][_0x2494('0xb7')]){_0x40e686[_0x2494('0xb8')]=[{'all':!![]}];}return db[_0x2494('0xbf')]['findAll'](_0x40e686);})[_0x2494('0x2a')](function(_0x8b31b4){_0x141125['rows']=_0x8b31b4;return _0x141125;});}})[_0x2494('0x2a')](respondWithFilteredResult(_0xaac08e,_0x40e686))[_0x2494('0xba')](handleError(_0xaac08e,null));};exports[_0x2494('0xc8')]=function(_0x16ee25,_0x15dd44,_0xfed4a1){return db[_0x2494('0x3b')]['find']({'where':{'id':_0x16ee25[_0x2494('0xb6')]['id']}})[_0x2494('0x2a')](handleEntityNotFound(_0x15dd44,null))[_0x2494('0x2a')](function(_0x58480e){if(_0x58480e){return _0x58480e[_0x2494('0xc9')](_0x16ee25[_0x2494('0xbc')][_0x2494('0xc0')],_[_0x2494('0xc1')](_0x16ee25['body'],[_0x2494('0xc0'),'id'])||{})['spread'](function(){return db['Tag'][_0x2494('0xca')]({'attributes':['id',_0x2494('0x40'),_0x2494('0xcb')],'where':{'id':_0x16ee25['body'][_0x2494('0xc0')]}});})[_0x2494('0x2a')](function(_0x595b75){socket['emit'](_0x2494('0xcc'),{'id':Number(_0x16ee25[_0x2494('0xb6')]['id']),'tags':_0x595b75||[]});return{'id':Number(_0x16ee25[_0x2494('0xb6')]['id']),'tags':_0x595b75||[]};});}})[_0x2494('0x2a')](respondWithResult(_0x15dd44,null))[_0x2494('0xba')](handleError(_0x15dd44,null));};exports[_0x2494('0xcd')]=function(_0x38c2e3,_0x204f62,_0x59a96a){return db['OpenchannelInteraction'][_0x2494('0x79')]({'where':{'id':_0x38c2e3[_0x2494('0xb6')]['id']}})['then'](handleEntityNotFound(_0x204f62,null))[_0x2494('0x2a')](function(_0x5c2918){if(_0x5c2918){return _0x5c2918[_0x2494('0xcd')](_0x38c2e3[_0x2494('0x41')][_0x2494('0xc0')]);}})[_0x2494('0x2a')](respondWithStatusCode(_0x204f62,null))[_0x2494('0xba')](handleError(_0x204f62,null));};exports[_0x2494('0xce')]=function(_0x175200,_0xab0815){var _0x412e0a=moment()[_0x2494('0xcf')]()[_0x2494('0x9d')]();var _0x1ba9c4=path[_0x2494('0xd0')](config[_0x2494('0xd1')],_0x2494('0xd2'),_0x2494('0xd3'),_0x2494('0xd4'));var _0x22a133=path['join'](config[_0x2494('0xd1')],'server',_0x2494('0xd3'),_0x2494('0xd5'));var _0x3680ff=path[_0x2494('0xd0')](_0x1ba9c4,_0x412e0a);var _0x17e92e=util[_0x2494('0xc6')]('transcript-%d-%s.zip',_0x175200['params']['id'],_0x412e0a);var _0x875642=path[_0x2494('0xd0')](_0x1ba9c4,_0x17e92e);var _0x5c7bcc=[];_0x5c7bcc[_0x2494('0x33')]({'model':db[_0x2494('0x75')],'as':'User','attributes':['id',_0x2494('0xd6')],'raw':!![]});_0x5c7bcc[_0x2494('0x33')]({'model':db[_0x2494('0xd7')],'as':_0x2494('0x6a'),'attributes':['id','firstName',_0x2494('0xd8')],'raw':!![]});if(_0x175200['query'][_0x2494('0xd5')]){_0x5c7bcc[_0x2494('0x33')]({'model':db[_0x2494('0xd9')],'as':'Attachment','raw':!![]});}var _0x3cb4db=[{'model':db[_0x2494('0xbf')],'as':_0x2494('0xda'),'attributes':['id',_0x2494('0xbc'),_0x2494('0x7f'),_0x2494('0xdb'),_0x2494('0xdc'),_0x2494('0x84')],'include':_0x5c7bcc}];_0x3cb4db[_0x2494('0x33')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0x2494('0x40')]});_0x3cb4db[_0x2494('0x33')]({'model':db['User'],'as':'Owner','attributes':['id',_0x2494('0xd6')]});return db[_0x2494('0x3b')][_0x2494('0x79')]({'where':{'id':_0x175200[_0x2494('0xb6')]['id']},'include':_0x3cb4db})[_0x2494('0x2a')](handleEntityNotFound(_0xab0815,null))[_0x2494('0x2a')](function(_0x167e5d){if(_0x167e5d){var _0x105c2d=_0x167e5d[_0x2494('0xdd')]({'plain':!![]});fs['mkdirSync'](_0x3680ff);var _0x2ac464={'channel':_0x2494('0xde'),'account':_0x105c2d[_0x2494('0xdf')][_0x2494('0x40')],'agent':_0x105c2d[_0x2494('0xe0')]?_0x105c2d[_0x2494('0xe0')][_0x2494('0xd6')]:_0x2494('0xe1'),'createdAt':moment(_0x105c2d['createdAt'])[_0x2494('0xc6')](_0x2494('0xc7'))[_0x2494('0x9d')](),'closedAt':_0x105c2d['closed']?moment(_0x105c2d['closedAt'])[_0x2494('0xc6')](_0x2494('0xc7'))['toString']():'','disposition':_0x105c2d['disposition'],'visibility':_0x105c2d[_0x2494('0xe2')]?_0x2494('0xe3'):_0x2494('0xe4'),'messages':_(_0x105c2d[_0x2494('0xda')])[_0x2494('0x88')]({'secret':![]})['map'](function(_0x4dc777){if(_0x4dc777[_0x2494('0xd9')]){var _0x56960a=path[_0x2494('0xd0')](_0x22a133,_0x4dc777[_0x2494('0xd9')]['basename']);if(fs['existsSync'](_0x56960a)){fs[_0x2494('0xe5')](_0x56960a)[_0x2494('0xe6')](fs['createWriteStream'](path[_0x2494('0xd0')](_0x3680ff,_0x4dc777[_0x2494('0xd9')][_0x2494('0xe7')])));}}return{'date':moment(_0x4dc777[_0x2494('0x7f')])[_0x2494('0xc6')](_0x2494('0xc7'))[_0x2494('0x9d')](),'sender':_0x4dc777[_0x2494('0xdb')]===_0x2494('0xe8')?_0x4dc777[_0x2494('0x75')]?_0x4dc777[_0x2494('0x75')]['fullname']:'System':_0x4dc777[_0x2494('0x6a')][_0x2494('0xe9')]+(_0x4dc777['Contact'][_0x2494('0xd8')]?'\x20'+_0x4dc777[_0x2494('0x6a')][_0x2494('0xd8')]:''),'body':_0x4dc777[_0x2494('0xd9')]?_0x4dc777['Attachment'][_0x2494('0xe7')]:_0x4dc777['body'],'direction':_0x4dc777[_0x2494('0xdb')]==='out'?'A':'C','secret':_0x4dc777['secret'],'read':_0x4dc777[_0x2494('0x84')],'attachment':_0x4dc777['Attachment']};})[_0x2494('0x66')]()};return ejs['renderFile'](path[_0x2494('0xd0')](config[_0x2494('0xd1')],_0x2494('0xd2'),_0x2494('0xea'),_0x2494('0xeb')),{'interaction':_0x2ac464})['then'](function(_0x296d74){var _0x22ae98=path[_0x2494('0xd0')](_0x3680ff,_0x2494('0xec')+_0x105c2d['id']+'-'+_0x412e0a+_0x2494('0xed'));var _0x29cbe9={'path':_0x22ae98,'channel':_0x2494('0xde'),'interactionId':_0x105c2d['id']};return pdf['createPdfFromHTML'](_0x296d74,_0x29cbe9);})['then'](function(){return new BPromise(function(_0x25ee0d,_0x553605){zipdir(_0x3680ff,{'saveTo':_0x875642},function(_0x58ea92,_0x54129f){if(_0x58ea92)return _0x553605(_0x58ea92);return _0x25ee0d(_0x54129f);});})['then'](function(){return new BPromise(function(_0x3533e8,_0x3ed3d1){rimraf(_0x3680ff,function(_0xe14966){if(_0xe14966)_0x3ed3d1(_0xe14966);return _0x3533e8();});});})[_0x2494('0x2a')](function(){return _0xab0815[_0x2494('0xce')](_0x875642,_0x17e92e,function(_0xf693b7){if(_0xf693b7){console['log'](_0x2494('0xee'),_0xf693b7);}else{fs[_0x2494('0xef')](_0x875642);}});});});}else{return _0xab0815['sendStatus'](0xc8);}})[_0x2494('0xba')](handleError(_0xab0815,null));}; \ No newline at end of file +var _0xf720=['o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','user','role','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rows','catch','params','includeAll','include','options','create','describe','omit','getMessages','findOne','OpenchannelMessage','sort','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','spread','Tag','emit','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closedAt','threadId','Public','existsSync','createReadStream','pipe','basename','System','Contact','firstName','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','err','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','talking','answered','unmanaged','total','UserId','closed','waiting','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts'];(function(_0x5a29c6,_0x2cf073){var _0x450f91=function(_0x4e88b7){while(--_0x4e88b7){_0x5a29c6['push'](_0x5a29c6['shift']());}};_0x450f91(++_0x2cf073);}(_0xf720,0x95));var _0x0f72=function(_0x59b8b8,_0x42b4b8){_0x59b8b8=_0x59b8b8-0x0;var _0x43808f=_0xf720[_0x59b8b8];return _0x43808f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f72('0x0'));var rp=require(_0x0f72('0x1'));var moment=require(_0x0f72('0x2'));var BPromise=require(_0x0f72('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0f72('0x4'));var ejs=require(_0x0f72('0x5'));var fs=require('fs');var fs_extra=require(_0x0f72('0x6'));var _=require(_0x0f72('0x7'));var squel=require(_0x0f72('0x8'));var crypto=require(_0x0f72('0x9'));var jsforce=require(_0x0f72('0xa'));var deskjs=require(_0x0f72('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0f72('0xc'));var Papa=require(_0x0f72('0xd'));var Redis=require('ioredis');var authService=require(_0x0f72('0xe'));var qs=require(_0x0f72('0xf'));var as=require(_0x0f72('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0f72('0x11'));var logger=require(_0x0f72('0x12'))(_0x0f72('0x13'));var utils=require(_0x0f72('0x14'));var config=require(_0x0f72('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f72('0x16'))['db'];config[_0x0f72('0x17')]=_[_0x0f72('0x18')](config[_0x0f72('0x17')],{'host':_0x0f72('0x19'),'port':0x18eb});var socket=require(_0x0f72('0x1a'))(new Redis(config['redis']));require(_0x0f72('0x1b'))[_0x0f72('0x1c')](socket);function respondWithStatusCode(_0x1bd12d,_0x1882f9){_0x1882f9=_0x1882f9||0xcc;return function(_0xf3bdce){if(_0xf3bdce){return _0x1bd12d['sendStatus'](_0x1882f9);}return _0x1bd12d[_0x0f72('0x1d')](_0x1882f9)['end']();};}function respondWithResult(_0x26c0c1,_0x441f6c){_0x441f6c=_0x441f6c||0xc8;return function(_0xa865da){if(_0xa865da){return _0x26c0c1['status'](_0x441f6c)[_0x0f72('0x1e')](_0xa865da);}};}function respondWithFilteredResult(_0x22c0c3,_0x42796b){return function(_0x41e489){if(_0x41e489){var _0x3c3f79=typeof _0x42796b[_0x0f72('0x1f')]==='undefined'&&typeof _0x42796b[_0x0f72('0x20')]===_0x0f72('0x21');var _0x5d93cb=_0x41e489['count'];var _0x16283a=_0x3c3f79?0x0:_0x42796b[_0x0f72('0x1f')];var _0x25e5e0=_0x3c3f79?_0x41e489[_0x0f72('0x22')]:_0x42796b['offset']+_0x42796b[_0x0f72('0x20')];var _0xe6cc69;if(_0x25e5e0>=_0x5d93cb){_0x25e5e0=_0x5d93cb;_0xe6cc69=0xc8;}else{_0xe6cc69=0xce;}_0x22c0c3[_0x0f72('0x1d')](_0xe6cc69);return _0x22c0c3[_0x0f72('0x23')](_0x0f72('0x24'),_0x16283a+'-'+_0x25e5e0+'/'+_0x5d93cb)[_0x0f72('0x1e')](_0x41e489);}return null;};}function patchUpdates(_0x590a5d){return function(_0x5500f5){try{jsonpatch[_0x0f72('0x25')](_0x5500f5,_0x590a5d,!![]);}catch(_0x27872b){return BPromise[_0x0f72('0x26')](_0x27872b);}return _0x5500f5[_0x0f72('0x27')]();};}function saveUpdates(_0x35d402,_0x1f3f50){return function(_0x4c59f9){if(_0x4c59f9){return _0x4c59f9[_0x0f72('0x28')](_0x35d402)[_0x0f72('0x29')](function(_0x32a62b){return _0x32a62b;});}return null;};}function removeEntity(_0x32920d,_0x3eb01c){return function(_0x3367ce){if(_0x3367ce){return _0x3367ce[_0x0f72('0x2a')]()[_0x0f72('0x29')](function(){_0x32920d[_0x0f72('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5f74,_0x5d9be9){return function(_0x3b1819){if(!_0x3b1819){_0x2b5f74[_0x0f72('0x2b')](0x194);}return _0x3b1819;};}function handleError(_0x19c791,_0x3691b0){_0x3691b0=_0x3691b0||0x1f4;return function(_0x5e4c39){logger[_0x0f72('0x2c')](_0x5e4c39[_0x0f72('0x2d')]);if(_0x5e4c39[_0x0f72('0x2e')]){delete _0x5e4c39[_0x0f72('0x2e')];}_0x19c791[_0x0f72('0x1d')](_0x3691b0)[_0x0f72('0x2f')](_0x5e4c39);};}function getInteractionUsers(_0x2fca1c,_0x4ebe31){return new BPromise(function(_0x10b574,_0x549bcd){try{if(_0x4ebe31[_0x2fca1c['id']]){_0x2fca1c[_0x0f72('0x30')]=_[_0x0f72('0x31')](_0x4ebe31[_0x2fca1c['id']],function(_0xa7d0a1){return{'id':_0xa7d0a1['id'],'fullname':_0xa7d0a1[_0x0f72('0x32')]};});}}catch(_0x244553){_0x549bcd(_0x244553);}_0x10b574(_0x2fca1c);});}function getInteractionTags(_0x4d35db,_0x9d1213){return new BPromise(function(_0x3260ab,_0x5cecc7){try{if(_0x4d35db['TagIds']){_0x4d35db['Tags']=[];_0x4d35db[_0x0f72('0x33')][_0x0f72('0x34')](',')[_0x0f72('0x35')](function(_0x1cda53){_0x4d35db[_0x0f72('0x36')][_0x0f72('0x37')](_0x9d1213[_0x1cda53]);});}delete _0x4d35db[_0x0f72('0x33')];}catch(_0x98e51d){_0x5cecc7(_0x98e51d);}_0x3260ab(_0x4d35db);});}function updateOpenchannelInteraction(_0x2b1d07,_0x3fb0f7,_0x3dfae8){return new BPromise(function(_0x2a4bf7,_0x5f0e50){return getInteractionUsers(_0x2b1d07,_0x3dfae8)['then'](function(_0x257887){return getInteractionTags(_0x257887,_0x3fb0f7);})[_0x0f72('0x29')](function(_0x5e97a8){return getStateInteraction(_0x5e97a8);})[_0x0f72('0x29')](function(_0x3ca854){_0x2a4bf7(_0x3ca854);})['catch'](function(_0x1614a9){_0x5f0e50(_0x1614a9);});});}function getStateInteraction(_0x9c19a1){return new BPromise(function(_0x3e09e2){_0x9c19a1['waiting']=0x0;_0x9c19a1[_0x0f72('0x38')]=0x0;_0x9c19a1[_0x0f72('0x39')]=0x0;_0x9c19a1[_0x0f72('0x3a')]=0x0;_0x9c19a1[_0x0f72('0x3b')]=0x0;if(!_0x9c19a1['closed']&&!_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1['waiting']+=0x1;}if(!_0x9c19a1['closed']&&_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1[_0x0f72('0x38')]+=0x1;if(_0x9c19a1['waiting']){_0x9c19a1['waiting']-=0x1;}}if(_0x9c19a1[_0x0f72('0x3d')]&&_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1[_0x0f72('0x39')]+=0x1;if(_0x9c19a1[_0x0f72('0x38')]){_0x9c19a1[_0x0f72('0x38')]-=0x1;}}if(_0x9c19a1[_0x0f72('0x3d')]&&!_0x9c19a1[_0x0f72('0x3c')]){_0x9c19a1[_0x0f72('0x3a')]+=0x1;if(_0x9c19a1[_0x0f72('0x3e')]){_0x9c19a1[_0x0f72('0x3e')]-=0x1;}}_0x9c19a1[_0x0f72('0x3b')]+=0x1;_0x3e09e2(_0x9c19a1);});}exports[_0x0f72('0x3f')]=function(_0x45a1e8,_0xdfcd75){var _0x1be2be={},_0x50607b={},_0x1162d6={'count':0x0,'rows':[]};var _0x413fea=_[_0x0f72('0x31')](db[_0x0f72('0x40')][_0x0f72('0x41')],function(_0x1a45bb){return{'name':_0x1a45bb[_0x0f72('0x42')],'type':_0x1a45bb[_0x0f72('0x43')][_0x0f72('0x44')]};});_0x50607b[_0x0f72('0x45')]=_['map'](_0x413fea,_0x0f72('0x2e'));_0x50607b[_0x0f72('0x46')]=_[_0x0f72('0x47')](_0x45a1e8[_0x0f72('0x46')]);_0x50607b[_0x0f72('0x48')]=_[_0x0f72('0x49')](_0x50607b['model'],_0x50607b[_0x0f72('0x46')]);_0x1be2be['attributes']=_[_0x0f72('0x49')](_0x50607b[_0x0f72('0x45')],qs['fields'](_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x4a')]));_0x1be2be[_0x0f72('0x4b')]=_0x1be2be['attributes'][_0x0f72('0x4c')]?_0x1be2be[_0x0f72('0x4b')]:_0x50607b['model'];if(!_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x4d')](_0x0f72('0x4e'))){_0x1be2be[_0x0f72('0x20')]=qs['limit'](_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x20')]);_0x1be2be[_0x0f72('0x1f')]=qs[_0x0f72('0x1f')](_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x1f')]);}_0x1be2be[_0x0f72('0x4f')]=qs['sort'](_0x45a1e8[_0x0f72('0x46')]['sort']);_0x1be2be[_0x0f72('0x50')]=qs['filters'](_['pick'](_0x45a1e8['query'],_0x50607b[_0x0f72('0x48')]),_0x413fea);var _0x2c5cbb=[];var _0x486fae=squel[_0x0f72('0x51')]()['field']('id')[_0x0f72('0x52')]('name')['field'](_0x0f72('0x53'))[_0x0f72('0x54')]('tools_tags');var _0x494bb6=squel[_0x0f72('0x51')]()[_0x0f72('0x52')](_0x0f72('0x55'))['field'](_0x0f72('0x56'))[_0x0f72('0x52')](_0x0f72('0x57'))[_0x0f72('0x54')]('user_has_openchannel_interactions','ui')['left_join'](_0x0f72('0x58'),'u',_0x0f72('0x59'));var _0x1c347e=squel[_0x0f72('0x51')]()[_0x0f72('0x54')]('openchannel_interactions','i')[_0x0f72('0x5a')](_0x0f72('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0f72('0x5a')]('users','o',_0x0f72('0x5c'))['left_join'](_0x0f72('0x5d'),'a',_0x0f72('0x5e'))[_0x0f72('0x5a')](_0x0f72('0x5f'),'me',_0x0f72('0x60'))[_0x0f72('0x5a')](_0x0f72('0x61'),'it',_0x0f72('0x62'))[_0x0f72('0x5a')](_0x0f72('0x63'),'t',_0x0f72('0x64'));var _0x3be03d=squel[_0x0f72('0x65')]();var _0x316df2=[];var _0x44ea54=squel[_0x0f72('0x65')]();var _0x40c3ed;if(_0x45a1e8[_0x0f72('0x46')]['search']){_0x40c3ed=as[_0x0f72('0x66')](_0x45a1e8[_0x0f72('0x46')]['search']);var _0x5ba325=_0x40c3ed['sqlOperator'];for(var _0xcab730=0x0;_0xcab730<_0x40c3ed['conditions'][_0x0f72('0x4c')];_0xcab730++){var _0x4695d7=_0x40c3ed['conditions'][_0xcab730];var _0x4b7afd='i';var _0x17819e=_[_0x0f72('0x67')](_0x413fea,[_0x0f72('0x2e'),_0x4695d7[_0x0f72('0x52')]]);if(!_0x17819e){switch(_0x4695d7['field']){case _0x0f72('0x68'):if(_0x4695d7[_0x0f72('0x69')]==0x1){_0x1c347e[_0x0f72('0x6a')]('`'+_0x4695d7[_0x0f72('0x52')]+_0x0f72('0x6b'));}else{_0x1c347e['having']('`'+_0x4695d7[_0x0f72('0x52')]+_0x0f72('0x6c'));}break;case'Contact':if(_0x4695d7[_0x0f72('0x6d')]===_0x0f72('0x6e')){if(_0x4695d7[_0x0f72('0x69')][_0x0f72('0x34')]('\x20')[_0x0f72('0x4c')]>0x1){_0x3be03d[_0x5ba325](_0x0f72('0x6f'),qs[_0x0f72('0x70')](_0x4695d7[_0x0f72('0x69')]),null);}else{var _0x5d4ed2='%'+_0x4695d7[_0x0f72('0x69')]+'%';_0x3be03d[_0x5ba325]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5d4ed2,_0x5d4ed2,_0x5d4ed2);}}else{_0x17819e=_[_0x0f72('0x67')](_0x413fea,[_0x0f72('0x2e'),_0x0f72('0x71')]);_0x4695d7[_0x0f72('0x52')]=_0x0f72('0x71');_0x49a501=as['buildExpression'](_0x4b7afd,_0x17819e[_0x0f72('0x43')],_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x73')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);}break;case'Tag':var _0x19ebbb=_0x4695d7[_0x0f72('0x69')][_0x0f72('0x34')](',')['map'](function(_0x3e3b64){return Number(_0x3e3b64);});_0x19ebbb[_0x0f72('0x35')](function(_0x5dd9f8){_0x44ea54['or'](_0x0f72('0x75'),'%,'+_0x5dd9f8+',%');});_0x316df2=_[_0x0f72('0x76')](_0x316df2,_0x19ebbb);break;case _0x0f72('0x77'):if(_0x4695d7[_0x0f72('0x6d')]===_0x0f72('0x6e')){_0x3be03d[_0x5ba325](_0x0f72('0x78'),'%'+_0x4695d7[_0x0f72('0x69')]+'%',null);}else{_0x17819e=_[_0x0f72('0x67')](_0x413fea,[_0x0f72('0x2e'),_0x0f72('0x3c')]);_0x4695d7[_0x0f72('0x52')]=_0x0f72('0x3c');_0x49a501=as['buildExpression'](_0x4b7afd,_0x17819e[_0x0f72('0x43')],_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')]['start'],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);}break;case _0x0f72('0x79'):_0x49a501=as[_0x0f72('0x7a')]('me',null,_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x73')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);break;}}else{var _0x49a501=as[_0x0f72('0x7a')](_0x4b7afd,_0x17819e['type'],_0x4695d7);_0x3be03d[_0x5ba325](_0x49a501[_0x0f72('0x72')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x73')],_0x49a501[_0x0f72('0x69')][_0x0f72('0x74')]);}}}else{var _0x31cd3d=_(_0x45a1e8[_0x0f72('0x46')])['keys']()['map'](function(_0x2795eb){return _[_0x0f72('0x7b')](_0x413fea,[_0x0f72('0x2e'),_0x2795eb])?_0x2795eb:undefined;})['compact']()[_0x0f72('0x69')]();if(!_[_0x0f72('0x7c')](_0x31cd3d)){_0x31cd3d[_0x0f72('0x35')](function(_0x2fc823){if(_0x2fc823===_0x0f72('0x7d')){_0x1c347e[_0x0f72('0x50')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x0f72('0x7e')](_0x45a1e8[_0x0f72('0x46')][_0x2fc823]));}else if(_0x2fc823===_0x0f72('0x7f')){var _0x5d9deb=JSON[_0x0f72('0x80')](_0x45a1e8[_0x0f72('0x46')][_0x2fc823])[_0x0f72('0x81')];var _0xa52cf8=JSON[_0x0f72('0x80')](_0x45a1e8[_0x0f72('0x46')][_0x2fc823])['$lte'];_0x1c347e[_0x0f72('0x50')](_0x0f72('0x82'),_0x5d9deb,_0xa52cf8);}else{if(_0x45a1e8['query'][_0x2fc823]===_0x0f72('0x83')){_0x1c347e[_0x0f72('0x50')]('i.'+_0x2fc823+'\x20IS\x20NULL');}else{_0x1c347e['where']('i.'+_0x2fc823+_0x0f72('0x84'),_0x45a1e8['query'][_0x2fc823]);}}});}if(_0x45a1e8[_0x0f72('0x46')]['read']){if(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x85')]==0x1){_0x1c347e[_0x0f72('0x6a')](_0x0f72('0x86'));}else{_0x1c347e[_0x0f72('0x6a')](_0x0f72('0x87'));}}if(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x88')]){_0x316df2=_[_0x0f72('0x89')](_0x45a1e8[_0x0f72('0x46')]['tag'])?_0x45a1e8['query'][_0x0f72('0x88')]:new Array(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x88')]);_0x316df2['forEach'](function(_0x49b324){_0x44ea54['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49b324+',%');});}if(_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x8a')]){var _0x38fcf2=_0x45a1e8['query'][_0x0f72('0x8a')]['replace']('\x5c','\x5c\x5c')[_0x0f72('0x8b')](/'/g,'\x27\x27');if(qs[_0x0f72('0x8c')](_0x38fcf2)){_0x3be03d['or'](_0x0f72('0x8d'),_0x38fcf2+'%');}else{_0x3be03d['or'](_0x0f72('0x8e'),qs[_0x0f72('0x70')](_0x38fcf2))['or']('i.from\x20LIKE\x20?',_0x38fcf2+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x38fcf2+'%');}}}_0x1c347e[_0x0f72('0x50')](_0x3be03d);_0x1c347e['group'](_0x0f72('0x8f'));var _0x58006a={'type':db['Sequelize'][_0x0f72('0x90')]['SELECT'],'raw':!![]};var _0xeb8595=_0x1c347e[_0x0f72('0x91')]();_0xeb8595[_0x0f72('0x52')]('i.id');_0xeb8595[_0x0f72('0x52')](_0x0f72('0x92'),'unreadMessages');if(_0x1be2be[_0x0f72('0x4f')]){_0x1be2be[_0x0f72('0x4f')][_0x0f72('0x35')](function(_0x663d15){var _0x369e64=_0x663d15[0x0]===_0x0f72('0x93')?_0x663d15[0x0]:'i.'+_0x663d15[0x0];_0x1c347e[_0x0f72('0x4f')](_0x369e64,_0x663d15[0x1]===_0x0f72('0x94')?![]:!![]);});}if(!_[_0x0f72('0x7c')](_0x316df2)){_0x1c347e['having'](_0x44ea54);_0xeb8595['where'](_0x0f72('0x95'),_0x316df2);}BPromise[_0x0f72('0x96')]()[_0x0f72('0x29')](function(){if(!_0x40c3ed){if(_0x45a1e8[_0x0f72('0x46')]['OpenchannelAccountId'])return;_0xeb8595['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1c347e[_0x0f72('0x50')](_0x0f72('0x97'));return;}if(_0x45a1e8['user']['role']!==_0x0f72('0x98'))return;return _0x45a1e8['user'][_0x0f72('0x99')]({'attributes':['id'],'raw':!![]})[_0x0f72('0x29')](function(_0x1e63a5){if(_[_0x0f72('0x7c')](_0x1e63a5)){_0xeb8595[_0x0f72('0x50')](_0x0f72('0x9a'));_0x1c347e[_0x0f72('0x50')](_0x0f72('0x9a'));}else{_0xeb8595[_0x0f72('0x50')](_0x0f72('0x9b'),_[_0x0f72('0x31')](_0x1e63a5,'id'));_0x1c347e[_0x0f72('0x50')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x0f72('0x31')](_0x1e63a5,'id'));}});})['then'](function(){if(_0x45a1e8[_0x0f72('0x9c')][_0x0f72('0x9d')]===_0x0f72('0x98')&&!_0x40c3ed&&!_0x45a1e8[_0x0f72('0x46')][_0x0f72('0x7d')])return[];return db['sequelize'][_0x0f72('0x46')](_0xeb8595[_0x0f72('0x9e')](),_0x58006a);})[_0x0f72('0x29')](function(_0x3581aa){_0x1162d6[_0x0f72('0x22')]=_0x3581aa[_0x0f72('0x4c')];if(_0x1162d6[_0x0f72('0x22')]===0x0)return[];return db[_0x0f72('0x9f')][_0x0f72('0x46')](_0x486fae[_0x0f72('0x9e')](),_0x58006a)['then'](function(_0x9d39c8){_0x2c5cbb=_[_0x0f72('0xa0')](_0x9d39c8,'id');_0x58006a=_[_0x0f72('0xa1')](_0x58006a,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x45a1e8['query']['fields']){_0x1be2be['attributes'][_0x0f72('0x35')](function(_0x21ba45){_0x1c347e[_0x0f72('0x52')]('i.'+_0x21ba45);});}else{_0x1c347e['field'](_0x0f72('0x92'),_0x0f72('0x68'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa2'),_0x0f72('0xa3'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa4'),_0x0f72('0xa5'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa6'),_0x0f72('0x93'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa7'));_0x1c347e['field']('c.firstName',_0x0f72('0xa8'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xa9'),_0x0f72('0xaa'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xab'),'Contact.email');_0x1c347e[_0x0f72('0x52')](_0x0f72('0xac'),_0x0f72('0xad'));_0x1c347e[_0x0f72('0x52')]('c.mobile',_0x0f72('0xae'));_0x1c347e['field'](_0x0f72('0xaf'),'Contact.fax');_0x1c347e[_0x0f72('0x52')]('o.fullname',_0x0f72('0xb0'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xb1'),_0x0f72('0xb2'));_0x1c347e[_0x0f72('0x52')](_0x0f72('0xb3'),_0x0f72('0x33'));}if(_0x1be2be['limit'])_0x1c347e['limit'](_0x1be2be[_0x0f72('0x20')]);if(_0x1be2be[_0x0f72('0x1f')])_0x1c347e[_0x0f72('0x1f')](_0x1be2be['offset']);return db['sequelize'][_0x0f72('0x46')](_0x1c347e[_0x0f72('0x9e')](),_0x58006a);})[_0x0f72('0x29')](function(_0x17444a){if(_0x17444a['length']>0x0)_0x494bb6['where'](_0x0f72('0xb4'),_[_0x0f72('0x31')](_0x17444a,'id'));return db[_0x0f72('0x9f')][_0x0f72('0x46')](_0x494bb6[_0x0f72('0x9e')](),_0x58006a)[_0x0f72('0x29')](function(_0x1cf206){var _0x4e7d89=_['groupBy'](_0x1cf206,_0x0f72('0xb5'));var _0xa7dbb9=[];_0x17444a[_0x0f72('0x35')](function(_0xc66b75){_0xa7dbb9[_0x0f72('0x37')](updateOpenchannelInteraction(_0xc66b75,_0x2c5cbb,_0x4e7d89));});return BPromise['all'](_0xa7dbb9);});});})[_0x0f72('0x29')](function(_0x55aa1d){_0x1162d6[_0x0f72('0xb6')]=_0x55aa1d;return _0x1162d6;})[_0x0f72('0x29')](respondWithFilteredResult(_0xdfcd75,_0x1be2be))[_0x0f72('0xb7')](handleError(_0xdfcd75,null));};exports['show']=function(_0x1ada43,_0x3c50bf){var _0x3ad0da={};if(_0x1ada43[_0x0f72('0x46')][_0x0f72('0x43')]&&_0x1ada43['query'][_0x0f72('0x43')]===_0x0f72('0x54')){_0x3ad0da[_0x0f72('0x54')]=_0x1ada43[_0x0f72('0xb8')]['id'];}else{_0x3ad0da['id']=_0x1ada43[_0x0f72('0xb8')]['id'];}var _0x328910={'raw':![],'where':_0x3ad0da},_0x2579ed={};_0x2579ed[_0x0f72('0x45')]=_[_0x0f72('0x47')](db[_0x0f72('0x40')][_0x0f72('0x41')]);_0x2579ed['query']=_['keys'](_0x1ada43[_0x0f72('0x46')]);_0x2579ed[_0x0f72('0x48')]=_[_0x0f72('0x49')](_0x2579ed[_0x0f72('0x45')],_0x2579ed[_0x0f72('0x46')]);_0x328910['attributes']=_[_0x0f72('0x49')](_0x2579ed[_0x0f72('0x45')],qs[_0x0f72('0x4a')](_0x1ada43[_0x0f72('0x46')][_0x0f72('0x4a')]));_0x328910[_0x0f72('0x4b')]=_0x328910[_0x0f72('0x4b')][_0x0f72('0x4c')]?_0x328910['attributes']:_0x2579ed['model'];if(_0x1ada43[_0x0f72('0x46')][_0x0f72('0xb9')]){_0x328910[_0x0f72('0xba')]=[{'all':!![]}];}_0x328910=_[_0x0f72('0xa1')]({},_0x328910,_0x1ada43[_0x0f72('0xbb')]);return db['OpenchannelInteraction'][_0x0f72('0x67')](_0x328910)[_0x0f72('0x29')](handleEntityNotFound(_0x3c50bf,null))[_0x0f72('0x29')](respondWithResult(_0x3c50bf,null))[_0x0f72('0xb7')](handleError(_0x3c50bf,null));};exports[_0x0f72('0xbc')]=function(_0x19805b,_0x30414d){return db[_0x0f72('0x40')][_0x0f72('0xbc')](_0x19805b[_0x0f72('0x79')],{})[_0x0f72('0x29')](respondWithResult(_0x30414d,0xc9))[_0x0f72('0xb7')](handleError(_0x30414d,null));};exports['update']=function(_0x566a00,_0x505b53){if(_0x566a00[_0x0f72('0x79')]['id']){delete _0x566a00[_0x0f72('0x79')]['id'];}return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x566a00['params']['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x505b53,null))[_0x0f72('0x29')](saveUpdates(_0x566a00['body'],null))[_0x0f72('0x29')](respondWithResult(_0x505b53,null))[_0x0f72('0xb7')](handleError(_0x505b53,null));};exports[_0x0f72('0x2a')]=function(_0x5b2ff2,_0x17a29e){return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x5b2ff2[_0x0f72('0xb8')]['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x17a29e,null))[_0x0f72('0x29')](removeEntity(_0x17a29e,null))['catch'](handleError(_0x17a29e,null));};exports[_0x0f72('0xbd')]=function(_0x508eca,_0x314406){return db['OpenchannelInteraction'][_0x0f72('0xbd')]()[_0x0f72('0x29')](respondWithResult(_0x314406,null))[_0x0f72('0xb7')](handleError(_0x314406,null));};exports['addMessage']=function(_0x2039d0,_0x26d668,_0x1bb924){return db['OpenchannelMessage']['find']({'where':{'id':_0x2039d0['params']['id']}})['then'](handleEntityNotFound(_0x26d668,null))[_0x0f72('0x29')](function(_0xd51e88){if(_0xd51e88){return _0xd51e88['addMessage'](_0x2039d0[_0x0f72('0x79')]['ids'],_[_0x0f72('0xbe')](_0x2039d0['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x26d668,null))[_0x0f72('0xb7')](handleError(_0x26d668,null));};exports[_0x0f72('0xbf')]=function(_0x462c1f,_0x5d5f8f,_0x237073){var _0x3daa32={'raw':![],'where':{}};var _0x380a55={};var _0x575a40={'count':0x0,'rows':[]};return db[_0x0f72('0x40')][_0x0f72('0xc0')]({'where':{'id':_0x462c1f['params']['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x5d5f8f,null))[_0x0f72('0x29')](function(_0x35f48f){if(_0x35f48f){_0x380a55[_0x0f72('0x45')]=_[_0x0f72('0x47')](db[_0x0f72('0xc1')][_0x0f72('0x41')]);_0x380a55['query']=_[_0x0f72('0x47')](_0x462c1f[_0x0f72('0x46')]);_0x380a55[_0x0f72('0x48')]=_[_0x0f72('0x49')](_0x380a55[_0x0f72('0x45')],_0x380a55[_0x0f72('0x46')]);_0x3daa32['attributes']=_['intersection'](_0x380a55[_0x0f72('0x45')],qs[_0x0f72('0x4a')](_0x462c1f[_0x0f72('0x46')]['fields']));_0x3daa32['attributes']=_0x3daa32[_0x0f72('0x4b')][_0x0f72('0x4c')]?_0x3daa32[_0x0f72('0x4b')]:_0x380a55[_0x0f72('0x45')];if(!_0x462c1f[_0x0f72('0x46')]['hasOwnProperty'](_0x0f72('0x4e'))){_0x3daa32['limit']=qs[_0x0f72('0x20')](_0x462c1f[_0x0f72('0x46')][_0x0f72('0x20')]);_0x3daa32['offset']=qs[_0x0f72('0x1f')](_0x462c1f[_0x0f72('0x46')][_0x0f72('0x1f')]);}_0x3daa32[_0x0f72('0x4f')]=qs[_0x0f72('0xc2')](_0x462c1f[_0x0f72('0x46')][_0x0f72('0xc2')]);_0x3daa32[_0x0f72('0x50')]=qs[_0x0f72('0x48')](_[_0x0f72('0xc3')](_0x462c1f['query'],_0x380a55[_0x0f72('0x48')]));_0x3daa32[_0x0f72('0x50')][_0x0f72('0xb5')]=_0x35f48f['id'];if(_0x462c1f[_0x0f72('0x46')]['filter']){_0x3daa32[_0x0f72('0x50')]=_[_0x0f72('0xa1')](_0x3daa32[_0x0f72('0x50')],{'$or':_[_0x0f72('0x31')](_0x3daa32[_0x0f72('0x4b')],function(_0x28d04a){var _0x5349c9={};_0x5349c9[_0x28d04a]={'$like':'%'+_0x462c1f[_0x0f72('0x46')][_0x0f72('0x8a')]+'%'};return _0x5349c9;})});}if(_0x462c1f[_0x0f72('0x46')]['$gte']){var _0x5e3e37=_0x462c1f[_0x0f72('0x46')][_0x0f72('0x81')]['split'](',');var _0x24fbe3={};_0x24fbe3[_0x5e3e37[0x0]]={'$gte':moment(_0x5e3e37[0x1])[_0x0f72('0xc4')](_0x0f72('0xc5'))};_0x3daa32[_0x0f72('0x50')]=_[_0x0f72('0xa1')](_0x3daa32[_0x0f72('0x50')],_0x24fbe3);}_0x3daa32=_[_0x0f72('0xa1')]({},_0x3daa32,_0x462c1f[_0x0f72('0xbb')]);return db[_0x0f72('0xc1')][_0x0f72('0x22')]({'where':_0x3daa32['where']})[_0x0f72('0x29')](function(_0x998a89){_0x575a40[_0x0f72('0x22')]=_0x998a89;if(_0x462c1f[_0x0f72('0x46')][_0x0f72('0xb9')]){_0x3daa32[_0x0f72('0xba')]=[{'all':!![]}];}return db[_0x0f72('0xc1')][_0x0f72('0xc6')](_0x3daa32);})['then'](function(_0x2c5862){_0x575a40[_0x0f72('0xb6')]=_0x2c5862;return _0x575a40;});}})[_0x0f72('0x29')](respondWithFilteredResult(_0x5d5f8f,_0x3daa32))[_0x0f72('0xb7')](handleError(_0x5d5f8f,null));};exports['addTags']=function(_0x49b4f1,_0x7d404d,_0x152992){return db['OpenchannelInteraction'][_0x0f72('0x67')]({'where':{'id':_0x49b4f1[_0x0f72('0xb8')]['id']}})['then'](handleEntityNotFound(_0x7d404d,null))['then'](function(_0x58083c){if(_0x58083c){return _0x58083c[_0x0f72('0xc7')](_0x49b4f1[_0x0f72('0x79')][_0x0f72('0xc8')],_[_0x0f72('0xbe')](_0x49b4f1[_0x0f72('0x79')],[_0x0f72('0xc8'),'id'])||{})[_0x0f72('0xc9')](function(){return db[_0x0f72('0xca')][_0x0f72('0xc6')]({'attributes':['id',_0x0f72('0x2e'),'color'],'where':{'id':_0x49b4f1[_0x0f72('0x79')][_0x0f72('0xc8')]}});})['then'](function(_0x3566af){socket[_0x0f72('0xcb')]('openchannelInteractionTags:save',{'id':Number(_0x49b4f1[_0x0f72('0xb8')]['id']),'tags':_0x3566af||[]});return{'id':Number(_0x49b4f1[_0x0f72('0xb8')]['id']),'tags':_0x3566af||[]};});}})['then'](respondWithResult(_0x7d404d,null))['catch'](handleError(_0x7d404d,null));};exports['removeTags']=function(_0x3a0cfc,_0x2d519d,_0x19fc3e){return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x3a0cfc[_0x0f72('0xb8')]['id']}})[_0x0f72('0x29')](handleEntityNotFound(_0x2d519d,null))[_0x0f72('0x29')](function(_0x2d724c){if(_0x2d724c){return _0x2d724c['removeTags'](_0x3a0cfc['query']['ids']);}})['then'](respondWithStatusCode(_0x2d519d,null))[_0x0f72('0xb7')](handleError(_0x2d519d,null));};exports[_0x0f72('0xcc')]=function(_0x334540,_0x425bc5){var _0xe83368=moment()[_0x0f72('0xcd')]()[_0x0f72('0x9e')]();var _0xf93b2c=path[_0x0f72('0xce')](config['root'],_0x0f72('0xcf'),'files',_0x0f72('0xd0'));var _0x405f08=path[_0x0f72('0xce')](config[_0x0f72('0xd1')],'server',_0x0f72('0xd2'),_0x0f72('0xd3'));var _0x3e1822=path[_0x0f72('0xce')](_0xf93b2c,_0xe83368);var _0xa2d5e1=util['format'](_0x0f72('0xd4'),_0x334540['params']['id'],_0xe83368);var _0x7a9c1d=path[_0x0f72('0xce')](_0xf93b2c,_0xa2d5e1);var _0xa99814=[];_0xa99814[_0x0f72('0x37')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xa99814[_0x0f72('0x37')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x0f72('0xd5')],'raw':!![]});if(_0x334540[_0x0f72('0x46')][_0x0f72('0xd3')]){_0xa99814[_0x0f72('0x37')]({'model':db[_0x0f72('0xd6')],'as':_0x0f72('0xd6'),'raw':!![]});}var _0x53490f=[{'model':db['OpenchannelMessage'],'as':_0x0f72('0xd7'),'attributes':['id',_0x0f72('0x79'),_0x0f72('0x7f'),_0x0f72('0xd8'),_0x0f72('0xd9'),'read'],'include':_0xa99814}];_0x53490f[_0x0f72('0x37')]({'model':db[_0x0f72('0xda')],'as':_0x0f72('0xdb'),'attributes':['id','name']});_0x53490f[_0x0f72('0x37')]({'model':db[_0x0f72('0x77')],'as':_0x0f72('0xdc'),'attributes':['id',_0x0f72('0x32')]});return db[_0x0f72('0x40')][_0x0f72('0x67')]({'where':{'id':_0x334540[_0x0f72('0xb8')]['id']},'include':_0x53490f})[_0x0f72('0x29')](handleEntityNotFound(_0x425bc5,null))[_0x0f72('0x29')](function(_0x145142){if(_0x145142){var _0x43806d=_0x145142[_0x0f72('0xdd')]({'plain':!![]});fs['mkdirSync'](_0x3e1822);var _0xa9be96={'channel':_0x0f72('0xde'),'account':_0x43806d[_0x0f72('0xdb')][_0x0f72('0x2e')],'agent':_0x43806d['Owner']?_0x43806d[_0x0f72('0xdc')][_0x0f72('0x32')]:_0x0f72('0xdf'),'createdAt':moment(_0x43806d[_0x0f72('0x7f')])[_0x0f72('0xc4')](_0x0f72('0xc5'))[_0x0f72('0x9e')](),'closedAt':_0x43806d[_0x0f72('0x3d')]?moment(_0x43806d[_0x0f72('0xe0')])[_0x0f72('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0f72('0x9e')]():'','disposition':_0x43806d['disposition'],'visibility':_0x43806d[_0x0f72('0xe1')]?_0x0f72('0xe2'):'Private','messages':_(_0x43806d[_0x0f72('0xd7')])[_0x0f72('0x8a')]({'secret':![]})[_0x0f72('0x31')](function(_0x4efb9b){if(_0x4efb9b[_0x0f72('0xd6')]){var _0x24fad9=path[_0x0f72('0xce')](_0x405f08,_0x4efb9b['Attachment']['basename']);if(fs[_0x0f72('0xe3')](_0x24fad9)){fs[_0x0f72('0xe4')](_0x24fad9)[_0x0f72('0xe5')](fs['createWriteStream'](path['join'](_0x3e1822,_0x4efb9b[_0x0f72('0xd6')][_0x0f72('0xe6')])));}}return{'date':moment(_0x4efb9b['createdAt'])[_0x0f72('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0f72('0x9e')](),'sender':_0x4efb9b[_0x0f72('0xd8')]==='out'?_0x4efb9b['User']?_0x4efb9b[_0x0f72('0x77')][_0x0f72('0x32')]:_0x0f72('0xe7'):_0x4efb9b[_0x0f72('0xe8')][_0x0f72('0xe9')]+(_0x4efb9b['Contact'][_0x0f72('0xd5')]?'\x20'+_0x4efb9b[_0x0f72('0xe8')][_0x0f72('0xd5')]:''),'body':_0x4efb9b[_0x0f72('0xd6')]?_0x4efb9b[_0x0f72('0xd6')][_0x0f72('0xe6')]:_0x4efb9b['body'],'direction':_0x4efb9b[_0x0f72('0xd8')]===_0x0f72('0xea')?'A':'C','secret':_0x4efb9b[_0x0f72('0xd9')],'read':_0x4efb9b[_0x0f72('0x85')],'attachment':_0x4efb9b[_0x0f72('0xd6')]};})[_0x0f72('0x69')]()};return ejs[_0x0f72('0xeb')](path['join'](config[_0x0f72('0xd1')],_0x0f72('0xcf'),_0x0f72('0xec'),_0x0f72('0xed')),{'interaction':_0xa9be96})[_0x0f72('0x29')](function(_0x5ae601){var _0x17a79f=path[_0x0f72('0xce')](_0x3e1822,'transcript-'+_0x43806d['id']+'-'+_0xe83368+'.pdf');var _0x29aaca={'path':_0x17a79f,'channel':_0x0f72('0xde'),'interactionId':_0x43806d['id']};return pdf[_0x0f72('0xee')](_0x5ae601,_0x29aaca);})[_0x0f72('0x29')](function(){return new BPromise(function(_0x411570,_0x50683a){zipdir(_0x3e1822,{'saveTo':_0x7a9c1d},function(_0x54a593,_0xe6275e){if(_0x54a593)return _0x50683a(_0x54a593);return _0x411570(_0xe6275e);});})[_0x0f72('0x29')](function(){return new BPromise(function(_0x1f5515,_0x346a68){rimraf(_0x3e1822,function(_0x575c39){if(_0x575c39)_0x346a68(_0x575c39);return _0x1f5515();});});})[_0x0f72('0x29')](function(){return _0x425bc5[_0x0f72('0xcc')](_0x7a9c1d,_0xa2d5e1,function(_0x3cb3d6){if(_0x3cb3d6){console[_0x0f72('0xef')](_0x0f72('0xf0'),_0x3cb3d6);}else{fs['unlinkSync'](_0x7a9c1d);}});});});}else{return _0x425bc5[_0x0f72('0x2b')](0xc8);}})['catch'](handleError(_0x425bc5,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 98abc34..cce9d85 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 _0x4300=['update','remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4300,0x1a6));var _0x0430=function(_0x287d49,_0x3414cf){_0x287d49=_0x287d49-0x0;var _0x3011b3=_0x4300[_0x287d49];return _0x3011b3;};'use strict';var EventEmitter=require(_0x0430('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0430('0x1')](0x0);var events={'afterCreate':_0x0430('0x2'),'afterUpdate':_0x0430('0x3'),'afterDestroy':_0x0430('0x4')};function emitEvent(_0x1735aa){return function(_0x5d0aac,_0x46b412,_0x5943c0){_0x5d0aac[_0x0430('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2388b9){_0x5d0aac[_0x0430('0x6')](_0x0430('0x7'),_0x2388b9[_0x0430('0x8')](function(_0x1e8d93){return{'id':_0x1e8d93['id']};}));return OpenchannelMessage[_0x0430('0x9')]({'where':{'OpenchannelInteractionId':_0x5d0aac['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0430('0xa')](function(_0x3af75c){_0x5d0aac[_0x0430('0x6')]('unreadMessages',_0x3af75c[_0x0430('0xb')]);OpenchannelInteractionEvents[_0x0430('0xc')](_0x1735aa+':'+_0x5d0aac['id'],_0x5d0aac);OpenchannelInteractionEvents[_0x0430('0xc')](_0x1735aa,_0x5d0aac);_0x5943c0(null);})[_0x0430('0xd')](_0x5943c0(null));};}for(var e in events){if(events[_0x0430('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x0430('0xf')](e,emitEvent(event));}}module[_0x0430('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd715=['then','length','emit','catch','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','save','update','remove','setDataValue','Users','findAll'];(function(_0x198987,_0x17bbd7){var _0x5151b0=function(_0x2efea6){while(--_0x2efea6){_0x198987['push'](_0x198987['shift']());}};_0x5151b0(++_0x17bbd7);}(_0xd715,0x132));var _0x5d71=function(_0x228dbc,_0x1474c0){_0x228dbc=_0x228dbc-0x0;var _0x80efa6=_0xd715[_0x228dbc];return _0x80efa6;};'use strict';var EventEmitter=require(_0x5d71('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x5d71('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x5d71('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d71('0x3'),'afterUpdate':_0x5d71('0x4'),'afterDestroy':_0x5d71('0x5')};function emitEvent(_0x4b1299){return function(_0xf1fd25,_0x2eb368,_0xaa7056){_0xf1fd25['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d7906){_0xf1fd25[_0x5d71('0x6')](_0x5d71('0x7'),_0x3d7906['map'](function(_0x12d66c){return{'id':_0x12d66c['id']};}));return OpenchannelMessage[_0x5d71('0x8')]({'where':{'OpenchannelInteractionId':_0xf1fd25['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5d71('0x9')](function(_0x253147){_0xf1fd25[_0x5d71('0x6')]('unreadMessages',_0x253147[_0x5d71('0xa')]);OpenchannelInteractionEvents[_0x5d71('0xb')](_0x4b1299+':'+_0xf1fd25['id'],_0xf1fd25);OpenchannelInteractionEvents['emit'](_0x4b1299,_0xf1fd25);_0xaa7056(null);})[_0x5d71('0xc')](_0xaa7056(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x5d71('0xd')](e,emitEvent(event));}}module[_0x5d71('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a122c38..af686e5 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 _0xba5c=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0xacb50,_0x27afa9){var _0x48d8af=function(_0x539bc0){while(--_0x539bc0){_0xacb50['push'](_0xacb50['shift']());}};_0x48d8af(++_0x27afa9);}(_0xba5c,0xfc));var _0xcba5=function(_0x5efb7a,_0x3109f3){_0x5efb7a=_0x5efb7a-0x0;var _0x581feb=_0xba5c[_0x5efb7a];return _0x581feb;};'use strict';var _=require(_0xcba5('0x0'));var util=require(_0xcba5('0x1'));var logger=require(_0xcba5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcba5('0x3'));var fs=require('fs');var path=require(_0xcba5('0x4'));var rimraf=require(_0xcba5('0x5'));var config=require(_0xcba5('0x6'));var attributes=require(_0xcba5('0x7'));module[_0xcba5('0x8')]=function(_0x36ee07,_0x17d52f){return _0x36ee07[_0xcba5('0x9')](_0xcba5('0xa'),attributes,{'tableName':_0xcba5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcba5('0xc'),'collate':_0xcba5('0xd'),'hooks':{'beforeUpdate':function(_0x1c8507,_0x2305bd,_0x22150a){if(_0x1c8507[_0xcba5('0xe')]('closed')){_0x1c8507[_0xcba5('0xf')]=moment()['format'](_0xcba5('0x10'));}_0x22150a(null,_0x1c8507);}}});}; \ No newline at end of file +var _0x3ed6=['bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment'];(function(_0x5dff26,_0x505dda){var _0x413230=function(_0x3b67fe){while(--_0x3b67fe){_0x5dff26['push'](_0x5dff26['shift']());}};_0x413230(++_0x505dda);}(_0x3ed6,0x12f));var _0x63ed=function(_0x5f22d0,_0x84c069){_0x5f22d0=_0x5f22d0-0x0;var _0xed7d79=_0x3ed6[_0x5f22d0];return _0xed7d79;};'use strict';var _=require('lodash');var util=require(_0x63ed('0x0'));var logger=require(_0x63ed('0x1'))('api');var moment=require(_0x63ed('0x2'));var BPromise=require(_0x63ed('0x3'));var rp=require(_0x63ed('0x4'));var fs=require('fs');var path=require(_0x63ed('0x5'));var rimraf=require(_0x63ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x63ed('0x7'));module[_0x63ed('0x8')]=function(_0xcf72f6,_0x4f15f1){return _0xcf72f6[_0x63ed('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x63ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63ed('0xb'),'collate':_0x63ed('0xc'),'hooks':{'beforeUpdate':function(_0x534f25,_0x362f54,_0x9ed038){if(_0x534f25[_0x63ed('0xd')](_0x63ed('0xe'))){_0x534f25[_0x63ed('0xf')]=moment()['format'](_0x63ed('0x10'));}_0x9ed038(null,_0x534f25);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c5c7140..7a6116f 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 _0x9a15=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9a15,0x94));var _0x59a1=function(_0x2ec1dd,_0x57d18c){_0x2ec1dd=_0x2ec1dd-0x0;var _0x2fa2ad=_0x9a15[_0x2ec1dd];return _0x2fa2ad;};'use strict';var _=require(_0x59a1('0x0'));var util=require(_0x59a1('0x1'));var moment=require(_0x59a1('0x2'));var BPromise=require(_0x59a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59a1('0x4'));var db=require(_0x59a1('0x5'))['db'];var utils=require(_0x59a1('0x6'));var logger=require(_0x59a1('0x7'))(_0x59a1('0x8'));var config=require(_0x59a1('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x59a1('0xa')]=_[_0x59a1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x59a1('0xc'))(new Redis(config['redis']));require(_0x59a1('0xd'))[_0x59a1('0xe')](socket);function respondWithRpcPromise(_0x2b5656,_0xeb3d99,_0x362292){return new BPromise(function(_0x25b228,_0x54029d){return client[_0x59a1('0xf')](_0x2b5656,_0x362292)[_0x59a1('0x10')](function(_0xef7d2c){logger[_0x59a1('0x11')](_0x59a1('0x12'),_0xeb3d99,_0x59a1('0x13'));logger[_0x59a1('0x14')](_0x59a1('0x15'),_0xeb3d99,'request\x20sent',JSON[_0x59a1('0x16')](_0xef7d2c));if(_0xef7d2c[_0x59a1('0x17')]){if(_0xef7d2c[_0x59a1('0x17')][_0x59a1('0x18')]===0x1f4){logger[_0x59a1('0x17')](_0x59a1('0x12'),_0xeb3d99,_0xef7d2c[_0x59a1('0x17')][_0x59a1('0x19')]);return _0x54029d(_0xef7d2c[_0x59a1('0x17')][_0x59a1('0x19')]);}logger[_0x59a1('0x17')](_0x59a1('0x12'),_0xeb3d99,_0xef7d2c[_0x59a1('0x17')]['message']);return _0x25b228(_0xef7d2c['error'][_0x59a1('0x19')]);}else{logger[_0x59a1('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0xeb3d99,_0x59a1('0x13'));_0x25b228(_0xef7d2c[_0x59a1('0x1a')][_0x59a1('0x19')]);}})[_0x59a1('0x1b')](function(_0x5a5475){logger[_0x59a1('0x17')](_0x59a1('0x12'),_0xeb3d99,_0x5a5475);_0x54029d(_0x5a5475);});});}exports['UpdateOpenchannelInteraction']=function(_0xae0472){var _0x20553e=this;return new Promise(function(_0x552ce5,_0x11a5df){return db[_0x59a1('0x1c')]['update'](_0xae0472[_0x59a1('0x1d')],{'raw':_0xae0472[_0x59a1('0x1e')]?_0xae0472[_0x59a1('0x1e')][_0x59a1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xae0472[_0x59a1('0x1e')]?_0xae0472[_0x59a1('0x1e')][_0x59a1('0x20')]||null:null,'attributes':_0xae0472['options']?_0xae0472[_0x59a1('0x1e')][_0x59a1('0x21')]||null:null,'limit':_0xae0472[_0x59a1('0x1e')]?_0xae0472[_0x59a1('0x1e')][_0x59a1('0x22')]||null:null})[_0x59a1('0x10')](function(_0x346f2c){logger[_0x59a1('0x11')](_0x59a1('0x23'),_0xae0472);logger[_0x59a1('0x14')](_0x59a1('0x23'),_0xae0472,JSON[_0x59a1('0x16')](_0x346f2c));_0x552ce5(_0x346f2c);})[_0x59a1('0x1b')](function(_0x2ec378){logger['error'](_0x59a1('0x23'),_0x2ec378[_0x59a1('0x19')],_0xae0472);_0x11a5df(_0x20553e[_0x59a1('0x17')](0x1f4,_0x2ec378[_0x59a1('0x19')]));});});};exports[_0x59a1('0x24')]=function(_0x561a17){return new Promise(function(_0x23ba3c,_0x232c89){return db[_0x59a1('0x1c')][_0x59a1('0x25')]({'where':_0x561a17[_0x59a1('0x1e')]?_0x561a17[_0x59a1('0x1e')]['where']||null:null})[_0x59a1('0x10')](function(_0x2c5609){if(_0x2c5609){return _0x2c5609[_0x59a1('0x26')](_0x561a17[_0x59a1('0x1d')]['ids'],_['omit'](_0x561a17[_0x59a1('0x1d')],[_0x59a1('0x27'),'id'])||{});}})[_0x59a1('0x28')](function(_0xf5ef0a){logger[_0x59a1('0x11')](_0x59a1('0x29'),_0x561a17);logger['debug'](_0x59a1('0x29'),_0x561a17,JSON[_0x59a1('0x16')](_0xf5ef0a));_0x23ba3c(_0xf5ef0a);})[_0x59a1('0x1b')](function(_0x2d0c81){logger[_0x59a1('0x17')]('AddTags',_0x2d0c81[_0x59a1('0x19')],_0x561a17);_0x232c89(_this[_0x59a1('0x17')](0x1f4,_0x2d0c81[_0x59a1('0x19')]));});});}; \ No newline at end of file +var _0x8319=['rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1e3e69,_0x15286b){var _0x28ca76=function(_0x2854fb){while(--_0x2854fb){_0x1e3e69['push'](_0x1e3e69['shift']());}};_0x28ca76(++_0x15286b);}(_0x8319,0x6f));var _0x9831=function(_0x805301,_0x3d4f79){_0x805301=_0x805301-0x0;var _0xbbee84=_0x8319[_0x805301];return _0xbbee84;};'use strict';var _=require(_0x9831('0x0'));var util=require('util');var moment=require(_0x9831('0x1'));var BPromise=require(_0x9831('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9831('0x3'));var db=require(_0x9831('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9831('0x5'))(_0x9831('0x6'));var config=require(_0x9831('0x7'));var jayson=require(_0x9831('0x8'));var client=jayson['client'][_0x9831('0x9')]({'port':0x232a});config[_0x9831('0xa')]=_['defaults'](config[_0x9831('0xa')],{'host':_0x9831('0xb'),'port':0x18eb});var socket=require(_0x9831('0xc'))(new Redis(config[_0x9831('0xa')]));require(_0x9831('0xd'))[_0x9831('0xe')](socket);function respondWithRpcPromise(_0x447b7e,_0x28aab3,_0x3c0685){return new BPromise(function(_0x29ee01,_0x393eda){return client['request'](_0x447b7e,_0x3c0685)[_0x9831('0xf')](function(_0x5c4f8b){logger[_0x9831('0x10')](_0x9831('0x11'),_0x28aab3,_0x9831('0x12'));logger[_0x9831('0x13')](_0x9831('0x14'),_0x28aab3,_0x9831('0x12'),JSON[_0x9831('0x15')](_0x5c4f8b));if(_0x5c4f8b[_0x9831('0x16')]){if(_0x5c4f8b[_0x9831('0x16')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x28aab3,_0x5c4f8b['error'][_0x9831('0x17')]);return _0x393eda(_0x5c4f8b[_0x9831('0x16')]['message']);}logger[_0x9831('0x16')](_0x9831('0x11'),_0x28aab3,_0x5c4f8b['error'][_0x9831('0x17')]);return _0x29ee01(_0x5c4f8b[_0x9831('0x16')][_0x9831('0x17')]);}else{logger[_0x9831('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x28aab3,_0x9831('0x12'));_0x29ee01(_0x5c4f8b['result'][_0x9831('0x17')]);}})[_0x9831('0x18')](function(_0x292456){logger[_0x9831('0x16')](_0x9831('0x11'),_0x28aab3,_0x292456);_0x393eda(_0x292456);});});}exports[_0x9831('0x19')]=function(_0x4a83b6){var _0x27149f=this;return new Promise(function(_0x252e74,_0x330215){return db[_0x9831('0x1a')][_0x9831('0x1b')](_0x4a83b6[_0x9831('0x1c')],{'raw':_0x4a83b6[_0x9831('0x1d')]?_0x4a83b6[_0x9831('0x1d')][_0x9831('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a83b6[_0x9831('0x1d')]?_0x4a83b6[_0x9831('0x1d')][_0x9831('0x1f')]||null:null,'attributes':_0x4a83b6[_0x9831('0x1d')]?_0x4a83b6['options']['attributes']||null:null,'limit':_0x4a83b6['options']?_0x4a83b6[_0x9831('0x1d')]['limit']||null:null})[_0x9831('0xf')](function(_0x4d4f17){logger[_0x9831('0x10')](_0x9831('0x19'),_0x4a83b6);logger[_0x9831('0x13')]('UpdateOpenchannelInteraction',_0x4a83b6,JSON[_0x9831('0x15')](_0x4d4f17));_0x252e74(_0x4d4f17);})[_0x9831('0x18')](function(_0x50d041){logger[_0x9831('0x16')](_0x9831('0x19'),_0x50d041['message'],_0x4a83b6);_0x330215(_0x27149f['error'](0x1f4,_0x50d041[_0x9831('0x17')]));});});};exports[_0x9831('0x20')]=function(_0x17db4e){return new Promise(function(_0x2c62ce,_0x4720d0){return db['OpenchannelInteraction'][_0x9831('0x21')]({'where':_0x17db4e[_0x9831('0x1d')]?_0x17db4e['options']['where']||null:null})[_0x9831('0xf')](function(_0x32e40a){if(_0x32e40a){return _0x32e40a[_0x9831('0x22')](_0x17db4e[_0x9831('0x1c')][_0x9831('0x23')],_[_0x9831('0x24')](_0x17db4e[_0x9831('0x1c')],[_0x9831('0x23'),'id'])||{});}})[_0x9831('0x25')](function(_0x343e41){logger[_0x9831('0x10')](_0x9831('0x26'),_0x17db4e);logger[_0x9831('0x13')]('AddTags',_0x17db4e,JSON[_0x9831('0x15')](_0x343e41));_0x2c62ce(_0x343e41);})[_0x9831('0x18')](function(_0x4075f9){logger[_0x9831('0x16')](_0x9831('0x26'),_0x4075f9['message'],_0x17db4e);_0x4720d0(_this['error'](0x1f4,_0x4075f9[_0x9831('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ed6e2d9..fbbb727 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 _0x7009=['emit','register','length','./openchannelInteraction.events','save','remove','update'];(function(_0x5b290a,_0x43fa5a){var _0x4af52f=function(_0x4a531b){while(--_0x4a531b){_0x5b290a['push'](_0x5b290a['shift']());}};_0x4af52f(++_0x43fa5a);}(_0x7009,0x96));var _0x9700=function(_0x2e2f17,_0x15f099){_0x2e2f17=_0x2e2f17-0x0;var _0x2ef958=_0x7009[_0x2e2f17];return _0x2ef958;};'use strict';var OpenchannelInteractionEvents=require(_0x9700('0x0'));var events=[_0x9700('0x1'),_0x9700('0x2'),_0x9700('0x3')];function createListener(_0x58e709,_0x4a13d9){return function(_0x30999f){_0x4a13d9[_0x9700('0x4')](_0x58e709,_0x30999f);};}function removeListener(_0x196113,_0x5326e6){return function(){OpenchannelInteractionEvents['removeListener'](_0x196113,_0x5326e6);};}exports[_0x9700('0x5')]=function(_0x362c7c){for(var _0x42b9d4=0x0,_0x3096ed=events[_0x9700('0x6')];_0x42b9d4<_0x3096ed;_0x42b9d4++){var _0x55b5d5=events[_0x42b9d4];var _0x1cf586=createListener('openchannelInteraction:'+_0x55b5d5,_0x362c7c);OpenchannelInteractionEvents['on'](_0x55b5d5,_0x1cf586);}}; \ No newline at end of file +var _0xc9aa=['register','openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener'];(function(_0x59c9a1,_0x9e4964){var _0x3d3133=function(_0x3482a8){while(--_0x3482a8){_0x59c9a1['push'](_0x59c9a1['shift']());}};_0x3d3133(++_0x9e4964);}(_0xc9aa,0xdb));var _0xac9a=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xc9aa[_0x3e6729];return _0x535bcd;};'use strict';var OpenchannelInteractionEvents=require(_0xac9a('0x0'));var events=[_0xac9a('0x1'),'remove',_0xac9a('0x2')];function createListener(_0x22d713,_0x4b7bc9){return function(_0x4dc324){_0x4b7bc9[_0xac9a('0x3')](_0x22d713,_0x4dc324);};}function removeListener(_0x26c76f,_0x10d672){return function(){OpenchannelInteractionEvents[_0xac9a('0x4')](_0x26c76f,_0x10d672);};}exports[_0xac9a('0x5')]=function(_0x2a1716){for(var _0x5c9f02=0x0,_0xecb9e7=events['length'];_0x5c9f02<_0xecb9e7;_0x5c9f02++){var _0x532b9e=events[_0x5c9f02];var _0x4b0a76=createListener(_0xac9a('0x6')+_0x532b9e,_0x2a1716);OpenchannelInteractionEvents['on'](_0x532b9e,_0x4b0a76);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6f2f70b..905ed97 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 _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x16267e,_0x4bcac0){_0x16267e=_0x16267e-0x0;var _0x148359=_0x70e0[_0x16267e];return _0x148359;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c5d1f6a..628aa9a 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 _0x6f2f=['BOOLEAN','out','DATE','STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x6f2f[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0xf6f2('0x0'));module[_0xf6f2('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf6f2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf6f2('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf6f2('0x4')]},'providerName':{'type':Sequelize[_0xf6f2('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1f81=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x5519c3,_0x488174){var _0x922cc7=function(_0x530054){while(--_0x530054){_0x5519c3['push'](_0x5519c3['shift']());}};_0x922cc7(++_0x488174);}(_0x1f81,0xab));var _0x11f8=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x1f81[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require(_0x11f8('0x0'));module[_0x11f8('0x1')]={'body':{'type':Sequelize['TEXT'](_0x11f8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x11f8('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x11f8('0x4')]('in',_0x11f8('0x5')),'defaultValue':_0x11f8('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x11f8('0x6')]},'providerName':{'type':Sequelize[_0x11f8('0x7')]},'providerResponse':{'type':Sequelize[_0x11f8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b893a7a..16b5efe 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 _0x4790=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./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','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','OpenchannelInteraction','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','agent','manual','interface','channel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','contact','SIP/%s','motionChannel','reject','rejectmessage','zip-dir'];(function(_0x284282,_0x2a4869){var _0x3eb80a=function(_0xed0b92){while(--_0xed0b92){_0x284282['push'](_0x284282['shift']());}};_0x3eb80a(++_0x2a4869);}(_0x4790,0x105));var _0x0479=function(_0x35e124,_0x1d85e2){_0x35e124=_0x35e124-0x0;var _0x53c482=_0x4790[_0x35e124];return _0x53c482;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0479('0x0'));var jsonpatch=require(_0x0479('0x1'));var rp=require(_0x0479('0x2'));var moment=require('moment');var BPromise=require(_0x0479('0x3'));var Mustache=require(_0x0479('0x4'));var util=require(_0x0479('0x5'));var path=require(_0x0479('0x6'));var sox=require('sox');var csv=require(_0x0479('0x7'));var ejs=require(_0x0479('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0479('0x9'));var squel=require(_0x0479('0xa'));var crypto=require(_0x0479('0xb'));var jsforce=require(_0x0479('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0479('0x7'));var querystring=require('querystring');var Papa=require(_0x0479('0xd'));var Redis=require(_0x0479('0xe'));var authService=require(_0x0479('0xf'));var qs=require(_0x0479('0x10'));var as=require(_0x0479('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0479('0x12'))(_0x0479('0x13'));var utils=require(_0x0479('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0479('0x15'));var db=require(_0x0479('0x16'))['db'];config[_0x0479('0x17')]=_[_0x0479('0x18')](config[_0x0479('0x17')],{'host':_0x0479('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0479('0x17')]));require(_0x0479('0x1a'))[_0x0479('0x1b')](socket);var jayson=require(_0x0479('0x1c'));var client=jayson[_0x0479('0x1d')][_0x0479('0x1e')]({'port':0x232c});var client9002=jayson[_0x0479('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1148b0,_0x199b3f,_0x5d9064,_0x55e781){return new BPromise(function(_0xf2b865,_0x30ed96){var _0x4247b4=_0x55e781||client;return _0x4247b4[_0x0479('0x1f')](_0x1148b0,_0x5d9064)[_0x0479('0x20')](function(_0x7ab047){logger[_0x0479('0x21')](_0x0479('0x22'),_0x199b3f,_0x0479('0x23'));logger[_0x0479('0x24')](_0x0479('0x25'),_0x199b3f,_0x0479('0x23'),JSON['stringify'](_0x7ab047));if(_0x7ab047[_0x0479('0x26')]){if(_0x7ab047['error']['code']===0x1f4){logger[_0x0479('0x26')](_0x0479('0x22'),_0x199b3f,_0x7ab047[_0x0479('0x26')][_0x0479('0x27')]);return _0x30ed96(_0x7ab047['error'][_0x0479('0x27')]);}logger[_0x0479('0x26')](_0x0479('0x22'),_0x199b3f,_0x7ab047[_0x0479('0x26')][_0x0479('0x27')]);return _0xf2b865(_0x7ab047[_0x0479('0x26')][_0x0479('0x27')]);}else{logger[_0x0479('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x199b3f,_0x0479('0x23'));_0xf2b865(_0x7ab047[_0x0479('0x28')][_0x0479('0x27')]);}})[_0x0479('0x29')](function(_0x2396f5){logger[_0x0479('0x26')](_0x0479('0x22'),_0x199b3f,_0x2396f5);_0x30ed96(_0x2396f5);});});}function respondWithStatusCode(_0x1ef592,_0x528929){_0x528929=_0x528929||0xcc;return function(_0x49b487){if(_0x49b487){return _0x1ef592[_0x0479('0x2a')](_0x528929);}return _0x1ef592[_0x0479('0x2b')](_0x528929)[_0x0479('0x2c')]();};}function respondWithResult(_0x7787f,_0x5b5bde){_0x5b5bde=_0x5b5bde||0xc8;return function(_0x200e3a){if(_0x200e3a){return _0x7787f['status'](_0x5b5bde)[_0x0479('0x2d')](_0x200e3a);}};}function respondWithFilteredResult(_0x1e474c,_0x141a60){return function(_0x3f3521){if(_0x3f3521){var _0x8018a7=typeof _0x141a60['offset']==='undefined'&&typeof _0x141a60['limit']===_0x0479('0x2e');var _0x20dac6=_0x3f3521[_0x0479('0x2f')];var _0x37910a=_0x8018a7?0x0:_0x141a60[_0x0479('0x30')];var _0x400887=_0x8018a7?_0x3f3521[_0x0479('0x2f')]:_0x141a60[_0x0479('0x30')]+_0x141a60[_0x0479('0x31')];var _0x197901;if(_0x400887>=_0x20dac6){_0x400887=_0x20dac6;_0x197901=0xc8;}else{_0x197901=0xce;}_0x1e474c[_0x0479('0x2b')](_0x197901);return _0x1e474c['set'](_0x0479('0x32'),_0x37910a+'-'+_0x400887+'/'+_0x20dac6)[_0x0479('0x2d')](_0x3f3521);}return null;};}function patchUpdates(_0x55c695){return function(_0x49ef1b){try{jsonpatch[_0x0479('0x33')](_0x49ef1b,_0x55c695,!![]);}catch(_0x3c58d9){return BPromise['reject'](_0x3c58d9);}return _0x49ef1b[_0x0479('0x34')]();};}function saveUpdates(_0x438bc6,_0x3b6d50){return function(_0x2dc2d0){if(_0x2dc2d0){return _0x2dc2d0[_0x0479('0x35')](_0x438bc6)['then'](function(_0x5a398b){return _0x5a398b;});}return null;};}function removeEntity(_0xab33da,_0x54ab8c){return function(_0x1326fb){if(_0x1326fb){return _0x1326fb[_0x0479('0x36')]()[_0x0479('0x20')](function(){_0xab33da[_0x0479('0x2b')](0xcc)[_0x0479('0x2c')]();});}};}function handleEntityNotFound(_0x2f1692,_0x561e78){return function(_0x48b815){if(!_0x48b815){_0x2f1692[_0x0479('0x2a')](0x194);}return _0x48b815;};}function handleError(_0xc6434d,_0x1a4ac5){_0x1a4ac5=_0x1a4ac5||0x1f4;return function(_0x2554e5){logger[_0x0479('0x26')](_0x2554e5['stack']);if(_0x2554e5[_0x0479('0x37')]){delete _0x2554e5[_0x0479('0x37')];}_0xc6434d[_0x0479('0x2b')](_0x1a4ac5)[_0x0479('0x38')](_0x2554e5);};}exports[_0x0479('0x39')]=function(_0x5801eb,_0x4ff2a5){var _0x2da38d={},_0x5b9129={},_0x32a3e4={'count':0x0,'rows':[]};var _0x283413=_[_0x0479('0x3a')](db[_0x0479('0x3b')][_0x0479('0x3c')],function(_0x4d7411){return{'name':_0x4d7411[_0x0479('0x3d')],'type':_0x4d7411[_0x0479('0x3e')]['key']};});_0x5b9129[_0x0479('0x3f')]=_['map'](_0x283413,_0x0479('0x37'));_0x5b9129[_0x0479('0x40')]=_[_0x0479('0x41')](_0x5801eb['query']);_0x5b9129[_0x0479('0x42')]=_['intersection'](_0x5b9129[_0x0479('0x3f')],_0x5b9129[_0x0479('0x40')]);_0x2da38d[_0x0479('0x43')]=_[_0x0479('0x44')](_0x5b9129[_0x0479('0x3f')],qs[_0x0479('0x45')](_0x5801eb[_0x0479('0x40')][_0x0479('0x45')]));_0x2da38d[_0x0479('0x43')]=_0x2da38d['attributes'][_0x0479('0x46')]?_0x2da38d['attributes']:_0x5b9129[_0x0479('0x3f')];if(!_0x5801eb[_0x0479('0x40')][_0x0479('0x47')](_0x0479('0x48'))){_0x2da38d['limit']=qs[_0x0479('0x31')](_0x5801eb[_0x0479('0x40')]['limit']);_0x2da38d[_0x0479('0x30')]=qs[_0x0479('0x30')](_0x5801eb['query'][_0x0479('0x30')]);}_0x2da38d['order']=qs[_0x0479('0x49')](_0x5801eb['query'][_0x0479('0x49')]);_0x2da38d[_0x0479('0x4a')]=qs[_0x0479('0x42')](_[_0x0479('0x4b')](_0x5801eb[_0x0479('0x40')],_0x5b9129[_0x0479('0x42')]),_0x283413);if(_0x5801eb[_0x0479('0x40')][_0x0479('0x4c')]){_0x2da38d[_0x0479('0x4a')]=_[_0x0479('0x4d')](_0x2da38d['where'],{'$or':_[_0x0479('0x3a')](_0x283413,function(_0x24e54d){if(_0x24e54d['type']!==_0x0479('0x4e')){var _0x23973e={};_0x23973e[_0x24e54d[_0x0479('0x37')]]={'$like':'%'+_0x5801eb[_0x0479('0x40')][_0x0479('0x4c')]+'%'};return _0x23973e;}})});}_0x2da38d=_[_0x0479('0x4d')]({},_0x2da38d,_0x5801eb[_0x0479('0x4f')]);var _0x5cf95c={'where':_0x2da38d['where']};return db['OpenchannelMessage'][_0x0479('0x2f')](_0x5cf95c)['then'](function(_0x1bbbf4){_0x32a3e4[_0x0479('0x2f')]=_0x1bbbf4;if(_0x5801eb[_0x0479('0x40')][_0x0479('0x50')]){_0x2da38d[_0x0479('0x51')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0479('0x52')](_0x2da38d);})[_0x0479('0x20')](function(_0x3112e4){_0x32a3e4['rows']=_0x3112e4;return _0x32a3e4;})[_0x0479('0x20')](respondWithFilteredResult(_0x4ff2a5,_0x2da38d))[_0x0479('0x29')](handleError(_0x4ff2a5,null));};exports[_0x0479('0x53')]=function(_0x53ebd6,_0x281d56){var _0x36fa93={'raw':!![],'where':{'id':_0x53ebd6[_0x0479('0x54')]['id']}},_0x3f1607={};_0x3f1607[_0x0479('0x3f')]=_['keys'](db[_0x0479('0x3b')]['rawAttributes']);_0x3f1607[_0x0479('0x40')]=_[_0x0479('0x41')](_0x53ebd6[_0x0479('0x40')]);_0x3f1607['filters']=_['intersection'](_0x3f1607[_0x0479('0x3f')],_0x3f1607['query']);_0x36fa93['attributes']=_[_0x0479('0x44')](_0x3f1607[_0x0479('0x3f')],qs[_0x0479('0x45')](_0x53ebd6[_0x0479('0x40')][_0x0479('0x45')]));_0x36fa93['attributes']=_0x36fa93['attributes']['length']?_0x36fa93['attributes']:_0x3f1607['model'];if(_0x53ebd6[_0x0479('0x40')][_0x0479('0x50')]){_0x36fa93[_0x0479('0x51')]=[{'all':!![]}];}_0x36fa93=_[_0x0479('0x4d')]({},_0x36fa93,_0x53ebd6['options']);return db[_0x0479('0x3b')][_0x0479('0x55')](_0x36fa93)[_0x0479('0x20')](handleEntityNotFound(_0x281d56,null))['then'](respondWithResult(_0x281d56,null))[_0x0479('0x29')](handleError(_0x281d56,null));};exports['create']=function(_0x3c3429,_0x2a4bf1){return db[_0x0479('0x3b')][_0x0479('0x56')](_0x3c3429[_0x0479('0x57')],{})[_0x0479('0x20')](respondWithResult(_0x2a4bf1,0xc9))[_0x0479('0x29')](handleError(_0x2a4bf1,null));};exports[_0x0479('0x35')]=function(_0x46878e,_0x2cf991){if(_0x46878e[_0x0479('0x57')]['id']){delete _0x46878e[_0x0479('0x57')]['id'];}return db[_0x0479('0x3b')][_0x0479('0x55')]({'where':{'id':_0x46878e[_0x0479('0x54')]['id']}})['then'](handleEntityNotFound(_0x2cf991,null))[_0x0479('0x20')](saveUpdates(_0x46878e[_0x0479('0x57')],null))[_0x0479('0x20')](respondWithResult(_0x2cf991,null))['catch'](handleError(_0x2cf991,null));};exports['destroy']=function(_0x5a3e45,_0x542ac6){return db[_0x0479('0x3b')][_0x0479('0x55')]({'where':{'id':_0x5a3e45[_0x0479('0x54')]['id']}})[_0x0479('0x20')](handleEntityNotFound(_0x542ac6,null))[_0x0479('0x20')](removeEntity(_0x542ac6,null))[_0x0479('0x29')](handleError(_0x542ac6,null));};exports[_0x0479('0x58')]=function(_0x1fe206,_0x25f280){return db['OpenchannelMessage']['describe']()[_0x0479('0x20')](respondWithResult(_0x25f280,null))[_0x0479('0x29')](handleError(_0x25f280,null));};var interaction_log=require(_0x0479('0x12'))(_0x0479('0x59'));exports['accept']=function(_0x566ecf,_0x5bd361,_0x218835){var _0x3d51a9={'agent':{},'channel':_0x0479('0x5a')};if(_0x566ecf['body']['id']){delete _0x566ecf[_0x0479('0x57')]['id'];}_0x566ecf[_0x0479('0x57')][_0x0479('0x5b')]=!![];_0x566ecf[_0x0479('0x57')][_0x0479('0x5c')]=moment()[_0x0479('0x5d')](_0x0479('0x5e'));_0x566ecf[_0x0479('0x57')]['UserId']=_0x566ecf[_0x0479('0x57')]['UserId']||_0x566ecf[_0x0479('0x5f')]['id'];_0x3d51a9['agent']['id']=_0x566ecf[_0x0479('0x57')][_0x0479('0x60')];return db['OpenchannelMessage'][_0x0479('0x55')]({'where':{'id':_0x566ecf[_0x0479('0x54')]['id'],'UserId':null}})[_0x0479('0x20')](handleEntityNotFound(_0x5bd361,null))[_0x0479('0x20')](saveUpdates(_0x566ecf[_0x0479('0x57')],null))[_0x0479('0x20')](function(_0x980174){if(_0x980174){_0x3d51a9[_0x0479('0x27')]=_0x980174[_0x0479('0x61')]({'plain':!![]});return db[_0x0479('0x62')][_0x0479('0x55')]({'where':{'id':_0x980174['OpenchannelInteractionId']}});}return null;})[_0x0479('0x20')](handleEntityNotFound(_0x5bd361,null))[_0x0479('0x20')](function(_0x5345c2){if(_0x5345c2){return _0x5345c2[_0x0479('0x35')]({'UserId':_0x566ecf[_0x0479('0x57')][_0x0479('0x60')],'read1stAt':_['isNil'](_0x5345c2[_0x0479('0x63')])?moment()[_0x0479('0x5d')](_0x0479('0x5e')):undefined});}return null;})['then'](function(_0x7e7664){if(_0x7e7664){_0x3d51a9[_0x0479('0x64')]=_0x7e7664[_0x0479('0x61')]({'plain':!![]});interaction_log[_0x0479('0x21')](_0x0479('0x65'),_0x566ecf[_0x0479('0x5f')]['id'],_0x566ecf['user']['name'],_0x566ecf['user']['role'],_0x3d51a9[_0x0479('0x64')]['id'],_0x566ecf['body']?JSON[_0x0479('0x66')](_0x566ecf['body']):'null');return respondWithRpcPromise(_0x0479('0x67'),_0x0479('0x68'),_0x3d51a9);}return null;})[_0x0479('0x20')](function(_0xdb6723){var _0x19861a=_0x0479('0x69')+_0xdb6723[_0x0479('0x27')][_0x0479('0x6a')];return db[_0x0479('0x6b')][_0x0479('0x40')](_0x19861a,{'type':db[_0x0479('0x6c')][_0x0479('0x6d')][_0x0479('0x6e')],'raw':!![]})[_0x0479('0x20')](function(_0x1fd991){return _0x1fd991;});})['then'](function(_0x3a9b6f){if(_0x3a9b6f){_0x3d51a9['message']['contact']=_0x3a9b6f[0x0];if(!_0x566ecf[_0x0479('0x57')]['UserId'])return;return db[_0x0479('0x6f')]['find']({'where':{'id':_0x566ecf[_0x0479('0x57')][_0x0479('0x60')],'role':'agent'},'attributes':['id','name',_0x0479('0x70'),_0x0479('0x71'),_0x0479('0x72')],'raw':!![]});}return null;})['then'](function(_0x5ccac3){if(!_0x5ccac3)return null;_0x3d51a9[_0x0479('0x27')][_0x0479('0x73')]=_0x5ccac3;return _0x3d51a9;})[_0x0479('0x20')](function(_0x2637e5){if(_0x2637e5){if(_0x566ecf[_0x0479('0x57')][_0x0479('0x74')]){_0x3d51a9[_0x0479('0x27')][_0x0479('0x75')]=util['format']('SIP/%s',_0x566ecf[_0x0479('0x5f')][_0x0479('0x37')]);_0x3d51a9[_0x0479('0x27')][_0x0479('0x76')]=_0x3d51a9[_0x0479('0x76')];_0x3d51a9[_0x0479('0x27')]['motionChannel']=_0x3d51a9['channel'];_0x3d51a9[_0x0479('0x27')][_0x0479('0x77')]='accept';return respondWithRpcPromise('EventManager',_0x0479('0x78'),{'event':_0x0479('0x79'),'message':_0x3d51a9[_0x0479('0x27')]},client9002)[_0x0479('0x20')](function(){return _0x3d51a9;});}return _0x3d51a9;}return null;})[_0x0479('0x20')](respondWithResult(_0x5bd361,null))[_0x0479('0x29')](handleError(_0x5bd361,null));};var interaction_log=require(_0x0479('0x12'))(_0x0479('0x59'));exports['reject']=function(_0x4b90ef,_0x800547,_0x5e7a5e){var _0x5829a4={'agent':{},'channel':'openchannel'};if(_0x4b90ef[_0x0479('0x57')]['id']){delete _0x4b90ef['body']['id'];}_0x4b90ef[_0x0479('0x57')][_0x0479('0x60')]=_0x4b90ef[_0x0479('0x57')][_0x0479('0x60')]||_0x4b90ef['user']['id'];_0x5829a4[_0x0479('0x73')]['id']=_0x4b90ef[_0x0479('0x57')]['UserId'];return db['OpenchannelMessage'][_0x0479('0x55')]({'where':{'id':_0x4b90ef[_0x0479('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x800547,null))[_0x0479('0x20')](function(_0x27fe19){if(_0x27fe19){_0x5829a4[_0x0479('0x27')]=_0x27fe19['get']({'plain':!![]});return db[_0x0479('0x62')]['find']({'where':{'id':_0x27fe19['OpenchannelInteractionId']}});}return null;})[_0x0479('0x20')](handleEntityNotFound(_0x800547,null))[_0x0479('0x20')](function(_0x478111){if(_0x478111){_0x5829a4[_0x0479('0x64')]=_0x478111['get']({'plain':!![]});interaction_log[_0x0479('0x21')](_0x0479('0x7a'),_0x4b90ef[_0x0479('0x5f')]['id'],_0x4b90ef[_0x0479('0x5f')][_0x0479('0x37')],_0x4b90ef['user'][_0x0479('0x7b')],_0x5829a4[_0x0479('0x64')]['id'],_0x4b90ef[_0x0479('0x57')]?JSON[_0x0479('0x66')](_0x4b90ef[_0x0479('0x57')]):_0x0479('0x7c'));return respondWithRpcPromise(_0x0479('0x7d'),'rejectMessage',_0x5829a4);}return null;})[_0x0479('0x20')](function(_0x1f94c3){var _0x525a7e=_0x0479('0x69')+_0x1f94c3[_0x0479('0x27')][_0x0479('0x6a')];return db[_0x0479('0x6b')][_0x0479('0x40')](_0x525a7e,{'type':db[_0x0479('0x6c')][_0x0479('0x6d')][_0x0479('0x6e')],'raw':!![]})['then'](function(_0x603c24){return _0x603c24;});})['then'](function(_0x21ab85){if(_0x21ab85){_0x5829a4[_0x0479('0x27')][_0x0479('0x7e')]=_0x21ab85[0x0];if(!_0x4b90ef[_0x0479('0x57')]['UserId'])return;return db[_0x0479('0x6f')][_0x0479('0x55')]({'where':{'id':_0x4b90ef['body']['UserId'],'role':_0x0479('0x73')},'attributes':['id',_0x0479('0x37'),_0x0479('0x70'),_0x0479('0x71'),_0x0479('0x72')],'raw':!![]});}return null;})['then'](function(_0x2ad51c){if(!_0x2ad51c)return null;_0x5829a4[_0x0479('0x27')][_0x0479('0x73')]=_0x2ad51c;return _0x5829a4;})[_0x0479('0x20')](function(_0x51b14b){if(_0x51b14b){_0x51b14b[_0x0479('0x27')]['interface']=util['format'](_0x0479('0x7f'),_0x4b90ef['user'][_0x0479('0x37')]);_0x51b14b[_0x0479('0x27')][_0x0479('0x76')]=_0x5829a4[_0x0479('0x76')];_0x51b14b[_0x0479('0x27')][_0x0479('0x80')]=_0x5829a4[_0x0479('0x76')];_0x51b14b[_0x0479('0x27')][_0x0479('0x77')]=_0x0479('0x81');respondWithRpcPromise(_0x0479('0x78'),_0x0479('0x78'),{'event':_0x0479('0x82'),'message':_0x51b14b[_0x0479('0x27')]},client9002);return _0x5829a4;}return null;})[_0x0479('0x20')](respondWithResult(_0x800547,null))[_0x0479('0x29')](handleError(_0x800547,null));}; \ No newline at end of file +var _0x1b64=['to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','debug','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','params','include','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js'];(function(_0x2a58f6,_0x13961e){var _0x37f349=function(_0x3be41c){while(--_0x3be41c){_0x2a58f6['push'](_0x2a58f6['shift']());}};_0x37f349(++_0x13961e);}(_0x1b64,0x76));var _0x41b6=function(_0x58d19c,_0x1612de){_0x58d19c=_0x58d19c-0x0;var _0x19cdb5=_0x1b64[_0x58d19c];return _0x19cdb5;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41b6('0x3'));var util=require(_0x41b6('0x4'));var path=require(_0x41b6('0x5'));var sox=require(_0x41b6('0x6'));var csv=require('to-csv');var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41b6('0x9'));var deskjs=require(_0x41b6('0xa'));var toCsv=require(_0x41b6('0xb'));var querystring=require(_0x41b6('0xc'));var Papa=require(_0x41b6('0xd'));var Redis=require(_0x41b6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x41b6('0xf'));var as=require(_0x41b6('0x10'));var hardwareService=require(_0x41b6('0x11'));var logger=require(_0x41b6('0x12'))(_0x41b6('0x13'));var utils=require(_0x41b6('0x14'));var config=require(_0x41b6('0x15'));var licenseUtil=require(_0x41b6('0x16'));var db=require(_0x41b6('0x17'))['db'];config[_0x41b6('0x18')]=_[_0x41b6('0x19')](config[_0x41b6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x41b6('0x1a'))(new Redis(config[_0x41b6('0x18')]));require(_0x41b6('0x1b'))[_0x41b6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232c});var client9002=jayson[_0x41b6('0x1d')][_0x41b6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d4441,_0x1bd0b0,_0x30f076,_0x4805de){return new BPromise(function(_0x13ce57,_0xf0d6ae){var _0x1b2500=_0x4805de||client;return _0x1b2500[_0x41b6('0x1f')](_0x1d4441,_0x30f076)[_0x41b6('0x20')](function(_0x47feb9){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1bd0b0,'request\x20sent');logger[_0x41b6('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1bd0b0,_0x41b6('0x22'),JSON[_0x41b6('0x23')](_0x47feb9));if(_0x47feb9[_0x41b6('0x24')]){if(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x25')]===0x1f4){logger[_0x41b6('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x1bd0b0,_0x47feb9['error'][_0x41b6('0x26')]);return _0xf0d6ae(_0x47feb9['error'][_0x41b6('0x26')]);}logger[_0x41b6('0x24')](_0x41b6('0x27'),_0x1bd0b0,_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);return _0x13ce57(_0x47feb9[_0x41b6('0x24')][_0x41b6('0x26')]);}else{logger[_0x41b6('0x28')](_0x41b6('0x27'),_0x1bd0b0,_0x41b6('0x22'));_0x13ce57(_0x47feb9[_0x41b6('0x29')]['message']);}})[_0x41b6('0x2a')](function(_0x2c1290){logger['error'](_0x41b6('0x27'),_0x1bd0b0,_0x2c1290);_0xf0d6ae(_0x2c1290);});});}function respondWithStatusCode(_0x358872,_0x4f98de){_0x4f98de=_0x4f98de||0xcc;return function(_0x22d399){if(_0x22d399){return _0x358872[_0x41b6('0x2b')](_0x4f98de);}return _0x358872[_0x41b6('0x2c')](_0x4f98de)['end']();};}function respondWithResult(_0x40a466,_0x5e431d){_0x5e431d=_0x5e431d||0xc8;return function(_0x49142b){if(_0x49142b){return _0x40a466['status'](_0x5e431d)[_0x41b6('0x2d')](_0x49142b);}};}function respondWithFilteredResult(_0x425c16,_0x5b5ca7){return function(_0x2dee1f){if(_0x2dee1f){var _0x45f9e2=typeof _0x5b5ca7[_0x41b6('0x2e')]===_0x41b6('0x2f')&&typeof _0x5b5ca7[_0x41b6('0x30')]==='undefined';var _0x5a0554=_0x2dee1f[_0x41b6('0x31')];var _0x37bd7a=_0x45f9e2?0x0:_0x5b5ca7[_0x41b6('0x2e')];var _0x56b365=_0x45f9e2?_0x2dee1f[_0x41b6('0x31')]:_0x5b5ca7[_0x41b6('0x2e')]+_0x5b5ca7['limit'];var _0x27a737;if(_0x56b365>=_0x5a0554){_0x56b365=_0x5a0554;_0x27a737=0xc8;}else{_0x27a737=0xce;}_0x425c16[_0x41b6('0x2c')](_0x27a737);return _0x425c16[_0x41b6('0x32')](_0x41b6('0x33'),_0x37bd7a+'-'+_0x56b365+'/'+_0x5a0554)[_0x41b6('0x2d')](_0x2dee1f);}return null;};}function patchUpdates(_0x2ac3a7){return function(_0x1c47b1){try{jsonpatch['apply'](_0x1c47b1,_0x2ac3a7,!![]);}catch(_0x13562f){return BPromise['reject'](_0x13562f);}return _0x1c47b1['save']();};}function saveUpdates(_0x2235fd,_0x4cf4d5){return function(_0x207412){if(_0x207412){return _0x207412[_0x41b6('0x34')](_0x2235fd)[_0x41b6('0x20')](function(_0x435639){return _0x435639;});}return null;};}function removeEntity(_0xc97805,_0x3c5141){return function(_0x420e40){if(_0x420e40){return _0x420e40[_0x41b6('0x35')]()['then'](function(){_0xc97805[_0x41b6('0x2c')](0xcc)[_0x41b6('0x36')]();});}};}function handleEntityNotFound(_0x326e10,_0x459186){return function(_0x13f0ad){if(!_0x13f0ad){_0x326e10[_0x41b6('0x2b')](0x194);}return _0x13f0ad;};}function handleError(_0x462340,_0x58112e){_0x58112e=_0x58112e||0x1f4;return function(_0x69277a){logger['error'](_0x69277a['stack']);if(_0x69277a[_0x41b6('0x37')]){delete _0x69277a[_0x41b6('0x37')];}_0x462340[_0x41b6('0x2c')](_0x58112e)[_0x41b6('0x38')](_0x69277a);};}exports[_0x41b6('0x39')]=function(_0x2291ba,_0x5b7e9d){var _0x19a73e={},_0x4313a5={},_0x2c3f43={'count':0x0,'rows':[]};var _0x442ec7=_[_0x41b6('0x3a')](db[_0x41b6('0x3b')][_0x41b6('0x3c')],function(_0x565ff8){return{'name':_0x565ff8[_0x41b6('0x3d')],'type':_0x565ff8[_0x41b6('0x3e')][_0x41b6('0x3f')]};});_0x4313a5[_0x41b6('0x40')]=_[_0x41b6('0x3a')](_0x442ec7,_0x41b6('0x37'));_0x4313a5[_0x41b6('0x41')]=_[_0x41b6('0x42')](_0x2291ba[_0x41b6('0x41')]);_0x4313a5[_0x41b6('0x43')]=_[_0x41b6('0x44')](_0x4313a5[_0x41b6('0x40')],_0x4313a5['query']);_0x19a73e[_0x41b6('0x45')]=_[_0x41b6('0x44')](_0x4313a5[_0x41b6('0x40')],qs[_0x41b6('0x46')](_0x2291ba[_0x41b6('0x41')][_0x41b6('0x46')]));_0x19a73e['attributes']=_0x19a73e['attributes'][_0x41b6('0x47')]?_0x19a73e[_0x41b6('0x45')]:_0x4313a5['model'];if(!_0x2291ba['query'][_0x41b6('0x48')](_0x41b6('0x49'))){_0x19a73e[_0x41b6('0x30')]=qs['limit'](_0x2291ba['query'][_0x41b6('0x30')]);_0x19a73e['offset']=qs[_0x41b6('0x2e')](_0x2291ba[_0x41b6('0x41')][_0x41b6('0x2e')]);}_0x19a73e[_0x41b6('0x4a')]=qs[_0x41b6('0x4b')](_0x2291ba['query'][_0x41b6('0x4b')]);_0x19a73e[_0x41b6('0x4c')]=qs[_0x41b6('0x43')](_[_0x41b6('0x4d')](_0x2291ba['query'],_0x4313a5[_0x41b6('0x43')]),_0x442ec7);if(_0x2291ba[_0x41b6('0x41')][_0x41b6('0x4e')]){_0x19a73e[_0x41b6('0x4c')]=_[_0x41b6('0x4f')](_0x19a73e[_0x41b6('0x4c')],{'$or':_[_0x41b6('0x3a')](_0x442ec7,function(_0x575e7f){if(_0x575e7f[_0x41b6('0x3e')]!=='VIRTUAL'){var _0x2e2764={};_0x2e2764[_0x575e7f[_0x41b6('0x37')]]={'$like':'%'+_0x2291ba['query'][_0x41b6('0x4e')]+'%'};return _0x2e2764;}})});}_0x19a73e=_[_0x41b6('0x4f')]({},_0x19a73e,_0x2291ba['options']);var _0x11c8b5={'where':_0x19a73e[_0x41b6('0x4c')]};return db[_0x41b6('0x3b')][_0x41b6('0x31')](_0x11c8b5)[_0x41b6('0x20')](function(_0x5ac0b2){_0x2c3f43[_0x41b6('0x31')]=_0x5ac0b2;if(_0x2291ba[_0x41b6('0x41')][_0x41b6('0x50')]){_0x19a73e['include']=[{'all':!![]}];}return db[_0x41b6('0x3b')][_0x41b6('0x51')](_0x19a73e);})[_0x41b6('0x20')](function(_0xdc4286){_0x2c3f43[_0x41b6('0x52')]=_0xdc4286;return _0x2c3f43;})[_0x41b6('0x20')](respondWithFilteredResult(_0x5b7e9d,_0x19a73e))[_0x41b6('0x2a')](handleError(_0x5b7e9d,null));};exports['show']=function(_0x565d5d,_0x2384bb){var _0x4eca3a={'raw':!![],'where':{'id':_0x565d5d[_0x41b6('0x53')]['id']}},_0x489186={};_0x489186[_0x41b6('0x40')]=_[_0x41b6('0x42')](db[_0x41b6('0x3b')][_0x41b6('0x3c')]);_0x489186[_0x41b6('0x41')]=_['keys'](_0x565d5d[_0x41b6('0x41')]);_0x489186['filters']=_[_0x41b6('0x44')](_0x489186['model'],_0x489186[_0x41b6('0x41')]);_0x4eca3a[_0x41b6('0x45')]=_['intersection'](_0x489186[_0x41b6('0x40')],qs[_0x41b6('0x46')](_0x565d5d[_0x41b6('0x41')][_0x41b6('0x46')]));_0x4eca3a[_0x41b6('0x45')]=_0x4eca3a[_0x41b6('0x45')][_0x41b6('0x47')]?_0x4eca3a[_0x41b6('0x45')]:_0x489186[_0x41b6('0x40')];if(_0x565d5d[_0x41b6('0x41')][_0x41b6('0x50')]){_0x4eca3a[_0x41b6('0x54')]=[{'all':!![]}];}_0x4eca3a=_[_0x41b6('0x4f')]({},_0x4eca3a,_0x565d5d[_0x41b6('0x55')]);return db[_0x41b6('0x3b')][_0x41b6('0x56')](_0x4eca3a)['then'](handleEntityNotFound(_0x2384bb,null))['then'](respondWithResult(_0x2384bb,null))['catch'](handleError(_0x2384bb,null));};exports[_0x41b6('0x57')]=function(_0x208dd9,_0x1d5dad){return db[_0x41b6('0x3b')][_0x41b6('0x57')](_0x208dd9[_0x41b6('0x58')],{})[_0x41b6('0x20')](respondWithResult(_0x1d5dad,0xc9))[_0x41b6('0x2a')](handleError(_0x1d5dad,null));};exports[_0x41b6('0x34')]=function(_0x1b69e3,_0x4f918c){if(_0x1b69e3['body']['id']){delete _0x1b69e3[_0x41b6('0x58')]['id'];}return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x1b69e3[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0x4f918c,null))[_0x41b6('0x20')](saveUpdates(_0x1b69e3[_0x41b6('0x58')],null))[_0x41b6('0x20')](respondWithResult(_0x4f918c,null))[_0x41b6('0x2a')](handleError(_0x4f918c,null));};exports[_0x41b6('0x35')]=function(_0x2a5185,_0xea54ab){return db['OpenchannelMessage'][_0x41b6('0x56')]({'where':{'id':_0x2a5185[_0x41b6('0x53')]['id']}})[_0x41b6('0x20')](handleEntityNotFound(_0xea54ab,null))[_0x41b6('0x20')](removeEntity(_0xea54ab,null))['catch'](handleError(_0xea54ab,null));};exports['describe']=function(_0x1e8ddb,_0x575806){return db['OpenchannelMessage'][_0x41b6('0x59')]()[_0x41b6('0x20')](respondWithResult(_0x575806,null))[_0x41b6('0x2a')](handleError(_0x575806,null));};var interaction_log=require(_0x41b6('0x12'))(_0x41b6('0x5a'));exports[_0x41b6('0x5b')]=function(_0x5f033b,_0x2a00b7,_0x3b6854){var _0x4f52fe={'agent':{},'channel':_0x41b6('0x5c')};if(_0x5f033b[_0x41b6('0x58')]['id']){delete _0x5f033b['body']['id'];}_0x5f033b[_0x41b6('0x58')][_0x41b6('0x5d')]=!![];_0x5f033b[_0x41b6('0x58')][_0x41b6('0x5e')]=moment()[_0x41b6('0x5f')](_0x41b6('0x60'));_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')]=_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')]||_0x5f033b['user']['id'];_0x4f52fe[_0x41b6('0x62')]['id']=_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')];return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x5f033b[_0x41b6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2a00b7,null))[_0x41b6('0x20')](saveUpdates(_0x5f033b[_0x41b6('0x58')],null))[_0x41b6('0x20')](function(_0x5bf8d5){if(_0x5bf8d5){_0x4f52fe['message']=_0x5bf8d5[_0x41b6('0x63')]({'plain':!![]});return db[_0x41b6('0x64')]['find']({'where':{'id':_0x5bf8d5['OpenchannelInteractionId']}});}return null;})[_0x41b6('0x20')](handleEntityNotFound(_0x2a00b7,null))['then'](function(_0x32fa3f){if(_0x32fa3f){return _0x32fa3f[_0x41b6('0x34')]({'UserId':_0x5f033b[_0x41b6('0x58')]['UserId'],'read1stAt':_[_0x41b6('0x65')](_0x32fa3f[_0x41b6('0x66')])?moment()['format'](_0x41b6('0x60')):undefined});}return null;})['then'](function(_0x29863e){if(_0x29863e){_0x4f52fe[_0x41b6('0x67')]=_0x29863e[_0x41b6('0x63')]({'plain':!![]});interaction_log[_0x41b6('0x28')](_0x41b6('0x68'),_0x5f033b[_0x41b6('0x69')]['id'],_0x5f033b['user']['name'],_0x5f033b[_0x41b6('0x69')]['role'],_0x4f52fe[_0x41b6('0x67')]['id'],_0x5f033b[_0x41b6('0x58')]?JSON[_0x41b6('0x23')](_0x5f033b[_0x41b6('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x41b6('0x6a'),_0x4f52fe);}return null;})[_0x41b6('0x20')](function(_0x5c5941){var _0x3c175c=_0x41b6('0x6b')+_0x5c5941['message'][_0x41b6('0x6c')];return db[_0x41b6('0x6d')][_0x41b6('0x41')](_0x3c175c,{'type':db[_0x41b6('0x6e')][_0x41b6('0x6f')][_0x41b6('0x70')],'raw':!![]})[_0x41b6('0x20')](function(_0x4cd1e1){return _0x4cd1e1;});})[_0x41b6('0x20')](function(_0x2f21b5){if(_0x2f21b5){_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x71')]=_0x2f21b5[0x0];if(!_0x5f033b[_0x41b6('0x58')]['UserId'])return;return db[_0x41b6('0x72')][_0x41b6('0x56')]({'where':{'id':_0x5f033b[_0x41b6('0x58')][_0x41b6('0x61')],'role':_0x41b6('0x62')},'attributes':['id',_0x41b6('0x37'),_0x41b6('0x73'),_0x41b6('0x74'),_0x41b6('0x75')],'raw':!![]});}return null;})[_0x41b6('0x20')](function(_0x139c80){if(!_0x139c80)return null;_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x62')]=_0x139c80;return _0x4f52fe;})[_0x41b6('0x20')](function(_0x58bec3){if(_0x58bec3){if(_0x5f033b[_0x41b6('0x58')][_0x41b6('0x76')]){_0x4f52fe['message'][_0x41b6('0x77')]=util[_0x41b6('0x5f')](_0x41b6('0x78'),_0x5f033b['user'][_0x41b6('0x37')]);_0x4f52fe['message'][_0x41b6('0x79')]=_0x4f52fe['channel'];_0x4f52fe[_0x41b6('0x26')][_0x41b6('0x7a')]=_0x4f52fe[_0x41b6('0x79')];_0x4f52fe['message'][_0x41b6('0x7b')]='accept';return respondWithRpcPromise(_0x41b6('0x7c'),_0x41b6('0x7c'),{'event':'acceptmessage','message':_0x4f52fe[_0x41b6('0x26')]},client9002)[_0x41b6('0x20')](function(){return _0x4f52fe;});}return _0x4f52fe;}return null;})[_0x41b6('0x20')](respondWithResult(_0x2a00b7,null))[_0x41b6('0x2a')](handleError(_0x2a00b7,null));};var interaction_log=require(_0x41b6('0x12'))(_0x41b6('0x5a'));exports['reject']=function(_0x4fd1ca,_0xa6a559,_0x5ad34e){var _0x4c866f={'agent':{},'channel':_0x41b6('0x5c')};if(_0x4fd1ca[_0x41b6('0x58')]['id']){delete _0x4fd1ca['body']['id'];}_0x4fd1ca[_0x41b6('0x58')][_0x41b6('0x61')]=_0x4fd1ca[_0x41b6('0x58')][_0x41b6('0x61')]||_0x4fd1ca[_0x41b6('0x69')]['id'];_0x4c866f['agent']['id']=_0x4fd1ca['body'][_0x41b6('0x61')];return db[_0x41b6('0x3b')][_0x41b6('0x56')]({'where':{'id':_0x4fd1ca[_0x41b6('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa6a559,null))['then'](function(_0x17405a){if(_0x17405a){_0x4c866f[_0x41b6('0x26')]=_0x17405a[_0x41b6('0x63')]({'plain':!![]});return db[_0x41b6('0x64')]['find']({'where':{'id':_0x17405a['OpenchannelInteractionId']}});}return null;})[_0x41b6('0x20')](handleEntityNotFound(_0xa6a559,null))[_0x41b6('0x20')](function(_0x442eaa){if(_0x442eaa){_0x4c866f[_0x41b6('0x67')]=_0x442eaa[_0x41b6('0x63')]({'plain':!![]});interaction_log['info'](_0x41b6('0x7d'),_0x4fd1ca['user']['id'],_0x4fd1ca[_0x41b6('0x69')][_0x41b6('0x37')],_0x4fd1ca[_0x41b6('0x69')]['role'],_0x4c866f['interaction']['id'],_0x4fd1ca[_0x41b6('0x58')]?JSON['stringify'](_0x4fd1ca[_0x41b6('0x58')]):_0x41b6('0x7e'));return respondWithRpcPromise('RejectMessage',_0x41b6('0x7f'),_0x4c866f);}return null;})[_0x41b6('0x20')](function(_0x2919b2){var _0x5d1f05='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2919b2[_0x41b6('0x26')][_0x41b6('0x6c')];return db[_0x41b6('0x6d')][_0x41b6('0x41')](_0x5d1f05,{'type':db[_0x41b6('0x6e')][_0x41b6('0x6f')][_0x41b6('0x70')],'raw':!![]})['then'](function(_0x104edd){return _0x104edd;});})[_0x41b6('0x20')](function(_0x6afdc3){if(_0x6afdc3){_0x4c866f['message'][_0x41b6('0x71')]=_0x6afdc3[0x0];if(!_0x4fd1ca['body'][_0x41b6('0x61')])return;return db[_0x41b6('0x72')][_0x41b6('0x56')]({'where':{'id':_0x4fd1ca['body']['UserId'],'role':_0x41b6('0x62')},'attributes':['id','name',_0x41b6('0x73'),_0x41b6('0x74'),_0x41b6('0x75')],'raw':!![]});}return null;})['then'](function(_0x5851ab){if(!_0x5851ab)return null;_0x4c866f[_0x41b6('0x26')]['agent']=_0x5851ab;return _0x4c866f;})[_0x41b6('0x20')](function(_0x206e03){if(_0x206e03){_0x206e03[_0x41b6('0x26')]['interface']=util[_0x41b6('0x5f')]('SIP/%s',_0x4fd1ca[_0x41b6('0x69')][_0x41b6('0x37')]);_0x206e03[_0x41b6('0x26')][_0x41b6('0x79')]=_0x4c866f['channel'];_0x206e03[_0x41b6('0x26')][_0x41b6('0x7a')]=_0x4c866f[_0x41b6('0x79')];_0x206e03[_0x41b6('0x26')][_0x41b6('0x7b')]='reject';respondWithRpcPromise(_0x41b6('0x7c'),'EventManager',{'event':_0x41b6('0x80'),'message':_0x206e03[_0x41b6('0x26')]},client9002);return _0x4c866f;}return null;})[_0x41b6('0x20')](respondWithResult(_0xa6a559,null))[_0x41b6('0x2a')](handleError(_0xa6a559,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 4333081..f82c1d7 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 _0xdf2a=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x450983,_0x8520a4){var _0x51819e=function(_0x5df17d){while(--_0x5df17d){_0x450983['push'](_0x450983['shift']());}};_0x51819e(++_0x8520a4);}(_0xdf2a,0x83));var _0xadf2=function(_0x289ab8,_0x318dd8){_0x289ab8=_0x289ab8-0x0;var _0x309e45=_0xdf2a[_0x289ab8];return _0x309e45;};'use strict';var EventEmitter=require(_0xadf2('0x0'));var OpenchannelMessage=require(_0xadf2('0x1'))['db'][_0xadf2('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xadf2('0x3')](0x0);var events={'afterCreate':_0xadf2('0x4'),'afterUpdate':_0xadf2('0x5'),'afterDestroy':_0xadf2('0x6')};function emitEvent(_0x12a549){return function(_0xb341ab,_0x28e1cf,_0x512eaf){OpenchannelMessageEvents[_0xadf2('0x7')](_0x12a549+':'+_0xb341ab['id'],_0xb341ab);OpenchannelMessageEvents[_0xadf2('0x7')](_0x12a549,_0xb341ab);_0x512eaf(null);};}for(var e in events){if(events[_0xadf2('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xf33d=['hasOwnProperty','hook','exports','events','OpenchannelMessage','save','update','emit'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xf33d,0xa3));var _0xdf33=function(_0x1c979b,_0x3e246d){_0x1c979b=_0x1c979b-0x0;var _0x142b09=_0xf33d[_0x1c979b];return _0x142b09;};'use strict';var EventEmitter=require(_0xdf33('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xdf33('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf33('0x2'),'afterUpdate':_0xdf33('0x3'),'afterDestroy':'remove'};function emitEvent(_0x126e7f){return function(_0x792011,_0xb64f7f,_0x354229){OpenchannelMessageEvents['emit'](_0x126e7f+':'+_0x792011['id'],_0x792011);OpenchannelMessageEvents[_0xdf33('0x4')](_0x126e7f,_0x792011);_0x354229(null);};}for(var e in events){if(events[_0xdf33('0x5')](e)){var event=events[e];OpenchannelMessage[_0xdf33('0x6')](e,emitEvent(event));}}module[_0xdf33('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b6bdfab..695cc1f 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 _0xbaf0=['out','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Contact','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch'];(function(_0x40abc8,_0x58b903){var _0x3b2bdd=function(_0x2efd3d){while(--_0x2efd3d){_0x40abc8['push'](_0x40abc8['shift']());}};_0x3b2bdd(++_0x58b903);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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':'fti_openchannel_messages','fields':[_0x0baf('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4605c3,_0x2c7442,_0x465528){var _0x2f46e8=_0xe4c3c4[_0x0baf('0xe')];var _0xf4c8ac=_0x4605c3[_0x0baf('0xf')]({'plain':!![]});if(_0xf4c8ac[_0x0baf('0x10')][_0x0baf('0x11')]()==='in'||_0xf4c8ac[_0x0baf('0x10')][_0x0baf('0x11')]()==='out'&&!_0xf4c8ac['secret']&&!_[_0x0baf('0x12')](_0xf4c8ac[_0x0baf('0x13')])){_0x2f46e8[_0x0baf('0x14')][_0x0baf('0x15')]({'where':{'id':_0xf4c8ac['OpenchannelInteractionId']}})[_0x0baf('0x16')](function(_0x49e44b){if(_0x49e44b){_0x49e44b[_0x0baf('0x17')]({'lastMsgAt':_0xf4c8ac[_0x0baf('0x18')],'lastMsgDirection':_0xf4c8ac[_0x0baf('0x10')][_0x0baf('0x11')]()});}})[_0x0baf('0x19')](function(_0x469599){console['error'](_0x469599);});}if(_0xf4c8ac['direction']===_0x0baf('0x1a')&&!_0xf4c8ac[_0x0baf('0x1b')]){var _0x283408;_0x2f46e8[_0x0baf('0x1c')][_0x0baf('0x1d')]()[_0x0baf('0x16')](function(_0x53c338){return _0x2f46e8[_0x0baf('0x1e')][_0x0baf('0x1f')]({'where':{'id':_0xf4c8ac[_0x0baf('0x20')]},'include':[{'model':_0x2f46e8[_0x0baf('0x14')],'as':_0x0baf('0x21'),'where':{'id':_0xf4c8ac[_0x0baf('0x22')]},'limit':0x1,'include':[{'model':_0x2f46e8['CmContact'],'as':'Contact','attributes':_[_0x0baf('0x23')](_0x53c338)}]}]});})[_0x0baf('0x16')](function(_0x32e839){_0x283408=_0x32e839[_0x0baf('0xf')]({'plain':!![]});if(_0x283408&&_0x283408[_0x0baf('0x24')]){logger[_0x0baf('0x25')](_0x0baf('0x26'),_0x0baf('0x27'),util[_0x0baf('0x28')](_0x0baf('0x29'),_0xf4c8ac['id'],_0x283408['replyUri']));if(_0x283408[_0x0baf('0x21')]&&_0x283408['Interactions'][_0x0baf('0x2a')]){_0xf4c8ac['Interaction']=_['omit'](_0x283408[_0x0baf('0x21')][0x0],'Contact');_0xf4c8ac['Contact']=_0x283408[_0x0baf('0x21')][0x0][_0x0baf('0x2b')];}var _0x2c7442={'method':_0x0baf('0x2c'),'uri':encodeURI(_0x283408[_0x0baf('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2c7442['method']){case _0x0baf('0x2d'):_0x2c7442['qs']=_0xf4c8ac;break;case _0x0baf('0x2c'):_0x2c7442[_0x0baf('0xd')]=_0xf4c8ac;break;}return rp(_0x2c7442)[_0x0baf('0x16')](function(_0x3843b8){logger[_0x0baf('0x25')](_0x0baf('0x26'),'afterCreate',util[_0x0baf('0x28')](_0x0baf('0x2e'),_0xf4c8ac['id'],_0x283408[_0x0baf('0x24')]));if(_0x3843b8[_0x0baf('0xd')]['threadId']&&_0x3843b8[_0x0baf('0xd')][_0x0baf('0x2f')]!=_0xf4c8ac['Interaction'][_0x0baf('0x2f')]){return _0x2f46e8[_0x0baf('0x14')][_0x0baf('0x17')]({'threadId':_0x3843b8[_0x0baf('0xd')][_0x0baf('0x2f')]},{'logging':!![],'where':{'id':_0xf4c8ac[_0x0baf('0x30')]['id']}});}else{return;}})[_0x0baf('0x16')](function(){return _0x4605c3['update']({'read':!![]});})[_0x0baf('0x19')](function(_0x156ed7){logger[_0x0baf('0x31')](_0x0baf('0x26'),_0x0baf('0x27'),util[_0x0baf('0x32')](_0x156ed7,{'showHidden':![],'depth':null}));_0x465528();});}else{_0x465528();}})[_0x0baf('0x33')](function(){_0x465528();});}else{_0x465528();}}},'charset':_0x0baf('0x34'),'collate':_0x0baf('0x35')});}; \ No newline at end of file +var _0x5eb8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','omit','POST','method','GET','info','body','Interaction','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys'];(function(_0x1ec03d,_0x281710){var _0x2e22d8=function(_0x371302){while(--_0x371302){_0x1ec03d['push'](_0x1ec03d['shift']());}};_0x2e22d8(++_0x281710);}(_0x5eb8,0xb0));var _0x85eb=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0x5eb8[_0x460dae];return _0x36e6d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[{'name':_0x85eb('0xc'),'fields':['body'],'type':_0x85eb('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50ea77,_0x1f0036,_0x40d6b6){var _0x673228=_0x2bf83c[_0x85eb('0xe')];var _0x1dacf2=_0x50ea77[_0x85eb('0xf')]({'plain':!![]});if(_0x1dacf2[_0x85eb('0x10')]['toLowerCase']()==='in'||_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()==='out'&&!_0x1dacf2[_0x85eb('0x12')]&&!_[_0x85eb('0x13')](_0x1dacf2[_0x85eb('0x14')])){_0x673228[_0x85eb('0x15')]['findOne']({'where':{'id':_0x1dacf2['OpenchannelInteractionId']}})[_0x85eb('0x16')](function(_0x5c760a){if(_0x5c760a){_0x5c760a[_0x85eb('0x17')]({'lastMsgAt':_0x1dacf2[_0x85eb('0x18')],'lastMsgDirection':_0x1dacf2[_0x85eb('0x10')][_0x85eb('0x11')]()});}})[_0x85eb('0x19')](function(_0x49efdf){console[_0x85eb('0x1a')](_0x49efdf);});}if(_0x1dacf2['direction']===_0x85eb('0x1b')&&!_0x1dacf2[_0x85eb('0x12')]){var _0x3e23e8;_0x673228[_0x85eb('0x1c')]['describe']()['then'](function(_0x50d2a8){return _0x673228[_0x85eb('0x1d')][_0x85eb('0x1e')]({'where':{'id':_0x1dacf2[_0x85eb('0x1f')]},'include':[{'model':_0x673228[_0x85eb('0x15')],'as':_0x85eb('0x20'),'where':{'id':_0x1dacf2[_0x85eb('0x21')]},'limit':0x1,'include':[{'model':_0x673228['CmContact'],'as':_0x85eb('0x22'),'attributes':_[_0x85eb('0x23')](_0x50d2a8)}]}]});})[_0x85eb('0x16')](function(_0x4e8041){_0x3e23e8=_0x4e8041['get']({'plain':!![]});if(_0x3e23e8&&_0x3e23e8['replyUri']){logger['info'](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')](_0x85eb('0x27'),_0x1dacf2['id'],_0x3e23e8[_0x85eb('0x28')]));if(_0x3e23e8[_0x85eb('0x20')]&&_0x3e23e8['Interactions']['length']){_0x1dacf2['Interaction']=_[_0x85eb('0x29')](_0x3e23e8[_0x85eb('0x20')][0x0],_0x85eb('0x22'));_0x1dacf2[_0x85eb('0x22')]=_0x3e23e8[_0x85eb('0x20')][0x0][_0x85eb('0x22')];}var _0x1f0036={'method':_0x85eb('0x2a'),'uri':encodeURI(_0x3e23e8[_0x85eb('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f0036[_0x85eb('0x2b')]){case _0x85eb('0x2c'):_0x1f0036['qs']=_0x1dacf2;break;case _0x85eb('0x2a'):_0x1f0036['body']=_0x1dacf2;break;}return rp(_0x1f0036)[_0x85eb('0x16')](function(_0x792d3a){logger[_0x85eb('0x2d')](_0x85eb('0x24'),_0x85eb('0x25'),util[_0x85eb('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1dacf2['id'],_0x3e23e8['replyUri']));if(_0x792d3a[_0x85eb('0x2e')]['threadId']&&_0x792d3a[_0x85eb('0x2e')]['threadId']!=_0x1dacf2[_0x85eb('0x2f')][_0x85eb('0x30')]){return _0x673228[_0x85eb('0x15')][_0x85eb('0x17')]({'threadId':_0x792d3a[_0x85eb('0x2e')][_0x85eb('0x30')]},{'logging':!![],'where':{'id':_0x1dacf2[_0x85eb('0x2f')]['id']}});}else{return;}})['then'](function(){return _0x50ea77[_0x85eb('0x17')]({'read':!![]});})[_0x85eb('0x19')](function(_0x515ee9){logger[_0x85eb('0x1a')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x85eb('0x31')](_0x515ee9,{'showHidden':![],'depth':null}));_0x40d6b6();});}else{_0x40d6b6();}})[_0x85eb('0x32')](function(){_0x40d6b6();});}else{_0x40d6b6();}}},'charset':_0x85eb('0x33'),'collate':_0x85eb('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9074271..4e1a0aa 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(_0x16af07,_0x3cf14f){var _0x1fb4a4=function(_0x540b66){while(--_0x540b66){_0x16af07['push'](_0x16af07['shift']());}};_0x1fb4a4(++_0x3cf14f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d91ec,_0x221f68){_0x1d91ec=_0x1d91ec-0x0;var _0x31a81b=_0x5f2f[_0x1d91ec];return _0x31a81b;};'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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x29a6e8,_0x370c7d){var _0x22ddea=function(_0x545e23){while(--_0x545e23){_0x29a6e8['push'](_0x29a6e8['shift']());}};_0x22ddea(++_0x370c7d);}(_0x7a54,0x106));var _0x47a5=function(_0x3614ff,_0x305917){_0x3614ff=_0x3614ff-0x0;var _0x3f1b22=_0x7a54[_0x3614ff];return _0x3f1b22;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 714aa7c..34be2a1 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 _0x96e8=['openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener','register','length'];(function(_0xa3308b,_0x326bc0){var _0x1c831a=function(_0x34be31){while(--_0x34be31){_0xa3308b['push'](_0xa3308b['shift']());}};_0x1c831a(++_0x326bc0);}(_0x96e8,0x99));var _0x896e=function(_0x472858,_0x8ab7dd){_0x472858=_0x472858-0x0;var _0x444c5f=_0x96e8[_0x472858];return _0x444c5f;};'use strict';var OpenchannelMessageEvents=require(_0x896e('0x0'));var events=[_0x896e('0x1'),_0x896e('0x2'),'update'];function createListener(_0x5bb160,_0xa921ec){return function(_0x1c2462){_0xa921ec[_0x896e('0x3')](_0x5bb160,_0x1c2462);};}function removeListener(_0x410364,_0x16ce4a){return function(){OpenchannelMessageEvents[_0x896e('0x4')](_0x410364,_0x16ce4a);};}exports[_0x896e('0x5')]=function(_0x38f8d3){for(var _0x535783=0x0,_0x29dac4=events[_0x896e('0x6')];_0x535783<_0x29dac4;_0x535783++){var _0x148d7b=events[_0x535783];var _0x5943b2=createListener(_0x896e('0x7')+_0x148d7b,_0x38f8d3);OpenchannelMessageEvents['on'](_0x148d7b,_0x5943b2);}}; \ No newline at end of file +var _0x9f83=['openchannelMessage:','./openchannelMessage.events','remove','update','emit','removeListener','length'];(function(_0x1e4b82,_0x567a06){var _0x506bf6=function(_0x2ef2e6){while(--_0x2ef2e6){_0x1e4b82['push'](_0x1e4b82['shift']());}};_0x506bf6(++_0x567a06);}(_0x9f83,0x1ac));var _0x39f8=function(_0x4d3d8c,_0x49177c){_0x4d3d8c=_0x4d3d8c-0x0;var _0x956010=_0x9f83[_0x4d3d8c];return _0x956010;};'use strict';var OpenchannelMessageEvents=require(_0x39f8('0x0'));var events=['save',_0x39f8('0x1'),_0x39f8('0x2')];function createListener(_0x512085,_0x5cf0a1){return function(_0x606925){_0x5cf0a1[_0x39f8('0x3')](_0x512085,_0x606925);};}function removeListener(_0x380223,_0x2e80ca){return function(){OpenchannelMessageEvents[_0x39f8('0x4')](_0x380223,_0x2e80ca);};}exports['register']=function(_0x34072a){for(var _0x1202cf=0x0,_0x5832c1=events[_0x39f8('0x5')];_0x1202cf<_0x5832c1;_0x1202cf++){var _0x161f9f=events[_0x1202cf];var _0x2f2121=createListener(_0x39f8('0x6')+_0x161f9f,_0x34072a);OpenchannelMessageEvents['on'](_0x161f9f,_0x2f2121);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 76d19aa..07ab472 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 _0x9ce4=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9ce4,0x1b3));var _0x49ce=function(_0x237f07,_0x2142a9){_0x237f07=_0x237f07-0x0;var _0x22c133=_0x9ce4[_0x237f07];return _0x22c133;};'use strict';var multer=require('multer');var util=require(_0x49ce('0x0'));var path=require('path');var timeout=require(_0x49ce('0x1'));var express=require(_0x49ce('0x2'));var router=express[_0x49ce('0x3')]();var fs_extra=require(_0x49ce('0x4'));var auth=require(_0x49ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x49ce('0x6'));var controller=require(_0x49ce('0x7'));router[_0x49ce('0x8')]('/',auth[_0x49ce('0x9')](),controller[_0x49ce('0xa')]);router[_0x49ce('0x8')](_0x49ce('0xb'),auth[_0x49ce('0x9')](),controller[_0x49ce('0xc')]);router[_0x49ce('0x8')]('/:id',auth[_0x49ce('0x9')](),controller[_0x49ce('0xd')]);router[_0x49ce('0x8')](_0x49ce('0xe'),auth[_0x49ce('0x9')](),controller['getMembers']);router['get'](_0x49ce('0xf'),auth[_0x49ce('0x9')](),controller[_0x49ce('0x10')]);router[_0x49ce('0x8')](_0x49ce('0x11'),auth[_0x49ce('0x9')](),controller[_0x49ce('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49ce('0x13')]);router[_0x49ce('0x14')]('/:id/teams',auth[_0x49ce('0x9')](),controller['addTeams']);router[_0x49ce('0x14')](_0x49ce('0x11'),auth[_0x49ce('0x9')](),controller[_0x49ce('0x15')]);router[_0x49ce('0x16')](_0x49ce('0x17'),auth[_0x49ce('0x9')](),controller[_0x49ce('0x18')]);router[_0x49ce('0x19')](_0x49ce('0x17'),auth['isAuthenticated'](),controller[_0x49ce('0x1a')]);router[_0x49ce('0x19')](_0x49ce('0xf'),auth[_0x49ce('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x49ce('0x1b')]);module[_0x49ce('0x1c')]=router; \ No newline at end of file +var _0x3033=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x75eeb1,_0xf52588){var _0x29ff24=function(_0x2c1322){while(--_0x2c1322){_0x75eeb1['push'](_0x75eeb1['shift']());}};_0x29ff24(++_0xf52588);}(_0x3033,0x81));var _0x3303=function(_0x11f69f,_0x1604f6){_0x11f69f=_0x11f69f-0x0;var _0x849d17=_0x3033[_0x11f69f];return _0x849d17;};'use strict';var multer=require(_0x3303('0x0'));var util=require(_0x3303('0x1'));var path=require(_0x3303('0x2'));var timeout=require(_0x3303('0x3'));var express=require(_0x3303('0x4'));var router=express[_0x3303('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3303('0x6'));var interaction=require(_0x3303('0x7'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x3303('0x8')]('/',auth[_0x3303('0x9')](),controller[_0x3303('0xa')]);router['get'](_0x3303('0xb'),auth['isAuthenticated'](),controller[_0x3303('0xc')]);router[_0x3303('0x8')](_0x3303('0xd'),auth[_0x3303('0x9')](),controller[_0x3303('0xe')]);router[_0x3303('0x8')](_0x3303('0xf'),auth[_0x3303('0x9')](),controller['getMembers']);router[_0x3303('0x8')](_0x3303('0x10'),auth['isAuthenticated'](),controller[_0x3303('0x11')]);router[_0x3303('0x8')]('/:id/users',auth[_0x3303('0x9')](),controller[_0x3303('0x12')]);router[_0x3303('0x13')]('/',auth[_0x3303('0x9')](),controller[_0x3303('0x14')]);router[_0x3303('0x13')]('/:id/teams',auth[_0x3303('0x9')](),controller[_0x3303('0x15')]);router[_0x3303('0x13')](_0x3303('0x16'),auth[_0x3303('0x9')](),controller[_0x3303('0x17')]);router[_0x3303('0x18')](_0x3303('0xd'),auth[_0x3303('0x9')](),controller[_0x3303('0x19')]);router[_0x3303('0x1a')](_0x3303('0xd'),auth[_0x3303('0x9')](),controller['destroy']);router[_0x3303('0x1a')](_0x3303('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x3303('0x16'),auth['isAuthenticated'](),controller[_0x3303('0x1b')]);module[_0x3303('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 93720e8..517d0d7 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 _0xe51b=['name','STRING','ENUM','beepall','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe51b,0x100));var _0xbe51=function(_0x4bea95,_0x2026cb){_0x4bea95=_0x4bea95-0x0;var _0x52aa29=_0xe51b[_0x4bea95];return _0x52aa29;};'use strict';var Sequelize=require(_0xbe51('0x0'));module[_0xbe51('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbe51('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbe51('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe51('0x4')]('rrmemory',_0xbe51('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x55df=['STRING','name','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x55df,0x12b));var _0xf55d=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x55df[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0xf55d('0x0'));module[_0xf55d('0x1')]={'name':{'type':Sequelize[_0xf55d('0x2')],'unique':_0xf55d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf55d('0x2')]},'timeout':{'type':Sequelize[_0xf55d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf55d('0x5')](_0xf55d('0x6'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 964d0b6..de687ae 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 _0x712e=['index','map','OpenchannelQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','error','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','pick','OpenchannelQueueId','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','transaction','each','emit','userOpenchannelQueue:save','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send'];(function(_0x411979,_0x2834f8){var _0x4098fb=function(_0x2f6ab0){while(--_0x2f6ab0){_0x411979['push'](_0x411979['shift']());}};_0x4098fb(++_0x2834f8);}(_0x712e,0x18b));var _0xe712=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x712e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe712('0x0'));var zipdir=require(_0xe712('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe712('0x2'));var moment=require(_0xe712('0x3'));var BPromise=require(_0xe712('0x4'));var Mustache=require(_0xe712('0x5'));var util=require('util');var path=require(_0xe712('0x6'));var sox=require(_0xe712('0x7'));var csv=require(_0xe712('0x8'));var ejs=require(_0xe712('0x9'));var fs=require('fs');var fs_extra=require(_0xe712('0xa'));var _=require(_0xe712('0xb'));var squel=require(_0xe712('0xc'));var crypto=require('crypto');var jsforce=require(_0xe712('0xd'));var deskjs=require(_0xe712('0xe'));var toCsv=require(_0xe712('0x8'));var querystring=require(_0xe712('0xf'));var Papa=require(_0xe712('0x10'));var Redis=require(_0xe712('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe712('0x12'));var as=require(_0xe712('0x13'));var hardwareService=require(_0xe712('0x14'));var logger=require('../../config/logger')(_0xe712('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe712('0x16'))['db'];config['redis']=_[_0xe712('0x17')](config[_0xe712('0x18')],{'host':_0xe712('0x19'),'port':0x18eb});var socket=require(_0xe712('0x1a'))(new Redis(config[_0xe712('0x18')]));require('./openchannelQueue.socket')[_0xe712('0x1b')](socket);function respondWithStatusCode(_0x277dd9,_0x59b449){_0x59b449=_0x59b449||0xcc;return function(_0x3d4c8e){if(_0x3d4c8e){return _0x277dd9[_0xe712('0x1c')](_0x59b449);}return _0x277dd9['status'](_0x59b449)[_0xe712('0x1d')]();};}function respondWithResult(_0x18c46e,_0x32e904){_0x32e904=_0x32e904||0xc8;return function(_0xec948f){if(_0xec948f){return _0x18c46e['status'](_0x32e904)[_0xe712('0x1e')](_0xec948f);}};}function respondWithFilteredResult(_0x506d50,_0x559e77){return function(_0x3e2873){if(_0x3e2873){var _0x1a3336=typeof _0x559e77[_0xe712('0x1f')]===_0xe712('0x20')&&typeof _0x559e77[_0xe712('0x21')]==='undefined';var _0x2e3d74=_0x3e2873[_0xe712('0x22')];var _0x481024=_0x1a3336?0x0:_0x559e77[_0xe712('0x1f')];var _0x3771a3=_0x1a3336?_0x3e2873['count']:_0x559e77[_0xe712('0x1f')]+_0x559e77[_0xe712('0x21')];var _0x25ee7a;if(_0x3771a3>=_0x2e3d74){_0x3771a3=_0x2e3d74;_0x25ee7a=0xc8;}else{_0x25ee7a=0xce;}_0x506d50[_0xe712('0x23')](_0x25ee7a);return _0x506d50[_0xe712('0x24')](_0xe712('0x25'),_0x481024+'-'+_0x3771a3+'/'+_0x2e3d74)[_0xe712('0x1e')](_0x3e2873);}return null;};}function patchUpdates(_0x3f60a5){return function(_0x1affdc){try{jsonpatch[_0xe712('0x26')](_0x1affdc,_0x3f60a5,!![]);}catch(_0x4804bd){return BPromise[_0xe712('0x27')](_0x4804bd);}return _0x1affdc[_0xe712('0x28')]();};}function saveUpdates(_0x5d1c76,_0x2c1723){return function(_0x345d8e){if(_0x345d8e){return _0x345d8e[_0xe712('0x29')](_0x5d1c76)[_0xe712('0x2a')](function(_0x245813){return _0x245813;});}return null;};}function removeEntity(_0x5577e0,_0x1c7776){return function(_0x53a2ee){if(_0x53a2ee){return _0x53a2ee[_0xe712('0x2b')]()[_0xe712('0x2a')](function(){var _0x17e10e=_0x53a2ee[_0xe712('0x2c')]({'plain':!![]});var _0x5ed250='OpenchannelQueues';return db[_0xe712('0x2d')][_0xe712('0x2b')]({'where':{'type':_0x5ed250,'resourceId':_0x17e10e['id']}})[_0xe712('0x2a')](function(){return _0x53a2ee;});})['then'](function(){_0x5577e0[_0xe712('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3afa48,_0x2f52fb){return function(_0x3d043a){if(!_0x3d043a){_0x3afa48[_0xe712('0x1c')](0x194);}return _0x3d043a;};}function handleError(_0x619638,_0x1a47e3){_0x1a47e3=_0x1a47e3||0x1f4;return function(_0x4e54ac){logger['error'](_0x4e54ac[_0xe712('0x2e')]);if(_0x4e54ac[_0xe712('0x2f')]){delete _0x4e54ac[_0xe712('0x2f')];}_0x619638[_0xe712('0x23')](_0x1a47e3)[_0xe712('0x30')](_0x4e54ac);};}exports[_0xe712('0x31')]=function(_0x31e446,_0xde392c){var _0x316855={},_0x204560={},_0x349f68={'count':0x0,'rows':[]};var _0x2a7512=_[_0xe712('0x32')](db[_0xe712('0x33')]['rawAttributes'],function(_0x154fc3){return{'name':_0x154fc3[_0xe712('0x34')],'type':_0x154fc3[_0xe712('0x35')][_0xe712('0x36')]};});_0x204560[_0xe712('0x37')]=_[_0xe712('0x32')](_0x2a7512,_0xe712('0x2f'));_0x204560[_0xe712('0x38')]=_[_0xe712('0x39')](_0x31e446[_0xe712('0x38')]);_0x204560[_0xe712('0x3a')]=_[_0xe712('0x3b')](_0x204560[_0xe712('0x37')],_0x204560['query']);_0x316855[_0xe712('0x3c')]=_[_0xe712('0x3b')](_0x204560[_0xe712('0x37')],qs[_0xe712('0x3d')](_0x31e446[_0xe712('0x38')][_0xe712('0x3d')]));_0x316855['attributes']=_0x316855['attributes'][_0xe712('0x3e')]?_0x316855[_0xe712('0x3c')]:_0x204560[_0xe712('0x37')];if(!_0x31e446['query'][_0xe712('0x3f')](_0xe712('0x40'))){_0x316855[_0xe712('0x21')]=qs['limit'](_0x31e446[_0xe712('0x38')][_0xe712('0x21')]);_0x316855[_0xe712('0x1f')]=qs['offset'](_0x31e446[_0xe712('0x38')]['offset']);}_0x316855[_0xe712('0x41')]=qs[_0xe712('0x42')](_0x31e446[_0xe712('0x38')][_0xe712('0x42')]);_0x316855[_0xe712('0x43')]=qs[_0xe712('0x3a')](_['pick'](_0x31e446[_0xe712('0x38')],_0x204560[_0xe712('0x3a')]),_0x2a7512);if(_0x31e446[_0xe712('0x38')][_0xe712('0x44')]){_0x316855[_0xe712('0x43')]=_[_0xe712('0x45')](_0x316855[_0xe712('0x43')],{'$or':_[_0xe712('0x32')](_0x2a7512,function(_0x5f2808){if(_0x5f2808[_0xe712('0x35')]!==_0xe712('0x46')){var _0x292978={};_0x292978[_0x5f2808['name']]={'$like':'%'+_0x31e446[_0xe712('0x38')][_0xe712('0x44')]+'%'};return _0x292978;}})});}_0x316855=_['merge']({},_0x316855,_0x31e446[_0xe712('0x47')]);var _0x2de426={'where':_0x316855[_0xe712('0x43')]};return db[_0xe712('0x33')][_0xe712('0x22')](_0x2de426)['then'](function(_0xaedf7){_0x349f68[_0xe712('0x22')]=_0xaedf7;if(_0x31e446[_0xe712('0x38')]['includeAll']){_0x316855[_0xe712('0x48')]=[{'all':!![]}];}return db[_0xe712('0x33')][_0xe712('0x49')](_0x316855);})[_0xe712('0x2a')](function(_0x272151){_0x349f68[_0xe712('0x4a')]=_0x272151;return _0x349f68;})[_0xe712('0x2a')](respondWithFilteredResult(_0xde392c,_0x316855))[_0xe712('0x4b')](handleError(_0xde392c,null));};exports[_0xe712('0x4c')]=function(_0x1f5f16,_0x40d808){var _0x3aa93a={'raw':!![],'where':{'id':_0x1f5f16[_0xe712('0x4d')]['id']}},_0x120466={};_0x120466[_0xe712('0x37')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x120466['query']=_[_0xe712('0x39')](_0x1f5f16['query']);_0x120466[_0xe712('0x3a')]=_[_0xe712('0x3b')](_0x120466[_0xe712('0x37')],_0x120466['query']);_0x3aa93a[_0xe712('0x3c')]=_[_0xe712('0x3b')](_0x120466['model'],qs[_0xe712('0x3d')](_0x1f5f16[_0xe712('0x38')][_0xe712('0x3d')]));_0x3aa93a[_0xe712('0x3c')]=_0x3aa93a[_0xe712('0x3c')][_0xe712('0x3e')]?_0x3aa93a['attributes']:_0x120466[_0xe712('0x37')];if(_0x1f5f16[_0xe712('0x38')]['includeAll']){_0x3aa93a[_0xe712('0x48')]=[{'all':!![]}];}_0x3aa93a=_[_0xe712('0x45')]({},_0x3aa93a,_0x1f5f16[_0xe712('0x47')]);return db[_0xe712('0x33')][_0xe712('0x4e')](_0x3aa93a)['then'](handleEntityNotFound(_0x40d808,null))[_0xe712('0x2a')](respondWithResult(_0x40d808,null))[_0xe712('0x4b')](handleError(_0x40d808,null));};exports[_0xe712('0x4f')]=function(_0x6baa7f,_0xa35a7b){return db['OpenchannelQueue'][_0xe712('0x4f')](_0x6baa7f[_0xe712('0x50')],{})[_0xe712('0x2a')](function(_0x49abc5){var _0x286aa9=_0x6baa7f['user'][_0xe712('0x2c')]({'plain':!![]});if(!_0x286aa9)throw new Error(_0xe712('0x51'));if(_0x286aa9[_0xe712('0x52')]===_0xe712('0x53')){var _0x4dc9fd=_0x49abc5['get']({'plain':!![]});var _0xcbc7dd=_0xe712('0x54');return db[_0xe712('0x55')][_0xe712('0x4e')]({'where':{'name':_0xcbc7dd,'userProfileId':_0x286aa9[_0xe712('0x56')]},'raw':!![]})[_0xe712('0x2a')](function(_0x275b95){if(_0x275b95&&_0x275b95[_0xe712('0x57')]===0x0){return db[_0xe712('0x2d')][_0xe712('0x4f')]({'name':_0x4dc9fd[_0xe712('0x2f')],'resourceId':_0x4dc9fd['id'],'type':_0x275b95[_0xe712('0x2f')],'sectionId':_0x275b95['id']},{})[_0xe712('0x2a')](function(){return _0x49abc5;});}else{return _0x49abc5;}})[_0xe712('0x4b')](function(_0x2227bc){logger[_0xe712('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2227bc);throw _0x2227bc;});}return _0x49abc5;})[_0xe712('0x2a')](respondWithResult(_0xa35a7b,0xc9))[_0xe712('0x4b')](handleError(_0xa35a7b,null));};exports['update']=function(_0x511264,_0x56925e){if(_0x511264['body']['id']){delete _0x511264[_0xe712('0x50')]['id'];}return db['OpenchannelQueue'][_0xe712('0x4e')]({'where':{'id':_0x511264['params']['id']}})[_0xe712('0x2a')](handleEntityNotFound(_0x56925e,null))[_0xe712('0x2a')](saveUpdates(_0x511264[_0xe712('0x50')],null))[_0xe712('0x2a')](respondWithResult(_0x56925e,null))[_0xe712('0x4b')](handleError(_0x56925e,null));};exports[_0xe712('0x2b')]=function(_0x3ff530,_0x2be008){return db[_0xe712('0x33')]['find']({'where':{'id':_0x3ff530[_0xe712('0x4d')]['id']}})[_0xe712('0x2a')](handleEntityNotFound(_0x2be008,null))[_0xe712('0x2a')](removeEntity(_0x2be008,null))[_0xe712('0x4b')](handleError(_0x2be008,null));};exports['describe']=function(_0xbf65bd,_0x529cf4){return db['OpenchannelQueue'][_0xe712('0x59')]()[_0xe712('0x2a')](respondWithResult(_0x529cf4,null))[_0xe712('0x4b')](handleError(_0x529cf4,null));};exports[_0xe712('0x5a')]=function(_0x5a4b06,_0x57ac8c,_0x425bc6){var _0x1f11df={'raw':!![],'where':{}},_0xe3fde={},_0x16df15;return db['OpenchannelQueue'][_0xe712('0x5b')]({'where':{'id':_0x5a4b06[_0xe712('0x4d')]['id']}})[_0xe712('0x2a')](handleEntityNotFound(_0x57ac8c,null))['then'](function(_0xb854b6){if(_0xb854b6){_0x16df15=_0xb854b6[_0xe712('0x2c')]({'plain':!![]});_0xe3fde['model']=_[_0xe712('0x39')](db[_0xe712('0x5c')][_0xe712('0x5d')]);_0xe3fde[_0xe712('0x38')]=_[_0xe712('0x39')](_0x5a4b06['query']);_0xe3fde[_0xe712('0x3a')]=_[_0xe712('0x3b')](_0xe3fde[_0xe712('0x37')],_0xe3fde[_0xe712('0x38')]);_0x1f11df[_0xe712('0x3c')]=_[_0xe712('0x3b')](_0xe3fde[_0xe712('0x37')],qs['fields'](_0x5a4b06[_0xe712('0x38')][_0xe712('0x3d')]));_0x1f11df[_0xe712('0x3c')]=_0x1f11df[_0xe712('0x3c')][_0xe712('0x3e')]?_0x1f11df['attributes']:_0xe3fde[_0xe712('0x37')];if(!_0x5a4b06['query']['hasOwnProperty']('nolimit')){_0x1f11df[_0xe712('0x21')]=qs[_0xe712('0x21')](_0x5a4b06['query']['limit']);_0x1f11df[_0xe712('0x1f')]=qs[_0xe712('0x1f')](_0x5a4b06[_0xe712('0x38')][_0xe712('0x1f')]);}_0x1f11df[_0xe712('0x41')]=qs[_0xe712('0x42')](_0x5a4b06[_0xe712('0x38')]['sort']);_0x1f11df[_0xe712('0x43')]=qs[_0xe712('0x3a')](_[_0xe712('0x5e')](_0x5a4b06['query'],_0xe3fde[_0xe712('0x3a')]));_0x1f11df[_0xe712('0x43')][_0xe712('0x5f')]=_0xb854b6['id'];if(_0x5a4b06['query'][_0xe712('0x44')]){_0x1f11df[_0xe712('0x43')]=_[_0xe712('0x45')](_0x1f11df[_0xe712('0x43')],{'$or':_[_0xe712('0x32')](_0x1f11df[_0xe712('0x3c')],function(_0x21bfc2){var _0x2bb7cc={};_0x2bb7cc[_0x21bfc2]={'$like':'%'+_0x5a4b06[_0xe712('0x38')][_0xe712('0x44')]+'%'};return _0x2bb7cc;})});}_0x1f11df=_[_0xe712('0x45')]({},_0x1f11df,_0x5a4b06[_0xe712('0x47')]);return db[_0xe712('0x5c')]['findAll'](_0x1f11df);}})[_0xe712('0x2a')](function(_0x1d8072){if(_0x1d8072){return db['User'][_0xe712('0x60')]({'where':{'id':_[_0xe712('0x32')](_0x1d8072,'UserId'),'role':_0xe712('0x61')},'attributes':['id','name',_0xe712('0x62'),_0xe712('0x63'),_0xe712('0x64')]});}})[_0xe712('0x2a')](function(_0x29f630){if(_0x29f630){return{'count':_0x29f630[_0xe712('0x22')],'rows':_['map'](_0x29f630[_0xe712('0x4a')],function(_0x4d2df1){return{'membername':_0x4d2df1[_0xe712('0x2f')],'UserId':_0x4d2df1['id'],'queue_name':_0x16df15[_0xe712('0x2f')],'OpenchannelQueueId':_0x16df15['id'],'interface':util[_0xe712('0x65')](_0xe712('0x66'),_0xe712('0x67'),_0x4d2df1['name']),'penalty':0x0,'paused':_0x4d2df1['openchannelPause'],'createdAt':_0x4d2df1[_0xe712('0x64')],'updatedAt':_0x4d2df1[_0xe712('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x57ac8c,_0x1f11df))['catch'](handleError(_0x57ac8c,null));};exports[_0xe712('0x68')]=function(_0x3ecb46,_0x5552da,_0x3af9a4){var _0x3328a8={};var _0x4af6f0={};var _0x2e9d9f;var _0x294b18;return db['OpenchannelQueue'][_0xe712('0x5b')]({'where':{'id':_0x3ecb46['params']['id']}})[_0xe712('0x2a')](handleEntityNotFound(_0x5552da,null))[_0xe712('0x2a')](function(_0x515212){if(_0x515212){_0x2e9d9f=_0x515212;_0x4af6f0[_0xe712('0x37')]=_[_0xe712('0x39')](db[_0xe712('0x69')]['rawAttributes']);_0x4af6f0[_0xe712('0x38')]=_[_0xe712('0x39')](_0x3ecb46[_0xe712('0x38')]);_0x4af6f0[_0xe712('0x3a')]=_['intersection'](_0x4af6f0[_0xe712('0x37')],_0x4af6f0[_0xe712('0x38')]);_0x3328a8['attributes']=_['intersection'](_0x4af6f0[_0xe712('0x37')],qs['fields'](_0x3ecb46[_0xe712('0x38')][_0xe712('0x3d')]));_0x3328a8['attributes']=_0x3328a8['attributes'][_0xe712('0x3e')]?_0x3328a8[_0xe712('0x3c')]:_0x4af6f0[_0xe712('0x37')];_0x3328a8[_0xe712('0x41')]=qs[_0xe712('0x42')](_0x3ecb46['query']['sort']);_0x3328a8[_0xe712('0x43')]=qs[_0xe712('0x3a')](_[_0xe712('0x5e')](_0x3ecb46[_0xe712('0x38')],_0x4af6f0['filters']));if(_0x3ecb46['query'][_0xe712('0x44')]){_0x3328a8[_0xe712('0x43')]=_['merge'](_0x3328a8[_0xe712('0x43')],{'$or':_[_0xe712('0x32')](_0x3328a8[_0xe712('0x3c')],function(_0x356b87){var _0x368a3c={};_0x368a3c[_0x356b87]={'$like':'%'+_0x3ecb46[_0xe712('0x38')][_0xe712('0x44')]+'%'};return _0x368a3c;})});}_0x3328a8=_[_0xe712('0x45')]({},_0x3328a8,_0x3ecb46[_0xe712('0x47')]);return _0x2e9d9f['getTeams'](_0x3328a8);}})[_0xe712('0x2a')](function(_0xbe1e4d){if(_0xbe1e4d){_0x294b18=_0xbe1e4d['length'];if(!_0x3ecb46[_0xe712('0x38')][_0xe712('0x3f')](_0xe712('0x40'))){_0x3328a8[_0xe712('0x21')]=qs[_0xe712('0x21')](_0x3ecb46[_0xe712('0x38')][_0xe712('0x21')]);_0x3328a8[_0xe712('0x1f')]=qs[_0xe712('0x1f')](_0x3ecb46[_0xe712('0x38')][_0xe712('0x1f')]);}return _0x2e9d9f[_0xe712('0x68')](_0x3328a8);}})[_0xe712('0x2a')](function(_0x42ec5a){if(_0x42ec5a){return _0x42ec5a?{'count':_0x294b18,'rows':_0x42ec5a}:null;}})[_0xe712('0x2a')](respondWithResult(_0x5552da,null))['catch'](handleError(_0x5552da,null));};exports[_0xe712('0x6a')]=function(_0xa03e4f,_0x3a4c23,_0x5c7990){var _0xcffd0e=_0xa03e4f[_0xe712('0x50')]['ids'];return db[_0xe712('0x69')][_0xe712('0x49')]({'where':{'id':_0xcffd0e},'attributes':['id'],'include':[{'model':db[_0xe712('0x6b')],'as':_0xe712('0x6c'),'attributes':['id',_0xe712('0x2f'),_0xe712('0x6d'),_0xe712('0x6e'),_0xe712('0x6f')],'raw':!![]}]})[_0xe712('0x2a')](function(_0x573f62){if(_0x573f62){var _0xdc6035=_[_0xe712('0x70')](_0x573f62,function(_0x575cf2){var _0x24a760=_0x575cf2[_0xe712('0x2c')]({'plain':!![]});return _0x24a760['Agents'];});return db['OpenchannelQueue'][_0xe712('0x4e')]({'where':{'id':_0xa03e4f[_0xe712('0x4d')]['id']}})[_0xe712('0x2a')](function(_0x3276ab){return db['sequelize'][_0xe712('0x71')](function(_0x2bb8bc){return _0x3276ab[_0xe712('0x6a')](_0xcffd0e,{'transaction':_0x2bb8bc})[_0xe712('0x2a')](function(){return BPromise[_0xe712('0x72')](_0xdc6035,function(_0x211093){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x211093['id'],'OpenchannelQueueId':_0xa03e4f['params']['id']},'transaction':_0x2bb8bc});});})['then'](function(){_0xdc6035['forEach'](function(_0x2960de){socket[_0xe712('0x73')](_0xe712('0x74'),{'UserId':_0x2960de['id'],'OpenchannelQueueId':_0x3276ab['id']});});});});});}})[_0xe712('0x2a')](respondWithStatusCode(_0x3a4c23,null))['catch'](handleError(_0x3a4c23,null));};exports['removeTeams']=function(_0x5ec90b,_0x5ab716,_0x2b9f54){return db['Team'][_0xe712('0x49')]({'where':{'id':_0x5ec90b[_0xe712('0x38')][_0xe712('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe712('0x6b')],'as':_0xe712('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5ab716,null))[_0xe712('0x2a')](function(_0x1ce08e){var _0x45b78d=_[_0xe712('0x32')](_0x1ce08e,'id');var _0x3f285e=[];var _0x120821=[];var _0x872604=squel[_0xe712('0x76')]();_0x872604[_0xe712('0x77')](_0xe712('0x78'))[_0xe712('0x79')](_0xe712('0x7a'),'tq')[_0xe712('0x7b')](_0xe712('0x7c'),'ut',_0xe712('0x7d'))[_0xe712('0x43')](_0xe712('0x7e'),_0x5ec90b[_0xe712('0x4d')]['id']);for(var _0x24ec77=0x0;_0x24ec77<_0x1ce08e['length'];_0x24ec77+=0x1){let _0x4c5470=_0x1ce08e[_0x24ec77];for(var _0xb2421e=0x0;_0xb2421e<_0x4c5470['Agents']['length'];_0xb2421e+=0x1){let _0x1015c0=_0x4c5470[_0xe712('0x6c')][_0xb2421e];var _0x30d767=_0x872604[_0xe712('0x7f')]();_0x30d767[_0xe712('0x43')](_0xe712('0x80'),_0x1015c0['id']);_0x120821[_0xe712('0x81')](db['sequelize'][_0xe712('0x38')](_0x30d767[_0xe712('0x82')](),{'type':db[_0xe712('0x83')][_0xe712('0x84')][_0xe712('0x85')]})[_0xe712('0x2a')](function(_0x437bb9){if(_0x437bb9['length']===0x1){return _0x1015c0['id'];}else{var _0x4af791=_[_0xe712('0x86')](_[_0xe712('0x32')](_0x437bb9,'TeamId'),function(_0x248dce){return _[_0xe712('0x87')](_0x45b78d,_0x248dce);});if(_0x4af791){return _0x1015c0['id'];}}}));}}return BPromise[_0xe712('0x88')](_0x120821)[_0xe712('0x2a')](function(_0x45ffaa){_0x3f285e=_(_0x3f285e)[_0xe712('0x89')](_0x45ffaa)[_0xe712('0x8a')]()['value']();return db['OpenchannelQueue'][_0xe712('0x4e')]({'where':{'id':_0x5ec90b[_0xe712('0x4d')]['id']}})[_0xe712('0x2a')](function(_0x23091c){return db[_0xe712('0x83')][_0xe712('0x71')](function(_0x35a325){return _0x23091c[_0xe712('0x8b')](_0x5ec90b[_0xe712('0x38')][_0xe712('0x75')],{'transaction':_0x35a325})['then'](function(){if(!_[_0xe712('0x8c')](_0x3f285e)){return _0x23091c[_0xe712('0x8d')](_0x3f285e,{'transaction':_0x35a325});}})[_0xe712('0x2a')](function(){_0x3f285e[_0xe712('0x8e')](function(_0x47106b){socket[_0xe712('0x73')](_0xe712('0x8f'),{'UserId':_0x47106b,'OpenchannelQueueId':_0x23091c['id']});});});});});});})[_0xe712('0x2a')](respondWithStatusCode(_0x5ab716,null))[_0xe712('0x4b')](handleError(_0x5ab716,null));};exports[_0xe712('0x90')]=function(_0x174e5,_0x2d600c,_0xcb7e3f){return db[_0xe712('0x33')]['find']({'where':{'id':_0x174e5[_0xe712('0x4d')]['id']}})[_0xe712('0x2a')](handleEntityNotFound(_0x2d600c,null))[_0xe712('0x2a')](function(_0x53bdd1){if(_0x53bdd1){return _0x53bdd1[_0xe712('0x90')](_0x174e5[_0xe712('0x50')][_0xe712('0x75')],_[_0xe712('0x91')](_0x174e5[_0xe712('0x50')],['ids','id'])||{})[_0xe712('0x92')](function(_0x1e2fae){for(var _0x2b7082=0x0;_0x2b7082<_0x174e5[_0xe712('0x50')][_0xe712('0x75')][_0xe712('0x3e')];_0x2b7082+=0x1){socket[_0xe712('0x73')](_0xe712('0x74'),{'UserId':Number(_0x174e5[_0xe712('0x50')][_0xe712('0x75')][_0x2b7082]),'OpenchannelQueueId':Number(_0x174e5['params']['id'])});}return _0x1e2fae;});}})[_0xe712('0x2a')](respondWithResult(_0x2d600c,null))[_0xe712('0x4b')](handleError(_0x2d600c,null));};exports[_0xe712('0x8d')]=function(_0x551278,_0x2cab13,_0xb39b03){return db[_0xe712('0x33')][_0xe712('0x4e')]({'where':{'id':_0x551278[_0xe712('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2cab13,null))[_0xe712('0x2a')](function(_0x2a356f){if(_0x2a356f){return _0x2a356f[_0xe712('0x8d')](_0x551278[_0xe712('0x38')][_0xe712('0x75')])[_0xe712('0x2a')](function(){if(_['isArray'](_0x551278['query']['ids'])){for(var _0x1a9d0a=0x0;_0x1a9d0a<_0x551278[_0xe712('0x38')][_0xe712('0x75')][_0xe712('0x3e')];_0x1a9d0a+=0x1){socket[_0xe712('0x73')](_0xe712('0x8f'),{'UserId':Number(_0x551278[_0xe712('0x38')][_0xe712('0x75')][_0x1a9d0a]),'OpenchannelQueueId':Number(_0x551278['params']['id'])});}}else{socket[_0xe712('0x73')](_0xe712('0x8f'),{'UserId':Number(_0x551278['query'][_0xe712('0x75')]),'OpenchannelQueueId':Number(_0x551278[_0xe712('0x4d')]['id'])});}});}})[_0xe712('0x2a')](respondWithStatusCode(_0x2cab13,null))[_0xe712('0x4b')](handleError(_0x2cab13,null));};exports[_0xe712('0x93')]=function(_0x4ace38,_0xb0b14e,_0x3f0a27){var _0x27259d={};var _0x45db86={};var _0x1a9b95;var _0x5697c2;return db[_0xe712('0x33')][_0xe712('0x5b')]({'where':{'id':_0x4ace38['params']['id']}})[_0xe712('0x2a')](handleEntityNotFound(_0xb0b14e,null))[_0xe712('0x2a')](function(_0x2f9d43){if(_0x2f9d43){_0x1a9b95=_0x2f9d43;_0x45db86['model']=_[_0xe712('0x39')](db[_0xe712('0x6b')]['rawAttributes']);_0x45db86[_0xe712('0x38')]=_[_0xe712('0x39')](_0x4ace38[_0xe712('0x38')]);_0x45db86[_0xe712('0x3a')]=_[_0xe712('0x3b')](_0x45db86[_0xe712('0x37')],_0x45db86[_0xe712('0x38')]);_0x27259d[_0xe712('0x3c')]=_[_0xe712('0x3b')](_0x45db86[_0xe712('0x37')],qs[_0xe712('0x3d')](_0x4ace38[_0xe712('0x38')][_0xe712('0x3d')]));_0x27259d[_0xe712('0x3c')]=_0x27259d[_0xe712('0x3c')][_0xe712('0x3e')]?_0x27259d[_0xe712('0x3c')]:_0x45db86[_0xe712('0x37')];_0x27259d['order']=qs['sort'](_0x4ace38[_0xe712('0x38')][_0xe712('0x42')]);_0x27259d[_0xe712('0x43')]=qs[_0xe712('0x3a')](_[_0xe712('0x5e')](_0x4ace38['query'],_0x45db86[_0xe712('0x3a')]));if(_0x4ace38[_0xe712('0x38')][_0xe712('0x44')]){_0x27259d[_0xe712('0x43')]=_[_0xe712('0x45')](_0x27259d[_0xe712('0x43')],{'$or':_[_0xe712('0x32')](_0x27259d[_0xe712('0x3c')],function(_0x19181d){var _0x3a281d={};_0x3a281d[_0x19181d]={'$like':'%'+_0x4ace38[_0xe712('0x38')]['filter']+'%'};return _0x3a281d;})});}_0x27259d=_[_0xe712('0x45')]({},_0x27259d,_0x4ace38[_0xe712('0x47')]);return _0x1a9b95[_0xe712('0x93')](_0x27259d);}})[_0xe712('0x2a')](function(_0x560333){if(_0x560333){_0x5697c2=_0x560333[_0xe712('0x3e')];if(!_0x4ace38[_0xe712('0x38')][_0xe712('0x3f')](_0xe712('0x40'))){_0x27259d[_0xe712('0x21')]=qs['limit'](_0x4ace38[_0xe712('0x38')]['limit']);_0x27259d[_0xe712('0x1f')]=qs[_0xe712('0x1f')](_0x4ace38[_0xe712('0x38')][_0xe712('0x1f')]);}return _0x1a9b95[_0xe712('0x93')](_0x27259d);}})[_0xe712('0x2a')](function(_0x5c0a0f){if(_0x5c0a0f){return _0x5c0a0f?{'count':_0x5697c2,'rows':_0x5c0a0f}:null;}})[_0xe712('0x2a')](respondWithResult(_0xb0b14e,null))[_0xe712('0x4b')](handleError(_0xb0b14e,null));}; \ No newline at end of file +var _0xf9fa=['filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','keys'];(function(_0x30f395,_0x3629b5){var _0x2ea0ee=function(_0x35a9af){while(--_0x35a9af){_0x30f395['push'](_0x30f395['shift']());}};_0x2ea0ee(++_0x3629b5);}(_0xf9fa,0xe0));var _0xaf9f=function(_0x306a90,_0x22d045){_0x306a90=_0x306a90-0x0;var _0x33900e=_0xf9fa[_0x306a90];return _0x33900e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf9f('0x0'));var zipdir=require(_0xaf9f('0x1'));var jsonpatch=require(_0xaf9f('0x2'));var rp=require(_0xaf9f('0x3'));var moment=require(_0xaf9f('0x4'));var BPromise=require(_0xaf9f('0x5'));var Mustache=require(_0xaf9f('0x6'));var util=require(_0xaf9f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xaf9f('0x8'));var ejs=require(_0xaf9f('0x9'));var fs=require('fs');var fs_extra=require(_0xaf9f('0xa'));var _=require(_0xaf9f('0xb'));var squel=require(_0xaf9f('0xc'));var crypto=require(_0xaf9f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf9f('0xe'));var Papa=require(_0xaf9f('0xf'));var Redis=require('ioredis');var authService=require(_0xaf9f('0x10'));var qs=require(_0xaf9f('0x11'));var as=require(_0xaf9f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaf9f('0x13'));var config=require(_0xaf9f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf9f('0x15'))['db'];config[_0xaf9f('0x16')]=_[_0xaf9f('0x17')](config[_0xaf9f('0x16')],{'host':_0xaf9f('0x18'),'port':0x18eb});var socket=require(_0xaf9f('0x19'))(new Redis(config[_0xaf9f('0x16')]));require(_0xaf9f('0x1a'))[_0xaf9f('0x1b')](socket);function respondWithStatusCode(_0x4a4db6,_0x33ecc6){_0x33ecc6=_0x33ecc6||0xcc;return function(_0x2c34be){if(_0x2c34be){return _0x4a4db6[_0xaf9f('0x1c')](_0x33ecc6);}return _0x4a4db6[_0xaf9f('0x1d')](_0x33ecc6)[_0xaf9f('0x1e')]();};}function respondWithResult(_0x3b5a0d,_0x5e442b){_0x5e442b=_0x5e442b||0xc8;return function(_0xe999a4){if(_0xe999a4){return _0x3b5a0d[_0xaf9f('0x1d')](_0x5e442b)[_0xaf9f('0x1f')](_0xe999a4);}};}function respondWithFilteredResult(_0x589d82,_0x4704e7){return function(_0x40e732){if(_0x40e732){var _0x4e10f9=typeof _0x4704e7[_0xaf9f('0x20')]==='undefined'&&typeof _0x4704e7[_0xaf9f('0x21')]===_0xaf9f('0x22');var _0x5067d9=_0x40e732[_0xaf9f('0x23')];var _0x3e2623=_0x4e10f9?0x0:_0x4704e7[_0xaf9f('0x20')];var _0x217ccc=_0x4e10f9?_0x40e732['count']:_0x4704e7[_0xaf9f('0x20')]+_0x4704e7[_0xaf9f('0x21')];var _0xf30ae2;if(_0x217ccc>=_0x5067d9){_0x217ccc=_0x5067d9;_0xf30ae2=0xc8;}else{_0xf30ae2=0xce;}_0x589d82[_0xaf9f('0x1d')](_0xf30ae2);return _0x589d82[_0xaf9f('0x24')](_0xaf9f('0x25'),_0x3e2623+'-'+_0x217ccc+'/'+_0x5067d9)[_0xaf9f('0x1f')](_0x40e732);}return null;};}function patchUpdates(_0x2d1bf4){return function(_0x10ad64){try{jsonpatch[_0xaf9f('0x26')](_0x10ad64,_0x2d1bf4,!![]);}catch(_0x3dafa0){return BPromise[_0xaf9f('0x27')](_0x3dafa0);}return _0x10ad64['save']();};}function saveUpdates(_0x193480,_0x48fcee){return function(_0x2b1a79){if(_0x2b1a79){return _0x2b1a79[_0xaf9f('0x28')](_0x193480)['then'](function(_0x11af3a){return _0x11af3a;});}return null;};}function removeEntity(_0x1b657d,_0x1eb482){return function(_0x5b0a98){if(_0x5b0a98){return _0x5b0a98[_0xaf9f('0x29')]()['then'](function(){var _0x15a8f9=_0x5b0a98[_0xaf9f('0x2a')]({'plain':!![]});var _0x1a6a8c=_0xaf9f('0x2b');return db[_0xaf9f('0x2c')]['destroy']({'where':{'type':_0x1a6a8c,'resourceId':_0x15a8f9['id']}})[_0xaf9f('0x2d')](function(){return _0x5b0a98;});})[_0xaf9f('0x2d')](function(){_0x1b657d[_0xaf9f('0x1d')](0xcc)[_0xaf9f('0x1e')]();});}};}function handleEntityNotFound(_0x3bd65b,_0x14e2f1){return function(_0x4b8cea){if(!_0x4b8cea){_0x3bd65b[_0xaf9f('0x1c')](0x194);}return _0x4b8cea;};}function handleError(_0x50902b,_0xcbe4f2){_0xcbe4f2=_0xcbe4f2||0x1f4;return function(_0x39a892){logger[_0xaf9f('0x2e')](_0x39a892[_0xaf9f('0x2f')]);if(_0x39a892[_0xaf9f('0x30')]){delete _0x39a892['name'];}_0x50902b[_0xaf9f('0x1d')](_0xcbe4f2)[_0xaf9f('0x31')](_0x39a892);};}exports[_0xaf9f('0x32')]=function(_0x964b29,_0x2c4190){var _0x3f2f55={},_0x211e3c={},_0x2ec416={'count':0x0,'rows':[]};var _0x478945=_[_0xaf9f('0x33')](db[_0xaf9f('0x34')][_0xaf9f('0x35')],function(_0x1cf0b3){return{'name':_0x1cf0b3[_0xaf9f('0x36')],'type':_0x1cf0b3['type'][_0xaf9f('0x37')]};});_0x211e3c['model']=_[_0xaf9f('0x33')](_0x478945,'name');_0x211e3c[_0xaf9f('0x38')]=_[_0xaf9f('0x39')](_0x964b29[_0xaf9f('0x38')]);_0x211e3c[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x211e3c[_0xaf9f('0x3c')],_0x211e3c[_0xaf9f('0x38')]);_0x3f2f55[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x211e3c['model'],qs[_0xaf9f('0x3e')](_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x3e')]));_0x3f2f55[_0xaf9f('0x3d')]=_0x3f2f55[_0xaf9f('0x3d')]['length']?_0x3f2f55[_0xaf9f('0x3d')]:_0x211e3c[_0xaf9f('0x3c')];if(!_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x3f')](_0xaf9f('0x40'))){_0x3f2f55[_0xaf9f('0x21')]=qs[_0xaf9f('0x21')](_0x964b29['query'][_0xaf9f('0x21')]);_0x3f2f55[_0xaf9f('0x20')]=qs[_0xaf9f('0x20')](_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x20')]);}_0x3f2f55[_0xaf9f('0x41')]=qs[_0xaf9f('0x42')](_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x42')]);_0x3f2f55[_0xaf9f('0x43')]=qs[_0xaf9f('0x3a')](_[_0xaf9f('0x44')](_0x964b29['query'],_0x211e3c['filters']),_0x478945);if(_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x45')]){_0x3f2f55[_0xaf9f('0x43')]=_[_0xaf9f('0x46')](_0x3f2f55[_0xaf9f('0x43')],{'$or':_[_0xaf9f('0x33')](_0x478945,function(_0x3dae83){if(_0x3dae83[_0xaf9f('0x47')]!=='VIRTUAL'){var _0x1adbdf={};_0x1adbdf[_0x3dae83['name']]={'$like':'%'+_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0x1adbdf;}})});}_0x3f2f55=_[_0xaf9f('0x46')]({},_0x3f2f55,_0x964b29[_0xaf9f('0x48')]);var _0x34541a={'where':_0x3f2f55[_0xaf9f('0x43')]};return db[_0xaf9f('0x34')][_0xaf9f('0x23')](_0x34541a)[_0xaf9f('0x2d')](function(_0x36ba8f){_0x2ec416[_0xaf9f('0x23')]=_0x36ba8f;if(_0x964b29[_0xaf9f('0x38')][_0xaf9f('0x49')]){_0x3f2f55['include']=[{'all':!![]}];}return db[_0xaf9f('0x34')][_0xaf9f('0x4a')](_0x3f2f55);})[_0xaf9f('0x2d')](function(_0x150d21){_0x2ec416[_0xaf9f('0x4b')]=_0x150d21;return _0x2ec416;})['then'](respondWithFilteredResult(_0x2c4190,_0x3f2f55))[_0xaf9f('0x4c')](handleError(_0x2c4190,null));};exports[_0xaf9f('0x4d')]=function(_0x2dcf3e,_0x33cbbf){var _0x49af88={'raw':!![],'where':{'id':_0x2dcf3e['params']['id']}},_0x516ac6={};_0x516ac6[_0xaf9f('0x3c')]=_['keys'](db[_0xaf9f('0x34')]['rawAttributes']);_0x516ac6[_0xaf9f('0x38')]=_[_0xaf9f('0x39')](_0x2dcf3e[_0xaf9f('0x38')]);_0x516ac6[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x516ac6[_0xaf9f('0x3c')],_0x516ac6[_0xaf9f('0x38')]);_0x49af88['attributes']=_['intersection'](_0x516ac6[_0xaf9f('0x3c')],qs['fields'](_0x2dcf3e['query'][_0xaf9f('0x3e')]));_0x49af88[_0xaf9f('0x3d')]=_0x49af88[_0xaf9f('0x3d')][_0xaf9f('0x4e')]?_0x49af88[_0xaf9f('0x3d')]:_0x516ac6['model'];if(_0x2dcf3e[_0xaf9f('0x38')][_0xaf9f('0x49')]){_0x49af88['include']=[{'all':!![]}];}_0x49af88=_[_0xaf9f('0x46')]({},_0x49af88,_0x2dcf3e['options']);return db[_0xaf9f('0x34')][_0xaf9f('0x4f')](_0x49af88)['then'](handleEntityNotFound(_0x33cbbf,null))[_0xaf9f('0x2d')](respondWithResult(_0x33cbbf,null))[_0xaf9f('0x4c')](handleError(_0x33cbbf,null));};exports[_0xaf9f('0x50')]=function(_0x271bfb,_0x3720c5){return db[_0xaf9f('0x34')][_0xaf9f('0x50')](_0x271bfb[_0xaf9f('0x51')],{})['then'](function(_0xd68ca9){var _0x336612=_0x271bfb[_0xaf9f('0x52')][_0xaf9f('0x2a')]({'plain':!![]});if(!_0x336612)throw new Error(_0xaf9f('0x53'));if(_0x336612[_0xaf9f('0x54')]===_0xaf9f('0x52')){var _0x5cd0b6=_0xd68ca9[_0xaf9f('0x2a')]({'plain':!![]});var _0x3bae45=_0xaf9f('0x2b');return db[_0xaf9f('0x55')][_0xaf9f('0x4f')]({'where':{'name':_0x3bae45,'userProfileId':_0x336612[_0xaf9f('0x56')]},'raw':!![]})[_0xaf9f('0x2d')](function(_0x4137be){if(_0x4137be&&_0x4137be[_0xaf9f('0x57')]===0x0){return db[_0xaf9f('0x2c')][_0xaf9f('0x50')]({'name':_0x5cd0b6[_0xaf9f('0x30')],'resourceId':_0x5cd0b6['id'],'type':_0x4137be['name'],'sectionId':_0x4137be['id']},{})['then'](function(){return _0xd68ca9;});}else{return _0xd68ca9;}})[_0xaf9f('0x4c')](function(_0x35c84c){logger[_0xaf9f('0x2e')](_0xaf9f('0x58'),_0x35c84c);throw _0x35c84c;});}return _0xd68ca9;})[_0xaf9f('0x2d')](respondWithResult(_0x3720c5,0xc9))[_0xaf9f('0x4c')](handleError(_0x3720c5,null));};exports[_0xaf9f('0x28')]=function(_0xa0c2cc,_0x5c403e){if(_0xa0c2cc['body']['id']){delete _0xa0c2cc['body']['id'];}return db[_0xaf9f('0x34')]['find']({'where':{'id':_0xa0c2cc['params']['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0x5c403e,null))['then'](saveUpdates(_0xa0c2cc[_0xaf9f('0x51')],null))[_0xaf9f('0x2d')](respondWithResult(_0x5c403e,null))[_0xaf9f('0x4c')](handleError(_0x5c403e,null));};exports[_0xaf9f('0x29')]=function(_0x58efe7,_0x13f637){return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0x58efe7[_0xaf9f('0x59')]['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0x13f637,null))[_0xaf9f('0x2d')](removeEntity(_0x13f637,null))[_0xaf9f('0x4c')](handleError(_0x13f637,null));};exports[_0xaf9f('0x5a')]=function(_0x2ea3c3,_0x2138ec){return db[_0xaf9f('0x34')]['describe']()[_0xaf9f('0x2d')](respondWithResult(_0x2138ec,null))[_0xaf9f('0x4c')](handleError(_0x2138ec,null));};exports['getMembers']=function(_0x430262,_0x5d5581,_0x47a91b){var _0x24422e={'raw':!![],'where':{}},_0x38d41f={},_0x261fa5;return db[_0xaf9f('0x34')]['findOne']({'where':{'id':_0x430262['params']['id']}})['then'](handleEntityNotFound(_0x5d5581,null))[_0xaf9f('0x2d')](function(_0x4d5ab7){if(_0x4d5ab7){_0x261fa5=_0x4d5ab7[_0xaf9f('0x2a')]({'plain':!![]});_0x38d41f[_0xaf9f('0x3c')]=_[_0xaf9f('0x39')](db['UserOpenchannelQueue'][_0xaf9f('0x35')]);_0x38d41f[_0xaf9f('0x38')]=_['keys'](_0x430262['query']);_0x38d41f[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x38d41f[_0xaf9f('0x3c')],_0x38d41f[_0xaf9f('0x38')]);_0x24422e[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x38d41f[_0xaf9f('0x3c')],qs['fields'](_0x430262[_0xaf9f('0x38')]['fields']));_0x24422e['attributes']=_0x24422e[_0xaf9f('0x3d')][_0xaf9f('0x4e')]?_0x24422e['attributes']:_0x38d41f[_0xaf9f('0x3c')];if(!_0x430262['query'][_0xaf9f('0x3f')](_0xaf9f('0x40'))){_0x24422e[_0xaf9f('0x21')]=qs['limit'](_0x430262[_0xaf9f('0x38')]['limit']);_0x24422e['offset']=qs[_0xaf9f('0x20')](_0x430262[_0xaf9f('0x38')]['offset']);}_0x24422e['order']=qs[_0xaf9f('0x42')](_0x430262[_0xaf9f('0x38')][_0xaf9f('0x42')]);_0x24422e[_0xaf9f('0x43')]=qs['filters'](_[_0xaf9f('0x44')](_0x430262[_0xaf9f('0x38')],_0x38d41f[_0xaf9f('0x3a')]));_0x24422e[_0xaf9f('0x43')][_0xaf9f('0x5b')]=_0x4d5ab7['id'];if(_0x430262[_0xaf9f('0x38')][_0xaf9f('0x45')]){_0x24422e['where']=_[_0xaf9f('0x46')](_0x24422e[_0xaf9f('0x43')],{'$or':_['map'](_0x24422e[_0xaf9f('0x3d')],function(_0xe7473f){var _0x39983e={};_0x39983e[_0xe7473f]={'$like':'%'+_0x430262[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0x39983e;})});}_0x24422e=_[_0xaf9f('0x46')]({},_0x24422e,_0x430262[_0xaf9f('0x48')]);return db[_0xaf9f('0x5c')][_0xaf9f('0x4a')](_0x24422e);}})[_0xaf9f('0x2d')](function(_0xeb6a82){if(_0xeb6a82){return db[_0xaf9f('0x5d')][_0xaf9f('0x5e')]({'where':{'id':_['map'](_0xeb6a82,_0xaf9f('0x5f')),'role':_0xaf9f('0x60')},'attributes':['id','name',_0xaf9f('0x61'),_0xaf9f('0x62'),_0xaf9f('0x63')]});}})[_0xaf9f('0x2d')](function(_0x37ac18){if(_0x37ac18){return{'count':_0x37ac18['count'],'rows':_[_0xaf9f('0x33')](_0x37ac18[_0xaf9f('0x4b')],function(_0x380b7a){return{'membername':_0x380b7a[_0xaf9f('0x30')],'UserId':_0x380b7a['id'],'queue_name':_0x261fa5[_0xaf9f('0x30')],'OpenchannelQueueId':_0x261fa5['id'],'interface':util[_0xaf9f('0x64')](_0xaf9f('0x65'),'SIP',_0x380b7a['name']),'penalty':0x0,'paused':_0x380b7a[_0xaf9f('0x61')],'createdAt':_0x380b7a[_0xaf9f('0x63')],'updatedAt':_0x380b7a[_0xaf9f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf9f('0x2d')](respondWithFilteredResult(_0x5d5581,_0x24422e))[_0xaf9f('0x4c')](handleError(_0x5d5581,null));};exports[_0xaf9f('0x66')]=function(_0x1f6859,_0xfbfb2b,_0x250b7b){var _0x3676d9={};var _0x5ab341={};var _0x17dd4a;var _0x188b16;return db['OpenchannelQueue'][_0xaf9f('0x67')]({'where':{'id':_0x1f6859[_0xaf9f('0x59')]['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0xfbfb2b,null))[_0xaf9f('0x2d')](function(_0x124b52){if(_0x124b52){_0x17dd4a=_0x124b52;_0x5ab341[_0xaf9f('0x3c')]=_[_0xaf9f('0x39')](db[_0xaf9f('0x68')]['rawAttributes']);_0x5ab341[_0xaf9f('0x38')]=_['keys'](_0x1f6859[_0xaf9f('0x38')]);_0x5ab341[_0xaf9f('0x3a')]=_['intersection'](_0x5ab341[_0xaf9f('0x3c')],_0x5ab341[_0xaf9f('0x38')]);_0x3676d9[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x5ab341['model'],qs[_0xaf9f('0x3e')](_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x3e')]));_0x3676d9['attributes']=_0x3676d9[_0xaf9f('0x3d')]['length']?_0x3676d9[_0xaf9f('0x3d')]:_0x5ab341['model'];_0x3676d9[_0xaf9f('0x41')]=qs[_0xaf9f('0x42')](_0x1f6859[_0xaf9f('0x38')]['sort']);_0x3676d9[_0xaf9f('0x43')]=qs[_0xaf9f('0x3a')](_['pick'](_0x1f6859[_0xaf9f('0x38')],_0x5ab341[_0xaf9f('0x3a')]));if(_0x1f6859['query'][_0xaf9f('0x45')]){_0x3676d9[_0xaf9f('0x43')]=_[_0xaf9f('0x46')](_0x3676d9['where'],{'$or':_[_0xaf9f('0x33')](_0x3676d9[_0xaf9f('0x3d')],function(_0x1692c7){var _0x59c009={};_0x59c009[_0x1692c7]={'$like':'%'+_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0x59c009;})});}_0x3676d9=_[_0xaf9f('0x46')]({},_0x3676d9,_0x1f6859[_0xaf9f('0x48')]);return _0x17dd4a[_0xaf9f('0x66')](_0x3676d9);}})[_0xaf9f('0x2d')](function(_0x204cb2){if(_0x204cb2){_0x188b16=_0x204cb2[_0xaf9f('0x4e')];if(!_0x1f6859[_0xaf9f('0x38')]['hasOwnProperty'](_0xaf9f('0x40'))){_0x3676d9[_0xaf9f('0x21')]=qs[_0xaf9f('0x21')](_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x21')]);_0x3676d9[_0xaf9f('0x20')]=qs['offset'](_0x1f6859[_0xaf9f('0x38')][_0xaf9f('0x20')]);}return _0x17dd4a[_0xaf9f('0x66')](_0x3676d9);}})[_0xaf9f('0x2d')](function(_0x79035d){if(_0x79035d){return _0x79035d?{'count':_0x188b16,'rows':_0x79035d}:null;}})['then'](respondWithResult(_0xfbfb2b,null))[_0xaf9f('0x4c')](handleError(_0xfbfb2b,null));};exports['addTeams']=function(_0x9baecd,_0x2577ec,_0x4b0a84){var _0x6e2718=_0x9baecd['body'][_0xaf9f('0x69')];return db[_0xaf9f('0x68')]['findAll']({'where':{'id':_0x6e2718},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaf9f('0x6a'),'attributes':['id',_0xaf9f('0x30'),_0xaf9f('0x6b'),_0xaf9f('0x6c'),_0xaf9f('0x6d')],'raw':!![]}]})[_0xaf9f('0x2d')](function(_0xf7f2cd){if(_0xf7f2cd){var _0x42f0aa=_[_0xaf9f('0x6e')](_0xf7f2cd,function(_0x4b608b){var _0x3f359d=_0x4b608b[_0xaf9f('0x2a')]({'plain':!![]});return _0x3f359d[_0xaf9f('0x6a')];});return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0x9baecd[_0xaf9f('0x59')]['id']}})['then'](function(_0x1154b7){return db[_0xaf9f('0x6f')][_0xaf9f('0x70')](function(_0x3943aa){return _0x1154b7[_0xaf9f('0x71')](_0x6e2718,{'transaction':_0x3943aa})['then'](function(){return BPromise['each'](_0x42f0aa,function(_0x458bf9){return db[_0xaf9f('0x5c')][_0xaf9f('0x72')]({'where':{'UserId':_0x458bf9['id'],'OpenchannelQueueId':_0x9baecd['params']['id']},'transaction':_0x3943aa});});})[_0xaf9f('0x2d')](function(){_0x42f0aa[_0xaf9f('0x73')](function(_0x41d4d3){socket['emit'](_0xaf9f('0x74'),{'UserId':_0x41d4d3['id'],'OpenchannelQueueId':_0x1154b7['id']});});});});});}})['then'](respondWithStatusCode(_0x2577ec,null))[_0xaf9f('0x4c')](handleError(_0x2577ec,null));};exports[_0xaf9f('0x75')]=function(_0x3e0b9f,_0x132556,_0x29972b){return db[_0xaf9f('0x68')][_0xaf9f('0x4a')]({'where':{'id':_0x3e0b9f[_0xaf9f('0x38')][_0xaf9f('0x69')]},'attributes':['id'],'include':[{'model':db[_0xaf9f('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xaf9f('0x2d')](handleEntityNotFound(_0x132556,null))[_0xaf9f('0x2d')](function(_0x450090){var _0x88f9b4=_[_0xaf9f('0x33')](_0x450090,'id');var _0x13e059=[];var _0x2caf94=[];var _0x16bd4f=squel[_0xaf9f('0x76')]();_0x16bd4f[_0xaf9f('0x77')]('tq.TeamId')[_0xaf9f('0x78')](_0xaf9f('0x79'),'tq')['join']('user_has_teams','ut',_0xaf9f('0x7a'))[_0xaf9f('0x43')]('OpenchannelQueueId\x20=\x20?',_0x3e0b9f[_0xaf9f('0x59')]['id']);for(var _0xf889f4=0x0;_0xf889f4<_0x450090['length'];_0xf889f4+=0x1){let _0x47ea4b=_0x450090[_0xf889f4];for(var _0x4e557f=0x0;_0x4e557f<_0x47ea4b[_0xaf9f('0x6a')]['length'];_0x4e557f+=0x1){let _0x54b8dd=_0x47ea4b[_0xaf9f('0x6a')][_0x4e557f];var _0x492c50=_0x16bd4f[_0xaf9f('0x7b')]();_0x492c50[_0xaf9f('0x43')](_0xaf9f('0x7c'),_0x54b8dd['id']);_0x2caf94[_0xaf9f('0x7d')](db['sequelize']['query'](_0x492c50[_0xaf9f('0x7e')](),{'type':db[_0xaf9f('0x6f')][_0xaf9f('0x7f')][_0xaf9f('0x80')]})[_0xaf9f('0x2d')](function(_0x5a9e47){if(_0x5a9e47[_0xaf9f('0x4e')]===0x1){return _0x54b8dd['id'];}else{var _0x117cdd=_['every'](_[_0xaf9f('0x33')](_0x5a9e47,_0xaf9f('0x81')),function(_0x45af13){return _['includes'](_0x88f9b4,_0x45af13);});if(_0x117cdd){return _0x54b8dd['id'];}}}));}}return BPromise[_0xaf9f('0x82')](_0x2caf94)[_0xaf9f('0x2d')](function(_0x4da607){_0x13e059=_(_0x13e059)['union'](_0x4da607)[_0xaf9f('0x83')]()[_0xaf9f('0x84')]();return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0x3e0b9f['params']['id']}})[_0xaf9f('0x2d')](function(_0x51fe80){return db[_0xaf9f('0x6f')]['transaction'](function(_0x1544d4){return _0x51fe80['removeTeams'](_0x3e0b9f[_0xaf9f('0x38')][_0xaf9f('0x69')],{'transaction':_0x1544d4})[_0xaf9f('0x2d')](function(){if(!_['isEmpty'](_0x13e059)){return _0x51fe80[_0xaf9f('0x85')](_0x13e059,{'transaction':_0x1544d4});}})['then'](function(){_0x13e059['forEach'](function(_0x5e6232){socket[_0xaf9f('0x86')]('userOpenchannelQueue:remove',{'UserId':_0x5e6232,'OpenchannelQueueId':_0x51fe80['id']});});});});});});})[_0xaf9f('0x2d')](respondWithStatusCode(_0x132556,null))['catch'](handleError(_0x132556,null));};exports[_0xaf9f('0x87')]=function(_0xbb20da,_0x2be95e,_0x155607){return db[_0xaf9f('0x34')][_0xaf9f('0x4f')]({'where':{'id':_0xbb20da['params']['id']}})['then'](handleEntityNotFound(_0x2be95e,null))[_0xaf9f('0x2d')](function(_0x35d6dd){if(_0x35d6dd){return _0x35d6dd[_0xaf9f('0x87')](_0xbb20da[_0xaf9f('0x51')][_0xaf9f('0x69')],_[_0xaf9f('0x88')](_0xbb20da[_0xaf9f('0x51')],['ids','id'])||{})[_0xaf9f('0x89')](function(_0x32f169){for(var _0x55052e=0x0;_0x55052e<_0xbb20da[_0xaf9f('0x51')]['ids']['length'];_0x55052e+=0x1){socket[_0xaf9f('0x86')](_0xaf9f('0x74'),{'UserId':Number(_0xbb20da['body'][_0xaf9f('0x69')][_0x55052e]),'OpenchannelQueueId':Number(_0xbb20da[_0xaf9f('0x59')]['id'])});}return _0x32f169;});}})[_0xaf9f('0x2d')](respondWithResult(_0x2be95e,null))[_0xaf9f('0x4c')](handleError(_0x2be95e,null));};exports[_0xaf9f('0x85')]=function(_0x5f87dc,_0x3240c2,_0x4da1c9){return db['OpenchannelQueue'][_0xaf9f('0x4f')]({'where':{'id':_0x5f87dc['params']['id']}})['then'](handleEntityNotFound(_0x3240c2,null))['then'](function(_0x101c99){if(_0x101c99){return _0x101c99[_0xaf9f('0x85')](_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')])['then'](function(){if(_[_0xaf9f('0x8a')](_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')])){for(var _0x5e0e30=0x0;_0x5e0e30<_0x5f87dc[_0xaf9f('0x38')]['ids'][_0xaf9f('0x4e')];_0x5e0e30+=0x1){socket[_0xaf9f('0x86')](_0xaf9f('0x8b'),{'UserId':Number(_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')][_0x5e0e30]),'OpenchannelQueueId':Number(_0x5f87dc[_0xaf9f('0x59')]['id'])});}}else{socket[_0xaf9f('0x86')](_0xaf9f('0x8b'),{'UserId':Number(_0x5f87dc[_0xaf9f('0x38')][_0xaf9f('0x69')]),'OpenchannelQueueId':Number(_0x5f87dc['params']['id'])});}});}})[_0xaf9f('0x2d')](respondWithStatusCode(_0x3240c2,null))[_0xaf9f('0x4c')](handleError(_0x3240c2,null));};exports[_0xaf9f('0x8c')]=function(_0x33593d,_0x3d1424,_0xcbf52a){var _0x2889e1={};var _0x4ef5f5={};var _0x5b6e28;var _0x2bca6f;return db['OpenchannelQueue'][_0xaf9f('0x67')]({'where':{'id':_0x33593d['params']['id']}})[_0xaf9f('0x2d')](handleEntityNotFound(_0x3d1424,null))[_0xaf9f('0x2d')](function(_0x27ca23){if(_0x27ca23){_0x5b6e28=_0x27ca23;_0x4ef5f5[_0xaf9f('0x3c')]=_[_0xaf9f('0x39')](db[_0xaf9f('0x5d')]['rawAttributes']);_0x4ef5f5[_0xaf9f('0x38')]=_[_0xaf9f('0x39')](_0x33593d['query']);_0x4ef5f5[_0xaf9f('0x3a')]=_[_0xaf9f('0x3b')](_0x4ef5f5['model'],_0x4ef5f5[_0xaf9f('0x38')]);_0x2889e1[_0xaf9f('0x3d')]=_[_0xaf9f('0x3b')](_0x4ef5f5[_0xaf9f('0x3c')],qs['fields'](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x3e')]));_0x2889e1[_0xaf9f('0x3d')]=_0x2889e1['attributes'][_0xaf9f('0x4e')]?_0x2889e1[_0xaf9f('0x3d')]:_0x4ef5f5['model'];_0x2889e1['order']=qs[_0xaf9f('0x42')](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x42')]);_0x2889e1[_0xaf9f('0x43')]=qs[_0xaf9f('0x3a')](_['pick'](_0x33593d[_0xaf9f('0x38')],_0x4ef5f5[_0xaf9f('0x3a')]));if(_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x45')]){_0x2889e1['where']=_['merge'](_0x2889e1[_0xaf9f('0x43')],{'$or':_[_0xaf9f('0x33')](_0x2889e1[_0xaf9f('0x3d')],function(_0x6d9a86){var _0xc0fe5c={};_0xc0fe5c[_0x6d9a86]={'$like':'%'+_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x45')]+'%'};return _0xc0fe5c;})});}_0x2889e1=_['merge']({},_0x2889e1,_0x33593d[_0xaf9f('0x48')]);return _0x5b6e28[_0xaf9f('0x8c')](_0x2889e1);}})['then'](function(_0x2fce1f){if(_0x2fce1f){_0x2bca6f=_0x2fce1f['length'];if(!_0x33593d['query'][_0xaf9f('0x3f')](_0xaf9f('0x40'))){_0x2889e1[_0xaf9f('0x21')]=qs[_0xaf9f('0x21')](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x21')]);_0x2889e1[_0xaf9f('0x20')]=qs[_0xaf9f('0x20')](_0x33593d[_0xaf9f('0x38')][_0xaf9f('0x20')]);}return _0x5b6e28[_0xaf9f('0x8c')](_0x2889e1);}})['then'](function(_0x51a0a5){if(_0x51a0a5){return _0x51a0a5?{'count':_0x2bca6f,'rows':_0x51a0a5}:null;}})[_0xaf9f('0x2d')](respondWithResult(_0x3d1424,null))[_0xaf9f('0x4c')](handleError(_0x3d1424,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 11992a6..f70b0e3 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 _0xdab5=['save','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x1d0d37,_0x7ba8f6){var _0x494a89=function(_0x34e439){while(--_0x34e439){_0x1d0d37['push'](_0x1d0d37['shift']());}};_0x494a89(++_0x7ba8f6);}(_0xdab5,0x14d));var _0x5dab=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdab5[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x5dab('0x0'));var OpenchannelQueue=require(_0x5dab('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5dab('0x2')](0x0);var events={'afterCreate':_0x5dab('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x441ab4){return function(_0xc2b130,_0x5609b2,_0x933f4b){OpenchannelQueueEvents[_0x5dab('0x4')](_0x441ab4+':'+_0xc2b130['id'],_0xc2b130);OpenchannelQueueEvents[_0x5dab('0x4')](_0x441ab4,_0xc2b130);_0x933f4b(null);};}for(var e in events){if(events[_0x5dab('0x5')](e)){var event=events[e];OpenchannelQueue[_0x5dab('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x725c=['save','update','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x725c,0x12b));var _0xc725=function(_0xa35408,_0x315f2a){_0xa35408=_0xa35408-0x0;var _0xc71d1b=_0x725c[_0xa35408];return _0xc71d1b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xc725('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc725('0x1')](0x0);var events={'afterCreate':_0xc725('0x2'),'afterUpdate':_0xc725('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f1325){return function(_0x4123fd,_0x4ea7c1,_0x2d1c6f){OpenchannelQueueEvents['emit'](_0x1f1325+':'+_0x4123fd['id'],_0x4123fd);OpenchannelQueueEvents['emit'](_0x1f1325,_0x4123fd);_0x2d1c6f(null);};}for(var e in events){if(events[_0xc725('0x4')](e)){var event=events[e];OpenchannelQueue[_0xc725('0x5')](e,emitEvent(event));}}module[_0xc725('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 98a9a05..2151212 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 _0x1b28=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues'];(function(_0x183f96,_0x1b5f2c){var _0x15e84a=function(_0x19b3b5){while(--_0x19b3b5){_0x183f96['push'](_0x183f96['shift']());}};_0x15e84a(++_0x1b5f2c);}(_0x1b28,0xd1));var _0x81b2=function(_0xc92bf8,_0x3436a9){_0xc92bf8=_0xc92bf8-0x0;var _0x1bc47d=_0x1b28[_0xc92bf8];return _0x1bc47d;};'use strict';var _=require(_0x81b2('0x0'));var util=require(_0x81b2('0x1'));var logger=require(_0x81b2('0x2'))(_0x81b2('0x3'));var moment=require(_0x81b2('0x4'));var BPromise=require('bluebird');var rp=require(_0x81b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x81b2('0x6'));var config=require('../../config/environment');var attributes=require(_0x81b2('0x7'));module[_0x81b2('0x8')]=function(_0x5f30d8,_0x23795b){return _0x5f30d8['define'](_0x81b2('0x9'),attributes,{'tableName':_0x81b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd8d=['openchannel_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue'];(function(_0x448970,_0x44b9b4){var _0x2fa420=function(_0x10a754){while(--_0x10a754){_0x448970['push'](_0x448970['shift']());}};_0x2fa420(++_0x44b9b4);}(_0xdd8d,0x85));var _0xddd8=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0xdd8d[_0x54fe1c];return _0x460aaa;};'use strict';var _=require(_0xddd8('0x0'));var util=require(_0xddd8('0x1'));var logger=require('../../config/logger')(_0xddd8('0x2'));var moment=require(_0xddd8('0x3'));var BPromise=require(_0xddd8('0x4'));var rp=require(_0xddd8('0x5'));var fs=require('fs');var path=require(_0xddd8('0x6'));var rimraf=require('rimraf');var config=require(_0xddd8('0x7'));var attributes=require(_0xddd8('0x8'));module[_0xddd8('0x9')]=function(_0x295194,_0x3fe554){return _0x295194['define'](_0xddd8('0xa'),attributes,{'tableName':_0xddd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 4ca2d31..3e617f3 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 _0x8a91=['attributes','limit','include','map','model','then','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','OpenchannelQueue','findAll','options','raw','where'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x8a91,0x185));var _0x18a9=function(_0x4a63c8,_0x587fa1){_0x4a63c8=_0x4a63c8-0x0;var _0x524066=_0x8a91[_0x4a63c8];return _0x524066;};'use strict';var _=require(_0x18a9('0x0'));var util=require(_0x18a9('0x1'));var moment=require('moment');var BPromise=require(_0x18a9('0x2'));var rs=require(_0x18a9('0x3'));var fs=require('fs');var Redis=require(_0x18a9('0x4'));var db=require(_0x18a9('0x5'))['db'];var utils=require(_0x18a9('0x6'));var logger=require(_0x18a9('0x7'))(_0x18a9('0x8'));var config=require('../../config/environment');var jayson=require(_0x18a9('0x9'));var client=jayson[_0x18a9('0xa')]['http']({'port':0x232a});config[_0x18a9('0xb')]=_['defaults'](config[_0x18a9('0xb')],{'host':_0x18a9('0xc'),'port':0x18eb});var socket=require(_0x18a9('0xd'))(new Redis(config[_0x18a9('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0xc57ae5,_0x509d46,_0x57202f){return new BPromise(function(_0x354fd5,_0x1e93f8){return client[_0x18a9('0xe')](_0xc57ae5,_0x57202f)['then'](function(_0x2b8373){logger[_0x18a9('0xf')](_0x18a9('0x10'),_0x509d46,'request\x20sent');logger[_0x18a9('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x509d46,_0x18a9('0x12'),JSON[_0x18a9('0x13')](_0x2b8373));if(_0x2b8373['error']){if(_0x2b8373[_0x18a9('0x14')]['code']===0x1f4){logger['error'](_0x18a9('0x10'),_0x509d46,_0x2b8373[_0x18a9('0x14')][_0x18a9('0x15')]);return _0x1e93f8(_0x2b8373[_0x18a9('0x14')][_0x18a9('0x15')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x509d46,_0x2b8373[_0x18a9('0x14')][_0x18a9('0x15')]);return _0x354fd5(_0x2b8373[_0x18a9('0x14')][_0x18a9('0x15')]);}else{logger[_0x18a9('0xf')](_0x18a9('0x10'),_0x509d46,_0x18a9('0x12'));_0x354fd5(_0x2b8373[_0x18a9('0x16')][_0x18a9('0x15')]);}})[_0x18a9('0x17')](function(_0x2c968c){logger['error'](_0x18a9('0x10'),_0x509d46,_0x2c968c);_0x1e93f8(_0x2c968c);});});}exports['GetOpenchannelQueue']=function(_0x4d223f){var _0x1a4fc8=this;return new Promise(function(_0xa7bbd4,_0x422615){return db[_0x18a9('0x18')][_0x18a9('0x19')]({'raw':_0x4d223f['options']?_0x4d223f[_0x18a9('0x1a')][_0x18a9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d223f[_0x18a9('0x1a')]?_0x4d223f['options'][_0x18a9('0x1c')]||null:null,'attributes':_0x4d223f['options']?_0x4d223f[_0x18a9('0x1a')][_0x18a9('0x1d')]||null:null,'limit':_0x4d223f['options']?_0x4d223f[_0x18a9('0x1a')][_0x18a9('0x1e')]||null:null,'include':_0x4d223f[_0x18a9('0x1a')]?_0x4d223f[_0x18a9('0x1a')][_0x18a9('0x1f')]?_[_0x18a9('0x20')](_0x4d223f[_0x18a9('0x1a')][_0x18a9('0x1f')],function(_0x7c7df0){return{'model':db[_0x7c7df0[_0x18a9('0x21')]],'as':_0x7c7df0['as'],'attributes':_0x7c7df0['attributes'],'include':_0x7c7df0['include']?_[_0x18a9('0x20')](_0x7c7df0['include'],function(_0x49da41){return{'model':db[_0x49da41[_0x18a9('0x21')]],'as':_0x49da41['as'],'attributes':_0x49da41[_0x18a9('0x1d')],'include':_0x49da41['include']?_[_0x18a9('0x20')](_0x49da41[_0x18a9('0x1f')],function(_0x2cd188){return{'model':db[_0x2cd188[_0x18a9('0x21')]],'as':_0x2cd188['as'],'attributes':_0x2cd188['attributes']};}):[]};}):[]};}):[]:[]})[_0x18a9('0x22')](function(_0x54baa3){logger[_0x18a9('0xf')](_0x18a9('0x23'),_0x4d223f);logger[_0x18a9('0x11')](_0x18a9('0x23'),_0x4d223f,JSON[_0x18a9('0x13')](_0x54baa3));_0xa7bbd4(_0x54baa3);})[_0x18a9('0x17')](function(_0x4c121e){logger[_0x18a9('0x14')](_0x18a9('0x23'),_0x4c121e[_0x18a9('0x15')],_0x4d223f);_0x422615(_0x1a4fc8[_0x18a9('0x14')](0x1f4,_0x4c121e['message']));});});};exports[_0x18a9('0x24')]=function(_0x5aae7c){var _0x2a100c=this;return new Promise(function(_0x5df631,_0x31041e){return db[_0x18a9('0x18')][_0x18a9('0x25')]({'raw':_0x5aae7c['options']?_0x5aae7c[_0x18a9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5aae7c[_0x18a9('0x1a')]?_0x5aae7c[_0x18a9('0x1a')][_0x18a9('0x1c')]||null:null,'attributes':_0x5aae7c[_0x18a9('0x1a')]?_0x5aae7c[_0x18a9('0x1a')][_0x18a9('0x1d')]||null:null,'include':_0x5aae7c[_0x18a9('0x1a')]?_0x5aae7c[_0x18a9('0x1a')][_0x18a9('0x1f')]?_['map'](_0x5aae7c[_0x18a9('0x1a')][_0x18a9('0x1f')],function(_0x46a6b0){return{'model':db[_0x46a6b0[_0x18a9('0x21')]],'as':_0x46a6b0['as'],'attributes':_0x46a6b0['attributes'],'include':_0x46a6b0[_0x18a9('0x1f')]?_[_0x18a9('0x20')](_0x46a6b0[_0x18a9('0x1f')],function(_0x2051dc){return{'model':db[_0x2051dc[_0x18a9('0x21')]],'as':_0x2051dc['as'],'attributes':_0x2051dc[_0x18a9('0x1d')],'include':_0x2051dc[_0x18a9('0x1f')]?_[_0x18a9('0x20')](_0x2051dc['include'],function(_0x5e6a1c){return{'model':db[_0x5e6a1c[_0x18a9('0x21')]],'as':_0x5e6a1c['as'],'attributes':_0x5e6a1c[_0x18a9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee04a){logger['info'](_0x18a9('0x24'),_0x5aae7c);logger[_0x18a9('0x11')](_0x18a9('0x24'),_0x5aae7c,JSON[_0x18a9('0x13')](_0x1ee04a));_0x5df631(_0x1ee04a);})[_0x18a9('0x17')](function(_0x3bd60c){logger[_0x18a9('0x14')](_0x18a9('0x24'),_0x3bd60c[_0x18a9('0x15')],_0x5aae7c);_0x31041e(_0x2a100c[_0x18a9('0x14')](0x1f4,_0x3bd60c[_0x18a9('0x15')]));});});}; \ No newline at end of file +var _0xa503=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetOpenchannelQueue','options','where','attributes','include','map','model','catch','ShowOpenchannelQueue','OpenchannelQueue','find','raw','lodash','moment'];(function(_0x5b16a4,_0x2ca88c){var _0x1cdb2a=function(_0x1b6927){while(--_0x1b6927){_0x5b16a4['push'](_0x5b16a4['shift']());}};_0x1cdb2a(++_0x2ca88c);}(_0xa503,0x1ea));var _0x3a50=function(_0x229d52,_0x385de9){_0x229d52=_0x229d52-0x0;var _0xef6539=_0xa503[_0x229d52];return _0xef6539;};'use strict';var _=require(_0x3a50('0x0'));var util=require('util');var moment=require(_0x3a50('0x1'));var BPromise=require(_0x3a50('0x2'));var rs=require(_0x3a50('0x3'));var fs=require('fs');var Redis=require(_0x3a50('0x4'));var db=require(_0x3a50('0x5'))['db'];var utils=require(_0x3a50('0x6'));var logger=require(_0x3a50('0x7'))('rpc');var config=require(_0x3a50('0x8'));var jayson=require(_0x3a50('0x9'));var client=jayson[_0x3a50('0xa')][_0x3a50('0xb')]({'port':0x232a});config[_0x3a50('0xc')]=_[_0x3a50('0xd')](config[_0x3a50('0xc')],{'host':_0x3a50('0xe'),'port':0x18eb});var socket=require(_0x3a50('0xf'))(new Redis(config[_0x3a50('0xc')]));require(_0x3a50('0x10'))[_0x3a50('0x11')](socket);function respondWithRpcPromise(_0x37b360,_0x4ea0f5,_0x535f73){return new BPromise(function(_0x1f4cd5,_0x2d7df5){return client[_0x3a50('0x12')](_0x37b360,_0x535f73)[_0x3a50('0x13')](function(_0x12d336){logger[_0x3a50('0x14')](_0x3a50('0x15'),_0x4ea0f5,_0x3a50('0x16'));logger[_0x3a50('0x17')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4ea0f5,_0x3a50('0x16'),JSON[_0x3a50('0x18')](_0x12d336));if(_0x12d336[_0x3a50('0x19')]){if(_0x12d336['error'][_0x3a50('0x1a')]===0x1f4){logger[_0x3a50('0x19')](_0x3a50('0x15'),_0x4ea0f5,_0x12d336['error'][_0x3a50('0x1b')]);return _0x2d7df5(_0x12d336[_0x3a50('0x19')][_0x3a50('0x1b')]);}logger[_0x3a50('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ea0f5,_0x12d336[_0x3a50('0x19')]['message']);return _0x1f4cd5(_0x12d336[_0x3a50('0x19')][_0x3a50('0x1b')]);}else{logger[_0x3a50('0x14')](_0x3a50('0x15'),_0x4ea0f5,_0x3a50('0x16'));_0x1f4cd5(_0x12d336[_0x3a50('0x1c')][_0x3a50('0x1b')]);}})['catch'](function(_0x5ebf5f){logger[_0x3a50('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ea0f5,_0x5ebf5f);_0x2d7df5(_0x5ebf5f);});});}exports[_0x3a50('0x1d')]=function(_0x3779ef){var _0x5385f7=this;return new Promise(function(_0x5a3e7f,_0x36a971){return db['OpenchannelQueue']['findAll']({'raw':_0x3779ef['options']?_0x3779ef[_0x3a50('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3779ef[_0x3a50('0x1e')]?_0x3779ef[_0x3a50('0x1e')][_0x3a50('0x1f')]||null:null,'attributes':_0x3779ef['options']?_0x3779ef[_0x3a50('0x1e')][_0x3a50('0x20')]||null:null,'limit':_0x3779ef[_0x3a50('0x1e')]?_0x3779ef[_0x3a50('0x1e')]['limit']||null:null,'include':_0x3779ef[_0x3a50('0x1e')]?_0x3779ef[_0x3a50('0x1e')][_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x3779ef[_0x3a50('0x1e')]['include'],function(_0x1bc180){return{'model':db[_0x1bc180[_0x3a50('0x23')]],'as':_0x1bc180['as'],'attributes':_0x1bc180['attributes'],'include':_0x1bc180[_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x1bc180[_0x3a50('0x21')],function(_0x4c0597){return{'model':db[_0x4c0597['model']],'as':_0x4c0597['as'],'attributes':_0x4c0597['attributes'],'include':_0x4c0597['include']?_[_0x3a50('0x22')](_0x4c0597['include'],function(_0x3cebd3){return{'model':db[_0x3cebd3[_0x3a50('0x23')]],'as':_0x3cebd3['as'],'attributes':_0x3cebd3[_0x3a50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a50('0x13')](function(_0x52555f){logger['info']('GetOpenchannelQueue',_0x3779ef);logger[_0x3a50('0x17')]('GetOpenchannelQueue',_0x3779ef,JSON[_0x3a50('0x18')](_0x52555f));_0x5a3e7f(_0x52555f);})[_0x3a50('0x24')](function(_0x1e1bf2){logger['error']('GetOpenchannelQueue',_0x1e1bf2[_0x3a50('0x1b')],_0x3779ef);_0x36a971(_0x5385f7[_0x3a50('0x19')](0x1f4,_0x1e1bf2[_0x3a50('0x1b')]));});});};exports[_0x3a50('0x25')]=function(_0x5815b6){var _0x28ca9e=this;return new Promise(function(_0x1baced,_0x3aa8dd){return db[_0x3a50('0x26')][_0x3a50('0x27')]({'raw':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x28')]===undefined?!![]:![]:!![],'where':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x1f')]||null:null,'attributes':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x20')]||null:null,'include':_0x5815b6[_0x3a50('0x1e')]?_0x5815b6[_0x3a50('0x1e')][_0x3a50('0x21')]?_['map'](_0x5815b6['options'][_0x3a50('0x21')],function(_0x5b23b1){return{'model':db[_0x5b23b1['model']],'as':_0x5b23b1['as'],'attributes':_0x5b23b1[_0x3a50('0x20')],'include':_0x5b23b1[_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x5b23b1['include'],function(_0x479cb2){return{'model':db[_0x479cb2['model']],'as':_0x479cb2['as'],'attributes':_0x479cb2['attributes'],'include':_0x479cb2[_0x3a50('0x21')]?_[_0x3a50('0x22')](_0x479cb2['include'],function(_0x3ab110){return{'model':db[_0x3ab110[_0x3a50('0x23')]],'as':_0x3ab110['as'],'attributes':_0x3ab110[_0x3a50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3a50('0x13')](function(_0x25957b){logger[_0x3a50('0x14')](_0x3a50('0x25'),_0x5815b6);logger['debug']('ShowOpenchannelQueue',_0x5815b6,JSON[_0x3a50('0x18')](_0x25957b));_0x1baced(_0x25957b);})[_0x3a50('0x24')](function(_0x605c9f){logger[_0x3a50('0x19')](_0x3a50('0x25'),_0x605c9f[_0x3a50('0x1b')],_0x5815b6);_0x3aa8dd(_0x28ca9e['error'](0x1f4,_0x605c9f[_0x3a50('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d93ba11..3ffec90 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 _0xbd2c=['length','./openchannelQueue.events','save','remove','emit','removeListener','register'];(function(_0x42ce72,_0x141243){var _0x2b17ad=function(_0x578177){while(--_0x578177){_0x42ce72['push'](_0x42ce72['shift']());}};_0x2b17ad(++_0x141243);}(_0xbd2c,0xef));var _0xcbd2=function(_0x446276,_0x2e5944){_0x446276=_0x446276-0x0;var _0xeca173=_0xbd2c[_0x446276];return _0xeca173;};'use strict';var OpenchannelQueueEvents=require(_0xcbd2('0x0'));var events=[_0xcbd2('0x1'),_0xcbd2('0x2'),'update'];function createListener(_0x36b597,_0x3f2773){return function(_0x4c1448){_0x3f2773[_0xcbd2('0x3')](_0x36b597,_0x4c1448);};}function removeListener(_0x473638,_0x4bf7bd){return function(){OpenchannelQueueEvents[_0xcbd2('0x4')](_0x473638,_0x4bf7bd);};}exports[_0xcbd2('0x5')]=function(_0x12933d){for(var _0x3bfdf5=0x0,_0x41e87e=events[_0xcbd2('0x6')];_0x3bfdf5<_0x41e87e;_0x3bfdf5++){var _0x46ea8d=events[_0x3bfdf5];var _0x21e85e=createListener('openchannelQueue:'+_0x46ea8d,_0x12933d);OpenchannelQueueEvents['on'](_0x46ea8d,_0x21e85e);}}; \ No newline at end of file +var _0x0c1a=['update','emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0c1a,0x169));var _0xa0c1=function(_0xedfe21,_0x3d887b){_0xedfe21=_0xedfe21-0x0;var _0x2f7085=_0x0c1a[_0xedfe21];return _0x2f7085;};'use strict';var OpenchannelQueueEvents=require(_0xa0c1('0x0'));var events=[_0xa0c1('0x1'),_0xa0c1('0x2'),_0xa0c1('0x3')];function createListener(_0x3e266a,_0x3b3cf9){return function(_0x1511a7){_0x3b3cf9[_0xa0c1('0x4')](_0x3e266a,_0x1511a7);};}function removeListener(_0x3037d5,_0x4118f0){return function(){OpenchannelQueueEvents[_0xa0c1('0x5')](_0x3037d5,_0x4118f0);};}exports['register']=function(_0x3be00e){for(var _0x3f194b=0x0,_0x305873=events['length'];_0x3f194b<_0x305873;_0x3f194b++){var _0x3295a0=events[_0x3f194b];var _0x303ee1=createListener(_0xa0c1('0x6')+_0x3295a0,_0x3be00e);OpenchannelQueueEvents['on'](_0x3295a0,_0x303ee1);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 8b37734..11a2b8a 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 _0x0114=['destroy','exports','path','express','Router','fs-extra','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete'];(function(_0x3e2b98,_0x4f3bad){var _0x5e141d=function(_0x24f3f6){while(--_0x24f3f6){_0x3e2b98['push'](_0x3e2b98['shift']());}};_0x5e141d(++_0x4f3bad);}(_0x0114,0x6e));var _0x4011=function(_0x1d6eee,_0x53b219){_0x1d6eee=_0x1d6eee-0x0;var _0x2c82c0=_0x0114[_0x1d6eee];return _0x2c82c0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4011('0x0'));var timeout=require('connect-timeout');var express=require(_0x4011('0x1'));var router=express[_0x4011('0x2')]();var fs_extra=require(_0x4011('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4011('0x4'));router[_0x4011('0x5')]('/',auth[_0x4011('0x6')](),controller[_0x4011('0x7')]);router[_0x4011('0x5')](_0x4011('0x8'),auth[_0x4011('0x6')](),controller[_0x4011('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4011('0xa')]);router[_0x4011('0xb')]('/',auth[_0x4011('0x6')](),controller[_0x4011('0xc')]);router[_0x4011('0xd')](_0x4011('0xe'),auth[_0x4011('0x6')](),controller['update']);router[_0x4011('0xf')](_0x4011('0xe'),auth[_0x4011('0x6')](),controller[_0x4011('0x10')]);module[_0x4011('0x11')]=router; \ No newline at end of file +var _0xf2ea=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','show','post','create','/:id','exports','path','connect-timeout','express'];(function(_0x2212f2,_0x48f999){var _0x36a343=function(_0x26f6cb){while(--_0x26f6cb){_0x2212f2['push'](_0x2212f2['shift']());}};_0x36a343(++_0x48f999);}(_0xf2ea,0xeb));var _0xaf2e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf2ea[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaf2e('0x0'));var timeout=require(_0xaf2e('0x1'));var express=require(_0xaf2e('0x2'));var router=express[_0xaf2e('0x3')]();var fs_extra=require(_0xaf2e('0x4'));var auth=require(_0xaf2e('0x5'));var interaction=require(_0xaf2e('0x6'));var config=require('../../config/environment');var controller=require(_0xaf2e('0x7'));router[_0xaf2e('0x8')]('/',auth[_0xaf2e('0x9')](),controller[_0xaf2e('0xa')]);router['get']('/describe',auth[_0xaf2e('0x9')](),controller[_0xaf2e('0xb')]);router[_0xaf2e('0x8')]('/:id',auth[_0xaf2e('0x9')](),controller[_0xaf2e('0xc')]);router[_0xaf2e('0xd')]('/',auth['isAuthenticated'](),controller[_0xaf2e('0xe')]);router['put'](_0xaf2e('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xaf2e('0xf'),auth[_0xaf2e('0x9')](),controller['destroy']);module[_0xaf2e('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index a893397..37ede8f 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 _0x8679=['sequelize','exports','STRING','DATE','moment'];(function(_0x157b25,_0x5d2328){var _0x3d8e35=function(_0x109cca){while(--_0x109cca){_0x157b25['push'](_0x157b25['shift']());}};_0x3d8e35(++_0x5d2328);}(_0x8679,0x19e));var _0x9867=function(_0xba1974,_0xabda59){_0xba1974=_0xba1974-0x0;var _0x4a7a3d=_0x8679[_0xba1974];return _0x4a7a3d;};'use strict';var moment=require(_0x9867('0x0'));var Sequelize=require(_0x9867('0x1'));module[_0x9867('0x2')]={'uniqueid':{'type':Sequelize[_0x9867('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9867('0x4')]},'acceptAt':{'type':Sequelize[_0x9867('0x4')]},'exitAt':{'type':Sequelize[_0x9867('0x4')]},'reason':{'type':Sequelize[_0x9867('0x3')]}}; \ No newline at end of file +var _0x26aa=['STRING','DATE','sequelize','exports'];(function(_0x256605,_0x1ac03d){var _0x4fac8a=function(_0xe6a1f2){while(--_0xe6a1f2){_0x256605['push'](_0x256605['shift']());}};_0x4fac8a(++_0x1ac03d);}(_0x26aa,0xa2));var _0xa26a=function(_0x5a5773,_0x44edae){_0x5a5773=_0x5a5773-0x0;var _0x373a26=_0x26aa[_0x5a5773];return _0x373a26;};'use strict';var moment=require('moment');var Sequelize=require(_0xa26a('0x0'));module[_0xa26a('0x1')]={'uniqueid':{'type':Sequelize[_0xa26a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa26a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa26a('0x3')]},'acceptAt':{'type':Sequelize[_0xa26a('0x3')]},'exitAt':{'type':Sequelize[_0xa26a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a856d30..d0a2d87 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 _0xf681=['save','update','then','destroy','sendStatus','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','end','json','offset','undefined','limit','count','status','Content-Range','reject'];(function(_0x204bd4,_0x5cf21d){var _0x378902=function(_0x331336){while(--_0x331336){_0x204bd4['push'](_0x204bd4['shift']());}};_0x378902(++_0x5cf21d);}(_0xf681,0x74));var _0x1f68=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf681[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f68('0x0'));var zipdir=require(_0x1f68('0x1'));var jsonpatch=require(_0x1f68('0x2'));var rp=require(_0x1f68('0x3'));var moment=require(_0x1f68('0x4'));var BPromise=require(_0x1f68('0x5'));var Mustache=require('mustache');var util=require(_0x1f68('0x6'));var path=require(_0x1f68('0x7'));var sox=require(_0x1f68('0x8'));var csv=require(_0x1f68('0x9'));var ejs=require(_0x1f68('0xa'));var fs=require('fs');var fs_extra=require(_0x1f68('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f68('0xc'));var jsforce=require(_0x1f68('0xd'));var deskjs=require(_0x1f68('0xe'));var toCsv=require(_0x1f68('0x9'));var querystring=require('querystring');var Papa=require(_0x1f68('0xf'));var Redis=require(_0x1f68('0x10'));var authService=require(_0x1f68('0x11'));var qs=require(_0x1f68('0x12'));var as=require(_0x1f68('0x13'));var hardwareService=require(_0x1f68('0x14'));var logger=require(_0x1f68('0x15'))(_0x1f68('0x16'));var utils=require('../../config/utils');var config=require(_0x1f68('0x17'));var licenseUtil=require(_0x1f68('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x155ef1,_0x2c56d2){_0x2c56d2=_0x2c56d2||0xcc;return function(_0x30b8f6){if(_0x30b8f6){return _0x155ef1['sendStatus'](_0x2c56d2);}return _0x155ef1['status'](_0x2c56d2)[_0x1f68('0x19')]();};}function respondWithResult(_0x5daedc,_0x26cfe9){_0x26cfe9=_0x26cfe9||0xc8;return function(_0x1fe09a){if(_0x1fe09a){return _0x5daedc['status'](_0x26cfe9)[_0x1f68('0x1a')](_0x1fe09a);}};}function respondWithFilteredResult(_0x59547c,_0x4fae72){return function(_0x3bd55a){if(_0x3bd55a){var _0x3df604=typeof _0x4fae72[_0x1f68('0x1b')]===_0x1f68('0x1c')&&typeof _0x4fae72[_0x1f68('0x1d')]==='undefined';var _0x5ecf60=_0x3bd55a[_0x1f68('0x1e')];var _0x24383f=_0x3df604?0x0:_0x4fae72[_0x1f68('0x1b')];var _0x5d9302=_0x3df604?_0x3bd55a['count']:_0x4fae72['offset']+_0x4fae72[_0x1f68('0x1d')];var _0x48ade0;if(_0x5d9302>=_0x5ecf60){_0x5d9302=_0x5ecf60;_0x48ade0=0xc8;}else{_0x48ade0=0xce;}_0x59547c[_0x1f68('0x1f')](_0x48ade0);return _0x59547c['set'](_0x1f68('0x20'),_0x24383f+'-'+_0x5d9302+'/'+_0x5ecf60)[_0x1f68('0x1a')](_0x3bd55a);}return null;};}function patchUpdates(_0x1382fe){return function(_0x389b7d){try{jsonpatch['apply'](_0x389b7d,_0x1382fe,!![]);}catch(_0x123280){return BPromise[_0x1f68('0x21')](_0x123280);}return _0x389b7d[_0x1f68('0x22')]();};}function saveUpdates(_0x4525ed,_0x4981bb){return function(_0x5b277c){if(_0x5b277c){return _0x5b277c[_0x1f68('0x23')](_0x4525ed)[_0x1f68('0x24')](function(_0x48c1d3){return _0x48c1d3;});}return null;};}function removeEntity(_0xd3efa0,_0x1a35d7){return function(_0x4db4fd){if(_0x4db4fd){return _0x4db4fd[_0x1f68('0x25')]()[_0x1f68('0x24')](function(){_0xd3efa0['status'](0xcc)[_0x1f68('0x19')]();});}};}function handleEntityNotFound(_0x95b4f3,_0x57ff26){return function(_0x22e33b){if(!_0x22e33b){_0x95b4f3[_0x1f68('0x26')](0x194);}return _0x22e33b;};}function handleError(_0x1ad462,_0x38a912){_0x38a912=_0x38a912||0x1f4;return function(_0x18b039){logger[_0x1f68('0x27')](_0x18b039['stack']);if(_0x18b039[_0x1f68('0x28')]){delete _0x18b039[_0x1f68('0x28')];}_0x1ad462['status'](_0x38a912)[_0x1f68('0x29')](_0x18b039);};}exports[_0x1f68('0x2a')]=function(_0x3931da,_0x3628de){var _0xf854fd={},_0x46a3d4={},_0x4fe18b={'count':0x0,'rows':[]};var _0x2fcb01=_[_0x1f68('0x2b')](db[_0x1f68('0x2c')][_0x1f68('0x2d')],function(_0x4db7bb){return{'name':_0x4db7bb['fieldName'],'type':_0x4db7bb[_0x1f68('0x2e')][_0x1f68('0x2f')]};});_0x46a3d4[_0x1f68('0x30')]=_[_0x1f68('0x2b')](_0x2fcb01,_0x1f68('0x28'));_0x46a3d4[_0x1f68('0x31')]=_[_0x1f68('0x32')](_0x3931da[_0x1f68('0x31')]);_0x46a3d4[_0x1f68('0x33')]=_[_0x1f68('0x34')](_0x46a3d4[_0x1f68('0x30')],_0x46a3d4['query']);_0xf854fd['attributes']=_[_0x1f68('0x34')](_0x46a3d4['model'],qs[_0x1f68('0x35')](_0x3931da[_0x1f68('0x31')][_0x1f68('0x35')]));_0xf854fd['attributes']=_0xf854fd['attributes'][_0x1f68('0x36')]?_0xf854fd[_0x1f68('0x37')]:_0x46a3d4[_0x1f68('0x30')];if(!_0x3931da[_0x1f68('0x31')]['hasOwnProperty'](_0x1f68('0x38'))){_0xf854fd[_0x1f68('0x1d')]=qs[_0x1f68('0x1d')](_0x3931da[_0x1f68('0x31')][_0x1f68('0x1d')]);_0xf854fd[_0x1f68('0x1b')]=qs['offset'](_0x3931da['query'][_0x1f68('0x1b')]);}_0xf854fd['order']=qs[_0x1f68('0x39')](_0x3931da[_0x1f68('0x31')][_0x1f68('0x39')]);_0xf854fd['where']=qs[_0x1f68('0x33')](_[_0x1f68('0x3a')](_0x3931da[_0x1f68('0x31')],_0x46a3d4[_0x1f68('0x33')]),_0x2fcb01);if(_0x3931da[_0x1f68('0x31')]['filter']){_0xf854fd[_0x1f68('0x3b')]=_[_0x1f68('0x3c')](_0xf854fd[_0x1f68('0x3b')],{'$or':_[_0x1f68('0x2b')](_0x2fcb01,function(_0x3d2eb3){if(_0x3d2eb3[_0x1f68('0x2e')]!==_0x1f68('0x3d')){var _0x3d1718={};_0x3d1718[_0x3d2eb3[_0x1f68('0x28')]]={'$like':'%'+_0x3931da[_0x1f68('0x31')][_0x1f68('0x3e')]+'%'};return _0x3d1718;}})});}_0xf854fd=_[_0x1f68('0x3c')]({},_0xf854fd,_0x3931da[_0x1f68('0x3f')]);var _0x3178c4={'where':_0xf854fd[_0x1f68('0x3b')]};return db[_0x1f68('0x2c')][_0x1f68('0x1e')](_0x3178c4)['then'](function(_0x3a453f){_0x4fe18b[_0x1f68('0x1e')]=_0x3a453f;if(_0x3931da[_0x1f68('0x31')][_0x1f68('0x40')]){_0xf854fd[_0x1f68('0x41')]=[{'all':!![]}];}return db[_0x1f68('0x2c')][_0x1f68('0x42')](_0xf854fd);})[_0x1f68('0x24')](function(_0x1bc90a){_0x4fe18b[_0x1f68('0x43')]=_0x1bc90a;return _0x4fe18b;})[_0x1f68('0x24')](respondWithFilteredResult(_0x3628de,_0xf854fd))[_0x1f68('0x44')](handleError(_0x3628de,null));};exports[_0x1f68('0x45')]=function(_0x444be9,_0x107b21){var _0x121dee={'raw':!![],'where':{'id':_0x444be9[_0x1f68('0x46')]['id']}},_0x32a50e={};_0x32a50e[_0x1f68('0x30')]=_[_0x1f68('0x32')](db['OpenchannelQueueReport'][_0x1f68('0x2d')]);_0x32a50e['query']=_[_0x1f68('0x32')](_0x444be9[_0x1f68('0x31')]);_0x32a50e[_0x1f68('0x33')]=_['intersection'](_0x32a50e[_0x1f68('0x30')],_0x32a50e[_0x1f68('0x31')]);_0x121dee[_0x1f68('0x37')]=_[_0x1f68('0x34')](_0x32a50e[_0x1f68('0x30')],qs[_0x1f68('0x35')](_0x444be9[_0x1f68('0x31')][_0x1f68('0x35')]));_0x121dee['attributes']=_0x121dee['attributes']['length']?_0x121dee['attributes']:_0x32a50e[_0x1f68('0x30')];if(_0x444be9[_0x1f68('0x31')]['includeAll']){_0x121dee['include']=[{'all':!![]}];}_0x121dee=_[_0x1f68('0x3c')]({},_0x121dee,_0x444be9[_0x1f68('0x3f')]);return db[_0x1f68('0x2c')][_0x1f68('0x47')](_0x121dee)[_0x1f68('0x24')](handleEntityNotFound(_0x107b21,null))[_0x1f68('0x24')](respondWithResult(_0x107b21,null))[_0x1f68('0x44')](handleError(_0x107b21,null));};exports[_0x1f68('0x48')]=function(_0x15eb50,_0x1ac4fa){return db[_0x1f68('0x2c')][_0x1f68('0x48')](_0x15eb50[_0x1f68('0x49')],{})[_0x1f68('0x24')](respondWithResult(_0x1ac4fa,0xc9))[_0x1f68('0x44')](handleError(_0x1ac4fa,null));};exports[_0x1f68('0x23')]=function(_0x535831,_0x33659e){if(_0x535831[_0x1f68('0x49')]['id']){delete _0x535831[_0x1f68('0x49')]['id'];}return db[_0x1f68('0x2c')]['find']({'where':{'id':_0x535831['params']['id']}})[_0x1f68('0x24')](handleEntityNotFound(_0x33659e,null))[_0x1f68('0x24')](saveUpdates(_0x535831[_0x1f68('0x49')],null))['then'](respondWithResult(_0x33659e,null))[_0x1f68('0x44')](handleError(_0x33659e,null));};exports['destroy']=function(_0x3aed50,_0xb6e716){return db[_0x1f68('0x2c')][_0x1f68('0x47')]({'where':{'id':_0x3aed50[_0x1f68('0x46')]['id']}})[_0x1f68('0x24')](handleEntityNotFound(_0xb6e716,null))[_0x1f68('0x24')](removeEntity(_0xb6e716,null))[_0x1f68('0x44')](handleError(_0xb6e716,null));};exports[_0x1f68('0x4a')]=function(_0x19d73f,_0x447bb9){return db['OpenchannelQueueReport']['describe']()[_0x1f68('0x24')](respondWithResult(_0x447bb9,null))[_0x1f68('0x44')](handleError(_0x447bb9,null));}; \ No newline at end of file +var _0xd54d=['../../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','name','send','map','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x2d2317,_0x48c7bc){var _0x158973=function(_0x4845be){while(--_0x4845be){_0x2d2317['push'](_0x2d2317['shift']());}};_0x158973(++_0x48c7bc);}(_0xd54d,0x154));var _0xdd54=function(_0x2b3ba6,_0x6ae989){_0x2b3ba6=_0x2b3ba6-0x0;var _0xfc181=_0xd54d[_0x2b3ba6];return _0xfc181;};'use strict';var emlformat=require(_0xdd54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd54('0x1'));var jsonpatch=require(_0xdd54('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd54('0x3'));var Mustache=require(_0xdd54('0x4'));var util=require(_0xdd54('0x5'));var path=require(_0xdd54('0x6'));var sox=require(_0xdd54('0x7'));var csv=require(_0xdd54('0x8'));var ejs=require(_0xdd54('0x9'));var fs=require('fs');var fs_extra=require(_0xdd54('0xa'));var _=require('lodash');var squel=require(_0xdd54('0xb'));var crypto=require(_0xdd54('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd54('0x8'));var querystring=require(_0xdd54('0xd'));var Papa=require(_0xdd54('0xe'));var Redis=require('ioredis');var authService=require(_0xdd54('0xf'));var qs=require(_0xdd54('0x10'));var as=require(_0xdd54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd54('0x12'))(_0xdd54('0x13'));var utils=require(_0xdd54('0x14'));var config=require(_0xdd54('0x15'));var licenseUtil=require(_0xdd54('0x16'));var db=require(_0xdd54('0x17'))['db'];function respondWithStatusCode(_0x43931e,_0x26d239){_0x26d239=_0x26d239||0xcc;return function(_0x1d24c8){if(_0x1d24c8){return _0x43931e[_0xdd54('0x18')](_0x26d239);}return _0x43931e[_0xdd54('0x19')](_0x26d239)[_0xdd54('0x1a')]();};}function respondWithResult(_0x1ffba6,_0x2e4817){_0x2e4817=_0x2e4817||0xc8;return function(_0x2dbdb6){if(_0x2dbdb6){return _0x1ffba6[_0xdd54('0x19')](_0x2e4817)['json'](_0x2dbdb6);}};}function respondWithFilteredResult(_0x448aff,_0x58cff5){return function(_0x3ebd1a){if(_0x3ebd1a){var _0x4ad1e6=typeof _0x58cff5[_0xdd54('0x1b')]===_0xdd54('0x1c')&&typeof _0x58cff5[_0xdd54('0x1d')]===_0xdd54('0x1c');var _0x1d7896=_0x3ebd1a[_0xdd54('0x1e')];var _0x363b5b=_0x4ad1e6?0x0:_0x58cff5[_0xdd54('0x1b')];var _0x1bd251=_0x4ad1e6?_0x3ebd1a['count']:_0x58cff5['offset']+_0x58cff5['limit'];var _0x4eb313;if(_0x1bd251>=_0x1d7896){_0x1bd251=_0x1d7896;_0x4eb313=0xc8;}else{_0x4eb313=0xce;}_0x448aff[_0xdd54('0x19')](_0x4eb313);return _0x448aff[_0xdd54('0x1f')](_0xdd54('0x20'),_0x363b5b+'-'+_0x1bd251+'/'+_0x1d7896)[_0xdd54('0x21')](_0x3ebd1a);}return null;};}function patchUpdates(_0x17c9b6){return function(_0x4d9168){try{jsonpatch[_0xdd54('0x22')](_0x4d9168,_0x17c9b6,!![]);}catch(_0x271da3){return BPromise[_0xdd54('0x23')](_0x271da3);}return _0x4d9168[_0xdd54('0x24')]();};}function saveUpdates(_0x16d042,_0x4e2142){return function(_0x44e987){if(_0x44e987){return _0x44e987[_0xdd54('0x25')](_0x16d042)[_0xdd54('0x26')](function(_0x5486fd){return _0x5486fd;});}return null;};}function removeEntity(_0x124e69,_0x249539){return function(_0x3a17cc){if(_0x3a17cc){return _0x3a17cc[_0xdd54('0x27')]()['then'](function(){_0x124e69['status'](0xcc)[_0xdd54('0x1a')]();});}};}function handleEntityNotFound(_0x15dade,_0x565edd){return function(_0x217b76){if(!_0x217b76){_0x15dade['sendStatus'](0x194);}return _0x217b76;};}function handleError(_0x367ef6,_0x1aa6f6){_0x1aa6f6=_0x1aa6f6||0x1f4;return function(_0x5df6bd){logger['error'](_0x5df6bd['stack']);if(_0x5df6bd[_0xdd54('0x28')]){delete _0x5df6bd[_0xdd54('0x28')];}_0x367ef6['status'](_0x1aa6f6)[_0xdd54('0x29')](_0x5df6bd);};}exports['index']=function(_0x49d4a1,_0x1552eb){var _0x431abd={},_0x20a85c={},_0x3fc48c={'count':0x0,'rows':[]};var _0xd0a2f5=_[_0xdd54('0x2a')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x49f52b){return{'name':_0x49f52b['fieldName'],'type':_0x49f52b['type']['key']};});_0x20a85c[_0xdd54('0x2b')]=_[_0xdd54('0x2a')](_0xd0a2f5,_0xdd54('0x28'));_0x20a85c[_0xdd54('0x2c')]=_[_0xdd54('0x2d')](_0x49d4a1[_0xdd54('0x2c')]);_0x20a85c[_0xdd54('0x2e')]=_[_0xdd54('0x2f')](_0x20a85c[_0xdd54('0x2b')],_0x20a85c['query']);_0x431abd[_0xdd54('0x30')]=_[_0xdd54('0x2f')](_0x20a85c['model'],qs[_0xdd54('0x31')](_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x31')]));_0x431abd[_0xdd54('0x30')]=_0x431abd[_0xdd54('0x30')][_0xdd54('0x32')]?_0x431abd['attributes']:_0x20a85c[_0xdd54('0x2b')];if(!_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x33')](_0xdd54('0x34'))){_0x431abd['limit']=qs[_0xdd54('0x1d')](_0x49d4a1['query'][_0xdd54('0x1d')]);_0x431abd[_0xdd54('0x1b')]=qs[_0xdd54('0x1b')](_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x1b')]);}_0x431abd[_0xdd54('0x35')]=qs[_0xdd54('0x36')](_0x49d4a1['query'][_0xdd54('0x36')]);_0x431abd[_0xdd54('0x37')]=qs['filters'](_[_0xdd54('0x38')](_0x49d4a1[_0xdd54('0x2c')],_0x20a85c[_0xdd54('0x2e')]),_0xd0a2f5);if(_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x39')]){_0x431abd[_0xdd54('0x37')]=_[_0xdd54('0x3a')](_0x431abd[_0xdd54('0x37')],{'$or':_[_0xdd54('0x2a')](_0xd0a2f5,function(_0x5aff8f){if(_0x5aff8f['type']!==_0xdd54('0x3b')){var _0x235ede={};_0x235ede[_0x5aff8f[_0xdd54('0x28')]]={'$like':'%'+_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x39')]+'%'};return _0x235ede;}})});}_0x431abd=_[_0xdd54('0x3a')]({},_0x431abd,_0x49d4a1[_0xdd54('0x3c')]);var _0x355595={'where':_0x431abd[_0xdd54('0x37')]};return db[_0xdd54('0x3d')][_0xdd54('0x1e')](_0x355595)['then'](function(_0x304930){_0x3fc48c[_0xdd54('0x1e')]=_0x304930;if(_0x49d4a1[_0xdd54('0x2c')][_0xdd54('0x3e')]){_0x431abd[_0xdd54('0x3f')]=[{'all':!![]}];}return db[_0xdd54('0x3d')][_0xdd54('0x40')](_0x431abd);})['then'](function(_0x5b025c){_0x3fc48c['rows']=_0x5b025c;return _0x3fc48c;})['then'](respondWithFilteredResult(_0x1552eb,_0x431abd))[_0xdd54('0x41')](handleError(_0x1552eb,null));};exports['show']=function(_0x86eea9,_0x2f76b4){var _0x20a2df={'raw':!![],'where':{'id':_0x86eea9[_0xdd54('0x42')]['id']}},_0x6876f5={};_0x6876f5[_0xdd54('0x2b')]=_[_0xdd54('0x2d')](db['OpenchannelQueueReport'][_0xdd54('0x43')]);_0x6876f5[_0xdd54('0x2c')]=_[_0xdd54('0x2d')](_0x86eea9[_0xdd54('0x2c')]);_0x6876f5[_0xdd54('0x2e')]=_[_0xdd54('0x2f')](_0x6876f5['model'],_0x6876f5[_0xdd54('0x2c')]);_0x20a2df[_0xdd54('0x30')]=_[_0xdd54('0x2f')](_0x6876f5[_0xdd54('0x2b')],qs[_0xdd54('0x31')](_0x86eea9[_0xdd54('0x2c')][_0xdd54('0x31')]));_0x20a2df[_0xdd54('0x30')]=_0x20a2df[_0xdd54('0x30')][_0xdd54('0x32')]?_0x20a2df[_0xdd54('0x30')]:_0x6876f5[_0xdd54('0x2b')];if(_0x86eea9['query'][_0xdd54('0x3e')]){_0x20a2df[_0xdd54('0x3f')]=[{'all':!![]}];}_0x20a2df=_['merge']({},_0x20a2df,_0x86eea9['options']);return db[_0xdd54('0x3d')][_0xdd54('0x44')](_0x20a2df)[_0xdd54('0x26')](handleEntityNotFound(_0x2f76b4,null))[_0xdd54('0x26')](respondWithResult(_0x2f76b4,null))[_0xdd54('0x41')](handleError(_0x2f76b4,null));};exports['create']=function(_0x2bbe86,_0x447bf8){return db[_0xdd54('0x3d')][_0xdd54('0x45')](_0x2bbe86['body'],{})[_0xdd54('0x26')](respondWithResult(_0x447bf8,0xc9))[_0xdd54('0x41')](handleError(_0x447bf8,null));};exports[_0xdd54('0x25')]=function(_0x1d98d1,_0x55a93d){if(_0x1d98d1[_0xdd54('0x46')]['id']){delete _0x1d98d1['body']['id'];}return db[_0xdd54('0x3d')][_0xdd54('0x44')]({'where':{'id':_0x1d98d1[_0xdd54('0x42')]['id']}})[_0xdd54('0x26')](handleEntityNotFound(_0x55a93d,null))[_0xdd54('0x26')](saveUpdates(_0x1d98d1['body'],null))[_0xdd54('0x26')](respondWithResult(_0x55a93d,null))['catch'](handleError(_0x55a93d,null));};exports[_0xdd54('0x27')]=function(_0x6a88df,_0x30f43c){return db['OpenchannelQueueReport'][_0xdd54('0x44')]({'where':{'id':_0x6a88df[_0xdd54('0x42')]['id']}})[_0xdd54('0x26')](handleEntityNotFound(_0x30f43c,null))['then'](removeEntity(_0x30f43c,null))['catch'](handleError(_0x30f43c,null));};exports[_0xdd54('0x47')]=function(_0x2d69bb,_0x37f97d){return db[_0xdd54('0x3d')][_0xdd54('0x47')]()[_0xdd54('0x26')](respondWithResult(_0x37f97d,null))[_0xdd54('0x41')](handleError(_0x37f97d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 23e6cf9..7d44e43 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x5da0e9,_0x43c898){var _0x4b022d=function(_0x2aefc2){while(--_0x2aefc2){_0x5da0e9['push'](_0x5da0e9['shift']());}};_0x4b022d(++_0x43c898);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x5fc3[_0x2a8860];return _0x2f47a4;};'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'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0xaf4b4a,_0x190a02){var _0x6ead88=function(_0x49b7ee){while(--_0x49b7ee){_0xaf4b4a['push'](_0xaf4b4a['shift']());}};_0x6ead88(++_0x190a02);}(_0x2ef3,0xba));var _0x32ef=function(_0x321f93,_0x275a05){_0x321f93=_0x321f93-0x0;var _0xba4680=_0x2ef3[_0x321f93];return _0xba4680;};'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':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 26fd433..28d4eba 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 _0x2b65=['jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','stringify','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x56500a,_0x5953c7){var _0x333977=function(_0x374007){while(--_0x374007){_0x56500a['push'](_0x56500a['shift']());}};_0x333977(++_0x5953c7);}(_0x2b65,0x131));var _0x52b6=function(_0x5d1594,_0x105585){_0x5d1594=_0x5d1594-0x0;var _0x5c4153=_0x2b65[_0x5d1594];return _0x5c4153;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d451f,_0x70579,_0x1af78f){return new BPromise(function(_0x432726,_0x27c5b9){return client['request'](_0x2d451f,_0x1af78f)[_0x52b6('0xd')](function(_0x1c2cb5){logger[_0x52b6('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70579,_0x52b6('0xf'));logger[_0x52b6('0x10')](_0x52b6('0x11'),_0x70579,_0x52b6('0xf'),JSON['stringify'](_0x1c2cb5));if(_0x1c2cb5[_0x52b6('0x12')]){if(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x13')]===0x1f4){logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')]['message']);return _0x27c5b9(_0x1c2cb5[_0x52b6('0x12')]['message']);}logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);return _0x432726(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);}else{logger[_0x52b6('0xe')](_0x52b6('0x14'),_0x70579,_0x52b6('0xf'));_0x432726(_0x1c2cb5[_0x52b6('0x16')][_0x52b6('0x15')]);}})[_0x52b6('0x17')](function(_0x307594){logger[_0x52b6('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x70579,_0x307594);_0x27c5b9(_0x307594);});});}exports[_0x52b6('0x18')]=function(_0x2fa3ed){var _0x9bab0a=this;return new Promise(function(_0x47d203,_0x36d376){return db[_0x52b6('0x19')]['create'](_0x2fa3ed['body'],{'raw':_0x2fa3ed[_0x52b6('0x1a')]?_0x2fa3ed['options'][_0x52b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2e472f){logger[_0x52b6('0xe')](_0x52b6('0x18'),_0x2fa3ed);logger[_0x52b6('0x10')]('CreateOpenchannelQueueReport',_0x2fa3ed,JSON[_0x52b6('0x1c')](_0x2e472f));_0x47d203(_0x2e472f);})[_0x52b6('0x17')](function(_0x1246db){logger[_0x52b6('0x12')](_0x52b6('0x18'),_0x1246db[_0x52b6('0x15')],_0x2fa3ed);_0x36d376(_0x9bab0a[_0x52b6('0x12')](0x1f4,_0x1246db[_0x52b6('0x15')]));});});};exports[_0x52b6('0x1d')]=function(_0x55aa4c){var _0x2a97c0=this;return new Promise(function(_0x2ff6f4,_0x3a2fb0){return db[_0x52b6('0x19')][_0x52b6('0x1e')](_0x55aa4c[_0x52b6('0x1f')],{'raw':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x20')]||null:null,'attributes':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c[_0x52b6('0x1a')][_0x52b6('0x21')]||null:null,'limit':_0x55aa4c[_0x52b6('0x1a')]?_0x55aa4c['options'][_0x52b6('0x22')]||null:null})[_0x52b6('0xd')](function(_0x1716b6){logger[_0x52b6('0xe')](_0x52b6('0x1d'),_0x55aa4c);logger[_0x52b6('0x10')](_0x52b6('0x1d'),_0x55aa4c,JSON['stringify'](_0x1716b6));_0x2ff6f4(_0x1716b6);})[_0x52b6('0x17')](function(_0x42ac9b){logger['error'](_0x52b6('0x1d'),_0x42ac9b[_0x52b6('0x15')],_0x55aa4c);_0x3a2fb0(_0x2a97c0[_0x52b6('0x12')](0x1f4,_0x42ac9b[_0x52b6('0x15')]));});});}; \ No newline at end of file +var _0xe605=['UpdateOpenchannelQueueReport','update','where','attributes','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe605,0x92));var _0x5e60=function(_0x3d123b,_0xe8917){_0x3d123b=_0x3d123b-0x0;var _0x178527=_0xe605[_0x3d123b];return _0x178527;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var rs=require(_0x5e60('0x3'));var fs=require('fs');var Redis=require(_0x5e60('0x4'));var db=require(_0x5e60('0x5'))['db'];var utils=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var config=require(_0x5e60('0x9'));var jayson=require(_0x5e60('0xa'));var client=jayson[_0x5e60('0xb')][_0x5e60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x168a14,_0x4e3501,_0x1c5a6f){return new BPromise(function(_0x55ff5c,_0x593118){return client['request'](_0x168a14,_0x1c5a6f)[_0x5e60('0xd')](function(_0xe93f9c){logger[_0x5e60('0xe')](_0x5e60('0xf'),_0x4e3501,_0x5e60('0x10'));logger[_0x5e60('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4e3501,_0x5e60('0x10'),JSON['stringify'](_0xe93f9c));if(_0xe93f9c[_0x5e60('0x12')]){if(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x13')]===0x1f4){logger['error'](_0x5e60('0xf'),_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x593118(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}logger[_0x5e60('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e3501,_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);return _0x55ff5c(_0xe93f9c[_0x5e60('0x12')][_0x5e60('0x14')]);}else{logger['info'](_0x5e60('0xf'),_0x4e3501,'request\x20sent');_0x55ff5c(_0xe93f9c[_0x5e60('0x15')][_0x5e60('0x14')]);}})['catch'](function(_0x39be57){logger[_0x5e60('0x12')](_0x5e60('0xf'),_0x4e3501,_0x39be57);_0x593118(_0x39be57);});});}exports[_0x5e60('0x16')]=function(_0x5c485d){var _0xdd0a71=this;return new Promise(function(_0x22d718,_0x52cc15){return db[_0x5e60('0x17')][_0x5e60('0x18')](_0x5c485d[_0x5e60('0x19')],{'raw':_0x5c485d[_0x5e60('0x1a')]?_0x5c485d[_0x5e60('0x1a')][_0x5e60('0x1b')]===undefined?!![]:![]:!![]})[_0x5e60('0xd')](function(_0x524c93){logger[_0x5e60('0xe')](_0x5e60('0x16'),_0x5c485d);logger[_0x5e60('0x11')]('CreateOpenchannelQueueReport',_0x5c485d,JSON[_0x5e60('0x1c')](_0x524c93));_0x22d718(_0x524c93);})['catch'](function(_0x376069){logger[_0x5e60('0x12')](_0x5e60('0x16'),_0x376069[_0x5e60('0x14')],_0x5c485d);_0x52cc15(_0xdd0a71[_0x5e60('0x12')](0x1f4,_0x376069[_0x5e60('0x14')]));});});};exports[_0x5e60('0x1d')]=function(_0x5d2c03){var _0x18d527=this;return new Promise(function(_0x7dbdb7,_0x19f37b){return db['OpenchannelQueueReport'][_0x5e60('0x1e')](_0x5d2c03[_0x5e60('0x19')],{'raw':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03[_0x5e60('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x1f')]||null:null,'attributes':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x20')]||null:null,'limit':_0x5d2c03[_0x5e60('0x1a')]?_0x5d2c03['options'][_0x5e60('0x21')]||null:null})[_0x5e60('0xd')](function(_0x52c97c){logger['info']('UpdateOpenchannelQueueReport',_0x5d2c03);logger[_0x5e60('0x11')](_0x5e60('0x1d'),_0x5d2c03,JSON[_0x5e60('0x1c')](_0x52c97c));_0x7dbdb7(_0x52c97c);})[_0x5e60('0x22')](function(_0x3ccfee){logger['error'](_0x5e60('0x1d'),_0x3ccfee[_0x5e60('0x14')],_0x5d2c03);_0x19f37b(_0x18d527['error'](0x1f4,_0x3ccfee[_0x5e60('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ee19d63..ba68c25 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 _0xa7ce=['/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x35d6a3,_0x5ae64d){var _0x13d064=function(_0x301be2){while(--_0x301be2){_0x35d6a3['push'](_0x35d6a3['shift']());}};_0x13d064(++_0x5ae64d);}(_0xa7ce,0x181));var _0xea7c=function(_0x13a4e1,_0x5cada4){_0x13a4e1=_0x13a4e1-0x0;var _0x50ac9=_0xa7ce[_0x13a4e1];return _0x50ac9;};'use strict';var multer=require(_0xea7c('0x0'));var util=require('util');var path=require(_0xea7c('0x1'));var timeout=require(_0xea7c('0x2'));var express=require(_0xea7c('0x3'));var router=express[_0xea7c('0x4')]();var fs_extra=require(_0xea7c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xea7c('0x6'));var config=require(_0xea7c('0x7'));var controller=require(_0xea7c('0x8'));router[_0xea7c('0x9')]('/',auth[_0xea7c('0xa')](),controller['index']);router[_0xea7c('0x9')](_0xea7c('0xb'),auth[_0xea7c('0xa')](),controller[_0xea7c('0xc')]);router[_0xea7c('0x9')]('/:id',auth[_0xea7c('0xa')](),controller[_0xea7c('0xd')]);router[_0xea7c('0xe')]('/',auth[_0xea7c('0xa')](),controller[_0xea7c('0xf')]);router[_0xea7c('0x10')](_0xea7c('0x11'),auth['isAuthenticated'](),controller[_0xea7c('0x12')]);router[_0xea7c('0x13')](_0xea7c('0x11'),auth[_0xea7c('0xa')](),controller[_0xea7c('0x14')]);module[_0xea7c('0x15')]=router; \ No newline at end of file +var _0xe083=['show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x567b0d,_0x498c8a){var _0x3b223f=function(_0x55ff76){while(--_0x55ff76){_0x567b0d['push'](_0x567b0d['shift']());}};_0x3b223f(++_0x498c8a);}(_0xe083,0x195));var _0x3e08=function(_0x586a76,_0x144520){_0x586a76=_0x586a76-0x0;var _0x193b99=_0xe083[_0x586a76];return _0x193b99;};'use strict';var multer=require('multer');var util=require(_0x3e08('0x0'));var path=require(_0x3e08('0x1'));var timeout=require(_0x3e08('0x2'));var express=require(_0x3e08('0x3'));var router=express[_0x3e08('0x4')]();var fs_extra=require(_0x3e08('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e08('0x6'));var controller=require(_0x3e08('0x7'));router['get']('/',auth[_0x3e08('0x8')](),controller['index']);router[_0x3e08('0x9')](_0x3e08('0xa'),auth[_0x3e08('0x8')](),controller[_0x3e08('0xb')]);router[_0x3e08('0x9')](_0x3e08('0xc'),auth[_0x3e08('0x8')](),controller[_0x3e08('0xd')]);router[_0x3e08('0xe')]('/',auth['isAuthenticated'](),controller[_0x3e08('0xf')]);router['put'](_0x3e08('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3e08('0x10')]('/:id',auth[_0x3e08('0x8')](),controller[_0x3e08('0x11')]);module[_0x3e08('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7a0b785..f23c13a 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5c3514,_0x18e281){var _0x56e259=function(_0x4914e3){while(--_0x4914e3){_0x5c3514['push'](_0x5c3514['shift']());}};_0x56e259(++_0x18e281);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x416df5,_0x5cd9e7){var _0x53235b=function(_0xc8811e){while(--_0xc8811e){_0x416df5['push'](_0x416df5['shift']());}};_0x53235b(++_0x5cd9e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ae5a4ae..d296b8d 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 _0x0df7=['util','sox','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','index','map','OpenchannelTransferReport','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0x0df7,0x87));var _0x70df=function(_0x880494,_0x4f96fe){_0x880494=_0x880494-0x0;var _0x52c10b=_0x0df7[_0x880494];return _0x52c10b;};'use strict';var emlformat=require(_0x70df('0x0'));var rimraf=require(_0x70df('0x1'));var zipdir=require(_0x70df('0x2'));var jsonpatch=require(_0x70df('0x3'));var rp=require(_0x70df('0x4'));var moment=require('moment');var BPromise=require(_0x70df('0x5'));var Mustache=require(_0x70df('0x6'));var util=require(_0x70df('0x7'));var path=require('path');var sox=require(_0x70df('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70df('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x70df('0xa'));var toCsv=require('to-csv');var querystring=require(_0x70df('0xb'));var Papa=require(_0x70df('0xc'));var Redis=require(_0x70df('0xd'));var authService=require(_0x70df('0xe'));var qs=require(_0x70df('0xf'));var as=require(_0x70df('0x10'));var hardwareService=require(_0x70df('0x11'));var logger=require('../../config/logger')(_0x70df('0x12'));var utils=require(_0x70df('0x13'));var config=require(_0x70df('0x14'));var licenseUtil=require(_0x70df('0x15'));var db=require(_0x70df('0x16'))['db'];function respondWithStatusCode(_0x2d6d7f,_0x4e518d){_0x4e518d=_0x4e518d||0xcc;return function(_0x1307b2){if(_0x1307b2){return _0x2d6d7f[_0x70df('0x17')](_0x4e518d);}return _0x2d6d7f[_0x70df('0x18')](_0x4e518d)[_0x70df('0x19')]();};}function respondWithResult(_0x41f6ed,_0xf16f26){_0xf16f26=_0xf16f26||0xc8;return function(_0x5d5984){if(_0x5d5984){return _0x41f6ed[_0x70df('0x18')](_0xf16f26)['json'](_0x5d5984);}};}function respondWithFilteredResult(_0x205f24,_0x2340cf){return function(_0x3bf63f){if(_0x3bf63f){var _0x1c1fe6=typeof _0x2340cf['offset']==='undefined'&&typeof _0x2340cf[_0x70df('0x1a')]==='undefined';var _0x5cc5f2=_0x3bf63f[_0x70df('0x1b')];var _0x433929=_0x1c1fe6?0x0:_0x2340cf[_0x70df('0x1c')];var _0x191817=_0x1c1fe6?_0x3bf63f['count']:_0x2340cf[_0x70df('0x1c')]+_0x2340cf[_0x70df('0x1a')];var _0x4f8a29;if(_0x191817>=_0x5cc5f2){_0x191817=_0x5cc5f2;_0x4f8a29=0xc8;}else{_0x4f8a29=0xce;}_0x205f24[_0x70df('0x18')](_0x4f8a29);return _0x205f24[_0x70df('0x1d')](_0x70df('0x1e'),_0x433929+'-'+_0x191817+'/'+_0x5cc5f2)[_0x70df('0x1f')](_0x3bf63f);}return null;};}function patchUpdates(_0xa509d5){return function(_0x4de4ba){try{jsonpatch['apply'](_0x4de4ba,_0xa509d5,!![]);}catch(_0x7a9640){return BPromise[_0x70df('0x20')](_0x7a9640);}return _0x4de4ba[_0x70df('0x21')]();};}function saveUpdates(_0xd48033,_0x3b7f83){return function(_0x1d96b8){if(_0x1d96b8){return _0x1d96b8[_0x70df('0x22')](_0xd48033)['then'](function(_0x5307e6){return _0x5307e6;});}return null;};}function removeEntity(_0xdfc672,_0x352b18){return function(_0x50f6a0){if(_0x50f6a0){return _0x50f6a0[_0x70df('0x23')]()[_0x70df('0x24')](function(){_0xdfc672[_0x70df('0x18')](0xcc)[_0x70df('0x19')]();});}};}function handleEntityNotFound(_0x49004d,_0x8c0084){return function(_0x419c70){if(!_0x419c70){_0x49004d[_0x70df('0x17')](0x194);}return _0x419c70;};}function handleError(_0x3cf792,_0x16d7f2){_0x16d7f2=_0x16d7f2||0x1f4;return function(_0x196098){logger['error'](_0x196098[_0x70df('0x25')]);if(_0x196098[_0x70df('0x26')]){delete _0x196098['name'];}_0x3cf792[_0x70df('0x18')](_0x16d7f2)[_0x70df('0x27')](_0x196098);};}exports[_0x70df('0x28')]=function(_0x48cf2a,_0x1a3009){var _0x4ef8a4={},_0x5ef007={},_0x1f7a36={'count':0x0,'rows':[]};var _0x24e3e3=_[_0x70df('0x29')](db[_0x70df('0x2a')]['rawAttributes'],function(_0x2bc465){return{'name':_0x2bc465['fieldName'],'type':_0x2bc465['type'][_0x70df('0x2b')]};});_0x5ef007[_0x70df('0x2c')]=_[_0x70df('0x29')](_0x24e3e3,'name');_0x5ef007[_0x70df('0x2d')]=_[_0x70df('0x2e')](_0x48cf2a[_0x70df('0x2d')]);_0x5ef007[_0x70df('0x2f')]=_['intersection'](_0x5ef007[_0x70df('0x2c')],_0x5ef007[_0x70df('0x2d')]);_0x4ef8a4[_0x70df('0x30')]=_[_0x70df('0x31')](_0x5ef007[_0x70df('0x2c')],qs[_0x70df('0x32')](_0x48cf2a[_0x70df('0x2d')]['fields']));_0x4ef8a4[_0x70df('0x30')]=_0x4ef8a4['attributes'][_0x70df('0x33')]?_0x4ef8a4['attributes']:_0x5ef007[_0x70df('0x2c')];if(!_0x48cf2a['query']['hasOwnProperty'](_0x70df('0x34'))){_0x4ef8a4[_0x70df('0x1a')]=qs[_0x70df('0x1a')](_0x48cf2a[_0x70df('0x2d')][_0x70df('0x1a')]);_0x4ef8a4[_0x70df('0x1c')]=qs[_0x70df('0x1c')](_0x48cf2a[_0x70df('0x2d')][_0x70df('0x1c')]);}_0x4ef8a4['order']=qs[_0x70df('0x35')](_0x48cf2a['query']['sort']);_0x4ef8a4[_0x70df('0x36')]=qs[_0x70df('0x2f')](_[_0x70df('0x37')](_0x48cf2a[_0x70df('0x2d')],_0x5ef007[_0x70df('0x2f')]),_0x24e3e3);if(_0x48cf2a['query'][_0x70df('0x38')]){_0x4ef8a4[_0x70df('0x36')]=_[_0x70df('0x39')](_0x4ef8a4[_0x70df('0x36')],{'$or':_[_0x70df('0x29')](_0x24e3e3,function(_0x141469){if(_0x141469['type']!==_0x70df('0x3a')){var _0x34ca20={};_0x34ca20[_0x141469[_0x70df('0x26')]]={'$like':'%'+_0x48cf2a['query'][_0x70df('0x38')]+'%'};return _0x34ca20;}})});}_0x4ef8a4=_[_0x70df('0x39')]({},_0x4ef8a4,_0x48cf2a[_0x70df('0x3b')]);var _0x33f95={'where':_0x4ef8a4[_0x70df('0x36')]};return db[_0x70df('0x2a')][_0x70df('0x1b')](_0x33f95)['then'](function(_0x529d1c){_0x1f7a36[_0x70df('0x1b')]=_0x529d1c;if(_0x48cf2a['query'][_0x70df('0x3c')]){_0x4ef8a4['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x70df('0x3d')](_0x4ef8a4);})['then'](function(_0x459f34){_0x1f7a36[_0x70df('0x3e')]=_0x459f34;return _0x1f7a36;})[_0x70df('0x24')](respondWithFilteredResult(_0x1a3009,_0x4ef8a4))[_0x70df('0x3f')](handleError(_0x1a3009,null));};exports['show']=function(_0x2ef0bd,_0x19e759){var _0x3fb273={'raw':!![],'where':{'id':_0x2ef0bd[_0x70df('0x40')]['id']}},_0x230bc3={};_0x230bc3[_0x70df('0x2c')]=_['keys'](db['OpenchannelTransferReport'][_0x70df('0x41')]);_0x230bc3[_0x70df('0x2d')]=_[_0x70df('0x2e')](_0x2ef0bd[_0x70df('0x2d')]);_0x230bc3[_0x70df('0x2f')]=_['intersection'](_0x230bc3['model'],_0x230bc3[_0x70df('0x2d')]);_0x3fb273[_0x70df('0x30')]=_[_0x70df('0x31')](_0x230bc3[_0x70df('0x2c')],qs[_0x70df('0x32')](_0x2ef0bd[_0x70df('0x2d')][_0x70df('0x32')]));_0x3fb273[_0x70df('0x30')]=_0x3fb273[_0x70df('0x30')][_0x70df('0x33')]?_0x3fb273['attributes']:_0x230bc3[_0x70df('0x2c')];if(_0x2ef0bd['query'][_0x70df('0x3c')]){_0x3fb273[_0x70df('0x42')]=[{'all':!![]}];}_0x3fb273=_[_0x70df('0x39')]({},_0x3fb273,_0x2ef0bd[_0x70df('0x3b')]);return db[_0x70df('0x2a')]['find'](_0x3fb273)['then'](handleEntityNotFound(_0x19e759,null))[_0x70df('0x24')](respondWithResult(_0x19e759,null))[_0x70df('0x3f')](handleError(_0x19e759,null));};exports[_0x70df('0x43')]=function(_0x799087,_0x245bb9){return db[_0x70df('0x2a')][_0x70df('0x43')](_0x799087[_0x70df('0x44')],{})[_0x70df('0x24')](respondWithResult(_0x245bb9,0xc9))[_0x70df('0x3f')](handleError(_0x245bb9,null));};exports[_0x70df('0x22')]=function(_0x24531a,_0x3c7375){if(_0x24531a[_0x70df('0x44')]['id']){delete _0x24531a[_0x70df('0x44')]['id'];}return db[_0x70df('0x2a')][_0x70df('0x45')]({'where':{'id':_0x24531a['params']['id']}})['then'](handleEntityNotFound(_0x3c7375,null))[_0x70df('0x24')](saveUpdates(_0x24531a[_0x70df('0x44')],null))[_0x70df('0x24')](respondWithResult(_0x3c7375,null))[_0x70df('0x3f')](handleError(_0x3c7375,null));};exports['destroy']=function(_0x15966c,_0x21dc34){return db[_0x70df('0x2a')][_0x70df('0x45')]({'where':{'id':_0x15966c[_0x70df('0x40')]['id']}})[_0x70df('0x24')](handleEntityNotFound(_0x21dc34,null))['then'](removeEntity(_0x21dc34,null))[_0x70df('0x3f')](handleError(_0x21dc34,null));};exports['describe']=function(_0x136cfc,_0x58670d){return db['OpenchannelTransferReport'][_0x70df('0x46')]()[_0x70df('0x24')](respondWithResult(_0x58670d,null))[_0x70df('0x3f')](handleError(_0x58670d,null));}; \ No newline at end of file +var _0xd8c5=['then','destroy','sendStatus','error','stack','name','send','OpenchannelTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject'];(function(_0x598d0a,_0x483ecf){var _0x511cc2=function(_0x56e864){while(--_0x56e864){_0x598d0a['push'](_0x598d0a['shift']());}};_0x511cc2(++_0x483ecf);}(_0xd8c5,0xff));var _0x5d8c=function(_0x4f1bb7,_0x42a7d1){_0x4f1bb7=_0x4f1bb7-0x0;var _0x4ce414=_0xd8c5[_0x4f1bb7];return _0x4ce414;};'use strict';var emlformat=require(_0x5d8c('0x0'));var rimraf=require(_0x5d8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d8c('0x2'));var moment=require('moment');var BPromise=require(_0x5d8c('0x3'));var Mustache=require(_0x5d8c('0x4'));var util=require(_0x5d8c('0x5'));var path=require(_0x5d8c('0x6'));var sox=require(_0x5d8c('0x7'));var csv=require(_0x5d8c('0x8'));var ejs=require(_0x5d8c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5d8c('0xa'));var crypto=require(_0x5d8c('0xb'));var jsforce=require(_0x5d8c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5d8c('0x8'));var querystring=require(_0x5d8c('0xd'));var Papa=require(_0x5d8c('0xe'));var Redis=require('ioredis');var authService=require(_0x5d8c('0xf'));var qs=require(_0x5d8c('0x10'));var as=require(_0x5d8c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d8c('0x12'))('api');var utils=require(_0x5d8c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5d8c('0x14'));var db=require(_0x5d8c('0x15'))['db'];function respondWithStatusCode(_0x53f053,_0x3a6933){_0x3a6933=_0x3a6933||0xcc;return function(_0x5e95ac){if(_0x5e95ac){return _0x53f053['sendStatus'](_0x3a6933);}return _0x53f053[_0x5d8c('0x16')](_0x3a6933)[_0x5d8c('0x17')]();};}function respondWithResult(_0x31c5a0,_0x3089d5){_0x3089d5=_0x3089d5||0xc8;return function(_0x1bc3cf){if(_0x1bc3cf){return _0x31c5a0[_0x5d8c('0x16')](_0x3089d5)[_0x5d8c('0x18')](_0x1bc3cf);}};}function respondWithFilteredResult(_0x3a641a,_0xb57160){return function(_0x3b9c76){if(_0x3b9c76){var _0x290dd6=typeof _0xb57160['offset']==='undefined'&&typeof _0xb57160[_0x5d8c('0x19')]===_0x5d8c('0x1a');var _0x2ccaac=_0x3b9c76['count'];var _0x3969f0=_0x290dd6?0x0:_0xb57160[_0x5d8c('0x1b')];var _0x2237e3=_0x290dd6?_0x3b9c76[_0x5d8c('0x1c')]:_0xb57160[_0x5d8c('0x1b')]+_0xb57160[_0x5d8c('0x19')];var _0x1d448c;if(_0x2237e3>=_0x2ccaac){_0x2237e3=_0x2ccaac;_0x1d448c=0xc8;}else{_0x1d448c=0xce;}_0x3a641a[_0x5d8c('0x16')](_0x1d448c);return _0x3a641a[_0x5d8c('0x1d')](_0x5d8c('0x1e'),_0x3969f0+'-'+_0x2237e3+'/'+_0x2ccaac)[_0x5d8c('0x18')](_0x3b9c76);}return null;};}function patchUpdates(_0x5236f0){return function(_0x30ad12){try{jsonpatch[_0x5d8c('0x1f')](_0x30ad12,_0x5236f0,!![]);}catch(_0x13b046){return BPromise[_0x5d8c('0x20')](_0x13b046);}return _0x30ad12['save']();};}function saveUpdates(_0x1f030f,_0x2e5fc1){return function(_0x4c3847){if(_0x4c3847){return _0x4c3847['update'](_0x1f030f)[_0x5d8c('0x21')](function(_0x582c44){return _0x582c44;});}return null;};}function removeEntity(_0x595e64,_0xb7c371){return function(_0x81d279){if(_0x81d279){return _0x81d279[_0x5d8c('0x22')]()[_0x5d8c('0x21')](function(){_0x595e64['status'](0xcc)[_0x5d8c('0x17')]();});}};}function handleEntityNotFound(_0x5183df,_0x259614){return function(_0x17ffac){if(!_0x17ffac){_0x5183df[_0x5d8c('0x23')](0x194);}return _0x17ffac;};}function handleError(_0x20a18c,_0x28e82a){_0x28e82a=_0x28e82a||0x1f4;return function(_0x2c2e9d){logger[_0x5d8c('0x24')](_0x2c2e9d[_0x5d8c('0x25')]);if(_0x2c2e9d[_0x5d8c('0x26')]){delete _0x2c2e9d['name'];}_0x20a18c[_0x5d8c('0x16')](_0x28e82a)[_0x5d8c('0x27')](_0x2c2e9d);};}exports['index']=function(_0xf8c7d1,_0x24f776){var _0xc93f9e={},_0xeda0f1={},_0x162b75={'count':0x0,'rows':[]};var _0x158770=_['map'](db[_0x5d8c('0x28')]['rawAttributes'],function(_0x2cde0f){return{'name':_0x2cde0f[_0x5d8c('0x29')],'type':_0x2cde0f[_0x5d8c('0x2a')][_0x5d8c('0x2b')]};});_0xeda0f1[_0x5d8c('0x2c')]=_[_0x5d8c('0x2d')](_0x158770,'name');_0xeda0f1[_0x5d8c('0x2e')]=_[_0x5d8c('0x2f')](_0xf8c7d1['query']);_0xeda0f1[_0x5d8c('0x30')]=_[_0x5d8c('0x31')](_0xeda0f1['model'],_0xeda0f1[_0x5d8c('0x2e')]);_0xc93f9e[_0x5d8c('0x32')]=_[_0x5d8c('0x31')](_0xeda0f1[_0x5d8c('0x2c')],qs[_0x5d8c('0x33')](_0xf8c7d1['query']['fields']));_0xc93f9e[_0x5d8c('0x32')]=_0xc93f9e[_0x5d8c('0x32')][_0x5d8c('0x34')]?_0xc93f9e[_0x5d8c('0x32')]:_0xeda0f1[_0x5d8c('0x2c')];if(!_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x35')]('nolimit')){_0xc93f9e[_0x5d8c('0x19')]=qs[_0x5d8c('0x19')](_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x19')]);_0xc93f9e['offset']=qs['offset'](_0xf8c7d1['query'][_0x5d8c('0x1b')]);}_0xc93f9e['order']=qs[_0x5d8c('0x36')](_0xf8c7d1['query'][_0x5d8c('0x36')]);_0xc93f9e['where']=qs[_0x5d8c('0x30')](_[_0x5d8c('0x37')](_0xf8c7d1[_0x5d8c('0x2e')],_0xeda0f1[_0x5d8c('0x30')]),_0x158770);if(_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x38')]){_0xc93f9e['where']=_[_0x5d8c('0x39')](_0xc93f9e[_0x5d8c('0x3a')],{'$or':_[_0x5d8c('0x2d')](_0x158770,function(_0xd9551d){if(_0xd9551d['type']!==_0x5d8c('0x3b')){var _0x16c4d9={};_0x16c4d9[_0xd9551d[_0x5d8c('0x26')]]={'$like':'%'+_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x38')]+'%'};return _0x16c4d9;}})});}_0xc93f9e=_[_0x5d8c('0x39')]({},_0xc93f9e,_0xf8c7d1[_0x5d8c('0x3c')]);var _0x503b82={'where':_0xc93f9e[_0x5d8c('0x3a')]};return db[_0x5d8c('0x28')][_0x5d8c('0x1c')](_0x503b82)[_0x5d8c('0x21')](function(_0x45816b){_0x162b75['count']=_0x45816b;if(_0xf8c7d1[_0x5d8c('0x2e')][_0x5d8c('0x3d')]){_0xc93f9e[_0x5d8c('0x3e')]=[{'all':!![]}];}return db[_0x5d8c('0x28')][_0x5d8c('0x3f')](_0xc93f9e);})[_0x5d8c('0x21')](function(_0x37d4d7){_0x162b75[_0x5d8c('0x40')]=_0x37d4d7;return _0x162b75;})[_0x5d8c('0x21')](respondWithFilteredResult(_0x24f776,_0xc93f9e))[_0x5d8c('0x41')](handleError(_0x24f776,null));};exports['show']=function(_0x2a8abe,_0x222e34){var _0x531553={'raw':!![],'where':{'id':_0x2a8abe[_0x5d8c('0x42')]['id']}},_0x5de939={};_0x5de939['model']=_[_0x5d8c('0x2f')](db['OpenchannelTransferReport']['rawAttributes']);_0x5de939['query']=_[_0x5d8c('0x2f')](_0x2a8abe[_0x5d8c('0x2e')]);_0x5de939[_0x5d8c('0x30')]=_[_0x5d8c('0x31')](_0x5de939[_0x5d8c('0x2c')],_0x5de939['query']);_0x531553[_0x5d8c('0x32')]=_[_0x5d8c('0x31')](_0x5de939[_0x5d8c('0x2c')],qs[_0x5d8c('0x33')](_0x2a8abe['query'][_0x5d8c('0x33')]));_0x531553[_0x5d8c('0x32')]=_0x531553[_0x5d8c('0x32')]['length']?_0x531553[_0x5d8c('0x32')]:_0x5de939[_0x5d8c('0x2c')];if(_0x2a8abe[_0x5d8c('0x2e')][_0x5d8c('0x3d')]){_0x531553[_0x5d8c('0x3e')]=[{'all':!![]}];}_0x531553=_[_0x5d8c('0x39')]({},_0x531553,_0x2a8abe[_0x5d8c('0x3c')]);return db[_0x5d8c('0x28')][_0x5d8c('0x43')](_0x531553)[_0x5d8c('0x21')](handleEntityNotFound(_0x222e34,null))[_0x5d8c('0x21')](respondWithResult(_0x222e34,null))['catch'](handleError(_0x222e34,null));};exports[_0x5d8c('0x44')]=function(_0x13a110,_0x458251){return db[_0x5d8c('0x28')]['create'](_0x13a110[_0x5d8c('0x45')],{})[_0x5d8c('0x21')](respondWithResult(_0x458251,0xc9))[_0x5d8c('0x41')](handleError(_0x458251,null));};exports[_0x5d8c('0x46')]=function(_0x383f33,_0x7966a3){if(_0x383f33[_0x5d8c('0x45')]['id']){delete _0x383f33[_0x5d8c('0x45')]['id'];}return db[_0x5d8c('0x28')][_0x5d8c('0x43')]({'where':{'id':_0x383f33[_0x5d8c('0x42')]['id']}})[_0x5d8c('0x21')](handleEntityNotFound(_0x7966a3,null))[_0x5d8c('0x21')](saveUpdates(_0x383f33[_0x5d8c('0x45')],null))[_0x5d8c('0x21')](respondWithResult(_0x7966a3,null))['catch'](handleError(_0x7966a3,null));};exports['destroy']=function(_0x241136,_0xce5ff8){return db[_0x5d8c('0x28')][_0x5d8c('0x43')]({'where':{'id':_0x241136[_0x5d8c('0x42')]['id']}})[_0x5d8c('0x21')](handleEntityNotFound(_0xce5ff8,null))[_0x5d8c('0x21')](removeEntity(_0xce5ff8,null))['catch'](handleError(_0xce5ff8,null));};exports['describe']=function(_0x46f5ce,_0xde88ac){return db[_0x5d8c('0x28')][_0x5d8c('0x47')]()[_0x5d8c('0x21')](respondWithResult(_0xde88ac,null))[_0x5d8c('0x41')](handleError(_0xde88ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 5b36bc0..3155cd2 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 _0xcc89=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x47c1b4,_0x3c9466){var _0x589dc6=function(_0x4a4369){while(--_0x4a4369){_0x47c1b4['push'](_0x47c1b4['shift']());}};_0x589dc6(++_0x3c9466);}(_0xcc89,0x16a));var _0x9cc8=function(_0x4a24a1,_0x2942ec){_0x4a24a1=_0x4a24a1-0x0;var _0x256d7b=_0xcc89[_0x4a24a1];return _0x256d7b;};'use strict';var _=require(_0x9cc8('0x0'));var util=require(_0x9cc8('0x1'));var logger=require(_0x9cc8('0x2'))('api');var moment=require(_0x9cc8('0x3'));var BPromise=require(_0x9cc8('0x4'));var rp=require(_0x9cc8('0x5'));var fs=require('fs');var path=require(_0x9cc8('0x6'));var rimraf=require(_0x9cc8('0x7'));var config=require(_0x9cc8('0x8'));var attributes=require(_0x9cc8('0x9'));module['exports']=function(_0x4cefc5,_0x45c76f){return _0x4cefc5[_0x9cc8('0xa')](_0x9cc8('0xb'),attributes,{'tableName':_0x9cc8('0xc'),'paranoid':![],'indexes':[{'name':_0x9cc8('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3006=['moment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api'];(function(_0x4a73f2,_0x352409){var _0x4190ee=function(_0x19603c){while(--_0x19603c){_0x4a73f2['push'](_0x4a73f2['shift']());}};_0x4190ee(++_0x352409);}(_0x3006,0x1bf));var _0x6300=function(_0x3773c0,_0x228151){_0x3773c0=_0x3773c0-0x0;var _0x424184=_0x3006[_0x3773c0];return _0x424184;};'use strict';var _=require(_0x6300('0x0'));var util=require('util');var logger=require(_0x6300('0x1'))(_0x6300('0x2'));var moment=require(_0x6300('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6300('0x4'));module[_0x6300('0x5')]=function(_0x1f06b3,_0x41777e){return _0x1f06b3[_0x6300('0x6')](_0x6300('0x7'),attributes,{'tableName':_0x6300('0x8'),'paranoid':![],'indexes':[{'name':_0x6300('0x9'),'fields':[_0x6300('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 57d6ecc..8ea4991 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46fc=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0x46fc,0x103));var _0xc46f=function(_0x27530d,_0x46480a){_0x27530d=_0x27530d-0x0;var _0x59e561=_0x46fc[_0x27530d];return _0x59e561;};'use strict';var _=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var moment=require(_0xc46f('0x2'));var BPromise=require(_0xc46f('0x3'));var rs=require(_0xc46f('0x4'));var fs=require('fs');var Redis=require(_0xc46f('0x5'));var db=require(_0xc46f('0x6'))['db'];var utils=require(_0xc46f('0x7'));var logger=require(_0xc46f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc46f('0x9'));var client=jayson[_0xc46f('0xa')][_0xc46f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15904c,_0x1f5ac8,_0x312101){return new BPromise(function(_0x155a10,_0x327019){return client[_0xc46f('0xc')](_0x15904c,_0x312101)[_0xc46f('0xd')](function(_0x1bd18f){logger[_0xc46f('0xe')](_0xc46f('0xf'),_0x1f5ac8,_0xc46f('0x10'));logger['debug'](_0xc46f('0x11'),_0x1f5ac8,_0xc46f('0x10'),JSON[_0xc46f('0x12')](_0x1bd18f));if(_0x1bd18f[_0xc46f('0x13')]){if(_0x1bd18f['error']['code']===0x1f4){logger['error'](_0xc46f('0xf'),_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')]['message']);return _0x327019(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f5ac8,_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);return _0x155a10(_0x1bd18f[_0xc46f('0x13')][_0xc46f('0x14')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f5ac8,'request\x20sent');_0x155a10(_0x1bd18f[_0xc46f('0x15')][_0xc46f('0x14')]);}})[_0xc46f('0x16')](function(_0x516238){logger[_0xc46f('0x13')](_0xc46f('0xf'),_0x1f5ac8,_0x516238);_0x327019(_0x516238);});});} \ No newline at end of file +var _0x4006=['moment','bluebird','randomstring','../../config/utils','rpc','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x1556cf,_0x6590e7){var _0x4f2b67=function(_0xb4310e){while(--_0xb4310e){_0x1556cf['push'](_0x1556cf['shift']());}};_0x4f2b67(++_0x6590e7);}(_0x4006,0x1c7));var _0x6400=function(_0x1264b8,_0x1f592c){_0x1264b8=_0x1264b8-0x0;var _0x4ceda7=_0x4006[_0x1264b8];return _0x4ceda7;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var moment=require(_0x6400('0x1'));var BPromise=require(_0x6400('0x2'));var rs=require(_0x6400('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6400('0x4'));var logger=require('../../config/logger')(_0x6400('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6400('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32c0db,_0x2d365b,_0x2bf4f8){return new BPromise(function(_0x250dba,_0x5cbe4f){return client[_0x6400('0x7')](_0x32c0db,_0x2bf4f8)[_0x6400('0x8')](function(_0x31a8d0){logger[_0x6400('0x9')](_0x6400('0xa'),_0x2d365b,_0x6400('0xb'));logger[_0x6400('0xc')](_0x6400('0xd'),_0x2d365b,_0x6400('0xb'),JSON[_0x6400('0xe')](_0x31a8d0));if(_0x31a8d0[_0x6400('0xf')]){if(_0x31a8d0['error'][_0x6400('0x10')]===0x1f4){logger[_0x6400('0xf')](_0x6400('0xa'),_0x2d365b,_0x31a8d0[_0x6400('0xf')]['message']);return _0x5cbe4f(_0x31a8d0[_0x6400('0xf')][_0x6400('0x11')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d365b,_0x31a8d0['error'][_0x6400('0x11')]);return _0x250dba(_0x31a8d0[_0x6400('0xf')]['message']);}else{logger[_0x6400('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d365b,_0x6400('0xb'));_0x250dba(_0x31a8d0['result'][_0x6400('0x11')]);}})[_0x6400('0x12')](function(_0x276fb2){logger[_0x6400('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d365b,_0x276fb2);_0x5cbe4f(_0x276fb2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index fecec15..6ff00c8 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 _0x1a41=['./pause.controller','get','index','/:id','post','isAuthenticated','create','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x118cda,_0x46f01a){var _0x75fce3=function(_0x422085){while(--_0x422085){_0x118cda['push'](_0x118cda['shift']());}};_0x75fce3(++_0x46f01a);}(_0x1a41,0x126));var _0x11a4=function(_0x25bf9,_0x467adb){_0x25bf9=_0x25bf9-0x0;var _0x5642e5=_0x1a41[_0x25bf9];return _0x5642e5;};'use strict';var multer=require('multer');var util=require(_0x11a4('0x0'));var path=require('path');var timeout=require(_0x11a4('0x1'));var express=require(_0x11a4('0x2'));var router=express['Router']();var fs_extra=require(_0x11a4('0x3'));var auth=require(_0x11a4('0x4'));var interaction=require(_0x11a4('0x5'));var config=require('../../config/environment');var controller=require(_0x11a4('0x6'));router[_0x11a4('0x7')]('/',auth['isAuthenticated'](),controller[_0x11a4('0x8')]);router[_0x11a4('0x7')](_0x11a4('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x11a4('0xa')]('/',auth[_0x11a4('0xb')](),controller[_0x11a4('0xc')]);router['put']('/:id',auth[_0x11a4('0xb')](),controller['update']);router[_0x11a4('0xd')]('/:id',auth[_0x11a4('0xb')](),controller['destroy']);module[_0x11a4('0xe')]=router; \ No newline at end of file +var _0xd7b2=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x22405d,_0x543526){var _0x3636ef=function(_0x121939){while(--_0x121939){_0x22405d['push'](_0x22405d['shift']());}};_0x3636ef(++_0x543526);}(_0xd7b2,0x152));var _0x2d7b=function(_0x524f2b,_0x230050){_0x524f2b=_0x524f2b-0x0;var _0x3493bf=_0xd7b2[_0x524f2b];return _0x3493bf;};'use strict';var multer=require(_0x2d7b('0x0'));var util=require(_0x2d7b('0x1'));var path=require(_0x2d7b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d7b('0x3'));var router=express[_0x2d7b('0x4')]();var fs_extra=require(_0x2d7b('0x5'));var auth=require(_0x2d7b('0x6'));var interaction=require(_0x2d7b('0x7'));var config=require(_0x2d7b('0x8'));var controller=require(_0x2d7b('0x9'));router['get']('/',auth[_0x2d7b('0xa')](),controller['index']);router[_0x2d7b('0xb')]('/:id',auth[_0x2d7b('0xa')](),controller[_0x2d7b('0xc')]);router[_0x2d7b('0xd')]('/',auth[_0x2d7b('0xa')](),controller[_0x2d7b('0xe')]);router[_0x2d7b('0xf')](_0x2d7b('0x10'),auth['isAuthenticated'](),controller[_0x2d7b('0x11')]);router['delete']('/:id',auth[_0x2d7b('0xa')](),controller[_0x2d7b('0x12')]);module[_0x2d7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9792798..ac784b4 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 _0x8d86=['exports','STRING','name','sequelize'];(function(_0x565e4d,_0x4a9881){var _0x49c96a=function(_0x779339){while(--_0x779339){_0x565e4d['push'](_0x565e4d['shift']());}};_0x49c96a(++_0x4a9881);}(_0x8d86,0x187));var _0x68d8=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x8d86[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0x68d8('0x0'));module[_0x68d8('0x1')]={'name':{'type':Sequelize[_0x68d8('0x2')],'unique':_0x68d8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x68d8('0x2')]}}; \ No newline at end of file +var _0x666f=['name','sequelize','exports'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x666f,0x85));var _0xf666=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x666f[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xf666('0x0'));module[_0xf666('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf666('0x2'),'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 ba33b04..10f1c87 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 _0xd72c=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','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','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x29d811,_0x5e55ad){var _0x3d6b82=function(_0x487b56){while(--_0x487b56){_0x29d811['push'](_0x29d811['shift']());}};_0x3d6b82(++_0x5e55ad);}(_0xd72c,0x12f));var _0xcd72=function(_0x337b17,_0x528dd0){_0x337b17=_0x337b17-0x0;var _0x2a8631=_0xd72c[_0x337b17];return _0x2a8631;};'use strict';var emlformat=require(_0xcd72('0x0'));var rimraf=require(_0xcd72('0x1'));var zipdir=require(_0xcd72('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd72('0x3'));var moment=require(_0xcd72('0x4'));var BPromise=require(_0xcd72('0x5'));var Mustache=require('mustache');var util=require(_0xcd72('0x6'));var path=require(_0xcd72('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd72('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd72('0x9'));var squel=require('squel');var crypto=require(_0xcd72('0xa'));var jsforce=require(_0xcd72('0xb'));var deskjs=require(_0xcd72('0xc'));var toCsv=require(_0xcd72('0xd'));var querystring=require('querystring');var Papa=require(_0xcd72('0xe'));var Redis=require(_0xcd72('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcd72('0x10'));var utils=require(_0xcd72('0x11'));var config=require(_0xcd72('0x12'));var licenseUtil=require(_0xcd72('0x13'));var db=require(_0xcd72('0x14'))['db'];function respondWithStatusCode(_0x52b39e,_0x38cb32){_0x38cb32=_0x38cb32||0xcc;return function(_0x221c69){if(_0x221c69){return _0x52b39e[_0xcd72('0x15')](_0x38cb32);}return _0x52b39e[_0xcd72('0x16')](_0x38cb32)[_0xcd72('0x17')]();};}function respondWithResult(_0x2a1d08,_0x48162f){_0x48162f=_0x48162f||0xc8;return function(_0x127855){if(_0x127855){return _0x2a1d08[_0xcd72('0x16')](_0x48162f)[_0xcd72('0x18')](_0x127855);}};}function respondWithFilteredResult(_0x35f03f,_0x17878b){return function(_0xf75c9a){if(_0xf75c9a){var _0x6a600b=typeof _0x17878b[_0xcd72('0x19')]===_0xcd72('0x1a')&&typeof _0x17878b[_0xcd72('0x1b')]===_0xcd72('0x1a');var _0x124852=_0xf75c9a[_0xcd72('0x1c')];var _0x3e3b4e=_0x6a600b?0x0:_0x17878b[_0xcd72('0x19')];var _0xa0fc37=_0x6a600b?_0xf75c9a[_0xcd72('0x1c')]:_0x17878b[_0xcd72('0x19')]+_0x17878b[_0xcd72('0x1b')];var _0x5b5b84;if(_0xa0fc37>=_0x124852){_0xa0fc37=_0x124852;_0x5b5b84=0xc8;}else{_0x5b5b84=0xce;}_0x35f03f[_0xcd72('0x16')](_0x5b5b84);return _0x35f03f['set'](_0xcd72('0x1d'),_0x3e3b4e+'-'+_0xa0fc37+'/'+_0x124852)[_0xcd72('0x18')](_0xf75c9a);}return null;};}function patchUpdates(_0x42aecc){return function(_0xaf6571){try{jsonpatch['apply'](_0xaf6571,_0x42aecc,!![]);}catch(_0x4b781a){return BPromise[_0xcd72('0x1e')](_0x4b781a);}return _0xaf6571['save']();};}function saveUpdates(_0xa5d18e,_0x37c5f1){return function(_0x54e9b8){if(_0x54e9b8){return _0x54e9b8[_0xcd72('0x1f')](_0xa5d18e)[_0xcd72('0x20')](function(_0x3fc595){return _0x3fc595;});}return null;};}function removeEntity(_0x28dfac,_0x3b5510){return function(_0x389d5d){if(_0x389d5d){return _0x389d5d['destroy']()['then'](function(){var _0x4ea333=_0x389d5d[_0xcd72('0x21')]({'plain':!![]});var _0x5306f0=_0xcd72('0x22');return db[_0xcd72('0x23')][_0xcd72('0x24')]({'where':{'type':_0x5306f0,'resourceId':_0x4ea333['id']}})[_0xcd72('0x20')](function(){return _0x389d5d;});})[_0xcd72('0x20')](function(){_0x28dfac[_0xcd72('0x16')](0xcc)[_0xcd72('0x17')]();});}};}function handleEntityNotFound(_0x44bd1f,_0x200769){return function(_0x5c114c){if(!_0x5c114c){_0x44bd1f['sendStatus'](0x194);}return _0x5c114c;};}function handleError(_0x371936,_0x1acb71){_0x1acb71=_0x1acb71||0x1f4;return function(_0x57f9ce){logger[_0xcd72('0x25')](_0x57f9ce[_0xcd72('0x26')]);if(_0x57f9ce['name']){delete _0x57f9ce[_0xcd72('0x27')];}_0x371936[_0xcd72('0x16')](_0x1acb71)[_0xcd72('0x28')](_0x57f9ce);};}exports[_0xcd72('0x29')]=function(_0x5b0139,_0x255556){var _0x3a9636={},_0x70a09e={},_0x25d851={'count':0x0,'rows':[]};var _0x434ed9=_[_0xcd72('0x2a')](db[_0xcd72('0x2b')][_0xcd72('0x2c')],function(_0xd72df4){return{'name':_0xd72df4[_0xcd72('0x2d')],'type':_0xd72df4[_0xcd72('0x2e')][_0xcd72('0x2f')]};});_0x70a09e[_0xcd72('0x30')]=_[_0xcd72('0x2a')](_0x434ed9,_0xcd72('0x27'));_0x70a09e[_0xcd72('0x31')]=_[_0xcd72('0x32')](_0x5b0139['query']);_0x70a09e[_0xcd72('0x33')]=_[_0xcd72('0x34')](_0x70a09e[_0xcd72('0x30')],_0x70a09e[_0xcd72('0x31')]);_0x3a9636['attributes']=_[_0xcd72('0x34')](_0x70a09e[_0xcd72('0x30')],qs[_0xcd72('0x35')](_0x5b0139[_0xcd72('0x31')][_0xcd72('0x35')]));_0x3a9636[_0xcd72('0x36')]=_0x3a9636[_0xcd72('0x36')][_0xcd72('0x37')]?_0x3a9636[_0xcd72('0x36')]:_0x70a09e['model'];if(!_0x5b0139[_0xcd72('0x31')][_0xcd72('0x38')](_0xcd72('0x39'))){_0x3a9636[_0xcd72('0x1b')]=qs[_0xcd72('0x1b')](_0x5b0139[_0xcd72('0x31')][_0xcd72('0x1b')]);_0x3a9636[_0xcd72('0x19')]=qs['offset'](_0x5b0139['query']['offset']);}_0x3a9636['order']=qs['sort'](_0x5b0139[_0xcd72('0x31')][_0xcd72('0x3a')]);_0x3a9636['where']=qs[_0xcd72('0x33')](_[_0xcd72('0x3b')](_0x5b0139[_0xcd72('0x31')],_0x70a09e[_0xcd72('0x33')]),_0x434ed9);if(_0x5b0139[_0xcd72('0x31')]['filter']){_0x3a9636[_0xcd72('0x3c')]=_['merge'](_0x3a9636['where'],{'$or':_['map'](_0x434ed9,function(_0x296a1d){if(_0x296a1d[_0xcd72('0x2e')]!==_0xcd72('0x3d')){var _0x1ed3a3={};_0x1ed3a3[_0x296a1d[_0xcd72('0x27')]]={'$like':'%'+_0x5b0139[_0xcd72('0x31')]['filter']+'%'};return _0x1ed3a3;}})});}_0x3a9636=_[_0xcd72('0x3e')]({},_0x3a9636,_0x5b0139[_0xcd72('0x3f')]);var _0x24a921={'where':_0x3a9636[_0xcd72('0x3c')]};return db[_0xcd72('0x2b')][_0xcd72('0x1c')](_0x24a921)[_0xcd72('0x20')](function(_0x2922af){_0x25d851['count']=_0x2922af;if(_0x5b0139[_0xcd72('0x31')]['includeAll']){_0x3a9636[_0xcd72('0x40')]=[{'all':!![]}];}return db[_0xcd72('0x2b')][_0xcd72('0x41')](_0x3a9636);})[_0xcd72('0x20')](function(_0x27ce4d){_0x25d851[_0xcd72('0x42')]=_0x27ce4d;return _0x25d851;})['then'](respondWithFilteredResult(_0x255556,_0x3a9636))[_0xcd72('0x43')](handleError(_0x255556,null));};exports[_0xcd72('0x44')]=function(_0x34f321,_0x583690){var _0x4bb283={'raw':!![],'where':{'id':_0x34f321[_0xcd72('0x45')]['id']}},_0xb9d4de={};_0xb9d4de[_0xcd72('0x30')]=_[_0xcd72('0x32')](db[_0xcd72('0x2b')][_0xcd72('0x2c')]);_0xb9d4de[_0xcd72('0x31')]=_['keys'](_0x34f321[_0xcd72('0x31')]);_0xb9d4de[_0xcd72('0x33')]=_['intersection'](_0xb9d4de['model'],_0xb9d4de[_0xcd72('0x31')]);_0x4bb283['attributes']=_[_0xcd72('0x34')](_0xb9d4de[_0xcd72('0x30')],qs[_0xcd72('0x35')](_0x34f321[_0xcd72('0x31')][_0xcd72('0x35')]));_0x4bb283[_0xcd72('0x36')]=_0x4bb283['attributes']['length']?_0x4bb283[_0xcd72('0x36')]:_0xb9d4de[_0xcd72('0x30')];if(_0x34f321['query'][_0xcd72('0x46')]){_0x4bb283[_0xcd72('0x40')]=[{'all':!![]}];}_0x4bb283=_[_0xcd72('0x3e')]({},_0x4bb283,_0x34f321[_0xcd72('0x3f')]);return db[_0xcd72('0x2b')][_0xcd72('0x47')](_0x4bb283)['then'](handleEntityNotFound(_0x583690,null))[_0xcd72('0x20')](respondWithResult(_0x583690,null))[_0xcd72('0x43')](handleError(_0x583690,null));};exports[_0xcd72('0x48')]=function(_0x5e5eb7,_0x1bf261){return db[_0xcd72('0x2b')][_0xcd72('0x48')](_0x5e5eb7['body'],{})[_0xcd72('0x20')](function(_0xae400e){var _0x5836d4=_0x5e5eb7[_0xcd72('0x49')]['get']({'plain':!![]});if(!_0x5836d4)throw new Error(_0xcd72('0x4a'));if(_0x5836d4[_0xcd72('0x4b')]===_0xcd72('0x49')){var _0xcb5d07=_0xae400e['get']({'plain':!![]});var _0x6d52ca=_0xcd72('0x22');return db[_0xcd72('0x4c')]['find']({'where':{'name':_0x6d52ca,'userProfileId':_0x5836d4[_0xcd72('0x4d')]},'raw':!![]})['then'](function(_0x108b29){if(_0x108b29&&_0x108b29[_0xcd72('0x4e')]===0x0){return db[_0xcd72('0x23')][_0xcd72('0x48')]({'name':_0xcb5d07['name'],'resourceId':_0xcb5d07['id'],'type':_0x108b29[_0xcd72('0x27')],'sectionId':_0x108b29['id']},{})['then'](function(){return _0xae400e;});}else{return _0xae400e;}})[_0xcd72('0x43')](function(_0x257c6d){logger[_0xcd72('0x25')](_0xcd72('0x4f'),_0x257c6d);throw _0x257c6d;});}return _0xae400e;})['then'](respondWithResult(_0x1bf261,0xc9))[_0xcd72('0x43')](handleError(_0x1bf261,null));};exports['update']=function(_0x169c31,_0x15246b){if(_0x169c31[_0xcd72('0x50')]['id']){delete _0x169c31[_0xcd72('0x50')]['id'];}return db['Pause'][_0xcd72('0x47')]({'where':{'id':_0x169c31[_0xcd72('0x45')]['id']}})[_0xcd72('0x20')](handleEntityNotFound(_0x15246b,null))[_0xcd72('0x20')](saveUpdates(_0x169c31['body'],null))[_0xcd72('0x20')](respondWithResult(_0x15246b,null))[_0xcd72('0x43')](handleError(_0x15246b,null));};exports['destroy']=function(_0x17a5cc,_0xdc957){return db[_0xcd72('0x2b')][_0xcd72('0x47')]({'where':{'id':_0x17a5cc[_0xcd72('0x45')]['id']}})['then'](handleEntityNotFound(_0xdc957,null))[_0xcd72('0x20')](removeEntity(_0xdc957,null))[_0xcd72('0x43')](handleError(_0xdc957,null));}; \ No newline at end of file +var _0x6f67=['includeAll','include','findAll','rows','catch','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','Pause'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x6f67,0xfe));var _0x76f6=function(_0x595619,_0x3b7ea6){_0x595619=_0x595619-0x0;var _0x30a1e4=_0x6f67[_0x595619];return _0x30a1e4;};'use strict';var emlformat=require(_0x76f6('0x0'));var rimraf=require(_0x76f6('0x1'));var zipdir=require(_0x76f6('0x2'));var jsonpatch=require(_0x76f6('0x3'));var rp=require('request-promise');var moment=require(_0x76f6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76f6('0x5'));var path=require(_0x76f6('0x6'));var sox=require(_0x76f6('0x7'));var csv=require('to-csv');var ejs=require(_0x76f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x76f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x76f6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x76f6('0xb'));var Papa=require(_0x76f6('0xc'));var Redis=require(_0x76f6('0xd'));var authService=require(_0x76f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76f6('0xf'));var logger=require('../../config/logger')(_0x76f6('0x10'));var utils=require('../../config/utils');var config=require(_0x76f6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x76f6('0x12'))['db'];function respondWithStatusCode(_0x72e09,_0xd2ec10){_0xd2ec10=_0xd2ec10||0xcc;return function(_0x30aa9b){if(_0x30aa9b){return _0x72e09[_0x76f6('0x13')](_0xd2ec10);}return _0x72e09['status'](_0xd2ec10)['end']();};}function respondWithResult(_0x4a1a28,_0x143ada){_0x143ada=_0x143ada||0xc8;return function(_0x1c8f59){if(_0x1c8f59){return _0x4a1a28[_0x76f6('0x14')](_0x143ada)[_0x76f6('0x15')](_0x1c8f59);}};}function respondWithFilteredResult(_0x25786c,_0x566bd3){return function(_0x3ec6be){if(_0x3ec6be){var _0x44590b=typeof _0x566bd3[_0x76f6('0x16')]===_0x76f6('0x17')&&typeof _0x566bd3[_0x76f6('0x18')]===_0x76f6('0x17');var _0x3a4c23=_0x3ec6be[_0x76f6('0x19')];var _0x1db6f8=_0x44590b?0x0:_0x566bd3[_0x76f6('0x16')];var _0x5cd389=_0x44590b?_0x3ec6be[_0x76f6('0x19')]:_0x566bd3[_0x76f6('0x16')]+_0x566bd3[_0x76f6('0x18')];var _0x5d993c;if(_0x5cd389>=_0x3a4c23){_0x5cd389=_0x3a4c23;_0x5d993c=0xc8;}else{_0x5d993c=0xce;}_0x25786c[_0x76f6('0x14')](_0x5d993c);return _0x25786c[_0x76f6('0x1a')](_0x76f6('0x1b'),_0x1db6f8+'-'+_0x5cd389+'/'+_0x3a4c23)[_0x76f6('0x15')](_0x3ec6be);}return null;};}function patchUpdates(_0x32fcab){return function(_0x297ef5){try{jsonpatch[_0x76f6('0x1c')](_0x297ef5,_0x32fcab,!![]);}catch(_0x125672){return BPromise[_0x76f6('0x1d')](_0x125672);}return _0x297ef5[_0x76f6('0x1e')]();};}function saveUpdates(_0x2ccd65,_0x421fad){return function(_0x111da2){if(_0x111da2){return _0x111da2[_0x76f6('0x1f')](_0x2ccd65)[_0x76f6('0x20')](function(_0x106acc){return _0x106acc;});}return null;};}function removeEntity(_0x14bcb9,_0x7d089f){return function(_0x20cadb){if(_0x20cadb){return _0x20cadb[_0x76f6('0x21')]()[_0x76f6('0x20')](function(){var _0x5c6046=_0x20cadb['get']({'plain':!![]});var _0x41e239=_0x76f6('0x22');return db[_0x76f6('0x23')][_0x76f6('0x21')]({'where':{'type':_0x41e239,'resourceId':_0x5c6046['id']}})['then'](function(){return _0x20cadb;});})[_0x76f6('0x20')](function(){_0x14bcb9[_0x76f6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c8ef,_0x482a4){return function(_0x4a7e23){if(!_0x4a7e23){_0x44c8ef[_0x76f6('0x13')](0x194);}return _0x4a7e23;};}function handleError(_0x19b819,_0x52a057){_0x52a057=_0x52a057||0x1f4;return function(_0x269a76){logger[_0x76f6('0x24')](_0x269a76[_0x76f6('0x25')]);if(_0x269a76[_0x76f6('0x26')]){delete _0x269a76[_0x76f6('0x26')];}_0x19b819[_0x76f6('0x14')](_0x52a057)[_0x76f6('0x27')](_0x269a76);};}exports[_0x76f6('0x28')]=function(_0x409d4b,_0x297b20){var _0x443317={},_0x435526={},_0x2b1382={'count':0x0,'rows':[]};var _0x5d2fa8=_[_0x76f6('0x29')](db['Pause'][_0x76f6('0x2a')],function(_0x5bc42e){return{'name':_0x5bc42e[_0x76f6('0x2b')],'type':_0x5bc42e[_0x76f6('0x2c')][_0x76f6('0x2d')]};});_0x435526[_0x76f6('0x2e')]=_[_0x76f6('0x29')](_0x5d2fa8,_0x76f6('0x26'));_0x435526[_0x76f6('0x2f')]=_[_0x76f6('0x30')](_0x409d4b[_0x76f6('0x2f')]);_0x435526[_0x76f6('0x31')]=_[_0x76f6('0x32')](_0x435526['model'],_0x435526[_0x76f6('0x2f')]);_0x443317[_0x76f6('0x33')]=_[_0x76f6('0x32')](_0x435526['model'],qs['fields'](_0x409d4b['query'][_0x76f6('0x34')]));_0x443317['attributes']=_0x443317[_0x76f6('0x33')][_0x76f6('0x35')]?_0x443317[_0x76f6('0x33')]:_0x435526[_0x76f6('0x2e')];if(!_0x409d4b[_0x76f6('0x2f')]['hasOwnProperty']('nolimit')){_0x443317[_0x76f6('0x18')]=qs['limit'](_0x409d4b[_0x76f6('0x2f')]['limit']);_0x443317[_0x76f6('0x16')]=qs[_0x76f6('0x16')](_0x409d4b['query'][_0x76f6('0x16')]);}_0x443317[_0x76f6('0x36')]=qs['sort'](_0x409d4b['query'][_0x76f6('0x37')]);_0x443317[_0x76f6('0x38')]=qs['filters'](_[_0x76f6('0x39')](_0x409d4b[_0x76f6('0x2f')],_0x435526[_0x76f6('0x31')]),_0x5d2fa8);if(_0x409d4b[_0x76f6('0x2f')][_0x76f6('0x3a')]){_0x443317['where']=_[_0x76f6('0x3b')](_0x443317[_0x76f6('0x38')],{'$or':_[_0x76f6('0x29')](_0x5d2fa8,function(_0x6c91de){if(_0x6c91de[_0x76f6('0x2c')]!==_0x76f6('0x3c')){var _0x43e08e={};_0x43e08e[_0x6c91de[_0x76f6('0x26')]]={'$like':'%'+_0x409d4b[_0x76f6('0x2f')][_0x76f6('0x3a')]+'%'};return _0x43e08e;}})});}_0x443317=_[_0x76f6('0x3b')]({},_0x443317,_0x409d4b['options']);var _0x2cf532={'where':_0x443317['where']};return db[_0x76f6('0x3d')][_0x76f6('0x19')](_0x2cf532)['then'](function(_0x3ec2ef){_0x2b1382['count']=_0x3ec2ef;if(_0x409d4b['query'][_0x76f6('0x3e')]){_0x443317[_0x76f6('0x3f')]=[{'all':!![]}];}return db[_0x76f6('0x3d')][_0x76f6('0x40')](_0x443317);})[_0x76f6('0x20')](function(_0x29694b){_0x2b1382[_0x76f6('0x41')]=_0x29694b;return _0x2b1382;})[_0x76f6('0x20')](respondWithFilteredResult(_0x297b20,_0x443317))[_0x76f6('0x42')](handleError(_0x297b20,null));};exports['show']=function(_0x55d7c5,_0x142a87){var _0x39e842={'raw':!![],'where':{'id':_0x55d7c5[_0x76f6('0x43')]['id']}},_0x3ccc53={};_0x3ccc53[_0x76f6('0x2e')]=_[_0x76f6('0x30')](db[_0x76f6('0x3d')][_0x76f6('0x2a')]);_0x3ccc53[_0x76f6('0x2f')]=_[_0x76f6('0x30')](_0x55d7c5['query']);_0x3ccc53[_0x76f6('0x31')]=_[_0x76f6('0x32')](_0x3ccc53['model'],_0x3ccc53[_0x76f6('0x2f')]);_0x39e842[_0x76f6('0x33')]=_['intersection'](_0x3ccc53['model'],qs[_0x76f6('0x34')](_0x55d7c5[_0x76f6('0x2f')][_0x76f6('0x34')]));_0x39e842[_0x76f6('0x33')]=_0x39e842[_0x76f6('0x33')][_0x76f6('0x35')]?_0x39e842[_0x76f6('0x33')]:_0x3ccc53[_0x76f6('0x2e')];if(_0x55d7c5['query'][_0x76f6('0x3e')]){_0x39e842[_0x76f6('0x3f')]=[{'all':!![]}];}_0x39e842=_[_0x76f6('0x3b')]({},_0x39e842,_0x55d7c5[_0x76f6('0x44')]);return db[_0x76f6('0x3d')][_0x76f6('0x45')](_0x39e842)['then'](handleEntityNotFound(_0x142a87,null))[_0x76f6('0x20')](respondWithResult(_0x142a87,null))[_0x76f6('0x42')](handleError(_0x142a87,null));};exports[_0x76f6('0x46')]=function(_0x1232ea,_0x53f4bc){return db['Pause'][_0x76f6('0x46')](_0x1232ea[_0x76f6('0x47')],{})['then'](function(_0x35a79a){var _0x40f394=_0x1232ea[_0x76f6('0x48')][_0x76f6('0x49')]({'plain':!![]});if(!_0x40f394)throw new Error(_0x76f6('0x4a'));if(_0x40f394[_0x76f6('0x4b')]===_0x76f6('0x48')){var _0x3ed792=_0x35a79a[_0x76f6('0x49')]({'plain':!![]});var _0x1fe650=_0x76f6('0x22');return db[_0x76f6('0x4c')][_0x76f6('0x45')]({'where':{'name':_0x1fe650,'userProfileId':_0x40f394[_0x76f6('0x4d')]},'raw':!![]})[_0x76f6('0x20')](function(_0xd566b2){if(_0xd566b2&&_0xd566b2[_0x76f6('0x4e')]===0x0){return db[_0x76f6('0x23')][_0x76f6('0x46')]({'name':_0x3ed792[_0x76f6('0x26')],'resourceId':_0x3ed792['id'],'type':_0xd566b2[_0x76f6('0x26')],'sectionId':_0xd566b2['id']},{})[_0x76f6('0x20')](function(){return _0x35a79a;});}else{return _0x35a79a;}})[_0x76f6('0x42')](function(_0x2b5716){logger[_0x76f6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b5716);throw _0x2b5716;});}return _0x35a79a;})['then'](respondWithResult(_0x53f4bc,0xc9))['catch'](handleError(_0x53f4bc,null));};exports[_0x76f6('0x1f')]=function(_0xcaefb8,_0x171cd6){if(_0xcaefb8[_0x76f6('0x47')]['id']){delete _0xcaefb8[_0x76f6('0x47')]['id'];}return db[_0x76f6('0x3d')][_0x76f6('0x45')]({'where':{'id':_0xcaefb8[_0x76f6('0x43')]['id']}})[_0x76f6('0x20')](handleEntityNotFound(_0x171cd6,null))[_0x76f6('0x20')](saveUpdates(_0xcaefb8[_0x76f6('0x47')],null))['then'](respondWithResult(_0x171cd6,null))['catch'](handleError(_0x171cd6,null));};exports[_0x76f6('0x21')]=function(_0xd20bcd,_0x1de7dc){return db[_0x76f6('0x3d')][_0x76f6('0x45')]({'where':{'id':_0xd20bcd[_0x76f6('0x43')]['id']}})['then'](handleEntityNotFound(_0x1de7dc,null))[_0x76f6('0x20')](removeEntity(_0x1de7dc,null))[_0x76f6('0x42')](handleError(_0x1de7dc,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f09d0cc..dea41ed 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x2db26e,_0x16eee7){var _0x5a1a20=function(_0x4d8e1c){while(--_0x4d8e1c){_0x2db26e['push'](_0x2db26e['shift']());}};_0x5a1a20(++_0x16eee7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0x5fc3[_0x398294];return _0x2a872d;};'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'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x3ff2c2,_0x26b2c2){_0x3ff2c2=_0x3ff2c2-0x0;var _0x2b0979=_0x6aa7[_0x3ff2c2];return _0x2b0979;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 6443784..3d4d37d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x37b58b,_0x4a8937){var _0x15b004=function(_0x3e1de0){while(--_0x3e1de0){_0x37b58b['push'](_0x37b58b['shift']());}};_0x15b004(++_0x4a8937);}(_0x7a54,0x106));var _0x47a5=function(_0x1c559b,_0x4da104){_0x1c559b=_0x1c559b-0x0;var _0x2f292c=_0x7a54[_0x1c559b];return _0x2f292c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x2b54c1,_0x54d47e){var _0x2a6176=function(_0x5b34d0){while(--_0x5b34d0){_0x2b54c1['push'](_0x2b54c1['shift']());}};_0x2a6176(++_0x54d47e);}(_0x7a54,0x106));var _0x47a5=function(_0x2bbe21,_0x226876){_0x2bbe21=_0x2bbe21-0x0;var _0x2fec34=_0x7a54[_0x2bbe21];return _0x2fec34;};'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 e1a715a..540f0a4 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 _0xe107=['get','/webhook','webhookGet','show','isAuthenticated','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','upload','post','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./plugin.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe107,0xb3));var _0x7e10=function(_0x205ea6,_0x2f79dc){_0x205ea6=_0x205ea6-0x0;var _0x57ce50=_0xe107[_0x205ea6];return _0x57ce50;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),controller[_0x7e10('0x9')]);router[_0x7e10('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7e10('0xa')]);router['get']('/:id/download',auth[_0x7e10('0xb')](),controller[_0x7e10('0xc')]);var upload=multer({'storage':multer[_0x7e10('0xd')]({'destination':function(_0x2bd58a,_0x256cb1,_0x52ba74){_0x52ba74(null,path[_0x7e10('0xe')](config['root'],_0x7e10('0xf')));},'filename':function(_0x2ca84c,_0x2f4d72,_0x5434dd){_0x2f4d72[_0x7e10('0x10')]=_0x2f4d72[_0x7e10('0x10')][_0x7e10('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5434dd(null,util[_0x7e10('0x12')](_0x7e10('0x13'),path[_0x7e10('0x14')](_0x2f4d72[_0x7e10('0x10')],path[_0x7e10('0x15')](_0x2f4d72['originalname'])),Date[_0x7e10('0x16')](),path[_0x7e10('0x15')](_0x2f4d72['originalname'])));}})});router['post']('/',upload[_0x7e10('0x17')]('file'),controller[_0x7e10('0x18')]);router[_0x7e10('0x19')](_0x7e10('0x8'),controller[_0x7e10('0x1a')]);router['put'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1c')]);router['delete'](_0x7e10('0x1b'),auth[_0x7e10('0xb')](),controller[_0x7e10('0x1d')]);module[_0x7e10('0x1e')]=router; \ No newline at end of file +var _0x9f62=['extname','now','post','single','file','upload','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id/download','isAuthenticated','join','root','originalname','replace','format','%s-%s%s','basename'];(function(_0x3c9e18,_0x171376){var _0x1b0ec6=function(_0x11e30b){while(--_0x11e30b){_0x3c9e18['push'](_0x3c9e18['shift']());}};_0x1b0ec6(++_0x171376);}(_0x9f62,0x154));var _0x29f6=function(_0x301318,_0x4a95e8){_0x301318=_0x301318-0x0;var _0x70d103=_0x9f62[_0x301318];return _0x70d103;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),controller[_0x29f6('0xa')]);router[_0x29f6('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x29f6('0xb'),auth[_0x29f6('0xc')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29b3f5,_0x442623,_0x4909e0){_0x4909e0(null,path[_0x29f6('0xd')](config[_0x29f6('0xe')],'server/files/plugins'));},'filename':function(_0x5b9b6a,_0x559585,_0x57b2d2){_0x559585[_0x29f6('0xf')]=_0x559585[_0x29f6('0xf')][_0x29f6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57b2d2(null,util[_0x29f6('0x11')](_0x29f6('0x12'),path[_0x29f6('0x13')](_0x559585[_0x29f6('0xf')],path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])),Date[_0x29f6('0x15')](),path[_0x29f6('0x14')](_0x559585[_0x29f6('0xf')])));}})});router[_0x29f6('0x16')]('/',upload[_0x29f6('0x17')](_0x29f6('0x18')),controller[_0x29f6('0x19')]);router[_0x29f6('0x16')]('/webhook',controller['webhookPost']);router[_0x29f6('0x1a')](_0x29f6('0x1b'),auth[_0x29f6('0xc')](),controller['update']);router[_0x29f6('0x1c')](_0x29f6('0x1b'),auth['isAuthenticated'](),controller[_0x29f6('0x1c')]);module[_0x29f6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 7522bfe..224349e 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 _0x918c=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x749614,_0x9c4b56){var _0x4cacdf=function(_0x2b6bcc){while(--_0x2b6bcc){_0x749614['push'](_0x749614['shift']());}};_0x4cacdf(++_0x9c4b56);}(_0x918c,0x95));var _0xc918=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x918c[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xc918('0x0'));module[_0xc918('0x1')]={'name':{'type':Sequelize[_0xc918('0x2')]},'type':{'type':Sequelize[_0xc918('0x3')](_0xc918('0x4'),_0xc918('0x5'))},'description':{'type':Sequelize[_0xc918('0x6')]},'version':{'type':Sequelize[_0xc918('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0xc918('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc918('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xc918('0x9'),'agentOnly','always',_0xc918('0xa')),'defaultValue':_0xc918('0xb'),'comment':_0xc918('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xc918('0x2')]},'agentUrl':{'type':Sequelize[_0xc918('0x2')]},'scriptName':{'type':Sequelize[_0xc918('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfbec=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never'];(function(_0x5cd1ee,_0x2488d6){var _0x3b63d1=function(_0x5ab880){while(--_0x5ab880){_0x5cd1ee['push'](_0x5cd1ee['shift']());}};_0x3b63d1(++_0x2488d6);}(_0xfbec,0x90));var _0xcfbe=function(_0x41fd8a,_0x51a69e){_0x41fd8a=_0x41fd8a-0x0;var _0x35c435=_0xfbec[_0x41fd8a];return _0x35c435;};'use strict';var Sequelize=require('sequelize');module[_0xcfbe('0x0')]={'name':{'type':Sequelize[_0xcfbe('0x1')]},'type':{'type':Sequelize[_0xcfbe('0x2')](_0xcfbe('0x3'),'script')},'description':{'type':Sequelize[_0xcfbe('0x4')]},'version':{'type':Sequelize[_0xcfbe('0x4')]},'path':{'type':Sequelize[_0xcfbe('0x1')],'comment':_0xcfbe('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xcfbe('0x6')},'sidebar':{'type':Sequelize[_0xcfbe('0x2')]('adminOnly',_0xcfbe('0x7'),_0xcfbe('0x8'),_0xcfbe('0x9')),'defaultValue':'always','comment':_0xcfbe('0xa')},'icon':{'type':Sequelize[_0xcfbe('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xcfbe('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 566ae6a..3f20adb 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 _0x1e4c=['show','params','keys','find','join','server/files/plugins','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','extract-zip','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','Plugins','sendStatus','error','stack','name','send','map','Plugin','rawAttributes','fieldName','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x4d95db,_0x28b7e9){var _0x1cc484=function(_0x42c09c){while(--_0x42c09c){_0x4d95db['push'](_0x4d95db['shift']());}};_0x1cc484(++_0x28b7e9);}(_0x1e4c,0x1b1));var _0xc1e4=function(_0x11638d,_0x46c64a){_0x11638d=_0x11638d-0x0;var _0x4a75fb=_0x1e4c[_0x11638d];return _0x4a75fb;};'use strict';var emlformat=require(_0xc1e4('0x0'));var rimraf=require(_0xc1e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1e4('0x2'));var rp=require(_0xc1e4('0x3'));var moment=require(_0xc1e4('0x4'));var BPromise=require(_0xc1e4('0x5'));var Mustache=require(_0xc1e4('0x6'));var util=require(_0xc1e4('0x7'));var path=require(_0xc1e4('0x8'));var sox=require('sox');var csv=require(_0xc1e4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1e4('0xa'));var _=require(_0xc1e4('0xb'));var squel=require(_0xc1e4('0xc'));var crypto=require('crypto');var jsforce=require(_0xc1e4('0xd'));var deskjs=require(_0xc1e4('0xe'));var toCsv=require(_0xc1e4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xc1e4('0xf'));var rimraf=require('rimraf');var archiver=require(_0xc1e4('0x10'));var Redis=require(_0xc1e4('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc1e4('0x12'));var hardwareService=require(_0xc1e4('0x13'));var logger=require(_0xc1e4('0x14'))(_0xc1e4('0x15'));var utils=require(_0xc1e4('0x16'));var config=require(_0xc1e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1e4('0x18'))['db'];config['redis']=_[_0xc1e4('0x19')](config[_0xc1e4('0x1a')],{'host':_0xc1e4('0x1b'),'port':0x18eb});var socket=require(_0xc1e4('0x1c'))(new Redis(config[_0xc1e4('0x1a')]));require(_0xc1e4('0x1d'))['register'](socket);function respondWithStatusCode(_0x36aceb,_0x508c83){_0x508c83=_0x508c83||0xcc;return function(_0x2d2cfc){if(_0x2d2cfc){return _0x36aceb['sendStatus'](_0x508c83);}return _0x36aceb[_0xc1e4('0x1e')](_0x508c83)[_0xc1e4('0x1f')]();};}function respondWithResult(_0x4483ea,_0x246f65){_0x246f65=_0x246f65||0xc8;return function(_0x2bee3a){if(_0x2bee3a){return _0x4483ea[_0xc1e4('0x1e')](_0x246f65)[_0xc1e4('0x20')](_0x2bee3a);}};}function respondWithFilteredResult(_0x128935,_0x37a74f){return function(_0x493fff){if(_0x493fff){var _0x20db1c=typeof _0x37a74f[_0xc1e4('0x21')]===_0xc1e4('0x22')&&typeof _0x37a74f[_0xc1e4('0x23')]===_0xc1e4('0x22');var _0x36cbe8=_0x493fff[_0xc1e4('0x24')];var _0x2b7ff9=_0x20db1c?0x0:_0x37a74f[_0xc1e4('0x21')];var _0x149641=_0x20db1c?_0x493fff['count']:_0x37a74f['offset']+_0x37a74f[_0xc1e4('0x23')];var _0x1b95ba;if(_0x149641>=_0x36cbe8){_0x149641=_0x36cbe8;_0x1b95ba=0xc8;}else{_0x1b95ba=0xce;}_0x128935['status'](_0x1b95ba);return _0x128935[_0xc1e4('0x25')](_0xc1e4('0x26'),_0x2b7ff9+'-'+_0x149641+'/'+_0x36cbe8)[_0xc1e4('0x20')](_0x493fff);}return null;};}function patchUpdates(_0x124e60){return function(_0x2afc32){try{jsonpatch['apply'](_0x2afc32,_0x124e60,!![]);}catch(_0x2865c6){return BPromise[_0xc1e4('0x27')](_0x2865c6);}return _0x2afc32['save']();};}function saveUpdates(_0x16ef26,_0x5e0ee6){return function(_0x31a608){if(_0x31a608){return _0x31a608[_0xc1e4('0x28')](_0x16ef26)[_0xc1e4('0x29')](function(_0x59399e){return _0x59399e;});}return null;};}function removeEntity(_0x466846,_0x17851d){return function(_0x5c35ff){if(_0x5c35ff){return _0x5c35ff[_0xc1e4('0x2a')]()[_0xc1e4('0x29')](function(){var _0x1dad75=_0x5c35ff['get']({'plain':!![]});var _0x307bd0=_0xc1e4('0x2b');return db['UserProfileResource'][_0xc1e4('0x2a')]({'where':{'type':_0x307bd0,'resourceId':_0x1dad75['id']}})[_0xc1e4('0x29')](function(){return _0x5c35ff;});})[_0xc1e4('0x29')](function(){_0x466846[_0xc1e4('0x1e')](0xcc)[_0xc1e4('0x1f')]();});}};}function handleEntityNotFound(_0x2cb97c,_0x21b93a){return function(_0x12c376){if(!_0x12c376){_0x2cb97c[_0xc1e4('0x2c')](0x194);}return _0x12c376;};}function handleError(_0x12eb95,_0x168807){_0x168807=_0x168807||0x1f4;return function(_0x447758){logger[_0xc1e4('0x2d')](_0x447758[_0xc1e4('0x2e')]);if(_0x447758[_0xc1e4('0x2f')]){delete _0x447758[_0xc1e4('0x2f')];}_0x12eb95[_0xc1e4('0x1e')](_0x168807)[_0xc1e4('0x30')](_0x447758);};}exports['index']=function(_0x10514e,_0x484e9f){var _0x335efc={},_0x46396b={},_0x140555={'count':0x0,'rows':[]};var _0x455a6c=_[_0xc1e4('0x31')](db[_0xc1e4('0x32')][_0xc1e4('0x33')],function(_0x217eaa){return{'name':_0x217eaa[_0xc1e4('0x34')],'type':_0x217eaa['type'][_0xc1e4('0x35')]};});_0x46396b[_0xc1e4('0x36')]=_['map'](_0x455a6c,_0xc1e4('0x2f'));_0x46396b['query']=_['keys'](_0x10514e[_0xc1e4('0x37')]);_0x46396b[_0xc1e4('0x38')]=_['intersection'](_0x46396b[_0xc1e4('0x36')],_0x46396b[_0xc1e4('0x37')]);_0x335efc['attributes']=_['intersection'](_0x46396b[_0xc1e4('0x36')],qs[_0xc1e4('0x39')](_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x39')]));_0x335efc[_0xc1e4('0x3a')]=_0x335efc[_0xc1e4('0x3a')][_0xc1e4('0x3b')]?_0x335efc[_0xc1e4('0x3a')]:_0x46396b[_0xc1e4('0x36')];if(!_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x3c')](_0xc1e4('0x3d'))){_0x335efc[_0xc1e4('0x23')]=qs[_0xc1e4('0x23')](_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x23')]);_0x335efc[_0xc1e4('0x21')]=qs[_0xc1e4('0x21')](_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x21')]);}_0x335efc[_0xc1e4('0x3e')]=qs[_0xc1e4('0x3f')](_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x3f')]);_0x335efc['where']=qs['filters'](_['pick'](_0x10514e['query'],_0x46396b[_0xc1e4('0x38')]),_0x455a6c);if(_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x40')]){_0x335efc[_0xc1e4('0x41')]=_[_0xc1e4('0x42')](_0x335efc[_0xc1e4('0x41')],{'$or':_[_0xc1e4('0x31')](_0x455a6c,function(_0x40b9ce){if(_0x40b9ce[_0xc1e4('0x43')]!==_0xc1e4('0x44')){var _0x2d0598={};_0x2d0598[_0x40b9ce[_0xc1e4('0x2f')]]={'$like':'%'+_0x10514e['query'][_0xc1e4('0x40')]+'%'};return _0x2d0598;}})});}_0x335efc=_['merge']({},_0x335efc,_0x10514e[_0xc1e4('0x45')]);var _0x437126={'where':_0x335efc[_0xc1e4('0x41')]};return db[_0xc1e4('0x32')]['count'](_0x437126)[_0xc1e4('0x29')](function(_0x5a823e){_0x140555['count']=_0x5a823e;if(_0x10514e[_0xc1e4('0x37')][_0xc1e4('0x46')]){_0x335efc[_0xc1e4('0x47')]=[{'all':!![]}];}return db[_0xc1e4('0x32')][_0xc1e4('0x48')](_0x335efc);})[_0xc1e4('0x29')](function(_0x46c58c){_0x140555['rows']=_0x46c58c;return _0x140555;})[_0xc1e4('0x29')](respondWithFilteredResult(_0x484e9f,_0x335efc))[_0xc1e4('0x49')](handleError(_0x484e9f,null));};exports[_0xc1e4('0x4a')]=function(_0x361532,_0x3e996c){var _0x3c08d5={'raw':!![],'where':{'id':_0x361532[_0xc1e4('0x4b')]['id']}},_0x551b47={};_0x551b47[_0xc1e4('0x36')]=_[_0xc1e4('0x4c')](db[_0xc1e4('0x32')][_0xc1e4('0x33')]);_0x551b47[_0xc1e4('0x37')]=_['keys'](_0x361532[_0xc1e4('0x37')]);_0x551b47[_0xc1e4('0x38')]=_['intersection'](_0x551b47['model'],_0x551b47[_0xc1e4('0x37')]);_0x3c08d5[_0xc1e4('0x3a')]=_['intersection'](_0x551b47[_0xc1e4('0x36')],qs[_0xc1e4('0x39')](_0x361532['query'][_0xc1e4('0x39')]));_0x3c08d5[_0xc1e4('0x3a')]=_0x3c08d5['attributes'][_0xc1e4('0x3b')]?_0x3c08d5[_0xc1e4('0x3a')]:_0x551b47[_0xc1e4('0x36')];if(_0x361532['query'][_0xc1e4('0x46')]){_0x3c08d5[_0xc1e4('0x47')]=[{'all':!![]}];}_0x3c08d5=_[_0xc1e4('0x42')]({},_0x3c08d5,_0x361532[_0xc1e4('0x45')]);return db[_0xc1e4('0x32')][_0xc1e4('0x4d')](_0x3c08d5)[_0xc1e4('0x29')](handleEntityNotFound(_0x3e996c,null))[_0xc1e4('0x29')](respondWithResult(_0x3e996c,null))[_0xc1e4('0x49')](handleError(_0x3e996c,null));};exports['download']=function(_0x1cbb28,_0x2e5813,_0x57cba6){return db[_0xc1e4('0x32')][_0xc1e4('0x4d')]({'where':{'id':_0x1cbb28['params']['id']},'attributes':['name',_0xc1e4('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x2e5813,null))[_0xc1e4('0x29')](function(_0x60f4c7){if(_0x60f4c7){var _0xc61c58=path[_0xc1e4('0x4e')](config['root'],_0xc1e4('0x4f'),util['format']('%s.zip',path[_0xc1e4('0x50')](_0x60f4c7[_0xc1e4('0x8')])));var _0x2f965d=fs[_0xc1e4('0x51')](_0xc61c58);var _0x11c14d=archiver('zip',{'zlib':{'level':0x9}});_0x11c14d['on'](_0xc1e4('0x52'),function(_0x6185c1){if(_0x6185c1[_0xc1e4('0x53')]===_0xc1e4('0x54')){logger[_0xc1e4('0x2d')](_0x6185c1);}else{throw new db[(_0xc1e4('0x55'))][(_0xc1e4('0x56'))](_0xc1e4('0x57'));}});_0x11c14d['on'](_0xc1e4('0x2d'),function(_0x5835cc){throw new db[(_0xc1e4('0x55'))][(_0xc1e4('0x56'))](_0xc1e4('0x57'));});_0x11c14d[_0xc1e4('0x58')](_0x2f965d);_0x11c14d['glob'](_0xc1e4('0x59'),{'cwd':path['join'](config[_0xc1e4('0x5a')],_0xc1e4('0x4f'),path[_0xc1e4('0x5b')](_0x60f4c7['path'])),'ignore':[path['join'](path[_0xc1e4('0x50')](_0x60f4c7[_0xc1e4('0x8')]),_0xc1e4('0x5c')),path['join'](path[_0xc1e4('0x50')](_0x60f4c7[_0xc1e4('0x8')]),_0xc1e4('0x5d'))],'nodir':!![]})['finalize']();_0x2f965d['on'](_0xc1e4('0x5e'),function(){if(!fs[_0xc1e4('0x5f')](_0xc61c58)){throw new db[(_0xc1e4('0x55'))][(_0xc1e4('0x56'))](_0xc1e4('0x60'));}return _0x2e5813[_0xc1e4('0x61')](_0xc61c58,util['format'](_0xc1e4('0x62'),path[_0xc1e4('0x50')](_0x60f4c7[_0xc1e4('0x8')])),function(_0x20c9ed){if(_0x20c9ed){throw new db[(_0xc1e4('0x55'))][(_0xc1e4('0x56'))](_0xc1e4('0x63'));}fs[_0xc1e4('0x64')](_0xc61c58);logger[_0xc1e4('0x65')]('Download\x20completed');logger[_0xc1e4('0x65')]('Temporary\x20file\x20removed');});});}return null;})[_0xc1e4('0x49')](handleError(_0x2e5813,null));};exports[_0xc1e4('0x66')]=function(_0x14cfc2,_0x11dcae,_0x391e42){var _0x41c8f0=path[_0xc1e4('0x50')](_0x14cfc2[_0xc1e4('0x67')][_0xc1e4('0x68')],path[_0xc1e4('0x69')](_0x14cfc2['file']['filename']));var _0xe27e22=path[_0xc1e4('0x4e')](config[_0xc1e4('0x5a')],'server/files/plugins',_0x14cfc2[_0xc1e4('0x67')][_0xc1e4('0x68')]);var _0x55c0fd=path[_0xc1e4('0x4e')](config['root'],_0xc1e4('0x4f'),_0x41c8f0);logger[_0xc1e4('0x65')](_0xc1e4('0x6a'),_0xe27e22);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x55c0fd);try{fs[_0xc1e4('0x6b')](_0xe27e22,parseInt('0777',0x8));extract(_0xe27e22,{'dir':_0x55c0fd},function(_0x9a315b){if(_0x9a315b){logger[_0xc1e4('0x2d')](_0x9a315b);handleError(_0x9a315b,!![]);};var _0x4f81fe=fs['readdirSync'](_0x55c0fd);if(_0x4f81fe[_0xc1e4('0x3b')]>0x1){removeReferences(_0xe27e22,_0x55c0fd);logger[_0xc1e4('0x2d')](_0xc1e4('0x6c'));return _0x391e42(new Error(_0xc1e4('0x6c')));}var _0x4a909b=fs[_0xc1e4('0x6d')](path[_0xc1e4('0x4e')](_0x55c0fd,_0x4f81fe[0x0]));if(_0x4a909b[_0xc1e4('0x6e')]()){removeReferences(_0xe27e22,_0x55c0fd);logger[_0xc1e4('0x2d')]('Invalid\x20plugin\x20structure');return _0x391e42(new Error('Invalid\x20plugin\x20structure'));}if(_0x4a909b['isDirectory']()){var _0x3d064b=fs[_0xc1e4('0x6f')](path['join'](_0x55c0fd,_0x4f81fe[0x0]));if(_0x3d064b[_0xc1e4('0x3b')]===0x0){removeReferences(_0xe27e22,_0x55c0fd);logger[_0xc1e4('0x2d')]('Invalid\x20plugin\x20structure');return _0x391e42(new Error('Invalid\x20plugin\x20structure'));}var _0xb4023d=_0x3d064b[_0xc1e4('0x70')](function(_0x5b1256){return _0x5b1256===_0xc1e4('0x71');});if(!_0xb4023d){return _0x391e42(new Error(_0xc1e4('0x72')));}var _0x281dc0=fs[_0xc1e4('0x73')](path[_0xc1e4('0x4e')](_0x55c0fd,_0x4f81fe[0x0],_0xc1e4('0x71')));var _0x523430=JSON[_0xc1e4('0x74')](_0x281dc0);if(_0xc1e4('0x22')==typeof _0x523430[_0xc1e4('0x2f')]){return _0x391e42(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x523430[_0xc1e4('0x43')]){return _0x391e42(new Error(_0xc1e4('0x75')));}if(_0xc1e4('0x22')==typeof _0x523430['version']){return _0x391e42(new Error(_0xc1e4('0x76')));}if(_0xc1e4('0x22')==typeof _0x523430[_0xc1e4('0x77')]){return _0x391e42(new Error(_0xc1e4('0x78')));}if(_0x523430['type']===_0xc1e4('0x79')){if(_0xc1e4('0x22')==typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')]){return _0x391e42(new Error(_0xc1e4('0x7b')));}if(_0xc1e4('0x22')==typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')]['admin']&&'undefined'==typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')]['agent']){return _0x391e42(new Error(_0xc1e4('0x7c')));}}else if(_0x523430[_0xc1e4('0x43')]===_0xc1e4('0x7d')){if('undefined'==typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7e')]){return _0x391e42(new Error(_0xc1e4('0x7f')));}if(_0xc1e4('0x22')==typeof _0x523430['parameters'][_0xc1e4('0x80')]){return _0x391e42(new Error(_0xc1e4('0x81')));}}else{return _0x391e42(new Error(_0xc1e4('0x82')));}var _0x239f02=_0x523430[_0xc1e4('0x2f')];var _0x35eee5=_0x523430[_0xc1e4('0x83')];var _0x2c2aa3=_0x523430[_0xc1e4('0x43')];var _0x6860ae=_0x523430[_0xc1e4('0x84')]?_0x523430['sidebar']:_0xc1e4('0x85');var _0xc4ff66=_0x523430['icon']?_0x523430[_0xc1e4('0x86')]:'icon-apps';var _0x58c1d6='';var _0x105c6f='';var _0x27b4a8='';var _0x57f3cb='';var _0x541f21=_0x523430[_0xc1e4('0x87')];if(_0x2c2aa3===_0xc1e4('0x79')){if(_0xc1e4('0x22')!=typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')][_0xc1e4('0x88')]){var _0x157d67=_0x523430['parameters'][_0xc1e4('0x7a')][_0xc1e4('0x88')];if(!/^(f|ht)tps?:\/\//i['test'](_0x157d67)){_0x58c1d6=path[_0xc1e4('0x4e')](_0xc1e4('0x89'),_0x41c8f0,_0x4f81fe[0x0],_0x157d67);}else{_0x58c1d6=_0x157d67;}}else{logger['info'](_0xc1e4('0x8a'));}if(_0xc1e4('0x22')!=typeof _0x523430['parameters'][_0xc1e4('0x7a')][_0xc1e4('0x8b')]){var _0x11c272=_0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')][_0xc1e4('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0xc1e4('0x8c')](_0x11c272)){_0x105c6f=path['join'](_0xc1e4('0x89'),_0x41c8f0,_0x4f81fe[0x0],_0x11c272);}else{_0x105c6f=_0x11c272;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2c2aa3===_0xc1e4('0x7d')){_0x27b4a8=_0x523430[_0xc1e4('0x77')]['scriptName'];_0x57f3cb=_0x523430[_0xc1e4('0x77')][_0xc1e4('0x80')];if('undefined'!=typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')]){if(_0xc1e4('0x22')!=typeof _0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')][_0xc1e4('0x88')]){var _0x157d67=_0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')][_0xc1e4('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xc1e4('0x8c')](_0x157d67)){_0x58c1d6=path['join'](_0xc1e4('0x89'),_0x41c8f0,_0x4f81fe[0x0],_0x157d67);}else{_0x58c1d6=_0x157d67;}}if('undefined'!=typeof _0x523430['parameters'][_0xc1e4('0x7a')][_0xc1e4('0x8b')]){var _0x11c272=_0x523430[_0xc1e4('0x77')][_0xc1e4('0x7a')][_0xc1e4('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0xc1e4('0x8c')](_0x11c272)){_0x105c6f=path[_0xc1e4('0x4e')](_0xc1e4('0x89'),_0x41c8f0,_0x4f81fe[0x0],_0x11c272);}else{_0x105c6f=_0x11c272;}}}}var _0x1c14c0={'name':_0x239f02,'description':_0x35eee5,'path':path[_0xc1e4('0x4e')](_0x41c8f0,_0x4f81fe[0x0]),'type':_0x2c2aa3,'sidebar':_0x6860ae,'icon':_0xc4ff66,'adminUrl':_0x58c1d6,'agentUrl':_0x105c6f,'scriptName':_0x27b4a8,'scriptPath':_0x57f3cb,'version':_0x541f21};removeReferences(_0xe27e22,null);return db[_0xc1e4('0x32')][_0xc1e4('0x8d')](_0x1c14c0)['then'](function(_0x45ea37){var _0x11b1c6={'role':_0x14cfc2[_0xc1e4('0x8e')][_0xc1e4('0x8f')],'userProfileId':_0x14cfc2[_0xc1e4('0x8e')][_0xc1e4('0x90')]};if(!_0x11b1c6)throw new Error(_0xc1e4('0x91'));if(_0x11b1c6['role']===_0xc1e4('0x92')){var _0x5c74cc=_0x45ea37[_0xc1e4('0x93')]({'plain':!![]});return db[_0xc1e4('0x94')][_0xc1e4('0x4d')]({'where':{'name':_0xc1e4('0x2b'),'userProfileId':_0x11b1c6['userProfileId']},'raw':!![]})['then'](function(_0x51f6ab){if(_0x51f6ab&&_0x51f6ab[_0xc1e4('0x95')]===0x0){return db['UserProfileResource'][_0xc1e4('0x8d')]({'name':_0x5c74cc[_0xc1e4('0x2f')],'resourceId':_0x5c74cc['id'],'type':_0x51f6ab[_0xc1e4('0x2f')],'sectionId':_0x51f6ab['id']},{})['then'](function(){return _0x45ea37;});}else{return _0x45ea37;}})[_0xc1e4('0x49')](function(_0x13d281){logger[_0xc1e4('0x2d')](_0xc1e4('0x96'),_0x13d281);throw _0x13d281;});}return _0x45ea37;})[_0xc1e4('0x29')](respondWithResult(_0x11dcae,null))[_0xc1e4('0x49')](handleError(_0x11dcae,null));}});}catch(_0x510cb8){_0x11dcae[_0xc1e4('0x1e')](0x1f4)[_0xc1e4('0x30')](_0x510cb8);}};function removeReferences(_0x167440,_0x52aadc){try{if(_0x167440){fs['unlinkSync'](_0x167440);logger[_0xc1e4('0x65')](_0xc1e4('0x97'));}if(_0x52aadc){rimraf(_0x52aadc,function(){});logger['info'](_0xc1e4('0x98'));}}catch(_0x3f3094){logger[_0xc1e4('0x2d')](_0x3f3094);}}exports[_0xc1e4('0x28')]=function(_0x299fd1,_0x4ec97d,_0x4e78fb){return db[_0xc1e4('0x32')][_0xc1e4('0x4d')]({'where':{'id':_0x299fd1['params']['id']}})['then'](handleEntityNotFound(_0x4ec97d,null))['then'](saveUpdates(_0x299fd1[_0xc1e4('0x8e')],null))[_0xc1e4('0x29')](respondWithResult(_0x4ec97d,null))[_0xc1e4('0x49')](handleError(_0x4ec97d,null));};exports['delete']=function(_0x329e6a,_0x26ff23,_0x3aa03f){return db[_0xc1e4('0x32')][_0xc1e4('0x4d')]({'where':{'id':_0x329e6a[_0xc1e4('0x4b')]['id']}})[_0xc1e4('0x29')](function(_0x14b6e8){if(_0x14b6e8){return _0x14b6e8['destroy']();}})['then'](function(_0x929b28){rimraf(path['join'](config[_0xc1e4('0x5a')],'server/files/plugins',path[_0xc1e4('0x5b')](_0x929b28['path'])),function(){});return _0x929b28;})[_0xc1e4('0x29')](handleEntityNotFound(_0x26ff23,null))['then'](respondWithStatusCode(_0x26ff23,null))[_0xc1e4('0x49')](handleError(_0x26ff23,null));};exports['webhookGet']=function(_0x4ce01a,_0x1ced1d,_0x463105){return BPromise[_0xc1e4('0x99')]()['then'](function(){if(!_0x4ce01a[_0xc1e4('0x37')][_0xc1e4('0x8')]){throw new Error(_0xc1e4('0x9a'));}if(!_0x4ce01a['query'][_0xc1e4('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x268028=_0x4ce01a['query'][_0xc1e4('0x9c')]?_0x4ce01a[_0xc1e4('0x37')]['hostname']+':'+_0x4ce01a[_0xc1e4('0x37')]['port']:'http://localhost:'+_0x4ce01a[_0xc1e4('0x37')][_0xc1e4('0x9b')];var _0x2fe085=_0x4ce01a['query'][_0xc1e4('0x20')]?_0x4ce01a[_0xc1e4('0x37')][_0xc1e4('0x20')]:!![];var _0x5854c7=_0x4ce01a['query'][_0xc1e4('0x9d')]?_0x4ce01a[_0xc1e4('0x37')][_0xc1e4('0x9d')]:null;var _0x1cf2b2={'method':_0x4ce01a[_0xc1e4('0x9e')],'uri':util[_0xc1e4('0x9f')](_0xc1e4('0xa0'),_0x268028,_0x4ce01a[_0xc1e4('0x37')][_0xc1e4('0x8')]),'json':_0x2fe085,'resolveWithFullResponse':!![],'encoding':_0x5854c7,'qs':_0x4ce01a[_0xc1e4('0x37')]};if(_0x4ce01a[_0xc1e4('0xa1')]){_0x1cf2b2['headers']=_0x4ce01a[_0xc1e4('0xa1')];if(_0x1cf2b2['headers']['content-length']){delete _0x1cf2b2['headers'][_0xc1e4('0xa2')];}}if(_0x1cf2b2['headers'][_0xc1e4('0xa3')]){delete _0x1cf2b2[_0xc1e4('0xa1')][_0xc1e4('0xa3')];}return rp(_0x1cf2b2);})[_0xc1e4('0x29')](function(_0x57870c){if(_0x57870c){_0x1ced1d[_0xc1e4('0x25')](_0x57870c[_0xc1e4('0xa1')]);logger['info'](_0x57870c['body']);if(_[_0xc1e4('0xa4')](_0x4ce01a[_0xc1e4('0x37')]['path'],_0xc1e4('0x61'))&&_0x57870c['statusCode']==0x1f4){return _0x1ced1d[_0xc1e4('0x2c')](_0x57870c[_0xc1e4('0xa5')]);}else{return _0x1ced1d[_0xc1e4('0x1e')](_0x57870c[_0xc1e4('0xa5')])['send'](_0x57870c[_0xc1e4('0x8e')]);}}else{return _0x1ced1d['sendStatus'](0xc8);}})[_0xc1e4('0x49')](handleError(_0x1ced1d,null));};exports[_0xc1e4('0xa6')]=function(_0x233960,_0x3f46f8,_0x3afe74){return BPromise[_0xc1e4('0x99')]()[_0xc1e4('0x29')](function(){if(!_0x233960[_0xc1e4('0x37')][_0xc1e4('0x8')]){throw new Error(_0xc1e4('0x9a'));}if(!_0x233960[_0xc1e4('0x37')][_0xc1e4('0x9b')]){throw new Error(_0xc1e4('0xa7'));}var _0x413f81=_0x233960[_0xc1e4('0x37')][_0xc1e4('0x9c')]?_0x233960[_0xc1e4('0x37')][_0xc1e4('0x9c')]+':'+_0x233960[_0xc1e4('0x37')][_0xc1e4('0x9b')]:_0xc1e4('0xa8')+_0x233960[_0xc1e4('0x37')][_0xc1e4('0x9b')];var _0x12db08=_0x233960['query'][_0xc1e4('0x20')]?_0x233960['query'][_0xc1e4('0x20')]:!![];var _0xab8283=_0x233960[_0xc1e4('0x37')]['encoding']?_0x233960['query']['encoding']:null;var _0x434231={'method':_0x233960[_0xc1e4('0x9e')],'uri':util[_0xc1e4('0x9f')]('%s%s',_0x413f81,_0x233960[_0xc1e4('0x37')][_0xc1e4('0x8')]),'json':_0x12db08,'resolveWithFullResponse':!![],'encoding':_0xab8283,'body':_0x233960[_0xc1e4('0x8e')]};if(_0x233960[_0xc1e4('0xa1')]){_0x434231[_0xc1e4('0xa1')]=_0x233960[_0xc1e4('0xa1')];if(_0x434231['headers']['content-length']){delete _0x434231['headers']['content-length'];}}if(_0x434231[_0xc1e4('0xa1')][_0xc1e4('0xa3')]){delete _0x434231[_0xc1e4('0xa1')][_0xc1e4('0xa3')];}return rp(_0x434231);})[_0xc1e4('0x29')](function(_0x34cafc){if(_0x34cafc){_0x3f46f8['set'](_0x34cafc[_0xc1e4('0xa1')]);logger['info'](_0x34cafc[_0xc1e4('0x8e')]);return _0x3f46f8[_0xc1e4('0x1e')](_0x34cafc[_0xc1e4('0xa5')])[_0xc1e4('0x30')](_0x34cafc[_0xc1e4('0x8e')]);}else{return _0x3f46f8[_0xc1e4('0x2c')](0xc8);}})[_0xc1e4('0x49')](handleError(_0x3f46f8,null));}; \ No newline at end of file +var _0xd7b5=['views','Invalid\x20manifest:\x20views\x20missing','admin','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','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','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','body','webhookPost','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','offset','limit','count','status','set','Content-Range','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Plugin','includeAll','findAll','rows','show','length','catch','download','find','params','join','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','attachments/**/*','finalize','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','undefined','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing'];(function(_0x325e52,_0x428df9){var _0x5dcf19=function(_0x2ee7e0){while(--_0x2ee7e0){_0x325e52['push'](_0x325e52['shift']());}};_0x5dcf19(++_0x428df9);}(_0xd7b5,0x182));var _0x5d7b=function(_0x2265c1,_0x154ab1){_0x2265c1=_0x2265c1-0x0;var _0x9b0f1e=_0xd7b5[_0x2265c1];return _0x9b0f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d7b('0x0'));var zipdir=require(_0x5d7b('0x1'));var jsonpatch=require(_0x5d7b('0x2'));var rp=require(_0x5d7b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d7b('0x4'));var util=require(_0x5d7b('0x5'));var path=require(_0x5d7b('0x6'));var sox=require(_0x5d7b('0x7'));var csv=require(_0x5d7b('0x8'));var ejs=require(_0x5d7b('0x9'));var fs=require('fs');var fs_extra=require(_0x5d7b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d7b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5d7b('0xc'));var toCsv=require(_0x5d7b('0x8'));var querystring=require('querystring');var Papa=require(_0x5d7b('0xd'));var extract=require(_0x5d7b('0xe'));var rimraf=require(_0x5d7b('0x0'));var archiver=require('archiver');var Redis=require(_0x5d7b('0xf'));var authService=require(_0x5d7b('0x10'));var qs=require(_0x5d7b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d7b('0x12'));var logger=require('../../config/logger')(_0x5d7b('0x13'));var utils=require(_0x5d7b('0x14'));var config=require(_0x5d7b('0x15'));var licenseUtil=require(_0x5d7b('0x16'));var db=require(_0x5d7b('0x17'))['db'];config['redis']=_['defaults'](config[_0x5d7b('0x18')],{'host':_0x5d7b('0x19'),'port':0x18eb});var socket=require(_0x5d7b('0x1a'))(new Redis(config[_0x5d7b('0x18')]));require('./plugin.socket')[_0x5d7b('0x1b')](socket);function respondWithStatusCode(_0x202c10,_0x471692){_0x471692=_0x471692||0xcc;return function(_0x24981c){if(_0x24981c){return _0x202c10['sendStatus'](_0x471692);}return _0x202c10['status'](_0x471692)[_0x5d7b('0x1c')]();};}function respondWithResult(_0x4c8b2d,_0x2faa31){_0x2faa31=_0x2faa31||0xc8;return function(_0x147524){if(_0x147524){return _0x4c8b2d['status'](_0x2faa31)['json'](_0x147524);}};}function respondWithFilteredResult(_0x4e04ec,_0x166ad9){return function(_0x38ce69){if(_0x38ce69){var _0x5e051b=typeof _0x166ad9[_0x5d7b('0x1d')]==='undefined'&&typeof _0x166ad9[_0x5d7b('0x1e')]==='undefined';var _0x966bc3=_0x38ce69[_0x5d7b('0x1f')];var _0x195d9b=_0x5e051b?0x0:_0x166ad9[_0x5d7b('0x1d')];var _0x33d31b=_0x5e051b?_0x38ce69['count']:_0x166ad9[_0x5d7b('0x1d')]+_0x166ad9[_0x5d7b('0x1e')];var _0x389585;if(_0x33d31b>=_0x966bc3){_0x33d31b=_0x966bc3;_0x389585=0xc8;}else{_0x389585=0xce;}_0x4e04ec[_0x5d7b('0x20')](_0x389585);return _0x4e04ec[_0x5d7b('0x21')](_0x5d7b('0x22'),_0x195d9b+'-'+_0x33d31b+'/'+_0x966bc3)[_0x5d7b('0x23')](_0x38ce69);}return null;};}function patchUpdates(_0x4d3110){return function(_0x43939b){try{jsonpatch['apply'](_0x43939b,_0x4d3110,!![]);}catch(_0x209f31){return BPromise[_0x5d7b('0x24')](_0x209f31);}return _0x43939b[_0x5d7b('0x25')]();};}function saveUpdates(_0x319f68,_0x7ae019){return function(_0x1ee1ac){if(_0x1ee1ac){return _0x1ee1ac[_0x5d7b('0x26')](_0x319f68)[_0x5d7b('0x27')](function(_0x288005){return _0x288005;});}return null;};}function removeEntity(_0x21d940,_0x5bfa93){return function(_0xbe4a0d){if(_0xbe4a0d){return _0xbe4a0d[_0x5d7b('0x28')]()[_0x5d7b('0x27')](function(){var _0x42d6c2=_0xbe4a0d[_0x5d7b('0x29')]({'plain':!![]});var _0x20cddb=_0x5d7b('0x2a');return db[_0x5d7b('0x2b')][_0x5d7b('0x28')]({'where':{'type':_0x20cddb,'resourceId':_0x42d6c2['id']}})[_0x5d7b('0x27')](function(){return _0xbe4a0d;});})[_0x5d7b('0x27')](function(){_0x21d940['status'](0xcc)[_0x5d7b('0x1c')]();});}};}function handleEntityNotFound(_0x518488,_0x20be61){return function(_0x2d601d){if(!_0x2d601d){_0x518488[_0x5d7b('0x2c')](0x194);}return _0x2d601d;};}function handleError(_0x5c2394,_0x5c3fd0){_0x5c3fd0=_0x5c3fd0||0x1f4;return function(_0x31d3e0){logger[_0x5d7b('0x2d')](_0x31d3e0[_0x5d7b('0x2e')]);if(_0x31d3e0['name']){delete _0x31d3e0[_0x5d7b('0x2f')];}_0x5c2394[_0x5d7b('0x20')](_0x5c3fd0)[_0x5d7b('0x30')](_0x31d3e0);};}exports['index']=function(_0x1c5c6c,_0x141b0e){var _0xdb6176={},_0x287ed1={},_0x33b91f={'count':0x0,'rows':[]};var _0x5d9b71=_['map'](db['Plugin'][_0x5d7b('0x31')],function(_0x25f15a){return{'name':_0x25f15a['fieldName'],'type':_0x25f15a[_0x5d7b('0x32')][_0x5d7b('0x33')]};});_0x287ed1[_0x5d7b('0x34')]=_[_0x5d7b('0x35')](_0x5d9b71,_0x5d7b('0x2f'));_0x287ed1['query']=_[_0x5d7b('0x36')](_0x1c5c6c[_0x5d7b('0x37')]);_0x287ed1[_0x5d7b('0x38')]=_[_0x5d7b('0x39')](_0x287ed1[_0x5d7b('0x34')],_0x287ed1[_0x5d7b('0x37')]);_0xdb6176[_0x5d7b('0x3a')]=_['intersection'](_0x287ed1[_0x5d7b('0x34')],qs[_0x5d7b('0x3b')](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x3b')]));_0xdb6176[_0x5d7b('0x3a')]=_0xdb6176[_0x5d7b('0x3a')]['length']?_0xdb6176[_0x5d7b('0x3a')]:_0x287ed1[_0x5d7b('0x34')];if(!_0x1c5c6c['query'][_0x5d7b('0x3c')](_0x5d7b('0x3d'))){_0xdb6176[_0x5d7b('0x1e')]=qs['limit'](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x1e')]);_0xdb6176[_0x5d7b('0x1d')]=qs[_0x5d7b('0x1d')](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x1d')]);}_0xdb6176[_0x5d7b('0x3e')]=qs[_0x5d7b('0x3f')](_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x3f')]);_0xdb6176['where']=qs[_0x5d7b('0x38')](_[_0x5d7b('0x40')](_0x1c5c6c[_0x5d7b('0x37')],_0x287ed1['filters']),_0x5d9b71);if(_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x41')]){_0xdb6176['where']=_[_0x5d7b('0x42')](_0xdb6176[_0x5d7b('0x43')],{'$or':_[_0x5d7b('0x35')](_0x5d9b71,function(_0x326410){if(_0x326410[_0x5d7b('0x32')]!==_0x5d7b('0x44')){var _0x1eb42a={};_0x1eb42a[_0x326410['name']]={'$like':'%'+_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x41')]+'%'};return _0x1eb42a;}})});}_0xdb6176=_['merge']({},_0xdb6176,_0x1c5c6c[_0x5d7b('0x45')]);var _0x20e36e={'where':_0xdb6176[_0x5d7b('0x43')]};return db[_0x5d7b('0x46')][_0x5d7b('0x1f')](_0x20e36e)[_0x5d7b('0x27')](function(_0x56f9c4){_0x33b91f[_0x5d7b('0x1f')]=_0x56f9c4;if(_0x1c5c6c[_0x5d7b('0x37')][_0x5d7b('0x47')]){_0xdb6176['include']=[{'all':!![]}];}return db[_0x5d7b('0x46')][_0x5d7b('0x48')](_0xdb6176);})[_0x5d7b('0x27')](function(_0x3574b7){_0x33b91f[_0x5d7b('0x49')]=_0x3574b7;return _0x33b91f;})['then'](respondWithFilteredResult(_0x141b0e,_0xdb6176))['catch'](handleError(_0x141b0e,null));};exports[_0x5d7b('0x4a')]=function(_0x58835e,_0x84d2d5){var _0x5157c8={'raw':!![],'where':{'id':_0x58835e['params']['id']}},_0xda9fdf={};_0xda9fdf['model']=_['keys'](db[_0x5d7b('0x46')][_0x5d7b('0x31')]);_0xda9fdf['query']=_[_0x5d7b('0x36')](_0x58835e['query']);_0xda9fdf[_0x5d7b('0x38')]=_[_0x5d7b('0x39')](_0xda9fdf['model'],_0xda9fdf[_0x5d7b('0x37')]);_0x5157c8['attributes']=_[_0x5d7b('0x39')](_0xda9fdf['model'],qs[_0x5d7b('0x3b')](_0x58835e[_0x5d7b('0x37')][_0x5d7b('0x3b')]));_0x5157c8[_0x5d7b('0x3a')]=_0x5157c8[_0x5d7b('0x3a')][_0x5d7b('0x4b')]?_0x5157c8[_0x5d7b('0x3a')]:_0xda9fdf['model'];if(_0x58835e[_0x5d7b('0x37')]['includeAll']){_0x5157c8['include']=[{'all':!![]}];}_0x5157c8=_[_0x5d7b('0x42')]({},_0x5157c8,_0x58835e['options']);return db[_0x5d7b('0x46')]['find'](_0x5157c8)[_0x5d7b('0x27')](handleEntityNotFound(_0x84d2d5,null))[_0x5d7b('0x27')](respondWithResult(_0x84d2d5,null))[_0x5d7b('0x4c')](handleError(_0x84d2d5,null));};exports[_0x5d7b('0x4d')]=function(_0x42620d,_0x27ee34,_0x3ec95b){return db[_0x5d7b('0x46')][_0x5d7b('0x4e')]({'where':{'id':_0x42620d[_0x5d7b('0x4f')]['id']},'attributes':[_0x5d7b('0x2f'),_0x5d7b('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x27ee34,null))[_0x5d7b('0x27')](function(_0x6fafd0){if(_0x6fafd0){var _0x50afaf=path[_0x5d7b('0x50')](config['root'],_0x5d7b('0x51'),util['format'](_0x5d7b('0x52'),path[_0x5d7b('0x53')](_0x6fafd0[_0x5d7b('0x6')])));var _0x5e783c=fs[_0x5d7b('0x54')](_0x50afaf);var _0x5b5a12=archiver(_0x5d7b('0x55'),{'zlib':{'level':0x9}});_0x5b5a12['on'](_0x5d7b('0x56'),function(_0x48cb65){if(_0x48cb65[_0x5d7b('0x57')]===_0x5d7b('0x58')){logger[_0x5d7b('0x2d')](_0x48cb65);}else{throw new db['Sequelize']['Error'](_0x5d7b('0x59'));}});_0x5b5a12['on'](_0x5d7b('0x2d'),function(_0x421625){throw new db[(_0x5d7b('0x5a'))][(_0x5d7b('0x5b'))](_0x5d7b('0x59'));});_0x5b5a12[_0x5d7b('0x5c')](_0x5e783c);_0x5b5a12[_0x5d7b('0x5d')](_0x5d7b('0x5e'),{'cwd':path[_0x5d7b('0x50')](config['root'],_0x5d7b('0x51'),path[_0x5d7b('0x5f')](_0x6fafd0[_0x5d7b('0x6')])),'ignore':[path[_0x5d7b('0x50')](path[_0x5d7b('0x53')](_0x6fafd0['path']),'node_modules/**/*'),path[_0x5d7b('0x50')](path[_0x5d7b('0x53')](_0x6fafd0[_0x5d7b('0x6')]),_0x5d7b('0x60'))],'nodir':!![]})[_0x5d7b('0x61')]();_0x5e783c['on']('close',function(){if(!fs['existsSync'](_0x50afaf)){throw new db[(_0x5d7b('0x5a'))]['Error'](_0x5d7b('0x62'));}return _0x27ee34[_0x5d7b('0x4d')](_0x50afaf,util[_0x5d7b('0x63')]('%s.zip',path[_0x5d7b('0x53')](_0x6fafd0[_0x5d7b('0x6')])),function(_0x13670d){if(_0x13670d){throw new db[(_0x5d7b('0x5a'))][(_0x5d7b('0x5b'))](_0x5d7b('0x64'));}fs[_0x5d7b('0x65')](_0x50afaf);logger[_0x5d7b('0x66')]('Download\x20completed');logger[_0x5d7b('0x66')](_0x5d7b('0x67'));});});}return null;})[_0x5d7b('0x4c')](handleError(_0x27ee34,null));};exports[_0x5d7b('0x68')]=function(_0x4cb7f4,_0x428850,_0x33bd6f){var _0x4a264d=path[_0x5d7b('0x53')](_0x4cb7f4['file']['filename'],path[_0x5d7b('0x69')](_0x4cb7f4[_0x5d7b('0x6a')][_0x5d7b('0x6b')]));var _0x16feee=path['join'](config['root'],_0x5d7b('0x51'),_0x4cb7f4[_0x5d7b('0x6a')][_0x5d7b('0x6b')]);var _0x58f8aa=path[_0x5d7b('0x50')](config['root'],_0x5d7b('0x51'),_0x4a264d);logger[_0x5d7b('0x66')](_0x5d7b('0x6c'),_0x16feee);logger['info'](_0x5d7b('0x6d'),_0x58f8aa);try{fs[_0x5d7b('0x6e')](_0x16feee,parseInt('0777',0x8));extract(_0x16feee,{'dir':_0x58f8aa},function(_0x4d381f){if(_0x4d381f){logger[_0x5d7b('0x2d')](_0x4d381f);handleError(_0x4d381f,!![]);};var _0x30adf6=fs[_0x5d7b('0x6f')](_0x58f8aa);if(_0x30adf6[_0x5d7b('0x4b')]>0x1){removeReferences(_0x16feee,_0x58f8aa);logger[_0x5d7b('0x2d')]('Invalid\x20plugin\x20structure');return _0x33bd6f(new Error(_0x5d7b('0x70')));}var _0x5ac6f1=fs[_0x5d7b('0x71')](path[_0x5d7b('0x50')](_0x58f8aa,_0x30adf6[0x0]));if(_0x5ac6f1[_0x5d7b('0x72')]()){removeReferences(_0x16feee,_0x58f8aa);logger[_0x5d7b('0x2d')](_0x5d7b('0x70'));return _0x33bd6f(new Error(_0x5d7b('0x70')));}if(_0x5ac6f1[_0x5d7b('0x73')]()){var _0x2b9283=fs[_0x5d7b('0x6f')](path[_0x5d7b('0x50')](_0x58f8aa,_0x30adf6[0x0]));if(_0x2b9283[_0x5d7b('0x4b')]===0x0){removeReferences(_0x16feee,_0x58f8aa);logger[_0x5d7b('0x2d')]('Invalid\x20plugin\x20structure');return _0x33bd6f(new Error(_0x5d7b('0x70')));}var _0x24752d=_0x2b9283[_0x5d7b('0x74')](function(_0x40e464){return _0x40e464===_0x5d7b('0x75');});if(!_0x24752d){return _0x33bd6f(new Error(_0x5d7b('0x76')));}var _0x1ab796=fs['readFileSync'](path[_0x5d7b('0x50')](_0x58f8aa,_0x30adf6[0x0],'manifest.json'));var _0x275688=JSON['parse'](_0x1ab796);if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x2f')]){return _0x33bd6f(new Error(_0x5d7b('0x78')));}if('undefined'==typeof _0x275688[_0x5d7b('0x32')]){return _0x33bd6f(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x79')]){return _0x33bd6f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x275688[_0x5d7b('0x7a')]){return _0x33bd6f(new Error(_0x5d7b('0x7b')));}if(_0x275688[_0x5d7b('0x32')]==='html'){if(_0x5d7b('0x77')==typeof _0x275688['parameters'][_0x5d7b('0x7c')]){return _0x33bd6f(new Error(_0x5d7b('0x7d')));}if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')][_0x5d7b('0x7e')]&&_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')]['agent']){return _0x33bd6f(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x275688['type']==='script'){if('undefined'==typeof _0x275688['parameters'][_0x5d7b('0x7f')]){return _0x33bd6f(new Error(_0x5d7b('0x80')));}if(_0x5d7b('0x77')==typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x81')]){return _0x33bd6f(new Error(_0x5d7b('0x82')));}}else{return _0x33bd6f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x22815f=_0x275688[_0x5d7b('0x2f')];var _0x3c2050=_0x275688['description'];var _0x3b9420=_0x275688[_0x5d7b('0x32')];var _0x2bfe88=_0x275688[_0x5d7b('0x83')]?_0x275688[_0x5d7b('0x83')]:_0x5d7b('0x84');var _0x2c3f8d=_0x275688[_0x5d7b('0x85')]?_0x275688[_0x5d7b('0x85')]:_0x5d7b('0x86');var _0x9c28d2='';var _0x53d409='';var _0x44deca='';var _0x5620e0='';var _0x3a0ba1=_0x275688[_0x5d7b('0x79')];if(_0x3b9420===_0x5d7b('0x87')){if('undefined'!=typeof _0x275688[_0x5d7b('0x7a')]['views'][_0x5d7b('0x7e')]){var _0x4bf905=_0x275688[_0x5d7b('0x7a')]['views'][_0x5d7b('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x5d7b('0x88')](_0x4bf905)){_0x9c28d2=path[_0x5d7b('0x50')](_0x5d7b('0x89'),_0x4a264d,_0x30adf6[0x0],_0x4bf905);}else{_0x9c28d2=_0x4bf905;}}else{logger[_0x5d7b('0x66')](_0x5d7b('0x8a'));}if('undefined'!=typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')][_0x5d7b('0x8b')]){var _0x3178a2=_0x275688['parameters'][_0x5d7b('0x7c')][_0x5d7b('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x5d7b('0x88')](_0x3178a2)){_0x53d409=path[_0x5d7b('0x50')]('plugins',_0x4a264d,_0x30adf6[0x0],_0x3178a2);}else{_0x53d409=_0x3178a2;}}else{logger[_0x5d7b('0x66')](_0x5d7b('0x8c'));}}else if(_0x3b9420===_0x5d7b('0x8d')){_0x44deca=_0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7f')];_0x5620e0=_0x275688[_0x5d7b('0x7a')][_0x5d7b('0x81')];if('undefined'!=typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')]){if(_0x5d7b('0x77')!=typeof _0x275688['parameters']['views']['admin']){var _0x4bf905=_0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')][_0x5d7b('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4bf905)){_0x9c28d2=path[_0x5d7b('0x50')]('plugins',_0x4a264d,_0x30adf6[0x0],_0x4bf905);}else{_0x9c28d2=_0x4bf905;}}if(_0x5d7b('0x77')!=typeof _0x275688[_0x5d7b('0x7a')][_0x5d7b('0x7c')]['agent']){var _0x3178a2=_0x275688[_0x5d7b('0x7a')]['views'][_0x5d7b('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x5d7b('0x88')](_0x3178a2)){_0x53d409=path[_0x5d7b('0x50')](_0x5d7b('0x89'),_0x4a264d,_0x30adf6[0x0],_0x3178a2);}else{_0x53d409=_0x3178a2;}}}}var _0x116ba5={'name':_0x22815f,'description':_0x3c2050,'path':path[_0x5d7b('0x50')](_0x4a264d,_0x30adf6[0x0]),'type':_0x3b9420,'sidebar':_0x2bfe88,'icon':_0x2c3f8d,'adminUrl':_0x9c28d2,'agentUrl':_0x53d409,'scriptName':_0x44deca,'scriptPath':_0x5620e0,'version':_0x3a0ba1};removeReferences(_0x16feee,null);return db[_0x5d7b('0x46')]['create'](_0x116ba5)[_0x5d7b('0x27')](function(_0x48e5db){var _0x251d9a={'role':_0x4cb7f4['body']['role'],'userProfileId':_0x4cb7f4['body'][_0x5d7b('0x8e')]};if(!_0x251d9a)throw new Error(_0x5d7b('0x8f'));if(_0x251d9a[_0x5d7b('0x90')]===_0x5d7b('0x91')){var _0x3e5649=_0x48e5db[_0x5d7b('0x29')]({'plain':!![]});return db[_0x5d7b('0x92')][_0x5d7b('0x4e')]({'where':{'name':'Plugins','userProfileId':_0x251d9a['userProfileId']},'raw':!![]})[_0x5d7b('0x27')](function(_0x3460bb){if(_0x3460bb&&_0x3460bb[_0x5d7b('0x93')]===0x0){return db[_0x5d7b('0x2b')][_0x5d7b('0x94')]({'name':_0x3e5649['name'],'resourceId':_0x3e5649['id'],'type':_0x3460bb[_0x5d7b('0x2f')],'sectionId':_0x3460bb['id']},{})[_0x5d7b('0x27')](function(){return _0x48e5db;});}else{return _0x48e5db;}})[_0x5d7b('0x4c')](function(_0x335893){logger[_0x5d7b('0x2d')](_0x5d7b('0x95'),_0x335893);throw _0x335893;});}return _0x48e5db;})[_0x5d7b('0x27')](respondWithResult(_0x428850,null))[_0x5d7b('0x4c')](handleError(_0x428850,null));}});}catch(_0x539afa){_0x428850['status'](0x1f4)[_0x5d7b('0x30')](_0x539afa);}};function removeReferences(_0x38c586,_0x5da458){try{if(_0x38c586){fs[_0x5d7b('0x65')](_0x38c586);logger[_0x5d7b('0x66')](_0x5d7b('0x96'));}if(_0x5da458){rimraf(_0x5da458,function(){});logger[_0x5d7b('0x66')](_0x5d7b('0x97'));}}catch(_0x162ceb){logger['error'](_0x162ceb);}}exports['update']=function(_0x462952,_0x2ba976,_0x166c93){return db[_0x5d7b('0x46')][_0x5d7b('0x4e')]({'where':{'id':_0x462952[_0x5d7b('0x4f')]['id']}})[_0x5d7b('0x27')](handleEntityNotFound(_0x2ba976,null))['then'](saveUpdates(_0x462952['body'],null))[_0x5d7b('0x27')](respondWithResult(_0x2ba976,null))[_0x5d7b('0x4c')](handleError(_0x2ba976,null));};exports[_0x5d7b('0x98')]=function(_0xf694bb,_0x45b6d2,_0x33b8ca){return db[_0x5d7b('0x46')][_0x5d7b('0x4e')]({'where':{'id':_0xf694bb[_0x5d7b('0x4f')]['id']}})[_0x5d7b('0x27')](function(_0x4e9223){if(_0x4e9223){return _0x4e9223['destroy']();}})[_0x5d7b('0x27')](function(_0x5dbcf4){rimraf(path['join'](config['root'],_0x5d7b('0x51'),path[_0x5d7b('0x5f')](_0x5dbcf4[_0x5d7b('0x6')])),function(){});return _0x5dbcf4;})[_0x5d7b('0x27')](handleEntityNotFound(_0x45b6d2,null))[_0x5d7b('0x27')](respondWithStatusCode(_0x45b6d2,null))[_0x5d7b('0x4c')](handleError(_0x45b6d2,null));};exports[_0x5d7b('0x99')]=function(_0x2adcc0,_0x30fc4f,_0x587245){return BPromise[_0x5d7b('0x9a')]()[_0x5d7b('0x27')](function(){if(!_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x6')]){throw new Error(_0x5d7b('0x9b'));}if(!_0x2adcc0['query'][_0x5d7b('0x9c')]){throw new Error(_0x5d7b('0x9d'));}var _0x50430c=_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9e')]?_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9e')]+':'+_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9c')]:_0x5d7b('0x9f')+_0x2adcc0[_0x5d7b('0x37')][_0x5d7b('0x9c')];var _0x2622d2=_0x2adcc0[_0x5d7b('0x37')]['json']?_0x2adcc0[_0x5d7b('0x37')]['json']:!![];var _0x38c258=_0x2adcc0['query']['encoding']?_0x2adcc0['query'][_0x5d7b('0xa0')]:null;var _0x1000ae={'method':_0x2adcc0[_0x5d7b('0xa1')],'uri':util[_0x5d7b('0x63')](_0x5d7b('0xa2'),_0x50430c,_0x2adcc0['query'][_0x5d7b('0x6')]),'json':_0x2622d2,'resolveWithFullResponse':!![],'encoding':_0x38c258,'qs':_0x2adcc0[_0x5d7b('0x37')]};if(_0x2adcc0[_0x5d7b('0xa3')]){_0x1000ae[_0x5d7b('0xa3')]=_0x2adcc0[_0x5d7b('0xa3')];if(_0x1000ae[_0x5d7b('0xa3')][_0x5d7b('0xa4')]){delete _0x1000ae['headers']['content-length'];}}if(_0x1000ae[_0x5d7b('0xa3')][_0x5d7b('0xa5')]){delete _0x1000ae[_0x5d7b('0xa3')][_0x5d7b('0xa5')];}return rp(_0x1000ae);})[_0x5d7b('0x27')](function(_0x5946ba){if(_0x5946ba){_0x30fc4f[_0x5d7b('0x21')](_0x5946ba[_0x5d7b('0xa3')]);logger[_0x5d7b('0x66')](_0x5946ba['body']);if(_[_0x5d7b('0xa6')](_0x2adcc0[_0x5d7b('0x37')]['path'],_0x5d7b('0x4d'))&&_0x5946ba[_0x5d7b('0xa7')]==0x1f4){return _0x30fc4f['sendStatus'](_0x5946ba[_0x5d7b('0xa7')]);}else{return _0x30fc4f['status'](_0x5946ba[_0x5d7b('0xa7')])['send'](_0x5946ba[_0x5d7b('0xa8')]);}}else{return _0x30fc4f[_0x5d7b('0x2c')](0xc8);}})['catch'](handleError(_0x30fc4f,null));};exports[_0x5d7b('0xa9')]=function(_0x4cfc10,_0x479645,_0x5602f4){return BPromise[_0x5d7b('0x9a')]()[_0x5d7b('0x27')](function(){if(!_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x9c')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x48e2cb=_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x9e')]?_0x4cfc10[_0x5d7b('0x37')]['hostname']+':'+_0x4cfc10['query'][_0x5d7b('0x9c')]:'http://localhost:'+_0x4cfc10['query'][_0x5d7b('0x9c')];var _0x49fe54=_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x23')]?_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x23')]:!![];var _0x147526=_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0xa0')]?_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0xa0')]:null;var _0x4a6e3c={'method':_0x4cfc10['method'],'uri':util[_0x5d7b('0x63')](_0x5d7b('0xa2'),_0x48e2cb,_0x4cfc10[_0x5d7b('0x37')][_0x5d7b('0x6')]),'json':_0x49fe54,'resolveWithFullResponse':!![],'encoding':_0x147526,'body':_0x4cfc10[_0x5d7b('0xa8')]};if(_0x4cfc10[_0x5d7b('0xa3')]){_0x4a6e3c[_0x5d7b('0xa3')]=_0x4cfc10[_0x5d7b('0xa3')];if(_0x4a6e3c[_0x5d7b('0xa3')]['content-length']){delete _0x4a6e3c[_0x5d7b('0xa3')][_0x5d7b('0xa4')];}}if(_0x4a6e3c[_0x5d7b('0xa3')][_0x5d7b('0xa5')]){delete _0x4a6e3c[_0x5d7b('0xa3')][_0x5d7b('0xa5')];}return rp(_0x4a6e3c);})[_0x5d7b('0x27')](function(_0x4f21b8){if(_0x4f21b8){_0x479645['set'](_0x4f21b8[_0x5d7b('0xa3')]);logger[_0x5d7b('0x66')](_0x4f21b8[_0x5d7b('0xa8')]);return _0x479645['status'](_0x4f21b8[_0x5d7b('0xa7')])['send'](_0x4f21b8['body']);}else{return _0x479645['sendStatus'](0xc8);}})[_0x5d7b('0x4c')](handleError(_0x479645,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1bcabe4..537925c 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 _0xf494=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','save','update'];(function(_0x30c572,_0x28ddc7){var _0x18d96c=function(_0x4ff8a4){while(--_0x4ff8a4){_0x30c572['push'](_0x30c572['shift']());}};_0x18d96c(++_0x28ddc7);}(_0xf494,0x1c6));var _0x4f49=function(_0x528200,_0x300702){_0x528200=_0x528200-0x0;var _0x160be8=_0xf494[_0x528200];return _0x160be8;};'use strict';var EventEmitter=require(_0x4f49('0x0'));var Plugin=require(_0x4f49('0x1'))['db'][_0x4f49('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4f49('0x3'),'afterUpdate':_0x4f49('0x4'),'afterDestroy':_0x4f49('0x5')};function emitEvent(_0x25677c){return function(_0x20c0d7,_0x2a15fb,_0x3267c1){PluginEvents[_0x4f49('0x6')](_0x25677c+':'+_0x20c0d7['id'],_0x20c0d7);PluginEvents[_0x4f49('0x6')](_0x25677c,_0x20c0d7);_0x3267c1(null);};}for(var e in events){if(events[_0x4f49('0x7')](e)){var event=events[e];Plugin[_0x4f49('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xdcf6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb','Plugin'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x22ac5b,_0x2ef85c){_0x22ac5b=_0x22ac5b-0x0;var _0x4b5cc4=_0xdcf6[_0x22ac5b];return _0x4b5cc4;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x6dcf('0x0'))['db'][_0x6dcf('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x6dcf('0x2')](0x0);var events={'afterCreate':_0x6dcf('0x3'),'afterUpdate':_0x6dcf('0x4'),'afterDestroy':_0x6dcf('0x5')};function emitEvent(_0x1320a5){return function(_0x513bcb,_0x69f442,_0x19eeff){PluginEvents['emit'](_0x1320a5+':'+_0x513bcb['id'],_0x513bcb);PluginEvents[_0x6dcf('0x6')](_0x1320a5,_0x513bcb);_0x19eeff(null);};}for(var e in events){if(events[_0x6dcf('0x7')](e)){var event=events[e];Plugin['hook'](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 b411243..15dd891 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 _0x31bb=['Plugin','plugins','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0x31bb,0x1e2));var _0xb31b=function(_0x37c3d7,_0x132d6d){_0x37c3d7=_0x37c3d7-0x0;var _0x365719=_0x31bb[_0x37c3d7];return _0x365719;};'use strict';var _=require('lodash');var util=require(_0xb31b('0x0'));var logger=require(_0xb31b('0x1'))(_0xb31b('0x2'));var moment=require(_0xb31b('0x3'));var BPromise=require(_0xb31b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb31b('0x5'));var config=require(_0xb31b('0x6'));var attributes=require(_0xb31b('0x7'));module[_0xb31b('0x8')]=function(_0x2b9c63,_0x1a0de2){return _0x2b9c63[_0xb31b('0x9')](_0xb31b('0xa'),attributes,{'tableName':_0xb31b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb84=['../../config/environment','exports','define','Plugin','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb84,0x122));var _0x4db8=function(_0x587efb,_0x4f976a){_0x587efb=_0x587efb-0x0;var _0x44c099=_0xdb84[_0x587efb];return _0x44c099;};'use strict';var _=require(_0x4db8('0x0'));var util=require(_0x4db8('0x1'));var logger=require(_0x4db8('0x2'))(_0x4db8('0x3'));var moment=require('moment');var BPromise=require(_0x4db8('0x4'));var rp=require(_0x4db8('0x5'));var fs=require('fs');var path=require(_0x4db8('0x6'));var rimraf=require('rimraf');var config=require(_0x4db8('0x7'));var attributes=require('./plugin.attributes');module[_0x4db8('0x8')]=function(_0x10603d,_0x13b7bc){return _0x10603d[_0x4db8('0x9')](_0x4db8('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index adcc79f..700af6e 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 _0x87ea=['message','info','result','CreatePlugin','Plugin','create','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xcc4d8,_0x5ac5d7){var _0x1d4234=function(_0x38862e){while(--_0x38862e){_0xcc4d8['push'](_0xcc4d8['shift']());}};_0x1d4234(++_0x5ac5d7);}(_0x87ea,0x1a0));var _0xa87e=function(_0x3d61c6,_0x4571e6){_0x3d61c6=_0x3d61c6-0x0;var _0x47e0df=_0x87ea[_0x3d61c6];return _0x47e0df;};'use strict';var _=require(_0xa87e('0x0'));var util=require(_0xa87e('0x1'));var moment=require('moment');var BPromise=require(_0xa87e('0x2'));var rs=require(_0xa87e('0x3'));var fs=require('fs');var Redis=require(_0xa87e('0x4'));var db=require(_0xa87e('0x5'))['db'];var utils=require(_0xa87e('0x6'));var logger=require(_0xa87e('0x7'))(_0xa87e('0x8'));var config=require(_0xa87e('0x9'));var jayson=require(_0xa87e('0xa'));var client=jayson[_0xa87e('0xb')][_0xa87e('0xc')]({'port':0x232a});config['redis']=_[_0xa87e('0xd')](config[_0xa87e('0xe')],{'host':_0xa87e('0xf'),'port':0x18eb});var socket=require(_0xa87e('0x10'))(new Redis(config[_0xa87e('0xe')]));require(_0xa87e('0x11'))[_0xa87e('0x12')](socket);function respondWithRpcPromise(_0x16b79e,_0x33e4f9,_0x57c16f){return new BPromise(function(_0x5183c0,_0x3777ac){return client[_0xa87e('0x13')](_0x16b79e,_0x57c16f)[_0xa87e('0x14')](function(_0x3171b3){logger['info'](_0xa87e('0x15'),_0x33e4f9,_0xa87e('0x16'));logger[_0xa87e('0x17')](_0xa87e('0x18'),_0x33e4f9,_0xa87e('0x16'),JSON[_0xa87e('0x19')](_0x3171b3));if(_0x3171b3[_0xa87e('0x1a')]){if(_0x3171b3[_0xa87e('0x1a')][_0xa87e('0x1b')]===0x1f4){logger[_0xa87e('0x1a')]('Plugin,\x20%s,\x20%s',_0x33e4f9,_0x3171b3[_0xa87e('0x1a')][_0xa87e('0x1c')]);return _0x3777ac(_0x3171b3[_0xa87e('0x1a')][_0xa87e('0x1c')]);}logger[_0xa87e('0x1a')](_0xa87e('0x15'),_0x33e4f9,_0x3171b3['error']['message']);return _0x5183c0(_0x3171b3[_0xa87e('0x1a')][_0xa87e('0x1c')]);}else{logger[_0xa87e('0x1d')](_0xa87e('0x15'),_0x33e4f9,_0xa87e('0x16'));_0x5183c0(_0x3171b3[_0xa87e('0x1e')]['message']);}})['catch'](function(_0x5909a6){logger[_0xa87e('0x1a')]('Plugin,\x20%s,\x20%s',_0x33e4f9,_0x5909a6);_0x3777ac(_0x5909a6);});});}exports[_0xa87e('0x1f')]=function(_0x443e12){var _0x29bef4=this;return new Promise(function(_0x58fa0,_0x26aa90){return db[_0xa87e('0x20')][_0xa87e('0x21')](_0x443e12['body'],{'raw':_0x443e12[_0xa87e('0x22')]?_0x443e12['options'][_0xa87e('0x23')]===undefined?!![]:![]:!![]})[_0xa87e('0x14')](function(_0x4e948c){logger[_0xa87e('0x1d')](_0xa87e('0x1f'),_0x443e12);logger[_0xa87e('0x17')](_0xa87e('0x1f'),_0x443e12,JSON[_0xa87e('0x19')](_0x4e948c));_0x58fa0(_0x4e948c);})[_0xa87e('0x24')](function(_0x311fb3){logger['error'](_0xa87e('0x1f'),_0x311fb3[_0xa87e('0x1c')],_0x443e12);_0x26aa90(_0x29bef4[_0xa87e('0x1a')](0x1f4,_0x311fb3[_0xa87e('0x1c')]));});});}; \ No newline at end of file +var _0xcac5=['register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./plugin.socket'];(function(_0x436b76,_0x44d2c7){var _0x3497bd=function(_0x48315a){while(--_0x48315a){_0x436b76['push'](_0x436b76['shift']());}};_0x3497bd(++_0x44d2c7);}(_0xcac5,0x1cc));var _0x5cac=function(_0x46fea1,_0x10490a){_0x46fea1=_0x46fea1-0x0;var _0x1130a7=_0xcac5[_0x46fea1];return _0x1130a7;};'use strict';var _=require(_0x5cac('0x0'));var util=require(_0x5cac('0x1'));var moment=require(_0x5cac('0x2'));var BPromise=require(_0x5cac('0x3'));var rs=require(_0x5cac('0x4'));var fs=require('fs');var Redis=require(_0x5cac('0x5'));var db=require(_0x5cac('0x6'))['db'];var utils=require(_0x5cac('0x7'));var logger=require(_0x5cac('0x8'))(_0x5cac('0x9'));var config=require(_0x5cac('0xa'));var jayson=require(_0x5cac('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x5cac('0xc')]=_['defaults'](config['redis'],{'host':_0x5cac('0xd'),'port':0x18eb});var socket=require(_0x5cac('0xe'))(new Redis(config[_0x5cac('0xc')]));require(_0x5cac('0xf'))[_0x5cac('0x10')](socket);function respondWithRpcPromise(_0x347db1,_0x36bd7a,_0x1138cb){return new BPromise(function(_0x38dd7f,_0x615eb3){return client['request'](_0x347db1,_0x1138cb)[_0x5cac('0x11')](function(_0x736606){logger['info'](_0x5cac('0x12'),_0x36bd7a,_0x5cac('0x13'));logger[_0x5cac('0x14')](_0x5cac('0x15'),_0x36bd7a,_0x5cac('0x13'),JSON[_0x5cac('0x16')](_0x736606));if(_0x736606[_0x5cac('0x17')]){if(_0x736606[_0x5cac('0x17')][_0x5cac('0x18')]===0x1f4){logger[_0x5cac('0x17')](_0x5cac('0x12'),_0x36bd7a,_0x736606[_0x5cac('0x17')][_0x5cac('0x19')]);return _0x615eb3(_0x736606['error'][_0x5cac('0x19')]);}logger[_0x5cac('0x17')](_0x5cac('0x12'),_0x36bd7a,_0x736606[_0x5cac('0x17')]['message']);return _0x38dd7f(_0x736606['error'][_0x5cac('0x19')]);}else{logger[_0x5cac('0x1a')](_0x5cac('0x12'),_0x36bd7a,_0x5cac('0x13'));_0x38dd7f(_0x736606[_0x5cac('0x1b')][_0x5cac('0x19')]);}})['catch'](function(_0x5a723d){logger[_0x5cac('0x17')]('Plugin,\x20%s,\x20%s',_0x36bd7a,_0x5a723d);_0x615eb3(_0x5a723d);});});}exports['CreatePlugin']=function(_0x29dcf8){var _0x271d0d=this;return new Promise(function(_0xbf8b1d,_0x222e02){return db[_0x5cac('0x1c')][_0x5cac('0x1d')](_0x29dcf8[_0x5cac('0x1e')],{'raw':_0x29dcf8[_0x5cac('0x1f')]?_0x29dcf8[_0x5cac('0x1f')][_0x5cac('0x20')]===undefined?!![]:![]:!![]})[_0x5cac('0x11')](function(_0x89bf6){logger['info']('CreatePlugin',_0x29dcf8);logger[_0x5cac('0x14')]('CreatePlugin',_0x29dcf8,JSON[_0x5cac('0x16')](_0x89bf6));_0xbf8b1d(_0x89bf6);})['catch'](function(_0x12bdf1){logger[_0x5cac('0x17')](_0x5cac('0x21'),_0x12bdf1[_0x5cac('0x19')],_0x29dcf8);_0x222e02(_0x271d0d[_0x5cac('0x17')](0x1f4,_0x12bdf1['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ef7f384..49df2b5 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 _0x8721=['length','plugin:','save','remove','register'];(function(_0x4ce3e7,_0xc7f15b){var _0x8f20e6=function(_0x16d60f){while(--_0x16d60f){_0x4ce3e7['push'](_0x4ce3e7['shift']());}};_0x8f20e6(++_0xc7f15b);}(_0x8721,0x179));var _0x1872=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x8721[_0x4b174a];return _0x3cd7bf;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x1872('0x0'),_0x1872('0x1'),'update'];function createListener(_0x317961,_0x3cd349){return function(_0x5bb101){_0x3cd349['emit'](_0x317961,_0x5bb101);};}function removeListener(_0x3788f1,_0x31c6ee){return function(){PluginEvents['removeListener'](_0x3788f1,_0x31c6ee);};}exports[_0x1872('0x2')]=function(_0xbfb1fa){for(var _0x167f9f=0x0,_0x54bc1a=events[_0x1872('0x3')];_0x167f9f<_0x54bc1a;_0x167f9f++){var _0x2bdaa=events[_0x167f9f];var _0x8f3412=createListener(_0x1872('0x4')+_0x2bdaa,_0xbfb1fa);PluginEvents['on'](_0x2bdaa,_0x8f3412);}}; \ No newline at end of file +var _0x01c0=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x416d06,_0x5e7532){var _0x25f7be=function(_0x3d608a){while(--_0x3d608a){_0x416d06['push'](_0x416d06['shift']());}};_0x25f7be(++_0x5e7532);}(_0x01c0,0xdd));var _0x001c=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x01c0[_0x28aea5];return _0x6a55f9;};'use strict';var PluginEvents=require(_0x001c('0x0'));var events=[_0x001c('0x1'),_0x001c('0x2'),_0x001c('0x3')];function createListener(_0x2ce55c,_0x61beb4){return function(_0x1cf76e){_0x61beb4[_0x001c('0x4')](_0x2ce55c,_0x1cf76e);};}function removeListener(_0x42a0d4,_0x12088c){return function(){PluginEvents[_0x001c('0x5')](_0x42a0d4,_0x12088c);};}exports[_0x001c('0x6')]=function(_0x395ceb){for(var _0x199463=0x0,_0x32b38c=events[_0x001c('0x7')];_0x199463<_0x32b38c;_0x199463++){var _0x83828e=events[_0x199463];var _0x155b14=createListener(_0x001c('0x8')+_0x83828e,_0x395ceb);PluginEvents['on'](_0x83828e,_0x155b14);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 5649a34..32096f5 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(_0x2c2070,_0xa7f1e9){var _0x2a66ea=function(_0x1632ab){while(--_0x1632ab){_0x2c2070['push'](_0x2c2070['shift']());}};_0x2a66ea(++_0xa7f1e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0xc2c29c,_0x2a17af){var _0xcb1793=function(_0x5cf048){while(--_0x5cf048){_0xc2c29c['push'](_0xc2c29c['shift']());}};_0xcb1793(++_0x2a17af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 dff3e9b..6182448 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 _0xd2ea=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x593e00,_0x141529){var _0x3719de=function(_0x1568fe){while(--_0x1568fe){_0x593e00['push'](_0x593e00['shift']());}};_0x3719de(++_0x141529);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5b5df1,_0x3864f3){_0x5b5df1=_0x5b5df1-0x0;var _0x264ace=_0xd2ea[_0x5b5df1];return _0x264ace;};'use strict';var _=require(_0xad2e('0x0'));var pm2=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var path=require(_0xad2e('0x4'));var exec=require('child_process')[_0xad2e('0x5')];var BPromise=require(_0xad2e('0x6'));function handleEntityNotFound(_0xcba7cb,_0x3e0741){return function(_0x2afdc4){if(!_0x2afdc4){_0xcba7cb[_0xad2e('0x7')](0x194);;}return _0x2afdc4;};}function respondWithResult(_0x29e97f,_0x592e8b){_0x592e8b=_0x592e8b||0xc8;return function(_0x3b5170){if(_0x3b5170){return _0x29e97f[_0xad2e('0x8')](_0x592e8b)[_0xad2e('0x9')](_0x3b5170);}return null;};}function handleError(_0x5710ac,_0x1e0e9e){_0x1e0e9e=_0x1e0e9e||0x1f4;return function(_0x19bb0d){logger['error'](_0x19bb0d[_0xad2e('0xa')]);if(_0x19bb0d['name']){delete _0x19bb0d[_0xad2e('0xb')];}_0x5710ac[_0xad2e('0x8')](_0x1e0e9e)[_0xad2e('0xc')](_0x19bb0d);};}function execChildProcess(){return new BPromise(function(_0x24c5da,_0x489f25){exec(_0xad2e('0xd'),function(_0x5707a5,_0x42d2ac,_0x347559){logger[_0xad2e('0xe')](_0x42d2ac);logger[_0xad2e('0xe')](_0x347559);if(_0x5707a5){logger['error'](_0x5707a5);return _0x489f25(_0x5707a5);}return _0x24c5da(_0x42d2ac);});});}exports[_0xad2e('0xf')]=function(_0x59201f,_0x1a91ce){return pm2['list']()['then'](function(_0x4a812b){if(_0x4a812b){var _0x5c96a7=_[_0xad2e('0x10')](_0x4a812b,function(_0x282780){return _0x282780[_0xad2e('0xb')]===_0xad2e('0x11')||_0x282780[_0xad2e('0xb')]===_0xad2e('0x12');});return{'rows':_0x5c96a7,'count':_0x5c96a7[_0xad2e('0x13')]};}return null;})[_0xad2e('0x14')](respondWithResult(_0x1a91ce,null))[_0xad2e('0x15')](handleError(_0x1a91ce,null));};exports[_0xad2e('0x16')]=function(_0x2af208,_0x39c5e4){return pm2[_0xad2e('0x17')](_0x2af208[_0xad2e('0x18')]['id'])[_0xad2e('0x14')](respondWithResult(_0x39c5e4,null))['then'](handleEntityNotFound(_0x39c5e4,null))[_0xad2e('0x15')](handleError(_0x39c5e4,null));};exports[_0xad2e('0x19')]=function(_0x489585,_0x50eb1a){if(_0x489585['body']['name']&&_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]){var _0x5549db=path[_0xad2e('0x1c')](__dirname,_0xad2e('0x1d'),_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]);var _0x23c0b6=process[_0xad2e('0x1e')]();process[_0xad2e('0x1f')](path[_0xad2e('0x20')](_0x5549db));return execChildProcess()[_0xad2e('0x14')](function(_0xd907a9){process[_0xad2e('0x1f')](_0x23c0b6);return pm2[_0xad2e('0x21')]({'name':_0x489585[_0xad2e('0x1a')]['name'],'script':_0x5549db});})[_0xad2e('0x14')](function(_0x2e8887){pm2[_0xad2e('0x22')]();return _0x2e8887[0x0];})[_0xad2e('0x14')](respondWithResult(_0x50eb1a,0xc9))[_0xad2e('0x15')](handleError(_0x50eb1a,null));}else{return _0x50eb1a[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x23')});}};exports[_0xad2e('0x24')]=function(_0x50d446,_0x356a19){if(_0x50d446['body']['id']){delete _0x50d446[_0xad2e('0x1a')]['id'];}var _0x28ef72={'online':_0xad2e('0x25'),'stopped':_0xad2e('0x26')};if(_0x28ef72[_0xad2e('0x27')](_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')])){return pm2[_0x28ef72[_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')]]](_0x50d446[_0xad2e('0x18')]['id'])['then'](respondWithResult(_0x356a19,0xc8))[_0xad2e('0x15')](handleError(_0x356a19,null));}else{return _0x356a19[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x28')});}};exports[_0xad2e('0x29')]=function(_0x9b4a23,_0x409f58){if(_0x9b4a23[_0xad2e('0x1a')]['id']){delete _0x9b4a23[_0xad2e('0x1a')]['id'];}if(_0x9b4a23[_0xad2e('0x18')]['id']){return pm2[_0xad2e('0x2a')](_0x9b4a23['params']['id'])[_0xad2e('0x14')](function(_0x55e1dc){pm2[_0xad2e('0x22')]();return _0x55e1dc[0x0];})[_0xad2e('0x14')](respondWithResult(_0x409f58,null))[_0xad2e('0x15')](handleError(_0x409f58,null));}else{return _0x409f58[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x4fdb=['lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dump','restart','stop','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id'];(function(_0x3a2689,_0x1ec923){var _0x1327d1=function(_0x194689){while(--_0x194689){_0x3a2689['push'](_0x3a2689['shift']());}};_0x1327d1(++_0x1ec923);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1e3328,_0x398856){_0x1e3328=_0x1e3328-0x0;var _0x594e6f=_0x4fdb[_0x1e3328];return _0x594e6f;};'use strict';var _=require(_0xb4fd('0x0'));var pm2=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var path=require(_0xb4fd('0x4'));var exec=require(_0xb4fd('0x5'))[_0xb4fd('0x6')];var BPromise=require(_0xb4fd('0x7'));function handleEntityNotFound(_0x1c0b08,_0x5b73bb){return function(_0x308de6){if(!_0x308de6){_0x1c0b08['sendStatus'](0x194);;}return _0x308de6;};}function respondWithResult(_0x14052b,_0x5d8b39){_0x5d8b39=_0x5d8b39||0xc8;return function(_0x53273f){if(_0x53273f){return _0x14052b[_0xb4fd('0x8')](_0x5d8b39)[_0xb4fd('0x9')](_0x53273f);}return null;};}function handleError(_0x1151b5,_0x52dca2){_0x52dca2=_0x52dca2||0x1f4;return function(_0x526d3b){logger[_0xb4fd('0xa')](_0x526d3b[_0xb4fd('0xb')]);if(_0x526d3b[_0xb4fd('0xc')]){delete _0x526d3b['name'];}_0x1151b5[_0xb4fd('0x8')](_0x52dca2)[_0xb4fd('0xd')](_0x526d3b);};}function execChildProcess(){return new BPromise(function(_0x2148db,_0x23b08f){exec(_0xb4fd('0xe'),function(_0x502379,_0xd05458,_0x1f3e30){logger[_0xb4fd('0xf')](_0xd05458);logger[_0xb4fd('0xf')](_0x1f3e30);if(_0x502379){logger['error'](_0x502379);return _0x23b08f(_0x502379);}return _0x2148db(_0xd05458);});});}exports[_0xb4fd('0x10')]=function(_0x65f08a,_0x345d35){return pm2['list']()[_0xb4fd('0x11')](function(_0x1234d7){if(_0x1234d7){var _0xc35d8d=_[_0xb4fd('0x12')](_0x1234d7,function(_0x36e88f){return _0x36e88f[_0xb4fd('0xc')]===_0xb4fd('0x13')||_0x36e88f['name']===_0xb4fd('0x14');});return{'rows':_0xc35d8d,'count':_0xc35d8d[_0xb4fd('0x15')]};}return null;})[_0xb4fd('0x11')](respondWithResult(_0x345d35,null))[_0xb4fd('0x16')](handleError(_0x345d35,null));};exports[_0xb4fd('0x17')]=function(_0x137e51,_0x1d0812){return pm2[_0xb4fd('0x18')](_0x137e51[_0xb4fd('0x19')]['id'])[_0xb4fd('0x11')](respondWithResult(_0x1d0812,null))[_0xb4fd('0x11')](handleEntityNotFound(_0x1d0812,null))['catch'](handleError(_0x1d0812,null));};exports['create']=function(_0x504e80,_0x5c14c0){if(_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')]&&_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0x1b')]){var _0x458133=path[_0xb4fd('0x1c')](__dirname,_0xb4fd('0x1d'),_0x504e80['body']['script']);var _0x216307=process[_0xb4fd('0x1e')]();process[_0xb4fd('0x1f')](path['dirname'](_0x458133));return execChildProcess()[_0xb4fd('0x11')](function(_0x49d42c){process[_0xb4fd('0x1f')](_0x216307);return pm2['start']({'name':_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')],'script':_0x458133});})[_0xb4fd('0x11')](function(_0x261eda){pm2[_0xb4fd('0x20')]();return _0x261eda[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x5c14c0,0xc9))[_0xb4fd('0x16')](handleError(_0x5c14c0,null));}else{return _0x5c14c0[_0xb4fd('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x453982,_0x4bad85){if(_0x453982[_0xb4fd('0x1a')]['id']){delete _0x453982['body']['id'];}var _0x5738c2={'online':_0xb4fd('0x21'),'stopped':_0xb4fd('0x22')};if(_0x5738c2[_0xb4fd('0x23')](_0x453982['body'][_0xb4fd('0x8')])){return pm2[_0x5738c2[_0x453982[_0xb4fd('0x1a')][_0xb4fd('0x8')]]](_0x453982[_0xb4fd('0x19')]['id'])['then'](respondWithResult(_0x4bad85,0xc8))[_0xb4fd('0x16')](handleError(_0x4bad85,null));}else{return _0x4bad85[_0xb4fd('0x8')](0x1f4)['send']({'message':_0xb4fd('0x24')});}};exports[_0xb4fd('0x25')]=function(_0xbe7d2c,_0x597874){if(_0xbe7d2c[_0xb4fd('0x1a')]['id']){delete _0xbe7d2c[_0xb4fd('0x1a')]['id'];}if(_0xbe7d2c[_0xb4fd('0x19')]['id']){return pm2['delete'](_0xbe7d2c['params']['id'])['then'](function(_0x5f36e4){pm2[_0xb4fd('0x20')]();return _0x5f36e4[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x597874,null))[_0xb4fd('0x16')](handleError(_0x597874,null));}else{return _0x597874[_0xb4fd('0x8')](0x1f4)[_0xb4fd('0xd')]({'message':_0xb4fd('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 39c3039..715aa48 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 _0x458d=['/queues','exports','express','Router','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x1956aa,_0x549112){var _0x1b2c87=function(_0x5842ff){while(--_0x5842ff){_0x1956aa['push'](_0x1956aa['shift']());}};_0x1b2c87(++_0x549112);}(_0x458d,0x172));var _0xd458=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x458d[_0x5f3f88];return _0xd08119;};'use strict';var express=require(_0xd458('0x0'));var router=express[_0xd458('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd458('0x2'));router[_0xd458('0x3')](_0xd458('0x4'),auth[_0xd458('0x5')](),controller['getAgents']);router[_0xd458('0x3')](_0xd458('0x6'),auth['isAuthenticated'](),controller['getQueues']);module[_0xd458('0x7')]=router; \ No newline at end of file +var _0xed8e=['/queues','exports','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x7239de,_0x2e89e3){var _0x525280=function(_0x4d1701){while(--_0x4d1701){_0x7239de['push'](_0x7239de['shift']());}};_0x525280(++_0x2e89e3);}(_0xed8e,0x14a));var _0xeed8=function(_0x2441b0,_0x2e1a34){_0x2441b0=_0x2441b0-0x0;var _0x3ed283=_0xed8e[_0x2441b0];return _0x3ed283;};'use strict';var express=require('express');var router=express[_0xeed8('0x0')]();var auth=require(_0xeed8('0x1'));var controller=require('./realtime.controller');router[_0xeed8('0x2')](_0xeed8('0x3'),auth[_0xeed8('0x4')](),controller[_0xeed8('0x5')]);router['get'](_0xeed8('0x6'),auth[_0xeed8('0x4')](),controller['getQueues']);module[_0xeed8('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index cca65e5..80ee10a 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 _0x2eb2=['voice','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','agents','loggedInDb','waiting','talking','busy','merge','pick','filter','queue','length','connectedlinenum','internal','toString','find','getMembers','UserId','accountcode','online','voiceStatus','User','startCase','Pause','unknown','chatPause','faxPause','openchannelPause','voicePause','whatsappPause','every','idle','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','getAgents','lastLoginAt','lastPauseAt','pauseType','address','mailPause','smsPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','openchannelStatusTime','mailStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','type','query','role','getOptions','raw','user','agent','nolimit','sort','UserProfile','findAndCountAll','rows','omit','globalStatus','pauseTypeFilter','getQueues','mail','fax','whatsapp','Invalid\x20channel','key','Queues','getResources','all','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','set','Content-Range','error','stack','name','status','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2eb2,0x19f));var _0x22eb=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x2eb2[_0x54d4fe];return _0x1ab5bb;};'use strict';var util=require('util');var _=require(_0x22eb('0x0'));var jayson=require(_0x22eb('0x1'));var qs=require(_0x22eb('0x2'));var logger=require(_0x22eb('0x3'))(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var amiClient=jayson['client'][_0x22eb('0x6')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x1dfef7,_0x10e116){return function(_0x35dd5b){if(_0x35dd5b){var _0x2a9850=typeof _0x10e116[_0x22eb('0x7')]===_0x22eb('0x8')&&typeof _0x10e116[_0x22eb('0x9')]===_0x22eb('0x8');var _0x419601=_0x35dd5b[_0x22eb('0xa')];var _0xb9c8a4=_0x2a9850?0x0:_0x10e116[_0x22eb('0x7')];var _0x489260=_0x2a9850?_0x35dd5b[_0x22eb('0xa')]:_0x10e116['offset']+_0x10e116['limit'];var _0x1aa348;if(_0x489260>=_0x419601){_0x489260=_0x419601;_0x1aa348=0xc8;}else{_0x1aa348=0xce;}_0x1dfef7['status'](_0x1aa348);return _0x1dfef7[_0x22eb('0xb')](_0x22eb('0xc'),_0xb9c8a4+'-'+_0x489260+'/'+_0x419601)['json'](_0x35dd5b);}return null;};}function handleError(_0x5068ea,_0x1f286c){_0x1f286c=_0x1f286c||0x1f4;return function(_0x189f05){logger[_0x22eb('0xd')](_0x189f05[_0x22eb('0xe')]);if(_0x189f05[_0x22eb('0xf')]){delete _0x189f05['name'];}_0x5068ea[_0x22eb('0x10')](_0x1f286c)['send'](_0x189f05);};}function getRealtimeAgents(){return new Promise(function(_0x1f5089,_0x55ede8){return amiClient[_0x22eb('0x11')](_0x22eb('0x12'),{})['then'](function(_0x48b63c){if(_0x48b63c['error'])throw new Error(_0x22eb('0x13'));var _0x5245fe=_0x48b63c['result'];return routingClient[_0x22eb('0x11')]('Agents',{})['then'](function(_0xb7a73a){if(_0xb7a73a[_0x22eb('0xd')])throw new Error(_0x22eb('0x14'));var _0x1ff041=_0xb7a73a[_0x22eb('0x15')];return _0x1f5089(_['merge']({},_0x5245fe,_0x1ff041));});})[_0x22eb('0x16')](function(_0x12bbd1){_0x55ede8(_0x12bbd1);});});}function getRealtimeQueues(_0x10d182,_0x410c25){return new Promise(function(_0x36be50,_0x517313){var _0x2eb115=_0x410c25===_0x22eb('0x17')?amiClient:routingClient;return _0x2eb115[_0x22eb('0x11')](_['startCase'](_0x410c25)+'Queues',_0x10d182)[_0x22eb('0x18')](function(_0x267d97){if(_0x267d97[_0x22eb('0xd')])throw new Error(util[_0x22eb('0x19')](_0x22eb('0x1a'),_0x410c25));return _0x36be50(_0x267d97[_0x22eb('0x15')]);})[_0x22eb('0x16')](function(_0x4e7e69){_0x517313(_0x4e7e69);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2e8f7c,_0x11edbd){return amiClient[_0x22eb('0x11')](_0x22eb('0x1b'),{})[_0x22eb('0x18')](function(_0x4da252){if(_0x4da252[_0x22eb('0xd')])throw new Error(_0x22eb('0x1c'));return _0x2e8f7c(_0x4da252[_0x22eb('0x15')]);})['catch'](function(_0xe0783c){_0x11edbd(_0xe0783c);});});}function initializeQueues(_0x259847,_0x4b409a,_0x32a4b6,_0x222ef3){var _0x1e3015=[_0x22eb('0x1d'),_0x22eb('0x1e'),'waiting','talking',_0x22eb('0x1f')];if(_0x32a4b6===_0x22eb('0x17')&&_0x222ef3===_0x22eb('0x20')){_0x1e3015[_0x22eb('0x21')](_0x22eb('0x22'),_0x22eb('0x23'),_0x22eb('0x24'),_0x22eb('0x25'),_0x22eb('0x26'),_0x22eb('0x27'),_0x22eb('0x28'),_0x22eb('0x29'),'erlangCalls',_0x22eb('0x2a'),'erlangAbandonmentRate',_0x22eb('0x2b'),_0x22eb('0x2c'),_0x22eb('0x2d'),_0x22eb('0x2e'),_0x22eb('0x2f'),_0x22eb('0x30'),_0x22eb('0x31'),_0x22eb('0x32'),_0x22eb('0x33'),_0x22eb('0x34'),'predictiveIntervalAvgTalktime');}return _0x259847['map'](function(_0x239a41){var _0x5ceec1=_0x239a41['get']({'plain':!![]});_0x5ceec1[_0x22eb('0x35')]=[];_0x5ceec1[_0x22eb('0x1f')]=0x0;_0x5ceec1[_0x22eb('0x36')]=0x0;_0x5ceec1[_0x22eb('0x1d')]=0x0;_0x5ceec1[_0x22eb('0x1e')]=0x0;_0x5ceec1[_0x22eb('0x37')]=0x0;if(_0x32a4b6===_0x22eb('0x17')){_0x5ceec1[_0x22eb('0x38')]=0x0;_0x5ceec1[_0x22eb('0x39')]=0x0;if(_0x222ef3===_0x22eb('0x20')){_0x5ceec1['pTalking']=0x0;_0x5ceec1[_0x22eb('0x23')]=0x0;}}var _0x47be01=_['find'](_0x4b409a,['id',_0x5ceec1['id']]);if(_0x47be01)_[_0x22eb('0x3a')](_0x5ceec1,_[_0x22eb('0x3b')](_0x47be01,_0x1e3015));return _0x5ceec1;});}function updateAgentVoiceStatus(_0x48e47e,_0x42e9bd,_0x121c04){var _0x236def=_[_0x22eb('0x3c')](_0x121c04,[_0x22eb('0x3d'),_0x42e9bd['name']]);if(_0x236def[_0x22eb('0x3e')]===0x0)return _0x48e47e[_0x22eb('0x39')]=!![];if(_['some'](_0x236def,[_0x22eb('0x3f'),_0x48e47e[_0x22eb('0x40')][_0x22eb('0x41')]()]))return _0x48e47e[_0x22eb('0x38')]=!![];if(!_0x48e47e[_0x22eb('0x38')])return _0x48e47e['busy']=!![];}function getVoiceQueueAgents(_0x51c8b5,_0x2b1ae1,_0x6cd651,_0x541153){var _0x595d76=_[_0x22eb('0x42')](_0x2b1ae1,['id',_0x51c8b5['id']]);if(!_0x595d76)return _0x51c8b5;return _0x595d76[_0x22eb('0x43')]({'raw':!![]})['then'](function(_0x1d977c){for(var _0x3377eb=0x0;_0x3377eb<_0x1d977c[_0x22eb('0x3e')];_0x3377eb++){var _0x2a8517=_[_0x22eb('0x42')](_0x6cd651,['id',_0x1d977c[_0x3377eb][_0x22eb('0x44')]]);if(!_0x2a8517){_0x2a8517={'id':_0x1d977c[_0x3377eb]['UserId'],'name':_0x1d977c[_0x3377eb][_0x22eb('0x44')],'accountcode':'','online':![]};}var _0x3d2d1d={'id':_0x2a8517['id'],'name':_0x2a8517['name'],'internal':_0x2a8517[_0x22eb('0x45')],'online':Boolean(_0x2a8517[_0x22eb('0x46')]),'paused':Boolean(_0x1d977c[_0x3377eb][_0x22eb('0x1f')])};if(_0x2a8517[_0x22eb('0x47')]===_0x22eb('0x38'))updateAgentVoiceStatus(_0x3d2d1d,_0x51c8b5,_0x541153);if(_0x3d2d1d[_0x22eb('0x46')])_0x51c8b5[_0x22eb('0x36')]++;if(_0x3d2d1d[_0x22eb('0x39')])_0x51c8b5[_0x22eb('0x39')]++;if(_0x3d2d1d[_0x22eb('0x1f')]&&!_0x3d2d1d[_0x22eb('0x39')]&&!_0x3d2d1d[_0x22eb('0x38')])_0x51c8b5[_0x22eb('0x1f')]++;_0x51c8b5[_0x22eb('0x35')][_0x22eb('0x21')](_0x3d2d1d);}return _0x51c8b5;});}function getQueueAgents(_0x471657,_0x6996b4,_0x46e3ec){var _0x507f21=_0x22eb('0x48')+_[_0x22eb('0x49')](_0x46e3ec)+'Queue';var _0x10462d=_0x46e3ec+_0x22eb('0x4a');return db[_0x507f21]['findAll']({'where':{[_['startCase'](_0x46e3ec)+'QueueId']:_0x471657['id']},'raw':!![]})[_0x22eb('0x18')](function(_0x1efc65){for(var _0x4e4c6d=0x0;_0x4e4c6d<_0x1efc65['length'];_0x4e4c6d++){var _0xa7c642=_[_0x22eb('0x42')](_0x6996b4,['id',_0x1efc65[_0x4e4c6d][_0x22eb('0x44')]]);if(!_0xa7c642){_0xa7c642={'id':_0x1efc65[_0x4e4c6d][_0x22eb('0x44')],'name':_0x1efc65[_0x4e4c6d][_0x22eb('0x44')],'online':![],['pauseField']:![]};}var _0x3b30a3={'id':_0xa7c642['id'],'name':_0xa7c642[_0x22eb('0xf')],'online':Boolean(_0xa7c642[_0x22eb('0x46')]),'paused':Boolean(_0xa7c642[_0x10462d])};if(_0x3b30a3['online'])_0x471657['loggedInDb']++;_0x471657[_0x22eb('0x35')]['push'](_0x3b30a3);}return _0x471657;});}function isIdle(_0x5e695c){return _0x5e695c==='idle'||_0x5e695c===_0x22eb('0x4b')||_0x5e695c==='unavailable'||_0x5e695c==='ringing'||_['isNil'](_0x5e695c);}function isAgentPaused(_0x517784,_0x36b174){var _0x4b5c03=[_0x517784[_0x22eb('0x4c')],_0x517784[_0x22eb('0x4d')],_0x517784['mailPause'],_0x517784[_0x22eb('0x4e')],_0x517784['smsPause'],_0x517784[_0x22eb('0x4f')],_0x517784[_0x22eb('0x50')]];if(!_0x36b174)return _[_0x22eb('0x51')](_0x4b5c03);var _0x111cbe=_[_0x22eb('0x3c')](_0x4b5c03);return _0x111cbe[_0x22eb('0x3e')]>0x0&&_0x111cbe[_0x22eb('0x3e')]<_0x4b5c03[_0x22eb('0x3e')]?!![]:![];}function isAgentIdle(_0x11942d){if(_0x11942d['voiceStatus']!==_0x22eb('0x52')&&_0x11942d[_0x22eb('0x4f')]){_0x11942d['voiceStatus']=_0x22eb('0x53');return![];}return _[_0x22eb('0x51')]([_0x11942d[_0x22eb('0x54')],_0x11942d[_0x22eb('0x55')],_0x11942d['mailStatus'],_0x11942d[_0x22eb('0x56')],_0x11942d[_0x22eb('0x57')],_0x11942d[_0x22eb('0x47')],_0x11942d[_0x22eb('0x58')]],isIdle);}function getAgentStatus(_0x447177){var _0x10393b='unknown';if(isAgentPaused(_0x447177))_0x10393b=_0x22eb('0x53');else if(isAgentPaused(_0x447177,!![]))_0x10393b='*pause';else if(isAgentIdle(_0x447177))_0x10393b=_0x22eb('0x52');else _0x10393b='busy';return _0x10393b;}exports[_0x22eb('0x59')]=function(_0x254b53,_0x4028ef){var _0x2c1b87={'count':0x0,'rows':[]},_0x3f03df={},_0x4aa0c5,_0x4896ed,_0xfbf2e7=['userpic',_0x22eb('0x46'),_0x22eb('0x5a'),_0x22eb('0x5b'),_0x22eb('0x5c'),_0x22eb('0x5b'),_0x22eb('0x40'),_0x22eb('0x5d'),_0x22eb('0x4c'),_0x22eb('0x4e'),_0x22eb('0x5e'),_0x22eb('0x5f'),'whatsappPause',_0x22eb('0x4d'),_0x22eb('0x4f'),_0x22eb('0x60'),_0x22eb('0x61'),_0x22eb('0x62'),_0x22eb('0x63'),_0x22eb('0x64'),_0x22eb('0x65'),_0x22eb('0x66'),_0x22eb('0x67'),_0x22eb('0x68'),_0x22eb('0x69'),_0x22eb('0x6a'),_0x22eb('0x6b'),'chatStatus','openchannelStatus',_0x22eb('0x6c'),_0x22eb('0x57'),_0x22eb('0x58'),_0x22eb('0x55'),_0x22eb('0x47'),'chatStatusTime',_0x22eb('0x6d'),_0x22eb('0x6e'),'smsStatusTime','whatsappStatusTime',_0x22eb('0x6f'),_0x22eb('0x70'),_0x22eb('0x3d'),_0x22eb('0x71'),_0x22eb('0x72'),_0x22eb('0x73'),_0x22eb('0x74'),_0x22eb('0x75')],_0x8e3864=[_0x22eb('0x4c'),_0x22eb('0x4e'),_0x22eb('0x5e'),_0x22eb('0x5f'),_0x22eb('0x50'),_0x22eb('0x4d'),'voicePause',_0x22eb('0x46')];Promise[_0x22eb('0x76')]()[_0x22eb('0x18')](function(){var _0x5dbc43=_[_0x22eb('0x77')](db['User'][_0x22eb('0x78')],function(_0x5347b4){return{'name':_0x5347b4[_0x22eb('0x79')],'type':_0x5347b4[_0x22eb('0x7a')]['key']};});_0x254b53[_0x22eb('0x7b')][_0x22eb('0x7c')]='agent';_0x254b53['query'][_0x22eb('0x46')]=!![];_0x3f03df=qs[_0x22eb('0x7d')](_0x5dbc43,_0x254b53);_0x3f03df[_0x22eb('0x7e')]=!![];if(_0x254b53[_0x22eb('0x7f')][_0x22eb('0x7c')]===_0x22eb('0x7f')){var _0x4f5eee={'params':{'id':_0x254b53[_0x22eb('0x7f')]['userProfileId']},'query':{'section':'Agents','role':_0x22eb('0x80'),'online':!![],'nolimit':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x81')],'sort':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x82')],'filter':_0x254b53[_0x22eb('0x7b')][_0x22eb('0x3c')],'raw':!![]}};return db[_0x22eb('0x83')]['getResources'](_0x4f5eee);}return db['User'][_0x22eb('0x84')](_0x3f03df);})[_0x22eb('0x18')](function(_0x49f182){_0x2c1b87[_0x22eb('0xa')]=_0x49f182[_0x22eb('0xa')];_0x4aa0c5=_0x49f182[_0x22eb('0x85')];return getRealtimeAgents();})[_0x22eb('0x18')](function(_0x40faf6){_0x4896ed=_0x40faf6[_0x22eb('0x85')];return _0x4aa0c5['map'](function(_0x3dd49b){var _0x29d4a7=_[_0x22eb('0x42')](_0x4896ed,['id',_0x3dd49b['id']]);if(_0x29d4a7)_['merge'](_0x3dd49b,_['pick'](_[_0x22eb('0x86')](_0x29d4a7,_0x8e3864),_0xfbf2e7));_0x3dd49b[_0x22eb('0x87')]=getAgentStatus(_0x3dd49b);return _0x3dd49b;});})[_0x22eb('0x18')](function(_0x5ebeb5){if(_0x254b53[_0x22eb('0x7b')]['globalStatusFilter']){var _0x1a305d=_[_0x22eb('0x3c')](_0x5ebeb5,[_0x22eb('0x87'),_0x254b53[_0x22eb('0x7b')]['globalStatusFilter']]);if(_0x254b53[_0x22eb('0x7b')][_0x22eb('0x88')]){_0x1a305d=_[_0x22eb('0x3c')](_0x1a305d,[_0x22eb('0x5c'),_0x254b53[_0x22eb('0x7b')][_0x22eb('0x88')]]);}}_0x2c1b87[_0x22eb('0x85')]=_0x1a305d||_0x5ebeb5;return _0x2c1b87;})[_0x22eb('0x18')](respondWithFilteredResult(_0x4028ef,_0x3f03df))[_0x22eb('0x16')](handleError(_0x4028ef,null));};exports[_0x22eb('0x89')]=function(_0x14006f,_0x5b4e6a){var _0x1d0749=[_0x22eb('0x8a'),'chat','sms','openchannel',_0x22eb('0x8b'),_0x22eb('0x8c'),'voice'];var _0x10726f={'count':0x0,'rows':[]},_0x15e08a={},_0xe6e71d,_0x41c50e,_0x8cbc83,_0x4ab4f8,_0x5e01b5;Promise[_0x22eb('0x76')]()[_0x22eb('0x18')](function(){if(_0x14006f[_0x22eb('0x7b')]['channel']){if(!_['includes'](_0x1d0749,_0x14006f[_0x22eb('0x7b')]['channel']['toLowerCase']()))throw new Error(_0x22eb('0x8d'));_0xe6e71d=_0x14006f[_0x22eb('0x7b')]['channel']['toLowerCase']();}var _0x1e393a=_[_0x22eb('0x49')](_0xe6e71d)+'Queue';var _0x17f51b=_[_0x22eb('0x77')](db[_0x1e393a][_0x22eb('0x78')],function(_0x5823d0){return{'name':_0x5823d0[_0x22eb('0x79')],'type':_0x5823d0[_0x22eb('0x7a')][_0x22eb('0x8e')]};});_0x15e08a=qs[_0x22eb('0x7d')](_0x17f51b,_0x14006f);if(_0x14006f[_0x22eb('0x7f')]['role']===_0x22eb('0x7f')){var _0x2ecc24={'params':{'id':_0x14006f[_0x22eb('0x7f')]['userProfileId']},'query':{'section':_0xe6e71d==='voice'&&_0x14006f[_0x22eb('0x7b')][_0x22eb('0x7a')]===_0x22eb('0x20')?'QueueCampaigns':_[_0x22eb('0x49')](_0xe6e71d)+_0x22eb('0x8f'),'type':_0x14006f[_0x22eb('0x7b')]['type'],'nolimit':!![],'sort':_0x22eb('0xf'),'filter':_0x14006f['query']['filter']}};return db[_0x22eb('0x83')][_0x22eb('0x90')](_0x2ecc24);}return db[_0x1e393a][_0x22eb('0x84')](_0x15e08a);})['then'](function(_0x3fc402){_0x10726f[_0x22eb('0xa')]=_0x3fc402[_0x22eb('0xa')];_0x41c50e=_0x3fc402[_0x22eb('0x85')];return getRealtimeQueues(_0x14006f,_0xe6e71d);})[_0x22eb('0x18')](function(_0x545c0a){_0x4ab4f8=_0x545c0a[_0x22eb('0x85')];return getRealtimeAgents();})['then'](function(_0x36dde2){_0x8cbc83=_0x36dde2[_0x22eb('0x85')];if(_0xe6e71d!=_0x22eb('0x17'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0xe19621){_0x5e01b5=_0xe19621?_0xe19621[_0x22eb('0x85')]:[];return initializeQueues(_0x41c50e,_0x4ab4f8,_0xe6e71d,_0x14006f[_0x22eb('0x7b')][_0x22eb('0x7a')]);})[_0x22eb('0x18')](function(_0xeaf655){var _0x45b691=_0xeaf655[_0x22eb('0x77')](function(_0x1ef974){if(_0xe6e71d===_0x22eb('0x17'))return getVoiceQueueAgents(_0x1ef974,_0x41c50e,_0x8cbc83,_0x5e01b5);else return getQueueAgents(_0x1ef974,_0x8cbc83,_0xe6e71d);});return Promise[_0x22eb('0x91')](_0x45b691);})['then'](function(_0x30e721){_0x10726f[_0x22eb('0x85')]=_0x30e721;return _0x10726f;})[_0x22eb('0x18')](respondWithFilteredResult(_0x5b4e6a,_0x15e08a))[_0x22eb('0x16')](handleError(_0x5b4e6a,null));}; \ No newline at end of file +var _0x2a07=['loggedIn','available','waiting','talking','paused','outbound','push','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','busy','find','pick','filter','queue','some','connectedlinenum','internal','toString','length','UserId','accountcode','online','voiceStatus','User','Queue','Pause','findAll','idle','unknown','unavailable','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','pause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','*pause','getAgents','userpic','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','rawAttributes','fieldName','query','agent','getOptions','user','role','nolimit','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','type','key','userProfileId','QueueCampaigns','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x2a07,0x74));var _0x72a0=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x2a07[_0x77773a];return _0x1091a2;};'use strict';var util=require(_0x72a0('0x0'));var _=require(_0x72a0('0x1'));var jayson=require(_0x72a0('0x2'));var qs=require(_0x72a0('0x3'));var logger=require(_0x72a0('0x4'))('api');var db=require(_0x72a0('0x5'))['db'];var amiClient=jayson[_0x72a0('0x6')][_0x72a0('0x7')]({'port':0x232a});var routingClient=jayson[_0x72a0('0x6')][_0x72a0('0x7')]({'port':0x232c});function respondWithFilteredResult(_0xce74c,_0x3ccf6d){return function(_0x20dab9){if(_0x20dab9){var _0x193e3b=typeof _0x3ccf6d[_0x72a0('0x8')]===_0x72a0('0x9')&&typeof _0x3ccf6d[_0x72a0('0xa')]===_0x72a0('0x9');var _0x1d32e9=_0x20dab9[_0x72a0('0xb')];var _0x2bc45b=_0x193e3b?0x0:_0x3ccf6d['offset'];var _0x169dc2=_0x193e3b?_0x20dab9[_0x72a0('0xb')]:_0x3ccf6d['offset']+_0x3ccf6d[_0x72a0('0xa')];var _0x194488;if(_0x169dc2>=_0x1d32e9){_0x169dc2=_0x1d32e9;_0x194488=0xc8;}else{_0x194488=0xce;}_0xce74c[_0x72a0('0xc')](_0x194488);return _0xce74c[_0x72a0('0xd')](_0x72a0('0xe'),_0x2bc45b+'-'+_0x169dc2+'/'+_0x1d32e9)['json'](_0x20dab9);}return null;};}function handleError(_0x130797,_0x335b9f){_0x335b9f=_0x335b9f||0x1f4;return function(_0x123ca4){logger[_0x72a0('0xf')](_0x123ca4[_0x72a0('0x10')]);if(_0x123ca4[_0x72a0('0x11')]){delete _0x123ca4[_0x72a0('0x11')];}_0x130797['status'](_0x335b9f)['send'](_0x123ca4);};}function getRealtimeAgents(){return new Promise(function(_0xe103dc,_0x3cd89f){return amiClient[_0x72a0('0x12')](_0x72a0('0x13'),{})[_0x72a0('0x14')](function(_0x3f3d62){if(_0x3f3d62['error'])throw new Error(_0x72a0('0x15'));var _0x2e7552=_0x3f3d62[_0x72a0('0x16')];return routingClient[_0x72a0('0x12')](_0x72a0('0x13'),{})['then'](function(_0x100d8f){if(_0x100d8f[_0x72a0('0xf')])throw new Error(_0x72a0('0x17'));var _0x5b63c8=_0x100d8f[_0x72a0('0x16')];return _0xe103dc(_[_0x72a0('0x18')]({},_0x2e7552,_0x5b63c8));});})[_0x72a0('0x19')](function(_0x41614d){_0x3cd89f(_0x41614d);});});}function getRealtimeQueues(_0x5437df,_0x3bc78b){return new Promise(function(_0x5b8f2c,_0x3d0607){var _0x315413=_0x3bc78b===_0x72a0('0x1a')?amiClient:routingClient;return _0x315413['request'](_[_0x72a0('0x1b')](_0x3bc78b)+_0x72a0('0x1c'),_0x5437df)[_0x72a0('0x14')](function(_0x3d1965){if(_0x3d1965['error'])throw new Error(util[_0x72a0('0x1d')](_0x72a0('0x1e'),_0x3bc78b));return _0x5b8f2c(_0x3d1965[_0x72a0('0x16')]);})[_0x72a0('0x19')](function(_0x3022b0){_0x3d0607(_0x3022b0);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x174b1b,_0x5c4daf){return amiClient['request'](_0x72a0('0x1f'),{})[_0x72a0('0x14')](function(_0x123df4){if(_0x123df4[_0x72a0('0xf')])throw new Error(_0x72a0('0x20'));return _0x174b1b(_0x123df4[_0x72a0('0x16')]);})[_0x72a0('0x19')](function(_0x15922a){_0x5c4daf(_0x15922a);});});}function initializeQueues(_0xee99e2,_0x12dcc9,_0x4f9718,_0x304b92){var _0x553641=[_0x72a0('0x21'),_0x72a0('0x22'),_0x72a0('0x23'),_0x72a0('0x24'),_0x72a0('0x25')];if(_0x4f9718===_0x72a0('0x1a')&&_0x304b92===_0x72a0('0x26')){_0x553641[_0x72a0('0x27')]('pTalking',_0x72a0('0x28'),_0x72a0('0x29'),_0x72a0('0x2a'),_0x72a0('0x2b'),_0x72a0('0x2c'),_0x72a0('0x2d'),_0x72a0('0x2e'),'erlangCalls',_0x72a0('0x2f'),_0x72a0('0x30'),_0x72a0('0x31'),_0x72a0('0x32'),_0x72a0('0x33'),_0x72a0('0x34'),_0x72a0('0x35'),_0x72a0('0x36'),'predictiveIntervalAnsweredCalls',_0x72a0('0x37'),_0x72a0('0x38'),_0x72a0('0x39'),'predictiveIntervalAvgTalktime');}return _0xee99e2[_0x72a0('0x3a')](function(_0x4ada83){var _0x4b2b44=_0x4ada83[_0x72a0('0x3b')]({'plain':!![]});_0x4b2b44[_0x72a0('0x3c')]=[];_0x4b2b44[_0x72a0('0x25')]=0x0;_0x4b2b44[_0x72a0('0x3d')]=0x0;_0x4b2b44[_0x72a0('0x21')]=0x0;_0x4b2b44[_0x72a0('0x22')]=0x0;_0x4b2b44[_0x72a0('0x23')]=0x0;if(_0x4f9718===_0x72a0('0x1a')){_0x4b2b44[_0x72a0('0x24')]=0x0;_0x4b2b44[_0x72a0('0x3e')]=0x0;if(_0x304b92===_0x72a0('0x26')){_0x4b2b44['pTalking']=0x0;_0x4b2b44[_0x72a0('0x28')]=0x0;}}var _0x5eb8f1=_[_0x72a0('0x3f')](_0x12dcc9,['id',_0x4b2b44['id']]);if(_0x5eb8f1)_[_0x72a0('0x18')](_0x4b2b44,_[_0x72a0('0x40')](_0x5eb8f1,_0x553641));return _0x4b2b44;});}function updateAgentVoiceStatus(_0x1a9597,_0xbb1f4,_0x17dcd8){var _0x90b437=_[_0x72a0('0x41')](_0x17dcd8,[_0x72a0('0x42'),_0xbb1f4['name']]);if(_0x90b437['length']===0x0)return _0x1a9597[_0x72a0('0x3e')]=!![];if(_[_0x72a0('0x43')](_0x90b437,[_0x72a0('0x44'),_0x1a9597[_0x72a0('0x45')][_0x72a0('0x46')]()]))return _0x1a9597['talking']=!![];if(!_0x1a9597[_0x72a0('0x24')])return _0x1a9597[_0x72a0('0x3e')]=!![];}function getVoiceQueueAgents(_0x582c90,_0x21ad08,_0x5cc69b,_0x582c84){var _0x4dee6c=_[_0x72a0('0x3f')](_0x21ad08,['id',_0x582c90['id']]);if(!_0x4dee6c)return _0x582c90;return _0x4dee6c['getMembers']({'raw':!![]})[_0x72a0('0x14')](function(_0x243a6b){for(var _0x1250ac=0x0;_0x1250ac<_0x243a6b[_0x72a0('0x47')];_0x1250ac++){var _0x4bf56e=_['find'](_0x5cc69b,['id',_0x243a6b[_0x1250ac]['UserId']]);if(!_0x4bf56e){_0x4bf56e={'id':_0x243a6b[_0x1250ac]['UserId'],'name':_0x243a6b[_0x1250ac][_0x72a0('0x48')],'accountcode':'','online':![]};}var _0x5784ec={'id':_0x4bf56e['id'],'name':_0x4bf56e['name'],'internal':_0x4bf56e[_0x72a0('0x49')],'online':Boolean(_0x4bf56e[_0x72a0('0x4a')]),'paused':Boolean(_0x243a6b[_0x1250ac]['paused'])};if(_0x4bf56e[_0x72a0('0x4b')]===_0x72a0('0x24'))updateAgentVoiceStatus(_0x5784ec,_0x582c90,_0x582c84);if(_0x5784ec[_0x72a0('0x4a')])_0x582c90[_0x72a0('0x3d')]++;if(_0x5784ec[_0x72a0('0x3e')])_0x582c90[_0x72a0('0x3e')]++;if(_0x5784ec['paused']&&!_0x5784ec[_0x72a0('0x3e')]&&!_0x5784ec['talking'])_0x582c90[_0x72a0('0x25')]++;_0x582c90['agents'][_0x72a0('0x27')](_0x5784ec);}return _0x582c90;});}function getQueueAgents(_0x3bd306,_0x52b575,_0x430178){var _0x506d65=_0x72a0('0x4c')+_[_0x72a0('0x1b')](_0x430178)+_0x72a0('0x4d');var _0x4afdd1=_0x430178+_0x72a0('0x4e');return db[_0x506d65][_0x72a0('0x4f')]({'where':{[_[_0x72a0('0x1b')](_0x430178)+'QueueId']:_0x3bd306['id']},'raw':!![]})['then'](function(_0x117fd3){for(var _0x590572=0x0;_0x590572<_0x117fd3[_0x72a0('0x47')];_0x590572++){var _0x1436f7=_[_0x72a0('0x3f')](_0x52b575,['id',_0x117fd3[_0x590572][_0x72a0('0x48')]]);if(!_0x1436f7){_0x1436f7={'id':_0x117fd3[_0x590572][_0x72a0('0x48')],'name':_0x117fd3[_0x590572][_0x72a0('0x48')],'online':![],['pauseField']:![]};}var _0x451558={'id':_0x1436f7['id'],'name':_0x1436f7[_0x72a0('0x11')],'online':Boolean(_0x1436f7[_0x72a0('0x4a')]),'paused':Boolean(_0x1436f7[_0x4afdd1])};if(_0x451558['online'])_0x3bd306[_0x72a0('0x3d')]++;_0x3bd306[_0x72a0('0x3c')][_0x72a0('0x27')](_0x451558);}return _0x3bd306;});}function isIdle(_0x476e7a){return _0x476e7a===_0x72a0('0x50')||_0x476e7a===_0x72a0('0x51')||_0x476e7a===_0x72a0('0x52')||_0x476e7a==='ringing'||_['isNil'](_0x476e7a);}function isAgentPaused(_0x409095,_0x2161a3){var _0xe38fb3=[_0x409095[_0x72a0('0x53')],_0x409095[_0x72a0('0x54')],_0x409095[_0x72a0('0x55')],_0x409095[_0x72a0('0x56')],_0x409095[_0x72a0('0x57')],_0x409095[_0x72a0('0x58')],_0x409095[_0x72a0('0x59')]];if(!_0x2161a3)return _['every'](_0xe38fb3);var _0x230e2e=_[_0x72a0('0x41')](_0xe38fb3);return _0x230e2e[_0x72a0('0x47')]>0x0&&_0x230e2e[_0x72a0('0x47')]<_0xe38fb3[_0x72a0('0x47')]?!![]:![];}function isAgentIdle(_0x5c1570){if(_0x5c1570[_0x72a0('0x4b')]!=='idle'&&_0x5c1570['voicePause']){_0x5c1570[_0x72a0('0x4b')]=_0x72a0('0x5a');return![];}return _[_0x72a0('0x5b')]([_0x5c1570[_0x72a0('0x5c')],_0x5c1570[_0x72a0('0x5d')],_0x5c1570['mailStatus'],_0x5c1570[_0x72a0('0x5e')],_0x5c1570[_0x72a0('0x5f')],_0x5c1570['voiceStatus'],_0x5c1570['whatsappStatus']],isIdle);}function getAgentStatus(_0x1f698d){var _0x251e08=_0x72a0('0x51');if(isAgentPaused(_0x1f698d))_0x251e08=_0x72a0('0x5a');else if(isAgentPaused(_0x1f698d,!![]))_0x251e08=_0x72a0('0x60');else if(isAgentIdle(_0x1f698d))_0x251e08=_0x72a0('0x50');else _0x251e08=_0x72a0('0x3e');return _0x251e08;}exports[_0x72a0('0x61')]=function(_0x57741b,_0x113eea){var _0x555b14={'count':0x0,'rows':[]},_0x530632={},_0x591dbc,_0x1f30e0,_0x16edb7=[_0x72a0('0x62'),'online',_0x72a0('0x63'),'lastPauseAt','pauseType',_0x72a0('0x64'),_0x72a0('0x45'),'address',_0x72a0('0x53'),'openchannelPause',_0x72a0('0x55'),'smsPause','whatsappPause',_0x72a0('0x54'),_0x72a0('0x58'),_0x72a0('0x65'),'openchannelCapacity','mailCapacity',_0x72a0('0x66'),'whatsappCapacity',_0x72a0('0x67'),_0x72a0('0x68'),_0x72a0('0x69'),_0x72a0('0x6a'),_0x72a0('0x6b'),_0x72a0('0x6c'),_0x72a0('0x6d'),_0x72a0('0x5c'),_0x72a0('0x5e'),_0x72a0('0x6e'),_0x72a0('0x5f'),_0x72a0('0x6f'),'faxStatus',_0x72a0('0x4b'),'chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime',_0x72a0('0x70'),_0x72a0('0x71'),_0x72a0('0x72'),'queue',_0x72a0('0x73'),'screenrecording',_0x72a0('0x74'),_0x72a0('0x75'),'routealias'],_0x583434=[_0x72a0('0x53'),_0x72a0('0x56'),_0x72a0('0x55'),_0x72a0('0x57'),'whatsappPause',_0x72a0('0x54'),'voicePause',_0x72a0('0x4a')];Promise[_0x72a0('0x76')]()[_0x72a0('0x14')](function(){var _0x47fe64=_[_0x72a0('0x3a')](db[_0x72a0('0x4c')][_0x72a0('0x77')],function(_0x154c9d){return{'name':_0x154c9d[_0x72a0('0x78')],'type':_0x154c9d['type']['key']};});_0x57741b[_0x72a0('0x79')]['role']=_0x72a0('0x7a');_0x57741b['query'][_0x72a0('0x4a')]=!![];_0x530632=qs[_0x72a0('0x7b')](_0x47fe64,_0x57741b);_0x530632['raw']=!![];if(_0x57741b[_0x72a0('0x7c')][_0x72a0('0x7d')]===_0x72a0('0x7c')){var _0x55b301={'params':{'id':_0x57741b[_0x72a0('0x7c')]['userProfileId']},'query':{'section':_0x72a0('0x13'),'role':_0x72a0('0x7a'),'online':!![],'nolimit':_0x57741b['query'][_0x72a0('0x7e')],'sort':_0x57741b['query']['sort'],'filter':_0x57741b['query'][_0x72a0('0x41')],'raw':!![]}};return db['UserProfile'][_0x72a0('0x7f')](_0x55b301);}return db['User'][_0x72a0('0x80')](_0x530632);})[_0x72a0('0x14')](function(_0x143ebf){_0x555b14['count']=_0x143ebf[_0x72a0('0xb')];_0x591dbc=_0x143ebf[_0x72a0('0x81')];return getRealtimeAgents();})[_0x72a0('0x14')](function(_0x28551a){_0x1f30e0=_0x28551a[_0x72a0('0x81')];return _0x591dbc['map'](function(_0x54e925){var _0x2d431d=_[_0x72a0('0x3f')](_0x1f30e0,['id',_0x54e925['id']]);if(_0x2d431d)_[_0x72a0('0x18')](_0x54e925,_['pick'](_[_0x72a0('0x82')](_0x2d431d,_0x583434),_0x16edb7));_0x54e925[_0x72a0('0x83')]=getAgentStatus(_0x54e925);return _0x54e925;});})['then'](function(_0xd041ec){if(_0x57741b['query'][_0x72a0('0x84')]){var _0x52f855=_[_0x72a0('0x41')](_0xd041ec,[_0x72a0('0x83'),_0x57741b[_0x72a0('0x79')][_0x72a0('0x84')]]);if(_0x57741b[_0x72a0('0x79')]['pauseTypeFilter']){_0x52f855=_['filter'](_0x52f855,['pauseType',_0x57741b[_0x72a0('0x79')][_0x72a0('0x85')]]);}}_0x555b14[_0x72a0('0x81')]=_0x52f855||_0xd041ec;return _0x555b14;})[_0x72a0('0x14')](respondWithFilteredResult(_0x113eea,_0x530632))[_0x72a0('0x19')](handleError(_0x113eea,null));};exports[_0x72a0('0x86')]=function(_0x5ab97b,_0x2dd438){var _0x1a201a=[_0x72a0('0x87'),_0x72a0('0x88'),_0x72a0('0x89'),_0x72a0('0x8a'),_0x72a0('0x8b'),'whatsapp',_0x72a0('0x1a')];var _0x9fc964={'count':0x0,'rows':[]},_0x130c90={},_0x116493,_0x2e6e32,_0x26e270,_0x5d2de2,_0x3bb322;Promise['resolve']()[_0x72a0('0x14')](function(){if(_0x5ab97b[_0x72a0('0x79')][_0x72a0('0x8c')]){if(!_[_0x72a0('0x8d')](_0x1a201a,_0x5ab97b[_0x72a0('0x79')]['channel'][_0x72a0('0x8e')]()))throw new Error(_0x72a0('0x8f'));_0x116493=_0x5ab97b['query'][_0x72a0('0x8c')][_0x72a0('0x8e')]();}var _0x32ada6=_[_0x72a0('0x1b')](_0x116493)+'Queue';var _0x3b4d55=_[_0x72a0('0x3a')](db[_0x32ada6][_0x72a0('0x77')],function(_0x34a337){return{'name':_0x34a337[_0x72a0('0x78')],'type':_0x34a337[_0x72a0('0x90')][_0x72a0('0x91')]};});_0x130c90=qs[_0x72a0('0x7b')](_0x3b4d55,_0x5ab97b);if(_0x5ab97b[_0x72a0('0x7c')][_0x72a0('0x7d')]===_0x72a0('0x7c')){var _0x109e9e={'params':{'id':_0x5ab97b['user'][_0x72a0('0x92')]},'query':{'section':_0x116493===_0x72a0('0x1a')&&_0x5ab97b[_0x72a0('0x79')][_0x72a0('0x90')]===_0x72a0('0x26')?_0x72a0('0x93'):_[_0x72a0('0x1b')](_0x116493)+_0x72a0('0x1c'),'type':_0x5ab97b['query'][_0x72a0('0x90')],'nolimit':!![],'sort':'name','filter':_0x5ab97b['query'][_0x72a0('0x41')]}};return db['UserProfile']['getResources'](_0x109e9e);}return db[_0x32ada6][_0x72a0('0x80')](_0x130c90);})['then'](function(_0xa89b8d){_0x9fc964[_0x72a0('0xb')]=_0xa89b8d[_0x72a0('0xb')];_0x2e6e32=_0xa89b8d['rows'];return getRealtimeQueues(_0x5ab97b,_0x116493);})[_0x72a0('0x14')](function(_0x179ca2){_0x5d2de2=_0x179ca2[_0x72a0('0x81')];return getRealtimeAgents();})[_0x72a0('0x14')](function(_0x3d3d1f){_0x26e270=_0x3d3d1f['rows'];if(_0x116493!=_0x72a0('0x1a'))return;return getRealtimeVoiceQueueChannels();})[_0x72a0('0x14')](function(_0x38736e){_0x3bb322=_0x38736e?_0x38736e['rows']:[];return initializeQueues(_0x2e6e32,_0x5d2de2,_0x116493,_0x5ab97b[_0x72a0('0x79')][_0x72a0('0x90')]);})[_0x72a0('0x14')](function(_0x56104e){var _0x100f97=_0x56104e[_0x72a0('0x3a')](function(_0x32f2d4){if(_0x116493===_0x72a0('0x1a'))return getVoiceQueueAgents(_0x32f2d4,_0x2e6e32,_0x26e270,_0x3bb322);else return getQueueAgents(_0x32f2d4,_0x26e270,_0x116493);});return Promise[_0x72a0('0x94')](_0x100f97);})[_0x72a0('0x14')](function(_0xff26b1){_0x9fc964[_0x72a0('0x81')]=_0xff26b1;return _0x9fc964;})[_0x72a0('0x14')](respondWithFilteredResult(_0x2dd438,_0x130c90))['catch'](handleError(_0x2dd438,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 80bde82..49379ea 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4baff6,_0x26d3cb){var _0x420798=function(_0xcbf6a0){while(--_0xcbf6a0){_0x4baff6['push'](_0x4baff6['shift']());}};_0x420798(++_0x26d3cb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc04d9b,_0x5a1450){var _0x26691e=function(_0x50daaa){while(--_0x50daaa){_0xc04d9b['push'](_0xc04d9b['shift']());}};_0x26691e(++_0x5a1450);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xcb91[_0x597484];return _0x218e64;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 2dfa491..418027a 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 _0xfb15=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x8808a1,_0x5b89c6){var _0x2018bf=function(_0x258dc0){while(--_0x258dc0){_0x8808a1['push'](_0x8808a1['shift']());}};_0x2018bf(++_0x5b89c6);}(_0xfb15,0x12f));var _0x5fb1=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfb15[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x5fb1('0x0'));module[_0x5fb1('0x1')]={'state':{'type':Sequelize[_0x5fb1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5fb1('0x3')]},'scheduledat':{'type':Sequelize[_0x5fb1('0x4')]},'uniqueid':{'type':Sequelize[_0x5fb1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5fb1('0x4')]},'ringtime':{'type':Sequelize[_0x5fb1('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5fb1('0x3')]},'campaigntype':{'type':Sequelize[_0x5fb1('0x3')]},'membername':{'type':Sequelize[_0x5fb1('0x3')]}}; \ No newline at end of file +var _0xf9d5=['DATE','STRING','exports','INTEGER'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf9d5,0x122));var _0x5f9d=function(_0x15ec27,_0x2b9c73){_0x15ec27=_0x15ec27-0x0;var _0x4421f8=_0xf9d5[_0x15ec27];return _0x4421f8;};'use strict';var Sequelize=require('sequelize');module[_0x5f9d('0x0')]={'state':{'type':Sequelize[_0x5f9d('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5f9d('0x2')]},'uniqueid':{'type':Sequelize[_0x5f9d('0x3')]},'starttime':{'type':Sequelize[_0x5f9d('0x2')]},'responsetime':{'type':Sequelize[_0x5f9d('0x2')]},'ringtime':{'type':Sequelize[_0x5f9d('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5f9d('0x3')]},'campaigntype':{'type':Sequelize[_0x5f9d('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0123dd7..613015f 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 _0xf7e6=['../../config/environment','./reportAgentPreview.attributes','report_agent_preview','util','../../config/logger','bluebird','path'];(function(_0x579042,_0x5a356f){var _0x3546af=function(_0x5a2689){while(--_0x5a2689){_0x579042['push'](_0x579042['shift']());}};_0x3546af(++_0x5a356f);}(_0xf7e6,0x15a));var _0x6f7e=function(_0x44ab8c,_0x4a0a14){_0x44ab8c=_0x44ab8c-0x0;var _0x2fde25=_0xf7e6[_0x44ab8c];return _0x2fde25;};'use strict';var _=require('lodash');var util=require(_0x6f7e('0x0'));var logger=require(_0x6f7e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6f7e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f7e('0x3'));var rimraf=require('rimraf');var config=require(_0x6f7e('0x4'));var attributes=require(_0x6f7e('0x5'));module['exports']=function(_0x8b184d,_0x1e4ab6){return _0x8b184d['define']('ReportAgentPreview',attributes,{'tableName':_0x6f7e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07ec=['moment','bluebird','request-promise','path','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api'];(function(_0x4c7317,_0x4c8672){var _0x10cf49=function(_0x5f28d9){while(--_0x5f28d9){_0x4c7317['push'](_0x4c7317['shift']());}};_0x10cf49(++_0x4c8672);}(_0x07ec,0x19f));var _0xc07e=function(_0x3b1e3f,_0xf8826b){_0x3b1e3f=_0x3b1e3f-0x0;var _0x3b1cd3=_0x07ec[_0x3b1e3f];return _0x3b1cd3;};'use strict';var _=require(_0xc07e('0x0'));var util=require(_0xc07e('0x1'));var logger=require('../../config/logger')(_0xc07e('0x2'));var moment=require(_0xc07e('0x3'));var BPromise=require(_0xc07e('0x4'));var rp=require(_0xc07e('0x5'));var fs=require('fs');var path=require(_0xc07e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xc07e('0x7')]=function(_0x1bff32,_0x42d231){return _0x1bff32[_0xc07e('0x8')](_0xc07e('0x9'),attributes,{'tableName':_0xc07e('0xa'),'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 abb9c9f..45c89c3 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 _0x9d2d=['options','raw','then','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','create','body'];(function(_0x2536cb,_0x4a1040){var _0x3fe4e9=function(_0x243e24){while(--_0x243e24){_0x2536cb['push'](_0x2536cb['shift']());}};_0x3fe4e9(++_0x4a1040);}(_0x9d2d,0x178));var _0xd9d2=function(_0x50f1c2,_0x132ed4){_0x50f1c2=_0x50f1c2-0x0;var _0x5e3649=_0x9d2d[_0x50f1c2];return _0x5e3649;};'use strict';var _=require(_0xd9d2('0x0'));var util=require(_0xd9d2('0x1'));var moment=require(_0xd9d2('0x2'));var BPromise=require(_0xd9d2('0x3'));var rs=require(_0xd9d2('0x4'));var fs=require('fs');var Redis=require(_0xd9d2('0x5'));var db=require(_0xd9d2('0x6'))['db'];var utils=require(_0xd9d2('0x7'));var logger=require(_0xd9d2('0x8'))(_0xd9d2('0x9'));var config=require(_0xd9d2('0xa'));var jayson=require(_0xd9d2('0xb'));var client=jayson[_0xd9d2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x424072,_0x3c2581,_0x5d1a20){return new BPromise(function(_0x17c33d,_0x1aa62f){return client[_0xd9d2('0xd')](_0x424072,_0x5d1a20)['then'](function(_0x5779f2){logger[_0xd9d2('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c2581,_0xd9d2('0xf'));logger[_0xd9d2('0x10')](_0xd9d2('0x11'),_0x3c2581,'request\x20sent',JSON[_0xd9d2('0x12')](_0x5779f2));if(_0x5779f2[_0xd9d2('0x13')]){if(_0x5779f2['error'][_0xd9d2('0x14')]===0x1f4){logger['error'](_0xd9d2('0x15'),_0x3c2581,_0x5779f2[_0xd9d2('0x13')][_0xd9d2('0x16')]);return _0x1aa62f(_0x5779f2[_0xd9d2('0x13')][_0xd9d2('0x16')]);}logger[_0xd9d2('0x13')](_0xd9d2('0x15'),_0x3c2581,_0x5779f2['error'][_0xd9d2('0x16')]);return _0x17c33d(_0x5779f2['error'][_0xd9d2('0x16')]);}else{logger[_0xd9d2('0xe')](_0xd9d2('0x15'),_0x3c2581,_0xd9d2('0xf'));_0x17c33d(_0x5779f2[_0xd9d2('0x17')][_0xd9d2('0x16')]);}})[_0xd9d2('0x18')](function(_0x5e87ef){logger['error'](_0xd9d2('0x15'),_0x3c2581,_0x5e87ef);_0x1aa62f(_0x5e87ef);});});}exports['CreateReportAgentPreview']=function(_0x3ce9b9){var _0x449b54=this;return new Promise(function(_0x53a9f1,_0xb33a20){return db['ReportAgentPreview'][_0xd9d2('0x19')](_0x3ce9b9[_0xd9d2('0x1a')],{'raw':_0x3ce9b9[_0xd9d2('0x1b')]?_0x3ce9b9[_0xd9d2('0x1b')][_0xd9d2('0x1c')]===undefined?!![]:![]:!![]})[_0xd9d2('0x1d')](function(_0x3955e4){logger[_0xd9d2('0xe')](_0xd9d2('0x1e'),_0x3ce9b9);logger[_0xd9d2('0x10')]('CreateReportAgentPreview',_0x3ce9b9,JSON[_0xd9d2('0x12')](_0x3955e4));_0x53a9f1(_0x3955e4);})['catch'](function(_0x5c25a9){logger['error']('CreateReportAgentPreview',_0x5c25a9[_0xd9d2('0x16')],_0x3ce9b9);_0xb33a20(_0x449b54['error'](0x1f4,_0x5c25a9[_0xd9d2('0x16')]));});});}; \ No newline at end of file +var _0x9203=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x29ff5e,_0x220788){var _0xd8135a=function(_0x3a0136){while(--_0x3a0136){_0x29ff5e['push'](_0x29ff5e['shift']());}};_0xd8135a(++_0x220788);}(_0x9203,0x183));var _0x3920=function(_0x542d6b,_0x1615bd){_0x542d6b=_0x542d6b-0x0;var _0x22d616=_0x9203[_0x542d6b];return _0x22d616;};'use strict';var _=require(_0x3920('0x0'));var util=require('util');var moment=require(_0x3920('0x1'));var BPromise=require('bluebird');var rs=require(_0x3920('0x2'));var fs=require('fs');var Redis=require(_0x3920('0x3'));var db=require(_0x3920('0x4'))['db'];var utils=require(_0x3920('0x5'));var logger=require(_0x3920('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3920('0x7'));var client=jayson[_0x3920('0x8')][_0x3920('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b6236,_0x3163bf,_0x4f66ec){return new BPromise(function(_0x2e2424,_0x5e1424){return client[_0x3920('0xa')](_0x3b6236,_0x4f66ec)[_0x3920('0xb')](function(_0x3d18a9){logger['info'](_0x3920('0xc'),_0x3163bf,_0x3920('0xd'));logger[_0x3920('0xe')](_0x3920('0xf'),_0x3163bf,'request\x20sent',JSON['stringify'](_0x3d18a9));if(_0x3d18a9[_0x3920('0x10')]){if(_0x3d18a9[_0x3920('0x10')][_0x3920('0x11')]===0x1f4){logger[_0x3920('0x10')](_0x3920('0xc'),_0x3163bf,_0x3d18a9['error'][_0x3920('0x12')]);return _0x5e1424(_0x3d18a9['error'][_0x3920('0x12')]);}logger[_0x3920('0x10')](_0x3920('0xc'),_0x3163bf,_0x3d18a9[_0x3920('0x10')][_0x3920('0x12')]);return _0x2e2424(_0x3d18a9[_0x3920('0x10')][_0x3920('0x12')]);}else{logger[_0x3920('0x13')](_0x3920('0xc'),_0x3163bf,_0x3920('0xd'));_0x2e2424(_0x3d18a9[_0x3920('0x14')][_0x3920('0x12')]);}})[_0x3920('0x15')](function(_0x5b6e06){logger['error'](_0x3920('0xc'),_0x3163bf,_0x5b6e06);_0x5e1424(_0x5b6e06);});});}exports[_0x3920('0x16')]=function(_0x301977){var _0x451ac2=this;return new Promise(function(_0x1ac8e9,_0x29c3e7){return db[_0x3920('0x17')][_0x3920('0x18')](_0x301977[_0x3920('0x19')],{'raw':_0x301977[_0x3920('0x1a')]?_0x301977[_0x3920('0x1a')][_0x3920('0x1b')]===undefined?!![]:![]:!![]})[_0x3920('0xb')](function(_0x17dba6){logger[_0x3920('0x13')](_0x3920('0x16'),_0x301977);logger[_0x3920('0xe')](_0x3920('0x16'),_0x301977,JSON['stringify'](_0x17dba6));_0x1ac8e9(_0x17dba6);})[_0x3920('0x15')](function(_0x32d2b5){logger[_0x3920('0x10')](_0x3920('0x16'),_0x32d2b5[_0x3920('0x12')],_0x301977);_0x29c3e7(_0x451ac2[_0x3920('0x10')](0x1f4,_0x32d2b5[_0x3920('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e45ddd6..d598a8d 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 _0xf0d3=['voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/whatsapp/queues','/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','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated'];(function(_0x40120c,_0x213c01){var _0x24f2f3=function(_0x23dda0){while(--_0x23dda0){_0x40120c['push'](_0x40120c['shift']());}};_0x24f2f3(++_0x213c01);}(_0xf0d3,0x9d));var _0x3f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3f0d('0x0'));var util=require(_0x3f0d('0x1'));var path=require(_0x3f0d('0x2'));var express=require(_0x3f0d('0x3'));var router=express[_0x3f0d('0x4')]();var auth=require(_0x3f0d('0x5'));var controller=require('./rpc.controller');router[_0x3f0d('0x6')](_0x3f0d('0x7'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x9')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0xa')]);router['get'](_0x3f0d('0xb'),auth['isAuthenticated'](),controller[_0x3f0d('0xc')]);router[_0x3f0d('0x6')](_0x3f0d('0xd'),auth[_0x3f0d('0x8')](),controller['voiceQueues']);router['get'](_0x3f0d('0xe'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0xf')]);router['get'](_0x3f0d('0x10'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x11')]);router['get'](_0x3f0d('0x12'),auth['isAuthenticated'](),controller[_0x3f0d('0x13')]);router[_0x3f0d('0x6')]('/openchannel/queues',auth[_0x3f0d('0x8')](),controller['openchannelQueues']);router[_0x3f0d('0x6')]('/sms/queues',auth[_0x3f0d('0x8')](),controller['smsQueues']);router['get'](_0x3f0d('0x14'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x3f0d('0x6')](_0x3f0d('0x15'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x3f0d('0x6')](_0x3f0d('0x16'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x17')]);router[_0x3f0d('0x6')](_0x3f0d('0x18'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x19')]);router[_0x3f0d('0x6')](_0x3f0d('0x1a'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x1b')]);router['get'](_0x3f0d('0x1c'),auth['isAuthenticated'](),controller[_0x3f0d('0x1d')]);router[_0x3f0d('0x6')](_0x3f0d('0x1e'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x1f')]);router[_0x3f0d('0x6')](_0x3f0d('0x20'),auth[_0x3f0d('0x8')](),controller['showVoiceQueues']);router[_0x3f0d('0x21')](_0x3f0d('0x20'),auth[_0x3f0d('0x8')](),controller['updateVoiceQueue']);router[_0x3f0d('0x6')]('/outbound',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x22')]);router[_0x3f0d('0x6')](_0x3f0d('0x23'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x24')]);router[_0x3f0d('0x6')]('/agents',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x25')]);router[_0x3f0d('0x21')](_0x3f0d('0x26'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x3f0d('0x6')]('/telephones',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x27')]);router[_0x3f0d('0x6')](_0x3f0d('0x28'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x29')]);router[_0x3f0d('0x6')]('/campaigns',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x2a')]);router[_0x3f0d('0x6')](_0x3f0d('0x2b'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x2c')]);router[_0x3f0d('0x6')](_0x3f0d('0x2d'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x2e')]);router['get'](_0x3f0d('0x2f'),auth['isAuthenticated'](),controller[_0x3f0d('0x30')]);router[_0x3f0d('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x31')]);router[_0x3f0d('0x6')](_0x3f0d('0x32'),auth['isAuthenticated'](),controller[_0x3f0d('0x33')]);router['get'](_0x3f0d('0x34'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x35')]);router[_0x3f0d('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x36')]);router[_0x3f0d('0x6')](_0x3f0d('0x37'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x38')]);router[_0x3f0d('0x39')](_0x3f0d('0x3a'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x3b')]('mail'));router['get'](_0x3f0d('0x3c'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x3d')]);router[_0x3f0d('0x39')](_0x3f0d('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0x3f0d('0x3f')));router[_0x3f0d('0x6')](_0x3f0d('0x40'),auth['isAuthenticated'](),controller[_0x3f0d('0x41')]);router[_0x3f0d('0x39')](_0x3f0d('0x42'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x3b')](_0x3f0d('0x43')));router[_0x3f0d('0x6')](_0x3f0d('0x44'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x45')]);router[_0x3f0d('0x39')](_0x3f0d('0x46'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x3b')](_0x3f0d('0x47')));router['get'](_0x3f0d('0x48'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x49')]);router[_0x3f0d('0x39')]('/sms/queues/:id/notify',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x3b')](_0x3f0d('0x4a')));router[_0x3f0d('0x39')](_0x3f0d('0x4b'),auth[_0x3f0d('0x8')](),controller['queueNotify'](_0x3f0d('0x4c')));router['get'](_0x3f0d('0x4d'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x4e')]);router[_0x3f0d('0x6')](_0x3f0d('0x4f'),auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x50')]);router[_0x3f0d('0x39')]('/agents/:id/notify',auth[_0x3f0d('0x8')](),controller[_0x3f0d('0x51')]);module[_0x3f0d('0x52')]=router; \ No newline at end of file +var _0x154a=['/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues'];(function(_0x36dc72,_0x41db1e){var _0x1710b5=function(_0x395e5c){while(--_0x395e5c){_0x36dc72['push'](_0x36dc72['shift']());}};_0x1710b5(++_0x41db1e);}(_0x154a,0x19d));var _0xa154=function(_0x8647a7,_0x2cc4c6){_0x8647a7=_0x8647a7-0x0;var _0x266151=_0x154a[_0x8647a7];return _0x266151;};'use strict';var multer=require(_0xa154('0x0'));var util=require(_0xa154('0x1'));var path=require('path');var express=require(_0xa154('0x2'));var router=express[_0xa154('0x3')]();var auth=require(_0xa154('0x4'));var controller=require(_0xa154('0x5'));router[_0xa154('0x6')](_0xa154('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xa154('0x6')](_0xa154('0x8'),auth[_0xa154('0x9')](),controller['voiceChannelMixMonitor']);router[_0xa154('0x6')](_0xa154('0xa'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0xa154('0x6')](_0xa154('0xb'),auth[_0xa154('0x9')](),controller[_0xa154('0xc')]);router[_0xa154('0x6')](_0xa154('0xd'),auth[_0xa154('0x9')](),controller[_0xa154('0xe')]);router[_0xa154('0x6')](_0xa154('0xf'),auth[_0xa154('0x9')](),controller[_0xa154('0x10')]);router[_0xa154('0x6')](_0xa154('0x11'),auth[_0xa154('0x9')](),controller[_0xa154('0x12')]);router[_0xa154('0x6')](_0xa154('0x13'),auth[_0xa154('0x9')](),controller['openchannelQueues']);router['get'](_0xa154('0x14'),auth[_0xa154('0x9')](),controller[_0xa154('0x15')]);router['get'](_0xa154('0x16'),auth[_0xa154('0x9')](),controller[_0xa154('0x17')]);router['get'](_0xa154('0x18'),auth[_0xa154('0x9')](),controller[_0xa154('0x19')]);router[_0xa154('0x6')](_0xa154('0x1a'),auth['isAuthenticated'](),controller[_0xa154('0x1b')]);router[_0xa154('0x6')](_0xa154('0x1c'),auth[_0xa154('0x9')](),controller[_0xa154('0x1d')]);router[_0xa154('0x6')](_0xa154('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xa154('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xa154('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0xa154('0x1f'),auth['isAuthenticated'](),controller[_0xa154('0x20')]);router[_0xa154('0x6')](_0xa154('0x21'),auth[_0xa154('0x9')](),controller['showVoiceQueues']);router['put'](_0xa154('0x21'),auth[_0xa154('0x9')](),controller[_0xa154('0x22')]);router['get'](_0xa154('0x23'),auth['isAuthenticated'](),controller[_0xa154('0x24')]);router[_0xa154('0x6')](_0xa154('0x25'),auth[_0xa154('0x9')](),controller[_0xa154('0x26')]);router[_0xa154('0x6')]('/agents',auth[_0xa154('0x9')](),controller[_0xa154('0x27')]);router[_0xa154('0x28')](_0xa154('0x29'),auth['isAuthenticated'](),controller[_0xa154('0x2a')]);router[_0xa154('0x6')](_0xa154('0x2b'),auth[_0xa154('0x9')](),controller[_0xa154('0x2c')]);router[_0xa154('0x6')](_0xa154('0x2d'),auth['isAuthenticated'](),controller[_0xa154('0x2e')]);router[_0xa154('0x6')](_0xa154('0x2f'),auth[_0xa154('0x9')](),controller[_0xa154('0x30')]);router['get'](_0xa154('0x31'),auth['isAuthenticated'](),controller[_0xa154('0x32')]);router[_0xa154('0x6')](_0xa154('0x33'),auth[_0xa154('0x9')](),controller[_0xa154('0x34')]);router[_0xa154('0x6')](_0xa154('0x35'),auth[_0xa154('0x9')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xa154('0x36'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xa154('0x6')](_0xa154('0x37'),auth[_0xa154('0x9')](),controller[_0xa154('0x38')]);router[_0xa154('0x6')](_0xa154('0x39'),auth[_0xa154('0x9')](),controller[_0xa154('0x3a')]);router['get'](_0xa154('0x3b'),auth[_0xa154('0x9')](),controller[_0xa154('0x3c')]);router[_0xa154('0x6')](_0xa154('0x3d'),auth[_0xa154('0x9')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xa154('0x3e'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')]('mail'));router['get']('/mail/queues/:id',auth[_0xa154('0x9')](),controller[_0xa154('0x40')]);router[_0xa154('0x41')](_0xa154('0x42'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')]('chat'));router[_0xa154('0x6')](_0xa154('0x43'),auth[_0xa154('0x9')](),controller[_0xa154('0x44')]);router[_0xa154('0x41')](_0xa154('0x45'),auth['isAuthenticated'](),controller[_0xa154('0x3f')]('fax'));router[_0xa154('0x6')](_0xa154('0x46'),auth['isAuthenticated'](),controller[_0xa154('0x47')]);router[_0xa154('0x41')](_0xa154('0x48'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')](_0xa154('0x49')));router['get'](_0xa154('0x4a'),auth[_0xa154('0x9')](),controller[_0xa154('0x4b')]);router['post'](_0xa154('0x4c'),auth[_0xa154('0x9')](),controller['queueNotify'](_0xa154('0x4d')));router['post'](_0xa154('0x4e'),auth[_0xa154('0x9')](),controller[_0xa154('0x3f')](_0xa154('0x4f')));router[_0xa154('0x6')](_0xa154('0x50'),auth[_0xa154('0x9')](),controller[_0xa154('0x51')]);router['get'](_0xa154('0x52'),auth[_0xa154('0x9')](),controller[_0xa154('0x53')]);router[_0xa154('0x41')](_0xa154('0x54'),auth[_0xa154('0x9')](),controller[_0xa154('0x55')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f20956c..571e9b3 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 _0x7dfd=['interface','format','SIP/%s','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','findOne','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x3be074,_0x2aeabb){var _0x1c2a22=function(_0x1ab805){while(--_0x1ab805){_0x3be074['push'](_0x3be074['shift']());}};_0x1c2a22(++_0x2aeabb);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var _=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var db=require(_0xd7df('0x4'))['db'];var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var jayson=require(_0xd7df('0x7'));var amiClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232a});var mailClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232b});var routingClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){var _0xb3557a=_0x2c48a4?_0x2c48a4:amiClient;return _0xb3557a[_0xd7df('0xa')](_0x354ea7,_0x16e50)[_0xd7df('0xb')](function(_0x5e59c3){if(_0x5e59c3[_0xd7df('0xc')]){if(_0x5e59c3['error'][_0xd7df('0xd')]===0x1f4){return _0xab6742(_0x5e59c3['error'][_0xd7df('0xe')]);}return _0x5c220a(_0x5e59c3[_0xd7df('0xc')][_0xd7df('0xe')]);}else{_0x5c220a(_0x5e59c3[_0xd7df('0xf')]);}})[_0xd7df('0x10')](function(_0x174c88){_0xab6742(_0x174c88);});});}function respondWithResult(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xc8;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x11')](_0x3da618)[_0xd7df('0x12')](_0x7ba3c);}return _0x2e8187[_0xd7df('0x13')](0x194);};}function handleError(_0xe1595f,_0x196632){_0x196632=_0x196632||0x1f4;return function(_0x3b2559){logger[_0xd7df('0xc')](_0x3b2559[_0xd7df('0x14')]);if(_0x3b2559['name']){delete _0x3b2559[_0xd7df('0x15')];}_0xe1595f[_0xd7df('0x11')](_0x196632)['send'](_0x3b2559);};}function findById(_0x18d38f){return function(_0xbe1c5e){if(!_['isNil'](_0x18d38f)&&!_[_0xd7df('0x16')](_0xbe1c5e)&&!_[_0xd7df('0x16')](_0xbe1c5e[_0xd7df('0x17')])){return _['find'](_0xbe1c5e[_0xd7df('0x17')],function(_0x471621){return _0x471621['id']==_0x18d38f;});}return null;};}exports[_0xd7df('0x18')]=function(_0x5ba653,_0x96d86e){return respondWithRpcPromise(_0xd7df('0x19'),_0x5ba653[_0xd7df('0x1a')])['then'](respondWithResult(_0x96d86e,null))[_0xd7df('0x10')](handleError(_0x96d86e,null));};exports['voiceChannelMixMonitor']=function(_0x225e33,_0x5ab737){return respondWithRpcPromise(_0xd7df('0x1b'),_[_0xd7df('0x1c')](_0x225e33[_0xd7df('0x1a')],_0x225e33['params']))[_0xd7df('0xb')](respondWithResult(_0x5ab737,null))['catch'](handleError(_0x5ab737,null));};exports[_0xd7df('0x1d')]=function(_0x379e4a,_0x40e7af){return respondWithRpcPromise(_0xd7df('0x1e'),_[_0xd7df('0x1c')](_0x379e4a[_0xd7df('0x1a')],_0x379e4a[_0xd7df('0x1f')]))['then'](respondWithResult(_0x40e7af,null))['catch'](handleError(_0x40e7af,null));};exports[_0xd7df('0x20')]=function(_0x38db14,_0x26047f){return respondWithRpcPromise(_0xd7df('0x21'),_0x38db14[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x26047f,null))[_0xd7df('0x10')](handleError(_0x26047f,null));};exports[_0xd7df('0x22')]=function(_0x163904,_0x5c4d17){return respondWithRpcPromise(_0xd7df('0x21'),_0x163904[_0xd7df('0x1a')])[_0xd7df('0xb')](findById(_0x163904[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x5c4d17,null))[_0xd7df('0x10')](handleError(_0x5c4d17,null));};exports[_0xd7df('0x23')]=function(_0x36de76,_0x5195cf){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x36de76['body'],_0x36de76['params']))[_0xd7df('0xb')](respondWithResult(_0x5195cf,null))['catch'](handleError(_0x5195cf,null));};exports[_0xd7df('0x24')]=function(_0x156612,_0x503a90){return respondWithRpcPromise(_0xd7df('0x25'),_[_0xd7df('0x1c')](_0x156612['query'],_0x156612[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x503a90,null))[_0xd7df('0x10')](handleError(_0x503a90,null));};exports[_0xd7df('0x26')]=function(_0x40f965,_0x3304c4){return respondWithRpcPromise('VoiceQueuesChannels',_0x40f965[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x3304c4,null))[_0xd7df('0x10')](handleError(_0x3304c4,null));};exports[_0xd7df('0x27')]=function(_0x363f2d,_0x4cecf2){return respondWithRpcPromise(_0xd7df('0x28'),_[_0xd7df('0x1c')](_0x363f2d[_0xd7df('0x1a')],_0x363f2d[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x4cecf2,null))['catch'](handleError(_0x4cecf2,null));};exports['voiceQueuesChannelHangup']=function(_0x4051fb,_0x564562){return respondWithRpcPromise(_0xd7df('0x29'),_[_0xd7df('0x1c')](_0x4051fb[_0xd7df('0x1a')],_0x4051fb[_0xd7df('0x1f')]))['then'](respondWithResult(_0x564562,null))['catch'](handleError(_0x564562,null));};exports['voiceQueuesChannelRedirect']=function(_0x2a96e3,_0x15e682){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd7df('0x1c')](_0x2a96e3[_0xd7df('0x1a')],_0x2a96e3[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x15e682,null))['catch'](handleError(_0x15e682,null));};exports[_0xd7df('0x2a')]=function(_0x45642c,_0x5f0a6d){return respondWithRpcPromise(_0xd7df('0x2b'),_0x45642c['query'])[_0xd7df('0xb')](respondWithResult(_0x5f0a6d,null))[_0xd7df('0x10')](handleError(_0x5f0a6d,null));};exports[_0xd7df('0x2c')]=function(_0x59c755,_0x138391){return respondWithRpcPromise(_0xd7df('0x2d'),_0x59c755[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x138391,null))['catch'](handleError(_0x138391,null));};exports[_0xd7df('0x2e')]=function(_0x230857,_0x2314e6){var _0x4f6286;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')])[_0xd7df('0xb')](function(_0x517824){_0x4f6286=_0x517824;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')],routingClient);})['then'](function(_0x4b2561){return _[_0xd7df('0x1c')]({},_0x4b2561,_0x4f6286);})[_0xd7df('0xb')](respondWithResult(_0x2314e6,null))[_0xd7df('0x10')](handleError(_0x2314e6,null));};exports['agentCapacity']=function(_0x5e8cd0,_0x2c149e){if(_0x5e8cd0['body']&&_0x5e8cd0[_0xd7df('0x30')]['interaction']&&_0x5e8cd0['user']&&_0x5e8cd0[_0xd7df('0x31')]['name']){for(var _0x18ef10 in _0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')]){if(_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0xd7df('0x33')](_0x18ef10)){db[_0xd7df('0x34')][_0xd7df('0x35')]({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')]['name'],'type':_0xd7df('0x36'),'exitAt':null,'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10]&&_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0xd7df('0x37')]?{'$notIn':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10]}:{'$ne':null}}})[_0xd7df('0xb')](function(_0x38056b){var _0x3a3c1a=moment()['format'](_0xd7df('0x38'));for(var _0x563f90=0x0,_0x49085b=_0x38056b['length'];_0x563f90<_0x49085b;_0x563f90+=0x1){_0x38056b[_0x563f90][_0xd7df('0x39')]({'exitAt':_0x3a3c1a});}});for(var _0x162900=0x0;_0x162900<_0x5e8cd0[_0xd7df('0x30')]['interaction'][_0x18ef10]['length'];_0x162900+=0x1){db[_0xd7df('0x34')]['findOrCreate']({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'type':_0xd7df('0x36'),'uniqueid':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0x162900],'exitAt':null},'defaults':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'interface':_[_0xd7df('0x16')](_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')])?util[_0xd7df('0x3b')](_0xd7df('0x3c'),_0x5e8cd0['user'][_0xd7df('0x15')]):_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')],'type':_0xd7df('0x36'),'enterAt':moment()[_0xd7df('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd7df('0x3d'),'internal':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3e')],'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10][_0x162900]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5e8cd0[_0xd7df('0x1f')]['id'],'capacity':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x3f')]},routingClient)[_0xd7df('0xb')](respondWithResult(_0x2c149e,null))[_0xd7df('0x10')](handleError(_0x2c149e,null));};exports['telephones']=function(_0x4abe81,_0x53ec02){return respondWithRpcPromise(_0xd7df('0x40'),_0x4abe81['query'])[_0xd7df('0xb')](respondWithResult(_0x53ec02,null))[_0xd7df('0x10')](handleError(_0x53ec02,null));};exports[_0xd7df('0x41')]=function(_0xdf3046,_0x275af9){return respondWithRpcPromise(_0xd7df('0x42'),_0xdf3046[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x275af9,null))[_0xd7df('0x10')](handleError(_0x275af9,null));};exports[_0xd7df('0x43')]=function(_0x382d11,_0x327365){return respondWithRpcPromise(_0xd7df('0x44'),_0x382d11[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x327365,null))[_0xd7df('0x10')](handleError(_0x327365,null));};exports['chatQueues']=function(_0x332db5,_0x28c9b7){return respondWithRpcPromise('ChatQueues',_0x332db5['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x28c9b7,null))['catch'](handleError(_0x28c9b7,null));};exports[_0xd7df('0x45')]=function(_0x4fb55a,_0x1f34c2){return respondWithRpcPromise(_0xd7df('0x46'),_0x4fb55a[_0xd7df('0x1a')],routingClient)['then'](findById(_0x4fb55a['params']['id']))['then'](respondWithResult(_0x1f34c2,null))[_0xd7df('0x10')](handleError(_0x1f34c2,null));};exports[_0xd7df('0x47')]=function(_0x19c387,_0x527b6f){return respondWithRpcPromise(_0xd7df('0x48'),_0x19c387[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x527b6f,null))[_0xd7df('0x10')](handleError(_0x527b6f,null));};exports[_0xd7df('0x49')]=function(_0x35204f,_0x25d187){return respondWithRpcPromise(_0xd7df('0x48'),_0x35204f[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x35204f[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x25d187,null))[_0xd7df('0x10')](handleError(_0x25d187,null));};exports[_0xd7df('0x4a')]=function(_0x398e43,_0x3dba78){return respondWithRpcPromise(_0xd7df('0x4b'),_0x398e43[_0xd7df('0x1a')],mailClient)[_0xd7df('0xb')](respondWithResult(_0x3dba78,null))[_0xd7df('0x10')](handleError(_0x3dba78,null));};exports[_0xd7df('0x4c')]=function(_0x3f2775,_0x1e6277){return respondWithRpcPromise(_0xd7df('0x4d'),_0x3f2775[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x1e6277,null))[_0xd7df('0x10')](handleError(_0x1e6277,null));};exports[_0xd7df('0x4e')]=function(_0x3912d6,_0x51ae2b){return respondWithRpcPromise('OpenchannelQueues',_0x3912d6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3912d6[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x51ae2b,null))[_0xd7df('0x10')](handleError(_0x51ae2b,null));};exports[_0xd7df('0x4f')]=function(_0x1e87aa,_0x2786a6){return respondWithRpcPromise('SmsQueues',_0x1e87aa[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2786a6,null))[_0xd7df('0x10')](handleError(_0x2786a6,null));};exports[_0xd7df('0x50')]=function(_0x19a25b,_0x2fbc53){return respondWithRpcPromise(_0xd7df('0x51'),_0x19a25b[_0xd7df('0x1a')],routingClient)['then'](findById(_0x19a25b[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x2fbc53,null))['catch'](handleError(_0x2fbc53,null));};exports['whatsappQueues']=function(_0x481fa5,_0x264c5b){return respondWithRpcPromise(_0xd7df('0x52'),_0x481fa5[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xd7df('0x53')]=function(_0x3d45cf,_0x19df03){return respondWithRpcPromise(_0xd7df('0x52'),_0x3d45cf[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3d45cf[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x19df03,null))['catch'](handleError(_0x19df03,null));};exports[_0xd7df('0x54')]=function(_0x5c1e68,_0x588537){return respondWithRpcPromise(_0xd7df('0x55'),_0x5c1e68[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x588537,null))['catch'](handleError(_0x588537,null));};exports[_0xd7df('0x56')]=function(_0x44d824,_0x49bf7e){return respondWithRpcPromise(_0xd7df('0x55'),_0x44d824[_0xd7df('0x1a')],routingClient)['then'](findById(_0x44d824[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x49bf7e,null))['catch'](handleError(_0x49bf7e,null));};exports[_0xd7df('0x57')]=function(_0x519f72,_0x56f55d){return respondWithRpcPromise(_0xd7df('0x58'),_0x519f72[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x56f55d,null))[_0xd7df('0x10')](handleError(_0x56f55d,null));};exports[_0xd7df('0x59')]=function(_0x40b2a1,_0x5831c1){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x40b2a1[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x5831c1,null))[_0xd7df('0x10')](handleError(_0x5831c1,null));};exports[_0xd7df('0x5a')]=function(_0x19b0e6,_0x31f681){return respondWithRpcPromise(_0xd7df('0x5b'),_0x19b0e6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x31f681,null))['catch'](handleError(_0x31f681,null));};exports[_0xd7df('0x5c')]=function(_0x1682ca,_0x4e9806){return respondWithRpcPromise(_0xd7df('0x5d'),_0x1682ca[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4e9806,null))[_0xd7df('0x10')](handleError(_0x4e9806,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4e5363,_0x5628ed){return respondWithRpcPromise(_0xd7df('0x5d'),_0x4e5363['query'],routingClient)[_0xd7df('0xb')](function(_0x2b1b30){if(_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')]!==undefined){var _0x2d8a31=_(_0x2b1b30[_0xd7df('0x17')])['filter']([_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')],_0x4e5363[_0xd7df('0x1f')]['id']])['map'](_0xd7df('0x5f'))[_0xd7df('0x60')]()['value']();return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x157290){return _0x2d8a31[_0xd7df('0x62')](_0x157290[_0xd7df('0x5f')])>-0x1;});}else{return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x5e93cc){return _0x5e93cc[_0xd7df('0x5f')]===parseInt(_0x4e5363[_0xd7df('0x1f')]['id']);});}})[_0xd7df('0xb')](respondWithResult(_0x5628ed,null))[_0xd7df('0x10')](handleError(_0x5628ed,null));};exports['smsQueuesWaitingInteractions']=function(_0x531a07,_0x2e1e96){return respondWithRpcPromise(_0xd7df('0x63'),_0x531a07[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2e1e96,null))[_0xd7df('0x10')](handleError(_0x2e1e96,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2329ce,_0x4f739b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2329ce[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4f739b,null))[_0xd7df('0x10')](handleError(_0x4f739b,null));};exports[_0xd7df('0x64')]=function(_0x30c401,_0x3ece24){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x30c401['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x3ece24,null))[_0xd7df('0x10')](handleError(_0x3ece24,null));};exports[_0xd7df('0x65')]=function(_0x175a36){return function(_0x5cb2b0,_0xac3b73){var _0x5df36d,_0x158bd9;var _0x5b73e5=_[_0xd7df('0x66')](_0x175a36);var _0x1ed032=_0x175a36===_0xd7df('0x67')?_0xd7df('0x68'):_0xd7df('0x69');return db[_0x5b73e5+_0xd7df('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5cb2b0[_0xd7df('0x1f')]['id']}})['then'](function(_0x1e2355){if(_[_0xd7df('0x16')](_0x1e2355)){throw new Error(_0x5b73e5+_0xd7df('0x6b'));}_0x5df36d=_0x1e2355;return db[_0x5b73e5+_0xd7df('0x6c')]['findOne']({'where':{'id':_0x5cb2b0[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x5b73e5+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x5b73e5+_0x1ed032],'as':_0xd7df('0x69')}]});})[_0xd7df('0xb')](function(_0x40a665){if(_[_0xd7df('0x16')](_0x40a665)){throw new Error(_0x5b73e5+_0xd7df('0x6f'));}_0x158bd9=_0x40a665;return _0x40a665[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0x15bd27={'uniqueid':_0x175a36+'.'+_0x158bd9['id']+'.'+_0x158bd9['Interaction']['id'],'FromUserId':_0x5cb2b0[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71')};_0x15bd27[_0x5b73e5+_0xd7df('0x72')]=_0x158bd9['id'];_0x15bd27[_0x5b73e5+'InteractionId']=_0x158bd9['Interaction']['id'];_0x15bd27[_0xd7df('0x73')+_0x5b73e5+_0x1ed032+'Id']=_0x158bd9[_0xd7df('0x69')]['id'];_0x15bd27['To'+_0x5b73e5+_0xd7df('0x74')]=_0x5df36d['id'];return db[_0x5b73e5+_0xd7df('0x75')][_0xd7df('0x76')](_0x15bd27);})[_0xd7df('0xb')](function(){return respondWithRpcPromise(_0xd7df('0x77'),{'channel':_0x175a36,'interaction':_0x158bd9[_0xd7df('0x6e')],'message':_0x158bd9,'account':_0x158bd9[_0xd7df('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x71'),'appdata':_0x5df36d['name']+','+(_0x158bd9[_0xd7df('0x69')][_0xd7df('0x78')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0xac3b73,null))[_0xd7df('0x10')](handleError(_0xac3b73,null));};};exports[_0xd7df('0x7a')]=function(_0x50c5b9,_0x518092){var _0xa3ae43,_0x31b159;if(_[_0xd7df('0x16')](_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1a888c=_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')];var _0x3d9fba=_[_0xd7df('0x66')](_0x1a888c);var _0x2861e3=_0x1a888c===_0xd7df('0x67')?'Website':_0xd7df('0x69');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50c5b9[_0xd7df('0x1f')]['id'],'role':_0xd7df('0x3d')}})[_0xd7df('0xb')](function(_0x5092d2){if(_[_0xd7df('0x16')](_0x5092d2)){throw new Error('Agent\x20not\x20found');}_0xa3ae43=_0x5092d2;return db[_0x3d9fba+'Message'][_0xd7df('0x7c')]({'where':{'id':_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x3d9fba+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x3d9fba+_0x2861e3],'as':'Account'}]});})['then'](function(_0x3f2ecd){if(_[_0xd7df('0x16')](_0x3f2ecd)){throw new Error(_0x3d9fba+_0xd7df('0x6f'));}_0x31b159=_0x3f2ecd;return _0x3f2ecd[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0xc447e8={'uniqueid':_0x1a888c+'.'+_0x31b159['id']+'.'+_0x31b159[_0xd7df('0x6e')]['id'],'FromUserId':_0x50c5b9[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71'),'ToUserId':_0xa3ae43['id']};_0xc447e8[_0x3d9fba+_0xd7df('0x72')]=_0x31b159['id'];_0xc447e8[_0x3d9fba+_0xd7df('0x7d')]=_0x31b159[_0xd7df('0x6e')]['id'];_0xc447e8[_0xd7df('0x73')+_0x3d9fba+_0x2861e3+'Id']=_0x31b159['Account']['id'];return db[_0x3d9fba+_0xd7df('0x75')][_0xd7df('0x76')](_0xc447e8);})[_0xd7df('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a888c,'interaction':_0x31b159[_0xd7df('0x6e')],'message':_0x31b159,'account':_0x31b159['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x3d'),'appdata':_0xa3ae43[_0xd7df('0x15')]+','+(_0x31b159['Account'][_0xd7df('0x7e')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0x518092,null))[_0xd7df('0x10')](handleError(_0x518092,null));}; \ No newline at end of file +var _0xeda8=['TransferReport','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','code','result','catch','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','merge','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','uniq','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User'];(function(_0x19c4bd,_0x19a00d){var _0x2fc7b5=function(_0x24fdab){while(--_0x24fdab){_0x19c4bd['push'](_0x19c4bd['shift']());}};_0x2fc7b5(++_0x19a00d);}(_0xeda8,0x104));var _0x8eda=function(_0x375d35,_0x49037e){_0x375d35=_0x375d35-0x0;var _0x28d0b8=_0xeda8[_0x375d35];return _0x28d0b8;};'use strict';var BPromise=require(_0x8eda('0x0'));var moment=require(_0x8eda('0x1'));var _=require('lodash');var util=require(_0x8eda('0x2'));var db=require(_0x8eda('0x3'))['db'];var logger=require(_0x8eda('0x4'))(_0x8eda('0x5'));var jayson=require(_0x8eda('0x6'));var amiClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232a});var mailClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232b});var routingClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){var _0x6b544f=_0x28b721?_0x28b721:amiClient;return _0x6b544f['request'](_0x32abe8,_0x4e2ebb)['then'](function(_0x488849){if(_0x488849['error']){if(_0x488849[_0x8eda('0x9')][_0x8eda('0xa')]===0x1f4){return _0x5aa93d(_0x488849[_0x8eda('0x9')]['message']);}return _0x1b6a1d(_0x488849[_0x8eda('0x9')]['message']);}else{_0x1b6a1d(_0x488849[_0x8eda('0xb')]);}})[_0x8eda('0xc')](function(_0x2fdec0){_0x5aa93d(_0x2fdec0);});});}function respondWithResult(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xc8;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0xd')](_0x337573)[_0x8eda('0xe')](_0x3af00c);}return _0x1ad3df['sendStatus'](0x194);};}function handleError(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0x1f4;return function(_0x223dcf){logger['error'](_0x223dcf[_0x8eda('0xf')]);if(_0x223dcf[_0x8eda('0x10')]){delete _0x223dcf[_0x8eda('0x10')];}_0x500bd4['status'](_0xe04d90)[_0x8eda('0x11')](_0x223dcf);};}function findById(_0x5594ad){return function(_0xf7d764){if(!_['isNil'](_0x5594ad)&&!_[_0x8eda('0x12')](_0xf7d764)&&!_['isNil'](_0xf7d764[_0x8eda('0x13')])){return _[_0x8eda('0x14')](_0xf7d764['rows'],function(_0x5e44b7){return _0x5e44b7['id']==_0x5594ad;});}return null;};}exports[_0x8eda('0x15')]=function(_0x1b7e94,_0x1b089d){return respondWithRpcPromise(_0x8eda('0x16'),_0x1b7e94[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x1b089d,null))[_0x8eda('0xc')](handleError(_0x1b089d,null));};exports[_0x8eda('0x19')]=function(_0x850cce,_0x232786){return respondWithRpcPromise(_0x8eda('0x1a'),_['merge'](_0x850cce[_0x8eda('0x17')],_0x850cce['params']))[_0x8eda('0x18')](respondWithResult(_0x232786,null))['catch'](handleError(_0x232786,null));};exports[_0x8eda('0x1b')]=function(_0x2dab25,_0x4f3e0a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x2dab25[_0x8eda('0x17')],_0x2dab25[_0x8eda('0x1c')]))['then'](respondWithResult(_0x4f3e0a,null))[_0x8eda('0xc')](handleError(_0x4f3e0a,null));};exports[_0x8eda('0x1d')]=function(_0x54aa7f,_0x25e955){return respondWithRpcPromise(_0x8eda('0x1e'),_0x54aa7f[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x25e955,null))[_0x8eda('0xc')](handleError(_0x25e955,null));};exports['showVoiceQueues']=function(_0x41b5a9,_0x5a8bed){return respondWithRpcPromise(_0x8eda('0x1e'),_0x41b5a9[_0x8eda('0x17')])[_0x8eda('0x18')](findById(_0x41b5a9['params']['id']))[_0x8eda('0x18')](respondWithResult(_0x5a8bed,null))[_0x8eda('0xc')](handleError(_0x5a8bed,null));};exports[_0x8eda('0x1f')]=function(_0x4cdd2e,_0x1616ea){return respondWithRpcPromise(_0x8eda('0x20'),_['merge'](_0x4cdd2e[_0x8eda('0x21')],_0x4cdd2e[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x1616ea,null))[_0x8eda('0xc')](handleError(_0x1616ea,null));};exports['voiceQueuesPreview']=function(_0x58dd55,_0x54513c){return respondWithRpcPromise(_0x8eda('0x22'),_[_0x8eda('0x23')](_0x58dd55[_0x8eda('0x17')],_0x58dd55['params']))['then'](respondWithResult(_0x54513c,null))['catch'](handleError(_0x54513c,null));};exports[_0x8eda('0x24')]=function(_0x48d52d,_0x31aaaf){return respondWithRpcPromise('VoiceQueuesChannels',_0x48d52d['query'])['then'](respondWithResult(_0x31aaaf,null))[_0x8eda('0xc')](handleError(_0x31aaaf,null));};exports[_0x8eda('0x25')]=function(_0x142f67,_0x2a3cdc){return respondWithRpcPromise(_0x8eda('0x26'),_[_0x8eda('0x23')](_0x142f67[_0x8eda('0x17')],_0x142f67[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x2a3cdc,null))[_0x8eda('0xc')](handleError(_0x2a3cdc,null));};exports[_0x8eda('0x27')]=function(_0x3132fd,_0xc354d9){return respondWithRpcPromise(_0x8eda('0x28'),_['merge'](_0x3132fd[_0x8eda('0x17')],_0x3132fd[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0xc354d9,null))['catch'](handleError(_0xc354d9,null));};exports['voiceQueuesChannelRedirect']=function(_0x41c873,_0x36dc26){return respondWithRpcPromise(_0x8eda('0x29'),_[_0x8eda('0x23')](_0x41c873['query'],_0x41c873[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x36dc26,null))[_0x8eda('0xc')](handleError(_0x36dc26,null));};exports[_0x8eda('0x2a')]=function(_0x567aa6,_0x29a706){return respondWithRpcPromise('Outbound',_0x567aa6[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x29a706,null))[_0x8eda('0xc')](handleError(_0x29a706,null));};exports[_0x8eda('0x2b')]=function(_0x261e12,_0x32ce09){return respondWithRpcPromise('OutboundChannels',_0x261e12[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x32ce09,null))[_0x8eda('0xc')](handleError(_0x32ce09,null));};exports[_0x8eda('0x2c')]=function(_0xa1e556,_0x5cf565){var _0x17ee80;return respondWithRpcPromise(_0x8eda('0x2d'),_0xa1e556[_0x8eda('0x17')])['then'](function(_0x408e00){_0x17ee80=_0x408e00;return respondWithRpcPromise('Agents',_0xa1e556[_0x8eda('0x17')],routingClient);})[_0x8eda('0x18')](function(_0x42d434){return _[_0x8eda('0x23')]({},_0x42d434,_0x17ee80);})[_0x8eda('0x18')](respondWithResult(_0x5cf565,null))['catch'](handleError(_0x5cf565,null));};exports['agentCapacity']=function(_0xbf14a1,_0xfcb278){if(_0xbf14a1[_0x8eda('0x21')]&&_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')]&&_0xbf14a1[_0x8eda('0x2f')]&&_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')]){for(var _0x184590 in _0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')]){if(_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x8eda('0x30')](_0x184590)){db[_0x8eda('0x31')][_0x8eda('0x32')]({'where':{'channel':_0x184590,'membername':_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')],'type':_0x8eda('0x33'),'exitAt':null,'uniqueid':_0xbf14a1['body'][_0x8eda('0x2e')][_0x184590]&&_0xbf14a1[_0x8eda('0x21')]['interaction'][_0x184590][_0x8eda('0x34')]?{'$notIn':_0xbf14a1[_0x8eda('0x21')]['interaction'][_0x184590]}:{'$ne':null}}})[_0x8eda('0x18')](function(_0x1fff77){var _0x51f2a3=moment()[_0x8eda('0x35')](_0x8eda('0x36'));for(var _0x2a3546=0x0,_0x48ad47=_0x1fff77[_0x8eda('0x34')];_0x2a3546<_0x48ad47;_0x2a3546+=0x1){_0x1fff77[_0x2a3546][_0x8eda('0x37')]({'exitAt':_0x51f2a3});}});for(var _0x3996b7=0x0;_0x3996b7<_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x184590][_0x8eda('0x34')];_0x3996b7+=0x1){db[_0x8eda('0x31')]['findOrCreate']({'where':{'channel':_0x184590,'membername':_0xbf14a1[_0x8eda('0x2f')]['name'],'type':_0x8eda('0x33'),'uniqueid':_0xbf14a1['body'][_0x8eda('0x2e')][_0x184590][_0x3996b7],'exitAt':null},'defaults':{'channel':_0x184590,'membername':_0xbf14a1['user'][_0x8eda('0x10')],'interface':_['isNil'](_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x38')])?util[_0x8eda('0x35')](_0x8eda('0x39'),_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')]):_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x38')],'type':_0x8eda('0x33'),'enterAt':moment()[_0x8eda('0x35')](_0x8eda('0x36')),'role':_0x8eda('0x3a'),'internal':_0xbf14a1['user'][_0x8eda('0x3b')],'uniqueid':_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x184590][_0x3996b7]}});}}}}return respondWithRpcPromise(_0x8eda('0x3c'),{'id':_0xbf14a1[_0x8eda('0x1c')]['id'],'capacity':_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x3d')]},routingClient)[_0x8eda('0x18')](respondWithResult(_0xfcb278,null))[_0x8eda('0xc')](handleError(_0xfcb278,null));};exports[_0x8eda('0x3e')]=function(_0x3e4242,_0x370ec2){return respondWithRpcPromise(_0x8eda('0x3f'),_0x3e4242[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x370ec2,null))['catch'](handleError(_0x370ec2,null));};exports[_0x8eda('0x40')]=function(_0x142581,_0xabfddb){return respondWithRpcPromise(_0x8eda('0x41'),_0x142581[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0xabfddb,null))['catch'](handleError(_0xabfddb,null));};exports[_0x8eda('0x42')]=function(_0x1b4942,_0x68f9cd){return respondWithRpcPromise('Campaigns',_0x1b4942[_0x8eda('0x17')])['then'](respondWithResult(_0x68f9cd,null))[_0x8eda('0xc')](handleError(_0x68f9cd,null));};exports[_0x8eda('0x43')]=function(_0x12ccb4,_0x582e90){return respondWithRpcPromise(_0x8eda('0x44'),_0x12ccb4[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x582e90,null))['catch'](handleError(_0x582e90,null));};exports[_0x8eda('0x45')]=function(_0xd8a5ba,_0x3a3c5a){return respondWithRpcPromise(_0x8eda('0x44'),_0xd8a5ba[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](findById(_0xd8a5ba[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x3a3c5a,null))[_0x8eda('0xc')](handleError(_0x3a3c5a,null));};exports[_0x8eda('0x46')]=function(_0x482a40,_0x3a9ffb){return respondWithRpcPromise(_0x8eda('0x47'),_0x482a40['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x3a9ffb,null))['catch'](handleError(_0x3a9ffb,null));};exports['showMailQueues']=function(_0x4a3e61,_0x4a26af){return respondWithRpcPromise('MailQueues',_0x4a3e61[_0x8eda('0x17')],routingClient)['then'](findById(_0x4a3e61[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x4a26af,null))[_0x8eda('0xc')](handleError(_0x4a26af,null));};exports[_0x8eda('0x48')]=function(_0x21bd2b,_0x302d82){return respondWithRpcPromise(_0x8eda('0x49'),_0x21bd2b['query'],mailClient)[_0x8eda('0x18')](respondWithResult(_0x302d82,null))['catch'](handleError(_0x302d82,null));};exports[_0x8eda('0x4a')]=function(_0x4ba827,_0xfb98bf){return respondWithRpcPromise('OpenchannelQueues',_0x4ba827[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0xfb98bf,null))[_0x8eda('0xc')](handleError(_0xfb98bf,null));};exports['showOpenchannelQueues']=function(_0x589fbe,_0x55d642){return respondWithRpcPromise(_0x8eda('0x4b'),_0x589fbe[_0x8eda('0x17')],routingClient)['then'](findById(_0x589fbe[_0x8eda('0x1c')]['id']))['then'](respondWithResult(_0x55d642,null))['catch'](handleError(_0x55d642,null));};exports[_0x8eda('0x4c')]=function(_0x375bbe,_0x284065){return respondWithRpcPromise(_0x8eda('0x4d'),_0x375bbe['query'],routingClient)['then'](respondWithResult(_0x284065,null))[_0x8eda('0xc')](handleError(_0x284065,null));};exports[_0x8eda('0x4e')]=function(_0x111177,_0x2119ce){return respondWithRpcPromise('SmsQueues',_0x111177[_0x8eda('0x17')],routingClient)['then'](findById(_0x111177[_0x8eda('0x1c')]['id']))['then'](respondWithResult(_0x2119ce,null))[_0x8eda('0xc')](handleError(_0x2119ce,null));};exports['whatsappQueues']=function(_0x437d35,_0x232e37){return respondWithRpcPromise(_0x8eda('0x4f'),_0x437d35[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x232e37,null))[_0x8eda('0xc')](handleError(_0x232e37,null));};exports[_0x8eda('0x50')]=function(_0x1dfb4f,_0xe32385){return respondWithRpcPromise('WhatsappQueues',_0x1dfb4f['query'],routingClient)[_0x8eda('0x18')](findById(_0x1dfb4f['params']['id']))[_0x8eda('0x18')](respondWithResult(_0xe32385,null))[_0x8eda('0xc')](handleError(_0xe32385,null));};exports[_0x8eda('0x51')]=function(_0x2ca608,_0x1729a8){return respondWithRpcPromise('FaxQueues',_0x2ca608['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x1729a8,null))[_0x8eda('0xc')](handleError(_0x1729a8,null));};exports[_0x8eda('0x52')]=function(_0xc6a2d8,_0x24953a){return respondWithRpcPromise(_0x8eda('0x53'),_0xc6a2d8[_0x8eda('0x17')],routingClient)['then'](findById(_0xc6a2d8[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x24953a,null))['catch'](handleError(_0x24953a,null));};exports[_0x8eda('0x54')]=function(_0x5467e9,_0x47f57c){return respondWithRpcPromise('FaxAccounts',_0x5467e9['query'])[_0x8eda('0x18')](respondWithResult(_0x47f57c,null))[_0x8eda('0xc')](handleError(_0x47f57c,null));};exports[_0x8eda('0x55')]=function(_0xb3bb07,_0xa3e405){return respondWithRpcPromise(_0x8eda('0x56'),_0xb3bb07['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0xa3e405,null))[_0x8eda('0xc')](handleError(_0xa3e405,null));};exports[_0x8eda('0x57')]=function(_0x3f5d3d,_0x4a1e6c){return respondWithRpcPromise(_0x8eda('0x58'),_0x3f5d3d[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x4a1e6c,null))[_0x8eda('0xc')](handleError(_0x4a1e6c,null));};exports[_0x8eda('0x59')]=function(_0x3167e1,_0x4ef854){return respondWithRpcPromise(_0x8eda('0x5a'),_0x3167e1[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x4ef854,null))[_0x8eda('0xc')](handleError(_0x4ef854,null));};exports[_0x8eda('0x5b')]=function(_0x34a5c8,_0x127d98){return respondWithRpcPromise(_0x8eda('0x5a'),_0x34a5c8[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](function(_0x2bdceb){if(_0x34a5c8[_0x8eda('0x17')][_0x8eda('0x5c')]!==undefined){var _0x3d823e=_(_0x2bdceb['rows'])['filter']([_0x34a5c8[_0x8eda('0x17')][_0x8eda('0x5c')],_0x34a5c8[_0x8eda('0x1c')]['id']])[_0x8eda('0x5d')]('queue_id')[_0x8eda('0x5e')]()[_0x8eda('0x5f')]();return _0x2bdceb['rows'][_0x8eda('0x60')](function(_0x5f0d26){return _0x3d823e[_0x8eda('0x61')](_0x5f0d26[_0x8eda('0x62')])>-0x1;});}else{return _0x2bdceb[_0x8eda('0x13')]['filter'](function(_0x1165fc){return _0x1165fc[_0x8eda('0x62')]===parseInt(_0x34a5c8[_0x8eda('0x1c')]['id']);});}})['then'](respondWithResult(_0x127d98,null))[_0x8eda('0xc')](handleError(_0x127d98,null));};exports[_0x8eda('0x63')]=function(_0x10fcab,_0x2f30af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x10fcab['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x2f30af,null))[_0x8eda('0xc')](handleError(_0x2f30af,null));};exports[_0x8eda('0x64')]=function(_0xd93d5,_0x49781b){return respondWithRpcPromise(_0x8eda('0x65'),_0xd93d5[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x49781b,null))[_0x8eda('0xc')](handleError(_0x49781b,null));};exports[_0x8eda('0x66')]=function(_0x4fb714,_0x2cec88){return respondWithRpcPromise(_0x8eda('0x67'),_0x4fb714[_0x8eda('0x17')],routingClient)['then'](respondWithResult(_0x2cec88,null))['catch'](handleError(_0x2cec88,null));};exports['queueNotify']=function(_0xcf2ef3){return function(_0x327590,_0x362b22){var _0x4751d6,_0x3c9c51;var _0x325adc=_[_0x8eda('0x68')](_0xcf2ef3);var _0x3f700a=_0xcf2ef3==='chat'?_0x8eda('0x69'):_0x8eda('0x6a');return db[_0x325adc+_0x8eda('0x6b')]['findOne']({'raw':!![],'where':{'id':_0x327590[_0x8eda('0x1c')]['id']}})[_0x8eda('0x18')](function(_0x3095bd){if(_[_0x8eda('0x12')](_0x3095bd)){throw new Error(_0x325adc+_0x8eda('0x6c'));}_0x4751d6=_0x3095bd;return db[_0x325adc+_0x8eda('0x6d')][_0x8eda('0x6e')]({'where':{'id':_0x327590[_0x8eda('0x21')][_0x8eda('0x6f')]},'include':[{'model':db[_0x325adc+_0x8eda('0x70')],'as':_0x8eda('0x70')},{'model':db[_0x325adc+_0x3f700a],'as':'Account'}]});})[_0x8eda('0x18')](function(_0x46c155){if(_[_0x8eda('0x12')](_0x46c155)){throw new Error(_0x325adc+_0x8eda('0x71'));}_0x3c9c51=_0x46c155;return _0x46c155[_0x8eda('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eda('0x18')](function(){var _0x11cbb1={'uniqueid':_0xcf2ef3+'.'+_0x3c9c51['id']+'.'+_0x3c9c51[_0x8eda('0x70')]['id'],'FromUserId':_0x327590[_0x8eda('0x2f')]['id'],'type':_0x8eda('0x73')};_0x11cbb1[_0x325adc+_0x8eda('0x74')]=_0x3c9c51['id'];_0x11cbb1[_0x325adc+'InteractionId']=_0x3c9c51['Interaction']['id'];_0x11cbb1['From'+_0x325adc+_0x3f700a+'Id']=_0x3c9c51[_0x8eda('0x6a')]['id'];_0x11cbb1['To'+_0x325adc+_0x8eda('0x75')]=_0x4751d6['id'];return db[_0x325adc+'TransferReport'][_0x8eda('0x76')](_0x11cbb1);})[_0x8eda('0x18')](function(){return respondWithRpcPromise(_0x8eda('0x77'),{'channel':_0xcf2ef3,'interaction':_0x3c9c51['Interaction'],'message':_0x3c9c51,'account':_0x3c9c51[_0x8eda('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4751d6[_0x8eda('0x10')]+','+(_0x3c9c51['Account'][_0x8eda('0x78')]||0x12c),'interval':_0x8eda('0x79')}]},routingClient);})['then'](respondWithResult(_0x362b22,null))[_0x8eda('0xc')](handleError(_0x362b22,null));};};exports[_0x8eda('0x7a')]=function(_0x355d61,_0x2a1c43){var _0x128cbd,_0x1bac9f;if(_[_0x8eda('0x12')](_0x355d61[_0x8eda('0x21')][_0x8eda('0x7b')])){throw new Error(_0x8eda('0x7c'));}var _0x5566f2=_0x355d61['body']['channel'];var _0x5b64c8=_[_0x8eda('0x68')](_0x5566f2);var _0x768f3f=_0x5566f2===_0x8eda('0x7d')?'Website':_0x8eda('0x6a');return db[_0x8eda('0x7e')][_0x8eda('0x6e')]({'raw':!![],'where':{'id':_0x355d61[_0x8eda('0x1c')]['id'],'role':_0x8eda('0x3a')}})[_0x8eda('0x18')](function(_0x72184a){if(_[_0x8eda('0x12')](_0x72184a)){throw new Error('Agent\x20not\x20found');}_0x128cbd=_0x72184a;return db[_0x5b64c8+'Message'][_0x8eda('0x6e')]({'where':{'id':_0x355d61[_0x8eda('0x21')]['messageId']},'include':[{'model':db[_0x5b64c8+_0x8eda('0x70')],'as':_0x8eda('0x70')},{'model':db[_0x5b64c8+_0x768f3f],'as':_0x8eda('0x6a')}]});})['then'](function(_0x36926f){if(_[_0x8eda('0x12')](_0x36926f)){throw new Error(_0x5b64c8+_0x8eda('0x71'));}_0x1bac9f=_0x36926f;return _0x36926f[_0x8eda('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eda('0x18')](function(){var _0x3c0bc4={'uniqueid':_0x5566f2+'.'+_0x1bac9f['id']+'.'+_0x1bac9f[_0x8eda('0x70')]['id'],'FromUserId':_0x355d61['user']['id'],'type':_0x8eda('0x73'),'ToUserId':_0x128cbd['id']};_0x3c0bc4[_0x5b64c8+_0x8eda('0x74')]=_0x1bac9f['id'];_0x3c0bc4[_0x5b64c8+'InteractionId']=_0x1bac9f['Interaction']['id'];_0x3c0bc4['From'+_0x5b64c8+_0x768f3f+'Id']=_0x1bac9f[_0x8eda('0x6a')]['id'];return db[_0x5b64c8+_0x8eda('0x7f')][_0x8eda('0x76')](_0x3c0bc4);})[_0x8eda('0x18')](function(){return respondWithRpcPromise(_0x8eda('0x77'),{'channel':_0x5566f2,'interaction':_0x1bac9f[_0x8eda('0x70')],'message':_0x1bac9f,'account':_0x1bac9f[_0x8eda('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eda('0x3a'),'appdata':_0x128cbd[_0x8eda('0x10')]+','+(_0x1bac9f[_0x8eda('0x6a')][_0x8eda('0x80')]||0x12c),'interval':_0x8eda('0x79')}]},routingClient);})[_0x8eda('0x18')](respondWithResult(_0x2a1c43,null))[_0x8eda('0xc')](handleError(_0x2a1c43,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c8d1d4d..dcc7097 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 _0xf553=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','get','/:id','show','/:id/run','run','create','update'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xf553,0x10d));var _0x3f55=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf553[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0x3f55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3f55('0x1'));var express=require(_0x3f55('0x2'));var router=express[_0x3f55('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3f55('0x4'));var interaction=require(_0x3f55('0x5'));var config=require(_0x3f55('0x6'));var controller=require(_0x3f55('0x7'));router['get']('/',auth[_0x3f55('0x8')](),controller['index']);router[_0x3f55('0x9')](_0x3f55('0xa'),auth['isAuthenticated'](),controller[_0x3f55('0xb')]);router['get'](_0x3f55('0xc'),auth[_0x3f55('0x8')](),controller[_0x3f55('0xd')]);router['post']('/',auth[_0x3f55('0x8')](),controller[_0x3f55('0xe')]);router['put'](_0x3f55('0xa'),auth[_0x3f55('0x8')](),controller[_0x3f55('0xf')]);router[_0x3f55('0x10')]('/:id',auth[_0x3f55('0x8')](),controller[_0x3f55('0x11')]);module[_0x3f55('0x12')]=router; \ No newline at end of file +var _0xd95b=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','post','create','update','delete','destroy','exports','multer','util'];(function(_0x269c23,_0x289264){var _0x184ecd=function(_0x32756b){while(--_0x32756b){_0x269c23['push'](_0x269c23['shift']());}};_0x184ecd(++_0x289264);}(_0xd95b,0xe5));var _0xbd95=function(_0x59a374,_0x1fd61a){_0x59a374=_0x59a374-0x0;var _0x2b4402=_0xd95b[_0x59a374];return _0x2b4402;};'use strict';var multer=require(_0xbd95('0x0'));var util=require(_0xbd95('0x1'));var path=require(_0xbd95('0x2'));var timeout=require(_0xbd95('0x3'));var express=require(_0xbd95('0x4'));var router=express[_0xbd95('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd95('0x7'));var controller=require(_0xbd95('0x8'));router[_0xbd95('0x9')]('/',auth[_0xbd95('0xa')](),controller[_0xbd95('0xb')]);router[_0xbd95('0x9')](_0xbd95('0xc'),auth[_0xbd95('0xa')](),controller[_0xbd95('0xd')]);router[_0xbd95('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xbd95('0xe')]);router[_0xbd95('0xf')]('/',auth[_0xbd95('0xa')](),controller[_0xbd95('0x10')]);router['put'](_0xbd95('0xc'),auth[_0xbd95('0xa')](),controller[_0xbd95('0x11')]);router[_0xbd95('0x12')](_0xbd95('0xc'),auth[_0xbd95('0xa')](),controller[_0xbd95('0x13')]);module[_0xbd95('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index f0bd42e..c8d9bf4 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 _0x70e4=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','weeks','days','minutes','ENUM','csv','pdf','xlsx','custom','default'];(function(_0xaae99b,_0xa5e251){var _0x138b2f=function(_0x4fee47){while(--_0x4fee47){_0xaae99b['push'](_0xaae99b['shift']());}};_0x138b2f(++_0xa5e251);}(_0x70e4,0x1c9));var _0x470e=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x70e4[_0x476c7];return _0x47ae56;};'use strict';var Sequelize=require(_0x470e('0x0'));module[_0x470e('0x1')]={'name':{'type':Sequelize[_0x470e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x470e('0x2')]},'active':{'type':Sequelize[_0x470e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x470e('0x4')},'startAt':{'type':Sequelize[_0x470e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x470e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x470e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x470e('0x7'),'quarters',_0x470e('0x8'),_0x470e('0x9'),_0x470e('0xa'),'hours',_0x470e('0xb')),'allowNull':![],'defaultValue':_0x470e('0xa')},'output':{'type':Sequelize[_0x470e('0xc')](_0x470e('0xd'),_0x470e('0xe'),_0x470e('0xf')),'allowNull':![],'defaultValue':_0x470e('0xd')},'type':{'type':Sequelize[_0x470e('0xc')](_0x470e('0x10'),_0x470e('0x11')),'allowNull':![],'defaultValue':_0x470e('0x10')},'sendMail':{'type':Sequelize[_0x470e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x470e('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x470e('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x470e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7fbb=['sequelize','exports','STRING','DATE','INTEGER','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','ENUM','custom','BOOLEAN','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7fbb,0xea));var _0xb7fb=function(_0x65ecd5,_0x88e4fe){_0x65ecd5=_0x65ecd5-0x0;var _0x6d57e3=_0x7fbb[_0x65ecd5];return _0x6d57e3;};'use strict';var Sequelize=require(_0xb7fb('0x0'));module[_0xb7fb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb7fb('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xb7fb('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb7fb('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb7fb('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xb7fb('0x5'),_0xb7fb('0x6'),_0xb7fb('0x7'),'days',_0xb7fb('0x8'),_0xb7fb('0x9')),'allowNull':![],'defaultValue':_0xb7fb('0xa')},'output':{'type':Sequelize['ENUM'](_0xb7fb('0xb'),_0xb7fb('0xc'),_0xb7fb('0xd')),'allowNull':![],'defaultValue':_0xb7fb('0xb')},'type':{'type':Sequelize[_0xb7fb('0xe')](_0xb7fb('0xf'),'default'),'allowNull':![],'defaultValue':_0xb7fb('0xf')},'sendMail':{'type':Sequelize[_0xb7fb('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xb7fb('0x2')]},'cc':{'type':Sequelize[_0xb7fb('0x11')]},'bcc':{'type':Sequelize[_0xb7fb('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xb7fb('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d96522b..8d64cfc 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 _0xad73=['bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','stack','name','send','index','map','Schedule','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x4acba6,_0x324108){var _0xf78175=function(_0xeb14ff){while(--_0xeb14ff){_0x4acba6['push'](_0x4acba6['shift']());}};_0xf78175(++_0x324108);}(_0xad73,0x147));var _0x3ad7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad73[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3ad7('0x0'));var rimraf=require(_0x3ad7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ad7('0x2'));var rp=require(_0x3ad7('0x3'));var moment=require(_0x3ad7('0x4'));var BPromise=require(_0x3ad7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3ad7('0x6'));var sox=require('sox');var csv=require(_0x3ad7('0x7'));var ejs=require(_0x3ad7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ad7('0x9'));var squel=require(_0x3ad7('0xa'));var crypto=require(_0x3ad7('0xb'));var jsforce=require(_0x3ad7('0xc'));var deskjs=require(_0x3ad7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ad7('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ad7('0xf'));var authService=require(_0x3ad7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ad7('0x11'));var hardwareService=require(_0x3ad7('0x12'));var logger=require('../../config/logger')(_0x3ad7('0x13'));var utils=require(_0x3ad7('0x14'));var config=require(_0x3ad7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1db7,_0x1b280d){_0x1b280d=_0x1b280d||0xcc;return function(_0xe003b9){if(_0xe003b9){return _0x4d1db7[_0x3ad7('0x16')](_0x1b280d);}return _0x4d1db7['status'](_0x1b280d)[_0x3ad7('0x17')]();};}function respondWithResult(_0x5df515,_0x25a710){_0x25a710=_0x25a710||0xc8;return function(_0x4efa6f){if(_0x4efa6f){return _0x5df515[_0x3ad7('0x18')](_0x25a710)[_0x3ad7('0x19')](_0x4efa6f);}};}function respondWithFilteredResult(_0x517757,_0x5d2447){return function(_0x3500e3){if(_0x3500e3){var _0x3840cf=typeof _0x5d2447[_0x3ad7('0x1a')]===_0x3ad7('0x1b')&&typeof _0x5d2447['limit']===_0x3ad7('0x1b');var _0x16caa1=_0x3500e3[_0x3ad7('0x1c')];var _0x124912=_0x3840cf?0x0:_0x5d2447[_0x3ad7('0x1a')];var _0x1456b4=_0x3840cf?_0x3500e3[_0x3ad7('0x1c')]:_0x5d2447[_0x3ad7('0x1a')]+_0x5d2447['limit'];var _0x479347;if(_0x1456b4>=_0x16caa1){_0x1456b4=_0x16caa1;_0x479347=0xc8;}else{_0x479347=0xce;}_0x517757[_0x3ad7('0x18')](_0x479347);return _0x517757[_0x3ad7('0x1d')](_0x3ad7('0x1e'),_0x124912+'-'+_0x1456b4+'/'+_0x16caa1)[_0x3ad7('0x19')](_0x3500e3);}return null;};}function patchUpdates(_0x443486){return function(_0x1dd8a5){try{jsonpatch['apply'](_0x1dd8a5,_0x443486,!![]);}catch(_0x4e33d4){return BPromise[_0x3ad7('0x1f')](_0x4e33d4);}return _0x1dd8a5[_0x3ad7('0x20')]();};}function saveUpdates(_0x27a0fd,_0x2593a0){return function(_0x102dc1){if(_0x102dc1){return _0x102dc1[_0x3ad7('0x21')](_0x27a0fd)[_0x3ad7('0x22')](function(_0x46d6fb){return _0x46d6fb;});}return null;};}function removeEntity(_0x2b6c34,_0xb3c72e){return function(_0x2dd31b){if(_0x2dd31b){return _0x2dd31b[_0x3ad7('0x23')]()[_0x3ad7('0x22')](function(){var _0x565466=_0x2dd31b[_0x3ad7('0x24')]({'plain':!![]});var _0x779f94='Scheduler';return db['UserProfileResource'][_0x3ad7('0x23')]({'where':{'type':_0x779f94,'resourceId':_0x565466['id']}})[_0x3ad7('0x22')](function(){return _0x2dd31b;});})[_0x3ad7('0x22')](function(){_0x2b6c34[_0x3ad7('0x18')](0xcc)[_0x3ad7('0x17')]();});}};}function handleEntityNotFound(_0x4f62e6,_0x213894){return function(_0x1f5a89){if(!_0x1f5a89){_0x4f62e6['sendStatus'](0x194);}return _0x1f5a89;};}function handleError(_0x3612d2,_0x5bd07f){_0x5bd07f=_0x5bd07f||0x1f4;return function(_0x3d1f84){logger['error'](_0x3d1f84[_0x3ad7('0x25')]);if(_0x3d1f84[_0x3ad7('0x26')]){delete _0x3d1f84[_0x3ad7('0x26')];}_0x3612d2[_0x3ad7('0x18')](_0x5bd07f)[_0x3ad7('0x27')](_0x3d1f84);};}exports[_0x3ad7('0x28')]=function(_0x111e0c,_0x3cc822){var _0x403b72={},_0x51ba18={},_0x189ff0={'count':0x0,'rows':[]};var _0x33080c=_[_0x3ad7('0x29')](db[_0x3ad7('0x2a')]['rawAttributes'],function(_0x50e972){return{'name':_0x50e972['fieldName'],'type':_0x50e972[_0x3ad7('0x2b')][_0x3ad7('0x2c')]};});_0x51ba18[_0x3ad7('0x2d')]=_['map'](_0x33080c,_0x3ad7('0x26'));_0x51ba18[_0x3ad7('0x2e')]=_[_0x3ad7('0x2f')](_0x111e0c[_0x3ad7('0x2e')]);_0x51ba18[_0x3ad7('0x30')]=_[_0x3ad7('0x31')](_0x51ba18[_0x3ad7('0x2d')],_0x51ba18[_0x3ad7('0x2e')]);_0x403b72[_0x3ad7('0x32')]=_[_0x3ad7('0x31')](_0x51ba18['model'],qs['fields'](_0x111e0c[_0x3ad7('0x2e')][_0x3ad7('0x33')]));_0x403b72['attributes']=_0x403b72['attributes'][_0x3ad7('0x34')]?_0x403b72[_0x3ad7('0x32')]:_0x51ba18[_0x3ad7('0x2d')];if(!_0x111e0c[_0x3ad7('0x2e')][_0x3ad7('0x35')](_0x3ad7('0x36'))){_0x403b72['limit']=qs[_0x3ad7('0x37')](_0x111e0c[_0x3ad7('0x2e')][_0x3ad7('0x37')]);_0x403b72['offset']=qs[_0x3ad7('0x1a')](_0x111e0c[_0x3ad7('0x2e')][_0x3ad7('0x1a')]);}_0x403b72['order']=qs[_0x3ad7('0x38')](_0x111e0c[_0x3ad7('0x2e')][_0x3ad7('0x38')]);_0x403b72[_0x3ad7('0x39')]=qs[_0x3ad7('0x30')](_[_0x3ad7('0x3a')](_0x111e0c[_0x3ad7('0x2e')],_0x51ba18[_0x3ad7('0x30')]),_0x33080c);if(_0x111e0c[_0x3ad7('0x2e')][_0x3ad7('0x3b')]){_0x403b72[_0x3ad7('0x39')]=_[_0x3ad7('0x3c')](_0x403b72[_0x3ad7('0x39')],{'$or':_[_0x3ad7('0x29')](_0x33080c,function(_0xcddc5){if(_0xcddc5[_0x3ad7('0x2b')]!==_0x3ad7('0x3d')){var _0x5c0a0e={};_0x5c0a0e[_0xcddc5['name']]={'$like':'%'+_0x111e0c['query'][_0x3ad7('0x3b')]+'%'};return _0x5c0a0e;}})});}_0x403b72=_['merge']({},_0x403b72,_0x111e0c['options']);var _0xe3f9bb={'where':_0x403b72[_0x3ad7('0x39')]};return db['Schedule'][_0x3ad7('0x1c')](_0xe3f9bb)['then'](function(_0x310807){_0x189ff0[_0x3ad7('0x1c')]=_0x310807;if(_0x111e0c[_0x3ad7('0x2e')]['includeAll']){_0x403b72['include']=[{'all':!![]}];}return db[_0x3ad7('0x2a')][_0x3ad7('0x3e')](_0x403b72);})[_0x3ad7('0x22')](function(_0x20c440){_0x189ff0[_0x3ad7('0x3f')]=_0x20c440;return _0x189ff0;})[_0x3ad7('0x22')](respondWithFilteredResult(_0x3cc822,_0x403b72))[_0x3ad7('0x40')](handleError(_0x3cc822,null));};exports[_0x3ad7('0x41')]=function(_0x5eee5e,_0x31eb35){var _0x2325d6={'raw':![],'where':{'id':_0x5eee5e[_0x3ad7('0x42')]['id']}},_0x47e38a={};_0x47e38a[_0x3ad7('0x2d')]=_[_0x3ad7('0x2f')](db[_0x3ad7('0x2a')][_0x3ad7('0x43')]);_0x47e38a[_0x3ad7('0x2e')]=_[_0x3ad7('0x2f')](_0x5eee5e['query']);_0x47e38a[_0x3ad7('0x30')]=_[_0x3ad7('0x31')](_0x47e38a['model'],_0x47e38a[_0x3ad7('0x2e')]);_0x2325d6[_0x3ad7('0x32')]=_[_0x3ad7('0x31')](_0x47e38a[_0x3ad7('0x2d')],qs['fields'](_0x5eee5e[_0x3ad7('0x2e')][_0x3ad7('0x33')]));_0x2325d6[_0x3ad7('0x32')]=_0x2325d6[_0x3ad7('0x32')]['length']?_0x2325d6[_0x3ad7('0x32')]:_0x47e38a[_0x3ad7('0x2d')];if(_0x5eee5e[_0x3ad7('0x2e')]['includeAll']){_0x2325d6[_0x3ad7('0x44')]=[{'all':!![]}];}_0x2325d6=_[_0x3ad7('0x3c')]({},_0x2325d6,_0x5eee5e['options']);return db[_0x3ad7('0x2a')][_0x3ad7('0x45')](_0x2325d6)[_0x3ad7('0x22')](handleEntityNotFound(_0x31eb35,null))['then'](respondWithResult(_0x31eb35,null))[_0x3ad7('0x40')](handleError(_0x31eb35,null));};exports[_0x3ad7('0x46')]=function(_0x4494e6,_0x2d5c45){return db[_0x3ad7('0x2a')][_0x3ad7('0x46')](_0x4494e6[_0x3ad7('0x47')],{})[_0x3ad7('0x22')](function(_0x43c2b5){var _0x48b560=_0x4494e6[_0x3ad7('0x48')][_0x3ad7('0x24')]({'plain':!![]});if(!_0x48b560)throw new Error(_0x3ad7('0x49'));if(_0x48b560[_0x3ad7('0x4a')]===_0x3ad7('0x48')){var _0x275add=_0x43c2b5[_0x3ad7('0x24')]({'plain':!![]});var _0x1f20d6=_0x3ad7('0x4b');return db[_0x3ad7('0x4c')][_0x3ad7('0x45')]({'where':{'name':_0x1f20d6,'userProfileId':_0x48b560[_0x3ad7('0x4d')]},'raw':!![]})['then'](function(_0xd9a9d9){if(_0xd9a9d9&&_0xd9a9d9[_0x3ad7('0x4e')]===0x0){return db[_0x3ad7('0x4f')][_0x3ad7('0x46')]({'name':_0x275add[_0x3ad7('0x26')],'resourceId':_0x275add['id'],'type':_0xd9a9d9[_0x3ad7('0x26')],'sectionId':_0xd9a9d9['id']},{})[_0x3ad7('0x22')](function(){return _0x43c2b5;});}else{return _0x43c2b5;}})[_0x3ad7('0x40')](function(_0x12673d){logger[_0x3ad7('0x50')](_0x3ad7('0x51'),_0x12673d);throw _0x12673d;});}return _0x43c2b5;})[_0x3ad7('0x22')](respondWithResult(_0x2d5c45,0xc9))[_0x3ad7('0x40')](handleError(_0x2d5c45,null));};exports[_0x3ad7('0x21')]=function(_0x54c1df,_0x406f31){if(_0x54c1df['body']['id']){delete _0x54c1df['body']['id'];}return db[_0x3ad7('0x2a')]['find']({'where':{'id':_0x54c1df[_0x3ad7('0x42')]['id']}})[_0x3ad7('0x22')](handleEntityNotFound(_0x406f31,null))['then'](saveUpdates(_0x54c1df[_0x3ad7('0x47')],null))[_0x3ad7('0x22')](respondWithResult(_0x406f31,null))[_0x3ad7('0x40')](handleError(_0x406f31,null));};exports[_0x3ad7('0x23')]=function(_0x561d0c,_0x10981a){return db[_0x3ad7('0x2a')][_0x3ad7('0x45')]({'where':{'id':_0x561d0c[_0x3ad7('0x42')]['id']}})[_0x3ad7('0x22')](handleEntityNotFound(_0x10981a,null))[_0x3ad7('0x22')](removeEntity(_0x10981a,null))['catch'](handleError(_0x10981a,null));};exports['run']=function(_0x1b28f7,_0x12b6b9,_0xc32894){var _0x522122=require('../../config/schedule');return db[_0x3ad7('0x2a')][_0x3ad7('0x45')]({'where':{'id':_0x1b28f7[_0x3ad7('0x42')]['id']},'raw':!![]})[_0x3ad7('0x22')](handleEntityNotFound(_0x12b6b9,null))[_0x3ad7('0x22')](function(){_0x522122[_0x3ad7('0x52')](_0x1b28f7[_0x3ad7('0x42')]['id']);})['then'](respondWithStatusCode(_0x12b6b9,null))[_0x3ad7('0x40')](handleError(_0x12b6b9,null));}; \ No newline at end of file +var _0x35ab=['intersection','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','destroy','run','../../config/schedule','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','type','key','model','map','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','keys'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x35ab,0xad));var _0xb35a=function(_0x19cc8f,_0x1a40ea){_0x19cc8f=_0x19cc8f-0x0;var _0x2e3d66=_0x35ab[_0x19cc8f];return _0x2e3d66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb35a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb35a('0x1'));var rp=require('request-promise');var moment=require(_0xb35a('0x2'));var BPromise=require(_0xb35a('0x3'));var Mustache=require(_0xb35a('0x4'));var util=require(_0xb35a('0x5'));var path=require(_0xb35a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb35a('0x7'));var fs=require('fs');var fs_extra=require(_0xb35a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb35a('0x9'));var jsforce=require(_0xb35a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb35a('0xb'));var querystring=require(_0xb35a('0xc'));var Papa=require(_0xb35a('0xd'));var Redis=require(_0xb35a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb35a('0xf'));var hardwareService=require(_0xb35a('0x10'));var logger=require(_0xb35a('0x11'))(_0xb35a('0x12'));var utils=require(_0xb35a('0x13'));var config=require(_0xb35a('0x14'));var licenseUtil=require(_0xb35a('0x15'));var db=require(_0xb35a('0x16'))['db'];function respondWithStatusCode(_0x351ef3,_0x5281a8){_0x5281a8=_0x5281a8||0xcc;return function(_0x3a5c57){if(_0x3a5c57){return _0x351ef3['sendStatus'](_0x5281a8);}return _0x351ef3[_0xb35a('0x17')](_0x5281a8)[_0xb35a('0x18')]();};}function respondWithResult(_0xfbdbd4,_0x2e42fb){_0x2e42fb=_0x2e42fb||0xc8;return function(_0x26b4a6){if(_0x26b4a6){return _0xfbdbd4['status'](_0x2e42fb)['json'](_0x26b4a6);}};}function respondWithFilteredResult(_0x22244c,_0x4c21ad){return function(_0x446d40){if(_0x446d40){var _0x15d275=typeof _0x4c21ad['offset']===_0xb35a('0x19')&&typeof _0x4c21ad[_0xb35a('0x1a')]===_0xb35a('0x19');var _0x33f20a=_0x446d40[_0xb35a('0x1b')];var _0xb3f1b3=_0x15d275?0x0:_0x4c21ad[_0xb35a('0x1c')];var _0x1e61da=_0x15d275?_0x446d40[_0xb35a('0x1b')]:_0x4c21ad['offset']+_0x4c21ad['limit'];var _0x1484d4;if(_0x1e61da>=_0x33f20a){_0x1e61da=_0x33f20a;_0x1484d4=0xc8;}else{_0x1484d4=0xce;}_0x22244c[_0xb35a('0x17')](_0x1484d4);return _0x22244c['set'](_0xb35a('0x1d'),_0xb3f1b3+'-'+_0x1e61da+'/'+_0x33f20a)[_0xb35a('0x1e')](_0x446d40);}return null;};}function patchUpdates(_0x5e6a6c){return function(_0x531690){try{jsonpatch[_0xb35a('0x1f')](_0x531690,_0x5e6a6c,!![]);}catch(_0x1b36e5){return BPromise['reject'](_0x1b36e5);}return _0x531690[_0xb35a('0x20')]();};}function saveUpdates(_0x475fb6,_0x57e15d){return function(_0x19cd10){if(_0x19cd10){return _0x19cd10[_0xb35a('0x21')](_0x475fb6)[_0xb35a('0x22')](function(_0x264282){return _0x264282;});}return null;};}function removeEntity(_0x462345,_0x30242f){return function(_0x286ce0){if(_0x286ce0){return _0x286ce0['destroy']()[_0xb35a('0x22')](function(){var _0x488304=_0x286ce0['get']({'plain':!![]});var _0x1b4557=_0xb35a('0x23');return db[_0xb35a('0x24')]['destroy']({'where':{'type':_0x1b4557,'resourceId':_0x488304['id']}})['then'](function(){return _0x286ce0;});})[_0xb35a('0x22')](function(){_0x462345[_0xb35a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e54b5,_0x16afeb){return function(_0x18882e){if(!_0x18882e){_0x3e54b5[_0xb35a('0x25')](0x194);}return _0x18882e;};}function handleError(_0x468d89,_0x292907){_0x292907=_0x292907||0x1f4;return function(_0x310eb3){logger[_0xb35a('0x26')](_0x310eb3[_0xb35a('0x27')]);if(_0x310eb3[_0xb35a('0x28')]){delete _0x310eb3[_0xb35a('0x28')];}_0x468d89[_0xb35a('0x17')](_0x292907)[_0xb35a('0x29')](_0x310eb3);};}exports[_0xb35a('0x2a')]=function(_0x22b3be,_0x2cfce5){var _0x25e964={},_0x2edb8d={},_0x1be565={'count':0x0,'rows':[]};var _0x2bd091=_['map'](db[_0xb35a('0x2b')][_0xb35a('0x2c')],function(_0x3bc50a){return{'name':_0x3bc50a['fieldName'],'type':_0x3bc50a[_0xb35a('0x2d')][_0xb35a('0x2e')]};});_0x2edb8d[_0xb35a('0x2f')]=_[_0xb35a('0x30')](_0x2bd091,_0xb35a('0x28'));_0x2edb8d[_0xb35a('0x31')]=_['keys'](_0x22b3be[_0xb35a('0x31')]);_0x2edb8d[_0xb35a('0x32')]=_['intersection'](_0x2edb8d[_0xb35a('0x2f')],_0x2edb8d[_0xb35a('0x31')]);_0x25e964[_0xb35a('0x33')]=_['intersection'](_0x2edb8d[_0xb35a('0x2f')],qs[_0xb35a('0x34')](_0x22b3be[_0xb35a('0x31')][_0xb35a('0x34')]));_0x25e964[_0xb35a('0x33')]=_0x25e964[_0xb35a('0x33')]['length']?_0x25e964['attributes']:_0x2edb8d[_0xb35a('0x2f')];if(!_0x22b3be['query']['hasOwnProperty'](_0xb35a('0x35'))){_0x25e964['limit']=qs['limit'](_0x22b3be[_0xb35a('0x31')][_0xb35a('0x1a')]);_0x25e964[_0xb35a('0x1c')]=qs['offset'](_0x22b3be[_0xb35a('0x31')]['offset']);}_0x25e964[_0xb35a('0x36')]=qs[_0xb35a('0x37')](_0x22b3be[_0xb35a('0x31')][_0xb35a('0x37')]);_0x25e964[_0xb35a('0x38')]=qs[_0xb35a('0x32')](_[_0xb35a('0x39')](_0x22b3be[_0xb35a('0x31')],_0x2edb8d[_0xb35a('0x32')]),_0x2bd091);if(_0x22b3be['query'][_0xb35a('0x3a')]){_0x25e964[_0xb35a('0x38')]=_[_0xb35a('0x3b')](_0x25e964[_0xb35a('0x38')],{'$or':_[_0xb35a('0x30')](_0x2bd091,function(_0x393ba9){if(_0x393ba9[_0xb35a('0x2d')]!==_0xb35a('0x3c')){var _0x311e7c={};_0x311e7c[_0x393ba9[_0xb35a('0x28')]]={'$like':'%'+_0x22b3be[_0xb35a('0x31')]['filter']+'%'};return _0x311e7c;}})});}_0x25e964=_[_0xb35a('0x3b')]({},_0x25e964,_0x22b3be['options']);var _0x3aba21={'where':_0x25e964[_0xb35a('0x38')]};return db[_0xb35a('0x2b')]['count'](_0x3aba21)[_0xb35a('0x22')](function(_0x5530e3){_0x1be565[_0xb35a('0x1b')]=_0x5530e3;if(_0x22b3be[_0xb35a('0x31')][_0xb35a('0x3d')]){_0x25e964[_0xb35a('0x3e')]=[{'all':!![]}];}return db[_0xb35a('0x2b')][_0xb35a('0x3f')](_0x25e964);})[_0xb35a('0x22')](function(_0xe81284){_0x1be565['rows']=_0xe81284;return _0x1be565;})[_0xb35a('0x22')](respondWithFilteredResult(_0x2cfce5,_0x25e964))[_0xb35a('0x40')](handleError(_0x2cfce5,null));};exports['show']=function(_0x7e34d4,_0x33b945){var _0x42723d={'raw':![],'where':{'id':_0x7e34d4[_0xb35a('0x41')]['id']}},_0x3e7088={};_0x3e7088[_0xb35a('0x2f')]=_['keys'](db[_0xb35a('0x2b')][_0xb35a('0x2c')]);_0x3e7088[_0xb35a('0x31')]=_[_0xb35a('0x42')](_0x7e34d4[_0xb35a('0x31')]);_0x3e7088['filters']=_[_0xb35a('0x43')](_0x3e7088[_0xb35a('0x2f')],_0x3e7088[_0xb35a('0x31')]);_0x42723d[_0xb35a('0x33')]=_[_0xb35a('0x43')](_0x3e7088[_0xb35a('0x2f')],qs['fields'](_0x7e34d4[_0xb35a('0x31')][_0xb35a('0x34')]));_0x42723d[_0xb35a('0x33')]=_0x42723d[_0xb35a('0x33')][_0xb35a('0x44')]?_0x42723d[_0xb35a('0x33')]:_0x3e7088[_0xb35a('0x2f')];if(_0x7e34d4['query']['includeAll']){_0x42723d[_0xb35a('0x3e')]=[{'all':!![]}];}_0x42723d=_[_0xb35a('0x3b')]({},_0x42723d,_0x7e34d4['options']);return db[_0xb35a('0x2b')][_0xb35a('0x45')](_0x42723d)[_0xb35a('0x22')](handleEntityNotFound(_0x33b945,null))['then'](respondWithResult(_0x33b945,null))[_0xb35a('0x40')](handleError(_0x33b945,null));};exports[_0xb35a('0x46')]=function(_0x37186f,_0x1a59cc){return db['Schedule']['create'](_0x37186f[_0xb35a('0x47')],{})[_0xb35a('0x22')](function(_0x325cb5){var _0x2a0445=_0x37186f[_0xb35a('0x48')][_0xb35a('0x49')]({'plain':!![]});if(!_0x2a0445)throw new Error(_0xb35a('0x4a'));if(_0x2a0445['role']===_0xb35a('0x48')){var _0x47033=_0x325cb5['get']({'plain':!![]});var _0x5b7952=_0xb35a('0x23');return db['UserProfileSection'][_0xb35a('0x45')]({'where':{'name':_0x5b7952,'userProfileId':_0x2a0445[_0xb35a('0x4b')]},'raw':!![]})[_0xb35a('0x22')](function(_0x4e4bd1){if(_0x4e4bd1&&_0x4e4bd1[_0xb35a('0x4c')]===0x0){return db[_0xb35a('0x24')][_0xb35a('0x46')]({'name':_0x47033[_0xb35a('0x28')],'resourceId':_0x47033['id'],'type':_0x4e4bd1['name'],'sectionId':_0x4e4bd1['id']},{})[_0xb35a('0x22')](function(){return _0x325cb5;});}else{return _0x325cb5;}})[_0xb35a('0x40')](function(_0x167708){logger[_0xb35a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x167708);throw _0x167708;});}return _0x325cb5;})[_0xb35a('0x22')](respondWithResult(_0x1a59cc,0xc9))['catch'](handleError(_0x1a59cc,null));};exports[_0xb35a('0x21')]=function(_0x22f6e6,_0x2645fe){if(_0x22f6e6[_0xb35a('0x47')]['id']){delete _0x22f6e6[_0xb35a('0x47')]['id'];}return db['Schedule'][_0xb35a('0x45')]({'where':{'id':_0x22f6e6[_0xb35a('0x41')]['id']}})[_0xb35a('0x22')](handleEntityNotFound(_0x2645fe,null))[_0xb35a('0x22')](saveUpdates(_0x22f6e6[_0xb35a('0x47')],null))[_0xb35a('0x22')](respondWithResult(_0x2645fe,null))[_0xb35a('0x40')](handleError(_0x2645fe,null));};exports[_0xb35a('0x4d')]=function(_0x2aa7de,_0x50ba90){return db['Schedule'][_0xb35a('0x45')]({'where':{'id':_0x2aa7de[_0xb35a('0x41')]['id']}})['then'](handleEntityNotFound(_0x50ba90,null))['then'](removeEntity(_0x50ba90,null))[_0xb35a('0x40')](handleError(_0x50ba90,null));};exports[_0xb35a('0x4e')]=function(_0x50dd44,_0x55525c,_0x6343c9){var _0x18fd15=require(_0xb35a('0x4f'));return db[_0xb35a('0x2b')][_0xb35a('0x45')]({'where':{'id':_0x50dd44[_0xb35a('0x41')]['id']},'raw':!![]})[_0xb35a('0x22')](handleEntityNotFound(_0x55525c,null))[_0xb35a('0x22')](function(){_0x18fd15['run'](_0x50dd44['params']['id']);})[_0xb35a('0x22')](respondWithStatusCode(_0x55525c,null))[_0xb35a('0x40')](handleError(_0x55525c,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7041d14..4620a10 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 _0x4df5=['api','moment','bluebird','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','../../config/logger'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x4df5,0x174));var _0x54df=function(_0x48d7e5,_0x3de86d){_0x48d7e5=_0x48d7e5-0x0;var _0x32a390=_0x4df5[_0x48d7e5];return _0x32a390;};'use strict';var _=require(_0x54df('0x0'));var util=require('util');var logger=require(_0x54df('0x1'))(_0x54df('0x2'));var moment=require(_0x54df('0x3'));var BPromise=require(_0x54df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54df('0x5'));var config=require(_0x54df('0x6'));var attributes=require(_0x54df('0x7'));module[_0x54df('0x8')]=function(_0x494ed0,_0x2a2e89){return _0x494ed0['define'](_0x54df('0x9'),attributes,{'tableName':_0x54df('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x755c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash'];(function(_0x36684b,_0x25725f){var _0xdd1f83=function(_0x4b219b){while(--_0x4b219b){_0x36684b['push'](_0x36684b['shift']());}};_0xdd1f83(++_0x25725f);}(_0x755c,0x77));var _0xc755=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x755c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc755('0x0'));var util=require('util');var logger=require(_0xc755('0x1'))(_0xc755('0x2'));var moment=require(_0xc755('0x3'));var BPromise=require(_0xc755('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc755('0x5'));var rimraf=require(_0xc755('0x6'));var config=require(_0xc755('0x7'));var attributes=require(_0xc755('0x8'));module[_0xc755('0x9')]=function(_0x2ca7d2,_0xe5eb77){return _0x2ca7d2['define'](_0xc755('0xa'),attributes,{'tableName':_0xc755('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 58a093e..301dd9d 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 _0x5b36=['request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x23f05c,_0x4a58){var _0x12f889=function(_0x4ecd99){while(--_0x4ecd99){_0x23f05c['push'](_0x23f05c['shift']());}};_0x12f889(++_0x4a58);}(_0x5b36,0xd0));var _0x65b3=function(_0xb6f397,_0x339495){_0xb6f397=_0xb6f397-0x0;var _0x49f176=_0x5b36[_0xb6f397];return _0x49f176;};'use strict';var _=require(_0x65b3('0x0'));var util=require(_0x65b3('0x1'));var moment=require(_0x65b3('0x2'));var BPromise=require(_0x65b3('0x3'));var rs=require(_0x65b3('0x4'));var fs=require('fs');var Redis=require(_0x65b3('0x5'));var db=require(_0x65b3('0x6'))['db'];var utils=require(_0x65b3('0x7'));var logger=require(_0x65b3('0x8'))(_0x65b3('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x65b3('0xa')][_0x65b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b5f5a,_0x355e44,_0x25ad3d){return new BPromise(function(_0x245f48,_0x4ffac8){return client[_0x65b3('0xc')](_0x2b5f5a,_0x25ad3d)['then'](function(_0x103ef9){logger[_0x65b3('0xd')](_0x65b3('0xe'),_0x355e44,_0x65b3('0xf'));logger['debug'](_0x65b3('0x10'),_0x355e44,_0x65b3('0xf'),JSON[_0x65b3('0x11')](_0x103ef9));if(_0x103ef9[_0x65b3('0x12')]){if(_0x103ef9['error']['code']===0x1f4){logger[_0x65b3('0x12')]('Schedule,\x20%s,\x20%s',_0x355e44,_0x103ef9[_0x65b3('0x12')][_0x65b3('0x13')]);return _0x4ffac8(_0x103ef9[_0x65b3('0x12')][_0x65b3('0x13')]);}logger[_0x65b3('0x12')](_0x65b3('0xe'),_0x355e44,_0x103ef9['error'][_0x65b3('0x13')]);return _0x245f48(_0x103ef9[_0x65b3('0x12')][_0x65b3('0x13')]);}else{logger[_0x65b3('0xd')](_0x65b3('0xe'),_0x355e44,'request\x20sent');_0x245f48(_0x103ef9[_0x65b3('0x14')][_0x65b3('0x13')]);}})[_0x65b3('0x15')](function(_0x1512cc){logger[_0x65b3('0x12')](_0x65b3('0xe'),_0x355e44,_0x1512cc);_0x4ffac8(_0x1512cc);});});} \ No newline at end of file +var _0xd776=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s'];(function(_0xe705ab,_0x1f8b00){var _0x538fa5=function(_0x44fd6e){while(--_0x44fd6e){_0xe705ab['push'](_0xe705ab['shift']());}};_0x538fa5(++_0x1f8b00);}(_0xd776,0x13f));var _0x6d77=function(_0x141307,_0x7694e9){_0x141307=_0x141307-0x0;var _0x32b59e=_0xd776[_0x141307];return _0x32b59e;};'use strict';var _=require(_0x6d77('0x0'));var util=require(_0x6d77('0x1'));var moment=require(_0x6d77('0x2'));var BPromise=require(_0x6d77('0x3'));var rs=require(_0x6d77('0x4'));var fs=require('fs');var Redis=require(_0x6d77('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d77('0x6'));var logger=require('../../config/logger')(_0x6d77('0x7'));var config=require(_0x6d77('0x8'));var jayson=require(_0x6d77('0x9'));var client=jayson[_0x6d77('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32871a,_0xb6b79e,_0x18e14f){return new BPromise(function(_0x5e6407,_0x3d1f47){return client[_0x6d77('0xb')](_0x32871a,_0x18e14f)[_0x6d77('0xc')](function(_0xc48d84){logger[_0x6d77('0xd')](_0x6d77('0xe'),_0xb6b79e,'request\x20sent');logger[_0x6d77('0xf')](_0x6d77('0x10'),_0xb6b79e,_0x6d77('0x11'),JSON[_0x6d77('0x12')](_0xc48d84));if(_0xc48d84[_0x6d77('0x13')]){if(_0xc48d84[_0x6d77('0x13')][_0x6d77('0x14')]===0x1f4){logger['error'](_0x6d77('0xe'),_0xb6b79e,_0xc48d84['error'][_0x6d77('0x15')]);return _0x3d1f47(_0xc48d84['error']['message']);}logger[_0x6d77('0x13')](_0x6d77('0xe'),_0xb6b79e,_0xc48d84['error'][_0x6d77('0x15')]);return _0x5e6407(_0xc48d84[_0x6d77('0x13')][_0x6d77('0x15')]);}else{logger[_0x6d77('0xd')](_0x6d77('0xe'),_0xb6b79e,_0x6d77('0x11'));_0x5e6407(_0xc48d84[_0x6d77('0x16')]['message']);}})[_0x6d77('0x17')](function(_0x11ec1c){logger[_0x6d77('0x13')](_0x6d77('0xe'),_0xb6b79e,_0x11ec1c);_0x3d1f47(_0x11ec1c);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0ea2327..f3c9b0e 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 _0x4bc9=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','download','post','create','put'];(function(_0x2f26a3,_0x54a7fa){var _0x5825a0=function(_0x1814ab){while(--_0x1814ab){_0x2f26a3['push'](_0x2f26a3['shift']());}};_0x5825a0(++_0x54a7fa);}(_0x4bc9,0xff));var _0x94bc=function(_0x885a10,_0x103938){_0x885a10=_0x885a10-0x0;var _0x22649c=_0x4bc9[_0x885a10];return _0x22649c;};'use strict';var multer=require(_0x94bc('0x0'));var util=require(_0x94bc('0x1'));var path=require(_0x94bc('0x2'));var timeout=require(_0x94bc('0x3'));var express=require(_0x94bc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x94bc('0x5'));var interaction=require(_0x94bc('0x6'));var config=require(_0x94bc('0x7'));var controller=require('./screenRecording.controller');router[_0x94bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x94bc('0x9')]);router[_0x94bc('0x8')](_0x94bc('0xa'),auth['isAuthenticated'](),controller[_0x94bc('0xb')]);router['get'](_0x94bc('0xc'),auth[_0x94bc('0xd')](),controller['show']);router[_0x94bc('0x8')]('/:id/download',auth[_0x94bc('0xd')](),controller[_0x94bc('0xe')]);router[_0x94bc('0xf')]('/',auth[_0x94bc('0xd')](),controller[_0x94bc('0x10')]);router[_0x94bc('0x11')](_0x94bc('0xc'),auth[_0x94bc('0xd')](),controller[_0x94bc('0x12')]);router[_0x94bc('0x13')](_0x94bc('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x94bc('0x14')]=router; \ No newline at end of file +var _0x962a=['/describe','describe','show','get','/:id/download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','isAuthenticated','index'];(function(_0x395b09,_0x11f392){var _0x2a97e2=function(_0x1d8ab4){while(--_0x1d8ab4){_0x395b09['push'](_0x395b09['shift']());}};_0x2a97e2(++_0x11f392);}(_0x962a,0x14f));var _0xa962=function(_0x398157,_0x1953ab){_0x398157=_0x398157-0x0;var _0x356075=_0x962a[_0x398157];return _0x356075;};'use strict';var multer=require(_0xa962('0x0'));var util=require(_0xa962('0x1'));var path=require(_0xa962('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa962('0x3')]();var fs_extra=require(_0xa962('0x4'));var auth=require(_0xa962('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa962('0x6'));var controller=require(_0xa962('0x7'));router['get']('/',auth[_0xa962('0x8')](),controller[_0xa962('0x9')]);router['get'](_0xa962('0xa'),auth['isAuthenticated'](),controller[_0xa962('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa962('0xc')]);router[_0xa962('0xd')](_0xa962('0xe'),auth[_0xa962('0x8')](),controller['download']);router[_0xa962('0xf')]('/',auth[_0xa962('0x8')](),controller[_0xa962('0x10')]);router[_0xa962('0x11')](_0xa962('0x12'),auth['isAuthenticated'](),controller[_0xa962('0x13')]);router[_0xa962('0x14')](_0xa962('0x12'),auth[_0xa962('0x8')](),controller[_0xa962('0x15')]);module[_0xa962('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b35fd9c..e78ce91 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 _0xab54=['setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','STRING','replace'];(function(_0x5a6f9b,_0x3f0261){var _0x5e583a=function(_0x2e5ec2){while(--_0x2e5ec2){_0x5a6f9b['push'](_0x5a6f9b['shift']());}};_0x5e583a(++_0x3f0261);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4ab5('0x0'));var path=require(_0x4ab5('0x1'));var config=require(_0x4ab5('0x2'));module[_0x4ab5('0x3')]={'format':{'type':Sequelize[_0x4ab5('0x4')],'get':function(){return this['getDataValue'](_0x4ab5('0x5'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x4ab5('0x6')]},'channel':{'type':Sequelize[_0x4ab5('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2c39fe){var _0x5c8c61=_0x2c39fe[_0x4ab5('0x7')](/\\/g,'/');this[_0x4ab5('0x8')](_0x4ab5('0x5'),_0x5c8c61);}},'rating':{'type':Sequelize[_0x4ab5('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x58e6a7){this['setDataValue'](_0x4ab5('0xa'),moment()[_0x4ab5('0xb')](_0x58e6a7,'ms'));this['setDataValue'](_0x4ab5('0xc'),moment());this[_0x4ab5('0x8')]('duration',_0x58e6a7);}},'startedAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')](_0x4ab5('0xa')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}},'closedAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')](_0x4ab5('0xc')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}},'createdAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')]('createdAt'))[_0x4ab5('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4ab5('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x4ab5('0x12')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}}}; \ No newline at end of file +var _0x3cae=['toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','format','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','setDataValue','value','INTEGER','startedAt','duration','DATE'];(function(_0x23e207,_0x34850b){var _0x2e25fa=function(_0x41bf81){while(--_0x41bf81){_0x23e207['push'](_0x23e207['shift']());}};_0x2e25fa(++_0x34850b);}(_0x3cae,0x117));var _0xe3ca=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x3cae[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0xe3ca('0x0'));var moment=require(_0xe3ca('0x1'));var path=require(_0xe3ca('0x2'));var config=require(_0xe3ca('0x3'));module[_0xe3ca('0x4')]={'format':{'type':Sequelize[_0xe3ca('0x5')],'get':function(){return this[_0xe3ca('0x6')]('value')?path[_0xe3ca('0x7')](this[_0xe3ca('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xe3ca('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xe3ca('0x8')],'set':function(_0x7fafb4){var _0x36d17a=_0x7fafb4['replace'](/\\/g,'/');this[_0xe3ca('0x9')](_0xe3ca('0xa'),_0x36d17a);}},'rating':{'type':Sequelize[_0xe3ca('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe3ca('0xb')],'set':function(_0x1ae7bf){this[_0xe3ca('0x9')](_0xe3ca('0xc'),moment()['subtract'](_0x1ae7bf,'ms'));this[_0xe3ca('0x9')]('closedAt',moment());this[_0xe3ca('0x9')](_0xe3ca('0xd'),_0x1ae7bf);}},'startedAt':{'type':Sequelize[_0xe3ca('0xe')],'get':function(){return moment(this[_0xe3ca('0x6')](_0xe3ca('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xe3ca('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xe3ca('0x6')](_0xe3ca('0x10')))['format'](_0xe3ca('0x11'))[_0xe3ca('0xf')]();}},'createdAt':{'type':Sequelize[_0xe3ca('0xe')],'get':function(){return moment(this[_0xe3ca('0x6')](_0xe3ca('0x12')))[_0xe3ca('0x13')](_0xe3ca('0x11'))[_0xe3ca('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xe3ca('0x14')))[_0xe3ca('0x13')](_0xe3ca('0x11'))[_0xe3ca('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index fc1a928..34ea203 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 _0x1cb9=['ValidationError','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize'];(function(_0x41d902,_0x29d0b){var _0x360fb1=function(_0x2517ae){while(--_0x2517ae){_0x41d902['push'](_0x41d902['shift']());}};_0x360fb1(++_0x29d0b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x191d19,_0xda734b){_0x191d19=_0x191d19-0x0;var _0x230227=_0x1cb9[_0x191d19];return _0x230227;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x33')](_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29')),[_0x91cb('0x34')]);_0x504275[_0x91cb('0x35')]=_['keys'](_0x3b3ee6[_0x91cb('0x35')]);_0x504275[_0x91cb('0x36')]=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x35')]);_0x468908['attributes']=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x38')]));_0x468908['attributes']=_0x468908[_0x91cb('0x39')]['length']?_0x468908['attributes']:_0x504275['model'];if(!_0x3b3ee6[_0x91cb('0x35')]['hasOwnProperty'](_0x91cb('0x3a'))){_0x468908['limit']=qs['limit'](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x1d')]);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x35')]['offset']);}_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3c')]);_0x468908['where']=qs['filters'](_[_0x91cb('0x3d')](_0x3b3ee6[_0x91cb('0x35')],_0x504275['filters']),_0x52670a);if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]){_0x468908['where']=_[_0x91cb('0x3f')](_0x468908[_0x91cb('0x40')],{'$or':_['map'](_0x52670a,function(_0x43d4fe){if(_0x43d4fe['type']!==_0x91cb('0x41')){var _0xabe6a3={};_0xabe6a3[_0x43d4fe[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]+'%'};return _0xabe6a3;}})});}_0x468908=_[_0x91cb('0x3f')]({},_0x468908,_0x3b3ee6['options']);var _0xa90111={'where':_0x468908[_0x91cb('0x40')]};return db['ScreenRecording'][_0x91cb('0x1e')](_0xa90111)['then'](function(_0x2c6102){_0x2f04a3[_0x91cb('0x1e')]=_0x2c6102;if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x42')]){_0x468908['include']=[{'all':!![]}];}return db[_0x91cb('0x2d')][_0x91cb('0x43')](_0x468908);})[_0x91cb('0x25')](function(_0x37e777){_0x2f04a3[_0x91cb('0x44')]=_0x37e777;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x45')](handleError(_0x2fb473,null));};exports[_0x91cb('0x46')]=function(_0x325dca,_0x3cc4c1){var _0x49bc42={'raw':![],'where':{'id':_0x325dca['params']['id']}},_0x16993f={};_0x16993f[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x16993f[_0x91cb('0x35')]=_[_0x91cb('0x47')](_0x325dca[_0x91cb('0x35')]);_0x16993f[_0x91cb('0x36')]=_['intersection'](_0x16993f[_0x91cb('0x32')],_0x16993f[_0x91cb('0x35')]);_0x49bc42['attributes']=_[_0x91cb('0x37')](_0x16993f[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x325dca[_0x91cb('0x35')][_0x91cb('0x38')]));_0x49bc42[_0x91cb('0x39')]=_0x49bc42[_0x91cb('0x39')][_0x91cb('0x48')]?_0x49bc42[_0x91cb('0x39')]:_0x16993f['model'];if(_0x325dca[_0x91cb('0x35')][_0x91cb('0x42')]){_0x49bc42[_0x91cb('0x49')]=[{'all':!![]}];}_0x49bc42=_[_0x91cb('0x3f')]({},_0x49bc42,_0x325dca[_0x91cb('0x4a')]);return db[_0x91cb('0x2d')][_0x91cb('0x4b')](_0x49bc42)[_0x91cb('0x25')](handleEntityNotFound(_0x3cc4c1,null))['then'](respondWithResult(_0x3cc4c1,null))[_0x91cb('0x45')](handleError(_0x3cc4c1,null));};exports[_0x91cb('0x4c')]=function(_0x2b8b7f,_0x3b8cfd){return db['ScreenRecording'][_0x91cb('0x4c')](_0x2b8b7f[_0x91cb('0x4d')],{})['then'](respondWithResult(_0x3b8cfd,0xc9))[_0x91cb('0x45')](handleError(_0x3b8cfd,null));};exports['update']=function(_0x2c419b,_0x4c0acd){if(_0x2c419b['body']['id']){delete _0x2c419b['body']['id'];}delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4e')];delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4f')];delete _0x2c419b[_0x91cb('0x4d')]['closedAt'];delete _0x2c419b['body'][_0x91cb('0x50')];return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x2c419b[_0x91cb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c0acd,null))['then'](saveUpdates(_0x2c419b['body'],null))[_0x91cb('0x25')](respondWithResult(_0x4c0acd,null))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x52')]=function(_0x4aa670,_0x21463a){return db[_0x91cb('0x2d')][_0x91cb('0x52')]()[_0x91cb('0x25')](respondWithResult(_0x21463a,null))[_0x91cb('0x45')](handleError(_0x21463a,null));};exports[_0x91cb('0x53')]=function(_0x3ec250,_0x30fd4e,_0xff7c3f){var _0x20fc0a=require(_0x91cb('0x54'));var _0x5752ed=![];var _0x1e445a={};if(_0x3ec250[_0x91cb('0x35')]['type']&&_0x3ec250[_0x91cb('0x35')][_0x91cb('0x30')]==='uniqueid'){_0x1e445a[_0x91cb('0x55')]=_0x3ec250[_0x91cb('0x51')]['id'];}else{_0x1e445a['id']=_0x3ec250[_0x91cb('0x51')]['id'];}return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':_0x1e445a,'attributes':['id',_0x91cb('0x50')],'raw':!![]})[_0x91cb('0x25')](handleEntityNotFound(_0x30fd4e,null))[_0x91cb('0x25')](function(_0x3320bd){if(_0x3320bd){var _0x93ef52=path[_0x91cb('0x56')](config['root'],_0x91cb('0x57'),_0x3320bd['value']);var _0x37221e=util['format'](_0x91cb('0x58'),_0x93ef52);if(fs[_0x91cb('0x59')](_0x37221e)){_0x5752ed=!![];return _0x20fc0a[_0x91cb('0x5a')](_0x37221e,_0x93ef52,config['secrets'][_0x91cb('0x5b')])[_0x91cb('0x25')](function(){return _0x3320bd;});}return _0x3320bd;}})['then'](function(_0xef4754){if(_0xef4754){var _0x102025=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],'server/files/screen_recordings',_0xef4754[_0x91cb('0x50')]);if(!fs[_0x91cb('0x59')](_0x102025)){throw new db[(_0x91cb('0x5d'))][(_0x91cb('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0xef4754[_0x91cb('0x5f')]){return _0x30fd4e[_0x91cb('0x53')](_0x102025,_0xef4754['filename']+path['extname'](_0x102025),function(){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}else{return _0x30fd4e['download'](_0x102025,function(_0x1180ac){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}}})['catch'](function(_0x4f19c8){if(_0x4f19c8[_0x91cb('0x61')]==='ScreenRecording\x20not\x20found'){_0x30fd4e[_0x91cb('0x1a')](0x194)[_0x91cb('0x2a')](_0x91cb('0x62'));}else{return handleError(_0x30fd4e,null);}});};exports['destroy']=function(_0x22fea8,_0x524400){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x22fea8[_0x91cb('0x51')]['id']}})[_0x91cb('0x25')](function(_0x483172){if(_[_0x91cb('0x63')](_0x483172)){throw new ReferenceError(_0x91cb('0x64'));}return _0x483172;})[_0x91cb('0x25')](function(_0x443c72){var _0xaf70c5=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],_0x91cb('0x57'),_0x443c72[_0x91cb('0x50')]);logger[_0x91cb('0x65')](_0x91cb('0x66'),_0xaf70c5);if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger[_0x91cb('0x65')](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}_0xaf70c5=_0xaf70c5+_0x91cb('0x6a');if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger['info'](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}return _0x443c72;})[_0x91cb('0x25')](function(_0x48fcfe){if(!_0x48fcfe)throw new InternalError();return _0x48fcfe[_0x91cb('0x26')]();})[_0x91cb('0x25')](function(){_0x524400[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();})[_0x91cb('0x45')](handleError(_0x524400,null));}; \ No newline at end of file +var _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5c85fd,_0x1cf78d){var _0x4c4e96=function(_0x56bd77){while(--_0x56bd77){_0x5c85fd['push'](_0x5c85fd['shift']());}};_0x4c4e96(++_0x1cf78d);}(_0x8958,0x93));var _0x8895=function(_0x212f65,_0x4f7a57){_0x212f65=_0x212f65-0x0;var _0x2bd077=_0x8958[_0x212f65];return _0x2bd077;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index c4566de..3f5be2f 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 _0xf43a=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xf43a,0x1e7));var _0xaf43=function(_0x484a9b,_0x122c3e){_0x484a9b=_0x484a9b-0x0;var _0x2eb996=_0xf43a[_0x484a9b];return _0x2eb996;};'use strict';var _=require(_0xaf43('0x0'));var util=require(_0xaf43('0x1'));var logger=require('../../config/logger')(_0xaf43('0x2'));var moment=require(_0xaf43('0x3'));var BPromise=require(_0xaf43('0x4'));var rp=require(_0xaf43('0x5'));var fs=require('fs');var path=require(_0xaf43('0x6'));var rimraf=require(_0xaf43('0x7'));var config=require(_0xaf43('0x8'));var attributes=require(_0xaf43('0x9'));module[_0xaf43('0xa')]=function(_0x105597,_0x330add){return _0x105597[_0xaf43('0xb')](_0xaf43('0xc'),attributes,{'tableName':_0xaf43('0xd'),'paranoid':![],'indexes':[{'name':_0xaf43('0xe'),'fields':[_0xaf43('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdecd=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports'];(function(_0x57f602,_0xb02a01){var _0x2f604d=function(_0xbb41e0){while(--_0xbb41e0){_0x57f602['push'](_0x57f602['shift']());}};_0x2f604d(++_0xb02a01);}(_0xdecd,0xa9));var _0xddec=function(_0x2ba2cb,_0x4f4fb8){_0x2ba2cb=_0x2ba2cb-0x0;var _0x2669ac=_0xdecd[_0x2ba2cb];return _0x2669ac;};'use strict';var _=require(_0xddec('0x0'));var util=require(_0xddec('0x1'));var logger=require(_0xddec('0x2'))(_0xddec('0x3'));var moment=require(_0xddec('0x4'));var BPromise=require(_0xddec('0x5'));var rp=require(_0xddec('0x6'));var fs=require('fs');var path=require(_0xddec('0x7'));var rimraf=require('rimraf');var config=require(_0xddec('0x8'));var attributes=require(_0xddec('0x9'));module[_0xddec('0xa')]=function(_0x15fcc8,_0x1efc97){return _0x15fcc8[_0xddec('0xb')](_0xddec('0xc'),attributes,{'tableName':_0xddec('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xddec('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0741b6f..48c585c 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 _0x8b37=['code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x2d8be7,_0x362d79){var _0x5ecbb9=function(_0x2749b4){while(--_0x2749b4){_0x2d8be7['push'](_0x2d8be7['shift']());}};_0x5ecbb9(++_0x362d79);}(_0x8b37,0x11c));var _0x78b3=function(_0x38dca6,_0x471cb7){_0x38dca6=_0x38dca6-0x0;var _0x29bcd7=_0x8b37[_0x38dca6];return _0x29bcd7;};'use strict';var _=require(_0x78b3('0x0'));var util=require(_0x78b3('0x1'));var moment=require(_0x78b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x78b3('0x3'));var fs=require('fs');var Redis=require(_0x78b3('0x4'));var db=require(_0x78b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x78b3('0x6'))(_0x78b3('0x7'));var config=require(_0x78b3('0x8'));var jayson=require(_0x78b3('0x9'));var client=jayson['client'][_0x78b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x156575,_0x571fd3,_0x30ea12){return new BPromise(function(_0x484a86,_0x1ced72){return client['request'](_0x156575,_0x30ea12)[_0x78b3('0xb')](function(_0x3e3f39){logger['info'](_0x78b3('0xc'),_0x571fd3,_0x78b3('0xd'));logger[_0x78b3('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x571fd3,_0x78b3('0xd'),JSON['stringify'](_0x3e3f39));if(_0x3e3f39[_0x78b3('0xf')]){if(_0x3e3f39['error'][_0x78b3('0x10')]===0x1f4){logger[_0x78b3('0xf')](_0x78b3('0xc'),_0x571fd3,_0x3e3f39[_0x78b3('0xf')][_0x78b3('0x11')]);return _0x1ced72(_0x3e3f39[_0x78b3('0xf')][_0x78b3('0x11')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x571fd3,_0x3e3f39[_0x78b3('0xf')][_0x78b3('0x11')]);return _0x484a86(_0x3e3f39[_0x78b3('0xf')][_0x78b3('0x11')]);}else{logger[_0x78b3('0x12')](_0x78b3('0xc'),_0x571fd3,_0x78b3('0xd'));_0x484a86(_0x3e3f39[_0x78b3('0x13')][_0x78b3('0x11')]);}})['catch'](function(_0x67f48b){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x571fd3,_0x67f48b);_0x1ced72(_0x67f48b);});});} \ No newline at end of file +var _0xafcd=['info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xafcd,0x1ad));var _0xdafc=function(_0x1ac562,_0x270a2d){_0x1ac562=_0x1ac562-0x0;var _0x483610=_0xafcd[_0x1ac562];return _0x483610;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdafc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdafc('0x5'));var config=require(_0xdafc('0x6'));var jayson=require(_0xdafc('0x7'));var client=jayson[_0xdafc('0x8')][_0xdafc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e0294,_0x1115ae,_0x1f0e10){return new BPromise(function(_0x574efa,_0x185975){return client[_0xdafc('0xa')](_0x3e0294,_0x1f0e10)['then'](function(_0x14cb0f){logger[_0xdafc('0xb')](_0xdafc('0xc'),_0x1115ae,_0xdafc('0xd'));logger[_0xdafc('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1115ae,'request\x20sent',JSON[_0xdafc('0xf')](_0x14cb0f));if(_0x14cb0f[_0xdafc('0x10')]){if(_0x14cb0f[_0xdafc('0x10')][_0xdafc('0x11')]===0x1f4){logger[_0xdafc('0x10')](_0xdafc('0xc'),_0x1115ae,_0x14cb0f['error'][_0xdafc('0x12')]);return _0x185975(_0x14cb0f[_0xdafc('0x10')]['message']);}logger[_0xdafc('0x10')](_0xdafc('0xc'),_0x1115ae,_0x14cb0f['error'][_0xdafc('0x12')]);return _0x574efa(_0x14cb0f[_0xdafc('0x10')]['message']);}else{logger[_0xdafc('0xb')](_0xdafc('0xc'),_0x1115ae,_0xdafc('0xd'));_0x574efa(_0x14cb0f[_0xdafc('0x13')][_0xdafc('0x12')]);}})['catch'](function(_0x17e709){logger[_0xdafc('0x10')](_0xdafc('0xc'),_0x1115ae,_0x17e709);_0x185975(_0x17e709);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b52aa04..cb0c9c5 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 _0x0d09=['post','diskStorage','preferred','/:id/preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','getFavicon','root','server/files/images/logos/','format','%s%s','logo','single','file','addLogo','join','extname','originalname'];(function(_0x55e34a,_0x151a3e){var _0x3f60eb=function(_0xefe5){while(--_0xefe5){_0x55e34a['push'](_0x55e34a['shift']());}};_0x3f60eb(++_0x151a3e);}(_0x0d09,0x92));var _0x90d0=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x0d09[_0x6eb833];return _0xdfc38c;};'use strict';var multer=require(_0x90d0('0x0'));var util=require(_0x90d0('0x1'));var path=require('path');var timeout=require(_0x90d0('0x2'));var express=require(_0x90d0('0x3'));var router=express['Router']();var fs_extra=require(_0x90d0('0x4'));var auth=require(_0x90d0('0x5'));var interaction=require(_0x90d0('0x6'));var config=require(_0x90d0('0x7'));var controller=require(_0x90d0('0x8'));router['get']('/',auth[_0x90d0('0x9')](),controller[_0x90d0('0xa')]);router[_0x90d0('0xb')](_0x90d0('0xc'),controller[_0x90d0('0xd')]);router[_0x90d0('0xb')](_0x90d0('0xe'),controller[_0x90d0('0xf')]);router['get'](_0x90d0('0x10'),controller['getLogo']);router[_0x90d0('0xb')](_0x90d0('0x11'),controller[_0x90d0('0x12')]);router['get'](_0x90d0('0x13'),controller[_0x90d0('0x14')]);router[_0x90d0('0xb')]('/:id/preferred',controller[_0x90d0('0x15')]);router[_0x90d0('0xb')]('/:id/favicon',controller[_0x90d0('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x128734,_0x42fe42,_0x18a27f){_0x18a27f(null,path['join'](config[_0x90d0('0x17')],_0x90d0('0x18')));},'filename':function(_0x44a564,_0x265404,_0x3056a6){_0x3056a6(null,util[_0x90d0('0x19')](_0x90d0('0x1a'),_0x90d0('0x1b'),path['extname'](_0x265404['originalname'])));}})});router['post'](_0x90d0('0x10'),upload[_0x90d0('0x1c')](_0x90d0('0x1d')),controller[_0x90d0('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2019c9,_0x46d2cb,_0x78cb5d){_0x78cb5d(null,path[_0x90d0('0x1f')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3d533e,_0x5ca137,_0x4d8a74){_0x4d8a74(null,util[_0x90d0('0x19')]('%s%s','logologin',path[_0x90d0('0x20')](_0x5ca137[_0x90d0('0x21')])));}})});router[_0x90d0('0x22')](_0x90d0('0x11'),upload[_0x90d0('0x1c')](_0x90d0('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x90d0('0x23')]({'destination':function(_0x2501d0,_0x4e4e83,_0x3ea10b){_0x3ea10b(null,path[_0x90d0('0x1f')](config[_0x90d0('0x17')],'server/files/images/logos/'));},'filename':function(_0x189dcc,_0x377d2f,_0x265c77){_0x265c77(null,util[_0x90d0('0x19')]('%s%s',_0x90d0('0x24'),path[_0x90d0('0x20')](_0x377d2f[_0x90d0('0x21')])));}})});router[_0x90d0('0x22')](_0x90d0('0x25'),upload['single']('file'),controller[_0x90d0('0x26')]);var upload=multer({'storage':multer[_0x90d0('0x23')]({'destination':function(_0x13c7e6,_0x529472,_0x6722a1){_0x6722a1(null,path[_0x90d0('0x1f')](config[_0x90d0('0x17')],_0x90d0('0x18')));},'filename':function(_0x12590d,_0x127d1e,_0xc8fb82){_0xc8fb82(null,util['format'](_0x90d0('0x1a'),_0x90d0('0x27'),path[_0x90d0('0x20')](_0x127d1e[_0x90d0('0x21')])));}})});router[_0x90d0('0x22')](_0x90d0('0x28'),upload[_0x90d0('0x1c')](_0x90d0('0x1d')),controller[_0x90d0('0x29')]);router[_0x90d0('0x2a')](_0x90d0('0xe'),auth['isAuthenticated'](),controller[_0x90d0('0x2b')]);module[_0x90d0('0x2c')]=router; \ No newline at end of file +var _0xbd3a=['/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','originalname','post','single','file','addLogo','format','logologin','addLogoLogin','preferred','extname','favicon','addFavicon','isAuthenticated','update','multer','path','Router','fs-extra','../../config/environment','./setting.controller','get','/now','getDate','/:id','/:id/logo_login','/:id/gdpr','gdpr'];(function(_0x1af68c,_0x49a8e7){var _0x3a319d=function(_0x1169d4){while(--_0x1169d4){_0x1af68c['push'](_0x1af68c['shift']());}};_0x3a319d(++_0x49a8e7);}(_0xbd3a,0x11b));var _0xabd3=function(_0x27f0c8,_0x54dcdb){_0x27f0c8=_0x27f0c8-0x0;var _0x47386b=_0xbd3a[_0x27f0c8];return _0x47386b;};'use strict';var multer=require(_0xabd3('0x0'));var util=require('util');var path=require(_0xabd3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabd3('0x2')]();var fs_extra=require(_0xabd3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xabd3('0x4'));var controller=require(_0xabd3('0x5'));router[_0xabd3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xabd3('0x6')](_0xabd3('0x7'),controller[_0xabd3('0x8')]);router[_0xabd3('0x6')](_0xabd3('0x9'),controller['show']);router[_0xabd3('0x6')]('/:id/logo',controller['getLogo']);router['get'](_0xabd3('0xa'),controller['getLogoLogin']);router[_0xabd3('0x6')](_0xabd3('0xb'),controller[_0xabd3('0xc')]);router[_0xabd3('0x6')](_0xabd3('0xd'),controller[_0xabd3('0xe')]);router[_0xabd3('0x6')](_0xabd3('0xf'),controller[_0xabd3('0x10')]);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x215bb6,_0x1bb583,_0x48b115){_0x48b115(null,path[_0xabd3('0x12')](config[_0xabd3('0x13')],_0xabd3('0x14')));},'filename':function(_0x4ff016,_0x226b81,_0x284e14){_0x284e14(null,util['format'](_0xabd3('0x15'),_0xabd3('0x16'),path['extname'](_0x226b81[_0xabd3('0x17')])));}})});router[_0xabd3('0x18')]('/:id/logo',upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller[_0xabd3('0x1b')]);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x549c57,_0x16b5be,_0x51bb97){_0x51bb97(null,path[_0xabd3('0x12')](config[_0xabd3('0x13')],'server/files/images/logos/'));},'filename':function(_0x1f3528,_0x5a057b,_0x43e483){_0x43e483(null,util[_0xabd3('0x1c')](_0xabd3('0x15'),_0xabd3('0x1d'),path['extname'](_0x5a057b[_0xabd3('0x17')])));}})});router[_0xabd3('0x18')](_0xabd3('0xa'),upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller[_0xabd3('0x1e')]);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x2e7f12,_0x1d3b93,_0x55e073){_0x55e073(null,path[_0xabd3('0x12')](config[_0xabd3('0x13')],'server/files/images/logos/'));},'filename':function(_0x42d320,_0x5d1c28,_0x24a654){_0x24a654(null,util[_0xabd3('0x1c')]('%s%s',_0xabd3('0x1f'),path[_0xabd3('0x20')](_0x5d1c28['originalname'])));}})});router['post'](_0xabd3('0xd'),upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0xabd3('0x11')]({'destination':function(_0x4086ff,_0x349d42,_0x5b0886){_0x5b0886(null,path[_0xabd3('0x12')](config['root'],_0xabd3('0x14')));},'filename':function(_0xab20dd,_0x331b27,_0x58f944){_0x58f944(null,util[_0xabd3('0x1c')](_0xabd3('0x15'),_0xabd3('0x21'),path[_0xabd3('0x20')](_0x331b27[_0xabd3('0x17')])));}})});router[_0xabd3('0x18')](_0xabd3('0xf'),upload[_0xabd3('0x19')](_0xabd3('0x1a')),controller[_0xabd3('0x22')]);router['put'](_0xabd3('0x9'),auth[_0xabd3('0x23')](),controller[_0xabd3('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e49c7a2..ba0512a 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 _0xe1c4=['alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0xc41796,_0x17572c){var _0x4256e2=function(_0x2fbf18){while(--_0x2fbf18){_0xc41796['push'](_0xc41796['shift']());}};_0x4256e2(++_0x17572c);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0xbf7f20,_0x3f856e){_0xbf7f20=_0xbf7f20-0x0;var _0x5dc25d=_0xe1c4[_0xbf7f20];return _0x5dc25d;};'use strict';var Sequelize=require(_0x4e1c('0x0'));module[_0x4e1c('0x1')]={'min_internal':{'type':Sequelize[_0x4e1c('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4e1c('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4e1c('0x4')],'defaultValue':_0x4e1c('0x5')},'logo':{'type':Sequelize[_0x4e1c('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4e1c('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4e1c('0x4')]},'turnaddr':{'type':Sequelize[_0x4e1c('0x4')]},'turnusername':{'type':Sequelize[_0x4e1c('0x4')]},'turnpassword':{'type':Sequelize[_0x4e1c('0x4')]},'pageTitle':{'type':Sequelize[_0x4e1c('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4e1c('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4e1c('0x4')],'defaultValue':_0x4e1c('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x4e1c('0x8')},'chatTimeout':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4e1c('0x4')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4e1c('0x4')]},'defaultFavicon':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4e1c('0x2')]},'transcribeRegion':{'type':Sequelize[_0x4e1c('0x4')]},'sentiment':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x4e1c('0x4')]},'language':{'type':Sequelize[_0x4e1c('0x4')]},'bucket':{'type':Sequelize[_0x4e1c('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4e1c('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4e1c('0x2')](0x2)[_0x4e1c('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4e1c('0x2')](0x2)[_0x4e1c('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x4e1c('0x2')](0x2)[_0x4e1c('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x4e1c('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x4e1c('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14}}; \ No newline at end of file +var _0xc15c=['min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER'];(function(_0x1b3d5a,_0x77805a){var _0x47511c=function(_0x5c86a5){while(--_0x5c86a5){_0x1b3d5a['push'](_0x1b3d5a['shift']());}};_0x47511c(++_0x77805a);}(_0xc15c,0xae));var _0xcc15=function(_0x379e3c,_0x3d16a5){_0x379e3c=_0x379e3c-0x0;var _0x2931a2=_0xc15c[_0x379e3c];return _0x2931a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xcc15('0x0')](0xb),'unique':_0xcc15('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xcc15('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xcc15('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xcc15('0x2')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xcc15('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xcc15('0x2')]},'turnaddr':{'type':Sequelize[_0xcc15('0x2')]},'turnusername':{'type':Sequelize[_0xcc15('0x2')]},'turnpassword':{'type':Sequelize[_0xcc15('0x2')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xcc15('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xcc15('0x4')},'enableEmailPreview':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'split':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xcc15('0x5')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xcc15('0x2')]},'allowedLoginAttempts':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xcc15('0x2')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xcc15('0x0')]},'transcribeRegion':{'type':Sequelize[_0xcc15('0x2')]},'sentiment':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xcc15('0x2')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xcc15('0x2')]},'googleSsoEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xcc15('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xcc15('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xcc15('0x0')](0x2)[_0xcc15('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xcc15('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xcc15('0x0')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xcc15('0x3')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xcc15('0x0')],'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 e44aca9..94516ab 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 _0x79e3=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','type','VIRTUAL','merge','options','includeAll','show','params','keys','length','include','update','body','find','addLogo','file','logo','filename','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','download','getLogoLogin','custom','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','moment'];(function(_0x362168,_0x2ff5e8){var _0x466a84=function(_0x1584ba){while(--_0x1584ba){_0x362168['push'](_0x362168['shift']());}};_0x466a84(++_0x2ff5e8);}(_0x79e3,0x77));var _0x379e=function(_0x5ec2a4,_0x441187){_0x5ec2a4=_0x5ec2a4-0x0;var _0x21cfaa=_0x79e3[_0x5ec2a4];return _0x21cfaa;};'use strict';var emlformat=require(_0x379e('0x0'));var rimraf=require(_0x379e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x379e('0x2'));var rp=require('request-promise');var moment=require(_0x379e('0x3'));var BPromise=require(_0x379e('0x4'));var Mustache=require(_0x379e('0x5'));var util=require(_0x379e('0x6'));var path=require(_0x379e('0x7'));var sox=require('sox');var csv=require(_0x379e('0x8'));var ejs=require(_0x379e('0x9'));var fs=require('fs');var fs_extra=require(_0x379e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x379e('0xb'));var jsforce=require(_0x379e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x379e('0x8'));var querystring=require(_0x379e('0xd'));var Papa=require(_0x379e('0xe'));var Redis=require('ioredis');var authService=require(_0x379e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x379e('0x10'));var hardwareService=require(_0x379e('0x11'));var logger=require(_0x379e('0x12'))(_0x379e('0x13'));var utils=require(_0x379e('0x14'));var config=require(_0x379e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x379e('0x16')][_0x379e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3886c7,_0x5a9b8f,_0x1b4ba1,_0x488c12){return new BPromise(function(_0x5efa8c,_0x4bd45f){var _0x3102c6=_0x488c12||client;return _0x3102c6['request'](_0x3886c7,_0x1b4ba1)[_0x379e('0x18')](function(_0x24b7f6){logger[_0x379e('0x19')](_0x379e('0x1a'),_0x5a9b8f,_0x379e('0x1b'));logger[_0x379e('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0x5a9b8f,'request\x20sent',JSON[_0x379e('0x1d')](_0x24b7f6));if(_0x24b7f6[_0x379e('0x1e')]){if(_0x24b7f6[_0x379e('0x1e')][_0x379e('0x1f')]===0x1f4){logger['error'](_0x379e('0x1a'),_0x5a9b8f,_0x24b7f6['error']['message']);return _0x4bd45f(_0x24b7f6[_0x379e('0x1e')][_0x379e('0x20')]);}logger[_0x379e('0x1e')](_0x379e('0x1a'),_0x5a9b8f,_0x24b7f6[_0x379e('0x1e')][_0x379e('0x20')]);return _0x5efa8c(_0x24b7f6[_0x379e('0x1e')][_0x379e('0x20')]);}else{logger[_0x379e('0x19')](_0x379e('0x1a'),_0x5a9b8f,_0x379e('0x1b'));_0x5efa8c(_0x24b7f6[_0x379e('0x21')]['message']);}})[_0x379e('0x22')](function(_0x486514){logger[_0x379e('0x1e')](_0x379e('0x1a'),_0x5a9b8f,_0x486514);_0x4bd45f(_0x486514);});});}function respondWithStatusCode(_0x48e0dc,_0xd6204a){_0xd6204a=_0xd6204a||0xcc;return function(_0x7dbb4a){if(_0x7dbb4a){return _0x48e0dc[_0x379e('0x23')](_0xd6204a);}return _0x48e0dc[_0x379e('0x24')](_0xd6204a)[_0x379e('0x25')]();};}function respondWithResult(_0x34411d,_0x489dc2){_0x489dc2=_0x489dc2||0xc8;return function(_0x2a4dd6){if(_0x2a4dd6){return _0x34411d['status'](_0x489dc2)[_0x379e('0x26')](_0x2a4dd6);}};}function respondWithFilteredResult(_0x2c7add,_0x29df5c){return function(_0x3c5f06){if(_0x3c5f06){var _0x797cab=typeof _0x29df5c[_0x379e('0x27')]===_0x379e('0x28')&&typeof _0x29df5c['limit']==='undefined';var _0x3b6be1=_0x3c5f06[_0x379e('0x29')];var _0x1c80db=_0x797cab?0x0:_0x29df5c['offset'];var _0x2228e7=_0x797cab?_0x3c5f06['count']:_0x29df5c[_0x379e('0x27')]+_0x29df5c[_0x379e('0x2a')];var _0x227a6f;if(_0x2228e7>=_0x3b6be1){_0x2228e7=_0x3b6be1;_0x227a6f=0xc8;}else{_0x227a6f=0xce;}_0x2c7add[_0x379e('0x24')](_0x227a6f);return _0x2c7add[_0x379e('0x2b')](_0x379e('0x2c'),_0x1c80db+'-'+_0x2228e7+'/'+_0x3b6be1)[_0x379e('0x26')](_0x3c5f06);}return null;};}function patchUpdates(_0x1a9b3d){return function(_0xf86a55){try{jsonpatch[_0x379e('0x2d')](_0xf86a55,_0x1a9b3d,!![]);}catch(_0xac14b8){return BPromise[_0x379e('0x2e')](_0xac14b8);}return _0xf86a55[_0x379e('0x2f')]();};}function saveUpdates(_0x3ef3ff,_0x2fb726){return function(_0x2a5da8){if(_0x2a5da8){return _0x2a5da8['update'](_0x3ef3ff)[_0x379e('0x18')](function(_0x538e27){return _0x538e27;});}return null;};}function removeEntity(_0x25580b,_0x3ed9e2){return function(_0x508224){if(_0x508224){return _0x508224['destroy']()[_0x379e('0x18')](function(){_0x25580b['status'](0xcc)[_0x379e('0x25')]();});}};}function handleEntityNotFound(_0x574ba1,_0x2e1a53){return function(_0x979759){if(!_0x979759){_0x574ba1[_0x379e('0x23')](0x194);}return _0x979759;};}function handleError(_0x3bde6c,_0x1af2b9){_0x1af2b9=_0x1af2b9||0x1f4;return function(_0x15b99f){logger[_0x379e('0x1e')](_0x15b99f[_0x379e('0x30')]);if(_0x15b99f[_0x379e('0x31')]){delete _0x15b99f['name'];}_0x3bde6c['status'](_0x1af2b9)[_0x379e('0x32')](_0x15b99f);};}exports[_0x379e('0x33')]=function(_0x50e566,_0x50e08a){var _0x248314={},_0x174bc0={},_0x55e1c1={'count':0x0,'rows':[]};var _0xc57b39=_[_0x379e('0x34')](db[_0x379e('0x35')][_0x379e('0x36')],function(_0x356791){return{'name':_0x356791[_0x379e('0x37')],'type':_0x356791['type'][_0x379e('0x38')]};});_0x174bc0[_0x379e('0x39')]=_[_0x379e('0x34')](_0xc57b39,_0x379e('0x31'));_0x174bc0[_0x379e('0x3a')]=_['keys'](_0x50e566[_0x379e('0x3a')]);_0x174bc0[_0x379e('0x3b')]=_[_0x379e('0x3c')](_0x174bc0[_0x379e('0x39')],_0x174bc0['query']);_0x248314[_0x379e('0x3d')]=_[_0x379e('0x3c')](_0x174bc0[_0x379e('0x39')],qs[_0x379e('0x3e')](_0x50e566[_0x379e('0x3a')][_0x379e('0x3e')]));_0x248314[_0x379e('0x3d')]=_0x248314['attributes']['length']?_0x248314['attributes']:_0x174bc0[_0x379e('0x39')];if(!_0x50e566[_0x379e('0x3a')]['hasOwnProperty'](_0x379e('0x3f'))){_0x248314['limit']=qs['limit'](_0x50e566[_0x379e('0x3a')][_0x379e('0x2a')]);_0x248314[_0x379e('0x27')]=qs[_0x379e('0x27')](_0x50e566[_0x379e('0x3a')][_0x379e('0x27')]);}_0x248314[_0x379e('0x40')]=qs[_0x379e('0x41')](_0x50e566[_0x379e('0x3a')][_0x379e('0x41')]);_0x248314['where']=qs[_0x379e('0x3b')](_[_0x379e('0x42')](_0x50e566[_0x379e('0x3a')],_0x174bc0[_0x379e('0x3b')]),_0xc57b39);if(_0x50e566[_0x379e('0x3a')]['filter']){_0x248314[_0x379e('0x43')]=_['merge'](_0x248314[_0x379e('0x43')],{'$or':_[_0x379e('0x34')](_0xc57b39,function(_0x38d3d4){if(_0x38d3d4[_0x379e('0x44')]!==_0x379e('0x45')){var _0x2004c6={};_0x2004c6[_0x38d3d4[_0x379e('0x31')]]={'$like':'%'+_0x50e566['query']['filter']+'%'};return _0x2004c6;}})});}_0x248314=_[_0x379e('0x46')]({},_0x248314,_0x50e566[_0x379e('0x47')]);var _0xec1466={'where':_0x248314[_0x379e('0x43')]};return db[_0x379e('0x35')][_0x379e('0x29')](_0xec1466)[_0x379e('0x18')](function(_0x4f50a4){_0x55e1c1[_0x379e('0x29')]=_0x4f50a4;if(_0x50e566[_0x379e('0x3a')][_0x379e('0x48')]){_0x248314['include']=[{'all':!![]}];}return db[_0x379e('0x35')]['findAll'](_0x248314);})['then'](function(_0x23e41f){_0x55e1c1['rows']=_0x23e41f;return _0x55e1c1;})['then'](respondWithFilteredResult(_0x50e08a,_0x248314))['catch'](handleError(_0x50e08a,null));};exports[_0x379e('0x49')]=function(_0x2b24d0,_0x2d7291){var _0x4c6dc2={'raw':![],'where':{'id':_0x2b24d0[_0x379e('0x4a')]['id']}},_0x37021d={};_0x37021d[_0x379e('0x39')]=_[_0x379e('0x4b')](db[_0x379e('0x35')][_0x379e('0x36')]);_0x37021d['query']=_[_0x379e('0x4b')](_0x2b24d0['query']);_0x37021d[_0x379e('0x3b')]=_['intersection'](_0x37021d[_0x379e('0x39')],_0x37021d[_0x379e('0x3a')]);_0x4c6dc2['attributes']=_['intersection'](_0x37021d[_0x379e('0x39')],qs[_0x379e('0x3e')](_0x2b24d0['query'][_0x379e('0x3e')]));_0x4c6dc2['attributes']=_0x4c6dc2[_0x379e('0x3d')][_0x379e('0x4c')]?_0x4c6dc2[_0x379e('0x3d')]:_0x37021d[_0x379e('0x39')];if(_0x2b24d0[_0x379e('0x3a')][_0x379e('0x48')]){_0x4c6dc2[_0x379e('0x4d')]=[{'all':!![]}];}_0x4c6dc2=_[_0x379e('0x46')]({},_0x4c6dc2,_0x2b24d0[_0x379e('0x47')]);return db[_0x379e('0x35')]['find'](_0x4c6dc2)[_0x379e('0x18')](handleEntityNotFound(_0x2d7291,null))['then'](respondWithResult(_0x2d7291,null))[_0x379e('0x22')](handleError(_0x2d7291,null));};exports[_0x379e('0x4e')]=function(_0x417b84,_0x275db3){if(_0x417b84[_0x379e('0x4f')]['id']){delete _0x417b84['body']['id'];}return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x417b84[_0x379e('0x4a')]['id']}})[_0x379e('0x18')](handleEntityNotFound(_0x275db3,null))['then'](saveUpdates(_0x417b84['body'],null))[_0x379e('0x18')](respondWithResult(_0x275db3,null))[_0x379e('0x22')](handleError(_0x275db3,null));};exports[_0x379e('0x51')]=function(_0x559fe2,_0x3f3048,_0x1a1bd5){if(_0x559fe2[_0x379e('0x52')]&&_0x559fe2[_0x379e('0x52')]['filename']){_0x559fe2[_0x379e('0x4f')][_0x379e('0x53')]=_0x559fe2[_0x379e('0x52')][_0x379e('0x54')];}return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x559fe2['params']['id']}})[_0x379e('0x18')](handleEntityNotFound(_0x3f3048,null))[_0x379e('0x18')](saveUpdates(_0x559fe2['body'],null))[_0x379e('0x18')](respondWithResult(_0x3f3048,null))[_0x379e('0x22')](handleError(_0x3f3048,null));};exports['addLogoLogin']=function(_0x26f9fc,_0x4b9d6e,_0x229f52){if(_0x26f9fc[_0x379e('0x52')]&&_0x26f9fc[_0x379e('0x52')][_0x379e('0x54')]){_0x26f9fc[_0x379e('0x4f')][_0x379e('0x55')]=_0x26f9fc[_0x379e('0x52')][_0x379e('0x54')];}return db[_0x379e('0x35')]['find']({'where':{'id':_0x26f9fc[_0x379e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b9d6e,null))[_0x379e('0x18')](saveUpdates(_0x26f9fc['body'],null))[_0x379e('0x18')](respondWithResult(_0x4b9d6e,null))[_0x379e('0x22')](handleError(_0x4b9d6e,null));};var utilLicense=require(_0x379e('0x56'));exports[_0x379e('0x57')]=function(_0x15be6a,_0x49daef,_0x3ee479){var _0x5dbdc0=_0x379e('0x58');var _0x177c29={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1a17ac){if(_0x1a17ac){_0x177c29=_0x1a17ac;}return db[_0x379e('0x35')]['find']({'where':{'id':_0x15be6a['params']['id']},'attributes':[_0x379e('0x53'),_0x379e('0x55'),_0x379e('0x59'),_0x379e('0x5a'),_0x379e('0x5b'),_0x379e('0x5c'),_0x379e('0x5d'),_0x379e('0x5e')],'raw':!![]});})[_0x379e('0x18')](handleEntityNotFound(_0x49daef,null))['then'](function(_0x4042b3){if(_0x4042b3){var _0x4e8ea2=_0x4042b3[_0x379e('0x53')]&&fs['existsSync'](path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x5dbdc0,_[_0x379e('0x61')](_0x4042b3[_0x379e('0x53')])))?path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x5dbdc0,_['toLower'](_0x4042b3[_0x379e('0x53')])):path['join'](config[_0x379e('0x60')],_0x5dbdc0,_[_0x379e('0x61')](_0x379e('0x62')));var _0x3ced56=_0x379e('0x63')+_[_0x379e('0x64')](_0x379e('0x53'));if(_0x4042b3[_0x3ced56]||!_0x177c29['custom']){_0x4e8ea2=path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x5dbdc0,_[_0x379e('0x61')](_0x379e('0x62')));}if(!fs[_0x379e('0x65')](_0x4e8ea2)){throw new db[(_0x379e('0x66'))][(_0x379e('0x67'))](_[_0x379e('0x64')](_0x379e('0x53'))+'\x20not\x20found');}return _0x49daef[_0x379e('0x68')](_0x4e8ea2);}})[_0x379e('0x22')](handleError(_0x49daef,null));};var utilLicense=require(_0x379e('0x56'));exports[_0x379e('0x69')]=function(_0x22db08,_0x5e9b8c,_0x101cf7){var _0x141f10=_0x379e('0x58');var _0x366f67={'custom':![]};return utilLicense['getLicense']()[_0x379e('0x18')](function(_0x43d425){if(_0x43d425){_0x366f67=_0x43d425;}return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x22db08[_0x379e('0x4a')]['id']},'attributes':[_0x379e('0x53'),'loginLogo',_0x379e('0x59'),_0x379e('0x5a'),_0x379e('0x5b'),'defaultLoginLogo','defaultPreferred',_0x379e('0x5e')],'raw':!![]});})[_0x379e('0x18')](handleEntityNotFound(_0x5e9b8c,null))['then'](function(_0x413dcb){if(_0x413dcb){var _0x5ae790=_0x413dcb[_0x379e('0x55')]&&fs[_0x379e('0x65')](path['join'](config[_0x379e('0x60')],_0x141f10,_['toLower'](_0x413dcb['loginLogo'])))?path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x141f10,_[_0x379e('0x61')](_0x413dcb['loginLogo'])):path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x141f10,_['toLower']('default_loginLogo.svg'));var _0x2c405f='default'+_[_0x379e('0x64')](_0x379e('0x55'));if(_0x413dcb[_0x2c405f]||!_0x366f67[_0x379e('0x6a')]){_0x5ae790=path['join'](config[_0x379e('0x60')],_0x141f10,_[_0x379e('0x61')](_0x379e('0x6b')));}if(!fs[_0x379e('0x65')](_0x5ae790)){throw new db[(_0x379e('0x66'))][(_0x379e('0x67'))](_['upperFirst']('loginLogo')+_0x379e('0x6c'));}return _0x5e9b8c[_0x379e('0x68')](_0x5ae790);}})['catch'](handleError(_0x5e9b8c,null));};exports[_0x379e('0x6d')]=function(_0x24a1a2,_0x2f1b9a){return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x24a1a2[_0x379e('0x4a')]['id']},'attributes':[_0x379e('0x6e')]})[_0x379e('0x18')](respondWithResult(_0x2f1b9a,null))[_0x379e('0x22')](handleError(_0x2f1b9a,null));};exports[_0x379e('0x6f')]=function(_0x3206ee,_0x3b814,_0x2df91f){if(_0x3206ee[_0x379e('0x52')]&&_0x3206ee[_0x379e('0x52')]['filename']){_0x3206ee[_0x379e('0x4f')][_0x379e('0x59')]=_0x3206ee[_0x379e('0x52')][_0x379e('0x54')];}return db['Setting'][_0x379e('0x50')]({'where':{'id':_0x3206ee[_0x379e('0x4a')]['id']}})[_0x379e('0x18')](handleEntityNotFound(_0x3b814,null))[_0x379e('0x18')](saveUpdates(_0x3206ee[_0x379e('0x4f')],null))[_0x379e('0x18')](respondWithResult(_0x3b814,null))[_0x379e('0x22')](handleError(_0x3b814,null));};var utilLicense=require(_0x379e('0x56'));exports[_0x379e('0x70')]=function(_0x55a227,_0x17ac70,_0x2caa70){var _0xe32c4d='server/files/images/logos';var _0x17064a={'custom':![]};return utilLicense[_0x379e('0x71')]()[_0x379e('0x18')](function(_0x254f41){if(_0x254f41){_0x17064a=_0x254f41;}return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x55a227[_0x379e('0x4a')]['id']},'attributes':['logo',_0x379e('0x55'),'preferred',_0x379e('0x5a'),_0x379e('0x5b'),_0x379e('0x5c'),_0x379e('0x5d'),_0x379e('0x5e')],'raw':!![]});})[_0x379e('0x18')](handleEntityNotFound(_0x17ac70,null))[_0x379e('0x18')](function(_0x190031){if(_0x190031){var _0x170fd7=_0x190031[_0x379e('0x59')]&&fs[_0x379e('0x65')](path[_0x379e('0x5f')](config['root'],_0xe32c4d,_[_0x379e('0x61')](_0x190031[_0x379e('0x59')])))?path[_0x379e('0x5f')](config[_0x379e('0x60')],_0xe32c4d,_[_0x379e('0x61')](_0x190031[_0x379e('0x59')])):path[_0x379e('0x5f')](config[_0x379e('0x60')],_0xe32c4d,_[_0x379e('0x61')](_0x379e('0x72')));var _0x14f347=_0x379e('0x63')+_[_0x379e('0x64')](_0x379e('0x59'));if(_0x190031[_0x14f347]||!_0x17064a['custom']||!_0x17064a['preferred']){_0x170fd7=path[_0x379e('0x5f')](config[_0x379e('0x60')],_0xe32c4d,_[_0x379e('0x61')](_0x379e('0x72')));}if(!fs[_0x379e('0x65')](_0x170fd7)){throw new db[(_0x379e('0x66'))][(_0x379e('0x67'))](_['upperFirst']('preferred')+_0x379e('0x6c'));}return _0x17ac70[_0x379e('0x68')](_0x170fd7);}})[_0x379e('0x22')](handleError(_0x17ac70,null));};exports[_0x379e('0x73')]=function(_0x5b5ae9,_0x1c993e,_0x9c86c5){if(_0x5b5ae9['file']&&_0x5b5ae9[_0x379e('0x52')][_0x379e('0x54')]){_0x5b5ae9['body'][_0x379e('0x5a')]=_0x5b5ae9[_0x379e('0x52')][_0x379e('0x54')];}return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x5b5ae9['params']['id']}})[_0x379e('0x18')](handleEntityNotFound(_0x1c993e,null))[_0x379e('0x18')](saveUpdates(_0x5b5ae9[_0x379e('0x4f')],null))[_0x379e('0x18')](respondWithResult(_0x1c993e,null))[_0x379e('0x22')](handleError(_0x1c993e,null));};var utilLicense=require(_0x379e('0x56'));exports[_0x379e('0x74')]=function(_0x543f68,_0x12c3ef,_0x3dd599){var _0x3a7dd3=_0x379e('0x58');var _0xdc5496={'custom':![]};return utilLicense[_0x379e('0x71')]()[_0x379e('0x18')](function(_0x41e97a){if(_0x41e97a){_0xdc5496=_0x41e97a;}return db[_0x379e('0x35')][_0x379e('0x50')]({'where':{'id':_0x543f68[_0x379e('0x4a')]['id']},'attributes':[_0x379e('0x53'),_0x379e('0x55'),'preferred',_0x379e('0x5a'),_0x379e('0x5b'),_0x379e('0x5c'),'defaultPreferred',_0x379e('0x5e')],'raw':!![]});})[_0x379e('0x18')](handleEntityNotFound(_0x12c3ef,null))[_0x379e('0x18')](function(_0x5d438c){if(_0x5d438c){var _0x46b56b=_0x5d438c[_0x379e('0x5a')]&&fs[_0x379e('0x65')](path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x3a7dd3,_[_0x379e('0x61')](_0x5d438c['favicon'])))?path['join'](config[_0x379e('0x60')],_0x3a7dd3,_[_0x379e('0x61')](_0x5d438c[_0x379e('0x5a')])):path[_0x379e('0x5f')](config[_0x379e('0x60')],_0x3a7dd3,_[_0x379e('0x61')]('default_favicon.ico'));var _0x5eba3c='default'+_['upperFirst'](_0x379e('0x5a'));if(_0x5d438c[_0x5eba3c]||!_0xdc5496[_0x379e('0x6a')]){_0x46b56b=path[_0x379e('0x5f')](config['root'],_0x3a7dd3,_['toLower'](_0x379e('0x75')));}if(!fs[_0x379e('0x65')](_0x46b56b)){throw new db[(_0x379e('0x66'))][(_0x379e('0x67'))](_['upperFirst'](_0x379e('0x5a'))+_0x379e('0x6c'));}return _0x12c3ef[_0x379e('0x68')](_0x46b56b);}})['catch'](handleError(_0x12c3ef,null));};exports[_0x379e('0x76')]=function(_0x329f4c,_0x27b971){var _0x2eadcd={'offset':moment()[_0x379e('0x77')]()};_0x2eadcd[_0x379e('0x78')]=moment()[_0x379e('0x77')](_0x2eadcd[_0x379e('0x27')])[_0x379e('0x79')](_0x379e('0x7a'));return _0x27b971[_0x379e('0x24')](0xc8)[_0x379e('0x32')](_0x2eadcd);}; \ No newline at end of file +var _0xc078=['\x20not\x20found','default_loginLogo.svg','custom','ValidationError','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','status','index','Setting','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','show','params','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize'];(function(_0x4b15a4,_0x4241fe){var _0x40a783=function(_0x1f3de1){while(--_0x1f3de1){_0x4b15a4['push'](_0x4b15a4['shift']());}};_0x40a783(++_0x4241fe);}(_0xc078,0xfd));var _0x8c07=function(_0x10bfb3,_0x492f8a){_0x10bfb3=_0x10bfb3-0x0;var _0x1a6ef6=_0xc078[_0x10bfb3];return _0x1a6ef6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c07('0x0'));var zipdir=require(_0x8c07('0x1'));var jsonpatch=require(_0x8c07('0x2'));var rp=require(_0x8c07('0x3'));var moment=require(_0x8c07('0x4'));var BPromise=require(_0x8c07('0x5'));var Mustache=require('mustache');var util=require(_0x8c07('0x6'));var path=require(_0x8c07('0x7'));var sox=require(_0x8c07('0x8'));var csv=require(_0x8c07('0x9'));var ejs=require(_0x8c07('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c07('0xb'));var crypto=require(_0x8c07('0xc'));var jsforce=require(_0x8c07('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8c07('0x9'));var querystring=require(_0x8c07('0xe'));var Papa=require(_0x8c07('0xf'));var Redis=require(_0x8c07('0x10'));var authService=require(_0x8c07('0x11'));var qs=require(_0x8c07('0x12'));var as=require(_0x8c07('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c07('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8c07('0x15'));var licenseUtil=require(_0x8c07('0x16'));var db=require(_0x8c07('0x17'))['db'];var jayson=require(_0x8c07('0x18'));var client=jayson[_0x8c07('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3e5d,_0x166e0e,_0x5801c9,_0x303bee){return new BPromise(function(_0x4982da,_0x536ca5){var _0xf47a62=_0x303bee||client;return _0xf47a62[_0x8c07('0x1a')](_0x5a3e5d,_0x5801c9)['then'](function(_0x35dcf3){logger[_0x8c07('0x1b')](_0x8c07('0x1c'),_0x166e0e,_0x8c07('0x1d'));logger[_0x8c07('0x1e')](_0x8c07('0x1f'),_0x166e0e,_0x8c07('0x1d'),JSON[_0x8c07('0x20')](_0x35dcf3));if(_0x35dcf3['error']){if(_0x35dcf3[_0x8c07('0x21')][_0x8c07('0x22')]===0x1f4){logger[_0x8c07('0x21')](_0x8c07('0x1c'),_0x166e0e,_0x35dcf3[_0x8c07('0x21')]['message']);return _0x536ca5(_0x35dcf3[_0x8c07('0x21')]['message']);}logger['error']('Setting,\x20%s,\x20%s',_0x166e0e,_0x35dcf3['error']['message']);return _0x4982da(_0x35dcf3[_0x8c07('0x21')][_0x8c07('0x23')]);}else{logger['info'](_0x8c07('0x1c'),_0x166e0e,_0x8c07('0x1d'));_0x4982da(_0x35dcf3[_0x8c07('0x24')][_0x8c07('0x23')]);}})[_0x8c07('0x25')](function(_0x33a7de){logger[_0x8c07('0x21')](_0x8c07('0x1c'),_0x166e0e,_0x33a7de);_0x536ca5(_0x33a7de);});});}function respondWithStatusCode(_0x3d276d,_0x52cc30){_0x52cc30=_0x52cc30||0xcc;return function(_0x1bc715){if(_0x1bc715){return _0x3d276d['sendStatus'](_0x52cc30);}return _0x3d276d['status'](_0x52cc30)[_0x8c07('0x26')]();};}function respondWithResult(_0x2bfcd7,_0x447d03){_0x447d03=_0x447d03||0xc8;return function(_0x5ab095){if(_0x5ab095){return _0x2bfcd7['status'](_0x447d03)['json'](_0x5ab095);}};}function respondWithFilteredResult(_0xa8b7dc,_0x2e748d){return function(_0x318897){if(_0x318897){var _0x3f671f=typeof _0x2e748d[_0x8c07('0x27')]==='undefined'&&typeof _0x2e748d[_0x8c07('0x28')]==='undefined';var _0x3643f8=_0x318897['count'];var _0xe01b51=_0x3f671f?0x0:_0x2e748d[_0x8c07('0x27')];var _0x1f6942=_0x3f671f?_0x318897[_0x8c07('0x29')]:_0x2e748d[_0x8c07('0x27')]+_0x2e748d[_0x8c07('0x28')];var _0x27cb69;if(_0x1f6942>=_0x3643f8){_0x1f6942=_0x3643f8;_0x27cb69=0xc8;}else{_0x27cb69=0xce;}_0xa8b7dc['status'](_0x27cb69);return _0xa8b7dc[_0x8c07('0x2a')](_0x8c07('0x2b'),_0xe01b51+'-'+_0x1f6942+'/'+_0x3643f8)['json'](_0x318897);}return null;};}function patchUpdates(_0x3061ef){return function(_0xb9a3ab){try{jsonpatch[_0x8c07('0x2c')](_0xb9a3ab,_0x3061ef,!![]);}catch(_0x4b0d7e){return BPromise[_0x8c07('0x2d')](_0x4b0d7e);}return _0xb9a3ab['save']();};}function saveUpdates(_0x388daa,_0x506fba){return function(_0x1a2d34){if(_0x1a2d34){return _0x1a2d34[_0x8c07('0x2e')](_0x388daa)[_0x8c07('0x2f')](function(_0x33f891){return _0x33f891;});}return null;};}function removeEntity(_0x37a9b3,_0xdfe5ba){return function(_0x4abf81){if(_0x4abf81){return _0x4abf81[_0x8c07('0x30')]()[_0x8c07('0x2f')](function(){_0x37a9b3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x250e9f,_0x11c4dd){return function(_0x35430f){if(!_0x35430f){_0x250e9f['sendStatus'](0x194);}return _0x35430f;};}function handleError(_0x3b58d,_0x3c914c){_0x3c914c=_0x3c914c||0x1f4;return function(_0xce7902){logger[_0x8c07('0x21')](_0xce7902[_0x8c07('0x31')]);if(_0xce7902['name']){delete _0xce7902[_0x8c07('0x32')];}_0x3b58d[_0x8c07('0x33')](_0x3c914c)['send'](_0xce7902);};}exports[_0x8c07('0x34')]=function(_0x26abf5,_0x41bc15){var _0x345c63={},_0x137d3c={},_0x1ca655={'count':0x0,'rows':[]};var _0x406a18=_['map'](db[_0x8c07('0x35')][_0x8c07('0x36')],function(_0x41476f){return{'name':_0x41476f['fieldName'],'type':_0x41476f['type'][_0x8c07('0x37')]};});_0x137d3c[_0x8c07('0x38')]=_[_0x8c07('0x39')](_0x406a18,_0x8c07('0x32'));_0x137d3c[_0x8c07('0x3a')]=_[_0x8c07('0x3b')](_0x26abf5[_0x8c07('0x3a')]);_0x137d3c[_0x8c07('0x3c')]=_['intersection'](_0x137d3c[_0x8c07('0x38')],_0x137d3c[_0x8c07('0x3a')]);_0x345c63[_0x8c07('0x3d')]=_[_0x8c07('0x3e')](_0x137d3c[_0x8c07('0x38')],qs[_0x8c07('0x3f')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x3f')]));_0x345c63[_0x8c07('0x3d')]=_0x345c63[_0x8c07('0x3d')][_0x8c07('0x40')]?_0x345c63[_0x8c07('0x3d')]:_0x137d3c[_0x8c07('0x38')];if(!_0x26abf5[_0x8c07('0x3a')]['hasOwnProperty'](_0x8c07('0x41'))){_0x345c63[_0x8c07('0x28')]=qs[_0x8c07('0x28')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x28')]);_0x345c63['offset']=qs[_0x8c07('0x27')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x27')]);}_0x345c63[_0x8c07('0x42')]=qs[_0x8c07('0x43')](_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x43')]);_0x345c63[_0x8c07('0x44')]=qs['filters'](_['pick'](_0x26abf5['query'],_0x137d3c['filters']),_0x406a18);if(_0x26abf5['query'][_0x8c07('0x45')]){_0x345c63[_0x8c07('0x44')]=_[_0x8c07('0x46')](_0x345c63[_0x8c07('0x44')],{'$or':_[_0x8c07('0x39')](_0x406a18,function(_0x48646e){if(_0x48646e['type']!==_0x8c07('0x47')){var _0x96cb3f={};_0x96cb3f[_0x48646e[_0x8c07('0x32')]]={'$like':'%'+_0x26abf5[_0x8c07('0x3a')]['filter']+'%'};return _0x96cb3f;}})});}_0x345c63=_[_0x8c07('0x46')]({},_0x345c63,_0x26abf5['options']);var _0x49ec39={'where':_0x345c63[_0x8c07('0x44')]};return db[_0x8c07('0x35')]['count'](_0x49ec39)[_0x8c07('0x2f')](function(_0x99aadf){_0x1ca655[_0x8c07('0x29')]=_0x99aadf;if(_0x26abf5[_0x8c07('0x3a')][_0x8c07('0x48')]){_0x345c63['include']=[{'all':!![]}];}return db[_0x8c07('0x35')][_0x8c07('0x49')](_0x345c63);})[_0x8c07('0x2f')](function(_0x417538){_0x1ca655['rows']=_0x417538;return _0x1ca655;})['then'](respondWithFilteredResult(_0x41bc15,_0x345c63))[_0x8c07('0x25')](handleError(_0x41bc15,null));};exports[_0x8c07('0x4a')]=function(_0x814b0,_0x3e1cf1){var _0x5c2c8f={'raw':![],'where':{'id':_0x814b0[_0x8c07('0x4b')]['id']}},_0x5a2911={};_0x5a2911['model']=_[_0x8c07('0x3b')](db[_0x8c07('0x35')]['rawAttributes']);_0x5a2911[_0x8c07('0x3a')]=_[_0x8c07('0x3b')](_0x814b0['query']);_0x5a2911['filters']=_['intersection'](_0x5a2911['model'],_0x5a2911[_0x8c07('0x3a')]);_0x5c2c8f[_0x8c07('0x3d')]=_['intersection'](_0x5a2911[_0x8c07('0x38')],qs['fields'](_0x814b0[_0x8c07('0x3a')][_0x8c07('0x3f')]));_0x5c2c8f[_0x8c07('0x3d')]=_0x5c2c8f[_0x8c07('0x3d')][_0x8c07('0x40')]?_0x5c2c8f[_0x8c07('0x3d')]:_0x5a2911[_0x8c07('0x38')];if(_0x814b0[_0x8c07('0x3a')][_0x8c07('0x48')]){_0x5c2c8f['include']=[{'all':!![]}];}_0x5c2c8f=_['merge']({},_0x5c2c8f,_0x814b0[_0x8c07('0x4c')]);return db[_0x8c07('0x35')][_0x8c07('0x4d')](_0x5c2c8f)[_0x8c07('0x2f')](handleEntityNotFound(_0x3e1cf1,null))['then'](respondWithResult(_0x3e1cf1,null))['catch'](handleError(_0x3e1cf1,null));};exports[_0x8c07('0x2e')]=function(_0x5cc6f9,_0x9c2bcc){if(_0x5cc6f9[_0x8c07('0x4e')]['id']){delete _0x5cc6f9[_0x8c07('0x4e')]['id'];}return db['Setting'][_0x8c07('0x4d')]({'where':{'id':_0x5cc6f9[_0x8c07('0x4b')]['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x9c2bcc,null))[_0x8c07('0x2f')](saveUpdates(_0x5cc6f9[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x9c2bcc,null))['catch'](handleError(_0x9c2bcc,null));};exports[_0x8c07('0x4f')]=function(_0x4dac5d,_0x35ddc1,_0x36e11f){if(_0x4dac5d[_0x8c07('0x50')]&&_0x4dac5d[_0x8c07('0x50')][_0x8c07('0x51')]){_0x4dac5d[_0x8c07('0x4e')][_0x8c07('0x52')]=_0x4dac5d[_0x8c07('0x50')][_0x8c07('0x51')];}return db[_0x8c07('0x35')]['find']({'where':{'id':_0x4dac5d[_0x8c07('0x4b')]['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x35ddc1,null))[_0x8c07('0x2f')](saveUpdates(_0x4dac5d[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x35ddc1,null))[_0x8c07('0x25')](handleError(_0x35ddc1,null));};exports[_0x8c07('0x53')]=function(_0x1676be,_0x251aa7,_0x4e2b11){if(_0x1676be[_0x8c07('0x50')]&&_0x1676be['file']['filename']){_0x1676be[_0x8c07('0x4e')][_0x8c07('0x54')]=_0x1676be['file'][_0x8c07('0x51')];}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x1676be['params']['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x251aa7,null))[_0x8c07('0x2f')](saveUpdates(_0x1676be['body'],null))[_0x8c07('0x2f')](respondWithResult(_0x251aa7,null))['catch'](handleError(_0x251aa7,null));};var utilLicense=require(_0x8c07('0x16'));exports['getLogo']=function(_0x5e3189,_0x18859f,_0x172aa7){var _0x13412a=_0x8c07('0x55');var _0x27fdf3={'custom':![]};return utilLicense[_0x8c07('0x56')]()[_0x8c07('0x2f')](function(_0x35462d){if(_0x35462d){_0x27fdf3=_0x35462d;}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x5e3189[_0x8c07('0x4b')]['id']},'attributes':[_0x8c07('0x52'),_0x8c07('0x54'),_0x8c07('0x57'),_0x8c07('0x58'),_0x8c07('0x59'),_0x8c07('0x5a'),_0x8c07('0x5b'),_0x8c07('0x5c')],'raw':!![]});})[_0x8c07('0x2f')](handleEntityNotFound(_0x18859f,null))['then'](function(_0x27f44c){if(_0x27f44c){var _0x20f3b4=_0x27f44c[_0x8c07('0x52')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x13412a,_[_0x8c07('0x60')](_0x27f44c[_0x8c07('0x52')])))?path['join'](config[_0x8c07('0x5f')],_0x13412a,_['toLower'](_0x27f44c[_0x8c07('0x52')])):path[_0x8c07('0x5e')](config['root'],_0x13412a,_['toLower']('default_logo.svg'));var _0x1e5b94=_0x8c07('0x61')+_[_0x8c07('0x62')]('logo');if(_0x27f44c[_0x1e5b94]||!_0x27fdf3['custom']){_0x20f3b4=path['join'](config[_0x8c07('0x5f')],_0x13412a,_[_0x8c07('0x60')](_0x8c07('0x63')));}if(!fs[_0x8c07('0x5d')](_0x20f3b4)){throw new db[(_0x8c07('0x64'))]['ValidationError'](_['upperFirst'](_0x8c07('0x52'))+_0x8c07('0x65'));}return _0x18859f['download'](_0x20f3b4);}})['catch'](handleError(_0x18859f,null));};var utilLicense=require(_0x8c07('0x16'));exports['getLogoLogin']=function(_0x511960,_0x592680,_0x54bed9){var _0x297f31=_0x8c07('0x55');var _0x34d9f6={'custom':![]};return utilLicense[_0x8c07('0x56')]()[_0x8c07('0x2f')](function(_0x218298){if(_0x218298){_0x34d9f6=_0x218298;}return db[_0x8c07('0x35')]['find']({'where':{'id':_0x511960[_0x8c07('0x4b')]['id']},'attributes':[_0x8c07('0x52'),'loginLogo','preferred',_0x8c07('0x58'),'defaultLogo',_0x8c07('0x5a'),_0x8c07('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x8c07('0x2f')](handleEntityNotFound(_0x592680,null))[_0x8c07('0x2f')](function(_0x3766b3){if(_0x3766b3){var _0x30716f=_0x3766b3[_0x8c07('0x54')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_[_0x8c07('0x60')](_0x3766b3[_0x8c07('0x54')])))?path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_['toLower'](_0x3766b3[_0x8c07('0x54')])):path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_['toLower'](_0x8c07('0x66')));var _0x389445=_0x8c07('0x61')+_[_0x8c07('0x62')](_0x8c07('0x54'));if(_0x3766b3[_0x389445]||!_0x34d9f6[_0x8c07('0x67')]){_0x30716f=path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x297f31,_[_0x8c07('0x60')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x30716f)){throw new db[(_0x8c07('0x64'))][(_0x8c07('0x68'))](_[_0x8c07('0x62')](_0x8c07('0x54'))+_0x8c07('0x65'));}return _0x592680[_0x8c07('0x69')](_0x30716f);}})[_0x8c07('0x25')](handleError(_0x592680,null));};exports[_0x8c07('0x6a')]=function(_0x42ffab,_0x5de5f5){return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x42ffab[_0x8c07('0x4b')]['id']},'attributes':[_0x8c07('0x6b')]})[_0x8c07('0x2f')](respondWithResult(_0x5de5f5,null))[_0x8c07('0x25')](handleError(_0x5de5f5,null));};exports[_0x8c07('0x6c')]=function(_0x1dedd3,_0x40720c,_0x227d4d){if(_0x1dedd3[_0x8c07('0x50')]&&_0x1dedd3['file'][_0x8c07('0x51')]){_0x1dedd3['body'][_0x8c07('0x57')]=_0x1dedd3['file']['filename'];}return db[_0x8c07('0x35')]['find']({'where':{'id':_0x1dedd3['params']['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x40720c,null))['then'](saveUpdates(_0x1dedd3[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x40720c,null))['catch'](handleError(_0x40720c,null));};var utilLicense=require(_0x8c07('0x16'));exports[_0x8c07('0x6d')]=function(_0xd5810c,_0x4705f9,_0xa3f6ed){var _0x5e1ef7='server/files/images/logos';var _0xeda979={'custom':![]};return utilLicense[_0x8c07('0x56')]()[_0x8c07('0x2f')](function(_0x58d478){if(_0x58d478){_0xeda979=_0x58d478;}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0xd5810c[_0x8c07('0x4b')]['id']},'attributes':['logo',_0x8c07('0x54'),_0x8c07('0x57'),_0x8c07('0x58'),_0x8c07('0x59'),'defaultLoginLogo','defaultPreferred',_0x8c07('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x4705f9,null))['then'](function(_0x1a2480){if(_0x1a2480){var _0xbb4b2c=_0x1a2480[_0x8c07('0x57')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x5e1ef7,_[_0x8c07('0x60')](_0x1a2480[_0x8c07('0x57')])))?path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x5e1ef7,_['toLower'](_0x1a2480[_0x8c07('0x57')])):path['join'](config[_0x8c07('0x5f')],_0x5e1ef7,_[_0x8c07('0x60')](_0x8c07('0x6e')));var _0x20302c=_0x8c07('0x61')+_[_0x8c07('0x62')](_0x8c07('0x57'));if(_0x1a2480[_0x20302c]||!_0xeda979[_0x8c07('0x67')]||!_0xeda979[_0x8c07('0x57')]){_0xbb4b2c=path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x5e1ef7,_[_0x8c07('0x60')]('default_preferred.png'));}if(!fs[_0x8c07('0x5d')](_0xbb4b2c)){throw new db[(_0x8c07('0x64'))][(_0x8c07('0x68'))](_[_0x8c07('0x62')](_0x8c07('0x57'))+_0x8c07('0x65'));}return _0x4705f9['download'](_0xbb4b2c);}})[_0x8c07('0x25')](handleError(_0x4705f9,null));};exports[_0x8c07('0x6f')]=function(_0x13945e,_0x1bb0fd,_0x3e2472){if(_0x13945e[_0x8c07('0x50')]&&_0x13945e['file'][_0x8c07('0x51')]){_0x13945e['body'][_0x8c07('0x58')]=_0x13945e[_0x8c07('0x50')][_0x8c07('0x51')];}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x13945e[_0x8c07('0x4b')]['id']}})[_0x8c07('0x2f')](handleEntityNotFound(_0x1bb0fd,null))[_0x8c07('0x2f')](saveUpdates(_0x13945e[_0x8c07('0x4e')],null))[_0x8c07('0x2f')](respondWithResult(_0x1bb0fd,null))[_0x8c07('0x25')](handleError(_0x1bb0fd,null));};var utilLicense=require(_0x8c07('0x16'));exports[_0x8c07('0x70')]=function(_0x449633,_0x16db58,_0x457564){var _0x45ae4b=_0x8c07('0x55');var _0x45fe9b={'custom':![]};return utilLicense[_0x8c07('0x56')]()['then'](function(_0x545338){if(_0x545338){_0x45fe9b=_0x545338;}return db[_0x8c07('0x35')][_0x8c07('0x4d')]({'where':{'id':_0x449633[_0x8c07('0x4b')]['id']},'attributes':['logo',_0x8c07('0x54'),_0x8c07('0x57'),_0x8c07('0x58'),_0x8c07('0x59'),_0x8c07('0x5a'),_0x8c07('0x5b'),_0x8c07('0x5c')],'raw':!![]});})[_0x8c07('0x2f')](handleEntityNotFound(_0x16db58,null))['then'](function(_0x31a796){if(_0x31a796){var _0x927133=_0x31a796[_0x8c07('0x58')]&&fs[_0x8c07('0x5d')](path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_[_0x8c07('0x60')](_0x31a796['favicon'])))?path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_[_0x8c07('0x60')](_0x31a796['favicon'])):path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_['toLower'](_0x8c07('0x71')));var _0x2e9b8b=_0x8c07('0x61')+_[_0x8c07('0x62')](_0x8c07('0x58'));if(_0x31a796[_0x2e9b8b]||!_0x45fe9b['custom']){_0x927133=path[_0x8c07('0x5e')](config[_0x8c07('0x5f')],_0x45ae4b,_['toLower'](_0x8c07('0x71')));}if(!fs[_0x8c07('0x5d')](_0x927133)){throw new db['Sequelize'][(_0x8c07('0x68'))](_['upperFirst']('favicon')+_0x8c07('0x65'));}return _0x16db58[_0x8c07('0x69')](_0x927133);}})[_0x8c07('0x25')](handleError(_0x16db58,null));};exports[_0x8c07('0x72')]=function(_0x24ea39,_0x43bf14){var _0x2f20ee={'offset':moment()['utcOffset']()};_0x2f20ee[_0x8c07('0x73')]=moment()[_0x8c07('0x74')](_0x2f20ee[_0x8c07('0x27')])[_0x8c07('0x75')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x43bf14[_0x8c07('0x33')](0xc8)['send'](_0x2f20ee);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 65579a7..6b22524 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x1bcbf7,_0x31bf2a){var _0x4aeb5b=function(_0x113ee2){while(--_0x113ee2){_0x1bcbf7['push'](_0x1bcbf7['shift']());}};_0x4aeb5b(++_0x31bf2a);}(_0x3e74,0x175));var _0x43e7=function(_0x3fb6fb,_0x1d4e00){_0x3fb6fb=_0x3fb6fb-0x0;var _0x5c99ec=_0x3e74[_0x3fb6fb];return _0x5c99ec;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0xbd29ae,_0xd0989){var _0x1d2837=function(_0x276a97){while(--_0x276a97){_0xbd29ae['push'](_0xbd29ae['shift']());}};_0x1d2837(++_0xd0989);}(_0xe14b,0x93));var _0xbe14=function(_0x26acad,_0x34a85d){_0x26acad=_0x26acad-0x0;var _0x5ca7ea=_0xe14b[_0x26acad];return _0x5ca7ea;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 21e63fe..131e2d1 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 _0x938a=['find','options','raw','where','attributes','include','map','model','then','ShowSetting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Setting'];(function(_0x53d86c,_0x1cd5cd){var _0x2b3985=function(_0x1ac831){while(--_0x1ac831){_0x53d86c['push'](_0x53d86c['shift']());}};_0x2b3985(++_0x1cd5cd);}(_0x938a,0x168));var _0xa938=function(_0x55542b,_0x435e1e){_0x55542b=_0x55542b-0x0;var _0x488038=_0x938a[_0x55542b];return _0x488038;};'use strict';var _=require('lodash');var util=require(_0xa938('0x0'));var moment=require(_0xa938('0x1'));var BPromise=require(_0xa938('0x2'));var rs=require(_0xa938('0x3'));var fs=require('fs');var Redis=require(_0xa938('0x4'));var db=require(_0xa938('0x5'))['db'];var utils=require(_0xa938('0x6'));var logger=require(_0xa938('0x7'))('rpc');var config=require(_0xa938('0x8'));var jayson=require(_0xa938('0x9'));var client=jayson[_0xa938('0xa')][_0xa938('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2041ca,_0x1f241e,_0x2ce8aa){return new BPromise(function(_0xe3c438,_0x359a80){return client[_0xa938('0xc')](_0x2041ca,_0x2ce8aa)['then'](function(_0x59808d){logger[_0xa938('0xd')](_0xa938('0xe'),_0x1f241e,_0xa938('0xf'));logger[_0xa938('0x10')](_0xa938('0x11'),_0x1f241e,_0xa938('0xf'),JSON[_0xa938('0x12')](_0x59808d));if(_0x59808d[_0xa938('0x13')]){if(_0x59808d[_0xa938('0x13')][_0xa938('0x14')]===0x1f4){logger[_0xa938('0x13')](_0xa938('0xe'),_0x1f241e,_0x59808d[_0xa938('0x13')][_0xa938('0x15')]);return _0x359a80(_0x59808d['error'][_0xa938('0x15')]);}logger[_0xa938('0x13')](_0xa938('0xe'),_0x1f241e,_0x59808d['error'][_0xa938('0x15')]);return _0xe3c438(_0x59808d[_0xa938('0x13')][_0xa938('0x15')]);}else{logger[_0xa938('0xd')](_0xa938('0xe'),_0x1f241e,_0xa938('0xf'));_0xe3c438(_0x59808d[_0xa938('0x16')][_0xa938('0x15')]);}})[_0xa938('0x17')](function(_0x2addf9){logger[_0xa938('0x13')](_0xa938('0xe'),_0x1f241e,_0x2addf9);_0x359a80(_0x2addf9);});});}exports['ShowSetting']=function(_0x3e7b87){var _0x2d8e52=this;return new Promise(function(_0x459897,_0x4b1213){return db[_0xa938('0x18')][_0xa938('0x19')]({'raw':_0x3e7b87[_0xa938('0x1a')]?_0x3e7b87[_0xa938('0x1a')][_0xa938('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e7b87['options']?_0x3e7b87[_0xa938('0x1a')][_0xa938('0x1c')]||null:null,'attributes':_0x3e7b87['options']?_0x3e7b87[_0xa938('0x1a')][_0xa938('0x1d')]||null:null,'include':_0x3e7b87[_0xa938('0x1a')]?_0x3e7b87[_0xa938('0x1a')][_0xa938('0x1e')]?_[_0xa938('0x1f')](_0x3e7b87['options'][_0xa938('0x1e')],function(_0x156bf5){return{'model':db[_0x156bf5[_0xa938('0x20')]],'as':_0x156bf5['as'],'attributes':_0x156bf5[_0xa938('0x1d')],'include':_0x156bf5[_0xa938('0x1e')]?_[_0xa938('0x1f')](_0x156bf5[_0xa938('0x1e')],function(_0x51541c){return{'model':db[_0x51541c[_0xa938('0x20')]],'as':_0x51541c['as'],'attributes':_0x51541c[_0xa938('0x1d')],'include':_0x51541c[_0xa938('0x1e')]?_[_0xa938('0x1f')](_0x51541c[_0xa938('0x1e')],function(_0x4b9557){return{'model':db[_0x4b9557[_0xa938('0x20')]],'as':_0x4b9557['as'],'attributes':_0x4b9557[_0xa938('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa938('0x21')](function(_0x35623e){logger['info']('ShowSetting',_0x3e7b87);logger[_0xa938('0x10')](_0xa938('0x22'),_0x3e7b87,JSON[_0xa938('0x12')](_0x35623e));_0x459897(_0x35623e);})[_0xa938('0x17')](function(_0x1fbbb8){logger[_0xa938('0x13')](_0xa938('0x22'),_0x1fbbb8['message'],_0x3e7b87);_0x4b1213(_0x2d8e52[_0xa938('0x13')](0x1f4,_0x1fbbb8['message']));});});}; \ No newline at end of file +var _0x3c69=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Setting','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','randomstring'];(function(_0x5dbe23,_0x29c9d5){var _0xf3f9c4=function(_0x5262f2){while(--_0x5262f2){_0x5dbe23['push'](_0x5dbe23['shift']());}};_0xf3f9c4(++_0x29c9d5);}(_0x3c69,0xd5));var _0x93c6=function(_0xd2e2ab,_0x2440cf){_0xd2e2ab=_0xd2e2ab-0x0;var _0x1703a2=_0x3c69[_0xd2e2ab];return _0x1703a2;};'use strict';var _=require(_0x93c6('0x0'));var util=require(_0x93c6('0x1'));var moment=require(_0x93c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x93c6('0x3'));var fs=require('fs');var Redis=require(_0x93c6('0x4'));var db=require(_0x93c6('0x5'))['db'];var utils=require(_0x93c6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x93c6('0x7'));var jayson=require(_0x93c6('0x8'));var client=jayson['client'][_0x93c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32eb9b,_0x3565c1,_0x1a1fef){return new BPromise(function(_0x46948b,_0x510fd1){return client[_0x93c6('0xa')](_0x32eb9b,_0x1a1fef)[_0x93c6('0xb')](function(_0x6c32aa){logger[_0x93c6('0xc')](_0x93c6('0xd'),_0x3565c1,_0x93c6('0xe'));logger[_0x93c6('0xf')](_0x93c6('0x10'),_0x3565c1,_0x93c6('0xe'),JSON[_0x93c6('0x11')](_0x6c32aa));if(_0x6c32aa[_0x93c6('0x12')]){if(_0x6c32aa['error'][_0x93c6('0x13')]===0x1f4){logger[_0x93c6('0x12')](_0x93c6('0xd'),_0x3565c1,_0x6c32aa[_0x93c6('0x12')][_0x93c6('0x14')]);return _0x510fd1(_0x6c32aa[_0x93c6('0x12')][_0x93c6('0x14')]);}logger['error'](_0x93c6('0xd'),_0x3565c1,_0x6c32aa[_0x93c6('0x12')]['message']);return _0x46948b(_0x6c32aa[_0x93c6('0x12')][_0x93c6('0x14')]);}else{logger[_0x93c6('0xc')](_0x93c6('0xd'),_0x3565c1,_0x93c6('0xe'));_0x46948b(_0x6c32aa[_0x93c6('0x15')][_0x93c6('0x14')]);}})[_0x93c6('0x16')](function(_0x48f4eb){logger[_0x93c6('0x12')](_0x93c6('0xd'),_0x3565c1,_0x48f4eb);_0x510fd1(_0x48f4eb);});});}exports['ShowSetting']=function(_0x2d1275){var _0x6818a=this;return new Promise(function(_0x46f038,_0x2c711a){return db[_0x93c6('0x17')]['find']({'raw':_0x2d1275[_0x93c6('0x18')]?_0x2d1275[_0x93c6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2d1275['options']?_0x2d1275[_0x93c6('0x18')][_0x93c6('0x19')]||null:null,'attributes':_0x2d1275[_0x93c6('0x18')]?_0x2d1275[_0x93c6('0x18')][_0x93c6('0x1a')]||null:null,'include':_0x2d1275[_0x93c6('0x18')]?_0x2d1275['options'][_0x93c6('0x1b')]?_[_0x93c6('0x1c')](_0x2d1275[_0x93c6('0x18')]['include'],function(_0x1068ac){return{'model':db[_0x1068ac[_0x93c6('0x1d')]],'as':_0x1068ac['as'],'attributes':_0x1068ac['attributes'],'include':_0x1068ac[_0x93c6('0x1b')]?_['map'](_0x1068ac[_0x93c6('0x1b')],function(_0x4fa414){return{'model':db[_0x4fa414[_0x93c6('0x1d')]],'as':_0x4fa414['as'],'attributes':_0x4fa414['attributes'],'include':_0x4fa414['include']?_['map'](_0x4fa414['include'],function(_0x46a270){return{'model':db[_0x46a270['model']],'as':_0x46a270['as'],'attributes':_0x46a270[_0x93c6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3deb47){logger[_0x93c6('0xc')]('ShowSetting',_0x2d1275);logger[_0x93c6('0xf')](_0x93c6('0x1e'),_0x2d1275,JSON[_0x93c6('0x11')](_0x3deb47));_0x46f038(_0x3deb47);})[_0x93c6('0x16')](function(_0x348897){logger['error'](_0x93c6('0x1e'),_0x348897[_0x93c6('0x14')],_0x2d1275);_0x2c711a(_0x6818a[_0x93c6('0x12')](0x1f4,_0x348897[_0x93c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2ab4f83..d8eaa4f 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x41187b,_0x4f05fe){var _0x29b244=function(_0xb15d76){while(--_0xb15d76){_0x41187b['push'](_0x41187b['shift']());}};_0x29b244(++_0x4f05fe);}(_0x6aa7,0x178));var _0x76aa=function(_0x3c15b8,_0x2b2ed1){_0x3c15b8=_0x3c15b8-0x0;var _0x47ef65=_0x6aa7[_0x3c15b8];return _0x47ef65;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0x55ca=['describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x55ca,0x126));var _0xa55c=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x55ca[_0x3a441a];return _0x3128a2;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getApplications']);router['get'](_0xa55c('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xa55c('0x12'),controller[_0xa55c('0x13')]);router[_0xa55c('0x7')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x17')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);router[_0xa55c('0x17')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller['addAnswer']);router[_0xa55c('0x17')](_0xa55c('0x19'),controller[_0xa55c('0x1a')]);router[_0xa55c('0x17')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['addApplications']);router['post'](_0xa55c('0x1b'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1c')]);router['post'](_0xa55c('0x12'),controller[_0xa55c('0x1d')]);router['post'](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x1e')]);router[_0xa55c('0x1f')](_0xa55c('0xb'),auth['isAuthenticated'](),controller[_0xa55c('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x21')]);router['delete'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x22')]);router[_0xa55c('0x23')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x24')]);router[_0xa55c('0x23')](_0xa55c('0x14'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 018e794..8d458f1 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 _0xfcd0=['sequelize','STRING','generate','ENUM','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x121f72,_0x299f72){var _0x3ef898=function(_0x10c0f8){while(--_0x10c0f8){_0x121f72['push'](_0x121f72['shift']());}};_0x3ef898(++_0x299f72);}(_0xfcd0,0xb4));var _0x0fcd=function(_0x10bfd1,_0x4665d9){_0x10bfd1=_0x10bfd1-0x0;var _0x182a00=_0xfcd0[_0x10bfd1];return _0x182a00;};'use strict';var Sequelize=require(_0x0fcd('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x0fcd('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0fcd('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x0fcd('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x0fcd('0x1')],'defaultValue':function(){return rs[_0x0fcd('0x2')]();}},'phone':{'type':Sequelize[_0x0fcd('0x1')]},'type':{'type':Sequelize[_0x0fcd('0x3')]('twilio','skebby','connectel',_0x0fcd('0x4'),_0x0fcd('0x5'),_0x0fcd('0x6'),'bandwidth',_0x0fcd('0x7'),_0x0fcd('0x8'),_0x0fcd('0x9'))},'accountSid':{'type':Sequelize[_0x0fcd('0x1')]},'authId':{'type':Sequelize[_0x0fcd('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x0fcd('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0fcd('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0fcd('0x1')]},'applicationId':{'type':Sequelize[_0x0fcd('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x0fcd('0x1')]},'deliveryReport':{'type':Sequelize[_0x0fcd('0xa')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0fcd('0xb')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0fcd('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0fcd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0fcd('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fcd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fcd('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0fcd('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0fcd('0xc')],'comment':_0x0fcd('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x0fcd('0xa')],'defaultValue':![],'comment':_0x0fcd('0xe'),'set':function(_0x46deb0){if(!_0x46deb0)this[_0x0fcd('0xf')](_0x0fcd('0x10'),null);this[_0x0fcd('0xf')](_0x0fcd('0x11'),_0x46deb0);}}}; \ No newline at end of file +var _0x565b=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x32cf3c,_0x3f7dc5){var _0x117b60=function(_0x344bf4){while(--_0x344bf4){_0x32cf3c['push'](_0x32cf3c['shift']());}};_0x117b60(++_0x3f7dc5);}(_0x565b,0xc9));var _0xb565=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x565b[_0x35f6b4];return _0x10f072;};'use strict';var Sequelize=require(_0xb565('0x0'));var rs=require('randomstring');module[_0xb565('0x1')]={'name':{'type':Sequelize[_0xb565('0x2')],'unique':_0xb565('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb565('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb565('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xb565('0x2')],'defaultValue':function(){return rs[_0xb565('0x4')]();}},'phone':{'type':Sequelize[_0xb565('0x2')]},'type':{'type':Sequelize[_0xb565('0x5')](_0xb565('0x6'),_0xb565('0x7'),_0xb565('0x8'),_0xb565('0x9'),_0xb565('0xa'),_0xb565('0xb'),'bandwidth','csc',_0xb565('0xc'),_0xb565('0xd'))},'accountSid':{'type':Sequelize[_0xb565('0x2')]},'authId':{'type':Sequelize[_0xb565('0x2')]},'authToken':{'type':Sequelize[_0xb565('0x2')]},'smsMethod':{'type':Sequelize[_0xb565('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb565('0x2')]},'password':{'type':Sequelize[_0xb565('0x2')]},'apiKey':{'type':Sequelize[_0xb565('0x2')]},'applicationId':{'type':Sequelize[_0xb565('0x2')]},'accountId':{'type':Sequelize[_0xb565('0x2')]},'senderString':{'type':Sequelize[_0xb565('0x2')]},'deliveryReport':{'type':Sequelize[_0xb565('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xb565('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb565('0xf')],'defaultValue':function(){return _0xb565('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb565('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb565('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb565('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb565('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb565('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb565('0x11')],'comment':_0xb565('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb565('0x13'),'set':function(_0x3a514e){if(!_0x3a514e)this[_0xb565('0x14')](_0xb565('0x15'),null);this[_0xb565('0x14')]('mandatoryDisposition',_0x3a514e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4a2522c..5c42117 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 _0x863e=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','SmsAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','show','params','keys','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','SmsAccountId','include','rows','removeDispositions','ids','CannedAnswer','findAll','removeAnswers','notify','account','priority','asc','Applications','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','clicksend','From','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','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','CmContact','Contacts','list','omit','defaults','contact','SmsInteraction','spread','interaction','autoclose','push','applications','close','unmanaged','created','ContactId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','message_id','status_code','DELIVERED','bandwidth','intelepeer','redif','inspect','connectel','error_code','groupName','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x5879cd,_0x447eff){var _0x3dcb06=function(_0x1674e6){while(--_0x1674e6){_0x5879cd['push'](_0x5879cd['shift']());}};_0x3dcb06(++_0x447eff);}(_0x863e,0xdd));var _0xe863=function(_0x5698f2,_0x4e2905){_0x5698f2=_0x5698f2-0x0;var _0x1f3f63=_0x863e[_0x5698f2];return _0x1f3f63;};'use strict';var emlformat=require(_0xe863('0x0'));var rimraf=require(_0xe863('0x1'));var zipdir=require(_0xe863('0x2'));var jsonpatch=require(_0xe863('0x3'));var rp=require(_0xe863('0x4'));var moment=require(_0xe863('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe863('0x6'));var util=require(_0xe863('0x7'));var path=require(_0xe863('0x8'));var sox=require('sox');var csv=require(_0xe863('0x9'));var ejs=require(_0xe863('0xa'));var fs=require('fs');var fs_extra=require(_0xe863('0xb'));var _=require(_0xe863('0xc'));var squel=require(_0xe863('0xd'));var crypto=require(_0xe863('0xe'));var jsforce=require(_0xe863('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe863('0x9'));var querystring=require(_0xe863('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe863('0x11'));var qs=require(_0xe863('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe863('0x13'));var logger=require('../../config/logger')(_0xe863('0x14'));var utils=require(_0xe863('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe863('0x16'));var db=require(_0xe863('0x17'))['db'];config['redis']=_['defaults'](config[_0xe863('0x18')],{'host':_0xe863('0x19'),'port':0x18eb});var socket=require(_0xe863('0x1a'))(new Redis(config[_0xe863('0x18')]));require('./smsAccount.socket')[_0xe863('0x1b')](socket);var jayson=require(_0xe863('0x1c'));var client=jayson[_0xe863('0x1d')][_0xe863('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0xc6118c,_0x5cc5fc,_0x427d59,_0x3e6462){return new BPromise(function(_0x573742,_0xe14e20){var _0x35413e=_0x3e6462||client;return _0x35413e[_0xe863('0x1f')](_0xc6118c,_0x427d59)['then'](function(_0x377e79){logger[_0xe863('0x20')](_0xe863('0x21'),_0x5cc5fc,'request\x20sent');logger[_0xe863('0x22')](_0xe863('0x23'),_0x5cc5fc,'request\x20sent',JSON[_0xe863('0x24')](_0x377e79));if(_0x377e79[_0xe863('0x25')]){if(_0x377e79['error'][_0xe863('0x26')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x5cc5fc,_0x377e79[_0xe863('0x25')][_0xe863('0x27')]);return _0xe14e20(_0x377e79[_0xe863('0x25')]['message']);}logger[_0xe863('0x25')]('SmsAccount,\x20%s,\x20%s',_0x5cc5fc,_0x377e79[_0xe863('0x25')][_0xe863('0x27')]);return _0x573742(_0x377e79[_0xe863('0x25')][_0xe863('0x27')]);}else{logger['info'](_0xe863('0x21'),_0x5cc5fc,_0xe863('0x28'));_0x573742(_0x377e79[_0xe863('0x29')][_0xe863('0x27')]);}})[_0xe863('0x2a')](function(_0x1e670c){logger[_0xe863('0x25')]('SmsAccount,\x20%s,\x20%s',_0x5cc5fc,_0x1e670c);_0xe14e20(_0x1e670c);});});}function respondWithStatusCode(_0x40320c,_0x20e15e){_0x20e15e=_0x20e15e||0xcc;return function(_0x5877d3){if(_0x5877d3){return _0x40320c[_0xe863('0x2b')](_0x20e15e);}return _0x40320c[_0xe863('0x2c')](_0x20e15e)[_0xe863('0x2d')]();};}function respondWithResult(_0x34255,_0x409987){_0x409987=_0x409987||0xc8;return function(_0x44e321){if(_0x44e321){return _0x34255['status'](_0x409987)[_0xe863('0x2e')](_0x44e321);}};}function respondWithFilteredResult(_0x1d8f4f,_0x4510e1){return function(_0x454a1b){if(_0x454a1b){var _0x3b994f=typeof _0x4510e1[_0xe863('0x2f')]===_0xe863('0x30')&&typeof _0x4510e1[_0xe863('0x31')]===_0xe863('0x30');var _0x33226a=_0x454a1b[_0xe863('0x32')];var _0x558146=_0x3b994f?0x0:_0x4510e1[_0xe863('0x2f')];var _0x4b5756=_0x3b994f?_0x454a1b['count']:_0x4510e1['offset']+_0x4510e1[_0xe863('0x31')];var _0x449eaf;if(_0x4b5756>=_0x33226a){_0x4b5756=_0x33226a;_0x449eaf=0xc8;}else{_0x449eaf=0xce;}_0x1d8f4f[_0xe863('0x2c')](_0x449eaf);return _0x1d8f4f[_0xe863('0x33')](_0xe863('0x34'),_0x558146+'-'+_0x4b5756+'/'+_0x33226a)[_0xe863('0x2e')](_0x454a1b);}return null;};}function patchUpdates(_0x2eb82d){return function(_0x5f4fc9){try{jsonpatch[_0xe863('0x35')](_0x5f4fc9,_0x2eb82d,!![]);}catch(_0x2a5b55){return BPromise['reject'](_0x2a5b55);}return _0x5f4fc9[_0xe863('0x36')]();};}function saveUpdates(_0x123334,_0x293e93){return function(_0x4c3455){if(_0x4c3455){return _0x4c3455[_0xe863('0x37')](_0x123334)[_0xe863('0x38')](function(_0x31ac84){return _0x31ac84;});}return null;};}function removeEntity(_0x145495,_0x5c269b){return function(_0x25e418){if(_0x25e418){return _0x25e418['destroy']()[_0xe863('0x38')](function(){var _0x1f5a55=_0x25e418['get']({'plain':!![]});var _0x2c8b29=_0xe863('0x39');return db[_0xe863('0x3a')][_0xe863('0x3b')]({'where':{'type':_0x2c8b29,'resourceId':_0x1f5a55['id']}})[_0xe863('0x38')](function(){return _0x25e418;});})['then'](function(){_0x145495[_0xe863('0x2c')](0xcc)[_0xe863('0x2d')]();});}};}function handleEntityNotFound(_0xbbc38f,_0x3a80c4){return function(_0x25ba52){if(!_0x25ba52){_0xbbc38f[_0xe863('0x2b')](0x194);}return _0x25ba52;};}function handleError(_0x38d73c,_0x3251ee){_0x3251ee=_0x3251ee||0x1f4;return function(_0x2b57f7){logger['error'](_0x2b57f7[_0xe863('0x3c')]);if(_0x2b57f7[_0xe863('0x3d')]){delete _0x2b57f7[_0xe863('0x3d')];}_0x38d73c[_0xe863('0x2c')](_0x3251ee)[_0xe863('0x3e')](_0x2b57f7);};}exports['index']=function(_0x2c38e5,_0x2c38d9){var _0x59fe60={'include':[{'model':db[_0xe863('0x3f')],'as':_0xe863('0x40')}]},_0x1232f4={},_0x2c3108={'count':0x0,'rows':[]};var _0xaa80c5=_[_0xe863('0x41')](db[_0xe863('0x42')][_0xe863('0x43')],function(_0x34c846){return{'name':_0x34c846['fieldName'],'type':_0x34c846[_0xe863('0x44')]['key']};});_0x1232f4[_0xe863('0x45')]=_[_0xe863('0x41')](_0xaa80c5,_0xe863('0x3d'));_0x1232f4[_0xe863('0x46')]=_['keys'](_0x2c38e5[_0xe863('0x46')]);_0x1232f4['filters']=_[_0xe863('0x47')](_0x1232f4[_0xe863('0x45')],_0x1232f4['query']);_0x59fe60[_0xe863('0x48')]=_['intersection'](_0x1232f4[_0xe863('0x45')],qs[_0xe863('0x49')](_0x2c38e5[_0xe863('0x46')][_0xe863('0x49')]));_0x59fe60[_0xe863('0x48')]=_0x59fe60['attributes'][_0xe863('0x4a')]?_0x59fe60[_0xe863('0x48')]:_0x1232f4[_0xe863('0x45')];if(!_0x2c38e5['query'][_0xe863('0x4b')](_0xe863('0x4c'))){_0x59fe60['limit']=qs[_0xe863('0x31')](_0x2c38e5[_0xe863('0x46')]['limit']);_0x59fe60[_0xe863('0x2f')]=qs[_0xe863('0x2f')](_0x2c38e5[_0xe863('0x46')][_0xe863('0x2f')]);}_0x59fe60['order']=qs['sort'](_0x2c38e5[_0xe863('0x46')][_0xe863('0x4d')]);_0x59fe60[_0xe863('0x4e')]=qs['filters'](_['pick'](_0x2c38e5[_0xe863('0x46')],_0x1232f4[_0xe863('0x4f')]),_0xaa80c5);if(_0x2c38e5[_0xe863('0x46')][_0xe863('0x50')]){_0x59fe60['where']=_['merge'](_0x59fe60[_0xe863('0x4e')],{'$or':_['map'](_0xaa80c5,function(_0x4f6912){if(_0x4f6912[_0xe863('0x44')]!==_0xe863('0x51')){var _0x4d4a50={};_0x4d4a50[_0x4f6912['name']]={'$like':'%'+_0x2c38e5[_0xe863('0x46')][_0xe863('0x50')]+'%'};return _0x4d4a50;}})});}_0x59fe60=_[_0xe863('0x52')]({},_0x59fe60,_0x2c38e5[_0xe863('0x53')]);var _0x4db709={'where':_0x59fe60[_0xe863('0x4e')]};return db[_0xe863('0x42')][_0xe863('0x32')](_0x4db709)[_0xe863('0x38')](function(_0x2064b5){_0x2c3108[_0xe863('0x32')]=_0x2064b5;if(_0x2c38e5['query']['includeAll']){_0x59fe60['include']=[{'all':!![]}];}return db[_0xe863('0x42')]['findAll'](_0x59fe60);})[_0xe863('0x38')](function(_0x6ac597){_0x2c3108['rows']=_0x6ac597;return _0x2c3108;})[_0xe863('0x38')](respondWithFilteredResult(_0x2c38d9,_0x59fe60))[_0xe863('0x2a')](handleError(_0x2c38d9,null));};exports[_0xe863('0x54')]=function(_0x52593b,_0x5a5213){var _0x3f9201={'raw':![],'where':{'id':_0x52593b[_0xe863('0x55')]['id']},'include':[{'model':db[_0xe863('0x3f')],'as':_0xe863('0x40')}]},_0x3faf78={};_0x3faf78['model']=_[_0xe863('0x56')](db[_0xe863('0x42')][_0xe863('0x43')]);_0x3faf78['query']=_[_0xe863('0x56')](_0x52593b[_0xe863('0x46')]);_0x3faf78['filters']=_[_0xe863('0x47')](_0x3faf78[_0xe863('0x45')],_0x3faf78[_0xe863('0x46')]);_0x3f9201['attributes']=_[_0xe863('0x47')](_0x3faf78[_0xe863('0x45')],qs[_0xe863('0x49')](_0x52593b['query']['fields']));_0x3f9201[_0xe863('0x48')]=_0x3f9201['attributes'][_0xe863('0x4a')]?_0x3f9201[_0xe863('0x48')]:_0x3faf78[_0xe863('0x45')];if(_0x52593b[_0xe863('0x46')][_0xe863('0x57')]){_0x3f9201['include']=[{'all':!![]}];}_0x3f9201=_[_0xe863('0x52')]({},_0x3f9201,_0x52593b[_0xe863('0x53')]);return db[_0xe863('0x42')][_0xe863('0x58')](_0x3f9201)['then'](handleEntityNotFound(_0x5a5213,null))[_0xe863('0x38')](respondWithResult(_0x5a5213,null))[_0xe863('0x2a')](handleError(_0x5a5213,null));};exports[_0xe863('0x59')]=function(_0x44e670,_0x4d56a2){return db[_0xe863('0x42')][_0xe863('0x59')](_0x44e670[_0xe863('0x5a')],{})[_0xe863('0x38')](function(_0x326268){var _0x5a8e17=_0x44e670['user'][_0xe863('0x5b')]({'plain':!![]});if(!_0x5a8e17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a8e17[_0xe863('0x5c')]===_0xe863('0x5d')){var _0x730faa=_0x326268[_0xe863('0x5b')]({'plain':!![]});var _0x95c2d1=_0xe863('0x39');return db[_0xe863('0x5e')][_0xe863('0x58')]({'where':{'name':_0x95c2d1,'userProfileId':_0x5a8e17[_0xe863('0x5f')]},'raw':!![]})[_0xe863('0x38')](function(_0xb98cd4){if(_0xb98cd4&&_0xb98cd4[_0xe863('0x60')]===0x0){return db[_0xe863('0x3a')][_0xe863('0x59')]({'name':_0x730faa['name'],'resourceId':_0x730faa['id'],'type':_0xb98cd4[_0xe863('0x3d')],'sectionId':_0xb98cd4['id']},{})[_0xe863('0x38')](function(){return _0x326268;});}else{return _0x326268;}})[_0xe863('0x2a')](function(_0x9aaa){logger[_0xe863('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9aaa);throw _0x9aaa;});}return _0x326268;})[_0xe863('0x38')](respondWithResult(_0x4d56a2,0xc9))[_0xe863('0x2a')](handleError(_0x4d56a2,null));};exports[_0xe863('0x37')]=function(_0x3f269a,_0xdbdce7){if(_0x3f269a[_0xe863('0x5a')]['id']){delete _0x3f269a[_0xe863('0x5a')]['id'];}return db['SmsAccount'][_0xe863('0x58')]({'where':{'id':_0x3f269a['params']['id']},'include':[{'model':db['Pause'],'as':_0xe863('0x40')}]})[_0xe863('0x38')](handleEntityNotFound(_0xdbdce7,null))[_0xe863('0x38')](saveUpdates(_0x3f269a['body'],null))['then'](respondWithResult(_0xdbdce7,null))[_0xe863('0x2a')](handleError(_0xdbdce7,null));};exports[_0xe863('0x3b')]=function(_0x3493e4,_0x2bed8c){return db[_0xe863('0x42')][_0xe863('0x58')]({'where':{'id':_0x3493e4[_0xe863('0x55')]['id']}})['then'](handleEntityNotFound(_0x2bed8c,null))['then'](removeEntity(_0x2bed8c,null))[_0xe863('0x2a')](handleError(_0x2bed8c,null));};exports[_0xe863('0x61')]=function(_0x449f81,_0x338ed5){return db[_0xe863('0x42')][_0xe863('0x61')]()[_0xe863('0x38')](respondWithResult(_0x338ed5,null))[_0xe863('0x2a')](handleError(_0x338ed5,null));};exports[_0xe863('0x62')]=function(_0x53cb1b,_0xfee76c,_0x22e3b0){if(_0x53cb1b[_0xe863('0x5a')]['id']){delete _0x53cb1b[_0xe863('0x5a')]['id'];}return db['SmsAccount'][_0xe863('0x58')]({'where':{'id':_0x53cb1b[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0xfee76c,null))[_0xe863('0x38')](function(_0x1f8b49){if(_0x1f8b49){_0x53cb1b[_0xe863('0x5a')]['SmsAccountId']=_0x1f8b49['id'];return db[_0xe863('0x63')][_0xe863('0x59')](_0x53cb1b[_0xe863('0x5a')]);}})[_0xe863('0x38')](respondWithResult(_0xfee76c,null))[_0xe863('0x2a')](handleError(_0xfee76c,null));};exports[_0xe863('0x64')]=function(_0x3e1213,_0x5eb1f1,_0x464011){var _0x5d2c4e={'raw':![],'where':{}};var _0x40e0d3={};var _0x45154a={'count':0x0,'rows':[]};return db[_0xe863('0x42')][_0xe863('0x65')]({'where':{'id':_0x3e1213[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x5eb1f1,null))[_0xe863('0x38')](function(_0x41cfa6){if(_0x41cfa6){_0x40e0d3[_0xe863('0x45')]=_[_0xe863('0x56')](db[_0xe863('0x63')]['rawAttributes']);_0x40e0d3[_0xe863('0x46')]=_[_0xe863('0x56')](_0x3e1213[_0xe863('0x46')]);_0x40e0d3[_0xe863('0x4f')]=_['intersection'](_0x40e0d3[_0xe863('0x45')],_0x40e0d3[_0xe863('0x46')]);_0x5d2c4e[_0xe863('0x48')]=_[_0xe863('0x47')](_0x40e0d3['model'],qs['fields'](_0x3e1213[_0xe863('0x46')][_0xe863('0x49')]));_0x5d2c4e[_0xe863('0x48')]=_0x5d2c4e['attributes'][_0xe863('0x4a')]?_0x5d2c4e[_0xe863('0x48')]:_0x40e0d3[_0xe863('0x45')];if(!_0x3e1213[_0xe863('0x46')][_0xe863('0x4b')](_0xe863('0x4c'))){_0x5d2c4e['limit']=qs[_0xe863('0x31')](_0x3e1213['query'][_0xe863('0x31')]);_0x5d2c4e[_0xe863('0x2f')]=qs[_0xe863('0x2f')](_0x3e1213[_0xe863('0x46')]['offset']);}_0x5d2c4e[_0xe863('0x66')]=qs[_0xe863('0x4d')](_0x3e1213[_0xe863('0x46')][_0xe863('0x4d')]);_0x5d2c4e[_0xe863('0x4e')]=qs[_0xe863('0x4f')](_[_0xe863('0x67')](_0x3e1213[_0xe863('0x46')],_0x40e0d3[_0xe863('0x4f')]));_0x5d2c4e[_0xe863('0x4e')][_0xe863('0x68')]=_0x41cfa6['id'];if(_0x3e1213['query'][_0xe863('0x50')]){_0x5d2c4e[_0xe863('0x4e')]=_['merge'](_0x5d2c4e[_0xe863('0x4e')],{'$or':_[_0xe863('0x41')](_0x5d2c4e['attributes'],function(_0x45de84){var _0x15cb9a={};_0x15cb9a[_0x45de84]={'$like':'%'+_0x3e1213['query'][_0xe863('0x50')]+'%'};return _0x15cb9a;})});}_0x5d2c4e=_['merge']({},_0x5d2c4e,_0x3e1213[_0xe863('0x53')]);return db[_0xe863('0x63')][_0xe863('0x32')]({'where':_0x5d2c4e['where']})['then'](function(_0xfe767b){_0x45154a[_0xe863('0x32')]=_0xfe767b;if(_0x3e1213[_0xe863('0x46')][_0xe863('0x57')]){_0x5d2c4e[_0xe863('0x69')]=[{'all':!![]}];}return db[_0xe863('0x63')]['findAll'](_0x5d2c4e);})['then'](function(_0x81fdfa){_0x45154a[_0xe863('0x6a')]=_0x81fdfa;return _0x45154a;});}})[_0xe863('0x38')](respondWithFilteredResult(_0x5eb1f1,_0x5d2c4e))[_0xe863('0x2a')](handleError(_0x5eb1f1,null));};exports[_0xe863('0x6b')]=function(_0x57bb0d,_0x370ac3,_0x43ed45){return db['SmsAccount'][_0xe863('0x58')]({'where':{'id':_0x57bb0d[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x370ac3,null))['then'](function(_0x3cb111){if(_0x3cb111){return _0x3cb111[_0xe863('0x6b')](_0x57bb0d['query'][_0xe863('0x6c')]);}})['then'](respondWithStatusCode(_0x370ac3,null))['catch'](handleError(_0x370ac3,null));};exports['addAnswer']=function(_0x4e3b14,_0x14f1cb,_0x466897){if(_0x4e3b14[_0xe863('0x5a')]['id']){delete _0x4e3b14[_0xe863('0x5a')]['id'];}return db[_0xe863('0x42')][_0xe863('0x58')]({'where':{'id':_0x4e3b14[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x14f1cb,null))[_0xe863('0x38')](function(_0x31c400){if(_0x31c400){_0x4e3b14[_0xe863('0x5a')][_0xe863('0x68')]=_0x31c400['id'];return db[_0xe863('0x6d')][_0xe863('0x59')](_0x4e3b14['body']);}})[_0xe863('0x38')](respondWithResult(_0x14f1cb,null))['catch'](handleError(_0x14f1cb,null));};exports['getAnswers']=function(_0x4b6cc5,_0xad8f58,_0x13dcbf){var _0x4f26b0={'raw':![],'where':{}};var _0x53eaeb={};var _0x5d711f={'count':0x0,'rows':[]};return db[_0xe863('0x42')][_0xe863('0x65')]({'where':{'id':_0x4b6cc5['params']['id']}})[_0xe863('0x38')](handleEntityNotFound(_0xad8f58,null))[_0xe863('0x38')](function(_0x41d214){if(_0x41d214){_0x53eaeb[_0xe863('0x45')]=_['keys'](db[_0xe863('0x6d')][_0xe863('0x43')]);_0x53eaeb[_0xe863('0x46')]=_[_0xe863('0x56')](_0x4b6cc5[_0xe863('0x46')]);_0x53eaeb[_0xe863('0x4f')]=_[_0xe863('0x47')](_0x53eaeb[_0xe863('0x45')],_0x53eaeb['query']);_0x4f26b0['attributes']=_[_0xe863('0x47')](_0x53eaeb[_0xe863('0x45')],qs['fields'](_0x4b6cc5[_0xe863('0x46')][_0xe863('0x49')]));_0x4f26b0[_0xe863('0x48')]=_0x4f26b0[_0xe863('0x48')][_0xe863('0x4a')]?_0x4f26b0[_0xe863('0x48')]:_0x53eaeb[_0xe863('0x45')];if(!_0x4b6cc5[_0xe863('0x46')][_0xe863('0x4b')]('nolimit')){_0x4f26b0[_0xe863('0x31')]=qs[_0xe863('0x31')](_0x4b6cc5['query'][_0xe863('0x31')]);_0x4f26b0[_0xe863('0x2f')]=qs['offset'](_0x4b6cc5[_0xe863('0x46')][_0xe863('0x2f')]);}_0x4f26b0[_0xe863('0x66')]=qs[_0xe863('0x4d')](_0x4b6cc5[_0xe863('0x46')]['sort']);_0x4f26b0[_0xe863('0x4e')]=qs['filters'](_[_0xe863('0x67')](_0x4b6cc5[_0xe863('0x46')],_0x53eaeb[_0xe863('0x4f')]));_0x4f26b0[_0xe863('0x4e')]['SmsAccountId']=_0x41d214['id'];if(_0x4b6cc5[_0xe863('0x46')][_0xe863('0x50')]){_0x4f26b0[_0xe863('0x4e')]=_[_0xe863('0x52')](_0x4f26b0[_0xe863('0x4e')],{'$or':_[_0xe863('0x41')](_0x4f26b0[_0xe863('0x48')],function(_0x4b18f7){var _0x21aa26={};_0x21aa26[_0x4b18f7]={'$like':'%'+_0x4b6cc5[_0xe863('0x46')][_0xe863('0x50')]+'%'};return _0x21aa26;})});}_0x4f26b0=_[_0xe863('0x52')]({},_0x4f26b0,_0x4b6cc5[_0xe863('0x53')]);return db[_0xe863('0x6d')][_0xe863('0x32')]({'where':_0x4f26b0[_0xe863('0x4e')]})[_0xe863('0x38')](function(_0x4fe941){_0x5d711f[_0xe863('0x32')]=_0x4fe941;if(_0x4b6cc5[_0xe863('0x46')][_0xe863('0x57')]){_0x4f26b0[_0xe863('0x69')]=[{'all':!![]}];}return db[_0xe863('0x6d')][_0xe863('0x6e')](_0x4f26b0);})[_0xe863('0x38')](function(_0x5da4be){_0x5d711f[_0xe863('0x6a')]=_0x5da4be;return _0x5d711f;});}})['then'](respondWithFilteredResult(_0xad8f58,_0x4f26b0))[_0xe863('0x2a')](handleError(_0xad8f58,null));};exports[_0xe863('0x6f')]=function(_0x56a397,_0x5a36e9,_0x3208b1){return db[_0xe863('0x42')][_0xe863('0x58')]({'where':{'id':_0x56a397['params']['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x5a36e9,null))['then'](function(_0x4b2161){if(_0x4b2161){return _0x4b2161[_0xe863('0x6f')](_0x56a397['query']['ids']);}})[_0xe863('0x38')](respondWithStatusCode(_0x5a36e9,null))[_0xe863('0x2a')](handleError(_0x5a36e9,null));};exports[_0xe863('0x70')]=function(_0x2ff70e,_0x46565d,_0x2cd970){var _0x469976={'channel':'sms'};var _0x219f12=[];var _0x15a630=[];var _0xffacd3={};return db['SmsAccount'][_0xe863('0x58')]({'where':{'id':_0x2ff70e[_0xe863('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0xe863('0x38')](handleEntityNotFound(_0x46565d,null))[_0xe863('0x38')](function(_0x49d273){_0x469976[_0xe863('0x71')]=_0x49d273;_0x469976['applications']=_['orderBy'](_0x49d273['Applications'],[_0xe863('0x72')],[_0xe863('0x73')]);if(_0x469976['account'][_0xe863('0x74')]){delete _0x469976['account']['Applications'];}return db['CmContact']['describe']();})[_0xe863('0x38')](function(_0x5cb977){if(!_0x5cb977){throw new db[(_0xe863('0x75'))][(_0xe863('0x76'))]('no\x20available\x20attributes');}_0x219f12=_[_0xe863('0x77')](_[_0xe863('0x56')](_0x5cb977),[_0xe863('0x78'),'updatedAt']);_0x15a630=_[_0xe863('0x77')](_[_0xe863('0x56')](_0x5cb977),[_0xe863('0x78'),_0xe863('0x79'),_0xe863('0x7a'),_0xe863('0x7b')]);_0x469976['body']={'mapKey':_0xe863('0x7c')};if(_0x469976[_0xe863('0x71')]['type']){switch(_0x469976[_0xe863('0x71')][_0xe863('0x44')]){case _0xe863('0x7d'):_0x469976['body'][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')]['From'];_0x469976[_0xe863('0x5a')]['body']=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x7f')];_0x469976[_0xe863('0x5a')][_0xe863('0x80')]=_0x2ff70e['body'][_0xe863('0x81')];break;case _0xe863('0x82'):_0x469976[_0xe863('0x5a')][_0xe863('0x7e')]='+'+_0x2ff70e[_0xe863('0x5a')][_0xe863('0x83')];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e['body'][_0xe863('0x84')];break;case'connectel':_0x469976['body'][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')]['from'];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e[_0xe863('0x5a')]['message'];break;case _0xe863('0x85'):_0x469976[_0xe863('0x5a')][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x7e')];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e[_0xe863('0x5a')]['body'];_0x469976['body']['messageId']=_0x2ff70e[_0xe863('0x5a')]['message_id'];break;case'plivo':_0x469976[_0xe863('0x5a')][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x86')];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x87')];_0x469976[_0xe863('0x5a')][_0xe863('0x80')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x88')];break;case _0xe863('0x89'):_0x469976[_0xe863('0x5a')]['from']='+'+_0x2ff70e[_0xe863('0x5a')][_0xe863('0x8a')][0x0][_0xe863('0x7e')];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x8a')][0x0][_0xe863('0x84')];_0x469976[_0xe863('0x5a')][_0xe863('0x80')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x8a')][0x0][_0xe863('0x80')];break;case'csc':_0x469976[_0xe863('0x5a')][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x8b')];_0x469976[_0xe863('0x5a')]['body']=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x8c')][_0xe863('0x27')];break;case _0xe863('0x8d'):_0x469976['body'][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x8e')];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x84')];_0x469976[_0xe863('0x5a')][_0xe863('0x80')]=_0x2ff70e[_0xe863('0x5a')]['replyMessageId'];break;case'bandwidth':_0x469976['body'][_0xe863('0x80')]=_0x2ff70e[_0xe863('0x5a')][0x0][_0xe863('0x27')]['id'];_0x469976[_0xe863('0x5a')][_0xe863('0x7e')]=_0x2ff70e[_0xe863('0x5a')][0x0][_0xe863('0x27')][_0xe863('0x7e')];_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]=_0x2ff70e[_0xe863('0x5a')][0x0][_0xe863('0x27')][_0xe863('0x84')];break;case'intelepeer':_0x469976[_0xe863('0x5a')]['from']=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x7e')];_0x469976[_0xe863('0x5a')]['body']=_0x2ff70e[_0xe863('0x5a')][_0xe863('0x27')];_0x469976[_0xe863('0x5a')]['messageId']=_0x2ff70e[_0xe863('0x5a')]['refid'];break;}}if(_0x469976[_0xe863('0x5a')]['id']){delete _0x469976['body']['id'];}if(_[_0xe863('0x8f')](_0x469976[_0xe863('0x5a')][_0xe863('0x7e')])){throw new db[(_0xe863('0x75'))][(_0xe863('0x76'))](_0xe863('0x90'));}if(_[_0xe863('0x8f')](_0x469976[_0xe863('0x5a')]['body'])||_0x469976[_0xe863('0x5a')][_0xe863('0x5a')]===''){throw new db[(_0xe863('0x75'))][(_0xe863('0x76'))](_0xe863('0x91'));}if(_['isNil'](_0x469976[_0xe863('0x5a')][_0xe863('0x92')])){throw new db[(_0xe863('0x75'))][(_0xe863('0x76'))](_0xe863('0x93')+_0x15a630);}if(!_[_0xe863('0x94')](_0x15a630,_0x469976['body'][_0xe863('0x92')])){throw new db['Sequelize']['ValidationError'](_0xe863('0x95')+_0x15a630);}_0xffacd3[_0x469976[_0xe863('0x5a')][_0xe863('0x92')]]=_0x469976['body'][_0xe863('0x7e')];return db[_0xe863('0x96')]['find']({'where':{'id':_0x469976[_0xe863('0x71')][_0xe863('0x7b')]},'include':[{'model':db[_0xe863('0x97')],'as':_0xe863('0x98'),'where':_0xffacd3,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x46565d,null))['then'](function(_0x1fd870){if(_0x1fd870){_0x469976[_0xe863('0x99')]=_[_0xe863('0x9a')](_0x1fd870,[_0xe863('0x98')]);if(_0x1fd870[_0xe863('0x98')][_0xe863('0x4a')]){return _0x1fd870[_0xe863('0x98')][0x0];}var _0x59e796=_[_0xe863('0x9b')](_0x469976[_0xe863('0x5a')],{'firstName':_0x469976[_0xe863('0x5a')][_0xe863('0x7e')],'ListId':_0x1fd870['id']});_0x59e796[_0x469976[_0xe863('0x5a')][_0xe863('0x92')]]=_0x469976[_0xe863('0x5a')][_0xe863('0x7e')];return db[_0xe863('0x97')][_0xe863('0x59')](_0x59e796,{'fields':_0x219f12,'raw':!![]});}})[_0xe863('0x38')](handleEntityNotFound(_0x46565d,null))[_0xe863('0x38')](function(_0x41a420){if(_0x41a420){_0x469976[_0xe863('0x9c')]=_0x41a420;var _0x318eca={'ContactId':_0x41a420['id'],'phone':_0x469976[_0xe863('0x5a')][_0xe863('0x7e')],'SmsAccountId':_0x2ff70e[_0xe863('0x55')]['id']};var _0x5e4719={'ContactId':_0x41a420['id'],'SmsAccountId':_0x2ff70e[_0xe863('0x55')]['id'],'closed':![]};return db[_0xe863('0x9d')][_0xe863('0x58')]({'where':_0x5e4719})[_0xe863('0x38')](function(_0x53c027){if(_0x53c027){return[_0x53c027,![]];}return db[_0xe863('0x9d')][_0xe863('0x59')](_0x318eca)[_0xe863('0x38')](function(_0x545ca8){return[_0x545ca8,!![]];});});}})[_0xe863('0x9e')](function(_0x358872,_0x53f088){_0x469976[_0xe863('0x9f')]=_0x358872[_0xe863('0x5b')]({'plain':!![]});_0x469976[_0xe863('0x9f')]['created']=![];if(_0x53f088){if(_0x469976[_0xe863('0x71')][_0xe863('0xa0')]){_0x469976['applications'][_0xe863('0xa1')]({'id':0x0,'priority':_0x469976[_0xe863('0xa2')][_0xe863('0x4a')]+0x1,'app':_0xe863('0xa3'),'appdata':_0xe863('0xa4'),'interval':'*,*,*,*'});}_0x469976['interaction'][_0xe863('0xa5')]=!![];}return db['SmsMessage'][_0xe863('0x59')]({'phone':_0x469976['body']['from'],'messageId':_0x469976[_0xe863('0x5a')][_0xe863('0x80')],'body':_0x469976[_0xe863('0x5a')][_0xe863('0x5a')],'SmsAccountId':_0x2ff70e['params']['id'],'SmsInteractionId':_0x358872['id'],'direction':'in','ContactId':_0x358872[_0xe863('0xa6')],'AttachmentId':_0x469976[_0xe863('0x5a')]['AttachmentId']});})[_0xe863('0x38')](function(_0x418cde){_0x469976[_0xe863('0x27')]=_0x418cde;if(_0x469976[_0xe863('0x9f')][_0xe863('0xa7')]){return db[_0xe863('0xa8')][_0xe863('0x58')]({'attributes':['id',_0xe863('0x3d')],'where':{'id':_0x469976[_0xe863('0x9f')][_0xe863('0xa7')]}})[_0xe863('0x38')](function(_0x1a996f){if(_0x1a996f){_0x469976[_0xe863('0xa2')][_0xe863('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a996f[_0xe863('0x3d')]+','+(_0x469976[_0xe863('0x71')][_0xe863('0xaa')]||0xa),'interval':_0xe863('0xab')});}return respondWithRpcPromise(_0xe863('0xac'),'startRouting',_0x469976);});}return respondWithRpcPromise(_0xe863('0xac'),_0xe863('0xad'),_0x469976);})[_0xe863('0x38')](function(_0x2f682c){if(_0x2f682c){var _0x456947=0xc8;var _0x42f836=_0xe863('0xae');logger[_0xe863('0x20')](_0xe863('0x23'),_0x42f836,_0x456947,_0xe863('0xaf'));logger['debug'](_0xe863('0xb0'),_0x42f836,_0x456947,'entity\x20found',JSON[_0xe863('0x24')](_0x2f682c));if(_0x469976[_0xe863('0x71')][_0xe863('0x44')]===_0xe863('0x7d')){return _0x46565d[_0xe863('0x2c')](_0x456947)[_0xe863('0x33')](_0xe863('0xb1'),_0xe863('0xb2'))['send'](_0xe863('0xb3'));}else{return _0x46565d['status'](_0x456947)[_0xe863('0x2e')](_0x2f682c);}}})[_0xe863('0x2a')](handleError(_0x46565d,null));};exports[_0xe863('0xb4')]=function(_0x2de2f6,_0x5a8c88){var _0x3c299c=_0x2de2f6['params']['id'];var _0x547a7f=_0x2de2f6['body'];var _0x46b337=0xc8;var _0x32149c=null;return db[_0xe863('0xb5')][_0xe863('0xb6')]({'isolationLevel':db['sequelize'][_0xe863('0xb7')][_0xe863('0xb8')]['READ_COMMITTED']},function(_0x32703a){return db[_0xe863('0x42')]['findOne']({'where':{'id':_0x3c299c},'transaction':_0x32703a})['then'](function(_0x2a60df){if(_0x2a60df){return db[_0xe863('0xb9')][_0xe863('0x3b')]({'where':{'SmsAccountId':_0x3c299c},'transaction':_0x32703a})[_0xe863('0x38')](function(){var _0x71b761=_[_0xe863('0x41')](_0x547a7f,function(_0x12b939){_0x12b939[_0xe863('0x68')]=_0x3c299c;return _0x12b939;});return db[_0xe863('0xb9')]['bulkCreate'](_0x71b761,{'transaction':_0x32703a});});}else{_0x46b337=0x194;_0x32149c=[];}});})[_0xe863('0x38')](function(){if(_0x46b337!==0x194){return db[_0xe863('0xb9')][_0xe863('0xba')]({'where':{'SmsAccountId':_0x3c299c},'order':_0xe863('0x72')})[_0xe863('0x38')](function(_0x5a8674){_0x32149c=_0x5a8674;});}})[_0xe863('0x2a')](function(_0x1b97c7){_0x46b337=0x1f4;logger[_0xe863('0x25')](_0x1b97c7[_0xe863('0x3c')]);if(_0x1b97c7[_0xe863('0x3d')]){delete _0x1b97c7[_0xe863('0x3d')];}_0x32149c=_0x1b97c7;})[_0xe863('0xbb')](function(){if(_0x32149c===null){_0x5a8c88[_0xe863('0x2b')](_0x46b337);}else{if(_0x46b337===0x1f4){_0x5a8c88['status'](_0x46b337)[_0xe863('0x3e')](_0x32149c);}else{_0x5a8c88['status'](_0x46b337)[_0xe863('0x2e')](_0x32149c);}}});};exports['getApplications']=function(_0x1488df,_0x4807a5,_0x582611){var _0x2f3767={};var _0x5f3693={};var _0x1196f5;var _0x327595;return db[_0xe863('0x42')][_0xe863('0x65')]({'where':{'id':_0x1488df[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x4807a5,null))[_0xe863('0x38')](function(_0x258f77){if(_0x258f77){_0x1196f5=_0x258f77;_0x5f3693[_0xe863('0x45')]=_[_0xe863('0x56')](db[_0xe863('0xb9')][_0xe863('0x43')]);_0x5f3693['query']=_[_0xe863('0x56')](_0x1488df['query']);_0x5f3693[_0xe863('0x4f')]=_[_0xe863('0x47')](_0x5f3693[_0xe863('0x45')],_0x5f3693[_0xe863('0x46')]);_0x2f3767[_0xe863('0x48')]=_[_0xe863('0x47')](_0x5f3693[_0xe863('0x45')],qs[_0xe863('0x49')](_0x1488df[_0xe863('0x46')][_0xe863('0x49')]));_0x2f3767[_0xe863('0x48')]=_0x2f3767['attributes'][_0xe863('0x4a')]?_0x2f3767[_0xe863('0x48')]:_0x5f3693['model'];_0x2f3767[_0xe863('0x66')]=qs['sort'](_0x1488df[_0xe863('0x46')]['sort']);_0x2f3767[_0xe863('0x4e')]=qs['filters'](_[_0xe863('0x67')](_0x1488df[_0xe863('0x46')],_0x5f3693['filters']));if(_0x1488df[_0xe863('0x46')][_0xe863('0x50')]){_0x2f3767[_0xe863('0x4e')]=_[_0xe863('0x52')](_0x2f3767['where'],{'$or':_[_0xe863('0x41')](_0x2f3767[_0xe863('0x48')],function(_0x4f8277){var _0x2bd7bf={};_0x2bd7bf[_0x4f8277]={'$like':'%'+_0x1488df['query']['filter']+'%'};return _0x2bd7bf;})});}_0x2f3767=_[_0xe863('0x52')]({},_0x2f3767,_0x1488df[_0xe863('0x53')]);return _0x1196f5[_0xe863('0xbc')](_0x2f3767);}})[_0xe863('0x38')](function(_0x103d63){if(_0x103d63){_0x327595=_0x103d63[_0xe863('0x4a')];if(!_0x1488df[_0xe863('0x46')][_0xe863('0x4b')]('nolimit')){_0x2f3767['limit']=qs[_0xe863('0x31')](_0x1488df['query']['limit']);_0x2f3767[_0xe863('0x2f')]=qs[_0xe863('0x2f')](_0x1488df[_0xe863('0x46')]['offset']);}return _0x1196f5[_0xe863('0xbc')](_0x2f3767);}})[_0xe863('0x38')](function(_0x205fcd){if(_0x205fcd){return _0x205fcd?{'count':_0x327595,'rows':_0x205fcd}:null;}})[_0xe863('0x38')](respondWithResult(_0x4807a5,null))[_0xe863('0x2a')](handleError(_0x4807a5,null));};exports[_0xe863('0xbd')]=function(_0x2676dc,_0x1f3c2b,_0x2a2604){var _0x130753={'raw':![],'where':{}};var _0x439143={};var _0x41c713={'count':0x0,'rows':[]};return db[_0xe863('0x42')][_0xe863('0x65')]({'where':{'id':_0x2676dc[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x1f3c2b,null))['then'](function(_0x31e4ba){if(_0x31e4ba){_0x439143[_0xe863('0x45')]=_['keys'](db['SmsInteraction'][_0xe863('0x43')]);_0x439143[_0xe863('0x46')]=_[_0xe863('0x56')](_0x2676dc[_0xe863('0x46')]);_0x439143[_0xe863('0x4f')]=_['intersection'](_0x439143[_0xe863('0x45')],_0x439143[_0xe863('0x46')]);_0x130753['attributes']=_['intersection'](_0x439143[_0xe863('0x45')],qs[_0xe863('0x49')](_0x2676dc['query'][_0xe863('0x49')]));_0x130753[_0xe863('0x48')]=_0x130753[_0xe863('0x48')][_0xe863('0x4a')]?_0x130753[_0xe863('0x48')]:_0x439143['model'];if(!_0x2676dc[_0xe863('0x46')][_0xe863('0x4b')]('nolimit')){_0x130753['limit']=qs[_0xe863('0x31')](_0x2676dc[_0xe863('0x46')][_0xe863('0x31')]);_0x130753[_0xe863('0x2f')]=qs[_0xe863('0x2f')](_0x2676dc[_0xe863('0x46')][_0xe863('0x2f')]);}_0x130753[_0xe863('0x66')]=qs[_0xe863('0x4d')](_0x2676dc[_0xe863('0x46')][_0xe863('0x4d')]);_0x130753['where']=qs[_0xe863('0x4f')](_[_0xe863('0x67')](_0x2676dc[_0xe863('0x46')],_0x439143[_0xe863('0x4f')]));_0x130753['where'][_0xe863('0x68')]=_0x31e4ba['id'];if(_0x2676dc[_0xe863('0x46')]['filter']){_0x130753[_0xe863('0x4e')]=_['merge'](_0x130753[_0xe863('0x4e')],{'$or':_['map'](_0x130753['attributes'],function(_0x12368a){var _0x924047={};_0x924047[_0x12368a]={'$like':'%'+_0x2676dc[_0xe863('0x46')]['filter']+'%'};return _0x924047;})});}_0x130753=_[_0xe863('0x52')]({},_0x130753,_0x2676dc[_0xe863('0x53')]);return db[_0xe863('0x9d')]['count']({'where':_0x130753['where']})[_0xe863('0x38')](function(_0x4ff31e){_0x41c713[_0xe863('0x32')]=_0x4ff31e;if(_0x2676dc[_0xe863('0x46')]['includeAll']){_0x130753[_0xe863('0x69')]=[{'model':db[_0xe863('0x97')],'as':'Contact','required':![]},{'model':db[_0xe863('0xa8')],'as':_0xe863('0xbe'),'attributes':[_0xe863('0x3d'),_0xe863('0xbf'),'internal'],'required':![]},{'model':db[_0xe863('0xc0')],'as':'Tags','attributes':['id',_0xe863('0x3d'),_0xe863('0xc1')],'where':_0x2676dc[_0xe863('0x46')][_0xe863('0xc2')]?{'id':_0x2676dc[_0xe863('0x46')][_0xe863('0xc2')]}:undefined,'required':_0x2676dc[_0xe863('0x46')][_0xe863('0xc2')]?!![]:![]}];}return db[_0xe863('0x9d')][_0xe863('0x6e')](_0x130753);})[_0xe863('0x38')](function(_0x7e647f){_0x41c713['rows']=_0x7e647f;return _0x41c713;});}})[_0xe863('0x38')](respondWithFilteredResult(_0x1f3c2b,_0x130753))[_0xe863('0x2a')](handleError(_0x1f3c2b,null));};exports[_0xe863('0x3e')]=function(_0x4226b3,_0x48958c,_0x210930){var _0x452b76,_0x254208,_0x30d998;if(_['isNil'](_0x4226b3[_0xe863('0x5a')]['body'])||_0x4226b3[_0xe863('0x5a')][_0xe863('0x5a')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4226b3[_0xe863('0x5a')]['to'])){throw new db[(_0xe863('0x75'))]['ValidationError'](_0xe863('0xc3'));}_0x452b76=_0x4226b3[_0xe863('0x5a')]['to'];return db[_0xe863('0x42')][_0xe863('0x58')]({'where':{'id':_0x4226b3[_0xe863('0x55')]['id']},'include':[{'model':db[_0xe863('0x96')],'as':_0xe863('0xc4'),'include':[{'model':db[_0xe863('0x97')],'as':_0xe863('0x98'),'where':{'mobile':_0x452b76},'limit':0x1,'order':[[_0xe863('0x79'),'DESC']]}]}]})[_0xe863('0x38')](handleEntityNotFound(_0x48958c,null))[_0xe863('0x38')](function(_0x46f473){if(_0x46f473&&_0x46f473[_0xe863('0xc4')]){_0x254208=_0x46f473[_0xe863('0x5b')]({'plain':!![]});if(_0x254208['List']&&_0x254208[_0xe863('0xc4')]['Contacts'][_0xe863('0x4a')]){return _0x254208[_0xe863('0xc4')][_0xe863('0x98')][0x0];}return db[_0xe863('0x97')][_0xe863('0x59')](_[_0xe863('0x9b')](_0x4226b3[_0xe863('0x5a')],{'firstName':_0x452b76,'mobile':_0x452b76,'phone':_0x452b76,'ListId':_0x254208[_0xe863('0x7b')]}));}})[_0xe863('0x38')](handleEntityNotFound(_0x48958c,null))[_0xe863('0x38')](function(_0x93a162){if(_0x93a162){_0x30d998=_0x93a162;return db['SmsInteraction'][_0xe863('0x58')]({'where':{'ContactId':_0x30d998['id'],'closed':![],'SmsAccountId':_0x254208['id']}})['then'](function(_0xa2ce60){if(_0xa2ce60){return[_0xa2ce60,![]];}return db['SmsInteraction'][_0xe863('0x59')]({'UserId':_0x4226b3[_0xe863('0x5d')]['id'],'ContactId':_0x30d998['id'],'SmsAccountId':_0x254208['id'],'phone':_0x452b76,'firstMsgDirection':_0xe863('0xc5'),'Messages':[_['merge'](_0x4226b3['body'],{'read':![],'body':_0x4226b3['body'][_0xe863('0x5a')],'phone':_0x452b76,'SmsAccountId':_0x254208['id'],'UserId':_0x4226b3[_0xe863('0x5d')]['id'],'ContactId':_0x30d998['id']})]},{'include':[{'model':db[_0xe863('0xc6')],'as':_0xe863('0xc7')}]})[_0xe863('0x38')](function(_0x54d918){return[_0x54d918,!![]];});});}})['spread'](function(_0x36f72e,_0x4b02aa){if(_0x4b02aa){return _0x36f72e;}return db[_0xe863('0xc6')][_0xe863('0x59')](_[_0xe863('0x52')](_0x4226b3['body'],{'read':![],'body':_0x4226b3[_0xe863('0x5a')][_0xe863('0x5a')],'phone':_0x452b76,'SmsAccountId':_0x254208['id'],'SmsInteractionId':_0x36f72e['id'],'UserId':_0x4226b3[_0xe863('0x5d')]['id'],'ContactId':_0x30d998['id']}))[_0xe863('0x38')](function(_0x5ba138){_0x36f72e['dataValues'][_0xe863('0xc7')]=[];_0x36f72e['dataValues']['Messages'][_0xe863('0xa1')](_0x5ba138[_0xe863('0xc8')]);return _0x36f72e;});})[_0xe863('0x38')](respondWithResult(_0x48958c,null))[_0xe863('0x2a')](handleError(_0x48958c,null));};exports[_0xe863('0x2c')]=function(_0x3bfcad,_0xf1aa1f,_0x36b2dd){if(_0x3bfcad[_0xe863('0x5a')]['id']){delete _0x3bfcad[_0xe863('0x5a')]['id'];}var _0xe9a9b1,_0x4acd7e,_0x504968;return db[_0xe863('0x42')][_0xe863('0x58')]({'where':{'id':_0x3bfcad[_0xe863('0x55')]['id']}})['then'](handleEntityNotFound(_0xf1aa1f,null))[_0xe863('0x38')](function(_0x37fb64){if(_0x37fb64){_0x504968=_0x37fb64;logger[_0xe863('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe863('0xc9'),_0x37fb64['type'],util['inspect'](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));switch(_0x37fb64['type']){case _0xe863('0x82'):if(_0x3bfcad[_0xe863('0x5a')][_0xe863('0xca')]&&_0x3bfcad[_0xe863('0x5a')][_0xe863('0x2c')]){_0x4acd7e=_0x3bfcad[_0xe863('0x5a')][_0xe863('0x2c')];return db['SmsMessage'][_0xe863('0x58')]({'where':{'messageId':_0x3bfcad[_0xe863('0x5a')][_0xe863('0xca')]}});}break;case'connectel':if(_0x3bfcad[_0xe863('0x5a')][_0xe863('0xcb')]&&_0x3bfcad['body']['statusInt']){_0x4acd7e=_0x3bfcad[_0xe863('0x5a')]['statusInt'];return db[_0xe863('0xc6')][_0xe863('0x58')]({'where':{'messageId':_0x3bfcad[_0xe863('0x5a')][_0xe863('0xcb')]}});}break;case _0xe863('0x85'):if(_0x3bfcad['body'][_0xe863('0xcc')]&&_0x3bfcad[_0xe863('0x5a')][_0xe863('0xcd')]){_0x4acd7e=_0x3bfcad[_0xe863('0x5a')][_0xe863('0xcd')];return db[_0xe863('0xc6')][_0xe863('0x58')]({'where':{'messageId':_0x3bfcad[_0xe863('0x5a')]['message_id']}});}break;case _0xe863('0x89'):var _0x8ccd83=_0x3bfcad[_0xe863('0x5a')][_0xe863('0x8a')][0x0];if(_0x8ccd83[_0xe863('0x80')]&&_0x8ccd83[_0xe863('0x2c')]['groupName']===_0xe863('0xce')){_0x4acd7e=_0x8ccd83[_0xe863('0x2c')]['groupName'];return db['SmsMessage'][_0xe863('0x58')]({'where':{'messageId':_0x8ccd83[_0xe863('0x80')]}});}break;case _0xe863('0x8d'):if(_0x3bfcad['body'][_0xe863('0x80')]&&_0x3bfcad[_0xe863('0x5a')][_0xe863('0x2c')]){_0x4acd7e=_0x3bfcad['body'][_0xe863('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x3bfcad['body'][_0xe863('0x80')]}});}break;case _0xe863('0xcf'):if(_0x3bfcad[_0xe863('0x5a')][0x0][_0xe863('0x27')]['id']){_0x4acd7e=_0x3bfcad[_0xe863('0x5a')][0x0][_0xe863('0x44')];return db[_0xe863('0xc6')][_0xe863('0x58')]({'where':{'messageId':_0x3bfcad[_0xe863('0x5a')][0x0][_0xe863('0x27')]['id']}});}break;case _0xe863('0xd0'):if(_0x3bfcad['body'][_0xe863('0xd1')]&&_0x3bfcad['body'][_0xe863('0x2c')]){_0x4acd7e=_0x3bfcad[_0xe863('0x5a')]['status'];return db[_0xe863('0xc6')][_0xe863('0x58')]({'where':{'messageId':_0x3bfcad[_0xe863('0x5a')][_0xe863('0xd1')]}});}break;}}})[_0xe863('0x38')](handleEntityNotFound(_0xf1aa1f,null))[_0xe863('0x38')](function(_0x46c0f7){if(_0x46c0f7){_0xe9a9b1=_0x46c0f7;switch(_0x504968['type']){case _0xe863('0x82'):if(_0x4acd7e===_0xe863('0xce')){return _0xe9a9b1[_0xe863('0x37')]({'read':!![]});}else{logger[_0xe863('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe863('0x2c'),'skebby',util[_0xe863('0xd2')](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xe863('0xd3'):if(_0x4acd7e==='1'){return _0xe9a9b1[_0xe863('0x37')]({'read':!![]});}else{logger['error'](_0xe863('0x23'),'status',_0xe863('0x82'),util[_0xe863('0xd2')](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3bfcad['body'][_0xe863('0xd4')]&&_0x4acd7e>=0xc8&&_0x4acd7e<=0xce){return _0xe9a9b1['update']({'read':!![]});}else{logger['error'](_0xe863('0x23'),'status','clicksend',util['inspect'](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x104488=_0x3bfcad[_0xe863('0x5a')][_0xe863('0x8a')][0x0];if(_0x104488[_0xe863('0x2c')][_0xe863('0xd5')]===_0xe863('0xce')){return _0xe9a9b1[_0xe863('0x37')]({'read':!![]});}else{logger[_0xe863('0x25')](_0xe863('0x23'),'status',_0xe863('0x89'),util['inspect'](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4acd7e==_0xe863('0xd6')||_0x4acd7e=='RECEIVED_BY_RECIPIENT'){return _0xe9a9b1[_0xe863('0x37')]({'read':!![]});}else{logger[_0xe863('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe863('0x2c'),'clickatell',util['inspect'](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xe863('0xcf'):if(_0x4acd7e==_0xe863('0xd7')){return _0xe9a9b1[_0xe863('0x37')]({'read':!![]});}else{logger[_0xe863('0x25')](_0xe863('0x23'),_0xe863('0x2c'),_0xe863('0xcf'),util['inspect'](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xe863('0xd0'):if(_0x4acd7e===_0xe863('0xd8')||_0x4acd7e===_0xe863('0xd9')){return _0xe9a9b1[_0xe863('0x37')]({'read':!![]});}else{logger[_0xe863('0x25')](_0xe863('0x23'),'status',_0xe863('0xd0'),util[_0xe863('0xd2')](_0x3bfcad[_0xe863('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xe9a9b1;}})['then'](respondWithResult(_0xf1aa1f,null))['catch'](handleError(_0xf1aa1f,null));};exports[_0xe863('0xda')]=function(_0x5162d9,_0x21bb09,_0x3db990){var _0x21d60a,_0x33ab7f,_0x1fd860;return db['SmsAccount'][_0xe863('0x58')]({'where':{'id':_0x5162d9[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x21bb09,null))[_0xe863('0x38')](function(_0x4972d7){if(_0x4972d7){_0x1fd860=_0x4972d7;logger[_0xe863('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe863('0xc9'),_0x4972d7[_0xe863('0x44')],util[_0xe863('0xd2')](_0x5162d9[_0xe863('0x46')],{'showHidden':![],'depth':null}));switch(_0x4972d7['type']){case _0xe863('0xdb'):if(_0x5162d9[_0xe863('0x46')][_0xe863('0xdc')]&&_0x5162d9['query']['state']){_0x33ab7f=_0x5162d9[_0xe863('0x46')]['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x5162d9[_0xe863('0x46')][_0xe863('0xdc')]}});}break;}}})[_0xe863('0x38')](handleEntityNotFound(_0x21bb09,null))[_0xe863('0x38')](function(_0x531fae){if(_0x531fae){_0x21d60a=_0x531fae;switch(_0x1fd860[_0xe863('0x44')]){case _0xe863('0xdb'):if(_0x33ab7f==='2'||_0x33ab7f==='6'){return _0x21d60a[_0xe863('0x37')]({'read':!![]});}else{logger[_0xe863('0x25')](_0xe863('0x23'),_0xe863('0x2c'),'csc',util['inspect'](_0x5162d9['query'],{'showHidden':![],'depth':null}));};break;}return _0x21d60a;}})['then'](respondWithResult(_0x21bb09,null))['catch'](handleError(_0x21bb09,null));};exports[_0xe863('0xdd')]=function(_0x93dcf0,_0x2a16c2,_0x7e74f7){return db[_0xe863('0x42')][_0xe863('0x58')]({'where':{'id':_0x93dcf0[_0xe863('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a16c2,null))[_0xe863('0x38')](function(_0x58024a){if(_0x58024a){return _0x58024a['addAgents'](_0x93dcf0[_0xe863('0x5a')]['ids'],_[_0xe863('0x9a')](_0x93dcf0[_0xe863('0x5a')],[_0xe863('0x6c'),'id'])||{})[_0xe863('0x9e')](function(_0x4c1d4d){for(var _0x179cc6=0x0;_0x179cc6<_0x93dcf0[_0xe863('0x5a')]['ids']['length'];_0x179cc6+=0x1){socket[_0xe863('0xde')](_0xe863('0xdf'),{'UserId':Number(_0x93dcf0[_0xe863('0x5a')][_0xe863('0x6c')][_0x179cc6]),'SmsAccountId':Number(_0x93dcf0[_0xe863('0x55')]['id'])});}return _0x4c1d4d;});}})[_0xe863('0x38')](respondWithResult(_0x2a16c2,null))[_0xe863('0x2a')](handleError(_0x2a16c2,null));};exports[_0xe863('0xe0')]=function(_0xf33bae,_0x3d3de5,_0x3dbd2b){return db['SmsAccount'][_0xe863('0x58')]({'where':{'id':_0xf33bae[_0xe863('0x55')]['id']}})[_0xe863('0x38')](handleEntityNotFound(_0x3d3de5,null))[_0xe863('0x38')](function(_0x35f8a9){if(_0x35f8a9){return _0x35f8a9['removeAgents'](_0xf33bae['query']['ids'])['then'](function(){if(_[_0xe863('0xe1')](_0xf33bae[_0xe863('0x46')][_0xe863('0x6c')])){for(var _0x443f20=0x0;_0x443f20<_0xf33bae['query'][_0xe863('0x6c')][_0xe863('0x4a')];_0x443f20+=0x1){socket[_0xe863('0xde')](_0xe863('0xe2'),{'UserId':Number(_0xf33bae[_0xe863('0x46')][_0xe863('0x6c')][_0x443f20]),'SmsAccountId':Number(_0xf33bae[_0xe863('0x55')]['id'])});}}else{socket['emit'](_0xe863('0xe2'),{'UserId':Number(_0xf33bae[_0xe863('0x46')][_0xe863('0x6c')]),'SmsAccountId':Number(_0xf33bae[_0xe863('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x3d3de5,null))[_0xe863('0x2a')](handleError(_0x3d3de5,null));};exports['getAgents']=function(_0x5158b5,_0x52956b,_0x3e46a2){var _0x262059={};var _0x5b5f88={};var _0x5b3008;var _0x5f21b6;return db[_0xe863('0x42')][_0xe863('0x65')]({'where':{'id':_0x5158b5[_0xe863('0x55')]['id']}})['then'](handleEntityNotFound(_0x52956b,null))[_0xe863('0x38')](function(_0x16f51c){if(_0x16f51c){_0x5b3008=_0x16f51c;_0x5b5f88[_0xe863('0x45')]=_[_0xe863('0x56')](db[_0xe863('0xa8')][_0xe863('0x43')]);_0x5b5f88[_0xe863('0x46')]=_[_0xe863('0x56')](_0x5158b5[_0xe863('0x46')]);_0x5b5f88[_0xe863('0x4f')]=_['intersection'](_0x5b5f88['model'],_0x5b5f88[_0xe863('0x46')]);_0x262059[_0xe863('0x48')]=_[_0xe863('0x47')](_0x5b5f88[_0xe863('0x45')],qs[_0xe863('0x49')](_0x5158b5[_0xe863('0x46')][_0xe863('0x49')]));_0x262059['attributes']=_0x262059['attributes'][_0xe863('0x4a')]?_0x262059['attributes']:_0x5b5f88[_0xe863('0x45')];_0x262059[_0xe863('0x66')]=qs[_0xe863('0x4d')](_0x5158b5[_0xe863('0x46')][_0xe863('0x4d')]);_0x262059[_0xe863('0x4e')]=qs[_0xe863('0x4f')](_[_0xe863('0x67')](_0x5158b5[_0xe863('0x46')],_0x5b5f88['filters']));if(_0x5158b5[_0xe863('0x46')][_0xe863('0x50')]){_0x262059[_0xe863('0x4e')]=_['merge'](_0x262059[_0xe863('0x4e')],{'$or':_[_0xe863('0x41')](_0x262059[_0xe863('0x48')],function(_0x41acc7){var _0x4351a5={};_0x4351a5[_0x41acc7]={'$like':'%'+_0x5158b5[_0xe863('0x46')]['filter']+'%'};return _0x4351a5;})});}_0x262059=_[_0xe863('0x52')]({},_0x262059,_0x5158b5[_0xe863('0x53')]);return _0x5b3008['getAgents'](_0x262059);}})[_0xe863('0x38')](function(_0x246d32){if(_0x246d32){_0x5f21b6=_0x246d32[_0xe863('0x4a')];if(!_0x5158b5['query'][_0xe863('0x4b')]('nolimit')){_0x262059[_0xe863('0x31')]=qs[_0xe863('0x31')](_0x5158b5['query'][_0xe863('0x31')]);_0x262059[_0xe863('0x2f')]=qs['offset'](_0x5158b5[_0xe863('0x46')][_0xe863('0x2f')]);}return _0x5b3008[_0xe863('0xe3')](_0x262059);}})['then'](function(_0xa38304){if(_0xa38304){return _0xa38304?{'count':_0x5f21b6,'rows':_0xa38304}:null;}})[_0xe863('0x38')](respondWithResult(_0x52956b,null))['catch'](handleError(_0x52956b,null));}; \ No newline at end of file +var _0x7bfc=['../../config/utils','../../config/environment','../../config/license/util','redis','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','length','pick','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','CompanyId','ListId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','updatedAt','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','statusInt','requestid','status_code','groupName','DELIVERED','intelepeer','redif','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','infobip','RECEIVED_BY_RECIPIENT','message-delivered','state','message-id','csc','emit','removeAgents','isArray','getAgents','eml-format','rimraf','bluebird','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x10025e,_0x3639b1){var _0x5c4342=function(_0x4a65f1){while(--_0x4a65f1){_0x10025e['push'](_0x10025e['shift']());}};_0x5c4342(++_0x3639b1);}(_0x7bfc,0xc6));var _0xc7bf=function(_0x2d9de5,_0x3846d1){_0x2d9de5=_0x2d9de5-0x0;var _0x20891d=_0x7bfc[_0x2d9de5];return _0x20891d;};'use strict';var emlformat=require(_0xc7bf('0x0'));var rimraf=require(_0xc7bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc7bf('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc7bf('0x3'));var sox=require(_0xc7bf('0x4'));var csv=require(_0xc7bf('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc7bf('0x6'));var _=require('lodash');var squel=require(_0xc7bf('0x7'));var crypto=require('crypto');var jsforce=require(_0xc7bf('0x8'));var deskjs=require(_0xc7bf('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc7bf('0xa'));var Papa=require(_0xc7bf('0xb'));var Redis=require(_0xc7bf('0xc'));var authService=require(_0xc7bf('0xd'));var qs=require(_0xc7bf('0xe'));var as=require(_0xc7bf('0xf'));var hardwareService=require(_0xc7bf('0x10'));var logger=require(_0xc7bf('0x11'))(_0xc7bf('0x12'));var utils=require(_0xc7bf('0x13'));var config=require(_0xc7bf('0x14'));var licenseUtil=require(_0xc7bf('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7bf('0x16')]));require('./smsAccount.socket')[_0xc7bf('0x17')](socket);var jayson=require(_0xc7bf('0x18'));var client=jayson[_0xc7bf('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3c29d6,_0x306a34,_0x1c0761,_0xe0288a){return new BPromise(function(_0x40f620,_0x2a3cb8){var _0x23f32f=_0xe0288a||client;return _0x23f32f['request'](_0x3c29d6,_0x1c0761)[_0xc7bf('0x1a')](function(_0x589d1f){logger[_0xc7bf('0x1b')](_0xc7bf('0x1c'),_0x306a34,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x306a34,_0xc7bf('0x1d'),JSON['stringify'](_0x589d1f));if(_0x589d1f[_0xc7bf('0x1e')]){if(_0x589d1f[_0xc7bf('0x1e')][_0xc7bf('0x1f')]===0x1f4){logger[_0xc7bf('0x1e')](_0xc7bf('0x1c'),_0x306a34,_0x589d1f[_0xc7bf('0x1e')][_0xc7bf('0x20')]);return _0x2a3cb8(_0x589d1f['error'][_0xc7bf('0x20')]);}logger[_0xc7bf('0x1e')](_0xc7bf('0x1c'),_0x306a34,_0x589d1f[_0xc7bf('0x1e')]['message']);return _0x40f620(_0x589d1f[_0xc7bf('0x1e')][_0xc7bf('0x20')]);}else{logger[_0xc7bf('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x306a34,_0xc7bf('0x1d'));_0x40f620(_0x589d1f['result'][_0xc7bf('0x20')]);}})[_0xc7bf('0x21')](function(_0x1fe43d){logger['error'](_0xc7bf('0x1c'),_0x306a34,_0x1fe43d);_0x2a3cb8(_0x1fe43d);});});}function respondWithStatusCode(_0x2863e1,_0x3041ec){_0x3041ec=_0x3041ec||0xcc;return function(_0x325ac5){if(_0x325ac5){return _0x2863e1[_0xc7bf('0x22')](_0x3041ec);}return _0x2863e1[_0xc7bf('0x23')](_0x3041ec)[_0xc7bf('0x24')]();};}function respondWithResult(_0x15c772,_0x3e7ec9){_0x3e7ec9=_0x3e7ec9||0xc8;return function(_0x5e7906){if(_0x5e7906){return _0x15c772[_0xc7bf('0x23')](_0x3e7ec9)[_0xc7bf('0x25')](_0x5e7906);}};}function respondWithFilteredResult(_0x1b52d9,_0x5ea2db){return function(_0x5a8893){if(_0x5a8893){var _0x31abf3=typeof _0x5ea2db[_0xc7bf('0x26')]==='undefined'&&typeof _0x5ea2db[_0xc7bf('0x27')]==='undefined';var _0x121a50=_0x5a8893[_0xc7bf('0x28')];var _0x580d7c=_0x31abf3?0x0:_0x5ea2db[_0xc7bf('0x26')];var _0x4959a4=_0x31abf3?_0x5a8893[_0xc7bf('0x28')]:_0x5ea2db[_0xc7bf('0x26')]+_0x5ea2db['limit'];var _0x54ffd1;if(_0x4959a4>=_0x121a50){_0x4959a4=_0x121a50;_0x54ffd1=0xc8;}else{_0x54ffd1=0xce;}_0x1b52d9[_0xc7bf('0x23')](_0x54ffd1);return _0x1b52d9['set'](_0xc7bf('0x29'),_0x580d7c+'-'+_0x4959a4+'/'+_0x121a50)[_0xc7bf('0x25')](_0x5a8893);}return null;};}function patchUpdates(_0x1d4c16){return function(_0x3dc3cd){try{jsonpatch['apply'](_0x3dc3cd,_0x1d4c16,!![]);}catch(_0x26a20e){return BPromise[_0xc7bf('0x2a')](_0x26a20e);}return _0x3dc3cd[_0xc7bf('0x2b')]();};}function saveUpdates(_0x19b2f4,_0x3e7ff5){return function(_0x280c8d){if(_0x280c8d){return _0x280c8d[_0xc7bf('0x2c')](_0x19b2f4)[_0xc7bf('0x1a')](function(_0x160c75){return _0x160c75;});}return null;};}function removeEntity(_0x4f6038,_0x1122d2){return function(_0x222a5d){if(_0x222a5d){return _0x222a5d[_0xc7bf('0x2d')]()[_0xc7bf('0x1a')](function(){var _0x555c9b=_0x222a5d[_0xc7bf('0x2e')]({'plain':!![]});var _0x458252='SmsAccounts';return db[_0xc7bf('0x2f')][_0xc7bf('0x2d')]({'where':{'type':_0x458252,'resourceId':_0x555c9b['id']}})[_0xc7bf('0x1a')](function(){return _0x222a5d;});})[_0xc7bf('0x1a')](function(){_0x4f6038[_0xc7bf('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x458f4e,_0x72d811){return function(_0x152d95){if(!_0x152d95){_0x458f4e['sendStatus'](0x194);}return _0x152d95;};}function handleError(_0x5e78aa,_0x2d8817){_0x2d8817=_0x2d8817||0x1f4;return function(_0x585d7f){logger[_0xc7bf('0x1e')](_0x585d7f[_0xc7bf('0x30')]);if(_0x585d7f[_0xc7bf('0x31')]){delete _0x585d7f[_0xc7bf('0x31')];}_0x5e78aa[_0xc7bf('0x23')](_0x2d8817)[_0xc7bf('0x32')](_0x585d7f);};}exports[_0xc7bf('0x33')]=function(_0x1e37d5,_0x90e45a){var _0x35cb03={'include':[{'model':db[_0xc7bf('0x34')],'as':_0xc7bf('0x35')}]},_0xc153cd={},_0x3b9e7a={'count':0x0,'rows':[]};var _0x423f73=_[_0xc7bf('0x36')](db[_0xc7bf('0x37')][_0xc7bf('0x38')],function(_0x280fdd){return{'name':_0x280fdd[_0xc7bf('0x39')],'type':_0x280fdd[_0xc7bf('0x3a')]['key']};});_0xc153cd[_0xc7bf('0x3b')]=_[_0xc7bf('0x36')](_0x423f73,_0xc7bf('0x31'));_0xc153cd[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x1e37d5['query']);_0xc153cd[_0xc7bf('0x3e')]=_['intersection'](_0xc153cd[_0xc7bf('0x3b')],_0xc153cd['query']);_0x35cb03[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0xc153cd[_0xc7bf('0x3b')],qs[_0xc7bf('0x41')](_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x35cb03[_0xc7bf('0x3f')]=_0x35cb03[_0xc7bf('0x3f')]['length']?_0x35cb03[_0xc7bf('0x3f')]:_0xc153cd[_0xc7bf('0x3b')];if(!_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x42')]('nolimit')){_0x35cb03[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x1e37d5['query'][_0xc7bf('0x27')]);_0x35cb03[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x1e37d5['query'][_0xc7bf('0x26')]);}_0x35cb03[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x44')]);_0x35cb03[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_['pick'](_0x1e37d5[_0xc7bf('0x3c')],_0xc153cd[_0xc7bf('0x3e')]),_0x423f73);if(_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x35cb03['where']=_[_0xc7bf('0x47')](_0x35cb03['where'],{'$or':_[_0xc7bf('0x36')](_0x423f73,function(_0xe62082){if(_0xe62082[_0xc7bf('0x3a')]!==_0xc7bf('0x48')){var _0x3f49b3={};_0x3f49b3[_0xe62082[_0xc7bf('0x31')]]={'$like':'%'+_0x1e37d5[_0xc7bf('0x3c')][_0xc7bf('0x46')]+'%'};return _0x3f49b3;}})});}_0x35cb03=_[_0xc7bf('0x47')]({},_0x35cb03,_0x1e37d5[_0xc7bf('0x49')]);var _0x59a30e={'where':_0x35cb03[_0xc7bf('0x45')]};return db['SmsAccount'][_0xc7bf('0x28')](_0x59a30e)[_0xc7bf('0x1a')](function(_0x386d05){_0x3b9e7a['count']=_0x386d05;if(_0x1e37d5[_0xc7bf('0x3c')]['includeAll']){_0x35cb03[_0xc7bf('0x4a')]=[{'all':!![]}];}return db[_0xc7bf('0x37')][_0xc7bf('0x4b')](_0x35cb03);})[_0xc7bf('0x1a')](function(_0x11d85c){_0x3b9e7a[_0xc7bf('0x4c')]=_0x11d85c;return _0x3b9e7a;})['then'](respondWithFilteredResult(_0x90e45a,_0x35cb03))[_0xc7bf('0x21')](handleError(_0x90e45a,null));};exports['show']=function(_0x2e7ca2,_0x23e2e5){var _0x9b7d73={'raw':![],'where':{'id':_0x2e7ca2[_0xc7bf('0x4d')]['id']},'include':[{'model':db[_0xc7bf('0x34')],'as':'mandatoryDispositionPause'}]},_0x50e347={};_0x50e347[_0xc7bf('0x3b')]=_[_0xc7bf('0x3d')](db['SmsAccount'][_0xc7bf('0x38')]);_0x50e347[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x2e7ca2['query']);_0x50e347[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0x50e347[_0xc7bf('0x3b')],_0x50e347['query']);_0x9b7d73[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0x50e347[_0xc7bf('0x3b')],qs['fields'](_0x2e7ca2['query']['fields']));_0x9b7d73[_0xc7bf('0x3f')]=_0x9b7d73[_0xc7bf('0x3f')]['length']?_0x9b7d73['attributes']:_0x50e347[_0xc7bf('0x3b')];if(_0x2e7ca2['query']['includeAll']){_0x9b7d73[_0xc7bf('0x4a')]=[{'all':!![]}];}_0x9b7d73=_[_0xc7bf('0x47')]({},_0x9b7d73,_0x2e7ca2[_0xc7bf('0x49')]);return db['SmsAccount']['find'](_0x9b7d73)['then'](handleEntityNotFound(_0x23e2e5,null))[_0xc7bf('0x1a')](respondWithResult(_0x23e2e5,null))[_0xc7bf('0x21')](handleError(_0x23e2e5,null));};exports[_0xc7bf('0x4e')]=function(_0x2e8377,_0x51222f){return db['SmsAccount'][_0xc7bf('0x4e')](_0x2e8377[_0xc7bf('0x4f')],{})[_0xc7bf('0x1a')](function(_0x246d9b){var _0x423ec8=_0x2e8377[_0xc7bf('0x50')][_0xc7bf('0x2e')]({'plain':!![]});if(!_0x423ec8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x423ec8['role']===_0xc7bf('0x50')){var _0x267d88=_0x246d9b[_0xc7bf('0x2e')]({'plain':!![]});var _0x736fec='SmsAccounts';return db[_0xc7bf('0x51')][_0xc7bf('0x52')]({'where':{'name':_0x736fec,'userProfileId':_0x423ec8[_0xc7bf('0x53')]},'raw':!![]})['then'](function(_0x9c5291){if(_0x9c5291&&_0x9c5291[_0xc7bf('0x54')]===0x0){return db['UserProfileResource'][_0xc7bf('0x4e')]({'name':_0x267d88[_0xc7bf('0x31')],'resourceId':_0x267d88['id'],'type':_0x9c5291[_0xc7bf('0x31')],'sectionId':_0x9c5291['id']},{})[_0xc7bf('0x1a')](function(){return _0x246d9b;});}else{return _0x246d9b;}})[_0xc7bf('0x21')](function(_0x556c99){logger[_0xc7bf('0x1e')](_0xc7bf('0x55'),_0x556c99);throw _0x556c99;});}return _0x246d9b;})[_0xc7bf('0x1a')](respondWithResult(_0x51222f,0xc9))[_0xc7bf('0x21')](handleError(_0x51222f,null));};exports[_0xc7bf('0x2c')]=function(_0x5ef955,_0x57f1f8){if(_0x5ef955[_0xc7bf('0x4f')]['id']){delete _0x5ef955[_0xc7bf('0x4f')]['id'];}return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x5ef955[_0xc7bf('0x4d')]['id']},'include':[{'model':db[_0xc7bf('0x34')],'as':'mandatoryDispositionPause'}]})[_0xc7bf('0x1a')](handleEntityNotFound(_0x57f1f8,null))[_0xc7bf('0x1a')](saveUpdates(_0x5ef955[_0xc7bf('0x4f')],null))[_0xc7bf('0x1a')](respondWithResult(_0x57f1f8,null))['catch'](handleError(_0x57f1f8,null));};exports[_0xc7bf('0x2d')]=function(_0x4f6c54,_0x4502f7){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x4f6c54[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x4502f7,null))[_0xc7bf('0x1a')](removeEntity(_0x4502f7,null))[_0xc7bf('0x21')](handleError(_0x4502f7,null));};exports[_0xc7bf('0x56')]=function(_0x5ccce9,_0x5c08d7){return db[_0xc7bf('0x37')][_0xc7bf('0x56')]()[_0xc7bf('0x1a')](respondWithResult(_0x5c08d7,null))['catch'](handleError(_0x5c08d7,null));};exports[_0xc7bf('0x57')]=function(_0x53781b,_0x2fa2a2,_0x413837){if(_0x53781b[_0xc7bf('0x4f')]['id']){delete _0x53781b[_0xc7bf('0x4f')]['id'];}return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x53781b[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x2fa2a2,null))[_0xc7bf('0x1a')](function(_0xca732e){if(_0xca732e){_0x53781b[_0xc7bf('0x4f')][_0xc7bf('0x58')]=_0xca732e['id'];return db[_0xc7bf('0x59')][_0xc7bf('0x4e')](_0x53781b['body']);}})['then'](respondWithResult(_0x2fa2a2,null))['catch'](handleError(_0x2fa2a2,null));};exports[_0xc7bf('0x5a')]=function(_0xaa5dbf,_0x4327f7,_0x457808){var _0x288914={'raw':![],'where':{}};var _0x3c7b35={};var _0x695a1={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc7bf('0x5b')]({'where':{'id':_0xaa5dbf[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x4327f7,null))[_0xc7bf('0x1a')](function(_0x27fc3d){if(_0x27fc3d){_0x3c7b35[_0xc7bf('0x3b')]=_['keys'](db[_0xc7bf('0x59')][_0xc7bf('0x38')]);_0x3c7b35[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0xaa5dbf[_0xc7bf('0x3c')]);_0x3c7b35[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0x3c7b35[_0xc7bf('0x3b')],_0x3c7b35[_0xc7bf('0x3c')]);_0x288914['attributes']=_['intersection'](_0x3c7b35['model'],qs['fields'](_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x288914[_0xc7bf('0x3f')]=_0x288914[_0xc7bf('0x3f')][_0xc7bf('0x5c')]?_0x288914[_0xc7bf('0x3f')]:_0x3c7b35[_0xc7bf('0x3b')];if(!_0xaa5dbf['query'][_0xc7bf('0x42')]('nolimit')){_0x288914[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x27')]);_0x288914['offset']=qs['offset'](_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}_0x288914['order']=qs[_0xc7bf('0x44')](_0xaa5dbf['query'][_0xc7bf('0x44')]);_0x288914[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0xaa5dbf[_0xc7bf('0x3c')],_0x3c7b35['filters']));_0x288914[_0xc7bf('0x45')][_0xc7bf('0x58')]=_0x27fc3d['id'];if(_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x288914[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x288914[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0x288914[_0xc7bf('0x3f')],function(_0x12bfa2){var _0x1e1f4b={};_0x1e1f4b[_0x12bfa2]={'$like':'%'+_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x46')]+'%'};return _0x1e1f4b;})});}_0x288914=_['merge']({},_0x288914,_0xaa5dbf['options']);return db[_0xc7bf('0x59')][_0xc7bf('0x28')]({'where':_0x288914['where']})[_0xc7bf('0x1a')](function(_0x353bb4){_0x695a1['count']=_0x353bb4;if(_0xaa5dbf[_0xc7bf('0x3c')][_0xc7bf('0x5e')]){_0x288914['include']=[{'all':!![]}];}return db[_0xc7bf('0x59')]['findAll'](_0x288914);})[_0xc7bf('0x1a')](function(_0xb069c){_0x695a1[_0xc7bf('0x4c')]=_0xb069c;return _0x695a1;});}})[_0xc7bf('0x1a')](respondWithFilteredResult(_0x4327f7,_0x288914))[_0xc7bf('0x21')](handleError(_0x4327f7,null));};exports[_0xc7bf('0x5f')]=function(_0x49054b,_0x349401,_0x3db8ea){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x49054b[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x349401,null))[_0xc7bf('0x1a')](function(_0x44ea9c){if(_0x44ea9c){return _0x44ea9c[_0xc7bf('0x5f')](_0x49054b[_0xc7bf('0x3c')][_0xc7bf('0x60')]);}})['then'](respondWithStatusCode(_0x349401,null))[_0xc7bf('0x21')](handleError(_0x349401,null));};exports['addAnswer']=function(_0x47f8a5,_0x34ed7e,_0x60b405){if(_0x47f8a5[_0xc7bf('0x4f')]['id']){delete _0x47f8a5[_0xc7bf('0x4f')]['id'];}return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x47f8a5[_0xc7bf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x34ed7e,null))[_0xc7bf('0x1a')](function(_0x477d9f){if(_0x477d9f){_0x47f8a5[_0xc7bf('0x4f')][_0xc7bf('0x58')]=_0x477d9f['id'];return db[_0xc7bf('0x61')][_0xc7bf('0x4e')](_0x47f8a5[_0xc7bf('0x4f')]);}})[_0xc7bf('0x1a')](respondWithResult(_0x34ed7e,null))[_0xc7bf('0x21')](handleError(_0x34ed7e,null));};exports[_0xc7bf('0x62')]=function(_0x362cd3,_0x5c9eaf,_0x3874e9){var _0xce475d={'raw':![],'where':{}};var _0x56ef3d={};var _0x263ed7={'count':0x0,'rows':[]};return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x362cd3['params']['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x5c9eaf,null))[_0xc7bf('0x1a')](function(_0x2b4124){if(_0x2b4124){_0x56ef3d[_0xc7bf('0x3b')]=_[_0xc7bf('0x3d')](db[_0xc7bf('0x61')]['rawAttributes']);_0x56ef3d[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x362cd3[_0xc7bf('0x3c')]);_0x56ef3d[_0xc7bf('0x3e')]=_['intersection'](_0x56ef3d[_0xc7bf('0x3b')],_0x56ef3d[_0xc7bf('0x3c')]);_0xce475d[_0xc7bf('0x3f')]=_['intersection'](_0x56ef3d['model'],qs[_0xc7bf('0x41')](_0x362cd3[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0xce475d[_0xc7bf('0x3f')]=_0xce475d[_0xc7bf('0x3f')]['length']?_0xce475d[_0xc7bf('0x3f')]:_0x56ef3d[_0xc7bf('0x3b')];if(!_0x362cd3['query'][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0xce475d[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x362cd3[_0xc7bf('0x3c')]['limit']);_0xce475d[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x362cd3['query'][_0xc7bf('0x26')]);}_0xce475d['order']=qs[_0xc7bf('0x44')](_0x362cd3['query']['sort']);_0xce475d['where']=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0x362cd3[_0xc7bf('0x3c')],_0x56ef3d[_0xc7bf('0x3e')]));_0xce475d['where']['SmsAccountId']=_0x2b4124['id'];if(_0x362cd3[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0xce475d[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0xce475d[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0xce475d['attributes'],function(_0x304e9e){var _0x1c1547={};_0x1c1547[_0x304e9e]={'$like':'%'+_0x362cd3[_0xc7bf('0x3c')][_0xc7bf('0x46')]+'%'};return _0x1c1547;})});}_0xce475d=_['merge']({},_0xce475d,_0x362cd3['options']);return db[_0xc7bf('0x61')][_0xc7bf('0x28')]({'where':_0xce475d['where']})[_0xc7bf('0x1a')](function(_0x456f24){_0x263ed7[_0xc7bf('0x28')]=_0x456f24;if(_0x362cd3['query']['includeAll']){_0xce475d[_0xc7bf('0x4a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc7bf('0x4b')](_0xce475d);})[_0xc7bf('0x1a')](function(_0x2e8150){_0x263ed7[_0xc7bf('0x4c')]=_0x2e8150;return _0x263ed7;});}})['then'](respondWithFilteredResult(_0x5c9eaf,_0xce475d))[_0xc7bf('0x21')](handleError(_0x5c9eaf,null));};exports[_0xc7bf('0x64')]=function(_0x2309d1,_0x36bfb5,_0x6d9bde){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x2309d1['params']['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x36bfb5,null))['then'](function(_0x30f5bb){if(_0x30f5bb){return _0x30f5bb['removeAnswers'](_0x2309d1['query'][_0xc7bf('0x60')]);}})[_0xc7bf('0x1a')](respondWithStatusCode(_0x36bfb5,null))[_0xc7bf('0x21')](handleError(_0x36bfb5,null));};exports['notify']=function(_0x1db4cb,_0x15d7d1,_0x3f054d){var _0xbf269b={'channel':_0xc7bf('0x65')};var _0x434578=[];var _0x3a0f68=[];var _0x20ea33={};return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x1db4cb['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xc7bf('0x66')}]})[_0xc7bf('0x1a')](handleEntityNotFound(_0x15d7d1,null))[_0xc7bf('0x1a')](function(_0x4afc0c){_0xbf269b[_0xc7bf('0x67')]=_0x4afc0c;_0xbf269b[_0xc7bf('0x68')]=_[_0xc7bf('0x69')](_0x4afc0c[_0xc7bf('0x66')],[_0xc7bf('0x6a')],[_0xc7bf('0x6b')]);if(_0xbf269b[_0xc7bf('0x67')]['Applications']){delete _0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x66')];}return db[_0xc7bf('0x6c')][_0xc7bf('0x56')]();})[_0xc7bf('0x1a')](function(_0x40c83f){if(!_0x40c83f){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0x6f'));}_0x434578=_['difference'](_['keys'](_0x40c83f),[_0xc7bf('0x70'),'updatedAt']);_0x3a0f68=_['difference'](_['keys'](_0x40c83f),['createdAt','updatedAt',_0xc7bf('0x71'),_0xc7bf('0x72')]);_0xbf269b[_0xc7bf('0x4f')]={'mapKey':'mobile'};if(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x3a')]){switch(_0xbf269b['account'][_0xc7bf('0x3a')]){case _0xc7bf('0x73'):_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x75')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x76')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x78')];break;case _0xc7bf('0x79'):_0xbf269b['body'][_0xc7bf('0x74')]='+'+_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x7a')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x7b')];break;case _0xc7bf('0x7c'):_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x74')];_0xbf269b['body'][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x20')];break;case _0xc7bf('0x7d'):_0xbf269b['body'][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')]['from'];_0xbf269b['body'][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x4f')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x7e')];break;case'plivo':_0xbf269b[_0xc7bf('0x4f')]['from']=_0x1db4cb['body'][_0xc7bf('0x75')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')]['Text'];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb['body'][_0xc7bf('0x7f')];break;case'infobip':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]='+'+_0x1db4cb[_0xc7bf('0x4f')]['results'][0x0][_0xc7bf('0x74')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x80')][0x0][_0xc7bf('0x7b')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x80')][0x0][_0xc7bf('0x77')];break;case'csc':_0xbf269b[_0xc7bf('0x4f')]['from']=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x81')];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x82')]['message'];break;case _0xc7bf('0x83'):_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')]['fromNumber'];_0xbf269b[_0xc7bf('0x4f')]['body']=_0x1db4cb[_0xc7bf('0x4f')]['text'];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x84')];break;case _0xc7bf('0x85'):_0xbf269b['body'][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][0x0][_0xc7bf('0x20')]['id'];_0xbf269b['body']['from']=_0x1db4cb[_0xc7bf('0x4f')][0x0]['message'][_0xc7bf('0x74')];_0xbf269b['body'][_0xc7bf('0x4f')]=_0x1db4cb['body'][0x0][_0xc7bf('0x20')]['text'];break;case'intelepeer':_0xbf269b['body'][_0xc7bf('0x74')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x74')];_0xbf269b[_0xc7bf('0x4f')]['body']=_0x1db4cb[_0xc7bf('0x4f')]['message'];_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')]=_0x1db4cb[_0xc7bf('0x4f')][_0xc7bf('0x86')];break;}}if(_0xbf269b[_0xc7bf('0x4f')]['id']){delete _0xbf269b[_0xc7bf('0x4f')]['id'];}if(_[_0xc7bf('0x87')](_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')])){throw new db[(_0xc7bf('0x6d'))]['ValidationError'](_0xc7bf('0x88'));}if(_[_0xc7bf('0x87')](_0xbf269b['body']['body'])||_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')]===''){throw new db['Sequelize'][(_0xc7bf('0x6e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc7bf('0x87')](_0xbf269b[_0xc7bf('0x4f')]['mapKey'])){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0x89')+_0x3a0f68);}if(!_['includes'](_0x3a0f68,_0xbf269b[_0xc7bf('0x4f')]['mapKey'])){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0x8a')+_0x3a0f68);}_0x20ea33[_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x8b')]]=_0xbf269b['body'][_0xc7bf('0x74')];return db[_0xc7bf('0x8c')][_0xc7bf('0x52')]({'where':{'id':_0xbf269b[_0xc7bf('0x67')]['ListId']},'include':[{'model':db[_0xc7bf('0x6c')],'as':_0xc7bf('0x8d'),'where':_0x20ea33,'limit':0x1,'order':[[_0xc7bf('0x8e'),_0xc7bf('0x8f')]]}]});})[_0xc7bf('0x1a')](handleEntityNotFound(_0x15d7d1,null))[_0xc7bf('0x1a')](function(_0x4112c1){if(_0x4112c1){_0xbf269b[_0xc7bf('0x90')]=_[_0xc7bf('0x91')](_0x4112c1,[_0xc7bf('0x8d')]);if(_0x4112c1[_0xc7bf('0x8d')]['length']){return _0x4112c1[_0xc7bf('0x8d')][0x0];}var _0x3a088c=_['defaults'](_0xbf269b[_0xc7bf('0x4f')],{'firstName':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')],'ListId':_0x4112c1['id']});_0x3a088c[_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x8b')]]=_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')];return db[_0xc7bf('0x6c')][_0xc7bf('0x4e')](_0x3a088c,{'fields':_0x434578,'raw':!![]});}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x15d7d1,null))[_0xc7bf('0x1a')](function(_0x54a0ec){if(_0x54a0ec){_0xbf269b[_0xc7bf('0x92')]=_0x54a0ec;var _0x141311={'ContactId':_0x54a0ec['id'],'phone':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')],'SmsAccountId':_0x1db4cb[_0xc7bf('0x4d')]['id']};var _0x2af417={'ContactId':_0x54a0ec['id'],'SmsAccountId':_0x1db4cb[_0xc7bf('0x4d')]['id'],'closed':![]};return db[_0xc7bf('0x93')]['find']({'where':_0x2af417})[_0xc7bf('0x1a')](function(_0x1c46dd){if(_0x1c46dd){return[_0x1c46dd,![]];}return db['SmsInteraction']['create'](_0x141311)[_0xc7bf('0x1a')](function(_0x463e86){return[_0x463e86,!![]];});});}})[_0xc7bf('0x94')](function(_0x113ab7,_0x1d0c05){_0xbf269b[_0xc7bf('0x95')]=_0x113ab7[_0xc7bf('0x2e')]({'plain':!![]});_0xbf269b[_0xc7bf('0x95')]['created']=![];if(_0x1d0c05){if(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x96')]){_0xbf269b[_0xc7bf('0x68')][_0xc7bf('0x97')]({'id':0x0,'priority':_0xbf269b['applications'][_0xc7bf('0x5c')]+0x1,'app':_0xc7bf('0x98'),'appdata':_0xc7bf('0x99'),'interval':_0xc7bf('0x9a')});}_0xbf269b[_0xc7bf('0x95')][_0xc7bf('0x9b')]=!![];}return db[_0xc7bf('0x9c')][_0xc7bf('0x4e')]({'phone':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x74')],'messageId':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x77')],'body':_0xbf269b[_0xc7bf('0x4f')][_0xc7bf('0x4f')],'SmsAccountId':_0x1db4cb[_0xc7bf('0x4d')]['id'],'SmsInteractionId':_0x113ab7['id'],'direction':'in','ContactId':_0x113ab7['ContactId'],'AttachmentId':_0xbf269b['body'][_0xc7bf('0x9d')]});})[_0xc7bf('0x1a')](function(_0x41248a){_0xbf269b['message']=_0x41248a;if(_0xbf269b['interaction'][_0xc7bf('0x9e')]){return db[_0xc7bf('0x9f')][_0xc7bf('0x52')]({'attributes':['id',_0xc7bf('0x31')],'where':{'id':_0xbf269b[_0xc7bf('0x95')][_0xc7bf('0x9e')]}})[_0xc7bf('0x1a')](function(_0x9c08a1){if(_0x9c08a1){_0xbf269b['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9c08a1['name']+','+(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0xa0')]||0xa),'interval':_0xc7bf('0x9a')});}return respondWithRpcPromise(_0xc7bf('0xa1'),_0xc7bf('0xa2'),_0xbf269b);});}return respondWithRpcPromise(_0xc7bf('0xa1'),_0xc7bf('0xa2'),_0xbf269b);})['then'](function(_0xfb702e){if(_0xfb702e){var _0x38cc6b=0xc8;var _0x2beaa1=_0xc7bf('0xa3');logger[_0xc7bf('0x1b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2beaa1,_0x38cc6b,_0xc7bf('0xa4'));logger[_0xc7bf('0xa5')](_0xc7bf('0xa6'),_0x2beaa1,_0x38cc6b,_0xc7bf('0xa4'),JSON[_0xc7bf('0xa7')](_0xfb702e));if(_0xbf269b[_0xc7bf('0x67')][_0xc7bf('0x3a')]===_0xc7bf('0x73')){return _0x15d7d1['status'](_0x38cc6b)[_0xc7bf('0xa8')](_0xc7bf('0xa9'),_0xc7bf('0xaa'))[_0xc7bf('0x32')](_0xc7bf('0xab'));}else{return _0x15d7d1[_0xc7bf('0x23')](_0x38cc6b)[_0xc7bf('0x25')](_0xfb702e);}}})[_0xc7bf('0x21')](handleError(_0x15d7d1,null));};exports[_0xc7bf('0xac')]=function(_0x48c31b,_0x5a5efa){var _0x17cb07=_0x48c31b[_0xc7bf('0x4d')]['id'];var _0x22fce4=_0x48c31b[_0xc7bf('0x4f')];var _0x586d6e=0xc8;var _0x2c290b=null;return db['sequelize'][_0xc7bf('0xad')]({'isolationLevel':db[_0xc7bf('0xae')][_0xc7bf('0xaf')]['ISOLATION_LEVELS'][_0xc7bf('0xb0')]},function(_0x45286c){return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x17cb07},'transaction':_0x45286c})[_0xc7bf('0x1a')](function(_0x4d42eb){if(_0x4d42eb){return db[_0xc7bf('0xb1')][_0xc7bf('0x2d')]({'where':{'SmsAccountId':_0x17cb07},'transaction':_0x45286c})['then'](function(){var _0x1f30fd=_[_0xc7bf('0x36')](_0x22fce4,function(_0x35bcb4){_0x35bcb4[_0xc7bf('0x58')]=_0x17cb07;return _0x35bcb4;});return db[_0xc7bf('0xb1')][_0xc7bf('0xb2')](_0x1f30fd,{'transaction':_0x45286c});});}else{_0x586d6e=0x194;_0x2c290b=[];}});})[_0xc7bf('0x1a')](function(){if(_0x586d6e!==0x194){return db['SmsApplication'][_0xc7bf('0xb3')]({'where':{'SmsAccountId':_0x17cb07},'order':_0xc7bf('0x6a')})['then'](function(_0x26a389){_0x2c290b=_0x26a389;});}})['catch'](function(_0x3241d1){_0x586d6e=0x1f4;logger[_0xc7bf('0x1e')](_0x3241d1['stack']);if(_0x3241d1['name']){delete _0x3241d1[_0xc7bf('0x31')];}_0x2c290b=_0x3241d1;})[_0xc7bf('0xb4')](function(){if(_0x2c290b===null){_0x5a5efa[_0xc7bf('0x22')](_0x586d6e);}else{if(_0x586d6e===0x1f4){_0x5a5efa[_0xc7bf('0x23')](_0x586d6e)['send'](_0x2c290b);}else{_0x5a5efa[_0xc7bf('0x23')](_0x586d6e)[_0xc7bf('0x25')](_0x2c290b);}}});};exports[_0xc7bf('0xb5')]=function(_0x436303,_0x3e8a0c,_0x5b35d8){var _0x5ef44c={};var _0x28b1b8={};var _0x59e737;var _0x4540e4;return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x436303[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x3e8a0c,null))[_0xc7bf('0x1a')](function(_0x104696){if(_0x104696){_0x59e737=_0x104696;_0x28b1b8[_0xc7bf('0x3b')]=_['keys'](db[_0xc7bf('0xb1')]['rawAttributes']);_0x28b1b8[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x436303['query']);_0x28b1b8[_0xc7bf('0x3e')]=_['intersection'](_0x28b1b8['model'],_0x28b1b8['query']);_0x5ef44c[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0x28b1b8[_0xc7bf('0x3b')],qs[_0xc7bf('0x41')](_0x436303['query'][_0xc7bf('0x41')]));_0x5ef44c[_0xc7bf('0x3f')]=_0x5ef44c['attributes'][_0xc7bf('0x5c')]?_0x5ef44c[_0xc7bf('0x3f')]:_0x28b1b8[_0xc7bf('0x3b')];_0x5ef44c[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x436303[_0xc7bf('0x3c')]['sort']);_0x5ef44c[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0x436303[_0xc7bf('0x3c')],_0x28b1b8['filters']));if(_0x436303['query'][_0xc7bf('0x46')]){_0x5ef44c[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x5ef44c[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0x5ef44c[_0xc7bf('0x3f')],function(_0x2da815){var _0x10bf26={};_0x10bf26[_0x2da815]={'$like':'%'+_0x436303[_0xc7bf('0x3c')]['filter']+'%'};return _0x10bf26;})});}_0x5ef44c=_['merge']({},_0x5ef44c,_0x436303['options']);return _0x59e737[_0xc7bf('0xb5')](_0x5ef44c);}})[_0xc7bf('0x1a')](function(_0x537122){if(_0x537122){_0x4540e4=_0x537122[_0xc7bf('0x5c')];if(!_0x436303[_0xc7bf('0x3c')][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0x5ef44c[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x436303[_0xc7bf('0x3c')][_0xc7bf('0x27')]);_0x5ef44c[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x436303[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}return _0x59e737[_0xc7bf('0xb5')](_0x5ef44c);}})['then'](function(_0x40bd6d){if(_0x40bd6d){return _0x40bd6d?{'count':_0x4540e4,'rows':_0x40bd6d}:null;}})['then'](respondWithResult(_0x3e8a0c,null))[_0xc7bf('0x21')](handleError(_0x3e8a0c,null));};exports['getInteractions']=function(_0x373c87,_0xd31e1f,_0x5d9fd6){var _0x4158a9={'raw':![],'where':{}};var _0x5c9107={};var _0x532acb={'count':0x0,'rows':[]};return db[_0xc7bf('0x37')]['findOne']({'where':{'id':_0x373c87['params']['id']}})['then'](handleEntityNotFound(_0xd31e1f,null))[_0xc7bf('0x1a')](function(_0x239548){if(_0x239548){_0x5c9107['model']=_[_0xc7bf('0x3d')](db[_0xc7bf('0x93')][_0xc7bf('0x38')]);_0x5c9107[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x373c87[_0xc7bf('0x3c')]);_0x5c9107[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0x5c9107[_0xc7bf('0x3b')],_0x5c9107[_0xc7bf('0x3c')]);_0x4158a9[_0xc7bf('0x3f')]=_[_0xc7bf('0x40')](_0x5c9107['model'],qs[_0xc7bf('0x41')](_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x4158a9[_0xc7bf('0x3f')]=_0x4158a9['attributes']['length']?_0x4158a9['attributes']:_0x5c9107['model'];if(!_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0x4158a9['limit']=qs[_0xc7bf('0x27')](_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x27')]);_0x4158a9[_0xc7bf('0x26')]=qs[_0xc7bf('0x26')](_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}_0x4158a9[_0xc7bf('0x43')]=qs['sort'](_0x373c87['query'][_0xc7bf('0x44')]);_0x4158a9['where']=qs['filters'](_['pick'](_0x373c87['query'],_0x5c9107[_0xc7bf('0x3e')]));_0x4158a9['where'][_0xc7bf('0x58')]=_0x239548['id'];if(_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x4158a9['where']=_[_0xc7bf('0x47')](_0x4158a9[_0xc7bf('0x45')],{'$or':_[_0xc7bf('0x36')](_0x4158a9[_0xc7bf('0x3f')],function(_0x3bf94d){var _0x3259a7={};_0x3259a7[_0x3bf94d]={'$like':'%'+_0x373c87['query'][_0xc7bf('0x46')]+'%'};return _0x3259a7;})});}_0x4158a9=_[_0xc7bf('0x47')]({},_0x4158a9,_0x373c87['options']);return db[_0xc7bf('0x93')][_0xc7bf('0x28')]({'where':_0x4158a9['where']})[_0xc7bf('0x1a')](function(_0x203c95){_0x532acb[_0xc7bf('0x28')]=_0x203c95;if(_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0x5e')]){_0x4158a9[_0xc7bf('0x4a')]=[{'model':db[_0xc7bf('0x6c')],'as':_0xc7bf('0xb6'),'required':![]},{'model':db['User'],'as':_0xc7bf('0xb7'),'attributes':[_0xc7bf('0x31'),_0xc7bf('0xb8'),_0xc7bf('0xb9')],'required':![]},{'model':db[_0xc7bf('0xba')],'as':_0xc7bf('0xbb'),'attributes':['id',_0xc7bf('0x31'),_0xc7bf('0xbc')],'where':_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0xbd')]?{'id':_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0xbd')]}:undefined,'required':_0x373c87[_0xc7bf('0x3c')][_0xc7bf('0xbd')]?!![]:![]}];}return db[_0xc7bf('0x93')]['findAll'](_0x4158a9);})['then'](function(_0x470462){_0x532acb[_0xc7bf('0x4c')]=_0x470462;return _0x532acb;});}})[_0xc7bf('0x1a')](respondWithFilteredResult(_0xd31e1f,_0x4158a9))['catch'](handleError(_0xd31e1f,null));};exports[_0xc7bf('0x32')]=function(_0x35d645,_0x218f81,_0x5930f2){var _0x4bfae0,_0x4510ec,_0x2c8650;if(_[_0xc7bf('0x87')](_0x35d645['body'][_0xc7bf('0x4f')])||_0x35d645[_0xc7bf('0x4f')][_0xc7bf('0x4f')]===''){throw new db[(_0xc7bf('0x6d'))]['ValidationError'](_0xc7bf('0xbe'));}if(_[_0xc7bf('0x87')](_0x35d645[_0xc7bf('0x4f')]['to'])){throw new db[(_0xc7bf('0x6d'))][(_0xc7bf('0x6e'))](_0xc7bf('0xbf'));}_0x4bfae0=_0x35d645['body']['to'];return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x35d645[_0xc7bf('0x4d')]['id']},'include':[{'model':db[_0xc7bf('0x8c')],'as':_0xc7bf('0xc0'),'include':[{'model':db['CmContact'],'as':_0xc7bf('0x8d'),'where':{'mobile':_0x4bfae0},'limit':0x1,'order':[[_0xc7bf('0x8e'),'DESC']]}]}]})[_0xc7bf('0x1a')](handleEntityNotFound(_0x218f81,null))[_0xc7bf('0x1a')](function(_0x56c1d1){if(_0x56c1d1&&_0x56c1d1['List']){_0x4510ec=_0x56c1d1[_0xc7bf('0x2e')]({'plain':!![]});if(_0x4510ec[_0xc7bf('0xc0')]&&_0x4510ec[_0xc7bf('0xc0')][_0xc7bf('0x8d')]['length']){return _0x4510ec[_0xc7bf('0xc0')]['Contacts'][0x0];}return db[_0xc7bf('0x6c')][_0xc7bf('0x4e')](_['defaults'](_0x35d645[_0xc7bf('0x4f')],{'firstName':_0x4bfae0,'mobile':_0x4bfae0,'phone':_0x4bfae0,'ListId':_0x4510ec['ListId']}));}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x218f81,null))[_0xc7bf('0x1a')](function(_0x47b265){if(_0x47b265){_0x2c8650=_0x47b265;return db[_0xc7bf('0x93')]['find']({'where':{'ContactId':_0x2c8650['id'],'closed':![],'SmsAccountId':_0x4510ec['id']}})[_0xc7bf('0x1a')](function(_0x503f35){if(_0x503f35){return[_0x503f35,![]];}return db['SmsInteraction'][_0xc7bf('0x4e')]({'UserId':_0x35d645[_0xc7bf('0x50')]['id'],'ContactId':_0x2c8650['id'],'SmsAccountId':_0x4510ec['id'],'phone':_0x4bfae0,'firstMsgDirection':_0xc7bf('0xc1'),'Messages':[_[_0xc7bf('0x47')](_0x35d645['body'],{'read':![],'body':_0x35d645[_0xc7bf('0x4f')][_0xc7bf('0x4f')],'phone':_0x4bfae0,'SmsAccountId':_0x4510ec['id'],'UserId':_0x35d645[_0xc7bf('0x50')]['id'],'ContactId':_0x2c8650['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xc7bf('0xc2')}]})[_0xc7bf('0x1a')](function(_0xcab5c5){return[_0xcab5c5,!![]];});});}})[_0xc7bf('0x94')](function(_0x150b33,_0xb5b3ee){if(_0xb5b3ee){return _0x150b33;}return db[_0xc7bf('0x9c')][_0xc7bf('0x4e')](_['merge'](_0x35d645[_0xc7bf('0x4f')],{'read':![],'body':_0x35d645[_0xc7bf('0x4f')][_0xc7bf('0x4f')],'phone':_0x4bfae0,'SmsAccountId':_0x4510ec['id'],'SmsInteractionId':_0x150b33['id'],'UserId':_0x35d645[_0xc7bf('0x50')]['id'],'ContactId':_0x2c8650['id']}))[_0xc7bf('0x1a')](function(_0x1d4200){_0x150b33[_0xc7bf('0xc3')][_0xc7bf('0xc2')]=[];_0x150b33[_0xc7bf('0xc3')][_0xc7bf('0xc2')][_0xc7bf('0x97')](_0x1d4200[_0xc7bf('0xc3')]);return _0x150b33;});})[_0xc7bf('0x1a')](respondWithResult(_0x218f81,null))['catch'](handleError(_0x218f81,null));};exports[_0xc7bf('0x23')]=function(_0x19fc68,_0x452c6c,_0xe57d72){if(_0x19fc68['body']['id']){delete _0x19fc68[_0xc7bf('0x4f')]['id'];}var _0x5cae5f,_0x12f00a,_0x10df83;return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x19fc68[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x452c6c,null))[_0xc7bf('0x1a')](function(_0x1c070a){if(_0x1c070a){_0x10df83=_0x1c070a;logger[_0xc7bf('0xa5')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7bf('0x23'),_0xc7bf('0xc4'),_0x1c070a[_0xc7bf('0x3a')],util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));switch(_0x1c070a[_0xc7bf('0x3a')]){case _0xc7bf('0x79'):if(_0x19fc68[_0xc7bf('0x4f')]['skebby_dispatch_id']&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')]){_0x12f00a=_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68['body']['skebby_dispatch_id']}});}break;case _0xc7bf('0x7c'):if(_0x19fc68[_0xc7bf('0x4f')]['requestid']&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xc6')]){_0x12f00a=_0x19fc68['body'][_0xc7bf('0xc6')];return db['SmsMessage'][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xc7')]}});}break;case'clicksend':if(_0x19fc68[_0xc7bf('0x4f')]['message_id']&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xc8')]){_0x12f00a=_0x19fc68[_0xc7bf('0x4f')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x19fc68['body'][_0xc7bf('0x7e')]}});}break;case'infobip':var _0x18d950=_0x19fc68['body'][_0xc7bf('0x80')][0x0];if(_0x18d950[_0xc7bf('0x77')]&&_0x18d950[_0xc7bf('0x23')][_0xc7bf('0xc9')]===_0xc7bf('0xca')){_0x12f00a=_0x18d950['status'][_0xc7bf('0xc9')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x18d950['messageId']}});}break;case'clickatell':if(_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x77')]&&_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')]){_0x12f00a=_0x19fc68['body'][_0xc7bf('0x23')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x77')]}});}break;case _0xc7bf('0x85'):if(_0x19fc68[_0xc7bf('0x4f')][0x0]['message']['id']){_0x12f00a=_0x19fc68['body'][0x0][_0xc7bf('0x3a')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68['body'][0x0]['message']['id']}});}break;case _0xc7bf('0xcb'):if(_0x19fc68[_0xc7bf('0x4f')]['redif']&&_0x19fc68['body']['status']){_0x12f00a=_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x23')];return db[_0xc7bf('0x9c')][_0xc7bf('0x52')]({'where':{'messageId':_0x19fc68['body'][_0xc7bf('0xcc')]}});}break;}}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x452c6c,null))[_0xc7bf('0x1a')](function(_0x42451d){if(_0x42451d){_0x5cae5f=_0x42451d;switch(_0x10df83['type']){case _0xc7bf('0x79'):if(_0x12f00a===_0xc7bf('0xca')){return _0x5cae5f[_0xc7bf('0x2c')]({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),_0xc7bf('0x23'),'skebby',util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0x7c'):if(_0x12f00a==='1'){return _0x5cae5f['update']({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),'status',_0xc7bf('0x79'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0x7d'):if(!_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0xce')]&&_0x12f00a>=0xc8&&_0x12f00a<=0xce){return _0x5cae5f[_0xc7bf('0x2c')]({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),_0xc7bf('0x23'),_0xc7bf('0x7d'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x52839b=_0x19fc68[_0xc7bf('0x4f')][_0xc7bf('0x80')][0x0];if(_0x52839b[_0xc7bf('0x23')][_0xc7bf('0xc9')]==='DELIVERED'){return _0x5cae5f['update']({'read':!![]});}else{logger['error'](_0xc7bf('0xcd'),_0xc7bf('0x23'),_0xc7bf('0xcf'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0x83'):if(_0x12f00a=='DELIVERED_TO_GATEWAY'||_0x12f00a==_0xc7bf('0xd0')){return _0x5cae5f['update']({'read':!![]});}else{logger['error'](_0xc7bf('0xcd'),_0xc7bf('0x23'),_0xc7bf('0x83'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x12f00a==_0xc7bf('0xd1')){return _0x5cae5f[_0xc7bf('0x2c')]({'read':!![]});}else{logger['error'](_0xc7bf('0xcd'),'status',_0xc7bf('0x85'),util['inspect'](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;case _0xc7bf('0xcb'):if(_0x12f00a==='DELIVRD'||_0x12f00a==='ACCEPTD'){return _0x5cae5f['update']({'read':!![]});}else{logger[_0xc7bf('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7bf('0x23'),_0xc7bf('0xcb'),util[_0xc7bf('0xc5')](_0x19fc68[_0xc7bf('0x4f')],{'showHidden':![],'depth':null}));}break;}return _0x5cae5f;}})['then'](respondWithResult(_0x452c6c,null))['catch'](handleError(_0x452c6c,null));};exports['statusGet']=function(_0x163423,_0xb5dce1,_0x303f54){var _0x5d7142,_0x12dffd,_0x4af238;return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x163423[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0xb5dce1,null))[_0xc7bf('0x1a')](function(_0x365587){if(_0x365587){_0x4af238=_0x365587;logger[_0xc7bf('0xa5')](_0xc7bf('0xcd'),_0xc7bf('0x23'),'received\x20delivery\x20report\x20from',_0x365587[_0xc7bf('0x3a')],util[_0xc7bf('0xc5')](_0x163423[_0xc7bf('0x3c')],{'showHidden':![],'depth':null}));switch(_0x365587[_0xc7bf('0x3a')]){case'csc':if(_0x163423[_0xc7bf('0x3c')]['message-id']&&_0x163423[_0xc7bf('0x3c')][_0xc7bf('0xd2')]){_0x12dffd=_0x163423[_0xc7bf('0x3c')][_0xc7bf('0xd2')];return db['SmsMessage'][_0xc7bf('0x52')]({'where':{'messageId':_0x163423[_0xc7bf('0x3c')][_0xc7bf('0xd3')]}});}break;}}})[_0xc7bf('0x1a')](handleEntityNotFound(_0xb5dce1,null))[_0xc7bf('0x1a')](function(_0xf48458){if(_0xf48458){_0x5d7142=_0xf48458;switch(_0x4af238[_0xc7bf('0x3a')]){case _0xc7bf('0xd4'):if(_0x12dffd==='2'||_0x12dffd==='6'){return _0x5d7142[_0xc7bf('0x2c')]({'read':!![]});}else{logger[_0xc7bf('0x1e')](_0xc7bf('0xcd'),_0xc7bf('0x23'),'csc',util['inspect'](_0x163423['query'],{'showHidden':![],'depth':null}));};break;}return _0x5d7142;}})['then'](respondWithResult(_0xb5dce1,null))['catch'](handleError(_0xb5dce1,null));};exports['addAgents']=function(_0x2db53c,_0x5e7ee1,_0x258a48){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x2db53c[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x5e7ee1,null))['then'](function(_0x23bab){if(_0x23bab){return _0x23bab['addAgents'](_0x2db53c[_0xc7bf('0x4f')][_0xc7bf('0x60')],_[_0xc7bf('0x91')](_0x2db53c[_0xc7bf('0x4f')],['ids','id'])||{})['spread'](function(_0xaf776f){for(var _0x2dacce=0x0;_0x2dacce<_0x2db53c[_0xc7bf('0x4f')][_0xc7bf('0x60')][_0xc7bf('0x5c')];_0x2dacce+=0x1){socket[_0xc7bf('0xd5')]('userSmsAccount:save',{'UserId':Number(_0x2db53c[_0xc7bf('0x4f')][_0xc7bf('0x60')][_0x2dacce]),'SmsAccountId':Number(_0x2db53c[_0xc7bf('0x4d')]['id'])});}return _0xaf776f;});}})[_0xc7bf('0x1a')](respondWithResult(_0x5e7ee1,null))['catch'](handleError(_0x5e7ee1,null));};exports[_0xc7bf('0xd6')]=function(_0x657e4a,_0x73e5ca,_0x3caa21){return db[_0xc7bf('0x37')][_0xc7bf('0x52')]({'where':{'id':_0x657e4a['params']['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x73e5ca,null))[_0xc7bf('0x1a')](function(_0x31b84f){if(_0x31b84f){return _0x31b84f[_0xc7bf('0xd6')](_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')])[_0xc7bf('0x1a')](function(){if(_[_0xc7bf('0xd7')](_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')])){for(var _0x5b17cb=0x0;_0x5b17cb<_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')][_0xc7bf('0x5c')];_0x5b17cb+=0x1){socket[_0xc7bf('0xd5')]('userSmsAccount:remove',{'UserId':Number(_0x657e4a['query'][_0xc7bf('0x60')][_0x5b17cb]),'SmsAccountId':Number(_0x657e4a[_0xc7bf('0x4d')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x657e4a[_0xc7bf('0x3c')][_0xc7bf('0x60')]),'SmsAccountId':Number(_0x657e4a[_0xc7bf('0x4d')]['id'])});}});}})[_0xc7bf('0x1a')](respondWithStatusCode(_0x73e5ca,null))[_0xc7bf('0x21')](handleError(_0x73e5ca,null));};exports[_0xc7bf('0xd8')]=function(_0x787ad3,_0x50557e,_0x404e45){var _0x2d4a6d={};var _0xd5e7df={};var _0x41bbf2;var _0x35c129;return db[_0xc7bf('0x37')][_0xc7bf('0x5b')]({'where':{'id':_0x787ad3[_0xc7bf('0x4d')]['id']}})[_0xc7bf('0x1a')](handleEntityNotFound(_0x50557e,null))[_0xc7bf('0x1a')](function(_0x47624e){if(_0x47624e){_0x41bbf2=_0x47624e;_0xd5e7df[_0xc7bf('0x3b')]=_[_0xc7bf('0x3d')](db[_0xc7bf('0x9f')][_0xc7bf('0x38')]);_0xd5e7df[_0xc7bf('0x3c')]=_[_0xc7bf('0x3d')](_0x787ad3['query']);_0xd5e7df[_0xc7bf('0x3e')]=_[_0xc7bf('0x40')](_0xd5e7df[_0xc7bf('0x3b')],_0xd5e7df[_0xc7bf('0x3c')]);_0x2d4a6d['attributes']=_[_0xc7bf('0x40')](_0xd5e7df[_0xc7bf('0x3b')],qs['fields'](_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x41')]));_0x2d4a6d[_0xc7bf('0x3f')]=_0x2d4a6d[_0xc7bf('0x3f')][_0xc7bf('0x5c')]?_0x2d4a6d[_0xc7bf('0x3f')]:_0xd5e7df[_0xc7bf('0x3b')];_0x2d4a6d[_0xc7bf('0x43')]=qs[_0xc7bf('0x44')](_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x44')]);_0x2d4a6d[_0xc7bf('0x45')]=qs[_0xc7bf('0x3e')](_[_0xc7bf('0x5d')](_0x787ad3[_0xc7bf('0x3c')],_0xd5e7df[_0xc7bf('0x3e')]));if(_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x46')]){_0x2d4a6d[_0xc7bf('0x45')]=_[_0xc7bf('0x47')](_0x2d4a6d[_0xc7bf('0x45')],{'$or':_['map'](_0x2d4a6d[_0xc7bf('0x3f')],function(_0x568f50){var _0x2d87ec={};_0x2d87ec[_0x568f50]={'$like':'%'+_0x787ad3['query'][_0xc7bf('0x46')]+'%'};return _0x2d87ec;})});}_0x2d4a6d=_[_0xc7bf('0x47')]({},_0x2d4a6d,_0x787ad3[_0xc7bf('0x49')]);return _0x41bbf2[_0xc7bf('0xd8')](_0x2d4a6d);}})[_0xc7bf('0x1a')](function(_0xe86321){if(_0xe86321){_0x35c129=_0xe86321['length'];if(!_0x787ad3['query'][_0xc7bf('0x42')](_0xc7bf('0x63'))){_0x2d4a6d[_0xc7bf('0x27')]=qs[_0xc7bf('0x27')](_0x787ad3['query']['limit']);_0x2d4a6d['offset']=qs[_0xc7bf('0x26')](_0x787ad3[_0xc7bf('0x3c')][_0xc7bf('0x26')]);}return _0x41bbf2[_0xc7bf('0xd8')](_0x2d4a6d);}})[_0xc7bf('0x1a')](function(_0x435cb7){if(_0x435cb7){return _0x435cb7?{'count':_0x35c129,'rows':_0x435cb7}:null;}})[_0xc7bf('0x1a')](respondWithResult(_0x50557e,null))[_0xc7bf('0x21')](handleError(_0x50557e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 6697c0e..66cc630 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 _0xe5e0=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','update'];(function(_0x12b9c3,_0x26bf4b){var _0x388a3c=function(_0x214555){while(--_0x214555){_0x12b9c3['push'](_0x12b9c3['shift']());}};_0x388a3c(++_0x26bf4b);}(_0xe5e0,0x16c));var _0x0e5e=function(_0x36313e,_0x18eaf9){_0x36313e=_0x36313e-0x0;var _0x36f725=_0xe5e0[_0x36313e];return _0x36f725;};'use strict';var EventEmitter=require(_0x0e5e('0x0'));var SmsAccount=require(_0x0e5e('0x1'))['db'][_0x0e5e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e5e('0x3'),'afterDestroy':_0x0e5e('0x4')};function emitEvent(_0xc4009e){return function(_0x210f75,_0x12f4d5,_0x265a7c){SmsAccountEvents[_0x0e5e('0x5')](_0xc4009e+':'+_0x210f75['id'],_0x210f75);SmsAccountEvents['emit'](_0xc4009e,_0x210f75);_0x265a7c(null);};}for(var e in events){if(events[_0x0e5e('0x6')](e)){var event=events[e];SmsAccount[_0x0e5e('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x81a8=['emit','hasOwnProperty','hook','events','SmsAccount','setMaxListeners','save'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x81a8,0x145));var _0x881a=function(_0x30e4c0,_0x58fed1){_0x30e4c0=_0x30e4c0-0x0;var _0x30b6d0=_0x81a8[_0x30e4c0];return _0x30b6d0;};'use strict';var EventEmitter=require(_0x881a('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x881a('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x881a('0x2')](0x0);var events={'afterCreate':_0x881a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432b51){return function(_0x20850b,_0x16d699,_0x3a65d5){SmsAccountEvents[_0x881a('0x4')](_0x432b51+':'+_0x20850b['id'],_0x20850b);SmsAccountEvents['emit'](_0x432b51,_0x20850b);_0x3a65d5(null);};}for(var e in events){if(events[_0x881a('0x5')](e)){var event=events[e];SmsAccount[_0x881a('0x6')](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 e78cc76..ed38423 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 _0xd0bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash','../../config/logger'];(function(_0x7c127b,_0x2471e5){var _0x3fed4d=function(_0x1e9ab1){while(--_0x1e9ab1){_0x7c127b['push'](_0x7c127b['shift']());}};_0x3fed4d(++_0x2471e5);}(_0xd0bf,0x9a));var _0xfd0b=function(_0x327f4e,_0x572066){_0x327f4e=_0x327f4e-0x0;var _0x536d63=_0xd0bf[_0x327f4e];return _0x536d63;};'use strict';var _=require(_0xfd0b('0x0'));var util=require('util');var logger=require(_0xfd0b('0x1'))(_0xfd0b('0x2'));var moment=require(_0xfd0b('0x3'));var BPromise=require(_0xfd0b('0x4'));var rp=require(_0xfd0b('0x5'));var fs=require('fs');var path=require(_0xfd0b('0x6'));var rimraf=require(_0xfd0b('0x7'));var config=require(_0xfd0b('0x8'));var attributes=require(_0xfd0b('0x9'));module[_0xfd0b('0xa')]=function(_0x36dfe1,_0x327baf){return _0x36dfe1['define'](_0xfd0b('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5482=['exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x598b0c,_0x12251f){var _0x24c2b3=function(_0x494c90){while(--_0x494c90){_0x598b0c['push'](_0x598b0c['shift']());}};_0x24c2b3(++_0x12251f);}(_0x5482,0x15f));var _0x2548=function(_0x147c96,_0x309657){_0x147c96=_0x147c96-0x0;var _0x4ec711=_0x5482[_0x147c96];return _0x4ec711;};'use strict';var _=require(_0x2548('0x0'));var util=require(_0x2548('0x1'));var logger=require(_0x2548('0x2'))('api');var moment=require(_0x2548('0x3'));var BPromise=require('bluebird');var rp=require(_0x2548('0x4'));var fs=require('fs');var path=require(_0x2548('0x5'));var rimraf=require(_0x2548('0x6'));var config=require(_0x2548('0x7'));var attributes=require(_0x2548('0x8'));module[_0x2548('0x9')]=function(_0x2a6bff,_0x4dd7f2){return _0x2a6bff['define'](_0x2548('0xa'),attributes,{'tableName':_0x2548('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 4809afe..5838694 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 _0x2469=['localhost','socket.io-emitter','./smsAccount.socket','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis'];(function(_0x3bad67,_0xc272ae){var _0x47a70a=function(_0x19a048){while(--_0x19a048){_0x3bad67['push'](_0x3bad67['shift']());}};_0x47a70a(++_0xc272ae);}(_0x2469,0xb1));var _0x9246=function(_0x23a4f5,_0x2c3b10){_0x23a4f5=_0x23a4f5-0x0;var _0x3b2aa2=_0x2469[_0x23a4f5];return _0x3b2aa2;};'use strict';var _=require(_0x9246('0x0'));var util=require(_0x9246('0x1'));var moment=require(_0x9246('0x2'));var BPromise=require(_0x9246('0x3'));var rs=require(_0x9246('0x4'));var fs=require('fs');var Redis=require(_0x9246('0x5'));var db=require(_0x9246('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9246('0x7'))(_0x9246('0x8'));var config=require(_0x9246('0x9'));var jayson=require(_0x9246('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9246('0xb')](config[_0x9246('0xc')],{'host':_0x9246('0xd'),'port':0x18eb});var socket=require(_0x9246('0xe'))(new Redis(config[_0x9246('0xc')]));require(_0x9246('0xf'))[_0x9246('0x10')](socket);function respondWithRpcPromise(_0x2a761f,_0x58bbf1,_0x3fa4a5){return new BPromise(function(_0x43ec2d,_0x2945f0){return client['request'](_0x2a761f,_0x3fa4a5)['then'](function(_0x3cc57e){logger[_0x9246('0x11')](_0x9246('0x12'),_0x58bbf1,_0x9246('0x13'));logger[_0x9246('0x14')](_0x9246('0x15'),_0x58bbf1,_0x9246('0x13'),JSON[_0x9246('0x16')](_0x3cc57e));if(_0x3cc57e[_0x9246('0x17')]){if(_0x3cc57e['error'][_0x9246('0x18')]===0x1f4){logger[_0x9246('0x17')]('SmsAccount,\x20%s,\x20%s',_0x58bbf1,_0x3cc57e[_0x9246('0x17')][_0x9246('0x19')]);return _0x2945f0(_0x3cc57e[_0x9246('0x17')]['message']);}logger[_0x9246('0x17')](_0x9246('0x12'),_0x58bbf1,_0x3cc57e[_0x9246('0x17')][_0x9246('0x19')]);return _0x43ec2d(_0x3cc57e[_0x9246('0x17')]['message']);}else{logger[_0x9246('0x11')]('SmsAccount,\x20%s,\x20%s',_0x58bbf1,'request\x20sent');_0x43ec2d(_0x3cc57e[_0x9246('0x1a')]['message']);}})[_0x9246('0x1b')](function(_0x478362){logger['error']('SmsAccount,\x20%s,\x20%s',_0x58bbf1,_0x478362);_0x2945f0(_0x478362);});});}exports[_0x9246('0x1c')]=function(_0x36cc27){var _0xf59b0e=this;return new Promise(function(_0x543534,_0x2ed239){return db[_0x9246('0x1d')][_0x9246('0x1e')]({'raw':_0x36cc27['options']?_0x36cc27['options'][_0x9246('0x1f')]===undefined?!![]:![]:!![],'where':_0x36cc27[_0x9246('0x20')]?_0x36cc27['options']['where']||null:null,'attributes':_0x36cc27[_0x9246('0x20')]?_0x36cc27[_0x9246('0x20')][_0x9246('0x21')]||null:null,'include':_0x36cc27[_0x9246('0x20')]?_0x36cc27[_0x9246('0x20')]['include']?_['map'](_0x36cc27[_0x9246('0x20')][_0x9246('0x22')],function(_0x297db5){return{'model':db[_0x297db5[_0x9246('0x23')]],'as':_0x297db5['as'],'attributes':_0x297db5[_0x9246('0x21')],'include':_0x297db5['include']?_[_0x9246('0x24')](_0x297db5[_0x9246('0x22')],function(_0xc4a22e){return{'model':db[_0xc4a22e[_0x9246('0x23')]],'as':_0xc4a22e['as'],'attributes':_0xc4a22e[_0x9246('0x21')],'include':_0xc4a22e[_0x9246('0x22')]?_[_0x9246('0x24')](_0xc4a22e[_0x9246('0x22')],function(_0x2ad8ae){return{'model':db[_0x2ad8ae[_0x9246('0x23')]],'as':_0x2ad8ae['as'],'attributes':_0x2ad8ae[_0x9246('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9246('0x25')](function(_0x196001){logger[_0x9246('0x11')](_0x9246('0x1c'),_0x36cc27);logger[_0x9246('0x14')](_0x9246('0x1c'),_0x36cc27,JSON['stringify'](_0x196001));_0x543534(_0x196001);})[_0x9246('0x1b')](function(_0x113e4f){logger[_0x9246('0x17')](_0x9246('0x1c'),_0x113e4f[_0x9246('0x19')],_0x36cc27);_0x2ed239(_0xf59b0e[_0x9246('0x17')](0x1f4,_0x113e4f[_0x9246('0x19')]));});});}; \ No newline at end of file +var _0x25ee=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','model','map','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x25ee,0x7a));var _0xe25e=function(_0xdb1494,_0x1e5208){_0xdb1494=_0xdb1494-0x0;var _0x505635=_0x25ee[_0xdb1494];return _0x505635;};'use strict';var _=require(_0xe25e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe25e('0x1'));var rs=require(_0xe25e('0x2'));var fs=require('fs');var Redis=require(_0xe25e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe25e('0x4'));var logger=require(_0xe25e('0x5'))(_0xe25e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe25e('0x7')][_0xe25e('0x8')]({'port':0x232a});config[_0xe25e('0x9')]=_['defaults'](config[_0xe25e('0x9')],{'host':_0xe25e('0xa'),'port':0x18eb});var socket=require(_0xe25e('0xb'))(new Redis(config[_0xe25e('0x9')]));require(_0xe25e('0xc'))[_0xe25e('0xd')](socket);function respondWithRpcPromise(_0x5ce1a6,_0x11b947,_0x1d7981){return new BPromise(function(_0x316b3f,_0x98ce5a){return client[_0xe25e('0xe')](_0x5ce1a6,_0x1d7981)[_0xe25e('0xf')](function(_0x55d2ca){logger[_0xe25e('0x10')](_0xe25e('0x11'),_0x11b947,_0xe25e('0x12'));logger[_0xe25e('0x13')](_0xe25e('0x14'),_0x11b947,_0xe25e('0x12'),JSON['stringify'](_0x55d2ca));if(_0x55d2ca[_0xe25e('0x15')]){if(_0x55d2ca['error'][_0xe25e('0x16')]===0x1f4){logger[_0xe25e('0x15')](_0xe25e('0x11'),_0x11b947,_0x55d2ca[_0xe25e('0x15')][_0xe25e('0x17')]);return _0x98ce5a(_0x55d2ca[_0xe25e('0x15')][_0xe25e('0x17')]);}logger[_0xe25e('0x15')]('SmsAccount,\x20%s,\x20%s',_0x11b947,_0x55d2ca[_0xe25e('0x15')][_0xe25e('0x17')]);return _0x316b3f(_0x55d2ca['error']['message']);}else{logger[_0xe25e('0x10')](_0xe25e('0x11'),_0x11b947,_0xe25e('0x12'));_0x316b3f(_0x55d2ca[_0xe25e('0x18')][_0xe25e('0x17')]);}})['catch'](function(_0x39518e){logger[_0xe25e('0x15')](_0xe25e('0x11'),_0x11b947,_0x39518e);_0x98ce5a(_0x39518e);});});}exports[_0xe25e('0x19')]=function(_0x16d2ea){var _0xeffa43=this;return new Promise(function(_0x42037c,_0x1282dd){return db[_0xe25e('0x1a')]['find']({'raw':_0x16d2ea[_0xe25e('0x1b')]?_0x16d2ea['options'][_0xe25e('0x1c')]===undefined?!![]:![]:!![],'where':_0x16d2ea[_0xe25e('0x1b')]?_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1d')]||null:null,'attributes':_0x16d2ea[_0xe25e('0x1b')]?_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1e')]||null:null,'include':_0x16d2ea['options']?_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1f')]?_['map'](_0x16d2ea[_0xe25e('0x1b')][_0xe25e('0x1f')],function(_0x4d2d74){return{'model':db[_0x4d2d74[_0xe25e('0x20')]],'as':_0x4d2d74['as'],'attributes':_0x4d2d74[_0xe25e('0x1e')],'include':_0x4d2d74[_0xe25e('0x1f')]?_[_0xe25e('0x21')](_0x4d2d74[_0xe25e('0x1f')],function(_0x12e501){return{'model':db[_0x12e501[_0xe25e('0x20')]],'as':_0x12e501['as'],'attributes':_0x12e501['attributes'],'include':_0x12e501[_0xe25e('0x1f')]?_[_0xe25e('0x21')](_0x12e501[_0xe25e('0x1f')],function(_0x50d3d3){return{'model':db[_0x50d3d3['model']],'as':_0x50d3d3['as'],'attributes':_0x50d3d3[_0xe25e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0d2f){logger[_0xe25e('0x10')](_0xe25e('0x19'),_0x16d2ea);logger[_0xe25e('0x13')](_0xe25e('0x19'),_0x16d2ea,JSON[_0xe25e('0x22')](_0x1a0d2f));_0x42037c(_0x1a0d2f);})['catch'](function(_0x4fa19d){logger['error']('ShowSmsAccount',_0x4fa19d[_0xe25e('0x17')],_0x16d2ea);_0x1282dd(_0xeffa43[_0xe25e('0x15')](0x1f4,_0x4fa19d[_0xe25e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index fc991dd..30a574c 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 c2dfb9e..9ab6f89 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x1fd7c7,_0x2543e3){var _0x44d7cd=function(_0x3a2b47){while(--_0x3a2b47){_0x1fd7c7['push'](_0x1fd7c7['shift']());}};_0x44d7cd(++_0x2543e3);}(_0x008c,0x188));var _0xc008=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x008c[_0x2d9c6a];return _0xf3c918;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=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(_0x236227,_0x510911){var _0x143f0b=function(_0x4bc967){while(--_0x4bc967){_0x236227['push'](_0x236227['shift']());}};_0x143f0b(++_0x510911);}(_0x55ca,0x126));var _0xa55c=function(_0x5347f1,_0x1122ab){_0x5347f1=_0x5347f1-0x0;var _0x31216d=_0x55ca[_0x5347f1];return _0x31216d;};'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 92f2090..cb847c9 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 _0x8fda=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x8fda,0x113));var _0xa8fd=function(_0x2df0e8,_0x3a4b55){_0x2df0e8=_0x2df0e8-0x0;var _0x41a739=_0x8fda[_0x2df0e8];return _0x41a739;};'use strict';var Sequelize=require(_0xa8fd('0x0'));module[_0xa8fd('0x1')]={'priority':{'type':Sequelize[_0xa8fd('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa8fd('0x3')},'appdata':{'type':Sequelize[_0xa8fd('0x4')]()},'description':{'type':Sequelize[_0xa8fd('0x5')]},'interval':{'type':Sequelize[_0xa8fd('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2c53=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x46bb4d,_0x180dbe){var _0x13a119=function(_0x122ce6){while(--_0x122ce6){_0x46bb4d['push'](_0x46bb4d['shift']());}};_0x13a119(++_0x180dbe);}(_0x2c53,0x1e7));var _0x32c5=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0x2c53[_0x35d775];return _0x59384d;};'use strict';var Sequelize=require(_0x32c5('0x0'));module[_0x32c5('0x1')]={'priority':{'type':Sequelize[_0x32c5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x32c5('0x3')],'allowNull':![],'defaultValue':_0x32c5('0x4')},'appdata':{'type':Sequelize[_0x32c5('0x5')]()},'description':{'type':Sequelize[_0x32c5('0x3')]},'interval':{'type':Sequelize[_0x32c5('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f5ac6f9..1822c53 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 _0xafa9=['model','hasOwnProperty','sort','pick','where','filter','options','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','SmsApplication','rawAttributes','fieldName','map','query','filters','intersection','fields','attributes','length'];(function(_0x3673e0,_0x18a452){var _0x42de36=function(_0x23cce4){while(--_0x23cce4){_0x3673e0['push'](_0x3673e0['shift']());}};_0x42de36(++_0x18a452);}(_0xafa9,0x11b));var _0x9afa=function(_0x200ded,_0x5cfa0e){_0x200ded=_0x200ded-0x0;var _0x4ed4a0=_0xafa9[_0x200ded];return _0x4ed4a0;};'use strict';var emlformat=require(_0x9afa('0x0'));var rimraf=require(_0x9afa('0x1'));var zipdir=require(_0x9afa('0x2'));var jsonpatch=require(_0x9afa('0x3'));var rp=require(_0x9afa('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9afa('0x5'));var sox=require(_0x9afa('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9afa('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9afa('0x8'));var deskjs=require(_0x9afa('0x9'));var toCsv=require(_0x9afa('0xa'));var querystring=require('querystring');var Papa=require(_0x9afa('0xb'));var Redis=require(_0x9afa('0xc'));var authService=require(_0x9afa('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9afa('0xe'));var hardwareService=require(_0x9afa('0xf'));var logger=require(_0x9afa('0x10'))('api');var utils=require(_0x9afa('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9afa('0x12'))['db'];function respondWithStatusCode(_0x329339,_0x91bf99){_0x91bf99=_0x91bf99||0xcc;return function(_0x4004c9){if(_0x4004c9){return _0x329339[_0x9afa('0x13')](_0x91bf99);}return _0x329339[_0x9afa('0x14')](_0x91bf99)['end']();};}function respondWithResult(_0x420b98,_0x2b2bcc){_0x2b2bcc=_0x2b2bcc||0xc8;return function(_0x3dbda4){if(_0x3dbda4){return _0x420b98[_0x9afa('0x14')](_0x2b2bcc)[_0x9afa('0x15')](_0x3dbda4);}};}function respondWithFilteredResult(_0x438a24,_0x573020){return function(_0x48988c){if(_0x48988c){var _0xac10be=typeof _0x573020['offset']===_0x9afa('0x16')&&typeof _0x573020[_0x9afa('0x17')]==='undefined';var _0x36c25d=_0x48988c[_0x9afa('0x18')];var _0x105d92=_0xac10be?0x0:_0x573020[_0x9afa('0x19')];var _0x594c06=_0xac10be?_0x48988c['count']:_0x573020['offset']+_0x573020[_0x9afa('0x17')];var _0x3f5e86;if(_0x594c06>=_0x36c25d){_0x594c06=_0x36c25d;_0x3f5e86=0xc8;}else{_0x3f5e86=0xce;}_0x438a24['status'](_0x3f5e86);return _0x438a24[_0x9afa('0x1a')](_0x9afa('0x1b'),_0x105d92+'-'+_0x594c06+'/'+_0x36c25d)[_0x9afa('0x15')](_0x48988c);}return null;};}function patchUpdates(_0x3c3a66){return function(_0x32d477){try{jsonpatch[_0x9afa('0x1c')](_0x32d477,_0x3c3a66,!![]);}catch(_0x41da67){return BPromise['reject'](_0x41da67);}return _0x32d477[_0x9afa('0x1d')]();};}function saveUpdates(_0x591108,_0x7118b){return function(_0x442d16){if(_0x442d16){return _0x442d16['update'](_0x591108)[_0x9afa('0x1e')](function(_0x21d0c9){return _0x21d0c9;});}return null;};}function removeEntity(_0x43ace8,_0xeecb92){return function(_0x25df45){if(_0x25df45){return _0x25df45[_0x9afa('0x1f')]()[_0x9afa('0x1e')](function(){_0x43ace8[_0x9afa('0x14')](0xcc)[_0x9afa('0x20')]();});}};}function handleEntityNotFound(_0x43c408,_0x3cb5f0){return function(_0x534636){if(!_0x534636){_0x43c408[_0x9afa('0x13')](0x194);}return _0x534636;};}function handleError(_0x3f76a0,_0x5ab26b){_0x5ab26b=_0x5ab26b||0x1f4;return function(_0x3d6b8a){logger[_0x9afa('0x21')](_0x3d6b8a[_0x9afa('0x22')]);if(_0x3d6b8a[_0x9afa('0x23')]){delete _0x3d6b8a[_0x9afa('0x23')];}_0x3f76a0['status'](_0x5ab26b)[_0x9afa('0x24')](_0x3d6b8a);};}exports['index']=function(_0x30a046,_0x48131a){var _0x33904f={},_0x290bf1={},_0x295f9b={'count':0x0,'rows':[]};var _0x234246=_['map'](db[_0x9afa('0x25')][_0x9afa('0x26')],function(_0x512e55){return{'name':_0x512e55[_0x9afa('0x27')],'type':_0x512e55['type']['key']};});_0x290bf1['model']=_[_0x9afa('0x28')](_0x234246,_0x9afa('0x23'));_0x290bf1['query']=_['keys'](_0x30a046[_0x9afa('0x29')]);_0x290bf1[_0x9afa('0x2a')]=_[_0x9afa('0x2b')](_0x290bf1['model'],_0x290bf1[_0x9afa('0x29')]);_0x33904f['attributes']=_[_0x9afa('0x2b')](_0x290bf1['model'],qs['fields'](_0x30a046[_0x9afa('0x29')][_0x9afa('0x2c')]));_0x33904f['attributes']=_0x33904f[_0x9afa('0x2d')][_0x9afa('0x2e')]?_0x33904f['attributes']:_0x290bf1[_0x9afa('0x2f')];if(!_0x30a046[_0x9afa('0x29')][_0x9afa('0x30')]('nolimit')){_0x33904f['limit']=qs[_0x9afa('0x17')](_0x30a046[_0x9afa('0x29')][_0x9afa('0x17')]);_0x33904f[_0x9afa('0x19')]=qs['offset'](_0x30a046[_0x9afa('0x29')]['offset']);}_0x33904f['order']=qs[_0x9afa('0x31')](_0x30a046[_0x9afa('0x29')][_0x9afa('0x31')]);_0x33904f['where']=qs['filters'](_[_0x9afa('0x32')](_0x30a046['query'],_0x290bf1['filters']),_0x234246);if(_0x30a046[_0x9afa('0x29')]['filter']){_0x33904f[_0x9afa('0x33')]=_['merge'](_0x33904f[_0x9afa('0x33')],{'$or':_[_0x9afa('0x28')](_0x234246,function(_0x30f53c){if(_0x30f53c['type']!=='VIRTUAL'){var _0x4817c2={};_0x4817c2[_0x30f53c[_0x9afa('0x23')]]={'$like':'%'+_0x30a046[_0x9afa('0x29')][_0x9afa('0x34')]+'%'};return _0x4817c2;}})});}_0x33904f=_['merge']({},_0x33904f,_0x30a046[_0x9afa('0x35')]);var _0x4a0f36={'where':_0x33904f[_0x9afa('0x33')]};return db['SmsApplication'][_0x9afa('0x18')](_0x4a0f36)[_0x9afa('0x1e')](function(_0x644e01){_0x295f9b['count']=_0x644e01;if(_0x30a046[_0x9afa('0x29')][_0x9afa('0x36')]){_0x33904f[_0x9afa('0x37')]=[{'all':!![]}];}return db[_0x9afa('0x25')][_0x9afa('0x38')](_0x33904f);})['then'](function(_0x15314b){_0x295f9b[_0x9afa('0x39')]=_0x15314b;return _0x295f9b;})[_0x9afa('0x1e')](respondWithFilteredResult(_0x48131a,_0x33904f))[_0x9afa('0x3a')](handleError(_0x48131a,null));};exports['show']=function(_0xd401b3,_0x1a7b49){var _0x4746c5={'raw':!![],'where':{'id':_0xd401b3[_0x9afa('0x3b')]['id']}},_0x3a43cd={};_0x3a43cd[_0x9afa('0x2f')]=_[_0x9afa('0x3c')](db[_0x9afa('0x25')][_0x9afa('0x26')]);_0x3a43cd[_0x9afa('0x29')]=_['keys'](_0xd401b3[_0x9afa('0x29')]);_0x3a43cd[_0x9afa('0x2a')]=_[_0x9afa('0x2b')](_0x3a43cd['model'],_0x3a43cd[_0x9afa('0x29')]);_0x4746c5[_0x9afa('0x2d')]=_[_0x9afa('0x2b')](_0x3a43cd[_0x9afa('0x2f')],qs[_0x9afa('0x2c')](_0xd401b3['query'][_0x9afa('0x2c')]));_0x4746c5[_0x9afa('0x2d')]=_0x4746c5['attributes']['length']?_0x4746c5[_0x9afa('0x2d')]:_0x3a43cd[_0x9afa('0x2f')];if(_0xd401b3[_0x9afa('0x29')]['includeAll']){_0x4746c5['include']=[{'all':!![]}];}_0x4746c5=_[_0x9afa('0x3d')]({},_0x4746c5,_0xd401b3[_0x9afa('0x35')]);return db[_0x9afa('0x25')][_0x9afa('0x3e')](_0x4746c5)[_0x9afa('0x1e')](handleEntityNotFound(_0x1a7b49,null))[_0x9afa('0x1e')](respondWithResult(_0x1a7b49,null))[_0x9afa('0x3a')](handleError(_0x1a7b49,null));};exports[_0x9afa('0x3f')]=function(_0x3e3c62,_0x5c64d1){return db[_0x9afa('0x25')][_0x9afa('0x3f')](_0x3e3c62[_0x9afa('0x40')],{})['then'](respondWithResult(_0x5c64d1,0xc9))['catch'](handleError(_0x5c64d1,null));};exports[_0x9afa('0x41')]=function(_0x510bcf,_0x38446e){if(_0x510bcf[_0x9afa('0x40')]['id']){delete _0x510bcf['body']['id'];}return db['SmsApplication'][_0x9afa('0x3e')]({'where':{'id':_0x510bcf[_0x9afa('0x3b')]['id']}})[_0x9afa('0x1e')](handleEntityNotFound(_0x38446e,null))[_0x9afa('0x1e')](saveUpdates(_0x510bcf['body'],null))[_0x9afa('0x1e')](respondWithResult(_0x38446e,null))['catch'](handleError(_0x38446e,null));};exports[_0x9afa('0x1f')]=function(_0x30c354,_0x24970e){return db[_0x9afa('0x25')][_0x9afa('0x3e')]({'where':{'id':_0x30c354[_0x9afa('0x3b')]['id']}})[_0x9afa('0x1e')](handleEntityNotFound(_0x24970e,null))['then'](removeEntity(_0x24970e,null))[_0x9afa('0x3a')](handleError(_0x24970e,null));}; \ No newline at end of file +var _0xfb37=['VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where'];(function(_0x2afacb,_0x35b4c8){var _0x273c6f=function(_0x4a3379){while(--_0x4a3379){_0x2afacb['push'](_0x2afacb['shift']());}};_0x273c6f(++_0x35b4c8);}(_0xfb37,0x95));var _0x7fb3=function(_0x261931,_0x5b654a){_0x261931=_0x261931-0x0;var _0x11083a=_0xfb37[_0x261931];return _0x11083a;};'use strict';var emlformat=require(_0x7fb3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fb3('0x1'));var jsonpatch=require(_0x7fb3('0x2'));var rp=require(_0x7fb3('0x3'));var moment=require(_0x7fb3('0x4'));var BPromise=require(_0x7fb3('0x5'));var Mustache=require('mustache');var util=require(_0x7fb3('0x6'));var path=require(_0x7fb3('0x7'));var sox=require(_0x7fb3('0x8'));var csv=require('to-csv');var ejs=require(_0x7fb3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7fb3('0xa'));var deskjs=require(_0x7fb3('0xb'));var toCsv=require(_0x7fb3('0xc'));var querystring=require(_0x7fb3('0xd'));var Papa=require(_0x7fb3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fb3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fb3('0x10'))(_0x7fb3('0x11'));var utils=require(_0x7fb3('0x12'));var config=require(_0x7fb3('0x13'));var licenseUtil=require(_0x7fb3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132b62,_0x2b7c4a){_0x2b7c4a=_0x2b7c4a||0xcc;return function(_0x5e1c05){if(_0x5e1c05){return _0x132b62[_0x7fb3('0x15')](_0x2b7c4a);}return _0x132b62[_0x7fb3('0x16')](_0x2b7c4a)[_0x7fb3('0x17')]();};}function respondWithResult(_0xc85944,_0x321970){_0x321970=_0x321970||0xc8;return function(_0x414ee1){if(_0x414ee1){return _0xc85944[_0x7fb3('0x16')](_0x321970)[_0x7fb3('0x18')](_0x414ee1);}};}function respondWithFilteredResult(_0x5cfdaf,_0x1e3dd3){return function(_0x4bcdfd){if(_0x4bcdfd){var _0x46a4bf=typeof _0x1e3dd3['offset']===_0x7fb3('0x19')&&typeof _0x1e3dd3['limit']==='undefined';var _0x15b251=_0x4bcdfd[_0x7fb3('0x1a')];var _0x4f42d7=_0x46a4bf?0x0:_0x1e3dd3['offset'];var _0x1ed2f6=_0x46a4bf?_0x4bcdfd['count']:_0x1e3dd3[_0x7fb3('0x1b')]+_0x1e3dd3['limit'];var _0xd74c65;if(_0x1ed2f6>=_0x15b251){_0x1ed2f6=_0x15b251;_0xd74c65=0xc8;}else{_0xd74c65=0xce;}_0x5cfdaf['status'](_0xd74c65);return _0x5cfdaf[_0x7fb3('0x1c')]('Content-Range',_0x4f42d7+'-'+_0x1ed2f6+'/'+_0x15b251)['json'](_0x4bcdfd);}return null;};}function patchUpdates(_0x1ebdff){return function(_0x47501f){try{jsonpatch[_0x7fb3('0x1d')](_0x47501f,_0x1ebdff,!![]);}catch(_0x59d97b){return BPromise['reject'](_0x59d97b);}return _0x47501f[_0x7fb3('0x1e')]();};}function saveUpdates(_0x16df0b,_0x419280){return function(_0x2252b2){if(_0x2252b2){return _0x2252b2[_0x7fb3('0x1f')](_0x16df0b)[_0x7fb3('0x20')](function(_0x2a914d){return _0x2a914d;});}return null;};}function removeEntity(_0x146a6b,_0x21d91c){return function(_0x4123ca){if(_0x4123ca){return _0x4123ca[_0x7fb3('0x21')]()['then'](function(){_0x146a6b[_0x7fb3('0x16')](0xcc)[_0x7fb3('0x17')]();});}};}function handleEntityNotFound(_0x1ea767,_0x1d3eaf){return function(_0x188c60){if(!_0x188c60){_0x1ea767[_0x7fb3('0x15')](0x194);}return _0x188c60;};}function handleError(_0x224581,_0x3321ca){_0x3321ca=_0x3321ca||0x1f4;return function(_0x483806){logger[_0x7fb3('0x22')](_0x483806[_0x7fb3('0x23')]);if(_0x483806['name']){delete _0x483806[_0x7fb3('0x24')];}_0x224581[_0x7fb3('0x16')](_0x3321ca)[_0x7fb3('0x25')](_0x483806);};}exports['index']=function(_0x1d366b,_0x4088b4){var _0x46d7a1={},_0x4cccb9={},_0x5bec27={'count':0x0,'rows':[]};var _0x1b1ffd=_[_0x7fb3('0x26')](db[_0x7fb3('0x27')][_0x7fb3('0x28')],function(_0x4fadfb){return{'name':_0x4fadfb['fieldName'],'type':_0x4fadfb[_0x7fb3('0x29')][_0x7fb3('0x2a')]};});_0x4cccb9[_0x7fb3('0x2b')]=_[_0x7fb3('0x26')](_0x1b1ffd,_0x7fb3('0x24'));_0x4cccb9[_0x7fb3('0x2c')]=_[_0x7fb3('0x2d')](_0x1d366b[_0x7fb3('0x2c')]);_0x4cccb9['filters']=_[_0x7fb3('0x2e')](_0x4cccb9[_0x7fb3('0x2b')],_0x4cccb9[_0x7fb3('0x2c')]);_0x46d7a1['attributes']=_[_0x7fb3('0x2e')](_0x4cccb9[_0x7fb3('0x2b')],qs[_0x7fb3('0x2f')](_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x2f')]));_0x46d7a1[_0x7fb3('0x30')]=_0x46d7a1[_0x7fb3('0x30')][_0x7fb3('0x31')]?_0x46d7a1['attributes']:_0x4cccb9[_0x7fb3('0x2b')];if(!_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x32')](_0x7fb3('0x33'))){_0x46d7a1[_0x7fb3('0x34')]=qs[_0x7fb3('0x34')](_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x34')]);_0x46d7a1[_0x7fb3('0x1b')]=qs[_0x7fb3('0x1b')](_0x1d366b[_0x7fb3('0x2c')]['offset']);}_0x46d7a1['order']=qs[_0x7fb3('0x35')](_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x35')]);_0x46d7a1['where']=qs[_0x7fb3('0x36')](_[_0x7fb3('0x37')](_0x1d366b[_0x7fb3('0x2c')],_0x4cccb9[_0x7fb3('0x36')]),_0x1b1ffd);if(_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x38')]){_0x46d7a1[_0x7fb3('0x39')]=_['merge'](_0x46d7a1['where'],{'$or':_[_0x7fb3('0x26')](_0x1b1ffd,function(_0x27404e){if(_0x27404e['type']!==_0x7fb3('0x3a')){var _0x1b8db9={};_0x1b8db9[_0x27404e['name']]={'$like':'%'+_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x38')]+'%'};return _0x1b8db9;}})});}_0x46d7a1=_[_0x7fb3('0x3b')]({},_0x46d7a1,_0x1d366b[_0x7fb3('0x3c')]);var _0x1e945a={'where':_0x46d7a1[_0x7fb3('0x39')]};return db[_0x7fb3('0x27')][_0x7fb3('0x1a')](_0x1e945a)['then'](function(_0x23ec2f){_0x5bec27[_0x7fb3('0x1a')]=_0x23ec2f;if(_0x1d366b[_0x7fb3('0x2c')][_0x7fb3('0x3d')]){_0x46d7a1[_0x7fb3('0x3e')]=[{'all':!![]}];}return db[_0x7fb3('0x27')]['findAll'](_0x46d7a1);})[_0x7fb3('0x20')](function(_0x2968ac){_0x5bec27['rows']=_0x2968ac;return _0x5bec27;})[_0x7fb3('0x20')](respondWithFilteredResult(_0x4088b4,_0x46d7a1))[_0x7fb3('0x3f')](handleError(_0x4088b4,null));};exports[_0x7fb3('0x40')]=function(_0x50034d,_0x3e39f5){var _0x28dcd9={'raw':!![],'where':{'id':_0x50034d[_0x7fb3('0x41')]['id']}},_0x1253cd={};_0x1253cd[_0x7fb3('0x2b')]=_[_0x7fb3('0x2d')](db[_0x7fb3('0x27')][_0x7fb3('0x28')]);_0x1253cd[_0x7fb3('0x2c')]=_[_0x7fb3('0x2d')](_0x50034d[_0x7fb3('0x2c')]);_0x1253cd['filters']=_['intersection'](_0x1253cd['model'],_0x1253cd[_0x7fb3('0x2c')]);_0x28dcd9[_0x7fb3('0x30')]=_[_0x7fb3('0x2e')](_0x1253cd[_0x7fb3('0x2b')],qs[_0x7fb3('0x2f')](_0x50034d[_0x7fb3('0x2c')][_0x7fb3('0x2f')]));_0x28dcd9[_0x7fb3('0x30')]=_0x28dcd9[_0x7fb3('0x30')][_0x7fb3('0x31')]?_0x28dcd9[_0x7fb3('0x30')]:_0x1253cd['model'];if(_0x50034d[_0x7fb3('0x2c')][_0x7fb3('0x3d')]){_0x28dcd9['include']=[{'all':!![]}];}_0x28dcd9=_[_0x7fb3('0x3b')]({},_0x28dcd9,_0x50034d[_0x7fb3('0x3c')]);return db['SmsApplication'][_0x7fb3('0x42')](_0x28dcd9)['then'](handleEntityNotFound(_0x3e39f5,null))[_0x7fb3('0x20')](respondWithResult(_0x3e39f5,null))[_0x7fb3('0x3f')](handleError(_0x3e39f5,null));};exports[_0x7fb3('0x43')]=function(_0x24597d,_0x1b6b2a){return db['SmsApplication'][_0x7fb3('0x43')](_0x24597d[_0x7fb3('0x44')],{})[_0x7fb3('0x20')](respondWithResult(_0x1b6b2a,0xc9))[_0x7fb3('0x3f')](handleError(_0x1b6b2a,null));};exports[_0x7fb3('0x1f')]=function(_0x251cee,_0xeef60b){if(_0x251cee[_0x7fb3('0x44')]['id']){delete _0x251cee[_0x7fb3('0x44')]['id'];}return db[_0x7fb3('0x27')][_0x7fb3('0x42')]({'where':{'id':_0x251cee[_0x7fb3('0x41')]['id']}})['then'](handleEntityNotFound(_0xeef60b,null))['then'](saveUpdates(_0x251cee[_0x7fb3('0x44')],null))[_0x7fb3('0x20')](respondWithResult(_0xeef60b,null))[_0x7fb3('0x3f')](handleError(_0xeef60b,null));};exports['destroy']=function(_0x37c023,_0x28be53){return db[_0x7fb3('0x27')][_0x7fb3('0x42')]({'where':{'id':_0x37c023['params']['id']}})['then'](handleEntityNotFound(_0x28be53,null))[_0x7fb3('0x20')](removeEntity(_0x28be53,null))[_0x7fb3('0x3f')](handleError(_0x28be53,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 57c94ad..ff7b429 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 _0xc222=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','sms_applications','utf8mb4_unicode_ci','lodash'];(function(_0x51708f,_0x511834){var _0x5c60a3=function(_0x29fbec){while(--_0x29fbec){_0x51708f['push'](_0x51708f['shift']());}};_0x5c60a3(++_0x511834);}(_0xc222,0x144));var _0x2c22=function(_0x1a4a0d,_0x3ad2ff){_0x1a4a0d=_0x1a4a0d-0x0;var _0x48efee=_0xc222[_0x1a4a0d];return _0x48efee;};'use strict';var _=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var logger=require(_0x2c22('0x2'))(_0x2c22('0x3'));var moment=require(_0x2c22('0x4'));var BPromise=require(_0x2c22('0x5'));var rp=require(_0x2c22('0x6'));var fs=require('fs');var path=require(_0x2c22('0x7'));var rimraf=require(_0x2c22('0x8'));var config=require(_0x2c22('0x9'));var attributes=require('./smsApplication.attributes');module[_0x2c22('0xa')]=function(_0x27d248,_0x4174b3){return _0x27d248['define']('SmsApplication',attributes,{'tableName':_0x2c22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2c22('0xc')});}; \ No newline at end of file +var _0xa584=['define','SmsApplication','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x4799d1,_0x282b9a){var _0x982e58=function(_0x1dab92){while(--_0x1dab92){_0x4799d1['push'](_0x4799d1['shift']());}};_0x982e58(++_0x282b9a);}(_0xa584,0x163));var _0x4a58=function(_0x4f856c,_0x3d5ced){_0x4f856c=_0x4f856c-0x0;var _0x52e036=_0xa584[_0x4f856c];return _0x52e036;};'use strict';var _=require('lodash');var util=require(_0x4a58('0x0'));var logger=require(_0x4a58('0x1'))(_0x4a58('0x2'));var moment=require(_0x4a58('0x3'));var BPromise=require(_0x4a58('0x4'));var rp=require(_0x4a58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a58('0x6'));var attributes=require('./smsApplication.attributes');module[_0x4a58('0x7')]=function(_0x5d78f6,_0x62455b){return _0x5d78f6[_0x4a58('0x8')](_0x4a58('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a58('0xa'),'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 9e2b8a2..aeb6963 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 _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9ab8,0x81));var _0x89ab=function(_0xee9246,_0x4509e1){_0xee9246=_0xee9246-0x0;var _0x5e4289=_0x9ab8[_0xee9246];return _0x5e4289;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('SmsApplication,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file +var _0xcf3d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x52af56,_0x27ca65){var _0x63fbaa=function(_0x276d1c){while(--_0x276d1c){_0x52af56['push'](_0x52af56['shift']());}};_0x63fbaa(++_0x27ca65);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x44febe,_0x378a00){_0x44febe=_0x44febe-0x0;var _0x18aa9b=_0xcf3d[_0x44febe];return _0x18aa9b;};'use strict';var _=require(_0xdcf3('0x0'));var util=require(_0xdcf3('0x1'));var moment=require(_0xdcf3('0x2'));var BPromise=require(_0xdcf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcf3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdcf3('0x5'));var logger=require(_0xdcf3('0x6'))(_0xdcf3('0x7'));var config=require(_0xdcf3('0x8'));var jayson=require(_0xdcf3('0x9'));var client=jayson[_0xdcf3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43f8d5,_0x47dde8,_0x2cd0af){return new BPromise(function(_0x45c5bd,_0x55fe3a){return client['request'](_0x43f8d5,_0x2cd0af)['then'](function(_0x4515a2){logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));logger[_0xdcf3('0xe')](_0xdcf3('0xf'),_0x47dde8,_0xdcf3('0xd'),JSON[_0xdcf3('0x10')](_0x4515a2));if(_0x4515a2[_0xdcf3('0x11')]){if(_0x4515a2['error'][_0xdcf3('0x12')]===0x1f4){logger[_0xdcf3('0x11')]('SmsApplication,\x20%s,\x20%s',_0x47dde8,_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);return _0x55fe3a(_0x4515a2[_0xdcf3('0x11')][_0xdcf3('0x13')]);}logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x4515a2[_0xdcf3('0x11')]['message']);return _0x45c5bd(_0x4515a2[_0xdcf3('0x11')]['message']);}else{logger[_0xdcf3('0xb')](_0xdcf3('0xc'),_0x47dde8,_0xdcf3('0xd'));_0x45c5bd(_0x4515a2[_0xdcf3('0x14')]['message']);}})[_0xdcf3('0x15')](function(_0x24cce5){logger['error'](_0xdcf3('0xc'),_0x47dde8,_0x24cce5);_0x55fe3a(_0x24cce5);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fe4d124..80ca97d 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 _0xac4a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','describe','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x138440,_0x385943){var _0x35204d=function(_0x192766){while(--_0x192766){_0x138440['push'](_0x138440['shift']());}};_0x35204d(++_0x385943);}(_0xac4a,0x13f));var _0xaac4=function(_0x1e2bf2,_0x137000){_0x1e2bf2=_0x1e2bf2-0x0;var _0x2a8780=_0xac4a[_0x1e2bf2];return _0x2a8780;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x15')),controller[_0xaac4('0x16')]);router[_0xaac4('0x17')](_0xaac4('0x18'),auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x19')),controller[_0xaac4('0x1a')]);router[_0xaac4('0x1b')]('/:id',auth[_0xaac4('0x9')](),interaction['tracked'](_0xaac4('0x14'),'smsinteraction:destroy'),controller[_0xaac4('0x1c')]);router[_0xaac4('0x1b')](_0xaac4('0x1d'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x1e')]);module[_0xaac4('0x1f')]=router; \ No newline at end of file +var _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x1381bf,_0x11b131){var _0x36ef59=function(_0x22a68b){while(--_0x22a68b){_0x1381bf['push'](_0x1381bf['shift']());}};_0x36ef59(++_0x11b131);}(_0xb10b,0x12a));var _0xbb10=function(_0x93c171,_0x2b3a4c){_0x93c171=_0x93c171-0x0;var _0x4970d9=_0xb10b[_0x93c171];return _0x4970d9;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d41422c..74b098d 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 _0xb1d3=['STRING','ENUM','out','BOOLEAN','sequelize','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x2951ce,_0x303ca1){_0x2951ce=_0x2951ce-0x0;var _0x53bd9f=_0xb1d3[_0x2951ce];return _0x53bd9f;};'use strict';var Sequelize=require(_0x3b1d('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3b1d('0x1')]},'disposition':{'type':Sequelize[_0x3b1d('0x2')]},'secondDisposition':{'type':Sequelize[_0x3b1d('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3b1d('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3b1d('0x2')]},'read1stAt':{'type':Sequelize[_0x3b1d('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x3b1d('0x3')]('in',_0x3b1d('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3b1d('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3b1d('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x6dfa=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6dfa,0x7b));var _0xa6df=function(_0x4b8bf5,_0x4aea7e){_0x4b8bf5=_0x4b8bf5-0x0;var _0xd7bc51=_0x6dfa[_0x4b8bf5];return _0xd7bc51;};'use strict';var Sequelize=require(_0xa6df('0x0'));var moment=require(_0xa6df('0x1'));module[_0xa6df('0x2')]={'closed':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa6df('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa6df('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa6df('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa6df('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa6df('0x6')]('in',_0xa6df('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa6df('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c29b5af..ee06aeb 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 _0xba28=['stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','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?','buildExpression','body','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','user','agent','toString','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','catch','show','params','SmsInteraction','includeAll','include','merge','options','create','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','get','N.A.','disposition','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','sendStatus','eml-format','fast-json-patch','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xba28,0xc8));var _0x8ba2=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xba28[_0x265aa2];return _0x447a3a;};'use strict';var emlformat=require(_0x8ba2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8ba2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8ba2('0x2'));var Mustache=require(_0x8ba2('0x3'));var util=require(_0x8ba2('0x4'));var path=require(_0x8ba2('0x5'));var sox=require(_0x8ba2('0x6'));var csv=require(_0x8ba2('0x7'));var ejs=require(_0x8ba2('0x8'));var fs=require('fs');var fs_extra=require(_0x8ba2('0x9'));var _=require(_0x8ba2('0xa'));var squel=require(_0x8ba2('0xb'));var crypto=require(_0x8ba2('0xc'));var jsforce=require(_0x8ba2('0xd'));var deskjs=require(_0x8ba2('0xe'));var toCsv=require(_0x8ba2('0x7'));var querystring=require(_0x8ba2('0xf'));var Papa=require(_0x8ba2('0x10'));var Redis=require('ioredis');var authService=require(_0x8ba2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ba2('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8ba2('0x13'));var config=require(_0x8ba2('0x14'));var licenseUtil=require(_0x8ba2('0x15'));var db=require(_0x8ba2('0x16'))['db'];config[_0x8ba2('0x17')]=_[_0x8ba2('0x18')](config[_0x8ba2('0x17')],{'host':_0x8ba2('0x19'),'port':0x18eb});var socket=require(_0x8ba2('0x1a'))(new Redis(config[_0x8ba2('0x17')]));require(_0x8ba2('0x1b'))['register'](socket);function respondWithStatusCode(_0x28f092,_0x3d049d){_0x3d049d=_0x3d049d||0xcc;return function(_0x4ac794){if(_0x4ac794){return _0x28f092['sendStatus'](_0x3d049d);}return _0x28f092[_0x8ba2('0x1c')](_0x3d049d)[_0x8ba2('0x1d')]();};}function respondWithResult(_0x4c5b3e,_0x15b1b8){_0x15b1b8=_0x15b1b8||0xc8;return function(_0x576ab5){if(_0x576ab5){return _0x4c5b3e['status'](_0x15b1b8)[_0x8ba2('0x1e')](_0x576ab5);}};}function respondWithFilteredResult(_0x195613,_0x3ec644){return function(_0x2b1d01){if(_0x2b1d01){var _0xe173d5=typeof _0x3ec644[_0x8ba2('0x1f')]===_0x8ba2('0x20')&&typeof _0x3ec644[_0x8ba2('0x21')]===_0x8ba2('0x20');var _0x883f6c=_0x2b1d01[_0x8ba2('0x22')];var _0x169185=_0xe173d5?0x0:_0x3ec644[_0x8ba2('0x1f')];var _0x5f8ec1=_0xe173d5?_0x2b1d01['count']:_0x3ec644['offset']+_0x3ec644[_0x8ba2('0x21')];var _0x27e799;if(_0x5f8ec1>=_0x883f6c){_0x5f8ec1=_0x883f6c;_0x27e799=0xc8;}else{_0x27e799=0xce;}_0x195613[_0x8ba2('0x1c')](_0x27e799);return _0x195613[_0x8ba2('0x23')](_0x8ba2('0x24'),_0x169185+'-'+_0x5f8ec1+'/'+_0x883f6c)[_0x8ba2('0x1e')](_0x2b1d01);}return null;};}function patchUpdates(_0x307eb8){return function(_0x4744d7){try{jsonpatch[_0x8ba2('0x25')](_0x4744d7,_0x307eb8,!![]);}catch(_0xcfd6d4){return BPromise[_0x8ba2('0x26')](_0xcfd6d4);}return _0x4744d7[_0x8ba2('0x27')]();};}function saveUpdates(_0x3a7483,_0x16601e){return function(_0x4a09b9){if(_0x4a09b9){return _0x4a09b9['update'](_0x3a7483)[_0x8ba2('0x28')](function(_0x26bbe0){return _0x26bbe0;});}return null;};}function removeEntity(_0x4d79aa,_0x52778c){return function(_0x31284a){if(_0x31284a){return _0x31284a['destroy']()[_0x8ba2('0x28')](function(){_0x4d79aa[_0x8ba2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe998a6,_0x23297b){return function(_0x142ce1){if(!_0x142ce1){_0xe998a6['sendStatus'](0x194);}return _0x142ce1;};}function handleError(_0x2df274,_0x224f9c){_0x224f9c=_0x224f9c||0x1f4;return function(_0xc31ca0){logger[_0x8ba2('0x29')](_0xc31ca0[_0x8ba2('0x2a')]);if(_0xc31ca0[_0x8ba2('0x2b')]){delete _0xc31ca0[_0x8ba2('0x2b')];}_0x2df274[_0x8ba2('0x1c')](_0x224f9c)[_0x8ba2('0x2c')](_0xc31ca0);};}function getInteractionUsers(_0x413ccd,_0x1d3207){return new BPromise(function(_0x574bbc,_0x139ca8){try{if(_0x1d3207[_0x413ccd['id']]){_0x413ccd[_0x8ba2('0x2d')]=_[_0x8ba2('0x2e')](_0x1d3207[_0x413ccd['id']],function(_0x4ea3c9){return{'id':_0x4ea3c9['id'],'fullname':_0x4ea3c9[_0x8ba2('0x2f')]};});}}catch(_0x2b57a0){_0x139ca8(_0x2b57a0);}_0x574bbc(_0x413ccd);});}function getInteractionTags(_0x51ed14,_0x32ad2c){return new BPromise(function(_0x2cc644,_0x4da00e){try{if(_0x51ed14['TagIds']){_0x51ed14[_0x8ba2('0x30')]=[];_0x51ed14[_0x8ba2('0x31')][_0x8ba2('0x32')](',')[_0x8ba2('0x33')](function(_0x25be38){_0x51ed14[_0x8ba2('0x30')][_0x8ba2('0x34')](_0x32ad2c[_0x25be38]);});}delete _0x51ed14[_0x8ba2('0x31')];}catch(_0x29b7ae){_0x4da00e(_0x29b7ae);}_0x2cc644(_0x51ed14);});}function updateSmsInteraction(_0x1d8c1b,_0xb222,_0xae81fd){return new BPromise(function(_0x593480,_0x1b5682){return getInteractionUsers(_0x1d8c1b,_0xae81fd)[_0x8ba2('0x28')](function(_0x1e0d25){return getInteractionTags(_0x1e0d25,_0xb222);})[_0x8ba2('0x28')](function(_0x292a3d){return getStateInteraction(_0x292a3d);})[_0x8ba2('0x28')](function(_0x1a4cb1){_0x593480(_0x1a4cb1);})['catch'](function(_0xf9695d){_0x1b5682(_0xf9695d);});});}function getStateInteraction(_0x3da00f){return new BPromise(function(_0x25d470){_0x3da00f[_0x8ba2('0x35')]=0x0;_0x3da00f[_0x8ba2('0x36')]=0x0;_0x3da00f[_0x8ba2('0x37')]=0x0;_0x3da00f[_0x8ba2('0x38')]=0x0;_0x3da00f[_0x8ba2('0x39')]=0x0;if(!_0x3da00f[_0x8ba2('0x3a')]&&!_0x3da00f[_0x8ba2('0x3b')]){_0x3da00f[_0x8ba2('0x35')]+=0x1;}if(!_0x3da00f[_0x8ba2('0x3a')]&&_0x3da00f[_0x8ba2('0x3b')]){_0x3da00f[_0x8ba2('0x36')]+=0x1;if(_0x3da00f[_0x8ba2('0x35')]){_0x3da00f[_0x8ba2('0x35')]-=0x1;}}if(_0x3da00f[_0x8ba2('0x3a')]&&_0x3da00f[_0x8ba2('0x3b')]){_0x3da00f[_0x8ba2('0x37')]+=0x1;if(_0x3da00f[_0x8ba2('0x36')]){_0x3da00f[_0x8ba2('0x36')]-=0x1;}}if(_0x3da00f[_0x8ba2('0x3a')]&&!_0x3da00f['UserId']){_0x3da00f['unmanaged']+=0x1;if(_0x3da00f[_0x8ba2('0x35')]){_0x3da00f['waiting']-=0x1;}}_0x3da00f[_0x8ba2('0x39')]+=0x1;_0x25d470(_0x3da00f);});}exports[_0x8ba2('0x3c')]=function(_0x1baf0b,_0x2efe16){var _0x232b6d={},_0x47dc01={},_0xe8c207={'count':0x0,'rows':[]};var _0x5ecba1=_[_0x8ba2('0x2e')](db['SmsInteraction'][_0x8ba2('0x3d')],function(_0x46186d){return{'name':_0x46186d[_0x8ba2('0x3e')],'type':_0x46186d['type']['key']};});_0x47dc01[_0x8ba2('0x3f')]=_[_0x8ba2('0x2e')](_0x5ecba1,_0x8ba2('0x2b'));_0x47dc01[_0x8ba2('0x40')]=_[_0x8ba2('0x41')](_0x1baf0b[_0x8ba2('0x40')]);_0x47dc01['filters']=_['intersection'](_0x47dc01['model'],_0x47dc01[_0x8ba2('0x40')]);_0x232b6d[_0x8ba2('0x42')]=_[_0x8ba2('0x43')](_0x47dc01[_0x8ba2('0x3f')],qs[_0x8ba2('0x44')](_0x1baf0b[_0x8ba2('0x40')]['fields']));_0x232b6d['attributes']=_0x232b6d[_0x8ba2('0x42')][_0x8ba2('0x45')]?_0x232b6d[_0x8ba2('0x42')]:_0x47dc01[_0x8ba2('0x3f')];if(!_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x46')](_0x8ba2('0x47'))){_0x232b6d[_0x8ba2('0x21')]=qs[_0x8ba2('0x21')](_0x1baf0b['query'][_0x8ba2('0x21')]);_0x232b6d['offset']=qs[_0x8ba2('0x1f')](_0x1baf0b['query'][_0x8ba2('0x1f')]);}_0x232b6d[_0x8ba2('0x48')]=qs[_0x8ba2('0x49')](_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x49')]);_0x232b6d[_0x8ba2('0x4a')]=qs[_0x8ba2('0x4b')](_[_0x8ba2('0x4c')](_0x1baf0b[_0x8ba2('0x40')],_0x47dc01['filters']),_0x5ecba1);var _0x219a19=[];var _0x1df8f6=squel['select']()[_0x8ba2('0x4d')]('id')['field'](_0x8ba2('0x2b'))[_0x8ba2('0x4d')](_0x8ba2('0x4e'))[_0x8ba2('0x4f')](_0x8ba2('0x50'));var _0x3ec868=squel[_0x8ba2('0x51')]()[_0x8ba2('0x4d')](_0x8ba2('0x52'))[_0x8ba2('0x4d')](_0x8ba2('0x53'))[_0x8ba2('0x4d')]('ui.SmsInteractionId')['from'](_0x8ba2('0x54'),'ui')['left_join']('users','u',_0x8ba2('0x55'));var _0x3bf317=squel['select']()[_0x8ba2('0x4f')](_0x8ba2('0x56'),'i')[_0x8ba2('0x57')]('cm_contacts','c',_0x8ba2('0x58'))[_0x8ba2('0x57')](_0x8ba2('0x59'),'o',_0x8ba2('0x5a'))['left_join'](_0x8ba2('0x5b'),'a',_0x8ba2('0x5c'))[_0x8ba2('0x57')]('sms_messages','me',_0x8ba2('0x5d'))['left_join'](_0x8ba2('0x5e'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x8ba2('0x57')](_0x8ba2('0x50'),'t',_0x8ba2('0x5f'));var _0x4b011e=squel[_0x8ba2('0x60')]();var _0x53dd4e=[];var _0x6c960c=squel[_0x8ba2('0x60')]();var _0x268087;if(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x61')]){_0x268087=as[_0x8ba2('0x62')](_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x61')]);var _0x59c18c=_0x268087['sqlOperator'];for(var _0x1455d0=0x0;_0x1455d0<_0x268087[_0x8ba2('0x63')]['length'];_0x1455d0++){var _0x6205f4=_0x268087[_0x8ba2('0x63')][_0x1455d0];var _0xe6353c='i';var _0x4def86=_[_0x8ba2('0x64')](_0x5ecba1,[_0x8ba2('0x2b'),_0x6205f4[_0x8ba2('0x4d')]]);if(!_0x4def86){switch(_0x6205f4[_0x8ba2('0x4d')]){case _0x8ba2('0x65'):if(_0x6205f4[_0x8ba2('0x66')]==0x1){_0x3bf317[_0x8ba2('0x67')]('`'+_0x6205f4['field']+_0x8ba2('0x68'));}else{_0x3bf317[_0x8ba2('0x67')]('`'+_0x6205f4['field']+_0x8ba2('0x69'));}break;case _0x8ba2('0x6a'):if(_0x6205f4[_0x8ba2('0x6b')]===_0x8ba2('0x6c')){if(_0x6205f4['value']['split']('\x20')['length']>0x1){_0x4b011e[_0x59c18c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ba2('0x6d')](_0x6205f4['value']),null);}else{var _0x9be435='%'+_0x6205f4[_0x8ba2('0x66')]+'%';_0x4b011e[_0x59c18c](_0x8ba2('0x6e'),_0x9be435,_0x9be435,_0x9be435);}}else{_0x4def86=_[_0x8ba2('0x64')](_0x5ecba1,['name',_0x8ba2('0x6f')]);_0x6205f4[_0x8ba2('0x4d')]=_0x8ba2('0x6f');_0x5c997e=as['buildExpression'](_0xe6353c,_0x4def86[_0x8ba2('0x70')],_0x6205f4);_0x4b011e[_0x59c18c](_0x5c997e[_0x8ba2('0x71')],_0x5c997e[_0x8ba2('0x66')][_0x8ba2('0x72')],_0x5c997e[_0x8ba2('0x66')]['end']);}break;case _0x8ba2('0x73'):var _0x242ddf=_0x6205f4[_0x8ba2('0x66')][_0x8ba2('0x32')](',')['map'](function(_0x1fc6cf){return Number(_0x1fc6cf);});_0x242ddf[_0x8ba2('0x33')](function(_0x4d44e4){_0x6c960c['or'](_0x8ba2('0x74'),'%,'+_0x4d44e4+',%');});_0x53dd4e=_[_0x8ba2('0x75')](_0x53dd4e,_0x242ddf);break;case _0x8ba2('0x76'):if(_0x6205f4[_0x8ba2('0x6b')]===_0x8ba2('0x6c')){_0x4b011e[_0x59c18c](_0x8ba2('0x77'),'%'+_0x6205f4[_0x8ba2('0x66')]+'%',null);}else{_0x4def86=_[_0x8ba2('0x64')](_0x5ecba1,[_0x8ba2('0x2b'),_0x8ba2('0x3b')]);_0x6205f4[_0x8ba2('0x4d')]='UserId';_0x5c997e=as[_0x8ba2('0x78')](_0xe6353c,_0x4def86['type'],_0x6205f4);_0x4b011e[_0x59c18c](_0x5c997e[_0x8ba2('0x71')],_0x5c997e[_0x8ba2('0x66')]['start'],_0x5c997e[_0x8ba2('0x66')]['end']);}break;case _0x8ba2('0x79'):_0x5c997e=as['buildExpression']('me',null,_0x6205f4);_0x4b011e[_0x59c18c](_0x5c997e[_0x8ba2('0x71')],_0x5c997e['value'][_0x8ba2('0x72')],_0x5c997e[_0x8ba2('0x66')][_0x8ba2('0x1d')]);break;}}else{var _0x5c997e=as[_0x8ba2('0x78')](_0xe6353c,_0x4def86[_0x8ba2('0x70')],_0x6205f4);_0x4b011e[_0x59c18c](_0x5c997e[_0x8ba2('0x71')],_0x5c997e[_0x8ba2('0x66')][_0x8ba2('0x72')],_0x5c997e[_0x8ba2('0x66')]['end']);}}}else{var _0x11fb05=_(_0x1baf0b[_0x8ba2('0x40')])[_0x8ba2('0x41')]()[_0x8ba2('0x2e')](function(_0x321d0d){return _[_0x8ba2('0x7a')](_0x5ecba1,[_0x8ba2('0x2b'),_0x321d0d])?_0x321d0d:undefined;})[_0x8ba2('0x7b')]()[_0x8ba2('0x66')]();if(!_[_0x8ba2('0x7c')](_0x11fb05)){_0x11fb05[_0x8ba2('0x33')](function(_0x584bbc){if(_0x584bbc==='SmsAccountId'){_0x3bf317['where'](_0x8ba2('0x7d'),[][_0x8ba2('0x7e')](_0x1baf0b['query'][_0x584bbc]));}else if(_0x584bbc===_0x8ba2('0x7f')){var _0x3fb2f8=JSON[_0x8ba2('0x80')](_0x1baf0b[_0x8ba2('0x40')][_0x584bbc])['$gte'];var _0x16bf8b=JSON[_0x8ba2('0x80')](_0x1baf0b[_0x8ba2('0x40')][_0x584bbc])[_0x8ba2('0x81')];_0x3bf317[_0x8ba2('0x4a')](_0x8ba2('0x82'),_0x3fb2f8,_0x16bf8b);}else{if(_0x1baf0b[_0x8ba2('0x40')][_0x584bbc]===_0x8ba2('0x83')){_0x3bf317[_0x8ba2('0x4a')]('i.'+_0x584bbc+_0x8ba2('0x84'));}else{_0x3bf317['where']('i.'+_0x584bbc+_0x8ba2('0x85'),_0x1baf0b['query'][_0x584bbc]);}}});}if(_0x1baf0b['query']['read']){if(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x86')]==0x1){_0x3bf317[_0x8ba2('0x67')](_0x8ba2('0x87'));}else{_0x3bf317[_0x8ba2('0x67')](_0x8ba2('0x88'));}}if(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x89')]){_0x53dd4e=_['isArray'](_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x89')])?_0x1baf0b[_0x8ba2('0x40')]['tag']:new Array(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x89')]);_0x53dd4e[_0x8ba2('0x33')](function(_0x151213){_0x6c960c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x151213+',%');});}if(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x8a')]){var _0x48455a=_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x8a')][_0x8ba2('0x8b')]('\x5c','\x5c\x5c')[_0x8ba2('0x8b')](/'/g,'\x27\x27');if(qs[_0x8ba2('0x8c')](_0x48455a)){_0x4b011e['or'](_0x8ba2('0x8d'),_0x48455a+'%')['or'](_0x8ba2('0x8e'),_0x48455a+'%');}else{_0x4b011e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ba2('0x6d')](_0x48455a))['or'](_0x8ba2('0x8f'),_0x48455a+'%');}}}_0x3bf317[_0x8ba2('0x4a')](_0x4b011e);_0x3bf317[_0x8ba2('0x90')](_0x8ba2('0x91'));var _0x36c5f8={'type':db[_0x8ba2('0x92')][_0x8ba2('0x93')]['SELECT'],'raw':!![]};var _0x4e966e=_0x3bf317[_0x8ba2('0x94')]();_0x4e966e['field'](_0x8ba2('0x91'));_0x4e966e[_0x8ba2('0x4d')](_0x8ba2('0x95'),_0x8ba2('0x65'));if(_0x232b6d[_0x8ba2('0x48')]){_0x232b6d[_0x8ba2('0x48')][_0x8ba2('0x33')](function(_0x3840b5){var _0x1aa537=_0x3840b5[0x0]===_0x8ba2('0x96')?_0x3840b5[0x0]:'i.'+_0x3840b5[0x0];_0x3bf317['order'](_0x1aa537,_0x3840b5[0x1]===_0x8ba2('0x97')?![]:!![]);});}if(!_[_0x8ba2('0x7c')](_0x53dd4e)){_0x3bf317[_0x8ba2('0x67')](_0x6c960c);_0x4e966e[_0x8ba2('0x4a')](_0x8ba2('0x98'),_0x53dd4e);}BPromise[_0x8ba2('0x99')]()['then'](function(){if(!_0x268087){if(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x9a')])return;_0x4e966e['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3bf317[_0x8ba2('0x4a')](_0x8ba2('0x9b'));return;}if(_0x1baf0b['user'][_0x8ba2('0x9c')]!=='agent')return;return _0x1baf0b['user'][_0x8ba2('0x9d')]({'attributes':['id'],'raw':!![]})[_0x8ba2('0x28')](function(_0xc126af){if(_[_0x8ba2('0x7c')](_0xc126af)){_0x4e966e['where'](_0x8ba2('0x9e'));_0x3bf317[_0x8ba2('0x4a')](_0x8ba2('0x9e'));}else{_0x4e966e[_0x8ba2('0x4a')](_0x8ba2('0x7d'),_[_0x8ba2('0x2e')](_0xc126af,'id'));_0x3bf317['where'](_0x8ba2('0x7d'),_[_0x8ba2('0x2e')](_0xc126af,'id'));}});})[_0x8ba2('0x28')](function(){if(_0x1baf0b[_0x8ba2('0x9f')]['role']===_0x8ba2('0xa0')&&!_0x268087&&!_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x9a')])return[];return db['sequelize']['query'](_0x4e966e[_0x8ba2('0xa1')](),_0x36c5f8);})[_0x8ba2('0x28')](function(_0x1157ce){_0xe8c207['count']=_0x1157ce['length'];if(_0xe8c207[_0x8ba2('0x22')]===0x0)return[];return db[_0x8ba2('0xa2')][_0x8ba2('0x40')](_0x1df8f6[_0x8ba2('0xa1')](),_0x36c5f8)['then'](function(_0x52e064){_0x219a19=_[_0x8ba2('0xa3')](_0x52e064,'id');_0x36c5f8=_['merge'](_0x36c5f8,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1baf0b[_0x8ba2('0x40')][_0x8ba2('0x44')]){_0x232b6d['attributes'][_0x8ba2('0x33')](function(_0x24db3f){_0x3bf317['field']('i.'+_0x24db3f);});}else{_0x3bf317[_0x8ba2('0x4d')](_0x8ba2('0x95'),_0x8ba2('0x65'));_0x3bf317[_0x8ba2('0x4d')](_0x8ba2('0xa4'),'Account.key');_0x3bf317['field'](_0x8ba2('0xa5'),_0x8ba2('0xa6'));_0x3bf317[_0x8ba2('0x4d')]('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',_0x8ba2('0x96'));_0x3bf317['field'](_0x8ba2('0xa7'));_0x3bf317[_0x8ba2('0x4d')]('c.firstName',_0x8ba2('0xa8'));_0x3bf317['field'](_0x8ba2('0xa9'),_0x8ba2('0xaa'));_0x3bf317[_0x8ba2('0x4d')]('c.email',_0x8ba2('0xab'));_0x3bf317[_0x8ba2('0x4d')]('c.phone',_0x8ba2('0xac'));_0x3bf317['field'](_0x8ba2('0xad'),'Contact.mobile');_0x3bf317[_0x8ba2('0x4d')](_0x8ba2('0xae'),_0x8ba2('0xaf'));_0x3bf317['field'](_0x8ba2('0xb0'),_0x8ba2('0xb1'));_0x3bf317['field'](_0x8ba2('0xb2'),_0x8ba2('0xb3'));_0x3bf317['field'](_0x8ba2('0xb4'),_0x8ba2('0x31'));}if(_0x232b6d[_0x8ba2('0x21')])_0x3bf317[_0x8ba2('0x21')](_0x232b6d[_0x8ba2('0x21')]);if(_0x232b6d[_0x8ba2('0x1f')])_0x3bf317[_0x8ba2('0x1f')](_0x232b6d[_0x8ba2('0x1f')]);return db['sequelize']['query'](_0x3bf317[_0x8ba2('0xa1')](),_0x36c5f8);})[_0x8ba2('0x28')](function(_0x2a85ef){if(_0x2a85ef[_0x8ba2('0x45')]>0x0)_0x3ec868[_0x8ba2('0x4a')](_0x8ba2('0xb5'),_[_0x8ba2('0x2e')](_0x2a85ef,'id'));return db[_0x8ba2('0xa2')]['query'](_0x3ec868[_0x8ba2('0xa1')](),_0x36c5f8)[_0x8ba2('0x28')](function(_0x400566){var _0x5a5ca9=_[_0x8ba2('0xb6')](_0x400566,_0x8ba2('0xb7'));var _0x188569=[];_0x2a85ef[_0x8ba2('0x33')](function(_0x39b34f){_0x188569[_0x8ba2('0x34')](updateSmsInteraction(_0x39b34f,_0x219a19,_0x5a5ca9));});return BPromise['all'](_0x188569);});});})[_0x8ba2('0x28')](function(_0xf72000){_0xe8c207[_0x8ba2('0xb8')]=_0xf72000;return _0xe8c207;})[_0x8ba2('0x28')](respondWithFilteredResult(_0x2efe16,_0x232b6d))[_0x8ba2('0xb9')](handleError(_0x2efe16,null));};exports[_0x8ba2('0xba')]=function(_0x2cc689,_0x1f0675){var _0x3e847d={'raw':![],'where':{'id':_0x2cc689[_0x8ba2('0xbb')]['id']}},_0x393209={};_0x393209['model']=_[_0x8ba2('0x41')](db[_0x8ba2('0xbc')][_0x8ba2('0x3d')]);_0x393209[_0x8ba2('0x40')]=_[_0x8ba2('0x41')](_0x2cc689[_0x8ba2('0x40')]);_0x393209['filters']=_[_0x8ba2('0x43')](_0x393209['model'],_0x393209['query']);_0x3e847d[_0x8ba2('0x42')]=_['intersection'](_0x393209['model'],qs[_0x8ba2('0x44')](_0x2cc689[_0x8ba2('0x40')][_0x8ba2('0x44')]));_0x3e847d['attributes']=_0x3e847d['attributes'][_0x8ba2('0x45')]?_0x3e847d[_0x8ba2('0x42')]:_0x393209['model'];if(_0x2cc689[_0x8ba2('0x40')][_0x8ba2('0xbd')]){_0x3e847d[_0x8ba2('0xbe')]=[{'all':!![]}];}_0x3e847d=_[_0x8ba2('0xbf')]({},_0x3e847d,_0x2cc689[_0x8ba2('0xc0')]);return db['SmsInteraction'][_0x8ba2('0x64')](_0x3e847d)[_0x8ba2('0x28')](handleEntityNotFound(_0x1f0675,null))[_0x8ba2('0x28')](respondWithResult(_0x1f0675,null))[_0x8ba2('0xb9')](handleError(_0x1f0675,null));};exports[_0x8ba2('0xc1')]=function(_0x3a5450,_0x3e1ce7){return db[_0x8ba2('0xbc')][_0x8ba2('0xc1')](_0x3a5450['body'],{})['then'](respondWithResult(_0x3e1ce7,0xc9))[_0x8ba2('0xb9')](handleError(_0x3e1ce7,null));};exports['update']=function(_0x378524,_0x49175e){if(_0x378524['body']['id']){delete _0x378524[_0x8ba2('0x79')]['id'];}return db['SmsInteraction'][_0x8ba2('0x64')]({'where':{'id':_0x378524['params']['id']}})[_0x8ba2('0x28')](handleEntityNotFound(_0x49175e,null))[_0x8ba2('0x28')](saveUpdates(_0x378524[_0x8ba2('0x79')],null))[_0x8ba2('0x28')](respondWithResult(_0x49175e,null))['catch'](handleError(_0x49175e,null));};exports[_0x8ba2('0xc2')]=function(_0x5ad482,_0x2297de){return db[_0x8ba2('0xbc')][_0x8ba2('0x64')]({'where':{'id':_0x5ad482['params']['id']}})[_0x8ba2('0x28')](handleEntityNotFound(_0x2297de,null))[_0x8ba2('0x28')](removeEntity(_0x2297de,null))['catch'](handleError(_0x2297de,null));};exports['describe']=function(_0x15768b,_0xcdfdee){return db[_0x8ba2('0xbc')][_0x8ba2('0xc3')]()['then'](respondWithResult(_0xcdfdee,null))[_0x8ba2('0xb9')](handleError(_0xcdfdee,null));};exports[_0x8ba2('0xc4')]=function(_0x35aa42,_0x273def,_0x319641){return db[_0x8ba2('0xc5')][_0x8ba2('0x64')]({'where':{'id':_0x35aa42[_0x8ba2('0xbb')]['id']}})[_0x8ba2('0x28')](handleEntityNotFound(_0x273def,null))[_0x8ba2('0x28')](function(_0x9eb4f5){if(_0x9eb4f5){return _0x9eb4f5['addMessage'](_0x35aa42[_0x8ba2('0x79')][_0x8ba2('0xc6')],_[_0x8ba2('0xc7')](_0x35aa42[_0x8ba2('0x79')],['ids','id'])||{});}})[_0x8ba2('0x28')](respondWithResult(_0x273def,null))[_0x8ba2('0xb9')](handleError(_0x273def,null));};exports[_0x8ba2('0xc8')]=function(_0x595d5b,_0x51963a,_0x3dfa04){var _0x3d53a8={'raw':![],'where':{}};var _0x226266={};var _0x35b454={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8ba2('0xc9')]({'where':{'id':_0x595d5b[_0x8ba2('0xbb')]['id']}})['then'](handleEntityNotFound(_0x51963a,null))[_0x8ba2('0x28')](function(_0x34353b){if(_0x34353b){_0x226266[_0x8ba2('0x3f')]=_[_0x8ba2('0x41')](db[_0x8ba2('0xc5')]['rawAttributes']);_0x226266['query']=_[_0x8ba2('0x41')](_0x595d5b[_0x8ba2('0x40')]);_0x226266['filters']=_[_0x8ba2('0x43')](_0x226266[_0x8ba2('0x3f')],_0x226266[_0x8ba2('0x40')]);_0x3d53a8[_0x8ba2('0x42')]=_[_0x8ba2('0x43')](_0x226266[_0x8ba2('0x3f')],qs['fields'](_0x595d5b[_0x8ba2('0x40')]['fields']));_0x3d53a8[_0x8ba2('0x42')]=_0x3d53a8[_0x8ba2('0x42')][_0x8ba2('0x45')]?_0x3d53a8[_0x8ba2('0x42')]:_0x226266['model'];if(!_0x595d5b[_0x8ba2('0x40')]['hasOwnProperty'](_0x8ba2('0x47'))){_0x3d53a8[_0x8ba2('0x21')]=qs[_0x8ba2('0x21')](_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0x21')]);_0x3d53a8[_0x8ba2('0x1f')]=qs[_0x8ba2('0x1f')](_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0x1f')]);}_0x3d53a8[_0x8ba2('0x48')]=qs[_0x8ba2('0x49')](_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0x49')]);_0x3d53a8['where']=qs[_0x8ba2('0x4b')](_['pick'](_0x595d5b[_0x8ba2('0x40')],_0x226266['filters']));_0x3d53a8[_0x8ba2('0x4a')][_0x8ba2('0xb7')]=_0x34353b['id'];if(_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0x8a')]){_0x3d53a8[_0x8ba2('0x4a')]=_[_0x8ba2('0xbf')](_0x3d53a8[_0x8ba2('0x4a')],{'$or':_[_0x8ba2('0x2e')](_0x3d53a8[_0x8ba2('0x42')],function(_0x21760a){var _0x5bf2c7={};_0x5bf2c7[_0x21760a]={'$like':'%'+_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0x8a')]+'%'};return _0x5bf2c7;})});}if(_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0xca')]){var _0x573514=_0x595d5b[_0x8ba2('0x40')][_0x8ba2('0xca')][_0x8ba2('0x32')](',');var _0x367d9a={};_0x367d9a[_0x573514[0x0]]={'$gte':moment(_0x573514[0x1])[_0x8ba2('0xcb')](_0x8ba2('0xcc'))};_0x3d53a8[_0x8ba2('0x4a')]=_[_0x8ba2('0xbf')](_0x3d53a8['where'],_0x367d9a);}_0x3d53a8=_[_0x8ba2('0xbf')]({},_0x3d53a8,_0x595d5b['options']);return db[_0x8ba2('0xc5')][_0x8ba2('0x22')]({'where':_0x3d53a8['where']})[_0x8ba2('0x28')](function(_0x2f920f){_0x35b454['count']=_0x2f920f;if(_0x595d5b['query'][_0x8ba2('0xbd')]){_0x3d53a8[_0x8ba2('0xbe')]=[{'all':!![]}];}return db[_0x8ba2('0xc5')]['findAll'](_0x3d53a8);})[_0x8ba2('0x28')](function(_0x4defa6){_0x35b454['rows']=_0x4defa6;return _0x35b454;});}})['then'](respondWithFilteredResult(_0x51963a,_0x3d53a8))[_0x8ba2('0xb9')](handleError(_0x51963a,null));};exports[_0x8ba2('0xcd')]=function(_0x52583c,_0x1b335e,_0x523677){return db[_0x8ba2('0xbc')]['find']({'where':{'id':_0x52583c[_0x8ba2('0xbb')]['id']}})[_0x8ba2('0x28')](handleEntityNotFound(_0x1b335e,null))[_0x8ba2('0x28')](function(_0xe70249){if(_0xe70249){return _0xe70249[_0x8ba2('0xce')](_0x52583c[_0x8ba2('0x79')][_0x8ba2('0xc6')],_[_0x8ba2('0xc7')](_0x52583c[_0x8ba2('0x79')],[_0x8ba2('0xc6'),'id'])||{})['spread'](function(){return db[_0x8ba2('0x73')][_0x8ba2('0xcf')]({'attributes':['id','name',_0x8ba2('0x4e')],'where':{'id':_0x52583c[_0x8ba2('0x79')]['ids']}});})[_0x8ba2('0x28')](function(_0x17fb51){socket[_0x8ba2('0xd0')](_0x8ba2('0xd1'),{'id':Number(_0x52583c[_0x8ba2('0xbb')]['id']),'tags':_0x17fb51||[]});return{'id':Number(_0x52583c[_0x8ba2('0xbb')]['id']),'tags':_0x17fb51||[]};});}})[_0x8ba2('0x28')](respondWithResult(_0x1b335e,null))[_0x8ba2('0xb9')](handleError(_0x1b335e,null));};exports[_0x8ba2('0xd2')]=function(_0xad84,_0xd9f42c,_0x90286f){return db[_0x8ba2('0xbc')][_0x8ba2('0x64')]({'where':{'id':_0xad84[_0x8ba2('0xbb')]['id']}})[_0x8ba2('0x28')](handleEntityNotFound(_0xd9f42c,null))['then'](function(_0x46923b){if(_0x46923b){return _0x46923b[_0x8ba2('0xd2')](_0xad84['query'][_0x8ba2('0xc6')]);}})[_0x8ba2('0x28')](respondWithStatusCode(_0xd9f42c,null))['catch'](handleError(_0xd9f42c,null));};exports[_0x8ba2('0xd3')]=function(_0x365d52,_0x53ca09){var _0x4a7ad3=moment()[_0x8ba2('0xd4')]()[_0x8ba2('0xa1')]();var _0x5ea290=path[_0x8ba2('0xd5')](config[_0x8ba2('0xd6')],_0x8ba2('0xd7'),_0x8ba2('0xd8'),'tmp');var _0x16ddb8=path[_0x8ba2('0xd5')](config['root'],_0x8ba2('0xd7'),_0x8ba2('0xd8'),_0x8ba2('0xd9'));var _0xed2f75=path[_0x8ba2('0xd5')](_0x5ea290,_0x4a7ad3);var _0x21e2df=util['format'](_0x8ba2('0xda'),_0x365d52['params']['id'],_0x4a7ad3);var _0xe3981f=path[_0x8ba2('0xd5')](_0x5ea290,_0x21e2df);var _0x23d02b=[];_0x23d02b['push']({'model':db[_0x8ba2('0x76')],'as':_0x8ba2('0x76'),'attributes':['id',_0x8ba2('0x2f')],'raw':!![]});_0x23d02b[_0x8ba2('0x34')]({'model':db[_0x8ba2('0xdb')],'as':'Contact','attributes':['id',_0x8ba2('0xdc'),_0x8ba2('0xdd')],'raw':!![]});var _0xd4bb41=[{'model':db[_0x8ba2('0xc5')],'as':_0x8ba2('0xde'),'attributes':['id',_0x8ba2('0x79'),_0x8ba2('0x7f'),_0x8ba2('0xdf'),_0x8ba2('0xe0'),'read'],'include':_0x23d02b}];_0xd4bb41[_0x8ba2('0x34')]({'model':db[_0x8ba2('0xe1')],'as':_0x8ba2('0xe2'),'attributes':['id',_0x8ba2('0x2b')]});_0xd4bb41[_0x8ba2('0x34')]({'model':db['User'],'as':_0x8ba2('0xe3'),'attributes':['id',_0x8ba2('0x2f')]});return db[_0x8ba2('0xbc')][_0x8ba2('0x64')]({'where':{'id':_0x365d52[_0x8ba2('0xbb')]['id']},'include':_0xd4bb41})['then'](handleEntityNotFound(_0x53ca09,null))[_0x8ba2('0x28')](function(_0xcaa9a){if(_0xcaa9a){var _0x29eef9=_0xcaa9a[_0x8ba2('0xe4')]({'plain':!![]});fs['mkdirSync'](_0xed2f75);var _0x312303={'channel':'Sms','account':_0x29eef9[_0x8ba2('0xe2')][_0x8ba2('0x2b')],'agent':_0x29eef9[_0x8ba2('0xe3')]?_0x29eef9[_0x8ba2('0xe3')]['fullname']:_0x8ba2('0xe5'),'createdAt':moment(_0x29eef9[_0x8ba2('0x7f')])[_0x8ba2('0xcb')](_0x8ba2('0xcc'))['toString'](),'closedAt':_0x29eef9['closed']?moment(_0x29eef9['closedAt'])['format'](_0x8ba2('0xcc'))[_0x8ba2('0xa1')]():'','disposition':_0x29eef9[_0x8ba2('0xe6')],'messages':_(_0x29eef9[_0x8ba2('0xde')])[_0x8ba2('0x8a')]({'secret':![]})['map'](function(_0x35ed9a){return{'date':moment(_0x35ed9a[_0x8ba2('0x7f')])[_0x8ba2('0xcb')](_0x8ba2('0xcc'))[_0x8ba2('0xa1')](),'sender':_0x35ed9a[_0x8ba2('0xdf')]===_0x8ba2('0xe7')?_0x35ed9a[_0x8ba2('0x76')]?_0x35ed9a['User'][_0x8ba2('0x2f')]:_0x8ba2('0xe8'):_0x35ed9a[_0x8ba2('0x6a')][_0x8ba2('0xdc')]+(_0x35ed9a[_0x8ba2('0x6a')][_0x8ba2('0xdd')]?'\x20'+_0x35ed9a[_0x8ba2('0x6a')][_0x8ba2('0xdd')]:''),'body':_0x35ed9a['body'],'direction':_0x35ed9a['direction']===_0x8ba2('0xe7')?'A':'C','secret':_0x35ed9a[_0x8ba2('0xe0')],'read':_0x35ed9a[_0x8ba2('0x86')]};})['value']()};return ejs[_0x8ba2('0xe9')](path['join'](config[_0x8ba2('0xd6')],'server',_0x8ba2('0xea'),_0x8ba2('0xeb')),{'interaction':_0x312303})[_0x8ba2('0x28')](function(_0x5ce940){var _0x5675be=path[_0x8ba2('0xd5')](_0xed2f75,_0x8ba2('0xec')+_0x29eef9['id']+'-'+_0x4a7ad3+_0x8ba2('0xed'));var _0x2ea7ef={'path':_0x5675be,'channel':_0x8ba2('0xee'),'interactionId':_0x29eef9['id']};return pdf[_0x8ba2('0xef')](_0x5ce940,_0x2ea7ef);})['then'](function(){return new BPromise(function(_0x3a14cc,_0x1d5b2c){zipdir(_0xed2f75,{'saveTo':_0xe3981f},function(_0x480da7,_0x59f517){if(_0x480da7)return _0x1d5b2c(_0x480da7);return _0x3a14cc(_0x59f517);});})[_0x8ba2('0x28')](function(){return new BPromise(function(_0x16f672,_0x25c3a5){rimraf(_0xed2f75,function(_0x5bd21f){if(_0x5bd21f)_0x25c3a5(_0x5bd21f);return _0x16f672();});});})[_0x8ba2('0x28')](function(){return _0x53ca09[_0x8ba2('0xd3')](_0xe3981f,_0x21e2df,function(_0x44f217){if(_0x44f217){console[_0x8ba2('0xf0')]('err',_0x44f217);}else{fs['unlinkSync'](_0xe3981f);}});});});}else{return _0x53ca09[_0x8ba2('0xf1')](0xc8);}})[_0x8ba2('0xb9')](handleError(_0x53ca09,null));}; \ No newline at end of file +var _0x48a9=['unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','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','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','count','merge','SmsInteraction','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','SmsInteractionId','all','rows','show','filters','include','create','body','update','params','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','addTags','setTags','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','fullname','CmContact','firstName','Messages','direction','SmsAccount','Account','mkdirSync','Sms','Owner','N.A.','closedAt','out','System','lastName','secret','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../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','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','set','apply','reject','save','destroy','then','error','stack','send','TagIds','Tags','split','forEach','push','catch','waiting','total','closed','UserId','talking','answered','unmanaged','map','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','order','sort','pick','select','color','from','tools_tags','field','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0x48a9,0x8a));var _0x948a=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x48a9[_0x289e64];return _0x30246c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x948a('0x0'));var zipdir=require(_0x948a('0x1'));var jsonpatch=require(_0x948a('0x2'));var rp=require(_0x948a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x948a('0x4'));var util=require(_0x948a('0x5'));var path=require(_0x948a('0x6'));var sox=require(_0x948a('0x7'));var csv=require(_0x948a('0x8'));var ejs=require(_0x948a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x948a('0xa'));var squel=require(_0x948a('0xb'));var crypto=require('crypto');var jsforce=require(_0x948a('0xc'));var deskjs=require(_0x948a('0xd'));var toCsv=require(_0x948a('0x8'));var querystring=require(_0x948a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x948a('0xf'));var qs=require(_0x948a('0x10'));var as=require(_0x948a('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x948a('0x12'))(_0x948a('0x13'));var utils=require(_0x948a('0x14'));var config=require(_0x948a('0x15'));var licenseUtil=require(_0x948a('0x16'));var db=require('../../mysqldb')['db'];config[_0x948a('0x17')]=_[_0x948a('0x18')](config[_0x948a('0x17')],{'host':_0x948a('0x19'),'port':0x18eb});var socket=require(_0x948a('0x1a'))(new Redis(config['redis']));require(_0x948a('0x1b'))[_0x948a('0x1c')](socket);function respondWithStatusCode(_0xa9b8e3,_0x432541){_0x432541=_0x432541||0xcc;return function(_0x1a8c8d){if(_0x1a8c8d){return _0xa9b8e3[_0x948a('0x1d')](_0x432541);}return _0xa9b8e3[_0x948a('0x1e')](_0x432541)['end']();};}function respondWithResult(_0x40179b,_0x18147f){_0x18147f=_0x18147f||0xc8;return function(_0x229bcb){if(_0x229bcb){return _0x40179b[_0x948a('0x1e')](_0x18147f)[_0x948a('0x1f')](_0x229bcb);}};}function respondWithFilteredResult(_0x4cc4e1,_0x4b9fe3){return function(_0x55e3d0){if(_0x55e3d0){var _0xd04a81=typeof _0x4b9fe3[_0x948a('0x20')]==='undefined'&&typeof _0x4b9fe3[_0x948a('0x21')]==='undefined';var _0xbda1f2=_0x55e3d0['count'];var _0x504c5c=_0xd04a81?0x0:_0x4b9fe3[_0x948a('0x20')];var _0x188e43=_0xd04a81?_0x55e3d0['count']:_0x4b9fe3['offset']+_0x4b9fe3[_0x948a('0x21')];var _0x3f6c7c;if(_0x188e43>=_0xbda1f2){_0x188e43=_0xbda1f2;_0x3f6c7c=0xc8;}else{_0x3f6c7c=0xce;}_0x4cc4e1['status'](_0x3f6c7c);return _0x4cc4e1[_0x948a('0x22')]('Content-Range',_0x504c5c+'-'+_0x188e43+'/'+_0xbda1f2)[_0x948a('0x1f')](_0x55e3d0);}return null;};}function patchUpdates(_0x4e1f14){return function(_0x393c73){try{jsonpatch[_0x948a('0x23')](_0x393c73,_0x4e1f14,!![]);}catch(_0x5592fb){return BPromise[_0x948a('0x24')](_0x5592fb);}return _0x393c73[_0x948a('0x25')]();};}function saveUpdates(_0x3efdca,_0x5db9fe){return function(_0x508f17){if(_0x508f17){return _0x508f17['update'](_0x3efdca)['then'](function(_0x2645cd){return _0x2645cd;});}return null;};}function removeEntity(_0x108d73,_0x3e1373){return function(_0x4d4dc2){if(_0x4d4dc2){return _0x4d4dc2[_0x948a('0x26')]()[_0x948a('0x27')](function(){_0x108d73['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d727,_0x402637){return function(_0xa967b0){if(!_0xa967b0){_0x52d727[_0x948a('0x1d')](0x194);}return _0xa967b0;};}function handleError(_0x5cae37,_0xc91c91){_0xc91c91=_0xc91c91||0x1f4;return function(_0x2a2433){logger[_0x948a('0x28')](_0x2a2433[_0x948a('0x29')]);if(_0x2a2433['name']){delete _0x2a2433['name'];}_0x5cae37[_0x948a('0x1e')](_0xc91c91)[_0x948a('0x2a')](_0x2a2433);};}function getInteractionUsers(_0xaf2c78,_0x43bd0f){return new BPromise(function(_0x1f8e6e,_0x164d74){try{if(_0x43bd0f[_0xaf2c78['id']]){_0xaf2c78['Users']=_['map'](_0x43bd0f[_0xaf2c78['id']],function(_0x1bc64a){return{'id':_0x1bc64a['id'],'fullname':_0x1bc64a['fullname']};});}}catch(_0x3e53ee){_0x164d74(_0x3e53ee);}_0x1f8e6e(_0xaf2c78);});}function getInteractionTags(_0x32f0c3,_0x57ee58){return new BPromise(function(_0x4e2403,_0x31db30){try{if(_0x32f0c3[_0x948a('0x2b')]){_0x32f0c3[_0x948a('0x2c')]=[];_0x32f0c3[_0x948a('0x2b')][_0x948a('0x2d')](',')[_0x948a('0x2e')](function(_0x45f65d){_0x32f0c3[_0x948a('0x2c')][_0x948a('0x2f')](_0x57ee58[_0x45f65d]);});}delete _0x32f0c3[_0x948a('0x2b')];}catch(_0x40ae50){_0x31db30(_0x40ae50);}_0x4e2403(_0x32f0c3);});}function updateSmsInteraction(_0x2f7d97,_0x2ac228,_0x16601e){return new BPromise(function(_0x32339c,_0x40e18d){return getInteractionUsers(_0x2f7d97,_0x16601e)[_0x948a('0x27')](function(_0x568e12){return getInteractionTags(_0x568e12,_0x2ac228);})['then'](function(_0x2f8807){return getStateInteraction(_0x2f8807);})[_0x948a('0x27')](function(_0x27ea38){_0x32339c(_0x27ea38);})[_0x948a('0x30')](function(_0x38e43f){_0x40e18d(_0x38e43f);});});}function getStateInteraction(_0x900ef6){return new BPromise(function(_0x48fdfa){_0x900ef6[_0x948a('0x31')]=0x0;_0x900ef6['talking']=0x0;_0x900ef6['answered']=0x0;_0x900ef6['unmanaged']=0x0;_0x900ef6[_0x948a('0x32')]=0x0;if(!_0x900ef6[_0x948a('0x33')]&&!_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x31')]+=0x1;}if(!_0x900ef6['closed']&&_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x35')]+=0x1;if(_0x900ef6['waiting']){_0x900ef6[_0x948a('0x31')]-=0x1;}}if(_0x900ef6['closed']&&_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x36')]+=0x1;if(_0x900ef6[_0x948a('0x35')]){_0x900ef6[_0x948a('0x35')]-=0x1;}}if(_0x900ef6[_0x948a('0x33')]&&!_0x900ef6[_0x948a('0x34')]){_0x900ef6[_0x948a('0x37')]+=0x1;if(_0x900ef6[_0x948a('0x31')]){_0x900ef6[_0x948a('0x31')]-=0x1;}}_0x900ef6[_0x948a('0x32')]+=0x1;_0x48fdfa(_0x900ef6);});}exports['index']=function(_0x16924b,_0x1bbe38){var _0x26e308={},_0x26fb0c={},_0x553e03={'count':0x0,'rows':[]};var _0xa38c6a=_[_0x948a('0x38')](db['SmsInteraction'][_0x948a('0x39')],function(_0x1980d1){return{'name':_0x1980d1[_0x948a('0x3a')],'type':_0x1980d1[_0x948a('0x3b')]['key']};});_0x26fb0c[_0x948a('0x3c')]=_['map'](_0xa38c6a,_0x948a('0x3d'));_0x26fb0c[_0x948a('0x3e')]=_[_0x948a('0x3f')](_0x16924b[_0x948a('0x3e')]);_0x26fb0c['filters']=_[_0x948a('0x40')](_0x26fb0c[_0x948a('0x3c')],_0x26fb0c[_0x948a('0x3e')]);_0x26e308[_0x948a('0x41')]=_[_0x948a('0x40')](_0x26fb0c[_0x948a('0x3c')],qs[_0x948a('0x42')](_0x16924b[_0x948a('0x3e')][_0x948a('0x42')]));_0x26e308[_0x948a('0x41')]=_0x26e308[_0x948a('0x41')][_0x948a('0x43')]?_0x26e308[_0x948a('0x41')]:_0x26fb0c[_0x948a('0x3c')];if(!_0x16924b[_0x948a('0x3e')]['hasOwnProperty']('nolimit')){_0x26e308[_0x948a('0x21')]=qs[_0x948a('0x21')](_0x16924b[_0x948a('0x3e')][_0x948a('0x21')]);_0x26e308[_0x948a('0x20')]=qs[_0x948a('0x20')](_0x16924b[_0x948a('0x3e')][_0x948a('0x20')]);}_0x26e308[_0x948a('0x44')]=qs[_0x948a('0x45')](_0x16924b[_0x948a('0x3e')][_0x948a('0x45')]);_0x26e308['where']=qs['filters'](_[_0x948a('0x46')](_0x16924b['query'],_0x26fb0c['filters']),_0xa38c6a);var _0x522ea2=[];var _0x1c3f84=squel[_0x948a('0x47')]()['field']('id')['field']('name')['field'](_0x948a('0x48'))[_0x948a('0x49')](_0x948a('0x4a'));var _0x14404a=squel[_0x948a('0x47')]()[_0x948a('0x4b')](_0x948a('0x4c'))[_0x948a('0x4b')](_0x948a('0x4d'))['field'](_0x948a('0x4e'))['from'](_0x948a('0x4f'),'ui')[_0x948a('0x50')]('users','u',_0x948a('0x51'));var _0x3b2cf1=squel[_0x948a('0x47')]()[_0x948a('0x49')]('sms_interactions','i')[_0x948a('0x50')](_0x948a('0x52'),'c',_0x948a('0x53'))['left_join'](_0x948a('0x54'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x948a('0x55'),'a',_0x948a('0x56'))[_0x948a('0x50')](_0x948a('0x57'),'me',_0x948a('0x58'))[_0x948a('0x50')](_0x948a('0x59'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x948a('0x50')](_0x948a('0x4a'),'t',_0x948a('0x5a'));var _0x4ad6d7=squel[_0x948a('0x5b')]();var _0x22af35=[];var _0x373e93=squel['expr']();var _0x50f17f;if(_0x16924b[_0x948a('0x3e')]['search']){_0x50f17f=as[_0x948a('0x5c')](_0x16924b[_0x948a('0x3e')][_0x948a('0x5d')]);var _0x5325f2=_0x50f17f['sqlOperator'];for(var _0x55755e=0x0;_0x55755e<_0x50f17f['conditions'][_0x948a('0x43')];_0x55755e++){var _0x364b5b=_0x50f17f['conditions'][_0x55755e];var _0x4c8273='i';var _0x556ac4=_['find'](_0xa38c6a,[_0x948a('0x3d'),_0x364b5b[_0x948a('0x4b')]]);if(!_0x556ac4){switch(_0x364b5b['field']){case _0x948a('0x5e'):if(_0x364b5b[_0x948a('0x5f')]==0x1){_0x3b2cf1[_0x948a('0x60')]('`'+_0x364b5b['field']+_0x948a('0x61'));}else{_0x3b2cf1['having']('`'+_0x364b5b[_0x948a('0x4b')]+_0x948a('0x62'));}break;case _0x948a('0x63'):if(_0x364b5b[_0x948a('0x64')]===_0x948a('0x65')){if(_0x364b5b['value'][_0x948a('0x2d')]('\x20')[_0x948a('0x43')]>0x1){_0x4ad6d7[_0x5325f2](_0x948a('0x66'),qs['getFullTextValue'](_0x364b5b['value']),null);}else{var _0x57c8c7='%'+_0x364b5b[_0x948a('0x5f')]+'%';_0x4ad6d7[_0x5325f2](_0x948a('0x67'),_0x57c8c7,_0x57c8c7,_0x57c8c7);}}else{_0x556ac4=_[_0x948a('0x68')](_0xa38c6a,['name',_0x948a('0x69')]);_0x364b5b[_0x948a('0x4b')]='ContactId';_0x5a73d6=as[_0x948a('0x6a')](_0x4c8273,_0x556ac4[_0x948a('0x3b')],_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6[_0x948a('0x6b')],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6c')],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);}break;case _0x948a('0x6e'):var _0x4c5eaa=_0x364b5b[_0x948a('0x5f')][_0x948a('0x2d')](',')[_0x948a('0x38')](function(_0x2d4b92){return Number(_0x2d4b92);});_0x4c5eaa['forEach'](function(_0x4c7975){_0x373e93['or'](_0x948a('0x6f'),'%,'+_0x4c7975+',%');});_0x22af35=_[_0x948a('0x70')](_0x22af35,_0x4c5eaa);break;case _0x948a('0x71'):if(_0x364b5b[_0x948a('0x64')]===_0x948a('0x65')){_0x4ad6d7[_0x5325f2](_0x948a('0x72'),'%'+_0x364b5b['value']+'%',null);}else{_0x556ac4=_[_0x948a('0x68')](_0xa38c6a,[_0x948a('0x3d'),_0x948a('0x34')]);_0x364b5b[_0x948a('0x4b')]='UserId';_0x5a73d6=as[_0x948a('0x6a')](_0x4c8273,_0x556ac4[_0x948a('0x3b')],_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6[_0x948a('0x6b')],_0x5a73d6[_0x948a('0x5f')]['start'],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);}break;case'body':_0x5a73d6=as[_0x948a('0x6a')]('me',null,_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6[_0x948a('0x6b')],_0x5a73d6[_0x948a('0x5f')]['start'],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);break;}}else{var _0x5a73d6=as[_0x948a('0x6a')](_0x4c8273,_0x556ac4[_0x948a('0x3b')],_0x364b5b);_0x4ad6d7[_0x5325f2](_0x5a73d6['text'],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6c')],_0x5a73d6[_0x948a('0x5f')][_0x948a('0x6d')]);}}}else{var _0x55d30a=_(_0x16924b[_0x948a('0x3e')])[_0x948a('0x3f')]()[_0x948a('0x38')](function(_0x1d5c45){return _[_0x948a('0x73')](_0xa38c6a,[_0x948a('0x3d'),_0x1d5c45])?_0x1d5c45:undefined;})[_0x948a('0x74')]()[_0x948a('0x5f')]();if(!_[_0x948a('0x75')](_0x55d30a)){_0x55d30a[_0x948a('0x2e')](function(_0x2ab9c3){if(_0x2ab9c3===_0x948a('0x76')){_0x3b2cf1[_0x948a('0x77')](_0x948a('0x78'),[]['concat'](_0x16924b[_0x948a('0x3e')][_0x2ab9c3]));}else if(_0x2ab9c3===_0x948a('0x79')){var _0x40f3fe=JSON['parse'](_0x16924b[_0x948a('0x3e')][_0x2ab9c3])['$gte'];var _0x130136=JSON[_0x948a('0x7a')](_0x16924b[_0x948a('0x3e')][_0x2ab9c3])[_0x948a('0x7b')];_0x3b2cf1[_0x948a('0x77')](_0x948a('0x7c'),_0x40f3fe,_0x130136);}else{if(_0x16924b['query'][_0x2ab9c3]===_0x948a('0x7d')){_0x3b2cf1[_0x948a('0x77')]('i.'+_0x2ab9c3+_0x948a('0x7e'));}else{_0x3b2cf1['where']('i.'+_0x2ab9c3+_0x948a('0x7f'),_0x16924b['query'][_0x2ab9c3]);}}});}if(_0x16924b[_0x948a('0x3e')][_0x948a('0x80')]){if(_0x16924b['query']['read']==0x1){_0x3b2cf1['having'](_0x948a('0x81'));}else{_0x3b2cf1[_0x948a('0x60')](_0x948a('0x82'));}}if(_0x16924b[_0x948a('0x3e')][_0x948a('0x83')]){_0x22af35=_['isArray'](_0x16924b[_0x948a('0x3e')][_0x948a('0x83')])?_0x16924b['query'][_0x948a('0x83')]:new Array(_0x16924b[_0x948a('0x3e')][_0x948a('0x83')]);_0x22af35[_0x948a('0x2e')](function(_0x25f501){_0x373e93['or'](_0x948a('0x6f'),'%,'+_0x25f501+',%');});}if(_0x16924b[_0x948a('0x3e')][_0x948a('0x84')]){var _0x4605e8=_0x16924b[_0x948a('0x3e')][_0x948a('0x84')][_0x948a('0x85')]('\x5c','\x5c\x5c')[_0x948a('0x85')](/'/g,'\x27\x27');if(qs[_0x948a('0x86')](_0x4605e8)){_0x4ad6d7['or']('i.id\x20LIKE\x20?',_0x4605e8+'%')['or'](_0x948a('0x87'),_0x4605e8+'%');}else{_0x4ad6d7['or'](_0x948a('0x88'),qs[_0x948a('0x89')](_0x4605e8))['or'](_0x948a('0x8a'),_0x4605e8+'%');}}}_0x3b2cf1['where'](_0x4ad6d7);_0x3b2cf1[_0x948a('0x8b')]('i.id');var _0x256764={'type':db['Sequelize']['QueryTypes'][_0x948a('0x8c')],'raw':!![]};var _0x22c78b=_0x3b2cf1['clone']();_0x22c78b[_0x948a('0x4b')](_0x948a('0x8d'));_0x22c78b[_0x948a('0x4b')](_0x948a('0x8e'),_0x948a('0x5e'));if(_0x26e308[_0x948a('0x44')]){_0x26e308[_0x948a('0x44')]['forEach'](function(_0x5e9185){var _0x1d26f3=_0x5e9185[0x0]===_0x948a('0x8f')?_0x5e9185[0x0]:'i.'+_0x5e9185[0x0];_0x3b2cf1[_0x948a('0x44')](_0x1d26f3,_0x5e9185[0x1]===_0x948a('0x90')?![]:!![]);});}if(!_[_0x948a('0x75')](_0x22af35)){_0x3b2cf1[_0x948a('0x60')](_0x373e93);_0x22c78b['where']('t.id\x20IN\x20?',_0x22af35);}BPromise[_0x948a('0x91')]()[_0x948a('0x27')](function(){if(!_0x50f17f){if(_0x16924b[_0x948a('0x3e')][_0x948a('0x76')])return;_0x22c78b[_0x948a('0x77')](_0x948a('0x92'));_0x3b2cf1[_0x948a('0x77')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x16924b[_0x948a('0x93')]['role']!==_0x948a('0x94'))return;return _0x16924b[_0x948a('0x93')][_0x948a('0x95')]({'attributes':['id'],'raw':!![]})[_0x948a('0x27')](function(_0x5b05ef){if(_[_0x948a('0x75')](_0x5b05ef)){_0x22c78b['where'](_0x948a('0x96'));_0x3b2cf1['where'](_0x948a('0x96'));}else{_0x22c78b[_0x948a('0x77')](_0x948a('0x78'),_['map'](_0x5b05ef,'id'));_0x3b2cf1[_0x948a('0x77')](_0x948a('0x78'),_[_0x948a('0x38')](_0x5b05ef,'id'));}});})[_0x948a('0x27')](function(){if(_0x16924b['user'][_0x948a('0x97')]===_0x948a('0x94')&&!_0x50f17f&&!_0x16924b[_0x948a('0x3e')][_0x948a('0x76')])return[];return db[_0x948a('0x98')][_0x948a('0x3e')](_0x22c78b[_0x948a('0x99')](),_0x256764);})[_0x948a('0x27')](function(_0x4cc1b0){_0x553e03[_0x948a('0x9a')]=_0x4cc1b0[_0x948a('0x43')];if(_0x553e03['count']===0x0)return[];return db[_0x948a('0x98')][_0x948a('0x3e')](_0x1c3f84[_0x948a('0x99')](),_0x256764)[_0x948a('0x27')](function(_0x57737d){_0x522ea2=_['keyBy'](_0x57737d,'id');_0x256764=_[_0x948a('0x9b')](_0x256764,{'model':db[_0x948a('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x16924b[_0x948a('0x3e')]['fields']){_0x26e308[_0x948a('0x41')][_0x948a('0x2e')](function(_0x1303c3){_0x3b2cf1[_0x948a('0x4b')]('i.'+_0x1303c3);});}else{_0x3b2cf1[_0x948a('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x3b2cf1['field'](_0x948a('0x9d'),'Account.key');_0x3b2cf1[_0x948a('0x4b')](_0x948a('0x9e'),'Account.mandatoryDisposition');_0x3b2cf1[_0x948a('0x4b')](_0x948a('0x9f'),_0x948a('0x8f'));_0x3b2cf1[_0x948a('0x4b')]('i.*');_0x3b2cf1[_0x948a('0x4b')]('c.firstName',_0x948a('0xa0'));_0x3b2cf1[_0x948a('0x4b')]('c.lastName',_0x948a('0xa1'));_0x3b2cf1[_0x948a('0x4b')]('c.email',_0x948a('0xa2'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa3'),_0x948a('0xa4'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa5'),_0x948a('0xa6'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa7'),_0x948a('0xa8'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xa9'),_0x948a('0xaa'));_0x3b2cf1[_0x948a('0x4b')](_0x948a('0xab'),_0x948a('0xac'));_0x3b2cf1[_0x948a('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x948a('0x2b'));}if(_0x26e308[_0x948a('0x21')])_0x3b2cf1[_0x948a('0x21')](_0x26e308[_0x948a('0x21')]);if(_0x26e308[_0x948a('0x20')])_0x3b2cf1['offset'](_0x26e308[_0x948a('0x20')]);return db[_0x948a('0x98')]['query'](_0x3b2cf1[_0x948a('0x99')](),_0x256764);})['then'](function(_0x1576fe){if(_0x1576fe[_0x948a('0x43')]>0x0)_0x14404a[_0x948a('0x77')]('ui.SmsInteractionId\x20IN\x20?',_[_0x948a('0x38')](_0x1576fe,'id'));return db['sequelize'][_0x948a('0x3e')](_0x14404a[_0x948a('0x99')](),_0x256764)[_0x948a('0x27')](function(_0x122d7a){var _0xace1d8=_[_0x948a('0xad')](_0x122d7a,_0x948a('0xae'));var _0x45b842=[];_0x1576fe[_0x948a('0x2e')](function(_0x3431a5){_0x45b842[_0x948a('0x2f')](updateSmsInteraction(_0x3431a5,_0x522ea2,_0xace1d8));});return BPromise[_0x948a('0xaf')](_0x45b842);});});})['then'](function(_0x3cd4db){_0x553e03[_0x948a('0xb0')]=_0x3cd4db;return _0x553e03;})['then'](respondWithFilteredResult(_0x1bbe38,_0x26e308))[_0x948a('0x30')](handleError(_0x1bbe38,null));};exports[_0x948a('0xb1')]=function(_0x31ef1e,_0x5a4722){var _0x20a242={'raw':![],'where':{'id':_0x31ef1e['params']['id']}},_0x4e7ae8={};_0x4e7ae8[_0x948a('0x3c')]=_[_0x948a('0x3f')](db[_0x948a('0x9c')][_0x948a('0x39')]);_0x4e7ae8[_0x948a('0x3e')]=_[_0x948a('0x3f')](_0x31ef1e[_0x948a('0x3e')]);_0x4e7ae8[_0x948a('0xb2')]=_[_0x948a('0x40')](_0x4e7ae8[_0x948a('0x3c')],_0x4e7ae8[_0x948a('0x3e')]);_0x20a242[_0x948a('0x41')]=_[_0x948a('0x40')](_0x4e7ae8['model'],qs[_0x948a('0x42')](_0x31ef1e['query'][_0x948a('0x42')]));_0x20a242[_0x948a('0x41')]=_0x20a242[_0x948a('0x41')][_0x948a('0x43')]?_0x20a242['attributes']:_0x4e7ae8[_0x948a('0x3c')];if(_0x31ef1e[_0x948a('0x3e')]['includeAll']){_0x20a242[_0x948a('0xb3')]=[{'all':!![]}];}_0x20a242=_[_0x948a('0x9b')]({},_0x20a242,_0x31ef1e['options']);return db[_0x948a('0x9c')][_0x948a('0x68')](_0x20a242)[_0x948a('0x27')](handleEntityNotFound(_0x5a4722,null))[_0x948a('0x27')](respondWithResult(_0x5a4722,null))[_0x948a('0x30')](handleError(_0x5a4722,null));};exports[_0x948a('0xb4')]=function(_0x3b9042,_0x2bd35c){return db[_0x948a('0x9c')][_0x948a('0xb4')](_0x3b9042[_0x948a('0xb5')],{})[_0x948a('0x27')](respondWithResult(_0x2bd35c,0xc9))[_0x948a('0x30')](handleError(_0x2bd35c,null));};exports[_0x948a('0xb6')]=function(_0x386b72,_0x547dc0){if(_0x386b72[_0x948a('0xb5')]['id']){delete _0x386b72[_0x948a('0xb5')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x386b72['params']['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x547dc0,null))[_0x948a('0x27')](saveUpdates(_0x386b72[_0x948a('0xb5')],null))[_0x948a('0x27')](respondWithResult(_0x547dc0,null))['catch'](handleError(_0x547dc0,null));};exports[_0x948a('0x26')]=function(_0x9f2a4e,_0x65c2e2){return db[_0x948a('0x9c')][_0x948a('0x68')]({'where':{'id':_0x9f2a4e[_0x948a('0xb7')]['id']}})['then'](handleEntityNotFound(_0x65c2e2,null))[_0x948a('0x27')](removeEntity(_0x65c2e2,null))['catch'](handleError(_0x65c2e2,null));};exports[_0x948a('0xb8')]=function(_0x34fc53,_0x3773b0){return db[_0x948a('0x9c')][_0x948a('0xb8')]()[_0x948a('0x27')](respondWithResult(_0x3773b0,null))['catch'](handleError(_0x3773b0,null));};exports[_0x948a('0xb9')]=function(_0x160ede,_0x98ab31,_0x427671){return db[_0x948a('0xba')][_0x948a('0x68')]({'where':{'id':_0x160ede[_0x948a('0xb7')]['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x98ab31,null))[_0x948a('0x27')](function(_0x3d9d14){if(_0x3d9d14){return _0x3d9d14[_0x948a('0xb9')](_0x160ede[_0x948a('0xb5')][_0x948a('0xbb')],_[_0x948a('0xbc')](_0x160ede[_0x948a('0xb5')],[_0x948a('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x98ab31,null))[_0x948a('0x30')](handleError(_0x98ab31,null));};exports[_0x948a('0xbd')]=function(_0x37beb8,_0x1a079c,_0x4fd6f4){var _0x1378cc={'raw':![],'where':{}};var _0x16a119={};var _0x42c5cf={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x37beb8[_0x948a('0xb7')]['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x1a079c,null))['then'](function(_0x256826){if(_0x256826){_0x16a119['model']=_[_0x948a('0x3f')](db['SmsMessage'][_0x948a('0x39')]);_0x16a119[_0x948a('0x3e')]=_[_0x948a('0x3f')](_0x37beb8[_0x948a('0x3e')]);_0x16a119[_0x948a('0xb2')]=_['intersection'](_0x16a119[_0x948a('0x3c')],_0x16a119[_0x948a('0x3e')]);_0x1378cc[_0x948a('0x41')]=_[_0x948a('0x40')](_0x16a119[_0x948a('0x3c')],qs[_0x948a('0x42')](_0x37beb8[_0x948a('0x3e')][_0x948a('0x42')]));_0x1378cc[_0x948a('0x41')]=_0x1378cc['attributes']['length']?_0x1378cc[_0x948a('0x41')]:_0x16a119['model'];if(!_0x37beb8[_0x948a('0x3e')][_0x948a('0xbe')]('nolimit')){_0x1378cc[_0x948a('0x21')]=qs['limit'](_0x37beb8[_0x948a('0x3e')][_0x948a('0x21')]);_0x1378cc[_0x948a('0x20')]=qs[_0x948a('0x20')](_0x37beb8['query']['offset']);}_0x1378cc[_0x948a('0x44')]=qs[_0x948a('0x45')](_0x37beb8[_0x948a('0x3e')][_0x948a('0x45')]);_0x1378cc[_0x948a('0x77')]=qs[_0x948a('0xb2')](_[_0x948a('0x46')](_0x37beb8['query'],_0x16a119[_0x948a('0xb2')]));_0x1378cc[_0x948a('0x77')][_0x948a('0xae')]=_0x256826['id'];if(_0x37beb8[_0x948a('0x3e')][_0x948a('0x84')]){_0x1378cc[_0x948a('0x77')]=_[_0x948a('0x9b')](_0x1378cc[_0x948a('0x77')],{'$or':_[_0x948a('0x38')](_0x1378cc['attributes'],function(_0x871cfa){var _0x2a6a8c={};_0x2a6a8c[_0x871cfa]={'$like':'%'+_0x37beb8[_0x948a('0x3e')][_0x948a('0x84')]+'%'};return _0x2a6a8c;})});}if(_0x37beb8['query'][_0x948a('0xbf')]){var _0x596c44=_0x37beb8[_0x948a('0x3e')][_0x948a('0xbf')][_0x948a('0x2d')](',');var _0x3b7061={};_0x3b7061[_0x596c44[0x0]]={'$gte':moment(_0x596c44[0x1])[_0x948a('0xc0')](_0x948a('0xc1'))};_0x1378cc[_0x948a('0x77')]=_[_0x948a('0x9b')](_0x1378cc[_0x948a('0x77')],_0x3b7061);}_0x1378cc=_['merge']({},_0x1378cc,_0x37beb8[_0x948a('0xc2')]);return db[_0x948a('0xba')][_0x948a('0x9a')]({'where':_0x1378cc[_0x948a('0x77')]})[_0x948a('0x27')](function(_0x5a4159){_0x42c5cf[_0x948a('0x9a')]=_0x5a4159;if(_0x37beb8[_0x948a('0x3e')][_0x948a('0xc3')]){_0x1378cc['include']=[{'all':!![]}];}return db[_0x948a('0xba')]['findAll'](_0x1378cc);})[_0x948a('0x27')](function(_0x1b30e5){_0x42c5cf[_0x948a('0xb0')]=_0x1b30e5;return _0x42c5cf;});}})[_0x948a('0x27')](respondWithFilteredResult(_0x1a079c,_0x1378cc))[_0x948a('0x30')](handleError(_0x1a079c,null));};exports[_0x948a('0xc4')]=function(_0x5b97cb,_0x339176,_0x46572){return db[_0x948a('0x9c')][_0x948a('0x68')]({'where':{'id':_0x5b97cb['params']['id']}})[_0x948a('0x27')](handleEntityNotFound(_0x339176,null))[_0x948a('0x27')](function(_0x51ba74){if(_0x51ba74){return _0x51ba74[_0x948a('0xc5')](_0x5b97cb[_0x948a('0xb5')]['ids'],_['omit'](_0x5b97cb[_0x948a('0xb5')],[_0x948a('0xbb'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x948a('0x48')],'where':{'id':_0x5b97cb['body'][_0x948a('0xbb')]}});})[_0x948a('0x27')](function(_0x1e4a92){socket[_0x948a('0xc6')](_0x948a('0xc7'),{'id':Number(_0x5b97cb['params']['id']),'tags':_0x1e4a92||[]});return{'id':Number(_0x5b97cb[_0x948a('0xb7')]['id']),'tags':_0x1e4a92||[]};});}})['then'](respondWithResult(_0x339176,null))[_0x948a('0x30')](handleError(_0x339176,null));};exports['removeTags']=function(_0x271f65,_0xece03d,_0x369ddb){return db[_0x948a('0x9c')]['find']({'where':{'id':_0x271f65['params']['id']}})[_0x948a('0x27')](handleEntityNotFound(_0xece03d,null))['then'](function(_0x95e8c4){if(_0x95e8c4){return _0x95e8c4[_0x948a('0xc8')](_0x271f65[_0x948a('0x3e')]['ids']);}})[_0x948a('0x27')](respondWithStatusCode(_0xece03d,null))[_0x948a('0x30')](handleError(_0xece03d,null));};exports[_0x948a('0xc9')]=function(_0x115891,_0x4dfe5b){var _0x8a0096=moment()[_0x948a('0xca')]()[_0x948a('0x99')]();var _0x4c0072=path[_0x948a('0xcb')](config[_0x948a('0xcc')],_0x948a('0xcd'),_0x948a('0xce'),_0x948a('0xcf'));var _0x2107da=path['join'](config['root'],_0x948a('0xcd'),_0x948a('0xce'),'attachments');var _0x37d263=path[_0x948a('0xcb')](_0x4c0072,_0x8a0096);var _0x4d5679=util[_0x948a('0xc0')]('transcript-%d-%s.zip',_0x115891[_0x948a('0xb7')]['id'],_0x8a0096);var _0x29bb5d=path[_0x948a('0xcb')](_0x4c0072,_0x4d5679);var _0x334710=[];_0x334710['push']({'model':db[_0x948a('0x71')],'as':_0x948a('0x71'),'attributes':['id',_0x948a('0xd0')],'raw':!![]});_0x334710[_0x948a('0x2f')]({'model':db[_0x948a('0xd1')],'as':_0x948a('0x63'),'attributes':['id',_0x948a('0xd2'),'lastName'],'raw':!![]});var _0x4f91c3=[{'model':db[_0x948a('0xba')],'as':_0x948a('0xd3'),'attributes':['id','body',_0x948a('0x79'),_0x948a('0xd4'),'secret',_0x948a('0x80')],'include':_0x334710}];_0x4f91c3[_0x948a('0x2f')]({'model':db[_0x948a('0xd5')],'as':_0x948a('0xd6'),'attributes':['id',_0x948a('0x3d')]});_0x4f91c3[_0x948a('0x2f')]({'model':db[_0x948a('0x71')],'as':'Owner','attributes':['id',_0x948a('0xd0')]});return db[_0x948a('0x9c')]['find']({'where':{'id':_0x115891['params']['id']},'include':_0x4f91c3})[_0x948a('0x27')](handleEntityNotFound(_0x4dfe5b,null))[_0x948a('0x27')](function(_0x5a27fd){if(_0x5a27fd){var _0x1d32c9=_0x5a27fd['get']({'plain':!![]});fs[_0x948a('0xd7')](_0x37d263);var _0x5ac7d6={'channel':_0x948a('0xd8'),'account':_0x1d32c9['Account'][_0x948a('0x3d')],'agent':_0x1d32c9[_0x948a('0xd9')]?_0x1d32c9[_0x948a('0xd9')]['fullname']:_0x948a('0xda'),'createdAt':moment(_0x1d32c9[_0x948a('0x79')])[_0x948a('0xc0')](_0x948a('0xc1'))['toString'](),'closedAt':_0x1d32c9[_0x948a('0x33')]?moment(_0x1d32c9[_0x948a('0xdb')])['format'](_0x948a('0xc1'))[_0x948a('0x99')]():'','disposition':_0x1d32c9['disposition'],'messages':_(_0x1d32c9[_0x948a('0xd3')])['filter']({'secret':![]})[_0x948a('0x38')](function(_0x1e9a17){return{'date':moment(_0x1e9a17[_0x948a('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x948a('0x99')](),'sender':_0x1e9a17[_0x948a('0xd4')]===_0x948a('0xdc')?_0x1e9a17['User']?_0x1e9a17[_0x948a('0x71')]['fullname']:_0x948a('0xdd'):_0x1e9a17[_0x948a('0x63')][_0x948a('0xd2')]+(_0x1e9a17['Contact'][_0x948a('0xde')]?'\x20'+_0x1e9a17[_0x948a('0x63')][_0x948a('0xde')]:''),'body':_0x1e9a17['body'],'direction':_0x1e9a17[_0x948a('0xd4')]===_0x948a('0xdc')?'A':'C','secret':_0x1e9a17[_0x948a('0xdf')],'read':_0x1e9a17['read']};})[_0x948a('0x5f')]()};return ejs[_0x948a('0xe0')](path[_0x948a('0xcb')](config['root'],_0x948a('0xcd'),_0x948a('0xe1'),_0x948a('0xe2')),{'interaction':_0x5ac7d6})[_0x948a('0x27')](function(_0x439f03){var _0x49e97e=path[_0x948a('0xcb')](_0x37d263,_0x948a('0xe3')+_0x1d32c9['id']+'-'+_0x8a0096+'.pdf');var _0x2587e7={'path':_0x49e97e,'channel':'Sms','interactionId':_0x1d32c9['id']};return pdf[_0x948a('0xe4')](_0x439f03,_0x2587e7);})['then'](function(){return new BPromise(function(_0x11bb57,_0x4c3d78){zipdir(_0x37d263,{'saveTo':_0x29bb5d},function(_0x2a8cc9,_0x4b6f8){if(_0x2a8cc9)return _0x4c3d78(_0x2a8cc9);return _0x11bb57(_0x4b6f8);});})[_0x948a('0x27')](function(){return new BPromise(function(_0x576099,_0x114aab){rimraf(_0x37d263,function(_0x4b34f2){if(_0x4b34f2)_0x114aab(_0x4b34f2);return _0x576099();});});})['then'](function(){return _0x4dfe5b[_0x948a('0xc9')](_0x29bb5d,_0x4d5679,function(_0x2f8475){if(_0x2f8475){console[_0x948a('0xe5')](_0x948a('0xe6'),_0x2f8475);}else{fs[_0x948a('0xe7')](_0x29bb5d);}});});});}else{return _0x4dfe5b[_0x948a('0x1d')](0xc8);}})[_0x948a('0x30')](handleError(_0x4dfe5b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f7376cd..06703df 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 _0x6343=['then','map','findAll','setDataValue','emit','hasOwnProperty','hook','exports','SmsInteraction','../../mysqldb','remove'];(function(_0x591206,_0x571873){var _0x3a3f53=function(_0x48f4dd){while(--_0x48f4dd){_0x591206['push'](_0x591206['shift']());}};_0x3a3f53(++_0x571873);}(_0x6343,0x168));var _0x3634=function(_0x574dfe,_0x322c23){_0x574dfe=_0x574dfe-0x0;var _0x34902d=_0x6343[_0x574dfe];return _0x34902d;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3634('0x0')];var SmsMessage=require(_0x3634('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3634('0x2')};function emitEvent(_0x420510){return function(_0x57c5e4,_0x247964,_0x388c18){_0x57c5e4['getUsers']({'attributes':['id'],'raw':!![]})[_0x3634('0x3')](function(_0xd40513){_0x57c5e4['setDataValue']('Users',_0xd40513[_0x3634('0x4')](function(_0x1bcdb2){return{'id':_0x1bcdb2['id']};}));return SmsMessage[_0x3634('0x5')]({'where':{'SmsInteractionId':_0x57c5e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3634('0x3')](function(_0x2e8e8b){_0x57c5e4[_0x3634('0x6')]('unreadMessages',_0x2e8e8b['length']);SmsInteractionEvents[_0x3634('0x7')](_0x420510+':'+_0x57c5e4['id'],_0x57c5e4);SmsInteractionEvents[_0x3634('0x7')](_0x420510,_0x57c5e4);_0x388c18(null);})['catch'](_0x388c18(null));};}for(var e in events){if(events[_0x3634('0x8')](e)){var event=events[e];SmsInteraction[_0x3634('0x9')](e,emitEvent(event));}}module[_0x3634('0xa')]=SmsInteractionEvents; \ No newline at end of file +var _0xab40=['remove','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x41841e,_0x4d2d54){var _0xb709b6=function(_0xf96093){while(--_0xf96093){_0x41841e['push'](_0x41841e['shift']());}};_0xb709b6(++_0x4d2d54);}(_0xab40,0xcd));var _0x0ab4=function(_0x4b53d4,_0x112661){_0x4b53d4=_0x4b53d4-0x0;var _0x15d654=_0xab40[_0x4b53d4];return _0x15d654;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var SmsInteraction=require(_0x0ab4('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0ab4('0x2')](0x0);var events={'afterCreate':_0x0ab4('0x3'),'afterUpdate':_0x0ab4('0x4'),'afterDestroy':_0x0ab4('0x5')};function emitEvent(_0x14634a){return function(_0x57fac1,_0x5f01aa,_0x28b17a){_0x57fac1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x46d16a){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x46d16a['map'](function(_0x55263d){return{'id':_0x55263d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x57fac1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x30e726){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x9'),_0x30e726[_0x0ab4('0xa')]);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a+':'+_0x57fac1['id'],_0x57fac1);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a,_0x57fac1);_0x28b17a(null);})[_0x0ab4('0xc')](_0x28b17a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0ab4('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 8384895..2c86549 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 _0xd1e1=['SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xd1e1,0xe6));var _0x1d1e=function(_0x4e9175,_0x2b630e){_0x4e9175=_0x4e9175-0x0;var _0x1d943a=_0xd1e1[_0x4e9175];return _0x1d943a;};'use strict';var _=require(_0x1d1e('0x0'));var util=require('util');var logger=require(_0x1d1e('0x1'))(_0x1d1e('0x2'));var moment=require('moment');var BPromise=require(_0x1d1e('0x3'));var rp=require(_0x1d1e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d1e('0x5'));var config=require(_0x1d1e('0x6'));var attributes=require(_0x1d1e('0x7'));module[_0x1d1e('0x8')]=function(_0x36e09c,_0x26cbda){return _0x36e09c[_0x1d1e('0x9')](_0x1d1e('0xa'),attributes,{'tableName':_0x1d1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d370b,_0x3014ea,_0x3dab8a){if(_0x2d370b[_0x1d1e('0xc')]('closed')){_0x2d370b[_0x1d1e('0xd')]=moment()[_0x1d1e('0xe')](_0x1d1e('0xf'));}_0x3dab8a(null,_0x2d370b);}}});}; \ No newline at end of file +var _0xbd44=['../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x574c48,_0x332df7){var _0x5ed59d=function(_0x1c2310){while(--_0x1c2310){_0x574c48['push'](_0x574c48['shift']());}};_0x5ed59d(++_0x332df7);}(_0xbd44,0xfd));var _0x4bd4=function(_0x43c6b1,_0x23e89c){_0x43c6b1=_0x43c6b1-0x0;var _0x358fae=_0xbd44[_0x43c6b1];return _0x358fae;};'use strict';var _=require(_0x4bd4('0x0'));var util=require('util');var logger=require(_0x4bd4('0x1'))(_0x4bd4('0x2'));var moment=require(_0x4bd4('0x3'));var BPromise=require(_0x4bd4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bd4('0x5'));var rimraf=require(_0x4bd4('0x6'));var config=require(_0x4bd4('0x7'));var attributes=require(_0x4bd4('0x8'));module[_0x4bd4('0x9')]=function(_0x39e5e8,_0x2b05a4){return _0x39e5e8['define'](_0x4bd4('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xcbf40a,_0x4057a4,_0x441e96){if(_0xcbf40a['changed']('closed')){_0xcbf40a[_0x4bd4('0xb')]=moment()['format'](_0x4bd4('0xc'));}_0x441e96(null,_0xcbf40a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 04cd745..5b26df5 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 _0x9ed7=['attributes','limit','AddTagsToSmsInteraction','find','addTags','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where'];(function(_0x5b3a8d,_0xcb0e86){var _0x329113=function(_0xa83198){while(--_0xa83198){_0x5b3a8d['push'](_0x5b3a8d['shift']());}};_0x329113(++_0xcb0e86);}(_0x9ed7,0x126));var _0x79ed=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x9ed7[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0x79ed('0x0'));var util=require('util');var moment=require(_0x79ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x79ed('0x2'));var fs=require('fs');var Redis=require(_0x79ed('0x3'));var db=require(_0x79ed('0x4'))['db'];var utils=require(_0x79ed('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x79ed('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x79ed('0x7')][_0x79ed('0x8')]({'port':0x232a});config['redis']=_[_0x79ed('0x9')](config[_0x79ed('0xa')],{'host':_0x79ed('0xb'),'port':0x18eb});var socket=require(_0x79ed('0xc'))(new Redis(config[_0x79ed('0xa')]));require(_0x79ed('0xd'))[_0x79ed('0xe')](socket);function respondWithRpcPromise(_0x4fbab3,_0x4b0743,_0x25dccb){return new BPromise(function(_0x51150a,_0x578dd4){return client[_0x79ed('0xf')](_0x4fbab3,_0x25dccb)[_0x79ed('0x10')](function(_0x38480c){logger[_0x79ed('0x11')](_0x79ed('0x12'),_0x4b0743,_0x79ed('0x13'));logger[_0x79ed('0x14')](_0x79ed('0x15'),_0x4b0743,_0x79ed('0x13'),JSON[_0x79ed('0x16')](_0x38480c));if(_0x38480c['error']){if(_0x38480c[_0x79ed('0x17')]['code']===0x1f4){logger['error'](_0x79ed('0x12'),_0x4b0743,_0x38480c[_0x79ed('0x17')][_0x79ed('0x18')]);return _0x578dd4(_0x38480c[_0x79ed('0x17')]['message']);}logger[_0x79ed('0x17')](_0x79ed('0x12'),_0x4b0743,_0x38480c[_0x79ed('0x17')][_0x79ed('0x18')]);return _0x51150a(_0x38480c[_0x79ed('0x17')][_0x79ed('0x18')]);}else{logger[_0x79ed('0x11')](_0x79ed('0x12'),_0x4b0743,'request\x20sent');_0x51150a(_0x38480c[_0x79ed('0x19')][_0x79ed('0x18')]);}})[_0x79ed('0x1a')](function(_0x57cc6f){logger[_0x79ed('0x17')](_0x79ed('0x12'),_0x4b0743,_0x57cc6f);_0x578dd4(_0x57cc6f);});});}exports[_0x79ed('0x1b')]=function(_0x1d2e09){var _0x641f88=this;return new Promise(function(_0xab823a,_0x27ca4f){return db[_0x79ed('0x1c')][_0x79ed('0x1d')](_0x1d2e09[_0x79ed('0x1e')],{'raw':_0x1d2e09[_0x79ed('0x1f')]?_0x1d2e09[_0x79ed('0x1f')][_0x79ed('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d2e09[_0x79ed('0x1f')]?_0x1d2e09[_0x79ed('0x1f')][_0x79ed('0x21')]||null:null,'attributes':_0x1d2e09['options']?_0x1d2e09[_0x79ed('0x1f')][_0x79ed('0x22')]||null:null,'limit':_0x1d2e09[_0x79ed('0x1f')]?_0x1d2e09['options'][_0x79ed('0x23')]||null:null})[_0x79ed('0x10')](function(_0x30211f){logger[_0x79ed('0x11')]('UpdateSmsInteraction',_0x1d2e09);logger['debug'](_0x79ed('0x1b'),_0x1d2e09,JSON[_0x79ed('0x16')](_0x30211f));_0xab823a(_0x30211f);})[_0x79ed('0x1a')](function(_0x37c68f){logger['error'](_0x79ed('0x1b'),_0x37c68f[_0x79ed('0x18')],_0x1d2e09);_0x27ca4f(_0x641f88[_0x79ed('0x17')](0x1f4,_0x37c68f[_0x79ed('0x18')]));});});};exports[_0x79ed('0x24')]=function(_0x564589){return new Promise(function(_0x163668,_0x43998){return db[_0x79ed('0x1c')][_0x79ed('0x25')]({'where':_0x564589[_0x79ed('0x1f')]?_0x564589[_0x79ed('0x1f')][_0x79ed('0x21')]||null:null})[_0x79ed('0x10')](function(_0x3d0a91){if(_0x3d0a91){return _0x3d0a91[_0x79ed('0x26')](_0x564589[_0x79ed('0x1e')]['ids'],_['omit'](_0x564589[_0x79ed('0x1e')],['ids','id'])||{});}})[_0x79ed('0x27')](function(_0x218b2e){logger[_0x79ed('0x11')](_0x79ed('0x28'),_0x564589);logger[_0x79ed('0x14')]('AddTags',_0x564589,JSON['stringify'](_0x218b2e));_0x163668(_0x218b2e);})['catch'](function(_0x3c114a){logger[_0x79ed('0x17')](_0x79ed('0x28'),_0x3c114a['message'],_0x564589);_0x43998(_this[_0x79ed('0x17')](0x1f4,_0x3c114a[_0x79ed('0x18')]));});});}; \ No newline at end of file +var _0xb8ac=['register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','limit','catch','AddTagsToSmsInteraction','find','where','addTags','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0xd06d03,_0x45b393){var _0x547b95=function(_0x2821e0){while(--_0x2821e0){_0xd06d03['push'](_0xd06d03['shift']());}};_0x547b95(++_0x45b393);}(_0xb8ac,0x1b3));var _0xcb8a=function(_0x3338e3,_0x141e7b){_0x3338e3=_0x3338e3-0x0;var _0x6ca671=_0xb8ac[_0x3338e3];return _0x6ca671;};'use strict';var _=require(_0xcb8a('0x0'));var util=require(_0xcb8a('0x1'));var moment=require(_0xcb8a('0x2'));var BPromise=require(_0xcb8a('0x3'));var rs=require(_0xcb8a('0x4'));var fs=require('fs');var Redis=require(_0xcb8a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb8a('0x6'));var logger=require(_0xcb8a('0x7'))(_0xcb8a('0x8'));var config=require(_0xcb8a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcb8a('0xa')][_0xcb8a('0xb')]({'port':0x232a});config[_0xcb8a('0xc')]=_[_0xcb8a('0xd')](config[_0xcb8a('0xc')],{'host':_0xcb8a('0xe'),'port':0x18eb});var socket=require(_0xcb8a('0xf'))(new Redis(config[_0xcb8a('0xc')]));require('./smsInteraction.socket')[_0xcb8a('0x10')](socket);function respondWithRpcPromise(_0x1412a8,_0x11ff48,_0x4bd24f){return new BPromise(function(_0x3d5035,_0x1961a0){return client['request'](_0x1412a8,_0x4bd24f)[_0xcb8a('0x11')](function(_0x223a07){logger[_0xcb8a('0x12')](_0xcb8a('0x13'),_0x11ff48,_0xcb8a('0x14'));logger[_0xcb8a('0x15')](_0xcb8a('0x16'),_0x11ff48,_0xcb8a('0x14'),JSON[_0xcb8a('0x17')](_0x223a07));if(_0x223a07[_0xcb8a('0x18')]){if(_0x223a07[_0xcb8a('0x18')][_0xcb8a('0x19')]===0x1f4){logger[_0xcb8a('0x18')](_0xcb8a('0x13'),_0x11ff48,_0x223a07[_0xcb8a('0x18')][_0xcb8a('0x1a')]);return _0x1961a0(_0x223a07[_0xcb8a('0x18')][_0xcb8a('0x1a')]);}logger[_0xcb8a('0x18')](_0xcb8a('0x13'),_0x11ff48,_0x223a07[_0xcb8a('0x18')]['message']);return _0x3d5035(_0x223a07[_0xcb8a('0x18')]['message']);}else{logger[_0xcb8a('0x12')](_0xcb8a('0x13'),_0x11ff48,'request\x20sent');_0x3d5035(_0x223a07['result'][_0xcb8a('0x1a')]);}})['catch'](function(_0x276d3b){logger[_0xcb8a('0x18')](_0xcb8a('0x13'),_0x11ff48,_0x276d3b);_0x1961a0(_0x276d3b);});});}exports[_0xcb8a('0x1b')]=function(_0x338e03){var _0x158ab8=this;return new Promise(function(_0x579cd3,_0x7ecbf0){return db[_0xcb8a('0x1c')][_0xcb8a('0x1d')](_0x338e03[_0xcb8a('0x1e')],{'raw':_0x338e03['options']?_0x338e03[_0xcb8a('0x1f')][_0xcb8a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338e03['options']?_0x338e03[_0xcb8a('0x1f')]['where']||null:null,'attributes':_0x338e03[_0xcb8a('0x1f')]?_0x338e03[_0xcb8a('0x1f')]['attributes']||null:null,'limit':_0x338e03[_0xcb8a('0x1f')]?_0x338e03[_0xcb8a('0x1f')][_0xcb8a('0x21')]||null:null})[_0xcb8a('0x11')](function(_0x3ea133){logger[_0xcb8a('0x12')](_0xcb8a('0x1b'),_0x338e03);logger[_0xcb8a('0x15')]('UpdateSmsInteraction',_0x338e03,JSON['stringify'](_0x3ea133));_0x579cd3(_0x3ea133);})[_0xcb8a('0x22')](function(_0x5bea28){logger[_0xcb8a('0x18')](_0xcb8a('0x1b'),_0x5bea28[_0xcb8a('0x1a')],_0x338e03);_0x7ecbf0(_0x158ab8[_0xcb8a('0x18')](0x1f4,_0x5bea28[_0xcb8a('0x1a')]));});});};exports[_0xcb8a('0x23')]=function(_0x41f24a){return new Promise(function(_0x3aa288,_0x301103){return db[_0xcb8a('0x1c')][_0xcb8a('0x24')]({'where':_0x41f24a['options']?_0x41f24a[_0xcb8a('0x1f')][_0xcb8a('0x25')]||null:null})[_0xcb8a('0x11')](function(_0x38d423){if(_0x38d423){return _0x38d423[_0xcb8a('0x26')](_0x41f24a[_0xcb8a('0x1e')]['ids'],_['omit'](_0x41f24a[_0xcb8a('0x1e')],['ids','id'])||{});}})[_0xcb8a('0x27')](function(_0x565d3f){logger[_0xcb8a('0x12')](_0xcb8a('0x28'),_0x41f24a);logger[_0xcb8a('0x15')]('AddTags',_0x41f24a,JSON['stringify'](_0x565d3f));_0x3aa288(_0x565d3f);})['catch'](function(_0x16730f){logger[_0xcb8a('0x18')](_0xcb8a('0x28'),_0x16730f[_0xcb8a('0x1a')],_0x41f24a);_0x301103(_this[_0xcb8a('0x18')](0x1f4,_0x16730f[_0xcb8a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index df0f73b..61021e0 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 _0xe113=['removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xe113,0x148));var _0x3e11=function(_0x3c3be5,_0x3f4848){_0x3c3be5=_0x3c3be5-0x0;var _0x580ea7=_0xe113[_0x3c3be5];return _0x580ea7;};'use strict';var SmsInteractionEvents=require(_0x3e11('0x0'));var events=[_0x3e11('0x1'),_0x3e11('0x2'),_0x3e11('0x3')];function createListener(_0x1ca176,_0x16cab3){return function(_0xcf2a21){_0x16cab3[_0x3e11('0x4')](_0x1ca176,_0xcf2a21);};}function removeListener(_0x41d53c,_0x2af17a){return function(){SmsInteractionEvents[_0x3e11('0x5')](_0x41d53c,_0x2af17a);};}exports[_0x3e11('0x6')]=function(_0x426f7e){for(var _0x467404=0x0,_0x269066=events[_0x3e11('0x7')];_0x467404<_0x269066;_0x467404++){var _0x40bbd5=events[_0x467404];var _0x2f3398=createListener(_0x3e11('0x8')+_0x40bbd5,_0x426f7e);SmsInteractionEvents['on'](_0x40bbd5,_0x2f3398);}}; \ No newline at end of file +var _0x88a5=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','register','length'];(function(_0x7b6352,_0x548a1f){var _0x2bec47=function(_0x578a36){while(--_0x578a36){_0x7b6352['push'](_0x7b6352['shift']());}};_0x2bec47(++_0x548a1f);}(_0x88a5,0x151));var _0x588a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x88a5[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsInteractionEvents=require(_0x588a('0x0'));var events=[_0x588a('0x1'),_0x588a('0x2'),_0x588a('0x3')];function createListener(_0x431bc4,_0x4c6633){return function(_0x32be34){_0x4c6633[_0x588a('0x4')](_0x431bc4,_0x32be34);};}function removeListener(_0x1f0627,_0x21d7ee){return function(){SmsInteractionEvents['removeListener'](_0x1f0627,_0x21d7ee);};}exports[_0x588a('0x5')]=function(_0x58ecac){for(var _0x4328ad=0x0,_0x56f8c9=events[_0x588a('0x6')];_0x4328ad<_0x56f8c9;_0x4328ad++){var _0xdb6a36=events[_0x4328ad];var _0x53a4f4=createListener(_0x588a('0x7')+_0xdb6a36,_0x58ecac);SmsInteractionEvents['on'](_0xdb6a36,_0x53a4f4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6cb1a5a..a57c066 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 _0xc863=['index','isAuthenticated','describe','/:id','show','tracked','smsmessage:create','create','post','status','put','update','/:id/reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc863,0x1ea));var _0x3c86=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xc863[_0x4c0622];return _0x1799d8;};'use strict';var multer=require(_0x3c86('0x0'));var util=require(_0x3c86('0x1'));var path=require(_0x3c86('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c86('0x3'));var router=express[_0x3c86('0x4')]();var fs_extra=require(_0x3c86('0x5'));var auth=require(_0x3c86('0x6'));var interaction=require(_0x3c86('0x7'));var config=require(_0x3c86('0x8'));var controller=require('./smsMessage.controller');router[_0x3c86('0x9')]('/',auth['isAuthenticated'](),controller[_0x3c86('0xa')]);router[_0x3c86('0x9')]('/describe',auth[_0x3c86('0xb')](),controller[_0x3c86('0xc')]);router[_0x3c86('0x9')](_0x3c86('0xd'),auth[_0x3c86('0xb')](),controller[_0x3c86('0xe')]);router['post']('/',auth[_0x3c86('0xb')](),interaction[_0x3c86('0xf')]('sms',_0x3c86('0x10')),controller[_0x3c86('0x11')]);router[_0x3c86('0x12')]('/:id/status',controller[_0x3c86('0x13')]);router[_0x3c86('0x14')](_0x3c86('0xd'),auth[_0x3c86('0xb')](),controller[_0x3c86('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x3c86('0x14')](_0x3c86('0x16'),auth[_0x3c86('0xb')](),controller['reject']);router[_0x3c86('0x17')](_0x3c86('0xd'),auth[_0x3c86('0xb')](),controller['destroy']);module[_0x3c86('0x18')]=router; \ No newline at end of file +var _0xbdd4=['status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','index','describe','/:id','isAuthenticated','post','tracked','sms','smsmessage:create','/:id/status'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xbdd4,0x14e));var _0x4bdd=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbdd4[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4bdd('0x0'));var timeout=require(_0x4bdd('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4bdd('0x2'));var auth=require(_0x4bdd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4bdd('0x4'));var controller=require(_0x4bdd('0x5'));router[_0x4bdd('0x6')]('/',auth['isAuthenticated'](),controller[_0x4bdd('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4bdd('0x8')]);router['get'](_0x4bdd('0x9'),auth[_0x4bdd('0xa')](),controller['show']);router[_0x4bdd('0xb')]('/',auth[_0x4bdd('0xa')](),interaction[_0x4bdd('0xc')](_0x4bdd('0xd'),_0x4bdd('0xe')),controller['create']);router[_0x4bdd('0xb')](_0x4bdd('0xf'),controller[_0x4bdd('0x10')]);router[_0x4bdd('0x11')](_0x4bdd('0x9'),auth['isAuthenticated'](),controller[_0x4bdd('0x12')]);router[_0x4bdd('0x11')](_0x4bdd('0x13'),auth[_0x4bdd('0xa')](),controller[_0x4bdd('0x14')]);router[_0x4bdd('0x11')](_0x4bdd('0x15'),auth[_0x4bdd('0xa')](),controller[_0x4bdd('0x16')]);router['delete']('/:id',auth[_0x4bdd('0xa')](),controller[_0x4bdd('0x17')]);module[_0x4bdd('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index c991b00..7d93c4c 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 _0x4588=['exports','TEXT','medium','ENUM','out','STRING','sequelize'];(function(_0x983dc2,_0x5cca11){var _0x4b0315=function(_0x1042f9){while(--_0x1042f9){_0x983dc2['push'](_0x983dc2['shift']());}};_0x4b0315(++_0x5cca11);}(_0x4588,0x179));var _0x8458=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x4588[_0x1fd9e7];return _0x1781f2;};'use strict';var Sequelize=require(_0x8458('0x0'));module[_0x8458('0x1')]={'body':{'type':Sequelize[_0x8458('0x2')](_0x8458('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8458('0x4')]('in',_0x8458('0x5')),'defaultValue':_0x8458('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8458('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8458('0x6')]},'providerResponse':{'type':Sequelize[_0x8458('0x2')]}}; \ No newline at end of file +var _0x8812=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x28bfc4,_0x19ca98){var _0x32f3ae=function(_0x15fbc8){while(--_0x15fbc8){_0x28bfc4['push'](_0x28bfc4['shift']());}};_0x32f3ae(++_0x19ca98);}(_0x8812,0x1cf));var _0x2881=function(_0x2cb8dc,_0x2758ba){_0x2cb8dc=_0x2cb8dc-0x0;var _0xfedef6=_0x8812[_0x2cb8dc];return _0xfedef6;};'use strict';var Sequelize=require(_0x2881('0x0'));module[_0x2881('0x1')]={'body':{'type':Sequelize[_0x2881('0x2')](_0x2881('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2881('0x4')]('in',_0x2881('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2881('0x6')]},'readAt':{'type':Sequelize[_0x2881('0x7')]},'secret':{'type':Sequelize[_0x2881('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2881('0x6')]},'providerResponse':{'type':Sequelize[_0x2881('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 527d118..40cf2e9 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 _0xaa64=['end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','SmsMessage','findAll','rows','show','params','options','catch','create','body','find','describe','../../config/logger','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','isNil','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','RejectMessage','rejectMessage','ContactId','QueryTypes','User','interface','SmsAccountId','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status'];(function(_0x35908d,_0x24c109){var _0x58492f=function(_0x573f08){while(--_0x573f08){_0x35908d['push'](_0x35908d['shift']());}};_0x58492f(++_0x24c109);}(_0xaa64,0xf7));var _0x4aa6=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xaa64[_0x1fafa5];return _0xcf08c9;};'use strict';var emlformat=require(_0x4aa6('0x0'));var rimraf=require(_0x4aa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aa6('0x2'));var rp=require('request-promise');var moment=require(_0x4aa6('0x3'));var BPromise=require(_0x4aa6('0x4'));var Mustache=require(_0x4aa6('0x5'));var util=require('util');var path=require(_0x4aa6('0x6'));var sox=require(_0x4aa6('0x7'));var csv=require(_0x4aa6('0x8'));var ejs=require(_0x4aa6('0x9'));var fs=require('fs');var fs_extra=require(_0x4aa6('0xa'));var _=require(_0x4aa6('0xb'));var squel=require(_0x4aa6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4aa6('0xd'));var toCsv=require(_0x4aa6('0x8'));var querystring=require('querystring');var Papa=require(_0x4aa6('0xe'));var Redis=require('ioredis');var authService=require(_0x4aa6('0xf'));var qs=require(_0x4aa6('0x10'));var as=require(_0x4aa6('0x11'));var hardwareService=require(_0x4aa6('0x12'));var logger=require('../../config/logger')(_0x4aa6('0x13'));var utils=require(_0x4aa6('0x14'));var config=require(_0x4aa6('0x15'));var licenseUtil=require(_0x4aa6('0x16'));var db=require(_0x4aa6('0x17'))['db'];config[_0x4aa6('0x18')]=_[_0x4aa6('0x19')](config[_0x4aa6('0x18')],{'host':_0x4aa6('0x1a'),'port':0x18eb});var socket=require(_0x4aa6('0x1b'))(new Redis(config['redis']));require(_0x4aa6('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4aa6('0x1d')][_0x4aa6('0x1e')]({'port':0x232c});var client9002=jayson[_0x4aa6('0x1d')][_0x4aa6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x375c09,_0x238f10,_0x3e234f,_0x2c5c66){return new BPromise(function(_0x530ed0,_0x138d55){var _0x5458ad=_0x2c5c66||client;return _0x5458ad[_0x4aa6('0x1f')](_0x375c09,_0x3e234f)['then'](function(_0x54a6d8){logger[_0x4aa6('0x20')](_0x4aa6('0x21'),_0x238f10,_0x4aa6('0x22'));logger[_0x4aa6('0x23')](_0x4aa6('0x24'),_0x238f10,_0x4aa6('0x22'),JSON[_0x4aa6('0x25')](_0x54a6d8));if(_0x54a6d8[_0x4aa6('0x26')]){if(_0x54a6d8[_0x4aa6('0x26')]['code']===0x1f4){logger[_0x4aa6('0x26')](_0x4aa6('0x21'),_0x238f10,_0x54a6d8[_0x4aa6('0x26')][_0x4aa6('0x27')]);return _0x138d55(_0x54a6d8[_0x4aa6('0x26')][_0x4aa6('0x27')]);}logger['error'](_0x4aa6('0x21'),_0x238f10,_0x54a6d8[_0x4aa6('0x26')][_0x4aa6('0x27')]);return _0x530ed0(_0x54a6d8[_0x4aa6('0x26')][_0x4aa6('0x27')]);}else{logger[_0x4aa6('0x20')]('SmsMessage,\x20%s,\x20%s',_0x238f10,_0x4aa6('0x22'));_0x530ed0(_0x54a6d8[_0x4aa6('0x28')]['message']);}})['catch'](function(_0x347856){logger[_0x4aa6('0x26')](_0x4aa6('0x21'),_0x238f10,_0x347856);_0x138d55(_0x347856);});});}function respondWithStatusCode(_0x3425df,_0x2001ce){_0x2001ce=_0x2001ce||0xcc;return function(_0x5e53a7){if(_0x5e53a7){return _0x3425df[_0x4aa6('0x29')](_0x2001ce);}return _0x3425df[_0x4aa6('0x2a')](_0x2001ce)[_0x4aa6('0x2b')]();};}function respondWithResult(_0x3bd7a8,_0x45a9e3){_0x45a9e3=_0x45a9e3||0xc8;return function(_0x256342){if(_0x256342){return _0x3bd7a8['status'](_0x45a9e3)[_0x4aa6('0x2c')](_0x256342);}};}function respondWithFilteredResult(_0x41bdc8,_0x5bc756){return function(_0x149c9a){if(_0x149c9a){var _0x121b97=typeof _0x5bc756[_0x4aa6('0x2d')]===_0x4aa6('0x2e')&&typeof _0x5bc756['limit']===_0x4aa6('0x2e');var _0x625df8=_0x149c9a[_0x4aa6('0x2f')];var _0x52b038=_0x121b97?0x0:_0x5bc756[_0x4aa6('0x2d')];var _0x29f31a=_0x121b97?_0x149c9a[_0x4aa6('0x2f')]:_0x5bc756['offset']+_0x5bc756[_0x4aa6('0x30')];var _0x2af33f;if(_0x29f31a>=_0x625df8){_0x29f31a=_0x625df8;_0x2af33f=0xc8;}else{_0x2af33f=0xce;}_0x41bdc8['status'](_0x2af33f);return _0x41bdc8[_0x4aa6('0x31')](_0x4aa6('0x32'),_0x52b038+'-'+_0x29f31a+'/'+_0x625df8)[_0x4aa6('0x2c')](_0x149c9a);}return null;};}function patchUpdates(_0x108903){return function(_0x1d71e5){try{jsonpatch['apply'](_0x1d71e5,_0x108903,!![]);}catch(_0x5b7ecc){return BPromise[_0x4aa6('0x33')](_0x5b7ecc);}return _0x1d71e5[_0x4aa6('0x34')]();};}function saveUpdates(_0x35006c,_0x5ec513){return function(_0x55e819){if(_0x55e819){return _0x55e819[_0x4aa6('0x35')](_0x35006c)[_0x4aa6('0x36')](function(_0x3efc36){return _0x3efc36;});}return null;};}function removeEntity(_0x19f5a5,_0xa463ae){return function(_0xbe8812){if(_0xbe8812){return _0xbe8812[_0x4aa6('0x37')]()[_0x4aa6('0x36')](function(){_0x19f5a5['status'](0xcc)[_0x4aa6('0x2b')]();});}};}function handleEntityNotFound(_0xec8944,_0x2ae741){return function(_0x40c289){if(!_0x40c289){_0xec8944[_0x4aa6('0x29')](0x194);}return _0x40c289;};}function handleError(_0xd3e41d,_0x4ab55d){_0x4ab55d=_0x4ab55d||0x1f4;return function(_0x223616){logger[_0x4aa6('0x26')](_0x223616['stack']);if(_0x223616[_0x4aa6('0x38')]){delete _0x223616[_0x4aa6('0x38')];}_0xd3e41d[_0x4aa6('0x2a')](_0x4ab55d)[_0x4aa6('0x39')](_0x223616);};}exports['index']=function(_0x4d03b1,_0x1126c4){var _0x2ad1bd={},_0x306bc1={},_0x5a74e8={'count':0x0,'rows':[]};var _0x2c4efd=_[_0x4aa6('0x3a')](db['SmsMessage'][_0x4aa6('0x3b')],function(_0x394319){return{'name':_0x394319[_0x4aa6('0x3c')],'type':_0x394319[_0x4aa6('0x3d')][_0x4aa6('0x3e')]};});_0x306bc1[_0x4aa6('0x3f')]=_['map'](_0x2c4efd,'name');_0x306bc1[_0x4aa6('0x40')]=_[_0x4aa6('0x41')](_0x4d03b1[_0x4aa6('0x40')]);_0x306bc1[_0x4aa6('0x42')]=_[_0x4aa6('0x43')](_0x306bc1['model'],_0x306bc1[_0x4aa6('0x40')]);_0x2ad1bd[_0x4aa6('0x44')]=_['intersection'](_0x306bc1[_0x4aa6('0x3f')],qs[_0x4aa6('0x45')](_0x4d03b1[_0x4aa6('0x40')][_0x4aa6('0x45')]));_0x2ad1bd[_0x4aa6('0x44')]=_0x2ad1bd['attributes'][_0x4aa6('0x46')]?_0x2ad1bd[_0x4aa6('0x44')]:_0x306bc1['model'];if(!_0x4d03b1[_0x4aa6('0x40')][_0x4aa6('0x47')]('nolimit')){_0x2ad1bd[_0x4aa6('0x30')]=qs[_0x4aa6('0x30')](_0x4d03b1['query'][_0x4aa6('0x30')]);_0x2ad1bd[_0x4aa6('0x2d')]=qs[_0x4aa6('0x2d')](_0x4d03b1[_0x4aa6('0x40')][_0x4aa6('0x2d')]);}_0x2ad1bd[_0x4aa6('0x48')]=qs[_0x4aa6('0x49')](_0x4d03b1['query'][_0x4aa6('0x49')]);_0x2ad1bd[_0x4aa6('0x4a')]=qs[_0x4aa6('0x42')](_[_0x4aa6('0x4b')](_0x4d03b1[_0x4aa6('0x40')],_0x306bc1[_0x4aa6('0x42')]),_0x2c4efd);if(_0x4d03b1[_0x4aa6('0x40')][_0x4aa6('0x4c')]){_0x2ad1bd['where']=_[_0x4aa6('0x4d')](_0x2ad1bd['where'],{'$or':_[_0x4aa6('0x3a')](_0x2c4efd,function(_0x2b1b48){if(_0x2b1b48[_0x4aa6('0x3d')]!=='VIRTUAL'){var _0x1c6731={};_0x1c6731[_0x2b1b48['name']]={'$like':'%'+_0x4d03b1['query'][_0x4aa6('0x4c')]+'%'};return _0x1c6731;}})});}_0x2ad1bd=_[_0x4aa6('0x4d')]({},_0x2ad1bd,_0x4d03b1['options']);var _0x1a92d4={'where':_0x2ad1bd[_0x4aa6('0x4a')]};return db['SmsMessage'][_0x4aa6('0x2f')](_0x1a92d4)['then'](function(_0x54b25c){_0x5a74e8[_0x4aa6('0x2f')]=_0x54b25c;if(_0x4d03b1['query'][_0x4aa6('0x4e')]){_0x2ad1bd[_0x4aa6('0x4f')]=[{'all':!![]}];}return db[_0x4aa6('0x50')][_0x4aa6('0x51')](_0x2ad1bd);})[_0x4aa6('0x36')](function(_0x8c5ada){_0x5a74e8[_0x4aa6('0x52')]=_0x8c5ada;return _0x5a74e8;})['then'](respondWithFilteredResult(_0x1126c4,_0x2ad1bd))['catch'](handleError(_0x1126c4,null));};exports[_0x4aa6('0x53')]=function(_0x58344c,_0x2f3ca6){var _0x4f23e0={'raw':!![],'where':{'id':_0x58344c[_0x4aa6('0x54')]['id']}},_0x193d48={};_0x193d48[_0x4aa6('0x3f')]=_[_0x4aa6('0x41')](db['SmsMessage']['rawAttributes']);_0x193d48[_0x4aa6('0x40')]=_[_0x4aa6('0x41')](_0x58344c[_0x4aa6('0x40')]);_0x193d48[_0x4aa6('0x42')]=_['intersection'](_0x193d48[_0x4aa6('0x3f')],_0x193d48[_0x4aa6('0x40')]);_0x4f23e0['attributes']=_[_0x4aa6('0x43')](_0x193d48['model'],qs[_0x4aa6('0x45')](_0x58344c[_0x4aa6('0x40')][_0x4aa6('0x45')]));_0x4f23e0[_0x4aa6('0x44')]=_0x4f23e0['attributes'][_0x4aa6('0x46')]?_0x4f23e0[_0x4aa6('0x44')]:_0x193d48[_0x4aa6('0x3f')];if(_0x58344c['query']['includeAll']){_0x4f23e0[_0x4aa6('0x4f')]=[{'all':!![]}];}_0x4f23e0=_[_0x4aa6('0x4d')]({},_0x4f23e0,_0x58344c[_0x4aa6('0x55')]);return db[_0x4aa6('0x50')]['find'](_0x4f23e0)[_0x4aa6('0x36')](handleEntityNotFound(_0x2f3ca6,null))[_0x4aa6('0x36')](respondWithResult(_0x2f3ca6,null))[_0x4aa6('0x56')](handleError(_0x2f3ca6,null));};exports[_0x4aa6('0x57')]=function(_0x5fd3ef,_0x2b0200){return db[_0x4aa6('0x50')]['create'](_0x5fd3ef[_0x4aa6('0x58')],{})['then'](respondWithResult(_0x2b0200,0xc9))['catch'](handleError(_0x2b0200,null));};exports['update']=function(_0xbc3e29,_0xc6d885){if(_0xbc3e29[_0x4aa6('0x58')]['id']){delete _0xbc3e29['body']['id'];}return db[_0x4aa6('0x50')][_0x4aa6('0x59')]({'where':{'id':_0xbc3e29[_0x4aa6('0x54')]['id']}})['then'](handleEntityNotFound(_0xc6d885,null))[_0x4aa6('0x36')](saveUpdates(_0xbc3e29[_0x4aa6('0x58')],null))[_0x4aa6('0x36')](respondWithResult(_0xc6d885,null))[_0x4aa6('0x56')](handleError(_0xc6d885,null));};exports[_0x4aa6('0x37')]=function(_0x317ceb,_0xc936cc){return db[_0x4aa6('0x50')][_0x4aa6('0x59')]({'where':{'id':_0x317ceb[_0x4aa6('0x54')]['id']}})['then'](handleEntityNotFound(_0xc936cc,null))[_0x4aa6('0x36')](removeEntity(_0xc936cc,null))[_0x4aa6('0x56')](handleError(_0xc936cc,null));};exports['describe']=function(_0x2bdec8,_0x4b41ec){return db[_0x4aa6('0x50')][_0x4aa6('0x5a')]()[_0x4aa6('0x36')](respondWithResult(_0x4b41ec,null))[_0x4aa6('0x56')](handleError(_0x4b41ec,null));};var interaction_log=require(_0x4aa6('0x5b'))('sms-interactions');exports[_0x4aa6('0x5c')]=function(_0x51c281,_0x158ec0,_0x215998){var _0x3d38dd={'agent':{},'channel':'sms'};if(_0x51c281[_0x4aa6('0x58')]['id']){delete _0x51c281[_0x4aa6('0x58')]['id'];}_0x51c281[_0x4aa6('0x58')]['read']=!![];_0x51c281['body']['readAt']=moment()['format'](_0x4aa6('0x5d'));_0x51c281[_0x4aa6('0x58')]['UserId']=_0x51c281['body'][_0x4aa6('0x5e')]||_0x51c281[_0x4aa6('0x5f')]['id'];_0x3d38dd[_0x4aa6('0x60')]['id']=_0x51c281[_0x4aa6('0x58')][_0x4aa6('0x5e')];return db[_0x4aa6('0x50')][_0x4aa6('0x59')]({'where':{'id':_0x51c281[_0x4aa6('0x54')]['id'],'UserId':null}})[_0x4aa6('0x36')](handleEntityNotFound(_0x158ec0,null))[_0x4aa6('0x36')](saveUpdates(_0x51c281[_0x4aa6('0x58')],null))[_0x4aa6('0x36')](function(_0x32d002){if(_0x32d002){_0x3d38dd[_0x4aa6('0x27')]=_0x32d002[_0x4aa6('0x61')]({'plain':!![]});return db['SmsInteraction'][_0x4aa6('0x59')]({'where':{'id':_0x32d002[_0x4aa6('0x62')]}});}return null;})[_0x4aa6('0x36')](handleEntityNotFound(_0x158ec0,null))[_0x4aa6('0x36')](function(_0x3475df){if(_0x3475df){return _0x3475df['update']({'UserId':_0x51c281[_0x4aa6('0x58')][_0x4aa6('0x5e')],'read1stAt':_[_0x4aa6('0x63')](_0x3475df['read1stAt'])?moment()[_0x4aa6('0x64')](_0x4aa6('0x5d')):undefined});}return null;})['then'](function(_0x3ff663){if(_0x3ff663){_0x3d38dd[_0x4aa6('0x65')]=_0x3ff663['get']({'plain':!![]});interaction_log[_0x4aa6('0x20')](_0x4aa6('0x66'),_0x51c281[_0x4aa6('0x5f')]['id'],_0x51c281['user'][_0x4aa6('0x38')],_0x51c281[_0x4aa6('0x5f')][_0x4aa6('0x67')],_0x3d38dd[_0x4aa6('0x65')]['id'],_0x51c281[_0x4aa6('0x58')]?JSON[_0x4aa6('0x25')](_0x51c281[_0x4aa6('0x58')]):_0x4aa6('0x68'));return respondWithRpcPromise('AcceptMessage',_0x4aa6('0x69'),_0x3d38dd);}return null;})[_0x4aa6('0x36')](function(_0x59a705){var _0x4ab963=_0x4aa6('0x6a')+_0x59a705[_0x4aa6('0x27')]['ContactId'];return db[_0x4aa6('0x6b')]['query'](_0x4ab963,{'type':db[_0x4aa6('0x6c')]['QueryTypes'][_0x4aa6('0x6d')],'raw':!![]})[_0x4aa6('0x36')](function(_0x56d929){return _0x56d929;});})[_0x4aa6('0x36')](function(_0x324c4a){if(_0x324c4a){_0x3d38dd[_0x4aa6('0x27')][_0x4aa6('0x6e')]=_0x324c4a[0x0];if(!_0x51c281[_0x4aa6('0x58')]['UserId'])return;return db['User'][_0x4aa6('0x59')]({'where':{'id':_0x51c281[_0x4aa6('0x58')][_0x4aa6('0x5e')],'role':_0x4aa6('0x60')},'attributes':['id',_0x4aa6('0x38'),_0x4aa6('0x6f'),_0x4aa6('0x70'),_0x4aa6('0x71')],'raw':!![]});}return null;})[_0x4aa6('0x36')](function(_0x26a145){if(!_0x26a145)return null;_0x3d38dd['message'][_0x4aa6('0x60')]=_0x26a145;return _0x3d38dd;})['then'](function(_0xb0c64b){if(_0xb0c64b){if(_0x51c281[_0x4aa6('0x58')][_0x4aa6('0x72')]){_0x3d38dd[_0x4aa6('0x27')]['interface']=util[_0x4aa6('0x64')](_0x4aa6('0x73'),_0x51c281['user'][_0x4aa6('0x38')]);_0x3d38dd[_0x4aa6('0x27')][_0x4aa6('0x74')]=_0x3d38dd[_0x4aa6('0x74')];_0x3d38dd[_0x4aa6('0x27')][_0x4aa6('0x75')]=_0x3d38dd[_0x4aa6('0x74')];_0x3d38dd[_0x4aa6('0x27')][_0x4aa6('0x76')]=_0x4aa6('0x5c');return respondWithRpcPromise(_0x4aa6('0x77'),_0x4aa6('0x77'),{'event':_0x4aa6('0x78'),'message':_0x3d38dd['message']},client9002)[_0x4aa6('0x36')](function(){return _0x3d38dd;});}return _0x3d38dd;}return null;})[_0x4aa6('0x36')](respondWithResult(_0x158ec0,null))[_0x4aa6('0x56')](handleError(_0x158ec0,null));};var interaction_log=require(_0x4aa6('0x5b'))('sms-interactions');exports[_0x4aa6('0x33')]=function(_0xdf485a,_0x39790f,_0x587b25){var _0xbd8423={'agent':{},'channel':_0x4aa6('0x79')};if(_0xdf485a[_0x4aa6('0x58')]['id']){delete _0xdf485a[_0x4aa6('0x58')]['id'];}_0xdf485a['body'][_0x4aa6('0x5e')]=_0xdf485a[_0x4aa6('0x58')][_0x4aa6('0x5e')]||_0xdf485a[_0x4aa6('0x5f')]['id'];_0xbd8423[_0x4aa6('0x60')]['id']=_0xdf485a['body']['UserId'];return db['SmsMessage'][_0x4aa6('0x59')]({'where':{'id':_0xdf485a[_0x4aa6('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x39790f,null))['then'](function(_0x31d1d9){if(_0x31d1d9){_0xbd8423[_0x4aa6('0x27')]=_0x31d1d9['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x31d1d9['SmsInteractionId']}});}return null;})[_0x4aa6('0x36')](handleEntityNotFound(_0x39790f,null))['then'](function(_0x120de2){if(_0x120de2){_0xbd8423[_0x4aa6('0x65')]=_0x120de2[_0x4aa6('0x61')]({'plain':!![]});interaction_log[_0x4aa6('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xdf485a['user']['id'],_0xdf485a[_0x4aa6('0x5f')][_0x4aa6('0x38')],_0xdf485a[_0x4aa6('0x5f')][_0x4aa6('0x67')],_0xbd8423[_0x4aa6('0x65')]['id'],_0xdf485a['body']?JSON[_0x4aa6('0x25')](_0xdf485a[_0x4aa6('0x58')]):_0x4aa6('0x68'));return respondWithRpcPromise(_0x4aa6('0x7a'),_0x4aa6('0x7b'),_0xbd8423);}return null;})[_0x4aa6('0x36')](function(_0x514400){var _0xcaee59=_0x4aa6('0x6a')+_0x514400[_0x4aa6('0x27')][_0x4aa6('0x7c')];return db[_0x4aa6('0x6b')][_0x4aa6('0x40')](_0xcaee59,{'type':db[_0x4aa6('0x6c')][_0x4aa6('0x7d')][_0x4aa6('0x6d')],'raw':!![]})['then'](function(_0x5640fd){return _0x5640fd;});})[_0x4aa6('0x36')](function(_0x34da8f){if(_0x34da8f){_0xbd8423[_0x4aa6('0x27')][_0x4aa6('0x6e')]=_0x34da8f[0x0];if(!_0xdf485a[_0x4aa6('0x58')][_0x4aa6('0x5e')])return;return db[_0x4aa6('0x7e')][_0x4aa6('0x59')]({'where':{'id':_0xdf485a[_0x4aa6('0x58')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0x4aa6('0x70'),_0x4aa6('0x71')],'raw':!![]});}return null;})[_0x4aa6('0x36')](function(_0x10e1d1){if(!_0x10e1d1)return null;_0xbd8423['message'][_0x4aa6('0x60')]=_0x10e1d1;return _0xbd8423;})[_0x4aa6('0x36')](function(_0x38baba){if(_0x38baba){_0x38baba[_0x4aa6('0x27')][_0x4aa6('0x7f')]=util[_0x4aa6('0x64')](_0x4aa6('0x73'),_0xdf485a[_0x4aa6('0x5f')][_0x4aa6('0x38')]);_0x38baba[_0x4aa6('0x27')]['channel']=_0xbd8423[_0x4aa6('0x74')];_0x38baba['message'][_0x4aa6('0x75')]=_0xbd8423[_0x4aa6('0x74')];_0x38baba[_0x4aa6('0x27')][_0x4aa6('0x76')]=_0x4aa6('0x33');respondWithRpcPromise(_0x4aa6('0x77'),'EventManager',{'event':'rejectmessage','message':_0x38baba[_0x4aa6('0x27')]},client9002);return _0xbd8423;}return null;})[_0x4aa6('0x36')](respondWithResult(_0x39790f,null))[_0x4aa6('0x56')](handleError(_0x39790f,null));};exports[_0x4aa6('0x2a')]=function(_0x1847c0,_0x15f05c,_0x3b670b){if(_0x1847c0[_0x4aa6('0x58')]['id']){delete _0x1847c0['body']['id'];}var _0x14f9bb;return db[_0x4aa6('0x50')][_0x4aa6('0x59')]({'where':{'id':_0x1847c0[_0x4aa6('0x54')]['id']}})['then'](handleEntityNotFound(_0x15f05c,null))['then'](function(_0x2d1807){if(_0x2d1807){_0x14f9bb=_0x2d1807;return db['SmsAccount'][_0x4aa6('0x59')]({'where':{'id':_0x2d1807[_0x4aa6('0x80')]}});}})[_0x4aa6('0x36')](handleEntityNotFound(_0x15f05c,null))[_0x4aa6('0x36')](function(_0x2bcede){if(_0x2bcede){logger[_0x4aa6('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4aa6('0x2a'),'received\x20delivery\x20report\x20from',_0x2bcede[_0x4aa6('0x3d')],util[_0x4aa6('0x81')](_0x1847c0[_0x4aa6('0x58')],{'showHidden':![],'depth':null}));switch(_0x2bcede[_0x4aa6('0x3d')]){case _0x4aa6('0x82'):if(_0x1847c0['body'][_0x4aa6('0x83')]&&_0x1847c0[_0x4aa6('0x58')]['MessageSid']===_0x14f9bb[_0x4aa6('0x84')]){return _0x14f9bb[_0x4aa6('0x35')]({'read':!![]});}else{logger[_0x4aa6('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x4aa6('0x81')](_0x1847c0[_0x4aa6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x4aa6('0x85'):if(_0x1847c0[_0x4aa6('0x58')][_0x4aa6('0x86')]&&_0x1847c0[_0x4aa6('0x58')][_0x4aa6('0x86')]===_0x14f9bb[_0x4aa6('0x84')]&&_[_0x4aa6('0x87')]([_0x4aa6('0x88'),_0x4aa6('0x89')],_0x1847c0['body'][_0x4aa6('0x8a')])>=0x0){return _0x14f9bb[_0x4aa6('0x35')]({'read':!![]});}else{logger[_0x4aa6('0x26')](_0x4aa6('0x8b'),_0x4aa6('0x2a'),_0x4aa6('0x8c'),util[_0x4aa6('0x81')](_0x1847c0['body'],{'showHidden':![],'depth':null}));}break;case _0x4aa6('0x8d'):var _0x56df9d=_0x1847c0[_0x4aa6('0x58')][_0x4aa6('0x8e')][0x0];if(_0x56df9d[_0x4aa6('0x2a')][_0x4aa6('0x8f')]===_0x4aa6('0x90')){return _0x14f9bb[_0x4aa6('0x35')]({'read':!![]});}else{logger[_0x4aa6('0x26')](_0x4aa6('0x8b'),_0x4aa6('0x2a'),_0x4aa6('0x8d'),util[_0x4aa6('0x81')](_0x1847c0[_0x4aa6('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x14f9bb;}})[_0x4aa6('0x36')](respondWithResult(_0x15f05c,null))[_0x4aa6('0x56')](handleError(_0x15f05c,null));}; \ No newline at end of file +var _0x89fb=['SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','User','motionChannel','rejectmessage','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','then','destroy','stack','name','send','map','SmsMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','create','body','update','describe','../../config/logger','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','user','role','null','acceptMessage','sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x89fb,0x14b));var _0xb89f=function(_0x5a152b,_0x341c18){_0x5a152b=_0x5a152b-0x0;var _0x25c8b1=_0x89fb[_0x5a152b];return _0x25c8b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb89f('0x0'));var zipdir=require(_0xb89f('0x1'));var jsonpatch=require(_0xb89f('0x2'));var rp=require(_0xb89f('0x3'));var moment=require(_0xb89f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb89f('0x5'));var util=require(_0xb89f('0x6'));var path=require(_0xb89f('0x7'));var sox=require(_0xb89f('0x8'));var csv=require(_0xb89f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb89f('0xa'));var _=require('lodash');var squel=require(_0xb89f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb89f('0xc'));var deskjs=require(_0xb89f('0xd'));var toCsv=require(_0xb89f('0x9'));var querystring=require('querystring');var Papa=require(_0xb89f('0xe'));var Redis=require(_0xb89f('0xf'));var authService=require(_0xb89f('0x10'));var qs=require(_0xb89f('0x11'));var as=require(_0xb89f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb89f('0x13'));var utils=require(_0xb89f('0x14'));var config=require(_0xb89f('0x15'));var licenseUtil=require(_0xb89f('0x16'));var db=require(_0xb89f('0x17'))['db'];config['redis']=_[_0xb89f('0x18')](config[_0xb89f('0x19')],{'host':_0xb89f('0x1a'),'port':0x18eb});var socket=require(_0xb89f('0x1b'))(new Redis(config[_0xb89f('0x19')]));require(_0xb89f('0x1c'))['register'](socket);var jayson=require(_0xb89f('0x1d'));var client=jayson[_0xb89f('0x1e')][_0xb89f('0x1f')]({'port':0x232c});var client9002=jayson[_0xb89f('0x1e')][_0xb89f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x10ffba,_0xb33497,_0x4d7a92,_0x243388){return new BPromise(function(_0xfc48d,_0x236c5b){var _0x43b231=_0x243388||client;return _0x43b231['request'](_0x10ffba,_0x4d7a92)['then'](function(_0x77a882){logger[_0xb89f('0x20')](_0xb89f('0x21'),_0xb33497,'request\x20sent');logger['debug'](_0xb89f('0x22'),_0xb33497,_0xb89f('0x23'),JSON[_0xb89f('0x24')](_0x77a882));if(_0x77a882[_0xb89f('0x25')]){if(_0x77a882[_0xb89f('0x25')][_0xb89f('0x26')]===0x1f4){logger[_0xb89f('0x25')]('SmsMessage,\x20%s,\x20%s',_0xb33497,_0x77a882['error']['message']);return _0x236c5b(_0x77a882['error']['message']);}logger[_0xb89f('0x25')]('SmsMessage,\x20%s,\x20%s',_0xb33497,_0x77a882[_0xb89f('0x25')][_0xb89f('0x27')]);return _0xfc48d(_0x77a882[_0xb89f('0x25')][_0xb89f('0x27')]);}else{logger[_0xb89f('0x20')](_0xb89f('0x21'),_0xb33497,'request\x20sent');_0xfc48d(_0x77a882[_0xb89f('0x28')][_0xb89f('0x27')]);}})[_0xb89f('0x29')](function(_0x3b3829){logger[_0xb89f('0x25')](_0xb89f('0x21'),_0xb33497,_0x3b3829);_0x236c5b(_0x3b3829);});});}function respondWithStatusCode(_0x1934e8,_0x177db8){_0x177db8=_0x177db8||0xcc;return function(_0x4bef2e){if(_0x4bef2e){return _0x1934e8[_0xb89f('0x2a')](_0x177db8);}return _0x1934e8[_0xb89f('0x2b')](_0x177db8)[_0xb89f('0x2c')]();};}function respondWithResult(_0x38983e,_0x1defa1){_0x1defa1=_0x1defa1||0xc8;return function(_0x22195c){if(_0x22195c){return _0x38983e['status'](_0x1defa1)[_0xb89f('0x2d')](_0x22195c);}};}function respondWithFilteredResult(_0x22b15f,_0x289d88){return function(_0x2ab40c){if(_0x2ab40c){var _0x4eb8da=typeof _0x289d88['offset']==='undefined'&&typeof _0x289d88[_0xb89f('0x2e')]===_0xb89f('0x2f');var _0x3ce71d=_0x2ab40c[_0xb89f('0x30')];var _0x283091=_0x4eb8da?0x0:_0x289d88[_0xb89f('0x31')];var _0x215925=_0x4eb8da?_0x2ab40c[_0xb89f('0x30')]:_0x289d88[_0xb89f('0x31')]+_0x289d88['limit'];var _0x17076d;if(_0x215925>=_0x3ce71d){_0x215925=_0x3ce71d;_0x17076d=0xc8;}else{_0x17076d=0xce;}_0x22b15f[_0xb89f('0x2b')](_0x17076d);return _0x22b15f['set'](_0xb89f('0x32'),_0x283091+'-'+_0x215925+'/'+_0x3ce71d)[_0xb89f('0x2d')](_0x2ab40c);}return null;};}function patchUpdates(_0x11ddbc){return function(_0xa0833d){try{jsonpatch['apply'](_0xa0833d,_0x11ddbc,!![]);}catch(_0x39cd78){return BPromise[_0xb89f('0x33')](_0x39cd78);}return _0xa0833d[_0xb89f('0x34')]();};}function saveUpdates(_0x11cef3,_0x4cda3d){return function(_0x4c2695){if(_0x4c2695){return _0x4c2695['update'](_0x11cef3)[_0xb89f('0x35')](function(_0x1cc704){return _0x1cc704;});}return null;};}function removeEntity(_0x3909a8,_0x4a5c19){return function(_0x465e68){if(_0x465e68){return _0x465e68[_0xb89f('0x36')]()[_0xb89f('0x35')](function(){_0x3909a8['status'](0xcc)[_0xb89f('0x2c')]();});}};}function handleEntityNotFound(_0x18578f,_0x19ad82){return function(_0x3fa6e6){if(!_0x3fa6e6){_0x18578f[_0xb89f('0x2a')](0x194);}return _0x3fa6e6;};}function handleError(_0x3a27a9,_0x3e49f4){_0x3e49f4=_0x3e49f4||0x1f4;return function(_0x4d70d2){logger[_0xb89f('0x25')](_0x4d70d2[_0xb89f('0x37')]);if(_0x4d70d2[_0xb89f('0x38')]){delete _0x4d70d2[_0xb89f('0x38')];}_0x3a27a9['status'](_0x3e49f4)[_0xb89f('0x39')](_0x4d70d2);};}exports['index']=function(_0x388606,_0x1bea30){var _0x5dc041={},_0x1b07b7={},_0x10ab12={'count':0x0,'rows':[]};var _0x2462cd=_[_0xb89f('0x3a')](db[_0xb89f('0x3b')]['rawAttributes'],function(_0x5d7b55){return{'name':_0x5d7b55[_0xb89f('0x3c')],'type':_0x5d7b55[_0xb89f('0x3d')][_0xb89f('0x3e')]};});_0x1b07b7[_0xb89f('0x3f')]=_[_0xb89f('0x3a')](_0x2462cd,_0xb89f('0x38'));_0x1b07b7['query']=_[_0xb89f('0x40')](_0x388606[_0xb89f('0x41')]);_0x1b07b7[_0xb89f('0x42')]=_[_0xb89f('0x43')](_0x1b07b7['model'],_0x1b07b7[_0xb89f('0x41')]);_0x5dc041[_0xb89f('0x44')]=_[_0xb89f('0x43')](_0x1b07b7['model'],qs[_0xb89f('0x45')](_0x388606[_0xb89f('0x41')][_0xb89f('0x45')]));_0x5dc041['attributes']=_0x5dc041[_0xb89f('0x44')][_0xb89f('0x46')]?_0x5dc041['attributes']:_0x1b07b7['model'];if(!_0x388606['query']['hasOwnProperty'](_0xb89f('0x47'))){_0x5dc041['limit']=qs[_0xb89f('0x2e')](_0x388606[_0xb89f('0x41')][_0xb89f('0x2e')]);_0x5dc041[_0xb89f('0x31')]=qs['offset'](_0x388606[_0xb89f('0x41')][_0xb89f('0x31')]);}_0x5dc041[_0xb89f('0x48')]=qs[_0xb89f('0x49')](_0x388606[_0xb89f('0x41')][_0xb89f('0x49')]);_0x5dc041[_0xb89f('0x4a')]=qs[_0xb89f('0x42')](_[_0xb89f('0x4b')](_0x388606[_0xb89f('0x41')],_0x1b07b7[_0xb89f('0x42')]),_0x2462cd);if(_0x388606[_0xb89f('0x41')][_0xb89f('0x4c')]){_0x5dc041['where']=_[_0xb89f('0x4d')](_0x5dc041[_0xb89f('0x4a')],{'$or':_[_0xb89f('0x3a')](_0x2462cd,function(_0x46370b){if(_0x46370b[_0xb89f('0x3d')]!==_0xb89f('0x4e')){var _0x3b028e={};_0x3b028e[_0x46370b['name']]={'$like':'%'+_0x388606[_0xb89f('0x41')]['filter']+'%'};return _0x3b028e;}})});}_0x5dc041=_[_0xb89f('0x4d')]({},_0x5dc041,_0x388606['options']);var _0x7b3c1b={'where':_0x5dc041[_0xb89f('0x4a')]};return db[_0xb89f('0x3b')]['count'](_0x7b3c1b)[_0xb89f('0x35')](function(_0x5d315b){_0x10ab12[_0xb89f('0x30')]=_0x5d315b;if(_0x388606[_0xb89f('0x41')][_0xb89f('0x4f')]){_0x5dc041['include']=[{'all':!![]}];}return db[_0xb89f('0x3b')][_0xb89f('0x50')](_0x5dc041);})['then'](function(_0x667859){_0x10ab12[_0xb89f('0x51')]=_0x667859;return _0x10ab12;})[_0xb89f('0x35')](respondWithFilteredResult(_0x1bea30,_0x5dc041))[_0xb89f('0x29')](handleError(_0x1bea30,null));};exports[_0xb89f('0x52')]=function(_0x3c5421,_0x29ad5f){var _0x30109e={'raw':!![],'where':{'id':_0x3c5421[_0xb89f('0x53')]['id']}},_0x61e636={};_0x61e636['model']=_['keys'](db[_0xb89f('0x3b')][_0xb89f('0x54')]);_0x61e636[_0xb89f('0x41')]=_[_0xb89f('0x40')](_0x3c5421['query']);_0x61e636['filters']=_[_0xb89f('0x43')](_0x61e636['model'],_0x61e636['query']);_0x30109e[_0xb89f('0x44')]=_['intersection'](_0x61e636[_0xb89f('0x3f')],qs[_0xb89f('0x45')](_0x3c5421[_0xb89f('0x41')][_0xb89f('0x45')]));_0x30109e[_0xb89f('0x44')]=_0x30109e['attributes'][_0xb89f('0x46')]?_0x30109e[_0xb89f('0x44')]:_0x61e636[_0xb89f('0x3f')];if(_0x3c5421[_0xb89f('0x41')][_0xb89f('0x4f')]){_0x30109e[_0xb89f('0x55')]=[{'all':!![]}];}_0x30109e=_['merge']({},_0x30109e,_0x3c5421[_0xb89f('0x56')]);return db[_0xb89f('0x3b')][_0xb89f('0x57')](_0x30109e)[_0xb89f('0x35')](handleEntityNotFound(_0x29ad5f,null))[_0xb89f('0x35')](respondWithResult(_0x29ad5f,null))[_0xb89f('0x29')](handleError(_0x29ad5f,null));};exports[_0xb89f('0x58')]=function(_0x496c1d,_0x1f19bb){return db[_0xb89f('0x3b')]['create'](_0x496c1d[_0xb89f('0x59')],{})[_0xb89f('0x35')](respondWithResult(_0x1f19bb,0xc9))['catch'](handleError(_0x1f19bb,null));};exports[_0xb89f('0x5a')]=function(_0x33cede,_0x2ce1a0){if(_0x33cede['body']['id']){delete _0x33cede['body']['id'];}return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x33cede['params']['id']}})[_0xb89f('0x35')](handleEntityNotFound(_0x2ce1a0,null))['then'](saveUpdates(_0x33cede[_0xb89f('0x59')],null))[_0xb89f('0x35')](respondWithResult(_0x2ce1a0,null))[_0xb89f('0x29')](handleError(_0x2ce1a0,null));};exports[_0xb89f('0x36')]=function(_0x4608d6,_0x448aea){return db['SmsMessage'][_0xb89f('0x57')]({'where':{'id':_0x4608d6[_0xb89f('0x53')]['id']}})['then'](handleEntityNotFound(_0x448aea,null))[_0xb89f('0x35')](removeEntity(_0x448aea,null))[_0xb89f('0x29')](handleError(_0x448aea,null));};exports['describe']=function(_0x4918c0,_0x11b8ff){return db[_0xb89f('0x3b')][_0xb89f('0x5b')]()['then'](respondWithResult(_0x11b8ff,null))[_0xb89f('0x29')](handleError(_0x11b8ff,null));};var interaction_log=require(_0xb89f('0x5c'))(_0xb89f('0x5d'));exports[_0xb89f('0x5e')]=function(_0x462da9,_0x5c1500,_0x5d8d92){var _0xd8727={'agent':{},'channel':'sms'};if(_0x462da9[_0xb89f('0x59')]['id']){delete _0x462da9['body']['id'];}_0x462da9[_0xb89f('0x59')][_0xb89f('0x5f')]=!![];_0x462da9[_0xb89f('0x59')][_0xb89f('0x60')]=moment()[_0xb89f('0x61')](_0xb89f('0x62'));_0x462da9[_0xb89f('0x59')]['UserId']=_0x462da9[_0xb89f('0x59')][_0xb89f('0x63')]||_0x462da9['user']['id'];_0xd8727[_0xb89f('0x64')]['id']=_0x462da9[_0xb89f('0x59')]['UserId'];return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x462da9[_0xb89f('0x53')]['id'],'UserId':null}})[_0xb89f('0x35')](handleEntityNotFound(_0x5c1500,null))['then'](saveUpdates(_0x462da9[_0xb89f('0x59')],null))[_0xb89f('0x35')](function(_0xa2cedd){if(_0xa2cedd){_0xd8727[_0xb89f('0x27')]=_0xa2cedd[_0xb89f('0x65')]({'plain':!![]});return db['SmsInteraction'][_0xb89f('0x57')]({'where':{'id':_0xa2cedd['SmsInteractionId']}});}return null;})[_0xb89f('0x35')](handleEntityNotFound(_0x5c1500,null))[_0xb89f('0x35')](function(_0x56117e){if(_0x56117e){return _0x56117e[_0xb89f('0x5a')]({'UserId':_0x462da9[_0xb89f('0x59')]['UserId'],'read1stAt':_[_0xb89f('0x66')](_0x56117e[_0xb89f('0x67')])?moment()[_0xb89f('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb89f('0x35')](function(_0x2c489b){if(_0x2c489b){_0xd8727[_0xb89f('0x68')]=_0x2c489b['get']({'plain':!![]});interaction_log[_0xb89f('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x462da9[_0xb89f('0x69')]['id'],_0x462da9[_0xb89f('0x69')][_0xb89f('0x38')],_0x462da9[_0xb89f('0x69')][_0xb89f('0x6a')],_0xd8727['interaction']['id'],_0x462da9[_0xb89f('0x59')]?JSON[_0xb89f('0x24')](_0x462da9[_0xb89f('0x59')]):_0xb89f('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xb89f('0x6c'),_0xd8727);}return null;})[_0xb89f('0x35')](function(_0x742e1a){var _0xccb9e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x742e1a['message']['ContactId'];return db[_0xb89f('0x6d')][_0xb89f('0x41')](_0xccb9e1,{'type':db['Sequelize'][_0xb89f('0x6e')][_0xb89f('0x6f')],'raw':!![]})[_0xb89f('0x35')](function(_0x4df87d){return _0x4df87d;});})[_0xb89f('0x35')](function(_0x31e97c){if(_0x31e97c){_0xd8727[_0xb89f('0x27')]['contact']=_0x31e97c[0x0];if(!_0x462da9[_0xb89f('0x59')][_0xb89f('0x63')])return;return db['User'][_0xb89f('0x57')]({'where':{'id':_0x462da9[_0xb89f('0x59')][_0xb89f('0x63')],'role':_0xb89f('0x64')},'attributes':['id',_0xb89f('0x38'),_0xb89f('0x70'),_0xb89f('0x71'),_0xb89f('0x72')],'raw':!![]});}return null;})[_0xb89f('0x35')](function(_0x489a73){if(!_0x489a73)return null;_0xd8727[_0xb89f('0x27')]['agent']=_0x489a73;return _0xd8727;})[_0xb89f('0x35')](function(_0x2024c0){if(_0x2024c0){if(_0x462da9[_0xb89f('0x59')][_0xb89f('0x73')]){_0xd8727[_0xb89f('0x27')][_0xb89f('0x74')]=util[_0xb89f('0x61')](_0xb89f('0x75'),_0x462da9[_0xb89f('0x69')][_0xb89f('0x38')]);_0xd8727[_0xb89f('0x27')][_0xb89f('0x76')]=_0xd8727[_0xb89f('0x76')];_0xd8727[_0xb89f('0x27')]['motionChannel']=_0xd8727['channel'];_0xd8727[_0xb89f('0x27')][_0xb89f('0x77')]=_0xb89f('0x5e');return respondWithRpcPromise(_0xb89f('0x78'),_0xb89f('0x78'),{'event':_0xb89f('0x79'),'message':_0xd8727[_0xb89f('0x27')]},client9002)[_0xb89f('0x35')](function(){return _0xd8727;});}return _0xd8727;}return null;})[_0xb89f('0x35')](respondWithResult(_0x5c1500,null))[_0xb89f('0x29')](handleError(_0x5c1500,null));};var interaction_log=require(_0xb89f('0x5c'))(_0xb89f('0x5d'));exports[_0xb89f('0x33')]=function(_0x174181,_0x414b56,_0x1a7060){var _0x3ffd8f={'agent':{},'channel':'sms'};if(_0x174181[_0xb89f('0x59')]['id']){delete _0x174181[_0xb89f('0x59')]['id'];}_0x174181[_0xb89f('0x59')][_0xb89f('0x63')]=_0x174181['body']['UserId']||_0x174181[_0xb89f('0x69')]['id'];_0x3ffd8f[_0xb89f('0x64')]['id']=_0x174181['body'][_0xb89f('0x63')];return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x174181[_0xb89f('0x53')]['id'],'UserId':null}})[_0xb89f('0x35')](handleEntityNotFound(_0x414b56,null))[_0xb89f('0x35')](function(_0x497a15){if(_0x497a15){_0x3ffd8f[_0xb89f('0x27')]=_0x497a15[_0xb89f('0x65')]({'plain':!![]});return db[_0xb89f('0x7a')][_0xb89f('0x57')]({'where':{'id':_0x497a15[_0xb89f('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x414b56,null))[_0xb89f('0x35')](function(_0x819aa4){if(_0x819aa4){_0x3ffd8f[_0xb89f('0x68')]=_0x819aa4[_0xb89f('0x65')]({'plain':!![]});interaction_log['info'](_0xb89f('0x7c'),_0x174181['user']['id'],_0x174181['user'][_0xb89f('0x38')],_0x174181[_0xb89f('0x69')][_0xb89f('0x6a')],_0x3ffd8f[_0xb89f('0x68')]['id'],_0x174181[_0xb89f('0x59')]?JSON['stringify'](_0x174181['body']):_0xb89f('0x6b'));return respondWithRpcPromise(_0xb89f('0x7d'),_0xb89f('0x7e'),_0x3ffd8f);}return null;})[_0xb89f('0x35')](function(_0x1c1aa1){var _0x2ada7=_0xb89f('0x7f')+_0x1c1aa1['message'][_0xb89f('0x80')];return db['sequelize']['query'](_0x2ada7,{'type':db[_0xb89f('0x81')][_0xb89f('0x6e')][_0xb89f('0x6f')],'raw':!![]})[_0xb89f('0x35')](function(_0x16defe){return _0x16defe;});})[_0xb89f('0x35')](function(_0x541467){if(_0x541467){_0x3ffd8f[_0xb89f('0x27')][_0xb89f('0x82')]=_0x541467[0x0];if(!_0x174181[_0xb89f('0x59')]['UserId'])return;return db[_0xb89f('0x83')][_0xb89f('0x57')]({'where':{'id':_0x174181[_0xb89f('0x59')][_0xb89f('0x63')],'role':_0xb89f('0x64')},'attributes':['id',_0xb89f('0x38'),'fullname',_0xb89f('0x71'),_0xb89f('0x72')],'raw':!![]});}return null;})[_0xb89f('0x35')](function(_0x1ddf08){if(!_0x1ddf08)return null;_0x3ffd8f[_0xb89f('0x27')][_0xb89f('0x64')]=_0x1ddf08;return _0x3ffd8f;})[_0xb89f('0x35')](function(_0x272011){if(_0x272011){_0x272011['message']['interface']=util[_0xb89f('0x61')](_0xb89f('0x75'),_0x174181[_0xb89f('0x69')]['name']);_0x272011[_0xb89f('0x27')][_0xb89f('0x76')]=_0x3ffd8f[_0xb89f('0x76')];_0x272011['message'][_0xb89f('0x84')]=_0x3ffd8f[_0xb89f('0x76')];_0x272011['message'][_0xb89f('0x77')]=_0xb89f('0x33');respondWithRpcPromise(_0xb89f('0x78'),_0xb89f('0x78'),{'event':_0xb89f('0x85'),'message':_0x272011['message']},client9002);return _0x3ffd8f;}return null;})[_0xb89f('0x35')](respondWithResult(_0x414b56,null))[_0xb89f('0x29')](handleError(_0x414b56,null));};exports[_0xb89f('0x2b')]=function(_0x207fed,_0x11ba25,_0x181ee2){if(_0x207fed[_0xb89f('0x59')]['id']){delete _0x207fed['body']['id'];}var _0x3bf1a3;return db[_0xb89f('0x3b')][_0xb89f('0x57')]({'where':{'id':_0x207fed['params']['id']}})[_0xb89f('0x35')](handleEntityNotFound(_0x11ba25,null))[_0xb89f('0x35')](function(_0x2d0123){if(_0x2d0123){_0x3bf1a3=_0x2d0123;return db['SmsAccount'][_0xb89f('0x57')]({'where':{'id':_0x2d0123[_0xb89f('0x86')]}});}})[_0xb89f('0x35')](handleEntityNotFound(_0x11ba25,null))[_0xb89f('0x35')](function(_0x3baa1b){if(_0x3baa1b){logger[_0xb89f('0x87')](_0xb89f('0x22'),_0xb89f('0x2b'),_0xb89f('0x88'),_0x3baa1b['type'],util[_0xb89f('0x89')](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));switch(_0x3baa1b[_0xb89f('0x3d')]){case'twilio':if(_0x207fed['body']['MessageSid']&&_0x207fed[_0xb89f('0x59')]['MessageSid']===_0x3bf1a3[_0xb89f('0x8a')]){return _0x3bf1a3[_0xb89f('0x5a')]({'read':!![]});}else{logger[_0xb89f('0x25')](_0xb89f('0x8b'),_0xb89f('0x2b'),_0xb89f('0x8c'),util[_0xb89f('0x89')](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb89f('0x8d'):if(_0x207fed['body']['MessageUUID']&&_0x207fed['body'][_0xb89f('0x8e')]===_0x3bf1a3[_0xb89f('0x8a')]&&_[_0xb89f('0x8f')]([_0xb89f('0x90'),_0xb89f('0x91')],_0x207fed[_0xb89f('0x59')][_0xb89f('0x92')])>=0x0){return _0x3bf1a3[_0xb89f('0x5a')]({'read':!![]});}else{logger['error'](_0xb89f('0x8b'),'status','plivio',util[_0xb89f('0x89')](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));}break;case _0xb89f('0x93'):var _0xf9cd1=_0x207fed[_0xb89f('0x59')][_0xb89f('0x94')][0x0];if(_0xf9cd1[_0xb89f('0x2b')][_0xb89f('0x95')]===_0xb89f('0x96')){return _0x3bf1a3[_0xb89f('0x5a')]({'read':!![]});}else{logger[_0xb89f('0x25')](_0xb89f('0x8b'),_0xb89f('0x2b'),_0xb89f('0x93'),util['inspect'](_0x207fed[_0xb89f('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x3bf1a3;}})[_0xb89f('0x35')](respondWithResult(_0x11ba25,null))[_0xb89f('0x29')](handleError(_0x11ba25,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index adfed9b..a5bf2ce 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 _0x4346=['SmsMessage','setMaxListeners','save','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x58c363,_0x24c11c){var _0x2664fa=function(_0x4ef9cd){while(--_0x4ef9cd){_0x58c363['push'](_0x58c363['shift']());}};_0x2664fa(++_0x24c11c);}(_0x4346,0x15e));var _0x6434=function(_0x251fa4,_0x3d5860){_0x251fa4=_0x251fa4-0x0;var _0x453047=_0x4346[_0x251fa4];return _0x453047;};'use strict';var EventEmitter=require(_0x6434('0x0'));var SmsMessage=require(_0x6434('0x1'))['db'][_0x6434('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6434('0x3')](0x0);var events={'afterCreate':_0x6434('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x24849b){return function(_0x372a2c,_0x5df8bd,_0x23b15a){SmsMessageEvents[_0x6434('0x5')](_0x24849b+':'+_0x372a2c['id'],_0x372a2c);SmsMessageEvents['emit'](_0x24849b,_0x372a2c);_0x23b15a(null);};}for(var e in events){if(events[_0x6434('0x6')](e)){var event=events[e];SmsMessage[_0x6434('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x059c=['events','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x38d595,_0x58c96f){var _0x43a940=function(_0x3e8102){while(--_0x3e8102){_0x38d595['push'](_0x38d595['shift']());}};_0x43a940(++_0x58c96f);}(_0x059c,0x1d0));var _0xc059=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x059c[_0x50e40b];return _0x2608b7;};'use strict';var EventEmitter=require(_0xc059('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc059('0x1')](0x0);var events={'afterCreate':_0xc059('0x2'),'afterUpdate':_0xc059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f7c21){return function(_0x4160f9,_0x9d046f,_0x1ce1da){SmsMessageEvents[_0xc059('0x4')](_0x1f7c21+':'+_0x4160f9['id'],_0x4160f9);SmsMessageEvents[_0xc059('0x4')](_0x1f7c21,_0x4160f9);_0x1ce1da(null);};}for(var e in events){if(events[_0xc059('0x5')](e)){var event=events[e];SmsMessage[_0xc059('0x6')](e,emitEvent(event));}}module[_0xc059('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 043d4f4..b49a72e 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 _0xc449=['POST','user_key','session_key','total_sent','internal_order_id','read','connectel','senderString','requestid','deliveryReport','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','/api/sms/messages/','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messageId','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','hex','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','isNil','SmsInteraction','findOne','then','update','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','split','sms'];(function(_0x125233,_0x522bf1){var _0x42d385=function(_0x5544d5){while(--_0x5544d5){_0x125233['push'](_0x125233['shift']());}};_0x42d385(++_0x522bf1);}(_0xc449,0x147));var _0x9c44=function(_0x1f139b,_0x3c35c0){_0x1f139b=_0x1f139b-0x0;var _0x3fed20=_0xc449[_0x1f139b];return _0x3fed20;};'use strict';var _=require(_0x9c44('0x0'));var util=require(_0x9c44('0x1'));var logger=require(_0x9c44('0x2'))(_0x9c44('0x3'));var moment=require(_0x9c44('0x4'));var BPromise=require(_0x9c44('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c44('0x6'));var rimraf=require(_0x9c44('0x7'));var config=require(_0x9c44('0x8'));var attributes=require(_0x9c44('0x9'));module['exports']=function(_0x314a23,_0x4e7a4e){return _0x314a23[_0x9c44('0xa')](_0x9c44('0xb'),attributes,{'tableName':_0x9c44('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x9c44('0xd'),'fields':[_0x9c44('0xe')],'type':_0x9c44('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a4350,_0x25399a,_0x1f215c){var _0x99eeeb=_0x314a23[_0x9c44('0x10')];var _0x1e927c=_0x3a4350['get']({'plain':!![]});if(_0x1e927c[_0x9c44('0x11')][_0x9c44('0x12')]()==='in'||_0x1e927c[_0x9c44('0x11')][_0x9c44('0x12')]()===_0x9c44('0x13')&&!_0x1e927c[_0x9c44('0x14')]&&!_['isNil'](_0x1e927c[_0x9c44('0x15')])&&!_[_0x9c44('0x16')](_0x1e927c['SmsInteractionId'])){_0x99eeeb[_0x9c44('0x17')][_0x9c44('0x18')]({'where':{'id':_0x1e927c['SmsInteractionId']}})[_0x9c44('0x19')](function(_0x5c708e){if(_0x5c708e){_0x5c708e[_0x9c44('0x1a')]({'lastMsgAt':_0x1e927c['createdAt'],'lastMsgDirection':_0x1e927c[_0x9c44('0x11')][_0x9c44('0x12')]()});}})[_0x9c44('0x1b')](function(_0x33d153){console[_0x9c44('0x1c')](_0x33d153);});}if(_0x1e927c[_0x9c44('0x11')]===_0x9c44('0x13')&&!_0x1e927c['secret']){var _0x40bc64;_0x99eeeb['SmsAccount'][_0x9c44('0x1d')]({'where':{'id':_0x1e927c[_0x9c44('0x1e')]},'raw':!![]})['then'](function(_0x466e3f){_0x40bc64=_0x466e3f;if(_0x40bc64&&_0x40bc64['type']){switch(_0x40bc64[_0x9c44('0x1f')]){case _0x9c44('0x20'):var _0x42b4cb=require('twilio');if(_0x40bc64[_0x9c44('0x21')]&&_0x40bc64[_0x9c44('0x22')]&&_0x40bc64[_0x9c44('0x23')]){var _0x4d45c8=new _0x42b4cb(_0x40bc64[_0x9c44('0x21')],_0x40bc64[_0x9c44('0x22')]);_0x4d45c8[_0x9c44('0x24')][_0x9c44('0x25')]({'body':_0x1e927c[_0x9c44('0xe')],'to':_0x1e927c[_0x9c44('0x23')],'from':_0x40bc64[_0x9c44('0x23')],'statusCallback':_0x40bc64[_0x9c44('0x26')]+'/api/sms/messages/'+_0x1e927c['id']+_0x9c44('0x27')+_0x40bc64[_0x9c44('0x28')]})[_0x9c44('0x19')](function(_0x2c4571){if(_0x2c4571[_0x9c44('0x29')]){return _0x3a4350[_0x9c44('0x1a')]({'messageId':_0x2c4571[_0x9c44('0x29')]});}})['catch'](function(_0x53a01c){logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x20'),util[_0x9c44('0x2c')](_0x53a01c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x20'),_0x9c44('0x2d'));}break;case _0x9c44('0x2e'):var _0x3a7ce0='https://api.skebby.it/API/v1.0/REST/';if(_0x40bc64[_0x9c44('0x2f')]&&_0x40bc64[_0x9c44('0x30')]){var _0x5b99e3={'recipient':[_0x1e927c[_0x9c44('0x23')]],'message':_0x1e927c[_0x9c44('0xe')],'message_type':_0x40bc64[_0x9c44('0x31')]};if(_0x40bc64[_0x9c44('0x31')]&&_0x40bc64[_0x9c44('0x31')]!=='SI'){_0x5b99e3[_0x9c44('0x32')]=_0x40bc64[_0x9c44('0x23')];}var _0x891ce4={'url':_0x3a7ce0+_0x9c44('0x33')+_0x40bc64['username']+'&password='+_0x40bc64[_0x9c44('0x30')],'method':'GET'};rp(_0x891ce4)[_0x9c44('0x19')](function(_0x73314d){var _0x2b1e3c=_0x73314d[_0x9c44('0x34')](';');var _0x505671={'user_key':_0x2b1e3c[0x0],'session_key':_0x2b1e3c[0x1]};_0x891ce4={'url':_0x3a7ce0+_0x9c44('0x35'),'method':_0x9c44('0x36'),'headers':{'user_key':_0x505671[_0x9c44('0x37')],'Session_key':_0x505671[_0x9c44('0x38')]},'json':!![],'body':_0x5b99e3};return rp(_0x891ce4);})[_0x9c44('0x19')](function(_0x5b0e18){if(_0x5b0e18[_0x9c44('0x39')]>=0x1){var _0x1e5185={'messageId':_0x5b0e18[_0x9c44('0x3a')]};if(_0x40bc64[_0x9c44('0x31')]!=='GP'||!_0x40bc64['deliveryReport']){_0x1e5185[_0x9c44('0x3b')]=!![];}return _0x3a4350[_0x9c44('0x1a')](_0x1e5185);}else{return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x2e'),util[_0x9c44('0x2c')](_0x5b0e18,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2d796b){return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),'afterCreate','skebby',util[_0x9c44('0x2c')](_0x2d796b,{'showHidden':![],'depth':null}));});}else{logger[_0x9c44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c44('0x2b'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x9c44('0x3c'):if(_0x40bc64[_0x9c44('0x22')]){var _0x3b1ef7={'recipient':_0x1e927c[_0x9c44('0x23')],'message':_0x1e927c[_0x9c44('0xe')],'sender':_0x40bc64[_0x9c44('0x3d')]||_0x40bc64[_0x9c44('0x23')],'authorization':_0x40bc64['authToken']};var _0x25399a={'method':_0x9c44('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3b1ef7,'json':!![]};rp(_0x25399a)[_0x9c44('0x19')](function(_0x48d759){var _0x3b7ab9={'messageId':_0x48d759[_0x9c44('0x3e')]};if(!_0x40bc64[_0x9c44('0x3f')]){_0x3b7ab9['read']=!![];}return _0x3a4350[_0x9c44('0x1a')](_0x3b7ab9);})[_0x9c44('0x1b')](function(_0x10cdda){logger[_0x9c44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c44('0x2b'),_0x9c44('0x3c'),util['inspect'](_0x10cdda,{'showHidden':![],'depth':null}));});}else{logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x9c44('0x40'):if(_0x40bc64[_0x9c44('0x2f')]&&_0x40bc64[_0x9c44('0x30')]){var _0x3b1ef7={'messages':[{'source':_0x9c44('0x41'),'to':_0x1e927c[_0x9c44('0x23')],'body':_0x1e927c[_0x9c44('0xe')],'from':_0x40bc64[_0x9c44('0x3d')]||_0x40bc64[_0x9c44('0x23')]}]};var _0x5073cb=util[_0x9c44('0x42')](_0x9c44('0x43'),_0x40bc64[_0x9c44('0x2f')],_0x40bc64[_0x9c44('0x30')]);var _0x25399a={'method':_0x9c44('0x36'),'uri':_0x9c44('0x44'),'body':_0x3b1ef7,'headers':{'Authorization':util[_0x9c44('0x42')]('Basic\x20%s',new Buffer(_0x5073cb)[_0x9c44('0x45')](_0x9c44('0x46')))},'json':!![]};rp(_0x25399a)[_0x9c44('0x19')](function(_0x13a31f){if(_0x13a31f[_0x9c44('0x47')]>=0xc8&&_0x13a31f[_0x9c44('0x47')]<=0xce){if(_0x13a31f[_0x9c44('0x48')]&&_0x13a31f['data']['queued_count']>0x0){var _0x4cb15c=_[_0x9c44('0x49')](_0x13a31f[_0x9c44('0x48')][_0x9c44('0x24')]);var _0x41f16d={'messageId':_0x4cb15c[_0x9c44('0x4a')]};if(!_0x40bc64[_0x9c44('0x3f')]){_0x41f16d[_0x9c44('0x3b')]=!![];}return _0x3a4350[_0x9c44('0x1a')](_0x41f16d);}else{logger['error'](_0x9c44('0x2a'),'afterCreate','clickSend',util[_0x9c44('0x2c')](_0x13a31f,{'showHidden':![],'depth':null}));}}else{logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x4b'),util['inspect'](_0x13a31f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x507a77){logger['error'](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x4b'),util[_0x9c44('0x2c')](_0x507a77,{'showHidden':![],'depth':null}));});}else{logger[_0x9c44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0x9c44('0x4c'));}break;case _0x9c44('0x4d'):if(_0x40bc64['authId']&&_0x40bc64['authToken']){var _0x3b1ef7={'dst':_0x1e927c['phone'],'text':_0x1e927c[_0x9c44('0xe')],'src':_0x40bc64[_0x9c44('0x3d')]||_0x40bc64[_0x9c44('0x23')],'url':_0x40bc64[_0x9c44('0x26')]+_0x9c44('0x4e')+_0x1e927c['id']+_0x9c44('0x27')+_0x40bc64[_0x9c44('0x28')]};var _0x5073cb=util[_0x9c44('0x42')]('%s:%s',_0x40bc64[_0x9c44('0x4f')],_0x40bc64['authToken']);var _0x25399a={'method':'POST','uri':util['format'](_0x9c44('0x50'),_0x40bc64[_0x9c44('0x4f')]),'body':_0x3b1ef7,'headers':{'Authorization':util[_0x9c44('0x42')](_0x9c44('0x51'),new Buffer(_0x5073cb)['toString'](_0x9c44('0x46')))},'json':!![]};rp(_0x25399a)['then'](function(_0x3e1a49){var _0x23dbc4={'messageId':_0x3e1a49[_0x9c44('0x52')][0x0]};return _0x3a4350['update'](_0x23dbc4);})[_0x9c44('0x1b')](function(_0x2ec8a9){logger[_0x9c44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9c44('0x4d'),util[_0x9c44('0x2c')](_0x2ec8a9,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c44('0x2b'),_0x9c44('0x4d'),_0x9c44('0x53'));}break;case _0x9c44('0x54'):if(_0x40bc64[_0x9c44('0x2f')]&&_0x40bc64['password']){if(_0x40bc64['baseUrl']){var _0x1efee9={'method':'POST','uri':_0x40bc64[_0x9c44('0x55')]+_0x9c44('0x56'),'body':{'username':_0x40bc64['username'],'password':_0x40bc64[_0x9c44('0x30')]},'json':!![]};return rp(_0x1efee9)['then'](function(_0x5ab169){var _0x407436={'method':_0x9c44('0x36'),'uri':_0x40bc64[_0x9c44('0x55')]+_0x9c44('0x57'),'body':{'messages':[{'from':_0x40bc64[_0x9c44('0x23')],'destinations':[{'to':_0x1e927c['phone']}],'text':_0x1e927c[_0x9c44('0xe')],'notifyUrl':_0x40bc64['remote']+_0x9c44('0x4e')+_0x1e927c['id']+_0x9c44('0x27')+_0x40bc64['token'],'notifyContentType':_0x9c44('0x58'),'callbackData':_0x40bc64['phone']+';'+_0x1e927c[_0x9c44('0xe')]}]},'headers':{'Authorization':_0x9c44('0x59')+_0x5ab169[_0x9c44('0x28')]},'json':!![]};return rp(_0x407436)['then'](function(_0x2a9be3){if(_0x2a9be3['messages']){var _0x25d339={'messageId':_0x2a9be3['messages'][0x0][_0x9c44('0x5a')]};if(!_0x40bc64[_0x9c44('0x3f')]){_0x25d339[_0x9c44('0x3b')]=!![];}return _0x3a4350[_0x9c44('0x1a')](_0x25d339);}else{return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x54'),util[_0x9c44('0x2c')](_0x2a9be3,{'showHidden':![],'depth':null}));}});})[_0x9c44('0x1b')](function(_0x49f579){return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x54'),util[_0x9c44('0x2c')](_0x49f579,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c44('0x2b'),_0x9c44('0x54'),_0x9c44('0x5b'));}}else{logger[_0x9c44('0x1c')](_0x9c44('0x2a'),'afterCreate',_0x9c44('0x54'),_0x9c44('0x4c'));}break;case _0x9c44('0x5c'):var _0x595967=require(_0x9c44('0x5d'));if(_0x40bc64[_0x9c44('0x5e')]){var _0x139622={};_0x139622[_0x9c44('0x5f')]=_0x40bc64[_0x9c44('0x2f')];_0x139622[_0x9c44('0x23')]=_0x1e927c[_0x9c44('0x23')];_0x139622['sender']=_0x40bc64['phone'];_0x139622[_0x9c44('0x60')]=_0x1e927c['body'];_0x139622[_0x9c44('0x61')]=+new Date();var _0x219d3f='';var _0x2c1143='';var _0x13250e=Object[_0x9c44('0x62')](_0x139622);_0x13250e[_0x9c44('0x63')]();for(var _0xab81a8=0x0;_0xab81a8<_0x13250e[_0x9c44('0x64')];_0xab81a8++){if(_0x219d3f!=''){_0x219d3f+='&';}_0x219d3f+=_0x13250e[_0xab81a8]+'='+encodeURIComponent(_0x139622[_0x13250e[_0xab81a8]]);_0x2c1143+=_0x139622[_0x13250e[_0xab81a8]];}_0x2c1143+=_0x40bc64[_0x9c44('0x5e')];_0x2c1143=_0x595967[_0x9c44('0x65')]('md5')[_0x9c44('0x1a')](_0x2c1143)['digest'](_0x9c44('0x66'));if(_0x219d3f!==''){_0x219d3f+='&';}_0x219d3f+=_0x9c44('0x67')+_0x2c1143;var _0x891ce4={'method':_0x9c44('0x68'),'uri':_0x40bc64['baseUrl']+'/external/get/send.php?'+_0x219d3f,'json':!![]};return rp(_0x891ce4)[_0x9c44('0x19')](function(_0x24fdbc){var _0x375e00=Object['keys'](_0x24fdbc);if(_0x24fdbc[_0x375e00[0x0]]['error']&&parseInt(_0x24fdbc[_0x375e00[0x0]][_0x9c44('0x1c')])===0x0){var _0x41345c={'messageId':_0x24fdbc[_0x375e00[0x0]][_0x9c44('0x69')]};if(!_0x40bc64['deliveryReport']){_0x41345c[_0x9c44('0x3b')]=!![];}return _0x3a4350[_0x9c44('0x1a')](_0x41345c);}else{return logger[_0x9c44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c44('0x2b'),_0x9c44('0x5c'),util[_0x9c44('0x2c')](_0x24fdbc['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3adfd0){return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),'csc',util[_0x9c44('0x2c')](_0x3adfd0,{'showHidden':![],'depth':null}));});}else{logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x5c'),_0x9c44('0x6a'));}break;case _0x9c44('0x6b'):if(_0x40bc64['apiKey']){var _0x20f93a={'method':_0x9c44('0x36'),'uri':_0x9c44('0x6c'),'headers':{'Authorization':_0x40bc64[_0x9c44('0x5e')]},'body':{'content':_0x1e927c[_0x9c44('0xe')],'to':[_0x1e927c[_0x9c44('0x23')]],'from':_0x40bc64[_0x9c44('0x23')],'binary':![],'clientMessageId':_0x9c44('0x6d'),'charset':_0x9c44('0x6e')},'json':!![]};rp(_0x20f93a)[_0x9c44('0x19')](function(_0x55977f){if(!_0x55977f[_0x9c44('0x1c')]){var _0x381bd6={'messageId':_0x55977f[_0x9c44('0x24')][0x0][_0x9c44('0x6f')]};if(!_0x40bc64['deliveryReport']){_0x381bd6[_0x9c44('0x3b')]=!![];}return _0x3a4350[_0x9c44('0x1a')](_0x381bd6);}else{return logger['error'](_0x9c44('0x2a'),'afterCreate','clickatell',util[_0x9c44('0x2c')](_0x55977f[_0x9c44('0x1c')],{'showHidden':![],'depth':null}));}})[_0x9c44('0x1b')](function(_0x5f4531){return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),'clickatell',util[_0x9c44('0x2c')](_0x5f4531,{'showHidden':![],'depth':null}));});}else{logger[_0x9c44('0x1c')](_0x9c44('0x2a'),'afterCreate',_0x9c44('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0x9c44('0x70'):if(_0x40bc64['username']&&_0x40bc64[_0x9c44('0x30')]){var _0x5073cb=util[_0x9c44('0x42')](_0x9c44('0x43'),_0x40bc64['username'],_0x40bc64['password']);var _0x25399a={'method':'POST','uri':_0x9c44('0x71')+_0x40bc64[_0x9c44('0x72')]+'/messages','body':{'to':[_0x1e927c[_0x9c44('0x23')]],'text':_0x1e927c['body'],'from':_0x40bc64['phone'],'applicationId':_0x40bc64[_0x9c44('0x73')]},'headers':{'Authorization':util[_0x9c44('0x42')](_0x9c44('0x51'),new Buffer(_0x5073cb)['toString'](_0x9c44('0x46')))},'json':!![]};rp(_0x25399a)[_0x9c44('0x19')](function(_0x57dfe0){if(_0x57dfe0['id']){var _0x379ca4={'messageId':_0x57dfe0['id']};return _0x3a4350['update'](_0x379ca4);}else{logger[_0x9c44('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c44('0x2b'),'bandwidth',util[_0x9c44('0x2c')](_0x57dfe0,{'showHidden':![],'depth':null}));}})[_0x9c44('0x1b')](function(_0x4376a6){logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),_0x9c44('0x70'),util[_0x9c44('0x2c')](_0x4376a6,{'showHidden':![],'depth':null}));});}else{logger[_0x9c44('0x1c')](_0x9c44('0x2a'),'afterCreate','bandwidth',_0x9c44('0x4c'));}break;case _0x9c44('0x74'):if(_0x40bc64[_0x9c44('0x5e')]){var _0x19eb31={};var _0x891ce4={'method':'POST','uri':_0x9c44('0x75'),'headers':{'Authorization':_0x9c44('0x76')+_0x40bc64[_0x9c44('0x5e')],'Content-Type':_0x9c44('0x58')},'body':{'from':_0x40bc64[_0x9c44('0x23')],'to':_0x1e927c[_0x9c44('0x23')],'text':_0x1e927c[_0x9c44('0xe')]},'json':!![]};return rp(_0x891ce4)[_0x9c44('0x19')](function(_0x1d2c9f){if(_0x1d2c9f[_0x9c44('0x77')]==0xca){_0x19eb31[_0x9c44('0x78')]=_0x1d2c9f;var _0x1d2844={'method':_0x9c44('0x36'),'uri':_0x9c44('0x79'),'headers':{'Authorization':_0x9c44('0x76')+_0x40bc64[_0x9c44('0x5e')],'Content-Type':_0x9c44('0x58')},'body':{'refid':_0x19eb31[_0x9c44('0x78')][_0x9c44('0x7a')]},'json':!![]};return rp(_0x1d2844)[_0x9c44('0x19')](function(_0x5cbb0e){_0x19eb31[_0x9c44('0x7b')]=_0x5cbb0e;var _0x16646f={'messageId':_0x19eb31[_0x9c44('0x78')][_0x9c44('0x7a')],'read':!![]};return _0x3a4350[_0x9c44('0x1a')](_0x16646f);});}else{return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),'afterCreate',_0x9c44('0x74'),util[_0x9c44('0x2c')](_0x1d2c9f,{'showHidden':![],'depth':null}));}})[_0x9c44('0x1b')](function(_0x303dae){return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),'intelepeer',util[_0x9c44('0x2c')](_0x303dae,{'showHidden':![],'depth':null}));});}else{return logger[_0x9c44('0x1c')](_0x9c44('0x2a'),_0x9c44('0x2b'),'intelepeer',_0x9c44('0x7c'));}break;}}})[_0x9c44('0x7d')](function(){_0x1f215c();});}else{_0x1f215c();}}},'charset':_0x9c44('0x7e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2242=['keys','sort','length','createHash','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','finally','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','out','UserId','isNil','SmsInteraction','SmsInteractionId','then','update','toLowerCase','secret','SmsAccount','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','/auth/1/session','baseUrl','application/json','IBSSO\x20','csc','crypto','login','text','timestamp'];(function(_0x409019,_0x9764c4){var _0x37a84c=function(_0x1de3d3){while(--_0x1de3d3){_0x409019['push'](_0x409019['shift']());}};_0x37a84c(++_0x9764c4);}(_0x2242,0x98));var _0x2224=function(_0x2f9e24,_0x40d108){_0x2f9e24=_0x2f9e24-0x0;var _0x221b02=_0x2242[_0x2f9e24];return _0x221b02;};'use strict';var _=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var logger=require('../../config/logger')(_0x2224('0x2'));var moment=require(_0x2224('0x3'));var BPromise=require('bluebird');var rp=require(_0x2224('0x4'));var fs=require('fs');var path=require(_0x2224('0x5'));var rimraf=require('rimraf');var config=require(_0x2224('0x6'));var attributes=require('./smsMessage.attributes');module[_0x2224('0x7')]=function(_0x42fddb,_0xece6f9){return _0x42fddb[_0x2224('0x8')](_0x2224('0x9'),attributes,{'tableName':_0x2224('0xa'),'paranoid':![],'indexes':[{'name':_0x2224('0xb'),'fields':[_0x2224('0xb')]},{'name':_0x2224('0xc'),'fields':[_0x2224('0xd')],'type':_0x2224('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dad1c,_0x49eeb2,_0x184295){var _0x4b2805=_0x42fddb[_0x2224('0xf')];var _0x16c29d=_0x2dad1c[_0x2224('0x10')]({'plain':!![]});if(_0x16c29d[_0x2224('0x11')]['toLowerCase']()==='in'||_0x16c29d[_0x2224('0x11')]['toLowerCase']()===_0x2224('0x12')&&!_0x16c29d['secret']&&!_['isNil'](_0x16c29d[_0x2224('0x13')])&&!_[_0x2224('0x14')](_0x16c29d['SmsInteractionId'])){_0x4b2805[_0x2224('0x15')]['findOne']({'where':{'id':_0x16c29d[_0x2224('0x16')]}})[_0x2224('0x17')](function(_0x1c8d8e){if(_0x1c8d8e){_0x1c8d8e[_0x2224('0x18')]({'lastMsgAt':_0x16c29d['createdAt'],'lastMsgDirection':_0x16c29d[_0x2224('0x11')][_0x2224('0x19')]()});}})['catch'](function(_0x57e9cc){console['error'](_0x57e9cc);});}if(_0x16c29d['direction']===_0x2224('0x12')&&!_0x16c29d[_0x2224('0x1a')]){var _0x3f969c;_0x4b2805[_0x2224('0x1b')]['find']({'where':{'id':_0x16c29d['SmsAccountId']},'raw':!![]})['then'](function(_0x5a49b2){_0x3f969c=_0x5a49b2;if(_0x3f969c&&_0x3f969c[_0x2224('0x1c')]){switch(_0x3f969c[_0x2224('0x1c')]){case _0x2224('0x1d'):var _0x31fb9b=require(_0x2224('0x1d'));if(_0x3f969c[_0x2224('0x1e')]&&_0x3f969c['authToken']&&_0x3f969c[_0x2224('0x1f')]){var _0xd68729=new _0x31fb9b(_0x3f969c[_0x2224('0x1e')],_0x3f969c[_0x2224('0x20')]);_0xd68729[_0x2224('0x21')][_0x2224('0x22')]({'body':_0x16c29d[_0x2224('0xd')],'to':_0x16c29d[_0x2224('0x1f')],'from':_0x3f969c['phone'],'statusCallback':_0x3f969c[_0x2224('0x23')]+_0x2224('0x24')+_0x16c29d['id']+_0x2224('0x25')+_0x3f969c[_0x2224('0x26')]})['then'](function(_0x4f14df){if(_0x4f14df[_0x2224('0x27')]){return _0x2dad1c[_0x2224('0x18')]({'messageId':_0x4f14df[_0x2224('0x27')]});}})[_0x2224('0x28')](function(_0x494234){logger['error'](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x1d'),util['inspect'](_0x494234,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),'twilio',_0x2224('0x2c'));}break;case _0x2224('0x2d'):var _0x375d4c=_0x2224('0x2e');if(_0x3f969c[_0x2224('0x2f')]&&_0x3f969c[_0x2224('0x30')]){var _0x2c6f41={'recipient':[_0x16c29d[_0x2224('0x1f')]],'message':_0x16c29d[_0x2224('0xd')],'message_type':_0x3f969c[_0x2224('0x31')]};if(_0x3f969c[_0x2224('0x31')]&&_0x3f969c['smsMethod']!=='SI'){_0x2c6f41[_0x2224('0x32')]=_0x3f969c[_0x2224('0x1f')];}var _0x152fc8={'url':_0x375d4c+_0x2224('0x33')+_0x3f969c[_0x2224('0x2f')]+_0x2224('0x34')+_0x3f969c[_0x2224('0x30')],'method':'GET'};rp(_0x152fc8)[_0x2224('0x17')](function(_0x690e4){var _0x1ace58=_0x690e4['split'](';');var _0xc96032={'user_key':_0x1ace58[0x0],'session_key':_0x1ace58[0x1]};_0x152fc8={'url':_0x375d4c+_0x2224('0x35'),'method':_0x2224('0x36'),'headers':{'user_key':_0xc96032[_0x2224('0x37')],'Session_key':_0xc96032[_0x2224('0x38')]},'json':!![],'body':_0x2c6f41};return rp(_0x152fc8);})[_0x2224('0x17')](function(_0x4d2a5d){if(_0x4d2a5d[_0x2224('0x39')]>=0x1){var _0x35c5cd={'messageId':_0x4d2a5d[_0x2224('0x3a')]};if(_0x3f969c['smsMethod']!=='GP'||!_0x3f969c[_0x2224('0x3b')]){_0x35c5cd[_0x2224('0x3c')]=!![];}return _0x2dad1c['update'](_0x35c5cd);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),'afterCreate',_0x2224('0x2d'),util[_0x2224('0x3d')](_0x4d2a5d,{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0x318582){return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x2d'),util['inspect'](_0x318582,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',_0x2224('0x3e'));}break;case _0x2224('0x3f'):if(_0x3f969c[_0x2224('0x20')]){var _0x11a007={'recipient':_0x16c29d['phone'],'message':_0x16c29d['body'],'sender':_0x3f969c[_0x2224('0x40')]||_0x3f969c[_0x2224('0x1f')],'authorization':_0x3f969c[_0x2224('0x20')]};var _0x49eeb2={'method':_0x2224('0x36'),'uri':_0x2224('0x41'),'body':_0x11a007,'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x12155e){var _0x3b919b={'messageId':_0x12155e[_0x2224('0x42')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x3b919b[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x3b919b);})[_0x2224('0x28')](function(_0x16fc3e){logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),_0x2224('0x3f'),util[_0x2224('0x3d')](_0x16fc3e,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x3f'),_0x2224('0x43'));}break;case _0x2224('0x44'):if(_0x3f969c['username']&&_0x3f969c[_0x2224('0x30')]){var _0x11a007={'messages':[{'source':_0x2224('0x45'),'to':_0x16c29d[_0x2224('0x1f')],'body':_0x16c29d[_0x2224('0xd')],'from':_0x3f969c[_0x2224('0x40')]||_0x3f969c[_0x2224('0x1f')]}]};var _0x4ebe36=util['format']('%s:%s',_0x3f969c['username'],_0x3f969c['password']);var _0x49eeb2={'method':_0x2224('0x36'),'uri':_0x2224('0x46'),'body':_0x11a007,'headers':{'Authorization':util['format'](_0x2224('0x47'),new Buffer(_0x4ebe36)[_0x2224('0x48')](_0x2224('0x49')))},'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x196439){if(_0x196439[_0x2224('0x4a')]>=0xc8&&_0x196439[_0x2224('0x4a')]<=0xce){if(_0x196439[_0x2224('0x4b')]&&_0x196439[_0x2224('0x4b')][_0x2224('0x4c')]>0x0){var _0x3bc398=_[_0x2224('0x4d')](_0x196439['data'][_0x2224('0x21')]);var _0xf18576={'messageId':_0x3bc398[_0x2224('0x4e')]};if(!_0x3f969c['deliveryReport']){_0xf18576[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0xf18576);}else{logger['error'](_0x2224('0x29'),'afterCreate',_0x2224('0x4f'),util[_0x2224('0x3d')](_0x196439,{'showHidden':![],'depth':null}));}}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x4f'),util[_0x2224('0x3d')](_0x196439,{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0x33e51c){logger['error'](_0x2224('0x29'),_0x2224('0x2a'),'clickSend',util[_0x2224('0x3d')](_0x33e51c,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),_0x2224('0x4f'),_0x2224('0x3e'));}break;case'plivo':if(_0x3f969c['authId']&&_0x3f969c[_0x2224('0x20')]){var _0x11a007={'dst':_0x16c29d[_0x2224('0x1f')],'text':_0x16c29d[_0x2224('0xd')],'src':_0x3f969c[_0x2224('0x40')]||_0x3f969c[_0x2224('0x1f')],'url':_0x3f969c[_0x2224('0x23')]+'/api/sms/messages/'+_0x16c29d['id']+'/status?token='+_0x3f969c[_0x2224('0x26')]};var _0x4ebe36=util['format']('%s:%s',_0x3f969c[_0x2224('0x50')],_0x3f969c[_0x2224('0x20')]);var _0x49eeb2={'method':_0x2224('0x36'),'uri':util[_0x2224('0x51')](_0x2224('0x52'),_0x3f969c['authId']),'body':_0x11a007,'headers':{'Authorization':util[_0x2224('0x51')](_0x2224('0x47'),new Buffer(_0x4ebe36)[_0x2224('0x48')]('base64'))},'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x2c579d){var _0x7ddb6e={'messageId':_0x2c579d[_0x2224('0x53')][0x0]};return _0x2dad1c[_0x2224('0x18')](_0x7ddb6e);})[_0x2224('0x28')](function(_0xc2cc60){logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x54'),util[_0x2224('0x3d')](_0xc2cc60,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x54'),_0x2224('0x55'));}break;case _0x2224('0x56'):if(_0x3f969c[_0x2224('0x2f')]&&_0x3f969c[_0x2224('0x30')]){if(_0x3f969c['baseUrl']){var _0x41fbbc={'method':'POST','uri':_0x3f969c['baseUrl']+_0x2224('0x57'),'body':{'username':_0x3f969c[_0x2224('0x2f')],'password':_0x3f969c[_0x2224('0x30')]},'json':!![]};return rp(_0x41fbbc)[_0x2224('0x17')](function(_0x1ed646){var _0x4a1326={'method':_0x2224('0x36'),'uri':_0x3f969c[_0x2224('0x58')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f969c[_0x2224('0x1f')],'destinations':[{'to':_0x16c29d[_0x2224('0x1f')]}],'text':_0x16c29d[_0x2224('0xd')],'notifyUrl':_0x3f969c['remote']+'/api/sms/messages/'+_0x16c29d['id']+_0x2224('0x25')+_0x3f969c[_0x2224('0x26')],'notifyContentType':_0x2224('0x59'),'callbackData':_0x3f969c[_0x2224('0x1f')]+';'+_0x16c29d['body']}]},'headers':{'Authorization':_0x2224('0x5a')+_0x1ed646[_0x2224('0x26')]},'json':!![]};return rp(_0x4a1326)[_0x2224('0x17')](function(_0x8e1e2f){if(_0x8e1e2f['messages']){var _0x12dd9e={'messageId':_0x8e1e2f['messages'][0x0][_0x2224('0xb')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x12dd9e[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x12dd9e);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'infobip',util[_0x2224('0x3d')](_0x8e1e2f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x53c672){return logger['error'](_0x2224('0x29'),'afterCreate',_0x2224('0x56'),util['inspect'](_0x53c672,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x56'),_0x2224('0x3e'));}break;case _0x2224('0x5b'):var _0x4a1d9b=require(_0x2224('0x5c'));if(_0x3f969c['apiKey']){var _0x11c7ce={};_0x11c7ce[_0x2224('0x5d')]=_0x3f969c[_0x2224('0x2f')];_0x11c7ce[_0x2224('0x1f')]=_0x16c29d[_0x2224('0x1f')];_0x11c7ce[_0x2224('0x32')]=_0x3f969c['phone'];_0x11c7ce[_0x2224('0x5e')]=_0x16c29d[_0x2224('0xd')];_0x11c7ce[_0x2224('0x5f')]=+new Date();var _0x476e9a='';var _0xa674d6='';var _0x3c020f=Object[_0x2224('0x60')](_0x11c7ce);_0x3c020f[_0x2224('0x61')]();for(var _0x34b465=0x0;_0x34b465<_0x3c020f[_0x2224('0x62')];_0x34b465++){if(_0x476e9a!=''){_0x476e9a+='&';}_0x476e9a+=_0x3c020f[_0x34b465]+'='+encodeURIComponent(_0x11c7ce[_0x3c020f[_0x34b465]]);_0xa674d6+=_0x11c7ce[_0x3c020f[_0x34b465]];}_0xa674d6+=_0x3f969c['apiKey'];_0xa674d6=_0x4a1d9b[_0x2224('0x63')]('md5')[_0x2224('0x18')](_0xa674d6)[_0x2224('0x64')](_0x2224('0x65'));if(_0x476e9a!==''){_0x476e9a+='&';}_0x476e9a+=_0x2224('0x66')+_0xa674d6;var _0x152fc8={'method':_0x2224('0x67'),'uri':_0x3f969c[_0x2224('0x58')]+_0x2224('0x68')+_0x476e9a,'json':!![]};return rp(_0x152fc8)[_0x2224('0x17')](function(_0x513a5d){var _0x316053=Object[_0x2224('0x60')](_0x513a5d);if(_0x513a5d[_0x316053[0x0]][_0x2224('0x2b')]&&parseInt(_0x513a5d[_0x316053[0x0]][_0x2224('0x2b')])===0x0){var _0x4a555c={'messageId':_0x513a5d[_0x316053[0x0]][_0x2224('0x69')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x4a555c[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x4a555c);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x5b'),util['inspect'](_0x513a5d[_0x2224('0x2b')],{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0xd4f828){return logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),'csc',util['inspect'](_0xd4f828,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2224('0x29'),_0x2224('0x2a'),'csc',_0x2224('0x6a'));}break;case _0x2224('0x6b'):if(_0x3f969c[_0x2224('0x6c')]){var _0x3e3748={'method':_0x2224('0x36'),'uri':_0x2224('0x6d'),'headers':{'Authorization':_0x3f969c[_0x2224('0x6c')]},'body':{'content':_0x16c29d[_0x2224('0xd')],'to':[_0x16c29d['phone']],'from':_0x3f969c[_0x2224('0x1f')],'binary':![],'clientMessageId':_0x2224('0x6e'),'charset':_0x2224('0x6f')},'json':!![]};rp(_0x3e3748)['then'](function(_0x4cfd35){if(!_0x4cfd35[_0x2224('0x2b')]){var _0x572698={'messageId':_0x4cfd35[_0x2224('0x21')][0x0][_0x2224('0x70')]};if(!_0x3f969c[_0x2224('0x3b')]){_0x572698[_0x2224('0x3c')]=!![];}return _0x2dad1c[_0x2224('0x18')](_0x572698);}else{return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'clickatell',util[_0x2224('0x3d')](_0x4cfd35[_0x2224('0x2b')],{'showHidden':![],'depth':null}));}})[_0x2224('0x28')](function(_0x225365){return logger[_0x2224('0x2b')](_0x2224('0x29'),'afterCreate',_0x2224('0x6b'),util[_0x2224('0x3d')](_0x225365,{'showHidden':![],'depth':null}));});}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),'clickatell',_0x2224('0x6a'));}break;case _0x2224('0x71'):if(_0x3f969c[_0x2224('0x2f')]&&_0x3f969c['password']){var _0x4ebe36=util[_0x2224('0x51')](_0x2224('0x72'),_0x3f969c[_0x2224('0x2f')],_0x3f969c['password']);var _0x49eeb2={'method':'POST','uri':_0x2224('0x73')+_0x3f969c[_0x2224('0x74')]+'/messages','body':{'to':[_0x16c29d[_0x2224('0x1f')]],'text':_0x16c29d['body'],'from':_0x3f969c['phone'],'applicationId':_0x3f969c['applicationId']},'headers':{'Authorization':util[_0x2224('0x51')](_0x2224('0x47'),new Buffer(_0x4ebe36)[_0x2224('0x48')](_0x2224('0x49')))},'json':!![]};rp(_0x49eeb2)[_0x2224('0x17')](function(_0x303753){if(_0x303753['id']){var _0x5cf332={'messageId':_0x303753['id']};return _0x2dad1c[_0x2224('0x18')](_0x5cf332);}else{logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x71'),util['inspect'](_0x303753,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e7b42){logger['error'](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x71'),util[_0x2224('0x3d')](_0x4e7b42,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2224('0x29'),_0x2224('0x2a'),'bandwidth',_0x2224('0x3e'));}break;case _0x2224('0x75'):if(_0x3f969c[_0x2224('0x6c')]){var _0x554bad={};var _0x152fc8={'method':_0x2224('0x36'),'uri':_0x2224('0x76'),'headers':{'Authorization':_0x2224('0x77')+_0x3f969c[_0x2224('0x6c')],'Content-Type':'application/json'},'body':{'from':_0x3f969c[_0x2224('0x1f')],'to':_0x16c29d[_0x2224('0x1f')],'text':_0x16c29d['body']},'json':!![]};return rp(_0x152fc8)[_0x2224('0x17')](function(_0xc94dd2){if(_0xc94dd2['code']==0xca){_0x554bad['message']=_0xc94dd2;var _0x117e49={'method':_0x2224('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x2224('0x77')+_0x3f969c[_0x2224('0x6c')],'Content-Type':_0x2224('0x59')},'body':{'refid':_0x554bad[_0x2224('0x78')][_0x2224('0x79')]},'json':!![]};return rp(_0x117e49)[_0x2224('0x17')](function(_0x2abc5e){_0x554bad[_0x2224('0x7a')]=_0x2abc5e;var _0x24ae79={'messageId':_0x554bad[_0x2224('0x78')][_0x2224('0x79')],'read':!![]};return _0x2dad1c[_0x2224('0x18')](_0x24ae79);});}else{return logger[_0x2224('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),_0x2224('0x75'),util[_0x2224('0x3d')](_0xc94dd2,{'showHidden':![],'depth':null}));}})['catch'](function(_0xd27867){return logger[_0x2224('0x2b')](_0x2224('0x29'),_0x2224('0x2a'),_0x2224('0x75'),util[_0x2224('0x3d')](_0xd27867,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2224('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x2224('0x7b')](function(){_0x184295();});}else{_0x184295();}}},'charset':'utf8mb4','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 0a66f12..1f7e7b1 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 _0xf766=['stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','request\x20sent','debug'];(function(_0x2b51a9,_0x5b9092){var _0x2de139=function(_0x5076b3){while(--_0x5076b3){_0x2b51a9['push'](_0x2b51a9['shift']());}};_0x2de139(++_0x5b9092);}(_0xf766,0x19f));var _0x6f76=function(_0x295ea9,_0x19d658){_0x295ea9=_0x295ea9-0x0;var _0x59a3fe=_0xf766[_0x295ea9];return _0x59a3fe;};'use strict';var _=require(_0x6f76('0x0'));var util=require(_0x6f76('0x1'));var moment=require(_0x6f76('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f76('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6f76('0x4'));var logger=require(_0x6f76('0x5'))(_0x6f76('0x6'));var config=require(_0x6f76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f76('0x8')]['http']({'port':0x232a});config[_0x6f76('0x9')]=_[_0x6f76('0xa')](config[_0x6f76('0x9')],{'host':_0x6f76('0xb'),'port':0x18eb});var socket=require(_0x6f76('0xc'))(new Redis(config[_0x6f76('0x9')]));require(_0x6f76('0xd'))[_0x6f76('0xe')](socket);function respondWithRpcPromise(_0x48b309,_0x4ea02a,_0x4fe12c){return new BPromise(function(_0x258817,_0x31ede5){return client[_0x6f76('0xf')](_0x48b309,_0x4fe12c)[_0x6f76('0x10')](function(_0x57b1f1){logger['info']('SmsMessage,\x20%s,\x20%s',_0x4ea02a,_0x6f76('0x11'));logger[_0x6f76('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ea02a,_0x6f76('0x11'),JSON[_0x6f76('0x13')](_0x57b1f1));if(_0x57b1f1[_0x6f76('0x14')]){if(_0x57b1f1['error'][_0x6f76('0x15')]===0x1f4){logger[_0x6f76('0x14')](_0x6f76('0x16'),_0x4ea02a,_0x57b1f1[_0x6f76('0x14')][_0x6f76('0x17')]);return _0x31ede5(_0x57b1f1[_0x6f76('0x14')][_0x6f76('0x17')]);}logger[_0x6f76('0x14')](_0x6f76('0x16'),_0x4ea02a,_0x57b1f1[_0x6f76('0x14')][_0x6f76('0x17')]);return _0x258817(_0x57b1f1[_0x6f76('0x14')][_0x6f76('0x17')]);}else{logger[_0x6f76('0x18')](_0x6f76('0x16'),_0x4ea02a,_0x6f76('0x11'));_0x258817(_0x57b1f1[_0x6f76('0x19')][_0x6f76('0x17')]);}})[_0x6f76('0x1a')](function(_0x4e84b8){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4ea02a,_0x4e84b8);_0x31ede5(_0x4e84b8);});});}exports[_0x6f76('0x1b')]=function(_0x1bc2ec){var _0x176e72=this;return new Promise(function(_0x18c293,_0x564303){return db[_0x6f76('0x1c')]['create'](_0x1bc2ec[_0x6f76('0x1d')],{'raw':_0x1bc2ec[_0x6f76('0x1e')]?_0x1bc2ec[_0x6f76('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x6f76('0x10')](function(_0xa2dd44){logger[_0x6f76('0x18')](_0x6f76('0x1b'),_0x1bc2ec);logger['debug'](_0x6f76('0x1b'),_0x1bc2ec,JSON[_0x6f76('0x13')](_0xa2dd44));_0x18c293(_0xa2dd44);})[_0x6f76('0x1a')](function(_0x1c7152){logger['error'](_0x6f76('0x1b'),_0x1c7152[_0x6f76('0x17')],_0x1bc2ec);_0x564303(_0x176e72[_0x6f76('0x14')](0x1f4,_0x1c7152['message']));});});}; \ No newline at end of file +var _0xb3bf=['catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./smsMessage.socket','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result'];(function(_0x5511ea,_0x175172){var _0x104292=function(_0x33c286){while(--_0x33c286){_0x5511ea['push'](_0x5511ea['shift']());}};_0x104292(++_0x175172);}(_0xb3bf,0x157));var _0xfb3b=function(_0x56c5bd,_0x30adb4){_0x56c5bd=_0x56c5bd-0x0;var _0x35ed02=_0xb3bf[_0x56c5bd];return _0x35ed02;};'use strict';var _=require(_0xfb3b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb3b('0x1'));var fs=require('fs');var Redis=require(_0xfb3b('0x2'));var db=require(_0xfb3b('0x3'))['db'];var utils=require(_0xfb3b('0x4'));var logger=require(_0xfb3b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfb3b('0x6'));var client=jayson['client'][_0xfb3b('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfb3b('0x8')],{'host':_0xfb3b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb3b('0x8')]));require(_0xfb3b('0xa'))[_0xfb3b('0xb')](socket);function respondWithRpcPromise(_0x1c1c37,_0x3ba2d9,_0x55050e){return new BPromise(function(_0xab83f8,_0x309e8f){return client['request'](_0x1c1c37,_0x55050e)[_0xfb3b('0xc')](function(_0x384eef){logger['info'](_0xfb3b('0xd'),_0x3ba2d9,_0xfb3b('0xe'));logger[_0xfb3b('0xf')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3ba2d9,_0xfb3b('0xe'),JSON[_0xfb3b('0x10')](_0x384eef));if(_0x384eef[_0xfb3b('0x11')]){if(_0x384eef[_0xfb3b('0x11')]['code']===0x1f4){logger['error'](_0xfb3b('0xd'),_0x3ba2d9,_0x384eef[_0xfb3b('0x11')][_0xfb3b('0x12')]);return _0x309e8f(_0x384eef[_0xfb3b('0x11')][_0xfb3b('0x12')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x3ba2d9,_0x384eef[_0xfb3b('0x11')][_0xfb3b('0x12')]);return _0xab83f8(_0x384eef['error'][_0xfb3b('0x12')]);}else{logger[_0xfb3b('0x13')](_0xfb3b('0xd'),_0x3ba2d9,_0xfb3b('0xe'));_0xab83f8(_0x384eef[_0xfb3b('0x14')][_0xfb3b('0x12')]);}})[_0xfb3b('0x15')](function(_0x334ea4){logger['error'](_0xfb3b('0xd'),_0x3ba2d9,_0x334ea4);_0x309e8f(_0x334ea4);});});}exports[_0xfb3b('0x16')]=function(_0x2f2a7e){var _0x25ab11=this;return new Promise(function(_0x56a3b9,_0x4caa65){return db[_0xfb3b('0x17')][_0xfb3b('0x18')](_0x2f2a7e[_0xfb3b('0x19')],{'raw':_0x2f2a7e[_0xfb3b('0x1a')]?_0x2f2a7e['options'][_0xfb3b('0x1b')]===undefined?!![]:![]:!![]})[_0xfb3b('0xc')](function(_0x44bb21){logger[_0xfb3b('0x13')](_0xfb3b('0x16'),_0x2f2a7e);logger['debug'](_0xfb3b('0x16'),_0x2f2a7e,JSON[_0xfb3b('0x10')](_0x44bb21));_0x56a3b9(_0x44bb21);})[_0xfb3b('0x15')](function(_0x546471){logger[_0xfb3b('0x11')](_0xfb3b('0x16'),_0x546471[_0xfb3b('0x12')],_0x2f2a7e);_0x4caa65(_0x25ab11[_0xfb3b('0x11')](0x1f4,_0x546471[_0xfb3b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a81001a..d160b36 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 _0xc3a6=['length','./smsMessage.events','save','remove','update','removeListener','register'];(function(_0x4cbb1f,_0x243b84){var _0x69773d=function(_0x48df7f){while(--_0x48df7f){_0x4cbb1f['push'](_0x4cbb1f['shift']());}};_0x69773d(++_0x243b84);}(_0xc3a6,0x13c));var _0x6c3a=function(_0x3dc7dd,_0x45cd61){_0x3dc7dd=_0x3dc7dd-0x0;var _0x40bbfa=_0xc3a6[_0x3dc7dd];return _0x40bbfa;};'use strict';var SmsMessageEvents=require(_0x6c3a('0x0'));var events=[_0x6c3a('0x1'),_0x6c3a('0x2'),_0x6c3a('0x3')];function createListener(_0x2a3e49,_0x2e39b8){return function(_0xce3451){_0x2e39b8['emit'](_0x2a3e49,_0xce3451);};}function removeListener(_0x58e814,_0x3e85c6){return function(){SmsMessageEvents[_0x6c3a('0x4')](_0x58e814,_0x3e85c6);};}exports[_0x6c3a('0x5')]=function(_0x5aa3ab){for(var _0x1efe03=0x0,_0x4b22c2=events[_0x6c3a('0x6')];_0x1efe03<_0x4b22c2;_0x1efe03++){var _0x3452be=events[_0x1efe03];var _0x328d88=createListener('smsMessage:'+_0x3452be,_0x5aa3ab);SmsMessageEvents['on'](_0x3452be,_0x328d88);}}; \ No newline at end of file +var _0xa824=['update','removeListener','length','./smsMessage.events','save','remove'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0xa824,0x183));var _0x4a82=function(_0x26a163,_0x4c335b){_0x26a163=_0x26a163-0x0;var _0x3a5a4e=_0xa824[_0x26a163];return _0x3a5a4e;};'use strict';var SmsMessageEvents=require(_0x4a82('0x0'));var events=[_0x4a82('0x1'),_0x4a82('0x2'),_0x4a82('0x3')];function createListener(_0x5b0aa4,_0x2c11d6){return function(_0x57d654){_0x2c11d6['emit'](_0x5b0aa4,_0x57d654);};}function removeListener(_0xccd446,_0x4b1703){return function(){SmsMessageEvents[_0x4a82('0x4')](_0xccd446,_0x4b1703);};}exports['register']=function(_0x99709c){for(var _0x2a2eef=0x0,_0x47ae61=events[_0x4a82('0x5')];_0x2a2eef<_0x47ae61;_0x2a2eef++){var _0x1da3d5=events[_0x2a2eef];var _0x1542e7=createListener('smsMessage:'+_0x1da3d5,_0x99709c);SmsMessageEvents['on'](_0x1da3d5,_0x1542e7);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6c872c6..8336100 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 _0x0723=['../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','Router','fs-extra'];(function(_0x37ac3e,_0x599c9f){var _0x3e3655=function(_0x314e91){while(--_0x314e91){_0x37ac3e['push'](_0x37ac3e['shift']());}};_0x3e3655(++_0x599c9f);}(_0x0723,0x126));var _0x3072=function(_0x556b16,_0x51f863){_0x556b16=_0x556b16-0x0;var _0x3f2a44=_0x0723[_0x556b16];return _0x3f2a44;};'use strict';var multer=require('multer');var util=require(_0x3072('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3072('0x1')]();var fs_extra=require(_0x3072('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3072('0x3'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x3072('0x4')]('/',auth['isAuthenticated'](),controller[_0x3072('0x5')]);router['get'](_0x3072('0x6'),auth[_0x3072('0x7')](),controller[_0x3072('0x8')]);router['get'](_0x3072('0x9'),auth['isAuthenticated'](),controller[_0x3072('0xa')]);router[_0x3072('0x4')]('/:id/members',auth[_0x3072('0x7')](),controller[_0x3072('0xb')]);router[_0x3072('0x4')](_0x3072('0xc'),auth[_0x3072('0x7')](),controller[_0x3072('0xd')]);router[_0x3072('0x4')]('/:id/users',auth[_0x3072('0x7')](),controller[_0x3072('0xe')]);router[_0x3072('0xf')]('/',auth[_0x3072('0x7')](),controller[_0x3072('0x10')]);router[_0x3072('0xf')]('/:id/teams',auth[_0x3072('0x7')](),controller[_0x3072('0x11')]);router[_0x3072('0xf')](_0x3072('0x12'),auth[_0x3072('0x7')](),controller[_0x3072('0x13')]);router[_0x3072('0x14')]('/:id',auth[_0x3072('0x7')](),controller[_0x3072('0x15')]);router[_0x3072('0x16')](_0x3072('0x9'),auth[_0x3072('0x7')](),controller[_0x3072('0x17')]);router['delete'](_0x3072('0xc'),auth[_0x3072('0x7')](),controller[_0x3072('0x18')]);router['delete']('/:id/users',auth[_0x3072('0x7')](),controller[_0x3072('0x19')]);module[_0x3072('0x1a')]=router; \ No newline at end of file +var _0x9db0=['destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete'];(function(_0x255caf,_0x2f893b){var _0x25e862=function(_0xffbed9){while(--_0xffbed9){_0x255caf['push'](_0x255caf['shift']());}};_0x25e862(++_0x2f893b);}(_0x9db0,0xf4));var _0x09db=function(_0x1ae389,_0x282417){_0x1ae389=_0x1ae389-0x0;var _0xcee9ca=_0x9db0[_0x1ae389];return _0xcee9ca;};'use strict';var multer=require(_0x09db('0x0'));var util=require('util');var path=require(_0x09db('0x1'));var timeout=require(_0x09db('0x2'));var express=require(_0x09db('0x3'));var router=express[_0x09db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x09db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x09db('0x6'));var controller=require(_0x09db('0x7'));router[_0x09db('0x8')]('/',auth[_0x09db('0x9')](),controller[_0x09db('0xa')]);router[_0x09db('0x8')](_0x09db('0xb'),auth[_0x09db('0x9')](),controller['describe']);router[_0x09db('0x8')]('/:id',auth[_0x09db('0x9')](),controller[_0x09db('0xc')]);router[_0x09db('0x8')](_0x09db('0xd'),auth[_0x09db('0x9')](),controller[_0x09db('0xe')]);router[_0x09db('0x8')]('/:id/teams',auth[_0x09db('0x9')](),controller[_0x09db('0xf')]);router[_0x09db('0x8')](_0x09db('0x10'),auth[_0x09db('0x9')](),controller[_0x09db('0x11')]);router[_0x09db('0x12')]('/',auth[_0x09db('0x9')](),controller[_0x09db('0x13')]);router[_0x09db('0x12')](_0x09db('0x14'),auth['isAuthenticated'](),controller[_0x09db('0x15')]);router[_0x09db('0x12')](_0x09db('0x10'),auth['isAuthenticated'](),controller[_0x09db('0x16')]);router[_0x09db('0x17')]('/:id',auth[_0x09db('0x9')](),controller[_0x09db('0x18')]);router[_0x09db('0x19')]('/:id',auth[_0x09db('0x9')](),controller[_0x09db('0x1a')]);router['delete']('/:id/teams',auth[_0x09db('0x9')](),controller[_0x09db('0x1b')]);router[_0x09db('0x19')](_0x09db('0x10'),auth[_0x09db('0x9')](),controller[_0x09db('0x1c')]);module[_0x09db('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 011b972..1f5ddd3 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 _0x2fbb=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2fbb,0x190));var _0xb2fb=function(_0x2e3953,_0x576e8f){_0x2e3953=_0x2e3953-0x0;var _0xf33ce=_0x2fbb[_0x2e3953];return _0xf33ce;};'use strict';var Sequelize=require(_0xb2fb('0x0'));module[_0xb2fb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb2fb('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb2fb('0x3')]},'timeout':{'type':Sequelize[_0xb2fb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb2fb('0x5')](_0xb2fb('0x6'),_0xb2fb('0x7'),_0xb2fb('0x8'))}}; \ No newline at end of file +var _0x7226=['exports','STRING','INTEGER','rrmemory'];(function(_0x5dc5fc,_0x19e40d){var _0x310094=function(_0x470c6a){while(--_0x470c6a){_0x5dc5fc['push'](_0x5dc5fc['shift']());}};_0x310094(++_0x19e40d);}(_0x7226,0x1b4));var _0x6722=function(_0x491496,_0x50fc1c){_0x491496=_0x491496-0x0;var _0x15fec2=_0x7226[_0x491496];return _0x15fec2;};'use strict';var Sequelize=require('sequelize');module[_0x6722('0x0')]={'name':{'type':Sequelize[_0x6722('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6722('0x1')]},'timeout':{'type':Sequelize[_0x6722('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6722('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2399d0a..8150e1a 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 _0x39cd=['removeAgents','forEach','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','error','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','name','options','SmsQueue','includeAll','include','findAll','catch','find','create','user','role','userProfileId','update','body','params','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','hasOwnProperty','addTeams','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','compact','value'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x39cd,0x11c));var _0xd39c=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x39cd[_0x40a825];return _0x273a54;};'use strict';var emlformat=require(_0xd39c('0x0'));var rimraf=require(_0xd39c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd39c('0x2'));var rp=require(_0xd39c('0x3'));var moment=require(_0xd39c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd39c('0x5'));var util=require(_0xd39c('0x6'));var path=require(_0xd39c('0x7'));var sox=require(_0xd39c('0x8'));var csv=require(_0xd39c('0x9'));var ejs=require(_0xd39c('0xa'));var fs=require('fs');var fs_extra=require(_0xd39c('0xb'));var _=require('lodash');var squel=require(_0xd39c('0xc'));var crypto=require(_0xd39c('0xd'));var jsforce=require(_0xd39c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd39c('0xf'));var Papa=require(_0xd39c('0x10'));var Redis=require(_0xd39c('0x11'));var authService=require(_0xd39c('0x12'));var qs=require(_0xd39c('0x13'));var as=require(_0xd39c('0x14'));var hardwareService=require(_0xd39c('0x15'));var logger=require(_0xd39c('0x16'))(_0xd39c('0x17'));var utils=require('../../config/utils');var config=require(_0xd39c('0x18'));var licenseUtil=require(_0xd39c('0x19'));var db=require(_0xd39c('0x1a'))['db'];config[_0xd39c('0x1b')]=_[_0xd39c('0x1c')](config[_0xd39c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd39c('0x1b')]));require('./smsQueue.socket')[_0xd39c('0x1d')](socket);function respondWithStatusCode(_0x585bad,_0x38ef49){_0x38ef49=_0x38ef49||0xcc;return function(_0x4df81c){if(_0x4df81c){return _0x585bad[_0xd39c('0x1e')](_0x38ef49);}return _0x585bad[_0xd39c('0x1f')](_0x38ef49)[_0xd39c('0x20')]();};}function respondWithResult(_0x411bb8,_0x4d3cb5){_0x4d3cb5=_0x4d3cb5||0xc8;return function(_0x2542c2){if(_0x2542c2){return _0x411bb8[_0xd39c('0x1f')](_0x4d3cb5)[_0xd39c('0x21')](_0x2542c2);}};}function respondWithFilteredResult(_0x30b94e,_0x50f1ec){return function(_0x2d9a15){if(_0x2d9a15){var _0x45054d=typeof _0x50f1ec[_0xd39c('0x22')]==='undefined'&&typeof _0x50f1ec['limit']==='undefined';var _0x23c405=_0x2d9a15['count'];var _0x1630a3=_0x45054d?0x0:_0x50f1ec[_0xd39c('0x22')];var _0x4dff39=_0x45054d?_0x2d9a15[_0xd39c('0x23')]:_0x50f1ec[_0xd39c('0x22')]+_0x50f1ec[_0xd39c('0x24')];var _0x11e143;if(_0x4dff39>=_0x23c405){_0x4dff39=_0x23c405;_0x11e143=0xc8;}else{_0x11e143=0xce;}_0x30b94e[_0xd39c('0x1f')](_0x11e143);return _0x30b94e['set'](_0xd39c('0x25'),_0x1630a3+'-'+_0x4dff39+'/'+_0x23c405)['json'](_0x2d9a15);}return null;};}function patchUpdates(_0x20722d){return function(_0xe6d7f7){try{jsonpatch[_0xd39c('0x26')](_0xe6d7f7,_0x20722d,!![]);}catch(_0x6c8965){return BPromise[_0xd39c('0x27')](_0x6c8965);}return _0xe6d7f7[_0xd39c('0x28')]();};}function saveUpdates(_0x55a680,_0x57deda){return function(_0x573359){if(_0x573359){return _0x573359['update'](_0x55a680)[_0xd39c('0x29')](function(_0xd2413){return _0xd2413;});}return null;};}function removeEntity(_0x50ab53,_0x45234b){return function(_0x2ebae5){if(_0x2ebae5){return _0x2ebae5[_0xd39c('0x2a')]()[_0xd39c('0x29')](function(){var _0xa11575=_0x2ebae5[_0xd39c('0x2b')]({'plain':!![]});var _0x281f52=_0xd39c('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x281f52,'resourceId':_0xa11575['id']}})[_0xd39c('0x29')](function(){return _0x2ebae5;});})[_0xd39c('0x29')](function(){_0x50ab53['status'](0xcc)[_0xd39c('0x20')]();});}};}function handleEntityNotFound(_0x210e7d,_0x1fe791){return function(_0x300893){if(!_0x300893){_0x210e7d[_0xd39c('0x1e')](0x194);}return _0x300893;};}function handleError(_0x3b14c5,_0x434c7b){_0x434c7b=_0x434c7b||0x1f4;return function(_0x465308){logger[_0xd39c('0x2d')](_0x465308['stack']);if(_0x465308['name']){delete _0x465308['name'];}_0x3b14c5[_0xd39c('0x1f')](_0x434c7b)[_0xd39c('0x2e')](_0x465308);};}exports[_0xd39c('0x2f')]=function(_0x5342cd,_0x1a0714){var _0x4a0b8c={},_0x4be6c0={},_0x167058={'count':0x0,'rows':[]};var _0xb946a1=_[_0xd39c('0x30')](db['SmsQueue'][_0xd39c('0x31')],function(_0x26fc36){return{'name':_0x26fc36[_0xd39c('0x32')],'type':_0x26fc36['type']['key']};});_0x4be6c0[_0xd39c('0x33')]=_[_0xd39c('0x30')](_0xb946a1,'name');_0x4be6c0[_0xd39c('0x34')]=_[_0xd39c('0x35')](_0x5342cd[_0xd39c('0x34')]);_0x4be6c0[_0xd39c('0x36')]=_[_0xd39c('0x37')](_0x4be6c0['model'],_0x4be6c0[_0xd39c('0x34')]);_0x4a0b8c[_0xd39c('0x38')]=_['intersection'](_0x4be6c0[_0xd39c('0x33')],qs[_0xd39c('0x39')](_0x5342cd[_0xd39c('0x34')][_0xd39c('0x39')]));_0x4a0b8c[_0xd39c('0x38')]=_0x4a0b8c[_0xd39c('0x38')][_0xd39c('0x3a')]?_0x4a0b8c[_0xd39c('0x38')]:_0x4be6c0['model'];if(!_0x5342cd[_0xd39c('0x34')]['hasOwnProperty'](_0xd39c('0x3b'))){_0x4a0b8c[_0xd39c('0x24')]=qs[_0xd39c('0x24')](_0x5342cd[_0xd39c('0x34')][_0xd39c('0x24')]);_0x4a0b8c[_0xd39c('0x22')]=qs['offset'](_0x5342cd[_0xd39c('0x34')][_0xd39c('0x22')]);}_0x4a0b8c['order']=qs[_0xd39c('0x3c')](_0x5342cd[_0xd39c('0x34')][_0xd39c('0x3c')]);_0x4a0b8c['where']=qs[_0xd39c('0x36')](_[_0xd39c('0x3d')](_0x5342cd[_0xd39c('0x34')],_0x4be6c0[_0xd39c('0x36')]),_0xb946a1);if(_0x5342cd[_0xd39c('0x34')][_0xd39c('0x3e')]){_0x4a0b8c[_0xd39c('0x3f')]=_[_0xd39c('0x40')](_0x4a0b8c[_0xd39c('0x3f')],{'$or':_[_0xd39c('0x30')](_0xb946a1,function(_0x3166b4){if(_0x3166b4[_0xd39c('0x41')]!==_0xd39c('0x42')){var _0x30c2de={};_0x30c2de[_0x3166b4[_0xd39c('0x43')]]={'$like':'%'+_0x5342cd[_0xd39c('0x34')][_0xd39c('0x3e')]+'%'};return _0x30c2de;}})});}_0x4a0b8c=_[_0xd39c('0x40')]({},_0x4a0b8c,_0x5342cd[_0xd39c('0x44')]);var _0x50438b={'where':_0x4a0b8c[_0xd39c('0x3f')]};return db[_0xd39c('0x45')][_0xd39c('0x23')](_0x50438b)[_0xd39c('0x29')](function(_0x3f4376){_0x167058[_0xd39c('0x23')]=_0x3f4376;if(_0x5342cd[_0xd39c('0x34')][_0xd39c('0x46')]){_0x4a0b8c[_0xd39c('0x47')]=[{'all':!![]}];}return db[_0xd39c('0x45')][_0xd39c('0x48')](_0x4a0b8c);})[_0xd39c('0x29')](function(_0x25bc39){_0x167058['rows']=_0x25bc39;return _0x167058;})[_0xd39c('0x29')](respondWithFilteredResult(_0x1a0714,_0x4a0b8c))[_0xd39c('0x49')](handleError(_0x1a0714,null));};exports['show']=function(_0x5ef98a,_0x13aa29){var _0x57b729={'raw':!![],'where':{'id':_0x5ef98a['params']['id']}},_0x254ed6={};_0x254ed6[_0xd39c('0x33')]=_[_0xd39c('0x35')](db['SmsQueue'][_0xd39c('0x31')]);_0x254ed6[_0xd39c('0x34')]=_['keys'](_0x5ef98a[_0xd39c('0x34')]);_0x254ed6[_0xd39c('0x36')]=_[_0xd39c('0x37')](_0x254ed6[_0xd39c('0x33')],_0x254ed6['query']);_0x57b729['attributes']=_[_0xd39c('0x37')](_0x254ed6[_0xd39c('0x33')],qs[_0xd39c('0x39')](_0x5ef98a[_0xd39c('0x34')][_0xd39c('0x39')]));_0x57b729[_0xd39c('0x38')]=_0x57b729[_0xd39c('0x38')][_0xd39c('0x3a')]?_0x57b729['attributes']:_0x254ed6['model'];if(_0x5ef98a['query']['includeAll']){_0x57b729[_0xd39c('0x47')]=[{'all':!![]}];}_0x57b729=_[_0xd39c('0x40')]({},_0x57b729,_0x5ef98a[_0xd39c('0x44')]);return db[_0xd39c('0x45')][_0xd39c('0x4a')](_0x57b729)[_0xd39c('0x29')](handleEntityNotFound(_0x13aa29,null))[_0xd39c('0x29')](respondWithResult(_0x13aa29,null))[_0xd39c('0x49')](handleError(_0x13aa29,null));};exports[_0xd39c('0x4b')]=function(_0x22ef31,_0x49f70c){return db[_0xd39c('0x45')][_0xd39c('0x4b')](_0x22ef31['body'],{})[_0xd39c('0x29')](function(_0x2e2590){var _0x189a66=_0x22ef31[_0xd39c('0x4c')][_0xd39c('0x2b')]({'plain':!![]});if(!_0x189a66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x189a66[_0xd39c('0x4d')]===_0xd39c('0x4c')){var _0x5cb0b3=_0x2e2590[_0xd39c('0x2b')]({'plain':!![]});var _0x562c62=_0xd39c('0x2c');return db['UserProfileSection'][_0xd39c('0x4a')]({'where':{'name':_0x562c62,'userProfileId':_0x189a66[_0xd39c('0x4e')]},'raw':!![]})[_0xd39c('0x29')](function(_0x4f823e){if(_0x4f823e&&_0x4f823e['autoAssociation']===0x0){return db['UserProfileResource'][_0xd39c('0x4b')]({'name':_0x5cb0b3[_0xd39c('0x43')],'resourceId':_0x5cb0b3['id'],'type':_0x4f823e[_0xd39c('0x43')],'sectionId':_0x4f823e['id']},{})[_0xd39c('0x29')](function(){return _0x2e2590;});}else{return _0x2e2590;}})[_0xd39c('0x49')](function(_0x508168){logger[_0xd39c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x508168);throw _0x508168;});}return _0x2e2590;})[_0xd39c('0x29')](respondWithResult(_0x49f70c,0xc9))[_0xd39c('0x49')](handleError(_0x49f70c,null));};exports[_0xd39c('0x4f')]=function(_0x26c4c9,_0x75dd9e){if(_0x26c4c9[_0xd39c('0x50')]['id']){delete _0x26c4c9['body']['id'];}return db[_0xd39c('0x45')][_0xd39c('0x4a')]({'where':{'id':_0x26c4c9[_0xd39c('0x51')]['id']}})[_0xd39c('0x29')](handleEntityNotFound(_0x75dd9e,null))[_0xd39c('0x29')](saveUpdates(_0x26c4c9[_0xd39c('0x50')],null))['then'](respondWithResult(_0x75dd9e,null))[_0xd39c('0x49')](handleError(_0x75dd9e,null));};exports['destroy']=function(_0x28cf42,_0x2ed1ff){return db[_0xd39c('0x45')][_0xd39c('0x4a')]({'where':{'id':_0x28cf42[_0xd39c('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ed1ff,null))[_0xd39c('0x29')](removeEntity(_0x2ed1ff,null))['catch'](handleError(_0x2ed1ff,null));};exports[_0xd39c('0x52')]=function(_0x14fa00,_0x2e1f33){return db[_0xd39c('0x45')][_0xd39c('0x52')]()['then'](respondWithResult(_0x2e1f33,null))[_0xd39c('0x49')](handleError(_0x2e1f33,null));};exports[_0xd39c('0x53')]=function(_0x58cb3c,_0x2dc660,_0x411401){var _0x34794f={'raw':!![],'where':{}},_0x3930bb={},_0x3599c4;return db[_0xd39c('0x45')][_0xd39c('0x54')]({'where':{'id':_0x58cb3c['params']['id']}})['then'](handleEntityNotFound(_0x2dc660,null))['then'](function(_0x573497){if(_0x573497){_0x3599c4=_0x573497['get']({'plain':!![]});_0x3930bb['model']=_[_0xd39c('0x35')](db[_0xd39c('0x55')][_0xd39c('0x31')]);_0x3930bb[_0xd39c('0x34')]=_[_0xd39c('0x35')](_0x58cb3c[_0xd39c('0x34')]);_0x3930bb[_0xd39c('0x36')]=_[_0xd39c('0x37')](_0x3930bb['model'],_0x3930bb[_0xd39c('0x34')]);_0x34794f['attributes']=_[_0xd39c('0x37')](_0x3930bb['model'],qs[_0xd39c('0x39')](_0x58cb3c['query'][_0xd39c('0x39')]));_0x34794f['attributes']=_0x34794f['attributes'][_0xd39c('0x3a')]?_0x34794f['attributes']:_0x3930bb[_0xd39c('0x33')];if(!_0x58cb3c[_0xd39c('0x34')]['hasOwnProperty'](_0xd39c('0x3b'))){_0x34794f[_0xd39c('0x24')]=qs[_0xd39c('0x24')](_0x58cb3c[_0xd39c('0x34')][_0xd39c('0x24')]);_0x34794f[_0xd39c('0x22')]=qs['offset'](_0x58cb3c[_0xd39c('0x34')][_0xd39c('0x22')]);}_0x34794f[_0xd39c('0x56')]=qs[_0xd39c('0x3c')](_0x58cb3c[_0xd39c('0x34')][_0xd39c('0x3c')]);_0x34794f[_0xd39c('0x3f')]=qs[_0xd39c('0x36')](_[_0xd39c('0x3d')](_0x58cb3c[_0xd39c('0x34')],_0x3930bb['filters']));_0x34794f['where'][_0xd39c('0x57')]=_0x573497['id'];if(_0x58cb3c[_0xd39c('0x34')][_0xd39c('0x3e')]){_0x34794f['where']=_[_0xd39c('0x40')](_0x34794f['where'],{'$or':_[_0xd39c('0x30')](_0x34794f[_0xd39c('0x38')],function(_0x448cda){var _0x224010={};_0x224010[_0x448cda]={'$like':'%'+_0x58cb3c[_0xd39c('0x34')][_0xd39c('0x3e')]+'%'};return _0x224010;})});}_0x34794f=_[_0xd39c('0x40')]({},_0x34794f,_0x58cb3c[_0xd39c('0x44')]);return db[_0xd39c('0x55')][_0xd39c('0x48')](_0x34794f);}})[_0xd39c('0x29')](function(_0x4a9ed1){if(_0x4a9ed1){return db['User'][_0xd39c('0x58')]({'where':{'id':_['map'](_0x4a9ed1,_0xd39c('0x59')),'role':_0xd39c('0x5a')},'attributes':['id',_0xd39c('0x43'),_0xd39c('0x5b'),_0xd39c('0x5c'),_0xd39c('0x5d')]});}})[_0xd39c('0x29')](function(_0x1cb823){if(_0x1cb823){return{'count':_0x1cb823[_0xd39c('0x23')],'rows':_['map'](_0x1cb823[_0xd39c('0x5e')],function(_0xeeffb8){return{'membername':_0xeeffb8['name'],'UserId':_0xeeffb8['id'],'queue_name':_0x3599c4[_0xd39c('0x43')],'SmsQueueId':_0x3599c4['id'],'interface':util[_0xd39c('0x5f')]('%s/%s',_0xd39c('0x60'),_0xeeffb8['name']),'penalty':0x0,'paused':_0xeeffb8[_0xd39c('0x5b')],'createdAt':_0xeeffb8[_0xd39c('0x5d')],'updatedAt':_0xeeffb8[_0xd39c('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2dc660,_0x34794f))[_0xd39c('0x49')](handleError(_0x2dc660,null));};exports[_0xd39c('0x61')]=function(_0x10e843,_0x6d985a,_0x33e6b1){var _0x229611={};var _0x189717={};var _0x31af08;var _0x1fcbba;return db[_0xd39c('0x45')][_0xd39c('0x54')]({'where':{'id':_0x10e843[_0xd39c('0x51')]['id']}})['then'](handleEntityNotFound(_0x6d985a,null))['then'](function(_0x3ea48a){if(_0x3ea48a){_0x31af08=_0x3ea48a;_0x189717[_0xd39c('0x33')]=_['keys'](db[_0xd39c('0x62')][_0xd39c('0x31')]);_0x189717[_0xd39c('0x34')]=_[_0xd39c('0x35')](_0x10e843[_0xd39c('0x34')]);_0x189717[_0xd39c('0x36')]=_[_0xd39c('0x37')](_0x189717[_0xd39c('0x33')],_0x189717[_0xd39c('0x34')]);_0x229611[_0xd39c('0x38')]=_['intersection'](_0x189717['model'],qs['fields'](_0x10e843[_0xd39c('0x34')]['fields']));_0x229611[_0xd39c('0x38')]=_0x229611['attributes'][_0xd39c('0x3a')]?_0x229611[_0xd39c('0x38')]:_0x189717['model'];_0x229611[_0xd39c('0x56')]=qs[_0xd39c('0x3c')](_0x10e843[_0xd39c('0x34')][_0xd39c('0x3c')]);_0x229611['where']=qs[_0xd39c('0x36')](_[_0xd39c('0x3d')](_0x10e843[_0xd39c('0x34')],_0x189717[_0xd39c('0x36')]));if(_0x10e843[_0xd39c('0x34')]['filter']){_0x229611['where']=_[_0xd39c('0x40')](_0x229611[_0xd39c('0x3f')],{'$or':_[_0xd39c('0x30')](_0x229611[_0xd39c('0x38')],function(_0xa27f49){var _0x539a4f={};_0x539a4f[_0xa27f49]={'$like':'%'+_0x10e843[_0xd39c('0x34')][_0xd39c('0x3e')]+'%'};return _0x539a4f;})});}_0x229611=_[_0xd39c('0x40')]({},_0x229611,_0x10e843[_0xd39c('0x44')]);return _0x31af08[_0xd39c('0x61')](_0x229611);}})[_0xd39c('0x29')](function(_0x7cf0a2){if(_0x7cf0a2){_0x1fcbba=_0x7cf0a2['length'];if(!_0x10e843[_0xd39c('0x34')][_0xd39c('0x63')]('nolimit')){_0x229611['limit']=qs[_0xd39c('0x24')](_0x10e843[_0xd39c('0x34')][_0xd39c('0x24')]);_0x229611[_0xd39c('0x22')]=qs['offset'](_0x10e843[_0xd39c('0x34')]['offset']);}return _0x31af08[_0xd39c('0x61')](_0x229611);}})['then'](function(_0x329b40){if(_0x329b40){return _0x329b40?{'count':_0x1fcbba,'rows':_0x329b40}:null;}})[_0xd39c('0x29')](respondWithResult(_0x6d985a,null))[_0xd39c('0x49')](handleError(_0x6d985a,null));};exports[_0xd39c('0x64')]=function(_0x5c2f1e,_0x5a13e1,_0x510382){var _0x47ec2a=_0x5c2f1e['body']['ids'];return db['Team'][_0xd39c('0x48')]({'where':{'id':_0x47ec2a},'attributes':['id'],'include':[{'model':db[_0xd39c('0x65')],'as':_0xd39c('0x66'),'attributes':['id',_0xd39c('0x43'),_0xd39c('0x67'),_0xd39c('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x3ae01b){if(_0x3ae01b){var _0x3fe4e2=_[_0xd39c('0x69')](_0x3ae01b,function(_0x4f68b7){var _0x28fe4f=_0x4f68b7[_0xd39c('0x2b')]({'plain':!![]});return _0x28fe4f[_0xd39c('0x66')];});return db[_0xd39c('0x45')][_0xd39c('0x4a')]({'where':{'id':_0x5c2f1e[_0xd39c('0x51')]['id']}})[_0xd39c('0x29')](function(_0x52b1ab){return db[_0xd39c('0x6a')][_0xd39c('0x6b')](function(_0x288a40){return _0x52b1ab[_0xd39c('0x64')](_0x47ec2a,{'transaction':_0x288a40})[_0xd39c('0x29')](function(){return BPromise[_0xd39c('0x6c')](_0x3fe4e2,function(_0x5ac3e8){return db[_0xd39c('0x55')][_0xd39c('0x6d')]({'where':{'UserId':_0x5ac3e8['id'],'SmsQueueId':_0x5c2f1e[_0xd39c('0x51')]['id']},'transaction':_0x288a40});});})[_0xd39c('0x29')](function(){_0x3fe4e2['forEach'](function(_0x21724f){socket['emit'](_0xd39c('0x6e'),{'UserId':_0x21724f['id'],'SmsQueueId':_0x52b1ab['id']});});});});});}})[_0xd39c('0x29')](respondWithStatusCode(_0x5a13e1,null))[_0xd39c('0x49')](handleError(_0x5a13e1,null));};exports[_0xd39c('0x6f')]=function(_0x10e626,_0x14cf24,_0x3d1bab){return db['Team']['findAll']({'where':{'id':_0x10e626[_0xd39c('0x34')][_0xd39c('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd39c('0x29')](handleEntityNotFound(_0x14cf24,null))[_0xd39c('0x29')](function(_0x5aaf70){var _0x2fcf51=_[_0xd39c('0x30')](_0x5aaf70,'id');var _0x4d4e2e=[];var _0x418f18=[];var _0x120b05=squel[_0xd39c('0x71')]();_0x120b05[_0xd39c('0x72')](_0xd39c('0x73'))[_0xd39c('0x74')](_0xd39c('0x75'),'tq')[_0xd39c('0x76')](_0xd39c('0x77'),'ut',_0xd39c('0x78'))[_0xd39c('0x3f')]('SmsQueueId\x20=\x20?',_0x10e626[_0xd39c('0x51')]['id']);for(var _0x6b78f8=0x0;_0x6b78f8<_0x5aaf70[_0xd39c('0x3a')];_0x6b78f8+=0x1){let _0x2fb427=_0x5aaf70[_0x6b78f8];for(var _0x33363d=0x0;_0x33363d<_0x2fb427[_0xd39c('0x66')]['length'];_0x33363d+=0x1){let _0x1fcf95=_0x2fb427[_0xd39c('0x66')][_0x33363d];var _0x26327a=_0x120b05['clone']();_0x26327a[_0xd39c('0x3f')](_0xd39c('0x79'),_0x1fcf95['id']);_0x418f18['push'](db['sequelize']['query'](_0x26327a[_0xd39c('0x7a')](),{'type':db[_0xd39c('0x6a')][_0xd39c('0x7b')]['SELECT']})[_0xd39c('0x29')](function(_0x15efdb){if(_0x15efdb[_0xd39c('0x3a')]===0x1){return _0x1fcf95['id'];}else{var _0xd459fe=_['every'](_[_0xd39c('0x30')](_0x15efdb,_0xd39c('0x7c')),function(_0x31e8aa){return _[_0xd39c('0x7d')](_0x2fcf51,_0x31e8aa);});if(_0xd459fe){return _0x1fcf95['id'];}}}));}}return BPromise[_0xd39c('0x7e')](_0x418f18)[_0xd39c('0x29')](function(_0x3c3477){_0x4d4e2e=_(_0x4d4e2e)[_0xd39c('0x7f')](_0x3c3477)[_0xd39c('0x80')]()[_0xd39c('0x81')]();return db[_0xd39c('0x45')][_0xd39c('0x4a')]({'where':{'id':_0x10e626['params']['id']}})[_0xd39c('0x29')](function(_0x55a095){return db[_0xd39c('0x6a')][_0xd39c('0x6b')](function(_0x48b1d1){return _0x55a095[_0xd39c('0x6f')](_0x10e626[_0xd39c('0x34')][_0xd39c('0x70')],{'transaction':_0x48b1d1})['then'](function(){if(!_['isEmpty'](_0x4d4e2e)){return _0x55a095[_0xd39c('0x82')](_0x4d4e2e,{'transaction':_0x48b1d1});}})[_0xd39c('0x29')](function(){_0x4d4e2e[_0xd39c('0x83')](function(_0x1bf3c7){socket[_0xd39c('0x84')](_0xd39c('0x85'),{'UserId':_0x1bf3c7,'SmsQueueId':_0x55a095['id']});});});});});});})[_0xd39c('0x29')](respondWithStatusCode(_0x14cf24,null))['catch'](handleError(_0x14cf24,null));};exports[_0xd39c('0x86')]=function(_0x3d0ee9,_0x3b48da,_0x24b5d5){return db[_0xd39c('0x45')]['find']({'where':{'id':_0x3d0ee9[_0xd39c('0x51')]['id']}})[_0xd39c('0x29')](handleEntityNotFound(_0x3b48da,null))[_0xd39c('0x29')](function(_0x1922a5){if(_0x1922a5){return _0x1922a5[_0xd39c('0x86')](_0x3d0ee9[_0xd39c('0x50')]['ids'],_[_0xd39c('0x87')](_0x3d0ee9['body'],[_0xd39c('0x70'),'id'])||{})[_0xd39c('0x88')](function(_0x4995c7){for(var _0x4cc18f=0x0;_0x4cc18f<_0x3d0ee9[_0xd39c('0x50')][_0xd39c('0x70')][_0xd39c('0x3a')];_0x4cc18f+=0x1){socket[_0xd39c('0x84')](_0xd39c('0x6e'),{'UserId':Number(_0x3d0ee9['body'][_0xd39c('0x70')][_0x4cc18f]),'SmsQueueId':Number(_0x3d0ee9['params']['id'])});}return _0x4995c7;});}})[_0xd39c('0x29')](respondWithResult(_0x3b48da,null))[_0xd39c('0x49')](handleError(_0x3b48da,null));};exports['removeAgents']=function(_0x28cdee,_0x330afb,_0x3fed26){return db[_0xd39c('0x45')][_0xd39c('0x4a')]({'where':{'id':_0x28cdee[_0xd39c('0x51')]['id']}})[_0xd39c('0x29')](handleEntityNotFound(_0x330afb,null))['then'](function(_0x54ab61){if(_0x54ab61){return _0x54ab61[_0xd39c('0x82')](_0x28cdee[_0xd39c('0x34')]['ids'])[_0xd39c('0x29')](function(){if(_[_0xd39c('0x89')](_0x28cdee[_0xd39c('0x34')][_0xd39c('0x70')])){for(var _0x1cec13=0x0;_0x1cec13<_0x28cdee[_0xd39c('0x34')]['ids']['length'];_0x1cec13+=0x1){socket[_0xd39c('0x84')](_0xd39c('0x85'),{'UserId':Number(_0x28cdee[_0xd39c('0x34')][_0xd39c('0x70')][_0x1cec13]),'SmsQueueId':Number(_0x28cdee[_0xd39c('0x51')]['id'])});}}else{socket[_0xd39c('0x84')](_0xd39c('0x85'),{'UserId':Number(_0x28cdee[_0xd39c('0x34')][_0xd39c('0x70')]),'SmsQueueId':Number(_0x28cdee[_0xd39c('0x51')]['id'])});}});}})[_0xd39c('0x29')](respondWithStatusCode(_0x330afb,null))[_0xd39c('0x49')](handleError(_0x330afb,null));};exports['getAgents']=function(_0x3574a8,_0x51ad90,_0x9f11a8){var _0x1484d7={};var _0x46b933={};var _0x1e7fdd;var _0xff3bbf;return db[_0xd39c('0x45')][_0xd39c('0x54')]({'where':{'id':_0x3574a8[_0xd39c('0x51')]['id']}})['then'](handleEntityNotFound(_0x51ad90,null))[_0xd39c('0x29')](function(_0x51b899){if(_0x51b899){_0x1e7fdd=_0x51b899;_0x46b933['model']=_[_0xd39c('0x35')](db[_0xd39c('0x65')][_0xd39c('0x31')]);_0x46b933[_0xd39c('0x34')]=_[_0xd39c('0x35')](_0x3574a8[_0xd39c('0x34')]);_0x46b933[_0xd39c('0x36')]=_[_0xd39c('0x37')](_0x46b933[_0xd39c('0x33')],_0x46b933['query']);_0x1484d7[_0xd39c('0x38')]=_['intersection'](_0x46b933[_0xd39c('0x33')],qs[_0xd39c('0x39')](_0x3574a8[_0xd39c('0x34')]['fields']));_0x1484d7['attributes']=_0x1484d7[_0xd39c('0x38')][_0xd39c('0x3a')]?_0x1484d7[_0xd39c('0x38')]:_0x46b933[_0xd39c('0x33')];_0x1484d7['order']=qs[_0xd39c('0x3c')](_0x3574a8[_0xd39c('0x34')]['sort']);_0x1484d7[_0xd39c('0x3f')]=qs[_0xd39c('0x36')](_[_0xd39c('0x3d')](_0x3574a8[_0xd39c('0x34')],_0x46b933['filters']));if(_0x3574a8[_0xd39c('0x34')]['filter']){_0x1484d7[_0xd39c('0x3f')]=_['merge'](_0x1484d7['where'],{'$or':_[_0xd39c('0x30')](_0x1484d7[_0xd39c('0x38')],function(_0x38fe59){var _0x18127c={};_0x18127c[_0x38fe59]={'$like':'%'+_0x3574a8['query'][_0xd39c('0x3e')]+'%'};return _0x18127c;})});}_0x1484d7=_[_0xd39c('0x40')]({},_0x1484d7,_0x3574a8[_0xd39c('0x44')]);return _0x1e7fdd['getAgents'](_0x1484d7);}})[_0xd39c('0x29')](function(_0x178f90){if(_0x178f90){_0xff3bbf=_0x178f90['length'];if(!_0x3574a8[_0xd39c('0x34')][_0xd39c('0x63')](_0xd39c('0x3b'))){_0x1484d7['limit']=qs[_0xd39c('0x24')](_0x3574a8[_0xd39c('0x34')][_0xd39c('0x24')]);_0x1484d7['offset']=qs['offset'](_0x3574a8['query'][_0xd39c('0x22')]);}return _0x1e7fdd['getAgents'](_0x1484d7);}})[_0xd39c('0x29')](function(_0x5e9e12){if(_0x5e9e12){return _0x5e9e12?{'count':_0xff3bbf,'rows':_0x5e9e12}:null;}})['then'](respondWithResult(_0x51ad90,null))['catch'](handleError(_0x51ad90,null));}; \ No newline at end of file +var _0xc468=['options','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserSmsQueue','order','findAndCountAll','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsQueue.socket','register','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','catch','show','params'];(function(_0x35ed66,_0x2e94c5){var _0x4b33a6=function(_0x21c8cc){while(--_0x21c8cc){_0x35ed66['push'](_0x35ed66['shift']());}};_0x4b33a6(++_0x2e94c5);}(_0xc468,0xd0));var _0x8c46=function(_0x2c8898,_0x1b5aa4){_0x2c8898=_0x2c8898-0x0;var _0x37cb1a=_0xc468[_0x2c8898];return _0x37cb1a;};'use strict';var emlformat=require(_0x8c46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c46('0x1'));var jsonpatch=require(_0x8c46('0x2'));var rp=require(_0x8c46('0x3'));var moment=require(_0x8c46('0x4'));var BPromise=require(_0x8c46('0x5'));var Mustache=require(_0x8c46('0x6'));var util=require(_0x8c46('0x7'));var path=require(_0x8c46('0x8'));var sox=require(_0x8c46('0x9'));var csv=require('to-csv');var ejs=require(_0x8c46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c46('0xb'));var squel=require(_0x8c46('0xc'));var crypto=require(_0x8c46('0xd'));var jsforce=require(_0x8c46('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c46('0xf'));var querystring=require(_0x8c46('0x10'));var Papa=require(_0x8c46('0x11'));var Redis=require('ioredis');var authService=require(_0x8c46('0x12'));var qs=require(_0x8c46('0x13'));var as=require(_0x8c46('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c46('0x15'))(_0x8c46('0x16'));var utils=require(_0x8c46('0x17'));var config=require(_0x8c46('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8c46('0x19')]=_['defaults'](config['redis'],{'host':_0x8c46('0x1a'),'port':0x18eb});var socket=require(_0x8c46('0x1b'))(new Redis(config[_0x8c46('0x19')]));require(_0x8c46('0x1c'))[_0x8c46('0x1d')](socket);function respondWithStatusCode(_0x20e656,_0x2b7a7f){_0x2b7a7f=_0x2b7a7f||0xcc;return function(_0x4632d4){if(_0x4632d4){return _0x20e656['sendStatus'](_0x2b7a7f);}return _0x20e656['status'](_0x2b7a7f)[_0x8c46('0x1e')]();};}function respondWithResult(_0x3d74b9,_0x2cf6ae){_0x2cf6ae=_0x2cf6ae||0xc8;return function(_0x25a3f3){if(_0x25a3f3){return _0x3d74b9[_0x8c46('0x1f')](_0x2cf6ae)[_0x8c46('0x20')](_0x25a3f3);}};}function respondWithFilteredResult(_0x3d08bc,_0x1fb993){return function(_0x167855){if(_0x167855){var _0x36680f=typeof _0x1fb993[_0x8c46('0x21')]===_0x8c46('0x22')&&typeof _0x1fb993[_0x8c46('0x23')]===_0x8c46('0x22');var _0x3420ef=_0x167855[_0x8c46('0x24')];var _0x2b2430=_0x36680f?0x0:_0x1fb993[_0x8c46('0x21')];var _0x5564ca=_0x36680f?_0x167855[_0x8c46('0x24')]:_0x1fb993[_0x8c46('0x21')]+_0x1fb993[_0x8c46('0x23')];var _0x1b164c;if(_0x5564ca>=_0x3420ef){_0x5564ca=_0x3420ef;_0x1b164c=0xc8;}else{_0x1b164c=0xce;}_0x3d08bc['status'](_0x1b164c);return _0x3d08bc['set']('Content-Range',_0x2b2430+'-'+_0x5564ca+'/'+_0x3420ef)['json'](_0x167855);}return null;};}function patchUpdates(_0x12d5fa){return function(_0x44de5e){try{jsonpatch[_0x8c46('0x25')](_0x44de5e,_0x12d5fa,!![]);}catch(_0x8160){return BPromise[_0x8c46('0x26')](_0x8160);}return _0x44de5e[_0x8c46('0x27')]();};}function saveUpdates(_0x320805,_0x38adf9){return function(_0x58a7f0){if(_0x58a7f0){return _0x58a7f0[_0x8c46('0x28')](_0x320805)[_0x8c46('0x29')](function(_0x2a583f){return _0x2a583f;});}return null;};}function removeEntity(_0x333360,_0x4aed4b){return function(_0x23f498){if(_0x23f498){return _0x23f498[_0x8c46('0x2a')]()[_0x8c46('0x29')](function(){var _0x28dda8=_0x23f498[_0x8c46('0x2b')]({'plain':!![]});var _0x4bf8bf=_0x8c46('0x2c');return db[_0x8c46('0x2d')][_0x8c46('0x2a')]({'where':{'type':_0x4bf8bf,'resourceId':_0x28dda8['id']}})[_0x8c46('0x29')](function(){return _0x23f498;});})[_0x8c46('0x29')](function(){_0x333360[_0x8c46('0x1f')](0xcc)[_0x8c46('0x1e')]();});}};}function handleEntityNotFound(_0x4bc631,_0x467871){return function(_0x3ce18b){if(!_0x3ce18b){_0x4bc631[_0x8c46('0x2e')](0x194);}return _0x3ce18b;};}function handleError(_0x9ed31a,_0x270cf0){_0x270cf0=_0x270cf0||0x1f4;return function(_0x42a27f){logger[_0x8c46('0x2f')](_0x42a27f[_0x8c46('0x30')]);if(_0x42a27f['name']){delete _0x42a27f[_0x8c46('0x31')];}_0x9ed31a[_0x8c46('0x1f')](_0x270cf0)[_0x8c46('0x32')](_0x42a27f);};}exports[_0x8c46('0x33')]=function(_0x30d4db,_0x490ffe){var _0x7c8476={},_0x5e3916={},_0x3e95d9={'count':0x0,'rows':[]};var _0x4190a2=_[_0x8c46('0x34')](db[_0x8c46('0x35')][_0x8c46('0x36')],function(_0x484383){return{'name':_0x484383[_0x8c46('0x37')],'type':_0x484383[_0x8c46('0x38')][_0x8c46('0x39')]};});_0x5e3916['model']=_['map'](_0x4190a2,_0x8c46('0x31'));_0x5e3916[_0x8c46('0x3a')]=_[_0x8c46('0x3b')](_0x30d4db[_0x8c46('0x3a')]);_0x5e3916[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x5e3916['model'],_0x5e3916['query']);_0x7c8476[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x5e3916[_0x8c46('0x3f')],qs[_0x8c46('0x40')](_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x7c8476[_0x8c46('0x3e')]=_0x7c8476['attributes'][_0x8c46('0x41')]?_0x7c8476[_0x8c46('0x3e')]:_0x5e3916[_0x8c46('0x3f')];if(!_0x30d4db['query']['hasOwnProperty'](_0x8c46('0x42'))){_0x7c8476[_0x8c46('0x23')]=qs[_0x8c46('0x23')](_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x23')]);_0x7c8476[_0x8c46('0x21')]=qs['offset'](_0x30d4db['query'][_0x8c46('0x21')]);}_0x7c8476['order']=qs['sort'](_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x43')]);_0x7c8476['where']=qs['filters'](_[_0x8c46('0x44')](_0x30d4db[_0x8c46('0x3a')],_0x5e3916[_0x8c46('0x3c')]),_0x4190a2);if(_0x30d4db['query'][_0x8c46('0x45')]){_0x7c8476[_0x8c46('0x46')]=_['merge'](_0x7c8476['where'],{'$or':_[_0x8c46('0x34')](_0x4190a2,function(_0xb75a27){if(_0xb75a27['type']!==_0x8c46('0x47')){var _0x510fac={};_0x510fac[_0xb75a27[_0x8c46('0x31')]]={'$like':'%'+_0x30d4db['query'][_0x8c46('0x45')]+'%'};return _0x510fac;}})});}_0x7c8476=_[_0x8c46('0x48')]({},_0x7c8476,_0x30d4db['options']);var _0x53c4bb={'where':_0x7c8476[_0x8c46('0x46')]};return db[_0x8c46('0x35')][_0x8c46('0x24')](_0x53c4bb)[_0x8c46('0x29')](function(_0x49fb1a){_0x3e95d9['count']=_0x49fb1a;if(_0x30d4db[_0x8c46('0x3a')][_0x8c46('0x49')]){_0x7c8476['include']=[{'all':!![]}];}return db[_0x8c46('0x35')][_0x8c46('0x4a')](_0x7c8476);})[_0x8c46('0x29')](function(_0x52c61e){_0x3e95d9['rows']=_0x52c61e;return _0x3e95d9;})['then'](respondWithFilteredResult(_0x490ffe,_0x7c8476))[_0x8c46('0x4b')](handleError(_0x490ffe,null));};exports[_0x8c46('0x4c')]=function(_0x2900ac,_0x32bd7d){var _0x139ae7={'raw':!![],'where':{'id':_0x2900ac[_0x8c46('0x4d')]['id']}},_0x14d5cd={};_0x14d5cd['model']=_[_0x8c46('0x3b')](db[_0x8c46('0x35')][_0x8c46('0x36')]);_0x14d5cd[_0x8c46('0x3a')]=_['keys'](_0x2900ac[_0x8c46('0x3a')]);_0x14d5cd[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x14d5cd[_0x8c46('0x3f')],_0x14d5cd[_0x8c46('0x3a')]);_0x139ae7[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x14d5cd[_0x8c46('0x3f')],qs['fields'](_0x2900ac[_0x8c46('0x3a')]['fields']));_0x139ae7[_0x8c46('0x3e')]=_0x139ae7[_0x8c46('0x3e')][_0x8c46('0x41')]?_0x139ae7[_0x8c46('0x3e')]:_0x14d5cd[_0x8c46('0x3f')];if(_0x2900ac[_0x8c46('0x3a')][_0x8c46('0x49')]){_0x139ae7['include']=[{'all':!![]}];}_0x139ae7=_[_0x8c46('0x48')]({},_0x139ae7,_0x2900ac[_0x8c46('0x4e')]);return db[_0x8c46('0x35')][_0x8c46('0x4f')](_0x139ae7)[_0x8c46('0x29')](handleEntityNotFound(_0x32bd7d,null))[_0x8c46('0x29')](respondWithResult(_0x32bd7d,null))[_0x8c46('0x4b')](handleError(_0x32bd7d,null));};exports[_0x8c46('0x50')]=function(_0x3cef9a,_0x293d52){return db[_0x8c46('0x35')][_0x8c46('0x50')](_0x3cef9a['body'],{})['then'](function(_0x1a4c6b){var _0x3decf6=_0x3cef9a[_0x8c46('0x51')]['get']({'plain':!![]});if(!_0x3decf6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3decf6['role']==='user'){var _0x5d47d5=_0x1a4c6b['get']({'plain':!![]});var _0x4eadf8=_0x8c46('0x2c');return db[_0x8c46('0x52')][_0x8c46('0x4f')]({'where':{'name':_0x4eadf8,'userProfileId':_0x3decf6[_0x8c46('0x53')]},'raw':!![]})[_0x8c46('0x29')](function(_0x353258){if(_0x353258&&_0x353258['autoAssociation']===0x0){return db[_0x8c46('0x2d')]['create']({'name':_0x5d47d5[_0x8c46('0x31')],'resourceId':_0x5d47d5['id'],'type':_0x353258[_0x8c46('0x31')],'sectionId':_0x353258['id']},{})[_0x8c46('0x29')](function(){return _0x1a4c6b;});}else{return _0x1a4c6b;}})[_0x8c46('0x4b')](function(_0xc4aa65){logger[_0x8c46('0x2f')](_0x8c46('0x54'),_0xc4aa65);throw _0xc4aa65;});}return _0x1a4c6b;})[_0x8c46('0x29')](respondWithResult(_0x293d52,0xc9))[_0x8c46('0x4b')](handleError(_0x293d52,null));};exports[_0x8c46('0x28')]=function(_0x1a5aff,_0x2b178d){if(_0x1a5aff['body']['id']){delete _0x1a5aff[_0x8c46('0x55')]['id'];}return db[_0x8c46('0x35')]['find']({'where':{'id':_0x1a5aff[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x2b178d,null))[_0x8c46('0x29')](saveUpdates(_0x1a5aff[_0x8c46('0x55')],null))[_0x8c46('0x29')](respondWithResult(_0x2b178d,null))[_0x8c46('0x4b')](handleError(_0x2b178d,null));};exports[_0x8c46('0x2a')]=function(_0x228cea,_0x355f3e){return db[_0x8c46('0x35')][_0x8c46('0x4f')]({'where':{'id':_0x228cea[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x355f3e,null))[_0x8c46('0x29')](removeEntity(_0x355f3e,null))['catch'](handleError(_0x355f3e,null));};exports[_0x8c46('0x56')]=function(_0x55749b,_0x1abb97){return db[_0x8c46('0x35')]['describe']()[_0x8c46('0x29')](respondWithResult(_0x1abb97,null))[_0x8c46('0x4b')](handleError(_0x1abb97,null));};exports['getMembers']=function(_0x47d41f,_0x10c6dc,_0x5c2b32){var _0x3d79eb={'raw':!![],'where':{}},_0x2257b8={},_0x40cecc;return db[_0x8c46('0x35')][_0x8c46('0x57')]({'where':{'id':_0x47d41f[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x10c6dc,null))[_0x8c46('0x29')](function(_0x1d08c7){if(_0x1d08c7){_0x40cecc=_0x1d08c7[_0x8c46('0x2b')]({'plain':!![]});_0x2257b8['model']=_['keys'](db[_0x8c46('0x58')][_0x8c46('0x36')]);_0x2257b8['query']=_['keys'](_0x47d41f['query']);_0x2257b8[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x2257b8[_0x8c46('0x3f')],_0x2257b8['query']);_0x3d79eb[_0x8c46('0x3e')]=_['intersection'](_0x2257b8[_0x8c46('0x3f')],qs[_0x8c46('0x40')](_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x3d79eb[_0x8c46('0x3e')]=_0x3d79eb[_0x8c46('0x3e')]['length']?_0x3d79eb[_0x8c46('0x3e')]:_0x2257b8[_0x8c46('0x3f')];if(!_0x47d41f[_0x8c46('0x3a')]['hasOwnProperty'](_0x8c46('0x42'))){_0x3d79eb['limit']=qs[_0x8c46('0x23')](_0x47d41f[_0x8c46('0x3a')]['limit']);_0x3d79eb['offset']=qs[_0x8c46('0x21')](_0x47d41f['query']['offset']);}_0x3d79eb[_0x8c46('0x59')]=qs[_0x8c46('0x43')](_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x43')]);_0x3d79eb['where']=qs[_0x8c46('0x3c')](_[_0x8c46('0x44')](_0x47d41f['query'],_0x2257b8['filters']));_0x3d79eb[_0x8c46('0x46')]['SmsQueueId']=_0x1d08c7['id'];if(_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x45')]){_0x3d79eb[_0x8c46('0x46')]=_[_0x8c46('0x48')](_0x3d79eb[_0x8c46('0x46')],{'$or':_['map'](_0x3d79eb[_0x8c46('0x3e')],function(_0x2cac08){var _0x7c6a3f={};_0x7c6a3f[_0x2cac08]={'$like':'%'+_0x47d41f[_0x8c46('0x3a')][_0x8c46('0x45')]+'%'};return _0x7c6a3f;})});}_0x3d79eb=_[_0x8c46('0x48')]({},_0x3d79eb,_0x47d41f[_0x8c46('0x4e')]);return db[_0x8c46('0x58')][_0x8c46('0x4a')](_0x3d79eb);}})[_0x8c46('0x29')](function(_0x3fd0e1){if(_0x3fd0e1){return db['User'][_0x8c46('0x5a')]({'where':{'id':_[_0x8c46('0x34')](_0x3fd0e1,'UserId'),'role':_0x8c46('0x5b')},'attributes':['id',_0x8c46('0x31'),_0x8c46('0x5c'),'updatedAt',_0x8c46('0x5d')]});}})[_0x8c46('0x29')](function(_0x2ca995){if(_0x2ca995){return{'count':_0x2ca995[_0x8c46('0x24')],'rows':_[_0x8c46('0x34')](_0x2ca995['rows'],function(_0x39fd42){return{'membername':_0x39fd42['name'],'UserId':_0x39fd42['id'],'queue_name':_0x40cecc['name'],'SmsQueueId':_0x40cecc['id'],'interface':util[_0x8c46('0x5e')](_0x8c46('0x5f'),_0x8c46('0x60'),_0x39fd42['name']),'penalty':0x0,'paused':_0x39fd42[_0x8c46('0x5c')],'createdAt':_0x39fd42[_0x8c46('0x5d')],'updatedAt':_0x39fd42[_0x8c46('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x10c6dc,_0x3d79eb))['catch'](handleError(_0x10c6dc,null));};exports[_0x8c46('0x62')]=function(_0x36d125,_0x7fd5fb,_0x18cfb3){var _0x41f73a={};var _0x2b4880={};var _0x325162;var _0x2648f4;return db[_0x8c46('0x35')][_0x8c46('0x57')]({'where':{'id':_0x36d125[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x7fd5fb,null))[_0x8c46('0x29')](function(_0x49fee7){if(_0x49fee7){_0x325162=_0x49fee7;_0x2b4880['model']=_[_0x8c46('0x3b')](db[_0x8c46('0x63')][_0x8c46('0x36')]);_0x2b4880['query']=_[_0x8c46('0x3b')](_0x36d125[_0x8c46('0x3a')]);_0x2b4880[_0x8c46('0x3c')]=_[_0x8c46('0x3d')](_0x2b4880['model'],_0x2b4880['query']);_0x41f73a[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x2b4880[_0x8c46('0x3f')],qs[_0x8c46('0x40')](_0x36d125[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x41f73a[_0x8c46('0x3e')]=_0x41f73a['attributes'][_0x8c46('0x41')]?_0x41f73a[_0x8c46('0x3e')]:_0x2b4880[_0x8c46('0x3f')];_0x41f73a[_0x8c46('0x59')]=qs[_0x8c46('0x43')](_0x36d125['query']['sort']);_0x41f73a[_0x8c46('0x46')]=qs[_0x8c46('0x3c')](_[_0x8c46('0x44')](_0x36d125[_0x8c46('0x3a')],_0x2b4880['filters']));if(_0x36d125[_0x8c46('0x3a')][_0x8c46('0x45')]){_0x41f73a[_0x8c46('0x46')]=_[_0x8c46('0x48')](_0x41f73a[_0x8c46('0x46')],{'$or':_[_0x8c46('0x34')](_0x41f73a['attributes'],function(_0x33a3b9){var _0x30add5={};_0x30add5[_0x33a3b9]={'$like':'%'+_0x36d125[_0x8c46('0x3a')][_0x8c46('0x45')]+'%'};return _0x30add5;})});}_0x41f73a=_['merge']({},_0x41f73a,_0x36d125[_0x8c46('0x4e')]);return _0x325162[_0x8c46('0x62')](_0x41f73a);}})[_0x8c46('0x29')](function(_0x570b65){if(_0x570b65){_0x2648f4=_0x570b65[_0x8c46('0x41')];if(!_0x36d125['query'][_0x8c46('0x64')](_0x8c46('0x42'))){_0x41f73a[_0x8c46('0x23')]=qs[_0x8c46('0x23')](_0x36d125[_0x8c46('0x3a')][_0x8c46('0x23')]);_0x41f73a[_0x8c46('0x21')]=qs[_0x8c46('0x21')](_0x36d125[_0x8c46('0x3a')][_0x8c46('0x21')]);}return _0x325162[_0x8c46('0x62')](_0x41f73a);}})[_0x8c46('0x29')](function(_0x3927f8){if(_0x3927f8){return _0x3927f8?{'count':_0x2648f4,'rows':_0x3927f8}:null;}})['then'](respondWithResult(_0x7fd5fb,null))[_0x8c46('0x4b')](handleError(_0x7fd5fb,null));};exports[_0x8c46('0x65')]=function(_0x1e3d33,_0x41a643,_0x9938e3){var _0x2386cc=_0x1e3d33[_0x8c46('0x55')][_0x8c46('0x66')];return db[_0x8c46('0x63')][_0x8c46('0x4a')]({'where':{'id':_0x2386cc},'attributes':['id'],'include':[{'model':db[_0x8c46('0x67')],'as':_0x8c46('0x68'),'attributes':['id',_0x8c46('0x31'),_0x8c46('0x69'),_0x8c46('0x6a'),_0x8c46('0x6b')],'raw':!![]}]})['then'](function(_0x473da6){if(_0x473da6){var _0xa0c55d=_[_0x8c46('0x6c')](_0x473da6,function(_0x23e31a){var _0x1b0c97=_0x23e31a[_0x8c46('0x2b')]({'plain':!![]});return _0x1b0c97[_0x8c46('0x68')];});return db['SmsQueue'][_0x8c46('0x4f')]({'where':{'id':_0x1e3d33['params']['id']}})[_0x8c46('0x29')](function(_0x267e55){return db['sequelize']['transaction'](function(_0x51e213){return _0x267e55['addTeams'](_0x2386cc,{'transaction':_0x51e213})[_0x8c46('0x29')](function(){return BPromise[_0x8c46('0x6d')](_0xa0c55d,function(_0x52089d){return db[_0x8c46('0x58')][_0x8c46('0x6e')]({'where':{'UserId':_0x52089d['id'],'SmsQueueId':_0x1e3d33['params']['id']},'transaction':_0x51e213});});})['then'](function(){_0xa0c55d[_0x8c46('0x6f')](function(_0x135118){socket[_0x8c46('0x70')](_0x8c46('0x71'),{'UserId':_0x135118['id'],'SmsQueueId':_0x267e55['id']});});});});});}})[_0x8c46('0x29')](respondWithStatusCode(_0x41a643,null))[_0x8c46('0x4b')](handleError(_0x41a643,null));};exports['removeTeams']=function(_0x214fbe,_0x2f905f,_0x41ee06){return db[_0x8c46('0x63')][_0x8c46('0x4a')]({'where':{'id':_0x214fbe[_0x8c46('0x3a')][_0x8c46('0x66')]},'attributes':['id'],'include':[{'model':db[_0x8c46('0x67')],'as':_0x8c46('0x68'),'attributes':['id'],'raw':!![]}]})[_0x8c46('0x29')](handleEntityNotFound(_0x2f905f,null))[_0x8c46('0x29')](function(_0xcdb8a5){var _0x3533e1=_[_0x8c46('0x34')](_0xcdb8a5,'id');var _0x49afdb=[];var _0x3cbd57=[];var _0x1b72f1=squel[_0x8c46('0x72')]();_0x1b72f1[_0x8c46('0x73')]('tq.TeamId')[_0x8c46('0x74')](_0x8c46('0x75'),'tq')[_0x8c46('0x76')](_0x8c46('0x77'),'ut',_0x8c46('0x78'))[_0x8c46('0x46')](_0x8c46('0x79'),_0x214fbe[_0x8c46('0x4d')]['id']);for(var _0x1b3f73=0x0;_0x1b3f73<_0xcdb8a5[_0x8c46('0x41')];_0x1b3f73+=0x1){let _0x1d67bc=_0xcdb8a5[_0x1b3f73];for(var _0x27020f=0x0;_0x27020f<_0x1d67bc[_0x8c46('0x68')][_0x8c46('0x41')];_0x27020f+=0x1){let _0x1d8de2=_0x1d67bc['Agents'][_0x27020f];var _0x117bbc=_0x1b72f1[_0x8c46('0x7a')]();_0x117bbc[_0x8c46('0x46')](_0x8c46('0x7b'),_0x1d8de2['id']);_0x3cbd57[_0x8c46('0x7c')](db['sequelize']['query'](_0x117bbc[_0x8c46('0x7d')](),{'type':db[_0x8c46('0x7e')]['QueryTypes']['SELECT']})[_0x8c46('0x29')](function(_0x1d9841){if(_0x1d9841[_0x8c46('0x41')]===0x1){return _0x1d8de2['id'];}else{var _0x218a4d=_[_0x8c46('0x7f')](_[_0x8c46('0x34')](_0x1d9841,_0x8c46('0x80')),function(_0x1560de){return _[_0x8c46('0x81')](_0x3533e1,_0x1560de);});if(_0x218a4d){return _0x1d8de2['id'];}}}));}}return BPromise[_0x8c46('0x82')](_0x3cbd57)[_0x8c46('0x29')](function(_0x293227){_0x49afdb=_(_0x49afdb)[_0x8c46('0x83')](_0x293227)[_0x8c46('0x84')]()[_0x8c46('0x85')]();return db[_0x8c46('0x35')]['find']({'where':{'id':_0x214fbe[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](function(_0x2af691){return db[_0x8c46('0x7e')]['transaction'](function(_0x3733d4){return _0x2af691[_0x8c46('0x86')](_0x214fbe[_0x8c46('0x3a')]['ids'],{'transaction':_0x3733d4})[_0x8c46('0x29')](function(){if(!_[_0x8c46('0x87')](_0x49afdb)){return _0x2af691['removeAgents'](_0x49afdb,{'transaction':_0x3733d4});}})['then'](function(){_0x49afdb[_0x8c46('0x6f')](function(_0x5ce6dc){socket['emit'](_0x8c46('0x88'),{'UserId':_0x5ce6dc,'SmsQueueId':_0x2af691['id']});});});});});});})['then'](respondWithStatusCode(_0x2f905f,null))['catch'](handleError(_0x2f905f,null));};exports[_0x8c46('0x89')]=function(_0x426d39,_0x451089,_0x3fe492){return db[_0x8c46('0x35')][_0x8c46('0x4f')]({'where':{'id':_0x426d39['params']['id']}})['then'](handleEntityNotFound(_0x451089,null))[_0x8c46('0x29')](function(_0x1a1587){if(_0x1a1587){return _0x1a1587[_0x8c46('0x89')](_0x426d39[_0x8c46('0x55')][_0x8c46('0x66')],_[_0x8c46('0x8a')](_0x426d39[_0x8c46('0x55')],[_0x8c46('0x66'),'id'])||{})[_0x8c46('0x8b')](function(_0x2dada2){for(var _0x47a61e=0x0;_0x47a61e<_0x426d39[_0x8c46('0x55')][_0x8c46('0x66')][_0x8c46('0x41')];_0x47a61e+=0x1){socket[_0x8c46('0x70')](_0x8c46('0x71'),{'UserId':Number(_0x426d39['body'][_0x8c46('0x66')][_0x47a61e]),'SmsQueueId':Number(_0x426d39[_0x8c46('0x4d')]['id'])});}return _0x2dada2;});}})[_0x8c46('0x29')](respondWithResult(_0x451089,null))[_0x8c46('0x4b')](handleError(_0x451089,null));};exports[_0x8c46('0x8c')]=function(_0x1a2c3c,_0x44b9cb,_0x3031a6){return db['SmsQueue'][_0x8c46('0x4f')]({'where':{'id':_0x1a2c3c[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x44b9cb,null))[_0x8c46('0x29')](function(_0x2ad17a){if(_0x2ad17a){return _0x2ad17a[_0x8c46('0x8c')](_0x1a2c3c[_0x8c46('0x3a')][_0x8c46('0x66')])[_0x8c46('0x29')](function(){if(_[_0x8c46('0x8d')](_0x1a2c3c[_0x8c46('0x3a')][_0x8c46('0x66')])){for(var _0x296564=0x0;_0x296564<_0x1a2c3c[_0x8c46('0x3a')]['ids']['length'];_0x296564+=0x1){socket[_0x8c46('0x70')](_0x8c46('0x88'),{'UserId':Number(_0x1a2c3c[_0x8c46('0x3a')]['ids'][_0x296564]),'SmsQueueId':Number(_0x1a2c3c[_0x8c46('0x4d')]['id'])});}}else{socket[_0x8c46('0x70')](_0x8c46('0x88'),{'UserId':Number(_0x1a2c3c['query'][_0x8c46('0x66')]),'SmsQueueId':Number(_0x1a2c3c[_0x8c46('0x4d')]['id'])});}});}})[_0x8c46('0x29')](respondWithStatusCode(_0x44b9cb,null))['catch'](handleError(_0x44b9cb,null));};exports['getAgents']=function(_0x32ac6b,_0x301c97,_0x247a07){var _0x36ba31={};var _0x23be4a={};var _0x1da60c;var _0x2f3504;return db[_0x8c46('0x35')][_0x8c46('0x57')]({'where':{'id':_0x32ac6b[_0x8c46('0x4d')]['id']}})[_0x8c46('0x29')](handleEntityNotFound(_0x301c97,null))[_0x8c46('0x29')](function(_0x44f7a){if(_0x44f7a){_0x1da60c=_0x44f7a;_0x23be4a[_0x8c46('0x3f')]=_[_0x8c46('0x3b')](db['User'][_0x8c46('0x36')]);_0x23be4a[_0x8c46('0x3a')]=_[_0x8c46('0x3b')](_0x32ac6b[_0x8c46('0x3a')]);_0x23be4a['filters']=_[_0x8c46('0x3d')](_0x23be4a[_0x8c46('0x3f')],_0x23be4a[_0x8c46('0x3a')]);_0x36ba31[_0x8c46('0x3e')]=_[_0x8c46('0x3d')](_0x23be4a[_0x8c46('0x3f')],qs['fields'](_0x32ac6b[_0x8c46('0x3a')][_0x8c46('0x40')]));_0x36ba31[_0x8c46('0x3e')]=_0x36ba31[_0x8c46('0x3e')][_0x8c46('0x41')]?_0x36ba31[_0x8c46('0x3e')]:_0x23be4a[_0x8c46('0x3f')];_0x36ba31[_0x8c46('0x59')]=qs[_0x8c46('0x43')](_0x32ac6b[_0x8c46('0x3a')][_0x8c46('0x43')]);_0x36ba31['where']=qs['filters'](_[_0x8c46('0x44')](_0x32ac6b['query'],_0x23be4a[_0x8c46('0x3c')]));if(_0x32ac6b[_0x8c46('0x3a')][_0x8c46('0x45')]){_0x36ba31[_0x8c46('0x46')]=_[_0x8c46('0x48')](_0x36ba31[_0x8c46('0x46')],{'$or':_[_0x8c46('0x34')](_0x36ba31[_0x8c46('0x3e')],function(_0x3a89dd){var _0x12114c={};_0x12114c[_0x3a89dd]={'$like':'%'+_0x32ac6b[_0x8c46('0x3a')]['filter']+'%'};return _0x12114c;})});}_0x36ba31=_['merge']({},_0x36ba31,_0x32ac6b[_0x8c46('0x4e')]);return _0x1da60c[_0x8c46('0x8e')](_0x36ba31);}})[_0x8c46('0x29')](function(_0x517322){if(_0x517322){_0x2f3504=_0x517322[_0x8c46('0x41')];if(!_0x32ac6b[_0x8c46('0x3a')]['hasOwnProperty']('nolimit')){_0x36ba31[_0x8c46('0x23')]=qs[_0x8c46('0x23')](_0x32ac6b[_0x8c46('0x3a')]['limit']);_0x36ba31['offset']=qs['offset'](_0x32ac6b[_0x8c46('0x3a')]['offset']);}return _0x1da60c[_0x8c46('0x8e')](_0x36ba31);}})[_0x8c46('0x29')](function(_0x3f58cf){if(_0x3f58cf){return _0x3f58cf?{'count':_0x2f3504,'rows':_0x3f58cf}:null;}})['then'](respondWithResult(_0x301c97,null))[_0x8c46('0x4b')](handleError(_0x301c97,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c8769b2..3e479fb 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 _0xa37d=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x28d0c4,_0x5acddd){var _0x55ea39=function(_0x549485){while(--_0x549485){_0x28d0c4['push'](_0x28d0c4['shift']());}};_0x55ea39(++_0x5acddd);}(_0xa37d,0x173));var _0xda37=function(_0x2291cb,_0x3d2b79){_0x2291cb=_0x2291cb-0x0;var _0x53b5d2=_0xa37d[_0x2291cb];return _0x53b5d2;};'use strict';var EventEmitter=require(_0xda37('0x0'));var SmsQueue=require(_0xda37('0x1'))['db'][_0xda37('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xda37('0x3')](0x0);var events={'afterCreate':_0xda37('0x4'),'afterUpdate':_0xda37('0x5'),'afterDestroy':_0xda37('0x6')};function emitEvent(_0x5cd521){return function(_0x30d1de,_0x3d0c11,_0x306341){SmsQueueEvents['emit'](_0x5cd521+':'+_0x30d1de['id'],_0x30d1de);SmsQueueEvents[_0xda37('0x7')](_0x5cd521,_0x30d1de);_0x306341(null);};}for(var e in events){if(events[_0xda37('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xda37('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x2af7=['update','remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x2af7,0x125));var _0x72af=function(_0x4f2119,_0x5cbdc8){_0x4f2119=_0x4f2119-0x0;var _0x9f2ccc=_0x2af7[_0x4f2119];return _0x9f2ccc;};'use strict';var EventEmitter=require(_0x72af('0x0'));var SmsQueue=require(_0x72af('0x1'))['db'][_0x72af('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x72af('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72af('0x4'),'afterDestroy':_0x72af('0x5')};function emitEvent(_0x585d2b){return function(_0x2c2eac,_0x3ce31e,_0x4fb644){SmsQueueEvents['emit'](_0x585d2b+':'+_0x2c2eac['id'],_0x2c2eac);SmsQueueEvents[_0x72af('0x6')](_0x585d2b,_0x2c2eac);_0x4fb644(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x72af('0x7')](e,emitEvent(event));}}module[_0x72af('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0bc89a6..790e126 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 _0x95a2=['bluebird','request-promise','../../config/environment','sms_queues','lodash','util','api','moment'];(function(_0x5b7786,_0xe47b5c){var _0x5882ab=function(_0x948f6d){while(--_0x948f6d){_0x5b7786['push'](_0x5b7786['shift']());}};_0x5882ab(++_0xe47b5c);}(_0x95a2,0x16c));var _0x295a=function(_0x1d1854,_0x4a83b1){_0x1d1854=_0x1d1854-0x0;var _0x5b2acb=_0x95a2[_0x1d1854];return _0x5b2acb;};'use strict';var _=require(_0x295a('0x0'));var util=require(_0x295a('0x1'));var logger=require('../../config/logger')(_0x295a('0x2'));var moment=require(_0x295a('0x3'));var BPromise=require(_0x295a('0x4'));var rp=require(_0x295a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x295a('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x221303,_0x35ba35){return _0x221303['define']('SmsQueue',attributes,{'tableName':_0x295a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cc6=['exports','SmsQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x3d1cd6,_0x1eb52d){var _0xfbf315=function(_0x4ae843){while(--_0x4ae843){_0x3d1cd6['push'](_0x3d1cd6['shift']());}};_0xfbf315(++_0x1eb52d);}(_0x0cc6,0x91));var _0x60cc=function(_0x1ad9b4,_0x5df9ed){_0x1ad9b4=_0x1ad9b4-0x0;var _0xbbee74=_0x0cc6[_0x1ad9b4];return _0xbbee74;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60cc('0x0'))(_0x60cc('0x1'));var moment=require(_0x60cc('0x2'));var BPromise=require(_0x60cc('0x3'));var rp=require(_0x60cc('0x4'));var fs=require('fs');var path=require(_0x60cc('0x5'));var rimraf=require(_0x60cc('0x6'));var config=require(_0x60cc('0x7'));var attributes=require(_0x60cc('0x8'));module[_0x60cc('0x9')]=function(_0x3da20a,_0x3da48b){return _0x3da20a['define'](_0x60cc('0xa'),attributes,{'tableName':'sms_queues','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 b3b3f3f..b9b24dc 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 _0x0fc0=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1b7726,_0xc7783f){var _0x1ab088=function(_0x3520a6){while(--_0x3520a6){_0x1b7726['push'](_0x1b7726['shift']());}};_0x1ab088(++_0xc7783f);}(_0x0fc0,0x13a));var _0x00fc=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0fc0[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x00fc('0x0'));var util=require(_0x00fc('0x1'));var moment=require(_0x00fc('0x2'));var BPromise=require(_0x00fc('0x3'));var rs=require(_0x00fc('0x4'));var fs=require('fs');var Redis=require(_0x00fc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x00fc('0x6'));var logger=require(_0x00fc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x00fc('0x8'));var client=jayson[_0x00fc('0x9')][_0x00fc('0xa')]({'port':0x232a});config[_0x00fc('0xb')]=_[_0x00fc('0xc')](config[_0x00fc('0xb')],{'host':_0x00fc('0xd'),'port':0x18eb});var socket=require(_0x00fc('0xe'))(new Redis(config[_0x00fc('0xb')]));require(_0x00fc('0xf'))[_0x00fc('0x10')](socket);function respondWithRpcPromise(_0x563268,_0x2011f8,_0x452dd7){return new BPromise(function(_0x41e70d,_0x4cc887){return client[_0x00fc('0x11')](_0x563268,_0x452dd7)[_0x00fc('0x12')](function(_0x357d5a){logger[_0x00fc('0x13')](_0x00fc('0x14'),_0x2011f8,_0x00fc('0x15'));logger[_0x00fc('0x16')](_0x00fc('0x17'),_0x2011f8,'request\x20sent',JSON[_0x00fc('0x18')](_0x357d5a));if(_0x357d5a['error']){if(_0x357d5a[_0x00fc('0x19')][_0x00fc('0x1a')]===0x1f4){logger['error'](_0x00fc('0x14'),_0x2011f8,_0x357d5a[_0x00fc('0x19')][_0x00fc('0x1b')]);return _0x4cc887(_0x357d5a['error'][_0x00fc('0x1b')]);}logger[_0x00fc('0x19')](_0x00fc('0x14'),_0x2011f8,_0x357d5a[_0x00fc('0x19')][_0x00fc('0x1b')]);return _0x41e70d(_0x357d5a['error'][_0x00fc('0x1b')]);}else{logger[_0x00fc('0x13')](_0x00fc('0x14'),_0x2011f8,_0x00fc('0x15'));_0x41e70d(_0x357d5a[_0x00fc('0x1c')][_0x00fc('0x1b')]);}})[_0x00fc('0x1d')](function(_0x48f242){logger['error'](_0x00fc('0x14'),_0x2011f8,_0x48f242);_0x4cc887(_0x48f242);});});}exports[_0x00fc('0x1e')]=function(_0x8f0e87){var _0x479959=this;return new Promise(function(_0x40391d,_0x14861d){return db['SmsQueue'][_0x00fc('0x1f')]({'raw':_0x8f0e87[_0x00fc('0x20')]?_0x8f0e87[_0x00fc('0x20')][_0x00fc('0x21')]===undefined?!![]:![]:!![],'where':_0x8f0e87['options']?_0x8f0e87[_0x00fc('0x20')][_0x00fc('0x22')]||null:null,'attributes':_0x8f0e87['options']?_0x8f0e87[_0x00fc('0x20')]['attributes']||null:null,'limit':_0x8f0e87[_0x00fc('0x20')]?_0x8f0e87['options'][_0x00fc('0x23')]||null:null,'include':_0x8f0e87[_0x00fc('0x20')]?_0x8f0e87[_0x00fc('0x20')][_0x00fc('0x24')]?_['map'](_0x8f0e87[_0x00fc('0x20')][_0x00fc('0x24')],function(_0xffb3a7){return{'model':db[_0xffb3a7['model']],'as':_0xffb3a7['as'],'attributes':_0xffb3a7['attributes'],'include':_0xffb3a7[_0x00fc('0x24')]?_[_0x00fc('0x25')](_0xffb3a7[_0x00fc('0x24')],function(_0x28ae75){return{'model':db[_0x28ae75[_0x00fc('0x26')]],'as':_0x28ae75['as'],'attributes':_0x28ae75[_0x00fc('0x27')],'include':_0x28ae75['include']?_[_0x00fc('0x25')](_0x28ae75[_0x00fc('0x24')],function(_0x1b8a9b){return{'model':db[_0x1b8a9b[_0x00fc('0x26')]],'as':_0x1b8a9b['as'],'attributes':_0x1b8a9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x00fc('0x12')](function(_0x5753d7){logger[_0x00fc('0x13')](_0x00fc('0x1e'),_0x8f0e87);logger[_0x00fc('0x16')]('GetSmsQueue',_0x8f0e87,JSON[_0x00fc('0x18')](_0x5753d7));_0x40391d(_0x5753d7);})[_0x00fc('0x1d')](function(_0xb8bd0){logger[_0x00fc('0x19')](_0x00fc('0x1e'),_0xb8bd0[_0x00fc('0x1b')],_0x8f0e87);_0x14861d(_0x479959['error'](0x1f4,_0xb8bd0[_0x00fc('0x1b')]));});});};exports[_0x00fc('0x28')]=function(_0x45a3c7){var _0x28837b=this;return new Promise(function(_0x5ec556,_0x4bc05c){return db['SmsQueue'][_0x00fc('0x29')]({'raw':_0x45a3c7[_0x00fc('0x20')]?_0x45a3c7[_0x00fc('0x20')][_0x00fc('0x21')]===undefined?!![]:![]:!![],'where':_0x45a3c7[_0x00fc('0x20')]?_0x45a3c7['options'][_0x00fc('0x22')]||null:null,'attributes':_0x45a3c7[_0x00fc('0x20')]?_0x45a3c7['options'][_0x00fc('0x27')]||null:null,'include':_0x45a3c7[_0x00fc('0x20')]?_0x45a3c7[_0x00fc('0x20')][_0x00fc('0x24')]?_[_0x00fc('0x25')](_0x45a3c7[_0x00fc('0x20')]['include'],function(_0x18951c){return{'model':db[_0x18951c['model']],'as':_0x18951c['as'],'attributes':_0x18951c['attributes'],'include':_0x18951c[_0x00fc('0x24')]?_[_0x00fc('0x25')](_0x18951c['include'],function(_0x388f0a){return{'model':db[_0x388f0a[_0x00fc('0x26')]],'as':_0x388f0a['as'],'attributes':_0x388f0a[_0x00fc('0x27')],'include':_0x388f0a[_0x00fc('0x24')]?_[_0x00fc('0x25')](_0x388f0a[_0x00fc('0x24')],function(_0x4489e7){return{'model':db[_0x4489e7[_0x00fc('0x26')]],'as':_0x4489e7['as'],'attributes':_0x4489e7[_0x00fc('0x27')]};}):[]};}):[]};}):[]:[]})[_0x00fc('0x12')](function(_0x4e7ccc){logger['info'](_0x00fc('0x28'),_0x45a3c7);logger[_0x00fc('0x16')](_0x00fc('0x28'),_0x45a3c7,JSON[_0x00fc('0x18')](_0x4e7ccc));_0x5ec556(_0x4e7ccc);})[_0x00fc('0x1d')](function(_0x20ca7d){logger[_0x00fc('0x19')]('ShowSmsQueue',_0x20ca7d[_0x00fc('0x1b')],_0x45a3c7);_0x4bc05c(_0x28837b[_0x00fc('0x19')](0x1f4,_0x20ca7d['message']));});});}; \ No newline at end of file +var _0x0ac6=['stringify','error','code','message','SmsQueue','findAll','options','raw','where','attributes','map','include','model','GetSmsQueue','ShowSmsQueue','find','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x0ac6,0x7d));var _0x60ac=function(_0x47023d,_0xd869d7){_0x47023d=_0x47023d-0x0;var _0x3cd608=_0x0ac6[_0x47023d];return _0x3cd608;};'use strict';var _=require(_0x60ac('0x0'));var util=require(_0x60ac('0x1'));var moment=require(_0x60ac('0x2'));var BPromise=require(_0x60ac('0x3'));var rs=require(_0x60ac('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x60ac('0x5'))(_0x60ac('0x6'));var config=require(_0x60ac('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x60ac('0x8')]({'port':0x232a});config['redis']=_[_0x60ac('0x9')](config['redis'],{'host':_0x60ac('0xa'),'port':0x18eb});var socket=require(_0x60ac('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x60ac('0xc')](socket);function respondWithRpcPromise(_0x30bec7,_0x2dfb56,_0x5598bf){return new BPromise(function(_0x32ee3e,_0x1d1e14){return client['request'](_0x30bec7,_0x5598bf)[_0x60ac('0xd')](function(_0x18f4f3){logger[_0x60ac('0xe')](_0x60ac('0xf'),_0x2dfb56,_0x60ac('0x10'));logger[_0x60ac('0x11')](_0x60ac('0x12'),_0x2dfb56,_0x60ac('0x10'),JSON[_0x60ac('0x13')](_0x18f4f3));if(_0x18f4f3[_0x60ac('0x14')]){if(_0x18f4f3['error'][_0x60ac('0x15')]===0x1f4){logger[_0x60ac('0x14')](_0x60ac('0xf'),_0x2dfb56,_0x18f4f3[_0x60ac('0x14')][_0x60ac('0x16')]);return _0x1d1e14(_0x18f4f3['error'][_0x60ac('0x16')]);}logger['error'](_0x60ac('0xf'),_0x2dfb56,_0x18f4f3[_0x60ac('0x14')][_0x60ac('0x16')]);return _0x32ee3e(_0x18f4f3[_0x60ac('0x14')][_0x60ac('0x16')]);}else{logger['info'](_0x60ac('0xf'),_0x2dfb56,_0x60ac('0x10'));_0x32ee3e(_0x18f4f3['result']['message']);}})['catch'](function(_0x287eff){logger[_0x60ac('0x14')](_0x60ac('0xf'),_0x2dfb56,_0x287eff);_0x1d1e14(_0x287eff);});});}exports['GetSmsQueue']=function(_0x35fdab){var _0x540381=this;return new Promise(function(_0x289ef3,_0x19c2f1){return db[_0x60ac('0x17')][_0x60ac('0x18')]({'raw':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1b')]||null:null,'attributes':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1c')]||null:null,'limit':_0x35fdab['options']?_0x35fdab[_0x60ac('0x19')]['limit']||null:null,'include':_0x35fdab[_0x60ac('0x19')]?_0x35fdab[_0x60ac('0x19')]['include']?_[_0x60ac('0x1d')](_0x35fdab[_0x60ac('0x19')][_0x60ac('0x1e')],function(_0x217b9b){return{'model':db[_0x217b9b[_0x60ac('0x1f')]],'as':_0x217b9b['as'],'attributes':_0x217b9b['attributes'],'include':_0x217b9b[_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x217b9b['include'],function(_0x56bca2){return{'model':db[_0x56bca2[_0x60ac('0x1f')]],'as':_0x56bca2['as'],'attributes':_0x56bca2[_0x60ac('0x1c')],'include':_0x56bca2[_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x56bca2['include'],function(_0x5ac9f5){return{'model':db[_0x5ac9f5['model']],'as':_0x5ac9f5['as'],'attributes':_0x5ac9f5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x498481){logger[_0x60ac('0xe')](_0x60ac('0x20'),_0x35fdab);logger[_0x60ac('0x11')](_0x60ac('0x20'),_0x35fdab,JSON[_0x60ac('0x13')](_0x498481));_0x289ef3(_0x498481);})['catch'](function(_0x562214){logger[_0x60ac('0x14')](_0x60ac('0x20'),_0x562214[_0x60ac('0x16')],_0x35fdab);_0x19c2f1(_0x540381[_0x60ac('0x14')](0x1f4,_0x562214[_0x60ac('0x16')]));});});};exports[_0x60ac('0x21')]=function(_0x20a272){var _0x32c142=this;return new Promise(function(_0x1f37cc,_0x141464){return db[_0x60ac('0x17')][_0x60ac('0x22')]({'raw':_0x20a272['options']?_0x20a272['options'][_0x60ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x20a272[_0x60ac('0x19')]?_0x20a272[_0x60ac('0x19')][_0x60ac('0x1b')]||null:null,'attributes':_0x20a272[_0x60ac('0x19')]?_0x20a272['options']['attributes']||null:null,'include':_0x20a272[_0x60ac('0x19')]?_0x20a272['options'][_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x20a272[_0x60ac('0x19')][_0x60ac('0x1e')],function(_0x50df0b){return{'model':db[_0x50df0b[_0x60ac('0x1f')]],'as':_0x50df0b['as'],'attributes':_0x50df0b['attributes'],'include':_0x50df0b[_0x60ac('0x1e')]?_[_0x60ac('0x1d')](_0x50df0b[_0x60ac('0x1e')],function(_0x38c880){return{'model':db[_0x38c880[_0x60ac('0x1f')]],'as':_0x38c880['as'],'attributes':_0x38c880[_0x60ac('0x1c')],'include':_0x38c880['include']?_[_0x60ac('0x1d')](_0x38c880['include'],function(_0x6485e6){return{'model':db[_0x6485e6[_0x60ac('0x1f')]],'as':_0x6485e6['as'],'attributes':_0x6485e6[_0x60ac('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x60ac('0xd')](function(_0x47a736){logger[_0x60ac('0xe')]('ShowSmsQueue',_0x20a272);logger[_0x60ac('0x11')](_0x60ac('0x21'),_0x20a272,JSON[_0x60ac('0x13')](_0x47a736));_0x1f37cc(_0x47a736);})[_0x60ac('0x23')](function(_0x225387){logger[_0x60ac('0x14')](_0x60ac('0x21'),_0x225387[_0x60ac('0x16')],_0x20a272);_0x141464(_0x32c142[_0x60ac('0x14')](0x1f4,_0x225387[_0x60ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b0ed486..acd9798 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 _0x8711=['removeListener','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x10b5ef,_0x1cc991){var _0xc6bbe0=function(_0x3066c7){while(--_0x3066c7){_0x10b5ef['push'](_0x10b5ef['shift']());}};_0xc6bbe0(++_0x1cc991);}(_0x8711,0xa4));var _0x1871=function(_0x565adc,_0x3fde28){_0x565adc=_0x565adc-0x0;var _0x5f3748=_0x8711[_0x565adc];return _0x5f3748;};'use strict';var SmsQueueEvents=require(_0x1871('0x0'));var events=[_0x1871('0x1'),_0x1871('0x2'),_0x1871('0x3')];function createListener(_0xd07b8d,_0x450f09){return function(_0x976219){_0x450f09['emit'](_0xd07b8d,_0x976219);};}function removeListener(_0x2a40d3,_0x443177){return function(){SmsQueueEvents[_0x1871('0x4')](_0x2a40d3,_0x443177);};}exports['register']=function(_0x5d94db){for(var _0x502499=0x0,_0x4bdd78=events[_0x1871('0x5')];_0x502499<_0x4bdd78;_0x502499++){var _0x208efd=events[_0x502499];var _0x565deb=createListener(_0x1871('0x6')+_0x208efd,_0x5d94db);SmsQueueEvents['on'](_0x208efd,_0x565deb);}}; \ No newline at end of file +var _0xb7e6=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x661311,_0x4aea1a){var _0x620063=function(_0x55f758){while(--_0x55f758){_0x661311['push'](_0x661311['shift']());}};_0x620063(++_0x4aea1a);}(_0xb7e6,0x8d));var _0x6b7e=function(_0x34b7e9,_0x382d81){_0x34b7e9=_0x34b7e9-0x0;var _0x32cb40=_0xb7e6[_0x34b7e9];return _0x32cb40;};'use strict';var SmsQueueEvents=require(_0x6b7e('0x0'));var events=[_0x6b7e('0x1'),_0x6b7e('0x2'),_0x6b7e('0x3')];function createListener(_0x3f027c,_0x96f421){return function(_0x24ee11){_0x96f421[_0x6b7e('0x4')](_0x3f027c,_0x24ee11);};}function removeListener(_0x50f8da,_0x238b62){return function(){SmsQueueEvents[_0x6b7e('0x5')](_0x50f8da,_0x238b62);};}exports[_0x6b7e('0x6')]=function(_0x4c357b){for(var _0x3310e5=0x0,_0x13b183=events[_0x6b7e('0x7')];_0x3310e5<_0x13b183;_0x3310e5++){var _0x1e108a=events[_0x3310e5];var _0x161ffb=createListener(_0x6b7e('0x8')+_0x1e108a,_0x4c357b);SmsQueueEvents['on'](_0x1e108a,_0x161ffb);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 379131f..ee03c5b 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 _0x9374=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x9374,0x1ac));var _0x4937=function(_0x356307,_0xe0a012){_0x356307=_0x356307-0x0;var _0x59e722=_0x9374[_0x356307];return _0x59e722;};'use strict';var multer=require('multer');var util=require(_0x4937('0x0'));var path=require(_0x4937('0x1'));var timeout=require(_0x4937('0x2'));var express=require('express');var router=express[_0x4937('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4937('0x4'));var interaction=require(_0x4937('0x5'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x4937('0x6')]('/',auth['isAuthenticated'](),controller[_0x4937('0x7')]);router[_0x4937('0x6')](_0x4937('0x8'),auth[_0x4937('0x9')](),controller[_0x4937('0xa')]);router[_0x4937('0x6')](_0x4937('0xb'),auth[_0x4937('0x9')](),controller[_0x4937('0xc')]);router[_0x4937('0xd')]('/',auth[_0x4937('0x9')](),controller[_0x4937('0xe')]);router[_0x4937('0xf')](_0x4937('0xb'),auth['isAuthenticated'](),controller[_0x4937('0x10')]);router[_0x4937('0x11')]('/:id',auth[_0x4937('0x9')](),controller[_0x4937('0x12')]);module[_0x4937('0x13')]=router; \ No newline at end of file +var _0xdb65=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb65,0x16c));var _0x5db6=function(_0xc3d763,_0x2e826d){_0xc3d763=_0xc3d763-0x0;var _0x122a26=_0xdb65[_0xc3d763];return _0x122a26;};'use strict';var multer=require('multer');var util=require(_0x5db6('0x0'));var path=require(_0x5db6('0x1'));var timeout=require(_0x5db6('0x2'));var express=require('express');var router=express[_0x5db6('0x3')]();var fs_extra=require(_0x5db6('0x4'));var auth=require(_0x5db6('0x5'));var interaction=require(_0x5db6('0x6'));var config=require('../../config/environment');var controller=require(_0x5db6('0x7'));router[_0x5db6('0x8')]('/',auth[_0x5db6('0x9')](),controller[_0x5db6('0xa')]);router[_0x5db6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5db6('0xb')]);router[_0x5db6('0x8')]('/:id',auth[_0x5db6('0x9')](),controller['show']);router[_0x5db6('0xc')]('/',auth[_0x5db6('0x9')](),controller[_0x5db6('0xd')]);router[_0x5db6('0xe')](_0x5db6('0xf'),auth['isAuthenticated'](),controller[_0x5db6('0x10')]);router[_0x5db6('0x11')]('/:id',auth[_0x5db6('0x9')](),controller[_0x5db6('0x12')]);module[_0x5db6('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 23672a2..501e0d4 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 _0x9305=['STRING','DATE','moment','sequelize','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9305,0x1e2));var _0x5930=function(_0x44e02d,_0x1e9c87){_0x44e02d=_0x44e02d-0x0;var _0x512b4e=_0x9305[_0x44e02d];return _0x512b4e;};'use strict';var moment=require(_0x5930('0x0'));var Sequelize=require(_0x5930('0x1'));module[_0x5930('0x2')]={'uniqueid':{'type':Sequelize[_0x5930('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5930('0x4')]},'leaveAt':{'type':Sequelize[_0x5930('0x4')]},'acceptAt':{'type':Sequelize[_0x5930('0x4')]},'exitAt':{'type':Sequelize[_0x5930('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc72=['exports','STRING','DATE','sequelize'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0xfc72,0xff));var _0x2fc7=function(_0x3a89dc,_0x54bb1e){_0x3a89dc=_0x3a89dc-0x0;var _0x11c5c9=_0xfc72[_0x3a89dc];return _0x11c5c9;};'use strict';var moment=require('moment');var Sequelize=require(_0x2fc7('0x0'));module[_0x2fc7('0x1')]={'uniqueid':{'type':Sequelize[_0x2fc7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2fc7('0x2')]},'joinAt':{'type':Sequelize[_0x2fc7('0x3')]},'leaveAt':{'type':Sequelize[_0x2fc7('0x3')]},'acceptAt':{'type':Sequelize[_0x2fc7('0x3')]},'exitAt':{'type':Sequelize[_0x2fc7('0x3')]},'reason':{'type':Sequelize[_0x2fc7('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4f3ab95..abe6131 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 _0x2bb0=['keys','include','options','find','create','body','catch','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','show','params'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2bb0,0x1c4));var _0x02bb=function(_0x3e3d40,_0x19c972){_0x3e3d40=_0x3e3d40-0x0;var _0x3c8f86=_0x2bb0[_0x3e3d40];return _0x3c8f86;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02bb('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x02bb('0x1'));var moment=require(_0x02bb('0x2'));var BPromise=require(_0x02bb('0x3'));var Mustache=require(_0x02bb('0x4'));var util=require(_0x02bb('0x5'));var path=require(_0x02bb('0x6'));var sox=require('sox');var csv=require(_0x02bb('0x7'));var ejs=require(_0x02bb('0x8'));var fs=require('fs');var fs_extra=require(_0x02bb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x02bb('0xa'));var jsforce=require(_0x02bb('0xb'));var deskjs=require(_0x02bb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x02bb('0xd'));var Papa=require(_0x02bb('0xe'));var Redis=require(_0x02bb('0xf'));var authService=require(_0x02bb('0x10'));var qs=require(_0x02bb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02bb('0x12'));var logger=require(_0x02bb('0x13'))('api');var utils=require(_0x02bb('0x14'));var config=require(_0x02bb('0x15'));var licenseUtil=require(_0x02bb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71f4ba,_0x28c68d){_0x28c68d=_0x28c68d||0xcc;return function(_0x5cd2aa){if(_0x5cd2aa){return _0x71f4ba[_0x02bb('0x17')](_0x28c68d);}return _0x71f4ba['status'](_0x28c68d)[_0x02bb('0x18')]();};}function respondWithResult(_0x4c0cc9,_0x360443){_0x360443=_0x360443||0xc8;return function(_0x25bcc6){if(_0x25bcc6){return _0x4c0cc9[_0x02bb('0x19')](_0x360443)['json'](_0x25bcc6);}};}function respondWithFilteredResult(_0x34ea43,_0x1b2a68){return function(_0x7654d7){if(_0x7654d7){var _0x4b56bf=typeof _0x1b2a68[_0x02bb('0x1a')]===_0x02bb('0x1b')&&typeof _0x1b2a68[_0x02bb('0x1c')]===_0x02bb('0x1b');var _0xf39587=_0x7654d7[_0x02bb('0x1d')];var _0x2f725e=_0x4b56bf?0x0:_0x1b2a68[_0x02bb('0x1a')];var _0x31649d=_0x4b56bf?_0x7654d7[_0x02bb('0x1d')]:_0x1b2a68['offset']+_0x1b2a68[_0x02bb('0x1c')];var _0x2200d3;if(_0x31649d>=_0xf39587){_0x31649d=_0xf39587;_0x2200d3=0xc8;}else{_0x2200d3=0xce;}_0x34ea43[_0x02bb('0x19')](_0x2200d3);return _0x34ea43[_0x02bb('0x1e')](_0x02bb('0x1f'),_0x2f725e+'-'+_0x31649d+'/'+_0xf39587)[_0x02bb('0x20')](_0x7654d7);}return null;};}function patchUpdates(_0x1c4dba){return function(_0xc2942a){try{jsonpatch[_0x02bb('0x21')](_0xc2942a,_0x1c4dba,!![]);}catch(_0x1eda0d){return BPromise[_0x02bb('0x22')](_0x1eda0d);}return _0xc2942a['save']();};}function saveUpdates(_0x14d019,_0x50cc83){return function(_0x40d6b2){if(_0x40d6b2){return _0x40d6b2[_0x02bb('0x23')](_0x14d019)[_0x02bb('0x24')](function(_0x3a2e39){return _0x3a2e39;});}return null;};}function removeEntity(_0x553d9b,_0x331950){return function(_0x1d8356){if(_0x1d8356){return _0x1d8356[_0x02bb('0x25')]()[_0x02bb('0x24')](function(){_0x553d9b[_0x02bb('0x19')](0xcc)[_0x02bb('0x18')]();});}};}function handleEntityNotFound(_0x67518e,_0x3dfdbb){return function(_0x1e4e69){if(!_0x1e4e69){_0x67518e[_0x02bb('0x17')](0x194);}return _0x1e4e69;};}function handleError(_0x14ab8a,_0x329202){_0x329202=_0x329202||0x1f4;return function(_0x2e92e4){logger[_0x02bb('0x26')](_0x2e92e4[_0x02bb('0x27')]);if(_0x2e92e4[_0x02bb('0x28')]){delete _0x2e92e4['name'];}_0x14ab8a[_0x02bb('0x19')](_0x329202)[_0x02bb('0x29')](_0x2e92e4);};}exports['index']=function(_0x568885,_0x1c43b5){var _0x38e212={},_0x5402a0={},_0x3e7917={'count':0x0,'rows':[]};var _0x55cfab=_[_0x02bb('0x2a')](db[_0x02bb('0x2b')][_0x02bb('0x2c')],function(_0xe4105f){return{'name':_0xe4105f[_0x02bb('0x2d')],'type':_0xe4105f[_0x02bb('0x2e')]['key']};});_0x5402a0[_0x02bb('0x2f')]=_[_0x02bb('0x2a')](_0x55cfab,_0x02bb('0x28'));_0x5402a0[_0x02bb('0x30')]=_['keys'](_0x568885[_0x02bb('0x30')]);_0x5402a0[_0x02bb('0x31')]=_[_0x02bb('0x32')](_0x5402a0[_0x02bb('0x2f')],_0x5402a0[_0x02bb('0x30')]);_0x38e212[_0x02bb('0x33')]=_[_0x02bb('0x32')](_0x5402a0[_0x02bb('0x2f')],qs[_0x02bb('0x34')](_0x568885[_0x02bb('0x30')][_0x02bb('0x34')]));_0x38e212[_0x02bb('0x33')]=_0x38e212[_0x02bb('0x33')][_0x02bb('0x35')]?_0x38e212[_0x02bb('0x33')]:_0x5402a0[_0x02bb('0x2f')];if(!_0x568885['query'][_0x02bb('0x36')](_0x02bb('0x37'))){_0x38e212[_0x02bb('0x1c')]=qs[_0x02bb('0x1c')](_0x568885[_0x02bb('0x30')][_0x02bb('0x1c')]);_0x38e212[_0x02bb('0x1a')]=qs[_0x02bb('0x1a')](_0x568885['query'][_0x02bb('0x1a')]);}_0x38e212['order']=qs[_0x02bb('0x38')](_0x568885[_0x02bb('0x30')]['sort']);_0x38e212['where']=qs[_0x02bb('0x31')](_[_0x02bb('0x39')](_0x568885[_0x02bb('0x30')],_0x5402a0[_0x02bb('0x31')]),_0x55cfab);if(_0x568885[_0x02bb('0x30')][_0x02bb('0x3a')]){_0x38e212[_0x02bb('0x3b')]=_[_0x02bb('0x3c')](_0x38e212[_0x02bb('0x3b')],{'$or':_[_0x02bb('0x2a')](_0x55cfab,function(_0x1b82cc){if(_0x1b82cc[_0x02bb('0x2e')]!==_0x02bb('0x3d')){var _0x402d2a={};_0x402d2a[_0x1b82cc[_0x02bb('0x28')]]={'$like':'%'+_0x568885[_0x02bb('0x30')][_0x02bb('0x3a')]+'%'};return _0x402d2a;}})});}_0x38e212=_[_0x02bb('0x3c')]({},_0x38e212,_0x568885['options']);var _0x2f7a86={'where':_0x38e212[_0x02bb('0x3b')]};return db['SmsQueueReport'][_0x02bb('0x1d')](_0x2f7a86)[_0x02bb('0x24')](function(_0x53ff12){_0x3e7917[_0x02bb('0x1d')]=_0x53ff12;if(_0x568885[_0x02bb('0x30')][_0x02bb('0x3e')]){_0x38e212['include']=[{'all':!![]}];}return db[_0x02bb('0x2b')][_0x02bb('0x3f')](_0x38e212);})['then'](function(_0x260918){_0x3e7917['rows']=_0x260918;return _0x3e7917;})['then'](respondWithFilteredResult(_0x1c43b5,_0x38e212))['catch'](handleError(_0x1c43b5,null));};exports[_0x02bb('0x40')]=function(_0x51c23a,_0x46317f){var _0x2b5bb8={'raw':!![],'where':{'id':_0x51c23a[_0x02bb('0x41')]['id']}},_0x5ec22c={};_0x5ec22c[_0x02bb('0x2f')]=_[_0x02bb('0x42')](db['SmsQueueReport'][_0x02bb('0x2c')]);_0x5ec22c[_0x02bb('0x30')]=_[_0x02bb('0x42')](_0x51c23a['query']);_0x5ec22c[_0x02bb('0x31')]=_[_0x02bb('0x32')](_0x5ec22c[_0x02bb('0x2f')],_0x5ec22c['query']);_0x2b5bb8[_0x02bb('0x33')]=_[_0x02bb('0x32')](_0x5ec22c['model'],qs[_0x02bb('0x34')](_0x51c23a[_0x02bb('0x30')][_0x02bb('0x34')]));_0x2b5bb8[_0x02bb('0x33')]=_0x2b5bb8[_0x02bb('0x33')][_0x02bb('0x35')]?_0x2b5bb8[_0x02bb('0x33')]:_0x5ec22c[_0x02bb('0x2f')];if(_0x51c23a['query'][_0x02bb('0x3e')]){_0x2b5bb8[_0x02bb('0x43')]=[{'all':!![]}];}_0x2b5bb8=_['merge']({},_0x2b5bb8,_0x51c23a[_0x02bb('0x44')]);return db[_0x02bb('0x2b')][_0x02bb('0x45')](_0x2b5bb8)[_0x02bb('0x24')](handleEntityNotFound(_0x46317f,null))[_0x02bb('0x24')](respondWithResult(_0x46317f,null))['catch'](handleError(_0x46317f,null));};exports[_0x02bb('0x46')]=function(_0xd4d2a0,_0x528ce9){return db[_0x02bb('0x2b')]['create'](_0xd4d2a0[_0x02bb('0x47')],{})[_0x02bb('0x24')](respondWithResult(_0x528ce9,0xc9))['catch'](handleError(_0x528ce9,null));};exports['update']=function(_0x10366a,_0xa90ae5){if(_0x10366a['body']['id']){delete _0x10366a[_0x02bb('0x47')]['id'];}return db[_0x02bb('0x2b')][_0x02bb('0x45')]({'where':{'id':_0x10366a['params']['id']}})[_0x02bb('0x24')](handleEntityNotFound(_0xa90ae5,null))[_0x02bb('0x24')](saveUpdates(_0x10366a[_0x02bb('0x47')],null))[_0x02bb('0x24')](respondWithResult(_0xa90ae5,null))[_0x02bb('0x48')](handleError(_0xa90ae5,null));};exports[_0x02bb('0x25')]=function(_0x1fa03d,_0x262f49){return db[_0x02bb('0x2b')]['find']({'where':{'id':_0x1fa03d[_0x02bb('0x41')]['id']}})[_0x02bb('0x24')](handleEntityNotFound(_0x262f49,null))['then'](removeEntity(_0x262f49,null))['catch'](handleError(_0x262f49,null));};exports[_0x02bb('0x49')]=function(_0x208849,_0x26e704){return db['SmsQueueReport']['describe']()[_0x02bb('0x24')](respondWithResult(_0x26e704,null))['catch'](handleError(_0x26e704,null));}; \ No newline at end of file +var _0x3393=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','sendStatus','error','stack','name','SmsQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x385eee,_0x270cca){var _0x41fd49=function(_0x6bb501){while(--_0x6bb501){_0x385eee['push'](_0x385eee['shift']());}};_0x41fd49(++_0x270cca);}(_0x3393,0x8a));var _0x3339=function(_0x200772,_0xe7614d){_0x200772=_0x200772-0x0;var _0x43ef27=_0x3393[_0x200772];return _0x43ef27;};'use strict';var emlformat=require(_0x3339('0x0'));var rimraf=require(_0x3339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3339('0x2'));var rp=require(_0x3339('0x3'));var moment=require(_0x3339('0x4'));var BPromise=require(_0x3339('0x5'));var Mustache=require(_0x3339('0x6'));var util=require(_0x3339('0x7'));var path=require(_0x3339('0x8'));var sox=require(_0x3339('0x9'));var csv=require(_0x3339('0xa'));var ejs=require(_0x3339('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3339('0xc'));var squel=require('squel');var crypto=require(_0x3339('0xd'));var jsforce=require(_0x3339('0xe'));var deskjs=require(_0x3339('0xf'));var toCsv=require(_0x3339('0xa'));var querystring=require(_0x3339('0x10'));var Papa=require(_0x3339('0x11'));var Redis=require(_0x3339('0x12'));var authService=require(_0x3339('0x13'));var qs=require(_0x3339('0x14'));var as=require(_0x3339('0x15'));var hardwareService=require(_0x3339('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3339('0x17'));var licenseUtil=require(_0x3339('0x18'));var db=require(_0x3339('0x19'))['db'];function respondWithStatusCode(_0x4dd86c,_0x120887){_0x120887=_0x120887||0xcc;return function(_0x10c5c3){if(_0x10c5c3){return _0x4dd86c['sendStatus'](_0x120887);}return _0x4dd86c[_0x3339('0x1a')](_0x120887)['end']();};}function respondWithResult(_0x99969c,_0x2de747){_0x2de747=_0x2de747||0xc8;return function(_0x1bb540){if(_0x1bb540){return _0x99969c['status'](_0x2de747)['json'](_0x1bb540);}};}function respondWithFilteredResult(_0x41146f,_0x452b0f){return function(_0x1bf745){if(_0x1bf745){var _0x2576fe=typeof _0x452b0f[_0x3339('0x1b')]===_0x3339('0x1c')&&typeof _0x452b0f[_0x3339('0x1d')]==='undefined';var _0x477ede=_0x1bf745['count'];var _0x553af0=_0x2576fe?0x0:_0x452b0f[_0x3339('0x1b')];var _0x2ab990=_0x2576fe?_0x1bf745[_0x3339('0x1e')]:_0x452b0f[_0x3339('0x1b')]+_0x452b0f['limit'];var _0x1df6ef;if(_0x2ab990>=_0x477ede){_0x2ab990=_0x477ede;_0x1df6ef=0xc8;}else{_0x1df6ef=0xce;}_0x41146f[_0x3339('0x1a')](_0x1df6ef);return _0x41146f[_0x3339('0x1f')](_0x3339('0x20'),_0x553af0+'-'+_0x2ab990+'/'+_0x477ede)[_0x3339('0x21')](_0x1bf745);}return null;};}function patchUpdates(_0xc708b9){return function(_0x4ec3e0){try{jsonpatch[_0x3339('0x22')](_0x4ec3e0,_0xc708b9,!![]);}catch(_0x36b3ab){return BPromise['reject'](_0x36b3ab);}return _0x4ec3e0[_0x3339('0x23')]();};}function saveUpdates(_0x59ffee,_0x292d83){return function(_0x80c3a1){if(_0x80c3a1){return _0x80c3a1[_0x3339('0x24')](_0x59ffee)[_0x3339('0x25')](function(_0x7d1a03){return _0x7d1a03;});}return null;};}function removeEntity(_0x26e940,_0x2e1c93){return function(_0x3c6e96){if(_0x3c6e96){return _0x3c6e96['destroy']()[_0x3339('0x25')](function(){_0x26e940[_0x3339('0x1a')](0xcc)[_0x3339('0x26')]();});}};}function handleEntityNotFound(_0x56e51a,_0x290aae){return function(_0x21177d){if(!_0x21177d){_0x56e51a[_0x3339('0x27')](0x194);}return _0x21177d;};}function handleError(_0x4b49c1,_0x2dfd2f){_0x2dfd2f=_0x2dfd2f||0x1f4;return function(_0x44ce9d){logger[_0x3339('0x28')](_0x44ce9d[_0x3339('0x29')]);if(_0x44ce9d['name']){delete _0x44ce9d[_0x3339('0x2a')];}_0x4b49c1['status'](_0x2dfd2f)['send'](_0x44ce9d);};}exports['index']=function(_0x246ec6,_0x2835d7){var _0x6cffc6={},_0x5d7bec={},_0x5db6b9={'count':0x0,'rows':[]};var _0x2252a2=_['map'](db[_0x3339('0x2b')][_0x3339('0x2c')],function(_0x6dfd50){return{'name':_0x6dfd50[_0x3339('0x2d')],'type':_0x6dfd50[_0x3339('0x2e')][_0x3339('0x2f')]};});_0x5d7bec['model']=_[_0x3339('0x30')](_0x2252a2,_0x3339('0x2a'));_0x5d7bec[_0x3339('0x31')]=_[_0x3339('0x32')](_0x246ec6[_0x3339('0x31')]);_0x5d7bec[_0x3339('0x33')]=_[_0x3339('0x34')](_0x5d7bec[_0x3339('0x35')],_0x5d7bec[_0x3339('0x31')]);_0x6cffc6[_0x3339('0x36')]=_['intersection'](_0x5d7bec['model'],qs[_0x3339('0x37')](_0x246ec6['query'][_0x3339('0x37')]));_0x6cffc6['attributes']=_0x6cffc6[_0x3339('0x36')][_0x3339('0x38')]?_0x6cffc6[_0x3339('0x36')]:_0x5d7bec[_0x3339('0x35')];if(!_0x246ec6['query'][_0x3339('0x39')]('nolimit')){_0x6cffc6[_0x3339('0x1d')]=qs['limit'](_0x246ec6['query']['limit']);_0x6cffc6['offset']=qs['offset'](_0x246ec6[_0x3339('0x31')][_0x3339('0x1b')]);}_0x6cffc6[_0x3339('0x3a')]=qs[_0x3339('0x3b')](_0x246ec6[_0x3339('0x31')][_0x3339('0x3b')]);_0x6cffc6['where']=qs[_0x3339('0x33')](_[_0x3339('0x3c')](_0x246ec6['query'],_0x5d7bec[_0x3339('0x33')]),_0x2252a2);if(_0x246ec6['query']['filter']){_0x6cffc6['where']=_['merge'](_0x6cffc6['where'],{'$or':_['map'](_0x2252a2,function(_0x40ddf4){if(_0x40ddf4[_0x3339('0x2e')]!==_0x3339('0x3d')){var _0x26b77f={};_0x26b77f[_0x40ddf4[_0x3339('0x2a')]]={'$like':'%'+_0x246ec6[_0x3339('0x31')][_0x3339('0x3e')]+'%'};return _0x26b77f;}})});}_0x6cffc6=_[_0x3339('0x3f')]({},_0x6cffc6,_0x246ec6[_0x3339('0x40')]);var _0x5095d6={'where':_0x6cffc6['where']};return db['SmsQueueReport']['count'](_0x5095d6)[_0x3339('0x25')](function(_0xf478ef){_0x5db6b9['count']=_0xf478ef;if(_0x246ec6[_0x3339('0x31')][_0x3339('0x41')]){_0x6cffc6[_0x3339('0x42')]=[{'all':!![]}];}return db[_0x3339('0x2b')][_0x3339('0x43')](_0x6cffc6);})[_0x3339('0x25')](function(_0x368a39){_0x5db6b9[_0x3339('0x44')]=_0x368a39;return _0x5db6b9;})[_0x3339('0x25')](respondWithFilteredResult(_0x2835d7,_0x6cffc6))['catch'](handleError(_0x2835d7,null));};exports[_0x3339('0x45')]=function(_0x1ab994,_0x58be71){var _0x31c621={'raw':!![],'where':{'id':_0x1ab994[_0x3339('0x46')]['id']}},_0x27f4e0={};_0x27f4e0['model']=_[_0x3339('0x32')](db['SmsQueueReport'][_0x3339('0x2c')]);_0x27f4e0[_0x3339('0x31')]=_[_0x3339('0x32')](_0x1ab994[_0x3339('0x31')]);_0x27f4e0[_0x3339('0x33')]=_[_0x3339('0x34')](_0x27f4e0[_0x3339('0x35')],_0x27f4e0[_0x3339('0x31')]);_0x31c621[_0x3339('0x36')]=_['intersection'](_0x27f4e0[_0x3339('0x35')],qs[_0x3339('0x37')](_0x1ab994[_0x3339('0x31')][_0x3339('0x37')]));_0x31c621[_0x3339('0x36')]=_0x31c621[_0x3339('0x36')][_0x3339('0x38')]?_0x31c621['attributes']:_0x27f4e0[_0x3339('0x35')];if(_0x1ab994['query'][_0x3339('0x41')]){_0x31c621['include']=[{'all':!![]}];}_0x31c621=_[_0x3339('0x3f')]({},_0x31c621,_0x1ab994[_0x3339('0x40')]);return db[_0x3339('0x2b')][_0x3339('0x47')](_0x31c621)[_0x3339('0x25')](handleEntityNotFound(_0x58be71,null))[_0x3339('0x25')](respondWithResult(_0x58be71,null))[_0x3339('0x48')](handleError(_0x58be71,null));};exports[_0x3339('0x49')]=function(_0x10e43c,_0x3c1444){return db[_0x3339('0x2b')][_0x3339('0x49')](_0x10e43c[_0x3339('0x4a')],{})[_0x3339('0x25')](respondWithResult(_0x3c1444,0xc9))[_0x3339('0x48')](handleError(_0x3c1444,null));};exports[_0x3339('0x24')]=function(_0x168369,_0x3d9247){if(_0x168369[_0x3339('0x4a')]['id']){delete _0x168369['body']['id'];}return db['SmsQueueReport'][_0x3339('0x47')]({'where':{'id':_0x168369[_0x3339('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d9247,null))['then'](saveUpdates(_0x168369[_0x3339('0x4a')],null))[_0x3339('0x25')](respondWithResult(_0x3d9247,null))[_0x3339('0x48')](handleError(_0x3d9247,null));};exports[_0x3339('0x4b')]=function(_0x30147c,_0x45e604){return db['SmsQueueReport'][_0x3339('0x47')]({'where':{'id':_0x30147c[_0x3339('0x46')]['id']}})[_0x3339('0x25')](handleEntityNotFound(_0x45e604,null))[_0x3339('0x25')](removeEntity(_0x45e604,null))['catch'](handleError(_0x45e604,null));};exports['describe']=function(_0x180fd6,_0xe0dc1c){return db[_0x3339('0x2b')][_0x3339('0x4c')]()[_0x3339('0x25')](respondWithResult(_0xe0dc1c,null))['catch'](handleError(_0xe0dc1c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 35697e0..c083da1 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x493239,_0x51cedb){var _0x4842c0=function(_0x543a28){while(--_0x543a28){_0x493239['push'](_0x493239['shift']());}};_0x4842c0(++_0x51cedb);}(_0x70e0,0x17b));var _0x070e=function(_0xbd7f6e,_0x11cc42){_0xbd7f6e=_0xbd7f6e-0x0;var _0x6f462c=_0x70e0[_0xbd7f6e];return _0x6f462c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0xd6297b,_0x3878a3){var _0x8ccab7=function(_0x152ac1){while(--_0x152ac1){_0xd6297b['push'](_0xd6297b['shift']());}};_0x8ccab7(++_0x3878a3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0xcb91[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d8a98ac..7f9a268 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 _0x7beb=['catch','CreateSmsQueueReport','create','body','options','raw','SmsQueueReport','update','attributes','limit','UpdateSmsQueueReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x7beb,0xeb));var _0xb7be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7beb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7be('0x0'));var BPromise=require(_0xb7be('0x1'));var rs=require(_0xb7be('0x2'));var fs=require('fs');var Redis=require(_0xb7be('0x3'));var db=require(_0xb7be('0x4'))['db'];var utils=require(_0xb7be('0x5'));var logger=require('../../config/logger')(_0xb7be('0x6'));var config=require(_0xb7be('0x7'));var jayson=require(_0xb7be('0x8'));var client=jayson[_0xb7be('0x9')][_0xb7be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1af665,_0x1113ad,_0x34f79a){return new BPromise(function(_0x39fa60,_0x1d6e54){return client['request'](_0x1af665,_0x34f79a)[_0xb7be('0xb')](function(_0x5362e8){logger[_0xb7be('0xc')](_0xb7be('0xd'),_0x1113ad,'request\x20sent');logger[_0xb7be('0xe')](_0xb7be('0xf'),_0x1113ad,_0xb7be('0x10'),JSON[_0xb7be('0x11')](_0x5362e8));if(_0x5362e8[_0xb7be('0x12')]){if(_0x5362e8[_0xb7be('0x12')]['code']===0x1f4){logger[_0xb7be('0x12')](_0xb7be('0xd'),_0x1113ad,_0x5362e8[_0xb7be('0x12')][_0xb7be('0x13')]);return _0x1d6e54(_0x5362e8[_0xb7be('0x12')][_0xb7be('0x13')]);}logger[_0xb7be('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x1113ad,_0x5362e8['error'][_0xb7be('0x13')]);return _0x39fa60(_0x5362e8[_0xb7be('0x12')][_0xb7be('0x13')]);}else{logger['info'](_0xb7be('0xd'),_0x1113ad,_0xb7be('0x10'));_0x39fa60(_0x5362e8[_0xb7be('0x14')][_0xb7be('0x13')]);}})[_0xb7be('0x15')](function(_0x43599d){logger[_0xb7be('0x12')](_0xb7be('0xd'),_0x1113ad,_0x43599d);_0x1d6e54(_0x43599d);});});}exports[_0xb7be('0x16')]=function(_0x53f961){var _0x46bfde=this;return new Promise(function(_0x50ba7c,_0x1cece7){return db['SmsQueueReport'][_0xb7be('0x17')](_0x53f961[_0xb7be('0x18')],{'raw':_0x53f961[_0xb7be('0x19')]?_0x53f961[_0xb7be('0x19')][_0xb7be('0x1a')]===undefined?!![]:![]:!![]})[_0xb7be('0xb')](function(_0x525e65){logger['info']('CreateSmsQueueReport',_0x53f961);logger[_0xb7be('0xe')](_0xb7be('0x16'),_0x53f961,JSON[_0xb7be('0x11')](_0x525e65));_0x50ba7c(_0x525e65);})['catch'](function(_0x33432a){logger['error'](_0xb7be('0x16'),_0x33432a[_0xb7be('0x13')],_0x53f961);_0x1cece7(_0x46bfde['error'](0x1f4,_0x33432a['message']));});});};exports['UpdateSmsQueueReport']=function(_0x4ed5a2){var _0x527a2e=this;return new Promise(function(_0x277934,_0x39c610){return db[_0xb7be('0x1b')][_0xb7be('0x1c')](_0x4ed5a2[_0xb7be('0x18')],{'raw':_0x4ed5a2[_0xb7be('0x19')]?_0x4ed5a2[_0xb7be('0x19')][_0xb7be('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed5a2[_0xb7be('0x19')]?_0x4ed5a2['options']['where']||null:null,'attributes':_0x4ed5a2[_0xb7be('0x19')]?_0x4ed5a2[_0xb7be('0x19')][_0xb7be('0x1d')]||null:null,'limit':_0x4ed5a2['options']?_0x4ed5a2[_0xb7be('0x19')][_0xb7be('0x1e')]||null:null})[_0xb7be('0xb')](function(_0x4fdf34){logger['info'](_0xb7be('0x1f'),_0x4ed5a2);logger['debug']('UpdateSmsQueueReport',_0x4ed5a2,JSON['stringify'](_0x4fdf34));_0x277934(_0x4fdf34);})[_0xb7be('0x15')](function(_0x340508){logger['error']('UpdateSmsQueueReport',_0x340508['message'],_0x4ed5a2);_0x39c610(_0x527a2e[_0xb7be('0x12')](0x1f4,_0x340508[_0xb7be('0x13')]));});});}; \ No newline at end of file +var _0xfc26=['UpdateSmsQueueReport','update','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xfc26,0x137));var _0x6fc2=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xfc26[_0x57d13b];return _0x467696;};'use strict';var _=require(_0x6fc2('0x0'));var util=require(_0x6fc2('0x1'));var moment=require(_0x6fc2('0x2'));var BPromise=require(_0x6fc2('0x3'));var rs=require(_0x6fc2('0x4'));var fs=require('fs');var Redis=require(_0x6fc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fc2('0x6'));var logger=require(_0x6fc2('0x7'))(_0x6fc2('0x8'));var config=require('../../config/environment');var jayson=require(_0x6fc2('0x9'));var client=jayson[_0x6fc2('0xa')][_0x6fc2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b39b2,_0x85cb7f,_0x2942f5){return new BPromise(function(_0x1cfd30,_0x475abe){return client[_0x6fc2('0xc')](_0x2b39b2,_0x2942f5)['then'](function(_0x13706a){logger[_0x6fc2('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x85cb7f,'request\x20sent');logger['debug'](_0x6fc2('0xe'),_0x85cb7f,'request\x20sent',JSON[_0x6fc2('0xf')](_0x13706a));if(_0x13706a['error']){if(_0x13706a[_0x6fc2('0x10')][_0x6fc2('0x11')]===0x1f4){logger['error'](_0x6fc2('0x12'),_0x85cb7f,_0x13706a[_0x6fc2('0x10')][_0x6fc2('0x13')]);return _0x475abe(_0x13706a['error'][_0x6fc2('0x13')]);}logger['error'](_0x6fc2('0x12'),_0x85cb7f,_0x13706a[_0x6fc2('0x10')]['message']);return _0x1cfd30(_0x13706a['error'][_0x6fc2('0x13')]);}else{logger[_0x6fc2('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x85cb7f,_0x6fc2('0x14'));_0x1cfd30(_0x13706a['result'][_0x6fc2('0x13')]);}})[_0x6fc2('0x15')](function(_0x2765f3){logger['error'](_0x6fc2('0x12'),_0x85cb7f,_0x2765f3);_0x475abe(_0x2765f3);});});}exports[_0x6fc2('0x16')]=function(_0x49d92f){var _0x5c2250=this;return new Promise(function(_0x4dc3d1,_0x3e7f3b){return db[_0x6fc2('0x17')][_0x6fc2('0x18')](_0x49d92f[_0x6fc2('0x19')],{'raw':_0x49d92f[_0x6fc2('0x1a')]?_0x49d92f['options'][_0x6fc2('0x1b')]===undefined?!![]:![]:!![]})[_0x6fc2('0x1c')](function(_0x4a04a3){logger['info'](_0x6fc2('0x16'),_0x49d92f);logger['debug']('CreateSmsQueueReport',_0x49d92f,JSON[_0x6fc2('0xf')](_0x4a04a3));_0x4dc3d1(_0x4a04a3);})[_0x6fc2('0x15')](function(_0x40d831){logger[_0x6fc2('0x10')](_0x6fc2('0x16'),_0x40d831[_0x6fc2('0x13')],_0x49d92f);_0x3e7f3b(_0x5c2250[_0x6fc2('0x10')](0x1f4,_0x40d831[_0x6fc2('0x13')]));});});};exports[_0x6fc2('0x1d')]=function(_0x1645d1){var _0x520133=this;return new Promise(function(_0x29b04a,_0x424c93){return db[_0x6fc2('0x17')][_0x6fc2('0x1e')](_0x1645d1[_0x6fc2('0x19')],{'raw':_0x1645d1[_0x6fc2('0x1a')]?_0x1645d1['options'][_0x6fc2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1645d1[_0x6fc2('0x1a')]?_0x1645d1[_0x6fc2('0x1a')][_0x6fc2('0x1f')]||null:null,'attributes':_0x1645d1['options']?_0x1645d1[_0x6fc2('0x1a')]['attributes']||null:null,'limit':_0x1645d1[_0x6fc2('0x1a')]?_0x1645d1['options'][_0x6fc2('0x20')]||null:null})[_0x6fc2('0x1c')](function(_0x281f5d){logger[_0x6fc2('0xd')]('UpdateSmsQueueReport',_0x1645d1);logger[_0x6fc2('0x21')](_0x6fc2('0x1d'),_0x1645d1,JSON[_0x6fc2('0xf')](_0x281f5d));_0x29b04a(_0x281f5d);})[_0x6fc2('0x15')](function(_0x14e42e){logger[_0x6fc2('0x10')](_0x6fc2('0x1d'),_0x14e42e[_0x6fc2('0x13')],_0x1645d1);_0x424c93(_0x520133[_0x6fc2('0x10')](0x1f4,_0x14e42e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7f514c7..31bf3e8 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 _0xb717=['put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','show','create'];(function(_0x29638f,_0x319dfd){var _0x227642=function(_0x3d5024){while(--_0x3d5024){_0x29638f['push'](_0x29638f['shift']());}};_0x227642(++_0x319dfd);}(_0xb717,0x1b4));var _0x7b71=function(_0x15b790,_0x104ec8){_0x15b790=_0x15b790-0x0;var _0x22f65a=_0xb717[_0x15b790];return _0x22f65a;};'use strict';var multer=require(_0x7b71('0x0'));var util=require('util');var path=require(_0x7b71('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b71('0x2'));var router=express[_0x7b71('0x3')]();var fs_extra=require(_0x7b71('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7b71('0x5'));var config=require(_0x7b71('0x6'));var controller=require(_0x7b71('0x7'));router[_0x7b71('0x8')]('/',auth[_0x7b71('0x9')](),controller['index']);router[_0x7b71('0x8')](_0x7b71('0xa'),auth[_0x7b71('0x9')](),controller[_0x7b71('0xb')]);router[_0x7b71('0x8')]('/:id',auth[_0x7b71('0x9')](),controller[_0x7b71('0xc')]);router['post']('/',auth[_0x7b71('0x9')](),controller[_0x7b71('0xd')]);router[_0x7b71('0xe')]('/:id',auth[_0x7b71('0x9')](),controller['update']);router[_0x7b71('0xf')]('/:id',auth[_0x7b71('0x9')](),controller[_0x7b71('0x10')]);module[_0x7b71('0x11')]=router; \ No newline at end of file +var _0x04de=['describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','/describe','isAuthenticated'];(function(_0x429684,_0x1e94fe){var _0x3903d6=function(_0x5323f9){while(--_0x5323f9){_0x429684['push'](_0x429684['shift']());}};_0x3903d6(++_0x1e94fe);}(_0x04de,0x107));var _0xe04d=function(_0x5dd57d,_0x352ddd){_0x5dd57d=_0x5dd57d-0x0;var _0x988bc0=_0x04de[_0x5dd57d];return _0x988bc0;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0xd')]);router[_0xe04d('0xe')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x10')]);router[_0xe04d('0x11')]('/',auth['isAuthenticated'](),controller[_0xe04d('0x12')]);router[_0xe04d('0x13')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x14')]);router[_0xe04d('0x15')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('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 adf066e..6203d3a 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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 +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2a1008,_0x402274){_0x2a1008=_0x2a1008-0x0;var _0x5a3e27=_0xb43b[_0x2a1008];return _0x5a3e27;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 901d823..bc9a362 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 _0x620c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','include','SmsTransferReport','rows','catch','show','params','keys','fields','length','includeAll','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0xdc1379,_0x2409ef){var _0x49a5f2=function(_0x2205e1){while(--_0x2205e1){_0xdc1379['push'](_0xdc1379['shift']());}};_0x49a5f2(++_0x2409ef);}(_0x620c,0x88));var _0xc620=function(_0x5a1350,_0x4813df){_0x5a1350=_0x5a1350-0x0;var _0x2589ae=_0x620c[_0x5a1350];return _0x2589ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc620('0x0'));var zipdir=require(_0xc620('0x1'));var jsonpatch=require(_0xc620('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc620('0x3'));var Mustache=require(_0xc620('0x4'));var util=require(_0xc620('0x5'));var path=require('path');var sox=require(_0xc620('0x6'));var csv=require(_0xc620('0x7'));var ejs=require(_0xc620('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc620('0x9'));var squel=require('squel');var crypto=require(_0xc620('0xa'));var jsforce=require(_0xc620('0xb'));var deskjs=require(_0xc620('0xc'));var toCsv=require(_0xc620('0x7'));var querystring=require(_0xc620('0xd'));var Papa=require(_0xc620('0xe'));var Redis=require(_0xc620('0xf'));var authService=require(_0xc620('0x10'));var qs=require(_0xc620('0x11'));var as=require(_0xc620('0x12'));var hardwareService=require(_0xc620('0x13'));var logger=require('../../config/logger')(_0xc620('0x14'));var utils=require(_0xc620('0x15'));var config=require(_0xc620('0x16'));var licenseUtil=require(_0xc620('0x17'));var db=require(_0xc620('0x18'))['db'];function respondWithStatusCode(_0x3c7ebe,_0x1d7716){_0x1d7716=_0x1d7716||0xcc;return function(_0xb49be0){if(_0xb49be0){return _0x3c7ebe[_0xc620('0x19')](_0x1d7716);}return _0x3c7ebe[_0xc620('0x1a')](_0x1d7716)[_0xc620('0x1b')]();};}function respondWithResult(_0x3ae021,_0x8206ee){_0x8206ee=_0x8206ee||0xc8;return function(_0x340f43){if(_0x340f43){return _0x3ae021[_0xc620('0x1a')](_0x8206ee)[_0xc620('0x1c')](_0x340f43);}};}function respondWithFilteredResult(_0x2108b9,_0x133f1b){return function(_0x27f445){if(_0x27f445){var _0x2b59d8=typeof _0x133f1b[_0xc620('0x1d')]==='undefined'&&typeof _0x133f1b[_0xc620('0x1e')]==='undefined';var _0x15956b=_0x27f445[_0xc620('0x1f')];var _0x40a3c1=_0x2b59d8?0x0:_0x133f1b[_0xc620('0x1d')];var _0x3ff31a=_0x2b59d8?_0x27f445[_0xc620('0x1f')]:_0x133f1b[_0xc620('0x1d')]+_0x133f1b[_0xc620('0x1e')];var _0x41d57a;if(_0x3ff31a>=_0x15956b){_0x3ff31a=_0x15956b;_0x41d57a=0xc8;}else{_0x41d57a=0xce;}_0x2108b9[_0xc620('0x1a')](_0x41d57a);return _0x2108b9['set'](_0xc620('0x20'),_0x40a3c1+'-'+_0x3ff31a+'/'+_0x15956b)[_0xc620('0x1c')](_0x27f445);}return null;};}function patchUpdates(_0x2dbf10){return function(_0x4a7418){try{jsonpatch[_0xc620('0x21')](_0x4a7418,_0x2dbf10,!![]);}catch(_0x32ac71){return BPromise['reject'](_0x32ac71);}return _0x4a7418['save']();};}function saveUpdates(_0x20a966,_0x49bf7b){return function(_0x3b5984){if(_0x3b5984){return _0x3b5984[_0xc620('0x22')](_0x20a966)[_0xc620('0x23')](function(_0x15138a){return _0x15138a;});}return null;};}function removeEntity(_0x48cc65,_0x518dad){return function(_0x31c253){if(_0x31c253){return _0x31c253['destroy']()[_0xc620('0x23')](function(){_0x48cc65[_0xc620('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf0e407,_0x5ed467){return function(_0x434855){if(!_0x434855){_0xf0e407[_0xc620('0x19')](0x194);}return _0x434855;};}function handleError(_0xe4ae0c,_0x4d7f50){_0x4d7f50=_0x4d7f50||0x1f4;return function(_0x22899f){logger[_0xc620('0x24')](_0x22899f[_0xc620('0x25')]);if(_0x22899f[_0xc620('0x26')]){delete _0x22899f[_0xc620('0x26')];}_0xe4ae0c[_0xc620('0x1a')](_0x4d7f50)[_0xc620('0x27')](_0x22899f);};}exports[_0xc620('0x28')]=function(_0x56b01d,_0x4f10ca){var _0x103c80={},_0x1afa7d={},_0x453eb6={'count':0x0,'rows':[]};var _0xc03f2b=_[_0xc620('0x29')](db['SmsTransferReport']['rawAttributes'],function(_0x6349ae){return{'name':_0x6349ae[_0xc620('0x2a')],'type':_0x6349ae[_0xc620('0x2b')][_0xc620('0x2c')]};});_0x1afa7d[_0xc620('0x2d')]=_[_0xc620('0x29')](_0xc03f2b,_0xc620('0x26'));_0x1afa7d[_0xc620('0x2e')]=_['keys'](_0x56b01d[_0xc620('0x2e')]);_0x1afa7d['filters']=_[_0xc620('0x2f')](_0x1afa7d[_0xc620('0x2d')],_0x1afa7d['query']);_0x103c80[_0xc620('0x30')]=_['intersection'](_0x1afa7d[_0xc620('0x2d')],qs['fields'](_0x56b01d['query']['fields']));_0x103c80[_0xc620('0x30')]=_0x103c80[_0xc620('0x30')]['length']?_0x103c80['attributes']:_0x1afa7d[_0xc620('0x2d')];if(!_0x56b01d['query'][_0xc620('0x31')](_0xc620('0x32'))){_0x103c80[_0xc620('0x1e')]=qs['limit'](_0x56b01d[_0xc620('0x2e')][_0xc620('0x1e')]);_0x103c80[_0xc620('0x1d')]=qs['offset'](_0x56b01d['query']['offset']);}_0x103c80[_0xc620('0x33')]=qs[_0xc620('0x34')](_0x56b01d[_0xc620('0x2e')][_0xc620('0x34')]);_0x103c80['where']=qs[_0xc620('0x35')](_[_0xc620('0x36')](_0x56b01d[_0xc620('0x2e')],_0x1afa7d[_0xc620('0x35')]),_0xc03f2b);if(_0x56b01d['query']['filter']){_0x103c80['where']=_['merge'](_0x103c80[_0xc620('0x37')],{'$or':_[_0xc620('0x29')](_0xc03f2b,function(_0x13b3cd){if(_0x13b3cd[_0xc620('0x2b')]!==_0xc620('0x38')){var _0x4325cc={};_0x4325cc[_0x13b3cd[_0xc620('0x26')]]={'$like':'%'+_0x56b01d[_0xc620('0x2e')][_0xc620('0x39')]+'%'};return _0x4325cc;}})});}_0x103c80=_[_0xc620('0x3a')]({},_0x103c80,_0x56b01d['options']);var _0xdbad8b={'where':_0x103c80[_0xc620('0x37')]};return db['SmsTransferReport'][_0xc620('0x1f')](_0xdbad8b)[_0xc620('0x23')](function(_0x370f3f){_0x453eb6[_0xc620('0x1f')]=_0x370f3f;if(_0x56b01d['query']['includeAll']){_0x103c80[_0xc620('0x3b')]=[{'all':!![]}];}return db[_0xc620('0x3c')]['findAll'](_0x103c80);})[_0xc620('0x23')](function(_0x451e7a){_0x453eb6[_0xc620('0x3d')]=_0x451e7a;return _0x453eb6;})[_0xc620('0x23')](respondWithFilteredResult(_0x4f10ca,_0x103c80))[_0xc620('0x3e')](handleError(_0x4f10ca,null));};exports[_0xc620('0x3f')]=function(_0x4f4f6f,_0xf73085){var _0x5654fb={'raw':!![],'where':{'id':_0x4f4f6f[_0xc620('0x40')]['id']}},_0x40690b={};_0x40690b['model']=_[_0xc620('0x41')](db[_0xc620('0x3c')]['rawAttributes']);_0x40690b[_0xc620('0x2e')]=_[_0xc620('0x41')](_0x4f4f6f[_0xc620('0x2e')]);_0x40690b[_0xc620('0x35')]=_['intersection'](_0x40690b['model'],_0x40690b[_0xc620('0x2e')]);_0x5654fb[_0xc620('0x30')]=_[_0xc620('0x2f')](_0x40690b[_0xc620('0x2d')],qs[_0xc620('0x42')](_0x4f4f6f[_0xc620('0x2e')][_0xc620('0x42')]));_0x5654fb[_0xc620('0x30')]=_0x5654fb['attributes'][_0xc620('0x43')]?_0x5654fb[_0xc620('0x30')]:_0x40690b[_0xc620('0x2d')];if(_0x4f4f6f[_0xc620('0x2e')][_0xc620('0x44')]){_0x5654fb[_0xc620('0x3b')]=[{'all':!![]}];}_0x5654fb=_['merge']({},_0x5654fb,_0x4f4f6f[_0xc620('0x45')]);return db['SmsTransferReport'][_0xc620('0x46')](_0x5654fb)[_0xc620('0x23')](handleEntityNotFound(_0xf73085,null))['then'](respondWithResult(_0xf73085,null))[_0xc620('0x3e')](handleError(_0xf73085,null));};exports[_0xc620('0x47')]=function(_0x573b37,_0x44ab01){return db[_0xc620('0x3c')][_0xc620('0x47')](_0x573b37[_0xc620('0x48')],{})[_0xc620('0x23')](respondWithResult(_0x44ab01,0xc9))[_0xc620('0x3e')](handleError(_0x44ab01,null));};exports[_0xc620('0x22')]=function(_0x8e8b94,_0x188929){if(_0x8e8b94[_0xc620('0x48')]['id']){delete _0x8e8b94[_0xc620('0x48')]['id'];}return db['SmsTransferReport'][_0xc620('0x46')]({'where':{'id':_0x8e8b94[_0xc620('0x40')]['id']}})[_0xc620('0x23')](handleEntityNotFound(_0x188929,null))[_0xc620('0x23')](saveUpdates(_0x8e8b94[_0xc620('0x48')],null))[_0xc620('0x23')](respondWithResult(_0x188929,null))[_0xc620('0x3e')](handleError(_0x188929,null));};exports[_0xc620('0x49')]=function(_0x2e6404,_0x4c5f5b){return db[_0xc620('0x3c')][_0xc620('0x46')]({'where':{'id':_0x2e6404[_0xc620('0x40')]['id']}})[_0xc620('0x23')](handleEntityNotFound(_0x4c5f5b,null))[_0xc620('0x23')](removeEntity(_0x4c5f5b,null))[_0xc620('0x3e')](handleError(_0x4c5f5b,null));};exports[_0xc620('0x4a')]=function(_0x7f0285,_0x1e3d9c){return db[_0xc620('0x3c')][_0xc620('0x4a')]()[_0xc620('0x23')](respondWithResult(_0x1e3d9c,null))[_0xc620('0x3e')](handleError(_0x1e3d9c,null));}; \ No newline at end of file +var _0x9034=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x59080e,_0x2c3518){var _0x4f86a9=function(_0x43784a){while(--_0x43784a){_0x59080e['push'](_0x59080e['shift']());}};_0x4f86a9(++_0x2c3518);}(_0x9034,0xaa));var _0x4903=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9034[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x4903('0x0'));var rimraf=require(_0x4903('0x1'));var zipdir=require(_0x4903('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4903('0x3'));var moment=require(_0x4903('0x4'));var BPromise=require(_0x4903('0x5'));var Mustache=require('mustache');var util=require(_0x4903('0x6'));var path=require(_0x4903('0x7'));var sox=require(_0x4903('0x8'));var csv=require(_0x4903('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4903('0xa'));var _=require(_0x4903('0xb'));var squel=require(_0x4903('0xc'));var crypto=require(_0x4903('0xd'));var jsforce=require(_0x4903('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4903('0x9'));var querystring=require(_0x4903('0xf'));var Papa=require('papaparse');var Redis=require(_0x4903('0x10'));var authService=require(_0x4903('0x11'));var qs=require(_0x4903('0x12'));var as=require(_0x4903('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4903('0x14'))('api');var utils=require(_0x4903('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4903('0x16'));var db=require(_0x4903('0x17'))['db'];function respondWithStatusCode(_0x386124,_0x5c0307){_0x5c0307=_0x5c0307||0xcc;return function(_0x1c09db){if(_0x1c09db){return _0x386124[_0x4903('0x18')](_0x5c0307);}return _0x386124['status'](_0x5c0307)[_0x4903('0x19')]();};}function respondWithResult(_0x893c6b,_0x5591d0){_0x5591d0=_0x5591d0||0xc8;return function(_0x3954f4){if(_0x3954f4){return _0x893c6b['status'](_0x5591d0)[_0x4903('0x1a')](_0x3954f4);}};}function respondWithFilteredResult(_0x539a97,_0x6d63a5){return function(_0x2da41f){if(_0x2da41f){var _0x4d02a4=typeof _0x6d63a5[_0x4903('0x1b')]===_0x4903('0x1c')&&typeof _0x6d63a5[_0x4903('0x1d')]===_0x4903('0x1c');var _0x41461a=_0x2da41f['count'];var _0xd39784=_0x4d02a4?0x0:_0x6d63a5[_0x4903('0x1b')];var _0x36f085=_0x4d02a4?_0x2da41f[_0x4903('0x1e')]:_0x6d63a5['offset']+_0x6d63a5[_0x4903('0x1d')];var _0x5791fa;if(_0x36f085>=_0x41461a){_0x36f085=_0x41461a;_0x5791fa=0xc8;}else{_0x5791fa=0xce;}_0x539a97[_0x4903('0x1f')](_0x5791fa);return _0x539a97[_0x4903('0x20')]('Content-Range',_0xd39784+'-'+_0x36f085+'/'+_0x41461a)[_0x4903('0x1a')](_0x2da41f);}return null;};}function patchUpdates(_0x1e0fed){return function(_0x308d8c){try{jsonpatch[_0x4903('0x21')](_0x308d8c,_0x1e0fed,!![]);}catch(_0x54565f){return BPromise[_0x4903('0x22')](_0x54565f);}return _0x308d8c['save']();};}function saveUpdates(_0x714fee,_0x33f27c){return function(_0x17a59a){if(_0x17a59a){return _0x17a59a[_0x4903('0x23')](_0x714fee)[_0x4903('0x24')](function(_0x1e4b43){return _0x1e4b43;});}return null;};}function removeEntity(_0x48a564,_0x1db90c){return function(_0x259d50){if(_0x259d50){return _0x259d50[_0x4903('0x25')]()[_0x4903('0x24')](function(){_0x48a564['status'](0xcc)[_0x4903('0x19')]();});}};}function handleEntityNotFound(_0x3437c5,_0x3ebf4d){return function(_0x4c659c){if(!_0x4c659c){_0x3437c5['sendStatus'](0x194);}return _0x4c659c;};}function handleError(_0x118136,_0x5bcfc6){_0x5bcfc6=_0x5bcfc6||0x1f4;return function(_0x4adb13){logger['error'](_0x4adb13[_0x4903('0x26')]);if(_0x4adb13[_0x4903('0x27')]){delete _0x4adb13[_0x4903('0x27')];}_0x118136[_0x4903('0x1f')](_0x5bcfc6)[_0x4903('0x28')](_0x4adb13);};}exports[_0x4903('0x29')]=function(_0x21e158,_0x50e53e){var _0x46cbd8={},_0x1b1a21={},_0x235bf6={'count':0x0,'rows':[]};var _0x5889c5=_[_0x4903('0x2a')](db[_0x4903('0x2b')][_0x4903('0x2c')],function(_0x4e1a64){return{'name':_0x4e1a64[_0x4903('0x2d')],'type':_0x4e1a64[_0x4903('0x2e')][_0x4903('0x2f')]};});_0x1b1a21[_0x4903('0x30')]=_[_0x4903('0x2a')](_0x5889c5,'name');_0x1b1a21[_0x4903('0x31')]=_[_0x4903('0x32')](_0x21e158['query']);_0x1b1a21['filters']=_[_0x4903('0x33')](_0x1b1a21[_0x4903('0x30')],_0x1b1a21[_0x4903('0x31')]);_0x46cbd8[_0x4903('0x34')]=_[_0x4903('0x33')](_0x1b1a21[_0x4903('0x30')],qs['fields'](_0x21e158[_0x4903('0x31')][_0x4903('0x35')]));_0x46cbd8[_0x4903('0x34')]=_0x46cbd8['attributes'][_0x4903('0x36')]?_0x46cbd8['attributes']:_0x1b1a21['model'];if(!_0x21e158[_0x4903('0x31')][_0x4903('0x37')](_0x4903('0x38'))){_0x46cbd8[_0x4903('0x1d')]=qs[_0x4903('0x1d')](_0x21e158[_0x4903('0x31')]['limit']);_0x46cbd8[_0x4903('0x1b')]=qs[_0x4903('0x1b')](_0x21e158[_0x4903('0x31')][_0x4903('0x1b')]);}_0x46cbd8[_0x4903('0x39')]=qs[_0x4903('0x3a')](_0x21e158[_0x4903('0x31')][_0x4903('0x3a')]);_0x46cbd8[_0x4903('0x3b')]=qs[_0x4903('0x3c')](_[_0x4903('0x3d')](_0x21e158[_0x4903('0x31')],_0x1b1a21[_0x4903('0x3c')]),_0x5889c5);if(_0x21e158[_0x4903('0x31')][_0x4903('0x3e')]){_0x46cbd8[_0x4903('0x3b')]=_[_0x4903('0x3f')](_0x46cbd8[_0x4903('0x3b')],{'$or':_[_0x4903('0x2a')](_0x5889c5,function(_0x586f6f){if(_0x586f6f[_0x4903('0x2e')]!==_0x4903('0x40')){var _0x16381a={};_0x16381a[_0x586f6f[_0x4903('0x27')]]={'$like':'%'+_0x21e158[_0x4903('0x31')]['filter']+'%'};return _0x16381a;}})});}_0x46cbd8=_['merge']({},_0x46cbd8,_0x21e158[_0x4903('0x41')]);var _0x5ed6f9={'where':_0x46cbd8['where']};return db[_0x4903('0x2b')][_0x4903('0x1e')](_0x5ed6f9)[_0x4903('0x24')](function(_0x35a657){_0x235bf6[_0x4903('0x1e')]=_0x35a657;if(_0x21e158[_0x4903('0x31')][_0x4903('0x42')]){_0x46cbd8['include']=[{'all':!![]}];}return db[_0x4903('0x2b')]['findAll'](_0x46cbd8);})[_0x4903('0x24')](function(_0x5969ee){_0x235bf6[_0x4903('0x43')]=_0x5969ee;return _0x235bf6;})[_0x4903('0x24')](respondWithFilteredResult(_0x50e53e,_0x46cbd8))[_0x4903('0x44')](handleError(_0x50e53e,null));};exports['show']=function(_0x21dcb5,_0x27fd54){var _0x1372e1={'raw':!![],'where':{'id':_0x21dcb5[_0x4903('0x45')]['id']}},_0x588fca={};_0x588fca['model']=_['keys'](db[_0x4903('0x2b')][_0x4903('0x2c')]);_0x588fca[_0x4903('0x31')]=_['keys'](_0x21dcb5[_0x4903('0x31')]);_0x588fca['filters']=_[_0x4903('0x33')](_0x588fca[_0x4903('0x30')],_0x588fca[_0x4903('0x31')]);_0x1372e1['attributes']=_[_0x4903('0x33')](_0x588fca[_0x4903('0x30')],qs[_0x4903('0x35')](_0x21dcb5[_0x4903('0x31')]['fields']));_0x1372e1[_0x4903('0x34')]=_0x1372e1[_0x4903('0x34')][_0x4903('0x36')]?_0x1372e1['attributes']:_0x588fca[_0x4903('0x30')];if(_0x21dcb5[_0x4903('0x31')][_0x4903('0x42')]){_0x1372e1[_0x4903('0x46')]=[{'all':!![]}];}_0x1372e1=_[_0x4903('0x3f')]({},_0x1372e1,_0x21dcb5['options']);return db[_0x4903('0x2b')][_0x4903('0x47')](_0x1372e1)[_0x4903('0x24')](handleEntityNotFound(_0x27fd54,null))['then'](respondWithResult(_0x27fd54,null))[_0x4903('0x44')](handleError(_0x27fd54,null));};exports[_0x4903('0x48')]=function(_0x502a19,_0x40812d){return db[_0x4903('0x2b')]['create'](_0x502a19[_0x4903('0x49')],{})[_0x4903('0x24')](respondWithResult(_0x40812d,0xc9))[_0x4903('0x44')](handleError(_0x40812d,null));};exports[_0x4903('0x23')]=function(_0x50e42e,_0x554d8a){if(_0x50e42e[_0x4903('0x49')]['id']){delete _0x50e42e['body']['id'];}return db[_0x4903('0x2b')][_0x4903('0x47')]({'where':{'id':_0x50e42e[_0x4903('0x45')]['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x554d8a,null))[_0x4903('0x24')](saveUpdates(_0x50e42e[_0x4903('0x49')],null))[_0x4903('0x24')](respondWithResult(_0x554d8a,null))['catch'](handleError(_0x554d8a,null));};exports[_0x4903('0x25')]=function(_0x2d681c,_0x1ed6c9){return db[_0x4903('0x2b')]['find']({'where':{'id':_0x2d681c[_0x4903('0x45')]['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x1ed6c9,null))[_0x4903('0x24')](removeEntity(_0x1ed6c9,null))[_0x4903('0x44')](handleError(_0x1ed6c9,null));};exports[_0x4903('0x4a')]=function(_0x1915c2,_0x520022){return db[_0x4903('0x2b')][_0x4903('0x4a')]()['then'](respondWithResult(_0x520022,null))[_0x4903('0x44')](handleError(_0x520022,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3dd9c28..05e4229 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 _0x13c0=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','uniqueid'];(function(_0x68c2a6,_0x5ac1ea){var _0x432010=function(_0x523f0d){while(--_0x523f0d){_0x68c2a6['push'](_0x68c2a6['shift']());}};_0x432010(++_0x5ac1ea);}(_0x13c0,0x79));var _0x013c=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x13c0[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var logger=require(_0x013c('0x2'))(_0x013c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x013c('0x4'));var rimraf=require(_0x013c('0x5'));var config=require(_0x013c('0x6'));var attributes=require(_0x013c('0x7'));module[_0x013c('0x8')]=function(_0x12d78e,_0x1142f4){return _0x12d78e[_0x013c('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x013c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x155d=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x277190,_0x38dea5){var _0x21992c=function(_0x2114cf){while(--_0x2114cf){_0x277190['push'](_0x277190['shift']());}};_0x21992c(++_0x38dea5);}(_0x155d,0x89));var _0xd155=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x155d[_0x14fad0];return _0x5c665f;};'use strict';var _=require(_0xd155('0x0'));var util=require(_0xd155('0x1'));var logger=require(_0xd155('0x2'))(_0xd155('0x3'));var moment=require('moment');var BPromise=require(_0xd155('0x4'));var rp=require(_0xd155('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xd155('0x6')]=function(_0x433e8e,_0x2ec7a9){return _0x433e8e[_0xd155('0x7')](_0xd155('0x8'),attributes,{'tableName':_0xd155('0x9'),'paranoid':![],'indexes':[{'name':_0xd155('0xa'),'fields':[_0xd155('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8fc9298..d7795f6 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 _0xbe2a=['client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5ca89f,_0x1a97a2){var _0x40e3bb=function(_0xd82acd){while(--_0xd82acd){_0x5ca89f['push'](_0x5ca89f['shift']());}};_0x40e3bb(++_0x1a97a2);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x31c356,_0x5e5675){_0x31c356=_0x31c356-0x0;var _0x5d5165=_0xbe2a[_0x31c356];return _0x5d5165;};'use strict';var _=require(_0xabe2('0x0'));var util=require(_0xabe2('0x1'));var moment=require(_0xabe2('0x2'));var BPromise=require(_0xabe2('0x3'));var rs=require(_0xabe2('0x4'));var fs=require('fs');var Redis=require(_0xabe2('0x5'));var db=require(_0xabe2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xabe2('0x7'))('rpc');var config=require(_0xabe2('0x8'));var jayson=require(_0xabe2('0x9'));var client=jayson[_0xabe2('0xa')][_0xabe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3538a0,_0x138e22,_0x5347ca){return new BPromise(function(_0x1c5c5c,_0x1f10d7){return client[_0xabe2('0xc')](_0x3538a0,_0x5347ca)[_0xabe2('0xd')](function(_0x229ac0){logger[_0xabe2('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x138e22,_0xabe2('0xf'));logger[_0xabe2('0x10')](_0xabe2('0x11'),_0x138e22,'request\x20sent',JSON['stringify'](_0x229ac0));if(_0x229ac0['error']){if(_0x229ac0[_0xabe2('0x12')]['code']===0x1f4){logger[_0xabe2('0x12')](_0xabe2('0x13'),_0x138e22,_0x229ac0['error']['message']);return _0x1f10d7(_0x229ac0[_0xabe2('0x12')][_0xabe2('0x14')]);}logger[_0xabe2('0x12')](_0xabe2('0x13'),_0x138e22,_0x229ac0[_0xabe2('0x12')][_0xabe2('0x14')]);return _0x1c5c5c(_0x229ac0[_0xabe2('0x12')][_0xabe2('0x14')]);}else{logger[_0xabe2('0xe')](_0xabe2('0x13'),_0x138e22,'request\x20sent');_0x1c5c5c(_0x229ac0[_0xabe2('0x15')][_0xabe2('0x14')]);}})[_0xabe2('0x16')](function(_0x50f335){logger[_0xabe2('0x12')](_0xabe2('0x13'),_0x138e22,_0x50f335);_0x1f10d7(_0x50f335);});});} \ No newline at end of file +var _0x9829=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x49d6be,_0x133f47){var _0x3b5550=function(_0x19da23){while(--_0x19da23){_0x49d6be['push'](_0x49d6be['shift']());}};_0x3b5550(++_0x133f47);}(_0x9829,0xc4));var _0x9982=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9829[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var moment=require(_0x9982('0x2'));var BPromise=require(_0x9982('0x3'));var rs=require(_0x9982('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9982('0x5'))['db'];var utils=require(_0x9982('0x6'));var logger=require(_0x9982('0x7'))('rpc');var config=require(_0x9982('0x8'));var jayson=require(_0x9982('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x340d62,_0x35a93f,_0x5d0824){return new BPromise(function(_0x25f30a,_0x1a3931){return client[_0x9982('0xa')](_0x340d62,_0x5d0824)[_0x9982('0xb')](function(_0x1e7881){logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));logger[_0x9982('0xf')](_0x9982('0x10'),_0x35a93f,_0x9982('0xe'),JSON[_0x9982('0x11')](_0x1e7881));if(_0x1e7881[_0x9982('0x12')]){if(_0x1e7881[_0x9982('0x12')][_0x9982('0x13')]===0x1f4){logger[_0x9982('0x12')](_0x9982('0xd'),_0x35a93f,_0x1e7881[_0x9982('0x12')]['message']);return _0x1a3931(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}logger['error'](_0x9982('0xd'),_0x35a93f,_0x1e7881['error'][_0x9982('0x14')]);return _0x25f30a(_0x1e7881[_0x9982('0x12')][_0x9982('0x14')]);}else{logger[_0x9982('0xc')](_0x9982('0xd'),_0x35a93f,_0x9982('0xe'));_0x25f30a(_0x1e7881[_0x9982('0x15')][_0x9982('0x14')]);}})[_0x9982('0x16')](function(_0x50ca89){logger[_0x9982('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x35a93f,_0x50ca89);_0x1a3931(_0x50ca89);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a0f8a98..09d24b4 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 _0xccbc=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','now','post','file','update','delete'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0xccbc,0x75));var _0xcccb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xccbc[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xcccb('0x0'));var path=require(_0xcccb('0x1'));var timeout=require(_0xcccb('0x2'));var express=require(_0xcccb('0x3'));var router=express['Router']();var fs_extra=require(_0xcccb('0x4'));var auth=require(_0xcccb('0x5'));var interaction=require(_0xcccb('0x6'));var config=require(_0xcccb('0x7'));var controller=require(_0xcccb('0x8'));router[_0xcccb('0x9')]('/',auth['isAuthenticated'](),controller[_0xcccb('0xa')]);router[_0xcccb('0x9')](_0xcccb('0xb'),auth[_0xcccb('0xc')](),controller[_0xcccb('0xd')]);router[_0xcccb('0x9')]('/:id/download',auth[_0xcccb('0xc')](),controller[_0xcccb('0xe')]);var upload=multer({'storage':multer[_0xcccb('0xf')]({'destination':function(_0x3dd11d,_0x101132,_0x48f68c){_0x48f68c(null,path[_0xcccb('0x10')](config[_0xcccb('0x11')],_0xcccb('0x12')));},'filename':function(_0x4dbb58,_0x3f7545,_0x40d6cb){_0x3f7545[_0xcccb('0x13')]=_0x3f7545['originalname'][_0xcccb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40d6cb(null,util['format'](_0xcccb('0x15'),path['basename'](_0x3f7545['originalname'],path[_0xcccb('0x16')](_0x3f7545['originalname'])),Date[_0xcccb('0x17')](),path[_0xcccb('0x16')](_0x3f7545[_0xcccb('0x13')])));}})});router[_0xcccb('0x18')]('/',upload['single'](_0xcccb('0x19')),controller['create']);router['put'](_0xcccb('0xb'),auth[_0xcccb('0xc')](),controller[_0xcccb('0x1a')]);router[_0xcccb('0x1b')](_0xcccb('0xb'),auth[_0xcccb('0xc')](),controller[_0xcccb('0x1b')]);module[_0xcccb('0x1c')]=router; \ No newline at end of file +var _0x9fd0=['server/files/sounds/original/','originalname','basename','extname','now','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','download','diskStorage','root'];(function(_0x36c913,_0x148df8){var _0x589cfd=function(_0x1b5fd0){while(--_0x1b5fd0){_0x36c913['push'](_0x36c913['shift']());}};_0x589cfd(++_0x148df8);}(_0x9fd0,0xce));var _0x09fd=function(_0x692463,_0x2c1ebc){_0x692463=_0x692463-0x0;var _0x14dbc2=_0x9fd0[_0x692463];return _0x14dbc2;};'use strict';var multer=require(_0x09fd('0x0'));var util=require(_0x09fd('0x1'));var path=require(_0x09fd('0x2'));var timeout=require(_0x09fd('0x3'));var express=require(_0x09fd('0x4'));var router=express[_0x09fd('0x5')]();var fs_extra=require(_0x09fd('0x6'));var auth=require(_0x09fd('0x7'));var interaction=require(_0x09fd('0x8'));var config=require(_0x09fd('0x9'));var controller=require(_0x09fd('0xa'));router[_0x09fd('0xb')]('/',auth[_0x09fd('0xc')](),controller['index']);router['get'](_0x09fd('0xd'),auth[_0x09fd('0xc')](),controller[_0x09fd('0xe')]);router[_0x09fd('0xb')]('/:id/download',auth[_0x09fd('0xc')](),controller[_0x09fd('0xf')]);var upload=multer({'storage':multer[_0x09fd('0x10')]({'destination':function(_0x1c1891,_0x38f8b6,_0x1bf3c5){_0x1bf3c5(null,path['join'](config[_0x09fd('0x11')],_0x09fd('0x12')));},'filename':function(_0x4c2127,_0x1a6e92,_0x57576f){_0x1a6e92[_0x09fd('0x13')]=_0x1a6e92[_0x09fd('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57576f(null,util['format']('%s-%s%s',path[_0x09fd('0x14')](_0x1a6e92[_0x09fd('0x13')],path[_0x09fd('0x15')](_0x1a6e92[_0x09fd('0x13')])),Date[_0x09fd('0x16')](),path[_0x09fd('0x15')](_0x1a6e92[_0x09fd('0x13')])));}})});router[_0x09fd('0x17')]('/',upload['single']('file'),controller[_0x09fd('0x18')]);router[_0x09fd('0x19')](_0x09fd('0xd'),auth[_0x09fd('0xc')](),controller['update']);router[_0x09fd('0x1a')](_0x09fd('0xd'),auth[_0x09fd('0xc')](),controller[_0x09fd('0x1a')]);module[_0x09fd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f8bdab0..1af5a3e 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 _0xa633=['name','FLOAT','BIGINT','INTEGER','STRING'];(function(_0x388898,_0x1728a8){var _0x4b2bdd=function(_0x20b3d7){while(--_0x20b3d7){_0x388898['push'](_0x388898['shift']());}};_0x4b2bdd(++_0x1728a8);}(_0xa633,0x18a));var _0x3a63=function(_0x476c07,_0x50a6ba){_0x476c07=_0x476c07-0x0;var _0x5eb9ac=_0xa633[_0x476c07];return _0x5eb9ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3a63('0x0')],'unique':_0x3a63('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3a63('0x0')]},'display_name':{'type':Sequelize[_0x3a63('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x3a63('0x0')]},'original_format':{'type':Sequelize[_0x3a63('0x0')]},'original_duration':{'type':Sequelize[_0x3a63('0x2')]},'original_sampleCount':{'type':Sequelize[_0x3a63('0x3')]},'original_channelCount':{'type':Sequelize[_0x3a63('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x3a63('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3a63('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3a63('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x3a63('0x4')]}}; \ No newline at end of file +var _0x52ad=['STRING','name','FLOAT','BIGINT','INTEGER','exports'];(function(_0x1d9864,_0x447ae3){var _0x3e12ea=function(_0xd5818e){while(--_0xd5818e){_0x1d9864['push'](_0x1d9864['shift']());}};_0x3e12ea(++_0x447ae3);}(_0x52ad,0xef));var _0xd52a=function(_0x5181d6,_0x176d8e){_0x5181d6=_0x5181d6-0x0;var _0x485c73=_0x52ad[_0x5181d6];return _0x485c73;};'use strict';var Sequelize=require('sequelize');module[_0xd52a('0x0')]={'name':{'type':Sequelize[_0xd52a('0x1')],'unique':_0xd52a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd52a('0x1')]},'display_name':{'type':Sequelize[_0xd52a('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xd52a('0x1')]},'original_format':{'type':Sequelize[_0xd52a('0x1')]},'original_duration':{'type':Sequelize[_0xd52a('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd52a('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd52a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd52a('0x5')]},'converted_format':{'type':Sequelize[_0xd52a('0x1')]},'converted_duration':{'type':Sequelize[_0xd52a('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xd52a('0x4')]},'converted_channelCount':{'type':Sequelize[_0xd52a('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xd52a('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 80daa28..5096c57 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 _0x920c=['ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','intersection','find','catch','download','save_name','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','join','root','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','start','description','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox'];(function(_0xfb0e92,_0x399f67){var _0x5ddbba=function(_0x572989){while(--_0x572989){_0xfb0e92['push'](_0xfb0e92['shift']());}};_0x5ddbba(++_0x399f67);}(_0x920c,0x169));var _0xc920=function(_0x537c32,_0x5c0845){_0x537c32=_0x537c32-0x0;var _0x2524d7=_0x920c[_0x537c32];return _0x2524d7;};'use strict';var emlformat=require(_0xc920('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc920('0x1'));var jsonpatch=require(_0xc920('0x2'));var rp=require(_0xc920('0x3'));var moment=require('moment');var BPromise=require(_0xc920('0x4'));var Mustache=require('mustache');var util=require(_0xc920('0x5'));var path=require(_0xc920('0x6'));var sox=require(_0xc920('0x7'));var csv=require('to-csv');var ejs=require(_0xc920('0x8'));var fs=require('fs');var fs_extra=require(_0xc920('0x9'));var _=require(_0xc920('0xa'));var squel=require(_0xc920('0xb'));var crypto=require(_0xc920('0xc'));var jsforce=require(_0xc920('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc920('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc920('0xf'));var qs=require(_0xc920('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc920('0x11'));var logger=require(_0xc920('0x12'))('api');var utils=require(_0xc920('0x13'));var config=require(_0xc920('0x14'));var licenseUtil=require(_0xc920('0x15'));var db=require(_0xc920('0x16'))['db'];function respondWithStatusCode(_0x57c441,_0x28167f){_0x28167f=_0x28167f||0xcc;return function(_0x25be88){if(_0x25be88){return _0x57c441[_0xc920('0x17')](_0x28167f);}return _0x57c441[_0xc920('0x18')](_0x28167f)[_0xc920('0x19')]();};}function respondWithResult(_0x502019,_0x8ff50b){_0x8ff50b=_0x8ff50b||0xc8;return function(_0x2e8ca9){if(_0x2e8ca9){return _0x502019[_0xc920('0x18')](_0x8ff50b)[_0xc920('0x1a')](_0x2e8ca9);}};}function respondWithFilteredResult(_0x43b8f1,_0x10ba5c){return function(_0xa7c04c){if(_0xa7c04c){var _0x4096de=typeof _0x10ba5c['offset']===_0xc920('0x1b')&&typeof _0x10ba5c['limit']==='undefined';var _0x2b9d8b=_0xa7c04c[_0xc920('0x1c')];var _0x2f261d=_0x4096de?0x0:_0x10ba5c[_0xc920('0x1d')];var _0x5d8582=_0x4096de?_0xa7c04c[_0xc920('0x1c')]:_0x10ba5c[_0xc920('0x1d')]+_0x10ba5c[_0xc920('0x1e')];var _0x51c05e;if(_0x5d8582>=_0x2b9d8b){_0x5d8582=_0x2b9d8b;_0x51c05e=0xc8;}else{_0x51c05e=0xce;}_0x43b8f1[_0xc920('0x18')](_0x51c05e);return _0x43b8f1[_0xc920('0x1f')](_0xc920('0x20'),_0x2f261d+'-'+_0x5d8582+'/'+_0x2b9d8b)[_0xc920('0x1a')](_0xa7c04c);}return null;};}function patchUpdates(_0xd7a149){return function(_0x30deb0){try{jsonpatch[_0xc920('0x21')](_0x30deb0,_0xd7a149,!![]);}catch(_0x35bfbe){return BPromise[_0xc920('0x22')](_0x35bfbe);}return _0x30deb0['save']();};}function saveUpdates(_0x39ba21,_0x513661){return function(_0x2a3211){if(_0x2a3211){return _0x2a3211[_0xc920('0x23')](_0x39ba21)[_0xc920('0x24')](function(_0x98a0e1){return _0x98a0e1;});}return null;};}function removeEntity(_0x828552,_0x48125e){return function(_0x22a553){if(_0x22a553){return _0x22a553[_0xc920('0x25')]()[_0xc920('0x24')](function(){var _0x52431c=_0x22a553[_0xc920('0x26')]({'plain':!![]});var _0x4e89f2=_0xc920('0x27');return db[_0xc920('0x28')]['destroy']({'where':{'type':_0x4e89f2,'resourceId':_0x52431c['id']}})[_0xc920('0x24')](function(){return _0x22a553;});})[_0xc920('0x24')](function(){_0x828552[_0xc920('0x18')](0xcc)[_0xc920('0x19')]();});}};}function handleEntityNotFound(_0x37e2cf,_0x352e6e){return function(_0x4c146b){if(!_0x4c146b){_0x37e2cf[_0xc920('0x17')](0x194);}return _0x4c146b;};}function handleError(_0xb474bd,_0x227857){_0x227857=_0x227857||0x1f4;return function(_0x834617){logger[_0xc920('0x29')](_0x834617[_0xc920('0x2a')]);if(_0x834617[_0xc920('0x2b')]){delete _0x834617['name'];}_0xb474bd[_0xc920('0x18')](_0x227857)[_0xc920('0x2c')](_0x834617);};}exports[_0xc920('0x2d')]=function(_0x1cc9a4,_0x7e379f){var _0x1aa81e={},_0x15277d={},_0x460f59={'count':0x0,'rows':[]};var _0x39da19=_[_0xc920('0x2e')](db[_0xc920('0x2f')][_0xc920('0x30')],function(_0x287851){return{'name':_0x287851['fieldName'],'type':_0x287851[_0xc920('0x31')][_0xc920('0x32')]};});_0x15277d[_0xc920('0x33')]=_[_0xc920('0x2e')](_0x39da19,_0xc920('0x2b'));_0x15277d[_0xc920('0x34')]=_[_0xc920('0x35')](_0x1cc9a4['query']);_0x15277d[_0xc920('0x36')]=_['intersection'](_0x15277d['model'],_0x15277d['query']);_0x1aa81e[_0xc920('0x37')]=_['intersection'](_0x15277d[_0xc920('0x33')],qs['fields'](_0x1cc9a4[_0xc920('0x34')][_0xc920('0x38')]));_0x1aa81e[_0xc920('0x37')]=_0x1aa81e[_0xc920('0x37')][_0xc920('0x39')]?_0x1aa81e[_0xc920('0x37')]:_0x15277d[_0xc920('0x33')];if(!_0x1cc9a4[_0xc920('0x34')]['hasOwnProperty'](_0xc920('0x3a'))){_0x1aa81e[_0xc920('0x1e')]=qs[_0xc920('0x1e')](_0x1cc9a4[_0xc920('0x34')]['limit']);_0x1aa81e['offset']=qs[_0xc920('0x1d')](_0x1cc9a4[_0xc920('0x34')][_0xc920('0x1d')]);}_0x1aa81e[_0xc920('0x3b')]=qs[_0xc920('0x3c')](_0x1cc9a4[_0xc920('0x34')][_0xc920('0x3c')]);_0x1aa81e['where']=qs[_0xc920('0x36')](_[_0xc920('0x3d')](_0x1cc9a4['query'],_0x15277d[_0xc920('0x36')]),_0x39da19);if(_0x1cc9a4[_0xc920('0x34')][_0xc920('0x3e')]){_0x1aa81e[_0xc920('0x3f')]=_['merge'](_0x1aa81e[_0xc920('0x3f')],{'$or':_[_0xc920('0x2e')](_0x39da19,function(_0x9fe36){if(_0x9fe36['type']!==_0xc920('0x40')){var _0x244b35={};_0x244b35[_0x9fe36[_0xc920('0x2b')]]={'$like':'%'+_0x1cc9a4[_0xc920('0x34')][_0xc920('0x3e')]+'%'};return _0x244b35;}})});}_0x1aa81e=_[_0xc920('0x41')]({},_0x1aa81e,_0x1cc9a4['options']);var _0xdab3cd={'where':_0x1aa81e[_0xc920('0x3f')]};return db[_0xc920('0x2f')]['count'](_0xdab3cd)[_0xc920('0x24')](function(_0x4f9012){_0x460f59[_0xc920('0x1c')]=_0x4f9012;if(_0x1cc9a4['query'][_0xc920('0x42')]){_0x1aa81e[_0xc920('0x43')]=[{'all':!![]}];}return db[_0xc920('0x2f')][_0xc920('0x44')](_0x1aa81e);})['then'](function(_0x4a9f35){_0x460f59[_0xc920('0x45')]=_0x4a9f35;return _0x460f59;})[_0xc920('0x24')](respondWithFilteredResult(_0x7e379f,_0x1aa81e))['catch'](handleError(_0x7e379f,null));};exports[_0xc920('0x46')]=function(_0x48ef00,_0x28d974){var _0x2dcaf6={'raw':!![],'where':{'id':_0x48ef00[_0xc920('0x47')]['id']}},_0x5ed2c2={};_0x5ed2c2[_0xc920('0x33')]=_[_0xc920('0x35')](db['Sound'][_0xc920('0x30')]);_0x5ed2c2[_0xc920('0x34')]=_[_0xc920('0x35')](_0x48ef00[_0xc920('0x34')]);_0x5ed2c2[_0xc920('0x36')]=_[_0xc920('0x48')](_0x5ed2c2[_0xc920('0x33')],_0x5ed2c2[_0xc920('0x34')]);_0x2dcaf6[_0xc920('0x37')]=_[_0xc920('0x48')](_0x5ed2c2[_0xc920('0x33')],qs[_0xc920('0x38')](_0x48ef00[_0xc920('0x34')][_0xc920('0x38')]));_0x2dcaf6['attributes']=_0x2dcaf6[_0xc920('0x37')][_0xc920('0x39')]?_0x2dcaf6[_0xc920('0x37')]:_0x5ed2c2[_0xc920('0x33')];if(_0x48ef00['query'][_0xc920('0x42')]){_0x2dcaf6['include']=[{'all':!![]}];}_0x2dcaf6=_[_0xc920('0x41')]({},_0x2dcaf6,_0x48ef00['options']);return db['Sound'][_0xc920('0x49')](_0x2dcaf6)[_0xc920('0x24')](handleEntityNotFound(_0x28d974,null))[_0xc920('0x24')](respondWithResult(_0x28d974,null))[_0xc920('0x4a')](handleError(_0x28d974,null));};exports[_0xc920('0x4b')]=function(_0x548d46,_0x267f06,_0x593f72){return db[_0xc920('0x2f')][_0xc920('0x49')]({'where':{'id':_0x548d46[_0xc920('0x47')]['id']},'attributes':[_0xc920('0x2b'),_0xc920('0x4c'),_0xc920('0x4d')],'raw':!![]})[_0xc920('0x24')](handleEntityNotFound(_0x267f06,null))[_0xc920('0x24')](function(_0x1d4dba){if(_0x1d4dba){if(!fs['existsSync'](path['join'](config['root'],'server/files/sounds/converted',_0x1d4dba[_0xc920('0x4c')]+'.'+_0x1d4dba[_0xc920('0x4d')]))){throw new db[(_0xc920('0x4e'))][(_0xc920('0x4f'))](_0xc920('0x50'));}return _0x267f06[_0xc920('0x4b')](path[_0xc920('0x51')](config[_0xc920('0x52')],_0xc920('0x53'),util[_0xc920('0x54')](_0xc920('0x55'),_0x1d4dba[_0xc920('0x4c')],_0x1d4dba[_0xc920('0x4d')])),util[_0xc920('0x54')](_0xc920('0x55'),_0x1d4dba[_0xc920('0x2b')],_0x1d4dba[_0xc920('0x4d')]));}return null;})[_0xc920('0x4a')](handleError(_0x267f06,null));};exports[_0xc920('0x56')]=function(_0x468b58,_0x3916bb,_0x30e0aa){var _0x2c431c={'name':path[_0xc920('0x57')](_0x468b58[_0xc920('0x58')][_0xc920('0x59')],path['extname'](_0x468b58[_0xc920('0x58')][_0xc920('0x59')])),'save_name':path['basename'](_0x468b58[_0xc920('0x58')][_0xc920('0x5a')],path[_0xc920('0x5b')](_0x468b58['file'][_0xc920('0x5a')])),'original_format':path['extname'](_0x468b58['file'][_0xc920('0x59')])['substring'](0x1),'converted_format':_0xc920('0x5c')};var _0x33aa49=path['join'](config[_0xc920('0x52')],_0xc920('0x5d'),_0x468b58[_0xc920('0x58')][_0xc920('0x5a')]);var _0x3aad0e=path[_0xc920('0x51')](config[_0xc920('0x52')],_0xc920('0x53'),util[_0xc920('0x54')](_0xc920('0x55'),path[_0xc920('0x57')](_0x468b58[_0xc920('0x58')][_0xc920('0x5a')],path['extname'](_0x468b58[_0xc920('0x58')]['filename'])),_0x2c431c['converted_format']));logger[_0xc920('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x33aa49);logger[_0xc920('0x5e')](_0xc920('0x5f'),_0x3aad0e);try{fs[_0xc920('0x60')](_0x33aa49,parseInt('0777',0x8));var _0x4557c9=sox[_0xc920('0x61')](_0x33aa49,_0x3aad0e,{'sampleRate':0x1f40,'format':_0xc920('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4557c9['on'](_0xc920('0x29'),function(_0x416307){fs[_0xc920('0x62')](_0x33aa49);_0x3916bb['status'](0x1f4)[_0xc920('0x2c')](_0x416307);});_0x4557c9['on']('src',function(_0x268e71){_0x2c431c[_0xc920('0x63')]=isNaN(_0x268e71[_0xc920('0x64')])?null:_0x268e71[_0xc920('0x64')]*0x3e8;_0x2c431c[_0xc920('0x65')]=isNaN(_0x268e71[_0xc920('0x66')])?null:_0x268e71[_0xc920('0x66')];_0x2c431c[_0xc920('0x67')]=isNaN(_0x268e71[_0xc920('0x68')])?null:_0x268e71[_0xc920('0x68')];_0x2c431c[_0xc920('0x69')]=isNaN(_0x268e71[_0xc920('0x6a')])?null:_0x268e71[_0xc920('0x6a')];_0x2c431c[_0xc920('0x6b')]=isNaN(_0x268e71[_0xc920('0x6c')])?null:_0x268e71[_0xc920('0x6c')];});_0x4557c9['on'](_0xc920('0x6d'),function(_0x43028a){_0x2c431c[_0xc920('0x6e')]=isNaN(_0x43028a[_0xc920('0x64')])?null:_0x43028a[_0xc920('0x64')]*0x3e8;_0x2c431c[_0xc920('0x6f')]=isNaN(_0x43028a[_0xc920('0x66')])?null:_0x43028a['sampleCount'];_0x2c431c[_0xc920('0x70')]=isNaN(_0x43028a[_0xc920('0x68')])?null:_0x43028a[_0xc920('0x68')];_0x2c431c[_0xc920('0x71')]=isNaN(_0x43028a[_0xc920('0x6a')])?null:_0x43028a[_0xc920('0x6a')];_0x2c431c[_0xc920('0x72')]=isNaN(_0x43028a[_0xc920('0x6c')])?null:_0x43028a[_0xc920('0x6c')];});_0x4557c9['on'](_0xc920('0x19'),function(){fs[_0xc920('0x60')](_0x3aad0e,parseInt(_0xc920('0x73'),0x8));return db[_0xc920('0x2f')][_0xc920('0x56')](_0x2c431c)[_0xc920('0x24')](function(_0x208444){var _0x4c3885={'role':_0x468b58['body']['role'],'userProfileId':_0x468b58[_0xc920('0x74')][_0xc920('0x75')]};if(!_0x4c3885)throw new Error(_0xc920('0x76'));if(_0x4c3885['role']==='user'){var _0xea67b8=_0x208444[_0xc920('0x26')]({'plain':!![]});return db[_0xc920('0x77')]['find']({'where':{'name':_0xc920('0x27'),'userProfileId':_0x4c3885[_0xc920('0x75')]},'raw':!![]})[_0xc920('0x24')](function(_0x4eb6cd){if(_0x4eb6cd&&_0x4eb6cd[_0xc920('0x78')]===0x0){return db['UserProfileResource'][_0xc920('0x56')]({'name':_0xea67b8['name'],'resourceId':_0xea67b8['id'],'type':_0x4eb6cd[_0xc920('0x2b')],'sectionId':_0x4eb6cd['id']},{})['then'](function(){return _0x208444;});}else{return _0x208444;}})['catch'](function(_0x4bc580){logger[_0xc920('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bc580);throw _0x4bc580;});}return _0x208444;})[_0xc920('0x24')](respondWithResult(_0x3916bb,null))[_0xc920('0x4a')](handleError(_0x3916bb,null));});_0x4557c9[_0xc920('0x79')]();}catch(_0x118ebb){_0x3916bb[_0xc920('0x18')](0x1f4)[_0xc920('0x2c')](_0x118ebb);}};exports['update']=function(_0x5cb51f,_0x531935,_0x3fffb1){return db[_0xc920('0x2f')][_0xc920('0x49')]({'where':{'id':_0x5cb51f[_0xc920('0x47')]['id']}})['then'](handleEntityNotFound(_0x531935,null))[_0xc920('0x24')](saveUpdates(_[_0xc920('0x3d')](_0x5cb51f[_0xc920('0x74')],[_0xc920('0x2b'),_0xc920('0x7a')]),null))[_0xc920('0x24')](respondWithResult(_0x531935,null))[_0xc920('0x4a')](handleError(_0x531935,null));};exports['delete']=function(_0x4a586a,_0x2e0fa2,_0x1296ee){return db['Sound'][_0xc920('0x49')]({'where':{'id':_0x4a586a[_0xc920('0x47')]['id']}})[_0xc920('0x24')](function(_0x4adfa2){if(_0x4adfa2){return _0x4adfa2[_0xc920('0x25')]();}})[_0xc920('0x24')](function(_0x3d2950){var _0x317d03=path[_0xc920('0x51')](config['root'],_0xc920('0x5d'),util[_0xc920('0x54')](_0xc920('0x55'),_0x3d2950[_0xc920('0x4c')],_0x3d2950['original_format']));var _0x418471=path[_0xc920('0x51')](config[_0xc920('0x52')],_0xc920('0x53'),util[_0xc920('0x54')]('%s.%s',_0x3d2950[_0xc920('0x4c')],_0x3d2950[_0xc920('0x4d')]));fs[_0xc920('0x62')](_0x317d03);fs[_0xc920('0x62')](_0x418471);return _0x3d2950;})['then'](function(_0x4154ed){if(_0x4154ed){return _0x2e0fa2[_0xc920('0x18')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2e0fa2,null))[_0xc920('0x4a')](handleError(_0x2e0fa2,null));}; \ No newline at end of file +var _0xd450=['sox','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','Sound','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','download','find','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','file','basename','filename','extname','originalname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','send','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','start','description','delete','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0xd450,0x176));var _0x0d45=function(_0x24a31f,_0x4e7a76){_0x24a31f=_0x24a31f-0x0;var _0x296f4a=_0xd450[_0x24a31f];return _0x296f4a;};'use strict';var emlformat=require(_0x0d45('0x0'));var rimraf=require(_0x0d45('0x1'));var zipdir=require(_0x0d45('0x2'));var jsonpatch=require(_0x0d45('0x3'));var rp=require(_0x0d45('0x4'));var moment=require(_0x0d45('0x5'));var BPromise=require(_0x0d45('0x6'));var Mustache=require(_0x0d45('0x7'));var util=require(_0x0d45('0x8'));var path=require(_0x0d45('0x9'));var sox=require(_0x0d45('0xa'));var csv=require('to-csv');var ejs=require(_0x0d45('0xb'));var fs=require('fs');var fs_extra=require(_0x0d45('0xc'));var _=require(_0x0d45('0xd'));var squel=require(_0x0d45('0xe'));var crypto=require(_0x0d45('0xf'));var jsforce=require(_0x0d45('0x10'));var deskjs=require(_0x0d45('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0d45('0x12'));var Papa=require(_0x0d45('0x13'));var Redis=require('ioredis');var authService=require(_0x0d45('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0d45('0x15'));var hardwareService=require(_0x0d45('0x16'));var logger=require(_0x0d45('0x17'))(_0x0d45('0x18'));var utils=require(_0x0d45('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0d45('0x1a'))['db'];function respondWithStatusCode(_0x41f89a,_0x4cbd62){_0x4cbd62=_0x4cbd62||0xcc;return function(_0xd3970){if(_0xd3970){return _0x41f89a[_0x0d45('0x1b')](_0x4cbd62);}return _0x41f89a[_0x0d45('0x1c')](_0x4cbd62)['end']();};}function respondWithResult(_0x126248,_0x7d638a){_0x7d638a=_0x7d638a||0xc8;return function(_0x229494){if(_0x229494){return _0x126248[_0x0d45('0x1c')](_0x7d638a)[_0x0d45('0x1d')](_0x229494);}};}function respondWithFilteredResult(_0xf784ed,_0x265b33){return function(_0x28d2f2){if(_0x28d2f2){var _0x1b5ae0=typeof _0x265b33[_0x0d45('0x1e')]===_0x0d45('0x1f')&&typeof _0x265b33[_0x0d45('0x20')]==='undefined';var _0xae8e8b=_0x28d2f2[_0x0d45('0x21')];var _0x3f54d1=_0x1b5ae0?0x0:_0x265b33[_0x0d45('0x1e')];var _0x1c9049=_0x1b5ae0?_0x28d2f2['count']:_0x265b33[_0x0d45('0x1e')]+_0x265b33[_0x0d45('0x20')];var _0x28f3b7;if(_0x1c9049>=_0xae8e8b){_0x1c9049=_0xae8e8b;_0x28f3b7=0xc8;}else{_0x28f3b7=0xce;}_0xf784ed[_0x0d45('0x1c')](_0x28f3b7);return _0xf784ed[_0x0d45('0x22')](_0x0d45('0x23'),_0x3f54d1+'-'+_0x1c9049+'/'+_0xae8e8b)[_0x0d45('0x1d')](_0x28d2f2);}return null;};}function patchUpdates(_0x2c8065){return function(_0x382a54){try{jsonpatch[_0x0d45('0x24')](_0x382a54,_0x2c8065,!![]);}catch(_0x34b569){return BPromise[_0x0d45('0x25')](_0x34b569);}return _0x382a54['save']();};}function saveUpdates(_0x40e9e6,_0x5f3d1b){return function(_0x2b6c69){if(_0x2b6c69){return _0x2b6c69[_0x0d45('0x26')](_0x40e9e6)[_0x0d45('0x27')](function(_0xb91718){return _0xb91718;});}return null;};}function removeEntity(_0x3f3327,_0x4bf64c){return function(_0x29acb0){if(_0x29acb0){return _0x29acb0['destroy']()['then'](function(){var _0x30bfaf=_0x29acb0[_0x0d45('0x28')]({'plain':!![]});var _0x410db7=_0x0d45('0x29');return db[_0x0d45('0x2a')][_0x0d45('0x2b')]({'where':{'type':_0x410db7,'resourceId':_0x30bfaf['id']}})['then'](function(){return _0x29acb0;});})[_0x0d45('0x27')](function(){_0x3f3327[_0x0d45('0x1c')](0xcc)[_0x0d45('0x2c')]();});}};}function handleEntityNotFound(_0x2a0c53,_0x43e85b){return function(_0x841d5a){if(!_0x841d5a){_0x2a0c53[_0x0d45('0x1b')](0x194);}return _0x841d5a;};}function handleError(_0x2025b6,_0xd0d3a1){_0xd0d3a1=_0xd0d3a1||0x1f4;return function(_0x585ead){logger[_0x0d45('0x2d')](_0x585ead[_0x0d45('0x2e')]);if(_0x585ead[_0x0d45('0x2f')]){delete _0x585ead[_0x0d45('0x2f')];}_0x2025b6['status'](_0xd0d3a1)['send'](_0x585ead);};}exports['index']=function(_0x28f061,_0x2c8c1c){var _0x4dd195={},_0x3961ee={},_0x1a54b0={'count':0x0,'rows':[]};var _0x40ff42=_['map'](db[_0x0d45('0x30')]['rawAttributes'],function(_0x4b716f){return{'name':_0x4b716f[_0x0d45('0x31')],'type':_0x4b716f[_0x0d45('0x32')][_0x0d45('0x33')]};});_0x3961ee[_0x0d45('0x34')]=_[_0x0d45('0x35')](_0x40ff42,'name');_0x3961ee[_0x0d45('0x36')]=_[_0x0d45('0x37')](_0x28f061[_0x0d45('0x36')]);_0x3961ee[_0x0d45('0x38')]=_[_0x0d45('0x39')](_0x3961ee[_0x0d45('0x34')],_0x3961ee[_0x0d45('0x36')]);_0x4dd195[_0x0d45('0x3a')]=_[_0x0d45('0x39')](_0x3961ee[_0x0d45('0x34')],qs[_0x0d45('0x3b')](_0x28f061[_0x0d45('0x36')][_0x0d45('0x3b')]));_0x4dd195[_0x0d45('0x3a')]=_0x4dd195[_0x0d45('0x3a')]['length']?_0x4dd195['attributes']:_0x3961ee['model'];if(!_0x28f061[_0x0d45('0x36')][_0x0d45('0x3c')](_0x0d45('0x3d'))){_0x4dd195[_0x0d45('0x20')]=qs[_0x0d45('0x20')](_0x28f061[_0x0d45('0x36')][_0x0d45('0x20')]);_0x4dd195[_0x0d45('0x1e')]=qs[_0x0d45('0x1e')](_0x28f061['query'][_0x0d45('0x1e')]);}_0x4dd195['order']=qs[_0x0d45('0x3e')](_0x28f061['query']['sort']);_0x4dd195[_0x0d45('0x3f')]=qs[_0x0d45('0x38')](_[_0x0d45('0x40')](_0x28f061[_0x0d45('0x36')],_0x3961ee[_0x0d45('0x38')]),_0x40ff42);if(_0x28f061[_0x0d45('0x36')][_0x0d45('0x41')]){_0x4dd195['where']=_[_0x0d45('0x42')](_0x4dd195[_0x0d45('0x3f')],{'$or':_[_0x0d45('0x35')](_0x40ff42,function(_0x3efa0b){if(_0x3efa0b['type']!==_0x0d45('0x43')){var _0x1a2eb5={};_0x1a2eb5[_0x3efa0b[_0x0d45('0x2f')]]={'$like':'%'+_0x28f061[_0x0d45('0x36')][_0x0d45('0x41')]+'%'};return _0x1a2eb5;}})});}_0x4dd195=_[_0x0d45('0x42')]({},_0x4dd195,_0x28f061[_0x0d45('0x44')]);var _0x574fe8={'where':_0x4dd195[_0x0d45('0x3f')]};return db['Sound'][_0x0d45('0x21')](_0x574fe8)['then'](function(_0x22a021){_0x1a54b0['count']=_0x22a021;if(_0x28f061[_0x0d45('0x36')]['includeAll']){_0x4dd195[_0x0d45('0x45')]=[{'all':!![]}];}return db[_0x0d45('0x30')][_0x0d45('0x46')](_0x4dd195);})['then'](function(_0x193e22){_0x1a54b0[_0x0d45('0x47')]=_0x193e22;return _0x1a54b0;})['then'](respondWithFilteredResult(_0x2c8c1c,_0x4dd195))[_0x0d45('0x48')](handleError(_0x2c8c1c,null));};exports[_0x0d45('0x49')]=function(_0x1c0e4a,_0x1a911f){var _0xd91729={'raw':!![],'where':{'id':_0x1c0e4a['params']['id']}},_0x24c9ca={};_0x24c9ca[_0x0d45('0x34')]=_[_0x0d45('0x37')](db[_0x0d45('0x30')][_0x0d45('0x4a')]);_0x24c9ca['query']=_[_0x0d45('0x37')](_0x1c0e4a[_0x0d45('0x36')]);_0x24c9ca['filters']=_[_0x0d45('0x39')](_0x24c9ca[_0x0d45('0x34')],_0x24c9ca[_0x0d45('0x36')]);_0xd91729[_0x0d45('0x3a')]=_['intersection'](_0x24c9ca[_0x0d45('0x34')],qs[_0x0d45('0x3b')](_0x1c0e4a[_0x0d45('0x36')][_0x0d45('0x3b')]));_0xd91729['attributes']=_0xd91729['attributes'][_0x0d45('0x4b')]?_0xd91729[_0x0d45('0x3a')]:_0x24c9ca[_0x0d45('0x34')];if(_0x1c0e4a['query']['includeAll']){_0xd91729[_0x0d45('0x45')]=[{'all':!![]}];}_0xd91729=_[_0x0d45('0x42')]({},_0xd91729,_0x1c0e4a['options']);return db[_0x0d45('0x30')]['find'](_0xd91729)[_0x0d45('0x27')](handleEntityNotFound(_0x1a911f,null))[_0x0d45('0x27')](respondWithResult(_0x1a911f,null))[_0x0d45('0x48')](handleError(_0x1a911f,null));};exports[_0x0d45('0x4c')]=function(_0x31ff51,_0x55ef34,_0x555279){return db[_0x0d45('0x30')][_0x0d45('0x4d')]({'where':{'id':_0x31ff51[_0x0d45('0x4e')]['id']},'attributes':['name',_0x0d45('0x4f'),_0x0d45('0x50')],'raw':!![]})[_0x0d45('0x27')](handleEntityNotFound(_0x55ef34,null))[_0x0d45('0x27')](function(_0x15b382){if(_0x15b382){if(!fs[_0x0d45('0x51')](path[_0x0d45('0x52')](config[_0x0d45('0x53')],_0x0d45('0x54'),_0x15b382['save_name']+'.'+_0x15b382[_0x0d45('0x50')]))){throw new db[(_0x0d45('0x55'))][(_0x0d45('0x56'))](_0x0d45('0x57'));}return _0x55ef34['download'](path[_0x0d45('0x52')](config[_0x0d45('0x53')],_0x0d45('0x54'),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x15b382[_0x0d45('0x4f')],_0x15b382[_0x0d45('0x50')])),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x15b382['name'],_0x15b382[_0x0d45('0x50')]));}return null;})[_0x0d45('0x48')](handleError(_0x55ef34,null));};exports['create']=function(_0x542748,_0x4c549e,_0x17738e){var _0x4e37e7={'name':path['basename'](_0x542748[_0x0d45('0x5a')]['originalname'],path['extname'](_0x542748[_0x0d45('0x5a')]['originalname'])),'save_name':path[_0x0d45('0x5b')](_0x542748[_0x0d45('0x5a')][_0x0d45('0x5c')],path[_0x0d45('0x5d')](_0x542748[_0x0d45('0x5a')]['filename'])),'original_format':path[_0x0d45('0x5d')](_0x542748[_0x0d45('0x5a')][_0x0d45('0x5e')])['substring'](0x1),'converted_format':_0x0d45('0x5f')};var _0x201415=path[_0x0d45('0x52')](config[_0x0d45('0x53')],_0x0d45('0x60'),_0x542748[_0x0d45('0x5a')][_0x0d45('0x5c')]);var _0x15c314=path[_0x0d45('0x52')](config['root'],_0x0d45('0x54'),util[_0x0d45('0x58')]('%s.%s',path['basename'](_0x542748['file'][_0x0d45('0x5c')],path[_0x0d45('0x5d')](_0x542748[_0x0d45('0x5a')][_0x0d45('0x5c')])),_0x4e37e7['converted_format']));logger[_0x0d45('0x61')](_0x0d45('0x62'),_0x201415);logger[_0x0d45('0x61')]('Sound\x20upload\x20destination:\x20%s',_0x15c314);try{fs['chmodSync'](_0x201415,parseInt(_0x0d45('0x63'),0x8));var _0x495460=sox[_0x0d45('0x64')](_0x201415,_0x15c314,{'sampleRate':0x1f40,'format':_0x0d45('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x495460['on'](_0x0d45('0x2d'),function(_0x247689){fs['unlinkSync'](_0x201415);_0x4c549e[_0x0d45('0x1c')](0x1f4)[_0x0d45('0x65')](_0x247689);});_0x495460['on'](_0x0d45('0x66'),function(_0x44c5b3){_0x4e37e7[_0x0d45('0x67')]=isNaN(_0x44c5b3[_0x0d45('0x68')])?null:_0x44c5b3[_0x0d45('0x68')]*0x3e8;_0x4e37e7['original_sampleCount']=isNaN(_0x44c5b3[_0x0d45('0x69')])?null:_0x44c5b3[_0x0d45('0x69')];_0x4e37e7['original_channelCount']=isNaN(_0x44c5b3[_0x0d45('0x6a')])?null:_0x44c5b3[_0x0d45('0x6a')];_0x4e37e7[_0x0d45('0x6b')]=isNaN(_0x44c5b3[_0x0d45('0x6c')])?null:_0x44c5b3[_0x0d45('0x6c')];_0x4e37e7[_0x0d45('0x6d')]=isNaN(_0x44c5b3[_0x0d45('0x6e')])?null:_0x44c5b3['sampleRate'];});_0x495460['on'](_0x0d45('0x6f'),function(_0x1d6d46){_0x4e37e7['converted_duration']=isNaN(_0x1d6d46[_0x0d45('0x68')])?null:_0x1d6d46[_0x0d45('0x68')]*0x3e8;_0x4e37e7[_0x0d45('0x70')]=isNaN(_0x1d6d46['sampleCount'])?null:_0x1d6d46['sampleCount'];_0x4e37e7[_0x0d45('0x71')]=isNaN(_0x1d6d46[_0x0d45('0x6a')])?null:_0x1d6d46[_0x0d45('0x6a')];_0x4e37e7[_0x0d45('0x72')]=isNaN(_0x1d6d46[_0x0d45('0x6c')])?null:_0x1d6d46['bitRate'];_0x4e37e7[_0x0d45('0x73')]=isNaN(_0x1d6d46[_0x0d45('0x6e')])?null:_0x1d6d46['sampleRate'];});_0x495460['on'](_0x0d45('0x2c'),function(){fs[_0x0d45('0x74')](_0x15c314,parseInt(_0x0d45('0x63'),0x8));return db[_0x0d45('0x30')][_0x0d45('0x75')](_0x4e37e7)[_0x0d45('0x27')](function(_0x447568){var _0x3a9d65={'role':_0x542748[_0x0d45('0x76')][_0x0d45('0x77')],'userProfileId':_0x542748['body'][_0x0d45('0x78')]};if(!_0x3a9d65)throw new Error(_0x0d45('0x79'));if(_0x3a9d65[_0x0d45('0x77')]===_0x0d45('0x7a')){var _0x48128a=_0x447568['get']({'plain':!![]});return db['UserProfileSection'][_0x0d45('0x4d')]({'where':{'name':_0x0d45('0x29'),'userProfileId':_0x3a9d65[_0x0d45('0x78')]},'raw':!![]})[_0x0d45('0x27')](function(_0x35caca){if(_0x35caca&&_0x35caca[_0x0d45('0x7b')]===0x0){return db[_0x0d45('0x2a')][_0x0d45('0x75')]({'name':_0x48128a[_0x0d45('0x2f')],'resourceId':_0x48128a['id'],'type':_0x35caca[_0x0d45('0x2f')],'sectionId':_0x35caca['id']},{})[_0x0d45('0x27')](function(){return _0x447568;});}else{return _0x447568;}})['catch'](function(_0x1907ba){logger[_0x0d45('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1907ba);throw _0x1907ba;});}return _0x447568;})[_0x0d45('0x27')](respondWithResult(_0x4c549e,null))[_0x0d45('0x48')](handleError(_0x4c549e,null));});_0x495460[_0x0d45('0x7c')]();}catch(_0xd8f47b){_0x4c549e[_0x0d45('0x1c')](0x1f4)[_0x0d45('0x65')](_0xd8f47b);}};exports[_0x0d45('0x26')]=function(_0x366ecb,_0x4a0369,_0x46eb87){return db['Sound'][_0x0d45('0x4d')]({'where':{'id':_0x366ecb['params']['id']}})[_0x0d45('0x27')](handleEntityNotFound(_0x4a0369,null))[_0x0d45('0x27')](saveUpdates(_[_0x0d45('0x40')](_0x366ecb[_0x0d45('0x76')],['name',_0x0d45('0x7d')]),null))[_0x0d45('0x27')](respondWithResult(_0x4a0369,null))[_0x0d45('0x48')](handleError(_0x4a0369,null));};exports[_0x0d45('0x7e')]=function(_0x3004fd,_0x1455a5,_0x1387f3){return db[_0x0d45('0x30')][_0x0d45('0x4d')]({'where':{'id':_0x3004fd[_0x0d45('0x4e')]['id']}})[_0x0d45('0x27')](function(_0x51b6a5){if(_0x51b6a5){return _0x51b6a5['destroy']();}})['then'](function(_0x17f566){var _0x533b19=path['join'](config[_0x0d45('0x53')],_0x0d45('0x60'),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x17f566['save_name'],_0x17f566['original_format']));var _0x46eeb9=path[_0x0d45('0x52')](config['root'],_0x0d45('0x54'),util[_0x0d45('0x58')](_0x0d45('0x59'),_0x17f566[_0x0d45('0x4f')],_0x17f566['converted_format']));fs[_0x0d45('0x7f')](_0x533b19);fs[_0x0d45('0x7f')](_0x46eeb9);return _0x17f566;})['then'](function(_0xd1ebe0){if(_0xd1ebe0){return _0x1455a5['status'](0xcc)['end']();}})[_0x0d45('0x27')](handleEntityNotFound(_0x1455a5,null))[_0x0d45('0x48')](handleError(_0x1455a5,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ecad4af..2bca89b 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 _0xd062=['../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x440b60,_0xc49fae){var _0x1fd5d4=function(_0x45045f){while(--_0x45045f){_0x440b60['push'](_0x440b60['shift']());}};_0x1fd5d4(++_0xc49fae);}(_0xd062,0x1d9));var _0x2d06=function(_0x46cb62,_0x3fbbb1){_0x46cb62=_0x46cb62-0x0;var _0x4349a9=_0xd062[_0x46cb62];return _0x4349a9;};'use strict';var _=require(_0x2d06('0x0'));var util=require(_0x2d06('0x1'));var logger=require(_0x2d06('0x2'))(_0x2d06('0x3'));var moment=require(_0x2d06('0x4'));var BPromise=require(_0x2d06('0x5'));var rp=require(_0x2d06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d06('0x7'));var config=require(_0x2d06('0x8'));var attributes=require(_0x2d06('0x9'));module['exports']=function(_0x5b5d3d,_0x4922cb){return _0x5b5d3d[_0x2d06('0xa')](_0x2d06('0xb'),attributes,{'tableName':_0x2d06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb84=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','util','api'];(function(_0x195983,_0x9845c1){var _0xc77367=function(_0x23cea4){while(--_0x23cea4){_0x195983['push'](_0x195983['shift']());}};_0xc77367(++_0x9845c1);}(_0xcb84,0x1ea));var _0x4cb8=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xcb84[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require(_0x4cb8('0x0'));var logger=require('../../config/logger')(_0x4cb8('0x1'));var moment=require(_0x4cb8('0x2'));var BPromise=require(_0x4cb8('0x3'));var rp=require(_0x4cb8('0x4'));var fs=require('fs');var path=require(_0x4cb8('0x5'));var rimraf=require(_0x4cb8('0x6'));var config=require(_0x4cb8('0x7'));var attributes=require(_0x4cb8('0x8'));module['exports']=function(_0x247705,_0x3699cc){return _0x247705[_0x4cb8('0x9')](_0x4cb8('0xa'),attributes,{'tableName':_0x4cb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index ca4725a..5f07aca 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 _0x40bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSound','Sound','find','options','where','include','map','model','attributes','debug','lodash'];(function(_0x2f9d7c,_0x35a2ba){var _0x5aa2a5=function(_0x6ad1c6){while(--_0x6ad1c6){_0x2f9d7c['push'](_0x2f9d7c['shift']());}};_0x5aa2a5(++_0x35a2ba);}(_0x40bd,0x13f));var _0xd40b=function(_0x37aba4,_0xf6ee97){_0x37aba4=_0x37aba4-0x0;var _0x4df590=_0x40bd[_0x37aba4];return _0x4df590;};'use strict';var _=require(_0xd40b('0x0'));var util=require(_0xd40b('0x1'));var moment=require(_0xd40b('0x2'));var BPromise=require(_0xd40b('0x3'));var rs=require(_0xd40b('0x4'));var fs=require('fs');var Redis=require(_0xd40b('0x5'));var db=require(_0xd40b('0x6'))['db'];var utils=require(_0xd40b('0x7'));var logger=require('../../config/logger')(_0xd40b('0x8'));var config=require(_0xd40b('0x9'));var jayson=require(_0xd40b('0xa'));var client=jayson[_0xd40b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4089e0,_0x3bf7af,_0x1a7dbd){return new BPromise(function(_0xd5b856,_0x159bc8){return client['request'](_0x4089e0,_0x1a7dbd)[_0xd40b('0xc')](function(_0x1881bf){logger[_0xd40b('0xd')](_0xd40b('0xe'),_0x3bf7af,'request\x20sent');logger['debug'](_0xd40b('0xf'),_0x3bf7af,_0xd40b('0x10'),JSON[_0xd40b('0x11')](_0x1881bf));if(_0x1881bf[_0xd40b('0x12')]){if(_0x1881bf[_0xd40b('0x12')]['code']===0x1f4){logger[_0xd40b('0x12')](_0xd40b('0xe'),_0x3bf7af,_0x1881bf[_0xd40b('0x12')][_0xd40b('0x13')]);return _0x159bc8(_0x1881bf[_0xd40b('0x12')][_0xd40b('0x13')]);}logger[_0xd40b('0x12')](_0xd40b('0xe'),_0x3bf7af,_0x1881bf[_0xd40b('0x12')]['message']);return _0xd5b856(_0x1881bf[_0xd40b('0x12')][_0xd40b('0x13')]);}else{logger[_0xd40b('0xd')](_0xd40b('0xe'),_0x3bf7af,_0xd40b('0x10'));_0xd5b856(_0x1881bf[_0xd40b('0x14')][_0xd40b('0x13')]);}})[_0xd40b('0x15')](function(_0x1392b6){logger[_0xd40b('0x12')](_0xd40b('0xe'),_0x3bf7af,_0x1392b6);_0x159bc8(_0x1392b6);});});}exports[_0xd40b('0x16')]=function(_0x15c0dd){var _0x7a8840=this;return new Promise(function(_0x9cf23b,_0x4bd08d){return db[_0xd40b('0x17')][_0xd40b('0x18')]({'raw':_0x15c0dd[_0xd40b('0x19')]?_0x15c0dd[_0xd40b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x15c0dd[_0xd40b('0x19')]?_0x15c0dd[_0xd40b('0x19')][_0xd40b('0x1a')]||null:null,'attributes':_0x15c0dd[_0xd40b('0x19')]?_0x15c0dd['options']['attributes']||null:null,'include':_0x15c0dd[_0xd40b('0x19')]?_0x15c0dd['options'][_0xd40b('0x1b')]?_[_0xd40b('0x1c')](_0x15c0dd[_0xd40b('0x19')][_0xd40b('0x1b')],function(_0x45f967){return{'model':db[_0x45f967[_0xd40b('0x1d')]],'as':_0x45f967['as'],'attributes':_0x45f967[_0xd40b('0x1e')],'include':_0x45f967[_0xd40b('0x1b')]?_[_0xd40b('0x1c')](_0x45f967[_0xd40b('0x1b')],function(_0x2c3e9d){return{'model':db[_0x2c3e9d['model']],'as':_0x2c3e9d['as'],'attributes':_0x2c3e9d[_0xd40b('0x1e')],'include':_0x2c3e9d[_0xd40b('0x1b')]?_[_0xd40b('0x1c')](_0x2c3e9d[_0xd40b('0x1b')],function(_0x455151){return{'model':db[_0x455151[_0xd40b('0x1d')]],'as':_0x455151['as'],'attributes':_0x455151[_0xd40b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd40b('0xc')](function(_0x36a66f){logger[_0xd40b('0xd')](_0xd40b('0x16'),_0x15c0dd);logger[_0xd40b('0x1f')](_0xd40b('0x16'),_0x15c0dd,JSON[_0xd40b('0x11')](_0x36a66f));_0x9cf23b(_0x36a66f);})['catch'](function(_0x35b04f){logger[_0xd40b('0x12')](_0xd40b('0x16'),_0x35b04f[_0xd40b('0x13')],_0x15c0dd);_0x4bd08d(_0x7a8840[_0xd40b('0x12')](0x1f4,_0x35b04f[_0xd40b('0x13')]));});});}; \ No newline at end of file +var _0x5417=['http','request','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','info','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x5417,0x137));var _0x7541=function(_0x2c90d4,_0x5abd07){_0x2c90d4=_0x2c90d4-0x0;var _0x1cbdfc=_0x5417[_0x2c90d4];return _0x1cbdfc;};'use strict';var _=require('lodash');var util=require(_0x7541('0x0'));var moment=require(_0x7541('0x1'));var BPromise=require(_0x7541('0x2'));var rs=require(_0x7541('0x3'));var fs=require('fs');var Redis=require(_0x7541('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7541('0x5'))('rpc');var config=require(_0x7541('0x6'));var jayson=require(_0x7541('0x7'));var client=jayson[_0x7541('0x8')][_0x7541('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58162b,_0xb6d109,_0xe57696){return new BPromise(function(_0x31aafc,_0x122144){return client[_0x7541('0xa')](_0x58162b,_0xe57696)[_0x7541('0xb')](function(_0x1a6bf3){logger['info'](_0x7541('0xc'),_0xb6d109,_0x7541('0xd'));logger['debug'](_0x7541('0xe'),_0xb6d109,'request\x20sent',JSON[_0x7541('0xf')](_0x1a6bf3));if(_0x1a6bf3['error']){if(_0x1a6bf3['error'][_0x7541('0x10')]===0x1f4){logger[_0x7541('0x11')](_0x7541('0xc'),_0xb6d109,_0x1a6bf3[_0x7541('0x11')][_0x7541('0x12')]);return _0x122144(_0x1a6bf3[_0x7541('0x11')]['message']);}logger[_0x7541('0x11')]('Sound,\x20%s,\x20%s',_0xb6d109,_0x1a6bf3[_0x7541('0x11')][_0x7541('0x12')]);return _0x31aafc(_0x1a6bf3[_0x7541('0x11')][_0x7541('0x12')]);}else{logger['info'](_0x7541('0xc'),_0xb6d109,_0x7541('0xd'));_0x31aafc(_0x1a6bf3[_0x7541('0x13')][_0x7541('0x12')]);}})[_0x7541('0x14')](function(_0x4ca9e8){logger['error']('Sound,\x20%s,\x20%s',_0xb6d109,_0x4ca9e8);_0x122144(_0x4ca9e8);});});}exports[_0x7541('0x15')]=function(_0x29c2f4){var _0x48d898=this;return new Promise(function(_0x4439e2,_0x26f835){return db[_0x7541('0x16')][_0x7541('0x17')]({'raw':_0x29c2f4[_0x7541('0x18')]?_0x29c2f4[_0x7541('0x18')][_0x7541('0x19')]===undefined?!![]:![]:!![],'where':_0x29c2f4[_0x7541('0x18')]?_0x29c2f4[_0x7541('0x18')]['where']||null:null,'attributes':_0x29c2f4['options']?_0x29c2f4[_0x7541('0x18')][_0x7541('0x1a')]||null:null,'include':_0x29c2f4[_0x7541('0x18')]?_0x29c2f4[_0x7541('0x18')][_0x7541('0x1b')]?_[_0x7541('0x1c')](_0x29c2f4[_0x7541('0x18')][_0x7541('0x1b')],function(_0x11fc35){return{'model':db[_0x11fc35[_0x7541('0x1d')]],'as':_0x11fc35['as'],'attributes':_0x11fc35[_0x7541('0x1a')],'include':_0x11fc35[_0x7541('0x1b')]?_['map'](_0x11fc35[_0x7541('0x1b')],function(_0x55bcd0){return{'model':db[_0x55bcd0['model']],'as':_0x55bcd0['as'],'attributes':_0x55bcd0[_0x7541('0x1a')],'include':_0x55bcd0[_0x7541('0x1b')]?_[_0x7541('0x1c')](_0x55bcd0[_0x7541('0x1b')],function(_0x1ec2d8){return{'model':db[_0x1ec2d8[_0x7541('0x1d')]],'as':_0x1ec2d8['as'],'attributes':_0x1ec2d8[_0x7541('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7541('0xb')](function(_0x3b21d9){logger[_0x7541('0x1e')](_0x7541('0x15'),_0x29c2f4);logger[_0x7541('0x1f')](_0x7541('0x15'),_0x29c2f4,JSON[_0x7541('0xf')](_0x3b21d9));_0x4439e2(_0x3b21d9);})[_0x7541('0x14')](function(_0x8ea0b0){logger[_0x7541('0x11')]('ShowSound',_0x8ea0b0['message'],_0x29c2f4);_0x26f835(_0x48d898[_0x7541('0x11')](0x1f4,_0x8ea0b0[_0x7541('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 44acdbd..a8903d7 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x9ac89b,_0x25b61d){var _0x40da74=function(_0x2643a2){while(--_0x2643a2){_0x9ac89b['push'](_0x9ac89b['shift']());}};_0x40da74(++_0x25b61d);}(_0x4fc2,0x111));var _0x24fc=function(_0xd02c35,_0x4be949){_0xd02c35=_0xd02c35-0x0;var _0x459eb0=_0x4fc2[_0xd02c35];return _0x459eb0;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x38550,_0x1e36a6){var _0x556e2c=function(_0x20777a){while(--_0x20777a){_0x38550['push'](_0x38550['shift']());}};_0x556e2c(++_0x1e36a6);}(_0xda2d,0x102));var _0xdda2=function(_0x37855c,_0x48abdd){_0x37855c=_0x37855c-0x0;var _0x2cb242=_0xda2d[_0x37855c];return _0x2cb242;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1cb439e..f6129fe 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 _0x26f3=['sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x26f3,0x12c));var _0x326f=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0x26f3[_0x208d75];return _0x382d27;};'use strict';var Sequelize=require(_0x326f('0x0'));module[_0x326f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x326f('0x2')](_0x326f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x326f('0x4')]('in','out'),'defaultValue':_0x326f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfaa4=['exports','TEXT','ENUM','out','STRING','sequelize'];(function(_0x5e40d2,_0x307679){var _0x3cf22a=function(_0x168f20){while(--_0x168f20){_0x5e40d2['push'](_0x5e40d2['shift']());}};_0x3cf22a(++_0x307679);}(_0xfaa4,0x71));var _0x4faa=function(_0x50f810,_0x3673a1){_0x50f810=_0x50f810-0x0;var _0x1a90dd=_0xfaa4[_0x50f810];return _0x1a90dd;};'use strict';var Sequelize=require(_0x4faa('0x0'));module[_0x4faa('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x4faa('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x4faa('0x3')]('in',_0x4faa('0x4')),'defaultValue':_0x4faa('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4faa('0x5')]},'providerResponse':{'type':Sequelize[_0x4faa('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1e65cf6..f1e8df3 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 _0x99d1=['../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','index','SquareMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','type','includeAll','findAll','rows','fields','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x335bc1,_0x48415f){var _0x3bff77=function(_0x2515fe){while(--_0x2515fe){_0x335bc1['push'](_0x335bc1['shift']());}};_0x3bff77(++_0x48415f);}(_0x99d1,0x104));var _0x199d=function(_0x44fac6,_0x6b0022){_0x44fac6=_0x44fac6-0x0;var _0x58fea6=_0x99d1[_0x44fac6];return _0x58fea6;};'use strict';var emlformat=require(_0x199d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x199d('0x1'));var jsonpatch=require(_0x199d('0x2'));var rp=require(_0x199d('0x3'));var moment=require(_0x199d('0x4'));var BPromise=require(_0x199d('0x5'));var Mustache=require('mustache');var util=require(_0x199d('0x6'));var path=require(_0x199d('0x7'));var sox=require(_0x199d('0x8'));var csv=require(_0x199d('0x9'));var ejs=require(_0x199d('0xa'));var fs=require('fs');var fs_extra=require(_0x199d('0xb'));var _=require(_0x199d('0xc'));var squel=require(_0x199d('0xd'));var crypto=require(_0x199d('0xe'));var jsforce=require(_0x199d('0xf'));var deskjs=require(_0x199d('0x10'));var toCsv=require(_0x199d('0x9'));var querystring=require(_0x199d('0x11'));var Papa=require(_0x199d('0x12'));var Redis=require('ioredis');var authService=require(_0x199d('0x13'));var qs=require(_0x199d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x199d('0x15'));var logger=require(_0x199d('0x16'))(_0x199d('0x17'));var utils=require('../../config/utils');var config=require(_0x199d('0x18'));var licenseUtil=require(_0x199d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bc650,_0x2cb356){_0x2cb356=_0x2cb356||0xcc;return function(_0xd12e1f){if(_0xd12e1f){return _0x5bc650[_0x199d('0x1a')](_0x2cb356);}return _0x5bc650[_0x199d('0x1b')](_0x2cb356)[_0x199d('0x1c')]();};}function respondWithResult(_0x393a90,_0x580f3e){_0x580f3e=_0x580f3e||0xc8;return function(_0x38fe82){if(_0x38fe82){return _0x393a90[_0x199d('0x1b')](_0x580f3e)['json'](_0x38fe82);}};}function respondWithFilteredResult(_0x21ee01,_0x38211e){return function(_0x1e22a9){if(_0x1e22a9){var _0x133368=typeof _0x38211e[_0x199d('0x1d')]===_0x199d('0x1e')&&typeof _0x38211e[_0x199d('0x1f')]===_0x199d('0x1e');var _0xe25ab4=_0x1e22a9[_0x199d('0x20')];var _0x1c99d2=_0x133368?0x0:_0x38211e[_0x199d('0x1d')];var _0x1bac24=_0x133368?_0x1e22a9[_0x199d('0x20')]:_0x38211e[_0x199d('0x1d')]+_0x38211e[_0x199d('0x1f')];var _0x37158d;if(_0x1bac24>=_0xe25ab4){_0x1bac24=_0xe25ab4;_0x37158d=0xc8;}else{_0x37158d=0xce;}_0x21ee01[_0x199d('0x1b')](_0x37158d);return _0x21ee01[_0x199d('0x21')]('Content-Range',_0x1c99d2+'-'+_0x1bac24+'/'+_0xe25ab4)['json'](_0x1e22a9);}return null;};}function patchUpdates(_0x5e0746){return function(_0x49886c){try{jsonpatch[_0x199d('0x22')](_0x49886c,_0x5e0746,!![]);}catch(_0x441285){return BPromise['reject'](_0x441285);}return _0x49886c[_0x199d('0x23')]();};}function saveUpdates(_0x30e2b9,_0x15a849){return function(_0x532c3c){if(_0x532c3c){return _0x532c3c[_0x199d('0x24')](_0x30e2b9)[_0x199d('0x25')](function(_0xd47124){return _0xd47124;});}return null;};}function removeEntity(_0x903963,_0x5341c0){return function(_0x14fa60){if(_0x14fa60){return _0x14fa60[_0x199d('0x26')]()[_0x199d('0x25')](function(){_0x903963['status'](0xcc)[_0x199d('0x1c')]();});}};}function handleEntityNotFound(_0x3c898b,_0x34f330){return function(_0x1f73de){if(!_0x1f73de){_0x3c898b[_0x199d('0x1a')](0x194);}return _0x1f73de;};}function handleError(_0x42ccbd,_0x428ea0){_0x428ea0=_0x428ea0||0x1f4;return function(_0x748392){logger[_0x199d('0x27')](_0x748392[_0x199d('0x28')]);if(_0x748392[_0x199d('0x29')]){delete _0x748392[_0x199d('0x29')];}_0x42ccbd['status'](_0x428ea0)['send'](_0x748392);};}exports[_0x199d('0x2a')]=function(_0x17a289,_0x4bdbda){var _0x565829={},_0x24110c={},_0x2e3238={'count':0x0,'rows':[]};var _0x95e333=_['map'](db[_0x199d('0x2b')][_0x199d('0x2c')],function(_0x15bf09){return{'name':_0x15bf09[_0x199d('0x2d')],'type':_0x15bf09['type'][_0x199d('0x2e')]};});_0x24110c[_0x199d('0x2f')]=_[_0x199d('0x30')](_0x95e333,_0x199d('0x29'));_0x24110c[_0x199d('0x31')]=_[_0x199d('0x32')](_0x17a289[_0x199d('0x31')]);_0x24110c[_0x199d('0x33')]=_[_0x199d('0x34')](_0x24110c[_0x199d('0x2f')],_0x24110c['query']);_0x565829[_0x199d('0x35')]=_[_0x199d('0x34')](_0x24110c['model'],qs['fields'](_0x17a289[_0x199d('0x31')]['fields']));_0x565829[_0x199d('0x35')]=_0x565829['attributes'][_0x199d('0x36')]?_0x565829['attributes']:_0x24110c['model'];if(!_0x17a289[_0x199d('0x31')]['hasOwnProperty']('nolimit')){_0x565829['limit']=qs[_0x199d('0x1f')](_0x17a289[_0x199d('0x31')][_0x199d('0x1f')]);_0x565829[_0x199d('0x1d')]=qs['offset'](_0x17a289[_0x199d('0x31')][_0x199d('0x1d')]);}_0x565829[_0x199d('0x37')]=qs[_0x199d('0x38')](_0x17a289[_0x199d('0x31')][_0x199d('0x38')]);_0x565829[_0x199d('0x39')]=qs[_0x199d('0x33')](_[_0x199d('0x3a')](_0x17a289[_0x199d('0x31')],_0x24110c[_0x199d('0x33')]),_0x95e333);if(_0x17a289[_0x199d('0x31')][_0x199d('0x3b')]){_0x565829[_0x199d('0x39')]=_[_0x199d('0x3c')](_0x565829[_0x199d('0x39')],{'$or':_[_0x199d('0x30')](_0x95e333,function(_0x2a154c){if(_0x2a154c[_0x199d('0x3d')]!=='VIRTUAL'){var _0x239bd8={};_0x239bd8[_0x2a154c['name']]={'$like':'%'+_0x17a289[_0x199d('0x31')][_0x199d('0x3b')]+'%'};return _0x239bd8;}})});}_0x565829=_[_0x199d('0x3c')]({},_0x565829,_0x17a289['options']);var _0x49861f={'where':_0x565829['where']};return db['SquareMessage'][_0x199d('0x20')](_0x49861f)[_0x199d('0x25')](function(_0x5c7c5){_0x2e3238[_0x199d('0x20')]=_0x5c7c5;if(_0x17a289[_0x199d('0x31')][_0x199d('0x3e')]){_0x565829['include']=[{'all':!![]}];}return db['SquareMessage'][_0x199d('0x3f')](_0x565829);})[_0x199d('0x25')](function(_0xadf670){_0x2e3238[_0x199d('0x40')]=_0xadf670;return _0x2e3238;})[_0x199d('0x25')](respondWithFilteredResult(_0x4bdbda,_0x565829))['catch'](handleError(_0x4bdbda,null));};exports['show']=function(_0x2d1440,_0x5698f7){var _0x14e7ff={'raw':!![],'where':{'id':_0x2d1440['params']['id']}},_0x4a6a80={};_0x4a6a80[_0x199d('0x2f')]=_[_0x199d('0x32')](db['SquareMessage'][_0x199d('0x2c')]);_0x4a6a80['query']=_[_0x199d('0x32')](_0x2d1440[_0x199d('0x31')]);_0x4a6a80[_0x199d('0x33')]=_[_0x199d('0x34')](_0x4a6a80['model'],_0x4a6a80['query']);_0x14e7ff[_0x199d('0x35')]=_['intersection'](_0x4a6a80[_0x199d('0x2f')],qs[_0x199d('0x41')](_0x2d1440[_0x199d('0x31')]['fields']));_0x14e7ff[_0x199d('0x35')]=_0x14e7ff[_0x199d('0x35')][_0x199d('0x36')]?_0x14e7ff[_0x199d('0x35')]:_0x4a6a80[_0x199d('0x2f')];if(_0x2d1440[_0x199d('0x31')][_0x199d('0x3e')]){_0x14e7ff['include']=[{'all':!![]}];}_0x14e7ff=_[_0x199d('0x3c')]({},_0x14e7ff,_0x2d1440['options']);return db['SquareMessage'][_0x199d('0x42')](_0x14e7ff)[_0x199d('0x25')](handleEntityNotFound(_0x5698f7,null))['then'](respondWithResult(_0x5698f7,null))['catch'](handleError(_0x5698f7,null));};exports[_0x199d('0x43')]=function(_0x58bb9d,_0x4824c5){return db[_0x199d('0x2b')][_0x199d('0x43')](_0x58bb9d[_0x199d('0x44')],{})['then'](respondWithResult(_0x4824c5,0xc9))[_0x199d('0x45')](handleError(_0x4824c5,null));};exports[_0x199d('0x24')]=function(_0x46bd1a,_0x1294d1){if(_0x46bd1a[_0x199d('0x44')]['id']){delete _0x46bd1a[_0x199d('0x44')]['id'];}return db[_0x199d('0x2b')][_0x199d('0x42')]({'where':{'id':_0x46bd1a[_0x199d('0x46')]['id']}})[_0x199d('0x25')](handleEntityNotFound(_0x1294d1,null))[_0x199d('0x25')](saveUpdates(_0x46bd1a[_0x199d('0x44')],null))[_0x199d('0x25')](respondWithResult(_0x1294d1,null))[_0x199d('0x45')](handleError(_0x1294d1,null));};exports[_0x199d('0x26')]=function(_0x58a57b,_0x92e7ca){return db[_0x199d('0x2b')][_0x199d('0x42')]({'where':{'id':_0x58a57b[_0x199d('0x46')]['id']}})['then'](handleEntityNotFound(_0x92e7ca,null))[_0x199d('0x25')](removeEntity(_0x92e7ca,null))[_0x199d('0x45')](handleError(_0x92e7ca,null));}; \ No newline at end of file +var _0x685d=['attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x685d,0x143));var _0xd685=function(_0x517cd4,_0x26453a){_0x517cd4=_0x517cd4-0x0;var _0x3d93b0=_0x685d[_0x517cd4];return _0x3d93b0;};'use strict';var emlformat=require(_0xd685('0x0'));var rimraf=require(_0xd685('0x1'));var zipdir=require(_0xd685('0x2'));var jsonpatch=require(_0xd685('0x3'));var rp=require(_0xd685('0x4'));var moment=require(_0xd685('0x5'));var BPromise=require(_0xd685('0x6'));var Mustache=require(_0xd685('0x7'));var util=require(_0xd685('0x8'));var path=require(_0xd685('0x9'));var sox=require(_0xd685('0xa'));var csv=require(_0xd685('0xb'));var ejs=require(_0xd685('0xc'));var fs=require('fs');var fs_extra=require(_0xd685('0xd'));var _=require(_0xd685('0xe'));var squel=require('squel');var crypto=require(_0xd685('0xf'));var jsforce=require(_0xd685('0x10'));var deskjs=require(_0xd685('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd685('0x12'));var Papa=require(_0xd685('0x13'));var Redis=require(_0xd685('0x14'));var authService=require(_0xd685('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd685('0x16'))(_0xd685('0x17'));var utils=require(_0xd685('0x18'));var config=require(_0xd685('0x19'));var licenseUtil=require(_0xd685('0x1a'));var db=require(_0xd685('0x1b'))['db'];function respondWithStatusCode(_0x55b01f,_0x2360df){_0x2360df=_0x2360df||0xcc;return function(_0x3eecba){if(_0x3eecba){return _0x55b01f[_0xd685('0x1c')](_0x2360df);}return _0x55b01f[_0xd685('0x1d')](_0x2360df)[_0xd685('0x1e')]();};}function respondWithResult(_0x5134ef,_0x5a0b30){_0x5a0b30=_0x5a0b30||0xc8;return function(_0x1b07d3){if(_0x1b07d3){return _0x5134ef[_0xd685('0x1d')](_0x5a0b30)[_0xd685('0x1f')](_0x1b07d3);}};}function respondWithFilteredResult(_0x1efb06,_0x33f449){return function(_0xed1cfb){if(_0xed1cfb){var _0x42d903=typeof _0x33f449[_0xd685('0x20')]===_0xd685('0x21')&&typeof _0x33f449[_0xd685('0x22')]==='undefined';var _0x4406ab=_0xed1cfb[_0xd685('0x23')];var _0x4c1467=_0x42d903?0x0:_0x33f449[_0xd685('0x20')];var _0x3897fa=_0x42d903?_0xed1cfb[_0xd685('0x23')]:_0x33f449[_0xd685('0x20')]+_0x33f449[_0xd685('0x22')];var _0x4c43a9;if(_0x3897fa>=_0x4406ab){_0x3897fa=_0x4406ab;_0x4c43a9=0xc8;}else{_0x4c43a9=0xce;}_0x1efb06[_0xd685('0x1d')](_0x4c43a9);return _0x1efb06[_0xd685('0x24')]('Content-Range',_0x4c1467+'-'+_0x3897fa+'/'+_0x4406ab)[_0xd685('0x1f')](_0xed1cfb);}return null;};}function patchUpdates(_0x366921){return function(_0x2dcf03){try{jsonpatch['apply'](_0x2dcf03,_0x366921,!![]);}catch(_0x36321b){return BPromise[_0xd685('0x25')](_0x36321b);}return _0x2dcf03['save']();};}function saveUpdates(_0x447fb6,_0x460759){return function(_0x3d1889){if(_0x3d1889){return _0x3d1889[_0xd685('0x26')](_0x447fb6)[_0xd685('0x27')](function(_0x189ebf){return _0x189ebf;});}return null;};}function removeEntity(_0x40fbd9,_0x32a2b6){return function(_0x3de24d){if(_0x3de24d){return _0x3de24d[_0xd685('0x28')]()[_0xd685('0x27')](function(){_0x40fbd9['status'](0xcc)[_0xd685('0x1e')]();});}};}function handleEntityNotFound(_0x191693,_0x2d44f7){return function(_0x3d77fc){if(!_0x3d77fc){_0x191693[_0xd685('0x1c')](0x194);}return _0x3d77fc;};}function handleError(_0xefa1b1,_0x250ee4){_0x250ee4=_0x250ee4||0x1f4;return function(_0x2e260f){logger[_0xd685('0x29')](_0x2e260f[_0xd685('0x2a')]);if(_0x2e260f['name']){delete _0x2e260f[_0xd685('0x2b')];}_0xefa1b1[_0xd685('0x1d')](_0x250ee4)[_0xd685('0x2c')](_0x2e260f);};}exports[_0xd685('0x2d')]=function(_0x226348,_0x5db7e5){var _0x2b7a49={},_0x4e4637={},_0x3e813a={'count':0x0,'rows':[]};var _0x495e99=_[_0xd685('0x2e')](db[_0xd685('0x2f')][_0xd685('0x30')],function(_0x43b377){return{'name':_0x43b377[_0xd685('0x31')],'type':_0x43b377[_0xd685('0x32')]['key']};});_0x4e4637[_0xd685('0x33')]=_[_0xd685('0x2e')](_0x495e99,_0xd685('0x2b'));_0x4e4637[_0xd685('0x34')]=_[_0xd685('0x35')](_0x226348['query']);_0x4e4637[_0xd685('0x36')]=_[_0xd685('0x37')](_0x4e4637[_0xd685('0x33')],_0x4e4637['query']);_0x2b7a49['attributes']=_['intersection'](_0x4e4637['model'],qs['fields'](_0x226348[_0xd685('0x34')][_0xd685('0x38')]));_0x2b7a49['attributes']=_0x2b7a49[_0xd685('0x39')][_0xd685('0x3a')]?_0x2b7a49['attributes']:_0x4e4637[_0xd685('0x33')];if(!_0x226348[_0xd685('0x34')][_0xd685('0x3b')](_0xd685('0x3c'))){_0x2b7a49['limit']=qs[_0xd685('0x22')](_0x226348[_0xd685('0x34')][_0xd685('0x22')]);_0x2b7a49[_0xd685('0x20')]=qs['offset'](_0x226348['query']['offset']);}_0x2b7a49[_0xd685('0x3d')]=qs[_0xd685('0x3e')](_0x226348[_0xd685('0x34')]['sort']);_0x2b7a49['where']=qs[_0xd685('0x36')](_['pick'](_0x226348['query'],_0x4e4637['filters']),_0x495e99);if(_0x226348[_0xd685('0x34')][_0xd685('0x3f')]){_0x2b7a49[_0xd685('0x40')]=_['merge'](_0x2b7a49[_0xd685('0x40')],{'$or':_[_0xd685('0x2e')](_0x495e99,function(_0x137d85){if(_0x137d85[_0xd685('0x32')]!==_0xd685('0x41')){var _0x46d8b5={};_0x46d8b5[_0x137d85['name']]={'$like':'%'+_0x226348['query'][_0xd685('0x3f')]+'%'};return _0x46d8b5;}})});}_0x2b7a49=_[_0xd685('0x42')]({},_0x2b7a49,_0x226348[_0xd685('0x43')]);var _0x29b866={'where':_0x2b7a49[_0xd685('0x40')]};return db[_0xd685('0x2f')][_0xd685('0x23')](_0x29b866)['then'](function(_0x5d7635){_0x3e813a[_0xd685('0x23')]=_0x5d7635;if(_0x226348[_0xd685('0x34')][_0xd685('0x44')]){_0x2b7a49[_0xd685('0x45')]=[{'all':!![]}];}return db[_0xd685('0x2f')]['findAll'](_0x2b7a49);})[_0xd685('0x27')](function(_0x525359){_0x3e813a[_0xd685('0x46')]=_0x525359;return _0x3e813a;})[_0xd685('0x27')](respondWithFilteredResult(_0x5db7e5,_0x2b7a49))['catch'](handleError(_0x5db7e5,null));};exports['show']=function(_0x7187e4,_0x2c9683){var _0x2b5532={'raw':!![],'where':{'id':_0x7187e4[_0xd685('0x47')]['id']}},_0x5513b0={};_0x5513b0[_0xd685('0x33')]=_[_0xd685('0x35')](db[_0xd685('0x2f')]['rawAttributes']);_0x5513b0[_0xd685('0x34')]=_[_0xd685('0x35')](_0x7187e4[_0xd685('0x34')]);_0x5513b0['filters']=_[_0xd685('0x37')](_0x5513b0['model'],_0x5513b0[_0xd685('0x34')]);_0x2b5532[_0xd685('0x39')]=_[_0xd685('0x37')](_0x5513b0['model'],qs[_0xd685('0x38')](_0x7187e4['query'][_0xd685('0x38')]));_0x2b5532[_0xd685('0x39')]=_0x2b5532['attributes'][_0xd685('0x3a')]?_0x2b5532[_0xd685('0x39')]:_0x5513b0['model'];if(_0x7187e4[_0xd685('0x34')]['includeAll']){_0x2b5532[_0xd685('0x45')]=[{'all':!![]}];}_0x2b5532=_[_0xd685('0x42')]({},_0x2b5532,_0x7187e4[_0xd685('0x43')]);return db[_0xd685('0x2f')][_0xd685('0x48')](_0x2b5532)[_0xd685('0x27')](handleEntityNotFound(_0x2c9683,null))[_0xd685('0x27')](respondWithResult(_0x2c9683,null))[_0xd685('0x49')](handleError(_0x2c9683,null));};exports['create']=function(_0x5eb4ae,_0xd62dac){return db[_0xd685('0x2f')][_0xd685('0x4a')](_0x5eb4ae[_0xd685('0x4b')],{})[_0xd685('0x27')](respondWithResult(_0xd62dac,0xc9))[_0xd685('0x49')](handleError(_0xd62dac,null));};exports[_0xd685('0x26')]=function(_0x13570d,_0x14648c){if(_0x13570d[_0xd685('0x4b')]['id']){delete _0x13570d[_0xd685('0x4b')]['id'];}return db['SquareMessage'][_0xd685('0x48')]({'where':{'id':_0x13570d['params']['id']}})[_0xd685('0x27')](handleEntityNotFound(_0x14648c,null))[_0xd685('0x27')](saveUpdates(_0x13570d[_0xd685('0x4b')],null))[_0xd685('0x27')](respondWithResult(_0x14648c,null))[_0xd685('0x49')](handleError(_0x14648c,null));};exports[_0xd685('0x28')]=function(_0x1a36eb,_0x2d5c13){return db[_0xd685('0x2f')]['find']({'where':{'id':_0x1a36eb['params']['id']}})[_0xd685('0x27')](handleEntityNotFound(_0x2d5c13,null))[_0xd685('0x27')](removeEntity(_0x2d5c13,null))['catch'](handleError(_0x2d5c13,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f078b70..9415dbb 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 _0xb079=['SquareMessage','square_messages','util','../../config/logger','api','moment','path','./squareMessage.attributes','exports','define'];(function(_0x5d9a1e,_0x31eed6){var _0x292c18=function(_0xedbc25){while(--_0xedbc25){_0x5d9a1e['push'](_0x5d9a1e['shift']());}};_0x292c18(++_0x31eed6);}(_0xb079,0xd4));var _0x9b07=function(_0xb27fd1,_0x66e8d7){_0xb27fd1=_0xb27fd1-0x0;var _0x413c06=_0xb079[_0xb27fd1];return _0x413c06;};'use strict';var _=require('lodash');var util=require(_0x9b07('0x0'));var logger=require(_0x9b07('0x1'))(_0x9b07('0x2'));var moment=require(_0x9b07('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b07('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9b07('0x5'));module[_0x9b07('0x6')]=function(_0x4f5b11,_0x59a6d5){return _0x4f5b11[_0x9b07('0x7')](_0x9b07('0x8'),attributes,{'tableName':_0x9b07('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c73=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x7c73,0x104));var _0x37c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7c73[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x37c7('0x0'));var util=require(_0x37c7('0x1'));var logger=require(_0x37c7('0x2'))('api');var moment=require(_0x37c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x37c7('0x4'));var fs=require('fs');var path=require(_0x37c7('0x5'));var rimraf=require(_0x37c7('0x6'));var config=require(_0x37c7('0x7'));var attributes=require(_0x37c7('0x8'));module[_0x37c7('0x9')]=function(_0x18748e,_0x150d75){return _0x18748e[_0x37c7('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 b470e94..1575f19 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 _0xc003=['result','catch','SquareMessage','create','body','options','then','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5b51c0,_0x55a4e4){var _0x442268=function(_0x553380){while(--_0x553380){_0x5b51c0['push'](_0x5b51c0['shift']());}};_0x442268(++_0x55a4e4);}(_0xc003,0x65));var _0x3c00=function(_0x4d166f,_0x310ed2){_0x4d166f=_0x4d166f-0x0;var _0x48b368=_0xc003[_0x4d166f];return _0x48b368;};'use strict';var _=require(_0x3c00('0x0'));var util=require(_0x3c00('0x1'));var moment=require(_0x3c00('0x2'));var BPromise=require(_0x3c00('0x3'));var rs=require(_0x3c00('0x4'));var fs=require('fs');var Redis=require(_0x3c00('0x5'));var db=require(_0x3c00('0x6'))['db'];var utils=require(_0x3c00('0x7'));var logger=require(_0x3c00('0x8'))(_0x3c00('0x9'));var config=require(_0x3c00('0xa'));var jayson=require(_0x3c00('0xb'));var client=jayson[_0x3c00('0xc')][_0x3c00('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4ac7b5,_0x5ef31d,_0x1c8076){return new BPromise(function(_0x14aa68,_0x924023){return client['request'](_0x4ac7b5,_0x1c8076)['then'](function(_0x4dcfaa){logger[_0x3c00('0xe')](_0x3c00('0xf'),_0x5ef31d,_0x3c00('0x10'));logger[_0x3c00('0x11')](_0x3c00('0x12'),_0x5ef31d,'request\x20sent',JSON[_0x3c00('0x13')](_0x4dcfaa));if(_0x4dcfaa[_0x3c00('0x14')]){if(_0x4dcfaa[_0x3c00('0x14')][_0x3c00('0x15')]===0x1f4){logger[_0x3c00('0x14')](_0x3c00('0xf'),_0x5ef31d,_0x4dcfaa[_0x3c00('0x14')][_0x3c00('0x16')]);return _0x924023(_0x4dcfaa[_0x3c00('0x14')][_0x3c00('0x16')]);}logger[_0x3c00('0x14')](_0x3c00('0xf'),_0x5ef31d,_0x4dcfaa['error'][_0x3c00('0x16')]);return _0x14aa68(_0x4dcfaa['error'][_0x3c00('0x16')]);}else{logger[_0x3c00('0xe')](_0x3c00('0xf'),_0x5ef31d,_0x3c00('0x10'));_0x14aa68(_0x4dcfaa[_0x3c00('0x17')]['message']);}})[_0x3c00('0x18')](function(_0x16d6e3){logger[_0x3c00('0x14')](_0x3c00('0xf'),_0x5ef31d,_0x16d6e3);_0x924023(_0x16d6e3);});});}exports['CreateSquareMessage']=function(_0xd665ef){var _0x5a85bb=this;return new Promise(function(_0x8c7c9f,_0xb0dd00){return db[_0x3c00('0x19')][_0x3c00('0x1a')](_0xd665ef[_0x3c00('0x1b')],{'raw':_0xd665ef[_0x3c00('0x1c')]?_0xd665ef[_0x3c00('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3c00('0x1d')](function(_0x495363){logger[_0x3c00('0xe')](_0x3c00('0x1e'),_0xd665ef);logger[_0x3c00('0x11')](_0x3c00('0x1e'),_0xd665ef,JSON['stringify'](_0x495363));_0x8c7c9f(_0x495363);})['catch'](function(_0xf6749c){logger[_0x3c00('0x14')](_0x3c00('0x1e'),_0xf6749c['message'],_0xd665ef);_0xb0dd00(_0x5a85bb[_0x3c00('0x14')](0x1f4,_0xf6749c[_0x3c00('0x16')]));});});}; \ No newline at end of file +var _0xae8b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x205b1a,_0x14c840){var _0x1540ed=function(_0x480ec7){while(--_0x480ec7){_0x205b1a['push'](_0x205b1a['shift']());}};_0x1540ed(++_0x14c840);}(_0xae8b,0x11b));var _0xbae8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae8b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbae8('0x0'));var util=require(_0xbae8('0x1'));var moment=require(_0xbae8('0x2'));var BPromise=require(_0xbae8('0x3'));var rs=require(_0xbae8('0x4'));var fs=require('fs');var Redis=require(_0xbae8('0x5'));var db=require(_0xbae8('0x6'))['db'];var utils=require(_0xbae8('0x7'));var logger=require(_0xbae8('0x8'))(_0xbae8('0x9'));var config=require(_0xbae8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xbae8('0xb')][_0xbae8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6d89d2,_0x2ca6d6,_0x51b267){return new BPromise(function(_0xcb0955,_0x39cda0){return client['request'](_0x6d89d2,_0x51b267)[_0xbae8('0xd')](function(_0x43e132){logger[_0xbae8('0xe')](_0xbae8('0xf'),_0x2ca6d6,'request\x20sent');logger['debug'](_0xbae8('0x10'),_0x2ca6d6,_0xbae8('0x11'),JSON[_0xbae8('0x12')](_0x43e132));if(_0x43e132[_0xbae8('0x13')]){if(_0x43e132[_0xbae8('0x13')][_0xbae8('0x14')]===0x1f4){logger[_0xbae8('0x13')](_0xbae8('0xf'),_0x2ca6d6,_0x43e132[_0xbae8('0x13')][_0xbae8('0x15')]);return _0x39cda0(_0x43e132[_0xbae8('0x13')][_0xbae8('0x15')]);}logger[_0xbae8('0x13')](_0xbae8('0xf'),_0x2ca6d6,_0x43e132[_0xbae8('0x13')][_0xbae8('0x15')]);return _0xcb0955(_0x43e132['error']['message']);}else{logger[_0xbae8('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2ca6d6,_0xbae8('0x11'));_0xcb0955(_0x43e132['result']['message']);}})[_0xbae8('0x16')](function(_0x1205f1){logger[_0xbae8('0x13')](_0xbae8('0xf'),_0x2ca6d6,_0x1205f1);_0x39cda0(_0x1205f1);});});}exports[_0xbae8('0x17')]=function(_0x2938ef){var _0x3e3fe1=this;return new Promise(function(_0x3f0dba,_0x2e3f9c){return db[_0xbae8('0x18')][_0xbae8('0x19')](_0x2938ef['body'],{'raw':_0x2938ef[_0xbae8('0x1a')]?_0x2938ef[_0xbae8('0x1a')][_0xbae8('0x1b')]===undefined?!![]:![]:!![]})[_0xbae8('0xd')](function(_0x54b8c8){logger[_0xbae8('0xe')](_0xbae8('0x17'),_0x2938ef);logger[_0xbae8('0x1c')](_0xbae8('0x17'),_0x2938ef,JSON[_0xbae8('0x12')](_0x54b8c8));_0x3f0dba(_0x54b8c8);})[_0xbae8('0x16')](function(_0x13ddea){logger[_0xbae8('0x13')](_0xbae8('0x17'),_0x13ddea[_0xbae8('0x15')],_0x2938ef);_0x2e3f9c(_0x3e3fe1[_0xbae8('0x13')](0x1f4,_0x13ddea[_0xbae8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 08ed5cc..99fb189 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 _0x1d91=['put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','create'];(function(_0x3261c4,_0x16b8a1){var _0x3d5b02=function(_0x229c6e){while(--_0x229c6e){_0x3261c4['push'](_0x3261c4['shift']());}};_0x3d5b02(++_0x16b8a1);}(_0x1d91,0x139));var _0x11d9=function(_0x5230a3,_0x241aec){_0x5230a3=_0x5230a3-0x0;var _0x3b4169=_0x1d91[_0x5230a3];return _0x3b4169;};'use strict';var multer=require(_0x11d9('0x0'));var util=require(_0x11d9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x11d9('0x2'));var router=express[_0x11d9('0x3')]();var fs_extra=require(_0x11d9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x11d9('0x5'));var config=require(_0x11d9('0x6'));var controller=require(_0x11d9('0x7'));router[_0x11d9('0x8')]('/',auth[_0x11d9('0x9')](),controller[_0x11d9('0xa')]);router[_0x11d9('0x8')](_0x11d9('0xb'),auth[_0x11d9('0x9')](),controller[_0x11d9('0xc')]);router[_0x11d9('0x8')]('/:id/test',auth[_0x11d9('0x9')](),timeout(_0x11d9('0xd')),controller[_0x11d9('0xe')]);router[_0x11d9('0xf')]('/',auth[_0x11d9('0x9')](),controller[_0x11d9('0x10')]);router[_0x11d9('0x11')]('/:id',auth[_0x11d9('0x9')](),controller[_0x11d9('0x12')]);router[_0x11d9('0x13')](_0x11d9('0xb'),auth['isAuthenticated'](),controller[_0x11d9('0x14')]);module[_0x11d9('0x15')]=router; \ No newline at end of file +var _0xfd9b=['create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfd9b,0x1d1));var _0xbfd9=function(_0x2c3aed,_0xa4011f){_0x2c3aed=_0x2c3aed-0x0;var _0x473dc4=_0xfd9b[_0x2c3aed];return _0x473dc4;};'use strict';var multer=require(_0xbfd9('0x0'));var util=require(_0xbfd9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbfd9('0x2'));var router=express[_0xbfd9('0x3')]();var fs_extra=require(_0xbfd9('0x4'));var auth=require(_0xbfd9('0x5'));var interaction=require(_0xbfd9('0x6'));var config=require(_0xbfd9('0x7'));var controller=require(_0xbfd9('0x8'));router[_0xbfd9('0x9')]('/',auth[_0xbfd9('0xa')](),controller[_0xbfd9('0xb')]);router[_0xbfd9('0x9')](_0xbfd9('0xc'),auth['isAuthenticated'](),controller[_0xbfd9('0xd')]);router[_0xbfd9('0x9')]('/:id/test',auth[_0xbfd9('0xa')](),timeout(_0xbfd9('0xe')),controller['test']);router['post']('/',auth[_0xbfd9('0xa')](),controller[_0xbfd9('0xf')]);router['put'](_0xbfd9('0xc'),auth[_0xbfd9('0xa')](),controller[_0xbfd9('0x10')]);router[_0xbfd9('0x11')](_0xbfd9('0xc'),auth[_0xbfd9('0xa')](),controller[_0xbfd9('0x12')]);module[_0xbfd9('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 005b590..fce03be 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 _0x8d16=['name','STRING'];(function(_0x20fa14,_0x2f0234){var _0x161aa0=function(_0x1dca88){while(--_0x1dca88){_0x20fa14['push'](_0x20fa14['shift']());}};_0x161aa0(++_0x2f0234);}(_0x8d16,0x1c5));var _0x68d1=function(_0x481813,_0x2cf9e1){_0x481813=_0x481813-0x0;var _0x3fb60c=_0x8d16[_0x481813];return _0x3fb60c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x68d1('0x0')],'unique':_0x68d1('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x68d1('0x0')]},'description':{'type':Sequelize[_0x68d1('0x0')]}}; \ No newline at end of file +var _0xf913=['STRING','name','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf913,0x182));var _0x3f91=function(_0x1dd70c,_0x562663){_0x1dd70c=_0x1dd70c-0x0;var _0x22259c=_0xf913[_0x1dd70c];return _0x22259c;};'use strict';var Sequelize=require('sequelize');module[_0x3f91('0x0')]={'name':{'type':Sequelize[_0x3f91('0x1')],'unique':_0x3f91('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3f91('0x1')]},'description':{'type':Sequelize[_0x3f91('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1dd0ac4..aeba9c8 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 _0xa447=['closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','get','ODBC','destroy','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','find','create','user','role','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync'];(function(_0x29ddb6,_0x44d201){var _0x317f80=function(_0xc553cc){while(--_0xc553cc){_0x29ddb6['push'](_0x29ddb6['shift']());}};_0x317f80(++_0x44d201);}(_0xa447,0x1b9));var _0x7a44=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa447[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x7a44('0x0'));var rimraf=require(_0x7a44('0x1'));var zipdir=require(_0x7a44('0x2'));var jsonpatch=require(_0x7a44('0x3'));var rp=require(_0x7a44('0x4'));var moment=require(_0x7a44('0x5'));var BPromise=require(_0x7a44('0x6'));var Mustache=require(_0x7a44('0x7'));var util=require(_0x7a44('0x8'));var path=require(_0x7a44('0x9'));var sox=require('sox');var csv=require(_0x7a44('0xa'));var ejs=require(_0x7a44('0xb'));var fs=require('fs');var fs_extra=require(_0x7a44('0xc'));var _=require(_0x7a44('0xd'));var squel=require(_0x7a44('0xe'));var crypto=require(_0x7a44('0xf'));var jsforce=require(_0x7a44('0x10'));var deskjs=require(_0x7a44('0x11'));var toCsv=require(_0x7a44('0xa'));var querystring=require(_0x7a44('0x12'));var Papa=require(_0x7a44('0x13'));var Redis=require(_0x7a44('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a44('0x15'));var hardwareService=require(_0x7a44('0x16'));var logger=require(_0x7a44('0x17'))(_0x7a44('0x18'));var utils=require('../../config/utils');var config=require(_0x7a44('0x19'));var licenseUtil=require(_0x7a44('0x1a'));var db=require(_0x7a44('0x1b'))['db'];function respondWithStatusCode(_0x357c6f,_0x317ead){_0x317ead=_0x317ead||0xcc;return function(_0x3c3a7e){if(_0x3c3a7e){return _0x357c6f['sendStatus'](_0x317ead);}return _0x357c6f[_0x7a44('0x1c')](_0x317ead)[_0x7a44('0x1d')]();};}function respondWithResult(_0x28f0c1,_0x32f634){_0x32f634=_0x32f634||0xc8;return function(_0x8308fa){if(_0x8308fa){return _0x28f0c1[_0x7a44('0x1c')](_0x32f634)[_0x7a44('0x1e')](_0x8308fa);}};}function respondWithFilteredResult(_0x3e3001,_0x1bba69){return function(_0x192e7f){if(_0x192e7f){var _0x4fdb1e=typeof _0x1bba69[_0x7a44('0x1f')]===_0x7a44('0x20')&&typeof _0x1bba69[_0x7a44('0x21')]===_0x7a44('0x20');var _0x200aa6=_0x192e7f[_0x7a44('0x22')];var _0x31277f=_0x4fdb1e?0x0:_0x1bba69['offset'];var _0x741839=_0x4fdb1e?_0x192e7f['count']:_0x1bba69[_0x7a44('0x1f')]+_0x1bba69[_0x7a44('0x21')];var _0x4896c3;if(_0x741839>=_0x200aa6){_0x741839=_0x200aa6;_0x4896c3=0xc8;}else{_0x4896c3=0xce;}_0x3e3001[_0x7a44('0x1c')](_0x4896c3);return _0x3e3001[_0x7a44('0x23')]('Content-Range',_0x31277f+'-'+_0x741839+'/'+_0x200aa6)['json'](_0x192e7f);}return null;};}function patchUpdates(_0x217d79){return function(_0x400855){try{jsonpatch['apply'](_0x400855,_0x217d79,!![]);}catch(_0x3afc61){return BPromise['reject'](_0x3afc61);}return _0x400855[_0x7a44('0x24')]();};}function saveUpdates(_0x2576f1,_0x3639c4){return function(_0x2528cd){if(_0x2528cd){return _0x2528cd[_0x7a44('0x25')](_0x2576f1)['then'](function(_0x371acc){return _0x371acc;});}return null;};}function removeEntity(_0x36d0fe,_0x3a66ef){return function(_0x8d73af){if(_0x8d73af){return _0x8d73af['destroy']()[_0x7a44('0x26')](function(){var _0x143db5=_0x8d73af[_0x7a44('0x27')]({'plain':!![]});var _0x2c2dbd=_0x7a44('0x28');return db['UserProfileResource'][_0x7a44('0x29')]({'where':{'type':_0x2c2dbd,'resourceId':_0x143db5['id']}})['then'](function(){return _0x8d73af;});})['then'](function(){_0x36d0fe[_0x7a44('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42b631,_0x2e7e7e){return function(_0xceb80f){if(!_0xceb80f){_0x42b631[_0x7a44('0x2a')](0x194);}return _0xceb80f;};}function handleError(_0x5dcfbe,_0xa570a6){_0xa570a6=_0xa570a6||0x1f4;return function(_0x32441e){logger[_0x7a44('0x2b')](_0x32441e[_0x7a44('0x2c')]);if(_0x32441e[_0x7a44('0x2d')]){delete _0x32441e[_0x7a44('0x2d')];}_0x5dcfbe['status'](_0xa570a6)[_0x7a44('0x2e')](_0x32441e);};}exports[_0x7a44('0x2f')]=function(_0x2224b7,_0x1b31f1){var _0x12dcc9={},_0x47809b={},_0x3e3916={'count':0x0,'rows':[]};var _0x2a1c99=_[_0x7a44('0x30')](db[_0x7a44('0x31')][_0x7a44('0x32')],function(_0x1a5169){return{'name':_0x1a5169[_0x7a44('0x33')],'type':_0x1a5169[_0x7a44('0x34')][_0x7a44('0x35')]};});_0x47809b['model']=_[_0x7a44('0x30')](_0x2a1c99,_0x7a44('0x2d'));_0x47809b[_0x7a44('0x36')]=_[_0x7a44('0x37')](_0x2224b7[_0x7a44('0x36')]);_0x47809b['filters']=_[_0x7a44('0x38')](_0x47809b[_0x7a44('0x39')],_0x47809b[_0x7a44('0x36')]);_0x12dcc9[_0x7a44('0x3a')]=_[_0x7a44('0x38')](_0x47809b[_0x7a44('0x39')],qs[_0x7a44('0x3b')](_0x2224b7[_0x7a44('0x36')]['fields']));_0x12dcc9[_0x7a44('0x3a')]=_0x12dcc9[_0x7a44('0x3a')][_0x7a44('0x3c')]?_0x12dcc9[_0x7a44('0x3a')]:_0x47809b[_0x7a44('0x39')];if(!_0x2224b7['query']['hasOwnProperty'](_0x7a44('0x3d'))){_0x12dcc9['limit']=qs[_0x7a44('0x21')](_0x2224b7[_0x7a44('0x36')][_0x7a44('0x21')]);_0x12dcc9[_0x7a44('0x1f')]=qs[_0x7a44('0x1f')](_0x2224b7[_0x7a44('0x36')]['offset']);}_0x12dcc9['order']=qs[_0x7a44('0x3e')](_0x2224b7[_0x7a44('0x36')][_0x7a44('0x3e')]);_0x12dcc9['where']=qs[_0x7a44('0x3f')](_[_0x7a44('0x40')](_0x2224b7[_0x7a44('0x36')],_0x47809b[_0x7a44('0x3f')]),_0x2a1c99);if(_0x2224b7[_0x7a44('0x36')][_0x7a44('0x41')]){_0x12dcc9[_0x7a44('0x42')]=_[_0x7a44('0x43')](_0x12dcc9[_0x7a44('0x42')],{'$or':_['map'](_0x2a1c99,function(_0x1aa98d){if(_0x1aa98d[_0x7a44('0x34')]!=='VIRTUAL'){var _0x20f7ae={};_0x20f7ae[_0x1aa98d[_0x7a44('0x2d')]]={'$like':'%'+_0x2224b7[_0x7a44('0x36')][_0x7a44('0x41')]+'%'};return _0x20f7ae;}})});}_0x12dcc9=_[_0x7a44('0x43')]({},_0x12dcc9,_0x2224b7[_0x7a44('0x44')]);var _0x4cb5bd={'where':_0x12dcc9[_0x7a44('0x42')]};return db['SquareOdbc']['count'](_0x4cb5bd)[_0x7a44('0x26')](function(_0x399851){_0x3e3916[_0x7a44('0x22')]=_0x399851;if(_0x2224b7[_0x7a44('0x36')][_0x7a44('0x45')]){_0x12dcc9[_0x7a44('0x46')]=[{'all':!![]}];}return db[_0x7a44('0x31')][_0x7a44('0x47')](_0x12dcc9);})[_0x7a44('0x26')](function(_0x2af87f){_0x3e3916[_0x7a44('0x48')]=_0x2af87f;return _0x3e3916;})[_0x7a44('0x26')](respondWithFilteredResult(_0x1b31f1,_0x12dcc9))['catch'](handleError(_0x1b31f1,null));};exports['show']=function(_0x5b651c,_0x19a09f){var _0x4139f4={'raw':!![],'where':{'id':_0x5b651c[_0x7a44('0x49')]['id']}},_0x21389d={};_0x21389d[_0x7a44('0x39')]=_[_0x7a44('0x37')](db[_0x7a44('0x31')][_0x7a44('0x32')]);_0x21389d[_0x7a44('0x36')]=_[_0x7a44('0x37')](_0x5b651c[_0x7a44('0x36')]);_0x21389d['filters']=_[_0x7a44('0x38')](_0x21389d[_0x7a44('0x39')],_0x21389d[_0x7a44('0x36')]);_0x4139f4[_0x7a44('0x3a')]=_[_0x7a44('0x38')](_0x21389d['model'],qs['fields'](_0x5b651c[_0x7a44('0x36')][_0x7a44('0x3b')]));_0x4139f4[_0x7a44('0x3a')]=_0x4139f4['attributes']['length']?_0x4139f4['attributes']:_0x21389d[_0x7a44('0x39')];if(_0x5b651c['query']['includeAll']){_0x4139f4['include']=[{'all':!![]}];}_0x4139f4=_[_0x7a44('0x43')]({},_0x4139f4,_0x5b651c[_0x7a44('0x44')]);return db[_0x7a44('0x31')][_0x7a44('0x4a')](_0x4139f4)['then'](handleEntityNotFound(_0x19a09f,null))[_0x7a44('0x26')](respondWithResult(_0x19a09f,null))['catch'](handleError(_0x19a09f,null));};exports[_0x7a44('0x4b')]=function(_0x1fbf7a,_0x1b5c69){return db['SquareOdbc'][_0x7a44('0x4b')](_0x1fbf7a['body'],{})[_0x7a44('0x26')](function(_0x4dfd7){var _0x16d4b0=_0x1fbf7a[_0x7a44('0x4c')][_0x7a44('0x27')]({'plain':!![]});if(!_0x16d4b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16d4b0[_0x7a44('0x4d')]===_0x7a44('0x4c')){var _0x15fdff=_0x4dfd7['get']({'plain':!![]});var _0x1c4156=_0x7a44('0x28');return db['UserProfileSection'][_0x7a44('0x4a')]({'where':{'name':_0x1c4156,'userProfileId':_0x16d4b0[_0x7a44('0x4e')]},'raw':!![]})[_0x7a44('0x26')](function(_0x404a74){if(_0x404a74&&_0x404a74['autoAssociation']===0x0){return db[_0x7a44('0x4f')][_0x7a44('0x4b')]({'name':_0x15fdff['name'],'resourceId':_0x15fdff['id'],'type':_0x404a74[_0x7a44('0x2d')],'sectionId':_0x404a74['id']},{})['then'](function(){return _0x4dfd7;});}else{return _0x4dfd7;}})[_0x7a44('0x50')](function(_0x434d64){logger['error'](_0x7a44('0x51'),_0x434d64);throw _0x434d64;});}return _0x4dfd7;})[_0x7a44('0x26')](respondWithResult(_0x1b5c69,0xc9))[_0x7a44('0x50')](handleError(_0x1b5c69,null));};exports[_0x7a44('0x25')]=function(_0x2643d1,_0x32d841){if(_0x2643d1[_0x7a44('0x52')]['id']){delete _0x2643d1[_0x7a44('0x52')]['id'];}return db[_0x7a44('0x31')][_0x7a44('0x4a')]({'where':{'id':_0x2643d1[_0x7a44('0x49')]['id']}})['then'](handleEntityNotFound(_0x32d841,null))[_0x7a44('0x26')](saveUpdates(_0x2643d1['body'],null))['then'](respondWithResult(_0x32d841,null))[_0x7a44('0x50')](handleError(_0x32d841,null));};exports[_0x7a44('0x29')]=function(_0x15785d,_0x3fed16){return db[_0x7a44('0x31')][_0x7a44('0x4a')]({'where':{'id':_0x15785d[_0x7a44('0x49')]['id']}})[_0x7a44('0x26')](handleEntityNotFound(_0x3fed16,null))['then'](removeEntity(_0x3fed16,null))[_0x7a44('0x50')](handleError(_0x3fed16,null));};exports[_0x7a44('0x53')]=function(_0x1b232d,_0x1c5cb7,_0xdb74e4){var _0x17c173;return db[_0x7a44('0x31')][_0x7a44('0x4a')]({'where':{'id':_0x1b232d[_0x7a44('0x49')]['id']},'attributes':['id',_0x7a44('0x54')]})[_0x7a44('0x26')](handleEntityNotFound(_0x1c5cb7,null))[_0x7a44('0x26')](function(_0xd55f5e){if(_0xd55f5e){var _0xbf898c=require(_0x7a44('0x55'))();_0xbf898c[_0x7a44('0x56')](_0xd55f5e[_0x7a44('0x54')]);_0xbf898c[_0x7a44('0x57')]();return _0xd55f5e;}})[_0x7a44('0x26')](respondWithResult(_0x1c5cb7,null))[_0x7a44('0x50')](handleError(_0x1c5cb7,null));}; \ No newline at end of file +var _0x7188=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','Content-Range','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','status','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query'];(function(_0x3a2843,_0x5aeacb){var _0x396cb8=function(_0x4398ad){while(--_0x4398ad){_0x3a2843['push'](_0x3a2843['shift']());}};_0x396cb8(++_0x5aeacb);}(_0x7188,0x75));var _0x8718=function(_0x452954,_0xe7b363){_0x452954=_0x452954-0x0;var _0x469f03=_0x7188[_0x452954];return _0x469f03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8718('0x0'));var zipdir=require(_0x8718('0x1'));var jsonpatch=require(_0x8718('0x2'));var rp=require(_0x8718('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8718('0x4'));var util=require(_0x8718('0x5'));var path=require(_0x8718('0x6'));var sox=require(_0x8718('0x7'));var csv=require(_0x8718('0x8'));var ejs=require(_0x8718('0x9'));var fs=require('fs');var fs_extra=require(_0x8718('0xa'));var _=require('lodash');var squel=require(_0x8718('0xb'));var crypto=require(_0x8718('0xc'));var jsforce=require(_0x8718('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8718('0xe'));var Redis=require(_0x8718('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8718('0x10'));var hardwareService=require(_0x8718('0x11'));var logger=require('../../config/logger')(_0x8718('0x12'));var utils=require(_0x8718('0x13'));var config=require(_0x8718('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8718('0x15'))['db'];function respondWithStatusCode(_0x5dddb2,_0x40ba98){_0x40ba98=_0x40ba98||0xcc;return function(_0x23976b){if(_0x23976b){return _0x5dddb2[_0x8718('0x16')](_0x40ba98);}return _0x5dddb2['status'](_0x40ba98)[_0x8718('0x17')]();};}function respondWithResult(_0x15d444,_0x262714){_0x262714=_0x262714||0xc8;return function(_0x2b5494){if(_0x2b5494){return _0x15d444['status'](_0x262714)[_0x8718('0x18')](_0x2b5494);}};}function respondWithFilteredResult(_0x1216d3,_0x5ea498){return function(_0x447752){if(_0x447752){var _0x15b48b=typeof _0x5ea498[_0x8718('0x19')]===_0x8718('0x1a')&&typeof _0x5ea498['limit']===_0x8718('0x1a');var _0x136c7d=_0x447752[_0x8718('0x1b')];var _0x39854a=_0x15b48b?0x0:_0x5ea498[_0x8718('0x19')];var _0x32d4e0=_0x15b48b?_0x447752[_0x8718('0x1b')]:_0x5ea498[_0x8718('0x19')]+_0x5ea498[_0x8718('0x1c')];var _0x25558e;if(_0x32d4e0>=_0x136c7d){_0x32d4e0=_0x136c7d;_0x25558e=0xc8;}else{_0x25558e=0xce;}_0x1216d3['status'](_0x25558e);return _0x1216d3['set'](_0x8718('0x1d'),_0x39854a+'-'+_0x32d4e0+'/'+_0x136c7d)[_0x8718('0x18')](_0x447752);}return null;};}function patchUpdates(_0x4a7018){return function(_0x984506){try{jsonpatch['apply'](_0x984506,_0x4a7018,!![]);}catch(_0x2720d3){return BPromise['reject'](_0x2720d3);}return _0x984506['save']();};}function saveUpdates(_0x53619c,_0x56052a){return function(_0x2cb15f){if(_0x2cb15f){return _0x2cb15f[_0x8718('0x1e')](_0x53619c)[_0x8718('0x1f')](function(_0x12b306){return _0x12b306;});}return null;};}function removeEntity(_0x418257,_0x556d22){return function(_0x58b760){if(_0x58b760){return _0x58b760['destroy']()[_0x8718('0x1f')](function(){var _0x879e56=_0x58b760[_0x8718('0x20')]({'plain':!![]});var _0x3f0550=_0x8718('0x21');return db[_0x8718('0x22')][_0x8718('0x23')]({'where':{'type':_0x3f0550,'resourceId':_0x879e56['id']}})['then'](function(){return _0x58b760;});})[_0x8718('0x1f')](function(){_0x418257['status'](0xcc)[_0x8718('0x17')]();});}};}function handleEntityNotFound(_0x40e9b8,_0x45de2a){return function(_0x3f6d4f){if(!_0x3f6d4f){_0x40e9b8[_0x8718('0x16')](0x194);}return _0x3f6d4f;};}function handleError(_0xe05c27,_0x353f21){_0x353f21=_0x353f21||0x1f4;return function(_0x1b9d4e){logger[_0x8718('0x24')](_0x1b9d4e[_0x8718('0x25')]);if(_0x1b9d4e[_0x8718('0x26')]){delete _0x1b9d4e[_0x8718('0x26')];}_0xe05c27[_0x8718('0x27')](_0x353f21)[_0x8718('0x28')](_0x1b9d4e);};}exports[_0x8718('0x29')]=function(_0x41d2d2,_0x3a6a83){var _0x189259={},_0x4c5f2e={},_0x15a159={'count':0x0,'rows':[]};var _0x15d057=_[_0x8718('0x2a')](db[_0x8718('0x2b')][_0x8718('0x2c')],function(_0x230ac7){return{'name':_0x230ac7[_0x8718('0x2d')],'type':_0x230ac7[_0x8718('0x2e')]['key']};});_0x4c5f2e[_0x8718('0x2f')]=_[_0x8718('0x2a')](_0x15d057,_0x8718('0x26'));_0x4c5f2e[_0x8718('0x30')]=_[_0x8718('0x31')](_0x41d2d2[_0x8718('0x30')]);_0x4c5f2e[_0x8718('0x32')]=_[_0x8718('0x33')](_0x4c5f2e[_0x8718('0x2f')],_0x4c5f2e['query']);_0x189259[_0x8718('0x34')]=_['intersection'](_0x4c5f2e[_0x8718('0x2f')],qs['fields'](_0x41d2d2['query']['fields']));_0x189259[_0x8718('0x34')]=_0x189259[_0x8718('0x34')][_0x8718('0x35')]?_0x189259[_0x8718('0x34')]:_0x4c5f2e[_0x8718('0x2f')];if(!_0x41d2d2[_0x8718('0x30')][_0x8718('0x36')](_0x8718('0x37'))){_0x189259[_0x8718('0x1c')]=qs[_0x8718('0x1c')](_0x41d2d2['query']['limit']);_0x189259[_0x8718('0x19')]=qs[_0x8718('0x19')](_0x41d2d2[_0x8718('0x30')][_0x8718('0x19')]);}_0x189259[_0x8718('0x38')]=qs['sort'](_0x41d2d2['query'][_0x8718('0x39')]);_0x189259['where']=qs[_0x8718('0x32')](_[_0x8718('0x3a')](_0x41d2d2[_0x8718('0x30')],_0x4c5f2e[_0x8718('0x32')]),_0x15d057);if(_0x41d2d2[_0x8718('0x30')][_0x8718('0x3b')]){_0x189259[_0x8718('0x3c')]=_[_0x8718('0x3d')](_0x189259[_0x8718('0x3c')],{'$or':_[_0x8718('0x2a')](_0x15d057,function(_0x147eef){if(_0x147eef[_0x8718('0x2e')]!==_0x8718('0x3e')){var _0x4b7eef={};_0x4b7eef[_0x147eef[_0x8718('0x26')]]={'$like':'%'+_0x41d2d2[_0x8718('0x30')][_0x8718('0x3b')]+'%'};return _0x4b7eef;}})});}_0x189259=_[_0x8718('0x3d')]({},_0x189259,_0x41d2d2[_0x8718('0x3f')]);var _0x4c7442={'where':_0x189259[_0x8718('0x3c')]};return db[_0x8718('0x2b')][_0x8718('0x1b')](_0x4c7442)[_0x8718('0x1f')](function(_0x542062){_0x15a159[_0x8718('0x1b')]=_0x542062;if(_0x41d2d2[_0x8718('0x30')][_0x8718('0x40')]){_0x189259['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x8718('0x41')](_0x189259);})['then'](function(_0x5d0d7c){_0x15a159[_0x8718('0x42')]=_0x5d0d7c;return _0x15a159;})[_0x8718('0x1f')](respondWithFilteredResult(_0x3a6a83,_0x189259))['catch'](handleError(_0x3a6a83,null));};exports[_0x8718('0x43')]=function(_0x4bcbc9,_0x348432){var _0x3077a6={'raw':!![],'where':{'id':_0x4bcbc9[_0x8718('0x44')]['id']}},_0x448992={};_0x448992[_0x8718('0x2f')]=_[_0x8718('0x31')](db[_0x8718('0x2b')][_0x8718('0x2c')]);_0x448992[_0x8718('0x30')]=_['keys'](_0x4bcbc9[_0x8718('0x30')]);_0x448992['filters']=_[_0x8718('0x33')](_0x448992[_0x8718('0x2f')],_0x448992['query']);_0x3077a6['attributes']=_['intersection'](_0x448992[_0x8718('0x2f')],qs['fields'](_0x4bcbc9['query']['fields']));_0x3077a6[_0x8718('0x34')]=_0x3077a6[_0x8718('0x34')][_0x8718('0x35')]?_0x3077a6[_0x8718('0x34')]:_0x448992[_0x8718('0x2f')];if(_0x4bcbc9['query'][_0x8718('0x40')]){_0x3077a6[_0x8718('0x45')]=[{'all':!![]}];}_0x3077a6=_[_0x8718('0x3d')]({},_0x3077a6,_0x4bcbc9['options']);return db[_0x8718('0x2b')][_0x8718('0x46')](_0x3077a6)['then'](handleEntityNotFound(_0x348432,null))[_0x8718('0x1f')](respondWithResult(_0x348432,null))[_0x8718('0x47')](handleError(_0x348432,null));};exports[_0x8718('0x48')]=function(_0x3c6992,_0x27cadc){return db['SquareOdbc'][_0x8718('0x48')](_0x3c6992['body'],{})[_0x8718('0x1f')](function(_0x3dbc9e){var _0x201a6c=_0x3c6992[_0x8718('0x49')][_0x8718('0x20')]({'plain':!![]});if(!_0x201a6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x201a6c[_0x8718('0x4a')]==='user'){var _0x3e660b=_0x3dbc9e[_0x8718('0x20')]({'plain':!![]});var _0x1308bb=_0x8718('0x21');return db[_0x8718('0x4b')]['find']({'where':{'name':_0x1308bb,'userProfileId':_0x201a6c[_0x8718('0x4c')]},'raw':!![]})[_0x8718('0x1f')](function(_0x119055){if(_0x119055&&_0x119055[_0x8718('0x4d')]===0x0){return db[_0x8718('0x22')][_0x8718('0x48')]({'name':_0x3e660b[_0x8718('0x26')],'resourceId':_0x3e660b['id'],'type':_0x119055[_0x8718('0x26')],'sectionId':_0x119055['id']},{})[_0x8718('0x1f')](function(){return _0x3dbc9e;});}else{return _0x3dbc9e;}})[_0x8718('0x47')](function(_0x1d5892){logger[_0x8718('0x24')](_0x8718('0x4e'),_0x1d5892);throw _0x1d5892;});}return _0x3dbc9e;})[_0x8718('0x1f')](respondWithResult(_0x27cadc,0xc9))['catch'](handleError(_0x27cadc,null));};exports[_0x8718('0x1e')]=function(_0xfadd0b,_0x439315){if(_0xfadd0b[_0x8718('0x4f')]['id']){delete _0xfadd0b[_0x8718('0x4f')]['id'];}return db[_0x8718('0x2b')]['find']({'where':{'id':_0xfadd0b['params']['id']}})[_0x8718('0x1f')](handleEntityNotFound(_0x439315,null))[_0x8718('0x1f')](saveUpdates(_0xfadd0b[_0x8718('0x4f')],null))[_0x8718('0x1f')](respondWithResult(_0x439315,null))[_0x8718('0x47')](handleError(_0x439315,null));};exports[_0x8718('0x23')]=function(_0x5d75e9,_0x2dbacb){return db['SquareOdbc'][_0x8718('0x46')]({'where':{'id':_0x5d75e9[_0x8718('0x44')]['id']}})['then'](handleEntityNotFound(_0x2dbacb,null))['then'](removeEntity(_0x2dbacb,null))[_0x8718('0x47')](handleError(_0x2dbacb,null));};exports[_0x8718('0x50')]=function(_0x6acb38,_0x18ecc8,_0x1a3d70){var _0x570c6a;return db['SquareOdbc'][_0x8718('0x46')]({'where':{'id':_0x6acb38['params']['id']},'attributes':['id','dsn']})[_0x8718('0x1f')](handleEntityNotFound(_0x18ecc8,null))[_0x8718('0x1f')](function(_0xfd6838){if(_0xfd6838){var _0x347bcd=require('odbc')();_0x347bcd[_0x8718('0x51')](_0xfd6838['dsn']);_0x347bcd[_0x8718('0x52')]();return _0xfd6838;}})['then'](respondWithResult(_0x18ecc8,null))[_0x8718('0x47')](handleError(_0x18ecc8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 81ae7f1..d803302 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 _0xe3d7=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes','exports','define','square_odbc'];(function(_0x5cfa51,_0x147217){var _0x115035=function(_0x7a37c0){while(--_0x7a37c0){_0x5cfa51['push'](_0x5cfa51['shift']());}};_0x115035(++_0x147217);}(_0xe3d7,0xb0));var _0x7e3d=function(_0x438204,_0x2e2b63){_0x438204=_0x438204-0x0;var _0x284e7b=_0xe3d7[_0x438204];return _0x284e7b;};'use strict';var _=require('lodash');var util=require(_0x7e3d('0x0'));var logger=require(_0x7e3d('0x1'))(_0x7e3d('0x2'));var moment=require(_0x7e3d('0x3'));var BPromise=require(_0x7e3d('0x4'));var rp=require(_0x7e3d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e3d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e3d('0x7'));module[_0x7e3d('0x8')]=function(_0x5cae3c,_0x2e46c1){return _0x5cae3c[_0x7e3d('0x9')]('SquareOdbc',attributes,{'tableName':_0x7e3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3380=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','square_odbc','lodash','util','../../config/logger','moment'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x3380,0xd4));var _0x0338=function(_0xd0f74,_0x47f7d4){_0xd0f74=_0xd0f74-0x0;var _0x1a29eb=_0x3380[_0xd0f74];return _0x1a29eb;};'use strict';var _=require(_0x0338('0x0'));var util=require(_0x0338('0x1'));var logger=require(_0x0338('0x2'))('api');var moment=require(_0x0338('0x3'));var BPromise=require(_0x0338('0x4'));var rp=require(_0x0338('0x5'));var fs=require('fs');var path=require(_0x0338('0x6'));var rimraf=require(_0x0338('0x7'));var config=require(_0x0338('0x8'));var attributes=require(_0x0338('0x9'));module[_0x0338('0xa')]=function(_0x21a2b2,_0xd18707){return _0x21a2b2['define']('SquareOdbc',attributes,{'tableName':_0x0338('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 0e91125..22e3859 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 _0xd7c2=['result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','then','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5b5547,_0xef43b6){var _0x598349=function(_0x245be8){while(--_0x245be8){_0x5b5547['push'](_0x5b5547['shift']());}};_0x598349(++_0xef43b6);}(_0xd7c2,0x1d8));var _0x2d7c=function(_0x2ec37c,_0x561bc8){_0x2ec37c=_0x2ec37c-0x0;var _0x10d4fe=_0xd7c2[_0x2ec37c];return _0x10d4fe;};'use strict';var _=require('lodash');var util=require(_0x2d7c('0x0'));var moment=require(_0x2d7c('0x1'));var BPromise=require(_0x2d7c('0x2'));var rs=require(_0x2d7c('0x3'));var fs=require('fs');var Redis=require(_0x2d7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d7c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d7c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54648a,_0x3b15f2,_0x37055a){return new BPromise(function(_0x4c6e3b,_0x3e0f93){return client[_0x2d7c('0x7')](_0x54648a,_0x37055a)['then'](function(_0x3d0482){logger[_0x2d7c('0x8')](_0x2d7c('0x9'),_0x3b15f2,_0x2d7c('0xa'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3b15f2,'request\x20sent',JSON['stringify'](_0x3d0482));if(_0x3d0482[_0x2d7c('0xb')]){if(_0x3d0482[_0x2d7c('0xb')][_0x2d7c('0xc')]===0x1f4){logger[_0x2d7c('0xb')](_0x2d7c('0x9'),_0x3b15f2,_0x3d0482[_0x2d7c('0xb')][_0x2d7c('0xd')]);return _0x3e0f93(_0x3d0482['error'][_0x2d7c('0xd')]);}logger[_0x2d7c('0xb')](_0x2d7c('0x9'),_0x3b15f2,_0x3d0482[_0x2d7c('0xb')][_0x2d7c('0xd')]);return _0x4c6e3b(_0x3d0482['error']['message']);}else{logger[_0x2d7c('0x8')]('SquareOdbc,\x20%s,\x20%s',_0x3b15f2,_0x2d7c('0xa'));_0x4c6e3b(_0x3d0482[_0x2d7c('0xe')][_0x2d7c('0xd')]);}})[_0x2d7c('0xf')](function(_0x10dec8){logger['error'](_0x2d7c('0x9'),_0x3b15f2,_0x10dec8);_0x3e0f93(_0x10dec8);});});}exports[_0x2d7c('0x10')]=function(_0x3a8e17){var _0x1f89c7=this;return new Promise(function(_0x479ce3,_0x30aee5){return db[_0x2d7c('0x11')][_0x2d7c('0x12')]({'raw':_0x3a8e17['options']?_0x3a8e17[_0x2d7c('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x3a8e17[_0x2d7c('0x13')]?_0x3a8e17['options'][_0x2d7c('0x14')]||null:null,'attributes':_0x3a8e17[_0x2d7c('0x13')]?_0x3a8e17[_0x2d7c('0x13')][_0x2d7c('0x15')]||null:null,'include':_0x3a8e17[_0x2d7c('0x13')]?_0x3a8e17['options'][_0x2d7c('0x16')]?_[_0x2d7c('0x17')](_0x3a8e17[_0x2d7c('0x13')]['include'],function(_0xaf937c){return{'model':db[_0xaf937c[_0x2d7c('0x18')]],'as':_0xaf937c['as'],'attributes':_0xaf937c['attributes'],'include':_0xaf937c[_0x2d7c('0x16')]?_[_0x2d7c('0x17')](_0xaf937c[_0x2d7c('0x16')],function(_0x451e12){return{'model':db[_0x451e12['model']],'as':_0x451e12['as'],'attributes':_0x451e12[_0x2d7c('0x15')],'include':_0x451e12[_0x2d7c('0x16')]?_[_0x2d7c('0x17')](_0x451e12[_0x2d7c('0x16')],function(_0x25a6a3){return{'model':db[_0x25a6a3[_0x2d7c('0x18')]],'as':_0x25a6a3['as'],'attributes':_0x25a6a3[_0x2d7c('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2d7c('0x19')](function(_0x3ecb69){logger[_0x2d7c('0x8')](_0x2d7c('0x10'),_0x3a8e17);logger[_0x2d7c('0x1a')]('ShowSquareOdbc',_0x3a8e17,JSON['stringify'](_0x3ecb69));_0x479ce3(_0x3ecb69);})[_0x2d7c('0xf')](function(_0x21fbbd){logger[_0x2d7c('0xb')]('ShowSquareOdbc',_0x21fbbd['message'],_0x3a8e17);_0x30aee5(_0x1f89c7[_0x2d7c('0xb')](0x1f4,_0x21fbbd[_0x2d7c('0xd')]));});});}; \ No newline at end of file +var _0x876b=['error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','model','map','debug','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0xe78add,_0x237047){var _0x41bf85=function(_0x1253e5){while(--_0x1253e5){_0xe78add['push'](_0xe78add['shift']());}};_0x41bf85(++_0x237047);}(_0x876b,0xa1));var _0xb876=function(_0x3346fa,_0x2a46e2){_0x3346fa=_0x3346fa-0x0;var _0x25a965=_0x876b[_0x3346fa];return _0x25a965;};'use strict';var _=require('lodash');var util=require(_0xb876('0x0'));var moment=require('moment');var BPromise=require(_0xb876('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb876('0x2'));var db=require(_0xb876('0x3'))['db'];var utils=require(_0xb876('0x4'));var logger=require(_0xb876('0x5'))('rpc');var config=require(_0xb876('0x6'));var jayson=require(_0xb876('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20d0f6,_0x4898ec,_0x2c04e2){return new BPromise(function(_0x152b21,_0x2bbe99){return client[_0xb876('0x8')](_0x20d0f6,_0x2c04e2)[_0xb876('0x9')](function(_0x24d00d){logger[_0xb876('0xa')](_0xb876('0xb'),_0x4898ec,_0xb876('0xc'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x4898ec,'request\x20sent',JSON['stringify'](_0x24d00d));if(_0x24d00d[_0xb876('0xd')]){if(_0x24d00d['error'][_0xb876('0xe')]===0x1f4){logger[_0xb876('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4898ec,_0x24d00d['error']['message']);return _0x2bbe99(_0x24d00d[_0xb876('0xd')]['message']);}logger[_0xb876('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4898ec,_0x24d00d['error'][_0xb876('0xf')]);return _0x152b21(_0x24d00d['error'][_0xb876('0xf')]);}else{logger[_0xb876('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x4898ec,_0xb876('0xc'));_0x152b21(_0x24d00d[_0xb876('0x10')][_0xb876('0xf')]);}})[_0xb876('0x11')](function(_0x517b4a){logger[_0xb876('0xd')](_0xb876('0xb'),_0x4898ec,_0x517b4a);_0x2bbe99(_0x517b4a);});});}exports[_0xb876('0x12')]=function(_0x2869f4){var _0x230dba=this;return new Promise(function(_0x53c2c9,_0x287405){return db[_0xb876('0x13')]['find']({'raw':_0x2869f4['options']?_0x2869f4[_0xb876('0x14')][_0xb876('0x15')]===undefined?!![]:![]:!![],'where':_0x2869f4[_0xb876('0x14')]?_0x2869f4[_0xb876('0x14')][_0xb876('0x16')]||null:null,'attributes':_0x2869f4[_0xb876('0x14')]?_0x2869f4['options'][_0xb876('0x17')]||null:null,'include':_0x2869f4[_0xb876('0x14')]?_0x2869f4[_0xb876('0x14')][_0xb876('0x18')]?_['map'](_0x2869f4[_0xb876('0x14')][_0xb876('0x18')],function(_0x224fbb){return{'model':db[_0x224fbb[_0xb876('0x19')]],'as':_0x224fbb['as'],'attributes':_0x224fbb[_0xb876('0x17')],'include':_0x224fbb[_0xb876('0x18')]?_['map'](_0x224fbb['include'],function(_0x1d55be){return{'model':db[_0x1d55be[_0xb876('0x19')]],'as':_0x1d55be['as'],'attributes':_0x1d55be['attributes'],'include':_0x1d55be['include']?_[_0xb876('0x1a')](_0x1d55be[_0xb876('0x18')],function(_0x3534e5){return{'model':db[_0x3534e5['model']],'as':_0x3534e5['as'],'attributes':_0x3534e5[_0xb876('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15e5e2){logger['info']('ShowSquareOdbc',_0x2869f4);logger[_0xb876('0x1b')](_0xb876('0x12'),_0x2869f4,JSON[_0xb876('0x1c')](_0x15e5e2));_0x53c2c9(_0x15e5e2);})[_0xb876('0x11')](function(_0x3a3893){logger['error']('ShowSquareOdbc',_0x3a3893['message'],_0x2869f4);_0x287405(_0x230dba[_0xb876('0xd')](0x1f4,_0x3a3893[_0xb876('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c083ecb..e929c23 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 _0x4c8c=['../../components/interaction/service','./squareProject.controller','get','index','/:id','isAuthenticated','/:id/users','getUsers','post','create','addUsers','put','update','destroy','delete','removeUsers','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4c8c,0x1b3));var _0xc4c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4c8c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc4c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc4c8('0x1'));var express=require(_0xc4c8('0x2'));var router=express[_0xc4c8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc4c8('0x4'));var interaction=require(_0xc4c8('0x5'));var config=require('../../config/environment');var controller=require(_0xc4c8('0x6'));router[_0xc4c8('0x7')]('/',auth['isAuthenticated'](),controller[_0xc4c8('0x8')]);router[_0xc4c8('0x7')](_0xc4c8('0x9'),auth[_0xc4c8('0xa')](),controller['show']);router[_0xc4c8('0x7')](_0xc4c8('0xb'),auth['isAuthenticated'](),controller[_0xc4c8('0xc')]);router[_0xc4c8('0xd')]('/',auth['isAuthenticated'](),controller[_0xc4c8('0xe')]);router[_0xc4c8('0xd')](_0xc4c8('0xb'),auth[_0xc4c8('0xa')](),controller[_0xc4c8('0xf')]);router[_0xc4c8('0x10')](_0xc4c8('0x9'),auth[_0xc4c8('0xa')](),controller[_0xc4c8('0x11')]);router['delete'](_0xc4c8('0x9'),auth[_0xc4c8('0xa')](),controller[_0xc4c8('0x12')]);router[_0xc4c8('0x13')](_0xc4c8('0xb'),auth[_0xc4c8('0xa')](),controller[_0xc4c8('0x14')]);module[_0xc4c8('0x15')]=router; \ No newline at end of file +var _0x826c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','post','create','addUsers','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c6ea2,_0x235789){var _0x3f1e64=function(_0x32cc91){while(--_0x32cc91){_0x4c6ea2['push'](_0x4c6ea2['shift']());}};_0x3f1e64(++_0x235789);}(_0x826c,0xc8));var _0xc826=function(_0x2f10ec,_0x53682a){_0x2f10ec=_0x2f10ec-0x0;var _0x299021=_0x826c[_0x2f10ec];return _0x299021;};'use strict';var multer=require(_0xc826('0x0'));var util=require(_0xc826('0x1'));var path=require(_0xc826('0x2'));var timeout=require(_0xc826('0x3'));var express=require(_0xc826('0x4'));var router=express[_0xc826('0x5')]();var fs_extra=require(_0xc826('0x6'));var auth=require(_0xc826('0x7'));var interaction=require(_0xc826('0x8'));var config=require(_0xc826('0x9'));var controller=require('./squareProject.controller');router[_0xc826('0xa')]('/',auth['isAuthenticated'](),controller[_0xc826('0xb')]);router['get'](_0xc826('0xc'),auth[_0xc826('0xd')](),controller[_0xc826('0xe')]);router[_0xc826('0xa')](_0xc826('0xf'),auth[_0xc826('0xd')](),controller['getUsers']);router[_0xc826('0x10')]('/',auth[_0xc826('0xd')](),controller[_0xc826('0x11')]);router['post'](_0xc826('0xf'),auth['isAuthenticated'](),controller[_0xc826('0x12')]);router['put']('/:id',auth[_0xc826('0xd')](),controller['update']);router[_0xc826('0x13')](_0xc826('0xc'),auth[_0xc826('0xd')](),controller[_0xc826('0x14')]);router['delete'](_0xc826('0xf'),auth['isAuthenticated'](),controller[_0xc826('0x15')]);module[_0xc826('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d979e30..7089cfc 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 _0x67d5=['BLOB','long','getDataValue','preproduction','toString','production','DATE','exports','STRING'];(function(_0x2a8d36,_0x287050){var _0x48ebcf=function(_0xbc481c){while(--_0xbc481c){_0x2a8d36['push'](_0x2a8d36['shift']());}};_0x48ebcf(++_0x287050);}(_0x67d5,0x18a));var _0x567d=function(_0x316274,_0x2a6aa5){_0x316274=_0x316274-0x0;var _0x17086b=_0x67d5[_0x316274];return _0x17086b;};'use strict';var Sequelize=require('sequelize');module[_0x567d('0x0')]={'name':{'type':Sequelize[_0x567d('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x567d('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x567d('0x2')](_0x567d('0x3')),'get':function(){if(this[_0x567d('0x4')](_0x567d('0x5'))){return this[_0x567d('0x4')](_0x567d('0x5'))[_0x567d('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x567d('0x2')](_0x567d('0x3')),'get':function(){if(this[_0x567d('0x4')](_0x567d('0x7'))){return this[_0x567d('0x4')](_0x567d('0x7'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x567d('0x8')]},'publishedAt':{'type':Sequelize[_0x567d('0x8')]}}; \ No newline at end of file +var _0xf40b=['preproduction','toString','utf8','production','DATE','sequelize','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x1d3901,_0x30d63e){var _0x2107bd=function(_0x33b3c1){while(--_0x33b3c1){_0x1d3901['push'](_0x1d3901['shift']());}};_0x2107bd(++_0x30d63e);}(_0xf40b,0xf7));var _0xbf40=function(_0x411511,_0x13b21a){_0x411511=_0x411511-0x0;var _0xda7b33=_0xf40b[_0x411511];return _0xda7b33;};'use strict';var Sequelize=require(_0xbf40('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf40('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbf40('0x1')]},'notes':{'type':Sequelize[_0xbf40('0x2')]},'preproduction':{'type':Sequelize[_0xbf40('0x3')](_0xbf40('0x4')),'get':function(){if(this[_0xbf40('0x5')](_0xbf40('0x6'))){return this[_0xbf40('0x5')]('preproduction')[_0xbf40('0x7')](_0xbf40('0x8'));}}},'production':{'type':Sequelize[_0xbf40('0x3')](_0xbf40('0x4')),'get':function(){if(this[_0xbf40('0x5')](_0xbf40('0x9'))){return this[_0xbf40('0x5')](_0xbf40('0x9'))[_0xbf40('0x7')](_0xbf40('0x8'));}}},'savedAt':{'type':Sequelize[_0xbf40('0xa')]},'publishedAt':{'type':Sequelize[_0xbf40('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0186b89..38d9091 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 _0x4496=['omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','UserProfileResource','destroy','error','stack','name','SquareProject','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','addUsers','ids'];(function(_0x2ed6e0,_0x5571c0){var _0x3df63d=function(_0x1cf19b){while(--_0x1cf19b){_0x2ed6e0['push'](_0x2ed6e0['shift']());}};_0x3df63d(++_0x5571c0);}(_0x4496,0x1dd));var _0x6449=function(_0xcd5b81,_0xffcae4){_0xcd5b81=_0xcd5b81-0x0;var _0x5388ba=_0x4496[_0xcd5b81];return _0x5388ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6449('0x0'));var jsonpatch=require(_0x6449('0x1'));var rp=require(_0x6449('0x2'));var moment=require(_0x6449('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6449('0x4'));var util=require(_0x6449('0x5'));var path=require('path');var sox=require(_0x6449('0x6'));var csv=require(_0x6449('0x7'));var ejs=require(_0x6449('0x8'));var fs=require('fs');var fs_extra=require(_0x6449('0x9'));var _=require(_0x6449('0xa'));var squel=require(_0x6449('0xb'));var crypto=require('crypto');var jsforce=require(_0x6449('0xc'));var deskjs=require(_0x6449('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6449('0xe'));var Papa=require(_0x6449('0xf'));var Redis=require(_0x6449('0x10'));var authService=require(_0x6449('0x11'));var qs=require(_0x6449('0x12'));var as=require(_0x6449('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6449('0x14'));var utils=require(_0x6449('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6449('0x16'));var db=require('../../mysqldb')['db'];config[_0x6449('0x17')]=_[_0x6449('0x18')](config[_0x6449('0x17')],{'host':_0x6449('0x19'),'port':0x18eb});var socket=require(_0x6449('0x1a'))(new Redis(config['redis']));require(_0x6449('0x1b'))[_0x6449('0x1c')](socket);function respondWithStatusCode(_0x48c5c2,_0x26715b){_0x26715b=_0x26715b||0xcc;return function(_0x34908a){if(_0x34908a){return _0x48c5c2[_0x6449('0x1d')](_0x26715b);}return _0x48c5c2[_0x6449('0x1e')](_0x26715b)[_0x6449('0x1f')]();};}function respondWithResult(_0xc8e369,_0x27adaf){_0x27adaf=_0x27adaf||0xc8;return function(_0x12e146){if(_0x12e146){return _0xc8e369[_0x6449('0x1e')](_0x27adaf)[_0x6449('0x20')](_0x12e146);}};}function respondWithFilteredResult(_0x338b37,_0x3b359b){return function(_0x1eff92){if(_0x1eff92){var _0x55290c=typeof _0x3b359b[_0x6449('0x21')]===_0x6449('0x22')&&typeof _0x3b359b[_0x6449('0x23')]===_0x6449('0x22');var _0x281874=_0x1eff92[_0x6449('0x24')];var _0xf6e3ee=_0x55290c?0x0:_0x3b359b['offset'];var _0x247a72=_0x55290c?_0x1eff92[_0x6449('0x24')]:_0x3b359b[_0x6449('0x21')]+_0x3b359b['limit'];var _0x536546;if(_0x247a72>=_0x281874){_0x247a72=_0x281874;_0x536546=0xc8;}else{_0x536546=0xce;}_0x338b37[_0x6449('0x1e')](_0x536546);return _0x338b37[_0x6449('0x25')](_0x6449('0x26'),_0xf6e3ee+'-'+_0x247a72+'/'+_0x281874)[_0x6449('0x20')](_0x1eff92);}return null;};}function patchUpdates(_0x28f629){return function(_0x5c6e8a){try{jsonpatch[_0x6449('0x27')](_0x5c6e8a,_0x28f629,!![]);}catch(_0x2f3df8){return BPromise['reject'](_0x2f3df8);}return _0x5c6e8a['save']();};}function saveUpdates(_0x2e5f84,_0x1e4dcd){return function(_0x3cf9c7){if(_0x3cf9c7){return _0x3cf9c7[_0x6449('0x28')](_0x2e5f84)[_0x6449('0x29')](function(_0x183cd2){return _0x183cd2;});}return null;};}function removeEntity(_0x185386,_0x347a32){return function(_0x265c10){if(_0x265c10){return _0x265c10['destroy']()[_0x6449('0x29')](function(){var _0x17cb5a=_0x265c10['get']({'plain':!![]});var _0x320c01='SquareProjects';return db[_0x6449('0x2a')][_0x6449('0x2b')]({'where':{'type':_0x320c01,'resourceId':_0x17cb5a['id']}})['then'](function(){return _0x265c10;});})[_0x6449('0x29')](function(){_0x185386[_0x6449('0x1e')](0xcc)[_0x6449('0x1f')]();});}};}function handleEntityNotFound(_0x50d9ca,_0x1426a8){return function(_0x474c20){if(!_0x474c20){_0x50d9ca['sendStatus'](0x194);}return _0x474c20;};}function handleError(_0x551ddd,_0x2a4f64){_0x2a4f64=_0x2a4f64||0x1f4;return function(_0x2e209d){logger[_0x6449('0x2c')](_0x2e209d[_0x6449('0x2d')]);if(_0x2e209d[_0x6449('0x2e')]){delete _0x2e209d['name'];}_0x551ddd[_0x6449('0x1e')](_0x2a4f64)['send'](_0x2e209d);};}exports['index']=function(_0x2656b1,_0x32ab78){var _0x15390d={},_0x478c5e={},_0x2bbc39={'count':0x0,'rows':[]};var _0x23706e=_['map'](db[_0x6449('0x2f')]['rawAttributes'],function(_0x398789){return{'name':_0x398789[_0x6449('0x30')],'type':_0x398789[_0x6449('0x31')]['key']};});_0x478c5e['model']=_[_0x6449('0x32')](_0x23706e,'name');_0x478c5e[_0x6449('0x33')]=_[_0x6449('0x34')](_0x2656b1['query']);_0x478c5e[_0x6449('0x35')]=_[_0x6449('0x36')](_0x478c5e[_0x6449('0x37')],_0x478c5e[_0x6449('0x33')]);_0x15390d['attributes']=_['intersection'](_0x478c5e[_0x6449('0x37')],qs[_0x6449('0x38')](_0x2656b1[_0x6449('0x33')][_0x6449('0x38')]));_0x15390d['attributes']=_0x15390d[_0x6449('0x39')][_0x6449('0x3a')]?_0x15390d[_0x6449('0x39')]:_0x478c5e[_0x6449('0x37')];if(!_0x2656b1[_0x6449('0x33')][_0x6449('0x3b')](_0x6449('0x3c'))){_0x15390d[_0x6449('0x23')]=qs[_0x6449('0x23')](_0x2656b1[_0x6449('0x33')][_0x6449('0x23')]);_0x15390d[_0x6449('0x21')]=qs[_0x6449('0x21')](_0x2656b1['query']['offset']);}_0x15390d[_0x6449('0x3d')]=qs[_0x6449('0x3e')](_0x2656b1[_0x6449('0x33')][_0x6449('0x3e')]);_0x15390d[_0x6449('0x3f')]=qs[_0x6449('0x35')](_[_0x6449('0x40')](_0x2656b1[_0x6449('0x33')],_0x478c5e[_0x6449('0x35')]),_0x23706e);if(_0x2656b1[_0x6449('0x33')][_0x6449('0x41')]){_0x15390d[_0x6449('0x3f')]=_[_0x6449('0x42')](_0x15390d[_0x6449('0x3f')],{'$or':_[_0x6449('0x32')](_0x23706e,function(_0xb5d22d){if(_0xb5d22d[_0x6449('0x31')]!=='VIRTUAL'){var _0x8476cb={};_0x8476cb[_0xb5d22d[_0x6449('0x2e')]]={'$like':'%'+_0x2656b1['query'][_0x6449('0x41')]+'%'};return _0x8476cb;}})});}_0x15390d=_['merge']({},_0x15390d,_0x2656b1[_0x6449('0x43')]);var _0x71b2a9={'where':_0x15390d[_0x6449('0x3f')]};return db[_0x6449('0x2f')][_0x6449('0x24')](_0x71b2a9)[_0x6449('0x29')](function(_0x3fd303){_0x2bbc39[_0x6449('0x24')]=_0x3fd303;if(_0x2656b1[_0x6449('0x33')][_0x6449('0x44')]){_0x15390d[_0x6449('0x45')]=[{'all':!![]}];}return db['SquareProject'][_0x6449('0x46')](_0x15390d);})[_0x6449('0x29')](function(_0x237577){_0x2bbc39['rows']=_0x237577;return _0x2bbc39;})[_0x6449('0x29')](respondWithFilteredResult(_0x32ab78,_0x15390d))[_0x6449('0x47')](handleError(_0x32ab78,null));};exports['show']=function(_0x528a36,_0x35e9ea){var _0x186c24={'raw':![],'where':{'id':_0x528a36['params']['id']}},_0x83f898={};_0x83f898[_0x6449('0x37')]=_['keys'](db['SquareProject'][_0x6449('0x48')]);_0x83f898[_0x6449('0x33')]=_[_0x6449('0x34')](_0x528a36[_0x6449('0x33')]);_0x83f898[_0x6449('0x35')]=_[_0x6449('0x36')](_0x83f898['model'],_0x83f898[_0x6449('0x33')]);_0x186c24[_0x6449('0x39')]=_[_0x6449('0x36')](_0x83f898[_0x6449('0x37')],qs['fields'](_0x528a36[_0x6449('0x33')][_0x6449('0x38')]));_0x186c24[_0x6449('0x39')]=_0x186c24[_0x6449('0x39')][_0x6449('0x3a')]?_0x186c24[_0x6449('0x39')]:_0x83f898[_0x6449('0x37')];if(_0x528a36[_0x6449('0x33')]['includeAll']){_0x186c24[_0x6449('0x45')]=[{'all':!![]}];}_0x186c24=_['merge']({},_0x186c24,_0x528a36[_0x6449('0x43')]);return db[_0x6449('0x2f')]['find'](_0x186c24)[_0x6449('0x29')](handleEntityNotFound(_0x35e9ea,null))[_0x6449('0x29')](respondWithResult(_0x35e9ea,null))[_0x6449('0x47')](handleError(_0x35e9ea,null));};exports[_0x6449('0x49')]=function(_0x5257c8,_0x2def43){return db[_0x6449('0x2f')][_0x6449('0x49')](_0x5257c8[_0x6449('0x4a')],{})[_0x6449('0x29')](function(_0x394e5e){var _0x3cfb08=_0x5257c8[_0x6449('0x4b')][_0x6449('0x4c')]({'plain':!![]});if(!_0x3cfb08)throw new Error(_0x6449('0x4d'));if(_0x3cfb08[_0x6449('0x4e')]===_0x6449('0x4b')){var _0x161d44=_0x394e5e['get']({'plain':!![]});var _0x17d752=_0x6449('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x17d752,'userProfileId':_0x3cfb08[_0x6449('0x50')]},'raw':!![]})[_0x6449('0x29')](function(_0xc856c4){if(_0xc856c4&&_0xc856c4[_0x6449('0x51')]===0x0){return db[_0x6449('0x2a')]['create']({'name':_0x161d44[_0x6449('0x2e')],'resourceId':_0x161d44['id'],'type':_0xc856c4['name'],'sectionId':_0xc856c4['id']},{})['then'](function(){return _0x394e5e;});}else{return _0x394e5e;}})['catch'](function(_0x31868a){logger['error'](_0x6449('0x52'),_0x31868a);throw _0x31868a;});}return _0x394e5e;})[_0x6449('0x29')](respondWithResult(_0x2def43,0xc9))[_0x6449('0x47')](handleError(_0x2def43,null));};exports[_0x6449('0x28')]=function(_0x17cabb,_0x4e343c){if(_0x17cabb['body']['id']){delete _0x17cabb[_0x6449('0x4a')]['id'];}return db[_0x6449('0x2f')][_0x6449('0x53')]({'where':{'id':_0x17cabb['params']['id']}})[_0x6449('0x29')](handleEntityNotFound(_0x4e343c,null))[_0x6449('0x29')](saveUpdates(_0x17cabb[_0x6449('0x4a')],null))['then'](respondWithResult(_0x4e343c,null))['catch'](handleError(_0x4e343c,null));};exports['destroy']=function(_0x47ce82,_0x2c6ddc){return db[_0x6449('0x2f')][_0x6449('0x53')]({'where':{'id':_0x47ce82[_0x6449('0x54')]['id']}})[_0x6449('0x29')](handleEntityNotFound(_0x2c6ddc,null))[_0x6449('0x29')](removeEntity(_0x2c6ddc,null))['catch'](handleError(_0x2c6ddc,null));};exports[_0x6449('0x55')]=function(_0x1b5d6a,_0x4c262b,_0xfa64b){return db[_0x6449('0x2f')]['find']({'where':{'id':_0x1b5d6a[_0x6449('0x54')]['id']}})[_0x6449('0x29')](handleEntityNotFound(_0x4c262b,null))[_0x6449('0x29')](function(_0xecf279){if(_0xecf279){return _0xecf279['addUsers'](_0x1b5d6a[_0x6449('0x4a')][_0x6449('0x56')],_[_0x6449('0x57')](_0x1b5d6a['body'],[_0x6449('0x56'),'id'])||{});}})[_0x6449('0x29')](respondWithResult(_0x4c262b,null))[_0x6449('0x47')](handleError(_0x4c262b,null));};exports[_0x6449('0x58')]=function(_0x28f985,_0x10eb92,_0x56c777){return db[_0x6449('0x2f')]['find']({'where':{'id':_0x28f985[_0x6449('0x54')]['id']}})[_0x6449('0x29')](handleEntityNotFound(_0x10eb92,null))[_0x6449('0x29')](function(_0x144118){if(_0x144118){return _0x144118['removeUsers'](_0x28f985[_0x6449('0x33')][_0x6449('0x56')])[_0x6449('0x29')](function(){if(_[_0x6449('0x59')](_0x28f985[_0x6449('0x33')][_0x6449('0x56')])){for(var _0x251fcd=0x0;_0x251fcd<_0x28f985[_0x6449('0x33')][_0x6449('0x56')][_0x6449('0x3a')];_0x251fcd+=0x1){socket[_0x6449('0x5a')](_0x6449('0x5b'),{'UserId':Number(_0x28f985[_0x6449('0x33')][_0x6449('0x56')][_0x251fcd]),'SquareProjectId':Number(_0x28f985[_0x6449('0x54')]['id'])});}}else{socket[_0x6449('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x28f985[_0x6449('0x33')]['ids']),'SquareProjectId':Number(_0x28f985['params']['id'])});}});}})[_0x6449('0x29')](respondWithStatusCode(_0x10eb92,null))[_0x6449('0x47')](handleError(_0x10eb92,null));};exports[_0x6449('0x5c')]=function(_0x5ea878,_0x4a0fec,_0x655de){var _0x5a715a={};var _0x212061={};var _0x21c1ef;var _0x524d67;return db[_0x6449('0x2f')]['findOne']({'where':{'id':_0x5ea878[_0x6449('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a0fec,null))['then'](function(_0x4ba776){if(_0x4ba776){_0x21c1ef=_0x4ba776;_0x212061[_0x6449('0x37')]=_['keys'](db[_0x6449('0x5d')]['rawAttributes']);_0x212061[_0x6449('0x33')]=_[_0x6449('0x34')](_0x5ea878[_0x6449('0x33')]);_0x212061[_0x6449('0x35')]=_['intersection'](_0x212061['model'],_0x212061[_0x6449('0x33')]);_0x5a715a['attributes']=_['intersection'](_0x212061[_0x6449('0x37')],qs['fields'](_0x5ea878['query'][_0x6449('0x38')]));_0x5a715a[_0x6449('0x39')]=_0x5a715a['attributes'][_0x6449('0x3a')]?_0x5a715a[_0x6449('0x39')]:_0x212061[_0x6449('0x37')];_0x5a715a[_0x6449('0x3d')]=qs[_0x6449('0x3e')](_0x5ea878[_0x6449('0x33')]['sort']);_0x5a715a[_0x6449('0x3f')]=qs[_0x6449('0x35')](_[_0x6449('0x40')](_0x5ea878[_0x6449('0x33')],_0x212061[_0x6449('0x35')]));if(_0x5ea878[_0x6449('0x33')][_0x6449('0x41')]){_0x5a715a['where']=_[_0x6449('0x42')](_0x5a715a['where'],{'$or':_[_0x6449('0x32')](_0x5a715a[_0x6449('0x39')],function(_0xdc32fb){var _0x552b25={};_0x552b25[_0xdc32fb]={'$like':'%'+_0x5ea878[_0x6449('0x33')][_0x6449('0x41')]+'%'};return _0x552b25;})});}_0x5a715a=_[_0x6449('0x42')]({},_0x5a715a,_0x5ea878[_0x6449('0x43')]);return _0x21c1ef[_0x6449('0x5c')](_0x5a715a);}})[_0x6449('0x29')](function(_0x40efc6){if(_0x40efc6){_0x524d67=_0x40efc6[_0x6449('0x3a')];if(!_0x5ea878[_0x6449('0x33')][_0x6449('0x3b')](_0x6449('0x3c'))){_0x5a715a[_0x6449('0x23')]=qs[_0x6449('0x23')](_0x5ea878[_0x6449('0x33')][_0x6449('0x23')]);_0x5a715a[_0x6449('0x21')]=qs['offset'](_0x5ea878[_0x6449('0x33')]['offset']);}return _0x21c1ef[_0x6449('0x5c')](_0x5a715a);}})[_0x6449('0x29')](function(_0x46b7dd){if(_0x46b7dd){return _0x46b7dd?{'count':_0x524d67,'rows':_0x46b7dd}:null;}})['then'](respondWithResult(_0x4a0fec,null))[_0x6449('0x47')](handleError(_0x4a0fec,null));}; \ No newline at end of file +var _0x4712=['filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','intersection','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','addUsers','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','rawAttributes','pick','hasOwnProperty','rimraf','zip-dir','fast-json-patch','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/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SquareProject','key','model','query','attributes','fields','length','nolimit','order','sort','filters'];(function(_0x9691c1,_0x3fee65){var _0x106cbf=function(_0x5948a5){while(--_0x5948a5){_0x9691c1['push'](_0x9691c1['shift']());}};_0x106cbf(++_0x3fee65);}(_0x4712,0xe5));var _0x2471=function(_0x30a02e,_0x38185c){_0x30a02e=_0x30a02e-0x0;var _0x1022a9=_0x4712[_0x30a02e];return _0x1022a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2471('0x0'));var zipdir=require(_0x2471('0x1'));var jsonpatch=require(_0x2471('0x2'));var rp=require(_0x2471('0x3'));var moment=require(_0x2471('0x4'));var BPromise=require(_0x2471('0x5'));var Mustache=require('mustache');var util=require(_0x2471('0x6'));var path=require(_0x2471('0x7'));var sox=require('sox');var csv=require(_0x2471('0x8'));var ejs=require(_0x2471('0x9'));var fs=require('fs');var fs_extra=require(_0x2471('0xa'));var _=require(_0x2471('0xb'));var squel=require(_0x2471('0xc'));var crypto=require(_0x2471('0xd'));var jsforce=require(_0x2471('0xe'));var deskjs=require(_0x2471('0xf'));var toCsv=require(_0x2471('0x8'));var querystring=require(_0x2471('0x10'));var Papa=require(_0x2471('0x11'));var Redis=require(_0x2471('0x12'));var authService=require(_0x2471('0x13'));var qs=require(_0x2471('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2471('0x15'));var logger=require(_0x2471('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2471('0x17'));var licenseUtil=require(_0x2471('0x18'));var db=require(_0x2471('0x19'))['db'];config[_0x2471('0x1a')]=_[_0x2471('0x1b')](config[_0x2471('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2471('0x1c'))(new Redis(config[_0x2471('0x1a')]));require('./squareProject.socket')[_0x2471('0x1d')](socket);function respondWithStatusCode(_0x350ff5,_0x5675d5){_0x5675d5=_0x5675d5||0xcc;return function(_0x564b23){if(_0x564b23){return _0x350ff5[_0x2471('0x1e')](_0x5675d5);}return _0x350ff5[_0x2471('0x1f')](_0x5675d5)[_0x2471('0x20')]();};}function respondWithResult(_0x1fdf16,_0x435def){_0x435def=_0x435def||0xc8;return function(_0x3ccea5){if(_0x3ccea5){return _0x1fdf16['status'](_0x435def)[_0x2471('0x21')](_0x3ccea5);}};}function respondWithFilteredResult(_0x132ee7,_0xb731d){return function(_0xeb2322){if(_0xeb2322){var _0x5d3678=typeof _0xb731d['offset']===_0x2471('0x22')&&typeof _0xb731d[_0x2471('0x23')]===_0x2471('0x22');var _0xc46820=_0xeb2322['count'];var _0x1ce145=_0x5d3678?0x0:_0xb731d[_0x2471('0x24')];var _0x7ebf4c=_0x5d3678?_0xeb2322['count']:_0xb731d[_0x2471('0x24')]+_0xb731d['limit'];var _0x122bbf;if(_0x7ebf4c>=_0xc46820){_0x7ebf4c=_0xc46820;_0x122bbf=0xc8;}else{_0x122bbf=0xce;}_0x132ee7[_0x2471('0x1f')](_0x122bbf);return _0x132ee7['set'](_0x2471('0x25'),_0x1ce145+'-'+_0x7ebf4c+'/'+_0xc46820)[_0x2471('0x21')](_0xeb2322);}return null;};}function patchUpdates(_0x5c2057){return function(_0x119dbc){try{jsonpatch[_0x2471('0x26')](_0x119dbc,_0x5c2057,!![]);}catch(_0x4ee866){return BPromise[_0x2471('0x27')](_0x4ee866);}return _0x119dbc[_0x2471('0x28')]();};}function saveUpdates(_0x59c7c2,_0xb31f4e){return function(_0x10e152){if(_0x10e152){return _0x10e152[_0x2471('0x29')](_0x59c7c2)[_0x2471('0x2a')](function(_0x5efd01){return _0x5efd01;});}return null;};}function removeEntity(_0x166d95,_0x4a7e55){return function(_0x5ca66d){if(_0x5ca66d){return _0x5ca66d[_0x2471('0x2b')]()[_0x2471('0x2a')](function(){var _0x4d3f3c=_0x5ca66d[_0x2471('0x2c')]({'plain':!![]});var _0x37bc1a='SquareProjects';return db[_0x2471('0x2d')][_0x2471('0x2b')]({'where':{'type':_0x37bc1a,'resourceId':_0x4d3f3c['id']}})[_0x2471('0x2a')](function(){return _0x5ca66d;});})[_0x2471('0x2a')](function(){_0x166d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ef6a,_0x211639){return function(_0x3d2680){if(!_0x3d2680){_0x10ef6a[_0x2471('0x1e')](0x194);}return _0x3d2680;};}function handleError(_0x24c017,_0x70b83a){_0x70b83a=_0x70b83a||0x1f4;return function(_0x3c20de){logger['error'](_0x3c20de[_0x2471('0x2e')]);if(_0x3c20de[_0x2471('0x2f')]){delete _0x3c20de[_0x2471('0x2f')];}_0x24c017[_0x2471('0x1f')](_0x70b83a)[_0x2471('0x30')](_0x3c20de);};}exports[_0x2471('0x31')]=function(_0x3258a2,_0x4c76d){var _0x5429ec={},_0x30f540={},_0x17a1ec={'count':0x0,'rows':[]};var _0x271ee1=_[_0x2471('0x32')](db[_0x2471('0x33')]['rawAttributes'],function(_0x219102){return{'name':_0x219102['fieldName'],'type':_0x219102['type'][_0x2471('0x34')]};});_0x30f540[_0x2471('0x35')]=_['map'](_0x271ee1,_0x2471('0x2f'));_0x30f540['query']=_['keys'](_0x3258a2[_0x2471('0x36')]);_0x30f540['filters']=_['intersection'](_0x30f540[_0x2471('0x35')],_0x30f540[_0x2471('0x36')]);_0x5429ec[_0x2471('0x37')]=_['intersection'](_0x30f540['model'],qs['fields'](_0x3258a2[_0x2471('0x36')][_0x2471('0x38')]));_0x5429ec[_0x2471('0x37')]=_0x5429ec[_0x2471('0x37')][_0x2471('0x39')]?_0x5429ec[_0x2471('0x37')]:_0x30f540[_0x2471('0x35')];if(!_0x3258a2[_0x2471('0x36')]['hasOwnProperty'](_0x2471('0x3a'))){_0x5429ec['limit']=qs[_0x2471('0x23')](_0x3258a2[_0x2471('0x36')][_0x2471('0x23')]);_0x5429ec[_0x2471('0x24')]=qs[_0x2471('0x24')](_0x3258a2[_0x2471('0x36')][_0x2471('0x24')]);}_0x5429ec[_0x2471('0x3b')]=qs[_0x2471('0x3c')](_0x3258a2['query']['sort']);_0x5429ec['where']=qs[_0x2471('0x3d')](_['pick'](_0x3258a2['query'],_0x30f540[_0x2471('0x3d')]),_0x271ee1);if(_0x3258a2[_0x2471('0x36')][_0x2471('0x3e')]){_0x5429ec[_0x2471('0x3f')]=_[_0x2471('0x40')](_0x5429ec[_0x2471('0x3f')],{'$or':_[_0x2471('0x32')](_0x271ee1,function(_0x29ecf1){if(_0x29ecf1['type']!==_0x2471('0x41')){var _0x945cf8={};_0x945cf8[_0x29ecf1[_0x2471('0x2f')]]={'$like':'%'+_0x3258a2['query'][_0x2471('0x3e')]+'%'};return _0x945cf8;}})});}_0x5429ec=_[_0x2471('0x40')]({},_0x5429ec,_0x3258a2[_0x2471('0x42')]);var _0x47e5bf={'where':_0x5429ec['where']};return db[_0x2471('0x33')]['count'](_0x47e5bf)[_0x2471('0x2a')](function(_0x2ccd33){_0x17a1ec[_0x2471('0x43')]=_0x2ccd33;if(_0x3258a2[_0x2471('0x36')]['includeAll']){_0x5429ec[_0x2471('0x44')]=[{'all':!![]}];}return db['SquareProject'][_0x2471('0x45')](_0x5429ec);})[_0x2471('0x2a')](function(_0x30f021){_0x17a1ec[_0x2471('0x46')]=_0x30f021;return _0x17a1ec;})[_0x2471('0x2a')](respondWithFilteredResult(_0x4c76d,_0x5429ec))['catch'](handleError(_0x4c76d,null));};exports[_0x2471('0x47')]=function(_0x2a1f34,_0x3fd6d6){var _0x56cbbd={'raw':![],'where':{'id':_0x2a1f34[_0x2471('0x48')]['id']}},_0x354f2a={};_0x354f2a[_0x2471('0x35')]=_['keys'](db['SquareProject']['rawAttributes']);_0x354f2a[_0x2471('0x36')]=_[_0x2471('0x49')](_0x2a1f34[_0x2471('0x36')]);_0x354f2a['filters']=_[_0x2471('0x4a')](_0x354f2a['model'],_0x354f2a['query']);_0x56cbbd[_0x2471('0x37')]=_[_0x2471('0x4a')](_0x354f2a[_0x2471('0x35')],qs[_0x2471('0x38')](_0x2a1f34[_0x2471('0x36')]['fields']));_0x56cbbd[_0x2471('0x37')]=_0x56cbbd['attributes'][_0x2471('0x39')]?_0x56cbbd['attributes']:_0x354f2a[_0x2471('0x35')];if(_0x2a1f34[_0x2471('0x36')][_0x2471('0x4b')]){_0x56cbbd[_0x2471('0x44')]=[{'all':!![]}];}_0x56cbbd=_[_0x2471('0x40')]({},_0x56cbbd,_0x2a1f34[_0x2471('0x42')]);return db['SquareProject']['find'](_0x56cbbd)[_0x2471('0x2a')](handleEntityNotFound(_0x3fd6d6,null))['then'](respondWithResult(_0x3fd6d6,null))['catch'](handleError(_0x3fd6d6,null));};exports['create']=function(_0x35c5bb,_0x3e0d55){return db['SquareProject'][_0x2471('0x4c')](_0x35c5bb['body'],{})[_0x2471('0x2a')](function(_0x11bb83){var _0x2e05dd=_0x35c5bb[_0x2471('0x4d')][_0x2471('0x2c')]({'plain':!![]});if(!_0x2e05dd)throw new Error(_0x2471('0x4e'));if(_0x2e05dd[_0x2471('0x4f')]===_0x2471('0x4d')){var _0x22d240=_0x11bb83[_0x2471('0x2c')]({'plain':!![]});var _0x3e993e=_0x2471('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x3e993e,'userProfileId':_0x2e05dd[_0x2471('0x51')]},'raw':!![]})['then'](function(_0x2052af){if(_0x2052af&&_0x2052af[_0x2471('0x52')]===0x0){return db[_0x2471('0x2d')][_0x2471('0x4c')]({'name':_0x22d240[_0x2471('0x2f')],'resourceId':_0x22d240['id'],'type':_0x2052af['name'],'sectionId':_0x2052af['id']},{})[_0x2471('0x2a')](function(){return _0x11bb83;});}else{return _0x11bb83;}})['catch'](function(_0x431b4a){logger[_0x2471('0x53')](_0x2471('0x54'),_0x431b4a);throw _0x431b4a;});}return _0x11bb83;})[_0x2471('0x2a')](respondWithResult(_0x3e0d55,0xc9))[_0x2471('0x55')](handleError(_0x3e0d55,null));};exports['update']=function(_0x512fa4,_0x452a99){if(_0x512fa4[_0x2471('0x56')]['id']){delete _0x512fa4['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x512fa4[_0x2471('0x48')]['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x452a99,null))[_0x2471('0x2a')](saveUpdates(_0x512fa4[_0x2471('0x56')],null))[_0x2471('0x2a')](respondWithResult(_0x452a99,null))[_0x2471('0x55')](handleError(_0x452a99,null));};exports[_0x2471('0x2b')]=function(_0x5a8811,_0x4d4adf){return db[_0x2471('0x33')]['find']({'where':{'id':_0x5a8811['params']['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x4d4adf,null))[_0x2471('0x2a')](removeEntity(_0x4d4adf,null))[_0x2471('0x55')](handleError(_0x4d4adf,null));};exports[_0x2471('0x57')]=function(_0x4d5198,_0x58d6d1,_0x444d4c){return db['SquareProject']['find']({'where':{'id':_0x4d5198[_0x2471('0x48')]['id']}})['then'](handleEntityNotFound(_0x58d6d1,null))[_0x2471('0x2a')](function(_0x3cde4c){if(_0x3cde4c){return _0x3cde4c[_0x2471('0x57')](_0x4d5198[_0x2471('0x56')][_0x2471('0x58')],_['omit'](_0x4d5198['body'],[_0x2471('0x58'),'id'])||{});}})['then'](respondWithResult(_0x58d6d1,null))[_0x2471('0x55')](handleError(_0x58d6d1,null));};exports[_0x2471('0x59')]=function(_0x3b9c30,_0x11980c,_0x2b763e){return db[_0x2471('0x33')]['find']({'where':{'id':_0x3b9c30[_0x2471('0x48')]['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x11980c,null))['then'](function(_0x5eae3c){if(_0x5eae3c){return _0x5eae3c[_0x2471('0x59')](_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')])[_0x2471('0x2a')](function(){if(_[_0x2471('0x5a')](_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')])){for(var _0x21e62e=0x0;_0x21e62e<_0x3b9c30['query']['ids']['length'];_0x21e62e+=0x1){socket['emit'](_0x2471('0x5b'),{'UserId':Number(_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')][_0x21e62e]),'SquareProjectId':Number(_0x3b9c30['params']['id'])});}}else{socket[_0x2471('0x5c')](_0x2471('0x5b'),{'UserId':Number(_0x3b9c30[_0x2471('0x36')][_0x2471('0x58')]),'SquareProjectId':Number(_0x3b9c30['params']['id'])});}});}})[_0x2471('0x2a')](respondWithStatusCode(_0x11980c,null))[_0x2471('0x55')](handleError(_0x11980c,null));};exports[_0x2471('0x5d')]=function(_0x54442c,_0x90ba51,_0x1e066e){var _0x240563={};var _0x59bd46={};var _0x8e61f5;var _0x3e1aff;return db[_0x2471('0x33')]['findOne']({'where':{'id':_0x54442c[_0x2471('0x48')]['id']}})[_0x2471('0x2a')](handleEntityNotFound(_0x90ba51,null))[_0x2471('0x2a')](function(_0x4b4b34){if(_0x4b4b34){_0x8e61f5=_0x4b4b34;_0x59bd46[_0x2471('0x35')]=_[_0x2471('0x49')](db['User'][_0x2471('0x5e')]);_0x59bd46[_0x2471('0x36')]=_[_0x2471('0x49')](_0x54442c['query']);_0x59bd46[_0x2471('0x3d')]=_['intersection'](_0x59bd46[_0x2471('0x35')],_0x59bd46[_0x2471('0x36')]);_0x240563[_0x2471('0x37')]=_['intersection'](_0x59bd46[_0x2471('0x35')],qs[_0x2471('0x38')](_0x54442c[_0x2471('0x36')][_0x2471('0x38')]));_0x240563['attributes']=_0x240563['attributes'][_0x2471('0x39')]?_0x240563[_0x2471('0x37')]:_0x59bd46[_0x2471('0x35')];_0x240563[_0x2471('0x3b')]=qs[_0x2471('0x3c')](_0x54442c['query'][_0x2471('0x3c')]);_0x240563['where']=qs[_0x2471('0x3d')](_[_0x2471('0x5f')](_0x54442c[_0x2471('0x36')],_0x59bd46[_0x2471('0x3d')]));if(_0x54442c[_0x2471('0x36')][_0x2471('0x3e')]){_0x240563[_0x2471('0x3f')]=_[_0x2471('0x40')](_0x240563[_0x2471('0x3f')],{'$or':_[_0x2471('0x32')](_0x240563['attributes'],function(_0x528582){var _0x4bd2e4={};_0x4bd2e4[_0x528582]={'$like':'%'+_0x54442c[_0x2471('0x36')][_0x2471('0x3e')]+'%'};return _0x4bd2e4;})});}_0x240563=_[_0x2471('0x40')]({},_0x240563,_0x54442c[_0x2471('0x42')]);return _0x8e61f5['getUsers'](_0x240563);}})[_0x2471('0x2a')](function(_0x1633a0){if(_0x1633a0){_0x3e1aff=_0x1633a0[_0x2471('0x39')];if(!_0x54442c['query'][_0x2471('0x60')](_0x2471('0x3a'))){_0x240563[_0x2471('0x23')]=qs[_0x2471('0x23')](_0x54442c[_0x2471('0x36')]['limit']);_0x240563[_0x2471('0x24')]=qs[_0x2471('0x24')](_0x54442c[_0x2471('0x36')][_0x2471('0x24')]);}return _0x8e61f5[_0x2471('0x5d')](_0x240563);}})['then'](function(_0x176fb9){if(_0x176fb9){return _0x176fb9?{'count':_0x3e1aff,'rows':_0x176fb9}:null;}})['then'](respondWithResult(_0x90ba51,null))['catch'](handleError(_0x90ba51,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 693fe57..a7dc094 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 _0xe137=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3a29f4,_0x1d36ac){var _0x1e5b0e=function(_0x299294){while(--_0x299294){_0x3a29f4['push'](_0x3a29f4['shift']());}};_0x1e5b0e(++_0x1d36ac);}(_0xe137,0x8c));var _0x7e13=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0xe137[_0x4d7f3f];return _0x5d67cc;};'use strict';var EventEmitter=require(_0x7e13('0x0'));var SquareProject=require(_0x7e13('0x1'))['db'][_0x7e13('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7e13('0x3')](0x0);var events={'afterCreate':_0x7e13('0x4'),'afterUpdate':_0x7e13('0x5'),'afterDestroy':_0x7e13('0x6')};function emitEvent(_0x4388a1){return function(_0x151a3c,_0x228d82,_0x56d498){SquareProjectEvents[_0x7e13('0x7')](_0x4388a1+':'+_0x151a3c['id'],_0x151a3c);SquareProjectEvents[_0x7e13('0x7')](_0x4388a1,_0x151a3c);_0x56d498(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x7e13('0x8')](e,emitEvent(event));}}module[_0x7e13('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x9252=['emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','save','remove'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x9252,0x164));var _0x2925=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9252[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x2925('0x0'))['db'][_0x2925('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2925('0x2'),'afterUpdate':'update','afterDestroy':_0x2925('0x3')};function emitEvent(_0x5a825e){return function(_0x14fc60,_0x43ddab,_0x356246){SquareProjectEvents[_0x2925('0x4')](_0x5a825e+':'+_0x14fc60['id'],_0x14fc60);SquareProjectEvents['emit'](_0x5a825e,_0x14fc60);_0x356246(null);};}for(var e in events){if(events[_0x2925('0x5')](e)){var event=events[e];SquareProject[_0x2925('0x6')](e,emitEvent(event));}}module[_0x2925('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 3810e4f..14f7b36 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 _0x51c6=['changed','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x51c6,0x10b));var _0x651c=function(_0x39d6f7,_0x3b5646){_0x39d6f7=_0x39d6f7-0x0;var _0x4edbf1=_0x51c6[_0x39d6f7];return _0x4edbf1;};'use strict';var _=require(_0x651c('0x0'));var util=require(_0x651c('0x1'));var logger=require(_0x651c('0x2'))(_0x651c('0x3'));var moment=require('moment');var BPromise=require(_0x651c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x651c('0x5'));var rimraf=require(_0x651c('0x6'));var config=require(_0x651c('0x7'));var attributes=require(_0x651c('0x8'));module[_0x651c('0x9')]=function(_0x5bfb29,_0x11e592){return _0x5bfb29[_0x651c('0xa')](_0x651c('0xb'),attributes,{'tableName':_0x651c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42e858,_0x2447c1,_0x276e54){if(_0x42e858[_0x651c('0xd')](_0x651c('0xe'))){_0x42e858[_0x651c('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x42e858[_0x651c('0xd')](_0x651c('0x10'))){_0x42e858[_0x651c('0x11')]=moment()[_0x651c('0x12')](_0x651c('0x13'));}_0x276e54(null,_0x42e858);}}});}; \ No newline at end of file +var _0x08f6=['changed','production','publishedAt','lodash','util','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5c2831,_0x33a580){var _0x36ac43=function(_0x52e503){while(--_0x52e503){_0x5c2831['push'](_0x5c2831['shift']());}};_0x36ac43(++_0x33a580);}(_0x08f6,0xc6));var _0x608f=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x08f6[_0x130d82];return _0x112070;};'use strict';var _=require(_0x608f('0x0'));var util=require(_0x608f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x608f('0x2'));var fs=require('fs');var path=require(_0x608f('0x3'));var rimraf=require(_0x608f('0x4'));var config=require('../../config/environment');var attributes=require(_0x608f('0x5'));module['exports']=function(_0xe2671,_0x4d6eb3){return _0xe2671[_0x608f('0x6')](_0x608f('0x7'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x88eabb,_0x3a2c8f,_0x4218ae){if(_0x88eabb['changed'](_0x608f('0x8'))){_0x88eabb[_0x608f('0x9')]=moment()[_0x608f('0xa')](_0x608f('0xb'));}if(_0x88eabb[_0x608f('0xc')](_0x608f('0xd'))){_0x88eabb[_0x608f('0xe')]=moment()[_0x608f('0xa')](_0x608f('0xb'));}_0x4218ae(null,_0x88eabb);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3b609eb..66044a5 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 _0x6063=['info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','include','map','model','ShowSquareProject','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./squareProject.socket','register','request','then'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x6063,0xea));var _0x3606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6063[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3606('0x0'));var moment=require(_0x3606('0x1'));var BPromise=require(_0x3606('0x2'));var rs=require(_0x3606('0x3'));var fs=require('fs');var Redis=require(_0x3606('0x4'));var db=require(_0x3606('0x5'))['db'];var utils=require(_0x3606('0x6'));var logger=require(_0x3606('0x7'))(_0x3606('0x8'));var config=require(_0x3606('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3606('0xa')][_0x3606('0xb')]({'port':0x232a});config[_0x3606('0xc')]=_['defaults'](config[_0x3606('0xc')],{'host':_0x3606('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3606('0xc')]));require(_0x3606('0xe'))[_0x3606('0xf')](socket);function respondWithRpcPromise(_0x9b8923,_0x2c784f,_0x1f1afc){return new BPromise(function(_0x39cb81,_0x82afd){return client[_0x3606('0x10')](_0x9b8923,_0x1f1afc)[_0x3606('0x11')](function(_0x57900e){logger[_0x3606('0x12')](_0x3606('0x13'),_0x2c784f,_0x3606('0x14'));logger[_0x3606('0x15')](_0x3606('0x16'),_0x2c784f,_0x3606('0x14'),JSON[_0x3606('0x17')](_0x57900e));if(_0x57900e['error']){if(_0x57900e[_0x3606('0x18')][_0x3606('0x19')]===0x1f4){logger['error'](_0x3606('0x13'),_0x2c784f,_0x57900e['error'][_0x3606('0x1a')]);return _0x82afd(_0x57900e[_0x3606('0x18')][_0x3606('0x1a')]);}logger[_0x3606('0x18')](_0x3606('0x13'),_0x2c784f,_0x57900e[_0x3606('0x18')]['message']);return _0x39cb81(_0x57900e['error'][_0x3606('0x1a')]);}else{logger[_0x3606('0x12')](_0x3606('0x13'),_0x2c784f,_0x3606('0x14'));_0x39cb81(_0x57900e[_0x3606('0x1b')][_0x3606('0x1a')]);}})[_0x3606('0x1c')](function(_0xad0448){logger[_0x3606('0x18')](_0x3606('0x13'),_0x2c784f,_0xad0448);_0x82afd(_0xad0448);});});}exports['ShowSquareProject']=function(_0x3b08e1){var _0x42264f=this;return new Promise(function(_0x3b0a48,_0x5aff12){return db['SquareProject']['find']({'raw':_0x3b08e1['options']?_0x3b08e1[_0x3606('0x1d')][_0x3606('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b08e1[_0x3606('0x1d')]?_0x3b08e1['options']['where']||null:null,'attributes':_0x3b08e1[_0x3606('0x1d')]?_0x3b08e1[_0x3606('0x1d')][_0x3606('0x1f')]||null:null,'include':_0x3b08e1[_0x3606('0x1d')]?_0x3b08e1[_0x3606('0x1d')][_0x3606('0x20')]?_[_0x3606('0x21')](_0x3b08e1[_0x3606('0x1d')][_0x3606('0x20')],function(_0x1f3226){return{'model':db[_0x1f3226[_0x3606('0x22')]],'as':_0x1f3226['as'],'attributes':_0x1f3226[_0x3606('0x1f')],'include':_0x1f3226[_0x3606('0x20')]?_[_0x3606('0x21')](_0x1f3226[_0x3606('0x20')],function(_0xbadb1c){return{'model':db[_0xbadb1c['model']],'as':_0xbadb1c['as'],'attributes':_0xbadb1c[_0x3606('0x1f')],'include':_0xbadb1c[_0x3606('0x20')]?_['map'](_0xbadb1c[_0x3606('0x20')],function(_0x5c96db){return{'model':db[_0x5c96db[_0x3606('0x22')]],'as':_0x5c96db['as'],'attributes':_0x5c96db['attributes']};}):[]};}):[]};}):[]:[]})[_0x3606('0x11')](function(_0x2b6d47){logger[_0x3606('0x12')](_0x3606('0x23'),_0x3b08e1);logger[_0x3606('0x15')](_0x3606('0x23'),_0x3b08e1,JSON[_0x3606('0x17')](_0x2b6d47));_0x3b0a48(_0x2b6d47);})[_0x3606('0x1c')](function(_0x77247a){logger[_0x3606('0x18')](_0x3606('0x23'),_0x77247a[_0x3606('0x1a')],_0x3b08e1);_0x5aff12(_0x42264f['error'](0x1f4,_0x77247a[_0x3606('0x1a')]));});});}; \ No newline at end of file +var _0x632e=['SquareProject,\x20%s,\x20%s,\x20%s','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','SquareProject','options','raw','where','attributes','include','map','model','ShowSquareProject','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./squareProject.socket','register','request','then','info','request\x20sent','debug'];(function(_0x12d573,_0x20ae28){var _0x5c7071=function(_0x16ea02){while(--_0x16ea02){_0x12d573['push'](_0x12d573['shift']());}};_0x5c7071(++_0x20ae28);}(_0x632e,0x1b3));var _0xe632=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x632e[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0xe632('0x0'));var util=require('util');var moment=require(_0xe632('0x1'));var BPromise=require(_0xe632('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe632('0x3'));var db=require(_0xe632('0x4'))['db'];var utils=require(_0xe632('0x5'));var logger=require(_0xe632('0x6'))(_0xe632('0x7'));var config=require(_0xe632('0x8'));var jayson=require(_0xe632('0x9'));var client=jayson[_0xe632('0xa')][_0xe632('0xb')]({'port':0x232a});config[_0xe632('0xc')]=_[_0xe632('0xd')](config[_0xe632('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe632('0xc')]));require(_0xe632('0xe'))[_0xe632('0xf')](socket);function respondWithRpcPromise(_0x3f2610,_0x341879,_0x296767){return new BPromise(function(_0x1c1c30,_0x522657){return client[_0xe632('0x10')](_0x3f2610,_0x296767)[_0xe632('0x11')](function(_0x69240c){logger[_0xe632('0x12')]('SquareProject,\x20%s,\x20%s',_0x341879,_0xe632('0x13'));logger[_0xe632('0x14')](_0xe632('0x15'),_0x341879,'request\x20sent',JSON['stringify'](_0x69240c));if(_0x69240c[_0xe632('0x16')]){if(_0x69240c[_0xe632('0x16')][_0xe632('0x17')]===0x1f4){logger[_0xe632('0x16')](_0xe632('0x18'),_0x341879,_0x69240c[_0xe632('0x16')][_0xe632('0x19')]);return _0x522657(_0x69240c[_0xe632('0x16')][_0xe632('0x19')]);}logger[_0xe632('0x16')](_0xe632('0x18'),_0x341879,_0x69240c['error'][_0xe632('0x19')]);return _0x1c1c30(_0x69240c[_0xe632('0x16')][_0xe632('0x19')]);}else{logger[_0xe632('0x12')](_0xe632('0x18'),_0x341879,_0xe632('0x13'));_0x1c1c30(_0x69240c[_0xe632('0x1a')][_0xe632('0x19')]);}})[_0xe632('0x1b')](function(_0x9fcf53){logger[_0xe632('0x16')](_0xe632('0x18'),_0x341879,_0x9fcf53);_0x522657(_0x9fcf53);});});}exports['ShowSquareProject']=function(_0x5306ba){var _0x5e93aa=this;return new Promise(function(_0x4bc62e,_0x536c8c){return db[_0xe632('0x1c')]['find']({'raw':_0x5306ba['options']?_0x5306ba[_0xe632('0x1d')][_0xe632('0x1e')]===undefined?!![]:![]:!![],'where':_0x5306ba[_0xe632('0x1d')]?_0x5306ba[_0xe632('0x1d')][_0xe632('0x1f')]||null:null,'attributes':_0x5306ba['options']?_0x5306ba['options'][_0xe632('0x20')]||null:null,'include':_0x5306ba[_0xe632('0x1d')]?_0x5306ba[_0xe632('0x1d')][_0xe632('0x21')]?_[_0xe632('0x22')](_0x5306ba[_0xe632('0x1d')][_0xe632('0x21')],function(_0x5f0370){return{'model':db[_0x5f0370[_0xe632('0x23')]],'as':_0x5f0370['as'],'attributes':_0x5f0370[_0xe632('0x20')],'include':_0x5f0370[_0xe632('0x21')]?_[_0xe632('0x22')](_0x5f0370[_0xe632('0x21')],function(_0x31d269){return{'model':db[_0x31d269[_0xe632('0x23')]],'as':_0x31d269['as'],'attributes':_0x31d269[_0xe632('0x20')],'include':_0x31d269['include']?_[_0xe632('0x22')](_0x31d269[_0xe632('0x21')],function(_0x5d6dfa){return{'model':db[_0x5d6dfa[_0xe632('0x23')]],'as':_0x5d6dfa['as'],'attributes':_0x5d6dfa[_0xe632('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe632('0x11')](function(_0x35e21f){logger['info'](_0xe632('0x24'),_0x5306ba);logger[_0xe632('0x14')](_0xe632('0x24'),_0x5306ba,JSON[_0xe632('0x25')](_0x35e21f));_0x4bc62e(_0x35e21f);})[_0xe632('0x1b')](function(_0x38737d){logger[_0xe632('0x16')](_0xe632('0x24'),_0x38737d[_0xe632('0x19')],_0x5306ba);_0x536c8c(_0x5e93aa[_0xe632('0x16')](0x1f4,_0x38737d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 97a9401..41a7c87 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 _0x947b=['update','removeListener','register','length','./squareProject.events','remove'];(function(_0x2b271,_0x7be48f){var _0x2af81b=function(_0x141c34){while(--_0x141c34){_0x2b271['push'](_0x2b271['shift']());}};_0x2af81b(++_0x7be48f);}(_0x947b,0x8e));var _0xb947=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x947b[_0x3bf83f];return _0x22c4a9;};'use strict';var SquareProjectEvents=require(_0xb947('0x0'));var events=['save',_0xb947('0x1'),_0xb947('0x2')];function createListener(_0x43112,_0x2bebee){return function(_0x4d394e){_0x2bebee['emit'](_0x43112,_0x4d394e);};}function removeListener(_0x11f5a7,_0x2a625c){return function(){SquareProjectEvents[_0xb947('0x3')](_0x11f5a7,_0x2a625c);};}exports[_0xb947('0x4')]=function(_0x103087){for(var _0x339f78=0x0,_0x2d6478=events[_0xb947('0x5')];_0x339f78<_0x2d6478;_0x339f78++){var _0x2fb4d1=events[_0x339f78];var _0x1c03af=createListener('squareProject:'+_0x2fb4d1,_0x103087);SquareProjectEvents['on'](_0x2fb4d1,_0x1c03af);}}; \ No newline at end of file +var _0x719a=['length','squareProject:','./squareProject.events','save','remove','emit','removeListener'];(function(_0x229b16,_0x432da1){var _0x934bd4=function(_0x4a4ed4){while(--_0x4a4ed4){_0x229b16['push'](_0x229b16['shift']());}};_0x934bd4(++_0x432da1);}(_0x719a,0x80));var _0xa719=function(_0x3d71d1,_0x4f10d0){_0x3d71d1=_0x3d71d1-0x0;var _0x5df68a=_0x719a[_0x3d71d1];return _0x5df68a;};'use strict';var SquareProjectEvents=require(_0xa719('0x0'));var events=[_0xa719('0x1'),_0xa719('0x2'),'update'];function createListener(_0x549e33,_0x5d06d0){return function(_0x54efce){_0x5d06d0[_0xa719('0x3')](_0x549e33,_0x54efce);};}function removeListener(_0x797368,_0x358cb3){return function(){SquareProjectEvents[_0xa719('0x4')](_0x797368,_0x358cb3);};}exports['register']=function(_0x2c4208){for(var _0x27126f=0x0,_0x4aada1=events[_0xa719('0x5')];_0x27126f<_0x4aada1;_0x27126f++){var _0x53fdd5=events[_0x27126f];var _0x508974=createListener(_0xa719('0x6')+_0x53fdd5,_0x2c4208);SquareProjectEvents['on'](_0x53fdd5,_0x508974);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index a4b50fe..3344b7a 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(_0xd75335,_0x51018f){var _0x3b4eef=function(_0x51fb24){while(--_0x51fb24){_0xd75335['push'](_0xd75335['shift']());}};_0x3b4eef(++_0x51018f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x21047d,_0x143ebd){_0x21047d=_0x21047d-0x0;var _0x48a088=_0x1cb9[_0x21047d];return _0x48a088;};'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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x1cdf2e,_0x1ff831){var _0x677952=function(_0x5752b7){while(--_0x5752b7){_0x1cdf2e['push'](_0x1cdf2e['shift']());}};_0x677952(++_0x1ff831);}(_0xe14b,0x93));var _0xbe14=function(_0x9b9e98,_0x372c4c){_0x9b9e98=_0x9b9e98-0x0;var _0x2893eb=_0xe14b[_0x9b9e98];return _0x2893eb;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b31ab7c..6dd0f48 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 _0x1cb9=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0x50c186,_0xf7791){var _0x1da419=function(_0x17b339){while(--_0x17b339){_0x50c186['push'](_0x50c186['shift']());}};_0x1da419(++_0xf7791);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2f864a,_0x3d0287){_0x2f864a=_0x2f864a-0x0;var _0x515dcf=_0x1cb9[_0x2f864a];return _0x515dcf;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'callerid':{'type':Sequelize[_0x91cb('0x1')]},'calleridname':{'type':Sequelize[_0x91cb('0x1')]},'context':{'type':Sequelize[_0x91cb('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x91cb('0x1')]},'accountcode':{'type':Sequelize[_0x91cb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x91cb('0x1')]},'saveName':{'type':Sequelize[_0x91cb('0x1')]},'filename':{'type':Sequelize[_0x91cb('0x1')]},'savePath':{'type':Sequelize[_0x91cb('0x1')]},'format':{'type':Sequelize[_0x91cb('0x2')],'get':function(){var _0x8f8a3b='';var _0x4c1f56=this[_0x91cb('0x3')]('savePath');if(_0x4c1f56){_0x8f8a3b=_0x4c1f56[_0x91cb('0x4')](_0x4c1f56['lastIndexOf']('.'));}return _0x8f8a3b;}}}; \ No newline at end of file +var _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x284019,_0x47c521){var _0x1c5fd5=function(_0x1c7e8e){while(--_0x1c7e8e){_0x284019['push'](_0x284019['shift']());}};_0x1c5fd5(++_0x47c521);}(_0x425d,0x1e0));var _0xd425=function(_0x4e7bb4,_0x42572c){_0x4e7bb4=_0x4e7bb4-0x0;var _0x456e48=_0x425d[_0x4e7bb4];return _0x456e48;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1e2b17d..494ac94 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 _0x1af7=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','save','then','destroy','sendStatus','error','stack','name','send','map','SquareRecording','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','body','update','params','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','secrets','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x54ffc2,_0x340c6c){var _0xbb9510=function(_0x457f21){while(--_0x457f21){_0x54ffc2['push'](_0x54ffc2['shift']());}};_0xbb9510(++_0x340c6c);}(_0x1af7,0x1d6));var _0x71af=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1af7[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x71af('0x0'));var rimraf=require(_0x71af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x71af('0x2'));var rp=require('request-promise');var moment=require(_0x71af('0x3'));var BPromise=require(_0x71af('0x4'));var Mustache=require(_0x71af('0x5'));var util=require(_0x71af('0x6'));var path=require(_0x71af('0x7'));var sox=require('sox');var csv=require(_0x71af('0x8'));var ejs=require(_0x71af('0x9'));var fs=require('fs');var fs_extra=require(_0x71af('0xa'));var _=require(_0x71af('0xb'));var squel=require(_0x71af('0xc'));var crypto=require(_0x71af('0xd'));var jsforce=require(_0x71af('0xe'));var deskjs=require(_0x71af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x71af('0x10'));var Papa=require(_0x71af('0x11'));var Redis=require('ioredis');var authService=require(_0x71af('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x71af('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71af('0x14'))('api');var utils=require(_0x71af('0x15'));var config=require(_0x71af('0x16'));var licenseUtil=require(_0x71af('0x17'));var db=require(_0x71af('0x18'))['db'];function respondWithStatusCode(_0x287a0b,_0x25f7ff){_0x25f7ff=_0x25f7ff||0xcc;return function(_0x212411){if(_0x212411){return _0x287a0b['sendStatus'](_0x25f7ff);}return _0x287a0b[_0x71af('0x19')](_0x25f7ff)[_0x71af('0x1a')]();};}function respondWithResult(_0x415a25,_0x18d622){_0x18d622=_0x18d622||0xc8;return function(_0x418d70){if(_0x418d70){return _0x415a25[_0x71af('0x19')](_0x18d622)['json'](_0x418d70);}};}function respondWithFilteredResult(_0x6ddbc8,_0x45adcb){return function(_0x1b02ed){if(_0x1b02ed){var _0x40520f=typeof _0x45adcb['offset']===_0x71af('0x1b')&&typeof _0x45adcb[_0x71af('0x1c')]===_0x71af('0x1b');var _0x4895b1=_0x1b02ed[_0x71af('0x1d')];var _0x4f7fa9=_0x40520f?0x0:_0x45adcb[_0x71af('0x1e')];var _0x322d25=_0x40520f?_0x1b02ed['count']:_0x45adcb[_0x71af('0x1e')]+_0x45adcb[_0x71af('0x1c')];var _0x32ba98;if(_0x322d25>=_0x4895b1){_0x322d25=_0x4895b1;_0x32ba98=0xc8;}else{_0x32ba98=0xce;}_0x6ddbc8[_0x71af('0x19')](_0x32ba98);return _0x6ddbc8[_0x71af('0x1f')]('Content-Range',_0x4f7fa9+'-'+_0x322d25+'/'+_0x4895b1)[_0x71af('0x20')](_0x1b02ed);}return null;};}function patchUpdates(_0x447cf9){return function(_0x5eb1da){try{jsonpatch[_0x71af('0x21')](_0x5eb1da,_0x447cf9,!![]);}catch(_0x7a3afd){return BPromise['reject'](_0x7a3afd);}return _0x5eb1da[_0x71af('0x22')]();};}function saveUpdates(_0x4dfec2,_0x57e82d){return function(_0x56e275){if(_0x56e275){return _0x56e275['update'](_0x4dfec2)[_0x71af('0x23')](function(_0x42b8ce){return _0x42b8ce;});}return null;};}function removeEntity(_0xfd940f,_0x5d229b){return function(_0x33f063){if(_0x33f063){return _0x33f063[_0x71af('0x24')]()['then'](function(){_0xfd940f[_0x71af('0x19')](0xcc)[_0x71af('0x1a')]();});}};}function handleEntityNotFound(_0x5544d6,_0x1f5e54){return function(_0x344c91){if(!_0x344c91){_0x5544d6[_0x71af('0x25')](0x194);}return _0x344c91;};}function handleError(_0x4ad1ce,_0x43b755){_0x43b755=_0x43b755||0x1f4;return function(_0x40610e){logger[_0x71af('0x26')](_0x40610e[_0x71af('0x27')]);if(_0x40610e[_0x71af('0x28')]){delete _0x40610e[_0x71af('0x28')];}_0x4ad1ce[_0x71af('0x19')](_0x43b755)[_0x71af('0x29')](_0x40610e);};}exports['index']=function(_0x10d4b4,_0x51a983){var _0x56599f={},_0x1a361d={},_0x3107ed={'count':0x0,'rows':[]};var _0x1bbdec=_[_0x71af('0x2a')](db[_0x71af('0x2b')]['rawAttributes'],function(_0x1edf07){return{'name':_0x1edf07[_0x71af('0x2c')],'type':_0x1edf07[_0x71af('0x2d')][_0x71af('0x2e')]};});_0x1a361d['model']=_[_0x71af('0x2a')](_0x1bbdec,'name');_0x1a361d[_0x71af('0x2f')]=_[_0x71af('0x30')](_0x10d4b4[_0x71af('0x2f')]);_0x1a361d[_0x71af('0x31')]=_[_0x71af('0x32')](_0x1a361d[_0x71af('0x33')],_0x1a361d[_0x71af('0x2f')]);_0x56599f['attributes']=_['intersection'](_0x1a361d[_0x71af('0x33')],qs[_0x71af('0x34')](_0x10d4b4['query'][_0x71af('0x34')]));_0x56599f['attributes']=_0x56599f[_0x71af('0x35')]['length']?_0x56599f[_0x71af('0x35')]:_0x1a361d['model'];if(!_0x10d4b4[_0x71af('0x2f')][_0x71af('0x36')](_0x71af('0x37'))){_0x56599f['limit']=qs[_0x71af('0x1c')](_0x10d4b4[_0x71af('0x2f')]['limit']);_0x56599f[_0x71af('0x1e')]=qs[_0x71af('0x1e')](_0x10d4b4['query'][_0x71af('0x1e')]);}_0x56599f[_0x71af('0x38')]=qs[_0x71af('0x39')](_0x10d4b4['query'][_0x71af('0x39')]);_0x56599f['where']=qs[_0x71af('0x31')](_[_0x71af('0x3a')](_0x10d4b4[_0x71af('0x2f')],_0x1a361d[_0x71af('0x31')]),_0x1bbdec);if(_0x10d4b4[_0x71af('0x2f')][_0x71af('0x3b')]){_0x56599f[_0x71af('0x3c')]=_[_0x71af('0x3d')](_0x56599f[_0x71af('0x3c')],{'$or':_[_0x71af('0x2a')](_0x1bbdec,function(_0xa1fc5e){if(_0xa1fc5e['type']!==_0x71af('0x3e')){var _0x5daf0b={};_0x5daf0b[_0xa1fc5e[_0x71af('0x28')]]={'$like':'%'+_0x10d4b4[_0x71af('0x2f')][_0x71af('0x3b')]+'%'};return _0x5daf0b;}})});}_0x56599f=_[_0x71af('0x3d')]({},_0x56599f,_0x10d4b4[_0x71af('0x3f')]);var _0xfb9ab9={'where':_0x56599f[_0x71af('0x3c')]};return db['SquareRecording'][_0x71af('0x1d')](_0xfb9ab9)[_0x71af('0x23')](function(_0xaa09fb){_0x3107ed[_0x71af('0x1d')]=_0xaa09fb;if(_0x10d4b4[_0x71af('0x2f')]['includeAll']){_0x56599f[_0x71af('0x40')]=[{'all':!![]}];}return db[_0x71af('0x2b')][_0x71af('0x41')](_0x56599f);})['then'](function(_0x24f4a0){_0x3107ed[_0x71af('0x42')]=_0x24f4a0;return _0x3107ed;})[_0x71af('0x23')](respondWithFilteredResult(_0x51a983,_0x56599f))[_0x71af('0x43')](handleError(_0x51a983,null));};exports[_0x71af('0x44')]=function(_0xc2ce0e,_0x67ca3b){var _0x138a3c={'raw':!![],'where':{'id':_0xc2ce0e['params']['id']}},_0x1ee4ba={};_0x1ee4ba[_0x71af('0x33')]=_[_0x71af('0x30')](db['SquareRecording'][_0x71af('0x45')]);_0x1ee4ba[_0x71af('0x2f')]=_['keys'](_0xc2ce0e[_0x71af('0x2f')]);_0x1ee4ba[_0x71af('0x31')]=_[_0x71af('0x32')](_0x1ee4ba['model'],_0x1ee4ba[_0x71af('0x2f')]);_0x138a3c[_0x71af('0x35')]=_['intersection'](_0x1ee4ba[_0x71af('0x33')],qs[_0x71af('0x34')](_0xc2ce0e['query']['fields']));_0x138a3c['attributes']=_0x138a3c[_0x71af('0x35')][_0x71af('0x46')]?_0x138a3c['attributes']:_0x1ee4ba[_0x71af('0x33')];if(_0xc2ce0e[_0x71af('0x2f')][_0x71af('0x47')]){_0x138a3c['include']=[{'all':!![]}];}_0x138a3c=_['merge']({},_0x138a3c,_0xc2ce0e['options']);return db[_0x71af('0x2b')][_0x71af('0x48')](_0x138a3c)[_0x71af('0x23')](handleEntityNotFound(_0x67ca3b,null))['then'](respondWithResult(_0x67ca3b,null))['catch'](handleError(_0x67ca3b,null));};exports[_0x71af('0x49')]=function(_0xbf4608,_0x22edae){return db['SquareRecording'][_0x71af('0x49')](_0xbf4608[_0x71af('0x4a')],{})['then'](respondWithResult(_0x22edae,0xc9))[_0x71af('0x43')](handleError(_0x22edae,null));};exports[_0x71af('0x4b')]=function(_0x4d45e8,_0x25dbb8){if(_0x4d45e8[_0x71af('0x4a')]['id']){delete _0x4d45e8[_0x71af('0x4a')]['id'];}return db[_0x71af('0x2b')][_0x71af('0x48')]({'where':{'id':_0x4d45e8[_0x71af('0x4c')]['id']}})[_0x71af('0x23')](handleEntityNotFound(_0x25dbb8,null))[_0x71af('0x23')](saveUpdates(_0x4d45e8[_0x71af('0x4a')],null))[_0x71af('0x23')](respondWithResult(_0x25dbb8,null))[_0x71af('0x43')](handleError(_0x25dbb8,null));};exports[_0x71af('0x4d')]=function(_0x524951,_0xcb29a6,_0x1b5831){var _0x2c83f3=require(_0x71af('0x4e'));var _0xa6cde0=![];var _0x4556b0={};if(_0x524951[_0x71af('0x2f')][_0x71af('0x2d')]&&_0x524951[_0x71af('0x2f')][_0x71af('0x2d')]===_0x71af('0x4f')){_0x4556b0[_0x71af('0x4f')]=_0x524951[_0x71af('0x4c')]['id'];}else{_0x4556b0['id']=_0x524951[_0x71af('0x4c')]['id'];}return db[_0x71af('0x2b')]['find']({'where':_0x4556b0,'attributes':['id',_0x71af('0x50'),_0x71af('0x51')],'raw':!![]})[_0x71af('0x23')](handleEntityNotFound(_0xcb29a6,null))['then'](function(_0x2048a1){if(_0x2048a1){var _0x57473a=_0x2048a1[_0x71af('0x50')];var _0x17655a=util[_0x71af('0x52')]('%s.cypher',_0x57473a);if(fs[_0x71af('0x53')](_0x17655a)){_0xa6cde0=!![];return _0x2c83f3['decryptFile'](_0x17655a,_0x57473a,config[_0x71af('0x54')]['recording'])['then'](function(){return _0x2048a1;});}return _0x2048a1;}})[_0x71af('0x23')](function(_0x26ffbd){if(_0x26ffbd){var _0x2c4ab7=_0x26ffbd[_0x71af('0x50')];if(!fs['existsSync'](_0x2c4ab7)){throw new db['Sequelize']['ValidationError'](_0x71af('0x55'));}if(_0x26ffbd[_0x71af('0x51')]){return _0xcb29a6['download'](_0x2c4ab7,_0x26ffbd[_0x71af('0x51')]+path[_0x71af('0x56')](_0x2c4ab7),function(){if(_0xa6cde0){fs[_0x71af('0x57')](_0x2c4ab7);}});}else{return _0xcb29a6[_0x71af('0x4d')](_0x2c4ab7,function(_0x50dda0){if(_0xa6cde0){fs[_0x71af('0x57')](_0x2c4ab7);}});}}})[_0x71af('0x43')](function(_0x238c21){if(_0x238c21['message']===_0x71af('0x55')){_0xcb29a6[_0x71af('0x19')](0x194)[_0x71af('0x29')]('Not\x20found');}else{return handleError(_0xcb29a6,null);}});};exports['destroy']=function(_0x54bcda,_0x2795d8){return db['SquareRecording'][_0x71af('0x48')]({'where':{'id':_0x54bcda['params']['id']}})['then'](function(_0x2cc738){if(_[_0x71af('0x58')](_0x2cc738)){throw new ReferenceError(_0x71af('0x59'));}return _0x2cc738;})['then'](function(_0x173080){var _0x41f517=_0x173080['savePath'];logger[_0x71af('0x5a')](_0x71af('0x5b'),_0x41f517);if(!_[_0x71af('0x58')](_0x173080['savePath'])&&fs[_0x71af('0x53')](_0x41f517)){logger[_0x71af('0x5a')]('File:\x20\x22'+_0x41f517+_0x71af('0x5c'));fs[_0x71af('0x5d')](_0x41f517);}_0x41f517=_0x41f517+_0x71af('0x5e');if(!_['isNil'](_0x173080['savePath'])&&fs[_0x71af('0x53')](_0x41f517)){logger[_0x71af('0x5a')]('File:\x20\x22'+_0x41f517+_0x71af('0x5c'));fs[_0x71af('0x5d')](_0x41f517);}return _0x173080;})[_0x71af('0x23')](function(_0x5f0416){if(!_0x5f0416)throw new InternalError();return _0x5f0416[_0x71af('0x24')]();})[_0x71af('0x23')](function(){_0x2795d8[_0x71af('0x19')](0xcc)['end']();})[_0x71af('0x43')](handleError(_0x2795d8,null));}; \ No newline at end of file +var _0xe6a6=['where','pick','filter','merge','includeAll','include','findAll','show','find','catch','create','body','params','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','end','error','stack','name','send','SquareRecording','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x43d28d,_0x249835){var _0x4c477e=function(_0x4d0c5f){while(--_0x4d0c5f){_0x43d28d['push'](_0x43d28d['shift']());}};_0x4c477e(++_0x249835);}(_0xe6a6,0x13c));var _0x6e6a=function(_0x228344,_0x440e68){_0x228344=_0x228344-0x0;var _0x6230c0=_0xe6a6[_0x228344];return _0x6230c0;};'use strict';var emlformat=require(_0x6e6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e6a('0x1'));var jsonpatch=require(_0x6e6a('0x2'));var rp=require(_0x6e6a('0x3'));var moment=require(_0x6e6a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e6a('0x5'));var path=require(_0x6e6a('0x6'));var sox=require(_0x6e6a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e6a('0x8'));var squel=require(_0x6e6a('0x9'));var crypto=require(_0x6e6a('0xa'));var jsforce=require(_0x6e6a('0xb'));var deskjs=require(_0x6e6a('0xc'));var toCsv=require(_0x6e6a('0xd'));var querystring=require(_0x6e6a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6e6a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6e6a('0x10'));var as=require(_0x6e6a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e6a('0x12'))(_0x6e6a('0x13'));var utils=require('../../config/utils');var config=require(_0x6e6a('0x14'));var licenseUtil=require(_0x6e6a('0x15'));var db=require(_0x6e6a('0x16'))['db'];function respondWithStatusCode(_0x568cee,_0x219b51){_0x219b51=_0x219b51||0xcc;return function(_0x57c26f){if(_0x57c26f){return _0x568cee[_0x6e6a('0x17')](_0x219b51);}return _0x568cee['status'](_0x219b51)['end']();};}function respondWithResult(_0x15f535,_0x1625f9){_0x1625f9=_0x1625f9||0xc8;return function(_0x4506dc){if(_0x4506dc){return _0x15f535[_0x6e6a('0x18')](_0x1625f9)['json'](_0x4506dc);}};}function respondWithFilteredResult(_0x5b21f4,_0x300fdd){return function(_0x2280c4){if(_0x2280c4){var _0x447fa3=typeof _0x300fdd['offset']===_0x6e6a('0x19')&&typeof _0x300fdd[_0x6e6a('0x1a')]===_0x6e6a('0x19');var _0x355ffa=_0x2280c4[_0x6e6a('0x1b')];var _0x3d20de=_0x447fa3?0x0:_0x300fdd['offset'];var _0x443acd=_0x447fa3?_0x2280c4[_0x6e6a('0x1b')]:_0x300fdd[_0x6e6a('0x1c')]+_0x300fdd[_0x6e6a('0x1a')];var _0x2c1ab4;if(_0x443acd>=_0x355ffa){_0x443acd=_0x355ffa;_0x2c1ab4=0xc8;}else{_0x2c1ab4=0xce;}_0x5b21f4[_0x6e6a('0x18')](_0x2c1ab4);return _0x5b21f4[_0x6e6a('0x1d')](_0x6e6a('0x1e'),_0x3d20de+'-'+_0x443acd+'/'+_0x355ffa)[_0x6e6a('0x1f')](_0x2280c4);}return null;};}function patchUpdates(_0x5eed4f){return function(_0x2af4b8){try{jsonpatch[_0x6e6a('0x20')](_0x2af4b8,_0x5eed4f,!![]);}catch(_0x4a8f58){return BPromise[_0x6e6a('0x21')](_0x4a8f58);}return _0x2af4b8[_0x6e6a('0x22')]();};}function saveUpdates(_0x41dd53,_0x4a877b){return function(_0x5aa25d){if(_0x5aa25d){return _0x5aa25d['update'](_0x41dd53)['then'](function(_0x399afc){return _0x399afc;});}return null;};}function removeEntity(_0x4bdb69,_0x5838b8){return function(_0x4ec52e){if(_0x4ec52e){return _0x4ec52e[_0x6e6a('0x23')]()[_0x6e6a('0x24')](function(){_0x4bdb69[_0x6e6a('0x18')](0xcc)[_0x6e6a('0x25')]();});}};}function handleEntityNotFound(_0x216c06,_0x2bab95){return function(_0x2bb17d){if(!_0x2bb17d){_0x216c06[_0x6e6a('0x17')](0x194);}return _0x2bb17d;};}function handleError(_0x52ea91,_0x29175f){_0x29175f=_0x29175f||0x1f4;return function(_0x4ce14f){logger[_0x6e6a('0x26')](_0x4ce14f[_0x6e6a('0x27')]);if(_0x4ce14f[_0x6e6a('0x28')]){delete _0x4ce14f[_0x6e6a('0x28')];}_0x52ea91[_0x6e6a('0x18')](_0x29175f)[_0x6e6a('0x29')](_0x4ce14f);};}exports['index']=function(_0x4d858f,_0x226aa7){var _0x1095e3={},_0x22b1b8={},_0x373f13={'count':0x0,'rows':[]};var _0x387796=_['map'](db[_0x6e6a('0x2a')]['rawAttributes'],function(_0x53dae3){return{'name':_0x53dae3['fieldName'],'type':_0x53dae3['type'][_0x6e6a('0x2b')]};});_0x22b1b8[_0x6e6a('0x2c')]=_[_0x6e6a('0x2d')](_0x387796,_0x6e6a('0x28'));_0x22b1b8[_0x6e6a('0x2e')]=_[_0x6e6a('0x2f')](_0x4d858f[_0x6e6a('0x2e')]);_0x22b1b8[_0x6e6a('0x30')]=_[_0x6e6a('0x31')](_0x22b1b8['model'],_0x22b1b8['query']);_0x1095e3[_0x6e6a('0x32')]=_['intersection'](_0x22b1b8[_0x6e6a('0x2c')],qs[_0x6e6a('0x33')](_0x4d858f[_0x6e6a('0x2e')]['fields']));_0x1095e3[_0x6e6a('0x32')]=_0x1095e3[_0x6e6a('0x32')][_0x6e6a('0x34')]?_0x1095e3[_0x6e6a('0x32')]:_0x22b1b8[_0x6e6a('0x2c')];if(!_0x4d858f['query'][_0x6e6a('0x35')]('nolimit')){_0x1095e3[_0x6e6a('0x1a')]=qs[_0x6e6a('0x1a')](_0x4d858f['query'][_0x6e6a('0x1a')]);_0x1095e3[_0x6e6a('0x1c')]=qs[_0x6e6a('0x1c')](_0x4d858f[_0x6e6a('0x2e')]['offset']);}_0x1095e3[_0x6e6a('0x36')]=qs[_0x6e6a('0x37')](_0x4d858f[_0x6e6a('0x2e')][_0x6e6a('0x37')]);_0x1095e3[_0x6e6a('0x38')]=qs[_0x6e6a('0x30')](_[_0x6e6a('0x39')](_0x4d858f[_0x6e6a('0x2e')],_0x22b1b8[_0x6e6a('0x30')]),_0x387796);if(_0x4d858f['query'][_0x6e6a('0x3a')]){_0x1095e3[_0x6e6a('0x38')]=_[_0x6e6a('0x3b')](_0x1095e3['where'],{'$or':_[_0x6e6a('0x2d')](_0x387796,function(_0x484a55){if(_0x484a55['type']!=='VIRTUAL'){var _0xa18767={};_0xa18767[_0x484a55[_0x6e6a('0x28')]]={'$like':'%'+_0x4d858f[_0x6e6a('0x2e')][_0x6e6a('0x3a')]+'%'};return _0xa18767;}})});}_0x1095e3=_[_0x6e6a('0x3b')]({},_0x1095e3,_0x4d858f['options']);var _0x1f1741={'where':_0x1095e3[_0x6e6a('0x38')]};return db[_0x6e6a('0x2a')][_0x6e6a('0x1b')](_0x1f1741)[_0x6e6a('0x24')](function(_0x46c049){_0x373f13[_0x6e6a('0x1b')]=_0x46c049;if(_0x4d858f[_0x6e6a('0x2e')][_0x6e6a('0x3c')]){_0x1095e3[_0x6e6a('0x3d')]=[{'all':!![]}];}return db[_0x6e6a('0x2a')][_0x6e6a('0x3e')](_0x1095e3);})['then'](function(_0x46b71b){_0x373f13['rows']=_0x46b71b;return _0x373f13;})[_0x6e6a('0x24')](respondWithFilteredResult(_0x226aa7,_0x1095e3))['catch'](handleError(_0x226aa7,null));};exports[_0x6e6a('0x3f')]=function(_0x31cdda,_0x2b1461){var _0x37fdeb={'raw':!![],'where':{'id':_0x31cdda['params']['id']}},_0x370aef={};_0x370aef['model']=_[_0x6e6a('0x2f')](db[_0x6e6a('0x2a')]['rawAttributes']);_0x370aef[_0x6e6a('0x2e')]=_[_0x6e6a('0x2f')](_0x31cdda['query']);_0x370aef[_0x6e6a('0x30')]=_['intersection'](_0x370aef[_0x6e6a('0x2c')],_0x370aef[_0x6e6a('0x2e')]);_0x37fdeb[_0x6e6a('0x32')]=_['intersection'](_0x370aef['model'],qs[_0x6e6a('0x33')](_0x31cdda['query'][_0x6e6a('0x33')]));_0x37fdeb['attributes']=_0x37fdeb[_0x6e6a('0x32')]['length']?_0x37fdeb[_0x6e6a('0x32')]:_0x370aef['model'];if(_0x31cdda['query']['includeAll']){_0x37fdeb[_0x6e6a('0x3d')]=[{'all':!![]}];}_0x37fdeb=_[_0x6e6a('0x3b')]({},_0x37fdeb,_0x31cdda['options']);return db[_0x6e6a('0x2a')][_0x6e6a('0x40')](_0x37fdeb)[_0x6e6a('0x24')](handleEntityNotFound(_0x2b1461,null))['then'](respondWithResult(_0x2b1461,null))[_0x6e6a('0x41')](handleError(_0x2b1461,null));};exports[_0x6e6a('0x42')]=function(_0x2c78e3,_0x1f76de){return db[_0x6e6a('0x2a')]['create'](_0x2c78e3[_0x6e6a('0x43')],{})[_0x6e6a('0x24')](respondWithResult(_0x1f76de,0xc9))['catch'](handleError(_0x1f76de,null));};exports['update']=function(_0x504c5c,_0x111863){if(_0x504c5c['body']['id']){delete _0x504c5c[_0x6e6a('0x43')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x504c5c[_0x6e6a('0x44')]['id']}})[_0x6e6a('0x24')](handleEntityNotFound(_0x111863,null))[_0x6e6a('0x24')](saveUpdates(_0x504c5c['body'],null))[_0x6e6a('0x24')](respondWithResult(_0x111863,null))['catch'](handleError(_0x111863,null));};exports[_0x6e6a('0x45')]=function(_0x28bdec,_0x32e054,_0x46f24e){var _0x3a1305=require(_0x6e6a('0x46'));var _0x82fe1b=![];var _0x411545={};if(_0x28bdec[_0x6e6a('0x2e')]['type']&&_0x28bdec[_0x6e6a('0x2e')][_0x6e6a('0x47')]===_0x6e6a('0x48')){_0x411545[_0x6e6a('0x48')]=_0x28bdec['params']['id'];}else{_0x411545['id']=_0x28bdec[_0x6e6a('0x44')]['id'];}return db['SquareRecording'][_0x6e6a('0x40')]({'where':_0x411545,'attributes':['id',_0x6e6a('0x49'),_0x6e6a('0x4a')],'raw':!![]})[_0x6e6a('0x24')](handleEntityNotFound(_0x32e054,null))[_0x6e6a('0x24')](function(_0x52d3bc){if(_0x52d3bc){var _0x7a5506=_0x52d3bc['savePath'];var _0x44d7f3=util[_0x6e6a('0x4b')](_0x6e6a('0x4c'),_0x7a5506);if(fs[_0x6e6a('0x4d')](_0x44d7f3)){_0x82fe1b=!![];return _0x3a1305['decryptFile'](_0x44d7f3,_0x7a5506,config[_0x6e6a('0x4e')]['recording'])['then'](function(){return _0x52d3bc;});}return _0x52d3bc;}})['then'](function(_0x11bdfd){if(_0x11bdfd){var _0x23be73=_0x11bdfd[_0x6e6a('0x49')];if(!fs[_0x6e6a('0x4d')](_0x23be73)){throw new db[(_0x6e6a('0x4f'))][(_0x6e6a('0x50'))]('SquareRecording\x20not\x20found');}if(_0x11bdfd[_0x6e6a('0x4a')]){return _0x32e054[_0x6e6a('0x45')](_0x23be73,_0x11bdfd[_0x6e6a('0x4a')]+path[_0x6e6a('0x51')](_0x23be73),function(){if(_0x82fe1b){fs[_0x6e6a('0x52')](_0x23be73);}});}else{return _0x32e054[_0x6e6a('0x45')](_0x23be73,function(_0x30c26c){if(_0x82fe1b){fs[_0x6e6a('0x52')](_0x23be73);}});}}})[_0x6e6a('0x41')](function(_0x234470){if(_0x234470[_0x6e6a('0x53')]===_0x6e6a('0x54')){_0x32e054['status'](0x194)[_0x6e6a('0x29')](_0x6e6a('0x55'));}else{return handleError(_0x32e054,null);}});};exports[_0x6e6a('0x23')]=function(_0x1f68df,_0x215896){return db[_0x6e6a('0x2a')][_0x6e6a('0x40')]({'where':{'id':_0x1f68df['params']['id']}})[_0x6e6a('0x24')](function(_0x58d856){if(_[_0x6e6a('0x56')](_0x58d856)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58d856;})[_0x6e6a('0x24')](function(_0x5685dd){var _0x226980=_0x5685dd[_0x6e6a('0x49')];logger[_0x6e6a('0x57')](_0x6e6a('0x58'),_0x226980);if(!_[_0x6e6a('0x56')](_0x5685dd['savePath'])&&fs['existsSync'](_0x226980)){logger[_0x6e6a('0x57')](_0x6e6a('0x59')+_0x226980+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6e6a('0x5a')](_0x226980);}_0x226980=_0x226980+_0x6e6a('0x5b');if(!_[_0x6e6a('0x56')](_0x5685dd[_0x6e6a('0x49')])&&fs[_0x6e6a('0x4d')](_0x226980)){logger[_0x6e6a('0x57')](_0x6e6a('0x59')+_0x226980+_0x6e6a('0x5c'));fs[_0x6e6a('0x5a')](_0x226980);}return _0x5685dd;})[_0x6e6a('0x24')](function(_0x216a11){if(!_0x216a11)throw new InternalError();return _0x216a11[_0x6e6a('0x23')]();})['then'](function(){_0x215896[_0x6e6a('0x18')](0xcc)[_0x6e6a('0x25')]();})[_0x6e6a('0x41')](handleError(_0x215896,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8537b67..9b586f2 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 _0x39d2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','../../config/logger'];(function(_0x38ef04,_0x5ad1b4){var _0x565de1=function(_0x58f279){while(--_0x58f279){_0x38ef04['push'](_0x38ef04['shift']());}};_0x565de1(++_0x5ad1b4);}(_0x39d2,0xf5));var _0x239d=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x39d2[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var logger=require(_0x239d('0x1'))(_0x239d('0x2'));var moment=require(_0x239d('0x3'));var BPromise=require(_0x239d('0x4'));var rp=require(_0x239d('0x5'));var fs=require('fs');var path=require(_0x239d('0x6'));var rimraf=require(_0x239d('0x7'));var config=require(_0x239d('0x8'));var attributes=require(_0x239d('0x9'));module[_0x239d('0xa')]=function(_0x12302d,_0x1504c1){return _0x12302d[_0x239d('0xb')]('SquareRecording',attributes,{'tableName':_0x239d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x032e=['./squareRecording.attributes','exports','SquareRecording','square_recordings','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x032e,0x1cc));var _0xe032=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x032e[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe032('0x5'));var rimraf=require(_0xe032('0x6'));var config=require(_0xe032('0x7'));var attributes=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x43dc81,_0x20da91){return _0x43dc81['define'](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'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 50563c3..82a1810 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 _0x1018=['../../config/logger','rpc','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','info','CreateSquareRecording','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1eb249,_0x30f50e){var _0x37def9=function(_0x23790f){while(--_0x23790f){_0x1eb249['push'](_0x1eb249['shift']());}};_0x37def9(++_0x30f50e);}(_0x1018,0x148));var _0x8101=function(_0x22c288,_0x2491c4){_0x22c288=_0x22c288-0x0;var _0x5950f0=_0x1018[_0x22c288];return _0x5950f0;};'use strict';var _=require(_0x8101('0x0'));var util=require(_0x8101('0x1'));var moment=require(_0x8101('0x2'));var BPromise=require(_0x8101('0x3'));var rs=require(_0x8101('0x4'));var fs=require('fs');var Redis=require(_0x8101('0x5'));var db=require(_0x8101('0x6'))['db'];var utils=require(_0x8101('0x7'));var logger=require(_0x8101('0x8'))(_0x8101('0x9'));var config=require('../../config/environment');var jayson=require(_0x8101('0xa'));var client=jayson[_0x8101('0xb')][_0x8101('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55bf39,_0x633fec,_0x3ea57d){return new BPromise(function(_0x3d730b,_0xda231e){return client[_0x8101('0xd')](_0x55bf39,_0x3ea57d)[_0x8101('0xe')](function(_0xbff937){logger['info'](_0x8101('0xf'),_0x633fec,_0x8101('0x10'));logger['debug'](_0x8101('0x11'),_0x633fec,_0x8101('0x10'),JSON[_0x8101('0x12')](_0xbff937));if(_0xbff937[_0x8101('0x13')]){if(_0xbff937[_0x8101('0x13')][_0x8101('0x14')]===0x1f4){logger[_0x8101('0x13')](_0x8101('0xf'),_0x633fec,_0xbff937[_0x8101('0x13')][_0x8101('0x15')]);return _0xda231e(_0xbff937[_0x8101('0x13')][_0x8101('0x15')]);}logger['error'](_0x8101('0xf'),_0x633fec,_0xbff937[_0x8101('0x13')]['message']);return _0x3d730b(_0xbff937[_0x8101('0x13')][_0x8101('0x15')]);}else{logger['info'](_0x8101('0xf'),_0x633fec,_0x8101('0x10'));_0x3d730b(_0xbff937[_0x8101('0x16')]['message']);}})['catch'](function(_0x4cf013){logger[_0x8101('0x13')](_0x8101('0xf'),_0x633fec,_0x4cf013);_0xda231e(_0x4cf013);});});}exports['CreateSquareRecording']=function(_0x3c7757){var _0x2ef277=this;return new Promise(function(_0x309b62,_0x408e80){return db['SquareRecording']['create'](_0x3c7757['body'],{'raw':_0x3c7757['options']?_0x3c7757[_0x8101('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x38d516){logger[_0x8101('0x18')](_0x8101('0x19'),_0x3c7757);logger[_0x8101('0x1a')](_0x8101('0x19'),_0x3c7757,JSON[_0x8101('0x12')](_0x38d516));_0x309b62(_0x38d516);})[_0x8101('0x1b')](function(_0x4742e8){logger['error'](_0x8101('0x19'),_0x4742e8[_0x8101('0x15')],_0x3c7757);_0x408e80(_0x2ef277[_0x8101('0x13')](0x1f4,_0x4742e8[_0x8101('0x15')]));});});}; \ No newline at end of file +var _0xbf60=['message','info','result','catch','CreateSquareRecording','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbf60,0x182));var _0x0bf6=function(_0x3f1a8a,_0x5e6b68){_0x3f1a8a=_0x3f1a8a-0x0;var _0x3e34da=_0xbf60[_0x3f1a8a];return _0x3e34da;};'use strict';var _=require(_0x0bf6('0x0'));var util=require(_0x0bf6('0x1'));var moment=require(_0x0bf6('0x2'));var BPromise=require(_0x0bf6('0x3'));var rs=require(_0x0bf6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0bf6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0bf6('0x6'));var jayson=require(_0x0bf6('0x7'));var client=jayson['client'][_0x0bf6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2417ee,_0x27e32c,_0x5da7e1){return new BPromise(function(_0x5d3d60,_0x4f4819){return client[_0x0bf6('0x9')](_0x2417ee,_0x5da7e1)['then'](function(_0x428cb3){logger['info'](_0x0bf6('0xa'),_0x27e32c,'request\x20sent');logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x27e32c,_0x0bf6('0xb'),JSON[_0x0bf6('0xc')](_0x428cb3));if(_0x428cb3['error']){if(_0x428cb3[_0x0bf6('0xd')]['code']===0x1f4){logger['error'](_0x0bf6('0xa'),_0x27e32c,_0x428cb3[_0x0bf6('0xd')]['message']);return _0x4f4819(_0x428cb3['error'][_0x0bf6('0xe')]);}logger[_0x0bf6('0xd')](_0x0bf6('0xa'),_0x27e32c,_0x428cb3['error'][_0x0bf6('0xe')]);return _0x5d3d60(_0x428cb3[_0x0bf6('0xd')][_0x0bf6('0xe')]);}else{logger[_0x0bf6('0xf')](_0x0bf6('0xa'),_0x27e32c,'request\x20sent');_0x5d3d60(_0x428cb3[_0x0bf6('0x10')]['message']);}})[_0x0bf6('0x11')](function(_0x195714){logger[_0x0bf6('0xd')](_0x0bf6('0xa'),_0x27e32c,_0x195714);_0x4f4819(_0x195714);});});}exports[_0x0bf6('0x12')]=function(_0x4a41cf){var _0x578259=this;return new Promise(function(_0x249416,_0x2a2608){return db['SquareRecording'][_0x0bf6('0x13')](_0x4a41cf[_0x0bf6('0x14')],{'raw':_0x4a41cf[_0x0bf6('0x15')]?_0x4a41cf[_0x0bf6('0x15')][_0x0bf6('0x16')]===undefined?!![]:![]:!![]})[_0x0bf6('0x17')](function(_0x1d968d){logger[_0x0bf6('0xf')](_0x0bf6('0x12'),_0x4a41cf);logger[_0x0bf6('0x18')](_0x0bf6('0x12'),_0x4a41cf,JSON[_0x0bf6('0xc')](_0x1d968d));_0x249416(_0x1d968d);})[_0x0bf6('0x11')](function(_0x8ae0d){logger['error'](_0x0bf6('0x12'),_0x8ae0d[_0x0bf6('0xe')],_0x4a41cf);_0x2a2608(_0x578259[_0x0bf6('0xd')](0x1f4,_0x8ae0d[_0x0bf6('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 261d9da..1b305b6 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 _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(_0x429dbc,_0x5c191){var _0x2f0d48=function(_0x41a715){while(--_0x41a715){_0x429dbc['push'](_0x429dbc['shift']());}};_0x2f0d48(++_0x5c191);}(_0xe706,0xa3));var _0x6e70=function(_0xb7202,_0x4aa500){_0xb7202=_0xb7202-0x0;var _0x6488bb=_0xe706[_0xb7202];return _0x6488bb;};'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 +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(_0x3c8bce,_0x18ef29){var _0x44e876=function(_0x92cfad){while(--_0x92cfad){_0x3c8bce['push'](_0x3c8bce['shift']());}};_0x44e876(++_0x18ef29);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 5f55aff..057bee7 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 _0x5bdd=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x5bdd,0x119));var _0xd5bd=function(_0x41414c,_0x55f252){_0x41414c=_0x41414c-0x0;var _0x5dbf91=_0x5bdd[_0x41414c];return _0x5dbf91;};'use strict';var Sequelize=require(_0xd5bd('0x0'));module['exports']={'network':{'type':Sequelize[_0xd5bd('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xd5bd('0x1')]},'channel':{'type':Sequelize[_0xd5bd('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd5bd('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd5bd('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xd5bd('0x1')]},'callingtns':{'type':Sequelize[_0xd5bd('0x1')]},'dnid':{'type':Sequelize[_0xd5bd('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd5bd('0x1')]},'extension':{'type':Sequelize[_0xd5bd('0x1')]},'priority':{'type':Sequelize[_0xd5bd('0x1')]},'enhanced':{'type':Sequelize[_0xd5bd('0x1')]},'accountcode':{'type':Sequelize[_0xd5bd('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xd5bd('0x1')]},'joinAt':{'type':Sequelize[_0xd5bd('0x2')]},'leaveAt':{'type':Sequelize[_0xd5bd('0x2')]},'bot':{'type':Sequelize[_0xd5bd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd2c4=['STRING','DATE','sequelize','exports'];(function(_0x45be8d,_0x365f2a){var _0x1a7740=function(_0x5aba28){while(--_0x5aba28){_0x45be8d['push'](_0x45be8d['shift']());}};_0x1a7740(++_0x365f2a);}(_0xd2c4,0x1ca));var _0x4d2c=function(_0x44976e,_0x311385){_0x44976e=_0x44976e-0x0;var _0x4852b2=_0xd2c4[_0x44976e];return _0x4852b2;};'use strict';var Sequelize=require(_0x4d2c('0x0'));module[_0x4d2c('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4d2c('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4d2c('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d2c('0x2')]},'uniqueid':{'type':Sequelize[_0x4d2c('0x2')]},'version':{'type':Sequelize[_0x4d2c('0x2')]},'callerid':{'type':Sequelize[_0x4d2c('0x2')]},'calleridname':{'type':Sequelize[_0x4d2c('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4d2c('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x4d2c('0x2')]},'dnid':{'type':Sequelize[_0x4d2c('0x2')]},'rdnis':{'type':Sequelize[_0x4d2c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4d2c('0x2')]},'priority':{'type':Sequelize[_0x4d2c('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4d2c('0x2')]},'threadid':{'type':Sequelize[_0x4d2c('0x2')]},'project_name':{'type':Sequelize[_0x4d2c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4d2c('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b1ed09e..e72d847 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 _0x436a=['attributes','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','length','options','create','body','find','catch','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x436a,0x1f2));var _0xa436=function(_0x1bc6e5,_0x15b443){_0x1bc6e5=_0x1bc6e5-0x0;var _0x532c7a=_0x436a[_0x1bc6e5];return _0x532c7a;};'use strict';var emlformat=require(_0xa436('0x0'));var rimraf=require(_0xa436('0x1'));var zipdir=require(_0xa436('0x2'));var jsonpatch=require(_0xa436('0x3'));var rp=require('request-promise');var moment=require(_0xa436('0x4'));var BPromise=require(_0xa436('0x5'));var Mustache=require(_0xa436('0x6'));var util=require('util');var path=require(_0xa436('0x7'));var sox=require(_0xa436('0x8'));var csv=require('to-csv');var ejs=require(_0xa436('0x9'));var fs=require('fs');var fs_extra=require(_0xa436('0xa'));var _=require(_0xa436('0xb'));var squel=require(_0xa436('0xc'));var crypto=require(_0xa436('0xd'));var jsforce=require(_0xa436('0xe'));var deskjs=require(_0xa436('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa436('0x10'));var Redis=require('ioredis');var authService=require(_0xa436('0x11'));var qs=require(_0xa436('0x12'));var as=require(_0xa436('0x13'));var hardwareService=require(_0xa436('0x14'));var logger=require(_0xa436('0x15'))(_0xa436('0x16'));var utils=require(_0xa436('0x17'));var config=require(_0xa436('0x18'));var licenseUtil=require(_0xa436('0x19'));var db=require(_0xa436('0x1a'))['db'];function respondWithStatusCode(_0x1088e4,_0x5521eb){_0x5521eb=_0x5521eb||0xcc;return function(_0x1996d8){if(_0x1996d8){return _0x1088e4[_0xa436('0x1b')](_0x5521eb);}return _0x1088e4[_0xa436('0x1c')](_0x5521eb)[_0xa436('0x1d')]();};}function respondWithResult(_0x335bb9,_0x5899ae){_0x5899ae=_0x5899ae||0xc8;return function(_0x586cb5){if(_0x586cb5){return _0x335bb9[_0xa436('0x1c')](_0x5899ae)[_0xa436('0x1e')](_0x586cb5);}};}function respondWithFilteredResult(_0x574450,_0x421faf){return function(_0x295a12){if(_0x295a12){var _0x5cc190=typeof _0x421faf[_0xa436('0x1f')]===_0xa436('0x20')&&typeof _0x421faf['limit']===_0xa436('0x20');var _0x7102bd=_0x295a12[_0xa436('0x21')];var _0x3a51e7=_0x5cc190?0x0:_0x421faf[_0xa436('0x1f')];var _0x3b4fd4=_0x5cc190?_0x295a12[_0xa436('0x21')]:_0x421faf[_0xa436('0x1f')]+_0x421faf['limit'];var _0xd7e775;if(_0x3b4fd4>=_0x7102bd){_0x3b4fd4=_0x7102bd;_0xd7e775=0xc8;}else{_0xd7e775=0xce;}_0x574450['status'](_0xd7e775);return _0x574450['set'](_0xa436('0x22'),_0x3a51e7+'-'+_0x3b4fd4+'/'+_0x7102bd)[_0xa436('0x1e')](_0x295a12);}return null;};}function patchUpdates(_0x1f061f){return function(_0x15ba0a){try{jsonpatch[_0xa436('0x23')](_0x15ba0a,_0x1f061f,!![]);}catch(_0xef917c){return BPromise[_0xa436('0x24')](_0xef917c);}return _0x15ba0a['save']();};}function saveUpdates(_0x75d2a8,_0xeb8b4e){return function(_0x14fa61){if(_0x14fa61){return _0x14fa61[_0xa436('0x25')](_0x75d2a8)[_0xa436('0x26')](function(_0x321ee7){return _0x321ee7;});}return null;};}function removeEntity(_0x548c00,_0x3ac031){return function(_0x57031f){if(_0x57031f){return _0x57031f['destroy']()[_0xa436('0x26')](function(){_0x548c00['status'](0xcc)[_0xa436('0x1d')]();});}};}function handleEntityNotFound(_0x1791b8,_0x13605a){return function(_0x4f4ccf){if(!_0x4f4ccf){_0x1791b8[_0xa436('0x1b')](0x194);}return _0x4f4ccf;};}function handleError(_0x2c80f7,_0x4bcecb){_0x4bcecb=_0x4bcecb||0x1f4;return function(_0x3ad132){logger[_0xa436('0x27')](_0x3ad132[_0xa436('0x28')]);if(_0x3ad132[_0xa436('0x29')]){delete _0x3ad132[_0xa436('0x29')];}_0x2c80f7['status'](_0x4bcecb)[_0xa436('0x2a')](_0x3ad132);};}exports[_0xa436('0x2b')]=function(_0x4d2177,_0x291261){var _0x2aca15={},_0xb352e7={},_0x56cffa={'count':0x0,'rows':[]};var _0x3eba63=_[_0xa436('0x2c')](db[_0xa436('0x2d')][_0xa436('0x2e')],function(_0x398d2e){return{'name':_0x398d2e[_0xa436('0x2f')],'type':_0x398d2e[_0xa436('0x30')][_0xa436('0x31')]};});_0xb352e7['model']=_[_0xa436('0x2c')](_0x3eba63,'name');_0xb352e7[_0xa436('0x32')]=_['keys'](_0x4d2177[_0xa436('0x32')]);_0xb352e7[_0xa436('0x33')]=_['intersection'](_0xb352e7[_0xa436('0x34')],_0xb352e7[_0xa436('0x32')]);_0x2aca15['attributes']=_[_0xa436('0x35')](_0xb352e7[_0xa436('0x34')],qs[_0xa436('0x36')](_0x4d2177['query'][_0xa436('0x36')]));_0x2aca15[_0xa436('0x37')]=_0x2aca15[_0xa436('0x37')]['length']?_0x2aca15['attributes']:_0xb352e7['model'];if(!_0x4d2177[_0xa436('0x32')]['hasOwnProperty'](_0xa436('0x38'))){_0x2aca15[_0xa436('0x39')]=qs['limit'](_0x4d2177['query'][_0xa436('0x39')]);_0x2aca15[_0xa436('0x1f')]=qs[_0xa436('0x1f')](_0x4d2177[_0xa436('0x32')][_0xa436('0x1f')]);}_0x2aca15[_0xa436('0x3a')]=qs[_0xa436('0x3b')](_0x4d2177[_0xa436('0x32')][_0xa436('0x3b')]);_0x2aca15[_0xa436('0x3c')]=qs[_0xa436('0x33')](_[_0xa436('0x3d')](_0x4d2177[_0xa436('0x32')],_0xb352e7[_0xa436('0x33')]),_0x3eba63);if(_0x4d2177[_0xa436('0x32')][_0xa436('0x3e')]){_0x2aca15[_0xa436('0x3c')]=_['merge'](_0x2aca15[_0xa436('0x3c')],{'$or':_[_0xa436('0x2c')](_0x3eba63,function(_0x51f44e){if(_0x51f44e[_0xa436('0x30')]!=='VIRTUAL'){var _0x3d9669={};_0x3d9669[_0x51f44e[_0xa436('0x29')]]={'$like':'%'+_0x4d2177[_0xa436('0x32')][_0xa436('0x3e')]+'%'};return _0x3d9669;}})});}_0x2aca15=_[_0xa436('0x3f')]({},_0x2aca15,_0x4d2177['options']);var _0x2bba01={'where':_0x2aca15['where']};return db[_0xa436('0x2d')][_0xa436('0x21')](_0x2bba01)['then'](function(_0xde19af){_0x56cffa[_0xa436('0x21')]=_0xde19af;if(_0x4d2177[_0xa436('0x32')][_0xa436('0x40')]){_0x2aca15[_0xa436('0x41')]=[{'all':!![]}];}return db[_0xa436('0x2d')][_0xa436('0x42')](_0x2aca15);})['then'](function(_0x27f52b){_0x56cffa[_0xa436('0x43')]=_0x27f52b;return _0x56cffa;})['then'](respondWithFilteredResult(_0x291261,_0x2aca15))['catch'](handleError(_0x291261,null));};exports[_0xa436('0x44')]=function(_0x1a68e5,_0x4d1710){var _0x1aa0c3={'raw':!![],'where':{'id':_0x1a68e5[_0xa436('0x45')]['id']}},_0x4313ce={};_0x4313ce[_0xa436('0x34')]=_[_0xa436('0x46')](db[_0xa436('0x2d')]['rawAttributes']);_0x4313ce[_0xa436('0x32')]=_[_0xa436('0x46')](_0x1a68e5[_0xa436('0x32')]);_0x4313ce[_0xa436('0x33')]=_[_0xa436('0x35')](_0x4313ce[_0xa436('0x34')],_0x4313ce[_0xa436('0x32')]);_0x1aa0c3[_0xa436('0x37')]=_[_0xa436('0x35')](_0x4313ce[_0xa436('0x34')],qs[_0xa436('0x36')](_0x1a68e5[_0xa436('0x32')][_0xa436('0x36')]));_0x1aa0c3['attributes']=_0x1aa0c3[_0xa436('0x37')][_0xa436('0x47')]?_0x1aa0c3[_0xa436('0x37')]:_0x4313ce[_0xa436('0x34')];if(_0x1a68e5[_0xa436('0x32')]['includeAll']){_0x1aa0c3[_0xa436('0x41')]=[{'all':!![]}];}_0x1aa0c3=_[_0xa436('0x3f')]({},_0x1aa0c3,_0x1a68e5[_0xa436('0x48')]);return db['SquareReport']['find'](_0x1aa0c3)['then'](handleEntityNotFound(_0x4d1710,null))['then'](respondWithResult(_0x4d1710,null))['catch'](handleError(_0x4d1710,null));};exports[_0xa436('0x49')]=function(_0x362218,_0x1c4eef){return db[_0xa436('0x2d')][_0xa436('0x49')](_0x362218[_0xa436('0x4a')],{})[_0xa436('0x26')](respondWithResult(_0x1c4eef,0xc9))['catch'](handleError(_0x1c4eef,null));};exports['update']=function(_0x5ae2e2,_0x2813fe){if(_0x5ae2e2['body']['id']){delete _0x5ae2e2['body']['id'];}return db[_0xa436('0x2d')][_0xa436('0x4b')]({'where':{'id':_0x5ae2e2['params']['id']}})[_0xa436('0x26')](handleEntityNotFound(_0x2813fe,null))['then'](saveUpdates(_0x5ae2e2[_0xa436('0x4a')],null))[_0xa436('0x26')](respondWithResult(_0x2813fe,null))[_0xa436('0x4c')](handleError(_0x2813fe,null));};exports[_0xa436('0x4d')]=function(_0x59e81f,_0x5695b1){return db[_0xa436('0x2d')][_0xa436('0x4b')]({'where':{'id':_0x59e81f[_0xa436('0x45')]['id']}})[_0xa436('0x26')](handleEntityNotFound(_0x5695b1,null))[_0xa436('0x26')](removeEntity(_0x5695b1,null))[_0xa436('0x4c')](handleError(_0x5695b1,null));};exports[_0xa436('0x4e')]=function(_0x504843,_0x47d944){return db[_0xa436('0x2d')][_0xa436('0x4e')]()['then'](respondWithResult(_0x47d944,null))[_0xa436('0x4c')](handleError(_0x47d944,null));}; \ No newline at end of file +var _0x9cb4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x20aee0,_0x29076f){var _0x26ba37=function(_0x3014ee){while(--_0x3014ee){_0x20aee0['push'](_0x20aee0['shift']());}};_0x26ba37(++_0x29076f);}(_0x9cb4,0xd9));var _0x49cb=function(_0x3fc388,_0x36668){_0x3fc388=_0x3fc388-0x0;var _0x36d7cd=_0x9cb4[_0x3fc388];return _0x36d7cd;};'use strict';var emlformat=require(_0x49cb('0x0'));var rimraf=require(_0x49cb('0x1'));var zipdir=require(_0x49cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49cb('0x3'));var moment=require(_0x49cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x49cb('0x5'));var util=require(_0x49cb('0x6'));var path=require(_0x49cb('0x7'));var sox=require(_0x49cb('0x8'));var csv=require('to-csv');var ejs=require(_0x49cb('0x9'));var fs=require('fs');var fs_extra=require(_0x49cb('0xa'));var _=require(_0x49cb('0xb'));var squel=require('squel');var crypto=require(_0x49cb('0xc'));var jsforce=require(_0x49cb('0xd'));var deskjs=require(_0x49cb('0xe'));var toCsv=require(_0x49cb('0xf'));var querystring=require(_0x49cb('0x10'));var Papa=require(_0x49cb('0x11'));var Redis=require(_0x49cb('0x12'));var authService=require(_0x49cb('0x13'));var qs=require(_0x49cb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49cb('0x15'));var logger=require(_0x49cb('0x16'))(_0x49cb('0x17'));var utils=require(_0x49cb('0x18'));var config=require(_0x49cb('0x19'));var licenseUtil=require(_0x49cb('0x1a'));var db=require(_0x49cb('0x1b'))['db'];function respondWithStatusCode(_0x13ca55,_0xba32be){_0xba32be=_0xba32be||0xcc;return function(_0x3d0890){if(_0x3d0890){return _0x13ca55[_0x49cb('0x1c')](_0xba32be);}return _0x13ca55['status'](_0xba32be)['end']();};}function respondWithResult(_0xb0efe5,_0xc73a58){_0xc73a58=_0xc73a58||0xc8;return function(_0x4cdfe2){if(_0x4cdfe2){return _0xb0efe5[_0x49cb('0x1d')](_0xc73a58)['json'](_0x4cdfe2);}};}function respondWithFilteredResult(_0x1a41f0,_0x2034d5){return function(_0x50f666){if(_0x50f666){var _0x40d454=typeof _0x2034d5['offset']===_0x49cb('0x1e')&&typeof _0x2034d5[_0x49cb('0x1f')]===_0x49cb('0x1e');var _0x2c4c5c=_0x50f666[_0x49cb('0x20')];var _0x5bb435=_0x40d454?0x0:_0x2034d5['offset'];var _0x252da6=_0x40d454?_0x50f666[_0x49cb('0x20')]:_0x2034d5[_0x49cb('0x21')]+_0x2034d5[_0x49cb('0x1f')];var _0x417d27;if(_0x252da6>=_0x2c4c5c){_0x252da6=_0x2c4c5c;_0x417d27=0xc8;}else{_0x417d27=0xce;}_0x1a41f0[_0x49cb('0x1d')](_0x417d27);return _0x1a41f0[_0x49cb('0x22')](_0x49cb('0x23'),_0x5bb435+'-'+_0x252da6+'/'+_0x2c4c5c)[_0x49cb('0x24')](_0x50f666);}return null;};}function patchUpdates(_0x214d4e){return function(_0xf2cc55){try{jsonpatch['apply'](_0xf2cc55,_0x214d4e,!![]);}catch(_0x58104c){return BPromise[_0x49cb('0x25')](_0x58104c);}return _0xf2cc55[_0x49cb('0x26')]();};}function saveUpdates(_0x595497,_0x142089){return function(_0x2a6219){if(_0x2a6219){return _0x2a6219['update'](_0x595497)[_0x49cb('0x27')](function(_0x5dff13){return _0x5dff13;});}return null;};}function removeEntity(_0x52ff96,_0x5a58f1){return function(_0x4efc52){if(_0x4efc52){return _0x4efc52[_0x49cb('0x28')]()['then'](function(){_0x52ff96[_0x49cb('0x1d')](0xcc)[_0x49cb('0x29')]();});}};}function handleEntityNotFound(_0x289d86,_0x50f3f4){return function(_0x9d4994){if(!_0x9d4994){_0x289d86['sendStatus'](0x194);}return _0x9d4994;};}function handleError(_0x285cab,_0x1d4308){_0x1d4308=_0x1d4308||0x1f4;return function(_0x195936){logger[_0x49cb('0x2a')](_0x195936[_0x49cb('0x2b')]);if(_0x195936[_0x49cb('0x2c')]){delete _0x195936[_0x49cb('0x2c')];}_0x285cab[_0x49cb('0x1d')](_0x1d4308)[_0x49cb('0x2d')](_0x195936);};}exports[_0x49cb('0x2e')]=function(_0x6011e3,_0x3c81dd){var _0x4fce8f={},_0xbd35e={},_0x543c79={'count':0x0,'rows':[]};var _0x4609dc=_[_0x49cb('0x2f')](db[_0x49cb('0x30')][_0x49cb('0x31')],function(_0xbd7c57){return{'name':_0xbd7c57[_0x49cb('0x32')],'type':_0xbd7c57[_0x49cb('0x33')][_0x49cb('0x34')]};});_0xbd35e['model']=_[_0x49cb('0x2f')](_0x4609dc,_0x49cb('0x2c'));_0xbd35e[_0x49cb('0x35')]=_['keys'](_0x6011e3['query']);_0xbd35e[_0x49cb('0x36')]=_['intersection'](_0xbd35e[_0x49cb('0x37')],_0xbd35e[_0x49cb('0x35')]);_0x4fce8f[_0x49cb('0x38')]=_[_0x49cb('0x39')](_0xbd35e[_0x49cb('0x37')],qs[_0x49cb('0x3a')](_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3a')]));_0x4fce8f[_0x49cb('0x38')]=_0x4fce8f[_0x49cb('0x38')][_0x49cb('0x3b')]?_0x4fce8f[_0x49cb('0x38')]:_0xbd35e[_0x49cb('0x37')];if(!_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3c')](_0x49cb('0x3d'))){_0x4fce8f[_0x49cb('0x1f')]=qs[_0x49cb('0x1f')](_0x6011e3[_0x49cb('0x35')][_0x49cb('0x1f')]);_0x4fce8f['offset']=qs[_0x49cb('0x21')](_0x6011e3['query']['offset']);}_0x4fce8f['order']=qs['sort'](_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3e')]);_0x4fce8f['where']=qs[_0x49cb('0x36')](_['pick'](_0x6011e3[_0x49cb('0x35')],_0xbd35e[_0x49cb('0x36')]),_0x4609dc);if(_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3f')]){_0x4fce8f['where']=_[_0x49cb('0x40')](_0x4fce8f[_0x49cb('0x41')],{'$or':_[_0x49cb('0x2f')](_0x4609dc,function(_0x29e5e){if(_0x29e5e[_0x49cb('0x33')]!==_0x49cb('0x42')){var _0x22de70={};_0x22de70[_0x29e5e[_0x49cb('0x2c')]]={'$like':'%'+_0x6011e3[_0x49cb('0x35')][_0x49cb('0x3f')]+'%'};return _0x22de70;}})});}_0x4fce8f=_[_0x49cb('0x40')]({},_0x4fce8f,_0x6011e3[_0x49cb('0x43')]);var _0x28199a={'where':_0x4fce8f[_0x49cb('0x41')]};return db[_0x49cb('0x30')]['count'](_0x28199a)[_0x49cb('0x27')](function(_0xb6af30){_0x543c79[_0x49cb('0x20')]=_0xb6af30;if(_0x6011e3['query']['includeAll']){_0x4fce8f[_0x49cb('0x44')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x4fce8f);})[_0x49cb('0x27')](function(_0x33aa90){_0x543c79[_0x49cb('0x45')]=_0x33aa90;return _0x543c79;})[_0x49cb('0x27')](respondWithFilteredResult(_0x3c81dd,_0x4fce8f))[_0x49cb('0x46')](handleError(_0x3c81dd,null));};exports[_0x49cb('0x47')]=function(_0x5239b1,_0x3b8b7c){var _0x4c891f={'raw':!![],'where':{'id':_0x5239b1[_0x49cb('0x48')]['id']}},_0x23b139={};_0x23b139[_0x49cb('0x37')]=_[_0x49cb('0x49')](db[_0x49cb('0x30')]['rawAttributes']);_0x23b139[_0x49cb('0x35')]=_[_0x49cb('0x49')](_0x5239b1['query']);_0x23b139[_0x49cb('0x36')]=_[_0x49cb('0x39')](_0x23b139['model'],_0x23b139['query']);_0x4c891f['attributes']=_['intersection'](_0x23b139['model'],qs[_0x49cb('0x3a')](_0x5239b1['query'][_0x49cb('0x3a')]));_0x4c891f[_0x49cb('0x38')]=_0x4c891f[_0x49cb('0x38')][_0x49cb('0x3b')]?_0x4c891f['attributes']:_0x23b139[_0x49cb('0x37')];if(_0x5239b1[_0x49cb('0x35')][_0x49cb('0x4a')]){_0x4c891f[_0x49cb('0x44')]=[{'all':!![]}];}_0x4c891f=_[_0x49cb('0x40')]({},_0x4c891f,_0x5239b1[_0x49cb('0x43')]);return db['SquareReport'][_0x49cb('0x4b')](_0x4c891f)[_0x49cb('0x27')](handleEntityNotFound(_0x3b8b7c,null))[_0x49cb('0x27')](respondWithResult(_0x3b8b7c,null))[_0x49cb('0x46')](handleError(_0x3b8b7c,null));};exports['create']=function(_0x1303e1,_0x16242f){return db['SquareReport']['create'](_0x1303e1['body'],{})['then'](respondWithResult(_0x16242f,0xc9))['catch'](handleError(_0x16242f,null));};exports['update']=function(_0xb9606b,_0x191781){if(_0xb9606b[_0x49cb('0x4c')]['id']){delete _0xb9606b['body']['id'];}return db[_0x49cb('0x30')][_0x49cb('0x4b')]({'where':{'id':_0xb9606b[_0x49cb('0x48')]['id']}})[_0x49cb('0x27')](handleEntityNotFound(_0x191781,null))['then'](saveUpdates(_0xb9606b[_0x49cb('0x4c')],null))[_0x49cb('0x27')](respondWithResult(_0x191781,null))[_0x49cb('0x46')](handleError(_0x191781,null));};exports['destroy']=function(_0x5c90c2,_0x1d097a){return db[_0x49cb('0x30')][_0x49cb('0x4b')]({'where':{'id':_0x5c90c2[_0x49cb('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d097a,null))['then'](removeEntity(_0x1d097a,null))[_0x49cb('0x46')](handleError(_0x1d097a,null));};exports[_0x49cb('0x4d')]=function(_0x4bcc4d,_0x569709){return db[_0x49cb('0x30')][_0x49cb('0x4d')]()[_0x49cb('0x27')](respondWithResult(_0x569709,null))['catch'](handleError(_0x569709,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 19b756b..1bd2e47 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 _0x3b71=['moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','api'];(function(_0x47de37,_0x257584){var _0x202d8a=function(_0x1cd56e){while(--_0x1cd56e){_0x47de37['push'](_0x47de37['shift']());}};_0x202d8a(++_0x257584);}(_0x3b71,0xa3));var _0x13b7=function(_0x40124a,_0x509bb5){_0x40124a=_0x40124a-0x0;var _0x3ce773=_0x3b71[_0x40124a];return _0x3ce773;};'use strict';var _=require(_0x13b7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x13b7('0x1'));var moment=require(_0x13b7('0x2'));var BPromise=require(_0x13b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13b7('0x4'));var rimraf=require(_0x13b7('0x5'));var config=require(_0x13b7('0x6'));var attributes=require(_0x13b7('0x7'));module[_0x13b7('0x8')]=function(_0x2bb997,_0x41c347){return _0x2bb997['define'](_0x13b7('0x9'),attributes,{'tableName':_0x13b7('0xa'),'paranoid':![],'indexes':[{'name':_0x13b7('0xb'),'fields':[_0x13b7('0xc'),_0x13b7('0xd')]},{'name':_0x13b7('0xe'),'fields':[_0x13b7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0d7=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt'];(function(_0x1c776a,_0x2d93fa){var _0x560caa=function(_0xc093d4){while(--_0xc093d4){_0x1c776a['push'](_0x1c776a['shift']());}};_0x560caa(++_0x2d93fa);}(_0xf0d7,0x195));var _0x7f0d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf0d7[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7f0d('0x0'));var util=require(_0x7f0d('0x1'));var logger=require(_0x7f0d('0x2'))(_0x7f0d('0x3'));var moment=require('moment');var BPromise=require(_0x7f0d('0x4'));var rp=require(_0x7f0d('0x5'));var fs=require('fs');var path=require(_0x7f0d('0x6'));var rimraf=require(_0x7f0d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7f0d('0x8'));module[_0x7f0d('0x9')]=function(_0x14955a,_0xc58be8){return _0x14955a[_0x7f0d('0xa')]('SquareReport',attributes,{'tableName':_0x7f0d('0xb'),'paranoid':![],'indexes':[{'name':_0x7f0d('0xc'),'fields':[_0x7f0d('0xd'),'project_name']},{'name':_0x7f0d('0xe'),'fields':[_0x7f0d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d71d7ad..98d1ee7 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 _0x1b13=['catch','SquareReport','create','body','options','raw','CreateSquareReport','debug','UpdateSquareReport','update','where','attributes','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result'];(function(_0x220d63,_0x2ac173){var _0xffccaa=function(_0x6b794b){while(--_0x6b794b){_0x220d63['push'](_0x220d63['shift']());}};_0xffccaa(++_0x2ac173);}(_0x1b13,0xc6));var _0x31b1=function(_0x44381b,_0x247e92){_0x44381b=_0x44381b-0x0;var _0x4d1f9a=_0x1b13[_0x44381b];return _0x4d1f9a;};'use strict';var _=require('lodash');var util=require(_0x31b1('0x0'));var moment=require('moment');var BPromise=require(_0x31b1('0x1'));var rs=require(_0x31b1('0x2'));var fs=require('fs');var Redis=require(_0x31b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x31b1('0x4'));var logger=require(_0x31b1('0x5'))('rpc');var config=require(_0x31b1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x31b1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1045ec,_0x201a11,_0x166db3){return new BPromise(function(_0x22e3ec,_0x1b63a8){return client[_0x31b1('0x8')](_0x1045ec,_0x166db3)[_0x31b1('0x9')](function(_0x2540ff){logger[_0x31b1('0xa')]('SquareReport,\x20%s,\x20%s',_0x201a11,'request\x20sent');logger['debug'](_0x31b1('0xb'),_0x201a11,_0x31b1('0xc'),JSON[_0x31b1('0xd')](_0x2540ff));if(_0x2540ff[_0x31b1('0xe')]){if(_0x2540ff[_0x31b1('0xe')][_0x31b1('0xf')]===0x1f4){logger['error'](_0x31b1('0x10'),_0x201a11,_0x2540ff[_0x31b1('0xe')][_0x31b1('0x11')]);return _0x1b63a8(_0x2540ff[_0x31b1('0xe')][_0x31b1('0x11')]);}logger[_0x31b1('0xe')](_0x31b1('0x10'),_0x201a11,_0x2540ff[_0x31b1('0xe')][_0x31b1('0x11')]);return _0x22e3ec(_0x2540ff['error'][_0x31b1('0x11')]);}else{logger[_0x31b1('0xa')](_0x31b1('0x10'),_0x201a11,_0x31b1('0xc'));_0x22e3ec(_0x2540ff[_0x31b1('0x12')][_0x31b1('0x11')]);}})[_0x31b1('0x13')](function(_0x283629){logger['error']('SquareReport,\x20%s,\x20%s',_0x201a11,_0x283629);_0x1b63a8(_0x283629);});});}exports['CreateSquareReport']=function(_0x5d5509){var _0x377426=this;return new Promise(function(_0x4a466f,_0x183d32){return db[_0x31b1('0x14')][_0x31b1('0x15')](_0x5d5509[_0x31b1('0x16')],{'raw':_0x5d5509['options']?_0x5d5509[_0x31b1('0x17')][_0x31b1('0x18')]===undefined?!![]:![]:!![]})[_0x31b1('0x9')](function(_0x3eafec){logger[_0x31b1('0xa')](_0x31b1('0x19'),_0x5d5509);logger[_0x31b1('0x1a')](_0x31b1('0x19'),_0x5d5509,JSON[_0x31b1('0xd')](_0x3eafec));_0x4a466f(_0x3eafec);})[_0x31b1('0x13')](function(_0x2ecde2){logger[_0x31b1('0xe')]('CreateSquareReport',_0x2ecde2[_0x31b1('0x11')],_0x5d5509);_0x183d32(_0x377426[_0x31b1('0xe')](0x1f4,_0x2ecde2[_0x31b1('0x11')]));});});};exports[_0x31b1('0x1b')]=function(_0x4e7590){var _0x583ae8=this;return new Promise(function(_0x500577,_0xb2561d){return db[_0x31b1('0x14')][_0x31b1('0x1c')](_0x4e7590[_0x31b1('0x16')],{'raw':_0x4e7590[_0x31b1('0x17')]?_0x4e7590[_0x31b1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7590['options']?_0x4e7590['options'][_0x31b1('0x1d')]||null:null,'attributes':_0x4e7590[_0x31b1('0x17')]?_0x4e7590[_0x31b1('0x17')][_0x31b1('0x1e')]||null:null,'limit':_0x4e7590[_0x31b1('0x17')]?_0x4e7590[_0x31b1('0x17')]['limit']||null:null})[_0x31b1('0x9')](function(_0x71c18){logger[_0x31b1('0xa')](_0x31b1('0x1b'),_0x4e7590);logger[_0x31b1('0x1a')](_0x31b1('0x1b'),_0x4e7590,JSON[_0x31b1('0xd')](_0x71c18));_0x500577(_0x71c18);})[_0x31b1('0x13')](function(_0x5c1867){logger[_0x31b1('0xe')](_0x31b1('0x1b'),_0x5c1867['message'],_0x4e7590);_0xb2561d(_0x583ae8['error'](0x1f4,_0x5c1867[_0x31b1('0x11')]));});});}; \ No newline at end of file +var _0x822a=['SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SquareReport','body','options','UpdateSquareReport','raw','where','attributes','limit','then','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','request','info'];(function(_0x55e430,_0x34984b){var _0x228190=function(_0x37a0c3){while(--_0x37a0c3){_0x55e430['push'](_0x55e430['shift']());}};_0x228190(++_0x34984b);}(_0x822a,0xcf));var _0xa822=function(_0x2a0ab3,_0xcdddf1){_0x2a0ab3=_0x2a0ab3-0x0;var _0x73f2ad=_0x822a[_0x2a0ab3];return _0x73f2ad;};'use strict';var _=require(_0xa822('0x0'));var util=require(_0xa822('0x1'));var moment=require(_0xa822('0x2'));var BPromise=require('bluebird');var rs=require(_0xa822('0x3'));var fs=require('fs');var Redis=require(_0xa822('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa822('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa822('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d1caa,_0x2e244a,_0x44d39a){return new BPromise(function(_0x43e5d0,_0x1b309e){return client[_0xa822('0x7')](_0x3d1caa,_0x44d39a)['then'](function(_0x38f76e){logger[_0xa822('0x8')](_0xa822('0x9'),_0x2e244a,_0xa822('0xa'));logger[_0xa822('0xb')](_0xa822('0xc'),_0x2e244a,_0xa822('0xa'),JSON['stringify'](_0x38f76e));if(_0x38f76e['error']){if(_0x38f76e[_0xa822('0xd')][_0xa822('0xe')]===0x1f4){logger['error'](_0xa822('0x9'),_0x2e244a,_0x38f76e[_0xa822('0xd')][_0xa822('0xf')]);return _0x1b309e(_0x38f76e[_0xa822('0xd')][_0xa822('0xf')]);}logger['error'](_0xa822('0x9'),_0x2e244a,_0x38f76e[_0xa822('0xd')]['message']);return _0x43e5d0(_0x38f76e[_0xa822('0xd')][_0xa822('0xf')]);}else{logger[_0xa822('0x8')](_0xa822('0x9'),_0x2e244a,'request\x20sent');_0x43e5d0(_0x38f76e['result']['message']);}})[_0xa822('0x10')](function(_0x558230){logger[_0xa822('0xd')](_0xa822('0x9'),_0x2e244a,_0x558230);_0x1b309e(_0x558230);});});}exports['CreateSquareReport']=function(_0x8e081a){var _0x4b7a55=this;return new Promise(function(_0x364eb1,_0x58b974){return db[_0xa822('0x11')]['create'](_0x8e081a[_0xa822('0x12')],{'raw':_0x8e081a['options']?_0x8e081a[_0xa822('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x155aaa){logger['info']('CreateSquareReport',_0x8e081a);logger['debug']('CreateSquareReport',_0x8e081a,JSON['stringify'](_0x155aaa));_0x364eb1(_0x155aaa);})[_0xa822('0x10')](function(_0xea56f){logger['error']('CreateSquareReport',_0xea56f[_0xa822('0xf')],_0x8e081a);_0x58b974(_0x4b7a55['error'](0x1f4,_0xea56f[_0xa822('0xf')]));});});};exports[_0xa822('0x14')]=function(_0x56274a){var _0x4c27d3=this;return new Promise(function(_0x4e9315,_0x1ff374){return db[_0xa822('0x11')]['update'](_0x56274a[_0xa822('0x12')],{'raw':_0x56274a[_0xa822('0x13')]?_0x56274a['options'][_0xa822('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56274a['options']?_0x56274a[_0xa822('0x13')][_0xa822('0x16')]||null:null,'attributes':_0x56274a['options']?_0x56274a[_0xa822('0x13')][_0xa822('0x17')]||null:null,'limit':_0x56274a[_0xa822('0x13')]?_0x56274a[_0xa822('0x13')][_0xa822('0x18')]||null:null})[_0xa822('0x19')](function(_0x42cc55){logger[_0xa822('0x8')](_0xa822('0x14'),_0x56274a);logger[_0xa822('0xb')](_0xa822('0x14'),_0x56274a,JSON[_0xa822('0x1a')](_0x42cc55));_0x4e9315(_0x42cc55);})[_0xa822('0x10')](function(_0x208b23){logger[_0xa822('0xd')](_0xa822('0x14'),_0x208b23[_0xa822('0xf')],_0x56274a);_0x1ff374(_0x4c27d3[_0xa822('0xd')](0x1f4,_0x208b23[_0xa822('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b84fd13..d1c1790 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 _0xbede=['fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xbede,0x175));var _0xebed=function(_0x4dbba5,_0x12bcde){_0x4dbba5=_0x4dbba5-0x0;var _0x238278=_0xbede[_0x4dbba5];return _0x238278;};'use strict';var multer=require('multer');var util=require(_0xebed('0x0'));var path=require(_0xebed('0x1'));var timeout=require(_0xebed('0x2'));var express=require(_0xebed('0x3'));var router=express[_0xebed('0x4')]();var fs_extra=require(_0xebed('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xebed('0x6'));var config=require(_0xebed('0x7'));var controller=require(_0xebed('0x8'));router['get']('/',auth[_0xebed('0x9')](),controller['index']);router[_0xebed('0xa')]('/describe',auth[_0xebed('0x9')](),controller[_0xebed('0xb')]);router['get'](_0xebed('0xc'),auth['isAuthenticated'](),controller[_0xebed('0xd')]);router[_0xebed('0xe')]('/',auth[_0xebed('0x9')](),controller[_0xebed('0xf')]);router[_0xebed('0x10')](_0xebed('0xc'),auth[_0xebed('0x9')](),controller[_0xebed('0x11')]);router[_0xebed('0x12')](_0xebed('0xc'),auth[_0xebed('0x9')](),controller[_0xebed('0x13')]);module[_0xebed('0x14')]=router; \ No newline at end of file +var _0x9451=['/:id','show','post','create','update','delete','destroy','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','isAuthenticated','describe'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x9451,0x15d));var _0x1945=function(_0x4e8147,_0x15717b){_0x4e8147=_0x4e8147-0x0;var _0x49285b=_0x9451[_0x4e8147];return _0x49285b;};'use strict';var multer=require(_0x1945('0x0'));var util=require('util');var path=require(_0x1945('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1945('0x2'));var auth=require(_0x1945('0x3'));var interaction=require(_0x1945('0x4'));var config=require(_0x1945('0x5'));var controller=require(_0x1945('0x6'));router[_0x1945('0x7')]('/',auth['isAuthenticated'](),controller[_0x1945('0x8')]);router[_0x1945('0x7')]('/describe',auth[_0x1945('0x9')](),controller[_0x1945('0xa')]);router[_0x1945('0x7')](_0x1945('0xb'),auth[_0x1945('0x9')](),controller[_0x1945('0xc')]);router[_0x1945('0xd')]('/',auth[_0x1945('0x9')](),controller[_0x1945('0xe')]);router['put'](_0x1945('0xb'),auth[_0x1945('0x9')](),controller[_0x1945('0xf')]);router[_0x1945('0x10')](_0x1945('0xb'),auth['isAuthenticated'](),controller[_0x1945('0x11')]);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 d0d825c..99d3bfa 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 _0xe491=['sequelize','STRING'];(function(_0x767e08,_0x156136){var _0x5e4d03=function(_0x591e83){while(--_0x591e83){_0x767e08['push'](_0x767e08['shift']());}};_0x5e4d03(++_0x156136);}(_0xe491,0x138));var _0x1e49=function(_0x4d7f05,_0x58e084){_0x4d7f05=_0x4d7f05-0x0;var _0xe49318=_0xe491[_0x4d7f05];return _0xe49318;};'use strict';var Sequelize=require(_0x1e49('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1e49('0x1')]},'node':{'type':Sequelize[_0x1e49('0x1')]},'application':{'type':Sequelize[_0x1e49('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1e49('0x1')]},'callerid':{'type':Sequelize[_0x1e49('0x1')]}}; \ No newline at end of file +var _0x9f91=['STRING','TEXT','sequelize','exports'];(function(_0x1599cb,_0x5bb2e2){var _0x1b4c09=function(_0x42d6df){while(--_0x42d6df){_0x1599cb['push'](_0x1599cb['shift']());}};_0x1b4c09(++_0x5bb2e2);}(_0x9f91,0xbe));var _0x19f9=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x9f91[_0x2f3ecd];return _0xffdc44;};'use strict';var Sequelize=require(_0x19f9('0x0'));module[_0x19f9('0x1')]={'uniqueid':{'type':Sequelize[_0x19f9('0x2')]},'node':{'type':Sequelize[_0x19f9('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x19f9('0x3')]},'project_name':{'type':Sequelize[_0x19f9('0x2')]},'callerid':{'type':Sequelize[_0x19f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b50f595..a03c6c0 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 _0x3e74=['ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','save','then','destroy','stack','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','offset','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','create','body','update','find','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','papaparse'];(function(_0x57e6cf,_0x373fbc){var _0x44166c=function(_0x50130b){while(--_0x50130b){_0x57e6cf['push'](_0x57e6cf['shift']());}};_0x44166c(++_0x373fbc);}(_0x3e74,0x1e4));var _0x43e7=function(_0x2c3290,_0x459a78){_0x2c3290=_0x2c3290-0x0;var _0x5e006c=_0x3e74[_0x2c3290];return _0x5e006c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x0'));var jsonpatch=require(_0x43e7('0x1'));var rp=require('request-promise');var moment=require(_0x43e7('0x2'));var BPromise=require(_0x43e7('0x3'));var Mustache=require(_0x43e7('0x4'));var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var fs_extra=require(_0x43e7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43e7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xc'));var Redis=require(_0x43e7('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e7('0xe'));var logger=require('../../config/logger')(_0x43e7('0xf'));var utils=require('../../config/utils');var config=require(_0x43e7('0x10'));var licenseUtil=require(_0x43e7('0x11'));var db=require(_0x43e7('0x12'))['db'];function respondWithStatusCode(_0x236d45,_0x15415d){_0x15415d=_0x15415d||0xcc;return function(_0x5a418b){if(_0x5a418b){return _0x236d45[_0x43e7('0x13')](_0x15415d);}return _0x236d45[_0x43e7('0x14')](_0x15415d)[_0x43e7('0x15')]();};}function respondWithResult(_0x2231c2,_0x34fde5){_0x34fde5=_0x34fde5||0xc8;return function(_0x2a776e){if(_0x2a776e){return _0x2231c2['status'](_0x34fde5)[_0x43e7('0x16')](_0x2a776e);}};}function respondWithFilteredResult(_0x38bf01,_0x1607b9){return function(_0x4eb18c){if(_0x4eb18c){var _0x5892df=typeof _0x1607b9['offset']==='undefined'&&typeof _0x1607b9[_0x43e7('0x17')]==='undefined';var _0x2b99e5=_0x4eb18c['count'];var _0x19da13=_0x5892df?0x0:_0x1607b9['offset'];var _0x35ee04=_0x5892df?_0x4eb18c['count']:_0x1607b9['offset']+_0x1607b9[_0x43e7('0x17')];var _0x50e927;if(_0x35ee04>=_0x2b99e5){_0x35ee04=_0x2b99e5;_0x50e927=0xc8;}else{_0x50e927=0xce;}_0x38bf01[_0x43e7('0x14')](_0x50e927);return _0x38bf01[_0x43e7('0x18')](_0x43e7('0x19'),_0x19da13+'-'+_0x35ee04+'/'+_0x2b99e5)[_0x43e7('0x16')](_0x4eb18c);}return null;};}function patchUpdates(_0x3b49bb){return function(_0x1616f6){try{jsonpatch[_0x43e7('0x1a')](_0x1616f6,_0x3b49bb,!![]);}catch(_0x37ea6b){return BPromise['reject'](_0x37ea6b);}return _0x1616f6[_0x43e7('0x1b')]();};}function saveUpdates(_0x39d963,_0x20099b){return function(_0xece362){if(_0xece362){return _0xece362['update'](_0x39d963)[_0x43e7('0x1c')](function(_0x48f521){return _0x48f521;});}return null;};}function removeEntity(_0x3ff385,_0x13a8d3){return function(_0xc92b0d){if(_0xc92b0d){return _0xc92b0d[_0x43e7('0x1d')]()[_0x43e7('0x1c')](function(){_0x3ff385[_0x43e7('0x14')](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x1f8387,_0x5367c2){return function(_0x5eb53c){if(!_0x5eb53c){_0x1f8387[_0x43e7('0x13')](0x194);}return _0x5eb53c;};}function handleError(_0x2890cb,_0x5dc1fd){_0x5dc1fd=_0x5dc1fd||0x1f4;return function(_0x34679a){logger['error'](_0x34679a[_0x43e7('0x1e')]);if(_0x34679a['name']){delete _0x34679a['name'];}_0x2890cb['status'](_0x5dc1fd)[_0x43e7('0x1f')](_0x34679a);};}exports[_0x43e7('0x20')]=function(_0x1f3c6a,_0x1aa10c){var _0x16deec={},_0x512938={},_0x1ccf44={'count':0x0,'rows':[]};var _0x1209fb=_[_0x43e7('0x21')](db[_0x43e7('0x22')][_0x43e7('0x23')],function(_0x5454e4){return{'name':_0x5454e4[_0x43e7('0x24')],'type':_0x5454e4[_0x43e7('0x25')][_0x43e7('0x26')]};});_0x512938[_0x43e7('0x27')]=_[_0x43e7('0x21')](_0x1209fb,_0x43e7('0x28'));_0x512938[_0x43e7('0x29')]=_[_0x43e7('0x2a')](_0x1f3c6a[_0x43e7('0x29')]);_0x512938[_0x43e7('0x2b')]=_['intersection'](_0x512938[_0x43e7('0x27')],_0x512938[_0x43e7('0x29')]);_0x16deec['attributes']=_['intersection'](_0x512938[_0x43e7('0x27')],qs['fields'](_0x1f3c6a['query'][_0x43e7('0x2c')]));_0x16deec[_0x43e7('0x2d')]=_0x16deec[_0x43e7('0x2d')]['length']?_0x16deec[_0x43e7('0x2d')]:_0x512938[_0x43e7('0x27')];if(!_0x1f3c6a['query'][_0x43e7('0x2e')](_0x43e7('0x2f'))){_0x16deec[_0x43e7('0x17')]=qs[_0x43e7('0x17')](_0x1f3c6a[_0x43e7('0x29')][_0x43e7('0x17')]);_0x16deec['offset']=qs[_0x43e7('0x30')](_0x1f3c6a[_0x43e7('0x29')][_0x43e7('0x30')]);}_0x16deec['order']=qs['sort'](_0x1f3c6a['query'][_0x43e7('0x31')]);_0x16deec['where']=qs[_0x43e7('0x2b')](_[_0x43e7('0x32')](_0x1f3c6a[_0x43e7('0x29')],_0x512938['filters']),_0x1209fb);if(_0x1f3c6a[_0x43e7('0x29')][_0x43e7('0x33')]){_0x16deec[_0x43e7('0x34')]=_[_0x43e7('0x35')](_0x16deec['where'],{'$or':_['map'](_0x1209fb,function(_0xa625cc){if(_0xa625cc['type']!==_0x43e7('0x36')){var _0x39afad={};_0x39afad[_0xa625cc['name']]={'$like':'%'+_0x1f3c6a[_0x43e7('0x29')]['filter']+'%'};return _0x39afad;}})});}_0x16deec=_[_0x43e7('0x35')]({},_0x16deec,_0x1f3c6a['options']);var _0x256bde={'where':_0x16deec['where']};return db[_0x43e7('0x22')]['count'](_0x256bde)['then'](function(_0x31eeb4){_0x1ccf44[_0x43e7('0x37')]=_0x31eeb4;if(_0x1f3c6a[_0x43e7('0x29')][_0x43e7('0x38')]){_0x16deec[_0x43e7('0x39')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x43e7('0x3a')](_0x16deec);})['then'](function(_0x93071a){_0x1ccf44[_0x43e7('0x3b')]=_0x93071a;return _0x1ccf44;})[_0x43e7('0x1c')](respondWithFilteredResult(_0x1aa10c,_0x16deec))[_0x43e7('0x3c')](handleError(_0x1aa10c,null));};exports[_0x43e7('0x3d')]=function(_0x2421c4,_0x3a49bd){var _0x9e33bc={'raw':!![],'where':{'id':_0x2421c4[_0x43e7('0x3e')]['id']}},_0x534dca={};_0x534dca[_0x43e7('0x27')]=_[_0x43e7('0x2a')](db[_0x43e7('0x22')][_0x43e7('0x23')]);_0x534dca['query']=_[_0x43e7('0x2a')](_0x2421c4[_0x43e7('0x29')]);_0x534dca[_0x43e7('0x2b')]=_['intersection'](_0x534dca['model'],_0x534dca['query']);_0x9e33bc[_0x43e7('0x2d')]=_[_0x43e7('0x3f')](_0x534dca['model'],qs[_0x43e7('0x2c')](_0x2421c4[_0x43e7('0x29')][_0x43e7('0x2c')]));_0x9e33bc['attributes']=_0x9e33bc[_0x43e7('0x2d')][_0x43e7('0x40')]?_0x9e33bc['attributes']:_0x534dca[_0x43e7('0x27')];if(_0x2421c4[_0x43e7('0x29')][_0x43e7('0x38')]){_0x9e33bc[_0x43e7('0x39')]=[{'all':!![]}];}_0x9e33bc=_[_0x43e7('0x35')]({},_0x9e33bc,_0x2421c4[_0x43e7('0x41')]);return db['SquareDetailsReport']['find'](_0x9e33bc)['then'](handleEntityNotFound(_0x3a49bd,null))[_0x43e7('0x1c')](respondWithResult(_0x3a49bd,null))[_0x43e7('0x3c')](handleError(_0x3a49bd,null));};exports[_0x43e7('0x42')]=function(_0x954301,_0x4307d6){return db[_0x43e7('0x22')][_0x43e7('0x42')](_0x954301[_0x43e7('0x43')],{})[_0x43e7('0x1c')](respondWithResult(_0x4307d6,0xc9))[_0x43e7('0x3c')](handleError(_0x4307d6,null));};exports[_0x43e7('0x44')]=function(_0xd88d75,_0x20e90f){if(_0xd88d75['body']['id']){delete _0xd88d75[_0x43e7('0x43')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0xd88d75['params']['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x20e90f,null))[_0x43e7('0x1c')](saveUpdates(_0xd88d75[_0x43e7('0x43')],null))[_0x43e7('0x1c')](respondWithResult(_0x20e90f,null))[_0x43e7('0x3c')](handleError(_0x20e90f,null));};exports[_0x43e7('0x1d')]=function(_0x36692e,_0x5719fc){return db['SquareDetailsReport'][_0x43e7('0x45')]({'where':{'id':_0x36692e[_0x43e7('0x3e')]['id']}})[_0x43e7('0x1c')](handleEntityNotFound(_0x5719fc,null))[_0x43e7('0x1c')](removeEntity(_0x5719fc,null))['catch'](handleError(_0x5719fc,null));};exports['describe']=function(_0x49f9b9,_0x2dacbf){return db[_0x43e7('0x22')][_0x43e7('0x46')]()[_0x43e7('0x1c')](respondWithResult(_0x2dacbf,null))[_0x43e7('0x3c')](handleError(_0x2dacbf,null));}; \ No newline at end of file +var _0x8d97=['SquareDetailsReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','catch','update','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','stack','name','index','map'];(function(_0x1eff09,_0x505cb0){var _0x2c442a=function(_0x276dff){while(--_0x276dff){_0x1eff09['push'](_0x1eff09['shift']());}};_0x2c442a(++_0x505cb0);}(_0x8d97,0x13c));var _0x78d9=function(_0x2abfe4,_0x32333e){_0x2abfe4=_0x2abfe4-0x0;var _0x5b90a0=_0x8d97[_0x2abfe4];return _0x5b90a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require(_0x78d9('0x2'));var rp=require('request-promise');var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require('util');var path=require(_0x78d9('0x6'));var sox=require('sox');var csv=require(_0x78d9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78d9('0x8'));var _=require('lodash');var squel=require(_0x78d9('0x9'));var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x7'));var querystring=require('querystring');var Papa=require(_0x78d9('0xd'));var Redis=require(_0x78d9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x78d9('0xf'));var as=require(_0x78d9('0x10'));var hardwareService=require(_0x78d9('0x11'));var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];function respondWithStatusCode(_0x5576fa,_0x364a4f){_0x364a4f=_0x364a4f||0xcc;return function(_0x160088){if(_0x160088){return _0x5576fa[_0x78d9('0x17')](_0x364a4f);}return _0x5576fa[_0x78d9('0x18')](_0x364a4f)[_0x78d9('0x19')]();};}function respondWithResult(_0x2656b1,_0x9f66a1){_0x9f66a1=_0x9f66a1||0xc8;return function(_0x3dc5ac){if(_0x3dc5ac){return _0x2656b1[_0x78d9('0x18')](_0x9f66a1)[_0x78d9('0x1a')](_0x3dc5ac);}};}function respondWithFilteredResult(_0x588a33,_0x4d2879){return function(_0x14fda8){if(_0x14fda8){var _0x39a9b7=typeof _0x4d2879[_0x78d9('0x1b')]===_0x78d9('0x1c')&&typeof _0x4d2879[_0x78d9('0x1d')]===_0x78d9('0x1c');var _0x5e1d37=_0x14fda8[_0x78d9('0x1e')];var _0x2d372e=_0x39a9b7?0x0:_0x4d2879['offset'];var _0x2e96ba=_0x39a9b7?_0x14fda8[_0x78d9('0x1e')]:_0x4d2879[_0x78d9('0x1b')]+_0x4d2879[_0x78d9('0x1d')];var _0x579514;if(_0x2e96ba>=_0x5e1d37){_0x2e96ba=_0x5e1d37;_0x579514=0xc8;}else{_0x579514=0xce;}_0x588a33[_0x78d9('0x18')](_0x579514);return _0x588a33[_0x78d9('0x1f')](_0x78d9('0x20'),_0x2d372e+'-'+_0x2e96ba+'/'+_0x5e1d37)[_0x78d9('0x1a')](_0x14fda8);}return null;};}function patchUpdates(_0x86bd29){return function(_0x4e83b2){try{jsonpatch['apply'](_0x4e83b2,_0x86bd29,!![]);}catch(_0xdd4949){return BPromise[_0x78d9('0x21')](_0xdd4949);}return _0x4e83b2['save']();};}function saveUpdates(_0x4b19f5,_0x173966){return function(_0x45e583){if(_0x45e583){return _0x45e583['update'](_0x4b19f5)['then'](function(_0x192c2e){return _0x192c2e;});}return null;};}function removeEntity(_0x46a496,_0x5d3a2a){return function(_0x28004e){if(_0x28004e){return _0x28004e[_0x78d9('0x22')]()['then'](function(){_0x46a496[_0x78d9('0x18')](0xcc)[_0x78d9('0x19')]();});}};}function handleEntityNotFound(_0x1c0ef0,_0x1f6095){return function(_0x39ec53){if(!_0x39ec53){_0x1c0ef0[_0x78d9('0x17')](0x194);}return _0x39ec53;};}function handleError(_0x17cd8f,_0x48c109){_0x48c109=_0x48c109||0x1f4;return function(_0xeb4d89){logger['error'](_0xeb4d89[_0x78d9('0x23')]);if(_0xeb4d89[_0x78d9('0x24')]){delete _0xeb4d89[_0x78d9('0x24')];}_0x17cd8f[_0x78d9('0x18')](_0x48c109)['send'](_0xeb4d89);};}exports[_0x78d9('0x25')]=function(_0x35f19b,_0x5256b6){var _0x789b7d={},_0xef1666={},_0x531ca2={'count':0x0,'rows':[]};var _0x3b6b7b=_[_0x78d9('0x26')](db[_0x78d9('0x27')]['rawAttributes'],function(_0x55d232){return{'name':_0x55d232[_0x78d9('0x28')],'type':_0x55d232[_0x78d9('0x29')]['key']};});_0xef1666['model']=_[_0x78d9('0x26')](_0x3b6b7b,'name');_0xef1666[_0x78d9('0x2a')]=_[_0x78d9('0x2b')](_0x35f19b[_0x78d9('0x2a')]);_0xef1666[_0x78d9('0x2c')]=_[_0x78d9('0x2d')](_0xef1666[_0x78d9('0x2e')],_0xef1666[_0x78d9('0x2a')]);_0x789b7d[_0x78d9('0x2f')]=_['intersection'](_0xef1666['model'],qs[_0x78d9('0x30')](_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x30')]));_0x789b7d[_0x78d9('0x2f')]=_0x789b7d[_0x78d9('0x2f')]['length']?_0x789b7d['attributes']:_0xef1666[_0x78d9('0x2e')];if(!_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x31')](_0x78d9('0x32'))){_0x789b7d[_0x78d9('0x1d')]=qs[_0x78d9('0x1d')](_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x1d')]);_0x789b7d['offset']=qs['offset'](_0x35f19b[_0x78d9('0x2a')]['offset']);}_0x789b7d[_0x78d9('0x33')]=qs[_0x78d9('0x34')](_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x34')]);_0x789b7d['where']=qs[_0x78d9('0x2c')](_[_0x78d9('0x35')](_0x35f19b['query'],_0xef1666[_0x78d9('0x2c')]),_0x3b6b7b);if(_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x36')]){_0x789b7d[_0x78d9('0x37')]=_['merge'](_0x789b7d['where'],{'$or':_[_0x78d9('0x26')](_0x3b6b7b,function(_0x1ad51f){if(_0x1ad51f[_0x78d9('0x29')]!=='VIRTUAL'){var _0x288e98={};_0x288e98[_0x1ad51f[_0x78d9('0x24')]]={'$like':'%'+_0x35f19b[_0x78d9('0x2a')]['filter']+'%'};return _0x288e98;}})});}_0x789b7d=_[_0x78d9('0x38')]({},_0x789b7d,_0x35f19b[_0x78d9('0x39')]);var _0x5d3fc9={'where':_0x789b7d[_0x78d9('0x37')]};return db[_0x78d9('0x27')][_0x78d9('0x1e')](_0x5d3fc9)[_0x78d9('0x3a')](function(_0x4cd0a9){_0x531ca2[_0x78d9('0x1e')]=_0x4cd0a9;if(_0x35f19b[_0x78d9('0x2a')][_0x78d9('0x3b')]){_0x789b7d[_0x78d9('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x78d9('0x3d')](_0x789b7d);})[_0x78d9('0x3a')](function(_0x526000){_0x531ca2[_0x78d9('0x3e')]=_0x526000;return _0x531ca2;})[_0x78d9('0x3a')](respondWithFilteredResult(_0x5256b6,_0x789b7d))['catch'](handleError(_0x5256b6,null));};exports[_0x78d9('0x3f')]=function(_0x56dd45,_0x5bf22e){var _0x5552dc={'raw':!![],'where':{'id':_0x56dd45[_0x78d9('0x40')]['id']}},_0x387b7f={};_0x387b7f[_0x78d9('0x2e')]=_[_0x78d9('0x2b')](db[_0x78d9('0x27')][_0x78d9('0x41')]);_0x387b7f['query']=_['keys'](_0x56dd45['query']);_0x387b7f[_0x78d9('0x2c')]=_['intersection'](_0x387b7f[_0x78d9('0x2e')],_0x387b7f[_0x78d9('0x2a')]);_0x5552dc[_0x78d9('0x2f')]=_[_0x78d9('0x2d')](_0x387b7f[_0x78d9('0x2e')],qs[_0x78d9('0x30')](_0x56dd45['query'][_0x78d9('0x30')]));_0x5552dc[_0x78d9('0x2f')]=_0x5552dc[_0x78d9('0x2f')]['length']?_0x5552dc['attributes']:_0x387b7f[_0x78d9('0x2e')];if(_0x56dd45[_0x78d9('0x2a')]['includeAll']){_0x5552dc[_0x78d9('0x3c')]=[{'all':!![]}];}_0x5552dc=_[_0x78d9('0x38')]({},_0x5552dc,_0x56dd45[_0x78d9('0x39')]);return db[_0x78d9('0x27')]['find'](_0x5552dc)['then'](handleEntityNotFound(_0x5bf22e,null))['then'](respondWithResult(_0x5bf22e,null))[_0x78d9('0x42')](handleError(_0x5bf22e,null));};exports['create']=function(_0x1e3bfe,_0x16da86){return db[_0x78d9('0x27')]['create'](_0x1e3bfe['body'],{})[_0x78d9('0x3a')](respondWithResult(_0x16da86,0xc9))[_0x78d9('0x42')](handleError(_0x16da86,null));};exports[_0x78d9('0x43')]=function(_0x23bb89,_0x377f25){if(_0x23bb89[_0x78d9('0x44')]['id']){delete _0x23bb89['body']['id'];}return db['SquareDetailsReport'][_0x78d9('0x45')]({'where':{'id':_0x23bb89[_0x78d9('0x40')]['id']}})[_0x78d9('0x3a')](handleEntityNotFound(_0x377f25,null))[_0x78d9('0x3a')](saveUpdates(_0x23bb89['body'],null))['then'](respondWithResult(_0x377f25,null))[_0x78d9('0x42')](handleError(_0x377f25,null));};exports[_0x78d9('0x22')]=function(_0x458eb0,_0x5b98c8){return db[_0x78d9('0x27')]['find']({'where':{'id':_0x458eb0[_0x78d9('0x40')]['id']}})[_0x78d9('0x3a')](handleEntityNotFound(_0x5b98c8,null))['then'](removeEntity(_0x5b98c8,null))[_0x78d9('0x42')](handleError(_0x5b98c8,null));};exports[_0x78d9('0x46')]=function(_0x4a20c9,_0x4a8aef){return db[_0x78d9('0x27')][_0x78d9('0x46')]()[_0x78d9('0x3a')](respondWithResult(_0x4a8aef,null))[_0x78d9('0x42')](handleError(_0x4a8aef,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index fa124c1..d371cac 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 _0xb575=['api','moment','request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash'];(function(_0x513616,_0x85c1c1){var _0x5bfadb=function(_0x211f70){while(--_0x211f70){_0x513616['push'](_0x513616['shift']());}};_0x5bfadb(++_0x85c1c1);}(_0xb575,0x95));var _0x5b57=function(_0x1de4cf,_0x29ca6d){_0x1de4cf=_0x1de4cf-0x0;var _0x4eba56=_0xb575[_0x1de4cf];return _0x4eba56;};'use strict';var _=require(_0x5b57('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b57('0x1'));var moment=require(_0x5b57('0x2'));var BPromise=require('bluebird');var rp=require(_0x5b57('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b57('0x4'));var attributes=require(_0x5b57('0x5'));module[_0x5b57('0x6')]=function(_0x2b968a,_0x31775d){return _0x2b968a[_0x5b57('0x7')](_0x5b57('0x8'),attributes,{'tableName':_0x5b57('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2d4=['SquareDetailsReport','util','bluebird','request-promise','path','rimraf'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0xa2d4,0x1f3));var _0x4a2d=function(_0x1d4c3d,_0x4ef405){_0x1d4c3d=_0x1d4c3d-0x0;var _0x39a709=_0xa2d4[_0x1d4c3d];return _0x39a709;};'use strict';var _=require('lodash');var util=require(_0x4a2d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4a2d('0x1'));var rp=require(_0x4a2d('0x2'));var fs=require('fs');var path=require(_0x4a2d('0x3'));var rimraf=require(_0x4a2d('0x4'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x1def41,_0x17ac6a){return _0x1def41['define'](_0x4a2d('0x5'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index caf5653..25ee65a 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 _0x0598=['catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','then','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4cf270,_0x2cfd19){var _0x5267e0=function(_0x4fa909){while(--_0x4fa909){_0x4cf270['push'](_0x4cf270['shift']());}};_0x5267e0(++_0x2cfd19);}(_0x0598,0x92));var _0x8059=function(_0x49e9b2,_0x1f2a00){_0x49e9b2=_0x49e9b2-0x0;var _0x31826=_0x0598[_0x49e9b2];return _0x31826;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['create'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x8059('0x13')](function(_0x56d794){logger[_0x8059('0x7')](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')]('CreateSquareDetailsReport',_0x4b6d55,JSON['stringify'](_0x56d794));_0x2bb670(_0x56d794);})[_0x8059('0xe')](function(_0x232f1b){logger[_0x8059('0xc')](_0x8059('0xf'),_0x232f1b['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x232f1b[_0x8059('0xd')]));});});}; \ No newline at end of file +var _0x3f8c=['code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x126a1b,_0x4fac35){var _0x1f23e1=function(_0x559b87){while(--_0x559b87){_0x126a1b['push'](_0x126a1b['shift']());}};_0x1f23e1(++_0x4fac35);}(_0x3f8c,0x104));var _0xc3f8=function(_0x2cddc8,_0x1bf009){_0x2cddc8=_0x2cddc8-0x0;var _0x587596=_0x3f8c[_0x2cddc8];return _0x587596;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')](_0x2e7c0f['body'],{'raw':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f['options'][_0xc3f8('0x16')]===undefined?!![]:![]:!![]})[_0xc3f8('0x8')](function(_0x3b2e98){logger['info']('CreateSquareDetailsReport',_0x2e7c0f);logger[_0xc3f8('0x17')](_0xc3f8('0x12'),_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x3b2e98));_0xb4ab67(_0x3b2e98);})[_0xc3f8('0x18')](function(_0x6522e9){logger[_0xc3f8('0xe')](_0xc3f8('0x12'),_0x6522e9[_0xc3f8('0x10')],_0x2e7c0f);_0x47a185(_0x35500f['error'](0x1f4,_0x6522e9['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 189a6a7..29763a9 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 _0x9e81=['index','/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x46c57f,_0x5b28a3){var _0x32d171=function(_0x12c6ff){while(--_0x12c6ff){_0x46c57f['push'](_0x46c57f['shift']());}};_0x32d171(++_0x5b28a3);}(_0x9e81,0x133));var _0x19e8=function(_0x59e815,_0x8c9d72){_0x59e815=_0x59e815-0x0;var _0x16bf37=_0x9e81[_0x59e815];return _0x16bf37;};'use strict';var express=require('express');var router=express[_0x19e8('0x0')]();var auth=require(_0x19e8('0x1'));var controller=require(_0x19e8('0x2'));router[_0x19e8('0x3')]('/',auth[_0x19e8('0x4')](),controller[_0x19e8('0x5')]);router[_0x19e8('0x3')](_0x19e8('0x6'),auth[_0x19e8('0x4')](),controller['killProcess']);module[_0x19e8('0x7')]=router; \ No newline at end of file +var _0x2230=['exports','Router','../../components/auth/service','./system.controller','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x2e0115,_0x27bc38){var _0x5a1dae=function(_0xa86064){while(--_0xa86064){_0x2e0115['push'](_0x2e0115['shift']());}};_0x5a1dae(++_0x27bc38);}(_0x2230,0x161));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x0223('0x0')]();var auth=require(_0x0223('0x1'));var controller=require(_0x0223('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0x0223('0x3')]);router['get'](_0x0223('0x4'),auth[_0x0223('0x5')](),controller[_0x0223('0x6')]);module[_0x0223('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 57b5747..86b9c03 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 _0x52e1=['kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','then','json','catch','killProcess','components/import/cm','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0x52e1,0x170));var _0x152e=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x52e1[_0x49a982];return _0x2a0bc9;};'use strict';var info=require(_0x152e('0x0'));var exec=require('child_process')[_0x152e('0x1')];var logger=require(_0x152e('0x2'))(_0x152e('0x3'));var util=require(_0x152e('0x4'));var BPromise=require(_0x152e('0x5'));var _=require('lodash');function handleError(_0x1d06eb,_0x180121,_0x1fb415){_0x180121=_0x180121||0x1f4;return function(_0x5d2e14){logger[_0x152e('0x6')](_0x152e('0x7'),_0x1fb415,_0x180121,util[_0x152e('0x8')](_0x5d2e14,{'showHidden':![],'depth':null}));delete _0x5d2e14[_0x152e('0x9')];_0x1d06eb[_0x152e('0xa')](_0x180121)[_0x152e('0xb')](_0x5d2e14);};}exports['index']=function(_0x471bd0,_0x10c29d){return info['getAllData']()[_0x152e('0xc')](function(_0x1d795b){return _0x10c29d['status'](0xc8)[_0x152e('0xd')](_0x1d795b);})[_0x152e('0xe')](function(_0x3b7b3b){return _0x10c29d[_0x152e('0xa')](0x1f4)[_0x152e('0xd')](_0x3b7b3b);});};exports[_0x152e('0xf')]=function(_0x36db1a,_0x5e69b1){var _0x10f79c=[_0x152e('0x10')];return new BPromise(function(_0x5adb46,_0x11d245){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x36db1a['params']['pid']),function(_0x324c07,_0x6faec,_0x17fc6e){if(_0x324c07){return _0x11d245(_0x324c07);}return _0x5adb46(_0x6faec);});})['then'](function(_0x463c92){var _0x1e14d1=![];var _0x159b29=_0x463c92['split'](/\n/);for(var _0x34021a=0x0,_0x261452=_0x10f79c[_0x152e('0x11')];_0x34021a<_0x261452,_0x1e14d1===![];_0x34021a+=0x1){if(_0x463c92[_0x152e('0x12')](_0x10f79c[_0x34021a])>=0x0){_0x1e14d1=!![];}}if(!_0x1e14d1){throw new Error(util['format'](_0x152e('0x13'),_0x36db1a[_0x152e('0x14')][_0x152e('0x15')]));}process[_0x152e('0x16')](_0x36db1a[_0x152e('0x14')][_0x152e('0x15')],_0x152e('0x17'));return _0x5e69b1[_0x152e('0xa')](0xc8)[_0x152e('0xd')]({'message':util[_0x152e('0x18')](_0x152e('0x19'),_0x36db1a[_0x152e('0x14')][_0x152e('0x15')])});})['catch'](handleError(_0x5e69b1,null,'killProcess'));}; \ No newline at end of file +var _0x554e=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','catch','json','components/import/cm','format','params','pid','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','util'];(function(_0x52f617,_0x43f347){var _0x29ee7e=function(_0x5888f5){while(--_0x5888f5){_0x52f617['push'](_0x52f617['shift']());}};_0x29ee7e(++_0x43f347);}(_0x554e,0x165));var _0xe554=function(_0x53f74c,_0xd71010){_0x53f74c=_0x53f74c-0x0;var _0x467bc0=_0x554e[_0x53f74c];return _0x467bc0;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xe554('0x0')];var logger=require(_0xe554('0x1'))('api');var util=require(_0xe554('0x2'));var BPromise=require(_0xe554('0x3'));var _=require(_0xe554('0x4'));function handleError(_0x569f85,_0x5a277b,_0x435dfd){_0x5a277b=_0x5a277b||0x1f4;return function(_0x1fbd30){logger[_0xe554('0x5')](_0xe554('0x6'),_0x435dfd,_0x5a277b,util[_0xe554('0x7')](_0x1fbd30,{'showHidden':![],'depth':null}));delete _0x1fbd30[_0xe554('0x8')];_0x569f85[_0xe554('0x9')](_0x5a277b)[_0xe554('0xa')](_0x1fbd30);};}exports[_0xe554('0xb')]=function(_0x135099,_0x5b6691){return info[_0xe554('0xc')]()[_0xe554('0xd')](function(_0x33dbb7){return _0x5b6691[_0xe554('0x9')](0xc8)['json'](_0x33dbb7);})[_0xe554('0xe')](function(_0x304e04){return _0x5b6691[_0xe554('0x9')](0x1f4)[_0xe554('0xf')](_0x304e04);});};exports['killProcess']=function(_0x307ebd,_0x49d40b){var _0x3b528c=[_0xe554('0x10')];return new BPromise(function(_0x40e576,_0x4992f3){return exec(util[_0xe554('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x307ebd[_0xe554('0x12')][_0xe554('0x13')]),function(_0x4713ea,_0x1ae541,_0x4b11a0){if(_0x4713ea){return _0x4992f3(_0x4713ea);}return _0x40e576(_0x1ae541);});})[_0xe554('0xd')](function(_0x617d35){var _0x546545=![];var _0x5a5511=_0x617d35['split'](/\n/);for(var _0x1fd584=0x0,_0x50a2f8=_0x3b528c['length'];_0x1fd584<_0x50a2f8,_0x546545===![];_0x1fd584+=0x1){if(_0x617d35[_0xe554('0x14')](_0x3b528c[_0x1fd584])>=0x0){_0x546545=!![];}}if(!_0x546545){throw new Error(util[_0xe554('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x307ebd[_0xe554('0x12')]['pid']));}process[_0xe554('0x15')](_0x307ebd[_0xe554('0x12')][_0xe554('0x13')],'SIGINT');return _0x49d40b[_0xe554('0x9')](0xc8)[_0xe554('0xf')]({'message':util['format'](_0xe554('0x16'),_0x307ebd[_0xe554('0x12')]['pid'])});})[_0xe554('0xe')](handleError(_0x49d40b,null,_0xe554('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5060ed3..d5987a5 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 _0x5880=['./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x399546,_0x5598af){var _0x1687a3=function(_0x3f7fc2){while(--_0x3f7fc2){_0x399546['push'](_0x399546['shift']());}};_0x1687a3(++_0x5598af);}(_0x5880,0x186));var _0x0588=function(_0x1b1ba2,_0x4c10d0){_0x1b1ba2=_0x1b1ba2-0x0;var _0xc20480=_0x5880[_0x1b1ba2];return _0xc20480;};'use strict';var multer=require(_0x0588('0x0'));var util=require(_0x0588('0x1'));var path=require(_0x0588('0x2'));var timeout=require(_0x0588('0x3'));var express=require('express');var router=express[_0x0588('0x4')]();var fs_extra=require(_0x0588('0x5'));var auth=require(_0x0588('0x6'));var interaction=require(_0x0588('0x7'));var config=require(_0x0588('0x8'));var controller=require(_0x0588('0x9'));router[_0x0588('0xa')]('/',auth[_0x0588('0xb')](),controller[_0x0588('0xc')]);router['get'](_0x0588('0xd'),auth[_0x0588('0xb')](),controller[_0x0588('0xe')]);router[_0x0588('0xf')]('/',auth['isAuthenticated'](),controller[_0x0588('0x10')]);router[_0x0588('0x11')](_0x0588('0xd'),auth[_0x0588('0xb')](),controller[_0x0588('0x12')]);router['delete'](_0x0588('0xd'),auth[_0x0588('0xb')](),controller[_0x0588('0x13')]);module[_0x0588('0x14')]=router; \ No newline at end of file +var _0xf316=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xf316,0xd7));var _0x6f31=function(_0x15d0f8,_0x12533c){_0x15d0f8=_0x15d0f8-0x0;var _0x12c086=_0xf316[_0x15d0f8];return _0x12c086;};'use strict';var multer=require('multer');var util=require(_0x6f31('0x0'));var path=require(_0x6f31('0x1'));var timeout=require(_0x6f31('0x2'));var express=require(_0x6f31('0x3'));var router=express[_0x6f31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6f31('0x5'));var interaction=require(_0x6f31('0x6'));var config=require(_0x6f31('0x7'));var controller=require(_0x6f31('0x8'));router[_0x6f31('0x9')]('/',auth[_0x6f31('0xa')](),controller[_0x6f31('0xb')]);router[_0x6f31('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6f31('0xc')]);router[_0x6f31('0xd')]('/',auth['isAuthenticated'](),controller[_0x6f31('0xe')]);router[_0x6f31('0xf')](_0x6f31('0x10'),auth['isAuthenticated'](),controller[_0x6f31('0x11')]);router[_0x6f31('0x12')](_0x6f31('0x10'),auth[_0x6f31('0xa')](),controller[_0x6f31('0x13')]);module[_0x6f31('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9f9e7ee..df7ff97 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 _0x5987=['#0091EA','sequelize','exports','STRING','name'];(function(_0x28dace,_0x41dc50){var _0x2a759a=function(_0x228a32){while(--_0x228a32){_0x28dace['push'](_0x28dace['shift']());}};_0x2a759a(++_0x41dc50);}(_0x5987,0x128));var _0x7598=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5987[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7598('0x0'));module[_0x7598('0x1')]={'name':{'type':Sequelize[_0x7598('0x2')],'unique':_0x7598('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7598('0x4')},'description':{'type':Sequelize[_0x7598('0x2')]}}; \ No newline at end of file +var _0x6582=['sequelize','exports','STRING','name'];(function(_0x33a151,_0x3527b4){var _0x5664ab=function(_0x4de25c){while(--_0x4de25c){_0x33a151['push'](_0x33a151['shift']());}};_0x5664ab(++_0x3527b4);}(_0x6582,0x108));var _0x2658=function(_0x5b50ae,_0x7da7e1){_0x5b50ae=_0x5b50ae-0x0;var _0x84eb56=_0x6582[_0x5b50ae];return _0x84eb56;};'use strict';var Sequelize=require(_0x2658('0x0'));module[_0x2658('0x1')]={'name':{'type':Sequelize[_0x2658('0x2')],'unique':_0x2658('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x2658('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x2658('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 6a008a3..1f6bfb2 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 _0xf9f7=['fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','update','then','destroy','get','Tags','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','Tag','includeAll','include','rows','catch','show','find','create','role','user','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x55ec31,_0x3f1d64){var _0x47a20e=function(_0x312d99){while(--_0x312d99){_0x55ec31['push'](_0x55ec31['shift']());}};_0x47a20e(++_0x3f1d64);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x22ba54,_0x3c105b){_0x22ba54=_0x22ba54-0x0;var _0x17af5b=_0xf9f7[_0x22ba54];return _0x17af5b;};'use strict';var emlformat=require(_0x7f9f('0x0'));var rimraf=require(_0x7f9f('0x1'));var zipdir=require(_0x7f9f('0x2'));var jsonpatch=require(_0x7f9f('0x3'));var rp=require(_0x7f9f('0x4'));var moment=require(_0x7f9f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f9f('0x6'));var path=require(_0x7f9f('0x7'));var sox=require(_0x7f9f('0x8'));var csv=require(_0x7f9f('0x9'));var ejs=require(_0x7f9f('0xa'));var fs=require('fs');var fs_extra=require(_0x7f9f('0xb'));var _=require('lodash');var squel=require(_0x7f9f('0xc'));var crypto=require(_0x7f9f('0xd'));var jsforce=require(_0x7f9f('0xe'));var deskjs=require(_0x7f9f('0xf'));var toCsv=require(_0x7f9f('0x9'));var querystring=require('querystring');var Papa=require(_0x7f9f('0x10'));var Redis=require(_0x7f9f('0x11'));var authService=require(_0x7f9f('0x12'));var qs=require(_0x7f9f('0x13'));var as=require(_0x7f9f('0x14'));var hardwareService=require(_0x7f9f('0x15'));var logger=require(_0x7f9f('0x16'))('api');var utils=require(_0x7f9f('0x17'));var config=require(_0x7f9f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39291c,_0x52cb68){_0x52cb68=_0x52cb68||0xcc;return function(_0x1800a0){if(_0x1800a0){return _0x39291c[_0x7f9f('0x19')](_0x52cb68);}return _0x39291c['status'](_0x52cb68)[_0x7f9f('0x1a')]();};}function respondWithResult(_0x5f1035,_0x292470){_0x292470=_0x292470||0xc8;return function(_0x39adff){if(_0x39adff){return _0x5f1035[_0x7f9f('0x1b')](_0x292470)[_0x7f9f('0x1c')](_0x39adff);}};}function respondWithFilteredResult(_0x12b182,_0x5cbd29){return function(_0x331a98){if(_0x331a98){var _0x3768ee=typeof _0x5cbd29['offset']===_0x7f9f('0x1d')&&typeof _0x5cbd29['limit']===_0x7f9f('0x1d');var _0x15c864=_0x331a98[_0x7f9f('0x1e')];var _0x35f6b1=_0x3768ee?0x0:_0x5cbd29[_0x7f9f('0x1f')];var _0x11e263=_0x3768ee?_0x331a98['count']:_0x5cbd29[_0x7f9f('0x1f')]+_0x5cbd29[_0x7f9f('0x20')];var _0x5c6345;if(_0x11e263>=_0x15c864){_0x11e263=_0x15c864;_0x5c6345=0xc8;}else{_0x5c6345=0xce;}_0x12b182[_0x7f9f('0x1b')](_0x5c6345);return _0x12b182['set'](_0x7f9f('0x21'),_0x35f6b1+'-'+_0x11e263+'/'+_0x15c864)[_0x7f9f('0x1c')](_0x331a98);}return null;};}function patchUpdates(_0x8ad1b2){return function(_0x188c51){try{jsonpatch['apply'](_0x188c51,_0x8ad1b2,!![]);}catch(_0x3aba8c){return BPromise['reject'](_0x3aba8c);}return _0x188c51['save']();};}function saveUpdates(_0x324531,_0x730665){return function(_0x1f3f66){if(_0x1f3f66){return _0x1f3f66[_0x7f9f('0x22')](_0x324531)[_0x7f9f('0x23')](function(_0x5df2b2){return _0x5df2b2;});}return null;};}function removeEntity(_0x4c7a08,_0x3ec242){return function(_0x4acc4f){if(_0x4acc4f){return _0x4acc4f[_0x7f9f('0x24')]()[_0x7f9f('0x23')](function(){var _0x392574=_0x4acc4f[_0x7f9f('0x25')]({'plain':!![]});var _0x1a49a9=_0x7f9f('0x26');return db['UserProfileResource'][_0x7f9f('0x24')]({'where':{'type':_0x1a49a9,'resourceId':_0x392574['id']}})['then'](function(){return _0x4acc4f;});})[_0x7f9f('0x23')](function(){_0x4c7a08[_0x7f9f('0x1b')](0xcc)[_0x7f9f('0x1a')]();});}};}function handleEntityNotFound(_0x59eba2,_0x120bfd){return function(_0x3380d7){if(!_0x3380d7){_0x59eba2[_0x7f9f('0x19')](0x194);}return _0x3380d7;};}function handleError(_0x531f5f,_0x43912a){_0x43912a=_0x43912a||0x1f4;return function(_0x3b6e4c){logger['error'](_0x3b6e4c['stack']);if(_0x3b6e4c['name']){delete _0x3b6e4c[_0x7f9f('0x27')];}_0x531f5f['status'](_0x43912a)[_0x7f9f('0x28')](_0x3b6e4c);};}exports[_0x7f9f('0x29')]=function(_0x5d25bf,_0x54f103){var _0x95e3f2={},_0x4d7945={},_0x13f950={'count':0x0,'rows':[]};var _0x5cfc33=_['map'](db['Tag'][_0x7f9f('0x2a')],function(_0x506d43){return{'name':_0x506d43[_0x7f9f('0x2b')],'type':_0x506d43[_0x7f9f('0x2c')][_0x7f9f('0x2d')]};});_0x4d7945[_0x7f9f('0x2e')]=_[_0x7f9f('0x2f')](_0x5cfc33,'name');_0x4d7945['query']=_[_0x7f9f('0x30')](_0x5d25bf['query']);_0x4d7945['filters']=_[_0x7f9f('0x31')](_0x4d7945[_0x7f9f('0x2e')],_0x4d7945[_0x7f9f('0x32')]);_0x95e3f2[_0x7f9f('0x33')]=_[_0x7f9f('0x31')](_0x4d7945[_0x7f9f('0x2e')],qs[_0x7f9f('0x34')](_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x34')]));_0x95e3f2[_0x7f9f('0x33')]=_0x95e3f2[_0x7f9f('0x33')][_0x7f9f('0x35')]?_0x95e3f2[_0x7f9f('0x33')]:_0x4d7945[_0x7f9f('0x2e')];if(!_0x5d25bf['query'][_0x7f9f('0x36')]('nolimit')){_0x95e3f2[_0x7f9f('0x20')]=qs[_0x7f9f('0x20')](_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x20')]);_0x95e3f2[_0x7f9f('0x1f')]=qs['offset'](_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x1f')]);}_0x95e3f2['order']=qs[_0x7f9f('0x37')](_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x37')]);_0x95e3f2[_0x7f9f('0x38')]=qs[_0x7f9f('0x39')](_[_0x7f9f('0x3a')](_0x5d25bf[_0x7f9f('0x32')],_0x4d7945[_0x7f9f('0x39')]),_0x5cfc33);if(_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x3b')]){_0x95e3f2[_0x7f9f('0x38')]=_['merge'](_0x95e3f2[_0x7f9f('0x38')],{'$or':_[_0x7f9f('0x2f')](_0x5cfc33,function(_0x5c7f95){if(_0x5c7f95[_0x7f9f('0x2c')]!==_0x7f9f('0x3c')){var _0x57ea46={};_0x57ea46[_0x5c7f95[_0x7f9f('0x27')]]={'$like':'%'+_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x3b')]+'%'};return _0x57ea46;}})});}_0x95e3f2=_[_0x7f9f('0x3d')]({},_0x95e3f2,_0x5d25bf[_0x7f9f('0x3e')]);var _0x321f90={'where':_0x95e3f2['where']};return db[_0x7f9f('0x3f')][_0x7f9f('0x1e')](_0x321f90)['then'](function(_0x52382e){_0x13f950[_0x7f9f('0x1e')]=_0x52382e;if(_0x5d25bf[_0x7f9f('0x32')][_0x7f9f('0x40')]){_0x95e3f2[_0x7f9f('0x41')]=[{'all':!![]}];}return db[_0x7f9f('0x3f')]['findAll'](_0x95e3f2);})['then'](function(_0x3aeb1a){_0x13f950[_0x7f9f('0x42')]=_0x3aeb1a;return _0x13f950;})[_0x7f9f('0x23')](respondWithFilteredResult(_0x54f103,_0x95e3f2))[_0x7f9f('0x43')](handleError(_0x54f103,null));};exports[_0x7f9f('0x44')]=function(_0x3c2460,_0x7f6787){var _0x372d7a={'raw':!![],'where':{'id':_0x3c2460['params']['id']}},_0x7abe6f={};_0x7abe6f['model']=_[_0x7f9f('0x30')](db[_0x7f9f('0x3f')][_0x7f9f('0x2a')]);_0x7abe6f['query']=_['keys'](_0x3c2460['query']);_0x7abe6f[_0x7f9f('0x39')]=_['intersection'](_0x7abe6f[_0x7f9f('0x2e')],_0x7abe6f[_0x7f9f('0x32')]);_0x372d7a[_0x7f9f('0x33')]=_[_0x7f9f('0x31')](_0x7abe6f['model'],qs['fields'](_0x3c2460[_0x7f9f('0x32')][_0x7f9f('0x34')]));_0x372d7a['attributes']=_0x372d7a[_0x7f9f('0x33')]['length']?_0x372d7a[_0x7f9f('0x33')]:_0x7abe6f['model'];if(_0x3c2460[_0x7f9f('0x32')][_0x7f9f('0x40')]){_0x372d7a[_0x7f9f('0x41')]=[{'all':!![]}];}_0x372d7a=_[_0x7f9f('0x3d')]({},_0x372d7a,_0x3c2460['options']);return db[_0x7f9f('0x3f')][_0x7f9f('0x45')](_0x372d7a)[_0x7f9f('0x23')](handleEntityNotFound(_0x7f6787,null))['then'](respondWithResult(_0x7f6787,null))[_0x7f9f('0x43')](handleError(_0x7f6787,null));};exports[_0x7f9f('0x46')]=function(_0x575680,_0x485113){return db['Tag'][_0x7f9f('0x46')](_0x575680['body'],{})[_0x7f9f('0x23')](function(_0xcfa8a6){var _0x18bd9b=_0x575680['user'][_0x7f9f('0x25')]({'plain':!![]});if(!_0x18bd9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18bd9b[_0x7f9f('0x47')]===_0x7f9f('0x48')){var _0x266fea=_0xcfa8a6[_0x7f9f('0x25')]({'plain':!![]});var _0xd93926=_0x7f9f('0x26');return db['UserProfileSection'][_0x7f9f('0x45')]({'where':{'name':_0xd93926,'userProfileId':_0x18bd9b[_0x7f9f('0x49')]},'raw':!![]})[_0x7f9f('0x23')](function(_0x5bf288){if(_0x5bf288&&_0x5bf288['autoAssociation']===0x0){return db[_0x7f9f('0x4a')]['create']({'name':_0x266fea[_0x7f9f('0x27')],'resourceId':_0x266fea['id'],'type':_0x5bf288[_0x7f9f('0x27')],'sectionId':_0x5bf288['id']},{})['then'](function(){return _0xcfa8a6;});}else{return _0xcfa8a6;}})[_0x7f9f('0x43')](function(_0x16537f){logger[_0x7f9f('0x4b')](_0x7f9f('0x4c'),_0x16537f);throw _0x16537f;});}return _0xcfa8a6;})[_0x7f9f('0x23')](respondWithResult(_0x485113,0xc9))['catch'](handleError(_0x485113,null));};exports[_0x7f9f('0x22')]=function(_0x3a60bd,_0x116475){if(_0x3a60bd[_0x7f9f('0x4d')]['id']){delete _0x3a60bd[_0x7f9f('0x4d')]['id'];}return db['Tag']['find']({'where':{'id':_0x3a60bd['params']['id']}})['then'](handleEntityNotFound(_0x116475,null))['then'](saveUpdates(_0x3a60bd[_0x7f9f('0x4d')],null))[_0x7f9f('0x23')](respondWithResult(_0x116475,null))[_0x7f9f('0x43')](handleError(_0x116475,null));};exports['destroy']=function(_0x127507,_0x17a6a0){return db[_0x7f9f('0x3f')][_0x7f9f('0x45')]({'where':{'id':_0x127507['params']['id']}})['then'](handleEntityNotFound(_0x17a6a0,null))[_0x7f9f('0x23')](removeEntity(_0x17a6a0,null))['catch'](handleError(_0x17a6a0,null));}; \ No newline at end of file +var _0xc3fe=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','status','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','body','params'];(function(_0x521347,_0x4b0ba5){var _0x4e2b48=function(_0x46a8f4){while(--_0x46a8f4){_0x521347['push'](_0x521347['shift']());}};_0x4e2b48(++_0x4b0ba5);}(_0xc3fe,0xff));var _0xec3f=function(_0x3290db,_0x45ea71){_0x3290db=_0x3290db-0x0;var _0x5e8c4e=_0xc3fe[_0x3290db];return _0x5e8c4e;};'use strict';var emlformat=require(_0xec3f('0x0'));var rimraf=require(_0xec3f('0x1'));var zipdir=require(_0xec3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec3f('0x3'));var moment=require(_0xec3f('0x4'));var BPromise=require(_0xec3f('0x5'));var Mustache=require('mustache');var util=require(_0xec3f('0x6'));var path=require(_0xec3f('0x7'));var sox=require(_0xec3f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec3f('0x9'));var _=require(_0xec3f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec3f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xec3f('0xc'));var querystring=require(_0xec3f('0xd'));var Papa=require(_0xec3f('0xe'));var Redis=require(_0xec3f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xec3f('0x10'));var as=require(_0xec3f('0x11'));var hardwareService=require(_0xec3f('0x12'));var logger=require(_0xec3f('0x13'))(_0xec3f('0x14'));var utils=require(_0xec3f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec3f('0x16'));var db=require(_0xec3f('0x17'))['db'];function respondWithStatusCode(_0x367c5e,_0x57891d){_0x57891d=_0x57891d||0xcc;return function(_0x5367df){if(_0x5367df){return _0x367c5e[_0xec3f('0x18')](_0x57891d);}return _0x367c5e['status'](_0x57891d)['end']();};}function respondWithResult(_0x209ffa,_0x4318bd){_0x4318bd=_0x4318bd||0xc8;return function(_0x113d16){if(_0x113d16){return _0x209ffa['status'](_0x4318bd)['json'](_0x113d16);}};}function respondWithFilteredResult(_0x5509ec,_0x5ad65a){return function(_0x37d688){if(_0x37d688){var _0x10ff81=typeof _0x5ad65a['offset']===_0xec3f('0x19')&&typeof _0x5ad65a[_0xec3f('0x1a')]===_0xec3f('0x19');var _0x3b7393=_0x37d688['count'];var _0x7805c=_0x10ff81?0x0:_0x5ad65a[_0xec3f('0x1b')];var _0x2d338=_0x10ff81?_0x37d688[_0xec3f('0x1c')]:_0x5ad65a[_0xec3f('0x1b')]+_0x5ad65a['limit'];var _0x2f8bc8;if(_0x2d338>=_0x3b7393){_0x2d338=_0x3b7393;_0x2f8bc8=0xc8;}else{_0x2f8bc8=0xce;}_0x5509ec['status'](_0x2f8bc8);return _0x5509ec[_0xec3f('0x1d')](_0xec3f('0x1e'),_0x7805c+'-'+_0x2d338+'/'+_0x3b7393)[_0xec3f('0x1f')](_0x37d688);}return null;};}function patchUpdates(_0x47b6f9){return function(_0x526ff){try{jsonpatch[_0xec3f('0x20')](_0x526ff,_0x47b6f9,!![]);}catch(_0x4fdfc3){return BPromise[_0xec3f('0x21')](_0x4fdfc3);}return _0x526ff[_0xec3f('0x22')]();};}function saveUpdates(_0x1f173f,_0x395b9a){return function(_0x4d9598){if(_0x4d9598){return _0x4d9598[_0xec3f('0x23')](_0x1f173f)[_0xec3f('0x24')](function(_0x2f45bb){return _0x2f45bb;});}return null;};}function removeEntity(_0x4e4770,_0xfc9c0d){return function(_0x4b5932){if(_0x4b5932){return _0x4b5932[_0xec3f('0x25')]()['then'](function(){var _0x56ecc3=_0x4b5932[_0xec3f('0x26')]({'plain':!![]});var _0x482bf2=_0xec3f('0x27');return db[_0xec3f('0x28')][_0xec3f('0x25')]({'where':{'type':_0x482bf2,'resourceId':_0x56ecc3['id']}})['then'](function(){return _0x4b5932;});})[_0xec3f('0x24')](function(){_0x4e4770[_0xec3f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53cc0d,_0x3e5244){return function(_0x48e166){if(!_0x48e166){_0x53cc0d[_0xec3f('0x18')](0x194);}return _0x48e166;};}function handleError(_0x1b3155,_0x358fcd){_0x358fcd=_0x358fcd||0x1f4;return function(_0x2eac8d){logger[_0xec3f('0x2a')](_0x2eac8d[_0xec3f('0x2b')]);if(_0x2eac8d[_0xec3f('0x2c')]){delete _0x2eac8d[_0xec3f('0x2c')];}_0x1b3155['status'](_0x358fcd)[_0xec3f('0x2d')](_0x2eac8d);};}exports[_0xec3f('0x2e')]=function(_0x4bfff2,_0x91c11a){var _0xb6da0={},_0x328284={},_0x185b20={'count':0x0,'rows':[]};var _0x26fb2a=_[_0xec3f('0x2f')](db[_0xec3f('0x30')][_0xec3f('0x31')],function(_0x32a522){return{'name':_0x32a522[_0xec3f('0x32')],'type':_0x32a522[_0xec3f('0x33')][_0xec3f('0x34')]};});_0x328284[_0xec3f('0x35')]=_[_0xec3f('0x2f')](_0x26fb2a,_0xec3f('0x2c'));_0x328284['query']=_[_0xec3f('0x36')](_0x4bfff2[_0xec3f('0x37')]);_0x328284[_0xec3f('0x38')]=_[_0xec3f('0x39')](_0x328284[_0xec3f('0x35')],_0x328284['query']);_0xb6da0[_0xec3f('0x3a')]=_[_0xec3f('0x39')](_0x328284[_0xec3f('0x35')],qs['fields'](_0x4bfff2['query'][_0xec3f('0x3b')]));_0xb6da0['attributes']=_0xb6da0[_0xec3f('0x3a')]['length']?_0xb6da0[_0xec3f('0x3a')]:_0x328284['model'];if(!_0x4bfff2['query'][_0xec3f('0x3c')](_0xec3f('0x3d'))){_0xb6da0[_0xec3f('0x1a')]=qs[_0xec3f('0x1a')](_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x1a')]);_0xb6da0['offset']=qs['offset'](_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x1b')]);}_0xb6da0[_0xec3f('0x3e')]=qs[_0xec3f('0x3f')](_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x3f')]);_0xb6da0[_0xec3f('0x40')]=qs['filters'](_[_0xec3f('0x41')](_0x4bfff2['query'],_0x328284[_0xec3f('0x38')]),_0x26fb2a);if(_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x42')]){_0xb6da0[_0xec3f('0x40')]=_[_0xec3f('0x43')](_0xb6da0[_0xec3f('0x40')],{'$or':_[_0xec3f('0x2f')](_0x26fb2a,function(_0x17722c){if(_0x17722c[_0xec3f('0x33')]!==_0xec3f('0x44')){var _0x38a9e3={};_0x38a9e3[_0x17722c[_0xec3f('0x2c')]]={'$like':'%'+_0x4bfff2[_0xec3f('0x37')]['filter']+'%'};return _0x38a9e3;}})});}_0xb6da0=_[_0xec3f('0x43')]({},_0xb6da0,_0x4bfff2[_0xec3f('0x45')]);var _0x4b416d={'where':_0xb6da0[_0xec3f('0x40')]};return db[_0xec3f('0x30')]['count'](_0x4b416d)[_0xec3f('0x24')](function(_0xae1b8a){_0x185b20[_0xec3f('0x1c')]=_0xae1b8a;if(_0x4bfff2[_0xec3f('0x37')][_0xec3f('0x46')]){_0xb6da0[_0xec3f('0x47')]=[{'all':!![]}];}return db['Tag'][_0xec3f('0x48')](_0xb6da0);})[_0xec3f('0x24')](function(_0x1c6494){_0x185b20[_0xec3f('0x49')]=_0x1c6494;return _0x185b20;})[_0xec3f('0x24')](respondWithFilteredResult(_0x91c11a,_0xb6da0))[_0xec3f('0x4a')](handleError(_0x91c11a,null));};exports[_0xec3f('0x4b')]=function(_0x18c560,_0x42d1ae){var _0x5f4033={'raw':!![],'where':{'id':_0x18c560['params']['id']}},_0x8d0f18={};_0x8d0f18[_0xec3f('0x35')]=_[_0xec3f('0x36')](db[_0xec3f('0x30')][_0xec3f('0x31')]);_0x8d0f18[_0xec3f('0x37')]=_[_0xec3f('0x36')](_0x18c560[_0xec3f('0x37')]);_0x8d0f18[_0xec3f('0x38')]=_[_0xec3f('0x39')](_0x8d0f18[_0xec3f('0x35')],_0x8d0f18[_0xec3f('0x37')]);_0x5f4033[_0xec3f('0x3a')]=_['intersection'](_0x8d0f18[_0xec3f('0x35')],qs[_0xec3f('0x3b')](_0x18c560['query'][_0xec3f('0x3b')]));_0x5f4033[_0xec3f('0x3a')]=_0x5f4033[_0xec3f('0x3a')][_0xec3f('0x4c')]?_0x5f4033['attributes']:_0x8d0f18['model'];if(_0x18c560[_0xec3f('0x37')][_0xec3f('0x46')]){_0x5f4033['include']=[{'all':!![]}];}_0x5f4033=_[_0xec3f('0x43')]({},_0x5f4033,_0x18c560[_0xec3f('0x45')]);return db[_0xec3f('0x30')]['find'](_0x5f4033)[_0xec3f('0x24')](handleEntityNotFound(_0x42d1ae,null))['then'](respondWithResult(_0x42d1ae,null))['catch'](handleError(_0x42d1ae,null));};exports['create']=function(_0x97c57d,_0x1b7cf6){return db[_0xec3f('0x30')][_0xec3f('0x4d')](_0x97c57d['body'],{})[_0xec3f('0x24')](function(_0x54673e){var _0x5af435=_0x97c57d[_0xec3f('0x4e')][_0xec3f('0x26')]({'plain':!![]});if(!_0x5af435)throw new Error(_0xec3f('0x4f'));if(_0x5af435[_0xec3f('0x50')]===_0xec3f('0x4e')){var _0x515bf2=_0x54673e[_0xec3f('0x26')]({'plain':!![]});var _0x56e5c2=_0xec3f('0x27');return db['UserProfileSection'][_0xec3f('0x51')]({'where':{'name':_0x56e5c2,'userProfileId':_0x5af435['userProfileId']},'raw':!![]})[_0xec3f('0x24')](function(_0x370660){if(_0x370660&&_0x370660[_0xec3f('0x52')]===0x0){return db[_0xec3f('0x28')][_0xec3f('0x4d')]({'name':_0x515bf2[_0xec3f('0x2c')],'resourceId':_0x515bf2['id'],'type':_0x370660[_0xec3f('0x2c')],'sectionId':_0x370660['id']},{})[_0xec3f('0x24')](function(){return _0x54673e;});}else{return _0x54673e;}})['catch'](function(_0x230aad){logger[_0xec3f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230aad);throw _0x230aad;});}return _0x54673e;})[_0xec3f('0x24')](respondWithResult(_0x1b7cf6,0xc9))['catch'](handleError(_0x1b7cf6,null));};exports[_0xec3f('0x23')]=function(_0x4cc474,_0x3d1767){if(_0x4cc474['body']['id']){delete _0x4cc474[_0xec3f('0x53')]['id'];}return db['Tag'][_0xec3f('0x51')]({'where':{'id':_0x4cc474[_0xec3f('0x54')]['id']}})[_0xec3f('0x24')](handleEntityNotFound(_0x3d1767,null))[_0xec3f('0x24')](saveUpdates(_0x4cc474[_0xec3f('0x53')],null))[_0xec3f('0x24')](respondWithResult(_0x3d1767,null))['catch'](handleError(_0x3d1767,null));};exports[_0xec3f('0x25')]=function(_0x584c68,_0x13825e){return db[_0xec3f('0x30')][_0xec3f('0x51')]({'where':{'id':_0x584c68[_0xec3f('0x54')]['id']}})[_0xec3f('0x24')](handleEntityNotFound(_0x13825e,null))[_0xec3f('0x24')](removeEntity(_0x13825e,null))[_0xec3f('0x4a')](handleError(_0x13825e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 43fbaa4..f300c48 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 _0x6e65=['define','tools_tags','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e65,0x1c5));var _0x56e6=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0x6e65[_0x132d9e];return _0x40b733;};'use strict';var _=require(_0x56e6('0x0'));var util=require('util');var logger=require(_0x56e6('0x1'))(_0x56e6('0x2'));var moment=require(_0x56e6('0x3'));var BPromise=require(_0x56e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56e6('0x5'));var config=require(_0x56e6('0x6'));var attributes=require(_0x56e6('0x7'));module[_0x56e6('0x8')]=function(_0x5cc513,_0xf3a1c3){return _0x5cc513[_0x56e6('0x9')]('Tag',attributes,{'tableName':_0x56e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf62=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','api','moment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xcf62,0x71));var _0x2cf6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcf62[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2cf6('0x0'));var util=require(_0x2cf6('0x1'));var logger=require('../../config/logger')(_0x2cf6('0x2'));var moment=require(_0x2cf6('0x3'));var BPromise=require(_0x2cf6('0x4'));var rp=require(_0x2cf6('0x5'));var fs=require('fs');var path=require(_0x2cf6('0x6'));var rimraf=require(_0x2cf6('0x7'));var config=require(_0x2cf6('0x8'));var attributes=require(_0x2cf6('0x9'));module['exports']=function(_0x3fe4c2,_0x55ab07){return _0x3fe4c2[_0x2cf6('0xa')](_0x2cf6('0xb'),attributes,{'tableName':_0x2cf6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 9e116eb..673a8f7 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 _0x79a8=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x79a8,0x1d0));var _0x879a=function(_0x4361c1,_0x175703){_0x4361c1=_0x4361c1-0x0;var _0x7d47bd=_0x79a8[_0x4361c1];return _0x7d47bd;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var moment=require(_0x879a('0x1'));var BPromise=require(_0x879a('0x2'));var rs=require(_0x879a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x879a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x879a('0x5'))(_0x879a('0x6'));var config=require(_0x879a('0x7'));var jayson=require(_0x879a('0x8'));var client=jayson[_0x879a('0x9')][_0x879a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d353e,_0x2427bf,_0x4bf3ab){return new BPromise(function(_0xe27fe6,_0x5cb5c9){return client[_0x879a('0xb')](_0x1d353e,_0x4bf3ab)[_0x879a('0xc')](function(_0x5eba04){logger[_0x879a('0xd')](_0x879a('0xe'),_0x2427bf,_0x879a('0xf'));logger['debug'](_0x879a('0x10'),_0x2427bf,_0x879a('0xf'),JSON['stringify'](_0x5eba04));if(_0x5eba04['error']){if(_0x5eba04[_0x879a('0x11')][_0x879a('0x12')]===0x1f4){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04['error'][_0x879a('0x13')]);return _0x5cb5c9(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);return _0xe27fe6(_0x5eba04[_0x879a('0x11')][_0x879a('0x13')]);}else{logger[_0x879a('0xd')]('Tag,\x20%s,\x20%s',_0x2427bf,'request\x20sent');_0xe27fe6(_0x5eba04[_0x879a('0x14')][_0x879a('0x13')]);}})['catch'](function(_0x119260){logger[_0x879a('0x11')](_0x879a('0xe'),_0x2427bf,_0x119260);_0x5cb5c9(_0x119260);});});} \ No newline at end of file +var _0xb458=['Tag,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','debug'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb458,0x103));var _0x8b45=function(_0x41cb9f,_0x34f6e0){_0x41cb9f=_0x41cb9f-0x0;var _0x426494=_0xb458[_0x41cb9f];return _0x426494;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f0ec766..df14fa0 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 50b5077..452c64b 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 _0xb7e7=['STRING','sequelize'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xb7e7,0x121));var _0x7b7e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb7e7[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x4a5b02,_0x2f2061){var _0xaef9c5=function(_0x50437d){while(--_0x50437d){_0x4a5b02['push'](_0x4a5b02['shift']());}};_0xaef9c5(++_0x2f2061);}(_0x757a,0xde));var _0xa757=function(_0x244c96,_0x1a8e6a){_0x244c96=_0x244c96-0x0;var _0x113f5f=_0x757a[_0x244c96];return _0x113f5f;};'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 7dcf330..1e6a9ae 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 _0x03d1=['Unknown\x20channel','remove','ids','addAgents','isArray','Chat','Mail','Fax','Openchannel','Whatsapp','Voice','through','penalty','Queues','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','findAll','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','TeamVoicePrefix','VoicePrefixId','removeAgents','Sms','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','then','error','stack','name','send','index','map','Team','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','get','role','Teams','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','UserMailQueue','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','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','UserVoicePrefix','end','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','addQueues','removeQueues'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x03d1,0x1ea));var _0x103d=function(_0x4c218d,_0x52bb0d){_0x4c218d=_0x4c218d-0x0;var _0x52ebb9=_0x03d1[_0x4c218d];return _0x52ebb9;};'use strict';var emlformat=require(_0x103d('0x0'));var rimraf=require(_0x103d('0x1'));var zipdir=require(_0x103d('0x2'));var jsonpatch=require(_0x103d('0x3'));var rp=require(_0x103d('0x4'));var moment=require(_0x103d('0x5'));var BPromise=require(_0x103d('0x6'));var Mustache=require('mustache');var util=require(_0x103d('0x7'));var path=require(_0x103d('0x8'));var sox=require(_0x103d('0x9'));var csv=require('to-csv');var ejs=require(_0x103d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x103d('0xb'));var squel=require('squel');var crypto=require(_0x103d('0xc'));var jsforce=require(_0x103d('0xd'));var deskjs=require(_0x103d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x103d('0xf'));var Papa=require(_0x103d('0x10'));var Redis=require(_0x103d('0x11'));var authService=require(_0x103d('0x12'));var qs=require(_0x103d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x103d('0x14'));var logger=require(_0x103d('0x15'))(_0x103d('0x16'));var utils=require(_0x103d('0x17'));var config=require(_0x103d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x103d('0x19'))['db'];config[_0x103d('0x1a')]=_[_0x103d('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x103d('0x1c'))(new Redis(config['redis']));require(_0x103d('0x1d'))['register'](socket);function respondWithStatusCode(_0x38bafc,_0x3e9dad){_0x3e9dad=_0x3e9dad||0xcc;return function(_0x197ed3){if(_0x197ed3){return _0x38bafc[_0x103d('0x1e')](_0x3e9dad);}return _0x38bafc[_0x103d('0x1f')](_0x3e9dad)['end']();};}function respondWithResult(_0x5a3230,_0x150763){_0x150763=_0x150763||0xc8;return function(_0x5dca1b){if(_0x5dca1b){return _0x5a3230[_0x103d('0x1f')](_0x150763)[_0x103d('0x20')](_0x5dca1b);}};}function respondWithFilteredResult(_0xefb2df,_0x5556ab){return function(_0x1980cf){if(_0x1980cf){var _0x5ca109=typeof _0x5556ab[_0x103d('0x21')]==='undefined'&&typeof _0x5556ab[_0x103d('0x22')]===_0x103d('0x23');var _0x23a71c=_0x1980cf[_0x103d('0x24')];var _0x5a7d47=_0x5ca109?0x0:_0x5556ab[_0x103d('0x21')];var _0xa77a56=_0x5ca109?_0x1980cf[_0x103d('0x24')]:_0x5556ab[_0x103d('0x21')]+_0x5556ab[_0x103d('0x22')];var _0x36a98b;if(_0xa77a56>=_0x23a71c){_0xa77a56=_0x23a71c;_0x36a98b=0xc8;}else{_0x36a98b=0xce;}_0xefb2df[_0x103d('0x1f')](_0x36a98b);return _0xefb2df['set']('Content-Range',_0x5a7d47+'-'+_0xa77a56+'/'+_0x23a71c)[_0x103d('0x20')](_0x1980cf);}return null;};}function patchUpdates(_0x136f97){return function(_0x2e0ba9){try{jsonpatch['apply'](_0x2e0ba9,_0x136f97,!![]);}catch(_0x31ec3e){return BPromise[_0x103d('0x25')](_0x31ec3e);}return _0x2e0ba9[_0x103d('0x26')]();};}function saveUpdates(_0x16722f,_0x287da7){return function(_0x454634){if(_0x454634){return _0x454634[_0x103d('0x27')](_0x16722f)[_0x103d('0x28')](function(_0x19ca25){return _0x19ca25;});}return null;};}function handleEntityNotFound(_0xee0493,_0x4127da){return function(_0xbe9f0d){if(!_0xbe9f0d){_0xee0493[_0x103d('0x1e')](0x194);}return _0xbe9f0d;};}function handleError(_0x5dae47,_0x3f37c1){_0x3f37c1=_0x3f37c1||0x1f4;return function(_0x336bae){logger[_0x103d('0x29')](_0x336bae[_0x103d('0x2a')]);if(_0x336bae[_0x103d('0x2b')]){delete _0x336bae[_0x103d('0x2b')];}_0x5dae47['status'](_0x3f37c1)[_0x103d('0x2c')](_0x336bae);};}exports[_0x103d('0x2d')]=function(_0x99fb4b,_0x2f0da0){var _0x369954={},_0x599c6c={},_0x544f10={'count':0x0,'rows':[]};var _0x2e8666=_[_0x103d('0x2e')](db[_0x103d('0x2f')]['rawAttributes'],function(_0xc14477){return{'name':_0xc14477[_0x103d('0x30')],'type':_0xc14477['type'][_0x103d('0x31')]};});_0x599c6c['model']=_[_0x103d('0x2e')](_0x2e8666,_0x103d('0x2b'));_0x599c6c['query']=_[_0x103d('0x32')](_0x99fb4b[_0x103d('0x33')]);_0x599c6c[_0x103d('0x34')]=_[_0x103d('0x35')](_0x599c6c[_0x103d('0x36')],_0x599c6c[_0x103d('0x33')]);_0x369954['attributes']=_[_0x103d('0x35')](_0x599c6c['model'],qs[_0x103d('0x37')](_0x99fb4b[_0x103d('0x33')][_0x103d('0x37')]));_0x369954['attributes']=_0x369954[_0x103d('0x38')][_0x103d('0x39')]?_0x369954[_0x103d('0x38')]:_0x599c6c[_0x103d('0x36')];if(!_0x99fb4b[_0x103d('0x33')][_0x103d('0x3a')](_0x103d('0x3b'))){_0x369954[_0x103d('0x22')]=qs['limit'](_0x99fb4b[_0x103d('0x33')]['limit']);_0x369954[_0x103d('0x21')]=qs['offset'](_0x99fb4b[_0x103d('0x33')][_0x103d('0x21')]);}_0x369954[_0x103d('0x3c')]=qs[_0x103d('0x3d')](_0x99fb4b[_0x103d('0x33')][_0x103d('0x3d')]);_0x369954['where']=qs['filters'](_[_0x103d('0x3e')](_0x99fb4b[_0x103d('0x33')],_0x599c6c[_0x103d('0x34')]),_0x2e8666);if(_0x99fb4b[_0x103d('0x33')][_0x103d('0x3f')]){_0x369954['where']=_[_0x103d('0x40')](_0x369954[_0x103d('0x41')],{'$or':_[_0x103d('0x2e')](_0x2e8666,function(_0x452dff){if(_0x452dff[_0x103d('0x42')]!==_0x103d('0x43')){var _0x107d68={};_0x107d68[_0x452dff['name']]={'$like':'%'+_0x99fb4b[_0x103d('0x33')][_0x103d('0x3f')]+'%'};return _0x107d68;}})});}_0x369954=_[_0x103d('0x40')]({},_0x369954,_0x99fb4b[_0x103d('0x44')]);var _0x220928={'where':_0x369954[_0x103d('0x41')]};return db[_0x103d('0x2f')][_0x103d('0x24')](_0x220928)[_0x103d('0x28')](function(_0x3faac0){_0x544f10[_0x103d('0x24')]=_0x3faac0;if(_0x99fb4b['query'][_0x103d('0x45')]){_0x369954[_0x103d('0x46')]=[{'all':!![]}];}return db[_0x103d('0x2f')]['findAll'](_0x369954);})['then'](function(_0x123233){_0x544f10[_0x103d('0x47')]=_0x123233;return _0x544f10;})['then'](respondWithFilteredResult(_0x2f0da0,_0x369954))[_0x103d('0x48')](handleError(_0x2f0da0,null));};exports[_0x103d('0x49')]=function(_0x2addfb,_0x275214){var _0x2f7826={'raw':![],'where':{'id':_0x2addfb['params']['id']}},_0x243b33={};_0x243b33[_0x103d('0x36')]=_['keys'](db[_0x103d('0x2f')][_0x103d('0x4a')]);_0x243b33[_0x103d('0x33')]=_[_0x103d('0x32')](_0x2addfb['query']);_0x243b33[_0x103d('0x34')]=_[_0x103d('0x35')](_0x243b33[_0x103d('0x36')],_0x243b33[_0x103d('0x33')]);_0x2f7826[_0x103d('0x38')]=_[_0x103d('0x35')](_0x243b33[_0x103d('0x36')],qs[_0x103d('0x37')](_0x2addfb['query']['fields']));_0x2f7826[_0x103d('0x38')]=_0x2f7826['attributes']['length']?_0x2f7826['attributes']:_0x243b33['model'];if(_0x2addfb[_0x103d('0x33')]['includeAll']){_0x2f7826[_0x103d('0x46')]=[{'all':!![]}];}_0x2f7826=_[_0x103d('0x40')]({},_0x2f7826,_0x2addfb[_0x103d('0x44')]);return db[_0x103d('0x2f')][_0x103d('0x4b')](_0x2f7826)[_0x103d('0x28')](handleEntityNotFound(_0x275214,null))['then'](respondWithResult(_0x275214,null))['catch'](handleError(_0x275214,null));};exports[_0x103d('0x4c')]=function(_0x53b365,_0x2dc40d){return db[_0x103d('0x2f')]['create'](_0x53b365[_0x103d('0x4d')],{})[_0x103d('0x28')](function(_0x17d325){var _0x5d596a=_0x53b365[_0x103d('0x4e')][_0x103d('0x4f')]({'plain':!![]});if(!_0x5d596a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d596a[_0x103d('0x50')]==='user'){var _0x23a515=_0x17d325[_0x103d('0x4f')]({'plain':!![]});var _0x212420=_0x103d('0x51');return db['UserProfileSection'][_0x103d('0x4b')]({'where':{'name':_0x212420,'userProfileId':_0x5d596a['userProfileId']},'raw':!![]})[_0x103d('0x28')](function(_0x18e679){if(_0x18e679&&_0x18e679[_0x103d('0x52')]===0x0){return db[_0x103d('0x53')]['create']({'name':_0x23a515['name'],'resourceId':_0x23a515['id'],'type':_0x18e679[_0x103d('0x2b')],'sectionId':_0x18e679['id']},{})['then'](function(){return _0x17d325;});}else{return _0x17d325;}})[_0x103d('0x48')](function(_0x2abcad){logger[_0x103d('0x29')](_0x103d('0x54'),_0x2abcad);throw _0x2abcad;});}return _0x17d325;})[_0x103d('0x28')](respondWithResult(_0x2dc40d,0xc9))[_0x103d('0x48')](handleError(_0x2dc40d,null));};exports[_0x103d('0x27')]=function(_0x268a52,_0x4b0b4c){if(_0x268a52[_0x103d('0x4d')]['id']){delete _0x268a52[_0x103d('0x4d')]['id'];}return db[_0x103d('0x2f')][_0x103d('0x4b')]({'where':{'id':_0x268a52[_0x103d('0x55')]['id']}})[_0x103d('0x28')](handleEntityNotFound(_0x4b0b4c,null))[_0x103d('0x28')](saveUpdates(_0x268a52[_0x103d('0x4d')],null))[_0x103d('0x28')](respondWithResult(_0x4b0b4c,null))['catch'](handleError(_0x4b0b4c,null));};exports[_0x103d('0x56')]=function(_0x3946e1,_0x1b798a){var _0x10388c=_0x3946e1[_0x103d('0x55')]['id'];var _0xb97f54=[];return db[_0x103d('0x57')][_0x103d('0x58')](function(_0x3fbec1){var _0x49a6db=_0x103d('0x59')+_0x10388c;return db[_0x103d('0x57')]['query'](_0x49a6db,{'type':db['Sequelize']['QueryTypes'][_0x103d('0x5a')],'raw':!![],'transaction':_0x3fbec1})['then'](function(_0x2b89a9){_0xb97f54=_[_0x103d('0x2e')](_0x2b89a9,function(_0x95d06c){return Number(_0x95d06c[_0x103d('0x5b')]);});})[_0x103d('0x28')](function(){var _0x10ceda=_0x103d('0x5c')+_0x10388c;return db[_0x103d('0x57')][_0x103d('0x33')](_0x10ceda,{'type':db['Sequelize'][_0x103d('0x5d')][_0x103d('0x5a')],'raw':!![],'transaction':_0x3fbec1});})['then'](function(_0x8a8437){var _0x4f6f4f=_[_0x103d('0x2e')](_0x8a8437,function(_0x2b6750){return Number(_0x2b6750['VoiceQueueId']);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0xb97f54},'VoiceQueueId':{'$in':_0x4f6f4f}},'transaction':_0x3fbec1});})['then'](function(){var _0x53595f=_0x103d('0x5e')+_0x10388c;return db['sequelize']['query'](_0x53595f,{'type':db[_0x103d('0x5f')][_0x103d('0x5d')][_0x103d('0x5a')],'raw':!![],'transaction':_0x3fbec1});})[_0x103d('0x28')](function(_0x19d459){var _0x4866fa=_[_0x103d('0x2e')](_0x19d459,function(_0x13e972){return Number(_0x13e972[_0x103d('0x60')]);});return db[_0x103d('0x61')]['destroy']({'where':{'UserId':{'$in':_0xb97f54},'MailQueueId':{'$in':_0x4866fa}},'transaction':_0x3fbec1});})['then'](function(){var _0x121a5d='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x10388c;return db[_0x103d('0x57')][_0x103d('0x33')](_0x121a5d,{'type':db['Sequelize'][_0x103d('0x5d')]['SELECT'],'raw':!![],'transaction':_0x3fbec1});})[_0x103d('0x28')](function(_0x22a4d7){var _0x150955=_[_0x103d('0x2e')](_0x22a4d7,function(_0x331fbc){return Number(_0x331fbc[_0x103d('0x62')]);});return db['UserSmsQueue'][_0x103d('0x56')]({'where':{'UserId':{'$in':_0xb97f54},'SmsQueueId':{'$in':_0x150955}},'transaction':_0x3fbec1});})[_0x103d('0x28')](function(){var _0x2c47d2=_0x103d('0x63')+_0x10388c;return db[_0x103d('0x57')][_0x103d('0x33')](_0x2c47d2,{'type':db[_0x103d('0x5f')][_0x103d('0x5d')][_0x103d('0x5a')],'raw':!![],'transaction':_0x3fbec1});})[_0x103d('0x28')](function(_0x48386c){var _0x5e88fb=_[_0x103d('0x2e')](_0x48386c,function(_0x4a1051){return Number(_0x4a1051['ChatQueueId']);});return db[_0x103d('0x64')]['destroy']({'where':{'UserId':{'$in':_0xb97f54},'ChatQueueId':{'$in':_0x5e88fb}},'transaction':_0x3fbec1});})['then'](function(){var _0x43fb61='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x10388c;return db[_0x103d('0x57')][_0x103d('0x33')](_0x43fb61,{'type':db[_0x103d('0x5f')]['QueryTypes'][_0x103d('0x5a')],'raw':!![],'transaction':_0x3fbec1});})['then'](function(_0x2e8c15){var _0x2820f3=_[_0x103d('0x2e')](_0x2e8c15,function(_0x4350cc){return Number(_0x4350cc['FaxQueueId']);});return db['UserFaxQueue'][_0x103d('0x56')]({'where':{'UserId':{'$in':_0xb97f54},'FaxQueueId':{'$in':_0x2820f3}},'transaction':_0x3fbec1});})['then'](function(){var _0x22a501=_0x103d('0x65')+_0x10388c;return db[_0x103d('0x57')][_0x103d('0x33')](_0x22a501,{'type':db[_0x103d('0x5f')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3fbec1});})[_0x103d('0x28')](function(_0x213681){var _0x529ecd=_['map'](_0x213681,function(_0x3ef56d){return Number(_0x3ef56d[_0x103d('0x66')]);});return db[_0x103d('0x67')][_0x103d('0x56')]({'where':{'UserId':{'$in':_0xb97f54},'OpenchannelQueueId':{'$in':_0x529ecd}},'transaction':_0x3fbec1});})['then'](function(){var _0x49f9f9=_0x103d('0x68')+_0x10388c;return db[_0x103d('0x57')][_0x103d('0x33')](_0x49f9f9,{'type':db['Sequelize'][_0x103d('0x5d')][_0x103d('0x5a')],'raw':!![],'transaction':_0x3fbec1});})['then'](function(_0x2bc729){var _0x24f5b0=_[_0x103d('0x2e')](_0x2bc729,function(_0x306881){return Number(_0x306881[_0x103d('0x69')]);});return db['UserWhatsappQueue'][_0x103d('0x56')]({'where':{'UserId':{'$in':_0xb97f54},'WhatsappQueueId':{'$in':_0x24f5b0}},'transaction':_0x3fbec1});})[_0x103d('0x28')](function(){return db['TeamVoicePrefix'][_0x103d('0x4b')]({'where':{'TeamId':_0x10388c}});})[_0x103d('0x28')](function(_0x21c855){if(_0x21c855===null){return;}return db[_0x103d('0x6a')][_0x103d('0x56')]({'where':{'UserId':{'$in':_0xb97f54},'VoicePrefixId':_0x21c855['VoicePrefixId']},'transaction':_0x3fbec1});})[_0x103d('0x28')](function(){return db['Team'][_0x103d('0x56')]({'where':{'id':_0x10388c},'cascade':!![],'transaction':_0x3fbec1});})['then'](function(_0x5d5103){if(_0x5d5103===0x0){_0x1b798a[_0x103d('0x1e')](0x194);}else{return db[_0x103d('0x53')][_0x103d('0x56')]({'where':{'type':_0x103d('0x51'),'resourceId':_0x10388c},'cascade':!![],'transaction':_0x3fbec1})[_0x103d('0x28')](function(){_0x1b798a[_0x103d('0x1f')](0xcc)[_0x103d('0x6b')]();});}})[_0x103d('0x48')](function(_0x24770a){_0x1b798a[_0x103d('0x1f')](0x1f4)[_0x103d('0x2c')](_0x24770a);});});};exports[_0x103d('0x6c')]=function(_0x1b7601,_0x2d2f9f,_0x35f583){return db[_0x103d('0x2f')][_0x103d('0x6d')]({'where':{'id':_0x1b7601[_0x103d('0x55')]['id']}})[_0x103d('0x28')](handleEntityNotFound(_0x2d2f9f,null))[_0x103d('0x28')](function(_0x27d2c4){if(!_0x1b7601['query'][_0x103d('0x6e')]||!utils[_0x103d('0x6f')](_0x1b7601[_0x103d('0x33')][_0x103d('0x6e')])){throw new db[(_0x103d('0x5f'))][(_0x103d('0x70'))]('Unknown\x20channel');}var _0x17ce6f={};var _0x3f4b2e={};_0x3f4b2e[_0x103d('0x36')]=_[_0x103d('0x32')](db[_[_0x103d('0x71')](_0x1b7601[_0x103d('0x33')][_0x103d('0x6e')][_0x103d('0x72')]())+_0x103d('0x73')]['rawAttributes']);_0x3f4b2e['query']=_[_0x103d('0x32')](_0x1b7601[_0x103d('0x33')]);_0x3f4b2e[_0x103d('0x34')]=_[_0x103d('0x35')](_0x3f4b2e[_0x103d('0x36')],_0x3f4b2e['query']);_0x17ce6f[_0x103d('0x38')]=_['intersection'](_0x3f4b2e[_0x103d('0x36')],qs[_0x103d('0x37')](_0x1b7601['query'][_0x103d('0x37')]));_0x17ce6f[_0x103d('0x38')]=_0x17ce6f['attributes'][_0x103d('0x39')]?_0x17ce6f[_0x103d('0x38')]:_0x3f4b2e['model'];_0x17ce6f[_0x103d('0x22')]=qs['limit'](_0x1b7601[_0x103d('0x33')][_0x103d('0x22')]);_0x17ce6f[_0x103d('0x21')]=qs[_0x103d('0x21')](_0x1b7601['query'][_0x103d('0x21')]);_0x17ce6f[_0x103d('0x3c')]=qs[_0x103d('0x3d')](_0x1b7601[_0x103d('0x33')][_0x103d('0x3d')]);_0x17ce6f[_0x103d('0x41')]=qs['filters'](_['pick'](_0x1b7601[_0x103d('0x33')],_0x3f4b2e['filters']));_0x17ce6f=_[_0x103d('0x40')]({},_0x17ce6f,_0x1b7601['options']);return _0x27d2c4[_0x103d('0x4f')+_[_0x103d('0x71')](_0x1b7601[_0x103d('0x33')][_0x103d('0x6e')]['toLowerCase']())+'Queues'](_0x17ce6f);})[_0x103d('0x28')](respondWithResult(_0x2d2f9f,null))['catch'](handleError(_0x2d2f9f,null));};exports[_0x103d('0x74')]=function(_0x4e278c,_0x2beb76,_0x2be7d8){return db[_0x103d('0x2f')][_0x103d('0x6d')]({'where':{'id':_0x4e278c[_0x103d('0x55')]['id']}})[_0x103d('0x28')](function(_0x398399){if(_0x398399){if(!_0x4e278c['body'][_0x103d('0x6e')]||!utils[_0x103d('0x6f')](_0x4e278c[_0x103d('0x4d')][_0x103d('0x6e')])){throw new db[(_0x103d('0x5f'))][(_0x103d('0x70'))]('Unknown\x20channel');}return _0x398399['add'+_[_0x103d('0x71')](_0x4e278c[_0x103d('0x4d')]['channel'][_0x103d('0x72')]())+'Queues'](_0x4e278c[_0x103d('0x4d')]['ids']);}return null;})[_0x103d('0x28')](handleEntityNotFound(_0x2beb76,null))[_0x103d('0x28')](respondWithStatusCode(_0x2beb76,null))[_0x103d('0x48')](handleError(_0x2beb76,null));};exports[_0x103d('0x75')]=function(_0x459961,_0x3d812f,_0x5d2eb3){return db[_0x103d('0x2f')][_0x103d('0x6d')]({'where':{'id':_0x459961['params']['id']}})[_0x103d('0x28')](function(_0x529dfa){if(_0x529dfa){if(!_0x459961[_0x103d('0x33')][_0x103d('0x6e')]||!utils[_0x103d('0x6f')](_0x459961[_0x103d('0x33')][_0x103d('0x6e')])){throw new db[(_0x103d('0x5f'))][(_0x103d('0x70'))](_0x103d('0x76'));}return _0x529dfa[_0x103d('0x77')+_[_0x103d('0x71')](_0x459961[_0x103d('0x33')][_0x103d('0x6e')]['toLowerCase']())+'Queues'](_0x459961[_0x103d('0x33')][_0x103d('0x78')]);}return null;})[_0x103d('0x28')](handleEntityNotFound(_0x3d812f,null))[_0x103d('0x28')](respondWithStatusCode(_0x3d812f,null))[_0x103d('0x48')](handleError(_0x3d812f,null));};exports[_0x103d('0x79')]=function(_0x4a17d7,_0x5112e3){var _0x34dc84=_[_0x103d('0x7a')](_0x4a17d7[_0x103d('0x4d')][_0x103d('0x78')])?_0x4a17d7['body'][_0x103d('0x78')]:[_0x4a17d7[_0x103d('0x4d')][_0x103d('0x78')]];var _0x7d67ac=_0x4a17d7[_0x103d('0x55')]['id'];return db['Team'][_0x103d('0x4b')]({'where':{'id':_0x7d67ac}})[_0x103d('0x28')](handleEntityNotFound(_0x5112e3,null))[_0x103d('0x28')](function(_0x4b5c19){if(_0x4b5c19){var _0x4e9878=['Voice',_0x103d('0x7b'),_0x103d('0x7c'),'Sms',_0x103d('0x7d'),_0x103d('0x7e'),_0x103d('0x7f')];return db['sequelize'][_0x103d('0x58')](function(_0x356520){var _0x3f439d=_[_0x103d('0x2e')](_0x4e9878,function(_0x47e444){var _0x29c30c={'attributes':['id','name']};if(_0x47e444===_0x103d('0x80')){_0x29c30c[_0x103d('0x81')]={'attributes':[_0x103d('0x82')]};}return _0x4b5c19[_0x103d('0x4f')+_0x47e444+_0x103d('0x83')](_0x29c30c)[_0x103d('0x28')](function(_0x827a75){var _0x2598a9=_[_0x103d('0x2e')](_0x827a75,function(_0x2f3c70){var _0x43b60e=_[_0x103d('0x2e')](_0x34dc84,function(_0x4e9f59){var _0x3747ea={'where':{'UserId':_0x4e9f59,[_0x47e444+_0x103d('0x84')]:_0x2f3c70['id']},'transaction':_0x356520};if(_0x47e444==='Voice'){_0x3747ea['defaults']={'penalty':_0x2f3c70[_0x103d('0x85')][_0x103d('0x82')]};}return db[_0x103d('0x86')+_0x47e444+_0x103d('0x73')][_0x103d('0x87')](_0x3747ea)[_0x103d('0x28')](function(){socket['emit']('user'+_0x47e444+_0x103d('0x88'),{'UserId':_0x4e9f59,[_0x47e444+_0x103d('0x84')]:_0x2f3c70['id']});if(_0x47e444!==_0x103d('0x80')){return;}return db[_0x103d('0x86')][_0x103d('0x89')]({'where':{'id':_0x34dc84,'online':0x1},'attributes':['id',_0x103d('0x2b'),'online',_0x103d('0x8a'),'interface'],'raw':!![]})[_0x103d('0x28')](function(_0x455543){var _0x5697f0=_[_0x103d('0x2e')](_0x455543,function(_0x597024){return db[_0x103d('0x8b')][_0x103d('0x8c')]({'membername':_0x597024[_0x103d('0x2b')],'UserId':_0x597024['id'],'queue_name':_0x2f3c70[_0x103d('0x2b')],'VoiceQueueId':_0x2f3c70['id'],'interface':_['isNil'](_0x597024[_0x103d('0x8d')])?util[_0x103d('0x8e')](_0x103d('0x8f'),_0x597024[_0x103d('0x2b')]):_0x597024[_0x103d('0x8d')],'paused':_0x597024[_0x103d('0x8a')]||![],'penalty':_0x2f3c70[_0x103d('0x85')][_0x103d('0x82')]},{'transaction':_0x356520});});return Promise[_0x103d('0x90')](_0x5697f0);});});});return Promise[_0x103d('0x90')](_0x43b60e);});return Promise[_0x103d('0x90')](_0x2598a9);})[_0x103d('0x28')](function(){return db[_0x103d('0x91')][_0x103d('0x6d')]({'where':{'teamId':_0x7d67ac}})['then'](function(_0x207bcb){if(_0x207bcb){var _0x42ab34=_['map'](_0x34dc84,function(_0x535b7d){db[_0x103d('0x6a')]['upsert']({'UserId':_0x535b7d,'VoicePrefixId':_0x207bcb[_0x103d('0x92')]});});return Promise['all'](_0x42ab34);}});});});return Promise[_0x103d('0x90')](_0x3f439d)[_0x103d('0x28')](function(){return _0x4b5c19[_0x103d('0x79')](_0x34dc84,{'transaction':_0x356520})['spread'](function(_0x533c5e){return _0x533c5e;});});});}})[_0x103d('0x28')](respondWithResult(_0x5112e3,null))[_0x103d('0x48')](handleError(_0x5112e3,null));};exports[_0x103d('0x93')]=function(_0x597038,_0x2cfa7e){var _0x360e21=_['isArray'](_0x597038[_0x103d('0x33')][_0x103d('0x78')])?_0x597038[_0x103d('0x33')][_0x103d('0x78')]:[_0x597038[_0x103d('0x33')][_0x103d('0x78')]];var _0x20c936=_0x597038[_0x103d('0x55')]['id'];return db[_0x103d('0x2f')][_0x103d('0x4b')]({'where':{'id':_0x20c936}})[_0x103d('0x28')](handleEntityNotFound(_0x2cfa7e,null))['then'](function(_0x3aeb75){if(_0x3aeb75){var _0xa20a1d=[_0x103d('0x80'),_0x103d('0x7b'),_0x103d('0x7c'),_0x103d('0x94'),_0x103d('0x7d'),'Openchannel',_0x103d('0x7f')];return db[_0x103d('0x57')][_0x103d('0x58')](function(_0x2b6cf0){var _0x52392f=_[_0x103d('0x2e')](_0xa20a1d,function(_0x552173){var _0x326ea2={'attributes':['id',_0x103d('0x2b')]};return _0x3aeb75[_0x103d('0x4f')+_0x552173+'Queues'](_0x326ea2)[_0x103d('0x28')](function(_0x179e09){var _0x55ce9d=_['map'](_0x179e09,function(_0x568d4b){return _0x568d4b[_0x103d('0x93')](_0x360e21,{'transaction':_0x2b6cf0})[_0x103d('0x28')](function(){var _0x5ee13d=_[_0x103d('0x2e')](_0x360e21,function(_0x21c08e){socket[_0x103d('0x95')]('user'+_0x552173+_0x103d('0x96'),{'UserId':Number(_0x21c08e),[_0x552173+_0x103d('0x84')]:_0x568d4b['id']});if(_0x552173!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x103d('0x56')]({'where':{'VoiceQueueId':_0x568d4b['id'],'UserId':_0x21c08e},'transaction':_0x2b6cf0});});return Promise[_0x103d('0x90')](_0x5ee13d);});});return Promise[_0x103d('0x90')](_0x55ce9d);});});return Promise['all'](_0x52392f)[_0x103d('0x28')](function(){return _0x3aeb75['removeAgents'](_0x360e21,{'transaction':_0x2b6cf0});})[_0x103d('0x28')](function(){return db[_0x103d('0x91')][_0x103d('0x6d')]({'where':{'teamId':_0x20c936}})['then'](function(_0x82ddf9){if(_0x82ddf9){var _0x4ea852=_['map'](_0x360e21,function(_0x4ed61b){db[_0x103d('0x6a')]['destroy']({'where':{'UserId':_0x4ed61b,'VoicePrefixId':_0x82ddf9['VoicePrefixId']}});});return Promise[_0x103d('0x90')](_0x4ea852);}});});});}})[_0x103d('0x28')](respondWithStatusCode(_0x2cfa7e,null))['catch'](handleError(_0x2cfa7e,null));};exports['getAgents']=function(_0x3b78df,_0x2f1cc4,_0x4e0b9e){var _0x4bceeb={};var _0x44df89={};var _0x284780;var _0x1498fd;return db['Team'][_0x103d('0x6d')]({'where':{'id':_0x3b78df[_0x103d('0x55')]['id']}})[_0x103d('0x28')](handleEntityNotFound(_0x2f1cc4,null))[_0x103d('0x28')](function(_0x3cf583){if(_0x3cf583){_0x284780=_0x3cf583;_0x44df89[_0x103d('0x36')]=_[_0x103d('0x32')](db[_0x103d('0x86')]['rawAttributes']);_0x44df89[_0x103d('0x33')]=_[_0x103d('0x32')](_0x3b78df[_0x103d('0x33')]);_0x44df89['filters']=_[_0x103d('0x35')](_0x44df89[_0x103d('0x36')],_0x44df89[_0x103d('0x33')]);_0x4bceeb[_0x103d('0x38')]=_[_0x103d('0x35')](_0x44df89['model'],qs[_0x103d('0x37')](_0x3b78df['query'][_0x103d('0x37')]));_0x4bceeb[_0x103d('0x38')]=_0x4bceeb['attributes'][_0x103d('0x39')]?_0x4bceeb[_0x103d('0x38')]:_0x44df89[_0x103d('0x36')];_0x4bceeb['order']=qs[_0x103d('0x3d')](_0x3b78df[_0x103d('0x33')][_0x103d('0x3d')]);_0x4bceeb[_0x103d('0x41')]=qs['filters'](_[_0x103d('0x3e')](_0x3b78df[_0x103d('0x33')],_0x44df89[_0x103d('0x34')]));if(_0x3b78df[_0x103d('0x33')][_0x103d('0x3f')]){_0x4bceeb['where']=_[_0x103d('0x40')](_0x4bceeb[_0x103d('0x41')],{'$or':_['map'](_0x4bceeb[_0x103d('0x38')],function(_0x2fde7a){var _0x6131be={};_0x6131be[_0x2fde7a]={'$like':'%'+_0x3b78df[_0x103d('0x33')][_0x103d('0x3f')]+'%'};return _0x6131be;})});}_0x4bceeb=_[_0x103d('0x40')]({},_0x4bceeb,_0x3b78df[_0x103d('0x44')]);return _0x284780[_0x103d('0x97')](_0x4bceeb);}})[_0x103d('0x28')](function(_0x23dfe9){if(_0x23dfe9){_0x1498fd=_0x23dfe9[_0x103d('0x39')];if(!_0x3b78df[_0x103d('0x33')][_0x103d('0x3a')](_0x103d('0x3b'))){_0x4bceeb[_0x103d('0x22')]=qs[_0x103d('0x22')](_0x3b78df[_0x103d('0x33')][_0x103d('0x22')]);_0x4bceeb[_0x103d('0x21')]=qs[_0x103d('0x21')](_0x3b78df[_0x103d('0x33')][_0x103d('0x21')]);}return _0x284780[_0x103d('0x97')](_0x4bceeb);}})[_0x103d('0x28')](function(_0x114c29){if(_0x114c29){return _0x114c29?{'count':_0x1498fd,'rows':_0x114c29}:null;}})[_0x103d('0x28')](respondWithResult(_0x2f1cc4,null))['catch'](handleError(_0x2f1cc4,null));}; \ No newline at end of file +var _0x388c=['save','update','then','error','stack','name','send','index','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','filter','where','merge','options','Team','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','OpenchannelQueueId','UserVoicePrefix','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','length','sort','pick','Queues','isValidChannel','add','ids','remove','addAgents','isArray','Voice','Mail','Sms','Fax','Whatsapp','through','QueueId','TeamVoiceQueue','User','Queue','emit','Queue:save','findAll','online','interface','UserVoiceQueueRt','format','SIP/%s','penalty','all','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','Chat','Openchannel','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject'];(function(_0x55a04b,_0x760be4){var _0x41e61e=function(_0x26e231){while(--_0x26e231){_0x55a04b['push'](_0x55a04b['shift']());}};_0x41e61e(++_0x760be4);}(_0x388c,0x19c));var _0xc388=function(_0x49cbfe,_0x1e6a12){_0x49cbfe=_0x49cbfe-0x0;var _0xa22a0c=_0x388c[_0x49cbfe];return _0xa22a0c;};'use strict';var emlformat=require(_0xc388('0x0'));var rimraf=require(_0xc388('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc388('0x2'));var rp=require('request-promise');var moment=require(_0xc388('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc388('0x4'));var util=require(_0xc388('0x5'));var path=require(_0xc388('0x6'));var sox=require(_0xc388('0x7'));var csv=require(_0xc388('0x8'));var ejs=require(_0xc388('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc388('0xa'));var squel=require(_0xc388('0xb'));var crypto=require(_0xc388('0xc'));var jsforce=require(_0xc388('0xd'));var deskjs=require(_0xc388('0xe'));var toCsv=require(_0xc388('0x8'));var querystring=require(_0xc388('0xf'));var Papa=require(_0xc388('0x10'));var Redis=require(_0xc388('0x11'));var authService=require(_0xc388('0x12'));var qs=require(_0xc388('0x13'));var as=require(_0xc388('0x14'));var hardwareService=require(_0xc388('0x15'));var logger=require(_0xc388('0x16'))(_0xc388('0x17'));var utils=require(_0xc388('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc388('0x19'));var db=require('../../mysqldb')['db'];config[_0xc388('0x1a')]=_[_0xc388('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc388('0x1c'))(new Redis(config[_0xc388('0x1a')]));require(_0xc388('0x1d'))[_0xc388('0x1e')](socket);function respondWithStatusCode(_0x4650ee,_0x10f512){_0x10f512=_0x10f512||0xcc;return function(_0x29cd9a){if(_0x29cd9a){return _0x4650ee[_0xc388('0x1f')](_0x10f512);}return _0x4650ee[_0xc388('0x20')](_0x10f512)[_0xc388('0x21')]();};}function respondWithResult(_0x234aa9,_0x10731f){_0x10731f=_0x10731f||0xc8;return function(_0x272085){if(_0x272085){return _0x234aa9[_0xc388('0x20')](_0x10731f)[_0xc388('0x22')](_0x272085);}};}function respondWithFilteredResult(_0x28086e,_0x5a9f08){return function(_0x17ec43){if(_0x17ec43){var _0x3fff61=typeof _0x5a9f08['offset']===_0xc388('0x23')&&typeof _0x5a9f08[_0xc388('0x24')]===_0xc388('0x23');var _0x5d69ff=_0x17ec43[_0xc388('0x25')];var _0x505b48=_0x3fff61?0x0:_0x5a9f08[_0xc388('0x26')];var _0x58e8f5=_0x3fff61?_0x17ec43[_0xc388('0x25')]:_0x5a9f08[_0xc388('0x26')]+_0x5a9f08[_0xc388('0x24')];var _0xd23924;if(_0x58e8f5>=_0x5d69ff){_0x58e8f5=_0x5d69ff;_0xd23924=0xc8;}else{_0xd23924=0xce;}_0x28086e[_0xc388('0x20')](_0xd23924);return _0x28086e['set']('Content-Range',_0x505b48+'-'+_0x58e8f5+'/'+_0x5d69ff)[_0xc388('0x22')](_0x17ec43);}return null;};}function patchUpdates(_0x41789a){return function(_0x389862){try{jsonpatch[_0xc388('0x27')](_0x389862,_0x41789a,!![]);}catch(_0x2f1b29){return BPromise[_0xc388('0x28')](_0x2f1b29);}return _0x389862[_0xc388('0x29')]();};}function saveUpdates(_0x41047e,_0x1e9710){return function(_0x5e3340){if(_0x5e3340){return _0x5e3340[_0xc388('0x2a')](_0x41047e)[_0xc388('0x2b')](function(_0x163d42){return _0x163d42;});}return null;};}function handleEntityNotFound(_0x21e4af,_0x12ddd5){return function(_0x281ecf){if(!_0x281ecf){_0x21e4af['sendStatus'](0x194);}return _0x281ecf;};}function handleError(_0xcfc10,_0x31b3b6){_0x31b3b6=_0x31b3b6||0x1f4;return function(_0xc73865){logger[_0xc388('0x2c')](_0xc73865[_0xc388('0x2d')]);if(_0xc73865[_0xc388('0x2e')]){delete _0xc73865[_0xc388('0x2e')];}_0xcfc10[_0xc388('0x20')](_0x31b3b6)[_0xc388('0x2f')](_0xc73865);};}exports[_0xc388('0x30')]=function(_0x192c87,_0x27c52d){var _0x453dff={},_0x2d62aa={},_0x37103e={'count':0x0,'rows':[]};var _0x462065=_['map'](db['Team']['rawAttributes'],function(_0x2b260b){return{'name':_0x2b260b['fieldName'],'type':_0x2b260b['type'][_0xc388('0x31')]};});_0x2d62aa[_0xc388('0x32')]=_[_0xc388('0x33')](_0x462065,_0xc388('0x2e'));_0x2d62aa[_0xc388('0x34')]=_[_0xc388('0x35')](_0x192c87[_0xc388('0x34')]);_0x2d62aa[_0xc388('0x36')]=_['intersection'](_0x2d62aa[_0xc388('0x32')],_0x2d62aa[_0xc388('0x34')]);_0x453dff[_0xc388('0x37')]=_[_0xc388('0x38')](_0x2d62aa['model'],qs[_0xc388('0x39')](_0x192c87[_0xc388('0x34')][_0xc388('0x39')]));_0x453dff[_0xc388('0x37')]=_0x453dff[_0xc388('0x37')]['length']?_0x453dff[_0xc388('0x37')]:_0x2d62aa[_0xc388('0x32')];if(!_0x192c87[_0xc388('0x34')][_0xc388('0x3a')](_0xc388('0x3b'))){_0x453dff[_0xc388('0x24')]=qs[_0xc388('0x24')](_0x192c87[_0xc388('0x34')][_0xc388('0x24')]);_0x453dff[_0xc388('0x26')]=qs['offset'](_0x192c87[_0xc388('0x34')][_0xc388('0x26')]);}_0x453dff[_0xc388('0x3c')]=qs['sort'](_0x192c87[_0xc388('0x34')]['sort']);_0x453dff['where']=qs[_0xc388('0x36')](_['pick'](_0x192c87[_0xc388('0x34')],_0x2d62aa[_0xc388('0x36')]),_0x462065);if(_0x192c87[_0xc388('0x34')][_0xc388('0x3d')]){_0x453dff[_0xc388('0x3e')]=_[_0xc388('0x3f')](_0x453dff[_0xc388('0x3e')],{'$or':_[_0xc388('0x33')](_0x462065,function(_0x5232e7){if(_0x5232e7['type']!=='VIRTUAL'){var _0xad94aa={};_0xad94aa[_0x5232e7[_0xc388('0x2e')]]={'$like':'%'+_0x192c87['query'][_0xc388('0x3d')]+'%'};return _0xad94aa;}})});}_0x453dff=_[_0xc388('0x3f')]({},_0x453dff,_0x192c87[_0xc388('0x40')]);var _0x1488fa={'where':_0x453dff[_0xc388('0x3e')]};return db[_0xc388('0x41')][_0xc388('0x25')](_0x1488fa)[_0xc388('0x2b')](function(_0x1ba709){_0x37103e[_0xc388('0x25')]=_0x1ba709;if(_0x192c87[_0xc388('0x34')][_0xc388('0x42')]){_0x453dff[_0xc388('0x43')]=[{'all':!![]}];}return db[_0xc388('0x41')]['findAll'](_0x453dff);})['then'](function(_0x27948b){_0x37103e[_0xc388('0x44')]=_0x27948b;return _0x37103e;})[_0xc388('0x2b')](respondWithFilteredResult(_0x27c52d,_0x453dff))[_0xc388('0x45')](handleError(_0x27c52d,null));};exports[_0xc388('0x46')]=function(_0x5c5429,_0x43339f){var _0x447c93={'raw':![],'where':{'id':_0x5c5429[_0xc388('0x47')]['id']}},_0x55d8e1={};_0x55d8e1[_0xc388('0x32')]=_[_0xc388('0x35')](db[_0xc388('0x41')][_0xc388('0x48')]);_0x55d8e1[_0xc388('0x34')]=_[_0xc388('0x35')](_0x5c5429[_0xc388('0x34')]);_0x55d8e1[_0xc388('0x36')]=_[_0xc388('0x38')](_0x55d8e1[_0xc388('0x32')],_0x55d8e1[_0xc388('0x34')]);_0x447c93[_0xc388('0x37')]=_[_0xc388('0x38')](_0x55d8e1[_0xc388('0x32')],qs['fields'](_0x5c5429[_0xc388('0x34')]['fields']));_0x447c93[_0xc388('0x37')]=_0x447c93[_0xc388('0x37')]['length']?_0x447c93[_0xc388('0x37')]:_0x55d8e1[_0xc388('0x32')];if(_0x5c5429[_0xc388('0x34')][_0xc388('0x42')]){_0x447c93[_0xc388('0x43')]=[{'all':!![]}];}_0x447c93=_[_0xc388('0x3f')]({},_0x447c93,_0x5c5429[_0xc388('0x40')]);return db[_0xc388('0x41')][_0xc388('0x49')](_0x447c93)[_0xc388('0x2b')](handleEntityNotFound(_0x43339f,null))[_0xc388('0x2b')](respondWithResult(_0x43339f,null))['catch'](handleError(_0x43339f,null));};exports[_0xc388('0x4a')]=function(_0x2959b0,_0x2fb526){return db['Team'][_0xc388('0x4a')](_0x2959b0[_0xc388('0x4b')],{})['then'](function(_0xc4263e){var _0x3f8c86=_0x2959b0[_0xc388('0x4c')]['get']({'plain':!![]});if(!_0x3f8c86)throw new Error(_0xc388('0x4d'));if(_0x3f8c86[_0xc388('0x4e')]==='user'){var _0x255aaf=_0xc4263e[_0xc388('0x4f')]({'plain':!![]});var _0x42a7f7=_0xc388('0x50');return db[_0xc388('0x51')]['find']({'where':{'name':_0x42a7f7,'userProfileId':_0x3f8c86[_0xc388('0x52')]},'raw':!![]})[_0xc388('0x2b')](function(_0x335369){if(_0x335369&&_0x335369[_0xc388('0x53')]===0x0){return db[_0xc388('0x54')][_0xc388('0x4a')]({'name':_0x255aaf[_0xc388('0x2e')],'resourceId':_0x255aaf['id'],'type':_0x335369[_0xc388('0x2e')],'sectionId':_0x335369['id']},{})[_0xc388('0x2b')](function(){return _0xc4263e;});}else{return _0xc4263e;}})[_0xc388('0x45')](function(_0x47287e){logger['error'](_0xc388('0x55'),_0x47287e);throw _0x47287e;});}return _0xc4263e;})[_0xc388('0x2b')](respondWithResult(_0x2fb526,0xc9))[_0xc388('0x45')](handleError(_0x2fb526,null));};exports[_0xc388('0x2a')]=function(_0x5164fa,_0x33e139){if(_0x5164fa['body']['id']){delete _0x5164fa[_0xc388('0x4b')]['id'];}return db[_0xc388('0x41')]['find']({'where':{'id':_0x5164fa[_0xc388('0x47')]['id']}})['then'](handleEntityNotFound(_0x33e139,null))[_0xc388('0x2b')](saveUpdates(_0x5164fa[_0xc388('0x4b')],null))[_0xc388('0x2b')](respondWithResult(_0x33e139,null))[_0xc388('0x45')](handleError(_0x33e139,null));};exports[_0xc388('0x56')]=function(_0x5cf307,_0x252643){var _0x40fc21=_0x5cf307[_0xc388('0x47')]['id'];var _0x88277f=[];return db[_0xc388('0x57')][_0xc388('0x58')](function(_0xa78439){var _0x4c1a19='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db[_0xc388('0x57')]['query'](_0x4c1a19,{'type':db['Sequelize'][_0xc388('0x59')]['SELECT'],'raw':!![],'transaction':_0xa78439})[_0xc388('0x2b')](function(_0x4def7a){_0x88277f=_['map'](_0x4def7a,function(_0x4cc9fd){return Number(_0x4cc9fd[_0xc388('0x5a')]);});})['then'](function(){var _0x1015fe=_0xc388('0x5b')+_0x40fc21;return db['sequelize'][_0xc388('0x34')](_0x1015fe,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x4e694a){var _0x2e869a=_[_0xc388('0x33')](_0x4e694a,function(_0x57182f){return Number(_0x57182f['VoiceQueueId']);});return db[_0xc388('0x5e')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'VoiceQueueId':{'$in':_0x2e869a}},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){var _0x54dab8=_0xc388('0x5f')+_0x40fc21;return db[_0xc388('0x57')][_0xc388('0x34')](_0x54dab8,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})['then'](function(_0xdb07e4){var _0x56e8a3=_[_0xc388('0x33')](_0xdb07e4,function(_0x258db6){return Number(_0x258db6[_0xc388('0x60')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x88277f},'MailQueueId':{'$in':_0x56e8a3}},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){var _0x1c30cb=_0xc388('0x61')+_0x40fc21;return db['sequelize'][_0xc388('0x34')](_0x1c30cb,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x6fe460){var _0x12748d=_[_0xc388('0x33')](_0x6fe460,function(_0x7536f8){return Number(_0x7536f8[_0xc388('0x62')]);});return db[_0xc388('0x63')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'SmsQueueId':{'$in':_0x12748d}},'transaction':_0xa78439});})['then'](function(){var _0x2550bc=_0xc388('0x64')+_0x40fc21;return db['sequelize']['query'](_0x2550bc,{'type':db[_0xc388('0x5c')][_0xc388('0x59')][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x40d6b0){var _0xe2a2df=_['map'](_0x40d6b0,function(_0x17f0eb){return Number(_0x17f0eb[_0xc388('0x65')]);});return db[_0xc388('0x66')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'ChatQueueId':{'$in':_0xe2a2df}},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){var _0x333bc5='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db['sequelize'][_0xc388('0x34')](_0x333bc5,{'type':db['Sequelize']['QueryTypes'][_0xc388('0x5d')],'raw':!![],'transaction':_0xa78439});})['then'](function(_0x4cb88e){var _0x4cd2e8=_[_0xc388('0x33')](_0x4cb88e,function(_0x1caa39){return Number(_0x1caa39[_0xc388('0x67')]);});return db['UserFaxQueue'][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'FaxQueueId':{'$in':_0x4cd2e8}},'transaction':_0xa78439});})['then'](function(){var _0x39403b='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db[_0xc388('0x57')][_0xc388('0x34')](_0x39403b,{'type':db[_0xc388('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0x3648fd){var _0x1f900f=_[_0xc388('0x33')](_0x3648fd,function(_0x202959){return Number(_0x202959[_0xc388('0x68')]);});return db['UserOpenchannelQueue'][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'OpenchannelQueueId':{'$in':_0x1f900f}},'transaction':_0xa78439});})['then'](function(){var _0x113129='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x40fc21;return db[_0xc388('0x57')][_0xc388('0x34')](_0x113129,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0xc22c1a){var _0x2af90d=_[_0xc388('0x33')](_0xc22c1a,function(_0x35a6c3){return Number(_0x35a6c3['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'WhatsappQueueId':{'$in':_0x2af90d}},'transaction':_0xa78439});})['then'](function(){return db['TeamVoicePrefix'][_0xc388('0x49')]({'where':{'TeamId':_0x40fc21}});})[_0xc388('0x2b')](function(_0x437582){if(_0x437582===null){return;}return db[_0xc388('0x69')][_0xc388('0x56')]({'where':{'UserId':{'$in':_0x88277f},'VoicePrefixId':_0x437582['VoicePrefixId']},'transaction':_0xa78439});})[_0xc388('0x2b')](function(){return db[_0xc388('0x41')]['destroy']({'where':{'id':_0x40fc21},'cascade':!![],'transaction':_0xa78439});})[_0xc388('0x2b')](function(_0xa6efb7){if(_0xa6efb7===0x0){_0x252643[_0xc388('0x1f')](0x194);}else{return db[_0xc388('0x54')]['destroy']({'where':{'type':'Teams','resourceId':_0x40fc21},'cascade':!![],'transaction':_0xa78439})['then'](function(){_0x252643['status'](0xcc)[_0xc388('0x21')]();});}})[_0xc388('0x45')](function(_0x4bcf3e){_0x252643[_0xc388('0x20')](0x1f4)['send'](_0x4bcf3e);});});};exports[_0xc388('0x6a')]=function(_0x49d615,_0x410a51,_0x3c2382){return db[_0xc388('0x41')][_0xc388('0x6b')]({'where':{'id':_0x49d615[_0xc388('0x47')]['id']}})[_0xc388('0x2b')](handleEntityNotFound(_0x410a51,null))[_0xc388('0x2b')](function(_0x427644){if(!_0x49d615[_0xc388('0x34')][_0xc388('0x6c')]||!utils['isValidChannel'](_0x49d615['query'][_0xc388('0x6c')])){throw new db[(_0xc388('0x5c'))][(_0xc388('0x6d'))](_0xc388('0x6e'));}var _0xf831df={};var _0x59f72f={};_0x59f72f['model']=_[_0xc388('0x35')](db[_[_0xc388('0x6f')](_0x49d615[_0xc388('0x34')][_0xc388('0x6c')][_0xc388('0x70')]())+'Queue'][_0xc388('0x48')]);_0x59f72f[_0xc388('0x34')]=_[_0xc388('0x35')](_0x49d615['query']);_0x59f72f['filters']=_['intersection'](_0x59f72f[_0xc388('0x32')],_0x59f72f[_0xc388('0x34')]);_0xf831df[_0xc388('0x37')]=_[_0xc388('0x38')](_0x59f72f[_0xc388('0x32')],qs[_0xc388('0x39')](_0x49d615[_0xc388('0x34')][_0xc388('0x39')]));_0xf831df[_0xc388('0x37')]=_0xf831df[_0xc388('0x37')][_0xc388('0x71')]?_0xf831df[_0xc388('0x37')]:_0x59f72f[_0xc388('0x32')];_0xf831df['limit']=qs[_0xc388('0x24')](_0x49d615[_0xc388('0x34')][_0xc388('0x24')]);_0xf831df[_0xc388('0x26')]=qs[_0xc388('0x26')](_0x49d615['query'][_0xc388('0x26')]);_0xf831df[_0xc388('0x3c')]=qs[_0xc388('0x72')](_0x49d615[_0xc388('0x34')]['sort']);_0xf831df[_0xc388('0x3e')]=qs[_0xc388('0x36')](_[_0xc388('0x73')](_0x49d615[_0xc388('0x34')],_0x59f72f[_0xc388('0x36')]));_0xf831df=_[_0xc388('0x3f')]({},_0xf831df,_0x49d615[_0xc388('0x40')]);return _0x427644[_0xc388('0x4f')+_[_0xc388('0x6f')](_0x49d615['query'][_0xc388('0x6c')]['toLowerCase']())+_0xc388('0x74')](_0xf831df);})[_0xc388('0x2b')](respondWithResult(_0x410a51,null))[_0xc388('0x45')](handleError(_0x410a51,null));};exports['addQueues']=function(_0x28d9b5,_0x45152f,_0x5de7e4){return db[_0xc388('0x41')]['findOne']({'where':{'id':_0x28d9b5[_0xc388('0x47')]['id']}})['then'](function(_0x5071e6){if(_0x5071e6){if(!_0x28d9b5[_0xc388('0x4b')][_0xc388('0x6c')]||!utils[_0xc388('0x75')](_0x28d9b5[_0xc388('0x4b')][_0xc388('0x6c')])){throw new db[(_0xc388('0x5c'))]['ValidationError']('Unknown\x20channel');}return _0x5071e6[_0xc388('0x76')+_[_0xc388('0x6f')](_0x28d9b5[_0xc388('0x4b')]['channel'][_0xc388('0x70')]())+_0xc388('0x74')](_0x28d9b5[_0xc388('0x4b')][_0xc388('0x77')]);}return null;})[_0xc388('0x2b')](handleEntityNotFound(_0x45152f,null))[_0xc388('0x2b')](respondWithStatusCode(_0x45152f,null))['catch'](handleError(_0x45152f,null));};exports['removeQueues']=function(_0x4a31c2,_0x52058e,_0x429216){return db[_0xc388('0x41')][_0xc388('0x6b')]({'where':{'id':_0x4a31c2['params']['id']}})[_0xc388('0x2b')](function(_0x3f8411){if(_0x3f8411){if(!_0x4a31c2['query']['channel']||!utils[_0xc388('0x75')](_0x4a31c2[_0xc388('0x34')][_0xc388('0x6c')])){throw new db[(_0xc388('0x5c'))][(_0xc388('0x6d'))](_0xc388('0x6e'));}return _0x3f8411[_0xc388('0x78')+_[_0xc388('0x6f')](_0x4a31c2['query'][_0xc388('0x6c')]['toLowerCase']())+_0xc388('0x74')](_0x4a31c2[_0xc388('0x34')][_0xc388('0x77')]);}return null;})[_0xc388('0x2b')](handleEntityNotFound(_0x52058e,null))[_0xc388('0x2b')](respondWithStatusCode(_0x52058e,null))['catch'](handleError(_0x52058e,null));};exports[_0xc388('0x79')]=function(_0x3e4c84,_0x24200b){var _0xb4567=_[_0xc388('0x7a')](_0x3e4c84[_0xc388('0x4b')]['ids'])?_0x3e4c84['body'][_0xc388('0x77')]:[_0x3e4c84[_0xc388('0x4b')][_0xc388('0x77')]];var _0x2786e5=_0x3e4c84['params']['id'];return db[_0xc388('0x41')]['find']({'where':{'id':_0x2786e5}})[_0xc388('0x2b')](handleEntityNotFound(_0x24200b,null))[_0xc388('0x2b')](function(_0x287459){if(_0x287459){var _0x4898ab=[_0xc388('0x7b'),'Chat',_0xc388('0x7c'),_0xc388('0x7d'),_0xc388('0x7e'),'Openchannel',_0xc388('0x7f')];return db[_0xc388('0x57')][_0xc388('0x58')](function(_0x1da8fb){var _0x535415=_[_0xc388('0x33')](_0x4898ab,function(_0x48b1c0){var _0x4b88af={'attributes':['id',_0xc388('0x2e')]};if(_0x48b1c0===_0xc388('0x7b')){_0x4b88af[_0xc388('0x80')]={'attributes':['penalty']};}return _0x287459[_0xc388('0x4f')+_0x48b1c0+_0xc388('0x74')](_0x4b88af)['then'](function(_0x457775){var _0x2e1847=_[_0xc388('0x33')](_0x457775,function(_0x242e23){var _0x3ad6a2=_['map'](_0xb4567,function(_0x599194){var _0x203118={'where':{'UserId':_0x599194,[_0x48b1c0+_0xc388('0x81')]:_0x242e23['id']},'transaction':_0x1da8fb};if(_0x48b1c0==='Voice'){_0x203118[_0xc388('0x1b')]={'penalty':_0x242e23[_0xc388('0x82')]['penalty']};}return db[_0xc388('0x83')+_0x48b1c0+_0xc388('0x84')]['findOrCreate'](_0x203118)[_0xc388('0x2b')](function(){socket[_0xc388('0x85')]('user'+_0x48b1c0+_0xc388('0x86'),{'UserId':_0x599194,[_0x48b1c0+_0xc388('0x81')]:_0x242e23['id']});if(_0x48b1c0!==_0xc388('0x7b')){return;}return db[_0xc388('0x83')][_0xc388('0x87')]({'where':{'id':_0xb4567,'online':0x1},'attributes':['id',_0xc388('0x2e'),_0xc388('0x88'),'voicePause',_0xc388('0x89')],'raw':!![]})[_0xc388('0x2b')](function(_0x23575c){var _0x11c88d=_[_0xc388('0x33')](_0x23575c,function(_0x201e48){return db[_0xc388('0x8a')]['upsert']({'membername':_0x201e48['name'],'UserId':_0x201e48['id'],'queue_name':_0x242e23[_0xc388('0x2e')],'VoiceQueueId':_0x242e23['id'],'interface':_['isNil'](_0x201e48['interface'])?util[_0xc388('0x8b')](_0xc388('0x8c'),_0x201e48[_0xc388('0x2e')]):_0x201e48[_0xc388('0x89')],'paused':_0x201e48['voicePause']||![],'penalty':_0x242e23[_0xc388('0x82')][_0xc388('0x8d')]},{'transaction':_0x1da8fb});});return Promise[_0xc388('0x8e')](_0x11c88d);});});});return Promise[_0xc388('0x8e')](_0x3ad6a2);});return Promise['all'](_0x2e1847);})[_0xc388('0x2b')](function(){return db[_0xc388('0x8f')]['findOne']({'where':{'teamId':_0x2786e5}})['then'](function(_0x23e94f){if(_0x23e94f){var _0xffe934=_[_0xc388('0x33')](_0xb4567,function(_0x41dc26){db[_0xc388('0x69')]['upsert']({'UserId':_0x41dc26,'VoicePrefixId':_0x23e94f[_0xc388('0x90')]});});return Promise['all'](_0xffe934);}});});});return Promise[_0xc388('0x8e')](_0x535415)[_0xc388('0x2b')](function(){return _0x287459[_0xc388('0x79')](_0xb4567,{'transaction':_0x1da8fb})[_0xc388('0x91')](function(_0x137fbc){return _0x137fbc;});});});}})[_0xc388('0x2b')](respondWithResult(_0x24200b,null))['catch'](handleError(_0x24200b,null));};exports[_0xc388('0x92')]=function(_0x8b9177,_0x694be){var _0x3ecdb0=_[_0xc388('0x7a')](_0x8b9177[_0xc388('0x34')]['ids'])?_0x8b9177[_0xc388('0x34')][_0xc388('0x77')]:[_0x8b9177[_0xc388('0x34')]['ids']];var _0xcb73e7=_0x8b9177[_0xc388('0x47')]['id'];return db[_0xc388('0x41')]['find']({'where':{'id':_0xcb73e7}})[_0xc388('0x2b')](handleEntityNotFound(_0x694be,null))[_0xc388('0x2b')](function(_0x37f202){if(_0x37f202){var _0x1c4b8d=['Voice',_0xc388('0x93'),_0xc388('0x7c'),_0xc388('0x7d'),_0xc388('0x7e'),_0xc388('0x94'),_0xc388('0x7f')];return db[_0xc388('0x57')][_0xc388('0x58')](function(_0x2ec322){var _0x4d09fe=_['map'](_0x1c4b8d,function(_0x2f85eb){var _0x240801={'attributes':['id',_0xc388('0x2e')]};return _0x37f202[_0xc388('0x4f')+_0x2f85eb+_0xc388('0x74')](_0x240801)['then'](function(_0x42b176){var _0x305304=_[_0xc388('0x33')](_0x42b176,function(_0xcb6190){return _0xcb6190[_0xc388('0x92')](_0x3ecdb0,{'transaction':_0x2ec322})['then'](function(){var _0x186f25=_[_0xc388('0x33')](_0x3ecdb0,function(_0x2c0e41){socket['emit'](_0xc388('0x4c')+_0x2f85eb+_0xc388('0x95'),{'UserId':Number(_0x2c0e41),[_0x2f85eb+_0xc388('0x81')]:_0xcb6190['id']});if(_0x2f85eb!==_0xc388('0x7b')){return;}return db[_0xc388('0x8a')]['destroy']({'where':{'VoiceQueueId':_0xcb6190['id'],'UserId':_0x2c0e41},'transaction':_0x2ec322});});return Promise['all'](_0x186f25);});});return Promise[_0xc388('0x8e')](_0x305304);});});return Promise[_0xc388('0x8e')](_0x4d09fe)['then'](function(){return _0x37f202[_0xc388('0x92')](_0x3ecdb0,{'transaction':_0x2ec322});})[_0xc388('0x2b')](function(){return db[_0xc388('0x8f')][_0xc388('0x6b')]({'where':{'teamId':_0xcb73e7}})[_0xc388('0x2b')](function(_0x13b2a4){if(_0x13b2a4){var _0x53831f=_[_0xc388('0x33')](_0x3ecdb0,function(_0x27dfc7){db['UserVoicePrefix'][_0xc388('0x56')]({'where':{'UserId':_0x27dfc7,'VoicePrefixId':_0x13b2a4[_0xc388('0x90')]}});});return Promise['all'](_0x53831f);}});});});}})[_0xc388('0x2b')](respondWithStatusCode(_0x694be,null))['catch'](handleError(_0x694be,null));};exports[_0xc388('0x96')]=function(_0x5bce0d,_0x4a624a,_0x3b48e0){var _0x8307a5={};var _0x1070fb={};var _0x346537;var _0x35512b;return db['Team'][_0xc388('0x6b')]({'where':{'id':_0x5bce0d[_0xc388('0x47')]['id']}})[_0xc388('0x2b')](handleEntityNotFound(_0x4a624a,null))[_0xc388('0x2b')](function(_0x2cb1d3){if(_0x2cb1d3){_0x346537=_0x2cb1d3;_0x1070fb[_0xc388('0x32')]=_[_0xc388('0x35')](db[_0xc388('0x83')][_0xc388('0x48')]);_0x1070fb[_0xc388('0x34')]=_[_0xc388('0x35')](_0x5bce0d[_0xc388('0x34')]);_0x1070fb[_0xc388('0x36')]=_[_0xc388('0x38')](_0x1070fb[_0xc388('0x32')],_0x1070fb[_0xc388('0x34')]);_0x8307a5[_0xc388('0x37')]=_[_0xc388('0x38')](_0x1070fb[_0xc388('0x32')],qs[_0xc388('0x39')](_0x5bce0d[_0xc388('0x34')]['fields']));_0x8307a5['attributes']=_0x8307a5[_0xc388('0x37')][_0xc388('0x71')]?_0x8307a5[_0xc388('0x37')]:_0x1070fb['model'];_0x8307a5[_0xc388('0x3c')]=qs[_0xc388('0x72')](_0x5bce0d[_0xc388('0x34')][_0xc388('0x72')]);_0x8307a5['where']=qs['filters'](_[_0xc388('0x73')](_0x5bce0d[_0xc388('0x34')],_0x1070fb['filters']));if(_0x5bce0d[_0xc388('0x34')][_0xc388('0x3d')]){_0x8307a5[_0xc388('0x3e')]=_[_0xc388('0x3f')](_0x8307a5[_0xc388('0x3e')],{'$or':_[_0xc388('0x33')](_0x8307a5[_0xc388('0x37')],function(_0x5923ba){var _0x2765cb={};_0x2765cb[_0x5923ba]={'$like':'%'+_0x5bce0d[_0xc388('0x34')][_0xc388('0x3d')]+'%'};return _0x2765cb;})});}_0x8307a5=_[_0xc388('0x3f')]({},_0x8307a5,_0x5bce0d[_0xc388('0x40')]);return _0x346537[_0xc388('0x96')](_0x8307a5);}})[_0xc388('0x2b')](function(_0x22990a){if(_0x22990a){_0x35512b=_0x22990a[_0xc388('0x71')];if(!_0x5bce0d[_0xc388('0x34')][_0xc388('0x3a')](_0xc388('0x3b'))){_0x8307a5[_0xc388('0x24')]=qs[_0xc388('0x24')](_0x5bce0d[_0xc388('0x34')]['limit']);_0x8307a5[_0xc388('0x26')]=qs[_0xc388('0x26')](_0x5bce0d[_0xc388('0x34')][_0xc388('0x26')]);}return _0x346537['getAgents'](_0x8307a5);}})[_0xc388('0x2b')](function(_0x306f52){if(_0x306f52){return _0x306f52?{'count':_0x35512b,'rows':_0x306f52}:null;}})[_0xc388('0x2b')](respondWithResult(_0x4a624a,null))['catch'](handleError(_0x4a624a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 567e027..cf3eba7 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 _0xf50f=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x4eacc2,_0xafb0b7){var _0x3b1911=function(_0x1fc1bb){while(--_0x1fc1bb){_0x4eacc2['push'](_0x4eacc2['shift']());}};_0x3b1911(++_0xafb0b7);}(_0xf50f,0x179));var _0xff50=function(_0x4e5055,_0x3b8b50){_0x4e5055=_0x4e5055-0x0;var _0x17adfa=_0xf50f[_0x4e5055];return _0x17adfa;};'use strict';var EventEmitter=require(_0xff50('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xff50('0x1')](0x0);var events={'afterCreate':_0xff50('0x2'),'afterUpdate':_0xff50('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e324d){return function(_0x2f64c9,_0x49ee84,_0x5d68ec){TeamEvents[_0xff50('0x4')](_0x5e324d+':'+_0x2f64c9['id'],_0x2f64c9);TeamEvents['emit'](_0x5e324d,_0x2f64c9);_0x5d68ec(null);};}for(var e in events){if(events[_0xff50('0x5')](e)){var event=events[e];Team[_0xff50('0x6')](e,emitEvent(event));}}module[_0xff50('0x7')]=TeamEvents; \ No newline at end of file +var _0xe9ba=['hasOwnProperty','hook','events','Team','setMaxListeners','update','remove','emit'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xe9ba,0x1da));var _0xae9b=function(_0x34ad09,_0xba8f16){_0x34ad09=_0x34ad09-0x0;var _0x4c8431=_0xe9ba[_0x34ad09];return _0x4c8431;};'use strict';var EventEmitter=require(_0xae9b('0x0'));var Team=require('../../mysqldb')['db'][_0xae9b('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xae9b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae9b('0x3'),'afterDestroy':_0xae9b('0x4')};function emitEvent(_0x34d3f9){return function(_0x4fb75c,_0x240956,_0x2080de){TeamEvents[_0xae9b('0x5')](_0x34d3f9+':'+_0x4fb75c['id'],_0x4fb75c);TeamEvents[_0xae9b('0x5')](_0x34d3f9,_0x4fb75c);_0x2080de(null);};}for(var e in events){if(events[_0xae9b('0x6')](e)){var event=events[e];Team[_0xae9b('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1652e85..5afcabe 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 _0xe618=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','Team','teams'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xe618,0x68));var _0x8e61=function(_0x5d990e,_0x4ba9f5){_0x5d990e=_0x5d990e-0x0;var _0x36c763=_0xe618[_0x5d990e];return _0x36c763;};'use strict';var _=require(_0x8e61('0x0'));var util=require(_0x8e61('0x1'));var logger=require(_0x8e61('0x2'))(_0x8e61('0x3'));var moment=require(_0x8e61('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e61('0x5'));var fs=require('fs');var path=require(_0x8e61('0x6'));var rimraf=require(_0x8e61('0x7'));var config=require(_0x8e61('0x8'));var attributes=require(_0x8e61('0x9'));module[_0x8e61('0xa')]=function(_0x2f5881,_0x3368fa){return _0x2f5881['define'](_0x8e61('0xb'),attributes,{'tableName':_0x8e61('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fa9=['../../config/environment','exports','Team','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x3fa9,0x17d));var _0x93fa=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x3fa9[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x93fa('0x0'));var logger=require(_0x93fa('0x1'))('api');var moment=require('moment');var BPromise=require(_0x93fa('0x2'));var rp=require(_0x93fa('0x3'));var fs=require('fs');var path=require(_0x93fa('0x4'));var rimraf=require(_0x93fa('0x5'));var config=require(_0x93fa('0x6'));var attributes=require('./team.attributes');module[_0x93fa('0x7')]=function(_0x27f932,_0x176d66){return _0x27f932['define'](_0x93fa('0x8'),attributes,{'tableName':'teams','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 ad05607..02ae7d3 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 _0x4ffb=['info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','http','redis','defaults','localhost','./team.socket','register','request','then'];(function(_0x21e565,_0x19ec38){var _0x50bbc6=function(_0x1fee57){while(--_0x1fee57){_0x21e565['push'](_0x21e565['shift']());}};_0x50bbc6(++_0x19ec38);}(_0x4ffb,0x69));var _0xb4ff=function(_0x5a33e5,_0xf91e32){_0x5a33e5=_0x5a33e5-0x0;var _0x3e73dd=_0x4ffb[_0x5a33e5];return _0x3e73dd;};'use strict';var _=require(_0xb4ff('0x0'));var util=require(_0xb4ff('0x1'));var moment=require(_0xb4ff('0x2'));var BPromise=require(_0xb4ff('0x3'));var rs=require(_0xb4ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb4ff('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb4ff('0x6'));var client=jayson['client'][_0xb4ff('0x7')]({'port':0x232a});config[_0xb4ff('0x8')]=_[_0xb4ff('0x9')](config[_0xb4ff('0x8')],{'host':_0xb4ff('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4ff('0x8')]));require(_0xb4ff('0xb'))[_0xb4ff('0xc')](socket);function respondWithRpcPromise(_0x4c7d51,_0x4d2cdd,_0x1f893f){return new BPromise(function(_0xdfe892,_0x32781a){return client[_0xb4ff('0xd')](_0x4c7d51,_0x1f893f)[_0xb4ff('0xe')](function(_0xfa88f2){logger[_0xb4ff('0xf')](_0xb4ff('0x10'),_0x4d2cdd,'request\x20sent');logger['debug'](_0xb4ff('0x11'),_0x4d2cdd,_0xb4ff('0x12'),JSON['stringify'](_0xfa88f2));if(_0xfa88f2[_0xb4ff('0x13')]){if(_0xfa88f2[_0xb4ff('0x13')][_0xb4ff('0x14')]===0x1f4){logger[_0xb4ff('0x13')](_0xb4ff('0x10'),_0x4d2cdd,_0xfa88f2[_0xb4ff('0x13')][_0xb4ff('0x15')]);return _0x32781a(_0xfa88f2['error'][_0xb4ff('0x15')]);}logger['error'](_0xb4ff('0x10'),_0x4d2cdd,_0xfa88f2[_0xb4ff('0x13')][_0xb4ff('0x15')]);return _0xdfe892(_0xfa88f2[_0xb4ff('0x13')]['message']);}else{logger[_0xb4ff('0xf')](_0xb4ff('0x10'),_0x4d2cdd,_0xb4ff('0x12'));_0xdfe892(_0xfa88f2[_0xb4ff('0x16')][_0xb4ff('0x15')]);}})[_0xb4ff('0x17')](function(_0x387fd5){logger[_0xb4ff('0x13')](_0xb4ff('0x10'),_0x4d2cdd,_0x387fd5);_0x32781a(_0x387fd5);});});} \ No newline at end of file +var _0x4ed6=['socket.io-emitter','./team.socket','request','then','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x2c7ec0,_0x30fae7){var _0x4643b3=function(_0x215cf0){while(--_0x215cf0){_0x2c7ec0['push'](_0x2c7ec0['shift']());}};_0x4643b3(++_0x30fae7);}(_0x4ed6,0xa3));var _0x64ed=function(_0x304634,_0x404e77){_0x304634=_0x304634-0x0;var _0x5724cc=_0x4ed6[_0x304634];return _0x5724cc;};'use strict';var _=require(_0x64ed('0x0'));var util=require(_0x64ed('0x1'));var moment=require(_0x64ed('0x2'));var BPromise=require('bluebird');var rs=require(_0x64ed('0x3'));var fs=require('fs');var Redis=require(_0x64ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64ed('0x5'));var logger=require(_0x64ed('0x6'))(_0x64ed('0x7'));var config=require('../../config/environment');var jayson=require(_0x64ed('0x8'));var client=jayson[_0x64ed('0x9')]['http']({'port':0x232a});config[_0x64ed('0xa')]=_[_0x64ed('0xb')](config[_0x64ed('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x64ed('0xc'))(new Redis(config[_0x64ed('0xa')]));require(_0x64ed('0xd'))['register'](socket);function respondWithRpcPromise(_0x4748c8,_0x127cac,_0x37e2d4){return new BPromise(function(_0x2728ff,_0x4e9ba9){return client[_0x64ed('0xe')](_0x4748c8,_0x37e2d4)[_0x64ed('0xf')](function(_0x189796){logger['info']('Team,\x20%s,\x20%s',_0x127cac,_0x64ed('0x10'));logger['debug'](_0x64ed('0x11'),_0x127cac,_0x64ed('0x10'),JSON['stringify'](_0x189796));if(_0x189796[_0x64ed('0x12')]){if(_0x189796['error'][_0x64ed('0x13')]===0x1f4){logger[_0x64ed('0x12')](_0x64ed('0x14'),_0x127cac,_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);return _0x4e9ba9(_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);}logger[_0x64ed('0x12')](_0x64ed('0x14'),_0x127cac,_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);return _0x2728ff(_0x189796[_0x64ed('0x12')][_0x64ed('0x15')]);}else{logger[_0x64ed('0x16')](_0x64ed('0x14'),_0x127cac,'request\x20sent');_0x2728ff(_0x189796[_0x64ed('0x17')][_0x64ed('0x15')]);}})[_0x64ed('0x18')](function(_0x307d34){logger['error'](_0x64ed('0x14'),_0x127cac,_0x307d34);_0x4e9ba9(_0x307d34);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4e9feb7..b7fb4d3 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 _0x08e5=['update','emit','register','length','team:','./team.events','save'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x08e5,0x1a9));var _0x508e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x08e5[_0x5d2803];return _0xdcad2c;};'use strict';var TeamEvents=require(_0x508e('0x0'));var events=[_0x508e('0x1'),'remove',_0x508e('0x2')];function createListener(_0xef94b9,_0x2436f5){return function(_0x4cb6ab){_0x2436f5[_0x508e('0x3')](_0xef94b9,_0x4cb6ab);};}function removeListener(_0x4f0ca5,_0x490adc){return function(){TeamEvents['removeListener'](_0x4f0ca5,_0x490adc);};}exports[_0x508e('0x4')]=function(_0x2d2b16){for(var _0x5ad57c=0x0,_0x380088=events[_0x508e('0x5')];_0x5ad57c<_0x380088;_0x5ad57c++){var _0x28b2f7=events[_0x5ad57c];var _0xae6f86=createListener(_0x508e('0x6')+_0x28b2f7,_0x2d2b16);TeamEvents['on'](_0x28b2f7,_0xae6f86);}}; \ No newline at end of file +var _0xb886=['update','emit','removeListener','register','length','./team.events','save','remove'];(function(_0x22e33f,_0x1620f6){var _0x20c9c=function(_0x4cbd90){while(--_0x4cbd90){_0x22e33f['push'](_0x22e33f['shift']());}};_0x20c9c(++_0x1620f6);}(_0xb886,0xf5));var _0x6b88=function(_0x524127,_0x161261){_0x524127=_0x524127-0x0;var _0x4f643e=_0xb886[_0x524127];return _0x4f643e;};'use strict';var TeamEvents=require(_0x6b88('0x0'));var events=[_0x6b88('0x1'),_0x6b88('0x2'),_0x6b88('0x3')];function createListener(_0x1227da,_0x24f91b){return function(_0x15bf58){_0x24f91b[_0x6b88('0x4')](_0x1227da,_0x15bf58);};}function removeListener(_0x5dc17b,_0x5007af){return function(){TeamEvents[_0x6b88('0x5')](_0x5dc17b,_0x5007af);};}exports[_0x6b88('0x6')]=function(_0x14acc6){for(var _0x23b99e=0x0,_0x2e0afb=events[_0x6b88('0x7')];_0x23b99e<_0x2e0afb;_0x23b99e++){var _0x4e15f1=events[_0x23b99e];var _0x154466=createListener('team:'+_0x4e15f1,_0x14acc6);TeamEvents['on'](_0x4e15f1,_0x154466);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index c4c235b..c0fb875 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 _0x2547=['INTEGER','exports'];(function(_0x5cf1a1,_0x1ab924){var _0x52cbcc=function(_0xdc1230){while(--_0xdc1230){_0x5cf1a1['push'](_0x5cf1a1['shift']());}};_0x52cbcc(++_0x1ab924);}(_0x2547,0x1cd));var _0x7254=function(_0x33103f,_0x39d826){_0x33103f=_0x33103f-0x0;var _0x440c48=_0x2547[_0x33103f];return _0x440c48;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'TeamId':{'type':Sequelize[_0x7254('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7254('0x1')]}}; \ No newline at end of file +var _0xf403=['INTEGER','sequelize'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xf403,0x1d3));var _0x3f40=function(_0x5b3682,_0x4786bf){_0x5b3682=_0x5b3682-0x0;var _0x23ae75=_0xf403[_0x5b3682];return _0x23ae75;};'use strict';var Sequelize=require(_0x3f40('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x3f40('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3f40('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d235801..8ee4a99 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 _0xbfcc=['bluebird','request-promise','exports','define','team_has_voice_prefixes','lodash','api','moment'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xbfcc[_0x43fdf8];return _0x1160c6;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcbfc('0x1'));var moment=require(_0xcbfc('0x2'));var BPromise=require(_0xcbfc('0x3'));var rp=require(_0xcbfc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xcbfc('0x5')]=function(_0x2dbb05,_0x537813){return _0x2dbb05[_0xcbfc('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0xcbfc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c32=['./teamVoicePrefix.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x3c32,0x161));var _0x23c3=function(_0x119bb9,_0x1bbcb7){_0x119bb9=_0x119bb9-0x0;var _0x391b91=_0x3c32[_0x119bb9];return _0x391b91;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var logger=require(_0x23c3('0x2'))('api');var moment=require(_0x23c3('0x3'));var BPromise=require(_0x23c3('0x4'));var rp=require(_0x23c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x23c3('0x7'));module[_0x23c3('0x8')]=function(_0x1ec17b,_0x190132){return _0x1ec17b[_0x23c3('0x9')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ccfc02a..632dadb 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x46c316,_0x158871){var _0x3a6104=function(_0x562857){while(--_0x562857){_0x46c316['push'](_0x46c316['shift']());}};_0x3a6104(++_0x158871);}(_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(_0x492857,_0xad43c7){var _0x443046=function(_0x3a82ad){while(--_0x3a82ad){_0x492857['push'](_0x492857['shift']());}};_0x443046(++_0xad43c7);}(_0xe706,0xa3));var _0x6e70=function(_0x17b1c0,_0x5f48f5){_0x17b1c0=_0x17b1c0-0x0;var _0x5b0ff5=_0xe706[_0x17b1c0];return _0x5b0ff5;};'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 86fde6e..8477ead 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 _0x6cc8=['exports','sequelize'];(function(_0x2f8c05,_0x551e3d){var _0x14cfde=function(_0x282d66){while(--_0x282d66){_0x2f8c05['push'](_0x2f8c05['shift']());}};_0x14cfde(++_0x551e3d);}(_0x6cc8,0x1c9));var _0x86cc=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x6cc8[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x86cc('0x0'));module[_0x86cc('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5bec=['INTEGER','sequelize','exports'];(function(_0x27bfc0,_0x648c41){var _0x2fea21=function(_0x4ba588){while(--_0x4ba588){_0x27bfc0['push'](_0x27bfc0['shift']());}};_0x2fea21(++_0x648c41);}(_0x5bec,0x85));var _0xc5be=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x5bec[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xc5be('0x0'));module[_0xc5be('0x1')]={'penalty':{'type':Sequelize[_0xc5be('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index b58a833..ed015d2 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 _0x177a=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x177a,0xdd));var _0xa177=function(_0x3d39b1,_0x2c416f){_0x3d39b1=_0x3d39b1-0x0;var _0x45014f=_0x177a[_0x3d39b1];return _0x45014f;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa177('0x1'));var moment=require(_0xa177('0x2'));var BPromise=require(_0xa177('0x3'));var rp=require(_0xa177('0x4'));var fs=require('fs');var path=require(_0xa177('0x5'));var rimraf=require(_0xa177('0x6'));var config=require('../../config/environment');var attributes=require(_0xa177('0x7'));module[_0xa177('0x8')]=function(_0x1f37b0,_0x455737){return _0x1f37b0[_0xa177('0x9')](_0xa177('0xa'),attributes,{'tableName':_0xa177('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfd=['team_has_voice_queues','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','TeamVoiceQueue'];(function(_0x3bc3c5,_0xa101ec){var _0x5641b3=function(_0x5da0e9){while(--_0x5da0e9){_0x3bc3c5['push'](_0x3bc3c5['shift']());}};_0x5641b3(++_0xa101ec);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdbdf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbdf('0x1'));var moment=require(_0xdbdf('0x2'));var BPromise=require(_0xdbdf('0x3'));var rp=require(_0xdbdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbdf('0x5'));var config=require(_0xdbdf('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0xdbdf('0x7')]=function(_0xa743ff,_0x484034){return _0xa743ff[_0xdbdf('0x8')](_0xdbdf('0x9'),attributes,{'tableName':_0xdbdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 367af17..4c9121c 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 _0xed3e=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x151681,_0x3613bc){var _0x4eac86=function(_0x3be9a7){while(--_0x3be9a7){_0x151681['push'](_0x151681['shift']());}};_0x4eac86(++_0x3613bc);}(_0xed3e,0x1a0));var _0xeed3=function(_0x32f582,_0x2ac357){_0x32f582=_0x32f582-0x0;var _0x1cbfa0=_0xed3e[_0x32f582];return _0x1cbfa0;};'use strict';var _=require(_0xeed3('0x0'));var util=require(_0xeed3('0x1'));var moment=require(_0xeed3('0x2'));var BPromise=require(_0xeed3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeed3('0x4'));var db=require(_0xeed3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeed3('0x6'))(_0xeed3('0x7'));var config=require(_0xeed3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeed3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47dfae,_0xeb9e9d,_0x88c6cb){return new BPromise(function(_0x5def7e,_0x41f229){return client[_0xeed3('0xa')](_0x47dfae,_0x88c6cb)[_0xeed3('0xb')](function(_0x4a86dd){logger[_0xeed3('0xc')](_0xeed3('0xd'),_0xeb9e9d,_0xeed3('0xe'));logger['debug'](_0xeed3('0xf'),_0xeb9e9d,_0xeed3('0xe'),JSON['stringify'](_0x4a86dd));if(_0x4a86dd['error']){if(_0x4a86dd[_0xeed3('0x10')]['code']===0x1f4){logger['error'](_0xeed3('0xd'),_0xeb9e9d,_0x4a86dd['error'][_0xeed3('0x11')]);return _0x41f229(_0x4a86dd[_0xeed3('0x10')][_0xeed3('0x11')]);}logger[_0xeed3('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0xeb9e9d,_0x4a86dd[_0xeed3('0x10')][_0xeed3('0x11')]);return _0x5def7e(_0x4a86dd[_0xeed3('0x10')][_0xeed3('0x11')]);}else{logger[_0xeed3('0xc')](_0xeed3('0xd'),_0xeb9e9d,_0xeed3('0xe'));_0x5def7e(_0x4a86dd[_0xeed3('0x12')]['message']);}})[_0xeed3('0x13')](function(_0x144ec4){logger[_0xeed3('0x10')](_0xeed3('0xd'),_0xeb9e9d,_0x144ec4);_0x41f229(_0x144ec4);});});} \ No newline at end of file +var _0xd847=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x587715,_0x4d4abe){var _0x599ece=function(_0x3ecbb8){while(--_0x3ecbb8){_0x587715['push'](_0x587715['shift']());}};_0x599ece(++_0x4d4abe);}(_0xd847,0x18a));var _0x7d84=function(_0x1acde2,_0x4cd189){_0x1acde2=_0x1acde2-0x0;var _0x4ccd31=_0xd847[_0x1acde2];return _0x4ccd31;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var moment=require(_0x7d84('0x2'));var BPromise=require(_0x7d84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d84('0x4'))['db'];var utils=require(_0x7d84('0x5'));var logger=require(_0x7d84('0x6'))(_0x7d84('0x7'));var config=require(_0x7d84('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c57cd,_0x20ce63,_0x1d6297){return new BPromise(function(_0x32da6d,_0x128ef5){return client[_0x7d84('0xa')](_0x3c57cd,_0x1d6297)['then'](function(_0x1cf0b9){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x20ce63,_0x7d84('0xb'));logger[_0x7d84('0xc')](_0x7d84('0xd'),_0x20ce63,_0x7d84('0xb'),JSON[_0x7d84('0xe')](_0x1cf0b9));if(_0x1cf0b9[_0x7d84('0xf')]){if(_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x10')]===0x1f4){logger[_0x7d84('0xf')](_0x7d84('0x11'),_0x20ce63,_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);return _0x128ef5(_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);}logger[_0x7d84('0xf')](_0x7d84('0x11'),_0x20ce63,_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);return _0x32da6d(_0x1cf0b9[_0x7d84('0xf')][_0x7d84('0x12')]);}else{logger[_0x7d84('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x20ce63,_0x7d84('0xb'));_0x32da6d(_0x1cf0b9[_0x7d84('0x14')]['message']);}})['catch'](function(_0x5338ab){logger[_0x7d84('0xf')](_0x7d84('0x11'),_0x20ce63,_0x5338ab);_0x128ef5(_0x5338ab);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 85793e4..df9e1c1 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 _0xbe2c=['isAuthenticated','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xc06638,_0x68dc26){var _0x34e96c=function(_0x15381a){while(--_0x15381a){_0xc06638['push'](_0xc06638['shift']());}};_0x34e96c(++_0x68dc26);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x447dc9,_0x2ad517){_0x447dc9=_0x447dc9-0x0;var _0x5dc8d1=_0xbe2c[_0x447dc9];return _0x5dc8d1;};'use strict';var multer=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var path=require('path');var timeout=require(_0xcbe2('0x2'));var express=require('express');var router=express[_0xcbe2('0x3')]();var fs_extra=require(_0xcbe2('0x4'));var auth=require(_0xcbe2('0x5'));var interaction=require(_0xcbe2('0x6'));var config=require(_0xcbe2('0x7'));var controller=require('./template.controller');router[_0xcbe2('0x8')]('/',auth[_0xcbe2('0x9')](),controller['index']);router[_0xcbe2('0x8')](_0xcbe2('0xa'),auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xb')]);router[_0xcbe2('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcbe2('0xd')](_0xcbe2('0xa'),auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xe')]);router['delete']('/:id',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xf')]);module[_0xcbe2('0x10')]=router; \ No newline at end of file +var _0x8a87=['delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','update'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0x8a87,0x6b));var _0x78a8=function(_0x5927ba,_0x34792d){_0x5927ba=_0x5927ba-0x0;var _0x1975d6=_0x8a87[_0x5927ba];return _0x1975d6;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x78a8('0x1'));var express=require('express');var router=express[_0x78a8('0x2')]();var fs_extra=require(_0x78a8('0x3'));var auth=require(_0x78a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78a8('0x5'));var controller=require('./template.controller');router['get']('/',auth[_0x78a8('0x6')](),controller[_0x78a8('0x7')]);router[_0x78a8('0x8')](_0x78a8('0x9'),auth[_0x78a8('0x6')](),controller['show']);router[_0x78a8('0xa')]('/',auth['isAuthenticated'](),controller[_0x78a8('0xb')]);router['put'](_0x78a8('0x9'),auth[_0x78a8('0x6')](),controller[_0x78a8('0xc')]);router[_0x78a8('0xd')](_0x78a8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x78a8('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0e59cc8..f6342e1 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 _0x1d63=['exports','TEXT'];(function(_0x357f6e,_0x267668){var _0x1f4f91=function(_0x300b6e){while(--_0x300b6e){_0x357f6e['push'](_0x357f6e['shift']());}};_0x1f4f91(++_0x267668);}(_0x1d63,0x178));var _0x31d6=function(_0x102c02,_0x501795){_0x102c02=_0x102c02-0x0;var _0x596678=_0x1d63[_0x102c02];return _0x596678;};'use strict';var Sequelize=require('sequelize');module[_0x31d6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x31d6('0x1')]}}; \ No newline at end of file +var _0x5239=['exports','STRING','sequelize'];(function(_0xcb7a1b,_0x39f401){var _0x550285=function(_0x290c6b){while(--_0x290c6b){_0xcb7a1b['push'](_0xcb7a1b['shift']());}};_0x550285(++_0x39f401);}(_0x5239,0x9e));var _0x9523=function(_0x3b8d4e,_0x3bb04b){_0x3b8d4e=_0x3b8d4e-0x0;var _0x41de4e=_0x5239[_0x3b8d4e];return _0x41de4e;};'use strict';var Sequelize=require(_0x9523('0x0'));module[_0x9523('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9523('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 85f1b73..b2bb021 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 _0x3058=['update','then','destroy','get','Templates','UserProfileResource','name','send','index','map','Template','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save'];(function(_0x2763b6,_0x269808){var _0x4cba9f=function(_0x326f3a){while(--_0x326f3a){_0x2763b6['push'](_0x2763b6['shift']());}};_0x4cba9f(++_0x269808);}(_0x3058,0x173));var _0x8305=function(_0x38bcd1,_0x4e2462){_0x38bcd1=_0x38bcd1-0x0;var _0x5df72d=_0x3058[_0x38bcd1];return _0x5df72d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8305('0x0'));var zipdir=require(_0x8305('0x1'));var jsonpatch=require(_0x8305('0x2'));var rp=require(_0x8305('0x3'));var moment=require(_0x8305('0x4'));var BPromise=require(_0x8305('0x5'));var Mustache=require(_0x8305('0x6'));var util=require(_0x8305('0x7'));var path=require(_0x8305('0x8'));var sox=require(_0x8305('0x9'));var csv=require(_0x8305('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8305('0xb'));var _=require(_0x8305('0xc'));var squel=require(_0x8305('0xd'));var crypto=require('crypto');var jsforce=require(_0x8305('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8305('0xa'));var querystring=require(_0x8305('0xf'));var Papa=require(_0x8305('0x10'));var Redis=require(_0x8305('0x11'));var authService=require(_0x8305('0x12'));var qs=require(_0x8305('0x13'));var as=require(_0x8305('0x14'));var hardwareService=require(_0x8305('0x15'));var logger=require(_0x8305('0x16'))(_0x8305('0x17'));var utils=require(_0x8305('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8305('0x19'));var db=require(_0x8305('0x1a'))['db'];function respondWithStatusCode(_0x1e0310,_0x4ecce4){_0x4ecce4=_0x4ecce4||0xcc;return function(_0x211cc6){if(_0x211cc6){return _0x1e0310[_0x8305('0x1b')](_0x4ecce4);}return _0x1e0310[_0x8305('0x1c')](_0x4ecce4)[_0x8305('0x1d')]();};}function respondWithResult(_0x305aed,_0x4870d1){_0x4870d1=_0x4870d1||0xc8;return function(_0x573456){if(_0x573456){return _0x305aed[_0x8305('0x1c')](_0x4870d1)['json'](_0x573456);}};}function respondWithFilteredResult(_0x45311e,_0x477c4e){return function(_0x4bfafe){if(_0x4bfafe){var _0x10cf93=typeof _0x477c4e[_0x8305('0x1e')]===_0x8305('0x1f')&&typeof _0x477c4e['limit']==='undefined';var _0xd86a8e=_0x4bfafe['count'];var _0x7362da=_0x10cf93?0x0:_0x477c4e['offset'];var _0x3af934=_0x10cf93?_0x4bfafe[_0x8305('0x20')]:_0x477c4e[_0x8305('0x1e')]+_0x477c4e[_0x8305('0x21')];var _0x36140a;if(_0x3af934>=_0xd86a8e){_0x3af934=_0xd86a8e;_0x36140a=0xc8;}else{_0x36140a=0xce;}_0x45311e[_0x8305('0x1c')](_0x36140a);return _0x45311e['set'](_0x8305('0x22'),_0x7362da+'-'+_0x3af934+'/'+_0xd86a8e)[_0x8305('0x23')](_0x4bfafe);}return null;};}function patchUpdates(_0x35a52e){return function(_0x3b6301){try{jsonpatch[_0x8305('0x24')](_0x3b6301,_0x35a52e,!![]);}catch(_0x2605d0){return BPromise[_0x8305('0x25')](_0x2605d0);}return _0x3b6301[_0x8305('0x26')]();};}function saveUpdates(_0x47dddd,_0x24f3a9){return function(_0x274129){if(_0x274129){return _0x274129[_0x8305('0x27')](_0x47dddd)[_0x8305('0x28')](function(_0x2b4661){return _0x2b4661;});}return null;};}function removeEntity(_0x11da5f,_0xe518d4){return function(_0x900ba9){if(_0x900ba9){return _0x900ba9[_0x8305('0x29')]()[_0x8305('0x28')](function(){var _0x5a8620=_0x900ba9[_0x8305('0x2a')]({'plain':!![]});var _0x413ec8=_0x8305('0x2b');return db[_0x8305('0x2c')][_0x8305('0x29')]({'where':{'type':_0x413ec8,'resourceId':_0x5a8620['id']}})[_0x8305('0x28')](function(){return _0x900ba9;});})['then'](function(){_0x11da5f[_0x8305('0x1c')](0xcc)[_0x8305('0x1d')]();});}};}function handleEntityNotFound(_0x26cfb2,_0x340284){return function(_0x244f75){if(!_0x244f75){_0x26cfb2[_0x8305('0x1b')](0x194);}return _0x244f75;};}function handleError(_0x537d94,_0x244465){_0x244465=_0x244465||0x1f4;return function(_0x12b96e){logger['error'](_0x12b96e['stack']);if(_0x12b96e[_0x8305('0x2d')]){delete _0x12b96e[_0x8305('0x2d')];}_0x537d94[_0x8305('0x1c')](_0x244465)[_0x8305('0x2e')](_0x12b96e);};}exports[_0x8305('0x2f')]=function(_0x275b9d,_0x58b455){var _0x1df56f={},_0x471e5f={},_0x3570e4={'count':0x0,'rows':[]};var _0x2dc7c8=_[_0x8305('0x30')](db[_0x8305('0x31')][_0x8305('0x32')],function(_0x3d7854){return{'name':_0x3d7854[_0x8305('0x33')],'type':_0x3d7854['type'][_0x8305('0x34')]};});_0x471e5f[_0x8305('0x35')]=_['map'](_0x2dc7c8,_0x8305('0x2d'));_0x471e5f['query']=_[_0x8305('0x36')](_0x275b9d[_0x8305('0x37')]);_0x471e5f[_0x8305('0x38')]=_['intersection'](_0x471e5f[_0x8305('0x35')],_0x471e5f[_0x8305('0x37')]);_0x1df56f[_0x8305('0x39')]=_[_0x8305('0x3a')](_0x471e5f[_0x8305('0x35')],qs['fields'](_0x275b9d[_0x8305('0x37')][_0x8305('0x3b')]));_0x1df56f[_0x8305('0x39')]=_0x1df56f['attributes']['length']?_0x1df56f[_0x8305('0x39')]:_0x471e5f[_0x8305('0x35')];if(!_0x275b9d[_0x8305('0x37')]['hasOwnProperty']('nolimit')){_0x1df56f[_0x8305('0x21')]=qs['limit'](_0x275b9d[_0x8305('0x37')][_0x8305('0x21')]);_0x1df56f[_0x8305('0x1e')]=qs[_0x8305('0x1e')](_0x275b9d['query'][_0x8305('0x1e')]);}_0x1df56f['order']=qs['sort'](_0x275b9d[_0x8305('0x37')]['sort']);_0x1df56f[_0x8305('0x3c')]=qs[_0x8305('0x38')](_[_0x8305('0x3d')](_0x275b9d['query'],_0x471e5f['filters']),_0x2dc7c8);if(_0x275b9d[_0x8305('0x37')]['filter']){_0x1df56f[_0x8305('0x3c')]=_[_0x8305('0x3e')](_0x1df56f[_0x8305('0x3c')],{'$or':_['map'](_0x2dc7c8,function(_0x2f96e9){if(_0x2f96e9[_0x8305('0x3f')]!==_0x8305('0x40')){var _0x583eb9={};_0x583eb9[_0x2f96e9['name']]={'$like':'%'+_0x275b9d['query'][_0x8305('0x41')]+'%'};return _0x583eb9;}})});}_0x1df56f=_[_0x8305('0x3e')]({},_0x1df56f,_0x275b9d[_0x8305('0x42')]);var _0x2eda32={'where':_0x1df56f['where']};return db[_0x8305('0x31')][_0x8305('0x20')](_0x2eda32)['then'](function(_0x1cb2e9){_0x3570e4[_0x8305('0x20')]=_0x1cb2e9;if(_0x275b9d[_0x8305('0x37')][_0x8305('0x43')]){_0x1df56f[_0x8305('0x44')]=[{'all':!![]}];}return db[_0x8305('0x31')][_0x8305('0x45')](_0x1df56f);})[_0x8305('0x28')](function(_0xbb6a1d){_0x3570e4[_0x8305('0x46')]=_0xbb6a1d;return _0x3570e4;})[_0x8305('0x28')](respondWithFilteredResult(_0x58b455,_0x1df56f))[_0x8305('0x47')](handleError(_0x58b455,null));};exports['show']=function(_0x4379d1,_0x545b7e){var _0x556e1f={'raw':!![],'where':{'id':_0x4379d1[_0x8305('0x48')]['id']}},_0x469df0={};_0x469df0[_0x8305('0x35')]=_[_0x8305('0x36')](db['Template']['rawAttributes']);_0x469df0[_0x8305('0x37')]=_[_0x8305('0x36')](_0x4379d1[_0x8305('0x37')]);_0x469df0['filters']=_[_0x8305('0x3a')](_0x469df0['model'],_0x469df0[_0x8305('0x37')]);_0x556e1f[_0x8305('0x39')]=_['intersection'](_0x469df0[_0x8305('0x35')],qs[_0x8305('0x3b')](_0x4379d1['query']['fields']));_0x556e1f[_0x8305('0x39')]=_0x556e1f[_0x8305('0x39')]['length']?_0x556e1f[_0x8305('0x39')]:_0x469df0[_0x8305('0x35')];if(_0x4379d1[_0x8305('0x37')]['includeAll']){_0x556e1f[_0x8305('0x44')]=[{'all':!![]}];}_0x556e1f=_[_0x8305('0x3e')]({},_0x556e1f,_0x4379d1[_0x8305('0x42')]);return db[_0x8305('0x31')][_0x8305('0x49')](_0x556e1f)[_0x8305('0x28')](handleEntityNotFound(_0x545b7e,null))[_0x8305('0x28')](respondWithResult(_0x545b7e,null))[_0x8305('0x47')](handleError(_0x545b7e,null));};exports[_0x8305('0x4a')]=function(_0x1d98ba,_0x12ee51){return db['Template'][_0x8305('0x4a')](_0x1d98ba[_0x8305('0x4b')],{})['then'](function(_0x366468){var _0x29b5d2=_0x1d98ba[_0x8305('0x4c')][_0x8305('0x2a')]({'plain':!![]});if(!_0x29b5d2)throw new Error(_0x8305('0x4d'));if(_0x29b5d2[_0x8305('0x4e')]==='user'){var _0x29ab45=_0x366468['get']({'plain':!![]});var _0x4f5ad0=_0x8305('0x2b');return db['UserProfileSection'][_0x8305('0x49')]({'where':{'name':_0x4f5ad0,'userProfileId':_0x29b5d2[_0x8305('0x4f')]},'raw':!![]})['then'](function(_0x1a7581){if(_0x1a7581&&_0x1a7581[_0x8305('0x50')]===0x0){return db[_0x8305('0x2c')]['create']({'name':_0x29ab45[_0x8305('0x2d')],'resourceId':_0x29ab45['id'],'type':_0x1a7581[_0x8305('0x2d')],'sectionId':_0x1a7581['id']},{})[_0x8305('0x28')](function(){return _0x366468;});}else{return _0x366468;}})[_0x8305('0x47')](function(_0xf4f737){logger['error'](_0x8305('0x51'),_0xf4f737);throw _0xf4f737;});}return _0x366468;})[_0x8305('0x28')](respondWithResult(_0x12ee51,0xc9))['catch'](handleError(_0x12ee51,null));};exports[_0x8305('0x27')]=function(_0x8b9b93,_0xc7a8e0){if(_0x8b9b93[_0x8305('0x4b')]['id']){delete _0x8b9b93[_0x8305('0x4b')]['id'];}return db[_0x8305('0x31')][_0x8305('0x49')]({'where':{'id':_0x8b9b93[_0x8305('0x48')]['id']}})[_0x8305('0x28')](handleEntityNotFound(_0xc7a8e0,null))['then'](saveUpdates(_0x8b9b93[_0x8305('0x4b')],null))[_0x8305('0x28')](respondWithResult(_0xc7a8e0,null))[_0x8305('0x47')](handleError(_0xc7a8e0,null));};exports[_0x8305('0x29')]=function(_0x2d3fa4,_0x98f87e){return db[_0x8305('0x31')]['find']({'where':{'id':_0x2d3fa4[_0x8305('0x48')]['id']}})[_0x8305('0x28')](handleEntityNotFound(_0x98f87e,null))[_0x8305('0x28')](removeEntity(_0x98f87e,null))[_0x8305('0x47')](handleError(_0x98f87e,null));}; \ No newline at end of file +var _0xf596=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','then','stack','name','index','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','Template','catch','show','params','keys','intersection','include','merge','find','create','body','user','get','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0x24fcf3,_0x87a2c4){var _0x4b6ed6=function(_0x59717d){while(--_0x59717d){_0x24fcf3['push'](_0x24fcf3['shift']());}};_0x4b6ed6(++_0x87a2c4);}(_0xf596,0xe1));var _0x6f59=function(_0x1c6520,_0x19ce8c){_0x1c6520=_0x1c6520-0x0;var _0x445165=_0xf596[_0x1c6520];return _0x445165;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f59('0x0'));var zipdir=require(_0x6f59('0x1'));var jsonpatch=require(_0x6f59('0x2'));var rp=require(_0x6f59('0x3'));var moment=require('moment');var BPromise=require(_0x6f59('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f59('0x5'));var sox=require(_0x6f59('0x6'));var csv=require(_0x6f59('0x7'));var ejs=require(_0x6f59('0x8'));var fs=require('fs');var fs_extra=require(_0x6f59('0x9'));var _=require(_0x6f59('0xa'));var squel=require(_0x6f59('0xb'));var crypto=require(_0x6f59('0xc'));var jsforce=require(_0x6f59('0xd'));var deskjs=require(_0x6f59('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f59('0xf'));var Papa=require('papaparse');var Redis=require(_0x6f59('0x10'));var authService=require(_0x6f59('0x11'));var qs=require(_0x6f59('0x12'));var as=require(_0x6f59('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f59('0x14'))(_0x6f59('0x15'));var utils=require(_0x6f59('0x16'));var config=require(_0x6f59('0x17'));var licenseUtil=require(_0x6f59('0x18'));var db=require(_0x6f59('0x19'))['db'];function respondWithStatusCode(_0x359bec,_0x4bd1ab){_0x4bd1ab=_0x4bd1ab||0xcc;return function(_0x491fed){if(_0x491fed){return _0x359bec['sendStatus'](_0x4bd1ab);}return _0x359bec['status'](_0x4bd1ab)[_0x6f59('0x1a')]();};}function respondWithResult(_0x12e1f8,_0x4bb569){_0x4bb569=_0x4bb569||0xc8;return function(_0x3af006){if(_0x3af006){return _0x12e1f8[_0x6f59('0x1b')](_0x4bb569)[_0x6f59('0x1c')](_0x3af006);}};}function respondWithFilteredResult(_0x18d190,_0x425fc7){return function(_0x1b5412){if(_0x1b5412){var _0x3c4c24=typeof _0x425fc7[_0x6f59('0x1d')]===_0x6f59('0x1e')&&typeof _0x425fc7[_0x6f59('0x1f')]===_0x6f59('0x1e');var _0x2cec53=_0x1b5412[_0x6f59('0x20')];var _0x5c7f8d=_0x3c4c24?0x0:_0x425fc7[_0x6f59('0x1d')];var _0x3034c2=_0x3c4c24?_0x1b5412['count']:_0x425fc7[_0x6f59('0x1d')]+_0x425fc7[_0x6f59('0x1f')];var _0x1b5c14;if(_0x3034c2>=_0x2cec53){_0x3034c2=_0x2cec53;_0x1b5c14=0xc8;}else{_0x1b5c14=0xce;}_0x18d190['status'](_0x1b5c14);return _0x18d190[_0x6f59('0x21')](_0x6f59('0x22'),_0x5c7f8d+'-'+_0x3034c2+'/'+_0x2cec53)[_0x6f59('0x1c')](_0x1b5412);}return null;};}function patchUpdates(_0x464061){return function(_0x2edba3){try{jsonpatch[_0x6f59('0x23')](_0x2edba3,_0x464061,!![]);}catch(_0x3cc81d){return BPromise[_0x6f59('0x24')](_0x3cc81d);}return _0x2edba3[_0x6f59('0x25')]();};}function saveUpdates(_0x2a838e,_0x42f4e4){return function(_0x256b40){if(_0x256b40){return _0x256b40[_0x6f59('0x26')](_0x2a838e)['then'](function(_0x467e6e){return _0x467e6e;});}return null;};}function removeEntity(_0xbee047,_0x561ab6){return function(_0x530008){if(_0x530008){return _0x530008[_0x6f59('0x27')]()['then'](function(){var _0x404e9f=_0x530008['get']({'plain':!![]});var _0x51cc6f='Templates';return db[_0x6f59('0x28')][_0x6f59('0x27')]({'where':{'type':_0x51cc6f,'resourceId':_0x404e9f['id']}})[_0x6f59('0x29')](function(){return _0x530008;});})[_0x6f59('0x29')](function(){_0xbee047[_0x6f59('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4243ef,_0x2f0227){return function(_0xdb6941){if(!_0xdb6941){_0x4243ef['sendStatus'](0x194);}return _0xdb6941;};}function handleError(_0x2a5297,_0x2cf503){_0x2cf503=_0x2cf503||0x1f4;return function(_0xeda4a3){logger['error'](_0xeda4a3[_0x6f59('0x2a')]);if(_0xeda4a3[_0x6f59('0x2b')]){delete _0xeda4a3[_0x6f59('0x2b')];}_0x2a5297[_0x6f59('0x1b')](_0x2cf503)['send'](_0xeda4a3);};}exports[_0x6f59('0x2c')]=function(_0x2e41a9,_0x5effa8){var _0x589fa3={},_0x2d72df={},_0x564a9b={'count':0x0,'rows':[]};var _0x2c6ef4=_['map'](db['Template'][_0x6f59('0x2d')],function(_0x51acc6){return{'name':_0x51acc6['fieldName'],'type':_0x51acc6[_0x6f59('0x2e')][_0x6f59('0x2f')]};});_0x2d72df[_0x6f59('0x30')]=_['map'](_0x2c6ef4,_0x6f59('0x2b'));_0x2d72df['query']=_['keys'](_0x2e41a9[_0x6f59('0x31')]);_0x2d72df['filters']=_['intersection'](_0x2d72df[_0x6f59('0x30')],_0x2d72df[_0x6f59('0x31')]);_0x589fa3['attributes']=_['intersection'](_0x2d72df[_0x6f59('0x30')],qs[_0x6f59('0x32')](_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x32')]));_0x589fa3['attributes']=_0x589fa3[_0x6f59('0x33')][_0x6f59('0x34')]?_0x589fa3[_0x6f59('0x33')]:_0x2d72df['model'];if(!_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x35')](_0x6f59('0x36'))){_0x589fa3['limit']=qs['limit'](_0x2e41a9['query'][_0x6f59('0x1f')]);_0x589fa3['offset']=qs[_0x6f59('0x1d')](_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x1d')]);}_0x589fa3[_0x6f59('0x37')]=qs[_0x6f59('0x38')](_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x38')]);_0x589fa3[_0x6f59('0x39')]=qs[_0x6f59('0x3a')](_[_0x6f59('0x3b')](_0x2e41a9[_0x6f59('0x31')],_0x2d72df[_0x6f59('0x3a')]),_0x2c6ef4);if(_0x2e41a9['query'][_0x6f59('0x3c')]){_0x589fa3[_0x6f59('0x39')]=_['merge'](_0x589fa3[_0x6f59('0x39')],{'$or':_['map'](_0x2c6ef4,function(_0x4a9e62){if(_0x4a9e62[_0x6f59('0x2e')]!==_0x6f59('0x3d')){var _0x1bd877={};_0x1bd877[_0x4a9e62[_0x6f59('0x2b')]]={'$like':'%'+_0x2e41a9['query'][_0x6f59('0x3c')]+'%'};return _0x1bd877;}})});}_0x589fa3=_['merge']({},_0x589fa3,_0x2e41a9[_0x6f59('0x3e')]);var _0x2edb48={'where':_0x589fa3[_0x6f59('0x39')]};return db['Template'][_0x6f59('0x20')](_0x2edb48)['then'](function(_0x56a883){_0x564a9b[_0x6f59('0x20')]=_0x56a883;if(_0x2e41a9[_0x6f59('0x31')][_0x6f59('0x3f')]){_0x589fa3['include']=[{'all':!![]}];}return db[_0x6f59('0x40')]['findAll'](_0x589fa3);})['then'](function(_0x55903c){_0x564a9b['rows']=_0x55903c;return _0x564a9b;})[_0x6f59('0x29')](respondWithFilteredResult(_0x5effa8,_0x589fa3))[_0x6f59('0x41')](handleError(_0x5effa8,null));};exports[_0x6f59('0x42')]=function(_0x449db9,_0x2d1470){var _0x303f36={'raw':!![],'where':{'id':_0x449db9[_0x6f59('0x43')]['id']}},_0x44a686={};_0x44a686[_0x6f59('0x30')]=_[_0x6f59('0x44')](db['Template'][_0x6f59('0x2d')]);_0x44a686[_0x6f59('0x31')]=_[_0x6f59('0x44')](_0x449db9[_0x6f59('0x31')]);_0x44a686[_0x6f59('0x3a')]=_[_0x6f59('0x45')](_0x44a686['model'],_0x44a686[_0x6f59('0x31')]);_0x303f36[_0x6f59('0x33')]=_[_0x6f59('0x45')](_0x44a686['model'],qs['fields'](_0x449db9[_0x6f59('0x31')][_0x6f59('0x32')]));_0x303f36[_0x6f59('0x33')]=_0x303f36[_0x6f59('0x33')][_0x6f59('0x34')]?_0x303f36[_0x6f59('0x33')]:_0x44a686[_0x6f59('0x30')];if(_0x449db9['query'][_0x6f59('0x3f')]){_0x303f36[_0x6f59('0x46')]=[{'all':!![]}];}_0x303f36=_[_0x6f59('0x47')]({},_0x303f36,_0x449db9[_0x6f59('0x3e')]);return db[_0x6f59('0x40')][_0x6f59('0x48')](_0x303f36)['then'](handleEntityNotFound(_0x2d1470,null))[_0x6f59('0x29')](respondWithResult(_0x2d1470,null))[_0x6f59('0x41')](handleError(_0x2d1470,null));};exports[_0x6f59('0x49')]=function(_0x33f911,_0x267aab){return db['Template'][_0x6f59('0x49')](_0x33f911[_0x6f59('0x4a')],{})[_0x6f59('0x29')](function(_0x1d9498){var _0x264a66=_0x33f911[_0x6f59('0x4b')][_0x6f59('0x4c')]({'plain':!![]});if(!_0x264a66)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x264a66[_0x6f59('0x4d')]===_0x6f59('0x4b')){var _0x2eb024=_0x1d9498[_0x6f59('0x4c')]({'plain':!![]});var _0x2be6ac=_0x6f59('0x4e');return db[_0x6f59('0x4f')]['find']({'where':{'name':_0x2be6ac,'userProfileId':_0x264a66[_0x6f59('0x50')]},'raw':!![]})[_0x6f59('0x29')](function(_0xf2917){if(_0xf2917&&_0xf2917[_0x6f59('0x51')]===0x0){return db[_0x6f59('0x28')][_0x6f59('0x49')]({'name':_0x2eb024['name'],'resourceId':_0x2eb024['id'],'type':_0xf2917[_0x6f59('0x2b')],'sectionId':_0xf2917['id']},{})[_0x6f59('0x29')](function(){return _0x1d9498;});}else{return _0x1d9498;}})['catch'](function(_0x295cf2){logger[_0x6f59('0x52')](_0x6f59('0x53'),_0x295cf2);throw _0x295cf2;});}return _0x1d9498;})['then'](respondWithResult(_0x267aab,0xc9))[_0x6f59('0x41')](handleError(_0x267aab,null));};exports[_0x6f59('0x26')]=function(_0x580f6c,_0x3f0cd8){if(_0x580f6c[_0x6f59('0x4a')]['id']){delete _0x580f6c[_0x6f59('0x4a')]['id'];}return db[_0x6f59('0x40')]['find']({'where':{'id':_0x580f6c['params']['id']}})[_0x6f59('0x29')](handleEntityNotFound(_0x3f0cd8,null))[_0x6f59('0x29')](saveUpdates(_0x580f6c[_0x6f59('0x4a')],null))[_0x6f59('0x29')](respondWithResult(_0x3f0cd8,null))[_0x6f59('0x41')](handleError(_0x3f0cd8,null));};exports['destroy']=function(_0x2405c5,_0x24e19a){return db[_0x6f59('0x40')][_0x6f59('0x48')]({'where':{'id':_0x2405c5[_0x6f59('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e19a,null))[_0x6f59('0x29')](removeEntity(_0x24e19a,null))[_0x6f59('0x41')](handleError(_0x24e19a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 96a43e0..bee26ee 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 _0x9013=['./template.attributes','exports','Template','tools_templates','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xcbd7ae,_0x60d37d){var _0x334d47=function(_0x29ffa8){while(--_0x29ffa8){_0xcbd7ae['push'](_0xcbd7ae['shift']());}};_0x334d47(++_0x60d37d);}(_0x9013,0x156));var _0x3901=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9013[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x3901('0x0'));var logger=require(_0x3901('0x1'))(_0x3901('0x2'));var moment=require(_0x3901('0x3'));var BPromise=require(_0x3901('0x4'));var rp=require(_0x3901('0x5'));var fs=require('fs');var path=require(_0x3901('0x6'));var rimraf=require(_0x3901('0x7'));var config=require(_0x3901('0x8'));var attributes=require(_0x3901('0x9'));module[_0x3901('0xa')]=function(_0x149e56,_0x10a65c){return _0x149e56['define'](_0x3901('0xb'),attributes,{'tableName':_0x3901('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5028=['../../config/logger','moment','bluebird','path','rimraf','./template.attributes','define','tools_templates','util'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x5028,0x74));var _0x8502=function(_0x2e211,_0x56a1c9){_0x2e211=_0x2e211-0x0;var _0x36f6c6=_0x5028[_0x2e211];return _0x36f6c6;};'use strict';var _=require('lodash');var util=require(_0x8502('0x0'));var logger=require(_0x8502('0x1'))('api');var moment=require(_0x8502('0x2'));var BPromise=require(_0x8502('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8502('0x4'));var rimraf=require(_0x8502('0x5'));var config=require('../../config/environment');var attributes=require(_0x8502('0x6'));module['exports']=function(_0x54dfee,_0x197dc3){return _0x54dfee[_0x8502('0x7')]('Template',attributes,{'tableName':_0x8502('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 106287a..97af287 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 _0xffcc=['options','where','limit','include','map','attributes','model','stringify','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetTemplate','findAll'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xffcc,0x147));var _0xcffc=function(_0xaa7dbc,_0x1150e6){_0xaa7dbc=_0xaa7dbc-0x0;var _0x1d8505=_0xffcc[_0xaa7dbc];return _0x1d8505;};'use strict';var _=require(_0xcffc('0x0'));var util=require('util');var moment=require(_0xcffc('0x1'));var BPromise=require('bluebird');var rs=require(_0xcffc('0x2'));var fs=require('fs');var Redis=require(_0xcffc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcffc('0x4'))(_0xcffc('0x5'));var config=require(_0xcffc('0x6'));var jayson=require(_0xcffc('0x7'));var client=jayson[_0xcffc('0x8')][_0xcffc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ca621,_0x509925,_0x9a3982){return new BPromise(function(_0x207559,_0x581629){return client['request'](_0x5ca621,_0x9a3982)[_0xcffc('0xa')](function(_0x1fad02){logger[_0xcffc('0xb')](_0xcffc('0xc'),_0x509925,_0xcffc('0xd'));logger[_0xcffc('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x509925,_0xcffc('0xd'),JSON['stringify'](_0x1fad02));if(_0x1fad02[_0xcffc('0xf')]){if(_0x1fad02[_0xcffc('0xf')][_0xcffc('0x10')]===0x1f4){logger[_0xcffc('0xf')](_0xcffc('0xc'),_0x509925,_0x1fad02[_0xcffc('0xf')][_0xcffc('0x11')]);return _0x581629(_0x1fad02['error'][_0xcffc('0x11')]);}logger['error'](_0xcffc('0xc'),_0x509925,_0x1fad02[_0xcffc('0xf')]['message']);return _0x207559(_0x1fad02['error'][_0xcffc('0x11')]);}else{logger[_0xcffc('0xb')]('Template,\x20%s,\x20%s',_0x509925,'request\x20sent');_0x207559(_0x1fad02['result'][_0xcffc('0x11')]);}})[_0xcffc('0x12')](function(_0x3437f1){logger[_0xcffc('0xf')](_0xcffc('0xc'),_0x509925,_0x3437f1);_0x581629(_0x3437f1);});});}exports[_0xcffc('0x13')]=function(_0x108a6e){var _0x169d7f=this;return new Promise(function(_0x2a7551,_0x4a4809){return db['Template'][_0xcffc('0x14')]({'raw':_0x108a6e[_0xcffc('0x15')]?_0x108a6e[_0xcffc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x108a6e['options']?_0x108a6e[_0xcffc('0x15')][_0xcffc('0x16')]||null:null,'attributes':_0x108a6e['options']?_0x108a6e[_0xcffc('0x15')]['attributes']||null:null,'limit':_0x108a6e[_0xcffc('0x15')]?_0x108a6e[_0xcffc('0x15')][_0xcffc('0x17')]||null:null,'include':_0x108a6e[_0xcffc('0x15')]?_0x108a6e[_0xcffc('0x15')][_0xcffc('0x18')]?_[_0xcffc('0x19')](_0x108a6e['options'][_0xcffc('0x18')],function(_0x31e773){return{'model':db[_0x31e773['model']],'as':_0x31e773['as'],'attributes':_0x31e773[_0xcffc('0x1a')],'include':_0x31e773[_0xcffc('0x18')]?_[_0xcffc('0x19')](_0x31e773[_0xcffc('0x18')],function(_0x2e8bf0){return{'model':db[_0x2e8bf0[_0xcffc('0x1b')]],'as':_0x2e8bf0['as'],'attributes':_0x2e8bf0[_0xcffc('0x1a')],'include':_0x2e8bf0[_0xcffc('0x18')]?_['map'](_0x2e8bf0['include'],function(_0x59c6eb){return{'model':db[_0x59c6eb['model']],'as':_0x59c6eb['as'],'attributes':_0x59c6eb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b089f){logger['info'](_0xcffc('0x13'),_0x108a6e);logger[_0xcffc('0xe')](_0xcffc('0x13'),_0x108a6e,JSON[_0xcffc('0x1c')](_0x6b089f));_0x2a7551(_0x6b089f);})[_0xcffc('0x12')](function(_0x3fba22){logger[_0xcffc('0xf')](_0xcffc('0x13'),_0x3fba22[_0xcffc('0x11')],_0x108a6e);_0x4a4809(_0x169d7f['error'](0x1f4,_0x3fba22[_0xcffc('0x11')]));});});}; \ No newline at end of file +var _0x98d2=['info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','catch','GetTemplate','Template','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x3c0c9e,_0x3ecdee){var _0x5ba5fe=function(_0x1f4a60){while(--_0x1f4a60){_0x3c0c9e['push'](_0x3c0c9e['shift']());}};_0x5ba5fe(++_0x3ecdee);}(_0x98d2,0xb3));var _0x298d=function(_0x1857d0,_0x6eade0){_0x1857d0=_0x1857d0-0x0;var _0x3e3c46=_0x98d2[_0x1857d0];return _0x3e3c46;};'use strict';var _=require(_0x298d('0x0'));var util=require(_0x298d('0x1'));var moment=require(_0x298d('0x2'));var BPromise=require(_0x298d('0x3'));var rs=require(_0x298d('0x4'));var fs=require('fs');var Redis=require(_0x298d('0x5'));var db=require(_0x298d('0x6'))['db'];var utils=require(_0x298d('0x7'));var logger=require(_0x298d('0x8'))('rpc');var config=require(_0x298d('0x9'));var jayson=require(_0x298d('0xa'));var client=jayson['client'][_0x298d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27720a,_0x94eb90,_0x49cff2){return new BPromise(function(_0x2e00cd,_0x4bc06c){return client['request'](_0x27720a,_0x49cff2)[_0x298d('0xc')](function(_0x47f0c9){logger[_0x298d('0xd')]('Template,\x20%s,\x20%s',_0x94eb90,_0x298d('0xe'));logger[_0x298d('0xf')](_0x298d('0x10'),_0x94eb90,_0x298d('0xe'),JSON[_0x298d('0x11')](_0x47f0c9));if(_0x47f0c9[_0x298d('0x12')]){if(_0x47f0c9[_0x298d('0x12')][_0x298d('0x13')]===0x1f4){logger[_0x298d('0x12')]('Template,\x20%s,\x20%s',_0x94eb90,_0x47f0c9[_0x298d('0x12')]['message']);return _0x4bc06c(_0x47f0c9['error'][_0x298d('0x14')]);}logger[_0x298d('0x12')](_0x298d('0x15'),_0x94eb90,_0x47f0c9[_0x298d('0x12')][_0x298d('0x14')]);return _0x2e00cd(_0x47f0c9[_0x298d('0x12')]['message']);}else{logger['info'](_0x298d('0x15'),_0x94eb90,'request\x20sent');_0x2e00cd(_0x47f0c9['result'][_0x298d('0x14')]);}})[_0x298d('0x16')](function(_0x52fb00){logger[_0x298d('0x12')](_0x298d('0x15'),_0x94eb90,_0x52fb00);_0x4bc06c(_0x52fb00);});});}exports[_0x298d('0x17')]=function(_0x4cbc15){var _0x25c9fe=this;return new Promise(function(_0x206a29,_0x5a81ae){return db[_0x298d('0x18')]['findAll']({'raw':_0x4cbc15['options']?_0x4cbc15[_0x298d('0x19')][_0x298d('0x1a')]===undefined?!![]:![]:!![],'where':_0x4cbc15[_0x298d('0x19')]?_0x4cbc15[_0x298d('0x19')]['where']||null:null,'attributes':_0x4cbc15[_0x298d('0x19')]?_0x4cbc15[_0x298d('0x19')][_0x298d('0x1b')]||null:null,'limit':_0x4cbc15[_0x298d('0x19')]?_0x4cbc15['options'][_0x298d('0x1c')]||null:null,'include':_0x4cbc15['options']?_0x4cbc15[_0x298d('0x19')][_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x4cbc15[_0x298d('0x19')]['include'],function(_0x10e07a){return{'model':db[_0x10e07a['model']],'as':_0x10e07a['as'],'attributes':_0x10e07a[_0x298d('0x1b')],'include':_0x10e07a[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x10e07a['include'],function(_0x9da717){return{'model':db[_0x9da717[_0x298d('0x1f')]],'as':_0x9da717['as'],'attributes':_0x9da717[_0x298d('0x1b')],'include':_0x9da717[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x9da717[_0x298d('0x1d')],function(_0x510b33){return{'model':db[_0x510b33['model']],'as':_0x510b33['as'],'attributes':_0x510b33['attributes']};}):[]};}):[]};}):[]:[]})[_0x298d('0xc')](function(_0x55ec55){logger['info'](_0x298d('0x17'),_0x4cbc15);logger['debug'](_0x298d('0x17'),_0x4cbc15,JSON[_0x298d('0x11')](_0x55ec55));_0x206a29(_0x55ec55);})[_0x298d('0x16')](function(_0x2056f3){logger['error']('GetTemplate',_0x2056f3[_0x298d('0x14')],_0x4cbc15);_0x5a81ae(_0x25c9fe[_0x298d('0x12')](0x1f4,_0x2056f3[_0x298d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e13c11f..b4c659b 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 _0xc224=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update'];(function(_0x3ce460,_0xcc24ba){var _0x5e5fc2=function(_0x59d7d3){while(--_0x59d7d3){_0x3ce460['push'](_0x3ce460['shift']());}};_0x5e5fc2(++_0xcc24ba);}(_0xc224,0xe4));var _0x4c22=function(_0x49e962,_0x2d85bf){_0x49e962=_0x49e962-0x0;var _0x2e8d35=_0xc224[_0x49e962];return _0x2e8d35;};'use strict';var multer=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var path=require(_0x4c22('0x2'));var timeout=require(_0x4c22('0x3'));var express=require('express');var router=express[_0x4c22('0x4')]();var fs_extra=require(_0x4c22('0x5'));var auth=require(_0x4c22('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c22('0x7'));var controller=require('./trigger.controller');router[_0x4c22('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4c22('0x8')](_0x4c22('0x9'),auth[_0x4c22('0xa')](),controller['show']);router[_0x4c22('0x8')](_0x4c22('0xb'),auth[_0x4c22('0xa')](),controller[_0x4c22('0xc')]);router[_0x4c22('0x8')](_0x4c22('0xd'),auth[_0x4c22('0xa')](),controller['getAnyConditions']);router['get'](_0x4c22('0xe'),auth['isAuthenticated'](),controller[_0x4c22('0xf')]);router[_0x4c22('0x10')]('/',auth[_0x4c22('0xa')](),controller[_0x4c22('0x11')]);router[_0x4c22('0x10')](_0x4c22('0xb'),auth[_0x4c22('0xa')](),controller[_0x4c22('0x12')]);router['post'](_0x4c22('0xd'),auth[_0x4c22('0xa')](),controller['addAnyCondition']);router[_0x4c22('0x10')]('/:id/actions',auth[_0x4c22('0xa')](),controller[_0x4c22('0x13')]);router[_0x4c22('0x14')]('/:id',auth[_0x4c22('0xa')](),controller[_0x4c22('0x15')]);router[_0x4c22('0x16')](_0x4c22('0x9'),auth[_0x4c22('0xa')](),controller[_0x4c22('0x17')]);module[_0x4c22('0x18')]=router; \ No newline at end of file +var _0x91bc=['addAction','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','post','addAllCondition','/:id/any_conditions','addAnyCondition'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x91bc,0x181));var _0xc91b=function(_0x533279,_0x42f831){_0x533279=_0x533279-0x0;var _0x5793db=_0x91bc[_0x533279];return _0x5793db;};'use strict';var multer=require(_0xc91b('0x0'));var util=require(_0xc91b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc91b('0x2'));var router=express[_0xc91b('0x3')]();var fs_extra=require(_0xc91b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc91b('0x5'));var config=require(_0xc91b('0x6'));var controller=require(_0xc91b('0x7'));router['get']('/',auth[_0xc91b('0x8')](),controller[_0xc91b('0x9')]);router[_0xc91b('0xa')]('/:id',auth[_0xc91b('0x8')](),controller[_0xc91b('0xb')]);router[_0xc91b('0xa')](_0xc91b('0xc'),auth[_0xc91b('0x8')](),controller[_0xc91b('0xd')]);router[_0xc91b('0xa')]('/:id/any_conditions',auth[_0xc91b('0x8')](),controller[_0xc91b('0xe')]);router[_0xc91b('0xa')](_0xc91b('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0xc91b('0x10')]('/',auth[_0xc91b('0x8')](),controller['create']);router[_0xc91b('0x10')](_0xc91b('0xc'),auth[_0xc91b('0x8')](),controller[_0xc91b('0x11')]);router['post'](_0xc91b('0x12'),auth['isAuthenticated'](),controller[_0xc91b('0x13')]);router['post']('/:id/actions',auth[_0xc91b('0x8')](),controller[_0xc91b('0x14')]);router[_0xc91b('0x15')](_0xc91b('0x16'),auth['isAuthenticated'](),controller[_0xc91b('0x17')]);router[_0xc91b('0x18')]('/:id',auth[_0xc91b('0x8')](),controller[_0xc91b('0x19')]);module[_0xc91b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d77094f..0c96993 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 _0x57e4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3d671b,_0x23fa83){var _0x557125=function(_0x52b8a4){while(--_0x52b8a4){_0x3d671b['push'](_0x3d671b['shift']());}};_0x557125(++_0x23fa83);}(_0x57e4,0x1eb));var _0x457e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57e4[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x457e('0x0'));module[_0x457e('0x1')]={'name':{'type':Sequelize[_0x457e('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x457e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xad84=['exports','STRING','sequelize'];(function(_0x5f2f0b,_0x5cceb8){var _0x2e3087=function(_0x2f9fb6){while(--_0x2f9fb6){_0x5f2f0b['push'](_0x5f2f0b['shift']());}};_0x2e3087(++_0x5cceb8);}(_0xad84,0x164));var _0x4ad8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xad84[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x4ad8('0x0'));module[_0x4ad8('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4ad8('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 a3d901f..b956a87 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 _0xdaa2=['options','nolimit','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','limit','offset','order','where','pick','filter','merge','includeAll','findAll','rows','show','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','sort'];(function(_0x1dda20,_0x7ba2a1){var _0x2159d5=function(_0x1e9bb7){while(--_0x1e9bb7){_0x1dda20['push'](_0x1dda20['shift']());}};_0x2159d5(++_0x7ba2a1);}(_0xdaa2,0x12e));var _0x2daa=function(_0x206012,_0xef6eb6){_0x206012=_0x206012-0x0;var _0x3fce45=_0xdaa2[_0x206012];return _0x3fce45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2daa('0x0'));var jsonpatch=require(_0x2daa('0x1'));var rp=require(_0x2daa('0x2'));var moment=require(_0x2daa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2daa('0x4'));var util=require(_0x2daa('0x5'));var path=require('path');var sox=require(_0x2daa('0x6'));var csv=require('to-csv');var ejs=require(_0x2daa('0x7'));var fs=require('fs');var fs_extra=require(_0x2daa('0x8'));var _=require(_0x2daa('0x9'));var squel=require(_0x2daa('0xa'));var crypto=require(_0x2daa('0xb'));var jsforce=require(_0x2daa('0xc'));var deskjs=require(_0x2daa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2daa('0xe'));var Papa=require(_0x2daa('0xf'));var Redis=require(_0x2daa('0x10'));var authService=require(_0x2daa('0x11'));var qs=require(_0x2daa('0x12'));var as=require(_0x2daa('0x13'));var hardwareService=require(_0x2daa('0x14'));var logger=require(_0x2daa('0x15'))(_0x2daa('0x16'));var utils=require(_0x2daa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2daa('0x18'));var db=require(_0x2daa('0x19'))['db'];function respondWithStatusCode(_0x6b0ce7,_0x26f82a){_0x26f82a=_0x26f82a||0xcc;return function(_0x6635b4){if(_0x6635b4){return _0x6b0ce7[_0x2daa('0x1a')](_0x26f82a);}return _0x6b0ce7[_0x2daa('0x1b')](_0x26f82a)[_0x2daa('0x1c')]();};}function respondWithResult(_0x5518ba,_0x4adaa7){_0x4adaa7=_0x4adaa7||0xc8;return function(_0x3e8871){if(_0x3e8871){return _0x5518ba['status'](_0x4adaa7)['json'](_0x3e8871);}};}function respondWithFilteredResult(_0x1ebfb9,_0x178c53){return function(_0x2c685e){if(_0x2c685e){var _0x25fb1c=typeof _0x178c53['offset']===_0x2daa('0x1d')&&typeof _0x178c53['limit']==='undefined';var _0x49d362=_0x2c685e[_0x2daa('0x1e')];var _0xe53b89=_0x25fb1c?0x0:_0x178c53['offset'];var _0x21b433=_0x25fb1c?_0x2c685e[_0x2daa('0x1e')]:_0x178c53['offset']+_0x178c53['limit'];var _0x50b781;if(_0x21b433>=_0x49d362){_0x21b433=_0x49d362;_0x50b781=0xc8;}else{_0x50b781=0xce;}_0x1ebfb9[_0x2daa('0x1b')](_0x50b781);return _0x1ebfb9[_0x2daa('0x1f')](_0x2daa('0x20'),_0xe53b89+'-'+_0x21b433+'/'+_0x49d362)['json'](_0x2c685e);}return null;};}function patchUpdates(_0xe88d40){return function(_0x15ab36){try{jsonpatch[_0x2daa('0x21')](_0x15ab36,_0xe88d40,!![]);}catch(_0x26a693){return BPromise[_0x2daa('0x22')](_0x26a693);}return _0x15ab36[_0x2daa('0x23')]();};}function saveUpdates(_0x1caa47,_0x200a50){return function(_0x53a1da){if(_0x53a1da){return _0x53a1da[_0x2daa('0x24')](_0x1caa47)[_0x2daa('0x25')](function(_0x5acb57){return _0x5acb57;});}return null;};}function removeEntity(_0x2e615f,_0x244ea8){return function(_0x2f6baa){if(_0x2f6baa){return _0x2f6baa[_0x2daa('0x26')]()[_0x2daa('0x25')](function(){var _0x31d343=_0x2f6baa['get']({'plain':!![]});var _0x35e1f8=_0x2daa('0x27');return db[_0x2daa('0x28')][_0x2daa('0x26')]({'where':{'type':_0x35e1f8,'resourceId':_0x31d343['id']}})[_0x2daa('0x25')](function(){return _0x2f6baa;});})[_0x2daa('0x25')](function(){_0x2e615f[_0x2daa('0x1b')](0xcc)[_0x2daa('0x1c')]();});}};}function handleEntityNotFound(_0x55b74a,_0x17ac8e){return function(_0x1d6e5c){if(!_0x1d6e5c){_0x55b74a[_0x2daa('0x1a')](0x194);}return _0x1d6e5c;};}function handleError(_0x2f37cc,_0x5a2faa){_0x5a2faa=_0x5a2faa||0x1f4;return function(_0x9cac07){logger[_0x2daa('0x29')](_0x9cac07[_0x2daa('0x2a')]);if(_0x9cac07[_0x2daa('0x2b')]){delete _0x9cac07['name'];}_0x2f37cc[_0x2daa('0x1b')](_0x5a2faa)[_0x2daa('0x2c')](_0x9cac07);};}exports[_0x2daa('0x2d')]=function(_0x1790fe,_0x2358c3){var _0xc9d194={},_0x4dc449={},_0xde1c88={'count':0x0,'rows':[]};var _0x4829a2=_[_0x2daa('0x2e')](db[_0x2daa('0x2f')][_0x2daa('0x30')],function(_0x4ea5f3){return{'name':_0x4ea5f3[_0x2daa('0x31')],'type':_0x4ea5f3[_0x2daa('0x32')][_0x2daa('0x33')]};});_0x4dc449[_0x2daa('0x34')]=_[_0x2daa('0x2e')](_0x4829a2,_0x2daa('0x2b'));_0x4dc449['query']=_[_0x2daa('0x35')](_0x1790fe['query']);_0x4dc449[_0x2daa('0x36')]=_[_0x2daa('0x37')](_0x4dc449['model'],_0x4dc449[_0x2daa('0x38')]);_0xc9d194['attributes']=_[_0x2daa('0x37')](_0x4dc449[_0x2daa('0x34')],qs[_0x2daa('0x39')](_0x1790fe['query']['fields']));_0xc9d194[_0x2daa('0x3a')]=_0xc9d194['attributes'][_0x2daa('0x3b')]?_0xc9d194[_0x2daa('0x3a')]:_0x4dc449[_0x2daa('0x34')];if(!_0x1790fe[_0x2daa('0x38')]['hasOwnProperty']('nolimit')){_0xc9d194[_0x2daa('0x3c')]=qs[_0x2daa('0x3c')](_0x1790fe[_0x2daa('0x38')]['limit']);_0xc9d194['offset']=qs[_0x2daa('0x3d')](_0x1790fe['query'][_0x2daa('0x3d')]);}_0xc9d194[_0x2daa('0x3e')]=qs['sort'](_0x1790fe[_0x2daa('0x38')]['sort']);_0xc9d194[_0x2daa('0x3f')]=qs[_0x2daa('0x36')](_[_0x2daa('0x40')](_0x1790fe['query'],_0x4dc449[_0x2daa('0x36')]),_0x4829a2);if(_0x1790fe[_0x2daa('0x38')][_0x2daa('0x41')]){_0xc9d194[_0x2daa('0x3f')]=_[_0x2daa('0x42')](_0xc9d194[_0x2daa('0x3f')],{'$or':_['map'](_0x4829a2,function(_0xfc3255){if(_0xfc3255['type']!=='VIRTUAL'){var _0x1c3d0c={};_0x1c3d0c[_0xfc3255[_0x2daa('0x2b')]]={'$like':'%'+_0x1790fe[_0x2daa('0x38')]['filter']+'%'};return _0x1c3d0c;}})});}_0xc9d194=_['merge']({},_0xc9d194,_0x1790fe['options']);var _0x4bf57a={'where':_0xc9d194[_0x2daa('0x3f')]};return db[_0x2daa('0x2f')][_0x2daa('0x1e')](_0x4bf57a)['then'](function(_0xc79768){_0xde1c88[_0x2daa('0x1e')]=_0xc79768;if(_0x1790fe[_0x2daa('0x38')][_0x2daa('0x43')]){_0xc9d194['include']=[{'all':!![]}];}return db[_0x2daa('0x2f')][_0x2daa('0x44')](_0xc9d194);})[_0x2daa('0x25')](function(_0x5f22c7){_0xde1c88[_0x2daa('0x45')]=_0x5f22c7;return _0xde1c88;})[_0x2daa('0x25')](respondWithFilteredResult(_0x2358c3,_0xc9d194))['catch'](handleError(_0x2358c3,null));};exports[_0x2daa('0x46')]=function(_0x2c84c2,_0x394f70){var _0x1c686c={'raw':![],'where':{'id':_0x2c84c2['params']['id']}},_0x1412da={};_0x1412da[_0x2daa('0x34')]=_['keys'](db[_0x2daa('0x2f')][_0x2daa('0x30')]);_0x1412da[_0x2daa('0x38')]=_[_0x2daa('0x35')](_0x2c84c2['query']);_0x1412da['filters']=_['intersection'](_0x1412da[_0x2daa('0x34')],_0x1412da['query']);_0x1c686c[_0x2daa('0x3a')]=_[_0x2daa('0x37')](_0x1412da[_0x2daa('0x34')],qs[_0x2daa('0x39')](_0x2c84c2[_0x2daa('0x38')][_0x2daa('0x39')]));_0x1c686c[_0x2daa('0x3a')]=_0x1c686c[_0x2daa('0x3a')][_0x2daa('0x3b')]?_0x1c686c['attributes']:_0x1412da['model'];if(_0x2c84c2[_0x2daa('0x38')]['includeAll']){_0x1c686c[_0x2daa('0x47')]=[{'all':!![]}];}_0x1c686c=_['merge']({},_0x1c686c,_0x2c84c2['options']);return db[_0x2daa('0x2f')][_0x2daa('0x48')](_0x1c686c)[_0x2daa('0x25')](handleEntityNotFound(_0x394f70,null))[_0x2daa('0x25')](respondWithResult(_0x394f70,null))[_0x2daa('0x49')](handleError(_0x394f70,null));};exports[_0x2daa('0x4a')]=function(_0x5897e9,_0x3c4d99){return db['Trigger'][_0x2daa('0x4a')](_0x5897e9[_0x2daa('0x4b')],{})[_0x2daa('0x25')](function(_0x4ea23c){var _0x434ca5=_0x5897e9[_0x2daa('0x4c')][_0x2daa('0x4d')]({'plain':!![]});if(!_0x434ca5)throw new Error(_0x2daa('0x4e'));if(_0x434ca5[_0x2daa('0x4f')]===_0x2daa('0x4c')){var _0x34485b=_0x4ea23c[_0x2daa('0x4d')]({'plain':!![]});var _0x48d983=_0x2daa('0x27');return db[_0x2daa('0x50')][_0x2daa('0x48')]({'where':{'name':_0x48d983,'userProfileId':_0x434ca5['userProfileId']},'raw':!![]})['then'](function(_0x3875e2){if(_0x3875e2&&_0x3875e2['autoAssociation']===0x0){return db[_0x2daa('0x28')][_0x2daa('0x4a')]({'name':_0x34485b[_0x2daa('0x2b')],'resourceId':_0x34485b['id'],'type':_0x3875e2[_0x2daa('0x2b')],'sectionId':_0x3875e2['id']},{})[_0x2daa('0x25')](function(){return _0x4ea23c;});}else{return _0x4ea23c;}})['catch'](function(_0x18a6d7){logger['error'](_0x2daa('0x51'),_0x18a6d7);throw _0x18a6d7;});}return _0x4ea23c;})['then'](respondWithResult(_0x3c4d99,0xc9))[_0x2daa('0x49')](handleError(_0x3c4d99,null));};exports[_0x2daa('0x24')]=function(_0x4b1f72,_0x4eb71e){if(_0x4b1f72['body']['id']){delete _0x4b1f72[_0x2daa('0x4b')]['id'];}return db['Trigger'][_0x2daa('0x48')]({'where':{'id':_0x4b1f72[_0x2daa('0x52')]['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x4eb71e,null))[_0x2daa('0x25')](saveUpdates(_0x4b1f72[_0x2daa('0x4b')],null))[_0x2daa('0x25')](respondWithResult(_0x4eb71e,null))['catch'](handleError(_0x4eb71e,null));};exports['destroy']=function(_0x2ac7da,_0x380400){return db[_0x2daa('0x2f')][_0x2daa('0x48')]({'where':{'id':_0x2ac7da[_0x2daa('0x52')]['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x380400,null))[_0x2daa('0x25')](removeEntity(_0x380400,null))[_0x2daa('0x49')](handleError(_0x380400,null));};exports['addAllCondition']=function(_0x1938df,_0x2ee760,_0x1dbb0){if(_0x1938df[_0x2daa('0x4b')]['id']){delete _0x1938df['body']['id'];}return db['Trigger'][_0x2daa('0x48')]({'where':{'id':_0x1938df[_0x2daa('0x52')]['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x2ee760,null))['then'](function(_0x12d045){if(_0x12d045){_0x1938df[_0x2daa('0x4b')][_0x2daa('0x53')]=_0x12d045['id'];return db[_0x2daa('0x54')]['create'](_0x1938df['body']);}})['then'](respondWithResult(_0x2ee760,null))['catch'](handleError(_0x2ee760,null));};exports[_0x2daa('0x55')]=function(_0x59ddde,_0x47be3c,_0x488bd9){if(_0x59ddde[_0x2daa('0x4b')]['id']){delete _0x59ddde[_0x2daa('0x4b')]['id'];}return db[_0x2daa('0x2f')]['find']({'where':{'id':_0x59ddde[_0x2daa('0x52')]['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x47be3c,null))['then'](function(_0x133dfa){if(_0x133dfa){_0x59ddde[_0x2daa('0x4b')][_0x2daa('0x56')]=_0x133dfa['id'];return db[_0x2daa('0x54')][_0x2daa('0x4a')](_0x59ddde[_0x2daa('0x4b')]);}})[_0x2daa('0x25')](respondWithResult(_0x47be3c,null))[_0x2daa('0x49')](handleError(_0x47be3c,null));};exports[_0x2daa('0x57')]=function(_0x40c44a,_0x3d542e,_0x409360){var _0x48b67c={};var _0x3bce95={};var _0x3503fd;var _0x443b83;return db[_0x2daa('0x2f')][_0x2daa('0x58')]({'where':{'id':_0x40c44a[_0x2daa('0x52')]['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x3d542e,null))[_0x2daa('0x25')](function(_0x4c3dc4){if(_0x4c3dc4){_0x3503fd=_0x4c3dc4;_0x3bce95[_0x2daa('0x34')]=_[_0x2daa('0x35')](db[_0x2daa('0x54')][_0x2daa('0x30')]);_0x3bce95['query']=_[_0x2daa('0x35')](_0x40c44a['query']);_0x3bce95[_0x2daa('0x36')]=_['intersection'](_0x3bce95[_0x2daa('0x34')],_0x3bce95[_0x2daa('0x38')]);_0x48b67c[_0x2daa('0x3a')]=_[_0x2daa('0x37')](_0x3bce95[_0x2daa('0x34')],qs['fields'](_0x40c44a['query'][_0x2daa('0x39')]));_0x48b67c[_0x2daa('0x3a')]=_0x48b67c[_0x2daa('0x3a')][_0x2daa('0x3b')]?_0x48b67c['attributes']:_0x3bce95[_0x2daa('0x34')];_0x48b67c[_0x2daa('0x3e')]=qs['sort'](_0x40c44a['query'][_0x2daa('0x59')]);_0x48b67c[_0x2daa('0x3f')]=qs[_0x2daa('0x36')](_[_0x2daa('0x40')](_0x40c44a[_0x2daa('0x38')],_0x3bce95[_0x2daa('0x36')]));if(_0x40c44a['query']['filter']){_0x48b67c['where']=_[_0x2daa('0x42')](_0x48b67c[_0x2daa('0x3f')],{'$or':_[_0x2daa('0x2e')](_0x48b67c['attributes'],function(_0x44ab01){var _0x3187e1={};_0x3187e1[_0x44ab01]={'$like':'%'+_0x40c44a['query']['filter']+'%'};return _0x3187e1;})});}_0x48b67c=_[_0x2daa('0x42')]({},_0x48b67c,_0x40c44a[_0x2daa('0x5a')]);return _0x3503fd[_0x2daa('0x57')](_0x48b67c);}})[_0x2daa('0x25')](function(_0x245f56){if(_0x245f56){_0x443b83=_0x245f56[_0x2daa('0x3b')];if(!_0x40c44a[_0x2daa('0x38')]['hasOwnProperty'](_0x2daa('0x5b'))){_0x48b67c[_0x2daa('0x3c')]=qs[_0x2daa('0x3c')](_0x40c44a['query'][_0x2daa('0x3c')]);_0x48b67c[_0x2daa('0x3d')]=qs[_0x2daa('0x3d')](_0x40c44a['query'][_0x2daa('0x3d')]);}return _0x3503fd[_0x2daa('0x57')](_0x48b67c);}})[_0x2daa('0x25')](function(_0x51c6ee){if(_0x51c6ee){return _0x51c6ee?{'count':_0x443b83,'rows':_0x51c6ee}:null;}})['then'](respondWithResult(_0x3d542e,null))['catch'](handleError(_0x3d542e,null));};exports[_0x2daa('0x5c')]=function(_0x1d533c,_0x58da16,_0x45a2b6){var _0x3a87f5={};var _0x343869={};var _0xb145f3;var _0x2a9838;return db[_0x2daa('0x2f')][_0x2daa('0x58')]({'where':{'id':_0x1d533c[_0x2daa('0x52')]['id']}})['then'](handleEntityNotFound(_0x58da16,null))[_0x2daa('0x25')](function(_0x1fb27c){if(_0x1fb27c){_0xb145f3=_0x1fb27c;_0x343869[_0x2daa('0x34')]=_[_0x2daa('0x35')](db[_0x2daa('0x54')][_0x2daa('0x30')]);_0x343869['query']=_[_0x2daa('0x35')](_0x1d533c[_0x2daa('0x38')]);_0x343869[_0x2daa('0x36')]=_[_0x2daa('0x37')](_0x343869[_0x2daa('0x34')],_0x343869['query']);_0x3a87f5['attributes']=_[_0x2daa('0x37')](_0x343869[_0x2daa('0x34')],qs[_0x2daa('0x39')](_0x1d533c[_0x2daa('0x38')]['fields']));_0x3a87f5[_0x2daa('0x3a')]=_0x3a87f5[_0x2daa('0x3a')][_0x2daa('0x3b')]?_0x3a87f5[_0x2daa('0x3a')]:_0x343869[_0x2daa('0x34')];_0x3a87f5[_0x2daa('0x3e')]=qs[_0x2daa('0x59')](_0x1d533c['query'][_0x2daa('0x59')]);_0x3a87f5[_0x2daa('0x3f')]=qs[_0x2daa('0x36')](_[_0x2daa('0x40')](_0x1d533c[_0x2daa('0x38')],_0x343869[_0x2daa('0x36')]));if(_0x1d533c[_0x2daa('0x38')][_0x2daa('0x41')]){_0x3a87f5[_0x2daa('0x3f')]=_['merge'](_0x3a87f5['where'],{'$or':_[_0x2daa('0x2e')](_0x3a87f5['attributes'],function(_0x49ebbd){var _0x46a098={};_0x46a098[_0x49ebbd]={'$like':'%'+_0x1d533c['query'][_0x2daa('0x41')]+'%'};return _0x46a098;})});}_0x3a87f5=_[_0x2daa('0x42')]({},_0x3a87f5,_0x1d533c[_0x2daa('0x5a')]);return _0xb145f3[_0x2daa('0x5c')](_0x3a87f5);}})[_0x2daa('0x25')](function(_0x1fb8b5){if(_0x1fb8b5){_0x2a9838=_0x1fb8b5[_0x2daa('0x3b')];if(!_0x1d533c['query'][_0x2daa('0x5d')]('nolimit')){_0x3a87f5[_0x2daa('0x3c')]=qs[_0x2daa('0x3c')](_0x1d533c['query'][_0x2daa('0x3c')]);_0x3a87f5['offset']=qs[_0x2daa('0x3d')](_0x1d533c['query']['offset']);}return _0xb145f3[_0x2daa('0x5c')](_0x3a87f5);}})['then'](function(_0x161025){if(_0x161025){return _0x161025?{'count':_0x2a9838,'rows':_0x161025}:null;}})[_0x2daa('0x25')](respondWithResult(_0x58da16,null))[_0x2daa('0x49')](handleError(_0x58da16,null));};exports[_0x2daa('0x5e')]=function(_0x452092,_0x28e0d9,_0x22fb17){if(_0x452092[_0x2daa('0x4b')]['id']){delete _0x452092[_0x2daa('0x4b')]['id'];}return db[_0x2daa('0x2f')]['find']({'where':{'id':_0x452092['params']['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x28e0d9,null))[_0x2daa('0x25')](function(_0x219894){if(_0x219894){_0x452092[_0x2daa('0x4b')][_0x2daa('0x5f')]=_0x219894['id'];return db[_0x2daa('0x60')][_0x2daa('0x4a')](_0x452092['body']);}})[_0x2daa('0x25')](respondWithResult(_0x28e0d9,null))[_0x2daa('0x49')](handleError(_0x28e0d9,null));};exports[_0x2daa('0x61')]=function(_0x205d2e,_0x1343c1,_0x44621e){var _0x1ac4df={};var _0xa98233={};var _0x5bc812;var _0x47f692;return db[_0x2daa('0x2f')][_0x2daa('0x58')]({'where':{'id':_0x205d2e['params']['id']}})[_0x2daa('0x25')](handleEntityNotFound(_0x1343c1,null))[_0x2daa('0x25')](function(_0x2c4afa){if(_0x2c4afa){_0x5bc812=_0x2c4afa;_0xa98233[_0x2daa('0x34')]=_[_0x2daa('0x35')](db[_0x2daa('0x60')][_0x2daa('0x30')]);_0xa98233['query']=_[_0x2daa('0x35')](_0x205d2e[_0x2daa('0x38')]);_0xa98233['filters']=_['intersection'](_0xa98233[_0x2daa('0x34')],_0xa98233[_0x2daa('0x38')]);_0x1ac4df[_0x2daa('0x3a')]=_['intersection'](_0xa98233['model'],qs[_0x2daa('0x39')](_0x205d2e[_0x2daa('0x38')][_0x2daa('0x39')]));_0x1ac4df[_0x2daa('0x3a')]=_0x1ac4df[_0x2daa('0x3a')][_0x2daa('0x3b')]?_0x1ac4df['attributes']:_0xa98233[_0x2daa('0x34')];_0x1ac4df[_0x2daa('0x3e')]=qs['sort'](_0x205d2e[_0x2daa('0x38')]['sort']);_0x1ac4df[_0x2daa('0x3f')]=qs[_0x2daa('0x36')](_[_0x2daa('0x40')](_0x205d2e['query'],_0xa98233[_0x2daa('0x36')]));if(_0x205d2e[_0x2daa('0x38')][_0x2daa('0x41')]){_0x1ac4df[_0x2daa('0x3f')]=_[_0x2daa('0x42')](_0x1ac4df[_0x2daa('0x3f')],{'$or':_['map'](_0x1ac4df[_0x2daa('0x3a')],function(_0x113e91){var _0x3f1b1b={};_0x3f1b1b[_0x113e91]={'$like':'%'+_0x205d2e['query']['filter']+'%'};return _0x3f1b1b;})});}_0x1ac4df=_['merge']({},_0x1ac4df,_0x205d2e[_0x2daa('0x5a')]);return _0x5bc812[_0x2daa('0x61')](_0x1ac4df);}})['then'](function(_0x2ce09e){if(_0x2ce09e){_0x47f692=_0x2ce09e[_0x2daa('0x3b')];if(!_0x205d2e[_0x2daa('0x38')][_0x2daa('0x5d')](_0x2daa('0x5b'))){_0x1ac4df[_0x2daa('0x3c')]=qs[_0x2daa('0x3c')](_0x205d2e['query'][_0x2daa('0x3c')]);_0x1ac4df[_0x2daa('0x3d')]=qs[_0x2daa('0x3d')](_0x205d2e['query']['offset']);}return _0x5bc812[_0x2daa('0x61')](_0x1ac4df);}})[_0x2daa('0x25')](function(_0x1031ff){if(_0x1031ff){return _0x1031ff?{'count':_0x47f692,'rows':_0x1031ff}:null;}})['then'](respondWithResult(_0x1343c1,null))['catch'](handleError(_0x1343c1,null));}; \ No newline at end of file +var _0xdb76=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','Triggers','UserProfileResource','name','index','map','rawAttributes','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Trigger','include','findAll','rows','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','error','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1d6746,_0xaccce7){var _0x18239e=function(_0x2ff661){while(--_0x2ff661){_0x1d6746['push'](_0x1d6746['shift']());}};_0x18239e(++_0xaccce7);}(_0xdb76,0xa8));var _0x6db7=function(_0x235ae0,_0x450404){_0x235ae0=_0x235ae0-0x0;var _0x29db32=_0xdb76[_0x235ae0];return _0x29db32;};'use strict';var emlformat=require(_0x6db7('0x0'));var rimraf=require(_0x6db7('0x1'));var zipdir=require(_0x6db7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db7('0x3'));var moment=require(_0x6db7('0x4'));var BPromise=require(_0x6db7('0x5'));var Mustache=require('mustache');var util=require(_0x6db7('0x6'));var path=require(_0x6db7('0x7'));var sox=require(_0x6db7('0x8'));var csv=require(_0x6db7('0x9'));var ejs=require(_0x6db7('0xa'));var fs=require('fs');var fs_extra=require(_0x6db7('0xb'));var _=require(_0x6db7('0xc'));var squel=require('squel');var crypto=require(_0x6db7('0xd'));var jsforce=require(_0x6db7('0xe'));var deskjs=require(_0x6db7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6db7('0x10'));var Papa=require(_0x6db7('0x11'));var Redis=require(_0x6db7('0x12'));var authService=require(_0x6db7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6db7('0x14'))(_0x6db7('0x15'));var utils=require(_0x6db7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6db7('0x17'));var db=require(_0x6db7('0x18'))['db'];function respondWithStatusCode(_0xbe1d7f,_0x57891f){_0x57891f=_0x57891f||0xcc;return function(_0x1ef869){if(_0x1ef869){return _0xbe1d7f[_0x6db7('0x19')](_0x57891f);}return _0xbe1d7f[_0x6db7('0x1a')](_0x57891f)[_0x6db7('0x1b')]();};}function respondWithResult(_0xe40e8d,_0x4d4ce7){_0x4d4ce7=_0x4d4ce7||0xc8;return function(_0x4360ba){if(_0x4360ba){return _0xe40e8d[_0x6db7('0x1a')](_0x4d4ce7)['json'](_0x4360ba);}};}function respondWithFilteredResult(_0x350c8a,_0x5e5998){return function(_0x1e087e){if(_0x1e087e){var _0x277105=typeof _0x5e5998[_0x6db7('0x1c')]===_0x6db7('0x1d')&&typeof _0x5e5998[_0x6db7('0x1e')]===_0x6db7('0x1d');var _0x89d7b4=_0x1e087e[_0x6db7('0x1f')];var _0x2a3f63=_0x277105?0x0:_0x5e5998[_0x6db7('0x1c')];var _0x2e4981=_0x277105?_0x1e087e[_0x6db7('0x1f')]:_0x5e5998[_0x6db7('0x1c')]+_0x5e5998['limit'];var _0x44d458;if(_0x2e4981>=_0x89d7b4){_0x2e4981=_0x89d7b4;_0x44d458=0xc8;}else{_0x44d458=0xce;}_0x350c8a[_0x6db7('0x1a')](_0x44d458);return _0x350c8a[_0x6db7('0x20')](_0x6db7('0x21'),_0x2a3f63+'-'+_0x2e4981+'/'+_0x89d7b4)[_0x6db7('0x22')](_0x1e087e);}return null;};}function patchUpdates(_0x2592d8){return function(_0x34ee4d){try{jsonpatch['apply'](_0x34ee4d,_0x2592d8,!![]);}catch(_0x4d0696){return BPromise[_0x6db7('0x23')](_0x4d0696);}return _0x34ee4d['save']();};}function saveUpdates(_0x26b237,_0x3c5cbc){return function(_0x361e1e){if(_0x361e1e){return _0x361e1e[_0x6db7('0x24')](_0x26b237)[_0x6db7('0x25')](function(_0xcb0923){return _0xcb0923;});}return null;};}function removeEntity(_0x343b1e,_0x3c2b3a){return function(_0x48c8be){if(_0x48c8be){return _0x48c8be['destroy']()['then'](function(){var _0x591bdf=_0x48c8be[_0x6db7('0x26')]({'plain':!![]});var _0x2c9adc=_0x6db7('0x27');return db[_0x6db7('0x28')]['destroy']({'where':{'type':_0x2c9adc,'resourceId':_0x591bdf['id']}})[_0x6db7('0x25')](function(){return _0x48c8be;});})[_0x6db7('0x25')](function(){_0x343b1e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a19e,_0x914082){return function(_0x3a18a7){if(!_0x3a18a7){_0x17a19e[_0x6db7('0x19')](0x194);}return _0x3a18a7;};}function handleError(_0x16da7b,_0x3b4710){_0x3b4710=_0x3b4710||0x1f4;return function(_0x214bef){logger['error'](_0x214bef['stack']);if(_0x214bef[_0x6db7('0x29')]){delete _0x214bef[_0x6db7('0x29')];}_0x16da7b['status'](_0x3b4710)['send'](_0x214bef);};}exports[_0x6db7('0x2a')]=function(_0x16f54d,_0x2cb358){var _0x590bda={},_0x392c36={},_0x2ad2f4={'count':0x0,'rows':[]};var _0x62285=_[_0x6db7('0x2b')](db['Trigger'][_0x6db7('0x2c')],function(_0x29dce6){return{'name':_0x29dce6['fieldName'],'type':_0x29dce6['type'][_0x6db7('0x2d')]};});_0x392c36['model']=_[_0x6db7('0x2b')](_0x62285,'name');_0x392c36[_0x6db7('0x2e')]=_['keys'](_0x16f54d['query']);_0x392c36[_0x6db7('0x2f')]=_['intersection'](_0x392c36[_0x6db7('0x30')],_0x392c36['query']);_0x590bda[_0x6db7('0x31')]=_[_0x6db7('0x32')](_0x392c36[_0x6db7('0x30')],qs[_0x6db7('0x33')](_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x33')]));_0x590bda['attributes']=_0x590bda['attributes'][_0x6db7('0x34')]?_0x590bda[_0x6db7('0x31')]:_0x392c36[_0x6db7('0x30')];if(!_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x35')](_0x6db7('0x36'))){_0x590bda['limit']=qs[_0x6db7('0x1e')](_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x590bda[_0x6db7('0x1c')]=qs['offset'](_0x16f54d['query']['offset']);}_0x590bda[_0x6db7('0x37')]=qs[_0x6db7('0x38')](_0x16f54d['query']['sort']);_0x590bda[_0x6db7('0x39')]=qs[_0x6db7('0x2f')](_[_0x6db7('0x3a')](_0x16f54d[_0x6db7('0x2e')],_0x392c36[_0x6db7('0x2f')]),_0x62285);if(_0x16f54d[_0x6db7('0x2e')]['filter']){_0x590bda[_0x6db7('0x39')]=_[_0x6db7('0x3b')](_0x590bda[_0x6db7('0x39')],{'$or':_['map'](_0x62285,function(_0x273c18){if(_0x273c18[_0x6db7('0x3c')]!==_0x6db7('0x3d')){var _0x44b748={};_0x44b748[_0x273c18[_0x6db7('0x29')]]={'$like':'%'+_0x16f54d[_0x6db7('0x2e')][_0x6db7('0x3e')]+'%'};return _0x44b748;}})});}_0x590bda=_[_0x6db7('0x3b')]({},_0x590bda,_0x16f54d[_0x6db7('0x3f')]);var _0x35c560={'where':_0x590bda['where']};return db[_0x6db7('0x40')][_0x6db7('0x1f')](_0x35c560)['then'](function(_0xf697ef){_0x2ad2f4[_0x6db7('0x1f')]=_0xf697ef;if(_0x16f54d[_0x6db7('0x2e')]['includeAll']){_0x590bda[_0x6db7('0x41')]=[{'all':!![]}];}return db['Trigger'][_0x6db7('0x42')](_0x590bda);})[_0x6db7('0x25')](function(_0x4e97d8){_0x2ad2f4[_0x6db7('0x43')]=_0x4e97d8;return _0x2ad2f4;})[_0x6db7('0x25')](respondWithFilteredResult(_0x2cb358,_0x590bda))[_0x6db7('0x44')](handleError(_0x2cb358,null));};exports['show']=function(_0x331ea9,_0x135692){var _0x3dd33d={'raw':![],'where':{'id':_0x331ea9[_0x6db7('0x45')]['id']}},_0x2cfd06={};_0x2cfd06[_0x6db7('0x30')]=_[_0x6db7('0x46')](db['Trigger'][_0x6db7('0x2c')]);_0x2cfd06[_0x6db7('0x2e')]=_['keys'](_0x331ea9['query']);_0x2cfd06[_0x6db7('0x2f')]=_[_0x6db7('0x32')](_0x2cfd06[_0x6db7('0x30')],_0x2cfd06[_0x6db7('0x2e')]);_0x3dd33d['attributes']=_['intersection'](_0x2cfd06[_0x6db7('0x30')],qs['fields'](_0x331ea9['query'][_0x6db7('0x33')]));_0x3dd33d['attributes']=_0x3dd33d[_0x6db7('0x31')]['length']?_0x3dd33d['attributes']:_0x2cfd06['model'];if(_0x331ea9[_0x6db7('0x2e')][_0x6db7('0x47')]){_0x3dd33d[_0x6db7('0x41')]=[{'all':!![]}];}_0x3dd33d=_['merge']({},_0x3dd33d,_0x331ea9[_0x6db7('0x3f')]);return db[_0x6db7('0x40')]['find'](_0x3dd33d)[_0x6db7('0x25')](handleEntityNotFound(_0x135692,null))[_0x6db7('0x25')](respondWithResult(_0x135692,null))[_0x6db7('0x44')](handleError(_0x135692,null));};exports['create']=function(_0x20edb6,_0x189bdb){return db[_0x6db7('0x40')][_0x6db7('0x48')](_0x20edb6[_0x6db7('0x49')],{})[_0x6db7('0x25')](function(_0xfff5fd){var _0x2be6dc=_0x20edb6[_0x6db7('0x4a')]['get']({'plain':!![]});if(!_0x2be6dc)throw new Error(_0x6db7('0x4b'));if(_0x2be6dc['role']===_0x6db7('0x4a')){var _0x220053=_0xfff5fd[_0x6db7('0x26')]({'plain':!![]});var _0x15e088=_0x6db7('0x27');return db['UserProfileSection'][_0x6db7('0x4c')]({'where':{'name':_0x15e088,'userProfileId':_0x2be6dc[_0x6db7('0x4d')]},'raw':!![]})[_0x6db7('0x25')](function(_0x4f89ea){if(_0x4f89ea&&_0x4f89ea[_0x6db7('0x4e')]===0x0){return db[_0x6db7('0x28')][_0x6db7('0x48')]({'name':_0x220053['name'],'resourceId':_0x220053['id'],'type':_0x4f89ea['name'],'sectionId':_0x4f89ea['id']},{})[_0x6db7('0x25')](function(){return _0xfff5fd;});}else{return _0xfff5fd;}})[_0x6db7('0x44')](function(_0x188680){logger[_0x6db7('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x188680);throw _0x188680;});}return _0xfff5fd;})['then'](respondWithResult(_0x189bdb,0xc9))[_0x6db7('0x44')](handleError(_0x189bdb,null));};exports[_0x6db7('0x24')]=function(_0x534aba,_0x1215a2){if(_0x534aba[_0x6db7('0x49')]['id']){delete _0x534aba[_0x6db7('0x49')]['id'];}return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x534aba[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x1215a2,null))[_0x6db7('0x25')](saveUpdates(_0x534aba[_0x6db7('0x49')],null))[_0x6db7('0x25')](respondWithResult(_0x1215a2,null))[_0x6db7('0x44')](handleError(_0x1215a2,null));};exports[_0x6db7('0x50')]=function(_0x5e1154,_0x21a11e){return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x5e1154[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x21a11e,null))['then'](removeEntity(_0x21a11e,null))[_0x6db7('0x44')](handleError(_0x21a11e,null));};exports[_0x6db7('0x51')]=function(_0x47c33a,_0x4a674b,_0x59ca63){if(_0x47c33a[_0x6db7('0x49')]['id']){delete _0x47c33a[_0x6db7('0x49')]['id'];}return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x47c33a['params']['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x4a674b,null))[_0x6db7('0x25')](function(_0x27090e){if(_0x27090e){_0x47c33a[_0x6db7('0x49')][_0x6db7('0x52')]=_0x27090e['id'];return db[_0x6db7('0x53')][_0x6db7('0x48')](_0x47c33a['body']);}})['then'](respondWithResult(_0x4a674b,null))[_0x6db7('0x44')](handleError(_0x4a674b,null));};exports[_0x6db7('0x54')]=function(_0x35deb0,_0xb4b435,_0x2ee20c){if(_0x35deb0[_0x6db7('0x49')]['id']){delete _0x35deb0['body']['id'];}return db[_0x6db7('0x40')][_0x6db7('0x4c')]({'where':{'id':_0x35deb0['params']['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0xb4b435,null))[_0x6db7('0x25')](function(_0x18aa52){if(_0x18aa52){_0x35deb0[_0x6db7('0x49')]['TriggerAnyId']=_0x18aa52['id'];return db[_0x6db7('0x53')][_0x6db7('0x48')](_0x35deb0[_0x6db7('0x49')]);}})[_0x6db7('0x25')](respondWithResult(_0xb4b435,null))[_0x6db7('0x44')](handleError(_0xb4b435,null));};exports[_0x6db7('0x55')]=function(_0x21e635,_0x2e5d40,_0x5d41bd){var _0x2fe318={};var _0x5cd098={};var _0x4ef810;var _0x1038a6;return db[_0x6db7('0x40')][_0x6db7('0x56')]({'where':{'id':_0x21e635['params']['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x2e5d40,null))['then'](function(_0x5f26a1){if(_0x5f26a1){_0x4ef810=_0x5f26a1;_0x5cd098[_0x6db7('0x30')]=_[_0x6db7('0x46')](db[_0x6db7('0x53')][_0x6db7('0x2c')]);_0x5cd098[_0x6db7('0x2e')]=_[_0x6db7('0x46')](_0x21e635[_0x6db7('0x2e')]);_0x5cd098[_0x6db7('0x2f')]=_['intersection'](_0x5cd098[_0x6db7('0x30')],_0x5cd098[_0x6db7('0x2e')]);_0x2fe318[_0x6db7('0x31')]=_[_0x6db7('0x32')](_0x5cd098[_0x6db7('0x30')],qs['fields'](_0x21e635[_0x6db7('0x2e')][_0x6db7('0x33')]));_0x2fe318[_0x6db7('0x31')]=_0x2fe318[_0x6db7('0x31')]['length']?_0x2fe318[_0x6db7('0x31')]:_0x5cd098[_0x6db7('0x30')];_0x2fe318['order']=qs[_0x6db7('0x38')](_0x21e635[_0x6db7('0x2e')]['sort']);_0x2fe318[_0x6db7('0x39')]=qs['filters'](_[_0x6db7('0x3a')](_0x21e635['query'],_0x5cd098[_0x6db7('0x2f')]));if(_0x21e635[_0x6db7('0x2e')]['filter']){_0x2fe318['where']=_[_0x6db7('0x3b')](_0x2fe318[_0x6db7('0x39')],{'$or':_[_0x6db7('0x2b')](_0x2fe318[_0x6db7('0x31')],function(_0x2e9beb){var _0x246b83={};_0x246b83[_0x2e9beb]={'$like':'%'+_0x21e635[_0x6db7('0x2e')][_0x6db7('0x3e')]+'%'};return _0x246b83;})});}_0x2fe318=_[_0x6db7('0x3b')]({},_0x2fe318,_0x21e635[_0x6db7('0x3f')]);return _0x4ef810[_0x6db7('0x55')](_0x2fe318);}})[_0x6db7('0x25')](function(_0x142406){if(_0x142406){_0x1038a6=_0x142406['length'];if(!_0x21e635[_0x6db7('0x2e')][_0x6db7('0x35')](_0x6db7('0x36'))){_0x2fe318[_0x6db7('0x1e')]=qs[_0x6db7('0x1e')](_0x21e635[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x2fe318[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x21e635['query']['offset']);}return _0x4ef810[_0x6db7('0x55')](_0x2fe318);}})['then'](function(_0x1579e8){if(_0x1579e8){return _0x1579e8?{'count':_0x1038a6,'rows':_0x1579e8}:null;}})['then'](respondWithResult(_0x2e5d40,null))[_0x6db7('0x44')](handleError(_0x2e5d40,null));};exports[_0x6db7('0x57')]=function(_0xd663a,_0xf78a4a,_0x5195ae){var _0x39b4d0={};var _0x53d41b={};var _0x5ae25f;var _0x35d64d;return db['Trigger'][_0x6db7('0x56')]({'where':{'id':_0xd663a[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0xf78a4a,null))[_0x6db7('0x25')](function(_0x472f1c){if(_0x472f1c){_0x5ae25f=_0x472f1c;_0x53d41b['model']=_[_0x6db7('0x46')](db[_0x6db7('0x53')][_0x6db7('0x2c')]);_0x53d41b[_0x6db7('0x2e')]=_['keys'](_0xd663a['query']);_0x53d41b['filters']=_['intersection'](_0x53d41b['model'],_0x53d41b['query']);_0x39b4d0['attributes']=_[_0x6db7('0x32')](_0x53d41b[_0x6db7('0x30')],qs[_0x6db7('0x33')](_0xd663a['query']['fields']));_0x39b4d0[_0x6db7('0x31')]=_0x39b4d0[_0x6db7('0x31')][_0x6db7('0x34')]?_0x39b4d0[_0x6db7('0x31')]:_0x53d41b['model'];_0x39b4d0[_0x6db7('0x37')]=qs[_0x6db7('0x38')](_0xd663a[_0x6db7('0x2e')][_0x6db7('0x38')]);_0x39b4d0[_0x6db7('0x39')]=qs[_0x6db7('0x2f')](_['pick'](_0xd663a['query'],_0x53d41b[_0x6db7('0x2f')]));if(_0xd663a[_0x6db7('0x2e')]['filter']){_0x39b4d0[_0x6db7('0x39')]=_[_0x6db7('0x3b')](_0x39b4d0[_0x6db7('0x39')],{'$or':_[_0x6db7('0x2b')](_0x39b4d0[_0x6db7('0x31')],function(_0x4651c2){var _0x2212e8={};_0x2212e8[_0x4651c2]={'$like':'%'+_0xd663a[_0x6db7('0x2e')][_0x6db7('0x3e')]+'%'};return _0x2212e8;})});}_0x39b4d0=_[_0x6db7('0x3b')]({},_0x39b4d0,_0xd663a[_0x6db7('0x3f')]);return _0x5ae25f[_0x6db7('0x57')](_0x39b4d0);}})[_0x6db7('0x25')](function(_0x522e14){if(_0x522e14){_0x35d64d=_0x522e14[_0x6db7('0x34')];if(!_0xd663a[_0x6db7('0x2e')][_0x6db7('0x35')]('nolimit')){_0x39b4d0[_0x6db7('0x1e')]=qs['limit'](_0xd663a[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x39b4d0[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0xd663a[_0x6db7('0x2e')]['offset']);}return _0x5ae25f['getAnyConditions'](_0x39b4d0);}})[_0x6db7('0x25')](function(_0x16fd3a){if(_0x16fd3a){return _0x16fd3a?{'count':_0x35d64d,'rows':_0x16fd3a}:null;}})['then'](respondWithResult(_0xf78a4a,null))[_0x6db7('0x44')](handleError(_0xf78a4a,null));};exports['addAction']=function(_0x4ded51,_0x51e38b,_0x198733){if(_0x4ded51[_0x6db7('0x49')]['id']){delete _0x4ded51['body']['id'];}return db[_0x6db7('0x40')]['find']({'where':{'id':_0x4ded51[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x51e38b,null))[_0x6db7('0x25')](function(_0x180c0c){if(_0x180c0c){_0x4ded51[_0x6db7('0x49')]['TriggerId']=_0x180c0c['id'];return db[_0x6db7('0x58')][_0x6db7('0x48')](_0x4ded51['body']);}})[_0x6db7('0x25')](respondWithResult(_0x51e38b,null))['catch'](handleError(_0x51e38b,null));};exports[_0x6db7('0x59')]=function(_0x2760b4,_0x37fbaf,_0x250b2a){var _0x241f16={};var _0x352750={};var _0x4227de;var _0x429772;return db[_0x6db7('0x40')][_0x6db7('0x56')]({'where':{'id':_0x2760b4[_0x6db7('0x45')]['id']}})[_0x6db7('0x25')](handleEntityNotFound(_0x37fbaf,null))[_0x6db7('0x25')](function(_0x2e47c0){if(_0x2e47c0){_0x4227de=_0x2e47c0;_0x352750[_0x6db7('0x30')]=_[_0x6db7('0x46')](db[_0x6db7('0x58')][_0x6db7('0x2c')]);_0x352750['query']=_['keys'](_0x2760b4[_0x6db7('0x2e')]);_0x352750[_0x6db7('0x2f')]=_['intersection'](_0x352750[_0x6db7('0x30')],_0x352750[_0x6db7('0x2e')]);_0x241f16[_0x6db7('0x31')]=_['intersection'](_0x352750['model'],qs[_0x6db7('0x33')](_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x33')]));_0x241f16['attributes']=_0x241f16[_0x6db7('0x31')][_0x6db7('0x34')]?_0x241f16[_0x6db7('0x31')]:_0x352750[_0x6db7('0x30')];_0x241f16[_0x6db7('0x37')]=qs['sort'](_0x2760b4[_0x6db7('0x2e')]['sort']);_0x241f16[_0x6db7('0x39')]=qs[_0x6db7('0x2f')](_[_0x6db7('0x3a')](_0x2760b4[_0x6db7('0x2e')],_0x352750[_0x6db7('0x2f')]));if(_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x3e')]){_0x241f16[_0x6db7('0x39')]=_[_0x6db7('0x3b')](_0x241f16[_0x6db7('0x39')],{'$or':_['map'](_0x241f16['attributes'],function(_0x1aa853){var _0x2bf58c={};_0x2bf58c[_0x1aa853]={'$like':'%'+_0x2760b4[_0x6db7('0x2e')]['filter']+'%'};return _0x2bf58c;})});}_0x241f16=_['merge']({},_0x241f16,_0x2760b4['options']);return _0x4227de[_0x6db7('0x59')](_0x241f16);}})[_0x6db7('0x25')](function(_0x1de217){if(_0x1de217){_0x429772=_0x1de217['length'];if(!_0x2760b4[_0x6db7('0x2e')]['hasOwnProperty'](_0x6db7('0x36'))){_0x241f16[_0x6db7('0x1e')]=qs[_0x6db7('0x1e')](_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x1e')]);_0x241f16[_0x6db7('0x1c')]=qs[_0x6db7('0x1c')](_0x2760b4[_0x6db7('0x2e')][_0x6db7('0x1c')]);}return _0x4227de['getActions'](_0x241f16);}})['then'](function(_0x262188){if(_0x262188){return _0x262188?{'count':_0x429772,'rows':_0x262188}:null;}})[_0x6db7('0x25')](respondWithResult(_0x37fbaf,null))['catch'](handleError(_0x37fbaf,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 35b7c74..03ebb58 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 _0xd2ea=['tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5bd3b4,_0x32f530){_0x5bd3b4=_0x5bd3b4-0x0;var _0x7f3354=_0xd2ea[_0x5bd3b4];return _0x7f3354;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var moment=require(_0xad2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xad2e('0x5'));var fs=require('fs');var path=require(_0xad2e('0x6'));var rimraf=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var attributes=require(_0xad2e('0x9'));module[_0xad2e('0xa')]=function(_0x29e97f,_0x592e8b){return _0x29e97f[_0xad2e('0xb')](_0xad2e('0xc'),attributes,{'tableName':_0xad2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1159=['define','Trigger','tools_triggers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0xbf4346,_0x56ef94){var _0xb3ce4b=function(_0x561472){while(--_0x561472){_0xbf4346['push'](_0xbf4346['shift']());}};_0xb3ce4b(++_0x56ef94);}(_0x1159,0xf3));var _0x9115=function(_0x396aca,_0x1b4f0c){_0x396aca=_0x396aca-0x0;var _0xe179d8=_0x1159[_0x396aca];return _0xe179d8;};'use strict';var _=require(_0x9115('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9115('0x1'));var moment=require(_0x9115('0x2'));var BPromise=require(_0x9115('0x3'));var rp=require(_0x9115('0x4'));var fs=require('fs');var path=require(_0x9115('0x5'));var rimraf=require(_0x9115('0x6'));var config=require(_0x9115('0x7'));var attributes=require(_0x9115('0x8'));module['exports']=function(_0x4a23ba,_0x3fd395){return _0x4a23ba[_0x9115('0x9')](_0x9115('0xa'),attributes,{'tableName':_0x9115('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index ce4f8a8..0ee6a40 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 _0x92cd=['stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','options','attributes','limit','include','model','map','debug','ShowTrigger','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x92cd,0x160));var _0xd92c=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x92cd[_0x616290];return _0x453879;};'use strict';var _=require(_0xd92c('0x0'));var util=require(_0xd92c('0x1'));var moment=require(_0xd92c('0x2'));var BPromise=require(_0xd92c('0x3'));var rs=require(_0xd92c('0x4'));var fs=require('fs');var Redis=require(_0xd92c('0x5'));var db=require(_0xd92c('0x6'))['db'];var utils=require(_0xd92c('0x7'));var logger=require(_0xd92c('0x8'))(_0xd92c('0x9'));var config=require(_0xd92c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd92c('0xb')][_0xd92c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x459c4a,_0x1addb8,_0x401427){return new BPromise(function(_0x321ea5,_0x31fb6e){return client[_0xd92c('0xd')](_0x459c4a,_0x401427)[_0xd92c('0xe')](function(_0x8e2311){logger[_0xd92c('0xf')]('Trigger,\x20%s,\x20%s',_0x1addb8,_0xd92c('0x10'));logger['debug'](_0xd92c('0x11'),_0x1addb8,_0xd92c('0x10'),JSON[_0xd92c('0x12')](_0x8e2311));if(_0x8e2311[_0xd92c('0x13')]){if(_0x8e2311[_0xd92c('0x13')]['code']===0x1f4){logger[_0xd92c('0x13')](_0xd92c('0x14'),_0x1addb8,_0x8e2311[_0xd92c('0x13')][_0xd92c('0x15')]);return _0x31fb6e(_0x8e2311[_0xd92c('0x13')][_0xd92c('0x15')]);}logger[_0xd92c('0x13')](_0xd92c('0x14'),_0x1addb8,_0x8e2311[_0xd92c('0x13')]['message']);return _0x321ea5(_0x8e2311['error'][_0xd92c('0x15')]);}else{logger[_0xd92c('0xf')](_0xd92c('0x14'),_0x1addb8,_0xd92c('0x10'));_0x321ea5(_0x8e2311[_0xd92c('0x16')]['message']);}})[_0xd92c('0x17')](function(_0xd208ef){logger['error'](_0xd92c('0x14'),_0x1addb8,_0xd208ef);_0x31fb6e(_0xd208ef);});});}exports[_0xd92c('0x18')]=function(_0x5c639e){var _0x47a3ee=this;return new Promise(function(_0x5c201a,_0x4398e5){return db[_0xd92c('0x19')]['findAll']({'raw':_0x5c639e[_0xd92c('0x1a')]?_0x5c639e['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c639e[_0xd92c('0x1a')]?_0x5c639e['options']['where']||null:null,'attributes':_0x5c639e[_0xd92c('0x1a')]?_0x5c639e['options'][_0xd92c('0x1b')]||null:null,'limit':_0x5c639e[_0xd92c('0x1a')]?_0x5c639e[_0xd92c('0x1a')][_0xd92c('0x1c')]||null:null,'include':_0x5c639e[_0xd92c('0x1a')]?_0x5c639e['options'][_0xd92c('0x1d')]?_['map'](_0x5c639e[_0xd92c('0x1a')][_0xd92c('0x1d')],function(_0x43055b){return{'model':db[_0x43055b[_0xd92c('0x1e')]],'as':_0x43055b['as'],'attributes':_0x43055b['attributes'],'include':_0x43055b['include']?_[_0xd92c('0x1f')](_0x43055b[_0xd92c('0x1d')],function(_0x2cdabf){return{'model':db[_0x2cdabf[_0xd92c('0x1e')]],'as':_0x2cdabf['as'],'attributes':_0x2cdabf[_0xd92c('0x1b')],'include':_0x2cdabf[_0xd92c('0x1d')]?_[_0xd92c('0x1f')](_0x2cdabf[_0xd92c('0x1d')],function(_0x5500a6){return{'model':db[_0x5500a6[_0xd92c('0x1e')]],'as':_0x5500a6['as'],'attributes':_0x5500a6[_0xd92c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd92c('0xe')](function(_0x1e5b9e){logger[_0xd92c('0xf')]('GetTrigger',_0x5c639e);logger[_0xd92c('0x20')](_0xd92c('0x18'),_0x5c639e,JSON[_0xd92c('0x12')](_0x1e5b9e));_0x5c201a(_0x1e5b9e);})[_0xd92c('0x17')](function(_0x3dd2f2){logger[_0xd92c('0x13')](_0xd92c('0x18'),_0x3dd2f2[_0xd92c('0x15')],_0x5c639e);_0x4398e5(_0x47a3ee[_0xd92c('0x13')](0x1f4,_0x3dd2f2[_0xd92c('0x15')]));});});};exports[_0xd92c('0x21')]=function(_0x59b35b){var _0x119aef=this;return new Promise(function(_0x37aabc,_0x1cdd22){return db[_0xd92c('0x19')][_0xd92c('0x22')]({'raw':_0x59b35b['options']?_0x59b35b[_0xd92c('0x1a')][_0xd92c('0x23')]===undefined?!![]:![]:!![],'where':_0x59b35b[_0xd92c('0x1a')]?_0x59b35b[_0xd92c('0x1a')][_0xd92c('0x24')]||null:null,'attributes':_0x59b35b['options']?_0x59b35b[_0xd92c('0x1a')][_0xd92c('0x1b')]||null:null,'include':_0x59b35b[_0xd92c('0x1a')]?_0x59b35b['options'][_0xd92c('0x1d')]?_[_0xd92c('0x1f')](_0x59b35b['options']['include'],function(_0x14f02c){return{'model':db[_0x14f02c[_0xd92c('0x1e')]],'as':_0x14f02c['as'],'attributes':_0x14f02c[_0xd92c('0x1b')],'include':_0x14f02c[_0xd92c('0x1d')]?_[_0xd92c('0x1f')](_0x14f02c['include'],function(_0x2d705c){return{'model':db[_0x2d705c[_0xd92c('0x1e')]],'as':_0x2d705c['as'],'attributes':_0x2d705c['attributes'],'include':_0x2d705c[_0xd92c('0x1d')]?_[_0xd92c('0x1f')](_0x2d705c[_0xd92c('0x1d')],function(_0x348215){return{'model':db[_0x348215[_0xd92c('0x1e')]],'as':_0x348215['as'],'attributes':_0x348215['attributes']};}):[]};}):[]};}):[]:[]})[_0xd92c('0xe')](function(_0x5ba81c){logger[_0xd92c('0xf')](_0xd92c('0x21'),_0x59b35b);logger[_0xd92c('0x20')]('ShowTrigger',_0x59b35b,JSON[_0xd92c('0x12')](_0x5ba81c));_0x37aabc(_0x5ba81c);})[_0xd92c('0x17')](function(_0x58be8d){logger[_0xd92c('0x13')](_0xd92c('0x21'),_0x58be8d[_0xd92c('0x15')],_0x59b35b);_0x1cdd22(_0x119aef[_0xd92c('0x13')](0x1f4,_0x58be8d['message']));});});}; \ No newline at end of file +var _0x4880=['http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x32b168,_0x22e559){var _0x4b0a8b=function(_0x568c0c){while(--_0x568c0c){_0x32b168['push'](_0x32b168['shift']());}};_0x4b0a8b(++_0x22e559);}(_0x4880,0xea));var _0x0488=function(_0x1e175c,_0x22076d){_0x1e175c=_0x1e175c-0x0;var _0x36f74e=_0x4880[_0x1e175c];return _0x36f74e;};'use strict';var _=require(_0x0488('0x0'));var util=require(_0x0488('0x1'));var moment=require(_0x0488('0x2'));var BPromise=require(_0x0488('0x3'));var rs=require(_0x0488('0x4'));var fs=require('fs');var Redis=require(_0x0488('0x5'));var db=require(_0x0488('0x6'))['db'];var utils=require(_0x0488('0x7'));var logger=require(_0x0488('0x8'))(_0x0488('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0488('0xa')][_0x0488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1abc36,_0x40f71c,_0x414973){return new BPromise(function(_0x340c9f,_0x28435a){return client['request'](_0x1abc36,_0x414973)[_0x0488('0xc')](function(_0xece6a){logger[_0x0488('0xd')](_0x0488('0xe'),_0x40f71c,_0x0488('0xf'));logger[_0x0488('0x10')](_0x0488('0x11'),_0x40f71c,_0x0488('0xf'),JSON['stringify'](_0xece6a));if(_0xece6a[_0x0488('0x12')]){if(_0xece6a['error']['code']===0x1f4){logger['error'](_0x0488('0xe'),_0x40f71c,_0xece6a[_0x0488('0x12')][_0x0488('0x13')]);return _0x28435a(_0xece6a[_0x0488('0x12')]['message']);}logger[_0x0488('0x12')](_0x0488('0xe'),_0x40f71c,_0xece6a[_0x0488('0x12')]['message']);return _0x340c9f(_0xece6a[_0x0488('0x12')]['message']);}else{logger[_0x0488('0xd')]('Trigger,\x20%s,\x20%s',_0x40f71c,_0x0488('0xf'));_0x340c9f(_0xece6a[_0x0488('0x14')][_0x0488('0x13')]);}})[_0x0488('0x15')](function(_0x4e66e2){logger[_0x0488('0x12')](_0x0488('0xe'),_0x40f71c,_0x4e66e2);_0x28435a(_0x4e66e2);});});}exports[_0x0488('0x16')]=function(_0x47601a){var _0x48b54b=this;return new Promise(function(_0x166dae,_0x5222cd){return db[_0x0488('0x17')]['findAll']({'raw':_0x47601a[_0x0488('0x18')]?_0x47601a['options'][_0x0488('0x19')]===undefined?!![]:![]:!![],'where':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1a')]||null:null,'attributes':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1b')]||null:null,'limit':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1c')]||null:null,'include':_0x47601a[_0x0488('0x18')]?_0x47601a[_0x0488('0x18')][_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x47601a[_0x0488('0x18')][_0x0488('0x1d')],function(_0x26b97d){return{'model':db[_0x26b97d['model']],'as':_0x26b97d['as'],'attributes':_0x26b97d[_0x0488('0x1b')],'include':_0x26b97d[_0x0488('0x1d')]?_['map'](_0x26b97d['include'],function(_0x1c59d4){return{'model':db[_0x1c59d4[_0x0488('0x1f')]],'as':_0x1c59d4['as'],'attributes':_0x1c59d4[_0x0488('0x1b')],'include':_0x1c59d4[_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x1c59d4[_0x0488('0x1d')],function(_0x4d47f1){return{'model':db[_0x4d47f1['model']],'as':_0x4d47f1['as'],'attributes':_0x4d47f1[_0x0488('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0488('0xc')](function(_0x3608e2){logger[_0x0488('0xd')](_0x0488('0x16'),_0x47601a);logger[_0x0488('0x10')](_0x0488('0x16'),_0x47601a,JSON[_0x0488('0x20')](_0x3608e2));_0x166dae(_0x3608e2);})[_0x0488('0x15')](function(_0x383aa7){logger[_0x0488('0x12')](_0x0488('0x16'),_0x383aa7[_0x0488('0x13')],_0x47601a);_0x5222cd(_0x48b54b[_0x0488('0x12')](0x1f4,_0x383aa7[_0x0488('0x13')]));});});};exports[_0x0488('0x21')]=function(_0x3cc9d1){var _0x2f187b=this;return new Promise(function(_0x45bfe0,_0x1c8e3b){return db[_0x0488('0x17')][_0x0488('0x22')]({'raw':_0x3cc9d1[_0x0488('0x18')]?_0x3cc9d1['options'][_0x0488('0x19')]===undefined?!![]:![]:!![],'where':_0x3cc9d1[_0x0488('0x18')]?_0x3cc9d1['options'][_0x0488('0x1a')]||null:null,'attributes':_0x3cc9d1['options']?_0x3cc9d1[_0x0488('0x18')][_0x0488('0x1b')]||null:null,'include':_0x3cc9d1[_0x0488('0x18')]?_0x3cc9d1[_0x0488('0x18')]['include']?_[_0x0488('0x1e')](_0x3cc9d1[_0x0488('0x18')][_0x0488('0x1d')],function(_0x47c85c){return{'model':db[_0x47c85c['model']],'as':_0x47c85c['as'],'attributes':_0x47c85c[_0x0488('0x1b')],'include':_0x47c85c[_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x47c85c[_0x0488('0x1d')],function(_0x17a5c6){return{'model':db[_0x17a5c6[_0x0488('0x1f')]],'as':_0x17a5c6['as'],'attributes':_0x17a5c6[_0x0488('0x1b')],'include':_0x17a5c6[_0x0488('0x1d')]?_[_0x0488('0x1e')](_0x17a5c6[_0x0488('0x1d')],function(_0x42a8b8){return{'model':db[_0x42a8b8[_0x0488('0x1f')]],'as':_0x42a8b8['as'],'attributes':_0x42a8b8[_0x0488('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4717e2){logger[_0x0488('0xd')](_0x0488('0x21'),_0x3cc9d1);logger[_0x0488('0x10')](_0x0488('0x21'),_0x3cc9d1,JSON[_0x0488('0x20')](_0x4717e2));_0x45bfe0(_0x4717e2);})[_0x0488('0x15')](function(_0x2289d8){logger['error'](_0x0488('0x21'),_0x2289d8[_0x0488('0x13')],_0x3cc9d1);_0x1c8e3b(_0x2f187b[_0x0488('0x12')](0x1f4,_0x2289d8[_0x0488('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8c2ef1e..592c605 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 _0x9c37=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x17c84b,_0x214ee7){var _0x4870f5=function(_0x133d4d){while(--_0x133d4d){_0x17c84b['push'](_0x17c84b['shift']());}};_0x4870f5(++_0x214ee7);}(_0x9c37,0x15a));var _0x79c3=function(_0x47e1ae,_0x220745){_0x47e1ae=_0x47e1ae-0x0;var _0x2e8810=_0x9c37[_0x47e1ae];return _0x2e8810;};'use strict';var multer=require(_0x79c3('0x0'));var util=require(_0x79c3('0x1'));var path=require(_0x79c3('0x2'));var timeout=require(_0x79c3('0x3'));var express=require(_0x79c3('0x4'));var router=express[_0x79c3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x79c3('0x6'));var interaction=require(_0x79c3('0x7'));var config=require(_0x79c3('0x8'));var controller=require(_0x79c3('0x9'));router[_0x79c3('0xa')]('/',auth[_0x79c3('0xb')](),controller[_0x79c3('0xc')]);router[_0x79c3('0xa')](_0x79c3('0xd'),auth[_0x79c3('0xb')](),controller[_0x79c3('0xe')]);router[_0x79c3('0xf')]('/:id/clone',auth[_0x79c3('0xb')](),controller[_0x79c3('0x10')]);router[_0x79c3('0xf')]('/',auth['isAuthenticated'](),controller[_0x79c3('0x11')]);router[_0x79c3('0x12')](_0x79c3('0xd'),auth[_0x79c3('0xb')](),controller['update']);router[_0x79c3('0x13')]('/:id',auth[_0x79c3('0xb')](),controller[_0x79c3('0x14')]);module[_0x79c3('0x15')]=router; \ No newline at end of file +var _0xff77=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','post','/:id/clone','clone','create','put','delete','destroy','exports','util'];(function(_0x41243b,_0x24f5b4){var _0x39dffe=function(_0xe569fc){while(--_0xe569fc){_0x41243b['push'](_0x41243b['shift']());}};_0x39dffe(++_0x24f5b4);}(_0xff77,0x9f));var _0x7ff7=function(_0x5d4311,_0x1ce34d){_0x5d4311=_0x5d4311-0x0;var _0x5c93d3=_0xff77[_0x5d4311];return _0x5c93d3;};'use strict';var multer=require('multer');var util=require(_0x7ff7('0x0'));var path=require('path');var timeout=require(_0x7ff7('0x1'));var express=require(_0x7ff7('0x2'));var router=express[_0x7ff7('0x3')]();var fs_extra=require(_0x7ff7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7ff7('0x5'));var config=require(_0x7ff7('0x6'));var controller=require(_0x7ff7('0x7'));router[_0x7ff7('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ff7('0x9')]);router[_0x7ff7('0x8')](_0x7ff7('0xa'),auth[_0x7ff7('0xb')](),controller['show']);router[_0x7ff7('0xc')](_0x7ff7('0xd'),auth[_0x7ff7('0xb')](),controller[_0x7ff7('0xe')]);router[_0x7ff7('0xc')]('/',auth['isAuthenticated'](),controller[_0x7ff7('0xf')]);router[_0x7ff7('0x10')](_0x7ff7('0xa'),auth[_0x7ff7('0xb')](),controller['update']);router[_0x7ff7('0x11')](_0x7ff7('0xa'),auth['isAuthenticated'](),controller[_0x7ff7('0x12')]);module[_0x7ff7('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 84ac0af..4cf635e 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 _0xed8a=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','always','INTEGER','accept','refuse','uac','uas','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xed8a,0xfb));var _0xaed8=function(_0x2a2eb0,_0x4c4c83){_0x2a2eb0=_0x2a2eb0-0x0;var _0x31a5d8=_0xed8a[_0x2a2eb0];return _0x31a5d8;};'use strict';var Sequelize=require(_0xaed8('0x0'));module[_0xaed8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaed8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x4'),_0xaed8('0x5'),_0xaed8('0x6')),'allowNull':![],'defaultValue':_0xaed8('0x4')},'context':{'type':Sequelize[_0xaed8('0x7')],'allowNull':![],'defaultValue':_0xaed8('0x8')},'callingpres':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x9'),_0xaed8('0xa'),_0xaed8('0xb'),_0xaed8('0xc'),_0xaed8('0xd'),_0xaed8('0xe'),_0xaed8('0xf'),_0xaed8('0x10'))},'deny':{'type':Sequelize[_0xaed8('0x7')]},'permit':{'type':Sequelize[_0xaed8('0x7')]},'secret':{'type':Sequelize[_0xaed8('0x7')]},'md5secret':{'type':Sequelize[_0xaed8('0x7')]},'remotesecret':{'type':Sequelize[_0xaed8('0x7')]},'transport':{'type':Sequelize[_0xaed8('0x7')],'defaultValue':_0xaed8('0x11'),'set':function(_0x52446f){this[_0xaed8('0x12')](_0xaed8('0x13'),_0x52446f?_0x52446f['join'](','):null);},'get':function(){return this['getDataValue'](_0xaed8('0x13'))?this[_0xaed8('0x14')](_0xaed8('0x13'))[_0xaed8('0x15')](','):null;},'comment':_0xaed8('0x16')},'dtmfmode':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x17'),'info',_0xaed8('0x18'),_0xaed8('0x19'),_0xaed8('0x1a')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no',_0xaed8('0x1c'),_0xaed8('0x1d'),_0xaed8('0x1e')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xaed8('0x7')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x11674d){this[_0xaed8('0x12')](_0xaed8('0x1f'),_0x11674d?_0x11674d['join'](','):null);},'get':function(){return this[_0xaed8('0x14')]('nat')?this[_0xaed8('0x14')](_0xaed8('0x1f'))[_0xaed8('0x15')](','):null;},'comment':_0xaed8('0x20')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xaed8('0x7')]},'pickupgroup':{'type':Sequelize[_0xaed8('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xaed8('0x7')]},'language':{'type':Sequelize[_0xaed8('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xaed8('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xaed8('0x7')],'allowNull':![],'defaultValue':_0xaed8('0x21'),'set':function(_0x27932a){this[_0xaed8('0x12')]('allow',_0x27932a?_0x27932a['join'](';'):_0xaed8('0x21'));},'get':function(){return this[_0xaed8('0x14')](_0xaed8('0x22'))?this[_0xaed8('0x14')](_0xaed8('0x22'))['split'](';'):null;},'comment':_0xaed8('0x23')},'autoframing':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'insecure':{'type':Sequelize[_0xaed8('0x7')],'defaultValue':_0xaed8('0x24'),'set':function(_0x4b669a){this['setDataValue'](_0xaed8('0x25'),_0x4b669a?_0x4b669a['join'](','):null);},'get':function(){return this[_0xaed8('0x14')]('insecure')?this[_0xaed8('0x14')](_0xaed8('0x25'))[_0xaed8('0x15')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no',_0xaed8('0x26'))},'promiscredir':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xaed8('0x7')]},'callerid':{'type':Sequelize[_0xaed8('0x7')],'defaultValue':_0xaed8('0x27')},'amaflags':{'type':Sequelize[_0xaed8('0x7')]},'callcounter':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no'),'defaultValue':_0xaed8('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xaed8('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xaed8('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xaed8('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no',_0xaed8('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xaed8('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xaed8('0x3')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0xaed8('0x2a'),_0xaed8('0x2b'),'originate')},'session_expires':{'type':Sequelize[_0xaed8('0x29')](0xb)},'session_minse':{'type':Sequelize[_0xaed8('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x2c'),_0xaed8('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xaed8('0x7')]},'regexten':{'type':Sequelize[_0xaed8('0x7')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xaed8('0x7')]},'port':{'type':Sequelize[_0xaed8('0x29')](0x5)},'qualify':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xaed8('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xaed8('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xaed8('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xaed8('0x3')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xaed8('0x7')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xaed8('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0xaed8('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0xaed8('0x7')]},'contactdeny':{'type':Sequelize[_0xaed8('0x7')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xaed8('0x7')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xaed8('0x29')](0xb)},'encryption':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xaed8('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no',_0xaed8('0x2e'),_0xaed8('0x2f'))},'dtlsrekey':{'type':Sequelize[_0xaed8('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0xaed8('0x7')]},'dtlsprivatekey':{'type':Sequelize[_0xaed8('0x7')]},'dtlscipher':{'type':Sequelize[_0xaed8('0x7')]},'dtlscafile':{'type':Sequelize[_0xaed8('0x7')]},'dtlscapath':{'type':Sequelize[_0xaed8('0x7')]},'dtlssetup':{'type':Sequelize[_0xaed8('0x3')]('active',_0xaed8('0x30'),_0xaed8('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xaed8('0x7')]},'usereqphone':{'type':Sequelize['ENUM'](_0xaed8('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xaed8('0x7')]},'recordofffeature':{'type':Sequelize[_0xaed8('0x7')]},'call_limit':{'type':Sequelize[_0xaed8('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xaed8('0x3')](_0xaed8('0x1b'),'no')},'vmexten':{'type':Sequelize[_0xaed8('0x7')]},'mohinterpret':{'type':Sequelize[_0xaed8('0x7')]},'mohsuggest':{'type':Sequelize[_0xaed8('0x7')]},'parkinglot':{'type':Sequelize[_0xaed8('0x7')]},'description':{'type':Sequelize[_0xaed8('0x7')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xaed8('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0xaed8('0x1b'),'no','nonat',_0xaed8('0x1d'),_0xaed8('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xaed8('0x7')]},'otherFields':{'type':Sequelize[_0xaed8('0x7')]},'active':{'type':Sequelize[_0xaed8('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4115=['uac','uas','pai','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','refuse','originate'];(function(_0x11ac91,_0x20c725){var _0x5a63dc=function(_0x157380){while(--_0x157380){_0x11ac91['push'](_0x11ac91['shift']());}};_0x5a63dc(++_0x20c725);}(_0x4115,0x1e6));var _0x5411=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4115[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0x5411('0x0')]={'name':{'type':Sequelize[_0x5411('0x1')],'allowNull':![],'unique':_0x5411('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x4'),_0x5411('0x5'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5411('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x6'),_0x5411('0x7'),_0x5411('0x8'),_0x5411('0x9'),_0x5411('0xa'),_0x5411('0xb'),_0x5411('0xc'),_0x5411('0xd'))},'deny':{'type':Sequelize[_0x5411('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5411('0x1')]},'remotesecret':{'type':Sequelize[_0x5411('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x5411('0xe'),'set':function(_0x560a42){this['setDataValue']('transport',_0x560a42?_0x560a42[_0x5411('0xf')](','):null);},'get':function(){return this[_0x5411('0x10')](_0x5411('0x11'))?this[_0x5411('0x10')](_0x5411('0x11'))[_0x5411('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x13'),_0x5411('0x14'),_0x5411('0x15'),_0x5411('0x16'),_0x5411('0x17')),'defaultValue':_0x5411('0x13')},'directmedia':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no',_0x5411('0x19'),_0x5411('0x1a'),_0x5411('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5411('0x1')]},'directmediadeny':{'type':Sequelize[_0x5411('0x1')]},'nat':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x1c'),'set':function(_0x43a89c){this[_0x5411('0x1d')]('nat',_0x43a89c?_0x43a89c[_0x5411('0xf')](','):null);},'get':function(){return this[_0x5411('0x10')](_0x5411('0x1e'))?this['getDataValue'](_0x5411('0x1e'))['split'](','):null;},'comment':_0x5411('0x1f')},'callgroup':{'type':Sequelize[_0x5411('0x1')]},'namedcallgroup':{'type':Sequelize[_0x5411('0x1')]},'pickupgroup':{'type':Sequelize[_0x5411('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x5411('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x39b335){this[_0x5411('0x1d')](_0x5411('0x21'),_0x39b335?_0x39b335[_0x5411('0xf')](';'):_0x5411('0x22'));},'get':function(){return this['getDataValue']('allow')?this[_0x5411('0x10')](_0x5411('0x21'))[_0x5411('0x12')](';'):null;},'comment':_0x5411('0x23')},'autoframing':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'insecure':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x24'),'set':function(_0x183f17){this[_0x5411('0x1d')](_0x5411('0x25'),_0x183f17?_0x183f17[_0x5411('0xf')](','):null);},'get':function(){return this[_0x5411('0x10')](_0x5411('0x25'))?this['getDataValue'](_0x5411('0x25'))[_0x5411('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5411('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no',_0x5411('0x26'))},'promiscredir':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'accountcode':{'type':Sequelize[_0x5411('0x27')](0xb)},'setvar':{'type':Sequelize[_0x5411('0x1')]},'callerid':{'type':Sequelize[_0x5411('0x1')],'defaultValue':_0x5411('0x28')},'amaflags':{'type':Sequelize[_0x5411('0x1')]},'callcounter':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':_0x5411('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x5411('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no',_0x5411('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5411('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'mailbox':{'type':Sequelize[_0x5411('0x1')]},'session_timers':{'type':Sequelize[_0x5411('0x3')]('accept',_0x5411('0x2a'),_0x5411('0x2b'))},'session_expires':{'type':Sequelize[_0x5411('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x5411('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x2c'),_0x5411('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x5411('0x1')]},'regexten':{'type':Sequelize[_0x5411('0x1')]},'fromdomain':{'type':Sequelize[_0x5411('0x1')]},'fromuser':{'type':Sequelize[_0x5411('0x1')]},'port':{'type':Sequelize[_0x5411('0x27')](0x5)},'qualify':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x5411('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5411('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no',_0x5411('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5411('0x1')]},'timert1':{'type':Sequelize[_0x5411('0x27')](0xb)},'timerb':{'type':Sequelize[_0x5411('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5411('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x5411('0x1')]},'contactacl':{'type':Sequelize[_0x5411('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x5411('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x5411('0x27')](0xb)},'encryption':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no')},'icesupport':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x5411('0x3')]('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x5411('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x5411('0x1')]},'dtlscipher':{'type':Sequelize[_0x5411('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x5411('0x1')]},'dtlssetup':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x2f'),_0x5411('0x30'),_0x5411('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5411('0x1')]},'recordofffeature':{'type':Sequelize[_0x5411('0x1')]},'call_limit':{'type':Sequelize[_0x5411('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x5411('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x5411('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x5411('0x1')]},'mohinterpret':{'type':Sequelize[_0x5411('0x1')]},'mohsuggest':{'type':Sequelize[_0x5411('0x1')]},'parkinglot':{'type':Sequelize[_0x5411('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x5411('0x32')},'canreinvite':{'type':Sequelize[_0x5411('0x3')](_0x5411('0x18'),'no','nonat',_0x5411('0x1a'),_0x5411('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5411('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5411('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5411('0x1')],'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 87f7264..aa35914 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x10a77f,_0x8575b0){var _0x40e612=function(_0x169079){while(--_0x169079){_0x10a77f['push'](_0x10a77f['shift']());}};_0x40e612(++_0x8575b0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x56cdba,_0x37c1b7){_0x56cdba=_0x56cdba-0x0;var _0x4c32e8=_0x9bde[_0x56cdba];return _0x4c32e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x49f913,_0x12ccd8){var _0xf48ea5=function(_0xfd48b0){while(--_0xfd48b0){_0x49f913['push'](_0x49f913['shift']());}};_0xf48ea5(++_0x12ccd8);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4b3d12,_0x1d4133){_0x4b3d12=_0x4b3d12-0x0;var _0x104e8c=_0xe5b3[_0x4b3d12];return _0x104e8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index eacc458..2d19419 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 _0x657f=['../../config/environment','exports','define','Trunk','tools_trunks','util','api','bluebird','request-promise','path'];(function(_0x552da7,_0x109499){var _0xf9841a=function(_0x5c4e75){while(--_0x5c4e75){_0x552da7['push'](_0x552da7['shift']());}};_0xf9841a(++_0x109499);}(_0x657f,0x181));var _0xf657=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x657f[_0x514260];return _0x4ac81b;};'use strict';var _=require('lodash');var util=require(_0xf657('0x0'));var logger=require('../../config/logger')(_0xf657('0x1'));var moment=require('moment');var BPromise=require(_0xf657('0x2'));var rp=require(_0xf657('0x3'));var fs=require('fs');var path=require(_0xf657('0x4'));var rimraf=require('rimraf');var config=require(_0xf657('0x5'));var attributes=require('./trunk.attributes');module[_0xf657('0x6')]=function(_0xd02fb0,_0x442602){return _0xd02fb0[_0xf657('0x7')](_0xf657('0x8'),attributes,{'tableName':_0xf657('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85a1=['tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk'];(function(_0x51e122,_0x5d27d5){var _0x374a80=function(_0x565df0){while(--_0x565df0){_0x51e122['push'](_0x51e122['shift']());}};_0x374a80(++_0x5d27d5);}(_0x85a1,0x90));var _0x185a=function(_0x2509e0,_0x64310e){_0x2509e0=_0x2509e0-0x0;var _0x7bcee8=_0x85a1[_0x2509e0];return _0x7bcee8;};'use strict';var _=require('lodash');var util=require(_0x185a('0x0'));var logger=require(_0x185a('0x1'))(_0x185a('0x2'));var moment=require(_0x185a('0x3'));var BPromise=require(_0x185a('0x4'));var rp=require(_0x185a('0x5'));var fs=require('fs');var path=require(_0x185a('0x6'));var rimraf=require(_0x185a('0x7'));var config=require(_0x185a('0x8'));var attributes=require(_0x185a('0x9'));module['exports']=function(_0x4a9e24,_0x3a739d){return _0x4a9e24[_0x185a('0xa')](_0x185a('0xb'),attributes,{'tableName':_0x185a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 858e7fb..ca6b585 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 _0xa9aa=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','debug','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','GetTrunk','Trunk','findAll','options','limit','map','include','attributes','model','catch','where','ShowTrunk','lodash'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa9aa,0xd1));var _0xaa9a=function(_0x42e08a,_0x52faf4){_0x42e08a=_0x42e08a-0x0;var _0x35c8ba=_0xa9aa[_0x42e08a];return _0x35c8ba;};'use strict';var _=require(_0xaa9a('0x0'));var util=require(_0xaa9a('0x1'));var moment=require('moment');var BPromise=require(_0xaa9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa9a('0x3'));var db=require(_0xaa9a('0x4'))['db'];var utils=require(_0xaa9a('0x5'));var logger=require(_0xaa9a('0x6'))('rpc');var config=require(_0xaa9a('0x7'));var jayson=require(_0xaa9a('0x8'));var client=jayson['client'][_0xaa9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8467e0,_0x52b666,_0x4dec0c){return new BPromise(function(_0x3fb9c9,_0x47cabe){return client['request'](_0x8467e0,_0x4dec0c)[_0xaa9a('0xa')](function(_0x2b4c0b){logger[_0xaa9a('0xb')]('Trunk,\x20%s,\x20%s',_0x52b666,'request\x20sent');logger[_0xaa9a('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x52b666,_0xaa9a('0xd'),JSON[_0xaa9a('0xe')](_0x2b4c0b));if(_0x2b4c0b[_0xaa9a('0xf')]){if(_0x2b4c0b[_0xaa9a('0xf')]['code']===0x1f4){logger[_0xaa9a('0xf')](_0xaa9a('0x10'),_0x52b666,_0x2b4c0b[_0xaa9a('0xf')][_0xaa9a('0x11')]);return _0x47cabe(_0x2b4c0b[_0xaa9a('0xf')][_0xaa9a('0x11')]);}logger['error'](_0xaa9a('0x10'),_0x52b666,_0x2b4c0b[_0xaa9a('0xf')]['message']);return _0x3fb9c9(_0x2b4c0b[_0xaa9a('0xf')][_0xaa9a('0x11')]);}else{logger['info'](_0xaa9a('0x10'),_0x52b666,_0xaa9a('0xd'));_0x3fb9c9(_0x2b4c0b['result']['message']);}})['catch'](function(_0x33c234){logger[_0xaa9a('0xf')](_0xaa9a('0x10'),_0x52b666,_0x33c234);_0x47cabe(_0x33c234);});});}exports[_0xaa9a('0x12')]=function(_0x5c4353){var _0x397e60=this;return new Promise(function(_0x551f09,_0x4c2468){return db[_0xaa9a('0x13')][_0xaa9a('0x14')]({'raw':_0x5c4353[_0xaa9a('0x15')]?_0x5c4353[_0xaa9a('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5c4353[_0xaa9a('0x15')]?_0x5c4353['options']['where']||null:null,'attributes':_0x5c4353[_0xaa9a('0x15')]?_0x5c4353[_0xaa9a('0x15')]['attributes']||null:null,'limit':_0x5c4353[_0xaa9a('0x15')]?_0x5c4353[_0xaa9a('0x15')][_0xaa9a('0x16')]||null:null,'include':_0x5c4353[_0xaa9a('0x15')]?_0x5c4353[_0xaa9a('0x15')]['include']?_[_0xaa9a('0x17')](_0x5c4353[_0xaa9a('0x15')][_0xaa9a('0x18')],function(_0x182de4){return{'model':db[_0x182de4['model']],'as':_0x182de4['as'],'attributes':_0x182de4[_0xaa9a('0x19')],'include':_0x182de4['include']?_[_0xaa9a('0x17')](_0x182de4[_0xaa9a('0x18')],function(_0x2f2f74){return{'model':db[_0x2f2f74['model']],'as':_0x2f2f74['as'],'attributes':_0x2f2f74['attributes'],'include':_0x2f2f74['include']?_[_0xaa9a('0x17')](_0x2f2f74[_0xaa9a('0x18')],function(_0x52358f){return{'model':db[_0x52358f[_0xaa9a('0x1a')]],'as':_0x52358f['as'],'attributes':_0x52358f[_0xaa9a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xaa9a('0xa')](function(_0x2d33bf){logger[_0xaa9a('0xb')](_0xaa9a('0x12'),_0x5c4353);logger[_0xaa9a('0xc')](_0xaa9a('0x12'),_0x5c4353,JSON['stringify'](_0x2d33bf));_0x551f09(_0x2d33bf);})[_0xaa9a('0x1b')](function(_0x1e8f01){logger['error']('GetTrunk',_0x1e8f01[_0xaa9a('0x11')],_0x5c4353);_0x4c2468(_0x397e60['error'](0x1f4,_0x1e8f01['message']));});});};exports['ShowTrunk']=function(_0x1b932e){var _0x2045b6=this;return new Promise(function(_0x5479dd,_0x4c3b1a){return db[_0xaa9a('0x13')]['find']({'raw':_0x1b932e[_0xaa9a('0x15')]?_0x1b932e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b932e[_0xaa9a('0x15')]?_0x1b932e[_0xaa9a('0x15')][_0xaa9a('0x1c')]||null:null,'attributes':_0x1b932e[_0xaa9a('0x15')]?_0x1b932e[_0xaa9a('0x15')][_0xaa9a('0x19')]||null:null,'include':_0x1b932e[_0xaa9a('0x15')]?_0x1b932e[_0xaa9a('0x15')]['include']?_[_0xaa9a('0x17')](_0x1b932e['options'][_0xaa9a('0x18')],function(_0x4687c1){return{'model':db[_0x4687c1[_0xaa9a('0x1a')]],'as':_0x4687c1['as'],'attributes':_0x4687c1[_0xaa9a('0x19')],'include':_0x4687c1['include']?_[_0xaa9a('0x17')](_0x4687c1[_0xaa9a('0x18')],function(_0x1f204c){return{'model':db[_0x1f204c[_0xaa9a('0x1a')]],'as':_0x1f204c['as'],'attributes':_0x1f204c[_0xaa9a('0x19')],'include':_0x1f204c[_0xaa9a('0x18')]?_[_0xaa9a('0x17')](_0x1f204c['include'],function(_0x38a1e4){return{'model':db[_0x38a1e4[_0xaa9a('0x1a')]],'as':_0x38a1e4['as'],'attributes':_0x38a1e4[_0xaa9a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xaa9a('0xa')](function(_0x3ddc2b){logger[_0xaa9a('0xb')](_0xaa9a('0x1d'),_0x1b932e);logger[_0xaa9a('0xc')](_0xaa9a('0x1d'),_0x1b932e,JSON[_0xaa9a('0xe')](_0x3ddc2b));_0x5479dd(_0x3ddc2b);})[_0xaa9a('0x1b')](function(_0x4dc78e){logger['error'](_0xaa9a('0x1d'),_0x4dc78e[_0xaa9a('0x11')],_0x1b932e);_0x4c3b1a(_0x2045b6[_0xaa9a('0xf')](0x1f4,_0x4dc78e[_0xaa9a('0x11')]));});});}; \ No newline at end of file +var _0x346d=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','options','raw','where','limit','include','map','model','attributes','find','ShowTrunk','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x346d,0x191));var _0xd346=function(_0x158d88,_0x489365){_0x158d88=_0x158d88-0x0;var _0x22e983=_0x346d[_0x158d88];return _0x22e983;};'use strict';var _=require(_0xd346('0x0'));var util=require(_0xd346('0x1'));var moment=require('moment');var BPromise=require(_0xd346('0x2'));var rs=require(_0xd346('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd346('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd346('0x5'))('rpc');var config=require(_0xd346('0x6'));var jayson=require(_0xd346('0x7'));var client=jayson['client'][_0xd346('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2374,_0xf87e39,_0x3f7a30){return new BPromise(function(_0x19a26a,_0x4cc10a){return client[_0xd346('0x9')](_0x3d2374,_0x3f7a30)[_0xd346('0xa')](function(_0x252f6e){logger[_0xd346('0xb')](_0xd346('0xc'),_0xf87e39,_0xd346('0xd'));logger[_0xd346('0xe')](_0xd346('0xf'),_0xf87e39,'request\x20sent',JSON[_0xd346('0x10')](_0x252f6e));if(_0x252f6e[_0xd346('0x11')]){if(_0x252f6e['error'][_0xd346('0x12')]===0x1f4){logger[_0xd346('0x11')](_0xd346('0xc'),_0xf87e39,_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);return _0x4cc10a(_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);}logger['error'](_0xd346('0xc'),_0xf87e39,_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);return _0x19a26a(_0x252f6e[_0xd346('0x11')][_0xd346('0x13')]);}else{logger['info'](_0xd346('0xc'),_0xf87e39,'request\x20sent');_0x19a26a(_0x252f6e['result'][_0xd346('0x13')]);}})[_0xd346('0x14')](function(_0x2e5e49){logger[_0xd346('0x11')](_0xd346('0xc'),_0xf87e39,_0x2e5e49);_0x4cc10a(_0x2e5e49);});});}exports[_0xd346('0x15')]=function(_0x1d18fa){var _0x4ce67f=this;return new Promise(function(_0x3a778f,_0x18e227){return db['Trunk']['findAll']({'raw':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa[_0xd346('0x16')][_0xd346('0x17')]===undefined?!![]:![]:!![],'where':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa[_0xd346('0x16')][_0xd346('0x18')]||null:null,'attributes':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa[_0xd346('0x16')]['attributes']||null:null,'limit':_0x1d18fa[_0xd346('0x16')]?_0x1d18fa['options'][_0xd346('0x19')]||null:null,'include':_0x1d18fa['options']?_0x1d18fa['options'][_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x1d18fa[_0xd346('0x16')][_0xd346('0x1a')],function(_0x2950c4){return{'model':db[_0x2950c4[_0xd346('0x1c')]],'as':_0x2950c4['as'],'attributes':_0x2950c4[_0xd346('0x1d')],'include':_0x2950c4[_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x2950c4['include'],function(_0x1d262e){return{'model':db[_0x1d262e[_0xd346('0x1c')]],'as':_0x1d262e['as'],'attributes':_0x1d262e[_0xd346('0x1d')],'include':_0x1d262e['include']?_[_0xd346('0x1b')](_0x1d262e[_0xd346('0x1a')],function(_0x26a3ff){return{'model':db[_0x26a3ff['model']],'as':_0x26a3ff['as'],'attributes':_0x26a3ff[_0xd346('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47796d){logger['info'](_0xd346('0x15'),_0x1d18fa);logger[_0xd346('0xe')](_0xd346('0x15'),_0x1d18fa,JSON[_0xd346('0x10')](_0x47796d));_0x3a778f(_0x47796d);})['catch'](function(_0x16cf6a){logger['error'](_0xd346('0x15'),_0x16cf6a['message'],_0x1d18fa);_0x18e227(_0x4ce67f['error'](0x1f4,_0x16cf6a['message']));});});};exports['ShowTrunk']=function(_0x323ab0){var _0x48af19=this;return new Promise(function(_0x3070dc,_0x43962c){return db['Trunk'][_0xd346('0x1e')]({'raw':_0x323ab0[_0xd346('0x16')]?_0x323ab0[_0xd346('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x323ab0[_0xd346('0x16')]?_0x323ab0[_0xd346('0x16')][_0xd346('0x18')]||null:null,'attributes':_0x323ab0[_0xd346('0x16')]?_0x323ab0[_0xd346('0x16')][_0xd346('0x1d')]||null:null,'include':_0x323ab0['options']?_0x323ab0[_0xd346('0x16')][_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x323ab0[_0xd346('0x16')][_0xd346('0x1a')],function(_0x5d97e8){return{'model':db[_0x5d97e8[_0xd346('0x1c')]],'as':_0x5d97e8['as'],'attributes':_0x5d97e8[_0xd346('0x1d')],'include':_0x5d97e8[_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x5d97e8[_0xd346('0x1a')],function(_0x3cb04b){return{'model':db[_0x3cb04b[_0xd346('0x1c')]],'as':_0x3cb04b['as'],'attributes':_0x3cb04b[_0xd346('0x1d')],'include':_0x3cb04b[_0xd346('0x1a')]?_[_0xd346('0x1b')](_0x3cb04b[_0xd346('0x1a')],function(_0x550159){return{'model':db[_0x550159['model']],'as':_0x550159['as'],'attributes':_0x550159[_0xd346('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd346('0xa')](function(_0x366b87){logger[_0xd346('0xb')](_0xd346('0x1f'),_0x323ab0);logger[_0xd346('0xe')]('ShowTrunk',_0x323ab0,JSON[_0xd346('0x10')](_0x366b87));_0x3070dc(_0x366b87);})[_0xd346('0x14')](function(_0x133323){logger['error'](_0xd346('0x1f'),_0x133323[_0xd346('0x13')],_0x323ab0);_0x43962c(_0x48af19[_0xd346('0x11')](0x1f4,_0x133323[_0xd346('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 95a6944..4fae1f2 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 _0xe886=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/whoami','whoami','show','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','/:id','put','/:id/password','changePassword','delete','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','util','path'];(function(_0x5dc9f3,_0xd522c6){var _0x120426=function(_0x3c32b0){while(--_0x3c32b0){_0x5dc9f3['push'](_0x5dc9f3['shift']());}};_0x120426(++_0xd522c6);}(_0xe886,0xe0));var _0x6e88=function(_0x4fb805,_0x522612){_0x4fb805=_0x4fb805-0x0;var _0xf72291=_0xe886[_0x4fb805];return _0xf72291;};'use strict';var multer=require('multer');var util=require(_0x6e88('0x0'));var path=require(_0x6e88('0x1'));var timeout=require(_0x6e88('0x2'));var express=require(_0x6e88('0x3'));var router=express['Router']();var fs_extra=require(_0x6e88('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6e88('0x5'));var config=require(_0x6e88('0x6'));var controller=require('./user.controller');router['get']('/',auth[_0x6e88('0x7')](),controller['index']);router[_0x6e88('0x8')]('/describe',auth[_0x6e88('0x7')](),controller[_0x6e88('0x9')]);router[_0x6e88('0x8')](_0x6e88('0xa'),auth['isAuthenticated'](),controller[_0x6e88('0xb')]);router[_0x6e88('0x8')]('/presence',auth[_0x6e88('0x7')](),controller['getPresence']);router[_0x6e88('0x8')]('/:id',auth[_0x6e88('0x7')](),controller[_0x6e88('0xc')]);router[_0x6e88('0x8')](_0x6e88('0xd'),controller['getAvatar']);router[_0x6e88('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x6e88('0x8')](_0x6e88('0xe'),auth[_0x6e88('0x7')](),controller[_0x6e88('0xf')]);router['get'](_0x6e88('0x10'),auth['isAuthenticated'](),controller[_0x6e88('0x11')]);router['get'](_0x6e88('0x12'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x6e88('0x8')](_0x6e88('0x13'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x14')]);router['get']('/:id/recordings',auth[_0x6e88('0x7')](),controller[_0x6e88('0x15')]);router[_0x6e88('0x8')](_0x6e88('0x16'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x17')]);router[_0x6e88('0x8')](_0x6e88('0x18'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x19')]);router[_0x6e88('0x8')](_0x6e88('0x1a'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x1b')]);router[_0x6e88('0x8')](_0x6e88('0x1c'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x1d')]);router[_0x6e88('0x8')]('/:id/sms/interactions',auth[_0x6e88('0x7')](),controller['getSmsInteractions']);router[_0x6e88('0x8')](_0x6e88('0x1e'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x1f')]);router[_0x6e88('0x8')](_0x6e88('0x20'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x21')]);router[_0x6e88('0x8')](_0x6e88('0x22'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x23')]);router['get'](_0x6e88('0x24'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x25')]);router[_0x6e88('0x8')](_0x6e88('0x26'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x27')]);router[_0x6e88('0x8')]('/:id/prefixes',auth[_0x6e88('0x7')](),controller[_0x6e88('0x28')]);router[_0x6e88('0x8')](_0x6e88('0x29'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x2a')]);router[_0x6e88('0x8')](_0x6e88('0x2b'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x2c')]);router[_0x6e88('0x8')](_0x6e88('0x2d'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x2e')]);router[_0x6e88('0x8')](_0x6e88('0x2f'),auth['isAuthenticated'](),controller[_0x6e88('0x30')]);router['get'](_0x6e88('0x31'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x32')]);router[_0x6e88('0x8')](_0x6e88('0x33'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x34')]);router['get'](_0x6e88('0x35'),auth[_0x6e88('0x7')](),controller['getSquareProjects']);router[_0x6e88('0x8')](_0x6e88('0x36'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x37')]);router['get'](_0x6e88('0x38'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x6e88('0x39')](_0x6e88('0xe'),auth[_0x6e88('0x7')](),controller['addContacts']);router[_0x6e88('0x39')]('/',auth[_0x6e88('0x7')](),controller[_0x6e88('0x3a')]);router[_0x6e88('0x39')](_0x6e88('0x3b'),auth[_0x6e88('0x7')](),controller['bulkCreate']);router[_0x6e88('0x39')](_0x6e88('0x10'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x3c')]);var upload=multer({'storage':multer[_0x6e88('0x3d')]({'destination':function(_0x1f0f2f,_0x1520ee,_0x274a91){_0x274a91(null,path[_0x6e88('0x3e')](config[_0x6e88('0x3f')],_0x6e88('0x40')));},'filename':function(_0x29b3e3,_0x1c8960,_0x3e3ad3){_0x3e3ad3(null,util[_0x6e88('0x41')]('%s-%s',Date[_0x6e88('0x42')](),_0x1c8960[_0x6e88('0x43')]));}})});router[_0x6e88('0x39')]('/:id/avatar',upload[_0x6e88('0x44')](_0x6e88('0x45')),controller['addAvatar']);router['post'](_0x6e88('0x46'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x47')]);router[_0x6e88('0x39')](_0x6e88('0x48'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x49')]);router[_0x6e88('0x39')](_0x6e88('0x4a'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x4b')]);router[_0x6e88('0x39')](_0x6e88('0x4c'),auth['isAuthenticated'](),controller[_0x6e88('0x4d')]);router[_0x6e88('0x39')](_0x6e88('0x22'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x4e')]);router['post'](_0x6e88('0x4f'),auth[_0x6e88('0x7')](),controller['addChatInteractions']);router[_0x6e88('0x39')]('/:id/mail_interactions',auth[_0x6e88('0x7')](),controller['addMailInteractions']);router['post'](_0x6e88('0x50'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x51')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x6e88('0x52')]);router[_0x6e88('0x39')]('/:id/openchannel_interactions',auth[_0x6e88('0x7')](),controller[_0x6e88('0x53')]);router[_0x6e88('0x39')](_0x6e88('0x54'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x6e88('0x39')]('/:id/fax_accounts',auth[_0x6e88('0x7')](),controller[_0x6e88('0x55')]);router[_0x6e88('0x39')](_0x6e88('0x2b'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x56')]);router[_0x6e88('0x39')](_0x6e88('0x2d'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x57')]);router[_0x6e88('0x39')](_0x6e88('0x2f'),auth['isAuthenticated'](),controller[_0x6e88('0x58')]);router[_0x6e88('0x39')]('/:id/chat_websites',auth[_0x6e88('0x7')](),controller[_0x6e88('0x59')]);router[_0x6e88('0x39')](_0x6e88('0x33'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x5a')]);router['post'](_0x6e88('0x35'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x5b')]);router[_0x6e88('0x39')](_0x6e88('0x38'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x5c')]);router['put'](_0x6e88('0x5d'),auth[_0x6e88('0x7')](),controller['update']);router[_0x6e88('0x5e')](_0x6e88('0x5f'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x60')]);router[_0x6e88('0x61')]('/:id/queues',auth[_0x6e88('0x7')](),controller['removeQueues']);router[_0x6e88('0x61')](_0x6e88('0x22'),auth[_0x6e88('0x7')](),controller['removeTeams']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6e88('0x4f'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x62')]);router['delete'](_0x6e88('0x63'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x64')]);router[_0x6e88('0x61')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x6e88('0x61')](_0x6e88('0x65'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x66')]);router[_0x6e88('0x61')](_0x6e88('0x67'),auth[_0x6e88('0x7')](),controller['removeOpenchannelInteractions']);router[_0x6e88('0x61')](_0x6e88('0x54'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x68')]);router[_0x6e88('0x61')](_0x6e88('0x29'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x69')]);router['delete'](_0x6e88('0x2b'),auth['isAuthenticated'](),controller[_0x6e88('0x6a')]);router[_0x6e88('0x61')]('/:id/openchannel_accounts',auth[_0x6e88('0x7')](),controller[_0x6e88('0x6b')]);router['delete'](_0x6e88('0x2f'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x6c')]);router[_0x6e88('0x61')](_0x6e88('0x31'),auth['isAuthenticated'](),controller[_0x6e88('0x6d')]);router[_0x6e88('0x61')](_0x6e88('0x33'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x6e')]);router[_0x6e88('0x61')](_0x6e88('0x35'),auth[_0x6e88('0x7')](),controller[_0x6e88('0x6f')]);router[_0x6e88('0x61')](_0x6e88('0x38'),auth[_0x6e88('0x7')](),controller['removeApiKey']);module[_0x6e88('0x70')]=router; \ No newline at end of file +var _0x73a2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','whoami','/presence','/:id','show','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','file','/:id/login','login','logout','/:id/pause','pause','/:id/teams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','update','/:id/password','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','exports','multer','util','path','connect-timeout'];(function(_0x582d74,_0x1d54d8){var _0x46f7fc=function(_0x527205){while(--_0x527205){_0x582d74['push'](_0x582d74['shift']());}};_0x46f7fc(++_0x1d54d8);}(_0x73a2,0x6d));var _0x273a=function(_0x32c718,_0x58ef99){_0x32c718=_0x32c718-0x0;var _0x3febe8=_0x73a2[_0x32c718];return _0x3febe8;};'use strict';var multer=require(_0x273a('0x0'));var util=require(_0x273a('0x1'));var path=require(_0x273a('0x2'));var timeout=require(_0x273a('0x3'));var express=require(_0x273a('0x4'));var router=express['Router']();var fs_extra=require(_0x273a('0x5'));var auth=require(_0x273a('0x6'));var interaction=require(_0x273a('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x273a('0x8')]('/',auth[_0x273a('0x9')](),controller[_0x273a('0xa')]);router[_0x273a('0x8')](_0x273a('0xb'),auth[_0x273a('0x9')](),controller[_0x273a('0xc')]);router[_0x273a('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0x273a('0xd')]);router['get'](_0x273a('0xe'),auth[_0x273a('0x9')](),controller['getPresence']);router[_0x273a('0x8')](_0x273a('0xf'),auth[_0x273a('0x9')](),controller[_0x273a('0x10')]);router[_0x273a('0x8')](_0x273a('0x11'),controller['getAvatar']);router[_0x273a('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x273a('0x12')]);router[_0x273a('0x8')](_0x273a('0x13'),auth[_0x273a('0x9')](),controller[_0x273a('0x14')]);router[_0x273a('0x8')]('/:id/queues',auth[_0x273a('0x9')](),controller[_0x273a('0x15')]);router[_0x273a('0x8')](_0x273a('0x16'),auth['isAuthenticated'](),controller[_0x273a('0x17')]);router['get'](_0x273a('0x18'),auth[_0x273a('0x9')](),controller[_0x273a('0x19')]);router['get'](_0x273a('0x1a'),auth[_0x273a('0x9')](),controller['getRecordings']);router[_0x273a('0x8')](_0x273a('0x1b'),auth[_0x273a('0x9')](),controller['getScreenRecordings']);router['get'](_0x273a('0x1c'),auth['isAuthenticated'](),controller[_0x273a('0x1d')]);router[_0x273a('0x8')](_0x273a('0x1e'),auth['isAuthenticated'](),controller[_0x273a('0x1f')]);router[_0x273a('0x8')](_0x273a('0x20'),auth[_0x273a('0x9')](),controller[_0x273a('0x21')]);router[_0x273a('0x8')](_0x273a('0x22'),auth[_0x273a('0x9')](),controller[_0x273a('0x23')]);router['get'](_0x273a('0x24'),auth[_0x273a('0x9')](),controller[_0x273a('0x25')]);router['get'](_0x273a('0x26'),auth['isAuthenticated'](),controller[_0x273a('0x27')]);router['get']('/:id/teams',auth[_0x273a('0x9')](),controller[_0x273a('0x28')]);router[_0x273a('0x8')](_0x273a('0x29'),auth['isAuthenticated'](),controller[_0x273a('0x2a')]);router['get'](_0x273a('0x2b'),auth['isAuthenticated'](),controller['getAgents']);router[_0x273a('0x8')](_0x273a('0x2c'),auth['isAuthenticated'](),controller[_0x273a('0x2d')]);router[_0x273a('0x8')](_0x273a('0x2e'),auth[_0x273a('0x9')](),controller[_0x273a('0x2f')]);router['get'](_0x273a('0x30'),auth[_0x273a('0x9')](),controller[_0x273a('0x31')]);router[_0x273a('0x8')](_0x273a('0x32'),auth[_0x273a('0x9')](),controller[_0x273a('0x33')]);router['get'](_0x273a('0x34'),auth[_0x273a('0x9')](),controller[_0x273a('0x35')]);router[_0x273a('0x8')](_0x273a('0x36'),auth[_0x273a('0x9')](),controller[_0x273a('0x37')]);router[_0x273a('0x8')](_0x273a('0x38'),auth[_0x273a('0x9')](),controller[_0x273a('0x39')]);router[_0x273a('0x8')](_0x273a('0x3a'),auth[_0x273a('0x9')](),controller[_0x273a('0x3b')]);router['get'](_0x273a('0x3c'),auth['isAuthenticated'](),controller['getScheduledCalls']);router['get'](_0x273a('0x3d'),auth[_0x273a('0x9')](),controller['getApiKey']);router[_0x273a('0x3e')](_0x273a('0x13'),auth[_0x273a('0x9')](),controller['addContacts']);router[_0x273a('0x3e')]('/',auth[_0x273a('0x9')](),controller[_0x273a('0x3f')]);router[_0x273a('0x3e')](_0x273a('0x40'),auth[_0x273a('0x9')](),controller[_0x273a('0x41')]);router[_0x273a('0x3e')](_0x273a('0x42'),auth['isAuthenticated'](),controller[_0x273a('0x43')]);var upload=multer({'storage':multer[_0x273a('0x44')]({'destination':function(_0x336308,_0x178c90,_0x5e541a){_0x5e541a(null,path[_0x273a('0x45')](config['root'],_0x273a('0x46')));},'filename':function(_0x240d94,_0x56d9a0,_0x391ac2){_0x391ac2(null,util[_0x273a('0x47')](_0x273a('0x48'),Date[_0x273a('0x49')](),_0x56d9a0[_0x273a('0x4a')]));}})});router[_0x273a('0x3e')](_0x273a('0x11'),upload['single'](_0x273a('0x4b')),controller['addAvatar']);router[_0x273a('0x3e')](_0x273a('0x4c'),auth['isAuthenticated'](),controller[_0x273a('0x4d')]);router[_0x273a('0x3e')]('/:id/logout',auth['isAuthenticated'](),controller[_0x273a('0x4e')]);router[_0x273a('0x3e')](_0x273a('0x4f'),auth[_0x273a('0x9')](),controller[_0x273a('0x50')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0x273a('0x3e')](_0x273a('0x51'),auth[_0x273a('0x9')](),controller['addTeams']);router[_0x273a('0x3e')]('/:id/chat_interactions',auth[_0x273a('0x9')](),controller[_0x273a('0x52')]);router[_0x273a('0x3e')](_0x273a('0x53'),auth[_0x273a('0x9')](),controller['addMailInteractions']);router[_0x273a('0x3e')](_0x273a('0x54'),auth[_0x273a('0x9')](),controller[_0x273a('0x55')]);router[_0x273a('0x3e')](_0x273a('0x56'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x273a('0x3e')](_0x273a('0x57'),auth[_0x273a('0x9')](),controller[_0x273a('0x58')]);router[_0x273a('0x3e')](_0x273a('0x59'),auth[_0x273a('0x9')](),controller[_0x273a('0x5a')]);router[_0x273a('0x3e')](_0x273a('0x2e'),auth['isAuthenticated'](),controller[_0x273a('0x5b')]);router[_0x273a('0x3e')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x273a('0x5c')]);router[_0x273a('0x3e')](_0x273a('0x32'),auth['isAuthenticated'](),controller[_0x273a('0x5d')]);router['post'](_0x273a('0x34'),auth[_0x273a('0x9')](),controller['addSmsAccounts']);router['post'](_0x273a('0x36'),auth['isAuthenticated'](),controller[_0x273a('0x5e')]);router[_0x273a('0x3e')](_0x273a('0x38'),auth[_0x273a('0x9')](),controller[_0x273a('0x5f')]);router[_0x273a('0x3e')](_0x273a('0x3a'),auth['isAuthenticated'](),controller[_0x273a('0x60')]);router[_0x273a('0x3e')](_0x273a('0x3d'),auth['isAuthenticated'](),controller['createApiKey']);router['put']('/:id',auth[_0x273a('0x9')](),controller[_0x273a('0x61')]);router['put'](_0x273a('0x62'),auth[_0x273a('0x9')](),controller[_0x273a('0x63')]);router['delete'](_0x273a('0x42'),auth[_0x273a('0x9')](),controller[_0x273a('0x64')]);router[_0x273a('0x65')]('/:id/teams',auth[_0x273a('0x9')](),controller['removeTeams']);router[_0x273a('0x65')](_0x273a('0xf'),auth[_0x273a('0x9')](),controller[_0x273a('0x66')]);router[_0x273a('0x65')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x273a('0x67')]);router[_0x273a('0x65')]('/:id/mail_interactions',auth[_0x273a('0x9')](),controller['removeMailInteractions']);router['delete'](_0x273a('0x54'),auth['isAuthenticated'](),controller[_0x273a('0x68')]);router[_0x273a('0x65')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x273a('0x65')](_0x273a('0x57'),auth[_0x273a('0x9')](),controller[_0x273a('0x69')]);router['delete'](_0x273a('0x59'),auth[_0x273a('0x9')](),controller[_0x273a('0x6a')]);router[_0x273a('0x65')](_0x273a('0x2e'),auth[_0x273a('0x9')](),controller[_0x273a('0x6b')]);router['delete'](_0x273a('0x30'),auth[_0x273a('0x9')](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x273a('0x9')](),controller[_0x273a('0x6c')]);router[_0x273a('0x65')](_0x273a('0x34'),auth[_0x273a('0x9')](),controller[_0x273a('0x6d')]);router['delete'](_0x273a('0x36'),auth[_0x273a('0x9')](),controller[_0x273a('0x6e')]);router[_0x273a('0x65')](_0x273a('0x38'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x273a('0x65')]('/:id/square_projects',auth[_0x273a('0x9')](),controller[_0x273a('0x6f')]);router[_0x273a('0x65')](_0x273a('0x3d'),auth[_0x273a('0x9')](),controller['removeApiKey']);module[_0x273a('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d4d2156..d42f72c 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 _0x3445=['\x22\x22\x20<>','always','uac','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','isArray','wss','udp','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','lodash','exports','STRING','name','setDataValue','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','peer','from-sip','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','join','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x3445,0x132));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5344('0x0'));var moment=require(_0x5344('0x1'));var util=require('util');var _=require(_0x5344('0x2'));module[_0x5344('0x3')]={'name':{'type':Sequelize[_0x5344('0x4')],'allowNull':![],'unique':_0x5344('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x35cb3e){this[_0x5344('0x6')](_0x5344('0x5'),_0x35cb3e);this[_0x5344('0x6')]('defaultuser',_0x35cb3e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x29fead){this[_0x5344('0x6')](_0x5344('0x7'),_0x29fead);this['setDataValue'](_0x5344('0x8'),util['format'](_0x5344('0x9'),_0x29fead,this[_0x5344('0xa')](_0x5344('0xb'))));}},'alias':{'type':Sequelize[_0x5344('0x4')]},'email':{'type':Sequelize[_0x5344('0x4')],'allowNull':![],'unique':_0x5344('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3225bf){if(_0x3225bf){this['setDataValue'](_0x5344('0xc'),_0x3225bf[_0x5344('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x5344('0xe'),_0x5344('0xf'),_0x5344('0x10'),_0x5344('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x5344('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x5344('0x12')},'internal':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':![],'unique':_0x5344('0xb'),'set':function(_0x21a2b3){this[_0x5344('0x6')](_0x5344('0xb'),_0x21a2b3);this[_0x5344('0x6')]('accountcode',_0x21a2b3);this[_0x5344('0x6')]('callerid',util[_0x5344('0x14')]('\x22%s\x22\x20<%s>',this[_0x5344('0xa')](_0x5344('0x7')),_0x21a2b3));}},'salt':{'type':Sequelize[_0x5344('0x4')]},'phone':{'type':Sequelize[_0x5344('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x5344('0x4')]},'zipcode':{'type':Sequelize[_0x5344('0x4')]},'userpic':{'type':Sequelize[_0x5344('0x4')]},'city':{'type':Sequelize[_0x5344('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5344('0x16')]},'voicePause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5344('0x4')],'defaultValue':_0x5344('0x17')},'lastPauseAt':{'type':Sequelize[_0x5344('0x16')]},'chatCapacity':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5344('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5344('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![],'defaultValue':_0x5344('0x18')},'ipaddr':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x5344('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5344('0x19')]('friend',_0x5344('0xf'),_0x5344('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![],'defaultValue':_0x5344('0x1b')},'callingpres':{'type':Sequelize[_0x5344('0x19')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x5344('0x1c'),_0x5344('0x1d'),_0x5344('0x1e'),_0x5344('0x1f'),_0x5344('0x20'),_0x5344('0x21')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x30250e){this[_0x5344('0x6')]('transport',_0x30250e?_0x30250e['join'](','):null);},'get':function(){return this['getDataValue'](_0x5344('0x22'))?this[_0x5344('0xa')]('transport')[_0x5344('0x23')](','):null;},'comment':_0x5344('0x24')},'dtmfmode':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x25'),_0x5344('0x26'),_0x5344('0x27'),_0x5344('0x28'),_0x5344('0x29')),'allowNull':!![],'defaultValue':_0x5344('0x25')},'directmedia':{'type':Sequelize[_0x5344('0x19')]('yes','no',_0x5344('0x2a'),_0x5344('0x2b'),_0x5344('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![],'defaultValue':_0x5344('0x2e'),'set':function(_0x33973d){this[_0x5344('0x6')](_0x5344('0x2f'),_0x33973d?_0x33973d[_0x5344('0x30')](','):null);},'get':function(){return this[_0x5344('0xa')](_0x5344('0x2f'))?this['getDataValue'](_0x5344('0x2f'))[_0x5344('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5344('0x4')]},'namedcallgroup':{'type':Sequelize[_0x5344('0x4')]},'pickupgroup':{'type':Sequelize[_0x5344('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x5344('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5344('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x5344('0x4')],'allowNull':![],'defaultValue':_0x5344('0x31'),'set':function(_0x3d3a10){this['setDataValue'](_0x5344('0x32'),_0x3d3a10?_0x3d3a10[_0x5344('0x30')](';'):_0x5344('0x31'));},'get':function(){return this[_0x5344('0xa')]('allow')?this[_0x5344('0xa')](_0x5344('0x32'))[_0x5344('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x5344('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![],'set':function(_0x41a8a3){this['setDataValue'](_0x5344('0x33'),_0x41a8a3?_0x41a8a3[_0x5344('0x30')](','):null);},'get':function(){return this[_0x5344('0xa')](_0x5344('0x33'))?this[_0x5344('0xa')](_0x5344('0x33'))[_0x5344('0x23')](','):null;},'comment':_0x5344('0x34')},'trustrpid':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no',_0x5344('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![],'defaultValue':_0x5344('0x36')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x5344('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x5344('0x2d'),'no',_0x5344('0x37')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5344('0x19')]('accept','refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x38'),_0x5344('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5344('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no',_0x5344('0x3a'),_0x5344('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x5344('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x3c'),_0x5344('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5344('0x19')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no',_0x5344('0x2a'),'update',_0x5344('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5344('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x5344('0x16')]},'passwordResetAt':{'type':Sequelize[_0x5344('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5344('0x3f')]},'showWebBar':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0,'set':function(_0x1f67e0){this[_0x5344('0x6')](_0x5344('0x40'),_0x1f67e0);var _0x2a8c82=this['get']({'plain':!![]});switch(_0x1f67e0){case 0x0:case 0x1:var _0x45f660=_0x2a8c82[_0x5344('0x22')]?_[_0x5344('0x41')](_0x2a8c82[_0x5344('0x22')])?_0x2a8c82[_0x5344('0x22')][_0x5344('0x30')]():_0x2a8c82[_0x5344('0x22')]:'udp';if(_0x45f660===_0x5344('0x42')){_0x45f660=_0x5344('0x43');}this['setDataValue']('transport',_0x45f660);this['setDataValue'](_0x5344('0x44'),'no');this['setDataValue'](_0x5344('0x45'),null);this[_0x5344('0x6')]('force_avp',null);this['setDataValue'](_0x5344('0x46'),null);this[_0x5344('0x6')](_0x5344('0x47'),null);this[_0x5344('0x6')](_0x5344('0x48'),null);this[_0x5344('0x6')](_0x5344('0x49'),null);this['setDataValue'](_0x5344('0x4a'),null);this[_0x5344('0x6')](_0x5344('0x4b'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x5344('0x6')](_0x5344('0x22'),_0x5344('0x42'));this[_0x5344('0x6')](_0x5344('0x44'),_0x5344('0x2d'));this[_0x5344('0x6')]('avpf',_0x5344('0x2d'));this[_0x5344('0x6')]('force_avp',_0x5344('0x2d'));this[_0x5344('0x6')](_0x5344('0x46'),_0x5344('0x2d'));this['setDataValue'](_0x5344('0x47'),_0x5344('0x2d'));this[_0x5344('0x6')](_0x5344('0x48'),'no');this[_0x5344('0x6')](_0x5344('0x49'),_0x5344('0x4c'));this[_0x5344('0x6')](_0x5344('0x4a'),_0x2a8c82['dtlscertfile']||_0x5344('0x4d'));this[_0x5344('0x6')](_0x5344('0x4b'),_0x2a8c82[_0x5344('0x4b')]||_0x5344('0x4e'));this[_0x5344('0x6')](_0x5344('0x4f'),_0x5344('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x5344('0x3f')],'set':function(_0x2a3554){this[_0x5344('0x6')]('permissions',_0x2a3554?_0x2a3554['join'](','):[]);},'get':function(){return this[_0x5344('0xa')](_0x5344('0x50'))?_[_0x5344('0x51')](this[_0x5344('0xa')](_0x5344('0x50'))[_0x5344('0x23')](','),function(_0x5c779c){return parseInt(_0x5c779c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x5344('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5344('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x5344('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5344('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5344('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5344('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5344('0x19')](_0x5344('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5344('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5344('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5344('0x52')],'get':function(){return this[_0x5344('0xa')](_0x5344('0x53'))?this[_0x5344('0xa')](_0x5344('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5344('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5344('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![],'set':function(_0x5c286d){if(typeof _0x5c286d==='string'){var _0x591223=_0x5c286d==='1'?!![]:_0x5c286d==='0'?![]:_0x5c286d===_0x5344('0x54')?!![]:_0x5c286d===_0x5344('0x55')?![]:![];this[_0x5344('0x6')]('screenrecording',_0x591223);}else{this[_0x5344('0x6')](_0x5344('0x56'),_0x5c286d);}}},'blocked':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![],'set':function(_0x4bf2f2){this[_0x5344('0x6')](_0x5344('0x57'),_0x4bf2f2);if(_0x4bf2f2===!![]){this[_0x5344('0x6')]('blockedAt',moment());this[_0x5344('0x6')](_0x5344('0x58'),0x0);}else{this[_0x5344('0x6')](_0x5344('0x59'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5344('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5344('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5344('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5344('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5344('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xa181=['encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','originate','uac','uas','fingerprint','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa181,0xbe));var _0x1a18=function(_0x443913,_0x33f0fb){_0x443913=_0x443913-0x0;var _0xda11cd=_0xa181[_0x443913];return _0xda11cd;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require(_0x1a18('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a18('0x1')],'allowNull':![],'unique':_0x1a18('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1aebfc){this[_0x1a18('0x3')](_0x1a18('0x2'),_0x1aebfc);this[_0x1a18('0x3')](_0x1a18('0x4'),_0x1aebfc);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x58b916){this[_0x1a18('0x3')](_0x1a18('0x5'),_0x58b916);this[_0x1a18('0x3')](_0x1a18('0x6'),util[_0x1a18('0x7')](_0x1a18('0x8'),_0x58b916,this[_0x1a18('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x1a18('0x1')]},'email':{'type':Sequelize[_0x1a18('0x1')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x59f026){if(_0x59f026){this[_0x1a18('0x3')](_0x1a18('0xa'),_0x59f026[_0x1a18('0xb')]());}}},'role':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0xd'),_0x1a18('0xe'),_0x1a18('0xf'),_0x1a18('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':_0x1a18('0x11')},'internal':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':![],'unique':_0x1a18('0x13'),'set':function(_0x475a64){this[_0x1a18('0x3')]('internal',_0x475a64);this[_0x1a18('0x3')](_0x1a18('0x14'),_0x475a64);this[_0x1a18('0x3')](_0x1a18('0x6'),util[_0x1a18('0x7')](_0x1a18('0x8'),this[_0x1a18('0x9')]('fullname'),_0x475a64));}},'salt':{'type':Sequelize[_0x1a18('0x1')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1a18('0x1')]},'address':{'type':Sequelize[_0x1a18('0x1')]},'zipcode':{'type':Sequelize[_0x1a18('0x1')]},'userpic':{'type':Sequelize[_0x1a18('0x1')]},'city':{'type':Sequelize[_0x1a18('0x1')]},'country':{'type':Sequelize[_0x1a18('0x1')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':_0x1a18('0x16')},'lastPauseAt':{'type':Sequelize[_0x1a18('0x17')]},'chatCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x1a18('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1a18('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'host':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x1a18('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1a18('0xc')]('friend',_0x1a18('0xe'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x1a18('0x18'),_0x1a18('0x19'),_0x1a18('0x1a'),_0x1a18('0x1b'),_0x1a18('0x1c'),_0x1a18('0x1d'),_0x1a18('0x1e'),_0x1a18('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':_0x1a18('0x20'),'set':function(_0x5c97bb){this[_0x1a18('0x3')](_0x1a18('0x21'),_0x5c97bb?_0x5c97bb[_0x1a18('0x22')](','):null);},'get':function(){return this[_0x1a18('0x9')]('transport')?this[_0x1a18('0x9')]('transport')['split'](','):null;},'comment':_0x1a18('0x23')},'dtmfmode':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x24'),'info',_0x1a18('0x25'),_0x1a18('0x26'),_0x1a18('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no',_0x1a18('0x29'),_0x1a18('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':_0x1a18('0x2b'),'set':function(_0x331612){this[_0x1a18('0x3')](_0x1a18('0x2c'),_0x331612?_0x331612['join'](','):null);},'get':function(){return this[_0x1a18('0x9')]('nat')?this['getDataValue'](_0x1a18('0x2c'))[_0x1a18('0x2d')](','):null;},'comment':_0x1a18('0x2e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1a18('0x1')]},'pickupgroup':{'type':Sequelize[_0x1a18('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1a18('0x1')]},'language':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a18('0x2f')},'allow':{'type':Sequelize[_0x1a18('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xe6c3f0){this[_0x1a18('0x3')](_0x1a18('0x30'),_0xe6c3f0?_0xe6c3f0[_0x1a18('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x30'))?this['getDataValue'](_0x1a18('0x30'))[_0x1a18('0x2d')](';'):null;},'comment':_0x1a18('0x31')},'autoframing':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'set':function(_0x3477f0){this[_0x1a18('0x3')](_0x1a18('0x32'),_0x3477f0?_0x3477f0[_0x1a18('0x22')](','):null);},'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x32'))?this[_0x1a18('0x9')]('insecure')[_0x1a18('0x2d')](','):null;},'comment':_0x1a18('0x33')},'trustrpid':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![],'defaultValue':_0x1a18('0x34')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1a18('0x28')},'busylevel':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'template':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x35'),'refuse',_0x1a18('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x37'),_0x1a18('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':_0x1a18('0x28')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no',_0x1a18('0x39'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active','passive',_0x1a18('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1a18('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1a18('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1a18('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1a18('0x1')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no','nonat',_0x1a18('0x2a'),_0x1a18('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1a18('0x1')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x1a18('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1a18('0x3c')]},'showWebBar':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0,'set':function(_0x5f1517){this['setDataValue'](_0x1a18('0x3d'),_0x5f1517);var _0x3b04f6=this[_0x1a18('0x3e')]({'plain':!![]});switch(_0x5f1517){case 0x0:case 0x1:var _0x1363c0=_0x3b04f6['transport']?_[_0x1a18('0x3f')](_0x3b04f6[_0x1a18('0x21')])?_0x3b04f6['transport'][_0x1a18('0x22')]():_0x3b04f6[_0x1a18('0x21')]:_0x1a18('0x20');if(_0x1363c0===_0x1a18('0x40')){_0x1363c0='udp';}this[_0x1a18('0x3')](_0x1a18('0x21'),_0x1363c0);this[_0x1a18('0x3')](_0x1a18('0x41'),'no');this[_0x1a18('0x3')](_0x1a18('0x42'),null);this['setDataValue'](_0x1a18('0x43'),null);this[_0x1a18('0x3')](_0x1a18('0x44'),null);this[_0x1a18('0x3')]('dtlsenable',null);this['setDataValue'](_0x1a18('0x45'),null);this[_0x1a18('0x3')](_0x1a18('0x46'),null);this[_0x1a18('0x3')](_0x1a18('0x47'),null);this[_0x1a18('0x3')](_0x1a18('0x48'),null);this[_0x1a18('0x3')](_0x1a18('0x49'),'no');break;case 0x2:this['setDataValue'](_0x1a18('0x21'),_0x1a18('0x40'));this[_0x1a18('0x3')](_0x1a18('0x41'),'yes');this[_0x1a18('0x3')]('avpf',_0x1a18('0x28'));this[_0x1a18('0x3')](_0x1a18('0x43'),_0x1a18('0x28'));this['setDataValue']('icesupport',_0x1a18('0x28'));this['setDataValue'](_0x1a18('0x4a'),_0x1a18('0x28'));this[_0x1a18('0x3')](_0x1a18('0x45'),'no');this[_0x1a18('0x3')](_0x1a18('0x46'),_0x1a18('0x3a'));this[_0x1a18('0x3')](_0x1a18('0x47'),_0x3b04f6['dtlscertfile']||_0x1a18('0x4b'));this[_0x1a18('0x3')](_0x1a18('0x48'),_0x3b04f6[_0x1a18('0x48')]||'/etc/pki/tls/private/motion.key');this[_0x1a18('0x3')](_0x1a18('0x49'),_0x1a18('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x1a18('0x3c')],'set':function(_0x4a2804){this[_0x1a18('0x3')](_0x1a18('0x4c'),_0x4a2804?_0x4a2804[_0x1a18('0x22')](','):[]);},'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x4c'))?_[_0x1a18('0x4d')](this['getDataValue'](_0x1a18('0x4c'))[_0x1a18('0x2d')](','),function(_0x3442e7){return parseInt(_0x3442e7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1a18('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1a18('0x1')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1a18('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1a18('0xc')](_0x1a18('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x1a18('0x1')]},'phoneBarEnableJaws':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1a18('0x4e')],'get':function(){return this[_0x1a18('0x9')](_0x1a18('0x4f'))?this[_0x1a18('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x1a18('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![],'set':function(_0xf8531a){if(typeof _0xf8531a==='string'){var _0x116c72=_0xf8531a==='1'?!![]:_0xf8531a==='0'?![]:_0xf8531a===_0x1a18('0x50')?!![]:_0xf8531a===_0x1a18('0x51')?![]:![];this['setDataValue'](_0x1a18('0x52'),_0x116c72);}else{this[_0x1a18('0x3')](_0x1a18('0x52'),_0xf8531a);}}},'blocked':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![],'set':function(_0x2bc684){this[_0x1a18('0x3')](_0x1a18('0x53'),_0x2bc684);if(_0x2bc684===!![]){this[_0x1a18('0x3')](_0x1a18('0x54'),moment());this[_0x1a18('0x3')]('loginAttempts',0x0);}else{this[_0x1a18('0x3')](_0x1a18('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1a18('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1a18('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x1a18('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 135e4bb..51bb00f 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 _0xc4aa=['dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','queues','isEmpty','teams','col','toString','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','pause','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','field','ui.','InteractionId','OpenTabs','moment','bluebird','util','path','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','get','role','admin','user','agent','telephone','filter','ignore','map','value','includes','find','name','destroy','then','sendStatus','stack','send','index','User','rawAttributes','fieldName','password','salt','getOptions','where','include','attributes','push','findAll','rows','openTabs','true','chat','dataValues','sms','fax','mail','show','params','differenceBy','keys','query','filters','intersection','model','fields','length','includeAll','merge','openchannel','whatsapp','all','update','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','permissions','102','110','105','108','109','100','115','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','settingsEnabled','userProfileId','create','UserProfileSection','Telephones','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','Agents','autoAssociation','compact','UserProfileResource','changePassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','VoiceQueue','format','each','upsert','remove','isArray','QueueId','Queue:remove','voice','UserVoiceQueueRt','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','order','sort','pick','options','hasOwnProperty','List','Tag','Tags','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','SIP/%s','intrf','user:%s','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','manual','%s%s','Pause','Team','getTeams','addTeams','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getOpenchannelQueues','flatten','addAgent','getDataValue','Queue:save','TeamVoicePrefix','UserVoicePrefix','getWhatsappQueues','getFaxQueues','Fax','Openchannel','transaction','VoicePrefixId','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$overlap','$any','lastName'];(function(_0x5e46ba,_0x12afee){var _0x1aa3f9=function(_0x4dee6c){while(--_0x4dee6c){_0x5e46ba['push'](_0x5e46ba['shift']());}};_0x1aa3f9(++_0x12afee);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var moment=require(_0xac4a('0x0'));var BPromise=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var path=require(_0xac4a('0x3'));var fs=require('fs');var _=require(_0xac4a('0x4'));var squel=require(_0xac4a('0x5'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac4a('0x6'));var logger=require(_0xac4a('0x7'))(_0xac4a('0x8'));var utils=require(_0xac4a('0x9'));var config=require(_0xac4a('0xa'));var licenseUtil=require(_0xac4a('0xb'));var db=require(_0xac4a('0xc'))['db'];var socket=require(_0xac4a('0xd'))(new Redis(config['redis']));require('./user.socket')[_0xac4a('0xe')](socket);config[_0xac4a('0xf')]=_[_0xac4a('0x10')](config['redis'],{'host':_0xac4a('0x11'),'port':0x18eb});var client=jayson[_0xac4a('0x12')][_0xac4a('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4d4acc,_0x30135d,_0x488e3c,_0x2f062c){return new BPromise(function(_0x4855b6,_0x333ca5){var _0x2a0776=_0x2f062c||client;return _0x2a0776[_0xac4a('0x14')](_0x4d4acc,_0x488e3c)['then'](function(_0x21a79){logger[_0xac4a('0x15')](_0xac4a('0x16'),_0x30135d,_0xac4a('0x17'));logger[_0xac4a('0x18')](_0xac4a('0x19'),_0x30135d,_0xac4a('0x17'),JSON[_0xac4a('0x1a')](_0x21a79));if(_0x21a79[_0xac4a('0x1b')]){if(_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1c')]===0x1f4){logger[_0xac4a('0x1b')]('User,\x20%s,\x20%s',_0x30135d,_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1d')]);return _0x333ca5(_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1d')]);}logger[_0xac4a('0x1b')](_0xac4a('0x16'),_0x30135d,_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1d')]);return _0x4855b6(_0x21a79['error']['message']);}else{logger[_0xac4a('0x15')](_0xac4a('0x16'),_0x30135d,_0xac4a('0x17'));_0x4855b6(_0x21a79['result'][_0xac4a('0x1d')]);}})[_0xac4a('0x1e')](function(_0x3752e4){logger[_0xac4a('0x1b')](_0xac4a('0x16'),_0x30135d,_0x3752e4);_0x333ca5(_0x3752e4);});});}function respondWithStatusCode(_0x3e829c,_0xe38996){_0xe38996=_0xe38996||0xcc;return function(_0x3ca790){if(_0x3ca790){return _0x3e829c['sendStatus'](_0xe38996);}return _0x3e829c[_0xac4a('0x1f')](_0xe38996)[_0xac4a('0x20')]();};}function respondWithResult(_0x599787,_0x3d7ce0){_0x3d7ce0=_0x3d7ce0||0xc8;return function(_0x4169c0){if(_0x4169c0){return _0x599787[_0xac4a('0x1f')](_0x3d7ce0)[_0xac4a('0x21')](_0x4169c0);}};}function respondWithFilteredResult(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){var _0x15435c=typeof _0x1b7998[_0xac4a('0x22')]===_0xac4a('0x23')&&typeof _0x1b7998[_0xac4a('0x24')]===_0xac4a('0x23');var _0x36054a=_0x2503d8[_0xac4a('0x25')];var _0x3bc318=_0x15435c?0x0:_0x1b7998[_0xac4a('0x22')];var _0x215a31=_0x15435c?_0x2503d8[_0xac4a('0x25')]:_0x1b7998[_0xac4a('0x22')]+_0x1b7998[_0xac4a('0x24')];var _0x20202c;if(_0x215a31>=_0x36054a){_0x215a31=_0x36054a;_0x20202c=0xc8;}else{_0x20202c=0xce;}_0x4d2d6c['status'](_0x20202c);return _0x4d2d6c[_0xac4a('0x26')](_0xac4a('0x27'),_0x3bc318+'-'+_0x215a31+'/'+_0x36054a)[_0xac4a('0x21')](_0x2503d8);}return null;};}function saveUpdates(_0x2772fe){return function(_0x116700){if(_0x116700){return _0x116700['update'](_0x2772fe)['then'](function(_0xdb7e){return _0xdb7e;});}return null;};}function removeEntity(_0x7a948b){return function(_0x1f12d5){if(_0x1f12d5){return _0x1f12d5['destroy']()['then'](function(){var _0x355755=_0x1f12d5[_0xac4a('0x28')]({'plain':!![]});if(_0x355755[_0xac4a('0x29')]===_0xac4a('0x2a'))return;var _0x17118e=[{'name':'Users','value':_0xac4a('0x2b'),'ignore':!![]},{'name':'Agents','value':_0xac4a('0x2c'),'ignore':![]},{'name':'Telephones','value':_0xac4a('0x2d'),'ignore':![]}];var _0xfbe355=_(_0x17118e)[_0xac4a('0x2e')](_0xac4a('0x2f'))[_0xac4a('0x30')](_0xac4a('0x31'))[_0xac4a('0x31')]();if(_[_0xac4a('0x32')](_0xfbe355,_0x355755[_0xac4a('0x29')])){return;}var _0xfd7c16=_[_0xac4a('0x33')](_0x17118e,[_0xac4a('0x31'),_0x355755[_0xac4a('0x29')]])[_0xac4a('0x34')];return db['UserProfileResource'][_0xac4a('0x35')]({'where':{'type':_0xfd7c16,'resourceId':_0x355755['id']}})[_0xac4a('0x36')](function(){return _0x1f12d5;});})['then'](function(){_0x7a948b[_0xac4a('0x1f')](0xcc)[_0xac4a('0x20')]();});}};}function handleEntityNotFound(_0x565164){return function(_0x58804b){if(!_0x58804b){_0x565164[_0xac4a('0x37')](0x194);}return _0x58804b;};}function handleError(_0x1ba096,_0x1b42b6){_0x1b42b6=_0x1b42b6||0x1f4;return function(_0x3de9e2){logger['error'](_0x3de9e2[_0xac4a('0x38')]);if(_0x3de9e2[_0xac4a('0x34')]){delete _0x3de9e2['name'];}_0x1ba096[_0xac4a('0x1f')](_0x1b42b6)[_0xac4a('0x39')](_0x3de9e2);};}exports[_0xac4a('0x3a')]=function(_0x5f0eb8,_0x121328){var _0x357f06={},_0x1b5427={'count':0x0,'rows':[]};var _0x4e0445=_(db[_0xac4a('0x3b')][_0xac4a('0x3c')])['map'](function(_0x59bebf){return{'name':_0x59bebf[_0xac4a('0x3d')],'type':_0x59bebf['type']['key']};})['filter'](function(_0x4fee3a){return!_[_0xac4a('0x32')]([_0xac4a('0x3e'),_0xac4a('0x3f')],_0x4fee3a[_0xac4a('0x34')]);})[_0xac4a('0x31')]();_0x357f06=qs[_0xac4a('0x40')](_0x4e0445,_0x5f0eb8);var _0x4220e2={'where':_0x357f06[_0xac4a('0x41')]};return db[_0xac4a('0x3b')][_0xac4a('0x25')](_0x4220e2)[_0xac4a('0x36')](function(_0x1c2a87){_0x1b5427['count']=_0x1c2a87;if(_0x5f0eb8['query']['includeAll']){_0x357f06[_0xac4a('0x42')]=[{'all':!![]}];}if(!_[_0xac4a('0x32')](_0x357f06[_0xac4a('0x43')],'id')){_0x357f06[_0xac4a('0x43')][_0xac4a('0x44')]('id');}return db[_0xac4a('0x3b')][_0xac4a('0x45')](_0x357f06);})[_0xac4a('0x36')](function(_0x3e9973){_0x1b5427[_0xac4a('0x46')]=_0x3e9973;if(_0x5f0eb8['query'][_0xac4a('0x47')]===_0xac4a('0x48')){var _0x3d9595=[];for(var _0x3f24a1=0x0;_0x3f24a1<_0x1b5427[_0xac4a('0x46')]['length'];_0x3f24a1++){_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x49'),_0x1b5427['rows'][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595['push'](get_open_tabs(_0xac4a('0x4b'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4c'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4d'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs('openchannel',_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs('whatsapp',_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));}return BPromise['all'](_0x3d9595)[_0xac4a('0x36')](function(_0x5a7f6e){return _0x1b5427;});}else{return _0x1b5427;}})[_0xac4a('0x36')](respondWithFilteredResult(_0x121328,_0x357f06))[_0xac4a('0x1e')](handleError(_0x121328,null));};exports[_0xac4a('0x4e')]=function(_0x5e3581,_0x588374){var _0x42fd9d={'raw':![],'where':{'id':_0x5e3581[_0xac4a('0x4f')]['id']}},_0x4aaeff={};_0x4aaeff['model']=_[_0xac4a('0x50')](_['keys'](db[_0xac4a('0x3b')][_0xac4a('0x3c')]),[_0xac4a('0x3e'),_0xac4a('0x3f')]);_0x4aaeff['query']=_[_0xac4a('0x51')](_0x5e3581[_0xac4a('0x52')]);_0x4aaeff[_0xac4a('0x53')]=_[_0xac4a('0x54')](_0x4aaeff[_0xac4a('0x55')],_0x4aaeff[_0xac4a('0x52')]);_0x42fd9d[_0xac4a('0x43')]=_['intersection'](_0x4aaeff[_0xac4a('0x55')],qs[_0xac4a('0x56')](_0x5e3581['query'][_0xac4a('0x56')]));_0x42fd9d[_0xac4a('0x43')]=_0x42fd9d[_0xac4a('0x43')][_0xac4a('0x57')]?_0x42fd9d['attributes']:_0x4aaeff[_0xac4a('0x55')];if(_0x5e3581[_0xac4a('0x52')][_0xac4a('0x58')]){_0x42fd9d[_0xac4a('0x42')]=[{'all':!![]}];}_0x42fd9d=_[_0xac4a('0x59')]({},_0x42fd9d,_0x5e3581['options']);if(!_[_0xac4a('0x32')](_0x42fd9d['attributes'],'id')){_0x42fd9d[_0xac4a('0x43')][_0xac4a('0x44')]('id');}return db['User']['find'](_0x42fd9d)[_0xac4a('0x36')](handleEntityNotFound(_0x588374,null))[_0xac4a('0x36')](function(_0x4d448f){var _0x18d29c=[];values=_0x4d448f;if(_0x5e3581[_0xac4a('0x52')][_0xac4a('0x47')]===_0xac4a('0x48')){_0x18d29c['push'](get_open_tabs(_0xac4a('0x49'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4b'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5a'),_0x4d448f['dataValues']));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5b'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4c'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4d'),_0x4d448f[_0xac4a('0x4a')]));return BPromise[_0xac4a('0x5c')](_0x18d29c);}else{return values;}})[_0xac4a('0x36')](function(_0x38dd4f){return values;})[_0xac4a('0x36')](respondWithResult(_0x588374,null))[_0xac4a('0x1e')](handleError(_0x588374,null));};exports[_0xac4a('0x5d')]=function(_0x11c753,_0x492aae){if(_0x11c753[_0xac4a('0x5e')]['id']){delete _0x11c753['body']['id'];}delete _0x11c753[_0xac4a('0x5e')]['role'];return db[_0xac4a('0x3b')]['find']({'where':{'id':_0x11c753[_0xac4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x492aae,null))['then'](saveUpdates(_0x11c753[_0xac4a('0x5e')],null))[_0xac4a('0x36')](respondWithResult(_0x492aae,null))[_0xac4a('0x1e')](handleError(_0x492aae,null));};exports[_0xac4a('0x5f')]=function(_0x2f9940,_0xb7b884){return db['User'][_0xac4a('0x5f')]()['then'](respondWithResult(_0xb7b884,null))[_0xac4a('0x1e')](handleError(_0xb7b884,null));};exports['addContacts']=function(_0x347880,_0x19ce2c){return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x347880[_0xac4a('0x4f')]['id']}})[_0xac4a('0x36')](handleEntityNotFound(_0x19ce2c,null))[_0xac4a('0x36')](function(_0xe3e375){if(_0xe3e375){return _0xe3e375[_0xac4a('0x60')](_0x347880[_0xac4a('0x5e')][_0xac4a('0x61')],_[_0xac4a('0x62')](_0x347880[_0xac4a('0x5e')],[_0xac4a('0x61'),'id'])||{});}})[_0xac4a('0x36')](respondWithResult(_0x19ce2c,null))[_0xac4a('0x1e')](handleError(_0x19ce2c,null));};function validateUser(_0x38cb4f){return new BPromise(function(_0x4a0156,_0xa90d71){if(_0x38cb4f[_0xac4a('0x63')])return _0x4a0156(_0x38cb4f);return db['Setting'][_0xac4a('0x64')](0x1)[_0xac4a('0x36')](function(_0x2d24c7){if(_0x2d24c7[_0xac4a('0x65')])authService[_0xac4a('0x66')](_0x38cb4f['password']);db['User'][_0xac4a('0x67')](_0xac4a('0x63'))[_0xac4a('0x36')](function(_0x148288){if(_[_0xac4a('0x68')](_0x148288)){_0x38cb4f[_0xac4a('0x63')]=_0x2d24c7[_0xac4a('0x69')]||0x1;return;}if(_[_0xac4a('0x68')](_0x2d24c7[_0xac4a('0x69')])||_0x2d24c7[_0xac4a('0x69')]===_0x148288){_0x38cb4f[_0xac4a('0x63')]=_0x148288+0x1;return;}if(_0x2d24c7['min_internal']>_0x148288){_0x38cb4f['internal']=_0x2d24c7[_0xac4a('0x69')];return;}return db[_0xac4a('0x6a')][_0xac4a('0x52')](_0xac4a('0x6b'),{'type':db[_0xac4a('0x6a')][_0xac4a('0x6c')][_0xac4a('0x6d')]})[_0xac4a('0x36')](function(_0x453d62){if(_0x453d62&&_0x453d62[_0xac4a('0x57')]){for(var _0xb09b89=0x0,_0xb12cc5=_0x453d62['length'];_0xb09b89<_0xb12cc5&&_[_0xac4a('0x68')](_0x38cb4f[_0xac4a('0x63')]);_0xb09b89++){if(_0x2d24c7[_0xac4a('0x69')]<=_0x453d62[_0xb09b89][_0xac4a('0x6e')]){_0x38cb4f['internal']=_0x453d62[_0xb09b89][_0xac4a('0x6e')];}else if(_0x2d24c7['min_internal']>_0x453d62[_0xb09b89][_0xac4a('0x6e')]&&_0x2d24c7[_0xac4a('0x69')]<=_0x453d62[_0xb09b89]['to']){_0x38cb4f['internal']=_0x2d24c7['min_internal'];}}}if(_[_0xac4a('0x68')](_0x38cb4f[_0xac4a('0x63')])){_0x38cb4f[_0xac4a('0x63')]=_0x148288+0x1;}return _0x4a0156(_0x38cb4f);});});})['catch'](function(_0x3a0cf8){_0xa90d71(_0x3a0cf8);});});}function updateUser(_0x4d067d){return new BPromise(function(_0x114b11,_0x4a88c7){try{if(_0x4d067d['voicemail']){_0x4d067d[_0xac4a('0x6f')]=_0x4d067d['internal'];_0x4d067d[_0xac4a('0x70')]={'mailbox':_0x4d067d['internal'],'password':_0x4d067d[_0xac4a('0x3e')],'fullname':_0x4d067d[_0xac4a('0x71')],'email':_0x4d067d['email']};}if(_0x4d067d[_0xac4a('0x29')]==='agent'){if(!_0x4d067d[_0xac4a('0x72')])_0x4d067d[_0xac4a('0x72')]=['101',_0xac4a('0x73'),'103','113',_0xac4a('0x74'),'104',_0xac4a('0x75'),'106','107',_0xac4a('0x76'),_0xac4a('0x77'),_0xac4a('0x78'),'111','114',_0xac4a('0x79')];}_0x114b11(_0x4d067d);}catch(_0x9c0fa1){_0x4a88c7(_0x9c0fa1);}});}exports['create']=function(_0x4e93f5,_0x3824a2){if(_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x29')]===_0xac4a('0x2c'))throw new Error(_0xac4a('0x7a'));if(_0x4e93f5[_0xac4a('0x5e')][_0xac4a('0x29')]===_0xac4a('0x2b')&&_0x4e93f5[_0xac4a('0x2b')]['role']!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7b'));}if(_0x4e93f5[_0xac4a('0x5e')]['role']===_0xac4a('0x2a')&&_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x29')]!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7c'));}return licenseUtil['checkUserLimits']([_0x4e93f5[_0xac4a('0x5e')]])[_0xac4a('0x36')](function(){return validateUser(_0x4e93f5[_0xac4a('0x5e')]);})[_0xac4a('0x36')](function(_0x72c90c){return updateUser(_0x72c90c)[_0xac4a('0x36')](function(_0xd7bdd6){if(_0xd7bdd6['role']===_0xac4a('0x2a')){_0xd7bdd6[_0xac4a('0x7d')]=_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x7d')];delete _0xd7bdd6[_0xac4a('0x7e')];}return _0xd7bdd6;});})[_0xac4a('0x36')](function(_0x547eec){return db[_0xac4a('0x3b')][_0xac4a('0x7f')](_0x547eec,{'include':[{'model':db[_0xac4a('0x70')],'as':_0xac4a('0x70')}]});})['then'](function(_0x21a384){if(_0x4e93f5['body'][_0xac4a('0x29')]===_0xac4a('0x2b'))return _0x21a384;if(_0x4e93f5['user']['role']!==_0xac4a('0x2b'))return _0x21a384;return db[_0xac4a('0x80')][_0xac4a('0x33')]({'where':{'name':_0x21a384['role']===_0xac4a('0x2c')?'Agents':_0xac4a('0x81'),'userProfileId':_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x7e')]},'raw':!![]})[_0xac4a('0x36')](function(_0x2e2c92){if(!_0x2e2c92||_0x2e2c92['autoAssociation']!=0x0)return _0x21a384;return db['UserProfileResource'][_0xac4a('0x7f')]({'name':_0x21a384[_0xac4a('0x34')],'resourceId':_0x21a384['id'],'type':_0x2e2c92[_0xac4a('0x34')],'sectionId':_0x2e2c92['id']},{})[_0xac4a('0x36')](function(){return _0x21a384;});})[_0xac4a('0x1e')](function(_0x3c5bbc){logger[_0xac4a('0x1b')](_0xac4a('0x82'),_0x3c5bbc);throw _0x3c5bbc;});})['then'](respondWithResult(_0x3824a2,0xc9))['catch'](handleError(_0x3824a2,null));};exports[_0xac4a('0x83')]=function(_0x31cc9a,_0x247eee){var _0x950e60=_0x31cc9a[_0xac4a('0x5e')];var _0x2ea4a4=[];if(_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x29')]==='agent')throw new Error('Unauthorized');if(_[_0xac4a('0x84')](_0x950e60,[_0xac4a('0x29'),_0xac4a('0x2b')])&&_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x29')]!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7b'));}if(_['some'](_0x950e60,[_0xac4a('0x29'),_0xac4a('0x2a')])&&_0x31cc9a[_0xac4a('0x2b')]['role']!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x85'));}return licenseUtil[_0xac4a('0x86')](_0x950e60)[_0xac4a('0x36')](function(){return validateUser(_0x950e60[0x0]);})[_0xac4a('0x36')](function(){for(var _0x27d023=0x1;_0x27d023<_0x950e60[_0xac4a('0x57')];_0x27d023++){var _0x2ef42a=_0x950e60[_0x27d023-0x1][_0xac4a('0x63')];if(!_0x950e60[_0x27d023]['internal'])_0x950e60[_0x27d023][_0xac4a('0x63')]=_0x2ef42a+0x1;_0x2ea4a4['push'](validateUser(_0x950e60[_0x27d023]));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);})[_0xac4a('0x36')](function(){_0x2ea4a4=[];for(var _0x3184b3=0x0;_0x3184b3<_0x950e60[_0xac4a('0x57')];_0x3184b3++){_0x2ea4a4[_0xac4a('0x44')](updateUser(_0x950e60[_0x3184b3]));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);})[_0xac4a('0x36')](function(){return BPromise['each'](_0x950e60,function(_0x2b883a){return db[_0xac4a('0x3b')][_0xac4a('0x7f')](_0x2b883a,{'include':[{'model':db[_0xac4a('0x70')],'as':_0xac4a('0x70')}]})['then'](function(_0x1b37d9){_0x2b883a['id']=_0x1b37d9['id'];return _0x2b883a;});});})[_0xac4a('0x36')](function(_0x4f2b19){if(_0x31cc9a['body'][_0xac4a('0x29')]===_0xac4a('0x2b'))return _0x4f2b19;if(_0x31cc9a['user'][_0xac4a('0x29')]!==_0xac4a('0x2b'))return _0x4f2b19;var _0x6afaba=_[_0xac4a('0x84')](_0x4f2b19,function(_0x31df2d){return _0x31df2d[_0xac4a('0x29')]==='agent'||_0x31df2d[_0xac4a('0x29')]===_0xac4a('0x2d');});if(!_0x6afaba)return _0x4f2b19;return db[_0xac4a('0x80')]['findAll']({'where':{'name':{'$or':[_0xac4a('0x87'),_0xac4a('0x81')]},'userProfileId':_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x7e')]},'raw':!![]})[_0xac4a('0x36')](function(_0x23d635){if(_['isEmpty'](_0x23d635)||!_[_0xac4a('0x84')](_0x23d635,[_0xac4a('0x88'),0x0]))return _0x4f2b19;_0x2ea4a4=[];var _0x5ab83b=_(_0x23d635)[_0xac4a('0x30')](function(_0x55054a){if(_0x55054a[_0xac4a('0x88')]===0x1)return;return _0x55054a[_0xac4a('0x34')]==='Agents'?_0xac4a('0x2c'):'telephone';})[_0xac4a('0x89')]()['value']();for(var _0x3c601e=0x0;_0x3c601e<_0x4f2b19[_0xac4a('0x57')];_0x3c601e++){if(!_[_0xac4a('0x32')](_0x5ab83b,_0x4f2b19[_0x3c601e][_0xac4a('0x29')]))return;var _0xc38492=_0x4f2b19[_0x3c601e][_0xac4a('0x29')]===_0xac4a('0x2c')?_0xac4a('0x87'):_0xac4a('0x81');_0x2ea4a4[_0xac4a('0x44')](db[_0xac4a('0x8a')][_0xac4a('0x7f')]({'name':_0x4f2b19[_0x3c601e][_0xac4a('0x34')],'resourceId':_0x4f2b19[_0x3c601e]['id'],'type':_0xc38492,'sectionId':_[_0xac4a('0x33')](_0x23d635,['name',_0xc38492])['id']},{}));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);});})[_0xac4a('0x36')](respondWithResult(_0x247eee,0xc9))['catch'](handleError(_0x247eee,null));};exports[_0xac4a('0x8b')]=function(_0x31d190,_0x1b10ad){if(_0x31d190[_0xac4a('0x5e')]['id']){delete _0x31d190[_0xac4a('0x5e')]['id'];}return db['User'][_0xac4a('0x33')]({'where':{'id':_0x31d190['params']['id']}})[_0xac4a('0x36')](function(_0x28ae76){if(!_0x28ae76)return null;if(_0x28ae76['id']===_0x31d190[_0xac4a('0x2b')]['id']){if(!_0x31d190[_0xac4a('0x5e')]['oldPassword']||!_0x31d190[_0xac4a('0x5e')]['newPassword']){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x8e'));}if(!_0x28ae76['authenticate'](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x8f')])){throw new db[(_0xac4a('0x8c'))]['ValidationError'](_0xac4a('0x90'));}if(_0x31d190[_0xac4a('0x5e')][_0xac4a('0x8f')]===_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')]){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x92'));}}else if(_0x31d190['user'][_0xac4a('0x29')]==='admin'){if(!_0x31d190['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0xac4a('0x93'));}}else if(_0x31d190[_0xac4a('0x2b')][_0xac4a('0x29')]===_0xac4a('0x2b')){if(!_0x31d190[_0xac4a('0x5e')]['newPassword']){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x93'));}if(_0x28ae76[_0xac4a('0x29')]!==_0xac4a('0x2c')){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x7a'));}}else{throw new db['Sequelize'][(_0xac4a('0x8d'))](_0xac4a('0x7a'));}return _0x28ae76;})[_0xac4a('0x36')](handleEntityNotFound(_0x1b10ad,null))[_0xac4a('0x36')](function(_0x303d5d){return db[_0xac4a('0x94')][_0xac4a('0x95')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xac4a('0x96')]})[_0xac4a('0x36')](function(_0x51993a){if(_0x51993a[_0xac4a('0x65')])authService[_0xac4a('0x66')](_0x31d190['body']['newPassword']);if(!_0x51993a[_0xac4a('0x97')]||!_0x303d5d[_0xac4a('0x98')])return _0x303d5d;authService[_0xac4a('0x99')](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')],_0x303d5d['previousPasswords'],_0x51993a[_0xac4a('0x96')]);return _0x303d5d;})['then'](saveUpdates({'password':_0x31d190['body']['newPassword'],'passwordResetAt':_0x31d190[_0xac4a('0x2b')]['id']==_0x31d190[_0xac4a('0x4f')]['id']?moment():null,'previousPasswords':authService[_0xac4a('0x9a')](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')],_0x303d5d[_0xac4a('0x98')])},null));})[_0xac4a('0x36')](respondWithResult(_0x1b10ad,null))[_0xac4a('0x1e')](handleError(_0x1b10ad,null));};exports['addQueues']=function(_0x5e1662,_0x53bcbc){var _0x3305a5=_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x9b')];return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x5e1662[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0x34'),_0xac4a('0x29'),_0xac4a('0x9c'),_0xac4a('0x9d'),_0xac4a('0x9e'),_0xac4a('0x9f')]})[_0xac4a('0x36')](handleEntityNotFound(_0x53bcbc,null))[_0xac4a('0x36')](function(_0x356a6b){if(_0x356a6b){if(!utils[_0xac4a('0xa0')](_0x3305a5)){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0xa1'));}return _0x356a6b[_0xac4a('0xa2')+_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+_0xac4a('0xa5')](_0x5e1662['body'][_0xac4a('0x61')],{'penalty':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0xa6')]||0x0})[_0xac4a('0xa7')](function(_0x237312){for(var _0x31afd2=0x0;_0x31afd2<_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x61')]['length'];_0x31afd2+=0x1){var _0x5127ea={'UserId':Number(_0x5e1662[_0xac4a('0x4f')]['id'])};_0x5127ea[_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+'QueueId']=Number(_0x5e1662['body']['ids'][_0x31afd2]);socket[_0xac4a('0xa8')]('user'+_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+'Queue:save',_0x5127ea);}return _0x237312;})[_0xac4a('0x36')](function(){if(_0x3305a5==='voice'){return db[_0xac4a('0xa9')][_0xac4a('0x45')]({'where':{'id':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x61')]||[]},'raw':!![],'attributes':['id',_0xac4a('0x34')]});}})[_0xac4a('0x36')](function(_0x5e0602){var _0x25bf23=_0x356a6b[_0xac4a('0x28')]({'plain':!![]});var _0x2c03a1=[];if(_0x3305a5==='voice'&&_0x25bf23[_0xac4a('0x29')]===_0xac4a('0x2c')&&_0x25bf23[_0xac4a('0x9c')]){for(var _0x247856=0x0;_0x247856<_0x5e0602['length'];_0x247856+=0x1){_0x2c03a1[_0xac4a('0x44')]({'membername':_0x25bf23[_0xac4a('0x34')],'UserId':_0x25bf23['id'],'queue_name':_0x5e0602[_0x247856][_0xac4a('0x34')],'VoiceQueueId':_0x5e0602[_0x247856]['id'],'interface':_[_0xac4a('0x68')](_0x25bf23[_0xac4a('0x9f')])?util[_0xac4a('0xaa')]('SIP/%s',_0x25bf23['name']):_0x25bf23[_0xac4a('0x9f')],'paused':_0x25bf23[_0xac4a('0x9e')]||![],'penalty':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0xa6')]||0x0});}return BPromise[_0xac4a('0xab')](_0x2c03a1,function(_0x1a12a2){return db['UserVoiceQueueRt'][_0xac4a('0xac')](_0x1a12a2);});}return _0x356a6b;});}})['then'](respondWithStatusCode(_0x53bcbc,null))[_0xac4a('0x1e')](handleError(_0x53bcbc,null));};exports['removeQueues']=function(_0xa1df14,_0x13b938){var _0x15f35a;return db[_0xac4a('0x3b')]['find']({'where':{'id':_0xa1df14[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0x34'),_0xac4a('0x29')]})[_0xac4a('0x36')](handleEntityNotFound(_0x13b938,null))[_0xac4a('0x36')](function(_0x520001){if(_0x520001){_0x15f35a=_0x520001;if(!_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')]||!utils[_0xac4a('0xa0')](_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')])){throw new db['Sequelize'][(_0xac4a('0x8d'))](_0xac4a('0xa1'));}return _0x520001[_0xac4a('0xad')+_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel']['toLowerCase']())+'Queues'](_0xa1df14['query'][_0xac4a('0x61')]);}})[_0xac4a('0x36')](function(_0x17f815){if(_[_0xac4a('0xae')](_0xa1df14[_0xac4a('0x52')]['ids'])){for(var _0x293d49=0x0;_0x293d49<_0xa1df14[_0xac4a('0x52')]['ids'][_0xac4a('0x57')];_0x293d49+=0x1){var _0x11faad={'UserId':Number(_0xa1df14[_0xac4a('0x4f')]['id'])};_0x11faad[_['capitalize'](_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')][_0xac4a('0xa4')]())+_0xac4a('0xaf')]=Number(_0xa1df14[_0xac4a('0x52')][_0xac4a('0x61')][_0x293d49]);socket[_0xac4a('0xa8')](_0xac4a('0x2b')+_[_0xac4a('0xa3')](_0xa1df14['query'][_0xac4a('0x9b')][_0xac4a('0xa4')]())+'Queue:remove',_0x11faad);}}else{var _0x11faad={'UserId':Number(_0xa1df14['params']['id'])};_0x11faad[_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel'][_0xac4a('0xa4')]())+_0xac4a('0xaf')]=Number(_0xa1df14[_0xac4a('0x52')][_0xac4a('0x61')]);socket[_0xac4a('0xa8')](_0xac4a('0x2b')+_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel']['toLowerCase']())+_0xac4a('0xb0'),_0x11faad);}return _0x17f815;})['then'](function(){if(_0xa1df14['query'][_0xac4a('0x9b')]===_0xac4a('0xb1')){return db[_0xac4a('0xb2')]['destroy']({'where':{'UserId':_0xa1df14[_0xac4a('0x4f')]['id'],'VoiceQueueId':_0xa1df14[_0xac4a('0x52')]['ids']},'individualHooks':!![]})['then'](function(){return _0x15f35a;});}return _0x15f35a;})[_0xac4a('0x36')](respondWithStatusCode(_0x13b938,null))[_0xac4a('0x1e')](handleError(_0x13b938,null));};exports[_0xac4a('0xb3')]=function(_0x368546,_0x4fadd1){_0x368546[_0xac4a('0x5e')][_0xac4a('0xb4')]=_0x368546[_0xac4a('0xb5')]['filename'];return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x368546[_0xac4a('0x4f')]['id']}})[_0xac4a('0x36')](handleEntityNotFound(_0x4fadd1,null))[_0xac4a('0x36')](saveUpdates(_0x368546['body'],null))['then'](respondWithResult(_0x4fadd1,null))[_0xac4a('0x1e')](handleError(_0x4fadd1,null));};exports[_0xac4a('0xb6')]=function(_0x1774e5,_0x110e16){var _0x14ca03=path[_0xac4a('0xb7')](config[_0xac4a('0xb8')],_0xac4a('0xb9'));return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x1774e5[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0xb4')],'raw':!![]})[_0xac4a('0x36')](handleEntityNotFound(_0x110e16,null))['then'](function(_0x3ef9b2){if(_0x3ef9b2){if(_['isNil'](_0x3ef9b2['userpic'])){return _0x110e16[_0xac4a('0xba')](_0x14ca03);}else{if(!fs[_0xac4a('0xbb')](path[_0xac4a('0xb7')](config[_0xac4a('0xb8')],_0xac4a('0xbc'),_0x3ef9b2[_0xac4a('0xb4')]))){return _0x110e16[_0xac4a('0xba')](_0x14ca03);}return _0x110e16[_0xac4a('0xba')](path[_0xac4a('0xb7')](config['root'],_0xac4a('0xbc'),_0x3ef9b2[_0xac4a('0xb4')]));}}})[_0xac4a('0x1e')](handleError(_0x110e16,null));};exports[_0xac4a('0xbd')]=function(_0x5c0bb8,_0x5b1934){return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x5c0bb8[_0xac4a('0x4f')]['id']},'attributes':['id']})[_0xac4a('0x36')](handleEntityNotFound(_0x5b1934,null))[_0xac4a('0x36')](function(_0x254de8){var _0x1c7ea7=[];values=_0x254de8[_0xac4a('0x4a')];_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('chat',_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4b'),_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5a'),_0x254de8['dataValues']));_0x1c7ea7['push'](get_open_tabs('whatsapp',_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('fax',_0x254de8['dataValues']));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('mail',_0x254de8[_0xac4a('0x4a')]));return BPromise['all'](_0x1c7ea7);})[_0xac4a('0x36')](function(_0x2abd82){var _0x1888c3=[];if(_0x2abd82){for(var _0x27e640=0x0;_0x27e640=_0x58057a){_0x6ebee0=_0x58057a;_0x38c137=0xc8;}else{_0x38c137=0xce;}_0x1361a6[_0x8488('0x1e')](_0x38c137);return _0x1361a6[_0x8488('0x24')](_0x8488('0x25'),_0x2f350a+'-'+_0x6ebee0+'/'+_0x58057a)[_0x8488('0x20')](_0x54ecda);}return null;};}function saveUpdates(_0x2c15ff){return function(_0x296b6c){if(_0x296b6c){return _0x296b6c[_0x8488('0x26')](_0x2c15ff)[_0x8488('0x13')](function(_0x888b24){return _0x888b24;});}return null;};}function removeEntity(_0x58d0cc){return function(_0x57ce3c){if(_0x57ce3c){return _0x57ce3c['destroy']()[_0x8488('0x13')](function(){var _0x408c36=_0x57ce3c[_0x8488('0x27')]({'plain':!![]});if(_0x408c36[_0x8488('0x28')]===_0x8488('0x29'))return;var _0x2f1399=[{'name':'Users','value':_0x8488('0x2a'),'ignore':!![]},{'name':_0x8488('0x2b'),'value':_0x8488('0x2c'),'ignore':![]},{'name':_0x8488('0x2d'),'value':_0x8488('0x2e'),'ignore':![]}];var _0x501981=_(_0x2f1399)[_0x8488('0x2f')](_0x8488('0x30'))['map'](_0x8488('0x31'))[_0x8488('0x31')]();if(_[_0x8488('0x32')](_0x501981,_0x408c36[_0x8488('0x28')])){return;}var _0x4555d0=_['find'](_0x2f1399,[_0x8488('0x31'),_0x408c36[_0x8488('0x28')]])[_0x8488('0x33')];return db['UserProfileResource'][_0x8488('0x34')]({'where':{'type':_0x4555d0,'resourceId':_0x408c36['id']}})['then'](function(){return _0x57ce3c;});})[_0x8488('0x13')](function(){_0x58d0cc[_0x8488('0x1e')](0xcc)[_0x8488('0x1f')]();});}};}function handleEntityNotFound(_0x16b0cd){return function(_0x4c3b59){if(!_0x4c3b59){_0x16b0cd[_0x8488('0x1d')](0x194);}return _0x4c3b59;};}function handleError(_0xe71bd9,_0x3939f2){_0x3939f2=_0x3939f2||0x1f4;return function(_0x583ece){logger[_0x8488('0x17')](_0x583ece[_0x8488('0x35')]);if(_0x583ece[_0x8488('0x33')]){delete _0x583ece[_0x8488('0x33')];}_0xe71bd9[_0x8488('0x1e')](_0x3939f2)[_0x8488('0x36')](_0x583ece);};}exports[_0x8488('0x37')]=function(_0x27ddb0,_0x1a8235){var _0x2171dc={},_0x3b6d07={'count':0x0,'rows':[]};var _0x4cb675=_(db['User'][_0x8488('0x38')])[_0x8488('0x39')](function(_0x3abb68){return{'name':_0x3abb68[_0x8488('0x3a')],'type':_0x3abb68[_0x8488('0x3b')][_0x8488('0x3c')]};})[_0x8488('0x2f')](function(_0x4481df){return!_[_0x8488('0x32')](['password',_0x8488('0x3d')],_0x4481df[_0x8488('0x33')]);})[_0x8488('0x31')]();_0x2171dc=qs['getOptions'](_0x4cb675,_0x27ddb0);var _0x207429={'where':_0x2171dc[_0x8488('0x3e')]};return db[_0x8488('0x3f')][_0x8488('0x22')](_0x207429)[_0x8488('0x13')](function(_0x156246){_0x3b6d07[_0x8488('0x22')]=_0x156246;if(_0x27ddb0['query'][_0x8488('0x40')]){_0x2171dc[_0x8488('0x41')]=[{'all':!![]}];}if(!_[_0x8488('0x32')](_0x2171dc['attributes'],'id')){_0x2171dc[_0x8488('0x42')]['push']('id');}return db[_0x8488('0x3f')][_0x8488('0x43')](_0x2171dc);})['then'](function(_0x22a3f3){_0x3b6d07[_0x8488('0x44')]=_0x22a3f3;if(_0x27ddb0[_0x8488('0x45')][_0x8488('0x46')]===_0x8488('0x47')){var _0x4e5c83=[];for(var _0x3724be=0x0;_0x3724be<_0x3b6d07['rows'][_0x8488('0x48')];_0x3724be++){_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4a'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4c'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4d'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs(_0x8488('0x4e'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83['push'](get_open_tabs(_0x8488('0x4f'),_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));_0x4e5c83[_0x8488('0x49')](get_open_tabs('whatsapp',_0x3b6d07[_0x8488('0x44')][_0x3724be][_0x8488('0x4b')]));}return BPromise[_0x8488('0x50')](_0x4e5c83)[_0x8488('0x13')](function(_0x52042c){return _0x3b6d07;});}else{return _0x3b6d07;}})[_0x8488('0x13')](respondWithFilteredResult(_0x1a8235,_0x2171dc))[_0x8488('0x51')](handleError(_0x1a8235,null));};exports[_0x8488('0x52')]=function(_0x33d6c9,_0x19a940){var _0x1157db={'raw':![],'where':{'id':_0x33d6c9[_0x8488('0x53')]['id']}},_0x886a9e={};_0x886a9e[_0x8488('0x54')]=_[_0x8488('0x55')](_[_0x8488('0x56')](db[_0x8488('0x3f')][_0x8488('0x38')]),['password','salt']);_0x886a9e[_0x8488('0x45')]=_[_0x8488('0x56')](_0x33d6c9[_0x8488('0x45')]);_0x886a9e[_0x8488('0x57')]=_[_0x8488('0x58')](_0x886a9e[_0x8488('0x54')],_0x886a9e[_0x8488('0x45')]);_0x1157db[_0x8488('0x42')]=_[_0x8488('0x58')](_0x886a9e['model'],qs[_0x8488('0x59')](_0x33d6c9[_0x8488('0x45')]['fields']));_0x1157db[_0x8488('0x42')]=_0x1157db[_0x8488('0x42')][_0x8488('0x48')]?_0x1157db[_0x8488('0x42')]:_0x886a9e['model'];if(_0x33d6c9[_0x8488('0x45')][_0x8488('0x40')]){_0x1157db[_0x8488('0x41')]=[{'all':!![]}];}_0x1157db=_['merge']({},_0x1157db,_0x33d6c9[_0x8488('0x5a')]);if(!_[_0x8488('0x32')](_0x1157db[_0x8488('0x42')],'id')){_0x1157db[_0x8488('0x42')]['push']('id');}return db[_0x8488('0x3f')]['find'](_0x1157db)['then'](handleEntityNotFound(_0x19a940,null))[_0x8488('0x13')](function(_0x5ca135){var _0x3453c7=[];values=_0x5ca135;if(_0x33d6c9[_0x8488('0x45')][_0x8488('0x46')]===_0x8488('0x47')){_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4a'),_0x5ca135['dataValues']));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4c'),_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4f'),_0x5ca135['dataValues']));_0x3453c7[_0x8488('0x49')](get_open_tabs('whatsapp',_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs('fax',_0x5ca135[_0x8488('0x4b')]));_0x3453c7[_0x8488('0x49')](get_open_tabs(_0x8488('0x4e'),_0x5ca135[_0x8488('0x4b')]));return BPromise[_0x8488('0x50')](_0x3453c7);}else{return values;}})[_0x8488('0x13')](function(_0x59d0d4){return values;})[_0x8488('0x13')](respondWithResult(_0x19a940,null))['catch'](handleError(_0x19a940,null));};exports[_0x8488('0x26')]=function(_0x3fa6e2,_0x3c06a4){if(_0x3fa6e2[_0x8488('0x5b')]['id']){delete _0x3fa6e2[_0x8488('0x5b')]['id'];}delete _0x3fa6e2[_0x8488('0x5b')]['role'];return db[_0x8488('0x3f')]['find']({'where':{'id':_0x3fa6e2[_0x8488('0x53')]['id']}})[_0x8488('0x13')](handleEntityNotFound(_0x3c06a4,null))[_0x8488('0x13')](saveUpdates(_0x3fa6e2[_0x8488('0x5b')],null))[_0x8488('0x13')](respondWithResult(_0x3c06a4,null))[_0x8488('0x51')](handleError(_0x3c06a4,null));};exports['describe']=function(_0x5755af,_0x5c8310){return db[_0x8488('0x3f')][_0x8488('0x5c')]()[_0x8488('0x13')](respondWithResult(_0x5c8310,null))[_0x8488('0x51')](handleError(_0x5c8310,null));};exports[_0x8488('0x5d')]=function(_0x190e53,_0x2377db){return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x190e53[_0x8488('0x53')]['id']}})['then'](handleEntityNotFound(_0x2377db,null))[_0x8488('0x13')](function(_0x174c57){if(_0x174c57){return _0x174c57[_0x8488('0x5d')](_0x190e53['body']['ids'],_[_0x8488('0x5f')](_0x190e53[_0x8488('0x5b')],[_0x8488('0x60'),'id'])||{});}})[_0x8488('0x13')](respondWithResult(_0x2377db,null))['catch'](handleError(_0x2377db,null));};function validateUser(_0x4b7475){return new BPromise(function(_0x1577ce,_0x26e0cc){if(_0x4b7475[_0x8488('0x61')])return _0x1577ce(_0x4b7475);return db['Setting'][_0x8488('0x62')](0x1)[_0x8488('0x13')](function(_0x17149f){if(_0x17149f[_0x8488('0x63')])authService[_0x8488('0x64')](_0x4b7475['password']);db[_0x8488('0x3f')][_0x8488('0x65')]('internal')[_0x8488('0x13')](function(_0x1b981b){if(_['isNil'](_0x1b981b)){_0x4b7475[_0x8488('0x61')]=_0x17149f[_0x8488('0x66')]||0x1;return;}if(_[_0x8488('0x67')](_0x17149f[_0x8488('0x66')])||_0x17149f[_0x8488('0x66')]===_0x1b981b){_0x4b7475[_0x8488('0x61')]=_0x1b981b+0x1;return;}if(_0x17149f[_0x8488('0x66')]>_0x1b981b){_0x4b7475['internal']=_0x17149f[_0x8488('0x66')];return;}return db[_0x8488('0x68')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x8488('0x68')][_0x8488('0x69')][_0x8488('0x6a')]})['then'](function(_0xb85159){if(_0xb85159&&_0xb85159[_0x8488('0x48')]){for(var _0x56b35a=0x0,_0x42b5c5=_0xb85159['length'];_0x56b35a<_0x42b5c5&&_[_0x8488('0x67')](_0x4b7475[_0x8488('0x61')]);_0x56b35a++){if(_0x17149f[_0x8488('0x66')]<=_0xb85159[_0x56b35a]['from']){_0x4b7475[_0x8488('0x61')]=_0xb85159[_0x56b35a][_0x8488('0x6b')];}else if(_0x17149f['min_internal']>_0xb85159[_0x56b35a]['from']&&_0x17149f[_0x8488('0x66')]<=_0xb85159[_0x56b35a]['to']){_0x4b7475[_0x8488('0x61')]=_0x17149f[_0x8488('0x66')];}}}if(_[_0x8488('0x67')](_0x4b7475[_0x8488('0x61')])){_0x4b7475[_0x8488('0x61')]=_0x1b981b+0x1;}return _0x1577ce(_0x4b7475);});});})[_0x8488('0x51')](function(_0x4288ce){_0x26e0cc(_0x4288ce);});});}function updateUser(_0x1dee36){return new BPromise(function(_0x1ff111,_0x5da70b){try{if(_0x1dee36[_0x8488('0x6c')]){_0x1dee36['mailbox']=_0x1dee36[_0x8488('0x61')];_0x1dee36[_0x8488('0x6d')]={'mailbox':_0x1dee36[_0x8488('0x61')],'password':_0x1dee36[_0x8488('0x6e')],'fullname':_0x1dee36['fullname'],'email':_0x1dee36[_0x8488('0x6f')]};}if(_0x1dee36[_0x8488('0x28')]==='agent'){if(!_0x1dee36[_0x8488('0x70')])_0x1dee36['permissions']=[_0x8488('0x71'),_0x8488('0x72'),_0x8488('0x73'),_0x8488('0x74'),_0x8488('0x75'),_0x8488('0x76'),_0x8488('0x77'),_0x8488('0x78'),'107',_0x8488('0x79'),'109','100',_0x8488('0x7a'),_0x8488('0x7b'),_0x8488('0x7c')];}_0x1ff111(_0x1dee36);}catch(_0x481e4b){_0x5da70b(_0x481e4b);}});}exports['create']=function(_0x1f89f9,_0xee1aac){if(_0x1f89f9['user'][_0x8488('0x28')]===_0x8488('0x2c'))throw new Error(_0x8488('0x7d'));if(_0x1f89f9[_0x8488('0x5b')][_0x8488('0x28')]===_0x8488('0x2a')&&_0x1f89f9['user'][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x7e'));}if(_0x1f89f9['body'][_0x8488('0x28')]===_0x8488('0x29')&&_0x1f89f9[_0x8488('0x2a')]['role']!==_0x8488('0x29')){throw new Error(_0x8488('0x7f'));}return licenseUtil['checkUserLimits']([_0x1f89f9['body']])[_0x8488('0x13')](function(){return validateUser(_0x1f89f9[_0x8488('0x5b')]);})['then'](function(_0x353514){return updateUser(_0x353514)[_0x8488('0x13')](function(_0x5c63b1){if(_0x5c63b1['role']===_0x8488('0x29')){_0x5c63b1['settingsEnabled']=_0x1f89f9[_0x8488('0x2a')][_0x8488('0x80')];delete _0x5c63b1[_0x8488('0x81')];}return _0x5c63b1;});})[_0x8488('0x13')](function(_0x581ea2){return db[_0x8488('0x3f')]['create'](_0x581ea2,{'include':[{'model':db[_0x8488('0x6d')],'as':'VoiceMail'}]});})[_0x8488('0x13')](function(_0x1a3a2d){if(_0x1f89f9[_0x8488('0x5b')][_0x8488('0x28')]===_0x8488('0x2a'))return _0x1a3a2d;if(_0x1f89f9[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x2a'))return _0x1a3a2d;return db[_0x8488('0x82')][_0x8488('0x5e')]({'where':{'name':_0x1a3a2d[_0x8488('0x28')]===_0x8488('0x2c')?_0x8488('0x2b'):_0x8488('0x2d'),'userProfileId':_0x1f89f9['user'][_0x8488('0x81')]},'raw':!![]})[_0x8488('0x13')](function(_0x55ddaf){if(!_0x55ddaf||_0x55ddaf[_0x8488('0x83')]!=0x0)return _0x1a3a2d;return db[_0x8488('0x84')][_0x8488('0x85')]({'name':_0x1a3a2d[_0x8488('0x33')],'resourceId':_0x1a3a2d['id'],'type':_0x55ddaf[_0x8488('0x33')],'sectionId':_0x55ddaf['id']},{})[_0x8488('0x13')](function(){return _0x1a3a2d;});})[_0x8488('0x51')](function(_0x42ce91){logger[_0x8488('0x17')](_0x8488('0x86'),_0x42ce91);throw _0x42ce91;});})[_0x8488('0x13')](respondWithResult(_0xee1aac,0xc9))['catch'](handleError(_0xee1aac,null));};exports[_0x8488('0x87')]=function(_0x1abac4,_0x51814e){var _0x1e509a=_0x1abac4[_0x8488('0x5b')];var _0x76c3c=[];if(_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]==='agent')throw new Error('Unauthorized');if(_[_0x8488('0x88')](_0x1e509a,[_0x8488('0x28'),_0x8488('0x2a')])&&_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x7e'));}if(_[_0x8488('0x88')](_0x1e509a,[_0x8488('0x28'),_0x8488('0x29')])&&_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x29')){throw new Error(_0x8488('0x89'));}return licenseUtil[_0x8488('0x8a')](_0x1e509a)['then'](function(){return validateUser(_0x1e509a[0x0]);})[_0x8488('0x13')](function(){for(var _0x5d5234=0x1;_0x5d5234<_0x1e509a['length'];_0x5d5234++){var _0x1e25a3=_0x1e509a[_0x5d5234-0x1][_0x8488('0x61')];if(!_0x1e509a[_0x5d5234][_0x8488('0x61')])_0x1e509a[_0x5d5234][_0x8488('0x61')]=_0x1e25a3+0x1;_0x76c3c[_0x8488('0x49')](validateUser(_0x1e509a[_0x5d5234]));}return BPromise[_0x8488('0x50')](_0x76c3c);})[_0x8488('0x13')](function(){_0x76c3c=[];for(var _0x366eab=0x0;_0x366eab<_0x1e509a[_0x8488('0x48')];_0x366eab++){_0x76c3c[_0x8488('0x49')](updateUser(_0x1e509a[_0x366eab]));}return BPromise['all'](_0x76c3c);})[_0x8488('0x13')](function(){return BPromise[_0x8488('0x8b')](_0x1e509a,function(_0x179637){return db[_0x8488('0x3f')][_0x8488('0x85')](_0x179637,{'include':[{'model':db[_0x8488('0x6d')],'as':'VoiceMail'}]})[_0x8488('0x13')](function(_0x5b0d69){_0x179637['id']=_0x5b0d69['id'];return _0x179637;});});})[_0x8488('0x13')](function(_0x3936b6){if(_0x1abac4['body']['role']===_0x8488('0x2a'))return _0x3936b6;if(_0x1abac4[_0x8488('0x2a')][_0x8488('0x28')]!==_0x8488('0x2a'))return _0x3936b6;var _0xbec8a6=_['some'](_0x3936b6,function(_0x26fb11){return _0x26fb11[_0x8488('0x28')]==='agent'||_0x26fb11['role']===_0x8488('0x2e');});if(!_0xbec8a6)return _0x3936b6;return db[_0x8488('0x82')][_0x8488('0x43')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x1abac4[_0x8488('0x2a')][_0x8488('0x81')]},'raw':!![]})[_0x8488('0x13')](function(_0x57e71a){if(_[_0x8488('0x8c')](_0x57e71a)||!_[_0x8488('0x88')](_0x57e71a,[_0x8488('0x83'),0x0]))return _0x3936b6;_0x76c3c=[];var _0x39851c=_(_0x57e71a)[_0x8488('0x39')](function(_0xd6a03b){if(_0xd6a03b[_0x8488('0x83')]===0x1)return;return _0xd6a03b[_0x8488('0x33')]===_0x8488('0x2b')?_0x8488('0x2c'):_0x8488('0x2e');})[_0x8488('0x8d')]()[_0x8488('0x31')]();for(var _0x591a58=0x0;_0x591a58<_0x3936b6[_0x8488('0x48')];_0x591a58++){if(!_[_0x8488('0x32')](_0x39851c,_0x3936b6[_0x591a58][_0x8488('0x28')]))return;var _0x553785=_0x3936b6[_0x591a58][_0x8488('0x28')]==='agent'?_0x8488('0x2b'):'Telephones';_0x76c3c['push'](db[_0x8488('0x84')]['create']({'name':_0x3936b6[_0x591a58][_0x8488('0x33')],'resourceId':_0x3936b6[_0x591a58]['id'],'type':_0x553785,'sectionId':_[_0x8488('0x5e')](_0x57e71a,[_0x8488('0x33'),_0x553785])['id']},{}));}return BPromise[_0x8488('0x50')](_0x76c3c);});})['then'](respondWithResult(_0x51814e,0xc9))[_0x8488('0x51')](handleError(_0x51814e,null));};exports[_0x8488('0x8e')]=function(_0x477a86,_0x37ca73){if(_0x477a86['body']['id']){delete _0x477a86[_0x8488('0x5b')]['id'];}return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x477a86[_0x8488('0x53')]['id']}})[_0x8488('0x13')](function(_0x564c4d){if(!_0x564c4d)return null;if(_0x564c4d['id']===_0x477a86['user']['id']){if(!_0x477a86[_0x8488('0x5b')][_0x8488('0x8f')]||!_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x564c4d['authenticate'](_0x477a86[_0x8488('0x5b')][_0x8488('0x8f')])){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0x92'));}if(_0x477a86[_0x8488('0x5b')]['oldPassword']===_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x94'));}}else if(_0x477a86[_0x8488('0x2a')][_0x8488('0x28')]===_0x8488('0x29')){if(!_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x95'));}}else if(_0x477a86['user'][_0x8488('0x28')]===_0x8488('0x2a')){if(!_0x477a86['body']['newPassword']){throw new db['Sequelize'][(_0x8488('0x93'))](_0x8488('0x95'));}if(_0x564c4d[_0x8488('0x28')]!=='agent'){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0x7d'));}}else{throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0x7d'));}return _0x564c4d;})[_0x8488('0x13')](handleEntityNotFound(_0x37ca73,null))['then'](function(_0x85093c){return db[_0x8488('0x96')][_0x8488('0x97')]({'attributes':['id',_0x8488('0x63'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8488('0x13')](function(_0xfaf366){if(_0xfaf366[_0x8488('0x63')])authService[_0x8488('0x64')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')]);if(!_0xfaf366[_0x8488('0x98')]||!_0x85093c[_0x8488('0x99')])return _0x85093c;authService[_0x8488('0x9a')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')],_0x85093c[_0x8488('0x99')],_0xfaf366[_0x8488('0x9b')]);return _0x85093c;})[_0x8488('0x13')](saveUpdates({'password':_0x477a86['body']['newPassword'],'passwordResetAt':_0x477a86[_0x8488('0x2a')]['id']==_0x477a86[_0x8488('0x53')]['id']?moment():null,'previousPasswords':authService[_0x8488('0x9c')](_0x477a86[_0x8488('0x5b')][_0x8488('0x90')],_0x85093c[_0x8488('0x99')])},null));})[_0x8488('0x13')](respondWithResult(_0x37ca73,null))[_0x8488('0x51')](handleError(_0x37ca73,null));};exports[_0x8488('0x9d')]=function(_0x4d611a,_0x46195e){var _0x153c05=_0x4d611a[_0x8488('0x5b')]['channel'];return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x4d611a[_0x8488('0x53')]['id']},'attributes':['id',_0x8488('0x33'),_0x8488('0x28'),_0x8488('0x9e'),_0x8488('0x9f'),_0x8488('0xa0'),'interface']})['then'](handleEntityNotFound(_0x46195e,null))[_0x8488('0x13')](function(_0x215d7e){if(_0x215d7e){if(!utils[_0x8488('0xa1')](_0x153c05)){throw new db[(_0x8488('0x91'))][(_0x8488('0x93'))](_0x8488('0xa2'));}return _0x215d7e[_0x8488('0xa3')+_['capitalize'](_0x153c05[_0x8488('0xa4')]())+'Queues'](_0x4d611a[_0x8488('0x5b')][_0x8488('0x60')],{'penalty':_0x4d611a[_0x8488('0x5b')][_0x8488('0xa5')]||0x0})[_0x8488('0xa6')](function(_0x5eeb6d){for(var _0x27add0=0x0;_0x27add0<_0x4d611a[_0x8488('0x5b')][_0x8488('0x60')][_0x8488('0x48')];_0x27add0+=0x1){var _0x14e4a9={'UserId':Number(_0x4d611a[_0x8488('0x53')]['id'])};_0x14e4a9[_[_0x8488('0xa7')](_0x153c05['toLowerCase']())+_0x8488('0xa8')]=Number(_0x4d611a['body']['ids'][_0x27add0]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_['capitalize'](_0x153c05[_0x8488('0xa4')]())+_0x8488('0xaa'),_0x14e4a9);}return _0x5eeb6d;})[_0x8488('0x13')](function(){if(_0x153c05===_0x8488('0xab')){return db[_0x8488('0xac')]['findAll']({'where':{'id':_0x4d611a['body'][_0x8488('0x60')]||[]},'raw':!![],'attributes':['id',_0x8488('0x33')]});}})[_0x8488('0x13')](function(_0x13abe8){var _0x3178fd=_0x215d7e['get']({'plain':!![]});var _0x4cfff4=[];if(_0x153c05===_0x8488('0xab')&&_0x3178fd[_0x8488('0x28')]===_0x8488('0x2c')&&_0x3178fd[_0x8488('0x9e')]){for(var _0x258985=0x0;_0x258985<_0x13abe8[_0x8488('0x48')];_0x258985+=0x1){_0x4cfff4[_0x8488('0x49')]({'membername':_0x3178fd[_0x8488('0x33')],'UserId':_0x3178fd['id'],'queue_name':_0x13abe8[_0x258985][_0x8488('0x33')],'VoiceQueueId':_0x13abe8[_0x258985]['id'],'interface':_[_0x8488('0x67')](_0x3178fd[_0x8488('0xad')])?util[_0x8488('0xae')](_0x8488('0xaf'),_0x3178fd[_0x8488('0x33')]):_0x3178fd['interface'],'paused':_0x3178fd[_0x8488('0xa0')]||![],'penalty':_0x4d611a[_0x8488('0x5b')][_0x8488('0xa5')]||0x0});}return BPromise['each'](_0x4cfff4,function(_0xfb02ed){return db[_0x8488('0xb0')][_0x8488('0xb1')](_0xfb02ed);});}return _0x215d7e;});}})['then'](respondWithStatusCode(_0x46195e,null))[_0x8488('0x51')](handleError(_0x46195e,null));};exports[_0x8488('0xb2')]=function(_0x5c7791,_0x310ffb){var _0x357136;return db['User'][_0x8488('0x5e')]({'where':{'id':_0x5c7791[_0x8488('0x53')]['id']},'attributes':['id',_0x8488('0x33'),_0x8488('0x28')]})[_0x8488('0x13')](handleEntityNotFound(_0x310ffb,null))[_0x8488('0x13')](function(_0x2ce70b){if(_0x2ce70b){_0x357136=_0x2ce70b;if(!_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')]||!utils[_0x8488('0xa1')](_0x5c7791['query'][_0x8488('0xb3')])){throw new db[(_0x8488('0x91'))]['ValidationError'](_0x8488('0xa2'));}return _0x2ce70b['remove'+_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xb4')](_0x5c7791[_0x8488('0x45')]['ids']);}})[_0x8488('0x13')](function(_0x4da306){if(_['isArray'](_0x5c7791[_0x8488('0x45')][_0x8488('0x60')])){for(var _0x3dffa8=0x0;_0x3dffa8<_0x5c7791[_0x8488('0x45')]['ids']['length'];_0x3dffa8+=0x1){var _0x5ea079={'UserId':Number(_0x5c7791['params']['id'])};_0x5ea079[_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xa8')]=Number(_0x5c7791['query'][_0x8488('0x60')][_0x3dffa8]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_['capitalize'](_0x5c7791['query'][_0x8488('0xb3')][_0x8488('0xa4')]())+'Queue:remove',_0x5ea079);}}else{var _0x5ea079={'UserId':Number(_0x5c7791[_0x8488('0x53')]['id'])};_0x5ea079[_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xa8')]=Number(_0x5c7791[_0x8488('0x45')][_0x8488('0x60')]);socket[_0x8488('0xa9')](_0x8488('0x2a')+_[_0x8488('0xa7')](_0x5c7791[_0x8488('0x45')][_0x8488('0xb3')][_0x8488('0xa4')]())+_0x8488('0xb5'),_0x5ea079);}return _0x4da306;})[_0x8488('0x13')](function(){if(_0x5c7791[_0x8488('0x45')]['channel']===_0x8488('0xab')){return db[_0x8488('0xb0')][_0x8488('0x34')]({'where':{'UserId':_0x5c7791['params']['id'],'VoiceQueueId':_0x5c7791[_0x8488('0x45')][_0x8488('0x60')]},'individualHooks':!![]})[_0x8488('0x13')](function(){return _0x357136;});}return _0x357136;})[_0x8488('0x13')](respondWithStatusCode(_0x310ffb,null))['catch'](handleError(_0x310ffb,null));};exports[_0x8488('0xb6')]=function(_0x479aca,_0xbd1f56){_0x479aca[_0x8488('0x5b')]['userpic']=_0x479aca[_0x8488('0xb7')][_0x8488('0xb8')];return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x479aca[_0x8488('0x53')]['id']}})[_0x8488('0x13')](handleEntityNotFound(_0xbd1f56,null))['then'](saveUpdates(_0x479aca['body'],null))[_0x8488('0x13')](respondWithResult(_0xbd1f56,null))[_0x8488('0x51')](handleError(_0xbd1f56,null));};exports[_0x8488('0xb9')]=function(_0x2628ba,_0x15a8de){var _0x590166=path['join'](config[_0x8488('0xba')],'server/files/images/logos/default_profile.png');return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x2628ba['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x8488('0x13')](handleEntityNotFound(_0x15a8de,null))[_0x8488('0x13')](function(_0x54ac42){if(_0x54ac42){if(_[_0x8488('0x67')](_0x54ac42['userpic'])){return _0x15a8de['download'](_0x590166);}else{if(!fs[_0x8488('0xbb')](path[_0x8488('0xbc')](config[_0x8488('0xba')],'server/files/images/',_0x54ac42[_0x8488('0xbd')]))){return _0x15a8de[_0x8488('0xbe')](_0x590166);}return _0x15a8de[_0x8488('0xbe')](path[_0x8488('0xbc')](config['root'],_0x8488('0xbf'),_0x54ac42[_0x8488('0xbd')]));}}})[_0x8488('0x51')](handleError(_0x15a8de,null));};exports[_0x8488('0xc0')]=function(_0x19f9ff,_0x778e6e){return db[_0x8488('0x3f')][_0x8488('0x5e')]({'where':{'id':_0x19f9ff[_0x8488('0x53')]['id']},'attributes':['id']})[_0x8488('0x13')](handleEntityNotFound(_0x778e6e,null))[_0x8488('0x13')](function(_0x545002){var _0x4c94a2=[];values=_0x545002['dataValues'];_0x4c94a2[_0x8488('0x49')](get_open_tabs('chat',_0x545002[_0x8488('0x4b')]));_0x4c94a2['push'](get_open_tabs(_0x8488('0x4c'),_0x545002[_0x8488('0x4b')]));_0x4c94a2[_0x8488('0x49')](get_open_tabs(_0x8488('0x4f'),_0x545002['dataValues']));_0x4c94a2['push'](get_open_tabs(_0x8488('0xc1'),_0x545002['dataValues']));_0x4c94a2[_0x8488('0x49')](get_open_tabs('fax',_0x545002[_0x8488('0x4b')]));_0x4c94a2[_0x8488('0x49')](get_open_tabs('mail',_0x545002[_0x8488('0x4b')]));return BPromise[_0x8488('0x50')](_0x4c94a2);})[_0x8488('0x13')](function(_0x319912){var _0x63ed1c=[];if(_0x319912){for(var _0xd0ee30=0x0;_0xd0ee30=_0x51128f[_0x26ac('0x56')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x26ac('0x12')](function(){if(_0x5f6e71){return db['UserVoiceQueueRt'][_0x26ac('0x4c')]({'where':{'membername':_0x5f6e71['name']},'individualHooks':!![]});}})[_0x26ac('0x12')](function(){if(_0x5f6e71){return _0x5f6e71[_0x26ac('0x57')]({'raw':!![]});}})[_0x26ac('0x12')](function(_0x5c7ae8){if(_0x5f6e71){if(_0x5c7ae8){var _0x4a799c=[];_0x427eed=_0x5c7ae8;if(_0x427eed['length']){for(var _0x1cd152=0x0;_0x1cd152<_0x427eed[_0x26ac('0x30')];_0x1cd152++){_0x4a799c['push'](db[_0x26ac('0x2c')][_0x26ac('0x58')]({'membername':_0x5f6e71[_0x26ac('0x2a')],'UserId':_0x5f6e71['id'],'queue_name':_0x427eed[_0x1cd152][_0x26ac('0x2a')],'VoiceQueueId':_0x427eed[_0x1cd152]['id'],'interface':_0x2252a4,'paused':_0x5f6e71[_0x26ac('0x52')]||![],'penalty':_0x427eed[_0x1cd152][_0x26ac('0x59')]||0x0}));}return BPromise[_0x26ac('0x4a')](_0x4a799c);}}}})[_0x26ac('0x12')](function(){if(_0x5f6e71){return db[_0x26ac('0x2e')][_0x26ac('0x1e')]({'where':{'membername':_0x5f6e71[_0x26ac('0x2a')],'exitAt':null}});}})['then'](function(_0x8e5aeb){if(_0x5f6e71){if(_0x8e5aeb&&_0x8e5aeb['length']){var _0x14f4e3=[];_0x8e5aeb['forEach'](function(_0x67e35d){_0x14f4e3['push'](_0x67e35d['update']({'exitAt':moment()['format'](_0x26ac('0x32'))}));});return BPromise[_0x26ac('0x4a')](_0x14f4e3);}}})[_0x26ac('0x12')](function(_0x153b86){if(_0x5f6e71){var _0x2537e0=[];var _0x57e15c=[];var _0xc352b9=utils[_0x26ac('0x34')]();var _0x3980bd={'membername':_0x5f6e71['name'],'interface':_0x2252a4,'enterAt':moment()[_0x26ac('0x31')](_0x26ac('0x32')),'role':_0x5f6e71[_0x26ac('0x2b')],'internal':_0x5f6e71[_0x26ac('0x51')]};_0xc352b9['forEach'](function(_0x531708){_0x2537e0[_0x26ac('0x36')](_[_0x26ac('0x5a')]({'channel':_0x531708,'type':_0x26ac('0x5b'),'data1':_0x26ac('0x5c'),'data2':_0x2252a4},_0x3980bd));if(_0x5f6e71['loginInPause']){_0x57e15c[_0x26ac('0x36')](_['merge']({'channel':_0x531708,'type':_0x26ac('0x2f'),'data1':_0x26ac('0x5d')},_0x3980bd));}});return db[_0x26ac('0x2e')]['bulkCreate'](_0x2537e0[_0x26ac('0x5e')](_0x57e15c),{'individualHooks':!![]});}})['then'](function(){if(_0x5f6e71){return _0x5f6e71[_0x26ac('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0x26ac('0x32')),'voicePause':_0x5f6e71[_0x26ac('0x52')]||![],'mailPause':_0x5f6e71[_0x26ac('0x52')]||![],'chatPause':_0x5f6e71[_0x26ac('0x52')]||![],'faxPause':_0x5f6e71[_0x26ac('0x52')]||![],'smsPause':_0x5f6e71['loginInPause']||![],'openchannelPause':_0x5f6e71[_0x26ac('0x52')]||![],'pauseType':_0x5f6e71[_0x26ac('0x52')]?_0x26ac('0x5d'):null,'lastPauseAt':moment()[_0x26ac('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2252a4});}})[_0x26ac('0x12')](function(_0x161640){_0xc81169(_0x161640);})[_0x26ac('0x1c')](function(_0x1b91fa){_0x450e63(_0x4e1043['error'](0x1f4,_0x1b91fa[_0x26ac('0x1b')]));});});}; \ No newline at end of file +var _0x2839=['all','LogoutUser','destroy','LoginUser','phone','loginInPause','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','bulkCreate','concat','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetUser','User','options','attributes','map','include','model','stringify','ShowUser','find','raw','where','PauseUser','name','internal','interface','UserVoiceQueueRt','update','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','format','body','type','role','MemberReport','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','set','%s%s','Pause','forEach'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x2839,0xca));var _0x9283=function(_0x2fc331,_0x3781ae){_0x2fc331=_0x2fc331-0x0;var _0x3f0810=_0x2839[_0x2fc331];return _0x3f0810;};'use strict';var _=require(_0x9283('0x0'));var util=require('util');var moment=require(_0x9283('0x1'));var BPromise=require('bluebird');var rs=require(_0x9283('0x2'));var fs=require('fs');var Redis=require(_0x9283('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9283('0x4'));var logger=require(_0x9283('0x5'))(_0x9283('0x6'));var config=require('../../config/environment');var jayson=require(_0x9283('0x7'));var client=jayson[_0x9283('0x8')][_0x9283('0x9')]({'port':0x232a});config[_0x9283('0xa')]=_[_0x9283('0xb')](config['redis'],{'host':_0x9283('0xc'),'port':0x18eb});var socket=require(_0x9283('0xd'))(new Redis(config[_0x9283('0xa')]));require(_0x9283('0xe'))[_0x9283('0xf')](socket);function respondWithRpcPromise(_0x361b0f,_0x142267,_0x584f67){return new BPromise(function(_0x5961d0,_0x525935){return client[_0x9283('0x10')](_0x361b0f,_0x584f67)[_0x9283('0x11')](function(_0x3a7b6e){logger[_0x9283('0x12')](_0x9283('0x13'),_0x142267,_0x9283('0x14'));logger[_0x9283('0x15')](_0x9283('0x16'),_0x142267,_0x9283('0x14'),JSON['stringify'](_0x3a7b6e));if(_0x3a7b6e[_0x9283('0x17')]){if(_0x3a7b6e[_0x9283('0x17')]['code']===0x1f4){logger[_0x9283('0x17')](_0x9283('0x13'),_0x142267,_0x3a7b6e['error'][_0x9283('0x18')]);return _0x525935(_0x3a7b6e[_0x9283('0x17')][_0x9283('0x18')]);}logger[_0x9283('0x17')](_0x9283('0x13'),_0x142267,_0x3a7b6e[_0x9283('0x17')][_0x9283('0x18')]);return _0x5961d0(_0x3a7b6e[_0x9283('0x17')][_0x9283('0x18')]);}else{logger[_0x9283('0x12')]('User,\x20%s,\x20%s',_0x142267,_0x9283('0x14'));_0x5961d0(_0x3a7b6e[_0x9283('0x19')]['message']);}})[_0x9283('0x1a')](function(_0x1ebf32){logger[_0x9283('0x17')](_0x9283('0x13'),_0x142267,_0x1ebf32);_0x525935(_0x1ebf32);});});}exports[_0x9283('0x1b')]=function(_0x91cce0){var _0x250c1c=this;return new Promise(function(_0x19a650,_0x4033c3){return db[_0x9283('0x1c')]['findAll']({'raw':_0x91cce0[_0x9283('0x1d')]?_0x91cce0[_0x9283('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x91cce0['options']?_0x91cce0['options']['where']||null:null,'attributes':_0x91cce0[_0x9283('0x1d')]?_0x91cce0[_0x9283('0x1d')][_0x9283('0x1e')]||null:null,'limit':_0x91cce0[_0x9283('0x1d')]?_0x91cce0[_0x9283('0x1d')]['limit']||null:null,'include':_0x91cce0[_0x9283('0x1d')]?_0x91cce0[_0x9283('0x1d')]['include']?_[_0x9283('0x1f')](_0x91cce0[_0x9283('0x1d')][_0x9283('0x20')],function(_0x17edfc){return{'model':db[_0x17edfc['model']],'as':_0x17edfc['as'],'attributes':_0x17edfc['attributes'],'include':_0x17edfc['include']?_[_0x9283('0x1f')](_0x17edfc[_0x9283('0x20')],function(_0x9a6755){return{'model':db[_0x9a6755['model']],'as':_0x9a6755['as'],'attributes':_0x9a6755['attributes'],'include':_0x9a6755[_0x9283('0x20')]?_[_0x9283('0x1f')](_0x9a6755[_0x9283('0x20')],function(_0x7ee324){return{'model':db[_0x7ee324[_0x9283('0x21')]],'as':_0x7ee324['as'],'attributes':_0x7ee324[_0x9283('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9283('0x11')](function(_0x20512f){logger[_0x9283('0x12')](_0x9283('0x1b'),_0x91cce0);logger[_0x9283('0x15')](_0x9283('0x1b'),_0x91cce0,JSON[_0x9283('0x22')](_0x20512f));_0x19a650(_0x20512f);})[_0x9283('0x1a')](function(_0x2ce54f){logger[_0x9283('0x17')](_0x9283('0x1b'),_0x2ce54f[_0x9283('0x18')],_0x91cce0);_0x4033c3(_0x250c1c['error'](0x1f4,_0x2ce54f[_0x9283('0x18')]));});});};exports[_0x9283('0x23')]=function(_0x13fafc){var _0x4621fb=this;return new Promise(function(_0x9bac3,_0x34bed6){return db[_0x9283('0x1c')][_0x9283('0x24')]({'raw':_0x13fafc[_0x9283('0x1d')]?_0x13fafc['options'][_0x9283('0x25')]===undefined?!![]:![]:!![],'where':_0x13fafc[_0x9283('0x1d')]?_0x13fafc[_0x9283('0x1d')][_0x9283('0x26')]||null:null,'attributes':_0x13fafc[_0x9283('0x1d')]?_0x13fafc['options'][_0x9283('0x1e')]||null:null,'include':_0x13fafc[_0x9283('0x1d')]?_0x13fafc['options'][_0x9283('0x20')]?_[_0x9283('0x1f')](_0x13fafc['options'][_0x9283('0x20')],function(_0x4e413e){return{'model':db[_0x4e413e['model']],'as':_0x4e413e['as'],'attributes':_0x4e413e[_0x9283('0x1e')],'include':_0x4e413e['include']?_[_0x9283('0x1f')](_0x4e413e['include'],function(_0x4e7a2f){return{'model':db[_0x4e7a2f[_0x9283('0x21')]],'as':_0x4e7a2f['as'],'attributes':_0x4e7a2f[_0x9283('0x1e')],'include':_0x4e7a2f[_0x9283('0x20')]?_[_0x9283('0x1f')](_0x4e7a2f[_0x9283('0x20')],function(_0x4756b8){return{'model':db[_0x4756b8[_0x9283('0x21')]],'as':_0x4756b8['as'],'attributes':_0x4756b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x9283('0x11')](function(_0x4eea20){logger[_0x9283('0x12')](_0x9283('0x23'),_0x13fafc);logger[_0x9283('0x15')](_0x9283('0x23'),_0x13fafc,JSON['stringify'](_0x4eea20));_0x9bac3(_0x4eea20);})[_0x9283('0x1a')](function(_0x570147){logger[_0x9283('0x17')](_0x9283('0x23'),_0x570147[_0x9283('0x18')],_0x13fafc);_0x34bed6(_0x4621fb[_0x9283('0x17')](0x1f4,_0x570147['message']));});});};exports[_0x9283('0x27')]=function(_0x39a288){var _0x9d1534=this;return new Promise(function(_0x53bc37,_0x56b444){var _0x20254e;return db[_0x9283('0x1c')][_0x9283('0x24')]({'where':_0x39a288[_0x9283('0x1d')][_0x9283('0x26')]||{},'attributes':['id',_0x9283('0x28'),'role',_0x9283('0x29'),_0x9283('0x2a')]})[_0x9283('0x11')](function(_0x42bc6d){if(_0x42bc6d){_0x20254e=_0x42bc6d;return db[_0x9283('0x2b')][_0x9283('0x2c')]({'paused':0x1},{'where':{'UserId':_0x20254e['id']},'individualHooks':!![]});}})['then'](function(){if(_0x20254e){return db['MemberReport'][_0x9283('0x2d')]({'where':{'membername':_0x20254e[_0x9283('0x28')],'type':_0x9283('0x2e'),'exitAt':null}});}})[_0x9283('0x11')](function(_0x1b5b8e){if(_0x20254e){if(_0x1b5b8e&&_0x1b5b8e[_0x9283('0x2f')]){var _0x2bd53b=moment()['format'](_0x9283('0x30'));for(var _0x59d192=0x0,_0x194bc4=_0x1b5b8e[_0x9283('0x2f')];_0x59d192<_0x194bc4;_0x59d192++){_0x1b5b8e[_0x59d192][_0x9283('0x31')]({'exitAt':_0x2bd53b});}}}})[_0x9283('0x11')](function(){if(_0x20254e){var _0x28caa2=[];var _0x1140a8=utils[_0x9283('0x32')]();_0x1140a8['forEach'](function(_0x712ca6){_0x28caa2[_0x9283('0x33')]({'channel':_0x712ca6,'membername':_0x20254e[_0x9283('0x28')],'interface':_[_0x9283('0x34')](_0x20254e['interface'])?util['format'](_0x9283('0x35'),_0x20254e[_0x9283('0x28')]):_0x20254e[_0x9283('0x2a')],'type':_0x9283('0x2e'),'enterAt':moment()[_0x9283('0x36')](_0x9283('0x30')),'data1':_0x39a288[_0x9283('0x37')][_0x9283('0x38')]||'DEFAULT\x20PAUSE','role':_0x20254e[_0x9283('0x39')],'internal':_0x20254e[_0x9283('0x29')],'uniqueid':_0x39a288['body']['uniqueid']||null});});return db[_0x9283('0x3a')]['bulkCreate'](_0x28caa2,{'individualHooks':!![]});}})[_0x9283('0x11')](function(){if(_0x20254e){return _0x20254e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x39a288[_0x9283('0x37')]['type']||_0x9283('0x3b'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x9283('0x11')](function(_0x3e4479){_0x53bc37(_0x3e4479);})[_0x9283('0x1a')](function(_0x3c21ae){_0x56b444(_0x9d1534[_0x9283('0x17')](0x1f4,_0x3c21ae['message']));});});};exports[_0x9283('0x3c')]=function(_0x3fa767){var _0x40c3bb=this;return new Promise(function(_0x4f37d8,_0x2ba725){var _0x4d7bd6;return db[_0x9283('0x1c')][_0x9283('0x3d')]({'where':_0x3fa767[_0x9283('0x1d')][_0x9283('0x26')]||{},'attributes':['id',_0x9283('0x28')]})['then'](function(_0x18c2b9){if(_0x18c2b9){_0x4d7bd6=_0x18c2b9;if(_0x3fa767[_0x9283('0x37')][_0x9283('0x3e')]&&!utils['isValidChannel'](_0x3fa767[_0x9283('0x37')]['channel'])){throw new Error(_0x9283('0x3f'));}switch(_0x3fa767[_0x9283('0x37')][_0x9283('0x3e')]){case _0x9283('0x40'):return db[_0x9283('0x2b')][_0x9283('0x2c')]({'paused':0x0},{'where':{'UserId':_0x4d7bd6['id']}})[_0x9283('0x11')](function(){return db['MemberReport'][_0x9283('0x24')]({'where':{'channel':_0x3fa767['body'][_0x9283('0x3e')],'membername':_0x4d7bd6['name'],'type':'PAUSE','exitAt':null}});})[_0x9283('0x11')](function(_0x4749bc){if(_0x4749bc){return _0x4749bc['update']({'exitAt':moment()['format'](_0x9283('0x30')),'data2':_0x9283('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x4d7bd6[_0x9283('0x2c')]({'voicePause':![]});});case _0x9283('0x42'):case _0x9283('0x43'):case _0x9283('0x44'):case _0x9283('0x45'):case'openchannel':case'whatsapp':return db[_0x9283('0x3a')]['find']({'where':{'channel':_0x3fa767[_0x9283('0x37')][_0x9283('0x3e')],'membername':_0x4d7bd6[_0x9283('0x28')],'type':_0x9283('0x2e'),'exitAt':null}})[_0x9283('0x11')](function(_0x3106e3){return _0x3106e3[_0x9283('0x2c')]({'exitAt':moment()[_0x9283('0x36')](_0x9283('0x30')),'data2':_0x9283('0x41')},{'individualHooks':!![]});})['then'](function(){var _0x2892f0={};_[_0x9283('0x46')](_0x2892f0,util['format'](_0x9283('0x47'),_0x3fa767[_0x9283('0x37')][_0x9283('0x3e')],_0x9283('0x48')),![]);return _0x4d7bd6[_0x9283('0x2c')](_0x2892f0);});default:return db['UserVoiceQueueRt'][_0x9283('0x2c')]({'paused':0x0},{'where':{'UserId':_0x4d7bd6['id']}})[_0x9283('0x11')](function(){return db[_0x9283('0x3a')][_0x9283('0x2d')]({'where':{'membername':_0x4d7bd6[_0x9283('0x28')],'type':_0x9283('0x2e'),'exitAt':null}});})['then'](function(_0x2ac905){var _0x59598d=[];_0x2ac905[_0x9283('0x49')](function(_0x18c6a5){_0x59598d['push'](_0x18c6a5[_0x9283('0x2c')]({'exitAt':moment()['format'](_0x9283('0x30')),'data2':_0x9283('0x41')}));});return BPromise[_0x9283('0x4a')](_0x59598d);})[_0x9283('0x11')](function(){return _0x4d7bd6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x9283('0x11')](function(_0x5b73d0){_0x4f37d8(_0x5b73d0);})[_0x9283('0x1a')](function(_0x5b1fc3){_0x2ba725(_0x40c3bb['error'](0x1f4,_0x5b1fc3['message']));});});};exports[_0x9283('0x4b')]=function(_0xb06cb9){var _0x13c416=this;return new Promise(function(_0x1d98b5,_0x39b867){var _0x171b98;return db[_0x9283('0x1c')]['findOne']({'where':_0xb06cb9[_0x9283('0x1d')][_0x9283('0x26')]||{},'attributes':['id',_0x9283('0x28')]})[_0x9283('0x11')](function(_0x3c5d0a){if(_0x3c5d0a){_0x171b98=_0x3c5d0a;return db['UserVoiceQueueRt'][_0x9283('0x4c')]({'where':{'membername':_0x171b98[_0x9283('0x28')]},'individualHooks':!![]});}})[_0x9283('0x11')](function(){if(_0x171b98){return db['MemberReport']['findAll']({'where':{'membername':_0x171b98[_0x9283('0x28')],'exitAt':null}});}})[_0x9283('0x11')](function(_0x2db1e2){if(_0x171b98){if(_0x2db1e2&&_0x2db1e2['length']){var _0x1564bf=[];_0x2db1e2[_0x9283('0x49')](function(_0x1b3233){_0x1564bf['push'](_0x1b3233[_0x9283('0x2c')]({'exitAt':moment()['format'](_0x9283('0x30'))}));});return BPromise['all'](_0x1564bf);}}})[_0x9283('0x11')](function(){if(_0x171b98){return _0x171b98[_0x9283('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9283('0x11')](function(_0x281e1e){_0x1d98b5(_0x281e1e);})[_0x9283('0x1a')](function(_0x2507b9){_0x39b867(_0x13c416['error'](0x1f4,_0x2507b9[_0x9283('0x18')]));});});};exports[_0x9283('0x4d')]=function(_0x1e80e){var _0x46ec52=this;return new Promise(function(_0x458c89,_0x2628ae){var _0x5c4051;var _0x3af5c9;var _0x43f3ea;var _0x19470a;return db[_0x9283('0x1c')][_0x9283('0x3d')]({'where':_0x1e80e['options']['where']||{},'attributes':['id','name',_0x9283('0x39'),'mobile',_0x9283('0x4e'),_0x9283('0x29'),_0x9283('0x4f'),_0x9283('0x2a')]})[_0x9283('0x11')](function(_0x43c729){if(_0x43c729){_0x5c4051=_0x43c729;_0x19470a=_0x1e80e[_0x9283('0x37')][_0x9283('0x2a')]?_0x1e80e[_0x9283('0x37')][_0x9283('0x2a')]:util[_0x9283('0x36')](_0x9283('0x35'),_0x5c4051[_0x9283('0x28')]);return db[_0x9283('0x1c')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5c4051['id']}}});}})[_0x9283('0x11')](function(_0x4f41e7){if(_0x4f41e7){_0x43f3ea=_0x4f41e7;return require(_0x9283('0x50'))[_0x9283('0x51')]();}})[_0x9283('0x11')](function(_0x1cc806){if(_0x1cc806&&_0x1cc806[_0x9283('0x52')]&&_0x43f3ea>=_0x1cc806[_0x9283('0x52')]){throw new Error(_0x9283('0x53'));}})[_0x9283('0x11')](function(){if(_0x5c4051){return db[_0x9283('0x2b')]['destroy']({'where':{'membername':_0x5c4051['name']},'individualHooks':!![]});}})[_0x9283('0x11')](function(){if(_0x5c4051){return _0x5c4051['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x154821){if(_0x5c4051){if(_0x154821){var _0x1013bc=[];_0x3af5c9=_0x154821;if(_0x3af5c9['length']){for(var _0x44cc16=0x0;_0x44cc16<_0x3af5c9[_0x9283('0x2f')];_0x44cc16++){_0x1013bc[_0x9283('0x33')](db[_0x9283('0x2b')][_0x9283('0x54')]({'membername':_0x5c4051[_0x9283('0x28')],'UserId':_0x5c4051['id'],'queue_name':_0x3af5c9[_0x44cc16]['name'],'VoiceQueueId':_0x3af5c9[_0x44cc16]['id'],'interface':_0x19470a,'paused':_0x5c4051[_0x9283('0x4f')]||![],'penalty':_0x3af5c9[_0x44cc16][_0x9283('0x55')]||0x0}));}return BPromise[_0x9283('0x4a')](_0x1013bc);}}}})['then'](function(){if(_0x5c4051){return db[_0x9283('0x3a')]['findAll']({'where':{'membername':_0x5c4051[_0x9283('0x28')],'exitAt':null}});}})['then'](function(_0x18562d){if(_0x5c4051){if(_0x18562d&&_0x18562d[_0x9283('0x2f')]){var _0x12ef38=[];_0x18562d[_0x9283('0x49')](function(_0xb41e66){_0x12ef38['push'](_0xb41e66['update']({'exitAt':moment()[_0x9283('0x36')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9283('0x4a')](_0x12ef38);}}})[_0x9283('0x11')](function(_0x3bf10e){if(_0x5c4051){var _0x1d356e=[];var _0x2f84d1=[];var _0x2ba5be=utils['getChannels']();var _0x543d46={'membername':_0x5c4051[_0x9283('0x28')],'interface':_0x19470a,'enterAt':moment()[_0x9283('0x36')](_0x9283('0x30')),'role':_0x5c4051[_0x9283('0x39')],'internal':_0x5c4051['internal']};_0x2ba5be['forEach'](function(_0x904ef){_0x1d356e['push'](_['merge']({'channel':_0x904ef,'type':_0x9283('0x56'),'data1':_0x9283('0x57'),'data2':_0x19470a},_0x543d46));if(_0x5c4051[_0x9283('0x4f')]){_0x2f84d1[_0x9283('0x33')](_[_0x9283('0x58')]({'channel':_0x904ef,'type':_0x9283('0x2e'),'data1':_0x9283('0x59')},_0x543d46));}});return db[_0x9283('0x3a')][_0x9283('0x5a')](_0x1d356e[_0x9283('0x5b')](_0x2f84d1),{'individualHooks':!![]});}})[_0x9283('0x11')](function(){if(_0x5c4051){return _0x5c4051[_0x9283('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x9283('0x36')](_0x9283('0x30')),'voicePause':_0x5c4051[_0x9283('0x4f')]||![],'mailPause':_0x5c4051[_0x9283('0x4f')]||![],'chatPause':_0x5c4051[_0x9283('0x4f')]||![],'faxPause':_0x5c4051[_0x9283('0x4f')]||![],'smsPause':_0x5c4051[_0x9283('0x4f')]||![],'openchannelPause':_0x5c4051['loginInPause']||![],'pauseType':_0x5c4051[_0x9283('0x4f')]?_0x9283('0x59'):null,'lastPauseAt':moment()['format'](_0x9283('0x30')),'interface':_0x19470a});}})[_0x9283('0x11')](function(_0x82a89d){_0x458c89(_0x82a89d);})['catch'](function(_0x4eaeeb){_0x2628ae(_0x46ec52[_0x9283('0x17')](0x1f4,_0x4eaeeb[_0x9283('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8b6146c..b0355ee 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 _0xcd35=['user:','./user.events','save','remove','update','emit','removeListener','register'];(function(_0x2a50fc,_0x792726){var _0x5aa6a2=function(_0x26ca83){while(--_0x26ca83){_0x2a50fc['push'](_0x2a50fc['shift']());}};_0x5aa6a2(++_0x792726);}(_0xcd35,0x119));var _0x5cd3=function(_0x3e5252,_0x250d00){_0x3e5252=_0x3e5252-0x0;var _0xa2ec84=_0xcd35[_0x3e5252];return _0xa2ec84;};'use strict';var UserEvents=require(_0x5cd3('0x0'));var events=[_0x5cd3('0x1'),_0x5cd3('0x2'),_0x5cd3('0x3')];function createListener(_0x3a6b96,_0x1ca84f){return function(_0x356d7c){_0x1ca84f[_0x5cd3('0x4')](_0x3a6b96,_0x356d7c);};}function removeListener(_0x50997c,_0x42ff82){return function(){UserEvents[_0x5cd3('0x5')](_0x50997c,_0x42ff82);};}exports[_0x5cd3('0x6')]=function(_0x3ff39b){for(var _0x311e5f=0x0,_0xd23279=events['length'];_0x311e5f<_0xd23279;_0x311e5f++){var _0x2e4e3e=events[_0x311e5f];var _0x114412=createListener(_0x5cd3('0x7')+_0x2e4e3e,_0x3ff39b);UserEvents['on'](_0x2e4e3e,_0x114412);}}; \ No newline at end of file +var _0xc988=['update','emit','removeListener','register','user:'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xc988,0x1cc));var _0x8c98=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xc988[_0x576170];return _0x397c70;};'use strict';var UserEvents=require('./user.events');var events=['save','remove',_0x8c98('0x0')];function createListener(_0x6d9df,_0x50036b){return function(_0x3b409d){_0x50036b[_0x8c98('0x1')](_0x6d9df,_0x3b409d);};}function removeListener(_0xcde86e,_0x19e7a5){return function(){UserEvents[_0x8c98('0x2')](_0xcde86e,_0x19e7a5);};}exports[_0x8c98('0x3')]=function(_0x45ecd0){for(var _0x39bbc0=0x0,_0xbe8431=events['length'];_0x39bbc0<_0xbe8431;_0x39bbc0++){var _0x2510f6=events[_0x39bbc0];var _0x567a2a=createListener(_0x8c98('0x4')+_0x2510f6,_0x45ecd0);UserEvents['on'](_0x2510f6,_0x567a2a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 07784b0..72fdfd4 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x6b4f14,_0x32dd02){var _0x10511a=function(_0x13cb36){while(--_0x13cb36){_0x6b4f14['push'](_0x6b4f14['shift']());}};_0x10511a(++_0x32dd02);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x571db3,_0x419d9a){var _0x1034be=function(_0x333d8c){while(--_0x333d8c){_0x571db3['push'](_0x571db3['shift']());}};_0x1034be(++_0x419d9a);}(_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 9006424..5e76dab 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf75b=['exports','INTEGER','sequelize'];(function(_0x425541,_0x5dec0e){var _0x455616=function(_0x28e721){while(--_0x28e721){_0x425541['push'](_0x425541['shift']());}};_0x455616(++_0x5dec0e);}(_0xf75b,0x1f4));var _0xbf75=function(_0x50e888,_0x29b0d8){_0x50e888=_0x50e888-0x0;var _0x646a07=_0xf75b[_0x50e888];return _0x646a07;};'use strict';var Sequelize=require(_0xbf75('0x0'));module[_0xbf75('0x1')]={'penalty':{'type':Sequelize[_0xbf75('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 0fbbd0b..34c4a31 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 _0x23a1=['api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','util','../../config/logger'];(function(_0x13f6bb,_0x1d625f){var _0x413673=function(_0x6dacf6){while(--_0x6dacf6){_0x13f6bb['push'](_0x13f6bb['shift']());}};_0x413673(++_0x1d625f);}(_0x23a1,0xda));var _0x123a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x23a1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x123a('0x0'));var logger=require(_0x123a('0x1'))(_0x123a('0x2'));var moment=require('moment');var BPromise=require(_0x123a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x123a('0x4'));var rimraf=require(_0x123a('0x5'));var config=require(_0x123a('0x6'));var attributes=require(_0x123a('0x7'));module['exports']=function(_0x41d665,_0x53c793){return _0x41d665[_0x123a('0x8')]('UserChatQueue',attributes,{'tableName':_0x123a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5108=['define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','./userChatQueue.attributes','exports'];(function(_0xe64b39,_0x21e115){var _0x43eb66=function(_0x1ca777){while(--_0x1ca777){_0xe64b39['push'](_0xe64b39['shift']());}};_0x43eb66(++_0x21e115);}(_0x5108,0x7c));var _0x8510=function(_0x528a8a,_0x5e138f){_0x528a8a=_0x528a8a-0x0;var _0x4469f5=_0x5108[_0x528a8a];return _0x4469f5;};'use strict';var _=require(_0x8510('0x0'));var util=require(_0x8510('0x1'));var logger=require(_0x8510('0x2'))(_0x8510('0x3'));var moment=require('moment');var BPromise=require(_0x8510('0x4'));var rp=require(_0x8510('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8510('0x6'));module[_0x8510('0x7')]=function(_0x47a1df,_0x3c40f4){return _0x47a1df[_0x8510('0x8')](_0x8510('0x9'),attributes,{'tableName':_0x8510('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 fb5a871..f9e5fbc 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 _0xd821=['jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd821,0x16e));var _0x1d82=function(_0xae06d3,_0x572d98){_0xae06d3=_0xae06d3-0x0;var _0x284f15=_0xd821[_0xae06d3];return _0x284f15;};'use strict';var _=require(_0x1d82('0x0'));var util=require(_0x1d82('0x1'));var moment=require('moment');var BPromise=require(_0x1d82('0x2'));var rs=require(_0x1d82('0x3'));var fs=require('fs');var Redis=require(_0x1d82('0x4'));var db=require(_0x1d82('0x5'))['db'];var utils=require(_0x1d82('0x6'));var logger=require('../../config/logger')(_0x1d82('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d82('0x8'));var client=jayson['client'][_0x1d82('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e3bdd,_0x3868b1,_0x594271){return new BPromise(function(_0x5cc74b,_0x273ef1){return client[_0x1d82('0xa')](_0x2e3bdd,_0x594271)[_0x1d82('0xb')](function(_0x3b7be9){logger[_0x1d82('0xc')](_0x1d82('0xd'),_0x3868b1,'request\x20sent');logger[_0x1d82('0xe')](_0x1d82('0xf'),_0x3868b1,_0x1d82('0x10'),JSON[_0x1d82('0x11')](_0x3b7be9));if(_0x3b7be9[_0x1d82('0x12')]){if(_0x3b7be9[_0x1d82('0x12')][_0x1d82('0x13')]===0x1f4){logger['error'](_0x1d82('0xd'),_0x3868b1,_0x3b7be9[_0x1d82('0x12')][_0x1d82('0x14')]);return _0x273ef1(_0x3b7be9[_0x1d82('0x12')]['message']);}logger[_0x1d82('0x12')](_0x1d82('0xd'),_0x3868b1,_0x3b7be9[_0x1d82('0x12')][_0x1d82('0x14')]);return _0x5cc74b(_0x3b7be9[_0x1d82('0x12')]['message']);}else{logger[_0x1d82('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x3868b1,_0x1d82('0x10'));_0x5cc74b(_0x3b7be9[_0x1d82('0x15')][_0x1d82('0x14')]);}})['catch'](function(_0xc735e3){logger[_0x1d82('0x12')](_0x1d82('0xd'),_0x3868b1,_0xc735e3);_0x273ef1(_0xc735e3);});});} \ No newline at end of file +var _0xa1f0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xa1f0,0xe4));var _0x0a1f=function(_0x59f8b5,_0x582975){_0x59f8b5=_0x59f8b5-0x0;var _0x4ef083=_0xa1f0[_0x59f8b5];return _0x4ef083;};'use strict';var _=require(_0x0a1f('0x0'));var util=require(_0x0a1f('0x1'));var moment=require('moment');var BPromise=require(_0x0a1f('0x2'));var rs=require(_0x0a1f('0x3'));var fs=require('fs');var Redis=require(_0x0a1f('0x4'));var db=require(_0x0a1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a1f('0x6'))(_0x0a1f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a1f('0x8')][_0x0a1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4da7e5,_0x5d5496,_0x3c75d4){return new BPromise(function(_0x525413,_0x1c9c9f){return client[_0x0a1f('0xa')](_0x4da7e5,_0x3c75d4)[_0x0a1f('0xb')](function(_0x1f9abc){logger['info'](_0x0a1f('0xc'),_0x5d5496,_0x0a1f('0xd'));logger['debug'](_0x0a1f('0xe'),_0x5d5496,_0x0a1f('0xd'),JSON[_0x0a1f('0xf')](_0x1f9abc));if(_0x1f9abc[_0x0a1f('0x10')]){if(_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x11')]===0x1f4){logger[_0x0a1f('0x10')](_0x0a1f('0xc'),_0x5d5496,_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x12')]);return _0x1c9c9f(_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x12')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5d5496,_0x1f9abc[_0x0a1f('0x10')]['message']);return _0x525413(_0x1f9abc[_0x0a1f('0x10')][_0x0a1f('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x5d5496,_0x0a1f('0xd'));_0x525413(_0x1f9abc[_0x0a1f('0x13')]['message']);}})[_0x0a1f('0x14')](function(_0x45f426){logger[_0x0a1f('0x10')](_0x0a1f('0xc'),_0x5d5496,_0x45f426);_0x1c9c9f(_0x45f426);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d751c8b..95da337 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x272a46,_0x12b300){var _0x2bfd12=function(_0x4a3d5f){while(--_0x4a3d5f){_0x272a46['push'](_0x272a46['shift']());}};_0x2bfd12(++_0x12b300);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x567d04,_0x3d13a1){var _0x58ee79=function(_0x4c5548){while(--_0x4c5548){_0x567d04['push'](_0x567d04['shift']());}};_0x58ee79(++_0x3d13a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 957df4b..81a0338 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 _0xb38d=['sequelize','exports'];(function(_0x30587f,_0x38e526){var _0x34806c=function(_0xd960f7){while(--_0xd960f7){_0x30587f['push'](_0x30587f['shift']());}};_0x34806c(++_0x38e526);}(_0xb38d,0x1ee));var _0xdb38=function(_0x4b9c9f,_0x1b1aee){_0x4b9c9f=_0x4b9c9f-0x0;var _0x2f7d34=_0xb38d[_0x4b9c9f];return _0x2f7d34;};'use strict';var Sequelize=require(_0xdb38('0x0'));module[_0xdb38('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb55c=['INTEGER','sequelize'];(function(_0x1d3c0e,_0x146084){var _0x571395=function(_0x5b55bf){while(--_0x5b55bf){_0x1d3c0e['push'](_0x1d3c0e['shift']());}};_0x571395(++_0x146084);}(_0xb55c,0x18f));var _0xcb55=function(_0x129259,_0x3c39ec){_0x129259=_0x129259-0x0;var _0x110f34=_0xb55c[_0x129259];return _0x110f34;};'use strict';var Sequelize=require(_0xcb55('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb55('0x1')],'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 2d4b1f3..b54c722 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 _0xbb05=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','bluebird','request-promise'];(function(_0x12c05d,_0x2731a0){var _0x5bb6a7=function(_0x172444){while(--_0x172444){_0x12c05d['push'](_0x12c05d['shift']());}};_0x5bb6a7(++_0x2731a0);}(_0xbb05,0xe3));var _0x5bb0=function(_0xbfdd7d,_0x148ca3){_0xbfdd7d=_0xbfdd7d-0x0;var _0x1a5a58=_0xbb05[_0xbfdd7d];return _0x1a5a58;};'use strict';var _=require(_0x5bb0('0x0'));var util=require('util');var logger=require(_0x5bb0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5bb0('0x2'));var rp=require(_0x5bb0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bb0('0x4'));var config=require(_0x5bb0('0x5'));var attributes=require(_0x5bb0('0x6'));module[_0x5bb0('0x7')]=function(_0x134fc8,_0x1a1898){return _0x134fc8[_0x5bb0('0x8')](_0x5bb0('0x9'),attributes,{'tableName':_0x5bb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53dc=['path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','util','moment','bluebird','request-promise'];(function(_0x14c006,_0x252012){var _0x553023=function(_0x427486){while(--_0x427486){_0x14c006['push'](_0x14c006['shift']());}};_0x553023(++_0x252012);}(_0x53dc,0x11a));var _0xc53d=function(_0x49367e,_0x46a9d4){_0x49367e=_0x49367e-0x0;var _0x1ae9ef=_0x53dc[_0x49367e];return _0x1ae9ef;};'use strict';var _=require('lodash');var util=require(_0xc53d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc53d('0x1'));var BPromise=require(_0xc53d('0x2'));var rp=require(_0xc53d('0x3'));var fs=require('fs');var path=require(_0xc53d('0x4'));var rimraf=require(_0xc53d('0x5'));var config=require(_0xc53d('0x6'));var attributes=require(_0xc53d('0x7'));module['exports']=function(_0x5a431a,_0x1e4856){return _0x5a431a[_0xc53d('0x8')](_0xc53d('0x9'),attributes,{'tableName':_0xc53d('0xa'),'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 cc34a24..0f6e7b8 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 _0xe9f5=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment'];(function(_0x38de59,_0x5086a9){var _0xd75309=function(_0x1ce1df){while(--_0x1ce1df){_0x38de59['push'](_0x38de59['shift']());}};_0xd75309(++_0x5086a9);}(_0xe9f5,0x6c));var _0x5e9f=function(_0x596c92,_0x552cec){_0x596c92=_0x596c92-0x0;var _0x5baefa=_0xe9f5[_0x596c92];return _0x5baefa;};'use strict';var _=require('lodash');var util=require(_0x5e9f('0x0'));var moment=require(_0x5e9f('0x1'));var BPromise=require(_0x5e9f('0x2'));var rs=require(_0x5e9f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e9f('0x4'));var logger=require(_0x5e9f('0x5'))(_0x5e9f('0x6'));var config=require(_0x5e9f('0x7'));var jayson=require(_0x5e9f('0x8'));var client=jayson[_0x5e9f('0x9')][_0x5e9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3cfb,_0xceccc6,_0x21d389){return new BPromise(function(_0x12f390,_0x43ad3f){return client[_0x5e9f('0xb')](_0x1c3cfb,_0x21d389)[_0x5e9f('0xc')](function(_0x44466e){logger[_0x5e9f('0xd')](_0x5e9f('0xe'),_0xceccc6,'request\x20sent');logger[_0x5e9f('0xf')](_0x5e9f('0x10'),_0xceccc6,_0x5e9f('0x11'),JSON[_0x5e9f('0x12')](_0x44466e));if(_0x44466e[_0x5e9f('0x13')]){if(_0x44466e[_0x5e9f('0x13')]['code']===0x1f4){logger['error'](_0x5e9f('0xe'),_0xceccc6,_0x44466e[_0x5e9f('0x13')][_0x5e9f('0x14')]);return _0x43ad3f(_0x44466e[_0x5e9f('0x13')]['message']);}logger['error'](_0x5e9f('0xe'),_0xceccc6,_0x44466e[_0x5e9f('0x13')][_0x5e9f('0x14')]);return _0x12f390(_0x44466e['error'][_0x5e9f('0x14')]);}else{logger[_0x5e9f('0xd')](_0x5e9f('0xe'),_0xceccc6,_0x5e9f('0x11'));_0x12f390(_0x44466e[_0x5e9f('0x15')][_0x5e9f('0x14')]);}})['catch'](function(_0x2ee859){logger[_0x5e9f('0x13')](_0x5e9f('0xe'),_0xceccc6,_0x2ee859);_0x43ad3f(_0x2ee859);});});} \ No newline at end of file +var _0xb331=['UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xb331,0xeb));var _0x1b33=function(_0x27bfd2,_0x380e36){_0x27bfd2=_0x27bfd2-0x0;var _0x2b2773=_0xb331[_0x27bfd2];return _0x2b2773;};'use strict';var _=require(_0x1b33('0x0'));var util=require(_0x1b33('0x1'));var moment=require(_0x1b33('0x2'));var BPromise=require(_0x1b33('0x3'));var rs=require(_0x1b33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b33('0x5'))['db'];var utils=require(_0x1b33('0x6'));var logger=require(_0x1b33('0x7'))(_0x1b33('0x8'));var config=require(_0x1b33('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b33('0xa')][_0x1b33('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c54,_0x340b1b,_0x2d20cb){return new BPromise(function(_0xbbab02,_0x16fc74){return client[_0x1b33('0xc')](_0x448c54,_0x2d20cb)[_0x1b33('0xd')](function(_0x5173d4){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x340b1b,_0x1b33('0xe'));logger['debug'](_0x1b33('0xf'),_0x340b1b,_0x1b33('0xe'),JSON['stringify'](_0x5173d4));if(_0x5173d4[_0x1b33('0x10')]){if(_0x5173d4[_0x1b33('0x10')][_0x1b33('0x11')]===0x1f4){logger['error'](_0x1b33('0x12'),_0x340b1b,_0x5173d4['error'][_0x1b33('0x13')]);return _0x16fc74(_0x5173d4[_0x1b33('0x10')]['message']);}logger['error'](_0x1b33('0x12'),_0x340b1b,_0x5173d4[_0x1b33('0x10')][_0x1b33('0x13')]);return _0xbbab02(_0x5173d4[_0x1b33('0x10')]['message']);}else{logger[_0x1b33('0x14')](_0x1b33('0x12'),_0x340b1b,_0x1b33('0xe'));_0xbbab02(_0x5173d4[_0x1b33('0x15')][_0x1b33('0x13')]);}})[_0x1b33('0x16')](function(_0x369f76){logger[_0x1b33('0x10')](_0x1b33('0x12'),_0x340b1b,_0x369f76);_0x16fc74(_0x369f76);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e06663c..b33b8ee 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x462753,_0x18db45){var _0x241048=function(_0x165ef6){while(--_0x165ef6){_0x462753['push'](_0x462753['shift']());}};_0x241048(++_0x18db45);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index df3474d..717e5e4 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 _0x865e=['INTEGER','sequelize','exports'];(function(_0x19c9b0,_0x2d61cc){var _0x31a9b8=function(_0x17619e){while(--_0x17619e){_0x19c9b0['push'](_0x19c9b0['shift']());}};_0x31a9b8(++_0x2d61cc);}(_0x865e,0x6d));var _0xe865=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x865e[_0x3740fe];return _0x55492b;};'use strict';var Sequelize=require(_0xe865('0x0'));module[_0xe865('0x1')]={'penalty':{'type':Sequelize[_0xe865('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x42a8=['INTEGER','sequelize','exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x42a8,0x18a));var _0x842a=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x42a8[_0x2d9e27];return _0xd35381;};'use strict';var Sequelize=require(_0x842a('0x0'));module[_0x842a('0x1')]={'penalty':{'type':Sequelize[_0x842a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a012bdb..c22ba97 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 _0xca3a=['define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports'];(function(_0x1dd427,_0x784e6c){var _0x190590=function(_0xf55afa){while(--_0xf55afa){_0x1dd427['push'](_0x1dd427['shift']());}};_0x190590(++_0x784e6c);}(_0xca3a,0x1d1));var _0xaca3=function(_0x138c7d,_0x3960fe){_0x138c7d=_0x138c7d-0x0;var _0x50d843=_0xca3a[_0x138c7d];return _0x50d843;};'use strict';var _=require(_0xaca3('0x0'));var util=require(_0xaca3('0x1'));var logger=require(_0xaca3('0x2'))(_0xaca3('0x3'));var moment=require(_0xaca3('0x4'));var BPromise=require(_0xaca3('0x5'));var rp=require(_0xaca3('0x6'));var fs=require('fs');var path=require(_0xaca3('0x7'));var rimraf=require(_0xaca3('0x8'));var config=require('../../config/environment');var attributes=require(_0xaca3('0x9'));module[_0xaca3('0xa')]=function(_0x3055f8,_0x341289){return _0x3055f8[_0xaca3('0xb')](_0xaca3('0xc'),attributes,{'tableName':_0xaca3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','../../config/logger'];(function(_0x15e3b5,_0x5f3780){var _0x145958=function(_0x42564d){while(--_0x42564d){_0x15e3b5['push'](_0x15e3b5['shift']());}};_0x145958(++_0x5f3780);}(_0x24c8,0x133));var _0x824c=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0x24c8[_0x38fb8b];return _0x1ec681;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x824c('0x0'))('api');var moment=require(_0x824c('0x1'));var BPromise=require(_0x824c('0x2'));var rp=require(_0x824c('0x3'));var fs=require('fs');var path=require(_0x824c('0x4'));var rimraf=require(_0x824c('0x5'));var config=require(_0x824c('0x6'));var attributes=require(_0x824c('0x7'));module[_0x824c('0x8')]=function(_0x3a963e,_0x102802){return _0x3a963e[_0x824c('0x9')]('UserMailQueue',attributes,{'tableName':_0x824c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 1fded06..fac9886 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2b91b9,_0x3a5afc){var _0x8c6f94=function(_0x27e23f){while(--_0x27e23f){_0x2b91b9['push'](_0x2b91b9['shift']());}};_0x8c6f94(++_0x3a5afc);}(_0x6aa7,0x178));var _0x76aa=function(_0xf50bcd,_0x5f14af){_0xf50bcd=_0xf50bcd-0x0;var _0x36664f=_0x6aa7[_0xf50bcd];return _0x36664f;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f90f0,_0xe64e8f){var _0x51cbd3=function(_0x210c9a){while(--_0x210c9a){_0x1f90f0['push'](_0x1f90f0['shift']());}};_0x51cbd3(++_0xe64e8f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x144bbb,_0x5145cd){_0x144bbb=_0x144bbb-0x0;var _0x86e150=_0x8ef6[_0x144bbb];return _0x86e150;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 14b7f9e..859d51b 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 _0x2174=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','express'];(function(_0x5eb3e0,_0x3699c6){var _0x2b8c6c=function(_0x5606e8){while(--_0x5606e8){_0x5eb3e0['push'](_0x5eb3e0['shift']());}};_0x2b8c6c(++_0x3699c6);}(_0x2174,0x1d8));var _0x4217=function(_0x2c90d6,_0x2489b0){_0x2c90d6=_0x2c90d6-0x0;var _0x9be4a5=_0x2174[_0x2c90d6];return _0x9be4a5;};'use strict';var multer=require('multer');var util=require(_0x4217('0x0'));var path=require(_0x4217('0x1'));var timeout=require(_0x4217('0x2'));var express=require(_0x4217('0x3'));var router=express[_0x4217('0x4')]();var fs_extra=require(_0x4217('0x5'));var auth=require(_0x4217('0x6'));var interaction=require(_0x4217('0x7'));var config=require(_0x4217('0x8'));var controller=require(_0x4217('0x9'));router[_0x4217('0xa')]('/',auth[_0x4217('0xb')](),controller[_0x4217('0xc')]);module[_0x4217('0xd')]=router; \ No newline at end of file +var _0x2139=['isAuthenticated','sendUserNotification','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x53fc9e,_0x4e4499){var _0x3d3dff=function(_0x581484){while(--_0x581484){_0x53fc9e['push'](_0x53fc9e['shift']());}};_0x3d3dff(++_0x4e4499);}(_0x2139,0x123));var _0x9213=function(_0x181167,_0x5a5269){_0x181167=_0x181167-0x0;var _0x10484f=_0x2139[_0x181167];return _0x10484f;};'use strict';var multer=require(_0x9213('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9213('0x1'));var router=express[_0x9213('0x2')]();var fs_extra=require(_0x9213('0x3'));var auth=require(_0x9213('0x4'));var interaction=require(_0x9213('0x5'));var config=require(_0x9213('0x6'));var controller=require(_0x9213('0x7'));router[_0x9213('0x8')]('/',auth[_0x9213('0x9')](),controller[_0x9213('0xa')]);module[_0x9213('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 9d77d90..faa7c02 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 _0x07a0=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x3d0d71,_0x3c4811){var _0xc3c53f=function(_0x5c08ab){while(--_0x5c08ab){_0x3d0d71['push'](_0x3d0d71['shift']());}};_0xc3c53f(++_0x3c4811);}(_0x07a0,0x152));var _0x007a=function(_0x134edc,_0x174749){_0x134edc=_0x134edc-0x0;var _0x31e8ec=_0x07a0[_0x134edc];return _0x31e8ec;};'use strict';var Sequelize=require(_0x007a('0x0'));module['exports']={'body':{'type':Sequelize[_0x007a('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x007a('0x1')]},'recipientsDescription':{'type':Sequelize[_0x007a('0x2')]},'beep':{'type':Sequelize[_0x007a('0x3')]}}; \ No newline at end of file +var _0xc13b=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x57fa08,_0x3ab921){var _0x19e260=function(_0x54dfec){while(--_0x54dfec){_0x57fa08['push'](_0x57fa08['shift']());}};_0x19e260(++_0x3ab921);}(_0xc13b,0x70));var _0xbc13=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xc13b[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xbc13('0x0'));module[_0xbc13('0x1')]={'body':{'type':Sequelize[_0xbc13('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xbc13('0x3')]},'beep':{'type':Sequelize[_0xbc13('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d2882d3..9f68a58 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 _0xe3fc=['beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','queue','ids','push','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userNotification.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe3fc,0x14e));var _0xce3f=function(_0x469ae2,_0x24cd30){_0x469ae2=_0x469ae2-0x0;var _0x5e33e4=_0xe3fc[_0x469ae2];return _0x5e33e4;};'use strict';var emlformat=require(_0xce3f('0x0'));var rimraf=require(_0xce3f('0x1'));var zipdir=require(_0xce3f('0x2'));var jsonpatch=require(_0xce3f('0x3'));var rp=require(_0xce3f('0x4'));var moment=require('moment');var BPromise=require(_0xce3f('0x5'));var Mustache=require(_0xce3f('0x6'));var util=require(_0xce3f('0x7'));var path=require(_0xce3f('0x8'));var sox=require(_0xce3f('0x9'));var csv=require(_0xce3f('0xa'));var ejs=require(_0xce3f('0xb'));var fs=require('fs');var fs_extra=require(_0xce3f('0xc'));var _=require(_0xce3f('0xd'));var squel=require(_0xce3f('0xe'));var crypto=require(_0xce3f('0xf'));var jsforce=require(_0xce3f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xce3f('0xa'));var querystring=require(_0xce3f('0x11'));var Papa=require('papaparse');var Redis=require(_0xce3f('0x12'));var authService=require(_0xce3f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xce3f('0x14'));var hardwareService=require(_0xce3f('0x15'));var logger=require(_0xce3f('0x16'))('api');var utils=require(_0xce3f('0x17'));var config=require(_0xce3f('0x18'));var licenseUtil=require(_0xce3f('0x19'));var db=require(_0xce3f('0x1a'))['db'];config[_0xce3f('0x1b')]=_['defaults'](config[_0xce3f('0x1b')],{'host':_0xce3f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce3f('0x1d'))['register'](socket);function respondWithStatusCode(_0x139204,_0x15d020){_0x15d020=_0x15d020||0xcc;return function(_0x2eefb5){if(_0x2eefb5){return _0x139204[_0xce3f('0x1e')](_0x15d020);}return _0x139204['status'](_0x15d020)[_0xce3f('0x1f')]();};}function respondWithResult(_0x2a7b44,_0x53c01e){_0x53c01e=_0x53c01e||0xc8;return function(_0x49f741){if(_0x49f741){return _0x2a7b44[_0xce3f('0x20')](_0x53c01e)[_0xce3f('0x21')](_0x49f741);}};}function respondWithFilteredResult(_0x1cec5a,_0x148cd2){return function(_0x20fa5a){if(_0x20fa5a){var _0x33dbc9=typeof _0x148cd2[_0xce3f('0x22')]===_0xce3f('0x23')&&typeof _0x148cd2[_0xce3f('0x24')]===_0xce3f('0x23');var _0x387860=_0x20fa5a[_0xce3f('0x25')];var _0xb84e84=_0x33dbc9?0x0:_0x148cd2[_0xce3f('0x22')];var _0x25fab9=_0x33dbc9?_0x20fa5a['count']:_0x148cd2['offset']+_0x148cd2[_0xce3f('0x24')];var _0x58e219;if(_0x25fab9>=_0x387860){_0x25fab9=_0x387860;_0x58e219=0xc8;}else{_0x58e219=0xce;}_0x1cec5a[_0xce3f('0x20')](_0x58e219);return _0x1cec5a[_0xce3f('0x26')](_0xce3f('0x27'),_0xb84e84+'-'+_0x25fab9+'/'+_0x387860)[_0xce3f('0x21')](_0x20fa5a);}return null;};}function patchUpdates(_0x565486){return function(_0x44e010){try{jsonpatch[_0xce3f('0x28')](_0x44e010,_0x565486,!![]);}catch(_0x36d58f){return BPromise[_0xce3f('0x29')](_0x36d58f);}return _0x44e010[_0xce3f('0x2a')]();};}function saveUpdates(_0x37482b,_0x189cf4){return function(_0x5ae152){if(_0x5ae152){return _0x5ae152[_0xce3f('0x2b')](_0x37482b)['then'](function(_0x44b444){return _0x44b444;});}return null;};}function removeEntity(_0x326d75,_0x430105){return function(_0x17e3e2){if(_0x17e3e2){return _0x17e3e2['destroy']()[_0xce3f('0x2c')](function(){_0x326d75['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x467eb9,_0x54f92c){return function(_0xfb74bc){if(!_0xfb74bc){_0x467eb9[_0xce3f('0x1e')](0x194);}return _0xfb74bc;};}function handleError(_0x4f0873,_0x58cd2d){_0x58cd2d=_0x58cd2d||0x1f4;return function(_0x1a6c38){logger[_0xce3f('0x2d')](_0x1a6c38[_0xce3f('0x2e')]);if(_0x1a6c38[_0xce3f('0x2f')]){delete _0x1a6c38[_0xce3f('0x2f')];}_0x4f0873['status'](_0x58cd2d)['send'](_0x1a6c38);};}exports['sendUserNotification']=function(_0xd55bcc,_0x1e5fb4,_0x4198e4){if(!_0xd55bcc[_0xce3f('0x30')]['hasOwnProperty']('text')&&!_0xd55bcc[_0xce3f('0x30')][_0xce3f('0x31')](_0xce3f('0x32'))){throw new db['Sequelize'][(_0xce3f('0x33'))](_0xce3f('0x34'));}else{if(_0xd55bcc[_0xce3f('0x30')]['hasOwnProperty'](_0xce3f('0x32'))&&!_0xd55bcc['body'][_0xce3f('0x31')](_0xce3f('0x35'))){throw new db[(_0xce3f('0x36'))][(_0xce3f('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xd55bcc[_0xce3f('0x30')][_0xce3f('0x31')](_0xce3f('0x37'))){throw new db['Sequelize']['ValidationError'](_0xce3f('0x38'));}else{try{var _0x484e3f=JSON[_0xce3f('0x39')](_0xd55bcc['body'][_0xce3f('0x37')]);}catch(_0x2dfe1){logger['error'](_0x2dfe1);throw new db['Sequelize'][(_0xce3f('0x33'))](_0xce3f('0x3a'));}var _0x6e5bee=[_0xce3f('0x3b'),_0xce3f('0x3c'),'mailqueue','openchannelqueue',_0xce3f('0x3d'),_0xce3f('0x3e'),_0xce3f('0x3f'),_0xce3f('0x40'),_0xce3f('0x41')];if(_[_0xce3f('0x42')](_0x484e3f,function(_0x5e7cc3){return!_['includes'](_0x6e5bee,_0x5e7cc3[_0xce3f('0x43')][_0xce3f('0x44')]());})){throw new db[(_0xce3f('0x36'))][(_0xce3f('0x33'))](_0xce3f('0x45'));}}}var _0x1a8be3={};_0x1a8be3[_0xce3f('0x46')]=_0xd55bcc['body'][_0xce3f('0x31')]('senderName')?_0xd55bcc[_0xce3f('0x30')][_0xce3f('0x46')]:_0xd55bcc[_0xce3f('0x41')][_0xce3f('0x47')];_0x1a8be3[_0xce3f('0x48')]=_[_0xce3f('0x49')](_0xd55bcc['body'][_0xce3f('0x48')])?null:_0xd55bcc['body'][_0xce3f('0x48')];_0x1a8be3[_0xce3f('0x4a')]=_0xd55bcc[_0xce3f('0x30')][_0xce3f('0x4a')]||![];_0x1a8be3[_0xce3f('0x4b')]=_0xd55bcc['user']['id'];return getContent(_0xd55bcc[_0xce3f('0x30')])['then'](function(_0x4ba113){_0x1a8be3[_0xce3f('0x30')]=_0x4ba113;return getRecipients(_0x484e3f);})[_0xce3f('0x2c')](function(_0x209402){_0x1a8be3[_0xce3f('0x4c')]=_[_0xce3f('0x4d')](_0x209402)[_0xce3f('0x4e')](',');return db[_0xce3f('0x4f')][_0xce3f('0x50')](function(_0x3d5d0d){return db[_0xce3f('0x51')][_0xce3f('0x52')](_0x1a8be3,{'raw':!![],'transaction':_0x3d5d0d})[_0xce3f('0x2c')](function(_0x2977be){var _0x4bcdad={'sender':_0x1a8be3[_0xce3f('0x46')],'description':_0x1a8be3['recipientsDescription'],'content':_0x1a8be3[_0xce3f('0x30')],'beep':_0x1a8be3[_0xce3f('0x4a')]};_0x209402[_0xce3f('0x53')](function(_0x5786b4){_0x4bcdad[_0xce3f('0x54')]=_0x5786b4;socket[_0xce3f('0x55')](_0xce3f('0x56'),_0x4bcdad);});return _0x2977be;});});})[_0xce3f('0x2c')](respondWithResult(_0x1e5fb4,0xc9))[_0xce3f('0x57')](handleError(_0x1e5fb4,null));};function getContent(_0x437f70){return new BPromise(function(_0x503f88,_0x49ad3f){if(_0x437f70[_0xce3f('0x58')]){_0x503f88(_0x437f70[_0xce3f('0x58')]);return;}return db[_0xce3f('0x59')][_0xce3f('0x5a')]({'attributes':[_0xce3f('0x5b')],'where':{'id':_0x437f70[_0xce3f('0x32')]},'raw':!![]})[_0xce3f('0x2c')](function(_0x1ed1f4){if(!_0x1ed1f4)throw new db['Sequelize'][(_0xce3f('0x33'))](_0xce3f('0x5c'));var _0x3d065e=Mustache[_0xce3f('0x5d')](_0x1ed1f4[_0xce3f('0x5b')],_0x437f70[_0xce3f('0x35')]);_0x503f88(_0x3d065e);})['catch'](function(_0x5d57e0){_0x49ad3f(_0x5d57e0);});});}function getRecipients(_0x52498f){return new BPromise(function(_0x4afdb3,_0xa86cf3){var _0x28aabd=[];var _0x16a399=[];_0x52498f[_0xce3f('0x53')](function(_0x458228){var _0x1afb48=_[_0xce3f('0x5e')](_0x458228[_0xce3f('0x43')][_0xce3f('0x44')]());if(_0x1afb48===_0xce3f('0x5f')){_0x28aabd=_[_0xce3f('0x60')](_0x28aabd,_0x458228['ids']);}else{if(_['includes'](_0x1afb48,_0xce3f('0x61')))_0x1afb48=_0x1afb48['replace'](_0xce3f('0x61'),'Queue');_0x458228[_0xce3f('0x62')]['forEach'](function(_0x53a253){_0x16a399[_0xce3f('0x63')](getAgents(_0x1afb48,_0x53a253));});}});return BPromise['all'](_0x16a399)[_0xce3f('0x2c')](function(_0x823dd5){_0x28aabd=_[_0xce3f('0x60')](_0x28aabd,_['flatten'](_0x823dd5));_0x4afdb3(_0x28aabd);})[_0xce3f('0x57')](function(_0x14cd65){_0xa86cf3(_0x14cd65);});});}function getAgents(_0x435360,_0x3ee347){return new BPromise(function(_0x42404c,_0x402981){return db[_0x435360]['findOne']({'where':{'id':_0x3ee347}})[_0xce3f('0x2c')](function(_0x362061){return _0x362061[_0xce3f('0x64')]({'attributes':['id'],'raw':!![]})[_0xce3f('0x2c')](function(_0x4f8d2c){var _0x134128=_[_0xce3f('0x65')](_0x4f8d2c,'id');_0x42404c(_0x134128);});})['catch'](function(_0x379282){_0x402981(_0x379282);});});} \ No newline at end of file +var _0x9a29=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','offset','undefined','limit','set','apply','reject','save','update','then','destroy','status','error','stack','name','sendUserNotification','body','hasOwnProperty','text','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','Sequelize','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','recipient','emit','userNotification:send','catch','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','queue','replace','Queue','forEach','push','union','flatten','getAgents','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x53b5f9,_0x2bf7dc){var _0x4180fb=function(_0x169466){while(--_0x169466){_0x53b5f9['push'](_0x53b5f9['shift']());}};_0x4180fb(++_0x2bf7dc);}(_0x9a29,0x184));var _0x99a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a29[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x99a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99a2('0x1'));var jsonpatch=require(_0x99a2('0x2'));var rp=require('request-promise');var moment=require(_0x99a2('0x3'));var BPromise=require(_0x99a2('0x4'));var Mustache=require(_0x99a2('0x5'));var util=require(_0x99a2('0x6'));var path=require(_0x99a2('0x7'));var sox=require(_0x99a2('0x8'));var csv=require(_0x99a2('0x9'));var ejs=require(_0x99a2('0xa'));var fs=require('fs');var fs_extra=require(_0x99a2('0xb'));var _=require(_0x99a2('0xc'));var squel=require('squel');var crypto=require(_0x99a2('0xd'));var jsforce=require(_0x99a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x99a2('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a2('0xf'));var authService=require(_0x99a2('0x10'));var qs=require(_0x99a2('0x11'));var as=require(_0x99a2('0x12'));var hardwareService=require(_0x99a2('0x13'));var logger=require(_0x99a2('0x14'))(_0x99a2('0x15'));var utils=require(_0x99a2('0x16'));var config=require(_0x99a2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x99a2('0x18')]=_['defaults'](config[_0x99a2('0x18')],{'host':_0x99a2('0x19'),'port':0x18eb});var socket=require(_0x99a2('0x1a'))(new Redis(config[_0x99a2('0x18')]));require('./userNotification.socket')[_0x99a2('0x1b')](socket);function respondWithStatusCode(_0x2857d4,_0x5dbff1){_0x5dbff1=_0x5dbff1||0xcc;return function(_0x4c5e17){if(_0x4c5e17){return _0x2857d4[_0x99a2('0x1c')](_0x5dbff1);}return _0x2857d4['status'](_0x5dbff1)[_0x99a2('0x1d')]();};}function respondWithResult(_0x525694,_0x591ea0){_0x591ea0=_0x591ea0||0xc8;return function(_0x375015){if(_0x375015){return _0x525694['status'](_0x591ea0)['json'](_0x375015);}};}function respondWithFilteredResult(_0xb34465,_0x3c71dc){return function(_0x1098a1){if(_0x1098a1){var _0x3f27e9=typeof _0x3c71dc[_0x99a2('0x1e')]===_0x99a2('0x1f')&&typeof _0x3c71dc[_0x99a2('0x20')]===_0x99a2('0x1f');var _0x267be8=_0x1098a1['count'];var _0x2a4aea=_0x3f27e9?0x0:_0x3c71dc['offset'];var _0x5abd6c=_0x3f27e9?_0x1098a1['count']:_0x3c71dc['offset']+_0x3c71dc['limit'];var _0x46f0c6;if(_0x5abd6c>=_0x267be8){_0x5abd6c=_0x267be8;_0x46f0c6=0xc8;}else{_0x46f0c6=0xce;}_0xb34465['status'](_0x46f0c6);return _0xb34465[_0x99a2('0x21')]('Content-Range',_0x2a4aea+'-'+_0x5abd6c+'/'+_0x267be8)['json'](_0x1098a1);}return null;};}function patchUpdates(_0xf3bd6a){return function(_0x4ae6d7){try{jsonpatch[_0x99a2('0x22')](_0x4ae6d7,_0xf3bd6a,!![]);}catch(_0x3c1ca9){return BPromise[_0x99a2('0x23')](_0x3c1ca9);}return _0x4ae6d7[_0x99a2('0x24')]();};}function saveUpdates(_0x985d8,_0x118e05){return function(_0x593e04){if(_0x593e04){return _0x593e04[_0x99a2('0x25')](_0x985d8)[_0x99a2('0x26')](function(_0x5a2a0b){return _0x5a2a0b;});}return null;};}function removeEntity(_0x521718,_0x1fcb57){return function(_0x5d23bc){if(_0x5d23bc){return _0x5d23bc[_0x99a2('0x27')]()[_0x99a2('0x26')](function(){_0x521718[_0x99a2('0x28')](0xcc)[_0x99a2('0x1d')]();});}};}function handleEntityNotFound(_0x53e3a0,_0x5b1404){return function(_0x57558e){if(!_0x57558e){_0x53e3a0[_0x99a2('0x1c')](0x194);}return _0x57558e;};}function handleError(_0x2a03a8,_0x1cece2){_0x1cece2=_0x1cece2||0x1f4;return function(_0x42d085){logger[_0x99a2('0x29')](_0x42d085[_0x99a2('0x2a')]);if(_0x42d085['name']){delete _0x42d085[_0x99a2('0x2b')];}_0x2a03a8[_0x99a2('0x28')](_0x1cece2)['send'](_0x42d085);};}exports[_0x99a2('0x2c')]=function(_0x5507ff,_0x4dad1c,_0x55020a){if(!_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')](_0x99a2('0x2f'))&&!_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x99a2('0x30'));}else{if(_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')]('TemplateId')&&!_0x5507ff['body'][_0x99a2('0x2e')]('view')){throw new db['Sequelize']['ValidationError'](_0x99a2('0x31'));}if(!_0x5507ff['body'][_0x99a2('0x2e')]('recipients')){throw new db[(_0x99a2('0x32'))][(_0x99a2('0x33'))](_0x99a2('0x34'));}else{try{var _0x35be81=JSON[_0x99a2('0x35')](_0x5507ff['body'][_0x99a2('0x36')]);}catch(_0x5b8e66){logger[_0x99a2('0x29')](_0x5b8e66);throw new db[(_0x99a2('0x32'))][(_0x99a2('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x20094d=[_0x99a2('0x37'),_0x99a2('0x38'),'mailqueue',_0x99a2('0x39'),_0x99a2('0x3a'),_0x99a2('0x3b'),'whatsappqueue',_0x99a2('0x3c'),_0x99a2('0x3d')];if(_[_0x99a2('0x3e')](_0x35be81,function(_0x470698){return!_[_0x99a2('0x3f')](_0x20094d,_0x470698[_0x99a2('0x40')][_0x99a2('0x41')]());})){throw new db[(_0x99a2('0x32'))][(_0x99a2('0x33'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x39f229={};_0x39f229['senderName']=_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x2e')](_0x99a2('0x42'))?_0x5507ff[_0x99a2('0x2d')]['senderName']:_0x5507ff[_0x99a2('0x3d')][_0x99a2('0x43')];_0x39f229[_0x99a2('0x44')]=_[_0x99a2('0x45')](_0x5507ff['body'][_0x99a2('0x44')])?null:_0x5507ff[_0x99a2('0x2d')][_0x99a2('0x44')];_0x39f229[_0x99a2('0x46')]=_0x5507ff['body'][_0x99a2('0x46')]||![];_0x39f229[_0x99a2('0x47')]=_0x5507ff[_0x99a2('0x3d')]['id'];return getContent(_0x5507ff[_0x99a2('0x2d')])[_0x99a2('0x26')](function(_0x525c8d){_0x39f229[_0x99a2('0x2d')]=_0x525c8d;return getRecipients(_0x35be81);})[_0x99a2('0x26')](function(_0x1793d1){_0x39f229[_0x99a2('0x48')]=_[_0x99a2('0x49')](_0x1793d1)[_0x99a2('0x4a')](',');return db['sequelize']['transaction'](function(_0xfcf49d){return db[_0x99a2('0x4b')][_0x99a2('0x4c')](_0x39f229,{'raw':!![],'transaction':_0xfcf49d})['then'](function(_0x2a6079){var _0x25d386={'sender':_0x39f229[_0x99a2('0x42')],'description':_0x39f229[_0x99a2('0x44')],'content':_0x39f229['body'],'beep':_0x39f229[_0x99a2('0x46')]};_0x1793d1['forEach'](function(_0x4df463){_0x25d386[_0x99a2('0x4d')]=_0x4df463;socket[_0x99a2('0x4e')](_0x99a2('0x4f'),_0x25d386);});return _0x2a6079;});});})[_0x99a2('0x26')](respondWithResult(_0x4dad1c,0xc9))[_0x99a2('0x50')](handleError(_0x4dad1c,null));};function getContent(_0x4ec84e){return new BPromise(function(_0x22c36d,_0x4390e6){if(_0x4ec84e['text']){_0x22c36d(_0x4ec84e[_0x99a2('0x2f')]);return;}return db[_0x99a2('0x51')][_0x99a2('0x52')]({'attributes':[_0x99a2('0x53')],'where':{'id':_0x4ec84e[_0x99a2('0x54')]},'raw':!![]})[_0x99a2('0x26')](function(_0x2b7c12){if(!_0x2b7c12)throw new db[(_0x99a2('0x32'))]['ValidationError'](_0x99a2('0x55'));var _0x568ea4=Mustache[_0x99a2('0x56')](_0x2b7c12['html'],_0x4ec84e['view']);_0x22c36d(_0x568ea4);})[_0x99a2('0x50')](function(_0x334779){_0x4390e6(_0x334779);});});}function getRecipients(_0x376d89){return new BPromise(function(_0x116485,_0x40c549){var _0x2eca0c=[];var _0x34c8be=[];_0x376d89['forEach'](function(_0x3c0a9f){var _0x7f4d54=_[_0x99a2('0x57')](_0x3c0a9f[_0x99a2('0x40')]['toLowerCase']());if(_0x7f4d54===_0x99a2('0x58')){_0x2eca0c=_['union'](_0x2eca0c,_0x3c0a9f[_0x99a2('0x59')]);}else{if(_[_0x99a2('0x3f')](_0x7f4d54,_0x99a2('0x5a')))_0x7f4d54=_0x7f4d54[_0x99a2('0x5b')](_0x99a2('0x5a'),_0x99a2('0x5c'));_0x3c0a9f[_0x99a2('0x59')][_0x99a2('0x5d')](function(_0x11caf5){_0x34c8be[_0x99a2('0x5e')](getAgents(_0x7f4d54,_0x11caf5));});}});return BPromise['all'](_0x34c8be)[_0x99a2('0x26')](function(_0x4fbf02){_0x2eca0c=_[_0x99a2('0x5f')](_0x2eca0c,_[_0x99a2('0x60')](_0x4fbf02));_0x116485(_0x2eca0c);})[_0x99a2('0x50')](function(_0x14ece0){_0x40c549(_0x14ece0);});});}function getAgents(_0xdb102f,_0x49a389){return new BPromise(function(_0x45efdb,_0x4f3d80){return db[_0xdb102f][_0x99a2('0x52')]({'where':{'id':_0x49a389}})[_0x99a2('0x26')](function(_0x5d9157){return _0x5d9157[_0x99a2('0x61')]({'attributes':['id'],'raw':!![]})[_0x99a2('0x26')](function(_0x568162){var _0x52ec80=_['map'](_0x568162,'id');_0x45efdb(_0x52ec80);});})[_0x99a2('0x50')](function(_0x685945){_0x4f3d80(_0x685945);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 487fe65..efb769f 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 _0xf63a=['remove','emit','hook','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf63a,0x1ca));var _0xaf63=function(_0x1d4aa8,_0x177c03){_0x1d4aa8=_0x1d4aa8-0x0;var _0x1d9b0f=_0xf63a[_0x1d4aa8];return _0x1d9b0f;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xaf63('0x0'))['db'][_0xaf63('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaf63('0x2')](0x0);var events={'afterCreate':_0xaf63('0x3'),'afterUpdate':'update','afterDestroy':_0xaf63('0x4')};function emitEvent(_0x1b2f40){return function(_0xce3bbc,_0x19ed4d,_0x1fe3ea){UserNotificationEvents[_0xaf63('0x5')](_0x1b2f40+':'+_0xce3bbc['id'],_0xce3bbc);UserNotificationEvents[_0xaf63('0x5')](_0x1b2f40,_0xce3bbc);_0x1fe3ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xaf63('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xbb4b=['events','UserNotification','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3696c1,_0x23bacb){var _0x1d013a=function(_0xbd5328){while(--_0xbd5328){_0x3696c1['push'](_0x3696c1['shift']());}};_0x1d013a(++_0x23bacb);}(_0xbb4b,0xbd));var _0xbbb4=function(_0xbb61de,_0x3e9399){_0xbb61de=_0xbb61de-0x0;var _0x378623=_0xbb4b[_0xbb61de];return _0x378623;};'use strict';var EventEmitter=require(_0xbbb4('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xbbb4('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbbb4('0x2')](0x0);var events={'afterCreate':_0xbbb4('0x3'),'afterUpdate':_0xbbb4('0x4'),'afterDestroy':_0xbbb4('0x5')};function emitEvent(_0xe79ac){return function(_0x17e5de,_0x1997d3,_0x3eb6e0){UserNotificationEvents[_0xbbb4('0x6')](_0xe79ac+':'+_0x17e5de['id'],_0x17e5de);UserNotificationEvents[_0xbbb4('0x6')](_0xe79ac,_0x17e5de);_0x3eb6e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xbbb4('0x7')](e,emitEvent(event));}}module[_0xbbb4('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index e8d7b83..bda13fe 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 _0x4fa4=['bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x58f1b6,_0x3226fb){var _0x167ea9=function(_0x4e30aa){while(--_0x4e30aa){_0x58f1b6['push'](_0x58f1b6['shift']());}};_0x167ea9(++_0x3226fb);}(_0x4fa4,0x6b));var _0x44fa=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4fa4[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x44fa('0x0'));var util=require(_0x44fa('0x1'));var logger=require(_0x44fa('0x2'))(_0x44fa('0x3'));var moment=require(_0x44fa('0x4'));var BPromise=require(_0x44fa('0x5'));var rp=require(_0x44fa('0x6'));var fs=require('fs');var path=require(_0x44fa('0x7'));var rimraf=require(_0x44fa('0x8'));var config=require(_0x44fa('0x9'));var attributes=require(_0x44fa('0xa'));module[_0x44fa('0xb')]=function(_0x21c20d,_0x83eb17){return _0x21c20d[_0x44fa('0xc')](_0x44fa('0xd'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44fa('0xe'),'collate':_0x44fa('0xf')});}; \ No newline at end of file +var _0xcc22=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3b9223,_0x5129c3){var _0x41ec61=function(_0x7001d4){while(--_0x7001d4){_0x3b9223['push'](_0x3b9223['shift']());}};_0x41ec61(++_0x5129c3);}(_0xcc22,0x19c));var _0x2cc2=function(_0x481f66,_0x2be3f1){_0x481f66=_0x481f66-0x0;var _0x5e848b=_0xcc22[_0x481f66];return _0x5e848b;};'use strict';var _=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var logger=require(_0x2cc2('0x2'))(_0x2cc2('0x3'));var moment=require(_0x2cc2('0x4'));var BPromise=require('bluebird');var rp=require(_0x2cc2('0x5'));var fs=require('fs');var path=require(_0x2cc2('0x6'));var rimraf=require('rimraf');var config=require(_0x2cc2('0x7'));var attributes=require(_0x2cc2('0x8'));module[_0x2cc2('0x9')]=function(_0x5141f8,_0x23204b){return _0x5141f8[_0x2cc2('0xa')](_0x2cc2('0xb'),attributes,{'tableName':_0x2cc2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2cc2('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d9f2912..9a8d9b0 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 _0x596a=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x32c06a,_0x4eab48){var _0x2fa68e=function(_0x17dd91){while(--_0x17dd91){_0x32c06a['push'](_0x32c06a['shift']());}};_0x2fa68e(++_0x4eab48);}(_0x596a,0x1d3));var _0xa596=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x596a[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xa596('0x0'));var moment=require(_0xa596('0x1'));var BPromise=require(_0xa596('0x2'));var rs=require(_0xa596('0x3'));var fs=require('fs');var Redis=require(_0xa596('0x4'));var db=require(_0xa596('0x5'))['db'];var utils=require(_0xa596('0x6'));var logger=require(_0xa596('0x7'))(_0xa596('0x8'));var config=require(_0xa596('0x9'));var jayson=require(_0xa596('0xa'));var client=jayson[_0xa596('0xb')][_0xa596('0xc')]({'port':0x232a});config['redis']=_[_0xa596('0xd')](config[_0xa596('0xe')],{'host':_0xa596('0xf'),'port':0x18eb});var socket=require(_0xa596('0x10'))(new Redis(config[_0xa596('0xe')]));require('./userNotification.socket')[_0xa596('0x11')](socket);function respondWithRpcPromise(_0xdb030a,_0x41d594,_0x2a358b){return new BPromise(function(_0xd75aef,_0x4830b4){return client[_0xa596('0x12')](_0xdb030a,_0x2a358b)[_0xa596('0x13')](function(_0x17da3d){logger[_0xa596('0x14')](_0xa596('0x15'),_0x41d594,_0xa596('0x16'));logger[_0xa596('0x17')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x41d594,'request\x20sent',JSON[_0xa596('0x18')](_0x17da3d));if(_0x17da3d[_0xa596('0x19')]){if(_0x17da3d[_0xa596('0x19')]['code']===0x1f4){logger[_0xa596('0x19')]('UserNotification,\x20%s,\x20%s',_0x41d594,_0x17da3d[_0xa596('0x19')]['message']);return _0x4830b4(_0x17da3d['error']['message']);}logger[_0xa596('0x19')](_0xa596('0x15'),_0x41d594,_0x17da3d[_0xa596('0x19')]['message']);return _0xd75aef(_0x17da3d['error'][_0xa596('0x1a')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x41d594,'request\x20sent');_0xd75aef(_0x17da3d[_0xa596('0x1b')][_0xa596('0x1a')]);}})[_0xa596('0x1c')](function(_0x115fb9){logger[_0xa596('0x19')]('UserNotification,\x20%s,\x20%s',_0x41d594,_0x115fb9);_0x4830b4(_0x115fb9);});});} \ No newline at end of file +var _0x54d1=['../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40570d,_0x173745){var _0x53bc05=function(_0x2e0259){while(--_0x2e0259){_0x40570d['push'](_0x40570d['shift']());}};_0x53bc05(++_0x173745);}(_0x54d1,0x88));var _0x154d=function(_0x4d80cd,_0x3e3fa4){_0x4d80cd=_0x4d80cd-0x0;var _0x180461=_0x54d1[_0x4d80cd];return _0x180461;};'use strict';var _=require(_0x154d('0x0'));var util=require(_0x154d('0x1'));var moment=require('moment');var BPromise=require(_0x154d('0x2'));var rs=require(_0x154d('0x3'));var fs=require('fs');var Redis=require(_0x154d('0x4'));var db=require(_0x154d('0x5'))['db'];var utils=require(_0x154d('0x6'));var logger=require(_0x154d('0x7'))(_0x154d('0x8'));var config=require(_0x154d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x154d('0xa')]['http']({'port':0x232a});config[_0x154d('0xb')]=_[_0x154d('0xc')](config[_0x154d('0xb')],{'host':_0x154d('0xd'),'port':0x18eb});var socket=require(_0x154d('0xe'))(new Redis(config[_0x154d('0xb')]));require(_0x154d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d2b26,_0x59c299,_0x38b608){return new BPromise(function(_0x43965b,_0x41ab79){return client[_0x154d('0x10')](_0x5d2b26,_0x38b608)[_0x154d('0x11')](function(_0x60cf84){logger[_0x154d('0x12')](_0x154d('0x13'),_0x59c299,_0x154d('0x14'));logger[_0x154d('0x15')](_0x154d('0x16'),_0x59c299,_0x154d('0x14'),JSON[_0x154d('0x17')](_0x60cf84));if(_0x60cf84[_0x154d('0x18')]){if(_0x60cf84[_0x154d('0x18')][_0x154d('0x19')]===0x1f4){logger['error'](_0x154d('0x13'),_0x59c299,_0x60cf84[_0x154d('0x18')]['message']);return _0x41ab79(_0x60cf84[_0x154d('0x18')][_0x154d('0x1a')]);}logger[_0x154d('0x18')](_0x154d('0x13'),_0x59c299,_0x60cf84['error']['message']);return _0x43965b(_0x60cf84[_0x154d('0x18')][_0x154d('0x1a')]);}else{logger[_0x154d('0x12')]('UserNotification,\x20%s,\x20%s',_0x59c299,_0x154d('0x14'));_0x43965b(_0x60cf84[_0x154d('0x1b')][_0x154d('0x1a')]);}})[_0x154d('0x1c')](function(_0x129ab7){logger[_0x154d('0x18')](_0x154d('0x13'),_0x59c299,_0x129ab7);_0x41ab79(_0x129ab7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5305076..965f08f 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 _0xf557=['update','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x11912a,_0x3b60bb){var _0x3f1a38=function(_0x39fdac){while(--_0x39fdac){_0x11912a['push'](_0x11912a['shift']());}};_0x3f1a38(++_0x3b60bb);}(_0xf557,0x1d9));var _0x7f55=function(_0x378fb3,_0xd475dc){_0x378fb3=_0x378fb3-0x0;var _0x2f97c1=_0xf557[_0x378fb3];return _0x2f97c1;};'use strict';var UserNotificationEvents=require(_0x7f55('0x0'));var events=['save','remove',_0x7f55('0x1')];function createListener(_0x55aa22,_0x4369c4){return function(_0x1e791b){_0x4369c4['emit'](_0x55aa22,_0x1e791b);};}function removeListener(_0xb3356b,_0xda5967){return function(){UserNotificationEvents[_0x7f55('0x2')](_0xb3356b,_0xda5967);};}exports[_0x7f55('0x3')]=function(_0x5e79a8){for(var _0x58b25c=0x0,_0x58fb75=events[_0x7f55('0x4')];_0x58b25c<_0x58fb75;_0x58b25c++){var _0x585c46=events[_0x58b25c];var _0x518892=createListener(_0x7f55('0x5')+_0x585c46,_0x5e79a8);UserNotificationEvents['on'](_0x585c46,_0x518892);}}; \ No newline at end of file +var _0xa906=['userNotification:','./userNotification.events','remove','update','emit','removeListener','register','length'];(function(_0x207420,_0x2f9c05){var _0x3253d6=function(_0x40b220){while(--_0x40b220){_0x207420['push'](_0x207420['shift']());}};_0x3253d6(++_0x2f9c05);}(_0xa906,0x69));var _0x6a90=function(_0x5acd2d,_0x50aea0){_0x5acd2d=_0x5acd2d-0x0;var _0x2bab66=_0xa906[_0x5acd2d];return _0x2bab66;};'use strict';var UserNotificationEvents=require(_0x6a90('0x0'));var events=['save',_0x6a90('0x1'),_0x6a90('0x2')];function createListener(_0x5a76df,_0x3ba02c){return function(_0x185909){_0x3ba02c[_0x6a90('0x3')](_0x5a76df,_0x185909);};}function removeListener(_0x323b60,_0x253bcc){return function(){UserNotificationEvents[_0x6a90('0x4')](_0x323b60,_0x253bcc);};}exports[_0x6a90('0x5')]=function(_0x2f1c24){for(var _0x21076c=0x0,_0x4796df=events[_0x6a90('0x6')];_0x21076c<_0x4796df;_0x21076c++){var _0x29ff57=events[_0x21076c];var _0x1991a6=createListener(_0x6a90('0x7')+_0x29ff57,_0x2f1c24);UserNotificationEvents['on'](_0x29ff57,_0x1991a6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 004e131..d1efc4d 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xfac25f,_0x34de01){var _0x51ff9d=function(_0x43b366){while(--_0x43b366){_0xfac25f['push'](_0xfac25f['shift']());}};_0x51ff9d(++_0x34de01);}(_0x70e0,0x17b));var _0x070e=function(_0x5eaad0,_0x499e2b){_0x5eaad0=_0x5eaad0-0x0;var _0x291adb=_0x70e0[_0x5eaad0];return _0x291adb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x49cbb4,_0x3e9c47){var _0x41d4c4=function(_0x3a3dae){while(--_0x3a3dae){_0x49cbb4['push'](_0x49cbb4['shift']());}};_0x41d4c4(++_0x3e9c47);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0xcb91[_0x4ec13d];return _0x3c3fa7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index d143c27..36e1033 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 _0x9983=['INTEGER','sequelize'];(function(_0x2bdbc4,_0x1b1171){var _0x589e28=function(_0xb058c8){while(--_0xb058c8){_0x2bdbc4['push'](_0x2bdbc4['shift']());}};_0x589e28(++_0x1b1171);}(_0x9983,0x159));var _0x3998=function(_0x2cea22,_0xcab99e){_0x2cea22=_0x2cea22-0x0;var _0x199cc6=_0x9983[_0x2cea22];return _0x199cc6;};'use strict';var Sequelize=require(_0x3998('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3998('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x60ed=['exports','INTEGER'];(function(_0xfd5be2,_0x1dd184){var _0x1dfe9d=function(_0x5b95db){while(--_0x5b95db){_0xfd5be2['push'](_0xfd5be2['shift']());}};_0x1dfe9d(++_0x1dd184);}(_0x60ed,0x118));var _0xd60e=function(_0x239f9d,_0x406400){_0x239f9d=_0x239f9d-0x0;var _0x3cadca=_0x60ed[_0x239f9d];return _0x3cadca;};'use strict';var Sequelize=require('sequelize');module[_0xd60e('0x0')]={'penalty':{'type':Sequelize[_0xd60e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index e2f6794..3680b2b 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 _0x52e3=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues'];(function(_0x13d01e,_0x278569){var _0x20f26b=function(_0x259391){while(--_0x259391){_0x13d01e['push'](_0x13d01e['shift']());}};_0x20f26b(++_0x278569);}(_0x52e3,0x134));var _0x352e=function(_0x162244,_0x32c4ee){_0x162244=_0x162244-0x0;var _0x52287f=_0x52e3[_0x162244];return _0x52287f;};'use strict';var _=require(_0x352e('0x0'));var util=require(_0x352e('0x1'));var logger=require(_0x352e('0x2'))(_0x352e('0x3'));var moment=require('moment');var BPromise=require(_0x352e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x352e('0x5'));var config=require(_0x352e('0x6'));var attributes=require(_0x352e('0x7'));module[_0x352e('0x8')]=function(_0x720663,_0x28244a){return _0x720663[_0x352e('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x352e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3838=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x108d68,_0x9b39de){var _0x11476a=function(_0x21cc20){while(--_0x21cc20){_0x108d68['push'](_0x108d68['shift']());}};_0x11476a(++_0x9b39de);}(_0x3838,0x1b8));var _0x8383=function(_0x7591c,_0x12dafd){_0x7591c=_0x7591c-0x0;var _0x3b62cb=_0x3838[_0x7591c];return _0x3b62cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8383('0x0'))('api');var moment=require(_0x8383('0x1'));var BPromise=require(_0x8383('0x2'));var rp=require(_0x8383('0x3'));var fs=require('fs');var path=require(_0x8383('0x4'));var rimraf=require(_0x8383('0x5'));var config=require(_0x8383('0x6'));var attributes=require(_0x8383('0x7'));module[_0x8383('0x8')]=function(_0x1a7db6,_0x1c3b15){return _0x1a7db6[_0x8383('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index fa895f7..3a55892 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 _0x73a3=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3fc9ad,_0x3e61bb){var _0x59db73=function(_0x4851ee){while(--_0x4851ee){_0x3fc9ad['push'](_0x3fc9ad['shift']());}};_0x59db73(++_0x3e61bb);}(_0x73a3,0x66));var _0x373a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x73a3[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x373a('0x0'));var util=require(_0x373a('0x1'));var moment=require(_0x373a('0x2'));var BPromise=require(_0x373a('0x3'));var rs=require(_0x373a('0x4'));var fs=require('fs');var Redis=require(_0x373a('0x5'));var db=require(_0x373a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x373a('0x7'))(_0x373a('0x8'));var config=require(_0x373a('0x9'));var jayson=require(_0x373a('0xa'));var client=jayson[_0x373a('0xb')][_0x373a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45a7cc,_0x40e6d5,_0x20e33f){return new BPromise(function(_0x590d69,_0x4fe669){return client[_0x373a('0xd')](_0x45a7cc,_0x20e33f)[_0x373a('0xe')](function(_0x428455){logger[_0x373a('0xf')](_0x373a('0x10'),_0x40e6d5,_0x373a('0x11'));logger[_0x373a('0x12')](_0x373a('0x13'),_0x40e6d5,_0x373a('0x11'),JSON[_0x373a('0x14')](_0x428455));if(_0x428455[_0x373a('0x15')]){if(_0x428455[_0x373a('0x15')]['code']===0x1f4){logger[_0x373a('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x40e6d5,_0x428455[_0x373a('0x15')][_0x373a('0x16')]);return _0x4fe669(_0x428455['error'][_0x373a('0x16')]);}logger[_0x373a('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x40e6d5,_0x428455[_0x373a('0x15')][_0x373a('0x16')]);return _0x590d69(_0x428455['error']['message']);}else{logger[_0x373a('0xf')](_0x373a('0x10'),_0x40e6d5,_0x373a('0x11'));_0x590d69(_0x428455[_0x373a('0x17')][_0x373a('0x16')]);}})[_0x373a('0x18')](function(_0x3af109){logger[_0x373a('0x15')](_0x373a('0x10'),_0x40e6d5,_0x3af109);_0x4fe669(_0x3af109);});});} \ No newline at end of file +var _0xa9ec=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x499b5b,_0x2960e3){var _0x47329e=function(_0x532a06){while(--_0x532a06){_0x499b5b['push'](_0x499b5b['shift']());}};_0x47329e(++_0x2960e3);}(_0xa9ec,0x148));var _0xca9e=function(_0x1dc337,_0x163446){_0x1dc337=_0x1dc337-0x0;var _0x2c4d04=_0xa9ec[_0x1dc337];return _0x2c4d04;};'use strict';var _=require(_0xca9e('0x0'));var util=require(_0xca9e('0x1'));var moment=require(_0xca9e('0x2'));var BPromise=require(_0xca9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca9e('0x4'));var db=require(_0xca9e('0x5'))['db'];var utils=require(_0xca9e('0x6'));var logger=require(_0xca9e('0x7'))(_0xca9e('0x8'));var config=require(_0xca9e('0x9'));var jayson=require(_0xca9e('0xa'));var client=jayson[_0xca9e('0xb')][_0xca9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27bff2,_0x4c46fb,_0x52a126){return new BPromise(function(_0x56301c,_0x203b16){return client[_0xca9e('0xd')](_0x27bff2,_0x52a126)[_0xca9e('0xe')](function(_0x43cb13){logger[_0xca9e('0xf')](_0xca9e('0x10'),_0x4c46fb,'request\x20sent');logger[_0xca9e('0x11')](_0xca9e('0x12'),_0x4c46fb,_0xca9e('0x13'),JSON[_0xca9e('0x14')](_0x43cb13));if(_0x43cb13[_0xca9e('0x15')]){if(_0x43cb13[_0xca9e('0x15')]['code']===0x1f4){logger[_0xca9e('0x15')](_0xca9e('0x10'),_0x4c46fb,_0x43cb13['error'][_0xca9e('0x16')]);return _0x203b16(_0x43cb13[_0xca9e('0x15')][_0xca9e('0x16')]);}logger[_0xca9e('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c46fb,_0x43cb13[_0xca9e('0x15')][_0xca9e('0x16')]);return _0x56301c(_0x43cb13[_0xca9e('0x15')][_0xca9e('0x16')]);}else{logger[_0xca9e('0xf')](_0xca9e('0x10'),_0x4c46fb,_0xca9e('0x13'));_0x56301c(_0x43cb13[_0xca9e('0x17')][_0xca9e('0x16')]);}})[_0xca9e('0x18')](function(_0x5bc2f3){logger[_0xca9e('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c46fb,_0x5bc2f3);_0x203b16(_0x5bc2f3);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 246b473..206a40d 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 _0xf9c5=['../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','addSections','addResources','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x24d22f,_0xfa6241){var _0x33b153=function(_0x28caa6){while(--_0x28caa6){_0x24d22f['push'](_0x24d22f['shift']());}};_0x33b153(++_0xfa6241);}(_0xf9c5,0xf7));var _0x5f9c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf9c5[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x5f9c('0x0'));var util=require(_0x5f9c('0x1'));var path=require(_0x5f9c('0x2'));var timeout=require(_0x5f9c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5f9c('0x4'));var auth=require(_0x5f9c('0x5'));var interaction=require(_0x5f9c('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x5f9c('0x7')]('/',auth['isAuthenticated'](),controller[_0x5f9c('0x8')]);router[_0x5f9c('0x7')](_0x5f9c('0x9'),auth['isAuthenticated'](),controller[_0x5f9c('0xa')]);router['get'](_0x5f9c('0xb'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0xd')]);router['get'](_0x5f9c('0xe'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0xf')]);router[_0x5f9c('0x7')](_0x5f9c('0x10'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0x11')]);router[_0x5f9c('0x12')]('/',auth[_0x5f9c('0xc')](),controller['create']);router[_0x5f9c('0x12')](_0x5f9c('0x13'),auth[_0x5f9c('0xc')](),controller['clone']);router['post'](_0x5f9c('0xe'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0x14')]);router['post'](_0x5f9c('0x10'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0x15')]);router['put'](_0x5f9c('0xb'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0x16')]);router[_0x5f9c('0x17')](_0x5f9c('0xb'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0x18')]);router[_0x5f9c('0x17')](_0x5f9c('0xe'),auth[_0x5f9c('0xc')](),controller[_0x5f9c('0x19')]);router[_0x5f9c('0x17')](_0x5f9c('0x10'),auth['isAuthenticated'](),controller[_0x5f9c('0x1a')]);module[_0x5f9c('0x1b')]=router; \ No newline at end of file +var _0xb27c=['removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getSections','/:id/resources','post','create','/:id/clone','clone','/:id/sections','addSections','put','delete','destroy','removeSections'];(function(_0x3713a0,_0x47fe71){var _0x63353b=function(_0x2bca8b){while(--_0x2bca8b){_0x3713a0['push'](_0x3713a0['shift']());}};_0x63353b(++_0x47fe71);}(_0xb27c,0x16a));var _0xcb27=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xb27c[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xcb27('0x0'));var util=require(_0xcb27('0x1'));var path=require(_0xcb27('0x2'));var timeout=require(_0xcb27('0x3'));var express=require('express');var router=express[_0xcb27('0x4')]();var fs_extra=require(_0xcb27('0x5'));var auth=require(_0xcb27('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb27('0x7'));var controller=require(_0xcb27('0x8'));router[_0xcb27('0x9')]('/',auth['isAuthenticated'](),controller[_0xcb27('0xa')]);router[_0xcb27('0x9')](_0xcb27('0xb'),auth[_0xcb27('0xc')](),controller[_0xcb27('0xd')]);router[_0xcb27('0x9')](_0xcb27('0xe'),auth[_0xcb27('0xc')](),controller[_0xcb27('0xf')]);router[_0xcb27('0x9')]('/:id/sections',auth[_0xcb27('0xc')](),controller[_0xcb27('0x10')]);router[_0xcb27('0x9')](_0xcb27('0x11'),auth[_0xcb27('0xc')](),controller['getResources']);router[_0xcb27('0x12')]('/',auth[_0xcb27('0xc')](),controller[_0xcb27('0x13')]);router[_0xcb27('0x12')](_0xcb27('0x14'),auth['isAuthenticated'](),controller[_0xcb27('0x15')]);router[_0xcb27('0x12')](_0xcb27('0x16'),auth['isAuthenticated'](),controller[_0xcb27('0x17')]);router['post'](_0xcb27('0x11'),auth['isAuthenticated'](),controller['addResources']);router[_0xcb27('0x18')](_0xcb27('0xe'),auth[_0xcb27('0xc')](),controller['update']);router[_0xcb27('0x19')](_0xcb27('0xe'),auth['isAuthenticated'](),controller[_0xcb27('0x1a')]);router[_0xcb27('0x19')](_0xcb27('0x16'),auth['isAuthenticated'](),controller[_0xcb27('0x1b')]);router['delete'](_0xcb27('0x11'),auth['isAuthenticated'](),controller[_0xcb27('0x1c')]);module[_0xcb27('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index cd36aaa..b87accf 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 _0x4fcd=['exports','STRING','name','setDataValue','getDataValue','crudPermissions','split','BOOLEAN','sequelize'];(function(_0x1f926f,_0x15c719){var _0x2e906c=function(_0x42c2b7){while(--_0x42c2b7){_0x1f926f['push'](_0x1f926f['shift']());}};_0x2e906c(++_0x15c719);}(_0x4fcd,0xfb));var _0xd4fc=function(_0x189472,_0x13afee){_0x189472=_0x189472-0x0;var _0x157cfb=_0x4fcd[_0x189472];return _0x157cfb;};'use strict';var Sequelize=require(_0xd4fc('0x0'));module[_0xd4fc('0x1')]={'name':{'type':Sequelize[_0xd4fc('0x2')],'allowNull':![],'unique':_0xd4fc('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1e0d83){this[_0xd4fc('0x4')]('crudPermissions',_0x1e0d83?_0x1e0d83['join'](''):[]);},'get':function(){return this[_0xd4fc('0x5')]('crudPermissions')?this[_0xd4fc('0x5')](_0xd4fc('0x6'))[_0xd4fc('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xd4fc('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd4fc('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd4fc('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd4fc('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xd4fc('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xd4fc('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xd4fc('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7952=['STRING','BOOLEAN','sequelize','exports','name','setDataValue','getDataValue','split'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7952,0xfa));var _0x2795=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x7952[_0xc55d64];return _0x4194f6;};'use strict';var Sequelize=require(_0x2795('0x0'));module[_0x2795('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2795('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x198458){this[_0x2795('0x3')]('crudPermissions',_0x198458?_0x198458['join'](''):[]);},'get':function(){return this[_0x2795('0x4')]('crudPermissions')?this[_0x2795('0x4')]('crudPermissions')[_0x2795('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2795('0x6')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2795('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2795('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 0ee7130..f026f93 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 _0xf3f9=['then','error','name','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','transaction','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','destroy','addSections','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','forEach','resourceId','addResources','sequelize','bulkCreate','removeResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','sendStatus','status','end','json','offset','limit','undefined','count','apply','save'];(function(_0x646d8e,_0x2a19ae){var _0x1c969a=function(_0x3d99cb){while(--_0x3d99cb){_0x646d8e['push'](_0x646d8e['shift']());}};_0x1c969a(++_0x2a19ae);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x1ba563,_0x434d71){_0x1ba563=_0x1ba563-0x0;var _0x2cec1f=_0xf3f9[_0x1ba563];return _0x2cec1f;};'use strict';var emlformat=require(_0x9f3f('0x0'));var rimraf=require(_0x9f3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f3f('0x2'));var rp=require(_0x9f3f('0x3'));var moment=require(_0x9f3f('0x4'));var BPromise=require(_0x9f3f('0x5'));var Mustache=require(_0x9f3f('0x6'));var util=require(_0x9f3f('0x7'));var path=require(_0x9f3f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f3f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f3f('0xa'));var squel=require('squel');var crypto=require(_0x9f3f('0xb'));var jsforce=require(_0x9f3f('0xc'));var deskjs=require(_0x9f3f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9f3f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f3f('0xf'));var hardwareService=require(_0x9f3f('0x10'));var logger=require(_0x9f3f('0x11'))(_0x9f3f('0x12'));var utils=require(_0x9f3f('0x13'));var config=require(_0x9f3f('0x14'));var licenseUtil=require(_0x9f3f('0x15'));var db=require(_0x9f3f('0x16'))['db'];config[_0x9f3f('0x17')]=_[_0x9f3f('0x18')](config[_0x9f3f('0x17')],{'host':_0x9f3f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f3f('0x17')]));require(_0x9f3f('0x1a'))['register'](socket);function respondWithStatusCode(_0x588ab3,_0x3564b4){_0x3564b4=_0x3564b4||0xcc;return function(_0x4849da){if(_0x4849da){return _0x588ab3[_0x9f3f('0x1b')](_0x3564b4);}return _0x588ab3[_0x9f3f('0x1c')](_0x3564b4)[_0x9f3f('0x1d')]();};}function respondWithResult(_0x40a26b,_0x569dc9){_0x569dc9=_0x569dc9||0xc8;return function(_0x258ecd){if(_0x258ecd){return _0x40a26b[_0x9f3f('0x1c')](_0x569dc9)[_0x9f3f('0x1e')](_0x258ecd);}};}function respondWithFilteredResult(_0x124077,_0x1c7633){return function(_0x153b2f){if(_0x153b2f){var _0x5d3fc9=typeof _0x1c7633[_0x9f3f('0x1f')]==='undefined'&&typeof _0x1c7633[_0x9f3f('0x20')]===_0x9f3f('0x21');var _0x5daff5=_0x153b2f[_0x9f3f('0x22')];var _0x8363f=_0x5d3fc9?0x0:_0x1c7633[_0x9f3f('0x1f')];var _0x43d9e6=_0x5d3fc9?_0x153b2f['count']:_0x1c7633['offset']+_0x1c7633[_0x9f3f('0x20')];var _0x5d51ad;if(_0x43d9e6>=_0x5daff5){_0x43d9e6=_0x5daff5;_0x5d51ad=0xc8;}else{_0x5d51ad=0xce;}_0x124077[_0x9f3f('0x1c')](_0x5d51ad);return _0x124077['set']('Content-Range',_0x8363f+'-'+_0x43d9e6+'/'+_0x5daff5)[_0x9f3f('0x1e')](_0x153b2f);}return null;};}function patchUpdates(_0x2e9379){return function(_0x4a4ad5){try{jsonpatch[_0x9f3f('0x23')](_0x4a4ad5,_0x2e9379,!![]);}catch(_0x4a0077){return BPromise['reject'](_0x4a0077);}return _0x4a4ad5[_0x9f3f('0x24')]();};}function saveUpdates(_0x2940e0,_0x18905d){return function(_0x45b6c0){if(_0x45b6c0){return _0x45b6c0['update'](_0x2940e0)[_0x9f3f('0x25')](function(_0x5d67f3){return _0x5d67f3;});}return null;};}function removeEntity(_0x242325,_0x1ef969){return function(_0x45b0fb){if(_0x45b0fb){return _0x45b0fb['destroy']()[_0x9f3f('0x25')](function(){_0x242325[_0x9f3f('0x1c')](0xcc)[_0x9f3f('0x1d')]();});}};}function handleEntityNotFound(_0x829555,_0xcd9d42){return function(_0x5c4f15){if(!_0x5c4f15){_0x829555['sendStatus'](0x194);}return _0x5c4f15;};}function handleError(_0x2d8ce3,_0x5def30){_0x5def30=_0x5def30||0x1f4;return function(_0x3b43c7){logger[_0x9f3f('0x26')](_0x3b43c7['stack']);if(_0x3b43c7[_0x9f3f('0x27')]){delete _0x3b43c7['name'];}_0x2d8ce3['status'](_0x5def30)['send'](_0x3b43c7);};}exports['index']=function(_0x44854d,_0x26e85b){var _0x4c496e={},_0x3a5be4={},_0xf848ef={'count':0x0,'rows':[]};var _0x2d01cd=_[_0x9f3f('0x28')](db[_0x9f3f('0x29')]['rawAttributes'],function(_0x20f77f){return{'name':_0x20f77f[_0x9f3f('0x2a')],'type':_0x20f77f[_0x9f3f('0x2b')][_0x9f3f('0x2c')]};});_0x3a5be4[_0x9f3f('0x2d')]=_[_0x9f3f('0x28')](_0x2d01cd,_0x9f3f('0x27'));_0x3a5be4[_0x9f3f('0x2e')]=_[_0x9f3f('0x2f')](_0x44854d['query']);_0x3a5be4[_0x9f3f('0x30')]=_[_0x9f3f('0x31')](_0x3a5be4[_0x9f3f('0x2d')],_0x3a5be4[_0x9f3f('0x2e')]);_0x4c496e[_0x9f3f('0x32')]=_[_0x9f3f('0x31')](_0x3a5be4[_0x9f3f('0x2d')],qs[_0x9f3f('0x33')](_0x44854d[_0x9f3f('0x2e')]['fields']));_0x4c496e['attributes']=_0x4c496e[_0x9f3f('0x32')][_0x9f3f('0x34')]?_0x4c496e[_0x9f3f('0x32')]:_0x3a5be4[_0x9f3f('0x2d')];if(!_0x44854d[_0x9f3f('0x2e')][_0x9f3f('0x35')](_0x9f3f('0x36'))){_0x4c496e[_0x9f3f('0x20')]=qs[_0x9f3f('0x20')](_0x44854d[_0x9f3f('0x2e')]['limit']);_0x4c496e[_0x9f3f('0x1f')]=qs[_0x9f3f('0x1f')](_0x44854d['query']['offset']);}_0x4c496e[_0x9f3f('0x37')]=qs[_0x9f3f('0x38')](_0x44854d[_0x9f3f('0x2e')][_0x9f3f('0x38')]);_0x4c496e[_0x9f3f('0x39')]=qs[_0x9f3f('0x30')](_['pick'](_0x44854d[_0x9f3f('0x2e')],_0x3a5be4[_0x9f3f('0x30')]),_0x2d01cd);if(_0x44854d[_0x9f3f('0x2e')][_0x9f3f('0x3a')]){_0x4c496e[_0x9f3f('0x39')]=_[_0x9f3f('0x3b')](_0x4c496e[_0x9f3f('0x39')],{'$or':_[_0x9f3f('0x28')](_0x2d01cd,function(_0x5c7fc8){if(_0x5c7fc8['type']!=='VIRTUAL'){var _0x374710={};_0x374710[_0x5c7fc8[_0x9f3f('0x27')]]={'$like':'%'+_0x44854d[_0x9f3f('0x2e')][_0x9f3f('0x3a')]+'%'};return _0x374710;}})});}_0x4c496e=_[_0x9f3f('0x3b')]({},_0x4c496e,_0x44854d['options']);var _0x3306f1={'where':_0x4c496e[_0x9f3f('0x39')]};return db[_0x9f3f('0x29')]['count'](_0x3306f1)['then'](function(_0x27bc99){_0xf848ef[_0x9f3f('0x22')]=_0x27bc99;if(_0x44854d[_0x9f3f('0x2e')][_0x9f3f('0x3c')]){_0x4c496e[_0x9f3f('0x3d')]=[{'all':!![]}];}return db[_0x9f3f('0x29')][_0x9f3f('0x3e')](_0x4c496e);})['then'](function(_0x1bf573){_0xf848ef['rows']=_0x1bf573;return _0xf848ef;})[_0x9f3f('0x25')](respondWithFilteredResult(_0x26e85b,_0x4c496e))[_0x9f3f('0x3f')](handleError(_0x26e85b,null));};exports[_0x9f3f('0x40')]=function(_0x41527e,_0x2f485a){var _0x282e29={'raw':![],'where':{'id':_0x41527e[_0x9f3f('0x41')]['id']}},_0x1812fe={};_0x1812fe[_0x9f3f('0x2d')]=_[_0x9f3f('0x2f')](db['UserProfile'][_0x9f3f('0x42')]);_0x1812fe['query']=_['keys'](_0x41527e[_0x9f3f('0x2e')]);_0x1812fe[_0x9f3f('0x30')]=_[_0x9f3f('0x31')](_0x1812fe[_0x9f3f('0x2d')],_0x1812fe[_0x9f3f('0x2e')]);_0x282e29[_0x9f3f('0x32')]=_[_0x9f3f('0x31')](_0x1812fe[_0x9f3f('0x2d')],qs[_0x9f3f('0x33')](_0x41527e['query'][_0x9f3f('0x33')]));_0x282e29[_0x9f3f('0x32')]=_0x282e29[_0x9f3f('0x32')][_0x9f3f('0x34')]?_0x282e29['attributes']:_0x1812fe[_0x9f3f('0x2d')];if(_0x41527e['query'][_0x9f3f('0x3c')]){_0x282e29[_0x9f3f('0x3d')]=[{'all':!![]}];}_0x282e29=_['merge']({},_0x282e29,_0x41527e[_0x9f3f('0x43')]);return db['UserProfile']['find'](_0x282e29)[_0x9f3f('0x25')](handleEntityNotFound(_0x2f485a,null))[_0x9f3f('0x25')](respondWithResult(_0x2f485a,null))['catch'](handleError(_0x2f485a,null));};exports[_0x9f3f('0x44')]=function(_0x3acc37,_0x3edd68){return db[_0x9f3f('0x29')][_0x9f3f('0x44')](_0x3acc37[_0x9f3f('0x45')],{})['then'](respondWithResult(_0x3edd68,0xc9))[_0x9f3f('0x3f')](handleError(_0x3edd68,null));};exports[_0x9f3f('0x46')]=function(_0x7b7228,_0x1d4960){var _0x18ee7d={'where':{'id':_0x7b7228['params']['id']}},_0x4df2bb={};_0x4df2bb[_0x9f3f('0x2d')]=_[_0x9f3f('0x2f')](db[_0x9f3f('0x29')]['rawAttributes']);_0x18ee7d[_0x9f3f('0x32')]=_[_0x9f3f('0x31')](_0x4df2bb[_0x9f3f('0x2d')],qs[_0x9f3f('0x33')](_0x7b7228[_0x9f3f('0x2e')][_0x9f3f('0x33')]));_0x18ee7d[_0x9f3f('0x32')]=_0x18ee7d[_0x9f3f('0x32')][_0x9f3f('0x34')]?_0x18ee7d[_0x9f3f('0x32')]:_0x4df2bb[_0x9f3f('0x2d')];if(_0x7b7228['query']['includeAll']){_0x18ee7d[_0x9f3f('0x3d')]=[{'all':!![]}];}_0x18ee7d=_[_0x9f3f('0x3b')]({},_0x18ee7d,_0x7b7228[_0x9f3f('0x43')]);return db[_0x9f3f('0x29')][_0x9f3f('0x47')](_0x18ee7d)[_0x9f3f('0x25')](handleEntityNotFound(_0x1d4960,null))['then'](function(_0x40118b){if(_0x40118b){var _0xda100b=_0x40118b[_0x9f3f('0x48')]({'plain':!![]});_0xda100b=qs[_0x9f3f('0x49')](_0xda100b,['id',_0x9f3f('0x4a'),_0x9f3f('0x4b'),_0x9f3f('0x4c')]);_0x7b7228['body']=_[_0x9f3f('0x49')](_0x7b7228['body'],['id','createdAt',_0x9f3f('0x4b')]);return db['sequelize'][_0x9f3f('0x4d')](function(_0x32acd8){return db[_0x9f3f('0x29')][_0x9f3f('0x44')](_['merge'](_0xda100b,_0x7b7228[_0x9f3f('0x45')]),{'include':_0x7b7228[_0x9f3f('0x2e')][_0x9f3f('0x3c')]?[{'all':!![]}]:undefined,'transaction':_0x32acd8})['then'](function(_0x16c10b){var _0x9170a3=_0x16c10b['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x7b7228[_0x9f3f('0x41')]['id']},'raw':!![]})[_0x9f3f('0x25')](function(_0x155e64){if(_0x155e64){return BPromise[_0x9f3f('0x4e')](_0x155e64,function(_0x5706ab){return new BPromise(function(_0x3c4177,_0x5d8c94){if(_0x5706ab[_0x9f3f('0x4f')]===null||_0x5706ab[_0x9f3f('0x4f')]===0x1)_0x3c4177(null);return db['UserProfileResource'][_0x9f3f('0x3e')]({'where':{'sectionId':_0x5706ab['id']},'raw':!![]})['then'](function(_0x4116ed){var _0xab129c=_['map'](_0x4116ed,function(_0x4da593){return qs[_0x9f3f('0x49')](_0x4da593,['id',_0x9f3f('0x4a'),_0x9f3f('0x4b'),_0x9f3f('0x50')]);});_0x3c4177(_0xab129c);})[_0x9f3f('0x3f')](function(_0x4b3d8f){_0x5d8c94(_0x4b3d8f);});})[_0x9f3f('0x25')](function(_0x36d1ac){var _0xa2afb1=qs[_0x9f3f('0x49')](_0x5706ab,['id',_0x9f3f('0x4a'),'updatedAt']);_0xa2afb1[_0x9f3f('0x51')]=_0x9170a3['id'];if(_0x36d1ac)_0xa2afb1[_0x9f3f('0x52')]=_0x36d1ac;return _0xa2afb1;})[_0x9f3f('0x25')](function(_0x265929){return db[_0x9f3f('0x53')][_0x9f3f('0x44')](_0x265929,{'include':[{'model':db[_0x9f3f('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x32acd8});});})[_0x9f3f('0x25')](function(){return _0x9170a3;});}});});});}})[_0x9f3f('0x25')](respondWithResult(_0x1d4960,0xc9))[_0x9f3f('0x3f')](handleError(_0x1d4960,null));};exports['update']=function(_0x209107,_0x26950d){if(_0x209107[_0x9f3f('0x45')]['id']){delete _0x209107[_0x9f3f('0x45')]['id'];}return db[_0x9f3f('0x29')][_0x9f3f('0x47')]({'where':{'id':_0x209107['params']['id']}})[_0x9f3f('0x25')](handleEntityNotFound(_0x26950d,null))[_0x9f3f('0x25')](saveUpdates(_0x209107[_0x9f3f('0x45')],null))[_0x9f3f('0x25')](respondWithResult(_0x26950d,null))['catch'](handleError(_0x26950d,null));};exports[_0x9f3f('0x55')]=function(_0x14e306,_0x4fd4d8){return db[_0x9f3f('0x29')][_0x9f3f('0x47')]({'where':{'id':_0x14e306[_0x9f3f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fd4d8,null))[_0x9f3f('0x25')](removeEntity(_0x4fd4d8,null))['catch'](handleError(_0x4fd4d8,null));};exports['describe']=function(_0x41e1be,_0x205473){return db[_0x9f3f('0x29')]['describe']()[_0x9f3f('0x25')](respondWithResult(_0x205473,null))[_0x9f3f('0x3f')](handleError(_0x205473,null));};exports[_0x9f3f('0x56')]=function(_0x56ae46,_0x34d553){var _0x23c57f=_0x56ae46[_0x9f3f('0x45')];return db[_0x9f3f('0x29')]['find']({'where':{'id':_0x56ae46[_0x9f3f('0x41')]['id']}})[_0x9f3f('0x25')](handleEntityNotFound(_0x34d553,null))['then'](function(_0xd02acf){if(_0xd02acf){return db['sequelize'][_0x9f3f('0x4d')](function(_0x386db2){return db[_0x9f3f('0x53')][_0x9f3f('0x55')]({'where':{'userProfileId':_0x56ae46['params']['id'],'sectionId':_[_0x9f3f('0x28')](_0x23c57f,function(_0x5b5e85){return _0x5b5e85[_0x9f3f('0x50')];})},'transaction':_0x386db2})[_0x9f3f('0x25')](function(){var _0x591f17=_[_0x9f3f('0x28')](_0x23c57f,function(_0x40c8fd){_0x40c8fd[_0x9f3f('0x51')]=_0x56ae46[_0x9f3f('0x41')]['id'];return _0x40c8fd;});var _0x331042=[];return BPromise[_0x9f3f('0x4e')](_0x591f17,function(_0x3b7f5a){return db[_0x9f3f('0x53')][_0x9f3f('0x44')](_0x3b7f5a,{'include':[{'model':db[_0x9f3f('0x54')],'as':_0x9f3f('0x52')}],'raw':!![],'transaction':_0x386db2})[_0x9f3f('0x25')](function(_0x346802){_0x331042[_0x9f3f('0x57')](_0x346802['get']({'plain':!![]}));});})[_0x9f3f('0x25')](function(){return _0x331042;});});});}})[_0x9f3f('0x25')](function(_0x5afd34){return _0x5afd34;})['then'](respondWithResult(_0x34d553,null))[_0x9f3f('0x3f')](handleError(_0x34d553,null));};exports[_0x9f3f('0x58')]=function(_0x4bc81b,_0x2828d9){var _0x19d1f7;return db['UserProfile']['find']({'where':{'id':_0x4bc81b[_0x9f3f('0x41')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x2828d9,null))['then'](function(_0x124835){if(_0x124835){_0x19d1f7=_0x124835;return db[_0x9f3f('0x53')][_0x9f3f('0x55')]({'where':{'userProfileId':_0x4bc81b[_0x9f3f('0x41')]['id'],'sectionId':_0x4bc81b[_0x9f3f('0x2e')][_0x9f3f('0x59')]}});}})['then'](function(){return _0x19d1f7;})['then'](respondWithStatusCode(_0x2828d9,null))[_0x9f3f('0x3f')](handleError(_0x2828d9,null));};exports[_0x9f3f('0x5a')]=function(_0x8d2a92,_0x365fd8){var _0x253448=[];var _0x224a0a=[];return db[_0x9f3f('0x53')][_0x9f3f('0x3e')]({'where':{'userProfileId':_0x8d2a92[_0x9f3f('0x41')]['id']},'raw':!![]})[_0x9f3f('0x25')](function(_0x2f7738){_0x253448=_[_0x9f3f('0x3a')](_0x2f7738,function(_0x5c505f){return _0x5c505f['enabled']===0x1||_[_0x9f3f('0x5b')]([0x3eb,0x709],_0x5c505f[_0x9f3f('0x50')]);});if(!_[_0x9f3f('0x5c')](_0x253448)){return _[_0x9f3f('0x28')](_0x253448,function(_0x277811){return _0x277811[_0x9f3f('0x50')];});}else{return;}})['then'](function(_0x2a1e5a){if(_0x2a1e5a)_0x224a0a=_0x2a1e5a;if(_[_0x9f3f('0x5b')](_0x224a0a,0x64)){var _0x4b69d3=_[_0x9f3f('0x47')](_0x253448,{'sectionId':0x64});return hasDefaultDashboard(_0x4b69d3)[_0x9f3f('0x25')](function(_0x4627e8){return _[_0x9f3f('0x28')](_0x253448,function(_0x16428f){if(_0x16428f[_0x9f3f('0x50')]===0x64){_0x16428f[_0x9f3f('0x5d')]=_0x4627e8;}return _0x16428f;});});}else{return;}})[_0x9f3f('0x25')](function(_0x4248fe){if(_0x4248fe)_0x253448=_0x4248fe;if(_['includes'](_0x224a0a,0x3eb)){var _0x176771=_[_0x9f3f('0x47')](_0x253448,{'sectionId':0x3eb});return getCustomDashboards(_0x176771)[_0x9f3f('0x25')](function(_0x33c2e5){return _['map'](_0x253448,function(_0x4d91e1){if(_0x176771[_0x9f3f('0x5e')]){if(_0x4d91e1[_0x9f3f('0x50')]===0x3eb){_0x4d91e1[_0x9f3f('0x5d')]=_0x33c2e5;}}else{if(_0x4d91e1[_0x9f3f('0x50')]===0x64){_0x4d91e1['subsections']=_0x33c2e5;}}return _0x4d91e1;});});}else{return;}})[_0x9f3f('0x25')](function(_0x286717){if(_0x286717)_0x253448=_0x286717;if(_[_0x9f3f('0x5b')](_0x224a0a,0x709)){var _0x5b148e=_[_0x9f3f('0x47')](_0x253448,{'sectionId':0x709});return getPlugins(_0x5b148e)['then'](function(_0x256251){if(_0x5b148e[_0x9f3f('0x5e')]){return _[_0x9f3f('0x28')](_0x253448,function(_0x1093ab){if(_0x1093ab['sectionId']===0x709){_0x1093ab[_0x9f3f('0x5d')]=_0x256251;}return _0x1093ab;});}else{var _0x11c375={'sectionId':0x76c,'enabled':0x1,'subsections':_0x256251};var _0xef5aa8=_[_0x9f3f('0x28')](_0x253448);_0xef5aa8[_0x9f3f('0x57')](_0x11c375);return _0xef5aa8;}});}else{return;}})[_0x9f3f('0x25')](function(_0x4a1036){if(_0x4a1036)_0x253448=_0x4a1036;return _['filter'](_0x253448,['enabled',0x1]);})['then'](respondWithResult(_0x365fd8,null))[_0x9f3f('0x3f')](handleError(_0x365fd8,null));};function hasDefaultDashboard(_0x29aeb6){var _0x405194=[0x65];return new BPromise(function(_0x422892,_0x32947f){try{if(_0x29aeb6[_0x9f3f('0x4f')]){_0x422892(_0x405194);}else{return db[_0x9f3f('0x54')]['findOne']({'where':{'sectionId':_0x29aeb6['id']},'raw':!![]})[_0x9f3f('0x25')](function(_0x3d2733){_0x3d2733?_0x422892(_0x405194):_0x422892();});}}catch(_0x20aa9c){_0x32947f(_0x20aa9c);}});}function getCustomDashboards(_0x3bb03f){var _0x266ac7=[];return new BPromise(function(_0x180f4e,_0x541a2d){try{if(_0x3bb03f[_0x9f3f('0x4f')]){return db['Dashboard'][_0x9f3f('0x3e')]({'raw':!![]})[_0x9f3f('0x25')](function(_0x57bd06){_0x57bd06[_0x9f3f('0x5f')](function(_0x23ef08){_0x266ac7[_0x9f3f('0x57')](_0x23ef08['id']+0x1869f);});_0x180f4e(_0x266ac7);});}else{return db[_0x9f3f('0x54')][_0x9f3f('0x3e')]({'where':{'sectionId':_0x3bb03f['id']},'raw':!![]})[_0x9f3f('0x25')](function(_0x45fa21){_0x45fa21['forEach'](function(_0x336bfa){_0x266ac7[_0x9f3f('0x57')](_0x336bfa[_0x9f3f('0x60')]+0x1869f);});_0x180f4e(_0x266ac7);});}}catch(_0x4388d1){_0x541a2d(_0x4388d1);}});}function getPlugins(_0x1112af){var _0x358521=[];return new BPromise(function(_0x193cc5,_0x371b00){try{if(_0x1112af['autoAssociation']){return db['Plugin'][_0x9f3f('0x3e')]({'raw':!![]})[_0x9f3f('0x25')](function(_0x43bd01){_0x43bd01[_0x9f3f('0x5f')](function(_0x476c0e){_0x358521[_0x9f3f('0x57')](_0x476c0e['id']+0x15b38);});_0x193cc5(_0x358521);});}else{return db[_0x9f3f('0x54')][_0x9f3f('0x3e')]({'where':{'sectionId':_0x1112af['id']},'raw':!![]})[_0x9f3f('0x25')](function(_0x493132){_0x493132[_0x9f3f('0x5f')](function(_0x3e1c4d){_0x358521['push'](_0x3e1c4d[_0x9f3f('0x60')]+0x15b38);});_0x193cc5(_0x358521);});}}catch(_0x40a2b2){_0x371b00(_0x40a2b2);}});}exports[_0x9f3f('0x61')]=function(_0xe36961,_0x2e2942){return db[_0x9f3f('0x29')][_0x9f3f('0x47')]({'where':{'id':_0xe36961[_0x9f3f('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e2942,null))[_0x9f3f('0x25')](function(_0x2eca68){if(_0x2eca68){return db[_0x9f3f('0x62')][_0x9f3f('0x4d')](function(_0x1649f4){return db[_0x9f3f('0x53')][_0x9f3f('0x3e')]({'where':{'userProfileId':_0xe36961[_0x9f3f('0x41')]['id']},'attributes':['id'],'raw':!![]})[_0x9f3f('0x25')](function(_0x2aa24a){if(_0x2aa24a){return db[_0x9f3f('0x53')][_0x9f3f('0x55')]({'where':{'userProfileId':_0xe36961[_0x9f3f('0x41')]['id'],'id':_[_0x9f3f('0x28')](_0x2aa24a,function(_0xe2fdff){return _0xe2fdff['id'];})},'transaction':_0x1649f4});}})[_0x9f3f('0x25')](function(_0x314dbb){var _0x448a26=_['map'](_0xe36961[_0x9f3f('0x45')],function(_0x339fc7){_0x339fc7[_0x9f3f('0x51')]=_0xe36961[_0x9f3f('0x41')]['id'];return _0x339fc7;});return db[_0x9f3f('0x53')]['bulkCreate'](_0x448a26,{'raw':!![],'transaction':_0x1649f4});})['then'](function(_0x3db3e3){var _0x328793=_[_0x9f3f('0x3a')](_[_0x9f3f('0x28')](_0x3db3e3,function(_0x468f84){return _0x468f84[_0x9f3f('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x328793){return db[_0x9f3f('0x53')][_0x9f3f('0x3e')]({'where':{'userProfileId':_0xe36961['params']['id'],'sectionId':_[_0x9f3f('0x28')](_0x328793,function(_0x345881){return _0x345881[_0x9f3f('0x50')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9f3f('0x25')](function(_0x73f6da){var _0xf4252a=_[_0x9f3f('0x28')](_0xe36961['body'],function(_0x3fadbd){_0x3fadbd[_0x9f3f('0x51')]=_0xe36961[_0x9f3f('0x41')]['id'];return _0x3fadbd;});return db[_0x9f3f('0x54')][_0x9f3f('0x63')](_0xf4252a,{'raw':!![],'transaction':_0x1649f4});});}})['catch'](handleError(_0x2e2942,null));});}})[_0x9f3f('0x25')](function(_0x218e57){var _0x1a0252=_[_0x9f3f('0x28')](_0x218e57,function(_0x98a58c){return _0x98a58c[_0x9f3f('0x48')]({'plain':!![]});});})[_0x9f3f('0x25')](respondWithResult(_0x2e2942,null))[_0x9f3f('0x3f')](handleError(_0x2e2942,null));};exports[_0x9f3f('0x64')]=function(_0x44f4da,_0x25c1d4,_0x338b88){return db['UserProfile'][_0x9f3f('0x47')]({'where':{'id':_0x44f4da[_0x9f3f('0x41')]['id']}})[_0x9f3f('0x25')](handleEntityNotFound(_0x25c1d4,null))[_0x9f3f('0x25')](function(_0x9be1c5){if(_0x9be1c5){return _0x9be1c5['removeResources'](_0x44f4da[_0x9f3f('0x2e')][_0x9f3f('0x59')]);}})[_0x9f3f('0x25')](respondWithStatusCode(_0x25c1d4,null))['catch'](handleError(_0x25c1d4,null));};exports['getResources']=function(_0x1bf8e1,_0x24a864){var _0x30b832={};if(!_0x1bf8e1['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x1bf8e1[_0x9f3f('0x2e')]['hasOwnProperty']('nolimit')){_0x30b832[_0x9f3f('0x20')]=qs[_0x9f3f('0x20')](_0x1bf8e1[_0x9f3f('0x2e')][_0x9f3f('0x20')]);_0x30b832[_0x9f3f('0x1f')]=qs[_0x9f3f('0x1f')](_0x1bf8e1[_0x9f3f('0x2e')][_0x9f3f('0x1f')]);}return db[_0x9f3f('0x29')]['find']({'where':{'id':_0x1bf8e1['params']['id']}})[_0x9f3f('0x25')](function(_0x1aa447){if(!_0x1aa447)throw new Error(_0x9f3f('0x65')+_0x1bf8e1['params']['id']);return db['UserProfile'][_0x9f3f('0x66')](_0x1bf8e1);})[_0x9f3f('0x25')](respondWithFilteredResult(_0x24a864,_0x30b832))[_0x9f3f('0x3f')](handleError(_0x24a864,null));}; \ No newline at end of file +var _0xae8e=['update','then','destroy','end','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','get','updatedAt','crudPermissions','omit','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','push','ids','enabled','isEmpty','includes','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','reject','save'];(function(_0x5e2ce3,_0x11c06f){var _0x5a2859=function(_0x18f60b){while(--_0x18f60b){_0x5e2ce3['push'](_0x5e2ce3['shift']());}};_0x5a2859(++_0x11c06f);}(_0xae8e,0xc3));var _0xeae8=function(_0x2a6505,_0x122a9c){_0x2a6505=_0x2a6505-0x0;var _0x46cbb4=_0xae8e[_0x2a6505];return _0x46cbb4;};'use strict';var emlformat=require(_0xeae8('0x0'));var rimraf=require(_0xeae8('0x1'));var zipdir=require(_0xeae8('0x2'));var jsonpatch=require(_0xeae8('0x3'));var rp=require(_0xeae8('0x4'));var moment=require(_0xeae8('0x5'));var BPromise=require(_0xeae8('0x6'));var Mustache=require(_0xeae8('0x7'));var util=require(_0xeae8('0x8'));var path=require(_0xeae8('0x9'));var sox=require(_0xeae8('0xa'));var csv=require(_0xeae8('0xb'));var ejs=require(_0xeae8('0xc'));var fs=require('fs');var fs_extra=require(_0xeae8('0xd'));var _=require(_0xeae8('0xe'));var squel=require(_0xeae8('0xf'));var crypto=require(_0xeae8('0x10'));var jsforce=require(_0xeae8('0x11'));var deskjs=require(_0xeae8('0x12'));var toCsv=require(_0xeae8('0xb'));var querystring=require(_0xeae8('0x13'));var Papa=require(_0xeae8('0x14'));var Redis=require(_0xeae8('0x15'));var authService=require(_0xeae8('0x16'));var qs=require(_0xeae8('0x17'));var as=require(_0xeae8('0x18'));var hardwareService=require(_0xeae8('0x19'));var logger=require(_0xeae8('0x1a'))(_0xeae8('0x1b'));var utils=require(_0xeae8('0x1c'));var config=require(_0xeae8('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0xeae8('0x1e'))['db'];config[_0xeae8('0x1f')]=_[_0xeae8('0x20')](config[_0xeae8('0x1f')],{'host':_0xeae8('0x21'),'port':0x18eb});var socket=require(_0xeae8('0x22'))(new Redis(config['redis']));require(_0xeae8('0x23'))[_0xeae8('0x24')](socket);function respondWithStatusCode(_0x3bf06a,_0x3c3787){_0x3c3787=_0x3c3787||0xcc;return function(_0xd5b943){if(_0xd5b943){return _0x3bf06a[_0xeae8('0x25')](_0x3c3787);}return _0x3bf06a[_0xeae8('0x26')](_0x3c3787)['end']();};}function respondWithResult(_0x2290d3,_0x3ac314){_0x3ac314=_0x3ac314||0xc8;return function(_0x3780e1){if(_0x3780e1){return _0x2290d3[_0xeae8('0x26')](_0x3ac314)[_0xeae8('0x27')](_0x3780e1);}};}function respondWithFilteredResult(_0x75d70b,_0xf7088f){return function(_0x5c53db){if(_0x5c53db){var _0x59931d=typeof _0xf7088f['offset']===_0xeae8('0x28')&&typeof _0xf7088f['limit']==='undefined';var _0x397695=_0x5c53db[_0xeae8('0x29')];var _0x25fe31=_0x59931d?0x0:_0xf7088f[_0xeae8('0x2a')];var _0x10bc44=_0x59931d?_0x5c53db[_0xeae8('0x29')]:_0xf7088f[_0xeae8('0x2a')]+_0xf7088f[_0xeae8('0x2b')];var _0x1c005f;if(_0x10bc44>=_0x397695){_0x10bc44=_0x397695;_0x1c005f=0xc8;}else{_0x1c005f=0xce;}_0x75d70b[_0xeae8('0x26')](_0x1c005f);return _0x75d70b[_0xeae8('0x2c')]('Content-Range',_0x25fe31+'-'+_0x10bc44+'/'+_0x397695)[_0xeae8('0x27')](_0x5c53db);}return null;};}function patchUpdates(_0x138dfe){return function(_0x364ada){try{jsonpatch['apply'](_0x364ada,_0x138dfe,!![]);}catch(_0x48af01){return BPromise[_0xeae8('0x2d')](_0x48af01);}return _0x364ada[_0xeae8('0x2e')]();};}function saveUpdates(_0x41e418,_0x447956){return function(_0x333de6){if(_0x333de6){return _0x333de6[_0xeae8('0x2f')](_0x41e418)[_0xeae8('0x30')](function(_0x93c8e1){return _0x93c8e1;});}return null;};}function removeEntity(_0x303a7a,_0x290ff4){return function(_0x2c0f38){if(_0x2c0f38){return _0x2c0f38[_0xeae8('0x31')]()['then'](function(){_0x303a7a[_0xeae8('0x26')](0xcc)[_0xeae8('0x32')]();});}};}function handleEntityNotFound(_0xac5c3e,_0x159b66){return function(_0x3e8c45){if(!_0x3e8c45){_0xac5c3e[_0xeae8('0x25')](0x194);}return _0x3e8c45;};}function handleError(_0x1388a7,_0x54ff77){_0x54ff77=_0x54ff77||0x1f4;return function(_0x163f0e){logger['error'](_0x163f0e[_0xeae8('0x33')]);if(_0x163f0e[_0xeae8('0x34')]){delete _0x163f0e[_0xeae8('0x34')];}_0x1388a7[_0xeae8('0x26')](_0x54ff77)[_0xeae8('0x35')](_0x163f0e);};}exports[_0xeae8('0x36')]=function(_0x4237c9,_0x3955a1){var _0x360657={},_0x265830={},_0x218012={'count':0x0,'rows':[]};var _0x3ee4ab=_['map'](db[_0xeae8('0x37')][_0xeae8('0x38')],function(_0x325e17){return{'name':_0x325e17[_0xeae8('0x39')],'type':_0x325e17[_0xeae8('0x3a')][_0xeae8('0x3b')]};});_0x265830[_0xeae8('0x3c')]=_['map'](_0x3ee4ab,_0xeae8('0x34'));_0x265830[_0xeae8('0x3d')]=_[_0xeae8('0x3e')](_0x4237c9[_0xeae8('0x3d')]);_0x265830[_0xeae8('0x3f')]=_[_0xeae8('0x40')](_0x265830['model'],_0x265830[_0xeae8('0x3d')]);_0x360657['attributes']=_[_0xeae8('0x40')](_0x265830['model'],qs['fields'](_0x4237c9[_0xeae8('0x3d')][_0xeae8('0x41')]));_0x360657['attributes']=_0x360657['attributes']['length']?_0x360657[_0xeae8('0x42')]:_0x265830[_0xeae8('0x3c')];if(!_0x4237c9['query'][_0xeae8('0x43')](_0xeae8('0x44'))){_0x360657[_0xeae8('0x2b')]=qs[_0xeae8('0x2b')](_0x4237c9['query'][_0xeae8('0x2b')]);_0x360657[_0xeae8('0x2a')]=qs[_0xeae8('0x2a')](_0x4237c9['query'][_0xeae8('0x2a')]);}_0x360657[_0xeae8('0x45')]=qs['sort'](_0x4237c9['query'][_0xeae8('0x46')]);_0x360657[_0xeae8('0x47')]=qs[_0xeae8('0x3f')](_[_0xeae8('0x48')](_0x4237c9[_0xeae8('0x3d')],_0x265830[_0xeae8('0x3f')]),_0x3ee4ab);if(_0x4237c9[_0xeae8('0x3d')][_0xeae8('0x49')]){_0x360657['where']=_[_0xeae8('0x4a')](_0x360657[_0xeae8('0x47')],{'$or':_[_0xeae8('0x4b')](_0x3ee4ab,function(_0x1f2981){if(_0x1f2981[_0xeae8('0x3a')]!==_0xeae8('0x4c')){var _0x343317={};_0x343317[_0x1f2981[_0xeae8('0x34')]]={'$like':'%'+_0x4237c9[_0xeae8('0x3d')][_0xeae8('0x49')]+'%'};return _0x343317;}})});}_0x360657=_['merge']({},_0x360657,_0x4237c9[_0xeae8('0x4d')]);var _0x10843a={'where':_0x360657[_0xeae8('0x47')]};return db[_0xeae8('0x37')]['count'](_0x10843a)[_0xeae8('0x30')](function(_0x1c9f47){_0x218012[_0xeae8('0x29')]=_0x1c9f47;if(_0x4237c9[_0xeae8('0x3d')]['includeAll']){_0x360657[_0xeae8('0x4e')]=[{'all':!![]}];}return db[_0xeae8('0x37')][_0xeae8('0x4f')](_0x360657);})[_0xeae8('0x30')](function(_0x1564f7){_0x218012[_0xeae8('0x50')]=_0x1564f7;return _0x218012;})[_0xeae8('0x30')](respondWithFilteredResult(_0x3955a1,_0x360657))[_0xeae8('0x51')](handleError(_0x3955a1,null));};exports[_0xeae8('0x52')]=function(_0x948c83,_0x59e4b6){var _0x55cf2a={'raw':![],'where':{'id':_0x948c83[_0xeae8('0x53')]['id']}},_0x40bceb={};_0x40bceb['model']=_[_0xeae8('0x3e')](db['UserProfile'][_0xeae8('0x38')]);_0x40bceb[_0xeae8('0x3d')]=_[_0xeae8('0x3e')](_0x948c83[_0xeae8('0x3d')]);_0x40bceb[_0xeae8('0x3f')]=_[_0xeae8('0x40')](_0x40bceb[_0xeae8('0x3c')],_0x40bceb[_0xeae8('0x3d')]);_0x55cf2a[_0xeae8('0x42')]=_['intersection'](_0x40bceb[_0xeae8('0x3c')],qs['fields'](_0x948c83[_0xeae8('0x3d')][_0xeae8('0x41')]));_0x55cf2a[_0xeae8('0x42')]=_0x55cf2a['attributes'][_0xeae8('0x54')]?_0x55cf2a[_0xeae8('0x42')]:_0x40bceb['model'];if(_0x948c83[_0xeae8('0x3d')][_0xeae8('0x55')]){_0x55cf2a[_0xeae8('0x4e')]=[{'all':!![]}];}_0x55cf2a=_[_0xeae8('0x4a')]({},_0x55cf2a,_0x948c83['options']);return db[_0xeae8('0x37')][_0xeae8('0x56')](_0x55cf2a)[_0xeae8('0x30')](handleEntityNotFound(_0x59e4b6,null))[_0xeae8('0x30')](respondWithResult(_0x59e4b6,null))[_0xeae8('0x51')](handleError(_0x59e4b6,null));};exports[_0xeae8('0x57')]=function(_0x2c0c35,_0x34b710){return db['UserProfile']['create'](_0x2c0c35[_0xeae8('0x58')],{})[_0xeae8('0x30')](respondWithResult(_0x34b710,0xc9))[_0xeae8('0x51')](handleError(_0x34b710,null));};exports['clone']=function(_0x4508ed,_0x213b55){var _0x46d7a0={'where':{'id':_0x4508ed[_0xeae8('0x53')]['id']}},_0x40d590={};_0x40d590[_0xeae8('0x3c')]=_['keys'](db[_0xeae8('0x37')][_0xeae8('0x38')]);_0x46d7a0['attributes']=_['intersection'](_0x40d590[_0xeae8('0x3c')],qs['fields'](_0x4508ed['query'][_0xeae8('0x41')]));_0x46d7a0['attributes']=_0x46d7a0[_0xeae8('0x42')][_0xeae8('0x54')]?_0x46d7a0[_0xeae8('0x42')]:_0x40d590[_0xeae8('0x3c')];if(_0x4508ed['query']['includeAll']){_0x46d7a0[_0xeae8('0x4e')]=[{'all':!![]}];}_0x46d7a0=_['merge']({},_0x46d7a0,_0x4508ed[_0xeae8('0x4d')]);return db[_0xeae8('0x37')]['find'](_0x46d7a0)[_0xeae8('0x30')](handleEntityNotFound(_0x213b55,null))[_0xeae8('0x30')](function(_0x4c01d4){if(_0x4c01d4){var _0x1d8284=_0x4c01d4[_0xeae8('0x59')]({'plain':!![]});_0x1d8284=qs['omit'](_0x1d8284,['id','createdAt',_0xeae8('0x5a'),_0xeae8('0x5b')]);_0x4508ed[_0xeae8('0x58')]=_[_0xeae8('0x5c')](_0x4508ed[_0xeae8('0x58')],['id',_0xeae8('0x5d'),_0xeae8('0x5a')]);return db['sequelize'][_0xeae8('0x5e')](function(_0x460c34){return db[_0xeae8('0x37')][_0xeae8('0x57')](_[_0xeae8('0x4a')](_0x1d8284,_0x4508ed[_0xeae8('0x58')]),{'include':_0x4508ed[_0xeae8('0x3d')][_0xeae8('0x55')]?[{'all':!![]}]:undefined,'transaction':_0x460c34})['then'](function(_0x12f1e6){var _0x1a4299=_0x12f1e6[_0xeae8('0x59')]({'plain':!![]});return db[_0xeae8('0x5f')]['findAll']({'where':{'userProfileId':_0x4508ed[_0xeae8('0x53')]['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x1c6989){if(_0x1c6989){return BPromise[_0xeae8('0x60')](_0x1c6989,function(_0x3da746){return new BPromise(function(_0x4ddd15,_0x30bc45){if(_0x3da746['autoAssociation']===null||_0x3da746[_0xeae8('0x61')]===0x1)_0x4ddd15(null);return db[_0xeae8('0x62')][_0xeae8('0x4f')]({'where':{'sectionId':_0x3da746['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x6bf317){var _0x403e89=_[_0xeae8('0x4b')](_0x6bf317,function(_0x2163b3){return qs[_0xeae8('0x5c')](_0x2163b3,['id','createdAt',_0xeae8('0x5a'),_0xeae8('0x63')]);});_0x4ddd15(_0x403e89);})[_0xeae8('0x51')](function(_0x56f0f4){_0x30bc45(_0x56f0f4);});})[_0xeae8('0x30')](function(_0x3e6ad1){var _0x18c778=qs['omit'](_0x3da746,['id',_0xeae8('0x5d'),_0xeae8('0x5a')]);_0x18c778[_0xeae8('0x64')]=_0x1a4299['id'];if(_0x3e6ad1)_0x18c778[_0xeae8('0x65')]=_0x3e6ad1;return _0x18c778;})[_0xeae8('0x30')](function(_0x23db7a){return db['UserProfileSection'][_0xeae8('0x57')](_0x23db7a,{'include':[{'model':db[_0xeae8('0x62')],'as':_0xeae8('0x65')}],'raw':!![],'transaction':_0x460c34});});})['then'](function(){return _0x1a4299;});}});});});}})[_0xeae8('0x30')](respondWithResult(_0x213b55,0xc9))['catch'](handleError(_0x213b55,null));};exports['update']=function(_0x22b9d6,_0x123ada){if(_0x22b9d6[_0xeae8('0x58')]['id']){delete _0x22b9d6[_0xeae8('0x58')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x22b9d6[_0xeae8('0x53')]['id']}})['then'](handleEntityNotFound(_0x123ada,null))['then'](saveUpdates(_0x22b9d6[_0xeae8('0x58')],null))[_0xeae8('0x30')](respondWithResult(_0x123ada,null))['catch'](handleError(_0x123ada,null));};exports[_0xeae8('0x31')]=function(_0x1173d4,_0x5ed2e5){return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x1173d4[_0xeae8('0x53')]['id']}})['then'](handleEntityNotFound(_0x5ed2e5,null))[_0xeae8('0x30')](removeEntity(_0x5ed2e5,null))[_0xeae8('0x51')](handleError(_0x5ed2e5,null));};exports[_0xeae8('0x66')]=function(_0x20107f,_0x5722ce){return db[_0xeae8('0x37')][_0xeae8('0x66')]()[_0xeae8('0x30')](respondWithResult(_0x5722ce,null))[_0xeae8('0x51')](handleError(_0x5722ce,null));};exports[_0xeae8('0x67')]=function(_0x55c5f5,_0x705e9d){var _0x55ab38=_0x55c5f5[_0xeae8('0x58')];return db['UserProfile'][_0xeae8('0x56')]({'where':{'id':_0x55c5f5[_0xeae8('0x53')]['id']}})[_0xeae8('0x30')](handleEntityNotFound(_0x705e9d,null))[_0xeae8('0x30')](function(_0x2e7991){if(_0x2e7991){return db[_0xeae8('0x68')][_0xeae8('0x5e')](function(_0x490036){return db[_0xeae8('0x5f')][_0xeae8('0x31')]({'where':{'userProfileId':_0x55c5f5[_0xeae8('0x53')]['id'],'sectionId':_[_0xeae8('0x4b')](_0x55ab38,function(_0x3cac2d){return _0x3cac2d[_0xeae8('0x63')];})},'transaction':_0x490036})[_0xeae8('0x30')](function(){var _0x3668cd=_[_0xeae8('0x4b')](_0x55ab38,function(_0x775b22){_0x775b22[_0xeae8('0x64')]=_0x55c5f5[_0xeae8('0x53')]['id'];return _0x775b22;});var _0x18f1bb=[];return BPromise[_0xeae8('0x60')](_0x3668cd,function(_0x4c0690){return db['UserProfileSection'][_0xeae8('0x57')](_0x4c0690,{'include':[{'model':db[_0xeae8('0x62')],'as':_0xeae8('0x65')}],'raw':!![],'transaction':_0x490036})['then'](function(_0x1752ce){_0x18f1bb[_0xeae8('0x69')](_0x1752ce[_0xeae8('0x59')]({'plain':!![]}));});})[_0xeae8('0x30')](function(){return _0x18f1bb;});});});}})[_0xeae8('0x30')](function(_0x2e2aad){return _0x2e2aad;})[_0xeae8('0x30')](respondWithResult(_0x705e9d,null))['catch'](handleError(_0x705e9d,null));};exports['removeSections']=function(_0x365dfa,_0x2e6130){var _0x13ab33;return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x365dfa[_0xeae8('0x53')]['id']},'attributes':['id','name']})[_0xeae8('0x30')](handleEntityNotFound(_0x2e6130,null))[_0xeae8('0x30')](function(_0x1db18f){if(_0x1db18f){_0x13ab33=_0x1db18f;return db[_0xeae8('0x5f')][_0xeae8('0x31')]({'where':{'userProfileId':_0x365dfa[_0xeae8('0x53')]['id'],'sectionId':_0x365dfa['query'][_0xeae8('0x6a')]}});}})[_0xeae8('0x30')](function(){return _0x13ab33;})[_0xeae8('0x30')](respondWithStatusCode(_0x2e6130,null))[_0xeae8('0x51')](handleError(_0x2e6130,null));};exports['getSections']=function(_0x458a76,_0xf1c6bd){var _0x559023=[];var _0x460ae5=[];return db[_0xeae8('0x5f')][_0xeae8('0x4f')]({'where':{'userProfileId':_0x458a76[_0xeae8('0x53')]['id']},'raw':!![]})['then'](function(_0x7d3cb2){_0x559023=_[_0xeae8('0x49')](_0x7d3cb2,function(_0x59da9e){return _0x59da9e[_0xeae8('0x6b')]===0x1||_['includes']([0x3eb,0x709],_0x59da9e[_0xeae8('0x63')]);});if(!_[_0xeae8('0x6c')](_0x559023)){return _['map'](_0x559023,function(_0x1bfc3a){return _0x1bfc3a[_0xeae8('0x63')];});}else{return;}})[_0xeae8('0x30')](function(_0x572244){if(_0x572244)_0x460ae5=_0x572244;if(_[_0xeae8('0x6d')](_0x460ae5,0x64)){var _0x28bdbb=_[_0xeae8('0x56')](_0x559023,{'sectionId':0x64});return hasDefaultDashboard(_0x28bdbb)[_0xeae8('0x30')](function(_0x1d7b7c){return _[_0xeae8('0x4b')](_0x559023,function(_0x5d2ae2){if(_0x5d2ae2[_0xeae8('0x63')]===0x64){_0x5d2ae2['subsections']=_0x1d7b7c;}return _0x5d2ae2;});});}else{return;}})[_0xeae8('0x30')](function(_0x5d1766){if(_0x5d1766)_0x559023=_0x5d1766;if(_[_0xeae8('0x6d')](_0x460ae5,0x3eb)){var _0x4dc0b6=_[_0xeae8('0x56')](_0x559023,{'sectionId':0x3eb});return getCustomDashboards(_0x4dc0b6)[_0xeae8('0x30')](function(_0x27317b){return _[_0xeae8('0x4b')](_0x559023,function(_0x4b0a11){if(_0x4dc0b6['enabled']){if(_0x4b0a11['sectionId']===0x3eb){_0x4b0a11[_0xeae8('0x6e')]=_0x27317b;}}else{if(_0x4b0a11[_0xeae8('0x63')]===0x64){_0x4b0a11['subsections']=_0x27317b;}}return _0x4b0a11;});});}else{return;}})[_0xeae8('0x30')](function(_0x3d2d2a){if(_0x3d2d2a)_0x559023=_0x3d2d2a;if(_['includes'](_0x460ae5,0x709)){var _0x27a398=_[_0xeae8('0x56')](_0x559023,{'sectionId':0x709});return getPlugins(_0x27a398)['then'](function(_0x4fb7a1){if(_0x27a398[_0xeae8('0x6b')]){return _[_0xeae8('0x4b')](_0x559023,function(_0x59c266){if(_0x59c266[_0xeae8('0x63')]===0x709){_0x59c266[_0xeae8('0x6e')]=_0x4fb7a1;}return _0x59c266;});}else{var _0x4f2dbb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4fb7a1};var _0x45bee4=_[_0xeae8('0x4b')](_0x559023);_0x45bee4[_0xeae8('0x69')](_0x4f2dbb);return _0x45bee4;}});}else{return;}})[_0xeae8('0x30')](function(_0x233e89){if(_0x233e89)_0x559023=_0x233e89;return _[_0xeae8('0x49')](_0x559023,[_0xeae8('0x6b'),0x1]);})[_0xeae8('0x30')](respondWithResult(_0xf1c6bd,null))[_0xeae8('0x51')](handleError(_0xf1c6bd,null));};function hasDefaultDashboard(_0x63afe9){var _0x3bd9fb=[0x65];return new BPromise(function(_0x260014,_0x22cc41){try{if(_0x63afe9[_0xeae8('0x61')]){_0x260014(_0x3bd9fb);}else{return db['UserProfileResource'][_0xeae8('0x6f')]({'where':{'sectionId':_0x63afe9['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x3cd292){_0x3cd292?_0x260014(_0x3bd9fb):_0x260014();});}}catch(_0x4134fa){_0x22cc41(_0x4134fa);}});}function getCustomDashboards(_0x4f052f){var _0x1bc707=[];return new BPromise(function(_0x5cb731,_0x330f86){try{if(_0x4f052f[_0xeae8('0x61')]){return db['Dashboard'][_0xeae8('0x4f')]({'raw':!![]})[_0xeae8('0x30')](function(_0xb3efdb){_0xb3efdb[_0xeae8('0x70')](function(_0x36a2f4){_0x1bc707[_0xeae8('0x69')](_0x36a2f4['id']+0x1869f);});_0x5cb731(_0x1bc707);});}else{return db['UserProfileResource'][_0xeae8('0x4f')]({'where':{'sectionId':_0x4f052f['id']},'raw':!![]})[_0xeae8('0x30')](function(_0x15ac76){_0x15ac76[_0xeae8('0x70')](function(_0x366f29){_0x1bc707[_0xeae8('0x69')](_0x366f29[_0xeae8('0x71')]+0x1869f);});_0x5cb731(_0x1bc707);});}}catch(_0x5efa33){_0x330f86(_0x5efa33);}});}function getPlugins(_0xdb988f){var _0x263c50=[];return new BPromise(function(_0x3d4df5,_0x1eddd9){try{if(_0xdb988f[_0xeae8('0x61')]){return db['Plugin'][_0xeae8('0x4f')]({'raw':!![]})[_0xeae8('0x30')](function(_0x21eb4e){_0x21eb4e[_0xeae8('0x70')](function(_0x1d89ef){_0x263c50[_0xeae8('0x69')](_0x1d89ef['id']+0x15b38);});_0x3d4df5(_0x263c50);});}else{return db[_0xeae8('0x62')][_0xeae8('0x4f')]({'where':{'sectionId':_0xdb988f['id']},'raw':!![]})[_0xeae8('0x30')](function(_0xfbc5ca){_0xfbc5ca[_0xeae8('0x70')](function(_0x28d37a){_0x263c50[_0xeae8('0x69')](_0x28d37a[_0xeae8('0x71')]+0x15b38);});_0x3d4df5(_0x263c50);});}}catch(_0x1b6305){_0x1eddd9(_0x1b6305);}});}exports[_0xeae8('0x72')]=function(_0xa2a9dc,_0x5b5deb){return db[_0xeae8('0x37')]['find']({'where':{'id':_0xa2a9dc['params']['id']}})[_0xeae8('0x30')](handleEntityNotFound(_0x5b5deb,null))[_0xeae8('0x30')](function(_0x147de4){if(_0x147de4){return db[_0xeae8('0x68')][_0xeae8('0x5e')](function(_0x3d2ed2){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xa2a9dc[_0xeae8('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0xeae8('0x30')](function(_0x17614b){if(_0x17614b){return db[_0xeae8('0x5f')][_0xeae8('0x31')]({'where':{'userProfileId':_0xa2a9dc[_0xeae8('0x53')]['id'],'id':_[_0xeae8('0x4b')](_0x17614b,function(_0x5c2002){return _0x5c2002['id'];})},'transaction':_0x3d2ed2});}})['then'](function(_0xf6aa2d){var _0xa15897=_[_0xeae8('0x4b')](_0xa2a9dc[_0xeae8('0x58')],function(_0x21f488){_0x21f488[_0xeae8('0x64')]=_0xa2a9dc[_0xeae8('0x53')]['id'];return _0x21f488;});return db['UserProfileSection'][_0xeae8('0x73')](_0xa15897,{'raw':!![],'transaction':_0x3d2ed2});})[_0xeae8('0x30')](function(_0x5815c6){var _0x7386a9=_[_0xeae8('0x49')](_[_0xeae8('0x4b')](_0x5815c6,function(_0x36f6d1){return _0x36f6d1[_0xeae8('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x7386a9){return db[_0xeae8('0x5f')][_0xeae8('0x4f')]({'where':{'userProfileId':_0xa2a9dc[_0xeae8('0x53')]['id'],'sectionId':_[_0xeae8('0x4b')](_0x7386a9,function(_0x318368){return _0x318368[_0xeae8('0x63')];})},'attributes':['id',_0xeae8('0x63')],'raw':!![]})['then'](function(_0x6bd067){var _0x4bbeb4=_[_0xeae8('0x4b')](_0xa2a9dc[_0xeae8('0x58')],function(_0x1c8a8d){_0x1c8a8d[_0xeae8('0x64')]=_0xa2a9dc[_0xeae8('0x53')]['id'];return _0x1c8a8d;});return db[_0xeae8('0x62')]['bulkCreate'](_0x4bbeb4,{'raw':!![],'transaction':_0x3d2ed2});});}})[_0xeae8('0x51')](handleError(_0x5b5deb,null));});}})[_0xeae8('0x30')](function(_0x206dc9){var _0x28361f=_[_0xeae8('0x4b')](_0x206dc9,function(_0x368e0d){return _0x368e0d[_0xeae8('0x59')]({'plain':!![]});});})[_0xeae8('0x30')](respondWithResult(_0x5b5deb,null))[_0xeae8('0x51')](handleError(_0x5b5deb,null));};exports[_0xeae8('0x74')]=function(_0x4e7fcc,_0x5f5144,_0x3dfb7d){return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x4e7fcc[_0xeae8('0x53')]['id']}})[_0xeae8('0x30')](handleEntityNotFound(_0x5f5144,null))['then'](function(_0x4d5a2c){if(_0x4d5a2c){return _0x4d5a2c[_0xeae8('0x74')](_0x4e7fcc[_0xeae8('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x5f5144,null))['catch'](handleError(_0x5f5144,null));};exports['getResources']=function(_0x1ebc1c,_0x17db20){var _0x8bc288={};if(!_0x1ebc1c[_0xeae8('0x3d')][_0xeae8('0x75')])throw new Error(_0xeae8('0x76'));if(!_0x1ebc1c['query'][_0xeae8('0x43')](_0xeae8('0x44'))){_0x8bc288[_0xeae8('0x2b')]=qs[_0xeae8('0x2b')](_0x1ebc1c[_0xeae8('0x3d')]['limit']);_0x8bc288[_0xeae8('0x2a')]=qs['offset'](_0x1ebc1c[_0xeae8('0x3d')][_0xeae8('0x2a')]);}return db[_0xeae8('0x37')][_0xeae8('0x56')]({'where':{'id':_0x1ebc1c[_0xeae8('0x53')]['id']}})[_0xeae8('0x30')](function(_0x2097a1){if(!_0x2097a1)throw new Error(_0xeae8('0x77')+_0x1ebc1c[_0xeae8('0x53')]['id']);return db[_0xeae8('0x37')][_0xeae8('0x78')](_0x1ebc1c);})[_0xeae8('0x30')](respondWithFilteredResult(_0x17db20,_0x8bc288))[_0xeae8('0x51')](handleError(_0x17db20,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index ca8a0c0..d93043b 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 _0x27a0=['hook','exports','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4b69ea,_0x2d1c6f){var _0x2f4945=function(_0x58c6ca){while(--_0x58c6ca){_0x4b69ea['push'](_0x4b69ea['shift']());}};_0x2f4945(++_0x2d1c6f);}(_0x27a0,0xbf));var _0x027a=function(_0x51bf5b,_0x332bd0){_0x51bf5b=_0x51bf5b-0x0;var _0x479322=_0x27a0[_0x51bf5b];return _0x479322;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x027a('0x0'))['db'][_0x027a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x027a('0x2')](0x0);var events={'afterCreate':_0x027a('0x3'),'afterUpdate':_0x027a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58a58b){return function(_0x4e8d6b,_0x47cd65,_0x30a54d){UserProfileEvents[_0x027a('0x5')](_0x58a58b+':'+_0x4e8d6b['id'],_0x4e8d6b);UserProfileEvents[_0x027a('0x5')](_0x58a58b,_0x4e8d6b);_0x30a54d(null);};}for(var e in events){if(events[_0x027a('0x6')](e)){var event=events[e];UserProfile[_0x027a('0x7')](e,emitEvent(event));}}module[_0x027a('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x11f3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','save'];(function(_0x44aa58,_0x211ecd){var _0x43e9cf=function(_0x3fb357){while(--_0x3fb357){_0x44aa58['push'](_0x44aa58['shift']());}};_0x43e9cf(++_0x211ecd);}(_0x11f3,0x149));var _0x311f=function(_0x13f638,_0x3dd3a4){_0x13f638=_0x13f638-0x0;var _0x500f5d=_0x11f3[_0x13f638];return _0x500f5d;};'use strict';var EventEmitter=require(_0x311f('0x0'));var UserProfile=require(_0x311f('0x1'))['db'][_0x311f('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x311f('0x3'),'afterUpdate':'update','afterDestroy':_0x311f('0x4')};function emitEvent(_0x3f8433){return function(_0x14ae97,_0x5efe46,_0x5cb8aa){UserProfileEvents[_0x311f('0x5')](_0x3f8433+':'+_0x14ae97['id'],_0x14ae97);UserProfileEvents['emit'](_0x3f8433,_0x14ae97);_0x5cb8aa(null);};}for(var e in events){if(events[_0x311f('0x6')](e)){var event=events[e];UserProfile[_0x311f('0x7')](e,emitEvent(event));}}module[_0x311f('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fab1531..d31c4a0 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 _0x43c3=['pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','Trunk','variables','Variable','Reports','metrics','AnalyticMetric','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','all','ignore','isEmpty','autoAssociation','model','rawAttributes','keys','intersection','fields','attributes','limit','offset','order','sort','filters','pick','key','VIRTUAL','foreignKey','merge','options','includeAll','forEach','reportType','default','DefaultReports','reportId','CustomReports','count','include','Tag','Tags','color','tag','rows','openTabs','true','chat','dataValues','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','odbc','SquareRecording','projectName','JscriptyProject','CmContact','parentSections','Lists','lists','CmList','companies','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','voicequeues','queuecampaigns','users','agents','telephones','admin','user','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','dispositions','Disposition','customdashboards','Dashboard'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x43c3,0x1b9));var _0x343c=function(_0x53d1f5,_0x60628a){_0x53d1f5=_0x53d1f5-0x0;var _0x5a5acf=_0x43c3[_0x53d1f5];return _0x5a5acf;};'use strict';var _=require(_0x343c('0x0'));var attributes=require(_0x343c('0x1'));var qs=require(_0x343c('0x2'));var squel=require(_0x343c('0x3'));module['exports']=function(_0xe831ce){var _0x47b9d7=_0xe831ce['models'];function _0x375900(_0x252536,_0x1c5819){return new Promise(function(_0x483d3b,_0x5e9e4a){if(!_0x1c5819)return _0x483d3b(null);var _0x2db278=_0x1c5819[_0x343c('0x4')]?{[_0x1c5819['filter'][_0x343c('0x5')]]:_0x1c5819[_0x343c('0x4')][_0x343c('0x6')]}:undefined;return _0x47b9d7[_0x252536][_0x343c('0x7')]({'where':_0x2db278,'raw':!![]})[_0x343c('0x8')](function(_0x1dd3d0){_0x1c5819[_0x343c('0x9')]=_[_0x343c('0xa')](_0x1dd3d0,'id');_0x483d3b(_0x1c5819);})[_0x343c('0xb')](function(_0x206c27){_0x5e9e4a(_0x206c27);});});}function _0x43b72d(_0x73866a,_0x425b38){return new Promise(function(_0x8ba9ab,_0x3cda83){var _0x125cfb=_0x73866a[_0x343c('0x4')]?{[_0x73866a[_0x343c('0x4')][_0x343c('0x5')]]:_0x73866a[_0x343c('0x4')][_0x343c('0x6')]}:undefined;return _0x47b9d7[_0x73866a['model']][_0x343c('0x7')]({'where':_0x125cfb,'raw':!![]})['then'](function(_0x26b768){_0x425b38[_0x343c('0x9')]=_[_0x343c('0xa')](_0x26b768,function(_0x17053e){return _0x17053e[_0x343c('0xc')];});_0x8ba9ab(_0x425b38);})['catch'](function(_0x11d5a6){_0x3cda83(_0x11d5a6);});});}function _0x7e096c(_0x5c5212,_0xd39748,_0x1d0ba3){if(!_0xd39748)return Promise[_0x343c('0xd')](null);return new Promise(function(_0xe80830,_0xa5da4a){return _0x47b9d7['UserProfileResource'][_0x343c('0x7')]({'where':{'sectionId':_0xd39748['id']},'raw':!![]})[_0x343c('0x8')](function(_0x305a27){if(_0x5c5212[_0x343c('0x5')]&&_0x5c5212[_0x343c('0x5')]!=='id'){_0xd39748[_0x343c('0x9')]=_[_0x343c('0xa')](_0x305a27,function(_0xa5f135){return _0xa5f135[_0x5c5212[_0x343c('0x5')]];});}else{if(_0x1d0ba3===_0x343c('0xe')){_0xd39748[_0x343c('0x9')]=_['map'](_0x305a27,function(_0x50baf4){return{'id':_0x50baf4[_0x343c('0xf')],'type':_0x50baf4[_0x343c('0x10')]};});}else{_0xd39748['associatedResources']=_[_0x343c('0xa')](_0x305a27,function(_0x525937){return _0x525937[_0x343c('0xf')];});}}_0xe80830(_0xd39748);})[_0x343c('0xb')](function(_0x1827e2){_0xa5da4a(_0x1827e2);});});}function _0x2583e9(_0x458f89,_0x37c123){var _0x20056f={'parentSections':[]};switch(_0x458f89['toLowerCase']()){case _0x343c('0x11'):_0x20056f[_0x343c('0x12')]='SquareProject';break;case _0x343c('0x13'):_0x20056f['childModel']='SquareOdbc';break;case'squarerecordings':_0x20056f[_0x343c('0x12')]=_0x343c('0x14');_0x20056f['parentSections']=[{'name':'SquareProjects','field':_0x343c('0xc'),'foreignKey':_0x343c('0x15')}];break;case'projects':_0x20056f['childModel']=_0x343c('0x16');break;case'contacts':_0x20056f[_0x343c('0x12')]=_0x343c('0x17');_0x20056f[_0x343c('0x18')]=[{'name':_0x343c('0x19'),'field':'id','foreignKey':'ListId'}];break;case _0x343c('0x1a'):_0x20056f[_0x343c('0x12')]=_0x343c('0x1b');break;case _0x343c('0x1c'):_0x20056f[_0x343c('0x12')]='CmCompany';break;case'globalcustomfields':_0x20056f[_0x343c('0x12')]='CmCustomField';break;case _0x343c('0x1d'):_0x20056f[_0x343c('0x12')]=_0x343c('0x1e');break;case _0x343c('0x1f'):_0x20056f[_0x343c('0x12')]=_0x343c('0x20');break;case _0x343c('0x21'):_0x20056f[_0x343c('0x12')]=_0x343c('0x22');break;case _0x343c('0x23'):_0x20056f[_0x343c('0x12')]=_0x343c('0x24');break;case _0x343c('0x25'):case'internalroutes':case _0x343c('0x26'):_0x20056f[_0x343c('0x12')]=_0x343c('0x27');break;case _0x343c('0x28'):_0x20056f[_0x343c('0x12')]=_0x343c('0x29');break;case _0x343c('0x2a'):_0x20056f['childModel']='VoiceMail';break;case _0x343c('0x2b'):_0x20056f[_0x343c('0x12')]='VoiceRecording';_0x20056f[_0x343c('0x18')]=[{'name':_0x343c('0x2c'),'field':_0x343c('0xc'),'foreignKey':'membername','model':_0x343c('0x2d'),'filter':{'field':_0x343c('0x2e'),'value':[_0x343c('0x2f')]}},{'name':'Telephones','field':'name','foreignKey':_0x343c('0x30'),'model':_0x343c('0x2d'),'filter':{'field':_0x343c('0x2e'),'value':[_0x343c('0x31')]}},{'name':_0x343c('0x32'),'field':'name','foreignKey':_0x343c('0x33'),'model':_0x343c('0x34'),'filter':{'field':'type','value':['inbound']}},{'name':_0x343c('0x35'),'field':_0x343c('0xc'),'foreignKey':_0x343c('0x33'),'model':_0x343c('0x34'),'filter':{'field':_0x343c('0x10'),'value':['outbound']}}];break;case'musiconholds':_0x20056f[_0x343c('0x12')]=_0x343c('0x36');break;case _0x343c('0x37'):_0x20056f[_0x343c('0x12')]=_0x343c('0x38');break;case _0x343c('0x39'):_0x20056f[_0x343c('0x12')]=_0x343c('0x3a');break;case _0x343c('0x3b'):_0x20056f['childModel']='Campaign';break;case'mailqueues':_0x20056f[_0x343c('0x12')]=_0x343c('0x3c');break;case _0x343c('0x3d'):_0x20056f[_0x343c('0x12')]='MailAccount';break;case _0x343c('0x3e'):_0x20056f[_0x343c('0x12')]=_0x343c('0x3f');break;case'openchannelqueues':_0x20056f[_0x343c('0x12')]=_0x343c('0x40');break;case'openchannelaccounts':_0x20056f['childModel']=_0x343c('0x41');break;case _0x343c('0x42'):_0x20056f[_0x343c('0x12')]='SmsQueue';break;case _0x343c('0x43'):_0x20056f[_0x343c('0x12')]=_0x343c('0x44');break;case _0x343c('0x45'):_0x20056f[_0x343c('0x12')]=_0x343c('0x46');break;case _0x343c('0x47'):_0x20056f[_0x343c('0x12')]='WhatsappAccount';break;case _0x343c('0x48'):_0x20056f[_0x343c('0x12')]='Team';break;case _0x343c('0x49'):case _0x343c('0x4a'):_0x20056f[_0x343c('0x12')]=_0x343c('0x34');if(_0x37c123){_0x20056f[_0x343c('0x18')]=[{'name':_0x343c('0x32')},{'name':'QueueCampaigns'}];}break;case _0x343c('0x4b'):case _0x343c('0x4c'):case _0x343c('0x4d'):_0x20056f[_0x343c('0x12')]=_0x343c('0x2d');if(_0x37c123){_0x20056f[_0x343c('0x18')]=[{'name':'Users','filter':{'field':_0x343c('0x2e'),'value':[_0x343c('0x4e'),_0x343c('0x4f')]},'ignore':!![]},{'name':_0x343c('0x2c')},{'name':_0x343c('0x50')}];}break;case _0x343c('0x51'):_0x20056f[_0x343c('0x12')]='ZendeskAccount';break;case _0x343c('0x52'):_0x20056f[_0x343c('0x12')]=_0x343c('0x53');break;case'freshdeskaccounts':_0x20056f['childModel']=_0x343c('0x54');break;case _0x343c('0x55'):_0x20056f['childModel']=_0x343c('0x56');break;case _0x343c('0x57'):_0x20056f[_0x343c('0x12')]=_0x343c('0x58');break;case _0x343c('0x59'):_0x20056f['childModel']=_0x343c('0x5a');break;case _0x343c('0x5b'):_0x20056f[_0x343c('0x12')]=_0x343c('0x2d');break;case'cannedanswers':_0x20056f[_0x343c('0x12')]='CannedAnswer';break;case _0x343c('0x5c'):_0x20056f[_0x343c('0x12')]=_0x343c('0x5d');break;case _0x343c('0x5e'):_0x20056f[_0x343c('0x12')]=_0x343c('0x5f');break;case'intervals':_0x20056f[_0x343c('0x12')]='Interval';break;case _0x343c('0x60'):_0x20056f[_0x343c('0x12')]=_0x343c('0x61');break;case _0x343c('0x62'):_0x20056f[_0x343c('0x12')]='Schedule';break;case _0x343c('0x63'):_0x20056f[_0x343c('0x12')]=_0x343c('0x64');break;case _0x343c('0x65'):_0x20056f[_0x343c('0x12')]='Tag';break;case _0x343c('0x66'):_0x20056f['childModel']=_0x343c('0x67');break;case _0x343c('0x68'):_0x20056f[_0x343c('0x12')]=_0x343c('0x69');break;case'trunks':_0x20056f[_0x343c('0x12')]=_0x343c('0x6a');break;case _0x343c('0x6b'):_0x20056f[_0x343c('0x12')]=_0x343c('0x6c');break;case'plugins':_0x20056f['childModel']='Plugin';break;case'extractedreports':_0x20056f[_0x343c('0x12')]='AnalyticExtractedReport';_0x20056f[_0x343c('0x18')]=[{'name':_0x343c('0x6d'),'field':'id','foreignKey':'reportId'}];break;case _0x343c('0x6e'):_0x20056f[_0x343c('0x12')]=_0x343c('0x6f');break;}return _0x20056f;}function _0x651dc3(_0xb41127,_0x23304e){var _0x273433=_0xb41127['charAt'](0x0)[_0x343c('0x70')]()+_0xb41127[_0x343c('0x71')](0x1);var _0x47b6b4={'type':_0x47b9d7['Sequelize'][_0x343c('0x72')][_0x343c('0x73')],'raw':!![]};return new Promise(function(_0x8a7119,_0x2b575b){var _0x299fcc=squel['select']()[_0x343c('0x5')](_0x343c('0x74')+_0x273433+_0x343c('0x75'),'id')[_0x343c('0x5')](_0x343c('0x76'))[_0x343c('0x77')](_0x343c('0x78')+_0xb41127+_0x343c('0x79'),'ui')[_0x343c('0x7a')]('ui.UserId\x20=\x20?',_0x23304e['id']);return _0x47b9d7[_0x343c('0x7b')][_0x343c('0x7c')](_0x299fcc[_0x343c('0x7d')](),_0x47b6b4)[_0x343c('0x8')](function(_0xfa50de){_0x23304e[_0x273433+_0x343c('0x7e')]=_0xfa50de;_0x8a7119(_0xfa50de);})[_0x343c('0xb')](function(_0x1140b7){_0x2b575b(_0x1140b7);});});}return _0xe831ce[_0x343c('0x7f')](_0x343c('0x80'),attributes,{'tableName':_0x343c('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4efc70){var _0x384418={'raw':_0x4efc70[_0x343c('0x7c')]['raw'],'where':{}};var _0x3bd265={};var _0x1ee1d9={'count':0x0,'rows':[]};var _0xb48c23=_0x4efc70['query'][_0x343c('0x82')];var _0x2c2b93=_0x4efc70['query'][_0x343c('0x83')]||![];var _0x9cf299=_0x2583e9(_0xb48c23,_0x2c2b93);if(!_0x9cf299['childModel'])throw new Error(_0x343c('0x84')+_0xb48c23+'\x27');var _0x5a4b03=[{'name':_0xb48c23}];if(!_['isEmpty'](_0x9cf299[_0x343c('0x18')]))_0x5a4b03=_0x9cf299[_0x343c('0x18')];var _0x1ed9a8=[];for(var _0x3cabb6=0x0;_0x3cabb6<_0x5a4b03[_0x343c('0x85')];_0x3cabb6++){_0x1ed9a8[_0x343c('0x86')](_0x47b9d7['UserProfileSection'][_0x343c('0x87')]({'where':{'userProfileId':_0x4efc70[_0x343c('0x88')]['id'],'name':_0x5a4b03[_0x3cabb6][_0x343c('0xc')]},'raw':!![]}));}return Promise[_0x343c('0x89')](_0x1ed9a8)[_0x343c('0x8')](function(_0x4c30c3){var _0x2e8b30=_['filter'](_0x4c30c3,function(_0x4c7fe6){return _0x4c7fe6?_0x4c7fe6:undefined;});var _0x34cdd9=_[_0x343c('0x4')](_0x5a4b03,[_0x343c('0x8a'),!![]]);var _0x441a4a=_[_0x343c('0x8b')](_0x2e8b30)&&_[_0x343c('0x8b')](_0x34cdd9)?null:_['union'](_0x34cdd9,_0x2e8b30);if(!_0x441a4a)return null;var _0x286017=[];for(var _0x414308=0x0;_0x414308<_0x441a4a[_0x343c('0x85')];_0x414308++){var _0x4dd4e0=_[_0x343c('0x87')](_0x5a4b03,function(_0x258bcb){return _0x441a4a[_0x414308]?_0x258bcb[_0x343c('0xc')]===_0x441a4a[_0x414308][_0x343c('0xc')]:null;});if(_0x4dd4e0){if(_0x441a4a[_0x414308][_0x343c('0x8a')]){_0x286017[_0x343c('0x86')](_0x375900(_0x9cf299[_0x343c('0x12')],_0x441a4a[_0x414308]));}else{if(!_0x441a4a[_0x414308][_0x343c('0x8c')]){_0x286017[_0x343c('0x86')](_0x7e096c(_0x4dd4e0,_0x441a4a[_0x414308],_0x9cf299['childModel']));}else{if(_0x4dd4e0[_0x343c('0x8d')]){_0x286017[_0x343c('0x86')](_0x43b72d(_0x4dd4e0,_0x441a4a[_0x414308]));}}}}}return Promise[_0x343c('0x89')](_0x286017);})[_0x343c('0x8')](function(_0x529177){var _0x59eae6=_0x529177;var _0x5d16a2=null;if(_0x59eae6){_0x5d16a2=_0x59eae6[_0x343c('0x85')]===0x1?_0x59eae6[0x0]:null;}if(!_0x5d16a2&&!_0x59eae6)return _0x1ee1d9;var _0x2e1177=_0x47b9d7[_0x9cf299[_0x343c('0x12')]][_0x343c('0x8e')];_0x3bd265[_0x343c('0x8d')]=_['keys'](_0x2e1177);_0x3bd265[_0x343c('0x7c')]=_[_0x343c('0x8f')](_0x4efc70[_0x343c('0x7c')]);_0x3bd265['filters']=_[_0x343c('0x90')](_0x3bd265[_0x343c('0x8d')],_0x3bd265[_0x343c('0x7c')]);_0x384418['attributes']=_[_0x343c('0x90')](_0x3bd265['model'],qs[_0x343c('0x91')](_0x4efc70[_0x343c('0x7c')][_0x343c('0x91')]));_0x384418[_0x343c('0x92')]=_0x384418[_0x343c('0x92')][_0x343c('0x85')]?_0x384418['attributes']:_0x3bd265['model'];if(!_0x4efc70['query']['hasOwnProperty']('nolimit')){_0x384418[_0x343c('0x93')]=qs[_0x343c('0x93')](_0x4efc70[_0x343c('0x7c')][_0x343c('0x93')]);_0x384418[_0x343c('0x94')]=qs['offset'](_0x4efc70[_0x343c('0x7c')]['offset']);}_0x384418[_0x343c('0x95')]=qs['sort'](_0x4efc70['query'][_0x343c('0x96')]);_0x384418[_0x343c('0x7a')]=qs[_0x343c('0x97')](_[_0x343c('0x98')](_0x4efc70[_0x343c('0x7c')],_0x3bd265['filters']));if(_0x4efc70[_0x343c('0x7c')][_0x343c('0x4')]){_0x384418[_0x343c('0x7a')]=_['merge'](_0x384418[_0x343c('0x7a')],{'$or':_[_0x343c('0xa')](_0x2e1177,function(_0x167003){if(_0x167003[_0x343c('0x10')][_0x343c('0x99')]!==_0x343c('0x9a')){var _0x205734={};_0x205734[_0x167003[_0x343c('0x5')]]={'$like':'%'+_0x4efc70['query'][_0x343c('0x4')]+'%'};return _0x205734;}})});}var _0x20abbb=[];var _0x2888cb=null;var _0x2cce08={};if(_0x5d16a2){_0x2888cb=_['find'](_0x5a4b03,[_0x343c('0xc'),_0x5d16a2['name']]);if(_0x2888cb[_0x343c('0x5')]){_0x2cce08={};if(_0x9cf299[_0x343c('0x12')]===_0x343c('0xe')){_0x2cce08[_0x2888cb[_0x343c('0x9b')]]=_[_0x343c('0xa')](_0x5d16a2[_0x343c('0x9')],'id');}else{_0x2cce08[_0x2888cb[_0x343c('0x9b')]]=_0x5d16a2['associatedResources'];}_0x20abbb[_0x343c('0x86')](_0x2cce08);}else{_0x384418['where']['id']=_0x5d16a2['associatedResources'];}}else{for(var _0x1c853d=0x0;_0x1c853d<_0x59eae6['length'];_0x1c853d++){_0x2888cb=_['find'](_0x5a4b03,[_0x343c('0xc'),_0x59eae6[_0x1c853d][_0x343c('0xc')]]);if(_0x2888cb['field']){_0x2cce08={};_0x2cce08[_0x2888cb[_0x343c('0x9b')]]=_0x59eae6[_0x1c853d][_0x343c('0x9')];_0x20abbb[_0x343c('0x86')](_0x2cce08);}else{if(!_0x384418[_0x343c('0x7a')]['id'])_0x384418[_0x343c('0x7a')]['id']=[];_0x59eae6[_0x1c853d]['associatedResources']['forEach'](function(_0x4158c4){_0x384418[_0x343c('0x7a')]['id'][_0x343c('0x86')](_0x4158c4);});}}}if(!_[_0x343c('0x8b')](_0x20abbb)){_0x384418['where']=_[_0x343c('0x9c')](_0x384418[_0x343c('0x7a')],{'$and':{'$or':_0x20abbb}});}_0x384418=_[_0x343c('0x9c')]({},_0x384418,_0x4efc70[_0x343c('0x9d')]);if(_0x5d16a2&&!_0x5d16a2[_0x343c('0x8c')]&&_0x9cf299[_0x343c('0x12')]==='AnalyticExtractedReport'){if(_0x4efc70[_0x343c('0x7c')][_0x343c('0x9e')]){_0x384418['include']=[{'all':!![]}];}return _0x47b9d7[_0x9cf299[_0x343c('0x12')]][_0x343c('0x7')](_0x384418)[_0x343c('0x8')](function(_0x490b8){var _0x35c87d=[];_0x490b8[_0x343c('0x9f')](function(_0x408b3c){var _0x57f3a6;switch(_0x408b3c[_0x343c('0xa0')]){case _0x343c('0xa1'):_0x57f3a6=_[_0x343c('0x87')](_0x5d16a2[_0x343c('0x9')],function(_0xbabea6){return _0xbabea6['id']===_0x408b3c['reportId']&&_0xbabea6[_0x343c('0x10')]===_0x343c('0xa2');});break;case'custom':_0x57f3a6=_['find'](_0x5d16a2[_0x343c('0x9')],function(_0x4bd4f0){return _0x4bd4f0['id']===_0x408b3c[_0x343c('0xa3')]&&_0x4bd4f0[_0x343c('0x10')]===_0x343c('0xa4');});break;}if(_0x57f3a6)_0x35c87d[_0x343c('0x86')](_0x408b3c);});_0x1ee1d9['count']=_0x35c87d['length'];_0x1ee1d9['rows']=_0x35c87d;return _0x1ee1d9;});}else{return _0x47b9d7[_0x9cf299[_0x343c('0x12')]][_0x343c('0xa5')]({'where':_0x384418['where']})[_0x343c('0x8')](function(_0x4b7939){_0x1ee1d9[_0x343c('0xa5')]=_0x4b7939;if(_0x4efc70[_0x343c('0x7c')][_0x343c('0x9e')]){if(_0x9cf299['childModel']==='CmContact'){_0x384418[_0x343c('0xa6')]=[{'model':_0x47b9d7[_0x343c('0xa7')],'as':_0x343c('0xa8'),'attributes':['id',_0x343c('0xc'),'color'],'required':_0x4efc70[_0x343c('0x7c')]['tag']?!![]:![]},{'model':_0x47b9d7[_0x343c('0xa7')],'as':'ThroughTags','attributes':['id',_0x343c('0xc'),_0x343c('0xa9')],'through':_0x4efc70[_0x343c('0x7c')][_0x343c('0xaa')]?{'attributes':[],'where':{'TagId':_0x4efc70[_0x343c('0x7c')][_0x343c('0xaa')]||undefined}}:{},'required':_0x4efc70[_0x343c('0x7c')][_0x343c('0xaa')]?!![]:![]}];}else{_0x384418[_0x343c('0xa6')]=[{'all':!![]}];}}return _0x47b9d7[_0x9cf299[_0x343c('0x12')]][_0x343c('0x7')](_0x384418);})['then'](function(_0x307080){_0x1ee1d9[_0x343c('0xab')]=_0x307080;if(_0xb48c23==='Agents'&&_0x4efc70[_0x343c('0x7c')][_0x343c('0xac')]===_0x343c('0xad')){var _0x25b668=[];for(var _0x1f2583=0x0;_0x1f2583<_0x1ee1d9['rows'][_0x343c('0x85')];_0x1f2583++){_0x25b668['push'](_0x651dc3(_0x343c('0xae'),_0x1ee1d9[_0x343c('0xab')][_0x1f2583][_0x343c('0xaf')]));_0x25b668[_0x343c('0x86')](_0x651dc3('sms',_0x1ee1d9[_0x343c('0xab')][_0x1f2583]['dataValues']));_0x25b668[_0x343c('0x86')](_0x651dc3(_0x343c('0xb0'),_0x1ee1d9[_0x343c('0xab')][_0x1f2583][_0x343c('0xaf')]));_0x25b668[_0x343c('0x86')](_0x651dc3(_0x343c('0xb1'),_0x1ee1d9[_0x343c('0xab')][_0x1f2583]['dataValues']));_0x25b668['push'](_0x651dc3('openchannel',_0x1ee1d9[_0x343c('0xab')][_0x1f2583]['dataValues']));_0x25b668['push'](_0x651dc3(_0x343c('0xb2'),_0x1ee1d9[_0x343c('0xab')][_0x1f2583][_0x343c('0xaf')]));}return Promise[_0x343c('0x89')](_0x25b668)[_0x343c('0x8')](function(){return _0x1ee1d9;});}return _0x1ee1d9;});}});}}});}; \ No newline at end of file +var _0xed17=['telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','CannedAnswer','Disposition','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','toUpperCase','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','union','ignore','autoAssociation','all','length','rawAttributes','keys','filters','model','attributes','intersection','fields','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','default','DefaultReports','custom','count','rows','include','Tag','Tags','tag','ThroughTags','Agents','openTabs','true','chat','sms','fax','dataValues','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','exports','filter','field','value','then','associatedResources','catch','findAll','name','UserProfileResource','map','resourceId','type','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','VoiceQueues','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users'];(function(_0x4ec339,_0x22430f){var _0x4e0e80=function(_0x321374){while(--_0x321374){_0x4ec339['push'](_0x4ec339['shift']());}};_0x4e0e80(++_0x22430f);}(_0xed17,0x67));var _0x7ed1=function(_0x540315,_0x5e4286){_0x540315=_0x540315-0x0;var _0x45b752=_0xed17[_0x540315];return _0x45b752;};'use strict';var _=require(_0x7ed1('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x7ed1('0x1'));var squel=require(_0x7ed1('0x2'));module[_0x7ed1('0x3')]=function(_0x1c90be){var _0x149413=_0x1c90be['models'];function _0x29adfd(_0x545306,_0x47fc8f){return new Promise(function(_0x5c8309,_0x1b77a4){if(!_0x47fc8f)return _0x5c8309(null);var _0x1dcde7=_0x47fc8f[_0x7ed1('0x4')]?{[_0x47fc8f['filter'][_0x7ed1('0x5')]]:_0x47fc8f[_0x7ed1('0x4')][_0x7ed1('0x6')]}:undefined;return _0x149413[_0x545306]['findAll']({'where':_0x1dcde7,'raw':!![]})[_0x7ed1('0x7')](function(_0x477d93){_0x47fc8f[_0x7ed1('0x8')]=_['map'](_0x477d93,'id');_0x5c8309(_0x47fc8f);})[_0x7ed1('0x9')](function(_0x1ff213){_0x1b77a4(_0x1ff213);});});}function _0x2fca6f(_0x574176,_0x1036c0){return new Promise(function(_0x2c0f01,_0x3b0222){var _0x476129=_0x574176[_0x7ed1('0x4')]?{[_0x574176['filter'][_0x7ed1('0x5')]]:_0x574176['filter']['value']}:undefined;return _0x149413[_0x574176['model']][_0x7ed1('0xa')]({'where':_0x476129,'raw':!![]})[_0x7ed1('0x7')](function(_0x93b0cf){_0x1036c0[_0x7ed1('0x8')]=_['map'](_0x93b0cf,function(_0x21ee51){return _0x21ee51[_0x7ed1('0xb')];});_0x2c0f01(_0x1036c0);})[_0x7ed1('0x9')](function(_0x13641b){_0x3b0222(_0x13641b);});});}function _0x16f09d(_0x5e867b,_0x38dd17,_0x59ca4){if(!_0x38dd17)return Promise['resolve'](null);return new Promise(function(_0x3ddadb,_0x3e898f){return _0x149413[_0x7ed1('0xc')][_0x7ed1('0xa')]({'where':{'sectionId':_0x38dd17['id']},'raw':!![]})['then'](function(_0x58056a){if(_0x5e867b[_0x7ed1('0x5')]&&_0x5e867b['field']!=='id'){_0x38dd17[_0x7ed1('0x8')]=_['map'](_0x58056a,function(_0x103bd7){return _0x103bd7[_0x5e867b[_0x7ed1('0x5')]];});}else{if(_0x59ca4==='AnalyticExtractedReport'){_0x38dd17[_0x7ed1('0x8')]=_[_0x7ed1('0xd')](_0x58056a,function(_0x590807){return{'id':_0x590807[_0x7ed1('0xe')],'type':_0x590807[_0x7ed1('0xf')]};});}else{_0x38dd17[_0x7ed1('0x8')]=_[_0x7ed1('0xd')](_0x58056a,function(_0x2de566){return _0x2de566[_0x7ed1('0xe')];});}}_0x3ddadb(_0x38dd17);})[_0x7ed1('0x9')](function(_0x50d65a){_0x3e898f(_0x50d65a);});});}function _0x1b1b4d(_0x2cb8fe,_0x20eb9f){var _0x2d5e9a={'parentSections':[]};switch(_0x2cb8fe['toLowerCase']()){case _0x7ed1('0x10'):_0x2d5e9a['childModel']=_0x7ed1('0x11');break;case _0x7ed1('0x12'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x14');break;case'squarerecordings':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x15');_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x7ed1('0x18'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x19');break;case'contacts':_0x2d5e9a[_0x7ed1('0x13')]='CmContact';_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x1a'),'field':'id','foreignKey':_0x7ed1('0x1b')}];break;case _0x7ed1('0x1c'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x1d');break;case _0x7ed1('0x1e'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x1f');break;case _0x7ed1('0x20'):_0x2d5e9a['childModel']=_0x7ed1('0x21');break;case _0x7ed1('0x22'):_0x2d5e9a[_0x7ed1('0x13')]='ChatQueue';break;case _0x7ed1('0x23'):_0x2d5e9a['childModel']='ChatWebsite';break;case'faxqueues':_0x2d5e9a['childModel']=_0x7ed1('0x24');break;case _0x7ed1('0x25'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x26');break;case _0x7ed1('0x27'):case _0x7ed1('0x28'):case _0x7ed1('0x29'):_0x2d5e9a[_0x7ed1('0x13')]='VoiceExtension';break;case _0x7ed1('0x2a'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x2b');break;case'voicemails':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x2c');break;case _0x7ed1('0x2d'):_0x2d5e9a['childModel']='VoiceRecording';_0x2d5e9a[_0x7ed1('0x16')]=[{'name':'Agents','field':'name','foreignKey':_0x7ed1('0x2e'),'model':_0x7ed1('0x2f'),'filter':{'field':_0x7ed1('0x30'),'value':[_0x7ed1('0x31')]}},{'name':_0x7ed1('0x32'),'field':_0x7ed1('0xb'),'foreignKey':_0x7ed1('0x2e'),'model':_0x7ed1('0x2f'),'filter':{'field':'role','value':['telephone']}},{'name':_0x7ed1('0x33'),'field':_0x7ed1('0xb'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x7ed1('0xf'),'value':[_0x7ed1('0x34')]}},{'name':_0x7ed1('0x35'),'field':_0x7ed1('0xb'),'foreignKey':'queue','model':_0x7ed1('0x36'),'filter':{'field':'type','value':[_0x7ed1('0x37')]}}];break;case _0x7ed1('0x38'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x39');break;case _0x7ed1('0x3a'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x3b');break;case _0x7ed1('0x3c'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x3d');break;case _0x7ed1('0x3e'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x3f');break;case'mailqueues':_0x2d5e9a['childModel']=_0x7ed1('0x40');break;case _0x7ed1('0x41'):_0x2d5e9a[_0x7ed1('0x13')]='MailAccount';break;case _0x7ed1('0x42'):_0x2d5e9a['childModel']=_0x7ed1('0x43');break;case _0x7ed1('0x44'):_0x2d5e9a['childModel']=_0x7ed1('0x45');break;case'openchannelaccounts':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x46');break;case'smsqueues':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x47');break;case _0x7ed1('0x48'):_0x2d5e9a[_0x7ed1('0x13')]='SmsAccount';break;case _0x7ed1('0x49'):_0x2d5e9a['childModel']=_0x7ed1('0x4a');break;case _0x7ed1('0x4b'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x4c');break;case _0x7ed1('0x4d'):_0x2d5e9a['childModel']=_0x7ed1('0x4e');break;case'voicequeues':case _0x7ed1('0x4f'):_0x2d5e9a[_0x7ed1('0x13')]='VoiceQueue';if(_0x20eb9f){_0x2d5e9a[_0x7ed1('0x16')]=[{'name':'VoiceQueues'},{'name':_0x7ed1('0x35')}];}break;case _0x7ed1('0x50'):case'agents':case _0x7ed1('0x51'):_0x2d5e9a[_0x7ed1('0x13')]='User';if(_0x20eb9f){_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x52'),'filter':{'field':_0x7ed1('0x30'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0x7ed1('0x32')}];}break;case _0x7ed1('0x53'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x54');break;case _0x7ed1('0x55'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x56');break;case'freshdeskaccounts':_0x2d5e9a[_0x7ed1('0x13')]='FreshdeskAccount';break;case _0x7ed1('0x57'):_0x2d5e9a['childModel']=_0x7ed1('0x58');break;case _0x7ed1('0x59'):_0x2d5e9a['childModel']=_0x7ed1('0x5a');break;case'zohoaccounts':_0x2d5e9a[_0x7ed1('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x2d5e9a['childModel']=_0x7ed1('0x2f');break;case'cannedanswers':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x5b');break;case'dispositions':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x5c');break;case'customdashboards':_0x2d5e9a[_0x7ed1('0x13')]='Dashboard';break;case _0x7ed1('0x5d'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x5e');break;case _0x7ed1('0x5f'):_0x2d5e9a['childModel']=_0x7ed1('0x60');break;case _0x7ed1('0x61'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x62');break;case'sounds':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x63');break;case _0x7ed1('0x64'):_0x2d5e9a['childModel']='Tag';break;case'templates':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x65');break;case _0x7ed1('0x66'):_0x2d5e9a['childModel']=_0x7ed1('0x67');break;case _0x7ed1('0x68'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x69');break;case'variables':_0x2d5e9a['childModel']=_0x7ed1('0x6a');break;case _0x7ed1('0x6b'):_0x2d5e9a[_0x7ed1('0x13')]='Plugin';break;case _0x7ed1('0x6c'):_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x6d');_0x2d5e9a[_0x7ed1('0x16')]=[{'name':_0x7ed1('0x6e'),'field':'id','foreignKey':_0x7ed1('0x6f')}];break;case'metrics':_0x2d5e9a[_0x7ed1('0x13')]=_0x7ed1('0x70');break;}return _0x2d5e9a;}function _0x5f2ae3(_0x284639,_0xf91833){var _0x5d5b65=_0x284639['charAt'](0x0)[_0x7ed1('0x71')]()+_0x284639['slice'](0x1);var _0x1deae6={'type':_0x149413['Sequelize'][_0x7ed1('0x72')]['SELECT'],'raw':!![]};return new Promise(function(_0x4ac306,_0x39ee6c){var _0x3ee4f8=squel[_0x7ed1('0x73')]()[_0x7ed1('0x5')](_0x7ed1('0x74')+_0x5d5b65+_0x7ed1('0x75'),'id')[_0x7ed1('0x5')](_0x7ed1('0x76'))[_0x7ed1('0x77')](_0x7ed1('0x78')+_0x284639+_0x7ed1('0x79'),'ui')[_0x7ed1('0x7a')](_0x7ed1('0x7b'),_0xf91833['id']);return _0x149413[_0x7ed1('0x7c')][_0x7ed1('0x7d')](_0x3ee4f8[_0x7ed1('0x7e')](),_0x1deae6)['then'](function(_0x270c87){_0xf91833[_0x5d5b65+_0x7ed1('0x7f')]=_0x270c87;_0x4ac306(_0x270c87);})['catch'](function(_0x2d8c34){_0x39ee6c(_0x2d8c34);});});}return _0x1c90be[_0x7ed1('0x80')](_0x7ed1('0x81'),attributes,{'tableName':_0x7ed1('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4a02bb){var _0x3fc1ec={'raw':_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x83')],'where':{}};var _0x3456c3={};var _0x123f61={'count':0x0,'rows':[]};var _0x3d0d56=_0x4a02bb['query']['section'];var _0x5a7179=_0x4a02bb[_0x7ed1('0x7d')]['mergeResources']||![];var _0x5a06fe=_0x1b1b4d(_0x3d0d56,_0x5a7179);if(!_0x5a06fe[_0x7ed1('0x13')])throw new Error(_0x7ed1('0x84')+_0x3d0d56+'\x27');var _0x3142fc=[{'name':_0x3d0d56}];if(!_[_0x7ed1('0x85')](_0x5a06fe[_0x7ed1('0x16')]))_0x3142fc=_0x5a06fe[_0x7ed1('0x16')];var _0x1dc101=[];for(var _0x3e71d9=0x0;_0x3e71d9<_0x3142fc['length'];_0x3e71d9++){_0x1dc101[_0x7ed1('0x86')](_0x149413[_0x7ed1('0x87')][_0x7ed1('0x88')]({'where':{'userProfileId':_0x4a02bb[_0x7ed1('0x89')]['id'],'name':_0x3142fc[_0x3e71d9][_0x7ed1('0xb')]},'raw':!![]}));}return Promise['all'](_0x1dc101)[_0x7ed1('0x7')](function(_0x17121c){var _0x1e5f8c=_['filter'](_0x17121c,function(_0x40b6fe){return _0x40b6fe?_0x40b6fe:undefined;});var _0x31c42c=_['filter'](_0x3142fc,['ignore',!![]]);var _0x28bf05=_[_0x7ed1('0x85')](_0x1e5f8c)&&_[_0x7ed1('0x85')](_0x31c42c)?null:_[_0x7ed1('0x8a')](_0x31c42c,_0x1e5f8c);if(!_0x28bf05)return null;var _0xe9084c=[];for(var _0xb8e96b=0x0;_0xb8e96b<_0x28bf05['length'];_0xb8e96b++){var _0x11532e=_[_0x7ed1('0x88')](_0x3142fc,function(_0x5848dc){return _0x28bf05[_0xb8e96b]?_0x5848dc[_0x7ed1('0xb')]===_0x28bf05[_0xb8e96b]['name']:null;});if(_0x11532e){if(_0x28bf05[_0xb8e96b][_0x7ed1('0x8b')]){_0xe9084c[_0x7ed1('0x86')](_0x29adfd(_0x5a06fe[_0x7ed1('0x13')],_0x28bf05[_0xb8e96b]));}else{if(!_0x28bf05[_0xb8e96b][_0x7ed1('0x8c')]){_0xe9084c[_0x7ed1('0x86')](_0x16f09d(_0x11532e,_0x28bf05[_0xb8e96b],_0x5a06fe[_0x7ed1('0x13')]));}else{if(_0x11532e['model']){_0xe9084c[_0x7ed1('0x86')](_0x2fca6f(_0x11532e,_0x28bf05[_0xb8e96b]));}}}}}return Promise[_0x7ed1('0x8d')](_0xe9084c);})[_0x7ed1('0x7')](function(_0x472769){var _0x569c02=_0x472769;var _0x59fe87=null;if(_0x569c02){_0x59fe87=_0x569c02[_0x7ed1('0x8e')]===0x1?_0x569c02[0x0]:null;}if(!_0x59fe87&&!_0x569c02)return _0x123f61;var _0x6f4d10=_0x149413[_0x5a06fe[_0x7ed1('0x13')]][_0x7ed1('0x8f')];_0x3456c3['model']=_['keys'](_0x6f4d10);_0x3456c3[_0x7ed1('0x7d')]=_[_0x7ed1('0x90')](_0x4a02bb[_0x7ed1('0x7d')]);_0x3456c3[_0x7ed1('0x91')]=_['intersection'](_0x3456c3[_0x7ed1('0x92')],_0x3456c3[_0x7ed1('0x7d')]);_0x3fc1ec[_0x7ed1('0x93')]=_[_0x7ed1('0x94')](_0x3456c3[_0x7ed1('0x92')],qs[_0x7ed1('0x95')](_0x4a02bb['query'][_0x7ed1('0x95')]));_0x3fc1ec['attributes']=_0x3fc1ec['attributes'][_0x7ed1('0x8e')]?_0x3fc1ec[_0x7ed1('0x93')]:_0x3456c3[_0x7ed1('0x92')];if(!_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x96')]('nolimit')){_0x3fc1ec['limit']=qs[_0x7ed1('0x97')](_0x4a02bb['query']['limit']);_0x3fc1ec[_0x7ed1('0x98')]=qs[_0x7ed1('0x98')](_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x98')]);}_0x3fc1ec[_0x7ed1('0x99')]=qs[_0x7ed1('0x9a')](_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x9a')]);_0x3fc1ec[_0x7ed1('0x7a')]=qs[_0x7ed1('0x91')](_[_0x7ed1('0x9b')](_0x4a02bb[_0x7ed1('0x7d')],_0x3456c3[_0x7ed1('0x91')]));if(_0x4a02bb[_0x7ed1('0x7d')]['filter']){_0x3fc1ec[_0x7ed1('0x7a')]=_['merge'](_0x3fc1ec[_0x7ed1('0x7a')],{'$or':_[_0x7ed1('0xd')](_0x6f4d10,function(_0x3ef102){if(_0x3ef102['type'][_0x7ed1('0x9c')]!==_0x7ed1('0x9d')){var _0x5fa39f={};_0x5fa39f[_0x3ef102[_0x7ed1('0x5')]]={'$like':'%'+_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0x4')]+'%'};return _0x5fa39f;}})});}var _0x51285a=[];var _0x71b272=null;var _0x115f9f={};if(_0x59fe87){_0x71b272=_[_0x7ed1('0x88')](_0x3142fc,[_0x7ed1('0xb'),_0x59fe87[_0x7ed1('0xb')]]);if(_0x71b272[_0x7ed1('0x5')]){_0x115f9f={};if(_0x5a06fe['childModel']==='AnalyticExtractedReport'){_0x115f9f[_0x71b272[_0x7ed1('0x9e')]]=_[_0x7ed1('0xd')](_0x59fe87['associatedResources'],'id');}else{_0x115f9f[_0x71b272[_0x7ed1('0x9e')]]=_0x59fe87['associatedResources'];}_0x51285a['push'](_0x115f9f);}else{_0x3fc1ec[_0x7ed1('0x7a')]['id']=_0x59fe87['associatedResources'];}}else{for(var _0x5bb988=0x0;_0x5bb988<_0x569c02[_0x7ed1('0x8e')];_0x5bb988++){_0x71b272=_[_0x7ed1('0x88')](_0x3142fc,[_0x7ed1('0xb'),_0x569c02[_0x5bb988][_0x7ed1('0xb')]]);if(_0x71b272[_0x7ed1('0x5')]){_0x115f9f={};_0x115f9f[_0x71b272['foreignKey']]=_0x569c02[_0x5bb988][_0x7ed1('0x8')];_0x51285a[_0x7ed1('0x86')](_0x115f9f);}else{if(!_0x3fc1ec[_0x7ed1('0x7a')]['id'])_0x3fc1ec[_0x7ed1('0x7a')]['id']=[];_0x569c02[_0x5bb988]['associatedResources'][_0x7ed1('0x9f')](function(_0x2858bc){_0x3fc1ec[_0x7ed1('0x7a')]['id']['push'](_0x2858bc);});}}}if(!_[_0x7ed1('0x85')](_0x51285a)){_0x3fc1ec[_0x7ed1('0x7a')]=_['merge'](_0x3fc1ec[_0x7ed1('0x7a')],{'$and':{'$or':_0x51285a}});}_0x3fc1ec=_[_0x7ed1('0xa0')]({},_0x3fc1ec,_0x4a02bb[_0x7ed1('0xa1')]);if(_0x59fe87&&!_0x59fe87[_0x7ed1('0x8c')]&&_0x5a06fe[_0x7ed1('0x13')]===_0x7ed1('0x6d')){if(_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xa2')]){_0x3fc1ec['include']=[{'all':!![]}];}return _0x149413[_0x5a06fe['childModel']][_0x7ed1('0xa')](_0x3fc1ec)[_0x7ed1('0x7')](function(_0x3ca5a4){var _0x321afb=[];_0x3ca5a4[_0x7ed1('0x9f')](function(_0x26cde2){var _0x18152f;switch(_0x26cde2[_0x7ed1('0xa3')]){case _0x7ed1('0xa4'):_0x18152f=_[_0x7ed1('0x88')](_0x59fe87[_0x7ed1('0x8')],function(_0x2c7665){return _0x2c7665['id']===_0x26cde2[_0x7ed1('0x6f')]&&_0x2c7665[_0x7ed1('0xf')]===_0x7ed1('0xa5');});break;case _0x7ed1('0xa6'):_0x18152f=_[_0x7ed1('0x88')](_0x59fe87[_0x7ed1('0x8')],function(_0x4368de){return _0x4368de['id']===_0x26cde2['reportId']&&_0x4368de['type']==='CustomReports';});break;}if(_0x18152f)_0x321afb[_0x7ed1('0x86')](_0x26cde2);});_0x123f61[_0x7ed1('0xa7')]=_0x321afb[_0x7ed1('0x8e')];_0x123f61[_0x7ed1('0xa8')]=_0x321afb;return _0x123f61;});}else{return _0x149413[_0x5a06fe[_0x7ed1('0x13')]][_0x7ed1('0xa7')]({'where':_0x3fc1ec[_0x7ed1('0x7a')]})[_0x7ed1('0x7')](function(_0x390c12){_0x123f61['count']=_0x390c12;if(_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xa2')]){if(_0x5a06fe[_0x7ed1('0x13')]==='CmContact'){_0x3fc1ec[_0x7ed1('0xa9')]=[{'model':_0x149413[_0x7ed1('0xaa')],'as':_0x7ed1('0xab'),'attributes':['id',_0x7ed1('0xb'),'color'],'required':_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xac')]?!![]:![]},{'model':_0x149413[_0x7ed1('0xaa')],'as':_0x7ed1('0xad'),'attributes':['id','name','color'],'through':_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xac')]?{'attributes':[],'where':{'TagId':_0x4a02bb['query'][_0x7ed1('0xac')]||undefined}}:{},'required':_0x4a02bb[_0x7ed1('0x7d')]['tag']?!![]:![]}];}else{_0x3fc1ec[_0x7ed1('0xa9')]=[{'all':!![]}];}}return _0x149413[_0x5a06fe[_0x7ed1('0x13')]][_0x7ed1('0xa')](_0x3fc1ec);})[_0x7ed1('0x7')](function(_0x444bf9){_0x123f61[_0x7ed1('0xa8')]=_0x444bf9;if(_0x3d0d56===_0x7ed1('0xae')&&_0x4a02bb[_0x7ed1('0x7d')][_0x7ed1('0xaf')]===_0x7ed1('0xb0')){var _0x589ce4=[];for(var _0x35efdd=0x0;_0x35efdd<_0x123f61['rows'][_0x7ed1('0x8e')];_0x35efdd++){_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb1'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd]['dataValues']));_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb2'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd]['dataValues']));_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb3'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));_0x589ce4['push'](_0x5f2ae3(_0x7ed1('0xb5'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));_0x589ce4[_0x7ed1('0x86')](_0x5f2ae3(_0x7ed1('0xb6'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));_0x589ce4['push'](_0x5f2ae3(_0x7ed1('0xb7'),_0x123f61[_0x7ed1('0xa8')][_0x35efdd][_0x7ed1('0xb4')]));}return Promise[_0x7ed1('0x8d')](_0x589ce4)[_0x7ed1('0x7')](function(){return _0x123f61;});}return _0x123f61;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d0ec063..9cf5bee 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 _0xf970=['defaults','localhost','socket.io-emitter','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5ab670,_0x4df6af){var _0x550f7a=function(_0x2b2616){while(--_0x2b2616){_0x5ab670['push'](_0x5ab670['shift']());}};_0x550f7a(++_0x4df6af);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var moment=require(_0x0f97('0x1'));var BPromise=require(_0x0f97('0x2'));var rs=require(_0x0f97('0x3'));var fs=require('fs');var Redis=require(_0x0f97('0x4'));var db=require(_0x0f97('0x5'))['db'];var utils=require(_0x0f97('0x6'));var logger=require(_0x0f97('0x7'))('rpc');var config=require(_0x0f97('0x8'));var jayson=require(_0x0f97('0x9'));var client=jayson[_0x0f97('0xa')][_0x0f97('0xb')]({'port':0x232a});config[_0x0f97('0xc')]=_[_0x0f97('0xd')](config[_0x0f97('0xc')],{'host':_0x0f97('0xe'),'port':0x18eb});var socket=require(_0x0f97('0xf'))(new Redis(config['redis']));require('./userProfile.socket')[_0x0f97('0x10')](socket);function respondWithRpcPromise(_0x49d8bd,_0x1366b4,_0x25f2c3){return new BPromise(function(_0xc8aa14,_0x497c7c){return client[_0x0f97('0x11')](_0x49d8bd,_0x25f2c3)['then'](function(_0x8f1b68){logger[_0x0f97('0x12')](_0x0f97('0x13'),_0x1366b4,_0x0f97('0x14'));logger[_0x0f97('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1366b4,_0x0f97('0x14'),JSON[_0x0f97('0x16')](_0x8f1b68));if(_0x8f1b68[_0x0f97('0x17')]){if(_0x8f1b68[_0x0f97('0x17')][_0x0f97('0x18')]===0x1f4){logger[_0x0f97('0x17')](_0x0f97('0x13'),_0x1366b4,_0x8f1b68['error']['message']);return _0x497c7c(_0x8f1b68[_0x0f97('0x17')][_0x0f97('0x19')]);}logger[_0x0f97('0x17')](_0x0f97('0x13'),_0x1366b4,_0x8f1b68['error']['message']);return _0xc8aa14(_0x8f1b68[_0x0f97('0x17')][_0x0f97('0x19')]);}else{logger[_0x0f97('0x12')](_0x0f97('0x13'),_0x1366b4,_0x0f97('0x14'));_0xc8aa14(_0x8f1b68[_0x0f97('0x1a')]['message']);}})['catch'](function(_0x35a341){logger[_0x0f97('0x17')](_0x0f97('0x13'),_0x1366b4,_0x35a341);_0x497c7c(_0x35a341);});});} \ No newline at end of file +var _0x598a=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x598a,0xfb));var _0xa598=function(_0x4c19f2,_0x5de019){_0x4c19f2=_0x4c19f2-0x0;var _0x1902d8=_0x598a[_0x4c19f2];return _0x1902d8;};'use strict';var _=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var moment=require(_0xa598('0x2'));var BPromise=require(_0xa598('0x3'));var rs=require(_0xa598('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa598('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa598('0x6'));var jayson=require(_0xa598('0x7'));var client=jayson[_0xa598('0x8')][_0xa598('0x9')]({'port':0x232a});config[_0xa598('0xa')]=_['defaults'](config['redis'],{'host':_0xa598('0xb'),'port':0x18eb});var socket=require(_0xa598('0xc'))(new Redis(config[_0xa598('0xa')]));require(_0xa598('0xd'))[_0xa598('0xe')](socket);function respondWithRpcPromise(_0x387afc,_0x5207d5,_0x5871a3){return new BPromise(function(_0x3ea1e4,_0x3cb7b8){return client[_0xa598('0xf')](_0x387afc,_0x5871a3)[_0xa598('0x10')](function(_0xa1c53){logger['info'](_0xa598('0x11'),_0x5207d5,_0xa598('0x12'));logger[_0xa598('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x5207d5,_0xa598('0x12'),JSON['stringify'](_0xa1c53));if(_0xa1c53[_0xa598('0x14')]){if(_0xa1c53[_0xa598('0x14')][_0xa598('0x15')]===0x1f4){logger[_0xa598('0x14')](_0xa598('0x11'),_0x5207d5,_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);return _0x3cb7b8(_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);}logger['error'](_0xa598('0x11'),_0x5207d5,_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);return _0x3ea1e4(_0xa1c53[_0xa598('0x14')][_0xa598('0x16')]);}else{logger[_0xa598('0x17')](_0xa598('0x11'),_0x5207d5,_0xa598('0x12'));_0x3ea1e4(_0xa1c53[_0xa598('0x18')][_0xa598('0x16')]);}})['catch'](function(_0x1ed03f){logger[_0xa598('0x14')](_0xa598('0x11'),_0x5207d5,_0x1ed03f);_0x3cb7b8(_0x1ed03f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e83bb2a..823b8d3 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 _0xefd0=['save','remove','removeListener','register','length','./userProfile.events'];(function(_0x4f9a7f,_0x30d20){var _0x169f92=function(_0x5a5d21){while(--_0x5a5d21){_0x4f9a7f['push'](_0x4f9a7f['shift']());}};_0x169f92(++_0x30d20);}(_0xefd0,0x9b));var _0x0efd=function(_0x3d5b35,_0x89546){_0x3d5b35=_0x3d5b35-0x0;var _0x20d58f=_0xefd0[_0x3d5b35];return _0x20d58f;};'use strict';var UserProfileEvents=require(_0x0efd('0x0'));var events=[_0x0efd('0x1'),_0x0efd('0x2'),'update'];function createListener(_0x11d417,_0x313fe6){return function(_0xe3f849){_0x313fe6['emit'](_0x11d417,_0xe3f849);};}function removeListener(_0x132e03,_0x42539c){return function(){UserProfileEvents[_0x0efd('0x3')](_0x132e03,_0x42539c);};}exports[_0x0efd('0x4')]=function(_0x5e50e3){for(var _0x57fa10=0x0,_0x496fb7=events[_0x0efd('0x5')];_0x57fa10<_0x496fb7;_0x57fa10++){var _0x337a03=events[_0x57fa10];var _0x56b07c=createListener('userProfile:'+_0x337a03,_0x5e50e3);UserProfileEvents['on'](_0x337a03,_0x56b07c);}}; \ No newline at end of file +var _0xb43a=['removeListener','./userProfile.events','save','remove','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb43a,0xb5));var _0xab43=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xb43a[_0x9edfd5];return _0x330738;};'use strict';var UserProfileEvents=require(_0xab43('0x0'));var events=[_0xab43('0x1'),_0xab43('0x2'),_0xab43('0x3')];function createListener(_0x448623,_0x382a61){return function(_0x2371ef){_0x382a61[_0xab43('0x4')](_0x448623,_0x2371ef);};}function removeListener(_0x4a2c88,_0x25330b){return function(){UserProfileEvents[_0xab43('0x5')](_0x4a2c88,_0x25330b);};}exports['register']=function(_0x49283c){for(var _0x5e9fa9=0x0,_0x36f1bc=events['length'];_0x5e9fa9<_0x36f1bc;_0x5e9fa9++){var _0x59169e=events[_0x5e9fa9];var _0x278d23=createListener('userProfile:'+_0x59169e,_0x49283c);UserProfileEvents['on'](_0x59169e,_0x278d23);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f7f9d99..84838c6 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 _0xea3a=['describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x18be96,_0x15e628){var _0x4b9baa=function(_0x2791b9){while(--_0x2791b9){_0x18be96['push'](_0x18be96['shift']());}};_0x4b9baa(++_0x15e628);}(_0xea3a,0x158));var _0xaea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea3a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaea3('0x0'));var util=require(_0xaea3('0x1'));var path=require('path');var timeout=require(_0xaea3('0x2'));var express=require(_0xaea3('0x3'));var router=express[_0xaea3('0x4')]();var fs_extra=require(_0xaea3('0x5'));var auth=require(_0xaea3('0x6'));var interaction=require(_0xaea3('0x7'));var config=require(_0xaea3('0x8'));var controller=require('./userProfileResource.controller');router[_0xaea3('0x9')]('/',auth['isAuthenticated'](),controller[_0xaea3('0xa')]);router['get'](_0xaea3('0xb'),auth[_0xaea3('0xc')](),controller[_0xaea3('0xd')]);router['get'](_0xaea3('0xe'),auth[_0xaea3('0xc')](),controller[_0xaea3('0xf')]);router[_0xaea3('0x10')]('/',auth['isAuthenticated'](),controller[_0xaea3('0x11')]);router[_0xaea3('0x12')](_0xaea3('0xe'),auth[_0xaea3('0xc')](),controller[_0xaea3('0x13')]);router['delete']('/:id',auth[_0xaea3('0xc')](),controller['destroy']);module[_0xaea3('0x14')]=router; \ No newline at end of file +var _0xb26d=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xb26d,0x197));var _0xdb26=function(_0x54c1eb,_0x90486d){_0x54c1eb=_0x54c1eb-0x0;var _0x18bd76=_0xb26d[_0x54c1eb];return _0x18bd76;};'use strict';var multer=require(_0xdb26('0x0'));var util=require(_0xdb26('0x1'));var path=require(_0xdb26('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdb26('0x3'));var auth=require(_0xdb26('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb26('0x5'));var controller=require('./userProfileResource.controller');router[_0xdb26('0x6')]('/',auth[_0xdb26('0x7')](),controller[_0xdb26('0x8')]);router[_0xdb26('0x6')](_0xdb26('0x9'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xa')]);router['get'](_0xdb26('0xb'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xc')]);router[_0xdb26('0xd')]('/',auth[_0xdb26('0x7')](),controller['create']);router[_0xdb26('0xe')](_0xdb26('0xb'),auth[_0xdb26('0x7')](),controller[_0xdb26('0xf')]);router[_0xdb26('0x10')](_0xdb26('0xb'),auth[_0xdb26('0x7')](),controller[_0xdb26('0x11')]);module[_0xdb26('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 2f6db3f..624a541 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 _0x0216=['STRING','INTEGER','sequelize','exports'];(function(_0x36aad8,_0x1cf491){var _0x214c2a=function(_0x5c66c4){while(--_0x5c66c4){_0x36aad8['push'](_0x36aad8['shift']());}};_0x214c2a(++_0x1cf491);}(_0x0216,0x96));var _0x6021=function(_0x8600cb,_0xf20ace){_0x8600cb=_0x8600cb-0x0;var _0x1979ee=_0x0216[_0x8600cb];return _0x1979ee;};'use strict';var Sequelize=require(_0x6021('0x0'));module[_0x6021('0x1')]={'name':{'type':Sequelize[_0x6021('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6021('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6021('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0264=['exports','STRING','INTEGER'];(function(_0x31d849,_0x3db9bc){var _0x1c55b3=function(_0x3b8040){while(--_0x3b8040){_0x31d849['push'](_0x31d849['shift']());}};_0x1c55b3(++_0x3db9bc);}(_0x0264,0x183));var _0x4026=function(_0x587041,_0x179518){_0x587041=_0x587041-0x0;var _0x13d979=_0x0264[_0x587041];return _0x13d979;};'use strict';var Sequelize=require('sequelize');module[_0x4026('0x0')]={'name':{'type':Sequelize[_0x4026('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4026('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4026('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 9df5c46..5f69c47 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 _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x2200f9,_0x26c709){var _0xa1ae40=function(_0x5dcf63){while(--_0x5dcf63){_0x2200f9['push'](_0x2200f9['shift']());}};_0xa1ae40(++_0x26c709);}(_0xd943,0x15d));var _0x3d94=function(_0x297a96,_0x62a5c1){_0x297a96=_0x297a96-0x0;var _0x5a9f06=_0xd943[_0x297a96];return _0x5a9f06;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file +var _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','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','describe','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dc6d6,_0x1788e8){var _0x1db7f1=function(_0x2147a0){while(--_0x2147a0){_0x3dc6d6['push'](_0x3dc6d6['shift']());}};_0x1db7f1(++_0x1788e8);}(_0x1261,0x144));var _0x1126=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0x1261[_0xd60031];return _0x43d00a;};'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['UserProfileResource'][_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['UserProfileResource']['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));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a5d8239..0dfc497 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 _0x4ed9=['compositeIndex','sectionId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources'];(function(_0x21e557,_0x276697){var _0x44d0e4=function(_0x34f92a){while(--_0x34f92a){_0x21e557['push'](_0x21e557['shift']());}};_0x44d0e4(++_0x276697);}(_0x4ed9,0x161));var _0x94ed=function(_0x1f3ad1,_0x5bee96){_0x1f3ad1=_0x1f3ad1-0x0;var _0x5eccb8=_0x4ed9[_0x1f3ad1];return _0x5eccb8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x94ed('0x0'))('api');var moment=require(_0x94ed('0x1'));var BPromise=require(_0x94ed('0x2'));var rp=require(_0x94ed('0x3'));var fs=require('fs');var path=require(_0x94ed('0x4'));var rimraf=require(_0x94ed('0x5'));var config=require(_0x94ed('0x6'));var attributes=require(_0x94ed('0x7'));module[_0x94ed('0x8')]=function(_0x5c881f,_0x2d1819){return _0x5c881f['define'](_0x94ed('0x9'),attributes,{'tableName':_0x94ed('0xa'),'paranoid':![],'indexes':[{'name':_0x94ed('0xb'),'fields':['resourceId',_0x94ed('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ca9=['resourceId','sectionId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex'];(function(_0x5e2af2,_0x3964a5){var _0x5b964b=function(_0x2e6a71){while(--_0x2e6a71){_0x5e2af2['push'](_0x5e2af2['shift']());}};_0x5b964b(++_0x3964a5);}(_0x9ca9,0x18a));var _0x99ca=function(_0x142cc0,_0x4ca2d0){_0x142cc0=_0x142cc0-0x0;var _0xabe71f=_0x9ca9[_0x142cc0];return _0xabe71f;};'use strict';var _=require(_0x99ca('0x0'));var util=require(_0x99ca('0x1'));var logger=require('../../config/logger')(_0x99ca('0x2'));var moment=require('moment');var BPromise=require(_0x99ca('0x3'));var rp=require(_0x99ca('0x4'));var fs=require('fs');var path=require(_0x99ca('0x5'));var rimraf=require(_0x99ca('0x6'));var config=require(_0x99ca('0x7'));var attributes=require(_0x99ca('0x8'));module[_0x99ca('0x9')]=function(_0x3f4cc2,_0x1f132d){return _0x3f4cc2['define']('UserProfileResource',attributes,{'tableName':_0x99ca('0xa'),'paranoid':![],'indexes':[{'name':_0x99ca('0xb'),'fields':[_0x99ca('0xc'),_0x99ca('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 e03bb8d..3208a09 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 _0x4a8a=['client','http','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x6ab30c,_0x2c713b){var _0x36e953=function(_0x1aea9a){while(--_0x1aea9a){_0x6ab30c['push'](_0x6ab30c['shift']());}};_0x36e953(++_0x2c713b);}(_0x4a8a,0x9b));var _0xa4a8=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x4a8a[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa4a8('0x0'));var fs=require('fs');var Redis=require(_0xa4a8('0x1'));var db=require(_0xa4a8('0x2'))['db'];var utils=require(_0xa4a8('0x3'));var logger=require('../../config/logger')(_0xa4a8('0x4'));var config=require(_0xa4a8('0x5'));var jayson=require(_0xa4a8('0x6'));var client=jayson[_0xa4a8('0x7')][_0xa4a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cd98f,_0x3477ea,_0x35281e){return new BPromise(function(_0x1f52ae,_0x300088){return client['request'](_0x4cd98f,_0x35281e)['then'](function(_0xffb57b){logger['info'](_0xa4a8('0x9'),_0x3477ea,_0xa4a8('0xa'));logger[_0xa4a8('0xb')](_0xa4a8('0xc'),_0x3477ea,_0xa4a8('0xa'),JSON[_0xa4a8('0xd')](_0xffb57b));if(_0xffb57b[_0xa4a8('0xe')]){if(_0xffb57b['error']['code']===0x1f4){logger[_0xa4a8('0xe')](_0xa4a8('0x9'),_0x3477ea,_0xffb57b['error']['message']);return _0x300088(_0xffb57b[_0xa4a8('0xe')]['message']);}logger['error'](_0xa4a8('0x9'),_0x3477ea,_0xffb57b[_0xa4a8('0xe')][_0xa4a8('0xf')]);return _0x1f52ae(_0xffb57b['error'][_0xa4a8('0xf')]);}else{logger[_0xa4a8('0x10')](_0xa4a8('0x9'),_0x3477ea,_0xa4a8('0xa'));_0x1f52ae(_0xffb57b['result'][_0xa4a8('0xf')]);}})[_0xa4a8('0x11')](function(_0x48b3d6){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x3477ea,_0x48b3d6);_0x300088(_0x48b3d6);});});} \ No newline at end of file +var _0x6236=['../../config/logger','rpc','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0x6236,0x149));var _0x6623=function(_0x1b327e,_0x488918){_0x1b327e=_0x1b327e-0x0;var _0xc8bf7e=_0x6236[_0x1b327e];return _0xc8bf7e;};'use strict';var _=require(_0x6623('0x0'));var util=require(_0x6623('0x1'));var moment=require(_0x6623('0x2'));var BPromise=require(_0x6623('0x3'));var rs=require(_0x6623('0x4'));var fs=require('fs');var Redis=require(_0x6623('0x5'));var db=require(_0x6623('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6623('0x7'))(_0x6623('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54b9fa,_0x960251,_0x314f11){return new BPromise(function(_0x41ba7f,_0x35aec1){return client[_0x6623('0x9')](_0x54b9fa,_0x314f11)[_0x6623('0xa')](function(_0x459e51){logger[_0x6623('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x960251,_0x6623('0xc'));logger[_0x6623('0xd')](_0x6623('0xe'),_0x960251,_0x6623('0xc'),JSON[_0x6623('0xf')](_0x459e51));if(_0x459e51[_0x6623('0x10')]){if(_0x459e51[_0x6623('0x10')][_0x6623('0x11')]===0x1f4){logger['error'](_0x6623('0x12'),_0x960251,_0x459e51[_0x6623('0x10')][_0x6623('0x13')]);return _0x35aec1(_0x459e51['error'][_0x6623('0x13')]);}logger[_0x6623('0x10')](_0x6623('0x12'),_0x960251,_0x459e51['error'][_0x6623('0x13')]);return _0x41ba7f(_0x459e51[_0x6623('0x10')][_0x6623('0x13')]);}else{logger[_0x6623('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x960251,'request\x20sent');_0x41ba7f(_0x459e51[_0x6623('0x14')][_0x6623('0x13')]);}})['catch'](function(_0x517648){logger[_0x6623('0x10')](_0x6623('0x12'),_0x960251,_0x517648);_0x35aec1(_0x517648);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 268cbe6..0d642b9 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 _0xe1b1=['create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x4d4d55,_0x7e059e){var _0x1c8281=function(_0x9b3cb8){while(--_0x9b3cb8){_0x4d4d55['push'](_0x4d4d55['shift']());}};_0x1c8281(++_0x7e059e);}(_0xe1b1,0x15a));var _0x1e1b=function(_0x3af0f4,_0xe30c1b){_0x3af0f4=_0x3af0f4-0x0;var _0x2c3185=_0xe1b1[_0x3af0f4];return _0x2c3185;};'use strict';var multer=require(_0x1e1b('0x0'));var util=require('util');var path=require(_0x1e1b('0x1'));var timeout=require(_0x1e1b('0x2'));var express=require(_0x1e1b('0x3'));var router=express[_0x1e1b('0x4')]();var fs_extra=require(_0x1e1b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e1b('0x6'));var config=require(_0x1e1b('0x7'));var controller=require(_0x1e1b('0x8'));router[_0x1e1b('0x9')]('/',auth[_0x1e1b('0xa')](),controller[_0x1e1b('0xb')]);router[_0x1e1b('0x9')](_0x1e1b('0xc'),auth[_0x1e1b('0xa')](),controller['describe']);router[_0x1e1b('0x9')](_0x1e1b('0xd'),auth[_0x1e1b('0xa')](),controller['show']);router[_0x1e1b('0xe')]('/',auth['isAuthenticated'](),controller[_0x1e1b('0xf')]);router['put'](_0x1e1b('0xd'),auth[_0x1e1b('0xa')](),controller[_0x1e1b('0x10')]);router['delete']('/:id',auth[_0x1e1b('0xa')](),controller[_0x1e1b('0x11')]);module[_0x1e1b('0x12')]=router; \ No newline at end of file +var _0xafad=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','post','create','put','delete','/:id','destroy','exports','multer','util','path'];(function(_0x447f32,_0x13386f){var _0x559a50=function(_0x27e1d6){while(--_0x27e1d6){_0x447f32['push'](_0x447f32['shift']());}};_0x559a50(++_0x13386f);}(_0xafad,0xbb));var _0xdafa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xafad[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xdafa('0x0'));var util=require(_0xdafa('0x1'));var path=require(_0xdafa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdafa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdafa('0x4'));var interaction=require(_0xdafa('0x5'));var config=require(_0xdafa('0x6'));var controller=require(_0xdafa('0x7'));router[_0xdafa('0x8')]('/',auth[_0xdafa('0x9')](),controller['index']);router[_0xdafa('0x8')](_0xdafa('0xa'),auth[_0xdafa('0x9')](),controller[_0xdafa('0xb')]);router[_0xdafa('0x8')]('/:id',auth[_0xdafa('0x9')](),controller['show']);router[_0xdafa('0xc')]('/',auth['isAuthenticated'](),controller[_0xdafa('0xd')]);router[_0xdafa('0xe')]('/:id',auth[_0xdafa('0x9')](),controller['update']);router[_0xdafa('0xf')](_0xdafa('0x10'),auth[_0xdafa('0x9')](),controller[_0xdafa('0x11')]);module[_0xdafa('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a25c541..3199857 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 _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x26e89e,_0xacad9){var _0x5bf1d3=function(_0x53cbf8){while(--_0x53cbf8){_0x26e89e['push'](_0x26e89e['shift']());}};_0x5bf1d3(++_0xacad9);}(_0x63a5,0x18e));var _0x563a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x63a5[_0x4b73a2];return _0x383c66;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x563a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x563a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x386400){this[_0x563a('0x5')]('crudPermissions',_0x386400?_0x386400['join'](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this[_0x563a('0x6')](_0x563a('0x7'))['split'](''):[];}}}; \ No newline at end of file +var _0x36ee=['getDataValue','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe36e('0x0')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe36e('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe36e('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe36e('0x0')],'set':function(_0x567a84){this[_0xe36e('0x3')](_0xe36e('0x4'),_0x567a84?_0x567a84[_0xe36e('0x5')](''):[]);},'get':function(){return this[_0xe36e('0x6')](_0xe36e('0x4'))?this[_0xe36e('0x6')](_0xe36e('0x4'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9379770..1e49fe8 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 _0x17f8=['bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','pick','where','type','VIRTUAL','filter','merge','options','UserProfileSection','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x308f09,_0x9c9367){var _0x2b58fd=function(_0x51b231){while(--_0x51b231){_0x308f09['push'](_0x308f09['shift']());}};_0x2b58fd(++_0x9c9367);}(_0x17f8,0x1c8));var _0x817f=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0x17f8[_0x2cdec6];return _0xa36703;};'use strict';var emlformat=require(_0x817f('0x0'));var rimraf=require(_0x817f('0x1'));var zipdir=require(_0x817f('0x2'));var jsonpatch=require(_0x817f('0x3'));var rp=require(_0x817f('0x4'));var moment=require(_0x817f('0x5'));var BPromise=require(_0x817f('0x6'));var Mustache=require('mustache');var util=require(_0x817f('0x7'));var path=require(_0x817f('0x8'));var sox=require('sox');var csv=require(_0x817f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x817f('0xa'));var _=require('lodash');var squel=require(_0x817f('0xb'));var crypto=require(_0x817f('0xc'));var jsforce=require(_0x817f('0xd'));var deskjs=require(_0x817f('0xe'));var toCsv=require(_0x817f('0x9'));var querystring=require('querystring');var Papa=require(_0x817f('0xf'));var Redis=require('ioredis');var authService=require(_0x817f('0x10'));var qs=require(_0x817f('0x11'));var as=require(_0x817f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x817f('0x13'))(_0x817f('0x14'));var utils=require(_0x817f('0x15'));var config=require(_0x817f('0x16'));var licenseUtil=require(_0x817f('0x17'));var db=require(_0x817f('0x18'))['db'];function respondWithStatusCode(_0x1f2d33,_0x2b319f){_0x2b319f=_0x2b319f||0xcc;return function(_0x4fd441){if(_0x4fd441){return _0x1f2d33[_0x817f('0x19')](_0x2b319f);}return _0x1f2d33[_0x817f('0x1a')](_0x2b319f)[_0x817f('0x1b')]();};}function respondWithResult(_0x4fe9d1,_0x5295d8){_0x5295d8=_0x5295d8||0xc8;return function(_0x3c9bc3){if(_0x3c9bc3){return _0x4fe9d1[_0x817f('0x1a')](_0x5295d8)[_0x817f('0x1c')](_0x3c9bc3);}};}function respondWithFilteredResult(_0x5f0060,_0x94de65){return function(_0x4647df){if(_0x4647df){var _0x3b97e3=typeof _0x94de65[_0x817f('0x1d')]===_0x817f('0x1e')&&typeof _0x94de65[_0x817f('0x1f')]===_0x817f('0x1e');var _0x15345d=_0x4647df['count'];var _0xae49ee=_0x3b97e3?0x0:_0x94de65[_0x817f('0x1d')];var _0x36ac66=_0x3b97e3?_0x4647df[_0x817f('0x20')]:_0x94de65[_0x817f('0x1d')]+_0x94de65[_0x817f('0x1f')];var _0x1c6c1c;if(_0x36ac66>=_0x15345d){_0x36ac66=_0x15345d;_0x1c6c1c=0xc8;}else{_0x1c6c1c=0xce;}_0x5f0060[_0x817f('0x1a')](_0x1c6c1c);return _0x5f0060[_0x817f('0x21')](_0x817f('0x22'),_0xae49ee+'-'+_0x36ac66+'/'+_0x15345d)['json'](_0x4647df);}return null;};}function patchUpdates(_0x5a118b){return function(_0xe71023){try{jsonpatch[_0x817f('0x23')](_0xe71023,_0x5a118b,!![]);}catch(_0x110d42){return BPromise[_0x817f('0x24')](_0x110d42);}return _0xe71023[_0x817f('0x25')]();};}function saveUpdates(_0x79942e,_0x3d7bcd){return function(_0x2d74b5){if(_0x2d74b5){return _0x2d74b5[_0x817f('0x26')](_0x79942e)[_0x817f('0x27')](function(_0x4c4eca){return _0x4c4eca;});}return null;};}function removeEntity(_0x3ea211,_0x322541){return function(_0x110268){if(_0x110268){return _0x110268[_0x817f('0x28')]()[_0x817f('0x27')](function(){_0x3ea211[_0x817f('0x1a')](0xcc)[_0x817f('0x1b')]();});}};}function handleEntityNotFound(_0x2e5da8,_0x9035a6){return function(_0x3f0f57){if(!_0x3f0f57){_0x2e5da8['sendStatus'](0x194);}return _0x3f0f57;};}function handleError(_0x117173,_0x31f65b){_0x31f65b=_0x31f65b||0x1f4;return function(_0x3d994f){logger[_0x817f('0x29')](_0x3d994f[_0x817f('0x2a')]);if(_0x3d994f[_0x817f('0x2b')]){delete _0x3d994f[_0x817f('0x2b')];}_0x117173[_0x817f('0x1a')](_0x31f65b)[_0x817f('0x2c')](_0x3d994f);};}exports[_0x817f('0x2d')]=function(_0x598ac6,_0x1e3a40){var _0x1bdc9d={},_0x259611={},_0x414de1={'count':0x0,'rows':[]};var _0x3ae7da=_['map'](db['UserProfileSection'][_0x817f('0x2e')],function(_0x518195){return{'name':_0x518195[_0x817f('0x2f')],'type':_0x518195['type'][_0x817f('0x30')]};});_0x259611[_0x817f('0x31')]=_['map'](_0x3ae7da,_0x817f('0x2b'));_0x259611[_0x817f('0x32')]=_[_0x817f('0x33')](_0x598ac6[_0x817f('0x32')]);_0x259611[_0x817f('0x34')]=_[_0x817f('0x35')](_0x259611[_0x817f('0x31')],_0x259611[_0x817f('0x32')]);_0x1bdc9d[_0x817f('0x36')]=_[_0x817f('0x35')](_0x259611[_0x817f('0x31')],qs[_0x817f('0x37')](_0x598ac6['query'][_0x817f('0x37')]));_0x1bdc9d['attributes']=_0x1bdc9d[_0x817f('0x36')]['length']?_0x1bdc9d[_0x817f('0x36')]:_0x259611['model'];if(!_0x598ac6[_0x817f('0x32')][_0x817f('0x38')]('nolimit')){_0x1bdc9d[_0x817f('0x1f')]=qs[_0x817f('0x1f')](_0x598ac6[_0x817f('0x32')][_0x817f('0x1f')]);_0x1bdc9d['offset']=qs[_0x817f('0x1d')](_0x598ac6['query'][_0x817f('0x1d')]);}_0x1bdc9d[_0x817f('0x39')]=qs['sort'](_0x598ac6['query']['sort']);_0x1bdc9d['where']=qs[_0x817f('0x34')](_[_0x817f('0x3a')](_0x598ac6[_0x817f('0x32')],_0x259611[_0x817f('0x34')]),_0x3ae7da);if(_0x598ac6[_0x817f('0x32')]['filter']){_0x1bdc9d['where']=_['merge'](_0x1bdc9d[_0x817f('0x3b')],{'$or':_['map'](_0x3ae7da,function(_0x556ba4){if(_0x556ba4[_0x817f('0x3c')]!==_0x817f('0x3d')){var _0x53d1a3={};_0x53d1a3[_0x556ba4['name']]={'$like':'%'+_0x598ac6[_0x817f('0x32')][_0x817f('0x3e')]+'%'};return _0x53d1a3;}})});}_0x1bdc9d=_[_0x817f('0x3f')]({},_0x1bdc9d,_0x598ac6[_0x817f('0x40')]);var _0x2aac9b={'where':_0x1bdc9d[_0x817f('0x3b')]};return db[_0x817f('0x41')]['count'](_0x2aac9b)[_0x817f('0x27')](function(_0x3a12b1){_0x414de1[_0x817f('0x20')]=_0x3a12b1;if(_0x598ac6['query'][_0x817f('0x42')]){_0x1bdc9d[_0x817f('0x43')]=[{'all':!![]}];}return db[_0x817f('0x41')][_0x817f('0x44')](_0x1bdc9d);})[_0x817f('0x27')](function(_0x1b1645){_0x414de1[_0x817f('0x45')]=_0x1b1645;return _0x414de1;})[_0x817f('0x27')](respondWithFilteredResult(_0x1e3a40,_0x1bdc9d))[_0x817f('0x46')](handleError(_0x1e3a40,null));};exports['show']=function(_0x2f0cdc,_0x1910d3){var _0x211dfc={'raw':![],'where':{'id':_0x2f0cdc[_0x817f('0x47')]['id']}},_0x101bb8={};_0x101bb8[_0x817f('0x31')]=_[_0x817f('0x33')](db[_0x817f('0x41')][_0x817f('0x2e')]);_0x101bb8[_0x817f('0x32')]=_[_0x817f('0x33')](_0x2f0cdc['query']);_0x101bb8[_0x817f('0x34')]=_['intersection'](_0x101bb8[_0x817f('0x31')],_0x101bb8[_0x817f('0x32')]);_0x211dfc['attributes']=_[_0x817f('0x35')](_0x101bb8[_0x817f('0x31')],qs[_0x817f('0x37')](_0x2f0cdc[_0x817f('0x32')]['fields']));_0x211dfc['attributes']=_0x211dfc[_0x817f('0x36')][_0x817f('0x48')]?_0x211dfc[_0x817f('0x36')]:_0x101bb8[_0x817f('0x31')];if(_0x2f0cdc[_0x817f('0x32')]['includeAll']){_0x211dfc['include']=[{'all':!![]}];}_0x211dfc=_[_0x817f('0x3f')]({},_0x211dfc,_0x2f0cdc[_0x817f('0x40')]);return db['UserProfileSection'][_0x817f('0x49')](_0x211dfc)[_0x817f('0x27')](handleEntityNotFound(_0x1910d3,null))['then'](respondWithResult(_0x1910d3,null))[_0x817f('0x46')](handleError(_0x1910d3,null));};exports[_0x817f('0x4a')]=function(_0x56403e,_0xec26ab){return db[_0x817f('0x41')]['create'](_0x56403e[_0x817f('0x4b')],{})[_0x817f('0x27')](respondWithResult(_0xec26ab,0xc9))[_0x817f('0x46')](handleError(_0xec26ab,null));};exports[_0x817f('0x26')]=function(_0x413ee2,_0x27b9c9){if(_0x413ee2[_0x817f('0x4b')]['id']){delete _0x413ee2['body']['id'];}return db[_0x817f('0x41')][_0x817f('0x49')]({'where':{'id':_0x413ee2['params']['id']}})[_0x817f('0x27')](handleEntityNotFound(_0x27b9c9,null))[_0x817f('0x27')](saveUpdates(_0x413ee2[_0x817f('0x4b')],null))[_0x817f('0x27')](respondWithResult(_0x27b9c9,null))[_0x817f('0x46')](handleError(_0x27b9c9,null));};exports[_0x817f('0x28')]=function(_0x587327,_0x49a952){return db[_0x817f('0x41')][_0x817f('0x49')]({'where':{'id':_0x587327[_0x817f('0x47')]['id']}})['then'](handleEntityNotFound(_0x49a952,null))['then'](removeEntity(_0x49a952,null))[_0x817f('0x46')](handleError(_0x49a952,null));};exports[_0x817f('0x4c')]=function(_0x28c771,_0x19e6fd){return db[_0x817f('0x41')]['describe']()[_0x817f('0x27')](respondWithResult(_0x19e6fd,null))[_0x817f('0x46')](handleError(_0x19e6fd,null));}; \ No newline at end of file +var _0x3ec5=['limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','length','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined'];(function(_0x492af5,_0xd51471){var _0x59f529=function(_0x40c9aa){while(--_0x40c9aa){_0x492af5['push'](_0x492af5['shift']());}};_0x59f529(++_0xd51471);}(_0x3ec5,0x1eb));var _0x53ec=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3ec5[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x53ec('0x0'));var rimraf=require(_0x53ec('0x1'));var zipdir=require(_0x53ec('0x2'));var jsonpatch=require(_0x53ec('0x3'));var rp=require('request-promise');var moment=require(_0x53ec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53ec('0x5'));var util=require(_0x53ec('0x6'));var path=require(_0x53ec('0x7'));var sox=require(_0x53ec('0x8'));var csv=require('to-csv');var ejs=require(_0x53ec('0x9'));var fs=require('fs');var fs_extra=require(_0x53ec('0xa'));var _=require(_0x53ec('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53ec('0xc'));var querystring=require(_0x53ec('0xd'));var Papa=require(_0x53ec('0xe'));var Redis=require('ioredis');var authService=require(_0x53ec('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ec('0x10'))(_0x53ec('0x11'));var utils=require(_0x53ec('0x12'));var config=require(_0x53ec('0x13'));var licenseUtil=require(_0x53ec('0x14'));var db=require(_0x53ec('0x15'))['db'];function respondWithStatusCode(_0x3d223f,_0x28343d){_0x28343d=_0x28343d||0xcc;return function(_0x52317f){if(_0x52317f){return _0x3d223f['sendStatus'](_0x28343d);}return _0x3d223f['status'](_0x28343d)[_0x53ec('0x16')]();};}function respondWithResult(_0x4ce593,_0x487239){_0x487239=_0x487239||0xc8;return function(_0x8533b8){if(_0x8533b8){return _0x4ce593[_0x53ec('0x17')](_0x487239)[_0x53ec('0x18')](_0x8533b8);}};}function respondWithFilteredResult(_0x55d071,_0xc0543d){return function(_0x4ec24a){if(_0x4ec24a){var _0x384d3d=typeof _0xc0543d[_0x53ec('0x19')]===_0x53ec('0x1a')&&typeof _0xc0543d[_0x53ec('0x1b')]===_0x53ec('0x1a');var _0x44fa54=_0x4ec24a[_0x53ec('0x1c')];var _0x5559a9=_0x384d3d?0x0:_0xc0543d[_0x53ec('0x19')];var _0x40c2ca=_0x384d3d?_0x4ec24a[_0x53ec('0x1c')]:_0xc0543d[_0x53ec('0x19')]+_0xc0543d[_0x53ec('0x1b')];var _0x5974b2;if(_0x40c2ca>=_0x44fa54){_0x40c2ca=_0x44fa54;_0x5974b2=0xc8;}else{_0x5974b2=0xce;}_0x55d071[_0x53ec('0x17')](_0x5974b2);return _0x55d071[_0x53ec('0x1d')](_0x53ec('0x1e'),_0x5559a9+'-'+_0x40c2ca+'/'+_0x44fa54)[_0x53ec('0x18')](_0x4ec24a);}return null;};}function patchUpdates(_0x378042){return function(_0x429fe1){try{jsonpatch[_0x53ec('0x1f')](_0x429fe1,_0x378042,!![]);}catch(_0x1c4403){return BPromise[_0x53ec('0x20')](_0x1c4403);}return _0x429fe1[_0x53ec('0x21')]();};}function saveUpdates(_0x55b2b5,_0x1158c2){return function(_0x34d2aa){if(_0x34d2aa){return _0x34d2aa['update'](_0x55b2b5)[_0x53ec('0x22')](function(_0x461830){return _0x461830;});}return null;};}function removeEntity(_0x57011a,_0x3534bc){return function(_0x1663f6){if(_0x1663f6){return _0x1663f6[_0x53ec('0x23')]()[_0x53ec('0x22')](function(){_0x57011a[_0x53ec('0x17')](0xcc)[_0x53ec('0x16')]();});}};}function handleEntityNotFound(_0xada51a,_0x45f464){return function(_0x206662){if(!_0x206662){_0xada51a[_0x53ec('0x24')](0x194);}return _0x206662;};}function handleError(_0x28eeac,_0x2064f3){_0x2064f3=_0x2064f3||0x1f4;return function(_0x54d566){logger[_0x53ec('0x25')](_0x54d566[_0x53ec('0x26')]);if(_0x54d566[_0x53ec('0x27')]){delete _0x54d566[_0x53ec('0x27')];}_0x28eeac[_0x53ec('0x17')](_0x2064f3)[_0x53ec('0x28')](_0x54d566);};}exports[_0x53ec('0x29')]=function(_0x132d2e,_0x3611a4){var _0xc8e685={},_0x54505a={},_0x364b0a={'count':0x0,'rows':[]};var _0x3e57e6=_[_0x53ec('0x2a')](db[_0x53ec('0x2b')][_0x53ec('0x2c')],function(_0x282f27){return{'name':_0x282f27[_0x53ec('0x2d')],'type':_0x282f27[_0x53ec('0x2e')]['key']};});_0x54505a[_0x53ec('0x2f')]=_[_0x53ec('0x2a')](_0x3e57e6,_0x53ec('0x27'));_0x54505a[_0x53ec('0x30')]=_[_0x53ec('0x31')](_0x132d2e[_0x53ec('0x30')]);_0x54505a[_0x53ec('0x32')]=_[_0x53ec('0x33')](_0x54505a[_0x53ec('0x2f')],_0x54505a[_0x53ec('0x30')]);_0xc8e685[_0x53ec('0x34')]=_[_0x53ec('0x33')](_0x54505a[_0x53ec('0x2f')],qs['fields'](_0x132d2e[_0x53ec('0x30')][_0x53ec('0x35')]));_0xc8e685[_0x53ec('0x34')]=_0xc8e685[_0x53ec('0x34')]['length']?_0xc8e685[_0x53ec('0x34')]:_0x54505a[_0x53ec('0x2f')];if(!_0x132d2e[_0x53ec('0x30')][_0x53ec('0x36')](_0x53ec('0x37'))){_0xc8e685[_0x53ec('0x1b')]=qs[_0x53ec('0x1b')](_0x132d2e['query'][_0x53ec('0x1b')]);_0xc8e685[_0x53ec('0x19')]=qs[_0x53ec('0x19')](_0x132d2e[_0x53ec('0x30')][_0x53ec('0x19')]);}_0xc8e685[_0x53ec('0x38')]=qs['sort'](_0x132d2e[_0x53ec('0x30')]['sort']);_0xc8e685[_0x53ec('0x39')]=qs[_0x53ec('0x32')](_[_0x53ec('0x3a')](_0x132d2e['query'],_0x54505a[_0x53ec('0x32')]),_0x3e57e6);if(_0x132d2e[_0x53ec('0x30')][_0x53ec('0x3b')]){_0xc8e685[_0x53ec('0x39')]=_[_0x53ec('0x3c')](_0xc8e685[_0x53ec('0x39')],{'$or':_['map'](_0x3e57e6,function(_0x17c62b){if(_0x17c62b[_0x53ec('0x2e')]!==_0x53ec('0x3d')){var _0x1bec4c={};_0x1bec4c[_0x17c62b[_0x53ec('0x27')]]={'$like':'%'+_0x132d2e[_0x53ec('0x30')][_0x53ec('0x3b')]+'%'};return _0x1bec4c;}})});}_0xc8e685=_[_0x53ec('0x3c')]({},_0xc8e685,_0x132d2e[_0x53ec('0x3e')]);var _0x1de0be={'where':_0xc8e685[_0x53ec('0x39')]};return db[_0x53ec('0x2b')][_0x53ec('0x1c')](_0x1de0be)[_0x53ec('0x22')](function(_0x48731a){_0x364b0a['count']=_0x48731a;if(_0x132d2e['query']['includeAll']){_0xc8e685['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x53ec('0x3f')](_0xc8e685);})['then'](function(_0x196d35){_0x364b0a['rows']=_0x196d35;return _0x364b0a;})[_0x53ec('0x22')](respondWithFilteredResult(_0x3611a4,_0xc8e685))[_0x53ec('0x40')](handleError(_0x3611a4,null));};exports[_0x53ec('0x41')]=function(_0xb490d9,_0x114cc8){var _0x2009e7={'raw':![],'where':{'id':_0xb490d9[_0x53ec('0x42')]['id']}},_0x3487a7={};_0x3487a7[_0x53ec('0x2f')]=_[_0x53ec('0x31')](db['UserProfileSection'][_0x53ec('0x2c')]);_0x3487a7[_0x53ec('0x30')]=_[_0x53ec('0x31')](_0xb490d9[_0x53ec('0x30')]);_0x3487a7['filters']=_[_0x53ec('0x33')](_0x3487a7[_0x53ec('0x2f')],_0x3487a7['query']);_0x2009e7[_0x53ec('0x34')]=_[_0x53ec('0x33')](_0x3487a7[_0x53ec('0x2f')],qs[_0x53ec('0x35')](_0xb490d9['query'][_0x53ec('0x35')]));_0x2009e7[_0x53ec('0x34')]=_0x2009e7[_0x53ec('0x34')][_0x53ec('0x43')]?_0x2009e7['attributes']:_0x3487a7[_0x53ec('0x2f')];if(_0xb490d9[_0x53ec('0x30')]['includeAll']){_0x2009e7[_0x53ec('0x44')]=[{'all':!![]}];}_0x2009e7=_[_0x53ec('0x3c')]({},_0x2009e7,_0xb490d9[_0x53ec('0x3e')]);return db[_0x53ec('0x2b')][_0x53ec('0x45')](_0x2009e7)[_0x53ec('0x22')](handleEntityNotFound(_0x114cc8,null))[_0x53ec('0x22')](respondWithResult(_0x114cc8,null))[_0x53ec('0x40')](handleError(_0x114cc8,null));};exports[_0x53ec('0x46')]=function(_0x774f52,_0xefa194){return db[_0x53ec('0x2b')]['create'](_0x774f52[_0x53ec('0x47')],{})[_0x53ec('0x22')](respondWithResult(_0xefa194,0xc9))[_0x53ec('0x40')](handleError(_0xefa194,null));};exports[_0x53ec('0x48')]=function(_0x21f6f4,_0x5ead96){if(_0x21f6f4[_0x53ec('0x47')]['id']){delete _0x21f6f4[_0x53ec('0x47')]['id'];}return db[_0x53ec('0x2b')][_0x53ec('0x45')]({'where':{'id':_0x21f6f4[_0x53ec('0x42')]['id']}})[_0x53ec('0x22')](handleEntityNotFound(_0x5ead96,null))[_0x53ec('0x22')](saveUpdates(_0x21f6f4[_0x53ec('0x47')],null))['then'](respondWithResult(_0x5ead96,null))[_0x53ec('0x40')](handleError(_0x5ead96,null));};exports[_0x53ec('0x23')]=function(_0x402ff3,_0x53fd19){return db[_0x53ec('0x2b')][_0x53ec('0x45')]({'where':{'id':_0x402ff3[_0x53ec('0x42')]['id']}})['then'](handleEntityNotFound(_0x53fd19,null))['then'](removeEntity(_0x53fd19,null))[_0x53ec('0x40')](handleError(_0x53fd19,null));};exports[_0x53ec('0x49')]=function(_0x3ecd70,_0x304428){return db[_0x53ec('0x2b')]['describe']()[_0x53ec('0x22')](respondWithResult(_0x304428,null))[_0x53ec('0x40')](handleError(_0x304428,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d306aec..020b844 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 _0xadf4=['api','bluebird','request-promise','path','rimraf','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0xadf4,0x8d));var _0x4adf=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0xadf4[_0x334651];return _0x29657c;};'use strict';var _=require('lodash');var util=require(_0x4adf('0x0'));var logger=require(_0x4adf('0x1'))(_0x4adf('0x2'));var moment=require('moment');var BPromise=require(_0x4adf('0x3'));var rp=require(_0x4adf('0x4'));var fs=require('fs');var path=require(_0x4adf('0x5'));var rimraf=require(_0x4adf('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x3e4c81,_0x542748){return _0x3e4c81[_0x4adf('0x7')](_0x4adf('0x8'),attributes,{'tableName':_0x4adf('0x9'),'paranoid':![],'indexes':[{'name':_0x4adf('0xa'),'fields':[_0x4adf('0xb'),_0x4adf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cc7=['util','../../config/logger','api','moment','request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','lodash'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x3cc7,0x11f));var _0x73cc=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x3cc7[_0x1e381c];return _0x9b5ea9;};'use strict';var _=require(_0x73cc('0x0'));var util=require(_0x73cc('0x1'));var logger=require(_0x73cc('0x2'))(_0x73cc('0x3'));var moment=require(_0x73cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x73cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73cc('0x6'));var config=require('../../config/environment');var attributes=require(_0x73cc('0x7'));module[_0x73cc('0x8')]=function(_0x343002,_0x5daec4){return _0x343002[_0x73cc('0x9')](_0x73cc('0xa'),attributes,{'tableName':_0x73cc('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 530b195..caabd84 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 _0x4ce6=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x5d70f8,_0x67043f){var _0x4ba4d3=function(_0x1f19f0){while(--_0x1f19f0){_0x5d70f8['push'](_0x5d70f8['shift']());}};_0x4ba4d3(++_0x67043f);}(_0x4ce6,0x108));var _0x64ce=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x4ce6[_0x1a21ff];return _0x25afc1;};'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')]('UserProfileSection,\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 +var _0x5434=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x8a14d8,_0x416faf){var _0x3fdcf3=function(_0x3bfd12){while(--_0x3bfd12){_0x8a14d8['push'](_0x8a14d8['shift']());}};_0x3fdcf3(++_0x416faf);}(_0x5434,0x105));var _0x4543=function(_0x2de031,_0x27f624){_0x2de031=_0x2de031-0x0;var _0x28a7d2=_0x5434[_0x2de031];return _0x28a7d2;};'use strict';var _=require('lodash');var util=require(_0x4543('0x0'));var moment=require(_0x4543('0x1'));var BPromise=require(_0x4543('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4543('0x3'));var db=require(_0x4543('0x4'))['db'];var utils=require(_0x4543('0x5'));var logger=require(_0x4543('0x6'))(_0x4543('0x7'));var config=require(_0x4543('0x8'));var jayson=require(_0x4543('0x9'));var client=jayson['client'][_0x4543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101db0,_0x44a653,_0xea67fa){return new BPromise(function(_0x318d48,_0x46c8ce){return client['request'](_0x101db0,_0xea67fa)[_0x4543('0xb')](function(_0x5264ce){logger['info'](_0x4543('0xc'),_0x44a653,'request\x20sent');logger[_0x4543('0xd')](_0x4543('0xe'),_0x44a653,_0x4543('0xf'),JSON[_0x4543('0x10')](_0x5264ce));if(_0x5264ce['error']){if(_0x5264ce[_0x4543('0x11')]['code']===0x1f4){logger[_0x4543('0x11')](_0x4543('0xc'),_0x44a653,_0x5264ce['error'][_0x4543('0x12')]);return _0x46c8ce(_0x5264ce[_0x4543('0x11')][_0x4543('0x12')]);}logger[_0x4543('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x44a653,_0x5264ce[_0x4543('0x11')][_0x4543('0x12')]);return _0x318d48(_0x5264ce[_0x4543('0x11')][_0x4543('0x12')]);}else{logger[_0x4543('0x13')](_0x4543('0xc'),_0x44a653,_0x4543('0xf'));_0x318d48(_0x5264ce[_0x4543('0x14')][_0x4543('0x12')]);}})[_0x4543('0x15')](function(_0x3d6cb5){logger['error'](_0x4543('0xc'),_0x44a653,_0x3d6cb5);_0x46c8ce(_0x3d6cb5);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 93f8bd0..627e243 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(_0x346743,_0x508376){var _0x244b31=function(_0x756114){while(--_0x756114){_0x346743['push'](_0x346743['shift']());}};_0x244b31(++_0x508376);}(_0x70e0,0x17b));var _0x070e=function(_0x2dd01e,_0x4e2cd3){_0x2dd01e=_0x2dd01e-0x0;var _0x32604b=_0x70e0[_0x2dd01e];return _0x32604b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3e2ac7,_0x5ecfed){var _0xa9af6f=function(_0x45f2b6){while(--_0x45f2b6){_0x3e2ac7['push'](_0x3e2ac7['shift']());}};_0xa9af6f(++_0x5ecfed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xcb91[_0x4eafed];return _0x159c85;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c7712a9..9cd6f57 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 _0xc73e=['INTEGER','sequelize','exports'];(function(_0x3f839f,_0x2dabdc){var _0x386f39=function(_0x45999f){while(--_0x45999f){_0x3f839f['push'](_0x3f839f['shift']());}};_0x386f39(++_0x2dabdc);}(_0xc73e,0x1c3));var _0xec73=function(_0x516d84,_0x174c1b){_0x516d84=_0x516d84-0x0;var _0x4204d1=_0xc73e[_0x516d84];return _0x4204d1;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'penalty':{'type':Sequelize[_0xec73('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc9c7=['INTEGER','sequelize'];(function(_0x261abd,_0x2f2e52){var _0x345c8e=function(_0x5841ee){while(--_0x5841ee){_0x261abd['push'](_0x261abd['shift']());}};_0x345c8e(++_0x2f2e52);}(_0xc9c7,0x16d));var _0x7c9c=function(_0x264054,_0x9e7673){_0x264054=_0x264054-0x0;var _0x3754e2=_0xc9c7[_0x264054];return _0x3754e2;};'use strict';var Sequelize=require(_0x7c9c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7c9c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 76d6527..96be5af 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 _0x4819=['user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','UserSmsQueue'];(function(_0x4fda99,_0xb1d9ed){var _0xd25589=function(_0x41a8e0){while(--_0x41a8e0){_0x4fda99['push'](_0x4fda99['shift']());}};_0xd25589(++_0xb1d9ed);}(_0x4819,0xcd));var _0x9481=function(_0x474e22,_0x5d5515){_0x474e22=_0x474e22-0x0;var _0x76a179=_0x4819[_0x474e22];return _0x76a179;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['exports','define','UserSmsQueue','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x5a0e70,_0x520112){var _0x69ae46=function(_0x9a6b97){while(--_0x9a6b97){_0x5a0e70['push'](_0x5a0e70['shift']());}};_0x69ae46(++_0x520112);}(_0x4bd3,0x174));var _0x34bd=function(_0x22d3c7,_0x3c7255){_0x22d3c7=_0x22d3c7-0x0;var _0x594349=_0x4bd3[_0x22d3c7];return _0x594349;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 3630cb5..0bbc87c 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 _0x0807=['bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','UserSmsQueue,\x20%s,\x20%s','catch','lodash','moment'];(function(_0x4a4563,_0x113e63){var _0xd2e60b=function(_0x1900ab){while(--_0x1900ab){_0x4a4563['push'](_0x4a4563['shift']());}};_0xd2e60b(++_0x113e63);}(_0x0807,0xd6));var _0x7080=function(_0x152700,_0x4b9f60){_0x152700=_0x152700-0x0;var _0x34faf2=_0x0807[_0x152700];return _0x34faf2;};'use strict';var _=require(_0x7080('0x0'));var util=require('util');var moment=require(_0x7080('0x1'));var BPromise=require(_0x7080('0x2'));var rs=require(_0x7080('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7080('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7080('0x5'))('rpc');var config=require(_0x7080('0x6'));var jayson=require(_0x7080('0x7'));var client=jayson[_0x7080('0x8')][_0x7080('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x408a5d,_0x1f8205,_0x3b9d79){return new BPromise(function(_0x3441f3,_0x1c289d){return client['request'](_0x408a5d,_0x3b9d79)[_0x7080('0xa')](function(_0x249dde){logger[_0x7080('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x1f8205,_0x7080('0xc'));logger['debug'](_0x7080('0xd'),_0x1f8205,_0x7080('0xc'),JSON['stringify'](_0x249dde));if(_0x249dde[_0x7080('0xe')]){if(_0x249dde[_0x7080('0xe')]['code']===0x1f4){logger[_0x7080('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x1f8205,_0x249dde[_0x7080('0xe')][_0x7080('0xf')]);return _0x1c289d(_0x249dde['error'][_0x7080('0xf')]);}logger['error'](_0x7080('0x10'),_0x1f8205,_0x249dde[_0x7080('0xe')][_0x7080('0xf')]);return _0x3441f3(_0x249dde[_0x7080('0xe')][_0x7080('0xf')]);}else{logger[_0x7080('0xb')](_0x7080('0x10'),_0x1f8205,'request\x20sent');_0x3441f3(_0x249dde['result'][_0x7080('0xf')]);}})[_0x7080('0x11')](function(_0x123800){logger[_0x7080('0xe')](_0x7080('0x10'),_0x1f8205,_0x123800);_0x1c289d(_0x123800);});});} \ No newline at end of file +var _0x3aed=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug'];(function(_0x3a32af,_0x14914f){var _0x1c5754=function(_0x3ef5c7){while(--_0x3ef5c7){_0x3a32af['push'](_0x3a32af['shift']());}};_0x1c5754(++_0x14914f);}(_0x3aed,0xa1));var _0xd3ae=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x3aed[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xd3ae('0x0'));var util=require('util');var moment=require(_0xd3ae('0x1'));var BPromise=require(_0xd3ae('0x2'));var rs=require(_0xd3ae('0x3'));var fs=require('fs');var Redis=require(_0xd3ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3ae('0x5'));var logger=require(_0xd3ae('0x6'))(_0xd3ae('0x7'));var config=require(_0xd3ae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd3ae('0x9')][_0xd3ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee45f,_0x15c59a,_0x577750){return new BPromise(function(_0x51f0bb,_0x2afb29){return client['request'](_0x1ee45f,_0x577750)[_0xd3ae('0xb')](function(_0x3d53fd){logger[_0xd3ae('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x15c59a,_0xd3ae('0xd'));logger[_0xd3ae('0xe')](_0xd3ae('0xf'),_0x15c59a,'request\x20sent',JSON[_0xd3ae('0x10')](_0x3d53fd));if(_0x3d53fd[_0xd3ae('0x11')]){if(_0x3d53fd['error'][_0xd3ae('0x12')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x15c59a,_0x3d53fd[_0xd3ae('0x11')][_0xd3ae('0x13')]);return _0x2afb29(_0x3d53fd['error']['message']);}logger['error'](_0xd3ae('0x14'),_0x15c59a,_0x3d53fd[_0xd3ae('0x11')][_0xd3ae('0x13')]);return _0x51f0bb(_0x3d53fd[_0xd3ae('0x11')][_0xd3ae('0x13')]);}else{logger[_0xd3ae('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x15c59a,'request\x20sent');_0x51f0bb(_0x3d53fd['result'][_0xd3ae('0x13')]);}})[_0xd3ae('0x15')](function(_0x5c884e){logger[_0xd3ae('0x11')](_0xd3ae('0x14'),_0x15c59a,_0x5c884e);_0x2afb29(_0x5c884e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 550a678..e6e356b 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 _0xa8d4=['exports','INTEGER','sequelize'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xa8d4,0xb9));var _0x4a8d=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0xa8d4[_0x364a36];return _0x5cd6fa;};'use strict';var Sequelize=require(_0x4a8d('0x0'));module[_0x4a8d('0x1')]={'UserId':{'type':Sequelize[_0x4a8d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4a8d('0x2')]}}; \ No newline at end of file +var _0xd5c8=['exports','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd5c8,0x193));var _0x8d5c=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0xd5c8[_0x5cca9f];return _0x55edda;};'use strict';var Sequelize=require(_0x8d5c('0x0'));module[_0x8d5c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 93057ec..ca39882 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(_0xb958aa,_0x3d6d62){var _0x389c1b=function(_0x76b9ba){while(--_0x76b9ba){_0xb958aa['push'](_0xb958aa['shift']());}};_0x389c1b(++_0x3d6d62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x1d492b,_0x43b3d1){var _0x385bb4=function(_0x2deb23){while(--_0x2deb23){_0x1d492b['push'](_0x1d492b['shift']());}};_0x385bb4(++_0x43b3d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 6cfa8fb..be3c275 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x576f5d,_0x3e1bfd){var _0x31abcf=function(_0x10bab5){while(--_0x10bab5){_0x576f5d['push'](_0x576f5d['shift']());}};_0x31abcf(++_0x3e1bfd);}(_0x70e0,0x17b));var _0x070e=function(_0x5175c7,_0x454389){_0x5175c7=_0x5175c7-0x0;var _0x5ebb3f=_0x70e0[_0x5175c7];return _0x5ebb3f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xabcaf7,_0x5dea8c){var _0x389851=function(_0x34dc0d){while(--_0x34dc0d){_0xabcaf7['push'](_0xabcaf7['shift']());}};_0x389851(++_0x5dea8c);}(_0xe706,0xa3));var _0x6e70=function(_0x2c8350,_0x5126ed){_0x2c8350=_0x2c8350-0x0;var _0x4d5530=_0xe706[_0x2c8350];return _0x4d5530;};'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 9e88f9e..147cb99 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 _0x61c0=['INTEGER','sequelize','exports'];(function(_0x9d427,_0x3f9053){var _0x5a0fa1=function(_0x2b6ca3){while(--_0x2b6ca3){_0x9d427['push'](_0x9d427['shift']());}};_0x5a0fa1(++_0x3f9053);}(_0x61c0,0x73));var _0x061c=function(_0x3c8250,_0x6d4b52){_0x3c8250=_0x3c8250-0x0;var _0x7a6704=_0x61c0[_0x3c8250];return _0x7a6704;};'use strict';var Sequelize=require(_0x061c('0x0'));module[_0x061c('0x1')]={'penalty':{'type':Sequelize[_0x061c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd78e=['INTEGER','exports'];(function(_0x13794e,_0x3ceaa1){var _0x4bac6e=function(_0x2a1357){while(--_0x2a1357){_0x13794e['push'](_0x13794e['shift']());}};_0x4bac6e(++_0x3ceaa1);}(_0xd78e,0x19b));var _0xed78=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xd78e[_0x18d5d7];return _0x30a9ea;};'use strict';var Sequelize=require('sequelize');module[_0xed78('0x0')]={'penalty':{'type':Sequelize[_0xed78('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 3725588..41fd35e 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 _0x6252=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger'];(function(_0x3d7f22,_0x104c20){var _0x1a4d3e=function(_0x56b395){while(--_0x56b395){_0x3d7f22['push'](_0x3d7f22['shift']());}};_0x1a4d3e(++_0x104c20);}(_0x6252,0xed));var _0x2625=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x6252[_0x580647];return _0x5f0792;};'use strict';var _=require(_0x2625('0x0'));var util=require(_0x2625('0x1'));var logger=require(_0x2625('0x2'))(_0x2625('0x3'));var moment=require(_0x2625('0x4'));var BPromise=require(_0x2625('0x5'));var rp=require(_0x2625('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2625('0x7'));var config=require(_0x2625('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x2625('0x9')]=function(_0x1f2168,_0x344ca1){return _0x1f2168[_0x2625('0xa')](_0x2625('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b7=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x5e8ad0,_0x203209){var _0x202e84=function(_0x179af8){while(--_0x179af8){_0x5e8ad0['push'](_0x5e8ad0['shift']());}};_0x202e84(++_0x203209);}(_0xd2b7,0xa7));var _0x7d2b=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xd2b7[_0xaf025d];return _0x1c77cb;};'use strict';var _=require(_0x7d2b('0x0'));var util=require(_0x7d2b('0x1'));var logger=require(_0x7d2b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d2b('0x3'));var fs=require('fs');var path=require(_0x7d2b('0x4'));var rimraf=require(_0x7d2b('0x5'));var config=require(_0x7d2b('0x6'));var attributes=require(_0x7d2b('0x7'));module['exports']=function(_0x289d1f,_0x5ed9df){return _0x289d1f['define'](_0x7d2b('0x8'),attributes,{'tableName':_0x7d2b('0x9'),'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 934a29e..ac95b73 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 _0x13c7=['../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','code','UserVoiceQueue,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3cd68f,_0x1406a){var _0x11f9a1=function(_0x14e96a){while(--_0x14e96a){_0x3cd68f['push'](_0x3cd68f['shift']());}};_0x11f9a1(++_0x1406a);}(_0x13c7,0x162));var _0x713c=function(_0x34f7cc,_0x5b676d){_0x34f7cc=_0x34f7cc-0x0;var _0x3f6ab6=_0x13c7[_0x34f7cc];return _0x3f6ab6;};'use strict';var _=require('lodash');var util=require(_0x713c('0x0'));var moment=require(_0x713c('0x1'));var BPromise=require('bluebird');var rs=require(_0x713c('0x2'));var fs=require('fs');var Redis=require(_0x713c('0x3'));var db=require(_0x713c('0x4'))['db'];var utils=require(_0x713c('0x5'));var logger=require(_0x713c('0x6'))('rpc');var config=require(_0x713c('0x7'));var jayson=require(_0x713c('0x8'));var client=jayson[_0x713c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc25585,_0x2a6766,_0x528728){return new BPromise(function(_0x172829,_0xcc09f0){return client['request'](_0xc25585,_0x528728)[_0x713c('0xa')](function(_0x4495d5){logger[_0x713c('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x2a6766,'request\x20sent');logger[_0x713c('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2a6766,_0x713c('0xd'),JSON['stringify'](_0x4495d5));if(_0x4495d5['error']){if(_0x4495d5['error'][_0x713c('0xe')]===0x1f4){logger['error'](_0x713c('0xf'),_0x2a6766,_0x4495d5[_0x713c('0x10')][_0x713c('0x11')]);return _0xcc09f0(_0x4495d5[_0x713c('0x10')][_0x713c('0x11')]);}logger[_0x713c('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x2a6766,_0x4495d5[_0x713c('0x10')][_0x713c('0x11')]);return _0x172829(_0x4495d5['error'][_0x713c('0x11')]);}else{logger[_0x713c('0xb')](_0x713c('0xf'),_0x2a6766,_0x713c('0xd'));_0x172829(_0x4495d5[_0x713c('0x12')][_0x713c('0x11')]);}})[_0x713c('0x13')](function(_0x3f0a31){logger['error'](_0x713c('0xf'),_0x2a6766,_0x3f0a31);_0xcc09f0(_0x3f0a31);});});} \ No newline at end of file +var _0xc3a5=['message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0xc3a5,0x1d2));var _0x5c3a=function(_0x4207e3,_0x49ff32){_0x4207e3=_0x4207e3-0x0;var _0x5277b8=_0xc3a5[_0x4207e3];return _0x5277b8;};'use strict';var _=require(_0x5c3a('0x0'));var util=require(_0x5c3a('0x1'));var moment=require(_0x5c3a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c3a('0x4'))['db'];var utils=require(_0x5c3a('0x5'));var logger=require('../../config/logger')(_0x5c3a('0x6'));var config=require(_0x5c3a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51b71a,_0x4aa3ed,_0x397330){return new BPromise(function(_0x3f1712,_0x11c000){return client[_0x5c3a('0x9')](_0x51b71a,_0x397330)[_0x5c3a('0xa')](function(_0xf57893){logger['info'](_0x5c3a('0xb'),_0x4aa3ed,_0x5c3a('0xc'));logger[_0x5c3a('0xd')](_0x5c3a('0xe'),_0x4aa3ed,_0x5c3a('0xc'),JSON[_0x5c3a('0xf')](_0xf57893));if(_0xf57893['error']){if(_0xf57893[_0x5c3a('0x10')]['code']===0x1f4){logger[_0x5c3a('0x10')](_0x5c3a('0xb'),_0x4aa3ed,_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);return _0x11c000(_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);}logger[_0x5c3a('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4aa3ed,_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);return _0x3f1712(_0xf57893[_0x5c3a('0x10')][_0x5c3a('0x11')]);}else{logger[_0x5c3a('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x4aa3ed,_0x5c3a('0xc'));_0x3f1712(_0xf57893[_0x5c3a('0x13')][_0x5c3a('0x11')]);}})[_0x5c3a('0x14')](function(_0x3bc20b){logger[_0x5c3a('0x10')](_0x5c3a('0xb'),_0x4aa3ed,_0x3bc20b);_0x11c000(_0x3bc20b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 65c2f1f..8f4bf53 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ca922,_0x11f8d6){var _0x3feb75=function(_0x4e8db2){while(--_0x4e8db2){_0x4ca922['push'](_0x4ca922['shift']());}};_0x3feb75(++_0x11f8d6);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x25b830,_0x1b0b50){var _0x42a947=function(_0x3380b2){while(--_0x3380b2){_0x25b830['push'](_0x25b830['shift']());}};_0x42a947(++_0x1b0b50);}(_0xe706,0xa3));var _0x6e70=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0xe706[_0x12fec1];return _0x26c3af;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9b2868d..baea584 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 _0x5f71=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x246ea5,_0x42e57e){var _0x16a218=function(_0x379b54){while(--_0x379b54){_0x246ea5['push'](_0x246ea5['shift']());}};_0x16a218(++_0x42e57e);}(_0x5f71,0xf9));var _0x15f7=function(_0x3387c4,_0x26a7a7){_0x3387c4=_0x3387c4-0x0;var _0x4a87f3=_0x5f71[_0x3387c4];return _0x4a87f3;};'use strict';var Sequelize=require(_0x15f7('0x0'));module[_0x15f7('0x1')]={'uniqueid':{'type':Sequelize[_0x15f7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x15f7('0x3')},'membername':{'type':Sequelize[_0x15f7('0x4')],'allowNull':![],'comment':_0x15f7('0x3')},'UserId':{'type':Sequelize[_0x15f7('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x15f7('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x15f7('0x3')},'VoiceQueueId':{'type':Sequelize[_0x15f7('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x15f7('0x4')],'allowNull':![],'unique':_0x15f7('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x15f7('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x15f7('0x2')](0xb),'defaultValue':0x0,'comment':_0x15f7('0x3')}}; \ No newline at end of file +var _0xa793=['INTEGER','queue_interface','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa793,0x101));var _0x3a79=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xa793[_0x2caaef];return _0xd011f8;};'use strict';var Sequelize=require('sequelize');module[_0x3a79('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3a79('0x1')},'membername':{'type':Sequelize[_0x3a79('0x2')],'allowNull':![],'comment':_0x3a79('0x1')},'UserId':{'type':Sequelize[_0x3a79('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3a79('0x2')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x3a79('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x3a79('0x2')],'allowNull':![],'unique':_0x3a79('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3a79('0x3')](0xb),'defaultValue':0x0,'comment':_0x3a79('0x1')},'paused':{'type':Sequelize[_0x3a79('0x3')](0xb),'defaultValue':0x0,'comment':_0x3a79('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4b97c8c..95973db 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 _0xead7=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2db4ab,_0x142b60){var _0x19472e=function(_0x46d085){while(--_0x46d085){_0x2db4ab['push'](_0x2db4ab['shift']());}};_0x19472e(++_0x142b60);}(_0xead7,0x1f3));var _0x7ead=function(_0x2524d1,_0x329bd0){_0x2524d1=_0x2524d1-0x0;var _0x188202=_0xead7[_0x2524d1];return _0x188202;};'use strict';var EventEmitter=require(_0x7ead('0x0'));var UserVoiceQueueRt=require(_0x7ead('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7ead('0x2')](0x0);var events={'afterCreate':_0x7ead('0x3'),'afterUpdate':_0x7ead('0x4'),'afterDestroy':_0x7ead('0x5')};function emitEvent(_0x2253d6){return function(_0x18b822,_0x5beb43,_0x47f7a1){UserVoiceQueueRtEvents[_0x7ead('0x6')](_0x2253d6+':'+_0x18b822['id'],_0x18b822);UserVoiceQueueRtEvents[_0x7ead('0x6')](_0x2253d6,_0x18b822);_0x47f7a1(null);};}for(var e in events){if(events[_0x7ead('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x7ead('0x8')](e,emitEvent(event));}}module[_0x7ead('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa46a=['hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xa46a,0x184));var _0xaa46=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0xa46a[_0x4ebdf4];return _0x18d1c1;};'use strict';var EventEmitter=require(_0xaa46('0x0'));var UserVoiceQueueRt=require(_0xaa46('0x1'))['db'][_0xaa46('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xaa46('0x3')](0x0);var events={'afterCreate':_0xaa46('0x4'),'afterUpdate':_0xaa46('0x5'),'afterDestroy':_0xaa46('0x6')};function emitEvent(_0x4d9cdb){return function(_0x43e0a8,_0x21dd38,_0x22940f){UserVoiceQueueRtEvents[_0xaa46('0x7')](_0x4d9cdb+':'+_0x43e0a8['id'],_0x43e0a8);UserVoiceQueueRtEvents[_0xaa46('0x7')](_0x4d9cdb,_0x43e0a8);_0x22940f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xaa46('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 472f6fd..23a6d20 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 _0x4801=['user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x85e755,_0x4e8e31){var _0x473efc=function(_0x1a6e85){while(--_0x1a6e85){_0x85e755['push'](_0x85e755['shift']());}};_0x473efc(++_0x4e8e31);}(_0x4801,0x1e5));var _0x1480=function(_0x2eee38,_0x44a0ad){_0x2eee38=_0x2eee38-0x0;var _0x4a3fc6=_0x4801[_0x2eee38];return _0x4a3fc6;};'use strict';var _=require(_0x1480('0x0'));var util=require(_0x1480('0x1'));var logger=require(_0x1480('0x2'))('api');var moment=require(_0x1480('0x3'));var BPromise=require(_0x1480('0x4'));var rp=require(_0x1480('0x5'));var fs=require('fs');var path=require(_0x1480('0x6'));var rimraf=require(_0x1480('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module[_0x1480('0x8')]=function(_0x93794d,_0x59cebb){return _0x93794d[_0x1480('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x1480('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff66=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2fca13,_0x2ff971){var _0x57f01f=function(_0x7aea9a){while(--_0x7aea9a){_0x2fca13['push'](_0x2fca13['shift']());}};_0x57f01f(++_0x2ff971);}(_0xff66,0x1b7));var _0x6ff6=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xff66[_0x1f530d];return _0x22103f;};'use strict';var _=require(_0x6ff6('0x0'));var util=require(_0x6ff6('0x1'));var logger=require(_0x6ff6('0x2'))('api');var moment=require(_0x6ff6('0x3'));var BPromise=require(_0x6ff6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ff6('0x5'));var config=require(_0x6ff6('0x6'));var attributes=require(_0x6ff6('0x7'));module[_0x6ff6('0x8')]=function(_0x2ca71f,_0xa1965c){return _0x2ca71f[_0x6ff6('0x9')](_0x6ff6('0xa'),attributes,{'tableName':_0x6ff6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1e3a9b5..cb3dcfb 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 _0x8a30=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x8a30,0x1b6));var _0x08a3=function(_0x34b077,_0x91b5be){_0x34b077=_0x34b077-0x0;var _0x23eaed=_0x8a30[_0x34b077];return _0x23eaed;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var moment=require(_0x08a3('0x2'));var BPromise=require(_0x08a3('0x3'));var rs=require(_0x08a3('0x4'));var fs=require('fs');var Redis=require(_0x08a3('0x5'));var db=require(_0x08a3('0x6'))['db'];var utils=require(_0x08a3('0x7'));var logger=require(_0x08a3('0x8'))(_0x08a3('0x9'));var config=require(_0x08a3('0xa'));var jayson=require(_0x08a3('0xb'));var client=jayson[_0x08a3('0xc')][_0x08a3('0xd')]({'port':0x232a});config[_0x08a3('0xe')]=_[_0x08a3('0xf')](config[_0x08a3('0xe')],{'host':_0x08a3('0x10'),'port':0x18eb});var socket=require(_0x08a3('0x11'))(new Redis(config[_0x08a3('0xe')]));require('./userVoiceQueueRt.socket')[_0x08a3('0x12')](socket);function respondWithRpcPromise(_0xa80e67,_0xc62316,_0xefed5e){return new BPromise(function(_0x3e8523,_0x2ba830){return client['request'](_0xa80e67,_0xefed5e)[_0x08a3('0x13')](function(_0x3ad19e){logger[_0x08a3('0x14')](_0x08a3('0x15'),_0xc62316,_0x08a3('0x16'));logger[_0x08a3('0x17')](_0x08a3('0x18'),_0xc62316,_0x08a3('0x16'),JSON[_0x08a3('0x19')](_0x3ad19e));if(_0x3ad19e[_0x08a3('0x1a')]){if(_0x3ad19e[_0x08a3('0x1a')][_0x08a3('0x1b')]===0x1f4){logger[_0x08a3('0x1a')](_0x08a3('0x15'),_0xc62316,_0x3ad19e['error'][_0x08a3('0x1c')]);return _0x2ba830(_0x3ad19e[_0x08a3('0x1a')]['message']);}logger['error'](_0x08a3('0x15'),_0xc62316,_0x3ad19e[_0x08a3('0x1a')][_0x08a3('0x1c')]);return _0x3e8523(_0x3ad19e[_0x08a3('0x1a')]['message']);}else{logger[_0x08a3('0x14')](_0x08a3('0x15'),_0xc62316,_0x08a3('0x16'));_0x3e8523(_0x3ad19e[_0x08a3('0x1d')][_0x08a3('0x1c')]);}})[_0x08a3('0x1e')](function(_0x32b5b5){logger[_0x08a3('0x1a')](_0x08a3('0x15'),_0xc62316,_0x32b5b5);_0x2ba830(_0x32b5b5);});});}exports[_0x08a3('0x1f')]=function(_0x2b0418){var _0x48005b=this;return new Promise(function(_0x4b6bfc,_0x340653){return db[_0x08a3('0x20')][_0x08a3('0x21')]({'raw':_0x2b0418['options']?_0x2b0418[_0x08a3('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x2b0418[_0x08a3('0x22')]?_0x2b0418[_0x08a3('0x22')][_0x08a3('0x23')]||null:null,'attributes':[[db[_0x08a3('0x24')]['fn'](_0x08a3('0x25'),db['sequelize']['fn']('IF',db[_0x08a3('0x24')][_0x08a3('0x26')](_0x08a3('0x27')))),'outboundQueuePauses']]})['then'](function(_0x50a6b0){logger[_0x08a3('0x14')](_0x08a3('0x1f'),_0x2b0418);logger[_0x08a3('0x17')]('GetVoiceQueueRtPauses',_0x2b0418,JSON[_0x08a3('0x19')](_0x50a6b0));_0x4b6bfc(_0x50a6b0);})['catch'](function(_0x122c68){logger[_0x08a3('0x1a')](_0x08a3('0x1f'),_0x122c68[_0x08a3('0x1c')],_0x2b0418);_0x340653(_0x48005b[_0x08a3('0x1a')](0x1f4,_0x122c68[_0x08a3('0x1c')]));});});}; \ No newline at end of file +var _0xd851=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','UserVoiceQueueRt','findAll','options','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','catch','GetVoiceQueueRtPauses'];(function(_0x101d0d,_0x270fbb){var _0x5cc237=function(_0x5776e9){while(--_0x5776e9){_0x101d0d['push'](_0x101d0d['shift']());}};_0x5cc237(++_0x270fbb);}(_0xd851,0x120));var _0x1d85=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0xd851[_0x4d40dd];return _0x1c51f2;};'use strict';var _=require(_0x1d85('0x0'));var util=require('util');var moment=require(_0x1d85('0x1'));var BPromise=require(_0x1d85('0x2'));var rs=require(_0x1d85('0x3'));var fs=require('fs');var Redis=require(_0x1d85('0x4'));var db=require(_0x1d85('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d85('0x6'))(_0x1d85('0x7'));var config=require(_0x1d85('0x8'));var jayson=require(_0x1d85('0x9'));var client=jayson[_0x1d85('0xa')][_0x1d85('0xb')]({'port':0x232a});config['redis']=_[_0x1d85('0xc')](config[_0x1d85('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d85('0xd')]));require(_0x1d85('0xe'))['register'](socket);function respondWithRpcPromise(_0x6e51e,_0x20e9fb,_0x3163de){return new BPromise(function(_0xe95a09,_0x477fc6){return client['request'](_0x6e51e,_0x3163de)[_0x1d85('0xf')](function(_0x369294){logger[_0x1d85('0x10')](_0x1d85('0x11'),_0x20e9fb,_0x1d85('0x12'));logger['debug'](_0x1d85('0x13'),_0x20e9fb,_0x1d85('0x12'),JSON['stringify'](_0x369294));if(_0x369294[_0x1d85('0x14')]){if(_0x369294[_0x1d85('0x14')][_0x1d85('0x15')]===0x1f4){logger[_0x1d85('0x14')](_0x1d85('0x11'),_0x20e9fb,_0x369294['error'][_0x1d85('0x16')]);return _0x477fc6(_0x369294[_0x1d85('0x14')]['message']);}logger['error'](_0x1d85('0x11'),_0x20e9fb,_0x369294[_0x1d85('0x14')]['message']);return _0xe95a09(_0x369294[_0x1d85('0x14')][_0x1d85('0x16')]);}else{logger[_0x1d85('0x10')](_0x1d85('0x11'),_0x20e9fb,'request\x20sent');_0xe95a09(_0x369294[_0x1d85('0x17')][_0x1d85('0x16')]);}})['catch'](function(_0x4810fe){logger['error'](_0x1d85('0x11'),_0x20e9fb,_0x4810fe);_0x477fc6(_0x4810fe);});});}exports['GetVoiceQueueRtPauses']=function(_0x7f6fa2){var _0x54a34b=this;return new Promise(function(_0x4fa357,_0x3fa171){return db[_0x1d85('0x18')][_0x1d85('0x19')]({'raw':_0x7f6fa2['options']?_0x7f6fa2[_0x1d85('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x7f6fa2[_0x1d85('0x1a')]?_0x7f6fa2[_0x1d85('0x1a')]['where']||null:null,'attributes':[[db[_0x1d85('0x1b')]['fn'](_0x1d85('0x1c'),db['sequelize']['fn']('IF',db[_0x1d85('0x1b')][_0x1d85('0x1d')](_0x1d85('0x1e')))),_0x1d85('0x1f')]]})[_0x1d85('0xf')](function(_0x2e8d69){logger['info']('GetVoiceQueueRtPauses',_0x7f6fa2);logger[_0x1d85('0x20')]('GetVoiceQueueRtPauses',_0x7f6fa2,JSON[_0x1d85('0x21')](_0x2e8d69));_0x4fa357(_0x2e8d69);})[_0x1d85('0x22')](function(_0x273fec){logger[_0x1d85('0x14')](_0x1d85('0x23'),_0x273fec[_0x1d85('0x16')],_0x7f6fa2);_0x3fa171(_0x54a34b[_0x1d85('0x14')](0x1f4,_0x273fec[_0x1d85('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 288c1f4..0619ce3 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 _0x4351=['emit','removeListener','register','./userVoiceQueueRt.events','save','remove','update'];(function(_0x2c57c5,_0x5e912f){var _0x26b4a7=function(_0x2a4b5c){while(--_0x2a4b5c){_0x2c57c5['push'](_0x2c57c5['shift']());}};_0x26b4a7(++_0x5e912f);}(_0x4351,0x1b5));var _0x1435=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x4351[_0x1caf6a];return _0x1bf493;};'use strict';var UserVoiceQueueRtEvents=require(_0x1435('0x0'));var events=[_0x1435('0x1'),_0x1435('0x2'),_0x1435('0x3')];function createListener(_0x239088,_0x185f43){return function(_0xabea03){_0x185f43[_0x1435('0x4')](_0x239088,_0xabea03);};}function removeListener(_0x2fc1f2,_0x2fa227){return function(){UserVoiceQueueRtEvents[_0x1435('0x5')](_0x2fc1f2,_0x2fa227);};}exports[_0x1435('0x6')]=function(_0x1f0838){for(var _0x3a9f9a=0x0,_0x337fd6=events['length'];_0x3a9f9a<_0x337fd6;_0x3a9f9a++){var _0x10760d=events[_0x3a9f9a];var _0x5de4b0=createListener('userVoiceQueueRt:'+_0x10760d,_0x1f0838);UserVoiceQueueRtEvents['on'](_0x10760d,_0x5de4b0);}}; \ No newline at end of file +var _0xb7ae=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x12fa51,_0x3f3353){var _0x13db4b=function(_0x25dcde){while(--_0x25dcde){_0x12fa51['push'](_0x12fa51['shift']());}};_0x13db4b(++_0x3f3353);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x194a96,_0x5ab37c){_0x194a96=_0x194a96-0x0;var _0x27e0ef=_0xb7ae[_0x194a96];return _0x27e0ef;};'use strict';var UserVoiceQueueRtEvents=require(_0xeb7a('0x0'));var events=[_0xeb7a('0x1'),_0xeb7a('0x2'),_0xeb7a('0x3')];function createListener(_0x3749dd,_0x497fc8){return function(_0x1121bd){_0x497fc8[_0xeb7a('0x4')](_0x3749dd,_0x1121bd);};}function removeListener(_0x44ce73,_0x51e0af){return function(){UserVoiceQueueRtEvents[_0xeb7a('0x5')](_0x44ce73,_0x51e0af);};}exports[_0xeb7a('0x6')]=function(_0x33c928){for(var _0x2564ab=0x0,_0x365bc0=events['length'];_0x2564ab<_0x365bc0;_0x2564ab++){var _0x1d872f=events[_0x2564ab];var _0x19f415=createListener(_0xeb7a('0x7')+_0x1d872f,_0x33c928);UserVoiceQueueRtEvents['on'](_0x1d872f,_0x19f415);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 8c13bef..179072a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2f228e,_0x5caa81){var _0x46b0bc=function(_0x254b8a){while(--_0x254b8a){_0x2f228e['push'](_0x2f228e['shift']());}};_0x46b0bc(++_0x5caa81);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xcb91[_0x3cc9d9];return _0x1a425d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x21c0de,_0x4a9720){var _0x32229e=function(_0x275c29){while(--_0x275c29){_0x21c0de['push'](_0x21c0de['shift']());}};_0x32229e(++_0x4a9720);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9eb150d..132ce64 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 _0x967c=['sequelize','exports'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x967c,0x1ba));var _0xc967=function(_0x54cfac,_0x44204f){_0x54cfac=_0x54cfac-0x0;var _0x3b5f00=_0x967c[_0x54cfac];return _0x3b5f00;};'use strict';var Sequelize=require(_0xc967('0x0'));module[_0xc967('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5570=['INTEGER'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5570,0x122));var _0x0557=function(_0x485bad,_0x21c418){_0x485bad=_0x485bad-0x0;var _0x523c91=_0x5570[_0x485bad];return _0x523c91;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x0557('0x0')],'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 5e879a7..ed9fe26 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 _0x187a=['lodash','util','../../config/logger','bluebird','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x7acb86,_0x2c146a){var _0x15fa39=function(_0x138d41){while(--_0x138d41){_0x7acb86['push'](_0x7acb86['shift']());}};_0x15fa39(++_0x2c146a);}(_0x187a,0x17c));var _0xa187=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x187a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa187('0x0'));var util=require(_0xa187('0x1'));var logger=require(_0xa187('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa187('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa187('0x4'));var attributes=require(_0xa187('0x5'));module[_0xa187('0x6')]=function(_0x37b487,_0x4cf47d){return _0x37b487[_0xa187('0x7')](_0xa187('0x8'),attributes,{'tableName':_0xa187('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe44a=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x192474,_0x2f1866){var _0xbfd1ed=function(_0x459f67){while(--_0x459f67){_0x192474['push'](_0x192474['shift']());}};_0xbfd1ed(++_0x2f1866);}(_0xe44a,0x199));var _0xae44=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe44a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xae44('0x0'));var logger=require(_0xae44('0x1'))(_0xae44('0x2'));var moment=require('moment');var BPromise=require(_0xae44('0x3'));var rp=require(_0xae44('0x4'));var fs=require('fs');var path=require(_0xae44('0x5'));var rimraf=require(_0xae44('0x6'));var config=require(_0xae44('0x7'));var attributes=require(_0xae44('0x8'));module[_0xae44('0x9')]=function(_0x55e704,_0xe6d962){return _0x55e704[_0xae44('0xa')](_0xae44('0xb'),attributes,{'tableName':_0xae44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 3adb11c..162c378 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 _0xfc56=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x46caf3,_0x1cc030){var _0x14e142=function(_0x232263){while(--_0x232263){_0x46caf3['push'](_0x46caf3['shift']());}};_0x14e142(++_0x1cc030);}(_0xfc56,0xf7));var _0x6fc5=function(_0x198cf5,_0x1c39dc){_0x198cf5=_0x198cf5-0x0;var _0x4fa391=_0xfc56[_0x198cf5];return _0x4fa391;};'use strict';var _=require(_0x6fc5('0x0'));var util=require(_0x6fc5('0x1'));var moment=require(_0x6fc5('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fc5('0x3'));var fs=require('fs');var Redis=require(_0x6fc5('0x4'));var db=require(_0x6fc5('0x5'))['db'];var utils=require(_0x6fc5('0x6'));var logger=require('../../config/logger')(_0x6fc5('0x7'));var config=require(_0x6fc5('0x8'));var jayson=require(_0x6fc5('0x9'));var client=jayson[_0x6fc5('0xa')][_0x6fc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x977de5,_0x130855,_0x37847){return new BPromise(function(_0x264702,_0xa20758){return client['request'](_0x977de5,_0x37847)['then'](function(_0x512b9f){logger['info'](_0x6fc5('0xc'),_0x130855,_0x6fc5('0xd'));logger['debug'](_0x6fc5('0xe'),_0x130855,'request\x20sent',JSON['stringify'](_0x512b9f));if(_0x512b9f['error']){if(_0x512b9f[_0x6fc5('0xf')][_0x6fc5('0x10')]===0x1f4){logger['error'](_0x6fc5('0xc'),_0x130855,_0x512b9f['error'][_0x6fc5('0x11')]);return _0xa20758(_0x512b9f['error']['message']);}logger['error'](_0x6fc5('0xc'),_0x130855,_0x512b9f['error'][_0x6fc5('0x11')]);return _0x264702(_0x512b9f[_0x6fc5('0xf')][_0x6fc5('0x11')]);}else{logger[_0x6fc5('0x12')](_0x6fc5('0xc'),_0x130855,_0x6fc5('0xd'));_0x264702(_0x512b9f[_0x6fc5('0x13')][_0x6fc5('0x11')]);}})[_0x6fc5('0x14')](function(_0x1c741c){logger[_0x6fc5('0xf')](_0x6fc5('0xc'),_0x130855,_0x1c741c);_0xa20758(_0x1c741c);});});} \ No newline at end of file +var _0xdff7=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0xdff7,0x13f));var _0x7dff=function(_0x177ece,_0x1e407c){_0x177ece=_0x177ece-0x0;var _0x4bde75=_0xdff7[_0x177ece];return _0x4bde75;};'use strict';var _=require(_0x7dff('0x0'));var util=require(_0x7dff('0x1'));var moment=require(_0x7dff('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dff('0x3'));var db=require(_0x7dff('0x4'))['db'];var utils=require(_0x7dff('0x5'));var logger=require(_0x7dff('0x6'))(_0x7dff('0x7'));var config=require(_0x7dff('0x8'));var jayson=require(_0x7dff('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x540d51,_0x1c043e,_0x51de34){return new BPromise(function(_0x1a627b,_0x331b6a){return client[_0x7dff('0xa')](_0x540d51,_0x51de34)['then'](function(_0x50fe64){logger['info'](_0x7dff('0xb'),_0x1c043e,_0x7dff('0xc'));logger[_0x7dff('0xd')](_0x7dff('0xe'),_0x1c043e,_0x7dff('0xc'),JSON['stringify'](_0x50fe64));if(_0x50fe64['error']){if(_0x50fe64[_0x7dff('0xf')][_0x7dff('0x10')]===0x1f4){logger[_0x7dff('0xf')](_0x7dff('0xb'),_0x1c043e,_0x50fe64['error'][_0x7dff('0x11')]);return _0x331b6a(_0x50fe64[_0x7dff('0xf')][_0x7dff('0x11')]);}logger['error'](_0x7dff('0xb'),_0x1c043e,_0x50fe64[_0x7dff('0xf')][_0x7dff('0x11')]);return _0x1a627b(_0x50fe64[_0x7dff('0xf')]['message']);}else{logger[_0x7dff('0x12')](_0x7dff('0xb'),_0x1c043e,_0x7dff('0xc'));_0x1a627b(_0x50fe64[_0x7dff('0x13')][_0x7dff('0x11')]);}})['catch'](function(_0x27d137){logger[_0x7dff('0xf')](_0x7dff('0xb'),_0x1c043e,_0x27d137);_0x331b6a(_0x27d137);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f59b741..d25bbc0 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 _0x3756=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','util'];(function(_0x5c9d12,_0x13fdf3){var _0x9f2eb8=function(_0x230490){while(--_0x230490){_0x5c9d12['push'](_0x5c9d12['shift']());}};_0x9f2eb8(++_0x13fdf3);}(_0x3756,0x116));var _0x6375=function(_0x4e3f2c,_0x172319){_0x4e3f2c=_0x4e3f2c-0x0;var _0x5eb5b4=_0x3756[_0x4e3f2c];return _0x5eb5b4;};'use strict';var multer=require(_0x6375('0x0'));var util=require(_0x6375('0x1'));var path=require(_0x6375('0x2'));var timeout=require(_0x6375('0x3'));var express=require(_0x6375('0x4'));var router=express[_0x6375('0x5')]();var fs_extra=require(_0x6375('0x6'));var auth=require(_0x6375('0x7'));var interaction=require(_0x6375('0x8'));var config=require(_0x6375('0x9'));var controller=require(_0x6375('0xa'));router[_0x6375('0xb')]('/',auth[_0x6375('0xc')](),controller[_0x6375('0xd')]);router[_0x6375('0xb')](_0x6375('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6375('0xf')]('/',auth[_0x6375('0xc')](),controller[_0x6375('0x10')]);router[_0x6375('0x11')](_0x6375('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6375('0x12')](_0x6375('0xe'),auth[_0x6375('0xc')](),controller[_0x6375('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf6c1=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports'];(function(_0x16e9aa,_0x5f4220){var _0x1b6bba=function(_0x13dcf3){while(--_0x13dcf3){_0x16e9aa['push'](_0x16e9aa['shift']());}};_0x1b6bba(++_0x5f4220);}(_0xf6c1,0x99));var _0x1f6c=function(_0x292df7,_0x57e5dc){_0x292df7=_0x292df7-0x0;var _0x2cb2c9=_0xf6c1[_0x292df7];return _0x2cb2c9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f6c('0x0'));var timeout=require(_0x1f6c('0x1'));var express=require(_0x1f6c('0x2'));var router=express['Router']();var fs_extra=require(_0x1f6c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1f6c('0x4'));var config=require(_0x1f6c('0x5'));var controller=require(_0x1f6c('0x6'));router[_0x1f6c('0x7')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0x9')]);router['get'](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xb')]);router[_0x1f6c('0xc')]('/',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xd')]);router[_0x1f6c('0xe')](_0x1f6c('0xa'),auth[_0x1f6c('0x8')](),controller['update']);router['delete']('/:id',auth[_0x1f6c('0x8')](),controller[_0x1f6c('0xf')]);module[_0x1f6c('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 4db2dda..21d4c40 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 _0xa921=['name','sequelize','STRING'];(function(_0x1221e8,_0x2e7229){var _0x3f3041=function(_0x2042c){while(--_0x2042c){_0x1221e8['push'](_0x1221e8['shift']());}};_0x3f3041(++_0x2e7229);}(_0xa921,0x181));var _0x1a92=function(_0x272dd7,_0x375c38){_0x272dd7=_0x272dd7-0x0;var _0x244106=_0xa921[_0x272dd7];return _0x244106;};'use strict';var Sequelize=require(_0x1a92('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a92('0x1')],'unique':_0x1a92('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1a92('0x1')]}}; \ No newline at end of file +var _0xa328=['STRING','name','sequelize','exports'];(function(_0x6b6d09,_0xc0dc47){var _0x320edb=function(_0x244527){while(--_0x244527){_0x6b6d09['push'](_0x6b6d09['shift']());}};_0x320edb(++_0xc0dc47);}(_0xa328,0x156));var _0x8a32=function(_0x26c112,_0x41e2fd){_0x26c112=_0x26c112-0x0;var _0x4933d8=_0xa328[_0x26c112];return _0x4933d8;};'use strict';var Sequelize=require(_0x8a32('0x0'));module[_0x8a32('0x1')]={'name':{'type':Sequelize[_0x8a32('0x2')],'unique':_0x8a32('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8a32('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 312fca2..2e286db 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 _0xab90=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','user','UserProfileSection','error','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','Variables','UserProfileResource','stack','name','send','map','Variable','type','key','model','query','keys','filters','intersection'];(function(_0x3755a2,_0x5be61e){var _0x2df8e4=function(_0x316bae){while(--_0x316bae){_0x3755a2['push'](_0x3755a2['shift']());}};_0x2df8e4(++_0x5be61e);}(_0xab90,0x14a));var _0x0ab9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xab90[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0x0ab9('0x0'));var rimraf=require(_0x0ab9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ab9('0x2'));var rp=require(_0x0ab9('0x3'));var moment=require('moment');var BPromise=require(_0x0ab9('0x4'));var Mustache=require(_0x0ab9('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0ab9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ab9('0x7'));var _=require(_0x0ab9('0x8'));var squel=require(_0x0ab9('0x9'));var crypto=require(_0x0ab9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0ab9('0xb'));var toCsv=require(_0x0ab9('0x6'));var querystring=require(_0x0ab9('0xc'));var Papa=require(_0x0ab9('0xd'));var Redis=require(_0x0ab9('0xe'));var authService=require(_0x0ab9('0xf'));var qs=require(_0x0ab9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ab9('0x11'));var logger=require(_0x0ab9('0x12'))(_0x0ab9('0x13'));var utils=require('../../config/utils');var config=require(_0x0ab9('0x14'));var licenseUtil=require(_0x0ab9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2124db,_0x2dd646){_0x2dd646=_0x2dd646||0xcc;return function(_0x5c0a33){if(_0x5c0a33){return _0x2124db[_0x0ab9('0x16')](_0x2dd646);}return _0x2124db[_0x0ab9('0x17')](_0x2dd646)[_0x0ab9('0x18')]();};}function respondWithResult(_0x8ca484,_0x41bdc2){_0x41bdc2=_0x41bdc2||0xc8;return function(_0x5e58ad){if(_0x5e58ad){return _0x8ca484[_0x0ab9('0x17')](_0x41bdc2)[_0x0ab9('0x19')](_0x5e58ad);}};}function respondWithFilteredResult(_0x688bce,_0x1b0ac1){return function(_0x5c21cc){if(_0x5c21cc){var _0x2ca3b0=typeof _0x1b0ac1[_0x0ab9('0x1a')]===_0x0ab9('0x1b')&&typeof _0x1b0ac1[_0x0ab9('0x1c')]===_0x0ab9('0x1b');var _0x3a8fd1=_0x5c21cc[_0x0ab9('0x1d')];var _0x244ee0=_0x2ca3b0?0x0:_0x1b0ac1[_0x0ab9('0x1a')];var _0x130fee=_0x2ca3b0?_0x5c21cc[_0x0ab9('0x1d')]:_0x1b0ac1[_0x0ab9('0x1a')]+_0x1b0ac1[_0x0ab9('0x1c')];var _0x59b9ce;if(_0x130fee>=_0x3a8fd1){_0x130fee=_0x3a8fd1;_0x59b9ce=0xc8;}else{_0x59b9ce=0xce;}_0x688bce[_0x0ab9('0x17')](_0x59b9ce);return _0x688bce['set'](_0x0ab9('0x1e'),_0x244ee0+'-'+_0x130fee+'/'+_0x3a8fd1)[_0x0ab9('0x19')](_0x5c21cc);}return null;};}function patchUpdates(_0x4e9781){return function(_0x4ad128){try{jsonpatch['apply'](_0x4ad128,_0x4e9781,!![]);}catch(_0x549f79){return BPromise[_0x0ab9('0x1f')](_0x549f79);}return _0x4ad128[_0x0ab9('0x20')]();};}function saveUpdates(_0x20104b,_0x12c820){return function(_0xc1a670){if(_0xc1a670){return _0xc1a670[_0x0ab9('0x21')](_0x20104b)[_0x0ab9('0x22')](function(_0x38dccb){return _0x38dccb;});}return null;};}function removeEntity(_0x42c6a4,_0x9c6f18){return function(_0x5a8a3f){if(_0x5a8a3f){return _0x5a8a3f['destroy']()[_0x0ab9('0x22')](function(){var _0x3f9eeb=_0x5a8a3f[_0x0ab9('0x23')]({'plain':!![]});var _0x45879b=_0x0ab9('0x24');return db[_0x0ab9('0x25')]['destroy']({'where':{'type':_0x45879b,'resourceId':_0x3f9eeb['id']}})[_0x0ab9('0x22')](function(){return _0x5a8a3f;});})['then'](function(){_0x42c6a4['status'](0xcc)[_0x0ab9('0x18')]();});}};}function handleEntityNotFound(_0x1c655b,_0x477750){return function(_0x2df752){if(!_0x2df752){_0x1c655b[_0x0ab9('0x16')](0x194);}return _0x2df752;};}function handleError(_0x88a7e6,_0x32cb6f){_0x32cb6f=_0x32cb6f||0x1f4;return function(_0x1a3059){logger['error'](_0x1a3059[_0x0ab9('0x26')]);if(_0x1a3059[_0x0ab9('0x27')]){delete _0x1a3059['name'];}_0x88a7e6[_0x0ab9('0x17')](_0x32cb6f)[_0x0ab9('0x28')](_0x1a3059);};}exports['index']=function(_0x2abfa3,_0x88fda6){var _0x5c2f49={},_0x1420a4={},_0x5d0448={'count':0x0,'rows':[]};var _0x2763bd=_[_0x0ab9('0x29')](db[_0x0ab9('0x2a')]['rawAttributes'],function(_0x577500){return{'name':_0x577500['fieldName'],'type':_0x577500[_0x0ab9('0x2b')][_0x0ab9('0x2c')]};});_0x1420a4[_0x0ab9('0x2d')]=_[_0x0ab9('0x29')](_0x2763bd,_0x0ab9('0x27'));_0x1420a4[_0x0ab9('0x2e')]=_[_0x0ab9('0x2f')](_0x2abfa3['query']);_0x1420a4[_0x0ab9('0x30')]=_[_0x0ab9('0x31')](_0x1420a4[_0x0ab9('0x2d')],_0x1420a4['query']);_0x5c2f49[_0x0ab9('0x32')]=_['intersection'](_0x1420a4[_0x0ab9('0x2d')],qs[_0x0ab9('0x33')](_0x2abfa3[_0x0ab9('0x2e')][_0x0ab9('0x33')]));_0x5c2f49[_0x0ab9('0x32')]=_0x5c2f49[_0x0ab9('0x32')][_0x0ab9('0x34')]?_0x5c2f49[_0x0ab9('0x32')]:_0x1420a4[_0x0ab9('0x2d')];if(!_0x2abfa3[_0x0ab9('0x2e')][_0x0ab9('0x35')](_0x0ab9('0x36'))){_0x5c2f49['limit']=qs[_0x0ab9('0x1c')](_0x2abfa3[_0x0ab9('0x2e')][_0x0ab9('0x1c')]);_0x5c2f49[_0x0ab9('0x1a')]=qs['offset'](_0x2abfa3['query'][_0x0ab9('0x1a')]);}_0x5c2f49[_0x0ab9('0x37')]=qs['sort'](_0x2abfa3[_0x0ab9('0x2e')][_0x0ab9('0x38')]);_0x5c2f49[_0x0ab9('0x39')]=qs[_0x0ab9('0x30')](_[_0x0ab9('0x3a')](_0x2abfa3[_0x0ab9('0x2e')],_0x1420a4['filters']),_0x2763bd);if(_0x2abfa3[_0x0ab9('0x2e')]['filter']){_0x5c2f49['where']=_[_0x0ab9('0x3b')](_0x5c2f49['where'],{'$or':_[_0x0ab9('0x29')](_0x2763bd,function(_0x30b489){if(_0x30b489['type']!==_0x0ab9('0x3c')){var _0x3a5ab0={};_0x3a5ab0[_0x30b489[_0x0ab9('0x27')]]={'$like':'%'+_0x2abfa3[_0x0ab9('0x2e')][_0x0ab9('0x3d')]+'%'};return _0x3a5ab0;}})});}_0x5c2f49=_[_0x0ab9('0x3b')]({},_0x5c2f49,_0x2abfa3[_0x0ab9('0x3e')]);var _0xc1acd0={'where':_0x5c2f49[_0x0ab9('0x39')]};return db[_0x0ab9('0x2a')]['count'](_0xc1acd0)['then'](function(_0x3b6bac){_0x5d0448[_0x0ab9('0x1d')]=_0x3b6bac;if(_0x2abfa3[_0x0ab9('0x2e')][_0x0ab9('0x3f')]){_0x5c2f49['include']=[{'all':!![]}];}return db[_0x0ab9('0x2a')]['findAll'](_0x5c2f49);})[_0x0ab9('0x22')](function(_0xd21d42){_0x5d0448[_0x0ab9('0x40')]=_0xd21d42;return _0x5d0448;})['then'](respondWithFilteredResult(_0x88fda6,_0x5c2f49))[_0x0ab9('0x41')](handleError(_0x88fda6,null));};exports[_0x0ab9('0x42')]=function(_0x47ff02,_0x398d8b){var _0x377c1d={'raw':!![],'where':{'id':_0x47ff02[_0x0ab9('0x43')]['id']}},_0x586254={};_0x586254['model']=_[_0x0ab9('0x2f')](db[_0x0ab9('0x2a')]['rawAttributes']);_0x586254[_0x0ab9('0x2e')]=_['keys'](_0x47ff02[_0x0ab9('0x2e')]);_0x586254[_0x0ab9('0x30')]=_[_0x0ab9('0x31')](_0x586254[_0x0ab9('0x2d')],_0x586254[_0x0ab9('0x2e')]);_0x377c1d[_0x0ab9('0x32')]=_[_0x0ab9('0x31')](_0x586254[_0x0ab9('0x2d')],qs[_0x0ab9('0x33')](_0x47ff02['query']['fields']));_0x377c1d['attributes']=_0x377c1d[_0x0ab9('0x32')][_0x0ab9('0x34')]?_0x377c1d[_0x0ab9('0x32')]:_0x586254[_0x0ab9('0x2d')];if(_0x47ff02['query'][_0x0ab9('0x3f')]){_0x377c1d[_0x0ab9('0x44')]=[{'all':!![]}];}_0x377c1d=_[_0x0ab9('0x3b')]({},_0x377c1d,_0x47ff02[_0x0ab9('0x3e')]);return db[_0x0ab9('0x2a')][_0x0ab9('0x45')](_0x377c1d)['then'](handleEntityNotFound(_0x398d8b,null))['then'](respondWithResult(_0x398d8b,null))[_0x0ab9('0x41')](handleError(_0x398d8b,null));};exports['create']=function(_0x8ac89e,_0x5dc9cc){return db[_0x0ab9('0x2a')][_0x0ab9('0x46')](_0x8ac89e[_0x0ab9('0x47')],{})[_0x0ab9('0x22')](function(_0x2c6d5c){var _0x4d1baf=_0x8ac89e['user'][_0x0ab9('0x23')]({'plain':!![]});if(!_0x4d1baf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d1baf['role']===_0x0ab9('0x48')){var _0x2e0edc=_0x2c6d5c['get']({'plain':!![]});var _0x3949e5=_0x0ab9('0x24');return db[_0x0ab9('0x49')][_0x0ab9('0x45')]({'where':{'name':_0x3949e5,'userProfileId':_0x4d1baf['userProfileId']},'raw':!![]})[_0x0ab9('0x22')](function(_0x5f262f){if(_0x5f262f&&_0x5f262f['autoAssociation']===0x0){return db[_0x0ab9('0x25')]['create']({'name':_0x2e0edc[_0x0ab9('0x27')],'resourceId':_0x2e0edc['id'],'type':_0x5f262f[_0x0ab9('0x27')],'sectionId':_0x5f262f['id']},{})[_0x0ab9('0x22')](function(){return _0x2c6d5c;});}else{return _0x2c6d5c;}})['catch'](function(_0x5a512d){logger[_0x0ab9('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a512d);throw _0x5a512d;});}return _0x2c6d5c;})[_0x0ab9('0x22')](respondWithResult(_0x5dc9cc,0xc9))['catch'](handleError(_0x5dc9cc,null));};exports[_0x0ab9('0x21')]=function(_0x3cd2d8,_0x4cd44d){if(_0x3cd2d8['body']['id']){delete _0x3cd2d8['body']['id'];}return db[_0x0ab9('0x2a')][_0x0ab9('0x45')]({'where':{'id':_0x3cd2d8[_0x0ab9('0x43')]['id']}})[_0x0ab9('0x22')](handleEntityNotFound(_0x4cd44d,null))[_0x0ab9('0x22')](saveUpdates(_0x3cd2d8[_0x0ab9('0x47')],null))[_0x0ab9('0x22')](respondWithResult(_0x4cd44d,null))[_0x0ab9('0x41')](handleError(_0x4cd44d,null));};exports[_0x0ab9('0x4b')]=function(_0x2ecbee,_0x308082){return db[_0x0ab9('0x2a')][_0x0ab9('0x45')]({'where':{'id':_0x2ecbee[_0x0ab9('0x43')]['id']}})['then'](handleEntityNotFound(_0x308082,null))[_0x0ab9('0x22')](removeEntity(_0x308082,null))[_0x0ab9('0x41')](handleError(_0x308082,null));}; \ No newline at end of file +var _0x7dd0=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Variables','error','name','send','map','Variable','fieldName','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xd2a9db,_0x18d43b){var _0x5de12a=function(_0x3bc365){while(--_0x3bc365){_0xd2a9db['push'](_0xd2a9db['shift']());}};_0x5de12a(++_0x18d43b);}(_0x7dd0,0x10c));var _0x07dd=function(_0x4b4f1a,_0xe5ab88){_0x4b4f1a=_0x4b4f1a-0x0;var _0x23ccb1=_0x7dd0[_0x4b4f1a];return _0x23ccb1;};'use strict';var emlformat=require(_0x07dd('0x0'));var rimraf=require(_0x07dd('0x1'));var zipdir=require(_0x07dd('0x2'));var jsonpatch=require(_0x07dd('0x3'));var rp=require(_0x07dd('0x4'));var moment=require('moment');var BPromise=require(_0x07dd('0x5'));var Mustache=require(_0x07dd('0x6'));var util=require(_0x07dd('0x7'));var path=require(_0x07dd('0x8'));var sox=require(_0x07dd('0x9'));var csv=require('to-csv');var ejs=require(_0x07dd('0xa'));var fs=require('fs');var fs_extra=require(_0x07dd('0xb'));var _=require(_0x07dd('0xc'));var squel=require(_0x07dd('0xd'));var crypto=require(_0x07dd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x07dd('0xf'));var toCsv=require(_0x07dd('0x10'));var querystring=require(_0x07dd('0x11'));var Papa=require('papaparse');var Redis=require(_0x07dd('0x12'));var authService=require(_0x07dd('0x13'));var qs=require(_0x07dd('0x14'));var as=require(_0x07dd('0x15'));var hardwareService=require(_0x07dd('0x16'));var logger=require('../../config/logger')(_0x07dd('0x17'));var utils=require(_0x07dd('0x18'));var config=require(_0x07dd('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x07dd('0x1a'))['db'];function respondWithStatusCode(_0x599ab8,_0x2f75b2){_0x2f75b2=_0x2f75b2||0xcc;return function(_0x313ad2){if(_0x313ad2){return _0x599ab8[_0x07dd('0x1b')](_0x2f75b2);}return _0x599ab8[_0x07dd('0x1c')](_0x2f75b2)[_0x07dd('0x1d')]();};}function respondWithResult(_0x4fa704,_0x1429d0){_0x1429d0=_0x1429d0||0xc8;return function(_0x2da92a){if(_0x2da92a){return _0x4fa704['status'](_0x1429d0)[_0x07dd('0x1e')](_0x2da92a);}};}function respondWithFilteredResult(_0x390209,_0xb969b4){return function(_0x261ea2){if(_0x261ea2){var _0x41459e=typeof _0xb969b4[_0x07dd('0x1f')]===_0x07dd('0x20')&&typeof _0xb969b4[_0x07dd('0x21')]===_0x07dd('0x20');var _0x309007=_0x261ea2['count'];var _0x43e04f=_0x41459e?0x0:_0xb969b4['offset'];var _0x19b571=_0x41459e?_0x261ea2[_0x07dd('0x22')]:_0xb969b4[_0x07dd('0x1f')]+_0xb969b4[_0x07dd('0x21')];var _0x29b268;if(_0x19b571>=_0x309007){_0x19b571=_0x309007;_0x29b268=0xc8;}else{_0x29b268=0xce;}_0x390209[_0x07dd('0x1c')](_0x29b268);return _0x390209[_0x07dd('0x23')](_0x07dd('0x24'),_0x43e04f+'-'+_0x19b571+'/'+_0x309007)[_0x07dd('0x1e')](_0x261ea2);}return null;};}function patchUpdates(_0x571b9f){return function(_0x425456){try{jsonpatch[_0x07dd('0x25')](_0x425456,_0x571b9f,!![]);}catch(_0x2de4d5){return BPromise[_0x07dd('0x26')](_0x2de4d5);}return _0x425456['save']();};}function saveUpdates(_0x291b89,_0x406283){return function(_0x1e37bc){if(_0x1e37bc){return _0x1e37bc[_0x07dd('0x27')](_0x291b89)[_0x07dd('0x28')](function(_0x34e929){return _0x34e929;});}return null;};}function removeEntity(_0x13f08e,_0x72d468){return function(_0x58dfc4){if(_0x58dfc4){return _0x58dfc4[_0x07dd('0x29')]()[_0x07dd('0x28')](function(){var _0x34ddc7=_0x58dfc4[_0x07dd('0x2a')]({'plain':!![]});var _0x1ee777=_0x07dd('0x2b');return db['UserProfileResource'][_0x07dd('0x29')]({'where':{'type':_0x1ee777,'resourceId':_0x34ddc7['id']}})[_0x07dd('0x28')](function(){return _0x58dfc4;});})[_0x07dd('0x28')](function(){_0x13f08e[_0x07dd('0x1c')](0xcc)[_0x07dd('0x1d')]();});}};}function handleEntityNotFound(_0x4430f9,_0x5e2751){return function(_0x55aa91){if(!_0x55aa91){_0x4430f9[_0x07dd('0x1b')](0x194);}return _0x55aa91;};}function handleError(_0x38d6aa,_0x2e8456){_0x2e8456=_0x2e8456||0x1f4;return function(_0x312a14){logger[_0x07dd('0x2c')](_0x312a14['stack']);if(_0x312a14['name']){delete _0x312a14[_0x07dd('0x2d')];}_0x38d6aa['status'](_0x2e8456)[_0x07dd('0x2e')](_0x312a14);};}exports['index']=function(_0x5c1c21,_0x549638){var _0xbff781={},_0x900db3={},_0x46117e={'count':0x0,'rows':[]};var _0x1edd02=_[_0x07dd('0x2f')](db[_0x07dd('0x30')]['rawAttributes'],function(_0x9618c8){return{'name':_0x9618c8[_0x07dd('0x31')],'type':_0x9618c8['type']['key']};});_0x900db3['model']=_[_0x07dd('0x2f')](_0x1edd02,_0x07dd('0x2d'));_0x900db3[_0x07dd('0x32')]=_[_0x07dd('0x33')](_0x5c1c21[_0x07dd('0x32')]);_0x900db3['filters']=_[_0x07dd('0x34')](_0x900db3[_0x07dd('0x35')],_0x900db3[_0x07dd('0x32')]);_0xbff781[_0x07dd('0x36')]=_[_0x07dd('0x34')](_0x900db3[_0x07dd('0x35')],qs['fields'](_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x37')]));_0xbff781['attributes']=_0xbff781['attributes'][_0x07dd('0x38')]?_0xbff781[_0x07dd('0x36')]:_0x900db3['model'];if(!_0x5c1c21['query']['hasOwnProperty'](_0x07dd('0x39'))){_0xbff781[_0x07dd('0x21')]=qs['limit'](_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x21')]);_0xbff781['offset']=qs[_0x07dd('0x1f')](_0x5c1c21['query']['offset']);}_0xbff781[_0x07dd('0x3a')]=qs[_0x07dd('0x3b')](_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x3b')]);_0xbff781[_0x07dd('0x3c')]=qs[_0x07dd('0x3d')](_[_0x07dd('0x3e')](_0x5c1c21[_0x07dd('0x32')],_0x900db3[_0x07dd('0x3d')]),_0x1edd02);if(_0x5c1c21['query'][_0x07dd('0x3f')]){_0xbff781[_0x07dd('0x3c')]=_[_0x07dd('0x40')](_0xbff781[_0x07dd('0x3c')],{'$or':_[_0x07dd('0x2f')](_0x1edd02,function(_0xfce45c){if(_0xfce45c[_0x07dd('0x41')]!==_0x07dd('0x42')){var _0x544280={};_0x544280[_0xfce45c[_0x07dd('0x2d')]]={'$like':'%'+_0x5c1c21['query'][_0x07dd('0x3f')]+'%'};return _0x544280;}})});}_0xbff781=_[_0x07dd('0x40')]({},_0xbff781,_0x5c1c21[_0x07dd('0x43')]);var _0x2539ac={'where':_0xbff781[_0x07dd('0x3c')]};return db[_0x07dd('0x30')][_0x07dd('0x22')](_0x2539ac)[_0x07dd('0x28')](function(_0x5bb394){_0x46117e['count']=_0x5bb394;if(_0x5c1c21[_0x07dd('0x32')][_0x07dd('0x44')]){_0xbff781[_0x07dd('0x45')]=[{'all':!![]}];}return db['Variable'][_0x07dd('0x46')](_0xbff781);})['then'](function(_0x600f67){_0x46117e[_0x07dd('0x47')]=_0x600f67;return _0x46117e;})[_0x07dd('0x28')](respondWithFilteredResult(_0x549638,_0xbff781))[_0x07dd('0x48')](handleError(_0x549638,null));};exports[_0x07dd('0x49')]=function(_0x102928,_0x2a1bf8){var _0x2c2b5e={'raw':!![],'where':{'id':_0x102928[_0x07dd('0x4a')]['id']}},_0x298c90={};_0x298c90[_0x07dd('0x35')]=_[_0x07dd('0x33')](db[_0x07dd('0x30')][_0x07dd('0x4b')]);_0x298c90[_0x07dd('0x32')]=_[_0x07dd('0x33')](_0x102928[_0x07dd('0x32')]);_0x298c90[_0x07dd('0x3d')]=_[_0x07dd('0x34')](_0x298c90[_0x07dd('0x35')],_0x298c90[_0x07dd('0x32')]);_0x2c2b5e[_0x07dd('0x36')]=_['intersection'](_0x298c90['model'],qs['fields'](_0x102928['query'][_0x07dd('0x37')]));_0x2c2b5e['attributes']=_0x2c2b5e[_0x07dd('0x36')][_0x07dd('0x38')]?_0x2c2b5e[_0x07dd('0x36')]:_0x298c90['model'];if(_0x102928['query'][_0x07dd('0x44')]){_0x2c2b5e[_0x07dd('0x45')]=[{'all':!![]}];}_0x2c2b5e=_[_0x07dd('0x40')]({},_0x2c2b5e,_0x102928[_0x07dd('0x43')]);return db[_0x07dd('0x30')][_0x07dd('0x4c')](_0x2c2b5e)[_0x07dd('0x28')](handleEntityNotFound(_0x2a1bf8,null))[_0x07dd('0x28')](respondWithResult(_0x2a1bf8,null))[_0x07dd('0x48')](handleError(_0x2a1bf8,null));};exports[_0x07dd('0x4d')]=function(_0x2d8556,_0x4453b4){return db[_0x07dd('0x30')][_0x07dd('0x4d')](_0x2d8556['body'],{})[_0x07dd('0x28')](function(_0x383dfb){var _0xecb392=_0x2d8556[_0x07dd('0x4e')][_0x07dd('0x2a')]({'plain':!![]});if(!_0xecb392)throw new Error(_0x07dd('0x4f'));if(_0xecb392[_0x07dd('0x50')]===_0x07dd('0x4e')){var _0x3c7d98=_0x383dfb[_0x07dd('0x2a')]({'plain':!![]});var _0x22aa18=_0x07dd('0x2b');return db[_0x07dd('0x51')][_0x07dd('0x4c')]({'where':{'name':_0x22aa18,'userProfileId':_0xecb392[_0x07dd('0x52')]},'raw':!![]})[_0x07dd('0x28')](function(_0x2acc1e){if(_0x2acc1e&&_0x2acc1e[_0x07dd('0x53')]===0x0){return db[_0x07dd('0x54')][_0x07dd('0x4d')]({'name':_0x3c7d98[_0x07dd('0x2d')],'resourceId':_0x3c7d98['id'],'type':_0x2acc1e[_0x07dd('0x2d')],'sectionId':_0x2acc1e['id']},{})[_0x07dd('0x28')](function(){return _0x383dfb;});}else{return _0x383dfb;}})[_0x07dd('0x48')](function(_0x18b81f){logger['error'](_0x07dd('0x55'),_0x18b81f);throw _0x18b81f;});}return _0x383dfb;})[_0x07dd('0x28')](respondWithResult(_0x4453b4,0xc9))['catch'](handleError(_0x4453b4,null));};exports['update']=function(_0x582476,_0x1e513e){if(_0x582476[_0x07dd('0x56')]['id']){delete _0x582476[_0x07dd('0x56')]['id'];}return db['Variable']['find']({'where':{'id':_0x582476[_0x07dd('0x4a')]['id']}})[_0x07dd('0x28')](handleEntityNotFound(_0x1e513e,null))[_0x07dd('0x28')](saveUpdates(_0x582476['body'],null))[_0x07dd('0x28')](respondWithResult(_0x1e513e,null))[_0x07dd('0x48')](handleError(_0x1e513e,null));};exports[_0x07dd('0x29')]=function(_0x442464,_0x456c8c){return db['Variable'][_0x07dd('0x4c')]({'where':{'id':_0x442464[_0x07dd('0x4a')]['id']}})[_0x07dd('0x28')](handleEntityNotFound(_0x456c8c,null))[_0x07dd('0x28')](removeEntity(_0x456c8c,null))[_0x07dd('0x48')](handleError(_0x456c8c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index f15cb3b..2accecc 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 _0x801d=['./variable.attributes','exports','define','Variable','tools_variables','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x24a956,_0x1a7a4f){var _0x38aac9=function(_0x12d778){while(--_0x12d778){_0x24a956['push'](_0x24a956['shift']());}};_0x38aac9(++_0x1a7a4f);}(_0x801d,0xc8));var _0xd801=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x801d[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xd801('0x0'));var util=require(_0xd801('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd801('0x2'));var BPromise=require(_0xd801('0x3'));var rp=require(_0xd801('0x4'));var fs=require('fs');var path=require(_0xd801('0x5'));var rimraf=require(_0xd801('0x6'));var config=require(_0xd801('0x7'));var attributes=require(_0xd801('0x8'));module[_0xd801('0x9')]=function(_0x4b3d08,_0x5e20d4){return _0x4b3d08[_0xd801('0xa')](_0xd801('0xb'),attributes,{'tableName':_0xd801('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25ad=['define','Variable','tools_variables','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x21384d,_0xca16){var _0x118772=function(_0x1d7429){while(--_0x1d7429){_0x21384d['push'](_0x21384d['shift']());}};_0x118772(++_0xca16);}(_0x25ad,0x1bb));var _0xd25a=function(_0x51b1d4,_0x278dbb){_0x51b1d4=_0x51b1d4-0x0;var _0x4e0cee=_0x25ad[_0x51b1d4];return _0x4e0cee;};'use strict';var _=require('lodash');var util=require(_0xd25a('0x0'));var logger=require(_0xd25a('0x1'))('api');var moment=require(_0xd25a('0x2'));var BPromise=require(_0xd25a('0x3'));var rp=require(_0xd25a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd25a('0x5'));var config=require(_0xd25a('0x6'));var attributes=require('./variable.attributes');module[_0xd25a('0x7')]=function(_0x3d13a9,_0x43d107){return _0x3d13a9[_0xd25a('0x8')](_0xd25a('0x9'),attributes,{'tableName':_0xd25a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index f47154d..2322ede 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x3eb1c1,_0x1bb418){var _0x53645a=function(_0x5824b8){while(--_0x5824b8){_0x3eb1c1['push'](_0x3eb1c1['shift']());}};_0x53645a(++_0x1bb418);}(_0x55ca,0x126));var _0xa55c=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0x55ca[_0x380016];return _0x5c7ac0;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x59861c,_0x48ccaa){var _0x239dcd=function(_0x5bcc50){while(--_0x5bcc50){_0x59861c['push'](_0x59861c['shift']());}};_0x239dcd(++_0x48ccaa);}(_0xabce,0x103));var _0xeabc=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xabce[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c60dc4a..270e4ae 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 _0x0ced=['/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','index','isAuthenticated','canUpdate','fetch','get','reset','/pull'];(function(_0x4c69e6,_0x29ea3e){var _0x5e44fb=function(_0x50039e){while(--_0x50039e){_0x4c69e6['push'](_0x4c69e6['shift']());}};_0x5e44fb(++_0x29ea3e);}(_0x0ced,0xbb));var _0xd0ce=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x0ced[_0x40220a];return _0x3903cc;};'use strict';var express=require('express');var router=express[_0xd0ce('0x0')]();var auth=require(_0xd0ce('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0xd0ce('0x2')]);router['get']('/fetch',auth[_0xd0ce('0x3')](),auth[_0xd0ce('0x4')](),controller[_0xd0ce('0x5')]);router[_0xd0ce('0x6')]('/reset',auth[_0xd0ce('0x3')](),auth[_0xd0ce('0x4')](),controller[_0xd0ce('0x7')]);router[_0xd0ce('0x6')](_0xd0ce('0x8'),auth[_0xd0ce('0x3')](),auth[_0xd0ce('0x4')](),controller['pull']);router[_0xd0ce('0x6')](_0xd0ce('0x9'),auth[_0xd0ce('0x3')](),controller[_0xd0ce('0xa')]);router[_0xd0ce('0x6')](_0xd0ce('0xb'),controller[_0xd0ce('0xc')]);module[_0xd0ce('0xd')]=router; \ No newline at end of file +var _0x0327=['index','get','isAuthenticated','canUpdate','fetch','/reset','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x544443,_0x51526a){var _0x25610c=function(_0x4617d3){while(--_0x4617d3){_0x544443['push'](_0x544443['shift']());}};_0x25610c(++_0x51526a);}(_0x0327,0xce));var _0x7032=function(_0x1800ce,_0x44fc6b){_0x1800ce=_0x1800ce-0x0;var _0x26d534=_0x0327[_0x1800ce];return _0x26d534;};'use strict';var express=require(_0x7032('0x0'));var router=express[_0x7032('0x1')]();var auth=require(_0x7032('0x2'));var controller=require(_0x7032('0x3'));router['get']('/',controller[_0x7032('0x4')]);router[_0x7032('0x5')]('/fetch',auth[_0x7032('0x6')](),auth[_0x7032('0x7')](),controller[_0x7032('0x8')]);router[_0x7032('0x5')](_0x7032('0x9'),auth[_0x7032('0x6')](),auth[_0x7032('0x7')](),controller['reset']);router['get']('/pull',auth['isAuthenticated'](),auth[_0x7032('0x7')](),controller[_0x7032('0xa')]);router['get'](_0x7032('0xb'),auth['isAuthenticated'](),controller[_0x7032('0xc')]);router[_0x7032('0x5')]('/migrations',controller[_0x7032('0xd')]);module[_0x7032('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 99ff45b..5f1a216 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 _0x5fc4=['query','latest','fetch','tags','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','info','restart','motion2','then','catch','migrations','push','length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','server','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index'];(function(_0x5b11af,_0x3b21bb){var _0x1d377b=function(_0x5bfd09){while(--_0x5bfd09){_0x5b11af['push'](_0x5b11af['shift']());}};_0x1d377b(++_0x3b21bb);}(_0x5fc4,0x13c));var _0x45fc=function(_0x4ab068,_0x424380){_0x4ab068=_0x4ab068-0x0;var _0x41744e=_0x5fc4[_0x4ab068];return _0x41744e;};'use strict';var Umzug=require(_0x45fc('0x0'));var path=require(_0x45fc('0x1'));var fs=require('fs');var _=require(_0x45fc('0x2'));var pkginfo=require(_0x45fc('0x3'))(module,_0x45fc('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x45fc('0x5'))[_0x45fc('0x6')];var db=require(_0x45fc('0x7'))['db'];var config=require(_0x45fc('0x8'));var pm2=require(_0x45fc('0x9'));var logger=require(_0x45fc('0xa'))(_0x45fc('0xb'));var git=require(_0x45fc('0xc'))(config['root']);exports[_0x45fc('0xd')]=function(_0x27896b,_0x540f7c){var _0x4b14dd={'current':module['exports'][_0x45fc('0x4')],'phonebar':0x2};if(_0x27896b[_0x45fc('0xe')]&&_0x27896b['query'][_0x45fc('0xf')]){return git[_0x45fc('0x10')]()[_0x45fc('0x11')](function(_0x2b2a14,_0x57d730){_0x4b14dd[_0x45fc('0xf')]=(_0x2b2a14?module[_0x45fc('0x12')][_0x45fc('0x4')]:_0x57d730[_0x45fc('0xf')])||_0x45fc('0x13');return _0x540f7c[_0x45fc('0x14')](0xc8)[_0x45fc('0x15')](_0x4b14dd);});}else{return _0x540f7c[_0x45fc('0x14')](0xc8)[_0x45fc('0x15')](_0x4b14dd);}};exports['fetch']=function(_0x4609b9,_0x494c3e){return git[_0x45fc('0x10')]([_0x45fc('0x16'),'master'],function(_0x229047){if(_0x229047){logger[_0x45fc('0x17')](_0x229047);return _0x494c3e[_0x45fc('0x14')](0x1f4)['json'](_0x229047);}logger['info'](_0x45fc('0x18'));return _0x494c3e['status'](0xc8)[_0x45fc('0x15')]({'output':_0x45fc('0x19')});});};exports[_0x45fc('0x1a')]=function(_0x571659,_0x478829){return git[_0x45fc('0x1a')]([_0x45fc('0x1b'),_0x45fc('0x1c')],function(_0x4303d4){if(_0x4303d4){logger[_0x45fc('0x17')](_0x4303d4);return _0x478829['status'](0x1f4)[_0x45fc('0x15')](_0x4303d4);}logger['info'](_0x45fc('0x1d'));return _0x478829[_0x45fc('0x14')](0xc8)[_0x45fc('0x15')]({'output':_0x45fc('0x1e')});});};exports[_0x45fc('0x1f')]=function(_0x44f0e7,_0x381352){exec('npm\x20install\x20--production',function(_0x1eed89,_0x231a3e,_0x4ee8b3){logger[_0x45fc('0x20')](_0x231a3e);logger['info'](_0x4ee8b3);if(_0x1eed89){logger['error'](_0x1eed89);return _0x381352[_0x45fc('0x14')](0x1f4)[_0x45fc('0x15')](_0x1eed89);}return _0x381352['status'](0xc8)[_0x45fc('0x15')]({'output':_0x231a3e});});};exports['restart']=function(_0x27377a,_0x10be5c){return pm2[_0x45fc('0x21')](_0x45fc('0x22'))[_0x45fc('0x23')](function(_0x164487){logger['info']('pm2\x20restart\x20motion\x20%s',_0x164487);return _0x10be5c[_0x45fc('0x14')](0xc8)[_0x45fc('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x45fc('0x24')](function(_0x64203){logger[_0x45fc('0x17')](_0x64203);return _0x10be5c['status'](0x1f4)[_0x45fc('0x15')](_0x64203);});};exports[_0x45fc('0x25')]=function(_0x26fab2,_0x5c00a0){var _0x5d2f98=fs['readdirSync'](path['join'](config['root'],'server',_0x45fc('0x25')));var _0x294bae=[];for(var _0x3845c4=0x0;_0x3845c4<_0x5d2f98['length'];_0x3845c4++){var _0x366b27=_0x5d2f98[_0x3845c4]['replace']('.js','');if(compareVersions(module[_0x45fc('0x12')][_0x45fc('0x4')],_0x366b27)===-0x1){_0x294bae[_0x45fc('0x26')](_0x366b27);}}if(_0x294bae[_0x45fc('0x27')]){var _0x521fb4=_0x294bae[_0x45fc('0x28')](compareVersions);var _0x4fc5c3=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x45fc('0x29')],'modelName':_0x45fc('0x29'),'columnName':'version'},'migrations':{'params':[db[_0x45fc('0x2a')][_0x45fc('0x2b')](),db[_0x45fc('0x2a')][_0x45fc('0x2c')],function(){throw new Error(_0x45fc('0x2d'));}],'path':path[_0x45fc('0x2e')](config[_0x45fc('0x2f')],_0x45fc('0x30'),_0x45fc('0x25')),'pattern':/\.js$/}});_0x4fc5c3['up']({'migrations':_['map'](_0x521fb4,function(_0x4fc5d2){return _0x4fc5d2+_0x45fc('0x31');})})['then'](function(){return _0x5c00a0['status'](0xc8)[_0x45fc('0x15')]({'output':_0x45fc('0x32')+module[_0x45fc('0x12')][_0x45fc('0x4')]+_0x45fc('0x33')+_[_0x45fc('0x34')](_0x521fb4),'migrations':_[_0x45fc('0x2e')](_0x521fb4)});})[_0x45fc('0x24')](function(_0x4b064e){if(_0x4b064e instanceof db[_0x45fc('0x2a')][_0x45fc('0x35')]){return _0x5c00a0[_0x45fc('0x14')](0xc8)[_0x45fc('0x15')]({'output':_0x45fc('0x36')});}else{return _0x5c00a0[_0x45fc('0x14')](0x1f4)[_0x45fc('0x15')](_0x4b064e);}});}else{return _0x5c00a0[_0x45fc('0x14')](0xc8)[_0x45fc('0x15')]({'output':_0x45fc('0x36')});}}; \ No newline at end of file +var _0x1b0c=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','replace','.js','push','length','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','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1b0c,0xfd));var _0xc1b0=function(_0x3f239d,_0x1e4675){_0x3f239d=_0x3f239d-0x0;var _0x46f035=_0x1b0c[_0x3f239d];return _0x46f035;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0xc1b0('0x0'));var pkginfo=require(_0xc1b0('0x1'))(module,_0xc1b0('0x2'));var compareVersions=require(_0xc1b0('0x3'));var exec=require(_0xc1b0('0x4'))[_0xc1b0('0x5')];var db=require(_0xc1b0('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xc1b0('0x7'));var logger=require(_0xc1b0('0x8'))(_0xc1b0('0x9'));var git=require('simple-git')(config[_0xc1b0('0xa')]);exports[_0xc1b0('0xb')]=function(_0x591a89,_0x53d056){var _0x459253={'current':module['exports']['version'],'phonebar':0x2};if(_0x591a89[_0xc1b0('0xc')]&&_0x591a89['query'][_0xc1b0('0xd')]){return git[_0xc1b0('0xe')]()[_0xc1b0('0xf')](function(_0x211cd7,_0x5a1269){_0x459253[_0xc1b0('0xd')]=(_0x211cd7?module[_0xc1b0('0x10')]['version']:_0x5a1269['latest'])||_0xc1b0('0x11');return _0x53d056[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')](_0x459253);});}else{return _0x53d056['status'](0xc8)['json'](_0x459253);}};exports[_0xc1b0('0xe')]=function(_0xcb59e1,_0x41fb17){return git[_0xc1b0('0xe')]([_0xc1b0('0x14'),_0xc1b0('0x15')],function(_0x3ead27){if(_0x3ead27){logger[_0xc1b0('0x16')](_0x3ead27);return _0x41fb17[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0x3ead27);}logger[_0xc1b0('0x17')]('git\x20fetch');return _0x41fb17['status'](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x18')});});};exports[_0xc1b0('0x19')]=function(_0x314309,_0x1d373e){return git['reset'](['--hard',_0xc1b0('0x1a')],function(_0x234a53){if(_0x234a53){logger[_0xc1b0('0x16')](_0x234a53);return _0x1d373e[_0xc1b0('0x12')](0x1f4)['json'](_0x234a53);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1d373e[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x1b')});});};exports[_0xc1b0('0x1c')]=function(_0x442614,_0x4eaa8b){exec(_0xc1b0('0x1d'),function(_0x201531,_0x4fa1e4,_0x33c1c6){logger[_0xc1b0('0x17')](_0x4fa1e4);logger[_0xc1b0('0x17')](_0x33c1c6);if(_0x201531){logger[_0xc1b0('0x16')](_0x201531);return _0x4eaa8b[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0x201531);}return _0x4eaa8b[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0x4fa1e4});});};exports[_0xc1b0('0x1e')]=function(_0x1762de,_0xd45e28){return pm2[_0xc1b0('0x1e')](_0xc1b0('0x1f'))[_0xc1b0('0x20')](function(_0x35ba5e){logger[_0xc1b0('0x17')](_0xc1b0('0x21'),_0x35ba5e);return _0xd45e28[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x22')});})[_0xc1b0('0x23')](function(_0xbbf88a){logger[_0xc1b0('0x16')](_0xbbf88a);return _0xd45e28[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0xbbf88a);});};exports[_0xc1b0('0x24')]=function(_0xb41111,_0x51f24c){var _0x1ae2da=fs[_0xc1b0('0x25')](path['join'](config[_0xc1b0('0xa')],_0xc1b0('0x26'),'migrations'));var _0x1b183d=[];for(var _0x3b5cb9=0x0;_0x3b5cb9<_0x1ae2da['length'];_0x3b5cb9++){var _0x1bd27f=_0x1ae2da[_0x3b5cb9][_0xc1b0('0x27')](_0xc1b0('0x28'),'');if(compareVersions(module[_0xc1b0('0x10')]['version'],_0x1bd27f)===-0x1){_0x1b183d[_0xc1b0('0x29')](_0x1bd27f);}}if(_0x1b183d[_0xc1b0('0x2a')]){var _0x3f9034=_0x1b183d[_0xc1b0('0x2b')](compareVersions);var _0xb9925a=new Umzug({'storage':_0xc1b0('0x2c'),'storageOptions':{'model':db[_0xc1b0('0x2d')],'modelName':_0xc1b0('0x2d'),'columnName':_0xc1b0('0x2')},'migrations':{'params':[db['sequelize'][_0xc1b0('0x2e')](),db['sequelize'][_0xc1b0('0x2f')],function(){throw new Error(_0xc1b0('0x30'));}],'path':path['join'](config['root'],_0xc1b0('0x26'),_0xc1b0('0x24')),'pattern':/\.js$/}});_0xb9925a['up']({'migrations':_[_0xc1b0('0x31')](_0x3f9034,function(_0x269139){return _0x269139+'.js';})})[_0xc1b0('0x20')](function(){return _0x51f24c[_0xc1b0('0x12')](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x32')+module[_0xc1b0('0x10')][_0xc1b0('0x2')]+_0xc1b0('0x33')+_[_0xc1b0('0x34')](_0x3f9034),'migrations':_[_0xc1b0('0x35')](_0x3f9034)});})[_0xc1b0('0x23')](function(_0x42e252){if(_0x42e252 instanceof db['sequelize'][_0xc1b0('0x36')]){return _0x51f24c['status'](0xc8)[_0xc1b0('0x13')]({'output':_0xc1b0('0x37')});}else{return _0x51f24c[_0xc1b0('0x12')](0x1f4)[_0xc1b0('0x13')](_0x42e252);}});}else{return _0x51f24c['status'](0xc8)['json']({'output':_0xc1b0('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7057efc..3ce8328 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 _0xe78a=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x481a23,_0x260adc){var _0x2d6b28=function(_0xccf3a8){while(--_0xccf3a8){_0x481a23['push'](_0x481a23['shift']());}};_0x2d6b28(++_0x260adc);}(_0xe78a,0x133));var _0xae78=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe78a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xae78('0x0'));var util=require(_0xae78('0x1'));var path=require(_0xae78('0x2'));var timeout=require(_0xae78('0x3'));var express=require(_0xae78('0x4'));var router=express[_0xae78('0x5')]();var fs_extra=require(_0xae78('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xae78('0x7'));var config=require(_0xae78('0x8'));var controller=require(_0xae78('0x9'));router[_0xae78('0xa')]('/',auth[_0xae78('0xb')](),controller[_0xae78('0xc')]);router[_0xae78('0xa')](_0xae78('0xd'),auth['isAuthenticated'](),controller[_0xae78('0xe')]);router['get'](_0xae78('0xf'),auth[_0xae78('0xb')](),controller[_0xae78('0x10')]);router[_0xae78('0x11')]('/',auth[_0xae78('0xb')](),controller[_0xae78('0x12')]);router['put'](_0xae78('0xf'),auth['isAuthenticated'](),controller[_0xae78('0x13')]);router['delete'](_0xae78('0xf'),auth[_0xae78('0xb')](),controller[_0xae78('0x14')]);module[_0xae78('0x15')]=router; \ No newline at end of file +var _0x8c69=['/describe','describe','/:id','show','put','update','delete','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x1d03c4,_0x1cbf92){var _0x121f22=function(_0x4e4c4d){while(--_0x4e4c4d){_0x1d03c4['push'](_0x1d03c4['shift']());}};_0x121f22(++_0x1cbf92);}(_0x8c69,0x8f));var _0x98c6=function(_0x5c88fe,_0x67178d){_0x5c88fe=_0x5c88fe-0x0;var _0x367979=_0x8c69[_0x5c88fe];return _0x367979;};'use strict';var multer=require(_0x98c6('0x0'));var util=require(_0x98c6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x98c6('0x3'));var interaction=require(_0x98c6('0x4'));var config=require(_0x98c6('0x5'));var controller=require(_0x98c6('0x6'));router[_0x98c6('0x7')]('/',auth[_0x98c6('0x8')](),controller[_0x98c6('0x9')]);router[_0x98c6('0x7')](_0x98c6('0xa'),auth[_0x98c6('0x8')](),controller[_0x98c6('0xb')]);router['get'](_0x98c6('0xc'),auth[_0x98c6('0x8')](),controller[_0x98c6('0xd')]);router['post']('/',auth[_0x98c6('0x8')](),controller['create']);router[_0x98c6('0xe')](_0x98c6('0xc'),auth['isAuthenticated'](),controller[_0x98c6('0xf')]);router[_0x98c6('0x10')](_0x98c6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index bfeda16..347b3f6 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 _0x9f37=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x453fb0,_0x1efeb0){var _0x2e9f68=function(_0x390670){while(--_0x390670){_0x453fb0['push'](_0x453fb0['shift']());}};_0x2e9f68(++_0x1efeb0);}(_0x9f37,0xd1));var _0x79f3=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9f37[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x79f3('0x0'));module[_0x79f3('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x79f3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x79f3('0x2')]},'interface':{'type':Sequelize[_0x79f3('0x2')]},'membername':{'type':Sequelize[_0x79f3('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x79f3('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x79f3('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x79f3('0x4')]},'agentcomplete':{'type':Sequelize[_0x79f3('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x79f3('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x79f3('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x79f3('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x79f3('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x79f3('0x2')]},'channel':{'type':Sequelize[_0x79f3('0x2')]},'channelstate':{'type':Sequelize[_0x79f3('0x4')]},'channelstatedesc':{'type':Sequelize[_0x79f3('0x2')]},'connectedlinenum':{'type':Sequelize[_0x79f3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x79f3('0x2')]},'accountcode':{'type':Sequelize[_0x79f3('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x79f3('0x2')]},'destchannel':{'type':Sequelize[_0x79f3('0x2')]},'destchannelstate':{'type':Sequelize[_0x79f3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x79f3('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x79f3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x79f3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x79f3('0x2')]},'destlanguage':{'type':Sequelize[_0x79f3('0x2')]},'destaccountcode':{'type':Sequelize[_0x79f3('0x2')]},'destcontext':{'type':Sequelize[_0x79f3('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x79f3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x79f3('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x79f3('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x79f3('0x2')],'comment':_0x79f3('0x6')},'transferexten':{'type':Sequelize[_0x79f3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x79f3('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x93e6=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x18fe97,_0x1a8b99){var _0x4611ca=function(_0x185c86){while(--_0x185c86){_0x18fe97['push'](_0x18fe97['shift']());}};_0x4611ca(++_0x1a8b99);}(_0x93e6,0x11e));var _0x693e=function(_0x2d120a,_0x5e4d33){_0x2d120a=_0x2d120a-0x0;var _0x205747=_0x93e6[_0x2d120a];return _0x205747;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x693e('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x693e('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x693e('0x1')]},'membername':{'type':Sequelize[_0x693e('0x1')]},'agentcalledAt':{'type':Sequelize[_0x693e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x693e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x693e('0x2')]},'agentdumpAt':{'type':Sequelize[_0x693e('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x693e('0x4')]},'reason':{'type':Sequelize[_0x693e('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x693e('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x693e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x693e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x693e('0x1')]},'exten':{'type':Sequelize[_0x693e('0x1')]},'priority':{'type':Sequelize[_0x693e('0x1')]},'destchannel':{'type':Sequelize[_0x693e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x693e('0x1')]},'destcalleridnum':{'type':Sequelize[_0x693e('0x1')]},'destcalleridname':{'type':Sequelize[_0x693e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x693e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x693e('0x1')]},'destlanguage':{'type':Sequelize[_0x693e('0x1')]},'destaccountcode':{'type':Sequelize[_0x693e('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x693e('0x1')]},'destpriority':{'type':Sequelize[_0x693e('0x1')]},'destuniqueid':{'type':Sequelize[_0x693e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x693e('0x1')]},'transfer':{'type':Sequelize[_0x693e('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x693e('0x1')],'comment':_0x693e('0x5')},'transferexten':{'type':Sequelize[_0x693e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x693e('0x1')]},'agententerreason':{'type':Sequelize[_0x693e('0x4')],'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 6ae2d96..b2e9741 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 ac6d97a..31f76da 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 _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','VoiceAgentReport','report_agent','lodash'];(function(_0x5ab4e8,_0x21d492){var _0x4808d0=function(_0x5c8a17){while(--_0x5c8a17){_0x5ab4e8['push'](_0x5ab4e8['shift']());}};_0x4808d0(++_0x21d492);}(_0xbd50,0x196));var _0x0bd5=function(_0x427687,_0x55e663){_0x427687=_0x427687-0x0;var _0x32d85b=_0xbd50[_0x427687];return _0x32d85b;};'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 +var _0xbeea=['moment','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api'];(function(_0xa8f19c,_0x47ae30){var _0x2f58c4=function(_0x30faf1){while(--_0x30faf1){_0xa8f19c['push'](_0xa8f19c['shift']());}};_0x2f58c4(++_0x47ae30);}(_0xbeea,0xb1));var _0xabee=function(_0x3a2c67,_0x32d339){_0x3a2c67=_0x3a2c67-0x0;var _0xeb9da5=_0xbeea[_0x3a2c67];return _0xeb9da5;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var logger=require(_0xabee('0x1'))(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var BPromise=require('bluebird');var rp=require(_0xabee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var attributes=require(_0xabee('0x7'));module[_0xabee('0x8')]=function(_0x1ea258,_0x58c9ef){return _0x1ea258['define'](_0xabee('0x9'),attributes,{'tableName':_0xabee('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xabee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 5f220e4..5d8cd9a 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 _0x5626=['CreateVoiceAgentReport','VoiceAgentReport','create','options','stringify','update','body','raw','where','attributes','limit','UpdateVoiceAgentReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x1ba29c,_0x5833e0){var _0x5d3243=function(_0x583b24){while(--_0x583b24){_0x1ba29c['push'](_0x1ba29c['shift']());}};_0x5d3243(++_0x5833e0);}(_0x5626,0x1c6));var _0x6562=function(_0x4bddfa,_0x9dd9aa){_0x4bddfa=_0x4bddfa-0x0;var _0x6b186=_0x5626[_0x4bddfa];return _0x6b186;};'use strict';var _=require('lodash');var util=require(_0x6562('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6562('0x1'));var fs=require('fs');var Redis=require(_0x6562('0x2'));var db=require(_0x6562('0x3'))['db'];var utils=require(_0x6562('0x4'));var logger=require(_0x6562('0x5'))(_0x6562('0x6'));var config=require(_0x6562('0x7'));var jayson=require(_0x6562('0x8'));var client=jayson[_0x6562('0x9')][_0x6562('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31a8f2,_0x394918,_0x1aa149){return new BPromise(function(_0x4a331a,_0x2d4787){return client[_0x6562('0xb')](_0x31a8f2,_0x1aa149)[_0x6562('0xc')](function(_0x5acb1d){logger[_0x6562('0xd')](_0x6562('0xe'),_0x394918,_0x6562('0xf'));logger[_0x6562('0x10')](_0x6562('0x11'),_0x394918,_0x6562('0xf'),JSON['stringify'](_0x5acb1d));if(_0x5acb1d[_0x6562('0x12')]){if(_0x5acb1d[_0x6562('0x12')][_0x6562('0x13')]===0x1f4){logger[_0x6562('0x12')](_0x6562('0xe'),_0x394918,_0x5acb1d[_0x6562('0x12')][_0x6562('0x14')]);return _0x2d4787(_0x5acb1d[_0x6562('0x12')]['message']);}logger[_0x6562('0x12')](_0x6562('0xe'),_0x394918,_0x5acb1d['error']['message']);return _0x4a331a(_0x5acb1d[_0x6562('0x12')][_0x6562('0x14')]);}else{logger[_0x6562('0xd')](_0x6562('0xe'),_0x394918,_0x6562('0xf'));_0x4a331a(_0x5acb1d['result'][_0x6562('0x14')]);}})[_0x6562('0x15')](function(_0x1e6e21){logger[_0x6562('0x12')](_0x6562('0xe'),_0x394918,_0x1e6e21);_0x2d4787(_0x1e6e21);});});}exports[_0x6562('0x16')]=function(_0x1f26a9){var _0x1746ab=this;return new Promise(function(_0x1d1425,_0x202b94){return db[_0x6562('0x17')][_0x6562('0x18')](_0x1f26a9['body'],{'raw':_0x1f26a9['options']?_0x1f26a9[_0x6562('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x301652){logger['info'](_0x6562('0x16'),_0x1f26a9);logger[_0x6562('0x10')](_0x6562('0x16'),_0x1f26a9,JSON[_0x6562('0x1a')](_0x301652));_0x1d1425(_0x301652);})[_0x6562('0x15')](function(_0x58abc0){logger[_0x6562('0x12')](_0x6562('0x16'),_0x58abc0[_0x6562('0x14')],_0x1f26a9);_0x202b94(_0x1746ab[_0x6562('0x12')](0x1f4,_0x58abc0[_0x6562('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0xa0366b){var _0x55c604=this;return new Promise(function(_0x4e7b82,_0x4bfef7){return db[_0x6562('0x17')][_0x6562('0x1b')](_0xa0366b[_0x6562('0x1c')],{'raw':_0xa0366b[_0x6562('0x19')]?_0xa0366b[_0x6562('0x19')][_0x6562('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa0366b[_0x6562('0x19')]?_0xa0366b[_0x6562('0x19')][_0x6562('0x1e')]||null:null,'attributes':_0xa0366b[_0x6562('0x19')]?_0xa0366b[_0x6562('0x19')][_0x6562('0x1f')]||null:null,'limit':_0xa0366b[_0x6562('0x19')]?_0xa0366b[_0x6562('0x19')][_0x6562('0x20')]||null:null})[_0x6562('0xc')](function(_0xb95404){logger[_0x6562('0xd')](_0x6562('0x21'),_0xa0366b);logger[_0x6562('0x10')](_0x6562('0x21'),_0xa0366b,JSON[_0x6562('0x1a')](_0xb95404));_0x4e7b82(_0xb95404);})[_0x6562('0x15')](function(_0x5f45fe){logger[_0x6562('0x12')]('UpdateVoiceAgentReport',_0x5f45fe['message'],_0xa0366b);_0x4bfef7(_0x55c604[_0x6562('0x12')](0x1f4,_0x5f45fe['message']));});});}; \ No newline at end of file +var _0xecd4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x544b41,_0x53aaed){var _0x3ef985=function(_0x494bc0){while(--_0x494bc0){_0x544b41['push'](_0x544b41['shift']());}};_0x3ef985(++_0x53aaed);}(_0xecd4,0x1a7));var _0x4ecd=function(_0x54818d,_0x2853a5){_0x54818d=_0x54818d-0x0;var _0x420ccb=_0xecd4[_0x54818d];return _0x420ccb;};'use strict';var _=require(_0x4ecd('0x0'));var util=require(_0x4ecd('0x1'));var moment=require(_0x4ecd('0x2'));var BPromise=require(_0x4ecd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ecd('0x4'));var db=require(_0x4ecd('0x5'))['db'];var utils=require(_0x4ecd('0x6'));var logger=require(_0x4ecd('0x7'))(_0x4ecd('0x8'));var config=require(_0x4ecd('0x9'));var jayson=require(_0x4ecd('0xa'));var client=jayson['client'][_0x4ecd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x137261,_0x53e9d8,_0x4ebec2){return new BPromise(function(_0xe4dbca,_0x227aa5){return client[_0x4ecd('0xc')](_0x137261,_0x4ebec2)[_0x4ecd('0xd')](function(_0x2843e2){logger[_0x4ecd('0xe')](_0x4ecd('0xf'),_0x53e9d8,_0x4ecd('0x10'));logger[_0x4ecd('0x11')](_0x4ecd('0x12'),_0x53e9d8,_0x4ecd('0x10'),JSON[_0x4ecd('0x13')](_0x2843e2));if(_0x2843e2[_0x4ecd('0x14')]){if(_0x2843e2[_0x4ecd('0x14')][_0x4ecd('0x15')]===0x1f4){logger[_0x4ecd('0x14')](_0x4ecd('0xf'),_0x53e9d8,_0x2843e2[_0x4ecd('0x14')]['message']);return _0x227aa5(_0x2843e2[_0x4ecd('0x14')][_0x4ecd('0x16')]);}logger[_0x4ecd('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x53e9d8,_0x2843e2['error'][_0x4ecd('0x16')]);return _0xe4dbca(_0x2843e2['error'][_0x4ecd('0x16')]);}else{logger[_0x4ecd('0xe')](_0x4ecd('0xf'),_0x53e9d8,_0x4ecd('0x10'));_0xe4dbca(_0x2843e2['result'][_0x4ecd('0x16')]);}})[_0x4ecd('0x17')](function(_0xce6cd){logger['error'](_0x4ecd('0xf'),_0x53e9d8,_0xce6cd);_0x227aa5(_0xce6cd);});});}exports[_0x4ecd('0x18')]=function(_0x53467b){var _0x567a4d=this;return new Promise(function(_0x477e35,_0x8bbad8){return db[_0x4ecd('0x19')][_0x4ecd('0x1a')](_0x53467b[_0x4ecd('0x1b')],{'raw':_0x53467b[_0x4ecd('0x1c')]?_0x53467b[_0x4ecd('0x1c')][_0x4ecd('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xe5da85){logger[_0x4ecd('0xe')]('CreateVoiceAgentReport',_0x53467b);logger[_0x4ecd('0x11')](_0x4ecd('0x18'),_0x53467b,JSON[_0x4ecd('0x13')](_0xe5da85));_0x477e35(_0xe5da85);})['catch'](function(_0x4c3c02){logger[_0x4ecd('0x14')]('CreateVoiceAgentReport',_0x4c3c02['message'],_0x53467b);_0x8bbad8(_0x567a4d[_0x4ecd('0x14')](0x1f4,_0x4c3c02['message']));});});};exports[_0x4ecd('0x1e')]=function(_0x38a3b0){var _0x43c500=this;return new Promise(function(_0x197576,_0x62d7be){return db['VoiceAgentReport'][_0x4ecd('0x1f')](_0x38a3b0[_0x4ecd('0x1b')],{'raw':_0x38a3b0[_0x4ecd('0x1c')]?_0x38a3b0[_0x4ecd('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38a3b0['options']?_0x38a3b0['options']['where']||null:null,'attributes':_0x38a3b0[_0x4ecd('0x1c')]?_0x38a3b0['options']['attributes']||null:null,'limit':_0x38a3b0[_0x4ecd('0x1c')]?_0x38a3b0[_0x4ecd('0x1c')][_0x4ecd('0x20')]||null:null})[_0x4ecd('0xd')](function(_0x595e00){logger[_0x4ecd('0xe')]('UpdateVoiceAgentReport',_0x38a3b0);logger[_0x4ecd('0x11')]('UpdateVoiceAgentReport',_0x38a3b0,JSON['stringify'](_0x595e00));_0x197576(_0x595e00);})[_0x4ecd('0x17')](function(_0x3310f5){logger[_0x4ecd('0x14')](_0x4ecd('0x1e'),_0x3310f5[_0x4ecd('0x16')],_0x38a3b0);_0x62d7be(_0x43c500[_0x4ecd('0x14')](0x1f4,_0x3310f5[_0x4ecd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 62874da..49fce45 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 _0x56e7=['put','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x42167f,_0x3b60a7){var _0x512cba=function(_0x188a3b){while(--_0x188a3b){_0x42167f['push'](_0x42167f['shift']());}};_0x512cba(++_0x3b60a7);}(_0x56e7,0x7b));var _0x756e=function(_0x1e1479,_0x151f8e){_0x1e1479=_0x1e1479-0x0;var _0x3cc16d=_0x56e7[_0x1e1479];return _0x3cc16d;};'use strict';var multer=require('multer');var util=require(_0x756e('0x0'));var path=require(_0x756e('0x1'));var timeout=require('connect-timeout');var express=require(_0x756e('0x2'));var router=express[_0x756e('0x3')]();var fs_extra=require(_0x756e('0x4'));var auth=require(_0x756e('0x5'));var interaction=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var controller=require(_0x756e('0x8'));router['get']('/',auth[_0x756e('0x9')](),controller[_0x756e('0xa')]);router[_0x756e('0xb')](_0x756e('0xc'),auth['isAuthenticated'](),controller[_0x756e('0xd')]);router['get'](_0x756e('0xe'),auth[_0x756e('0x9')](),controller[_0x756e('0xf')]);router[_0x756e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x756e('0x11')](_0x756e('0xe'),auth[_0x756e('0x9')](),controller['update']);router[_0x756e('0x12')](_0x756e('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x756e('0x13')]=router; \ No newline at end of file +var _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x4abcc0,_0xd1d228){var _0x575073=function(_0xe3a4ee){while(--_0xe3a4ee){_0x4abcc0['push'](_0x4abcc0['shift']());}};_0x575073(++_0xd1d228);}(_0x4bc3,0x16e));var _0x34bc=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x4bc3[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 84e8182..b036930 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 _0xeb3b=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','inbound-fax'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xeb3b,0x19e));var _0xbeb3=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0xeb3b[_0xa45395];return _0x3c83d2;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'uniqueid':{'type':Sequelize[_0xbeb3('0x2')]},'type':{'type':Sequelize[_0xbeb3('0x3')](_0xbeb3('0x4'),'internal','outbound',_0xbeb3('0x5'),'outbound-fax',_0xbeb3('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbeb3('0x2')]},'source':{'type':Sequelize[_0xbeb3('0x2')]},'destination':{'type':Sequelize[_0xbeb3('0x2')]},'destinationcontext':{'type':Sequelize[_0xbeb3('0x2')]},'callerid':{'type':Sequelize[_0xbeb3('0x2')]},'channel':{'type':Sequelize[_0xbeb3('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xbeb3('0x2')]},'lastdata':{'type':Sequelize[_0xbeb3('0x7')]},'starttime':{'type':Sequelize[_0xbeb3('0x8')]},'systemanswertime':{'type':Sequelize[_0xbeb3('0x8')]},'answertime':{'type':Sequelize[_0xbeb3('0x8')]},'endtime':{'type':Sequelize[_0xbeb3('0x8')]},'duration':{'type':Sequelize[_0xbeb3('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xbeb3('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbeb3('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbeb3('0x2')]},'userDisposition':{'type':Sequelize[_0xbeb3('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xbeb3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xbeb3('0x2')]},'note':{'type':Sequelize[_0xbeb3('0x2')]},'prefix':{'type':Sequelize[_0xbeb3('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f68=['STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','DATE','INTEGER','exports'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x2f68,0x12b));var _0x82f6=function(_0x36071b,_0x1fbee8){_0x36071b=_0x36071b-0x0;var _0x6b902a=_0x2f68[_0x36071b];return _0x6b902a;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'uniqueid':{'type':Sequelize[_0x82f6('0x1')]},'type':{'type':Sequelize[_0x82f6('0x2')](_0x82f6('0x3'),_0x82f6('0x4'),'outbound',_0x82f6('0x5'),_0x82f6('0x6'),_0x82f6('0x7'))},'tag':{'type':Sequelize[_0x82f6('0x1')]},'accountcode':{'type':Sequelize[_0x82f6('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x82f6('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x82f6('0x1')]},'destinationchannel':{'type':Sequelize[_0x82f6('0x1')]},'lastapplication':{'type':Sequelize[_0x82f6('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x82f6('0x8')]},'systemanswertime':{'type':Sequelize[_0x82f6('0x8')]},'answertime':{'type':Sequelize[_0x82f6('0x8')]},'endtime':{'type':Sequelize[_0x82f6('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x82f6('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x82f6('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x82f6('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x82f6('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x82f6('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x82f6('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 85cb244..d9af4a1 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 _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x300667,_0x5c2f22){var _0x58555c=function(_0x2b2f55){while(--_0x2b2f55){_0x300667['push'](_0x300667['shift']());}};_0x58555c(++_0x5c2f22);}(_0xdb28,0x106));var _0x8db2=function(_0x2f4518,_0x3fdcb5){_0x2f4518=_0x2f4518-0x0;var _0x41a85e=_0xdb28[_0x2f4518];return _0x41a85e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c85b8,_0x1d65f5){_0x1c85b8=_0x1c85b8-0x0;var _0x224f11=_0x2ef3[_0x1c85b8];return _0x224f11;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a9e6904..6dc94e7 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 _0x7314=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment'];(function(_0x214249,_0x7143d1){var _0x1da365=function(_0x552bd4){while(--_0x552bd4){_0x214249['push'](_0x214249['shift']());}};_0x1da365(++_0x7143d1);}(_0x7314,0x100));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 logger=require('../../config/logger')(_0x4731('0x2'));var moment=require(_0x4731('0x3'));var BPromise=require(_0x4731('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4731('0x5'));var rimraf=require(_0x4731('0x6'));var config=require(_0x4731('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x4731('0x8')]=function(_0x1baa3f,_0x4d0789){return _0x1baa3f[_0x4731('0x9')](_0x4731('0xa'),attributes,{'tableName':_0x4731('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4731('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0531=['VoiceCallReport','report_call','lodash','util','moment','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x0531,0xde));var _0x1053=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x0531[_0x208505];return _0x1a985f;};'use strict';var _=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1053('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1053('0x3'));var rimraf=require(_0x1053('0x4'));var config=require(_0x1053('0x5'));var attributes=require(_0x1053('0x6'));module[_0x1053('0x7')]=function(_0x5d8ce2,_0x29e7cd){return _0x5d8ce2[_0x1053('0x8')](_0x1053('0x9'),attributes,{'tableName':_0x1053('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 8404dcf..d3bf80a 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 _0x67f2=['map','attributes','model','info','CreateVoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include'];(function(_0x13594e,_0x6f0ed0){var _0x1a4f42=function(_0x30b064){while(--_0x30b064){_0x13594e['push'](_0x13594e['shift']());}};_0x1a4f42(++_0x6f0ed0);}(_0x67f2,0xe8));var _0x267f=function(_0x298b30,_0x15d434){_0x298b30=_0x298b30-0x0;var _0x13ff40=_0x67f2[_0x298b30];return _0x13ff40;};'use strict';var _=require(_0x267f('0x0'));var util=require(_0x267f('0x1'));var moment=require('moment');var BPromise=require(_0x267f('0x2'));var rs=require(_0x267f('0x3'));var fs=require('fs');var Redis=require(_0x267f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x267f('0x5'))(_0x267f('0x6'));var config=require(_0x267f('0x7'));var jayson=require(_0x267f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x387c4a,_0x2d1e26,_0x294d6a){return new BPromise(function(_0xb1abe8,_0x199faf){return client[_0x267f('0x9')](_0x387c4a,_0x294d6a)[_0x267f('0xa')](function(_0x8ab3bc){logger['info'](_0x267f('0xb'),_0x2d1e26,_0x267f('0xc'));logger[_0x267f('0xd')](_0x267f('0xe'),_0x2d1e26,_0x267f('0xc'),JSON[_0x267f('0xf')](_0x8ab3bc));if(_0x8ab3bc[_0x267f('0x10')]){if(_0x8ab3bc[_0x267f('0x10')]['code']===0x1f4){logger[_0x267f('0x10')](_0x267f('0xb'),_0x2d1e26,_0x8ab3bc['error'][_0x267f('0x11')]);return _0x199faf(_0x8ab3bc[_0x267f('0x10')][_0x267f('0x11')]);}logger[_0x267f('0x10')](_0x267f('0xb'),_0x2d1e26,_0x8ab3bc[_0x267f('0x10')][_0x267f('0x11')]);return _0xb1abe8(_0x8ab3bc['error'][_0x267f('0x11')]);}else{logger['info'](_0x267f('0xb'),_0x2d1e26,'request\x20sent');_0xb1abe8(_0x8ab3bc[_0x267f('0x12')][_0x267f('0x11')]);}})[_0x267f('0x13')](function(_0x38711c){logger['error'](_0x267f('0xb'),_0x2d1e26,_0x38711c);_0x199faf(_0x38711c);});});}exports[_0x267f('0x14')]=function(_0x4cb1ac){var _0x4ca9fb=this;return new Promise(function(_0xd35cf4,_0xc5df76){return db[_0x267f('0x15')][_0x267f('0x16')]({'raw':_0x4cb1ac[_0x267f('0x17')]?_0x4cb1ac[_0x267f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4cb1ac['options']?_0x4cb1ac[_0x267f('0x17')][_0x267f('0x18')]||null:null,'attributes':_0x4cb1ac[_0x267f('0x17')]?_0x4cb1ac[_0x267f('0x17')]['attributes']||null:null,'limit':_0x4cb1ac[_0x267f('0x17')]?_0x4cb1ac[_0x267f('0x17')][_0x267f('0x19')]||null:null,'include':_0x4cb1ac[_0x267f('0x17')]?_0x4cb1ac[_0x267f('0x17')][_0x267f('0x1a')]?_[_0x267f('0x1b')](_0x4cb1ac['options'][_0x267f('0x1a')],function(_0x49c75d){return{'model':db[_0x49c75d['model']],'as':_0x49c75d['as'],'attributes':_0x49c75d[_0x267f('0x1c')],'include':_0x49c75d[_0x267f('0x1a')]?_[_0x267f('0x1b')](_0x49c75d['include'],function(_0x5572bb){return{'model':db[_0x5572bb['model']],'as':_0x5572bb['as'],'attributes':_0x5572bb[_0x267f('0x1c')],'include':_0x5572bb['include']?_['map'](_0x5572bb['include'],function(_0x9d209e){return{'model':db[_0x9d209e[_0x267f('0x1d')]],'as':_0x9d209e['as'],'attributes':_0x9d209e[_0x267f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x267f('0xa')](function(_0x46300f){logger[_0x267f('0x1e')]('GetVoiceCallReport',_0x4cb1ac);logger[_0x267f('0xd')](_0x267f('0x14'),_0x4cb1ac,JSON[_0x267f('0xf')](_0x46300f));_0xd35cf4(_0x46300f);})[_0x267f('0x13')](function(_0x53d77f){logger[_0x267f('0x10')]('GetVoiceCallReport',_0x53d77f[_0x267f('0x11')],_0x4cb1ac);_0xc5df76(_0x4ca9fb[_0x267f('0x10')](0x1f4,_0x53d77f[_0x267f('0x11')]));});});};exports[_0x267f('0x1f')]=function(_0x3320c4){var _0xd9627c=this;return new Promise(function(_0x570be2,_0x51017b){return db['VoiceCallReport'][_0x267f('0x20')](_0x3320c4[_0x267f('0x21')],{'raw':_0x3320c4[_0x267f('0x17')]?_0x3320c4[_0x267f('0x17')][_0x267f('0x22')]===undefined?!![]:![]:!![]})[_0x267f('0xa')](function(_0x195dfa){logger[_0x267f('0x1e')](_0x267f('0x1f'),_0x3320c4);logger['debug']('CreateVoiceCallReport',_0x3320c4,JSON[_0x267f('0xf')](_0x195dfa));_0x570be2(_0x195dfa);})[_0x267f('0x13')](function(_0x1f8928){logger[_0x267f('0x10')](_0x267f('0x1f'),_0x1f8928['message'],_0x3320c4);_0x51017b(_0xd9627c['error'](0x1f4,_0x1f8928[_0x267f('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x1921bd){var _0x126bc4=this;return new Promise(function(_0x2d3e6a,_0x39460e){return db[_0x267f('0x15')][_0x267f('0x23')](_0x1921bd[_0x267f('0x21')],{'raw':_0x1921bd[_0x267f('0x17')]?_0x1921bd[_0x267f('0x17')][_0x267f('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1921bd['options']?_0x1921bd[_0x267f('0x17')]['where']||null:null,'attributes':_0x1921bd[_0x267f('0x17')]?_0x1921bd[_0x267f('0x17')][_0x267f('0x1c')]||null:null,'limit':_0x1921bd['options']?_0x1921bd[_0x267f('0x17')][_0x267f('0x19')]||null:null})[_0x267f('0xa')](function(_0xf4593a){logger[_0x267f('0x1e')](_0x267f('0x24'),_0x1921bd);logger['debug'](_0x267f('0x24'),_0x1921bd,JSON['stringify'](_0xf4593a));_0x2d3e6a(_0xf4593a);})[_0x267f('0x13')](function(_0x12a0e5){logger[_0x267f('0x10')](_0x267f('0x24'),_0x12a0e5[_0x267f('0x11')],_0x1921bd);_0x39460e(_0x126bc4[_0x267f('0x10')](0x1f4,_0x12a0e5[_0x267f('0x11')]));});});}; \ No newline at end of file +var _0xe0c6=['body','raw','CreateVoiceCallReport','debug','stringify','UpdateVoiceCallReport','where','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','limit','map','include','model','catch'];(function(_0x42f204,_0x26d24e){var _0x54da59=function(_0x11dafb){while(--_0x11dafb){_0x42f204['push'](_0x42f204['shift']());}};_0x54da59(++_0x26d24e);}(_0xe0c6,0x1db));var _0x6e0c=function(_0x614386,_0x181ef8){_0x614386=_0x614386-0x0;var _0x3e1c89=_0xe0c6[_0x614386];return _0x3e1c89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e0c('0x0'));var BPromise=require('bluebird');var rs=require(_0x6e0c('0x1'));var fs=require('fs');var Redis=require(_0x6e0c('0x2'));var db=require(_0x6e0c('0x3'))['db'];var utils=require(_0x6e0c('0x4'));var logger=require(_0x6e0c('0x5'))('rpc');var config=require(_0x6e0c('0x6'));var jayson=require(_0x6e0c('0x7'));var client=jayson[_0x6e0c('0x8')][_0x6e0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d3d9a,_0x2c63b2,_0x2eb304){return new BPromise(function(_0x4b3a85,_0x1d26cc){return client['request'](_0x2d3d9a,_0x2eb304)[_0x6e0c('0xa')](function(_0x535884){logger[_0x6e0c('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x2c63b2,_0x6e0c('0xc'));logger['debug'](_0x6e0c('0xd'),_0x2c63b2,_0x6e0c('0xc'),JSON['stringify'](_0x535884));if(_0x535884['error']){if(_0x535884[_0x6e0c('0xe')][_0x6e0c('0xf')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2c63b2,_0x535884['error'][_0x6e0c('0x10')]);return _0x1d26cc(_0x535884[_0x6e0c('0xe')][_0x6e0c('0x10')]);}logger[_0x6e0c('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x2c63b2,_0x535884['error'][_0x6e0c('0x10')]);return _0x4b3a85(_0x535884[_0x6e0c('0xe')][_0x6e0c('0x10')]);}else{logger['info'](_0x6e0c('0x11'),_0x2c63b2,_0x6e0c('0xc'));_0x4b3a85(_0x535884[_0x6e0c('0x12')][_0x6e0c('0x10')]);}})['catch'](function(_0x270570){logger[_0x6e0c('0xe')](_0x6e0c('0x11'),_0x2c63b2,_0x270570);_0x1d26cc(_0x270570);});});}exports[_0x6e0c('0x13')]=function(_0x24f3ed){var _0x286b82=this;return new Promise(function(_0x1dcdb6,_0x4df83d){return db[_0x6e0c('0x14')][_0x6e0c('0x15')]({'raw':_0x24f3ed['options']?_0x24f3ed['options']['raw']===undefined?!![]:![]:!![],'where':_0x24f3ed[_0x6e0c('0x16')]?_0x24f3ed[_0x6e0c('0x16')]['where']||null:null,'attributes':_0x24f3ed[_0x6e0c('0x16')]?_0x24f3ed[_0x6e0c('0x16')][_0x6e0c('0x17')]||null:null,'limit':_0x24f3ed['options']?_0x24f3ed[_0x6e0c('0x16')][_0x6e0c('0x18')]||null:null,'include':_0x24f3ed[_0x6e0c('0x16')]?_0x24f3ed[_0x6e0c('0x16')]['include']?_[_0x6e0c('0x19')](_0x24f3ed[_0x6e0c('0x16')][_0x6e0c('0x1a')],function(_0x498ff9){return{'model':db[_0x498ff9[_0x6e0c('0x1b')]],'as':_0x498ff9['as'],'attributes':_0x498ff9[_0x6e0c('0x17')],'include':_0x498ff9[_0x6e0c('0x1a')]?_[_0x6e0c('0x19')](_0x498ff9[_0x6e0c('0x1a')],function(_0x2ed52d){return{'model':db[_0x2ed52d[_0x6e0c('0x1b')]],'as':_0x2ed52d['as'],'attributes':_0x2ed52d[_0x6e0c('0x17')],'include':_0x2ed52d['include']?_[_0x6e0c('0x19')](_0x2ed52d[_0x6e0c('0x1a')],function(_0x4899e2){return{'model':db[_0x4899e2[_0x6e0c('0x1b')]],'as':_0x4899e2['as'],'attributes':_0x4899e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e0c('0xa')](function(_0x140374){logger[_0x6e0c('0xb')](_0x6e0c('0x13'),_0x24f3ed);logger['debug'](_0x6e0c('0x13'),_0x24f3ed,JSON['stringify'](_0x140374));_0x1dcdb6(_0x140374);})[_0x6e0c('0x1c')](function(_0x12fe95){logger[_0x6e0c('0xe')](_0x6e0c('0x13'),_0x12fe95[_0x6e0c('0x10')],_0x24f3ed);_0x4df83d(_0x286b82[_0x6e0c('0xe')](0x1f4,_0x12fe95[_0x6e0c('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x93beb4){var _0x2cde25=this;return new Promise(function(_0x258061,_0x214317){return db[_0x6e0c('0x14')]['create'](_0x93beb4[_0x6e0c('0x1d')],{'raw':_0x93beb4['options']?_0x93beb4[_0x6e0c('0x16')][_0x6e0c('0x1e')]===undefined?!![]:![]:!![]})[_0x6e0c('0xa')](function(_0x3995d7){logger[_0x6e0c('0xb')](_0x6e0c('0x1f'),_0x93beb4);logger[_0x6e0c('0x20')](_0x6e0c('0x1f'),_0x93beb4,JSON[_0x6e0c('0x21')](_0x3995d7));_0x258061(_0x3995d7);})['catch'](function(_0x5e9948){logger[_0x6e0c('0xe')]('CreateVoiceCallReport',_0x5e9948['message'],_0x93beb4);_0x214317(_0x2cde25[_0x6e0c('0xe')](0x1f4,_0x5e9948[_0x6e0c('0x10')]));});});};exports[_0x6e0c('0x22')]=function(_0xc7f59f){var _0x5a9d6c=this;return new Promise(function(_0x1f286e,_0x324c41){return db['VoiceCallReport']['update'](_0xc7f59f[_0x6e0c('0x1d')],{'raw':_0xc7f59f[_0x6e0c('0x16')]?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc7f59f[_0x6e0c('0x16')]?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x23')]||null:null,'attributes':_0xc7f59f[_0x6e0c('0x16')]?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x17')]||null:null,'limit':_0xc7f59f['options']?_0xc7f59f[_0x6e0c('0x16')][_0x6e0c('0x18')]||null:null})[_0x6e0c('0xa')](function(_0x398dfb){logger[_0x6e0c('0xb')](_0x6e0c('0x22'),_0xc7f59f);logger[_0x6e0c('0x20')](_0x6e0c('0x22'),_0xc7f59f,JSON[_0x6e0c('0x21')](_0x398dfb));_0x1f286e(_0x398dfb);})['catch'](function(_0x309e21){logger[_0x6e0c('0xe')]('UpdateVoiceCallReport',_0x309e21[_0x6e0c('0x10')],_0xc7f59f);_0x324c41(_0x5a9d6c['error'](0x1f4,_0x309e21[_0x6e0c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0c67307..40ab7d9 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 _0xf7a5=['/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x3644e6,_0x4fbd12){var _0x25d719=function(_0x5d5ef){while(--_0x5d5ef){_0x3644e6['push'](_0x3644e6['shift']());}};_0x25d719(++_0x4fbd12);}(_0xf7a5,0xf8));var _0x5f7a=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0xf7a5[_0x3fd3a3];return _0xa3e4d5;};'use strict';var multer=require(_0x5f7a('0x0'));var util=require(_0x5f7a('0x1'));var path=require('path');var timeout=require(_0x5f7a('0x2'));var express=require(_0x5f7a('0x3'));var router=express[_0x5f7a('0x4')]();var fs_extra=require(_0x5f7a('0x5'));var auth=require(_0x5f7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f7a('0x7'));var controller=require(_0x5f7a('0x8'));router[_0x5f7a('0x9')]('/',auth[_0x5f7a('0xa')](),controller[_0x5f7a('0xb')]);router[_0x5f7a('0x9')](_0x5f7a('0xc'),auth['isAuthenticated'](),controller[_0x5f7a('0xd')]);router[_0x5f7a('0xe')]('/',auth[_0x5f7a('0xa')](),controller[_0x5f7a('0xf')]);router[_0x5f7a('0x10')]('/:id',auth[_0x5f7a('0xa')](),controller[_0x5f7a('0x11')]);router[_0x5f7a('0x12')]('/:id',auth[_0x5f7a('0xa')](),controller['destroy']);module[_0x5f7a('0x13')]=router; \ No newline at end of file +var _0xfe7e=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','util'];(function(_0xbe05af,_0x4345a1){var _0x134631=function(_0x4fd4d8){while(--_0x4fd4d8){_0xbe05af['push'](_0xbe05af['shift']());}};_0x134631(++_0x4345a1);}(_0xfe7e,0x12b));var _0xefe7=function(_0x5b069f,_0x2a6941){_0x5b069f=_0x5b069f-0x0;var _0x3a83d2=_0xfe7e[_0x5b069f];return _0x3a83d2;};'use strict';var multer=require('multer');var util=require(_0xefe7('0x0'));var path=require(_0xefe7('0x1'));var timeout=require(_0xefe7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xefe7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xefe7('0x4'));var config=require(_0xefe7('0x5'));var controller=require(_0xefe7('0x6'));router[_0xefe7('0x7')]('/',auth[_0xefe7('0x8')](),controller[_0xefe7('0x9')]);router['get'](_0xefe7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xefe7('0xb')]('/',auth[_0xefe7('0x8')](),controller['create']);router['put'](_0xefe7('0xa'),auth[_0xefe7('0x8')](),controller[_0xefe7('0xc')]);router[_0xefe7('0xd')](_0xefe7('0xa'),auth['isAuthenticated'](),controller[_0xefe7('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 060165c..c45af42 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 _0xa6e2=['join','getDataValue','split','BOOLEAN','exports','STRING','name','options'];(function(_0x57d410,_0x1bc7fb){var _0x3ef393=function(_0x3d3ede){while(--_0x3d3ede){_0x57d410['push'](_0x57d410['shift']());}};_0x3ef393(++_0x1bc7fb);}(_0xa6e2,0xac));var _0x2a6e=function(_0x1ed67b,_0x4c079c){_0x1ed67b=_0x1ed67b-0x0;var _0x457e68=_0xa6e2[_0x1ed67b];return _0x457e68;};'use strict';var Sequelize=require('sequelize');module[_0x2a6e('0x0')]={'name':{'type':Sequelize[_0x2a6e('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x2a6e('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2a6e('0x1')],'set':function(_0x3dc0df){this['setDataValue'](_0x2a6e('0x3'),_0x3dc0df?_0x3dc0df[_0x2a6e('0x4')](''):[]);},'get':function(){return this[_0x2a6e('0x5')]('options')?this['getDataValue'](_0x2a6e('0x3'))[_0x2a6e('0x6')](''):[];}},'auth':{'type':Sequelize[_0x2a6e('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x2a6e('0x1')]},'record':{'type':Sequelize[_0x2a6e('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2a6e('0x1')]},'description':{'type':Sequelize[_0x2a6e('0x1')]}}; \ No newline at end of file +var _0x1fd3=['BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue','split'];(function(_0x5e3701,_0x596265){var _0x345dcf=function(_0x5eb12a){while(--_0x5eb12a){_0x5e3701['push'](_0x5e3701['shift']());}};_0x345dcf(++_0x596265);}(_0x1fd3,0x17b));var _0x31fd=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x1fd3[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x31fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x31fd('0x1')]},'prefix':{'type':Sequelize[_0x31fd('0x1')],'unique':_0x31fd('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x276fed){this[_0x31fd('0x3')](_0x31fd('0x4'),_0x276fed?_0x276fed[_0x31fd('0x5')](''):[]);},'get':function(){return this[_0x31fd('0x6')](_0x31fd('0x4'))?this[_0x31fd('0x6')](_0x31fd('0x4'))[_0x31fd('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x31fd('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x31fd('0x1')]},'description':{'type':Sequelize[_0x31fd('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ed235c4..7f6bd4e 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 _0x2750=['sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4b5d0b,_0x1bf0b6){var _0x1067a2=function(_0x2d250b){while(--_0x2d250b){_0x4b5d0b['push'](_0x4b5d0b['shift']());}};_0x1067a2(++_0x1bf0b6);}(_0x2750,0x13b));var _0x0275=function(_0x45cadf,_0x4dd100){_0x45cadf=_0x45cadf-0x0;var _0x2abddb=_0x2750[_0x45cadf];return _0x2abddb;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];function respondWithStatusCode(_0x1f128d,_0x4c6ee0){_0x4c6ee0=_0x4c6ee0||0xcc;return function(_0x55ffd6){if(_0x55ffd6){return _0x1f128d[_0x0275('0x19')](_0x4c6ee0);}return _0x1f128d[_0x0275('0x1a')](_0x4c6ee0)[_0x0275('0x1b')]();};}function respondWithResult(_0x46a729,_0x28827b){_0x28827b=_0x28827b||0xc8;return function(_0x36921c){if(_0x36921c){return _0x46a729['status'](_0x28827b)[_0x0275('0x1c')](_0x36921c);}};}function respondWithFilteredResult(_0x3030c0,_0x4aa412){return function(_0x6344fc){if(_0x6344fc){var _0xaae367=typeof _0x4aa412['offset']===_0x0275('0x1d')&&typeof _0x4aa412[_0x0275('0x1e')]==='undefined';var _0x5e7466=_0x6344fc['count'];var _0x591d27=_0xaae367?0x0:_0x4aa412['offset'];var _0x566ad6=_0xaae367?_0x6344fc[_0x0275('0x1f')]:_0x4aa412[_0x0275('0x20')]+_0x4aa412['limit'];var _0x7075c9;if(_0x566ad6>=_0x5e7466){_0x566ad6=_0x5e7466;_0x7075c9=0xc8;}else{_0x7075c9=0xce;}_0x3030c0[_0x0275('0x1a')](_0x7075c9);return _0x3030c0[_0x0275('0x21')]('Content-Range',_0x591d27+'-'+_0x566ad6+'/'+_0x5e7466)[_0x0275('0x1c')](_0x6344fc);}return null;};}function patchUpdates(_0x402f0d){return function(_0x575786){try{jsonpatch['apply'](_0x575786,_0x402f0d,!![]);}catch(_0x31ba9e){return BPromise[_0x0275('0x22')](_0x31ba9e);}return _0x575786[_0x0275('0x23')]();};}function saveUpdates(_0x592a53,_0xf3b68e){return function(_0x5ab9e7){if(_0x5ab9e7){return _0x5ab9e7[_0x0275('0x24')](_0x592a53)['then'](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0xfa0081,_0x594321){return function(_0x140a18){if(_0x140a18){return _0x140a18[_0x0275('0x25')]()[_0x0275('0x26')](function(){var _0x52946b=_0x140a18[_0x0275('0x27')]({'plain':!![]});var _0x44bbf8=_0x0275('0x28');return db[_0x0275('0x29')][_0x0275('0x25')]({'where':{'type':_0x44bbf8,'resourceId':_0x52946b['id']}})[_0x0275('0x26')](function(){return _0x140a18;});})['then'](function(){_0xfa0081[_0x0275('0x1a')](0xcc)[_0x0275('0x1b')]();});}};}function handleEntityNotFound(_0x1d24b2,_0x275dac){return function(_0x4689a3){if(!_0x4689a3){_0x1d24b2['sendStatus'](0x194);}return _0x4689a3;};}function handleError(_0x1ffd57,_0xd59d69){_0xd59d69=_0xd59d69||0x1f4;return function(_0x3246ea){logger[_0x0275('0x2a')](_0x3246ea[_0x0275('0x2b')]);if(_0x3246ea['name']){delete _0x3246ea[_0x0275('0x2c')];}_0x1ffd57[_0x0275('0x1a')](_0xd59d69)[_0x0275('0x2d')](_0x3246ea);};}exports['index']=function(_0x5e2e22,_0x3cb2d7){var _0x299190={},_0x5dc2bc={},_0x7eff96={'count':0x0,'rows':[]};var _0x155a50=_[_0x0275('0x2e')](db[_0x0275('0x2f')]['rawAttributes'],function(_0x24c762){return{'name':_0x24c762[_0x0275('0x30')],'type':_0x24c762[_0x0275('0x31')][_0x0275('0x32')]};});_0x5dc2bc['model']=_[_0x0275('0x2e')](_0x155a50,'name');_0x5dc2bc[_0x0275('0x33')]=_['keys'](_0x5e2e22[_0x0275('0x33')]);_0x5dc2bc[_0x0275('0x34')]=_['intersection'](_0x5dc2bc[_0x0275('0x35')],_0x5dc2bc[_0x0275('0x33')]);_0x299190[_0x0275('0x36')]=_[_0x0275('0x37')](_0x5dc2bc['model'],qs[_0x0275('0x38')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x38')]));_0x299190[_0x0275('0x36')]=_0x299190[_0x0275('0x36')]['length']?_0x299190[_0x0275('0x36')]:_0x5dc2bc[_0x0275('0x35')];if(!_0x5e2e22[_0x0275('0x33')][_0x0275('0x39')](_0x0275('0x3a'))){_0x299190[_0x0275('0x1e')]=qs[_0x0275('0x1e')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x1e')]);_0x299190[_0x0275('0x20')]=qs[_0x0275('0x20')](_0x5e2e22['query'][_0x0275('0x20')]);}_0x299190[_0x0275('0x3b')]=qs[_0x0275('0x3c')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x3c')]);_0x299190[_0x0275('0x3d')]=qs[_0x0275('0x34')](_[_0x0275('0x3e')](_0x5e2e22[_0x0275('0x33')],_0x5dc2bc[_0x0275('0x34')]),_0x155a50);if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]){_0x299190[_0x0275('0x3d')]=_[_0x0275('0x40')](_0x299190['where'],{'$or':_[_0x0275('0x2e')](_0x155a50,function(_0x1cc40d){if(_0x1cc40d['type']!==_0x0275('0x41')){var _0x76b8fa={};_0x76b8fa[_0x1cc40d[_0x0275('0x2c')]]={'$like':'%'+_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]+'%'};return _0x76b8fa;}})});}_0x299190=_[_0x0275('0x40')]({},_0x299190,_0x5e2e22[_0x0275('0x42')]);var _0x5e57b5={'where':_0x299190[_0x0275('0x3d')]};return db[_0x0275('0x2f')][_0x0275('0x1f')](_0x5e57b5)[_0x0275('0x26')](function(_0x4f888c){_0x7eff96[_0x0275('0x1f')]=_0x4f888c;if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x43')]){_0x299190[_0x0275('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x0275('0x45')](_0x299190);})['then'](function(_0x261e66){_0x7eff96[_0x0275('0x46')]=_0x261e66;return _0x7eff96;})[_0x0275('0x26')](respondWithFilteredResult(_0x3cb2d7,_0x299190))[_0x0275('0x47')](handleError(_0x3cb2d7,null));};exports['show']=function(_0x13c651,_0x3d1bfc){var _0x59839d={'raw':![],'where':{'id':_0x13c651[_0x0275('0x48')]['id']}},_0x1e143e={};_0x1e143e[_0x0275('0x35')]=_['keys'](db[_0x0275('0x2f')][_0x0275('0x49')]);_0x1e143e['query']=_[_0x0275('0x4a')](_0x13c651[_0x0275('0x33')]);_0x1e143e[_0x0275('0x34')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],_0x1e143e[_0x0275('0x33')]);_0x59839d[_0x0275('0x36')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],qs[_0x0275('0x38')](_0x13c651[_0x0275('0x33')]['fields']));_0x59839d[_0x0275('0x36')]=_0x59839d[_0x0275('0x36')][_0x0275('0x4b')]?_0x59839d[_0x0275('0x36')]:_0x1e143e[_0x0275('0x35')];if(_0x13c651[_0x0275('0x33')][_0x0275('0x43')]){_0x59839d[_0x0275('0x44')]=[{'all':!![]}];}_0x59839d=_[_0x0275('0x40')]({},_0x59839d,_0x13c651[_0x0275('0x42')]);return db[_0x0275('0x2f')]['find'](_0x59839d)['then'](handleEntityNotFound(_0x3d1bfc,null))[_0x0275('0x26')](respondWithResult(_0x3d1bfc,null))[_0x0275('0x47')](handleError(_0x3d1bfc,null));};exports[_0x0275('0x4c')]=function(_0x3bd019,_0x310c6b){return db['VoiceChanSpy'][_0x0275('0x4c')](_0x3bd019['body'],{})[_0x0275('0x26')](function(_0x17dde0){var _0x27a469=_0x3bd019[_0x0275('0x4d')]['get']({'plain':!![]});if(!_0x27a469)throw new Error(_0x0275('0x4e'));if(_0x27a469['role']==='user'){var _0x515860=_0x17dde0[_0x0275('0x27')]({'plain':!![]});var _0x4e36fc=_0x0275('0x28');return db[_0x0275('0x4f')][_0x0275('0x50')]({'where':{'name':_0x4e36fc,'userProfileId':_0x27a469[_0x0275('0x51')]},'raw':!![]})[_0x0275('0x26')](function(_0x11794b){if(_0x11794b&&_0x11794b[_0x0275('0x52')]===0x0){return db['UserProfileResource'][_0x0275('0x4c')]({'name':_0x515860['name'],'resourceId':_0x515860['id'],'type':_0x11794b[_0x0275('0x2c')],'sectionId':_0x11794b['id']},{})[_0x0275('0x26')](function(){return _0x17dde0;});}else{return _0x17dde0;}})[_0x0275('0x47')](function(_0x1686d9){logger[_0x0275('0x2a')](_0x0275('0x53'),_0x1686d9);throw _0x1686d9;});}return _0x17dde0;})[_0x0275('0x26')](respondWithResult(_0x310c6b,0xc9))[_0x0275('0x47')](handleError(_0x310c6b,null));};exports[_0x0275('0x24')]=function(_0x3673ad,_0x545333){if(_0x3673ad['body']['id']){delete _0x3673ad[_0x0275('0x54')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x3673ad[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x545333,null))[_0x0275('0x26')](saveUpdates(_0x3673ad[_0x0275('0x54')],null))[_0x0275('0x26')](respondWithResult(_0x545333,null))[_0x0275('0x47')](handleError(_0x545333,null));};exports['destroy']=function(_0x104232,_0x163ce2){return db[_0x0275('0x2f')][_0x0275('0x50')]({'where':{'id':_0x104232[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x163ce2,null))['then'](removeEntity(_0x163ce2,null))[_0x0275('0x47')](handleError(_0x163ce2,null));}; \ No newline at end of file +var _0xf00e=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','status','end','json','offset','undefined','Content-Range','apply','save','destroy','then','get','ChanSpies','stack','name','send','map','VoiceChanSpy','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xa59e37,_0xd7215f){var _0x4d9133=function(_0x3b4b50){while(--_0x3b4b50){_0xa59e37['push'](_0xa59e37['shift']());}};_0x4d9133(++_0xd7215f);}(_0xf00e,0x12f));var _0xef00=function(_0x3e525e,_0x2432a9){_0x3e525e=_0x3e525e-0x0;var _0x3fe8ac=_0xf00e[_0x3e525e];return _0x3fe8ac;};'use strict';var emlformat=require(_0xef00('0x0'));var rimraf=require(_0xef00('0x1'));var zipdir=require(_0xef00('0x2'));var jsonpatch=require(_0xef00('0x3'));var rp=require(_0xef00('0x4'));var moment=require(_0xef00('0x5'));var BPromise=require(_0xef00('0x6'));var Mustache=require(_0xef00('0x7'));var util=require(_0xef00('0x8'));var path=require(_0xef00('0x9'));var sox=require(_0xef00('0xa'));var csv=require(_0xef00('0xb'));var ejs=require(_0xef00('0xc'));var fs=require('fs');var fs_extra=require(_0xef00('0xd'));var _=require(_0xef00('0xe'));var squel=require(_0xef00('0xf'));var crypto=require(_0xef00('0x10'));var jsforce=require(_0xef00('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xef00('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xef00('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef00('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef00('0x14'))(_0xef00('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19c7d9,_0x582462){_0x582462=_0x582462||0xcc;return function(_0x18ea2e){if(_0x18ea2e){return _0x19c7d9['sendStatus'](_0x582462);}return _0x19c7d9[_0xef00('0x16')](_0x582462)[_0xef00('0x17')]();};}function respondWithResult(_0x2b897,_0x7d477e){_0x7d477e=_0x7d477e||0xc8;return function(_0x216963){if(_0x216963){return _0x2b897['status'](_0x7d477e)[_0xef00('0x18')](_0x216963);}};}function respondWithFilteredResult(_0x2fba5d,_0x4f0a5b){return function(_0x21257e){if(_0x21257e){var _0x457035=typeof _0x4f0a5b[_0xef00('0x19')]===_0xef00('0x1a')&&typeof _0x4f0a5b['limit']===_0xef00('0x1a');var _0x1e714d=_0x21257e['count'];var _0x45a9d4=_0x457035?0x0:_0x4f0a5b[_0xef00('0x19')];var _0x242658=_0x457035?_0x21257e['count']:_0x4f0a5b['offset']+_0x4f0a5b['limit'];var _0x1b059c;if(_0x242658>=_0x1e714d){_0x242658=_0x1e714d;_0x1b059c=0xc8;}else{_0x1b059c=0xce;}_0x2fba5d[_0xef00('0x16')](_0x1b059c);return _0x2fba5d['set'](_0xef00('0x1b'),_0x45a9d4+'-'+_0x242658+'/'+_0x1e714d)[_0xef00('0x18')](_0x21257e);}return null;};}function patchUpdates(_0x4e4157){return function(_0x5838c9){try{jsonpatch[_0xef00('0x1c')](_0x5838c9,_0x4e4157,!![]);}catch(_0xcf0f4b){return BPromise['reject'](_0xcf0f4b);}return _0x5838c9[_0xef00('0x1d')]();};}function saveUpdates(_0x70bf89,_0x54cd84){return function(_0x232565){if(_0x232565){return _0x232565['update'](_0x70bf89)['then'](function(_0x203cfe){return _0x203cfe;});}return null;};}function removeEntity(_0x56347a,_0x639d69){return function(_0x1f6b50){if(_0x1f6b50){return _0x1f6b50[_0xef00('0x1e')]()[_0xef00('0x1f')](function(){var _0x57f4eb=_0x1f6b50[_0xef00('0x20')]({'plain':!![]});var _0x1ec423=_0xef00('0x21');return db['UserProfileResource'][_0xef00('0x1e')]({'where':{'type':_0x1ec423,'resourceId':_0x57f4eb['id']}})[_0xef00('0x1f')](function(){return _0x1f6b50;});})[_0xef00('0x1f')](function(){_0x56347a[_0xef00('0x16')](0xcc)[_0xef00('0x17')]();});}};}function handleEntityNotFound(_0x441584,_0x1d1fce){return function(_0x4c1978){if(!_0x4c1978){_0x441584['sendStatus'](0x194);}return _0x4c1978;};}function handleError(_0x996710,_0x18f56f){_0x18f56f=_0x18f56f||0x1f4;return function(_0x17b633){logger['error'](_0x17b633[_0xef00('0x22')]);if(_0x17b633[_0xef00('0x23')]){delete _0x17b633[_0xef00('0x23')];}_0x996710[_0xef00('0x16')](_0x18f56f)[_0xef00('0x24')](_0x17b633);};}exports['index']=function(_0x26f3c0,_0xba426c){var _0x4892be={},_0x128dd9={},_0x19b4c1={'count':0x0,'rows':[]};var _0x1c6dde=_[_0xef00('0x25')](db[_0xef00('0x26')][_0xef00('0x27')],function(_0x5c977f){return{'name':_0x5c977f['fieldName'],'type':_0x5c977f[_0xef00('0x28')][_0xef00('0x29')]};});_0x128dd9[_0xef00('0x2a')]=_['map'](_0x1c6dde,'name');_0x128dd9[_0xef00('0x2b')]=_['keys'](_0x26f3c0[_0xef00('0x2b')]);_0x128dd9[_0xef00('0x2c')]=_[_0xef00('0x2d')](_0x128dd9[_0xef00('0x2a')],_0x128dd9[_0xef00('0x2b')]);_0x4892be['attributes']=_[_0xef00('0x2d')](_0x128dd9['model'],qs[_0xef00('0x2e')](_0x26f3c0[_0xef00('0x2b')][_0xef00('0x2e')]));_0x4892be[_0xef00('0x2f')]=_0x4892be[_0xef00('0x2f')][_0xef00('0x30')]?_0x4892be['attributes']:_0x128dd9[_0xef00('0x2a')];if(!_0x26f3c0[_0xef00('0x2b')][_0xef00('0x31')]('nolimit')){_0x4892be[_0xef00('0x32')]=qs[_0xef00('0x32')](_0x26f3c0[_0xef00('0x2b')]['limit']);_0x4892be['offset']=qs['offset'](_0x26f3c0['query'][_0xef00('0x19')]);}_0x4892be[_0xef00('0x33')]=qs['sort'](_0x26f3c0['query'][_0xef00('0x34')]);_0x4892be[_0xef00('0x35')]=qs[_0xef00('0x2c')](_[_0xef00('0x36')](_0x26f3c0[_0xef00('0x2b')],_0x128dd9[_0xef00('0x2c')]),_0x1c6dde);if(_0x26f3c0[_0xef00('0x2b')][_0xef00('0x37')]){_0x4892be[_0xef00('0x35')]=_['merge'](_0x4892be[_0xef00('0x35')],{'$or':_[_0xef00('0x25')](_0x1c6dde,function(_0x16cfcc){if(_0x16cfcc[_0xef00('0x28')]!==_0xef00('0x38')){var _0x358ed6={};_0x358ed6[_0x16cfcc[_0xef00('0x23')]]={'$like':'%'+_0x26f3c0[_0xef00('0x2b')][_0xef00('0x37')]+'%'};return _0x358ed6;}})});}_0x4892be=_[_0xef00('0x39')]({},_0x4892be,_0x26f3c0[_0xef00('0x3a')]);var _0x503238={'where':_0x4892be[_0xef00('0x35')]};return db[_0xef00('0x26')]['count'](_0x503238)['then'](function(_0x578ea3){_0x19b4c1[_0xef00('0x3b')]=_0x578ea3;if(_0x26f3c0[_0xef00('0x2b')][_0xef00('0x3c')]){_0x4892be['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xef00('0x3d')](_0x4892be);})[_0xef00('0x1f')](function(_0x2e0b58){_0x19b4c1['rows']=_0x2e0b58;return _0x19b4c1;})[_0xef00('0x1f')](respondWithFilteredResult(_0xba426c,_0x4892be))[_0xef00('0x3e')](handleError(_0xba426c,null));};exports[_0xef00('0x3f')]=function(_0x38e2be,_0x2d0639){var _0x30b756={'raw':![],'where':{'id':_0x38e2be['params']['id']}},_0x3ed1fa={};_0x3ed1fa[_0xef00('0x2a')]=_[_0xef00('0x40')](db[_0xef00('0x26')][_0xef00('0x27')]);_0x3ed1fa[_0xef00('0x2b')]=_[_0xef00('0x40')](_0x38e2be[_0xef00('0x2b')]);_0x3ed1fa[_0xef00('0x2c')]=_['intersection'](_0x3ed1fa[_0xef00('0x2a')],_0x3ed1fa[_0xef00('0x2b')]);_0x30b756['attributes']=_['intersection'](_0x3ed1fa[_0xef00('0x2a')],qs['fields'](_0x38e2be[_0xef00('0x2b')][_0xef00('0x2e')]));_0x30b756['attributes']=_0x30b756[_0xef00('0x2f')][_0xef00('0x30')]?_0x30b756['attributes']:_0x3ed1fa[_0xef00('0x2a')];if(_0x38e2be[_0xef00('0x2b')][_0xef00('0x3c')]){_0x30b756[_0xef00('0x41')]=[{'all':!![]}];}_0x30b756=_['merge']({},_0x30b756,_0x38e2be['options']);return db[_0xef00('0x26')]['find'](_0x30b756)[_0xef00('0x1f')](handleEntityNotFound(_0x2d0639,null))[_0xef00('0x1f')](respondWithResult(_0x2d0639,null))['catch'](handleError(_0x2d0639,null));};exports[_0xef00('0x42')]=function(_0x39c7dc,_0x21aed8){return db[_0xef00('0x26')][_0xef00('0x42')](_0x39c7dc[_0xef00('0x43')],{})[_0xef00('0x1f')](function(_0x33e9a6){var _0x3c6cbf=_0x39c7dc[_0xef00('0x44')]['get']({'plain':!![]});if(!_0x3c6cbf)throw new Error(_0xef00('0x45'));if(_0x3c6cbf['role']===_0xef00('0x44')){var _0xb39b1=_0x33e9a6[_0xef00('0x20')]({'plain':!![]});var _0x2e3f40=_0xef00('0x21');return db[_0xef00('0x46')]['find']({'where':{'name':_0x2e3f40,'userProfileId':_0x3c6cbf[_0xef00('0x47')]},'raw':!![]})[_0xef00('0x1f')](function(_0x3617ca){if(_0x3617ca&&_0x3617ca[_0xef00('0x48')]===0x0){return db[_0xef00('0x49')]['create']({'name':_0xb39b1[_0xef00('0x23')],'resourceId':_0xb39b1['id'],'type':_0x3617ca[_0xef00('0x23')],'sectionId':_0x3617ca['id']},{})[_0xef00('0x1f')](function(){return _0x33e9a6;});}else{return _0x33e9a6;}})[_0xef00('0x3e')](function(_0x5c81f1){logger['error'](_0xef00('0x4a'),_0x5c81f1);throw _0x5c81f1;});}return _0x33e9a6;})['then'](respondWithResult(_0x21aed8,0xc9))[_0xef00('0x3e')](handleError(_0x21aed8,null));};exports[_0xef00('0x4b')]=function(_0x14cf37,_0x2b6b45){if(_0x14cf37[_0xef00('0x43')]['id']){delete _0x14cf37[_0xef00('0x43')]['id'];}return db[_0xef00('0x26')][_0xef00('0x4c')]({'where':{'id':_0x14cf37['params']['id']}})[_0xef00('0x1f')](handleEntityNotFound(_0x2b6b45,null))[_0xef00('0x1f')](saveUpdates(_0x14cf37['body'],null))[_0xef00('0x1f')](respondWithResult(_0x2b6b45,null))[_0xef00('0x3e')](handleError(_0x2b6b45,null));};exports[_0xef00('0x1e')]=function(_0x798bcc,_0x382b95){return db['VoiceChanSpy'][_0xef00('0x4c')]({'where':{'id':_0x798bcc[_0xef00('0x4d')]['id']}})[_0xef00('0x1f')](handleEntityNotFound(_0x382b95,null))['then'](removeEntity(_0x382b95,null))['catch'](handleError(_0x382b95,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e0a7273..53fe30a 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 _0xaa9f=['then','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent'];(function(_0xed374a,_0x2c190e){var _0x4b4e80=function(_0x50edbd){while(--_0x50edbd){_0xed374a['push'](_0xed374a['shift']());}};_0x4b4e80(++_0x2c190e);}(_0xaa9f,0x81));var _0xfaa9=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xaa9f[_0xd511d];return _0x3f148e;};'use strict';var _=require('lodash');var util=require(_0xfaa9('0x0'));var BPromise=require(_0xfaa9('0x1'));var attributes=require(_0xfaa9('0x2'));var getUserApplications=function(_0x1fbbb2,_0x29165f,_0x478698){var _0x199dc1=0x1;var _0x24a275=[];var _0x7aaa1e={'context':_0x29165f[_0xfaa9('0x3')]||_0xfaa9('0x4'),'exten':util[_0xfaa9('0x5')]('%s%s',_0x1fbbb2[_0xfaa9('0x6')],_0x478698),'type':_0xfaa9('0x7'),'isApp':![],'ChanSpyId':_0x1fbbb2['id'],'UserId':_0x29165f['id']};_0x24a275[_0xfaa9('0x8')](_[_0xfaa9('0x9')]({'app':_0xfaa9('0xa'),'appdata':util[_0xfaa9('0x5')](_0xfaa9('0xb'),_0xfaa9('0xc')),'priority':_0x199dc1++},_0x7aaa1e));if(_0x1fbbb2[_0xfaa9('0xd')]){_0x24a275[_0xfaa9('0x8')](_[_0xfaa9('0x9')]({'app':_0xfaa9('0xe'),'appdata':util[_0xfaa9('0x5')](_0xfaa9('0xf'),_0x1fbbb2[_0xfaa9('0x10')]),'priority':_0x199dc1++},_0x7aaa1e));}if(_0x1fbbb2['auth']){_0x24a275['push'](_[_0xfaa9('0x9')]({'app':_0xfaa9('0x11'),'appdata':_0x1fbbb2[_0xfaa9('0x12')],'priority':_0x199dc1++},_0x7aaa1e));}_0x24a275[_0xfaa9('0x8')](_[_0xfaa9('0x9')]({'app':_0xfaa9('0x13'),'appdata':util[_0xfaa9('0x5')](_0xfaa9('0x14'),_0x29165f[_0xfaa9('0x15')],_0x1fbbb2['options']?_0x1fbbb2[_0xfaa9('0x16')][_0xfaa9('0x17')](''):''),'priority':_0x199dc1++},_0x7aaa1e));if(_0x1fbbb2[_0xfaa9('0xd')]){_0x24a275[_0xfaa9('0x8')](_[_0xfaa9('0x9')]({'app':_0xfaa9('0x18'),'priority':_0x199dc1++},_0x7aaa1e));}return _0x24a275;};var getChanSpyApplications=function(_0x195bc4,_0x3bf7bc){var _0x3b4b34=[];for(var _0x8f3824=0x0,_0x8a3aa2=0x1;_0x8f3824<_0x3bf7bc[_0xfaa9('0x19')];_0x8f3824++,_0x8a3aa2=0x1){_0x3b4b34=_0x3b4b34[_0xfaa9('0x1a')](getUserApplications(_0x195bc4,_0x3bf7bc[_0x8f3824],_0x3bf7bc[_0x8f3824][_0xfaa9('0x1b')]));if(_0x3bf7bc[_0x8f3824][_0xfaa9('0x1b')]!=_0x3bf7bc[_0x8f3824][_0xfaa9('0x15')]){_0x3b4b34=_0x3b4b34[_0xfaa9('0x1a')](getUserApplications(_0x195bc4,_0x3bf7bc[_0x8f3824],_0x3bf7bc[_0x8f3824]['name']));}}return _0x3b4b34;};var getChanSpyPromise=function(_0x2df1de,_0x5a35cc){return new BPromise(function(_0x41248f,_0x377b3b){return _0x2df1de[_0xfaa9('0x1c')][_0xfaa9('0x1d')]({'attributes':['id',_0xfaa9('0x15'),_0xfaa9('0x1b')],'where':{'role':_0xfaa9('0x1e'),'chanspy':!![]},'raw':!![]})[_0xfaa9('0x1f')](function(_0x4d00bc){if(_0x4d00bc){return _0x41248f(getChanSpyApplications(_0x5a35cc,_0x4d00bc));}return _0x41248f([]);})['catch'](function(_0x3da3a0){_0x377b3b(_0x3da3a0);});});};module['exports']=function(_0x525526,_0x3726fd){var _0x296fcd=_0x525526[_0xfaa9('0x20')];return _0x525526[_0xfaa9('0x21')](_0xfaa9('0x22'),attributes,{'tableName':_0xfaa9('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cf6f0,_0x89759a,_0x5680ab){return getChanSpyPromise(_0x296fcd,_0x3cf6f0)[_0xfaa9('0x1f')](function(_0x5dab08){if(_0x5dab08&&_0x5dab08[_0xfaa9('0x19')]){return _0x296fcd['VoiceExtension'][_0xfaa9('0x24')](_0x5dab08);}})[_0xfaa9('0x1f')](function(){_0x5680ab();})[_0xfaa9('0x25')](function(_0xbc012d){_0x5680ab(_0xbc012d);});},'afterUpdate':function(_0x328584,_0x5b96e1,_0x309630){return _0x296fcd[_0xfaa9('0x26')][_0xfaa9('0x27')]({'where':{'ChanSpyId':_0x328584['id']}})[_0xfaa9('0x1f')](function(){return getChanSpyPromise(_0x296fcd,_0x328584);})['then'](function(_0x234578){if(_0x234578&&_0x234578['length']){return _0x296fcd[_0xfaa9('0x26')][_0xfaa9('0x24')](_0x234578);}})[_0xfaa9('0x1f')](function(){_0x309630();})['catch'](function(_0x31ec18){_0x309630(_0x31ec18);});},'afterDestroy':function(_0x18a2a8,_0x2290dd,_0x4639a0){return _0x296fcd[_0xfaa9('0x26')][_0xfaa9('0x27')]({'where':{'ChanSpyId':_0x18a2a8['id']}})[_0xfaa9('0x1f')](function(){_0x4639a0();})[_0xfaa9('0x25')](function(_0x474da4){_0x4639a0(_0x474da4);});}}});}; \ No newline at end of file +var _0x0086=['util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','merge','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','models','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy'];(function(_0x1cc125,_0x2aebe0){var _0x5f3964=function(_0x43f943){while(--_0x43f943){_0x1cc125['push'](_0x1cc125['shift']());}};_0x5f3964(++_0x2aebe0);}(_0x0086,0x156));var _0x6008=function(_0x509e3f,_0x332207){_0x509e3f=_0x509e3f-0x0;var _0x53c3f7=_0x0086[_0x509e3f];return _0x53c3f7;};'use strict';var _=require('lodash');var util=require(_0x6008('0x0'));var BPromise=require(_0x6008('0x1'));var attributes=require(_0x6008('0x2'));var getUserApplications=function(_0x5d576b,_0x2c821b,_0xc6e2c7){var _0x807871=0x1;var _0x321d63=[];var _0x281aa4={'context':_0x2c821b['context']||_0x6008('0x3'),'exten':util['format'](_0x6008('0x4'),_0x5d576b[_0x6008('0x5')],_0xc6e2c7),'type':_0x6008('0x6'),'isApp':![],'ChanSpyId':_0x5d576b['id'],'UserId':_0x2c821b['id']};_0x321d63[_0x6008('0x7')](_['merge']({'app':_0x6008('0x8'),'appdata':util[_0x6008('0x9')](_0x6008('0xa'),_0x6008('0xb')),'priority':_0x807871++},_0x281aa4));if(_0x5d576b['record']){_0x321d63[_0x6008('0x7')](_[_0x6008('0xc')]({'app':_0x6008('0xd'),'appdata':util[_0x6008('0x9')]('${UNIQUEID}.%s,a',_0x5d576b['recordingFormat']),'priority':_0x807871++},_0x281aa4));}if(_0x5d576b['auth']){_0x321d63['push'](_[_0x6008('0xc')]({'app':_0x6008('0xe'),'appdata':_0x5d576b[_0x6008('0xf')],'priority':_0x807871++},_0x281aa4));}_0x321d63[_0x6008('0x7')](_[_0x6008('0xc')]({'app':_0x6008('0x10'),'appdata':util[_0x6008('0x9')](_0x6008('0x11'),_0x2c821b[_0x6008('0x12')],_0x5d576b['options']?_0x5d576b[_0x6008('0x13')][_0x6008('0x14')](''):''),'priority':_0x807871++},_0x281aa4));if(_0x5d576b[_0x6008('0x15')]){_0x321d63['push'](_[_0x6008('0xc')]({'app':_0x6008('0x16'),'priority':_0x807871++},_0x281aa4));}return _0x321d63;};var getChanSpyApplications=function(_0x92a4bb,_0x3228fd){var _0x3f2996=[];for(var _0x4bd0ca=0x0,_0x1097aa=0x1;_0x4bd0ca<_0x3228fd[_0x6008('0x17')];_0x4bd0ca++,_0x1097aa=0x1){_0x3f2996=_0x3f2996[_0x6008('0x18')](getUserApplications(_0x92a4bb,_0x3228fd[_0x4bd0ca],_0x3228fd[_0x4bd0ca][_0x6008('0x19')]));if(_0x3228fd[_0x4bd0ca][_0x6008('0x19')]!=_0x3228fd[_0x4bd0ca][_0x6008('0x12')]){_0x3f2996=_0x3f2996['concat'](getUserApplications(_0x92a4bb,_0x3228fd[_0x4bd0ca],_0x3228fd[_0x4bd0ca][_0x6008('0x12')]));}}return _0x3f2996;};var getChanSpyPromise=function(_0x53626e,_0x59a64c){return new BPromise(function(_0x171a50,_0x87093b){return _0x53626e[_0x6008('0x1a')][_0x6008('0x1b')]({'attributes':['id',_0x6008('0x12'),_0x6008('0x19')],'where':{'role':_0x6008('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5d1edf){if(_0x5d1edf){return _0x171a50(getChanSpyApplications(_0x59a64c,_0x5d1edf));}return _0x171a50([]);})[_0x6008('0x1d')](function(_0x5d74b1){_0x87093b(_0x5d74b1);});});};module[_0x6008('0x1e')]=function(_0x336b48,_0x4f930c){var _0xd7373f=_0x336b48[_0x6008('0x1f')];return _0x336b48['define'](_0x6008('0x20'),attributes,{'tableName':_0x6008('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50db5c,_0x1a173e,_0xebb99d){return getChanSpyPromise(_0xd7373f,_0x50db5c)[_0x6008('0x22')](function(_0x306300){if(_0x306300&&_0x306300[_0x6008('0x17')]){return _0xd7373f['VoiceExtension'][_0x6008('0x23')](_0x306300);}})[_0x6008('0x22')](function(){_0xebb99d();})[_0x6008('0x1d')](function(_0x5b23da){_0xebb99d(_0x5b23da);});},'afterUpdate':function(_0x55b2ab,_0xa86453,_0x2969ac){return _0xd7373f[_0x6008('0x24')]['destroy']({'where':{'ChanSpyId':_0x55b2ab['id']}})['then'](function(){return getChanSpyPromise(_0xd7373f,_0x55b2ab);})[_0x6008('0x22')](function(_0x59ac2d){if(_0x59ac2d&&_0x59ac2d[_0x6008('0x17')]){return _0xd7373f[_0x6008('0x24')]['bulkCreate'](_0x59ac2d);}})['then'](function(){_0x2969ac();})[_0x6008('0x1d')](function(_0x133fd1){_0x2969ac(_0x133fd1);});},'afterDestroy':function(_0x440369,_0x361f66,_0x1bd43d){return _0xd7373f['VoiceExtension'][_0x6008('0x25')]({'where':{'ChanSpyId':_0x440369['id']}})[_0x6008('0x22')](function(){_0x1bd43d();})['catch'](function(_0x2e7112){_0x1bd43d(_0x2e7112);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b47096a..e9eb772 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 _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5aeb5c,_0x31d1d6){var _0x244996=function(_0x210044){while(--_0x210044){_0x5aeb5c['push'](_0x5aeb5c['shift']());}};_0x244996(++_0x31d1d6);}(_0xda55,0x6d));var _0x5da5=function(_0x57aad9,_0x2cceaf){_0x57aad9=_0x57aad9-0x0;var _0x237671=_0xda55[_0x57aad9];return _0x237671;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file +var _0x3f8c=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x56957a,_0x303245){var _0x4864b7=function(_0xc640d3){while(--_0xc640d3){_0x56957a['push'](_0x56957a['shift']());}};_0x4864b7(++_0x303245);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4e34ef,_0x2bc057){_0x4e34ef=_0x4e34ef-0x0;var _0x9b32b9=_0x3f8c[_0x4e34ef];return _0x9b32b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8794a7c..c7aaa49 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 _0x508b=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x447346,_0x56bbe5){var _0x323f2d=function(_0x4f974d){while(--_0x4f974d){_0x447346['push'](_0x447346['shift']());}};_0x323f2d(++_0x56bbe5);}(_0x508b,0x12c));var _0xb508=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0x508b[_0x5383f1];return _0xa23930;};'use strict';var multer=require(_0xb508('0x0'));var util=require('util');var path=require(_0xb508('0x1'));var timeout=require('connect-timeout');var express=require(_0xb508('0x2'));var router=express['Router']();var fs_extra=require(_0xb508('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb508('0x4'));var config=require(_0xb508('0x5'));var controller=require(_0xb508('0x6'));router[_0xb508('0x7')]('/',auth[_0xb508('0x8')](),controller[_0xb508('0x9')]);router['get'](_0xb508('0xa'),auth[_0xb508('0x8')](),controller['show']);router[_0xb508('0xb')]('/',auth['isAuthenticated'](),controller[_0xb508('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb508('0xd')](_0xb508('0xa'),auth[_0xb508('0x8')](),controller[_0xb508('0xe')]);module[_0xb508('0xf')]=router; \ No newline at end of file +var _0x8c33=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','post','create','/:id','multer','util'];(function(_0x124619,_0x282505){var _0x3e79c8=function(_0x1e6af4){while(--_0x1e6af4){_0x124619['push'](_0x124619['shift']());}};_0x3e79c8(++_0x282505);}(_0x8c33,0x1be));var _0x38c3=function(_0x17a298,_0xbd3f81){_0x17a298=_0x17a298-0x0;var _0x2d4200=_0x8c33[_0x17a298];return _0x2d4200;};'use strict';var multer=require(_0x38c3('0x0'));var util=require(_0x38c3('0x1'));var path=require(_0x38c3('0x2'));var timeout=require(_0x38c3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x38c3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x38c3('0x5'));var config=require(_0x38c3('0x6'));var controller=require(_0x38c3('0x7'));router[_0x38c3('0x8')]('/',auth[_0x38c3('0x9')](),controller[_0x38c3('0xa')]);router[_0x38c3('0x8')]('/:id',auth[_0x38c3('0x9')](),controller['show']);router[_0x38c3('0xb')]('/',auth[_0x38c3('0x9')](),controller[_0x38c3('0xc')]);router['put'](_0x38c3('0xd'),auth[_0x38c3('0x9')](),controller['update']);router['delete'](_0x38c3('0xd'),auth[_0x38c3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 77d7b86..af2ac2b 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 _0x3a0e=['exports','name'];(function(_0x5c6c2e,_0x86e980){var _0xd262ac=function(_0x2469a1){while(--_0x2469a1){_0x5c6c2e['push'](_0x5c6c2e['shift']());}};_0xd262ac(++_0x86e980);}(_0x3a0e,0x122));var _0xe3a0=function(_0x3f467f,_0x389c73){_0x3f467f=_0x3f467f-0x0;var _0x2d0956=_0x3a0e[_0x3f467f];return _0x2d0956;};'use strict';var Sequelize=require('sequelize');module[_0xe3a0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe3a0('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc24b=['BOOLEAN','STRING'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xc24b,0xa5));var _0xbc24=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xc24b[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbc24('0x0')],'unique':'name'},'description':{'type':Sequelize[_0xbc24('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbc24('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 9fac5a4..8206692 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 _0xc94e=['utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','params','fields','find','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs'];(function(_0x4c9908,_0x24d8c5){var _0x528b7e=function(_0x69eb8e){while(--_0x69eb8e){_0x4c9908['push'](_0x4c9908['shift']());}};_0x528b7e(++_0x24d8c5);}(_0xc94e,0xdd));var _0xec94=function(_0x377779,_0x444539){_0x377779=_0x377779-0x0;var _0x310f4a=_0xc94e[_0x377779];return _0x310f4a;};'use strict';var emlformat=require(_0xec94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec94('0x1'));var jsonpatch=require(_0xec94('0x2'));var rp=require('request-promise');var moment=require(_0xec94('0x3'));var BPromise=require(_0xec94('0x4'));var Mustache=require(_0xec94('0x5'));var util=require(_0xec94('0x6'));var path=require(_0xec94('0x7'));var sox=require(_0xec94('0x8'));var csv=require(_0xec94('0x9'));var ejs=require(_0xec94('0xa'));var fs=require('fs');var fs_extra=require(_0xec94('0xb'));var _=require(_0xec94('0xc'));var squel=require('squel');var crypto=require(_0xec94('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xec94('0xe'));var toCsv=require('to-csv');var querystring=require(_0xec94('0xf'));var Papa=require(_0xec94('0x10'));var Redis=require(_0xec94('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec94('0x12'));var hardwareService=require(_0xec94('0x13'));var logger=require(_0xec94('0x14'))('api');var utils=require(_0xec94('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec94('0x16'));var db=require(_0xec94('0x17'))['db'];var jayson=require(_0xec94('0x18'));var client=jayson['client'][_0xec94('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x14479b,_0x429d09,_0x5ae434,_0x541733){return new BPromise(function(_0x156d8b,_0x1de6a4){var _0x48e1e6=_0x541733||client;return _0x48e1e6['request'](_0x14479b,_0x5ae434)[_0xec94('0x1a')](function(_0x2bbb88){logger[_0xec94('0x1b')](_0xec94('0x1c'),_0x429d09,_0xec94('0x1d'));logger[_0xec94('0x1e')](_0xec94('0x1f'),_0x429d09,'request\x20sent',JSON[_0xec94('0x20')](_0x2bbb88));if(_0x2bbb88[_0xec94('0x21')]){if(_0x2bbb88[_0xec94('0x21')][_0xec94('0x22')]===0x1f4){logger[_0xec94('0x21')](_0xec94('0x1c'),_0x429d09,_0x2bbb88[_0xec94('0x21')][_0xec94('0x23')]);return _0x1de6a4(_0x2bbb88[_0xec94('0x21')][_0xec94('0x23')]);}logger['error'](_0xec94('0x1c'),_0x429d09,_0x2bbb88[_0xec94('0x21')][_0xec94('0x23')]);return _0x156d8b(_0x2bbb88[_0xec94('0x21')]['message']);}else{logger[_0xec94('0x1b')](_0xec94('0x1c'),_0x429d09,_0xec94('0x1d'));_0x156d8b(_0x2bbb88[_0xec94('0x24')]['message']);}})[_0xec94('0x25')](function(_0x1f1eb6){logger[_0xec94('0x21')](_0xec94('0x1c'),_0x429d09,_0x1f1eb6);_0x1de6a4(_0x1f1eb6);});});}function respondWithStatusCode(_0x3c9c39,_0x4cc07f){_0x4cc07f=_0x4cc07f||0xcc;return function(_0x559d0f){if(_0x559d0f){return _0x3c9c39[_0xec94('0x26')](_0x4cc07f);}return _0x3c9c39['status'](_0x4cc07f)[_0xec94('0x27')]();};}function respondWithResult(_0x4d9b77,_0x14f95f){_0x14f95f=_0x14f95f||0xc8;return function(_0x2f9289){if(_0x2f9289){return _0x4d9b77['status'](_0x14f95f)[_0xec94('0x28')](_0x2f9289);}};}function respondWithFilteredResult(_0x4f2534,_0x39f1cc){return function(_0x4a39d4){if(_0x4a39d4){var _0x520b09=typeof _0x39f1cc[_0xec94('0x29')]===_0xec94('0x2a')&&typeof _0x39f1cc[_0xec94('0x2b')]===_0xec94('0x2a');var _0x11968f=_0x4a39d4[_0xec94('0x2c')];var _0x32cfaf=_0x520b09?0x0:_0x39f1cc[_0xec94('0x29')];var _0x2e49f8=_0x520b09?_0x4a39d4[_0xec94('0x2c')]:_0x39f1cc[_0xec94('0x29')]+_0x39f1cc[_0xec94('0x2b')];var _0x3f895a;if(_0x2e49f8>=_0x11968f){_0x2e49f8=_0x11968f;_0x3f895a=0xc8;}else{_0x3f895a=0xce;}_0x4f2534[_0xec94('0x2d')](_0x3f895a);return _0x4f2534[_0xec94('0x2e')](_0xec94('0x2f'),_0x32cfaf+'-'+_0x2e49f8+'/'+_0x11968f)[_0xec94('0x28')](_0x4a39d4);}return null;};}function patchUpdates(_0x5a8aa2){return function(_0x171c5d){try{jsonpatch[_0xec94('0x30')](_0x171c5d,_0x5a8aa2,!![]);}catch(_0x965a8b){return BPromise[_0xec94('0x31')](_0x965a8b);}return _0x171c5d[_0xec94('0x32')]();};}function saveUpdates(_0x55f52c,_0x1a931c){return function(_0x376a1e){if(_0x376a1e){return _0x376a1e[_0xec94('0x33')](_0x55f52c)[_0xec94('0x1a')](function(_0x1ffca1){return _0x1ffca1;});}return null;};}function removeEntity(_0x590996,_0x480e2d){return function(_0x4226b8){if(_0x4226b8){return _0x4226b8[_0xec94('0x34')]()[_0xec94('0x1a')](function(){var _0x3e1d72=_0x4226b8['get']({'plain':!![]});var _0x4253fd=_0xec94('0x35');return db[_0xec94('0x36')]['destroy']({'where':{'type':_0x4253fd,'resourceId':_0x3e1d72['id']}})['then'](function(){return _0x4226b8;});})['then'](function(){_0x590996[_0xec94('0x2d')](0xcc)[_0xec94('0x27')]();});}};}function handleEntityNotFound(_0x4aa3e5,_0x2c54f7){return function(_0x4ee790){if(!_0x4ee790){_0x4aa3e5[_0xec94('0x26')](0x194);}return _0x4ee790;};}function handleError(_0x3e10be,_0x3c958a){_0x3c958a=_0x3c958a||0x1f4;return function(_0x1cbdfd){logger[_0xec94('0x21')](_0x1cbdfd['stack']);if(_0x1cbdfd[_0xec94('0x37')]){delete _0x1cbdfd['name'];}_0x3e10be[_0xec94('0x2d')](_0x3c958a)[_0xec94('0x38')](_0x1cbdfd);};}exports[_0xec94('0x39')]=function(_0x3b97c2,_0x399852){var _0x232344={},_0x1bb500={},_0x316071={'count':0x0,'rows':[]};var _0x5ee500=_[_0xec94('0x3a')](db[_0xec94('0x3b')][_0xec94('0x3c')],function(_0x2c2852){return{'name':_0x2c2852[_0xec94('0x3d')],'type':_0x2c2852['type'][_0xec94('0x3e')]};});_0x1bb500[_0xec94('0x3f')]=_[_0xec94('0x3a')](_0x5ee500,'name');_0x1bb500[_0xec94('0x40')]=_[_0xec94('0x41')](_0x3b97c2[_0xec94('0x40')]);_0x1bb500[_0xec94('0x42')]=_[_0xec94('0x43')](_0x1bb500['model'],_0x1bb500['query']);_0x232344[_0xec94('0x44')]=_[_0xec94('0x43')](_0x1bb500[_0xec94('0x3f')],qs['fields'](_0x3b97c2['query']['fields']));_0x232344[_0xec94('0x44')]=_0x232344[_0xec94('0x44')][_0xec94('0x45')]?_0x232344[_0xec94('0x44')]:_0x1bb500[_0xec94('0x3f')];if(!_0x3b97c2[_0xec94('0x40')][_0xec94('0x46')](_0xec94('0x47'))){_0x232344[_0xec94('0x2b')]=qs[_0xec94('0x2b')](_0x3b97c2['query'][_0xec94('0x2b')]);_0x232344[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x3b97c2[_0xec94('0x40')][_0xec94('0x29')]);}_0x232344[_0xec94('0x48')]=qs[_0xec94('0x49')](_0x3b97c2[_0xec94('0x40')][_0xec94('0x49')]);_0x232344['where']=qs[_0xec94('0x42')](_['pick'](_0x3b97c2[_0xec94('0x40')],_0x1bb500[_0xec94('0x42')]),_0x5ee500);if(_0x3b97c2[_0xec94('0x40')][_0xec94('0x4a')]){_0x232344[_0xec94('0x4b')]=_[_0xec94('0x4c')](_0x232344[_0xec94('0x4b')],{'$or':_[_0xec94('0x3a')](_0x5ee500,function(_0xc813){if(_0xc813['type']!==_0xec94('0x4d')){var _0x649839={};_0x649839[_0xc813[_0xec94('0x37')]]={'$like':'%'+_0x3b97c2[_0xec94('0x40')][_0xec94('0x4a')]+'%'};return _0x649839;}})});}_0x232344=_[_0xec94('0x4c')]({},_0x232344,_0x3b97c2[_0xec94('0x4e')]);var _0x220e17={'where':_0x232344[_0xec94('0x4b')]};return db[_0xec94('0x3b')][_0xec94('0x2c')](_0x220e17)['then'](function(_0x2da197){_0x316071[_0xec94('0x2c')]=_0x2da197;if(_0x3b97c2[_0xec94('0x40')]['includeAll']){_0x232344[_0xec94('0x4f')]=[{'all':!![]}];}return db[_0xec94('0x3b')]['findAll'](_0x232344);})[_0xec94('0x1a')](function(_0x4f510d){_0x316071[_0xec94('0x50')]=_0x4f510d;return _0x316071;})['then'](respondWithFilteredResult(_0x399852,_0x232344))['catch'](handleError(_0x399852,null));};exports['show']=function(_0x168efc,_0x14e35f){var _0x109ad0={'raw':![],'where':{'id':_0x168efc[_0xec94('0x51')]['id']}},_0x28d88d={};_0x28d88d[_0xec94('0x3f')]=_[_0xec94('0x41')](db[_0xec94('0x3b')][_0xec94('0x3c')]);_0x28d88d[_0xec94('0x40')]=_['keys'](_0x168efc[_0xec94('0x40')]);_0x28d88d['filters']=_[_0xec94('0x43')](_0x28d88d[_0xec94('0x3f')],_0x28d88d['query']);_0x109ad0[_0xec94('0x44')]=_['intersection'](_0x28d88d['model'],qs[_0xec94('0x52')](_0x168efc['query'][_0xec94('0x52')]));_0x109ad0['attributes']=_0x109ad0['attributes'][_0xec94('0x45')]?_0x109ad0[_0xec94('0x44')]:_0x28d88d[_0xec94('0x3f')];if(_0x168efc[_0xec94('0x40')]['includeAll']){_0x109ad0[_0xec94('0x4f')]=[{'all':!![]}];}_0x109ad0=_[_0xec94('0x4c')]({},_0x109ad0,_0x168efc[_0xec94('0x4e')]);return db[_0xec94('0x3b')][_0xec94('0x53')](_0x109ad0)[_0xec94('0x1a')](handleEntityNotFound(_0x14e35f,null))['then'](respondWithResult(_0x14e35f,null))[_0xec94('0x25')](handleError(_0x14e35f,null));};exports[_0xec94('0x54')]=function(_0x2fdcdc,_0x54078b,_0x200bb8){var _0x48ff43;return db[_0xec94('0x3b')][_0xec94('0x54')](_0x2fdcdc[_0xec94('0x55')],{'raw':!![]})['then'](function(_0x42caae){_0x48ff43=_0x42caae;return db[_0xec94('0x3b')][_0xec94('0x56')]({'raw':!![]});})[_0xec94('0x1a')](function(_0x3632aa){var _0x3f43fd=fs[_0xec94('0x57')](path[_0xec94('0x58')](config[_0xec94('0x59')],_0xec94('0x5a')),_0xec94('0x5b'));var _0x9401af=ejs[_0xec94('0x5c')](_0x3f43fd,{'contexts':_0x3632aa||[]});fs[_0xec94('0x5d')](_0xec94('0x5e'),_0x9401af);})[_0xec94('0x1a')](function(){return respondWithRpcPromise(_0xec94('0x5f'),_0xec94('0x54'),{'module':_0xec94('0x60')});})[_0xec94('0x1a')](function(){var _0x4528a6=_0x2fdcdc[_0xec94('0x61')][_0xec94('0x62')]({'plain':!![]});if(!_0x4528a6)throw new Error(_0xec94('0x63'));if(_0x4528a6[_0xec94('0x64')]===_0xec94('0x61')){var _0x1a7278=_0x48ff43[_0xec94('0x62')]({'plain':!![]});return db[_0xec94('0x65')][_0xec94('0x53')]({'where':{'name':'Contexts','userProfileId':_0x4528a6['userProfileId']},'raw':!![]})[_0xec94('0x1a')](function(_0x31d199){if(_0x31d199&&_0x31d199[_0xec94('0x66')]===0x0){return db[_0xec94('0x36')]['create']({'name':_0x1a7278[_0xec94('0x37')],'resourceId':_0x1a7278['id'],'type':_0x31d199[_0xec94('0x37')],'sectionId':_0x31d199['id']},{})[_0xec94('0x1a')](function(){return _0x48ff43;});}else{return _0x48ff43;}})[_0xec94('0x25')](function(_0x479b56){logger[_0xec94('0x21')](_0xec94('0x67'),_0x479b56);throw _0x479b56;});}return _0x48ff43;})[_0xec94('0x1a')](respondWithResult(_0x54078b,0xc9))['catch'](handleError(_0x54078b,null));};exports[_0xec94('0x33')]=function(_0x4e340d,_0x15e089,_0xa923c1){var _0x432b07;return db[_0xec94('0x3b')]['find']({'where':{'id':_0x4e340d[_0xec94('0x51')]['id']}})[_0xec94('0x1a')](handleEntityNotFound(_0x15e089,null))[_0xec94('0x1a')](saveUpdates(_0x4e340d['body'],null))[_0xec94('0x1a')](function(_0x481a66){if(_0x481a66){_0x432b07=_0x481a66;return db[_0xec94('0x3b')][_0xec94('0x56')]({'raw':!![]});}})['then'](function(_0x5008f6){var _0x482452=fs[_0xec94('0x57')](path['join'](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x234326=ejs[_0xec94('0x5c')](_0x482452,{'contexts':_0x5008f6||[]});fs[_0xec94('0x5d')](_0xec94('0x5e'),_0x234326);})[_0xec94('0x1a')](function(){return respondWithRpcPromise(_0xec94('0x5f'),_0xec94('0x33'),{'module':'chan_sip.so'});})[_0xec94('0x1a')](function(){return _0x432b07;})[_0xec94('0x1a')](respondWithResult(_0x15e089,null))[_0xec94('0x25')](handleError(_0x15e089,null));};exports[_0xec94('0x34')]=function(_0x1d4ed0,_0x176460,_0x430a38){var _0x45b280;return db[_0xec94('0x3b')][_0xec94('0x53')]({'where':{'id':_0x1d4ed0[_0xec94('0x51')]['id']}})[_0xec94('0x1a')](handleEntityNotFound(_0x176460,null))[_0xec94('0x1a')](removeEntity(_0x176460,null))[_0xec94('0x1a')](function(){return db[_0xec94('0x3b')][_0xec94('0x56')]({'raw':!![]});})['then'](function(_0x41bfdc){var _0x24d47b=fs[_0xec94('0x57')](path[_0xec94('0x58')](config['root'],'server/files/templates/context.ejs'),_0xec94('0x5b'));var _0x4ebb03=ejs[_0xec94('0x5c')](_0x24d47b,{'contexts':_0x41bfdc});fs['writeFileSync'](_0xec94('0x5e'),_0x4ebb03);return respondWithRpcPromise(_0xec94('0x5f'),_0xec94('0x34'),{'module':_0xec94('0x60')});})[_0xec94('0x25')](handleError(_0x176460,null));}; \ No newline at end of file +var _0xafab=['Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','chan_sip.so','render','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','include','findAll','rows','params','includeAll','options','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x2ff2a9,_0x251bfc){var _0x17c7b5=function(_0x18da7e){while(--_0x18da7e){_0x2ff2a9['push'](_0x2ff2a9['shift']());}};_0x17c7b5(++_0x251bfc);}(_0xafab,0x128));var _0xbafa=function(_0x1f3177,_0x145892){_0x1f3177=_0x1f3177-0x0;var _0x1e9044=_0xafab[_0x1f3177];return _0x1e9044;};'use strict';var emlformat=require(_0xbafa('0x0'));var rimraf=require(_0xbafa('0x1'));var zipdir=require(_0xbafa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbafa('0x3'));var moment=require(_0xbafa('0x4'));var BPromise=require(_0xbafa('0x5'));var Mustache=require(_0xbafa('0x6'));var util=require(_0xbafa('0x7'));var path=require(_0xbafa('0x8'));var sox=require(_0xbafa('0x9'));var csv=require(_0xbafa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbafa('0xb'));var _=require(_0xbafa('0xc'));var squel=require(_0xbafa('0xd'));var crypto=require(_0xbafa('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbafa('0xf'));var toCsv=require(_0xbafa('0xa'));var querystring=require('querystring');var Papa=require(_0xbafa('0x10'));var Redis=require('ioredis');var authService=require(_0xbafa('0x11'));var qs=require(_0xbafa('0x12'));var as=require(_0xbafa('0x13'));var hardwareService=require(_0xbafa('0x14'));var logger=require(_0xbafa('0x15'))(_0xbafa('0x16'));var utils=require('../../config/utils');var config=require(_0xbafa('0x17'));var licenseUtil=require(_0xbafa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbafa('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1926eb,_0x4e6d09,_0x327ab5,_0x1a5e8e){return new BPromise(function(_0x2131f2,_0xa0e2ba){var _0x3c460d=_0x1a5e8e||client;return _0x3c460d[_0xbafa('0x1a')](_0x1926eb,_0x327ab5)[_0xbafa('0x1b')](function(_0x17173c){logger[_0xbafa('0x1c')](_0xbafa('0x1d'),_0x4e6d09,_0xbafa('0x1e'));logger[_0xbafa('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4e6d09,_0xbafa('0x1e'),JSON['stringify'](_0x17173c));if(_0x17173c[_0xbafa('0x20')]){if(_0x17173c[_0xbafa('0x20')][_0xbafa('0x21')]===0x1f4){logger[_0xbafa('0x20')](_0xbafa('0x1d'),_0x4e6d09,_0x17173c[_0xbafa('0x20')][_0xbafa('0x22')]);return _0xa0e2ba(_0x17173c[_0xbafa('0x20')]['message']);}logger[_0xbafa('0x20')](_0xbafa('0x1d'),_0x4e6d09,_0x17173c['error'][_0xbafa('0x22')]);return _0x2131f2(_0x17173c['error'][_0xbafa('0x22')]);}else{logger[_0xbafa('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x4e6d09,_0xbafa('0x1e'));_0x2131f2(_0x17173c[_0xbafa('0x23')][_0xbafa('0x22')]);}})[_0xbafa('0x24')](function(_0x235064){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4e6d09,_0x235064);_0xa0e2ba(_0x235064);});});}function respondWithStatusCode(_0x1ca89c,_0x5345f8){_0x5345f8=_0x5345f8||0xcc;return function(_0x15be05){if(_0x15be05){return _0x1ca89c[_0xbafa('0x25')](_0x5345f8);}return _0x1ca89c[_0xbafa('0x26')](_0x5345f8)[_0xbafa('0x27')]();};}function respondWithResult(_0x27901b,_0x4963c5){_0x4963c5=_0x4963c5||0xc8;return function(_0x260f01){if(_0x260f01){return _0x27901b[_0xbafa('0x26')](_0x4963c5)[_0xbafa('0x28')](_0x260f01);}};}function respondWithFilteredResult(_0x29fd31,_0xa317ce){return function(_0x2cbeae){if(_0x2cbeae){var _0x481bbd=typeof _0xa317ce[_0xbafa('0x29')]===_0xbafa('0x2a')&&typeof _0xa317ce[_0xbafa('0x2b')]===_0xbafa('0x2a');var _0x4fd5de=_0x2cbeae[_0xbafa('0x2c')];var _0x17bfb4=_0x481bbd?0x0:_0xa317ce[_0xbafa('0x29')];var _0x50f55c=_0x481bbd?_0x2cbeae[_0xbafa('0x2c')]:_0xa317ce[_0xbafa('0x29')]+_0xa317ce['limit'];var _0x54f37a;if(_0x50f55c>=_0x4fd5de){_0x50f55c=_0x4fd5de;_0x54f37a=0xc8;}else{_0x54f37a=0xce;}_0x29fd31[_0xbafa('0x26')](_0x54f37a);return _0x29fd31['set'](_0xbafa('0x2d'),_0x17bfb4+'-'+_0x50f55c+'/'+_0x4fd5de)[_0xbafa('0x28')](_0x2cbeae);}return null;};}function patchUpdates(_0x52ada8){return function(_0x5e3481){try{jsonpatch['apply'](_0x5e3481,_0x52ada8,!![]);}catch(_0x11530c){return BPromise['reject'](_0x11530c);}return _0x5e3481[_0xbafa('0x2e')]();};}function saveUpdates(_0x1efe80,_0x57270b){return function(_0x548609){if(_0x548609){return _0x548609['update'](_0x1efe80)[_0xbafa('0x1b')](function(_0x25bff7){return _0x25bff7;});}return null;};}function removeEntity(_0x5210eb,_0x55c684){return function(_0xf33f40){if(_0xf33f40){return _0xf33f40[_0xbafa('0x2f')]()[_0xbafa('0x1b')](function(){var _0x232794=_0xf33f40[_0xbafa('0x30')]({'plain':!![]});var _0x110e9a=_0xbafa('0x31');return db[_0xbafa('0x32')][_0xbafa('0x2f')]({'where':{'type':_0x110e9a,'resourceId':_0x232794['id']}})[_0xbafa('0x1b')](function(){return _0xf33f40;});})[_0xbafa('0x1b')](function(){_0x5210eb['status'](0xcc)[_0xbafa('0x27')]();});}};}function handleEntityNotFound(_0x16dd54,_0x298f9a){return function(_0x172e44){if(!_0x172e44){_0x16dd54[_0xbafa('0x25')](0x194);}return _0x172e44;};}function handleError(_0x51eac8,_0x3daec7){_0x3daec7=_0x3daec7||0x1f4;return function(_0xdeafc4){logger[_0xbafa('0x20')](_0xdeafc4[_0xbafa('0x33')]);if(_0xdeafc4[_0xbafa('0x34')]){delete _0xdeafc4[_0xbafa('0x34')];}_0x51eac8[_0xbafa('0x26')](_0x3daec7)['send'](_0xdeafc4);};}exports[_0xbafa('0x35')]=function(_0x1ac249,_0x414cf4){var _0x1493ff={},_0x2bbee0={},_0x677f59={'count':0x0,'rows':[]};var _0x1a81fe=_[_0xbafa('0x36')](db[_0xbafa('0x37')][_0xbafa('0x38')],function(_0x5a0b2b){return{'name':_0x5a0b2b[_0xbafa('0x39')],'type':_0x5a0b2b[_0xbafa('0x3a')][_0xbafa('0x3b')]};});_0x2bbee0[_0xbafa('0x3c')]=_[_0xbafa('0x36')](_0x1a81fe,_0xbafa('0x34'));_0x2bbee0[_0xbafa('0x3d')]=_[_0xbafa('0x3e')](_0x1ac249[_0xbafa('0x3d')]);_0x2bbee0['filters']=_[_0xbafa('0x3f')](_0x2bbee0[_0xbafa('0x3c')],_0x2bbee0[_0xbafa('0x3d')]);_0x1493ff[_0xbafa('0x40')]=_[_0xbafa('0x3f')](_0x2bbee0[_0xbafa('0x3c')],qs['fields'](_0x1ac249[_0xbafa('0x3d')][_0xbafa('0x41')]));_0x1493ff['attributes']=_0x1493ff[_0xbafa('0x40')][_0xbafa('0x42')]?_0x1493ff[_0xbafa('0x40')]:_0x2bbee0[_0xbafa('0x3c')];if(!_0x1ac249[_0xbafa('0x3d')]['hasOwnProperty'](_0xbafa('0x43'))){_0x1493ff[_0xbafa('0x2b')]=qs[_0xbafa('0x2b')](_0x1ac249[_0xbafa('0x3d')][_0xbafa('0x2b')]);_0x1493ff['offset']=qs['offset'](_0x1ac249[_0xbafa('0x3d')]['offset']);}_0x1493ff['order']=qs[_0xbafa('0x44')](_0x1ac249['query']['sort']);_0x1493ff['where']=qs[_0xbafa('0x45')](_['pick'](_0x1ac249[_0xbafa('0x3d')],_0x2bbee0[_0xbafa('0x45')]),_0x1a81fe);if(_0x1ac249[_0xbafa('0x3d')][_0xbafa('0x46')]){_0x1493ff[_0xbafa('0x47')]=_[_0xbafa('0x48')](_0x1493ff[_0xbafa('0x47')],{'$or':_[_0xbafa('0x36')](_0x1a81fe,function(_0x374f71){if(_0x374f71[_0xbafa('0x3a')]!=='VIRTUAL'){var _0x6442ef={};_0x6442ef[_0x374f71[_0xbafa('0x34')]]={'$like':'%'+_0x1ac249[_0xbafa('0x3d')]['filter']+'%'};return _0x6442ef;}})});}_0x1493ff=_[_0xbafa('0x48')]({},_0x1493ff,_0x1ac249['options']);var _0x4e3127={'where':_0x1493ff[_0xbafa('0x47')]};return db[_0xbafa('0x37')][_0xbafa('0x2c')](_0x4e3127)[_0xbafa('0x1b')](function(_0x3d5e3b){_0x677f59['count']=_0x3d5e3b;if(_0x1ac249[_0xbafa('0x3d')]['includeAll']){_0x1493ff[_0xbafa('0x49')]=[{'all':!![]}];}return db['VoiceContext'][_0xbafa('0x4a')](_0x1493ff);})[_0xbafa('0x1b')](function(_0x34171e){_0x677f59[_0xbafa('0x4b')]=_0x34171e;return _0x677f59;})['then'](respondWithFilteredResult(_0x414cf4,_0x1493ff))[_0xbafa('0x24')](handleError(_0x414cf4,null));};exports['show']=function(_0x573589,_0x46fcfb){var _0x2272d9={'raw':![],'where':{'id':_0x573589[_0xbafa('0x4c')]['id']}},_0x440481={};_0x440481[_0xbafa('0x3c')]=_[_0xbafa('0x3e')](db[_0xbafa('0x37')][_0xbafa('0x38')]);_0x440481[_0xbafa('0x3d')]=_[_0xbafa('0x3e')](_0x573589['query']);_0x440481['filters']=_[_0xbafa('0x3f')](_0x440481['model'],_0x440481[_0xbafa('0x3d')]);_0x2272d9['attributes']=_['intersection'](_0x440481[_0xbafa('0x3c')],qs[_0xbafa('0x41')](_0x573589[_0xbafa('0x3d')]['fields']));_0x2272d9[_0xbafa('0x40')]=_0x2272d9[_0xbafa('0x40')][_0xbafa('0x42')]?_0x2272d9[_0xbafa('0x40')]:_0x440481['model'];if(_0x573589[_0xbafa('0x3d')][_0xbafa('0x4d')]){_0x2272d9[_0xbafa('0x49')]=[{'all':!![]}];}_0x2272d9=_[_0xbafa('0x48')]({},_0x2272d9,_0x573589[_0xbafa('0x4e')]);return db[_0xbafa('0x37')][_0xbafa('0x4f')](_0x2272d9)['then'](handleEntityNotFound(_0x46fcfb,null))['then'](respondWithResult(_0x46fcfb,null))[_0xbafa('0x24')](handleError(_0x46fcfb,null));};exports[_0xbafa('0x50')]=function(_0x85c0f8,_0x3b90bc,_0x35b7bc){var _0x572f08;return db[_0xbafa('0x37')]['create'](_0x85c0f8[_0xbafa('0x51')],{'raw':!![]})[_0xbafa('0x1b')](function(_0x3d6078){_0x572f08=_0x3d6078;return db['VoiceContext'][_0xbafa('0x4a')]({'raw':!![]});})['then'](function(_0x53e8b3){var _0x4231b4=fs[_0xbafa('0x52')](path['join'](config[_0xbafa('0x53')],_0xbafa('0x54')),_0xbafa('0x55'));var _0x27eaa5=ejs['render'](_0x4231b4,{'contexts':_0x53e8b3||[]});fs[_0xbafa('0x56')](_0xbafa('0x57'),_0x27eaa5);})[_0xbafa('0x1b')](function(){return respondWithRpcPromise(_0xbafa('0x58'),_0xbafa('0x50'),{'module':'chan_sip.so'});})[_0xbafa('0x1b')](function(){var _0x506a09=_0x85c0f8['user'][_0xbafa('0x30')]({'plain':!![]});if(!_0x506a09)throw new Error(_0xbafa('0x59'));if(_0x506a09[_0xbafa('0x5a')]==='user'){var _0x55cdb7=_0x572f08[_0xbafa('0x30')]({'plain':!![]});return db[_0xbafa('0x5b')]['find']({'where':{'name':'Contexts','userProfileId':_0x506a09['userProfileId']},'raw':!![]})[_0xbafa('0x1b')](function(_0x166f8b){if(_0x166f8b&&_0x166f8b[_0xbafa('0x5c')]===0x0){return db[_0xbafa('0x32')]['create']({'name':_0x55cdb7['name'],'resourceId':_0x55cdb7['id'],'type':_0x166f8b[_0xbafa('0x34')],'sectionId':_0x166f8b['id']},{})[_0xbafa('0x1b')](function(){return _0x572f08;});}else{return _0x572f08;}})[_0xbafa('0x24')](function(_0x4f77a1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f77a1);throw _0x4f77a1;});}return _0x572f08;})['then'](respondWithResult(_0x3b90bc,0xc9))[_0xbafa('0x24')](handleError(_0x3b90bc,null));};exports[_0xbafa('0x5d')]=function(_0x34a707,_0x353be7,_0x4c205a){var _0x37eaa4;return db[_0xbafa('0x37')][_0xbafa('0x4f')]({'where':{'id':_0x34a707[_0xbafa('0x4c')]['id']}})[_0xbafa('0x1b')](handleEntityNotFound(_0x353be7,null))[_0xbafa('0x1b')](saveUpdates(_0x34a707[_0xbafa('0x51')],null))[_0xbafa('0x1b')](function(_0x141733){if(_0x141733){_0x37eaa4=_0x141733;return db[_0xbafa('0x37')][_0xbafa('0x4a')]({'raw':!![]});}})['then'](function(_0x996993){var _0x293e40=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0xbafa('0x55'));var _0x45c4df=ejs['render'](_0x293e40,{'contexts':_0x996993||[]});fs[_0xbafa('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x45c4df);})[_0xbafa('0x1b')](function(){return respondWithRpcPromise('Reload',_0xbafa('0x5d'),{'module':_0xbafa('0x5e')});})['then'](function(){return _0x37eaa4;})[_0xbafa('0x1b')](respondWithResult(_0x353be7,null))[_0xbafa('0x24')](handleError(_0x353be7,null));};exports['destroy']=function(_0x29915a,_0x4cfe23,_0xb911bb){var _0x3230e6;return db[_0xbafa('0x37')][_0xbafa('0x4f')]({'where':{'id':_0x29915a['params']['id']}})[_0xbafa('0x1b')](handleEntityNotFound(_0x4cfe23,null))[_0xbafa('0x1b')](removeEntity(_0x4cfe23,null))[_0xbafa('0x1b')](function(){return db[_0xbafa('0x37')][_0xbafa('0x4a')]({'raw':!![]});})['then'](function(_0x54fff7){var _0x2a4ebe=fs[_0xbafa('0x52')](path['join'](config['root'],_0xbafa('0x54')),'utf8');var _0x2ef640=ejs[_0xbafa('0x5f')](_0x2a4ebe,{'contexts':_0x54fff7});fs[_0xbafa('0x56')](_0xbafa('0x57'),_0x2ef640);return respondWithRpcPromise(_0xbafa('0x58'),_0xbafa('0x2f'),{'module':_0xbafa('0x5e')});})['catch'](handleError(_0x4cfe23,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 4fed2c5..a1a0b72 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 _0xa5ab=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x271c7e,_0xf7830f){var _0x3cb37d=function(_0x1f6467){while(--_0x1f6467){_0x271c7e['push'](_0x271c7e['shift']());}};_0x3cb37d(++_0xf7830f);}(_0xa5ab,0xca));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba5a('0x0'));var util=require(_0xba5a('0x1'));var logger=require(_0xba5a('0x2'))('api');var moment=require(_0xba5a('0x3'));var BPromise=require('bluebird');var rp=require(_0xba5a('0x4'));var fs=require('fs');var path=require(_0xba5a('0x5'));var rimraf=require(_0xba5a('0x6'));var config=require(_0xba5a('0x7'));var attributes=require(_0xba5a('0x8'));module[_0xba5a('0x9')]=function(_0x4ffeea,_0x22c2b7){return _0x4ffeea[_0xba5a('0xa')](_0xba5a('0xb'),attributes,{'tableName':_0xba5a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbf1=['request-promise','rimraf','./voiceContext.attributes','exports','define','VoiceContext','util','api','bluebird'];(function(_0x5e9c6d,_0x2957f7){var _0x32b9a3=function(_0x584145){while(--_0x584145){_0x5e9c6d['push'](_0x5e9c6d['shift']());}};_0x32b9a3(++_0x2957f7);}(_0xfbf1,0x10b));var _0x1fbf=function(_0x317be4,_0x4d8f0e){_0x317be4=_0x317be4-0x0;var _0x467cf9=_0xfbf1[_0x317be4];return _0x467cf9;};'use strict';var _=require('lodash');var util=require(_0x1fbf('0x0'));var logger=require('../../config/logger')(_0x1fbf('0x1'));var moment=require('moment');var BPromise=require(_0x1fbf('0x2'));var rp=require(_0x1fbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1fbf('0x4'));var config=require('../../config/environment');var attributes=require(_0x1fbf('0x5'));module[_0x1fbf('0x6')]=function(_0x2552fe,_0x80a881){return _0x2552fe[_0x1fbf('0x7')](_0x1fbf('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index c4dca4a..2a7265b 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 _0x9861=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ea9f7,_0x5b248b){var _0x22e9d1=function(_0x9585b0){while(--_0x9585b0){_0x2ea9f7['push'](_0x2ea9f7['shift']());}};_0x22e9d1(++_0x5b248b);}(_0x9861,0x176));var _0x1986=function(_0x25bb67,_0x3ee001){_0x25bb67=_0x25bb67-0x0;var _0x403a54=_0x9861[_0x25bb67];return _0x403a54;};'use strict';var _=require(_0x1986('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1986('0x1'));var rs=require(_0x1986('0x2'));var fs=require('fs');var Redis=require(_0x1986('0x3'));var db=require(_0x1986('0x4'))['db'];var utils=require(_0x1986('0x5'));var logger=require(_0x1986('0x6'))('rpc');var config=require(_0x1986('0x7'));var jayson=require(_0x1986('0x8'));var client=jayson[_0x1986('0x9')][_0x1986('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40a16f,_0xc5e066,_0x412444){return new BPromise(function(_0x4150da,_0x2bd40f){return client[_0x1986('0xb')](_0x40a16f,_0x412444)['then'](function(_0x14f7b4){logger[_0x1986('0xc')](_0x1986('0xd'),_0xc5e066,_0x1986('0xe'));logger['debug'](_0x1986('0xf'),_0xc5e066,_0x1986('0xe'),JSON['stringify'](_0x14f7b4));if(_0x14f7b4[_0x1986('0x10')]){if(_0x14f7b4['error']['code']===0x1f4){logger[_0x1986('0x10')](_0x1986('0xd'),_0xc5e066,_0x14f7b4[_0x1986('0x10')][_0x1986('0x11')]);return _0x2bd40f(_0x14f7b4[_0x1986('0x10')][_0x1986('0x11')]);}logger[_0x1986('0x10')](_0x1986('0xd'),_0xc5e066,_0x14f7b4[_0x1986('0x10')][_0x1986('0x11')]);return _0x4150da(_0x14f7b4['error']['message']);}else{logger[_0x1986('0xc')](_0x1986('0xd'),_0xc5e066,'request\x20sent');_0x4150da(_0x14f7b4[_0x1986('0x12')][_0x1986('0x11')]);}})[_0x1986('0x13')](function(_0x462f14){logger[_0x1986('0x10')](_0x1986('0xd'),_0xc5e066,_0x462f14);_0x2bd40f(_0x462f14);});});} \ No newline at end of file +var _0x7117=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x7117,0x1ec));var _0x7711=function(_0x1a0ed5,_0x2859c4){_0x1a0ed5=_0x1a0ed5-0x0;var _0x29a051=_0x7117[_0x1a0ed5];return _0x29a051;};'use strict';var _=require(_0x7711('0x0'));var util=require(_0x7711('0x1'));var moment=require(_0x7711('0x2'));var BPromise=require(_0x7711('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7711('0x4'));var db=require(_0x7711('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7711('0x6'))('rpc');var config=require(_0x7711('0x7'));var jayson=require(_0x7711('0x8'));var client=jayson[_0x7711('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x492137,_0x56d953,_0x50acc7){return new BPromise(function(_0x390862,_0xb9cae4){return client[_0x7711('0xa')](_0x492137,_0x50acc7)[_0x7711('0xb')](function(_0x4bb5fc){logger[_0x7711('0xc')](_0x7711('0xd'),_0x56d953,_0x7711('0xe'));logger[_0x7711('0xf')](_0x7711('0x10'),_0x56d953,'request\x20sent',JSON[_0x7711('0x11')](_0x4bb5fc));if(_0x4bb5fc[_0x7711('0x12')]){if(_0x4bb5fc['error'][_0x7711('0x13')]===0x1f4){logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x4bb5fc[_0x7711('0x12')][_0x7711('0x14')]);return _0xb9cae4(_0x4bb5fc[_0x7711('0x12')]['message']);}logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x4bb5fc[_0x7711('0x12')][_0x7711('0x14')]);return _0x390862(_0x4bb5fc['error'][_0x7711('0x14')]);}else{logger[_0x7711('0xc')](_0x7711('0xd'),_0x56d953,_0x7711('0xe'));_0x390862(_0x4bb5fc[_0x7711('0x15')][_0x7711('0x14')]);}})[_0x7711('0x16')](function(_0x1a9d42){logger[_0x7711('0x12')](_0x7711('0xd'),_0x56d953,_0x1a9d42);_0xb9cae4(_0x1a9d42);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d01625f..b0e1c98 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 _0xaced=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','put'];(function(_0x2d611c,_0x1bedc1){var _0x498d84=function(_0x2286ea){while(--_0x2286ea){_0x2d611c['push'](_0x2d611c['shift']());}};_0x498d84(++_0x1bedc1);}(_0xaced,0xa4));var _0xdace=function(_0x225065,_0x37d3f0){_0x225065=_0x225065-0x0;var _0x14cbd9=_0xaced[_0x225065];return _0x14cbd9;};'use strict';var multer=require(_0xdace('0x0'));var util=require(_0xdace('0x1'));var path=require(_0xdace('0x2'));var timeout=require(_0xdace('0x3'));var express=require(_0xdace('0x4'));var router=express[_0xdace('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdace('0x6'));var interaction=require(_0xdace('0x7'));var config=require(_0xdace('0x8'));var controller=require('./voiceDialReport.controller');router[_0xdace('0x9')]('/',auth[_0xdace('0xa')](),controller['index']);router['get'](_0xdace('0xb'),auth[_0xdace('0xa')](),controller[_0xdace('0xc')]);router[_0xdace('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdace('0xd')]);router[_0xdace('0xe')]('/',auth[_0xdace('0xa')](),controller['create']);router[_0xdace('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xdace('0x10')]);router[_0xdace('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xdace('0x12')]);module[_0xdace('0x13')]=router; \ No newline at end of file +var _0x028d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','express','Router','fs-extra'];(function(_0x123310,_0x1b03e0){var _0x25a23a=function(_0x1cbd2a){while(--_0x1cbd2a){_0x123310['push'](_0x123310['shift']());}};_0x25a23a(++_0x1b03e0);}(_0x028d,0xff));var _0xd028=function(_0x4ca925,_0x5ea0b1){_0x4ca925=_0x4ca925-0x0;var _0x1f54e6=_0x028d[_0x4ca925];return _0x1f54e6;};'use strict';var multer=require('multer');var util=require(_0xd028('0x0'));var path=require(_0xd028('0x1'));var timeout=require('connect-timeout');var express=require(_0xd028('0x2'));var router=express[_0xd028('0x3')]();var fs_extra=require(_0xd028('0x4'));var auth=require(_0xd028('0x5'));var interaction=require(_0xd028('0x6'));var config=require(_0xd028('0x7'));var controller=require('./voiceDialReport.controller');router[_0xd028('0x8')]('/',auth[_0xd028('0x9')](),controller[_0xd028('0xa')]);router[_0xd028('0x8')](_0xd028('0xb'),auth[_0xd028('0x9')](),controller[_0xd028('0xc')]);router[_0xd028('0x8')](_0xd028('0xd'),auth[_0xd028('0x9')](),controller[_0xd028('0xe')]);router[_0xd028('0xf')]('/',auth[_0xd028('0x9')](),controller[_0xd028('0x10')]);router['put'](_0xd028('0xd'),auth[_0xd028('0x9')](),controller[_0xd028('0x11')]);router[_0xd028('0x12')](_0xd028('0xd'),auth[_0xd028('0x9')](),controller['destroy']);module[_0xd028('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 5e37203..b569fbd 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x3fe30d,_0x469e48){var _0x37b3e1=function(_0x5f1a27){while(--_0x5f1a27){_0x3fe30d['push'](_0x3fe30d['shift']());}};_0x37b3e1(++_0x469e48);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x579126,_0x589f7b){_0x579126=_0x579126-0x0;var _0x304ad4=_0xd6d6[_0x579126];return _0x304ad4;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file +var _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x50f48d,_0x198cb7){var _0x12bb20=function(_0xc66b3a){while(--_0xc66b3a){_0x50f48d['push'](_0x50f48d['shift']());}};_0x12bb20(++_0x198cb7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x24ca[_0x5a26f5];return _0x2e9ef7;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 86bca81..fd6fdc8 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 _0x5dc0=['sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x26fd0d,_0x4a14ba){var _0x3dc658=function(_0x178304){while(--_0x178304){_0x26fd0d['push'](_0x26fd0d['shift']());}};_0x3dc658(++_0x4a14ba);}(_0x5dc0,0x14e));var _0x05dc=function(_0x27e1bf,_0x43e0ca){_0x27e1bf=_0x27e1bf-0x0;var _0xef0321=_0x5dc0[_0x27e1bf];return _0xef0321;};'use strict';var emlformat=require(_0x05dc('0x0'));var rimraf=require(_0x05dc('0x1'));var zipdir=require(_0x05dc('0x2'));var jsonpatch=require(_0x05dc('0x3'));var rp=require('request-promise');var moment=require(_0x05dc('0x4'));var BPromise=require(_0x05dc('0x5'));var Mustache=require(_0x05dc('0x6'));var util=require(_0x05dc('0x7'));var path=require(_0x05dc('0x8'));var sox=require(_0x05dc('0x9'));var csv=require('to-csv');var ejs=require(_0x05dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05dc('0xb'));var squel=require(_0x05dc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x05dc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x05dc('0xe'));var Papa=require(_0x05dc('0xf'));var Redis=require(_0x05dc('0x10'));var authService=require(_0x05dc('0x11'));var qs=require(_0x05dc('0x12'));var as=require(_0x05dc('0x13'));var hardwareService=require(_0x05dc('0x14'));var logger=require(_0x05dc('0x15'))(_0x05dc('0x16'));var utils=require(_0x05dc('0x17'));var config=require(_0x05dc('0x18'));var licenseUtil=require(_0x05dc('0x19'));var db=require(_0x05dc('0x1a'))['db'];function respondWithStatusCode(_0x275953,_0x55b406){_0x55b406=_0x55b406||0xcc;return function(_0x5cfb1b){if(_0x5cfb1b){return _0x275953[_0x05dc('0x1b')](_0x55b406);}return _0x275953[_0x05dc('0x1c')](_0x55b406)[_0x05dc('0x1d')]();};}function respondWithResult(_0x569b64,_0x50f8fe){_0x50f8fe=_0x50f8fe||0xc8;return function(_0x3753ad){if(_0x3753ad){return _0x569b64[_0x05dc('0x1c')](_0x50f8fe)[_0x05dc('0x1e')](_0x3753ad);}};}function respondWithFilteredResult(_0x46c2ec,_0x5706b1){return function(_0xe1932c){if(_0xe1932c){var _0x398c4b=typeof _0x5706b1[_0x05dc('0x1f')]===_0x05dc('0x20')&&typeof _0x5706b1[_0x05dc('0x21')]==='undefined';var _0x450b15=_0xe1932c[_0x05dc('0x22')];var _0x4b417d=_0x398c4b?0x0:_0x5706b1[_0x05dc('0x1f')];var _0x4a9c5d=_0x398c4b?_0xe1932c[_0x05dc('0x22')]:_0x5706b1['offset']+_0x5706b1[_0x05dc('0x21')];var _0xecef9;if(_0x4a9c5d>=_0x450b15){_0x4a9c5d=_0x450b15;_0xecef9=0xc8;}else{_0xecef9=0xce;}_0x46c2ec['status'](_0xecef9);return _0x46c2ec[_0x05dc('0x23')]('Content-Range',_0x4b417d+'-'+_0x4a9c5d+'/'+_0x450b15)[_0x05dc('0x1e')](_0xe1932c);}return null;};}function patchUpdates(_0xf1bf3e){return function(_0x235908){try{jsonpatch[_0x05dc('0x24')](_0x235908,_0xf1bf3e,!![]);}catch(_0x31ac9a){return BPromise[_0x05dc('0x25')](_0x31ac9a);}return _0x235908[_0x05dc('0x26')]();};}function saveUpdates(_0x166dc7,_0x4ee00d){return function(_0x3b7bb1){if(_0x3b7bb1){return _0x3b7bb1[_0x05dc('0x27')](_0x166dc7)[_0x05dc('0x28')](function(_0xd0d4d2){return _0xd0d4d2;});}return null;};}function removeEntity(_0x267e1e,_0x484c44){return function(_0x4303da){if(_0x4303da){return _0x4303da['destroy']()[_0x05dc('0x28')](function(){_0x267e1e[_0x05dc('0x1c')](0xcc)[_0x05dc('0x1d')]();});}};}function handleEntityNotFound(_0x20d747,_0xe9ba00){return function(_0x12136f){if(!_0x12136f){_0x20d747[_0x05dc('0x1b')](0x194);}return _0x12136f;};}function handleError(_0x428d0e,_0x2d78cc){_0x2d78cc=_0x2d78cc||0x1f4;return function(_0x2f6519){logger[_0x05dc('0x29')](_0x2f6519[_0x05dc('0x2a')]);if(_0x2f6519[_0x05dc('0x2b')]){delete _0x2f6519['name'];}_0x428d0e['status'](_0x2d78cc)[_0x05dc('0x2c')](_0x2f6519);};}exports[_0x05dc('0x2d')]=function(_0x18ce62,_0x4e35ab){var _0xd89057={},_0x2b2cee={},_0x2846d7={'count':0x0,'rows':[]};var _0x1c3ed1=_[_0x05dc('0x2e')](db[_0x05dc('0x2f')][_0x05dc('0x30')],function(_0x2f18da){return{'name':_0x2f18da[_0x05dc('0x31')],'type':_0x2f18da['type'][_0x05dc('0x32')]};});_0x2b2cee[_0x05dc('0x33')]=_['map'](_0x1c3ed1,_0x05dc('0x2b'));_0x2b2cee[_0x05dc('0x34')]=_[_0x05dc('0x35')](_0x18ce62[_0x05dc('0x34')]);_0x2b2cee[_0x05dc('0x36')]=_[_0x05dc('0x37')](_0x2b2cee[_0x05dc('0x33')],_0x2b2cee['query']);_0xd89057[_0x05dc('0x38')]=_[_0x05dc('0x37')](_0x2b2cee['model'],qs[_0x05dc('0x39')](_0x18ce62[_0x05dc('0x34')][_0x05dc('0x39')]));_0xd89057[_0x05dc('0x38')]=_0xd89057[_0x05dc('0x38')][_0x05dc('0x3a')]?_0xd89057[_0x05dc('0x38')]:_0x2b2cee[_0x05dc('0x33')];if(!_0x18ce62['query'][_0x05dc('0x3b')]('nolimit')){_0xd89057[_0x05dc('0x21')]=qs[_0x05dc('0x21')](_0x18ce62[_0x05dc('0x34')][_0x05dc('0x21')]);_0xd89057[_0x05dc('0x1f')]=qs['offset'](_0x18ce62[_0x05dc('0x34')][_0x05dc('0x1f')]);}_0xd89057[_0x05dc('0x3c')]=qs[_0x05dc('0x3d')](_0x18ce62['query'][_0x05dc('0x3d')]);_0xd89057[_0x05dc('0x3e')]=qs[_0x05dc('0x36')](_[_0x05dc('0x3f')](_0x18ce62[_0x05dc('0x34')],_0x2b2cee[_0x05dc('0x36')]),_0x1c3ed1);if(_0x18ce62[_0x05dc('0x34')][_0x05dc('0x40')]){_0xd89057[_0x05dc('0x3e')]=_[_0x05dc('0x41')](_0xd89057[_0x05dc('0x3e')],{'$or':_[_0x05dc('0x2e')](_0x1c3ed1,function(_0x47b7a3){if(_0x47b7a3[_0x05dc('0x42')]!==_0x05dc('0x43')){var _0x547635={};_0x547635[_0x47b7a3['name']]={'$like':'%'+_0x18ce62[_0x05dc('0x34')][_0x05dc('0x40')]+'%'};return _0x547635;}})});}_0xd89057=_['merge']({},_0xd89057,_0x18ce62[_0x05dc('0x44')]);var _0x5bd408={'where':_0xd89057[_0x05dc('0x3e')]};return db[_0x05dc('0x2f')][_0x05dc('0x22')](_0x5bd408)[_0x05dc('0x28')](function(_0x4bb7cc){_0x2846d7[_0x05dc('0x22')]=_0x4bb7cc;if(_0x18ce62[_0x05dc('0x34')][_0x05dc('0x45')]){_0xd89057[_0x05dc('0x46')]=[{'all':!![]}];}return db[_0x05dc('0x2f')]['findAll'](_0xd89057);})[_0x05dc('0x28')](function(_0x5a07e5){_0x2846d7['rows']=_0x5a07e5;return _0x2846d7;})[_0x05dc('0x28')](respondWithFilteredResult(_0x4e35ab,_0xd89057))[_0x05dc('0x47')](handleError(_0x4e35ab,null));};exports[_0x05dc('0x48')]=function(_0x4af13e,_0x111e16){var _0x3c0d8a={'raw':!![],'where':{'id':_0x4af13e[_0x05dc('0x49')]['id']}},_0xda0e33={};_0xda0e33[_0x05dc('0x33')]=_[_0x05dc('0x35')](db[_0x05dc('0x2f')][_0x05dc('0x30')]);_0xda0e33['query']=_[_0x05dc('0x35')](_0x4af13e[_0x05dc('0x34')]);_0xda0e33['filters']=_[_0x05dc('0x37')](_0xda0e33[_0x05dc('0x33')],_0xda0e33[_0x05dc('0x34')]);_0x3c0d8a[_0x05dc('0x38')]=_[_0x05dc('0x37')](_0xda0e33['model'],qs['fields'](_0x4af13e[_0x05dc('0x34')][_0x05dc('0x39')]));_0x3c0d8a[_0x05dc('0x38')]=_0x3c0d8a[_0x05dc('0x38')][_0x05dc('0x3a')]?_0x3c0d8a[_0x05dc('0x38')]:_0xda0e33[_0x05dc('0x33')];if(_0x4af13e[_0x05dc('0x34')][_0x05dc('0x45')]){_0x3c0d8a[_0x05dc('0x46')]=[{'all':!![]}];}_0x3c0d8a=_[_0x05dc('0x41')]({},_0x3c0d8a,_0x4af13e[_0x05dc('0x44')]);return db[_0x05dc('0x2f')]['find'](_0x3c0d8a)['then'](handleEntityNotFound(_0x111e16,null))['then'](respondWithResult(_0x111e16,null))[_0x05dc('0x47')](handleError(_0x111e16,null));};exports['create']=function(_0x2302e7,_0x43a327){return db[_0x05dc('0x2f')][_0x05dc('0x4a')](_0x2302e7[_0x05dc('0x4b')],{})[_0x05dc('0x28')](respondWithResult(_0x43a327,0xc9))[_0x05dc('0x47')](handleError(_0x43a327,null));};exports[_0x05dc('0x27')]=function(_0x1ef48d,_0x3ebdc3){if(_0x1ef48d[_0x05dc('0x4b')]['id']){delete _0x1ef48d[_0x05dc('0x4b')]['id'];}return db[_0x05dc('0x2f')][_0x05dc('0x4c')]({'where':{'id':_0x1ef48d[_0x05dc('0x49')]['id']}})[_0x05dc('0x28')](handleEntityNotFound(_0x3ebdc3,null))['then'](saveUpdates(_0x1ef48d[_0x05dc('0x4b')],null))[_0x05dc('0x28')](respondWithResult(_0x3ebdc3,null))['catch'](handleError(_0x3ebdc3,null));};exports[_0x05dc('0x4d')]=function(_0x367e18,_0xf81725){return db['VoiceDialReport']['find']({'where':{'id':_0x367e18[_0x05dc('0x49')]['id']}})[_0x05dc('0x28')](handleEntityNotFound(_0xf81725,null))[_0x05dc('0x28')](removeEntity(_0xf81725,null))[_0x05dc('0x47')](handleError(_0xf81725,null));};exports['describe']=function(_0x15b706,_0x6b8617){return db['VoiceDialReport'][_0x05dc('0x4e')]()[_0x05dc('0x28')](respondWithResult(_0x6b8617,null))[_0x05dc('0x47')](handleError(_0x6b8617,null));}; \ No newline at end of file +var _0xae16=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','name','keys','filters','intersection','fields','query','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0xc4733c,_0x2d9730){var _0x2855e9=function(_0x1a736e){while(--_0x1a736e){_0xc4733c['push'](_0xc4733c['shift']());}};_0x2855e9(++_0x2d9730);}(_0xae16,0x76));var _0x6ae1=function(_0x2ea0f0,_0xf151e1){_0x2ea0f0=_0x2ea0f0-0x0;var _0x4aa5c1=_0xae16[_0x2ea0f0];return _0x4aa5c1;};'use strict';var emlformat=require(_0x6ae1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ae1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ae1('0x2'));var BPromise=require(_0x6ae1('0x3'));var Mustache=require(_0x6ae1('0x4'));var util=require(_0x6ae1('0x5'));var path=require(_0x6ae1('0x6'));var sox=require(_0x6ae1('0x7'));var csv=require('to-csv');var ejs=require(_0x6ae1('0x8'));var fs=require('fs');var fs_extra=require(_0x6ae1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ae1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ae1('0xb'));var querystring=require(_0x6ae1('0xc'));var Papa=require('papaparse');var Redis=require(_0x6ae1('0xd'));var authService=require(_0x6ae1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6ae1('0xf'));var hardwareService=require(_0x6ae1('0x10'));var logger=require(_0x6ae1('0x11'))(_0x6ae1('0x12'));var utils=require(_0x6ae1('0x13'));var config=require(_0x6ae1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ae1('0x15'))['db'];function respondWithStatusCode(_0x22f22f,_0x30a359){_0x30a359=_0x30a359||0xcc;return function(_0x5a3d34){if(_0x5a3d34){return _0x22f22f[_0x6ae1('0x16')](_0x30a359);}return _0x22f22f[_0x6ae1('0x17')](_0x30a359)[_0x6ae1('0x18')]();};}function respondWithResult(_0x19d822,_0x1ca46f){_0x1ca46f=_0x1ca46f||0xc8;return function(_0x3b02d4){if(_0x3b02d4){return _0x19d822['status'](_0x1ca46f)[_0x6ae1('0x19')](_0x3b02d4);}};}function respondWithFilteredResult(_0x3f9054,_0x38efb7){return function(_0x23d9a5){if(_0x23d9a5){var _0x45b97b=typeof _0x38efb7[_0x6ae1('0x1a')]===_0x6ae1('0x1b')&&typeof _0x38efb7[_0x6ae1('0x1c')]===_0x6ae1('0x1b');var _0x23ee00=_0x23d9a5['count'];var _0xc3217f=_0x45b97b?0x0:_0x38efb7[_0x6ae1('0x1a')];var _0x590b32=_0x45b97b?_0x23d9a5[_0x6ae1('0x1d')]:_0x38efb7[_0x6ae1('0x1a')]+_0x38efb7[_0x6ae1('0x1c')];var _0x520b5d;if(_0x590b32>=_0x23ee00){_0x590b32=_0x23ee00;_0x520b5d=0xc8;}else{_0x520b5d=0xce;}_0x3f9054[_0x6ae1('0x17')](_0x520b5d);return _0x3f9054[_0x6ae1('0x1e')](_0x6ae1('0x1f'),_0xc3217f+'-'+_0x590b32+'/'+_0x23ee00)[_0x6ae1('0x19')](_0x23d9a5);}return null;};}function patchUpdates(_0x3e69b3){return function(_0x444fea){try{jsonpatch[_0x6ae1('0x20')](_0x444fea,_0x3e69b3,!![]);}catch(_0x5775fc){return BPromise[_0x6ae1('0x21')](_0x5775fc);}return _0x444fea[_0x6ae1('0x22')]();};}function saveUpdates(_0x458146,_0x3061af){return function(_0x4f1694){if(_0x4f1694){return _0x4f1694[_0x6ae1('0x23')](_0x458146)[_0x6ae1('0x24')](function(_0x55de53){return _0x55de53;});}return null;};}function removeEntity(_0x595c92,_0xb14d54){return function(_0x99e679){if(_0x99e679){return _0x99e679[_0x6ae1('0x25')]()[_0x6ae1('0x24')](function(){_0x595c92[_0x6ae1('0x17')](0xcc)[_0x6ae1('0x18')]();});}};}function handleEntityNotFound(_0x3fd4ba,_0x5f4ba1){return function(_0x3f80ce){if(!_0x3f80ce){_0x3fd4ba[_0x6ae1('0x16')](0x194);}return _0x3f80ce;};}function handleError(_0x37d4e2,_0x18e890){_0x18e890=_0x18e890||0x1f4;return function(_0x2031c4){logger[_0x6ae1('0x26')](_0x2031c4[_0x6ae1('0x27')]);if(_0x2031c4['name']){delete _0x2031c4['name'];}_0x37d4e2[_0x6ae1('0x17')](_0x18e890)[_0x6ae1('0x28')](_0x2031c4);};}exports[_0x6ae1('0x29')]=function(_0x35eca5,_0x586ae7){var _0x4db0c2={},_0x23211b={},_0x115568={'count':0x0,'rows':[]};var _0x2de9f1=_['map'](db[_0x6ae1('0x2a')][_0x6ae1('0x2b')],function(_0x47e032){return{'name':_0x47e032[_0x6ae1('0x2c')],'type':_0x47e032[_0x6ae1('0x2d')][_0x6ae1('0x2e')]};});_0x23211b[_0x6ae1('0x2f')]=_[_0x6ae1('0x30')](_0x2de9f1,_0x6ae1('0x31'));_0x23211b['query']=_[_0x6ae1('0x32')](_0x35eca5['query']);_0x23211b[_0x6ae1('0x33')]=_[_0x6ae1('0x34')](_0x23211b['model'],_0x23211b['query']);_0x4db0c2['attributes']=_['intersection'](_0x23211b[_0x6ae1('0x2f')],qs[_0x6ae1('0x35')](_0x35eca5[_0x6ae1('0x36')]['fields']));_0x4db0c2['attributes']=_0x4db0c2['attributes']['length']?_0x4db0c2[_0x6ae1('0x37')]:_0x23211b[_0x6ae1('0x2f')];if(!_0x35eca5['query']['hasOwnProperty'](_0x6ae1('0x38'))){_0x4db0c2[_0x6ae1('0x1c')]=qs['limit'](_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x1c')]);_0x4db0c2[_0x6ae1('0x1a')]=qs['offset'](_0x35eca5['query']['offset']);}_0x4db0c2[_0x6ae1('0x39')]=qs[_0x6ae1('0x3a')](_0x35eca5['query'][_0x6ae1('0x3a')]);_0x4db0c2[_0x6ae1('0x3b')]=qs[_0x6ae1('0x33')](_[_0x6ae1('0x3c')](_0x35eca5['query'],_0x23211b[_0x6ae1('0x33')]),_0x2de9f1);if(_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x3d')]){_0x4db0c2['where']=_['merge'](_0x4db0c2['where'],{'$or':_[_0x6ae1('0x30')](_0x2de9f1,function(_0x203fe1){if(_0x203fe1[_0x6ae1('0x2d')]!==_0x6ae1('0x3e')){var _0x514fef={};_0x514fef[_0x203fe1[_0x6ae1('0x31')]]={'$like':'%'+_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x3d')]+'%'};return _0x514fef;}})});}_0x4db0c2=_[_0x6ae1('0x3f')]({},_0x4db0c2,_0x35eca5[_0x6ae1('0x40')]);var _0x2698c0={'where':_0x4db0c2[_0x6ae1('0x3b')]};return db[_0x6ae1('0x2a')]['count'](_0x2698c0)[_0x6ae1('0x24')](function(_0x510153){_0x115568[_0x6ae1('0x1d')]=_0x510153;if(_0x35eca5[_0x6ae1('0x36')][_0x6ae1('0x41')]){_0x4db0c2['include']=[{'all':!![]}];}return db[_0x6ae1('0x2a')][_0x6ae1('0x42')](_0x4db0c2);})[_0x6ae1('0x24')](function(_0x225713){_0x115568[_0x6ae1('0x43')]=_0x225713;return _0x115568;})[_0x6ae1('0x24')](respondWithFilteredResult(_0x586ae7,_0x4db0c2))[_0x6ae1('0x44')](handleError(_0x586ae7,null));};exports['show']=function(_0x1f93c0,_0x4ac214){var _0x3e7cc7={'raw':!![],'where':{'id':_0x1f93c0[_0x6ae1('0x45')]['id']}},_0x32aec3={};_0x32aec3[_0x6ae1('0x2f')]=_['keys'](db[_0x6ae1('0x2a')][_0x6ae1('0x2b')]);_0x32aec3[_0x6ae1('0x36')]=_[_0x6ae1('0x32')](_0x1f93c0[_0x6ae1('0x36')]);_0x32aec3['filters']=_[_0x6ae1('0x34')](_0x32aec3['model'],_0x32aec3[_0x6ae1('0x36')]);_0x3e7cc7[_0x6ae1('0x37')]=_[_0x6ae1('0x34')](_0x32aec3[_0x6ae1('0x2f')],qs[_0x6ae1('0x35')](_0x1f93c0[_0x6ae1('0x36')][_0x6ae1('0x35')]));_0x3e7cc7[_0x6ae1('0x37')]=_0x3e7cc7[_0x6ae1('0x37')]['length']?_0x3e7cc7[_0x6ae1('0x37')]:_0x32aec3[_0x6ae1('0x2f')];if(_0x1f93c0['query']['includeAll']){_0x3e7cc7['include']=[{'all':!![]}];}_0x3e7cc7=_['merge']({},_0x3e7cc7,_0x1f93c0[_0x6ae1('0x40')]);return db[_0x6ae1('0x2a')][_0x6ae1('0x46')](_0x3e7cc7)['then'](handleEntityNotFound(_0x4ac214,null))[_0x6ae1('0x24')](respondWithResult(_0x4ac214,null))[_0x6ae1('0x44')](handleError(_0x4ac214,null));};exports[_0x6ae1('0x47')]=function(_0x5cd9ba,_0x43a6be){return db['VoiceDialReport'][_0x6ae1('0x47')](_0x5cd9ba[_0x6ae1('0x48')],{})[_0x6ae1('0x24')](respondWithResult(_0x43a6be,0xc9))[_0x6ae1('0x44')](handleError(_0x43a6be,null));};exports[_0x6ae1('0x23')]=function(_0x2ce8e7,_0x2fdd30){if(_0x2ce8e7[_0x6ae1('0x48')]['id']){delete _0x2ce8e7[_0x6ae1('0x48')]['id'];}return db[_0x6ae1('0x2a')][_0x6ae1('0x46')]({'where':{'id':_0x2ce8e7['params']['id']}})[_0x6ae1('0x24')](handleEntityNotFound(_0x2fdd30,null))[_0x6ae1('0x24')](saveUpdates(_0x2ce8e7[_0x6ae1('0x48')],null))[_0x6ae1('0x24')](respondWithResult(_0x2fdd30,null))['catch'](handleError(_0x2fdd30,null));};exports[_0x6ae1('0x25')]=function(_0x3fad4e,_0x595291){return db[_0x6ae1('0x2a')][_0x6ae1('0x46')]({'where':{'id':_0x3fad4e[_0x6ae1('0x45')]['id']}})[_0x6ae1('0x24')](handleEntityNotFound(_0x595291,null))[_0x6ae1('0x24')](removeEntity(_0x595291,null))['catch'](handleError(_0x595291,null));};exports[_0x6ae1('0x49')]=function(_0x51cfad,_0x4f0c21){return db[_0x6ae1('0x2a')]['describe']()[_0x6ae1('0x24')](respondWithResult(_0x4f0c21,null))['catch'](handleError(_0x4f0c21,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 78ca619..2c7a3b3 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 _0xf2d7=['report_dial','lodash','../../config/logger','api','moment','bluebird','../../config/environment','exports','define'];(function(_0x42bc5b,_0x57a583){var _0x358c0e=function(_0x4fadf7){while(--_0x4fadf7){_0x42bc5b['push'](_0x42bc5b['shift']());}};_0x358c0e(++_0x57a583);}(_0xf2d7,0x121));var _0x7f2d=function(_0x2d5246,_0x521bf7){_0x2d5246=_0x2d5246-0x0;var _0x1fcbfb=_0xf2d7[_0x2d5246];return _0x1fcbfb;};'use strict';var _=require(_0x7f2d('0x0'));var util=require('util');var logger=require(_0x7f2d('0x1'))(_0x7f2d('0x2'));var moment=require(_0x7f2d('0x3'));var BPromise=require(_0x7f2d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f2d('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x7f2d('0x6')]=function(_0x5bfa7e,_0x5ef14d){return _0x5bfa7e[_0x7f2d('0x7')]('VoiceDialReport',attributes,{'tableName':_0x7f2d('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf541=['../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xf541,0x1f4));var _0x1f54=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xf541[_0x44268d];return _0x4be92d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f54('0x0'))('api');var moment=require(_0x1f54('0x1'));var BPromise=require(_0x1f54('0x2'));var rp=require(_0x1f54('0x3'));var fs=require('fs');var path=require(_0x1f54('0x4'));var rimraf=require(_0x1f54('0x5'));var config=require(_0x1f54('0x6'));var attributes=require(_0x1f54('0x7'));module[_0x1f54('0x8')]=function(_0x538b5f,_0x3d1766){return _0x538b5f[_0x1f54('0x9')](_0x1f54('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 29a116c..7f3d362 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 _0xed43=['stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','options','then','catch','UpdateVoiceDialReport','update','body','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed43,0x9d));var _0x3ed4=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xed43[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x3ed4('0x0'));var util=require(_0x3ed4('0x1'));var moment=require('moment');var BPromise=require(_0x3ed4('0x2'));var rs=require(_0x3ed4('0x3'));var fs=require('fs');var Redis=require(_0x3ed4('0x4'));var db=require(_0x3ed4('0x5'))['db'];var utils=require(_0x3ed4('0x6'));var logger=require(_0x3ed4('0x7'))(_0x3ed4('0x8'));var config=require('../../config/environment');var jayson=require(_0x3ed4('0x9'));var client=jayson[_0x3ed4('0xa')][_0x3ed4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x344336,_0xdf4eec,_0x49e25b){return new BPromise(function(_0x4b3f8b,_0x3320d2){return client[_0x3ed4('0xc')](_0x344336,_0x49e25b)['then'](function(_0x462ce2){logger[_0x3ed4('0xd')](_0x3ed4('0xe'),_0xdf4eec,'request\x20sent');logger[_0x3ed4('0xf')](_0x3ed4('0x10'),_0xdf4eec,_0x3ed4('0x11'),JSON[_0x3ed4('0x12')](_0x462ce2));if(_0x462ce2['error']){if(_0x462ce2[_0x3ed4('0x13')][_0x3ed4('0x14')]===0x1f4){logger[_0x3ed4('0x13')](_0x3ed4('0xe'),_0xdf4eec,_0x462ce2[_0x3ed4('0x13')][_0x3ed4('0x15')]);return _0x3320d2(_0x462ce2[_0x3ed4('0x13')][_0x3ed4('0x15')]);}logger[_0x3ed4('0x13')](_0x3ed4('0xe'),_0xdf4eec,_0x462ce2[_0x3ed4('0x13')][_0x3ed4('0x15')]);return _0x4b3f8b(_0x462ce2[_0x3ed4('0x13')][_0x3ed4('0x15')]);}else{logger[_0x3ed4('0xd')](_0x3ed4('0xe'),_0xdf4eec,_0x3ed4('0x11'));_0x4b3f8b(_0x462ce2[_0x3ed4('0x16')][_0x3ed4('0x15')]);}})['catch'](function(_0x5e8a97){logger[_0x3ed4('0x13')](_0x3ed4('0xe'),_0xdf4eec,_0x5e8a97);_0x3320d2(_0x5e8a97);});});}exports[_0x3ed4('0x17')]=function(_0x346e6e){var _0x35c1e1=this;return new Promise(function(_0x551541,_0x58efaa){return db[_0x3ed4('0x18')]['create'](_0x346e6e['body'],{'raw':_0x346e6e[_0x3ed4('0x19')]?_0x346e6e[_0x3ed4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3ed4('0x1a')](function(_0x16cfc3){logger[_0x3ed4('0xd')](_0x3ed4('0x17'),_0x346e6e);logger[_0x3ed4('0xf')](_0x3ed4('0x17'),_0x346e6e,JSON['stringify'](_0x16cfc3));_0x551541(_0x16cfc3);})[_0x3ed4('0x1b')](function(_0x55396c){logger[_0x3ed4('0x13')](_0x3ed4('0x17'),_0x55396c['message'],_0x346e6e);_0x58efaa(_0x35c1e1[_0x3ed4('0x13')](0x1f4,_0x55396c[_0x3ed4('0x15')]));});});};exports[_0x3ed4('0x1c')]=function(_0x43c821){var _0x244a41=this;return new Promise(function(_0x5b169b,_0x325cac){return db[_0x3ed4('0x18')][_0x3ed4('0x1d')](_0x43c821[_0x3ed4('0x1e')],{'raw':_0x43c821[_0x3ed4('0x19')]?_0x43c821['options'][_0x3ed4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c821[_0x3ed4('0x19')]?_0x43c821[_0x3ed4('0x19')][_0x3ed4('0x20')]||null:null,'attributes':_0x43c821[_0x3ed4('0x19')]?_0x43c821[_0x3ed4('0x19')][_0x3ed4('0x21')]||null:null,'limit':_0x43c821[_0x3ed4('0x19')]?_0x43c821[_0x3ed4('0x19')][_0x3ed4('0x22')]||null:null})[_0x3ed4('0x1a')](function(_0x13ee1c){logger[_0x3ed4('0xd')](_0x3ed4('0x1c'),_0x43c821);logger[_0x3ed4('0xf')](_0x3ed4('0x1c'),_0x43c821,JSON[_0x3ed4('0x12')](_0x13ee1c));_0x5b169b(_0x13ee1c);})[_0x3ed4('0x1b')](function(_0x316e27){logger[_0x3ed4('0x13')](_0x3ed4('0x1c'),_0x316e27[_0x3ed4('0x15')],_0x43c821);_0x325cac(_0x244a41[_0x3ed4('0x13')](0x1f4,_0x316e27[_0x3ed4('0x15')]));});});}; \ No newline at end of file +var _0x0992=['CreateVoiceDialReport','VoiceDialReport','create','options','then','stringify','UpdateVoiceDialReport','update','body','raw','where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x0992,0x1ba));var _0x2099=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x0992[_0x47adb8];return _0x4689a8;};'use strict';var _=require('lodash');var util=require(_0x2099('0x0'));var moment=require(_0x2099('0x1'));var BPromise=require('bluebird');var rs=require(_0x2099('0x2'));var fs=require('fs');var Redis=require(_0x2099('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2099('0x4'));var logger=require(_0x2099('0x5'))(_0x2099('0x6'));var config=require(_0x2099('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2099('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16945,_0x57c09d,_0x1c3d79){return new BPromise(function(_0x583797,_0x11ffc2){return client[_0x2099('0x9')](_0x16945,_0x1c3d79)['then'](function(_0x2d5975){logger[_0x2099('0xa')](_0x2099('0xb'),_0x57c09d,'request\x20sent');logger[_0x2099('0xc')](_0x2099('0xd'),_0x57c09d,_0x2099('0xe'),JSON['stringify'](_0x2d5975));if(_0x2d5975[_0x2099('0xf')]){if(_0x2d5975['error'][_0x2099('0x10')]===0x1f4){logger[_0x2099('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x57c09d,_0x2d5975[_0x2099('0xf')][_0x2099('0x11')]);return _0x11ffc2(_0x2d5975['error'][_0x2099('0x11')]);}logger[_0x2099('0xf')](_0x2099('0xb'),_0x57c09d,_0x2d5975['error']['message']);return _0x583797(_0x2d5975['error'][_0x2099('0x11')]);}else{logger['info'](_0x2099('0xb'),_0x57c09d,_0x2099('0xe'));_0x583797(_0x2d5975[_0x2099('0x12')][_0x2099('0x11')]);}})[_0x2099('0x13')](function(_0x2d2c91){logger[_0x2099('0xf')](_0x2099('0xb'),_0x57c09d,_0x2d2c91);_0x11ffc2(_0x2d2c91);});});}exports[_0x2099('0x14')]=function(_0x41a1d0){var _0xcabf26=this;return new Promise(function(_0xb01af9,_0x4fbf30){return db[_0x2099('0x15')][_0x2099('0x16')](_0x41a1d0['body'],{'raw':_0x41a1d0[_0x2099('0x17')]?_0x41a1d0[_0x2099('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2099('0x18')](function(_0x13ec63){logger[_0x2099('0xa')](_0x2099('0x14'),_0x41a1d0);logger[_0x2099('0xc')](_0x2099('0x14'),_0x41a1d0,JSON[_0x2099('0x19')](_0x13ec63));_0xb01af9(_0x13ec63);})[_0x2099('0x13')](function(_0x3667d3){logger['error'](_0x2099('0x14'),_0x3667d3[_0x2099('0x11')],_0x41a1d0);_0x4fbf30(_0xcabf26[_0x2099('0xf')](0x1f4,_0x3667d3[_0x2099('0x11')]));});});};exports[_0x2099('0x1a')]=function(_0x560394){var _0x3e8b56=this;return new Promise(function(_0x1d1541,_0x347618){return db[_0x2099('0x15')][_0x2099('0x1b')](_0x560394[_0x2099('0x1c')],{'raw':_0x560394[_0x2099('0x17')]?_0x560394['options'][_0x2099('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x560394[_0x2099('0x17')]?_0x560394[_0x2099('0x17')][_0x2099('0x1e')]||null:null,'attributes':_0x560394[_0x2099('0x17')]?_0x560394[_0x2099('0x17')][_0x2099('0x1f')]||null:null,'limit':_0x560394[_0x2099('0x17')]?_0x560394[_0x2099('0x17')][_0x2099('0x20')]||null:null})[_0x2099('0x18')](function(_0x50115f){logger[_0x2099('0xa')](_0x2099('0x1a'),_0x560394);logger[_0x2099('0xc')](_0x2099('0x1a'),_0x560394,JSON[_0x2099('0x19')](_0x50115f));_0x1d1541(_0x50115f);})[_0x2099('0x13')](function(_0x49be14){logger[_0x2099('0xf')](_0x2099('0x1a'),_0x49be14[_0x2099('0x11')],_0x560394);_0x347618(_0x3e8b56[_0x2099('0xf')](0x1f4,_0x49be14[_0x2099('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 97cabe7..deacf74 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 _0xa635=['isAuthenticated','index','get','show','post','create','/:id/applications','put','/:id','update','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller'];(function(_0x55b3a8,_0x5bb634){var _0x821732=function(_0x209e29){while(--_0x209e29){_0x55b3a8['push'](_0x55b3a8['shift']());}};_0x821732(++_0x5bb634);}(_0xa635,0x1e7));var _0x5a63=function(_0x48dc2c,_0x35179c){_0x48dc2c=_0x48dc2c-0x0;var _0x415cd4=_0xa635[_0x48dc2c];return _0x415cd4;};'use strict';var multer=require('multer');var util=require(_0x5a63('0x0'));var path=require('path');var timeout=require(_0x5a63('0x1'));var express=require('express');var router=express[_0x5a63('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5a63('0x3'));var interaction=require(_0x5a63('0x4'));var config=require('../../config/environment');var controller=require(_0x5a63('0x5'));router['get']('/',auth[_0x5a63('0x6')](),controller[_0x5a63('0x7')]);router[_0x5a63('0x8')]('/:id',auth[_0x5a63('0x6')](),controller[_0x5a63('0x9')]);router[_0x5a63('0xa')]('/',auth[_0x5a63('0x6')](),controller[_0x5a63('0xb')]);router[_0x5a63('0xa')](_0x5a63('0xc'),auth['isAuthenticated'](),controller['addApplications']);router[_0x5a63('0xd')](_0x5a63('0xe'),auth[_0x5a63('0x6')](),controller[_0x5a63('0xf')]);router['delete'](_0x5a63('0xe'),auth[_0x5a63('0x6')](),controller[_0x5a63('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb292=['/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x2382a0,_0x29c440){var _0x1308dc=function(_0x41b07b){while(--_0x41b07b){_0x2382a0['push'](_0x2382a0['shift']());}};_0x1308dc(++_0x29c440);}(_0xb292,0x149));var _0x2b29=function(_0x327b51,_0x4a20bd){_0x327b51=_0x327b51-0x0;var _0x1b6be1=_0xb292[_0x327b51];return _0x1b6be1;};'use strict';var multer=require(_0x2b29('0x0'));var util=require(_0x2b29('0x1'));var path=require(_0x2b29('0x2'));var timeout=require(_0x2b29('0x3'));var express=require(_0x2b29('0x4'));var router=express[_0x2b29('0x5')]();var fs_extra=require(_0x2b29('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2b29('0x7'));var config=require(_0x2b29('0x8'));var controller=require(_0x2b29('0x9'));router[_0x2b29('0xa')]('/',auth[_0x2b29('0xb')](),controller[_0x2b29('0xc')]);router[_0x2b29('0xa')](_0x2b29('0xd'),auth[_0x2b29('0xb')](),controller[_0x2b29('0xe')]);router[_0x2b29('0xf')]('/',auth[_0x2b29('0xb')](),controller[_0x2b29('0x10')]);router['post']('/:id/applications',auth[_0x2b29('0xb')](),controller['addApplications']);router['put'](_0x2b29('0xd'),auth[_0x2b29('0xb')](),controller[_0x2b29('0x11')]);router[_0x2b29('0x12')](_0x2b29('0xd'),auth[_0x2b29('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7e8c126..cde6225 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 _0x909f=['any','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system'];(function(_0x5b46da,_0x1e4bec){var _0x468fd5=function(_0x6f37f2){while(--_0x6f37f2){_0x5b46da['push'](_0x5b46da['shift']());}};_0x468fd5(++_0x1e4bec);}(_0x909f,0x185));var _0xf909=function(_0x28b469,_0x209679){_0x28b469=_0x28b469-0x0;var _0x1d4a1f=_0x909f[_0x28b469];return _0x1d4a1f;};'use strict';var Sequelize=require(_0xf909('0x0'));module[_0xf909('0x1')]={'context':{'type':Sequelize[_0xf909('0x2')],'allowNull':![],'unique':_0xf909('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf909('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xf909('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xf909('0x3')},'tag':{'type':Sequelize[_0xf909('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf909('0x2')],'allowNull':![],'defaultValue':_0xf909('0x4')},'appdata':{'type':Sequelize[_0xf909('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf909('0x5')](_0xf909('0x6'),_0xf909('0x7'),'internal',_0xf909('0x8'),_0xf909('0x9'),_0xf909('0xa'),_0xf909('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf909('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xf909('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf909('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf909('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xf909('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xf909('0xd')},'answer':{'type':Sequelize[_0xf909('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x49aa10){return this[_0xf909('0xe')](_0xf909('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xdaa3=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','internal','inbound-fax','system','any','INTEGER','wav'];(function(_0x331fde,_0x6c962){var _0x3b6855=function(_0x207bdd){while(--_0x207bdd){_0x331fde['push'](_0x331fde['shift']());}};_0x3b6855(++_0x6c962);}(_0xdaa3,0xe4));var _0x3daa=function(_0x1e076c,_0x36176a){_0x1e076c=_0x1e076c-0x0;var _0x1b583a=_0xdaa3[_0x1e076c];return _0x1b583a;};'use strict';var Sequelize=require(_0x3daa('0x0'));module[_0x3daa('0x1')]={'context':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'unique':_0x3daa('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3daa('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3daa('0x4')](_0x3daa('0x5'),'outbound',_0x3daa('0x6'),_0x3daa('0x7'),'outbound-fax',_0x3daa('0x8'),_0x3daa('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x3daa('0x2')]},'interval':{'type':Sequelize[_0x3daa('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3daa('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3daa('0xa')]},'recordingFormat':{'type':Sequelize[_0x3daa('0x2')],'defaultValue':_0x3daa('0xb')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x3daa('0xc')],'get':function(_0x4dcff5){return this[_0x3daa('0xd')](_0x3daa('0xe'));}},'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 2dc985a..eb7b4ce 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 _0x533c=['find','name','destroy','error','send','VoiceExtension','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','findAll','rows','catch','include','merge','params','create','startsWith','exten','body','concat','user','get','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','type'];(function(_0x46a8be,_0x1e44c7){var _0x5175b9=function(_0x5607c8){while(--_0x5607c8){_0x46a8be['push'](_0x46a8be['shift']());}};_0x5175b9(++_0x1e44c7);}(_0x533c,0x1e7));var _0xc533=function(_0x495f26,_0x10c68c){_0x495f26=_0x495f26-0x0;var _0x311b28=_0x533c[_0x495f26];return _0x311b28;};'use strict';var _=require(_0xc533('0x0'));var Redis=require(_0xc533('0x1'));var qs=require(_0xc533('0x2'));var logger=require('../../config/logger')(_0xc533('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc533('0x4')]=_['defaults'](config[_0xc533('0x4')],{'host':_0xc533('0x5'),'port':0x18eb});var socket=require(_0xc533('0x6'))(new Redis(config[_0xc533('0x4')]));require(_0xc533('0x7'))['register'](socket);function respondWithStatusCode(_0x57b544,_0x9a48fc){_0x9a48fc=_0x9a48fc||0xcc;return function(_0x53f5a2){if(_0x53f5a2){return _0x57b544[_0xc533('0x8')](_0x9a48fc);}return _0x57b544[_0xc533('0x9')](_0x9a48fc)[_0xc533('0xa')]();};}function respondWithResult(_0x2b8692,_0x5b61ad){_0x5b61ad=_0x5b61ad||0xc8;return function(_0xb6c4ec){if(_0xb6c4ec){return _0x2b8692['status'](_0x5b61ad)[_0xc533('0xb')](_0xb6c4ec);}};}function respondWithFilteredResult(_0xe85019,_0x23df05){return function(_0xf33b53){if(_0xf33b53){var _0xdc5a2e=typeof _0x23df05[_0xc533('0xc')]===_0xc533('0xd')&&typeof _0x23df05[_0xc533('0xe')]===_0xc533('0xd');var _0x40fc4e=_0xf33b53['count'];var _0x31b5d0=_0xdc5a2e?0x0:_0x23df05[_0xc533('0xc')];var _0x4541d3=_0xdc5a2e?_0xf33b53[_0xc533('0xf')]:_0x23df05[_0xc533('0xc')]+_0x23df05[_0xc533('0xe')];var _0x17d8da;if(_0x4541d3>=_0x40fc4e){_0x4541d3=_0x40fc4e;_0x17d8da=0xc8;}else{_0x17d8da=0xce;}_0xe85019[_0xc533('0x9')](_0x17d8da);return _0xe85019[_0xc533('0x10')](_0xc533('0x11'),_0x31b5d0+'-'+_0x4541d3+'/'+_0x40fc4e)[_0xc533('0xb')](_0xf33b53);}return null;};}function removeEntity(_0x3a29a5){return function(_0x51bb9b){if(_0x51bb9b){return _0x51bb9b['destroy']()[_0xc533('0x12')](function(){var _0x442acc=_0x51bb9b['get']({'plain':!![]});var _0x3b32e2=[{'name':_0xc533('0x13'),'value':_0xc533('0x14'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc533('0x15'),'ignore':![]},{'name':_0xc533('0x16'),'value':_0xc533('0x17'),'ignore':![]}];var _0x1b381f=_(_0x3b32e2)[_0xc533('0x18')](_0xc533('0x19'))[_0xc533('0x1a')](_0xc533('0x1b'))[_0xc533('0x1b')]();if(_['includes'](_0x1b381f,_0x442acc[_0xc533('0x1c')])){return;}var _0x400ec9=_[_0xc533('0x1d')](_0x3b32e2,[_0xc533('0x1b'),_0x442acc[_0xc533('0x1c')]])[_0xc533('0x1e')];return db['UserProfileResource'][_0xc533('0x1f')]({'where':{'type':_0x400ec9,'resourceId':_0x442acc['id']}})[_0xc533('0x12')](function(){return _0x51bb9b;});})[_0xc533('0x12')](function(){_0x3a29a5['status'](0xcc)[_0xc533('0xa')]();});}};}function handleEntityNotFound(_0x3f690f){return function(_0x3e9031){if(!_0x3e9031){_0x3f690f[_0xc533('0x8')](0x194);}return _0x3e9031;};}function handleError(_0xe0069a,_0x297284){_0x297284=_0x297284||0x1f4;return function(_0x59f781){logger[_0xc533('0x20')](_0x59f781['stack']);if(_0x59f781[_0xc533('0x1e')]){delete _0x59f781[_0xc533('0x1e')];}_0xe0069a['status'](_0x297284)[_0xc533('0x21')](_0x59f781);};}exports['index']=function(_0xbb5ef,_0x9c41e5){var _0x2d6ddb={},_0x55ce54={},_0x1984bf={'count':0x0,'rows':[]};var _0x16091d=_[_0xc533('0x1a')](db[_0xc533('0x22')]['rawAttributes'],function(_0x1648e8){return{'name':_0x1648e8[_0xc533('0x23')],'type':_0x1648e8['type'][_0xc533('0x24')]};});_0x55ce54['model']=_[_0xc533('0x1a')](_0x16091d,_0xc533('0x1e'));_0x55ce54[_0xc533('0x25')]=_[_0xc533('0x26')](_0xbb5ef[_0xc533('0x25')]);_0x55ce54[_0xc533('0x27')]=_[_0xc533('0x28')](_0x55ce54[_0xc533('0x29')],_0x55ce54[_0xc533('0x25')]);_0x2d6ddb[_0xc533('0x2a')]=_[_0xc533('0x28')](_0x55ce54[_0xc533('0x29')],qs[_0xc533('0x2b')](_0xbb5ef[_0xc533('0x25')][_0xc533('0x2b')]));_0x2d6ddb['attributes']=_0x2d6ddb['attributes'][_0xc533('0x2c')]?_0x2d6ddb[_0xc533('0x2a')]:_0x55ce54[_0xc533('0x29')];if(!_0xbb5ef[_0xc533('0x25')]['hasOwnProperty'](_0xc533('0x2d'))){_0x2d6ddb[_0xc533('0xe')]=qs['limit'](_0xbb5ef[_0xc533('0x25')]['limit']);_0x2d6ddb[_0xc533('0xc')]=qs[_0xc533('0xc')](_0xbb5ef[_0xc533('0x25')][_0xc533('0xc')]);}_0x2d6ddb[_0xc533('0x2e')]=qs[_0xc533('0x2f')](_0xbb5ef[_0xc533('0x25')][_0xc533('0x2f')]);_0x2d6ddb[_0xc533('0x30')]=qs['filters'](_[_0xc533('0x31')](_0xbb5ef['query'],_0x55ce54[_0xc533('0x27')]),_0x16091d);if(_0xbb5ef['query']['filter']){_0x2d6ddb[_0xc533('0x30')]=_['merge'](_0x2d6ddb[_0xc533('0x30')],{'$or':_[_0xc533('0x1a')](_0x16091d,function(_0x4bf709){if(_0x4bf709[_0xc533('0x1c')]!==_0xc533('0x32')){var _0x331c54={};_0x331c54[_0x4bf709[_0xc533('0x1e')]]={'$like':'%'+_0xbb5ef[_0xc533('0x25')]['filter']+'%'};return _0x331c54;}})});}_0x2d6ddb=_['merge']({},_0x2d6ddb,_0xbb5ef[_0xc533('0x33')]);var _0x2882e1={'where':_0x2d6ddb[_0xc533('0x30')]};return db[_0xc533('0x22')][_0xc533('0xf')](_0x2882e1)[_0xc533('0x12')](function(_0x1862ca){_0x1984bf['count']=_0x1862ca;if(_0xbb5ef['query'][_0xc533('0x34')]){_0x2d6ddb['include']=[{'all':!![]}];}return db[_0xc533('0x22')][_0xc533('0x35')](_0x2d6ddb);})['then'](function(_0x24408d){_0x1984bf[_0xc533('0x36')]=_0x24408d;return _0x1984bf;})[_0xc533('0x12')](respondWithFilteredResult(_0x9c41e5,_0x2d6ddb))[_0xc533('0x37')](handleError(_0x9c41e5,null));};exports['show']=function(_0x3b011e,_0xfdbe5f){var _0x2d78e5={'raw':![],'where':{'id':_0x3b011e['params']['id']}},_0x326587={};_0x326587['model']=_[_0xc533('0x26')](db[_0xc533('0x22')]['rawAttributes']);_0x326587['query']=_[_0xc533('0x26')](_0x3b011e[_0xc533('0x25')]);_0x326587[_0xc533('0x27')]=_[_0xc533('0x28')](_0x326587[_0xc533('0x29')],_0x326587[_0xc533('0x25')]);_0x2d78e5[_0xc533('0x2a')]=_[_0xc533('0x28')](_0x326587[_0xc533('0x29')],qs[_0xc533('0x2b')](_0x3b011e['query'][_0xc533('0x2b')]));_0x2d78e5[_0xc533('0x2a')]=_0x2d78e5[_0xc533('0x2a')][_0xc533('0x2c')]?_0x2d78e5['attributes']:_0x326587[_0xc533('0x29')];if(_0x3b011e['query'][_0xc533('0x34')]){_0x2d78e5[_0xc533('0x38')]=[{'all':!![]}];}_0x2d78e5=_[_0xc533('0x39')]({},_0x2d78e5,_0x3b011e[_0xc533('0x33')]);return db[_0xc533('0x22')][_0xc533('0x1d')](_0x2d78e5)[_0xc533('0x12')](handleEntityNotFound(_0xfdbe5f,null))[_0xc533('0x12')](respondWithResult(_0xfdbe5f,null))['catch'](handleError(_0xfdbe5f,null));};exports['destroy']=function(_0x3db47f,_0x19f243){return db[_0xc533('0x22')][_0xc533('0x1d')]({'where':{'id':_0x3db47f[_0xc533('0x3a')]['id']}})[_0xc533('0x12')](handleEntityNotFound(_0x19f243,null))[_0xc533('0x12')](removeEntity(_0x19f243,null))['catch'](handleError(_0x19f243,null));};exports[_0xc533('0x3b')]=function(_0x540fbf,_0x1c7e2c){if(_0x540fbf['body'][_0xc533('0x1c')]===_0xc533('0x15')&&!_[_0xc533('0x3c')](_0x540fbf['body'][_0xc533('0x3d')],'_')){_0x540fbf[_0xc533('0x3e')][_0xc533('0x3d')]='_'[_0xc533('0x3f')](_0x540fbf[_0xc533('0x3e')][_0xc533('0x3d')]);}return db['VoiceExtension'][_0xc533('0x3b')](_0x540fbf['body'],{'raw':![]})[_0xc533('0x12')](function(_0x21f453){var _0xf55261=_0x540fbf[_0xc533('0x40')][_0xc533('0x41')]({'plain':!![]});if(!_0xf55261)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf55261[_0xc533('0x42')]===_0xc533('0x40')){var _0x10f83e=_0x21f453['get']({'plain':!![]});var _0x3fdcf8=[{'name':_0xc533('0x13'),'value':_0xc533('0x14')},{'name':'OutboundRoutes','value':_0xc533('0x15')},{'name':_0xc533('0x16'),'value':_0xc533('0x17')}];var _0x3c6a0a=_['find'](_0x3fdcf8,[_0xc533('0x1b'),_0x10f83e['type']])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x3c6a0a,'userProfileId':_0xf55261[_0xc533('0x43')]},'raw':!![]})['then'](function(_0x35af7c){if(_0x35af7c&&_0x35af7c['autoAssociation']===0x0){return db[_0xc533('0x44')][_0xc533('0x3b')]({'name':_0x10f83e[_0xc533('0x1e')],'resourceId':_0x10f83e['id'],'type':_0x35af7c[_0xc533('0x1e')],'sectionId':_0x35af7c['id']},{})[_0xc533('0x12')](function(){return _0x21f453;});}else{return _0x21f453;}})[_0xc533('0x37')](function(_0x2e95c1){logger['error'](_0xc533('0x45'),_0x2e95c1);throw _0x2e95c1;});}return _0x21f453;})[_0xc533('0x12')](respondWithResult(_0x1c7e2c,0xc9))['catch'](handleError(_0x1c7e2c,null));};exports[_0xc533('0x46')]=function(_0x205827,_0xd31d0e){if(_0x205827['body']['id']){delete _0x205827[_0xc533('0x3e')]['id'];}return db['VoiceExtension'][_0xc533('0x1d')]({'where':{'id':_0x205827[_0xc533('0x3a')]['id']}})[_0xc533('0x12')](handleEntityNotFound(_0xd31d0e,null))['then'](function(_0x581116){if(_0x581116){return db[_0xc533('0x22')][_0xc533('0x46')](_[_0xc533('0x31')](_0x205827['body'],[_0xc533('0x3d'),_0xc533('0x47'),_0xc533('0x48'),'recordingFormat',_0xc533('0x49'),'mandatoryDisposition','alias']),{'where':{'context':_0x581116['context'],'exten':_0x581116['exten']},'individualHooks':!![]})[_0xc533('0x12')](function(_0x409fc8){return _0x409fc8;});}return null;})[_0xc533('0x12')](respondWithStatusCode(_0xd31d0e,null))[_0xc533('0x37')](handleError(_0xd31d0e,null));};exports[_0xc533('0x4a')]=function(_0x20aebd,_0x4c367e){var _0xc4c668=_0x20aebd[_0xc533('0x3a')]['id'];var _0xc6d533=_0x20aebd[_0xc533('0x3e')];var _0x4bdab3=0xc8;var _0x5111f3=null;return db[_0xc533('0x4b')][_0xc533('0x4c')]({'isolationLevel':db[_0xc533('0x4b')][_0xc533('0x4d')][_0xc533('0x4e')]['READ_COMMITTED']},function(_0x4d6845){return db['VoiceExtension'][_0xc533('0x4f')]({'where':{'id':_0xc4c668},'transaction':_0x4d6845})[_0xc533('0x12')](function(_0x1deec1){if(_0x1deec1){return db[_0xc533('0x22')][_0xc533('0x1f')]({'where':{'VoiceExtensionId':_0xc4c668},'transaction':_0x4d6845})['then'](function(){var _0x6683a9=_[_0xc533('0x1a')](_0xc6d533,function(_0x1e1adb){_0x1e1adb[_0xc533('0x50')]=_0xc4c668;_0x1e1adb[_0xc533('0x51')]=!![];return _0x1e1adb;});return _0x1deec1['createRouting'](_0x6683a9);})['then'](function(_0x1401e5){return db[_0xc533('0x22')]['bulkCreate'](_0x1401e5,{'transaction':_0x4d6845});});}else{_0x4bdab3=0x194;_0x5111f3=[];}});})['then'](function(){if(_0x4bdab3!==0x194){return db[_0xc533('0x22')][_0xc533('0x52')]({'where':{'isApp':!![],'VoiceExtensionId':_0xc4c668},'order':_0xc533('0x53')})[_0xc533('0x12')](function(_0x3f6084){_0x5111f3=_0x3f6084;});}})['catch'](function(_0x13b56a){_0x4bdab3=0x1f4;logger[_0xc533('0x20')](_0x13b56a[_0xc533('0x54')]);if(_0x13b56a[_0xc533('0x1e')]){delete _0x13b56a[_0xc533('0x1e')];}_0x5111f3=_0x13b56a;})[_0xc533('0x55')](function(){if(_0x5111f3===null){_0x4c367e[_0xc533('0x8')](_0x4bdab3);}else{if(_0x4bdab3===0x1f4){_0x4c367e[_0xc533('0x9')](_0x4bdab3)[_0xc533('0x21')](_0x5111f3);}else{_0x4c367e[_0xc533('0x9')](_0x4bdab3)[_0xc533('0xb')](_0x5111f3);}}});}; \ No newline at end of file +var _0xb4b0=['addApplications','transaction','sequelize','Transaction','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','./voiceExtension.socket','register','status','end','undefined','limit','offset','count','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','includes','find','value','UserProfileResource','sendStatus','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','catch','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb4b0,0xbc));var _0x0b4b=function(_0x24b156,_0x6e3d6){_0x24b156=_0x24b156-0x0;var _0x1fa205=_0xb4b0[_0x24b156];return _0x1fa205;};'use strict';var _=require('lodash');var Redis=require(_0x0b4b('0x0'));var qs=require(_0x0b4b('0x1'));var logger=require('../../config/logger')(_0x0b4b('0x2'));var config=require(_0x0b4b('0x3'));var db=require('../../mysqldb')['db'];config[_0x0b4b('0x4')]=_[_0x0b4b('0x5')](config[_0x0b4b('0x4')],{'host':_0x0b4b('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0b4b('0x7'))[_0x0b4b('0x8')](socket);function respondWithStatusCode(_0x14144b,_0x536187){_0x536187=_0x536187||0xcc;return function(_0xb9acd5){if(_0xb9acd5){return _0x14144b['sendStatus'](_0x536187);}return _0x14144b[_0x0b4b('0x9')](_0x536187)[_0x0b4b('0xa')]();};}function respondWithResult(_0x21736b,_0x31f7cc){_0x31f7cc=_0x31f7cc||0xc8;return function(_0xb6c465){if(_0xb6c465){return _0x21736b['status'](_0x31f7cc)['json'](_0xb6c465);}};}function respondWithFilteredResult(_0x1c28fe,_0x569a91){return function(_0x5a88ff){if(_0x5a88ff){var _0x418309=typeof _0x569a91['offset']===_0x0b4b('0xb')&&typeof _0x569a91[_0x0b4b('0xc')]===_0x0b4b('0xb');var _0x4074b1=_0x5a88ff['count'];var _0x550125=_0x418309?0x0:_0x569a91[_0x0b4b('0xd')];var _0x145b79=_0x418309?_0x5a88ff[_0x0b4b('0xe')]:_0x569a91[_0x0b4b('0xd')]+_0x569a91[_0x0b4b('0xc')];var _0x13ce3e;if(_0x145b79>=_0x4074b1){_0x145b79=_0x4074b1;_0x13ce3e=0xc8;}else{_0x13ce3e=0xce;}_0x1c28fe[_0x0b4b('0x9')](_0x13ce3e);return _0x1c28fe['set']('Content-Range',_0x550125+'-'+_0x145b79+'/'+_0x4074b1)[_0x0b4b('0xf')](_0x5a88ff);}return null;};}function removeEntity(_0x56bdb9){return function(_0x28fda7){if(_0x28fda7){return _0x28fda7[_0x0b4b('0x10')]()[_0x0b4b('0x11')](function(){var _0x132871=_0x28fda7[_0x0b4b('0x12')]({'plain':!![]});var _0x2ad73c=[{'name':_0x0b4b('0x13'),'value':_0x0b4b('0x14'),'ignore':![]},{'name':_0x0b4b('0x15'),'value':_0x0b4b('0x16'),'ignore':![]},{'name':_0x0b4b('0x17'),'value':_0x0b4b('0x18'),'ignore':![]}];var _0x5164fc=_(_0x2ad73c)['filter'](_0x0b4b('0x19'))[_0x0b4b('0x1a')]('value')['value']();if(_[_0x0b4b('0x1b')](_0x5164fc,_0x132871['type'])){return;}var _0x16c0ee=_[_0x0b4b('0x1c')](_0x2ad73c,[_0x0b4b('0x1d'),_0x132871['type']])['name'];return db[_0x0b4b('0x1e')][_0x0b4b('0x10')]({'where':{'type':_0x16c0ee,'resourceId':_0x132871['id']}})['then'](function(){return _0x28fda7;});})['then'](function(){_0x56bdb9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x203377){return function(_0x1549af){if(!_0x1549af){_0x203377[_0x0b4b('0x1f')](0x194);}return _0x1549af;};}function handleError(_0x36e702,_0x268d7e){_0x268d7e=_0x268d7e||0x1f4;return function(_0x1d93e4){logger['error'](_0x1d93e4[_0x0b4b('0x20')]);if(_0x1d93e4[_0x0b4b('0x21')]){delete _0x1d93e4['name'];}_0x36e702[_0x0b4b('0x9')](_0x268d7e)[_0x0b4b('0x22')](_0x1d93e4);};}exports[_0x0b4b('0x23')]=function(_0x2887ad,_0x479b3f){var _0x454066={},_0xae566a={},_0x5a1282={'count':0x0,'rows':[]};var _0x1e9aee=_['map'](db[_0x0b4b('0x24')][_0x0b4b('0x25')],function(_0x4954ec){return{'name':_0x4954ec[_0x0b4b('0x26')],'type':_0x4954ec[_0x0b4b('0x27')]['key']};});_0xae566a[_0x0b4b('0x28')]=_[_0x0b4b('0x1a')](_0x1e9aee,'name');_0xae566a['query']=_[_0x0b4b('0x29')](_0x2887ad[_0x0b4b('0x2a')]);_0xae566a['filters']=_['intersection'](_0xae566a[_0x0b4b('0x28')],_0xae566a[_0x0b4b('0x2a')]);_0x454066[_0x0b4b('0x2b')]=_[_0x0b4b('0x2c')](_0xae566a[_0x0b4b('0x28')],qs[_0x0b4b('0x2d')](_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x2d')]));_0x454066[_0x0b4b('0x2b')]=_0x454066[_0x0b4b('0x2b')][_0x0b4b('0x2e')]?_0x454066[_0x0b4b('0x2b')]:_0xae566a[_0x0b4b('0x28')];if(!_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x2f')](_0x0b4b('0x30'))){_0x454066['limit']=qs[_0x0b4b('0xc')](_0x2887ad['query'][_0x0b4b('0xc')]);_0x454066['offset']=qs['offset'](_0x2887ad[_0x0b4b('0x2a')]['offset']);}_0x454066[_0x0b4b('0x31')]=qs['sort'](_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x32')]);_0x454066[_0x0b4b('0x33')]=qs[_0x0b4b('0x34')](_['pick'](_0x2887ad['query'],_0xae566a[_0x0b4b('0x34')]),_0x1e9aee);if(_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x35')]){_0x454066['where']=_['merge'](_0x454066[_0x0b4b('0x33')],{'$or':_[_0x0b4b('0x1a')](_0x1e9aee,function(_0x70237b){if(_0x70237b['type']!==_0x0b4b('0x36')){var _0x5e79f1={};_0x5e79f1[_0x70237b[_0x0b4b('0x21')]]={'$like':'%'+_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x35')]+'%'};return _0x5e79f1;}})});}_0x454066=_[_0x0b4b('0x37')]({},_0x454066,_0x2887ad[_0x0b4b('0x38')]);var _0x32bde5={'where':_0x454066[_0x0b4b('0x33')]};return db[_0x0b4b('0x24')]['count'](_0x32bde5)[_0x0b4b('0x11')](function(_0x225f20){_0x5a1282['count']=_0x225f20;if(_0x2887ad[_0x0b4b('0x2a')][_0x0b4b('0x39')]){_0x454066[_0x0b4b('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0b4b('0x3b')](_0x454066);})[_0x0b4b('0x11')](function(_0x570515){_0x5a1282[_0x0b4b('0x3c')]=_0x570515;return _0x5a1282;})[_0x0b4b('0x11')](respondWithFilteredResult(_0x479b3f,_0x454066))['catch'](handleError(_0x479b3f,null));};exports[_0x0b4b('0x3d')]=function(_0x45a61e,_0x77434c){var _0x15fbe3={'raw':![],'where':{'id':_0x45a61e[_0x0b4b('0x3e')]['id']}},_0x4251b8={};_0x4251b8[_0x0b4b('0x28')]=_[_0x0b4b('0x29')](db[_0x0b4b('0x24')][_0x0b4b('0x25')]);_0x4251b8[_0x0b4b('0x2a')]=_[_0x0b4b('0x29')](_0x45a61e['query']);_0x4251b8[_0x0b4b('0x34')]=_[_0x0b4b('0x2c')](_0x4251b8[_0x0b4b('0x28')],_0x4251b8['query']);_0x15fbe3[_0x0b4b('0x2b')]=_[_0x0b4b('0x2c')](_0x4251b8[_0x0b4b('0x28')],qs[_0x0b4b('0x2d')](_0x45a61e['query']['fields']));_0x15fbe3['attributes']=_0x15fbe3[_0x0b4b('0x2b')]['length']?_0x15fbe3['attributes']:_0x4251b8[_0x0b4b('0x28')];if(_0x45a61e['query']['includeAll']){_0x15fbe3['include']=[{'all':!![]}];}_0x15fbe3=_['merge']({},_0x15fbe3,_0x45a61e[_0x0b4b('0x38')]);return db[_0x0b4b('0x24')][_0x0b4b('0x1c')](_0x15fbe3)[_0x0b4b('0x11')](handleEntityNotFound(_0x77434c,null))[_0x0b4b('0x11')](respondWithResult(_0x77434c,null))[_0x0b4b('0x3f')](handleError(_0x77434c,null));};exports['destroy']=function(_0x8f864e,_0x391de5){return db[_0x0b4b('0x24')][_0x0b4b('0x1c')]({'where':{'id':_0x8f864e[_0x0b4b('0x3e')]['id']}})[_0x0b4b('0x11')](handleEntityNotFound(_0x391de5,null))[_0x0b4b('0x11')](removeEntity(_0x391de5,null))[_0x0b4b('0x3f')](handleError(_0x391de5,null));};exports['create']=function(_0x4e5df5,_0x44e1d5){if(_0x4e5df5[_0x0b4b('0x40')][_0x0b4b('0x27')]===_0x0b4b('0x16')&&!_[_0x0b4b('0x41')](_0x4e5df5[_0x0b4b('0x40')]['exten'],'_')){_0x4e5df5[_0x0b4b('0x40')][_0x0b4b('0x42')]='_'['concat'](_0x4e5df5[_0x0b4b('0x40')][_0x0b4b('0x42')]);}return db[_0x0b4b('0x24')]['create'](_0x4e5df5['body'],{'raw':![]})[_0x0b4b('0x11')](function(_0x23fb40){var _0x42737e=_0x4e5df5[_0x0b4b('0x43')]['get']({'plain':!![]});if(!_0x42737e)throw new Error(_0x0b4b('0x44'));if(_0x42737e[_0x0b4b('0x45')]===_0x0b4b('0x43')){var _0x396da6=_0x23fb40[_0x0b4b('0x12')]({'plain':!![]});var _0xb47575=[{'name':'InboundRoutes','value':_0x0b4b('0x14')},{'name':_0x0b4b('0x15'),'value':_0x0b4b('0x16')},{'name':'InternalRoutes','value':_0x0b4b('0x18')}];var _0x3ceeaf=_[_0x0b4b('0x1c')](_0xb47575,[_0x0b4b('0x1d'),_0x396da6['type']])[_0x0b4b('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x3ceeaf,'userProfileId':_0x42737e[_0x0b4b('0x46')]},'raw':!![]})[_0x0b4b('0x11')](function(_0x2c61fd){if(_0x2c61fd&&_0x2c61fd[_0x0b4b('0x47')]===0x0){return db[_0x0b4b('0x1e')]['create']({'name':_0x396da6[_0x0b4b('0x21')],'resourceId':_0x396da6['id'],'type':_0x2c61fd['name'],'sectionId':_0x2c61fd['id']},{})['then'](function(){return _0x23fb40;});}else{return _0x23fb40;}})[_0x0b4b('0x3f')](function(_0x4aeb5f){logger['error'](_0x0b4b('0x48'),_0x4aeb5f);throw _0x4aeb5f;});}return _0x23fb40;})[_0x0b4b('0x11')](respondWithResult(_0x44e1d5,0xc9))[_0x0b4b('0x3f')](handleError(_0x44e1d5,null));};exports[_0x0b4b('0x49')]=function(_0x234d93,_0x2495ae){if(_0x234d93['body']['id']){delete _0x234d93[_0x0b4b('0x40')]['id'];}return db[_0x0b4b('0x24')]['find']({'where':{'id':_0x234d93['params']['id']}})[_0x0b4b('0x11')](handleEntityNotFound(_0x2495ae,null))['then'](function(_0xd64771){if(_0xd64771){return db[_0x0b4b('0x24')][_0x0b4b('0x49')](_[_0x0b4b('0x4a')](_0x234d93[_0x0b4b('0x40')],[_0x0b4b('0x42'),_0x0b4b('0x4b'),_0x0b4b('0x4c'),_0x0b4b('0x4d'),'cutdigits',_0x0b4b('0x4e'),'alias']),{'where':{'context':_0xd64771[_0x0b4b('0x4b')],'exten':_0xd64771[_0x0b4b('0x42')]},'individualHooks':!![]})[_0x0b4b('0x11')](function(_0x38522a){return _0x38522a;});}return null;})[_0x0b4b('0x11')](respondWithStatusCode(_0x2495ae,null))[_0x0b4b('0x3f')](handleError(_0x2495ae,null));};exports[_0x0b4b('0x4f')]=function(_0x55d085,_0x576810){var _0x196321=_0x55d085[_0x0b4b('0x3e')]['id'];var _0x5e4db0=_0x55d085[_0x0b4b('0x40')];var _0x4a9229=0xc8;var _0x370e2b=null;return db['sequelize'][_0x0b4b('0x50')]({'isolationLevel':db[_0x0b4b('0x51')][_0x0b4b('0x52')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xb82f61){return db['VoiceExtension']['findOne']({'where':{'id':_0x196321},'transaction':_0xb82f61})[_0x0b4b('0x11')](function(_0x48d5f3){if(_0x48d5f3){return db['VoiceExtension'][_0x0b4b('0x10')]({'where':{'VoiceExtensionId':_0x196321},'transaction':_0xb82f61})[_0x0b4b('0x11')](function(){var _0x28cc15=_[_0x0b4b('0x1a')](_0x5e4db0,function(_0x278a47){_0x278a47[_0x0b4b('0x53')]=_0x196321;_0x278a47[_0x0b4b('0x54')]=!![];return _0x278a47;});return _0x48d5f3[_0x0b4b('0x55')](_0x28cc15);})[_0x0b4b('0x11')](function(_0x165bbb){return db[_0x0b4b('0x24')][_0x0b4b('0x56')](_0x165bbb,{'transaction':_0xb82f61});});}else{_0x4a9229=0x194;_0x370e2b=[];}});})[_0x0b4b('0x11')](function(){if(_0x4a9229!==0x194){return db[_0x0b4b('0x24')][_0x0b4b('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x196321},'order':_0x0b4b('0x58')})[_0x0b4b('0x11')](function(_0x4834b5){_0x370e2b=_0x4834b5;});}})[_0x0b4b('0x3f')](function(_0x3b4957){_0x4a9229=0x1f4;logger['error'](_0x3b4957[_0x0b4b('0x20')]);if(_0x3b4957['name']){delete _0x3b4957[_0x0b4b('0x21')];}_0x370e2b=_0x3b4957;})['finally'](function(){if(_0x370e2b===null){_0x576810[_0x0b4b('0x1f')](_0x4a9229);}else{if(_0x4a9229===0x1f4){_0x576810[_0x0b4b('0x9')](_0x4a9229)[_0x0b4b('0x22')](_0x370e2b);}else{_0x576810[_0x0b4b('0x9')](_0x4a9229)[_0x0b4b('0xf')](_0x370e2b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f776e1e..809de55 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 _0x9825=['save','update','remove','emit','hasOwnProperty','hook','events','VoiceExtension'];(function(_0x14510c,_0x3f66f0){var _0x31c5f8=function(_0x1660ec){while(--_0x1660ec){_0x14510c['push'](_0x14510c['shift']());}};_0x31c5f8(++_0x3f66f0);}(_0x9825,0x6e));var _0x5982=function(_0x4bb55a,_0x1797ac){_0x4bb55a=_0x4bb55a-0x0;var _0xc6fc7d=_0x9825[_0x4bb55a];return _0xc6fc7d;};'use strict';var EventEmitter=require(_0x5982('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x5982('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5982('0x2'),'afterUpdate':_0x5982('0x3'),'afterDestroy':_0x5982('0x4')};function emitEvent(_0x36cd7a){return function(_0x452c26,_0x352e6a,_0x485b73){VoiceExtensionEvents[_0x5982('0x5')](_0x36cd7a+':'+_0x452c26['id'],_0x452c26);VoiceExtensionEvents[_0x5982('0x5')](_0x36cd7a,_0x452c26);_0x485b73(null);};}for(var e in events){if(events[_0x5982('0x6')](e)){var event=events[e];VoiceExtension[_0x5982('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xf5b9=['exports','events','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xf5b9,0xb9));var _0x9f5b=function(_0x368eba,_0x561e2a){_0x368eba=_0x368eba-0x0;var _0xf13fe7=_0xf5b9[_0x368eba];return _0xf13fe7;};'use strict';var EventEmitter=require(_0x9f5b('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9f5b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9f5b('0x2')](0x0);var events={'afterCreate':_0x9f5b('0x3'),'afterUpdate':_0x9f5b('0x4'),'afterDestroy':_0x9f5b('0x5')};function emitEvent(_0x4d8414){return function(_0x4803b1,_0x223bc2,_0x2e11af){VoiceExtensionEvents['emit'](_0x4d8414+':'+_0x4803b1['id'],_0x4803b1);VoiceExtensionEvents[_0x9f5b('0x6')](_0x4d8414,_0x4803b1);_0x2e11af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9f5b('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 439e050..37b144f 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 _0x8819=['CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','length','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','catch','VoiceExtension','voice_extensions','get','last','concat','Hangup','exports','models','type','Set','CDR(type)=','exten','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','alias','NoOp'];(function(_0x43febc,_0x46449f){var _0x56d914=function(_0xeb4772){while(--_0xeb4772){_0x43febc['push'](_0x43febc['shift']());}};_0x56d914(++_0x46449f);}(_0x8819,0x94));var _0x9881=function(_0x51b430,_0x2a940d){_0x51b430=_0x51b430-0x0;var _0x4e690b=_0x8819[_0x51b430];return _0x4e690b;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x9881('0x0')]=function(_0x27a509){var _0x317d26=_0x27a509[_0x9881('0x1')];function _0x17e6bf(_0x5e52c5){var _0x333d6f=0x2;var _0x446deb=[{'type':_0x5e52c5[_0x9881('0x2')],'app':_0x9881('0x3'),'appdata':_0x9881('0x4')+_0x5e52c5[_0x9881('0x2')],'context':_0x5e52c5['context'],'exten':_0x5e52c5[_0x9881('0x5')],'priority':_0x333d6f++,'VoiceExtensionId':_0x5e52c5['id']},{'type':_0x5e52c5['type'],'app':_0x5e52c5['alias']?_0x9881('0x3'):'NoOp','appdata':_0x5e52c5['alias']?_0x9881('0x6')+_0x5e52c5['alias']:_0x9881('0x7'),'context':_0x5e52c5[_0x9881('0x8')],'exten':_0x5e52c5[_0x9881('0x5')],'priority':_0x333d6f++,'VoiceExtensionId':_0x5e52c5['id']}];if(_0x5e52c5['type']===_0x9881('0x9')){_0x446deb[_0x9881('0xa')]({'type':_0x9881('0x9'),'app':_0x9881('0x3'),'appdata':'CDR(routeid)='+_0x5e52c5['id'],'context':_0x5e52c5[_0x9881('0x8')],'exten':_0x5e52c5[_0x9881('0x5')],'priority':_0x333d6f++,'VoiceExtensionId':_0x5e52c5['id']});}_0x446deb['push']({'type':_0x5e52c5[_0x9881('0x2')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5e52c5['context'],'exten':_0x5e52c5['exten'],'priority':_0x333d6f++,'VoiceExtensionId':_0x5e52c5['id']},{'type':_0x5e52c5[_0x9881('0x2')],'app':_0x9881('0x3'),'appdata':_0x9881('0xb'),'context':_0x5e52c5[_0x9881('0x8')],'exten':_0x5e52c5[_0x9881('0x5')],'priority':_0x333d6f++,'VoiceExtensionId':_0x5e52c5['id']},{'type':_0x5e52c5[_0x9881('0x2')],'app':'Set','appdata':_0x9881('0xc'),'context':_0x5e52c5[_0x9881('0x8')],'exten':_0x5e52c5[_0x9881('0x5')],'priority':_0x333d6f++,'VoiceExtensionId':_0x5e52c5['id']});return _0x446deb;}function _0x47975d(_0x50969c){var _0x4c92c9=0x2;var _0x280ea2=[{'type':'outbound','app':_0x9881('0x3'),'appdata':'CDR(type)=outbound','context':_0x50969c['context'],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':_0x50969c[_0x9881('0xe')]?_0x9881('0x3'):_0x9881('0xf'),'appdata':_0x50969c[_0x9881('0xe')]?_0x9881('0x6')+_0x50969c[_0x9881('0xe')]:_0x9881('0x7'),'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':_0x9881('0x3'),'appdata':_0x9881('0x10')+(_0x50969c[_0x9881('0x11')]?'${EXTEN:'+_0x50969c['cutdigits']+'}':_0x9881('0x12')),'context':_0x50969c['context'],'exten':_0x50969c['exten'],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':_0x9881('0x3'),'appdata':'CDR(routeid)='+_0x50969c['id'],'context':_0x50969c['context'],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':'outbound','app':_0x9881('0x13'),'appdata':_0x9881('0x14')+(_0x4c92c9+0x2)+_0x9881('0x15')+(_0x4c92c9+0x1)+')','context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':_0x9881('0x3'),'appdata':_0x50969c[_0x9881('0x11')]?_0x9881('0x16')+_0x50969c[_0x9881('0x11')]+'}':_0x9881('0x17'),'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':'outbound','app':_0x9881('0x3'),'appdata':_0x9881('0x18'),'context':_0x50969c['context'],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':'Set','appdata':_0x9881('0xb'),'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':_0x9881('0x3'),'appdata':_0x9881('0xc'),'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':'outbound','app':_0x9881('0x3'),'appdata':_0x9881('0x19')+_0x50969c['id'],'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']}];if(_0x50969c[_0x9881('0x1a')](_0x9881('0x1b'))&&_0x50969c['recordingFormat']!==_0x9881('0x1c')){_0x280ea2[_0x9881('0xa')]({'type':'outbound','app':_0x9881('0x3'),'appdata':_0x9881('0x1d'),'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']},{'type':_0x9881('0xd'),'app':'Set','appdata':_0x9881('0x1e')+_0x50969c[_0x9881('0x1b')]||_0x9881('0x1f'),'context':_0x50969c[_0x9881('0x8')],'exten':_0x50969c[_0x9881('0x5')],'priority':_0x4c92c9++,'VoiceExtensionId':_0x50969c['id']});}return _0x280ea2;}function _0x28abfc(_0x2028fc,_0x250987){var _0x2f6aea=[{'name':_0x9881('0x20'),'param':0x0},{'name':_0x9881('0x21'),'param':0x1},{'name':_0x9881('0x22'),'param':0x2},{'name':_0x9881('0x23'),'param':0x3}];var _0x136f9a={};var _0x450ee9=_0x250987[_0x9881('0x24')](',');var _0x5d902d=[];for(var _0x241c82=0x0;_0x241c82<_0x2f6aea['length'];_0x241c82++){switch(_0x2f6aea[_0x241c82][_0x9881('0x25')]){case'trunk':_0x136f9a[_0x9881('0x20')]=_0x450ee9[_0x2f6aea[_0x241c82][_0x9881('0x26')]]['split']('/')[0x1];_0x136f9a[_0x9881('0x27')]=_0x450ee9[_0x2f6aea[_0x241c82]['param']][_0x9881('0x24')]('/')[0x2];_0x136f9a[_0x9881('0x28')]=_0x136f9a[_0x9881('0x27')]?_0x136f9a[_0x9881('0x27')]['split']('$')[0x0]:undefined;_0x136f9a[_0x9881('0x27')]=_0x2028fc[_0x9881('0x11')]?(_0x136f9a[_0x9881('0x28')]||'')+_0x9881('0x29')+_0x2028fc[_0x9881('0x11')]+'}':(_0x136f9a[_0x9881('0x28')]||'')+_0x9881('0x12');_0x5d902d[_0x2f6aea[_0x241c82]['param']]=[_0x9881('0x2a'),_0x136f9a['trunk'],_0x136f9a[_0x9881('0x27')]][_0x9881('0x2b')]('/');break;case _0x9881('0x22'):_0x136f9a['options']=_0x450ee9[_0x2f6aea[_0x241c82][_0x9881('0x26')]];if(_0x2028fc[_0x9881('0x1b')]!==_0x9881('0x1c')){if(_0x136f9a['options'][_0x9881('0x2c')](_0x9881('0x2d'))<0x0){_0x136f9a['options']+=_0x9881('0x2d');}}else{_0x136f9a[_0x9881('0x22')]=_0x136f9a[_0x9881('0x22')][_0x9881('0x2e')](_0x9881('0x2d'),'');}_0x5d902d[_0x2f6aea[_0x241c82][_0x9881('0x26')]]=_0x136f9a[_0x9881('0x22')];break;default:_0x5d902d[_0x2f6aea[_0x241c82][_0x9881('0x26')]]=_0x450ee9[_0x2f6aea[_0x241c82][_0x9881('0x26')]];}}return _0x5d902d[_0x9881('0x2b')](',');}function _0x520118(_0x457249,_0x2fe742,_0x366546){return new Promise(function(_0x49de5,_0x228c4d){var _0x4f25a9=[];if(_[_0x9881('0x2f')](_0x2fe742))return _0x49de5(_0x4f25a9);_0x317d26[_0x9881('0x30')][_0x9881('0x31')]({'attributes':['id',_0x9881('0x32'),'IntervalId'],'raw':!![]})[_0x9881('0x33')](function(_0xc9713c){for(var _0x25ca4e=0x0,_0x5528b9=0x0;_0x25ca4e<_0x2fe742[_0x9881('0x34')];_0x25ca4e++,_0x5528b9=0x0){var _0x3746f6=_0x2fe742[_0x25ca4e];var _0x35f875=[];var _0x21fa38=[];delete _0x3746f6['id'];if(_0x3746f6[_0x9881('0x32')]!==_0x9881('0x35')){_0x3746f6[_0x9881('0x36')]=[_0x3746f6[_0x9881('0x32')]];}else{_0x3746f6[_0x9881('0x36')]=_0x3746f6[_0x9881('0x37')]?_['map'](_[_0x9881('0x38')](_0xc9713c,{'IntervalId':_0x3746f6[_0x9881('0x37')]}),_0x9881('0x32')):[];}_0x3746f6['context']=_0x457249[_0x9881('0x8')];_0x3746f6[_0x9881('0x5')]=_0x457249[_0x9881('0x5')];if(_0x3746f6['type'])_0x3746f6['type']=_0x3746f6[_0x9881('0x2')][_0x9881('0x39')]();if(_0x457249[_0x9881('0x2')]===_0x9881('0xd')){if(_0x3746f6['hasOwnProperty']('tag')&&_0x3746f6[_0x9881('0x3a')]&&_0x3746f6[_0x9881('0x3a')]!=='--'){_0x35f875[_0x9881('0xa')]({'type':_0x3746f6['type'][_0x9881('0x39')](),'app':_0x9881('0x3'),'appdata':'CDR(tag)='+_0x3746f6[_0x9881('0x3a')],'context':_0x457249[_0x9881('0x8')],'exten':_0x457249[_0x9881('0x5')],'priority':_0x3746f6[_0x9881('0x36')][_0x9881('0x34')]+_0x366546+_0x5528b9++,'VoiceExtensionId':_0x457249['id']});}_0x35f875[_0x9881('0xa')]({'type':_0x3746f6[_0x9881('0x2')]['toLowerCase'](),'app':_0x9881('0x13'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3746f6[_0x9881('0x3b')]?_0x9881('0x3c')+_0x3746f6[_0x9881('0x3b')]+')':_0x9881('0x3d')),'context':_0x457249['context'],'exten':_0x457249['exten'],'priority':_0x3746f6[_0x9881('0x36')][_0x9881('0x34')]+_0x366546+_0x5528b9++,'VoiceExtensionId':_0x457249['id']});}else{if(_0x3746f6[_0x9881('0x1a')]('answer')){if([_0x9881('0x3e'),_0x9881('0x3f')][_0x9881('0x40')](_0x3746f6[_0x9881('0x41')][_0x9881('0x39')]())&&_0x3746f6[_0x9881('0x42')]!=='custom'){if(_0x3746f6[_0x9881('0x43')]){_0x35f875[_0x9881('0xa')]({'type':_0x3746f6[_0x9881('0x2')][_0x9881('0x39')](),'app':_0x9881('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x457249['context'],'exten':_0x457249['exten'],'priority':_0x3746f6[_0x9881('0x36')][_0x9881('0x34')]+_0x366546+_0x5528b9++,'VoiceExtensionId':_0x457249['id']});_0x35f875[_0x9881('0xa')]({'type':_0x3746f6[_0x9881('0x2')][_0x9881('0x39')](),'app':_0x9881('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x457249['context'],'exten':_0x457249[_0x9881('0x5')],'priority':_0x3746f6[_0x9881('0x36')]['length']+_0x366546+_0x5528b9++,'VoiceExtensionId':_0x457249['id']});}else{_0x35f875[_0x9881('0xa')]({'type':_0x3746f6[_0x9881('0x2')][_0x9881('0x39')](),'app':_0x9881('0x13'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x457249[_0x9881('0x8')],'exten':_0x457249['exten'],'priority':_0x3746f6[_0x9881('0x36')][_0x9881('0x34')]+_0x366546+_0x5528b9++,'VoiceExtensionId':_0x457249['id']});_0x35f875[_0x9881('0xa')]({'type':_0x3746f6['type']['toLowerCase'](),'app':'Set','appdata':_0x9881('0x44'),'context':_0x457249[_0x9881('0x8')],'exten':_0x457249['exten'],'priority':_0x3746f6[_0x9881('0x36')][_0x9881('0x34')]+_0x366546+_0x5528b9++,'VoiceExtensionId':_0x457249['id']});}}}}for(var _0x9ce0de=0x0;_0x9ce0de<_0x3746f6[_0x9881('0x36')][_0x9881('0x34')];_0x9ce0de++){var _0x3cea77=_0x366546+_0x3746f6[_0x9881('0x36')][_0x9881('0x34')];var _0x5a9958=_0x9ce0de===_0x3746f6['intervals'][_0x9881('0x34')]-0x1?_0x366546+_0x35f875[_0x9881('0x34')]+_0x21fa38[_0x9881('0x34')]+0x2:_0x366546+_0x9ce0de+0x1;_0x35f875[_0x9881('0x45')](_0x9ce0de,0x0,{'type':_0x457249[_0x9881('0x2')],'app':_0x9881('0x46'),'appdata':_0x3746f6['intervals'][_0x9ce0de]+'?'+_0x457249[_0x9881('0x8')]+_0x9881('0x47')+_0x3cea77+':'+_0x457249[_0x9881('0x8')]+_0x9881('0x47')+_0x5a9958,'exten':_0x457249['exten'],'context':_0x457249[_0x9881('0x8')],'priority':_0x366546+_0x9ce0de,'VoiceExtensionId':_0x457249['id']});}if(_0x3746f6['appType']===_0x9881('0x48'))_0x3746f6[_0x9881('0x49')]=_0x28abfc(_0x457249,_0x3746f6[_0x9881('0x49')]);_0x3746f6[_0x9881('0x4a')]=_0x35f875['length']?_['last'](_0x35f875)[_0x9881('0x4a')]+0x1:_0x366546;_0x4f25a9=_['concat'](_0x4f25a9,_0x35f875,[_0x3746f6],_0x21fa38);_0x366546=_['last'](_0x4f25a9)[_0x9881('0x4a')]+0x1;}return _0x49de5(_0x4f25a9);})[_0x9881('0x4b')](function(_0x115eec){_0x228c4d(_0x115eec);});});}return _0x27a509['define'](_0x9881('0x4c'),attributes,{'tableName':_0x9881('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x51d605){var _0x2938e3=this[_0x9881('0x4e')]({'plain':!![]});var _0x4d5ea0=_0x2938e3[_0x9881('0x2')]==='outbound'?_0x47975d(_0x2938e3):_0x17e6bf(_0x2938e3);return _0x520118(_0x2938e3,_0x51d605,_[_0x9881('0x4f')](_0x4d5ea0)[_0x9881('0x4a')]+0x1)[_0x9881('0x33')](function(_0x228b47){var _0x1817c4=_[_0x9881('0x50')](_0x4d5ea0,_0x228b47);_0x1817c4['push']({'type':_0x2938e3[_0x9881('0x2')],'app':_0x9881('0x51'),'exten':_0x2938e3[_0x9881('0x5')],'context':_0x2938e3[_0x9881('0x8')],'priority':_[_0x9881('0x4f')](_0x1817c4)[_0x9881('0x4a')]+0x1,'VoiceExtensionId':_0x2938e3['id']});return _0x1817c4;});}}});}; \ No newline at end of file +var _0xe9e8=['length','name','param','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime','appdata','priority','last','concat','catch','define','VoiceExtension','get','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','exten','alias','NoOp','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split'];(function(_0x272206,_0x428bb6){var _0x57df1d=function(_0x2d52bc){while(--_0x2d52bc){_0x272206['push'](_0x272206['shift']());}};_0x57df1d(++_0x428bb6);}(_0xe9e8,0x179));var _0x8e9e=function(_0x2188e3,_0x322761){_0x2188e3=_0x2188e3-0x0;var _0x150f51=_0xe9e8[_0x2188e3];return _0x150f51;};'use strict';var _=require(_0x8e9e('0x0'));var attributes=require(_0x8e9e('0x1'));module[_0x8e9e('0x2')]=function(_0x38b3cb){var _0x1a564e=_0x38b3cb[_0x8e9e('0x3')];function _0x398891(_0x48f1bc){var _0x1508fb=0x2;var _0x497f2a=[{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x6')+_0x48f1bc['type'],'context':_0x48f1bc['context'],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']},{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x48f1bc[_0x8e9e('0x8')]?_0x8e9e('0x5'):_0x8e9e('0x9'),'appdata':_0x48f1bc[_0x8e9e('0x8')]?'CDR(routeAlias)='+_0x48f1bc['alias']:_0x8e9e('0xa'),'context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']}];if(_0x48f1bc[_0x8e9e('0x4')]===_0x8e9e('0xc')){_0x497f2a[_0x8e9e('0xd')]({'type':_0x8e9e('0xc'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xe')+_0x48f1bc['id'],'context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']});}_0x497f2a[_0x8e9e('0xd')]({'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc[_0x8e9e('0x7')],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']},{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48f1bc[_0x8e9e('0xb')],'exten':_0x48f1bc['exten'],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']},{'type':_0x48f1bc[_0x8e9e('0x4')],'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xf'),'context':_0x48f1bc['context'],'exten':_0x48f1bc['exten'],'priority':_0x1508fb++,'VoiceExtensionId':_0x48f1bc['id']});return _0x497f2a;}function _0x20220a(_0xe80653){var _0x5b62ca=0x2;var _0x1bddc7=[{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x11'),'context':_0xe80653['context'],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':'outbound','app':_0xe80653[_0x8e9e('0x8')]?_0x8e9e('0x5'):_0x8e9e('0x9'),'appdata':_0xe80653[_0x8e9e('0x8')]?'CDR(routeAlias)='+_0xe80653['alias']:'No\x20alias\x20set','context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x12')+(_0xe80653[_0x8e9e('0x13')]?_0x8e9e('0x14')+_0xe80653[_0x8e9e('0x13')]+'}':_0x8e9e('0x15')),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xe')+_0xe80653['id'],'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653['exten'],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':'ExecIf','appdata':_0x8e9e('0x16')+(_0x5b62ca+0x2)+_0x8e9e('0x17')+(_0x5b62ca+0x1)+')','context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0xe80653[_0x8e9e('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0xe80653[_0x8e9e('0x13')]+'}':_0x8e9e('0x18'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':'Set','appdata':_0x8e9e('0x19'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':'outbound','app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1a'),'context':_0xe80653['context'],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0xf'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':'outbound','app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1b')+_0xe80653['id'],'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']}];if(_0xe80653[_0x8e9e('0x1c')](_0x8e9e('0x1d'))&&_0xe80653['recordingFormat']!=='none'){_0x1bddc7[_0x8e9e('0xd')]({'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1e'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653['exten'],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']},{'type':_0x8e9e('0x10'),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x1f')+_0xe80653[_0x8e9e('0x1d')]||_0x8e9e('0x20'),'context':_0xe80653[_0x8e9e('0xb')],'exten':_0xe80653[_0x8e9e('0x7')],'priority':_0x5b62ca++,'VoiceExtensionId':_0xe80653['id']});}return _0x1bddc7;}function _0x3f6caa(_0x5f0e5b,_0x597609){var _0x52f57f=[{'name':_0x8e9e('0x21'),'param':0x0},{'name':_0x8e9e('0x22'),'param':0x1},{'name':_0x8e9e('0x23'),'param':0x2},{'name':_0x8e9e('0x24'),'param':0x3}];var _0x574954={};var _0x142676=_0x597609[_0x8e9e('0x25')](',');var _0x2cda50=[];for(var _0x1ea9c0=0x0;_0x1ea9c0<_0x52f57f[_0x8e9e('0x26')];_0x1ea9c0++){switch(_0x52f57f[_0x1ea9c0][_0x8e9e('0x27')]){case _0x8e9e('0x21'):_0x574954['trunk']=_0x142676[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]][_0x8e9e('0x25')]('/')[0x1];_0x574954[_0x8e9e('0x29')]=_0x142676[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]]['split']('/')[0x2];_0x574954[_0x8e9e('0x2a')]=_0x574954[_0x8e9e('0x29')]?_0x574954[_0x8e9e('0x29')][_0x8e9e('0x25')]('$')[0x0]:undefined;_0x574954['phone']=_0x5f0e5b[_0x8e9e('0x13')]?(_0x574954[_0x8e9e('0x2a')]||'')+_0x8e9e('0x14')+_0x5f0e5b[_0x8e9e('0x13')]+'}':(_0x574954[_0x8e9e('0x2a')]||'')+'${EXTEN}';_0x2cda50[_0x52f57f[_0x1ea9c0]['param']]=[_0x8e9e('0x2b'),_0x574954[_0x8e9e('0x21')],_0x574954['phone']][_0x8e9e('0x2c')]('/');break;case'options':_0x574954[_0x8e9e('0x23')]=_0x142676[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]];if(_0x5f0e5b[_0x8e9e('0x1d')]!==_0x8e9e('0x2d')){if(_0x574954['options'][_0x8e9e('0x2e')]('U(xcally-mixmonitor-context)')<0x0){_0x574954[_0x8e9e('0x23')]+=_0x8e9e('0x2f');}}else{_0x574954[_0x8e9e('0x23')]=_0x574954[_0x8e9e('0x23')][_0x8e9e('0x30')](_0x8e9e('0x2f'),'');}_0x2cda50[_0x52f57f[_0x1ea9c0][_0x8e9e('0x28')]]=_0x574954[_0x8e9e('0x23')];break;default:_0x2cda50[_0x52f57f[_0x1ea9c0]['param']]=_0x142676[_0x52f57f[_0x1ea9c0]['param']];}}return _0x2cda50['join'](',');}function _0x240164(_0x52094c,_0x1d5d79,_0x2f3c12){return new Promise(function(_0x5802bf,_0x2bb2f2){var _0x4c747b=[];if(_[_0x8e9e('0x31')](_0x1d5d79))return _0x5802bf(_0x4c747b);_0x1a564e[_0x8e9e('0x32')][_0x8e9e('0x33')]({'attributes':['id',_0x8e9e('0x34'),_0x8e9e('0x35')],'raw':!![]})[_0x8e9e('0x36')](function(_0x31c134){for(var _0x2d7a86=0x0,_0x1b6d8a=0x0;_0x2d7a86<_0x1d5d79[_0x8e9e('0x26')];_0x2d7a86++,_0x1b6d8a=0x0){var _0x41b9e4=_0x1d5d79[_0x2d7a86];var _0x58bd25=[];var _0x150db7=[];delete _0x41b9e4['id'];if(_0x41b9e4[_0x8e9e('0x34')]!==_0x8e9e('0x37')){_0x41b9e4[_0x8e9e('0x38')]=[_0x41b9e4[_0x8e9e('0x34')]];}else{_0x41b9e4['intervals']=_0x41b9e4[_0x8e9e('0x35')]?_[_0x8e9e('0x39')](_['filter'](_0x31c134,{'IntervalId':_0x41b9e4[_0x8e9e('0x35')]}),_0x8e9e('0x34')):[];}_0x41b9e4['context']=_0x52094c[_0x8e9e('0xb')];_0x41b9e4[_0x8e9e('0x7')]=_0x52094c[_0x8e9e('0x7')];if(_0x41b9e4[_0x8e9e('0x4')])_0x41b9e4['type']=_0x41b9e4[_0x8e9e('0x4')]['toLowerCase']();if(_0x52094c['type']===_0x8e9e('0x10')){if(_0x41b9e4['hasOwnProperty'](_0x8e9e('0x3a'))&&_0x41b9e4['tag']&&_0x41b9e4['tag']!=='--'){_0x58bd25[_0x8e9e('0xd')]({'type':_0x41b9e4[_0x8e9e('0x4')][_0x8e9e('0x3b')](),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x3c')+_0x41b9e4[_0x8e9e('0x3a')],'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4['intervals'][_0x8e9e('0x26')]+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}_0x58bd25[_0x8e9e('0xd')]({'type':_0x41b9e4[_0x8e9e('0x4')][_0x8e9e('0x3b')](),'app':'ExecIf','appdata':_0x8e9e('0x3d')+(_0x41b9e4[_0x8e9e('0x3e')]?_0x8e9e('0x3f')+_0x41b9e4['callerID']+')':_0x8e9e('0x40')),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')]['length']+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}else{if(_0x41b9e4[_0x8e9e('0x1c')](_0x8e9e('0x41'))){if([_0x8e9e('0x42'),_0x8e9e('0x43')]['includes'](_0x41b9e4[_0x8e9e('0x44')][_0x8e9e('0x3b')]())&&_0x41b9e4[_0x8e9e('0x45')]!==_0x8e9e('0x46')){if(_0x41b9e4[_0x8e9e('0x41')]){_0x58bd25['push']({'type':_0x41b9e4['type']['toLowerCase'](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')][_0x8e9e('0x26')]+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});_0x58bd25['push']({'type':_0x41b9e4[_0x8e9e('0x4')][_0x8e9e('0x3b')](),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x47'),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c['exten'],'priority':_0x41b9e4[_0x8e9e('0x38')]['length']+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}else{_0x58bd25['push']({'type':_0x41b9e4[_0x8e9e('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0x8e9e('0x48'),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')][_0x8e9e('0x26')]+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});_0x58bd25[_0x8e9e('0xd')]({'type':_0x41b9e4['type']['toLowerCase'](),'app':_0x8e9e('0x5'),'appdata':_0x8e9e('0x49'),'context':_0x52094c[_0x8e9e('0xb')],'exten':_0x52094c[_0x8e9e('0x7')],'priority':_0x41b9e4[_0x8e9e('0x38')]['length']+_0x2f3c12+_0x1b6d8a++,'VoiceExtensionId':_0x52094c['id']});}}}}for(var _0x183e92=0x0;_0x183e92<_0x41b9e4['intervals'][_0x8e9e('0x26')];_0x183e92++){var _0x425eff=_0x2f3c12+_0x41b9e4[_0x8e9e('0x38')][_0x8e9e('0x26')];var _0x387367=_0x183e92===_0x41b9e4['intervals']['length']-0x1?_0x2f3c12+_0x58bd25[_0x8e9e('0x26')]+_0x150db7['length']+0x2:_0x2f3c12+_0x183e92+0x1;_0x58bd25['splice'](_0x183e92,0x0,{'type':_0x52094c[_0x8e9e('0x4')],'app':_0x8e9e('0x4a'),'appdata':_0x41b9e4[_0x8e9e('0x38')][_0x183e92]+'?'+_0x52094c[_0x8e9e('0xb')]+',${EXTEN},'+_0x425eff+':'+_0x52094c['context']+',${EXTEN},'+_0x387367,'exten':_0x52094c[_0x8e9e('0x7')],'context':_0x52094c[_0x8e9e('0xb')],'priority':_0x2f3c12+_0x183e92,'VoiceExtensionId':_0x52094c['id']});}if(_0x41b9e4[_0x8e9e('0x45')]==='outboundDial')_0x41b9e4[_0x8e9e('0x4b')]=_0x3f6caa(_0x52094c,_0x41b9e4[_0x8e9e('0x4b')]);_0x41b9e4[_0x8e9e('0x4c')]=_0x58bd25['length']?_[_0x8e9e('0x4d')](_0x58bd25)[_0x8e9e('0x4c')]+0x1:_0x2f3c12;_0x4c747b=_[_0x8e9e('0x4e')](_0x4c747b,_0x58bd25,[_0x41b9e4],_0x150db7);_0x2f3c12=_[_0x8e9e('0x4d')](_0x4c747b)[_0x8e9e('0x4c')]+0x1;}return _0x5802bf(_0x4c747b);})[_0x8e9e('0x4f')](function(_0x429514){_0x2bb2f2(_0x429514);});});}return _0x38b3cb[_0x8e9e('0x50')](_0x8e9e('0x51'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1839b1){var _0x189501=this[_0x8e9e('0x52')]({'plain':!![]});var _0x40e965=_0x189501['type']===_0x8e9e('0x10')?_0x20220a(_0x189501):_0x398891(_0x189501);return _0x240164(_0x189501,_0x1839b1,_[_0x8e9e('0x4d')](_0x40e965)[_0x8e9e('0x4c')]+0x1)[_0x8e9e('0x36')](function(_0x3be122){var _0x14edc4=_[_0x8e9e('0x4e')](_0x40e965,_0x3be122);_0x14edc4['push']({'type':_0x189501[_0x8e9e('0x4')],'app':'Hangup','exten':_0x189501['exten'],'context':_0x189501[_0x8e9e('0xb')],'priority':_[_0x8e9e('0x4d')](_0x14edc4)[_0x8e9e('0x4c')]+0x1,'VoiceExtensionId':_0x189501['id']});return _0x14edc4;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e568e7a..27a6a65 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 _0xd9ce=['message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','attributes','limit','include','model','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x376dae,_0x430ddb){var _0x4054a0=function(_0x2d4812){while(--_0x2d4812){_0x376dae['push'](_0x376dae['shift']());}};_0x4054a0(++_0x430ddb);}(_0xd9ce,0xeb));var _0xed9c=function(_0x5442a5,_0x4110f1){_0x5442a5=_0x5442a5-0x0;var _0x130af0=_0xd9ce[_0x5442a5];return _0x130af0;};'use strict';var _=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var moment=require(_0xed9c('0x2'));var BPromise=require(_0xed9c('0x3'));var rs=require(_0xed9c('0x4'));var fs=require('fs');var Redis=require(_0xed9c('0x5'));var db=require(_0xed9c('0x6'))['db'];var utils=require(_0xed9c('0x7'));var logger=require('../../config/logger')(_0xed9c('0x8'));var config=require(_0xed9c('0x9'));var jayson=require(_0xed9c('0xa'));var client=jayson[_0xed9c('0xb')][_0xed9c('0xc')]({'port':0x232a});config[_0xed9c('0xd')]=_['defaults'](config[_0xed9c('0xd')],{'host':_0xed9c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xed9c('0xf'))['register'](socket);function respondWithRpcPromise(_0x2a61eb,_0x12471a,_0xd11a6){return new BPromise(function(_0x7f112a,_0x5e3385){return client[_0xed9c('0x10')](_0x2a61eb,_0xd11a6)[_0xed9c('0x11')](function(_0x103137){logger[_0xed9c('0x12')](_0xed9c('0x13'),_0x12471a,'request\x20sent');logger['debug'](_0xed9c('0x14'),_0x12471a,_0xed9c('0x15'),JSON[_0xed9c('0x16')](_0x103137));if(_0x103137[_0xed9c('0x17')]){if(_0x103137['error']['code']===0x1f4){logger[_0xed9c('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x12471a,_0x103137[_0xed9c('0x17')][_0xed9c('0x18')]);return _0x5e3385(_0x103137[_0xed9c('0x17')][_0xed9c('0x18')]);}logger[_0xed9c('0x17')](_0xed9c('0x13'),_0x12471a,_0x103137[_0xed9c('0x17')]['message']);return _0x7f112a(_0x103137[_0xed9c('0x17')][_0xed9c('0x18')]);}else{logger[_0xed9c('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x12471a,_0xed9c('0x15'));_0x7f112a(_0x103137[_0xed9c('0x19')]['message']);}})[_0xed9c('0x1a')](function(_0x465bec){logger[_0xed9c('0x17')](_0xed9c('0x13'),_0x12471a,_0x465bec);_0x5e3385(_0x465bec);});});}exports[_0xed9c('0x1b')]=function(_0x310ec0){var _0x57a22f=this;return new Promise(function(_0x28c1ce,_0x32c67e){return db[_0xed9c('0x1c')]['findAll']({'raw':_0x310ec0[_0xed9c('0x1d')]?_0x310ec0[_0xed9c('0x1d')][_0xed9c('0x1e')]===undefined?!![]:![]:!![],'where':_0x310ec0[_0xed9c('0x1d')]?_0x310ec0['options']['where']||null:null,'attributes':_0x310ec0[_0xed9c('0x1d')]?_0x310ec0[_0xed9c('0x1d')][_0xed9c('0x1f')]||null:null,'limit':_0x310ec0[_0xed9c('0x1d')]?_0x310ec0[_0xed9c('0x1d')][_0xed9c('0x20')]||null:null,'include':_0x310ec0['options']?_0x310ec0[_0xed9c('0x1d')]['include']?_['map'](_0x310ec0['options'][_0xed9c('0x21')],function(_0xc02cd5){return{'model':db[_0xc02cd5[_0xed9c('0x22')]],'as':_0xc02cd5['as'],'attributes':_0xc02cd5[_0xed9c('0x1f')],'include':_0xc02cd5['include']?_[_0xed9c('0x23')](_0xc02cd5[_0xed9c('0x21')],function(_0x262f82){return{'model':db[_0x262f82['model']],'as':_0x262f82['as'],'attributes':_0x262f82[_0xed9c('0x1f')],'include':_0x262f82[_0xed9c('0x21')]?_[_0xed9c('0x23')](_0x262f82[_0xed9c('0x21')],function(_0x548eab){return{'model':db[_0x548eab[_0xed9c('0x22')]],'as':_0x548eab['as'],'attributes':_0x548eab['attributes']};}):[]};}):[]};}):[]:[]})[_0xed9c('0x11')](function(_0x438a31){logger[_0xed9c('0x12')](_0xed9c('0x1b'),_0x310ec0);logger[_0xed9c('0x24')]('GetVoiceExtension',_0x310ec0,JSON['stringify'](_0x438a31));_0x28c1ce(_0x438a31);})[_0xed9c('0x1a')](function(_0x9a2584){logger[_0xed9c('0x17')](_0xed9c('0x1b'),_0x9a2584['message'],_0x310ec0);_0x32c67e(_0x57a22f[_0xed9c('0x17')](0x1f4,_0x9a2584[_0xed9c('0x18')]));});});}; \ No newline at end of file +var _0xe132=['info','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c7cea,_0x58d586){var _0x4ce52a=function(_0x3face3){while(--_0x3face3){_0x1c7cea['push'](_0x1c7cea['shift']());}};_0x4ce52a(++_0x58d586);}(_0xe132,0x162));var _0x2e13=function(_0x2b44c5,_0x3130c1){_0x2b44c5=_0x2b44c5-0x0;var _0x173a85=_0xe132[_0x2b44c5];return _0x173a85;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var moment=require(_0x2e13('0x1'));var BPromise=require(_0x2e13('0x2'));var rs=require(_0x2e13('0x3'));var fs=require('fs');var Redis=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e13('0x6'))(_0x2e13('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e13('0x8')][_0x2e13('0x9')]({'port':0x232a});config[_0x2e13('0xa')]=_[_0x2e13('0xb')](config[_0x2e13('0xa')],{'host':_0x2e13('0xc'),'port':0x18eb});var socket=require(_0x2e13('0xd'))(new Redis(config[_0x2e13('0xa')]));require(_0x2e13('0xe'))[_0x2e13('0xf')](socket);function respondWithRpcPromise(_0x5122a2,_0x1fc092,_0x20fe3e){return new BPromise(function(_0x31b284,_0x40c2eb){return client[_0x2e13('0x10')](_0x5122a2,_0x20fe3e)[_0x2e13('0x11')](function(_0x302718){logger['info'](_0x2e13('0x12'),_0x1fc092,_0x2e13('0x13'));logger[_0x2e13('0x14')](_0x2e13('0x15'),_0x1fc092,_0x2e13('0x13'),JSON[_0x2e13('0x16')](_0x302718));if(_0x302718[_0x2e13('0x17')]){if(_0x302718['error'][_0x2e13('0x18')]===0x1f4){logger[_0x2e13('0x17')](_0x2e13('0x12'),_0x1fc092,_0x302718['error'][_0x2e13('0x19')]);return _0x40c2eb(_0x302718[_0x2e13('0x17')][_0x2e13('0x19')]);}logger['error'](_0x2e13('0x12'),_0x1fc092,_0x302718[_0x2e13('0x17')][_0x2e13('0x19')]);return _0x31b284(_0x302718['error']['message']);}else{logger[_0x2e13('0x1a')](_0x2e13('0x12'),_0x1fc092,_0x2e13('0x13'));_0x31b284(_0x302718[_0x2e13('0x1b')][_0x2e13('0x19')]);}})[_0x2e13('0x1c')](function(_0x2496ee){logger[_0x2e13('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1fc092,_0x2496ee);_0x40c2eb(_0x2496ee);});});}exports[_0x2e13('0x1d')]=function(_0x9c37a9){var _0xa1ea28=this;return new Promise(function(_0x173a27,_0x479013){return db['VoiceExtension'][_0x2e13('0x1e')]({'raw':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x9c37a9['options']?_0x9c37a9[_0x2e13('0x1f')][_0x2e13('0x20')]||null:null,'attributes':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9[_0x2e13('0x1f')][_0x2e13('0x21')]||null:null,'limit':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9['options'][_0x2e13('0x22')]||null:null,'include':_0x9c37a9[_0x2e13('0x1f')]?_0x9c37a9[_0x2e13('0x1f')][_0x2e13('0x23')]?_[_0x2e13('0x24')](_0x9c37a9[_0x2e13('0x1f')]['include'],function(_0x341ae7){return{'model':db[_0x341ae7[_0x2e13('0x25')]],'as':_0x341ae7['as'],'attributes':_0x341ae7['attributes'],'include':_0x341ae7['include']?_[_0x2e13('0x24')](_0x341ae7[_0x2e13('0x23')],function(_0x279d9e){return{'model':db[_0x279d9e['model']],'as':_0x279d9e['as'],'attributes':_0x279d9e[_0x2e13('0x21')],'include':_0x279d9e[_0x2e13('0x23')]?_[_0x2e13('0x24')](_0x279d9e[_0x2e13('0x23')],function(_0x2c6e04){return{'model':db[_0x2c6e04[_0x2e13('0x25')]],'as':_0x2c6e04['as'],'attributes':_0x2c6e04[_0x2e13('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2e13('0x11')](function(_0x31f448){logger[_0x2e13('0x1a')](_0x2e13('0x1d'),_0x9c37a9);logger[_0x2e13('0x14')](_0x2e13('0x1d'),_0x9c37a9,JSON[_0x2e13('0x16')](_0x31f448));_0x173a27(_0x31f448);})[_0x2e13('0x1c')](function(_0x49e258){logger[_0x2e13('0x17')](_0x2e13('0x1d'),_0x49e258[_0x2e13('0x19')],_0x9c37a9);_0x479013(_0xa1ea28['error'](0x1f4,_0x49e258['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 005ddb3..423974e 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x3980c8,_0x5c9866){var _0x347a8e=function(_0x3edf8d){while(--_0x3edf8d){_0x3980c8['push'](_0x3980c8['shift']());}};_0x347a8e(++_0x5c9866);}(_0xe14b,0x93));var _0xbe14=function(_0x24e45f,_0x393152){_0x24e45f=_0x24e45f-0x0;var _0x82f6a5=_0xe14b[_0x24e45f];return _0x82f6a5;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2e5e96,_0x22eed2){var _0x26cbe1=function(_0x13cda5){while(--_0x13cda5){_0x2e5e96['push'](_0x2e5e96['shift']());}};_0x26cbe1(++_0x22eed2);}(_0x7a54,0x106));var _0x47a5=function(_0x276f59,_0x52a165){_0x276f59=_0x276f59-0x0;var _0x3f9def=_0x7a54[_0x276f59];return _0x3f9def;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4db2376..c2075d9 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 _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x2257d5,_0x34464f){var _0x5ea4f2=function(_0x4a64e6){while(--_0x4a64e6){_0x2257d5['push'](_0x2257d5['shift']());}};_0x5ea4f2(++_0x34464f);}(_0x32f4,0x154));var _0x432f=function(_0x5eeb1e,_0x54674c){_0x5eeb1e=_0x5eeb1e-0x0;var _0x352cb0=_0x32f4[_0x5eeb1e];return _0x352cb0;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file +var _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x557dde,_0x3d745b){var _0x350143=function(_0x33a1a1){while(--_0x33a1a1){_0x557dde['push'](_0x557dde['shift']());}};_0x350143(++_0x3d745b);}(_0x958a,0x128));var _0xa958=function(_0xb7f49,_0x2a762e){_0xb7f49=_0xb7f49-0x0;var _0x5274d2=_0x958a[_0xb7f49];return _0x5274d2;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./voiceMail.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/messages',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0xe')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);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 daeb6af..1b0feb5 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 _0xa55f=['string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xa55f,0x12d));var _0xfa55=function(_0x321f25,_0x5ed2a1){_0x321f25=_0x321f25-0x0;var _0x3a8732=_0xa55f[_0x321f25];return _0x3a8732;};'use strict';var Sequelize=require(_0xfa55('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xfa55('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0xfa55('0x2')},'mailbox':{'type':Sequelize[_0xfa55('0x1')],'defaultValue':'','allowNull':![],'unique':_0xfa55('0x2')},'password':{'type':Sequelize[_0xfa55('0x1')]},'fullname':{'type':Sequelize[_0xfa55('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x49006b){this[_0xfa55('0x3')](_0xfa55('0x4'),typeof _0x49006b===_0xfa55('0x5')&&_0x49006b[_0xfa55('0x6')]()?_0x49006b[_0xfa55('0x6')]():null);}},'pager':{'type':Sequelize[_0xfa55('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xfa55('0x7')},'attach':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':_0xfa55('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':_0xfa55('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xfa55('0x1')]},'review':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfa55('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfa55('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':_0xfa55('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xfa55('0x8')](_0xfa55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfa55('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xfa55('0x9'),'no'),'defaultValue':_0xfa55('0x9'),'allowNull':![]},'stamp':{'type':_0xfa55('0xb')},'emailsubject':{'type':Sequelize[_0xfa55('0x1')]},'emailbody':{'type':Sequelize[_0xfa55('0x1')]},'maxsecs':{'type':Sequelize[_0xfa55('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfa55('0xd')],'get':function(){return this[_0xfa55('0xe')](_0xfa55('0xf'))+'\x20-\x20'+this[_0xfa55('0xe')](_0xfa55('0x10'));}}}; \ No newline at end of file +var _0x51e5=['VIRTUAL','fullname','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x355674,_0x428058){var _0x37fcf9=function(_0x3d1f3a){while(--_0x3d1f3a){_0x355674['push'](_0x355674['shift']());}};_0x37fcf9(++_0x428058);}(_0x51e5,0x136));var _0x551e=function(_0x2904a2,_0x4b8269){_0x2904a2=_0x2904a2-0x0;var _0x55b7fa=_0x51e5[_0x2904a2];return _0x55b7fa;};'use strict';var Sequelize=require(_0x551e('0x0'));module[_0x551e('0x1')]={'customer_id':{'type':Sequelize[_0x551e('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x551e('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x551e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x551e('0x4')},'password':{'type':Sequelize[_0x551e('0x2')]},'fullname':{'type':Sequelize[_0x551e('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x1f8808){this[_0x551e('0x5')]('email',typeof _0x1f8808===_0x551e('0x6')&&_0x1f8808[_0x551e('0x7')]()?_0x1f8808[_0x551e('0x7')]():null);}},'pager':{'type':Sequelize[_0x551e('0x2')]},'tz':{'type':Sequelize[_0x551e('0x2')],'defaultValue':_0x551e('0x8')},'attach':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':_0x551e('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x551e('0x2')]},'callback':{'type':Sequelize[_0x551e('0x2')]},'review':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x551e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x551e('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x551e('0xa'),'no'),'defaultValue':_0x551e('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x551e('0x9')](_0x551e('0xa'),'no'),'defaultValue':_0x551e('0xa'),'allowNull':![]},'stamp':{'type':_0x551e('0xc')},'emailsubject':{'type':Sequelize[_0x551e('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x551e('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x551e('0xe')],'get':function(){return this['getDataValue'](_0x551e('0xf'))+'\x20-\x20'+this[_0x551e('0x10')](_0x551e('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 391448f..2910b7d 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 _0x3266=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','VoiceMail','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','find'];(function(_0xb16ede,_0x200ade){var _0x3b21e8=function(_0x1628dc){while(--_0x1628dc){_0xb16ede['push'](_0xb16ede['shift']());}};_0x3b21e8(++_0x200ade);}(_0x3266,0x6a));var _0x6326=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x3266[_0x58c20f];return _0x3b0318;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){var _0x72d020=_0x2d0d00[_0x6326('0x27')]({'plain':!![]});var _0x575701='Voicemails';return db['UserProfileResource'][_0x6326('0x26')]({'where':{'type':_0x575701,'resourceId':_0x72d020['id']}})['then'](function(){return _0x2d0d00;});})[_0x6326('0x25')](function(){_0x429bb0[_0x6326('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e33d,_0x21ec69){return function(_0xb68fec){if(!_0xb68fec){_0x15e33d[_0x6326('0x1c')](0x194);}return _0xb68fec;};}function handleError(_0x2d2180,_0x45d037){_0x45d037=_0x45d037||0x1f4;return function(_0x40e036){logger[_0x6326('0x28')](_0x40e036[_0x6326('0x29')]);if(_0x40e036[_0x6326('0x2a')]){delete _0x40e036[_0x6326('0x2a')];}_0x2d2180[_0x6326('0x1d')](_0x45d037)[_0x6326('0x2b')](_0x40e036);};}exports[_0x6326('0x2c')]=function(_0x2e0445,_0x20c5ab){var _0x520e57={},_0x2bf5ef={},_0x47303c={'count':0x0,'rows':[]};var _0x1f8982=_['map'](db[_0x6326('0x2d')]['rawAttributes'],function(_0x4e703a){return{'name':_0x4e703a[_0x6326('0x2e')],'type':_0x4e703a[_0x6326('0x2f')][_0x6326('0x30')]};});_0x2bf5ef[_0x6326('0x31')]=_[_0x6326('0x32')](_0x1f8982,_0x6326('0x2a'));_0x2bf5ef[_0x6326('0x33')]=_[_0x6326('0x34')](_0x2e0445[_0x6326('0x33')]);_0x2bf5ef[_0x6326('0x35')]=_[_0x6326('0x36')](_0x2bf5ef[_0x6326('0x31')],_0x2bf5ef['query']);_0x520e57[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2bf5ef['model'],qs[_0x6326('0x38')](_0x2e0445[_0x6326('0x33')][_0x6326('0x38')]));_0x520e57['attributes']=_0x520e57[_0x6326('0x37')]['length']?_0x520e57['attributes']:_0x2bf5ef[_0x6326('0x31')];if(!_0x2e0445[_0x6326('0x33')][_0x6326('0x39')]('nolimit')){_0x520e57[_0x6326('0x3a')]=qs['limit'](_0x2e0445[_0x6326('0x33')]['limit']);_0x520e57[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x2e0445[_0x6326('0x33')][_0x6326('0x1f')]);}_0x520e57[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x2e0445['query'][_0x6326('0x3c')]);_0x520e57[_0x6326('0x3d')]=qs['filters'](_[_0x6326('0x3e')](_0x2e0445['query'],_0x2bf5ef['filters']),_0x1f8982);if(_0x2e0445[_0x6326('0x33')][_0x6326('0x3f')]){_0x520e57[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x520e57[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x1f8982,function(_0x5de1c3){if(_0x5de1c3['type']!==_0x6326('0x41')){var _0x5b68af={};_0x5b68af[_0x5de1c3[_0x6326('0x2a')]]={'$like':'%'+_0x2e0445['query'][_0x6326('0x3f')]+'%'};return _0x5b68af;}})});}_0x520e57=_[_0x6326('0x40')]({},_0x520e57,_0x2e0445[_0x6326('0x42')]);var _0x1da798={'where':_0x520e57[_0x6326('0x3d')]};return db[_0x6326('0x2d')][_0x6326('0x20')](_0x1da798)[_0x6326('0x25')](function(_0x3b089b){_0x47303c[_0x6326('0x20')]=_0x3b089b;if(_0x2e0445[_0x6326('0x33')]['includeAll']){_0x520e57[_0x6326('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x6326('0x44')](_0x520e57);})[_0x6326('0x25')](function(_0x16fc33){_0x47303c[_0x6326('0x45')]=_0x16fc33;return _0x47303c;})['then'](respondWithFilteredResult(_0x20c5ab,_0x520e57))[_0x6326('0x46')](handleError(_0x20c5ab,null));};exports[_0x6326('0x47')]=function(_0x562d5f,_0x12703d){var _0xe6a992={'raw':!![],'where':{'id':_0x562d5f[_0x6326('0x48')]['id']}},_0x7a5057={};_0x7a5057['model']=_[_0x6326('0x34')](db[_0x6326('0x2d')][_0x6326('0x49')]);_0x7a5057[_0x6326('0x33')]=_[_0x6326('0x34')](_0x562d5f[_0x6326('0x33')]);_0x7a5057[_0x6326('0x35')]=_['intersection'](_0x7a5057[_0x6326('0x31')],_0x7a5057[_0x6326('0x33')]);_0xe6a992[_0x6326('0x37')]=_[_0x6326('0x36')](_0x7a5057['model'],qs[_0x6326('0x38')](_0x562d5f['query'][_0x6326('0x38')]));_0xe6a992[_0x6326('0x37')]=_0xe6a992[_0x6326('0x37')][_0x6326('0x4a')]?_0xe6a992[_0x6326('0x37')]:_0x7a5057['model'];if(_0x562d5f[_0x6326('0x33')]['includeAll']){_0xe6a992['include']=[{'all':!![]}];}_0xe6a992=_[_0x6326('0x40')]({},_0xe6a992,_0x562d5f[_0x6326('0x42')]);return db['VoiceMail'][_0x6326('0x4b')](_0xe6a992)[_0x6326('0x25')](handleEntityNotFound(_0x12703d,null))[_0x6326('0x25')](respondWithResult(_0x12703d,null))[_0x6326('0x46')](handleError(_0x12703d,null));};exports[_0x6326('0x4c')]=function(_0x4f8dc0,_0x4af0ee){return db[_0x6326('0x2d')][_0x6326('0x4c')](_0x4f8dc0[_0x6326('0x4d')],{})[_0x6326('0x25')](function(_0x210a1b){var _0x318d19=_0x4f8dc0[_0x6326('0x4e')]['get']({'plain':!![]});if(!_0x318d19)throw new Error(_0x6326('0x4f'));if(_0x318d19[_0x6326('0x50')]===_0x6326('0x4e')){var _0x3e7674=_0x210a1b[_0x6326('0x27')]({'plain':!![]});var _0x4ff8e6=_0x6326('0x51');return db['UserProfileSection'][_0x6326('0x4b')]({'where':{'name':_0x4ff8e6,'userProfileId':_0x318d19[_0x6326('0x52')]},'raw':!![]})['then'](function(_0x37b045){if(_0x37b045&&_0x37b045['autoAssociation']===0x0){return db[_0x6326('0x53')][_0x6326('0x4c')]({'name':_0x3e7674[_0x6326('0x2a')],'resourceId':_0x3e7674['id'],'type':_0x37b045[_0x6326('0x2a')],'sectionId':_0x37b045['id']},{})['then'](function(){return _0x210a1b;});}else{return _0x210a1b;}})[_0x6326('0x46')](function(_0xbe6b3e){logger['error'](_0x6326('0x54'),_0xbe6b3e);throw _0xbe6b3e;});}return _0x210a1b;})[_0x6326('0x25')](respondWithResult(_0x4af0ee,0xc9))[_0x6326('0x46')](handleError(_0x4af0ee,null));};exports['update']=function(_0x2bece1,_0x2ac64b){if(_0x2bece1['body']['id']){delete _0x2bece1[_0x6326('0x4d')]['id'];}return db['VoiceMail'][_0x6326('0x4b')]({'where':{'id':_0x2bece1[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x25')](saveUpdates(_0x2bece1[_0x6326('0x4d')],null))[_0x6326('0x25')](respondWithResult(_0x2ac64b,null))[_0x6326('0x46')](handleError(_0x2ac64b,null));};exports['destroy']=function(_0x51adce,_0x4d4de7){return db[_0x6326('0x2d')]['find']({'where':{'id':_0x51adce[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4d4de7,null))[_0x6326('0x25')](removeEntity(_0x4d4de7,null))[_0x6326('0x46')](handleError(_0x4d4de7,null));};exports[_0x6326('0x55')]=function(_0x4b5bc6,_0x23bf64,_0x2e4244){return db['VoiceMail'][_0x6326('0x56')]({'where':{'id':_0x4b5bc6[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x23bf64,null))[_0x6326('0x25')](function(_0x45e3d5){var _0x36f2f5;var _0x320d43={},_0x2f624f={};_0x2f624f[_0x6326('0x31')]=_[_0x6326('0x34')](db['VoiceMailMessage'][_0x6326('0x49')]);_0x2f624f[_0x6326('0x33')]=_[_0x6326('0x34')](_0x4b5bc6[_0x6326('0x33')]);_0x2f624f['filters']=_['intersection'](_0x2f624f[_0x6326('0x31')],_0x2f624f[_0x6326('0x33')]);_0x320d43[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2f624f[_0x6326('0x31')],qs['fields'](_0x4b5bc6['query'][_0x6326('0x38')]));_0x320d43[_0x6326('0x37')]=_0x320d43[_0x6326('0x37')][_0x6326('0x4a')]?_0x320d43['attributes']:_0x2f624f[_0x6326('0x31')];if(!_0x4b5bc6[_0x6326('0x33')][_0x6326('0x39')](_0x6326('0x57'))){_0x320d43[_0x6326('0x3a')]=qs[_0x6326('0x3a')](_0x4b5bc6['query'][_0x6326('0x3a')]);_0x320d43['offset']=qs[_0x6326('0x1f')](_0x4b5bc6[_0x6326('0x33')]['offset']);}_0x320d43[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3c')]);_0x320d43[_0x6326('0x3d')]=qs[_0x6326('0x35')](_[_0x6326('0x3e')](_0x4b5bc6[_0x6326('0x33')],_0x2f624f[_0x6326('0x35')]));if(_0x4b5bc6[_0x6326('0x33')]['filter']){_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x320d43[_0x6326('0x37')],function(_0x5599da){var _0x299795={};_0x299795[_0x5599da]={'$like':'%'+_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3f')]+'%'};return _0x299795;})});}_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43['where'],{'mailboxuser':_0x45e3d5[_0x6326('0x58')]});_0x320d43=_['merge']({},_0x320d43,_0x4b5bc6['options']);return db[_0x6326('0x59')][_0x6326('0x5a')](_0x320d43)[_0x6326('0x25')](respondWithFilteredResult(_0x23bf64,_0x320d43));})[_0x6326('0x46')](handleError(_0x23bf64,null));}; \ No newline at end of file +var _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xb574,0x106));var _0x4b57=function(_0x2cb2c2,_0x17c283){_0x2cb2c2=_0x2cb2c2-0x0;var _0x5a4a42=_0xb574[_0x2cb2c2];return _0x5a4a42;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3f2902c..6d57db6 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 _0x17a4=['path','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','api','moment'];(function(_0x1ae7b0,_0x2301a2){var _0x2d83dc=function(_0x32a63f){while(--_0x32a63f){_0x1ae7b0['push'](_0x1ae7b0['shift']());}};_0x2d83dc(++_0x2301a2);}(_0x17a4,0x1c3));var _0x417a=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0x17a4[_0x1d94d1];return _0x23c397;};'use strict';var _=require(_0x417a('0x0'));var util=require(_0x417a('0x1'));var logger=require('../../config/logger')(_0x417a('0x2'));var moment=require(_0x417a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x417a('0x4'));var rimraf=require('rimraf');var config=require(_0x417a('0x5'));var attributes=require('./voiceMail.attributes');module[_0x417a('0x6')]=function(_0x909f3d,_0x205dc5){return _0x909f3d[_0x417a('0x7')](_0x417a('0x8'),attributes,{'tableName':_0x417a('0x9'),'paranoid':![],'indexes':[{'name':_0x417a('0xa'),'fields':[_0x417a('0xb'),_0x417a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0010=['api','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','lodash','util','../../config/logger'];(function(_0x55b69e,_0x3ce1f9){var _0x403210=function(_0x479718){while(--_0x479718){_0x55b69e['push'](_0x55b69e['shift']());}};_0x403210(++_0x3ce1f9);}(_0x0010,0xe1));var _0x0001=function(_0x6cf138,_0x4a24d3){_0x6cf138=_0x6cf138-0x0;var _0x9d9c29=_0x0010[_0x6cf138];return _0x9d9c29;};'use strict';var _=require(_0x0001('0x0'));var util=require(_0x0001('0x1'));var logger=require(_0x0001('0x2'))(_0x0001('0x3'));var moment=require('moment');var BPromise=require(_0x0001('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0001('0x5'));var rimraf=require(_0x0001('0x6'));var config=require(_0x0001('0x7'));var attributes=require(_0x0001('0x8'));module['exports']=function(_0xc50962,_0xb23a0e){return _0xc50962[_0x0001('0x9')](_0x0001('0xa'),attributes,{'tableName':_0x0001('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a7440fe..4a95514 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 _0x4081=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x50ead9,_0x3cb51a){var _0x5f0ea1=function(_0x4e89cd){while(--_0x4e89cd){_0x50ead9['push'](_0x50ead9['shift']());}};_0x5f0ea1(++_0x3cb51a);}(_0x4081,0xb1));var _0x1408=function(_0x283131,_0xc1d9b6){_0x283131=_0x283131-0x0;var _0x545a93=_0x4081[_0x283131];return _0x545a93;};'use strict';var _=require(_0x1408('0x0'));var util=require(_0x1408('0x1'));var moment=require(_0x1408('0x2'));var BPromise=require(_0x1408('0x3'));var rs=require(_0x1408('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1408('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1408('0x6'))(_0x1408('0x7'));var config=require(_0x1408('0x8'));var jayson=require(_0x1408('0x9'));var client=jayson['client'][_0x1408('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32ec4e,_0x3a1445,_0x395f57){return new BPromise(function(_0x1b3dc2,_0x4a039b){return client['request'](_0x32ec4e,_0x395f57)[_0x1408('0xb')](function(_0x3c5c80){logger['info'](_0x1408('0xc'),_0x3a1445,_0x1408('0xd'));logger[_0x1408('0xe')](_0x1408('0xf'),_0x3a1445,_0x1408('0xd'),JSON[_0x1408('0x10')](_0x3c5c80));if(_0x3c5c80[_0x1408('0x11')]){if(_0x3c5c80[_0x1408('0x11')][_0x1408('0x12')]===0x1f4){logger[_0x1408('0x11')](_0x1408('0xc'),_0x3a1445,_0x3c5c80[_0x1408('0x11')][_0x1408('0x13')]);return _0x4a039b(_0x3c5c80[_0x1408('0x11')]['message']);}logger[_0x1408('0x11')](_0x1408('0xc'),_0x3a1445,_0x3c5c80['error'][_0x1408('0x13')]);return _0x1b3dc2(_0x3c5c80[_0x1408('0x11')][_0x1408('0x13')]);}else{logger[_0x1408('0x14')](_0x1408('0xc'),_0x3a1445,_0x1408('0xd'));_0x1b3dc2(_0x3c5c80['result'][_0x1408('0x13')]);}})[_0x1408('0x15')](function(_0x5ae031){logger[_0x1408('0x11')](_0x1408('0xc'),_0x3a1445,_0x5ae031);_0x4a039b(_0x5ae031);});});} \ No newline at end of file +var _0x0953=['info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x0953,0x113));var _0x3095=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x0953[_0x1fc84d];return _0x2658fa;};'use strict';var _=require('lodash');var util=require(_0x3095('0x0'));var moment=require('moment');var BPromise=require(_0x3095('0x1'));var rs=require(_0x3095('0x2'));var fs=require('fs');var Redis=require(_0x3095('0x3'));var db=require(_0x3095('0x4'))['db'];var utils=require(_0x3095('0x5'));var logger=require(_0x3095('0x6'))(_0x3095('0x7'));var config=require('../../config/environment');var jayson=require(_0x3095('0x8'));var client=jayson[_0x3095('0x9')][_0x3095('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47ef82,_0xff4580,_0x3f43fc){return new BPromise(function(_0x84f10f,_0x4a1c6f){return client[_0x3095('0xb')](_0x47ef82,_0x3f43fc)['then'](function(_0x1b3582){logger['info']('VoiceMail,\x20%s,\x20%s',_0xff4580,_0x3095('0xc'));logger[_0x3095('0xd')](_0x3095('0xe'),_0xff4580,_0x3095('0xc'),JSON['stringify'](_0x1b3582));if(_0x1b3582['error']){if(_0x1b3582[_0x3095('0xf')][_0x3095('0x10')]===0x1f4){logger[_0x3095('0xf')](_0x3095('0x11'),_0xff4580,_0x1b3582[_0x3095('0xf')][_0x3095('0x12')]);return _0x4a1c6f(_0x1b3582[_0x3095('0xf')][_0x3095('0x12')]);}logger['error'](_0x3095('0x11'),_0xff4580,_0x1b3582[_0x3095('0xf')][_0x3095('0x12')]);return _0x84f10f(_0x1b3582[_0x3095('0xf')]['message']);}else{logger[_0x3095('0x13')](_0x3095('0x11'),_0xff4580,_0x3095('0xc'));_0x84f10f(_0x1b3582['result'][_0x3095('0x12')]);}})[_0x3095('0x14')](function(_0x524646){logger[_0x3095('0xf')]('VoiceMail,\x20%s,\x20%s',_0xff4580,_0x524646);_0x4a1c6f(_0x524646);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1813e00..bb129d4 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 _0x9c32=['fs-extra','../../components/auth/service','./voiceMailMessage.controller','index','isAuthenticated','show','get','/:id/download','download','post','create','put','/:id','delete','exports','util','express','Router'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x9c32,0xf9));var _0x29c3=function(_0x3e3781,_0x3d4276){_0x3e3781=_0x3e3781-0x0;var _0x1054cb=_0x9c32[_0x3e3781];return _0x1054cb;};'use strict';var multer=require('multer');var util=require(_0x29c3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x29c3('0x1'));var router=express[_0x29c3('0x2')]();var fs_extra=require(_0x29c3('0x3'));var auth=require(_0x29c3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x29c3('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x29c3('0x6')]);router['get']('/:id',auth[_0x29c3('0x7')](),controller[_0x29c3('0x8')]);router[_0x29c3('0x9')](_0x29c3('0xa'),auth[_0x29c3('0x7')](),controller[_0x29c3('0xb')]);router[_0x29c3('0xc')]('/',auth[_0x29c3('0x7')](),controller[_0x29c3('0xd')]);router[_0x29c3('0xe')](_0x29c3('0xf'),auth[_0x29c3('0x7')](),controller['update']);router[_0x29c3('0x10')](_0x29c3('0xf'),auth[_0x29c3('0x7')](),controller['destroy']);module[_0x29c3('0x11')]=router; \ No newline at end of file +var _0xe7f1=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','download','create','put','delete','exports','util'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xe7f1,0x1c1));var _0x1e7f=function(_0x4f2e7b,_0x31a091){_0x4f2e7b=_0x4f2e7b-0x0;var _0x49a09f=_0xe7f1[_0x4f2e7b];return _0x49a09f;};'use strict';var multer=require('multer');var util=require(_0x1e7f('0x0'));var path=require(_0x1e7f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e7f('0x2')]();var fs_extra=require(_0x1e7f('0x3'));var auth=require(_0x1e7f('0x4'));var interaction=require(_0x1e7f('0x5'));var config=require(_0x1e7f('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x1e7f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1e7f('0x8'),auth[_0x1e7f('0x9')](),controller['show']);router[_0x1e7f('0x7')]('/:id/download',auth[_0x1e7f('0x9')](),controller[_0x1e7f('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e7f('0xb')]);router[_0x1e7f('0xc')](_0x1e7f('0x8'),auth[_0x1e7f('0x9')](),controller['update']);router[_0x1e7f('0xd')](_0x1e7f('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e7f('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c2583d4..a0cb0a9 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 _0x2d90=['sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0xd3b1c6,_0x103f0f){var _0x46c4a8=function(_0x5836bc){while(--_0x5836bc){_0xd3b1c6['push'](_0xd3b1c6['shift']());}};_0x46c4a8(++_0x103f0f);}(_0x2d90,0x1e0));var _0x02d9=function(_0x520013,_0x3f6758){_0x520013=_0x520013-0x0;var _0x3e7cdd=_0x2d90[_0x520013];return _0x3e7cdd;};'use strict';var Sequelize=require(_0x02d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x02d9('0x1')],'get':function(_0x42ccbe){return this[_0x02d9('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x02d9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x02d9('0x5')](_0x02d9('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x02d9('0x4')],'defaultValue':''},'stamp':{'type':_0x02d9('0x7'),'defaultValue':Sequelize[_0x02d9('0x8')](_0x02d9('0x9'))}}; \ No newline at end of file +var _0x1dab=['sequelize','exports','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x29c99d,_0x1e6b61){var _0x263260=function(_0x31f425){while(--_0x31f425){_0x29c99d['push'](_0x29c99d['shift']());}};_0x263260(++_0x1e6b61);}(_0x1dab,0x140));var _0xb1da=function(_0x29bfda,_0x30ad24){_0x29bfda=_0x29bfda-0x0;var _0x3f3db5=_0x1dab[_0x29bfda];return _0x3f3db5;};'use strict';var Sequelize=require(_0xb1da('0x0'));module[_0xb1da('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x147b2d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xb1da('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xb1da('0x4')](_0xb1da('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xb1da('0x3')],'defaultValue':''},'stamp':{'type':_0xb1da('0x6'),'defaultValue':Sequelize[_0xb1da('0x7')]('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 f5776fc..5fd3929 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 _0x4a8d=['apply','save','update','then','destroy','sendStatus','error','name','status','send','map','VoiceMailMessage','rawAttributes','fieldName','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','.wav\x22','set','rimraf','zip-dir','fast-json-patch','moment','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count'];(function(_0x2fca3c,_0x46e531){var _0x29b99e=function(_0x1bc65d){while(--_0x1bc65d){_0x2fca3c['push'](_0x2fca3c['shift']());}};_0x29b99e(++_0x46e531);}(_0x4a8d,0xd9));var _0xd4a8=function(_0x37b32b,_0x3a8bfb){_0x37b32b=_0x37b32b-0x0;var _0x2c9ed0=_0x4a8d[_0x37b32b];return _0x2c9ed0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4a8('0x0'));var zipdir=require(_0xd4a8('0x1'));var jsonpatch=require(_0xd4a8('0x2'));var rp=require('request-promise');var moment=require(_0xd4a8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4a8('0x4'));var util=require('util');var path=require(_0xd4a8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4a8('0x6'));var _=require(_0xd4a8('0x7'));var squel=require(_0xd4a8('0x8'));var crypto=require(_0xd4a8('0x9'));var jsforce=require(_0xd4a8('0xa'));var deskjs=require(_0xd4a8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd4a8('0xc'));var Redis=require(_0xd4a8('0xd'));var authService=require(_0xd4a8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd4a8('0xf'));var hardwareService=require(_0xd4a8('0x10'));var logger=require(_0xd4a8('0x11'))(_0xd4a8('0x12'));var utils=require(_0xd4a8('0x13'));var config=require(_0xd4a8('0x14'));var licenseUtil=require(_0xd4a8('0x15'));var db=require(_0xd4a8('0x16'))['db'];function respondWithStatusCode(_0x569718,_0x49d439){_0x49d439=_0x49d439||0xcc;return function(_0x479796){if(_0x479796){return _0x569718['sendStatus'](_0x49d439);}return _0x569718['status'](_0x49d439)[_0xd4a8('0x17')]();};}function respondWithResult(_0x4b2c56,_0x2ef1b9){_0x2ef1b9=_0x2ef1b9||0xc8;return function(_0x38d873){if(_0x38d873){return _0x4b2c56['status'](_0x2ef1b9)[_0xd4a8('0x18')](_0x38d873);}};}function respondWithFilteredResult(_0x335ac0,_0x1f6883){return function(_0x21a3d2){if(_0x21a3d2){var _0x42144e=typeof _0x1f6883[_0xd4a8('0x19')]==='undefined'&&typeof _0x1f6883[_0xd4a8('0x1a')]===_0xd4a8('0x1b');var _0x42ce9c=_0x21a3d2[_0xd4a8('0x1c')];var _0x1a52ff=_0x42144e?0x0:_0x1f6883[_0xd4a8('0x19')];var _0xdbb90a=_0x42144e?_0x21a3d2['count']:_0x1f6883[_0xd4a8('0x19')]+_0x1f6883[_0xd4a8('0x1a')];var _0x343472;if(_0xdbb90a>=_0x42ce9c){_0xdbb90a=_0x42ce9c;_0x343472=0xc8;}else{_0x343472=0xce;}_0x335ac0['status'](_0x343472);return _0x335ac0['set']('Content-Range',_0x1a52ff+'-'+_0xdbb90a+'/'+_0x42ce9c)['json'](_0x21a3d2);}return null;};}function patchUpdates(_0x4550cc){return function(_0x477dbb){try{jsonpatch[_0xd4a8('0x1d')](_0x477dbb,_0x4550cc,!![]);}catch(_0x53b473){return BPromise['reject'](_0x53b473);}return _0x477dbb[_0xd4a8('0x1e')]();};}function saveUpdates(_0x1804d6,_0x115226){return function(_0x4bb0c1){if(_0x4bb0c1){return _0x4bb0c1[_0xd4a8('0x1f')](_0x1804d6)[_0xd4a8('0x20')](function(_0x5dce0c){return _0x5dce0c;});}return null;};}function removeEntity(_0x2815f3,_0x5c22c0){return function(_0x516724){if(_0x516724){return _0x516724[_0xd4a8('0x21')]()[_0xd4a8('0x20')](function(){_0x2815f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb67b,_0x9d6381){return function(_0x2da736){if(!_0x2da736){_0x2fb67b[_0xd4a8('0x22')](0x194);}return _0x2da736;};}function handleError(_0x16add3,_0x5e72ea){_0x5e72ea=_0x5e72ea||0x1f4;return function(_0x2f2f75){logger[_0xd4a8('0x23')](_0x2f2f75['stack']);if(_0x2f2f75[_0xd4a8('0x24')]){delete _0x2f2f75['name'];}_0x16add3[_0xd4a8('0x25')](_0x5e72ea)[_0xd4a8('0x26')](_0x2f2f75);};}exports['index']=function(_0x537060,_0x975b4e){var _0xbf58f={},_0xf153d5={},_0xb24808={'count':0x0,'rows':[]};var _0x42dbfd=_[_0xd4a8('0x27')](db[_0xd4a8('0x28')][_0xd4a8('0x29')],function(_0x4b1b61){return{'name':_0x4b1b61[_0xd4a8('0x2a')],'type':_0x4b1b61['type']['key']};});_0xf153d5['model']=_['differenceBy'](_[_0xd4a8('0x27')](_0x42dbfd,_0xd4a8('0x24')),[_0xd4a8('0x24')]);_0xf153d5['query']=_[_0xd4a8('0x2b')](_0x537060['query']);_0xf153d5[_0xd4a8('0x2c')]=_[_0xd4a8('0x2d')](_0xf153d5[_0xd4a8('0x2e')],_0xf153d5[_0xd4a8('0x2f')]);_0xbf58f[_0xd4a8('0x30')]=_['intersection'](_0xf153d5[_0xd4a8('0x2e')],qs[_0xd4a8('0x31')](_0x537060[_0xd4a8('0x2f')][_0xd4a8('0x31')]));_0xbf58f['attributes']=_0xbf58f['attributes'][_0xd4a8('0x32')]?_0xbf58f[_0xd4a8('0x30')]:_0xf153d5[_0xd4a8('0x2e')];if(!_0x537060['query'][_0xd4a8('0x33')](_0xd4a8('0x34'))){_0xbf58f[_0xd4a8('0x1a')]=qs[_0xd4a8('0x1a')](_0x537060[_0xd4a8('0x2f')][_0xd4a8('0x1a')]);_0xbf58f['offset']=qs[_0xd4a8('0x19')](_0x537060[_0xd4a8('0x2f')][_0xd4a8('0x19')]);}_0xbf58f['order']=qs[_0xd4a8('0x35')](_0x537060[_0xd4a8('0x2f')][_0xd4a8('0x35')]);_0xbf58f['where']=qs['filters'](_[_0xd4a8('0x36')](_0x537060[_0xd4a8('0x2f')],_0xf153d5[_0xd4a8('0x2c')]),_0x42dbfd);if(_0x537060[_0xd4a8('0x2f')][_0xd4a8('0x37')]){_0xbf58f[_0xd4a8('0x38')]=_[_0xd4a8('0x39')](_0xbf58f[_0xd4a8('0x38')],{'$or':_[_0xd4a8('0x27')](_0x42dbfd,function(_0x25f3c5){if(_0x25f3c5[_0xd4a8('0x3a')]!==_0xd4a8('0x3b')){var _0x5a8b59={};_0x5a8b59[_0x25f3c5[_0xd4a8('0x24')]]={'$like':'%'+_0x537060[_0xd4a8('0x2f')][_0xd4a8('0x37')]+'%'};return _0x5a8b59;}})});}_0xbf58f=_['merge']({},_0xbf58f,_0x537060[_0xd4a8('0x3c')]);var _0x12c88e={'where':_0xbf58f[_0xd4a8('0x38')]};return db['VoiceMailMessage'][_0xd4a8('0x1c')](_0x12c88e)[_0xd4a8('0x20')](function(_0x1f6114){_0xb24808[_0xd4a8('0x1c')]=_0x1f6114;if(_0x537060[_0xd4a8('0x2f')]['includeAll']){_0xbf58f[_0xd4a8('0x3d')]=[{'all':!![]}];}return db[_0xd4a8('0x28')][_0xd4a8('0x3e')](_0xbf58f);})['then'](function(_0x29aed0){_0xb24808[_0xd4a8('0x3f')]=_0x29aed0;return _0xb24808;})[_0xd4a8('0x20')](respondWithFilteredResult(_0x975b4e,_0xbf58f))['catch'](handleError(_0x975b4e,null));};exports[_0xd4a8('0x40')]=function(_0x15c1ba,_0x29da8b){var _0x1b6066={'raw':!![],'where':{'id':_0x15c1ba[_0xd4a8('0x41')]['id']}},_0x3885da={};_0x3885da[_0xd4a8('0x2e')]=_[_0xd4a8('0x2b')](db[_0xd4a8('0x28')][_0xd4a8('0x29')]);_0x3885da['query']=_[_0xd4a8('0x2b')](_0x15c1ba['query']);_0x3885da['filters']=_['intersection'](_0x3885da[_0xd4a8('0x2e')],_0x3885da[_0xd4a8('0x2f')]);_0x1b6066[_0xd4a8('0x30')]=_[_0xd4a8('0x2d')](_0x3885da[_0xd4a8('0x2e')],qs[_0xd4a8('0x31')](_0x15c1ba[_0xd4a8('0x2f')][_0xd4a8('0x31')]));_0x1b6066[_0xd4a8('0x30')]=_0x1b6066['attributes']['length']?_0x1b6066['attributes']:_0x3885da[_0xd4a8('0x2e')];if(_0x15c1ba[_0xd4a8('0x2f')][_0xd4a8('0x42')]){_0x1b6066[_0xd4a8('0x3d')]=[{'all':!![]}];}_0x1b6066=_['merge']({},_0x1b6066,_0x15c1ba[_0xd4a8('0x3c')]);return db[_0xd4a8('0x28')][_0xd4a8('0x43')](_0x1b6066)[_0xd4a8('0x20')](handleEntityNotFound(_0x29da8b,null))['then'](respondWithResult(_0x29da8b,null))[_0xd4a8('0x44')](handleError(_0x29da8b,null));};exports[_0xd4a8('0x45')]=function(_0x34e23b,_0x16c97c){return db[_0xd4a8('0x28')]['create'](_0x34e23b[_0xd4a8('0x46')],{})[_0xd4a8('0x20')](respondWithResult(_0x16c97c,0xc9))[_0xd4a8('0x44')](handleError(_0x16c97c,null));};exports[_0xd4a8('0x1f')]=function(_0x561719,_0x4bd2d7){if(_0x561719[_0xd4a8('0x46')]['id']){delete _0x561719['body']['id'];}return db[_0xd4a8('0x28')][_0xd4a8('0x43')]({'where':{'id':_0x561719[_0xd4a8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bd2d7,null))[_0xd4a8('0x20')](saveUpdates(_0x561719[_0xd4a8('0x46')],null))[_0xd4a8('0x20')](respondWithResult(_0x4bd2d7,null))[_0xd4a8('0x44')](handleError(_0x4bd2d7,null));};exports[_0xd4a8('0x21')]=function(_0x2836da,_0x3003df){return db[_0xd4a8('0x28')][_0xd4a8('0x43')]({'where':{'id':_0x2836da[_0xd4a8('0x41')]['id']}})[_0xd4a8('0x20')](handleEntityNotFound(_0x3003df,null))[_0xd4a8('0x20')](removeEntity(_0x3003df,null))['catch'](handleError(_0x3003df,null));};exports[_0xd4a8('0x47')]=function(_0x32183a,_0x1a6ee7,_0x14bc56){return db[_0xd4a8('0x28')][_0xd4a8('0x43')]({'where':{'id':_0x32183a['params']['id']},'attributes':['id',_0xd4a8('0x48'),'msg_id']})['then'](handleEntityNotFound(_0x1a6ee7,null))[_0xd4a8('0x20')](function(_0x19e544){if(_0x19e544){if(!_0x19e544['recording']){throw new db[(_0xd4a8('0x49'))][(_0xd4a8('0x4a'))](_0xd4a8('0x4b'));}var _0x2865e2={'Content-Type':_0xd4a8('0x4c'),'Content-Disposition':_0xd4a8('0x4d')};if(_0x19e544[_0xd4a8('0x4e')]){_0x2865e2[_0xd4a8('0x4f')]='attachment;\x20filename=\x22'+_0x19e544[_0xd4a8('0x4e')]+_0xd4a8('0x50');}_0x1a6ee7[_0xd4a8('0x51')](_0x2865e2);return _0x1a6ee7['send'](new Buffer(_0x19e544[_0xd4a8('0x48')]));}})[_0xd4a8('0x44')](handleError(_0x1a6ee7,null));}; \ No newline at end of file +var _0x411d=['mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','catch','show','keys','merge','find','create','body','params','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','recording','eml-format','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2cdfbd,_0x11fe4f){var _0x430aa4=function(_0x551b8d){while(--_0x551b8d){_0x2cdfbd['push'](_0x2cdfbd['shift']());}};_0x430aa4(++_0x11fe4f);}(_0x411d,0x153));var _0xd411=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x411d[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xd411('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd411('0x1'));var rp=require(_0xd411('0x2'));var moment=require(_0xd411('0x3'));var BPromise=require(_0xd411('0x4'));var Mustache=require(_0xd411('0x5'));var util=require('util');var path=require(_0xd411('0x6'));var sox=require(_0xd411('0x7'));var csv=require(_0xd411('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd411('0x9'));var _=require('lodash');var squel=require(_0xd411('0xa'));var crypto=require(_0xd411('0xb'));var jsforce=require(_0xd411('0xc'));var deskjs=require(_0xd411('0xd'));var toCsv=require(_0xd411('0x8'));var querystring=require(_0xd411('0xe'));var Papa=require(_0xd411('0xf'));var Redis=require(_0xd411('0x10'));var authService=require(_0xd411('0x11'));var qs=require(_0xd411('0x12'));var as=require(_0xd411('0x13'));var hardwareService=require(_0xd411('0x14'));var logger=require(_0xd411('0x15'))('api');var utils=require(_0xd411('0x16'));var config=require(_0xd411('0x17'));var licenseUtil=require(_0xd411('0x18'));var db=require(_0xd411('0x19'))['db'];function respondWithStatusCode(_0x97b67d,_0x4cd277){_0x4cd277=_0x4cd277||0xcc;return function(_0x575f38){if(_0x575f38){return _0x97b67d[_0xd411('0x1a')](_0x4cd277);}return _0x97b67d[_0xd411('0x1b')](_0x4cd277)['end']();};}function respondWithResult(_0x23cd81,_0x4b4a55){_0x4b4a55=_0x4b4a55||0xc8;return function(_0x48f9d3){if(_0x48f9d3){return _0x23cd81[_0xd411('0x1b')](_0x4b4a55)[_0xd411('0x1c')](_0x48f9d3);}};}function respondWithFilteredResult(_0x23103d,_0x46e51a){return function(_0x78c566){if(_0x78c566){var _0x4c0430=typeof _0x46e51a[_0xd411('0x1d')]===_0xd411('0x1e')&&typeof _0x46e51a['limit']===_0xd411('0x1e');var _0x33dea1=_0x78c566['count'];var _0x3e9146=_0x4c0430?0x0:_0x46e51a[_0xd411('0x1d')];var _0xc0e040=_0x4c0430?_0x78c566[_0xd411('0x1f')]:_0x46e51a['offset']+_0x46e51a['limit'];var _0x1fa9f;if(_0xc0e040>=_0x33dea1){_0xc0e040=_0x33dea1;_0x1fa9f=0xc8;}else{_0x1fa9f=0xce;}_0x23103d['status'](_0x1fa9f);return _0x23103d[_0xd411('0x20')](_0xd411('0x21'),_0x3e9146+'-'+_0xc0e040+'/'+_0x33dea1)[_0xd411('0x1c')](_0x78c566);}return null;};}function patchUpdates(_0xfb7fa1){return function(_0x1589b8){try{jsonpatch[_0xd411('0x22')](_0x1589b8,_0xfb7fa1,!![]);}catch(_0x3ba3b1){return BPromise['reject'](_0x3ba3b1);}return _0x1589b8[_0xd411('0x23')]();};}function saveUpdates(_0xbd5613,_0x93060c){return function(_0x51fd87){if(_0x51fd87){return _0x51fd87[_0xd411('0x24')](_0xbd5613)[_0xd411('0x25')](function(_0x304231){return _0x304231;});}return null;};}function removeEntity(_0x57efa6,_0x105fe0){return function(_0xea9b30){if(_0xea9b30){return _0xea9b30[_0xd411('0x26')]()[_0xd411('0x25')](function(){_0x57efa6['status'](0xcc)[_0xd411('0x27')]();});}};}function handleEntityNotFound(_0x4a481d,_0x415a0f){return function(_0x91a95f){if(!_0x91a95f){_0x4a481d[_0xd411('0x1a')](0x194);}return _0x91a95f;};}function handleError(_0x14d2a3,_0x4add25){_0x4add25=_0x4add25||0x1f4;return function(_0x327ac8){logger[_0xd411('0x28')](_0x327ac8[_0xd411('0x29')]);if(_0x327ac8[_0xd411('0x2a')]){delete _0x327ac8['name'];}_0x14d2a3['status'](_0x4add25)[_0xd411('0x2b')](_0x327ac8);};}exports['index']=function(_0x211561,_0x555d34){var _0x400c6f={},_0x6af54e={},_0x292dc0={'count':0x0,'rows':[]};var _0x42adf9=_['map'](db[_0xd411('0x2c')][_0xd411('0x2d')],function(_0x1ee0c9){return{'name':_0x1ee0c9[_0xd411('0x2e')],'type':_0x1ee0c9[_0xd411('0x2f')][_0xd411('0x30')]};});_0x6af54e[_0xd411('0x31')]=_['differenceBy'](_[_0xd411('0x32')](_0x42adf9,'name'),[_0xd411('0x2a')]);_0x6af54e[_0xd411('0x33')]=_['keys'](_0x211561['query']);_0x6af54e[_0xd411('0x34')]=_[_0xd411('0x35')](_0x6af54e[_0xd411('0x31')],_0x6af54e[_0xd411('0x33')]);_0x400c6f['attributes']=_[_0xd411('0x35')](_0x6af54e[_0xd411('0x31')],qs[_0xd411('0x36')](_0x211561['query'][_0xd411('0x36')]));_0x400c6f[_0xd411('0x37')]=_0x400c6f['attributes'][_0xd411('0x38')]?_0x400c6f[_0xd411('0x37')]:_0x6af54e['model'];if(!_0x211561[_0xd411('0x33')][_0xd411('0x39')]('nolimit')){_0x400c6f[_0xd411('0x3a')]=qs[_0xd411('0x3a')](_0x211561[_0xd411('0x33')][_0xd411('0x3a')]);_0x400c6f[_0xd411('0x1d')]=qs[_0xd411('0x1d')](_0x211561[_0xd411('0x33')][_0xd411('0x1d')]);}_0x400c6f[_0xd411('0x3b')]=qs['sort'](_0x211561[_0xd411('0x33')][_0xd411('0x3c')]);_0x400c6f['where']=qs[_0xd411('0x34')](_[_0xd411('0x3d')](_0x211561[_0xd411('0x33')],_0x6af54e[_0xd411('0x34')]),_0x42adf9);if(_0x211561[_0xd411('0x33')]['filter']){_0x400c6f[_0xd411('0x3e')]=_['merge'](_0x400c6f[_0xd411('0x3e')],{'$or':_[_0xd411('0x32')](_0x42adf9,function(_0x4c8784){if(_0x4c8784[_0xd411('0x2f')]!==_0xd411('0x3f')){var _0x5ec436={};_0x5ec436[_0x4c8784[_0xd411('0x2a')]]={'$like':'%'+_0x211561['query'][_0xd411('0x40')]+'%'};return _0x5ec436;}})});}_0x400c6f=_['merge']({},_0x400c6f,_0x211561[_0xd411('0x41')]);var _0x11ef7b={'where':_0x400c6f[_0xd411('0x3e')]};return db[_0xd411('0x2c')][_0xd411('0x1f')](_0x11ef7b)['then'](function(_0x13751a){_0x292dc0[_0xd411('0x1f')]=_0x13751a;if(_0x211561[_0xd411('0x33')][_0xd411('0x42')]){_0x400c6f[_0xd411('0x43')]=[{'all':!![]}];}return db[_0xd411('0x2c')]['findAll'](_0x400c6f);})[_0xd411('0x25')](function(_0x527f1a){_0x292dc0['rows']=_0x527f1a;return _0x292dc0;})[_0xd411('0x25')](respondWithFilteredResult(_0x555d34,_0x400c6f))[_0xd411('0x44')](handleError(_0x555d34,null));};exports[_0xd411('0x45')]=function(_0x593656,_0x361cf5){var _0x34fb4c={'raw':!![],'where':{'id':_0x593656['params']['id']}},_0x421073={};_0x421073[_0xd411('0x31')]=_[_0xd411('0x46')](db['VoiceMailMessage'][_0xd411('0x2d')]);_0x421073[_0xd411('0x33')]=_[_0xd411('0x46')](_0x593656[_0xd411('0x33')]);_0x421073[_0xd411('0x34')]=_[_0xd411('0x35')](_0x421073[_0xd411('0x31')],_0x421073['query']);_0x34fb4c[_0xd411('0x37')]=_[_0xd411('0x35')](_0x421073[_0xd411('0x31')],qs['fields'](_0x593656[_0xd411('0x33')]['fields']));_0x34fb4c[_0xd411('0x37')]=_0x34fb4c[_0xd411('0x37')]['length']?_0x34fb4c[_0xd411('0x37')]:_0x421073[_0xd411('0x31')];if(_0x593656[_0xd411('0x33')][_0xd411('0x42')]){_0x34fb4c['include']=[{'all':!![]}];}_0x34fb4c=_[_0xd411('0x47')]({},_0x34fb4c,_0x593656[_0xd411('0x41')]);return db[_0xd411('0x2c')][_0xd411('0x48')](_0x34fb4c)[_0xd411('0x25')](handleEntityNotFound(_0x361cf5,null))['then'](respondWithResult(_0x361cf5,null))[_0xd411('0x44')](handleError(_0x361cf5,null));};exports['create']=function(_0x839b84,_0x1e5902){return db[_0xd411('0x2c')][_0xd411('0x49')](_0x839b84[_0xd411('0x4a')],{})[_0xd411('0x25')](respondWithResult(_0x1e5902,0xc9))[_0xd411('0x44')](handleError(_0x1e5902,null));};exports['update']=function(_0x10a69d,_0x49d51d){if(_0x10a69d[_0xd411('0x4a')]['id']){delete _0x10a69d[_0xd411('0x4a')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x10a69d[_0xd411('0x4b')]['id']}})[_0xd411('0x25')](handleEntityNotFound(_0x49d51d,null))[_0xd411('0x25')](saveUpdates(_0x10a69d[_0xd411('0x4a')],null))['then'](respondWithResult(_0x49d51d,null))[_0xd411('0x44')](handleError(_0x49d51d,null));};exports[_0xd411('0x26')]=function(_0xef3c29,_0x48837b){return db[_0xd411('0x2c')][_0xd411('0x48')]({'where':{'id':_0xef3c29[_0xd411('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48837b,null))[_0xd411('0x25')](removeEntity(_0x48837b,null))[_0xd411('0x44')](handleError(_0x48837b,null));};exports[_0xd411('0x4c')]=function(_0x2afa77,_0xce4f79,_0x5740a){return db['VoiceMailMessage'][_0xd411('0x48')]({'where':{'id':_0x2afa77['params']['id']},'attributes':['id','recording',_0xd411('0x4d')]})[_0xd411('0x25')](handleEntityNotFound(_0xce4f79,null))[_0xd411('0x25')](function(_0x1e7ae4){if(_0x1e7ae4){if(!_0x1e7ae4['recording']){throw new db['Sequelize'][(_0xd411('0x4e'))](_0xd411('0x4f'));}var _0x467fa2={'Content-Type':_0xd411('0x50'),'Content-Disposition':_0xd411('0x51')};if(_0x1e7ae4[_0xd411('0x4d')]){_0x467fa2[_0xd411('0x52')]=_0xd411('0x53')+_0x1e7ae4['msg_id']+_0xd411('0x54');}_0xce4f79[_0xd411('0x20')](_0x467fa2);return _0xce4f79['send'](new Buffer(_0x1e7ae4[_0xd411('0x55')]));}})[_0xd411('0x44')](handleError(_0xce4f79,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 277b220..dca09b8 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 _0x1d40=['dir','lodash','api','request-promise','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x187a30,_0x4c12e1){var _0x29f306=function(_0x268783){while(--_0x268783){_0x187a30['push'](_0x187a30['shift']());}};_0x29f306(++_0x4c12e1);}(_0x1d40,0x145));var _0x01d4=function(_0x208c26,_0xd03b50){_0x208c26=_0x208c26-0x0;var _0x160b08=_0x1d40[_0x208c26];return _0x160b08;};'use strict';var _=require(_0x01d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x01d4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01d4('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01d4('0x3'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x01d4('0x4')]=function(_0x5dc31e,_0x23e148){return _0x5dc31e[_0x01d4('0x5')](_0x01d4('0x6'),attributes,{'tableName':_0x01d4('0x7'),'paranoid':![],'indexes':[{'name':_0x01d4('0x8'),'fields':[_0x01d4('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x38b2=['voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x2405de,_0x548637){var _0xeadb6e=function(_0x4ad187){while(--_0x4ad187){_0x2405de['push'](_0x2405de['shift']());}};_0xeadb6e(++_0x548637);}(_0x38b2,0xaa));var _0x238b=function(_0x1de8af,_0x56efd7){_0x1de8af=_0x1de8af-0x0;var _0x5e35fb=_0x38b2[_0x1de8af];return _0x5e35fb;};'use strict';var _=require('lodash');var util=require(_0x238b('0x0'));var logger=require(_0x238b('0x1'))(_0x238b('0x2'));var moment=require('moment');var BPromise=require(_0x238b('0x3'));var rp=require(_0x238b('0x4'));var fs=require('fs');var path=require(_0x238b('0x5'));var rimraf=require(_0x238b('0x6'));var config=require(_0x238b('0x7'));var attributes=require(_0x238b('0x8'));module[_0x238b('0x9')]=function(_0x5238e3,_0x1f9c05){return _0x5238e3[_0x238b('0xa')](_0x238b('0xb'),attributes,{'tableName':_0x238b('0xc'),'paranoid':![],'indexes':[{'name':_0x238b('0xd'),'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 a5a81f4..0794df2 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 _0xeffa=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x31b66c,_0x5773db){var _0x406b7d=function(_0x4abf44){while(--_0x4abf44){_0x31b66c['push'](_0x31b66c['shift']());}};_0x406b7d(++_0x5773db);}(_0xeffa,0x1cb));var _0xaeff=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xeffa[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xaeff('0x0'));var util=require(_0xaeff('0x1'));var moment=require(_0xaeff('0x2'));var BPromise=require(_0xaeff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaeff('0x4'));var logger=require(_0xaeff('0x5'))(_0xaeff('0x6'));var config=require(_0xaeff('0x7'));var jayson=require(_0xaeff('0x8'));var client=jayson[_0xaeff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461a35,_0x498074,_0x51e8cd){return new BPromise(function(_0x3a73d8,_0x2e27b2){return client[_0xaeff('0xa')](_0x461a35,_0x51e8cd)[_0xaeff('0xb')](function(_0x760c8b){logger[_0xaeff('0xc')](_0xaeff('0xd'),_0x498074,_0xaeff('0xe'));logger[_0xaeff('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x498074,_0xaeff('0xe'),JSON[_0xaeff('0x10')](_0x760c8b));if(_0x760c8b['error']){if(_0x760c8b[_0xaeff('0x11')][_0xaeff('0x12')]===0x1f4){logger['error'](_0xaeff('0xd'),_0x498074,_0x760c8b[_0xaeff('0x11')][_0xaeff('0x13')]);return _0x2e27b2(_0x760c8b[_0xaeff('0x11')][_0xaeff('0x13')]);}logger[_0xaeff('0x11')](_0xaeff('0xd'),_0x498074,_0x760c8b[_0xaeff('0x11')]['message']);return _0x3a73d8(_0x760c8b['error'][_0xaeff('0x13')]);}else{logger[_0xaeff('0xc')](_0xaeff('0xd'),_0x498074,_0xaeff('0xe'));_0x3a73d8(_0x760c8b[_0xaeff('0x14')][_0xaeff('0x13')]);}})[_0xaeff('0x15')](function(_0x5bc2f4){logger['error'](_0xaeff('0xd'),_0x498074,_0x5bc2f4);_0x2e27b2(_0x5bc2f4);});});} \ No newline at end of file +var _0x8b96=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8b96,0x17e));var _0x68b9=function(_0x3464b4,_0x70c61f){_0x3464b4=_0x3464b4-0x0;var _0x56c27d=_0x8b96[_0x3464b4];return _0x56c27d;};'use strict';var _=require(_0x68b9('0x0'));var util=require(_0x68b9('0x1'));var moment=require(_0x68b9('0x2'));var BPromise=require(_0x68b9('0x3'));var rs=require(_0x68b9('0x4'));var fs=require('fs');var Redis=require(_0x68b9('0x5'));var db=require(_0x68b9('0x6'))['db'];var utils=require(_0x68b9('0x7'));var logger=require(_0x68b9('0x8'))(_0x68b9('0x9'));var config=require(_0x68b9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x68b9('0xb')][_0x68b9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6d3879,_0xc9a15a,_0x156b54){return new BPromise(function(_0x620197,_0x29147c){return client[_0x68b9('0xd')](_0x6d3879,_0x156b54)[_0x68b9('0xe')](function(_0x58b016){logger[_0x68b9('0xf')](_0x68b9('0x10'),_0xc9a15a,'request\x20sent');logger[_0x68b9('0x11')](_0x68b9('0x12'),_0xc9a15a,_0x68b9('0x13'),JSON[_0x68b9('0x14')](_0x58b016));if(_0x58b016[_0x68b9('0x15')]){if(_0x58b016[_0x68b9('0x15')][_0x68b9('0x16')]===0x1f4){logger[_0x68b9('0x15')](_0x68b9('0x10'),_0xc9a15a,_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);return _0x29147c(_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);}logger[_0x68b9('0x15')]('VoiceMailMessage,\x20%s,\x20%s',_0xc9a15a,_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);return _0x620197(_0x58b016[_0x68b9('0x15')][_0x68b9('0x17')]);}else{logger[_0x68b9('0xf')](_0x68b9('0x10'),_0xc9a15a,'request\x20sent');_0x620197(_0x58b016[_0x68b9('0x18')][_0x68b9('0x17')]);}})[_0x68b9('0x19')](function(_0x30c4cf){logger['error'](_0x68b9('0x10'),_0xc9a15a,_0x30c4cf);_0x29147c(_0x30c4cf);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8ef99d2..c1abbc2 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 _0x5749=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','create','post','addSound','/:id','update','destroy','delete','removeSound','exports'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5749,0x170));var _0x9574=function(_0xd627ee,_0x9385cc){_0xd627ee=_0xd627ee-0x0;var _0x529eb0=_0x5749[_0xd627ee];return _0x529eb0;};'use strict';var multer=require(_0x9574('0x0'));var util=require(_0x9574('0x1'));var path=require('path');var timeout=require(_0x9574('0x2'));var express=require(_0x9574('0x3'));var router=express['Router']();var fs_extra=require(_0x9574('0x4'));var auth=require(_0x9574('0x5'));var interaction=require(_0x9574('0x6'));var config=require('../../config/environment');var controller=require(_0x9574('0x7'));router[_0x9574('0x8')]('/',auth[_0x9574('0x9')](),controller[_0x9574('0xa')]);router['get']('/:id',auth[_0x9574('0x9')](),controller[_0x9574('0xb')]);router[_0x9574('0x8')](_0x9574('0xc'),auth['isAuthenticated'](),controller[_0x9574('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9574('0xe')]);router[_0x9574('0xf')](_0x9574('0xc'),auth[_0x9574('0x9')](),controller[_0x9574('0x10')]);router['put'](_0x9574('0x11'),auth[_0x9574('0x9')](),controller[_0x9574('0x12')]);router['delete'](_0x9574('0x11'),auth[_0x9574('0x9')](),controller[_0x9574('0x13')]);router[_0x9574('0x14')]('/:id/sounds/:id2',auth[_0x9574('0x9')](),controller[_0x9574('0x15')]);module[_0x9574('0x16')]=router; \ No newline at end of file +var _0x2307=['/:id/sounds/:id2','exports','multer','path','connect-timeout','express','Router','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','post','/:id/sounds','addSound','update','delete','destroy'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x2307,0x17e));var _0x7230=function(_0x2cec8a,_0xec8ab5){_0x2cec8a=_0x2cec8a-0x0;var _0x2f42bb=_0x2307[_0x2cec8a];return _0x2f42bb;};'use strict';var multer=require(_0x7230('0x0'));var util=require('util');var path=require(_0x7230('0x1'));var timeout=require(_0x7230('0x2'));var express=require(_0x7230('0x3'));var router=express[_0x7230('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7230('0x5'));var controller=require(_0x7230('0x6'));router[_0x7230('0x7')]('/',auth[_0x7230('0x8')](),controller[_0x7230('0x9')]);router[_0x7230('0x7')](_0x7230('0xa'),auth['isAuthenticated'](),controller[_0x7230('0xb')]);router[_0x7230('0x7')]('/:id/sounds',auth[_0x7230('0x8')](),controller['getSounds']);router[_0x7230('0xc')]('/',auth[_0x7230('0x8')](),controller['create']);router['post'](_0x7230('0xd'),auth[_0x7230('0x8')](),controller[_0x7230('0xe')]);router['put'](_0x7230('0xa'),auth[_0x7230('0x8')](),controller[_0x7230('0xf')]);router[_0x7230('0x10')](_0x7230('0xa'),auth[_0x7230('0x8')](),controller[_0x7230('0x11')]);router[_0x7230('0x10')](_0x7230('0x12'),auth[_0x7230('0x8')](),controller['removeSound']);module[_0x7230('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d12d91b..83db9d8 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 _0x2600=['BOOLEAN','sequelize','exports','name','custom','files','quietmp3nb','quietmp3','STRING','alpha'];(function(_0x24bb80,_0x14e041){var _0xdf1d52=function(_0x49e082){while(--_0x49e082){_0x24bb80['push'](_0x24bb80['shift']());}};_0xdf1d52(++_0x14e041);}(_0x2600,0x119));var _0x0260=function(_0x445fa8,_0x1ce79d){_0x445fa8=_0x445fa8-0x0;var _0x30ceb3=_0x2600[_0x445fa8];return _0x30ceb3;};'use strict';var Sequelize=require(_0x0260('0x0'));module[_0x0260('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0260('0x2')},'mode':{'type':Sequelize['ENUM'](_0x0260('0x3'),_0x0260('0x4'),'mp3nb',_0x0260('0x5'),_0x0260('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x0260('0x4')},'directory':{'type':Sequelize[_0x0260('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x0260('0x7')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0260('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x0260('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbd72=['quietmp3','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','mp3nb'];(function(_0x54dcb7,_0x310c80){var _0x2d68d1=function(_0x541e70){while(--_0x541e70){_0x54dcb7['push'](_0x54dcb7['shift']());}};_0x2d68d1(++_0x310c80);}(_0xbd72,0x179));var _0x2bd7=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xbd72[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x2bd7('0x0'));module[_0x2bd7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2bd7('0x2')},'mode':{'type':Sequelize[_0x2bd7('0x3')](_0x2bd7('0x4'),_0x2bd7('0x5'),_0x2bd7('0x6'),'quietmp3nb',_0x2bd7('0x7'),_0x2bd7('0x8')),'allowNull':!![],'defaultValue':_0x2bd7('0x5')},'directory':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x2bd7('0x9')],'allowNull':!![]},'stamp':{'type':_0x2bd7('0xa')},'defaultEntry':{'type':Sequelize[_0x2bd7('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b53e3f3..ac33252 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 _0x9e50=['error','stack','name','send','map','VoiceMusicOnHold','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','ValidationError','message','removeSound','id2','getSounds','Sound','pick','filter','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','sendStatus'];(function(_0x29f6f8,_0x3bd3e4){var _0x6c4589=function(_0x4cc8dc){while(--_0x4cc8dc){_0x29f6f8['push'](_0x29f6f8['shift']());}};_0x6c4589(++_0x3bd3e4);}(_0x9e50,0x131));var _0x09e5=function(_0x14eb3f,_0x19c655){_0x14eb3f=_0x14eb3f-0x0;var _0x271f25=_0x9e50[_0x14eb3f];return _0x271f25;};'use strict';var emlformat=require(_0x09e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x09e5('0x1'));var rp=require(_0x09e5('0x2'));var moment=require(_0x09e5('0x3'));var BPromise=require(_0x09e5('0x4'));var Mustache=require(_0x09e5('0x5'));var util=require('util');var path=require(_0x09e5('0x6'));var sox=require('sox');var csv=require(_0x09e5('0x7'));var ejs=require(_0x09e5('0x8'));var fs=require('fs');var fs_extra=require(_0x09e5('0x9'));var _=require(_0x09e5('0xa'));var squel=require(_0x09e5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x09e5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x09e5('0xd'));var Redis=require(_0x09e5('0xe'));var authService=require(_0x09e5('0xf'));var qs=require(_0x09e5('0x10'));var as=require(_0x09e5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09e5('0x12'))('api');var utils=require(_0x09e5('0x13'));var config=require(_0x09e5('0x14'));var licenseUtil=require(_0x09e5('0x15'));var db=require(_0x09e5('0x16'))['db'];function respondWithStatusCode(_0x227544,_0x46dd91){_0x46dd91=_0x46dd91||0xcc;return function(_0x413ef2){if(_0x413ef2){return _0x227544['sendStatus'](_0x46dd91);}return _0x227544[_0x09e5('0x17')](_0x46dd91)[_0x09e5('0x18')]();};}function respondWithResult(_0x5a6d1d,_0x1f06b5){_0x1f06b5=_0x1f06b5||0xc8;return function(_0x1e21ba){if(_0x1e21ba){return _0x5a6d1d[_0x09e5('0x17')](_0x1f06b5)[_0x09e5('0x19')](_0x1e21ba);}};}function respondWithFilteredResult(_0x4341b6,_0x1a0c5d){return function(_0x1b37f9){if(_0x1b37f9){var _0x216ac0=typeof _0x1a0c5d[_0x09e5('0x1a')]===_0x09e5('0x1b')&&typeof _0x1a0c5d['limit']===_0x09e5('0x1b');var _0x2a7527=_0x1b37f9[_0x09e5('0x1c')];var _0xd59234=_0x216ac0?0x0:_0x1a0c5d['offset'];var _0x1ebda6=_0x216ac0?_0x1b37f9[_0x09e5('0x1c')]:_0x1a0c5d[_0x09e5('0x1a')]+_0x1a0c5d['limit'];var _0x51c559;if(_0x1ebda6>=_0x2a7527){_0x1ebda6=_0x2a7527;_0x51c559=0xc8;}else{_0x51c559=0xce;}_0x4341b6['status'](_0x51c559);return _0x4341b6[_0x09e5('0x1d')](_0x09e5('0x1e'),_0xd59234+'-'+_0x1ebda6+'/'+_0x2a7527)[_0x09e5('0x19')](_0x1b37f9);}return null;};}function patchUpdates(_0x10b082){return function(_0xe69f7d){try{jsonpatch[_0x09e5('0x1f')](_0xe69f7d,_0x10b082,!![]);}catch(_0x4e44c0){return BPromise[_0x09e5('0x20')](_0x4e44c0);}return _0xe69f7d[_0x09e5('0x21')]();};}function saveUpdates(_0x2ef5ab,_0x5383df){return function(_0x24574c){if(_0x24574c){return _0x24574c[_0x09e5('0x22')](_0x2ef5ab)['then'](function(_0x651f27){return _0x651f27;});}return null;};}function removeEntity(_0x536462,_0x5e6756){return function(_0x63181e){if(_0x63181e){return _0x63181e[_0x09e5('0x23')]()[_0x09e5('0x24')](function(){var _0xffa38e=_0x63181e['get']({'plain':!![]});var _0x1abaf0=_0x09e5('0x25');return db[_0x09e5('0x26')]['destroy']({'where':{'type':_0x1abaf0,'resourceId':_0xffa38e['id']}})[_0x09e5('0x24')](function(){return _0x63181e;});})['then'](function(){_0x536462[_0x09e5('0x17')](0xcc)[_0x09e5('0x18')]();});}};}function handleEntityNotFound(_0x53247b,_0xcfd86){return function(_0x138183){if(!_0x138183){_0x53247b[_0x09e5('0x27')](0x194);}return _0x138183;};}function handleError(_0x4f2b43,_0x3575ed){_0x3575ed=_0x3575ed||0x1f4;return function(_0x24d5e2){logger[_0x09e5('0x28')](_0x24d5e2[_0x09e5('0x29')]);if(_0x24d5e2[_0x09e5('0x2a')]){delete _0x24d5e2[_0x09e5('0x2a')];}_0x4f2b43['status'](_0x3575ed)[_0x09e5('0x2b')](_0x24d5e2);};}exports['index']=function(_0xeef55e,_0x34403e){var _0xe0e8b={},_0xb226a8={},_0x3cc5ea={'count':0x0,'rows':[]};var _0xe294b8=_[_0x09e5('0x2c')](db[_0x09e5('0x2d')]['rawAttributes'],function(_0x4c70f3){return{'name':_0x4c70f3[_0x09e5('0x2e')],'type':_0x4c70f3['type'][_0x09e5('0x2f')]};});_0xb226a8[_0x09e5('0x30')]=_['map'](_0xe294b8,_0x09e5('0x2a'));_0xb226a8[_0x09e5('0x31')]=_[_0x09e5('0x32')](_0xeef55e[_0x09e5('0x31')]);_0xb226a8[_0x09e5('0x33')]=_[_0x09e5('0x34')](_0xb226a8['model'],_0xb226a8['query']);_0xe0e8b[_0x09e5('0x35')]=_[_0x09e5('0x34')](_0xb226a8['model'],qs[_0x09e5('0x36')](_0xeef55e[_0x09e5('0x31')][_0x09e5('0x36')]));_0xe0e8b['attributes']=_0xe0e8b[_0x09e5('0x35')][_0x09e5('0x37')]?_0xe0e8b[_0x09e5('0x35')]:_0xb226a8[_0x09e5('0x30')];if(!_0xeef55e[_0x09e5('0x31')][_0x09e5('0x38')](_0x09e5('0x39'))){_0xe0e8b[_0x09e5('0x3a')]=qs[_0x09e5('0x3a')](_0xeef55e[_0x09e5('0x31')]['limit']);_0xe0e8b[_0x09e5('0x1a')]=qs[_0x09e5('0x1a')](_0xeef55e[_0x09e5('0x31')][_0x09e5('0x1a')]);}_0xe0e8b[_0x09e5('0x3b')]=qs['sort'](_0xeef55e['query'][_0x09e5('0x3c')]);delete _0xeef55e[_0x09e5('0x31')][_0x09e5('0x3c')];_0xe0e8b[_0x09e5('0x3d')]=qs[_0x09e5('0x33')](_['pick'](_0xeef55e['query'],_0xb226a8[_0x09e5('0x33')]),_0xe294b8);if(_0xeef55e[_0x09e5('0x31')]['filter']){_0xe0e8b['where']=_[_0x09e5('0x3e')](_0xe0e8b['where'],{'$or':_[_0x09e5('0x2c')](_0xe294b8,function(_0x25de73){if(_0x25de73[_0x09e5('0x3f')]!==_0x09e5('0x40')){var _0x2468ff={};_0x2468ff[_0x25de73[_0x09e5('0x2a')]]={'$like':'%'+_0xeef55e[_0x09e5('0x31')]['filter']+'%'};return _0x2468ff;}})});}_0xe0e8b=_[_0x09e5('0x3e')]({},_0xe0e8b,_0xeef55e[_0x09e5('0x41')]);var _0x496969={'where':_0xe0e8b[_0x09e5('0x3d')]};return db['VoiceMusicOnHold']['count'](_0x496969)[_0x09e5('0x24')](function(_0x2bfd3f){_0x3cc5ea['count']=_0x2bfd3f;if(_0xeef55e[_0x09e5('0x31')][_0x09e5('0x42')]){_0xe0e8b[_0x09e5('0x43')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0xe0e8b);})['then'](function(_0x192517){_0x3cc5ea[_0x09e5('0x44')]=_0x192517;return _0x3cc5ea;})[_0x09e5('0x24')](respondWithFilteredResult(_0x34403e,_0xe0e8b))[_0x09e5('0x45')](handleError(_0x34403e,null));};exports['show']=function(_0x55e858,_0x34fda5){var _0x5dd648={'raw':![],'where':{'id':_0x55e858[_0x09e5('0x46')]['id']}},_0x2ac2a4={};_0x2ac2a4['model']=_['keys'](db['VoiceMusicOnHold'][_0x09e5('0x47')]);_0x2ac2a4[_0x09e5('0x31')]=_['keys'](_0x55e858[_0x09e5('0x31')]);_0x2ac2a4[_0x09e5('0x33')]=_[_0x09e5('0x34')](_0x2ac2a4[_0x09e5('0x30')],_0x2ac2a4[_0x09e5('0x31')]);_0x5dd648[_0x09e5('0x35')]=_[_0x09e5('0x34')](_0x2ac2a4[_0x09e5('0x30')],qs[_0x09e5('0x36')](_0x55e858[_0x09e5('0x31')][_0x09e5('0x36')]));_0x5dd648[_0x09e5('0x35')]=_0x5dd648[_0x09e5('0x35')]['length']?_0x5dd648[_0x09e5('0x35')]:_0x2ac2a4[_0x09e5('0x30')];if(_0x55e858[_0x09e5('0x31')]['includeAll']){_0x5dd648['include']=[{'all':!![]}];}_0x5dd648=_['merge']({},_0x5dd648,_0x55e858[_0x09e5('0x41')]);return db[_0x09e5('0x2d')][_0x09e5('0x48')](_0x5dd648)[_0x09e5('0x24')](handleEntityNotFound(_0x34fda5,null))[_0x09e5('0x24')](respondWithResult(_0x34fda5,null))[_0x09e5('0x45')](handleError(_0x34fda5,null));};exports[_0x09e5('0x22')]=function(_0x25bd0c,_0x57125d){if(_0x25bd0c[_0x09e5('0x49')]['id']){delete _0x25bd0c['body']['id'];}return db[_0x09e5('0x2d')][_0x09e5('0x48')]({'where':{'id':_0x25bd0c[_0x09e5('0x46')]['id']}})[_0x09e5('0x24')](handleEntityNotFound(_0x57125d,null))[_0x09e5('0x24')](saveUpdates(_0x25bd0c[_0x09e5('0x49')],null))[_0x09e5('0x24')](respondWithResult(_0x57125d,null))[_0x09e5('0x45')](handleError(_0x57125d,null));};exports[_0x09e5('0x4a')]=function(_0x3dd489,_0x1bc0fc,_0x38b5ee){return db[_0x09e5('0x4b')][_0x09e5('0x4c')](function(_0xf0f1c5){if(_0x3dd489[_0x09e5('0x49')][_0x09e5('0x4d')]===_0x09e5('0x4e')){_0x3dd489[_0x09e5('0x49')]['directory']=path[_0x09e5('0x4f')](config[_0x09e5('0x50')],_0x09e5('0x51'),_0x3dd489[_0x09e5('0x49')][_0x09e5('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x3dd489[_0x09e5('0x49')],{'transaction':_0xf0f1c5})[_0x09e5('0x24')](function(_0x4928bb){if(_0x3dd489[_0x09e5('0x49')]['mode']===_0x09e5('0x4e')){fs['mkdirSync'](_0x4928bb[_0x09e5('0x52')],parseInt(_0x09e5('0x53'),0x8));}var _0x38cd24=_0x3dd489[_0x09e5('0x54')][_0x09e5('0x55')]({'plain':!![]});if(!_0x38cd24)throw new Error(_0x09e5('0x56'));if(_0x38cd24[_0x09e5('0x57')]===_0x09e5('0x54')){var _0x4e6f0a=_0x4928bb[_0x09e5('0x55')]({'plain':!![]});return db[_0x09e5('0x58')][_0x09e5('0x48')]({'where':{'name':_0x09e5('0x25'),'userProfileId':_0x38cd24[_0x09e5('0x59')]},'raw':!![]})[_0x09e5('0x24')](function(_0x126e9e){if(_0x126e9e&&_0x126e9e[_0x09e5('0x5a')]===0x0){return db['UserProfileResource'][_0x09e5('0x4a')]({'name':_0x4e6f0a[_0x09e5('0x2a')],'resourceId':_0x4e6f0a['id'],'type':_0x126e9e[_0x09e5('0x2a')],'sectionId':_0x126e9e['id']},{})[_0x09e5('0x24')](function(){return _0x4928bb;});}else{return _0x4928bb;}})['catch'](function(_0x402f69){logger[_0x09e5('0x28')](_0x09e5('0x5b'),_0x402f69);});}return _0x4928bb;});})['then'](respondWithResult(_0x1bc0fc,0xc9))['catch'](handleError(_0x1bc0fc,null));};exports[_0x09e5('0x23')]=function(_0x5082bb,_0x143677,_0x356bfd){var _0x5b088d;return db[_0x09e5('0x2d')][_0x09e5('0x48')]({'where':{'id':_0x5082bb[_0x09e5('0x46')]['id']}})['then'](function(_0x4b1f30){if(_0x4b1f30){return db[_0x09e5('0x4b')][_0x09e5('0x4c')](function(_0x560907){return _0x4b1f30[_0x09e5('0x23')]({'transaction':_0x560907,'raw':!![]})[_0x09e5('0x24')](function(_0x2a46a2){if(_0x2a46a2['directory']){fs[_0x09e5('0x5c')](_0x2a46a2[_0x09e5('0x52')])[_0x09e5('0x5d')](function(_0x10189d){fs[_0x09e5('0x5e')](path[_0x09e5('0x4f')](_0x2a46a2[_0x09e5('0x52')],_0x10189d));});fs[_0x09e5('0x5f')](_0x2a46a2['directory']);}return _0x2a46a2;});})[_0x09e5('0x45')](function(_0x3dbb25){throw new db[(_0x09e5('0x60'))]['ValidationError'](_0x3dbb25['message']);});}})[_0x09e5('0x24')](handleEntityNotFound(_0x143677,null))[_0x09e5('0x24')](removeEntity(_0x143677,null))[_0x09e5('0x45')](handleError(_0x143677,null));};exports[_0x09e5('0x61')]=function(_0x2164dc,_0x5d96c0,_0x178472){return db[_0x09e5('0x4b')][_0x09e5('0x4c')](function(_0x50cc03){var _0x24c804;return db[_0x09e5('0x2d')]['find']({'where':{'id':_0x2164dc['params']['id']}})[_0x09e5('0x24')](function(_0x13e341){if(_0x13e341){_0x24c804=_0x13e341;return _0x13e341['addSound'](_0x2164dc[_0x09e5('0x49')]['id'],{'transaction':_0x50cc03});}})[_0x09e5('0x24')](function(_0x2b5594){if(_0x2b5594){return db['Sound'][_0x09e5('0x62')]({'where':{'id':_0x2164dc['body']['id']},'attributes':['id','name','save_name',_0x09e5('0x63'),_0x09e5('0x64')],'raw':!![]});}})['then'](function(_0x2fc879){if(_0x2fc879){var _0x3f6104=path[_0x09e5('0x4f')](config['root'],'server/files/sounds/converted',util[_0x09e5('0x65')](_0x09e5('0x66'),path[_0x09e5('0x67')](_0x2fc879[_0x09e5('0x68')],path[_0x09e5('0x69')](_0x2fc879[_0x09e5('0x68')])),_0x2fc879[_0x09e5('0x63')]));var _0x115e8d=path[_0x09e5('0x4f')](config[_0x09e5('0x50')],_0x09e5('0x51'),_0x24c804['name'],util[_0x09e5('0x65')](_0x09e5('0x66'),_0x2fc879[_0x09e5('0x2a')],_0x2fc879[_0x09e5('0x63')]));fs[_0x09e5('0x6a')](_0x3f6104,_0x115e8d);return _0x2fc879;}})['catch'](function(_0x31dfe5){throw new db[(_0x09e5('0x60'))][(_0x09e5('0x6b'))](_0x31dfe5[_0x09e5('0x6c')]);});})['then'](handleEntityNotFound(_0x5d96c0,null))[_0x09e5('0x24')](respondWithResult(_0x5d96c0,0xc9))[_0x09e5('0x45')](handleError(_0x5d96c0,null));};exports['removeSound']=function(_0x42d1b9,_0x1af079,_0x57286b){return db[_0x09e5('0x4b')][_0x09e5('0x4c')](function(_0x5f3d1a){var _0x1213b4;return db[_0x09e5('0x2d')]['findOne']({'where':{'id':_0x42d1b9[_0x09e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1af079,null))[_0x09e5('0x24')](function(_0x52396e){if(_0x52396e){_0x1213b4=_0x52396e;return _0x52396e[_0x09e5('0x6d')](_0x42d1b9[_0x09e5('0x46')][_0x09e5('0x6e')]);}})[_0x09e5('0x24')](function(_0x5d0ba7){if(_0x5d0ba7){return db['Sound'][_0x09e5('0x62')]({'where':{'id':_0x42d1b9['params'][_0x09e5('0x6e')]},'attributes':['id',_0x09e5('0x2a'),_0x09e5('0x68'),_0x09e5('0x63'),_0x09e5('0x64')],'raw':!![]});}})['then'](function(_0x74f019){if(_0x74f019){fs[_0x09e5('0x5e')](path[_0x09e5('0x4f')](_0x1213b4[_0x09e5('0x52')],util[_0x09e5('0x65')](_0x09e5('0x66'),_0x74f019[_0x09e5('0x2a')],_0x74f019[_0x09e5('0x63')])));return _0x74f019;}})[_0x09e5('0x45')](function(_0x49b432){throw new db[(_0x09e5('0x60'))][(_0x09e5('0x6b'))](_0x49b432[_0x09e5('0x6c')]);});})['then'](handleEntityNotFound(_0x1af079,null))[_0x09e5('0x24')](respondWithStatusCode(_0x1af079,0xcc))[_0x09e5('0x45')](handleError(_0x1af079,null));};exports[_0x09e5('0x6f')]=function(_0xb9082d,_0x379cc8,_0x335433){var _0x3cbaff={};var _0x29adf7={};var _0x2c0084;var _0x101770;return db[_0x09e5('0x2d')]['findOne']({'where':{'id':_0xb9082d['params']['id']}})[_0x09e5('0x24')](handleEntityNotFound(_0x379cc8,null))[_0x09e5('0x24')](function(_0x2a8990){if(_0x2a8990){_0x2c0084=_0x2a8990;_0x29adf7[_0x09e5('0x30')]=_[_0x09e5('0x32')](db[_0x09e5('0x70')][_0x09e5('0x47')]);_0x29adf7[_0x09e5('0x31')]=_['keys'](_0xb9082d['query']);_0x29adf7['filters']=_[_0x09e5('0x34')](_0x29adf7[_0x09e5('0x30')],_0x29adf7[_0x09e5('0x31')]);_0x3cbaff[_0x09e5('0x35')]=_[_0x09e5('0x34')](_0x29adf7['model'],qs[_0x09e5('0x36')](_0xb9082d[_0x09e5('0x31')][_0x09e5('0x36')]));_0x3cbaff[_0x09e5('0x35')]=_0x3cbaff[_0x09e5('0x35')][_0x09e5('0x37')]?_0x3cbaff[_0x09e5('0x35')]:_0x29adf7[_0x09e5('0x30')];_0x3cbaff[_0x09e5('0x3b')]=qs[_0x09e5('0x3c')](_0xb9082d[_0x09e5('0x31')][_0x09e5('0x3c')]);_0x3cbaff[_0x09e5('0x3d')]=qs['filters'](_[_0x09e5('0x71')](_0xb9082d[_0x09e5('0x31')],_0x29adf7['filters']));if(_0xb9082d[_0x09e5('0x31')][_0x09e5('0x72')]){_0x3cbaff[_0x09e5('0x3d')]=_[_0x09e5('0x3e')](_0x3cbaff[_0x09e5('0x3d')],{'$or':_[_0x09e5('0x2c')](_0x3cbaff[_0x09e5('0x35')],function(_0x1b6338){var _0x48ac36={};_0x48ac36[_0x1b6338]={'$like':'%'+_0xb9082d[_0x09e5('0x31')][_0x09e5('0x72')]+'%'};return _0x48ac36;})});}_0x3cbaff=_[_0x09e5('0x3e')]({},_0x3cbaff,_0xb9082d[_0x09e5('0x41')]);return _0x2c0084[_0x09e5('0x6f')](_0x3cbaff);}})[_0x09e5('0x24')](function(_0x39457e){if(_0x39457e){_0x101770=_0x39457e[_0x09e5('0x37')];if(!_0xb9082d[_0x09e5('0x31')][_0x09e5('0x38')](_0x09e5('0x39'))){_0x3cbaff['limit']=qs[_0x09e5('0x3a')](_0xb9082d[_0x09e5('0x31')][_0x09e5('0x3a')]);_0x3cbaff[_0x09e5('0x1a')]=qs[_0x09e5('0x1a')](_0xb9082d['query']['offset']);}return _0x2c0084['getSounds'](_0x3cbaff);}})[_0x09e5('0x24')](function(_0x3292c7){if(_0x3292c7){return _0x3292c7?{'count':_0x101770,'rows':_0x3292c7}:null;}})['then'](respondWithResult(_0x379cc8,null))['catch'](handleError(_0x379cc8,null));}; \ No newline at end of file +var _0x637b=['server/files/sounds/converted','format','extname','%s.%s','converted_format','symlinkSync','message','removeSound','id2','unlinkSync','getSounds','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','reject','save','then','destroy','MusicOnHolds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','catch','show','params','include','find','update','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','createdAt'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x637b,0x79));var _0xb637=function(_0xa86729,_0x56846a){_0xa86729=_0xa86729-0x0;var _0x45fd8d=_0x637b[_0xa86729];return _0x45fd8d;};'use strict';var emlformat=require(_0xb637('0x0'));var rimraf=require(_0xb637('0x1'));var zipdir=require(_0xb637('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb637('0x3'));var BPromise=require(_0xb637('0x4'));var Mustache=require(_0xb637('0x5'));var util=require(_0xb637('0x6'));var path=require(_0xb637('0x7'));var sox=require(_0xb637('0x8'));var csv=require(_0xb637('0x9'));var ejs=require(_0xb637('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb637('0xb'));var crypto=require(_0xb637('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb637('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb637('0xe'));var Papa=require(_0xb637('0xf'));var Redis=require('ioredis');var authService=require(_0xb637('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb637('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb637('0x12'));var utils=require(_0xb637('0x13'));var config=require(_0xb637('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb637('0x15'))['db'];function respondWithStatusCode(_0x2fcd2b,_0x2459d6){_0x2459d6=_0x2459d6||0xcc;return function(_0x20f211){if(_0x20f211){return _0x2fcd2b['sendStatus'](_0x2459d6);}return _0x2fcd2b[_0xb637('0x16')](_0x2459d6)['end']();};}function respondWithResult(_0x43bf86,_0x1ecc4d){_0x1ecc4d=_0x1ecc4d||0xc8;return function(_0x5066ee){if(_0x5066ee){return _0x43bf86[_0xb637('0x16')](_0x1ecc4d)[_0xb637('0x17')](_0x5066ee);}};}function respondWithFilteredResult(_0x5998c1,_0x19061c){return function(_0xc9486c){if(_0xc9486c){var _0x4cb472=typeof _0x19061c['offset']===_0xb637('0x18')&&typeof _0x19061c[_0xb637('0x19')]==='undefined';var _0x4a37ae=_0xc9486c[_0xb637('0x1a')];var _0x1facc9=_0x4cb472?0x0:_0x19061c[_0xb637('0x1b')];var _0x2974b3=_0x4cb472?_0xc9486c['count']:_0x19061c[_0xb637('0x1b')]+_0x19061c[_0xb637('0x19')];var _0x826c35;if(_0x2974b3>=_0x4a37ae){_0x2974b3=_0x4a37ae;_0x826c35=0xc8;}else{_0x826c35=0xce;}_0x5998c1[_0xb637('0x16')](_0x826c35);return _0x5998c1[_0xb637('0x1c')]('Content-Range',_0x1facc9+'-'+_0x2974b3+'/'+_0x4a37ae)[_0xb637('0x17')](_0xc9486c);}return null;};}function patchUpdates(_0x2d556f){return function(_0x46963d){try{jsonpatch['apply'](_0x46963d,_0x2d556f,!![]);}catch(_0x5252cb){return BPromise[_0xb637('0x1d')](_0x5252cb);}return _0x46963d[_0xb637('0x1e')]();};}function saveUpdates(_0x3b1f00,_0x295e70){return function(_0x170840){if(_0x170840){return _0x170840['update'](_0x3b1f00)[_0xb637('0x1f')](function(_0x5de78e){return _0x5de78e;});}return null;};}function removeEntity(_0x2f1519,_0x3b33b0){return function(_0x26bd80){if(_0x26bd80){return _0x26bd80[_0xb637('0x20')]()[_0xb637('0x1f')](function(){var _0x42cdde=_0x26bd80['get']({'plain':!![]});var _0x1701e3=_0xb637('0x21');return db[_0xb637('0x22')]['destroy']({'where':{'type':_0x1701e3,'resourceId':_0x42cdde['id']}})['then'](function(){return _0x26bd80;});})[_0xb637('0x1f')](function(){_0x2f1519[_0xb637('0x16')](0xcc)[_0xb637('0x23')]();});}};}function handleEntityNotFound(_0x329a0c,_0x5e9e34){return function(_0x168037){if(!_0x168037){_0x329a0c[_0xb637('0x24')](0x194);}return _0x168037;};}function handleError(_0xc3c955,_0x3b2cc9){_0x3b2cc9=_0x3b2cc9||0x1f4;return function(_0x15c9ce){logger[_0xb637('0x25')](_0x15c9ce[_0xb637('0x26')]);if(_0x15c9ce['name']){delete _0x15c9ce[_0xb637('0x27')];}_0xc3c955[_0xb637('0x16')](_0x3b2cc9)[_0xb637('0x28')](_0x15c9ce);};}exports[_0xb637('0x29')]=function(_0x3107b0,_0x1f9fd8){var _0x485ebe={},_0x15d31c={},_0x152aa9={'count':0x0,'rows':[]};var _0xc75fc=_[_0xb637('0x2a')](db[_0xb637('0x2b')][_0xb637('0x2c')],function(_0x19dee1){return{'name':_0x19dee1[_0xb637('0x2d')],'type':_0x19dee1[_0xb637('0x2e')]['key']};});_0x15d31c[_0xb637('0x2f')]=_[_0xb637('0x2a')](_0xc75fc,_0xb637('0x27'));_0x15d31c['query']=_[_0xb637('0x30')](_0x3107b0['query']);_0x15d31c[_0xb637('0x31')]=_['intersection'](_0x15d31c[_0xb637('0x2f')],_0x15d31c[_0xb637('0x32')]);_0x485ebe[_0xb637('0x33')]=_[_0xb637('0x34')](_0x15d31c[_0xb637('0x2f')],qs[_0xb637('0x35')](_0x3107b0[_0xb637('0x32')][_0xb637('0x35')]));_0x485ebe[_0xb637('0x33')]=_0x485ebe[_0xb637('0x33')][_0xb637('0x36')]?_0x485ebe[_0xb637('0x33')]:_0x15d31c['model'];if(!_0x3107b0[_0xb637('0x32')][_0xb637('0x37')](_0xb637('0x38'))){_0x485ebe[_0xb637('0x19')]=qs[_0xb637('0x19')](_0x3107b0[_0xb637('0x32')][_0xb637('0x19')]);_0x485ebe[_0xb637('0x1b')]=qs[_0xb637('0x1b')](_0x3107b0[_0xb637('0x32')][_0xb637('0x1b')]);}_0x485ebe[_0xb637('0x39')]=qs[_0xb637('0x3a')](_0x3107b0[_0xb637('0x32')][_0xb637('0x3a')]);delete _0x3107b0[_0xb637('0x32')][_0xb637('0x3a')];_0x485ebe['where']=qs[_0xb637('0x31')](_[_0xb637('0x3b')](_0x3107b0[_0xb637('0x32')],_0x15d31c['filters']),_0xc75fc);if(_0x3107b0[_0xb637('0x32')][_0xb637('0x3c')]){_0x485ebe[_0xb637('0x3d')]=_['merge'](_0x485ebe['where'],{'$or':_[_0xb637('0x2a')](_0xc75fc,function(_0x39833f){if(_0x39833f[_0xb637('0x2e')]!==_0xb637('0x3e')){var _0x11e43b={};_0x11e43b[_0x39833f[_0xb637('0x27')]]={'$like':'%'+_0x3107b0[_0xb637('0x32')][_0xb637('0x3c')]+'%'};return _0x11e43b;}})});}_0x485ebe=_[_0xb637('0x3f')]({},_0x485ebe,_0x3107b0[_0xb637('0x40')]);var _0xa38301={'where':_0x485ebe[_0xb637('0x3d')]};return db[_0xb637('0x2b')][_0xb637('0x1a')](_0xa38301)[_0xb637('0x1f')](function(_0x20542e){_0x152aa9[_0xb637('0x1a')]=_0x20542e;if(_0x3107b0['query'][_0xb637('0x41')]){_0x485ebe['include']=[{'all':!![]}];}return db[_0xb637('0x2b')]['findAll'](_0x485ebe);})[_0xb637('0x1f')](function(_0x54aa4d){_0x152aa9['rows']=_0x54aa4d;return _0x152aa9;})[_0xb637('0x1f')](respondWithFilteredResult(_0x1f9fd8,_0x485ebe))[_0xb637('0x42')](handleError(_0x1f9fd8,null));};exports[_0xb637('0x43')]=function(_0x4dd5c4,_0x5adeee){var _0x44b9df={'raw':![],'where':{'id':_0x4dd5c4[_0xb637('0x44')]['id']}},_0x271f84={};_0x271f84[_0xb637('0x2f')]=_[_0xb637('0x30')](db[_0xb637('0x2b')][_0xb637('0x2c')]);_0x271f84[_0xb637('0x32')]=_['keys'](_0x4dd5c4[_0xb637('0x32')]);_0x271f84[_0xb637('0x31')]=_[_0xb637('0x34')](_0x271f84['model'],_0x271f84['query']);_0x44b9df['attributes']=_[_0xb637('0x34')](_0x271f84['model'],qs[_0xb637('0x35')](_0x4dd5c4[_0xb637('0x32')]['fields']));_0x44b9df[_0xb637('0x33')]=_0x44b9df[_0xb637('0x33')][_0xb637('0x36')]?_0x44b9df[_0xb637('0x33')]:_0x271f84[_0xb637('0x2f')];if(_0x4dd5c4[_0xb637('0x32')][_0xb637('0x41')]){_0x44b9df[_0xb637('0x45')]=[{'all':!![]}];}_0x44b9df=_[_0xb637('0x3f')]({},_0x44b9df,_0x4dd5c4[_0xb637('0x40')]);return db['VoiceMusicOnHold'][_0xb637('0x46')](_0x44b9df)[_0xb637('0x1f')](handleEntityNotFound(_0x5adeee,null))[_0xb637('0x1f')](respondWithResult(_0x5adeee,null))['catch'](handleError(_0x5adeee,null));};exports[_0xb637('0x47')]=function(_0x4bca20,_0x334a89){if(_0x4bca20[_0xb637('0x48')]['id']){delete _0x4bca20['body']['id'];}return db[_0xb637('0x2b')][_0xb637('0x46')]({'where':{'id':_0x4bca20[_0xb637('0x44')]['id']}})[_0xb637('0x1f')](handleEntityNotFound(_0x334a89,null))[_0xb637('0x1f')](saveUpdates(_0x4bca20['body'],null))['then'](respondWithResult(_0x334a89,null))['catch'](handleError(_0x334a89,null));};exports[_0xb637('0x49')]=function(_0x12e6d3,_0x164dfc,_0x2f9dbb){return db[_0xb637('0x4a')][_0xb637('0x4b')](function(_0xa13c1c){if(_0x12e6d3[_0xb637('0x48')]['mode']===_0xb637('0x4c')){_0x12e6d3[_0xb637('0x48')][_0xb637('0x4d')]=path[_0xb637('0x4e')](config[_0xb637('0x4f')],_0xb637('0x50'),_0x12e6d3[_0xb637('0x48')][_0xb637('0x27')]);}return db[_0xb637('0x2b')][_0xb637('0x49')](_0x12e6d3[_0xb637('0x48')],{'transaction':_0xa13c1c})[_0xb637('0x1f')](function(_0x306051){if(_0x12e6d3[_0xb637('0x48')]['mode']===_0xb637('0x4c')){fs[_0xb637('0x51')](_0x306051[_0xb637('0x4d')],parseInt(_0xb637('0x52'),0x8));}var _0x5c57e9=_0x12e6d3[_0xb637('0x53')][_0xb637('0x54')]({'plain':!![]});if(!_0x5c57e9)throw new Error(_0xb637('0x55'));if(_0x5c57e9['role']===_0xb637('0x53')){var _0x4a8c88=_0x306051[_0xb637('0x54')]({'plain':!![]});return db[_0xb637('0x56')][_0xb637('0x46')]({'where':{'name':_0xb637('0x21'),'userProfileId':_0x5c57e9[_0xb637('0x57')]},'raw':!![]})['then'](function(_0x183241){if(_0x183241&&_0x183241['autoAssociation']===0x0){return db['UserProfileResource'][_0xb637('0x49')]({'name':_0x4a8c88[_0xb637('0x27')],'resourceId':_0x4a8c88['id'],'type':_0x183241['name'],'sectionId':_0x183241['id']},{})[_0xb637('0x1f')](function(){return _0x306051;});}else{return _0x306051;}})[_0xb637('0x42')](function(_0x35ba25){logger[_0xb637('0x25')](_0xb637('0x58'),_0x35ba25);});}return _0x306051;});})['then'](respondWithResult(_0x164dfc,0xc9))[_0xb637('0x42')](handleError(_0x164dfc,null));};exports[_0xb637('0x20')]=function(_0x4c3129,_0x21d927,_0x44476f){var _0x246e3d;return db[_0xb637('0x2b')]['find']({'where':{'id':_0x4c3129['params']['id']}})[_0xb637('0x1f')](function(_0x537986){if(_0x537986){return db['sequelize'][_0xb637('0x4b')](function(_0x51d200){return _0x537986[_0xb637('0x20')]({'transaction':_0x51d200,'raw':!![]})[_0xb637('0x1f')](function(_0x277fc6){if(_0x277fc6['directory']){fs[_0xb637('0x59')](_0x277fc6['directory'])[_0xb637('0x5a')](function(_0x2f3e5a){fs['unlinkSync'](path[_0xb637('0x4e')](_0x277fc6['directory'],_0x2f3e5a));});fs[_0xb637('0x5b')](_0x277fc6['directory']);}return _0x277fc6;});})[_0xb637('0x42')](function(_0x5d9095){throw new db[(_0xb637('0x5c'))][(_0xb637('0x5d'))](_0x5d9095['message']);});}})['then'](handleEntityNotFound(_0x21d927,null))[_0xb637('0x1f')](removeEntity(_0x21d927,null))[_0xb637('0x42')](handleError(_0x21d927,null));};exports[_0xb637('0x5e')]=function(_0x4f4c64,_0x266442,_0x21ed14){return db[_0xb637('0x4a')]['transaction'](function(_0x2eaf65){var _0x2695ed;return db[_0xb637('0x2b')]['find']({'where':{'id':_0x4f4c64[_0xb637('0x44')]['id']}})[_0xb637('0x1f')](function(_0x22ee9b){if(_0x22ee9b){_0x2695ed=_0x22ee9b;return _0x22ee9b[_0xb637('0x5e')](_0x4f4c64[_0xb637('0x48')]['id'],{'transaction':_0x2eaf65});}})[_0xb637('0x1f')](function(_0x645acf){if(_0x645acf){return db[_0xb637('0x5f')][_0xb637('0x60')]({'where':{'id':_0x4f4c64[_0xb637('0x48')]['id']},'attributes':['id',_0xb637('0x27'),_0xb637('0x61'),'converted_format',_0xb637('0x62')],'raw':!![]});}})['then'](function(_0x51d6d1){if(_0x51d6d1){var _0x129d03=path[_0xb637('0x4e')](config[_0xb637('0x4f')],_0xb637('0x63'),util[_0xb637('0x64')]('%s.%s',path['basename'](_0x51d6d1[_0xb637('0x61')],path[_0xb637('0x65')](_0x51d6d1[_0xb637('0x61')])),_0x51d6d1['converted_format']));var _0x41d3f3=path[_0xb637('0x4e')](config[_0xb637('0x4f')],_0xb637('0x50'),_0x2695ed[_0xb637('0x27')],util['format'](_0xb637('0x66'),_0x51d6d1[_0xb637('0x27')],_0x51d6d1[_0xb637('0x67')]));fs[_0xb637('0x68')](_0x129d03,_0x41d3f3);return _0x51d6d1;}})[_0xb637('0x42')](function(_0x48bc8a){throw new db[(_0xb637('0x5c'))][(_0xb637('0x5d'))](_0x48bc8a[_0xb637('0x69')]);});})[_0xb637('0x1f')](handleEntityNotFound(_0x266442,null))[_0xb637('0x1f')](respondWithResult(_0x266442,0xc9))[_0xb637('0x42')](handleError(_0x266442,null));};exports[_0xb637('0x6a')]=function(_0x122ab8,_0x33e45f,_0x46a7c9){return db[_0xb637('0x4a')][_0xb637('0x4b')](function(_0x57701a){var _0x4e89ef;return db[_0xb637('0x2b')]['findOne']({'where':{'id':_0x122ab8[_0xb637('0x44')]['id']}})[_0xb637('0x1f')](handleEntityNotFound(_0x33e45f,null))[_0xb637('0x1f')](function(_0x40e12b){if(_0x40e12b){_0x4e89ef=_0x40e12b;return _0x40e12b[_0xb637('0x6a')](_0x122ab8[_0xb637('0x44')][_0xb637('0x6b')]);}})[_0xb637('0x1f')](function(_0xab4306){if(_0xab4306){return db[_0xb637('0x5f')]['findOne']({'where':{'id':_0x122ab8[_0xb637('0x44')]['id2']},'attributes':['id',_0xb637('0x27'),'save_name',_0xb637('0x67'),'createdAt'],'raw':!![]});}})[_0xb637('0x1f')](function(_0x39379f){if(_0x39379f){fs[_0xb637('0x6c')](path[_0xb637('0x4e')](_0x4e89ef[_0xb637('0x4d')],util[_0xb637('0x64')](_0xb637('0x66'),_0x39379f[_0xb637('0x27')],_0x39379f['converted_format'])));return _0x39379f;}})['catch'](function(_0x5567ff){throw new db[(_0xb637('0x5c'))]['ValidationError'](_0x5567ff[_0xb637('0x69')]);});})[_0xb637('0x1f')](handleEntityNotFound(_0x33e45f,null))['then'](respondWithStatusCode(_0x33e45f,0xcc))[_0xb637('0x42')](handleError(_0x33e45f,null));};exports[_0xb637('0x6d')]=function(_0x2021d4,_0x3d9e48,_0x3c7182){var _0x3eb021={};var _0x23c8b8={};var _0x33f693;var _0x58a70e;return db[_0xb637('0x2b')][_0xb637('0x60')]({'where':{'id':_0x2021d4[_0xb637('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d9e48,null))[_0xb637('0x1f')](function(_0x55aac1){if(_0x55aac1){_0x33f693=_0x55aac1;_0x23c8b8[_0xb637('0x2f')]=_[_0xb637('0x30')](db[_0xb637('0x5f')][_0xb637('0x2c')]);_0x23c8b8[_0xb637('0x32')]=_[_0xb637('0x30')](_0x2021d4[_0xb637('0x32')]);_0x23c8b8[_0xb637('0x31')]=_[_0xb637('0x34')](_0x23c8b8[_0xb637('0x2f')],_0x23c8b8[_0xb637('0x32')]);_0x3eb021[_0xb637('0x33')]=_[_0xb637('0x34')](_0x23c8b8[_0xb637('0x2f')],qs[_0xb637('0x35')](_0x2021d4[_0xb637('0x32')][_0xb637('0x35')]));_0x3eb021[_0xb637('0x33')]=_0x3eb021[_0xb637('0x33')][_0xb637('0x36')]?_0x3eb021[_0xb637('0x33')]:_0x23c8b8[_0xb637('0x2f')];_0x3eb021['order']=qs[_0xb637('0x3a')](_0x2021d4[_0xb637('0x32')][_0xb637('0x3a')]);_0x3eb021[_0xb637('0x3d')]=qs[_0xb637('0x31')](_[_0xb637('0x3b')](_0x2021d4[_0xb637('0x32')],_0x23c8b8[_0xb637('0x31')]));if(_0x2021d4[_0xb637('0x32')][_0xb637('0x3c')]){_0x3eb021[_0xb637('0x3d')]=_[_0xb637('0x3f')](_0x3eb021[_0xb637('0x3d')],{'$or':_[_0xb637('0x2a')](_0x3eb021['attributes'],function(_0x20860a){var _0x1c29a8={};_0x1c29a8[_0x20860a]={'$like':'%'+_0x2021d4['query'][_0xb637('0x3c')]+'%'};return _0x1c29a8;})});}_0x3eb021=_['merge']({},_0x3eb021,_0x2021d4[_0xb637('0x40')]);return _0x33f693[_0xb637('0x6d')](_0x3eb021);}})[_0xb637('0x1f')](function(_0xba7442){if(_0xba7442){_0x58a70e=_0xba7442[_0xb637('0x36')];if(!_0x2021d4[_0xb637('0x32')][_0xb637('0x37')](_0xb637('0x38'))){_0x3eb021['limit']=qs['limit'](_0x2021d4['query']['limit']);_0x3eb021[_0xb637('0x1b')]=qs[_0xb637('0x1b')](_0x2021d4[_0xb637('0x32')][_0xb637('0x1b')]);}return _0x33f693['getSounds'](_0x3eb021);}})['then'](function(_0x48dd6f){if(_0x48dd6f){return _0x48dd6f?{'count':_0x58a70e,'rows':_0x48dd6f}:null;}})[_0xb637('0x1f')](respondWithResult(_0x3d9e48,null))[_0xb637('0x42')](handleError(_0x3d9e48,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 40b10bd..ec209cd 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 _0x2dfd=['./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf6b925,_0x6d05ee){var _0x262cd8=function(_0xaaf053){while(--_0xaaf053){_0xf6b925['push'](_0xf6b925['shift']());}};_0x262cd8(++_0x6d05ee);}(_0x2dfd,0x12f));var _0xd2df=function(_0x654425,_0x5f3079){_0x654425=_0x654425-0x0;var _0xa05488=_0x2dfd[_0x654425];return _0xa05488;};'use strict';var _=require(_0xd2df('0x0'));var util=require(_0xd2df('0x1'));var logger=require(_0xd2df('0x2'))('api');var moment=require(_0xd2df('0x3'));var BPromise=require(_0xd2df('0x4'));var rp=require(_0xd2df('0x5'));var fs=require('fs');var path=require(_0xd2df('0x6'));var rimraf=require(_0xd2df('0x7'));var config=require(_0xd2df('0x8'));var attributes=require(_0xd2df('0x9'));module[_0xd2df('0xa')]=function(_0xaadff2,_0x48b910){return _0xaadff2[_0xd2df('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0xd2df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dca=['define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9dca,0x188));var _0xa9dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa9dc('0x0'));var util=require(_0xa9dc('0x1'));var logger=require(_0xa9dc('0x2'))(_0xa9dc('0x3'));var moment=require('moment');var BPromise=require(_0xa9dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9dc('0x5'));var attributes=require(_0xa9dc('0x6'));module[_0xa9dc('0x7')]=function(_0x31fcdd,_0x490856){return _0x31fcdd[_0xa9dc('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xa9dc('0x9'),'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 c499f0e..8f8ab48 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x128e6e,_0x35d3f9){var _0xb44cd5=function(_0x2ebe84){while(--_0x2ebe84){_0x128e6e['push'](_0x128e6e['shift']());}};_0xb44cd5(++_0x35d3f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xcb91[_0x4b73a2];return _0x383c66;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x5f446e,_0x24c66b){var _0x384a84=function(_0x2251c2){while(--_0x2251c2){_0x5f446e['push'](_0x5f446e['shift']());}};_0x384a84(++_0x24c66b);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e35420b..f1a91c6 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 _0x3f47=['/describe','isAuthenticated','describe','show','/:id/users','getAgents','/:id/teams','getTeams','create','addAgents','post','addTeams','put','/:id','update','delete','removeAgents','removeTeams','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index'];(function(_0x1c6188,_0x3a9c35){var _0x2feabd=function(_0x23495f){while(--_0x23495f){_0x1c6188['push'](_0x1c6188['shift']());}};_0x2feabd(++_0x3a9c35);}(_0x3f47,0x10e));var _0x73f4=function(_0x29ae5c,_0x4368f4){_0x29ae5c=_0x29ae5c-0x0;var _0x1b3c5e=_0x3f47[_0x29ae5c];return _0x1b3c5e;};'use strict';var multer=require(_0x73f4('0x0'));var util=require(_0x73f4('0x1'));var path=require('path');var timeout=require(_0x73f4('0x2'));var express=require('express');var router=express[_0x73f4('0x3')]();var fs_extra=require(_0x73f4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73f4('0x5'));var config=require(_0x73f4('0x6'));var controller=require(_0x73f4('0x7'));router[_0x73f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x73f4('0x9')]);router[_0x73f4('0x8')](_0x73f4('0xa'),auth[_0x73f4('0xb')](),controller[_0x73f4('0xc')]);router[_0x73f4('0x8')]('/:id',auth[_0x73f4('0xb')](),controller[_0x73f4('0xd')]);router[_0x73f4('0x8')](_0x73f4('0xe'),auth[_0x73f4('0xb')](),controller[_0x73f4('0xf')]);router[_0x73f4('0x8')](_0x73f4('0x10'),auth[_0x73f4('0xb')](),controller[_0x73f4('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x73f4('0x12')]);router['post'](_0x73f4('0xe'),auth[_0x73f4('0xb')](),controller[_0x73f4('0x13')]);router[_0x73f4('0x14')](_0x73f4('0x10'),auth['isAuthenticated'](),controller[_0x73f4('0x15')]);router[_0x73f4('0x16')](_0x73f4('0x17'),auth[_0x73f4('0xb')](),controller[_0x73f4('0x18')]);router[_0x73f4('0x19')]('/:id',auth[_0x73f4('0xb')](),controller['destroy']);router['delete'](_0x73f4('0xe'),auth[_0x73f4('0xb')](),controller[_0x73f4('0x1a')]);router['delete'](_0x73f4('0x10'),auth[_0x73f4('0xb')](),controller[_0x73f4('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa41a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','describe','/:id','show','get','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','put','update','delete','removeAgents','removeTeams','exports','multer','util','connect-timeout','express','Router'];(function(_0x390801,_0x43ec03){var _0x5381f9=function(_0x42f265){while(--_0x42f265){_0x390801['push'](_0x390801['shift']());}};_0x5381f9(++_0x43ec03);}(_0xa41a,0x6b));var _0xaa41=function(_0x4bde3e,_0x4ae680){_0x4bde3e=_0x4bde3e-0x0;var _0x2e37bb=_0xa41a[_0x4bde3e];return _0x2e37bb;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/describe',auth[_0xaa41('0xa')](),controller[_0xaa41('0xc')]);router['get'](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xf')](_0xaa41('0x10'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x11')]);router[_0xaa41('0xf')](_0xaa41('0x12'),auth['isAuthenticated'](),controller[_0xaa41('0x13')]);router[_0xaa41('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaa41('0x14')]('/:id/users',auth[_0xaa41('0xa')](),controller[_0xaa41('0x15')]);router[_0xaa41('0x14')](_0xaa41('0x12'),auth[_0xaa41('0xa')](),controller['addTeams']);router[_0xaa41('0x16')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0xd'),auth[_0xaa41('0xa')](),controller['destroy']);router[_0xaa41('0x18')](_0xaa41('0x10'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x19')]);router[_0xaa41('0x18')](_0xaa41('0x12'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 0925a34..a351710 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 _0x4137=['name','getDataValue','INTEGER','sequelize','STRING'];(function(_0x518cb6,_0x3b603a){var _0x3dc6b0=function(_0x4c1835){while(--_0x4c1835){_0x518cb6['push'](_0x518cb6['shift']());}};_0x3dc6b0(++_0x3b603a);}(_0x4137,0x157));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x7413('0x0'));module['exports']={'name':{'type':Sequelize[_0x7413('0x1')],'allowNull':![],'unique':_0x7413('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5cd136){return'system-'+this[_0x7413('0x3')]('name')+'-';}},'description':{'type':Sequelize[_0x7413('0x1')]},'callerIdAll':{'type':Sequelize[_0x7413('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x7413('0x4')]}}; \ No newline at end of file +var _0x15fe=['system-','getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x54f423,_0x2cde1d){var _0x2f80a9=function(_0x35c597){while(--_0x35c597){_0x54f423['push'](_0x54f423['shift']());}};_0x2f80a9(++_0x2cde1d);}(_0x15fe,0x144));var _0xe15f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe15f('0x0'));module[_0xe15f('0x1')]={'name':{'type':Sequelize[_0xe15f('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xe15f('0x3')],'get':function(_0xe34c55){return _0xe15f('0x4')+this[_0xe15f('0x5')](_0xe15f('0x6'))+'-';}},'description':{'type':Sequelize[_0xe15f('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xe15f('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 91b9ba0..d34ba57 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 _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1c9a,0x98));var _0xa1c9=function(_0x115cc0,_0x485bfc){_0x115cc0=_0x115cc0-0x0;var _0x1b3245=_0x1c9a[_0x115cc0];return _0x1b3245;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file +var _0x1399=['Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','each','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./voicePrefix.socket','register','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','VoicePrefix','findAll','catch','show','params','includeAll','find','describe','transaction','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','error','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate'];(function(_0x9b12da,_0xf22341){var _0x263db6=function(_0x1b740f){while(--_0x1b740f){_0x9b12da['push'](_0x9b12da['shift']());}};_0x263db6(++_0xf22341);}(_0x1399,0x16c));var _0x9139=function(_0x436adc,_0x5c9ae1){_0x436adc=_0x436adc-0x0;var _0x421a87=_0x1399[_0x436adc];return _0x421a87;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9139('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9139('0x17'))(new Redis(config[_0x9139('0x16')]));require(_0x9139('0x18'))[_0x9139('0x19')](socket);function respondWithStatusCode(_0x5936d2,_0x3b1f21){_0x3b1f21=_0x3b1f21||0xcc;return function(_0x4d1a85){if(_0x4d1a85){return _0x5936d2['sendStatus'](_0x3b1f21);}return _0x5936d2['status'](_0x3b1f21)[_0x9139('0x1a')]();};}function respondWithResult(_0x3e2bad,_0x1cd24e){_0x1cd24e=_0x1cd24e||0xc8;return function(_0x3fadf7){if(_0x3fadf7){return _0x3e2bad[_0x9139('0x1b')](_0x1cd24e)[_0x9139('0x1c')](_0x3fadf7);}};}function respondWithFilteredResult(_0x4bd957,_0x57b9df){return function(_0x13cab8){if(_0x13cab8){var _0xe39cbc=typeof _0x57b9df['offset']==='undefined'&&typeof _0x57b9df[_0x9139('0x1d')]===_0x9139('0x1e');var _0x56add4=_0x13cab8[_0x9139('0x1f')];var _0x1ef57b=_0xe39cbc?0x0:_0x57b9df[_0x9139('0x20')];var _0x3c8296=_0xe39cbc?_0x13cab8[_0x9139('0x1f')]:_0x57b9df[_0x9139('0x20')]+_0x57b9df[_0x9139('0x1d')];var _0x45fa16;if(_0x3c8296>=_0x56add4){_0x3c8296=_0x56add4;_0x45fa16=0xc8;}else{_0x45fa16=0xce;}_0x4bd957[_0x9139('0x1b')](_0x45fa16);return _0x4bd957[_0x9139('0x21')](_0x9139('0x22'),_0x1ef57b+'-'+_0x3c8296+'/'+_0x56add4)[_0x9139('0x1c')](_0x13cab8);}return null;};}function patchUpdates(_0x5a3e2e){return function(_0x105170){try{jsonpatch[_0x9139('0x23')](_0x105170,_0x5a3e2e,!![]);}catch(_0x31635a){return BPromise[_0x9139('0x24')](_0x31635a);}return _0x105170[_0x9139('0x25')]();};}function saveUpdates(_0x1a7350,_0x4b7fe0){return function(_0x28bf7d){if(_0x28bf7d){return _0x28bf7d[_0x9139('0x26')](_0x1a7350)['then'](function(_0x3ed4da){return _0x3ed4da;});}return null;};}function removeEntity(_0x2ee4bb,_0x10bfa0){return function(_0x4a3ed2){if(_0x4a3ed2){return _0x4a3ed2[_0x9139('0x27')]()[_0x9139('0x28')](function(){var _0x49d01e=_0x4a3ed2[_0x9139('0x29')]({'plain':!![]});var _0x39e8cf=_0x9139('0x2a');return db['UserProfileResource'][_0x9139('0x27')]({'where':{'type':_0x39e8cf,'resourceId':_0x49d01e['id']}})[_0x9139('0x28')](function(){return _0x4a3ed2;});})[_0x9139('0x28')](function(){_0x2ee4bb[_0x9139('0x1b')](0xcc)[_0x9139('0x1a')]();});}};}function handleEntityNotFound(_0x16dfb4,_0xfe6854){return function(_0x573a05){if(!_0x573a05){_0x16dfb4['sendStatus'](0x194);}return _0x573a05;};}function handleError(_0x1b3fd9,_0x22d0f8){_0x22d0f8=_0x22d0f8||0x1f4;return function(_0xd27355){logger['error'](_0xd27355['stack']);if(_0xd27355[_0x9139('0x2b')]){delete _0xd27355[_0x9139('0x2b')];}_0x1b3fd9[_0x9139('0x1b')](_0x22d0f8)[_0x9139('0x2c')](_0xd27355);};}exports[_0x9139('0x2d')]=function(_0x541644,_0x5a1673){var _0x2f26de={},_0x57a6fb={},_0x4de1a2={'count':0x0,'rows':[]};var _0x222429=_[_0x9139('0x2e')](db['VoicePrefix'][_0x9139('0x2f')],function(_0xe658c2){return{'name':_0xe658c2['fieldName'],'type':_0xe658c2[_0x9139('0x30')][_0x9139('0x31')]};});_0x57a6fb[_0x9139('0x32')]=_[_0x9139('0x2e')](_0x222429,_0x9139('0x2b'));_0x57a6fb[_0x9139('0x33')]=_[_0x9139('0x34')](_0x541644[_0x9139('0x33')]);_0x57a6fb[_0x9139('0x35')]=_[_0x9139('0x36')](_0x57a6fb[_0x9139('0x32')],_0x57a6fb['query']);_0x2f26de[_0x9139('0x37')]=_[_0x9139('0x36')](_0x57a6fb['model'],qs[_0x9139('0x38')](_0x541644[_0x9139('0x33')][_0x9139('0x38')]));_0x2f26de['attributes']=_0x2f26de[_0x9139('0x37')][_0x9139('0x39')]?_0x2f26de[_0x9139('0x37')]:_0x57a6fb[_0x9139('0x32')];if(!_0x541644[_0x9139('0x33')][_0x9139('0x3a')](_0x9139('0x3b'))){_0x2f26de[_0x9139('0x1d')]=qs[_0x9139('0x1d')](_0x541644[_0x9139('0x33')]['limit']);_0x2f26de[_0x9139('0x20')]=qs[_0x9139('0x20')](_0x541644[_0x9139('0x33')][_0x9139('0x20')]);}_0x2f26de[_0x9139('0x3c')]=qs[_0x9139('0x3d')](_0x541644[_0x9139('0x33')]['sort']);_0x2f26de[_0x9139('0x3e')]=qs['filters'](_[_0x9139('0x3f')](_0x541644[_0x9139('0x33')],_0x57a6fb[_0x9139('0x35')]),_0x222429);if(_0x541644['query'][_0x9139('0x40')]){_0x2f26de[_0x9139('0x3e')]=_[_0x9139('0x41')](_0x2f26de[_0x9139('0x3e')],{'$or':_[_0x9139('0x2e')](_0x222429,function(_0xe90991){if(_0xe90991[_0x9139('0x30')]!==_0x9139('0x42')){var _0x118d53={};_0x118d53[_0xe90991[_0x9139('0x2b')]]={'$like':'%'+_0x541644['query'][_0x9139('0x40')]+'%'};return _0x118d53;}})});}_0x2f26de=_[_0x9139('0x41')]({},_0x2f26de,_0x541644[_0x9139('0x43')]);var _0x4b8dd7={'where':_0x2f26de['where']};return db['VoicePrefix'][_0x9139('0x1f')](_0x4b8dd7)[_0x9139('0x28')](function(_0x3611b4){_0x4de1a2[_0x9139('0x1f')]=_0x3611b4;if(_0x541644[_0x9139('0x33')]['includeAll']){_0x2f26de[_0x9139('0x44')]=[{'all':!![]}];}return db[_0x9139('0x45')][_0x9139('0x46')](_0x2f26de);})[_0x9139('0x28')](function(_0x2197ff){_0x4de1a2['rows']=_0x2197ff;return _0x4de1a2;})[_0x9139('0x28')](respondWithFilteredResult(_0x5a1673,_0x2f26de))[_0x9139('0x47')](handleError(_0x5a1673,null));};exports[_0x9139('0x48')]=function(_0x197891,_0x539a55){var _0x5b0aec={'raw':![],'where':{'id':_0x197891[_0x9139('0x49')]['id']}},_0x39d3dc={};_0x39d3dc['model']=_['keys'](db[_0x9139('0x45')][_0x9139('0x2f')]);_0x39d3dc['query']=_[_0x9139('0x34')](_0x197891[_0x9139('0x33')]);_0x39d3dc['filters']=_[_0x9139('0x36')](_0x39d3dc['model'],_0x39d3dc['query']);_0x5b0aec[_0x9139('0x37')]=_[_0x9139('0x36')](_0x39d3dc[_0x9139('0x32')],qs[_0x9139('0x38')](_0x197891[_0x9139('0x33')]['fields']));_0x5b0aec[_0x9139('0x37')]=_0x5b0aec[_0x9139('0x37')][_0x9139('0x39')]?_0x5b0aec['attributes']:_0x39d3dc[_0x9139('0x32')];if(_0x197891[_0x9139('0x33')][_0x9139('0x4a')]){_0x5b0aec[_0x9139('0x44')]=[{'all':!![]}];}_0x5b0aec=_[_0x9139('0x41')]({},_0x5b0aec,_0x197891[_0x9139('0x43')]);return db[_0x9139('0x45')][_0x9139('0x4b')](_0x5b0aec)[_0x9139('0x28')](handleEntityNotFound(_0x539a55,null))[_0x9139('0x28')](respondWithResult(_0x539a55,null))[_0x9139('0x47')](handleError(_0x539a55,null));};exports['destroy']=function(_0x10eb03,_0x2e1bbe){return db[_0x9139('0x45')]['find']({'where':{'id':_0x10eb03[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x2e1bbe,null))['then'](removeEntity(_0x2e1bbe,null))[_0x9139('0x47')](handleError(_0x2e1bbe,null));};exports[_0x9139('0x4c')]=function(_0x83f1d2,_0x5180b5){return db[_0x9139('0x45')][_0x9139('0x4c')]()[_0x9139('0x28')](respondWithResult(_0x5180b5,null))[_0x9139('0x47')](handleError(_0x5180b5,null));};exports['create']=function(_0x2b6948,_0x1a2a2d){var _0x3ba071;return db['sequelize'][_0x9139('0x4d')](function(_0x146201){return db[_0x9139('0x45')][_0x9139('0x4e')](_0x2b6948[_0x9139('0x4f')],{'transaction':_0x146201})[_0x9139('0x28')](function(_0x2b22fa){_0x3ba071=_0x2b22fa['get']({'plain':!![]});return db[_0x9139('0x50')][_0x9139('0x4b')]({'where':{'id':_0x3ba071['VoiceExtensionId']},'raw':!![]})[_0x9139('0x28')](function(_0x1e1290){return createVoicePrefixExtensions(_0x3ba071,_0x1e1290,_0x146201);});});})[_0x9139('0x28')](function(){var _0x1a0841=_0x2b6948[_0x9139('0x51')]['get']({'plain':!![]});if(!_0x1a0841)throw new Error(_0x9139('0x52'));if(_0x1a0841[_0x9139('0x53')]==='user'){var _0x500863=_0x3ba071;return db[_0x9139('0x54')][_0x9139('0x4b')]({'where':{'name':_0x9139('0x2a'),'userProfileId':_0x1a0841['userProfileId']},'raw':!![]})[_0x9139('0x28')](function(_0x576b5a){if(_0x576b5a&&_0x576b5a['autoAssociation']===0x0){return db[_0x9139('0x55')][_0x9139('0x4e')]({'name':_0x500863[_0x9139('0x2b')],'resourceId':_0x500863['id'],'type':_0x576b5a[_0x9139('0x2b')],'sectionId':_0x576b5a['id']},{})['then'](function(){return _0x3ba071;});}else{return _0x3ba071;}})[_0x9139('0x47')](function(_0x91a5a8){logger[_0x9139('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x91a5a8);throw _0x91a5a8;});}return _0x3ba071;})[_0x9139('0x28')](respondWithResult(_0x1a2a2d,null))[_0x9139('0x47')](handleError(_0x1a2a2d,null));};function Extension(_0x25cf0f,_0x73d4fc,_0x163730,_0x3f7e41){this[_0x9139('0x57')]=_0x9139('0x58');this[_0x9139('0x59')]=_0x25cf0f;this[_0x9139('0x5a')]=_0x163730;this[_0x9139('0x30')]=_0x9139('0x5b');this[_0x9139('0x5c')]=_0x9139('0x5d');this['priority']=_0x73d4fc;this[_0x9139('0x5e')]=_0x3f7e41;}function createVoicePrefixExtensions(_0x32b31b,_0x3ef34c,_0x37433c){return new BPromise(function(_0x40afea,_0x53c09a){var _0x3feaac=new Extension(formatPrefixName(_0x32b31b[_0x9139('0x5f')]),0x1,_0x9139('0x60'),_0x9139('0x61'));_0x3feaac[_0x9139('0x62')]=_0x32b31b['id'];return db['VoiceExtension']['create'](_0x3feaac,{'transaction':_0x37433c})[_0x9139('0x28')](function(_0x3a0bc6){var _0x4b0274=_0x3a0bc6[_0x9139('0x29')]({'plain':!![]});var _0xd20c65=_[_0x9139('0x2e')](addVoicePrefixExtensions(_0x32b31b,_0x3ef34c),function(_0x4c125e){_0x4c125e[_0x9139('0x63')]=_0x4b0274['id'];_0x4c125e[_0x9139('0x62')]=_0x32b31b['id'];return _0x4c125e;});return db[_0x9139('0x50')][_0x9139('0x64')](_0xd20c65,{'transaction':_0x37433c})[_0x9139('0x28')](function(_0x53a27f){if(!_0x53a27f){return _0x53c09a(_0x9139('0x65'));}else{return _0x40afea(_0x53a27f);}})[_0x9139('0x47')](function(_0x336230){return _0x53c09a(_0x336230);});});;});};function addVoicePrefixExtensions(_0x26fe55,_0x4f6e7c){var _0x53152f=[];var _0x46b5cb=formatPrefixName(_0x26fe55[_0x9139('0x5f')]);_0x53152f[_0x9139('0x66')](new Extension(_0x46b5cb,0x2,_0x9139('0x67'),'CDR(prefix)='+_0x26fe55[_0x9139('0x2b')]));if(_0x26fe55[_0x9139('0x68')]){_0x53152f['push'](new Extension(_0x46b5cb,0x3,_0x9139('0x67'),_0x9139('0x69')+_0x26fe55[_0x9139('0x68')]));}else{_0x53152f[_0x9139('0x66')](new Extension(_0x46b5cb,0x3,_0x9139('0x60'),_0x9139('0x6a')));}_0x53152f[_0x9139('0x66')](new Extension(_0x46b5cb,0x4,_0x9139('0x6b'),_0x4f6e7c['context']+','+'${EXTEN:'+(0x8+_0x26fe55['name'][_0x9139('0x39')])+'}'+','+0x1));return _0x53152f;}function formatPrefixName(_0x1025d6){var _0x2235fb='_';for(var _0x4eefd8=0x0;_0x4eefd8<_0x1025d6[_0x9139('0x39')];_0x4eefd8++){if(_0x1025d6[_0x9139('0x6c')](_0x4eefd8)=='-'){_0x2235fb+=_0x1025d6[_0x9139('0x6c')](_0x4eefd8);}else{_0x2235fb+='['+_0x1025d6[_0x9139('0x6c')](_0x4eefd8)+']';}}_0x2235fb+='.';return _0x2235fb;}exports[_0x9139('0x26')]=function(_0x3aacdb,_0x5d9ae8,_0x437d18){var _0x582b67=_0x3aacdb[_0x9139('0x4f')];_0x582b67['prefix']=_0x9139('0x6d')+_0x582b67[_0x9139('0x2b')]+'-';return db['sequelize']['transaction'](function(_0x4324ed){return db[_0x9139('0x45')][_0x9139('0x26')](_0x582b67,{'where':{'id':_0x582b67['id']},'transaction':_0x4324ed})['then'](function(){return db[_0x9139('0x50')][_0x9139('0x27')]({'where':{'VoicePrefixId':_0x582b67['id']},'transaction':_0x4324ed})[_0x9139('0x28')](function(){return db[_0x9139('0x50')]['find']({'where':{'id':_0x582b67['VoiceExtensionId']},'raw':!![]})[_0x9139('0x28')](function(_0x2462fc){return createVoicePrefixExtensions(_0x582b67,_0x2462fc,_0x4324ed);});});});})['then'](function(){return db[_0x9139('0x45')][_0x9139('0x6e')](_0x582b67['id']);})[_0x9139('0x28')](respondWithResult(_0x5d9ae8,null))[_0x9139('0x47')](handleError(_0x5d9ae8,null));};exports[_0x9139('0x6f')]=function(_0x400ac9,_0x3c17fd,_0x3167bb){return db[_0x9139('0x45')][_0x9139('0x4b')]({'where':{'id':_0x400ac9[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x3c17fd,null))[_0x9139('0x28')](function(_0x582a47){if(_0x582a47){return _0x582a47[_0x9139('0x6f')](_0x400ac9[_0x9139('0x4f')][_0x9139('0x70')],_[_0x9139('0x71')](_0x400ac9[_0x9139('0x4f')],['ids','id'])||{})[_0x9139('0x72')](function(_0x54cd2a){for(var _0x14868a=0x0;_0x14868a<_0x400ac9[_0x9139('0x4f')][_0x9139('0x70')]['length'];_0x14868a+=0x1){socket[_0x9139('0x73')](_0x9139('0x74'),{'UserId':Number(_0x400ac9['body'][_0x9139('0x70')][_0x14868a]),'VoicePrefixId':Number(_0x400ac9[_0x9139('0x49')]['id'])});}return _0x54cd2a;});}})[_0x9139('0x28')](respondWithResult(_0x3c17fd,null))[_0x9139('0x47')](handleError(_0x3c17fd,null));};exports[_0x9139('0x75')]=function(_0x451458,_0x1abb10,_0x24b8d8){return db[_0x9139('0x45')]['find']({'where':{'id':_0x451458[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x1abb10,null))[_0x9139('0x28')](function(_0x3c3474){if(_0x3c3474){return _0x3c3474[_0x9139('0x75')](_0x451458['query'][_0x9139('0x70')])[_0x9139('0x28')](function(){if(_['isArray'](_0x451458['query'][_0x9139('0x70')])){for(var _0x377234=0x0;_0x377234<_0x451458[_0x9139('0x33')][_0x9139('0x70')]['length'];_0x377234+=0x1){socket[_0x9139('0x73')](_0x9139('0x76'),{'UserId':Number(_0x451458[_0x9139('0x33')][_0x9139('0x70')][_0x377234]),'VoicePrefixId':Number(_0x451458[_0x9139('0x49')]['id'])});}}else{socket[_0x9139('0x73')](_0x9139('0x76'),{'UserId':Number(_0x451458[_0x9139('0x33')][_0x9139('0x70')]),'VoicePrefixId':Number(_0x451458[_0x9139('0x49')]['id'])});}});}})[_0x9139('0x28')](respondWithStatusCode(_0x1abb10,null))[_0x9139('0x47')](handleError(_0x1abb10,null));};exports[_0x9139('0x77')]=function(_0x100c61,_0x1bcf40,_0x402a07){var _0x4152b2={};var _0x43a3d4={};var _0x2d9821;var _0x55ac7a;return db[_0x9139('0x45')][_0x9139('0x78')]({'where':{'id':_0x100c61[_0x9139('0x49')]['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x1bcf40,null))[_0x9139('0x28')](function(_0x4c633e){if(_0x4c633e){_0x2d9821=_0x4c633e;_0x43a3d4[_0x9139('0x32')]=_[_0x9139('0x34')](db[_0x9139('0x79')][_0x9139('0x2f')]);_0x43a3d4[_0x9139('0x33')]=_[_0x9139('0x34')](_0x100c61[_0x9139('0x33')]);_0x43a3d4['filters']=_['intersection'](_0x43a3d4[_0x9139('0x32')],_0x43a3d4[_0x9139('0x33')]);_0x4152b2[_0x9139('0x37')]=_[_0x9139('0x36')](_0x43a3d4['model'],qs['fields'](_0x100c61[_0x9139('0x33')][_0x9139('0x38')]));_0x4152b2[_0x9139('0x37')]=_0x4152b2[_0x9139('0x37')][_0x9139('0x39')]?_0x4152b2[_0x9139('0x37')]:_0x43a3d4[_0x9139('0x32')];_0x4152b2[_0x9139('0x3c')]=qs[_0x9139('0x3d')](_0x100c61['query'][_0x9139('0x3d')]);_0x4152b2['where']=qs[_0x9139('0x35')](_[_0x9139('0x3f')](_0x100c61[_0x9139('0x33')],_0x43a3d4[_0x9139('0x35')]));if(_0x100c61['query']['filter']){_0x4152b2[_0x9139('0x3e')]=_[_0x9139('0x41')](_0x4152b2[_0x9139('0x3e')],{'$or':_[_0x9139('0x2e')](_0x4152b2[_0x9139('0x37')],function(_0x49bdc7){var _0x47e8bf={};_0x47e8bf[_0x49bdc7]={'$like':'%'+_0x100c61[_0x9139('0x33')]['filter']+'%'};return _0x47e8bf;})});}_0x4152b2=_[_0x9139('0x41')]({},_0x4152b2,_0x100c61[_0x9139('0x43')]);return _0x2d9821[_0x9139('0x77')](_0x4152b2);}})['then'](function(_0x22ce9c){if(_0x22ce9c){_0x55ac7a=_0x22ce9c[_0x9139('0x39')];if(!_0x100c61[_0x9139('0x33')][_0x9139('0x3a')](_0x9139('0x3b'))){_0x4152b2[_0x9139('0x1d')]=qs['limit'](_0x100c61[_0x9139('0x33')][_0x9139('0x1d')]);_0x4152b2[_0x9139('0x20')]=qs[_0x9139('0x20')](_0x100c61['query']['offset']);}return _0x2d9821[_0x9139('0x77')](_0x4152b2);}})[_0x9139('0x28')](function(_0x4fe06f){if(_0x4fe06f){return _0x4fe06f?{'count':_0x55ac7a,'rows':_0x4fe06f}:null;}})['then'](respondWithResult(_0x1bcf40,null))[_0x9139('0x47')](handleError(_0x1bcf40,null));};exports['getTeams']=function(_0x43514f,_0x550504,_0x580185){var _0x21c1e0={};var _0x2ed30b={};var _0x7eeefb;var _0x22349d;return db[_0x9139('0x45')]['findOne']({'where':{'id':_0x43514f['params']['id']}})[_0x9139('0x28')](handleEntityNotFound(_0x550504,null))[_0x9139('0x28')](function(_0x459e1e){if(_0x459e1e){_0x7eeefb=_0x459e1e;_0x2ed30b[_0x9139('0x32')]=_['keys'](db[_0x9139('0x7a')]['rawAttributes']);_0x2ed30b[_0x9139('0x33')]=_[_0x9139('0x34')](_0x43514f[_0x9139('0x33')]);_0x2ed30b['filters']=_[_0x9139('0x36')](_0x2ed30b['model'],_0x2ed30b['query']);_0x21c1e0[_0x9139('0x37')]=_[_0x9139('0x36')](_0x2ed30b[_0x9139('0x32')],qs['fields'](_0x43514f[_0x9139('0x33')]['fields']));_0x21c1e0[_0x9139('0x37')]=_0x21c1e0[_0x9139('0x37')][_0x9139('0x39')]?_0x21c1e0[_0x9139('0x37')]:_0x2ed30b[_0x9139('0x32')];_0x21c1e0[_0x9139('0x3c')]=qs['sort'](_0x43514f['query'][_0x9139('0x3d')]);_0x21c1e0[_0x9139('0x3e')]=qs[_0x9139('0x35')](_[_0x9139('0x3f')](_0x43514f[_0x9139('0x33')],_0x2ed30b['filters']));if(_0x43514f['query'][_0x9139('0x40')]){_0x21c1e0[_0x9139('0x3e')]=_[_0x9139('0x41')](_0x21c1e0[_0x9139('0x3e')],{'$or':_[_0x9139('0x2e')](_0x21c1e0[_0x9139('0x37')],function(_0x5614df){var _0x55e8d7={};_0x55e8d7[_0x5614df]={'$like':'%'+_0x43514f[_0x9139('0x33')][_0x9139('0x40')]+'%'};return _0x55e8d7;})});}_0x21c1e0=_[_0x9139('0x41')]({},_0x21c1e0,_0x43514f['options']);return _0x7eeefb['getTeams'](_0x21c1e0);}})[_0x9139('0x28')](function(_0x4f8488){if(_0x4f8488){_0x22349d=_0x4f8488[_0x9139('0x39')];if(!_0x43514f['query'][_0x9139('0x3a')](_0x9139('0x3b'))){_0x21c1e0['limit']=qs[_0x9139('0x1d')](_0x43514f['query']['limit']);_0x21c1e0[_0x9139('0x20')]=qs[_0x9139('0x20')](_0x43514f[_0x9139('0x33')][_0x9139('0x20')]);}return _0x7eeefb[_0x9139('0x7b')](_0x21c1e0);}})[_0x9139('0x28')](function(_0x4cce2c){if(_0x4cce2c){return _0x4cce2c?{'count':_0x22349d,'rows':_0x4cce2c}:null;}})[_0x9139('0x28')](respondWithResult(_0x550504,null))[_0x9139('0x47')](handleError(_0x550504,null));};exports[_0x9139('0x7c')]=function(_0x387d19,_0x5511ac,_0x2c3437){var _0x24e241=_0x387d19[_0x9139('0x4f')][_0x9139('0x70')];var _0x10c463;return db[_0x9139('0x7a')][_0x9139('0x46')]({'where':{'id':_0x24e241},'attributes':['id'],'include':[{'model':db[_0x9139('0x79')],'as':'Agents','attributes':['id',_0x9139('0x2b'),_0x9139('0x7d'),_0x9139('0x7e'),_0x9139('0x7f')],'raw':!![]}]})[_0x9139('0x28')](function(_0xdbd388){if(_0xdbd388){_0x10c463=_0xdbd388;var _0x6a479a=_[_0x9139('0x80')](_0xdbd388,function(_0x4ab1ed){var _0x4ac0a5=_0x4ab1ed[_0x9139('0x29')]({'plain':!![]});return _0x4ac0a5[_0x9139('0x81')];});return db[_0x9139('0x45')][_0x9139('0x4b')]({'where':{'id':_0x387d19[_0x9139('0x49')]['id']}})[_0x9139('0x28')](function(_0x338cf4){return db[_0x9139('0x82')][_0x9139('0x4d')](function(_0x4ac429){return _0x338cf4[_0x9139('0x7c')](_0x24e241,{'transaction':_0x4ac429})[_0x9139('0x28')](function(){return BPromise[_0x9139('0x83')](_0x10c463,function(_0xee935b){return db['TeamVoicePrefix'][_0x9139('0x84')]({'TeamId':_0xee935b['id'],'VoicePrefixId':_0x387d19['params']['id']},{'transaction':_0x4ac429});});})[_0x9139('0x28')](function(){return BPromise[_0x9139('0x83')](_0x6a479a,function(_0x8ee6f3){return db[_0x9139('0x85')][_0x9139('0x86')]({'where':{'UserId':_0x8ee6f3['id'],'VoicePrefixId':_0x387d19[_0x9139('0x49')]['id']},'transaction':_0x4ac429});});})[_0x9139('0x28')](function(){_0x6a479a[_0x9139('0x87')](function(_0x520457){socket['emit']('userVoicePrefix:save',{'UserId':_0x520457['id'],'VoicePrefixId':_0x338cf4['id']});});});});});}})[_0x9139('0x28')](respondWithStatusCode(_0x5511ac,null))['catch'](handleError(_0x5511ac,null));};exports[_0x9139('0x88')]=function(_0x26e724,_0x31ede0,_0x13f114){return db[_0x9139('0x7a')][_0x9139('0x46')]({'where':{'id':_0x26e724[_0x9139('0x33')][_0x9139('0x70')]},'attributes':['id'],'include':[{'model':db[_0x9139('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9139('0x28')](handleEntityNotFound(_0x31ede0,null))['then'](function(_0x2cc56d){var _0x346236=_[_0x9139('0x2e')](_0x2cc56d,'id');var _0x2c3a84=[];var _0x518031=[];var _0x4e1267=squel[_0x9139('0x89')]();_0x4e1267[_0x9139('0x8a')](_0x9139('0x8b'))[_0x9139('0x8c')](_0x9139('0x8d'),'tq')[_0x9139('0x8e')](_0x9139('0x8f'),'ut',_0x9139('0x90'))[_0x9139('0x3e')](_0x9139('0x91'),_0x26e724['params']['id']);for(var _0x568234=0x0;_0x568234<_0x2cc56d[_0x9139('0x39')];_0x568234+=0x1){let _0x3e41e5=_0x2cc56d[_0x568234];for(var _0x27c1a2=0x0;_0x27c1a2<_0x3e41e5[_0x9139('0x81')][_0x9139('0x39')];_0x27c1a2+=0x1){let _0x40a2a5=_0x3e41e5[_0x9139('0x81')][_0x27c1a2];var _0x194b7d=_0x4e1267['clone']();_0x194b7d[_0x9139('0x3e')](_0x9139('0x92'),_0x40a2a5['id']);_0x518031['push'](db[_0x9139('0x82')][_0x9139('0x33')](_0x194b7d[_0x9139('0x93')](),{'type':db[_0x9139('0x82')][_0x9139('0x94')][_0x9139('0x95')]})[_0x9139('0x28')](function(_0x43ef80){if(_0x43ef80[_0x9139('0x39')]===0x1){return _0x40a2a5['id'];}else{var _0x4cb6ad=_[_0x9139('0x96')](_['map'](_0x43ef80,'TeamId'),function(_0xd0b878){return _[_0x9139('0x97')](_0x346236,_0xd0b878);});if(_0x4cb6ad){return _0x40a2a5['id'];}}}));}}return BPromise[_0x9139('0x98')](_0x518031)[_0x9139('0x28')](function(_0x59cf9d){_0x2c3a84=_(_0x2c3a84)['union'](_0x59cf9d)[_0x9139('0x99')]()[_0x9139('0x9a')]();return db['VoicePrefix'][_0x9139('0x4b')]({'where':{'id':_0x26e724[_0x9139('0x49')]['id']}})['then'](function(_0x18625c){return db['sequelize'][_0x9139('0x4d')](function(_0x20ff88){return _0x18625c[_0x9139('0x88')](_0x26e724[_0x9139('0x33')][_0x9139('0x70')],{'transaction':_0x20ff88})['then'](function(){if(!_['isEmpty'](_0x2c3a84)){return _0x18625c['removeAgents'](_0x2c3a84,{'transaction':_0x20ff88});}})['then'](function(){_0x2c3a84[_0x9139('0x87')](function(_0x4c4081){socket[_0x9139('0x73')](_0x9139('0x76'),{'UserId':_0x4c4081,'VoicePrefixId':_0x18625c['id']});});});});});});})[_0x9139('0x28')](respondWithStatusCode(_0x31ede0,null))[_0x9139('0x47')](handleError(_0x31ede0,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 80e3081..5e4b803 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 _0x39af=['hook','exports','../../mysqldb','VoicePrefix','update','remove','emit'];(function(_0x4f98a0,_0x2a6228){var _0x161a8a=function(_0x1343b4){while(--_0x1343b4){_0x4f98a0['push'](_0x4f98a0['shift']());}};_0x161a8a(++_0x2a6228);}(_0x39af,0xcd));var _0xf39a=function(_0x159f9a,_0x339b13){_0x159f9a=_0x159f9a-0x0;var _0xaceca5=_0x39af[_0x159f9a];return _0xaceca5;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xf39a('0x0'))['db'][_0xf39a('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf39a('0x2'),'afterDestroy':_0xf39a('0x3')};function emitEvent(_0x4129ff){return function(_0xef7e06,_0x26752f,_0x4b1e9e){VoicePrefixEvents['emit'](_0x4129ff+':'+_0xef7e06['id'],_0xef7e06);VoicePrefixEvents[_0xf39a('0x4')](_0x4129ff,_0xef7e06);_0x4b1e9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xf39a('0x5')](e,emitEvent(event));}}module[_0xf39a('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0xeb6e=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xeb6e,0x19c));var _0xeeb6=function(_0x3304d6,_0x2c346c){_0x3304d6=_0x3304d6-0x0;var _0x3e8895=_0xeb6e[_0x3304d6];return _0x3e8895;};'use strict';var EventEmitter=require(_0xeeb6('0x0'));var VoicePrefix=require(_0xeeb6('0x1'))['db'][_0xeeb6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xeeb6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeeb6('0x4')};function emitEvent(_0x1038f2){return function(_0x10082e,_0x4c9b24,_0x501ec1){VoicePrefixEvents['emit'](_0x1038f2+':'+_0x10082e['id'],_0x10082e);VoicePrefixEvents[_0xeeb6('0x5')](_0x1038f2,_0x10082e);_0x501ec1(null);};}for(var e in events){if(events[_0xeeb6('0x6')](e)){var event=events[e];VoicePrefix[_0xeeb6('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index abe72ed..4d92860 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 _0x8fbb=['lodash','util','api','moment','bluebird','request-promise','path','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8fbb,0x1bc));var _0xb8fb=function(_0x106895,_0xf6b6be){_0x106895=_0x106895-0x0;var _0x3ee675=_0x8fbb[_0x106895];return _0x3ee675;};'use strict';var _=require(_0xb8fb('0x0'));var util=require(_0xb8fb('0x1'));var logger=require('../../config/logger')(_0xb8fb('0x2'));var moment=require(_0xb8fb('0x3'));var BPromise=require(_0xb8fb('0x4'));var rp=require(_0xb8fb('0x5'));var fs=require('fs');var path=require(_0xb8fb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb8fb('0x7'));module[_0xb8fb('0x8')]=function(_0x2fd17c,_0x4ed38a){return _0x2fd17c[_0xb8fb('0x9')](_0xb8fb('0xa'),attributes,{'tableName':_0xb8fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d15=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoicePrefix','voice_prefixes','util'];(function(_0x377f18,_0x50612d){var _0x5cb7b0=function(_0x272388){while(--_0x272388){_0x377f18['push'](_0x377f18['shift']());}};_0x5cb7b0(++_0x50612d);}(_0x0d15,0x8f));var _0x50d1=function(_0x3afd5d,_0x5e5d0f){_0x3afd5d=_0x3afd5d-0x0;var _0x2ffa6c=_0x0d15[_0x3afd5d];return _0x2ffa6c;};'use strict';var _=require('lodash');var util=require(_0x50d1('0x0'));var logger=require(_0x50d1('0x1'))(_0x50d1('0x2'));var moment=require(_0x50d1('0x3'));var BPromise=require(_0x50d1('0x4'));var rp=require(_0x50d1('0x5'));var fs=require('fs');var path=require(_0x50d1('0x6'));var rimraf=require(_0x50d1('0x7'));var config=require(_0x50d1('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x50d1('0x9')]=function(_0x1ec7b2,_0x248319){return _0x1ec7b2['define'](_0x50d1('0xa'),attributes,{'tableName':_0x50d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index d7e3f37..4dd1871 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 _0xd1f1=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x4cc72b,_0x103864){var _0x3f657f=function(_0x1355e5){while(--_0x1355e5){_0x4cc72b['push'](_0x4cc72b['shift']());}};_0x3f657f(++_0x103864);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x9f295b,_0x5d274d){_0x9f295b=_0x9f295b-0x0;var _0x36d06d=_0xd1f1[_0x9f295b];return _0x36d06d;};'use strict';var _=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var moment=require('moment');var BPromise=require(_0x1d1f('0x2'));var rs=require(_0x1d1f('0x3'));var fs=require('fs');var Redis=require(_0x1d1f('0x4'));var db=require(_0x1d1f('0x5'))['db'];var utils=require(_0x1d1f('0x6'));var logger=require(_0x1d1f('0x7'))(_0x1d1f('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d1f('0x9'));var client=jayson[_0x1d1f('0xa')][_0x1d1f('0xb')]({'port':0x232a});config[_0x1d1f('0xc')]=_[_0x1d1f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d1f('0xc')]));require(_0x1d1f('0xe'))[_0x1d1f('0xf')](socket);function respondWithRpcPromise(_0x18ac32,_0x5a640d,_0x474a28){return new BPromise(function(_0x3f1a34,_0x220282){return client[_0x1d1f('0x10')](_0x18ac32,_0x474a28)[_0x1d1f('0x11')](function(_0x5f39fe){logger['info'](_0x1d1f('0x12'),_0x5a640d,_0x1d1f('0x13'));logger['debug'](_0x1d1f('0x14'),_0x5a640d,_0x1d1f('0x13'),JSON[_0x1d1f('0x15')](_0x5f39fe));if(_0x5f39fe[_0x1d1f('0x16')]){if(_0x5f39fe['error'][_0x1d1f('0x17')]===0x1f4){logger[_0x1d1f('0x16')](_0x1d1f('0x12'),_0x5a640d,_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);return _0x220282(_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);}logger[_0x1d1f('0x16')](_0x1d1f('0x12'),_0x5a640d,_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);return _0x3f1a34(_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);}else{logger[_0x1d1f('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x5a640d,'request\x20sent');_0x3f1a34(_0x5f39fe['result'][_0x1d1f('0x18')]);}})['catch'](function(_0x1300b0){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5a640d,_0x1300b0);_0x220282(_0x1300b0);});});} \ No newline at end of file +var _0xa613=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x91f1f5,_0x230416){var _0x5bdb35=function(_0x149aa9){while(--_0x149aa9){_0x91f1f5['push'](_0x91f1f5['shift']());}};_0x5bdb35(++_0x230416);}(_0xa613,0x8a));var _0x3a61=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xa613[_0x337748];return _0x3bb03f;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var moment=require(_0x3a61('0x1'));var BPromise=require(_0x3a61('0x2'));var rs=require(_0x3a61('0x3'));var fs=require('fs');var Redis=require(_0x3a61('0x4'));var db=require(_0x3a61('0x5'))['db'];var utils=require(_0x3a61('0x6'));var logger=require(_0x3a61('0x7'))(_0x3a61('0x8'));var config=require(_0x3a61('0x9'));var jayson=require(_0x3a61('0xa'));var client=jayson['client'][_0x3a61('0xb')]({'port':0x232a});config[_0x3a61('0xc')]=_['defaults'](config[_0x3a61('0xc')],{'host':_0x3a61('0xd'),'port':0x18eb});var socket=require(_0x3a61('0xe'))(new Redis(config[_0x3a61('0xc')]));require(_0x3a61('0xf'))['register'](socket);function respondWithRpcPromise(_0x2ad63f,_0x357242,_0x5b0db1){return new BPromise(function(_0x57be09,_0x56fbbc){return client[_0x3a61('0x10')](_0x2ad63f,_0x5b0db1)[_0x3a61('0x11')](function(_0x5ab59f){logger[_0x3a61('0x12')](_0x3a61('0x13'),_0x357242,_0x3a61('0x14'));logger[_0x3a61('0x15')](_0x3a61('0x16'),_0x357242,_0x3a61('0x14'),JSON['stringify'](_0x5ab59f));if(_0x5ab59f['error']){if(_0x5ab59f[_0x3a61('0x17')][_0x3a61('0x18')]===0x1f4){logger[_0x3a61('0x17')](_0x3a61('0x13'),_0x357242,_0x5ab59f[_0x3a61('0x17')]['message']);return _0x56fbbc(_0x5ab59f['error'][_0x3a61('0x19')]);}logger['error'](_0x3a61('0x13'),_0x357242,_0x5ab59f['error'][_0x3a61('0x19')]);return _0x57be09(_0x5ab59f[_0x3a61('0x17')]['message']);}else{logger[_0x3a61('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x357242,_0x3a61('0x14'));_0x57be09(_0x5ab59f['result'][_0x3a61('0x19')]);}})['catch'](function(_0x1047f5){logger[_0x3a61('0x17')](_0x3a61('0x13'),_0x357242,_0x1047f5);_0x56fbbc(_0x1047f5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3e174d4..49dd494 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 _0xb469=['./voicePrefix.events','save','remove','update','register'];(function(_0x132769,_0x5696e3){var _0x4b1044=function(_0x1a092f){while(--_0x1a092f){_0x132769['push'](_0x132769['shift']());}};_0x4b1044(++_0x5696e3);}(_0xb469,0x13b));var _0x9b46=function(_0x2fc1ee,_0x2594fc){_0x2fc1ee=_0x2fc1ee-0x0;var _0x26e77f=_0xb469[_0x2fc1ee];return _0x26e77f;};'use strict';var VoicePrefixEvents=require(_0x9b46('0x0'));var events=[_0x9b46('0x1'),_0x9b46('0x2'),_0x9b46('0x3')];function createListener(_0x1a41e8,_0x895347){return function(_0x9212ae){_0x895347['emit'](_0x1a41e8,_0x9212ae);};}function removeListener(_0x31f853,_0x45322f){return function(){VoicePrefixEvents['removeListener'](_0x31f853,_0x45322f);};}exports[_0x9b46('0x4')]=function(_0x405d1c){for(var _0x50b49e=0x0,_0x1b2dd3=events['length'];_0x50b49e<_0x1b2dd3;_0x50b49e++){var _0x4c1ed9=events[_0x50b49e];var _0x34c0de=createListener('voicePrefix:'+_0x4c1ed9,_0x405d1c);VoicePrefixEvents['on'](_0x4c1ed9,_0x34c0de);}}; \ No newline at end of file +var _0x340c=['update','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x3c192c,_0x5bd6f9){var _0x3d8f5b=function(_0xce675c){while(--_0xce675c){_0x3c192c['push'](_0x3c192c['shift']());}};_0x3d8f5b(++_0x5bd6f9);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0xc340('0x0'));var events=[_0xc340('0x1'),_0xc340('0x2'),_0xc340('0x3')];function createListener(_0x5b80c5,_0x44a3d4){return function(_0x13c907){_0x44a3d4[_0xc340('0x4')](_0x5b80c5,_0x13c907);};}function removeListener(_0x43c651,_0x577d30){return function(){VoicePrefixEvents[_0xc340('0x5')](_0x43c651,_0x577d30);};}exports[_0xc340('0x6')]=function(_0x337a1f){for(var _0xb55d36=0x0,_0x35b8e6=events['length'];_0xb55d36<_0x35b8e6;_0xb55d36++){var _0x4c33db=events[_0xb55d36];var _0x59a213=createListener(_0xc340('0x7')+_0x4c33db,_0x337a1f);VoicePrefixEvents['on'](_0x4c33db,_0x59a213);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 07e9940..a5f3ede 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(_0x26f802,_0x2a355d){var _0x454995=function(_0x29d8ef){while(--_0x29d8ef){_0x26f802['push'](_0x26f802['shift']());}};_0x454995(++_0x2a355d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x42d97b,_0x511716){var _0x4ab9fc=function(_0x435046){while(--_0x435046){_0x42d97b['push'](_0x42d97b['shift']());}};_0x4ab9fc(++_0x511716);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d937fff..f7f169a 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 _0x5d5d=['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','STRING','name','ENUM','outbound','inbound','leastrecent','fewestcalls','random','ringall','setDataValue','strategy','rrmemory','getDataValue','type','roundrobin','progressive','power','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x59e9a3,_0x21a3d8){var _0x5250b6=function(_0x4d654b){while(--_0x4d654b){_0x59e9a3['push'](_0x59e9a3['shift']());}};_0x5250b6(++_0x21a3d8);}(_0x5d5d,0x1e2));var _0xd5d5=function(_0x4c96a7,_0x429461){_0x4c96a7=_0x4c96a7-0x0;var _0x42f88f=_0x5d5d[_0x4c96a7];return _0x42f88f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd5d5('0x0')],'allowNull':![],'unique':_0xd5d5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd5d5('0x2')]('inbound',_0xd5d5('0x3')),'allowNull':![],'defaultValue':_0xd5d5('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd5d5('0x2')]('rr','ringall',_0xd5d5('0x5'),_0xd5d5('0x6'),_0xd5d5('0x7'),'rrmemory','linear','wrandom','rrordered'),'allowNull':![],'defaultValue':_0xd5d5('0x8'),'set':function(_0x352dd2){this[_0xd5d5('0x9')](_0xd5d5('0xa'),_0x352dd2?_0x352dd2:_0xd5d5('0xb'));},'get':function(){var _0x5a98fd=this[_0xd5d5('0xc')](_0xd5d5('0xd'));var _0x315032=this[_0xd5d5('0xc')]('dialMethod');var _0x363bc4=this[_0xd5d5('0xc')](_0xd5d5('0xa'));if(_0x5a98fd===_0xd5d5('0x4')){return _0x363bc4;}if(_0x315032==='booked'&&_0x363bc4===_0xd5d5('0xb')||_0x315032==='booked'&&_0x363bc4===_0xd5d5('0xe')){return _0x363bc4;}if(_0x315032===_0xd5d5('0xf')||_0x315032==='predictive'||_0x315032===_0xd5d5('0x10')){return _0x363bc4;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xd5d5('0x11')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd5d5('0x11')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no'),'defaultValue':_0xd5d5('0x12')},'autopause':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd5d5('0x11')](0xb)},'autopausebusy':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd5d5('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd5d5('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xd5d5('0x12'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xd5d5('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd5d5('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xd5d5('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd5d5('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd5d5('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xd5d5('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd5d5('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no'),'defaultValue':_0xd5d5('0x12')},'announce_holdtime':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no',_0xd5d5('0x13')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xd5d5('0x12'),'no')},'announce_position_limit':{'type':Sequelize[_0xd5d5('0x11')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd5d5('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xd5d5('0x0')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd5d5('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xd5d5('0x0')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xd5d5('0x0')]},'queue_periodic_announce':{'type':Sequelize[_0xd5d5('0x0')]},'queue_less_than':{'type':Sequelize[_0xd5d5('0x0')]},'periodic_announce':{'type':Sequelize[_0xd5d5('0x14')],'set':function(_0x2dd3dd){this[_0xd5d5('0x9')]('periodic_announce',_0x2dd3dd?_0x2dd3dd[_0xd5d5('0x15')](','):[]);},'get':function(){return this['getDataValue'](_0xd5d5('0x16'))?this[_0xd5d5('0xc')](_0xd5d5('0x16'))[_0xd5d5('0x17')](','):[];}},'joinempty':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':_0xd5d5('0x12'),'set':function(_0x5b1a7c){this[_0xd5d5('0x9')](_0xd5d5('0x18'),_0x5b1a7c?_0x5b1a7c[_0xd5d5('0x15')](','):undefined);},'get':function(){return this[_0xd5d5('0xc')]('joinempty')?this[_0xd5d5('0xc')](_0xd5d5('0x18'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':'no','set':function(_0x35026f){this[_0xd5d5('0x9')]('leavewhenempty',_0x35026f?_0x35026f[_0xd5d5('0x15')](','):undefined);},'get':function(){return this[_0xd5d5('0xc')](_0xd5d5('0x19'))?this[_0xd5d5('0xc')](_0xd5d5('0x19'))[_0xd5d5('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xd5d5('0x12'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd5d5('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd5d5('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd5d5('0x0')]},'acw':{'type':Sequelize[_0xd5d5('0x1a')],'defaultValue':0x0,'set':function(_0x47d316){this[_0xd5d5('0x9')](_0xd5d5('0x1b'),_0x47d316);if(_0x47d316){if(this[_0xd5d5('0xc')]('wrapuptime')<0x2){this[_0xd5d5('0x9')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd5d5('0x1a')],'defaultValue':0x0,'comment':_0xd5d5('0x1c')},'dialMethod':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x1d'),'progressive','power',_0xd5d5('0x1e'),'booked'),'defaultValue':'progressive','comment':_0xd5d5('0x1f')},'dialLimitChannel':{'type':Sequelize[_0xd5d5('0x11')](0x4)[_0xd5d5('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xd5d5('0x21')},'dialLimitQueue':{'type':Sequelize['INTEGER'](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[_0xd5d5('0x22')](0x2)[_0xd5d5('0x20')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd5d5('0x23')},'dialPredictiveOptimization':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x24'),_0xd5d5('0x25')),'defaultValue':_0xd5d5('0x25'),'comment':_0xd5d5('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd5d5('0x22')](0x2)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd5d5('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd5d5('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd5d5('0x20')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x29')},'dialQueueOptions':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':_0xd5d5('0x2a'),'comment':_0xd5d5('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x2c')},'dialQueueProject':{'type':Sequelize[_0xd5d5('0x0')],'comment':_0xd5d5('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd5d5('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'comment':_0xd5d5('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd5d5('0x32')},'dialTimezone':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd5d5('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xd5d5('0x33'),_0xd5d5('0x34'),_0xd5d5('0x35')),'defaultValue':_0xd5d5('0x33')},'dialAMDActive':{'type':Sequelize[_0xd5d5('0x1a')],'defaultValue':0x0,'comment':_0xd5d5('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0xd5d5('0x11')](0x9)[_0xd5d5('0x20')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd5d5('0x37')},'dialAMDGreeting':{'type':Sequelize[_0xd5d5('0x11')](0x9)[_0xd5d5('0x20')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd5d5('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd5d5('0x11')](0x9)[_0xd5d5('0x20')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd5d5('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xd5d5('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd5d5('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xd5d5('0x11')](0x9)[_0xd5d5('0x20')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd5d5('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd5d5('0x20')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd5d5('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd5d5('0x11')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xd5d5('0x20')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd5d5('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd5d5('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd5d5('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd5d5('0x3f')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd5d5('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd5d5('0x2')](_0xd5d5('0x41'),_0xd5d5('0x42')),'defaultValue':_0xd5d5('0x41')},'dialQueueProject2':{'type':Sequelize[_0xd5d5('0x0')],'comment':_0xd5d5('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd5d5('0x1a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xd5d5('0x1a')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd5d5('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd5d5('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd5d5('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd5d5('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd5d5('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd5d5('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd5d5('0x11')](0x5)[_0xd5d5('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd5d5('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd5d5('0x11')],'allowNull':!![],'comment':_0xd5d5('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd5d5('0x4c'),'set':function(_0x2b4458){if(!_0x2b4458)this[_0xd5d5('0x9')](_0xd5d5('0x4d'),null);this['setDataValue'](_0xd5d5('0x4e'),_0x2b4458);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd5d5('0x11')](0x3)[_0xd5d5('0x20')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd5d5('0x1a')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc1a8=['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\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#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)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'];(function(_0x3dd266,_0x4d919f){var _0x320665=function(_0x447b4e){while(--_0x447b4e){_0x3dd266['push'](_0x3dd266['shift']());}};_0x320665(++_0x4d919f);}(_0xc1a8,0xcb));var _0x8c1a=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0xc1a8[_0x443f79];return _0x3847e4;};'use strict';var Sequelize=require(_0x8c1a('0x0'));module[_0x8c1a('0x1')]={'name':{'type':Sequelize[_0x8c1a('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x4'),_0x8c1a('0x5')),'allowNull':![],'defaultValue':_0x8c1a('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x8c1a('0x6')},'announce':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8c1a('0x3')]('rr',_0x8c1a('0x7'),_0x8c1a('0x8'),'fewestcalls',_0x8c1a('0x9'),_0x8c1a('0xa'),_0x8c1a('0xb'),_0x8c1a('0xc'),_0x8c1a('0xd')),'allowNull':![],'defaultValue':_0x8c1a('0x7'),'set':function(_0x3a5ce3){this[_0x8c1a('0xe')](_0x8c1a('0xf'),_0x3a5ce3?_0x3a5ce3:_0x8c1a('0xa'));},'get':function(){var _0x1525cb=this[_0x8c1a('0x10')](_0x8c1a('0x11'));var _0x137a8e=this[_0x8c1a('0x10')](_0x8c1a('0x12'));var _0xebbbd9=this[_0x8c1a('0x10')](_0x8c1a('0xf'));if(_0x1525cb===_0x8c1a('0x4')){return _0xebbbd9;}if(_0x137a8e===_0x8c1a('0x13')&&_0xebbbd9===_0x8c1a('0xa')||_0x137a8e==='booked'&&_0xebbbd9===_0x8c1a('0x14')){return _0xebbbd9;}if(_0x137a8e===_0x8c1a('0x15')||_0x137a8e==='predictive'||_0x137a8e===_0x8c1a('0x16')){return _0xebbbd9;}return null;}},'servicelevel':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8c1a('0x17')](0xb)},'timeout':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8c1a('0x2')]},'weight':{'type':Sequelize[_0x8c1a('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no',_0x8c1a('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8c1a('0x17')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8c1a('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8c1a('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no',_0x8c1a('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8c1a('0x3')](_0x8c1a('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x8c1a('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8c1a('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8c1a('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8c1a('0x2')]},'queue_quantity2':{'type':Sequelize[_0x8c1a('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x8c1a('0x2')]},'queue_less_than':{'type':Sequelize[_0x8c1a('0x2')]},'periodic_announce':{'type':Sequelize[_0x8c1a('0x1b')],'set':function(_0x4e856b){this[_0x8c1a('0xe')]('periodic_announce',_0x4e856b?_0x4e856b[_0x8c1a('0x1c')](','):[]);},'get':function(){return this[_0x8c1a('0x10')](_0x8c1a('0x1d'))?this[_0x8c1a('0x10')](_0x8c1a('0x1d'))[_0x8c1a('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':_0x8c1a('0x18'),'set':function(_0x507225){this[_0x8c1a('0xe')](_0x8c1a('0x1f'),_0x507225?_0x507225[_0x8c1a('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0x8c1a('0x1f'))?this[_0x8c1a('0x10')](_0x8c1a('0x1f'))[_0x8c1a('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':'no','set':function(_0x3606e2){this[_0x8c1a('0xe')]('leavewhenempty',_0x3606e2?_0x3606e2[_0x8c1a('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0x8c1a('0x20'))[_0x8c1a('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x8c1a('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8c1a('0x2')]},'description':{'type':Sequelize[_0x8c1a('0x2')]},'acw':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'set':function(_0x3eeeaa){this[_0x8c1a('0xe')](_0x8c1a('0x22'),_0x3eeeaa);if(_0x3eeeaa){if(this[_0x8c1a('0x10')](_0x8c1a('0x23'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8c1a('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'comment':_0x8c1a('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0x8c1a('0x25'),'progressive',_0x8c1a('0x16'),'predictive',_0x8c1a('0x13')),'defaultValue':_0x8c1a('0x15'),'comment':_0x8c1a('0x26')},'dialLimitChannel':{'type':Sequelize[_0x8c1a('0x17')](0x4)[_0x8c1a('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8c1a('0x28')},'dialLimitQueue':{'type':Sequelize[_0x8c1a('0x17')](0x4)[_0x8c1a('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8c1a('0x29')},'dialPowerLevel':{'type':Sequelize[_0x8c1a('0x2a')](0x2)[_0x8c1a('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8c1a('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x8c1a('0x3')]('agentBusyFactor',_0x8c1a('0x2c')),'defaultValue':'dropRate','comment':_0x8c1a('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8c1a('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8c1a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8c1a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x2f')},'dialQueueOptions':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':'tTxX','comment':_0x8c1a('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x31')},'dialQueueProject':{'type':Sequelize[_0x8c1a('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x8c1a('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8c1a('0x38')},'dialTimezone':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8c1a('0x2')],'defaultValue':_0x8c1a('0x39')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8c1a('0x3')]('always',_0x8c1a('0x3a'),_0x8c1a('0x3b')),'defaultValue':_0x8c1a('0x3c')},'dialAMDActive':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8c1a('0x3d')},'dialAMDGreeting':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8c1a('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8c1a('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8c1a('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8c1a('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8c1a('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8c1a('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8c1a('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8c1a('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8c1a('0x17')](0x9)[_0x8c1a('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8c1a('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':0x0,'comment':_0x8c1a('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8c1a('0x3')]('DESC','ASC'),'defaultValue':_0x8c1a('0x46')},'dialQueueProject2':{'type':Sequelize[_0x8c1a('0x2')],'comment':_0x8c1a('0x47')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x8c1a('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8c1a('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8c1a('0x17')](0x3)[_0x8c1a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8c1a('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8c1a('0x17')](0x5)[_0x8c1a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c1a('0x17')],'allowNull':!![],'comment':_0x8c1a('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x8c1a('0x21')],'defaultValue':![],'comment':_0x8c1a('0x51'),'set':function(_0xcec68e){if(!_0xcec68e)this['setDataValue'](_0x8c1a('0x52'),null);this['setDataValue'](_0x8c1a('0x53'),_0xcec68e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x8c1a('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x8c1a('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index edd970b..9f69779 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 _0x4b07=['where','pick','merge','options','includeAll','include','findAll','rows','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','update','findOne','CmHopper','nolimit','order','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','addTeams','TeamVoiceQueue','upsert','findOrCreate','each','UserVoiceQueueRt','isNil','format','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','union','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','SIP/%s','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','count','limit','set','Content-Range','reject','save','then','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','destroy','stack','name','send','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort'];(function(_0x565d4e,_0x1b1015){var _0x3e21d8=function(_0x334314){while(--_0x334314){_0x565d4e['push'](_0x565d4e['shift']());}};_0x3e21d8(++_0x1b1015);}(_0x4b07,0x125));var _0x74b0=function(_0x428b86,_0x2ce50f){_0x428b86=_0x428b86-0x0;var _0x31161e=_0x4b07[_0x428b86];return _0x31161e;};'use strict';var emlformat=require(_0x74b0('0x0'));var rimraf=require(_0x74b0('0x1'));var zipdir=require(_0x74b0('0x2'));var jsonpatch=require(_0x74b0('0x3'));var rp=require(_0x74b0('0x4'));var moment=require(_0x74b0('0x5'));var BPromise=require(_0x74b0('0x6'));var Mustache=require('mustache');var util=require(_0x74b0('0x7'));var path=require(_0x74b0('0x8'));var sox=require(_0x74b0('0x9'));var csv=require(_0x74b0('0xa'));var ejs=require(_0x74b0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74b0('0xc'));var squel=require(_0x74b0('0xd'));var crypto=require(_0x74b0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x74b0('0xf'));var toCsv=require(_0x74b0('0xa'));var querystring=require(_0x74b0('0x10'));var Papa=require('papaparse');var Redis=require(_0x74b0('0x11'));var authService=require(_0x74b0('0x12'));var qs=require(_0x74b0('0x13'));var as=require(_0x74b0('0x14'));var hardwareService=require(_0x74b0('0x15'));var logger=require(_0x74b0('0x16'))(_0x74b0('0x17'));var utils=require(_0x74b0('0x18'));var config=require(_0x74b0('0x19'));var licenseUtil=require(_0x74b0('0x1a'));var db=require('../../mysqldb')['db'];config[_0x74b0('0x1b')]=_['defaults'](config[_0x74b0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x74b0('0x1c'))(new Redis(config[_0x74b0('0x1b')]));require(_0x74b0('0x1d'))[_0x74b0('0x1e')](socket);function respondWithStatusCode(_0x3d70f0,_0xede77c){_0xede77c=_0xede77c||0xcc;return function(_0x363ebb){if(_0x363ebb){return _0x3d70f0[_0x74b0('0x1f')](_0xede77c);}return _0x3d70f0[_0x74b0('0x20')](_0xede77c)[_0x74b0('0x21')]();};}function respondWithResult(_0x1dd8d5,_0x43fee3){_0x43fee3=_0x43fee3||0xc8;return function(_0x431d7a){if(_0x431d7a){return _0x1dd8d5[_0x74b0('0x20')](_0x43fee3)['json'](_0x431d7a);}};}function respondWithFilteredResult(_0x24ef3e,_0x5d456d){return function(_0x4fb329){if(_0x4fb329){var _0x30abcf=typeof _0x5d456d[_0x74b0('0x22')]==='undefined'&&typeof _0x5d456d['limit']==='undefined';var _0x163c74=_0x4fb329[_0x74b0('0x23')];var _0x2951a2=_0x30abcf?0x0:_0x5d456d[_0x74b0('0x22')];var _0x42ccd9=_0x30abcf?_0x4fb329[_0x74b0('0x23')]:_0x5d456d[_0x74b0('0x22')]+_0x5d456d[_0x74b0('0x24')];var _0x54a82e;if(_0x42ccd9>=_0x163c74){_0x42ccd9=_0x163c74;_0x54a82e=0xc8;}else{_0x54a82e=0xce;}_0x24ef3e[_0x74b0('0x20')](_0x54a82e);return _0x24ef3e[_0x74b0('0x25')](_0x74b0('0x26'),_0x2951a2+'-'+_0x42ccd9+'/'+_0x163c74)['json'](_0x4fb329);}return null;};}function patchUpdates(_0x493e49){return function(_0xe20ae){try{jsonpatch['apply'](_0xe20ae,_0x493e49,!![]);}catch(_0x2d9136){return BPromise[_0x74b0('0x27')](_0x2d9136);}return _0xe20ae[_0x74b0('0x28')]();};}function saveUpdates(_0x2e4501,_0x357113){return function(_0x39f894){if(_0x39f894){return _0x39f894['update'](_0x2e4501)[_0x74b0('0x29')](function(_0x29ba21){return _0x29ba21;});}return null;};}function removeEntity(_0x2d4ca5,_0x353d8b){return function(_0x1c7396){if(_0x1c7396){return _0x1c7396['destroy']()[_0x74b0('0x29')](function(){var _0x42525e=_0x1c7396[_0x74b0('0x2a')]({'plain':!![]});var _0x5acd0b=[{'name':_0x74b0('0x2b'),'value':_0x74b0('0x2c'),'ignore':![]},{'name':_0x74b0('0x2d'),'value':'outbound','ignore':![]}];var _0x227fa9=_(_0x5acd0b)[_0x74b0('0x2e')]('ignore')[_0x74b0('0x2f')](_0x74b0('0x30'))['value']();if(_[_0x74b0('0x31')](_0x227fa9,_0x42525e[_0x74b0('0x32')])){return;}var _0x16ebac=_['find'](_0x5acd0b,['value',_0x42525e[_0x74b0('0x32')]])['name'];return db[_0x74b0('0x33')][_0x74b0('0x34')]({'where':{'type':_0x16ebac,'resourceId':_0x42525e['id']}})[_0x74b0('0x29')](function(){return _0x1c7396;});})[_0x74b0('0x29')](function(){_0x2d4ca5[_0x74b0('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3c9b,_0x208201){return function(_0x7b61a6){if(!_0x7b61a6){_0x1f3c9b[_0x74b0('0x1f')](0x194);}return _0x7b61a6;};}function handleError(_0x28a885,_0x3a7bb9){_0x3a7bb9=_0x3a7bb9||0x1f4;return function(_0x118bef){logger['error'](_0x118bef[_0x74b0('0x35')]);if(_0x118bef[_0x74b0('0x36')]){delete _0x118bef[_0x74b0('0x36')];}_0x28a885[_0x74b0('0x20')](_0x3a7bb9)[_0x74b0('0x37')](_0x118bef);};}exports['index']=function(_0x30785d,_0x5956a2){var _0x5b80f9={},_0x3c5cd8={},_0x18558c={'count':0x0,'rows':[]};var _0x13ee67=_[_0x74b0('0x2f')](db[_0x74b0('0x38')][_0x74b0('0x39')],function(_0x57f580){return{'name':_0x57f580[_0x74b0('0x3a')],'type':_0x57f580[_0x74b0('0x32')][_0x74b0('0x3b')]};});_0x3c5cd8['model']=_[_0x74b0('0x2f')](_0x13ee67,_0x74b0('0x36'));_0x3c5cd8[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x30785d[_0x74b0('0x3c')]);_0x3c5cd8[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0x3c5cd8['model'],_0x3c5cd8[_0x74b0('0x3c')]);_0x5b80f9[_0x74b0('0x40')]=_[_0x74b0('0x3f')](_0x3c5cd8[_0x74b0('0x41')],qs[_0x74b0('0x42')](_0x30785d[_0x74b0('0x3c')][_0x74b0('0x42')]));_0x5b80f9[_0x74b0('0x40')]=_0x5b80f9['attributes']['length']?_0x5b80f9[_0x74b0('0x40')]:_0x3c5cd8[_0x74b0('0x41')];if(!_0x30785d[_0x74b0('0x3c')][_0x74b0('0x43')]('nolimit')){_0x5b80f9[_0x74b0('0x24')]=qs[_0x74b0('0x24')](_0x30785d['query'][_0x74b0('0x24')]);_0x5b80f9[_0x74b0('0x22')]=qs['offset'](_0x30785d[_0x74b0('0x3c')][_0x74b0('0x22')]);}_0x5b80f9['order']=qs[_0x74b0('0x44')](_0x30785d[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x5b80f9[_0x74b0('0x45')]=qs[_0x74b0('0x3e')](_[_0x74b0('0x46')](_0x30785d[_0x74b0('0x3c')],_0x3c5cd8['filters']),_0x13ee67);if(_0x30785d['query'][_0x74b0('0x2e')]){_0x5b80f9[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x5b80f9[_0x74b0('0x45')],{'$or':_[_0x74b0('0x2f')](_0x13ee67,function(_0x23498f){if(_0x23498f[_0x74b0('0x32')]!=='VIRTUAL'){var _0x12aa68={};_0x12aa68[_0x23498f[_0x74b0('0x36')]]={'$like':'%'+_0x30785d[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0x12aa68;}})});}_0x5b80f9=_[_0x74b0('0x47')]({},_0x5b80f9,_0x30785d[_0x74b0('0x48')]);var _0x45d8ad={'where':_0x5b80f9[_0x74b0('0x45')]};return db[_0x74b0('0x38')][_0x74b0('0x23')](_0x45d8ad)[_0x74b0('0x29')](function(_0x10bba0){_0x18558c[_0x74b0('0x23')]=_0x10bba0;if(_0x30785d[_0x74b0('0x3c')][_0x74b0('0x49')]){_0x5b80f9[_0x74b0('0x4a')]=[{'all':!![]}];}return db['VoiceQueue'][_0x74b0('0x4b')](_0x5b80f9);})[_0x74b0('0x29')](function(_0x5ae510){_0x18558c[_0x74b0('0x4c')]=_0x5ae510;return _0x18558c;})['then'](respondWithFilteredResult(_0x5956a2,_0x5b80f9))['catch'](handleError(_0x5956a2,null));};exports['show']=function(_0x3c9614,_0x1e4782){var _0x5e268c={'raw':![],'where':{'id':_0x3c9614['params']['id']}},_0x3e489a={};_0x3e489a[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db[_0x74b0('0x38')][_0x74b0('0x39')]);_0x3e489a[_0x74b0('0x3c')]=_['keys'](_0x3c9614['query']);_0x3e489a['filters']=_[_0x74b0('0x3f')](_0x3e489a[_0x74b0('0x41')],_0x3e489a[_0x74b0('0x3c')]);_0x5e268c['attributes']=_[_0x74b0('0x3f')](_0x3e489a[_0x74b0('0x41')],qs['fields'](_0x3c9614[_0x74b0('0x3c')][_0x74b0('0x42')]));_0x5e268c[_0x74b0('0x40')]=_0x5e268c['attributes'][_0x74b0('0x4d')]?_0x5e268c[_0x74b0('0x40')]:_0x3e489a[_0x74b0('0x41')];if(_0x3c9614[_0x74b0('0x3c')]['includeAll']){_0x5e268c[_0x74b0('0x4a')]=[{'all':!![]}];}_0x5e268c=_[_0x74b0('0x47')]({},_0x5e268c,_0x3c9614[_0x74b0('0x48')]);return db[_0x74b0('0x38')][_0x74b0('0x4e')](_0x5e268c)[_0x74b0('0x29')](handleEntityNotFound(_0x1e4782,null))['then'](respondWithResult(_0x1e4782,null))['catch'](handleError(_0x1e4782,null));};exports[_0x74b0('0x4f')]=function(_0x130a04,_0x125872){return db[_0x74b0('0x38')][_0x74b0('0x4f')](_0x130a04[_0x74b0('0x50')],{})[_0x74b0('0x29')](function(_0x28f8fe){var _0x48dfe4=_0x130a04[_0x74b0('0x51')][_0x74b0('0x2a')]({'plain':!![]});if(!_0x48dfe4)throw new Error(_0x74b0('0x52'));if(_0x48dfe4[_0x74b0('0x53')]===_0x74b0('0x51')){var _0x10e9da=_0x28f8fe[_0x74b0('0x2a')]({'plain':!![]});var _0x54f185=[{'name':_0x74b0('0x2b'),'value':_0x74b0('0x2c')},{'name':'QueueCampaigns','value':_0x74b0('0x54')}];var _0x4a59b0=_[_0x74b0('0x4e')](_0x54f185,[_0x74b0('0x30'),_0x10e9da[_0x74b0('0x32')]])[_0x74b0('0x36')];return db['UserProfileSection'][_0x74b0('0x4e')]({'where':{'name':_0x4a59b0,'userProfileId':_0x48dfe4[_0x74b0('0x55')]},'raw':!![]})[_0x74b0('0x29')](function(_0x9d4169){if(_0x9d4169&&_0x9d4169[_0x74b0('0x56')]===0x0){return db['UserProfileResource'][_0x74b0('0x4f')]({'name':_0x10e9da[_0x74b0('0x36')],'resourceId':_0x10e9da['id'],'type':_0x9d4169[_0x74b0('0x36')],'sectionId':_0x9d4169['id']},{})['then'](function(){return _0x28f8fe;});}else{return _0x28f8fe;}})[_0x74b0('0x57')](function(_0x9456a4){logger[_0x74b0('0x58')](_0x74b0('0x59'),_0x9456a4);throw _0x9456a4;});}return _0x28f8fe;})[_0x74b0('0x29')](respondWithResult(_0x125872,0xc9))[_0x74b0('0x57')](handleError(_0x125872,null));};exports[_0x74b0('0x5a')]=function(_0x4f10a8,_0x2d49df){var _0x5a2448={'where':{'id':_0x4f10a8[_0x74b0('0x5b')]['id']}},_0x93f05d={};_0x93f05d[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db[_0x74b0('0x38')]['rawAttributes']);_0x5a2448['attributes']=_[_0x74b0('0x3f')](_0x93f05d[_0x74b0('0x41')],qs[_0x74b0('0x42')](_0x4f10a8[_0x74b0('0x3c')]['fields']));_0x5a2448[_0x74b0('0x40')]=_0x5a2448[_0x74b0('0x40')]['length']?_0x5a2448[_0x74b0('0x40')]:_0x93f05d[_0x74b0('0x41')];if(_0x4f10a8['query'][_0x74b0('0x49')]){_0x5a2448[_0x74b0('0x4a')]=[{'all':!![]}];}_0x5a2448=_['merge']({},_0x5a2448,_0x4f10a8[_0x74b0('0x48')]);return db[_0x74b0('0x38')][_0x74b0('0x4e')](_0x5a2448)[_0x74b0('0x29')](handleEntityNotFound(_0x2d49df,null))[_0x74b0('0x29')](function(_0x7826b6){if(_0x7826b6){var _0xc2f4d=_0x7826b6[_0x74b0('0x2a')]({'plain':!![]});_0xc2f4d=qs[_0x74b0('0x5c')](_0xc2f4d,['id','createdAt','updatedAt']);_0x4f10a8['body']=_[_0x74b0('0x5c')](_0x4f10a8[_0x74b0('0x50')],['id',_0x74b0('0x5d'),_0x74b0('0x5e')]);return db[_0x74b0('0x38')][_0x74b0('0x4f')](_[_0x74b0('0x47')](_0xc2f4d,_0x4f10a8[_0x74b0('0x50')]),{'include':_0x4f10a8[_0x74b0('0x3c')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x359be9){var _0x56c8d5=_0x4f10a8[_0x74b0('0x51')]['get']({'plain':!![]});if(!_0x56c8d5)throw new Error(_0x74b0('0x52'));if(_0x56c8d5[_0x74b0('0x53')]==='user'){var _0x39ab14=_0x359be9['get']({'plain':!![]});var _0x41ade1=[{'name':_0x74b0('0x2b'),'value':_0x74b0('0x2c')},{'name':_0x74b0('0x2d'),'value':_0x74b0('0x54')}];var _0x40fea2=_[_0x74b0('0x4e')](_0x41ade1,['value',_0x39ab14[_0x74b0('0x32')]])[_0x74b0('0x36')];return db[_0x74b0('0x5f')][_0x74b0('0x4e')]({'where':{'name':_0x40fea2,'userProfileId':_0x56c8d5[_0x74b0('0x55')]},'raw':!![]})[_0x74b0('0x29')](function(_0xccb4e5){if(_0xccb4e5&&_0xccb4e5['autoAssociation']===0x0){return db[_0x74b0('0x33')][_0x74b0('0x4f')]({'name':_0x39ab14['name'],'resourceId':_0x39ab14['id'],'type':_0xccb4e5['name'],'sectionId':_0xccb4e5['id']},{})[_0x74b0('0x29')](function(){return _0x359be9;});}else{return _0x359be9;}})[_0x74b0('0x57')](function(_0x31f942){logger[_0x74b0('0x58')](_0x74b0('0x59'),_0x31f942);throw _0x31f942;});}return _0x359be9;});}})['then'](respondWithResult(_0x2d49df,0xc9))[_0x74b0('0x57')](handleError(_0x2d49df,null));};exports[_0x74b0('0x60')]=function(_0x2dd962,_0x56184f){if(_0x2dd962[_0x74b0('0x50')]['id']){delete _0x2dd962['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x2dd962[_0x74b0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x56184f,null))[_0x74b0('0x29')](saveUpdates(_0x2dd962[_0x74b0('0x50')],null))[_0x74b0('0x29')](respondWithResult(_0x56184f,null))[_0x74b0('0x57')](handleError(_0x56184f,null));};exports[_0x74b0('0x34')]=function(_0xa21f33,_0x188a80){return db[_0x74b0('0x38')][_0x74b0('0x4e')]({'where':{'id':_0xa21f33[_0x74b0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x188a80,null))[_0x74b0('0x29')](removeEntity(_0x188a80,null))[_0x74b0('0x57')](handleError(_0x188a80,null));};exports['getHoppers']=function(_0x3d33fa,_0x4647f0,_0x262f9b){var _0x5a4b20={'raw':![],'where':{}};var _0x1a9563={};var _0x41837a={'count':0x0,'rows':[]};return db[_0x74b0('0x38')][_0x74b0('0x61')]({'where':{'id':_0x3d33fa[_0x74b0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4647f0,null))['then'](function(_0x134440){if(_0x134440){_0x1a9563['model']=_[_0x74b0('0x3d')](db[_0x74b0('0x62')][_0x74b0('0x39')]);_0x1a9563[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x3d33fa[_0x74b0('0x3c')]);_0x1a9563[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0x1a9563[_0x74b0('0x41')],_0x1a9563['query']);_0x5a4b20['attributes']=_[_0x74b0('0x3f')](_0x1a9563['model'],qs[_0x74b0('0x42')](_0x3d33fa[_0x74b0('0x3c')][_0x74b0('0x42')]));_0x5a4b20[_0x74b0('0x40')]=_0x5a4b20[_0x74b0('0x40')][_0x74b0('0x4d')]?_0x5a4b20[_0x74b0('0x40')]:_0x1a9563[_0x74b0('0x41')];if(!_0x3d33fa[_0x74b0('0x3c')]['hasOwnProperty'](_0x74b0('0x63'))){_0x5a4b20['limit']=qs[_0x74b0('0x24')](_0x3d33fa['query'][_0x74b0('0x24')]);_0x5a4b20['offset']=qs[_0x74b0('0x22')](_0x3d33fa[_0x74b0('0x3c')][_0x74b0('0x22')]);}_0x5a4b20[_0x74b0('0x64')]=qs['sort'](_0x3d33fa[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x5a4b20['where']=qs[_0x74b0('0x3e')](_[_0x74b0('0x46')](_0x3d33fa[_0x74b0('0x3c')],_0x1a9563[_0x74b0('0x3e')]));_0x5a4b20[_0x74b0('0x45')][_0x74b0('0x65')]=_0x134440['id'];if(_0x3d33fa[_0x74b0('0x3c')][_0x74b0('0x2e')]){_0x5a4b20[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x5a4b20[_0x74b0('0x45')],{'$or':_[_0x74b0('0x2f')](_0x5a4b20['attributes'],function(_0x30e4a1){var _0x1bc89f={};_0x1bc89f[_0x30e4a1]={'$like':'%'+_0x3d33fa[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0x1bc89f;})});}_0x5a4b20=_[_0x74b0('0x47')]({},_0x5a4b20,_0x3d33fa[_0x74b0('0x48')]);return db['CmHopper'][_0x74b0('0x23')]({'where':_0x5a4b20[_0x74b0('0x45')]})[_0x74b0('0x29')](function(_0x4e327b){_0x41837a[_0x74b0('0x23')]=_0x4e327b;if(_0x3d33fa[_0x74b0('0x3c')][_0x74b0('0x49')]){_0x5a4b20['include']=[{'all':!![]}];}return db[_0x74b0('0x62')][_0x74b0('0x4b')](_0x5a4b20);})[_0x74b0('0x29')](function(_0x3b7f26){_0x41837a[_0x74b0('0x4c')]=_0x3b7f26;return _0x41837a;});}})['then'](respondWithFilteredResult(_0x4647f0,_0x5a4b20))[_0x74b0('0x57')](handleError(_0x4647f0,null));};exports[_0x74b0('0x66')]=function(_0x304c54,_0x357aaa,_0x39b20d){var _0x2b742d={'raw':!![],'where':{}};var _0x43f2cc={};var _0x21f1bf={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x74b0('0x61')]({'where':{'id':_0x304c54[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x357aaa,null))[_0x74b0('0x29')](function(_0x20d20e){if(_0x20d20e){_0x43f2cc['model']=_['keys'](db[_0x74b0('0x67')]['rawAttributes']);_0x43f2cc[_0x74b0('0x3c')]=_['keys'](_0x304c54['query']);_0x43f2cc['filters']=_[_0x74b0('0x3f')](_0x43f2cc['model'],_0x43f2cc[_0x74b0('0x3c')]);_0x2b742d[_0x74b0('0x40')]=_[_0x74b0('0x3f')](_0x43f2cc[_0x74b0('0x41')],qs[_0x74b0('0x42')](_0x304c54[_0x74b0('0x3c')][_0x74b0('0x42')]));_0x2b742d[_0x74b0('0x40')]=_0x2b742d[_0x74b0('0x40')]['length']?_0x2b742d[_0x74b0('0x40')]:_0x43f2cc[_0x74b0('0x41')];if(!_0x304c54[_0x74b0('0x3c')][_0x74b0('0x43')](_0x74b0('0x63'))){_0x2b742d[_0x74b0('0x24')]=qs['limit'](_0x304c54[_0x74b0('0x3c')]['limit']);_0x2b742d[_0x74b0('0x22')]=qs['offset'](_0x304c54['query'][_0x74b0('0x22')]);}_0x2b742d[_0x74b0('0x64')]=qs[_0x74b0('0x44')](_0x304c54[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x2b742d['where']=qs[_0x74b0('0x3e')](_['pick'](_0x304c54[_0x74b0('0x3c')],_0x43f2cc[_0x74b0('0x3e')]));_0x2b742d[_0x74b0('0x45')][_0x74b0('0x65')]=_0x20d20e['id'];if(_0x304c54['query'][_0x74b0('0x2e')]){_0x2b742d[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x2b742d[_0x74b0('0x45')],{'$or':_[_0x74b0('0x2f')](_0x2b742d[_0x74b0('0x40')],function(_0x3192aa){var _0xcf145a={};_0xcf145a[_0x3192aa]={'$like':'%'+_0x304c54[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0xcf145a;})});}_0x2b742d=_[_0x74b0('0x47')]({},_0x2b742d,_0x304c54['options']);return db[_0x74b0('0x67')][_0x74b0('0x23')]({'where':_0x2b742d[_0x74b0('0x45')]})[_0x74b0('0x29')](function(_0x1748d5){_0x21f1bf[_0x74b0('0x23')]=_0x1748d5;if(_0x304c54[_0x74b0('0x3c')][_0x74b0('0x49')]){_0x2b742d[_0x74b0('0x4a')]=[{'all':!![]}];}return db[_0x74b0('0x67')]['findAll'](_0x2b742d);})[_0x74b0('0x29')](function(_0x1fa603){_0x21f1bf[_0x74b0('0x4c')]=_0x1fa603;return _0x21f1bf;});}})[_0x74b0('0x29')](respondWithFilteredResult(_0x357aaa,_0x2b742d))[_0x74b0('0x57')](handleError(_0x357aaa,null));};exports[_0x74b0('0x68')]=function(_0x5979f6,_0x3f3bb6,_0x212518){var _0x2b6a19={'raw':!![],'where':{}};var _0x340f76={};var _0x50edb2={'count':0x0,'rows':[]};return db[_0x74b0('0x38')][_0x74b0('0x61')]({'where':{'id':_0x5979f6[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x3f3bb6,null))[_0x74b0('0x29')](function(_0x3fec5c){if(_0x3fec5c){_0x340f76[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db[_0x74b0('0x69')][_0x74b0('0x39')]);_0x340f76[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x5979f6[_0x74b0('0x3c')]);_0x340f76[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0x340f76['model'],_0x340f76[_0x74b0('0x3c')]);_0x2b6a19['attributes']=_[_0x74b0('0x3f')](_0x340f76[_0x74b0('0x41')],qs[_0x74b0('0x42')](_0x5979f6[_0x74b0('0x3c')][_0x74b0('0x42')]));_0x2b6a19[_0x74b0('0x40')]=_0x2b6a19['attributes'][_0x74b0('0x4d')]?_0x2b6a19[_0x74b0('0x40')]:_0x340f76['model'];if(!_0x5979f6[_0x74b0('0x3c')][_0x74b0('0x43')](_0x74b0('0x63'))){_0x2b6a19['limit']=qs[_0x74b0('0x24')](_0x5979f6['query'][_0x74b0('0x24')]);_0x2b6a19[_0x74b0('0x22')]=qs['offset'](_0x5979f6[_0x74b0('0x3c')][_0x74b0('0x22')]);}_0x2b6a19[_0x74b0('0x64')]=qs['sort'](_0x5979f6[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x2b6a19[_0x74b0('0x45')]=qs[_0x74b0('0x3e')](_[_0x74b0('0x46')](_0x5979f6[_0x74b0('0x3c')],_0x340f76[_0x74b0('0x3e')]));_0x2b6a19[_0x74b0('0x45')][_0x74b0('0x65')]=_0x3fec5c['id'];if(_0x5979f6[_0x74b0('0x3c')][_0x74b0('0x2e')]){_0x2b6a19[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x2b6a19['where'],{'$or':_[_0x74b0('0x2f')](_0x2b6a19[_0x74b0('0x40')],function(_0x11c54a){var _0x1276fa={};_0x1276fa[_0x11c54a]={'$like':'%'+_0x5979f6[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0x1276fa;})});}_0x2b6a19=_[_0x74b0('0x47')]({},_0x2b6a19,_0x5979f6['options']);return db[_0x74b0('0x69')][_0x74b0('0x23')]({'where':_0x2b6a19[_0x74b0('0x45')]})['then'](function(_0x3f02f5){_0x50edb2['count']=_0x3f02f5;if(_0x5979f6[_0x74b0('0x3c')]['includeAll']){_0x2b6a19[_0x74b0('0x4a')]=[{'all':!![]}];}return db[_0x74b0('0x69')][_0x74b0('0x4b')](_0x2b6a19);})[_0x74b0('0x29')](function(_0x1b90ca){_0x50edb2[_0x74b0('0x4c')]=_0x1b90ca;return _0x50edb2;});}})[_0x74b0('0x29')](respondWithFilteredResult(_0x3f3bb6,_0x2b6a19))['catch'](handleError(_0x3f3bb6,null));};exports['getHopperBlacks']=function(_0xadfda4,_0x4a1b89,_0x5f0361){var _0xf8d2b5={'raw':!![],'where':{}};var _0x18b6db={};var _0xf593bf={'count':0x0,'rows':[]};return db[_0x74b0('0x38')][_0x74b0('0x61')]({'where':{'id':_0xadfda4[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x4a1b89,null))[_0x74b0('0x29')](function(_0x2b37e7){if(_0x2b37e7){_0x18b6db[_0x74b0('0x41')]=_['keys'](db[_0x74b0('0x6a')][_0x74b0('0x39')]);_0x18b6db[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0xadfda4[_0x74b0('0x3c')]);_0x18b6db[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0x18b6db[_0x74b0('0x41')],_0x18b6db[_0x74b0('0x3c')]);_0xf8d2b5[_0x74b0('0x40')]=_[_0x74b0('0x3f')](_0x18b6db[_0x74b0('0x41')],qs['fields'](_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x42')]));_0xf8d2b5[_0x74b0('0x40')]=_0xf8d2b5[_0x74b0('0x40')][_0x74b0('0x4d')]?_0xf8d2b5[_0x74b0('0x40')]:_0x18b6db[_0x74b0('0x41')];if(!_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x43')](_0x74b0('0x63'))){_0xf8d2b5[_0x74b0('0x24')]=qs['limit'](_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x24')]);_0xf8d2b5[_0x74b0('0x22')]=qs[_0x74b0('0x22')](_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x22')]);}_0xf8d2b5[_0x74b0('0x64')]=qs[_0x74b0('0x44')](_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x44')]);_0xf8d2b5[_0x74b0('0x45')]=qs[_0x74b0('0x3e')](_['pick'](_0xadfda4['query'],_0x18b6db[_0x74b0('0x3e')]));_0xf8d2b5[_0x74b0('0x45')][_0x74b0('0x65')]=_0x2b37e7['id'];if(_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x2e')]){_0xf8d2b5[_0x74b0('0x45')]=_['merge'](_0xf8d2b5[_0x74b0('0x45')],{'$or':_[_0x74b0('0x2f')](_0xf8d2b5[_0x74b0('0x40')],function(_0x4054ea){var _0x3415c8={};_0x3415c8[_0x4054ea]={'$like':'%'+_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0x3415c8;})});}_0xf8d2b5=_[_0x74b0('0x47')]({},_0xf8d2b5,_0xadfda4[_0x74b0('0x48')]);return db[_0x74b0('0x6a')][_0x74b0('0x23')]({'where':_0xf8d2b5[_0x74b0('0x45')]})['then'](function(_0x44f2b0){_0xf593bf[_0x74b0('0x23')]=_0x44f2b0;if(_0xadfda4[_0x74b0('0x3c')][_0x74b0('0x49')]){_0xf8d2b5[_0x74b0('0x4a')]=[{'all':!![]}];}return db[_0x74b0('0x6a')][_0x74b0('0x4b')](_0xf8d2b5);})['then'](function(_0x23eca3){_0xf593bf[_0x74b0('0x4c')]=_0x23eca3;return _0xf593bf;});}})[_0x74b0('0x29')](respondWithFilteredResult(_0x4a1b89,_0xf8d2b5))[_0x74b0('0x57')](handleError(_0x4a1b89,null));};exports[_0x74b0('0x6b')]=function(_0x73e759,_0x58ed27,_0x318eb7){var _0x1afaaa={};var _0xc7c4cc={};var _0x4584e9;var _0x4841f5;return db['VoiceQueue']['findOne']({'where':{'id':_0x73e759[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x58ed27,null))[_0x74b0('0x29')](function(_0x27f8f8){if(_0x27f8f8){_0x4584e9=_0x27f8f8;_0xc7c4cc[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db[_0x74b0('0x6c')][_0x74b0('0x39')]);_0xc7c4cc[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x73e759['query']);_0xc7c4cc[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0xc7c4cc['model'],_0xc7c4cc[_0x74b0('0x3c')]);_0x1afaaa[_0x74b0('0x40')]=_['intersection'](_0xc7c4cc['model'],qs[_0x74b0('0x42')](_0x73e759['query'][_0x74b0('0x42')]));_0x1afaaa[_0x74b0('0x40')]=_0x1afaaa[_0x74b0('0x40')]['length']?_0x1afaaa[_0x74b0('0x40')]:_0xc7c4cc[_0x74b0('0x41')];_0x1afaaa[_0x74b0('0x64')]=qs['sort'](_0x73e759[_0x74b0('0x3c')]['sort']);_0x1afaaa[_0x74b0('0x45')]=qs['filters'](_['pick'](_0x73e759['query'],_0xc7c4cc['filters']));if(_0x73e759['query'][_0x74b0('0x2e')]){_0x1afaaa['where']=_['merge'](_0x1afaaa[_0x74b0('0x45')],{'$or':_[_0x74b0('0x2f')](_0x1afaaa[_0x74b0('0x40')],function(_0x11d69e){var _0x2b46af={};_0x2b46af[_0x11d69e]={'$like':'%'+_0x73e759['query']['filter']+'%'};return _0x2b46af;})});}_0x1afaaa=_[_0x74b0('0x47')]({},_0x1afaaa,_0x73e759['options']);return _0x4584e9['getTeams'](_0x1afaaa);}})[_0x74b0('0x29')](function(_0x3fac74){if(_0x3fac74){_0x4841f5=_0x3fac74[_0x74b0('0x4d')];if(!_0x73e759['query']['hasOwnProperty'](_0x74b0('0x63'))){_0x1afaaa[_0x74b0('0x24')]=qs['limit'](_0x73e759[_0x74b0('0x3c')][_0x74b0('0x24')]);_0x1afaaa[_0x74b0('0x22')]=qs['offset'](_0x73e759[_0x74b0('0x3c')]['offset']);}return _0x4584e9['getTeams'](_0x1afaaa);}})[_0x74b0('0x29')](function(_0x588298){if(_0x588298){return _0x588298?{'count':_0x4841f5,'rows':_0x588298}:null;}})[_0x74b0('0x29')](respondWithResult(_0x58ed27,null))[_0x74b0('0x57')](handleError(_0x58ed27,null));};exports['addTeams']=function(_0x59e938,_0x25a961,_0x3ff329){var _0x1a40a1=_0x59e938[_0x74b0('0x50')][_0x74b0('0x6d')];var _0x5a6e5a=_[_0x74b0('0x2f')](_0x1a40a1,'id');return db[_0x74b0('0x6c')][_0x74b0('0x4b')]({'where':{'id':_0x5a6e5a},'attributes':['id'],'include':[{'model':db[_0x74b0('0x6e')],'as':'Agents','attributes':['id',_0x74b0('0x36'),_0x74b0('0x6f'),_0x74b0('0x70'),_0x74b0('0x71')],'raw':!![]}]})[_0x74b0('0x29')](function(_0x5e771f){if(_0x5e771f){var _0x38b361=_[_0x74b0('0x72')](_0x5e771f,function(_0x3bf285){var _0x3755bf=_0x3bf285['get']({'plain':!![]});_0x3755bf[_0x74b0('0x73')][_0x74b0('0x74')](function(_0x46dd59){_0x46dd59[_0x74b0('0x75')]=_['find'](_0x1a40a1,{'id':_0x3755bf['id']})[_0x74b0('0x75')];});return _0x3755bf[_0x74b0('0x73')];});return db[_0x74b0('0x38')][_0x74b0('0x4e')]({'where':{'id':_0x59e938[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](function(_0x446dac){return db['sequelize'][_0x74b0('0x76')](function(_0x4a9e50){return _0x446dac[_0x74b0('0x77')](_0x5a6e5a,{'transaction':_0x4a9e50})[_0x74b0('0x29')](function(){return BPromise['each'](_0x1a40a1,function(_0x76db37){return db[_0x74b0('0x78')][_0x74b0('0x79')]({'TeamId':_0x76db37['id'],'VoiceQueueId':_0x59e938[_0x74b0('0x5b')]['id'],'penalty':_0x76db37[_0x74b0('0x75')]},{'transaction':_0x4a9e50});});})['then'](function(){return BPromise['each'](_0x38b361,function(_0x4c5489){return db['UserVoiceQueue'][_0x74b0('0x7a')]({'where':{'UserId':_0x4c5489['id'],'VoiceQueueId':_0x59e938[_0x74b0('0x5b')]['id']},'defaults':{'penalty':_0x4c5489[_0x74b0('0x75')]},'transaction':_0x4a9e50});});})[_0x74b0('0x29')](function(){return BPromise[_0x74b0('0x7b')](_[_0x74b0('0x2e')](_0x38b361,{'online':!![]}),function(_0x2a6818){return db[_0x74b0('0x7c')][_0x74b0('0x79')]({'membername':_0x2a6818['name'],'UserId':_0x2a6818['id'],'queue_name':_0x446dac[_0x74b0('0x36')],'VoiceQueueId':_0x446dac['id'],'interface':_[_0x74b0('0x7d')](_0x2a6818['interface'])?util[_0x74b0('0x7e')]('SIP/%s',_0x2a6818[_0x74b0('0x36')]):_0x2a6818[_0x74b0('0x71')],'paused':_0x2a6818[_0x74b0('0x70')]||![],'penalty':_0x2a6818['penalty']},{'transaction':_0x4a9e50});});})[_0x74b0('0x29')](function(){_0x38b361['forEach'](function(_0x539981){socket['emit'](_0x74b0('0x7f'),{'UserId':_0x539981['id'],'VoiceQueueId':_0x446dac['id']});});});});});}})[_0x74b0('0x29')](respondWithStatusCode(_0x25a961,null))[_0x74b0('0x57')](handleError(_0x25a961,null));};exports[_0x74b0('0x80')]=function(_0x2c5b70,_0x59af3b,_0x27669b){return db[_0x74b0('0x6c')][_0x74b0('0x4b')]({'where':{'id':_0x2c5b70[_0x74b0('0x3c')][_0x74b0('0x81')]},'attributes':['id'],'include':[{'model':db[_0x74b0('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b0('0x29')](handleEntityNotFound(_0x59af3b,null))[_0x74b0('0x29')](function(_0x3ebb9c){var _0x22333f=_['map'](_0x3ebb9c,'id');var _0x1bf049=[];var _0x464d09=[];var _0x168034=squel[_0x74b0('0x82')]();_0x168034[_0x74b0('0x83')](_0x74b0('0x84'))['from'](_0x74b0('0x85'),'tq')['join'](_0x74b0('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x74b0('0x45')](_0x74b0('0x87'),_0x2c5b70[_0x74b0('0x5b')]['id']);for(var _0x3baff6=0x0;_0x3baff6<_0x3ebb9c['length'];_0x3baff6+=0x1){let _0x172bb=_0x3ebb9c[_0x3baff6];for(var _0x7427c3=0x0;_0x7427c3<_0x172bb[_0x74b0('0x73')]['length'];_0x7427c3+=0x1){let _0x4be3c1=_0x172bb[_0x74b0('0x73')][_0x7427c3];var _0x365e4a=_0x168034[_0x74b0('0x5a')]();_0x365e4a[_0x74b0('0x45')]('ut.UserId\x20=\x20?',_0x4be3c1['id']);_0x464d09[_0x74b0('0x88')](db[_0x74b0('0x89')][_0x74b0('0x3c')](_0x365e4a[_0x74b0('0x8a')](),{'type':db[_0x74b0('0x89')]['QueryTypes'][_0x74b0('0x8b')]})[_0x74b0('0x29')](function(_0x46fe5c){if(_0x46fe5c[_0x74b0('0x4d')]===0x1){return _0x4be3c1['id'];}else{var _0x4042fd=_[_0x74b0('0x8c')](_['map'](_0x46fe5c,_0x74b0('0x8d')),function(_0x2a9347){return _[_0x74b0('0x31')](_0x22333f,_0x2a9347);});if(_0x4042fd){return _0x4be3c1['id'];}}}));}}return BPromise['all'](_0x464d09)['then'](function(_0x34d83c){_0x1bf049=_(_0x1bf049)[_0x74b0('0x8e')](_0x34d83c)['compact']()['value']();return db[_0x74b0('0x38')][_0x74b0('0x4e')]({'where':{'id':_0x2c5b70['params']['id']}})[_0x74b0('0x29')](function(_0x539ea0){return db['sequelize'][_0x74b0('0x76')](function(_0x53740c){return _0x539ea0['removeTeams'](_0x2c5b70[_0x74b0('0x3c')][_0x74b0('0x81')],{'transaction':_0x53740c})[_0x74b0('0x29')](function(){if(!_['isEmpty'](_0x1bf049)){return _0x539ea0[_0x74b0('0x8f')](_0x1bf049,{'transaction':_0x53740c})[_0x74b0('0x29')](function(){return db[_0x74b0('0x7c')][_0x74b0('0x34')]({'where':{'VoiceQueueId':_0x2c5b70['params']['id'],'UserId':_0x1bf049},'transaction':_0x53740c});});}})[_0x74b0('0x29')](function(){_0x1bf049['forEach'](function(_0x373dd8){socket['emit'](_0x74b0('0x90'),{'UserId':_0x373dd8,'VoiceQueueId':_0x539ea0['id']});});});});});});})[_0x74b0('0x29')](respondWithStatusCode(_0x59af3b,null))['catch'](handleError(_0x59af3b,null));};exports[_0x74b0('0x91')]=function(_0x26e70b,_0x5de1b0,_0x3d6c91){var _0x1ffd73,_0x2ca10c;return db[_0x74b0('0x38')]['find']({'where':{'id':_0x26e70b[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x5de1b0,null))[_0x74b0('0x29')](function(_0x298947){if(_0x298947){_0x2ca10c=_0x298947;return _0x298947[_0x74b0('0x91')](_0x26e70b[_0x74b0('0x50')]['ids'],_[_0x74b0('0x5c')](_0x26e70b['body'],['ids','id'])||{})[_0x74b0('0x92')](function(_0x26f198){for(var _0x507926=0x0;_0x507926<_0x26e70b['body'][_0x74b0('0x81')]['length'];_0x507926+=0x1){socket[_0x74b0('0x93')](_0x74b0('0x7f'),{'UserId':Number(_0x26e70b[_0x74b0('0x50')][_0x74b0('0x81')][_0x507926]),'VoiceQueueId':Number(_0x26e70b[_0x74b0('0x5b')]['id'])});}return _0x26f198;});}})[_0x74b0('0x29')](function(_0xb310ad){_0x1ffd73=_0xb310ad||[];if(_0x2ca10c){return db[_0x74b0('0x6e')][_0x74b0('0x4b')]({'where':{'id':_0x26e70b['body'][_0x74b0('0x81')]},'attributes':['id',_0x74b0('0x36'),_0x74b0('0x6f'),_0x74b0('0x70'),'interface'],'raw':!![]});}})['then'](function(_0x4441a8){if(!_['isEmpty'](_0x4441a8)){var _0x4eb2e4=[];for(var _0x484e06=0x0;_0x484e06<_0x4441a8[_0x74b0('0x4d')];_0x484e06++){if(_0x4441a8[_0x484e06][_0x74b0('0x6f')]){_0x4eb2e4[_0x74b0('0x88')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4441a8[_0x484e06][_0x74b0('0x36')],'UserId':_0x4441a8[_0x484e06]['id'],'queue_name':_0x2ca10c['name'],'VoiceQueueId':_0x2ca10c['id'],'interface':_['isNil'](_0x4441a8[_0x484e06][_0x74b0('0x71')])?util[_0x74b0('0x7e')](_0x74b0('0x94'),_0x4441a8[_0x484e06]['name']):_0x4441a8[_0x484e06][_0x74b0('0x71')],'paused':_0x4441a8[_0x484e06]['voicePause']||![],'penalty':_0x26e70b['body'][_0x74b0('0x75')]||0x0}));}}return BPromise[_0x74b0('0x95')](_0x4eb2e4);}})['then'](function(){return _0x1ffd73;})[_0x74b0('0x29')](respondWithResult(_0x5de1b0,null))['catch'](handleError(_0x5de1b0,null));};exports['removeAgents']=function(_0x4920e2,_0x3e6f94,_0x2c5760){return db[_0x74b0('0x38')][_0x74b0('0x4e')]({'where':{'id':_0x4920e2['params']['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x3e6f94,null))[_0x74b0('0x29')](function(_0x463384){if(_0x463384){return _0x463384[_0x74b0('0x8f')](_0x4920e2[_0x74b0('0x3c')][_0x74b0('0x81')])[_0x74b0('0x29')](function(){if(_[_0x74b0('0x96')](_0x4920e2[_0x74b0('0x3c')][_0x74b0('0x81')])){for(var _0x2ccb09=0x0;_0x2ccb09<_0x4920e2['query'][_0x74b0('0x81')][_0x74b0('0x4d')];_0x2ccb09+=0x1){socket[_0x74b0('0x93')](_0x74b0('0x90'),{'UserId':Number(_0x4920e2[_0x74b0('0x3c')][_0x74b0('0x81')][_0x2ccb09]),'VoiceQueueId':Number(_0x4920e2[_0x74b0('0x5b')]['id'])});}}else{socket[_0x74b0('0x93')](_0x74b0('0x90'),{'UserId':Number(_0x4920e2[_0x74b0('0x3c')][_0x74b0('0x81')]),'VoiceQueueId':Number(_0x4920e2[_0x74b0('0x5b')]['id'])});}});}})['then'](function(_0x30a2a6){return db['UserVoiceQueueRt'][_0x74b0('0x34')]({'where':{'VoiceQueueId':_0x4920e2[_0x74b0('0x5b')]['id'],'UserId':_0x4920e2[_0x74b0('0x3c')][_0x74b0('0x81')]}})[_0x74b0('0x29')](function(){return _0x30a2a6;});})[_0x74b0('0x29')](respondWithStatusCode(_0x3e6f94,null))['catch'](handleError(_0x3e6f94,null));};exports[_0x74b0('0x97')]=function(_0x596176,_0x58dcb5,_0x58dbb8){var _0x16dcd2={};var _0x389346={};var _0x2190db;var _0x39048;return db[_0x74b0('0x38')]['findOne']({'where':{'id':_0x596176[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x58dcb5,null))['then'](function(_0x4d7724){if(_0x4d7724){_0x2190db=_0x4d7724;_0x389346[_0x74b0('0x41')]=_['keys'](db[_0x74b0('0x6e')][_0x74b0('0x39')]);_0x389346['query']=_[_0x74b0('0x3d')](_0x596176[_0x74b0('0x3c')]);_0x389346['filters']=_['intersection'](_0x389346[_0x74b0('0x41')],_0x389346[_0x74b0('0x3c')]);_0x16dcd2[_0x74b0('0x40')]=_[_0x74b0('0x3f')](_0x389346[_0x74b0('0x41')],qs[_0x74b0('0x42')](_0x596176['query'][_0x74b0('0x42')]));_0x16dcd2['attributes']=_0x16dcd2['attributes']['length']?_0x16dcd2[_0x74b0('0x40')]:_0x389346[_0x74b0('0x41')];_0x16dcd2[_0x74b0('0x64')]=qs[_0x74b0('0x44')](_0x596176[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x16dcd2['where']=qs['filters'](_['pick'](_0x596176[_0x74b0('0x3c')],_0x389346[_0x74b0('0x3e')]));if(_0x596176[_0x74b0('0x3c')][_0x74b0('0x2e')]){_0x16dcd2[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x16dcd2[_0x74b0('0x45')],{'$or':_['map'](_0x16dcd2[_0x74b0('0x40')],function(_0x11b2d4){var _0xe50a8a={};_0xe50a8a[_0x11b2d4]={'$like':'%'+_0x596176[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0xe50a8a;})});}_0x16dcd2=_[_0x74b0('0x47')]({},_0x16dcd2,_0x596176[_0x74b0('0x48')]);return _0x2190db[_0x74b0('0x97')](_0x16dcd2);}})[_0x74b0('0x29')](function(_0x1887c6){if(_0x1887c6){_0x39048=_0x1887c6[_0x74b0('0x4d')];if(!_0x596176[_0x74b0('0x3c')][_0x74b0('0x43')](_0x74b0('0x63'))){_0x16dcd2['limit']=qs[_0x74b0('0x24')](_0x596176[_0x74b0('0x3c')][_0x74b0('0x24')]);_0x16dcd2['offset']=qs['offset'](_0x596176['query']['offset']);}return _0x2190db['getAgents'](_0x16dcd2);}})[_0x74b0('0x29')](function(_0x2dfc0d){if(_0x2dfc0d){return _0x2dfc0d?{'count':_0x39048,'rows':_0x2dfc0d}:null;}})[_0x74b0('0x29')](respondWithResult(_0x58dcb5,null))[_0x74b0('0x57')](handleError(_0x58dcb5,null));};exports[_0x74b0('0x98')]=function(_0x5c565a,_0x101367,_0x3b5014){var _0x34b07f={};var _0x59df8b={};var _0x501a9e;var _0x216fc4;return db['VoiceQueue'][_0x74b0('0x61')]({'where':{'id':_0x5c565a['params']['id']}})['then'](handleEntityNotFound(_0x101367,null))[_0x74b0('0x29')](function(_0x4d2008){if(_0x4d2008){_0x501a9e=_0x4d2008;_0x59df8b[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db['UserVoiceQueueRt'][_0x74b0('0x39')]);_0x59df8b[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x5c565a[_0x74b0('0x3c')]);_0x59df8b[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0x59df8b[_0x74b0('0x41')],_0x59df8b[_0x74b0('0x3c')]);_0x34b07f['attributes']=_[_0x74b0('0x3f')](_0x59df8b['model'],qs[_0x74b0('0x42')](_0x5c565a[_0x74b0('0x3c')][_0x74b0('0x42')]));_0x34b07f[_0x74b0('0x40')]=_0x34b07f[_0x74b0('0x40')][_0x74b0('0x4d')]?_0x34b07f['attributes']:_0x59df8b[_0x74b0('0x41')];_0x34b07f[_0x74b0('0x64')]=qs[_0x74b0('0x44')](_0x5c565a[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x34b07f[_0x74b0('0x45')]=qs[_0x74b0('0x3e')](_[_0x74b0('0x46')](_0x5c565a['query'],_0x59df8b['filters']));if(_0x5c565a[_0x74b0('0x3c')]['filter']){_0x34b07f[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x34b07f[_0x74b0('0x45')],{'$or':_['map'](_0x34b07f[_0x74b0('0x40')],function(_0x5e8bb8){var _0x5575b6={};_0x5575b6[_0x5e8bb8]={'$like':'%'+_0x5c565a[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0x5575b6;})});}_0x34b07f=_[_0x74b0('0x47')]({},_0x34b07f,_0x5c565a['options']);return _0x501a9e[_0x74b0('0x98')](_0x34b07f);}})[_0x74b0('0x29')](function(_0x4d2222){if(_0x4d2222){_0x216fc4=_0x4d2222['length'];if(!_0x5c565a[_0x74b0('0x3c')]['hasOwnProperty'](_0x74b0('0x63'))){_0x34b07f['limit']=qs[_0x74b0('0x24')](_0x5c565a[_0x74b0('0x3c')][_0x74b0('0x24')]);_0x34b07f[_0x74b0('0x22')]=qs[_0x74b0('0x22')](_0x5c565a[_0x74b0('0x3c')][_0x74b0('0x22')]);}return _0x501a9e[_0x74b0('0x98')](_0x34b07f);}})[_0x74b0('0x29')](function(_0x26c78c){return _0x26c78c?{'count':_0x216fc4,'rows':_0x26c78c}:null;})[_0x74b0('0x29')](respondWithResult(_0x101367,null))[_0x74b0('0x57')](handleError(_0x101367,null));};exports[_0x74b0('0x99')]=function(_0x40505,_0x36f6e2,_0x6d953e){var _0x386de5={};var _0x44c149={};var _0x24ef72;var _0x1ed8c4;return db[_0x74b0('0x38')]['findOne']({'where':{'id':_0x40505[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x36f6e2,null))['then'](function(_0x348cfc){if(_0x348cfc){_0x24ef72=_0x348cfc;_0x44c149[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db[_0x74b0('0x9a')][_0x74b0('0x39')]);_0x44c149[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x40505[_0x74b0('0x3c')]);_0x44c149['filters']=_[_0x74b0('0x3f')](_0x44c149[_0x74b0('0x41')],_0x44c149[_0x74b0('0x3c')]);_0x386de5[_0x74b0('0x40')]=_[_0x74b0('0x3f')](_0x44c149[_0x74b0('0x41')],qs[_0x74b0('0x42')](_0x40505[_0x74b0('0x3c')]['fields']));_0x386de5['attributes']=_0x386de5[_0x74b0('0x40')][_0x74b0('0x4d')]?_0x386de5[_0x74b0('0x40')]:_0x44c149[_0x74b0('0x41')];_0x386de5['order']=qs[_0x74b0('0x44')](_0x40505[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x386de5[_0x74b0('0x45')]=qs['filters'](_[_0x74b0('0x46')](_0x40505[_0x74b0('0x3c')],_0x44c149[_0x74b0('0x3e')]));if(_0x40505[_0x74b0('0x3c')][_0x74b0('0x2e')]){_0x386de5[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x386de5[_0x74b0('0x45')],{'$or':_['map'](_0x386de5[_0x74b0('0x40')],function(_0x24b060){var _0x1179be={};_0x1179be[_0x24b060]={'$like':'%'+_0x40505[_0x74b0('0x3c')][_0x74b0('0x2e')]+'%'};return _0x1179be;})});}_0x386de5=_[_0x74b0('0x47')]({},_0x386de5,_0x40505['options']);return _0x24ef72[_0x74b0('0x99')](_0x386de5);}})[_0x74b0('0x29')](function(_0x354bac){if(_0x354bac){_0x1ed8c4=_0x354bac[_0x74b0('0x4d')];if(!_0x40505[_0x74b0('0x3c')][_0x74b0('0x43')]('nolimit')){_0x386de5[_0x74b0('0x24')]=qs['limit'](_0x40505['query']['limit']);_0x386de5[_0x74b0('0x22')]=qs[_0x74b0('0x22')](_0x40505[_0x74b0('0x3c')][_0x74b0('0x22')]);}return _0x24ef72[_0x74b0('0x99')](_0x386de5);}})[_0x74b0('0x29')](function(_0x335b30){if(_0x335b30){return _0x335b30?{'count':_0x1ed8c4,'rows':_0x335b30}:null;}})[_0x74b0('0x29')](respondWithResult(_0x36f6e2,null))[_0x74b0('0x57')](handleError(_0x36f6e2,null));};exports[_0x74b0('0x9b')]=function(_0xd9dae7,_0x161944,_0x96a91){var _0x5f0e95,_0x4b7637;return db[_0x74b0('0x38')][_0x74b0('0x4e')]({'where':{'id':_0xd9dae7[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x161944,null))[_0x74b0('0x29')](function(_0x2078bd){if(_0x2078bd){_0x4b7637=_0x2078bd;return _0x2078bd[_0x74b0('0x9b')](_0xd9dae7['body'][_0x74b0('0x81')],_['omit'](_0xd9dae7[_0x74b0('0x50')],[_0x74b0('0x81'),'id'])||{});}return null;})[_0x74b0('0x92')](function(_0x763a4d){var _0x56913e;_0x5f0e95=_0x763a4d||[];var _0x4080ca=[];if(_0x763a4d){for(var _0x187c1a=0x0;_0x187c1a<_0x763a4d[_0x74b0('0x4d')];_0x187c1a+=0x1){var _0x39d077=_0x763a4d[_0x187c1a][_0x74b0('0x2a')]({'plain':!![]});_0x4b7637[_0x74b0('0x9c')]=_0xd9dae7[_0x74b0('0x50')][_0x74b0('0x9c')]?_0xd9dae7[_0x74b0('0x50')][_0x74b0('0x9c')]:_0x4b7637['dialCheckDuplicateType'];switch(_0x4b7637[_0x74b0('0x9c')]){case _0x74b0('0x9d'):_0x56913e=squel['insert']()[_0x74b0('0x9e')](_0x74b0('0x9f'))[_0x74b0('0xa0')]([_0x74b0('0xa1'),_0x74b0('0xa2'),_0x74b0('0xa3'),_0x74b0('0xa4'),_0x74b0('0x65'),_0x74b0('0x5d'),_0x74b0('0x5e')],squel[_0x74b0('0x82')]()['field'](_0x74b0('0xa1'),'phone')[_0x74b0('0x83')](_0x74b0('0xa5'),_0x74b0('0xa2'))['field']('id',_0x74b0('0xa3'))['field'](_0x39d077[_0x74b0('0xa6')][_0x74b0('0x8a')](),_0x74b0('0xa4'))[_0x74b0('0x83')](_0xd9dae7[_0x74b0('0x5b')]['id']['toString'](),'VoiceQueueId')[_0x74b0('0x83')]('NOW()',_0x74b0('0x5d'))['field'](_0x74b0('0xa5'),_0x74b0('0x5e'))[_0x74b0('0xa7')](_0x74b0('0xa8'))[_0x74b0('0x45')](_0x74b0('0xa9'))[_0x74b0('0x45')]('ListId\x20=\x20?',_0x39d077[_0x74b0('0xa6')][_0x74b0('0x8a')]())[_0x74b0('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x74b0('0x45')](_0x74b0('0xaa'),squel[_0x74b0('0x82')]()[_0x74b0('0x83')]('COALESCE(calleridnum,\x27\x27)')[_0x74b0('0xa7')]('cm_hopper_final')[_0x74b0('0x45')](_0x74b0('0x87'),_0xd9dae7[_0x74b0('0x5b')]['id']['toString']()))[_0x74b0('0x45')](_0x74b0('0xaa'),squel['select']()[_0x74b0('0x83')](_0x74b0('0xab'))[_0x74b0('0xa7')](_0x74b0('0x9f'))[_0x74b0('0x45')]('VoiceQueueId\x20=\x20?',_0xd9dae7[_0x74b0('0x5b')]['id'][_0x74b0('0x8a')]())))[_0x74b0('0x8a')]();break;case _0x74b0('0xac'):_0x56913e=squel[_0x74b0('0xad')]()[_0x74b0('0x9e')](_0x74b0('0x9f'))['fromQuery']([_0x74b0('0xa1'),_0x74b0('0xa2'),_0x74b0('0xa3'),_0x74b0('0xa4'),'VoiceQueueId','createdAt',_0x74b0('0x5e')],squel[_0x74b0('0x82')]()[_0x74b0('0x83')](_0x74b0('0xa1'),_0x74b0('0xa1'))[_0x74b0('0x83')](_0x74b0('0xa5'),_0x74b0('0xa2'))[_0x74b0('0x83')]('id','ContactId')[_0x74b0('0x83')](_0x39d077[_0x74b0('0xa6')][_0x74b0('0x8a')](),_0x74b0('0xa4'))[_0x74b0('0x83')](_0xd9dae7['params']['id'][_0x74b0('0x8a')](),_0x74b0('0x65'))['field'](_0x74b0('0xa5'),'createdAt')[_0x74b0('0x83')](_0x74b0('0xa5'),'updatedAt')[_0x74b0('0xa7')]('cm_contacts')['where'](_0x74b0('0xa9'))[_0x74b0('0x45')](_0x74b0('0xae'),_0x39d077[_0x74b0('0xa6')][_0x74b0('0x8a')]())[_0x74b0('0x45')](_0x74b0('0xaf'))[_0x74b0('0x45')](_0x74b0('0xaa'),squel[_0x74b0('0x82')]()[_0x74b0('0x83')](_0x74b0('0xab'))[_0x74b0('0xa7')](_0x74b0('0x9f'))[_0x74b0('0x45')](_0x74b0('0x87'),_0xd9dae7['params']['id'][_0x74b0('0x8a')]())))[_0x74b0('0x8a')]();break;default:_0x56913e=squel[_0x74b0('0xad')]()[_0x74b0('0x9e')](_0x74b0('0x9f'))['fromQuery']([_0x74b0('0xa1'),_0x74b0('0xa2'),_0x74b0('0xa3'),_0x74b0('0xa4'),_0x74b0('0x65'),_0x74b0('0x5d'),_0x74b0('0x5e')],squel[_0x74b0('0x82')]()[_0x74b0('0x83')]('phone',_0x74b0('0xa1'))[_0x74b0('0x83')]('NOW()',_0x74b0('0xa2'))[_0x74b0('0x83')]('id',_0x74b0('0xa3'))[_0x74b0('0x83')](_0x39d077[_0x74b0('0xa6')]['toString'](),_0x74b0('0xa4'))[_0x74b0('0x83')](_0xd9dae7[_0x74b0('0x5b')]['id'][_0x74b0('0x8a')](),_0x74b0('0x65'))['field']('NOW()','createdAt')['field'](_0x74b0('0xa5'),_0x74b0('0x5e'))[_0x74b0('0xa7')]('cm_contacts')['where'](_0x74b0('0xa9'))[_0x74b0('0x45')]('ListId\x20=\x20?',_0x39d077[_0x74b0('0xa6')][_0x74b0('0x8a')]())[_0x74b0('0x45')](_0x74b0('0xaf')))[_0x74b0('0x8a')]();}_0x4080ca['push'](db['sequelize'][_0x74b0('0x3c')](_0x56913e));}return BPromise[_0x74b0('0x95')](_0x4080ca);}})[_0x74b0('0x29')](function(){return _0x5f0e95;})[_0x74b0('0x29')](respondWithResult(_0x161944,null))[_0x74b0('0x57')](handleError(_0x161944,null));};exports['removeLists']=function(_0x4d6475,_0x548fee,_0x51f018){return db[_0x74b0('0x38')][_0x74b0('0x4e')]({'where':{'id':_0x4d6475[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x548fee,null))[_0x74b0('0x29')](function(_0x463b3d){if(_0x463b3d){return _0x463b3d[_0x74b0('0xb0')](_0x4d6475[_0x74b0('0x3c')][_0x74b0('0x81')]);}})[_0x74b0('0x29')](function(_0x44c7fd){if(_0x44c7fd){return db[_0x74b0('0x62')][_0x74b0('0x34')]({'where':{'ListId':_0x4d6475[_0x74b0('0x3c')][_0x74b0('0x81')],'VoiceQueueId':_0x4d6475[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](function(){return _0x44c7fd;});}})[_0x74b0('0x29')](respondWithStatusCode(_0x548fee,null))[_0x74b0('0x57')](handleError(_0x548fee,null));};exports[_0x74b0('0xb1')]=function(_0x3bc508,_0x2e3e9d,_0x2576f8){var _0x26601e={};var _0x5d8364={};var _0x2cae7d;var _0xc1bc12;return db[_0x74b0('0x38')][_0x74b0('0x61')]({'where':{'id':_0x3bc508[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x2e3e9d,null))['then'](function(_0x169489){if(_0x169489){_0x2cae7d=_0x169489;_0x5d8364[_0x74b0('0x41')]=_[_0x74b0('0x3d')](db[_0x74b0('0x9a')]['rawAttributes']);_0x5d8364[_0x74b0('0x3c')]=_[_0x74b0('0x3d')](_0x3bc508[_0x74b0('0x3c')]);_0x5d8364[_0x74b0('0x3e')]=_[_0x74b0('0x3f')](_0x5d8364[_0x74b0('0x41')],_0x5d8364['query']);_0x26601e[_0x74b0('0x40')]=_[_0x74b0('0x3f')](_0x5d8364['model'],qs[_0x74b0('0x42')](_0x3bc508[_0x74b0('0x3c')]['fields']));_0x26601e[_0x74b0('0x40')]=_0x26601e[_0x74b0('0x40')][_0x74b0('0x4d')]?_0x26601e[_0x74b0('0x40')]:_0x5d8364['model'];_0x26601e[_0x74b0('0x64')]=qs[_0x74b0('0x44')](_0x3bc508[_0x74b0('0x3c')][_0x74b0('0x44')]);_0x26601e[_0x74b0('0x45')]=qs[_0x74b0('0x3e')](_[_0x74b0('0x46')](_0x3bc508[_0x74b0('0x3c')],_0x5d8364[_0x74b0('0x3e')]));if(_0x3bc508[_0x74b0('0x3c')][_0x74b0('0x2e')]){_0x26601e[_0x74b0('0x45')]=_[_0x74b0('0x47')](_0x26601e[_0x74b0('0x45')],{'$or':_[_0x74b0('0x2f')](_0x26601e['attributes'],function(_0x5498a1){var _0x143251={};_0x143251[_0x5498a1]={'$like':'%'+_0x3bc508['query'][_0x74b0('0x2e')]+'%'};return _0x143251;})});}_0x26601e=_[_0x74b0('0x47')]({},_0x26601e,_0x3bc508[_0x74b0('0x48')]);return _0x2cae7d[_0x74b0('0xb1')](_0x26601e);}})[_0x74b0('0x29')](function(_0xd6b6a4){if(_0xd6b6a4){_0xc1bc12=_0xd6b6a4[_0x74b0('0x4d')];if(!_0x3bc508[_0x74b0('0x3c')][_0x74b0('0x43')](_0x74b0('0x63'))){_0x26601e[_0x74b0('0x24')]=qs[_0x74b0('0x24')](_0x3bc508['query'][_0x74b0('0x24')]);_0x26601e[_0x74b0('0x22')]=qs[_0x74b0('0x22')](_0x3bc508[_0x74b0('0x3c')][_0x74b0('0x22')]);}return _0x2cae7d[_0x74b0('0xb1')](_0x26601e);}})[_0x74b0('0x29')](function(_0x3c1ae4){if(_0x3c1ae4){return _0x3c1ae4?{'count':_0xc1bc12,'rows':_0x3c1ae4}:null;}})[_0x74b0('0x29')](respondWithResult(_0x2e3e9d,null))[_0x74b0('0x57')](handleError(_0x2e3e9d,null));};exports[_0x74b0('0xb2')]=function(_0x9000e2,_0x3435ee,_0x204723){var _0x561ff0,_0x45c81c;return db[_0x74b0('0x38')]['find']({'where':{'id':_0x9000e2[_0x74b0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3435ee,null))[_0x74b0('0x29')](function(_0x417d5d){if(_0x417d5d){_0x45c81c=_0x417d5d;return _0x417d5d[_0x74b0('0xb2')](_0x9000e2[_0x74b0('0x50')][_0x74b0('0x81')],_[_0x74b0('0x5c')](_0x9000e2['body'],['ids','id'])||{});}return null;})['spread'](function(_0x5060a2){var _0x38ebed;_0x561ff0=_0x5060a2||[];var _0x751159=[];if(_0x5060a2){for(var _0x13713f=0x0;_0x13713f<_0x5060a2['length'];_0x13713f+=0x1){var _0x18157e=_0x5060a2[_0x13713f]['get']({'plain':!![]});_0x38ebed=squel['insert']()['into'](_0x74b0('0xb3'))[_0x74b0('0xa0')]([_0x74b0('0xa1'),'ContactId',_0x74b0('0xa4'),'VoiceQueueId','createdAt',_0x74b0('0x5e')],squel[_0x74b0('0x82')]()['field'](_0x74b0('0xa1'),'phone')[_0x74b0('0x83')]('id','ContactId')[_0x74b0('0x83')](_0x18157e[_0x74b0('0xa6')][_0x74b0('0x8a')](),_0x74b0('0xa4'))['field'](_0x9000e2['params']['id'][_0x74b0('0x8a')](),_0x74b0('0x65'))[_0x74b0('0x83')](_0x74b0('0xa5'),_0x74b0('0x5d'))[_0x74b0('0x83')](_0x74b0('0xa5'),_0x74b0('0x5e'))[_0x74b0('0xa7')](_0x74b0('0xa8'))[_0x74b0('0x45')]('deletedAt\x20IS\x20NULL')[_0x74b0('0x45')](_0x74b0('0xae'),_0x18157e[_0x74b0('0xa6')][_0x74b0('0x8a')]())['where'](_0x74b0('0xaf')))[_0x74b0('0x8a')]();_0x751159[_0x74b0('0x88')](db[_0x74b0('0x89')][_0x74b0('0x3c')](_0x38ebed));}return BPromise[_0x74b0('0x95')](_0x751159);}})[_0x74b0('0x29')](function(){return _0x561ff0;})[_0x74b0('0x29')](respondWithResult(_0x3435ee,null))['catch'](handleError(_0x3435ee,null));};exports[_0x74b0('0xb4')]=function(_0x13ef57,_0x2a6fe9,_0xe96d17){return db[_0x74b0('0x38')]['find']({'where':{'id':_0x13ef57[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](handleEntityNotFound(_0x2a6fe9,null))[_0x74b0('0x29')](function(_0x1e010c){if(_0x1e010c){return _0x1e010c[_0x74b0('0xb4')](_0x13ef57[_0x74b0('0x3c')][_0x74b0('0x81')]);}})[_0x74b0('0x29')](function(_0x754cd7){if(_0x754cd7){return db['CmHopperBlack'][_0x74b0('0x34')]({'where':{'ListId':_0x13ef57[_0x74b0('0x3c')]['ids'],'VoiceQueueId':_0x13ef57[_0x74b0('0x5b')]['id']}})[_0x74b0('0x29')](function(){return _0x754cd7;});}})[_0x74b0('0x29')](respondWithStatusCode(_0x2a6fe9,null))[_0x74b0('0x57')](handleError(_0x2a6fe9,null));}; \ No newline at end of file +var _0x41a1=['UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','params','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','Agents','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','User','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ListId','phone','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','createdAt','ContactId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','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','../../config/utils','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','type','value','name','error','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','model','query','keys','intersection','fields','length','attributes','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','user','role','inbound'];(function(_0x33a82a,_0xd1bb35){var _0x15d013=function(_0x14b340){while(--_0x14b340){_0x33a82a['push'](_0x33a82a['shift']());}};_0x15d013(++_0xd1bb35);}(_0x41a1,0x111));var _0x141a=function(_0x27ec33,_0xddd613){_0x27ec33=_0x27ec33-0x0;var _0x168e5e=_0x41a1[_0x27ec33];return _0x168e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x141a('0x0'));var zipdir=require(_0x141a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x141a('0x2'));var moment=require(_0x141a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x141a('0x4'));var util=require(_0x141a('0x5'));var path=require(_0x141a('0x6'));var sox=require(_0x141a('0x7'));var csv=require('to-csv');var ejs=require(_0x141a('0x8'));var fs=require('fs');var fs_extra=require(_0x141a('0x9'));var _=require(_0x141a('0xa'));var squel=require(_0x141a('0xb'));var crypto=require(_0x141a('0xc'));var jsforce=require(_0x141a('0xd'));var deskjs=require(_0x141a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x141a('0xf'));var Papa=require('papaparse');var Redis=require(_0x141a('0x10'));var authService=require(_0x141a('0x11'));var qs=require(_0x141a('0x12'));var as=require(_0x141a('0x13'));var hardwareService=require(_0x141a('0x14'));var logger=require(_0x141a('0x15'))('api');var utils=require(_0x141a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x141a('0x17')](config[_0x141a('0x18')],{'host':_0x141a('0x19'),'port':0x18eb});var socket=require(_0x141a('0x1a'))(new Redis(config['redis']));require(_0x141a('0x1b'))['register'](socket);function respondWithStatusCode(_0x2dd715,_0xee6c9d){_0xee6c9d=_0xee6c9d||0xcc;return function(_0x1c487d){if(_0x1c487d){return _0x2dd715[_0x141a('0x1c')](_0xee6c9d);}return _0x2dd715[_0x141a('0x1d')](_0xee6c9d)[_0x141a('0x1e')]();};}function respondWithResult(_0x4be9b1,_0x3ac686){_0x3ac686=_0x3ac686||0xc8;return function(_0x2a9381){if(_0x2a9381){return _0x4be9b1[_0x141a('0x1d')](_0x3ac686)['json'](_0x2a9381);}};}function respondWithFilteredResult(_0x3db6ab,_0x2c35df){return function(_0x4342e9){if(_0x4342e9){var _0x1a4504=typeof _0x2c35df[_0x141a('0x1f')]===_0x141a('0x20')&&typeof _0x2c35df[_0x141a('0x21')]===_0x141a('0x20');var _0x31f785=_0x4342e9[_0x141a('0x22')];var _0x1790a7=_0x1a4504?0x0:_0x2c35df[_0x141a('0x1f')];var _0x5dc729=_0x1a4504?_0x4342e9[_0x141a('0x22')]:_0x2c35df[_0x141a('0x1f')]+_0x2c35df['limit'];var _0x476010;if(_0x5dc729>=_0x31f785){_0x5dc729=_0x31f785;_0x476010=0xc8;}else{_0x476010=0xce;}_0x3db6ab[_0x141a('0x1d')](_0x476010);return _0x3db6ab[_0x141a('0x23')](_0x141a('0x24'),_0x1790a7+'-'+_0x5dc729+'/'+_0x31f785)['json'](_0x4342e9);}return null;};}function patchUpdates(_0x3c927c){return function(_0x1802d8){try{jsonpatch[_0x141a('0x25')](_0x1802d8,_0x3c927c,!![]);}catch(_0x3e1a17){return BPromise[_0x141a('0x26')](_0x3e1a17);}return _0x1802d8['save']();};}function saveUpdates(_0x2ac197,_0x3c3365){return function(_0x378ef9){if(_0x378ef9){return _0x378ef9['update'](_0x2ac197)[_0x141a('0x27')](function(_0x22ce8b){return _0x22ce8b;});}return null;};}function removeEntity(_0x4cabbf,_0x5d6644){return function(_0x38fff2){if(_0x38fff2){return _0x38fff2[_0x141a('0x28')]()[_0x141a('0x27')](function(){var _0x365724=_0x38fff2[_0x141a('0x29')]({'plain':!![]});var _0x256e54=[{'name':_0x141a('0x2a'),'value':'inbound','ignore':![]},{'name':_0x141a('0x2b'),'value':_0x141a('0x2c'),'ignore':![]}];var _0x5a568c=_(_0x256e54)[_0x141a('0x2d')](_0x141a('0x2e'))['map']('value')['value']();if(_['includes'](_0x5a568c,_0x365724[_0x141a('0x2f')])){return;}var _0x2a8243=_['find'](_0x256e54,[_0x141a('0x30'),_0x365724[_0x141a('0x2f')]])[_0x141a('0x31')];return db['UserProfileResource'][_0x141a('0x28')]({'where':{'type':_0x2a8243,'resourceId':_0x365724['id']}})[_0x141a('0x27')](function(){return _0x38fff2;});})[_0x141a('0x27')](function(){_0x4cabbf['status'](0xcc)[_0x141a('0x1e')]();});}};}function handleEntityNotFound(_0x4d7bf4,_0x4a122f){return function(_0x3b6c27){if(!_0x3b6c27){_0x4d7bf4[_0x141a('0x1c')](0x194);}return _0x3b6c27;};}function handleError(_0x237f3f,_0x248548){_0x248548=_0x248548||0x1f4;return function(_0x48f5cb){logger[_0x141a('0x32')](_0x48f5cb[_0x141a('0x33')]);if(_0x48f5cb[_0x141a('0x31')]){delete _0x48f5cb[_0x141a('0x31')];}_0x237f3f['status'](_0x248548)[_0x141a('0x34')](_0x48f5cb);};}exports[_0x141a('0x35')]=function(_0x2130c0,_0x3d3613){var _0x330353={},_0x204dd7={},_0x1ef1af={'count':0x0,'rows':[]};var _0xd7d7c2=_[_0x141a('0x36')](db[_0x141a('0x37')][_0x141a('0x38')],function(_0x5f139c){return{'name':_0x5f139c[_0x141a('0x39')],'type':_0x5f139c[_0x141a('0x2f')]['key']};});_0x204dd7[_0x141a('0x3a')]=_['map'](_0xd7d7c2,_0x141a('0x31'));_0x204dd7[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x2130c0[_0x141a('0x3b')]);_0x204dd7['filters']=_[_0x141a('0x3d')](_0x204dd7['model'],_0x204dd7[_0x141a('0x3b')]);_0x330353['attributes']=_[_0x141a('0x3d')](_0x204dd7[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x2130c0['query'][_0x141a('0x3e')]));_0x330353['attributes']=_0x330353['attributes'][_0x141a('0x3f')]?_0x330353[_0x141a('0x40')]:_0x204dd7[_0x141a('0x3a')];if(!_0x2130c0[_0x141a('0x3b')]['hasOwnProperty'](_0x141a('0x41'))){_0x330353[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x2130c0['query'][_0x141a('0x21')]);_0x330353[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x2130c0[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x330353[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x2130c0[_0x141a('0x3b')]['sort']);_0x330353['where']=qs['filters'](_[_0x141a('0x44')](_0x2130c0[_0x141a('0x3b')],_0x204dd7[_0x141a('0x45')]),_0xd7d7c2);if(_0x2130c0[_0x141a('0x3b')]['filter']){_0x330353[_0x141a('0x46')]=_[_0x141a('0x47')](_0x330353[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0xd7d7c2,function(_0x1fa668){if(_0x1fa668[_0x141a('0x2f')]!==_0x141a('0x48')){var _0x461257={};_0x461257[_0x1fa668['name']]={'$like':'%'+_0x2130c0[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x461257;}})});}_0x330353=_['merge']({},_0x330353,_0x2130c0['options']);var _0x17886c={'where':_0x330353[_0x141a('0x46')]};return db[_0x141a('0x37')]['count'](_0x17886c)[_0x141a('0x27')](function(_0x1b58b6){_0x1ef1af[_0x141a('0x22')]=_0x1b58b6;if(_0x2130c0['query'][_0x141a('0x49')]){_0x330353[_0x141a('0x4a')]=[{'all':!![]}];}return db['VoiceQueue'][_0x141a('0x4b')](_0x330353);})[_0x141a('0x27')](function(_0x4a4d75){_0x1ef1af[_0x141a('0x4c')]=_0x4a4d75;return _0x1ef1af;})[_0x141a('0x27')](respondWithFilteredResult(_0x3d3613,_0x330353))[_0x141a('0x4d')](handleError(_0x3d3613,null));};exports[_0x141a('0x4e')]=function(_0x4f9aaa,_0x22c96a){var _0x5e8fff={'raw':![],'where':{'id':_0x4f9aaa['params']['id']}},_0x4eb6a6={};_0x4eb6a6[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x37')]['rawAttributes']);_0x4eb6a6[_0x141a('0x3b')]=_['keys'](_0x4f9aaa['query']);_0x4eb6a6[_0x141a('0x45')]=_[_0x141a('0x3d')](_0x4eb6a6['model'],_0x4eb6a6[_0x141a('0x3b')]);_0x5e8fff[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x4eb6a6[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x4f9aaa[_0x141a('0x3b')][_0x141a('0x3e')]));_0x5e8fff[_0x141a('0x40')]=_0x5e8fff['attributes'][_0x141a('0x3f')]?_0x5e8fff[_0x141a('0x40')]:_0x4eb6a6[_0x141a('0x3a')];if(_0x4f9aaa['query']['includeAll']){_0x5e8fff[_0x141a('0x4a')]=[{'all':!![]}];}_0x5e8fff=_[_0x141a('0x47')]({},_0x5e8fff,_0x4f9aaa[_0x141a('0x4f')]);return db[_0x141a('0x37')][_0x141a('0x50')](_0x5e8fff)[_0x141a('0x27')](handleEntityNotFound(_0x22c96a,null))['then'](respondWithResult(_0x22c96a,null))[_0x141a('0x4d')](handleError(_0x22c96a,null));};exports['create']=function(_0x454964,_0x40c80a){return db[_0x141a('0x37')][_0x141a('0x51')](_0x454964['body'],{})['then'](function(_0x38b380){var _0x43b918=_0x454964[_0x141a('0x52')]['get']({'plain':!![]});if(!_0x43b918)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43b918[_0x141a('0x53')]===_0x141a('0x52')){var _0xaee0dd=_0x38b380['get']({'plain':!![]});var _0x10de3c=[{'name':_0x141a('0x2a'),'value':_0x141a('0x54')},{'name':_0x141a('0x2b'),'value':_0x141a('0x2c')}];var _0x622a59=_[_0x141a('0x50')](_0x10de3c,['value',_0xaee0dd[_0x141a('0x2f')]])[_0x141a('0x31')];return db[_0x141a('0x55')][_0x141a('0x50')]({'where':{'name':_0x622a59,'userProfileId':_0x43b918['userProfileId']},'raw':!![]})[_0x141a('0x27')](function(_0x5853f1){if(_0x5853f1&&_0x5853f1[_0x141a('0x56')]===0x0){return db[_0x141a('0x57')][_0x141a('0x51')]({'name':_0xaee0dd[_0x141a('0x31')],'resourceId':_0xaee0dd['id'],'type':_0x5853f1['name'],'sectionId':_0x5853f1['id']},{})['then'](function(){return _0x38b380;});}else{return _0x38b380;}})[_0x141a('0x4d')](function(_0x14c8c0){logger[_0x141a('0x32')](_0x141a('0x58'),_0x14c8c0);throw _0x14c8c0;});}return _0x38b380;})[_0x141a('0x27')](respondWithResult(_0x40c80a,0xc9))['catch'](handleError(_0x40c80a,null));};exports[_0x141a('0x59')]=function(_0x4b7adc,_0x35a522){var _0x5498a6={'where':{'id':_0x4b7adc['params']['id']}},_0xa0bf14={};_0xa0bf14[_0x141a('0x3a')]=_['keys'](db[_0x141a('0x37')][_0x141a('0x38')]);_0x5498a6[_0x141a('0x40')]=_[_0x141a('0x3d')](_0xa0bf14[_0x141a('0x3a')],qs['fields'](_0x4b7adc['query'][_0x141a('0x3e')]));_0x5498a6[_0x141a('0x40')]=_0x5498a6[_0x141a('0x40')]['length']?_0x5498a6[_0x141a('0x40')]:_0xa0bf14[_0x141a('0x3a')];if(_0x4b7adc[_0x141a('0x3b')][_0x141a('0x49')]){_0x5498a6[_0x141a('0x4a')]=[{'all':!![]}];}_0x5498a6=_[_0x141a('0x47')]({},_0x5498a6,_0x4b7adc['options']);return db[_0x141a('0x37')][_0x141a('0x50')](_0x5498a6)[_0x141a('0x27')](handleEntityNotFound(_0x35a522,null))[_0x141a('0x27')](function(_0x45f66e){if(_0x45f66e){var _0x36d5b7=_0x45f66e[_0x141a('0x29')]({'plain':!![]});_0x36d5b7=qs['omit'](_0x36d5b7,['id','createdAt',_0x141a('0x5a')]);_0x4b7adc[_0x141a('0x5b')]=_[_0x141a('0x5c')](_0x4b7adc[_0x141a('0x5b')],['id','createdAt',_0x141a('0x5a')]);return db[_0x141a('0x37')][_0x141a('0x51')](_['merge'](_0x36d5b7,_0x4b7adc[_0x141a('0x5b')]),{'include':_0x4b7adc['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x50caff){var _0x222baa=_0x4b7adc[_0x141a('0x52')]['get']({'plain':!![]});if(!_0x222baa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x222baa[_0x141a('0x53')]==='user'){var _0x408a7f=_0x50caff[_0x141a('0x29')]({'plain':!![]});var _0xc881be=[{'name':_0x141a('0x2a'),'value':_0x141a('0x54')},{'name':'QueueCampaigns','value':_0x141a('0x2c')}];var _0x2a9b98=_[_0x141a('0x50')](_0xc881be,[_0x141a('0x30'),_0x408a7f[_0x141a('0x2f')]])[_0x141a('0x31')];return db[_0x141a('0x55')]['find']({'where':{'name':_0x2a9b98,'userProfileId':_0x222baa['userProfileId']},'raw':!![]})[_0x141a('0x27')](function(_0x5f074a){if(_0x5f074a&&_0x5f074a['autoAssociation']===0x0){return db['UserProfileResource'][_0x141a('0x51')]({'name':_0x408a7f[_0x141a('0x31')],'resourceId':_0x408a7f['id'],'type':_0x5f074a[_0x141a('0x31')],'sectionId':_0x5f074a['id']},{})[_0x141a('0x27')](function(){return _0x50caff;});}else{return _0x50caff;}})[_0x141a('0x4d')](function(_0x365bb9){logger[_0x141a('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x365bb9);throw _0x365bb9;});}return _0x50caff;});}})[_0x141a('0x27')](respondWithResult(_0x35a522,0xc9))[_0x141a('0x4d')](handleError(_0x35a522,null));};exports['update']=function(_0xbaab73,_0x521754){if(_0xbaab73[_0x141a('0x5b')]['id']){delete _0xbaab73[_0x141a('0x5b')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0xbaab73['params']['id']}})['then'](handleEntityNotFound(_0x521754,null))[_0x141a('0x27')](saveUpdates(_0xbaab73[_0x141a('0x5b')],null))['then'](respondWithResult(_0x521754,null))['catch'](handleError(_0x521754,null));};exports[_0x141a('0x28')]=function(_0x572d8e,_0x34bccc){return db[_0x141a('0x37')]['find']({'where':{'id':_0x572d8e[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x34bccc,null))['then'](removeEntity(_0x34bccc,null))[_0x141a('0x4d')](handleError(_0x34bccc,null));};exports[_0x141a('0x5e')]=function(_0x42316f,_0x122bf1,_0x45958e){var _0x38834c={'raw':![],'where':{}};var _0x4e904b={};var _0x41462e={'count':0x0,'rows':[]};return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x42316f[_0x141a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x122bf1,null))[_0x141a('0x27')](function(_0x459248){if(_0x459248){_0x4e904b[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x60')][_0x141a('0x38')]);_0x4e904b['query']=_['keys'](_0x42316f[_0x141a('0x3b')]);_0x4e904b['filters']=_['intersection'](_0x4e904b[_0x141a('0x3a')],_0x4e904b['query']);_0x38834c[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x4e904b['model'],qs[_0x141a('0x3e')](_0x42316f[_0x141a('0x3b')][_0x141a('0x3e')]));_0x38834c[_0x141a('0x40')]=_0x38834c[_0x141a('0x40')][_0x141a('0x3f')]?_0x38834c['attributes']:_0x4e904b[_0x141a('0x3a')];if(!_0x42316f[_0x141a('0x3b')][_0x141a('0x61')](_0x141a('0x41'))){_0x38834c['limit']=qs['limit'](_0x42316f['query'][_0x141a('0x21')]);_0x38834c[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x42316f[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x38834c['order']=qs[_0x141a('0x43')](_0x42316f[_0x141a('0x3b')][_0x141a('0x43')]);_0x38834c[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0x42316f[_0x141a('0x3b')],_0x4e904b[_0x141a('0x45')]));_0x38834c[_0x141a('0x46')][_0x141a('0x62')]=_0x459248['id'];if(_0x42316f['query'][_0x141a('0x2d')]){_0x38834c['where']=_[_0x141a('0x47')](_0x38834c['where'],{'$or':_[_0x141a('0x36')](_0x38834c[_0x141a('0x40')],function(_0x5ab227){var _0xa37529={};_0xa37529[_0x5ab227]={'$like':'%'+_0x42316f[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0xa37529;})});}_0x38834c=_[_0x141a('0x47')]({},_0x38834c,_0x42316f[_0x141a('0x4f')]);return db[_0x141a('0x60')][_0x141a('0x22')]({'where':_0x38834c[_0x141a('0x46')]})[_0x141a('0x27')](function(_0x5933b8){_0x41462e[_0x141a('0x22')]=_0x5933b8;if(_0x42316f['query'][_0x141a('0x49')]){_0x38834c[_0x141a('0x4a')]=[{'all':!![]}];}return db[_0x141a('0x60')]['findAll'](_0x38834c);})[_0x141a('0x27')](function(_0xbfdf61){_0x41462e[_0x141a('0x4c')]=_0xbfdf61;return _0x41462e;});}})[_0x141a('0x27')](respondWithFilteredResult(_0x122bf1,_0x38834c))[_0x141a('0x4d')](handleError(_0x122bf1,null));};exports['getHopperHistories']=function(_0x4e1d63,_0x23754b,_0x4cc836){var _0xf814ee={'raw':!![],'where':{}};var _0x4857b7={};var _0x34423f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x141a('0x5f')]({'where':{'id':_0x4e1d63[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x23754b,null))[_0x141a('0x27')](function(_0x2f6eb8){if(_0x2f6eb8){_0x4857b7[_0x141a('0x3a')]=_['keys'](db[_0x141a('0x63')]['rawAttributes']);_0x4857b7[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x4e1d63['query']);_0x4857b7[_0x141a('0x45')]=_['intersection'](_0x4857b7['model'],_0x4857b7[_0x141a('0x3b')]);_0xf814ee['attributes']=_[_0x141a('0x3d')](_0x4857b7[_0x141a('0x3a')],qs['fields'](_0x4e1d63[_0x141a('0x3b')]['fields']));_0xf814ee[_0x141a('0x40')]=_0xf814ee[_0x141a('0x40')][_0x141a('0x3f')]?_0xf814ee[_0x141a('0x40')]:_0x4857b7[_0x141a('0x3a')];if(!_0x4e1d63[_0x141a('0x3b')][_0x141a('0x61')]('nolimit')){_0xf814ee[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x4e1d63[_0x141a('0x3b')][_0x141a('0x21')]);_0xf814ee[_0x141a('0x1f')]=qs['offset'](_0x4e1d63[_0x141a('0x3b')][_0x141a('0x1f')]);}_0xf814ee[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x4e1d63[_0x141a('0x3b')][_0x141a('0x43')]);_0xf814ee[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0x4e1d63[_0x141a('0x3b')],_0x4857b7[_0x141a('0x45')]));_0xf814ee['where']['VoiceQueueId']=_0x2f6eb8['id'];if(_0x4e1d63[_0x141a('0x3b')]['filter']){_0xf814ee['where']=_['merge'](_0xf814ee[_0x141a('0x46')],{'$or':_['map'](_0xf814ee[_0x141a('0x40')],function(_0x1edabe){var _0x199164={};_0x199164[_0x1edabe]={'$like':'%'+_0x4e1d63['query'][_0x141a('0x2d')]+'%'};return _0x199164;})});}_0xf814ee=_[_0x141a('0x47')]({},_0xf814ee,_0x4e1d63[_0x141a('0x4f')]);return db[_0x141a('0x63')][_0x141a('0x22')]({'where':_0xf814ee[_0x141a('0x46')]})[_0x141a('0x27')](function(_0x10d3d6){_0x34423f['count']=_0x10d3d6;if(_0x4e1d63[_0x141a('0x3b')][_0x141a('0x49')]){_0xf814ee[_0x141a('0x4a')]=[{'all':!![]}];}return db[_0x141a('0x63')][_0x141a('0x4b')](_0xf814ee);})[_0x141a('0x27')](function(_0x1288b7){_0x34423f[_0x141a('0x4c')]=_0x1288b7;return _0x34423f;});}})[_0x141a('0x27')](respondWithFilteredResult(_0x23754b,_0xf814ee))[_0x141a('0x4d')](handleError(_0x23754b,null));};exports[_0x141a('0x64')]=function(_0x4d43c5,_0x3981b6,_0x46d4ae){var _0x634350={'raw':!![],'where':{}};var _0x284773={};var _0x45c14a={'count':0x0,'rows':[]};return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x4d43c5[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x3981b6,null))[_0x141a('0x27')](function(_0x19ace9){if(_0x19ace9){_0x284773[_0x141a('0x3a')]=_[_0x141a('0x3c')](db['CmHopperFinal']['rawAttributes']);_0x284773[_0x141a('0x3b')]=_['keys'](_0x4d43c5[_0x141a('0x3b')]);_0x284773[_0x141a('0x45')]=_[_0x141a('0x3d')](_0x284773['model'],_0x284773['query']);_0x634350[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x284773['model'],qs[_0x141a('0x3e')](_0x4d43c5[_0x141a('0x3b')]['fields']));_0x634350[_0x141a('0x40')]=_0x634350[_0x141a('0x40')][_0x141a('0x3f')]?_0x634350[_0x141a('0x40')]:_0x284773[_0x141a('0x3a')];if(!_0x4d43c5['query'][_0x141a('0x61')](_0x141a('0x41'))){_0x634350[_0x141a('0x21')]=qs['limit'](_0x4d43c5[_0x141a('0x3b')][_0x141a('0x21')]);_0x634350[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x4d43c5[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x634350[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x4d43c5[_0x141a('0x3b')][_0x141a('0x43')]);_0x634350[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0x4d43c5[_0x141a('0x3b')],_0x284773[_0x141a('0x45')]));_0x634350[_0x141a('0x46')][_0x141a('0x62')]=_0x19ace9['id'];if(_0x4d43c5[_0x141a('0x3b')][_0x141a('0x2d')]){_0x634350[_0x141a('0x46')]=_[_0x141a('0x47')](_0x634350[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0x634350[_0x141a('0x40')],function(_0x19edc4){var _0x525bd3={};_0x525bd3[_0x19edc4]={'$like':'%'+_0x4d43c5[_0x141a('0x3b')]['filter']+'%'};return _0x525bd3;})});}_0x634350=_[_0x141a('0x47')]({},_0x634350,_0x4d43c5[_0x141a('0x4f')]);return db['CmHopperFinal'][_0x141a('0x22')]({'where':_0x634350['where']})[_0x141a('0x27')](function(_0x1f8011){_0x45c14a[_0x141a('0x22')]=_0x1f8011;if(_0x4d43c5[_0x141a('0x3b')][_0x141a('0x49')]){_0x634350[_0x141a('0x4a')]=[{'all':!![]}];}return db[_0x141a('0x65')][_0x141a('0x4b')](_0x634350);})['then'](function(_0x553ca2){_0x45c14a['rows']=_0x553ca2;return _0x45c14a;});}})['then'](respondWithFilteredResult(_0x3981b6,_0x634350))[_0x141a('0x4d')](handleError(_0x3981b6,null));};exports['getHopperBlacks']=function(_0x4120b9,_0x37ab25,_0x493bb7){var _0x525d03={'raw':!![],'where':{}};var _0x2b412d={};var _0x3c4fb1={'count':0x0,'rows':[]};return db[_0x141a('0x37')]['findOne']({'where':{'id':_0x4120b9['params']['id']}})['then'](handleEntityNotFound(_0x37ab25,null))[_0x141a('0x27')](function(_0xff13a7){if(_0xff13a7){_0x2b412d[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x66')][_0x141a('0x38')]);_0x2b412d[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x4120b9['query']);_0x2b412d['filters']=_[_0x141a('0x3d')](_0x2b412d[_0x141a('0x3a')],_0x2b412d[_0x141a('0x3b')]);_0x525d03[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x2b412d[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x3e')]));_0x525d03[_0x141a('0x40')]=_0x525d03[_0x141a('0x40')][_0x141a('0x3f')]?_0x525d03[_0x141a('0x40')]:_0x2b412d[_0x141a('0x3a')];if(!_0x4120b9[_0x141a('0x3b')]['hasOwnProperty'](_0x141a('0x41'))){_0x525d03['limit']=qs[_0x141a('0x21')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x21')]);_0x525d03[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x1f')]);}_0x525d03[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x4120b9[_0x141a('0x3b')][_0x141a('0x43')]);_0x525d03[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x4120b9[_0x141a('0x3b')],_0x2b412d[_0x141a('0x45')]));_0x525d03[_0x141a('0x46')][_0x141a('0x62')]=_0xff13a7['id'];if(_0x4120b9[_0x141a('0x3b')][_0x141a('0x2d')]){_0x525d03['where']=_[_0x141a('0x47')](_0x525d03[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0x525d03[_0x141a('0x40')],function(_0x37cb27){var _0x593e9d={};_0x593e9d[_0x37cb27]={'$like':'%'+_0x4120b9['query'][_0x141a('0x2d')]+'%'};return _0x593e9d;})});}_0x525d03=_[_0x141a('0x47')]({},_0x525d03,_0x4120b9['options']);return db[_0x141a('0x66')][_0x141a('0x22')]({'where':_0x525d03[_0x141a('0x46')]})[_0x141a('0x27')](function(_0x305a7b){_0x3c4fb1['count']=_0x305a7b;if(_0x4120b9[_0x141a('0x3b')][_0x141a('0x49')]){_0x525d03[_0x141a('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x141a('0x4b')](_0x525d03);})[_0x141a('0x27')](function(_0x3f7411){_0x3c4fb1[_0x141a('0x4c')]=_0x3f7411;return _0x3c4fb1;});}})[_0x141a('0x27')](respondWithFilteredResult(_0x37ab25,_0x525d03))['catch'](handleError(_0x37ab25,null));};exports[_0x141a('0x67')]=function(_0x388742,_0x71abfa,_0x420a42){var _0x2aaae1={};var _0x4e2c9c={};var _0x10d780;var _0xd01894;return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x388742[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x71abfa,null))['then'](function(_0x5d60a1){if(_0x5d60a1){_0x10d780=_0x5d60a1;_0x4e2c9c['model']=_['keys'](db[_0x141a('0x68')][_0x141a('0x38')]);_0x4e2c9c[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x388742[_0x141a('0x3b')]);_0x4e2c9c['filters']=_['intersection'](_0x4e2c9c[_0x141a('0x3a')],_0x4e2c9c[_0x141a('0x3b')]);_0x2aaae1[_0x141a('0x40')]=_['intersection'](_0x4e2c9c[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x388742[_0x141a('0x3b')]['fields']));_0x2aaae1[_0x141a('0x40')]=_0x2aaae1[_0x141a('0x40')]['length']?_0x2aaae1[_0x141a('0x40')]:_0x4e2c9c[_0x141a('0x3a')];_0x2aaae1[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x388742[_0x141a('0x3b')]['sort']);_0x2aaae1[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x388742[_0x141a('0x3b')],_0x4e2c9c['filters']));if(_0x388742[_0x141a('0x3b')][_0x141a('0x2d')]){_0x2aaae1[_0x141a('0x46')]=_[_0x141a('0x47')](_0x2aaae1['where'],{'$or':_[_0x141a('0x36')](_0x2aaae1['attributes'],function(_0x3d2043){var _0x271194={};_0x271194[_0x3d2043]={'$like':'%'+_0x388742[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x271194;})});}_0x2aaae1=_[_0x141a('0x47')]({},_0x2aaae1,_0x388742[_0x141a('0x4f')]);return _0x10d780[_0x141a('0x67')](_0x2aaae1);}})['then'](function(_0x1d712d){if(_0x1d712d){_0xd01894=_0x1d712d['length'];if(!_0x388742['query'][_0x141a('0x61')](_0x141a('0x41'))){_0x2aaae1[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x388742[_0x141a('0x3b')]['limit']);_0x2aaae1[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x388742[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x10d780[_0x141a('0x67')](_0x2aaae1);}})[_0x141a('0x27')](function(_0x2594e2){if(_0x2594e2){return _0x2594e2?{'count':_0xd01894,'rows':_0x2594e2}:null;}})['then'](respondWithResult(_0x71abfa,null))['catch'](handleError(_0x71abfa,null));};exports['addTeams']=function(_0x1a55ed,_0x49c840,_0x2c3494){var _0x6958ff=_0x1a55ed[_0x141a('0x5b')][_0x141a('0x69')];var _0x51a95b=_[_0x141a('0x36')](_0x6958ff,'id');return db[_0x141a('0x68')]['findAll']({'where':{'id':_0x51a95b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x141a('0x6a'),'attributes':['id','name','online',_0x141a('0x6b'),'interface'],'raw':!![]}]})[_0x141a('0x27')](function(_0x3fd3db){if(_0x3fd3db){var _0x5ec90a=_[_0x141a('0x6c')](_0x3fd3db,function(_0x4c3ada){var _0x3182fb=_0x4c3ada[_0x141a('0x29')]({'plain':!![]});_0x3182fb[_0x141a('0x6a')][_0x141a('0x6d')](function(_0x25aaec){_0x25aaec[_0x141a('0x6e')]=_[_0x141a('0x50')](_0x6958ff,{'id':_0x3182fb['id']})[_0x141a('0x6e')];});return _0x3182fb[_0x141a('0x6a')];});return db['VoiceQueue'][_0x141a('0x50')]({'where':{'id':_0x1a55ed['params']['id']}})[_0x141a('0x27')](function(_0x4eccfc){return db[_0x141a('0x6f')][_0x141a('0x70')](function(_0x436be5){return _0x4eccfc[_0x141a('0x71')](_0x51a95b,{'transaction':_0x436be5})[_0x141a('0x27')](function(){return BPromise[_0x141a('0x72')](_0x6958ff,function(_0x3d65ba){return db[_0x141a('0x73')][_0x141a('0x74')]({'TeamId':_0x3d65ba['id'],'VoiceQueueId':_0x1a55ed[_0x141a('0x5d')]['id'],'penalty':_0x3d65ba[_0x141a('0x6e')]},{'transaction':_0x436be5});});})[_0x141a('0x27')](function(){return BPromise[_0x141a('0x72')](_0x5ec90a,function(_0x29cfa6){return db[_0x141a('0x75')]['findOrCreate']({'where':{'UserId':_0x29cfa6['id'],'VoiceQueueId':_0x1a55ed['params']['id']},'defaults':{'penalty':_0x29cfa6[_0x141a('0x6e')]},'transaction':_0x436be5});});})[_0x141a('0x27')](function(){return BPromise[_0x141a('0x72')](_[_0x141a('0x2d')](_0x5ec90a,{'online':!![]}),function(_0x4b03a5){return db[_0x141a('0x76')][_0x141a('0x74')]({'membername':_0x4b03a5['name'],'UserId':_0x4b03a5['id'],'queue_name':_0x4eccfc[_0x141a('0x31')],'VoiceQueueId':_0x4eccfc['id'],'interface':_[_0x141a('0x77')](_0x4b03a5[_0x141a('0x78')])?util[_0x141a('0x79')](_0x141a('0x7a'),_0x4b03a5[_0x141a('0x31')]):_0x4b03a5[_0x141a('0x78')],'paused':_0x4b03a5[_0x141a('0x6b')]||![],'penalty':_0x4b03a5[_0x141a('0x6e')]},{'transaction':_0x436be5});});})['then'](function(){_0x5ec90a['forEach'](function(_0x1b193d){socket[_0x141a('0x7b')](_0x141a('0x7c'),{'UserId':_0x1b193d['id'],'VoiceQueueId':_0x4eccfc['id']});});});});});}})[_0x141a('0x27')](respondWithStatusCode(_0x49c840,null))[_0x141a('0x4d')](handleError(_0x49c840,null));};exports[_0x141a('0x7d')]=function(_0x1169ef,_0x5a7afb,_0x5e636a){return db[_0x141a('0x68')][_0x141a('0x4b')]({'where':{'id':_0x1169ef[_0x141a('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x141a('0x7e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x141a('0x27')](handleEntityNotFound(_0x5a7afb,null))[_0x141a('0x27')](function(_0x44de8f){var _0x1ad63b=_[_0x141a('0x36')](_0x44de8f,'id');var _0x46ab1a=[];var _0x3d1e88=[];var _0xca09b2=squel[_0x141a('0x7f')]();_0xca09b2[_0x141a('0x80')](_0x141a('0x81'))['from']('team_has_voice_queues','tq')['join'](_0x141a('0x82'),'ut',_0x141a('0x83'))[_0x141a('0x46')](_0x141a('0x84'),_0x1169ef['params']['id']);for(var _0x52c62a=0x0;_0x52c62a<_0x44de8f[_0x141a('0x3f')];_0x52c62a+=0x1){let _0x2abc9d=_0x44de8f[_0x52c62a];for(var _0x3065e3=0x0;_0x3065e3<_0x2abc9d['Agents'][_0x141a('0x3f')];_0x3065e3+=0x1){let _0x147016=_0x2abc9d[_0x141a('0x6a')][_0x3065e3];var _0x47e7cf=_0xca09b2[_0x141a('0x59')]();_0x47e7cf[_0x141a('0x46')](_0x141a('0x85'),_0x147016['id']);_0x3d1e88[_0x141a('0x86')](db[_0x141a('0x6f')][_0x141a('0x3b')](_0x47e7cf[_0x141a('0x87')](),{'type':db['sequelize'][_0x141a('0x88')][_0x141a('0x89')]})['then'](function(_0x5d2e32){if(_0x5d2e32[_0x141a('0x3f')]===0x1){return _0x147016['id'];}else{var _0x155492=_[_0x141a('0x8a')](_[_0x141a('0x36')](_0x5d2e32,'TeamId'),function(_0x12afb4){return _['includes'](_0x1ad63b,_0x12afb4);});if(_0x155492){return _0x147016['id'];}}}));}}return BPromise[_0x141a('0x8b')](_0x3d1e88)['then'](function(_0x3f98af){_0x46ab1a=_(_0x46ab1a)['union'](_0x3f98af)[_0x141a('0x8c')]()[_0x141a('0x30')]();return db['VoiceQueue'][_0x141a('0x50')]({'where':{'id':_0x1169ef[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](function(_0x2a0b8a){return db[_0x141a('0x6f')][_0x141a('0x70')](function(_0x13b5ef){return _0x2a0b8a['removeTeams'](_0x1169ef[_0x141a('0x3b')][_0x141a('0x8d')],{'transaction':_0x13b5ef})['then'](function(){if(!_[_0x141a('0x8e')](_0x46ab1a)){return _0x2a0b8a[_0x141a('0x8f')](_0x46ab1a,{'transaction':_0x13b5ef})[_0x141a('0x27')](function(){return db[_0x141a('0x76')][_0x141a('0x28')]({'where':{'VoiceQueueId':_0x1169ef['params']['id'],'UserId':_0x46ab1a},'transaction':_0x13b5ef});});}})[_0x141a('0x27')](function(){_0x46ab1a[_0x141a('0x6d')](function(_0x3974b5){socket['emit'](_0x141a('0x90'),{'UserId':_0x3974b5,'VoiceQueueId':_0x2a0b8a['id']});});});});});});})[_0x141a('0x27')](respondWithStatusCode(_0x5a7afb,null))[_0x141a('0x4d')](handleError(_0x5a7afb,null));};exports['addAgents']=function(_0x388c84,_0x239936,_0x2fab4a){var _0x1e5094,_0x277698;return db[_0x141a('0x37')]['find']({'where':{'id':_0x388c84['params']['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x239936,null))['then'](function(_0x391fc6){if(_0x391fc6){_0x277698=_0x391fc6;return _0x391fc6[_0x141a('0x91')](_0x388c84[_0x141a('0x5b')]['ids'],_[_0x141a('0x5c')](_0x388c84[_0x141a('0x5b')],[_0x141a('0x8d'),'id'])||{})[_0x141a('0x92')](function(_0x20a7ca){for(var _0x1b0e57=0x0;_0x1b0e57<_0x388c84[_0x141a('0x5b')]['ids']['length'];_0x1b0e57+=0x1){socket['emit'](_0x141a('0x7c'),{'UserId':Number(_0x388c84[_0x141a('0x5b')][_0x141a('0x8d')][_0x1b0e57]),'VoiceQueueId':Number(_0x388c84[_0x141a('0x5d')]['id'])});}return _0x20a7ca;});}})[_0x141a('0x27')](function(_0x38344f){_0x1e5094=_0x38344f||[];if(_0x277698){return db[_0x141a('0x7e')]['findAll']({'where':{'id':_0x388c84[_0x141a('0x5b')][_0x141a('0x8d')]},'attributes':['id',_0x141a('0x31'),_0x141a('0x93'),_0x141a('0x6b'),_0x141a('0x78')],'raw':!![]});}})[_0x141a('0x27')](function(_0x4349e1){if(!_['isEmpty'](_0x4349e1)){var _0x2d61ab=[];for(var _0x2b8de=0x0;_0x2b8de<_0x4349e1[_0x141a('0x3f')];_0x2b8de++){if(_0x4349e1[_0x2b8de][_0x141a('0x93')]){_0x2d61ab['push'](db[_0x141a('0x76')][_0x141a('0x74')]({'membername':_0x4349e1[_0x2b8de][_0x141a('0x31')],'UserId':_0x4349e1[_0x2b8de]['id'],'queue_name':_0x277698[_0x141a('0x31')],'VoiceQueueId':_0x277698['id'],'interface':_['isNil'](_0x4349e1[_0x2b8de][_0x141a('0x78')])?util[_0x141a('0x79')]('SIP/%s',_0x4349e1[_0x2b8de]['name']):_0x4349e1[_0x2b8de][_0x141a('0x78')],'paused':_0x4349e1[_0x2b8de][_0x141a('0x6b')]||![],'penalty':_0x388c84[_0x141a('0x5b')]['penalty']||0x0}));}}return BPromise[_0x141a('0x8b')](_0x2d61ab);}})[_0x141a('0x27')](function(){return _0x1e5094;})[_0x141a('0x27')](respondWithResult(_0x239936,null))['catch'](handleError(_0x239936,null));};exports[_0x141a('0x8f')]=function(_0x327e5a,_0x26f3a1,_0x373495){return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x327e5a[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x26f3a1,null))['then'](function(_0x449381){if(_0x449381){return _0x449381[_0x141a('0x8f')](_0x327e5a[_0x141a('0x3b')]['ids'])[_0x141a('0x27')](function(){if(_['isArray'](_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')])){for(var _0x2f1b7e=0x0;_0x2f1b7e<_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')]['length'];_0x2f1b7e+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x327e5a['query'][_0x141a('0x8d')][_0x2f1b7e]),'VoiceQueueId':Number(_0x327e5a[_0x141a('0x5d')]['id'])});}}else{socket[_0x141a('0x7b')](_0x141a('0x90'),{'UserId':Number(_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')]),'VoiceQueueId':Number(_0x327e5a[_0x141a('0x5d')]['id'])});}});}})[_0x141a('0x27')](function(_0x549056){return db[_0x141a('0x76')][_0x141a('0x28')]({'where':{'VoiceQueueId':_0x327e5a[_0x141a('0x5d')]['id'],'UserId':_0x327e5a[_0x141a('0x3b')][_0x141a('0x8d')]}})[_0x141a('0x27')](function(){return _0x549056;});})['then'](respondWithStatusCode(_0x26f3a1,null))[_0x141a('0x4d')](handleError(_0x26f3a1,null));};exports[_0x141a('0x94')]=function(_0x130ede,_0x2fd8ba,_0x3cc042){var _0x5cb1ed={};var _0x57220f={};var _0x506b10;var _0x58d526;return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0x130ede[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x2fd8ba,null))['then'](function(_0xb99c43){if(_0xb99c43){_0x506b10=_0xb99c43;_0x57220f[_0x141a('0x3a')]=_[_0x141a('0x3c')](db['User'][_0x141a('0x38')]);_0x57220f[_0x141a('0x3b')]=_['keys'](_0x130ede[_0x141a('0x3b')]);_0x57220f[_0x141a('0x45')]=_[_0x141a('0x3d')](_0x57220f[_0x141a('0x3a')],_0x57220f[_0x141a('0x3b')]);_0x5cb1ed[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x57220f[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x130ede['query'][_0x141a('0x3e')]));_0x5cb1ed[_0x141a('0x40')]=_0x5cb1ed['attributes'][_0x141a('0x3f')]?_0x5cb1ed[_0x141a('0x40')]:_0x57220f['model'];_0x5cb1ed['order']=qs[_0x141a('0x43')](_0x130ede[_0x141a('0x3b')]['sort']);_0x5cb1ed['where']=qs['filters'](_[_0x141a('0x44')](_0x130ede['query'],_0x57220f[_0x141a('0x45')]));if(_0x130ede[_0x141a('0x3b')][_0x141a('0x2d')]){_0x5cb1ed['where']=_[_0x141a('0x47')](_0x5cb1ed[_0x141a('0x46')],{'$or':_['map'](_0x5cb1ed[_0x141a('0x40')],function(_0x478e72){var _0x3a7018={};_0x3a7018[_0x478e72]={'$like':'%'+_0x130ede[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x3a7018;})});}_0x5cb1ed=_[_0x141a('0x47')]({},_0x5cb1ed,_0x130ede[_0x141a('0x4f')]);return _0x506b10['getAgents'](_0x5cb1ed);}})[_0x141a('0x27')](function(_0x4cc831){if(_0x4cc831){_0x58d526=_0x4cc831[_0x141a('0x3f')];if(!_0x130ede[_0x141a('0x3b')][_0x141a('0x61')](_0x141a('0x41'))){_0x5cb1ed[_0x141a('0x21')]=qs[_0x141a('0x21')](_0x130ede[_0x141a('0x3b')][_0x141a('0x21')]);_0x5cb1ed[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x130ede[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x506b10['getAgents'](_0x5cb1ed);}})[_0x141a('0x27')](function(_0x89e45c){if(_0x89e45c){return _0x89e45c?{'count':_0x58d526,'rows':_0x89e45c}:null;}})[_0x141a('0x27')](respondWithResult(_0x2fd8ba,null))[_0x141a('0x4d')](handleError(_0x2fd8ba,null));};exports['getMembers']=function(_0x37d7c1,_0x1ca562,_0x1f2aa5){var _0x3f0e4b={};var _0x1291cf={};var _0x2a6d70;var _0x27ca0d;return db['VoiceQueue'][_0x141a('0x5f')]({'where':{'id':_0x37d7c1[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x1ca562,null))[_0x141a('0x27')](function(_0x508d44){if(_0x508d44){_0x2a6d70=_0x508d44;_0x1291cf[_0x141a('0x3a')]=_['keys'](db[_0x141a('0x76')][_0x141a('0x38')]);_0x1291cf[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x37d7c1['query']);_0x1291cf['filters']=_[_0x141a('0x3d')](_0x1291cf[_0x141a('0x3a')],_0x1291cf[_0x141a('0x3b')]);_0x3f0e4b['attributes']=_[_0x141a('0x3d')](_0x1291cf[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x37d7c1[_0x141a('0x3b')][_0x141a('0x3e')]));_0x3f0e4b['attributes']=_0x3f0e4b[_0x141a('0x40')][_0x141a('0x3f')]?_0x3f0e4b[_0x141a('0x40')]:_0x1291cf['model'];_0x3f0e4b[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x37d7c1['query']['sort']);_0x3f0e4b[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x37d7c1[_0x141a('0x3b')],_0x1291cf[_0x141a('0x45')]));if(_0x37d7c1[_0x141a('0x3b')][_0x141a('0x2d')]){_0x3f0e4b[_0x141a('0x46')]=_[_0x141a('0x47')](_0x3f0e4b['where'],{'$or':_['map'](_0x3f0e4b[_0x141a('0x40')],function(_0x38a449){var _0x2e21bb={};_0x2e21bb[_0x38a449]={'$like':'%'+_0x37d7c1[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x2e21bb;})});}_0x3f0e4b=_[_0x141a('0x47')]({},_0x3f0e4b,_0x37d7c1[_0x141a('0x4f')]);return _0x2a6d70[_0x141a('0x95')](_0x3f0e4b);}})['then'](function(_0x22cdbc){if(_0x22cdbc){_0x27ca0d=_0x22cdbc['length'];if(!_0x37d7c1[_0x141a('0x3b')][_0x141a('0x61')](_0x141a('0x41'))){_0x3f0e4b['limit']=qs['limit'](_0x37d7c1[_0x141a('0x3b')]['limit']);_0x3f0e4b[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0x37d7c1[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x2a6d70[_0x141a('0x95')](_0x3f0e4b);}})[_0x141a('0x27')](function(_0x36437c){return _0x36437c?{'count':_0x27ca0d,'rows':_0x36437c}:null;})[_0x141a('0x27')](respondWithResult(_0x1ca562,null))[_0x141a('0x4d')](handleError(_0x1ca562,null));};exports[_0x141a('0x96')]=function(_0x86e084,_0x5139c3,_0x2ed717){var _0x5c74b3={};var _0x19b9ba={};var _0x46c2f8;var _0x4228b8;return db['VoiceQueue'][_0x141a('0x5f')]({'where':{'id':_0x86e084['params']['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x5139c3,null))[_0x141a('0x27')](function(_0x6db3b0){if(_0x6db3b0){_0x46c2f8=_0x6db3b0;_0x19b9ba[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x97')][_0x141a('0x38')]);_0x19b9ba[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0x86e084[_0x141a('0x3b')]);_0x19b9ba[_0x141a('0x45')]=_['intersection'](_0x19b9ba[_0x141a('0x3a')],_0x19b9ba['query']);_0x5c74b3['attributes']=_[_0x141a('0x3d')](_0x19b9ba[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0x86e084[_0x141a('0x3b')][_0x141a('0x3e')]));_0x5c74b3['attributes']=_0x5c74b3[_0x141a('0x40')][_0x141a('0x3f')]?_0x5c74b3[_0x141a('0x40')]:_0x19b9ba['model'];_0x5c74b3[_0x141a('0x42')]=qs[_0x141a('0x43')](_0x86e084[_0x141a('0x3b')]['sort']);_0x5c74b3[_0x141a('0x46')]=qs['filters'](_[_0x141a('0x44')](_0x86e084[_0x141a('0x3b')],_0x19b9ba[_0x141a('0x45')]));if(_0x86e084[_0x141a('0x3b')][_0x141a('0x2d')]){_0x5c74b3['where']=_[_0x141a('0x47')](_0x5c74b3[_0x141a('0x46')],{'$or':_[_0x141a('0x36')](_0x5c74b3[_0x141a('0x40')],function(_0xb0ea11){var _0x15b285={};_0x15b285[_0xb0ea11]={'$like':'%'+_0x86e084[_0x141a('0x3b')]['filter']+'%'};return _0x15b285;})});}_0x5c74b3=_[_0x141a('0x47')]({},_0x5c74b3,_0x86e084[_0x141a('0x4f')]);return _0x46c2f8[_0x141a('0x96')](_0x5c74b3);}})[_0x141a('0x27')](function(_0x3456c5){if(_0x3456c5){_0x4228b8=_0x3456c5[_0x141a('0x3f')];if(!_0x86e084[_0x141a('0x3b')][_0x141a('0x61')]('nolimit')){_0x5c74b3[_0x141a('0x21')]=qs['limit'](_0x86e084[_0x141a('0x3b')]['limit']);_0x5c74b3[_0x141a('0x1f')]=qs['offset'](_0x86e084[_0x141a('0x3b')][_0x141a('0x1f')]);}return _0x46c2f8[_0x141a('0x96')](_0x5c74b3);}})['then'](function(_0x285f06){if(_0x285f06){return _0x285f06?{'count':_0x4228b8,'rows':_0x285f06}:null;}})[_0x141a('0x27')](respondWithResult(_0x5139c3,null))[_0x141a('0x4d')](handleError(_0x5139c3,null));};exports[_0x141a('0x98')]=function(_0x5f39aa,_0x2988c7,_0x597457){var _0x56c21e,_0x5bb0c2;return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x5f39aa[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x2988c7,null))['then'](function(_0x175af3){if(_0x175af3){_0x5bb0c2=_0x175af3;return _0x175af3[_0x141a('0x98')](_0x5f39aa[_0x141a('0x5b')][_0x141a('0x8d')],_[_0x141a('0x5c')](_0x5f39aa['body'],['ids','id'])||{});}return null;})[_0x141a('0x92')](function(_0x181a59){var _0x2b55d5;_0x56c21e=_0x181a59||[];var _0x4c06c2=[];if(_0x181a59){for(var _0x562dc1=0x0;_0x562dc1<_0x181a59[_0x141a('0x3f')];_0x562dc1+=0x1){var _0xc667d5=_0x181a59[_0x562dc1][_0x141a('0x29')]({'plain':!![]});_0x5bb0c2[_0x141a('0x99')]=_0x5f39aa[_0x141a('0x5b')][_0x141a('0x99')]?_0x5f39aa[_0x141a('0x5b')]['dialCheckDuplicateType']:_0x5bb0c2[_0x141a('0x99')];switch(_0x5bb0c2[_0x141a('0x99')]){case _0x141a('0x9a'):_0x2b55d5=squel[_0x141a('0x9b')]()[_0x141a('0x9c')]('cm_hopper')[_0x141a('0x9d')](['phone',_0x141a('0x9e'),'ContactId',_0x141a('0x9f'),_0x141a('0x62'),'createdAt',_0x141a('0x5a')],squel[_0x141a('0x7f')]()[_0x141a('0x80')]('phone',_0x141a('0xa0'))['field'](_0x141a('0xa1'),'scheduledAt')[_0x141a('0x80')]('id','ContactId')[_0x141a('0x80')](_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')](),_0x141a('0x9f'))['field'](_0x5f39aa['params']['id'][_0x141a('0x87')](),'VoiceQueueId')[_0x141a('0x80')](_0x141a('0xa1'),'createdAt')[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))['where'](_0x141a('0xa5'))[_0x141a('0x46')](_0x141a('0xa6'),_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')]())[_0x141a('0x46')](_0x141a('0xa7'))[_0x141a('0x46')](_0x141a('0xa8'),squel[_0x141a('0x7f')]()[_0x141a('0x80')]('COALESCE(calleridnum,\x27\x27)')[_0x141a('0xa3')](_0x141a('0xa9'))[_0x141a('0x46')](_0x141a('0x84'),_0x5f39aa['params']['id'][_0x141a('0x87')]()))[_0x141a('0x46')](_0x141a('0xa8'),squel[_0x141a('0x7f')]()['field'](_0x141a('0xaa'))[_0x141a('0xa3')]('cm_hopper')[_0x141a('0x46')](_0x141a('0x84'),_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')]())))[_0x141a('0x87')]();break;case'onlyIfOpen':_0x2b55d5=squel[_0x141a('0x9b')]()[_0x141a('0x9c')](_0x141a('0xab'))['fromQuery']([_0x141a('0xa0'),_0x141a('0x9e'),'ContactId',_0x141a('0x9f'),'VoiceQueueId',_0x141a('0xac'),_0x141a('0x5a')],squel[_0x141a('0x7f')]()['field'](_0x141a('0xa0'),'phone')[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x9e'))['field']('id','ContactId')[_0x141a('0x80')](_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')](),'ListId')['field'](_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')](),'VoiceQueueId')['field'](_0x141a('0xa1'),_0x141a('0xac'))[_0x141a('0x80')]('NOW()',_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))[_0x141a('0x46')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0xc667d5[_0x141a('0xa2')][_0x141a('0x87')]())[_0x141a('0x46')](_0x141a('0xa7'))[_0x141a('0x46')](_0x141a('0xa8'),squel[_0x141a('0x7f')]()[_0x141a('0x80')](_0x141a('0xaa'))[_0x141a('0xa3')](_0x141a('0xab'))['where'](_0x141a('0x84'),_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')]())))['toString']();break;default:_0x2b55d5=squel[_0x141a('0x9b')]()[_0x141a('0x9c')]('cm_hopper')[_0x141a('0x9d')]([_0x141a('0xa0'),_0x141a('0x9e'),_0x141a('0xad'),_0x141a('0x9f'),_0x141a('0x62'),_0x141a('0xac'),_0x141a('0x5a')],squel[_0x141a('0x7f')]()['field'](_0x141a('0xa0'),_0x141a('0xa0'))[_0x141a('0x80')]('NOW()',_0x141a('0x9e'))[_0x141a('0x80')]('id',_0x141a('0xad'))[_0x141a('0x80')](_0xc667d5['CmListId'][_0x141a('0x87')](),_0x141a('0x9f'))[_0x141a('0x80')](_0x5f39aa[_0x141a('0x5d')]['id'][_0x141a('0x87')](),_0x141a('0x62'))['field'](_0x141a('0xa1'),_0x141a('0xac'))[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))['where'](_0x141a('0xa5'))[_0x141a('0x46')]('ListId\x20=\x20?',_0xc667d5[_0x141a('0xa2')]['toString']())[_0x141a('0x46')](_0x141a('0xa7')))[_0x141a('0x87')]();}_0x4c06c2[_0x141a('0x86')](db['sequelize'][_0x141a('0x3b')](_0x2b55d5));}return BPromise[_0x141a('0x8b')](_0x4c06c2);}})[_0x141a('0x27')](function(){return _0x56c21e;})[_0x141a('0x27')](respondWithResult(_0x2988c7,null))[_0x141a('0x4d')](handleError(_0x2988c7,null));};exports[_0x141a('0xae')]=function(_0x165448,_0x381241,_0x2a3684){return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x165448[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x381241,null))[_0x141a('0x27')](function(_0x30c835){if(_0x30c835){return _0x30c835[_0x141a('0xae')](_0x165448['query']['ids']);}})[_0x141a('0x27')](function(_0x43c55f){if(_0x43c55f){return db['CmHopper'][_0x141a('0x28')]({'where':{'ListId':_0x165448[_0x141a('0x3b')]['ids'],'VoiceQueueId':_0x165448[_0x141a('0x5d')]['id']}})['then'](function(){return _0x43c55f;});}})[_0x141a('0x27')](respondWithStatusCode(_0x381241,null))[_0x141a('0x4d')](handleError(_0x381241,null));};exports[_0x141a('0xaf')]=function(_0xc7b005,_0x4ee663,_0x2ca503){var _0x1df999={};var _0x3cadf4={};var _0x352293;var _0x5418c6;return db[_0x141a('0x37')][_0x141a('0x5f')]({'where':{'id':_0xc7b005[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x4ee663,null))[_0x141a('0x27')](function(_0x56bdbb){if(_0x56bdbb){_0x352293=_0x56bdbb;_0x3cadf4[_0x141a('0x3a')]=_[_0x141a('0x3c')](db[_0x141a('0x97')][_0x141a('0x38')]);_0x3cadf4[_0x141a('0x3b')]=_[_0x141a('0x3c')](_0xc7b005[_0x141a('0x3b')]);_0x3cadf4[_0x141a('0x45')]=_['intersection'](_0x3cadf4[_0x141a('0x3a')],_0x3cadf4[_0x141a('0x3b')]);_0x1df999[_0x141a('0x40')]=_[_0x141a('0x3d')](_0x3cadf4[_0x141a('0x3a')],qs[_0x141a('0x3e')](_0xc7b005['query'][_0x141a('0x3e')]));_0x1df999[_0x141a('0x40')]=_0x1df999[_0x141a('0x40')]['length']?_0x1df999['attributes']:_0x3cadf4[_0x141a('0x3a')];_0x1df999[_0x141a('0x42')]=qs[_0x141a('0x43')](_0xc7b005['query'][_0x141a('0x43')]);_0x1df999[_0x141a('0x46')]=qs[_0x141a('0x45')](_[_0x141a('0x44')](_0xc7b005['query'],_0x3cadf4[_0x141a('0x45')]));if(_0xc7b005[_0x141a('0x3b')][_0x141a('0x2d')]){_0x1df999[_0x141a('0x46')]=_[_0x141a('0x47')](_0x1df999['where'],{'$or':_[_0x141a('0x36')](_0x1df999[_0x141a('0x40')],function(_0x4ec8ea){var _0x19f16f={};_0x19f16f[_0x4ec8ea]={'$like':'%'+_0xc7b005[_0x141a('0x3b')][_0x141a('0x2d')]+'%'};return _0x19f16f;})});}_0x1df999=_[_0x141a('0x47')]({},_0x1df999,_0xc7b005[_0x141a('0x4f')]);return _0x352293[_0x141a('0xaf')](_0x1df999);}})[_0x141a('0x27')](function(_0x140a96){if(_0x140a96){_0x5418c6=_0x140a96[_0x141a('0x3f')];if(!_0xc7b005['query'][_0x141a('0x61')](_0x141a('0x41'))){_0x1df999[_0x141a('0x21')]=qs[_0x141a('0x21')](_0xc7b005[_0x141a('0x3b')][_0x141a('0x21')]);_0x1df999[_0x141a('0x1f')]=qs[_0x141a('0x1f')](_0xc7b005['query']['offset']);}return _0x352293['getBlackLists'](_0x1df999);}})[_0x141a('0x27')](function(_0x4bb49b){if(_0x4bb49b){return _0x4bb49b?{'count':_0x5418c6,'rows':_0x4bb49b}:null;}})[_0x141a('0x27')](respondWithResult(_0x4ee663,null))[_0x141a('0x4d')](handleError(_0x4ee663,null));};exports[_0x141a('0xb0')]=function(_0x23c944,_0x332f73,_0x27a334){var _0x4eb965,_0x3b7d37;return db['VoiceQueue']['find']({'where':{'id':_0x23c944[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x332f73,null))[_0x141a('0x27')](function(_0x4f2f12){if(_0x4f2f12){_0x3b7d37=_0x4f2f12;return _0x4f2f12['addBlackLists'](_0x23c944[_0x141a('0x5b')][_0x141a('0x8d')],_[_0x141a('0x5c')](_0x23c944[_0x141a('0x5b')],['ids','id'])||{});}return null;})[_0x141a('0x92')](function(_0x5c5fe5){var _0x280c8c;_0x4eb965=_0x5c5fe5||[];var _0x128f7e=[];if(_0x5c5fe5){for(var _0x4330a0=0x0;_0x4330a0<_0x5c5fe5[_0x141a('0x3f')];_0x4330a0+=0x1){var _0x5f1d53=_0x5c5fe5[_0x4330a0][_0x141a('0x29')]({'plain':!![]});_0x280c8c=squel[_0x141a('0x9b')]()[_0x141a('0x9c')](_0x141a('0xb1'))[_0x141a('0x9d')](['phone',_0x141a('0xad'),_0x141a('0x9f'),_0x141a('0x62'),_0x141a('0xac'),_0x141a('0x5a')],squel[_0x141a('0x7f')]()[_0x141a('0x80')](_0x141a('0xa0'),_0x141a('0xa0'))[_0x141a('0x80')]('id',_0x141a('0xad'))[_0x141a('0x80')](_0x5f1d53['CmListId'][_0x141a('0x87')](),'ListId')[_0x141a('0x80')](_0x23c944['params']['id']['toString'](),_0x141a('0x62'))[_0x141a('0x80')](_0x141a('0xa1'),'createdAt')[_0x141a('0x80')](_0x141a('0xa1'),_0x141a('0x5a'))[_0x141a('0xa3')](_0x141a('0xa4'))[_0x141a('0x46')](_0x141a('0xa5'))[_0x141a('0x46')](_0x141a('0xa6'),_0x5f1d53[_0x141a('0xa2')][_0x141a('0x87')]())['where'](_0x141a('0xa7')))[_0x141a('0x87')]();_0x128f7e['push'](db[_0x141a('0x6f')][_0x141a('0x3b')](_0x280c8c));}return BPromise[_0x141a('0x8b')](_0x128f7e);}})[_0x141a('0x27')](function(){return _0x4eb965;})['then'](respondWithResult(_0x332f73,null))['catch'](handleError(_0x332f73,null));};exports[_0x141a('0xb2')]=function(_0x47d59f,_0x23b232,_0x41cc71){return db[_0x141a('0x37')][_0x141a('0x50')]({'where':{'id':_0x47d59f['params']['id']}})[_0x141a('0x27')](handleEntityNotFound(_0x23b232,null))[_0x141a('0x27')](function(_0x14dbba){if(_0x14dbba){return _0x14dbba[_0x141a('0xb2')](_0x47d59f[_0x141a('0x3b')]['ids']);}})[_0x141a('0x27')](function(_0x3ca2f8){if(_0x3ca2f8){return db[_0x141a('0x66')][_0x141a('0x28')]({'where':{'ListId':_0x47d59f[_0x141a('0x3b')][_0x141a('0x8d')],'VoiceQueueId':_0x47d59f[_0x141a('0x5d')]['id']}})[_0x141a('0x27')](function(){return _0x3ca2f8;});}})['then'](respondWithStatusCode(_0x23b232,null))[_0x141a('0x4d')](handleError(_0x23b232,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 65bfc1f..271f5e1 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 _0x6c8a=['events','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x266bc6,_0x56409d){var _0x481e33=function(_0x14e5ad){while(--_0x14e5ad){_0x266bc6['push'](_0x266bc6['shift']());}};_0x481e33(++_0x56409d);}(_0x6c8a,0x90));var _0xa6c8=function(_0x325fb9,_0x331331){_0x325fb9=_0x325fb9-0x0;var _0x30ddc0=_0x6c8a[_0x325fb9];return _0x30ddc0;};'use strict';var EventEmitter=require(_0xa6c8('0x0'));var VoiceQueue=require(_0xa6c8('0x1'))['db'][_0xa6c8('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6c8('0x3'),'afterUpdate':_0xa6c8('0x4'),'afterDestroy':_0xa6c8('0x5')};function emitEvent(_0x5be50b){return function(_0x30bc62,_0x29e351,_0x485304){VoiceQueueEvents[_0xa6c8('0x6')](_0x5be50b+':'+_0x30bc62['id'],_0x30bc62);VoiceQueueEvents[_0xa6c8('0x6')](_0x5be50b,_0x30bc62);_0x485304(null);};}for(var e in events){if(events[_0xa6c8('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa6c8('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x2e27=['save','update','remove','emit','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x183800,_0x146171){var _0x34aa35=function(_0x264662){while(--_0x264662){_0x183800['push'](_0x183800['shift']());}};_0x34aa35(++_0x146171);}(_0x2e27,0xa8));var _0x72e2=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2e27[_0x4b2863];return _0x567d67;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x72e2('0x0'))['db'][_0x72e2('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x72e2('0x2')](0x0);var events={'afterCreate':_0x72e2('0x3'),'afterUpdate':_0x72e2('0x4'),'afterDestroy':_0x72e2('0x5')};function emitEvent(_0x3de09e){return function(_0x2c14d6,_0x5cb3fc,_0x22179f){VoiceQueueEvents[_0x72e2('0x6')](_0x3de09e+':'+_0x2c14d6['id'],_0x2c14d6);VoiceQueueEvents[_0x72e2('0x6')](_0x3de09e,_0x2c14d6);_0x22179f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x72e2('0x7')](e,emitEvent(event));}}module[_0x72e2('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 3f94202..623baa3 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x133fef,_0x3525ba){var _0x2e9b82=function(_0x5b9cfb){while(--_0x5b9cfb){_0x133fef['push'](_0x133fef['shift']());}};_0x2e9b82(++_0x3525ba);}(_0x34e8,0x12c));var _0x834e=function(_0x546c88,_0x9eb162){_0x546c88=_0x546c88-0x0;var _0x1b46eb=_0x34e8[_0x546c88];return _0x1b46eb;};'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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x36e1e2,_0x5c36a9){var _0x3e5de8=function(_0x5ca6ff){while(--_0x5ca6ff){_0x36e1e2['push'](_0x36e1e2['shift']());}};_0x3e5de8(++_0x5c36a9);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 6bce88a..cc4a124 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 _0x6479=['result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','then','ShowVoiceQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0x6479,0x18a));var _0x9647=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0x6479[_0x4d03d6];return _0x22752e;};'use strict';var _=require(_0x9647('0x0'));var util=require(_0x9647('0x1'));var moment=require(_0x9647('0x2'));var BPromise=require(_0x9647('0x3'));var rs=require(_0x9647('0x4'));var fs=require('fs');var Redis=require(_0x9647('0x5'));var db=require(_0x9647('0x6'))['db'];var utils=require(_0x9647('0x7'));var logger=require(_0x9647('0x8'))(_0x9647('0x9'));var config=require('../../config/environment');var jayson=require(_0x9647('0xa'));var client=jayson['client'][_0x9647('0xb')]({'port':0x232a});config[_0x9647('0xc')]=_[_0x9647('0xd')](config[_0x9647('0xc')],{'host':_0x9647('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9647('0xc')]));require(_0x9647('0xf'))[_0x9647('0x10')](socket);function respondWithRpcPromise(_0x60a657,_0x2d2c25,_0x7a962e){return new BPromise(function(_0x523bd4,_0x5cccb4){return client[_0x9647('0x11')](_0x60a657,_0x7a962e)['then'](function(_0x248a73){logger[_0x9647('0x12')](_0x9647('0x13'),_0x2d2c25,_0x9647('0x14'));logger[_0x9647('0x15')](_0x9647('0x16'),_0x2d2c25,_0x9647('0x14'),JSON[_0x9647('0x17')](_0x248a73));if(_0x248a73[_0x9647('0x18')]){if(_0x248a73[_0x9647('0x18')]['code']===0x1f4){logger[_0x9647('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x2d2c25,_0x248a73[_0x9647('0x18')][_0x9647('0x19')]);return _0x5cccb4(_0x248a73[_0x9647('0x18')]['message']);}logger[_0x9647('0x18')](_0x9647('0x13'),_0x2d2c25,_0x248a73[_0x9647('0x18')][_0x9647('0x19')]);return _0x523bd4(_0x248a73[_0x9647('0x18')][_0x9647('0x19')]);}else{logger[_0x9647('0x12')](_0x9647('0x13'),_0x2d2c25,_0x9647('0x14'));_0x523bd4(_0x248a73[_0x9647('0x1a')][_0x9647('0x19')]);}})[_0x9647('0x1b')](function(_0x3b3a7b){logger[_0x9647('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x2d2c25,_0x3b3a7b);_0x5cccb4(_0x3b3a7b);});});}exports[_0x9647('0x1c')]=function(_0x161f3e){var _0x6ce2d9=this;return new Promise(function(_0x35c409,_0x5c6039){return db[_0x9647('0x1d')][_0x9647('0x1e')]({'raw':_0x161f3e['options']?_0x161f3e[_0x9647('0x1f')][_0x9647('0x20')]===undefined?!![]:![]:!![],'where':_0x161f3e[_0x9647('0x1f')]?_0x161f3e['options']['where']||null:null,'attributes':_0x161f3e[_0x9647('0x1f')]?_0x161f3e[_0x9647('0x1f')][_0x9647('0x21')]||null:null,'limit':_0x161f3e[_0x9647('0x1f')]?_0x161f3e[_0x9647('0x1f')][_0x9647('0x22')]||null:null,'include':_0x161f3e[_0x9647('0x1f')]?_0x161f3e[_0x9647('0x1f')][_0x9647('0x23')]?_[_0x9647('0x24')](_0x161f3e[_0x9647('0x1f')][_0x9647('0x23')],function(_0x37c2c6){return{'model':db[_0x37c2c6[_0x9647('0x25')]],'as':_0x37c2c6['as'],'attributes':_0x37c2c6[_0x9647('0x21')],'include':_0x37c2c6[_0x9647('0x23')]?_[_0x9647('0x24')](_0x37c2c6['include'],function(_0x29d16d){return{'model':db[_0x29d16d[_0x9647('0x25')]],'as':_0x29d16d['as'],'attributes':_0x29d16d[_0x9647('0x21')],'include':_0x29d16d[_0x9647('0x23')]?_[_0x9647('0x24')](_0x29d16d[_0x9647('0x23')],function(_0x2eeaa6){return{'model':db[_0x2eeaa6[_0x9647('0x25')]],'as':_0x2eeaa6['as'],'attributes':_0x2eeaa6[_0x9647('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9647('0x26')](function(_0x3aff90){logger[_0x9647('0x12')](_0x9647('0x1c'),_0x161f3e);logger[_0x9647('0x15')]('GetVoiceQueue',_0x161f3e,JSON[_0x9647('0x17')](_0x3aff90));_0x35c409(_0x3aff90);})[_0x9647('0x1b')](function(_0x49cc95){logger[_0x9647('0x18')](_0x9647('0x1c'),_0x49cc95[_0x9647('0x19')],_0x161f3e);_0x5c6039(_0x6ce2d9[_0x9647('0x18')](0x1f4,_0x49cc95[_0x9647('0x19')]));});});};exports[_0x9647('0x27')]=function(_0x53dc5a){var _0x2e643f=this;return new Promise(function(_0x1b244c,_0x482b18){return db[_0x9647('0x1d')][_0x9647('0x28')]({'raw':_0x53dc5a['options']?_0x53dc5a['options'][_0x9647('0x20')]===undefined?!![]:![]:!![],'where':_0x53dc5a[_0x9647('0x1f')]?_0x53dc5a[_0x9647('0x1f')][_0x9647('0x29')]||null:null,'attributes':_0x53dc5a[_0x9647('0x1f')]?_0x53dc5a[_0x9647('0x1f')]['attributes']||null:null,'include':_0x53dc5a['options']?_0x53dc5a['options'][_0x9647('0x23')]?_['map'](_0x53dc5a[_0x9647('0x1f')][_0x9647('0x23')],function(_0x7b4839){return{'model':db[_0x7b4839[_0x9647('0x25')]],'as':_0x7b4839['as'],'attributes':_0x7b4839[_0x9647('0x21')],'include':_0x7b4839[_0x9647('0x23')]?_[_0x9647('0x24')](_0x7b4839[_0x9647('0x23')],function(_0x300330){return{'model':db[_0x300330[_0x9647('0x25')]],'as':_0x300330['as'],'attributes':_0x300330['attributes'],'include':_0x300330['include']?_['map'](_0x300330[_0x9647('0x23')],function(_0x16dba9){return{'model':db[_0x16dba9['model']],'as':_0x16dba9['as'],'attributes':_0x16dba9[_0x9647('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3042bc){logger[_0x9647('0x12')](_0x9647('0x27'),_0x53dc5a);logger[_0x9647('0x15')](_0x9647('0x27'),_0x53dc5a,JSON[_0x9647('0x17')](_0x3042bc));_0x1b244c(_0x3042bc);})[_0x9647('0x1b')](function(_0x4c9a64){logger[_0x9647('0x18')]('ShowVoiceQueue',_0x4c9a64[_0x9647('0x19')],_0x53dc5a);_0x482b18(_0x2e643f[_0x9647('0x18')](0x1f4,_0x4c9a64[_0x9647('0x19')]));});});}; \ No newline at end of file +var _0x082a=['raw','where','attributes','include','model','map','GetVoiceQueue','stringify','ShowVoiceQueue','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','VoiceQueue','findAll','options'];(function(_0x1c9205,_0x538b38){var _0x4bd51a=function(_0x77709f){while(--_0x77709f){_0x1c9205['push'](_0x1c9205['shift']());}};_0x4bd51a(++_0x538b38);}(_0x082a,0x1a4));var _0xa082=function(_0x205818,_0xe9dc3f){_0x205818=_0x205818-0x0;var _0x41b12f=_0x082a[_0x205818];return _0x41b12f;};'use strict';var _=require(_0xa082('0x0'));var util=require(_0xa082('0x1'));var moment=require('moment');var BPromise=require(_0xa082('0x2'));var rs=require(_0xa082('0x3'));var fs=require('fs');var Redis=require(_0xa082('0x4'));var db=require(_0xa082('0x5'))['db'];var utils=require(_0xa082('0x6'));var logger=require(_0xa082('0x7'))(_0xa082('0x8'));var config=require(_0xa082('0x9'));var jayson=require(_0xa082('0xa'));var client=jayson[_0xa082('0xb')]['http']({'port':0x232a});config[_0xa082('0xc')]=_[_0xa082('0xd')](config[_0xa082('0xc')],{'host':_0xa082('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa082('0xc')]));require(_0xa082('0xf'))[_0xa082('0x10')](socket);function respondWithRpcPromise(_0x2c5f56,_0x3f1291,_0x5ee527){return new BPromise(function(_0x2e6b8b,_0x54581e){return client[_0xa082('0x11')](_0x2c5f56,_0x5ee527)[_0xa082('0x12')](function(_0x56f00a){logger[_0xa082('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x3f1291,_0xa082('0x14'));logger[_0xa082('0x15')](_0xa082('0x16'),_0x3f1291,_0xa082('0x14'),JSON['stringify'](_0x56f00a));if(_0x56f00a[_0xa082('0x17')]){if(_0x56f00a[_0xa082('0x17')][_0xa082('0x18')]===0x1f4){logger['error'](_0xa082('0x19'),_0x3f1291,_0x56f00a[_0xa082('0x17')][_0xa082('0x1a')]);return _0x54581e(_0x56f00a['error'][_0xa082('0x1a')]);}logger[_0xa082('0x17')](_0xa082('0x19'),_0x3f1291,_0x56f00a[_0xa082('0x17')][_0xa082('0x1a')]);return _0x2e6b8b(_0x56f00a[_0xa082('0x17')][_0xa082('0x1a')]);}else{logger[_0xa082('0x13')](_0xa082('0x19'),_0x3f1291,_0xa082('0x14'));_0x2e6b8b(_0x56f00a[_0xa082('0x1b')][_0xa082('0x1a')]);}})['catch'](function(_0x364531){logger['error'](_0xa082('0x19'),_0x3f1291,_0x364531);_0x54581e(_0x364531);});});}exports['GetVoiceQueue']=function(_0xd1ef1b){var _0x512f16=this;return new Promise(function(_0x17d3c9,_0x1764c0){return db[_0xa082('0x1c')][_0xa082('0x1d')]({'raw':_0xd1ef1b[_0xa082('0x1e')]?_0xd1ef1b[_0xa082('0x1e')][_0xa082('0x1f')]===undefined?!![]:![]:!![],'where':_0xd1ef1b['options']?_0xd1ef1b['options'][_0xa082('0x20')]||null:null,'attributes':_0xd1ef1b[_0xa082('0x1e')]?_0xd1ef1b['options'][_0xa082('0x21')]||null:null,'limit':_0xd1ef1b['options']?_0xd1ef1b['options']['limit']||null:null,'include':_0xd1ef1b[_0xa082('0x1e')]?_0xd1ef1b[_0xa082('0x1e')][_0xa082('0x22')]?_['map'](_0xd1ef1b[_0xa082('0x1e')]['include'],function(_0x213e53){return{'model':db[_0x213e53[_0xa082('0x23')]],'as':_0x213e53['as'],'attributes':_0x213e53[_0xa082('0x21')],'include':_0x213e53['include']?_['map'](_0x213e53['include'],function(_0x1f5877){return{'model':db[_0x1f5877[_0xa082('0x23')]],'as':_0x1f5877['as'],'attributes':_0x1f5877[_0xa082('0x21')],'include':_0x1f5877[_0xa082('0x22')]?_[_0xa082('0x24')](_0x1f5877[_0xa082('0x22')],function(_0x30b0ba){return{'model':db[_0x30b0ba['model']],'as':_0x30b0ba['as'],'attributes':_0x30b0ba[_0xa082('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa082('0x12')](function(_0x2e41bd){logger[_0xa082('0x13')](_0xa082('0x25'),_0xd1ef1b);logger[_0xa082('0x15')](_0xa082('0x25'),_0xd1ef1b,JSON[_0xa082('0x26')](_0x2e41bd));_0x17d3c9(_0x2e41bd);})['catch'](function(_0x556e47){logger[_0xa082('0x17')]('GetVoiceQueue',_0x556e47[_0xa082('0x1a')],_0xd1ef1b);_0x1764c0(_0x512f16['error'](0x1f4,_0x556e47[_0xa082('0x1a')]));});});};exports[_0xa082('0x27')]=function(_0x4a65d0){var _0xdc1922=this;return new Promise(function(_0x43db53,_0x4f60d7){return db['VoiceQueue']['find']({'raw':_0x4a65d0['options']?_0x4a65d0['options'][_0xa082('0x1f')]===undefined?!![]:![]:!![],'where':_0x4a65d0[_0xa082('0x1e')]?_0x4a65d0[_0xa082('0x1e')][_0xa082('0x20')]||null:null,'attributes':_0x4a65d0[_0xa082('0x1e')]?_0x4a65d0['options']['attributes']||null:null,'include':_0x4a65d0[_0xa082('0x1e')]?_0x4a65d0['options'][_0xa082('0x22')]?_['map'](_0x4a65d0[_0xa082('0x1e')][_0xa082('0x22')],function(_0x5eace5){return{'model':db[_0x5eace5['model']],'as':_0x5eace5['as'],'attributes':_0x5eace5[_0xa082('0x21')],'include':_0x5eace5[_0xa082('0x22')]?_['map'](_0x5eace5[_0xa082('0x22')],function(_0x32f17f){return{'model':db[_0x32f17f[_0xa082('0x23')]],'as':_0x32f17f['as'],'attributes':_0x32f17f[_0xa082('0x21')],'include':_0x32f17f['include']?_['map'](_0x32f17f['include'],function(_0x2cf53d){return{'model':db[_0x2cf53d[_0xa082('0x23')]],'as':_0x2cf53d['as'],'attributes':_0x2cf53d[_0xa082('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa082('0x12')](function(_0x481110){logger[_0xa082('0x13')](_0xa082('0x27'),_0x4a65d0);logger[_0xa082('0x15')](_0xa082('0x27'),_0x4a65d0,JSON[_0xa082('0x26')](_0x481110));_0x43db53(_0x481110);})[_0xa082('0x28')](function(_0x1b8961){logger[_0xa082('0x17')]('ShowVoiceQueue',_0x1b8961[_0xa082('0x1a')],_0x4a65d0);_0x4f60d7(_0xdc1922[_0xa082('0x17')](0x1f4,_0x1b8961[_0xa082('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3810602..628a783 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 _0x9706=['length','voiceQueue:','./voiceQueue.events','update','emit','removeListener'];(function(_0x126cd0,_0xea6882){var _0xbbb117=function(_0x2f1f2f){while(--_0x2f1f2f){_0x126cd0['push'](_0x126cd0['shift']());}};_0xbbb117(++_0xea6882);}(_0x9706,0x1ac));var _0x6970=function(_0x271a24,_0x547869){_0x271a24=_0x271a24-0x0;var _0x47816f=_0x9706[_0x271a24];return _0x47816f;};'use strict';var VoiceQueueEvents=require(_0x6970('0x0'));var events=['save','remove',_0x6970('0x1')];function createListener(_0x3d5f3b,_0x1dd931){return function(_0x4b56a3){_0x1dd931[_0x6970('0x2')](_0x3d5f3b,_0x4b56a3);};}function removeListener(_0x3462ea,_0x47696d){return function(){VoiceQueueEvents[_0x6970('0x3')](_0x3462ea,_0x47696d);};}exports['register']=function(_0x48db02){for(var _0x51e097=0x0,_0x39aaf1=events[_0x6970('0x4')];_0x51e097<_0x39aaf1;_0x51e097++){var _0x1c050e=events[_0x51e097];var _0xd583e4=createListener(_0x6970('0x5')+_0x1c050e,_0x48db02);VoiceQueueEvents['on'](_0x1c050e,_0xd583e4);}}; \ No newline at end of file +var _0xc726=['remove','update','emit','length','./voiceQueue.events'];(function(_0x95dbd7,_0x537d57){var _0x482fd4=function(_0x14c2b7){while(--_0x14c2b7){_0x95dbd7['push'](_0x95dbd7['shift']());}};_0x482fd4(++_0x537d57);}(_0xc726,0x130));var _0x6c72=function(_0x235e59,_0x2a015d){_0x235e59=_0x235e59-0x0;var _0x19aa97=_0xc726[_0x235e59];return _0x19aa97;};'use strict';var VoiceQueueEvents=require(_0x6c72('0x0'));var events=['save',_0x6c72('0x1'),_0x6c72('0x2')];function createListener(_0x542466,_0x20175c){return function(_0x23daff){_0x20175c[_0x6c72('0x3')](_0x542466,_0x23daff);};}function removeListener(_0x4a0f9b,_0x51fa9c){return function(){VoiceQueueEvents['removeListener'](_0x4a0f9b,_0x51fa9c);};}exports['register']=function(_0x58ac57){for(var _0x580431=0x0,_0x78e799=events[_0x6c72('0x4')];_0x580431<_0x78e799;_0x580431++){var _0x370a25=events[_0x580431];var _0x5f1f92=createListener('voiceQueue:'+_0x370a25,_0x58ac57);VoiceQueueEvents['on'](_0x370a25,_0x5f1f92);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6ea0c58..dcfdd2c 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 _0x8ba6=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/index','getVoiceQueuesReport','/:id','post'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x8ba6,0x13a));var _0x68ba=function(_0x96822e,_0x2e1d69){_0x96822e=_0x96822e-0x0;var _0x46b9c7=_0x8ba6[_0x96822e];return _0x46b9c7;};'use strict';var multer=require(_0x68ba('0x0'));var util=require(_0x68ba('0x1'));var path=require(_0x68ba('0x2'));var timeout=require(_0x68ba('0x3'));var express=require(_0x68ba('0x4'));var router=express[_0x68ba('0x5')]();var fs_extra=require(_0x68ba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ba('0x7'));var config=require(_0x68ba('0x8'));var controller=require('./voiceQueueReport.controller');router[_0x68ba('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ba('0x9')](_0x68ba('0xa'),auth[_0x68ba('0xb')](),controller['describe']);router['get'](_0x68ba('0xc'),auth[_0x68ba('0xb')](),controller[_0x68ba('0xd')]);router[_0x68ba('0x9')](_0x68ba('0xe'),auth[_0x68ba('0xb')](),controller['show']);router[_0x68ba('0xf')]('/',auth['isAuthenticated'](),controller[_0x68ba('0x10')]);router[_0x68ba('0x11')](_0x68ba('0xe'),auth[_0x68ba('0xb')](),controller[_0x68ba('0x12')]);router[_0x68ba('0x13')](_0x68ba('0xe'),auth[_0x68ba('0xb')](),controller[_0x68ba('0x14')]);module[_0x68ba('0x15')]=router; \ No newline at end of file +var _0xe64a=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','/:id','show','post','create','update'];(function(_0x5473e5,_0x34da63){var _0x296320=function(_0x261d5d){while(--_0x261d5d){_0x5473e5['push'](_0x5473e5['shift']());}};_0x296320(++_0x34da63);}(_0xe64a,0x1e2));var _0xae64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe64a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require('connect-timeout');var express=require(_0xae64('0x3'));var router=express[_0xae64('0x4')]();var fs_extra=require(_0xae64('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae64('0x6'));var config=require('../../config/environment');var controller=require(_0xae64('0x7'));router[_0xae64('0x8')]('/',auth[_0xae64('0x9')](),controller[_0xae64('0xa')]);router[_0xae64('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xae64('0xb')]);router[_0xae64('0x8')](_0xae64('0xc'),auth[_0xae64('0x9')](),controller['getVoiceQueuesReport']);router[_0xae64('0x8')](_0xae64('0xd'),auth[_0xae64('0x9')](),controller[_0xae64('0xe')]);router[_0xae64('0xf')]('/',auth[_0xae64('0x9')](),controller[_0xae64('0x10')]);router['put'](_0xae64('0xd'),auth[_0xae64('0x9')](),controller[_0xae64('0x11')]);router['delete'](_0xae64('0xd'),auth[_0xae64('0x9')](),controller[_0xae64('0x12')]);module[_0xae64('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 89ebeaa..fb4146e 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 _0x91b4=['moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x91b4,0x1e0));var _0x491b=function(_0x4dec2f,_0x104cb9){_0x4dec2f=_0x4dec2f-0x0;var _0x2e7951=_0x91b4[_0x4dec2f];return _0x2e7951;};'use strict';var Sequelize=require(_0x491b('0x0'));var moment=require(_0x491b('0x1'));module[_0x491b('0x2')]={'type':{'type':Sequelize[_0x491b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x491b('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x491b('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x491b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x491b('0x4')],'set':function(_0x1e6666){var _0x3d6508=moment(_0x1e6666);var _0x17af71=moment(this[_0x491b('0x5')]('queuecallerjoinAt'))[_0x491b('0x6')](_0x491b('0x7'));var _0x1f6039=_0x3d6508['diff'](_0x17af71,_0x491b('0x8'));this['setDataValue']('queuecallerleaveAt',_0x1e6666);this['setDataValue'](_0x491b('0x9'),_0x1f6039||null);}},'position':{'type':Sequelize[_0x491b('0xa')]},'count':{'type':Sequelize[_0x491b('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x491b('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x491b('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x491b('0x4')]},'queuecallerexit':{'type':Sequelize[_0x491b('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x491b('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x491b('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x491b('0x3')]},'connectedlinenum':{'type':Sequelize[_0x491b('0x3')]},'connectedlinename':{'type':Sequelize[_0x491b('0x3')]},'accountcode':{'type':Sequelize[_0x491b('0x3')]},'context':{'type':Sequelize[_0x491b('0x3')]},'exten':{'type':Sequelize[_0x491b('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x491b('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x491b('0x3')]},'transfer':{'type':Sequelize[_0x491b('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x491b('0xc')},'transferexten':{'type':Sequelize[_0x491b('0x3')]},'transferuniqueid':{'type':Sequelize[_0x491b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x491b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x491b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x491b('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2e7=['diff','setDataValue','holdtime','INTEGER','BOOLEAN','DATE','FORWARD,\x20BLIND,\x20ATTENDED','STRING','getDataValue','queuecallerjoinAt','format'];(function(_0x52761c,_0x40a3fe){var _0x115499=function(_0x335302){while(--_0x335302){_0x52761c['push'](_0x52761c['shift']());}};_0x115499(++_0x40a3fe);}(_0xc2e7,0x19e));var _0x7c2e=function(_0x50a806,_0x58c826){_0x50a806=_0x50a806-0x0;var _0x2c89d2=_0xc2e7[_0x50a806];return _0x2c89d2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7c2e('0x0')]},'calleridnum':{'type':Sequelize[_0x7c2e('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7c2e('0x0')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0xf1d49b){var _0x566a5c=moment(_0xf1d49b);var _0x22a289=moment(this[_0x7c2e('0x1')](_0x7c2e('0x2')))[_0x7c2e('0x3')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4b1af3=_0x566a5c[_0x7c2e('0x4')](_0x22a289,'seconds');this[_0x7c2e('0x5')]('queuecallerleaveAt',_0xf1d49b);this[_0x7c2e('0x5')](_0x7c2e('0x6'),_0x4b1af3||null);}},'position':{'type':Sequelize[_0x7c2e('0x7')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7c2e('0x9')]},'queuecallerexit':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7c2e('0x9')]},'queuecallerexitreason':{'type':Sequelize[_0x7c2e('0x0')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7c2e('0x7')]},'channel':{'type':Sequelize[_0x7c2e('0x0')]},'connectedlinenum':{'type':Sequelize[_0x7c2e('0x0')]},'connectedlinename':{'type':Sequelize[_0x7c2e('0x0')]},'accountcode':{'type':Sequelize[_0x7c2e('0x0')]},'context':{'type':Sequelize[_0x7c2e('0x0')]},'exten':{'type':Sequelize[_0x7c2e('0x0')]},'priority':{'type':Sequelize[_0x7c2e('0x0')]},'holdtime':{'type':Sequelize[_0x7c2e('0x7')]},'mohtime':{'type':Sequelize[_0x7c2e('0x7')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7c2e('0x0')]},'transfer':{'type':Sequelize[_0x7c2e('0x8')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7c2e('0x0')],'comment':_0x7c2e('0xa')},'transferexten':{'type':Sequelize[_0x7c2e('0x0')]},'transferuniqueid':{'type':Sequelize[_0x7c2e('0x0')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7c2e('0x0')]},'thirdDisposition':{'type':Sequelize[_0x7c2e('0x0')]},'queuecallerenterreason':{'type':Sequelize[_0x7c2e('0x7')],'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 0481130..8017211 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 _0xfe45=['ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','where','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','describe','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x1150e1,_0x192f84){var _0x5bbc72=function(_0x582c9d){while(--_0x582c9d){_0x1150e1['push'](_0x1150e1['shift']());}};_0x5bbc72(++_0x192f84);}(_0xfe45,0xf2));var _0x5fe4=function(_0x5e50e6,_0x2d28b8){_0x5e50e6=_0x5e50e6-0x0;var _0x5dd664=_0xfe45[_0x5e50e6];return _0x5dd664;};'use strict';var emlformat=require(_0x5fe4('0x0'));var rimraf=require(_0x5fe4('0x1'));var zipdir=require(_0x5fe4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fe4('0x3'));var moment=require(_0x5fe4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5fe4('0x5'));var util=require(_0x5fe4('0x6'));var path=require(_0x5fe4('0x7'));var sox=require(_0x5fe4('0x8'));var csv=require(_0x5fe4('0x9'));var ejs=require(_0x5fe4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fe4('0xb'));var squel=require(_0x5fe4('0xc'));var crypto=require(_0x5fe4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5fe4('0xe'));var toCsv=require(_0x5fe4('0x9'));var querystring=require(_0x5fe4('0xf'));var Papa=require('papaparse');var Redis=require(_0x5fe4('0x10'));var authService=require(_0x5fe4('0x11'));var qs=require(_0x5fe4('0x12'));var as=require(_0x5fe4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fe4('0x14'))(_0x5fe4('0x15'));var utils=require(_0x5fe4('0x16'));var config=require(_0x5fe4('0x17'));var licenseUtil=require(_0x5fe4('0x18'));var db=require(_0x5fe4('0x19'))['db'];config[_0x5fe4('0x1a')]=_[_0x5fe4('0x1b')](config['redis'],{'host':_0x5fe4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fe4('0x1a')]));require(_0x5fe4('0x1d'))[_0x5fe4('0x1e')](socket);function respondWithStatusCode(_0x2cfd8d,_0x3d8952){_0x3d8952=_0x3d8952||0xcc;return function(_0x24753d){if(_0x24753d){return _0x2cfd8d[_0x5fe4('0x1f')](_0x3d8952);}return _0x2cfd8d[_0x5fe4('0x20')](_0x3d8952)[_0x5fe4('0x21')]();};}function respondWithResult(_0x990e2,_0x2ca397){_0x2ca397=_0x2ca397||0xc8;return function(_0x4a68c5){if(_0x4a68c5){return _0x990e2[_0x5fe4('0x20')](_0x2ca397)[_0x5fe4('0x22')](_0x4a68c5);}};}function respondWithFilteredResult(_0x442ac0,_0x34065d){return function(_0x2cd36d){if(_0x2cd36d){var _0x41f527=typeof _0x34065d[_0x5fe4('0x23')]===_0x5fe4('0x24')&&typeof _0x34065d[_0x5fe4('0x25')]==='undefined';var _0x36676a=_0x2cd36d[_0x5fe4('0x26')];var _0x9ecfaf=_0x41f527?0x0:_0x34065d[_0x5fe4('0x23')];var _0x1e00a2=_0x41f527?_0x2cd36d['count']:_0x34065d['offset']+_0x34065d[_0x5fe4('0x25')];var _0x6182b;if(_0x1e00a2>=_0x36676a){_0x1e00a2=_0x36676a;_0x6182b=0xc8;}else{_0x6182b=0xce;}_0x442ac0[_0x5fe4('0x20')](_0x6182b);return _0x442ac0[_0x5fe4('0x27')]('Content-Range',_0x9ecfaf+'-'+_0x1e00a2+'/'+_0x36676a)[_0x5fe4('0x22')](_0x2cd36d);}return null;};}function patchUpdates(_0x4c4397){return function(_0x57cb14){try{jsonpatch[_0x5fe4('0x28')](_0x57cb14,_0x4c4397,!![]);}catch(_0x19727a){return BPromise['reject'](_0x19727a);}return _0x57cb14[_0x5fe4('0x29')]();};}function saveUpdates(_0x3ac49c,_0x55e1c7){return function(_0x1ed4d1){if(_0x1ed4d1){return _0x1ed4d1[_0x5fe4('0x2a')](_0x3ac49c)[_0x5fe4('0x2b')](function(_0x469793){return _0x469793;});}return null;};}function removeEntity(_0x505042,_0x2ce876){return function(_0x469030){if(_0x469030){return _0x469030['destroy']()[_0x5fe4('0x2b')](function(){_0x505042[_0x5fe4('0x20')](0xcc)[_0x5fe4('0x21')]();});}};}function handleEntityNotFound(_0x22df91,_0x1e0bb0){return function(_0x4e09ab){if(!_0x4e09ab){_0x22df91[_0x5fe4('0x1f')](0x194);}return _0x4e09ab;};}function handleError(_0x497612,_0x44f192){_0x44f192=_0x44f192||0x1f4;return function(_0x309e07){logger[_0x5fe4('0x2c')](_0x309e07[_0x5fe4('0x2d')]);if(_0x309e07['name']){delete _0x309e07[_0x5fe4('0x2e')];}_0x497612[_0x5fe4('0x20')](_0x44f192)[_0x5fe4('0x2f')](_0x309e07);};}exports[_0x5fe4('0x30')]=function(_0x1df259,_0x133b56){var _0x265cb1={},_0x62579a={},_0x2fcbbf={'count':0x0,'rows':[]};var _0x262252=_[_0x5fe4('0x31')](db['VoiceQueueReport'][_0x5fe4('0x32')],function(_0x3fe6f3){return{'name':_0x3fe6f3['fieldName'],'type':_0x3fe6f3['type'][_0x5fe4('0x33')]};});_0x62579a['model']=_[_0x5fe4('0x31')](_0x262252,_0x5fe4('0x2e'));_0x62579a[_0x5fe4('0x34')]=_[_0x5fe4('0x35')](_0x1df259[_0x5fe4('0x34')]);_0x62579a[_0x5fe4('0x36')]=_['intersection'](_0x62579a[_0x5fe4('0x37')],_0x62579a['query']);_0x265cb1['attributes']=_[_0x5fe4('0x38')](_0x62579a[_0x5fe4('0x37')],qs['fields'](_0x1df259[_0x5fe4('0x34')][_0x5fe4('0x39')]));_0x265cb1['attributes']=_0x265cb1[_0x5fe4('0x3a')][_0x5fe4('0x3b')]?_0x265cb1[_0x5fe4('0x3a')]:_0x62579a[_0x5fe4('0x37')];if(!_0x1df259['query'][_0x5fe4('0x3c')](_0x5fe4('0x3d'))){_0x265cb1['limit']=qs['limit'](_0x1df259[_0x5fe4('0x34')]['limit']);_0x265cb1['offset']=qs[_0x5fe4('0x23')](_0x1df259[_0x5fe4('0x34')][_0x5fe4('0x23')]);}_0x265cb1['order']=qs[_0x5fe4('0x3e')](_0x1df259[_0x5fe4('0x34')][_0x5fe4('0x3e')]);_0x265cb1['where']=qs[_0x5fe4('0x36')](_[_0x5fe4('0x3f')](_0x1df259[_0x5fe4('0x34')],_0x62579a['filters']),_0x262252);if(_0x1df259[_0x5fe4('0x34')][_0x5fe4('0x40')]){_0x265cb1['where']=_[_0x5fe4('0x41')](_0x265cb1['where'],{'$or':_[_0x5fe4('0x31')](_0x262252,function(_0x583917){if(_0x583917[_0x5fe4('0x42')]!=='VIRTUAL'){var _0x5e36d4={};_0x5e36d4[_0x583917[_0x5fe4('0x2e')]]={'$like':'%'+_0x1df259[_0x5fe4('0x34')][_0x5fe4('0x40')]+'%'};return _0x5e36d4;}})});}_0x265cb1=_[_0x5fe4('0x41')]({},_0x265cb1,_0x1df259['options']);var _0x1a8c9b={'where':_0x265cb1[_0x5fe4('0x43')]};return db[_0x5fe4('0x44')][_0x5fe4('0x26')](_0x1a8c9b)[_0x5fe4('0x2b')](function(_0x25a3f9){_0x2fcbbf['count']=_0x25a3f9;if(_0x1df259['query'][_0x5fe4('0x45')]){_0x265cb1[_0x5fe4('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x5fe4('0x47')](_0x265cb1);})['then'](function(_0x159f82){_0x2fcbbf[_0x5fe4('0x48')]=_0x159f82;return _0x2fcbbf;})['then'](respondWithFilteredResult(_0x133b56,_0x265cb1))[_0x5fe4('0x49')](handleError(_0x133b56,null));};exports[_0x5fe4('0x4a')]=function(_0x545926,_0x378767){var _0x538180={'raw':![],'where':{'id':_0x545926[_0x5fe4('0x4b')]['id']}},_0x49db9c={};_0x49db9c[_0x5fe4('0x37')]=_[_0x5fe4('0x35')](db[_0x5fe4('0x44')][_0x5fe4('0x32')]);_0x49db9c['query']=_[_0x5fe4('0x35')](_0x545926[_0x5fe4('0x34')]);_0x49db9c[_0x5fe4('0x36')]=_[_0x5fe4('0x38')](_0x49db9c[_0x5fe4('0x37')],_0x49db9c[_0x5fe4('0x34')]);_0x538180[_0x5fe4('0x3a')]=_[_0x5fe4('0x38')](_0x49db9c[_0x5fe4('0x37')],qs[_0x5fe4('0x39')](_0x545926[_0x5fe4('0x34')][_0x5fe4('0x39')]));_0x538180[_0x5fe4('0x3a')]=_0x538180[_0x5fe4('0x3a')]['length']?_0x538180[_0x5fe4('0x3a')]:_0x49db9c[_0x5fe4('0x37')];if(_0x545926[_0x5fe4('0x34')][_0x5fe4('0x45')]){_0x538180[_0x5fe4('0x46')]=[{'all':!![]}];}_0x538180=_['merge']({},_0x538180,_0x545926[_0x5fe4('0x4c')]);return db[_0x5fe4('0x44')][_0x5fe4('0x4d')](_0x538180)[_0x5fe4('0x2b')](handleEntityNotFound(_0x378767,null))['then'](respondWithResult(_0x378767,null))['catch'](handleError(_0x378767,null));};exports[_0x5fe4('0x4e')]=function(_0x23dd9d,_0x4e0fc4){return db[_0x5fe4('0x44')]['create'](_0x23dd9d[_0x5fe4('0x4f')],{})['then'](respondWithResult(_0x4e0fc4,0xc9))[_0x5fe4('0x49')](handleError(_0x4e0fc4,null));};exports[_0x5fe4('0x2a')]=function(_0x2b2533,_0x42a62b){if(_0x2b2533[_0x5fe4('0x4f')]['id']){delete _0x2b2533[_0x5fe4('0x4f')]['id'];}return db[_0x5fe4('0x44')][_0x5fe4('0x4d')]({'where':{'id':_0x2b2533[_0x5fe4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42a62b,null))[_0x5fe4('0x2b')](saveUpdates(_0x2b2533['body'],null))[_0x5fe4('0x2b')](respondWithResult(_0x42a62b,null))[_0x5fe4('0x49')](handleError(_0x42a62b,null));};exports[_0x5fe4('0x50')]=function(_0x3c1dba,_0x116c0a){return db['VoiceQueueReport']['find']({'where':{'id':_0x3c1dba[_0x5fe4('0x4b')]['id']}})[_0x5fe4('0x2b')](handleEntityNotFound(_0x116c0a,null))['then'](removeEntity(_0x116c0a,null))[_0x5fe4('0x49')](handleError(_0x116c0a,null));};exports[_0x5fe4('0x51')]=function(_0x183847,_0x4d5ede){return db[_0x5fe4('0x44')][_0x5fe4('0x51')]()[_0x5fe4('0x2b')](respondWithResult(_0x4d5ede,null))[_0x5fe4('0x49')](handleError(_0x4d5ede,null));};exports['getVoiceQueuesReport']=function(_0x122cf4,_0x4c22d8){var _0x1727d1={},_0x2e3b47={},_0x492dc2={'count':0x0,'rows':[]};_0x2e3b47[_0x5fe4('0x37')]=_[_0x5fe4('0x35')](db['VoiceQueueReport'][_0x5fe4('0x32')]);_0x2e3b47[_0x5fe4('0x34')]=_[_0x5fe4('0x35')](_0x122cf4[_0x5fe4('0x34')]);_0x2e3b47[_0x5fe4('0x36')]=_[_0x5fe4('0x38')](_0x2e3b47[_0x5fe4('0x37')],_0x2e3b47['query']);_0x1727d1[_0x5fe4('0x3a')]=_[_0x5fe4('0x38')](_0x2e3b47[_0x5fe4('0x37')],qs[_0x5fe4('0x39')](_0x122cf4[_0x5fe4('0x34')]['fields']));_0x1727d1[_0x5fe4('0x3a')]=_0x1727d1[_0x5fe4('0x3a')][_0x5fe4('0x3b')]?_0x1727d1['attributes']:_0x2e3b47[_0x5fe4('0x37')];if(!_0x122cf4['query'][_0x5fe4('0x3c')](_0x5fe4('0x3d'))){_0x1727d1[_0x5fe4('0x25')]=qs[_0x5fe4('0x25')](_0x122cf4[_0x5fe4('0x34')][_0x5fe4('0x25')]);_0x1727d1[_0x5fe4('0x23')]=qs[_0x5fe4('0x23')](_0x122cf4[_0x5fe4('0x34')][_0x5fe4('0x23')]);}_0x1727d1[_0x5fe4('0x52')]=qs[_0x5fe4('0x3e')](_0x122cf4[_0x5fe4('0x34')]['sort']);_0x1727d1['where']=qs['filters'](_['pick'](_0x122cf4[_0x5fe4('0x34')],_0x2e3b47[_0x5fe4('0x36')]));if(_0x122cf4[_0x5fe4('0x34')]['filter']){_0x1727d1[_0x5fe4('0x43')]=_['merge'](_0x1727d1['where'],{'$or':_['map'](_0x1727d1[_0x5fe4('0x3a')],function(_0xc52323){var _0x147169={};_0x147169[_0xc52323]={'$like':'%'+_0x122cf4[_0x5fe4('0x34')][_0x5fe4('0x40')]+'%'};return _0x147169;})});}_0x1727d1=_[_0x5fe4('0x41')]({},_0x1727d1,_0x122cf4[_0x5fe4('0x4c')]);var _0x1f1f1a={'where':_0x1727d1[_0x5fe4('0x43')]};return db[_0x5fe4('0x44')][_0x5fe4('0x26')](_0x1f1f1a)[_0x5fe4('0x2b')](function(_0x165200){_0x492dc2[_0x5fe4('0x26')]=_0x165200;if(_0x122cf4[_0x5fe4('0x34')][_0x5fe4('0x45')]){_0x1727d1[_0x5fe4('0x46')]=[{'all':!![]}];}return db[_0x5fe4('0x44')][_0x5fe4('0x47')](_0x1727d1);})[_0x5fe4('0x2b')](function(_0x13a24d){_0x492dc2[_0x5fe4('0x48')]=_0x13a24d;return _0x492dc2;})[_0x5fe4('0x2b')](respondWithFilteredResult(_0x4c22d8,_0x1727d1,_0x5fe4('0x53')))[_0x5fe4('0x49')](handleError(_0x4c22d8,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x6045=['filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getVoiceQueuesReport','findAll','eml-format','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','offset','order','sort','where'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x6045,0xa8));var _0x5604=function(_0x3684ba,_0x51c305){_0x3684ba=_0x3684ba-0x0;var _0x4d4cf8=_0x6045[_0x3684ba];return _0x4d4cf8;};'use strict';var emlformat=require(_0x5604('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5604('0x1'));var Mustache=require(_0x5604('0x2'));var util=require('util');var path=require(_0x5604('0x3'));var sox=require(_0x5604('0x4'));var csv=require(_0x5604('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5604('0x6'));var _=require(_0x5604('0x7'));var squel=require(_0x5604('0x8'));var crypto=require('crypto');var jsforce=require(_0x5604('0x9'));var deskjs=require(_0x5604('0xa'));var toCsv=require(_0x5604('0x5'));var querystring=require('querystring');var Papa=require(_0x5604('0xb'));var Redis=require('ioredis');var authService=require(_0x5604('0xc'));var qs=require(_0x5604('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5604('0xe'));var logger=require('../../config/logger')(_0x5604('0xf'));var utils=require(_0x5604('0x10'));var config=require(_0x5604('0x11'));var licenseUtil=require(_0x5604('0x12'));var db=require(_0x5604('0x13'))['db'];config[_0x5604('0x14')]=_[_0x5604('0x15')](config[_0x5604('0x14')],{'host':_0x5604('0x16'),'port':0x18eb});var socket=require(_0x5604('0x17'))(new Redis(config['redis']));require(_0x5604('0x18'))['register'](socket);function respondWithStatusCode(_0x34160e,_0x375951){_0x375951=_0x375951||0xcc;return function(_0x3f9dc0){if(_0x3f9dc0){return _0x34160e[_0x5604('0x19')](_0x375951);}return _0x34160e[_0x5604('0x1a')](_0x375951)[_0x5604('0x1b')]();};}function respondWithResult(_0x32f953,_0x39f164){_0x39f164=_0x39f164||0xc8;return function(_0x18a957){if(_0x18a957){return _0x32f953[_0x5604('0x1a')](_0x39f164)[_0x5604('0x1c')](_0x18a957);}};}function respondWithFilteredResult(_0x386829,_0x59107a){return function(_0x51b80c){if(_0x51b80c){var _0x3c24a1=typeof _0x59107a['offset']==='undefined'&&typeof _0x59107a['limit']==='undefined';var _0x3b95e8=_0x51b80c[_0x5604('0x1d')];var _0x5cff47=_0x3c24a1?0x0:_0x59107a['offset'];var _0x43bd26=_0x3c24a1?_0x51b80c[_0x5604('0x1d')]:_0x59107a['offset']+_0x59107a[_0x5604('0x1e')];var _0x46f5a4;if(_0x43bd26>=_0x3b95e8){_0x43bd26=_0x3b95e8;_0x46f5a4=0xc8;}else{_0x46f5a4=0xce;}_0x386829['status'](_0x46f5a4);return _0x386829[_0x5604('0x1f')](_0x5604('0x20'),_0x5cff47+'-'+_0x43bd26+'/'+_0x3b95e8)[_0x5604('0x1c')](_0x51b80c);}return null;};}function patchUpdates(_0xbb5d8a){return function(_0x41584f){try{jsonpatch[_0x5604('0x21')](_0x41584f,_0xbb5d8a,!![]);}catch(_0x5d5276){return BPromise[_0x5604('0x22')](_0x5d5276);}return _0x41584f['save']();};}function saveUpdates(_0x19cb94,_0x453046){return function(_0x13f079){if(_0x13f079){return _0x13f079[_0x5604('0x23')](_0x19cb94)[_0x5604('0x24')](function(_0x18c516){return _0x18c516;});}return null;};}function removeEntity(_0x57cb22,_0x5b343c){return function(_0x1f011a){if(_0x1f011a){return _0x1f011a[_0x5604('0x25')]()['then'](function(){_0x57cb22['status'](0xcc)[_0x5604('0x1b')]();});}};}function handleEntityNotFound(_0x2b0489,_0x3b69c9){return function(_0x1f6904){if(!_0x1f6904){_0x2b0489[_0x5604('0x19')](0x194);}return _0x1f6904;};}function handleError(_0x191fe1,_0x105224){_0x105224=_0x105224||0x1f4;return function(_0x16dc00){logger[_0x5604('0x26')](_0x16dc00['stack']);if(_0x16dc00[_0x5604('0x27')]){delete _0x16dc00[_0x5604('0x27')];}_0x191fe1[_0x5604('0x1a')](_0x105224)[_0x5604('0x28')](_0x16dc00);};}exports[_0x5604('0x29')]=function(_0x564ec0,_0x1e105f){var _0xa19ae6={},_0x5e4b74={},_0x946043={'count':0x0,'rows':[]};var _0x5268fb=_[_0x5604('0x2a')](db[_0x5604('0x2b')][_0x5604('0x2c')],function(_0x1c4307){return{'name':_0x1c4307[_0x5604('0x2d')],'type':_0x1c4307[_0x5604('0x2e')]['key']};});_0x5e4b74['model']=_[_0x5604('0x2a')](_0x5268fb,_0x5604('0x27'));_0x5e4b74[_0x5604('0x2f')]=_[_0x5604('0x30')](_0x564ec0[_0x5604('0x2f')]);_0x5e4b74[_0x5604('0x31')]=_[_0x5604('0x32')](_0x5e4b74['model'],_0x5e4b74[_0x5604('0x2f')]);_0xa19ae6[_0x5604('0x33')]=_['intersection'](_0x5e4b74[_0x5604('0x34')],qs[_0x5604('0x35')](_0x564ec0[_0x5604('0x2f')][_0x5604('0x35')]));_0xa19ae6['attributes']=_0xa19ae6[_0x5604('0x33')]['length']?_0xa19ae6[_0x5604('0x33')]:_0x5e4b74['model'];if(!_0x564ec0[_0x5604('0x2f')][_0x5604('0x36')](_0x5604('0x37'))){_0xa19ae6[_0x5604('0x1e')]=qs['limit'](_0x564ec0['query'][_0x5604('0x1e')]);_0xa19ae6[_0x5604('0x38')]=qs[_0x5604('0x38')](_0x564ec0[_0x5604('0x2f')][_0x5604('0x38')]);}_0xa19ae6[_0x5604('0x39')]=qs[_0x5604('0x3a')](_0x564ec0['query'][_0x5604('0x3a')]);_0xa19ae6[_0x5604('0x3b')]=qs[_0x5604('0x31')](_['pick'](_0x564ec0[_0x5604('0x2f')],_0x5e4b74[_0x5604('0x31')]),_0x5268fb);if(_0x564ec0[_0x5604('0x2f')][_0x5604('0x3c')]){_0xa19ae6[_0x5604('0x3b')]=_[_0x5604('0x3d')](_0xa19ae6['where'],{'$or':_[_0x5604('0x2a')](_0x5268fb,function(_0x3734a9){if(_0x3734a9['type']!==_0x5604('0x3e')){var _0x5cea24={};_0x5cea24[_0x3734a9[_0x5604('0x27')]]={'$like':'%'+_0x564ec0[_0x5604('0x2f')][_0x5604('0x3c')]+'%'};return _0x5cea24;}})});}_0xa19ae6=_[_0x5604('0x3d')]({},_0xa19ae6,_0x564ec0[_0x5604('0x3f')]);var _0x4ae1f7={'where':_0xa19ae6[_0x5604('0x3b')]};return db[_0x5604('0x2b')][_0x5604('0x1d')](_0x4ae1f7)[_0x5604('0x24')](function(_0x3f6cf3){_0x946043[_0x5604('0x1d')]=_0x3f6cf3;if(_0x564ec0[_0x5604('0x2f')][_0x5604('0x40')]){_0xa19ae6[_0x5604('0x41')]=[{'all':!![]}];}return db[_0x5604('0x2b')]['findAll'](_0xa19ae6);})[_0x5604('0x24')](function(_0x1bb98a){_0x946043[_0x5604('0x42')]=_0x1bb98a;return _0x946043;})[_0x5604('0x24')](respondWithFilteredResult(_0x1e105f,_0xa19ae6))[_0x5604('0x43')](handleError(_0x1e105f,null));};exports[_0x5604('0x44')]=function(_0x289994,_0x390407){var _0x590877={'raw':![],'where':{'id':_0x289994[_0x5604('0x45')]['id']}},_0x34d90a={};_0x34d90a['model']=_[_0x5604('0x30')](db[_0x5604('0x2b')][_0x5604('0x2c')]);_0x34d90a[_0x5604('0x2f')]=_[_0x5604('0x30')](_0x289994['query']);_0x34d90a[_0x5604('0x31')]=_[_0x5604('0x32')](_0x34d90a[_0x5604('0x34')],_0x34d90a['query']);_0x590877[_0x5604('0x33')]=_[_0x5604('0x32')](_0x34d90a[_0x5604('0x34')],qs[_0x5604('0x35')](_0x289994['query'][_0x5604('0x35')]));_0x590877[_0x5604('0x33')]=_0x590877[_0x5604('0x33')][_0x5604('0x46')]?_0x590877[_0x5604('0x33')]:_0x34d90a['model'];if(_0x289994[_0x5604('0x2f')][_0x5604('0x40')]){_0x590877[_0x5604('0x41')]=[{'all':!![]}];}_0x590877=_[_0x5604('0x3d')]({},_0x590877,_0x289994['options']);return db[_0x5604('0x2b')][_0x5604('0x47')](_0x590877)[_0x5604('0x24')](handleEntityNotFound(_0x390407,null))['then'](respondWithResult(_0x390407,null))[_0x5604('0x43')](handleError(_0x390407,null));};exports[_0x5604('0x48')]=function(_0x4ce1e1,_0x138c4f){return db[_0x5604('0x2b')]['create'](_0x4ce1e1[_0x5604('0x49')],{})[_0x5604('0x24')](respondWithResult(_0x138c4f,0xc9))['catch'](handleError(_0x138c4f,null));};exports[_0x5604('0x23')]=function(_0xc627a0,_0x400160){if(_0xc627a0[_0x5604('0x49')]['id']){delete _0xc627a0['body']['id'];}return db['VoiceQueueReport'][_0x5604('0x47')]({'where':{'id':_0xc627a0['params']['id']}})['then'](handleEntityNotFound(_0x400160,null))[_0x5604('0x24')](saveUpdates(_0xc627a0[_0x5604('0x49')],null))['then'](respondWithResult(_0x400160,null))['catch'](handleError(_0x400160,null));};exports['destroy']=function(_0xbda332,_0x2da284){return db[_0x5604('0x2b')][_0x5604('0x47')]({'where':{'id':_0xbda332[_0x5604('0x45')]['id']}})['then'](handleEntityNotFound(_0x2da284,null))[_0x5604('0x24')](removeEntity(_0x2da284,null))['catch'](handleError(_0x2da284,null));};exports['describe']=function(_0x554296,_0x4af4f4){return db[_0x5604('0x2b')]['describe']()[_0x5604('0x24')](respondWithResult(_0x4af4f4,null))[_0x5604('0x43')](handleError(_0x4af4f4,null));};exports[_0x5604('0x4a')]=function(_0x5b9a51,_0x5db057){var _0x2fc2c6={},_0x102eb9={},_0x4bf474={'count':0x0,'rows':[]};_0x102eb9['model']=_[_0x5604('0x30')](db[_0x5604('0x2b')]['rawAttributes']);_0x102eb9['query']=_[_0x5604('0x30')](_0x5b9a51[_0x5604('0x2f')]);_0x102eb9[_0x5604('0x31')]=_['intersection'](_0x102eb9[_0x5604('0x34')],_0x102eb9[_0x5604('0x2f')]);_0x2fc2c6[_0x5604('0x33')]=_[_0x5604('0x32')](_0x102eb9['model'],qs[_0x5604('0x35')](_0x5b9a51[_0x5604('0x2f')]['fields']));_0x2fc2c6[_0x5604('0x33')]=_0x2fc2c6[_0x5604('0x33')]['length']?_0x2fc2c6[_0x5604('0x33')]:_0x102eb9[_0x5604('0x34')];if(!_0x5b9a51[_0x5604('0x2f')][_0x5604('0x36')]('nolimit')){_0x2fc2c6['limit']=qs[_0x5604('0x1e')](_0x5b9a51[_0x5604('0x2f')][_0x5604('0x1e')]);_0x2fc2c6[_0x5604('0x38')]=qs[_0x5604('0x38')](_0x5b9a51[_0x5604('0x2f')]['offset']);}_0x2fc2c6[_0x5604('0x39')]=qs[_0x5604('0x3a')](_0x5b9a51[_0x5604('0x2f')][_0x5604('0x3a')]);_0x2fc2c6[_0x5604('0x3b')]=qs['filters'](_['pick'](_0x5b9a51[_0x5604('0x2f')],_0x102eb9[_0x5604('0x31')]));if(_0x5b9a51[_0x5604('0x2f')]['filter']){_0x2fc2c6['where']=_[_0x5604('0x3d')](_0x2fc2c6[_0x5604('0x3b')],{'$or':_[_0x5604('0x2a')](_0x2fc2c6[_0x5604('0x33')],function(_0x46d53c){var _0x47692c={};_0x47692c[_0x46d53c]={'$like':'%'+_0x5b9a51[_0x5604('0x2f')]['filter']+'%'};return _0x47692c;})});}_0x2fc2c6=_[_0x5604('0x3d')]({},_0x2fc2c6,_0x5b9a51[_0x5604('0x3f')]);var _0xe7cd78={'where':_0x2fc2c6[_0x5604('0x3b')]};return db[_0x5604('0x2b')][_0x5604('0x1d')](_0xe7cd78)[_0x5604('0x24')](function(_0x346128){_0x4bf474[_0x5604('0x1d')]=_0x346128;if(_0x5b9a51[_0x5604('0x2f')][_0x5604('0x40')]){_0x2fc2c6['include']=[{'all':!![]}];}return db[_0x5604('0x2b')][_0x5604('0x4b')](_0x2fc2c6);})[_0x5604('0x24')](function(_0x53e0e1){_0x4bf474['rows']=_0x53e0e1;return _0x4bf474;})[_0x5604('0x24')](respondWithFilteredResult(_0x5db057,_0x2fc2c6,_0x5604('0x4a')))[_0x5604('0x43')](handleError(_0x5db057,null,_0x5604('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 86365c0..34ba199 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 _0xf220=['emit','hook','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf220,0x164));var _0x0f22=function(_0x8fbed7,_0x12f5d5){_0x8fbed7=_0x8fbed7-0x0;var _0x3666c1=_0xf220[_0x8fbed7];return _0x3666c1;};'use strict';var EventEmitter=require(_0x0f22('0x0'));var VoiceQueueReport=require(_0x0f22('0x1'))['db'][_0x0f22('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0f22('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x918ace){return function(_0x4bb3bf,_0x13c142,_0x34b790){VoiceQueueReportEvents[_0x0f22('0x4')](_0x918ace+':'+_0x4bb3bf['id'],_0x4bb3bf);VoiceQueueReportEvents[_0x0f22('0x4')](_0x918ace,_0x4bb3bf);_0x34b790(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0f22('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x0f95=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x0f95,0x1af));var _0x50f9=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x0f95[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require(_0x50f9('0x0'));var VoiceQueueReport=require(_0x50f9('0x1'))['db'][_0x50f9('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50f9('0x3'),'afterUpdate':_0x50f9('0x4'),'afterDestroy':_0x50f9('0x5')};function emitEvent(_0x36f280){return function(_0x5e5df7,_0x3a0429,_0x2fbe40){VoiceQueueReportEvents[_0x50f9('0x6')](_0x36f280+':'+_0x5e5df7['id'],_0x5e5df7);VoiceQueueReportEvents[_0x50f9('0x6')](_0x36f280,_0x5e5df7);_0x2fbe40(null);};}for(var e in events){if(events[_0x50f9('0x7')](e)){var event=events[e];VoiceQueueReport[_0x50f9('0x8')](e,emitEvent(event));}}module[_0x50f9('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2fdc6e9..d8d4d2a 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 _0x4b8a=['exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x31d03c,_0x158cef){var _0x420e61=function(_0x1ddac1){while(--_0x1ddac1){_0x31d03c['push'](_0x31d03c['shift']());}};_0x420e61(++_0x158cef);}(_0x4b8a,0x9b));var _0xa4b8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4b8a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa4b8('0x0'));var util=require(_0xa4b8('0x1'));var logger=require(_0xa4b8('0x2'))(_0xa4b8('0x3'));var moment=require(_0xa4b8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4b8('0x5'));var fs=require('fs');var path=require(_0xa4b8('0x6'));var rimraf=require(_0xa4b8('0x7'));var config=require(_0xa4b8('0x8'));var attributes=require(_0xa4b8('0x9'));module[_0xa4b8('0xa')]=function(_0x46d5e6,_0x433fd8){return _0x46d5e6[_0xa4b8('0xb')](_0xa4b8('0xc'),attributes,{'tableName':_0xa4b8('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa4b8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xceec=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x43167b,_0xbfaf5b){var _0x21c9b9=function(_0x203c11){while(--_0x203c11){_0x43167b['push'](_0x43167b['shift']());}};_0x21c9b9(++_0xbfaf5b);}(_0xceec,0x17c));var _0xccee=function(_0x25132c,_0x5846a5){_0x25132c=_0x25132c-0x0;var _0x2138da=_0xceec[_0x25132c];return _0x2138da;};'use strict';var _=require(_0xccee('0x0'));var util=require(_0xccee('0x1'));var logger=require(_0xccee('0x2'))('api');var moment=require('moment');var BPromise=require(_0xccee('0x3'));var rp=require(_0xccee('0x4'));var fs=require('fs');var path=require(_0xccee('0x5'));var rimraf=require('rimraf');var config=require(_0xccee('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0xccee('0x7')]=function(_0x1e238d,_0x4d7e89){return _0x1e238d[_0xccee('0x8')](_0xccee('0x9'),attributes,{'tableName':_0xccee('0xa'),'paranoid':![],'indexes':[{'fields':[_0xccee('0xb')]},{'fields':[_0xccee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c76d9e5..0709291 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 _0x84dc=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','stringify','CreateVoiceQueueReport','create','raw','catch','UpdateVoiceQueueReport','body','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request'];(function(_0x540cee,_0x2e5938){var _0x3448cb=function(_0x520e42){while(--_0x520e42){_0x540cee['push'](_0x540cee['shift']());}};_0x3448cb(++_0x2e5938);}(_0x84dc,0x11c));var _0xc84d=function(_0x12e2d2,_0x8897bc){_0x12e2d2=_0x12e2d2-0x0;var _0x1a83fc=_0x84dc[_0x12e2d2];return _0x1a83fc;};'use strict';var _=require(_0xc84d('0x0'));var util=require(_0xc84d('0x1'));var moment=require('moment');var BPromise=require(_0xc84d('0x2'));var rs=require(_0xc84d('0x3'));var fs=require('fs');var Redis=require(_0xc84d('0x4'));var db=require(_0xc84d('0x5'))['db'];var utils=require(_0xc84d('0x6'));var logger=require(_0xc84d('0x7'))(_0xc84d('0x8'));var config=require('../../config/environment');var jayson=require(_0xc84d('0x9'));var client=jayson['client'][_0xc84d('0xa')]({'port':0x232a});config['redis']=_[_0xc84d('0xb')](config[_0xc84d('0xc')],{'host':_0xc84d('0xd'),'port':0x18eb});var socket=require(_0xc84d('0xe'))(new Redis(config[_0xc84d('0xc')]));require(_0xc84d('0xf'))['register'](socket);function respondWithRpcPromise(_0x466995,_0x8a1e33,_0x44677c){return new BPromise(function(_0xfb989d,_0x1313cb){return client[_0xc84d('0x10')](_0x466995,_0x44677c)[_0xc84d('0x11')](function(_0xca45e2){logger[_0xc84d('0x12')](_0xc84d('0x13'),_0x8a1e33,_0xc84d('0x14'));logger[_0xc84d('0x15')](_0xc84d('0x16'),_0x8a1e33,_0xc84d('0x14'),JSON['stringify'](_0xca45e2));if(_0xca45e2[_0xc84d('0x17')]){if(_0xca45e2[_0xc84d('0x17')]['code']===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x8a1e33,_0xca45e2[_0xc84d('0x17')][_0xc84d('0x18')]);return _0x1313cb(_0xca45e2[_0xc84d('0x17')][_0xc84d('0x18')]);}logger[_0xc84d('0x17')](_0xc84d('0x13'),_0x8a1e33,_0xca45e2[_0xc84d('0x17')][_0xc84d('0x18')]);return _0xfb989d(_0xca45e2['error'][_0xc84d('0x18')]);}else{logger['info'](_0xc84d('0x13'),_0x8a1e33,_0xc84d('0x14'));_0xfb989d(_0xca45e2[_0xc84d('0x19')][_0xc84d('0x18')]);}})['catch'](function(_0x368405){logger[_0xc84d('0x17')](_0xc84d('0x13'),_0x8a1e33,_0x368405);_0x1313cb(_0x368405);});});}exports[_0xc84d('0x1a')]=function(_0x3b5986){var _0x2c50d1=this;return new Promise(function(_0x285755,_0x2e136f){return db[_0xc84d('0x1b')][_0xc84d('0x1c')]({'raw':_0x3b5986[_0xc84d('0x1d')]?_0x3b5986[_0xc84d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3b5986[_0xc84d('0x1d')]?_0x3b5986[_0xc84d('0x1d')][_0xc84d('0x1e')]||null:null,'attributes':_0x3b5986[_0xc84d('0x1d')]?_0x3b5986[_0xc84d('0x1d')][_0xc84d('0x1f')]||null:null,'limit':_0x3b5986[_0xc84d('0x1d')]?_0x3b5986[_0xc84d('0x1d')]['limit']||null:null,'include':_0x3b5986[_0xc84d('0x1d')]?_0x3b5986[_0xc84d('0x1d')][_0xc84d('0x20')]?_[_0xc84d('0x21')](_0x3b5986[_0xc84d('0x1d')][_0xc84d('0x20')],function(_0x1e6095){return{'model':db[_0x1e6095[_0xc84d('0x22')]],'as':_0x1e6095['as'],'attributes':_0x1e6095['attributes'],'include':_0x1e6095[_0xc84d('0x20')]?_[_0xc84d('0x21')](_0x1e6095['include'],function(_0x525aa5){return{'model':db[_0x525aa5[_0xc84d('0x22')]],'as':_0x525aa5['as'],'attributes':_0x525aa5[_0xc84d('0x1f')],'include':_0x525aa5[_0xc84d('0x20')]?_[_0xc84d('0x21')](_0x525aa5[_0xc84d('0x20')],function(_0x2af7e5){return{'model':db[_0x2af7e5[_0xc84d('0x22')]],'as':_0x2af7e5['as'],'attributes':_0x2af7e5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x106e22){logger[_0xc84d('0x12')]('GetVoiceQueueReport',_0x3b5986);logger['debug'](_0xc84d('0x1a'),_0x3b5986,JSON[_0xc84d('0x23')](_0x106e22));_0x285755(_0x106e22);})['catch'](function(_0x2d7693){logger[_0xc84d('0x17')](_0xc84d('0x1a'),_0x2d7693[_0xc84d('0x18')],_0x3b5986);_0x2e136f(_0x2c50d1[_0xc84d('0x17')](0x1f4,_0x2d7693[_0xc84d('0x18')]));});});};exports[_0xc84d('0x24')]=function(_0x9b2c33){var _0x34ed37=this;return new Promise(function(_0x16cb35,_0x6b29a1){return db['VoiceQueueReport'][_0xc84d('0x25')](_0x9b2c33['body'],{'raw':_0x9b2c33[_0xc84d('0x1d')]?_0x9b2c33[_0xc84d('0x1d')][_0xc84d('0x26')]===undefined?!![]:![]:!![]})[_0xc84d('0x11')](function(_0x5e98c1){logger[_0xc84d('0x12')](_0xc84d('0x24'),_0x9b2c33);logger[_0xc84d('0x15')](_0xc84d('0x24'),_0x9b2c33,JSON[_0xc84d('0x23')](_0x5e98c1));_0x16cb35(_0x5e98c1);})[_0xc84d('0x27')](function(_0xfb53f){logger[_0xc84d('0x17')]('CreateVoiceQueueReport',_0xfb53f[_0xc84d('0x18')],_0x9b2c33);_0x6b29a1(_0x34ed37[_0xc84d('0x17')](0x1f4,_0xfb53f['message']));});});};exports[_0xc84d('0x28')]=function(_0x562b3e){var _0x1830c8=this;return new Promise(function(_0x2a7882,_0x16a096){return db[_0xc84d('0x1b')]['update'](_0x562b3e[_0xc84d('0x29')],{'raw':_0x562b3e[_0xc84d('0x1d')]?_0x562b3e[_0xc84d('0x1d')][_0xc84d('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562b3e['options']?_0x562b3e['options']['where']||null:null,'attributes':_0x562b3e[_0xc84d('0x1d')]?_0x562b3e[_0xc84d('0x1d')]['attributes']||null:null,'limit':_0x562b3e[_0xc84d('0x1d')]?_0x562b3e[_0xc84d('0x1d')][_0xc84d('0x2a')]||null:null})[_0xc84d('0x11')](function(_0x4ddc3d){logger[_0xc84d('0x12')](_0xc84d('0x28'),_0x562b3e);logger['debug'](_0xc84d('0x28'),_0x562b3e,JSON[_0xc84d('0x23')](_0x4ddc3d));_0x2a7882(_0x4ddc3d);})[_0xc84d('0x27')](function(_0xfac149){logger[_0xc84d('0x17')](_0xc84d('0x28'),_0xfac149[_0xc84d('0x18')],_0x562b3e);_0x16a096(_0x1830c8['error'](0x1f4,_0xfac149[_0xc84d('0x18')]));});});}; \ No newline at end of file +var _0x197b=['defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','include','map','model','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x4bd64d,_0x3c2b8a){var _0x37db2d=function(_0x5ca98f){while(--_0x5ca98f){_0x4bd64d['push'](_0x4bd64d['shift']());}};_0x37db2d(++_0x3c2b8a);}(_0x197b,0x12d));var _0xb197=function(_0x3face9,_0x16de50){_0x3face9=_0x3face9-0x0;var _0x3c239a=_0x197b[_0x3face9];return _0x3c239a;};'use strict';var _=require(_0xb197('0x0'));var util=require(_0xb197('0x1'));var moment=require(_0xb197('0x2'));var BPromise=require(_0xb197('0x3'));var rs=require(_0xb197('0x4'));var fs=require('fs');var Redis=require(_0xb197('0x5'));var db=require(_0xb197('0x6'))['db'];var utils=require(_0xb197('0x7'));var logger=require(_0xb197('0x8'))(_0xb197('0x9'));var config=require(_0xb197('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb197('0xb')][_0xb197('0xc')]({'port':0x232a});config[_0xb197('0xd')]=_[_0xb197('0xe')](config['redis'],{'host':_0xb197('0xf'),'port':0x18eb});var socket=require(_0xb197('0x10'))(new Redis(config[_0xb197('0xd')]));require(_0xb197('0x11'))[_0xb197('0x12')](socket);function respondWithRpcPromise(_0x50994d,_0xef36d5,_0x24de03){return new BPromise(function(_0x622f4e,_0x4235f2){return client[_0xb197('0x13')](_0x50994d,_0x24de03)[_0xb197('0x14')](function(_0x25be31){logger[_0xb197('0x15')](_0xb197('0x16'),_0xef36d5,'request\x20sent');logger[_0xb197('0x17')](_0xb197('0x18'),_0xef36d5,_0xb197('0x19'),JSON[_0xb197('0x1a')](_0x25be31));if(_0x25be31[_0xb197('0x1b')]){if(_0x25be31[_0xb197('0x1b')][_0xb197('0x1c')]===0x1f4){logger[_0xb197('0x1b')](_0xb197('0x16'),_0xef36d5,_0x25be31[_0xb197('0x1b')]['message']);return _0x4235f2(_0x25be31[_0xb197('0x1b')]['message']);}logger['error'](_0xb197('0x16'),_0xef36d5,_0x25be31[_0xb197('0x1b')][_0xb197('0x1d')]);return _0x622f4e(_0x25be31[_0xb197('0x1b')][_0xb197('0x1d')]);}else{logger['info'](_0xb197('0x16'),_0xef36d5,_0xb197('0x19'));_0x622f4e(_0x25be31[_0xb197('0x1e')][_0xb197('0x1d')]);}})[_0xb197('0x1f')](function(_0x7c30cd){logger[_0xb197('0x1b')](_0xb197('0x16'),_0xef36d5,_0x7c30cd);_0x4235f2(_0x7c30cd);});});}exports[_0xb197('0x20')]=function(_0x301b1b){var _0x3b2794=this;return new Promise(function(_0x47d219,_0x1f469a){return db[_0xb197('0x21')]['findAll']({'raw':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')][_0xb197('0x23')]||null:null,'attributes':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')][_0xb197('0x24')]||null:null,'limit':_0x301b1b[_0xb197('0x22')]?_0x301b1b[_0xb197('0x22')]['limit']||null:null,'include':_0x301b1b[_0xb197('0x22')]?_0x301b1b['options'][_0xb197('0x25')]?_[_0xb197('0x26')](_0x301b1b['options']['include'],function(_0x5bc0ef){return{'model':db[_0x5bc0ef[_0xb197('0x27')]],'as':_0x5bc0ef['as'],'attributes':_0x5bc0ef[_0xb197('0x24')],'include':_0x5bc0ef[_0xb197('0x25')]?_[_0xb197('0x26')](_0x5bc0ef['include'],function(_0x327fb5){return{'model':db[_0x327fb5[_0xb197('0x27')]],'as':_0x327fb5['as'],'attributes':_0x327fb5[_0xb197('0x24')],'include':_0x327fb5[_0xb197('0x25')]?_['map'](_0x327fb5['include'],function(_0x4852e6){return{'model':db[_0x4852e6[_0xb197('0x27')]],'as':_0x4852e6['as'],'attributes':_0x4852e6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x413006){logger[_0xb197('0x15')](_0xb197('0x20'),_0x301b1b);logger[_0xb197('0x17')](_0xb197('0x20'),_0x301b1b,JSON[_0xb197('0x1a')](_0x413006));_0x47d219(_0x413006);})['catch'](function(_0x57f804){logger['error'](_0xb197('0x20'),_0x57f804['message'],_0x301b1b);_0x1f469a(_0x3b2794[_0xb197('0x1b')](0x1f4,_0x57f804[_0xb197('0x1d')]));});});};exports[_0xb197('0x28')]=function(_0x33c3e7){var _0x246f97=this;return new Promise(function(_0x58fb42,_0x337740){return db[_0xb197('0x21')]['create'](_0x33c3e7[_0xb197('0x29')],{'raw':_0x33c3e7['options']?_0x33c3e7[_0xb197('0x22')][_0xb197('0x2a')]===undefined?!![]:![]:!![]})[_0xb197('0x14')](function(_0x6f987b){logger[_0xb197('0x15')](_0xb197('0x28'),_0x33c3e7);logger[_0xb197('0x17')](_0xb197('0x28'),_0x33c3e7,JSON[_0xb197('0x1a')](_0x6f987b));_0x58fb42(_0x6f987b);})[_0xb197('0x1f')](function(_0x1a687b){logger[_0xb197('0x1b')](_0xb197('0x28'),_0x1a687b['message'],_0x33c3e7);_0x337740(_0x246f97[_0xb197('0x1b')](0x1f4,_0x1a687b[_0xb197('0x1d')]));});});};exports[_0xb197('0x2b')]=function(_0x1f9c10){var _0x51ea47=this;return new Promise(function(_0x19e85f,_0x4fdf18){return db[_0xb197('0x21')][_0xb197('0x2c')](_0x1f9c10[_0xb197('0x29')],{'raw':_0x1f9c10['options']?_0x1f9c10[_0xb197('0x22')][_0xb197('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9c10[_0xb197('0x22')]?_0x1f9c10[_0xb197('0x22')][_0xb197('0x23')]||null:null,'attributes':_0x1f9c10['options']?_0x1f9c10['options'][_0xb197('0x24')]||null:null,'limit':_0x1f9c10['options']?_0x1f9c10[_0xb197('0x22')]['limit']||null:null})[_0xb197('0x14')](function(_0x1c1e17){logger[_0xb197('0x15')](_0xb197('0x2b'),_0x1f9c10);logger[_0xb197('0x17')](_0xb197('0x2b'),_0x1f9c10,JSON['stringify'](_0x1c1e17));_0x19e85f(_0x1c1e17);})[_0xb197('0x1f')](function(_0x9c3bc9){logger[_0xb197('0x1b')](_0xb197('0x2b'),_0x9c3bc9[_0xb197('0x1d')],_0x1f9c10);_0x4fdf18(_0x51ea47[_0xb197('0x1b')](0x1f4,_0x9c3bc9[_0xb197('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 5ca4110..ab45934 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 _0xbeff=['removeListener','register','save','remove','update'];(function(_0x56762b,_0x5e2ddd){var _0x179344=function(_0x171dff){while(--_0x171dff){_0x56762b['push'](_0x56762b['shift']());}};_0x179344(++_0x5e2ddd);}(_0xbeff,0x8e));var _0xfbef=function(_0x184595,_0xd91480){_0x184595=_0x184595-0x0;var _0x19f278=_0xbeff[_0x184595];return _0x19f278;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xfbef('0x0'),_0xfbef('0x1'),_0xfbef('0x2')];function createListener(_0x304d07,_0x114ed7){return function(_0x4fb975){_0x114ed7['emit'](_0x304d07,_0x4fb975);};}function removeListener(_0x474798,_0x387be8){return function(){VoiceQueueReportEvents[_0xfbef('0x3')](_0x474798,_0x387be8);};}exports[_0xfbef('0x4')]=function(_0x5496a6){for(var _0x295f40=0x0,_0x2ed5bc=events['length'];_0x295f40<_0x2ed5bc;_0x295f40++){var _0x257f3a=events[_0x295f40];var _0x43e95e=createListener('voiceQueueReport:'+_0x257f3a,_0x5496a6);VoiceQueueReportEvents['on'](_0x257f3a,_0x43e95e);}}; \ No newline at end of file +var _0x82f5=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82f5,0x15d));var _0x582f=function(_0x12cf9d,_0xfdf512){_0x12cf9d=_0x12cf9d-0x0;var _0x299d32=_0x82f5[_0x12cf9d];return _0x299d32;};'use strict';var VoiceQueueReportEvents=require(_0x582f('0x0'));var events=[_0x582f('0x1'),_0x582f('0x2'),_0x582f('0x3')];function createListener(_0x43501c,_0x5a8ca2){return function(_0x4e1ebd){_0x5a8ca2[_0x582f('0x4')](_0x43501c,_0x4e1ebd);};}function removeListener(_0x3f3bde,_0xfc37e0){return function(){VoiceQueueReportEvents[_0x582f('0x5')](_0x3f3bde,_0xfc37e0);};}exports[_0x582f('0x6')]=function(_0x15d332){for(var _0x459755=0x0,_0x506655=events[_0x582f('0x7')];_0x459755<_0x506655;_0x459755++){var _0x5d4e30=events[_0x459755];var _0x2cb791=createListener(_0x582f('0x8')+_0x5d4e30,_0x15d332);VoiceQueueReportEvents['on'](_0x5d4e30,_0x2cb791);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d4485ad..3727332 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 _0xe439=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','post','create','put','/:id','update'];(function(_0x589a88,_0x4ca2b8){var _0x2013db=function(_0x15f886){while(--_0x15f886){_0x589a88['push'](_0x589a88['shift']());}};_0x2013db(++_0x4ca2b8);}(_0xe439,0xc0));var _0x9e43=function(_0x3d1c7c,_0x603d38){_0x3d1c7c=_0x3d1c7c-0x0;var _0x4893db=_0xe439[_0x3d1c7c];return _0x4893db;};'use strict';var multer=require(_0x9e43('0x0'));var util=require(_0x9e43('0x1'));var path=require(_0x9e43('0x2'));var timeout=require(_0x9e43('0x3'));var express=require(_0x9e43('0x4'));var router=express['Router']();var fs_extra=require(_0x9e43('0x5'));var auth=require(_0x9e43('0x6'));var interaction=require(_0x9e43('0x7'));var config=require(_0x9e43('0x8'));var controller=require(_0x9e43('0x9'));router['get']('/',auth[_0x9e43('0xa')](),controller[_0x9e43('0xb')]);router[_0x9e43('0xc')]('/:id',auth[_0x9e43('0xa')](),controller['show']);router[_0x9e43('0xd')]('/',auth['isAuthenticated'](),controller[_0x9e43('0xe')]);router[_0x9e43('0xf')](_0x9e43('0x10'),auth['isAuthenticated'](),controller[_0x9e43('0x11')]);router[_0x9e43('0x12')]('/:id',auth[_0x9e43('0xa')](),controller[_0x9e43('0x13')]);module[_0x9e43('0x14')]=router; \ No newline at end of file +var _0x4134=['get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x4840bc,_0x56cabe){var _0x26632c=function(_0x14f856){while(--_0x14f856){_0x4840bc['push'](_0x4840bc['shift']());}};_0x26632c(++_0x56cabe);}(_0x4134,0x1ac));var _0x4413=function(_0x2877d0,_0x2ea52a){_0x2877d0=_0x2877d0-0x0;var _0x58994c=_0x4134[_0x2877d0];return _0x58994c;};'use strict';var multer=require(_0x4413('0x0'));var util=require(_0x4413('0x1'));var path=require(_0x4413('0x2'));var timeout=require(_0x4413('0x3'));var express=require('express');var router=express[_0x4413('0x4')]();var fs_extra=require(_0x4413('0x5'));var auth=require(_0x4413('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4413('0x7'));var controller=require(_0x4413('0x8'));router[_0x4413('0x9')]('/',auth[_0x4413('0xa')](),controller['index']);router[_0x4413('0x9')](_0x4413('0xb'),auth[_0x4413('0xa')](),controller[_0x4413('0xc')]);router[_0x4413('0xd')]('/',auth[_0x4413('0xa')](),controller[_0x4413('0xe')]);router[_0x4413('0xf')]('/:id',auth[_0x4413('0xa')](),controller['update']);router[_0x4413('0x10')](_0x4413('0xb'),auth[_0x4413('0xa')](),controller[_0x4413('0x11')]);module[_0x4413('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 333960d..8150cfa 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 _0x1caa=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE'];(function(_0x5dfdb9,_0x28a8d1){var _0x2028cd=function(_0x5d93af){while(--_0x5d93af){_0x5dfdb9['push'](_0x5dfdb9['shift']());}};_0x2028cd(++_0x28a8d1);}(_0x1caa,0xbf));var _0xa1ca=function(_0x21dfb3,_0x62390f){_0x21dfb3=_0x21dfb3-0x0;var _0x497b00=_0x1caa[_0x21dfb3];return _0x497b00;};'use strict';var Sequelize=require(_0xa1ca('0x0'));var moment=require('moment');module[_0xa1ca('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa1ca('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa1ca('0x3')],'allowNull':![],'defaultValue':moment()['format'](_0xa1ca('0x4'))}}; \ No newline at end of file +var _0xb7b5=['DATE','format','moment','exports','STRING'];(function(_0x4197da,_0x3b3af5){var _0xcae72e=function(_0x50b9a9){while(--_0x50b9a9){_0x4197da['push'](_0x4197da['shift']());}};_0xcae72e(++_0x3b3af5);}(_0xb7b5,0x75));var _0x5b7b=function(_0xe9d735,_0x57608d){_0xe9d735=_0xe9d735-0x0;var _0x352df1=_0xb7b5[_0xe9d735];return _0x352df1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5b7b('0x0'));module[_0x5b7b('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5b7b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5b7b('0x3')],'allowNull':![],'defaultValue':moment()[_0x5b7b('0x4')]('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 7f6ecc8..6a5dbcc 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 _0x18a3=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3c512f,_0x3e0167){var _0x561847=function(_0xad3bf1){while(--_0xad3bf1){_0x3c512f['push'](_0x3c512f['shift']());}};_0x561847(++_0x3e0167);}(_0x18a3,0xc1));var _0x318a=function(_0x22c95c,_0x32232c){_0x22c95c=_0x22c95c-0x0;var _0x573bf7=_0x18a3[_0x22c95c];return _0x573bf7;};'use strict';var emlformat=require(_0x318a('0x0'));var rimraf=require(_0x318a('0x1'));var zipdir=require(_0x318a('0x2'));var jsonpatch=require(_0x318a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x318a('0x4'));var Mustache=require(_0x318a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x318a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x318a('0x7'));var _=require('lodash');var squel=require(_0x318a('0x8'));var crypto=require('crypto');var jsforce=require(_0x318a('0x9'));var deskjs=require(_0x318a('0xa'));var toCsv=require(_0x318a('0x6'));var querystring=require(_0x318a('0xb'));var Papa=require(_0x318a('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x318a('0xd'));var as=require(_0x318a('0xe'));var hardwareService=require(_0x318a('0xf'));var logger=require('../../config/logger')(_0x318a('0x10'));var utils=require(_0x318a('0x11'));var config=require(_0x318a('0x12'));var licenseUtil=require(_0x318a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a087f,_0x4f1153){_0x4f1153=_0x4f1153||0xcc;return function(_0x1bc313){if(_0x1bc313){return _0x2a087f[_0x318a('0x14')](_0x4f1153);}return _0x2a087f[_0x318a('0x15')](_0x4f1153)[_0x318a('0x16')]();};}function respondWithResult(_0x50dae5,_0x437c2a){_0x437c2a=_0x437c2a||0xc8;return function(_0x1d49fe){if(_0x1d49fe){return _0x50dae5[_0x318a('0x15')](_0x437c2a)[_0x318a('0x17')](_0x1d49fe);}};}function respondWithFilteredResult(_0xd3be04,_0x343997){return function(_0x21985a){if(_0x21985a){var _0x21e9c8=typeof _0x343997[_0x318a('0x18')]===_0x318a('0x19')&&typeof _0x343997[_0x318a('0x1a')]===_0x318a('0x19');var _0x14218b=_0x21985a[_0x318a('0x1b')];var _0x1712f1=_0x21e9c8?0x0:_0x343997[_0x318a('0x18')];var _0x45437e=_0x21e9c8?_0x21985a[_0x318a('0x1b')]:_0x343997['offset']+_0x343997[_0x318a('0x1a')];var _0x41f4b6;if(_0x45437e>=_0x14218b){_0x45437e=_0x14218b;_0x41f4b6=0xc8;}else{_0x41f4b6=0xce;}_0xd3be04[_0x318a('0x15')](_0x41f4b6);return _0xd3be04['set']('Content-Range',_0x1712f1+'-'+_0x45437e+'/'+_0x14218b)['json'](_0x21985a);}return null;};}function patchUpdates(_0x63f6f){return function(_0x5d0f14){try{jsonpatch[_0x318a('0x1c')](_0x5d0f14,_0x63f6f,!![]);}catch(_0x3509bc){return BPromise['reject'](_0x3509bc);}return _0x5d0f14[_0x318a('0x1d')]();};}function saveUpdates(_0x330b71,_0x4242b4){return function(_0x1a4772){if(_0x1a4772){return _0x1a4772[_0x318a('0x1e')](_0x330b71)['then'](function(_0x12b3f2){return _0x12b3f2;});}return null;};}function removeEntity(_0x205b9a,_0x27b5fd){return function(_0x2274b9){if(_0x2274b9){return _0x2274b9[_0x318a('0x1f')]()[_0x318a('0x20')](function(){_0x205b9a[_0x318a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55af49,_0x52adf4){return function(_0x37fe2e){if(!_0x37fe2e){_0x55af49[_0x318a('0x14')](0x194);}return _0x37fe2e;};}function handleError(_0x526cd6,_0x7d5b93){_0x7d5b93=_0x7d5b93||0x1f4;return function(_0x4a3816){logger[_0x318a('0x21')](_0x4a3816[_0x318a('0x22')]);if(_0x4a3816[_0x318a('0x23')]){delete _0x4a3816[_0x318a('0x23')];}_0x526cd6[_0x318a('0x15')](_0x7d5b93)[_0x318a('0x24')](_0x4a3816);};}exports[_0x318a('0x25')]=function(_0x5206f7,_0x3c2bd9){var _0x51bb1f={},_0x430b84={},_0x5097e7={'count':0x0,'rows':[]};var _0x3e6528=_[_0x318a('0x26')](db[_0x318a('0x27')][_0x318a('0x28')],function(_0x2b01cf){return{'name':_0x2b01cf[_0x318a('0x29')],'type':_0x2b01cf[_0x318a('0x2a')][_0x318a('0x2b')]};});_0x430b84['model']=_[_0x318a('0x26')](_0x3e6528,_0x318a('0x23'));_0x430b84[_0x318a('0x2c')]=_['keys'](_0x5206f7[_0x318a('0x2c')]);_0x430b84[_0x318a('0x2d')]=_[_0x318a('0x2e')](_0x430b84[_0x318a('0x2f')],_0x430b84['query']);_0x51bb1f['attributes']=_[_0x318a('0x2e')](_0x430b84['model'],qs[_0x318a('0x30')](_0x5206f7[_0x318a('0x2c')]['fields']));_0x51bb1f[_0x318a('0x31')]=_0x51bb1f['attributes'][_0x318a('0x32')]?_0x51bb1f[_0x318a('0x31')]:_0x430b84[_0x318a('0x2f')];if(!_0x5206f7[_0x318a('0x2c')][_0x318a('0x33')](_0x318a('0x34'))){_0x51bb1f['limit']=qs[_0x318a('0x1a')](_0x5206f7[_0x318a('0x2c')][_0x318a('0x1a')]);_0x51bb1f['offset']=qs[_0x318a('0x18')](_0x5206f7[_0x318a('0x2c')]['offset']);}_0x51bb1f['order']=qs[_0x318a('0x35')](_0x5206f7[_0x318a('0x2c')][_0x318a('0x35')]);_0x51bb1f[_0x318a('0x36')]=qs[_0x318a('0x2d')](_[_0x318a('0x37')](_0x5206f7[_0x318a('0x2c')],_0x430b84[_0x318a('0x2d')]),_0x3e6528);if(_0x5206f7[_0x318a('0x2c')]['filter']){_0x51bb1f[_0x318a('0x36')]=_[_0x318a('0x38')](_0x51bb1f[_0x318a('0x36')],{'$or':_[_0x318a('0x26')](_0x3e6528,function(_0x46cfcd){if(_0x46cfcd[_0x318a('0x2a')]!==_0x318a('0x39')){var _0x46dd83={};_0x46dd83[_0x46cfcd[_0x318a('0x23')]]={'$like':'%'+_0x5206f7[_0x318a('0x2c')][_0x318a('0x3a')]+'%'};return _0x46dd83;}})});}_0x51bb1f=_[_0x318a('0x38')]({},_0x51bb1f,_0x5206f7['options']);var _0x2959d2={'where':_0x51bb1f[_0x318a('0x36')]};return db['VoiceQueuesLog'][_0x318a('0x1b')](_0x2959d2)[_0x318a('0x20')](function(_0x1702dc){_0x5097e7[_0x318a('0x1b')]=_0x1702dc;if(_0x5206f7['query'][_0x318a('0x3b')]){_0x51bb1f[_0x318a('0x3c')]=[{'all':!![]}];}return db[_0x318a('0x27')]['findAll'](_0x51bb1f);})['then'](function(_0x237734){_0x5097e7[_0x318a('0x3d')]=_0x237734;return _0x5097e7;})[_0x318a('0x20')](respondWithFilteredResult(_0x3c2bd9,_0x51bb1f))[_0x318a('0x3e')](handleError(_0x3c2bd9,null));};exports[_0x318a('0x3f')]=function(_0x244644,_0x107fc5){var _0x5557fd={'raw':!![],'where':{'id':_0x244644[_0x318a('0x40')]['id']}},_0x29ae3a={};_0x29ae3a['model']=_['keys'](db['VoiceQueuesLog'][_0x318a('0x28')]);_0x29ae3a['query']=_[_0x318a('0x41')](_0x244644[_0x318a('0x2c')]);_0x29ae3a['filters']=_[_0x318a('0x2e')](_0x29ae3a[_0x318a('0x2f')],_0x29ae3a[_0x318a('0x2c')]);_0x5557fd[_0x318a('0x31')]=_[_0x318a('0x2e')](_0x29ae3a[_0x318a('0x2f')],qs[_0x318a('0x30')](_0x244644[_0x318a('0x2c')][_0x318a('0x30')]));_0x5557fd[_0x318a('0x31')]=_0x5557fd['attributes'][_0x318a('0x32')]?_0x5557fd['attributes']:_0x29ae3a[_0x318a('0x2f')];if(_0x244644[_0x318a('0x2c')]['includeAll']){_0x5557fd[_0x318a('0x3c')]=[{'all':!![]}];}_0x5557fd=_['merge']({},_0x5557fd,_0x244644[_0x318a('0x42')]);return db[_0x318a('0x27')]['find'](_0x5557fd)[_0x318a('0x20')](handleEntityNotFound(_0x107fc5,null))[_0x318a('0x20')](respondWithResult(_0x107fc5,null))[_0x318a('0x3e')](handleError(_0x107fc5,null));};exports[_0x318a('0x43')]=function(_0x3ec83b,_0xec69cb){return db[_0x318a('0x27')][_0x318a('0x43')](_0x3ec83b['body'],{})[_0x318a('0x20')](respondWithResult(_0xec69cb,0xc9))['catch'](handleError(_0xec69cb,null));};exports[_0x318a('0x1e')]=function(_0x43eecd,_0x2d439f){if(_0x43eecd[_0x318a('0x44')]['id']){delete _0x43eecd[_0x318a('0x44')]['id'];}return db[_0x318a('0x27')][_0x318a('0x45')]({'where':{'id':_0x43eecd[_0x318a('0x40')]['id']}})[_0x318a('0x20')](handleEntityNotFound(_0x2d439f,null))['then'](saveUpdates(_0x43eecd['body'],null))['then'](respondWithResult(_0x2d439f,null))[_0x318a('0x3e')](handleError(_0x2d439f,null));};exports[_0x318a('0x1f')]=function(_0x29229d,_0x322f36){return db[_0x318a('0x27')][_0x318a('0x45')]({'where':{'id':_0x29229d[_0x318a('0x40')]['id']}})[_0x318a('0x20')](handleEntityNotFound(_0x322f36,null))['then'](removeEntity(_0x322f36,null))[_0x318a('0x3e')](handleError(_0x322f36,null));}; \ No newline at end of file +var _0x0bc7=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','VoiceQueuesLog','findAll','rows','catch','show','keys','length','includeAll','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3ef7ce,_0x57011b){var _0x54d928=function(_0x5d13a7){while(--_0x5d13a7){_0x3ef7ce['push'](_0x3ef7ce['shift']());}};_0x54d928(++_0x57011b);}(_0x0bc7,0x11e));var _0x70bc=function(_0x4a286e,_0x3ff265){_0x4a286e=_0x4a286e-0x0;var _0x142dde=_0x0bc7[_0x4a286e];return _0x142dde;};'use strict';var emlformat=require(_0x70bc('0x0'));var rimraf=require(_0x70bc('0x1'));var zipdir=require(_0x70bc('0x2'));var jsonpatch=require(_0x70bc('0x3'));var rp=require(_0x70bc('0x4'));var moment=require(_0x70bc('0x5'));var BPromise=require(_0x70bc('0x6'));var Mustache=require(_0x70bc('0x7'));var util=require(_0x70bc('0x8'));var path=require('path');var sox=require(_0x70bc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70bc('0xa'));var _=require(_0x70bc('0xb'));var squel=require(_0x70bc('0xc'));var crypto=require(_0x70bc('0xd'));var jsforce=require(_0x70bc('0xe'));var deskjs=require(_0x70bc('0xf'));var toCsv=require('to-csv');var querystring=require(_0x70bc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x70bc('0x11'));var qs=require(_0x70bc('0x12'));var as=require(_0x70bc('0x13'));var hardwareService=require(_0x70bc('0x14'));var logger=require(_0x70bc('0x15'))(_0x70bc('0x16'));var utils=require(_0x70bc('0x17'));var config=require(_0x70bc('0x18'));var licenseUtil=require(_0x70bc('0x19'));var db=require(_0x70bc('0x1a'))['db'];function respondWithStatusCode(_0x3a0597,_0x596d83){_0x596d83=_0x596d83||0xcc;return function(_0x172e64){if(_0x172e64){return _0x3a0597[_0x70bc('0x1b')](_0x596d83);}return _0x3a0597[_0x70bc('0x1c')](_0x596d83)['end']();};}function respondWithResult(_0x5b83de,_0x18d833){_0x18d833=_0x18d833||0xc8;return function(_0x2d0a3f){if(_0x2d0a3f){return _0x5b83de['status'](_0x18d833)[_0x70bc('0x1d')](_0x2d0a3f);}};}function respondWithFilteredResult(_0x2a7bf9,_0x5cb71b){return function(_0x2788b7){if(_0x2788b7){var _0x1512cf=typeof _0x5cb71b['offset']==='undefined'&&typeof _0x5cb71b['limit']===_0x70bc('0x1e');var _0x22dd5f=_0x2788b7['count'];var _0x272534=_0x1512cf?0x0:_0x5cb71b[_0x70bc('0x1f')];var _0xe4cd12=_0x1512cf?_0x2788b7[_0x70bc('0x20')]:_0x5cb71b[_0x70bc('0x1f')]+_0x5cb71b[_0x70bc('0x21')];var _0x442bca;if(_0xe4cd12>=_0x22dd5f){_0xe4cd12=_0x22dd5f;_0x442bca=0xc8;}else{_0x442bca=0xce;}_0x2a7bf9[_0x70bc('0x1c')](_0x442bca);return _0x2a7bf9[_0x70bc('0x22')]('Content-Range',_0x272534+'-'+_0xe4cd12+'/'+_0x22dd5f)['json'](_0x2788b7);}return null;};}function patchUpdates(_0x14987e){return function(_0xde2b0e){try{jsonpatch['apply'](_0xde2b0e,_0x14987e,!![]);}catch(_0x5f03a2){return BPromise[_0x70bc('0x23')](_0x5f03a2);}return _0xde2b0e[_0x70bc('0x24')]();};}function saveUpdates(_0x5d1371,_0x33ab60){return function(_0x1bf340){if(_0x1bf340){return _0x1bf340[_0x70bc('0x25')](_0x5d1371)[_0x70bc('0x26')](function(_0x4095cb){return _0x4095cb;});}return null;};}function removeEntity(_0xe0460c,_0x560d19){return function(_0x5496dd){if(_0x5496dd){return _0x5496dd[_0x70bc('0x27')]()['then'](function(){_0xe0460c[_0x70bc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x75cfb,_0x56d916){return function(_0x550abe){if(!_0x550abe){_0x75cfb[_0x70bc('0x1b')](0x194);}return _0x550abe;};}function handleError(_0x3b7e0f,_0x174b49){_0x174b49=_0x174b49||0x1f4;return function(_0x3da4f5){logger[_0x70bc('0x28')](_0x3da4f5[_0x70bc('0x29')]);if(_0x3da4f5[_0x70bc('0x2a')]){delete _0x3da4f5[_0x70bc('0x2a')];}_0x3b7e0f[_0x70bc('0x1c')](_0x174b49)[_0x70bc('0x2b')](_0x3da4f5);};}exports[_0x70bc('0x2c')]=function(_0x2aa171,_0x3a0599){var _0x513b62={},_0x3d2bdf={},_0x17eeb0={'count':0x0,'rows':[]};var _0x4dc903=_[_0x70bc('0x2d')](db['VoiceQueuesLog'][_0x70bc('0x2e')],function(_0x18a5a5){return{'name':_0x18a5a5[_0x70bc('0x2f')],'type':_0x18a5a5[_0x70bc('0x30')][_0x70bc('0x31')]};});_0x3d2bdf[_0x70bc('0x32')]=_[_0x70bc('0x2d')](_0x4dc903,_0x70bc('0x2a'));_0x3d2bdf[_0x70bc('0x33')]=_['keys'](_0x2aa171['query']);_0x3d2bdf[_0x70bc('0x34')]=_['intersection'](_0x3d2bdf['model'],_0x3d2bdf[_0x70bc('0x33')]);_0x513b62[_0x70bc('0x35')]=_[_0x70bc('0x36')](_0x3d2bdf[_0x70bc('0x32')],qs[_0x70bc('0x37')](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x37')]));_0x513b62[_0x70bc('0x35')]=_0x513b62[_0x70bc('0x35')]['length']?_0x513b62[_0x70bc('0x35')]:_0x3d2bdf[_0x70bc('0x32')];if(!_0x2aa171['query'][_0x70bc('0x38')]('nolimit')){_0x513b62[_0x70bc('0x21')]=qs[_0x70bc('0x21')](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x21')]);_0x513b62[_0x70bc('0x1f')]=qs['offset'](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x1f')]);}_0x513b62[_0x70bc('0x39')]=qs[_0x70bc('0x3a')](_0x2aa171[_0x70bc('0x33')][_0x70bc('0x3a')]);_0x513b62[_0x70bc('0x3b')]=qs[_0x70bc('0x34')](_['pick'](_0x2aa171[_0x70bc('0x33')],_0x3d2bdf[_0x70bc('0x34')]),_0x4dc903);if(_0x2aa171[_0x70bc('0x33')][_0x70bc('0x3c')]){_0x513b62[_0x70bc('0x3b')]=_[_0x70bc('0x3d')](_0x513b62[_0x70bc('0x3b')],{'$or':_[_0x70bc('0x2d')](_0x4dc903,function(_0x4649ca){if(_0x4649ca[_0x70bc('0x30')]!==_0x70bc('0x3e')){var _0x37ac93={};_0x37ac93[_0x4649ca[_0x70bc('0x2a')]]={'$like':'%'+_0x2aa171['query'][_0x70bc('0x3c')]+'%'};return _0x37ac93;}})});}_0x513b62=_[_0x70bc('0x3d')]({},_0x513b62,_0x2aa171[_0x70bc('0x3f')]);var _0x1ab89b={'where':_0x513b62[_0x70bc('0x3b')]};return db['VoiceQueuesLog']['count'](_0x1ab89b)['then'](function(_0x32cfe2){_0x17eeb0[_0x70bc('0x20')]=_0x32cfe2;if(_0x2aa171['query']['includeAll']){_0x513b62[_0x70bc('0x40')]=[{'all':!![]}];}return db[_0x70bc('0x41')][_0x70bc('0x42')](_0x513b62);})[_0x70bc('0x26')](function(_0x40e4c8){_0x17eeb0[_0x70bc('0x43')]=_0x40e4c8;return _0x17eeb0;})['then'](respondWithFilteredResult(_0x3a0599,_0x513b62))[_0x70bc('0x44')](handleError(_0x3a0599,null));};exports[_0x70bc('0x45')]=function(_0x358a5b,_0x4b890d){var _0x58fdf2={'raw':!![],'where':{'id':_0x358a5b['params']['id']}},_0x2f5754={};_0x2f5754[_0x70bc('0x32')]=_['keys'](db['VoiceQueuesLog'][_0x70bc('0x2e')]);_0x2f5754[_0x70bc('0x33')]=_[_0x70bc('0x46')](_0x358a5b[_0x70bc('0x33')]);_0x2f5754[_0x70bc('0x34')]=_[_0x70bc('0x36')](_0x2f5754[_0x70bc('0x32')],_0x2f5754[_0x70bc('0x33')]);_0x58fdf2[_0x70bc('0x35')]=_[_0x70bc('0x36')](_0x2f5754['model'],qs[_0x70bc('0x37')](_0x358a5b[_0x70bc('0x33')][_0x70bc('0x37')]));_0x58fdf2['attributes']=_0x58fdf2[_0x70bc('0x35')][_0x70bc('0x47')]?_0x58fdf2[_0x70bc('0x35')]:_0x2f5754[_0x70bc('0x32')];if(_0x358a5b[_0x70bc('0x33')][_0x70bc('0x48')]){_0x58fdf2[_0x70bc('0x40')]=[{'all':!![]}];}_0x58fdf2=_[_0x70bc('0x3d')]({},_0x58fdf2,_0x358a5b[_0x70bc('0x3f')]);return db[_0x70bc('0x41')]['find'](_0x58fdf2)[_0x70bc('0x26')](handleEntityNotFound(_0x4b890d,null))[_0x70bc('0x26')](respondWithResult(_0x4b890d,null))['catch'](handleError(_0x4b890d,null));};exports[_0x70bc('0x49')]=function(_0x2da67a,_0x41f051){return db[_0x70bc('0x41')][_0x70bc('0x49')](_0x2da67a[_0x70bc('0x4a')],{})[_0x70bc('0x26')](respondWithResult(_0x41f051,0xc9))['catch'](handleError(_0x41f051,null));};exports[_0x70bc('0x25')]=function(_0x36530e,_0x208c5){if(_0x36530e[_0x70bc('0x4a')]['id']){delete _0x36530e['body']['id'];}return db[_0x70bc('0x41')][_0x70bc('0x4b')]({'where':{'id':_0x36530e[_0x70bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x208c5,null))[_0x70bc('0x26')](saveUpdates(_0x36530e[_0x70bc('0x4a')],null))['then'](respondWithResult(_0x208c5,null))[_0x70bc('0x44')](handleError(_0x208c5,null));};exports[_0x70bc('0x27')]=function(_0x18e50e,_0x84a503){return db[_0x70bc('0x41')][_0x70bc('0x4b')]({'where':{'id':_0x18e50e[_0x70bc('0x4c')]['id']}})[_0x70bc('0x26')](handleEntityNotFound(_0x84a503,null))[_0x70bc('0x26')](removeEntity(_0x84a503,null))[_0x70bc('0x44')](handleError(_0x84a503,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8e255e3..9ff7368 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 _0xbaa8=['dtm','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event'];(function(_0x83c24,_0x88572){var _0x466f3c=function(_0x56cbeb){while(--_0x56cbeb){_0x83c24['push'](_0x83c24['shift']());}};_0x466f3c(++_0x88572);}(_0xbaa8,0x1a5));var _0x8baa=function(_0x4a95bb,_0x2788f9){_0x4a95bb=_0x4a95bb-0x0;var _0x314474=_0xbaa8[_0x4a95bb];return _0x314474;};'use strict';var _=require(_0x8baa('0x0'));var util=require(_0x8baa('0x1'));var logger=require(_0x8baa('0x2'))(_0x8baa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8baa('0x4'));var fs=require('fs');var path=require(_0x8baa('0x5'));var rimraf=require(_0x8baa('0x6'));var config=require(_0x8baa('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x8baa('0x8')]=function(_0x40f0ec,_0x5b8cf4){return _0x40f0ec[_0x8baa('0x9')](_0x8baa('0xa'),attributes,{'tableName':_0x8baa('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x8baa('0xc'),_0x8baa('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x501f=['../../config/logger','api','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x501f,0x1db));var _0xf501=function(_0x596fb3,_0x5869a0){_0x596fb3=_0x596fb3-0x0;var _0x12621b=_0x501f[_0x596fb3];return _0x12621b;};'use strict';var _=require('lodash');var util=require(_0xf501('0x0'));var logger=require(_0xf501('0x1'))(_0xf501('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf501('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf501('0x4'));var config=require(_0xf501('0x5'));var attributes=require(_0xf501('0x6'));module[_0xf501('0x7')]=function(_0x528848,_0x3d6096){return _0x528848[_0xf501('0x8')](_0xf501('0x9'),attributes,{'tableName':_0xf501('0xa'),'paranoid':![],'indexes':[{'name':_0xf501('0xb'),'fields':[_0xf501('0xc'),_0xf501('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 729c447..001ab60 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 _0x5cad=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2173e7,_0x34fcd3){var _0x550cab=function(_0x743abd){while(--_0x743abd){_0x2173e7['push'](_0x2173e7['shift']());}};_0x550cab(++_0x34fcd3);}(_0x5cad,0x8c));var _0xd5ca=function(_0x3c9c05,_0x31f740){_0x3c9c05=_0x3c9c05-0x0;var _0x2f1d51=_0x5cad[_0x3c9c05];return _0x2f1d51;};'use strict';var _=require(_0xd5ca('0x0'));var util=require(_0xd5ca('0x1'));var moment=require(_0xd5ca('0x2'));var BPromise=require(_0xd5ca('0x3'));var rs=require(_0xd5ca('0x4'));var fs=require('fs');var Redis=require(_0xd5ca('0x5'));var db=require(_0xd5ca('0x6'))['db'];var utils=require(_0xd5ca('0x7'));var logger=require(_0xd5ca('0x8'))(_0xd5ca('0x9'));var config=require(_0xd5ca('0xa'));var jayson=require(_0xd5ca('0xb'));var client=jayson[_0xd5ca('0xc')][_0xd5ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x33574c,_0x213303,_0x9cc275){return new BPromise(function(_0x1aa01e,_0x332a9a){return client[_0xd5ca('0xe')](_0x33574c,_0x9cc275)[_0xd5ca('0xf')](function(_0x5cb395){logger[_0xd5ca('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x213303,_0xd5ca('0x11'));logger['debug'](_0xd5ca('0x12'),_0x213303,'request\x20sent',JSON[_0xd5ca('0x13')](_0x5cb395));if(_0x5cb395[_0xd5ca('0x14')]){if(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x15')]===0x1f4){logger[_0xd5ca('0x14')](_0xd5ca('0x16'),_0x213303,_0x5cb395[_0xd5ca('0x14')]['message']);return _0x332a9a(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x17')]);}logger[_0xd5ca('0x14')](_0xd5ca('0x16'),_0x213303,_0x5cb395['error'][_0xd5ca('0x17')]);return _0x1aa01e(_0x5cb395[_0xd5ca('0x14')][_0xd5ca('0x17')]);}else{logger[_0xd5ca('0x10')](_0xd5ca('0x16'),_0x213303,_0xd5ca('0x11'));_0x1aa01e(_0x5cb395[_0xd5ca('0x18')][_0xd5ca('0x17')]);}})['catch'](function(_0x5dbcaf){logger[_0xd5ca('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x213303,_0x5dbcaf);_0x332a9a(_0x5dbcaf);});});} \ No newline at end of file +var _0x048c=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x398ec6,_0x450ea7){var _0x1e9a44=function(_0x3c74e6){while(--_0x3c74e6){_0x398ec6['push'](_0x398ec6['shift']());}};_0x1e9a44(++_0x450ea7);}(_0x048c,0xdb));var _0xc048=function(_0x54cb3f,_0x160320){_0x54cb3f=_0x54cb3f-0x0;var _0x530da3=_0x048c[_0x54cb3f];return _0x530da3;};'use strict';var _=require(_0xc048('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc048('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc048('0x2'));var db=require(_0xc048('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc048('0x4'))(_0xc048('0x5'));var config=require(_0xc048('0x6'));var jayson=require(_0xc048('0x7'));var client=jayson[_0xc048('0x8')][_0xc048('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbfb080,_0x3550a8,_0x5597fe){return new BPromise(function(_0xe3f589,_0x3d4f95){return client[_0xc048('0xa')](_0xbfb080,_0x5597fe)[_0xc048('0xb')](function(_0x28fc92){logger[_0xc048('0xc')](_0xc048('0xd'),_0x3550a8,_0xc048('0xe'));logger['debug'](_0xc048('0xf'),_0x3550a8,_0xc048('0xe'),JSON[_0xc048('0x10')](_0x28fc92));if(_0x28fc92[_0xc048('0x11')]){if(_0x28fc92['error'][_0xc048('0x12')]===0x1f4){logger['error'](_0xc048('0xd'),_0x3550a8,_0x28fc92['error'][_0xc048('0x13')]);return _0x3d4f95(_0x28fc92[_0xc048('0x11')][_0xc048('0x13')]);}logger[_0xc048('0x11')](_0xc048('0xd'),_0x3550a8,_0x28fc92[_0xc048('0x11')][_0xc048('0x13')]);return _0xe3f589(_0x28fc92[_0xc048('0x11')][_0xc048('0x13')]);}else{logger[_0xc048('0xc')](_0xc048('0xd'),_0x3550a8,_0xc048('0xe'));_0xe3f589(_0x28fc92[_0xc048('0x14')]['message']);}})['catch'](function(_0x341ae7){logger[_0xc048('0x11')](_0xc048('0xd'),_0x3550a8,_0x341ae7);_0x3d4f95(_0x341ae7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c843a20..161d409 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 _0x9189=['../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','create','post','/:id/transcribe','runTranscribe','put','update','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3d0678,_0x10e9ae){var _0x7f9a43=function(_0x85d80f){while(--_0x85d80f){_0x3d0678['push'](_0x3d0678['shift']());}};_0x7f9a43(++_0x10e9ae);}(_0x9189,0xa9));var _0x9918=function(_0x2e511b,_0x1ea04e){_0x2e511b=_0x2e511b-0x0;var _0x5cd090=_0x9189[_0x2e511b];return _0x5cd090;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9918('0x0'));var timeout=require(_0x9918('0x1'));var express=require(_0x9918('0x2'));var router=express[_0x9918('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9918('0x4'));var interaction=require(_0x9918('0x5'));var config=require(_0x9918('0x6'));var controller=require(_0x9918('0x7'));router[_0x9918('0x8')]('/',auth['isAuthenticated'](),controller[_0x9918('0x9')]);router['get'](_0x9918('0xa'),auth[_0x9918('0xb')](),controller['describe']);router['get'](_0x9918('0xc'),auth[_0x9918('0xb')](),controller[_0x9918('0xd')]);router[_0x9918('0x8')](_0x9918('0xe'),auth['isAuthenticated'](),controller[_0x9918('0xf')]);router['get'](_0x9918('0x10'),controller[_0x9918('0x11')]);router[_0x9918('0x8')]('/:id/transcribe',auth[_0x9918('0xb')](),controller[_0x9918('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9918('0x13')]);router[_0x9918('0x14')](_0x9918('0x15'),auth[_0x9918('0xb')](),controller[_0x9918('0x16')]);router[_0x9918('0x17')]('/:id',auth[_0x9918('0xb')](),controller[_0x9918('0x18')]);router['delete']('/:id',auth[_0x9918('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9606=['/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','show','/:id/download'];(function(_0x2d28ee,_0x5c1a43){var _0x55834f=function(_0x338085){while(--_0x338085){_0x2d28ee['push'](_0x2d28ee['shift']());}};_0x55834f(++_0x5c1a43);}(_0x9606,0x153));var _0x6960=function(_0x18d279,_0x1acba8){_0x18d279=_0x18d279-0x0;var _0x5a2100=_0x9606[_0x18d279];return _0x5a2100;};'use strict';var multer=require(_0x6960('0x0'));var util=require(_0x6960('0x1'));var path=require(_0x6960('0x2'));var timeout=require(_0x6960('0x3'));var express=require(_0x6960('0x4'));var router=express[_0x6960('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6960('0x6'));var interaction=require(_0x6960('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x6960('0x8')](),controller['index']);router['get'](_0x6960('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6960('0xa')]('/:id',auth[_0x6960('0x8')](),controller[_0x6960('0xb')]);router['get'](_0x6960('0xc'),auth[_0x6960('0x8')](),controller['download']);router[_0x6960('0xa')]('/:id/downloads',controller['downloads']);router[_0x6960('0xa')](_0x6960('0xd'),auth['isAuthenticated'](),controller[_0x6960('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6960('0xf')]);router[_0x6960('0x10')](_0x6960('0xd'),auth[_0x6960('0x8')](),controller[_0x6960('0x11')]);router[_0x6960('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6960('0x13')]);router['delete'](_0x6960('0x14'),auth[_0x6960('0x8')](),controller[_0x6960('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 03a35a3..92fb0e0 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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 593a9ed..47908c4 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 _0x0a48=['apply','save','update','then','end','error','name','send','index','map','VoiceRecording','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','rawAttributes','options','find','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','$and','push','format','recording','Sequelize','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','info','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x2cded1,_0xe7cc1d){var _0x195d6d=function(_0x4802c6){while(--_0x4802c6){_0x2cded1['push'](_0x2cded1['shift']());}};_0x195d6d(++_0xe7cc1d);}(_0x0a48,0x105));var _0x80a4=function(_0x40beba,_0x2917e2){_0x40beba=_0x40beba-0x0;var _0x3ababf=_0x0a48[_0x40beba];return _0x3ababf;};'use strict';var emlformat=require(_0x80a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x80a4('0x1'));var rp=require(_0x80a4('0x2'));var moment=require(_0x80a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x80a4('0x4'));var util=require('util');var path=require(_0x80a4('0x5'));var sox=require(_0x80a4('0x6'));var csv=require('to-csv');var ejs=require(_0x80a4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x80a4('0x8'));var squel=require('squel');var crypto=require(_0x80a4('0x9'));var jsforce=require(_0x80a4('0xa'));var deskjs=require(_0x80a4('0xb'));var toCsv=require(_0x80a4('0xc'));var querystring=require(_0x80a4('0xd'));var Papa=require(_0x80a4('0xe'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x80a4('0xf'));var qs=require(_0x80a4('0x10'));var as=require(_0x80a4('0x11'));var hardwareService=require(_0x80a4('0x12'));var logger=require(_0x80a4('0x13'))('api');var utils=require(_0x80a4('0x14'));var config=require(_0x80a4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x80a4('0x16'))['db'];function respondWithStatusCode(_0xb5f563,_0x457d52){_0x457d52=_0x457d52||0xcc;return function(_0x3078e3){if(_0x3078e3){return _0xb5f563[_0x80a4('0x17')](_0x457d52);}return _0xb5f563[_0x80a4('0x18')](_0x457d52)['end']();};}function respondWithResult(_0x1eada4,_0x2ca80c){_0x2ca80c=_0x2ca80c||0xc8;return function(_0x3babe7){if(_0x3babe7){return _0x1eada4[_0x80a4('0x18')](_0x2ca80c)[_0x80a4('0x19')](_0x3babe7);}};}function respondWithFilteredResult(_0x2d237d,_0x3b592a){return function(_0xe79246){if(_0xe79246){var _0x229426=typeof _0x3b592a[_0x80a4('0x1a')]===_0x80a4('0x1b')&&typeof _0x3b592a[_0x80a4('0x1c')]===_0x80a4('0x1b');var _0xf5ad25=_0xe79246[_0x80a4('0x1d')];var _0x1f501c=_0x229426?0x0:_0x3b592a[_0x80a4('0x1a')];var _0x413e62=_0x229426?_0xe79246['count']:_0x3b592a[_0x80a4('0x1a')]+_0x3b592a[_0x80a4('0x1c')];var _0x287f16;if(_0x413e62>=_0xf5ad25){_0x413e62=_0xf5ad25;_0x287f16=0xc8;}else{_0x287f16=0xce;}_0x2d237d['status'](_0x287f16);return _0x2d237d['set'](_0x80a4('0x1e'),_0x1f501c+'-'+_0x413e62+'/'+_0xf5ad25)[_0x80a4('0x19')](_0xe79246);}return null;};}function patchUpdates(_0x47f179){return function(_0x4d5586){try{jsonpatch[_0x80a4('0x1f')](_0x4d5586,_0x47f179,!![]);}catch(_0x772c72){return BPromise['reject'](_0x772c72);}return _0x4d5586[_0x80a4('0x20')]();};}function saveUpdates(_0xfe8f88,_0x385fd4){return function(_0x326aba){if(_0x326aba){return _0x326aba[_0x80a4('0x21')](_0xfe8f88)[_0x80a4('0x22')](function(_0x43dc8b){return _0x43dc8b;});}return null;};}function removeEntity(_0x571a4e,_0x2b7b96){return function(_0x2f64bc){if(_0x2f64bc){return _0x2f64bc['destroy']()['then'](function(){_0x571a4e[_0x80a4('0x18')](0xcc)[_0x80a4('0x23')]();});}};}function handleEntityNotFound(_0x1a50dd,_0x2e4f50){return function(_0x1fa7b7){if(!_0x1fa7b7){_0x1a50dd[_0x80a4('0x17')](0x194);}return _0x1fa7b7;};}function handleError(_0x25a096,_0x1a7adc){_0x1a7adc=_0x1a7adc||0x1f4;return function(_0xd06dca){logger[_0x80a4('0x24')](_0xd06dca['stack']);if(_0xd06dca['name']){delete _0xd06dca[_0x80a4('0x25')];}_0x25a096[_0x80a4('0x18')](_0x1a7adc)[_0x80a4('0x26')](_0xd06dca);};}exports[_0x80a4('0x27')]=function(_0x44410a,_0x2440eb){var _0x296c6c={},_0x2ae1dd={},_0x453416={'count':0x0,'rows':[]};var _0x1275ec=_[_0x80a4('0x28')](db[_0x80a4('0x29')]['rawAttributes'],function(_0x6b89ab){return{'name':_0x6b89ab[_0x80a4('0x2a')],'type':_0x6b89ab[_0x80a4('0x2b')]['key']};});_0x2ae1dd[_0x80a4('0x2c')]=_[_0x80a4('0x2d')](_[_0x80a4('0x28')](_0x1275ec,_0x80a4('0x25')),['format']);_0x2ae1dd[_0x80a4('0x2e')]=_[_0x80a4('0x2f')](_0x44410a[_0x80a4('0x2e')]);_0x2ae1dd[_0x80a4('0x30')]=_[_0x80a4('0x31')](_0x2ae1dd['model'],_0x2ae1dd[_0x80a4('0x2e')]);_0x296c6c[_0x80a4('0x32')]=_[_0x80a4('0x31')](_0x2ae1dd[_0x80a4('0x2c')],qs[_0x80a4('0x33')](_0x44410a[_0x80a4('0x2e')][_0x80a4('0x33')]));_0x296c6c[_0x80a4('0x32')]=_0x296c6c['attributes'][_0x80a4('0x34')]?_0x296c6c['attributes']:_0x2ae1dd[_0x80a4('0x2c')];if(!_0x44410a[_0x80a4('0x2e')][_0x80a4('0x35')](_0x80a4('0x36'))){_0x296c6c[_0x80a4('0x1c')]=qs[_0x80a4('0x1c')](_0x44410a[_0x80a4('0x2e')]['limit']);_0x296c6c['offset']=qs[_0x80a4('0x1a')](_0x44410a[_0x80a4('0x2e')][_0x80a4('0x1a')]);}_0x296c6c[_0x80a4('0x37')]=qs[_0x80a4('0x38')](_0x44410a['query'][_0x80a4('0x38')]);_0x296c6c[_0x80a4('0x39')]=qs[_0x80a4('0x30')](_[_0x80a4('0x3a')](_0x44410a[_0x80a4('0x2e')],_0x2ae1dd[_0x80a4('0x30')]),_0x1275ec);if(_0x44410a[_0x80a4('0x2e')][_0x80a4('0x3b')]){_0x296c6c['where']=_[_0x80a4('0x3c')](_0x296c6c[_0x80a4('0x39')],{'$or':_[_0x80a4('0x28')](_0x1275ec,function(_0x2239cd){if(_0x2239cd[_0x80a4('0x2b')]!=='VIRTUAL'){var _0x6aac1d={};_0x6aac1d[_0x2239cd[_0x80a4('0x25')]]={'$like':'%'+_0x44410a['query'][_0x80a4('0x3b')]+'%'};return _0x6aac1d;}})});}_0x296c6c=_[_0x80a4('0x3c')]({},_0x296c6c,_0x44410a['options']);var _0x4b5b9b={'where':_0x296c6c[_0x80a4('0x39')]};return db[_0x80a4('0x29')][_0x80a4('0x1d')](_0x4b5b9b)['then'](function(_0x49ceec){_0x453416['count']=_0x49ceec;if(_0x44410a[_0x80a4('0x2e')][_0x80a4('0x3d')]){_0x296c6c['include']=[{'all':!![]}];}return db[_0x80a4('0x29')][_0x80a4('0x3e')](_0x296c6c);})[_0x80a4('0x22')](function(_0x39cfd1){_0x453416[_0x80a4('0x3f')]=_0x39cfd1;return _0x453416;})[_0x80a4('0x22')](respondWithFilteredResult(_0x2440eb,_0x296c6c))[_0x80a4('0x40')](handleError(_0x2440eb,null));};exports[_0x80a4('0x41')]=function(_0x6419fe,_0x3ee700){var _0x52a8d0={'raw':![],'where':{'id':_0x6419fe['params']['id']}},_0x394c84={};_0x394c84['model']=_[_0x80a4('0x2f')](db['VoiceRecording'][_0x80a4('0x42')]);_0x394c84['query']=_['keys'](_0x6419fe[_0x80a4('0x2e')]);_0x394c84[_0x80a4('0x30')]=_[_0x80a4('0x31')](_0x394c84[_0x80a4('0x2c')],_0x394c84['query']);_0x52a8d0[_0x80a4('0x32')]=_['intersection'](_0x394c84[_0x80a4('0x2c')],qs[_0x80a4('0x33')](_0x6419fe['query']['fields']));_0x52a8d0[_0x80a4('0x32')]=_0x52a8d0[_0x80a4('0x32')][_0x80a4('0x34')]?_0x52a8d0[_0x80a4('0x32')]:_0x394c84[_0x80a4('0x2c')];if(_0x6419fe[_0x80a4('0x2e')][_0x80a4('0x3d')]){_0x52a8d0['include']=[{'all':!![]}];}_0x52a8d0=_['merge']({},_0x52a8d0,_0x6419fe[_0x80a4('0x43')]);return db[_0x80a4('0x29')][_0x80a4('0x44')](_0x52a8d0)[_0x80a4('0x22')](handleEntityNotFound(_0x3ee700,null))[_0x80a4('0x22')](respondWithResult(_0x3ee700,null))['catch'](handleError(_0x3ee700,null));};exports[_0x80a4('0x45')]=function(_0x5befec,_0x302b52){return db[_0x80a4('0x29')][_0x80a4('0x45')](_0x5befec['body'],{})['then'](respondWithResult(_0x302b52,0xc9))['catch'](handleError(_0x302b52,null));};exports['update']=function(_0x292775,_0x5c2dbb){if(_0x292775['body']['id']){delete _0x292775[_0x80a4('0x46')]['id'];}return db[_0x80a4('0x29')][_0x80a4('0x44')]({'where':{'id':_0x292775['params']['id']}})['then'](handleEntityNotFound(_0x5c2dbb,null))[_0x80a4('0x22')](saveUpdates(_0x292775[_0x80a4('0x46')],null))['then'](respondWithResult(_0x5c2dbb,null))[_0x80a4('0x40')](handleError(_0x5c2dbb,null));};exports[_0x80a4('0x47')]=function(_0x4cbe17,_0x42e23b){return db[_0x80a4('0x29')][_0x80a4('0x47')]()[_0x80a4('0x22')](respondWithResult(_0x42e23b,null))['catch'](handleError(_0x42e23b,null));};exports[_0x80a4('0x48')]=function(_0x2afef1,_0x1fda8c,_0x1957b5){var _0x2a3558=require(_0x80a4('0x49'));var _0x101cca=![];var _0x320fa2={};if(_0x2afef1[_0x80a4('0x2e')][_0x80a4('0x2b')]&&_0x2afef1[_0x80a4('0x2e')][_0x80a4('0x2b')]===_0x80a4('0x4a')){_0x320fa2[_0x80a4('0x4a')]=_0x2afef1[_0x80a4('0x4b')]['id'];}else{_0x320fa2['id']=_0x2afef1[_0x80a4('0x4b')]['id'];}return db['VoiceRecording'][_0x80a4('0x44')]({'where':_0x320fa2,'attributes':['id',_0x80a4('0x4c')],'raw':!![]})[_0x80a4('0x22')](handleEntityNotFound(_0x1fda8c,null))[_0x80a4('0x22')](function(_0x395e94){if(_0x395e94){var _0x572064=_0x395e94[_0x80a4('0x4c')];var _0x2be6fc=util['format'](_0x80a4('0x4d'),_0x572064);if(fs[_0x80a4('0x4e')](_0x2be6fc)){_0x101cca=!![];return _0x2a3558[_0x80a4('0x4f')](_0x2be6fc,_0x572064,config[_0x80a4('0x50')]['recording'])[_0x80a4('0x22')](function(){return _0x395e94;});}return _0x395e94;}})['then'](function(_0xdff57a){if(_0xdff57a){var _0x4c68f8=_0xdff57a[_0x80a4('0x4c')];if(!fs['existsSync'](_0x4c68f8)){throw new db['Sequelize'][(_0x80a4('0x51'))](_0x80a4('0x52'));}if(_0xdff57a[_0x80a4('0x53')]){return _0x1fda8c['download'](_0x4c68f8,_0xdff57a[_0x80a4('0x53')]+path[_0x80a4('0x54')](_0x4c68f8),function(){if(_0x101cca){fs['unlink'](_0x4c68f8);}});}else{return _0x1fda8c[_0x80a4('0x48')](_0x4c68f8,function(_0x55bad9){if(_0x101cca){fs[_0x80a4('0x55')](_0x4c68f8);}});}}})[_0x80a4('0x40')](function(_0x24fb58){if(_0x24fb58[_0x80a4('0x56')]==='VoiceRecording\x20not\x20found'){_0x1fda8c[_0x80a4('0x18')](0x194)['send'](_0x80a4('0x57'));}else{return handleError(_0x1fda8c,null);}});};exports[_0x80a4('0x58')]=function(_0x5a544f,_0x4e6284,_0x4b7807){var _0x4664ed=require(_0x80a4('0x49'));var _0x5c6443=![];var _0x5c24fb={'$and':[db[_0x80a4('0x59')][_0x80a4('0x39')](db[_0x80a4('0x59')]['fn'](_0x80a4('0x5a'),db['sequelize']['col'](_0x80a4('0x4a'))),_0x5a544f['query']['token'])]};if(_0x5a544f['query'][_0x80a4('0x2b')]&&_0x5a544f[_0x80a4('0x2e')][_0x80a4('0x2b')]===_0x80a4('0x4a')){_0x5c24fb[_0x80a4('0x5b')][_0x80a4('0x5c')]({'uniqueid':_0x5a544f[_0x80a4('0x4b')]['id']});}else{_0x5c24fb[_0x80a4('0x5b')][_0x80a4('0x5c')]({'id':_0x5a544f[_0x80a4('0x4b')]['id']});}return db[_0x80a4('0x29')][_0x80a4('0x44')]({'where':_0x5c24fb,'attributes':['id',_0x80a4('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x4e6284,null))[_0x80a4('0x22')](function(_0x54012d){if(_0x54012d){var _0x2a22ae=util[_0x80a4('0x5d')](_0x80a4('0x4d'),_0x54012d['value']);if(fs[_0x80a4('0x4e')](_0x2a22ae)){_0x5c6443=!![];return _0x4664ed['decryptFile'](_0x2a22ae,_0x54012d[_0x80a4('0x4c')],config[_0x80a4('0x50')][_0x80a4('0x5e')])[_0x80a4('0x22')](function(){return _0x54012d;});}return _0x54012d;}})[_0x80a4('0x22')](function(_0x368ac2){if(_0x368ac2){if(!fs[_0x80a4('0x4e')](_0x368ac2[_0x80a4('0x4c')])){throw new db[(_0x80a4('0x5f'))][(_0x80a4('0x51'))](_0x80a4('0x52'));}if(_0x368ac2[_0x80a4('0x53')]){return _0x4e6284[_0x80a4('0x48')](_0x368ac2[_0x80a4('0x4c')],_0x368ac2[_0x80a4('0x53')]+path[_0x80a4('0x54')](_0x368ac2[_0x80a4('0x4c')]),function(){if(_0x5c6443){fs[_0x80a4('0x55')](_0x368ac2[_0x80a4('0x4c')]);}});}else{return _0x4e6284[_0x80a4('0x48')](_0x368ac2[_0x80a4('0x4c')],function(_0x52bb2c){if(_0x5c6443){fs[_0x80a4('0x55')](_0x368ac2[_0x80a4('0x4c')]);}});}}})[_0x80a4('0x40')](handleError(_0x4e6284,null));};exports[_0x80a4('0x60')]=function(_0x163fbd,_0x2ca446){return db['VoiceRecording'][_0x80a4('0x44')]({'where':{'id':_0x163fbd[_0x80a4('0x4b')]['id']}})[_0x80a4('0x22')](function(_0x28fe20){if(_[_0x80a4('0x61')](_0x28fe20)){throw new ReferenceError(_0x80a4('0x62'));}return _0x28fe20;})[_0x80a4('0x22')](function(_0x3fd97c){var _0x435bc1=_0x3fd97c[_0x80a4('0x4c')];logger['info'](_0x80a4('0x63'),_0x435bc1);if(!_[_0x80a4('0x61')](_0x3fd97c['value'])&&fs[_0x80a4('0x4e')](_0x435bc1)){logger['info'](_0x80a4('0x64')+_0x435bc1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x80a4('0x65')](_0x435bc1);}_0x435bc1=_0x435bc1+_0x80a4('0x66');if(!_['isNil'](_0x3fd97c[_0x80a4('0x4c')])&&fs[_0x80a4('0x4e')](_0x435bc1)){logger[_0x80a4('0x67')](_0x80a4('0x64')+_0x435bc1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x80a4('0x65')](_0x435bc1);}return _0x3fd97c;})[_0x80a4('0x22')](function(_0x16c17f){if(!_0x16c17f)throw new InternalError();return _0x16c17f[_0x80a4('0x60')]();})[_0x80a4('0x22')](function(){_0x2ca446[_0x80a4('0x18')](0xcc)[_0x80a4('0x23')]();})[_0x80a4('0x40')](handleError(_0x2ca446,null));};function getBucketslist(_0x27f218,_0x8782d4,_0x850395){return new Promise(function(_0x1ffb69,_0x346c02){var _0x59316c=new AWS['S3']({'accessKeyId':_0x8782d4,'secretAccessKey':_0x27f218,'region':_0x850395});_0x59316c['listBuckets']({},function(_0x3974ca,_0x52f196){if(_0x3974ca){return _0x346c02(_0x3974ca);}else{return _0x1ffb69(_0x52f196);}});});}function createBucket(_0x3dbd07,_0x4567e8,_0x334265,_0x4b473e){return new Promise(function(_0x8aaaa7,_0x1d538c){var _0x291b91=new AWS['S3']({'accessKeyId':_0x4567e8,'secretAccessKey':_0x3dbd07,'region':_0x334265});_0x291b91['createBucket']({'Bucket':_0x4b473e},function(_0x4b0a19,_0x308275){if(_0x4b0a19){return _0x1d538c(_0x4b0a19);}else{return _0x8aaaa7(_0x308275);}});});}function uploadFile(_0x5ef838,_0x928a6f,_0xd203df,_0x5c68bc,_0x1674a5,_0x32731b){return new Promise(function(_0x103659,_0x37f6da){var _0x100f27=new AWS['S3']({'accessKeyId':_0x928a6f,'secretAccessKey':_0x5ef838,'region':_0xd203df});_0x100f27[_0x80a4('0x68')]({'Bucket':_0x5c68bc,'Key':_0x1674a5,'Body':_0x32731b},function(_0x18b74e,_0x2e681c){if(_0x18b74e){return _0x37f6da(_0x18b74e);}else{return _0x103659(_0x2e681c);}});});}function startTranscribe(_0x1ecb2b,_0x50d60b,_0x1672ed,_0x3ae179,_0x9a8242,_0x3ae97e){return new Promise(function(_0x54f1b1,_0x2e7a1b){var _0x440178=new AWS['TranscribeService']({'accessKeyId':_0x50d60b,'secretAccessKey':_0x1ecb2b,'region':_0x1672ed});_0x440178[_0x80a4('0x69')]({'TranscriptionJobName':_0x3ae179,'LanguageCode':_0x9a8242,'Media':{'MediaFileUri':_0x3ae97e}},function(_0x1d64ef,_0x190124){if(_0x1d64ef){return _0x2e7a1b(_0x1d64ef);}else{return _0x54f1b1(_0x190124);}});});}function transcribe(_0x17e626,_0x2fee83,_0x2c73d5,_0x1a53e7,_0x15402e,_0x32fb36,_0x434eae){return new Promise(function(_0x723da5,_0xdddd40){var _0x51103b={};logger[_0x80a4('0x67')](util[_0x80a4('0x5d')](_0x80a4('0x6a'),_0x17e626,_0x15402e));return uploadFile(_0x2fee83,_0x2c73d5,_0x1a53e7,_0x15402e,path['basename'](_0x32fb36),fs[_0x80a4('0x6b')](_0x32fb36))['then'](function(_0x5a9878){logger[_0x80a4('0x67')](util[_0x80a4('0x5d')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x17e626,_0x15402e,_0x5a9878[_0x80a4('0x6c')]));_0x51103b[_0x80a4('0x6d')]=_0x5a9878[_0x80a4('0x6e')];_0x51103b[_0x80a4('0x6f')]=_0x5a9878[_0x80a4('0x6c')];logger[_0x80a4('0x67')](util['format'](_0x80a4('0x70'),_0x17e626));return startTranscribe(_0x2fee83,_0x2c73d5,_0x1a53e7,uuidv4(),_0x434eae,_0x5a9878[_0x80a4('0x6c')]);})[_0x80a4('0x22')](function(_0x7b074d){logger[_0x80a4('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x17e626,_0x7b074d[_0x80a4('0x71')][_0x80a4('0x72')]));_0x51103b[_0x80a4('0x73')]=_0x7b074d[_0x80a4('0x71')][_0x80a4('0x72')];_0x51103b[_0x80a4('0x74')]=_0x7b074d['TranscriptionJob'][_0x80a4('0x75')];return _0x723da5(_0x51103b);})[_0x80a4('0x40')](function(_0x469661){return _0xdddd40(_0x469661);});});}exports['runTranscribe']=function(_0x468422,_0x45ce32,_0x1e3370){var _0x5e1d60;var _0x17aac6;var _0x2cccb8;var _0x53eaf1=require('../../components/encryptor');return db[_0x80a4('0x29')]['findOne']({'where':{'id':_0x468422[_0x80a4('0x4b')]['id']}})[_0x80a4('0x22')](function(_0x142c02){if(_0x142c02){var _0x261cce=util[_0x80a4('0x5d')]('%s.cypher',_0x142c02[_0x80a4('0x4c')]);if(fs[_0x80a4('0x4e')](_0x261cce)){cypher=!![];return _0x53eaf1[_0x80a4('0x4f')](_0x261cce,_0x142c02[_0x80a4('0x4c')],config['secrets'][_0x80a4('0x5e')])[_0x80a4('0x22')](function(){return _0x142c02;});}return _0x142c02;}})[_0x80a4('0x22')](function(_0x3a6af9){if(!_0x3a6af9){throw new db[(_0x80a4('0x5f'))][(_0x80a4('0x51'))](_0x80a4('0x76'));}_0x17aac6=_0x3a6af9;return db[_0x80a4('0x77')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x45ce32,null))[_0x80a4('0x22')](function(_0x24e872){if(_0x24e872){_0x5e1d60=_0x24e872;if(!_0x5e1d60[_0x80a4('0x78')]||!_0x5e1d60[_0x80a4('0x79')]||!_0x5e1d60[_0x80a4('0x7a')]||!_0x5e1d60['language']||!_0x5e1d60[_0x80a4('0x6d')]){throw new db[(_0x80a4('0x5f'))][(_0x80a4('0x51'))](_0x80a4('0x7b'));}if(_0x468422[_0x80a4('0x46')]['runSentiment']&&(!_0x5e1d60[_0x80a4('0x7c')]||!_0x5e1d60[_0x80a4('0x7d')]||!_0x5e1d60[_0x80a4('0x7e')]||!_0x5e1d60['language']||!_0x5e1d60[_0x80a4('0x6d')])){throw new db['Sequelize'][(_0x80a4('0x51'))](_0x80a4('0x7f'));}return db['CloudProvider'][_0x80a4('0x80')]({'where':{'id':_0x5e1d60[_0x80a4('0x79')]}});}})[_0x80a4('0x22')](function(_0x413767){if(!_0x413767){throw new db[(_0x80a4('0x5f'))][(_0x80a4('0x51'))](_0x80a4('0x81'));}if(!_0x413767[_0x80a4('0x82')]||!_0x413767[_0x80a4('0x83')]){throw new db[(_0x80a4('0x5f'))][(_0x80a4('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x2cccb8=_0x413767;return getBucketslist(_0x2cccb8[_0x80a4('0x82')],_0x2cccb8[_0x80a4('0x83')],_0x5e1d60[_0x80a4('0x7a')]);})[_0x80a4('0x22')](function(_0x3ae594){if(_0x3ae594&&_0x3ae594['Buckets']){var _0x31855f=_[_0x80a4('0x44')](_0x3ae594[_0x80a4('0x84')],function(_0x174911){return _0x174911['Name']===_0x5e1d60[_0x80a4('0x6d')];});if(!_0x31855f){logger[_0x80a4('0x67')](util[_0x80a4('0x5d')](_0x80a4('0x85'),_0x468422[_0x80a4('0x4b')]['id'],_0x5e1d60[_0x80a4('0x6d')]));return createBucket(_0x2cccb8['data1'],_0x2cccb8[_0x80a4('0x83')],_0x5e1d60['transcribeRegion'],_0x5e1d60[_0x80a4('0x6d')]);}logger[_0x80a4('0x67')](util[_0x80a4('0x5d')](_0x80a4('0x86'),_0x468422[_0x80a4('0x4b')]['id'],_0x5e1d60[_0x80a4('0x6d')]));return;}})[_0x80a4('0x22')](function(_0x499091){if(_0x17aac6[_0x80a4('0x74')]==='NEW'){return transcribe(_0x468422[_0x80a4('0x4b')]['id'],_0x2cccb8[_0x80a4('0x82')],_0x2cccb8[_0x80a4('0x83')],_0x5e1d60[_0x80a4('0x7a')],_0x5e1d60[_0x80a4('0x6d')],_0x17aac6[_0x80a4('0x4c')],_0x5e1d60['language']);}else{logger[_0x80a4('0x67')](util[_0x80a4('0x5d')](_0x80a4('0x87'),_0x468422[_0x80a4('0x4b')]['id']));return{'transcribeStatus':_0x80a4('0x88')};}})[_0x80a4('0x22')](function(_0x24f66b){if(_0x24f66b){_0x24f66b[_0x80a4('0x89')]=_0x468422[_0x80a4('0x46')]['runSentiment'];return _0x17aac6[_0x80a4('0x8a')](_0x24f66b);}})[_0x80a4('0x22')](respondWithResult(_0x45ce32,null))[_0x80a4('0x40')](handleError(_0x45ce32,null));};function writeFile(_0x565ee2,_0x2a4ad0){return new Promise(function(_0x124762,_0x44248b){fs[_0x80a4('0x8b')](_0x2a4ad0,_0x565ee2,function(_0x24853d,_0xb8f6d2){if(_0x24853d){return _0x44248b(_0x24853d);}else{return _0x124762(_0xb8f6d2);}});});}exports[_0x80a4('0x8c')]=function(_0xd7eba7,_0x662b19,_0xdc6a6b){return db[_0x80a4('0x29')]['findOne']({'where':{'id':_0xd7eba7[_0x80a4('0x4b')]['id']}})[_0x80a4('0x22')](handleEntityNotFound(_0x662b19))[_0x80a4('0x22')](function(_0x1ec957){if(_0x1ec957&&_0x1ec957[_0x80a4('0x8d')]){var _0x294a5e=_0x1ec957[_0x80a4('0x8d')];var _0x475649=config[_0x80a4('0x8e')]+_0x80a4('0x8f')+_0x1ec957['id']+_0x80a4('0x90');if(fs[_0x80a4('0x4e')](_0x475649)){return _0x475649;}return writeFile(_0x294a5e,_0x475649)[_0x80a4('0x22')](function(){return _0x475649;});}else{throw new db[(_0x80a4('0x5f'))][(_0x80a4('0x51'))](_0x80a4('0x91'));}})[_0x80a4('0x22')](function(_0x4d391a){return _0x662b19[_0x80a4('0x48')](_0x4d391a);})[_0x80a4('0x40')](handleError(_0x662b19));}; \ No newline at end of file +var _0x3ce9=['CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','destroy','then','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','name','format','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','findAll','catch','params','include','find','body','download','../../components/encryptor','uniqueid','value','%s.cypher','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','decryptFile','Setting','findOne','transcribe','transcribeAccountId','language','bucket','runSentiment','sentiment','sentimentRegion'];(function(_0x450033,_0x513ddd){var _0xdd1ce4=function(_0x2a2da2){while(--_0x2a2da2){_0x450033['push'](_0x450033['shift']());}};_0xdd1ce4(++_0x513ddd);}(_0x3ce9,0x1d3));var _0x93ce=function(_0x3faebb,_0x1266a4){_0x3faebb=_0x3faebb-0x0;var _0x1d45b2=_0x3ce9[_0x3faebb];return _0x1d45b2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93ce('0x0'));var zipdir=require(_0x93ce('0x1'));var jsonpatch=require(_0x93ce('0x2'));var rp=require(_0x93ce('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93ce('0x4'));var path=require('path');var sox=require(_0x93ce('0x5'));var csv=require(_0x93ce('0x6'));var ejs=require(_0x93ce('0x7'));var fs=require('fs');var fs_extra=require(_0x93ce('0x8'));var _=require(_0x93ce('0x9'));var squel=require(_0x93ce('0xa'));var crypto=require(_0x93ce('0xb'));var jsforce=require(_0x93ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93ce('0x6'));var querystring=require(_0x93ce('0xd'));var Papa=require(_0x93ce('0xe'));var AWS=require(_0x93ce('0xf'));var uuidv4=require(_0x93ce('0x10'));var Redis=require(_0x93ce('0x11'));var authService=require(_0x93ce('0x12'));var qs=require(_0x93ce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93ce('0x14'))(_0x93ce('0x15'));var utils=require(_0x93ce('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x93ce('0x17'));var db=require(_0x93ce('0x18'))['db'];function respondWithStatusCode(_0x2181c9,_0x583870){_0x583870=_0x583870||0xcc;return function(_0x2438b1){if(_0x2438b1){return _0x2181c9[_0x93ce('0x19')](_0x583870);}return _0x2181c9[_0x93ce('0x1a')](_0x583870)[_0x93ce('0x1b')]();};}function respondWithResult(_0x41c6a4,_0x148d6a){_0x148d6a=_0x148d6a||0xc8;return function(_0x1ff7df){if(_0x1ff7df){return _0x41c6a4['status'](_0x148d6a)[_0x93ce('0x1c')](_0x1ff7df);}};}function respondWithFilteredResult(_0x17ac01,_0x150cb7){return function(_0xee5bba){if(_0xee5bba){var _0x366f3e=typeof _0x150cb7['offset']==='undefined'&&typeof _0x150cb7[_0x93ce('0x1d')]===_0x93ce('0x1e');var _0x38be03=_0xee5bba[_0x93ce('0x1f')];var _0x3b9daf=_0x366f3e?0x0:_0x150cb7[_0x93ce('0x20')];var _0x3c049e=_0x366f3e?_0xee5bba[_0x93ce('0x1f')]:_0x150cb7[_0x93ce('0x20')]+_0x150cb7['limit'];var _0x2de43f;if(_0x3c049e>=_0x38be03){_0x3c049e=_0x38be03;_0x2de43f=0xc8;}else{_0x2de43f=0xce;}_0x17ac01[_0x93ce('0x1a')](_0x2de43f);return _0x17ac01['set'](_0x93ce('0x21'),_0x3b9daf+'-'+_0x3c049e+'/'+_0x38be03)['json'](_0xee5bba);}return null;};}function patchUpdates(_0x14a791){return function(_0x568801){try{jsonpatch['apply'](_0x568801,_0x14a791,!![]);}catch(_0x4a7a18){return BPromise[_0x93ce('0x22')](_0x4a7a18);}return _0x568801[_0x93ce('0x23')]();};}function saveUpdates(_0xd5193e,_0x9343a){return function(_0x572c5a){if(_0x572c5a){return _0x572c5a[_0x93ce('0x24')](_0xd5193e)['then'](function(_0xccaf57){return _0xccaf57;});}return null;};}function removeEntity(_0x3edad8,_0x5e0f4c){return function(_0x48af6b){if(_0x48af6b){return _0x48af6b[_0x93ce('0x25')]()[_0x93ce('0x26')](function(){_0x3edad8[_0x93ce('0x1a')](0xcc)[_0x93ce('0x1b')]();});}};}function handleEntityNotFound(_0x25fc17,_0x4eea5d){return function(_0x580a50){if(!_0x580a50){_0x25fc17[_0x93ce('0x19')](0x194);}return _0x580a50;};}function handleError(_0x3893dc,_0x3efee1){_0x3efee1=_0x3efee1||0x1f4;return function(_0x1262e5){logger['error'](_0x1262e5['stack']);if(_0x1262e5['name']){delete _0x1262e5['name'];}_0x3893dc[_0x93ce('0x1a')](_0x3efee1)[_0x93ce('0x27')](_0x1262e5);};}exports[_0x93ce('0x28')]=function(_0x2ab0e6,_0x29c6ae){var _0x48ca18={},_0x201486={},_0x598874={'count':0x0,'rows':[]};var _0x4bbec8=_[_0x93ce('0x29')](db['VoiceRecording'][_0x93ce('0x2a')],function(_0x742a61){return{'name':_0x742a61[_0x93ce('0x2b')],'type':_0x742a61[_0x93ce('0x2c')][_0x93ce('0x2d')]};});_0x201486[_0x93ce('0x2e')]=_[_0x93ce('0x2f')](_[_0x93ce('0x29')](_0x4bbec8,_0x93ce('0x30')),[_0x93ce('0x31')]);_0x201486['query']=_[_0x93ce('0x32')](_0x2ab0e6['query']);_0x201486[_0x93ce('0x33')]=_[_0x93ce('0x34')](_0x201486[_0x93ce('0x2e')],_0x201486[_0x93ce('0x35')]);_0x48ca18[_0x93ce('0x36')]=_[_0x93ce('0x34')](_0x201486[_0x93ce('0x2e')],qs[_0x93ce('0x37')](_0x2ab0e6[_0x93ce('0x35')][_0x93ce('0x37')]));_0x48ca18[_0x93ce('0x36')]=_0x48ca18[_0x93ce('0x36')][_0x93ce('0x38')]?_0x48ca18[_0x93ce('0x36')]:_0x201486[_0x93ce('0x2e')];if(!_0x2ab0e6['query'][_0x93ce('0x39')]('nolimit')){_0x48ca18[_0x93ce('0x1d')]=qs['limit'](_0x2ab0e6['query'][_0x93ce('0x1d')]);_0x48ca18['offset']=qs['offset'](_0x2ab0e6[_0x93ce('0x35')][_0x93ce('0x20')]);}_0x48ca18[_0x93ce('0x3a')]=qs[_0x93ce('0x3b')](_0x2ab0e6['query']['sort']);_0x48ca18[_0x93ce('0x3c')]=qs[_0x93ce('0x33')](_[_0x93ce('0x3d')](_0x2ab0e6[_0x93ce('0x35')],_0x201486[_0x93ce('0x33')]),_0x4bbec8);if(_0x2ab0e6[_0x93ce('0x35')][_0x93ce('0x3e')]){_0x48ca18[_0x93ce('0x3c')]=_[_0x93ce('0x3f')](_0x48ca18[_0x93ce('0x3c')],{'$or':_[_0x93ce('0x29')](_0x4bbec8,function(_0x424603){if(_0x424603['type']!==_0x93ce('0x40')){var _0x1a846e={};_0x1a846e[_0x424603['name']]={'$like':'%'+_0x2ab0e6[_0x93ce('0x35')]['filter']+'%'};return _0x1a846e;}})});}_0x48ca18=_['merge']({},_0x48ca18,_0x2ab0e6[_0x93ce('0x41')]);var _0x2fdbda={'where':_0x48ca18['where']};return db[_0x93ce('0x42')][_0x93ce('0x1f')](_0x2fdbda)['then'](function(_0x25ace4){_0x598874[_0x93ce('0x1f')]=_0x25ace4;if(_0x2ab0e6['query'][_0x93ce('0x43')]){_0x48ca18['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x93ce('0x44')](_0x48ca18);})[_0x93ce('0x26')](function(_0x2c9682){_0x598874['rows']=_0x2c9682;return _0x598874;})['then'](respondWithFilteredResult(_0x29c6ae,_0x48ca18))[_0x93ce('0x45')](handleError(_0x29c6ae,null));};exports['show']=function(_0x4fc408,_0x2d824a){var _0x21fbc7={'raw':![],'where':{'id':_0x4fc408[_0x93ce('0x46')]['id']}},_0x135f7c={};_0x135f7c[_0x93ce('0x2e')]=_[_0x93ce('0x32')](db[_0x93ce('0x42')][_0x93ce('0x2a')]);_0x135f7c['query']=_[_0x93ce('0x32')](_0x4fc408[_0x93ce('0x35')]);_0x135f7c[_0x93ce('0x33')]=_[_0x93ce('0x34')](_0x135f7c[_0x93ce('0x2e')],_0x135f7c['query']);_0x21fbc7['attributes']=_[_0x93ce('0x34')](_0x135f7c[_0x93ce('0x2e')],qs['fields'](_0x4fc408[_0x93ce('0x35')][_0x93ce('0x37')]));_0x21fbc7[_0x93ce('0x36')]=_0x21fbc7['attributes'][_0x93ce('0x38')]?_0x21fbc7['attributes']:_0x135f7c[_0x93ce('0x2e')];if(_0x4fc408[_0x93ce('0x35')][_0x93ce('0x43')]){_0x21fbc7[_0x93ce('0x47')]=[{'all':!![]}];}_0x21fbc7=_[_0x93ce('0x3f')]({},_0x21fbc7,_0x4fc408[_0x93ce('0x41')]);return db[_0x93ce('0x42')][_0x93ce('0x48')](_0x21fbc7)[_0x93ce('0x26')](handleEntityNotFound(_0x2d824a,null))['then'](respondWithResult(_0x2d824a,null))['catch'](handleError(_0x2d824a,null));};exports['create']=function(_0x53bbb4,_0x5e8970){return db['VoiceRecording']['create'](_0x53bbb4[_0x93ce('0x49')],{})[_0x93ce('0x26')](respondWithResult(_0x5e8970,0xc9))[_0x93ce('0x45')](handleError(_0x5e8970,null));};exports[_0x93ce('0x24')]=function(_0x498df4,_0x5a0d26){if(_0x498df4[_0x93ce('0x49')]['id']){delete _0x498df4['body']['id'];}return db[_0x93ce('0x42')][_0x93ce('0x48')]({'where':{'id':_0x498df4['params']['id']}})[_0x93ce('0x26')](handleEntityNotFound(_0x5a0d26,null))['then'](saveUpdates(_0x498df4['body'],null))[_0x93ce('0x26')](respondWithResult(_0x5a0d26,null))[_0x93ce('0x45')](handleError(_0x5a0d26,null));};exports['describe']=function(_0x58de12,_0x4690f4){return db['VoiceRecording']['describe']()['then'](respondWithResult(_0x4690f4,null))[_0x93ce('0x45')](handleError(_0x4690f4,null));};exports[_0x93ce('0x4a')]=function(_0x4247f7,_0xd3ecda,_0x38fcc2){var _0x9ba269=require(_0x93ce('0x4b'));var _0x2bad13=![];var _0x5b41fe={};if(_0x4247f7[_0x93ce('0x35')][_0x93ce('0x2c')]&&_0x4247f7[_0x93ce('0x35')][_0x93ce('0x2c')]===_0x93ce('0x4c')){_0x5b41fe['uniqueid']=_0x4247f7[_0x93ce('0x46')]['id'];}else{_0x5b41fe['id']=_0x4247f7[_0x93ce('0x46')]['id'];}return db[_0x93ce('0x42')]['find']({'where':_0x5b41fe,'attributes':['id',_0x93ce('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xd3ecda,null))[_0x93ce('0x26')](function(_0x24157d){if(_0x24157d){var _0x2d274d=_0x24157d[_0x93ce('0x4d')];var _0x4aec19=util['format'](_0x93ce('0x4e'),_0x2d274d);if(fs['existsSync'](_0x4aec19)){_0x2bad13=!![];return _0x9ba269['decryptFile'](_0x4aec19,_0x2d274d,config['secrets'][_0x93ce('0x4f')])[_0x93ce('0x26')](function(){return _0x24157d;});}return _0x24157d;}})[_0x93ce('0x26')](function(_0x8fa1d8){if(_0x8fa1d8){var _0x4f7944=_0x8fa1d8[_0x93ce('0x4d')];if(!fs[_0x93ce('0x50')](_0x4f7944)){throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))](_0x93ce('0x53'));}if(_0x8fa1d8[_0x93ce('0x54')]){return _0xd3ecda[_0x93ce('0x4a')](_0x4f7944,_0x8fa1d8['filename']+path['extname'](_0x4f7944),function(){if(_0x2bad13){fs['unlink'](_0x4f7944);}});}else{return _0xd3ecda['download'](_0x4f7944,function(_0x111ca0){if(_0x2bad13){fs[_0x93ce('0x55')](_0x4f7944);}});}}})['catch'](function(_0x5cb9c2){if(_0x5cb9c2[_0x93ce('0x56')]===_0x93ce('0x53')){_0xd3ecda[_0x93ce('0x1a')](0x194)[_0x93ce('0x27')](_0x93ce('0x57'));}else{return handleError(_0xd3ecda,null);}});};exports[_0x93ce('0x58')]=function(_0x42295f,_0x4d6720,_0xdba791){var _0x24daa1=require(_0x93ce('0x4b'));var _0x569fac=![];var _0x2480a9={'$and':[db[_0x93ce('0x59')][_0x93ce('0x3c')](db[_0x93ce('0x59')]['fn'](_0x93ce('0x5a'),db[_0x93ce('0x59')][_0x93ce('0x5b')](_0x93ce('0x4c'))),_0x42295f['query'][_0x93ce('0x5c')])]};if(_0x42295f[_0x93ce('0x35')][_0x93ce('0x2c')]&&_0x42295f[_0x93ce('0x35')][_0x93ce('0x2c')]===_0x93ce('0x4c')){_0x2480a9['$and']['push']({'uniqueid':_0x42295f[_0x93ce('0x46')]['id']});}else{_0x2480a9[_0x93ce('0x5d')][_0x93ce('0x5e')]({'id':_0x42295f['params']['id']});}return db[_0x93ce('0x42')][_0x93ce('0x48')]({'where':_0x2480a9,'attributes':['id',_0x93ce('0x4d')],'raw':!![]})[_0x93ce('0x26')](handleEntityNotFound(_0x4d6720,null))[_0x93ce('0x26')](function(_0x1c5741){if(_0x1c5741){var _0x144eda=util['format'](_0x93ce('0x4e'),_0x1c5741['value']);if(fs['existsSync'](_0x144eda)){_0x569fac=!![];return _0x24daa1['decryptFile'](_0x144eda,_0x1c5741[_0x93ce('0x4d')],config[_0x93ce('0x5f')][_0x93ce('0x4f')])[_0x93ce('0x26')](function(){return _0x1c5741;});}return _0x1c5741;}})['then'](function(_0x479fb4){if(_0x479fb4){if(!fs['existsSync'](_0x479fb4[_0x93ce('0x4d')])){throw new db[(_0x93ce('0x51'))]['ValidationError'](_0x93ce('0x53'));}if(_0x479fb4[_0x93ce('0x54')]){return _0x4d6720[_0x93ce('0x4a')](_0x479fb4[_0x93ce('0x4d')],_0x479fb4['filename']+path['extname'](_0x479fb4['value']),function(){if(_0x569fac){fs[_0x93ce('0x55')](_0x479fb4[_0x93ce('0x4d')]);}});}else{return _0x4d6720[_0x93ce('0x4a')](_0x479fb4['value'],function(_0x2bbcd7){if(_0x569fac){fs['unlink'](_0x479fb4[_0x93ce('0x4d')]);}});}}})[_0x93ce('0x45')](handleError(_0x4d6720,null));};exports[_0x93ce('0x25')]=function(_0x1ecbf2,_0x1eaa50){return db[_0x93ce('0x42')][_0x93ce('0x48')]({'where':{'id':_0x1ecbf2['params']['id']}})[_0x93ce('0x26')](function(_0x3d3a87){if(_[_0x93ce('0x60')](_0x3d3a87)){throw new ReferenceError(_0x93ce('0x61'));}return _0x3d3a87;})['then'](function(_0x57b6e2){var _0x47304b=_0x57b6e2[_0x93ce('0x4d')];logger[_0x93ce('0x62')](_0x93ce('0x63'),_0x47304b);if(!_[_0x93ce('0x60')](_0x57b6e2[_0x93ce('0x4d')])&&fs[_0x93ce('0x50')](_0x47304b)){logger[_0x93ce('0x62')](_0x93ce('0x64')+_0x47304b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x47304b);}_0x47304b=_0x47304b+'.cypher';if(!_[_0x93ce('0x60')](_0x57b6e2[_0x93ce('0x4d')])&&fs['existsSync'](_0x47304b)){logger[_0x93ce('0x62')]('File:\x20\x22'+_0x47304b+_0x93ce('0x65'));fs['unlinkSync'](_0x47304b);}return _0x57b6e2;})[_0x93ce('0x26')](function(_0x49d965){if(!_0x49d965)throw new InternalError();return _0x49d965[_0x93ce('0x25')]();})['then'](function(){_0x1eaa50['status'](0xcc)['end']();})[_0x93ce('0x45')](handleError(_0x1eaa50,null));};function getBucketslist(_0x3a7fc5,_0x5ac129,_0x5d0b68){return new Promise(function(_0x30ae20,_0x2eac2f){var _0x5b184d=new AWS['S3']({'accessKeyId':_0x5ac129,'secretAccessKey':_0x3a7fc5,'region':_0x5d0b68});_0x5b184d[_0x93ce('0x66')]({},function(_0x357693,_0x41d461){if(_0x357693){return _0x2eac2f(_0x357693);}else{return _0x30ae20(_0x41d461);}});});}function createBucket(_0x107b7e,_0x449d5b,_0xaaa37d,_0x84b1f0){return new Promise(function(_0x260a4b,_0x65e58){var _0x31bcd2=new AWS['S3']({'accessKeyId':_0x449d5b,'secretAccessKey':_0x107b7e,'region':_0xaaa37d});_0x31bcd2[_0x93ce('0x67')]({'Bucket':_0x84b1f0},function(_0x14369d,_0x2305b3){if(_0x14369d){return _0x65e58(_0x14369d);}else{return _0x260a4b(_0x2305b3);}});});}function uploadFile(_0x476333,_0x23edbc,_0x1a335b,_0xe6c456,_0xc9fa6a,_0x18f4c4){return new Promise(function(_0x2789c6,_0x38ed36){var _0x57cfde=new AWS['S3']({'accessKeyId':_0x23edbc,'secretAccessKey':_0x476333,'region':_0x1a335b});_0x57cfde[_0x93ce('0x68')]({'Bucket':_0xe6c456,'Key':_0xc9fa6a,'Body':_0x18f4c4},function(_0x2c7b0b,_0x14920a){if(_0x2c7b0b){return _0x38ed36(_0x2c7b0b);}else{return _0x2789c6(_0x14920a);}});});}function startTranscribe(_0x48726d,_0x412c4d,_0x126fea,_0x71ced7,_0x157c25,_0x1f56fb){return new Promise(function(_0x2c0eee,_0x2b1115){var _0x394d94=new AWS[(_0x93ce('0x69'))]({'accessKeyId':_0x412c4d,'secretAccessKey':_0x48726d,'region':_0x126fea});_0x394d94[_0x93ce('0x6a')]({'TranscriptionJobName':_0x71ced7,'LanguageCode':_0x157c25,'Media':{'MediaFileUri':_0x1f56fb}},function(_0x586d4c,_0x5a6b4c){if(_0x586d4c){return _0x2b1115(_0x586d4c);}else{return _0x2c0eee(_0x5a6b4c);}});});}function transcribe(_0xa6c612,_0x2c2be4,_0x30f432,_0xdd67e6,_0x4ea701,_0x400bbd,_0x307471){return new Promise(function(_0x55e7bb,_0x275f01){var _0x1b5df3={};logger[_0x93ce('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xa6c612,_0x4ea701));return uploadFile(_0x2c2be4,_0x30f432,_0xdd67e6,_0x4ea701,path[_0x93ce('0x6b')](_0x400bbd),fs[_0x93ce('0x6c')](_0x400bbd))[_0x93ce('0x26')](function(_0x44122c){logger[_0x93ce('0x62')](util['format'](_0x93ce('0x6d'),_0xa6c612,_0x4ea701,_0x44122c[_0x93ce('0x6e')]));_0x1b5df3['bucket']=_0x44122c[_0x93ce('0x6f')];_0x1b5df3['location']=_0x44122c[_0x93ce('0x6e')];logger[_0x93ce('0x62')](util[_0x93ce('0x31')](_0x93ce('0x70'),_0xa6c612));return startTranscribe(_0x2c2be4,_0x30f432,_0xdd67e6,uuidv4(),_0x307471,_0x44122c[_0x93ce('0x6e')]);})[_0x93ce('0x26')](function(_0x64b02f){logger[_0x93ce('0x62')](util['format'](_0x93ce('0x71'),_0xa6c612,_0x64b02f[_0x93ce('0x72')][_0x93ce('0x73')]));_0x1b5df3[_0x93ce('0x74')]=_0x64b02f[_0x93ce('0x72')][_0x93ce('0x73')];_0x1b5df3['transcribeStatus']=_0x64b02f['TranscriptionJob'][_0x93ce('0x75')];return _0x55e7bb(_0x1b5df3);})[_0x93ce('0x45')](function(_0x18526a){return _0x275f01(_0x18526a);});});}exports[_0x93ce('0x76')]=function(_0x2f5c46,_0x45e46b,_0x54a71d){var _0x298782;var _0x481ef8;var _0x5d5530;var _0x336f2b=require(_0x93ce('0x4b'));return db[_0x93ce('0x42')]['findOne']({'where':{'id':_0x2f5c46[_0x93ce('0x46')]['id']}})[_0x93ce('0x26')](function(_0xba4186){if(_0xba4186){var _0x111484=util['format'](_0x93ce('0x4e'),_0xba4186[_0x93ce('0x4d')]);if(fs[_0x93ce('0x50')](_0x111484)){cypher=!![];return _0x336f2b[_0x93ce('0x77')](_0x111484,_0xba4186['value'],config[_0x93ce('0x5f')]['recording'])['then'](function(){return _0xba4186;});}return _0xba4186;}})[_0x93ce('0x26')](function(_0x2dda4b){if(!_0x2dda4b){throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))]('Voice\x20Recording\x20not\x20found');}_0x481ef8=_0x2dda4b;return db[_0x93ce('0x78')][_0x93ce('0x79')]({'where':{'id':0x1}});})[_0x93ce('0x26')](handleEntityNotFound(_0x45e46b,null))['then'](function(_0x2257f2){if(_0x2257f2){_0x298782=_0x2257f2;if(!_0x298782[_0x93ce('0x7a')]||!_0x298782[_0x93ce('0x7b')]||!_0x298782['transcribeRegion']||!_0x298782[_0x93ce('0x7c')]||!_0x298782[_0x93ce('0x7d')]){throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))]('Transcribe\x20not\x20configured');}if(_0x2f5c46[_0x93ce('0x49')][_0x93ce('0x7e')]&&(!_0x298782[_0x93ce('0x7f')]||!_0x298782['sentimentAccountId']||!_0x298782[_0x93ce('0x80')]||!_0x298782[_0x93ce('0x7c')]||!_0x298782['bucket'])){throw new db['Sequelize'][(_0x93ce('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x93ce('0x81')]['findOne']({'where':{'id':_0x298782[_0x93ce('0x7b')]}});}})['then'](function(_0x10e7dc){if(!_0x10e7dc){throw new db[(_0x93ce('0x51'))]['ValidationError'](_0x93ce('0x82'));}if(!_0x10e7dc[_0x93ce('0x83')]||!_0x10e7dc['data2']){throw new db['Sequelize'][(_0x93ce('0x52'))](_0x93ce('0x84'));}_0x5d5530=_0x10e7dc;return getBucketslist(_0x5d5530[_0x93ce('0x83')],_0x5d5530['data2'],_0x298782[_0x93ce('0x85')]);})[_0x93ce('0x26')](function(_0xb44026){if(_0xb44026&&_0xb44026[_0x93ce('0x86')]){var _0x3f3483=_[_0x93ce('0x48')](_0xb44026[_0x93ce('0x86')],function(_0x3d91be){return _0x3d91be['Name']===_0x298782[_0x93ce('0x7d')];});if(!_0x3f3483){logger[_0x93ce('0x62')](util[_0x93ce('0x31')](_0x93ce('0x87'),_0x2f5c46[_0x93ce('0x46')]['id'],_0x298782[_0x93ce('0x7d')]));return createBucket(_0x5d5530['data1'],_0x5d5530[_0x93ce('0x88')],_0x298782[_0x93ce('0x85')],_0x298782['bucket']);}logger[_0x93ce('0x62')](util[_0x93ce('0x31')](_0x93ce('0x89'),_0x2f5c46['params']['id'],_0x298782[_0x93ce('0x7d')]));return;}})[_0x93ce('0x26')](function(_0x4a49ab){if(_0x481ef8[_0x93ce('0x8a')]===_0x93ce('0x8b')){return transcribe(_0x2f5c46[_0x93ce('0x46')]['id'],_0x5d5530[_0x93ce('0x83')],_0x5d5530['data2'],_0x298782[_0x93ce('0x85')],_0x298782['bucket'],_0x481ef8[_0x93ce('0x4d')],_0x298782[_0x93ce('0x7c')]);}else{logger[_0x93ce('0x62')](util['format'](_0x93ce('0x8c'),_0x2f5c46[_0x93ce('0x46')]['id']));return{'transcribeStatus':_0x93ce('0x8d')};}})[_0x93ce('0x26')](function(_0x28e015){if(_0x28e015){_0x28e015[_0x93ce('0x8e')]=_0x2f5c46[_0x93ce('0x49')][_0x93ce('0x7e')];return _0x481ef8[_0x93ce('0x8f')](_0x28e015);}})['then'](respondWithResult(_0x45e46b,null))[_0x93ce('0x45')](handleError(_0x45e46b,null));};function writeFile(_0xff7b09,_0x2a3592){return new Promise(function(_0x5d1bf5,_0x214878){fs['writeFile'](_0x2a3592,_0xff7b09,function(_0x18faea,_0x127447){if(_0x18faea){return _0x214878(_0x18faea);}else{return _0x5d1bf5(_0x127447);}});});}exports[_0x93ce('0x90')]=function(_0x46273b,_0x2ceafd,_0x36ef48){return db['VoiceRecording']['findOne']({'where':{'id':_0x46273b['params']['id']}})['then'](handleEntityNotFound(_0x2ceafd))['then'](function(_0x410208){if(_0x410208&&_0x410208[_0x93ce('0x91')]){var _0x1c9c5a=_0x410208[_0x93ce('0x91')];var _0x11a16b=config[_0x93ce('0x92')]+_0x93ce('0x93')+_0x410208['id']+_0x93ce('0x94');if(fs['existsSync'](_0x11a16b)){return _0x11a16b;}return writeFile(_0x1c9c5a,_0x11a16b)[_0x93ce('0x26')](function(){return _0x11a16b;});}else{throw new db[(_0x93ce('0x51'))][(_0x93ce('0x52'))]('Transcript\x20not\x20available');}})['then'](function(_0x4eaa12){return _0x2ceafd['download'](_0x4eaa12);})[_0x93ce('0x45')](handleError(_0x2ceafd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 3dd8414..9227601 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 _0x65c9=['path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x65c9,0x182));var _0x965c=function(_0x2fecb1,_0x352f91){_0x2fecb1=_0x2fecb1-0x0;var _0x3bba7e=_0x65c9[_0x2fecb1];return _0x3bba7e;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('VoiceRecording',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[{'name':_0x965c('0xd'),'fields':[_0x965c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca8=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash'];(function(_0xb63756,_0x4b700f){var _0x48038e=function(_0x2a9ee5){while(--_0x2a9ee5){_0xb63756['push'](_0xb63756['shift']());}};_0x48038e(++_0x4b700f);}(_0x6ca8,0x74));var _0x86ca=function(_0x5f1c98,_0x4c8e8c){_0x5f1c98=_0x5f1c98-0x0;var _0x12ce8a=_0x6ca8[_0x5f1c98];return _0x12ce8a;};'use strict';var _=require(_0x86ca('0x0'));var util=require(_0x86ca('0x1'));var logger=require(_0x86ca('0x2'))(_0x86ca('0x3'));var moment=require(_0x86ca('0x4'));var BPromise=require('bluebird');var rp=require(_0x86ca('0x5'));var fs=require('fs');var path=require(_0x86ca('0x6'));var rimraf=require(_0x86ca('0x7'));var config=require(_0x86ca('0x8'));var attributes=require(_0x86ca('0x9'));module[_0x86ca('0xa')]=function(_0x3ed818,_0x25f654){return _0x3ed818['define']('VoiceRecording',attributes,{'tableName':_0x86ca('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x86ca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 134763c..dfa6519 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x15165e,_0x47648c){var _0x3383e3=function(_0x250cb0){while(--_0x250cb0){_0x15165e['push'](_0x15165e['shift']());}};_0x3383e3(++_0x47648c);}(_0xd943,0x15d));var _0x3d94=function(_0x29d5bc,_0x20bd87){_0x29d5bc=_0x29d5bc-0x0;var _0xee4572=_0xd943[_0x29d5bc];return _0xee4572;};'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});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x5204=['attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','create','callRecordingEncryption','value','format','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where'];(function(_0x41c0ad,_0x2a73a1){var _0x115106=function(_0x1f0f60){while(--_0x1f0f60){_0x41c0ad['push'](_0x41c0ad['shift']());}};_0x115106(++_0x2a73a1);}(_0x5204,0xdf));var _0x4520=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x5204[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e00f4['options']?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'attributes':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')][_0x4520('0x1d')]||null:null,'limit':_0x2e00f4[_0x4520('0x1b')]?_0x2e00f4['options'][_0x4520('0x1e')]||null:null})[_0x4520('0x1f')](function(_0x3b2ede){logger['info'](_0x4520('0x17'),_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x3b2ede));_0x4ba69f(_0x3b2ede);})[_0x4520('0x16')](function(_0x552da1){logger[_0x4520('0x12')](_0x4520('0x17'),_0x552da1[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x552da1['message']));});});};exports[_0x4520('0x20')]=function(_0x4602a4){var _0x92168b=this;return new Promise(function(_0x21e1f3,_0xad9f8){var _0x2c95ea=require(_0x4520('0x21'));var _0x195c58;return db[_0x4520('0x22')][_0x4520('0x23')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x4520('0x1f')](function(_0x5c1a0b){_0x195c58=_0x5c1a0b;return db[_0x4520('0x18')][_0x4520('0x24')](_0x4602a4[_0x4520('0x1a')]);})[_0x4520('0x1f')](function(_0x1da740){if(_0x195c58[_0x4520('0x25')]&&fs['existsSync'](_0x1da740[_0x4520('0x26')])){var _0x508c05=util[_0x4520('0x27')]('%s.cypher',_0x1da740[_0x4520('0x26')]);return _0x2c95ea['encryptFile'](_0x1da740[_0x4520('0x26')],_0x508c05,config['secrets']['recording'])[_0x4520('0x1f')](function(){fs[_0x4520('0x28')](_0x1da740[_0x4520('0x26')]);logger['info'](_0x4520('0x29'));return _0x1da740;});}return _0x1da740;})[_0x4520('0x1f')](function(_0x2acb4e){logger[_0x4520('0xc')]('CreateVoiceRecording',_0x4602a4);logger['debug'](_0x4520('0x20'),_0x4602a4,JSON[_0x4520('0x11')](_0x2acb4e));_0x21e1f3(_0x2acb4e);})['catch'](function(_0x779e94){logger[_0x4520('0x12')](_0x4520('0x20'),_0x779e94[_0x4520('0x14')],_0x4602a4);_0xad9f8(_0x92168b[_0x4520('0x12')](0x1f4,_0x779e94[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 82e056f..25fd7b7 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 _0x72f6=['/describe','isAuthenticated','describe','show','post','create','update','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','get'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x72f6,0x1d3));var _0x672f=function(_0x43c1f7,_0x42bed3){_0x43c1f7=_0x43c1f7-0x0;var _0x2abdb3=_0x72f6[_0x43c1f7];return _0x2abdb3;};'use strict';var multer=require(_0x672f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x672f('0x1'));var express=require(_0x672f('0x2'));var router=express[_0x672f('0x3')]();var fs_extra=require(_0x672f('0x4'));var auth=require(_0x672f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x672f('0x6'));router[_0x672f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x672f('0x7')](_0x672f('0x8'),auth[_0x672f('0x9')](),controller[_0x672f('0xa')]);router['get']('/:id',auth[_0x672f('0x9')](),controller[_0x672f('0xb')]);router[_0x672f('0xc')]('/',auth[_0x672f('0x9')](),controller[_0x672f('0xd')]);router['put']('/:id',auth[_0x672f('0x9')](),controller[_0x672f('0xe')]);router[_0x672f('0xf')](_0x672f('0x10'),auth[_0x672f('0x9')](),controller[_0x672f('0x11')]);module[_0x672f('0x12')]=router; \ No newline at end of file +var _0x1fa3=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x1fa3,0x104));var _0x31fa=function(_0x567f55,_0xd4da7){_0x567f55=_0x567f55-0x0;var _0xc4d4ba=_0x1fa3[_0x567f55];return _0xc4d4ba;};'use strict';var multer=require(_0x31fa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x31fa('0x1'));var express=require(_0x31fa('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x31fa('0x3'));var interaction=require(_0x31fa('0x4'));var config=require(_0x31fa('0x5'));var controller=require(_0x31fa('0x6'));router[_0x31fa('0x7')]('/',auth[_0x31fa('0x8')](),controller[_0x31fa('0x9')]);router[_0x31fa('0x7')](_0x31fa('0xa'),auth[_0x31fa('0x8')](),controller[_0x31fa('0xb')]);router['get'](_0x31fa('0xc'),auth[_0x31fa('0x8')](),controller[_0x31fa('0xd')]);router[_0x31fa('0xe')]('/',auth[_0x31fa('0x8')](),controller[_0x31fa('0xf')]);router[_0x31fa('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x31fa('0x11')]);router['delete'](_0x31fa('0xc'),auth[_0x31fa('0x8')](),controller[_0x31fa('0x12')]);module[_0x31fa('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 fe308f9..b7d8e97 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 _0x9690=['ENUM','attended','STRING','Yes','moment','exports'];(function(_0x134c08,_0x261d68){var _0x49f0a8=function(_0x1eeda6){while(--_0x1eeda6){_0x134c08['push'](_0x134c08['shift']());}};_0x49f0a8(++_0x261d68);}(_0x9690,0xf4));var _0x0969=function(_0x5aecfe,_0x144ad1){_0x5aecfe=_0x5aecfe-0x0;var _0x14e752=_0x9690[_0x5aecfe];return _0x14e752;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0969('0x0'));module[_0x0969('0x1')]={'type':{'type':Sequelize[_0x0969('0x2')]('blind',_0x0969('0x3'))},'result':{'type':Sequelize[_0x0969('0x4')]},'transfererchannel':{'type':Sequelize[_0x0969('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0969('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0969('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x0969('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x0969('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x0969('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x0969('0x4')]},'transfereechannel':{'type':Sequelize[_0x0969('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0969('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0969('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0969('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x0969('0x4')]},'transfereecontext':{'type':Sequelize[_0x0969('0x4')]},'transfereeexten':{'type':Sequelize[_0x0969('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x0969('0x2')](_0x0969('0x5'),'No')},'context':{'type':Sequelize[_0x0969('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3cc7=['exports','ENUM','attended','STRING','Yes','sequelize','moment'];(function(_0x4ee6e0,_0x42c6a0){var _0x503f25=function(_0x1f7734){while(--_0x1f7734){_0x4ee6e0['push'](_0x4ee6e0['shift']());}};_0x503f25(++_0x42c6a0);}(_0x3cc7,0x116));var _0x73cc=function(_0x16bb0e,_0x343132){_0x16bb0e=_0x16bb0e-0x0;var _0x102b8b=_0x3cc7[_0x16bb0e];return _0x102b8b;};'use strict';var Sequelize=require(_0x73cc('0x0'));var moment=require(_0x73cc('0x1'));module[_0x73cc('0x2')]={'type':{'type':Sequelize[_0x73cc('0x3')]('blind',_0x73cc('0x4'))},'result':{'type':Sequelize[_0x73cc('0x5')]},'transfererchannel':{'type':Sequelize[_0x73cc('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x73cc('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x73cc('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x73cc('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x73cc('0x5')]},'transferercontext':{'type':Sequelize[_0x73cc('0x5')]},'transfererexten':{'type':Sequelize[_0x73cc('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x73cc('0x5')]},'transfereechannel':{'type':Sequelize[_0x73cc('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x73cc('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x73cc('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x73cc('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x73cc('0x5')]},'isexternal':{'type':Sequelize[_0x73cc('0x3')](_0x73cc('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x73cc('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e0fe38f..645a230 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 _0xe3e2=['end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x3110fc,_0x4a1764){var _0x515a02=function(_0x4715b5){while(--_0x4715b5){_0x3110fc['push'](_0x3110fc['shift']());}};_0x515a02(++_0x4a1764);}(_0xe3e2,0x78));var _0x2e3e=function(_0x55ca53,_0x2e6c54){_0x55ca53=_0x55ca53-0x0;var _0x3c504b=_0xe3e2[_0x55ca53];return _0x3c504b;};'use strict';var emlformat=require(_0x2e3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e3e('0x1'));var jsonpatch=require(_0x2e3e('0x2'));var rp=require(_0x2e3e('0x3'));var moment=require(_0x2e3e('0x4'));var BPromise=require(_0x2e3e('0x5'));var Mustache=require(_0x2e3e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2e3e('0x7'));var csv=require(_0x2e3e('0x8'));var ejs=require(_0x2e3e('0x9'));var fs=require('fs');var fs_extra=require(_0x2e3e('0xa'));var _=require(_0x2e3e('0xb'));var squel=require(_0x2e3e('0xc'));var crypto=require(_0x2e3e('0xd'));var jsforce=require(_0x2e3e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2e3e('0x8'));var querystring=require(_0x2e3e('0xf'));var Papa=require('papaparse');var Redis=require(_0x2e3e('0x10'));var authService=require(_0x2e3e('0x11'));var qs=require(_0x2e3e('0x12'));var as=require(_0x2e3e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e3e('0x14'))(_0x2e3e('0x15'));var utils=require('../../config/utils');var config=require(_0x2e3e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e3e('0x17'))['db'];function respondWithStatusCode(_0xe10dc5,_0x215cec){_0x215cec=_0x215cec||0xcc;return function(_0x2ed274){if(_0x2ed274){return _0xe10dc5[_0x2e3e('0x18')](_0x215cec);}return _0xe10dc5[_0x2e3e('0x19')](_0x215cec)[_0x2e3e('0x1a')]();};}function respondWithResult(_0xaf4c54,_0x473f2e){_0x473f2e=_0x473f2e||0xc8;return function(_0x56ee14){if(_0x56ee14){return _0xaf4c54[_0x2e3e('0x19')](_0x473f2e)['json'](_0x56ee14);}};}function respondWithFilteredResult(_0x5941ad,_0x5b276f){return function(_0x139dbc){if(_0x139dbc){var _0x37b749=typeof _0x5b276f[_0x2e3e('0x1b')]==='undefined'&&typeof _0x5b276f[_0x2e3e('0x1c')]==='undefined';var _0x10af51=_0x139dbc['count'];var _0x4393ba=_0x37b749?0x0:_0x5b276f['offset'];var _0x26e64d=_0x37b749?_0x139dbc[_0x2e3e('0x1d')]:_0x5b276f['offset']+_0x5b276f[_0x2e3e('0x1c')];var _0x5a11f9;if(_0x26e64d>=_0x10af51){_0x26e64d=_0x10af51;_0x5a11f9=0xc8;}else{_0x5a11f9=0xce;}_0x5941ad[_0x2e3e('0x19')](_0x5a11f9);return _0x5941ad[_0x2e3e('0x1e')](_0x2e3e('0x1f'),_0x4393ba+'-'+_0x26e64d+'/'+_0x10af51)[_0x2e3e('0x20')](_0x139dbc);}return null;};}function patchUpdates(_0x21435e){return function(_0x379856){try{jsonpatch[_0x2e3e('0x21')](_0x379856,_0x21435e,!![]);}catch(_0xde300c){return BPromise[_0x2e3e('0x22')](_0xde300c);}return _0x379856[_0x2e3e('0x23')]();};}function saveUpdates(_0x68afab,_0x26fa11){return function(_0x49b8a5){if(_0x49b8a5){return _0x49b8a5[_0x2e3e('0x24')](_0x68afab)['then'](function(_0x221e2a){return _0x221e2a;});}return null;};}function removeEntity(_0x5b2174,_0xb43f9b){return function(_0x6e18b){if(_0x6e18b){return _0x6e18b['destroy']()[_0x2e3e('0x25')](function(){_0x5b2174[_0x2e3e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49abca,_0x7d19ab){return function(_0x103867){if(!_0x103867){_0x49abca[_0x2e3e('0x18')](0x194);}return _0x103867;};}function handleError(_0x104ba0,_0x1fb164){_0x1fb164=_0x1fb164||0x1f4;return function(_0xb07477){logger[_0x2e3e('0x26')](_0xb07477[_0x2e3e('0x27')]);if(_0xb07477[_0x2e3e('0x28')]){delete _0xb07477['name'];}_0x104ba0[_0x2e3e('0x19')](_0x1fb164)[_0x2e3e('0x29')](_0xb07477);};}exports['index']=function(_0x19d5e7,_0x152437){var _0x26daf5={},_0x4aeaa1={},_0x56ad5e={'count':0x0,'rows':[]};var _0x9e222b=_[_0x2e3e('0x2a')](db[_0x2e3e('0x2b')][_0x2e3e('0x2c')],function(_0x4bb111){return{'name':_0x4bb111[_0x2e3e('0x2d')],'type':_0x4bb111[_0x2e3e('0x2e')]['key']};});_0x4aeaa1[_0x2e3e('0x2f')]=_[_0x2e3e('0x2a')](_0x9e222b,_0x2e3e('0x28'));_0x4aeaa1[_0x2e3e('0x30')]=_[_0x2e3e('0x31')](_0x19d5e7[_0x2e3e('0x30')]);_0x4aeaa1[_0x2e3e('0x32')]=_[_0x2e3e('0x33')](_0x4aeaa1[_0x2e3e('0x2f')],_0x4aeaa1[_0x2e3e('0x30')]);_0x26daf5[_0x2e3e('0x34')]=_[_0x2e3e('0x33')](_0x4aeaa1[_0x2e3e('0x2f')],qs['fields'](_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x35')]));_0x26daf5['attributes']=_0x26daf5[_0x2e3e('0x34')]['length']?_0x26daf5[_0x2e3e('0x34')]:_0x4aeaa1[_0x2e3e('0x2f')];if(!_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x36')](_0x2e3e('0x37'))){_0x26daf5[_0x2e3e('0x1c')]=qs[_0x2e3e('0x1c')](_0x19d5e7[_0x2e3e('0x30')]['limit']);_0x26daf5[_0x2e3e('0x1b')]=qs['offset'](_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x1b')]);}_0x26daf5['order']=qs[_0x2e3e('0x38')](_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x38')]);_0x26daf5['where']=qs[_0x2e3e('0x32')](_['pick'](_0x19d5e7[_0x2e3e('0x30')],_0x4aeaa1[_0x2e3e('0x32')]),_0x9e222b);if(_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x39')]){_0x26daf5['where']=_[_0x2e3e('0x3a')](_0x26daf5[_0x2e3e('0x3b')],{'$or':_[_0x2e3e('0x2a')](_0x9e222b,function(_0x5dc04d){if(_0x5dc04d[_0x2e3e('0x2e')]!==_0x2e3e('0x3c')){var _0x8f1c6f={};_0x8f1c6f[_0x5dc04d[_0x2e3e('0x28')]]={'$like':'%'+_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x39')]+'%'};return _0x8f1c6f;}})});}_0x26daf5=_['merge']({},_0x26daf5,_0x19d5e7['options']);var _0x3ea372={'where':_0x26daf5[_0x2e3e('0x3b')]};return db[_0x2e3e('0x2b')]['count'](_0x3ea372)[_0x2e3e('0x25')](function(_0x3f1ac6){_0x56ad5e['count']=_0x3f1ac6;if(_0x19d5e7[_0x2e3e('0x30')][_0x2e3e('0x3d')]){_0x26daf5[_0x2e3e('0x3e')]=[{'all':!![]}];}return db[_0x2e3e('0x2b')][_0x2e3e('0x3f')](_0x26daf5);})[_0x2e3e('0x25')](function(_0x580300){_0x56ad5e[_0x2e3e('0x40')]=_0x580300;return _0x56ad5e;})['then'](respondWithFilteredResult(_0x152437,_0x26daf5))[_0x2e3e('0x41')](handleError(_0x152437,null));};exports[_0x2e3e('0x42')]=function(_0xaa9a38,_0x1493b4){var _0x7c68d0={'raw':!![],'where':{'id':_0xaa9a38[_0x2e3e('0x43')]['id']}},_0x245e8b={};_0x245e8b['model']=_[_0x2e3e('0x31')](db['VoiceTransferReport'][_0x2e3e('0x2c')]);_0x245e8b[_0x2e3e('0x30')]=_[_0x2e3e('0x31')](_0xaa9a38['query']);_0x245e8b[_0x2e3e('0x32')]=_[_0x2e3e('0x33')](_0x245e8b['model'],_0x245e8b['query']);_0x7c68d0[_0x2e3e('0x34')]=_[_0x2e3e('0x33')](_0x245e8b[_0x2e3e('0x2f')],qs[_0x2e3e('0x35')](_0xaa9a38[_0x2e3e('0x30')]['fields']));_0x7c68d0['attributes']=_0x7c68d0['attributes']['length']?_0x7c68d0[_0x2e3e('0x34')]:_0x245e8b[_0x2e3e('0x2f')];if(_0xaa9a38['query'][_0x2e3e('0x3d')]){_0x7c68d0[_0x2e3e('0x3e')]=[{'all':!![]}];}_0x7c68d0=_[_0x2e3e('0x3a')]({},_0x7c68d0,_0xaa9a38['options']);return db[_0x2e3e('0x2b')][_0x2e3e('0x44')](_0x7c68d0)[_0x2e3e('0x25')](handleEntityNotFound(_0x1493b4,null))[_0x2e3e('0x25')](respondWithResult(_0x1493b4,null))[_0x2e3e('0x41')](handleError(_0x1493b4,null));};exports[_0x2e3e('0x45')]=function(_0x491f30,_0x4bb4e5){return db['VoiceTransferReport']['create'](_0x491f30['body'],{})[_0x2e3e('0x25')](respondWithResult(_0x4bb4e5,0xc9))[_0x2e3e('0x41')](handleError(_0x4bb4e5,null));};exports[_0x2e3e('0x24')]=function(_0x521088,_0x5a8dc9){if(_0x521088[_0x2e3e('0x46')]['id']){delete _0x521088[_0x2e3e('0x46')]['id'];}return db['VoiceTransferReport'][_0x2e3e('0x44')]({'where':{'id':_0x521088[_0x2e3e('0x43')]['id']}})[_0x2e3e('0x25')](handleEntityNotFound(_0x5a8dc9,null))[_0x2e3e('0x25')](saveUpdates(_0x521088['body'],null))[_0x2e3e('0x25')](respondWithResult(_0x5a8dc9,null))[_0x2e3e('0x41')](handleError(_0x5a8dc9,null));};exports[_0x2e3e('0x47')]=function(_0x1bb822,_0x2196f5){return db[_0x2e3e('0x2b')]['find']({'where':{'id':_0x1bb822['params']['id']}})[_0x2e3e('0x25')](handleEntityNotFound(_0x2196f5,null))['then'](removeEntity(_0x2196f5,null))[_0x2e3e('0x41')](handleError(_0x2196f5,null));};exports[_0x2e3e('0x48')]=function(_0x169419,_0x28c069){return db['VoiceTransferReport'][_0x2e3e('0x48')]()['then'](respondWithResult(_0x28c069,null))['catch'](handleError(_0x28c069,null));}; \ No newline at end of file +var _0x0199=['destroy','error','stack','name','map','VoiceTransferReport','rawAttributes','key','model','keys','query','attributes','intersection','fields','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x0199,0xfa));var _0x9019=function(_0x4f9124,_0x441308){_0x4f9124=_0x4f9124-0x0;var _0x590c70=_0x0199[_0x4f9124];return _0x590c70;};'use strict';var emlformat=require(_0x9019('0x0'));var rimraf=require(_0x9019('0x1'));var zipdir=require(_0x9019('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9019('0x3'));var Mustache=require(_0x9019('0x4'));var util=require(_0x9019('0x5'));var path=require(_0x9019('0x6'));var sox=require(_0x9019('0x7'));var csv=require(_0x9019('0x8'));var ejs=require(_0x9019('0x9'));var fs=require('fs');var fs_extra=require(_0x9019('0xa'));var _=require(_0x9019('0xb'));var squel=require(_0x9019('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9019('0xd'));var toCsv=require(_0x9019('0x8'));var querystring=require(_0x9019('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9019('0xf'));var qs=require(_0x9019('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9019('0x11'));var logger=require(_0x9019('0x12'))(_0x9019('0x13'));var utils=require(_0x9019('0x14'));var config=require(_0x9019('0x15'));var licenseUtil=require(_0x9019('0x16'));var db=require(_0x9019('0x17'))['db'];function respondWithStatusCode(_0x592f6b,_0x88030e){_0x88030e=_0x88030e||0xcc;return function(_0x1d9582){if(_0x1d9582){return _0x592f6b[_0x9019('0x18')](_0x88030e);}return _0x592f6b[_0x9019('0x19')](_0x88030e)[_0x9019('0x1a')]();};}function respondWithResult(_0xdf3ee2,_0x27327e){_0x27327e=_0x27327e||0xc8;return function(_0x20307c){if(_0x20307c){return _0xdf3ee2[_0x9019('0x19')](_0x27327e)[_0x9019('0x1b')](_0x20307c);}};}function respondWithFilteredResult(_0x44d1ce,_0xbc05cb){return function(_0x23f386){if(_0x23f386){var _0x57dbc6=typeof _0xbc05cb['offset']===_0x9019('0x1c')&&typeof _0xbc05cb[_0x9019('0x1d')]===_0x9019('0x1c');var _0x3a6884=_0x23f386[_0x9019('0x1e')];var _0x2247aa=_0x57dbc6?0x0:_0xbc05cb[_0x9019('0x1f')];var _0xec98c3=_0x57dbc6?_0x23f386[_0x9019('0x1e')]:_0xbc05cb['offset']+_0xbc05cb['limit'];var _0xa786b8;if(_0xec98c3>=_0x3a6884){_0xec98c3=_0x3a6884;_0xa786b8=0xc8;}else{_0xa786b8=0xce;}_0x44d1ce['status'](_0xa786b8);return _0x44d1ce[_0x9019('0x20')](_0x9019('0x21'),_0x2247aa+'-'+_0xec98c3+'/'+_0x3a6884)[_0x9019('0x1b')](_0x23f386);}return null;};}function patchUpdates(_0x136319){return function(_0x3909aa){try{jsonpatch['apply'](_0x3909aa,_0x136319,!![]);}catch(_0x21394b){return BPromise[_0x9019('0x22')](_0x21394b);}return _0x3909aa[_0x9019('0x23')]();};}function saveUpdates(_0x3176ea,_0x3f37e7){return function(_0x2c15cb){if(_0x2c15cb){return _0x2c15cb[_0x9019('0x24')](_0x3176ea)[_0x9019('0x25')](function(_0x1278bb){return _0x1278bb;});}return null;};}function removeEntity(_0x31ca33,_0xadc8c6){return function(_0xad81a3){if(_0xad81a3){return _0xad81a3[_0x9019('0x26')]()[_0x9019('0x25')](function(){_0x31ca33[_0x9019('0x19')](0xcc)[_0x9019('0x1a')]();});}};}function handleEntityNotFound(_0x4b63cc,_0x476911){return function(_0x7fb8c8){if(!_0x7fb8c8){_0x4b63cc['sendStatus'](0x194);}return _0x7fb8c8;};}function handleError(_0x49d1d6,_0x9558cf){_0x9558cf=_0x9558cf||0x1f4;return function(_0x534b12){logger[_0x9019('0x27')](_0x534b12[_0x9019('0x28')]);if(_0x534b12[_0x9019('0x29')]){delete _0x534b12[_0x9019('0x29')];}_0x49d1d6[_0x9019('0x19')](_0x9558cf)['send'](_0x534b12);};}exports['index']=function(_0x2c50d5,_0x326b90){var _0x2b190b={},_0x80f152={},_0xbc8cdb={'count':0x0,'rows':[]};var _0x23e338=_[_0x9019('0x2a')](db[_0x9019('0x2b')][_0x9019('0x2c')],function(_0x1cc76c){return{'name':_0x1cc76c['fieldName'],'type':_0x1cc76c['type'][_0x9019('0x2d')]};});_0x80f152[_0x9019('0x2e')]=_[_0x9019('0x2a')](_0x23e338,_0x9019('0x29'));_0x80f152['query']=_[_0x9019('0x2f')](_0x2c50d5['query']);_0x80f152['filters']=_['intersection'](_0x80f152[_0x9019('0x2e')],_0x80f152[_0x9019('0x30')]);_0x2b190b[_0x9019('0x31')]=_[_0x9019('0x32')](_0x80f152[_0x9019('0x2e')],qs[_0x9019('0x33')](_0x2c50d5[_0x9019('0x30')]['fields']));_0x2b190b[_0x9019('0x31')]=_0x2b190b[_0x9019('0x31')]['length']?_0x2b190b['attributes']:_0x80f152[_0x9019('0x2e')];if(!_0x2c50d5[_0x9019('0x30')]['hasOwnProperty']('nolimit')){_0x2b190b[_0x9019('0x1d')]=qs[_0x9019('0x1d')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x1d')]);_0x2b190b[_0x9019('0x1f')]=qs[_0x9019('0x1f')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x1f')]);}_0x2b190b['order']=qs[_0x9019('0x34')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x34')]);_0x2b190b[_0x9019('0x35')]=qs[_0x9019('0x36')](_['pick'](_0x2c50d5[_0x9019('0x30')],_0x80f152['filters']),_0x23e338);if(_0x2c50d5['query'][_0x9019('0x37')]){_0x2b190b[_0x9019('0x35')]=_[_0x9019('0x38')](_0x2b190b[_0x9019('0x35')],{'$or':_[_0x9019('0x2a')](_0x23e338,function(_0x2d1d44){if(_0x2d1d44[_0x9019('0x39')]!==_0x9019('0x3a')){var _0x519055={};_0x519055[_0x2d1d44[_0x9019('0x29')]]={'$like':'%'+_0x2c50d5[_0x9019('0x30')][_0x9019('0x37')]+'%'};return _0x519055;}})});}_0x2b190b=_[_0x9019('0x38')]({},_0x2b190b,_0x2c50d5[_0x9019('0x3b')]);var _0x5a3b2d={'where':_0x2b190b[_0x9019('0x35')]};return db[_0x9019('0x2b')][_0x9019('0x1e')](_0x5a3b2d)['then'](function(_0x518fb9){_0xbc8cdb[_0x9019('0x1e')]=_0x518fb9;if(_0x2c50d5[_0x9019('0x30')][_0x9019('0x3c')]){_0x2b190b['include']=[{'all':!![]}];}return db[_0x9019('0x2b')][_0x9019('0x3d')](_0x2b190b);})[_0x9019('0x25')](function(_0xd6cb88){_0xbc8cdb[_0x9019('0x3e')]=_0xd6cb88;return _0xbc8cdb;})[_0x9019('0x25')](respondWithFilteredResult(_0x326b90,_0x2b190b))[_0x9019('0x3f')](handleError(_0x326b90,null));};exports[_0x9019('0x40')]=function(_0x5e24fa,_0x3f9ff1){var _0x52a10e={'raw':!![],'where':{'id':_0x5e24fa[_0x9019('0x41')]['id']}},_0x5c789b={};_0x5c789b[_0x9019('0x2e')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x5c789b['query']=_[_0x9019('0x2f')](_0x5e24fa['query']);_0x5c789b['filters']=_[_0x9019('0x32')](_0x5c789b[_0x9019('0x2e')],_0x5c789b[_0x9019('0x30')]);_0x52a10e['attributes']=_[_0x9019('0x32')](_0x5c789b['model'],qs['fields'](_0x5e24fa['query'][_0x9019('0x33')]));_0x52a10e[_0x9019('0x31')]=_0x52a10e[_0x9019('0x31')][_0x9019('0x42')]?_0x52a10e['attributes']:_0x5c789b['model'];if(_0x5e24fa[_0x9019('0x30')]['includeAll']){_0x52a10e[_0x9019('0x43')]=[{'all':!![]}];}_0x52a10e=_[_0x9019('0x38')]({},_0x52a10e,_0x5e24fa[_0x9019('0x3b')]);return db[_0x9019('0x2b')][_0x9019('0x44')](_0x52a10e)[_0x9019('0x25')](handleEntityNotFound(_0x3f9ff1,null))['then'](respondWithResult(_0x3f9ff1,null))[_0x9019('0x3f')](handleError(_0x3f9ff1,null));};exports[_0x9019('0x45')]=function(_0x302121,_0x5c51a5){return db[_0x9019('0x2b')][_0x9019('0x45')](_0x302121['body'],{})['then'](respondWithResult(_0x5c51a5,0xc9))[_0x9019('0x3f')](handleError(_0x5c51a5,null));};exports[_0x9019('0x24')]=function(_0x24d547,_0x1d2080){if(_0x24d547['body']['id']){delete _0x24d547[_0x9019('0x46')]['id'];}return db[_0x9019('0x2b')][_0x9019('0x44')]({'where':{'id':_0x24d547[_0x9019('0x41')]['id']}})[_0x9019('0x25')](handleEntityNotFound(_0x1d2080,null))[_0x9019('0x25')](saveUpdates(_0x24d547[_0x9019('0x46')],null))[_0x9019('0x25')](respondWithResult(_0x1d2080,null))[_0x9019('0x3f')](handleError(_0x1d2080,null));};exports[_0x9019('0x26')]=function(_0x255029,_0x2610b9){return db[_0x9019('0x2b')]['find']({'where':{'id':_0x255029[_0x9019('0x41')]['id']}})['then'](handleEntityNotFound(_0x2610b9,null))[_0x9019('0x25')](removeEntity(_0x2610b9,null))[_0x9019('0x3f')](handleError(_0x2610b9,null));};exports[_0x9019('0x47')]=function(_0x1cc0e7,_0x1e77e6){return db['VoiceTransferReport']['describe']()[_0x9019('0x25')](respondWithResult(_0x1e77e6,null))[_0x9019('0x3f')](handleError(_0x1e77e6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 66a911f..fe3e76d 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 _0x9eea=['api','moment','bluebird','rimraf','../../config/environment','./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger'];(function(_0x163555,_0x27ce78){var _0x250307=function(_0x27c529){while(--_0x27c529){_0x163555['push'](_0x163555['shift']());}};_0x250307(++_0x27ce78);}(_0x9eea,0xce));var _0xa9ee=function(_0x2e1cc4,_0x5e93f6){_0x2e1cc4=_0x2e1cc4-0x0;var _0x50be05=_0x9eea[_0x2e1cc4];return _0x50be05;};'use strict';var _=require(_0xa9ee('0x0'));var util=require(_0xa9ee('0x1'));var logger=require(_0xa9ee('0x2'))(_0xa9ee('0x3'));var moment=require(_0xa9ee('0x4'));var BPromise=require(_0xa9ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa9ee('0x6'));var config=require(_0xa9ee('0x7'));var attributes=require(_0xa9ee('0x8'));module['exports']=function(_0x5284dc,_0x49c70b){return _0x5284dc[_0xa9ee('0x9')]('VoiceTransferReport',attributes,{'tableName':_0xa9ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc166=['./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc166,0x79));var _0x6c16=function(_0x178b0c,_0x41198b){_0x178b0c=_0x178b0c-0x0;var _0x4da8be=_0xc166[_0x178b0c];return _0x4da8be;};'use strict';var _=require(_0x6c16('0x0'));var util=require('util');var logger=require(_0x6c16('0x1'))(_0x6c16('0x2'));var moment=require(_0x6c16('0x3'));var BPromise=require(_0x6c16('0x4'));var rp=require(_0x6c16('0x5'));var fs=require('fs');var path=require(_0x6c16('0x6'));var rimraf=require(_0x6c16('0x7'));var config=require(_0x6c16('0x8'));var attributes=require(_0x6c16('0x9'));module[_0x6c16('0xa')]=function(_0x59441c,_0x50258a){return _0x59441c['define'](_0x6c16('0xb'),attributes,{'tableName':_0x6c16('0xc'),'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 f172f7e..533105b 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 _0xfc4d=['then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x149c82,_0x2af07a){var _0x385d7c=function(_0xe1fe16){while(--_0xe1fe16){_0x149c82['push'](_0x149c82['shift']());}};_0x385d7c(++_0x2af07a);}(_0xfc4d,0xcd));var _0xdfc4=function(_0x4e62ca,_0xe85442){_0x4e62ca=_0x4e62ca-0x0;var _0x16007a=_0xfc4d[_0x4e62ca];return _0x16007a;};'use strict';var _=require(_0xdfc4('0x0'));var util=require(_0xdfc4('0x1'));var moment=require('moment');var BPromise=require(_0xdfc4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfc4('0x3'));var db=require(_0xdfc4('0x4'))['db'];var utils=require(_0xdfc4('0x5'));var logger=require(_0xdfc4('0x6'))(_0xdfc4('0x7'));var config=require('../../config/environment');var jayson=require(_0xdfc4('0x8'));var client=jayson[_0xdfc4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184994,_0x15504a,_0x202143){return new BPromise(function(_0x54b2b7,_0x5d89e1){return client[_0xdfc4('0xa')](_0x184994,_0x202143)[_0xdfc4('0xb')](function(_0xc40395){logger[_0xdfc4('0xc')](_0xdfc4('0xd'),_0x15504a,_0xdfc4('0xe'));logger[_0xdfc4('0xf')](_0xdfc4('0x10'),_0x15504a,_0xdfc4('0xe'),JSON[_0xdfc4('0x11')](_0xc40395));if(_0xc40395[_0xdfc4('0x12')]){if(_0xc40395['error'][_0xdfc4('0x13')]===0x1f4){logger[_0xdfc4('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x15504a,_0xc40395[_0xdfc4('0x12')][_0xdfc4('0x14')]);return _0x5d89e1(_0xc40395['error'][_0xdfc4('0x14')]);}logger[_0xdfc4('0x12')](_0xdfc4('0xd'),_0x15504a,_0xc40395['error'][_0xdfc4('0x14')]);return _0x54b2b7(_0xc40395[_0xdfc4('0x12')][_0xdfc4('0x14')]);}else{logger[_0xdfc4('0xc')](_0xdfc4('0xd'),_0x15504a,_0xdfc4('0xe'));_0x54b2b7(_0xc40395[_0xdfc4('0x15')]['message']);}})[_0xdfc4('0x16')](function(_0xea501e){logger[_0xdfc4('0x12')](_0xdfc4('0xd'),_0x15504a,_0xea501e);_0x5d89e1(_0xea501e);});});}exports[_0xdfc4('0x17')]=function(_0x567827){var _0x115e50=this;return new Promise(function(_0x1f03ca,_0x1fada9){return db['VoiceTransferReport']['create'](_0x567827[_0xdfc4('0x18')],{'raw':_0x567827[_0xdfc4('0x19')]?_0x567827[_0xdfc4('0x19')][_0xdfc4('0x1a')]===undefined?!![]:![]:!![]})[_0xdfc4('0xb')](function(_0x2e5a67){logger[_0xdfc4('0xc')](_0xdfc4('0x17'),_0x567827);logger['debug'](_0xdfc4('0x17'),_0x567827,JSON['stringify'](_0x2e5a67));_0x1f03ca(_0x2e5a67);})[_0xdfc4('0x16')](function(_0x1bc1a8){logger[_0xdfc4('0x12')](_0xdfc4('0x17'),_0x1bc1a8[_0xdfc4('0x14')],_0x567827);_0x1fada9(_0x115e50[_0xdfc4('0x12')](0x1f4,_0x1bc1a8[_0xdfc4('0x14')]));});});}; \ No newline at end of file +var _0x8fca=['CreateVoiceTransferReport','VoiceTransferReport','create','body','options','info','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x21a6a5,_0x50a8bf){var _0x184c01=function(_0x874098){while(--_0x874098){_0x21a6a5['push'](_0x21a6a5['shift']());}};_0x184c01(++_0x50a8bf);}(_0x8fca,0x180));var _0xa8fc=function(_0x58716a,_0x2ed9b2){_0x58716a=_0x58716a-0x0;var _0x57ae5d=_0x8fca[_0x58716a];return _0x57ae5d;};'use strict';var _=require('lodash');var util=require(_0xa8fc('0x0'));var moment=require(_0xa8fc('0x1'));var BPromise=require('bluebird');var rs=require(_0xa8fc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8fc('0x3'))['db'];var utils=require(_0xa8fc('0x4'));var logger=require(_0xa8fc('0x5'))(_0xa8fc('0x6'));var config=require(_0xa8fc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8fc('0x8')][_0xa8fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x167764,_0x2ebbb9,_0x273c7e){return new BPromise(function(_0x1e9817,_0x5723dc){return client[_0xa8fc('0xa')](_0x167764,_0x273c7e)[_0xa8fc('0xb')](function(_0x4bac11){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2ebbb9,_0xa8fc('0xc'));logger[_0xa8fc('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2ebbb9,_0xa8fc('0xc'),JSON[_0xa8fc('0xe')](_0x4bac11));if(_0x4bac11['error']){if(_0x4bac11[_0xa8fc('0xf')][_0xa8fc('0x10')]===0x1f4){logger[_0xa8fc('0xf')](_0xa8fc('0x11'),_0x2ebbb9,_0x4bac11['error'][_0xa8fc('0x12')]);return _0x5723dc(_0x4bac11[_0xa8fc('0xf')]['message']);}logger[_0xa8fc('0xf')](_0xa8fc('0x11'),_0x2ebbb9,_0x4bac11[_0xa8fc('0xf')][_0xa8fc('0x12')]);return _0x1e9817(_0x4bac11[_0xa8fc('0xf')][_0xa8fc('0x12')]);}else{logger['info'](_0xa8fc('0x11'),_0x2ebbb9,'request\x20sent');_0x1e9817(_0x4bac11[_0xa8fc('0x13')][_0xa8fc('0x12')]);}})[_0xa8fc('0x14')](function(_0x564a7b){logger[_0xa8fc('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x2ebbb9,_0x564a7b);_0x5723dc(_0x564a7b);});});}exports[_0xa8fc('0x15')]=function(_0x5300ba){var _0x11795e=this;return new Promise(function(_0xba5fb1,_0x2615a1){return db[_0xa8fc('0x16')][_0xa8fc('0x17')](_0x5300ba[_0xa8fc('0x18')],{'raw':_0x5300ba[_0xa8fc('0x19')]?_0x5300ba[_0xa8fc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa8fc('0xb')](function(_0x54baf6){logger[_0xa8fc('0x1a')](_0xa8fc('0x15'),_0x5300ba);logger['debug'](_0xa8fc('0x15'),_0x5300ba,JSON[_0xa8fc('0xe')](_0x54baf6));_0xba5fb1(_0x54baf6);})[_0xa8fc('0x14')](function(_0x2a6c49){logger[_0xa8fc('0xf')](_0xa8fc('0x15'),_0x2a6c49['message'],_0x5300ba);_0x2615a1(_0x11795e[_0xa8fc('0xf')](0x1f4,_0x2a6c49[_0xa8fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index eb11aaf..88bf575 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 _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x1a7536,_0x30c791){var _0x4660d9=function(_0x1db222){while(--_0x1db222){_0x1a7536['push'](_0x1a7536['shift']());}};_0x4660d9(++_0x30c791);}(_0x91a7,0xe7));var _0x791a=function(_0xb812ef,_0xc79be){_0xb812ef=_0xb812ef-0x0;var _0x49db88=_0x91a7[_0xb812ef];return _0x49db88;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0x6f0d=['isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','unhold','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x275699,_0x3531e7){var _0x55708f=function(_0x170fb4){while(--_0x170fb4){_0x275699['push'](_0x275699['shift']());}};_0x55708f(++_0x3531e7);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x20b8d,_0x471e78){_0x20b8d=_0x20b8d-0x0;var _0x44b833=_0x6f0d[_0x20b8d];return _0x44b833;};'use strict';var express=require('express');var router=express[_0xd6f0('0x0')]();var auth=require(_0xd6f0('0x1'));var controller=require(_0xd6f0('0x2'));router[_0xd6f0('0x3')]('/originate',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0x6')]);router[_0xd6f0('0x3')](_0xd6f0('0x7'),auth['isAuthenticated'](),auth[_0xd6f0('0x5')](),controller['hangup']);router[_0xd6f0('0x3')](_0xd6f0('0x8'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller['answer']);router['post'](_0xd6f0('0x9'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xa')]);router[_0xd6f0('0x3')]('/unhold',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xb')]);router[_0xd6f0('0x3')]('/calls',auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xc')]);router[_0xd6f0('0x3')](_0xd6f0('0xd'),auth[_0xd6f0('0x4')](),auth[_0xd6f0('0x5')](),controller[_0xd6f0('0xe')]);module[_0xd6f0('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index edbb445..3b43834 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 _0x303a=['answer','answer\x20fired:','webbar:answer','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','transferNumber','path','../../mysqldb','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','log','error','name','status','NotFound','then','code','message','findOne','agent','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callerId','callbackUrl','entityFound:','format','webbar:originate','catch','hangup','user:%s','webbar:hangup'];(function(_0x18c65e,_0x5ac557){var _0x29f202=function(_0x3ec15a){while(--_0x3ec15a){_0x18c65e['push'](_0x18c65e['shift']());}};_0x29f202(++_0x5ac557);}(_0x303a,0x1a0));var _0xa303=function(_0x9733df,_0x450c75){_0x9733df=_0x9733df-0x0;var _0x1abfad=_0x303a[_0x9733df];return _0x1abfad;};'use strict';var path=require(_0xa303('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xa303('0x1'))['db'];var config=require(_0xa303('0x2'));var util=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa303('0x5')][_0xa303('0x6')]({'port':0x232a});var logger=require(_0xa303('0x7'))(_0xa303('0x8'));var Redis=require(_0xa303('0x9'));config[_0xa303('0xa')]=_[_0xa303('0xb')](config[_0xa303('0xa')],{'host':_0xa303('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'callNumber':{'type':'string','required':[!![],_0xa303('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xa303('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa303('0x10'),'required':[!![],_0xa303('0x11')]},'transferNumber':{'type':_0xa303('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]},'sessionId':{'type':_0xa303('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa303('0xd'),'required':[!![],_0xa303('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa303('0xe')]}});function emit(_0xd2e8ee,_0x1f3ede,_0x288596){logger[_0xa303('0x12')](_0xd2e8ee,_0x1f3ede,JSON[_0xa303('0x13')](_0x288596));io['to'](_0xd2e8ee)['emit'](_0x1f3ede,_0x288596);}function handleError(_0x28c164){return function(_0x54ca49){console[_0xa303('0x14')]('handleError:',_0x54ca49,_0x54ca49 instanceof RangeError);logger[_0xa303('0x15')](_0x54ca49['stack']);if(_0x54ca49 instanceof RangeError){if(_0x54ca49[_0xa303('0x16')]){delete _0x54ca49[_0xa303('0x16')];}_0x28c164[_0xa303('0x17')](0x194)['send'](_0x54ca49);}else{if(_0x54ca49[_0xa303('0x16')]){delete _0x54ca49[_0xa303('0x16')];}_0x28c164[_0xa303('0x17')](0x1f4)['send'](_0x54ca49);}};}function checkError(){return function(_0x282e25){if(!_0x282e25){throw new RangeError(_0xa303('0x18'));}return _0x282e25;};}function respondWithRpcPromise(_0x21deee,_0x904261){return new BPromise(function(_0x54b173,_0x14f9ab){var _0x2a2512=amiClient;return _0x2a2512['request'](_0x21deee,_0x904261)[_0xa303('0x19')](function(_0x27c1d7){if(_0x27c1d7[_0xa303('0x15')]){if(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1a')]===0x1f4){return _0x14f9ab(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1b')]);}return _0x54b173(_0x27c1d7[_0xa303('0x15')][_0xa303('0x1b')]);}else{_0x54b173(_0x27c1d7['result']);}})['catch'](function(_0x4dad5b){_0x14f9ab(_0x4dad5b);});});}function getAgent(_0x58922f){return db['User'][_0xa303('0x1c')]({'where':{'id':_0x58922f,'role':_0xa303('0x1d')}})[_0xa303('0x19')](checkError());}function getAgentCheckSession(_0xbb93f0,_0x94d3e4){return new BPromise(function(_0x48e79f,_0x2d1341){var _0xb35c22=respondWithRpcPromise('VoiceChannels');var _0x221f59=getAgent(_0xbb93f0);Promise[_0xa303('0x1e')]([_0xb35c22,_0x221f59])[_0xa303('0x19')](function(_0x32dcfb){var _0x3c85de=_0x32dcfb[0x0];var _0x221007=_0x32dcfb[0x1];var _0x11b175=_[_0xa303('0x1f')](_0x3c85de[_0xa303('0x20')],function(_0x3383f4){return _0x3383f4[_0xa303('0x21')]==_0x221007['id']&&_0x3383f4[_0xa303('0x22')]==_0x94d3e4;});if(_0x11b175[_0xa303('0x23')]==0x1){_0x48e79f(_0x221007);}else{_0x2d1341(new RangeError(_0xa303('0x24')+_0x94d3e4+_0xa303('0x25')));}});});}exports[_0xa303('0x26')]=function(_0x228ae7,_0x5de180){logger['info'](_0xa303('0x27'),_0x228ae7[_0xa303('0x28')]);var _0xa69c59=originateValidation[_0xa303('0x29')](_0x228ae7['body']);if(_0xa69c59[_0xa303('0x23')]>0x0){return _0x5de180[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0xa69c59);}var _0x1093e1=_0x228ae7['body'][_0xa303('0x2b')];var _0x37376d=_0x228ae7[_0xa303('0x28')]['callNumber'];var _0xd35249=_0x228ae7[_0xa303('0x28')][_0xa303('0x2c')];var _0x4a6328=_0x228ae7[_0xa303('0x28')][_0xa303('0x2d')];return getAgent(_0x1093e1)[_0xa303('0x19')](function(_0x5dea0a){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x5dea0a[_0xa303('0x16')]);emit(util[_0xa303('0x2f')]('user:%s',_0x5dea0a[_0xa303('0x16')]),_0xa303('0x30'),{'callNumber':_0x37376d,'callerId':_0xd35249,'callbackUrl':_0x4a6328});return _0x5de180[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0xa303('0x31')](handleError(_0x5de180));};exports[_0xa303('0x32')]=function(_0x22da2d,_0x16c680){logger[_0xa303('0x12')]('hangup\x20fired:',_0x22da2d['body']);var _0x992eb9=hangupValidation[_0xa303('0x29')](_0x22da2d[_0xa303('0x28')]);if(_0x992eb9['length']>0x0){return _0x16c680['status'](0x190)[_0xa303('0x2a')](_0x992eb9);}var _0x8a16a3=_0x22da2d[_0xa303('0x28')][_0xa303('0x2b')];var _0x569158=_0x22da2d['body'][_0xa303('0x22')];return getAgent(_0x8a16a3)[_0xa303('0x19')](function(_0x1c99b4){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x1c99b4['name']);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x1c99b4[_0xa303('0x16')]),_0xa303('0x34'),{'sessionId':_0x569158});return _0x16c680['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0xa303('0x31')](handleError(_0x16c680));};exports[_0xa303('0x35')]=function(_0x3aece5,_0x411b69){logger[_0xa303('0x12')](_0xa303('0x36'),_0x3aece5[_0xa303('0x28')]);var _0x1f4352=answerValidation[_0xa303('0x29')](_0x3aece5[_0xa303('0x28')]);if(_0x1f4352[_0xa303('0x23')]>0x0){return _0x411b69['status'](0x190)['json'](_0x1f4352);}var _0x45fb2f=_0x3aece5['body'][_0xa303('0x2b')];var _0x564d59=_0x3aece5[_0xa303('0x28')][_0xa303('0x22')];return getAgent(_0x45fb2f)[_0xa303('0x19')](function(_0x2c03fa){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x2c03fa[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x2c03fa[_0xa303('0x16')]),_0xa303('0x37'),{'sessionId':_0x564d59});return _0x411b69[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0xa303('0x31')](handleError(_0x411b69));};exports['hold']=function(_0x32b439,_0x11440f){logger[_0xa303('0x12')]('hold\x20fired:',_0x32b439['body']);var _0x9240e1=holdValidation[_0xa303('0x29')](_0x32b439[_0xa303('0x28')]);if(_0x9240e1[_0xa303('0x23')]>0x0){return _0x11440f[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x9240e1);}var _0x2f9f0b=_0x32b439[_0xa303('0x28')][_0xa303('0x2b')];var _0x4cbf30=_0x32b439['body'][_0xa303('0x22')];return getAgent(_0x2f9f0b)[_0xa303('0x19')](function(_0x532003){logger[_0xa303('0x12')]('entityFound:',_0x532003[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0x532003[_0xa303('0x16')]),'webbar:hold',{'sessionId':_0x4cbf30});return _0x11440f[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':_0xa303('0x38')});})[_0xa303('0x31')](handleError(_0x11440f));};exports[_0xa303('0x39')]=function(_0x16242c,_0x538ef4){logger[_0xa303('0x12')](_0xa303('0x3a'),_0x16242c[_0xa303('0x28')]);var _0xe4a907=unholdValidation['validate'](_0x16242c['body']);if(_0xe4a907[_0xa303('0x23')]>0x0){return _0x538ef4[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0xe4a907);}var _0x4bcee0=_0x16242c[_0xa303('0x28')]['userId'];var _0x5939ea=_0x16242c['body']['sessionId'];return getAgent(_0x4bcee0)[_0xa303('0x19')](function(_0xdc6eaf){logger['info'](_0xa303('0x2e'),_0xdc6eaf[_0xa303('0x16')]);emit(util[_0xa303('0x2f')](_0xa303('0x33'),_0xdc6eaf[_0xa303('0x16')]),'webbar:unhold',{'sessionId':_0x5939ea});return _0x538ef4[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':_0xa303('0x3b')});})[_0xa303('0x31')](handleError(_0x538ef4));};exports[_0xa303('0x3c')]=function(_0x53d9dc,_0x56bc98){logger[_0xa303('0x12')](_0xa303('0x3d'),_0x56bc98[_0xa303('0x28')]);var _0x87a096=callsValidation[_0xa303('0x29')](_0x53d9dc[_0xa303('0x28')]);if(_0x87a096[_0xa303('0x23')]>0x0){return _0x56bc98[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x87a096);}var _0x5d4a72=_0x53d9dc[_0xa303('0x28')][_0xa303('0x2b')];var _0x27471c=respondWithRpcPromise(_0xa303('0x3e'));var _0x47da3a=getAgent(_0x5d4a72);return Promise['all']([_0x27471c,_0x47da3a])[_0xa303('0x19')](function(_0x4db2e2){var _0x14861e=_0x4db2e2[0x0];var _0x44c8d3=_0x4db2e2[0x1];var _0x5272d7=_['filter'](_0x14861e[_0xa303('0x20')],function(_0x249378){return _0x249378['UserId']==_0x44c8d3['id'];});return _0x56bc98['status'](0xc8)['json']({'count':_0x5272d7[_0xa303('0x23')],'rows':_0x5272d7});})[_0xa303('0x31')](handleError(_0x56bc98));};exports[_0xa303('0x3f')]=function(_0x15f4e6,_0x28cd01){logger[_0xa303('0x12')](_0xa303('0x40'),_0x15f4e6[_0xa303('0x28')]);var _0x8aecd7=conferenceValidation['validate'](_0x15f4e6[_0xa303('0x28')]);if(_0x8aecd7[_0xa303('0x23')]>0x0){return _0x28cd01[_0xa303('0x17')](0x190)[_0xa303('0x2a')](_0x8aecd7);}var _0x40e4b4=_0x15f4e6[_0xa303('0x28')]['userId'];return getAgent(_0x40e4b4)[_0xa303('0x19')](function(_0x558a2a){logger['info'](_0xa303('0x2e'),_0x558a2a[_0xa303('0x16')]);emit(util['format'](_0xa303('0x33'),_0x558a2a[_0xa303('0x16')]),_0xa303('0x41'));return _0x28cd01[_0xa303('0x17')](0xc8)[_0xa303('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x28cd01));};exports['transfer']=function(_0x2e8100,_0x40550d){logger[_0xa303('0x12')]('transfer\x20fired:',_0x2e8100['body']);var _0x3b0f1e=transferValidation['validate'](_0x2e8100['body']);if(_0x3b0f1e['length']>0x0){return _0x40550d['status'](0x190)[_0xa303('0x2a')](_0x3b0f1e);}var _0x27474e=_0x2e8100[_0xa303('0x28')][_0xa303('0x2b')];var _0x3008ae=_0x2e8100[_0xa303('0x28')][_0xa303('0x22')];var _0x2e5a11=_0x2e8100['body'][_0xa303('0x42')];return getAgent(_0x27474e)[_0xa303('0x19')](function(_0x123d7f){logger[_0xa303('0x12')](_0xa303('0x2e'),_0x123d7f[_0xa303('0x16')]);emit(util['format'](_0xa303('0x33'),_0x123d7f['name']),'webbar:transfer',{'sessionId':_0x3008ae,'transferNumber':_0x2e5a11});return _0x40550d[_0xa303('0x17')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x40550d));}; \ No newline at end of file +var _0x593e=['number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','name','status','send','NotFound','request','code','message','catch','findOne','agent','then','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x169dcc,_0x45c7f0){var _0x12b22c=function(_0x1fdb13){while(--_0x1fdb13){_0x169dcc['push'](_0x169dcc['shift']());}};_0x12b22c(++_0x45c7f0);}(_0x593e,0xcb));var _0xe593=function(_0x154d24,_0x30ee21){_0x154d24=_0x154d24-0x0;var _0x128164=_0x593e[_0x154d24];return _0x128164;};'use strict';var path=require(_0xe593('0x0'));var fs=require('fs');var _=require(_0xe593('0x1'));var db=require(_0xe593('0x2'))['db'];var config=require(_0xe593('0x3'));var util=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var jayson=require(_0xe593('0x6'));var amiClient=jayson[_0xe593('0x7')]['http']({'port':0x232a});var logger=require(_0xe593('0x8'))(_0xe593('0x9'));var Redis=require(_0xe593('0xa'));config[_0xe593('0xb')]=_[_0xe593('0xc')](config[_0xe593('0xb')],{'host':_0xe593('0xd'),'port':0x18eb});var io=require(_0xe593('0xe'))(new Redis(config[_0xe593('0xb')]));var Schema=require(_0xe593('0xf'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'callNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x14')]},'transferNumber':{'type':_0xe593('0x11'),'required':[!![],_0xe593('0x15')]}});var holdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xe593('0x13'),'required':[!![],_0xe593('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe593('0x10')]}});function emit(_0x40416c,_0x1c6de3,_0x2d525c){logger[_0xe593('0x16')](_0x40416c,_0x1c6de3,JSON[_0xe593('0x17')](_0x2d525c));io['to'](_0x40416c)['emit'](_0x1c6de3,_0x2d525c);}function handleError(_0xfbc79f){return function(_0x470d07){console['log'](_0xe593('0x18'),_0x470d07,_0x470d07 instanceof RangeError);logger[_0xe593('0x19')](_0x470d07['stack']);if(_0x470d07 instanceof RangeError){if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x194)[_0xe593('0x1c')](_0x470d07);}else{if(_0x470d07[_0xe593('0x1a')]){delete _0x470d07[_0xe593('0x1a')];}_0xfbc79f[_0xe593('0x1b')](0x1f4)['send'](_0x470d07);}};}function checkError(){return function(_0x4af4c8){if(!_0x4af4c8){throw new RangeError(_0xe593('0x1d'));}return _0x4af4c8;};}function respondWithRpcPromise(_0x5d4895,_0x56c23f){return new BPromise(function(_0x1bb8e8,_0x3c65b5){var _0x57379d=amiClient;return _0x57379d[_0xe593('0x1e')](_0x5d4895,_0x56c23f)['then'](function(_0x1672bf){if(_0x1672bf[_0xe593('0x19')]){if(_0x1672bf[_0xe593('0x19')][_0xe593('0x1f')]===0x1f4){return _0x3c65b5(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}return _0x1bb8e8(_0x1672bf[_0xe593('0x19')][_0xe593('0x20')]);}else{_0x1bb8e8(_0x1672bf['result']);}})[_0xe593('0x21')](function(_0x347d7d){_0x3c65b5(_0x347d7d);});});}function getAgent(_0x480218){return db['User'][_0xe593('0x22')]({'where':{'id':_0x480218,'role':_0xe593('0x23')}})[_0xe593('0x24')](checkError());}function getAgentCheckSession(_0x43699d,_0x3b66bc){return new BPromise(function(_0x27a3d2,_0x5918cd){var _0x350e2b=respondWithRpcPromise('VoiceChannels');var _0x1dacf6=getAgent(_0x43699d);Promise[_0xe593('0x25')]([_0x350e2b,_0x1dacf6])['then'](function(_0x337ee0){var _0x561a01=_0x337ee0[0x0];var _0x44a68c=_0x337ee0[0x1];var _0x1c147b=_[_0xe593('0x26')](_0x561a01['rows'],function(_0x1ae8d9){return _0x1ae8d9[_0xe593('0x27')]==_0x44a68c['id']&&_0x1ae8d9[_0xe593('0x28')]==_0x3b66bc;});if(_0x1c147b[_0xe593('0x29')]==0x1){_0x27a3d2(_0x44a68c);}else{_0x5918cd(new RangeError(_0xe593('0x2a')+_0x3b66bc+_0xe593('0x2b')));}});});}exports[_0xe593('0x2c')]=function(_0x4efc93,_0x4098a9){logger[_0xe593('0x16')]('originate\x20fired:',_0x4efc93[_0xe593('0x2d')]);var _0x571995=originateValidation[_0xe593('0xf')](_0x4efc93[_0xe593('0x2d')]);if(_0x571995[_0xe593('0x29')]>0x0){return _0x4098a9[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x571995);}var _0x24a560=_0x4efc93[_0xe593('0x2d')][_0xe593('0x2f')];var _0x11f287=_0x4efc93[_0xe593('0x2d')]['callNumber'];var _0x27a563=_0x4efc93[_0xe593('0x2d')][_0xe593('0x30')];var _0x5a55c0=_0x4efc93['body'][_0xe593('0x31')];return getAgent(_0x24a560)['then'](function(_0x232bf1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x232bf1[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x232bf1[_0xe593('0x1a')]),'webbar:originate',{'callNumber':_0x11f287,'callerId':_0x27a563,'callbackUrl':_0x5a55c0});return _0x4098a9['status'](0xc8)[_0xe593('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xe593('0x21')](handleError(_0x4098a9));};exports['hangup']=function(_0x206775,_0x5b9589){logger['info'](_0xe593('0x35'),_0x206775[_0xe593('0x2d')]);var _0x2aa9d8=hangupValidation['validate'](_0x206775['body']);if(_0x2aa9d8['length']>0x0){return _0x5b9589[_0xe593('0x1b')](0x190)['json'](_0x2aa9d8);}var _0x37ba0e=_0x206775[_0xe593('0x2d')][_0xe593('0x2f')];var _0x475207=_0x206775['body'][_0xe593('0x28')];return getAgent(_0x37ba0e)['then'](function(_0x36c08e){logger['info']('entityFound:',_0x36c08e['name']);emit(util[_0xe593('0x33')]('user:%s',_0x36c08e[_0xe593('0x1a')]),_0xe593('0x36'),{'sessionId':_0x475207});return _0x5b9589[_0xe593('0x1b')](0xc8)['json']({'error':![],'message':_0xe593('0x37')});})[_0xe593('0x21')](handleError(_0x5b9589));};exports[_0xe593('0x38')]=function(_0x4655dd,_0x26ff41){logger[_0xe593('0x16')](_0xe593('0x39'),_0x4655dd[_0xe593('0x2d')]);var _0x4b36e1=answerValidation[_0xe593('0xf')](_0x4655dd[_0xe593('0x2d')]);if(_0x4b36e1[_0xe593('0x29')]>0x0){return _0x26ff41[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x4b36e1);}var _0x4d3018=_0x4655dd['body'][_0xe593('0x2f')];var _0x380429=_0x4655dd[_0xe593('0x2d')]['sessionId'];return getAgent(_0x4d3018)[_0xe593('0x24')](function(_0x8a4c26){logger['info']('entityFound:',_0x8a4c26[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x8a4c26['name']),_0xe593('0x3a'),{'sessionId':_0x380429});return _0x26ff41[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3b')});})['catch'](handleError(_0x26ff41));};exports['hold']=function(_0x4a7434,_0x4c8d14){logger[_0xe593('0x16')]('hold\x20fired:',_0x4a7434[_0xe593('0x2d')]);var _0xd016b3=holdValidation[_0xe593('0xf')](_0x4a7434[_0xe593('0x2d')]);if(_0xd016b3[_0xe593('0x29')]>0x0){return _0x4c8d14[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0xd016b3);}var _0x297c3e=_0x4a7434['body'][_0xe593('0x2f')];var _0x1a5e0f=_0x4a7434[_0xe593('0x2d')]['sessionId'];return getAgent(_0x297c3e)[_0xe593('0x24')](function(_0x5dfdb1){logger[_0xe593('0x16')](_0xe593('0x32'),_0x5dfdb1[_0xe593('0x1a')]);emit(util['format']('user:%s',_0x5dfdb1[_0xe593('0x1a')]),_0xe593('0x3c'),{'sessionId':_0x1a5e0f});return _0x4c8d14['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x4c8d14));};exports['unhold']=function(_0x383645,_0x1e48d8){logger[_0xe593('0x16')](_0xe593('0x3d'),_0x383645[_0xe593('0x2d')]);var _0x44201e=unholdValidation[_0xe593('0xf')](_0x383645[_0xe593('0x2d')]);if(_0x44201e[_0xe593('0x29')]>0x0){return _0x1e48d8[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x44201e);}var _0x1ea4ef=_0x383645[_0xe593('0x2d')][_0xe593('0x2f')];var _0xa25aa8=_0x383645[_0xe593('0x2d')]['sessionId'];return getAgent(_0x1ea4ef)[_0xe593('0x24')](function(_0x12e2ac){logger[_0xe593('0x16')](_0xe593('0x32'),_0x12e2ac[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x12e2ac[_0xe593('0x1a')]),_0xe593('0x3e'),{'sessionId':_0xa25aa8});return _0x1e48d8[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x3f')});})[_0xe593('0x21')](handleError(_0x1e48d8));};exports[_0xe593('0x40')]=function(_0x93ca5e,_0x5e8f9c){logger[_0xe593('0x16')](_0xe593('0x41'),_0x5e8f9c[_0xe593('0x2d')]);var _0x24d061=callsValidation[_0xe593('0xf')](_0x93ca5e['body']);if(_0x24d061['length']>0x0){return _0x5e8f9c[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x24d061);}var _0x318dd2=_0x93ca5e[_0xe593('0x2d')][_0xe593('0x2f')];var _0x1e49ed=respondWithRpcPromise(_0xe593('0x42'));var _0x518b6f=getAgent(_0x318dd2);return Promise['all']([_0x1e49ed,_0x518b6f])[_0xe593('0x24')](function(_0x23ee3b){var _0x4ff51d=_0x23ee3b[0x0];var _0x103403=_0x23ee3b[0x1];var _0xf8ed1d=_[_0xe593('0x26')](_0x4ff51d[_0xe593('0x43')],function(_0x3a3d7b){return _0x3a3d7b[_0xe593('0x27')]==_0x103403['id'];});return _0x5e8f9c[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'count':_0xf8ed1d[_0xe593('0x29')],'rows':_0xf8ed1d});})[_0xe593('0x21')](handleError(_0x5e8f9c));};exports['conference']=function(_0x36f38e,_0x13e368){logger[_0xe593('0x16')](_0xe593('0x44'),_0x36f38e[_0xe593('0x2d')]);var _0x202b18=conferenceValidation[_0xe593('0xf')](_0x36f38e['body']);if(_0x202b18[_0xe593('0x29')]>0x0){return _0x13e368[_0xe593('0x1b')](0x190)[_0xe593('0x2e')](_0x202b18);}var _0x14f8e1=_0x36f38e['body'][_0xe593('0x2f')];return getAgent(_0x14f8e1)[_0xe593('0x24')](function(_0x207c3d){logger[_0xe593('0x16')](_0xe593('0x32'),_0x207c3d['name']);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x207c3d[_0xe593('0x1a')]),_0xe593('0x45'));return _0x13e368[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x46')});})[_0xe593('0x21')](handleError(_0x13e368));};exports['transfer']=function(_0x2145c0,_0x16f9fc){logger[_0xe593('0x16')](_0xe593('0x47'),_0x2145c0[_0xe593('0x2d')]);var _0x9f1813=transferValidation[_0xe593('0xf')](_0x2145c0[_0xe593('0x2d')]);if(_0x9f1813[_0xe593('0x29')]>0x0){return _0x16f9fc[_0xe593('0x1b')](0x190)['json'](_0x9f1813);}var _0x190e90=_0x2145c0[_0xe593('0x2d')][_0xe593('0x2f')];var _0x492a9e=_0x2145c0[_0xe593('0x2d')][_0xe593('0x28')];var _0x4001b7=_0x2145c0[_0xe593('0x2d')][_0xe593('0x48')];return getAgent(_0x190e90)['then'](function(_0x17a1bc){logger[_0xe593('0x16')]('entityFound:',_0x17a1bc[_0xe593('0x1a')]);emit(util[_0xe593('0x33')](_0xe593('0x34'),_0x17a1bc[_0xe593('0x1a')]),'webbar:transfer',{'sessionId':_0x492a9e,'transferNumber':_0x4001b7});return _0x16f9fc[_0xe593('0x1b')](0xc8)[_0xe593('0x2e')]({'error':![],'message':_0xe593('0x49')});})['catch'](handleError(_0x16f9fc));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a96307f..e9fb65c 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 _0xe3da=['/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/canned_answers',auth[_0xae3d('0xc')](),controller['getAnswers']);router[_0xae3d('0xb')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router['get'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x16')]);router[_0xae3d('0x17')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x18')]);router[_0xae3d('0x17')]('/:id/dispositions',auth[_0xae3d('0xc')](),controller[_0xae3d('0x19')]);router[_0xae3d('0x17')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1b')]);router['post'](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1c')]);router['post'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller['addApplications']);router['post'](_0xae3d('0x1d'),controller[_0xae3d('0x1e')]);router[_0xae3d('0x17')](_0xae3d('0x1f'),auth[_0xae3d('0xc')](),controller['send']);router[_0xae3d('0x20')]('/:id',auth[_0xae3d('0xc')](),controller[_0xae3d('0x21')]);router[_0xae3d('0x22')](_0xae3d('0x23'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x24')]);router[_0xae3d('0x22')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x25')]);router[_0xae3d('0x22')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x26')]);router[_0xae3d('0x22')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x27')]);module[_0xae3d('0x28')]=router; \ No newline at end of file +var _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x5861a8,_0x18a679){var _0x5b8bb7=function(_0x495256){while(--_0x495256){_0x5861a8['push'](_0x5861a8['shift']());}};_0x5b8bb7(++_0x18a679);}(_0x33af,0xec));var _0xf33a=function(_0x4aaaef,_0x4cd2d0){_0x4aaaef=_0x4aaaef-0x0;var _0xbe59a=_0x33af[_0x4aaaef];return _0xbe59a;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2d754c6..f5d878d 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 _0xbedc=['STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports'];(function(_0x57838c,_0x10a692){var _0x57ae80=function(_0x4e614a){while(--_0x4e614a){_0x57838c['push'](_0x57838c['shift']());}};_0x57ae80(++_0x10a692);}(_0xbedc,0x1ec));var _0xcbed=function(_0x2339f8,_0x6cdd71){_0x2339f8=_0x2339f8-0x0;var _0x54b1f3=_0xbedc[_0x2339f8];return _0x54b1f3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcbed('0x0'));module[_0xcbed('0x1')]={'name':{'type':Sequelize[_0xcbed('0x2')],'unique':_0xcbed('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xcbed('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xcbed('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcbed('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xcbed('0x2')]},'type':{'type':Sequelize[_0xcbed('0x4')](_0xcbed('0x5'),'sinch')},'accountSid':{'type':Sequelize[_0xcbed('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xcbed('0x6')],'defaultValue':function(){return _0xcbed('0x7');}},'notificationSound':{'type':Sequelize[_0xcbed('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xcbed('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcbed('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcbed('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcbed('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcbed('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xcbed('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcbed('0xb'),'set':function(_0x232856){if(!_0x232856){this[_0xcbed('0xc')]('mandatoryDispositionPauseId',null);}this[_0xcbed('0xc')]('mandatoryDisposition',_0x232856);}},'description':{'type':Sequelize[_0xcbed('0x2')]}}; \ No newline at end of file +var _0xbf70=['randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2d8fdf,_0x2ea4b7){var _0x50eaa3=function(_0xe86822){while(--_0xe86822){_0x2d8fdf['push'](_0x2d8fdf['shift']());}};_0x50eaa3(++_0x2ea4b7);}(_0xbf70,0x1cb));var _0x0bf7=function(_0x5c3947,_0x10c67e){_0x5c3947=_0x5c3947-0x0;var _0x2a5c23=_0xbf70[_0x5c3947];return _0x2a5c23;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0bf7('0x0'));module[_0x0bf7('0x1')]={'name':{'type':Sequelize[_0x0bf7('0x2')],'unique':_0x0bf7('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0bf7('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0bf7('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0bf7('0x2')],'defaultValue':function(){return rs[_0x0bf7('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0bf7('0x5')](_0x0bf7('0x6'),_0x0bf7('0x7'))},'accountSid':{'type':Sequelize[_0x0bf7('0x2')]},'baseUrl':{'type':Sequelize[_0x0bf7('0x2')]},'authToken':{'type':Sequelize[_0x0bf7('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0bf7('0x8')],'defaultValue':function(){return _0x0bf7('0x9');}},'notificationSound':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0bf7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0bf7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bf7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0bf7('0xb')],'comment':_0x0bf7('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x0bf7('0xa')],'defaultValue':![],'comment':_0x0bf7('0xd'),'set':function(_0x251a0d){if(!_0x251a0d){this[_0x0bf7('0xe')](_0x0bf7('0xf'),null);}this['setDataValue'](_0x0bf7('0x10'),_0x251a0d);}},'description':{'type':Sequelize[_0x0bf7('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index bf81d4d..7f49d60 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 _0x72fe=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','UserProfileResource','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','role','WhatsappAccounts','UserProfileSection','Pause','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','whatsapp','Applications','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','orderBy','asc','account','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','From','replace','whatsapp:','Body','messageId','MessageSid','from','notifications','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','contact','WhatsappInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','AttachmentId','UserId','User','agent','*,*,*,*','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','List','DESC','ListId','user','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info'];(function(_0x3cd458,_0x5ba109){var _0x530af1=function(_0x43a43c){while(--_0x43a43c){_0x3cd458['push'](_0x3cd458['shift']());}};_0x530af1(++_0x5ba109);}(_0x72fe,0x167));var _0xe72f=function(_0x22a776,_0x4d0468){_0x22a776=_0x22a776-0x0;var _0x185b25=_0x72fe[_0x22a776];return _0x185b25;};'use strict';var emlformat=require(_0xe72f('0x0'));var rimraf=require(_0xe72f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe72f('0x2'));var rp=require('request-promise');var moment=require(_0xe72f('0x3'));var BPromise=require(_0xe72f('0x4'));var Mustache=require(_0xe72f('0x5'));var util=require(_0xe72f('0x6'));var path=require(_0xe72f('0x7'));var sox=require(_0xe72f('0x8'));var csv=require(_0xe72f('0x9'));var ejs=require(_0xe72f('0xa'));var fs=require('fs');var fs_extra=require(_0xe72f('0xb'));var _=require(_0xe72f('0xc'));var squel=require(_0xe72f('0xd'));var crypto=require(_0xe72f('0xe'));var jsforce=require(_0xe72f('0xf'));var deskjs=require(_0xe72f('0x10'));var toCsv=require(_0xe72f('0x9'));var querystring=require('querystring');var Papa=require(_0xe72f('0x11'));var Redis=require(_0xe72f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe72f('0x13'));var as=require(_0xe72f('0x14'));var hardwareService=require(_0xe72f('0x15'));var logger=require(_0xe72f('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xe72f('0x17'));var licenseUtil=require(_0xe72f('0x18'));var db=require(_0xe72f('0x19'))['db'];config[_0xe72f('0x1a')]=_[_0xe72f('0x1b')](config[_0xe72f('0x1a')],{'host':_0xe72f('0x1c'),'port':0x18eb});var socket=require(_0xe72f('0x1d'))(new Redis(config[_0xe72f('0x1a')]));require(_0xe72f('0x1e'))[_0xe72f('0x1f')](socket);var jayson=require(_0xe72f('0x20'));var client=jayson['client'][_0xe72f('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x19f3e5,_0x77e113,_0x1db210,_0x49a8b7){return new BPromise(function(_0x18b97c,_0x107f30){var _0x58e5f5=_0x49a8b7||client;return _0x58e5f5[_0xe72f('0x22')](_0x19f3e5,_0x1db210)[_0xe72f('0x23')](function(_0x410f85){logger[_0xe72f('0x24')](_0xe72f('0x25'),_0x77e113,_0xe72f('0x26'));logger[_0xe72f('0x27')](_0xe72f('0x28'),_0x77e113,_0xe72f('0x26'),JSON['stringify'](_0x410f85));if(_0x410f85[_0xe72f('0x29')]){if(_0x410f85['error'][_0xe72f('0x2a')]===0x1f4){logger['error'](_0xe72f('0x25'),_0x77e113,_0x410f85[_0xe72f('0x29')][_0xe72f('0x2b')]);return _0x107f30(_0x410f85['error'][_0xe72f('0x2b')]);}logger[_0xe72f('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x77e113,_0x410f85[_0xe72f('0x29')][_0xe72f('0x2b')]);return _0x18b97c(_0x410f85[_0xe72f('0x29')][_0xe72f('0x2b')]);}else{logger[_0xe72f('0x24')](_0xe72f('0x25'),_0x77e113,_0xe72f('0x26'));_0x18b97c(_0x410f85[_0xe72f('0x2c')][_0xe72f('0x2b')]);}})[_0xe72f('0x2d')](function(_0x4a45d8){logger[_0xe72f('0x29')](_0xe72f('0x25'),_0x77e113,_0x4a45d8);_0x107f30(_0x4a45d8);});});}function respondWithStatusCode(_0x3621a1,_0x38d831){_0x38d831=_0x38d831||0xcc;return function(_0x34cf98){if(_0x34cf98){return _0x3621a1[_0xe72f('0x2e')](_0x38d831);}return _0x3621a1['status'](_0x38d831)[_0xe72f('0x2f')]();};}function respondWithResult(_0x46fb26,_0x4a08b4){_0x4a08b4=_0x4a08b4||0xc8;return function(_0x2dd2ca){if(_0x2dd2ca){return _0x46fb26[_0xe72f('0x30')](_0x4a08b4)[_0xe72f('0x31')](_0x2dd2ca);}};}function respondWithFilteredResult(_0x505ac9,_0x1146ab){return function(_0x4fd2d2){if(_0x4fd2d2){var _0x9fba59=typeof _0x1146ab[_0xe72f('0x32')]===_0xe72f('0x33')&&typeof _0x1146ab[_0xe72f('0x34')]===_0xe72f('0x33');var _0x1e833d=_0x4fd2d2[_0xe72f('0x35')];var _0x3b55fe=_0x9fba59?0x0:_0x1146ab[_0xe72f('0x32')];var _0x104684=_0x9fba59?_0x4fd2d2['count']:_0x1146ab[_0xe72f('0x32')]+_0x1146ab[_0xe72f('0x34')];var _0x3fa7b5;if(_0x104684>=_0x1e833d){_0x104684=_0x1e833d;_0x3fa7b5=0xc8;}else{_0x3fa7b5=0xce;}_0x505ac9[_0xe72f('0x30')](_0x3fa7b5);return _0x505ac9[_0xe72f('0x36')](_0xe72f('0x37'),_0x3b55fe+'-'+_0x104684+'/'+_0x1e833d)[_0xe72f('0x31')](_0x4fd2d2);}return null;};}function patchUpdates(_0x433091){return function(_0x51d2ae){try{jsonpatch['apply'](_0x51d2ae,_0x433091,!![]);}catch(_0x5a689d){return BPromise[_0xe72f('0x38')](_0x5a689d);}return _0x51d2ae['save']();};}function saveUpdates(_0x566c7b,_0xcd0f91){return function(_0x32841a){if(_0x32841a){return _0x32841a[_0xe72f('0x39')](_0x566c7b)[_0xe72f('0x23')](function(_0x3939e9){return _0x3939e9;});}return null;};}function removeEntity(_0x1277a4,_0x324532){return function(_0x48afa0){if(_0x48afa0){return _0x48afa0[_0xe72f('0x3a')]()[_0xe72f('0x23')](function(){var _0xc92f49=_0x48afa0[_0xe72f('0x3b')]({'plain':!![]});var _0x339458='WhatsappAccounts';return db[_0xe72f('0x3c')]['destroy']({'where':{'type':_0x339458,'resourceId':_0xc92f49['id']}})['then'](function(){return _0x48afa0;});})[_0xe72f('0x23')](function(){_0x1277a4[_0xe72f('0x30')](0xcc)[_0xe72f('0x2f')]();});}};}function handleEntityNotFound(_0x2496b6,_0x48956b){return function(_0x21ba26){if(!_0x21ba26){_0x2496b6[_0xe72f('0x2e')](0x194);}return _0x21ba26;};}function handleError(_0x3138c7,_0x37845e){_0x37845e=_0x37845e||0x1f4;return function(_0x432532){logger[_0xe72f('0x29')](_0x432532['stack']);if(_0x432532[_0xe72f('0x3d')]){delete _0x432532[_0xe72f('0x3d')];}_0x3138c7['status'](_0x37845e)[_0xe72f('0x3e')](_0x432532);};}exports[_0xe72f('0x3f')]=function(_0x594b3c,_0x454b94){var _0x5b81f5={'include':[{'model':db['Pause'],'as':_0xe72f('0x40')}]},_0x14331b={},_0x108deb={'count':0x0,'rows':[]};var _0x1ace26=_[_0xe72f('0x41')](db[_0xe72f('0x42')][_0xe72f('0x43')],function(_0x4183bf){return{'name':_0x4183bf['fieldName'],'type':_0x4183bf[_0xe72f('0x44')]['key']};});_0x14331b[_0xe72f('0x45')]=_[_0xe72f('0x41')](_0x1ace26,_0xe72f('0x3d'));_0x14331b[_0xe72f('0x46')]=_[_0xe72f('0x47')](_0x594b3c[_0xe72f('0x46')]);_0x14331b[_0xe72f('0x48')]=_[_0xe72f('0x49')](_0x14331b[_0xe72f('0x45')],_0x14331b[_0xe72f('0x46')]);_0x5b81f5[_0xe72f('0x4a')]=_[_0xe72f('0x49')](_0x14331b[_0xe72f('0x45')],qs[_0xe72f('0x4b')](_0x594b3c[_0xe72f('0x46')][_0xe72f('0x4b')]));_0x5b81f5['attributes']=_0x5b81f5[_0xe72f('0x4a')][_0xe72f('0x4c')]?_0x5b81f5[_0xe72f('0x4a')]:_0x14331b[_0xe72f('0x45')];if(!_0x594b3c[_0xe72f('0x46')][_0xe72f('0x4d')](_0xe72f('0x4e'))){_0x5b81f5['limit']=qs[_0xe72f('0x34')](_0x594b3c[_0xe72f('0x46')]['limit']);_0x5b81f5[_0xe72f('0x32')]=qs['offset'](_0x594b3c[_0xe72f('0x46')][_0xe72f('0x32')]);}_0x5b81f5['order']=qs[_0xe72f('0x4f')](_0x594b3c[_0xe72f('0x46')][_0xe72f('0x4f')]);_0x5b81f5[_0xe72f('0x50')]=qs[_0xe72f('0x48')](_['pick'](_0x594b3c[_0xe72f('0x46')],_0x14331b[_0xe72f('0x48')]),_0x1ace26);if(_0x594b3c[_0xe72f('0x46')][_0xe72f('0x51')]){_0x5b81f5[_0xe72f('0x50')]=_[_0xe72f('0x52')](_0x5b81f5['where'],{'$or':_[_0xe72f('0x41')](_0x1ace26,function(_0x40dccd){if(_0x40dccd[_0xe72f('0x44')]!==_0xe72f('0x53')){var _0x28d49f={};_0x28d49f[_0x40dccd['name']]={'$like':'%'+_0x594b3c['query'][_0xe72f('0x51')]+'%'};return _0x28d49f;}})});}_0x5b81f5=_[_0xe72f('0x52')]({},_0x5b81f5,_0x594b3c[_0xe72f('0x54')]);var _0x2d38a={'where':_0x5b81f5['where']};return db[_0xe72f('0x42')][_0xe72f('0x35')](_0x2d38a)['then'](function(_0x51624c){_0x108deb[_0xe72f('0x35')]=_0x51624c;if(_0x594b3c[_0xe72f('0x46')][_0xe72f('0x55')]){_0x5b81f5[_0xe72f('0x56')]=[{'all':!![]}];}return db[_0xe72f('0x42')][_0xe72f('0x57')](_0x5b81f5);})[_0xe72f('0x23')](function(_0x162e54){_0x108deb[_0xe72f('0x58')]=_0x162e54;return _0x108deb;})['then'](respondWithFilteredResult(_0x454b94,_0x5b81f5))['catch'](handleError(_0x454b94,null));};exports[_0xe72f('0x59')]=function(_0x132b33,_0xeb7443){var _0x3db096={'raw':![],'where':{'id':_0x132b33[_0xe72f('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5d0eb1={};_0x5d0eb1['model']=_[_0xe72f('0x47')](db[_0xe72f('0x42')][_0xe72f('0x43')]);_0x5d0eb1[_0xe72f('0x46')]=_[_0xe72f('0x47')](_0x132b33[_0xe72f('0x46')]);_0x5d0eb1[_0xe72f('0x48')]=_['intersection'](_0x5d0eb1['model'],_0x5d0eb1[_0xe72f('0x46')]);_0x3db096[_0xe72f('0x4a')]=_[_0xe72f('0x49')](_0x5d0eb1[_0xe72f('0x45')],qs[_0xe72f('0x4b')](_0x132b33[_0xe72f('0x46')][_0xe72f('0x4b')]));_0x3db096[_0xe72f('0x4a')]=_0x3db096[_0xe72f('0x4a')]['length']?_0x3db096[_0xe72f('0x4a')]:_0x5d0eb1[_0xe72f('0x45')];if(_0x132b33['query'][_0xe72f('0x55')]){_0x3db096[_0xe72f('0x56')]=[{'all':!![]}];}_0x3db096=_[_0xe72f('0x52')]({},_0x3db096,_0x132b33[_0xe72f('0x54')]);return db[_0xe72f('0x42')][_0xe72f('0x5b')](_0x3db096)[_0xe72f('0x23')](handleEntityNotFound(_0xeb7443,null))[_0xe72f('0x23')](respondWithResult(_0xeb7443,null))[_0xe72f('0x2d')](handleError(_0xeb7443,null));};exports[_0xe72f('0x5c')]=function(_0x37dd67,_0xd9eb35){return db['WhatsappAccount'][_0xe72f('0x5c')](_0x37dd67[_0xe72f('0x5d')],{})[_0xe72f('0x23')](function(_0x4b14af){var _0x5e5f43=_0x37dd67['user']['get']({'plain':!![]});if(!_0x5e5f43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e5f43[_0xe72f('0x5e')]==='user'){var _0x451e04=_0x4b14af[_0xe72f('0x3b')]({'plain':!![]});var _0x39dde9=_0xe72f('0x5f');return db[_0xe72f('0x60')][_0xe72f('0x5b')]({'where':{'name':_0x39dde9,'userProfileId':_0x5e5f43['userProfileId']},'raw':!![]})[_0xe72f('0x23')](function(_0xe9165a){if(_0xe9165a&&_0xe9165a['autoAssociation']===0x0){return db[_0xe72f('0x3c')][_0xe72f('0x5c')]({'name':_0x451e04[_0xe72f('0x3d')],'resourceId':_0x451e04['id'],'type':_0xe9165a[_0xe72f('0x3d')],'sectionId':_0xe9165a['id']},{})[_0xe72f('0x23')](function(){return _0x4b14af;});}else{return _0x4b14af;}})['catch'](function(_0x29dbc9){logger[_0xe72f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29dbc9);throw _0x29dbc9;});}return _0x4b14af;})[_0xe72f('0x23')](respondWithResult(_0xd9eb35,0xc9))[_0xe72f('0x2d')](handleError(_0xd9eb35,null));};exports[_0xe72f('0x39')]=function(_0x1dfefd,_0x5d1305){if(_0x1dfefd[_0xe72f('0x5d')]['id']){delete _0x1dfefd[_0xe72f('0x5d')]['id'];}return db[_0xe72f('0x42')]['find']({'where':{'id':_0x1dfefd[_0xe72f('0x5a')]['id']},'include':[{'model':db[_0xe72f('0x61')],'as':_0xe72f('0x40')}]})[_0xe72f('0x23')](handleEntityNotFound(_0x5d1305,null))[_0xe72f('0x23')](saveUpdates(_0x1dfefd['body'],null))[_0xe72f('0x23')](respondWithResult(_0x5d1305,null))['catch'](handleError(_0x5d1305,null));};exports['destroy']=function(_0x45873b,_0x3ea4c8){return db['WhatsappAccount'][_0xe72f('0x5b')]({'where':{'id':_0x45873b['params']['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x3ea4c8,null))['then'](removeEntity(_0x3ea4c8,null))[_0xe72f('0x2d')](handleError(_0x3ea4c8,null));};exports[_0xe72f('0x62')]=function(_0x4ea157,_0x210a46){return db['WhatsappAccount'][_0xe72f('0x62')]()[_0xe72f('0x23')](respondWithResult(_0x210a46,null))['catch'](handleError(_0x210a46,null));};exports[_0xe72f('0x63')]=function(_0x45a9c8,_0x2d026f,_0x159837){if(_0x45a9c8['body']['id']){delete _0x45a9c8['body']['id'];}return db[_0xe72f('0x42')][_0xe72f('0x5b')]({'where':{'id':_0x45a9c8[_0xe72f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2d026f,null))[_0xe72f('0x23')](function(_0x307711){if(_0x307711){_0x45a9c8[_0xe72f('0x5d')]['WhatsappAccountId']=_0x307711['id'];return db[_0xe72f('0x64')][_0xe72f('0x5c')](_0x45a9c8[_0xe72f('0x5d')]);}})[_0xe72f('0x23')](respondWithResult(_0x2d026f,null))[_0xe72f('0x2d')](handleError(_0x2d026f,null));};exports[_0xe72f('0x65')]=function(_0x32cbb7,_0x5dc823,_0x434770){var _0x4fe416={'raw':![],'where':{}};var _0x1ec30e={};var _0x38678f={'count':0x0,'rows':[]};return db[_0xe72f('0x42')][_0xe72f('0x66')]({'where':{'id':_0x32cbb7['params']['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x5dc823,null))['then'](function(_0x4d9821){if(_0x4d9821){_0x1ec30e[_0xe72f('0x45')]=_[_0xe72f('0x47')](db[_0xe72f('0x64')][_0xe72f('0x43')]);_0x1ec30e['query']=_['keys'](_0x32cbb7['query']);_0x1ec30e[_0xe72f('0x48')]=_[_0xe72f('0x49')](_0x1ec30e[_0xe72f('0x45')],_0x1ec30e[_0xe72f('0x46')]);_0x4fe416[_0xe72f('0x4a')]=_[_0xe72f('0x49')](_0x1ec30e[_0xe72f('0x45')],qs[_0xe72f('0x4b')](_0x32cbb7[_0xe72f('0x46')]['fields']));_0x4fe416[_0xe72f('0x4a')]=_0x4fe416['attributes'][_0xe72f('0x4c')]?_0x4fe416[_0xe72f('0x4a')]:_0x1ec30e[_0xe72f('0x45')];if(!_0x32cbb7['query'][_0xe72f('0x4d')](_0xe72f('0x4e'))){_0x4fe416[_0xe72f('0x34')]=qs[_0xe72f('0x34')](_0x32cbb7[_0xe72f('0x46')][_0xe72f('0x34')]);_0x4fe416[_0xe72f('0x32')]=qs[_0xe72f('0x32')](_0x32cbb7[_0xe72f('0x46')][_0xe72f('0x32')]);}_0x4fe416[_0xe72f('0x67')]=qs['sort'](_0x32cbb7[_0xe72f('0x46')][_0xe72f('0x4f')]);_0x4fe416[_0xe72f('0x50')]=qs[_0xe72f('0x48')](_[_0xe72f('0x68')](_0x32cbb7[_0xe72f('0x46')],_0x1ec30e[_0xe72f('0x48')]));_0x4fe416[_0xe72f('0x50')][_0xe72f('0x69')]=_0x4d9821['id'];if(_0x32cbb7['query'][_0xe72f('0x51')]){_0x4fe416[_0xe72f('0x50')]=_[_0xe72f('0x52')](_0x4fe416[_0xe72f('0x50')],{'$or':_[_0xe72f('0x41')](_0x4fe416[_0xe72f('0x4a')],function(_0x3dfc0f){var _0x3cf958={};_0x3cf958[_0x3dfc0f]={'$like':'%'+_0x32cbb7[_0xe72f('0x46')][_0xe72f('0x51')]+'%'};return _0x3cf958;})});}_0x4fe416=_['merge']({},_0x4fe416,_0x32cbb7[_0xe72f('0x54')]);return db['Disposition'][_0xe72f('0x35')]({'where':_0x4fe416[_0xe72f('0x50')]})[_0xe72f('0x23')](function(_0x1a4e4f){_0x38678f[_0xe72f('0x35')]=_0x1a4e4f;if(_0x32cbb7['query'][_0xe72f('0x55')]){_0x4fe416[_0xe72f('0x56')]=[{'all':!![]}];}return db[_0xe72f('0x64')][_0xe72f('0x57')](_0x4fe416);})[_0xe72f('0x23')](function(_0x18c0e0){_0x38678f['rows']=_0x18c0e0;return _0x38678f;});}})['then'](respondWithFilteredResult(_0x5dc823,_0x4fe416))['catch'](handleError(_0x5dc823,null));};exports[_0xe72f('0x6a')]=function(_0x5f04fa,_0x3227db,_0x1a5603){return db[_0xe72f('0x42')][_0xe72f('0x5b')]({'where':{'id':_0x5f04fa[_0xe72f('0x5a')]['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x3227db,null))[_0xe72f('0x23')](function(_0x361326){if(_0x361326){return _0x361326[_0xe72f('0x6a')](_0x5f04fa[_0xe72f('0x46')][_0xe72f('0x6b')]);}})[_0xe72f('0x23')](respondWithStatusCode(_0x3227db,null))[_0xe72f('0x2d')](handleError(_0x3227db,null));};exports[_0xe72f('0x6c')]=function(_0x201780,_0x2a0661,_0x266246){if(_0x201780['body']['id']){delete _0x201780[_0xe72f('0x5d')]['id'];}return db[_0xe72f('0x42')]['find']({'where':{'id':_0x201780['params']['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x2a0661,null))['then'](function(_0x137998){if(_0x137998){_0x201780[_0xe72f('0x5d')]['WhatsappAccountId']=_0x137998['id'];return db[_0xe72f('0x6d')][_0xe72f('0x5c')](_0x201780[_0xe72f('0x5d')]);}})[_0xe72f('0x23')](respondWithResult(_0x2a0661,null))[_0xe72f('0x2d')](handleError(_0x2a0661,null));};exports['getAnswers']=function(_0x1edfbf,_0x20b9a1,_0x6b8cd4){var _0x45e5ff={'raw':![],'where':{}};var _0x1608a0={};var _0x4572c5={'count':0x0,'rows':[]};return db[_0xe72f('0x42')][_0xe72f('0x66')]({'where':{'id':_0x1edfbf[_0xe72f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x20b9a1,null))['then'](function(_0x57f7a0){if(_0x57f7a0){_0x1608a0[_0xe72f('0x45')]=_[_0xe72f('0x47')](db[_0xe72f('0x6d')][_0xe72f('0x43')]);_0x1608a0[_0xe72f('0x46')]=_['keys'](_0x1edfbf['query']);_0x1608a0[_0xe72f('0x48')]=_[_0xe72f('0x49')](_0x1608a0['model'],_0x1608a0[_0xe72f('0x46')]);_0x45e5ff['attributes']=_[_0xe72f('0x49')](_0x1608a0[_0xe72f('0x45')],qs[_0xe72f('0x4b')](_0x1edfbf['query'][_0xe72f('0x4b')]));_0x45e5ff['attributes']=_0x45e5ff['attributes'][_0xe72f('0x4c')]?_0x45e5ff[_0xe72f('0x4a')]:_0x1608a0[_0xe72f('0x45')];if(!_0x1edfbf['query'][_0xe72f('0x4d')](_0xe72f('0x4e'))){_0x45e5ff[_0xe72f('0x34')]=qs[_0xe72f('0x34')](_0x1edfbf[_0xe72f('0x46')][_0xe72f('0x34')]);_0x45e5ff['offset']=qs[_0xe72f('0x32')](_0x1edfbf[_0xe72f('0x46')][_0xe72f('0x32')]);}_0x45e5ff[_0xe72f('0x67')]=qs['sort'](_0x1edfbf[_0xe72f('0x46')][_0xe72f('0x4f')]);_0x45e5ff[_0xe72f('0x50')]=qs[_0xe72f('0x48')](_[_0xe72f('0x68')](_0x1edfbf[_0xe72f('0x46')],_0x1608a0['filters']));_0x45e5ff[_0xe72f('0x50')][_0xe72f('0x69')]=_0x57f7a0['id'];if(_0x1edfbf[_0xe72f('0x46')][_0xe72f('0x51')]){_0x45e5ff[_0xe72f('0x50')]=_['merge'](_0x45e5ff['where'],{'$or':_[_0xe72f('0x41')](_0x45e5ff['attributes'],function(_0x2a06d3){var _0x26b5bc={};_0x26b5bc[_0x2a06d3]={'$like':'%'+_0x1edfbf[_0xe72f('0x46')]['filter']+'%'};return _0x26b5bc;})});}_0x45e5ff=_['merge']({},_0x45e5ff,_0x1edfbf['options']);return db[_0xe72f('0x6d')][_0xe72f('0x35')]({'where':_0x45e5ff['where']})[_0xe72f('0x23')](function(_0x1e17ec){_0x4572c5[_0xe72f('0x35')]=_0x1e17ec;if(_0x1edfbf[_0xe72f('0x46')][_0xe72f('0x55')]){_0x45e5ff[_0xe72f('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe72f('0x57')](_0x45e5ff);})['then'](function(_0x3293e1){_0x4572c5[_0xe72f('0x58')]=_0x3293e1;return _0x4572c5;});}})['then'](respondWithFilteredResult(_0x20b9a1,_0x45e5ff))[_0xe72f('0x2d')](handleError(_0x20b9a1,null));};exports['removeAnswers']=function(_0xd5936,_0x596adc,_0x439a52){return db[_0xe72f('0x42')][_0xe72f('0x5b')]({'where':{'id':_0xd5936[_0xe72f('0x5a')]['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x596adc,null))[_0xe72f('0x23')](function(_0x507e10){if(_0x507e10){return _0x507e10[_0xe72f('0x6e')](_0xd5936['query']['ids']);}})[_0xe72f('0x23')](respondWithStatusCode(_0x596adc,null))[_0xe72f('0x2d')](handleError(_0x596adc,null));};exports[_0xe72f('0x6f')]=function(_0x2b08ba,_0x298c11,_0x154a20){return db['WhatsappAccount'][_0xe72f('0x5b')]({'where':{'id':_0x2b08ba[_0xe72f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x298c11,null))[_0xe72f('0x23')](function(_0x22a134){if(_0x22a134){return _0x22a134['addAgents'](_0x2b08ba['body']['ids'],_[_0xe72f('0x70')](_0x2b08ba[_0xe72f('0x5d')],[_0xe72f('0x6b'),'id'])||{})['spread'](function(_0x243149){for(var _0x2d2b3a=0x0;_0x2d2b3a<_0x2b08ba[_0xe72f('0x5d')][_0xe72f('0x6b')][_0xe72f('0x4c')];_0x2d2b3a+=0x1){socket[_0xe72f('0x71')](_0xe72f('0x72'),{'UserId':Number(_0x2b08ba['body'][_0xe72f('0x6b')][_0x2d2b3a]),'WhatsappAccountId':Number(_0x2b08ba[_0xe72f('0x5a')]['id'])});}return _0x243149;});}})[_0xe72f('0x23')](respondWithResult(_0x298c11,null))[_0xe72f('0x2d')](handleError(_0x298c11,null));};exports[_0xe72f('0x73')]=function(_0x5db062,_0x34f89f,_0x3c63d2){return db[_0xe72f('0x42')][_0xe72f('0x5b')]({'where':{'id':_0x5db062[_0xe72f('0x5a')]['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x34f89f,null))[_0xe72f('0x23')](function(_0x367279){if(_0x367279){return _0x367279['removeAgents'](_0x5db062[_0xe72f('0x46')][_0xe72f('0x6b')])[_0xe72f('0x23')](function(){if(_[_0xe72f('0x74')](_0x5db062[_0xe72f('0x46')]['ids'])){for(var _0xc3dc47=0x0;_0xc3dc47<_0x5db062[_0xe72f('0x46')][_0xe72f('0x6b')][_0xe72f('0x4c')];_0xc3dc47+=0x1){socket['emit'](_0xe72f('0x75'),{'UserId':Number(_0x5db062[_0xe72f('0x46')][_0xe72f('0x6b')][_0xc3dc47]),'WhatsappAccountId':Number(_0x5db062[_0xe72f('0x5a')]['id'])});}}else{socket[_0xe72f('0x71')](_0xe72f('0x75'),{'UserId':Number(_0x5db062['query'][_0xe72f('0x6b')]),'WhatsappAccountId':Number(_0x5db062['params']['id'])});}});}})[_0xe72f('0x23')](respondWithStatusCode(_0x34f89f,null))[_0xe72f('0x2d')](handleError(_0x34f89f,null));};exports['getAgents']=function(_0x31bdd1,_0x362d8a,_0x4ed28f){var _0x12921a={};var _0x57f8f6={};var _0xcd6c3f;var _0xf1a5eb;return db[_0xe72f('0x42')][_0xe72f('0x66')]({'where':{'id':_0x31bdd1['params']['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x362d8a,null))[_0xe72f('0x23')](function(_0x2aca1a){if(_0x2aca1a){_0xcd6c3f=_0x2aca1a;_0x57f8f6[_0xe72f('0x45')]=_['keys'](db['User']['rawAttributes']);_0x57f8f6[_0xe72f('0x46')]=_[_0xe72f('0x47')](_0x31bdd1[_0xe72f('0x46')]);_0x57f8f6['filters']=_['intersection'](_0x57f8f6[_0xe72f('0x45')],_0x57f8f6[_0xe72f('0x46')]);_0x12921a['attributes']=_['intersection'](_0x57f8f6[_0xe72f('0x45')],qs[_0xe72f('0x4b')](_0x31bdd1[_0xe72f('0x46')][_0xe72f('0x4b')]));_0x12921a[_0xe72f('0x4a')]=_0x12921a[_0xe72f('0x4a')][_0xe72f('0x4c')]?_0x12921a['attributes']:_0x57f8f6[_0xe72f('0x45')];_0x12921a['order']=qs[_0xe72f('0x4f')](_0x31bdd1[_0xe72f('0x46')]['sort']);_0x12921a[_0xe72f('0x50')]=qs[_0xe72f('0x48')](_[_0xe72f('0x68')](_0x31bdd1[_0xe72f('0x46')],_0x57f8f6[_0xe72f('0x48')]));if(_0x31bdd1[_0xe72f('0x46')][_0xe72f('0x51')]){_0x12921a[_0xe72f('0x50')]=_[_0xe72f('0x52')](_0x12921a[_0xe72f('0x50')],{'$or':_[_0xe72f('0x41')](_0x12921a[_0xe72f('0x4a')],function(_0x26ccf3){var _0x464845={};_0x464845[_0x26ccf3]={'$like':'%'+_0x31bdd1[_0xe72f('0x46')]['filter']+'%'};return _0x464845;})});}_0x12921a=_['merge']({},_0x12921a,_0x31bdd1[_0xe72f('0x54')]);return _0xcd6c3f[_0xe72f('0x76')](_0x12921a);}})[_0xe72f('0x23')](function(_0x7a8e8f){if(_0x7a8e8f){_0xf1a5eb=_0x7a8e8f[_0xe72f('0x4c')];if(!_0x31bdd1[_0xe72f('0x46')]['hasOwnProperty'](_0xe72f('0x4e'))){_0x12921a[_0xe72f('0x34')]=qs['limit'](_0x31bdd1[_0xe72f('0x46')]['limit']);_0x12921a[_0xe72f('0x32')]=qs['offset'](_0x31bdd1[_0xe72f('0x46')][_0xe72f('0x32')]);}return _0xcd6c3f['getAgents'](_0x12921a);}})['then'](function(_0x3a1a04){if(_0x3a1a04){return _0x3a1a04?{'count':_0xf1a5eb,'rows':_0x3a1a04}:null;}})[_0xe72f('0x23')](respondWithResult(_0x362d8a,null))[_0xe72f('0x2d')](handleError(_0x362d8a,null));};exports['addApplications']=function(_0x304000,_0xf1bf9f){var _0x56f57d=_0x304000[_0xe72f('0x5a')]['id'];var _0x48c2ac=_0x304000[_0xe72f('0x5d')];var _0x5636e0=0xc8;var _0x3fdbdf=null;return db['sequelize'][_0xe72f('0x77')]({'isolationLevel':db[_0xe72f('0x78')][_0xe72f('0x79')][_0xe72f('0x7a')][_0xe72f('0x7b')]},function(_0x2f1097){return db['WhatsappAccount'][_0xe72f('0x66')]({'where':{'id':_0x56f57d},'transaction':_0x2f1097})[_0xe72f('0x23')](function(_0x4649f8){if(_0x4649f8){return db[_0xe72f('0x7c')][_0xe72f('0x3a')]({'where':{'WhatsappAccountId':_0x56f57d},'transaction':_0x2f1097})['then'](function(){var _0x29dd37=_[_0xe72f('0x41')](_0x48c2ac,function(_0x4086fe){_0x4086fe[_0xe72f('0x69')]=_0x56f57d;return _0x4086fe;});return db['WhatsappApplication'][_0xe72f('0x7d')](_0x29dd37,{'transaction':_0x2f1097});});}else{_0x5636e0=0x194;_0x3fdbdf=[];}});})[_0xe72f('0x23')](function(){if(_0x5636e0!==0x194){return db[_0xe72f('0x7c')][_0xe72f('0x7e')]({'where':{'WhatsappAccountId':_0x56f57d},'order':_0xe72f('0x7f')})['then'](function(_0x228748){_0x3fdbdf=_0x228748;});}})['catch'](function(_0x1b642d){_0x5636e0=0x1f4;logger['error'](_0x1b642d[_0xe72f('0x80')]);if(_0x1b642d['name']){delete _0x1b642d['name'];}_0x3fdbdf=_0x1b642d;})[_0xe72f('0x81')](function(){if(_0x3fdbdf===null){_0xf1bf9f[_0xe72f('0x2e')](_0x5636e0);}else{if(_0x5636e0===0x1f4){_0xf1bf9f['status'](_0x5636e0)[_0xe72f('0x3e')](_0x3fdbdf);}else{_0xf1bf9f[_0xe72f('0x30')](_0x5636e0)['json'](_0x3fdbdf);}}});};exports[_0xe72f('0x82')]=function(_0x510052,_0x340a29,_0x11231a){var _0x2e21e9={};var _0x19f706={};var _0x18f678;var _0x54dc6e;return db['WhatsappAccount'][_0xe72f('0x66')]({'where':{'id':_0x510052[_0xe72f('0x5a')]['id']}})[_0xe72f('0x23')](handleEntityNotFound(_0x340a29,null))[_0xe72f('0x23')](function(_0x16706d){if(_0x16706d){_0x18f678=_0x16706d;_0x19f706['model']=_['keys'](db[_0xe72f('0x7c')][_0xe72f('0x43')]);_0x19f706[_0xe72f('0x46')]=_[_0xe72f('0x47')](_0x510052[_0xe72f('0x46')]);_0x19f706[_0xe72f('0x48')]=_[_0xe72f('0x49')](_0x19f706[_0xe72f('0x45')],_0x19f706[_0xe72f('0x46')]);_0x2e21e9[_0xe72f('0x4a')]=_['intersection'](_0x19f706[_0xe72f('0x45')],qs[_0xe72f('0x4b')](_0x510052['query'][_0xe72f('0x4b')]));_0x2e21e9['attributes']=_0x2e21e9[_0xe72f('0x4a')][_0xe72f('0x4c')]?_0x2e21e9[_0xe72f('0x4a')]:_0x19f706['model'];_0x2e21e9[_0xe72f('0x67')]=qs[_0xe72f('0x4f')](_0x510052[_0xe72f('0x46')][_0xe72f('0x4f')]);_0x2e21e9[_0xe72f('0x50')]=qs['filters'](_['pick'](_0x510052[_0xe72f('0x46')],_0x19f706[_0xe72f('0x48')]));if(_0x510052['query'][_0xe72f('0x51')]){_0x2e21e9[_0xe72f('0x50')]=_[_0xe72f('0x52')](_0x2e21e9[_0xe72f('0x50')],{'$or':_[_0xe72f('0x41')](_0x2e21e9[_0xe72f('0x4a')],function(_0x5c0f1b){var _0x29bb1c={};_0x29bb1c[_0x5c0f1b]={'$like':'%'+_0x510052[_0xe72f('0x46')]['filter']+'%'};return _0x29bb1c;})});}_0x2e21e9=_[_0xe72f('0x52')]({},_0x2e21e9,_0x510052[_0xe72f('0x54')]);return _0x18f678[_0xe72f('0x82')](_0x2e21e9);}})['then'](function(_0xaff0bf){if(_0xaff0bf){_0x54dc6e=_0xaff0bf[_0xe72f('0x4c')];if(!_0x510052[_0xe72f('0x46')][_0xe72f('0x4d')](_0xe72f('0x4e'))){_0x2e21e9[_0xe72f('0x34')]=qs[_0xe72f('0x34')](_0x510052['query']['limit']);_0x2e21e9[_0xe72f('0x32')]=qs[_0xe72f('0x32')](_0x510052[_0xe72f('0x46')][_0xe72f('0x32')]);}return _0x18f678['getApplications'](_0x2e21e9);}})[_0xe72f('0x23')](function(_0x4e2caa){if(_0x4e2caa){return _0x4e2caa?{'count':_0x54dc6e,'rows':_0x4e2caa}:null;}})['then'](respondWithResult(_0x340a29,null))['catch'](handleError(_0x340a29,null));};exports['notify']=function(_0xa89fb5,_0x1faab1,_0x1138b5){var _0x390a3e={'channel':_0xe72f('0x83')};var _0x83420=[];var _0x32e246=[];var _0x447fb4={};return db['WhatsappAccount']['find']({'where':{'id':_0xa89fb5['params']['id']},'include':[{'model':db[_0xe72f('0x7c')],'as':_0xe72f('0x84')}]})[_0xe72f('0x23')](handleEntityNotFound(_0x1faab1,null))[_0xe72f('0x23')](function(_0x32e867){_0x390a3e['account']=_0x32e867;if(_0x390a3e['account']&&_0x390a3e['account'][_0xe72f('0x44')]===_0xe72f('0x85')&&_0xa89fb5['body']['statuses']){if(_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x86')][_0xe72f('0x4c')]===0x0)return;if(_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x86')][0x0][_0xe72f('0x87')]!==_0xe72f('0x88'))return;return db[_0xe72f('0x89')][_0xe72f('0x39')]({'read':!![],'readAt':_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x86')][0x0][_0xe72f('0x8a')]},{'where':{'messageId':_0xa89fb5['body']['statuses'][0x0][_0xe72f('0x8b')]},'individualHooks':!![]})[_0xe72f('0x23')](function(_0x378e4a){return _0x1faab1[_0xe72f('0x30')](0xc8)[_0xe72f('0x31')](_0x378e4a);});}_0x390a3e['applications']=_[_0xe72f('0x8c')](_0x32e867[_0xe72f('0x84')],[_0xe72f('0x7f')],[_0xe72f('0x8d')]);if(_0x390a3e['account']['Applications']){delete _0x390a3e[_0xe72f('0x8e')][_0xe72f('0x84')];}return db['CmContact'][_0xe72f('0x62')]()[_0xe72f('0x23')](function(_0x1f956){if(!_0x1f956){throw new db[(_0xe72f('0x8f'))]['ValidationError'](_0xe72f('0x90'));}_0x83420=_[_0xe72f('0x91')](_['keys'](_0x1f956),[_0xe72f('0x92'),_0xe72f('0x93')]);_0x32e246=_[_0xe72f('0x91')](_[_0xe72f('0x47')](_0x1f956),['createdAt','updatedAt',_0xe72f('0x94'),'ListId']);_0x390a3e[_0xe72f('0x5d')]={'mapKey':'mobile'};if(_0x390a3e['account']&&_0x390a3e[_0xe72f('0x8e')][_0xe72f('0x44')]===_0xe72f('0x95')){_0x390a3e[_0xe72f('0x5d')]['from']=_0xa89fb5['body'][_0xe72f('0x96')][_0xe72f('0x97')](_0xe72f('0x98'),'');_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x5d')]=_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x99')];_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9a')]=_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x9b')];}if(_0x390a3e['account']&&_0x390a3e[_0xe72f('0x8e')][_0xe72f('0x44')]===_0xe72f('0x85')){_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9c')]=_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x9d')][0x0]['from'];_0x390a3e['body'][_0xe72f('0x5d')]=_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x9d')][0x0]['message'][_0xe72f('0x5d')];_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9a')]=_0xa89fb5[_0xe72f('0x5d')][_0xe72f('0x9d')][0x0]['message_id'];}if(_0x390a3e[_0xe72f('0x5d')]['id']){delete _0x390a3e[_0xe72f('0x5d')]['id'];}if(_[_0xe72f('0x9e')](_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9c')])){throw new db[(_0xe72f('0x8f'))]['ValidationError'](_0xe72f('0x9f'));}if(_['isNil'](_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x5d')])||_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x5d')]===''){throw new db[(_0xe72f('0x8f'))][(_0xe72f('0xa0'))](_0xe72f('0xa1'));}if(_[_0xe72f('0x9e')](_0x390a3e[_0xe72f('0x5d')][_0xe72f('0xa2')])){throw new db[(_0xe72f('0x8f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32e246);}if(!_[_0xe72f('0xa3')](_0x32e246,_0x390a3e['body']['mapKey'])){throw new db['Sequelize'][(_0xe72f('0xa0'))](_0xe72f('0xa4')+_0x32e246);}_0x447fb4[_0x390a3e['body']['mapKey']]=_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9c')];return db[_0xe72f('0xa5')][_0xe72f('0x5b')]({'where':{'id':_0x390a3e['account']['ListId']},'include':[{'model':db[_0xe72f('0xa6')],'as':_0xe72f('0xa7'),'where':_0x447fb4,'limit':0x1,'order':[[_0xe72f('0x93'),'DESC']]}]});})[_0xe72f('0x23')](handleEntityNotFound(_0x1faab1,null))[_0xe72f('0x23')](function(_0x312702){if(_0x312702){_0x390a3e['list']=_[_0xe72f('0x70')](_0x312702,[_0xe72f('0xa7')]);if(_0x312702[_0xe72f('0xa7')][_0xe72f('0x4c')]){return _0x312702['Contacts'][0x0];}var _0x3e4fb5=_[_0xe72f('0x1b')](_0x390a3e[_0xe72f('0x5d')],{'firstName':_0x390a3e['body']['from'],'ListId':_0x312702['id']});_0x3e4fb5[_0x390a3e[_0xe72f('0x5d')][_0xe72f('0xa2')]]=_0x390a3e['body'][_0xe72f('0x9c')];return db['CmContact'][_0xe72f('0x5c')](_0x3e4fb5,{'fields':_0x83420,'raw':!![]});}})['then'](handleEntityNotFound(_0x1faab1,null))[_0xe72f('0x23')](function(_0x25659f){if(_0x25659f){_0x390a3e[_0xe72f('0xa8')]=_0x25659f;var _0x2fc56e={'ContactId':_0x25659f['id'],'phone':_0x390a3e[_0xe72f('0x5d')]['from'],'WhatsappAccountId':_0xa89fb5[_0xe72f('0x5a')]['id']};var _0x3f98cb={'ContactId':_0x25659f['id'],'WhatsappAccountId':_0xa89fb5[_0xe72f('0x5a')]['id'],'closed':![]};return db[_0xe72f('0xa9')][_0xe72f('0x5b')]({'where':_0x3f98cb})[_0xe72f('0x23')](function(_0x2954b2){if(_0x2954b2){return[_0x2954b2,![]];}return db[_0xe72f('0xa9')][_0xe72f('0x5c')](_0x2fc56e)[_0xe72f('0x23')](function(_0x1e6371){return[_0x1e6371,!![]];});});}})[_0xe72f('0xaa')](function(_0x13c6f9,_0x3b177a){_0x390a3e[_0xe72f('0xab')]=_0x13c6f9[_0xe72f('0x3b')]({'plain':!![]});_0x390a3e[_0xe72f('0xab')][_0xe72f('0xac')]=![];if(_0x3b177a){if(_0x390a3e['account'][_0xe72f('0xad')]){_0x390a3e[_0xe72f('0xae')][_0xe72f('0xaf')]({'id':0x0,'priority':_0x390a3e[_0xe72f('0xae')][_0xe72f('0x4c')]+0x1,'app':_0xe72f('0xb0'),'appdata':_0xe72f('0xb1'),'interval':'*,*,*,*'});}_0x390a3e[_0xe72f('0xab')][_0xe72f('0xac')]=!![];}return db[_0xe72f('0x89')][_0xe72f('0x5c')]({'phone':_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9c')],'messageId':_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x9a')],'body':_0x390a3e[_0xe72f('0x5d')][_0xe72f('0x5d')],'WhatsappAccountId':_0xa89fb5[_0xe72f('0x5a')]['id'],'WhatsappInteractionId':_0x13c6f9['id'],'direction':'in','ContactId':_0x13c6f9['ContactId'],'AttachmentId':_0x390a3e['body'][_0xe72f('0xb2')]});})['then'](function(_0x36a6d6){_0x390a3e[_0xe72f('0x2b')]=_0x36a6d6;if(_0x390a3e[_0xe72f('0xab')][_0xe72f('0xb3')]){return db[_0xe72f('0xb4')][_0xe72f('0x5b')]({'attributes':['id',_0xe72f('0x3d')],'where':{'id':_0x390a3e[_0xe72f('0xab')][_0xe72f('0xb3')]}})[_0xe72f('0x23')](function(_0x214f09){if(_0x214f09){_0x390a3e[_0xe72f('0xae')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe72f('0xb5'),'appdata':_0x214f09['name']+','+(_0x390a3e[_0xe72f('0x8e')]['waitForTheAssignedAgent']||0xa),'interval':_0xe72f('0xb6')});}return respondWithRpcPromise(_0xe72f('0xb7'),_0xe72f('0xb8'),_0x390a3e);});}return respondWithRpcPromise(_0xe72f('0xb7'),_0xe72f('0xb8'),_0x390a3e);})[_0xe72f('0x23')](function(_0x335a3d){if(_0x335a3d){var _0x1b94eb=0xc8;var _0x2abf91='receiveMessage';logger[_0xe72f('0x24')](_0xe72f('0x28'),_0x2abf91,_0x1b94eb,_0xe72f('0xb9'));logger['debug'](_0xe72f('0xba'),_0x2abf91,_0x1b94eb,'entity\x20found',JSON[_0xe72f('0xbb')](_0x335a3d));if(_0x390a3e[_0xe72f('0x8e')][_0xe72f('0x44')]===_0xe72f('0x95')){return _0x1faab1['status'](_0x1b94eb)[_0xe72f('0x36')](_0xe72f('0xbc'),_0xe72f('0xbd'))['send'](_0xe72f('0xbe'));}else{return _0x1faab1[_0xe72f('0x30')](_0x1b94eb)[_0xe72f('0x31')](_0x335a3d);}}});})['catch'](handleError(_0x1faab1,null));};exports[_0xe72f('0x3e')]=function(_0x7520cf,_0x2ba537,_0x483196){var _0x2b672d,_0x350f8c,_0x3101c0;if(_['isNil'](_0x7520cf[_0xe72f('0x5d')]['body'])||_0x7520cf[_0xe72f('0x5d')][_0xe72f('0x5d')]===''){throw new db[(_0xe72f('0x8f'))]['ValidationError'](_0xe72f('0xa1'));}if(_[_0xe72f('0x9e')](_0x7520cf[_0xe72f('0x5d')]['to'])){throw new db[(_0xe72f('0x8f'))][(_0xe72f('0xa0'))]('to\x20is\x20mandatory');}_0x2b672d=_0x7520cf['body']['to'];return db[_0xe72f('0x42')][_0xe72f('0x5b')]({'where':{'id':_0x7520cf[_0xe72f('0x5a')]['id']},'include':[{'model':db[_0xe72f('0xa5')],'as':_0xe72f('0xbf'),'include':[{'model':db['CmContact'],'as':_0xe72f('0xa7'),'where':{'mobile':_0x2b672d},'limit':0x1,'order':[[_0xe72f('0x93'),_0xe72f('0xc0')]]}]}]})[_0xe72f('0x23')](handleEntityNotFound(_0x2ba537,null))['then'](function(_0x1a2415){if(_0x1a2415&&_0x1a2415[_0xe72f('0xbf')]){_0x350f8c=_0x1a2415[_0xe72f('0x3b')]({'plain':!![]});if(_0x350f8c['List']&&_0x350f8c[_0xe72f('0xbf')][_0xe72f('0xa7')]['length']){return _0x350f8c['List'][_0xe72f('0xa7')][0x0];}return db[_0xe72f('0xa6')]['create'](_[_0xe72f('0x1b')](_0x7520cf['body'],{'firstName':_0x2b672d,'mobile':_0x2b672d,'phone':_0x2b672d,'ListId':_0x350f8c[_0xe72f('0xc1')]}));}})[_0xe72f('0x23')](handleEntityNotFound(_0x2ba537,null))[_0xe72f('0x23')](function(_0x2ad71c){if(_0x2ad71c){_0x3101c0=_0x2ad71c;return db[_0xe72f('0xa9')][_0xe72f('0x5b')]({'where':{'ContactId':_0x3101c0['id'],'closed':![],'WhatsappAccountId':_0x350f8c['id']}})[_0xe72f('0x23')](function(_0x602612){if(_0x602612){return[_0x602612,![]];}return db[_0xe72f('0xa9')][_0xe72f('0x5c')]({'UserId':_0x7520cf[_0xe72f('0xc2')]['id'],'ContactId':_0x3101c0['id'],'WhatsappAccountId':_0x350f8c['id'],'phone':_0x2b672d,'firstMsgDirection':_0xe72f('0xc3'),'Messages':[_[_0xe72f('0x52')](_0x7520cf[_0xe72f('0x5d')],{'read':![],'body':_0x7520cf[_0xe72f('0x5d')][_0xe72f('0x5d')],'phone':_0x2b672d,'WhatsappAccountId':_0x350f8c['id'],'UserId':_0x7520cf[_0xe72f('0xc2')]['id'],'ContactId':_0x3101c0['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xe72f('0xc4')}]})[_0xe72f('0x23')](function(_0x49ddff){return[_0x49ddff,!![]];});});}})[_0xe72f('0xaa')](function(_0x21e84c,_0x3bf792){if(_0x3bf792){return _0x21e84c;}return db['WhatsappMessage'][_0xe72f('0x5c')](_[_0xe72f('0x52')](_0x7520cf[_0xe72f('0x5d')],{'read':![],'body':_0x7520cf[_0xe72f('0x5d')][_0xe72f('0x5d')],'phone':_0x2b672d,'WhatsappAccountId':_0x350f8c['id'],'WhatsappInteractionId':_0x21e84c['id'],'UserId':_0x7520cf['user']['id'],'ContactId':_0x3101c0['id']}))[_0xe72f('0x23')](function(_0x3b9eb6){_0x21e84c[_0xe72f('0xc5')][_0xe72f('0xc4')]=[];_0x21e84c['dataValues'][_0xe72f('0xc4')][_0xe72f('0xaf')](_0x3b9eb6['dataValues']);return _0x21e84c;});})['then'](respondWithResult(_0x2ba537,null))['catch'](handleError(_0x2ba537,null));}; \ No newline at end of file +var _0xa647=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','status','stack','name','mandatoryDispositionPause','map','WhatsappAccount','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','includeAll','include','findAll','rows','params','options','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','userWhatsappAccount:remove','emit','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','send','getApplications','whatsapp','Applications','account','statuses','WhatsappMessage','timestamp','message_id','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','sinch','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','CmContact','DESC','Contacts','WhatsappInteraction','interaction','created','autoclose','push','close','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','CmList','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x5afd32,_0x1a9286){var _0x34ff0c=function(_0x56b4c0){while(--_0x56b4c0){_0x5afd32['push'](_0x5afd32['shift']());}};_0x34ff0c(++_0x1a9286);}(_0xa647,0xb7));var _0x7a64=function(_0x174b8a,_0xc5b506){_0x174b8a=_0x174b8a-0x0;var _0x5a119f=_0xa647[_0x174b8a];return _0x5a119f;};'use strict';var emlformat=require(_0x7a64('0x0'));var rimraf=require(_0x7a64('0x1'));var zipdir=require(_0x7a64('0x2'));var jsonpatch=require(_0x7a64('0x3'));var rp=require(_0x7a64('0x4'));var moment=require(_0x7a64('0x5'));var BPromise=require(_0x7a64('0x6'));var Mustache=require(_0x7a64('0x7'));var util=require(_0x7a64('0x8'));var path=require(_0x7a64('0x9'));var sox=require(_0x7a64('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a64('0xb'));var _=require(_0x7a64('0xc'));var squel=require(_0x7a64('0xd'));var crypto=require(_0x7a64('0xe'));var jsforce=require(_0x7a64('0xf'));var deskjs=require(_0x7a64('0x10'));var toCsv=require(_0x7a64('0x11'));var querystring=require(_0x7a64('0x12'));var Papa=require(_0x7a64('0x13'));var Redis=require(_0x7a64('0x14'));var authService=require(_0x7a64('0x15'));var qs=require(_0x7a64('0x16'));var as=require(_0x7a64('0x17'));var hardwareService=require(_0x7a64('0x18'));var logger=require(_0x7a64('0x19'))(_0x7a64('0x1a'));var utils=require(_0x7a64('0x1b'));var config=require(_0x7a64('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a64('0x1d'))['db'];config[_0x7a64('0x1e')]=_[_0x7a64('0x1f')](config[_0x7a64('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a64('0x20'))(new Redis(config[_0x7a64('0x1e')]));require(_0x7a64('0x21'))[_0x7a64('0x22')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7a64('0x23')][_0x7a64('0x24')]({'port':0x232c});function respondWithRpcPromise(_0x55f7ec,_0xffd095,_0x526466,_0x4a42a8){return new BPromise(function(_0x2b4931,_0x492786){var _0x2bdb5f=_0x4a42a8||client;return _0x2bdb5f['request'](_0x55f7ec,_0x526466)[_0x7a64('0x25')](function(_0x417a5a){logger[_0x7a64('0x26')](_0x7a64('0x27'),_0xffd095,_0x7a64('0x28'));logger['debug'](_0x7a64('0x29'),_0xffd095,_0x7a64('0x28'),JSON['stringify'](_0x417a5a));if(_0x417a5a[_0x7a64('0x2a')]){if(_0x417a5a[_0x7a64('0x2a')][_0x7a64('0x2b')]===0x1f4){logger[_0x7a64('0x2a')](_0x7a64('0x27'),_0xffd095,_0x417a5a[_0x7a64('0x2a')]['message']);return _0x492786(_0x417a5a[_0x7a64('0x2a')][_0x7a64('0x2c')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xffd095,_0x417a5a[_0x7a64('0x2a')]['message']);return _0x2b4931(_0x417a5a[_0x7a64('0x2a')][_0x7a64('0x2c')]);}else{logger[_0x7a64('0x26')](_0x7a64('0x27'),_0xffd095,'request\x20sent');_0x2b4931(_0x417a5a[_0x7a64('0x2d')][_0x7a64('0x2c')]);}})[_0x7a64('0x2e')](function(_0x4661c0){logger[_0x7a64('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0xffd095,_0x4661c0);_0x492786(_0x4661c0);});});}function respondWithStatusCode(_0x4b6860,_0x4b754d){_0x4b754d=_0x4b754d||0xcc;return function(_0x3b7523){if(_0x3b7523){return _0x4b6860[_0x7a64('0x2f')](_0x4b754d);}return _0x4b6860['status'](_0x4b754d)[_0x7a64('0x30')]();};}function respondWithResult(_0x29263e,_0xe1fd90){_0xe1fd90=_0xe1fd90||0xc8;return function(_0x135ff9){if(_0x135ff9){return _0x29263e['status'](_0xe1fd90)[_0x7a64('0x31')](_0x135ff9);}};}function respondWithFilteredResult(_0x2bd0e6,_0x230c32){return function(_0x222874){if(_0x222874){var _0xbc4827=typeof _0x230c32[_0x7a64('0x32')]===_0x7a64('0x33')&&typeof _0x230c32[_0x7a64('0x34')]===_0x7a64('0x33');var _0x202e45=_0x222874[_0x7a64('0x35')];var _0x5b9cde=_0xbc4827?0x0:_0x230c32[_0x7a64('0x32')];var _0x10a939=_0xbc4827?_0x222874[_0x7a64('0x35')]:_0x230c32[_0x7a64('0x32')]+_0x230c32[_0x7a64('0x34')];var _0x538395;if(_0x10a939>=_0x202e45){_0x10a939=_0x202e45;_0x538395=0xc8;}else{_0x538395=0xce;}_0x2bd0e6['status'](_0x538395);return _0x2bd0e6[_0x7a64('0x36')](_0x7a64('0x37'),_0x5b9cde+'-'+_0x10a939+'/'+_0x202e45)['json'](_0x222874);}return null;};}function patchUpdates(_0x33cd2b){return function(_0x284eeb){try{jsonpatch[_0x7a64('0x38')](_0x284eeb,_0x33cd2b,!![]);}catch(_0x455012){return BPromise[_0x7a64('0x39')](_0x455012);}return _0x284eeb[_0x7a64('0x3a')]();};}function saveUpdates(_0x297fa2,_0x330349){return function(_0x1fe008){if(_0x1fe008){return _0x1fe008[_0x7a64('0x3b')](_0x297fa2)['then'](function(_0x296327){return _0x296327;});}return null;};}function removeEntity(_0x2a4e05,_0x20753b){return function(_0x24173e){if(_0x24173e){return _0x24173e[_0x7a64('0x3c')]()[_0x7a64('0x25')](function(){var _0x4e7ca1=_0x24173e[_0x7a64('0x3d')]({'plain':!![]});var _0x5b61c1=_0x7a64('0x3e');return db[_0x7a64('0x3f')][_0x7a64('0x3c')]({'where':{'type':_0x5b61c1,'resourceId':_0x4e7ca1['id']}})[_0x7a64('0x25')](function(){return _0x24173e;});})['then'](function(){_0x2a4e05[_0x7a64('0x40')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56bc7c,_0x58b0a1){return function(_0x429bcc){if(!_0x429bcc){_0x56bc7c['sendStatus'](0x194);}return _0x429bcc;};}function handleError(_0x578be2,_0x5b140f){_0x5b140f=_0x5b140f||0x1f4;return function(_0x457b95){logger[_0x7a64('0x2a')](_0x457b95[_0x7a64('0x41')]);if(_0x457b95[_0x7a64('0x42')]){delete _0x457b95[_0x7a64('0x42')];}_0x578be2[_0x7a64('0x40')](_0x5b140f)['send'](_0x457b95);};}exports['index']=function(_0x2fc790,_0x5200cc){var _0x267f29={'include':[{'model':db['Pause'],'as':_0x7a64('0x43')}]},_0x2fac34={},_0x3aa5bf={'count':0x0,'rows':[]};var _0x2232a9=_[_0x7a64('0x44')](db[_0x7a64('0x45')]['rawAttributes'],function(_0x248ef8){return{'name':_0x248ef8['fieldName'],'type':_0x248ef8['type'][_0x7a64('0x46')]};});_0x2fac34['model']=_[_0x7a64('0x44')](_0x2232a9,'name');_0x2fac34['query']=_[_0x7a64('0x47')](_0x2fc790['query']);_0x2fac34[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x2fac34[_0x7a64('0x4a')],_0x2fac34[_0x7a64('0x4b')]);_0x267f29[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x2fac34[_0x7a64('0x4a')],qs[_0x7a64('0x4d')](_0x2fc790[_0x7a64('0x4b')]['fields']));_0x267f29['attributes']=_0x267f29['attributes'][_0x7a64('0x4e')]?_0x267f29[_0x7a64('0x4c')]:_0x2fac34[_0x7a64('0x4a')];if(!_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x4f')](_0x7a64('0x50'))){_0x267f29[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0x2fc790[_0x7a64('0x4b')]['limit']);_0x267f29[_0x7a64('0x32')]=qs[_0x7a64('0x32')](_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x32')]);}_0x267f29['order']=qs['sort'](_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x51')]);_0x267f29[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_['pick'](_0x2fc790[_0x7a64('0x4b')],_0x2fac34[_0x7a64('0x48')]),_0x2232a9);if(_0x2fc790['query'][_0x7a64('0x53')]){_0x267f29['where']=_[_0x7a64('0x54')](_0x267f29[_0x7a64('0x52')],{'$or':_[_0x7a64('0x44')](_0x2232a9,function(_0x3e8d61){if(_0x3e8d61[_0x7a64('0x55')]!=='VIRTUAL'){var _0x13014d={};_0x13014d[_0x3e8d61[_0x7a64('0x42')]]={'$like':'%'+_0x2fc790[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x13014d;}})});}_0x267f29=_['merge']({},_0x267f29,_0x2fc790['options']);var _0x4f0c33={'where':_0x267f29[_0x7a64('0x52')]};return db[_0x7a64('0x45')][_0x7a64('0x35')](_0x4f0c33)[_0x7a64('0x25')](function(_0x56a2a4){_0x3aa5bf[_0x7a64('0x35')]=_0x56a2a4;if(_0x2fc790['query'][_0x7a64('0x56')]){_0x267f29[_0x7a64('0x57')]=[{'all':!![]}];}return db[_0x7a64('0x45')][_0x7a64('0x58')](_0x267f29);})['then'](function(_0x29c733){_0x3aa5bf[_0x7a64('0x59')]=_0x29c733;return _0x3aa5bf;})[_0x7a64('0x25')](respondWithFilteredResult(_0x5200cc,_0x267f29))[_0x7a64('0x2e')](handleError(_0x5200cc,null));};exports['show']=function(_0x7bd291,_0x3a6ecf){var _0x40e1a3={'raw':![],'where':{'id':_0x7bd291[_0x7a64('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x7a64('0x43')}]},_0x4c10bd={};_0x4c10bd['model']=_[_0x7a64('0x47')](db[_0x7a64('0x45')]['rawAttributes']);_0x4c10bd[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0x7bd291['query']);_0x4c10bd[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x4c10bd['model'],_0x4c10bd[_0x7a64('0x4b')]);_0x40e1a3[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x4c10bd['model'],qs[_0x7a64('0x4d')](_0x7bd291[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x40e1a3[_0x7a64('0x4c')]=_0x40e1a3['attributes'][_0x7a64('0x4e')]?_0x40e1a3[_0x7a64('0x4c')]:_0x4c10bd['model'];if(_0x7bd291[_0x7a64('0x4b')]['includeAll']){_0x40e1a3[_0x7a64('0x57')]=[{'all':!![]}];}_0x40e1a3=_[_0x7a64('0x54')]({},_0x40e1a3,_0x7bd291[_0x7a64('0x5b')]);return db[_0x7a64('0x45')][_0x7a64('0x5c')](_0x40e1a3)[_0x7a64('0x25')](handleEntityNotFound(_0x3a6ecf,null))[_0x7a64('0x25')](respondWithResult(_0x3a6ecf,null))[_0x7a64('0x2e')](handleError(_0x3a6ecf,null));};exports[_0x7a64('0x5d')]=function(_0x340fc9,_0x11ec28){return db[_0x7a64('0x45')][_0x7a64('0x5d')](_0x340fc9[_0x7a64('0x5e')],{})['then'](function(_0x730c23){var _0x33e29d=_0x340fc9['user'][_0x7a64('0x3d')]({'plain':!![]});if(!_0x33e29d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33e29d[_0x7a64('0x5f')]===_0x7a64('0x60')){var _0x29375c=_0x730c23['get']({'plain':!![]});var _0x5791ee=_0x7a64('0x3e');return db[_0x7a64('0x61')][_0x7a64('0x5c')]({'where':{'name':_0x5791ee,'userProfileId':_0x33e29d[_0x7a64('0x62')]},'raw':!![]})[_0x7a64('0x25')](function(_0x306a53){if(_0x306a53&&_0x306a53['autoAssociation']===0x0){return db[_0x7a64('0x3f')][_0x7a64('0x5d')]({'name':_0x29375c[_0x7a64('0x42')],'resourceId':_0x29375c['id'],'type':_0x306a53[_0x7a64('0x42')],'sectionId':_0x306a53['id']},{})[_0x7a64('0x25')](function(){return _0x730c23;});}else{return _0x730c23;}})[_0x7a64('0x2e')](function(_0x100ca8){logger[_0x7a64('0x2a')](_0x7a64('0x63'),_0x100ca8);throw _0x100ca8;});}return _0x730c23;})[_0x7a64('0x25')](respondWithResult(_0x11ec28,0xc9))[_0x7a64('0x2e')](handleError(_0x11ec28,null));};exports['update']=function(_0x419dbb,_0x46817b){if(_0x419dbb[_0x7a64('0x5e')]['id']){delete _0x419dbb[_0x7a64('0x5e')]['id'];}return db[_0x7a64('0x45')]['find']({'where':{'id':_0x419dbb[_0x7a64('0x5a')]['id']},'include':[{'model':db[_0x7a64('0x64')],'as':_0x7a64('0x43')}]})[_0x7a64('0x25')](handleEntityNotFound(_0x46817b,null))['then'](saveUpdates(_0x419dbb[_0x7a64('0x5e')],null))['then'](respondWithResult(_0x46817b,null))[_0x7a64('0x2e')](handleError(_0x46817b,null));};exports[_0x7a64('0x3c')]=function(_0x319fbf,_0x8f473){return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x319fbf[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x8f473,null))[_0x7a64('0x25')](removeEntity(_0x8f473,null))[_0x7a64('0x2e')](handleError(_0x8f473,null));};exports[_0x7a64('0x65')]=function(_0x225574,_0x3c3524){return db[_0x7a64('0x45')][_0x7a64('0x65')]()[_0x7a64('0x25')](respondWithResult(_0x3c3524,null))[_0x7a64('0x2e')](handleError(_0x3c3524,null));};exports[_0x7a64('0x66')]=function(_0x4dfa1e,_0x106306,_0x53aad2){if(_0x4dfa1e[_0x7a64('0x5e')]['id']){delete _0x4dfa1e['body']['id'];}return db[_0x7a64('0x45')]['find']({'where':{'id':_0x4dfa1e[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x106306,null))[_0x7a64('0x25')](function(_0x36bdb4){if(_0x36bdb4){_0x4dfa1e[_0x7a64('0x5e')][_0x7a64('0x67')]=_0x36bdb4['id'];return db[_0x7a64('0x68')][_0x7a64('0x5d')](_0x4dfa1e[_0x7a64('0x5e')]);}})[_0x7a64('0x25')](respondWithResult(_0x106306,null))[_0x7a64('0x2e')](handleError(_0x106306,null));};exports[_0x7a64('0x69')]=function(_0x3c0374,_0x239a90,_0x3a9b34){var _0x101081={'raw':![],'where':{}};var _0x2a5c3e={};var _0x5ebe19={'count':0x0,'rows':[]};return db[_0x7a64('0x45')][_0x7a64('0x6a')]({'where':{'id':_0x3c0374['params']['id']}})['then'](handleEntityNotFound(_0x239a90,null))[_0x7a64('0x25')](function(_0x2792d9){if(_0x2792d9){_0x2a5c3e['model']=_['keys'](db['Disposition'][_0x7a64('0x6b')]);_0x2a5c3e[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0x3c0374[_0x7a64('0x4b')]);_0x2a5c3e[_0x7a64('0x48')]=_['intersection'](_0x2a5c3e[_0x7a64('0x4a')],_0x2a5c3e[_0x7a64('0x4b')]);_0x101081[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x2a5c3e['model'],qs['fields'](_0x3c0374[_0x7a64('0x4b')]['fields']));_0x101081[_0x7a64('0x4c')]=_0x101081[_0x7a64('0x4c')][_0x7a64('0x4e')]?_0x101081['attributes']:_0x2a5c3e[_0x7a64('0x4a')];if(!_0x3c0374['query']['hasOwnProperty'](_0x7a64('0x50'))){_0x101081['limit']=qs[_0x7a64('0x34')](_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x34')]);_0x101081['offset']=qs[_0x7a64('0x32')](_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x32')]);}_0x101081[_0x7a64('0x6c')]=qs[_0x7a64('0x51')](_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x51')]);_0x101081[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_[_0x7a64('0x6d')](_0x3c0374['query'],_0x2a5c3e[_0x7a64('0x48')]));_0x101081[_0x7a64('0x52')]['WhatsappAccountId']=_0x2792d9['id'];if(_0x3c0374['query'][_0x7a64('0x53')]){_0x101081[_0x7a64('0x52')]=_[_0x7a64('0x54')](_0x101081['where'],{'$or':_[_0x7a64('0x44')](_0x101081[_0x7a64('0x4c')],function(_0x2ab644){var _0x334267={};_0x334267[_0x2ab644]={'$like':'%'+_0x3c0374[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x334267;})});}_0x101081=_[_0x7a64('0x54')]({},_0x101081,_0x3c0374[_0x7a64('0x5b')]);return db[_0x7a64('0x68')][_0x7a64('0x35')]({'where':_0x101081[_0x7a64('0x52')]})[_0x7a64('0x25')](function(_0x4771aa){_0x5ebe19[_0x7a64('0x35')]=_0x4771aa;if(_0x3c0374['query'][_0x7a64('0x56')]){_0x101081['include']=[{'all':!![]}];}return db[_0x7a64('0x68')]['findAll'](_0x101081);})['then'](function(_0x4310a4){_0x5ebe19[_0x7a64('0x59')]=_0x4310a4;return _0x5ebe19;});}})[_0x7a64('0x25')](respondWithFilteredResult(_0x239a90,_0x101081))['catch'](handleError(_0x239a90,null));};exports[_0x7a64('0x6e')]=function(_0xa5b3e3,_0x188de9,_0x458288){return db['WhatsappAccount'][_0x7a64('0x5c')]({'where':{'id':_0xa5b3e3[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x188de9,null))[_0x7a64('0x25')](function(_0x4dc2e8){if(_0x4dc2e8){return _0x4dc2e8[_0x7a64('0x6e')](_0xa5b3e3['query'][_0x7a64('0x6f')]);}})['then'](respondWithStatusCode(_0x188de9,null))['catch'](handleError(_0x188de9,null));};exports[_0x7a64('0x70')]=function(_0x5e4e67,_0x2cdf85,_0x2c4c26){if(_0x5e4e67[_0x7a64('0x5e')]['id']){delete _0x5e4e67[_0x7a64('0x5e')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5e4e67['params']['id']}})['then'](handleEntityNotFound(_0x2cdf85,null))[_0x7a64('0x25')](function(_0x3c90dc){if(_0x3c90dc){_0x5e4e67[_0x7a64('0x5e')][_0x7a64('0x67')]=_0x3c90dc['id'];return db[_0x7a64('0x71')]['create'](_0x5e4e67[_0x7a64('0x5e')]);}})[_0x7a64('0x25')](respondWithResult(_0x2cdf85,null))['catch'](handleError(_0x2cdf85,null));};exports[_0x7a64('0x72')]=function(_0xcc8230,_0x45ba32,_0x40e4f0){var _0x3db6fa={'raw':![],'where':{}};var _0x160362={};var _0x41d28e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7a64('0x6a')]({'where':{'id':_0xcc8230[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x45ba32,null))['then'](function(_0x5934f4){if(_0x5934f4){_0x160362[_0x7a64('0x4a')]=_[_0x7a64('0x47')](db['CannedAnswer'][_0x7a64('0x6b')]);_0x160362[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0xcc8230[_0x7a64('0x4b')]);_0x160362[_0x7a64('0x48')]=_['intersection'](_0x160362[_0x7a64('0x4a')],_0x160362[_0x7a64('0x4b')]);_0x3db6fa[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x160362['model'],qs['fields'](_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x3db6fa[_0x7a64('0x4c')]=_0x3db6fa[_0x7a64('0x4c')]['length']?_0x3db6fa[_0x7a64('0x4c')]:_0x160362[_0x7a64('0x4a')];if(!_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x4f')](_0x7a64('0x50'))){_0x3db6fa[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0xcc8230[_0x7a64('0x4b')]['limit']);_0x3db6fa[_0x7a64('0x32')]=qs[_0x7a64('0x32')](_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x32')]);}_0x3db6fa[_0x7a64('0x6c')]=qs['sort'](_0xcc8230['query'][_0x7a64('0x51')]);_0x3db6fa[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_[_0x7a64('0x6d')](_0xcc8230[_0x7a64('0x4b')],_0x160362[_0x7a64('0x48')]));_0x3db6fa['where'][_0x7a64('0x67')]=_0x5934f4['id'];if(_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x53')]){_0x3db6fa[_0x7a64('0x52')]=_[_0x7a64('0x54')](_0x3db6fa[_0x7a64('0x52')],{'$or':_['map'](_0x3db6fa['attributes'],function(_0x389662){var _0x4d6060={};_0x4d6060[_0x389662]={'$like':'%'+_0xcc8230['query'][_0x7a64('0x53')]+'%'};return _0x4d6060;})});}_0x3db6fa=_['merge']({},_0x3db6fa,_0xcc8230[_0x7a64('0x5b')]);return db['CannedAnswer'][_0x7a64('0x35')]({'where':_0x3db6fa['where']})['then'](function(_0x30fbaa){_0x41d28e[_0x7a64('0x35')]=_0x30fbaa;if(_0xcc8230[_0x7a64('0x4b')][_0x7a64('0x56')]){_0x3db6fa['include']=[{'all':!![]}];}return db[_0x7a64('0x71')][_0x7a64('0x58')](_0x3db6fa);})[_0x7a64('0x25')](function(_0x308839){_0x41d28e[_0x7a64('0x59')]=_0x308839;return _0x41d28e;});}})[_0x7a64('0x25')](respondWithFilteredResult(_0x45ba32,_0x3db6fa))['catch'](handleError(_0x45ba32,null));};exports['removeAnswers']=function(_0x102d94,_0x2990de,_0x284fad){return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x102d94['params']['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x2990de,null))[_0x7a64('0x25')](function(_0x915b1){if(_0x915b1){return _0x915b1[_0x7a64('0x73')](_0x102d94[_0x7a64('0x4b')][_0x7a64('0x6f')]);}})[_0x7a64('0x25')](respondWithStatusCode(_0x2990de,null))[_0x7a64('0x2e')](handleError(_0x2990de,null));};exports[_0x7a64('0x74')]=function(_0x100c48,_0x2dfc40,_0x3618cd){return db['WhatsappAccount']['find']({'where':{'id':_0x100c48[_0x7a64('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2dfc40,null))[_0x7a64('0x25')](function(_0x46e0f4){if(_0x46e0f4){return _0x46e0f4[_0x7a64('0x74')](_0x100c48[_0x7a64('0x5e')][_0x7a64('0x6f')],_[_0x7a64('0x75')](_0x100c48[_0x7a64('0x5e')],['ids','id'])||{})[_0x7a64('0x76')](function(_0x112c16){for(var _0x287178=0x0;_0x287178<_0x100c48[_0x7a64('0x5e')]['ids'][_0x7a64('0x4e')];_0x287178+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x100c48['body']['ids'][_0x287178]),'WhatsappAccountId':Number(_0x100c48[_0x7a64('0x5a')]['id'])});}return _0x112c16;});}})[_0x7a64('0x25')](respondWithResult(_0x2dfc40,null))[_0x7a64('0x2e')](handleError(_0x2dfc40,null));};exports[_0x7a64('0x77')]=function(_0x5c5e9c,_0x5d10af,_0x217609){return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x5c5e9c[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x5d10af,null))[_0x7a64('0x25')](function(_0x34df47){if(_0x34df47){return _0x34df47[_0x7a64('0x77')](_0x5c5e9c[_0x7a64('0x4b')][_0x7a64('0x6f')])[_0x7a64('0x25')](function(){if(_['isArray'](_0x5c5e9c[_0x7a64('0x4b')][_0x7a64('0x6f')])){for(var _0x3c061f=0x0;_0x3c061f<_0x5c5e9c[_0x7a64('0x4b')][_0x7a64('0x6f')][_0x7a64('0x4e')];_0x3c061f+=0x1){socket['emit'](_0x7a64('0x78'),{'UserId':Number(_0x5c5e9c[_0x7a64('0x4b')]['ids'][_0x3c061f]),'WhatsappAccountId':Number(_0x5c5e9c[_0x7a64('0x5a')]['id'])});}}else{socket[_0x7a64('0x79')](_0x7a64('0x78'),{'UserId':Number(_0x5c5e9c['query'][_0x7a64('0x6f')]),'WhatsappAccountId':Number(_0x5c5e9c[_0x7a64('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d10af,null))[_0x7a64('0x2e')](handleError(_0x5d10af,null));};exports['getAgents']=function(_0x490b50,_0x37adaa,_0x3e3b88){var _0x135c36={};var _0x53de36={};var _0x20b120;var _0x13cfab;return db[_0x7a64('0x45')][_0x7a64('0x6a')]({'where':{'id':_0x490b50[_0x7a64('0x5a')]['id']}})[_0x7a64('0x25')](handleEntityNotFound(_0x37adaa,null))[_0x7a64('0x25')](function(_0x2930a0){if(_0x2930a0){_0x20b120=_0x2930a0;_0x53de36[_0x7a64('0x4a')]=_[_0x7a64('0x47')](db[_0x7a64('0x7a')]['rawAttributes']);_0x53de36['query']=_[_0x7a64('0x47')](_0x490b50['query']);_0x53de36[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x53de36[_0x7a64('0x4a')],_0x53de36[_0x7a64('0x4b')]);_0x135c36[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x53de36['model'],qs['fields'](_0x490b50[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x135c36[_0x7a64('0x4c')]=_0x135c36['attributes'][_0x7a64('0x4e')]?_0x135c36['attributes']:_0x53de36[_0x7a64('0x4a')];_0x135c36['order']=qs[_0x7a64('0x51')](_0x490b50[_0x7a64('0x4b')][_0x7a64('0x51')]);_0x135c36['where']=qs[_0x7a64('0x48')](_[_0x7a64('0x6d')](_0x490b50[_0x7a64('0x4b')],_0x53de36[_0x7a64('0x48')]));if(_0x490b50[_0x7a64('0x4b')][_0x7a64('0x53')]){_0x135c36[_0x7a64('0x52')]=_[_0x7a64('0x54')](_0x135c36[_0x7a64('0x52')],{'$or':_[_0x7a64('0x44')](_0x135c36['attributes'],function(_0x4c72a3){var _0x2336c0={};_0x2336c0[_0x4c72a3]={'$like':'%'+_0x490b50[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x2336c0;})});}_0x135c36=_[_0x7a64('0x54')]({},_0x135c36,_0x490b50[_0x7a64('0x5b')]);return _0x20b120[_0x7a64('0x7b')](_0x135c36);}})[_0x7a64('0x25')](function(_0x208f92){if(_0x208f92){_0x13cfab=_0x208f92[_0x7a64('0x4e')];if(!_0x490b50[_0x7a64('0x4b')]['hasOwnProperty']('nolimit')){_0x135c36[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0x490b50[_0x7a64('0x4b')][_0x7a64('0x34')]);_0x135c36[_0x7a64('0x32')]=qs['offset'](_0x490b50['query']['offset']);}return _0x20b120[_0x7a64('0x7b')](_0x135c36);}})[_0x7a64('0x25')](function(_0x33ce4e){if(_0x33ce4e){return _0x33ce4e?{'count':_0x13cfab,'rows':_0x33ce4e}:null;}})[_0x7a64('0x25')](respondWithResult(_0x37adaa,null))[_0x7a64('0x2e')](handleError(_0x37adaa,null));};exports[_0x7a64('0x7c')]=function(_0x2ba022,_0x17b1ae){var _0xa3514c=_0x2ba022[_0x7a64('0x5a')]['id'];var _0x3cc597=_0x2ba022[_0x7a64('0x5e')];var _0x420ae2=0xc8;var _0x4c7b51=null;return db[_0x7a64('0x7d')][_0x7a64('0x7e')]({'isolationLevel':db[_0x7a64('0x7d')][_0x7a64('0x7f')][_0x7a64('0x80')][_0x7a64('0x81')]},function(_0xae3de3){return db['WhatsappAccount']['findOne']({'where':{'id':_0xa3514c},'transaction':_0xae3de3})[_0x7a64('0x25')](function(_0x3b46c7){if(_0x3b46c7){return db['WhatsappApplication'][_0x7a64('0x3c')]({'where':{'WhatsappAccountId':_0xa3514c},'transaction':_0xae3de3})[_0x7a64('0x25')](function(){var _0x127c1c=_[_0x7a64('0x44')](_0x3cc597,function(_0x1e21c4){_0x1e21c4[_0x7a64('0x67')]=_0xa3514c;return _0x1e21c4;});return db['WhatsappApplication'][_0x7a64('0x82')](_0x127c1c,{'transaction':_0xae3de3});});}else{_0x420ae2=0x194;_0x4c7b51=[];}});})['then'](function(){if(_0x420ae2!==0x194){return db[_0x7a64('0x83')][_0x7a64('0x84')]({'where':{'WhatsappAccountId':_0xa3514c},'order':_0x7a64('0x85')})['then'](function(_0x4c1158){_0x4c7b51=_0x4c1158;});}})[_0x7a64('0x2e')](function(_0x55c12f){_0x420ae2=0x1f4;logger[_0x7a64('0x2a')](_0x55c12f[_0x7a64('0x41')]);if(_0x55c12f[_0x7a64('0x42')]){delete _0x55c12f[_0x7a64('0x42')];}_0x4c7b51=_0x55c12f;})['finally'](function(){if(_0x4c7b51===null){_0x17b1ae[_0x7a64('0x2f')](_0x420ae2);}else{if(_0x420ae2===0x1f4){_0x17b1ae[_0x7a64('0x40')](_0x420ae2)[_0x7a64('0x86')](_0x4c7b51);}else{_0x17b1ae[_0x7a64('0x40')](_0x420ae2)[_0x7a64('0x31')](_0x4c7b51);}}});};exports['getApplications']=function(_0x2b1083,_0x46beae,_0x5f0dc7){var _0x4b2ddb={};var _0x1392da={};var _0x142ab1;var _0x22814d;return db[_0x7a64('0x45')][_0x7a64('0x6a')]({'where':{'id':_0x2b1083['params']['id']}})['then'](handleEntityNotFound(_0x46beae,null))['then'](function(_0x5be65f){if(_0x5be65f){_0x142ab1=_0x5be65f;_0x1392da[_0x7a64('0x4a')]=_[_0x7a64('0x47')](db[_0x7a64('0x83')]['rawAttributes']);_0x1392da[_0x7a64('0x4b')]=_[_0x7a64('0x47')](_0x2b1083[_0x7a64('0x4b')]);_0x1392da[_0x7a64('0x48')]=_[_0x7a64('0x49')](_0x1392da['model'],_0x1392da[_0x7a64('0x4b')]);_0x4b2ddb[_0x7a64('0x4c')]=_[_0x7a64('0x49')](_0x1392da['model'],qs['fields'](_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x4d')]));_0x4b2ddb[_0x7a64('0x4c')]=_0x4b2ddb[_0x7a64('0x4c')][_0x7a64('0x4e')]?_0x4b2ddb[_0x7a64('0x4c')]:_0x1392da[_0x7a64('0x4a')];_0x4b2ddb[_0x7a64('0x6c')]=qs[_0x7a64('0x51')](_0x2b1083[_0x7a64('0x4b')]['sort']);_0x4b2ddb[_0x7a64('0x52')]=qs[_0x7a64('0x48')](_['pick'](_0x2b1083[_0x7a64('0x4b')],_0x1392da[_0x7a64('0x48')]));if(_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x53')]){_0x4b2ddb['where']=_[_0x7a64('0x54')](_0x4b2ddb[_0x7a64('0x52')],{'$or':_[_0x7a64('0x44')](_0x4b2ddb[_0x7a64('0x4c')],function(_0xaa3411){var _0x466317={};_0x466317[_0xaa3411]={'$like':'%'+_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x53')]+'%'};return _0x466317;})});}_0x4b2ddb=_[_0x7a64('0x54')]({},_0x4b2ddb,_0x2b1083[_0x7a64('0x5b')]);return _0x142ab1[_0x7a64('0x87')](_0x4b2ddb);}})['then'](function(_0x2f2930){if(_0x2f2930){_0x22814d=_0x2f2930[_0x7a64('0x4e')];if(!_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x4f')](_0x7a64('0x50'))){_0x4b2ddb[_0x7a64('0x34')]=qs[_0x7a64('0x34')](_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x34')]);_0x4b2ddb[_0x7a64('0x32')]=qs[_0x7a64('0x32')](_0x2b1083[_0x7a64('0x4b')][_0x7a64('0x32')]);}return _0x142ab1[_0x7a64('0x87')](_0x4b2ddb);}})['then'](function(_0x4d35b8){if(_0x4d35b8){return _0x4d35b8?{'count':_0x22814d,'rows':_0x4d35b8}:null;}})[_0x7a64('0x25')](respondWithResult(_0x46beae,null))[_0x7a64('0x2e')](handleError(_0x46beae,null));};exports['notify']=function(_0x1391c4,_0x5f0fa9,_0x20138e){var _0x5e2962={'channel':_0x7a64('0x88')};var _0x17b3e7=[];var _0x42235c=[];var _0x586b91={};return db[_0x7a64('0x45')][_0x7a64('0x5c')]({'where':{'id':_0x1391c4[_0x7a64('0x5a')]['id']},'include':[{'model':db[_0x7a64('0x83')],'as':_0x7a64('0x89')}]})[_0x7a64('0x25')](handleEntityNotFound(_0x5f0fa9,null))['then'](function(_0x2e0375){_0x5e2962[_0x7a64('0x8a')]=_0x2e0375;if(_0x5e2962[_0x7a64('0x8a')]&&_0x5e2962['account'][_0x7a64('0x55')]==='sinch'&&_0x1391c4[_0x7a64('0x5e')]['statuses']){if(_0x1391c4['body'][_0x7a64('0x8b')][_0x7a64('0x4e')]===0x0)return;if(_0x1391c4['body']['statuses'][0x0]['state']!=='read')return;return db[_0x7a64('0x8c')][_0x7a64('0x3b')]({'read':!![],'readAt':_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x8b')][0x0][_0x7a64('0x8d')]},{'where':{'messageId':_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x8b')][0x0][_0x7a64('0x8e')]},'individualHooks':!![]})['then'](function(_0x48896e){return _0x5f0fa9[_0x7a64('0x40')](0xc8)[_0x7a64('0x31')](_0x48896e);});}_0x5e2962[_0x7a64('0x8f')]=_['orderBy'](_0x2e0375[_0x7a64('0x89')],[_0x7a64('0x85')],[_0x7a64('0x90')]);if(_0x5e2962[_0x7a64('0x8a')][_0x7a64('0x89')]){delete _0x5e2962[_0x7a64('0x8a')]['Applications'];}return db['CmContact'][_0x7a64('0x65')]()[_0x7a64('0x25')](function(_0x5e97d3){if(!_0x5e97d3){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))](_0x7a64('0x93'));}_0x17b3e7=_[_0x7a64('0x94')](_[_0x7a64('0x47')](_0x5e97d3),['createdAt',_0x7a64('0x95')]);_0x42235c=_['difference'](_[_0x7a64('0x47')](_0x5e97d3),[_0x7a64('0x96'),_0x7a64('0x95'),'CompanyId',_0x7a64('0x97')]);_0x5e2962['body']={'mapKey':_0x7a64('0x98')};if(_0x5e2962[_0x7a64('0x8a')]&&_0x5e2962['account'][_0x7a64('0x55')]===_0x7a64('0x99')){_0x5e2962['body'][_0x7a64('0x9a')]=_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x9b')][_0x7a64('0x9c')](_0x7a64('0x9d'),'');_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x5e')]=_0x1391c4[_0x7a64('0x5e')][_0x7a64('0x9e')];_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9f')]=_0x1391c4[_0x7a64('0x5e')]['MessageSid'];}if(_0x5e2962['account']&&_0x5e2962['account'][_0x7a64('0x55')]===_0x7a64('0xa0')){_0x5e2962['body'][_0x7a64('0x9a')]=_0x1391c4[_0x7a64('0x5e')]['notifications'][0x0][_0x7a64('0x9a')];_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x5e')]=_0x1391c4[_0x7a64('0x5e')][_0x7a64('0xa1')][0x0][_0x7a64('0x2c')]['body'];_0x5e2962[_0x7a64('0x5e')]['messageId']=_0x1391c4[_0x7a64('0x5e')]['notifications'][0x0][_0x7a64('0x8e')];}if(_0x5e2962[_0x7a64('0x5e')]['id']){delete _0x5e2962[_0x7a64('0x5e')]['id'];}if(_[_0x7a64('0xa2')](_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')])){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))](_0x7a64('0xa3'));}if(_['isNil'](_0x5e2962[_0x7a64('0x5e')]['body'])||_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x5e')]===''){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))](_0x7a64('0xa4'));}if(_[_0x7a64('0xa2')](_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')])){throw new db['Sequelize'][(_0x7a64('0x92'))](_0x7a64('0xa6')+_0x42235c);}if(!_[_0x7a64('0xa7')](_0x42235c,_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')])){throw new db['Sequelize'][(_0x7a64('0x92'))](_0x7a64('0xa8')+_0x42235c);}_0x586b91[_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')]]=_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')];return db['CmList'][_0x7a64('0x5c')]({'where':{'id':_0x5e2962[_0x7a64('0x8a')][_0x7a64('0x97')]},'include':[{'model':db[_0x7a64('0xa9')],'as':'Contacts','where':_0x586b91,'limit':0x1,'order':[[_0x7a64('0x95'),_0x7a64('0xaa')]]}]});})[_0x7a64('0x25')](handleEntityNotFound(_0x5f0fa9,null))[_0x7a64('0x25')](function(_0x33a2b1){if(_0x33a2b1){_0x5e2962['list']=_[_0x7a64('0x75')](_0x33a2b1,[_0x7a64('0xab')]);if(_0x33a2b1[_0x7a64('0xab')][_0x7a64('0x4e')]){return _0x33a2b1[_0x7a64('0xab')][0x0];}var _0x427515=_[_0x7a64('0x1f')](_0x5e2962[_0x7a64('0x5e')],{'firstName':_0x5e2962[_0x7a64('0x5e')]['from'],'ListId':_0x33a2b1['id']});_0x427515[_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xa5')]]=_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')];return db['CmContact'][_0x7a64('0x5d')](_0x427515,{'fields':_0x17b3e7,'raw':!![]});}})[_0x7a64('0x25')](handleEntityNotFound(_0x5f0fa9,null))[_0x7a64('0x25')](function(_0xe670a0){if(_0xe670a0){_0x5e2962['contact']=_0xe670a0;var _0x9da720={'ContactId':_0xe670a0['id'],'phone':_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')],'WhatsappAccountId':_0x1391c4[_0x7a64('0x5a')]['id']};var _0x35e929={'ContactId':_0xe670a0['id'],'WhatsappAccountId':_0x1391c4[_0x7a64('0x5a')]['id'],'closed':![]};return db[_0x7a64('0xac')]['find']({'where':_0x35e929})[_0x7a64('0x25')](function(_0x4a4507){if(_0x4a4507){return[_0x4a4507,![]];}return db[_0x7a64('0xac')][_0x7a64('0x5d')](_0x9da720)[_0x7a64('0x25')](function(_0x317564){return[_0x317564,!![]];});});}})[_0x7a64('0x76')](function(_0x5e84f3,_0x129f3d){_0x5e2962['interaction']=_0x5e84f3[_0x7a64('0x3d')]({'plain':!![]});_0x5e2962[_0x7a64('0xad')][_0x7a64('0xae')]=![];if(_0x129f3d){if(_0x5e2962['account'][_0x7a64('0xaf')]){_0x5e2962[_0x7a64('0x8f')][_0x7a64('0xb0')]({'id':0x0,'priority':_0x5e2962[_0x7a64('0x8f')][_0x7a64('0x4e')]+0x1,'app':_0x7a64('0xb1'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x5e2962[_0x7a64('0xad')][_0x7a64('0xae')]=!![];}return db[_0x7a64('0x8c')]['create']({'phone':_0x5e2962[_0x7a64('0x5e')][_0x7a64('0x9a')],'messageId':_0x5e2962[_0x7a64('0x5e')]['messageId'],'body':_0x5e2962[_0x7a64('0x5e')]['body'],'WhatsappAccountId':_0x1391c4[_0x7a64('0x5a')]['id'],'WhatsappInteractionId':_0x5e84f3['id'],'direction':'in','ContactId':_0x5e84f3[_0x7a64('0xb2')],'AttachmentId':_0x5e2962[_0x7a64('0x5e')][_0x7a64('0xb3')]});})[_0x7a64('0x25')](function(_0x43bc26){_0x5e2962[_0x7a64('0x2c')]=_0x43bc26;if(_0x5e2962[_0x7a64('0xad')][_0x7a64('0xb4')]){return db['User'][_0x7a64('0x5c')]({'attributes':['id',_0x7a64('0x42')],'where':{'id':_0x5e2962[_0x7a64('0xad')][_0x7a64('0xb4')]}})[_0x7a64('0x25')](function(_0x1bae26){if(_0x1bae26){_0x5e2962['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x7a64('0xb5'),'appdata':_0x1bae26[_0x7a64('0x42')]+','+(_0x5e2962[_0x7a64('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':_0x7a64('0xb6')});}return respondWithRpcPromise(_0x7a64('0xb7'),_0x7a64('0xb8'),_0x5e2962);});}return respondWithRpcPromise(_0x7a64('0xb7'),'startRouting',_0x5e2962);})['then'](function(_0xe8b459){if(_0xe8b459){var _0x446a5a=0xc8;var _0x6fa22e=_0x7a64('0xb9');logger[_0x7a64('0x26')](_0x7a64('0x29'),_0x6fa22e,_0x446a5a,'entity\x20found');logger['debug'](_0x7a64('0xba'),_0x6fa22e,_0x446a5a,_0x7a64('0xbb'),JSON[_0x7a64('0xbc')](_0xe8b459));if(_0x5e2962[_0x7a64('0x8a')][_0x7a64('0x55')]===_0x7a64('0x99')){return _0x5f0fa9[_0x7a64('0x40')](_0x446a5a)[_0x7a64('0x36')](_0x7a64('0xbd'),_0x7a64('0xbe'))[_0x7a64('0x86')](_0x7a64('0xbf'));}else{return _0x5f0fa9[_0x7a64('0x40')](_0x446a5a)[_0x7a64('0x31')](_0xe8b459);}}});})[_0x7a64('0x2e')](handleError(_0x5f0fa9,null));};exports[_0x7a64('0x86')]=function(_0x105f6d,_0x1d5e3a,_0x4cd2d8){var _0x3eda6a,_0x28be42,_0x5cd71f;if(_[_0x7a64('0xa2')](_0x105f6d[_0x7a64('0x5e')][_0x7a64('0x5e')])||_0x105f6d['body'][_0x7a64('0x5e')]===''){throw new db['Sequelize'][(_0x7a64('0x92'))](_0x7a64('0xa4'));}if(_[_0x7a64('0xa2')](_0x105f6d['body']['to'])){throw new db[(_0x7a64('0x91'))][(_0x7a64('0x92'))]('to\x20is\x20mandatory');}_0x3eda6a=_0x105f6d[_0x7a64('0x5e')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x105f6d[_0x7a64('0x5a')]['id']},'include':[{'model':db[_0x7a64('0xc0')],'as':_0x7a64('0xc1'),'include':[{'model':db[_0x7a64('0xa9')],'as':_0x7a64('0xab'),'where':{'mobile':_0x3eda6a},'limit':0x1,'order':[[_0x7a64('0x95'),'DESC']]}]}]})[_0x7a64('0x25')](handleEntityNotFound(_0x1d5e3a,null))[_0x7a64('0x25')](function(_0x56d0b5){if(_0x56d0b5&&_0x56d0b5['List']){_0x28be42=_0x56d0b5[_0x7a64('0x3d')]({'plain':!![]});if(_0x28be42[_0x7a64('0xc1')]&&_0x28be42[_0x7a64('0xc1')][_0x7a64('0xab')][_0x7a64('0x4e')]){return _0x28be42['List'][_0x7a64('0xab')][0x0];}return db[_0x7a64('0xa9')][_0x7a64('0x5d')](_[_0x7a64('0x1f')](_0x105f6d['body'],{'firstName':_0x3eda6a,'mobile':_0x3eda6a,'phone':_0x3eda6a,'ListId':_0x28be42[_0x7a64('0x97')]}));}})['then'](handleEntityNotFound(_0x1d5e3a,null))[_0x7a64('0x25')](function(_0x1d04e7){if(_0x1d04e7){_0x5cd71f=_0x1d04e7;return db[_0x7a64('0xac')][_0x7a64('0x5c')]({'where':{'ContactId':_0x5cd71f['id'],'closed':![],'WhatsappAccountId':_0x28be42['id']}})['then'](function(_0x196396){if(_0x196396){return[_0x196396,![]];}return db[_0x7a64('0xac')][_0x7a64('0x5d')]({'UserId':_0x105f6d[_0x7a64('0x60')]['id'],'ContactId':_0x5cd71f['id'],'WhatsappAccountId':_0x28be42['id'],'phone':_0x3eda6a,'firstMsgDirection':_0x7a64('0xc2'),'Messages':[_[_0x7a64('0x54')](_0x105f6d[_0x7a64('0x5e')],{'read':![],'body':_0x105f6d[_0x7a64('0x5e')][_0x7a64('0x5e')],'phone':_0x3eda6a,'WhatsappAccountId':_0x28be42['id'],'UserId':_0x105f6d[_0x7a64('0x60')]['id'],'ContactId':_0x5cd71f['id']})]},{'include':[{'model':db[_0x7a64('0x8c')],'as':_0x7a64('0xc3')}]})[_0x7a64('0x25')](function(_0x3dfdc6){return[_0x3dfdc6,!![]];});});}})['spread'](function(_0x290015,_0x4e9e92){if(_0x4e9e92){return _0x290015;}return db[_0x7a64('0x8c')][_0x7a64('0x5d')](_[_0x7a64('0x54')](_0x105f6d[_0x7a64('0x5e')],{'read':![],'body':_0x105f6d['body'][_0x7a64('0x5e')],'phone':_0x3eda6a,'WhatsappAccountId':_0x28be42['id'],'WhatsappInteractionId':_0x290015['id'],'UserId':_0x105f6d['user']['id'],'ContactId':_0x5cd71f['id']}))[_0x7a64('0x25')](function(_0x4e4a46){_0x290015[_0x7a64('0xc4')][_0x7a64('0xc3')]=[];_0x290015[_0x7a64('0xc4')]['Messages'][_0x7a64('0xb0')](_0x4e4a46['dataValues']);return _0x290015;});})[_0x7a64('0x25')](respondWithResult(_0x1d5e3a,null))[_0x7a64('0x2e')](handleError(_0x1d5e3a,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 676203b..c0079cb 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 _0xd059=['hook','exports','WhatsappAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0xd059,0x1f2));var _0x9d05=function(_0x31e799,_0xda2436){_0x31e799=_0x31e799-0x0;var _0x32943f=_0xd059[_0x31e799];return _0x32943f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x9d05('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9d05('0x1'),'afterUpdate':_0x9d05('0x2'),'afterDestroy':_0x9d05('0x3')};function emitEvent(_0x4a5e90){return function(_0x3b73ca,_0x488a69,_0x15d546){WhatsappAccountEvents[_0x9d05('0x4')](_0x4a5e90+':'+_0x3b73ca['id'],_0x3b73ca);WhatsappAccountEvents['emit'](_0x4a5e90,_0x3b73ca);_0x15d546(null);};}for(var e in events){if(events[_0x9d05('0x5')](e)){var event=events[e];WhatsappAccount[_0x9d05('0x6')](e,emitEvent(event));}}module[_0x9d05('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x1522=['exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3feb3c,_0x4379b5){var _0x33e0c0=function(_0x4910e3){while(--_0x4910e3){_0x3feb3c['push'](_0x3feb3c['shift']());}};_0x33e0c0(++_0x4379b5);}(_0x1522,0x1ba));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2152('0x0'));var WhatsappAccount=require(_0x2152('0x1'))['db'][_0x2152('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2152('0x3')](0x0);var events={'afterCreate':_0x2152('0x4'),'afterUpdate':_0x2152('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5ad08d){return function(_0xf461af,_0xbfb28e,_0x18bb62){WhatsappAccountEvents[_0x2152('0x6')](_0x5ad08d+':'+_0xf461af['id'],_0xf461af);WhatsappAccountEvents['emit'](_0x5ad08d,_0xf461af);_0x18bb62(null);};}for(var e in events){if(events[_0x2152('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2152('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 3391485..2dc1ca4 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 _0x27ae=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x10776c,_0x4d65ec){var _0x5ec3a3=function(_0xdbf23a){while(--_0xdbf23a){_0x10776c['push'](_0x10776c['shift']());}};_0x5ec3a3(++_0x4d65ec);}(_0x27ae,0x9c));var _0xe27a=function(_0x3dacf8,_0x4d6188){_0x3dacf8=_0x3dacf8-0x0;var _0x9cb0fa=_0x27ae[_0x3dacf8];return _0x9cb0fa;};'use strict';var _=require(_0xe27a('0x0'));var util=require(_0xe27a('0x1'));var logger=require(_0xe27a('0x2'))(_0xe27a('0x3'));var moment=require(_0xe27a('0x4'));var BPromise=require(_0xe27a('0x5'));var rp=require(_0xe27a('0x6'));var fs=require('fs');var path=require(_0xe27a('0x7'));var rimraf=require('rimraf');var config=require(_0xe27a('0x8'));var attributes=require(_0xe27a('0x9'));module[_0xe27a('0xa')]=function(_0x36c59c,_0xc9eede){return _0x36c59c[_0xe27a('0xb')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44fb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','util','api'];(function(_0x5e068e,_0x28ff2e){var _0x329514=function(_0x1c9815){while(--_0x1c9815){_0x5e068e['push'](_0x5e068e['shift']());}};_0x329514(++_0x28ff2e);}(_0x44fb,0x1e2));var _0xb44f=function(_0x17baf7,_0x232f8c){_0x17baf7=_0x17baf7-0x0;var _0x1b6115=_0x44fb[_0x17baf7];return _0x1b6115;};'use strict';var _=require('lodash');var util=require(_0xb44f('0x0'));var logger=require('../../config/logger')(_0xb44f('0x1'));var moment=require(_0xb44f('0x2'));var BPromise=require(_0xb44f('0x3'));var rp=require(_0xb44f('0x4'));var fs=require('fs');var path=require(_0xb44f('0x5'));var rimraf=require(_0xb44f('0x6'));var config=require(_0xb44f('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xb44f('0x8')]=function(_0x5a247c,_0x97d206){return _0x5a247c[_0xb44f('0x9')](_0xb44f('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 288811e..aef08b5 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 _0x87e5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','ShowWhatsappAccount','find','options','where','attributes','include','model','map','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x221ca3,_0xb25dd3){var _0x5974e4=function(_0x4c1607){while(--_0x4c1607){_0x221ca3['push'](_0x221ca3['shift']());}};_0x5974e4(++_0xb25dd3);}(_0x87e5,0xc1));var _0x587e=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x87e5[_0x13cab0];return _0x38804f;};'use strict';var _=require(_0x587e('0x0'));var util=require(_0x587e('0x1'));var moment=require('moment');var BPromise=require(_0x587e('0x2'));var rs=require(_0x587e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x587e('0x4'))['db'];var utils=require(_0x587e('0x5'));var logger=require(_0x587e('0x6'))(_0x587e('0x7'));var config=require(_0x587e('0x8'));var jayson=require(_0x587e('0x9'));var client=jayson['client'][_0x587e('0xa')]({'port':0x232a});config[_0x587e('0xb')]=_[_0x587e('0xc')](config[_0x587e('0xb')],{'host':_0x587e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5ef4d2,_0x270658,_0x3780d4){return new BPromise(function(_0x1d1dd5,_0x3763cf){return client[_0x587e('0xe')](_0x5ef4d2,_0x3780d4)[_0x587e('0xf')](function(_0x1284a2){logger[_0x587e('0x10')](_0x587e('0x11'),_0x270658,_0x587e('0x12'));logger['debug'](_0x587e('0x13'),_0x270658,_0x587e('0x12'),JSON['stringify'](_0x1284a2));if(_0x1284a2['error']){if(_0x1284a2[_0x587e('0x14')]['code']===0x1f4){logger[_0x587e('0x14')](_0x587e('0x11'),_0x270658,_0x1284a2[_0x587e('0x14')][_0x587e('0x15')]);return _0x3763cf(_0x1284a2['error']['message']);}logger[_0x587e('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x270658,_0x1284a2[_0x587e('0x14')]['message']);return _0x1d1dd5(_0x1284a2[_0x587e('0x14')][_0x587e('0x15')]);}else{logger[_0x587e('0x10')](_0x587e('0x11'),_0x270658,_0x587e('0x12'));_0x1d1dd5(_0x1284a2[_0x587e('0x16')][_0x587e('0x15')]);}})['catch'](function(_0x451c4f){logger[_0x587e('0x14')](_0x587e('0x11'),_0x270658,_0x451c4f);_0x3763cf(_0x451c4f);});});}exports[_0x587e('0x17')]=function(_0xa03a03){var _0x4bc007=this;return new Promise(function(_0x1b5c49,_0x49648e){return db['WhatsappAccount'][_0x587e('0x18')]({'raw':_0xa03a03[_0x587e('0x19')]?_0xa03a03[_0x587e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xa03a03[_0x587e('0x19')]?_0xa03a03[_0x587e('0x19')][_0x587e('0x1a')]||null:null,'attributes':_0xa03a03[_0x587e('0x19')]?_0xa03a03[_0x587e('0x19')][_0x587e('0x1b')]||null:null,'include':_0xa03a03[_0x587e('0x19')]?_0xa03a03['options']['include']?_['map'](_0xa03a03['options'][_0x587e('0x1c')],function(_0x47086c){return{'model':db[_0x47086c['model']],'as':_0x47086c['as'],'attributes':_0x47086c['attributes'],'include':_0x47086c[_0x587e('0x1c')]?_['map'](_0x47086c[_0x587e('0x1c')],function(_0x580794){return{'model':db[_0x580794[_0x587e('0x1d')]],'as':_0x580794['as'],'attributes':_0x580794['attributes'],'include':_0x580794[_0x587e('0x1c')]?_[_0x587e('0x1e')](_0x580794[_0x587e('0x1c')],function(_0xced0da){return{'model':db[_0xced0da['model']],'as':_0xced0da['as'],'attributes':_0xced0da[_0x587e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x587e('0xf')](function(_0x180293){logger[_0x587e('0x10')](_0x587e('0x17'),_0xa03a03);logger[_0x587e('0x1f')](_0x587e('0x17'),_0xa03a03,JSON['stringify'](_0x180293));_0x1b5c49(_0x180293);})[_0x587e('0x20')](function(_0x232452){logger[_0x587e('0x14')](_0x587e('0x17'),_0x232452['message'],_0xa03a03);_0x49648e(_0x4bc007[_0x587e('0x14')](0x1f4,_0x232452[_0x587e('0x15')]));});});}; \ No newline at end of file +var _0x9e75=['error','code','message','result','catch','ShowWhatsappAccount','find','options','raw','where','attributes','include','model','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x5407c4,_0x3cb4c8){var _0x3a1c46=function(_0x49fb40){while(--_0x49fb40){_0x5407c4['push'](_0x5407c4['shift']());}};_0x3a1c46(++_0x3cb4c8);}(_0x9e75,0x1ca));var _0x59e7=function(_0x42edcb,_0x42dc81){_0x42edcb=_0x42edcb-0x0;var _0x36c026=_0x9e75[_0x42edcb];return _0x36c026;};'use strict';var _=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var moment=require(_0x59e7('0x2'));var BPromise=require('bluebird');var rs=require(_0x59e7('0x3'));var fs=require('fs');var Redis=require(_0x59e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x59e7('0x5'));var logger=require('../../config/logger')(_0x59e7('0x6'));var config=require(_0x59e7('0x7'));var jayson=require(_0x59e7('0x8'));var client=jayson[_0x59e7('0x9')][_0x59e7('0xa')]({'port':0x232a});config['redis']=_[_0x59e7('0xb')](config[_0x59e7('0xc')],{'host':_0x59e7('0xd'),'port':0x18eb});var socket=require(_0x59e7('0xe'))(new Redis(config[_0x59e7('0xc')]));require(_0x59e7('0xf'))[_0x59e7('0x10')](socket);function respondWithRpcPromise(_0x131ede,_0x2d76c0,_0x1c71ee){return new BPromise(function(_0x30a315,_0xd6eb29){return client['request'](_0x131ede,_0x1c71ee)[_0x59e7('0x11')](function(_0x26652d){logger[_0x59e7('0x12')](_0x59e7('0x13'),_0x2d76c0,_0x59e7('0x14'));logger[_0x59e7('0x15')](_0x59e7('0x16'),_0x2d76c0,_0x59e7('0x14'),JSON['stringify'](_0x26652d));if(_0x26652d[_0x59e7('0x17')]){if(_0x26652d[_0x59e7('0x17')][_0x59e7('0x18')]===0x1f4){logger[_0x59e7('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2d76c0,_0x26652d[_0x59e7('0x17')]['message']);return _0xd6eb29(_0x26652d['error'][_0x59e7('0x19')]);}logger[_0x59e7('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x2d76c0,_0x26652d[_0x59e7('0x17')][_0x59e7('0x19')]);return _0x30a315(_0x26652d[_0x59e7('0x17')][_0x59e7('0x19')]);}else{logger[_0x59e7('0x12')](_0x59e7('0x13'),_0x2d76c0,_0x59e7('0x14'));_0x30a315(_0x26652d[_0x59e7('0x1a')][_0x59e7('0x19')]);}})[_0x59e7('0x1b')](function(_0x19c955){logger[_0x59e7('0x17')](_0x59e7('0x13'),_0x2d76c0,_0x19c955);_0xd6eb29(_0x19c955);});});}exports[_0x59e7('0x1c')]=function(_0x16a8e3){var _0x23b53f=this;return new Promise(function(_0x581366,_0xba1952){return db['WhatsappAccount'][_0x59e7('0x1d')]({'raw':_0x16a8e3[_0x59e7('0x1e')]?_0x16a8e3['options'][_0x59e7('0x1f')]===undefined?!![]:![]:!![],'where':_0x16a8e3[_0x59e7('0x1e')]?_0x16a8e3[_0x59e7('0x1e')][_0x59e7('0x20')]||null:null,'attributes':_0x16a8e3['options']?_0x16a8e3[_0x59e7('0x1e')][_0x59e7('0x21')]||null:null,'include':_0x16a8e3['options']?_0x16a8e3['options'][_0x59e7('0x22')]?_['map'](_0x16a8e3[_0x59e7('0x1e')][_0x59e7('0x22')],function(_0x5d1fcc){return{'model':db[_0x5d1fcc[_0x59e7('0x23')]],'as':_0x5d1fcc['as'],'attributes':_0x5d1fcc['attributes'],'include':_0x5d1fcc[_0x59e7('0x22')]?_['map'](_0x5d1fcc[_0x59e7('0x22')],function(_0x10d650){return{'model':db[_0x10d650[_0x59e7('0x23')]],'as':_0x10d650['as'],'attributes':_0x10d650[_0x59e7('0x21')],'include':_0x10d650['include']?_['map'](_0x10d650[_0x59e7('0x22')],function(_0x2fd5de){return{'model':db[_0x2fd5de[_0x59e7('0x23')]],'as':_0x2fd5de['as'],'attributes':_0x2fd5de[_0x59e7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ac3be){logger[_0x59e7('0x12')](_0x59e7('0x1c'),_0x16a8e3);logger[_0x59e7('0x15')](_0x59e7('0x1c'),_0x16a8e3,JSON[_0x59e7('0x24')](_0x2ac3be));_0x581366(_0x2ac3be);})['catch'](function(_0x57a519){logger[_0x59e7('0x17')](_0x59e7('0x1c'),_0x57a519['message'],_0x16a8e3);_0xba1952(_0x23b53f[_0x59e7('0x17')](0x1f4,_0x57a519[_0x59e7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c51552a..eaa16b0 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 _0x2bcd=['register','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bcd,0x1a9));var _0xd2bc=function(_0x19a0ad,_0x328495){_0x19a0ad=_0x19a0ad-0x0;var _0x46e3f3=_0x2bcd[_0x19a0ad];return _0x46e3f3;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xd2bc('0x0'),'remove',_0xd2bc('0x1')];function createListener(_0x5b7b5d,_0x462384){return function(_0x114b49){_0x462384[_0xd2bc('0x2')](_0x5b7b5d,_0x114b49);};}function removeListener(_0x1281dd,_0x121ad3){return function(){WhatsappAccountEvents['removeListener'](_0x1281dd,_0x121ad3);};}exports[_0xd2bc('0x3')]=function(_0x3a95dd){for(var _0xb7b984=0x0,_0x290647=events['length'];_0xb7b984<_0x290647;_0xb7b984++){var _0x3e98ea=events[_0xb7b984];var _0x523aa0=createListener('whatsappAccount:'+_0x3e98ea,_0x3a95dd);WhatsappAccountEvents['on'](_0x3e98ea,_0x523aa0);}}; \ No newline at end of file +var _0xdc68=['save','remove','update','removeListener','register','length','./whatsappAccount.events'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xdc68,0xa7));var _0x8dc6=function(_0x2bfb95,_0x3d6b56){_0x2bfb95=_0x2bfb95-0x0;var _0x449d66=_0xdc68[_0x2bfb95];return _0x449d66;};'use strict';var WhatsappAccountEvents=require(_0x8dc6('0x0'));var events=[_0x8dc6('0x1'),_0x8dc6('0x2'),_0x8dc6('0x3')];function createListener(_0x522333,_0x27872a){return function(_0x488e21){_0x27872a['emit'](_0x522333,_0x488e21);};}function removeListener(_0x85680b,_0x3b9fc8){return function(){WhatsappAccountEvents[_0x8dc6('0x4')](_0x85680b,_0x3b9fc8);};}exports[_0x8dc6('0x5')]=function(_0x58bf42){for(var _0x5390d9=0x0,_0x1181b6=events[_0x8dc6('0x6')];_0x5390d9<_0x1181b6;_0x5390d9++){var _0x18d3d8=events[_0x5390d9];var _0x4abb3d=createListener('whatsappAccount:'+_0x18d3d8,_0x58bf42);WhatsappAccountEvents['on'](_0x18d3d8,_0x4abb3d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3c4a90e..1c11af7 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 _0xb4af=['destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete'];(function(_0x18e8c8,_0x5b6b81){var _0x1fa76e=function(_0x369790){while(--_0x369790){_0x18e8c8['push'](_0x18e8c8['shift']());}};_0x1fa76e(++_0x5b6b81);}(_0xb4af,0x19a));var _0xfb4a=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb4af[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0xfb4a('0x0'));var util=require('util');var path=require(_0xfb4a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfb4a('0x2'));var router=express['Router']();var fs_extra=require(_0xfb4a('0x3'));var auth=require(_0xfb4a('0x4'));var interaction=require(_0xfb4a('0x5'));var config=require(_0xfb4a('0x6'));var controller=require('./whatsappApplication.controller');router[_0xfb4a('0x7')]('/',auth[_0xfb4a('0x8')](),controller[_0xfb4a('0x9')]);router[_0xfb4a('0x7')](_0xfb4a('0xa'),auth['isAuthenticated'](),controller[_0xfb4a('0xb')]);router[_0xfb4a('0xc')]('/',auth[_0xfb4a('0x8')](),controller['create']);router[_0xfb4a('0xd')]('/:id',auth[_0xfb4a('0x8')](),controller['update']);router[_0xfb4a('0xe')](_0xfb4a('0xa'),auth[_0xfb4a('0x8')](),controller[_0xfb4a('0xf')]);module[_0xfb4a('0x10')]=router; \ No newline at end of file +var _0x447b=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x56dbbd,_0x53a898){var _0x26012c=function(_0x558b27){while(--_0x558b27){_0x56dbbd['push'](_0x56dbbd['shift']());}};_0x26012c(++_0x53a898);}(_0x447b,0x1ee));var _0xb447=function(_0x8c318b,_0x309481){_0x8c318b=_0x8c318b-0x0;var _0x3c000a=_0x447b[_0x8c318b];return _0x3c000a;};'use strict';var multer=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var path=require(_0xb447('0x2'));var timeout=require(_0xb447('0x3'));var express=require('express');var router=express[_0xb447('0x4')]();var fs_extra=require(_0xb447('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb447('0x6'));var config=require(_0xb447('0x7'));var controller=require('./whatsappApplication.controller');router[_0xb447('0x8')]('/',auth[_0xb447('0x9')](),controller[_0xb447('0xa')]);router[_0xb447('0x8')](_0xb447('0xb'),auth[_0xb447('0x9')](),controller[_0xb447('0xc')]);router[_0xb447('0xd')]('/',auth[_0xb447('0x9')](),controller['create']);router[_0xb447('0xe')](_0xb447('0xb'),auth[_0xb447('0x9')](),controller[_0xb447('0xf')]);router[_0xb447('0x10')]('/:id',auth[_0xb447('0x9')](),controller[_0xb447('0x11')]);module[_0xb447('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 55d8f70..16edf00 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 _0xd0b6=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3d96f0,_0x5b38e3){var _0x1f076c=function(_0x1b09c8){while(--_0x1b09c8){_0x3d96f0['push'](_0x3d96f0['shift']());}};_0x1f076c(++_0x5b38e3);}(_0xd0b6,0x8d));var _0x6d0b=function(_0x39cff5,_0x234f0c){_0x39cff5=_0x39cff5-0x0;var _0x430437=_0xd0b6[_0x39cff5];return _0x430437;};'use strict';var Sequelize=require(_0x6d0b('0x0'));module[_0x6d0b('0x1')]={'priority':{'type':Sequelize[_0x6d0b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6d0b('0x3')],'allowNull':![],'defaultValue':_0x6d0b('0x4')},'appdata':{'type':Sequelize[_0x6d0b('0x5')]()},'description':{'type':Sequelize[_0x6d0b('0x3')]},'interval':{'type':Sequelize[_0x6d0b('0x3')],'defaultValue':_0x6d0b('0x6')}}; \ No newline at end of file +var _0x8a6b=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3b7eb5,_0xdb63f8){var _0xbe1830=function(_0x5be6cf){while(--_0x5be6cf){_0x3b7eb5['push'](_0x3b7eb5['shift']());}};_0xbe1830(++_0xdb63f8);}(_0x8a6b,0x1ef));var _0xb8a6=function(_0x5bb343,_0xe17bb5){_0x5bb343=_0x5bb343-0x0;var _0x3ab062=_0x8a6b[_0x5bb343];return _0x3ab062;};'use strict';var Sequelize=require(_0xb8a6('0x0'));module[_0xb8a6('0x1')]={'priority':{'type':Sequelize[_0xb8a6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb8a6('0x3')],'allowNull':![],'defaultValue':_0xb8a6('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb8a6('0x3')]},'interval':{'type':Sequelize[_0xb8a6('0x3')],'defaultValue':_0xb8a6('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 571a384..87ec0f3 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 _0xb8cb=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x505500,_0x2f5a52){var _0x2bf37a=function(_0x3be956){while(--_0x3be956){_0x505500['push'](_0x505500['shift']());}};_0x2bf37a(++_0x2f5a52);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x5eff18,_0x5bd9c0){_0x5eff18=_0x5eff18-0x0;var _0x1383f0=_0xb8cb[_0x5eff18];return _0x1383f0;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file +var _0xa817=['count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','merge','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit'];(function(_0x188337,_0x4e3280){var _0x205fde=function(_0x1ed4fd){while(--_0x1ed4fd){_0x188337['push'](_0x188337['shift']());}};_0x205fde(++_0x4e3280);}(_0xa817,0x7b));var _0x7a81=function(_0x3f9b1d,_0x21b2a8){_0x3f9b1d=_0x3f9b1d-0x0;var _0x4acf85=_0xa817[_0x3f9b1d];return _0x4acf85;};'use strict';var emlformat=require(_0x7a81('0x0'));var rimraf=require(_0x7a81('0x1'));var zipdir=require(_0x7a81('0x2'));var jsonpatch=require(_0x7a81('0x3'));var rp=require(_0x7a81('0x4'));var moment=require(_0x7a81('0x5'));var BPromise=require(_0x7a81('0x6'));var Mustache=require(_0x7a81('0x7'));var util=require(_0x7a81('0x8'));var path=require('path');var sox=require(_0x7a81('0x9'));var csv=require(_0x7a81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a81('0xb'));var _=require(_0x7a81('0xc'));var squel=require(_0x7a81('0xd'));var crypto=require(_0x7a81('0xe'));var jsforce=require(_0x7a81('0xf'));var deskjs=require(_0x7a81('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7a81('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a81('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7a81('0x13'));var hardwareService=require(_0x7a81('0x14'));var logger=require(_0x7a81('0x15'))(_0x7a81('0x16'));var utils=require(_0x7a81('0x17'));var config=require(_0x7a81('0x18'));var licenseUtil=require(_0x7a81('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12a089,_0x32c90e){_0x32c90e=_0x32c90e||0xcc;return function(_0xc5cdf2){if(_0xc5cdf2){return _0x12a089['sendStatus'](_0x32c90e);}return _0x12a089[_0x7a81('0x1a')](_0x32c90e)[_0x7a81('0x1b')]();};}function respondWithResult(_0x2977a9,_0x4ca2d3){_0x4ca2d3=_0x4ca2d3||0xc8;return function(_0x43141a){if(_0x43141a){return _0x2977a9[_0x7a81('0x1a')](_0x4ca2d3)['json'](_0x43141a);}};}function respondWithFilteredResult(_0x4aef24,_0x1ce514){return function(_0x208a7b){if(_0x208a7b){var _0x584c0c=typeof _0x1ce514[_0x7a81('0x1c')]===_0x7a81('0x1d')&&typeof _0x1ce514[_0x7a81('0x1e')]===_0x7a81('0x1d');var _0xed69fc=_0x208a7b[_0x7a81('0x1f')];var _0x114cfa=_0x584c0c?0x0:_0x1ce514[_0x7a81('0x1c')];var _0x2b5720=_0x584c0c?_0x208a7b[_0x7a81('0x1f')]:_0x1ce514[_0x7a81('0x1c')]+_0x1ce514[_0x7a81('0x1e')];var _0x1aefdf;if(_0x2b5720>=_0xed69fc){_0x2b5720=_0xed69fc;_0x1aefdf=0xc8;}else{_0x1aefdf=0xce;}_0x4aef24['status'](_0x1aefdf);return _0x4aef24[_0x7a81('0x20')](_0x7a81('0x21'),_0x114cfa+'-'+_0x2b5720+'/'+_0xed69fc)[_0x7a81('0x22')](_0x208a7b);}return null;};}function patchUpdates(_0x3087c0){return function(_0x3b0786){try{jsonpatch[_0x7a81('0x23')](_0x3b0786,_0x3087c0,!![]);}catch(_0x34dd0b){return BPromise[_0x7a81('0x24')](_0x34dd0b);}return _0x3b0786[_0x7a81('0x25')]();};}function saveUpdates(_0x596a8c,_0x3c0c41){return function(_0x26b384){if(_0x26b384){return _0x26b384[_0x7a81('0x26')](_0x596a8c)[_0x7a81('0x27')](function(_0x26556b){return _0x26556b;});}return null;};}function removeEntity(_0x15a1cd,_0x249ae1){return function(_0x21c45a){if(_0x21c45a){return _0x21c45a['destroy']()[_0x7a81('0x27')](function(){_0x15a1cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2476,_0x41ea68){return function(_0x13d2ae){if(!_0x13d2ae){_0x1e2476['sendStatus'](0x194);}return _0x13d2ae;};}function handleError(_0x2abcf4,_0x35f521){_0x35f521=_0x35f521||0x1f4;return function(_0x87e708){logger[_0x7a81('0x28')](_0x87e708[_0x7a81('0x29')]);if(_0x87e708['name']){delete _0x87e708[_0x7a81('0x2a')];}_0x2abcf4[_0x7a81('0x1a')](_0x35f521)[_0x7a81('0x2b')](_0x87e708);};}exports[_0x7a81('0x2c')]=function(_0x29655a,_0x3295df){var _0x31fe26={},_0x551c14={},_0x1a0232={'count':0x0,'rows':[]};var _0x5b79ea=_[_0x7a81('0x2d')](db[_0x7a81('0x2e')][_0x7a81('0x2f')],function(_0x523d39){return{'name':_0x523d39[_0x7a81('0x30')],'type':_0x523d39['type']['key']};});_0x551c14[_0x7a81('0x31')]=_[_0x7a81('0x2d')](_0x5b79ea,_0x7a81('0x2a'));_0x551c14[_0x7a81('0x32')]=_[_0x7a81('0x33')](_0x29655a['query']);_0x551c14[_0x7a81('0x34')]=_[_0x7a81('0x35')](_0x551c14[_0x7a81('0x31')],_0x551c14[_0x7a81('0x32')]);_0x31fe26[_0x7a81('0x36')]=_[_0x7a81('0x35')](_0x551c14[_0x7a81('0x31')],qs['fields'](_0x29655a[_0x7a81('0x32')][_0x7a81('0x37')]));_0x31fe26[_0x7a81('0x36')]=_0x31fe26['attributes'][_0x7a81('0x38')]?_0x31fe26[_0x7a81('0x36')]:_0x551c14[_0x7a81('0x31')];if(!_0x29655a[_0x7a81('0x32')]['hasOwnProperty'](_0x7a81('0x39'))){_0x31fe26[_0x7a81('0x1e')]=qs[_0x7a81('0x1e')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x1e')]);_0x31fe26['offset']=qs[_0x7a81('0x1c')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x1c')]);}_0x31fe26[_0x7a81('0x3a')]=qs[_0x7a81('0x3b')](_0x29655a[_0x7a81('0x32')][_0x7a81('0x3b')]);_0x31fe26['where']=qs['filters'](_[_0x7a81('0x3c')](_0x29655a[_0x7a81('0x32')],_0x551c14['filters']),_0x5b79ea);if(_0x29655a[_0x7a81('0x32')][_0x7a81('0x3d')]){_0x31fe26[_0x7a81('0x3e')]=_['merge'](_0x31fe26[_0x7a81('0x3e')],{'$or':_[_0x7a81('0x2d')](_0x5b79ea,function(_0x4be82f){if(_0x4be82f[_0x7a81('0x3f')]!==_0x7a81('0x40')){var _0x475aac={};_0x475aac[_0x4be82f['name']]={'$like':'%'+_0x29655a[_0x7a81('0x32')][_0x7a81('0x3d')]+'%'};return _0x475aac;}})});}_0x31fe26=_['merge']({},_0x31fe26,_0x29655a[_0x7a81('0x41')]);var _0x315db1={'where':_0x31fe26[_0x7a81('0x3e')]};return db[_0x7a81('0x2e')][_0x7a81('0x1f')](_0x315db1)[_0x7a81('0x27')](function(_0x4723ea){_0x1a0232['count']=_0x4723ea;if(_0x29655a['query'][_0x7a81('0x42')]){_0x31fe26[_0x7a81('0x43')]=[{'all':!![]}];}return db[_0x7a81('0x2e')][_0x7a81('0x44')](_0x31fe26);})[_0x7a81('0x27')](function(_0x25ef87){_0x1a0232[_0x7a81('0x45')]=_0x25ef87;return _0x1a0232;})[_0x7a81('0x27')](respondWithFilteredResult(_0x3295df,_0x31fe26))[_0x7a81('0x46')](handleError(_0x3295df,null));};exports['show']=function(_0x28f628,_0x58777a){var _0x4f9bb7={'raw':!![],'where':{'id':_0x28f628['params']['id']}},_0x611df={};_0x611df['model']=_[_0x7a81('0x33')](db[_0x7a81('0x2e')][_0x7a81('0x2f')]);_0x611df[_0x7a81('0x32')]=_[_0x7a81('0x33')](_0x28f628[_0x7a81('0x32')]);_0x611df[_0x7a81('0x34')]=_[_0x7a81('0x35')](_0x611df[_0x7a81('0x31')],_0x611df[_0x7a81('0x32')]);_0x4f9bb7[_0x7a81('0x36')]=_[_0x7a81('0x35')](_0x611df[_0x7a81('0x31')],qs['fields'](_0x28f628[_0x7a81('0x32')][_0x7a81('0x37')]));_0x4f9bb7[_0x7a81('0x36')]=_0x4f9bb7[_0x7a81('0x36')][_0x7a81('0x38')]?_0x4f9bb7['attributes']:_0x611df[_0x7a81('0x31')];if(_0x28f628[_0x7a81('0x32')][_0x7a81('0x42')]){_0x4f9bb7['include']=[{'all':!![]}];}_0x4f9bb7=_[_0x7a81('0x47')]({},_0x4f9bb7,_0x28f628[_0x7a81('0x41')]);return db[_0x7a81('0x2e')][_0x7a81('0x48')](_0x4f9bb7)[_0x7a81('0x27')](handleEntityNotFound(_0x58777a,null))[_0x7a81('0x27')](respondWithResult(_0x58777a,null))[_0x7a81('0x46')](handleError(_0x58777a,null));};exports['create']=function(_0x40c17c,_0x473e42){return db[_0x7a81('0x2e')][_0x7a81('0x49')](_0x40c17c[_0x7a81('0x4a')],{})[_0x7a81('0x27')](respondWithResult(_0x473e42,0xc9))['catch'](handleError(_0x473e42,null));};exports['update']=function(_0x31a0aa,_0x7fb80){if(_0x31a0aa[_0x7a81('0x4a')]['id']){delete _0x31a0aa[_0x7a81('0x4a')]['id'];}return db['WhatsappApplication'][_0x7a81('0x48')]({'where':{'id':_0x31a0aa[_0x7a81('0x4b')]['id']}})[_0x7a81('0x27')](handleEntityNotFound(_0x7fb80,null))[_0x7a81('0x27')](saveUpdates(_0x31a0aa[_0x7a81('0x4a')],null))['then'](respondWithResult(_0x7fb80,null))['catch'](handleError(_0x7fb80,null));};exports[_0x7a81('0x4c')]=function(_0x450f67,_0x1ed652){return db['WhatsappApplication'][_0x7a81('0x48')]({'where':{'id':_0x450f67[_0x7a81('0x4b')]['id']}})[_0x7a81('0x27')](handleEntityNotFound(_0x1ed652,null))[_0x7a81('0x27')](removeEntity(_0x1ed652,null))['catch'](handleError(_0x1ed652,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4ee1aeb..5a8add0 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 _0x98a8=['../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x11733a,_0x465d47){var _0x2bee7d=function(_0x29640f){while(--_0x29640f){_0x11733a['push'](_0x11733a['shift']());}};_0x2bee7d(++_0x465d47);}(_0x98a8,0x12c));var _0x898a=function(_0x53a7a2,_0x3dae53){_0x53a7a2=_0x53a7a2-0x0;var _0x175780=_0x98a8[_0x53a7a2];return _0x175780;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));module[_0x898a('0xa')]=function(_0x3e7ddd,_0x5d7e59){return _0x3e7ddd[_0x898a('0xb')]('WhatsappApplication',attributes,{'tableName':_0x898a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x898a('0xd')});}; \ No newline at end of file +var _0xc997=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x26bbb8,_0x12e79a){var _0x27becc=function(_0x15251a){while(--_0x15251a){_0x26bbb8['push'](_0x26bbb8['shift']());}};_0x27becc(++_0x12e79a);}(_0xc997,0x1ac));var _0x7c99=function(_0x45bd41,_0x19b2a0){_0x45bd41=_0x45bd41-0x0;var _0xd955e8=_0xc997[_0x45bd41];return _0xd955e8;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('WhatsappApplication',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c99('0xc'),'collate':_0x7c99('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a0f7120..0988c76 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappApplication,\x20%s,\x20%s','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x1e7c1d,_0x47ffe4){var _0x5d1b99=function(_0x36d6af){while(--_0x36d6af){_0x1e7c1d['push'](_0x1e7c1d['shift']());}};_0x5d1b99(++_0x47ffe4);}(_0x9f62,0x154));var _0x29f6=function(_0x29fbdc,_0x5be5d5){_0x29fbdc=_0x29fbdc-0x0;var _0x54b7e9=_0x9f62[_0x29fbdc];return _0x54b7e9;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +var _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1460d7,_0x35787e){var _0x3de766=function(_0x1ef8ef){while(--_0x1ef8ef){_0x1460d7['push'](_0x1460d7['shift']());}};_0x3de766(++_0x35787e);}(_0xed1f,0x6a));var _0xfed1=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xed1f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 265bdc0..2e1eeba 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 _0x1dcc=['tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x585f13,_0x4e4ae9){_0x585f13=_0x585f13-0x0;var _0x4c8e93=_0x1dcc[_0x585f13];return _0x4c8e93;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x9')]);router[_0xc1dc('0xa')]('/describe',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xb')]);router['get'](_0xc1dc('0xc'),auth['isAuthenticated'](),controller[_0xc1dc('0xd')]);router['get'](_0xc1dc('0xe'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xf')]);router[_0xc1dc('0xa')](_0xc1dc('0x10'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x11')]);router[_0xc1dc('0x12')]('/',auth[_0xc1dc('0x8')](),controller['create']);router[_0xc1dc('0x12')](_0xc1dc('0xe'),auth[_0xc1dc('0x8')](),controller['addMessage']);router[_0xc1dc('0x12')](_0xc1dc('0x13'),auth[_0xc1dc('0x8')](),interaction[_0xc1dc('0x14')](_0xc1dc('0x15'),_0xc1dc('0x16')),controller[_0xc1dc('0x17')]);router[_0xc1dc('0x18')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),interaction[_0xc1dc('0x14')]('whatsapp',_0xc1dc('0x19')),controller[_0xc1dc('0x1a')]);router[_0xc1dc('0x1b')](_0xc1dc('0xc'),auth['isAuthenticated'](),interaction[_0xc1dc('0x14')](_0xc1dc('0x15'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xc1dc('0x1b')](_0xc1dc('0x13'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x1c')]);module[_0xc1dc('0x1d')]=router; \ No newline at end of file +var _0xc492=['describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x157111,_0x3a9771){var _0x5b00c4=function(_0x1b15e4){while(--_0x1b15e4){_0x157111['push'](_0x157111['shift']());}};_0x5b00c4(++_0x3a9771);}(_0xc492,0xd7));var _0x2c49=function(_0x3ab0b7,_0x34e13b){_0x3ab0b7=_0x3ab0b7-0x0;var _0x218c9c=_0xc492[_0x3ab0b7];return _0x218c9c;};'use strict';var multer=require(_0x2c49('0x0'));var util=require(_0x2c49('0x1'));var path=require(_0x2c49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c49('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c49('0x4'));var config=require(_0x2c49('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x2c49('0x6')]('/',auth['isAuthenticated'](),controller[_0x2c49('0x7')]);router[_0x2c49('0x6')]('/describe',auth[_0x2c49('0x8')](),controller[_0x2c49('0x9')]);router[_0x2c49('0x6')](_0x2c49('0xa'),auth[_0x2c49('0x8')](),controller['show']);router[_0x2c49('0x6')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x2c49('0xb'),auth['isAuthenticated'](),controller[_0x2c49('0xc')]);router[_0x2c49('0xd')]('/',auth['isAuthenticated'](),controller[_0x2c49('0xe')]);router[_0x2c49('0xd')](_0x2c49('0xf'),auth[_0x2c49('0x8')](),controller[_0x2c49('0x10')]);router[_0x2c49('0xd')]('/:id/tags',auth[_0x2c49('0x8')](),interaction[_0x2c49('0x11')](_0x2c49('0x12'),_0x2c49('0x13')),controller[_0x2c49('0x14')]);router['put'](_0x2c49('0xa'),auth[_0x2c49('0x8')](),interaction[_0x2c49('0x11')](_0x2c49('0x12'),_0x2c49('0x15')),controller[_0x2c49('0x16')]);router[_0x2c49('0x17')](_0x2c49('0xa'),auth[_0x2c49('0x8')](),interaction[_0x2c49('0x11')]('whatsapp',_0x2c49('0x18')),controller[_0x2c49('0x19')]);router[_0x2c49('0x17')](_0x2c49('0x1a'),auth['isAuthenticated'](),controller[_0x2c49('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f0c4511..aa1834d 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 _0x29eb=['exports','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x3b86ce,_0x39ede5){var _0x325a6f=function(_0x1415dd){while(--_0x1415dd){_0x3b86ce['push'](_0x3b86ce['shift']());}};_0x325a6f(++_0x39ede5);}(_0x29eb,0x1c5));var _0xb29e=function(_0x3804c3,_0x3a7c96){_0x3804c3=_0x3804c3-0x0;var _0x44d776=_0x29eb[_0x3804c3];return _0x44d776;};'use strict';var Sequelize=require(_0xb29e('0x0'));var moment=require(_0xb29e('0x1'));module[_0xb29e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb29e('0x3')]},'disposition':{'type':Sequelize[_0xb29e('0x4')]},'secondDisposition':{'type':Sequelize[_0xb29e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb29e('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb29e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb29e('0x5')]('in',_0xb29e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb29e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb29e('0x5')]('in',_0xb29e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x448a=['DATE','STRING','ENUM','out','BOOLEAN','moment','exports'];(function(_0x117bdd,_0x29a86e){var _0x93ed36=function(_0x473358){while(--_0x473358){_0x117bdd['push'](_0x117bdd['shift']());}};_0x93ed36(++_0x29a86e);}(_0x448a,0x1ef));var _0xa448=function(_0x5f3057,_0x4b72da){_0x5f3057=_0x5f3057-0x0;var _0x3f985d=_0x448a[_0x5f3057];return _0x3f985d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa448('0x0'));module[_0xa448('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa448('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa448('0x3')]},'note':{'type':Sequelize[_0xa448('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa448('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa448('0x4')]('in',_0xa448('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa448('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa448('0x4')]('in',_0xa448('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa448('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 8ff893a..de557dd 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 _0xd5c8=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','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','user','role','getWhatsappAccounts','sequelize','toString','keyBy','merge','a.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','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','push','all','rows','show','params','filters','includeAll','include','options','WhatsappInteraction','destroy','describe','addMessage','ids','WhatsappMessage','hasOwnProperty','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','format','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','views','downloadInteraction.ejs','createPdfFromHTML','log','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','model','query','attributes','intersection','fields','length','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','text','body','type','keys','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte'];(function(_0x29712d,_0xb0fcad){var _0x2ee031=function(_0x53d196){while(--_0x53d196){_0x29712d['push'](_0x29712d['shift']());}};_0x2ee031(++_0xb0fcad);}(_0xd5c8,0x166));var _0x8d5c=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0xd5c8[_0x471448];return _0x38190b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d5c('0x0'));var jsonpatch=require(_0x8d5c('0x1'));var rp=require(_0x8d5c('0x2'));var moment=require(_0x8d5c('0x3'));var BPromise=require(_0x8d5c('0x4'));var Mustache=require(_0x8d5c('0x5'));var util=require(_0x8d5c('0x6'));var path=require(_0x8d5c('0x7'));var sox=require(_0x8d5c('0x8'));var csv=require('to-csv');var ejs=require(_0x8d5c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d5c('0xa'));var crypto=require(_0x8d5c('0xb'));var jsforce=require(_0x8d5c('0xc'));var deskjs=require(_0x8d5c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d5c('0xe'));var Redis=require('ioredis');var authService=require(_0x8d5c('0xf'));var qs=require(_0x8d5c('0x10'));var as=require(_0x8d5c('0x11'));var pdf=require(_0x8d5c('0x12'));var hardwareService=require(_0x8d5c('0x13'));var logger=require(_0x8d5c('0x14'))(_0x8d5c('0x15'));var utils=require(_0x8d5c('0x16'));var config=require(_0x8d5c('0x17'));var licenseUtil=require(_0x8d5c('0x18'));var db=require(_0x8d5c('0x19'))['db'];config[_0x8d5c('0x1a')]=_['defaults'](config[_0x8d5c('0x1a')],{'host':_0x8d5c('0x1b'),'port':0x18eb});var socket=require(_0x8d5c('0x1c'))(new Redis(config[_0x8d5c('0x1a')]));require(_0x8d5c('0x1d'))[_0x8d5c('0x1e')](socket);function respondWithStatusCode(_0x3c26e3,_0x330a94){_0x330a94=_0x330a94||0xcc;return function(_0x516388){if(_0x516388){return _0x3c26e3[_0x8d5c('0x1f')](_0x330a94);}return _0x3c26e3[_0x8d5c('0x20')](_0x330a94)['end']();};}function respondWithResult(_0x56878f,_0x645f26){_0x645f26=_0x645f26||0xc8;return function(_0x4a1dab){if(_0x4a1dab){return _0x56878f['status'](_0x645f26)['json'](_0x4a1dab);}};}function respondWithFilteredResult(_0xa5fbe5,_0x43f233){return function(_0x200846){if(_0x200846){var _0x189005=typeof _0x43f233[_0x8d5c('0x21')]===_0x8d5c('0x22')&&typeof _0x43f233['limit']==='undefined';var _0x51d5da=_0x200846['count'];var _0x379bfb=_0x189005?0x0:_0x43f233[_0x8d5c('0x21')];var _0x31cd31=_0x189005?_0x200846[_0x8d5c('0x23')]:_0x43f233[_0x8d5c('0x21')]+_0x43f233[_0x8d5c('0x24')];var _0x167c74;if(_0x31cd31>=_0x51d5da){_0x31cd31=_0x51d5da;_0x167c74=0xc8;}else{_0x167c74=0xce;}_0xa5fbe5[_0x8d5c('0x20')](_0x167c74);return _0xa5fbe5[_0x8d5c('0x25')](_0x8d5c('0x26'),_0x379bfb+'-'+_0x31cd31+'/'+_0x51d5da)[_0x8d5c('0x27')](_0x200846);}return null;};}function patchUpdates(_0x4e87dd){return function(_0x2f067f){try{jsonpatch[_0x8d5c('0x28')](_0x2f067f,_0x4e87dd,!![]);}catch(_0x4c0cdf){return BPromise[_0x8d5c('0x29')](_0x4c0cdf);}return _0x2f067f[_0x8d5c('0x2a')]();};}function saveUpdates(_0x11b4f8,_0x47519d){return function(_0x568bcf){if(_0x568bcf){return _0x568bcf[_0x8d5c('0x2b')](_0x11b4f8)[_0x8d5c('0x2c')](function(_0x506828){return _0x506828;});}return null;};}function removeEntity(_0x5e0daa,_0x1e36d8){return function(_0xa8aeac){if(_0xa8aeac){return _0xa8aeac['destroy']()['then'](function(){_0x5e0daa[_0x8d5c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d40ba,_0x20c2f3){return function(_0x2be887){if(!_0x2be887){_0x5d40ba[_0x8d5c('0x1f')](0x194);}return _0x2be887;};}function handleError(_0x130af7,_0xd060b1){_0xd060b1=_0xd060b1||0x1f4;return function(_0x2302a8){logger[_0x8d5c('0x2d')](_0x2302a8[_0x8d5c('0x2e')]);if(_0x2302a8['name']){delete _0x2302a8[_0x8d5c('0x2f')];}_0x130af7[_0x8d5c('0x20')](_0xd060b1)[_0x8d5c('0x30')](_0x2302a8);};}function getInteractionUsers(_0x58feb4,_0xe7290){return new BPromise(function(_0x3116c5,_0x3f9d1a){try{if(_0xe7290[_0x58feb4['id']]){_0x58feb4[_0x8d5c('0x31')]=_[_0x8d5c('0x32')](_0xe7290[_0x58feb4['id']],function(_0x152517){return{'id':_0x152517['id'],'fullname':_0x152517[_0x8d5c('0x33')]};});}}catch(_0x3519da){_0x3f9d1a(_0x3519da);}_0x3116c5(_0x58feb4);});}function getInteractionTags(_0x37b9d0,_0x417d87){return new BPromise(function(_0x2c1464,_0x3036a9){try{if(_0x37b9d0[_0x8d5c('0x34')]){_0x37b9d0[_0x8d5c('0x35')]=[];_0x37b9d0[_0x8d5c('0x34')][_0x8d5c('0x36')](',')[_0x8d5c('0x37')](function(_0x427311){_0x37b9d0['Tags']['push'](_0x417d87[_0x427311]);});}delete _0x37b9d0['TagIds'];}catch(_0x5b64c6){_0x3036a9(_0x5b64c6);}_0x2c1464(_0x37b9d0);});}function updateWhatsappInteraction(_0x661bec,_0x216900,_0x348a43){return new BPromise(function(_0x4bb598,_0x2248dd){return getInteractionUsers(_0x661bec,_0x348a43)[_0x8d5c('0x2c')](function(_0x1339a9){return getInteractionTags(_0x1339a9,_0x216900);})[_0x8d5c('0x2c')](function(_0x57d2e1){return getStateInteraction(_0x57d2e1);})[_0x8d5c('0x2c')](function(_0x54a5d6){_0x4bb598(_0x54a5d6);})[_0x8d5c('0x38')](function(_0x52b656){_0x2248dd(_0x52b656);});});}function getStateInteraction(_0x51f6bc){return new BPromise(function(_0x21e114){_0x51f6bc[_0x8d5c('0x39')]=0x0;_0x51f6bc[_0x8d5c('0x3a')]=0x0;_0x51f6bc[_0x8d5c('0x3b')]=0x0;_0x51f6bc[_0x8d5c('0x3c')]=0x0;_0x51f6bc[_0x8d5c('0x3d')]=0x0;if(!_0x51f6bc[_0x8d5c('0x3e')]&&!_0x51f6bc[_0x8d5c('0x3f')]){_0x51f6bc[_0x8d5c('0x39')]+=0x1;}if(!_0x51f6bc[_0x8d5c('0x3e')]&&_0x51f6bc[_0x8d5c('0x3f')]){_0x51f6bc[_0x8d5c('0x3a')]+=0x1;if(_0x51f6bc['waiting']){_0x51f6bc['waiting']-=0x1;}}if(_0x51f6bc['closed']&&_0x51f6bc['UserId']){_0x51f6bc['answered']+=0x1;if(_0x51f6bc[_0x8d5c('0x3a')]){_0x51f6bc[_0x8d5c('0x3a')]-=0x1;}}if(_0x51f6bc['closed']&&!_0x51f6bc[_0x8d5c('0x3f')]){_0x51f6bc[_0x8d5c('0x3c')]+=0x1;if(_0x51f6bc[_0x8d5c('0x39')]){_0x51f6bc[_0x8d5c('0x39')]-=0x1;}}_0x51f6bc[_0x8d5c('0x3d')]+=0x1;_0x21e114(_0x51f6bc);});}exports[_0x8d5c('0x40')]=function(_0x4ca52d,_0x56f15b){var _0x210134={},_0x10eeef={},_0x5fd4f2={'count':0x0,'rows':[]};var _0xdad44b=_[_0x8d5c('0x32')](db['WhatsappInteraction'][_0x8d5c('0x41')],function(_0x3d01b1){return{'name':_0x3d01b1[_0x8d5c('0x42')],'type':_0x3d01b1['type']['key']};});_0x10eeef[_0x8d5c('0x43')]=_[_0x8d5c('0x32')](_0xdad44b,_0x8d5c('0x2f'));_0x10eeef[_0x8d5c('0x44')]=_['keys'](_0x4ca52d['query']);_0x10eeef['filters']=_['intersection'](_0x10eeef[_0x8d5c('0x43')],_0x10eeef[_0x8d5c('0x44')]);_0x210134[_0x8d5c('0x45')]=_[_0x8d5c('0x46')](_0x10eeef[_0x8d5c('0x43')],qs[_0x8d5c('0x47')](_0x4ca52d['query'][_0x8d5c('0x47')]));_0x210134[_0x8d5c('0x45')]=_0x210134[_0x8d5c('0x45')][_0x8d5c('0x48')]?_0x210134[_0x8d5c('0x45')]:_0x10eeef[_0x8d5c('0x43')];if(!_0x4ca52d[_0x8d5c('0x44')]['hasOwnProperty'](_0x8d5c('0x49'))){_0x210134[_0x8d5c('0x24')]=qs['limit'](_0x4ca52d[_0x8d5c('0x44')]['limit']);_0x210134[_0x8d5c('0x21')]=qs[_0x8d5c('0x21')](_0x4ca52d[_0x8d5c('0x44')]['offset']);}_0x210134[_0x8d5c('0x4a')]=qs[_0x8d5c('0x4b')](_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x4b')]);_0x210134['where']=qs['filters'](_[_0x8d5c('0x4c')](_0x4ca52d[_0x8d5c('0x44')],_0x10eeef['filters']),_0xdad44b);var _0x32a2c0=[];var _0x118ef7=squel[_0x8d5c('0x4d')]()[_0x8d5c('0x4e')]('id')[_0x8d5c('0x4e')]('name')[_0x8d5c('0x4e')](_0x8d5c('0x4f'))[_0x8d5c('0x50')](_0x8d5c('0x51'));var _0x326a1c=squel[_0x8d5c('0x4d')]()[_0x8d5c('0x4e')]('u.id')[_0x8d5c('0x4e')](_0x8d5c('0x52'))[_0x8d5c('0x4e')](_0x8d5c('0x53'))[_0x8d5c('0x50')](_0x8d5c('0x54'),'ui')[_0x8d5c('0x55')](_0x8d5c('0x56'),'u',_0x8d5c('0x57'));var _0xf39d50=squel[_0x8d5c('0x4d')]()[_0x8d5c('0x50')](_0x8d5c('0x58'),'i')['left_join'](_0x8d5c('0x59'),'c',_0x8d5c('0x5a'))[_0x8d5c('0x55')](_0x8d5c('0x56'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x8d5c('0x5b'),'a',_0x8d5c('0x5c'))[_0x8d5c('0x55')](_0x8d5c('0x5d'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x8d5c('0x55')](_0x8d5c('0x5e'),'it',_0x8d5c('0x5f'))[_0x8d5c('0x55')](_0x8d5c('0x51'),'t',_0x8d5c('0x60'));var _0x3d3b20=squel[_0x8d5c('0x61')]();var _0x2e2523=[];var _0x201b12=squel[_0x8d5c('0x61')]();var _0x2b3092;if(_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x62')]){_0x2b3092=as[_0x8d5c('0x63')](_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x62')]);var _0x430d74=_0x2b3092[_0x8d5c('0x64')];for(var _0x499cfb=0x0;_0x499cfb<_0x2b3092['conditions'][_0x8d5c('0x48')];_0x499cfb++){var _0x11c864=_0x2b3092[_0x8d5c('0x65')][_0x499cfb];var _0xea4028='i';var _0x1e3470=_[_0x8d5c('0x66')](_0xdad44b,[_0x8d5c('0x2f'),_0x11c864[_0x8d5c('0x4e')]]);if(!_0x1e3470){switch(_0x11c864[_0x8d5c('0x4e')]){case _0x8d5c('0x67'):if(_0x11c864[_0x8d5c('0x68')]==0x1){_0xf39d50[_0x8d5c('0x69')]('`'+_0x11c864[_0x8d5c('0x4e')]+_0x8d5c('0x6a'));}else{_0xf39d50[_0x8d5c('0x69')]('`'+_0x11c864[_0x8d5c('0x4e')]+_0x8d5c('0x6b'));}break;case _0x8d5c('0x6c'):if(_0x11c864[_0x8d5c('0x6d')]===_0x8d5c('0x6e')){if(_0x11c864[_0x8d5c('0x68')]['split']('\x20')[_0x8d5c('0x48')]>0x1){_0x3d3b20[_0x430d74]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d5c('0x6f')](_0x11c864[_0x8d5c('0x68')]),null);}else{var _0x3cc4e6='%'+_0x11c864[_0x8d5c('0x68')]+'%';_0x3d3b20[_0x430d74](_0x8d5c('0x70'),_0x3cc4e6,_0x3cc4e6,_0x3cc4e6);}}else{_0x1e3470=_['find'](_0xdad44b,['name',_0x8d5c('0x71')]);_0x11c864[_0x8d5c('0x4e')]=_0x8d5c('0x71');_0x9b5d3d=as[_0x8d5c('0x72')](_0xea4028,_0x1e3470['type'],_0x11c864);_0x3d3b20[_0x430d74](_0x9b5d3d['text'],_0x9b5d3d[_0x8d5c('0x68')][_0x8d5c('0x73')],_0x9b5d3d[_0x8d5c('0x68')][_0x8d5c('0x74')]);}break;case _0x8d5c('0x75'):var _0x1e5207=_0x11c864['value'][_0x8d5c('0x36')](',')[_0x8d5c('0x32')](function(_0x527930){return Number(_0x527930);});_0x1e5207[_0x8d5c('0x37')](function(_0x4cc59b){_0x201b12['or'](_0x8d5c('0x76'),'%,'+_0x4cc59b+',%');});_0x2e2523=_[_0x8d5c('0x77')](_0x2e2523,_0x1e5207);break;case _0x8d5c('0x78'):if(_0x11c864['operator']==='$substring'){_0x3d3b20[_0x430d74]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x11c864['value']+'%',null);}else{_0x1e3470=_[_0x8d5c('0x66')](_0xdad44b,[_0x8d5c('0x2f'),_0x8d5c('0x3f')]);_0x11c864[_0x8d5c('0x4e')]=_0x8d5c('0x3f');_0x9b5d3d=as[_0x8d5c('0x72')](_0xea4028,_0x1e3470['type'],_0x11c864);_0x3d3b20[_0x430d74](_0x9b5d3d[_0x8d5c('0x79')],_0x9b5d3d['value'][_0x8d5c('0x73')],_0x9b5d3d[_0x8d5c('0x68')][_0x8d5c('0x74')]);}break;case _0x8d5c('0x7a'):_0x9b5d3d=as[_0x8d5c('0x72')]('me',null,_0x11c864);_0x3d3b20[_0x430d74](_0x9b5d3d[_0x8d5c('0x79')],_0x9b5d3d[_0x8d5c('0x68')]['start'],_0x9b5d3d['value'][_0x8d5c('0x74')]);break;}}else{var _0x9b5d3d=as[_0x8d5c('0x72')](_0xea4028,_0x1e3470[_0x8d5c('0x7b')],_0x11c864);_0x3d3b20[_0x430d74](_0x9b5d3d[_0x8d5c('0x79')],_0x9b5d3d[_0x8d5c('0x68')][_0x8d5c('0x73')],_0x9b5d3d['value'][_0x8d5c('0x74')]);}}}else{var _0x46eb29=_(_0x4ca52d[_0x8d5c('0x44')])[_0x8d5c('0x7c')]()[_0x8d5c('0x32')](function(_0x4e2ed7){return _[_0x8d5c('0x7d')](_0xdad44b,['name',_0x4e2ed7])?_0x4e2ed7:undefined;})[_0x8d5c('0x7e')]()[_0x8d5c('0x68')]();if(!_[_0x8d5c('0x7f')](_0x46eb29)){_0x46eb29[_0x8d5c('0x37')](function(_0x2e816e){if(_0x2e816e===_0x8d5c('0x80')){_0xf39d50[_0x8d5c('0x81')](_0x8d5c('0x82'),[][_0x8d5c('0x83')](_0x4ca52d[_0x8d5c('0x44')][_0x2e816e]));}else if(_0x2e816e===_0x8d5c('0x84')){var _0x367fe5=JSON[_0x8d5c('0x85')](_0x4ca52d[_0x8d5c('0x44')][_0x2e816e])[_0x8d5c('0x86')];var _0x42e541=JSON['parse'](_0x4ca52d[_0x8d5c('0x44')][_0x2e816e])[_0x8d5c('0x87')];_0xf39d50['where'](_0x8d5c('0x88'),_0x367fe5,_0x42e541);}else{if(_0x4ca52d['query'][_0x2e816e]==='null'){_0xf39d50[_0x8d5c('0x81')]('i.'+_0x2e816e+_0x8d5c('0x89'));}else{_0xf39d50[_0x8d5c('0x81')]('i.'+_0x2e816e+_0x8d5c('0x8a'),_0x4ca52d[_0x8d5c('0x44')][_0x2e816e]);}}});}if(_0x4ca52d['query'][_0x8d5c('0x8b')]){if(_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x8b')]==0x1){_0xf39d50['having'](_0x8d5c('0x8c'));}else{_0xf39d50[_0x8d5c('0x69')](_0x8d5c('0x8d'));}}if(_0x4ca52d[_0x8d5c('0x44')]['tag']){_0x2e2523=_[_0x8d5c('0x8e')](_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x8f')])?_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x8f')]:new Array(_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x8f')]);_0x2e2523['forEach'](function(_0x7c9019){_0x201b12['or'](_0x8d5c('0x76'),'%,'+_0x7c9019+',%');});}if(_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x90')]){var _0x90061d=_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x90')][_0x8d5c('0x91')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8d5c('0x92')](_0x90061d)){_0x3d3b20['or']('i.id\x20LIKE\x20?',_0x90061d+'%')['or']('i.phone\x20LIKE\x20?',_0x90061d+'%');}else{_0x3d3b20['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d5c('0x6f')](_0x90061d))['or'](_0x8d5c('0x93'),_0x90061d+'%');}}}_0xf39d50[_0x8d5c('0x81')](_0x3d3b20);_0xf39d50['group'](_0x8d5c('0x94'));var _0x5e86f5={'type':db[_0x8d5c('0x95')]['QueryTypes'][_0x8d5c('0x96')],'raw':!![]};var _0x42cc7a=_0xf39d50['clone']();_0x42cc7a[_0x8d5c('0x4e')](_0x8d5c('0x94'));_0x42cc7a[_0x8d5c('0x4e')](_0x8d5c('0x97'),_0x8d5c('0x67'));if(_0x210134['order']){_0x210134[_0x8d5c('0x4a')][_0x8d5c('0x37')](function(_0xfc4a61){var _0x317239=_0xfc4a61[0x0]===_0x8d5c('0x98')?_0xfc4a61[0x0]:'i.'+_0xfc4a61[0x0];_0xf39d50[_0x8d5c('0x4a')](_0x317239,_0xfc4a61[0x1]===_0x8d5c('0x99')?![]:!![]);});}if(!_[_0x8d5c('0x7f')](_0x2e2523)){_0xf39d50[_0x8d5c('0x69')](_0x201b12);_0x42cc7a[_0x8d5c('0x81')](_0x8d5c('0x9a'),_0x2e2523);}BPromise[_0x8d5c('0x9b')]()[_0x8d5c('0x2c')](function(){if(!_0x2b3092){if(_0x4ca52d['query'][_0x8d5c('0x80')])return;_0x42cc7a['where'](_0x8d5c('0x9c'));_0xf39d50[_0x8d5c('0x81')](_0x8d5c('0x9c'));return;}if(_0x4ca52d[_0x8d5c('0x9d')][_0x8d5c('0x9e')]!=='agent')return;return _0x4ca52d[_0x8d5c('0x9d')][_0x8d5c('0x9f')]({'attributes':['id'],'raw':!![]})[_0x8d5c('0x2c')](function(_0x4b49b9){if(_[_0x8d5c('0x7f')](_0x4b49b9)){_0x42cc7a['where']('i.WhatsappAccountId\x20IS\x20NULL');_0xf39d50[_0x8d5c('0x81')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x42cc7a[_0x8d5c('0x81')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x4b49b9,'id'));_0xf39d50['where'](_0x8d5c('0x82'),_[_0x8d5c('0x32')](_0x4b49b9,'id'));}});})[_0x8d5c('0x2c')](function(){if(_0x4ca52d[_0x8d5c('0x9d')][_0x8d5c('0x9e')]==='agent'&&!_0x2b3092&&!_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x80')])return[];return db[_0x8d5c('0xa0')][_0x8d5c('0x44')](_0x42cc7a[_0x8d5c('0xa1')](),_0x5e86f5);})[_0x8d5c('0x2c')](function(_0x4228d5){_0x5fd4f2[_0x8d5c('0x23')]=_0x4228d5[_0x8d5c('0x48')];if(_0x5fd4f2['count']===0x0)return[];return db['sequelize']['query'](_0x118ef7[_0x8d5c('0xa1')](),_0x5e86f5)['then'](function(_0x54ca67){_0x32a2c0=_[_0x8d5c('0xa2')](_0x54ca67,'id');_0x5e86f5=_[_0x8d5c('0xa3')](_0x5e86f5,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ca52d[_0x8d5c('0x44')][_0x8d5c('0x47')]){_0x210134[_0x8d5c('0x45')][_0x8d5c('0x37')](function(_0x51e1ba){_0xf39d50[_0x8d5c('0x4e')]('i.'+_0x51e1ba);});}else{_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0x97'),_0x8d5c('0x67'));_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xa4'),'Account.key');_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xa5'),_0x8d5c('0xa6'));_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xa7'),_0x8d5c('0x98'));_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xa8'));_0xf39d50['field'](_0x8d5c('0xa9'),_0x8d5c('0xaa'));_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xab'),'Contact.lastName');_0xf39d50['field'](_0x8d5c('0xac'),_0x8d5c('0xad'));_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xae'),_0x8d5c('0xaf'));_0xf39d50['field'](_0x8d5c('0xb0'),_0x8d5c('0xb1'));_0xf39d50['field'](_0x8d5c('0xb2'),'Contact.fax');_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xb3'),_0x8d5c('0xb4'));_0xf39d50[_0x8d5c('0x4e')](_0x8d5c('0xb5'),_0x8d5c('0xb6'));_0xf39d50['field'](_0x8d5c('0xb7'),_0x8d5c('0x34'));}if(_0x210134[_0x8d5c('0x24')])_0xf39d50[_0x8d5c('0x24')](_0x210134[_0x8d5c('0x24')]);if(_0x210134['offset'])_0xf39d50[_0x8d5c('0x21')](_0x210134[_0x8d5c('0x21')]);return db[_0x8d5c('0xa0')][_0x8d5c('0x44')](_0xf39d50[_0x8d5c('0xa1')](),_0x5e86f5);})[_0x8d5c('0x2c')](function(_0x5e6cc0){if(_0x5e6cc0[_0x8d5c('0x48')]>0x0)_0x326a1c['where']('ui.WhatsappInteractionId\x20IN\x20?',_[_0x8d5c('0x32')](_0x5e6cc0,'id'));return db[_0x8d5c('0xa0')][_0x8d5c('0x44')](_0x326a1c[_0x8d5c('0xa1')](),_0x5e86f5)[_0x8d5c('0x2c')](function(_0x4d37c7){var _0x2f9135=_[_0x8d5c('0xb8')](_0x4d37c7,_0x8d5c('0xb9'));var _0x484f23=[];_0x5e6cc0[_0x8d5c('0x37')](function(_0x2a05b7){_0x484f23[_0x8d5c('0xba')](updateWhatsappInteraction(_0x2a05b7,_0x32a2c0,_0x2f9135));});return BPromise[_0x8d5c('0xbb')](_0x484f23);});});})[_0x8d5c('0x2c')](function(_0x255081){_0x5fd4f2[_0x8d5c('0xbc')]=_0x255081;return _0x5fd4f2;})[_0x8d5c('0x2c')](respondWithFilteredResult(_0x56f15b,_0x210134))[_0x8d5c('0x38')](handleError(_0x56f15b,null));};exports[_0x8d5c('0xbd')]=function(_0x1644b6,_0x39a225){var _0xffae91={'raw':![],'where':{'id':_0x1644b6[_0x8d5c('0xbe')]['id']}},_0x329ba5={};_0x329ba5[_0x8d5c('0x43')]=_[_0x8d5c('0x7c')](db['WhatsappInteraction'][_0x8d5c('0x41')]);_0x329ba5[_0x8d5c('0x44')]=_['keys'](_0x1644b6['query']);_0x329ba5[_0x8d5c('0xbf')]=_[_0x8d5c('0x46')](_0x329ba5['model'],_0x329ba5[_0x8d5c('0x44')]);_0xffae91[_0x8d5c('0x45')]=_[_0x8d5c('0x46')](_0x329ba5['model'],qs[_0x8d5c('0x47')](_0x1644b6[_0x8d5c('0x44')]['fields']));_0xffae91['attributes']=_0xffae91[_0x8d5c('0x45')]['length']?_0xffae91['attributes']:_0x329ba5[_0x8d5c('0x43')];if(_0x1644b6['query'][_0x8d5c('0xc0')]){_0xffae91[_0x8d5c('0xc1')]=[{'all':!![]}];}_0xffae91=_[_0x8d5c('0xa3')]({},_0xffae91,_0x1644b6[_0x8d5c('0xc2')]);return db[_0x8d5c('0xc3')]['find'](_0xffae91)['then'](handleEntityNotFound(_0x39a225,null))[_0x8d5c('0x2c')](respondWithResult(_0x39a225,null))[_0x8d5c('0x38')](handleError(_0x39a225,null));};exports['create']=function(_0x5e0b0d,_0x50b820){return db[_0x8d5c('0xc3')]['create'](_0x5e0b0d[_0x8d5c('0x7a')],{})[_0x8d5c('0x2c')](respondWithResult(_0x50b820,0xc9))['catch'](handleError(_0x50b820,null));};exports[_0x8d5c('0x2b')]=function(_0x3914a7,_0x1bba3c){if(_0x3914a7['body']['id']){delete _0x3914a7[_0x8d5c('0x7a')]['id'];}return db['WhatsappInteraction'][_0x8d5c('0x66')]({'where':{'id':_0x3914a7[_0x8d5c('0xbe')]['id']}})[_0x8d5c('0x2c')](handleEntityNotFound(_0x1bba3c,null))['then'](saveUpdates(_0x3914a7[_0x8d5c('0x7a')],null))['then'](respondWithResult(_0x1bba3c,null))[_0x8d5c('0x38')](handleError(_0x1bba3c,null));};exports[_0x8d5c('0xc4')]=function(_0x4f409f,_0x2e0970){return db[_0x8d5c('0xc3')][_0x8d5c('0x66')]({'where':{'id':_0x4f409f[_0x8d5c('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e0970,null))['then'](removeEntity(_0x2e0970,null))[_0x8d5c('0x38')](handleError(_0x2e0970,null));};exports[_0x8d5c('0xc5')]=function(_0x29d07e,_0x525e9e){return db['WhatsappInteraction'][_0x8d5c('0xc5')]()[_0x8d5c('0x2c')](respondWithResult(_0x525e9e,null))[_0x8d5c('0x38')](handleError(_0x525e9e,null));};exports['addMessage']=function(_0x3f0f2a,_0x4127ec,_0x2bb8c9){return db['WhatsappMessage'][_0x8d5c('0x66')]({'where':{'id':_0x3f0f2a[_0x8d5c('0xbe')]['id']}})[_0x8d5c('0x2c')](handleEntityNotFound(_0x4127ec,null))['then'](function(_0x4f83f1){if(_0x4f83f1){return _0x4f83f1[_0x8d5c('0xc6')](_0x3f0f2a[_0x8d5c('0x7a')][_0x8d5c('0xc7')],_['omit'](_0x3f0f2a[_0x8d5c('0x7a')],[_0x8d5c('0xc7'),'id'])||{});}})[_0x8d5c('0x2c')](respondWithResult(_0x4127ec,null))[_0x8d5c('0x38')](handleError(_0x4127ec,null));};exports['getMessages']=function(_0x3b7ef9,_0x4fa35b,_0x1b077d){var _0x222e93={'raw':![],'where':{}};var _0x1105a1={};var _0x5579c1={'count':0x0,'rows':[]};return db[_0x8d5c('0xc3')]['findOne']({'where':{'id':_0x3b7ef9[_0x8d5c('0xbe')]['id']}})[_0x8d5c('0x2c')](handleEntityNotFound(_0x4fa35b,null))['then'](function(_0x647ffa){if(_0x647ffa){_0x1105a1[_0x8d5c('0x43')]=_[_0x8d5c('0x7c')](db[_0x8d5c('0xc8')][_0x8d5c('0x41')]);_0x1105a1['query']=_[_0x8d5c('0x7c')](_0x3b7ef9[_0x8d5c('0x44')]);_0x1105a1[_0x8d5c('0xbf')]=_[_0x8d5c('0x46')](_0x1105a1['model'],_0x1105a1['query']);_0x222e93[_0x8d5c('0x45')]=_[_0x8d5c('0x46')](_0x1105a1[_0x8d5c('0x43')],qs[_0x8d5c('0x47')](_0x3b7ef9['query'][_0x8d5c('0x47')]));_0x222e93[_0x8d5c('0x45')]=_0x222e93['attributes'][_0x8d5c('0x48')]?_0x222e93[_0x8d5c('0x45')]:_0x1105a1[_0x8d5c('0x43')];if(!_0x3b7ef9[_0x8d5c('0x44')][_0x8d5c('0xc9')]('nolimit')){_0x222e93[_0x8d5c('0x24')]=qs[_0x8d5c('0x24')](_0x3b7ef9[_0x8d5c('0x44')][_0x8d5c('0x24')]);_0x222e93['offset']=qs['offset'](_0x3b7ef9[_0x8d5c('0x44')]['offset']);}_0x222e93[_0x8d5c('0x4a')]=qs[_0x8d5c('0x4b')](_0x3b7ef9['query'][_0x8d5c('0x4b')]);_0x222e93[_0x8d5c('0x81')]=qs[_0x8d5c('0xbf')](_[_0x8d5c('0x4c')](_0x3b7ef9[_0x8d5c('0x44')],_0x1105a1[_0x8d5c('0xbf')]));_0x222e93[_0x8d5c('0x81')][_0x8d5c('0xb9')]=_0x647ffa['id'];if(_0x3b7ef9['query'][_0x8d5c('0x90')]){_0x222e93[_0x8d5c('0x81')]=_[_0x8d5c('0xa3')](_0x222e93[_0x8d5c('0x81')],{'$or':_[_0x8d5c('0x32')](_0x222e93[_0x8d5c('0x45')],function(_0x1253b5){var _0x90e08e={};_0x90e08e[_0x1253b5]={'$like':'%'+_0x3b7ef9['query']['filter']+'%'};return _0x90e08e;})});}if(_0x3b7ef9[_0x8d5c('0x44')]['$gte']){var _0x36137a=_0x3b7ef9[_0x8d5c('0x44')]['$gte'][_0x8d5c('0x36')](',');var _0x54eb50={};_0x54eb50[_0x36137a[0x0]]={'$gte':moment(_0x36137a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x222e93[_0x8d5c('0x81')]=_[_0x8d5c('0xa3')](_0x222e93[_0x8d5c('0x81')],_0x54eb50);}_0x222e93=_['merge']({},_0x222e93,_0x3b7ef9[_0x8d5c('0xc2')]);return db[_0x8d5c('0xc8')][_0x8d5c('0x23')]({'where':_0x222e93[_0x8d5c('0x81')]})[_0x8d5c('0x2c')](function(_0x52bad3){_0x5579c1['count']=_0x52bad3;if(_0x3b7ef9[_0x8d5c('0x44')][_0x8d5c('0xc0')]){_0x222e93[_0x8d5c('0xc1')]=[{'all':!![]}];}return db[_0x8d5c('0xc8')][_0x8d5c('0xca')](_0x222e93);})[_0x8d5c('0x2c')](function(_0x5cfefc){_0x5579c1[_0x8d5c('0xbc')]=_0x5cfefc;return _0x5579c1;});}})[_0x8d5c('0x2c')](respondWithFilteredResult(_0x4fa35b,_0x222e93))[_0x8d5c('0x38')](handleError(_0x4fa35b,null));};exports[_0x8d5c('0xcb')]=function(_0x3b0ea5,_0x1f5518,_0x1e29a5){return db[_0x8d5c('0xc3')]['find']({'where':{'id':_0x3b0ea5[_0x8d5c('0xbe')]['id']}})[_0x8d5c('0x2c')](handleEntityNotFound(_0x1f5518,null))[_0x8d5c('0x2c')](function(_0x4f6642){if(_0x4f6642){return _0x4f6642[_0x8d5c('0xcc')](_0x3b0ea5['body'][_0x8d5c('0xc7')],_[_0x8d5c('0xcd')](_0x3b0ea5[_0x8d5c('0x7a')],[_0x8d5c('0xc7'),'id'])||{})[_0x8d5c('0xce')](function(){return db[_0x8d5c('0x75')][_0x8d5c('0xca')]({'attributes':['id','name',_0x8d5c('0x4f')],'where':{'id':_0x3b0ea5['body']['ids']}});})[_0x8d5c('0x2c')](function(_0x42a30a){socket[_0x8d5c('0xcf')](_0x8d5c('0xd0'),{'id':Number(_0x3b0ea5[_0x8d5c('0xbe')]['id']),'tags':_0x42a30a||[]});return{'id':Number(_0x3b0ea5[_0x8d5c('0xbe')]['id']),'tags':_0x42a30a||[]};});}})[_0x8d5c('0x2c')](respondWithResult(_0x1f5518,null))['catch'](handleError(_0x1f5518,null));};exports[_0x8d5c('0xd1')]=function(_0x752831,_0x25ed01,_0x4475cb){return db[_0x8d5c('0xc3')][_0x8d5c('0x66')]({'where':{'id':_0x752831['params']['id']}})['then'](handleEntityNotFound(_0x25ed01,null))[_0x8d5c('0x2c')](function(_0xf8d319){if(_0xf8d319){return _0xf8d319[_0x8d5c('0xd1')](_0x752831[_0x8d5c('0x44')]['ids']);}})[_0x8d5c('0x2c')](respondWithStatusCode(_0x25ed01,null))[_0x8d5c('0x38')](handleError(_0x25ed01,null));};exports[_0x8d5c('0xd2')]=function(_0x5d661a,_0x3d2da8){var _0x259c8a=moment()[_0x8d5c('0xd3')]()[_0x8d5c('0xa1')]();var _0x36f6be=path[_0x8d5c('0xd4')](config['root'],_0x8d5c('0xd5'),_0x8d5c('0xd6'),_0x8d5c('0xd7'));var _0x18d691=path[_0x8d5c('0xd4')](config[_0x8d5c('0xd8')],'server',_0x8d5c('0xd6'),'attachments');var _0x508578=path[_0x8d5c('0xd4')](_0x36f6be,_0x259c8a);var _0x3072ca=util[_0x8d5c('0xd9')](_0x8d5c('0xda'),_0x5d661a[_0x8d5c('0xbe')]['id'],_0x259c8a);var _0x2c7609=path[_0x8d5c('0xd4')](_0x36f6be,_0x3072ca);var _0x1705ae=[];_0x1705ae['push']({'model':db[_0x8d5c('0x78')],'as':_0x8d5c('0x78'),'attributes':['id','fullname'],'raw':!![]});_0x1705ae['push']({'model':db[_0x8d5c('0xdb')],'as':_0x8d5c('0x6c'),'attributes':['id',_0x8d5c('0xdc'),_0x8d5c('0xdd')],'raw':!![]});if(_0x5d661a[_0x8d5c('0x44')][_0x8d5c('0xde')]){_0x1705ae[_0x8d5c('0xba')]({'model':db[_0x8d5c('0xdf')],'as':_0x8d5c('0xdf'),'raw':!![]});}var _0x3beac0=[{'model':db[_0x8d5c('0xc8')],'as':_0x8d5c('0xe0'),'attributes':['id',_0x8d5c('0x7a'),'createdAt',_0x8d5c('0xe1'),_0x8d5c('0xe2'),'read'],'include':_0x1705ae}];_0x3beac0[_0x8d5c('0xba')]({'model':db[_0x8d5c('0xe3')],'as':_0x8d5c('0xe4'),'attributes':['id',_0x8d5c('0x2f')]});_0x3beac0[_0x8d5c('0xba')]({'model':db['User'],'as':_0x8d5c('0xe5'),'attributes':['id',_0x8d5c('0x33')]});return db[_0x8d5c('0xc3')]['find']({'where':{'id':_0x5d661a[_0x8d5c('0xbe')]['id']},'include':_0x3beac0})[_0x8d5c('0x2c')](handleEntityNotFound(_0x3d2da8,null))[_0x8d5c('0x2c')](function(_0x35a71d){if(_0x35a71d){var _0x13b8e3=_0x35a71d[_0x8d5c('0xe6')]({'plain':!![]});fs[_0x8d5c('0xe7')](_0x508578);var _0x3e7b2f={'channel':_0x8d5c('0xe8'),'account':_0x13b8e3['Account'][_0x8d5c('0x2f')],'agent':_0x13b8e3[_0x8d5c('0xe5')]?_0x13b8e3[_0x8d5c('0xe5')][_0x8d5c('0x33')]:_0x8d5c('0xe9'),'createdAt':moment(_0x13b8e3[_0x8d5c('0x84')])[_0x8d5c('0xd9')](_0x8d5c('0xea'))[_0x8d5c('0xa1')](),'closedAt':_0x13b8e3[_0x8d5c('0x3e')]?moment(_0x13b8e3[_0x8d5c('0xeb')])[_0x8d5c('0xd9')](_0x8d5c('0xea'))[_0x8d5c('0xa1')]():'','disposition':_0x13b8e3[_0x8d5c('0xec')],'messages':_(_0x13b8e3['Messages'])[_0x8d5c('0x90')]({'secret':![]})[_0x8d5c('0x32')](function(_0x3ff50d){if(_0x3ff50d['Attachment']){var _0x404970=path['join'](_0x18d691,_0x3ff50d['Attachment'][_0x8d5c('0xed')]);if(fs[_0x8d5c('0xee')](_0x404970)){fs[_0x8d5c('0xef')](_0x404970)['pipe'](fs[_0x8d5c('0xf0')](path[_0x8d5c('0xd4')](_0x508578,_0x3ff50d[_0x8d5c('0xdf')]['basename'])));}}return{'date':moment(_0x3ff50d[_0x8d5c('0x84')])[_0x8d5c('0xd9')](_0x8d5c('0xea'))[_0x8d5c('0xa1')](),'sender':_0x3ff50d[_0x8d5c('0xe1')]===_0x8d5c('0xf1')?_0x3ff50d[_0x8d5c('0x78')]?_0x3ff50d[_0x8d5c('0x78')][_0x8d5c('0x33')]:_0x8d5c('0xf2'):_0x3ff50d['Contact'][_0x8d5c('0xdc')]+(_0x3ff50d['Contact']['lastName']?'\x20'+_0x3ff50d[_0x8d5c('0x6c')][_0x8d5c('0xdd')]:''),'body':_0x3ff50d[_0x8d5c('0xdf')]?_0x3ff50d['Attachment']['basename']:_0x3ff50d[_0x8d5c('0x7a')],'direction':_0x3ff50d[_0x8d5c('0xe1')]===_0x8d5c('0xf1')?'A':'C','secret':_0x3ff50d[_0x8d5c('0xe2')],'read':_0x3ff50d[_0x8d5c('0x8b')],'attachment':_0x3ff50d[_0x8d5c('0xdf')]};})[_0x8d5c('0x68')]()};return ejs['renderFile'](path[_0x8d5c('0xd4')](config['root'],'server',_0x8d5c('0xf3'),_0x8d5c('0xf4')),{'interaction':_0x3e7b2f})[_0x8d5c('0x2c')](function(_0x30035b){var _0x20269e=path[_0x8d5c('0xd4')](_0x508578,'transcript-'+_0x13b8e3['id']+'-'+_0x259c8a+'.pdf');var _0x42a3bb={'path':_0x20269e,'channel':_0x8d5c('0xe8'),'interactionId':_0x13b8e3['id']};return pdf[_0x8d5c('0xf5')](_0x30035b,_0x42a3bb);})[_0x8d5c('0x2c')](function(){return new BPromise(function(_0x5ca639,_0x262f5b){zipdir(_0x508578,{'saveTo':_0x2c7609},function(_0x179891,_0x541300){if(_0x179891)return _0x262f5b(_0x179891);return _0x5ca639(_0x541300);});})[_0x8d5c('0x2c')](function(){return new BPromise(function(_0x3ea136,_0x57145c){rimraf(_0x508578,function(_0x41438b){if(_0x41438b)_0x57145c(_0x41438b);return _0x3ea136();});});})[_0x8d5c('0x2c')](function(){return _0x3d2da8[_0x8d5c('0xd2')](_0x2c7609,_0x3072ca,function(_0x34e70e){if(_0x34e70e){console[_0x8d5c('0xf6')]('err',_0x34e70e);}else{fs['unlinkSync'](_0x2c7609);}});});});}else{return _0x3d2da8[_0x8d5c('0x1f')](0xc8);}})[_0x8d5c('0x38')](handleError(_0x3d2da8,null));}; \ No newline at end of file +var _0xac35=['o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','WhatsappInteraction','includeAll','create','params','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','WhatsappInteractionId','format','options','include','addTags','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','WhatsappAccount','Account','Owner','mkdirSync','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','createReadStream','pipe','createWriteStream','basename','out','System','secret','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','Users','TagIds','Tags','split','forEach','push','catch','talking','answered','unmanaged','total','UserId','closed','waiting','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','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?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','fields','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','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax'];(function(_0x4c4932,_0x79f03b){var _0x4290bf=function(_0x53f865){while(--_0x53f865){_0x4c4932['push'](_0x4c4932['shift']());}};_0x4290bf(++_0x79f03b);}(_0xac35,0x141));var _0x5ac3=function(_0x5c9058,_0x36cfba){_0x5c9058=_0x5c9058-0x0;var _0x108b70=_0xac35[_0x5c9058];return _0x108b70;};'use strict';var emlformat=require(_0x5ac3('0x0'));var rimraf=require(_0x5ac3('0x1'));var zipdir=require(_0x5ac3('0x2'));var jsonpatch=require(_0x5ac3('0x3'));var rp=require(_0x5ac3('0x4'));var moment=require(_0x5ac3('0x5'));var BPromise=require(_0x5ac3('0x6'));var Mustache=require(_0x5ac3('0x7'));var util=require(_0x5ac3('0x8'));var path=require(_0x5ac3('0x9'));var sox=require(_0x5ac3('0xa'));var csv=require(_0x5ac3('0xb'));var ejs=require(_0x5ac3('0xc'));var fs=require('fs');var fs_extra=require(_0x5ac3('0xd'));var _=require('lodash');var squel=require(_0x5ac3('0xe'));var crypto=require('crypto');var jsforce=require(_0x5ac3('0xf'));var deskjs=require(_0x5ac3('0x10'));var toCsv=require(_0x5ac3('0xb'));var querystring=require(_0x5ac3('0x11'));var Papa=require(_0x5ac3('0x12'));var Redis=require(_0x5ac3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ac3('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5ac3('0x15'));var hardwareService=require(_0x5ac3('0x16'));var logger=require(_0x5ac3('0x17'))(_0x5ac3('0x18'));var utils=require(_0x5ac3('0x19'));var config=require(_0x5ac3('0x1a'));var licenseUtil=require(_0x5ac3('0x1b'));var db=require('../../mysqldb')['db'];config[_0x5ac3('0x1c')]=_[_0x5ac3('0x1d')](config[_0x5ac3('0x1c')],{'host':_0x5ac3('0x1e'),'port':0x18eb});var socket=require(_0x5ac3('0x1f'))(new Redis(config[_0x5ac3('0x1c')]));require(_0x5ac3('0x20'))[_0x5ac3('0x21')](socket);function respondWithStatusCode(_0x5b64a8,_0x585770){_0x585770=_0x585770||0xcc;return function(_0x3926d0){if(_0x3926d0){return _0x5b64a8[_0x5ac3('0x22')](_0x585770);}return _0x5b64a8['status'](_0x585770)[_0x5ac3('0x23')]();};}function respondWithResult(_0x4b718a,_0x45c7ed){_0x45c7ed=_0x45c7ed||0xc8;return function(_0x18cad4){if(_0x18cad4){return _0x4b718a[_0x5ac3('0x24')](_0x45c7ed)['json'](_0x18cad4);}};}function respondWithFilteredResult(_0x13a1b5,_0x1c2566){return function(_0x200eca){if(_0x200eca){var _0x141128=typeof _0x1c2566['offset']===_0x5ac3('0x25')&&typeof _0x1c2566[_0x5ac3('0x26')]===_0x5ac3('0x25');var _0x2ec013=_0x200eca[_0x5ac3('0x27')];var _0xeb7dea=_0x141128?0x0:_0x1c2566[_0x5ac3('0x28')];var _0x2fcc26=_0x141128?_0x200eca[_0x5ac3('0x27')]:_0x1c2566[_0x5ac3('0x28')]+_0x1c2566[_0x5ac3('0x26')];var _0x38486d;if(_0x2fcc26>=_0x2ec013){_0x2fcc26=_0x2ec013;_0x38486d=0xc8;}else{_0x38486d=0xce;}_0x13a1b5['status'](_0x38486d);return _0x13a1b5[_0x5ac3('0x29')](_0x5ac3('0x2a'),_0xeb7dea+'-'+_0x2fcc26+'/'+_0x2ec013)[_0x5ac3('0x2b')](_0x200eca);}return null;};}function patchUpdates(_0x3edd5f){return function(_0x53b383){try{jsonpatch[_0x5ac3('0x2c')](_0x53b383,_0x3edd5f,!![]);}catch(_0x1e28f6){return BPromise[_0x5ac3('0x2d')](_0x1e28f6);}return _0x53b383[_0x5ac3('0x2e')]();};}function saveUpdates(_0x5ec3fc,_0x1eb39c){return function(_0x567807){if(_0x567807){return _0x567807[_0x5ac3('0x2f')](_0x5ec3fc)['then'](function(_0x5e6076){return _0x5e6076;});}return null;};}function removeEntity(_0x395127,_0x208615){return function(_0x47d765){if(_0x47d765){return _0x47d765[_0x5ac3('0x30')]()[_0x5ac3('0x31')](function(){_0x395127[_0x5ac3('0x24')](0xcc)[_0x5ac3('0x23')]();});}};}function handleEntityNotFound(_0x4af783,_0x452519){return function(_0x228deb){if(!_0x228deb){_0x4af783[_0x5ac3('0x22')](0x194);}return _0x228deb;};}function handleError(_0x372006,_0x84eeb4){_0x84eeb4=_0x84eeb4||0x1f4;return function(_0xf37646){logger[_0x5ac3('0x32')](_0xf37646['stack']);if(_0xf37646[_0x5ac3('0x33')]){delete _0xf37646[_0x5ac3('0x33')];}_0x372006[_0x5ac3('0x24')](_0x84eeb4)['send'](_0xf37646);};}function getInteractionUsers(_0x8d4a36,_0x470090){return new BPromise(function(_0x28c96e,_0x5df562){try{if(_0x470090[_0x8d4a36['id']]){_0x8d4a36[_0x5ac3('0x34')]=_['map'](_0x470090[_0x8d4a36['id']],function(_0x359c5a){return{'id':_0x359c5a['id'],'fullname':_0x359c5a['fullname']};});}}catch(_0x443998){_0x5df562(_0x443998);}_0x28c96e(_0x8d4a36);});}function getInteractionTags(_0x384ed4,_0x5a4497){return new BPromise(function(_0x5afa5b,_0x52b712){try{if(_0x384ed4[_0x5ac3('0x35')]){_0x384ed4[_0x5ac3('0x36')]=[];_0x384ed4['TagIds'][_0x5ac3('0x37')](',')[_0x5ac3('0x38')](function(_0x111881){_0x384ed4[_0x5ac3('0x36')][_0x5ac3('0x39')](_0x5a4497[_0x111881]);});}delete _0x384ed4[_0x5ac3('0x35')];}catch(_0x57e07f){_0x52b712(_0x57e07f);}_0x5afa5b(_0x384ed4);});}function updateWhatsappInteraction(_0x4552ab,_0x386c9c,_0x17a0cc){return new BPromise(function(_0x836011,_0x5adb79){return getInteractionUsers(_0x4552ab,_0x17a0cc)['then'](function(_0x3466ef){return getInteractionTags(_0x3466ef,_0x386c9c);})['then'](function(_0x20a0d7){return getStateInteraction(_0x20a0d7);})[_0x5ac3('0x31')](function(_0x528b50){_0x836011(_0x528b50);})[_0x5ac3('0x3a')](function(_0x4e68ea){_0x5adb79(_0x4e68ea);});});}function getStateInteraction(_0x36960a){return new BPromise(function(_0x49ed51){_0x36960a['waiting']=0x0;_0x36960a[_0x5ac3('0x3b')]=0x0;_0x36960a[_0x5ac3('0x3c')]=0x0;_0x36960a[_0x5ac3('0x3d')]=0x0;_0x36960a[_0x5ac3('0x3e')]=0x0;if(!_0x36960a['closed']&&!_0x36960a[_0x5ac3('0x3f')]){_0x36960a['waiting']+=0x1;}if(!_0x36960a[_0x5ac3('0x40')]&&_0x36960a[_0x5ac3('0x3f')]){_0x36960a[_0x5ac3('0x3b')]+=0x1;if(_0x36960a[_0x5ac3('0x41')]){_0x36960a[_0x5ac3('0x41')]-=0x1;}}if(_0x36960a['closed']&&_0x36960a[_0x5ac3('0x3f')]){_0x36960a[_0x5ac3('0x3c')]+=0x1;if(_0x36960a[_0x5ac3('0x3b')]){_0x36960a[_0x5ac3('0x3b')]-=0x1;}}if(_0x36960a[_0x5ac3('0x40')]&&!_0x36960a[_0x5ac3('0x3f')]){_0x36960a[_0x5ac3('0x3d')]+=0x1;if(_0x36960a[_0x5ac3('0x41')]){_0x36960a[_0x5ac3('0x41')]-=0x1;}}_0x36960a[_0x5ac3('0x3e')]+=0x1;_0x49ed51(_0x36960a);});}exports[_0x5ac3('0x42')]=function(_0x10292e,_0x2dd86e){var _0x31897f={},_0x5bd8e6={},_0x20c16c={'count':0x0,'rows':[]};var _0x35155b=_['map'](db['WhatsappInteraction'][_0x5ac3('0x43')],function(_0x40f749){return{'name':_0x40f749[_0x5ac3('0x44')],'type':_0x40f749['type'][_0x5ac3('0x45')]};});_0x5bd8e6[_0x5ac3('0x46')]=_[_0x5ac3('0x47')](_0x35155b,_0x5ac3('0x33'));_0x5bd8e6[_0x5ac3('0x48')]=_[_0x5ac3('0x49')](_0x10292e[_0x5ac3('0x48')]);_0x5bd8e6[_0x5ac3('0x4a')]=_[_0x5ac3('0x4b')](_0x5bd8e6[_0x5ac3('0x46')],_0x5bd8e6[_0x5ac3('0x48')]);_0x31897f[_0x5ac3('0x4c')]=_[_0x5ac3('0x4b')](_0x5bd8e6['model'],qs['fields'](_0x10292e['query']['fields']));_0x31897f['attributes']=_0x31897f['attributes'][_0x5ac3('0x4d')]?_0x31897f[_0x5ac3('0x4c')]:_0x5bd8e6[_0x5ac3('0x46')];if(!_0x10292e['query'][_0x5ac3('0x4e')](_0x5ac3('0x4f'))){_0x31897f[_0x5ac3('0x26')]=qs[_0x5ac3('0x26')](_0x10292e[_0x5ac3('0x48')]['limit']);_0x31897f[_0x5ac3('0x28')]=qs[_0x5ac3('0x28')](_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x28')]);}_0x31897f[_0x5ac3('0x50')]=qs['sort'](_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x51')]);_0x31897f[_0x5ac3('0x52')]=qs[_0x5ac3('0x4a')](_['pick'](_0x10292e[_0x5ac3('0x48')],_0x5bd8e6[_0x5ac3('0x4a')]),_0x35155b);var _0xba49dd=[];var _0x47332a=squel['select']()[_0x5ac3('0x53')]('id')[_0x5ac3('0x53')](_0x5ac3('0x33'))[_0x5ac3('0x53')](_0x5ac3('0x54'))[_0x5ac3('0x55')](_0x5ac3('0x56'));var _0x572228=squel['select']()[_0x5ac3('0x53')](_0x5ac3('0x57'))[_0x5ac3('0x53')](_0x5ac3('0x58'))[_0x5ac3('0x53')]('ui.WhatsappInteractionId')['from'](_0x5ac3('0x59'),'ui')[_0x5ac3('0x5a')](_0x5ac3('0x5b'),'u',_0x5ac3('0x5c'));var _0x68538a=squel[_0x5ac3('0x5d')]()['from'](_0x5ac3('0x5e'),'i')[_0x5ac3('0x5a')](_0x5ac3('0x5f'),'c',_0x5ac3('0x60'))['left_join'](_0x5ac3('0x5b'),'o',_0x5ac3('0x61'))[_0x5ac3('0x5a')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x5ac3('0x5a')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x5ac3('0x5a')](_0x5ac3('0x62'),'it',_0x5ac3('0x63'))[_0x5ac3('0x5a')](_0x5ac3('0x56'),'t',_0x5ac3('0x64'));var _0x6e3295=squel[_0x5ac3('0x65')]();var _0x135fcb=[];var _0x53646b=squel[_0x5ac3('0x65')]();var _0x253579;if(_0x10292e[_0x5ac3('0x48')]['search']){_0x253579=as[_0x5ac3('0x66')](_0x10292e['query']['search']);var _0x18a3b6=_0x253579[_0x5ac3('0x67')];for(var _0x14956c=0x0;_0x14956c<_0x253579[_0x5ac3('0x68')][_0x5ac3('0x4d')];_0x14956c++){var _0x39c5d0=_0x253579[_0x5ac3('0x68')][_0x14956c];var _0x1a29de='i';var _0x59fb35=_[_0x5ac3('0x69')](_0x35155b,[_0x5ac3('0x33'),_0x39c5d0[_0x5ac3('0x53')]]);if(!_0x59fb35){switch(_0x39c5d0['field']){case'unreadMessages':if(_0x39c5d0[_0x5ac3('0x6a')]==0x1){_0x68538a[_0x5ac3('0x6b')]('`'+_0x39c5d0['field']+_0x5ac3('0x6c'));}else{_0x68538a[_0x5ac3('0x6b')]('`'+_0x39c5d0[_0x5ac3('0x53')]+_0x5ac3('0x6d'));}break;case'Contact':if(_0x39c5d0['operator']===_0x5ac3('0x6e')){if(_0x39c5d0[_0x5ac3('0x6a')]['split']('\x20')['length']>0x1){_0x6e3295[_0x18a3b6](_0x5ac3('0x6f'),qs[_0x5ac3('0x70')](_0x39c5d0[_0x5ac3('0x6a')]),null);}else{var _0x230f1e='%'+_0x39c5d0[_0x5ac3('0x6a')]+'%';_0x6e3295[_0x18a3b6](_0x5ac3('0x71'),_0x230f1e,_0x230f1e,_0x230f1e);}}else{_0x59fb35=_[_0x5ac3('0x69')](_0x35155b,[_0x5ac3('0x33'),_0x5ac3('0x72')]);_0x39c5d0[_0x5ac3('0x53')]='ContactId';_0x492d5e=as['buildExpression'](_0x1a29de,_0x59fb35[_0x5ac3('0x73')],_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x75')],_0x492d5e['value'][_0x5ac3('0x23')]);}break;case _0x5ac3('0x76'):var _0x547006=_0x39c5d0[_0x5ac3('0x6a')][_0x5ac3('0x37')](',')[_0x5ac3('0x47')](function(_0x254c5d){return Number(_0x254c5d);});_0x547006[_0x5ac3('0x38')](function(_0x3d06ee){_0x53646b['or'](_0x5ac3('0x77'),'%,'+_0x3d06ee+',%');});_0x135fcb=_[_0x5ac3('0x78')](_0x135fcb,_0x547006);break;case'User':if(_0x39c5d0[_0x5ac3('0x79')]==='$substring'){_0x6e3295[_0x18a3b6](_0x5ac3('0x7a'),'%'+_0x39c5d0[_0x5ac3('0x6a')]+'%',null);}else{_0x59fb35=_['find'](_0x35155b,['name',_0x5ac3('0x3f')]);_0x39c5d0[_0x5ac3('0x53')]=_0x5ac3('0x3f');_0x492d5e=as['buildExpression'](_0x1a29de,_0x59fb35[_0x5ac3('0x73')],_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e['value'][_0x5ac3('0x75')],_0x492d5e['value']['end']);}break;case _0x5ac3('0x7b'):_0x492d5e=as[_0x5ac3('0x7c')]('me',null,_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x75')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x23')]);break;}}else{var _0x492d5e=as['buildExpression'](_0x1a29de,_0x59fb35[_0x5ac3('0x73')],_0x39c5d0);_0x6e3295[_0x18a3b6](_0x492d5e[_0x5ac3('0x74')],_0x492d5e[_0x5ac3('0x6a')][_0x5ac3('0x75')],_0x492d5e['value']['end']);}}}else{var _0x1d5cc2=_(_0x10292e[_0x5ac3('0x48')])['keys']()[_0x5ac3('0x47')](function(_0x17bbd4){return _[_0x5ac3('0x7d')](_0x35155b,['name',_0x17bbd4])?_0x17bbd4:undefined;})[_0x5ac3('0x7e')]()['value']();if(!_[_0x5ac3('0x7f')](_0x1d5cc2)){_0x1d5cc2[_0x5ac3('0x38')](function(_0xec0bb2){if(_0xec0bb2===_0x5ac3('0x80')){_0x68538a[_0x5ac3('0x52')](_0x5ac3('0x81'),[][_0x5ac3('0x82')](_0x10292e[_0x5ac3('0x48')][_0xec0bb2]));}else if(_0xec0bb2==='createdAt'){var _0x4a5092=JSON[_0x5ac3('0x83')](_0x10292e['query'][_0xec0bb2])[_0x5ac3('0x84')];var _0x4d028f=JSON['parse'](_0x10292e['query'][_0xec0bb2])[_0x5ac3('0x85')];_0x68538a['where'](_0x5ac3('0x86'),_0x4a5092,_0x4d028f);}else{if(_0x10292e[_0x5ac3('0x48')][_0xec0bb2]===_0x5ac3('0x87')){_0x68538a[_0x5ac3('0x52')]('i.'+_0xec0bb2+_0x5ac3('0x88'));}else{_0x68538a['where']('i.'+_0xec0bb2+_0x5ac3('0x89'),_0x10292e[_0x5ac3('0x48')][_0xec0bb2]);}}});}if(_0x10292e['query'][_0x5ac3('0x8a')]){if(_0x10292e['query'][_0x5ac3('0x8a')]==0x1){_0x68538a[_0x5ac3('0x6b')](_0x5ac3('0x8b'));}else{_0x68538a[_0x5ac3('0x6b')](_0x5ac3('0x8c'));}}if(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8d')]){_0x135fcb=_[_0x5ac3('0x8e')](_0x10292e[_0x5ac3('0x48')]['tag'])?_0x10292e[_0x5ac3('0x48')]['tag']:new Array(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8d')]);_0x135fcb[_0x5ac3('0x38')](function(_0x3d45d7){_0x53646b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3d45d7+',%');});}if(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8f')]){var _0x451279=_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x8f')]['replace']('\x5c','\x5c\x5c')[_0x5ac3('0x90')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x451279)){_0x6e3295['or'](_0x5ac3('0x91'),_0x451279+'%')['or'](_0x5ac3('0x92'),_0x451279+'%');}else{_0x6e3295['or'](_0x5ac3('0x93'),qs[_0x5ac3('0x70')](_0x451279))['or'](_0x5ac3('0x94'),_0x451279+'%');}}}_0x68538a[_0x5ac3('0x52')](_0x6e3295);_0x68538a[_0x5ac3('0x95')](_0x5ac3('0x96'));var _0x57844e={'type':db['Sequelize'][_0x5ac3('0x97')][_0x5ac3('0x98')],'raw':!![]};var _0x424e05=_0x68538a['clone']();_0x424e05['field'](_0x5ac3('0x96'));_0x424e05[_0x5ac3('0x53')](_0x5ac3('0x99'),_0x5ac3('0x9a'));if(_0x31897f[_0x5ac3('0x50')]){_0x31897f[_0x5ac3('0x50')][_0x5ac3('0x38')](function(_0x3c9be1){var _0x2a6be4=_0x3c9be1[0x0]==='contactName'?_0x3c9be1[0x0]:'i.'+_0x3c9be1[0x0];_0x68538a['order'](_0x2a6be4,_0x3c9be1[0x1]===_0x5ac3('0x9b')?![]:!![]);});}if(!_[_0x5ac3('0x7f')](_0x135fcb)){_0x68538a['having'](_0x53646b);_0x424e05['where']('t.id\x20IN\x20?',_0x135fcb);}BPromise[_0x5ac3('0x9c')]()[_0x5ac3('0x31')](function(){if(!_0x253579){if(_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x80')])return;_0x424e05['where'](_0x5ac3('0x9d'));_0x68538a[_0x5ac3('0x52')](_0x5ac3('0x9d'));return;}if(_0x10292e[_0x5ac3('0x9e')][_0x5ac3('0x9f')]!=='agent')return;return _0x10292e['user'][_0x5ac3('0xa0')]({'attributes':['id'],'raw':!![]})[_0x5ac3('0x31')](function(_0x52015c){if(_[_0x5ac3('0x7f')](_0x52015c)){_0x424e05['where'](_0x5ac3('0xa1'));_0x68538a[_0x5ac3('0x52')](_0x5ac3('0xa1'));}else{_0x424e05['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x5ac3('0x47')](_0x52015c,'id'));_0x68538a[_0x5ac3('0x52')]('i.WhatsappAccountId\x20IN\x20?',_[_0x5ac3('0x47')](_0x52015c,'id'));}});})['then'](function(){if(_0x10292e[_0x5ac3('0x9e')][_0x5ac3('0x9f')]===_0x5ac3('0xa2')&&!_0x253579&&!_0x10292e[_0x5ac3('0x48')][_0x5ac3('0x80')])return[];return db[_0x5ac3('0xa3')][_0x5ac3('0x48')](_0x424e05[_0x5ac3('0xa4')](),_0x57844e);})[_0x5ac3('0x31')](function(_0x1cde2e){_0x20c16c[_0x5ac3('0x27')]=_0x1cde2e[_0x5ac3('0x4d')];if(_0x20c16c[_0x5ac3('0x27')]===0x0)return[];return db[_0x5ac3('0xa3')][_0x5ac3('0x48')](_0x47332a[_0x5ac3('0xa4')](),_0x57844e)[_0x5ac3('0x31')](function(_0x48c4bf){_0xba49dd=_['keyBy'](_0x48c4bf,'id');_0x57844e=_[_0x5ac3('0xa5')](_0x57844e,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10292e['query'][_0x5ac3('0xa6')]){_0x31897f[_0x5ac3('0x4c')][_0x5ac3('0x38')](function(_0x11848f){_0x68538a['field']('i.'+_0x11848f);});}else{_0x68538a[_0x5ac3('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xa7'),_0x5ac3('0xa8'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xa9'),_0x5ac3('0xaa'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xab'),_0x5ac3('0xac'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xad'));_0x68538a['field']('c.firstName',_0x5ac3('0xae'));_0x68538a[_0x5ac3('0x53')]('c.lastName',_0x5ac3('0xaf'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb0'),_0x5ac3('0xb1'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb2'),'Contact.phone');_0x68538a[_0x5ac3('0x53')]('c.mobile',_0x5ac3('0xb3'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb4'),'Contact.fax');_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb5'),_0x5ac3('0xb6'));_0x68538a[_0x5ac3('0x53')]('o.internal',_0x5ac3('0xb7'));_0x68538a[_0x5ac3('0x53')](_0x5ac3('0xb8'),'TagIds');}if(_0x31897f[_0x5ac3('0x26')])_0x68538a['limit'](_0x31897f[_0x5ac3('0x26')]);if(_0x31897f[_0x5ac3('0x28')])_0x68538a[_0x5ac3('0x28')](_0x31897f[_0x5ac3('0x28')]);return db['sequelize'][_0x5ac3('0x48')](_0x68538a[_0x5ac3('0xa4')](),_0x57844e);})[_0x5ac3('0x31')](function(_0x1252b2){if(_0x1252b2[_0x5ac3('0x4d')]>0x0)_0x572228[_0x5ac3('0x52')](_0x5ac3('0xb9'),_[_0x5ac3('0x47')](_0x1252b2,'id'));return db[_0x5ac3('0xa3')]['query'](_0x572228[_0x5ac3('0xa4')](),_0x57844e)[_0x5ac3('0x31')](function(_0x121bfc){var _0xcbeeb0=_[_0x5ac3('0xba')](_0x121bfc,'WhatsappInteractionId');var _0x3e7002=[];_0x1252b2[_0x5ac3('0x38')](function(_0x1a6bc8){_0x3e7002['push'](updateWhatsappInteraction(_0x1a6bc8,_0xba49dd,_0xcbeeb0));});return BPromise[_0x5ac3('0xbb')](_0x3e7002);});});})[_0x5ac3('0x31')](function(_0x5e22db){_0x20c16c[_0x5ac3('0xbc')]=_0x5e22db;return _0x20c16c;})[_0x5ac3('0x31')](respondWithFilteredResult(_0x2dd86e,_0x31897f))[_0x5ac3('0x3a')](handleError(_0x2dd86e,null));};exports['show']=function(_0x1b264b,_0x3560dd){var _0x38cc54={'raw':![],'where':{'id':_0x1b264b['params']['id']}},_0x5f4a91={};_0x5f4a91['model']=_[_0x5ac3('0x49')](db[_0x5ac3('0xbd')][_0x5ac3('0x43')]);_0x5f4a91['query']=_[_0x5ac3('0x49')](_0x1b264b[_0x5ac3('0x48')]);_0x5f4a91[_0x5ac3('0x4a')]=_['intersection'](_0x5f4a91[_0x5ac3('0x46')],_0x5f4a91[_0x5ac3('0x48')]);_0x38cc54[_0x5ac3('0x4c')]=_[_0x5ac3('0x4b')](_0x5f4a91['model'],qs[_0x5ac3('0xa6')](_0x1b264b[_0x5ac3('0x48')][_0x5ac3('0xa6')]));_0x38cc54[_0x5ac3('0x4c')]=_0x38cc54['attributes'][_0x5ac3('0x4d')]?_0x38cc54[_0x5ac3('0x4c')]:_0x5f4a91['model'];if(_0x1b264b[_0x5ac3('0x48')][_0x5ac3('0xbe')]){_0x38cc54['include']=[{'all':!![]}];}_0x38cc54=_['merge']({},_0x38cc54,_0x1b264b['options']);return db[_0x5ac3('0xbd')][_0x5ac3('0x69')](_0x38cc54)[_0x5ac3('0x31')](handleEntityNotFound(_0x3560dd,null))[_0x5ac3('0x31')](respondWithResult(_0x3560dd,null))[_0x5ac3('0x3a')](handleError(_0x3560dd,null));};exports[_0x5ac3('0xbf')]=function(_0x240569,_0x59719a){return db[_0x5ac3('0xbd')][_0x5ac3('0xbf')](_0x240569[_0x5ac3('0x7b')],{})[_0x5ac3('0x31')](respondWithResult(_0x59719a,0xc9))[_0x5ac3('0x3a')](handleError(_0x59719a,null));};exports['update']=function(_0x256420,_0x34f786){if(_0x256420['body']['id']){delete _0x256420[_0x5ac3('0x7b')]['id'];}return db[_0x5ac3('0xbd')][_0x5ac3('0x69')]({'where':{'id':_0x256420['params']['id']}})['then'](handleEntityNotFound(_0x34f786,null))[_0x5ac3('0x31')](saveUpdates(_0x256420['body'],null))[_0x5ac3('0x31')](respondWithResult(_0x34f786,null))[_0x5ac3('0x3a')](handleError(_0x34f786,null));};exports[_0x5ac3('0x30')]=function(_0x47bd6e,_0x5a7802){return db[_0x5ac3('0xbd')][_0x5ac3('0x69')]({'where':{'id':_0x47bd6e[_0x5ac3('0xc0')]['id']}})['then'](handleEntityNotFound(_0x5a7802,null))[_0x5ac3('0x31')](removeEntity(_0x5a7802,null))[_0x5ac3('0x3a')](handleError(_0x5a7802,null));};exports[_0x5ac3('0xc1')]=function(_0x19e208,_0xc2cba7){return db['WhatsappInteraction'][_0x5ac3('0xc1')]()[_0x5ac3('0x31')](respondWithResult(_0xc2cba7,null))['catch'](handleError(_0xc2cba7,null));};exports[_0x5ac3('0xc2')]=function(_0x3fd4fb,_0x5c1376,_0x3966eb){return db['WhatsappMessage'][_0x5ac3('0x69')]({'where':{'id':_0x3fd4fb['params']['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x5c1376,null))[_0x5ac3('0x31')](function(_0x1010aa){if(_0x1010aa){return _0x1010aa[_0x5ac3('0xc2')](_0x3fd4fb[_0x5ac3('0x7b')][_0x5ac3('0xc3')],_[_0x5ac3('0xc4')](_0x3fd4fb['body'],['ids','id'])||{});}})[_0x5ac3('0x31')](respondWithResult(_0x5c1376,null))[_0x5ac3('0x3a')](handleError(_0x5c1376,null));};exports[_0x5ac3('0xc5')]=function(_0x113eca,_0x3473a0,_0x31c208){var _0x1b502e={'raw':![],'where':{}};var _0x2d1001={};var _0x45973d={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x5ac3('0xc6')]({'where':{'id':_0x113eca['params']['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x3473a0,null))[_0x5ac3('0x31')](function(_0x177a0b){if(_0x177a0b){_0x2d1001['model']=_[_0x5ac3('0x49')](db[_0x5ac3('0xc7')][_0x5ac3('0x43')]);_0x2d1001['query']=_[_0x5ac3('0x49')](_0x113eca[_0x5ac3('0x48')]);_0x2d1001[_0x5ac3('0x4a')]=_[_0x5ac3('0x4b')](_0x2d1001[_0x5ac3('0x46')],_0x2d1001[_0x5ac3('0x48')]);_0x1b502e[_0x5ac3('0x4c')]=_[_0x5ac3('0x4b')](_0x2d1001[_0x5ac3('0x46')],qs[_0x5ac3('0xa6')](_0x113eca[_0x5ac3('0x48')][_0x5ac3('0xa6')]));_0x1b502e['attributes']=_0x1b502e[_0x5ac3('0x4c')]['length']?_0x1b502e[_0x5ac3('0x4c')]:_0x2d1001[_0x5ac3('0x46')];if(!_0x113eca['query']['hasOwnProperty'](_0x5ac3('0x4f'))){_0x1b502e['limit']=qs['limit'](_0x113eca['query'][_0x5ac3('0x26')]);_0x1b502e['offset']=qs[_0x5ac3('0x28')](_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x28')]);}_0x1b502e[_0x5ac3('0x50')]=qs[_0x5ac3('0x51')](_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x51')]);_0x1b502e[_0x5ac3('0x52')]=qs[_0x5ac3('0x4a')](_['pick'](_0x113eca[_0x5ac3('0x48')],_0x2d1001[_0x5ac3('0x4a')]));_0x1b502e[_0x5ac3('0x52')][_0x5ac3('0xc8')]=_0x177a0b['id'];if(_0x113eca[_0x5ac3('0x48')]['filter']){_0x1b502e['where']=_[_0x5ac3('0xa5')](_0x1b502e['where'],{'$or':_[_0x5ac3('0x47')](_0x1b502e['attributes'],function(_0x166615){var _0x50d5b9={};_0x50d5b9[_0x166615]={'$like':'%'+_0x113eca['query'][_0x5ac3('0x8f')]+'%'};return _0x50d5b9;})});}if(_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x84')]){var _0x4345af=_0x113eca[_0x5ac3('0x48')][_0x5ac3('0x84')][_0x5ac3('0x37')](',');var _0x25b7df={};_0x25b7df[_0x4345af[0x0]]={'$gte':moment(_0x4345af[0x1])[_0x5ac3('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b502e[_0x5ac3('0x52')]=_[_0x5ac3('0xa5')](_0x1b502e['where'],_0x25b7df);}_0x1b502e=_[_0x5ac3('0xa5')]({},_0x1b502e,_0x113eca[_0x5ac3('0xca')]);return db[_0x5ac3('0xc7')][_0x5ac3('0x27')]({'where':_0x1b502e[_0x5ac3('0x52')]})[_0x5ac3('0x31')](function(_0x1e3ec1){_0x45973d[_0x5ac3('0x27')]=_0x1e3ec1;if(_0x113eca[_0x5ac3('0x48')][_0x5ac3('0xbe')]){_0x1b502e[_0x5ac3('0xcb')]=[{'all':!![]}];}return db[_0x5ac3('0xc7')]['findAll'](_0x1b502e);})[_0x5ac3('0x31')](function(_0x50e02a){_0x45973d[_0x5ac3('0xbc')]=_0x50e02a;return _0x45973d;});}})[_0x5ac3('0x31')](respondWithFilteredResult(_0x3473a0,_0x1b502e))[_0x5ac3('0x3a')](handleError(_0x3473a0,null));};exports[_0x5ac3('0xcc')]=function(_0x594006,_0x1e5ef3,_0x34f00a){return db['WhatsappInteraction'][_0x5ac3('0x69')]({'where':{'id':_0x594006[_0x5ac3('0xc0')]['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x1e5ef3,null))[_0x5ac3('0x31')](function(_0x50ad5b){if(_0x50ad5b){return _0x50ad5b[_0x5ac3('0xcd')](_0x594006[_0x5ac3('0x7b')][_0x5ac3('0xc3')],_[_0x5ac3('0xc4')](_0x594006[_0x5ac3('0x7b')],['ids','id'])||{})[_0x5ac3('0xce')](function(){return db[_0x5ac3('0x76')][_0x5ac3('0xcf')]({'attributes':['id',_0x5ac3('0x33'),'color'],'where':{'id':_0x594006[_0x5ac3('0x7b')]['ids']}});})[_0x5ac3('0x31')](function(_0x332705){socket[_0x5ac3('0xd0')](_0x5ac3('0xd1'),{'id':Number(_0x594006[_0x5ac3('0xc0')]['id']),'tags':_0x332705||[]});return{'id':Number(_0x594006[_0x5ac3('0xc0')]['id']),'tags':_0x332705||[]};});}})[_0x5ac3('0x31')](respondWithResult(_0x1e5ef3,null))['catch'](handleError(_0x1e5ef3,null));};exports[_0x5ac3('0xd2')]=function(_0x39c815,_0x9b9144,_0x5718cc){return db['WhatsappInteraction'][_0x5ac3('0x69')]({'where':{'id':_0x39c815['params']['id']}})[_0x5ac3('0x31')](handleEntityNotFound(_0x9b9144,null))[_0x5ac3('0x31')](function(_0x276ea8){if(_0x276ea8){return _0x276ea8[_0x5ac3('0xd2')](_0x39c815[_0x5ac3('0x48')][_0x5ac3('0xc3')]);}})[_0x5ac3('0x31')](respondWithStatusCode(_0x9b9144,null))['catch'](handleError(_0x9b9144,null));};exports[_0x5ac3('0xd3')]=function(_0x545d12,_0x16f657){var _0x4a2eae=moment()[_0x5ac3('0xd4')]()['toString']();var _0x4fa6f2=path[_0x5ac3('0xd5')](config[_0x5ac3('0xd6')],_0x5ac3('0xd7'),_0x5ac3('0xd8'),_0x5ac3('0xd9'));var _0x13550e=path[_0x5ac3('0xd5')](config['root'],_0x5ac3('0xd7'),'files',_0x5ac3('0xda'));var _0x377222=path['join'](_0x4fa6f2,_0x4a2eae);var _0x778e2a=util[_0x5ac3('0xc9')]('transcript-%d-%s.zip',_0x545d12[_0x5ac3('0xc0')]['id'],_0x4a2eae);var _0x4e2b37=path['join'](_0x4fa6f2,_0x778e2a);var _0x47a1bb=[];_0x47a1bb[_0x5ac3('0x39')]({'model':db['User'],'as':'User','attributes':['id',_0x5ac3('0xdb')],'raw':!![]});_0x47a1bb[_0x5ac3('0x39')]({'model':db[_0x5ac3('0xdc')],'as':_0x5ac3('0xdd'),'attributes':['id',_0x5ac3('0xde'),_0x5ac3('0xdf')],'raw':!![]});if(_0x545d12['query'][_0x5ac3('0xda')]){_0x47a1bb['push']({'model':db[_0x5ac3('0xe0')],'as':'Attachment','raw':!![]});}var _0x38bde5=[{'model':db[_0x5ac3('0xc7')],'as':_0x5ac3('0xe1'),'attributes':['id',_0x5ac3('0x7b'),_0x5ac3('0xe2'),_0x5ac3('0xe3'),'secret',_0x5ac3('0x8a')],'include':_0x47a1bb}];_0x38bde5[_0x5ac3('0x39')]({'model':db[_0x5ac3('0xe4')],'as':_0x5ac3('0xe5'),'attributes':['id','name']});_0x38bde5[_0x5ac3('0x39')]({'model':db['User'],'as':_0x5ac3('0xe6'),'attributes':['id','fullname']});return db[_0x5ac3('0xbd')][_0x5ac3('0x69')]({'where':{'id':_0x545d12[_0x5ac3('0xc0')]['id']},'include':_0x38bde5})[_0x5ac3('0x31')](handleEntityNotFound(_0x16f657,null))['then'](function(_0xa9b7c9){if(_0xa9b7c9){var _0x27a019=_0xa9b7c9['get']({'plain':!![]});fs[_0x5ac3('0xe7')](_0x377222);var _0x269b5a={'channel':'Whatsapp','account':_0x27a019[_0x5ac3('0xe5')][_0x5ac3('0x33')],'agent':_0x27a019[_0x5ac3('0xe6')]?_0x27a019[_0x5ac3('0xe6')]['fullname']:'N.A.','createdAt':moment(_0x27a019[_0x5ac3('0xe2')])[_0x5ac3('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x27a019[_0x5ac3('0x40')]?moment(_0x27a019[_0x5ac3('0xe8')])['format'](_0x5ac3('0xe9'))['toString']():'','disposition':_0x27a019[_0x5ac3('0xea')],'messages':_(_0x27a019[_0x5ac3('0xe1')])['filter']({'secret':![]})[_0x5ac3('0x47')](function(_0x50ac8b){if(_0x50ac8b[_0x5ac3('0xe0')]){var _0x1089c9=path[_0x5ac3('0xd5')](_0x13550e,_0x50ac8b[_0x5ac3('0xe0')]['basename']);if(fs['existsSync'](_0x1089c9)){fs[_0x5ac3('0xeb')](_0x1089c9)[_0x5ac3('0xec')](fs[_0x5ac3('0xed')](path[_0x5ac3('0xd5')](_0x377222,_0x50ac8b[_0x5ac3('0xe0')][_0x5ac3('0xee')])));}}return{'date':moment(_0x50ac8b[_0x5ac3('0xe2')])['format'](_0x5ac3('0xe9'))[_0x5ac3('0xa4')](),'sender':_0x50ac8b[_0x5ac3('0xe3')]===_0x5ac3('0xef')?_0x50ac8b['User']?_0x50ac8b['User'][_0x5ac3('0xdb')]:_0x5ac3('0xf0'):_0x50ac8b['Contact'][_0x5ac3('0xde')]+(_0x50ac8b['Contact']['lastName']?'\x20'+_0x50ac8b[_0x5ac3('0xdd')]['lastName']:''),'body':_0x50ac8b[_0x5ac3('0xe0')]?_0x50ac8b[_0x5ac3('0xe0')][_0x5ac3('0xee')]:_0x50ac8b[_0x5ac3('0x7b')],'direction':_0x50ac8b[_0x5ac3('0xe3')]===_0x5ac3('0xef')?'A':'C','secret':_0x50ac8b[_0x5ac3('0xf1')],'read':_0x50ac8b[_0x5ac3('0x8a')],'attachment':_0x50ac8b['Attachment']};})['value']()};return ejs[_0x5ac3('0xf2')](path['join'](config[_0x5ac3('0xd6')],_0x5ac3('0xd7'),_0x5ac3('0xf3'),_0x5ac3('0xf4')),{'interaction':_0x269b5a})[_0x5ac3('0x31')](function(_0x79956c){var _0x31ab27=path[_0x5ac3('0xd5')](_0x377222,'transcript-'+_0x27a019['id']+'-'+_0x4a2eae+_0x5ac3('0xf5'));var _0x2ba723={'path':_0x31ab27,'channel':_0x5ac3('0xf6'),'interactionId':_0x27a019['id']};return pdf[_0x5ac3('0xf7')](_0x79956c,_0x2ba723);})[_0x5ac3('0x31')](function(){return new BPromise(function(_0x57dbe3,_0x10078a){zipdir(_0x377222,{'saveTo':_0x4e2b37},function(_0x42131e,_0x2e7e88){if(_0x42131e)return _0x10078a(_0x42131e);return _0x57dbe3(_0x2e7e88);});})['then'](function(){return new BPromise(function(_0x52c0e9,_0x274f9d){rimraf(_0x377222,function(_0x1578b2){if(_0x1578b2)_0x274f9d(_0x1578b2);return _0x52c0e9();});});})[_0x5ac3('0x31')](function(){return _0x16f657[_0x5ac3('0xd3')](_0x4e2b37,_0x778e2a,function(_0x53079){if(_0x53079){console[_0x5ac3('0xf8')](_0x5ac3('0xf9'),_0x53079);}else{fs[_0x5ac3('0xfa')](_0x4e2b37);}});});});}else{return _0x16f657['sendStatus'](0xc8);}})['catch'](handleError(_0x16f657,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fd5d442..ffb32cf 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 _0xf958=['setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then'];(function(_0x872891,_0x2f615d){var _0xf5c75b=function(_0x4c8247){while(--_0x4c8247){_0x872891['push'](_0x872891['shift']());}};_0xf5c75b(++_0x2f615d);}(_0xf958,0xe6));var _0x8f95=function(_0xb6ad36,_0x53a39c){_0xb6ad36=_0xb6ad36-0x0;var _0x320c68=_0xf958[_0xb6ad36];return _0x320c68;};'use strict';var EventEmitter=require(_0x8f95('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8f95('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8f95('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8f95('0x3'),'afterUpdate':_0x8f95('0x4'),'afterDestroy':_0x8f95('0x5')};function emitEvent(_0x482c0c){return function(_0x49d448,_0x32df52,_0x10a425){_0x49d448[_0x8f95('0x6')]({'attributes':['id'],'raw':!![]})[_0x8f95('0x7')](function(_0x5cfc04){_0x49d448[_0x8f95('0x8')](_0x8f95('0x9'),_0x5cfc04[_0x8f95('0xa')](function(_0x19cbd0){return{'id':_0x19cbd0['id']};}));return WhatsappMessage[_0x8f95('0xb')]({'where':{'WhatsappInteractionId':_0x49d448['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x378eb1){_0x49d448[_0x8f95('0x8')]('unreadMessages',_0x378eb1[_0x8f95('0xc')]);WhatsappInteractionEvents[_0x8f95('0xd')](_0x482c0c+':'+_0x49d448['id'],_0x49d448);WhatsappInteractionEvents[_0x8f95('0xd')](_0x482c0c,_0x49d448);_0x10a425(null);})['catch'](_0x10a425(null));};}for(var e in events){if(events[_0x8f95('0xe')](e)){var event=events[e];WhatsappInteraction[_0x8f95('0xf')](e,emitEvent(event));}}module[_0x8f95('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x3013=['update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners'];(function(_0x515985,_0x47fd63){var _0x5852d2=function(_0xa04f74){while(--_0xa04f74){_0x515985['push'](_0x515985['shift']());}};_0x5852d2(++_0x47fd63);}(_0x3013,0xea));var _0x3301=function(_0x33b464,_0xd2326c){_0x33b464=_0x33b464-0x0;var _0x5b4283=_0x3013[_0x33b464];return _0x5b4283;};'use strict';var EventEmitter=require(_0x3301('0x0'));var WhatsappInteraction=require(_0x3301('0x1'))['db'][_0x3301('0x2')];var WhatsappMessage=require(_0x3301('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3301('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3301('0x4'),'afterDestroy':_0x3301('0x5')};function emitEvent(_0xb395bd){return function(_0x3a8c34,_0x501044,_0x30b608){_0x3a8c34['getUsers']({'attributes':['id'],'raw':!![]})[_0x3301('0x6')](function(_0x3d7e08){_0x3a8c34[_0x3301('0x7')](_0x3301('0x8'),_0x3d7e08[_0x3301('0x9')](function(_0x5355e1){return{'id':_0x5355e1['id']};}));return WhatsappMessage[_0x3301('0xa')]({'where':{'WhatsappInteractionId':_0x3a8c34['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3301('0x6')](function(_0x394691){_0x3a8c34[_0x3301('0x7')](_0x3301('0xb'),_0x394691['length']);WhatsappInteractionEvents[_0x3301('0xc')](_0xb395bd+':'+_0x3a8c34['id'],_0x3a8c34);WhatsappInteractionEvents[_0x3301('0xc')](_0xb395bd,_0x3a8c34);_0x30b608(null);})[_0x3301('0xd')](_0x30b608(null));};}for(var e in events){if(events[_0x3301('0xe')](e)){var event=events[e];WhatsappInteraction[_0x3301('0xf')](e,emitEvent(event));}}module[_0x3301('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 603467a..ab4cf37 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 _0x81e5=['../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','closedAt','format','lodash','api','moment','bluebird','path'];(function(_0x5617,_0x592343){var _0xe662da=function(_0x19b54e){while(--_0x19b54e){_0x5617['push'](_0x5617['shift']());}};_0xe662da(++_0x592343);}(_0x81e5,0x97));var _0x581e=function(_0x17aabe,_0x1812d2){_0x17aabe=_0x17aabe-0x0;var _0x5ac57e=_0x81e5[_0x17aabe];return _0x5ac57e;};'use strict';var _=require(_0x581e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x581e('0x1'));var moment=require(_0x581e('0x2'));var BPromise=require(_0x581e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x581e('0x4'));var rimraf=require('rimraf');var config=require(_0x581e('0x5'));var attributes=require(_0x581e('0x6'));module[_0x581e('0x7')]=function(_0x1a9253,_0x132ab5){return _0x1a9253[_0x581e('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x581e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f8654,_0x432aa5,_0xc89bc9){if(_0x3f8654['changed']('closed')){_0x3f8654[_0x581e('0xa')]=moment()[_0x581e('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0xc89bc9(null,_0x3f8654);}}});}; \ No newline at end of file +var _0xcfcb=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format'];(function(_0x130705,_0x2d266b){var _0x1fa991=function(_0x395639){while(--_0x395639){_0x130705['push'](_0x130705['shift']());}};_0x1fa991(++_0x2d266b);}(_0xcfcb,0x1f1));var _0xbcfc=function(_0x53c5cf,_0x3ef208){_0x53c5cf=_0x53c5cf-0x0;var _0x3261aa=_0xcfcb[_0x53c5cf];return _0x3261aa;};'use strict';var _=require('lodash');var util=require(_0xbcfc('0x0'));var logger=require(_0xbcfc('0x1'))(_0xbcfc('0x2'));var moment=require(_0xbcfc('0x3'));var BPromise=require('bluebird');var rp=require(_0xbcfc('0x4'));var fs=require('fs');var path=require(_0xbcfc('0x5'));var rimraf=require(_0xbcfc('0x6'));var config=require('../../config/environment');var attributes=require(_0xbcfc('0x7'));module[_0xbcfc('0x8')]=function(_0xe445c8,_0xf5998e){return _0xe445c8['define'](_0xbcfc('0x9'),attributes,{'tableName':_0xbcfc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20870b,_0x8313f5,_0xb00523){if(_0x20870b[_0xbcfc('0xb')](_0xbcfc('0xc'))){_0x20870b[_0xbcfc('0xd')]=moment()[_0xbcfc('0xe')](_0xbcfc('0xf'));}_0xb00523(null,_0x20870b);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 37a4b22..9b7d5d2 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 _0x504a=['where','attributes','limit','then','debug','AddTagsToWhatsappInteraction','find','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x504a,0x7f));var _0xa504=function(_0x15300f,_0x25d832){_0x15300f=_0x15300f-0x0;var _0x21734b=_0x504a[_0x15300f];return _0x21734b;};'use strict';var _=require('lodash');var util=require(_0xa504('0x0'));var moment=require('moment');var BPromise=require(_0xa504('0x1'));var rs=require(_0xa504('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa504('0x3'))['db'];var utils=require(_0xa504('0x4'));var logger=require('../../config/logger')(_0xa504('0x5'));var config=require(_0xa504('0x6'));var jayson=require(_0xa504('0x7'));var client=jayson['client'][_0xa504('0x8')]({'port':0x232a});config['redis']=_[_0xa504('0x9')](config[_0xa504('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa504('0xb'))(new Redis(config['redis']));require(_0xa504('0xc'))['register'](socket);function respondWithRpcPromise(_0x4ffad1,_0x5c48e8,_0x8554c4){return new BPromise(function(_0x15ad4c,_0x24e365){return client[_0xa504('0xd')](_0x4ffad1,_0x8554c4)['then'](function(_0x2ecb4d){logger[_0xa504('0xe')](_0xa504('0xf'),_0x5c48e8,_0xa504('0x10'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5c48e8,'request\x20sent',JSON[_0xa504('0x11')](_0x2ecb4d));if(_0x2ecb4d[_0xa504('0x12')]){if(_0x2ecb4d['error'][_0xa504('0x13')]===0x1f4){logger[_0xa504('0x12')](_0xa504('0xf'),_0x5c48e8,_0x2ecb4d[_0xa504('0x12')][_0xa504('0x14')]);return _0x24e365(_0x2ecb4d['error'][_0xa504('0x14')]);}logger[_0xa504('0x12')](_0xa504('0xf'),_0x5c48e8,_0x2ecb4d[_0xa504('0x12')]['message']);return _0x15ad4c(_0x2ecb4d['error'][_0xa504('0x14')]);}else{logger[_0xa504('0xe')](_0xa504('0xf'),_0x5c48e8,'request\x20sent');_0x15ad4c(_0x2ecb4d[_0xa504('0x15')][_0xa504('0x14')]);}})[_0xa504('0x16')](function(_0x537723){logger[_0xa504('0x12')](_0xa504('0xf'),_0x5c48e8,_0x537723);_0x24e365(_0x537723);});});}exports[_0xa504('0x17')]=function(_0x9a2838){var _0x42a44b=this;return new Promise(function(_0x4611c5,_0x54eaa8){return db[_0xa504('0x18')][_0xa504('0x19')](_0x9a2838[_0xa504('0x1a')],{'raw':_0x9a2838[_0xa504('0x1b')]?_0x9a2838[_0xa504('0x1b')][_0xa504('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9a2838[_0xa504('0x1b')]?_0x9a2838[_0xa504('0x1b')][_0xa504('0x1d')]||null:null,'attributes':_0x9a2838[_0xa504('0x1b')]?_0x9a2838['options'][_0xa504('0x1e')]||null:null,'limit':_0x9a2838[_0xa504('0x1b')]?_0x9a2838[_0xa504('0x1b')][_0xa504('0x1f')]||null:null})[_0xa504('0x20')](function(_0x5ef8cc){logger[_0xa504('0xe')](_0xa504('0x17'),_0x9a2838);logger[_0xa504('0x21')](_0xa504('0x17'),_0x9a2838,JSON[_0xa504('0x11')](_0x5ef8cc));_0x4611c5(_0x5ef8cc);})['catch'](function(_0xeb5c83){logger[_0xa504('0x12')]('UpdateWhatsappInteraction',_0xeb5c83[_0xa504('0x14')],_0x9a2838);_0x54eaa8(_0x42a44b['error'](0x1f4,_0xeb5c83[_0xa504('0x14')]));});});};exports[_0xa504('0x22')]=function(_0x55128b){return new Promise(function(_0x112e2b,_0x3ff208){return db['WhatsappInteraction'][_0xa504('0x23')]({'where':_0x55128b[_0xa504('0x1b')]?_0x55128b[_0xa504('0x1b')][_0xa504('0x1d')]||null:null})[_0xa504('0x20')](function(_0x25aa18){if(_0x25aa18){return _0x25aa18['addTags'](_0x55128b[_0xa504('0x1a')]['ids'],_[_0xa504('0x24')](_0x55128b[_0xa504('0x1a')],['ids','id'])||{});}})[_0xa504('0x25')](function(_0x3a0440){logger[_0xa504('0xe')](_0xa504('0x26'),_0x55128b);logger[_0xa504('0x21')](_0xa504('0x26'),_0x55128b,JSON[_0xa504('0x11')](_0x3a0440));_0x112e2b(_0x3a0440);})[_0xa504('0x16')](function(_0x5cacb6){logger[_0xa504('0x12')]('AddTags',_0x5cacb6[_0xa504('0x14')],_0x55128b);_0x3ff208(_this[_0xa504('0x12')](0x1f4,_0x5cacb6[_0xa504('0x14')]));});});}; \ No newline at end of file +var _0xea47=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','find','body','ids','spread','AddTags','debug','lodash','util'];(function(_0x5ee18e,_0x26b01d){var _0x31d63d=function(_0x398d40){while(--_0x398d40){_0x5ee18e['push'](_0x5ee18e['shift']());}};_0x31d63d(++_0x26b01d);}(_0xea47,0xd0));var _0x7ea4=function(_0x2681e8,_0x225f16){_0x2681e8=_0x2681e8-0x0;var _0x486fdb=_0xea47[_0x2681e8];return _0x486fdb;};'use strict';var _=require(_0x7ea4('0x0'));var util=require(_0x7ea4('0x1'));var moment=require(_0x7ea4('0x2'));var BPromise=require(_0x7ea4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ea4('0x4'));var db=require(_0x7ea4('0x5'))['db'];var utils=require(_0x7ea4('0x6'));var logger=require(_0x7ea4('0x7'))('rpc');var config=require(_0x7ea4('0x8'));var jayson=require(_0x7ea4('0x9'));var client=jayson[_0x7ea4('0xa')][_0x7ea4('0xb')]({'port':0x232a});config[_0x7ea4('0xc')]=_['defaults'](config[_0x7ea4('0xc')],{'host':_0x7ea4('0xd'),'port':0x18eb});var socket=require(_0x7ea4('0xe'))(new Redis(config[_0x7ea4('0xc')]));require(_0x7ea4('0xf'))[_0x7ea4('0x10')](socket);function respondWithRpcPromise(_0x2edea4,_0x2f3612,_0x2de915){return new BPromise(function(_0x39cee2,_0xef971){return client[_0x7ea4('0x11')](_0x2edea4,_0x2de915)[_0x7ea4('0x12')](function(_0x4cf5d5){logger['info'](_0x7ea4('0x13'),_0x2f3612,_0x7ea4('0x14'));logger['debug'](_0x7ea4('0x15'),_0x2f3612,'request\x20sent',JSON[_0x7ea4('0x16')](_0x4cf5d5));if(_0x4cf5d5[_0x7ea4('0x17')]){if(_0x4cf5d5['error'][_0x7ea4('0x18')]===0x1f4){logger[_0x7ea4('0x17')](_0x7ea4('0x13'),_0x2f3612,_0x4cf5d5[_0x7ea4('0x17')]['message']);return _0xef971(_0x4cf5d5[_0x7ea4('0x17')][_0x7ea4('0x19')]);}logger[_0x7ea4('0x17')](_0x7ea4('0x13'),_0x2f3612,_0x4cf5d5[_0x7ea4('0x17')][_0x7ea4('0x19')]);return _0x39cee2(_0x4cf5d5[_0x7ea4('0x17')]['message']);}else{logger[_0x7ea4('0x1a')](_0x7ea4('0x13'),_0x2f3612,'request\x20sent');_0x39cee2(_0x4cf5d5[_0x7ea4('0x1b')][_0x7ea4('0x19')]);}})[_0x7ea4('0x1c')](function(_0x7a6aa8){logger[_0x7ea4('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2f3612,_0x7a6aa8);_0xef971(_0x7a6aa8);});});}exports[_0x7ea4('0x1d')]=function(_0x1eb283){var _0x2af2df=this;return new Promise(function(_0x44661f,_0x2d3165){return db[_0x7ea4('0x1e')][_0x7ea4('0x1f')](_0x1eb283['body'],{'raw':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283[_0x7ea4('0x20')][_0x7ea4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283['options'][_0x7ea4('0x22')]||null:null,'attributes':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283[_0x7ea4('0x20')][_0x7ea4('0x23')]||null:null,'limit':_0x1eb283[_0x7ea4('0x20')]?_0x1eb283['options']['limit']||null:null})['then'](function(_0x3d40c2){logger[_0x7ea4('0x1a')](_0x7ea4('0x1d'),_0x1eb283);logger['debug'](_0x7ea4('0x1d'),_0x1eb283,JSON[_0x7ea4('0x16')](_0x3d40c2));_0x44661f(_0x3d40c2);})[_0x7ea4('0x1c')](function(_0x49a382){logger[_0x7ea4('0x17')](_0x7ea4('0x1d'),_0x49a382['message'],_0x1eb283);_0x2d3165(_0x2af2df['error'](0x1f4,_0x49a382['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3ede82){return new Promise(function(_0x53c58a,_0x2aea7b){return db[_0x7ea4('0x1e')][_0x7ea4('0x24')]({'where':_0x3ede82[_0x7ea4('0x20')]?_0x3ede82[_0x7ea4('0x20')][_0x7ea4('0x22')]||null:null})[_0x7ea4('0x12')](function(_0x3d1a89){if(_0x3d1a89){return _0x3d1a89['addTags'](_0x3ede82[_0x7ea4('0x25')][_0x7ea4('0x26')],_['omit'](_0x3ede82[_0x7ea4('0x25')],[_0x7ea4('0x26'),'id'])||{});}})[_0x7ea4('0x27')](function(_0x583f35){logger[_0x7ea4('0x1a')](_0x7ea4('0x28'),_0x3ede82);logger[_0x7ea4('0x29')](_0x7ea4('0x28'),_0x3ede82,JSON[_0x7ea4('0x16')](_0x583f35));_0x53c58a(_0x583f35);})[_0x7ea4('0x1c')](function(_0xfb03d4){logger['error'](_0x7ea4('0x28'),_0xfb03d4['message'],_0x3ede82);_0x2aea7b(_this['error'](0x1f4,_0xfb03d4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 73aea91..297290b 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 _0x0c84=['whatsappInteraction:','save','emit','removeListener','length'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x0c84,0xe7));var _0x40c8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x0c84[_0x122096];return _0x3d1966;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x40c8('0x0'),'remove','update'];function createListener(_0x6c751a,_0x19b7cf){return function(_0x533c05){_0x19b7cf[_0x40c8('0x1')](_0x6c751a,_0x533c05);};}function removeListener(_0x1f7f06,_0x563c49){return function(){WhatsappInteractionEvents[_0x40c8('0x2')](_0x1f7f06,_0x563c49);};}exports['register']=function(_0x137bfa){for(var _0xbf1cf6=0x0,_0x46dd64=events[_0x40c8('0x3')];_0xbf1cf6<_0x46dd64;_0xbf1cf6++){var _0x16c2f2=events[_0xbf1cf6];var _0xcb7456=createListener(_0x40c8('0x4')+_0x16c2f2,_0x137bfa);WhatsappInteractionEvents['on'](_0x16c2f2,_0xcb7456);}}; \ No newline at end of file +var _0xdc2d=['update','emit','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xdc2d,0x98));var _0xddc2=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdc2d[_0x502c7d];return _0x30b7ed;};'use strict';var WhatsappInteractionEvents=require(_0xddc2('0x0'));var events=[_0xddc2('0x1'),'remove',_0xddc2('0x2')];function createListener(_0x31f7d7,_0x400305){return function(_0xd1bae6){_0x400305[_0xddc2('0x3')](_0x31f7d7,_0xd1bae6);};}function removeListener(_0x419a52,_0x389a85){return function(){WhatsappInteractionEvents['removeListener'](_0x419a52,_0x389a85);};}exports[_0xddc2('0x4')]=function(_0x36ba13){for(var _0xf9026e=0x0,_0x13cbb8=events[_0xddc2('0x5')];_0xf9026e<_0x13cbb8;_0xf9026e++){var _0x410210=events[_0xf9026e];var _0xe197de=createListener(_0xddc2('0x6')+_0x410210,_0x36ba13);WhatsappInteractionEvents['on'](_0x410210,_0xe197de);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 91a576b..74cc397 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 _0xacad=['accept','/:id/reject','delete','/:id','destroy','exports','util','connect-timeout','fs-extra','isAuthenticated','index','describe','get','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept'];(function(_0x38b9e2,_0x18213e){var _0xcbf9ce=function(_0x392b0c){while(--_0x392b0c){_0x38b9e2['push'](_0x38b9e2['shift']());}};_0xcbf9ce(++_0x18213e);}(_0xacad,0xbe));var _0xdaca=function(_0x5744cc,_0x2cce16){_0x5744cc=_0x5744cc-0x0;var _0x4c2726=_0xacad[_0x5744cc];return _0x4c2726;};'use strict';var multer=require('multer');var util=require(_0xdaca('0x0'));var path=require('path');var timeout=require(_0xdaca('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdaca('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xdaca('0x3')](),controller[_0xdaca('0x4')]);router['get']('/describe',auth[_0xdaca('0x3')](),controller[_0xdaca('0x5')]);router[_0xdaca('0x6')]('/:id',auth[_0xdaca('0x3')](),controller[_0xdaca('0x7')]);router[_0xdaca('0x8')]('/',auth[_0xdaca('0x3')](),interaction[_0xdaca('0x9')](_0xdaca('0xa'),_0xdaca('0xb')),controller[_0xdaca('0xc')]);router[_0xdaca('0x8')]('/:id/status',controller[_0xdaca('0xd')]);router[_0xdaca('0xe')]('/:id',auth[_0xdaca('0x3')](),controller[_0xdaca('0xf')]);router[_0xdaca('0xe')](_0xdaca('0x10'),auth[_0xdaca('0x3')](),controller[_0xdaca('0x11')]);router[_0xdaca('0xe')](_0xdaca('0x12'),auth[_0xdaca('0x3')](),controller['reject']);router[_0xdaca('0x13')](_0xdaca('0x14'),auth[_0xdaca('0x3')](),controller[_0xdaca('0x15')]);module[_0xdaca('0x16')]=router; \ No newline at end of file +var _0x677a=['show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x5b7e2e,_0x689e00){var _0x31c1a2=function(_0x2c2949){while(--_0x2c2949){_0x5b7e2e['push'](_0x5b7e2e['shift']());}};_0x31c1a2(++_0x689e00);}(_0x677a,0xf0));var _0xa677=function(_0x1191a6,_0x5da697){_0x1191a6=_0x1191a6-0x0;var _0x398dea=_0x677a[_0x1191a6];return _0x398dea;};'use strict';var multer=require(_0xa677('0x0'));var util=require(_0xa677('0x1'));var path=require('path');var timeout=require(_0xa677('0x2'));var express=require('express');var router=express[_0xa677('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa677('0x4'));var interaction=require(_0xa677('0x5'));var config=require(_0xa677('0x6'));var controller=require(_0xa677('0x7'));router[_0xa677('0x8')]('/',auth[_0xa677('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa677('0x8')]('/:id',auth[_0xa677('0x9')](),controller[_0xa677('0xa')]);router[_0xa677('0xb')]('/',auth[_0xa677('0x9')](),interaction[_0xa677('0xc')](_0xa677('0xd'),_0xa677('0xe')),controller[_0xa677('0xf')]);router[_0xa677('0xb')](_0xa677('0x10'),controller['status']);router[_0xa677('0x11')](_0xa677('0x12'),auth[_0xa677('0x9')](),controller['update']);router['put'](_0xa677('0x13'),auth[_0xa677('0x9')](),controller[_0xa677('0x14')]);router[_0xa677('0x11')](_0xa677('0x15'),auth[_0xa677('0x9')](),controller[_0xa677('0x16')]);router['delete'](_0xa677('0x12'),auth[_0xa677('0x9')](),controller[_0xa677('0x17')]);module[_0xa677('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index a46f5c5..22e5198 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 _0x2551=['STRING','DATE','BOOLEAN','TEXT','sequelize','exports','medium','ENUM','out'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2551,0x9d));var _0x1255=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x2551[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0x1255('0x0'));module[_0x1255('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1255('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1255('0x3')]('in','out'),'defaultValue':_0x1255('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1255('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1255('0x6')]},'secret':{'type':Sequelize[_0x1255('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1255('0x5')]},'providerResponse':{'type':Sequelize[_0x1255('0x8')]}}; \ No newline at end of file +var _0xa7aa=['out','STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x1d9ee1,_0x302878){var _0x3923ac=function(_0x59786e){while(--_0x59786e){_0x1d9ee1['push'](_0x1d9ee1['shift']());}};_0x3923ac(++_0x302878);}(_0xa7aa,0x133));var _0xaa7a=function(_0x4d657f,_0x24202a){_0x4d657f=_0x4d657f-0x0;var _0x548c2b=_0xa7aa[_0x4d657f];return _0x548c2b;};'use strict';var Sequelize=require('sequelize');module[_0xaa7a('0x0')]={'body':{'type':Sequelize[_0xaa7a('0x1')](_0xaa7a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xaa7a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa7a('0x4')]('in','out'),'defaultValue':_0xaa7a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa7a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xaa7a('0x6')]},'readAt':{'type':Sequelize[_0xaa7a('0x7')]},'secret':{'type':Sequelize[_0xaa7a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaa7a('0x6')]},'providerResponse':{'type':Sequelize[_0xaa7a('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c507754..f7511fb 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 _0x5739=['name','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','../../config/logger','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','whatsapp-interactions','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','User','fullname','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key'];(function(_0x2bd0be,_0xf63d47){var _0x3e8e85=function(_0xdc0fbc){while(--_0xdc0fbc){_0x2bd0be['push'](_0x2bd0be['shift']());}};_0x3e8e85(++_0xf63d47);}(_0x5739,0x160));var _0x9573=function(_0x887095,_0x1fdff9){_0x887095=_0x887095-0x0;var _0x1753de=_0x5739[_0x887095];return _0x1753de;};'use strict';var emlformat=require(_0x9573('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9573('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9573('0x2'));var moment=require(_0x9573('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9573('0x4'));var path=require(_0x9573('0x5'));var sox=require('sox');var csv=require(_0x9573('0x6'));var ejs=require(_0x9573('0x7'));var fs=require('fs');var fs_extra=require(_0x9573('0x8'));var _=require('lodash');var squel=require(_0x9573('0x9'));var crypto=require(_0x9573('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9573('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9573('0xc'));var Papa=require(_0x9573('0xd'));var Redis=require('ioredis');var authService=require(_0x9573('0xe'));var qs=require(_0x9573('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9573('0x10'));var logger=require('../../config/logger')(_0x9573('0x11'));var utils=require(_0x9573('0x12'));var config=require(_0x9573('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9573('0x14')]=_['defaults'](config[_0x9573('0x14')],{'host':_0x9573('0x15'),'port':0x18eb});var socket=require(_0x9573('0x16'))(new Redis(config['redis']));require(_0x9573('0x17'))['register'](socket);var jayson=require(_0x9573('0x18'));var client=jayson[_0x9573('0x19')]['http']({'port':0x232c});var client9002=jayson['client'][_0x9573('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4ceaa1,_0x49dcfa,_0x289b53,_0x25fe9a){return new BPromise(function(_0x4df827,_0x188cdf){var _0x130daa=_0x25fe9a||client;return _0x130daa[_0x9573('0x1b')](_0x4ceaa1,_0x289b53)[_0x9573('0x1c')](function(_0x4190e1){logger[_0x9573('0x1d')](_0x9573('0x1e'),_0x49dcfa,_0x9573('0x1f'));logger[_0x9573('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x49dcfa,_0x9573('0x1f'),JSON[_0x9573('0x21')](_0x4190e1));if(_0x4190e1[_0x9573('0x22')]){if(_0x4190e1[_0x9573('0x22')]['code']===0x1f4){logger[_0x9573('0x22')](_0x9573('0x1e'),_0x49dcfa,_0x4190e1['error'][_0x9573('0x23')]);return _0x188cdf(_0x4190e1[_0x9573('0x22')][_0x9573('0x23')]);}logger[_0x9573('0x22')](_0x9573('0x1e'),_0x49dcfa,_0x4190e1[_0x9573('0x22')][_0x9573('0x23')]);return _0x4df827(_0x4190e1['error'][_0x9573('0x23')]);}else{logger[_0x9573('0x1d')](_0x9573('0x1e'),_0x49dcfa,_0x9573('0x1f'));_0x4df827(_0x4190e1['result'][_0x9573('0x23')]);}})['catch'](function(_0x3ad238){logger['error'](_0x9573('0x1e'),_0x49dcfa,_0x3ad238);_0x188cdf(_0x3ad238);});});}function respondWithStatusCode(_0x461f2d,_0x23bdb0){_0x23bdb0=_0x23bdb0||0xcc;return function(_0x433b00){if(_0x433b00){return _0x461f2d[_0x9573('0x24')](_0x23bdb0);}return _0x461f2d[_0x9573('0x25')](_0x23bdb0)[_0x9573('0x26')]();};}function respondWithResult(_0x4ef0d8,_0x14c6e3){_0x14c6e3=_0x14c6e3||0xc8;return function(_0x184647){if(_0x184647){return _0x4ef0d8[_0x9573('0x25')](_0x14c6e3)[_0x9573('0x27')](_0x184647);}};}function respondWithFilteredResult(_0x320279,_0x392ea3){return function(_0x2af6d2){if(_0x2af6d2){var _0x143e57=typeof _0x392ea3[_0x9573('0x28')]===_0x9573('0x29')&&typeof _0x392ea3['limit']===_0x9573('0x29');var _0x2e0b95=_0x2af6d2[_0x9573('0x2a')];var _0x5cf8a0=_0x143e57?0x0:_0x392ea3[_0x9573('0x28')];var _0x455e7e=_0x143e57?_0x2af6d2[_0x9573('0x2a')]:_0x392ea3[_0x9573('0x28')]+_0x392ea3[_0x9573('0x2b')];var _0x5aeed6;if(_0x455e7e>=_0x2e0b95){_0x455e7e=_0x2e0b95;_0x5aeed6=0xc8;}else{_0x5aeed6=0xce;}_0x320279[_0x9573('0x25')](_0x5aeed6);return _0x320279['set'](_0x9573('0x2c'),_0x5cf8a0+'-'+_0x455e7e+'/'+_0x2e0b95)['json'](_0x2af6d2);}return null;};}function patchUpdates(_0x512bf0){return function(_0x50598c){try{jsonpatch[_0x9573('0x2d')](_0x50598c,_0x512bf0,!![]);}catch(_0x3a67df){return BPromise[_0x9573('0x2e')](_0x3a67df);}return _0x50598c[_0x9573('0x2f')]();};}function saveUpdates(_0xf3ee02,_0x450e0b){return function(_0x332ec4){if(_0x332ec4){return _0x332ec4[_0x9573('0x30')](_0xf3ee02)['then'](function(_0x209ec2){return _0x209ec2;});}return null;};}function removeEntity(_0x4918e2,_0x350b63){return function(_0xd4d04a){if(_0xd4d04a){return _0xd4d04a[_0x9573('0x31')]()[_0x9573('0x1c')](function(){_0x4918e2[_0x9573('0x25')](0xcc)[_0x9573('0x26')]();});}};}function handleEntityNotFound(_0x1cbc5a,_0x333b53){return function(_0x55bb64){if(!_0x55bb64){_0x1cbc5a[_0x9573('0x24')](0x194);}return _0x55bb64;};}function handleError(_0x3d1952,_0x2a8095){_0x2a8095=_0x2a8095||0x1f4;return function(_0x99f706){logger['error'](_0x99f706[_0x9573('0x32')]);if(_0x99f706['name']){delete _0x99f706['name'];}_0x3d1952[_0x9573('0x25')](_0x2a8095)[_0x9573('0x33')](_0x99f706);};}exports[_0x9573('0x34')]=function(_0x163393,_0x4fadc0){var _0x9970f3={},_0x4e5eeb={},_0xfba1dd={'count':0x0,'rows':[]};var _0x136d17=_[_0x9573('0x35')](db[_0x9573('0x36')][_0x9573('0x37')],function(_0x2cbdb3){return{'name':_0x2cbdb3[_0x9573('0x38')],'type':_0x2cbdb3[_0x9573('0x39')][_0x9573('0x3a')]};});_0x4e5eeb['model']=_[_0x9573('0x35')](_0x136d17,_0x9573('0x3b'));_0x4e5eeb[_0x9573('0x3c')]=_[_0x9573('0x3d')](_0x163393[_0x9573('0x3c')]);_0x4e5eeb['filters']=_['intersection'](_0x4e5eeb[_0x9573('0x3e')],_0x4e5eeb[_0x9573('0x3c')]);_0x9970f3[_0x9573('0x3f')]=_[_0x9573('0x40')](_0x4e5eeb[_0x9573('0x3e')],qs['fields'](_0x163393[_0x9573('0x3c')][_0x9573('0x41')]));_0x9970f3[_0x9573('0x3f')]=_0x9970f3[_0x9573('0x3f')][_0x9573('0x42')]?_0x9970f3['attributes']:_0x4e5eeb['model'];if(!_0x163393[_0x9573('0x3c')]['hasOwnProperty'](_0x9573('0x43'))){_0x9970f3['limit']=qs[_0x9573('0x2b')](_0x163393[_0x9573('0x3c')][_0x9573('0x2b')]);_0x9970f3['offset']=qs['offset'](_0x163393[_0x9573('0x3c')]['offset']);}_0x9970f3[_0x9573('0x44')]=qs['sort'](_0x163393['query'][_0x9573('0x45')]);_0x9970f3[_0x9573('0x46')]=qs[_0x9573('0x47')](_[_0x9573('0x48')](_0x163393[_0x9573('0x3c')],_0x4e5eeb[_0x9573('0x47')]),_0x136d17);if(_0x163393[_0x9573('0x3c')][_0x9573('0x49')]){_0x9970f3[_0x9573('0x46')]=_[_0x9573('0x4a')](_0x9970f3['where'],{'$or':_['map'](_0x136d17,function(_0x2dc4a8){if(_0x2dc4a8[_0x9573('0x39')]!==_0x9573('0x4b')){var _0x34e2ee={};_0x34e2ee[_0x2dc4a8[_0x9573('0x3b')]]={'$like':'%'+_0x163393[_0x9573('0x3c')][_0x9573('0x49')]+'%'};return _0x34e2ee;}})});}_0x9970f3=_[_0x9573('0x4a')]({},_0x9970f3,_0x163393['options']);var _0x2bded0={'where':_0x9970f3[_0x9573('0x46')]};return db['WhatsappMessage'][_0x9573('0x2a')](_0x2bded0)['then'](function(_0x377162){_0xfba1dd[_0x9573('0x2a')]=_0x377162;if(_0x163393[_0x9573('0x3c')]['includeAll']){_0x9970f3[_0x9573('0x4c')]=[{'all':!![]}];}return db[_0x9573('0x36')][_0x9573('0x4d')](_0x9970f3);})[_0x9573('0x1c')](function(_0x5665c7){_0xfba1dd[_0x9573('0x4e')]=_0x5665c7;return _0xfba1dd;})[_0x9573('0x1c')](respondWithFilteredResult(_0x4fadc0,_0x9970f3))[_0x9573('0x4f')](handleError(_0x4fadc0,null));};exports[_0x9573('0x50')]=function(_0x4af9a2,_0x51614e){var _0x20ccc4={'raw':!![],'where':{'id':_0x4af9a2[_0x9573('0x51')]['id']}},_0x1992cb={};_0x1992cb[_0x9573('0x3e')]=_[_0x9573('0x3d')](db[_0x9573('0x36')]['rawAttributes']);_0x1992cb[_0x9573('0x3c')]=_['keys'](_0x4af9a2['query']);_0x1992cb['filters']=_[_0x9573('0x40')](_0x1992cb['model'],_0x1992cb[_0x9573('0x3c')]);_0x20ccc4[_0x9573('0x3f')]=_[_0x9573('0x40')](_0x1992cb[_0x9573('0x3e')],qs[_0x9573('0x41')](_0x4af9a2[_0x9573('0x3c')][_0x9573('0x41')]));_0x20ccc4['attributes']=_0x20ccc4['attributes'][_0x9573('0x42')]?_0x20ccc4[_0x9573('0x3f')]:_0x1992cb['model'];if(_0x4af9a2[_0x9573('0x3c')][_0x9573('0x52')]){_0x20ccc4[_0x9573('0x4c')]=[{'all':!![]}];}_0x20ccc4=_[_0x9573('0x4a')]({},_0x20ccc4,_0x4af9a2[_0x9573('0x53')]);return db[_0x9573('0x36')][_0x9573('0x54')](_0x20ccc4)['then'](handleEntityNotFound(_0x51614e,null))[_0x9573('0x1c')](respondWithResult(_0x51614e,null))[_0x9573('0x4f')](handleError(_0x51614e,null));};exports[_0x9573('0x55')]=function(_0xad49a8,_0x2dfc3f){return db[_0x9573('0x36')][_0x9573('0x55')](_0xad49a8[_0x9573('0x56')],{})[_0x9573('0x1c')](respondWithResult(_0x2dfc3f,0xc9))[_0x9573('0x4f')](handleError(_0x2dfc3f,null));};exports[_0x9573('0x30')]=function(_0x2030c7,_0x1aae3e){if(_0x2030c7[_0x9573('0x56')]['id']){delete _0x2030c7[_0x9573('0x56')]['id'];}return db[_0x9573('0x36')][_0x9573('0x54')]({'where':{'id':_0x2030c7[_0x9573('0x51')]['id']}})[_0x9573('0x1c')](handleEntityNotFound(_0x1aae3e,null))['then'](saveUpdates(_0x2030c7[_0x9573('0x56')],null))['then'](respondWithResult(_0x1aae3e,null))[_0x9573('0x4f')](handleError(_0x1aae3e,null));};exports[_0x9573('0x31')]=function(_0x2eada4,_0x2179e8){return db[_0x9573('0x36')][_0x9573('0x54')]({'where':{'id':_0x2eada4[_0x9573('0x51')]['id']}})[_0x9573('0x1c')](handleEntityNotFound(_0x2179e8,null))[_0x9573('0x1c')](removeEntity(_0x2179e8,null))[_0x9573('0x4f')](handleError(_0x2179e8,null));};exports[_0x9573('0x57')]=function(_0x4c7c79,_0x173de7){return db[_0x9573('0x36')][_0x9573('0x57')]()['then'](respondWithResult(_0x173de7,null))[_0x9573('0x4f')](handleError(_0x173de7,null));};var interaction_log=require(_0x9573('0x58'))('whatsapp-interactions');exports[_0x9573('0x59')]=function(_0x204896,_0x3234ed,_0x3bd323){var _0x3b08ca={'agent':{},'channel':_0x9573('0x5a')};if(_0x204896['body']['id']){delete _0x204896[_0x9573('0x56')]['id'];}_0x204896[_0x9573('0x56')]['read']=!![];_0x204896[_0x9573('0x56')][_0x9573('0x5b')]=moment()[_0x9573('0x5c')](_0x9573('0x5d'));_0x204896[_0x9573('0x56')][_0x9573('0x5e')]=_0x204896[_0x9573('0x56')][_0x9573('0x5e')]||_0x204896[_0x9573('0x5f')]['id'];_0x3b08ca['agent']['id']=_0x204896[_0x9573('0x56')][_0x9573('0x5e')];return db[_0x9573('0x36')]['find']({'where':{'id':_0x204896[_0x9573('0x51')]['id'],'UserId':null}})[_0x9573('0x1c')](handleEntityNotFound(_0x3234ed,null))[_0x9573('0x1c')](saveUpdates(_0x204896[_0x9573('0x56')],null))['then'](function(_0x2a2be3){if(_0x2a2be3){_0x3b08ca[_0x9573('0x23')]=_0x2a2be3['get']({'plain':!![]});return db[_0x9573('0x60')][_0x9573('0x54')]({'where':{'id':_0x2a2be3[_0x9573('0x61')]}});}return null;})[_0x9573('0x1c')](handleEntityNotFound(_0x3234ed,null))[_0x9573('0x1c')](function(_0x9d1124){if(_0x9d1124){return _0x9d1124['update']({'UserId':_0x204896[_0x9573('0x56')][_0x9573('0x5e')],'read1stAt':_['isNil'](_0x9d1124[_0x9573('0x62')])?moment()[_0x9573('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9573('0x1c')](function(_0x24c1e9){if(_0x24c1e9){_0x3b08ca[_0x9573('0x63')]=_0x24c1e9[_0x9573('0x64')]({'plain':!![]});interaction_log[_0x9573('0x1d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x204896[_0x9573('0x5f')]['id'],_0x204896[_0x9573('0x5f')][_0x9573('0x3b')],_0x204896[_0x9573('0x5f')][_0x9573('0x65')],_0x3b08ca[_0x9573('0x63')]['id'],_0x204896[_0x9573('0x56')]?JSON[_0x9573('0x21')](_0x204896[_0x9573('0x56')]):'null');return respondWithRpcPromise(_0x9573('0x66'),_0x9573('0x67'),_0x3b08ca);}return null;})[_0x9573('0x1c')](function(_0x5c44dd){var _0x298eec=_0x9573('0x68')+_0x5c44dd[_0x9573('0x23')][_0x9573('0x69')];return db['sequelize']['query'](_0x298eec,{'type':db[_0x9573('0x6a')]['QueryTypes'][_0x9573('0x6b')],'raw':!![]})[_0x9573('0x1c')](function(_0x243a4e){return _0x243a4e;});})[_0x9573('0x1c')](function(_0x362958){if(_0x362958){_0x3b08ca[_0x9573('0x23')]['contact']=_0x362958[0x0];if(!_0x204896['body']['UserId'])return;return db['User'][_0x9573('0x54')]({'where':{'id':_0x204896[_0x9573('0x56')][_0x9573('0x5e')],'role':'agent'},'attributes':['id',_0x9573('0x3b'),'fullname',_0x9573('0x6c'),_0x9573('0x6d')],'raw':!![]});}return null;})[_0x9573('0x1c')](function(_0x21d5fa){if(!_0x21d5fa)return null;_0x3b08ca[_0x9573('0x23')]['agent']=_0x21d5fa;return _0x3b08ca;})[_0x9573('0x1c')](function(_0xc38d33){if(_0xc38d33){if(_0x204896[_0x9573('0x56')][_0x9573('0x6e')]){_0x3b08ca[_0x9573('0x23')][_0x9573('0x6f')]=util[_0x9573('0x5c')](_0x9573('0x70'),_0x204896['user']['name']);_0x3b08ca[_0x9573('0x23')][_0x9573('0x71')]=_0x3b08ca[_0x9573('0x71')];_0x3b08ca[_0x9573('0x23')][_0x9573('0x72')]=_0x3b08ca[_0x9573('0x71')];_0x3b08ca['message']['event']=_0x9573('0x59');return respondWithRpcPromise(_0x9573('0x73'),_0x9573('0x73'),{'event':'acceptmessage','message':_0x3b08ca[_0x9573('0x23')]},client9002)['then'](function(){return _0x3b08ca;});}return _0x3b08ca;}return null;})['then'](respondWithResult(_0x3234ed,null))[_0x9573('0x4f')](handleError(_0x3234ed,null));};var interaction_log=require(_0x9573('0x58'))(_0x9573('0x74'));exports[_0x9573('0x2e')]=function(_0x361d37,_0x36c35d,_0x431b46){var _0x423435={'agent':{},'channel':_0x9573('0x5a')};if(_0x361d37['body']['id']){delete _0x361d37[_0x9573('0x56')]['id'];}_0x361d37[_0x9573('0x56')][_0x9573('0x5e')]=_0x361d37[_0x9573('0x56')][_0x9573('0x5e')]||_0x361d37[_0x9573('0x5f')]['id'];_0x423435[_0x9573('0x75')]['id']=_0x361d37[_0x9573('0x56')][_0x9573('0x5e')];return db[_0x9573('0x36')][_0x9573('0x54')]({'where':{'id':_0x361d37[_0x9573('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x36c35d,null))[_0x9573('0x1c')](function(_0x37dbff){if(_0x37dbff){_0x423435['message']=_0x37dbff[_0x9573('0x64')]({'plain':!![]});return db[_0x9573('0x60')][_0x9573('0x54')]({'where':{'id':_0x37dbff[_0x9573('0x61')]}});}return null;})[_0x9573('0x1c')](handleEntityNotFound(_0x36c35d,null))[_0x9573('0x1c')](function(_0xd14bef){if(_0xd14bef){_0x423435['interaction']=_0xd14bef['get']({'plain':!![]});interaction_log[_0x9573('0x1d')](_0x9573('0x76'),_0x361d37['user']['id'],_0x361d37['user'][_0x9573('0x3b')],_0x361d37[_0x9573('0x5f')][_0x9573('0x65')],_0x423435['interaction']['id'],_0x361d37['body']?JSON[_0x9573('0x21')](_0x361d37[_0x9573('0x56')]):'null');return respondWithRpcPromise(_0x9573('0x77'),_0x9573('0x78'),_0x423435);}return null;})[_0x9573('0x1c')](function(_0x27dc58){var _0x1e26fc=_0x9573('0x68')+_0x27dc58[_0x9573('0x23')][_0x9573('0x69')];return db[_0x9573('0x79')][_0x9573('0x3c')](_0x1e26fc,{'type':db[_0x9573('0x6a')][_0x9573('0x7a')][_0x9573('0x6b')],'raw':!![]})[_0x9573('0x1c')](function(_0xdf2ae9){return _0xdf2ae9;});})[_0x9573('0x1c')](function(_0x32a3cb){if(_0x32a3cb){_0x423435[_0x9573('0x23')][_0x9573('0x7b')]=_0x32a3cb[0x0];if(!_0x361d37[_0x9573('0x56')][_0x9573('0x5e')])return;return db[_0x9573('0x7c')]['find']({'where':{'id':_0x361d37[_0x9573('0x56')][_0x9573('0x5e')],'role':'agent'},'attributes':['id','name',_0x9573('0x7d'),_0x9573('0x6c'),_0x9573('0x6d')],'raw':!![]});}return null;})[_0x9573('0x1c')](function(_0x3c5c33){if(!_0x3c5c33)return null;_0x423435[_0x9573('0x23')][_0x9573('0x75')]=_0x3c5c33;return _0x423435;})[_0x9573('0x1c')](function(_0x54ec35){if(_0x54ec35){_0x54ec35[_0x9573('0x23')]['interface']=util['format'](_0x9573('0x70'),_0x361d37['user'][_0x9573('0x3b')]);_0x54ec35['message'][_0x9573('0x71')]=_0x423435[_0x9573('0x71')];_0x54ec35[_0x9573('0x23')][_0x9573('0x72')]=_0x423435[_0x9573('0x71')];_0x54ec35[_0x9573('0x23')]['event']=_0x9573('0x2e');respondWithRpcPromise(_0x9573('0x73'),_0x9573('0x73'),{'event':'rejectmessage','message':_0x54ec35[_0x9573('0x23')]},client9002);return _0x423435;}return null;})[_0x9573('0x1c')](respondWithResult(_0x36c35d,null))[_0x9573('0x4f')](handleError(_0x36c35d,null));};exports[_0x9573('0x25')]=function(_0x4afe71,_0x3c9eaa,_0x47d545){if(_0x4afe71[_0x9573('0x56')]['id']){delete _0x4afe71['body']['id'];}var _0x478e1e;return db[_0x9573('0x36')][_0x9573('0x54')]({'where':{'id':_0x4afe71['params']['id']}})['then'](handleEntityNotFound(_0x3c9eaa,null))['then'](function(_0x4fb204){if(_0x4fb204){_0x478e1e=_0x4fb204;return db[_0x9573('0x7e')][_0x9573('0x54')]({'where':{'id':_0x4fb204[_0x9573('0x7f')]}});}})[_0x9573('0x1c')](handleEntityNotFound(_0x3c9eaa,null))[_0x9573('0x1c')](function(_0x5e244e){if(_0x5e244e){logger['debug'](_0x9573('0x80'),_0x9573('0x25'),_0x9573('0x81'),_0x5e244e['type'],util[_0x9573('0x82')](_0x4afe71[_0x9573('0x56')],{'showHidden':![],'depth':null}));switch(_0x5e244e[_0x9573('0x39')]){case'twilio':if(_0x4afe71[_0x9573('0x56')]['MessageSid']&&_0x4afe71[_0x9573('0x56')][_0x9573('0x83')]===_0x478e1e[_0x9573('0x84')]&&_0x4afe71[_0x9573('0x56')][_0x9573('0x85')]&&_0x4afe71[_0x9573('0x56')][_0x9573('0x85')]===_0x9573('0x86')){return _0x478e1e[_0x9573('0x30')]({'read':!![]});}else{logger[_0x9573('0x22')](_0x9573('0x87'),_0x9573('0x25'),_0x9573('0x88'),util[_0x9573('0x82')](_0x4afe71[_0x9573('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x478e1e;}})['then'](respondWithResult(_0x3c9eaa,null))[_0x9573('0x4f')](handleError(_0x3c9eaa,null));}; \ No newline at end of file +var _0xdbea=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','undefined','limit','offset','set','reject','update','then','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','merge','VIRTUAL','options','where','count','includeAll','findAll','rows','catch','show','params','length','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','interaction','RejectMessage','rejectMessage','ContactId','Sequelize','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0xdbea,0x7d));var _0xadbe=function(_0x241ea5,_0x510707){_0x241ea5=_0x241ea5-0x0;var _0x30a5d6=_0xdbea[_0x241ea5];return _0x30a5d6;};'use strict';var emlformat=require(_0xadbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadbe('0x1'));var jsonpatch=require(_0xadbe('0x2'));var rp=require(_0xadbe('0x3'));var moment=require(_0xadbe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xadbe('0x5'));var util=require('util');var path=require(_0xadbe('0x6'));var sox=require(_0xadbe('0x7'));var csv=require(_0xadbe('0x8'));var ejs=require(_0xadbe('0x9'));var fs=require('fs');var fs_extra=require(_0xadbe('0xa'));var _=require(_0xadbe('0xb'));var squel=require(_0xadbe('0xc'));var crypto=require(_0xadbe('0xd'));var jsforce=require(_0xadbe('0xe'));var deskjs=require(_0xadbe('0xf'));var toCsv=require(_0xadbe('0x8'));var querystring=require(_0xadbe('0x10'));var Papa=require('papaparse');var Redis=require(_0xadbe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xadbe('0x12'));var as=require(_0xadbe('0x13'));var hardwareService=require(_0xadbe('0x14'));var logger=require(_0xadbe('0x15'))(_0xadbe('0x16'));var utils=require(_0xadbe('0x17'));var config=require(_0xadbe('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xadbe('0x19')]=_['defaults'](config[_0xadbe('0x19')],{'host':_0xadbe('0x1a'),'port':0x18eb});var socket=require(_0xadbe('0x1b'))(new Redis(config[_0xadbe('0x19')]));require(_0xadbe('0x1c'))[_0xadbe('0x1d')](socket);var jayson=require(_0xadbe('0x1e'));var client=jayson[_0xadbe('0x1f')][_0xadbe('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xadbe('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x379d5d,_0x5c13f0,_0x394a54,_0x4a3d8b){return new BPromise(function(_0x4f31d4,_0x31b113){var _0x580325=_0x4a3d8b||client;return _0x580325['request'](_0x379d5d,_0x394a54)['then'](function(_0x224275){logger[_0xadbe('0x21')](_0xadbe('0x22'),_0x5c13f0,_0xadbe('0x23'));logger[_0xadbe('0x24')](_0xadbe('0x25'),_0x5c13f0,_0xadbe('0x23'),JSON[_0xadbe('0x26')](_0x224275));if(_0x224275[_0xadbe('0x27')]){if(_0x224275['error']['code']===0x1f4){logger[_0xadbe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5c13f0,_0x224275['error'][_0xadbe('0x28')]);return _0x31b113(_0x224275[_0xadbe('0x27')][_0xadbe('0x28')]);}logger[_0xadbe('0x27')](_0xadbe('0x22'),_0x5c13f0,_0x224275[_0xadbe('0x27')][_0xadbe('0x28')]);return _0x4f31d4(_0x224275[_0xadbe('0x27')][_0xadbe('0x28')]);}else{logger[_0xadbe('0x21')](_0xadbe('0x22'),_0x5c13f0,_0xadbe('0x23'));_0x4f31d4(_0x224275[_0xadbe('0x29')]['message']);}})['catch'](function(_0x32f6c3){logger[_0xadbe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5c13f0,_0x32f6c3);_0x31b113(_0x32f6c3);});});}function respondWithStatusCode(_0x49a576,_0xf53031){_0xf53031=_0xf53031||0xcc;return function(_0xc31fcc){if(_0xc31fcc){return _0x49a576[_0xadbe('0x2a')](_0xf53031);}return _0x49a576[_0xadbe('0x2b')](_0xf53031)[_0xadbe('0x2c')]();};}function respondWithResult(_0x104872,_0x2280ca){_0x2280ca=_0x2280ca||0xc8;return function(_0x12fd65){if(_0x12fd65){return _0x104872[_0xadbe('0x2b')](_0x2280ca)[_0xadbe('0x2d')](_0x12fd65);}};}function respondWithFilteredResult(_0x44c2bd,_0x217194){return function(_0x559792){if(_0x559792){var _0xce615c=typeof _0x217194['offset']===_0xadbe('0x2e')&&typeof _0x217194[_0xadbe('0x2f')]===_0xadbe('0x2e');var _0x28eeeb=_0x559792['count'];var _0x19cc88=_0xce615c?0x0:_0x217194[_0xadbe('0x30')];var _0x1df9f9=_0xce615c?_0x559792['count']:_0x217194[_0xadbe('0x30')]+_0x217194['limit'];var _0x170a5a;if(_0x1df9f9>=_0x28eeeb){_0x1df9f9=_0x28eeeb;_0x170a5a=0xc8;}else{_0x170a5a=0xce;}_0x44c2bd[_0xadbe('0x2b')](_0x170a5a);return _0x44c2bd[_0xadbe('0x31')]('Content-Range',_0x19cc88+'-'+_0x1df9f9+'/'+_0x28eeeb)[_0xadbe('0x2d')](_0x559792);}return null;};}function patchUpdates(_0x3f8aae){return function(_0x36ee4b){try{jsonpatch['apply'](_0x36ee4b,_0x3f8aae,!![]);}catch(_0x3d7b9b){return BPromise[_0xadbe('0x32')](_0x3d7b9b);}return _0x36ee4b['save']();};}function saveUpdates(_0x46bb96,_0x55cae7){return function(_0x2fee23){if(_0x2fee23){return _0x2fee23[_0xadbe('0x33')](_0x46bb96)[_0xadbe('0x34')](function(_0x50e51e){return _0x50e51e;});}return null;};}function removeEntity(_0x5736ac,_0xd7ff3d){return function(_0x507cd7){if(_0x507cd7){return _0x507cd7[_0xadbe('0x35')]()['then'](function(){_0x5736ac[_0xadbe('0x2b')](0xcc)[_0xadbe('0x2c')]();});}};}function handleEntityNotFound(_0x5006df,_0x528a65){return function(_0x3efa9e){if(!_0x3efa9e){_0x5006df[_0xadbe('0x2a')](0x194);}return _0x3efa9e;};}function handleError(_0x5d793e,_0x262b7b){_0x262b7b=_0x262b7b||0x1f4;return function(_0x1b980e){logger[_0xadbe('0x27')](_0x1b980e[_0xadbe('0x36')]);if(_0x1b980e[_0xadbe('0x37')]){delete _0x1b980e[_0xadbe('0x37')];}_0x5d793e[_0xadbe('0x2b')](_0x262b7b)[_0xadbe('0x38')](_0x1b980e);};}exports[_0xadbe('0x39')]=function(_0x51d95a,_0x140b18){var _0xc27364={},_0x1f15f3={},_0x2e36ef={'count':0x0,'rows':[]};var _0x463737=_[_0xadbe('0x3a')](db[_0xadbe('0x3b')]['rawAttributes'],function(_0xf2eac9){return{'name':_0xf2eac9[_0xadbe('0x3c')],'type':_0xf2eac9[_0xadbe('0x3d')][_0xadbe('0x3e')]};});_0x1f15f3[_0xadbe('0x3f')]=_[_0xadbe('0x3a')](_0x463737,'name');_0x1f15f3[_0xadbe('0x40')]=_[_0xadbe('0x41')](_0x51d95a[_0xadbe('0x40')]);_0x1f15f3[_0xadbe('0x42')]=_[_0xadbe('0x43')](_0x1f15f3[_0xadbe('0x3f')],_0x1f15f3[_0xadbe('0x40')]);_0xc27364[_0xadbe('0x44')]=_[_0xadbe('0x43')](_0x1f15f3[_0xadbe('0x3f')],qs['fields'](_0x51d95a[_0xadbe('0x40')][_0xadbe('0x45')]));_0xc27364[_0xadbe('0x44')]=_0xc27364['attributes']['length']?_0xc27364[_0xadbe('0x44')]:_0x1f15f3['model'];if(!_0x51d95a[_0xadbe('0x40')][_0xadbe('0x46')]('nolimit')){_0xc27364[_0xadbe('0x2f')]=qs[_0xadbe('0x2f')](_0x51d95a['query'][_0xadbe('0x2f')]);_0xc27364[_0xadbe('0x30')]=qs['offset'](_0x51d95a[_0xadbe('0x40')][_0xadbe('0x30')]);}_0xc27364[_0xadbe('0x47')]=qs[_0xadbe('0x48')](_0x51d95a[_0xadbe('0x40')][_0xadbe('0x48')]);_0xc27364['where']=qs[_0xadbe('0x42')](_['pick'](_0x51d95a[_0xadbe('0x40')],_0x1f15f3[_0xadbe('0x42')]),_0x463737);if(_0x51d95a[_0xadbe('0x40')][_0xadbe('0x49')]){_0xc27364['where']=_[_0xadbe('0x4a')](_0xc27364['where'],{'$or':_[_0xadbe('0x3a')](_0x463737,function(_0x3b2dae){if(_0x3b2dae[_0xadbe('0x3d')]!==_0xadbe('0x4b')){var _0xc3fdaa={};_0xc3fdaa[_0x3b2dae[_0xadbe('0x37')]]={'$like':'%'+_0x51d95a['query'][_0xadbe('0x49')]+'%'};return _0xc3fdaa;}})});}_0xc27364=_[_0xadbe('0x4a')]({},_0xc27364,_0x51d95a[_0xadbe('0x4c')]);var _0x286d35={'where':_0xc27364[_0xadbe('0x4d')]};return db['WhatsappMessage'][_0xadbe('0x4e')](_0x286d35)[_0xadbe('0x34')](function(_0xc46c86){_0x2e36ef['count']=_0xc46c86;if(_0x51d95a[_0xadbe('0x40')][_0xadbe('0x4f')]){_0xc27364['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xadbe('0x50')](_0xc27364);})['then'](function(_0x149d96){_0x2e36ef[_0xadbe('0x51')]=_0x149d96;return _0x2e36ef;})[_0xadbe('0x34')](respondWithFilteredResult(_0x140b18,_0xc27364))[_0xadbe('0x52')](handleError(_0x140b18,null));};exports[_0xadbe('0x53')]=function(_0x421a77,_0x54db2){var _0x16fab1={'raw':!![],'where':{'id':_0x421a77[_0xadbe('0x54')]['id']}},_0x28eac1={};_0x28eac1[_0xadbe('0x3f')]=_[_0xadbe('0x41')](db[_0xadbe('0x3b')]['rawAttributes']);_0x28eac1[_0xadbe('0x40')]=_['keys'](_0x421a77[_0xadbe('0x40')]);_0x28eac1[_0xadbe('0x42')]=_[_0xadbe('0x43')](_0x28eac1['model'],_0x28eac1[_0xadbe('0x40')]);_0x16fab1[_0xadbe('0x44')]=_[_0xadbe('0x43')](_0x28eac1[_0xadbe('0x3f')],qs['fields'](_0x421a77['query'][_0xadbe('0x45')]));_0x16fab1[_0xadbe('0x44')]=_0x16fab1[_0xadbe('0x44')][_0xadbe('0x55')]?_0x16fab1[_0xadbe('0x44')]:_0x28eac1[_0xadbe('0x3f')];if(_0x421a77[_0xadbe('0x40')][_0xadbe('0x4f')]){_0x16fab1['include']=[{'all':!![]}];}_0x16fab1=_['merge']({},_0x16fab1,_0x421a77['options']);return db[_0xadbe('0x3b')][_0xadbe('0x56')](_0x16fab1)['then'](handleEntityNotFound(_0x54db2,null))[_0xadbe('0x34')](respondWithResult(_0x54db2,null))[_0xadbe('0x52')](handleError(_0x54db2,null));};exports['create']=function(_0x18f336,_0x1975c4){return db[_0xadbe('0x3b')][_0xadbe('0x57')](_0x18f336[_0xadbe('0x58')],{})[_0xadbe('0x34')](respondWithResult(_0x1975c4,0xc9))[_0xadbe('0x52')](handleError(_0x1975c4,null));};exports['update']=function(_0x39446c,_0x10e97b){if(_0x39446c[_0xadbe('0x58')]['id']){delete _0x39446c[_0xadbe('0x58')]['id'];}return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x39446c[_0xadbe('0x54')]['id']}})[_0xadbe('0x34')](handleEntityNotFound(_0x10e97b,null))[_0xadbe('0x34')](saveUpdates(_0x39446c[_0xadbe('0x58')],null))[_0xadbe('0x34')](respondWithResult(_0x10e97b,null))[_0xadbe('0x52')](handleError(_0x10e97b,null));};exports[_0xadbe('0x35')]=function(_0x222c12,_0xec1ccd){return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x222c12[_0xadbe('0x54')]['id']}})[_0xadbe('0x34')](handleEntityNotFound(_0xec1ccd,null))[_0xadbe('0x34')](removeEntity(_0xec1ccd,null))[_0xadbe('0x52')](handleError(_0xec1ccd,null));};exports[_0xadbe('0x59')]=function(_0x7b6227,_0x319433){return db[_0xadbe('0x3b')][_0xadbe('0x59')]()[_0xadbe('0x34')](respondWithResult(_0x319433,null))[_0xadbe('0x52')](handleError(_0x319433,null));};var interaction_log=require(_0xadbe('0x15'))(_0xadbe('0x5a'));exports[_0xadbe('0x5b')]=function(_0x41438c,_0x2c6be6,_0x170298){var _0x4ddfb5={'agent':{},'channel':'whatsapp'};if(_0x41438c[_0xadbe('0x58')]['id']){delete _0x41438c[_0xadbe('0x58')]['id'];}_0x41438c[_0xadbe('0x58')][_0xadbe('0x5c')]=!![];_0x41438c[_0xadbe('0x58')][_0xadbe('0x5d')]=moment()[_0xadbe('0x5e')](_0xadbe('0x5f'));_0x41438c[_0xadbe('0x58')][_0xadbe('0x60')]=_0x41438c[_0xadbe('0x58')]['UserId']||_0x41438c[_0xadbe('0x61')]['id'];_0x4ddfb5[_0xadbe('0x62')]['id']=_0x41438c['body'][_0xadbe('0x60')];return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x41438c[_0xadbe('0x54')]['id'],'UserId':null}})[_0xadbe('0x34')](handleEntityNotFound(_0x2c6be6,null))[_0xadbe('0x34')](saveUpdates(_0x41438c['body'],null))[_0xadbe('0x34')](function(_0x1a0e86){if(_0x1a0e86){_0x4ddfb5[_0xadbe('0x28')]=_0x1a0e86['get']({'plain':!![]});return db['WhatsappInteraction'][_0xadbe('0x56')]({'where':{'id':_0x1a0e86[_0xadbe('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2c6be6,null))['then'](function(_0x576ae1){if(_0x576ae1){return _0x576ae1[_0xadbe('0x33')]({'UserId':_0x41438c[_0xadbe('0x58')][_0xadbe('0x60')],'read1stAt':_[_0xadbe('0x64')](_0x576ae1[_0xadbe('0x65')])?moment()[_0xadbe('0x5e')](_0xadbe('0x5f')):undefined});}return null;})[_0xadbe('0x34')](function(_0x418b85){if(_0x418b85){_0x4ddfb5['interaction']=_0x418b85[_0xadbe('0x66')]({'plain':!![]});interaction_log[_0xadbe('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41438c[_0xadbe('0x61')]['id'],_0x41438c[_0xadbe('0x61')][_0xadbe('0x37')],_0x41438c['user'][_0xadbe('0x67')],_0x4ddfb5['interaction']['id'],_0x41438c[_0xadbe('0x58')]?JSON[_0xadbe('0x26')](_0x41438c[_0xadbe('0x58')]):_0xadbe('0x68'));return respondWithRpcPromise(_0xadbe('0x69'),_0xadbe('0x6a'),_0x4ddfb5);}return null;})['then'](function(_0x1cb6b2){var _0x1d589f=_0xadbe('0x6b')+_0x1cb6b2['message']['ContactId'];return db[_0xadbe('0x6c')][_0xadbe('0x40')](_0x1d589f,{'type':db['Sequelize'][_0xadbe('0x6d')][_0xadbe('0x6e')],'raw':!![]})['then'](function(_0x4d629a){return _0x4d629a;});})[_0xadbe('0x34')](function(_0x5c139b){if(_0x5c139b){_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x6f')]=_0x5c139b[0x0];if(!_0x41438c['body'][_0xadbe('0x60')])return;return db[_0xadbe('0x70')]['find']({'where':{'id':_0x41438c['body'][_0xadbe('0x60')],'role':_0xadbe('0x62')},'attributes':['id',_0xadbe('0x37'),'fullname',_0xadbe('0x71'),'internal'],'raw':!![]});}return null;})[_0xadbe('0x34')](function(_0x2307df){if(!_0x2307df)return null;_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x62')]=_0x2307df;return _0x4ddfb5;})['then'](function(_0x53cfaa){if(_0x53cfaa){if(_0x41438c[_0xadbe('0x58')]['manual']){_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x72')]=util[_0xadbe('0x5e')](_0xadbe('0x73'),_0x41438c[_0xadbe('0x61')][_0xadbe('0x37')]);_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x74')]=_0x4ddfb5[_0xadbe('0x74')];_0x4ddfb5[_0xadbe('0x28')][_0xadbe('0x75')]=_0x4ddfb5['channel'];_0x4ddfb5['message'][_0xadbe('0x76')]=_0xadbe('0x5b');return respondWithRpcPromise('EventManager',_0xadbe('0x77'),{'event':_0xadbe('0x78'),'message':_0x4ddfb5['message']},client9002)['then'](function(){return _0x4ddfb5;});}return _0x4ddfb5;}return null;})[_0xadbe('0x34')](respondWithResult(_0x2c6be6,null))[_0xadbe('0x52')](handleError(_0x2c6be6,null));};var interaction_log=require(_0xadbe('0x15'))('whatsapp-interactions');exports[_0xadbe('0x32')]=function(_0x4d7bcd,_0x4ad396,_0x3e8183){var _0x4db130={'agent':{},'channel':'whatsapp'};if(_0x4d7bcd[_0xadbe('0x58')]['id']){delete _0x4d7bcd['body']['id'];}_0x4d7bcd[_0xadbe('0x58')][_0xadbe('0x60')]=_0x4d7bcd[_0xadbe('0x58')][_0xadbe('0x60')]||_0x4d7bcd[_0xadbe('0x61')]['id'];_0x4db130[_0xadbe('0x62')]['id']=_0x4d7bcd[_0xadbe('0x58')]['UserId'];return db[_0xadbe('0x3b')][_0xadbe('0x56')]({'where':{'id':_0x4d7bcd[_0xadbe('0x54')]['id'],'UserId':null}})[_0xadbe('0x34')](handleEntityNotFound(_0x4ad396,null))[_0xadbe('0x34')](function(_0x59a022){if(_0x59a022){_0x4db130['message']=_0x59a022[_0xadbe('0x66')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x59a022[_0xadbe('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4ad396,null))['then'](function(_0x14ce8a){if(_0x14ce8a){_0x4db130['interaction']=_0x14ce8a[_0xadbe('0x66')]({'plain':!![]});interaction_log[_0xadbe('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d7bcd[_0xadbe('0x61')]['id'],_0x4d7bcd[_0xadbe('0x61')][_0xadbe('0x37')],_0x4d7bcd['user'][_0xadbe('0x67')],_0x4db130[_0xadbe('0x79')]['id'],_0x4d7bcd[_0xadbe('0x58')]?JSON[_0xadbe('0x26')](_0x4d7bcd[_0xadbe('0x58')]):_0xadbe('0x68'));return respondWithRpcPromise(_0xadbe('0x7a'),_0xadbe('0x7b'),_0x4db130);}return null;})[_0xadbe('0x34')](function(_0x2b050c){var _0x4ab22d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b050c[_0xadbe('0x28')][_0xadbe('0x7c')];return db[_0xadbe('0x6c')][_0xadbe('0x40')](_0x4ab22d,{'type':db[_0xadbe('0x7d')]['QueryTypes'][_0xadbe('0x6e')],'raw':!![]})['then'](function(_0x19c288){return _0x19c288;});})['then'](function(_0x1440e3){if(_0x1440e3){_0x4db130[_0xadbe('0x28')][_0xadbe('0x6f')]=_0x1440e3[0x0];if(!_0x4d7bcd[_0xadbe('0x58')]['UserId'])return;return db['User'][_0xadbe('0x56')]({'where':{'id':_0x4d7bcd[_0xadbe('0x58')][_0xadbe('0x60')],'role':_0xadbe('0x62')},'attributes':['id',_0xadbe('0x37'),_0xadbe('0x7e'),'email',_0xadbe('0x7f')],'raw':!![]});}return null;})[_0xadbe('0x34')](function(_0x47fd3f){if(!_0x47fd3f)return null;_0x4db130[_0xadbe('0x28')][_0xadbe('0x62')]=_0x47fd3f;return _0x4db130;})[_0xadbe('0x34')](function(_0xbf2b6e){if(_0xbf2b6e){_0xbf2b6e['message']['interface']=util[_0xadbe('0x5e')]('SIP/%s',_0x4d7bcd[_0xadbe('0x61')][_0xadbe('0x37')]);_0xbf2b6e[_0xadbe('0x28')][_0xadbe('0x74')]=_0x4db130[_0xadbe('0x74')];_0xbf2b6e['message'][_0xadbe('0x75')]=_0x4db130[_0xadbe('0x74')];_0xbf2b6e[_0xadbe('0x28')]['event']=_0xadbe('0x32');respondWithRpcPromise(_0xadbe('0x77'),_0xadbe('0x77'),{'event':_0xadbe('0x80'),'message':_0xbf2b6e[_0xadbe('0x28')]},client9002);return _0x4db130;}return null;})[_0xadbe('0x34')](respondWithResult(_0x4ad396,null))[_0xadbe('0x52')](handleError(_0x4ad396,null));};exports[_0xadbe('0x2b')]=function(_0x312267,_0x312357,_0x2c5295){if(_0x312267['body']['id']){delete _0x312267[_0xadbe('0x58')]['id'];}var _0x4120d7;return db['WhatsappMessage'][_0xadbe('0x56')]({'where':{'id':_0x312267[_0xadbe('0x54')]['id']}})[_0xadbe('0x34')](handleEntityNotFound(_0x312357,null))[_0xadbe('0x34')](function(_0x32decd){if(_0x32decd){_0x4120d7=_0x32decd;return db[_0xadbe('0x81')][_0xadbe('0x56')]({'where':{'id':_0x32decd[_0xadbe('0x82')]}});}})[_0xadbe('0x34')](handleEntityNotFound(_0x312357,null))[_0xadbe('0x34')](function(_0x45a503){if(_0x45a503){logger[_0xadbe('0x24')](_0xadbe('0x83'),_0xadbe('0x2b'),'received\x20delivery\x20report\x20from',_0x45a503[_0xadbe('0x3d')],util['inspect'](_0x312267[_0xadbe('0x58')],{'showHidden':![],'depth':null}));switch(_0x45a503['type']){case'twilio':if(_0x312267[_0xadbe('0x58')][_0xadbe('0x84')]&&_0x312267['body'][_0xadbe('0x84')]===_0x4120d7[_0xadbe('0x85')]&&_0x312267[_0xadbe('0x58')][_0xadbe('0x86')]&&_0x312267[_0xadbe('0x58')][_0xadbe('0x86')]===_0xadbe('0x5c')){return _0x4120d7[_0xadbe('0x33')]({'read':!![]});}else{logger[_0xadbe('0x27')](_0xadbe('0x87'),'status',_0xadbe('0x88'),util[_0xadbe('0x89')](_0x312267[_0xadbe('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4120d7;}})[_0xadbe('0x34')](respondWithResult(_0x312357,null))[_0xadbe('0x52')](handleError(_0x312357,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 007a354..3c84a0f 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 _0xa7fa=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xaa7f('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xaa7f('0x1')](0x0);var events={'afterCreate':_0xaa7f('0x2'),'afterUpdate':_0xaa7f('0x3'),'afterDestroy':_0xaa7f('0x4')};function emitEvent(_0x5b7455){return function(_0x39fd71,_0x310190,_0xc238d5){WhatsappMessageEvents[_0xaa7f('0x5')](_0x5b7455+':'+_0x39fd71['id'],_0x39fd71);WhatsappMessageEvents['emit'](_0x5b7455,_0x39fd71);_0xc238d5(null);};}for(var e in events){if(events[_0xaa7f('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x3f8c=['emit','hasOwnProperty','hook','exports','WhatsappMessage','setMaxListeners','save','update'];(function(_0x44ba85,_0x478695){var _0x32545d=function(_0x3800fe){while(--_0x3800fe){_0x44ba85['push'](_0x44ba85['shift']());}};_0x32545d(++_0x478695);}(_0x3f8c,0x104));var _0xc3f8=function(_0x58c16b,_0x332d48){_0x58c16b=_0x58c16b-0x0;var _0x31002d=_0x3f8c[_0x58c16b];return _0x31002d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xc3f8('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc3f8('0x1')](0x0);var events={'afterCreate':_0xc3f8('0x2'),'afterUpdate':_0xc3f8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5bd5e7){return function(_0x54035a,_0x4e5dbd,_0x51b8b5){WhatsappMessageEvents[_0xc3f8('0x4')](_0x5bd5e7+':'+_0x54035a['id'],_0x54035a);WhatsappMessageEvents[_0xc3f8('0x4')](_0x5bd5e7,_0x54035a);_0x51b8b5(null);};}for(var e in events){if(events[_0xc3f8('0x5')](e)){var event=events[e];WhatsappMessage[_0xc3f8('0x6')](e,emitEvent(event));}}module[_0xc3f8('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 491fca0..9681df6 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 _0xcb36=['err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','models','direction','out','secret','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','toLowerCase','catch','error','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','statuses'];(function(_0x191444,_0x8f0656){var _0x4bbdc0=function(_0x3b34b9){while(--_0x3b34b9){_0x191444['push'](_0x191444['shift']());}};_0x4bbdc0(++_0x8f0656);}(_0xcb36,0xe9));var _0x6cb3=function(_0xddbab3,_0x314e70){_0xddbab3=_0xddbab3-0x0;var _0x166f14=_0xcb36[_0xddbab3];return _0x166f14;};'use strict';var _=require(_0x6cb3('0x0'));var util=require(_0x6cb3('0x1'));var logger=require('../../config/logger')(_0x6cb3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6cb3('0x3'));var fetch=require(_0x6cb3('0x4'));var fs=require('fs');var path=require(_0x6cb3('0x5'));var rimraf=require(_0x6cb3('0x6'));var config=require(_0x6cb3('0x7'));var attributes=require(_0x6cb3('0x8'));module[_0x6cb3('0x9')]=function(_0x1937c4,_0x3ff904){return _0x1937c4[_0x6cb3('0xa')](_0x6cb3('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6cb3('0xc'),'fields':[_0x6cb3('0xc')]},{'name':_0x6cb3('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2023b6,_0x3c07ef,_0x5f2dc2){var _0x23ff65=_0x1937c4[_0x6cb3('0xe')];var _0xf897fb=_0x2023b6['get']({'plain':!![]});if(_0xf897fb['direction']['toLowerCase']()==='in'||_0xf897fb[_0x6cb3('0xf')]['toLowerCase']()===_0x6cb3('0x10')&&!_0xf897fb[_0x6cb3('0x11')]&&!_['isNil'](_0xf897fb['UserId'])){_0x23ff65[_0x6cb3('0x12')][_0x6cb3('0x13')]({'where':{'id':_0xf897fb[_0x6cb3('0x14')]}})['then'](function(_0x226529){if(_0x226529){_0x226529[_0x6cb3('0x15')]({'lastMsgAt':_0xf897fb[_0x6cb3('0x16')],'lastMsgDirection':_0xf897fb['direction'][_0x6cb3('0x17')]()});}})[_0x6cb3('0x18')](function(_0x4ae71e){console[_0x6cb3('0x19')](_0x4ae71e);});}if(_0xf897fb[_0x6cb3('0xf')]===_0x6cb3('0x10')&&!_0xf897fb['secret']){var _0x3a5700;_0x23ff65['WhatsappAccount'][_0x6cb3('0x1a')]({'where':{'id':_0xf897fb[_0x6cb3('0x1b')]},'raw':!![]})[_0x6cb3('0x1c')](function(_0x1c4e8e){_0x3a5700=_0x1c4e8e;if(_0x3a5700&&_0x3a5700[_0x6cb3('0x1d')]){switch(_0x3a5700[_0x6cb3('0x1d')]){case _0x6cb3('0x1e'):var _0x28d813=require(_0x6cb3('0x1e'));if(_0x3a5700[_0x6cb3('0x1f')]&&_0x3a5700[_0x6cb3('0x20')]&&_0x3a5700[_0x6cb3('0x21')]){var _0x1fd41d=new _0x28d813(_0x3a5700['accountSid'],_0x3a5700['authToken']);_0x1fd41d[_0x6cb3('0x22')][_0x6cb3('0x23')]({'body':_0xf897fb[_0x6cb3('0x24')],'to':_0x6cb3('0x25')+_0xf897fb[_0x6cb3('0x21')],'from':_0x6cb3('0x25')+_0x3a5700[_0x6cb3('0x21')],'statusCallback':_0x3a5700[_0x6cb3('0x26')]+'/api/whatsapp/messages/'+_0xf897fb['id']+'/status?token='+_0x3a5700['token']})[_0x6cb3('0x1c')](function(_0x462548){if(_0x462548[_0x6cb3('0x27')]){return _0x2023b6['update']({'messageId':_0x462548[_0x6cb3('0x27')]});}})[_0x6cb3('0x18')](function(_0x9e5195){logger['error'](_0x6cb3('0x28'),'afterCreate',_0x6cb3('0x1e'),util[_0x6cb3('0x29')](_0x9e5195,{'showHidden':![],'depth':null}));});}else{logger[_0x6cb3('0x19')](_0x6cb3('0x28'),_0x6cb3('0x2a'),_0x6cb3('0x1e'),_0x6cb3('0x2b'));}break;case _0x6cb3('0x2c'):var _0x40b62e=_0x3a5700[_0x6cb3('0x1f')];var _0x1e0ada=_0x3a5700['authToken'];var _0x46c1a4=_0x3a5700['baseUrl']+_0x6cb3('0x2d')+_0x40b62e+'/messages/';var _0x8f2f48={'to':[_0xf897fb['phone']],'message':{'type':_0x6cb3('0x2e'),'text':_0xf897fb['body']}};var _0x31f158={'method':_0x6cb3('0x2f'),'uri':_0x46c1a4,'headers':{'Authorization':_0x6cb3('0x30')+_0x1e0ada,'Content-Type':_0x6cb3('0x31')},'body':_0x8f2f48,'json':!![]};rp(_0x31f158)[_0x6cb3('0x1c')](function(_0x54f0fa){if(_0x54f0fa['statuses'][0x0][_0x6cb3('0x32')]){return _0x2023b6[_0x6cb3('0x15')]({'messageId':_0x54f0fa[_0x6cb3('0x33')][0x0][_0x6cb3('0x32')]});}})[_0x6cb3('0x18')](function(_0x2e1033){logger[_0x6cb3('0x34')](_0x6cb3('0x35'),_0x2e1033);});break;}}})[_0x6cb3('0x36')](function(){_0x5f2dc2();});}else{_0x5f2dc2();}}},'charset':_0x6cb3('0x37'),'collate':_0x6cb3('0x38')});}; \ No newline at end of file +var _0x0d9c=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','Bearer\x20','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','api','moment','request-promise','node-fetch','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','body','whatsapp:','/api/whatsapp/messages/','/status?token=','token','then','sid','afterCreate'];(function(_0x58d038,_0x508f2f){var _0xd5fa8f=function(_0x354b57){while(--_0x354b57){_0x58d038['push'](_0x58d038['shift']());}};_0xd5fa8f(++_0x508f2f);}(_0x0d9c,0x7c));var _0xc0d9=function(_0x6afc9c,_0xf6b755){_0x6afc9c=_0x6afc9c-0x0;var _0x195d68=_0x0d9c[_0x6afc9c];return _0x195d68;};'use strict';var _=require('lodash');var util=require(_0xc0d9('0x0'));var logger=require(_0xc0d9('0x1'))(_0xc0d9('0x2'));var moment=require(_0xc0d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0d9('0x4'));var fetch=require(_0xc0d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xc0d9('0x7'));module[_0xc0d9('0x8')]=function(_0x2b5ae3,_0x434082){return _0x2b5ae3[_0xc0d9('0x9')](_0xc0d9('0xa'),attributes,{'tableName':_0xc0d9('0xb'),'paranoid':![],'indexes':[{'name':_0xc0d9('0xc'),'fields':[_0xc0d9('0xc')]},{'name':_0xc0d9('0xd'),'fields':['body'],'type':_0xc0d9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f5fc6,_0x5301c5,_0x52bbee){var _0x5971e5=_0x2b5ae3['models'];var _0x1e2201=_0x1f5fc6[_0xc0d9('0xf')]({'plain':!![]});if(_0x1e2201[_0xc0d9('0x10')][_0xc0d9('0x11')]()==='in'||_0x1e2201[_0xc0d9('0x10')][_0xc0d9('0x11')]()==='out'&&!_0x1e2201[_0xc0d9('0x12')]&&!_[_0xc0d9('0x13')](_0x1e2201[_0xc0d9('0x14')])){_0x5971e5[_0xc0d9('0x15')][_0xc0d9('0x16')]({'where':{'id':_0x1e2201['WhatsappInteractionId']}})['then'](function(_0x144380){if(_0x144380){_0x144380[_0xc0d9('0x17')]({'lastMsgAt':_0x1e2201[_0xc0d9('0x18')],'lastMsgDirection':_0x1e2201['direction'][_0xc0d9('0x11')]()});}})[_0xc0d9('0x19')](function(_0x3479c4){console[_0xc0d9('0x1a')](_0x3479c4);});}if(_0x1e2201[_0xc0d9('0x10')]===_0xc0d9('0x1b')&&!_0x1e2201[_0xc0d9('0x12')]){var _0x67bf00;_0x5971e5[_0xc0d9('0x1c')][_0xc0d9('0x1d')]({'where':{'id':_0x1e2201[_0xc0d9('0x1e')]},'raw':!![]})['then'](function(_0x5ab313){_0x67bf00=_0x5ab313;if(_0x67bf00&&_0x67bf00[_0xc0d9('0x1f')]){switch(_0x67bf00[_0xc0d9('0x1f')]){case _0xc0d9('0x20'):var _0x54d4eb=require(_0xc0d9('0x20'));if(_0x67bf00[_0xc0d9('0x21')]&&_0x67bf00[_0xc0d9('0x22')]&&_0x67bf00[_0xc0d9('0x23')]){var _0x3640a1=new _0x54d4eb(_0x67bf00[_0xc0d9('0x21')],_0x67bf00[_0xc0d9('0x22')]);_0x3640a1['messages']['create']({'body':_0x1e2201[_0xc0d9('0x24')],'to':_0xc0d9('0x25')+_0x1e2201[_0xc0d9('0x23')],'from':_0xc0d9('0x25')+_0x67bf00[_0xc0d9('0x23')],'statusCallback':_0x67bf00['remote']+_0xc0d9('0x26')+_0x1e2201['id']+_0xc0d9('0x27')+_0x67bf00[_0xc0d9('0x28')]})[_0xc0d9('0x29')](function(_0x9dc075){if(_0x9dc075[_0xc0d9('0x2a')]){return _0x1f5fc6[_0xc0d9('0x17')]({'messageId':_0x9dc075[_0xc0d9('0x2a')]});}})[_0xc0d9('0x19')](function(_0x17f1df){logger[_0xc0d9('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc0d9('0x2b'),_0xc0d9('0x20'),util['inspect'](_0x17f1df,{'showHidden':![],'depth':null}));});}else{logger[_0xc0d9('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc0d9('0x2b'),'twilio',_0xc0d9('0x2c'));}break;case _0xc0d9('0x2d'):var _0x5f17f3=_0x67bf00[_0xc0d9('0x21')];var _0xcddec=_0x67bf00[_0xc0d9('0x22')];var _0x268bab=_0x67bf00['baseUrl']+_0xc0d9('0x2e')+_0x5f17f3+_0xc0d9('0x2f');var _0x4b55f5={'to':[_0x1e2201[_0xc0d9('0x23')]],'message':{'type':_0xc0d9('0x30'),'text':_0x1e2201[_0xc0d9('0x24')]}};var _0x3c6ab3={'method':'POST','uri':_0x268bab,'headers':{'Authorization':_0xc0d9('0x31')+_0xcddec,'Content-Type':'application/json'},'body':_0x4b55f5,'json':!![]};rp(_0x3c6ab3)[_0xc0d9('0x29')](function(_0x2209b5){if(_0x2209b5['statuses'][0x0][_0xc0d9('0x32')]){return _0x1f5fc6[_0xc0d9('0x17')]({'messageId':_0x2209b5[_0xc0d9('0x33')][0x0][_0xc0d9('0x32')]});}})['catch'](function(_0x393445){logger[_0xc0d9('0x34')](_0xc0d9('0x35'),_0x393445);});break;}}})[_0xc0d9('0x36')](function(){_0x52bbee();});}else{_0x52bbee();}}},'charset':_0xc0d9('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b990d78..5ffd4d7 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 _0x00d2=['create','body','options','raw','then','CreateWhatsappMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch'];(function(_0x111e50,_0x18f892){var _0x3eb57c=function(_0x3f545d){while(--_0x3f545d){_0x111e50['push'](_0x111e50['shift']());}};_0x3eb57c(++_0x18f892);}(_0x00d2,0x17c));var _0x200d=function(_0x592307,_0x2b8719){_0x592307=_0x592307-0x0;var _0x244eb8=_0x00d2[_0x592307];return _0x244eb8;};'use strict';var _=require(_0x200d('0x0'));var util=require(_0x200d('0x1'));var moment=require(_0x200d('0x2'));var BPromise=require(_0x200d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x200d('0x4'));var db=require(_0x200d('0x5'))['db'];var utils=require(_0x200d('0x6'));var logger=require(_0x200d('0x7'))(_0x200d('0x8'));var config=require('../../config/environment');var jayson=require(_0x200d('0x9'));var client=jayson[_0x200d('0xa')][_0x200d('0xb')]({'port':0x232a});config[_0x200d('0xc')]=_[_0x200d('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x200d('0xe'))(new Redis(config[_0x200d('0xc')]));require(_0x200d('0xf'))['register'](socket);function respondWithRpcPromise(_0x2c308c,_0x971563,_0x4c7746){return new BPromise(function(_0x58bfa0,_0x185290){return client[_0x200d('0x10')](_0x2c308c,_0x4c7746)['then'](function(_0x16014c){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x971563,'request\x20sent');logger[_0x200d('0x11')](_0x200d('0x12'),_0x971563,_0x200d('0x13'),JSON[_0x200d('0x14')](_0x16014c));if(_0x16014c['error']){if(_0x16014c['error'][_0x200d('0x15')]===0x1f4){logger[_0x200d('0x16')](_0x200d('0x17'),_0x971563,_0x16014c['error'][_0x200d('0x18')]);return _0x185290(_0x16014c[_0x200d('0x16')][_0x200d('0x18')]);}logger[_0x200d('0x16')](_0x200d('0x17'),_0x971563,_0x16014c[_0x200d('0x16')][_0x200d('0x18')]);return _0x58bfa0(_0x16014c['error'][_0x200d('0x18')]);}else{logger[_0x200d('0x19')](_0x200d('0x17'),_0x971563,_0x200d('0x13'));_0x58bfa0(_0x16014c[_0x200d('0x1a')]['message']);}})[_0x200d('0x1b')](function(_0x51caba){logger[_0x200d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x971563,_0x51caba);_0x185290(_0x51caba);});});}exports['CreateWhatsappMessage']=function(_0x3b84ec){var _0x203d69=this;return new Promise(function(_0x2e035a,_0x29fd30){return db['WhatsappMessage'][_0x200d('0x1c')](_0x3b84ec[_0x200d('0x1d')],{'raw':_0x3b84ec[_0x200d('0x1e')]?_0x3b84ec[_0x200d('0x1e')][_0x200d('0x1f')]===undefined?!![]:![]:!![]})[_0x200d('0x20')](function(_0xd1d8d1){logger['info'](_0x200d('0x21'),_0x3b84ec);logger[_0x200d('0x11')](_0x200d('0x21'),_0x3b84ec,JSON[_0x200d('0x14')](_0xd1d8d1));_0x2e035a(_0xd1d8d1);})[_0x200d('0x1b')](function(_0x5bc93a){logger[_0x200d('0x16')](_0x200d('0x21'),_0x5bc93a['message'],_0x3b84ec);_0x29fd30(_0x203d69[_0x200d('0x16')](0x1f4,_0x5bc93a['message']));});});}; \ No newline at end of file +var _0xf308=['WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateWhatsappMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xf308,0x190));var _0x8f30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf308[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8f30('0x0'));var util=require(_0x8f30('0x1'));var moment=require(_0x8f30('0x2'));var BPromise=require(_0x8f30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f30('0x4'));var db=require(_0x8f30('0x5'))['db'];var utils=require(_0x8f30('0x6'));var logger=require(_0x8f30('0x7'))(_0x8f30('0x8'));var config=require(_0x8f30('0x9'));var jayson=require(_0x8f30('0xa'));var client=jayson[_0x8f30('0xb')][_0x8f30('0xc')]({'port':0x232a});config[_0x8f30('0xd')]=_[_0x8f30('0xe')](config[_0x8f30('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8f30('0xf'))(new Redis(config[_0x8f30('0xd')]));require('./whatsappMessage.socket')[_0x8f30('0x10')](socket);function respondWithRpcPromise(_0x530828,_0x103def,_0x24bc88){return new BPromise(function(_0x5bb9d4,_0x5b1953){return client[_0x8f30('0x11')](_0x530828,_0x24bc88)[_0x8f30('0x12')](function(_0x57a780){logger[_0x8f30('0x13')](_0x8f30('0x14'),_0x103def,'request\x20sent');logger['debug'](_0x8f30('0x15'),_0x103def,'request\x20sent',JSON[_0x8f30('0x16')](_0x57a780));if(_0x57a780[_0x8f30('0x17')]){if(_0x57a780[_0x8f30('0x17')][_0x8f30('0x18')]===0x1f4){logger[_0x8f30('0x17')](_0x8f30('0x14'),_0x103def,_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);return _0x5b1953(_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);}logger[_0x8f30('0x17')](_0x8f30('0x14'),_0x103def,_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);return _0x5bb9d4(_0x57a780[_0x8f30('0x17')][_0x8f30('0x19')]);}else{logger[_0x8f30('0x13')](_0x8f30('0x14'),_0x103def,_0x8f30('0x1a'));_0x5bb9d4(_0x57a780[_0x8f30('0x1b')][_0x8f30('0x19')]);}})['catch'](function(_0x4971c1){logger[_0x8f30('0x17')](_0x8f30('0x14'),_0x103def,_0x4971c1);_0x5b1953(_0x4971c1);});});}exports[_0x8f30('0x1c')]=function(_0x3869c1){var _0x109daa=this;return new Promise(function(_0x49ed01,_0x219f06){return db['WhatsappMessage'][_0x8f30('0x1d')](_0x3869c1[_0x8f30('0x1e')],{'raw':_0x3869c1['options']?_0x3869c1[_0x8f30('0x1f')][_0x8f30('0x20')]===undefined?!![]:![]:!![]})[_0x8f30('0x12')](function(_0x16dd53){logger[_0x8f30('0x13')](_0x8f30('0x1c'),_0x3869c1);logger[_0x8f30('0x21')]('CreateWhatsappMessage',_0x3869c1,JSON[_0x8f30('0x16')](_0x16dd53));_0x49ed01(_0x16dd53);})[_0x8f30('0x22')](function(_0x538f90){logger['error'](_0x8f30('0x1c'),_0x538f90[_0x8f30('0x19')],_0x3869c1);_0x219f06(_0x109daa[_0x8f30('0x17')](0x1f4,_0x538f90[_0x8f30('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 0a102a9..bbfda00 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 _0x803f=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x173e4a,_0x3d5cbd){var _0x4dbb90=function(_0x54b475){while(--_0x54b475){_0x173e4a['push'](_0x173e4a['shift']());}};_0x4dbb90(++_0x3d5cbd);}(_0x803f,0x18a));var _0xf803=function(_0x313e0f,_0x3ff7c1){_0x313e0f=_0x313e0f-0x0;var _0x478985=_0x803f[_0x313e0f];return _0x478985;};'use strict';var WhatsappMessageEvents=require(_0xf803('0x0'));var events=[_0xf803('0x1'),_0xf803('0x2'),_0xf803('0x3')];function createListener(_0x2974bb,_0x40aa56){return function(_0x435d19){_0x40aa56[_0xf803('0x4')](_0x2974bb,_0x435d19);};}function removeListener(_0x12def1,_0x8efff){return function(){WhatsappMessageEvents[_0xf803('0x5')](_0x12def1,_0x8efff);};}exports[_0xf803('0x6')]=function(_0x481805){for(var _0x4ea577=0x0,_0x2bcd06=events[_0xf803('0x7')];_0x4ea577<_0x2bcd06;_0x4ea577++){var _0x126360=events[_0x4ea577];var _0x539045=createListener(_0xf803('0x8')+_0x126360,_0x481805);WhatsappMessageEvents['on'](_0x126360,_0x539045);}}; \ No newline at end of file +var _0x7a4a=['save','remove','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x4ea092,_0x531671){var _0x53a0fd=function(_0x4f67cd){while(--_0x4f67cd){_0x4ea092['push'](_0x4ea092['shift']());}};_0x53a0fd(++_0x531671);}(_0x7a4a,0x8b));var _0xa7a4=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x7a4a[_0x582274];return _0x8f14d3;};'use strict';var WhatsappMessageEvents=require(_0xa7a4('0x0'));var events=[_0xa7a4('0x1'),_0xa7a4('0x2'),'update'];function createListener(_0x5ec646,_0x5366b5){return function(_0x41525c){_0x5366b5[_0xa7a4('0x3')](_0x5ec646,_0x41525c);};}function removeListener(_0x12e6c0,_0x5bbbb5){return function(){WhatsappMessageEvents[_0xa7a4('0x4')](_0x12e6c0,_0x5bbbb5);};}exports[_0xa7a4('0x5')]=function(_0x42edef){for(var _0x5ae486=0x0,_0x27ca8b=events['length'];_0x5ae486<_0x27ca8b;_0x5ae486++){var _0x188d56=events[_0x5ae486];var _0x572bc9=createListener(_0xa7a4('0x6')+_0x188d56,_0x42edef);WhatsappMessageEvents['on'](_0x188d56,_0x572bc9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 0b6993e..b063aab 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 _0x10fc=['/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','put'];(function(_0x4da528,_0x3e5a26){var _0x13b677=function(_0x16861f){while(--_0x16861f){_0x4da528['push'](_0x4da528['shift']());}};_0x13b677(++_0x3e5a26);}(_0x10fc,0x10b));var _0xc10f=function(_0x2ab669,_0x3aee0b){_0x2ab669=_0x2ab669-0x0;var _0x234eb3=_0x10fc[_0x2ab669];return _0x234eb3;};'use strict';var multer=require(_0xc10f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc10f('0x1'));var router=express[_0xc10f('0x2')]();var fs_extra=require(_0xc10f('0x3'));var auth=require(_0xc10f('0x4'));var interaction=require(_0xc10f('0x5'));var config=require('../../config/environment');var controller=require(_0xc10f('0x6'));router['get']('/',auth[_0xc10f('0x7')](),controller[_0xc10f('0x8')]);router[_0xc10f('0x9')](_0xc10f('0xa'),auth[_0xc10f('0x7')](),controller[_0xc10f('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc10f('0x9')]('/:id/members',auth[_0xc10f('0x7')](),controller['getMembers']);router[_0xc10f('0x9')](_0xc10f('0xc'),auth['isAuthenticated'](),controller[_0xc10f('0xd')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xc10f('0xe')]);router[_0xc10f('0xf')]('/',auth[_0xc10f('0x7')](),controller['create']);router[_0xc10f('0xf')]('/:id/teams',auth[_0xc10f('0x7')](),controller[_0xc10f('0x10')]);router[_0xc10f('0xf')](_0xc10f('0x11'),auth[_0xc10f('0x7')](),controller['addAgents']);router[_0xc10f('0x12')](_0xc10f('0x13'),auth[_0xc10f('0x7')](),controller[_0xc10f('0x14')]);router[_0xc10f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc10f('0x16')]);router[_0xc10f('0x15')](_0xc10f('0xc'),auth[_0xc10f('0x7')](),controller[_0xc10f('0x17')]);router[_0xc10f('0x15')](_0xc10f('0x11'),auth[_0xc10f('0x7')](),controller[_0xc10f('0x18')]);module[_0xc10f('0x19')]=router; \ No newline at end of file +var _0xd7a4=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put'];(function(_0x2b78e5,_0x3126f8){var _0xa8d52d=function(_0x51fd7f){while(--_0x51fd7f){_0x2b78e5['push'](_0x2b78e5['shift']());}};_0xa8d52d(++_0x3126f8);}(_0xd7a4,0x7e));var _0x4d7a=function(_0x35f735,_0x23be1b){_0x35f735=_0x35f735-0x0;var _0x59fdfc=_0xd7a4[_0x35f735];return _0x59fdfc;};'use strict';var multer=require(_0x4d7a('0x0'));var util=require(_0x4d7a('0x1'));var path=require('path');var timeout=require(_0x4d7a('0x2'));var express=require(_0x4d7a('0x3'));var router=express[_0x4d7a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4d7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d7a('0x6'));var controller=require('./whatsappQueue.controller');router[_0x4d7a('0x7')]('/',auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x9')]);router[_0x4d7a('0x7')](_0x4d7a('0xa'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0xb')]);router[_0x4d7a('0x7')](_0x4d7a('0xc'),auth['isAuthenticated'](),controller[_0x4d7a('0xd')]);router['get'](_0x4d7a('0xe'),auth[_0x4d7a('0x8')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x4d7a('0x8')](),controller[_0x4d7a('0xf')]);router[_0x4d7a('0x7')](_0x4d7a('0x10'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x11')]);router[_0x4d7a('0x12')]('/',auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x13')]);router[_0x4d7a('0x12')](_0x4d7a('0x14'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x15')]);router[_0x4d7a('0x12')](_0x4d7a('0x10'),auth['isAuthenticated'](),controller[_0x4d7a('0x16')]);router[_0x4d7a('0x17')](_0x4d7a('0xc'),auth['isAuthenticated'](),controller[_0x4d7a('0x18')]);router[_0x4d7a('0x19')](_0x4d7a('0xc'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x1a')]);router[_0x4d7a('0x19')](_0x4d7a('0x14'),auth[_0x4d7a('0x8')](),controller[_0x4d7a('0x1b')]);router['delete'](_0x4d7a('0x10'),auth['isAuthenticated'](),controller[_0x4d7a('0x1c')]);module[_0x4d7a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 2da76aa..60d2bd1 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 _0xa9e0=['ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x4a7d46,_0x570717){var _0x179d32=function(_0x5c5bf5){while(--_0x5c5bf5){_0x4a7d46['push'](_0x4a7d46['shift']());}};_0x179d32(++_0x570717);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a9e('0x3')]('rrmemory',_0x0a9e('0x4'),_0x0a9e('0x5'))},'description':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0x91a7=['beepall','exports','STRING','name','ENUM'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x91a7,0xe7));var _0x791a=function(_0x35f3b5,_0xcbee2d){_0x35f3b5=_0x35f3b5-0x0;var _0x5d2a4c=_0x91a7[_0x35f3b5];return _0x5d2a4c;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')],'unique':_0x791a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x791a('0x3')]('rrmemory',_0x791a('0x4'),'roundrobin')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6b57f48..288b767 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 _0x1495=['set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','WhatsappQueue','include','catch','show','params','keys','includeAll','options','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','order','pick','findAll','User','findAndCountAll','agent','whatsappPause','updatedAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','value','isEmpty','removeAgents','addAgents','omit','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x4ad10b,_0xc0529e){var _0xfc602f=function(_0x73b3eb){while(--_0x73b3eb){_0x4ad10b['push'](_0x4ad10b['shift']());}};_0xfc602f(++_0xc0529e);}(_0x1495,0x189));var _0x5149=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1495[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x5149('0x0'));var rimraf=require(_0x5149('0x1'));var zipdir=require(_0x5149('0x2'));var jsonpatch=require(_0x5149('0x3'));var rp=require('request-promise');var moment=require(_0x5149('0x4'));var BPromise=require(_0x5149('0x5'));var Mustache=require(_0x5149('0x6'));var util=require(_0x5149('0x7'));var path=require(_0x5149('0x8'));var sox=require(_0x5149('0x9'));var csv=require('to-csv');var ejs=require(_0x5149('0xa'));var fs=require('fs');var fs_extra=require(_0x5149('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5149('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5149('0xd'));var toCsv=require(_0x5149('0xe'));var querystring=require(_0x5149('0xf'));var Papa=require(_0x5149('0x10'));var Redis=require(_0x5149('0x11'));var authService=require(_0x5149('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5149('0x13'));var hardwareService=require(_0x5149('0x14'));var logger=require(_0x5149('0x15'))(_0x5149('0x16'));var utils=require(_0x5149('0x17'));var config=require(_0x5149('0x18'));var licenseUtil=require(_0x5149('0x19'));var db=require(_0x5149('0x1a'))['db'];config['redis']=_[_0x5149('0x1b')](config[_0x5149('0x1c')],{'host':_0x5149('0x1d'),'port':0x18eb});var socket=require(_0x5149('0x1e'))(new Redis(config[_0x5149('0x1c')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x5e6166,_0x304244){_0x304244=_0x304244||0xcc;return function(_0x36608d){if(_0x36608d){return _0x5e6166[_0x5149('0x1f')](_0x304244);}return _0x5e6166[_0x5149('0x20')](_0x304244)[_0x5149('0x21')]();};}function respondWithResult(_0x442e92,_0x4150ca){_0x4150ca=_0x4150ca||0xc8;return function(_0x31d549){if(_0x31d549){return _0x442e92[_0x5149('0x20')](_0x4150ca)[_0x5149('0x22')](_0x31d549);}};}function respondWithFilteredResult(_0x1594e0,_0x438851){return function(_0x2fd9c2){if(_0x2fd9c2){var _0x4d7b5f=typeof _0x438851['offset']===_0x5149('0x23')&&typeof _0x438851[_0x5149('0x24')]===_0x5149('0x23');var _0x1916c3=_0x2fd9c2[_0x5149('0x25')];var _0xc08e35=_0x4d7b5f?0x0:_0x438851[_0x5149('0x26')];var _0x4dff37=_0x4d7b5f?_0x2fd9c2[_0x5149('0x25')]:_0x438851[_0x5149('0x26')]+_0x438851['limit'];var _0x2b76db;if(_0x4dff37>=_0x1916c3){_0x4dff37=_0x1916c3;_0x2b76db=0xc8;}else{_0x2b76db=0xce;}_0x1594e0[_0x5149('0x20')](_0x2b76db);return _0x1594e0[_0x5149('0x27')](_0x5149('0x28'),_0xc08e35+'-'+_0x4dff37+'/'+_0x1916c3)['json'](_0x2fd9c2);}return null;};}function patchUpdates(_0x2671ad){return function(_0x5f597c){try{jsonpatch[_0x5149('0x29')](_0x5f597c,_0x2671ad,!![]);}catch(_0x181f36){return BPromise[_0x5149('0x2a')](_0x181f36);}return _0x5f597c[_0x5149('0x2b')]();};}function saveUpdates(_0x384eda,_0x347fbc){return function(_0x5b190d){if(_0x5b190d){return _0x5b190d[_0x5149('0x2c')](_0x384eda)[_0x5149('0x2d')](function(_0x15c95c){return _0x15c95c;});}return null;};}function removeEntity(_0x5e2442,_0x92291){return function(_0x6d2556){if(_0x6d2556){return _0x6d2556[_0x5149('0x2e')]()[_0x5149('0x2d')](function(){var _0x1d64af=_0x6d2556[_0x5149('0x2f')]({'plain':!![]});var _0x563b4d=_0x5149('0x30');return db[_0x5149('0x31')]['destroy']({'where':{'type':_0x563b4d,'resourceId':_0x1d64af['id']}})[_0x5149('0x2d')](function(){return _0x6d2556;});})[_0x5149('0x2d')](function(){_0x5e2442[_0x5149('0x20')](0xcc)[_0x5149('0x21')]();});}};}function handleEntityNotFound(_0x23cf13,_0x1e589c){return function(_0x457d7d){if(!_0x457d7d){_0x23cf13[_0x5149('0x1f')](0x194);}return _0x457d7d;};}function handleError(_0x385b38,_0x17c4a6){_0x17c4a6=_0x17c4a6||0x1f4;return function(_0x374193){logger['error'](_0x374193['stack']);if(_0x374193[_0x5149('0x32')]){delete _0x374193[_0x5149('0x32')];}_0x385b38[_0x5149('0x20')](_0x17c4a6)[_0x5149('0x33')](_0x374193);};}exports[_0x5149('0x34')]=function(_0x1092ac,_0x47cd00){var _0x34d228={},_0x4f6001={},_0x569601={'count':0x0,'rows':[]};var _0x47e8ef=_[_0x5149('0x35')](db['WhatsappQueue'][_0x5149('0x36')],function(_0x227afc){return{'name':_0x227afc[_0x5149('0x37')],'type':_0x227afc[_0x5149('0x38')][_0x5149('0x39')]};});_0x4f6001[_0x5149('0x3a')]=_['map'](_0x47e8ef,_0x5149('0x32'));_0x4f6001[_0x5149('0x3b')]=_['keys'](_0x1092ac['query']);_0x4f6001['filters']=_[_0x5149('0x3c')](_0x4f6001['model'],_0x4f6001[_0x5149('0x3b')]);_0x34d228[_0x5149('0x3d')]=_[_0x5149('0x3c')](_0x4f6001['model'],qs['fields'](_0x1092ac[_0x5149('0x3b')][_0x5149('0x3e')]));_0x34d228[_0x5149('0x3d')]=_0x34d228[_0x5149('0x3d')][_0x5149('0x3f')]?_0x34d228['attributes']:_0x4f6001[_0x5149('0x3a')];if(!_0x1092ac[_0x5149('0x3b')][_0x5149('0x40')]('nolimit')){_0x34d228[_0x5149('0x24')]=qs[_0x5149('0x24')](_0x1092ac[_0x5149('0x3b')][_0x5149('0x24')]);_0x34d228[_0x5149('0x26')]=qs[_0x5149('0x26')](_0x1092ac[_0x5149('0x3b')][_0x5149('0x26')]);}_0x34d228['order']=qs[_0x5149('0x41')](_0x1092ac[_0x5149('0x3b')][_0x5149('0x41')]);_0x34d228[_0x5149('0x42')]=qs[_0x5149('0x43')](_['pick'](_0x1092ac[_0x5149('0x3b')],_0x4f6001[_0x5149('0x43')]),_0x47e8ef);if(_0x1092ac[_0x5149('0x3b')][_0x5149('0x44')]){_0x34d228[_0x5149('0x42')]=_[_0x5149('0x45')](_0x34d228[_0x5149('0x42')],{'$or':_[_0x5149('0x35')](_0x47e8ef,function(_0x30bfca){if(_0x30bfca['type']!==_0x5149('0x46')){var _0x2ec8a0={};_0x2ec8a0[_0x30bfca['name']]={'$like':'%'+_0x1092ac[_0x5149('0x3b')][_0x5149('0x44')]+'%'};return _0x2ec8a0;}})});}_0x34d228=_[_0x5149('0x45')]({},_0x34d228,_0x1092ac['options']);var _0x485476={'where':_0x34d228[_0x5149('0x42')]};return db[_0x5149('0x47')][_0x5149('0x25')](_0x485476)[_0x5149('0x2d')](function(_0x2c9a7a){_0x569601[_0x5149('0x25')]=_0x2c9a7a;if(_0x1092ac[_0x5149('0x3b')]['includeAll']){_0x34d228[_0x5149('0x48')]=[{'all':!![]}];}return db[_0x5149('0x47')]['findAll'](_0x34d228);})[_0x5149('0x2d')](function(_0x38f1a5){_0x569601['rows']=_0x38f1a5;return _0x569601;})[_0x5149('0x2d')](respondWithFilteredResult(_0x47cd00,_0x34d228))[_0x5149('0x49')](handleError(_0x47cd00,null));};exports[_0x5149('0x4a')]=function(_0x302f57,_0x447f9a){var _0x1104ed={'raw':!![],'where':{'id':_0x302f57[_0x5149('0x4b')]['id']}},_0x31c3ec={};_0x31c3ec[_0x5149('0x3a')]=_[_0x5149('0x4c')](db[_0x5149('0x47')][_0x5149('0x36')]);_0x31c3ec['query']=_[_0x5149('0x4c')](_0x302f57[_0x5149('0x3b')]);_0x31c3ec[_0x5149('0x43')]=_[_0x5149('0x3c')](_0x31c3ec['model'],_0x31c3ec[_0x5149('0x3b')]);_0x1104ed[_0x5149('0x3d')]=_[_0x5149('0x3c')](_0x31c3ec[_0x5149('0x3a')],qs['fields'](_0x302f57[_0x5149('0x3b')]['fields']));_0x1104ed[_0x5149('0x3d')]=_0x1104ed[_0x5149('0x3d')]['length']?_0x1104ed[_0x5149('0x3d')]:_0x31c3ec[_0x5149('0x3a')];if(_0x302f57[_0x5149('0x3b')][_0x5149('0x4d')]){_0x1104ed[_0x5149('0x48')]=[{'all':!![]}];}_0x1104ed=_[_0x5149('0x45')]({},_0x1104ed,_0x302f57[_0x5149('0x4e')]);return db[_0x5149('0x47')][_0x5149('0x4f')](_0x1104ed)[_0x5149('0x2d')](handleEntityNotFound(_0x447f9a,null))[_0x5149('0x2d')](respondWithResult(_0x447f9a,null))['catch'](handleError(_0x447f9a,null));};exports[_0x5149('0x50')]=function(_0x1c9929,_0x1f39d9){return db['WhatsappQueue'][_0x5149('0x50')](_0x1c9929[_0x5149('0x51')],{})[_0x5149('0x2d')](function(_0x3c2840){var _0x2312a7=_0x1c9929[_0x5149('0x52')][_0x5149('0x2f')]({'plain':!![]});if(!_0x2312a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2312a7[_0x5149('0x53')]===_0x5149('0x52')){var _0x1583a7=_0x3c2840['get']({'plain':!![]});var _0xbd1907=_0x5149('0x30');return db[_0x5149('0x54')]['find']({'where':{'name':_0xbd1907,'userProfileId':_0x2312a7[_0x5149('0x55')]},'raw':!![]})[_0x5149('0x2d')](function(_0x505d8e){if(_0x505d8e&&_0x505d8e['autoAssociation']===0x0){return db[_0x5149('0x31')]['create']({'name':_0x1583a7[_0x5149('0x32')],'resourceId':_0x1583a7['id'],'type':_0x505d8e[_0x5149('0x32')],'sectionId':_0x505d8e['id']},{})[_0x5149('0x2d')](function(){return _0x3c2840;});}else{return _0x3c2840;}})[_0x5149('0x49')](function(_0x5a2771){logger[_0x5149('0x56')](_0x5149('0x57'),_0x5a2771);throw _0x5a2771;});}return _0x3c2840;})[_0x5149('0x2d')](respondWithResult(_0x1f39d9,0xc9))[_0x5149('0x49')](handleError(_0x1f39d9,null));};exports[_0x5149('0x2c')]=function(_0x31d1c5,_0x912fd1){if(_0x31d1c5[_0x5149('0x51')]['id']){delete _0x31d1c5['body']['id'];}return db[_0x5149('0x47')][_0x5149('0x4f')]({'where':{'id':_0x31d1c5['params']['id']}})['then'](handleEntityNotFound(_0x912fd1,null))[_0x5149('0x2d')](saveUpdates(_0x31d1c5['body'],null))['then'](respondWithResult(_0x912fd1,null))['catch'](handleError(_0x912fd1,null));};exports[_0x5149('0x2e')]=function(_0x44cf29,_0x514038){return db[_0x5149('0x47')][_0x5149('0x4f')]({'where':{'id':_0x44cf29[_0x5149('0x4b')]['id']}})[_0x5149('0x2d')](handleEntityNotFound(_0x514038,null))[_0x5149('0x2d')](removeEntity(_0x514038,null))[_0x5149('0x49')](handleError(_0x514038,null));};exports[_0x5149('0x58')]=function(_0x386cb9,_0xd2b203){return db[_0x5149('0x47')]['describe']()[_0x5149('0x2d')](respondWithResult(_0xd2b203,null))[_0x5149('0x49')](handleError(_0xd2b203,null));};exports[_0x5149('0x59')]=function(_0x3876ab,_0x4d930a,_0x259f4c){var _0x49a0c7={'raw':!![],'where':{}},_0x3f4fc5={},_0x133892;return db[_0x5149('0x47')][_0x5149('0x5a')]({'where':{'id':_0x3876ab[_0x5149('0x4b')]['id']}})[_0x5149('0x2d')](handleEntityNotFound(_0x4d930a,null))['then'](function(_0x4bda15){if(_0x4bda15){_0x133892=_0x4bda15[_0x5149('0x2f')]({'plain':!![]});_0x3f4fc5[_0x5149('0x3a')]=_[_0x5149('0x4c')](db['UserWhatsappQueue']['rawAttributes']);_0x3f4fc5['query']=_[_0x5149('0x4c')](_0x3876ab['query']);_0x3f4fc5[_0x5149('0x43')]=_[_0x5149('0x3c')](_0x3f4fc5[_0x5149('0x3a')],_0x3f4fc5['query']);_0x49a0c7[_0x5149('0x3d')]=_[_0x5149('0x3c')](_0x3f4fc5[_0x5149('0x3a')],qs['fields'](_0x3876ab['query'][_0x5149('0x3e')]));_0x49a0c7[_0x5149('0x3d')]=_0x49a0c7['attributes'][_0x5149('0x3f')]?_0x49a0c7[_0x5149('0x3d')]:_0x3f4fc5[_0x5149('0x3a')];if(!_0x3876ab[_0x5149('0x3b')][_0x5149('0x40')](_0x5149('0x5b'))){_0x49a0c7[_0x5149('0x24')]=qs['limit'](_0x3876ab[_0x5149('0x3b')][_0x5149('0x24')]);_0x49a0c7['offset']=qs[_0x5149('0x26')](_0x3876ab['query']['offset']);}_0x49a0c7[_0x5149('0x5c')]=qs['sort'](_0x3876ab['query'][_0x5149('0x41')]);_0x49a0c7[_0x5149('0x42')]=qs[_0x5149('0x43')](_[_0x5149('0x5d')](_0x3876ab['query'],_0x3f4fc5[_0x5149('0x43')]));_0x49a0c7[_0x5149('0x42')]['WhatsappQueueId']=_0x4bda15['id'];if(_0x3876ab[_0x5149('0x3b')][_0x5149('0x44')]){_0x49a0c7['where']=_[_0x5149('0x45')](_0x49a0c7[_0x5149('0x42')],{'$or':_['map'](_0x49a0c7['attributes'],function(_0x3dfc69){var _0x16d214={};_0x16d214[_0x3dfc69]={'$like':'%'+_0x3876ab[_0x5149('0x3b')][_0x5149('0x44')]+'%'};return _0x16d214;})});}_0x49a0c7=_[_0x5149('0x45')]({},_0x49a0c7,_0x3876ab[_0x5149('0x4e')]);return db['UserWhatsappQueue'][_0x5149('0x5e')](_0x49a0c7);}})['then'](function(_0xd12b68){if(_0xd12b68){return db[_0x5149('0x5f')][_0x5149('0x60')]({'where':{'id':_['map'](_0xd12b68,'UserId'),'role':_0x5149('0x61')},'attributes':['id','name',_0x5149('0x62'),_0x5149('0x63'),'createdAt']});}})[_0x5149('0x2d')](function(_0x520a6a){if(_0x520a6a){return{'count':_0x520a6a[_0x5149('0x25')],'rows':_[_0x5149('0x35')](_0x520a6a[_0x5149('0x64')],function(_0x48eb0c){return{'membername':_0x48eb0c[_0x5149('0x32')],'UserId':_0x48eb0c['id'],'queue_name':_0x133892[_0x5149('0x32')],'WhatsappQueueId':_0x133892['id'],'interface':util[_0x5149('0x65')](_0x5149('0x66'),_0x5149('0x67'),_0x48eb0c[_0x5149('0x32')]),'penalty':0x0,'paused':_0x48eb0c['whatsappPause'],'createdAt':_0x48eb0c['createdAt'],'updatedAt':_0x48eb0c[_0x5149('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5149('0x2d')](respondWithFilteredResult(_0x4d930a,_0x49a0c7))['catch'](handleError(_0x4d930a,null));};exports['getTeams']=function(_0x44599f,_0x3afd5e,_0xfc1b59){var _0x29d0fe={};var _0x4c6d55={};var _0x5e03de;var _0x32c57a;return db[_0x5149('0x47')][_0x5149('0x5a')]({'where':{'id':_0x44599f['params']['id']}})[_0x5149('0x2d')](handleEntityNotFound(_0x3afd5e,null))[_0x5149('0x2d')](function(_0x256064){if(_0x256064){_0x5e03de=_0x256064;_0x4c6d55[_0x5149('0x3a')]=_['keys'](db[_0x5149('0x68')]['rawAttributes']);_0x4c6d55[_0x5149('0x3b')]=_[_0x5149('0x4c')](_0x44599f[_0x5149('0x3b')]);_0x4c6d55[_0x5149('0x43')]=_[_0x5149('0x3c')](_0x4c6d55[_0x5149('0x3a')],_0x4c6d55[_0x5149('0x3b')]);_0x29d0fe[_0x5149('0x3d')]=_[_0x5149('0x3c')](_0x4c6d55[_0x5149('0x3a')],qs[_0x5149('0x3e')](_0x44599f[_0x5149('0x3b')][_0x5149('0x3e')]));_0x29d0fe['attributes']=_0x29d0fe[_0x5149('0x3d')][_0x5149('0x3f')]?_0x29d0fe[_0x5149('0x3d')]:_0x4c6d55['model'];_0x29d0fe[_0x5149('0x5c')]=qs[_0x5149('0x41')](_0x44599f['query'][_0x5149('0x41')]);_0x29d0fe[_0x5149('0x42')]=qs['filters'](_[_0x5149('0x5d')](_0x44599f[_0x5149('0x3b')],_0x4c6d55[_0x5149('0x43')]));if(_0x44599f[_0x5149('0x3b')][_0x5149('0x44')]){_0x29d0fe[_0x5149('0x42')]=_[_0x5149('0x45')](_0x29d0fe[_0x5149('0x42')],{'$or':_[_0x5149('0x35')](_0x29d0fe[_0x5149('0x3d')],function(_0x53fb5f){var _0x36225a={};_0x36225a[_0x53fb5f]={'$like':'%'+_0x44599f[_0x5149('0x3b')][_0x5149('0x44')]+'%'};return _0x36225a;})});}_0x29d0fe=_['merge']({},_0x29d0fe,_0x44599f['options']);return _0x5e03de[_0x5149('0x69')](_0x29d0fe);}})[_0x5149('0x2d')](function(_0x23c931){if(_0x23c931){_0x32c57a=_0x23c931['length'];if(!_0x44599f[_0x5149('0x3b')]['hasOwnProperty'](_0x5149('0x5b'))){_0x29d0fe[_0x5149('0x24')]=qs['limit'](_0x44599f['query'][_0x5149('0x24')]);_0x29d0fe[_0x5149('0x26')]=qs['offset'](_0x44599f[_0x5149('0x3b')][_0x5149('0x26')]);}return _0x5e03de[_0x5149('0x69')](_0x29d0fe);}})[_0x5149('0x2d')](function(_0x10e2ac){if(_0x10e2ac){return _0x10e2ac?{'count':_0x32c57a,'rows':_0x10e2ac}:null;}})[_0x5149('0x2d')](respondWithResult(_0x3afd5e,null))[_0x5149('0x49')](handleError(_0x3afd5e,null));};exports[_0x5149('0x6a')]=function(_0x212ded,_0x4a413f,_0x181428){var _0x2ce1f4=_0x212ded['body']['ids'];return db[_0x5149('0x68')][_0x5149('0x5e')]({'where':{'id':_0x2ce1f4},'attributes':['id'],'include':[{'model':db[_0x5149('0x5f')],'as':_0x5149('0x6b'),'attributes':['id',_0x5149('0x32'),_0x5149('0x6c'),_0x5149('0x6d'),_0x5149('0x6e')],'raw':!![]}]})[_0x5149('0x2d')](function(_0x513f46){if(_0x513f46){var _0x32053c=_[_0x5149('0x6f')](_0x513f46,function(_0x583458){var _0xf37632=_0x583458[_0x5149('0x2f')]({'plain':!![]});return _0xf37632[_0x5149('0x6b')];});return db[_0x5149('0x47')][_0x5149('0x4f')]({'where':{'id':_0x212ded['params']['id']}})['then'](function(_0x519972){return db[_0x5149('0x70')][_0x5149('0x71')](function(_0xd892ff){return _0x519972[_0x5149('0x6a')](_0x2ce1f4,{'transaction':_0xd892ff})[_0x5149('0x2d')](function(){return BPromise['each'](_0x32053c,function(_0x1e6321){return db['UserWhatsappQueue'][_0x5149('0x72')]({'where':{'UserId':_0x1e6321['id'],'WhatsappQueueId':_0x212ded[_0x5149('0x4b')]['id']},'transaction':_0xd892ff});});})['then'](function(){_0x32053c[_0x5149('0x73')](function(_0x4c2278){socket[_0x5149('0x74')](_0x5149('0x75'),{'UserId':_0x4c2278['id'],'WhatsappQueueId':_0x519972['id']});});});});});}})['then'](respondWithStatusCode(_0x4a413f,null))[_0x5149('0x49')](handleError(_0x4a413f,null));};exports[_0x5149('0x76')]=function(_0xe8848d,_0x42d431,_0x2e0685){return db[_0x5149('0x68')]['findAll']({'where':{'id':_0xe8848d['query'][_0x5149('0x77')]},'attributes':['id'],'include':[{'model':db[_0x5149('0x5f')],'as':_0x5149('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x5149('0x2d')](handleEntityNotFound(_0x42d431,null))[_0x5149('0x2d')](function(_0x980554){var _0x3b6581=_[_0x5149('0x35')](_0x980554,'id');var _0x459584=[];var _0xecacc4=[];var _0x848af6=squel[_0x5149('0x78')]();_0x848af6[_0x5149('0x79')](_0x5149('0x7a'))['from'](_0x5149('0x7b'),'tq')[_0x5149('0x7c')]('user_has_teams','ut',_0x5149('0x7d'))['where'](_0x5149('0x7e'),_0xe8848d['params']['id']);for(var _0x19d2a5=0x0;_0x19d2a5<_0x980554[_0x5149('0x3f')];_0x19d2a5+=0x1){let _0x5cd066=_0x980554[_0x19d2a5];for(var _0x3a42f5=0x0;_0x3a42f5<_0x5cd066[_0x5149('0x6b')][_0x5149('0x3f')];_0x3a42f5+=0x1){let _0x2ab5ee=_0x5cd066[_0x5149('0x6b')][_0x3a42f5];var _0x49f81e=_0x848af6[_0x5149('0x7f')]();_0x49f81e[_0x5149('0x42')](_0x5149('0x80'),_0x2ab5ee['id']);_0xecacc4['push'](db[_0x5149('0x70')][_0x5149('0x3b')](_0x49f81e[_0x5149('0x81')](),{'type':db['sequelize'][_0x5149('0x82')][_0x5149('0x83')]})[_0x5149('0x2d')](function(_0x3216c6){if(_0x3216c6['length']===0x1){return _0x2ab5ee['id'];}else{var _0x3bee88=_[_0x5149('0x84')](_[_0x5149('0x35')](_0x3216c6,_0x5149('0x85')),function(_0x3f1cd0){return _[_0x5149('0x86')](_0x3b6581,_0x3f1cd0);});if(_0x3bee88){return _0x2ab5ee['id'];}}}));}}return BPromise['all'](_0xecacc4)['then'](function(_0x1b9cc1){_0x459584=_(_0x459584)[_0x5149('0x87')](_0x1b9cc1)['compact']()[_0x5149('0x88')]();return db[_0x5149('0x47')][_0x5149('0x4f')]({'where':{'id':_0xe8848d[_0x5149('0x4b')]['id']}})[_0x5149('0x2d')](function(_0xa1f7e5){return db[_0x5149('0x70')][_0x5149('0x71')](function(_0x35bc85){return _0xa1f7e5[_0x5149('0x76')](_0xe8848d[_0x5149('0x3b')][_0x5149('0x77')],{'transaction':_0x35bc85})[_0x5149('0x2d')](function(){if(!_[_0x5149('0x89')](_0x459584)){return _0xa1f7e5[_0x5149('0x8a')](_0x459584,{'transaction':_0x35bc85});}})[_0x5149('0x2d')](function(){_0x459584['forEach'](function(_0x1698b7){socket[_0x5149('0x74')]('userWhatsappQueue:remove',{'UserId':_0x1698b7,'WhatsappQueueId':_0xa1f7e5['id']});});});});});});})[_0x5149('0x2d')](respondWithStatusCode(_0x42d431,null))[_0x5149('0x49')](handleError(_0x42d431,null));};exports['addAgents']=function(_0x4712e9,_0x491fd2,_0x450622){return db[_0x5149('0x47')][_0x5149('0x4f')]({'where':{'id':_0x4712e9['params']['id']}})[_0x5149('0x2d')](handleEntityNotFound(_0x491fd2,null))['then'](function(_0x2f382c){if(_0x2f382c){return _0x2f382c[_0x5149('0x8b')](_0x4712e9['body'][_0x5149('0x77')],_[_0x5149('0x8c')](_0x4712e9[_0x5149('0x51')],[_0x5149('0x77'),'id'])||{})['spread'](function(_0x3ac3ed){for(var _0x4d8dcc=0x0;_0x4d8dcc<_0x4712e9[_0x5149('0x51')][_0x5149('0x77')][_0x5149('0x3f')];_0x4d8dcc+=0x1){socket[_0x5149('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0x4712e9[_0x5149('0x51')][_0x5149('0x77')][_0x4d8dcc]),'WhatsappQueueId':Number(_0x4712e9['params']['id'])});}return _0x3ac3ed;});}})[_0x5149('0x2d')](respondWithResult(_0x491fd2,null))[_0x5149('0x49')](handleError(_0x491fd2,null));};exports[_0x5149('0x8a')]=function(_0x1ca70b,_0x1f9e91,_0x18b9f9){return db[_0x5149('0x47')]['find']({'where':{'id':_0x1ca70b[_0x5149('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f9e91,null))['then'](function(_0x1402b3){if(_0x1402b3){return _0x1402b3[_0x5149('0x8a')](_0x1ca70b['query'][_0x5149('0x77')])[_0x5149('0x2d')](function(){if(_[_0x5149('0x8d')](_0x1ca70b[_0x5149('0x3b')][_0x5149('0x77')])){for(var _0x393e1b=0x0;_0x393e1b<_0x1ca70b[_0x5149('0x3b')][_0x5149('0x77')][_0x5149('0x3f')];_0x393e1b+=0x1){socket['emit'](_0x5149('0x8e'),{'UserId':Number(_0x1ca70b[_0x5149('0x3b')]['ids'][_0x393e1b]),'WhatsappQueueId':Number(_0x1ca70b[_0x5149('0x4b')]['id'])});}}else{socket[_0x5149('0x74')](_0x5149('0x8e'),{'UserId':Number(_0x1ca70b[_0x5149('0x3b')][_0x5149('0x77')]),'WhatsappQueueId':Number(_0x1ca70b[_0x5149('0x4b')]['id'])});}});}})[_0x5149('0x2d')](respondWithStatusCode(_0x1f9e91,null))[_0x5149('0x49')](handleError(_0x1f9e91,null));};exports['getAgents']=function(_0x44bb37,_0x6eb7ff,_0x1058b9){var _0x52c2cf={};var _0xbefda2={};var _0x41159f;var _0x13be27;return db[_0x5149('0x47')][_0x5149('0x5a')]({'where':{'id':_0x44bb37[_0x5149('0x4b')]['id']}})[_0x5149('0x2d')](handleEntityNotFound(_0x6eb7ff,null))['then'](function(_0x249248){if(_0x249248){_0x41159f=_0x249248;_0xbefda2['model']=_[_0x5149('0x4c')](db['User'][_0x5149('0x36')]);_0xbefda2[_0x5149('0x3b')]=_[_0x5149('0x4c')](_0x44bb37[_0x5149('0x3b')]);_0xbefda2['filters']=_[_0x5149('0x3c')](_0xbefda2[_0x5149('0x3a')],_0xbefda2[_0x5149('0x3b')]);_0x52c2cf['attributes']=_['intersection'](_0xbefda2[_0x5149('0x3a')],qs[_0x5149('0x3e')](_0x44bb37[_0x5149('0x3b')][_0x5149('0x3e')]));_0x52c2cf[_0x5149('0x3d')]=_0x52c2cf['attributes']['length']?_0x52c2cf[_0x5149('0x3d')]:_0xbefda2[_0x5149('0x3a')];_0x52c2cf['order']=qs[_0x5149('0x41')](_0x44bb37[_0x5149('0x3b')][_0x5149('0x41')]);_0x52c2cf[_0x5149('0x42')]=qs['filters'](_['pick'](_0x44bb37['query'],_0xbefda2[_0x5149('0x43')]));if(_0x44bb37[_0x5149('0x3b')][_0x5149('0x44')]){_0x52c2cf['where']=_[_0x5149('0x45')](_0x52c2cf[_0x5149('0x42')],{'$or':_[_0x5149('0x35')](_0x52c2cf[_0x5149('0x3d')],function(_0x2c9d8e){var _0x1110a1={};_0x1110a1[_0x2c9d8e]={'$like':'%'+_0x44bb37[_0x5149('0x3b')][_0x5149('0x44')]+'%'};return _0x1110a1;})});}_0x52c2cf=_[_0x5149('0x45')]({},_0x52c2cf,_0x44bb37[_0x5149('0x4e')]);return _0x41159f[_0x5149('0x8f')](_0x52c2cf);}})[_0x5149('0x2d')](function(_0x2b8103){if(_0x2b8103){_0x13be27=_0x2b8103[_0x5149('0x3f')];if(!_0x44bb37[_0x5149('0x3b')]['hasOwnProperty'](_0x5149('0x5b'))){_0x52c2cf[_0x5149('0x24')]=qs['limit'](_0x44bb37[_0x5149('0x3b')][_0x5149('0x24')]);_0x52c2cf['offset']=qs['offset'](_0x44bb37[_0x5149('0x3b')][_0x5149('0x26')]);}return _0x41159f[_0x5149('0x8f')](_0x52c2cf);}})[_0x5149('0x2d')](function(_0x28bd2a){if(_0x28bd2a){return _0x28bd2a?{'count':_0x13be27,'rows':_0x28bd2a}:null;}})[_0x5149('0x2d')](respondWithResult(_0x6eb7ff,null))[_0x5149('0x49')](handleError(_0x6eb7ff,null));}; \ No newline at end of file +var _0x496b=['join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','every','TeamId','includes','union','compact','value','transaction','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','limit','count','set','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','name','filter','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','keys','model','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','params','describe','getMembers','findOne','UserWhatsappQueue','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','createdAt','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','field','from','team_has_whatsapp_queues'];(function(_0x560e99,_0xd4aa09){var _0x2d770d=function(_0x131766){while(--_0x131766){_0x560e99['push'](_0x560e99['shift']());}};_0x2d770d(++_0xd4aa09);}(_0x496b,0x126));var _0xb496=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x496b[_0x3e25c1];return _0x52e7f2;};'use strict';var emlformat=require(_0xb496('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb496('0x1'));var BPromise=require(_0xb496('0x2'));var Mustache=require(_0xb496('0x3'));var util=require(_0xb496('0x4'));var path=require(_0xb496('0x5'));var sox=require(_0xb496('0x6'));var csv=require(_0xb496('0x7'));var ejs=require(_0xb496('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb496('0x9'));var crypto=require(_0xb496('0xa'));var jsforce=require(_0xb496('0xb'));var deskjs=require(_0xb496('0xc'));var toCsv=require(_0xb496('0x7'));var querystring=require(_0xb496('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb496('0xe'));var qs=require(_0xb496('0xf'));var as=require(_0xb496('0x10'));var hardwareService=require(_0xb496('0x11'));var logger=require(_0xb496('0x12'))(_0xb496('0x13'));var utils=require(_0xb496('0x14'));var config=require(_0xb496('0x15'));var licenseUtil=require(_0xb496('0x16'));var db=require(_0xb496('0x17'))['db'];config[_0xb496('0x18')]=_[_0xb496('0x19')](config['redis'],{'host':_0xb496('0x1a'),'port':0x18eb});var socket=require(_0xb496('0x1b'))(new Redis(config[_0xb496('0x18')]));require(_0xb496('0x1c'))[_0xb496('0x1d')](socket);function respondWithStatusCode(_0x19463f,_0x3c06d6){_0x3c06d6=_0x3c06d6||0xcc;return function(_0x4fe15a){if(_0x4fe15a){return _0x19463f['sendStatus'](_0x3c06d6);}return _0x19463f[_0xb496('0x1e')](_0x3c06d6)[_0xb496('0x1f')]();};}function respondWithResult(_0x27806f,_0xae62b4){_0xae62b4=_0xae62b4||0xc8;return function(_0x50d01b){if(_0x50d01b){return _0x27806f['status'](_0xae62b4)['json'](_0x50d01b);}};}function respondWithFilteredResult(_0x406118,_0x417c6b){return function(_0x3ef55f){if(_0x3ef55f){var _0x3fbeea=typeof _0x417c6b[_0xb496('0x20')]==='undefined'&&typeof _0x417c6b[_0xb496('0x21')]==='undefined';var _0x2b13c5=_0x3ef55f[_0xb496('0x22')];var _0xa292e4=_0x3fbeea?0x0:_0x417c6b[_0xb496('0x20')];var _0x47597d=_0x3fbeea?_0x3ef55f[_0xb496('0x22')]:_0x417c6b[_0xb496('0x20')]+_0x417c6b['limit'];var _0x2158a9;if(_0x47597d>=_0x2b13c5){_0x47597d=_0x2b13c5;_0x2158a9=0xc8;}else{_0x2158a9=0xce;}_0x406118[_0xb496('0x1e')](_0x2158a9);return _0x406118[_0xb496('0x23')]('Content-Range',_0xa292e4+'-'+_0x47597d+'/'+_0x2b13c5)['json'](_0x3ef55f);}return null;};}function patchUpdates(_0x159f31){return function(_0x2c6609){try{jsonpatch[_0xb496('0x24')](_0x2c6609,_0x159f31,!![]);}catch(_0x59de9b){return BPromise[_0xb496('0x25')](_0x59de9b);}return _0x2c6609[_0xb496('0x26')]();};}function saveUpdates(_0x318da6,_0x218d4e){return function(_0x2d7d27){if(_0x2d7d27){return _0x2d7d27['update'](_0x318da6)[_0xb496('0x27')](function(_0x546892){return _0x546892;});}return null;};}function removeEntity(_0x8ebbe5,_0xcdb36){return function(_0x3466ec){if(_0x3466ec){return _0x3466ec[_0xb496('0x28')]()[_0xb496('0x27')](function(){var _0x4943ca=_0x3466ec[_0xb496('0x29')]({'plain':!![]});var _0x438757=_0xb496('0x2a');return db[_0xb496('0x2b')][_0xb496('0x28')]({'where':{'type':_0x438757,'resourceId':_0x4943ca['id']}})[_0xb496('0x27')](function(){return _0x3466ec;});})['then'](function(){_0x8ebbe5['status'](0xcc)[_0xb496('0x1f')]();});}};}function handleEntityNotFound(_0x24f50a,_0x12a389){return function(_0x277334){if(!_0x277334){_0x24f50a[_0xb496('0x2c')](0x194);}return _0x277334;};}function handleError(_0x690a7b,_0x59fe7d){_0x59fe7d=_0x59fe7d||0x1f4;return function(_0x33220a){logger[_0xb496('0x2d')](_0x33220a[_0xb496('0x2e')]);if(_0x33220a['name']){delete _0x33220a['name'];}_0x690a7b['status'](_0x59fe7d)['send'](_0x33220a);};}exports[_0xb496('0x2f')]=function(_0x502670,_0x532827){var _0x4826c0={},_0x4f8b0e={},_0x36473a={'count':0x0,'rows':[]};var _0x475cbf=_[_0xb496('0x30')](db['WhatsappQueue'][_0xb496('0x31')],function(_0x3b7478){return{'name':_0x3b7478[_0xb496('0x32')],'type':_0x3b7478[_0xb496('0x33')][_0xb496('0x34')]};});_0x4f8b0e['model']=_[_0xb496('0x30')](_0x475cbf,'name');_0x4f8b0e[_0xb496('0x35')]=_['keys'](_0x502670[_0xb496('0x35')]);_0x4f8b0e[_0xb496('0x36')]=_[_0xb496('0x37')](_0x4f8b0e['model'],_0x4f8b0e['query']);_0x4826c0[_0xb496('0x38')]=_['intersection'](_0x4f8b0e['model'],qs['fields'](_0x502670[_0xb496('0x35')][_0xb496('0x39')]));_0x4826c0[_0xb496('0x38')]=_0x4826c0[_0xb496('0x38')][_0xb496('0x3a')]?_0x4826c0[_0xb496('0x38')]:_0x4f8b0e['model'];if(!_0x502670['query'][_0xb496('0x3b')](_0xb496('0x3c'))){_0x4826c0['limit']=qs[_0xb496('0x21')](_0x502670[_0xb496('0x35')][_0xb496('0x21')]);_0x4826c0[_0xb496('0x20')]=qs[_0xb496('0x20')](_0x502670[_0xb496('0x35')][_0xb496('0x20')]);}_0x4826c0[_0xb496('0x3d')]=qs[_0xb496('0x3e')](_0x502670[_0xb496('0x35')][_0xb496('0x3e')]);_0x4826c0[_0xb496('0x3f')]=qs['filters'](_['pick'](_0x502670['query'],_0x4f8b0e[_0xb496('0x36')]),_0x475cbf);if(_0x502670['query']['filter']){_0x4826c0[_0xb496('0x3f')]=_[_0xb496('0x40')](_0x4826c0[_0xb496('0x3f')],{'$or':_[_0xb496('0x30')](_0x475cbf,function(_0x3724a6){if(_0x3724a6[_0xb496('0x33')]!==_0xb496('0x41')){var _0x3ca103={};_0x3ca103[_0x3724a6[_0xb496('0x42')]]={'$like':'%'+_0x502670[_0xb496('0x35')][_0xb496('0x43')]+'%'};return _0x3ca103;}})});}_0x4826c0=_['merge']({},_0x4826c0,_0x502670[_0xb496('0x44')]);var _0x24ba15={'where':_0x4826c0[_0xb496('0x3f')]};return db[_0xb496('0x45')][_0xb496('0x22')](_0x24ba15)['then'](function(_0xcd6cd1){_0x36473a[_0xb496('0x22')]=_0xcd6cd1;if(_0x502670[_0xb496('0x35')][_0xb496('0x46')]){_0x4826c0[_0xb496('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xb496('0x48')](_0x4826c0);})[_0xb496('0x27')](function(_0x804450){_0x36473a[_0xb496('0x49')]=_0x804450;return _0x36473a;})['then'](respondWithFilteredResult(_0x532827,_0x4826c0))[_0xb496('0x4a')](handleError(_0x532827,null));};exports[_0xb496('0x4b')]=function(_0x35695c,_0x158ddc){var _0x957a31={'raw':!![],'where':{'id':_0x35695c['params']['id']}},_0xcd7678={};_0xcd7678['model']=_['keys'](db[_0xb496('0x45')][_0xb496('0x31')]);_0xcd7678[_0xb496('0x35')]=_[_0xb496('0x4c')](_0x35695c[_0xb496('0x35')]);_0xcd7678[_0xb496('0x36')]=_[_0xb496('0x37')](_0xcd7678[_0xb496('0x4d')],_0xcd7678[_0xb496('0x35')]);_0x957a31[_0xb496('0x38')]=_[_0xb496('0x37')](_0xcd7678[_0xb496('0x4d')],qs[_0xb496('0x39')](_0x35695c[_0xb496('0x35')][_0xb496('0x39')]));_0x957a31['attributes']=_0x957a31[_0xb496('0x38')]['length']?_0x957a31[_0xb496('0x38')]:_0xcd7678[_0xb496('0x4d')];if(_0x35695c[_0xb496('0x35')]['includeAll']){_0x957a31[_0xb496('0x47')]=[{'all':!![]}];}_0x957a31=_[_0xb496('0x40')]({},_0x957a31,_0x35695c[_0xb496('0x44')]);return db[_0xb496('0x45')][_0xb496('0x4e')](_0x957a31)[_0xb496('0x27')](handleEntityNotFound(_0x158ddc,null))['then'](respondWithResult(_0x158ddc,null))['catch'](handleError(_0x158ddc,null));};exports[_0xb496('0x4f')]=function(_0x497021,_0x5e0553){return db[_0xb496('0x45')]['create'](_0x497021[_0xb496('0x50')],{})[_0xb496('0x27')](function(_0x49c688){var _0x3c3739=_0x497021[_0xb496('0x51')][_0xb496('0x29')]({'plain':!![]});if(!_0x3c3739)throw new Error(_0xb496('0x52'));if(_0x3c3739[_0xb496('0x53')]==='user'){var _0x4c97a4=_0x49c688[_0xb496('0x29')]({'plain':!![]});var _0x2ce5b2=_0xb496('0x2a');return db['UserProfileSection'][_0xb496('0x4e')]({'where':{'name':_0x2ce5b2,'userProfileId':_0x3c3739[_0xb496('0x54')]},'raw':!![]})['then'](function(_0x26167d){if(_0x26167d&&_0x26167d['autoAssociation']===0x0){return db[_0xb496('0x2b')][_0xb496('0x4f')]({'name':_0x4c97a4[_0xb496('0x42')],'resourceId':_0x4c97a4['id'],'type':_0x26167d[_0xb496('0x42')],'sectionId':_0x26167d['id']},{})[_0xb496('0x27')](function(){return _0x49c688;});}else{return _0x49c688;}})[_0xb496('0x4a')](function(_0x4a63d2){logger[_0xb496('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a63d2);throw _0x4a63d2;});}return _0x49c688;})[_0xb496('0x27')](respondWithResult(_0x5e0553,0xc9))[_0xb496('0x4a')](handleError(_0x5e0553,null));};exports[_0xb496('0x55')]=function(_0x217656,_0x515729){if(_0x217656[_0xb496('0x50')]['id']){delete _0x217656['body']['id'];}return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x217656['params']['id']}})[_0xb496('0x27')](handleEntityNotFound(_0x515729,null))[_0xb496('0x27')](saveUpdates(_0x217656['body'],null))[_0xb496('0x27')](respondWithResult(_0x515729,null))[_0xb496('0x4a')](handleError(_0x515729,null));};exports['destroy']=function(_0x2938cc,_0x5e9e71){return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x2938cc[_0xb496('0x56')]['id']}})[_0xb496('0x27')](handleEntityNotFound(_0x5e9e71,null))[_0xb496('0x27')](removeEntity(_0x5e9e71,null))[_0xb496('0x4a')](handleError(_0x5e9e71,null));};exports[_0xb496('0x57')]=function(_0x5799ed,_0x9cc1d6){return db[_0xb496('0x45')][_0xb496('0x57')]()[_0xb496('0x27')](respondWithResult(_0x9cc1d6,null))['catch'](handleError(_0x9cc1d6,null));};exports[_0xb496('0x58')]=function(_0x2529b0,_0x2258c0,_0x5134aa){var _0xb64990={'raw':!![],'where':{}},_0x4ecaf2={},_0x50f51c;return db[_0xb496('0x45')][_0xb496('0x59')]({'where':{'id':_0x2529b0[_0xb496('0x56')]['id']}})['then'](handleEntityNotFound(_0x2258c0,null))[_0xb496('0x27')](function(_0x4d52aa){if(_0x4d52aa){_0x50f51c=_0x4d52aa['get']({'plain':!![]});_0x4ecaf2['model']=_[_0xb496('0x4c')](db[_0xb496('0x5a')][_0xb496('0x31')]);_0x4ecaf2['query']=_[_0xb496('0x4c')](_0x2529b0[_0xb496('0x35')]);_0x4ecaf2[_0xb496('0x36')]=_[_0xb496('0x37')](_0x4ecaf2[_0xb496('0x4d')],_0x4ecaf2[_0xb496('0x35')]);_0xb64990['attributes']=_[_0xb496('0x37')](_0x4ecaf2[_0xb496('0x4d')],qs['fields'](_0x2529b0[_0xb496('0x35')][_0xb496('0x39')]));_0xb64990[_0xb496('0x38')]=_0xb64990[_0xb496('0x38')]['length']?_0xb64990['attributes']:_0x4ecaf2[_0xb496('0x4d')];if(!_0x2529b0[_0xb496('0x35')][_0xb496('0x3b')]('nolimit')){_0xb64990[_0xb496('0x21')]=qs[_0xb496('0x21')](_0x2529b0[_0xb496('0x35')][_0xb496('0x21')]);_0xb64990[_0xb496('0x20')]=qs[_0xb496('0x20')](_0x2529b0['query'][_0xb496('0x20')]);}_0xb64990['order']=qs[_0xb496('0x3e')](_0x2529b0['query']['sort']);_0xb64990[_0xb496('0x3f')]=qs[_0xb496('0x36')](_[_0xb496('0x5b')](_0x2529b0['query'],_0x4ecaf2[_0xb496('0x36')]));_0xb64990[_0xb496('0x3f')][_0xb496('0x5c')]=_0x4d52aa['id'];if(_0x2529b0[_0xb496('0x35')][_0xb496('0x43')]){_0xb64990[_0xb496('0x3f')]=_[_0xb496('0x40')](_0xb64990[_0xb496('0x3f')],{'$or':_['map'](_0xb64990['attributes'],function(_0x4bb07c){var _0x56b8e0={};_0x56b8e0[_0x4bb07c]={'$like':'%'+_0x2529b0['query'][_0xb496('0x43')]+'%'};return _0x56b8e0;})});}_0xb64990=_[_0xb496('0x40')]({},_0xb64990,_0x2529b0[_0xb496('0x44')]);return db[_0xb496('0x5a')][_0xb496('0x48')](_0xb64990);}})[_0xb496('0x27')](function(_0x1d2a44){if(_0x1d2a44){return db[_0xb496('0x5d')][_0xb496('0x5e')]({'where':{'id':_[_0xb496('0x30')](_0x1d2a44,_0xb496('0x5f')),'role':_0xb496('0x60')},'attributes':['id',_0xb496('0x42'),_0xb496('0x61'),_0xb496('0x62'),'createdAt']});}})[_0xb496('0x27')](function(_0x2258ff){if(_0x2258ff){return{'count':_0x2258ff[_0xb496('0x22')],'rows':_[_0xb496('0x30')](_0x2258ff[_0xb496('0x49')],function(_0x353077){return{'membername':_0x353077[_0xb496('0x42')],'UserId':_0x353077['id'],'queue_name':_0x50f51c[_0xb496('0x42')],'WhatsappQueueId':_0x50f51c['id'],'interface':util[_0xb496('0x63')]('%s/%s','SIP',_0x353077['name']),'penalty':0x0,'paused':_0x353077['whatsappPause'],'createdAt':_0x353077[_0xb496('0x64')],'updatedAt':_0x353077[_0xb496('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb496('0x27')](respondWithFilteredResult(_0x2258c0,_0xb64990))[_0xb496('0x4a')](handleError(_0x2258c0,null));};exports[_0xb496('0x65')]=function(_0x500165,_0x408006,_0x12668c){var _0xa740f5={};var _0x533b25={};var _0x1a9972;var _0x58dd5d;return db['WhatsappQueue'][_0xb496('0x59')]({'where':{'id':_0x500165[_0xb496('0x56')]['id']}})['then'](handleEntityNotFound(_0x408006,null))[_0xb496('0x27')](function(_0x8a89d9){if(_0x8a89d9){_0x1a9972=_0x8a89d9;_0x533b25[_0xb496('0x4d')]=_[_0xb496('0x4c')](db[_0xb496('0x66')][_0xb496('0x31')]);_0x533b25[_0xb496('0x35')]=_['keys'](_0x500165[_0xb496('0x35')]);_0x533b25[_0xb496('0x36')]=_[_0xb496('0x37')](_0x533b25[_0xb496('0x4d')],_0x533b25['query']);_0xa740f5[_0xb496('0x38')]=_[_0xb496('0x37')](_0x533b25[_0xb496('0x4d')],qs[_0xb496('0x39')](_0x500165['query'][_0xb496('0x39')]));_0xa740f5[_0xb496('0x38')]=_0xa740f5[_0xb496('0x38')][_0xb496('0x3a')]?_0xa740f5[_0xb496('0x38')]:_0x533b25[_0xb496('0x4d')];_0xa740f5['order']=qs['sort'](_0x500165[_0xb496('0x35')][_0xb496('0x3e')]);_0xa740f5[_0xb496('0x3f')]=qs['filters'](_[_0xb496('0x5b')](_0x500165[_0xb496('0x35')],_0x533b25[_0xb496('0x36')]));if(_0x500165[_0xb496('0x35')][_0xb496('0x43')]){_0xa740f5['where']=_['merge'](_0xa740f5[_0xb496('0x3f')],{'$or':_['map'](_0xa740f5['attributes'],function(_0xf5eeea){var _0x3a9621={};_0x3a9621[_0xf5eeea]={'$like':'%'+_0x500165['query'][_0xb496('0x43')]+'%'};return _0x3a9621;})});}_0xa740f5=_['merge']({},_0xa740f5,_0x500165[_0xb496('0x44')]);return _0x1a9972[_0xb496('0x65')](_0xa740f5);}})['then'](function(_0x1aac21){if(_0x1aac21){_0x58dd5d=_0x1aac21['length'];if(!_0x500165['query']['hasOwnProperty'](_0xb496('0x3c'))){_0xa740f5[_0xb496('0x21')]=qs['limit'](_0x500165[_0xb496('0x35')][_0xb496('0x21')]);_0xa740f5['offset']=qs['offset'](_0x500165[_0xb496('0x35')][_0xb496('0x20')]);}return _0x1a9972['getTeams'](_0xa740f5);}})['then'](function(_0xcfaf40){if(_0xcfaf40){return _0xcfaf40?{'count':_0x58dd5d,'rows':_0xcfaf40}:null;}})['then'](respondWithResult(_0x408006,null))[_0xb496('0x4a')](handleError(_0x408006,null));};exports['addTeams']=function(_0x23d168,_0x2bf687,_0x17d4b9){var _0x508a49=_0x23d168[_0xb496('0x50')][_0xb496('0x67')];return db['Team'][_0xb496('0x48')]({'where':{'id':_0x508a49},'attributes':['id'],'include':[{'model':db[_0xb496('0x5d')],'as':_0xb496('0x68'),'attributes':['id',_0xb496('0x42'),'online',_0xb496('0x69'),_0xb496('0x6a')],'raw':!![]}]})[_0xb496('0x27')](function(_0x3b1be9){if(_0x3b1be9){var _0x4f411e=_[_0xb496('0x6b')](_0x3b1be9,function(_0x28908a){var _0x2a0423=_0x28908a[_0xb496('0x29')]({'plain':!![]});return _0x2a0423[_0xb496('0x68')];});return db['WhatsappQueue'][_0xb496('0x4e')]({'where':{'id':_0x23d168[_0xb496('0x56')]['id']}})['then'](function(_0x23d97a){return db[_0xb496('0x6c')]['transaction'](function(_0x31ca7d){return _0x23d97a[_0xb496('0x6d')](_0x508a49,{'transaction':_0x31ca7d})['then'](function(){return BPromise['each'](_0x4f411e,function(_0x5aa553){return db[_0xb496('0x5a')][_0xb496('0x6e')]({'where':{'UserId':_0x5aa553['id'],'WhatsappQueueId':_0x23d168[_0xb496('0x56')]['id']},'transaction':_0x31ca7d});});})[_0xb496('0x27')](function(){_0x4f411e[_0xb496('0x6f')](function(_0x91dfe7){socket[_0xb496('0x70')](_0xb496('0x71'),{'UserId':_0x91dfe7['id'],'WhatsappQueueId':_0x23d97a['id']});});});});});}})[_0xb496('0x27')](respondWithStatusCode(_0x2bf687,null))[_0xb496('0x4a')](handleError(_0x2bf687,null));};exports['removeTeams']=function(_0x4c6a34,_0x4f22b1,_0x1e8446){return db['Team'][_0xb496('0x48')]({'where':{'id':_0x4c6a34[_0xb496('0x35')][_0xb496('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb496('0x27')](handleEntityNotFound(_0x4f22b1,null))[_0xb496('0x27')](function(_0x424b50){var _0x34adf2=_[_0xb496('0x30')](_0x424b50,'id');var _0x2412a8=[];var _0x23a61c=[];var _0x2e70a2=squel['select']();_0x2e70a2[_0xb496('0x72')]('tq.TeamId')[_0xb496('0x73')](_0xb496('0x74'),'tq')[_0xb496('0x75')](_0xb496('0x76'),'ut',_0xb496('0x77'))[_0xb496('0x3f')]('WhatsappQueueId\x20=\x20?',_0x4c6a34[_0xb496('0x56')]['id']);for(var _0x3ababf=0x0;_0x3ababf<_0x424b50['length'];_0x3ababf+=0x1){let _0x7b59f4=_0x424b50[_0x3ababf];for(var _0x384f1b=0x0;_0x384f1b<_0x7b59f4[_0xb496('0x68')][_0xb496('0x3a')];_0x384f1b+=0x1){let _0x10c6c3=_0x7b59f4[_0xb496('0x68')][_0x384f1b];var _0x49c5d9=_0x2e70a2[_0xb496('0x78')]();_0x49c5d9[_0xb496('0x3f')]('ut.UserId\x20=\x20?',_0x10c6c3['id']);_0x23a61c[_0xb496('0x79')](db[_0xb496('0x6c')][_0xb496('0x35')](_0x49c5d9[_0xb496('0x7a')](),{'type':db[_0xb496('0x6c')]['QueryTypes']['SELECT']})[_0xb496('0x27')](function(_0x2a44f6){if(_0x2a44f6['length']===0x1){return _0x10c6c3['id'];}else{var _0x524c2d=_[_0xb496('0x7b')](_[_0xb496('0x30')](_0x2a44f6,_0xb496('0x7c')),function(_0x410c12){return _[_0xb496('0x7d')](_0x34adf2,_0x410c12);});if(_0x524c2d){return _0x10c6c3['id'];}}}));}}return BPromise['all'](_0x23a61c)['then'](function(_0x5b236b){_0x2412a8=_(_0x2412a8)[_0xb496('0x7e')](_0x5b236b)[_0xb496('0x7f')]()[_0xb496('0x80')]();return db['WhatsappQueue'][_0xb496('0x4e')]({'where':{'id':_0x4c6a34[_0xb496('0x56')]['id']}})['then'](function(_0x1552d9){return db[_0xb496('0x6c')][_0xb496('0x81')](function(_0x3ea33d){return _0x1552d9[_0xb496('0x82')](_0x4c6a34[_0xb496('0x35')][_0xb496('0x67')],{'transaction':_0x3ea33d})[_0xb496('0x27')](function(){if(!_['isEmpty'](_0x2412a8)){return _0x1552d9[_0xb496('0x83')](_0x2412a8,{'transaction':_0x3ea33d});}})['then'](function(){_0x2412a8[_0xb496('0x6f')](function(_0x1e49b1){socket[_0xb496('0x70')](_0xb496('0x84'),{'UserId':_0x1e49b1,'WhatsappQueueId':_0x1552d9['id']});});});});});});})[_0xb496('0x27')](respondWithStatusCode(_0x4f22b1,null))[_0xb496('0x4a')](handleError(_0x4f22b1,null));};exports[_0xb496('0x85')]=function(_0x1b23e4,_0x20d8f1,_0x37f05d){return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x1b23e4[_0xb496('0x56')]['id']}})[_0xb496('0x27')](handleEntityNotFound(_0x20d8f1,null))['then'](function(_0x396e9a){if(_0x396e9a){return _0x396e9a[_0xb496('0x85')](_0x1b23e4['body'][_0xb496('0x67')],_['omit'](_0x1b23e4[_0xb496('0x50')],[_0xb496('0x67'),'id'])||{})[_0xb496('0x86')](function(_0x3cd6b0){for(var _0x1e6702=0x0;_0x1e6702<_0x1b23e4[_0xb496('0x50')][_0xb496('0x67')][_0xb496('0x3a')];_0x1e6702+=0x1){socket['emit'](_0xb496('0x71'),{'UserId':Number(_0x1b23e4[_0xb496('0x50')]['ids'][_0x1e6702]),'WhatsappQueueId':Number(_0x1b23e4[_0xb496('0x56')]['id'])});}return _0x3cd6b0;});}})[_0xb496('0x27')](respondWithResult(_0x20d8f1,null))['catch'](handleError(_0x20d8f1,null));};exports[_0xb496('0x83')]=function(_0x391378,_0x21a194,_0x3190f6){return db[_0xb496('0x45')][_0xb496('0x4e')]({'where':{'id':_0x391378['params']['id']}})['then'](handleEntityNotFound(_0x21a194,null))[_0xb496('0x27')](function(_0x8f16b4){if(_0x8f16b4){return _0x8f16b4[_0xb496('0x83')](_0x391378[_0xb496('0x35')]['ids'])[_0xb496('0x27')](function(){if(_[_0xb496('0x87')](_0x391378[_0xb496('0x35')][_0xb496('0x67')])){for(var _0x2c406f=0x0;_0x2c406f<_0x391378[_0xb496('0x35')][_0xb496('0x67')][_0xb496('0x3a')];_0x2c406f+=0x1){socket[_0xb496('0x70')](_0xb496('0x84'),{'UserId':Number(_0x391378[_0xb496('0x35')][_0xb496('0x67')][_0x2c406f]),'WhatsappQueueId':Number(_0x391378[_0xb496('0x56')]['id'])});}}else{socket[_0xb496('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x391378[_0xb496('0x35')][_0xb496('0x67')]),'WhatsappQueueId':Number(_0x391378[_0xb496('0x56')]['id'])});}});}})[_0xb496('0x27')](respondWithStatusCode(_0x21a194,null))[_0xb496('0x4a')](handleError(_0x21a194,null));};exports[_0xb496('0x88')]=function(_0x45a8e3,_0x166bfd,_0x388576){var _0x206766={};var _0x46f3f2={};var _0x5d2b0e;var _0x4dceeb;return db[_0xb496('0x45')][_0xb496('0x59')]({'where':{'id':_0x45a8e3[_0xb496('0x56')]['id']}})['then'](handleEntityNotFound(_0x166bfd,null))[_0xb496('0x27')](function(_0x2428e2){if(_0x2428e2){_0x5d2b0e=_0x2428e2;_0x46f3f2['model']=_[_0xb496('0x4c')](db['User'][_0xb496('0x31')]);_0x46f3f2[_0xb496('0x35')]=_[_0xb496('0x4c')](_0x45a8e3['query']);_0x46f3f2[_0xb496('0x36')]=_[_0xb496('0x37')](_0x46f3f2[_0xb496('0x4d')],_0x46f3f2[_0xb496('0x35')]);_0x206766[_0xb496('0x38')]=_[_0xb496('0x37')](_0x46f3f2[_0xb496('0x4d')],qs['fields'](_0x45a8e3['query'][_0xb496('0x39')]));_0x206766['attributes']=_0x206766['attributes'][_0xb496('0x3a')]?_0x206766['attributes']:_0x46f3f2[_0xb496('0x4d')];_0x206766['order']=qs[_0xb496('0x3e')](_0x45a8e3[_0xb496('0x35')][_0xb496('0x3e')]);_0x206766[_0xb496('0x3f')]=qs['filters'](_[_0xb496('0x5b')](_0x45a8e3[_0xb496('0x35')],_0x46f3f2['filters']));if(_0x45a8e3[_0xb496('0x35')][_0xb496('0x43')]){_0x206766['where']=_[_0xb496('0x40')](_0x206766[_0xb496('0x3f')],{'$or':_['map'](_0x206766['attributes'],function(_0xb1b2f4){var _0x314816={};_0x314816[_0xb1b2f4]={'$like':'%'+_0x45a8e3[_0xb496('0x35')][_0xb496('0x43')]+'%'};return _0x314816;})});}_0x206766=_['merge']({},_0x206766,_0x45a8e3[_0xb496('0x44')]);return _0x5d2b0e['getAgents'](_0x206766);}})[_0xb496('0x27')](function(_0x2de2e7){if(_0x2de2e7){_0x4dceeb=_0x2de2e7[_0xb496('0x3a')];if(!_0x45a8e3['query'][_0xb496('0x3b')](_0xb496('0x3c'))){_0x206766['limit']=qs[_0xb496('0x21')](_0x45a8e3[_0xb496('0x35')]['limit']);_0x206766['offset']=qs[_0xb496('0x20')](_0x45a8e3[_0xb496('0x35')][_0xb496('0x20')]);}return _0x5d2b0e[_0xb496('0x88')](_0x206766);}})['then'](function(_0x3db63b){if(_0x3db63b){return _0x3db63b?{'count':_0x4dceeb,'rows':_0x3db63b}:null;}})['then'](respondWithResult(_0x166bfd,null))['catch'](handleError(_0x166bfd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 25295f5..7c4aff5 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 _0x2628=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x2628,0x157));var _0x8262=function(_0x2dc433,_0x3da0b7){_0x2dc433=_0x2dc433-0x0;var _0x1e5fc0=_0x2628[_0x2dc433];return _0x1e5fc0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x8262('0x0'))['db'][_0x8262('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8262('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8262('0x3'),'afterDestroy':_0x8262('0x4')};function emitEvent(_0x432517){return function(_0x5135b1,_0x241edd,_0x513b84){WhatsappQueueEvents[_0x8262('0x5')](_0x432517+':'+_0x5135b1['id'],_0x5135b1);WhatsappQueueEvents['emit'](_0x432517,_0x5135b1);_0x513b84(null);};}for(var e in events){if(events[_0x8262('0x6')](e)){var event=events[e];WhatsappQueue[_0x8262('0x7')](e,emitEvent(event));}}module[_0x8262('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6289=['emit','hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0xa1ecfd,_0x479438){var _0x598b8e=function(_0x560411){while(--_0x560411){_0xa1ecfd['push'](_0xa1ecfd['shift']());}};_0x598b8e(++_0x479438);}(_0x6289,0x12a));var _0x9628=function(_0x28f0f7,_0x5e43cb){_0x28f0f7=_0x28f0f7-0x0;var _0x14eabb=_0x6289[_0x28f0f7];return _0x14eabb;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x9628('0x0'))['db'][_0x9628('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9628('0x2')](0x0);var events={'afterCreate':_0x9628('0x3'),'afterUpdate':_0x9628('0x4'),'afterDestroy':_0x9628('0x5')};function emitEvent(_0x30c377){return function(_0x4a3fa9,_0x53437b,_0x59ebc0){WhatsappQueueEvents[_0x9628('0x6')](_0x30c377+':'+_0x4a3fa9['id'],_0x4a3fa9);WhatsappQueueEvents['emit'](_0x30c377,_0x4a3fa9);_0x59ebc0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x9628('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ece2a72..860a8eb 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 _0x03dc=['../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x5744ec,_0x4c760a){var _0x2a6b2d=function(_0x4da8f9){while(--_0x4da8f9){_0x5744ec['push'](_0x5744ec['shift']());}};_0x2a6b2d(++_0x4c760a);}(_0x03dc,0x16a));var _0xc03d=function(_0x1e59d4,_0x461eb3){_0x1e59d4=_0x1e59d4-0x0;var _0x552390=_0x03dc[_0x1e59d4];return _0x552390;};'use strict';var _=require(_0xc03d('0x0'));var util=require(_0xc03d('0x1'));var logger=require(_0xc03d('0x2'))(_0xc03d('0x3'));var moment=require('moment');var BPromise=require(_0xc03d('0x4'));var rp=require(_0xc03d('0x5'));var fs=require('fs');var path=require(_0xc03d('0x6'));var rimraf=require(_0xc03d('0x7'));var config=require('../../config/environment');var attributes=require(_0xc03d('0x8'));module[_0xc03d('0x9')]=function(_0x59f88f,_0x3aa2d2){return _0x59f88f[_0xc03d('0xa')](_0xc03d('0xb'),attributes,{'tableName':_0xc03d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa62b=['moment','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x59ab65,_0x410a52){var _0x57db9b=function(_0x19dc31){while(--_0x19dc31){_0x59ab65['push'](_0x59ab65['shift']());}};_0x57db9b(++_0x410a52);}(_0xa62b,0x1a0));var _0xba62=function(_0x51e01c,_0x2a367f){_0x51e01c=_0x51e01c-0x0;var _0x50b0eb=_0xa62b[_0x51e01c];return _0x50b0eb;};'use strict';var _=require(_0xba62('0x0'));var util=require(_0xba62('0x1'));var logger=require(_0xba62('0x2'))(_0xba62('0x3'));var moment=require(_0xba62('0x4'));var BPromise=require('bluebird');var rp=require(_0xba62('0x5'));var fs=require('fs');var path=require(_0xba62('0x6'));var rimraf=require(_0xba62('0x7'));var config=require(_0xba62('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xba62('0x9')]=function(_0x602289,_0x31f085){return _0x602289['define'](_0xba62('0xa'),attributes,{'tableName':_0xba62('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 9ded029..1316bb0 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 _0x5066=['request\x20sent','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x21fe01,_0x1f5919){var _0x5ca68f=function(_0x52928c){while(--_0x52928c){_0x21fe01['push'](_0x21fe01['shift']());}};_0x5ca68f(++_0x1f5919);}(_0x5066,0xa2));var _0x6506=function(_0x3f0aea,_0x40ea8c){_0x3f0aea=_0x3f0aea-0x0;var _0x382714=_0x5066[_0x3f0aea];return _0x382714;};'use strict';var _=require(_0x6506('0x0'));var util=require(_0x6506('0x1'));var moment=require(_0x6506('0x2'));var BPromise=require(_0x6506('0x3'));var rs=require(_0x6506('0x4'));var fs=require('fs');var Redis=require(_0x6506('0x5'));var db=require(_0x6506('0x6'))['db'];var utils=require(_0x6506('0x7'));var logger=require('../../config/logger')(_0x6506('0x8'));var config=require(_0x6506('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6506('0xa')]['http']({'port':0x232a});config[_0x6506('0xb')]=_['defaults'](config[_0x6506('0xb')],{'host':_0x6506('0xc'),'port':0x18eb});var socket=require(_0x6506('0xd'))(new Redis(config[_0x6506('0xb')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x527db5,_0x40e787,_0x30512c){return new BPromise(function(_0x11ea58,_0x1b9882){return client[_0x6506('0xe')](_0x527db5,_0x30512c)[_0x6506('0xf')](function(_0x244e67){logger[_0x6506('0x10')](_0x6506('0x11'),_0x40e787,'request\x20sent');logger[_0x6506('0x12')](_0x6506('0x13'),_0x40e787,'request\x20sent',JSON['stringify'](_0x244e67));if(_0x244e67['error']){if(_0x244e67[_0x6506('0x14')][_0x6506('0x15')]===0x1f4){logger[_0x6506('0x14')](_0x6506('0x11'),_0x40e787,_0x244e67[_0x6506('0x14')][_0x6506('0x16')]);return _0x1b9882(_0x244e67[_0x6506('0x14')]['message']);}logger[_0x6506('0x14')](_0x6506('0x11'),_0x40e787,_0x244e67[_0x6506('0x14')]['message']);return _0x11ea58(_0x244e67[_0x6506('0x14')][_0x6506('0x16')]);}else{logger[_0x6506('0x10')](_0x6506('0x11'),_0x40e787,_0x6506('0x17'));_0x11ea58(_0x244e67['result'][_0x6506('0x16')]);}})['catch'](function(_0x20c154){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x40e787,_0x20c154);_0x1b9882(_0x20c154);});});}exports[_0x6506('0x18')]=function(_0x1e83d0){var _0x189206=this;return new Promise(function(_0x47b294,_0x4e6887){return db[_0x6506('0x19')]['findAll']({'raw':_0x1e83d0[_0x6506('0x1a')]?_0x1e83d0[_0x6506('0x1a')][_0x6506('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e83d0[_0x6506('0x1a')]?_0x1e83d0[_0x6506('0x1a')][_0x6506('0x1c')]||null:null,'attributes':_0x1e83d0[_0x6506('0x1a')]?_0x1e83d0[_0x6506('0x1a')]['attributes']||null:null,'limit':_0x1e83d0['options']?_0x1e83d0[_0x6506('0x1a')][_0x6506('0x1d')]||null:null,'include':_0x1e83d0[_0x6506('0x1a')]?_0x1e83d0['options'][_0x6506('0x1e')]?_[_0x6506('0x1f')](_0x1e83d0[_0x6506('0x1a')][_0x6506('0x1e')],function(_0x36fb66){return{'model':db[_0x36fb66[_0x6506('0x20')]],'as':_0x36fb66['as'],'attributes':_0x36fb66['attributes'],'include':_0x36fb66['include']?_[_0x6506('0x1f')](_0x36fb66[_0x6506('0x1e')],function(_0x22dcca){return{'model':db[_0x22dcca['model']],'as':_0x22dcca['as'],'attributes':_0x22dcca[_0x6506('0x21')],'include':_0x22dcca[_0x6506('0x1e')]?_['map'](_0x22dcca[_0x6506('0x1e')],function(_0x21af77){return{'model':db[_0x21af77[_0x6506('0x20')]],'as':_0x21af77['as'],'attributes':_0x21af77[_0x6506('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6506('0xf')](function(_0x4654b1){logger[_0x6506('0x10')](_0x6506('0x18'),_0x1e83d0);logger[_0x6506('0x12')](_0x6506('0x18'),_0x1e83d0,JSON[_0x6506('0x22')](_0x4654b1));_0x47b294(_0x4654b1);})[_0x6506('0x23')](function(_0xd42ec0){logger[_0x6506('0x14')](_0x6506('0x18'),_0xd42ec0[_0x6506('0x16')],_0x1e83d0);_0x4e6887(_0x189206[_0x6506('0x14')](0x1f4,_0xd42ec0[_0x6506('0x16')]));});});};exports[_0x6506('0x24')]=function(_0x4b0e68){var _0x3ab2d0=this;return new Promise(function(_0x209b5b,_0x3538cf){return db['WhatsappQueue']['find']({'raw':_0x4b0e68[_0x6506('0x1a')]?_0x4b0e68[_0x6506('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b0e68[_0x6506('0x1a')]?_0x4b0e68[_0x6506('0x1a')][_0x6506('0x1c')]||null:null,'attributes':_0x4b0e68[_0x6506('0x1a')]?_0x4b0e68[_0x6506('0x1a')][_0x6506('0x21')]||null:null,'include':_0x4b0e68[_0x6506('0x1a')]?_0x4b0e68[_0x6506('0x1a')]['include']?_['map'](_0x4b0e68[_0x6506('0x1a')][_0x6506('0x1e')],function(_0x3473eb){return{'model':db[_0x3473eb['model']],'as':_0x3473eb['as'],'attributes':_0x3473eb[_0x6506('0x21')],'include':_0x3473eb[_0x6506('0x1e')]?_[_0x6506('0x1f')](_0x3473eb[_0x6506('0x1e')],function(_0x9ade97){return{'model':db[_0x9ade97[_0x6506('0x20')]],'as':_0x9ade97['as'],'attributes':_0x9ade97[_0x6506('0x21')],'include':_0x9ade97[_0x6506('0x1e')]?_[_0x6506('0x1f')](_0x9ade97['include'],function(_0x30d4ef){return{'model':db[_0x30d4ef[_0x6506('0x20')]],'as':_0x30d4ef['as'],'attributes':_0x30d4ef[_0x6506('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43720e){logger[_0x6506('0x10')](_0x6506('0x24'),_0x4b0e68);logger['debug'](_0x6506('0x24'),_0x4b0e68,JSON[_0x6506('0x22')](_0x43720e));_0x209b5b(_0x43720e);})[_0x6506('0x23')](function(_0x42a792){logger[_0x6506('0x14')]('ShowWhatsappQueue',_0x42a792[_0x6506('0x16')],_0x4b0e68);_0x3538cf(_0x3ab2d0[_0x6506('0x14')](0x1f4,_0x42a792[_0x6506('0x16')]));});});}; \ No newline at end of file +var _0x9c01=['../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','attributes','model','then','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0x9c01,0xc7));var _0x19c0=function(_0x5cf083,_0x38b4fa){_0x5cf083=_0x5cf083-0x0;var _0x49d437=_0x9c01[_0x5cf083];return _0x49d437;};'use strict';var _=require(_0x19c0('0x0'));var util=require(_0x19c0('0x1'));var moment=require(_0x19c0('0x2'));var BPromise=require(_0x19c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19c0('0x4'));var db=require(_0x19c0('0x5'))['db'];var utils=require(_0x19c0('0x6'));var logger=require('../../config/logger')(_0x19c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x19c0('0x8'));var client=jayson[_0x19c0('0x9')][_0x19c0('0xa')]({'port':0x232a});config[_0x19c0('0xb')]=_[_0x19c0('0xc')](config[_0x19c0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x19c0('0xd'))(new Redis(config[_0x19c0('0xb')]));require(_0x19c0('0xe'))[_0x19c0('0xf')](socket);function respondWithRpcPromise(_0x1c0615,_0x3df62d,_0x425c6a){return new BPromise(function(_0x4ffeac,_0x3df2e8){return client[_0x19c0('0x10')](_0x1c0615,_0x425c6a)['then'](function(_0x3d1adc){logger[_0x19c0('0x11')](_0x19c0('0x12'),_0x3df62d,_0x19c0('0x13'));logger[_0x19c0('0x14')](_0x19c0('0x15'),_0x3df62d,'request\x20sent',JSON[_0x19c0('0x16')](_0x3d1adc));if(_0x3d1adc[_0x19c0('0x17')]){if(_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x18')]===0x1f4){logger[_0x19c0('0x17')](_0x19c0('0x12'),_0x3df62d,_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x19')]);return _0x3df2e8(_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x19')]);}logger['error'](_0x19c0('0x12'),_0x3df62d,_0x3d1adc[_0x19c0('0x17')][_0x19c0('0x19')]);return _0x4ffeac(_0x3d1adc['error'][_0x19c0('0x19')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x3df62d,_0x19c0('0x13'));_0x4ffeac(_0x3d1adc[_0x19c0('0x1a')][_0x19c0('0x19')]);}})[_0x19c0('0x1b')](function(_0x728c5){logger[_0x19c0('0x17')](_0x19c0('0x12'),_0x3df62d,_0x728c5);_0x3df2e8(_0x728c5);});});}exports[_0x19c0('0x1c')]=function(_0x39b709){var _0x298ebd=this;return new Promise(function(_0x4d31ef,_0x4ab6a5){return db[_0x19c0('0x1d')][_0x19c0('0x1e')]({'raw':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')][_0x19c0('0x20')]===undefined?!![]:![]:!![],'where':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')][_0x19c0('0x21')]||null:null,'attributes':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')]['attributes']||null:null,'limit':_0x39b709[_0x19c0('0x1f')]?_0x39b709[_0x19c0('0x1f')][_0x19c0('0x22')]||null:null,'include':_0x39b709['options']?_0x39b709['options'][_0x19c0('0x23')]?_[_0x19c0('0x24')](_0x39b709[_0x19c0('0x1f')][_0x19c0('0x23')],function(_0x50c438){return{'model':db[_0x50c438['model']],'as':_0x50c438['as'],'attributes':_0x50c438[_0x19c0('0x25')],'include':_0x50c438['include']?_[_0x19c0('0x24')](_0x50c438[_0x19c0('0x23')],function(_0x472823){return{'model':db[_0x472823['model']],'as':_0x472823['as'],'attributes':_0x472823[_0x19c0('0x25')],'include':_0x472823[_0x19c0('0x23')]?_['map'](_0x472823[_0x19c0('0x23')],function(_0x3b4817){return{'model':db[_0x3b4817[_0x19c0('0x26')]],'as':_0x3b4817['as'],'attributes':_0x3b4817[_0x19c0('0x25')]};}):[]};}):[]};}):[]:[]})[_0x19c0('0x27')](function(_0x2c2ba8){logger[_0x19c0('0x11')](_0x19c0('0x1c'),_0x39b709);logger[_0x19c0('0x14')](_0x19c0('0x1c'),_0x39b709,JSON[_0x19c0('0x16')](_0x2c2ba8));_0x4d31ef(_0x2c2ba8);})['catch'](function(_0x1462a6){logger[_0x19c0('0x17')](_0x19c0('0x1c'),_0x1462a6[_0x19c0('0x19')],_0x39b709);_0x4ab6a5(_0x298ebd['error'](0x1f4,_0x1462a6[_0x19c0('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x3a2a71){var _0x22fdf9=this;return new Promise(function(_0x11c3de,_0x41f237){return db[_0x19c0('0x1d')]['find']({'raw':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71[_0x19c0('0x1f')][_0x19c0('0x20')]===undefined?!![]:![]:!![],'where':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71[_0x19c0('0x1f')][_0x19c0('0x21')]||null:null,'attributes':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71['options']['attributes']||null:null,'include':_0x3a2a71[_0x19c0('0x1f')]?_0x3a2a71['options'][_0x19c0('0x23')]?_[_0x19c0('0x24')](_0x3a2a71[_0x19c0('0x1f')][_0x19c0('0x23')],function(_0x44228e){return{'model':db[_0x44228e[_0x19c0('0x26')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e['include']?_['map'](_0x44228e[_0x19c0('0x23')],function(_0x415148){return{'model':db[_0x415148[_0x19c0('0x26')]],'as':_0x415148['as'],'attributes':_0x415148['attributes'],'include':_0x415148[_0x19c0('0x23')]?_[_0x19c0('0x24')](_0x415148[_0x19c0('0x23')],function(_0x43621c){return{'model':db[_0x43621c[_0x19c0('0x26')]],'as':_0x43621c['as'],'attributes':_0x43621c[_0x19c0('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27b47d){logger[_0x19c0('0x11')]('ShowWhatsappQueue',_0x3a2a71);logger[_0x19c0('0x14')](_0x19c0('0x28'),_0x3a2a71,JSON[_0x19c0('0x16')](_0x27b47d));_0x11c3de(_0x27b47d);})[_0x19c0('0x1b')](function(_0x120383){logger[_0x19c0('0x17')](_0x19c0('0x28'),_0x120383[_0x19c0('0x19')],_0x3a2a71);_0x41f237(_0x22fdf9[_0x19c0('0x17')](0x1f4,_0x120383[_0x19c0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4c2ce96..2599356 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 _0x2700=['save','remove','update','emit','removeListener','length','./whatsappQueue.events'];(function(_0x39708e,_0x293e56){var _0x743499=function(_0x398433){while(--_0x398433){_0x39708e['push'](_0x39708e['shift']());}};_0x743499(++_0x293e56);}(_0x2700,0xa7));var _0x0270=function(_0x5d96ec,_0x39248f){_0x5d96ec=_0x5d96ec-0x0;var _0x350f30=_0x2700[_0x5d96ec];return _0x350f30;};'use strict';var WhatsappQueueEvents=require(_0x0270('0x0'));var events=[_0x0270('0x1'),_0x0270('0x2'),_0x0270('0x3')];function createListener(_0x56c255,_0x5cccb3){return function(_0x269ea8){_0x5cccb3[_0x0270('0x4')](_0x56c255,_0x269ea8);};}function removeListener(_0x1f2b9e,_0x2191ec){return function(){WhatsappQueueEvents[_0x0270('0x5')](_0x1f2b9e,_0x2191ec);};}exports['register']=function(_0x4a481b){for(var _0x524f6b=0x0,_0x47078d=events[_0x0270('0x6')];_0x524f6b<_0x47078d;_0x524f6b++){var _0x1e7bb9=events[_0x524f6b];var _0x18458f=createListener('whatsappQueue:'+_0x1e7bb9,_0x4a481b);WhatsappQueueEvents['on'](_0x1e7bb9,_0x18458f);}}; \ No newline at end of file +var _0x930c=['./whatsappQueue.events','save','remove','update','removeListener','register','whatsappQueue:'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x930c,0x12d));var _0xc930=function(_0xc53417,_0x17ec83){_0xc53417=_0xc53417-0x0;var _0x4fc437=_0x930c[_0xc53417];return _0x4fc437;};'use strict';var WhatsappQueueEvents=require(_0xc930('0x0'));var events=[_0xc930('0x1'),_0xc930('0x2'),_0xc930('0x3')];function createListener(_0x57e2d3,_0x27d2f9){return function(_0x32398f){_0x27d2f9['emit'](_0x57e2d3,_0x32398f);};}function removeListener(_0x166441,_0x95fa39){return function(){WhatsappQueueEvents[_0xc930('0x4')](_0x166441,_0x95fa39);};}exports[_0xc930('0x5')]=function(_0x2fb045){for(var _0x43a02d=0x0,_0x52c030=events['length'];_0x43a02d<_0x52c030;_0x43a02d++){var _0x1f4dc6=events[_0x43a02d];var _0xd44086=createListener(_0xc930('0x6')+_0x1f4dc6,_0x2fb045);WhatsappQueueEvents['on'](_0x1f4dc6,_0xd44086);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index cfddc27..b34bace 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 _0xba1a=['isAuthenticated','describe','show','post','create','put','update','delete','/:id','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x5cd376,_0x163789){var _0x57de74=function(_0x3e56c9){while(--_0x3e56c9){_0x5cd376['push'](_0x5cd376['shift']());}};_0x57de74(++_0x163789);}(_0xba1a,0xc7));var _0xaba1=function(_0x4872ad,_0x5c8968){_0x4872ad=_0x4872ad-0x0;var _0x3ef263=_0xba1a[_0x4872ad];return _0x3ef263;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaba1('0x0'));var timeout=require(_0xaba1('0x1'));var express=require(_0xaba1('0x2'));var router=express[_0xaba1('0x3')]();var fs_extra=require(_0xaba1('0x4'));var auth=require(_0xaba1('0x5'));var interaction=require(_0xaba1('0x6'));var config=require(_0xaba1('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0xaba1('0x8')]('/',auth['isAuthenticated'](),controller[_0xaba1('0x9')]);router['get'](_0xaba1('0xa'),auth[_0xaba1('0xb')](),controller[_0xaba1('0xc')]);router['get']('/:id',auth[_0xaba1('0xb')](),controller[_0xaba1('0xd')]);router[_0xaba1('0xe')]('/',auth[_0xaba1('0xb')](),controller[_0xaba1('0xf')]);router[_0xaba1('0x10')]('/:id',auth[_0xaba1('0xb')](),controller[_0xaba1('0x11')]);router[_0xaba1('0x12')](_0xaba1('0x13'),auth[_0xaba1('0xb')](),controller['destroy']);module[_0xaba1('0x14')]=router; \ No newline at end of file +var _0xcd88=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','/describe','isAuthenticated','/:id','show','put','delete'];(function(_0xaa7af2,_0x289bf0){var _0xbf48e3=function(_0x477729){while(--_0x477729){_0xaa7af2['push'](_0xaa7af2['shift']());}};_0xbf48e3(++_0x289bf0);}(_0xcd88,0x1ee));var _0x8cd8=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xcd88[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var path=require(_0x8cd8('0x2'));var timeout=require(_0x8cd8('0x3'));var express=require(_0x8cd8('0x4'));var router=express[_0x8cd8('0x5')]();var fs_extra=require(_0x8cd8('0x6'));var auth=require(_0x8cd8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8cd8('0x8'));router[_0x8cd8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8cd8('0xa'),auth[_0x8cd8('0xb')](),controller['describe']);router['get'](_0x8cd8('0xc'),auth['isAuthenticated'](),controller[_0x8cd8('0xd')]);router['post']('/',auth[_0x8cd8('0xb')](),controller['create']);router[_0x8cd8('0xe')]('/:id',auth[_0x8cd8('0xb')](),controller['update']);router[_0x8cd8('0xf')](_0x8cd8('0xc'),auth[_0x8cd8('0xb')](),controller[_0x8cd8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f37a0fa..e07b9bd 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x30f8ed,_0x1309da){var _0x43bee0=function(_0x5795bb){while(--_0x5795bb){_0x30f8ed['push'](_0x30f8ed['shift']());}};_0x43bee0(++_0x1309da);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x205add,_0x326491){var _0x133063=function(_0x286a1b){while(--_0x286a1b){_0x205add['push'](_0x205add['shift']());}};_0x133063(++_0x326491);}(_0x7a54,0x106));var _0x47a5=function(_0x265618,_0x1022f0){_0x265618=_0x265618-0x0;var _0x430ef2=_0x7a54[_0x265618];return _0x430ef2;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c705e89..e37d0e6 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 _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0x3328bd,_0x34b6cc){var _0xf2012a=function(_0x35a4e5){while(--_0x35a4e5){_0x3328bd['push'](_0x3328bd['shift']());}};_0xf2012a(++_0x34b6cc);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x480a3f,_0x1485f5){_0x480a3f=_0x480a3f-0x0;var _0x1a931d=_0xe1e3[_0x480a3f];return _0x1a931d;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));}; \ No newline at end of file +var _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x49bb70,_0x81f90e){var _0x3b0d52=function(_0x3b5ddc){while(--_0x3b5ddc){_0x49bb70['push'](_0x49bb70['shift']());}};_0x3b0d52(++_0x81f90e);}(_0xa902,0x8d));var _0x2a90=function(_0x1630b3,_0x56559d){_0x1630b3=_0x1630b3-0x0;var _0x4acaa3=_0xa902[_0x1630b3];return _0x4acaa3;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 96dde18..cef62aa 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 _0x9404=['report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9404,0x12e));var _0x4940=function(_0x345d12,_0x19e0e2){_0x345d12=_0x345d12-0x0;var _0x11d218=_0x9404[_0x345d12];return _0x11d218;};'use strict';var _=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var logger=require(_0x4940('0x2'))(_0x4940('0x3'));var moment=require(_0x4940('0x4'));var BPromise=require(_0x4940('0x5'));var rp=require(_0x4940('0x6'));var fs=require('fs');var path=require(_0x4940('0x7'));var rimraf=require(_0x4940('0x8'));var config=require(_0x4940('0x9'));var attributes=require(_0x4940('0xa'));module['exports']=function(_0xfed716,_0x577cdc){return _0xfed716[_0x4940('0xb')](_0x4940('0xc'),attributes,{'tableName':_0x4940('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4940('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3245=['bluebird','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api'];(function(_0x42b990,_0x3aae6d){var _0x36c73a=function(_0x402886){while(--_0x402886){_0x42b990['push'](_0x42b990['shift']());}};_0x36c73a(++_0x3aae6d);}(_0x3245,0xbd));var _0x5324=function(_0x39929e,_0x5b9d76){_0x39929e=_0x39929e-0x0;var _0x2ced4b=_0x3245[_0x39929e];return _0x2ced4b;};'use strict';var _=require(_0x5324('0x0'));var util=require(_0x5324('0x1'));var logger=require('../../config/logger')(_0x5324('0x2'));var moment=require('moment');var BPromise=require(_0x5324('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5324('0x4'));var rimraf=require(_0x5324('0x5'));var config=require(_0x5324('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x5324('0x7')]=function(_0x16f4a8,_0x467132){return _0x16f4a8[_0x5324('0x8')](_0x5324('0x9'),attributes,{'tableName':_0x5324('0xa'),'paranoid':![],'indexes':[{'name':_0x5324('0xb'),'fields':[_0x5324('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 3be545c..e1240e3 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 _0xd379=['UpdateWhatsappQueueReport','WhatsappQueueReport','update','body','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateWhatsappQueueReport','create','options','raw','stringify','catch'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0xd379,0xab));var _0x9d37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd379[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d37('0x0'));var util=require(_0x9d37('0x1'));var moment=require(_0x9d37('0x2'));var BPromise=require(_0x9d37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d37('0x4'));var db=require(_0x9d37('0x5'))['db'];var utils=require(_0x9d37('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9d37('0x7'));var jayson=require(_0x9d37('0x8'));var client=jayson['client'][_0x9d37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf0b064,_0x539b1c,_0x278bb5){return new BPromise(function(_0x1b835f,_0x25d2a0){return client[_0x9d37('0xa')](_0xf0b064,_0x278bb5)[_0x9d37('0xb')](function(_0x438bc7){logger[_0x9d37('0xc')](_0x9d37('0xd'),_0x539b1c,_0x9d37('0xe'));logger[_0x9d37('0xf')](_0x9d37('0x10'),_0x539b1c,_0x9d37('0xe'),JSON['stringify'](_0x438bc7));if(_0x438bc7[_0x9d37('0x11')]){if(_0x438bc7[_0x9d37('0x11')][_0x9d37('0x12')]===0x1f4){logger[_0x9d37('0x11')](_0x9d37('0xd'),_0x539b1c,_0x438bc7[_0x9d37('0x11')][_0x9d37('0x13')]);return _0x25d2a0(_0x438bc7[_0x9d37('0x11')][_0x9d37('0x13')]);}logger[_0x9d37('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x539b1c,_0x438bc7[_0x9d37('0x11')][_0x9d37('0x13')]);return _0x1b835f(_0x438bc7[_0x9d37('0x11')][_0x9d37('0x13')]);}else{logger['info'](_0x9d37('0xd'),_0x539b1c,_0x9d37('0xe'));_0x1b835f(_0x438bc7[_0x9d37('0x14')][_0x9d37('0x13')]);}})['catch'](function(_0x580131){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x539b1c,_0x580131);_0x25d2a0(_0x580131);});});}exports[_0x9d37('0x15')]=function(_0xf2e94b){var _0x8166cd=this;return new Promise(function(_0x28a18d,_0x3427a7){return db['WhatsappQueueReport'][_0x9d37('0x16')](_0xf2e94b['body'],{'raw':_0xf2e94b[_0x9d37('0x17')]?_0xf2e94b[_0x9d37('0x17')][_0x9d37('0x18')]===undefined?!![]:![]:!![]})[_0x9d37('0xb')](function(_0x4783d6){logger['info'](_0x9d37('0x15'),_0xf2e94b);logger[_0x9d37('0xf')]('CreateWhatsappQueueReport',_0xf2e94b,JSON[_0x9d37('0x19')](_0x4783d6));_0x28a18d(_0x4783d6);})[_0x9d37('0x1a')](function(_0xece4a){logger[_0x9d37('0x11')](_0x9d37('0x15'),_0xece4a[_0x9d37('0x13')],_0xf2e94b);_0x3427a7(_0x8166cd['error'](0x1f4,_0xece4a[_0x9d37('0x13')]));});});};exports[_0x9d37('0x1b')]=function(_0x256c1f){var _0x13db2e=this;return new Promise(function(_0x54afce,_0x36b359){return db[_0x9d37('0x1c')][_0x9d37('0x1d')](_0x256c1f[_0x9d37('0x1e')],{'raw':_0x256c1f[_0x9d37('0x17')]?_0x256c1f[_0x9d37('0x17')][_0x9d37('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x256c1f[_0x9d37('0x17')]?_0x256c1f[_0x9d37('0x17')][_0x9d37('0x1f')]||null:null,'attributes':_0x256c1f[_0x9d37('0x17')]?_0x256c1f[_0x9d37('0x17')]['attributes']||null:null,'limit':_0x256c1f[_0x9d37('0x17')]?_0x256c1f[_0x9d37('0x17')][_0x9d37('0x20')]||null:null})[_0x9d37('0xb')](function(_0x2debed){logger[_0x9d37('0xc')](_0x9d37('0x1b'),_0x256c1f);logger[_0x9d37('0xf')]('UpdateWhatsappQueueReport',_0x256c1f,JSON['stringify'](_0x2debed));_0x54afce(_0x2debed);})[_0x9d37('0x1a')](function(_0x3d143f){logger[_0x9d37('0x11')](_0x9d37('0x1b'),_0x3d143f[_0x9d37('0x13')],_0x256c1f);_0x36b359(_0x13db2e[_0x9d37('0x11')](0x1f4,_0x3d143f[_0x9d37('0x13')]));});});}; \ No newline at end of file +var _0x37bc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','body','where','limit','UpdateWhatsappQueueReport'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0x37bc,0xf5));var _0xc37b=function(_0x3e225a,_0x41d9aa){_0x3e225a=_0x3e225a-0x0;var _0x1fe38f=_0x37bc[_0x3e225a];return _0x1fe38f;};'use strict';var _=require(_0xc37b('0x0'));var util=require(_0xc37b('0x1'));var moment=require(_0xc37b('0x2'));var BPromise=require(_0xc37b('0x3'));var rs=require(_0xc37b('0x4'));var fs=require('fs');var Redis=require(_0xc37b('0x5'));var db=require(_0xc37b('0x6'))['db'];var utils=require(_0xc37b('0x7'));var logger=require(_0xc37b('0x8'))(_0xc37b('0x9'));var config=require(_0xc37b('0xa'));var jayson=require(_0xc37b('0xb'));var client=jayson[_0xc37b('0xc')][_0xc37b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x174529,_0x5157e4,_0x51f2d6){return new BPromise(function(_0x319732,_0x43ea90){return client[_0xc37b('0xe')](_0x174529,_0x51f2d6)[_0xc37b('0xf')](function(_0x1065f9){logger[_0xc37b('0x10')](_0xc37b('0x11'),_0x5157e4,_0xc37b('0x12'));logger[_0xc37b('0x13')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5157e4,_0xc37b('0x12'),JSON[_0xc37b('0x14')](_0x1065f9));if(_0x1065f9[_0xc37b('0x15')]){if(_0x1065f9[_0xc37b('0x15')][_0xc37b('0x16')]===0x1f4){logger[_0xc37b('0x15')](_0xc37b('0x11'),_0x5157e4,_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);return _0x43ea90(_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);}logger[_0xc37b('0x15')](_0xc37b('0x11'),_0x5157e4,_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);return _0x319732(_0x1065f9[_0xc37b('0x15')][_0xc37b('0x17')]);}else{logger[_0xc37b('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5157e4,_0xc37b('0x12'));_0x319732(_0x1065f9[_0xc37b('0x18')][_0xc37b('0x17')]);}})[_0xc37b('0x19')](function(_0x549823){logger[_0xc37b('0x15')](_0xc37b('0x11'),_0x5157e4,_0x549823);_0x43ea90(_0x549823);});});}exports[_0xc37b('0x1a')]=function(_0x3a3945){var _0x31fb11=this;return new Promise(function(_0x316956,_0x485669){return db[_0xc37b('0x1b')][_0xc37b('0x1c')](_0x3a3945['body'],{'raw':_0x3a3945[_0xc37b('0x1d')]?_0x3a3945[_0xc37b('0x1d')][_0xc37b('0x1e')]===undefined?!![]:![]:!![]})[_0xc37b('0xf')](function(_0x53bb27){logger[_0xc37b('0x10')](_0xc37b('0x1a'),_0x3a3945);logger['debug']('CreateWhatsappQueueReport',_0x3a3945,JSON[_0xc37b('0x14')](_0x53bb27));_0x316956(_0x53bb27);})[_0xc37b('0x19')](function(_0xecbbc6){logger[_0xc37b('0x15')](_0xc37b('0x1a'),_0xecbbc6[_0xc37b('0x17')],_0x3a3945);_0x485669(_0x31fb11[_0xc37b('0x15')](0x1f4,_0xecbbc6[_0xc37b('0x17')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x30e035){var _0x2812f8=this;return new Promise(function(_0xe5d04c,_0x1db6d6){return db[_0xc37b('0x1b')]['update'](_0x30e035[_0xc37b('0x1f')],{'raw':_0x30e035[_0xc37b('0x1d')]?_0x30e035['options'][_0xc37b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e035['options']?_0x30e035[_0xc37b('0x1d')][_0xc37b('0x20')]||null:null,'attributes':_0x30e035[_0xc37b('0x1d')]?_0x30e035['options']['attributes']||null:null,'limit':_0x30e035[_0xc37b('0x1d')]?_0x30e035['options'][_0xc37b('0x21')]||null:null})[_0xc37b('0xf')](function(_0x2eee68){logger['info'](_0xc37b('0x22'),_0x30e035);logger[_0xc37b('0x13')](_0xc37b('0x22'),_0x30e035,JSON[_0xc37b('0x14')](_0x2eee68));_0xe5d04c(_0x2eee68);})[_0xc37b('0x19')](function(_0x3c30b4){logger[_0xc37b('0x15')](_0xc37b('0x22'),_0x3c30b4[_0xc37b('0x17')],_0x30e035);_0x1db6d6(_0x2812f8[_0xc37b('0x15')](0x1f4,_0x3c30b4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index dd87cd1..4a76fd4 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 _0xfc52=['destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','post','create','update','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfc52,0x199));var _0x2fc5=function(_0x2f6c38,_0x4b067a){_0x2f6c38=_0x2f6c38-0x0;var _0x66279f=_0xfc52[_0x2f6c38];return _0x66279f;};'use strict';var multer=require(_0x2fc5('0x0'));var util=require('util');var path=require(_0x2fc5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fc5('0x2')]();var fs_extra=require(_0x2fc5('0x3'));var auth=require(_0x2fc5('0x4'));var interaction=require(_0x2fc5('0x5'));var config=require(_0x2fc5('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x2fc5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2fc5('0x8'),auth[_0x2fc5('0x9')](),controller[_0x2fc5('0xa')]);router[_0x2fc5('0x7')]('/:id',auth[_0x2fc5('0x9')](),controller[_0x2fc5('0xb')]);router[_0x2fc5('0xc')]('/',auth[_0x2fc5('0x9')](),controller[_0x2fc5('0xd')]);router['put']('/:id',auth[_0x2fc5('0x9')](),controller[_0x2fc5('0xe')]);router['delete'](_0x2fc5('0xf'),auth[_0x2fc5('0x9')](),controller[_0x2fc5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xadef=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1717d7,_0x560994){var _0x3b3a98=function(_0x421a65){while(--_0x421a65){_0x1717d7['push'](_0x1717d7['shift']());}};_0x3b3a98(++_0x560994);}(_0xadef,0x1ed));var _0xfade=function(_0x107726,_0x4874bb){_0x107726=_0x107726-0x0;var _0x101b71=_0xadef[_0x107726];return _0x101b71;};'use strict';var multer=require(_0xfade('0x0'));var util=require(_0xfade('0x1'));var path=require('path');var timeout=require(_0xfade('0x2'));var express=require(_0xfade('0x3'));var router=express[_0xfade('0x4')]();var fs_extra=require(_0xfade('0x5'));var auth=require(_0xfade('0x6'));var interaction=require(_0xfade('0x7'));var config=require(_0xfade('0x8'));var controller=require(_0xfade('0x9'));router[_0xfade('0xa')]('/',auth[_0xfade('0xb')](),controller[_0xfade('0xc')]);router[_0xfade('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xfade('0xd')]);router['get'](_0xfade('0xe'),auth[_0xfade('0xb')](),controller[_0xfade('0xf')]);router[_0xfade('0x10')]('/',auth[_0xfade('0xb')](),controller[_0xfade('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfade('0x12')](_0xfade('0xe'),auth[_0xfade('0xb')](),controller['destroy']);module[_0xfade('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 39246cb..a18a74e 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 _0x7916=['queue','DATE','sequelize','STRING','ENUM','agent'];(function(_0x351e57,_0x6f6f4b){var _0x3698a5=function(_0x39ca2b){while(--_0x39ca2b){_0x351e57['push'](_0x351e57['shift']());}};_0x3698a5(++_0x6f6f4b);}(_0x7916,0x128));var _0x6791=function(_0x15892d,_0x4ca74b){_0x15892d=_0x15892d-0x0;var _0x486efc=_0x7916[_0x15892d];return _0x486efc;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6791('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6791('0x2')]('account',_0x6791('0x3'),_0x6791('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6791('0x5')]}}; \ No newline at end of file +var _0xdef9=['ENUM','account','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x3aa758,_0x98c545){var _0x1a43df=function(_0x2b6b7d){while(--_0x2b6b7d){_0x3aa758['push'](_0x3aa758['shift']());}};_0x1a43df(++_0x98c545);}(_0xdef9,0x1ed));var _0x9def=function(_0x1f5236,_0xea7afc){_0x1f5236=_0x1f5236-0x0;var _0x2efe18=_0xdef9[_0x1f5236];return _0x2efe18;};'use strict';var Sequelize=require(_0x9def('0x0'));module[_0x9def('0x1')]={'uniqueid':{'type':Sequelize[_0x9def('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9def('0x3')](_0x9def('0x4'),_0x9def('0x5'),_0x9def('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x9def('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 467972c..fbdcae4 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 _0x5df3=['bluebird','mustache','sox','to-csv','ejs','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','name','index','map','WhatsappTransferReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','rows','catch','show','params','rawAttributes','options','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x5df3,0x15f));var _0x35df=function(_0x3ba537,_0x56b969){_0x3ba537=_0x3ba537-0x0;var _0x585c1a=_0x5df3[_0x3ba537];return _0x585c1a;};'use strict';var emlformat=require(_0x35df('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x35df('0x1'));var rp=require(_0x35df('0x2'));var moment=require(_0x35df('0x3'));var BPromise=require(_0x35df('0x4'));var Mustache=require(_0x35df('0x5'));var util=require('util');var path=require('path');var sox=require(_0x35df('0x6'));var csv=require(_0x35df('0x7'));var ejs=require(_0x35df('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35df('0x9'));var squel=require(_0x35df('0xa'));var crypto=require(_0x35df('0xb'));var jsforce=require(_0x35df('0xc'));var deskjs=require(_0x35df('0xd'));var toCsv=require(_0x35df('0x7'));var querystring=require(_0x35df('0xe'));var Papa=require(_0x35df('0xf'));var Redis=require(_0x35df('0x10'));var authService=require(_0x35df('0x11'));var qs=require(_0x35df('0x12'));var as=require(_0x35df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35df('0x14'))(_0x35df('0x15'));var utils=require(_0x35df('0x16'));var config=require(_0x35df('0x17'));var licenseUtil=require(_0x35df('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27dfa0,_0x2f7f22){_0x2f7f22=_0x2f7f22||0xcc;return function(_0x3c8a00){if(_0x3c8a00){return _0x27dfa0[_0x35df('0x19')](_0x2f7f22);}return _0x27dfa0[_0x35df('0x1a')](_0x2f7f22)[_0x35df('0x1b')]();};}function respondWithResult(_0x18de4c,_0x1c35ae){_0x1c35ae=_0x1c35ae||0xc8;return function(_0x566c11){if(_0x566c11){return _0x18de4c[_0x35df('0x1a')](_0x1c35ae)[_0x35df('0x1c')](_0x566c11);}};}function respondWithFilteredResult(_0x1ec0f9,_0x27a35d){return function(_0x50e9c1){if(_0x50e9c1){var _0x5228db=typeof _0x27a35d[_0x35df('0x1d')]===_0x35df('0x1e')&&typeof _0x27a35d[_0x35df('0x1f')]===_0x35df('0x1e');var _0x447291=_0x50e9c1[_0x35df('0x20')];var _0x40d61c=_0x5228db?0x0:_0x27a35d[_0x35df('0x1d')];var _0x20c4ab=_0x5228db?_0x50e9c1[_0x35df('0x20')]:_0x27a35d[_0x35df('0x1d')]+_0x27a35d[_0x35df('0x1f')];var _0x83c854;if(_0x20c4ab>=_0x447291){_0x20c4ab=_0x447291;_0x83c854=0xc8;}else{_0x83c854=0xce;}_0x1ec0f9['status'](_0x83c854);return _0x1ec0f9[_0x35df('0x21')]('Content-Range',_0x40d61c+'-'+_0x20c4ab+'/'+_0x447291)['json'](_0x50e9c1);}return null;};}function patchUpdates(_0x3d7c4c){return function(_0x5000cb){try{jsonpatch['apply'](_0x5000cb,_0x3d7c4c,!![]);}catch(_0x3a3a65){return BPromise[_0x35df('0x22')](_0x3a3a65);}return _0x5000cb[_0x35df('0x23')]();};}function saveUpdates(_0x3168b9,_0x47b575){return function(_0x6c0ab0){if(_0x6c0ab0){return _0x6c0ab0[_0x35df('0x24')](_0x3168b9)['then'](function(_0x3fac47){return _0x3fac47;});}return null;};}function removeEntity(_0x11425b,_0x36455a){return function(_0x1546cb){if(_0x1546cb){return _0x1546cb[_0x35df('0x25')]()[_0x35df('0x26')](function(){_0x11425b[_0x35df('0x1a')](0xcc)[_0x35df('0x1b')]();});}};}function handleEntityNotFound(_0x44166b,_0x24f173){return function(_0x15a8fd){if(!_0x15a8fd){_0x44166b[_0x35df('0x19')](0x194);}return _0x15a8fd;};}function handleError(_0xdb353c,_0x3875ae){_0x3875ae=_0x3875ae||0x1f4;return function(_0x7f9fe3){logger[_0x35df('0x27')](_0x7f9fe3['stack']);if(_0x7f9fe3[_0x35df('0x28')]){delete _0x7f9fe3[_0x35df('0x28')];}_0xdb353c[_0x35df('0x1a')](_0x3875ae)['send'](_0x7f9fe3);};}exports[_0x35df('0x29')]=function(_0x510862,_0x2012d8){var _0xe285be={},_0x27ce22={},_0x553960={'count':0x0,'rows':[]};var _0x33e66d=_[_0x35df('0x2a')](db[_0x35df('0x2b')]['rawAttributes'],function(_0x17359f){return{'name':_0x17359f[_0x35df('0x2c')],'type':_0x17359f[_0x35df('0x2d')]['key']};});_0x27ce22[_0x35df('0x2e')]=_[_0x35df('0x2a')](_0x33e66d,_0x35df('0x28'));_0x27ce22[_0x35df('0x2f')]=_[_0x35df('0x30')](_0x510862['query']);_0x27ce22[_0x35df('0x31')]=_['intersection'](_0x27ce22[_0x35df('0x2e')],_0x27ce22[_0x35df('0x2f')]);_0xe285be['attributes']=_[_0x35df('0x32')](_0x27ce22['model'],qs['fields'](_0x510862[_0x35df('0x2f')][_0x35df('0x33')]));_0xe285be[_0x35df('0x34')]=_0xe285be[_0x35df('0x34')][_0x35df('0x35')]?_0xe285be[_0x35df('0x34')]:_0x27ce22[_0x35df('0x2e')];if(!_0x510862[_0x35df('0x2f')]['hasOwnProperty'](_0x35df('0x36'))){_0xe285be[_0x35df('0x1f')]=qs[_0x35df('0x1f')](_0x510862['query']['limit']);_0xe285be[_0x35df('0x1d')]=qs[_0x35df('0x1d')](_0x510862[_0x35df('0x2f')][_0x35df('0x1d')]);}_0xe285be['order']=qs[_0x35df('0x37')](_0x510862[_0x35df('0x2f')]['sort']);_0xe285be[_0x35df('0x38')]=qs[_0x35df('0x31')](_[_0x35df('0x39')](_0x510862[_0x35df('0x2f')],_0x27ce22[_0x35df('0x31')]),_0x33e66d);if(_0x510862[_0x35df('0x2f')][_0x35df('0x3a')]){_0xe285be['where']=_[_0x35df('0x3b')](_0xe285be[_0x35df('0x38')],{'$or':_['map'](_0x33e66d,function(_0x23ef20){if(_0x23ef20[_0x35df('0x2d')]!=='VIRTUAL'){var _0x3fcc22={};_0x3fcc22[_0x23ef20['name']]={'$like':'%'+_0x510862[_0x35df('0x2f')][_0x35df('0x3a')]+'%'};return _0x3fcc22;}})});}_0xe285be=_[_0x35df('0x3b')]({},_0xe285be,_0x510862['options']);var _0x302e1d={'where':_0xe285be[_0x35df('0x38')]};return db[_0x35df('0x2b')][_0x35df('0x20')](_0x302e1d)['then'](function(_0x4837b0){_0x553960[_0x35df('0x20')]=_0x4837b0;if(_0x510862['query'][_0x35df('0x3c')]){_0xe285be['include']=[{'all':!![]}];}return db[_0x35df('0x2b')]['findAll'](_0xe285be);})['then'](function(_0x1d5f8e){_0x553960[_0x35df('0x3d')]=_0x1d5f8e;return _0x553960;})[_0x35df('0x26')](respondWithFilteredResult(_0x2012d8,_0xe285be))[_0x35df('0x3e')](handleError(_0x2012d8,null));};exports[_0x35df('0x3f')]=function(_0x300cf6,_0x94d005){var _0x260201={'raw':!![],'where':{'id':_0x300cf6[_0x35df('0x40')]['id']}},_0x206366={};_0x206366[_0x35df('0x2e')]=_['keys'](db['WhatsappTransferReport'][_0x35df('0x41')]);_0x206366[_0x35df('0x2f')]=_[_0x35df('0x30')](_0x300cf6['query']);_0x206366[_0x35df('0x31')]=_[_0x35df('0x32')](_0x206366[_0x35df('0x2e')],_0x206366[_0x35df('0x2f')]);_0x260201[_0x35df('0x34')]=_[_0x35df('0x32')](_0x206366[_0x35df('0x2e')],qs['fields'](_0x300cf6[_0x35df('0x2f')][_0x35df('0x33')]));_0x260201['attributes']=_0x260201['attributes'][_0x35df('0x35')]?_0x260201[_0x35df('0x34')]:_0x206366[_0x35df('0x2e')];if(_0x300cf6[_0x35df('0x2f')]['includeAll']){_0x260201['include']=[{'all':!![]}];}_0x260201=_[_0x35df('0x3b')]({},_0x260201,_0x300cf6[_0x35df('0x42')]);return db[_0x35df('0x2b')]['find'](_0x260201)[_0x35df('0x26')](handleEntityNotFound(_0x94d005,null))[_0x35df('0x26')](respondWithResult(_0x94d005,null))[_0x35df('0x3e')](handleError(_0x94d005,null));};exports['create']=function(_0x2a2b3b,_0x194520){return db[_0x35df('0x2b')][_0x35df('0x43')](_0x2a2b3b[_0x35df('0x44')],{})[_0x35df('0x26')](respondWithResult(_0x194520,0xc9))[_0x35df('0x3e')](handleError(_0x194520,null));};exports[_0x35df('0x24')]=function(_0x5d0e60,_0x8db52f){if(_0x5d0e60[_0x35df('0x44')]['id']){delete _0x5d0e60[_0x35df('0x44')]['id'];}return db[_0x35df('0x2b')][_0x35df('0x45')]({'where':{'id':_0x5d0e60[_0x35df('0x40')]['id']}})['then'](handleEntityNotFound(_0x8db52f,null))[_0x35df('0x26')](saveUpdates(_0x5d0e60[_0x35df('0x44')],null))['then'](respondWithResult(_0x8db52f,null))[_0x35df('0x3e')](handleError(_0x8db52f,null));};exports['destroy']=function(_0x500e8d,_0x288081){return db[_0x35df('0x2b')][_0x35df('0x45')]({'where':{'id':_0x500e8d[_0x35df('0x40')]['id']}})[_0x35df('0x26')](handleEntityNotFound(_0x288081,null))['then'](removeEntity(_0x288081,null))['catch'](handleError(_0x288081,null));};exports[_0x35df('0x46')]=function(_0x51fe11,_0x43f529){return db[_0x35df('0x2b')][_0x35df('0x46')]()[_0x35df('0x26')](respondWithResult(_0x43f529,null))['catch'](handleError(_0x43f529,null));}; \ No newline at end of file +var _0xfd49=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','WhatsappTransferReport','findAll','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfd49,0x121));var _0x9fd4=function(_0x10c19d,_0x27d01e){_0x10c19d=_0x10c19d-0x0;var _0x313fe4=_0xfd49[_0x10c19d];return _0x313fe4;};'use strict';var emlformat=require(_0x9fd4('0x0'));var rimraf=require(_0x9fd4('0x1'));var zipdir=require(_0x9fd4('0x2'));var jsonpatch=require(_0x9fd4('0x3'));var rp=require(_0x9fd4('0x4'));var moment=require('moment');var BPromise=require(_0x9fd4('0x5'));var Mustache=require(_0x9fd4('0x6'));var util=require(_0x9fd4('0x7'));var path=require(_0x9fd4('0x8'));var sox=require(_0x9fd4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fd4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9fd4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fd4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9fd4('0xd'));var Papa=require(_0x9fd4('0xe'));var Redis=require('ioredis');var authService=require(_0x9fd4('0xf'));var qs=require(_0x9fd4('0x10'));var as=require(_0x9fd4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd4('0x12'))(_0x9fd4('0x13'));var utils=require(_0x9fd4('0x14'));var config=require(_0x9fd4('0x15'));var licenseUtil=require(_0x9fd4('0x16'));var db=require(_0x9fd4('0x17'))['db'];function respondWithStatusCode(_0x338e09,_0x46e613){_0x46e613=_0x46e613||0xcc;return function(_0x3d3bef){if(_0x3d3bef){return _0x338e09['sendStatus'](_0x46e613);}return _0x338e09[_0x9fd4('0x18')](_0x46e613)[_0x9fd4('0x19')]();};}function respondWithResult(_0x2bdb31,_0x551601){_0x551601=_0x551601||0xc8;return function(_0x3ef064){if(_0x3ef064){return _0x2bdb31[_0x9fd4('0x18')](_0x551601)[_0x9fd4('0x1a')](_0x3ef064);}};}function respondWithFilteredResult(_0x1b92af,_0x2ae467){return function(_0x54efaa){if(_0x54efaa){var _0x59143e=typeof _0x2ae467['offset']===_0x9fd4('0x1b')&&typeof _0x2ae467[_0x9fd4('0x1c')]===_0x9fd4('0x1b');var _0x291cb1=_0x54efaa[_0x9fd4('0x1d')];var _0x2e55cc=_0x59143e?0x0:_0x2ae467[_0x9fd4('0x1e')];var _0x4600e7=_0x59143e?_0x54efaa['count']:_0x2ae467[_0x9fd4('0x1e')]+_0x2ae467[_0x9fd4('0x1c')];var _0xfbf5a5;if(_0x4600e7>=_0x291cb1){_0x4600e7=_0x291cb1;_0xfbf5a5=0xc8;}else{_0xfbf5a5=0xce;}_0x1b92af[_0x9fd4('0x18')](_0xfbf5a5);return _0x1b92af[_0x9fd4('0x1f')](_0x9fd4('0x20'),_0x2e55cc+'-'+_0x4600e7+'/'+_0x291cb1)[_0x9fd4('0x1a')](_0x54efaa);}return null;};}function patchUpdates(_0x4e1498){return function(_0x22851f){try{jsonpatch[_0x9fd4('0x21')](_0x22851f,_0x4e1498,!![]);}catch(_0xc72c7b){return BPromise[_0x9fd4('0x22')](_0xc72c7b);}return _0x22851f['save']();};}function saveUpdates(_0x18c402,_0x907f07){return function(_0x2a44dc){if(_0x2a44dc){return _0x2a44dc[_0x9fd4('0x23')](_0x18c402)['then'](function(_0x3066f1){return _0x3066f1;});}return null;};}function removeEntity(_0x4d18da,_0xd948d2){return function(_0x415550){if(_0x415550){return _0x415550[_0x9fd4('0x24')]()[_0x9fd4('0x25')](function(){_0x4d18da['status'](0xcc)[_0x9fd4('0x19')]();});}};}function handleEntityNotFound(_0x341dd6,_0x1e89a6){return function(_0x4cd3a6){if(!_0x4cd3a6){_0x341dd6['sendStatus'](0x194);}return _0x4cd3a6;};}function handleError(_0x5da55f,_0x43b5ad){_0x43b5ad=_0x43b5ad||0x1f4;return function(_0x2f6682){logger[_0x9fd4('0x26')](_0x2f6682[_0x9fd4('0x27')]);if(_0x2f6682[_0x9fd4('0x28')]){delete _0x2f6682[_0x9fd4('0x28')];}_0x5da55f['status'](_0x43b5ad)[_0x9fd4('0x29')](_0x2f6682);};}exports['index']=function(_0x30e4a6,_0x1d621a){var _0x3d4b40={},_0x50fed9={},_0x3fef71={'count':0x0,'rows':[]};var _0x8cf39e=_[_0x9fd4('0x2a')](db['WhatsappTransferReport']['rawAttributes'],function(_0x26b659){return{'name':_0x26b659[_0x9fd4('0x2b')],'type':_0x26b659[_0x9fd4('0x2c')][_0x9fd4('0x2d')]};});_0x50fed9['model']=_['map'](_0x8cf39e,_0x9fd4('0x28'));_0x50fed9[_0x9fd4('0x2e')]=_[_0x9fd4('0x2f')](_0x30e4a6[_0x9fd4('0x2e')]);_0x50fed9[_0x9fd4('0x30')]=_['intersection'](_0x50fed9['model'],_0x50fed9[_0x9fd4('0x2e')]);_0x3d4b40['attributes']=_[_0x9fd4('0x31')](_0x50fed9[_0x9fd4('0x32')],qs['fields'](_0x30e4a6[_0x9fd4('0x2e')][_0x9fd4('0x33')]));_0x3d4b40['attributes']=_0x3d4b40[_0x9fd4('0x34')]['length']?_0x3d4b40[_0x9fd4('0x34')]:_0x50fed9[_0x9fd4('0x32')];if(!_0x30e4a6[_0x9fd4('0x2e')][_0x9fd4('0x35')](_0x9fd4('0x36'))){_0x3d4b40[_0x9fd4('0x1c')]=qs[_0x9fd4('0x1c')](_0x30e4a6[_0x9fd4('0x2e')]['limit']);_0x3d4b40[_0x9fd4('0x1e')]=qs['offset'](_0x30e4a6['query'][_0x9fd4('0x1e')]);}_0x3d4b40[_0x9fd4('0x37')]=qs['sort'](_0x30e4a6['query'][_0x9fd4('0x38')]);_0x3d4b40['where']=qs['filters'](_[_0x9fd4('0x39')](_0x30e4a6['query'],_0x50fed9[_0x9fd4('0x30')]),_0x8cf39e);if(_0x30e4a6['query'][_0x9fd4('0x3a')]){_0x3d4b40['where']=_['merge'](_0x3d4b40[_0x9fd4('0x3b')],{'$or':_[_0x9fd4('0x2a')](_0x8cf39e,function(_0x4f0218){if(_0x4f0218[_0x9fd4('0x2c')]!=='VIRTUAL'){var _0x137dd8={};_0x137dd8[_0x4f0218['name']]={'$like':'%'+_0x30e4a6[_0x9fd4('0x2e')][_0x9fd4('0x3a')]+'%'};return _0x137dd8;}})});}_0x3d4b40=_[_0x9fd4('0x3c')]({},_0x3d4b40,_0x30e4a6[_0x9fd4('0x3d')]);var _0x46b5a9={'where':_0x3d4b40['where']};return db['WhatsappTransferReport'][_0x9fd4('0x1d')](_0x46b5a9)[_0x9fd4('0x25')](function(_0x1ba66d){_0x3fef71[_0x9fd4('0x1d')]=_0x1ba66d;if(_0x30e4a6['query'][_0x9fd4('0x3e')]){_0x3d4b40[_0x9fd4('0x3f')]=[{'all':!![]}];}return db[_0x9fd4('0x40')][_0x9fd4('0x41')](_0x3d4b40);})[_0x9fd4('0x25')](function(_0x25ad34){_0x3fef71['rows']=_0x25ad34;return _0x3fef71;})[_0x9fd4('0x25')](respondWithFilteredResult(_0x1d621a,_0x3d4b40))[_0x9fd4('0x42')](handleError(_0x1d621a,null));};exports[_0x9fd4('0x43')]=function(_0x5d05d7,_0x4056e9){var _0x4a6b6e={'raw':!![],'where':{'id':_0x5d05d7[_0x9fd4('0x44')]['id']}},_0x19dd5a={};_0x19dd5a['model']=_['keys'](db[_0x9fd4('0x40')][_0x9fd4('0x45')]);_0x19dd5a[_0x9fd4('0x2e')]=_['keys'](_0x5d05d7[_0x9fd4('0x2e')]);_0x19dd5a[_0x9fd4('0x30')]=_['intersection'](_0x19dd5a[_0x9fd4('0x32')],_0x19dd5a['query']);_0x4a6b6e[_0x9fd4('0x34')]=_[_0x9fd4('0x31')](_0x19dd5a['model'],qs[_0x9fd4('0x33')](_0x5d05d7[_0x9fd4('0x2e')][_0x9fd4('0x33')]));_0x4a6b6e[_0x9fd4('0x34')]=_0x4a6b6e[_0x9fd4('0x34')][_0x9fd4('0x46')]?_0x4a6b6e['attributes']:_0x19dd5a['model'];if(_0x5d05d7['query'][_0x9fd4('0x3e')]){_0x4a6b6e[_0x9fd4('0x3f')]=[{'all':!![]}];}_0x4a6b6e=_[_0x9fd4('0x3c')]({},_0x4a6b6e,_0x5d05d7[_0x9fd4('0x3d')]);return db[_0x9fd4('0x40')][_0x9fd4('0x47')](_0x4a6b6e)[_0x9fd4('0x25')](handleEntityNotFound(_0x4056e9,null))[_0x9fd4('0x25')](respondWithResult(_0x4056e9,null))[_0x9fd4('0x42')](handleError(_0x4056e9,null));};exports['create']=function(_0x5ca70b,_0x5d2cc1){return db[_0x9fd4('0x40')][_0x9fd4('0x48')](_0x5ca70b['body'],{})[_0x9fd4('0x25')](respondWithResult(_0x5d2cc1,0xc9))[_0x9fd4('0x42')](handleError(_0x5d2cc1,null));};exports[_0x9fd4('0x23')]=function(_0x4fdfea,_0x57c527){if(_0x4fdfea[_0x9fd4('0x49')]['id']){delete _0x4fdfea[_0x9fd4('0x49')]['id'];}return db[_0x9fd4('0x40')]['find']({'where':{'id':_0x4fdfea[_0x9fd4('0x44')]['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x57c527,null))[_0x9fd4('0x25')](saveUpdates(_0x4fdfea[_0x9fd4('0x49')],null))[_0x9fd4('0x25')](respondWithResult(_0x57c527,null))[_0x9fd4('0x42')](handleError(_0x57c527,null));};exports[_0x9fd4('0x24')]=function(_0x4c26d6,_0x493d07){return db['WhatsappTransferReport'][_0x9fd4('0x47')]({'where':{'id':_0x4c26d6['params']['id']}})[_0x9fd4('0x25')](handleEntityNotFound(_0x493d07,null))[_0x9fd4('0x25')](removeEntity(_0x493d07,null))[_0x9fd4('0x42')](handleError(_0x493d07,null));};exports[_0x9fd4('0x4a')]=function(_0x12df65,_0x40d34c){return db[_0x9fd4('0x40')][_0x9fd4('0x4a')]()[_0x9fd4('0x25')](respondWithResult(_0x40d34c,null))[_0x9fd4('0x42')](handleError(_0x40d34c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 79ddd6b..cad9fe0 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 _0x6b95=['WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x57717d,_0x1c1542){var _0x4b81c3=function(_0x39822f){while(--_0x39822f){_0x57717d['push'](_0x57717d['shift']());}};_0x4b81c3(++_0x1c1542);}(_0x6b95,0x64));var _0x56b9=function(_0x2ad777,_0x4e7315){_0x2ad777=_0x2ad777-0x0;var _0x1991a4=_0x6b95[_0x2ad777];return _0x1991a4;};'use strict';var _=require(_0x56b9('0x0'));var util=require(_0x56b9('0x1'));var logger=require(_0x56b9('0x2'))(_0x56b9('0x3'));var moment=require(_0x56b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x56b9('0x5'));var fs=require('fs');var path=require(_0x56b9('0x6'));var rimraf=require(_0x56b9('0x7'));var config=require(_0x56b9('0x8'));var attributes=require(_0x56b9('0x9'));module[_0x56b9('0xa')]=function(_0x330380,_0x30cc98){return _0x330380[_0x56b9('0xb')](_0x56b9('0xc'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x56b9('0xd'),'fields':[_0x56b9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe97=['path','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0xfe97,0x10e));var _0x7fe9=function(_0x1e3450,_0x33e786){_0x1e3450=_0x1e3450-0x0;var _0x186346=_0xfe97[_0x1e3450];return _0x186346;};'use strict';var _=require(_0x7fe9('0x0'));var util=require(_0x7fe9('0x1'));var logger=require('../../config/logger')(_0x7fe9('0x2'));var moment=require('moment');var BPromise=require(_0x7fe9('0x3'));var rp=require(_0x7fe9('0x4'));var fs=require('fs');var path=require(_0x7fe9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x7fe9('0x6')]=function(_0x4534aa,_0x75c2ac){return _0x4534aa[_0x7fe9('0x7')](_0x7fe9('0x8'),attributes,{'tableName':_0x7fe9('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7fe9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6e253c1..c2666f9 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 _0x6220=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3a07f5,_0x357c50){var _0x1ae6b9=function(_0x18579e){while(--_0x18579e){_0x3a07f5['push'](_0x3a07f5['shift']());}};_0x1ae6b9(++_0x357c50);}(_0x6220,0x16a));var _0x0622=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6220[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x0622('0x0'));var moment=require(_0x0622('0x1'));var BPromise=require(_0x0622('0x2'));var rs=require(_0x0622('0x3'));var fs=require('fs');var Redis=require(_0x0622('0x4'));var db=require(_0x0622('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0622('0x6'))('rpc');var config=require(_0x0622('0x7'));var jayson=require(_0x0622('0x8'));var client=jayson[_0x0622('0x9')][_0x0622('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbd801d,_0x1e6789,_0x1538ef){return new BPromise(function(_0x18bc1b,_0xc200f3){return client[_0x0622('0xb')](_0xbd801d,_0x1538ef)[_0x0622('0xc')](function(_0x1f6e13){logger[_0x0622('0xd')](_0x0622('0xe'),_0x1e6789,_0x0622('0xf'));logger['debug'](_0x0622('0x10'),_0x1e6789,'request\x20sent',JSON[_0x0622('0x11')](_0x1f6e13));if(_0x1f6e13['error']){if(_0x1f6e13[_0x0622('0x12')][_0x0622('0x13')]===0x1f4){logger[_0x0622('0x12')](_0x0622('0xe'),_0x1e6789,_0x1f6e13[_0x0622('0x12')][_0x0622('0x14')]);return _0xc200f3(_0x1f6e13['error'][_0x0622('0x14')]);}logger['error'](_0x0622('0xe'),_0x1e6789,_0x1f6e13[_0x0622('0x12')]['message']);return _0x18bc1b(_0x1f6e13[_0x0622('0x12')][_0x0622('0x14')]);}else{logger[_0x0622('0xd')](_0x0622('0xe'),_0x1e6789,'request\x20sent');_0x18bc1b(_0x1f6e13[_0x0622('0x15')][_0x0622('0x14')]);}})[_0x0622('0x16')](function(_0x3db345){logger[_0x0622('0x12')](_0x0622('0xe'),_0x1e6789,_0x3db345);_0xc200f3(_0x3db345);});});} \ No newline at end of file +var _0x6f2b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x125bd0,_0x163a59){var _0x45988f=function(_0x183f93){while(--_0x183f93){_0x125bd0['push'](_0x125bd0['shift']());}};_0x45988f(++_0x163a59);}(_0x6f2b,0x1de));var _0xb6f2=function(_0xf59ef4,_0x5822d0){_0xf59ef4=_0xf59ef4-0x0;var _0x60a01e=_0x6f2b[_0xf59ef4];return _0x60a01e;};'use strict';var _=require(_0xb6f2('0x0'));var util=require(_0xb6f2('0x1'));var moment=require(_0xb6f2('0x2'));var BPromise=require(_0xb6f2('0x3'));var rs=require(_0xb6f2('0x4'));var fs=require('fs');var Redis=require(_0xb6f2('0x5'));var db=require(_0xb6f2('0x6'))['db'];var utils=require(_0xb6f2('0x7'));var logger=require(_0xb6f2('0x8'))(_0xb6f2('0x9'));var config=require('../../config/environment');var jayson=require(_0xb6f2('0xa'));var client=jayson[_0xb6f2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43621b,_0x590e39,_0x46fc8e){return new BPromise(function(_0x3ba807,_0x568ee2){return client[_0xb6f2('0xc')](_0x43621b,_0x46fc8e)[_0xb6f2('0xd')](function(_0x3d40fb){logger[_0xb6f2('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x590e39,'request\x20sent');logger['debug'](_0xb6f2('0xf'),_0x590e39,_0xb6f2('0x10'),JSON[_0xb6f2('0x11')](_0x3d40fb));if(_0x3d40fb[_0xb6f2('0x12')]){if(_0x3d40fb[_0xb6f2('0x12')][_0xb6f2('0x13')]===0x1f4){logger['error'](_0xb6f2('0x14'),_0x590e39,_0x3d40fb[_0xb6f2('0x12')][_0xb6f2('0x15')]);return _0x568ee2(_0x3d40fb[_0xb6f2('0x12')]['message']);}logger[_0xb6f2('0x12')](_0xb6f2('0x14'),_0x590e39,_0x3d40fb[_0xb6f2('0x12')][_0xb6f2('0x15')]);return _0x3ba807(_0x3d40fb['error'][_0xb6f2('0x15')]);}else{logger[_0xb6f2('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x590e39,_0xb6f2('0x10'));_0x3ba807(_0x3d40fb['result']['message']);}})[_0xb6f2('0x16')](function(_0x179dce){logger[_0xb6f2('0x12')](_0xb6f2('0x14'),_0x590e39,_0x179dce);_0x568ee2(_0x179dce);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index d549b3a..01a6ade 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x090c=['./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','listen','info','start','Online\x20apps:','filter','name','join','Offline\x20apps:','map','online','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit'];(function(_0xf202c5,_0x1cec69){var _0x3441dc=function(_0x5f8c98){while(--_0x5f8c98){_0xf202c5['push'](_0xf202c5['shift']());}};_0x3441dc(++_0x1cec69);}(_0x090c,0x1a4));var _0xc090=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x090c[_0x31b5a5];return _0x364cc9;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0xc090('0x0'));var config=require(_0xc090('0x1'));var logger=require('./config/logger')(_0xc090('0x2'));var pm2=require(_0xc090('0x3'));var pm2Config=require(_0xc090('0x4'));var schedule=require('./config/schedule');var chat=require(_0xc090('0x5'));var whatsapp=require(_0xc090('0x6'));var transcribe=require(_0xc090('0x7'));var provider=require(_0xc090('0x8'));function main(){return mysqldb['db'][_0xc090('0x9')]['sync']()[_0xc090('0xa')](function(){return rpc[_0xc090('0xb')]();})[_0xc090('0xa')](function(_0x5585d0){logger[_0xc090('0xc')](_0x5585d0);return chat[_0xc090('0xd')]();})[_0xc090('0xa')](function(){return whatsapp[_0xc090('0xd')]();})[_0xc090('0xa')](function(){return schedule[_0xc090('0xd')]();})[_0xc090('0xa')](function(){return transcribe['start']();})[_0xc090('0xa')](function(){return provider['start']();})[_0xc090('0xa')](function(_0x568d0b){logger[_0xc090('0xc')](_0x568d0b);return pm2[_0xc090('0xd')](pm2Config);})[_0xc090('0xa')](function(_0x3796b2){logger[_0xc090('0xc')](_0xc090('0xe'),_['map'](_[_0xc090('0xf')](_0x3796b2,{'status':'online'}),_0xc090('0x10'))[_0xc090('0x11')]());logger[_0xc090('0xc')](_0xc090('0x12'),_[_0xc090('0x13')](_[_0xc090('0xf')](_0x3796b2,function(_0x4db428){return _0x4db428['status']!==_0xc090('0x14');}),_0xc090('0x10'))[_0xc090('0x11')]()||_0xc090('0x15'));config[_0xc090('0x16')]&&require(_0xc090('0x17'))[_0xc090('0x18')]();require(_0xc090('0x19'))[_0xc090('0x18')]();})[_0xc090('0x1a')](function(_0x5e5bb9){logger[_0xc090('0x1b')](_0xc090('0x1c'),_0x5e5bb9);process[_0xc090('0x1d')](0x1);});}main(); \ No newline at end of file +var _0x27ae=['./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','start','info','map','filter','online','name','join','Offline\x20apps:','None','seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config'];(function(_0x2f4cbf,_0x206d43){var _0x184315=function(_0x594e0a){while(--_0x594e0a){_0x2f4cbf['push'](_0x2f4cbf['shift']());}};_0x184315(++_0x206d43);}(_0x27ae,0xa7));var _0xe27a=function(_0x4f93a9,_0x2793c3){_0x4f93a9=_0x4f93a9-0x0;var _0x8fab33=_0x27ae[_0x4f93a9];return _0x8fab33;};'use strict';var _=require(_0xe27a('0x0'));var mysqldb=require(_0xe27a('0x1'));var rpc=require(_0xe27a('0x2'));var config=require(_0xe27a('0x3'));var logger=require(_0xe27a('0x4'))(_0xe27a('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xe27a('0x6'));var schedule=require(_0xe27a('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xe27a('0x8'));var transcribe=require(_0xe27a('0x9'));var provider=require(_0xe27a('0xa'));function main(){return mysqldb['db'][_0xe27a('0xb')][_0xe27a('0xc')]()['then'](function(){return rpc['listen']();})[_0xe27a('0xd')](function(_0x3be723){logger['info'](_0x3be723);return chat[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return whatsapp[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return schedule[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return transcribe[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(){return provider[_0xe27a('0xe')]();})[_0xe27a('0xd')](function(_0x2902e8){logger[_0xe27a('0xf')](_0x2902e8);return pm2[_0xe27a('0xe')](pm2Config);})['then'](function(_0x50eeb8){logger[_0xe27a('0xf')]('Online\x20apps:',_[_0xe27a('0x10')](_[_0xe27a('0x11')](_0x50eeb8,{'status':_0xe27a('0x12')}),_0xe27a('0x13'))[_0xe27a('0x14')]());logger[_0xe27a('0xf')](_0xe27a('0x15'),_['map'](_[_0xe27a('0x11')](_0x50eeb8,function(_0xa5ef11){return _0xa5ef11['status']!==_0xe27a('0x12');}),_0xe27a('0x13'))[_0xe27a('0x14')]()||_0xe27a('0x16'));config[_0xe27a('0x17')]&&require('./config/seedDB')[_0xe27a('0x18')]();require(_0xe27a('0x19'))[_0xe27a('0x18')]();})[_0xe27a('0x1a')](function(_0x64c48e){logger['error'](_0xe27a('0x1b'),_0x64c48e);process[_0xe27a('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8274d14..7d4edf8 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 _0xccfb=['canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','bluebird','moment','secrets','session','userpic','permissions','voicePause','chatPause','faxPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','then','status','unmanaged','disposition','Unmanaged.','catch','startsWith','headers','authorization','Basic','User','find','name','authenticate','pass','json','Wrong\x20credentials.','Bearer','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.'];(function(_0x2ce189,_0x4b6664){var _0x185d63=function(_0xf87688){while(--_0xf87688){_0x2ce189['push'](_0x2ce189['shift']());}};_0x185d63(++_0x4b6664);}(_0xccfb,0xb3));var _0xbccf=function(_0x3e5450,_0x3fcf22){_0x3e5450=_0x3e5450-0x0;var _0x2f7078=_0xccfb[_0x3e5450];return _0x2f7078;};'use strict';var db=require(_0xbccf('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xbccf('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xbccf('0x2'));var _=require(_0xbccf('0x3'));var jwt=require(_0xbccf('0x4'));var expressJwt=require(_0xbccf('0x5'));var compose=require(_0xbccf('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0xbccf('0x7'));var util=require('util');var moment=require(_0xbccf('0x8'));var validateJwt=expressJwt({'secret':config[_0xbccf('0x9')][_0xbccf('0xa')]});var userAttributes=['id','role','fullname','name','internal','email',_0xbccf('0xb'),_0xbccf('0xc'),'md5secret',_0xbccf('0xd'),_0xbccf('0xe'),'mailPause',_0xbccf('0xf'),'smsPause',_0xbccf('0x10'),'pauseType',_0xbccf('0x11'),'lastLoginAt',_0xbccf('0x12'),_0xbccf('0x13'),_0xbccf('0x14'),_0xbccf('0x15'),_0xbccf('0x16'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xbccf('0x17'),_0xbccf('0x18'),_0xbccf('0x19'),_0xbccf('0x1a'),'phoneBarExpires',_0xbccf('0x1b'),_0xbccf('0x1c'),_0xbccf('0x1d'),_0xbccf('0x1e'),_0xbccf('0x1f'),_0xbccf('0x20'),_0xbccf('0x21'),_0xbccf('0x22'),_0xbccf('0x23'),'downloadVoiceRecordings',_0xbccf('0x24'),_0xbccf('0x25'),'ignorePauseForPreviewCalls',_0xbccf('0x26')];exports[_0xbccf('0x27')]=function(){return this[_0xbccf('0x28')](!![])[_0xbccf('0x29')](function(_0x5f526a,_0x1e142e,_0x50d881){if(_0x5f526a[_0xbccf('0x2a')]){_0x50d881();}else{return db[_0xbccf('0x2b')]['findOne']({'where':{'id':_0x5f526a[_0xbccf('0x2c')]['id']},'attributes':['id',_0xbccf('0x2d'),'disposition'],'raw':!![]})[_0xbccf('0x2e')](function(_0x281291){if(_0x281291&&_0x281291[_0xbccf('0x2d')]){return _0x1e142e[_0xbccf('0x2f')](_0x281291['disposition']===_0xbccf('0x30')?0x195:0x193)['json']({'message':_0x281291[_0xbccf('0x31')]===_0xbccf('0x30')?_0xbccf('0x32'):'Forbidden.'});}else{_0x50d881();}})[_0xbccf('0x33')](function(_0x3615fc){_0x50d881(_0x3615fc);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5deb64){return compose()[_0xbccf('0x29')](function(_0x142304,_0xcfbe9b,_0x18e36f){var _0x312fc8;if(_0x142304['headers']['authorization']){if(_[_0xbccf('0x34')](_0x142304[_0xbccf('0x35')][_0xbccf('0x36')],_0xbccf('0x37'))){var _0x4993a7=basicAuth(_0x142304);db[_0xbccf('0x38')][_0xbccf('0x39')]({'where':{'name':_0x4993a7[_0xbccf('0x3a')]}})[_0xbccf('0x2e')](function(_0x2344af){if(!_0x2344af||!_0x2344af[_0xbccf('0x3b')](_0x4993a7[_0xbccf('0x3c')])){return _0xcfbe9b[_0xbccf('0x2f')](0x191)[_0xbccf('0x3d')]({'message':_0xbccf('0x3e')});}_0x142304[_0xbccf('0x2a')]={'id':_0x2344af['id']};_0x18e36f();})[_0xbccf('0x33')](function(_0x174dc8){_0x18e36f(_0x174dc8);});}else if(_[_0xbccf('0x34')](_0x142304[_0xbccf('0x35')]['authorization'],_0xbccf('0x3f'))){validateJwt(_0x142304,_0xcfbe9b,_0x18e36f);}else{if(_0x5deb64){_0x18e36f();}else{return _0xcfbe9b['status'](0x193)[_0xbccf('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x142304[_0xbccf('0x40')][_0xbccf('0x41')]){try{var _0x3ecb69={'audience':hardwareConf[_0xbccf('0x42')](),'issuer':hardwareConf[_0xbccf('0x42')]()};verifyJwt(_0x142304[_0xbccf('0x40')][_0xbccf('0x41')],_0x3ecb69)[_0xbccf('0x2e')](function(_0x1339fa){return db['User']['find']({'where':{'id':_0x1339fa[_0xbccf('0x43')]}})[_0xbccf('0x2e')](function(_0x28c5dc){_0x312fc8=_0x28c5dc;return db[_0xbccf('0x44')][_0xbccf('0x45')]({'where':{'id':0x1},'attributes':[_0xbccf('0x46'),_0xbccf('0x47')],'raw':!![]});})[_0xbccf('0x2e')](function(_0x19fd96){if(!_0x312fc8||!_[_0xbccf('0x48')](_0x312fc8[_0xbccf('0x49')],_0x1339fa[_0xbccf('0x4a')])){return _0xcfbe9b[_0xbccf('0x2f')](0x191)[_0xbccf('0x3d')]({'message':_0xbccf('0x4b')});}if(_0x312fc8[_0xbccf('0x4c')]){return _0xcfbe9b[_0xbccf('0x2f')](0x191)[_0xbccf('0x3d')]({'message':_0xbccf('0x4d')});}if(_0x312fc8[_0xbccf('0x4e')]){if(_0x19fd96[_0xbccf('0x47')]>0x0){if(moment(_0x312fc8[_0xbccf('0x4f')])[_0xbccf('0x50')](_0x19fd96[_0xbccf('0x47')],_0xbccf('0x51'))>moment()){return _0xcfbe9b['status'](0x191)[_0xbccf('0x3d')]({'message':_0xbccf('0x4d')});}}else{return _0xcfbe9b['status'](0x191)[_0xbccf('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x142304[_0xbccf('0x2a')]={'id':_0x312fc8['id']};_0x18e36f();});})[_0xbccf('0x33')](function(){return _0xcfbe9b[_0xbccf('0x2f')](0x191)['json']({'message':_0xbccf('0x4d')});});}catch(_0x49988e){_0x18e36f(_0x49988e);}}else if(_0x5deb64){_0x18e36f();}else{return _0xcfbe9b[_0xbccf('0x2f')](0x193)[_0xbccf('0x3d')]({'message':_0xbccf('0x52')});}})[_0xbccf('0x29')](function(_0x260e40,_0x162b57,_0x179aeb){if(_0x260e40['user']){db[_0xbccf('0x38')]['find']({'where':{'id':_0x260e40[_0xbccf('0x2a')]['id']},'attributes':userAttributes})['then'](function(_0x3cc4fc){if(!_0x3cc4fc){return _0x162b57[_0xbccf('0x2f')](0x194)[_0xbccf('0x3d')]({'message':_0xbccf('0x53')});}_0x260e40[_0xbccf('0x2a')]=_0x3cc4fc;_0x179aeb();})['catch'](function(_0x220c5e){_0x179aeb(_0x220c5e);});}else if(_0x5deb64){_0x179aeb();}else{return _0x162b57[_0xbccf('0x2f')](0x194)[_0xbccf('0x3d')]({'message':_0xbccf('0x54')});}});};exports[_0xbccf('0x55')]=function canUpdate(){return compose()[_0xbccf('0x29')](function(_0x615e4d,_0x1d2dc9,_0x5c86b4){return licenseUtil[_0xbccf('0x56')]()[_0xbccf('0x2e')](function(_0x25080e){if(_0x25080e[_0xbccf('0x57')]){_0x5c86b4();}else{return _0x1d2dc9[_0xbccf('0x2f')](0x193)['json']({'message':_0xbccf('0x58')});}})[_0xbccf('0x33')](function(_0x313830){_0x5c86b4(_0x313830);});});};exports[_0xbccf('0x59')]=function isWebrtcLicence(){return compose()['use'](function(_0x2f9534,_0x111800,_0x8f5686){return licenseUtil['getLicense']()[_0xbccf('0x2e')](function(_0x526016){if(_0x526016[_0xbccf('0x5a')]){_0x8f5686();}else{return _0x111800['status'](0x193)[_0xbccf('0x3d')]({'message':_0xbccf('0x58')});}})[_0xbccf('0x33')](function(_0x3fd60a){_0x8f5686(_0x3fd60a);});});};exports[_0xbccf('0x5b')]=function(_0x575140,_0x367594,_0xd6d897){_0x575140[_0xbccf('0x5b')]=!![];return _0xd6d897();};exports['signToken']=function signToken(_0x460bcd){return signJwt(_0x460bcd);};exports[_0xbccf('0x5c')]=function(_0x22bf53,_0x66223e){if(!_0x22bf53[_0xbccf('0x2a')]){return _0x66223e[_0xbccf('0x2f')](0x194)[_0xbccf('0x3d')]({'message':_0xbccf('0x5d')});}var _0x4b0c6a={'payload':{'id':_0x22bf53['user']['id'],'role':_0x22bf53[_0xbccf('0x2a')][_0xbccf('0x5e')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4b0c6a)[_0xbccf('0x2e')](function(_0x52666c){_0x66223e[_0xbccf('0x5f')](_0xbccf('0x60'),_0x52666c);_0x66223e[_0xbccf('0x61')](_0xbccf('0x62'));})['catch'](function(_0x381168){return _0x66223e[_0xbccf('0x2f')](0x1f4)[_0xbccf('0x63')](_0x381168);});};exports[_0xbccf('0x64')]=function(_0x57fc52){if(_[_0xbccf('0x65')](_0x57fc52[_0xbccf('0x49')])||_[_0xbccf('0x65')](_0x57fc52[_0xbccf('0x66')])){return null;}else{return createJwt(_0x57fc52);}};exports[_0xbccf('0x67')]=function(_0x4f955c){_0x4f955c[_0xbccf('0x49')]=generateNonce();_0x4f955c['apiKeyIat']=generateIssuedAt();return createJwt(_0x4f955c);};exports[_0xbccf('0x68')]=function(_0x68303,_0x17e559){var _0x478add=_0x68303[_0xbccf('0x40')][_0xbccf('0x41')];if(_0x478add){var _0x37f6ba={'nonce':_0x17e559[_0xbccf('0x49')],'iat':_0x17e559[_0xbccf('0x66')],'audience':hardwareConf[_0xbccf('0x42')](),'issuer':hardwareConf[_0xbccf('0x42')]()};return verifyJwt(_0x478add,_0x37f6ba)['then'](function(){return generateApiKey(_0x17e559);});}else{throw{'message':_0xbccf('0x69')};}};exports[_0xbccf('0x6a')]=function(_0x4540b6){var _0x109581=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x109581[_0xbccf('0x6b')](_0x4540b6))throw new db[(_0xbccf('0x6c'))][(_0xbccf('0x6d'))](_0xbccf('0x6e'));return;};exports[_0xbccf('0x6f')]=function(_0x2c5272,_0x1a51a6,_0x147a82){var _0x2c3b4e=encryptor[_0xbccf('0x70')](_0x1a51a6)[_0xbccf('0x71')](',');for(var _0x12d620=0x0;_0x12d620<_0x147a82;_0x12d620++){if(!_0x2c3b4e[_0x12d620])break;if(_0x2c5272['toLowerCase']()===_0x2c3b4e[_0x12d620][_0xbccf('0x72')]()){var _0x50e940=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x147a82);if(_0x147a82===0x1){_0x50e940=_0xbccf('0x73');}throw new db[(_0xbccf('0x6c'))]['ValidationError'](_0x50e940);}}return;};exports['updatePasswordsHistory']=function(_0x10088b,_0x24cf62){var _0xe18897=_0x24cf62?encryptor[_0xbccf('0x70')](_0x24cf62)[_0xbccf('0x71')](','):[];if(_0xe18897[_0xbccf('0x74')]===0x5){_0xe18897[_0xbccf('0x75')](-0x1,0x1);}_0xe18897[_0xbccf('0x76')](_0x10088b);return encryptor['encryptString'](_0xe18897[_0xbccf('0x77')](','));};function signJwt(_0x2facbb){var _0x4ccbb2=BPromise[_0xbccf('0x78')](jwt[_0xbccf('0x79')],{'context':jwt});var _0x1a87ca=_0x2facbb[_0xbccf('0x7a')]||config['secrets']['session'];return new BPromise(function(_0x126eb2,_0xb0721d){_0x4ccbb2(_0x2facbb[_0xbccf('0x7b')],_0x1a87ca,_0x2facbb[_0xbccf('0x7c')])['then'](function(_0xd129){_0x126eb2(_0xd129);})[_0xbccf('0x33')](function(_0x3fcf66){_0xb0721d(_0x3fcf66);});});}function verifyJwt(_0x13f927,_0x5c54d9,_0x1c5144){var _0x235f82=BPromise['promisify'](jwt[_0xbccf('0x7d')],{'context':jwt});var _0x1958c6=_0x1c5144||config['secrets']['session'];return new BPromise(function(_0x25ceab,_0x2132e1){_0x235f82(_0x13f927,_0x1958c6,_0x5c54d9)[_0xbccf('0x2e')](function(_0x378bf6){_0x25ceab(_0x378bf6);})['catch'](function(_0x17bf1d){_0x2132e1(_0x17bf1d);});});}function generateNonce(){return crypto[_0xbccf('0x7e')](0x10)[_0xbccf('0x7f')](_0xbccf('0x80'));}function generateIssuedAt(){return Math[_0xbccf('0x81')](Date[_0xbccf('0x82')]()/0x3e8)[_0xbccf('0x7f')]();}function createJwt(_0x57cfee){var _0x48fb54={'payload':{'iat':_0x57cfee['apiKeyIat'],'nonce':_0x57cfee[_0xbccf('0x49')]},'options':{'algorithm':_0xbccf('0x83'),'subject':_0x57cfee['id'][_0xbccf('0x7f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xbccf('0x42')]()}};return signJwt(_0x48fb54)['then'](function(_0x4bd4a9){return{'iat':_0x57cfee[_0xbccf('0x66')],'nonce':_0x57cfee[_0xbccf('0x49')],'token':_0x4bd4a9};});} \ No newline at end of file +var _0xd1bb=['smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','startsWith','authorization','Basic','User','find','name','authenticate','pass','json','Wrong\x20credentials.','user','Bearer','query','apikey','getUuid','then','allowedLoginAttempts','isEqual','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','randomBytes','toString','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','secrets','session','role','fullname','email','permissions','md5secret','voicePause','chatPause','mailPause'];(function(_0x550d2f,_0x367bea){var _0x28e111=function(_0x2e47eb){while(--_0x2e47eb){_0x550d2f['push'](_0x550d2f['shift']());}};_0x28e111(++_0x367bea);}(_0xd1bb,0xef));var _0xbd1b=function(_0x5beaab,_0x4d708d){_0x5beaab=_0x5beaab-0x0;var _0x19e7db=_0xd1bb[_0x5beaab];return _0x19e7db;};'use strict';var db=require(_0xbd1b('0x0'))['db'];var config=require(_0xbd1b('0x1'));var hardwareConf=require(_0xbd1b('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xbd1b('0x3'));var _=require(_0xbd1b('0x4'));var jwt=require(_0xbd1b('0x5'));var expressJwt=require(_0xbd1b('0x6'));var compose=require(_0xbd1b('0x7'));var basicAuth=require(_0xbd1b('0x8'));var crypto=require(_0xbd1b('0x9'));var BPromise=require('bluebird');var util=require(_0xbd1b('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xbd1b('0xb')][_0xbd1b('0xc')]});var userAttributes=['id',_0xbd1b('0xd'),_0xbd1b('0xe'),'name','internal',_0xbd1b('0xf'),'userpic',_0xbd1b('0x10'),_0xbd1b('0x11'),_0xbd1b('0x12'),_0xbd1b('0x13'),_0xbd1b('0x14'),'faxPause',_0xbd1b('0x15'),_0xbd1b('0x16'),_0xbd1b('0x17'),_0xbd1b('0x18'),_0xbd1b('0x19'),_0xbd1b('0x1a'),_0xbd1b('0x1b'),_0xbd1b('0x1c'),_0xbd1b('0x1d'),_0xbd1b('0x1e'),'phoneBarAutoAnswer',_0xbd1b('0x1f'),_0xbd1b('0x20'),'phoneBarEnableRecording',_0xbd1b('0x21'),_0xbd1b('0x22'),_0xbd1b('0x23'),_0xbd1b('0x24'),_0xbd1b('0x25'),_0xbd1b('0x26'),_0xbd1b('0x27'),_0xbd1b('0x28'),'userProfileId','privacyEnabled',_0xbd1b('0x29'),_0xbd1b('0x2a'),_0xbd1b('0x2b'),_0xbd1b('0x2c'),'downloadAttachments','ignorePauseForPreviewCalls',_0xbd1b('0x2d')];exports[_0xbd1b('0x2e')]=function(){return this[_0xbd1b('0x2f')](!![])['use'](function(_0x234ce3,_0x26ca26,_0x302f9d){if(_0x234ce3['user']){_0x302f9d();}else{return db[_0xbd1b('0x30')][_0xbd1b('0x31')]({'where':{'id':_0x234ce3[_0xbd1b('0x32')]['id']},'attributes':['id',_0xbd1b('0x33'),_0xbd1b('0x34')],'raw':!![]})['then'](function(_0x32b60b){if(_0x32b60b&&_0x32b60b[_0xbd1b('0x33')]){return _0x26ca26[_0xbd1b('0x35')](_0x32b60b[_0xbd1b('0x34')]===_0xbd1b('0x36')?0x195:0x193)['json']({'message':_0x32b60b['disposition']===_0xbd1b('0x36')?_0xbd1b('0x37'):_0xbd1b('0x38')});}else{_0x302f9d();}})[_0xbd1b('0x39')](function(_0x5b9425){_0x302f9d(_0x5b9425);});}});};exports[_0xbd1b('0x2f')]=function isAuthenticated(_0x25d534){return compose()[_0xbd1b('0x3a')](function(_0x259b1e,_0x590565,_0x42b3a3){var _0x2b2acf;if(_0x259b1e[_0xbd1b('0x3b')]['authorization']){if(_[_0xbd1b('0x3c')](_0x259b1e[_0xbd1b('0x3b')][_0xbd1b('0x3d')],_0xbd1b('0x3e'))){var _0x29c841=basicAuth(_0x259b1e);db[_0xbd1b('0x3f')][_0xbd1b('0x40')]({'where':{'name':_0x29c841[_0xbd1b('0x41')]}})['then'](function(_0xaaa168){if(!_0xaaa168||!_0xaaa168[_0xbd1b('0x42')](_0x29c841[_0xbd1b('0x43')])){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x45')});}_0x259b1e[_0xbd1b('0x46')]={'id':_0xaaa168['id']};_0x42b3a3();})[_0xbd1b('0x39')](function(_0x3747e6){_0x42b3a3(_0x3747e6);});}else if(_[_0xbd1b('0x3c')](_0x259b1e[_0xbd1b('0x3b')][_0xbd1b('0x3d')],_0xbd1b('0x47'))){validateJwt(_0x259b1e,_0x590565,_0x42b3a3);}else{if(_0x25d534){_0x42b3a3();}else{return _0x590565[_0xbd1b('0x35')](0x193)[_0xbd1b('0x44')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x259b1e[_0xbd1b('0x48')][_0xbd1b('0x49')]){try{var _0x4c4da7={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xbd1b('0x4a')]()};verifyJwt(_0x259b1e[_0xbd1b('0x48')][_0xbd1b('0x49')],_0x4c4da7)[_0xbd1b('0x4b')](function(_0x452902){return db['User'][_0xbd1b('0x40')]({'where':{'id':_0x452902['sub']}})[_0xbd1b('0x4b')](function(_0xe78c5f){_0x2b2acf=_0xe78c5f;return db['Setting'][_0xbd1b('0x31')]({'where':{'id':0x1},'attributes':[_0xbd1b('0x4c'),'blockDuration'],'raw':!![]});})['then'](function(_0x567176){if(!_0x2b2acf||!_[_0xbd1b('0x4d')](_0x2b2acf['apiKeyNonce'],_0x452902[_0xbd1b('0x4e')])){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2b2acf[_0xbd1b('0x4f')]){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});}if(_0x2b2acf[_0xbd1b('0x51')]){if(_0x567176[_0xbd1b('0x52')]>0x0){if(moment(_0x2b2acf[_0xbd1b('0x53')])[_0xbd1b('0x54')](_0x567176[_0xbd1b('0x52')],_0xbd1b('0x55'))>moment()){return _0x590565[_0xbd1b('0x35')](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});}}else{return _0x590565[_0xbd1b('0x35')](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});}}_0x259b1e['user']={'id':_0x2b2acf['id']};_0x42b3a3();});})[_0xbd1b('0x39')](function(){return _0x590565['status'](0x191)[_0xbd1b('0x44')]({'message':_0xbd1b('0x50')});});}catch(_0x3ca8ec){_0x42b3a3(_0x3ca8ec);}}else if(_0x25d534){_0x42b3a3();}else{return _0x590565['status'](0x193)[_0xbd1b('0x44')]({'message':_0xbd1b('0x56')});}})[_0xbd1b('0x3a')](function(_0x427c00,_0x2c4e03,_0x5524ab){if(_0x427c00[_0xbd1b('0x46')]){db['User'][_0xbd1b('0x40')]({'where':{'id':_0x427c00[_0xbd1b('0x46')]['id']},'attributes':userAttributes})['then'](function(_0x236ce5){if(!_0x236ce5){return _0x2c4e03['status'](0x194)[_0xbd1b('0x44')]({'message':_0xbd1b('0x57')});}_0x427c00[_0xbd1b('0x46')]=_0x236ce5;_0x5524ab();})[_0xbd1b('0x39')](function(_0x2fe39b){_0x5524ab(_0x2fe39b);});}else if(_0x25d534){_0x5524ab();}else{return _0x2c4e03[_0xbd1b('0x35')](0x194)[_0xbd1b('0x44')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xbd1b('0x58')]=function canUpdate(){return compose()[_0xbd1b('0x3a')](function(_0x32d760,_0x5e2b13,_0x31116d){return licenseUtil['getLicense']()[_0xbd1b('0x4b')](function(_0x39d72a){if(_0x39d72a[_0xbd1b('0x59')]){_0x31116d();}else{return _0x5e2b13[_0xbd1b('0x35')](0x193)[_0xbd1b('0x44')]({'message':_0xbd1b('0x5a')});}})[_0xbd1b('0x39')](function(_0x5c0467){_0x31116d(_0x5c0467);});});};exports[_0xbd1b('0x5b')]=function isWebrtcLicence(){return compose()[_0xbd1b('0x3a')](function(_0x164e01,_0x407d11,_0x41fab2){return licenseUtil['getLicense']()['then'](function(_0x25cb1e){if(_0x25cb1e[_0xbd1b('0x5c')]){_0x41fab2();}else{return _0x407d11[_0xbd1b('0x35')](0x193)[_0xbd1b('0x44')]({'message':_0xbd1b('0x5a')});}})['catch'](function(_0x57741e){_0x41fab2(_0x57741e);});});};exports[_0xbd1b('0x5d')]=function(_0x1f8d39,_0x55eb31,_0x3601ee){_0x1f8d39[_0xbd1b('0x5d')]=!![];return _0x3601ee();};exports['signToken']=function signToken(_0x3cb6fa){return signJwt(_0x3cb6fa);};exports[_0xbd1b('0x5e')]=function(_0x5f20d2,_0x5ceb15){if(!_0x5f20d2[_0xbd1b('0x46')]){return _0x5ceb15[_0xbd1b('0x35')](0x194)[_0xbd1b('0x44')]({'message':_0xbd1b('0x5f')});}var _0x434e7a={'payload':{'id':_0x5f20d2[_0xbd1b('0x46')]['id'],'role':_0x5f20d2[_0xbd1b('0x46')][_0xbd1b('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x434e7a)[_0xbd1b('0x4b')](function(_0x5238e0){_0x5ceb15['cookie'](_0xbd1b('0x60'),_0x5238e0);_0x5ceb15[_0xbd1b('0x61')](_0xbd1b('0x62'));})[_0xbd1b('0x39')](function(_0x17788d){return _0x5ceb15[_0xbd1b('0x35')](0x1f4)[_0xbd1b('0x63')](_0x17788d);});};exports[_0xbd1b('0x64')]=function(_0xcb0889){if(_['isNil'](_0xcb0889[_0xbd1b('0x65')])||_[_0xbd1b('0x66')](_0xcb0889[_0xbd1b('0x67')])){return null;}else{return createJwt(_0xcb0889);}};exports['generateApiKey']=function(_0x59af40){_0x59af40[_0xbd1b('0x65')]=generateNonce();_0x59af40[_0xbd1b('0x67')]=generateIssuedAt();return createJwt(_0x59af40);};exports[_0xbd1b('0x68')]=function(_0x2dfc42,_0x311de0){var _0x25780c=_0x2dfc42['query'][_0xbd1b('0x49')];if(_0x25780c){var _0x2554c8={'nonce':_0x311de0['apiKeyNonce'],'iat':_0x311de0[_0xbd1b('0x67')],'audience':hardwareConf[_0xbd1b('0x4a')](),'issuer':hardwareConf[_0xbd1b('0x4a')]()};return verifyJwt(_0x25780c,_0x2554c8)[_0xbd1b('0x4b')](function(){return generateApiKey(_0x311de0);});}else{throw{'message':_0xbd1b('0x69')};}};exports[_0xbd1b('0x6a')]=function(_0x2bd4ae){var _0x3fd233=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3fd233[_0xbd1b('0x6b')](_0x2bd4ae))throw new db[(_0xbd1b('0x6c'))][(_0xbd1b('0x6d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x4b1364,_0xe8527a,_0x468e1d){var _0x37df62=encryptor[_0xbd1b('0x6e')](_0xe8527a)[_0xbd1b('0x6f')](',');for(var _0x1b9220=0x0;_0x1b9220<_0x468e1d;_0x1b9220++){if(!_0x37df62[_0x1b9220])break;if(_0x4b1364[_0xbd1b('0x70')]()===_0x37df62[_0x1b9220]['toLowerCase']()){var _0x2302a1=util[_0xbd1b('0x71')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x468e1d);if(_0x468e1d===0x1){_0x2302a1=_0xbd1b('0x72');}throw new db['Sequelize']['ValidationError'](_0x2302a1);}}return;};exports[_0xbd1b('0x73')]=function(_0x36cb34,_0x3305c7){var _0x1047f0=_0x3305c7?encryptor['decryptString'](_0x3305c7)[_0xbd1b('0x6f')](','):[];if(_0x1047f0[_0xbd1b('0x74')]===0x5){_0x1047f0[_0xbd1b('0x75')](-0x1,0x1);}_0x1047f0[_0xbd1b('0x76')](_0x36cb34);return encryptor[_0xbd1b('0x77')](_0x1047f0[_0xbd1b('0x78')](','));};function signJwt(_0x15dfe5){var _0x1b4711=BPromise[_0xbd1b('0x79')](jwt[_0xbd1b('0x7a')],{'context':jwt});var _0x5590d9=_0x15dfe5[_0xbd1b('0x7b')]||config[_0xbd1b('0xb')]['session'];return new BPromise(function(_0x135549,_0x61a7c4){_0x1b4711(_0x15dfe5['payload'],_0x5590d9,_0x15dfe5[_0xbd1b('0x7c')])[_0xbd1b('0x4b')](function(_0x101e82){_0x135549(_0x101e82);})[_0xbd1b('0x39')](function(_0x16e4d9){_0x61a7c4(_0x16e4d9);});});}function verifyJwt(_0x432b48,_0x43f051,_0x45a43e){var _0x3f483e=BPromise['promisify'](jwt[_0xbd1b('0x7d')],{'context':jwt});var _0xac8464=_0x45a43e||config[_0xbd1b('0xb')][_0xbd1b('0xc')];return new BPromise(function(_0x3efbef,_0x3355d4){_0x3f483e(_0x432b48,_0xac8464,_0x43f051)['then'](function(_0x4154a2){_0x3efbef(_0x4154a2);})['catch'](function(_0x1b40b4){_0x3355d4(_0x1b40b4);});});}function generateNonce(){return crypto[_0xbd1b('0x7e')](0x10)[_0xbd1b('0x7f')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xbd1b('0x80')]()/0x3e8)[_0xbd1b('0x7f')]();}function createJwt(_0x295820){var _0x5689d0={'payload':{'iat':_0x295820[_0xbd1b('0x67')],'nonce':_0x295820['apiKeyNonce']},'options':{'algorithm':_0xbd1b('0x81'),'subject':_0x295820['id'][_0xbd1b('0x7f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xbd1b('0x4a')]()}};return signJwt(_0x5689d0)[_0xbd1b('0x4b')](function(_0x237acd){return{'iat':_0x295820[_0xbd1b('0x67')],'nonce':_0x295820[_0xbd1b('0x65')],'token':_0x237acd};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 481f686..f57298b 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 _0x78ea=['data','update','binary','write','end','close','unlink','createDecipher','final','encryptString','utf8','base64','secret','crypto','bluebird','lodash','../../config/environment','secrets','session','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createWriteStream','createCipher'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x78ea,0x105));var _0xa78e=function(_0x23edfa,_0x2f0f44){_0x23edfa=_0x23edfa-0x0;var _0x4a3030=_0x78ea[_0x23edfa];return _0x4a3030;};'use strict';var crypto=require(_0xa78e('0x0'));var fs=require('fs');var BPromise=require(_0xa78e('0x1'));var _=require(_0xa78e('0x2'));var config=require(_0xa78e('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xa78e('0x4')][_0xa78e('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa78e('0x6')};if(config[_0xa78e('0x7')]&&config[_0xa78e('0x7')][_0xa78e('0x8')]){var isSupported=isAlgorithmSupported(config[_0xa78e('0x7')][_0xa78e('0x8')]);if(isSupported){fileOptions[_0xa78e('0x8')]=config['encrypt'][_0xa78e('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xa78e('0x9')](config[_0xa78e('0x7')][_0xa78e('0x8')],_0xa78e('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4187ab){return AES_SUPPORTED_RX[_0xa78e('0xb')](_0x4187ab);}function getSupportedCiphers(){return crypto[_0xa78e('0xc')]()[_0xa78e('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x3cf553){return getSupportedCiphers()[_0xa78e('0xe')](_0x3cf553)>-0x1;}function combineOptions(_0x27b9a9){var _0x19c8cf={};for(var _0x402389 in fileOptions){if(fileOptions['hasOwnProperty'](_0x402389)){_0x19c8cf[_0x402389]=fileOptions[_0x402389];}}if(_0x27b9a9){for(var _0x54ee08 in _0x27b9a9){if(_0x27b9a9[_0xa78e('0xf')](_0x54ee08)){_0x19c8cf[_0x54ee08]=_0x27b9a9[_0x54ee08];}}}return _0x19c8cf;}exports['encryptFile']=function(_0x5d2781,_0x5478a5,_0x5e62dd,_0x4ab305){return new BPromise(function(_0x52c534,_0x1884fe){_0x4ab305=combineOptions(_0x4ab305);var _0x21b221=new Buffer(_0x5e62dd);var _0x364492=fs['createReadStream'](_0x5d2781);var _0xb303f4=fs[_0xa78e('0x10')](_0x5478a5);var _0x38b1bb=crypto[_0xa78e('0x11')](_0x4ab305['algorithm'],_0x21b221);_0x364492['on'](_0xa78e('0x12'),function(_0x9287b2){var _0x496e4b=new Buffer(_0x38b1bb[_0xa78e('0x13')](_0x9287b2),_0xa78e('0x14'));_0xb303f4[_0xa78e('0x15')](_0x496e4b);});_0x364492['on'](_0xa78e('0x16'),function(){try{var _0x1ec00b=new Buffer(_0x38b1bb['final'](_0xa78e('0x14')),_0xa78e('0x14'));_0xb303f4[_0xa78e('0x15')](_0x1ec00b);_0xb303f4['end']();_0xb303f4['on'](_0xa78e('0x17'),function(){return _0x52c534(_0x5478a5);});}catch(_0x24d4e4){fs[_0xa78e('0x18')](_0x5478a5);return _0x1884fe(_0x24d4e4);}});});};exports['decryptFile']=function(_0x5093f2,_0x1798dd,_0x22e244,_0x193752){return new BPromise(function(_0x26b700,_0x1be946){_0x193752=combineOptions(_0x193752);var _0xae286d=new Buffer(_0x22e244);var _0x58fc11=fs['createReadStream'](_0x5093f2);var _0x4979bf=fs[_0xa78e('0x10')](_0x1798dd);var _0x4c6331=crypto[_0xa78e('0x19')](_0x193752[_0xa78e('0x8')],_0xae286d);_0x58fc11['on'](_0xa78e('0x12'),function(_0x4375e5){var _0x57e5ca=new Buffer(_0x4c6331['update'](_0x4375e5),_0xa78e('0x14'));_0x4979bf['write'](_0x57e5ca);});_0x58fc11['on'](_0xa78e('0x16'),function(){try{var _0x2cccff=new Buffer(_0x4c6331[_0xa78e('0x1a')](_0xa78e('0x14')),_0xa78e('0x14'));_0x4979bf[_0xa78e('0x15')](_0x2cccff);_0x4979bf[_0xa78e('0x16')]();_0x4979bf['on']('close',function(){return _0x26b700(_0x1798dd);});}catch(_0x3ff870){fs[_0xa78e('0x18')](_0x1798dd);return _0x1be946(_0x3ff870);}});});};exports[_0xa78e('0x1b')]=function(_0x1b7bac,_0x22f910,_0x3ab41a){var _0x37556b=_0x3ab41a||stringOptions[_0xa78e('0x8')];var _0x1ad0a1=_0x22f910||stringOptions['secret'];var _0x2a394a=crypto[_0xa78e('0x11')](_0x37556b,_0x1ad0a1);var _0x8f61d=_0x2a394a[_0xa78e('0x13')](_0x1b7bac,_0xa78e('0x1c'),_0xa78e('0x1d'));_0x8f61d+=_0x2a394a[_0xa78e('0x1a')](_0xa78e('0x1d'));return _0x8f61d;};exports['decryptString']=function(_0x6931d1,_0x4919cf,_0x5f0f2f){var _0x1bb5c4=_0x5f0f2f||stringOptions[_0xa78e('0x8')];var _0x511028=_0x4919cf||stringOptions[_0xa78e('0x1e')];var _0x579001=crypto[_0xa78e('0x19')](_0x1bb5c4,_0x511028);var _0x18b086=_0x579001['update'](_0x6931d1,_0xa78e('0x1d'),_0xa78e('0x1c'));_0x18b086+=_0x579001[_0xa78e('0x1a')](_0xa78e('0x1c'));return _0x18b086;}; \ No newline at end of file +var _0x183e=['decryptFile','createDecipher','close','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','algorithm','encrypt','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','final','unlink'];(function(_0x1fcee4,_0x5de71f){var _0x56bb96=function(_0x4b9498){while(--_0x4b9498){_0x1fcee4['push'](_0x1fcee4['shift']());}};_0x56bb96(++_0x5de71f);}(_0x183e,0x6a));var _0xe183=function(_0xb837bd,_0x4186e2){_0xb837bd=_0xb837bd-0x0;var _0x5d229a=_0x183e[_0xb837bd];return _0x5d229a;};'use strict';var crypto=require(_0xe183('0x0'));var fs=require('fs');var BPromise=require(_0xe183('0x1'));var _=require(_0xe183('0x2'));var config=require(_0xe183('0x3'));var logger=require(_0xe183('0x4'))(_0xe183('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe183('0x6')][_0xe183('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt'][_0xe183('0x8')]){var isSupported=isAlgorithmSupported(config[_0xe183('0x9')][_0xe183('0x8')]);if(isSupported){fileOptions[_0xe183('0x8')]=config[_0xe183('0x9')][_0xe183('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xe183('0xa')](config[_0xe183('0x9')][_0xe183('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x304a8a){return AES_SUPPORTED_RX[_0xe183('0xb')](_0x304a8a);}function getSupportedCiphers(){return crypto[_0xe183('0xc')]()[_0xe183('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1ee673){return getSupportedCiphers()[_0xe183('0xe')](_0x1ee673)>-0x1;}function combineOptions(_0x5e243a){var _0x3195f8={};for(var _0xd119cd in fileOptions){if(fileOptions[_0xe183('0xf')](_0xd119cd)){_0x3195f8[_0xd119cd]=fileOptions[_0xd119cd];}}if(_0x5e243a){for(var _0x46271e in _0x5e243a){if(_0x5e243a[_0xe183('0xf')](_0x46271e)){_0x3195f8[_0x46271e]=_0x5e243a[_0x46271e];}}}return _0x3195f8;}exports[_0xe183('0x10')]=function(_0x586ff4,_0x50c37c,_0x13494a,_0x1a3246){return new BPromise(function(_0x1c7e41,_0x1e7708){_0x1a3246=combineOptions(_0x1a3246);var _0x44eece=new Buffer(_0x13494a);var _0x500098=fs[_0xe183('0x11')](_0x586ff4);var _0x2560c9=fs['createWriteStream'](_0x50c37c);var _0x363b79=crypto[_0xe183('0x12')](_0x1a3246[_0xe183('0x8')],_0x44eece);_0x500098['on'](_0xe183('0x13'),function(_0x5a49a2){var _0x2de5f3=new Buffer(_0x363b79[_0xe183('0x14')](_0x5a49a2),_0xe183('0x15'));_0x2560c9[_0xe183('0x16')](_0x2de5f3);});_0x500098['on'](_0xe183('0x17'),function(){try{var _0x4aa930=new Buffer(_0x363b79[_0xe183('0x18')](_0xe183('0x15')),_0xe183('0x15'));_0x2560c9[_0xe183('0x16')](_0x4aa930);_0x2560c9[_0xe183('0x17')]();_0x2560c9['on']('close',function(){return _0x1c7e41(_0x50c37c);});}catch(_0x392bfe){fs[_0xe183('0x19')](_0x50c37c);return _0x1e7708(_0x392bfe);}});});};exports[_0xe183('0x1a')]=function(_0xc189a3,_0x4e67a2,_0x4f9163,_0x41b55b){return new BPromise(function(_0x4ab252,_0x579de0){_0x41b55b=combineOptions(_0x41b55b);var _0xcb9659=new Buffer(_0x4f9163);var _0x525f6d=fs[_0xe183('0x11')](_0xc189a3);var _0x328eac=fs['createWriteStream'](_0x4e67a2);var _0x32ff60=crypto[_0xe183('0x1b')](_0x41b55b[_0xe183('0x8')],_0xcb9659);_0x525f6d['on']('data',function(_0x273c39){var _0xfe3e5e=new Buffer(_0x32ff60['update'](_0x273c39),_0xe183('0x15'));_0x328eac['write'](_0xfe3e5e);});_0x525f6d['on'](_0xe183('0x17'),function(){try{var _0x19f0be=new Buffer(_0x32ff60[_0xe183('0x18')](_0xe183('0x15')),_0xe183('0x15'));_0x328eac['write'](_0x19f0be);_0x328eac[_0xe183('0x17')]();_0x328eac['on'](_0xe183('0x1c'),function(){return _0x4ab252(_0x4e67a2);});}catch(_0x2aa47e){fs[_0xe183('0x19')](_0x4e67a2);return _0x579de0(_0x2aa47e);}});});};exports['encryptString']=function(_0x2dd972,_0x9a146f,_0x32e376){var _0x332bc3=_0x32e376||stringOptions[_0xe183('0x8')];var _0x5ccb5f=_0x9a146f||stringOptions[_0xe183('0x1d')];var _0x4b1851=crypto[_0xe183('0x12')](_0x332bc3,_0x5ccb5f);var _0xcce77=_0x4b1851[_0xe183('0x14')](_0x2dd972,'utf8',_0xe183('0x1e'));_0xcce77+=_0x4b1851['final'](_0xe183('0x1e'));return _0xcce77;};exports[_0xe183('0x1f')]=function(_0x297eab,_0xe1b6d5,_0x8ddc33){var _0x375347=_0x8ddc33||stringOptions['algorithm'];var _0x5e0fbe=_0xe1b6d5||stringOptions[_0xe183('0x1d')];var _0x20518e=crypto[_0xe183('0x1b')](_0x375347,_0x5e0fbe);var _0x5bb57d=_0x20518e[_0xe183('0x14')](_0x297eab,_0xe183('0x1e'),_0xe183('0x20'));_0x5bb57d+=_0x20518e['final']('utf8');return _0x5bb57d;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index fd3641a..e3d5e62 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 _0xf2d1=['rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.csv','join','each','csv','%s.%s','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','zip-dir'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf2d1,0xbb));var _0x1f2d=function(_0x1d2180,_0x213b79){_0x1d2180=_0x1d2180-0x0;var _0x5a56ef=_0xf2d1[_0x1d2180];return _0x5a56ef;};'use strict';var util=require(_0x1f2d('0x0'));var path=require(_0x1f2d('0x1'));var _=require(_0x1f2d('0x2'));var csv=require(_0x1f2d('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x1f2d('0x4'));var rimraf=require(_0x1f2d('0x5'));var db=require(_0x1f2d('0x6'))['db'];var dbH=require(_0x1f2d('0x6'))[_0x1f2d('0x7')];var logger=require(_0x1f2d('0x8'))(_0x1f2d('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x1f2d('0xa')][0x2]);var QUERY=process[_0x1f2d('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1116a4,_0xca56df){var _0x1b3ce6={'status':_0x1116a4};var _0x10bb53={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xca56df){_0x1b3ce6[_0x1f2d('0xb')]=_0xca56df;}return db[_0x1f2d('0xc')]['update'](_0x1b3ce6,_0x10bb53);}function main(){var _0x208989=0x1388;var _0x395311;logger[_0x1f2d('0xd')](util[_0x1f2d('0xe')](_0x1f2d('0xf'),EXTRACTED_REPORT_ID,_0x1f2d('0x10')));return db[_0x1f2d('0x11')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1f2d('0x12')]})['then'](function(_0x5aa158){if(_0x5aa158){_0x395311=_0x5aa158;_0x208989=_0x395311['splitSizeCsv']||0x1388;}})[_0x1f2d('0x13')](function(){return dbH['sequelize']['query'](util[_0x1f2d('0xe')](_0x1f2d('0x14'),QUERY),{'type':dbH[_0x1f2d('0x15')][_0x1f2d('0x16')][_0x1f2d('0x17')]});})[_0x1f2d('0x13')](function(_0x1ac2a8){if(!_0x1ac2a8[0x0][_0x1f2d('0x18')]){return analyticExtractedReport(_0x1f2d('0x19'));}var _0x40f252=[];var _0xb7146c=0x0;if(_0x395311[_0x1f2d('0x1a')]){if(_0x1ac2a8&&_0x1ac2a8[_0x1f2d('0x1b')]){var _0x5238ce=_[_0x1f2d('0x1c')](_0x1ac2a8[0x0]['num']/_0x208989);var _0x16557f=Number[_0x1f2d('0x1d')](_0x1ac2a8[0x0]['num']/_0x208989)?_0x1ac2a8[0x0][_0x1f2d('0x18')]%_0x208989:0x0;_0x5238ce[_0x1f2d('0x1e')](function(_0x38c890){if(_0x38c890>0x0){_0xb7146c+=_0x208989;}_0x40f252['push'](dbH[_0x1f2d('0x15')][_0x1f2d('0x1f')](util[_0x1f2d('0xe')](_0x1f2d('0x20'),QUERY,_0x208989,_0xb7146c),{'type':dbH[_0x1f2d('0x15')]['QueryTypes'][_0x1f2d('0x17')]}));});if(_0x16557f>0x0){_0xb7146c+=_0x208989;_0x40f252[_0x1f2d('0x21')](dbH[_0x1f2d('0x15')]['query'](util[_0x1f2d('0xe')](_0x1f2d('0x20'),QUERY,_0x16557f,_0xb7146c),{'type':dbH[_0x1f2d('0x15')][_0x1f2d('0x16')][_0x1f2d('0x17')]}));}}}else{_0x40f252[_0x1f2d('0x21')](dbH[_0x1f2d('0x15')][_0x1f2d('0x1f')](QUERY,{'type':dbH[_0x1f2d('0x15')][_0x1f2d('0x16')][_0x1f2d('0x17')]}));}var _0x574ca1=path[_0x1f2d('0x22')](PATH);var _0x524045=path['basename'](PATH,_0x1f2d('0x23'));var _0x2ba182=_0x395311[_0x1f2d('0x1a')]&&_0x40f252[_0x1f2d('0x1b')]>0x1;var _0x24289d=[];if(!fs['existsSync'](path['join'](_0x574ca1,_0x524045))&&_0x2ba182){fs['mkdirSync'](path[_0x1f2d('0x24')](_0x574ca1,_0x524045));}return BPromise[_0x1f2d('0x25')](_0x40f252,function(_0x2292a9){_0x24289d['push'](_0x2292a9);})[_0x1f2d('0x13')](function(){for(var _0x30307d=0x0;_0x30307d<_0x24289d[_0x1f2d('0x1b')];_0x30307d+=0x1){var _0x4c399d;var _0x32b8c7=_0x24289d[_0x30307d];if(_0x2ba182){_0x4c399d=path[_0x1f2d('0x24')](_0x574ca1,_0x524045,util[_0x1f2d('0xe')]('%s%d.%s',_0x524045,_0x30307d,_0x1f2d('0x26')));}else{_0x4c399d=path[_0x1f2d('0x24')](_0x574ca1,util[_0x1f2d('0xe')](_0x1f2d('0x27'),_0x524045,'csv'));}fs['writeFileSync'](_0x4c399d,csv(_0x32b8c7));}})[_0x1f2d('0x13')](function(){if(_0x2ba182){return new Promise(function(_0x4a34f5){zipdir(path[_0x1f2d('0x24')](_0x574ca1,_0x524045),{'saveTo':path['join'](_0x574ca1,util['format'](_0x1f2d('0x27'),_0x524045,_0x1f2d('0x28')))},function(_0x95ad76,_0x3ee823){rimraf(path[_0x1f2d('0x24')](_0x574ca1,_0x524045),function(){});_0x4a34f5(_0x1f2d('0x29'));});});}})[_0x1f2d('0x13')](function(){logger['info'](util[_0x1f2d('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x1f2d('0x2a'),_0x2ba182?util[_0x1f2d('0xe')](_0x1f2d('0x27'),_0x524045,_0x2ba182?_0x1f2d('0x28'):_0x1f2d('0x26')):null);});})[_0x1f2d('0x2b')](function(_0x11f0fa){logger[_0x1f2d('0xd')](util[_0x1f2d('0xe')](_0x1f2d('0x2c'),EXTRACTED_REPORT_ID,_0x1f2d('0x10')),util[_0x1f2d('0x2d')](_0x11f0fa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1f2d('0x2e')](function(){process[_0x1f2d('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0405=['splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','split','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting'];(function(_0x1e1c3c,_0x29fbff){var _0x231987=function(_0x17d05f){while(--_0x17d05f){_0x1e1c3c['push'](_0x1e1c3c['shift']());}};_0x231987(++_0x29fbff);}(_0x0405,0x16e));var _0x5040=function(_0x1d1e5b,_0x11c6c0){_0x1d1e5b=_0x1d1e5b-0x0;var _0x3458c5=_0x0405[_0x1d1e5b];return _0x3458c5;};'use strict';var util=require(_0x5040('0x0'));var path=require(_0x5040('0x1'));var _=require(_0x5040('0x2'));var csv=require(_0x5040('0x3'));var fs=require('fs');var BPromise=require(_0x5040('0x4'));var zipdir=require(_0x5040('0x5'));var rimraf=require(_0x5040('0x6'));var db=require(_0x5040('0x7'))['db'];var dbH=require('../../mysqldb')[_0x5040('0x8')];var logger=require(_0x5040('0x9'))(_0x5040('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5040('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x5040('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xcde922,_0x40f996){var _0x30770f={'status':_0xcde922};var _0x5124f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x40f996){_0x30770f[_0x5040('0xc')]=_0x40f996;}return db['AnalyticExtractedReport'][_0x5040('0xd')](_0x30770f,_0x5124f6);}function main(){var _0x419018=0x1388;var _0x2ec416;logger[_0x5040('0xe')](util[_0x5040('0xf')](_0x5040('0x10'),EXTRACTED_REPORT_ID,_0x5040('0x11')));return db[_0x5040('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})['then'](function(_0x1af360){if(_0x1af360){_0x2ec416=_0x1af360;_0x419018=_0x2ec416[_0x5040('0x13')]||0x1388;}})['then'](function(){return dbH[_0x5040('0x14')][_0x5040('0x15')](util[_0x5040('0xf')](_0x5040('0x16'),QUERY),{'type':dbH['sequelize'][_0x5040('0x17')][_0x5040('0x18')]});})[_0x5040('0x19')](function(_0x27a264){if(!_0x27a264[0x0][_0x5040('0x1a')]){return analyticExtractedReport(_0x5040('0x1b'));}var _0xbc766d=[];var _0x133983=0x0;if(_0x2ec416[_0x5040('0x1c')]){if(_0x27a264&&_0x27a264['length']){var _0x1da2ad=_[_0x5040('0x1d')](_0x27a264[0x0][_0x5040('0x1a')]/_0x419018);var _0xbcc7c9=Number[_0x5040('0x1e')](_0x27a264[0x0][_0x5040('0x1a')]/_0x419018)?_0x27a264[0x0]['num']%_0x419018:0x0;_0x1da2ad['forEach'](function(_0x44dc50){if(_0x44dc50>0x0){_0x133983+=_0x419018;}_0xbc766d[_0x5040('0x1f')](dbH[_0x5040('0x14')][_0x5040('0x15')](util['format'](_0x5040('0x20'),QUERY,_0x419018,_0x133983),{'type':dbH[_0x5040('0x14')][_0x5040('0x17')][_0x5040('0x18')]}));});if(_0xbcc7c9>0x0){_0x133983+=_0x419018;_0xbc766d[_0x5040('0x1f')](dbH[_0x5040('0x14')][_0x5040('0x15')](util[_0x5040('0xf')](_0x5040('0x20'),QUERY,_0xbcc7c9,_0x133983),{'type':dbH[_0x5040('0x14')]['QueryTypes'][_0x5040('0x18')]}));}}}else{_0xbc766d[_0x5040('0x1f')](dbH[_0x5040('0x14')]['query'](QUERY,{'type':dbH[_0x5040('0x14')]['QueryTypes'][_0x5040('0x18')]}));}var _0x29fd1e=path[_0x5040('0x21')](PATH);var _0x405711=path[_0x5040('0x22')](PATH,_0x5040('0x23'));var _0x588b02=_0x2ec416[_0x5040('0x1c')]&&_0xbc766d[_0x5040('0x24')]>0x1;var _0x4e1912=[];if(!fs[_0x5040('0x25')](path['join'](_0x29fd1e,_0x405711))&&_0x588b02){fs[_0x5040('0x26')](path[_0x5040('0x27')](_0x29fd1e,_0x405711));}return BPromise[_0x5040('0x28')](_0xbc766d,function(_0x46e0ef){_0x4e1912[_0x5040('0x1f')](_0x46e0ef);})[_0x5040('0x19')](function(){for(var _0x23f808=0x0;_0x23f808<_0x4e1912[_0x5040('0x24')];_0x23f808+=0x1){var _0x363088;var _0x5f1efc=_0x4e1912[_0x23f808];if(_0x588b02){_0x363088=path[_0x5040('0x27')](_0x29fd1e,_0x405711,util[_0x5040('0xf')](_0x5040('0x29'),_0x405711,_0x23f808,_0x5040('0x2a')));}else{_0x363088=path['join'](_0x29fd1e,util[_0x5040('0xf')](_0x5040('0x2b'),_0x405711,_0x5040('0x2a')));}fs[_0x5040('0x2c')](_0x363088,csv(_0x5f1efc));}})[_0x5040('0x19')](function(){if(_0x588b02){return new Promise(function(_0x5baca1){zipdir(path[_0x5040('0x27')](_0x29fd1e,_0x405711),{'saveTo':path[_0x5040('0x27')](_0x29fd1e,util[_0x5040('0xf')]('%s.%s',_0x405711,_0x5040('0x2d')))},function(_0x4877b0,_0x34b042){rimraf(path[_0x5040('0x27')](_0x29fd1e,_0x405711),function(){});_0x5baca1(_0x5040('0x2e'));});});}})[_0x5040('0x19')](function(){logger[_0x5040('0xe')](util[_0x5040('0xf')](_0x5040('0x2f'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x5040('0x30'),_0x588b02?util[_0x5040('0xf')](_0x5040('0x2b'),_0x405711,_0x588b02?_0x5040('0x2d'):_0x5040('0x2a')):null);});})[_0x5040('0x31')](function(_0x7b338e){logger[_0x5040('0xe')](util[_0x5040('0xf')](_0x5040('0x32'),EXTRACTED_REPORT_ID,_0x5040('0x11')),util[_0x5040('0x33')](_0x7b338e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5040('0x34'));})[_0x5040('0x35')](function(){process[_0x5040('0x36')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index cbb3e6f..4a61e7f 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 _0x2f6a=['query','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','pageBreak','before','margin','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','isInteger','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2f6a,0xe6));var _0xa2f6=function(_0x47a0d3,_0x27102d){_0x47a0d3=_0x47a0d3-0x0;var _0x4b81fc=_0x2f6a[_0x47a0d3];return _0x4b81fc;};'use strict';var _=require(_0xa2f6('0x0'));var fs=require('fs');var util=require(_0xa2f6('0x1'));var path=require(_0xa2f6('0x2'));var moment=require(_0xa2f6('0x3'));var htmlToPdfmake=require(_0xa2f6('0x4'));var PdfPrinter=require(_0xa2f6('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0xa2f6('0x6'));var JSDOM=require(_0xa2f6('0x7'))[_0xa2f6('0x8')];var window=new JSDOM('')[_0xa2f6('0x9')];var BPromise=require(_0xa2f6('0xa'));var db=require(_0xa2f6('0xb'))['db'];var dbH=require(_0xa2f6('0xb'))[_0xa2f6('0xc')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa2f6('0xd')][0x2]);var QUERY=process[_0xa2f6('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xa2f6('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x11d75d,_0x1d63b4){var _0x2c9010={'status':_0x11d75d};var _0x5f4178={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1d63b4){_0x2c9010[_0xa2f6('0xe')]=_0x1d63b4;}return db[_0xa2f6('0xf')][_0xa2f6('0x10')](_0x2c9010,_0x5f4178);}function getHeaders(_0x3a267a){return _[_0xa2f6('0x11')](_0x3a267a,function(_0x3f7032){return{'text':_0x3f7032,'style':_0xa2f6('0x12')};});}function getRows(_0xf0d59c,_0x2be26a){return _[_0xa2f6('0x11')](_0x2be26a,function(_0x28d7e0){return _(_0x28d7e0)[_0xa2f6('0x13')](_0xf0d59c)[_0xa2f6('0x11')](function(_0x43383a){return _0x43383a?_[_0xa2f6('0x14')](_0x43383a):'';})[_0xa2f6('0x15')]();});}function createTable(_0xceb621,_0x2226b9){var _0xe9c509={'widths':_['fill'](Array(_0xceb621[_0xa2f6('0x16')]),0x91),'heights':function(_0x252bfe){return _0x252bfe===0x0?_0xa2f6('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1a50be=getHeaders(_0xceb621);_0xe9c509[_0xa2f6('0x18')][_0xa2f6('0x19')](_0x1a50be);var _0x86768d=getRows(_0xceb621,_0x2226b9);_0xe9c509['body']=_0xe9c509[_0xa2f6('0x18')]['concat'](_0x86768d);return _0xe9c509;}function createTables(_0xbd5d59){var _0x15dfa4=[];var _0x5275e4=_[_0xa2f6('0x1a')](Object[_0xa2f6('0x1b')](_0xbd5d59[0x0]),0x5);_0x5275e4[_0xa2f6('0x1c')](function(_0x282946){_0x15dfa4[_0xa2f6('0x19')](createTable(_0x282946,_0xbd5d59));});return _0x15dfa4;}function getPDFDocDefinition(_0x17c4ed){var _0x15bb21=util[_0xa2f6('0x1d')](_0xa2f6('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xa2f6('0x1f')])[_0xa2f6('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xa2f6('0x20')])[_0xa2f6('0x1d')](FORMAT));var _0x5cd3d4=[];for(var _0x7f7462=0x0;_0x7f7462<_0x17c4ed[_0xa2f6('0x16')];_0x7f7462++){var _0xfd6a15=[];if(_0x7f7462===0x0){_0xfd6a15[_0xa2f6('0x19')]({'text':_0x15bb21,'style':'header'});}var _0x38606a={'table':_0x17c4ed[_0x7f7462]};if(_0x7f7462>0x0){_0x38606a[_0xa2f6('0x21')]=_0xa2f6('0x22');_0x38606a[_0xa2f6('0x23')]=[0x0,0x46,0x0,0x0];}_0xfd6a15[_0xa2f6('0x19')](_0x38606a);_0x5cd3d4[_0xa2f6('0x19')](_0xfd6a15);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5cd3d4,'footer':function(_0x2a0bda,_0x4c9309){return{'text':_0x2a0bda[_0xa2f6('0x14')]()+'\x20/\x20'+_0x4c9309,'style':_0xa2f6('0x24')};},'defaultStyle':{'font':_0xa2f6('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa2f6('0x26')},'footer':{'alignment':_0xa2f6('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x24b52a){var _0x359979=0x1388;var _0x9d4420;if(!_0x24b52a[0x0][_0xa2f6('0x28')]){return analyticExtractedReport(_0xa2f6('0x29'));}return db[_0xa2f6('0x2a')][_0xa2f6('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa2f6('0x2c')]})[_0xa2f6('0x2d')](function(_0x578492){if(_0x578492){_0x9d4420=_0x578492;_0x359979=_0x9d4420[_0xa2f6('0x2c')]||0x3e8;}})[_0xa2f6('0x2d')](function(){var _0x679a29=[];var _0xcf1eeb=0x0;if(_0x9d4420[_0xa2f6('0x2e')]){if(_0x24b52a&&_0x24b52a[_0xa2f6('0x16')]){var _0x54ed6b=_['range'](_0x24b52a[0x0][_0xa2f6('0x28')]/_0x359979);var _0x558856=Number[_0xa2f6('0x2f')](_0x24b52a[0x0]['num']/_0x359979)?_0x24b52a[0x0][_0xa2f6('0x28')]%_0x359979:0x0;_0x54ed6b[_0xa2f6('0x1c')](function(_0x459acb){if(_0x459acb>0x0){_0xcf1eeb+=_0x359979;}_0x679a29['push'](dbH[_0xa2f6('0x30')]['query'](util[_0xa2f6('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x359979,_0xcf1eeb),{'type':dbH[_0xa2f6('0x30')][_0xa2f6('0x31')][_0xa2f6('0x32')]}));});if(_0x558856>0x0){_0xcf1eeb+=_0x359979;_0x679a29['push'](dbH[_0xa2f6('0x30')]['query'](util[_0xa2f6('0x1d')](_0xa2f6('0x33'),QUERY,_0x558856,_0xcf1eeb),{'type':dbH[_0xa2f6('0x30')][_0xa2f6('0x31')]['SELECT']}));}}}else{_0x679a29[_0xa2f6('0x19')](dbH[_0xa2f6('0x30')][_0xa2f6('0x34')](QUERY,{'type':dbH[_0xa2f6('0x30')][_0xa2f6('0x31')]['SELECT']}));}var _0x59a275=path[_0xa2f6('0x35')](PATH);var _0x4c3e3b=path[_0xa2f6('0x36')](PATH,_0xa2f6('0x37'));var _0x3b18d0=_0x9d4420[_0xa2f6('0x2e')]&&_0x679a29[_0xa2f6('0x16')]>0x1;var _0x580c7b=[];if(!fs[_0xa2f6('0x38')](path[_0xa2f6('0x39')](_0x59a275,_0x4c3e3b))&&_0x3b18d0){fs[_0xa2f6('0x3a')](path[_0xa2f6('0x39')](_0x59a275,_0x4c3e3b));}return BPromise[_0xa2f6('0x3b')](_0x679a29,function(_0x37ae15){_0x580c7b[_0xa2f6('0x19')](_0x37ae15);})[_0xa2f6('0x2d')](function(){var _0x588e8b=[];for(var _0x5837f5=0x0;_0x5837f5<_0x580c7b[_0xa2f6('0x16')];_0x5837f5+=0x1){var _0x4ea327=_0x580c7b[_0x5837f5];var _0x26edf4=createTables(_[_0xa2f6('0x3c')](_0x4ea327));var _0x1f2773;var _0x79b568=getPDFDocDefinition(_0x26edf4);var _0x1dda16=getPDFPrinter();var _0x5d8c9a=_0x1dda16[_0xa2f6('0x3d')](_0x79b568);if(_0x3b18d0){_0x1f2773=path[_0xa2f6('0x39')](_0x59a275,_0x4c3e3b,util[_0xa2f6('0x1d')](_0xa2f6('0x3e'),_0x4c3e3b,_0x5837f5,'pdf'));}else{_0x1f2773=path[_0xa2f6('0x39')](_0x59a275,util['format'](_0xa2f6('0x3f'),_0x4c3e3b,_0xa2f6('0x40')));}_0x588e8b[_0xa2f6('0x19')](writePDFDocument(_0x5d8c9a,_0x1f2773));}return Promise['all'](_0x588e8b);})['then'](function(){if(_0x3b18d0){return new Promise(function(_0x3f3a17){zipdir(path[_0xa2f6('0x39')](_0x59a275,_0x4c3e3b),{'saveTo':path[_0xa2f6('0x39')](_0x59a275,util['format'](_0xa2f6('0x3f'),_0x4c3e3b,'zip'))},function(){rimraf(path['join'](_0x59a275,_0x4c3e3b),function(){});_0x3f3a17(_0xa2f6('0x41'));});});}})[_0xa2f6('0x2d')](function(){if(!_0x3b18d0)return;rimraf(path[_0xa2f6('0x39')](_0x59a275,_0x4c3e3b),function(){});})[_0xa2f6('0x2d')](function(){logger['info'](util[_0xa2f6('0x1d')](_0xa2f6('0x42'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xa2f6('0x43'),_0x3b18d0?util['format']('%s.%s',_0x4c3e3b,_0x3b18d0?_0xa2f6('0x44'):_0xa2f6('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0xa2f6('0x45'),EXTRACTED_REPORT_ID,_0xa2f6('0x46')));return db[_0xa2f6('0xf')][_0xa2f6('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa2f6('0x2d')](function(_0x3a7a81){EXTRACTED_REPORT=_0x3a7a81;return dbH['sequelize'][_0xa2f6('0x34')](util[_0xa2f6('0x1d')](_0xa2f6('0x48'),QUERY),{'type':dbH[_0xa2f6('0x30')]['QueryTypes'][_0xa2f6('0x32')]});})['then'](extractReport)[_0xa2f6('0x49')](function(_0xe223bf){logger[_0xa2f6('0x4a')](util[_0xa2f6('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa2f6('0x46')),util[_0xa2f6('0x4b')](_0xe223bf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa2f6('0x4c'));})[_0xa2f6('0x4d')](function(){process[_0xa2f6('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3b4e05=new PdfPrinter({'Arial':{'normal':__dirname+_0xa2f6('0x4f'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa2f6('0x50'),'bolditalics':__dirname+_0xa2f6('0x51')}});return _0x3b4e05;}function getPDFDocDefinitionFromHTML(_0xa91205,_0x178211){var _0x39f5c5=util[_0xa2f6('0x1d')](_0xa2f6('0x52'),_0x178211[_0xa2f6('0x53')],_0x178211[_0xa2f6('0x54')]);var _0x2eaf96=moment()[_0xa2f6('0x1d')](_0xa2f6('0x55'))['toString']();var _0x5e09a4=htmlToPdfmake(_0xa91205,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5e09a4],'defaultStyle':{'font':_0xa2f6('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa2f6('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa2f6('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xa2f6('0x57'),'style':_0xa2f6('0x58')}];},'footer':function(_0x481ccf,_0x5b703d){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x39f5c5,_0x481ccf,_0x5b703d,_0x2eaf96),'style':_0xa2f6('0x24')}];}};}function writePDFDocument(_0x3cc632,_0x4e6f21){return new Promise(function(_0x15ee28,_0x25af23){var _0xd60f04=_0x3cc632[_0xa2f6('0x59')](fs[_0xa2f6('0x5a')](_0x4e6f21));_0xd60f04['on'](_0xa2f6('0x5b'),function(){_0x15ee28(_0xa2f6('0x5b'));});_0xd60f04['on'](_0xa2f6('0x5c'),function(_0x29c792){_0x25af23(_0x29c792);});_0x3cc632['end']();});}exports[_0xa2f6('0x5d')]=function(_0x40dece,_0x244289){var _0x492a70=getPDFPrinter();var _0x2502aa=getPDFDocDefinitionFromHTML(_0x40dece,_0x244289);var _0xcca5cd=_0x492a70[_0xa2f6('0x3d')](_0x2502aa);return writePDFDocument(_0xcca5cd,_0x244289[_0xa2f6('0x2')])[_0xa2f6('0x49')](function(_0x132a7f){throw _0x132a7f;});}; \ No newline at end of file +var _0x22e9=['body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','pageBreak','before','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','split','splitSizePdf','then','range','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','tableHeader','map','pick','fill','length','auto'];(function(_0x2bb82d,_0x42c7f8){var _0x5e0b92=function(_0x19f44b){while(--_0x19f44b){_0x2bb82d['push'](_0x2bb82d['shift']());}};_0x5e0b92(++_0x42c7f8);}(_0x22e9,0x18d));var _0x922e=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0x22e9[_0x32bbb1];return _0x42b415;};'use strict';var _=require(_0x922e('0x0'));var fs=require('fs');var util=require(_0x922e('0x1'));var path=require(_0x922e('0x2'));var moment=require(_0x922e('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x922e('0x4'));var zipdir=require(_0x922e('0x5'));var rimraf=require(_0x922e('0x6'));var JSDOM=require(_0x922e('0x7'))[_0x922e('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0x922e('0x9'));var db=require(_0x922e('0xa'))['db'];var dbH=require('../../mysqldb')[_0x922e('0xb')];var logger=require(_0x922e('0xc'))(_0x922e('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x922e('0xe')][0x4];var NAME=process[_0x922e('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1282c6,_0x242abd){var _0x3a166c={'status':_0x1282c6};var _0x5e5a91={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x242abd){_0x3a166c[_0x922e('0xf')]=_0x242abd;}return db[_0x922e('0x10')]['update'](_0x3a166c,_0x5e5a91);}function getHeaders(_0x26f5b8){return _['map'](_0x26f5b8,function(_0x46edf1){return{'text':_0x46edf1,'style':_0x922e('0x11')};});}function getRows(_0x175e3d,_0x4f3f52){return _[_0x922e('0x12')](_0x4f3f52,function(_0x440466){return _(_0x440466)[_0x922e('0x13')](_0x175e3d)[_0x922e('0x12')](function(_0xc33442){return _0xc33442?_['toString'](_0xc33442):'';})['value']();});}function createTable(_0x4e7c92,_0x1f2e43){var _0x46be54={'widths':_[_0x922e('0x14')](Array(_0x4e7c92[_0x922e('0x15')]),0x91),'heights':function(_0x44da79){return _0x44da79===0x0?_0x922e('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5f42a6=getHeaders(_0x4e7c92);_0x46be54[_0x922e('0x17')][_0x922e('0x18')](_0x5f42a6);var _0x172f81=getRows(_0x4e7c92,_0x1f2e43);_0x46be54['body']=_0x46be54['body'][_0x922e('0x19')](_0x172f81);return _0x46be54;}function createTables(_0x35f23b){var _0x520874=[];var _0x19962c=_[_0x922e('0x1a')](Object[_0x922e('0x1b')](_0x35f23b[0x0]),0x5);_0x19962c[_0x922e('0x1c')](function(_0x7a17f2){_0x520874['push'](createTable(_0x7a17f2,_0x35f23b));});return _0x520874;}function getPDFDocDefinition(_0xf3b48b){var _0xfe32d4=util[_0x922e('0x1d')](_0x922e('0x1e'),NAME,EXTRACTED_REPORT[_0x922e('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0x922e('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x922e('0x1d')](FORMAT));var _0x4dd9a2=[];for(var _0x5cabd2=0x0;_0x5cabd2<_0xf3b48b[_0x922e('0x15')];_0x5cabd2++){var _0x22b0c7=[];if(_0x5cabd2===0x0){_0x22b0c7[_0x922e('0x18')]({'text':_0xfe32d4,'style':_0x922e('0x20')});}var _0x2bb885={'table':_0xf3b48b[_0x5cabd2]};if(_0x5cabd2>0x0){_0x2bb885[_0x922e('0x21')]=_0x922e('0x22');_0x2bb885['margin']=[0x0,0x46,0x0,0x0];}_0x22b0c7[_0x922e('0x18')](_0x2bb885);_0x4dd9a2[_0x922e('0x18')](_0x22b0c7);}return{'pageSize':'A4','pageOrientation':_0x922e('0x23'),'content':_0x4dd9a2,'footer':function(_0x2664b3,_0x138204){return{'text':_0x2664b3['toString']()+_0x922e('0x24')+_0x138204,'style':_0x922e('0x25')};},'defaultStyle':{'font':_0x922e('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x922e('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x44b103){var _0x45f6ff=0x1388;var _0x3d8b38;if(!_0x44b103[0x0][_0x922e('0x28')]){return analyticExtractedReport(_0x922e('0x29'));}return db[_0x922e('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x922e('0x2b'),_0x922e('0x2c')]})[_0x922e('0x2d')](function(_0x2ca4e1){if(_0x2ca4e1){_0x3d8b38=_0x2ca4e1;_0x45f6ff=_0x3d8b38[_0x922e('0x2c')]||0x3e8;}})['then'](function(){var _0x279467=[];var _0x4ac725=0x0;if(_0x3d8b38['split']){if(_0x44b103&&_0x44b103['length']){var _0x295965=_[_0x922e('0x2e')](_0x44b103[0x0][_0x922e('0x28')]/_0x45f6ff);var _0x3f5fb7=Number['isInteger'](_0x44b103[0x0][_0x922e('0x28')]/_0x45f6ff)?_0x44b103[0x0][_0x922e('0x28')]%_0x45f6ff:0x0;_0x295965[_0x922e('0x1c')](function(_0x43fc4f){if(_0x43fc4f>0x0){_0x4ac725+=_0x45f6ff;}_0x279467[_0x922e('0x18')](dbH['sequelize'][_0x922e('0x2f')](util[_0x922e('0x1d')](_0x922e('0x30'),QUERY,_0x45f6ff,_0x4ac725),{'type':dbH['sequelize'][_0x922e('0x31')][_0x922e('0x32')]}));});if(_0x3f5fb7>0x0){_0x4ac725+=_0x45f6ff;_0x279467[_0x922e('0x18')](dbH[_0x922e('0x33')][_0x922e('0x2f')](util[_0x922e('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f5fb7,_0x4ac725),{'type':dbH['sequelize'][_0x922e('0x31')][_0x922e('0x32')]}));}}}else{_0x279467[_0x922e('0x18')](dbH[_0x922e('0x33')][_0x922e('0x2f')](QUERY,{'type':dbH['sequelize'][_0x922e('0x31')][_0x922e('0x32')]}));}var _0x341e3b=path[_0x922e('0x34')](PATH);var _0x135467=path['basename'](PATH,'.pdf');var _0x46bf3d=_0x3d8b38[_0x922e('0x2b')]&&_0x279467['length']>0x1;var _0x5f0219=[];if(!fs['existsSync'](path[_0x922e('0x35')](_0x341e3b,_0x135467))&&_0x46bf3d){fs[_0x922e('0x36')](path[_0x922e('0x35')](_0x341e3b,_0x135467));}return BPromise[_0x922e('0x37')](_0x279467,function(_0x4158e4){_0x5f0219[_0x922e('0x18')](_0x4158e4);})[_0x922e('0x2d')](function(){var _0x472d6e=[];for(var _0x560fa3=0x0;_0x560fa3<_0x5f0219['length'];_0x560fa3+=0x1){var _0x59f61f=_0x5f0219[_0x560fa3];var _0x1994ff=createTables(_['flatten'](_0x59f61f));var _0x63931e;var _0x34279f=getPDFDocDefinition(_0x1994ff);var _0x280fb0=getPDFPrinter();var _0x5149ea=_0x280fb0[_0x922e('0x38')](_0x34279f);if(_0x46bf3d){_0x63931e=path[_0x922e('0x35')](_0x341e3b,_0x135467,util[_0x922e('0x1d')](_0x922e('0x39'),_0x135467,_0x560fa3,_0x922e('0x3a')));}else{_0x63931e=path[_0x922e('0x35')](_0x341e3b,util['format'](_0x922e('0x3b'),_0x135467,_0x922e('0x3a')));}_0x472d6e[_0x922e('0x18')](writePDFDocument(_0x5149ea,_0x63931e));}return Promise['all'](_0x472d6e);})[_0x922e('0x2d')](function(){if(_0x46bf3d){return new Promise(function(_0x4fd5be){zipdir(path[_0x922e('0x35')](_0x341e3b,_0x135467),{'saveTo':path[_0x922e('0x35')](_0x341e3b,util['format'](_0x922e('0x3b'),_0x135467,_0x922e('0x3c')))},function(){rimraf(path[_0x922e('0x35')](_0x341e3b,_0x135467),function(){});_0x4fd5be(_0x922e('0x3d'));});});}})[_0x922e('0x2d')](function(){if(!_0x46bf3d)return;rimraf(path[_0x922e('0x35')](_0x341e3b,_0x135467),function(){});})[_0x922e('0x2d')](function(){logger[_0x922e('0x3e')](util[_0x922e('0x1d')](_0x922e('0x3f'),EXTRACTED_REPORT_ID,_0x922e('0x40')));return analyticExtractedReport('Completed',_0x46bf3d?util[_0x922e('0x1d')]('%s.%s',_0x135467,_0x46bf3d?_0x922e('0x3c'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x922e('0x3e')](util['format'](_0x922e('0x41'),EXTRACTED_REPORT_ID,_0x922e('0x40')));return db[_0x922e('0x10')][_0x922e('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x922e('0x2d')](function(_0x41bd88){EXTRACTED_REPORT=_0x41bd88;return dbH[_0x922e('0x33')][_0x922e('0x2f')](util[_0x922e('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x922e('0x33')][_0x922e('0x31')][_0x922e('0x32')]});})[_0x922e('0x2d')](extractReport)[_0x922e('0x43')](function(_0x45ad62){logger[_0x922e('0x3e')](util[_0x922e('0x1d')](_0x922e('0x44'),EXTRACTED_REPORT_ID,_0x922e('0x40')),util[_0x922e('0x45')](_0x45ad62,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x922e('0x46'));})[_0x922e('0x47')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x34b04f=new PdfPrinter({'Arial':{'normal':__dirname+_0x922e('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x922e('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x34b04f;}function getPDFDocDefinitionFromHTML(_0x4e79e7,_0x21196a){var _0x47dc63=util[_0x922e('0x1d')](_0x922e('0x4a'),_0x21196a[_0x922e('0x4b')],_0x21196a[_0x922e('0x4c')]);var _0x2721f4=moment()[_0x922e('0x1d')](_0x922e('0x4d'))[_0x922e('0x4e')]();var _0x3b8dfb=htmlToPdfmake(_0x4e79e7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3b8dfb],'defaultStyle':{'font':_0x922e('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x922e('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x922e('0x50'),'style':_0x922e('0x20')}];},'footer':function(_0x5f0e31,_0x1c112b){return[{'text':util[_0x922e('0x1d')](_0x922e('0x51'),_0x47dc63,_0x5f0e31,_0x1c112b,_0x2721f4),'style':_0x922e('0x25')}];}};}function writePDFDocument(_0x5e9749,_0x469052){return new Promise(function(_0x33843b,_0x2f86cf){var _0x103ced=_0x5e9749['pipe'](fs['createWriteStream'](_0x469052));_0x103ced['on'](_0x922e('0x52'),function(){_0x33843b(_0x922e('0x52'));});_0x103ced['on'](_0x922e('0x53'),function(_0x145a7b){_0x2f86cf(_0x145a7b);});_0x5e9749['end']();});}exports['createPdfFromHTML']=function(_0x1572eb,_0x559548){var _0x10e415=getPDFPrinter();var _0x15053f=getPDFDocDefinitionFromHTML(_0x1572eb,_0x559548);var _0x4e1dc7=_0x10e415[_0x922e('0x38')](_0x15053f);return writePDFDocument(_0x4e1dc7,_0x559548[_0x922e('0x2')])['catch'](function(_0x2f268e){throw _0x2f268e;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 04e7697..c7e21cf 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 _0xecc5=['existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','format','Setting','find','split','then','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','length'];(function(_0xf7a64a,_0xcb9b7d){var _0x3423c6=function(_0x2a7359){while(--_0x2a7359){_0xf7a64a['push'](_0xf7a64a['shift']());}};_0x3423c6(++_0xcb9b7d);}(_0xecc5,0x1c0));var _0x5ecc=function(_0x20f012,_0x52c799){_0x20f012=_0x20f012-0x0;var _0x54d3fc=_0xecc5[_0x20f012];return _0x54d3fc;};'use strict';var util=require(_0x5ecc('0x0'));var path=require(_0x5ecc('0x1'));var _=require(_0x5ecc('0x2'));var fs=require('fs');var json2xls=require(_0x5ecc('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x5ecc('0x4'));var rimraf=require(_0x5ecc('0x5'));var db=require(_0x5ecc('0x6'))['db'];var dbH=require(_0x5ecc('0x6'))['dbH'];var logger=require(_0x5ecc('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5ecc('0x8')][0x2]);var QUERY=process[_0x5ecc('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x258e00,_0x16c2c0){var _0x5b202={'status':_0x258e00};var _0x1ef563={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16c2c0){_0x5b202[_0x5ecc('0x9')]=_0x16c2c0;}return db[_0x5ecc('0xa')]['update'](_0x5b202,_0x1ef563);}function main(){var _0x474e04=0x1388;var _0x3db6ef;logger['info'](util[_0x5ecc('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x5ecc('0xc')][_0x5ecc('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5ecc('0xe'),'splitSizeXlsx']})[_0x5ecc('0xf')](function(_0x13ff3e){if(_0x13ff3e){_0x3db6ef=_0x13ff3e;_0x474e04=_0x3db6ef[_0x5ecc('0x10')]||0x1388;}})[_0x5ecc('0xf')](function(){return dbH['sequelize'][_0x5ecc('0x11')](util[_0x5ecc('0xb')](_0x5ecc('0x12'),QUERY),{'type':dbH[_0x5ecc('0x13')][_0x5ecc('0x14')][_0x5ecc('0x15')]});})['then'](function(_0x57f147){if(!_0x57f147[0x0][_0x5ecc('0x16')]){return analyticExtractedReport(_0x5ecc('0x17'));}var _0x16e9d5=[];var _0xafc35e=0x0;if(_0x3db6ef['split']){if(_0x57f147&&_0x57f147['length']){var _0x5bac33=_[_0x5ecc('0x18')](_0x57f147[0x0]['num']/_0x474e04);var _0x21386d=Number[_0x5ecc('0x19')](_0x57f147[0x0][_0x5ecc('0x16')]/_0x474e04)?_0x57f147[0x0][_0x5ecc('0x16')]%_0x474e04:0x0;_0x5bac33[_0x5ecc('0x1a')](function(_0xffe68a){if(_0xffe68a>0x0){_0xafc35e+=_0x474e04;}_0x16e9d5[_0x5ecc('0x1b')](dbH[_0x5ecc('0x13')]['query'](util[_0x5ecc('0xb')](_0x5ecc('0x1c'),QUERY,_0x474e04,_0xafc35e),{'type':dbH[_0x5ecc('0x13')][_0x5ecc('0x14')][_0x5ecc('0x15')]}));});if(_0x21386d>0x0){_0xafc35e+=_0x474e04;_0x16e9d5[_0x5ecc('0x1b')](dbH[_0x5ecc('0x13')][_0x5ecc('0x11')](util[_0x5ecc('0xb')](_0x5ecc('0x1c'),QUERY,_0x21386d,_0xafc35e),{'type':dbH[_0x5ecc('0x13')][_0x5ecc('0x14')][_0x5ecc('0x15')]}));}}}else{_0x16e9d5[_0x5ecc('0x1b')](dbH['sequelize'][_0x5ecc('0x11')](QUERY,{'type':dbH[_0x5ecc('0x13')][_0x5ecc('0x14')][_0x5ecc('0x15')]}));}var _0x52c82b=path[_0x5ecc('0x1d')](PATH);var _0x3edaa3=path['basename'](PATH,_0x5ecc('0x1e'));var _0x2c8ebd=_0x3db6ef['split']&&_0x16e9d5[_0x5ecc('0x1f')]>0x1;var _0x42432e=[];if(!fs[_0x5ecc('0x20')](path[_0x5ecc('0x21')](_0x52c82b,_0x3edaa3))&&_0x2c8ebd){fs[_0x5ecc('0x22')](path[_0x5ecc('0x21')](_0x52c82b,_0x3edaa3));}return BPromise[_0x5ecc('0x23')](_0x16e9d5,function(_0xf09028){_0x42432e[_0x5ecc('0x1b')](_0xf09028);})[_0x5ecc('0xf')](function(){for(var _0x521dcf=0x0;_0x521dcf<_0x42432e[_0x5ecc('0x1f')];_0x521dcf+=0x1){var _0x3a0348;var _0x3c9d89=_0x42432e[_0x521dcf];if(_0x2c8ebd){_0x3a0348=path[_0x5ecc('0x21')](_0x52c82b,_0x3edaa3,util[_0x5ecc('0xb')](_0x5ecc('0x24'),_0x3edaa3,_0x521dcf,_0x5ecc('0x25')));}else{_0x3a0348=path[_0x5ecc('0x21')](_0x52c82b,util['format'](_0x5ecc('0x26'),_0x3edaa3,'xlsx'));}fs['writeFileSync'](_0x3a0348,json2xls(_0x3c9d89),_0x5ecc('0x27'));}})['then'](function(){if(_0x2c8ebd){return new Promise(function(_0x506224){zipdir(path[_0x5ecc('0x21')](_0x52c82b,_0x3edaa3),{'saveTo':path[_0x5ecc('0x21')](_0x52c82b,util[_0x5ecc('0xb')](_0x5ecc('0x26'),_0x3edaa3,'zip'))},function(_0x3a9043,_0x3b0c79){rimraf(path[_0x5ecc('0x21')](_0x52c82b,_0x3edaa3),function(){});_0x506224('zip\x20finished');});});}})[_0x5ecc('0xf')](function(){logger['info'](util[_0x5ecc('0xb')](_0x5ecc('0x28'),EXTRACTED_REPORT_ID,_0x5ecc('0x29')));return analyticExtractedReport(_0x5ecc('0x2a'),_0x2c8ebd?util['format'](_0x5ecc('0x26'),_0x3edaa3,_0x2c8ebd?_0x5ecc('0x2b'):'xlsx'):null);});})['catch'](function(_0x31056c){logger['info'](util[_0x5ecc('0xb')](_0x5ecc('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x5ecc('0x2d')](_0x31056c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5ecc('0x2e'));})[_0x5ecc('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2854=['dirname','basename','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3fc2ca,_0x216ef7){var _0x436186=function(_0x10e593){while(--_0x10e593){_0x3fc2ca['push'](_0x3fc2ca['shift']());}};_0x436186(++_0x216ef7);}(_0x2854,0xaa));var _0x4285=function(_0x1d9b61,_0x3e1b2e){_0x1d9b61=_0x1d9b61-0x0;var _0x2e8717=_0x2854[_0x1d9b61];return _0x2e8717;};'use strict';var util=require(_0x4285('0x0'));var path=require('path');var _=require(_0x4285('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x4285('0x2'));var zipdir=require(_0x4285('0x3'));var rimraf=require(_0x4285('0x4'));var db=require(_0x4285('0x5'))['db'];var dbH=require(_0x4285('0x5'))[_0x4285('0x6')];var logger=require(_0x4285('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4285('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x317416,_0x3dcea0){var _0x4f7faf={'status':_0x317416};var _0x2edd78={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3dcea0){_0x4f7faf[_0x4285('0x9')]=_0x3dcea0;}return db['AnalyticExtractedReport'][_0x4285('0xa')](_0x4f7faf,_0x2edd78);}function main(){var _0x440880=0x1388;var _0x2759c1;logger[_0x4285('0xb')](util[_0x4285('0xc')](_0x4285('0xd'),EXTRACTED_REPORT_ID,_0x4285('0xe')));return db[_0x4285('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4285('0x10'),_0x4285('0x11')]})[_0x4285('0x12')](function(_0x219bb9){if(_0x219bb9){_0x2759c1=_0x219bb9;_0x440880=_0x2759c1['splitSizeXlsx']||0x1388;}})[_0x4285('0x12')](function(){return dbH[_0x4285('0x13')][_0x4285('0x14')](util[_0x4285('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4285('0x13')][_0x4285('0x15')][_0x4285('0x16')]});})[_0x4285('0x12')](function(_0x248853){if(!_0x248853[0x0]['num']){return analyticExtractedReport(_0x4285('0x17'));}var _0x52b05b=[];var _0x1e85a4=0x0;if(_0x2759c1[_0x4285('0x10')]){if(_0x248853&&_0x248853['length']){var _0x450dbb=_[_0x4285('0x18')](_0x248853[0x0][_0x4285('0x19')]/_0x440880);var _0x148673=Number[_0x4285('0x1a')](_0x248853[0x0][_0x4285('0x19')]/_0x440880)?_0x248853[0x0]['num']%_0x440880:0x0;_0x450dbb[_0x4285('0x1b')](function(_0xc21d05){if(_0xc21d05>0x0){_0x1e85a4+=_0x440880;}_0x52b05b[_0x4285('0x1c')](dbH[_0x4285('0x13')][_0x4285('0x14')](util[_0x4285('0xc')](_0x4285('0x1d'),QUERY,_0x440880,_0x1e85a4),{'type':dbH[_0x4285('0x13')][_0x4285('0x15')][_0x4285('0x16')]}));});if(_0x148673>0x0){_0x1e85a4+=_0x440880;_0x52b05b[_0x4285('0x1c')](dbH['sequelize'][_0x4285('0x14')](util[_0x4285('0xc')](_0x4285('0x1d'),QUERY,_0x148673,_0x1e85a4),{'type':dbH['sequelize'][_0x4285('0x15')][_0x4285('0x16')]}));}}}else{_0x52b05b[_0x4285('0x1c')](dbH[_0x4285('0x13')][_0x4285('0x14')](QUERY,{'type':dbH[_0x4285('0x13')]['QueryTypes'][_0x4285('0x16')]}));}var _0x252f86=path[_0x4285('0x1e')](PATH);var _0x39af8c=path[_0x4285('0x1f')](PATH,'.xlsx');var _0x1fa890=_0x2759c1[_0x4285('0x10')]&&_0x52b05b['length']>0x1;var _0x1a1759=[];if(!fs[_0x4285('0x20')](path[_0x4285('0x21')](_0x252f86,_0x39af8c))&&_0x1fa890){fs[_0x4285('0x22')](path['join'](_0x252f86,_0x39af8c));}return BPromise[_0x4285('0x23')](_0x52b05b,function(_0x9c6fa2){_0x1a1759[_0x4285('0x1c')](_0x9c6fa2);})[_0x4285('0x12')](function(){for(var _0x11267f=0x0;_0x11267f<_0x1a1759[_0x4285('0x24')];_0x11267f+=0x1){var _0x2d0651;var _0x5d45f2=_0x1a1759[_0x11267f];if(_0x1fa890){_0x2d0651=path['join'](_0x252f86,_0x39af8c,util[_0x4285('0xc')](_0x4285('0x25'),_0x39af8c,_0x11267f,_0x4285('0x26')));}else{_0x2d0651=path[_0x4285('0x21')](_0x252f86,util['format'](_0x4285('0x27'),_0x39af8c,_0x4285('0x26')));}fs[_0x4285('0x28')](_0x2d0651,json2xls(_0x5d45f2),'binary');}})[_0x4285('0x12')](function(){if(_0x1fa890){return new Promise(function(_0x3b33bb){zipdir(path[_0x4285('0x21')](_0x252f86,_0x39af8c),{'saveTo':path[_0x4285('0x21')](_0x252f86,util[_0x4285('0xc')]('%s.%s',_0x39af8c,'zip'))},function(_0x4dc987,_0x30321c){rimraf(path[_0x4285('0x21')](_0x252f86,_0x39af8c),function(){});_0x3b33bb(_0x4285('0x29'));});});}})[_0x4285('0x12')](function(){logger[_0x4285('0xb')](util[_0x4285('0xc')](_0x4285('0x2a'),EXTRACTED_REPORT_ID,_0x4285('0xe')));return analyticExtractedReport('Completed',_0x1fa890?util['format'](_0x4285('0x27'),_0x39af8c,_0x1fa890?_0x4285('0x2b'):_0x4285('0x26')):null);});})[_0x4285('0x2c')](function(_0x287064){logger['info'](util[_0x4285('0xc')](_0x4285('0x2d'),EXTRACTED_REPORT_ID,_0x4285('0xe')),util[_0x4285('0x2e')](_0x287064,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4285('0x2f'));})[_0x4285('0x30')](function(){process[_0x4285('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 23faa49..f4759b0 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 _0x1969=['none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','hasOwnProperty','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','lodash','Interval','findAll','then','intervals','models','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','priority','extensions','push','type','Set','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat'];(function(_0x583705,_0x392a6e){var _0x2574b8=function(_0x33dafa){while(--_0x33dafa){_0x583705['push'](_0x583705['shift']());}};_0x2574b8(++_0x392a6e);}(_0x1969,0xe9));var _0x9196=function(_0x50bb34,_0x5f2e6c){_0x50bb34=_0x50bb34-0x0;var _0x8006c4=_0x1969[_0x50bb34];return _0x8006c4;};'use strict';var _=require(_0x9196('0x0'));var util=require('util');function rewrite(_0x10fe0c,_0x3e2f5f){var _0x901f6b=this;return _0x10fe0c['models'][_0x9196('0x1')][_0x9196('0x2')]({'raw':!![]})[_0x9196('0x3')](function(_0x5f350f){_0x901f6b[_0x9196('0x4')]=_0x5f350f;return _0x10fe0c[_0x9196('0x5')][_0x9196('0x6')]['findAll']({'where':{'IntervalId':_0x3e2f5f['IntervalId']},'raw':!![]});})[_0x9196('0x3')](function(_0x983a88){return _0x10fe0c[_0x9196('0x5')][_0x9196('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x9196('0x7')](_[_0x9196('0x8')](_0x983a88,'exten'))}},'order':[{'raw':_0x9196('0x9')}],'raw':!![]});})[_0x9196('0x3')](function(_0x5696b4){var _0xa8f1f=_[_0x9196('0xa')](_0x5696b4,{'priority':'1'});var _0x10f088=_[_0x9196('0xa')](_0x5696b4,{'isApp':0x1});var _0x5c94c1=_[_0x9196('0xb')](_0x10f088,_0x9196('0xc'));var _0x40d079=[_0x9196('0xd'),_0x9196('0xe')];var _0x2c1227=[];var _0x33dd31=[];for(var _0x3e45b9 in _0x5c94c1){if(_0x5c94c1['hasOwnProperty'](_0x3e45b9)){_0x901f6b[_0x9196('0xf')]=0x2;_0x901f6b['extensions']=[];_0x901f6b['extension']=_['find'](_0xa8f1f,{'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')]});_0x901f6b[_0x9196('0x10')][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':util['format']('CDR(type)=%s',_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')]),'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0]['exten'],'priority':_0x901f6b[_0x9196('0xf')]++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});if(_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')]===_0x9196('0x16')){_0x901f6b[_0x9196('0x10')]['push']({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':_0x9196('0x17')+_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')],'context':_0x5c94c1[_0x3e45b9][0x0]['context'],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b[_0x9196('0xf')]++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});}else if(_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')]===_0x9196('0x18')){if(_0x901f6b[_0x9196('0x19')]){_0x901f6b[_0x9196('0x10')][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':'Set','appdata':_0x9196('0x1a')+(_0x901f6b['extension'][_0x9196('0x1b')]?'${EXTEN:'+_0x901f6b[_0x9196('0x19')]['cutdigits']+'}':'${EXTEN}'),'context':_0x5c94c1[_0x3e45b9][0x0]['context'],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b[_0x9196('0xf')]++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0]['VoiceExtensionId']});}_0x901f6b[_0x9196('0x10')][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':_0x9196('0x17')+_0x5c94c1[_0x3e45b9][0x0]['VoiceExtensionId'],'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b['priority']++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});var _0x577569=_0x901f6b[_0x9196('0xf')]++;_0x901f6b[_0x9196('0x10')][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x1c'),'appdata':_0x9196('0x1d')+(_0x577569+0x2)+_0x9196('0x1e')+(_0x577569+0x1)+')','context':_0x5c94c1[_0x3e45b9][0x0]['context'],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x577569,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});if(_0x901f6b[_0x9196('0x19')]){_0x901f6b['extensions'][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0]['type'],'app':'Set','appdata':_0x901f6b[_0x9196('0x19')][_0x9196('0x1b')]?_0x9196('0x1f')+_0x901f6b[_0x9196('0x19')][_0x9196('0x1b')]+'}':_0x9196('0x20'),'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b['priority']++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});}_0x901f6b[_0x9196('0x10')][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':_0x9196('0x21')+_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')],'context':_0x5c94c1[_0x3e45b9][0x0]['context'],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b[_0x9196('0xf')]++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});if(_0x901f6b[_0x9196('0x19')]&&_0x901f6b['extension']['hasOwnProperty'](_0x9196('0x22'))&&_0x901f6b[_0x9196('0x19')][_0x9196('0x22')]!==_0x9196('0x23')){_0x901f6b[_0x9196('0x10')][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':'Set','appdata':_0x9196('0x24'),'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b['priority']++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});_0x901f6b['extensions']['push']({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x901f6b[_0x9196('0x19')][_0x9196('0x22')]||'wav','context':_0x5c94c1[_0x3e45b9][0x0]['context'],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b[_0x9196('0xf')]++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});}}_0x901f6b['extensions'][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0]['type'],'app':_0x9196('0x13'),'appdata':_0x9196('0x25'),'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b[_0x9196('0xf')]++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0]['VoiceExtensionId']});_0x901f6b['extensions'][_0x9196('0x11')]({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':'Set','appdata':_0x9196('0x26'),'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b['priority']++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0]['VoiceExtensionId']});_0x901f6b[_0x9196('0x10')]['push']({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':_0x9196('0x27'),'context':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x14')],'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'priority':_0x901f6b['priority']++,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});for(var _0xc72d9f=0x0,_0x2e7207=0x0;_0xc72d9f<_0x5c94c1[_0x3e45b9][_0x9196('0x28')];_0xc72d9f+=0x1,_0x2e7207=0x0){var _0x561747=_0x5c94c1[_0x3e45b9][_0xc72d9f];if(_0x561747[_0x9196('0x12')]){_0x561747[_0x9196('0x12')]=_0x561747[_0x9196('0x12')][_0x9196('0x29')]();}var _0x2dfb36=[];var _0x2c4095=[];delete _0x561747['id'];delete _0x561747['createdAt'];delete _0x561747[_0x9196('0x2a')];var _0x493896=_0x561747[_0x9196('0x2b')]!==_0x9196('0x2c')?[_0x561747[_0x9196('0x2b')]]:_0x561747['IntervalId']?_[_0x9196('0x8')](_[_0x9196('0xa')](_0x901f6b['intervals'],{'IntervalId':_0x561747[_0x9196('0x2d')]}),'interval'):[];if(_0x561747[_0x9196('0x2e')](_0x9196('0x2f'))){if(_0x561747[_0x9196('0x2f')]&&_0x561747[_0x9196('0x2f')]!=='--'){_0x2dfb36[_0x9196('0x11')]({'type':_0x561747[_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':'CDR(tag)='+_0x561747[_0x9196('0x2f')],'context':_0x561747['context'],'exten':_0x561747[_0x9196('0xc')],'priority':_0x493896[_0x9196('0x28')]+_0x901f6b[_0x9196('0xf')]+_0x2e7207++,'VoiceExtensionId':_0x561747['VoiceExtensionId']});}}if(_0x561747[_0x9196('0x12')]===_0x9196('0x18')&&_0x561747[_0x9196('0x2e')]('callerID')){if(_0x561747[_0x9196('0x30')]){_0x2dfb36[_0x9196('0x11')]({'type':_0x561747[_0x9196('0x12')],'app':_0x9196('0x1c'),'appdata':_0x9196('0x31')+_0x561747[_0x9196('0x30')]+')','context':_0x561747[_0x9196('0x14')],'exten':_0x561747[_0x9196('0xc')],'priority':_0x493896[_0x9196('0x28')]+_0x901f6b[_0x9196('0xf')]+_0x2e7207++,'VoiceExtensionId':_0x561747[_0x9196('0x15')]});}else{_0x2dfb36[_0x9196('0x11')]({'type':_0x561747[_0x9196('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x561747[_0x9196('0x14')],'exten':_0x561747[_0x9196('0xc')],'priority':_0x493896['length']+_0x901f6b[_0x9196('0xf')]+_0x2e7207++,'VoiceExtensionId':_0x561747['VoiceExtensionId']});}}if(_0x561747['hasOwnProperty'](_0x9196('0x32'))){if(_0x40d079['indexOf'](_0x561747[_0x9196('0x33')][_0x9196('0x29')]())>=0x0&&_0x561747[_0x9196('0x34')]!==_0x9196('0x35')){if(_0x561747['answer']){_0x2dfb36[_0x9196('0x11')]({'type':_0x561747[_0x9196('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x561747[_0x9196('0x14')],'exten':_0x561747['exten'],'priority':_0x493896[_0x9196('0x28')]+_0x901f6b[_0x9196('0xf')]+_0x2e7207++,'VoiceExtensionId':_0x561747[_0x9196('0x15')]});_0x2dfb36[_0x9196('0x11')]({'type':_0x561747['type'],'app':_0x9196('0x13'),'appdata':_0x9196('0x36'),'context':_0x561747[_0x9196('0x14')],'exten':_0x561747[_0x9196('0xc')],'priority':_0x493896[_0x9196('0x28')]+_0x901f6b[_0x9196('0xf')]+_0x2e7207++,'VoiceExtensionId':_0x561747[_0x9196('0x15')]});}else{_0x2dfb36[_0x9196('0x11')]({'type':_0x561747[_0x9196('0x12')],'app':_0x9196('0x1c'),'appdata':_0x9196('0x37'),'context':_0x561747['context'],'exten':_0x561747[_0x9196('0xc')],'priority':_0x493896[_0x9196('0x28')]+_0x901f6b['priority']+_0x2e7207++,'VoiceExtensionId':_0x561747[_0x9196('0x15')]});_0x2dfb36[_0x9196('0x11')]({'type':_0x561747[_0x9196('0x12')],'app':_0x9196('0x13'),'appdata':_0x9196('0x38'),'context':_0x561747['context'],'exten':_0x561747[_0x9196('0xc')],'priority':_0x493896[_0x9196('0x28')]+_0x901f6b[_0x9196('0xf')]+_0x2e7207++,'VoiceExtensionId':_0x561747[_0x9196('0x15')]});}}}for(var _0x57ead3=0x0;_0x57ead3<_0x493896['length'];_0x57ead3+=0x1){var _0x253455=_0x901f6b[_0x9196('0xf')]+_0x493896[_0x9196('0x28')];var _0x690d9a=_0x57ead3===_0x493896[_0x9196('0x28')]-0x1?_0x901f6b[_0x9196('0xf')]+_0x2dfb36[_0x9196('0x28')]+_0x2c4095[_0x9196('0x28')]+0x2:_0x901f6b['priority']+_0x57ead3+0x1;_0x2dfb36[_0x9196('0x39')](_0x57ead3,0x0,{'type':_0x561747[_0x9196('0x12')],'app':_0x9196('0x3a'),'appdata':_0x493896[_0x57ead3]+'?'+_0x561747['context']+_0x9196('0x3b')+_0x253455+':'+_0x561747[_0x9196('0x14')]+_0x9196('0x3b')+_0x690d9a,'exten':_0x561747[_0x9196('0xc')],'context':_0x561747['context'],'priority':_0x901f6b[_0x9196('0xf')]+_0x57ead3,'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});}_0x561747[_0x9196('0xf')]=_0x2dfb36[_0x9196('0x28')]?_[_0x9196('0x3c')](_0x2dfb36)[_0x9196('0xf')]+0x1:_0x901f6b[_0x9196('0xf')];_0x901f6b[_0x9196('0xf')]=(_0x2c4095[_0x9196('0x28')]?_[_0x9196('0x3c')](_0x2c4095)[_0x9196('0xf')]:_0x561747[_0x9196('0xf')])+0x1;_0x901f6b[_0x9196('0x10')]=_[_0x9196('0x3d')](_0x901f6b[_0x9196('0x10')],_0x2dfb36,[_0x561747],_0x2c4095);}_0x901f6b[_0x9196('0x10')]['push']({'type':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x12')],'app':_0x9196('0x3e'),'exten':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0xc')],'context':_0x5c94c1[_0x3e45b9][0x0]['context'],'priority':_0x901f6b[_0x9196('0xf')],'VoiceExtensionId':_0x5c94c1[_0x3e45b9][0x0][_0x9196('0x15')]});_0x2c1227['push'](_0x5c94c1[_0x3e45b9][0x0]['VoiceExtensionId']);_0x33dd31=_['concat'](_0x33dd31,_0x901f6b['extensions']);}}return _0x10fe0c[_0x9196('0x3f')](function(_0x13dfc4){return _0x10fe0c[_0x9196('0x5')][_0x9196('0x6')][_0x9196('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x2c1227}},'transaction':_0x13dfc4})[_0x9196('0x3')](function(_0x519542){return _0x10fe0c[_0x9196('0x5')][_0x9196('0x6')][_0x9196('0x41')](_[_0x9196('0x42')](_0x33dd31,_0x9196('0xf')),{'transaction':_0x13dfc4});});});})['catch'](function(_0x1f1cd5){console['error'](_0x1f1cd5);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x1134=['then','findAll','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','format','CDR(type)=%s','type','inbound','push','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','IntervalId','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','models','Interval'];(function(_0x45afc1,_0x52a029){var _0x182539=function(_0x547e72){while(--_0x547e72){_0x45afc1['push'](_0x45afc1['shift']());}};_0x182539(++_0x52a029);}(_0x1134,0x1e0));var _0x4113=function(_0x3c65cc,_0x1104b3){_0x3c65cc=_0x3c65cc-0x0;var _0x21a62d=_0x1134[_0x3c65cc];return _0x21a62d;};'use strict';var _=require(_0x4113('0x0'));var util=require('util');function rewrite(_0x1de27f,_0x53aa53){var _0x525949=this;return _0x1de27f[_0x4113('0x1')][_0x4113('0x2')]['findAll']({'raw':!![]})[_0x4113('0x3')](function(_0x4edb52){_0x525949['intervals']=_0x4edb52;return _0x1de27f['models']['VoiceExtension'][_0x4113('0x4')]({'where':{'IntervalId':_0x53aa53['IntervalId']},'raw':!![]});})['then'](function(_0x3671c5){return _0x1de27f[_0x4113('0x1')][_0x4113('0x5')][_0x4113('0x4')]({'where':{'exten':{'$in':_[_0x4113('0x6')](_[_0x4113('0x7')](_0x3671c5,'exten'))}},'order':[{'raw':_0x4113('0x8')}],'raw':!![]});})['then'](function(_0x5c0ee0){var _0x3c7ab9=_[_0x4113('0x9')](_0x5c0ee0,{'priority':'1'});var _0x24ae61=_[_0x4113('0x9')](_0x5c0ee0,{'isApp':0x1});var _0x2aeb91=_[_0x4113('0xa')](_0x24ae61,_0x4113('0xb'));var _0x126d71=[_0x4113('0xc'),_0x4113('0xd')];var _0x217b4a=[];var _0x48847a=[];for(var _0x340422 in _0x2aeb91){if(_0x2aeb91[_0x4113('0xe')](_0x340422)){_0x525949[_0x4113('0xf')]=0x2;_0x525949[_0x4113('0x10')]=[];_0x525949[_0x4113('0x11')]=_['find'](_0x3c7ab9,{'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')]});_0x525949[_0x4113('0x10')]['push']({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':'Set','appdata':util[_0x4113('0x12')](_0x4113('0x13'),_0x2aeb91[_0x340422][0x0][_0x4113('0x14')]),'context':_0x2aeb91[_0x340422][0x0]['context'],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']});if(_0x2aeb91[_0x340422][0x0]['type']===_0x4113('0x15')){_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':_0x4113('0x17'),'appdata':_0x4113('0x18')+_0x2aeb91[_0x340422][0x0][_0x4113('0x19')],'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}else if(_0x2aeb91[_0x340422][0x0][_0x4113('0x14')]===_0x4113('0x1b')){if(_0x525949['extension']){_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':'Set','appdata':'CDR(destination)='+(_0x525949[_0x4113('0x11')][_0x4113('0x1c')]?_0x4113('0x1d')+_0x525949['extension'][_0x4113('0x1c')]+'}':'${EXTEN}'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x18')+_0x2aeb91[_0x340422][0x0][_0x4113('0x19')],'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});var _0x5be9b2=_0x525949[_0x4113('0xf')]++;_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5be9b2+0x2)+_0x4113('0x1f')+(_0x5be9b2+0x1)+')','context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x5be9b2,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});if(_0x525949[_0x4113('0x11')]){_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':'Set','appdata':_0x525949[_0x4113('0x11')]['cutdigits']?_0x4113('0x20')+_0x525949[_0x4113('0x11')][_0x4113('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x2aeb91[_0x340422][0x0]['context'],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x21')+_0x2aeb91[_0x340422][0x0][_0x4113('0x19')],'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});if(_0x525949[_0x4113('0x11')]&&_0x525949['extension']['hasOwnProperty'](_0x4113('0x22'))&&_0x525949[_0x4113('0x11')][_0x4113('0x22')]!==_0x4113('0x23')){_0x525949['extensions']['push']({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});_0x525949['extensions'][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x24')+_0x525949['extension'][_0x4113('0x22')]||'wav','context':_0x2aeb91[_0x340422][0x0]['context'],'exten':_0x2aeb91[_0x340422][0x0]['exten'],'priority':_0x525949['priority']++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']});}}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':'Set','appdata':_0x4113('0x25'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});_0x525949[_0x4113('0x10')]['push']({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x26'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0]['type'],'app':_0x4113('0x17'),'appdata':_0x4113('0x27'),'context':_0x2aeb91[_0x340422][0x0][_0x4113('0x1a')],'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'priority':_0x525949[_0x4113('0xf')]++,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});for(var _0x392ef2=0x0,_0x2d97ac=0x0;_0x392ef2<_0x2aeb91[_0x340422][_0x4113('0x28')];_0x392ef2+=0x1,_0x2d97ac=0x0){var _0xa656cf=_0x2aeb91[_0x340422][_0x392ef2];if(_0xa656cf[_0x4113('0x14')]){_0xa656cf[_0x4113('0x14')]=_0xa656cf[_0x4113('0x14')][_0x4113('0x29')]();}var _0x171c1e=[];var _0x2977a3=[];delete _0xa656cf['id'];delete _0xa656cf[_0x4113('0x2a')];delete _0xa656cf[_0x4113('0x2b')];var _0x513837=_0xa656cf['interval']!==_0x4113('0x2c')?[_0xa656cf[_0x4113('0x2d')]]:_0xa656cf[_0x4113('0x2e')]?_[_0x4113('0x7')](_[_0x4113('0x9')](_0x525949[_0x4113('0x2f')],{'IntervalId':_0xa656cf['IntervalId']}),_0x4113('0x2d')):[];if(_0xa656cf[_0x4113('0xe')]('tag')){if(_0xa656cf[_0x4113('0x30')]&&_0xa656cf['tag']!=='--'){_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':'CDR(tag)='+_0xa656cf[_0x4113('0x30')],'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf['exten'],'priority':_0x513837['length']+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}}if(_0xa656cf[_0x4113('0x14')]===_0x4113('0x1b')&&_0xa656cf[_0x4113('0xe')]('callerID')){if(_0xa656cf[_0x4113('0x31')]){_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x1e'),'appdata':_0x4113('0x32')+_0xa656cf[_0x4113('0x31')]+')','context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949['priority']+_0x2d97ac++,'VoiceExtensionId':_0xa656cf['VoiceExtensionId']});}else{_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf['type'],'app':_0x4113('0x1e'),'appdata':_0x4113('0x33'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf['exten'],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}}if(_0xa656cf['hasOwnProperty']('answer')){if(_0x126d71['indexOf'](_0xa656cf[_0x4113('0x34')]['toLowerCase']())>=0x0&&_0xa656cf['appType']!==_0x4113('0x35')){if(_0xa656cf[_0x4113('0x36')]){_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf['type'],'app':'ExecIf','appdata':_0x4113('0x37'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x17'),'appdata':_0x4113('0x38'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}else{_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf[_0x4113('0x14')],'app':_0x4113('0x1e'),'appdata':_0x4113('0x39'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf['VoiceExtensionId']});_0x171c1e[_0x4113('0x16')]({'type':_0xa656cf['type'],'app':_0x4113('0x17'),'appdata':_0x4113('0x3a'),'context':_0xa656cf[_0x4113('0x1a')],'exten':_0xa656cf[_0x4113('0xb')],'priority':_0x513837[_0x4113('0x28')]+_0x525949[_0x4113('0xf')]+_0x2d97ac++,'VoiceExtensionId':_0xa656cf[_0x4113('0x19')]});}}}for(var _0x521bbd=0x0;_0x521bbd<_0x513837['length'];_0x521bbd+=0x1){var _0x4409e7=_0x525949[_0x4113('0xf')]+_0x513837['length'];var _0x8e8207=_0x521bbd===_0x513837['length']-0x1?_0x525949[_0x4113('0xf')]+_0x171c1e[_0x4113('0x28')]+_0x2977a3[_0x4113('0x28')]+0x2:_0x525949[_0x4113('0xf')]+_0x521bbd+0x1;_0x171c1e['splice'](_0x521bbd,0x0,{'type':_0xa656cf[_0x4113('0x14')],'app':'GotoIfTime','appdata':_0x513837[_0x521bbd]+'?'+_0xa656cf[_0x4113('0x1a')]+',${EXTEN},'+_0x4409e7+':'+_0xa656cf[_0x4113('0x1a')]+_0x4113('0x3b')+_0x8e8207,'exten':_0xa656cf[_0x4113('0xb')],'context':_0xa656cf[_0x4113('0x1a')],'priority':_0x525949[_0x4113('0xf')]+_0x521bbd,'VoiceExtensionId':_0x2aeb91[_0x340422][0x0][_0x4113('0x19')]});}_0xa656cf[_0x4113('0xf')]=_0x171c1e[_0x4113('0x28')]?_[_0x4113('0x3c')](_0x171c1e)[_0x4113('0xf')]+0x1:_0x525949[_0x4113('0xf')];_0x525949[_0x4113('0xf')]=(_0x2977a3[_0x4113('0x28')]?_[_0x4113('0x3c')](_0x2977a3)[_0x4113('0xf')]:_0xa656cf['priority'])+0x1;_0x525949['extensions']=_[_0x4113('0x3d')](_0x525949[_0x4113('0x10')],_0x171c1e,[_0xa656cf],_0x2977a3);}_0x525949[_0x4113('0x10')][_0x4113('0x16')]({'type':_0x2aeb91[_0x340422][0x0][_0x4113('0x14')],'app':_0x4113('0x3e'),'exten':_0x2aeb91[_0x340422][0x0][_0x4113('0xb')],'context':_0x2aeb91[_0x340422][0x0]['context'],'priority':_0x525949['priority'],'VoiceExtensionId':_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']});_0x217b4a['push'](_0x2aeb91[_0x340422][0x0]['VoiceExtensionId']);_0x48847a=_[_0x4113('0x3d')](_0x48847a,_0x525949[_0x4113('0x10')]);}}return _0x1de27f[_0x4113('0x3f')](function(_0x2996dd){return _0x1de27f['models'][_0x4113('0x5')][_0x4113('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x217b4a}},'transaction':_0x2996dd})[_0x4113('0x3')](function(_0x9cb899){return _0x1de27f['models'][_0x4113('0x5')][_0x4113('0x41')](_[_0x4113('0x42')](_0x48847a,_0x4113('0xf')),{'transaction':_0x2996dd});});});})['catch'](function(_0x24a67b){console[_0x4113('0x43')](_0x24a67b);});}exports[_0x4113('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9514837..c9bcc17 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 _0x8aa6=['error','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','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','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','toString','NOW()','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','outbound','dialCheckDuplicateType','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','VoiceQueue','findAll','CmList','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','squel','ioredis','../../../mysqldb','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x8aa6,0x1a6));var _0x68aa=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0x8aa6[_0x1f5887];return _0x21774b;};'use strict';var BPromise=require(_0x68aa('0x0'));var util=require(_0x68aa('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x68aa('0x2'));var Papa=require('papaparse');var Redis=require(_0x68aa('0x3'));var db=require(_0x68aa('0x4'))['db'];var config=require(_0x68aa('0x5'));var logger=require('../../../config/logger')(_0x68aa('0x6'));config['redis']=_['defaults'](config[_0x68aa('0x7')],{'host':_0x68aa('0x8'),'port':0x18eb});var socket=require(_0x68aa('0x9'))(new Redis(config[_0x68aa('0x7')]));require(_0x68aa('0xa'))[_0x68aa('0xb')](socket);try{if(!process[_0x68aa('0xc')][0x2]||process[_0x68aa('0xc')][0x2]===_0x68aa('0xd')||process[_0x68aa('0xc')][0x2]===_0x68aa('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x68aa('0xc')][0x2];if(!process['argv'][0x3]||process[_0x68aa('0xc')][0x3]==='undefined'||process[_0x68aa('0xc')][0x3]===_0x68aa('0xe')||!process[_0x68aa('0xc')][0x4]||process[_0x68aa('0xc')][0x4]==='undefined'||process[_0x68aa('0xc')][0x4]==='null'){throw new Error(_0x68aa('0xf'));}var FIELDS=_[_0x68aa('0x10')](process[_0x68aa('0xc')][0x3][_0x68aa('0x11')](','),process['argv'][0x4][_0x68aa('0x11')](','));if(!process[_0x68aa('0xc')][0x5]||process[_0x68aa('0xc')][0x5]==='undefined'||process[_0x68aa('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x68aa('0xc')][0x5];var COMPANYID=process[_0x68aa('0xc')][0x6]&&process[_0x68aa('0xc')][0x6]!==_0x68aa('0xd')&&process[_0x68aa('0xc')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x68aa('0xc')][0x7]&&process[_0x68aa('0xc')][0x7]!==_0x68aa('0xd')&&process[_0x68aa('0xc')][0x7]!==_0x68aa('0xe')?process[_0x68aa('0xc')][0x7]:null;if(!process[_0x68aa('0xc')][0x8]||process[_0x68aa('0xc')][0x8]===_0x68aa('0xd')||process['argv'][0x8]===_0x68aa('0xe')){throw new Error(_0x68aa('0x12'));}var SOCKET_TIMESTAMP=process[_0x68aa('0xc')][0x8];}catch(_0x16ba1a){logger['error'](_0x16ba1a);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(_0x58f658,_0x4fbc37,_0x3d864b,_0x51de90){var _0x1740ac={'message':_0x4fbc37};_0x1740ac[_0x58f658]=!![];if(_0x3d864b){_0x1740ac[_0x68aa('0x13')]=_0x3d864b;}if(_0x51de90){_0x1740ac[_0x68aa('0x14')]=_0x51de90;}return _0x1740ac;}function isEmail(_0x33df52){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))*$/[_0x68aa('0x15')](_0x33df52);}function checkRow(_0x1afd29,_0x87c5c8,_0x2a0745){return new BPromise(function(_0x998d4d,_0x31b5cf){if(_['isNil'](_0x1afd29)){return _0x31b5cf(handleCheckRowError(_0x68aa('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2a0745));}if(_0x1afd29[_0x68aa('0x17')]&&_0x1afd29['errors'][_0x68aa('0x18')]){var _0x1418cb=_[_0x68aa('0x19')](_0x1afd29[_0x68aa('0x17')],_0x68aa('0x1a'))['join'](';');return _0x31b5cf(handleCheckRowError(_0x68aa('0x16'),_0x1418cb,null,_0x2a0745));}var _0x18b5e1={};for(var _0x5cb056 in FIELDS){if(FIELDS[_0x68aa('0x1b')](_0x5cb056)&&FIELDS[_0x5cb056]){_0x18b5e1[_0x5cb056]=_0x1afd29[_0x68aa('0x1c')][0x0][FIELDS[_0x5cb056]]||_0x1afd29['data'][0x0]['\ufeff'+FIELDS[_0x5cb056]];}}if(!_0x18b5e1[_0x68aa('0x1d')]){return _0x31b5cf(handleCheckRowError('error',_0x68aa('0x1e'),null,_0x2a0745));}if(!_0x18b5e1[_0x68aa('0x1f')]){return _0x31b5cf(handleCheckRowError(_0x68aa('0x16'),_0x68aa('0x20'),null,_0x2a0745));}if(_0x18b5e1['birthDate']){var _0x4e3519=moment(_0x18b5e1[_0x68aa('0x21')],_0x68aa('0x22'));if(!_0x4e3519[_0x68aa('0x23')]()){return _0x31b5cf(handleCheckRowError(_0x68aa('0x16'),_0x68aa('0x24'),null,_0x2a0745));}}if(_0x18b5e1[_0x68aa('0x25')]){if(!isEmail(_0x18b5e1['email'])){return _0x31b5cf(handleCheckRowError(_0x68aa('0x16'),_0x68aa('0x26'),null,_0x2a0745));}}_0x18b5e1[_0x68aa('0x27')]=LISTID;_0x18b5e1[_0x68aa('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x68aa('0x18')]&&_0x87c5c8){var _0x148243={};for(var _0x5306fa=0x0,_0x4043e3=DUPLICATES['length'];_0x5306fa<_0x4043e3;_0x5306fa+=0x1){_0x148243[DUPLICATES[_0x5306fa]]=_0x18b5e1[DUPLICATES[_0x5306fa]];}var _0x1db393=_[_0x68aa('0x29')](_0x87c5c8,_0x148243);if(_0x1db393){return _0x31b5cf(handleCheckRowError(_0x68aa('0x2a'),_0x68aa('0x2b'),_0x1db393,_0x2a0745));}}return db[_0x68aa('0x2c')][_0x68aa('0x2d')](_0x18b5e1,{'raw':!![],'hooks':![],'fields':_[_0x68aa('0x2e')](_0x18b5e1)})[_0x68aa('0x2f')](function(_0x38443f){if(DUPLICATES&&DUPLICATES[_0x68aa('0x18')]&&_0x87c5c8){_0x87c5c8[_0x68aa('0x30')](_[_0x68aa('0x31')](_0x18b5e1,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x38443f['id'];return _0x998d4d();})[_0x68aa('0x32')](function(_0x43bdfb){return _0x31b5cf(handleCheckRowError(_0x68aa('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x43bdfb[_0x68aa('0x1a')]||JSON[_0x68aa('0x33')](_0x43bdfb)),null,_0x2a0745));});});}function checkHopper(){function _0x438433(){return function(_0xb0b3cb){logger[_0x68aa('0x16')]('cmContact',_0x68aa('0x34'),util[_0x68aa('0x35')](_0xb0b3cb,{'showHidden':![],'depth':null}));};}var _0x16c716=function(_0x555008,_0x34e814){var _0x58e59f=squel[_0x68aa('0x36')]()[_0x68aa('0x37')](_0x68aa('0x38'))[_0x68aa('0x39')]([_0x68aa('0x1f'),_0x68aa('0x3a'),_0x68aa('0x3b'),_0x68aa('0x27'),_0x34e814,_0x68aa('0x3c'),'updatedAt'],squel[_0x68aa('0x3d')]()['field'](_0x68aa('0x1f'),'phone')[_0x68aa('0x3e')]('NOW()',_0x68aa('0x3a'))[_0x68aa('0x3e')]('id','ContactId')[_0x68aa('0x3e')](LISTID[_0x68aa('0x3f')](),_0x68aa('0x27'))['field'](_0x555008['id'][_0x68aa('0x3f')](),_0x34e814)[_0x68aa('0x3e')](_0x68aa('0x40'),_0x68aa('0x3c'))[_0x68aa('0x3e')](_0x68aa('0x40'),_0x68aa('0x41'))[_0x68aa('0x42')](_0x68aa('0x43'))[_0x68aa('0x44')](_0x68aa('0x45'))['where']('ListId\x20=\x20?',LISTID[_0x68aa('0x3f')]())[_0x68aa('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x68aa('0x44')](_0x68aa('0x46'),squel[_0x68aa('0x3d')]()[_0x68aa('0x3e')]('phone')[_0x68aa('0x42')](_0x68aa('0x38'))[_0x68aa('0x44')](_0x34e814+_0x68aa('0x47'),_0x555008['id'][_0x68aa('0x3f')]())))[_0x68aa('0x3f')]();return _0x58e59f;};var _0x3763af=function(_0x29153e,_0x1cc8ad){var _0x21ce77=squel[_0x68aa('0x36')]()[_0x68aa('0x37')](_0x68aa('0x38'))[_0x68aa('0x39')](['phone',_0x68aa('0x3a'),_0x68aa('0x3b'),_0x68aa('0x27'),_0x1cc8ad,_0x68aa('0x3c'),_0x68aa('0x41')],squel[_0x68aa('0x3d')]()['field']('phone',_0x68aa('0x1f'))['field'](_0x68aa('0x40'),_0x68aa('0x3a'))['field']('id',_0x68aa('0x3b'))['field'](LISTID[_0x68aa('0x3f')](),_0x68aa('0x27'))[_0x68aa('0x3e')](_0x29153e['id'][_0x68aa('0x3f')](),_0x1cc8ad)['field']('NOW()',_0x68aa('0x3c'))['field'](_0x68aa('0x40'),'updatedAt')['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x68aa('0x44')](_0x68aa('0x48'),LISTID[_0x68aa('0x3f')]())[_0x68aa('0x44')](_0x68aa('0x49'),squel[_0x68aa('0x4a')](hopperContacts))[_0x68aa('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x68aa('0x46'),squel[_0x68aa('0x3d')]()['field'](_0x68aa('0x4b'))['from'](_0x68aa('0x4c'))[_0x68aa('0x44')](_0x1cc8ad+_0x68aa('0x47'),_0x29153e['id'][_0x68aa('0x3f')]()))[_0x68aa('0x44')](_0x68aa('0x46'),squel[_0x68aa('0x3d')]()[_0x68aa('0x3e')](_0x68aa('0x1f'))['from'](_0x68aa('0x38'))[_0x68aa('0x44')](_0x1cc8ad+'\x20=\x20?',_0x29153e['id'][_0x68aa('0x3f')]())))[_0x68aa('0x3f')]();return _0x21ce77;};function _0x5d5c00(_0x4bd825,_0x2b6c68){var _0xa2e8fa=squel[_0x68aa('0x36')]()['into'](_0x68aa('0x38'))['fromQuery'](['phone','scheduledAt','ContactId',_0x68aa('0x27'),_0x2b6c68,'createdAt','updatedAt'],squel[_0x68aa('0x3d')]()[_0x68aa('0x3e')]('phone',_0x68aa('0x1f'))['field'](_0x68aa('0x40'),_0x68aa('0x3a'))[_0x68aa('0x3e')]('id',_0x68aa('0x3b'))[_0x68aa('0x3e')](LISTID[_0x68aa('0x3f')](),_0x68aa('0x27'))[_0x68aa('0x3e')](_0x4bd825['id'][_0x68aa('0x3f')](),_0x2b6c68)[_0x68aa('0x3e')](_0x68aa('0x40'),'createdAt')[_0x68aa('0x3e')](_0x68aa('0x40'),'updatedAt')[_0x68aa('0x42')](_0x68aa('0x43'))[_0x68aa('0x44')](_0x68aa('0x45'))[_0x68aa('0x44')](_0x68aa('0x48'),LISTID[_0x68aa('0x3f')]())[_0x68aa('0x44')](_0x68aa('0x49'),squel['str'](hopperContacts))[_0x68aa('0x44')](_0x68aa('0x4d')))[_0x68aa('0x3f')]();return _0xa2e8fa;}function _0x1026b9(_0x120a42,_0x2fbab6){var _0x1677cf=squel[_0x68aa('0x36')]()[_0x68aa('0x37')](_0x68aa('0x4e'))[_0x68aa('0x39')]([_0x68aa('0x1f'),'ContactId',_0x68aa('0x27'),_0x2fbab6,_0x68aa('0x3c'),_0x68aa('0x41')],squel[_0x68aa('0x3d')]()[_0x68aa('0x3e')](_0x68aa('0x1f'),'phone')[_0x68aa('0x3e')]('id','ContactId')['field'](LISTID[_0x68aa('0x3f')](),'ListId')['field'](_0x120a42['id']['toString'](),_0x2fbab6)[_0x68aa('0x3e')](_0x68aa('0x40'),_0x68aa('0x3c'))['field'](_0x68aa('0x40'),_0x68aa('0x41'))[_0x68aa('0x42')](_0x68aa('0x43'))[_0x68aa('0x44')](_0x68aa('0x45'))[_0x68aa('0x44')](_0x68aa('0x48'),LISTID[_0x68aa('0x3f')]())[_0x68aa('0x44')](_0x68aa('0x49'),squel[_0x68aa('0x4a')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x68aa('0x3f')]();return _0x1677cf;}return db['VoiceQueue']['findAll']({'where':{'type':_0x68aa('0x4f')},'attributes':['id',_0x68aa('0x50')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x68aa('0x2f')](function(_0x9c8f9d){var _0xabf26d=[];if(_0x9c8f9d){var _0x177442;for(var _0x3f4276=0x0,_0xb62d2b;_0x3f4276<_0x9c8f9d['length'];_0x3f4276+=0x1){_0xb62d2b=_0x9c8f9d[_0x3f4276][_0x68aa('0x51')]({'plain':!![]});switch(_0xb62d2b[_0x68aa('0x50')]){case _0x68aa('0x52'):_0xabf26d[_0x68aa('0x30')](db['sequelize'][_0x68aa('0x53')](_0x3763af(_0xb62d2b,_0x68aa('0x54')))[_0x68aa('0x2f')](function(){})[_0x68aa('0x32')](_0x438433()));break;case _0x68aa('0x55'):_0xabf26d[_0x68aa('0x30')](db[_0x68aa('0x56')][_0x68aa('0x53')](_0x16c716(_0xb62d2b,_0x68aa('0x54')))[_0x68aa('0x2f')](function(){})[_0x68aa('0x32')](_0x438433()));break;default:_0xabf26d[_0x68aa('0x30')](db[_0x68aa('0x56')][_0x68aa('0x53')](_0x5d5c00(_0xb62d2b,_0x68aa('0x54')))[_0x68aa('0x2f')](function(){})['catch'](_0x438433()));}}}return _0xabf26d;})[_0x68aa('0x57')]()['then'](function(){return db[_0x68aa('0x58')][_0x68aa('0x59')]({'where':{'type':_0x68aa('0x4f')},'attributes':['id'],'include':[{'model':db[_0x68aa('0x5a')],'as':_0x68aa('0x5b'),'where':{'id':LISTID}}]})[_0x68aa('0x2f')](function(_0x4aefd9){var _0x179b18=[];if(_0x4aefd9){var _0x2be175;for(var _0xf82616=0x0,_0xd0f9d0;_0xf82616<_0x4aefd9[_0x68aa('0x18')];_0xf82616+=0x1){_0xd0f9d0=_0x4aefd9[_0xf82616][_0x68aa('0x51')]({'plain':!![]});_0x179b18[_0x68aa('0x30')](db[_0x68aa('0x56')][_0x68aa('0x53')](_0x1026b9(_0xd0f9d0,_0x68aa('0x54')))[_0x68aa('0x2f')](function(){})[_0x68aa('0x32')](_0x438433()));}}return _0x179b18;})[_0x68aa('0x57')]();})[_0x68aa('0x2f')](function(){return db[_0x68aa('0x5c')][_0x68aa('0x59')]({'attributes':['id',_0x68aa('0x50')],'include':[{'model':db[_0x68aa('0x5a')],'as':_0x68aa('0x5d'),'where':{'id':LISTID}}]})[_0x68aa('0x2f')](function(_0x59d5a1){var _0x56bb58=[];if(_0x59d5a1){for(var _0x795307=0x0,_0x528835;_0x795307<_0x59d5a1['length'];_0x795307+=0x1){_0x528835=_0x59d5a1[_0x795307][_0x68aa('0x51')]({'plain':!![]});switch(_0x528835[_0x68aa('0x50')]){case _0x68aa('0x52'):_0x56bb58[_0x68aa('0x30')](db[_0x68aa('0x56')][_0x68aa('0x53')](_0x3763af(_0x528835,_0x68aa('0x5e')))[_0x68aa('0x2f')](function(){})['catch'](_0x438433()));break;case _0x68aa('0x55'):_0x56bb58[_0x68aa('0x30')](db[_0x68aa('0x56')][_0x68aa('0x53')](_0x16c716(_0x528835,'CampaignId'))[_0x68aa('0x2f')](function(){})[_0x68aa('0x32')](_0x438433()));break;default:_0x56bb58[_0x68aa('0x30')](db['sequelize']['query'](_0x5d5c00(_0x528835,_0x68aa('0x5e')))[_0x68aa('0x2f')](function(){})[_0x68aa('0x32')](_0x438433()));}}}return _0x56bb58;})['all']();})[_0x68aa('0x2f')](function(){return db[_0x68aa('0x5c')][_0x68aa('0x59')]({'attributes':['id'],'include':[{'model':db[_0x68aa('0x5a')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x15f1a4){var _0x4f2509=[];if(_0x15f1a4){for(var _0x40a07c=0x0,_0x2bc012;_0x40a07c<_0x15f1a4[_0x68aa('0x18')];_0x40a07c+=0x1){_0x2bc012=_0x15f1a4[_0x40a07c]['get']({'plain':!![]});_0x4f2509[_0x68aa('0x30')](db[_0x68aa('0x56')][_0x68aa('0x53')](_0x1026b9(_0x2bc012,_0x68aa('0x5e')))[_0x68aa('0x2f')](function(){})['catch'](_0x438433()));}}return _0x4f2509;})[_0x68aa('0x57')]();})[_0x68aa('0x32')](function(_0x2aad6d){logger[_0x68aa('0x16')](_0x68aa('0x5f'),_0x68aa('0x60'),_0x2aad6d[_0x68aa('0x1a')]);});}var processPromises=function(_0x19392b){return BPromise[_0x68aa('0x57')](promises)[_0x68aa('0x2f')](function(_0x9412f1){})[_0x68aa('0x32')](function(_0x5253fa){logger[_0x68aa('0x16')](_0x68aa('0x61'),JSON['stringify'](_0x5253fa));})['finally'](function(){socket[_0x68aa('0x62')](_0x68aa('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x19392b){return _0x19392b[_0x68aa('0x64')]();}});};var endCsv=function(){return BPromise[_0x68aa('0x65')]()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x68aa('0x62')](_0x68aa('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x68aa('0x66')](FILEPATH);}catch(_0xc54357){logger[_0x68aa('0x16')](_0x68aa('0x67'),JSON['stringify'](_0xc54357));}finally{process[_0x68aa('0x68')](0x0);}});};process['on'](_0x68aa('0x69'),function(){logger[_0x68aa('0x6a')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x68aa('0x65')]()[_0x68aa('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x68aa('0x11')](',');return db[_0x68aa('0x2c')][_0x68aa('0x59')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x145d54){var _0x2bcc85=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x68aa('0x6b')](_0x2bcc85,{'header':!![],'skipEmptyLines':!![],'step':function(_0x30d886,_0x363435){total+=0x1;var _0x1be018=total;promises[_0x68aa('0x30')](checkRow(_0x30d886,_0x145d54,_0x1be018)[_0x68aa('0x2f')](function(){success+=0x1;})[_0x68aa('0x32')](function(_0x2c648e){if(_0x2c648e[_0x68aa('0x16')]){errors+=0x1;delete _0x2c648e[_0x68aa('0x16')];}else if(_0x2c648e['duplicate']){duplicates+=0x1;delete _0x2c648e[_0x68aa('0x2a')];}rows[_0x68aa('0x30')](_0x2c648e);}));if(total%0xc8===0x0){_0x363435[_0x68aa('0x6c')]();return processPromises(_0x363435);}},'complete':function(){return processPromises()['then'](function(){logger[_0x68aa('0x6a')](_0x68aa('0x6d'));endCsv();});},'error':function(_0x58f81c,_0x4d4265){logger[_0x68aa('0x6a')](_0x68aa('0x6e'),JSON[_0x68aa('0x33')](_0x58f81c));endCsv();}});})[_0x68aa('0x32')](function(_0x209f97){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x209f97));});}main(); \ No newline at end of file +var _0x6455=['ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','onlyIfOpen','VoiceQueueId','all','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','select','field','NOW()','scheduledAt'];(function(_0x5219e4,_0x50cdef){var _0x390418=function(_0x589678){while(--_0x589678){_0x5219e4['push'](_0x5219e4['shift']());}};_0x390418(++_0x50cdef);}(_0x6455,0x189));var _0x5645=function(_0x529adc,_0x544212){_0x529adc=_0x529adc-0x0;var _0x3dde47=_0x6455[_0x529adc];return _0x3dde47;};'use strict';var BPromise=require(_0x5645('0x0'));var util=require(_0x5645('0x1'));var _=require(_0x5645('0x2'));var fs=require('fs');var squel=require(_0x5645('0x3'));var Papa=require(_0x5645('0x4'));var Redis=require(_0x5645('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x5645('0x6'));var logger=require(_0x5645('0x7'))(_0x5645('0x8'));config[_0x5645('0x9')]=_['defaults'](config[_0x5645('0x9')],{'host':_0x5645('0xa'),'port':0x18eb});var socket=require(_0x5645('0xb'))(new Redis(config[_0x5645('0x9')]));require(_0x5645('0xc'))[_0x5645('0xd')](socket);try{if(!process[_0x5645('0xe')][0x2]||process[_0x5645('0xe')][0x2]===_0x5645('0xf')||process['argv'][0x2]==='null'){throw new Error(_0x5645('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x5645('0xe')][0x3]||process[_0x5645('0xe')][0x3]===_0x5645('0xf')||process[_0x5645('0xe')][0x3]===_0x5645('0x11')||!process[_0x5645('0xe')][0x4]||process[_0x5645('0xe')][0x4]===_0x5645('0xf')||process['argv'][0x4]===_0x5645('0x11')){throw new Error(_0x5645('0x12'));}var FIELDS=_[_0x5645('0x13')](process['argv'][0x3][_0x5645('0x14')](','),process['argv'][0x4][_0x5645('0x14')](','));if(!process[_0x5645('0xe')][0x5]||process[_0x5645('0xe')][0x5]===_0x5645('0xf')||process[_0x5645('0xe')][0x5]===_0x5645('0x11')){throw new Error(_0x5645('0x15'));}var LISTID=process[_0x5645('0xe')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x5645('0xe')][0x6]!==_0x5645('0xf')&&process['argv'][0x6]!==_0x5645('0x11')?process[_0x5645('0xe')][0x6]:null;var DUPLICATES=process[_0x5645('0xe')][0x7]&&process[_0x5645('0xe')][0x7]!==_0x5645('0xf')&&process[_0x5645('0xe')][0x7]!==_0x5645('0x11')?process[_0x5645('0xe')][0x7]:null;if(!process[_0x5645('0xe')][0x8]||process[_0x5645('0xe')][0x8]===_0x5645('0xf')||process['argv'][0x8]==='null'){throw new Error(_0x5645('0x16'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2bff43){logger[_0x5645('0x17')](_0x2bff43);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(_0x3fadb5,_0x353027,_0x16581b,_0x1df670){var _0x116868={'message':_0x353027};_0x116868[_0x3fadb5]=!![];if(_0x16581b){_0x116868[_0x5645('0x18')]=_0x16581b;}if(_0x1df670){_0x116868['index']=_0x1df670;}return _0x116868;}function isEmail(_0x312455){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))*$/[_0x5645('0x19')](_0x312455);}function checkRow(_0x4c2f19,_0x25cfdf,_0x2e73fe){return new BPromise(function(_0x417d81,_0x1309e3){if(_[_0x5645('0x1a')](_0x4c2f19)){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x1b'),null,_0x2e73fe));}if(_0x4c2f19['errors']&&_0x4c2f19[_0x5645('0x1c')][_0x5645('0x1d')]){var _0xb6d61c=_[_0x5645('0x1e')](_0x4c2f19['errors'],_0x5645('0x1f'))[_0x5645('0x20')](';');return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0xb6d61c,null,_0x2e73fe));}var _0x5125c5={};for(var _0x4fbfe0 in FIELDS){if(FIELDS[_0x5645('0x21')](_0x4fbfe0)&&FIELDS[_0x4fbfe0]){_0x5125c5[_0x4fbfe0]=_0x4c2f19['data'][0x0][FIELDS[_0x4fbfe0]]||_0x4c2f19[_0x5645('0x22')][0x0]['\ufeff'+FIELDS[_0x4fbfe0]];}}if(!_0x5125c5['firstName']){return _0x1309e3(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x2e73fe));}if(!_0x5125c5[_0x5645('0x23')]){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x24'),null,_0x2e73fe));}if(_0x5125c5[_0x5645('0x25')]){var _0x206d38=moment(_0x5125c5[_0x5645('0x25')],_0x5645('0x26'));if(!_0x206d38['isValid']()){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x27'),null,_0x2e73fe));}}if(_0x5125c5['email']){if(!isEmail(_0x5125c5[_0x5645('0x28')])){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x29'),null,_0x2e73fe));}}_0x5125c5[_0x5645('0x2a')]=LISTID;_0x5125c5[_0x5645('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x5645('0x1d')]&&_0x25cfdf){var _0x303327={};for(var _0x4eb293=0x0,_0x3f782a=DUPLICATES[_0x5645('0x1d')];_0x4eb293<_0x3f782a;_0x4eb293+=0x1){_0x303327[DUPLICATES[_0x4eb293]]=_0x5125c5[DUPLICATES[_0x4eb293]];}var _0x36a8a6=_[_0x5645('0x2c')](_0x25cfdf,_0x303327);if(_0x36a8a6){return _0x1309e3(handleCheckRowError(_0x5645('0x2d'),_0x5645('0x2e'),_0x36a8a6,_0x2e73fe));}}return db[_0x5645('0x2f')][_0x5645('0x30')](_0x5125c5,{'raw':!![],'hooks':![],'fields':_[_0x5645('0x31')](_0x5125c5)})[_0x5645('0x32')](function(_0x37d659){if(DUPLICATES&&DUPLICATES[_0x5645('0x1d')]&&_0x25cfdf){_0x25cfdf[_0x5645('0x33')](_['pick'](_0x5125c5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x37d659['id'];return _0x417d81();})[_0x5645('0x34')](function(_0x33839e){return _0x1309e3(handleCheckRowError(_0x5645('0x17'),_0x5645('0x35')+(_0x33839e[_0x5645('0x1f')]||JSON['stringify'](_0x33839e)),null,_0x2e73fe));});});}function checkHopper(){function _0x3ff276(){return function(_0x1e1d69){logger[_0x5645('0x17')](_0x5645('0x36'),_0x5645('0x37'),util[_0x5645('0x38')](_0x1e1d69,{'showHidden':![],'depth':null}));};}var _0x3c2f4a=function(_0x147ea9,_0x26599c){var _0x2f9530=squel[_0x5645('0x39')]()[_0x5645('0x3a')](_0x5645('0x3b'))[_0x5645('0x3c')](['phone','scheduledAt','ContactId',_0x5645('0x2a'),_0x26599c,_0x5645('0x3d'),_0x5645('0x3e')],squel[_0x5645('0x3f')]()[_0x5645('0x40')](_0x5645('0x23'),_0x5645('0x23'))[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x42'))[_0x5645('0x40')]('id',_0x5645('0x43'))[_0x5645('0x40')](LISTID[_0x5645('0x44')](),'ListId')[_0x5645('0x40')](_0x147ea9['id'][_0x5645('0x44')](),_0x26599c)[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3d'))[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3e'))[_0x5645('0x45')](_0x5645('0x46'))['where'](_0x5645('0x47'))[_0x5645('0x48')](_0x5645('0x49'),LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4a'))[_0x5645('0x48')](_0x5645('0x4b'),squel[_0x5645('0x3f')]()['field'](_0x5645('0x23'))[_0x5645('0x45')](_0x5645('0x3b'))['where'](_0x26599c+_0x5645('0x4c'),_0x147ea9['id'][_0x5645('0x44')]())))[_0x5645('0x44')]();return _0x2f9530;};var _0x1bcc3e=function(_0x6ba361,_0xe5f4cd){var _0x3560b2=squel[_0x5645('0x39')]()['into'](_0x5645('0x3b'))[_0x5645('0x3c')](['phone',_0x5645('0x42'),_0x5645('0x43'),'ListId',_0xe5f4cd,_0x5645('0x3d'),_0x5645('0x3e')],squel[_0x5645('0x3f')]()[_0x5645('0x40')](_0x5645('0x23'),_0x5645('0x23'))['field'](_0x5645('0x41'),_0x5645('0x42'))['field']('id',_0x5645('0x43'))[_0x5645('0x40')](LISTID[_0x5645('0x44')](),_0x5645('0x2a'))[_0x5645('0x40')](_0x6ba361['id'][_0x5645('0x44')](),_0xe5f4cd)[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3d'))['field'](_0x5645('0x41'),'updatedAt')[_0x5645('0x45')](_0x5645('0x46'))[_0x5645('0x48')](_0x5645('0x47'))[_0x5645('0x48')]('ListId\x20=\x20?',LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4d'),squel[_0x5645('0x4e')](hopperContacts))['where'](_0x5645('0x4a'))['where'](_0x5645('0x4b'),squel[_0x5645('0x3f')]()['field'](_0x5645('0x4f'))[_0x5645('0x45')](_0x5645('0x50'))[_0x5645('0x48')](_0xe5f4cd+_0x5645('0x4c'),_0x6ba361['id']['toString']()))['where'](_0x5645('0x4b'),squel['select']()[_0x5645('0x40')]('phone')['from'](_0x5645('0x3b'))[_0x5645('0x48')](_0xe5f4cd+_0x5645('0x4c'),_0x6ba361['id'][_0x5645('0x44')]())))[_0x5645('0x44')]();return _0x3560b2;};function _0x17a20a(_0x5e6291,_0x30828a){var _0x390876=squel[_0x5645('0x39')]()['into'](_0x5645('0x3b'))[_0x5645('0x3c')]([_0x5645('0x23'),_0x5645('0x42'),'ContactId','ListId',_0x30828a,_0x5645('0x3d'),_0x5645('0x3e')],squel[_0x5645('0x3f')]()[_0x5645('0x40')](_0x5645('0x23'),'phone')[_0x5645('0x40')]('NOW()',_0x5645('0x42'))[_0x5645('0x40')]('id',_0x5645('0x43'))[_0x5645('0x40')](LISTID['toString'](),_0x5645('0x2a'))[_0x5645('0x40')](_0x5e6291['id'][_0x5645('0x44')](),_0x30828a)[_0x5645('0x40')]('NOW()',_0x5645('0x3d'))[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3e'))[_0x5645('0x45')](_0x5645('0x46'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4d'),squel[_0x5645('0x4e')](hopperContacts))[_0x5645('0x48')](_0x5645('0x4a')))[_0x5645('0x44')]();return _0x390876;}function _0x26f9e8(_0x4fffd3,_0x23f73a){var _0x33a741=squel[_0x5645('0x39')]()[_0x5645('0x3a')](_0x5645('0x51'))[_0x5645('0x3c')]([_0x5645('0x23'),_0x5645('0x43'),_0x5645('0x2a'),_0x23f73a,'createdAt','updatedAt'],squel[_0x5645('0x3f')]()['field']('phone','phone')['field']('id','ContactId')[_0x5645('0x40')](LISTID[_0x5645('0x44')](),_0x5645('0x2a'))[_0x5645('0x40')](_0x4fffd3['id']['toString'](),_0x23f73a)[_0x5645('0x40')](_0x5645('0x41'),_0x5645('0x3d'))[_0x5645('0x40')](_0x5645('0x41'),'updatedAt')['from']('cm_contacts')['where'](_0x5645('0x47'))['where'](_0x5645('0x49'),LISTID[_0x5645('0x44')]())[_0x5645('0x48')](_0x5645('0x4d'),squel['str'](hopperContacts))[_0x5645('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x33a741;}return db[_0x5645('0x52')][_0x5645('0x53')]({'where':{'type':_0x5645('0x54')},'attributes':['id',_0x5645('0x55')],'include':[{'model':db[_0x5645('0x56')],'as':_0x5645('0x57'),'where':{'id':LISTID}}]})[_0x5645('0x32')](function(_0x1ab681){var _0x18a1d6=[];if(_0x1ab681){var _0x543463;for(var _0x1a242e=0x0,_0x236832;_0x1a242e<_0x1ab681[_0x5645('0x1d')];_0x1a242e+=0x1){_0x236832=_0x1ab681[_0x1a242e][_0x5645('0x58')]({'plain':!![]});switch(_0x236832[_0x5645('0x55')]){case'always':_0x18a1d6['push'](db[_0x5645('0x59')][_0x5645('0x5a')](_0x1bcc3e(_0x236832,'VoiceQueueId'))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;case _0x5645('0x5b'):_0x18a1d6['push'](db['sequelize'][_0x5645('0x5a')](_0x3c2f4a(_0x236832,_0x5645('0x5c')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;default:_0x18a1d6[_0x5645('0x33')](db['sequelize'][_0x5645('0x5a')](_0x17a20a(_0x236832,'VoiceQueueId'))[_0x5645('0x32')](function(){})['catch'](_0x3ff276()));}}}return _0x18a1d6;})['all']()[_0x5645('0x32')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x5645('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x5ddc4d){var _0x509ab7=[];if(_0x5ddc4d){var _0x14117e;for(var _0x567449=0x0,_0x36d89f;_0x567449<_0x5ddc4d[_0x5645('0x1d')];_0x567449+=0x1){_0x36d89f=_0x5ddc4d[_0x567449][_0x5645('0x58')]({'plain':!![]});_0x509ab7[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x26f9e8(_0x36d89f,'VoiceQueueId'))['then'](function(){})['catch'](_0x3ff276()));}}return _0x509ab7;})[_0x5645('0x5d')]();})[_0x5645('0x32')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x5645('0x55')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2258b7){var _0x464ded=[];if(_0x2258b7){for(var _0x404051=0x0,_0x481381;_0x404051<_0x2258b7[_0x5645('0x1d')];_0x404051+=0x1){_0x481381=_0x2258b7[_0x404051]['get']({'plain':!![]});switch(_0x481381['dialCheckDuplicateType']){case'always':_0x464ded['push'](db[_0x5645('0x59')][_0x5645('0x5a')](_0x1bcc3e(_0x481381,_0x5645('0x5e')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;case _0x5645('0x5b'):_0x464ded[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x3c2f4a(_0x481381,_0x5645('0x5e')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));break;default:_0x464ded[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x17a20a(_0x481381,_0x5645('0x5e')))[_0x5645('0x32')](function(){})[_0x5645('0x34')](_0x3ff276()));}}}return _0x464ded;})['all']();})[_0x5645('0x32')](function(){return db[_0x5645('0x5f')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x5645('0x56')],'as':_0x5645('0x60'),'where':{'id':LISTID}}]})[_0x5645('0x32')](function(_0x34b4f7){var _0x647df5=[];if(_0x34b4f7){for(var _0x1eb5ad=0x0,_0x423062;_0x1eb5ad<_0x34b4f7[_0x5645('0x1d')];_0x1eb5ad+=0x1){_0x423062=_0x34b4f7[_0x1eb5ad][_0x5645('0x58')]({'plain':!![]});_0x647df5[_0x5645('0x33')](db[_0x5645('0x59')][_0x5645('0x5a')](_0x26f9e8(_0x423062,'CampaignId'))[_0x5645('0x32')](function(){})['catch'](_0x3ff276()));}}return _0x647df5;})[_0x5645('0x5d')]();})[_0x5645('0x34')](function(_0xa0a61d){logger[_0x5645('0x17')](_0x5645('0x61'),_0x5645('0x62'),_0xa0a61d['message']);});}var processPromises=function(_0x44937c){return BPromise[_0x5645('0x5d')](promises)[_0x5645('0x32')](function(_0x8f5e02){})['catch'](function(_0x3033bc){logger[_0x5645('0x17')](_0x5645('0x63'),JSON[_0x5645('0x64')](_0x3033bc));})[_0x5645('0x65')](function(){socket['emit'](_0x5645('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x44937c){return _0x44937c[_0x5645('0x67')]();}});};var endCsv=function(){return BPromise[_0x5645('0x68')]()[_0x5645('0x32')](function(){if(hopperContacts){return checkHopper();}})[_0x5645('0x32')](function(){socket['emit'](_0x5645('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x5645('0x69')](FILEPATH);}catch(_0x3baf81){logger[_0x5645('0x17')](_0x5645('0x6a'),JSON[_0x5645('0x64')](_0x3baf81));}finally{process[_0x5645('0x6b')](0x0);}});};process['on'](_0x5645('0x6c'),function(){logger[_0x5645('0x6d')](_0x5645('0x6e'));endCsv();});function main(){return BPromise[_0x5645('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x5645('0x14')](',');return db['CmContact'][_0x5645('0x53')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x5645('0x32')](function(_0x3976bd){var _0x1dadb3=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x5645('0x6f')](_0x1dadb3,{'header':!![],'skipEmptyLines':!![],'step':function(_0xcc938,_0x4ee971){total+=0x1;var _0xe021b8=total;promises[_0x5645('0x33')](checkRow(_0xcc938,_0x3976bd,_0xe021b8)[_0x5645('0x32')](function(){success+=0x1;})[_0x5645('0x34')](function(_0xaf421f){if(_0xaf421f[_0x5645('0x17')]){errors+=0x1;delete _0xaf421f[_0x5645('0x17')];}else if(_0xaf421f[_0x5645('0x2d')]){duplicates+=0x1;delete _0xaf421f[_0x5645('0x2d')];}rows[_0x5645('0x33')](_0xaf421f);}));if(total%0xc8===0x0){_0x4ee971[_0x5645('0x70')]();return processPromises(_0x4ee971);}},'complete':function(){return processPromises()[_0x5645('0x32')](function(){logger[_0x5645('0x6d')](_0x5645('0x71'));endCsv();});},'error':function(_0xbcb808,_0x558bcf){logger[_0x5645('0x6d')](_0x5645('0x72'),JSON[_0x5645('0x64')](_0xbcb808));endCsv();}});})['catch'](function(_0x119162){logger[_0x5645('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x5645('0x64')](_0x119162));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 82b5f31..a2d8bb3 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 _0x17c9=['updatedAt','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','.CmListId','.id\x20=\x20','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','catch','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','keys','header','writeFileSync','createReadStream','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','emit','info','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','bluebird','moment','squel','../../../config/environment','redis','defaults','localhost','socket.io-emitter','select','field','phone','join','where','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt'];(function(_0x537281,_0x3e2849){var _0x58a6b3=function(_0x1698cb){while(--_0x1698cb){_0x537281['push'](_0x537281['shift']());}};_0x58a6b3(++_0x3e2849);}(_0x17c9,0x170));var _0x917c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x17c9[_0x122ef9];return _0x42fba0;};'use strict';var fs=require('fs');var path=require(_0x917c('0x0'));var _=require(_0x917c('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x917c('0x2'));var moment=require(_0x917c('0x3'));var squel=require(_0x917c('0x4'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x917c('0x5'));var logger=require('../../../config/logger')('import');config[_0x917c('0x6')]=_[_0x917c('0x7')](config['redis'],{'host':_0x917c('0x8'),'port':0x18eb});var socket=require(_0x917c('0x9'))(new Redis(config[_0x917c('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1f0acb){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'](_0x1f0acb);}function selectNotIn(_0x3c68a0,_0x3779ad,_0x192e0a,_0x1f8490,_0x3480da){return squel[_0x917c('0xa')]()[_0x917c('0xb')](_0x917c('0xc'))['from'](_0x1f8490)[_0x917c('0xd')](_0x3779ad,null,_0x3779ad+'.id\x20=\x20'+_0x1f8490+'.'+_0x192e0a)['where'](_0x1f8490+'.'+_0x192e0a+'\x20=\x20'+_0x3c68a0+'.'+_0x192e0a)[_0x917c('0xe')](_0x3779ad+'.dialCheckDuplicateType\x20IN\x20('+_0x3480da[_0x917c('0xd')]()+')');}function insertCmHopper(_0x2b2c67,_0x1b6bb8,_0x42cb5d,_0x294589,_0x5af71b){var _0x35a60b=['cm_contacts.phone',_0x917c('0xf'),_0x917c('0x10'),'cm_contacts.ListId',_0x1b6bb8+'.'+_0x294589,_0x917c('0x11'),_0x917c('0x12'),'cm_contacts.priority',_0x917c('0x13'),'\x22'+_0x5af71b+'\x22'];return squel[_0x917c('0x14')]()[_0x917c('0x15')](_0x917c('0x16'))[_0x917c('0x17')]([_0x917c('0xc'),_0x917c('0x18'),_0x917c('0x19'),_0x917c('0x1a'),_0x294589,_0x917c('0x1b'),_0x917c('0x1c'),'priority',_0x917c('0x1d'),_0x917c('0x1e')],squel[_0x917c('0xa')]()[_0x917c('0x1f')](_0x35a60b)[_0x917c('0x20')](_0x1b6bb8)[_0x917c('0xd')](_0x917c('0x21'),null,_0x917c('0x22')+_0x1b6bb8+'.CmListId')[_0x917c('0xd')](_0x42cb5d,null,_0x42cb5d+'.id\x20=\x20'+_0x1b6bb8+'.'+_0x294589)[_0x917c('0xe')](_0x1b6bb8+_0x917c('0x23'),_0x2b2c67)[_0x917c('0xe')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x917c('0xe')](_0x917c('0x24'),selectNotIn(_0x1b6bb8,_0x42cb5d,_0x294589,_0x917c('0x16'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x917c('0xe')](_0x917c('0x24'),selectNotIn(_0x1b6bb8,_0x42cb5d,_0x294589,_0x917c('0x16'),[_0x917c('0x25')])))[_0x917c('0x26')]();}function insertCmHopperBlack(_0xe5c6d9,_0x1ff824,_0xc6166d,_0x5d221b){var _0x7091fc=[_0x917c('0x27'),_0x917c('0x10'),_0x917c('0x28'),_0x1ff824+'.'+_0x5d221b,'cm_contacts.createdAt',_0x917c('0x12')];return squel['insert']()[_0x917c('0x15')](_0x917c('0x29'))[_0x917c('0x17')](['phone',_0x917c('0x19'),'ListId',_0x5d221b,'createdAt',_0x917c('0x1c')],squel[_0x917c('0xa')]()[_0x917c('0x1f')](_0x7091fc)[_0x917c('0x20')](_0x1ff824)[_0x917c('0xd')](_0x917c('0x21'),null,'cm_contacts.ListId\x20=\x20'+_0x1ff824+_0x917c('0x2a'))[_0x917c('0xd')](_0xc6166d,null,_0xc6166d+_0x917c('0x2b')+_0x1ff824+'.'+_0x5d221b)[_0x917c('0xe')](_0x1ff824+'.CmListId\x20=\x20?',_0xe5c6d9)[_0x917c('0xe')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x917c('0xe')](_0x917c('0x24'),squel['select']()[_0x917c('0xb')](_0x917c('0xc'))[_0x917c('0x20')](_0x917c('0x29'))[_0x917c('0xe')](_0x917c('0x2c'),_0xe5c6d9)[_0x917c('0xe')](_0x5d221b+_0x917c('0x2d'),_0x1ff824+'.'+_0x5d221b)))[_0x917c('0x26')]();}function insertCmContact(_0x15f153,_0x5635b2,_0x13bc3d,_0x252d6a){var _0x16d654=_[_0x917c('0x2e')](_['keys'](_0x252d6a),[_0x917c('0x1a'),_0x917c('0x2f'),_0x917c('0x1b'),_0x917c('0x1c')]);return squel['insert']()['into'](_0x917c('0x21'))[_0x917c('0x17')](_0x16d654,squel[_0x917c('0xa')]()[_0x917c('0x1f')](_0x16d654)[_0x917c('0x20')](_0x5635b2)[_0x917c('0xe')]('('+_0x13bc3d[_0x917c('0xd')](',')+_0x917c('0x30'),squel[_0x917c('0xa')]()['fields'](_0x13bc3d)['from']('cm_contacts')[_0x917c('0xe')](_0x917c('0x2c'),_0x15f153)['where'](_0x917c('0x31')))['where'](_0x917c('0x32'),squel['select']()['field'](_0x917c('0x33'),_0x917c('0x34'))['from'](_0x5635b2)[_0x917c('0x35')](_0x13bc3d['join'](','))))['toString']();}function handleStop(){logger['info'](_0x917c('0x36'));stopped=!![];}function handleUncaughtException(_0x18f04a){logger[_0x917c('0x37')](_0x18f04a[_0x917c('0x38')]);process[_0x917c('0x39')](0x1);}function handleError(_0x6731ce,_0x457de6){stats[_0x917c('0x3a')][_0x917c('0x3b')]({'name':_0x457de6[_0x917c('0x3c')],'message':_0x457de6[_0x917c('0x38')],'row':_0x6731ce});}function handleQuery(_0x5c61c6){logger['info'](_0x5c61c6);return db[_0x917c('0x3d')][_0x917c('0x3e')](_0x5c61c6)['spread'](function(_0x2bb019){results[_0x917c('0x3b')](_0x2bb019);})[_0x917c('0x3f')](function(_0x409722){logger['error'](_0x409722[_0x917c('0x38')]);});}function main(_0x43e032,_0xa646c5,_0x18dcfe,_0x11cb84){logger['info']('main',_0x43e032,JSON[_0x917c('0x40')](_0xa646c5));process[_0x917c('0x41')](_0x917c('0x42'));var _0x23b8b0=_0xa646c5[_0x917c('0x43')];var _0x2b5c38=_0xa646c5[_0x917c('0x44')];var _0x475319=path[_0x917c('0xd')](config['root'],_0x917c('0x45'),_0x2b5c38+_0x917c('0x46'));var _0x12b17b=_[_0x917c('0x47')](_0x23b8b0)['join']();logger['info'](_0x917c('0x48'),_0x12b17b);fs[_0x917c('0x49')](_0x475319,_0x12b17b+'\x0a');Papa['parse'](fs[_0x917c('0x4a')](_0x43e032),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4591c9,_0x294a6e){try{for(var _0x4577a3=0x0,_0x3d1d9e=[];_0x4577a3<_0x4591c9['data']['length'];_0x4577a3++){stats[_0x917c('0x4b')]+=0x1;if(_0x4591c9[_0x917c('0x3a')][_0x4577a3]){handleError(_0x4591c9[_0x917c('0x4c')][_0x4577a3],_0x4591c9[_0x917c('0x3a')][_0x4577a3]);}else{var _0x32e29a=[];for(var _0x114214 in _0x23b8b0){if(_0x23b8b0[_0x917c('0x4d')](_0x114214)){if(_0x4591c9['data'][_0x4577a3][_0x23b8b0[_0x114214]]){var _0x4a667e=_[_0x917c('0x4e')](_0x4591c9[_0x917c('0x4c')][_0x4577a3][_0x23b8b0[_0x114214]][_0x917c('0x4f')](/"/g,'\x27'));switch(_0x114214){case _0x917c('0x18'):var _0x399c90=moment(_0x4a667e,_0x917c('0x50'),!![]);if(_0x399c90[_0x917c('0x51')]()){_0x3d1d9e[_0x917c('0x3b')]('\x22'+_0x4a667e+'\x22');}else{_0x32e29a['push'](_0x917c('0x52'));}break;case'priority':var _0x490431=parseInt(_0x4a667e);_0x4a667e=_[_0x917c('0x53')](_0x490431)||_0x490431<0x0||_0x490431>0x4?_0x11cb84?0x3:0x2:_0x490431;_0x3d1d9e[_0x917c('0x3b')]('\x22'+_0x4a667e+'\x22');break;case'UserId':var _0x4e25ec=parseInt(_0x4a667e);if(_[_0x917c('0x54')](_0x4e25ec)&&_[_0x917c('0x55')](_0x18dcfe,_0x4e25ec)){_0x3d1d9e[_0x917c('0x3b')]('\x22'+_0x4e25ec+'\x22');}else{_0x32e29a[_0x917c('0x3b')](_0x917c('0x56'));}break;case'email':if(isEmail(_0x4a667e)){_0x3d1d9e[_0x917c('0x3b')]('\x22'+_0x4a667e+'\x22');}else{_0x32e29a[_0x917c('0x3b')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0xfa4c45=moment(_0x4a667e,_0x917c('0x57'),!![]);if(_0xfa4c45[_0x917c('0x51')]()){_0x3d1d9e['push']('\x22'+_0x4a667e+'\x22');}else{_0x32e29a[_0x917c('0x3b')](_0x917c('0x58'));}break;default:_0x3d1d9e[_0x917c('0x3b')]('\x22'+_0x4a667e+'\x22');}}else{switch(_0x114214){case _0x917c('0x59'):case'phone':_0x32e29a['push'](_0x114214+_0x917c('0x5a'));break;default:_0x3d1d9e[_0x917c('0x3b')]('\x22\x22');}}}}if(_0x32e29a[_0x917c('0x5b')]){handleError(_0x4591c9[_0x917c('0x4c')][_0x4577a3],{'code':_0x917c('0x5c'),'message':_0x32e29a[_0x917c('0xd')]()});}else{fs[_0x917c('0x5d')](_0x475319,_0x3d1d9e[_0x917c('0xd')]()+'\x0a');}_0x3d1d9e=[];}if(!(stats[_0x917c('0x4b')]%0xc8)){socket[_0x917c('0x5e')]('contact:import:'+_0x2b5c38,stats);stats[_0x917c('0x3a')]=[];}}if(stopped){logger[_0x917c('0x5f')](_0x917c('0x60'));_0x294a6e[_0x917c('0x61')]();}}catch(_0xb012e6){handleError(_0x4591c9[_0x917c('0x4c')][_0x4577a3],{'code':'SystemError','message':_0xb012e6['message']});logger[_0x917c('0x37')](_0x917c('0x62'),_0xb012e6[_0x917c('0x38')]);}},'complete':function(){try{var _0x406b6=[];var _0x33f4e3=_0x917c('0x21');if(_0xa646c5[_0x917c('0x63')]&&_0xa646c5['duplicates'][_0x917c('0x5b')]){_0x33f4e3=_0x917c('0x64')+_0x2b5c38;_0x406b6['push'](_0x917c('0x65')+_0x33f4e3+_0x917c('0x66'));}var _0x3eb0f9=util[_0x917c('0x67')]('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',_0x475319,_0x33f4e3,_0x12b17b,_0xa646c5[_0x917c('0x1a')],_0xa646c5[_0x917c('0x2f')]||null,NOW,NOW);if(_[_0x917c('0x68')](_0x23b8b0[_0x917c('0x18')])){_0x3eb0f9+=_0x917c('0x69');}_0x406b6[_0x917c('0x3b')](_0x3eb0f9);if(_0xa646c5[_0x917c('0x63')]&&_0xa646c5['duplicates'][_0x917c('0x5b')]){_0x406b6['push'](insertCmContact(_0xa646c5[_0x917c('0x1a')],_0x33f4e3,_0xa646c5[_0x917c('0x63')],_0x23b8b0));_0x406b6[_0x917c('0x3b')]('DROP\x20TABLE\x20'+_0x33f4e3+';');}_0x406b6[_0x917c('0x3b')](insertCmHopper(_0xa646c5['ListId'],_0x917c('0x6a'),_0x917c('0x6b'),_0x917c('0x6c'),_0x11cb84));_0x406b6[_0x917c('0x3b')](insertCmHopperBlack(_0xa646c5[_0x917c('0x1a')],'voice_queues_has_cm_blacklists',_0x917c('0x6b'),_0x917c('0x6c')));_0x406b6['push'](insertCmHopper(_0xa646c5['ListId'],_0x917c('0x6d'),_0x917c('0x6e'),_0x917c('0x6f'),_0x11cb84));_0x406b6[_0x917c('0x3b')](insertCmHopperBlack(_0xa646c5[_0x917c('0x1a')],_0x917c('0x70'),_0x917c('0x6e'),_0x917c('0x6f')));BPromise[_0x917c('0x71')](_0x406b6,handleQuery)[_0x917c('0x72')](function(_0x53cd35){stats[_0x917c('0x73')]=!![];stats[_0x917c('0x74')]=_0xa646c5[_0x917c('0x63')]&&_0xa646c5[_0x917c('0x63')][_0x917c('0x5b')]?results[0x2]['affectedRows']:results[0x0][_0x917c('0x74')];socket[_0x917c('0x5e')](_0x917c('0x75')+_0x2b5c38,stats);fs[_0x917c('0x76')](_0x43e032);fs[_0x917c('0x76')](_0x475319);process[_0x917c('0x39')](0x0);})[_0x917c('0x3f')](function(_0x3610e9){logger['error'](_0x3610e9[_0x917c('0x38')]);process[_0x917c('0x39')](0x1);});}catch(_0x1768fe){logger[_0x917c('0x37')](_0x917c('0x77'),_0x1768fe['message']);process['exit'](0x1);}},'error':function(_0x288dcc,_0x54fa40,_0x310c84,_0x2f3970){throw new Error(_0x2f3970);}});}function validate(){if(process[_0x917c('0x78')]&&process[_0x917c('0x78')]['length']<0x4){throw new Error(_0x917c('0x79'));}var _0x47701a=path['join'](config['root'],_0x917c('0x45'),process['argv'][0x2]);if(!fs['existsSync'](_0x47701a)){throw new Error(_0x917c('0x7a'));}var _0x3cd4d1={};try{_0x3cd4d1=JSON['parse'](process[_0x917c('0x78')][0x3]);if(!_0x3cd4d1[_0x917c('0x43')]){throw new Error(_0x917c('0x7b'));}if(!_0x3cd4d1[_0x917c('0x43')][_0x917c('0xc')]){throw new Error(_0x917c('0x7c'));}if(!_0x3cd4d1[_0x917c('0x43')][_0x917c('0x59')]){throw new Error(_0x917c('0x7d'));}var _0x3f217c=0x0;if(_0x3cd4d1[_0x917c('0x43')][_0x917c('0x1d')]){_0x3f217c=0x1;}if(!_0x3cd4d1[_0x917c('0x1a')]){throw new Error(_0x917c('0x7e'));}}catch(_0x38923f){throw new Error(_0x917c('0x7f'));}var _0x1d9083=[];try{_0x1d9083=_['map'](JSON[_0x917c('0x80')](process[_0x917c('0x78')][0x4]),'id');}catch(_0x5bf1d8){logger['info'](_0x917c('0x81'));}main(_0x47701a,_0x3cd4d1,_0x1d9083,_0x3f217c);}validate();process['on'](_0x917c('0x82'),handleStop);process['on'](_0x917c('0x83'),handleUncaughtException); \ No newline at end of file +var _0x0b7f=['cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','insert',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','push','code','message','sequelize','catch','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header','writeFileSync','parse','data','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','length','SystemRow','appendFileSync','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?'];(function(_0x40c50e,_0x3c645b){var _0x3f2686=function(_0x382e41){while(--_0x382e41){_0x40c50e['push'](_0x40c50e['shift']());}};_0x3f2686(++_0x3c645b);}(_0x0b7f,0x1d0));var _0xf0b7=function(_0x3e6d97,_0xec789){_0x3e6d97=_0x3e6d97-0x0;var _0x45035e=_0x0b7f[_0x3e6d97];return _0x45035e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf0b7('0x0'));var Papa=require(_0xf0b7('0x1'));var util=require(_0xf0b7('0x2'));var BPromise=require(_0xf0b7('0x3'));var moment=require(_0xf0b7('0x4'));var squel=require(_0xf0b7('0x5'));var Redis=require(_0xf0b7('0x6'));var db=require(_0xf0b7('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xf0b7('0x8'));config[_0xf0b7('0x9')]=_['defaults'](config[_0xf0b7('0x9')],{'host':_0xf0b7('0xa'),'port':0x18eb});var socket=require(_0xf0b7('0xb'))(new Redis(config[_0xf0b7('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xf0b7('0xc')](_0xf0b7('0xd'));function isEmail(_0x3535f2){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'](_0x3535f2);}function selectNotIn(_0x44f5c1,_0x4fc096,_0x727fde,_0x24398b,_0x4d85e5){return squel[_0xf0b7('0xe')]()[_0xf0b7('0xf')](_0xf0b7('0x10'))[_0xf0b7('0x11')](_0x24398b)[_0xf0b7('0x12')](_0x4fc096,null,_0x4fc096+_0xf0b7('0x13')+_0x24398b+'.'+_0x727fde)[_0xf0b7('0x14')](_0x24398b+'.'+_0x727fde+_0xf0b7('0x15')+_0x44f5c1+'.'+_0x727fde)[_0xf0b7('0x14')](_0x4fc096+'.dialCheckDuplicateType\x20IN\x20('+_0x4d85e5['join']()+')');}function insertCmHopper(_0x1c5bfd,_0x3a03e3,_0x52d603,_0x2bb129,_0x539e32){var _0x404688=[_0xf0b7('0x16'),_0xf0b7('0x17'),_0xf0b7('0x18'),_0xf0b7('0x19'),_0x3a03e3+'.'+_0x2bb129,_0xf0b7('0x1a'),_0xf0b7('0x1b'),'cm_contacts.priority',_0xf0b7('0x1c'),'\x22'+_0x539e32+'\x22'];return squel['insert']()[_0xf0b7('0x1d')](_0xf0b7('0x1e'))[_0xf0b7('0x1f')](['phone',_0xf0b7('0x20'),'ContactId',_0xf0b7('0x21'),_0x2bb129,_0xf0b7('0x22'),_0xf0b7('0x23'),_0xf0b7('0x24'),_0xf0b7('0x25'),_0xf0b7('0x26')],squel[_0xf0b7('0xe')]()[_0xf0b7('0x27')](_0x404688)[_0xf0b7('0x11')](_0x3a03e3)[_0xf0b7('0x12')](_0xf0b7('0x28'),null,_0xf0b7('0x29')+_0x3a03e3+_0xf0b7('0x2a'))['join'](_0x52d603,null,_0x52d603+_0xf0b7('0x13')+_0x3a03e3+'.'+_0x2bb129)[_0xf0b7('0x14')](_0x3a03e3+_0xf0b7('0x2b'),_0x1c5bfd)[_0xf0b7('0x14')](_0xf0b7('0x2c'),NOW)[_0xf0b7('0x14')](_0xf0b7('0x2d'),selectNotIn(_0x3a03e3,_0x52d603,_0x2bb129,_0xf0b7('0x1e'),['\x22always\x22',_0xf0b7('0x2e')]))[_0xf0b7('0x14')](_0xf0b7('0x2d'),selectNotIn(_0x3a03e3,_0x52d603,_0x2bb129,'cm_hopper',[_0xf0b7('0x2f')])))[_0xf0b7('0x30')]();}function insertCmHopperBlack(_0x5a3d7d,_0x1c31f4,_0xf1426c,_0x309dc7){var _0x31490c=[_0xf0b7('0x16'),_0xf0b7('0x18'),_0xf0b7('0x19'),_0x1c31f4+'.'+_0x309dc7,_0xf0b7('0x1a'),_0xf0b7('0x1b')];return squel['insert']()[_0xf0b7('0x1d')](_0xf0b7('0x31'))[_0xf0b7('0x1f')]([_0xf0b7('0x10'),'ContactId','ListId',_0x309dc7,_0xf0b7('0x22'),_0xf0b7('0x23')],squel[_0xf0b7('0xe')]()['fields'](_0x31490c)[_0xf0b7('0x11')](_0x1c31f4)[_0xf0b7('0x12')]('cm_contacts',null,_0xf0b7('0x29')+_0x1c31f4+_0xf0b7('0x2a'))[_0xf0b7('0x12')](_0xf1426c,null,_0xf1426c+_0xf0b7('0x13')+_0x1c31f4+'.'+_0x309dc7)['where'](_0x1c31f4+_0xf0b7('0x2b'),_0x5a3d7d)['where'](_0xf0b7('0x2c'),NOW)[_0xf0b7('0x14')](_0xf0b7('0x2d'),squel[_0xf0b7('0xe')]()[_0xf0b7('0xf')]('phone')['from'](_0xf0b7('0x31'))[_0xf0b7('0x14')](_0xf0b7('0x32'),_0x5a3d7d)['where'](_0x309dc7+_0xf0b7('0x33'),_0x1c31f4+'.'+_0x309dc7)))['toString']();}function insertCmContact(_0x43de8d,_0x1a3843,_0x42efcf,_0x47ca98){var _0x3d7058=_['concat'](_[_0xf0b7('0x34')](_0x47ca98),['ListId',_0xf0b7('0x35'),_0xf0b7('0x22'),_0xf0b7('0x23')]);return squel[_0xf0b7('0x36')]()[_0xf0b7('0x1d')]('cm_contacts')['fromQuery'](_0x3d7058,squel[_0xf0b7('0xe')]()['fields'](_0x3d7058)[_0xf0b7('0x11')](_0x1a3843)[_0xf0b7('0x14')]('('+_0x42efcf[_0xf0b7('0x12')](',')+_0xf0b7('0x37'),squel[_0xf0b7('0xe')]()[_0xf0b7('0x27')](_0x42efcf)[_0xf0b7('0x11')](_0xf0b7('0x28'))[_0xf0b7('0x14')]('ListId\x20=\x20?',_0x43de8d)[_0xf0b7('0x14')](_0xf0b7('0x38')))[_0xf0b7('0x14')](_0xf0b7('0x39'),squel[_0xf0b7('0xe')]()[_0xf0b7('0xf')]('MIN(id)',_0xf0b7('0x3a'))[_0xf0b7('0x11')](_0x1a3843)[_0xf0b7('0x3b')](_0x42efcf[_0xf0b7('0x12')](','))))[_0xf0b7('0x30')]();}function handleStop(){logger[_0xf0b7('0x3c')](_0xf0b7('0x3d'));stopped=!![];}function handleUncaughtException(_0x3f2726){logger[_0xf0b7('0x3e')](_0x3f2726['message']);process[_0xf0b7('0x3f')](0x1);}function handleError(_0x17bbf4,_0x310d23){stats['errors'][_0xf0b7('0x40')]({'name':_0x310d23[_0xf0b7('0x41')],'message':_0x310d23[_0xf0b7('0x42')],'row':_0x17bbf4});}function handleQuery(_0x28e1d7){logger[_0xf0b7('0x3c')](_0x28e1d7);return db[_0xf0b7('0x43')]['query'](_0x28e1d7)['spread'](function(_0x38c9a4){results['push'](_0x38c9a4);})[_0xf0b7('0x44')](function(_0x5da92a){logger[_0xf0b7('0x3e')](_0x5da92a[_0xf0b7('0x42')]);});}function main(_0x5ddb45,_0x49c30a,_0x4220dd,_0x578868){logger[_0xf0b7('0x3c')]('main',_0x5ddb45,JSON[_0xf0b7('0x45')](_0x49c30a));process[_0xf0b7('0x46')](_0xf0b7('0x47'));var _0x271807=_0x49c30a[_0xf0b7('0x48')];var _0xddbdaa=_0x49c30a[_0xf0b7('0x49')];var _0x164afa=path[_0xf0b7('0x12')](config[_0xf0b7('0x4a')],_0xf0b7('0x4b'),_0xddbdaa+'.csv');var _0xcec30a=_['keys'](_0x271807)[_0xf0b7('0x12')]();logger[_0xf0b7('0x3c')](_0xf0b7('0x4c'),_0xcec30a);fs[_0xf0b7('0x4d')](_0x164afa,_0xcec30a+'\x0a');Papa[_0xf0b7('0x4e')](fs['createReadStream'](_0x5ddb45),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1eaa55,_0x1a46b1){try{for(var _0x228f15=0x0,_0x322470=[];_0x228f15<_0x1eaa55[_0xf0b7('0x4f')]['length'];_0x228f15++){stats[_0xf0b7('0x50')]+=0x1;if(_0x1eaa55[_0xf0b7('0x51')][_0x228f15]){handleError(_0x1eaa55[_0xf0b7('0x4f')][_0x228f15],_0x1eaa55['errors'][_0x228f15]);}else{var _0x52f32b=[];for(var _0x3482df in _0x271807){if(_0x271807[_0xf0b7('0x52')](_0x3482df)){if(_0x1eaa55[_0xf0b7('0x4f')][_0x228f15][_0x271807[_0x3482df]]){var _0x359036=_[_0xf0b7('0x53')](_0x1eaa55[_0xf0b7('0x4f')][_0x228f15][_0x271807[_0x3482df]][_0xf0b7('0x54')](/"/g,'\x27'));switch(_0x3482df){case _0xf0b7('0x20'):var _0x41d5d4=moment(_0x359036,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x41d5d4[_0xf0b7('0x55')]()){_0x322470['push']('\x22'+_0x359036+'\x22');}else{_0x52f32b[_0xf0b7('0x40')](_0xf0b7('0x56'));}break;case _0xf0b7('0x24'):var _0x203f68=parseInt(_0x359036);_0x359036=_['isNaN'](_0x203f68)||_0x203f68<0x0||_0x203f68>0x4?_0x578868?0x3:0x2:_0x203f68;_0x322470[_0xf0b7('0x40')]('\x22'+_0x359036+'\x22');break;case _0xf0b7('0x25'):var _0x46a606=parseInt(_0x359036);if(_[_0xf0b7('0x57')](_0x46a606)&&_[_0xf0b7('0x58')](_0x4220dd,_0x46a606)){_0x322470[_0xf0b7('0x40')]('\x22'+_0x46a606+'\x22');}else{_0x52f32b['push'](_0xf0b7('0x59'));}break;case'email':if(isEmail(_0x359036)){_0x322470[_0xf0b7('0x40')]('\x22'+_0x359036+'\x22');}else{_0x52f32b['push'](_0xf0b7('0x5a'));}break;case'dateOfBirth':var _0x36b3e5=moment(_0x359036,'YYYY-MM-DD',!![]);if(_0x36b3e5[_0xf0b7('0x55')]()){_0x322470['push']('\x22'+_0x359036+'\x22');}else{_0x52f32b[_0xf0b7('0x40')](_0xf0b7('0x5b'));}break;default:_0x322470['push']('\x22'+_0x359036+'\x22');}}else{switch(_0x3482df){case'firstName':case _0xf0b7('0x10'):_0x52f32b[_0xf0b7('0x40')](_0x3482df+'\x20not\x20specified');break;default:_0x322470['push']('\x22\x22');}}}}if(_0x52f32b[_0xf0b7('0x5c')]){handleError(_0x1eaa55[_0xf0b7('0x4f')][_0x228f15],{'code':_0xf0b7('0x5d'),'message':_0x52f32b['join']()});}else{fs[_0xf0b7('0x5e')](_0x164afa,_0x322470[_0xf0b7('0x12')]()+'\x0a');}_0x322470=[];}if(!(stats[_0xf0b7('0x50')]%0xc8)){socket['emit']('contact:import:'+_0xddbdaa,stats);stats['errors']=[];}}if(stopped){logger[_0xf0b7('0x3c')](_0xf0b7('0x5f'));_0x1a46b1[_0xf0b7('0x60')]();}}catch(_0x2f40cd){handleError(_0x1eaa55['data'][_0x228f15],{'code':_0xf0b7('0x61'),'message':_0x2f40cd[_0xf0b7('0x42')]});logger[_0xf0b7('0x3e')](_0xf0b7('0x62'),_0x2f40cd[_0xf0b7('0x42')]);}},'complete':function(){try{var _0x5c830b=[];var _0x51b9e3='cm_contacts';if(_0x49c30a[_0xf0b7('0x63')]&&_0x49c30a[_0xf0b7('0x63')]['length']){_0x51b9e3=_0xf0b7('0x64')+_0xddbdaa;_0x5c830b[_0xf0b7('0x40')](_0xf0b7('0x65')+_0x51b9e3+_0xf0b7('0x66'));}var _0x44e5a8=util[_0xf0b7('0xc')](_0xf0b7('0x67'),_0x164afa,_0x51b9e3,_0xcec30a,_0x49c30a['ListId'],_0x49c30a[_0xf0b7('0x35')]||null,NOW,NOW);if(_[_0xf0b7('0x68')](_0x271807[_0xf0b7('0x20')])){_0x44e5a8+=_0xf0b7('0x69');}_0x5c830b[_0xf0b7('0x40')](_0x44e5a8);if(_0x49c30a['duplicates']&&_0x49c30a['duplicates'][_0xf0b7('0x5c')]){_0x5c830b[_0xf0b7('0x40')](insertCmContact(_0x49c30a[_0xf0b7('0x21')],_0x51b9e3,_0x49c30a[_0xf0b7('0x63')],_0x271807));_0x5c830b[_0xf0b7('0x40')](_0xf0b7('0x6a')+_0x51b9e3+';');}_0x5c830b[_0xf0b7('0x40')](insertCmHopper(_0x49c30a['ListId'],_0xf0b7('0x6b'),_0xf0b7('0x6c'),_0xf0b7('0x6d'),_0x578868));_0x5c830b[_0xf0b7('0x40')](insertCmHopperBlack(_0x49c30a[_0xf0b7('0x21')],_0xf0b7('0x6e'),_0xf0b7('0x6c'),'VoiceQueueId'));_0x5c830b[_0xf0b7('0x40')](insertCmHopper(_0x49c30a['ListId'],_0xf0b7('0x6f'),_0xf0b7('0x70'),_0xf0b7('0x71'),_0x578868));_0x5c830b['push'](insertCmHopperBlack(_0x49c30a[_0xf0b7('0x21')],_0xf0b7('0x72'),'campaigns','CampaignId'));BPromise['each'](_0x5c830b,handleQuery)[_0xf0b7('0x73')](function(_0x4df49a){stats[_0xf0b7('0x74')]=!![];stats[_0xf0b7('0x75')]=_0x49c30a[_0xf0b7('0x63')]&&_0x49c30a[_0xf0b7('0x63')][_0xf0b7('0x5c')]?results[0x2][_0xf0b7('0x75')]:results[0x0][_0xf0b7('0x75')];socket['emit']('contact:import:'+_0xddbdaa,stats);fs[_0xf0b7('0x76')](_0x5ddb45);fs['unlink'](_0x164afa);process[_0xf0b7('0x3f')](0x0);})[_0xf0b7('0x44')](function(_0x3041f8){logger['error'](_0x3041f8[_0xf0b7('0x42')]);process[_0xf0b7('0x3f')](0x1);});}catch(_0x38276a){logger['error']('complete',_0x38276a[_0xf0b7('0x42')]);process[_0xf0b7('0x3f')](0x1);}},'error':function(_0x5705be,_0x28d783,_0x3eda01,_0x384e29){throw new Error(_0x384e29);}});}function validate(){if(process[_0xf0b7('0x77')]&&process[_0xf0b7('0x77')][_0xf0b7('0x5c')]<0x4){throw new Error(_0xf0b7('0x78'));}var _0x6a10b6=path[_0xf0b7('0x12')](config[_0xf0b7('0x4a')],_0xf0b7('0x4b'),process[_0xf0b7('0x77')][0x2]);if(!fs['existsSync'](_0x6a10b6)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1c5c90={};try{_0x1c5c90=JSON[_0xf0b7('0x4e')](process[_0xf0b7('0x77')][0x3]);if(!_0x1c5c90[_0xf0b7('0x48')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x1c5c90[_0xf0b7('0x48')][_0xf0b7('0x10')]){throw new Error(_0xf0b7('0x79'));}if(!_0x1c5c90[_0xf0b7('0x48')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x4e6271=0x0;if(_0x1c5c90[_0xf0b7('0x48')][_0xf0b7('0x25')]){_0x4e6271=0x1;}if(!_0x1c5c90[_0xf0b7('0x21')]){throw new Error(_0xf0b7('0x7a'));}}catch(_0x564b45){throw new Error(_0xf0b7('0x7b'));}var _0x4819d5=[];try{_0x4819d5=_[_0xf0b7('0x7c')](JSON[_0xf0b7('0x4e')](process[_0xf0b7('0x77')][0x4]),'id');}catch(_0x5a7e23){logger['info']('No\x20agent\x20available');}main(_0x6a10b6,_0x1c5c90,_0x4819d5,_0x4e6271);}validate();process['on'](_0xf0b7('0x7d'),handleStop);process['on'](_0xf0b7('0x7e'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 37b43b5..957117a 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 _0x5819=['duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','membername','starttime','Complete\x20Time','endtime','Duration'];(function(_0x5d506c,_0x20e254){var _0x3a4dd1=function(_0x374562){while(--_0x374562){_0x5d506c['push'](_0x5d506c['shift']());}};_0x3a4dd1(++_0x20e254);}(_0x5819,0x1dc));var _0x9581=function(_0x42c0ed,_0x5248aa){_0x42c0ed=_0x42c0ed-0x0;var _0x4ad9b0=_0x5819[_0x42c0ed];return _0x4ad9b0;};'use strict';exports[_0x9581('0x0')]=function(_0x368abf,_0x4e7b82){var _0x525506=[{'type':_0x9581('0x1'),'content':_0x9581('0x2'),'variableName':null}];switch(_0x368abf[_0x9581('0x3')]()){case _0x9581('0x4'):switch(_0x4e7b82[_0x9581('0x3')]()){case _0x9581('0x5'):_0x525506[_0x9581('0x6')]({'type':'variable','content':'','variableName':_0x9581('0x7')});_0x525506[_0x9581('0x6')]({'type':_0x9581('0x8'),'content':'','variableName':'calleridnum'});break;case _0x9581('0x9'):_0x525506[_0x9581('0x6')]({'type':_0x9581('0x1'),'content':_0x9581('0xa'),'variableName':null});_0x525506[_0x9581('0x6')]({'type':'variable','content':'','variableName':_0x9581('0xb')});break;}}return _0x525506;};exports[_0x9581('0xc')]=function(_0x17894f,_0x40b013){var _0x3119aa=[];switch(_0x17894f[_0x9581('0x3')]()){case'voice':switch(_0x40b013['toLowerCase']()){case'inbound':_0x3119aa=[{'type':'string','content':_0x9581('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0xf'),'keyType':'variable','variableName':'calleridnum'},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x10'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x11')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x12'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x13')},{'type':'keyValue','content':'','key':_0x9581('0x14'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0x9581('0x15'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x16')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x17'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x18')},{'type':_0x9581('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x19'),'keyType':_0x9581('0x8'),'variableName':'destcalleridname'},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x1a'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x9581('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x1b'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x18')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x1c'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x1d')},{'type':'keyValue','content':'','key':_0x9581('0x1e'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x1f')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x20'),'keyType':_0x9581('0x8'),'variableName':_0x9581('0x21')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x22'),'keyType':_0x9581('0x8'),'variableName':'talktime'}];break;case _0x9581('0x9'):_0x3119aa=[{'type':'string','content':_0x9581('0xd'),'variableName':null},{'type':_0x9581('0xe'),'content':'','key':'Called\x20Number','keyType':_0x9581('0x8'),'keyContent':'','variableName':_0x9581('0xb')},{'type':_0x9581('0xe'),'content':'','key':'Member\x20Name','keyType':_0x9581('0x8'),'keyContent':'','variableName':_0x9581('0x23')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x15'),'keyType':_0x9581('0x8'),'keyContent':'','variableName':'uniqueid'},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x17'),'keyType':_0x9581('0x8'),'keyContent':'','variableName':_0x9581('0x24')},{'type':_0x9581('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x25'),'keyType':_0x9581('0x8'),'keyContent':'','variableName':_0x9581('0x26')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x27'),'keyType':_0x9581('0x8'),'keyContent':'','variableName':_0x9581('0x28')},{'type':_0x9581('0xe'),'content':'','key':_0x9581('0x29'),'keyType':'variable','keyContent':'','variableName':_0x9581('0x2a')}];break;}}return _0x3119aa;}; \ No newline at end of file +var _0x66c7=['[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','string','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x66c7,0x111));var _0x766c=function(_0x274de3,_0x3c6b41){_0x274de3=_0x274de3-0x0;var _0x2bb217=_0x66c7[_0x274de3];return _0x2bb217;};'use strict';exports['getSubjects']=function(_0x4a2630,_0x2be24c){var _0xdadbf0=[{'type':'string','content':_0x766c('0x0'),'variableName':null}];switch(_0x4a2630[_0x766c('0x1')]()){case _0x766c('0x2'):switch(_0x2be24c[_0x766c('0x1')]()){case _0x766c('0x3'):_0xdadbf0['push']({'type':'variable','content':'','variableName':'queue'});_0xdadbf0[_0x766c('0x4')]({'type':_0x766c('0x5'),'content':'','variableName':_0x766c('0x6')});break;case _0x766c('0x7'):_0xdadbf0[_0x766c('0x4')]({'type':_0x766c('0x8'),'content':'Outbound\x20Call','variableName':null});_0xdadbf0[_0x766c('0x4')]({'type':'variable','content':'','variableName':_0x766c('0x9')});break;}}return _0xdadbf0;};exports['getDescriptions']=function(_0x5dee06,_0x30ca3a){var _0x4d7bd6=[];switch(_0x5dee06[_0x766c('0x1')]()){case'voice':switch(_0x30ca3a['toLowerCase']()){case _0x766c('0x3'):_0x4d7bd6=[{'type':_0x766c('0x8'),'content':_0x766c('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0xc'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x6')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0xd'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0xe')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':'destexten'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0xf'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x10')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x11'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x12')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x13'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x14')},{'type':_0x766c('0x8'),'content':_0x766c('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x16'),'keyType':_0x766c('0x5'),'variableName':'destcalleridname'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x17'),'keyType':_0x766c('0x5'),'variableName':'destcalleridnum'},{'type':_0x766c('0x8'),'content':_0x766c('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x766c('0xb'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0x766c('0x14')},{'type':_0x766c('0xb'),'content':'','key':'Agent\x20Connect','keyType':_0x766c('0x5'),'variableName':_0x766c('0x19')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x1a'),'keyType':'variable','variableName':_0x766c('0x1b')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x1c'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x1d')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x1e'),'keyType':_0x766c('0x5'),'variableName':_0x766c('0x1f')}];break;case _0x766c('0x7'):_0x4d7bd6=[{'type':_0x766c('0x8'),'content':_0x766c('0xa'),'variableName':null},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x20'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0x766c('0x11'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x13'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'starttime'},{'type':_0x766c('0x8'),'content':_0x766c('0x18')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x21'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x22'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':_0x766c('0x23')},{'type':_0x766c('0xb'),'content':'','key':_0x766c('0x24'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0x766c('0x25'),'keyType':_0x766c('0x5'),'keyContent':'','variableName':_0x766c('0x26')}];break;}}return _0x4d7bd6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 36bc2e1..d15e37d 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 _0x1862=['tracked','user','query','clone','body','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','then','update','info'];(function(_0x2b3d5f,_0x54cdb3){var _0x7a0e57=function(_0x3530fc){while(--_0x3530fc){_0x2b3d5f['push'](_0x2b3d5f['shift']());}};_0x7a0e57(++_0x54cdb3);}(_0x1862,0xd3));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2186('0x0'));var db=require(_0x2186('0x1'))['db'];var loggers={'openchannel':require(_0x2186('0x2'))(_0x2186('0x3')),'mail':require(_0x2186('0x2'))('mail-interactions'),'fax':require(_0x2186('0x2'))(_0x2186('0x4')),'sms':require('../../config/logger')(_0x2186('0x5')),'chat':require('../../config/logger')(_0x2186('0x6')),'whatsapp':require(_0x2186('0x2'))(_0x2186('0x7'))};function getInteractionId(_0x1b28ef,_0x3b92a4,_0x2036a2){if(_0x1b28ef&&_0x1b28ef[_[_0x2186('0x8')](_0x2036a2)+_0x2186('0x9')]){return _0x1b28ef[_[_0x2186('0x8')](_0x2036a2)+_0x2186('0x9')];}else if(_0x1b28ef&&_0x1b28ef['id']){return _0x1b28ef['id'];}else if(_0x3b92a4&&_0x3b92a4['id']){return _0x3b92a4['id'];}else{return _0x2186('0xa');}}function log(_0x2c60ec,_0x17096d,_0x2599a1,_0x411c9c,_0x2f8069,_0x29c2ef){loggers[_0x2f8069[_0x2186('0xb')]()][_0x2c60ec]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29c2ef[_0x2186('0xc')](),_0x17096d?_0x17096d['id']:null,_0x17096d?_0x17096d[_0x2186('0xd')]:null,_0x17096d?_0x17096d[_0x2186('0xe')]:null,getInteractionId(_0x2599a1,_0x411c9c,_0x2f8069),_0x2599a1?JSON[_0x2186('0xf')](_0x2599a1):_0x2186('0x10'));}function updateUser(_0x13e48a,_0x5bbf93,_0x59eae8,_0x564bad,_0x45bc11){db[_[_0x2186('0x8')](_0x564bad)+_0x2186('0x11')]['findOne']({'where':{'id':getInteractionId(_0x5bbf93,_0x59eae8,_0x564bad)}})[_0x2186('0x12')](function(_0x53224c){if(_0x53224c){return _0x53224c[_0x2186('0x13')]({'UserId':_0x13e48a?_0x13e48a['id']:null});}})[_0x2186('0x12')](function(_0x563d04){if(_0x563d04){log(_0x2186('0x14'),_0x13e48a,_0x5bbf93,_0x59eae8,_0x564bad,_0x45bc11);}})['catch'](function(){log('error',_0x13e48a,_0x5bbf93,_0x59eae8,_0x564bad,_0x45bc11);});}exports[_0x2186('0x15')]=function(_0xb9973c,_0x273885){return function(_0x3d6116,_0x8bfb85,_0x1ff43e){var _0x10f63e=_0x3d6116[_0x2186('0x16')];var _0x32d747={};var _0x11bfca=_0x3d6116[_0x2186('0x17')];if(_0x32d747){_0x32d747=_[_0x2186('0x18')](_0x3d6116['body']);_0x32d747=_['omit'](_0x32d747,[_0x2186('0x19'),'html',_0x2186('0x1a'),_0x2186('0x1b'),_0x2186('0x1c')]);}updateUser(_0x10f63e,_0x32d747,_0x11bfca,_0xb9973c,_0x273885);_0x1ff43e(null);};}; \ No newline at end of file +var _0xa675=['html','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','findOne','then','catch','error','tracked','user','clone','body','omit'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xa675,0x72));var _0x5a67=function(_0x5b11e0,_0x48afdf){_0x5b11e0=_0x5b11e0-0x0;var _0x40256b=_0xa675[_0x5b11e0];return _0x40256b;};'use strict';var _=require(_0x5a67('0x0'));var db=require(_0x5a67('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x5a67('0x2'))(_0x5a67('0x3')),'fax':require(_0x5a67('0x2'))(_0x5a67('0x4')),'sms':require('../../config/logger')(_0x5a67('0x5')),'chat':require('../../config/logger')(_0x5a67('0x6')),'whatsapp':require(_0x5a67('0x2'))('whatsapp-interactions')};function getInteractionId(_0x116b26,_0x48a916,_0xc803bf){if(_0x116b26&&_0x116b26[_['upperFirst'](_0xc803bf)+_0x5a67('0x7')]){return _0x116b26[_[_0x5a67('0x8')](_0xc803bf)+_0x5a67('0x7')];}else if(_0x116b26&&_0x116b26['id']){return _0x116b26['id'];}else if(_0x48a916&&_0x48a916['id']){return _0x48a916['id'];}else{return _0x5a67('0x9');}}function log(_0x533c78,_0x3fce2c,_0x2e4b91,_0x2798d7,_0x5dab26,_0xba4fea){loggers[_0x5dab26[_0x5a67('0xa')]()][_0x533c78](_0x5a67('0xb'),_0xba4fea[_0x5a67('0xc')](),_0x3fce2c?_0x3fce2c['id']:null,_0x3fce2c?_0x3fce2c['name']:null,_0x3fce2c?_0x3fce2c[_0x5a67('0xd')]:null,getInteractionId(_0x2e4b91,_0x2798d7,_0x5dab26),_0x2e4b91?JSON[_0x5a67('0xe')](_0x2e4b91):_0x5a67('0xf'));}function updateUser(_0x23e710,_0x4e1b93,_0x2b02ba,_0x397af5,_0x21d134){db[_[_0x5a67('0x8')](_0x397af5)+_0x5a67('0x10')][_0x5a67('0x11')]({'where':{'id':getInteractionId(_0x4e1b93,_0x2b02ba,_0x397af5)}})[_0x5a67('0x12')](function(_0x53737d){if(_0x53737d){return _0x53737d['update']({'UserId':_0x23e710?_0x23e710['id']:null});}})[_0x5a67('0x12')](function(_0x235cab){if(_0x235cab){log('info',_0x23e710,_0x4e1b93,_0x2b02ba,_0x397af5,_0x21d134);}})[_0x5a67('0x13')](function(){log(_0x5a67('0x14'),_0x23e710,_0x4e1b93,_0x2b02ba,_0x397af5,_0x21d134);});}exports[_0x5a67('0x15')]=function(_0x4672ef,_0x6f4be4){return function(_0x233342,_0x468bb8,_0x35baef){var _0x23c758=_0x233342[_0x5a67('0x16')];var _0x501bb0={};var _0x5e00d0=_0x233342['query'];if(_0x501bb0){_0x501bb0=_[_0x5a67('0x17')](_0x233342[_0x5a67('0x18')]);_0x501bb0=_[_0x5a67('0x19')](_0x501bb0,[_0x5a67('0x18'),_0x5a67('0x1a'),'phone','fax',_0x5a67('0x1b')]);}updateUser(_0x23c758,_0x501bb0,_0x5e00d0,_0x4672ef,_0x6f4be4);_0x35baef(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 19cb53f..472c8c6 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 _0x2019=['createDecipher','aes-256-ctr','format','update','base64','final','parse','hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split'];(function(_0x468352,_0x5d6ea7){var _0xa91c44=function(_0x22107e){while(--_0x22107e){_0x468352['push'](_0x468352['shift']());}};_0xa91c44(++_0x5d6ea7);}(_0x2019,0x16f));var _0x9201=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2019[_0x341e0f];return _0x59555a;};'use strict';var crypto=require(_0x9201('0x0'));var util=require(_0x9201('0x1'));var compose=require(_0x9201('0x2'));var db=require(_0x9201('0x3'))['db'];var config=require(_0x9201('0x4'));function getValueFromLicense(_0x53e17d,_0x5c4123){if(_0x53e17d&&_0x5c4123){if(_0x5c4123['data1']&&_0x5c4123[_0x9201('0x5')]){var _0x224b49=_0x5c4123[_0x9201('0x6')];var _0x109f77=_0x5c4123[_0x9201('0x5')];var _0x3d030c=_0x224b49[_0x9201('0x7')]('-')[0x4];var _0x2054af=_0x224b49[_0x9201('0x7')]('-')[0x0];var _0x3a3175=crypto[_0x9201('0x8')](_0x9201('0x9'),util[_0x9201('0xa')]('%s:%s:%s',_0x3d030c,_0x224b49,_0x2054af));var _0x25b383=_0x3a3175[_0x9201('0xb')](_0x109f77,_0x9201('0xc'),'utf8');_0x25b383+=_0x3a3175[_0x9201('0xd')]('utf8');var _0x1852c9=JSON[_0x9201('0xe')](_0x25b383);return _0x1852c9[_0x9201('0xf')](_0x53e17d)?_0x1852c9[_0x53e17d]:null;}}return null;}function isLimit(_0x5c31e4,_0x2b6c21,_0x4f0d3c,_0x44b743){var _0x1d912e=_0x2b6c21;return compose()['use'](function(_0x2a6393,_0x13c291,_0x557b30){return db['License'][_0x9201('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x9201('0x11')](function(_0x1b5472){var _0x33786e=getValueFromLicense(_0x5c31e4,_0x1b5472);return _0x33786e?_0x33786e:_0x1d912e;})[_0x9201('0x11')](function(_0x3581ec){_0x1d912e=_0x3581ec;return _0x4f0d3c[_0x9201('0x12')](_0x44b743);})[_0x9201('0x11')](function(_0x5806c4){if(_0x5806c4>=_0x1d912e){return _0x13c291[_0x9201('0x13')](0x193)[_0x9201('0x14')]({'message':util[_0x9201('0xa')](_0x9201('0x15'),_0x5c31e4)});}_0x557b30();})[_0x9201('0x16')](function(_0x301a63){_0x557b30(_0x301a63);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x9201('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x9201('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xa63d=['license','split','createDecipher','aes-256-ctr','format','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1'];(function(_0x18d36f,_0x31b65f){var _0x10034d=function(_0x38bb30){while(--_0x38bb30){_0x18d36f['push'](_0x18d36f['shift']());}};_0x10034d(++_0x31b65f);}(_0xa63d,0xbf));var _0xda63=function(_0x4854ed,_0xf1d3e2){_0x4854ed=_0x4854ed-0x0;var _0x17bd4c=_0xa63d[_0x4854ed];return _0x17bd4c;};'use strict';var crypto=require('crypto');var util=require(_0xda63('0x0'));var compose=require(_0xda63('0x1'));var db=require(_0xda63('0x2'))['db'];var config=require(_0xda63('0x3'));function getValueFromLicense(_0x575a75,_0x46fa8e){if(_0x575a75&&_0x46fa8e){if(_0x46fa8e[_0xda63('0x4')]&&_0x46fa8e[_0xda63('0x5')]){var _0x588ca4=_0x46fa8e[_0xda63('0x4')];var _0x50aeaf=_0x46fa8e[_0xda63('0x5')];var _0xc1dfff=_0x588ca4[_0xda63('0x6')]('-')[0x4];var _0x43fe37=_0x588ca4[_0xda63('0x6')]('-')[0x0];var _0xbc83dd=crypto[_0xda63('0x7')](_0xda63('0x8'),util[_0xda63('0x9')]('%s:%s:%s',_0xc1dfff,_0x588ca4,_0x43fe37));var _0x117bd3=_0xbc83dd['update'](_0x50aeaf,_0xda63('0xa'),_0xda63('0xb'));_0x117bd3+=_0xbc83dd[_0xda63('0xc')](_0xda63('0xb'));var _0x3c022a=JSON[_0xda63('0xd')](_0x117bd3);return _0x3c022a[_0xda63('0xe')](_0x575a75)?_0x3c022a[_0x575a75]:null;}}return null;}function isLimit(_0x3340f5,_0x41d7c7,_0x1f7159,_0x51555c){var _0x5dac31=_0x41d7c7;return compose()[_0xda63('0xf')](function(_0x1fac2d,_0x4ca602,_0x4d843e){return db['License'][_0xda63('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xda63('0x11')](function(_0x21937b){var _0x104f1d=getValueFromLicense(_0x3340f5,_0x21937b);return _0x104f1d?_0x104f1d:_0x5dac31;})[_0xda63('0x11')](function(_0xabbf72){_0x5dac31=_0xabbf72;return _0x1f7159[_0xda63('0x12')](_0x51555c);})[_0xda63('0x11')](function(_0x364996){if(_0x364996>=_0x5dac31){return _0x4ca602[_0xda63('0x13')](0x193)[_0xda63('0x14')]({'message':util[_0xda63('0x9')](_0xda63('0x15'),_0x3340f5)});}_0x4d843e();})[_0xda63('0x16')](function(_0xca94fe){_0x4d843e(_0xca94fe);});});}function isUserLimit(){return isLimit(_0xda63('0x17'),0x1,db[_0xda63('0x18')],{'where':{'$or':[{'role':_0xda63('0x19')},{'role':_0xda63('0x1a')}]}});}exports[_0xda63('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 3caa53c..a44eb23 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 _0xde4b=['LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','\x20AS\x20','castTo','field','$notIn','text','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','$endsWith'];(function(_0x8e5cc8,_0x25a924){var _0x3377f5=function(_0x394b84){while(--_0x394b84){_0x8e5cc8['push'](_0x8e5cc8['shift']());}};_0x3377f5(++_0x25a924);}(_0xde4b,0xb5));var _0xbde4=function(_0x117c97,_0x5c7ba2){_0x117c97=_0x117c97-0x0;var _0xb3a3fe=_0xde4b[_0x117c97];return _0xb3a3fe;};'use strict';var _=require('lodash');var moment=require(_0xbde4('0x0'));exports[_0xbde4('0x1')]=function(_0x11798d){var _0x5bc3b8={'conditions':[]};_0x5bc3b8[_0xbde4('0x2')]=_[_0xbde4('0x3')](_0x11798d,_0xbde4('0x4'))?'or':_0xbde4('0x5');var _0x1d64b9=_0x11798d[_0xbde4('0x6')](_0xbde4('0x7'),'')['replace'](_0xbde4('0x4'),'')[_0xbde4('0x8')]('||');for(var _0x548dc0=0x0;_0x548dc0<_0x1d64b9[_0xbde4('0x9')];_0x548dc0++){var _0x22cdb4=_0x1d64b9[_0x548dc0][_0xbde4('0x8')](':=');var _0x31e4e1=_0x22cdb4[0x0];var _0x19df7b=_0x22cdb4['slice'](0x1);_0x19df7b['forEach'](function(_0x15500f){var _0x3d7ec2=_0x15500f[_0xbde4('0x8')]('[')[_0xbde4('0xa')]();var _0x26be91=_0x15500f[_0xbde4('0xb')](/\[(.*?)\]/g);_0x26be91[_0xbde4('0xc')](function(_0x582cf4){var _0x9648b9=_0x582cf4[_0xbde4('0x8')]('[')[_0xbde4('0xd')](function(_0x56a4b0){return _0x56a4b0[_0xbde4('0xe')](']')>-0x1;})[_0xbde4('0xf')](function(_0x2e5dbe){return _0x2e5dbe[_0xbde4('0x8')](']')[0x0];})[0x0];_0x5bc3b8[_0xbde4('0x10')][_0xbde4('0x11')]({'field':_0x31e4e1,'operator':_0x3d7ec2,'value':_0x9648b9});});});}return _0x5bc3b8;};exports[_0xbde4('0x12')]=function(_0x1e309a,_0x5f2f4f,_0x1aa4c7){var _0x39cead={};if(_0x5f2f4f===_0xbde4('0x13')){if(_0x1aa4c7[_0xbde4('0x14')]===_0xbde4('0x15')){_0x1aa4c7['operator']=_0xbde4('0x16');_0x1aa4c7[_0xbde4('0x17')]+=','+_0x1aa4c7[_0xbde4('0x17')];}else if(_[_0xbde4('0x18')]([_0xbde4('0x19'),'$lte'],_0x1aa4c7[_0xbde4('0x14')])){_0x1aa4c7[_0xbde4('0x17')]=moment(_0x1aa4c7['value'])[_0xbde4('0x1a')](0x1,_0xbde4('0x1b'))[_0xbde4('0x1c')](_0xbde4('0x1d'));}}if(_0x1aa4c7['castTo']){_0x5f2f4f=_0x1aa4c7['castTo'];_0x39cead['text']='CAST('+_0x1e309a+'.'+_0x1aa4c7['field']+_0xbde4('0x1e')+_0x1aa4c7[_0xbde4('0x1f')]+')\x20'+parseOperator(_0x1aa4c7[_0xbde4('0x14')]);}else{_0x39cead['text']=_0x1e309a+'.'+_0x1aa4c7[_0xbde4('0x20')]+'\x20'+parseOperator(_0x1aa4c7[_0xbde4('0x14')]);}if(_[_0xbde4('0x18')](['$ne',_0xbde4('0x21')],_0x1aa4c7['operator']))_0x39cead[_0xbde4('0x22')]='('+_0x39cead[_0xbde4('0x22')]+'\x20OR\x20'+_0x1e309a+'.'+_0x1aa4c7[_0xbde4('0x20')]+'\x20IS\x20NULL)';_0x39cead['value']=parseValue(_0x5f2f4f,_0x1aa4c7[_0xbde4('0x14')],_0x1aa4c7['value']);return _0x39cead;};function parseOperator(_0x4def11){var _0x50e66b;switch(_0x4def11){case _0xbde4('0x23'):_0x50e66b=_0xbde4('0x24');break;case _0xbde4('0x21'):_0x50e66b=_0xbde4('0x25');break;case'$eq':_0x50e66b=_0xbde4('0x26');break;case _0xbde4('0x27'):_0x50e66b=_0xbde4('0x28');break;case'$substring':case _0xbde4('0x29'):case _0xbde4('0x2a'):_0x50e66b=_0xbde4('0x2b');break;case'$lt':_0x50e66b=_0xbde4('0x2c');break;case _0xbde4('0x19'):_0x50e66b=_0xbde4('0x2d');break;case _0xbde4('0x2e'):_0x50e66b=_0xbde4('0x2f');break;case _0xbde4('0x30'):_0x50e66b='>=\x20?';break;case'$between':_0x50e66b=_0xbde4('0x31');break;}return _0x50e66b;}function parseValue(_0x203806,_0x3298b0,_0x5f1eff){var _0x288563={'start':undefined,'end':undefined};switch(_0x3298b0){case _0xbde4('0x23'):case _0xbde4('0x21'):_0x288563[_0xbde4('0x32')]=_0x5f1eff[_0xbde4('0x8')](',');break;case _0xbde4('0x33'):_0x288563[_0xbde4('0x32')]='%'+_0x5f1eff+'%';break;case _0xbde4('0x29'):_0x288563['start']=_0x5f1eff+'%';break;case _0xbde4('0x2a'):_0x288563[_0xbde4('0x32')]='%'+_0x5f1eff;break;case _0xbde4('0x16'):var _0x47e3b0=_0x5f1eff[_0xbde4('0x8')](',');var _0x5f1eff=_0x47e3b0[_0xbde4('0xa')]();var _0x1bb3ef=_0x47e3b0[_0xbde4('0x34')]();if(_0x203806===_0xbde4('0x13')){_0x5f1eff=moment(_0x5f1eff)[_0xbde4('0x35')](0x0,!![])['format']();_0x1bb3ef=moment(_0x1bb3ef)['utcOffset'](0x0,!![])[_0xbde4('0x1a')](0x17,_0xbde4('0x36'))[_0xbde4('0x1a')](0x3b,_0xbde4('0x37'))[_0xbde4('0x1a')](0x3b,'seconds')[_0xbde4('0x1c')]();}_0x288563={'start':_0x5f1eff,'end':_0x1bb3ef};break;default:_0x288563[_0xbde4('0x32')]=_0x5f1eff;break;}return _0x288563;} \ No newline at end of file +var _0x2fd3=['$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','slice','shift','forEach','filter','indexOf','map','conditions','DATE','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x2fd3,0xf0));var _0x32fd=function(_0x5cbe2b,_0x15b394){_0x5cbe2b=_0x5cbe2b-0x0;var _0xef566=_0x2fd3[_0x5cbe2b];return _0xef566;};'use strict';var _=require('lodash');var moment=require(_0x32fd('0x0'));exports[_0x32fd('0x1')]=function(_0x4e90aa){var _0x37f53a={'conditions':[]};_0x37f53a[_0x32fd('0x2')]=_[_0x32fd('0x3')](_0x4e90aa,'[$or]')?'or':_0x32fd('0x4');var _0x58c264=_0x4e90aa[_0x32fd('0x5')](_0x32fd('0x6'),'')[_0x32fd('0x5')](_0x32fd('0x7'),'')['split']('||');for(var _0x355102=0x0;_0x355102<_0x58c264[_0x32fd('0x8')];_0x355102++){var _0x59ae33=_0x58c264[_0x355102][_0x32fd('0x9')](':=');var _0x521bd4=_0x59ae33[0x0];var _0x55bb6a=_0x59ae33[_0x32fd('0xa')](0x1);_0x55bb6a['forEach'](function(_0xc8a6af){var _0x32b4c3=_0xc8a6af['split']('[')[_0x32fd('0xb')]();var _0x434775=_0xc8a6af['match'](/\[(.*?)\]/g);_0x434775[_0x32fd('0xc')](function(_0x1eceb8){var _0x2ba0af=_0x1eceb8['split']('[')[_0x32fd('0xd')](function(_0x25230a){return _0x25230a[_0x32fd('0xe')](']')>-0x1;})[_0x32fd('0xf')](function(_0x16c334){return _0x16c334['split'](']')[0x0];})[0x0];_0x37f53a[_0x32fd('0x10')]['push']({'field':_0x521bd4,'operator':_0x32b4c3,'value':_0x2ba0af});});});}return _0x37f53a;};exports['buildExpression']=function(_0x17f58f,_0x587a43,_0x3fcb76){var _0x37b201={};if(_0x587a43===_0x32fd('0x11')){if(_0x3fcb76[_0x32fd('0x12')]==='$eq'){_0x3fcb76['operator']=_0x32fd('0x13');_0x3fcb76['value']+=','+_0x3fcb76[_0x32fd('0x14')];}else if(_['includes']([_0x32fd('0x15'),_0x32fd('0x16')],_0x3fcb76[_0x32fd('0x12')])){_0x3fcb76[_0x32fd('0x14')]=moment(_0x3fcb76[_0x32fd('0x14')])[_0x32fd('0x17')](0x1,_0x32fd('0x18'))[_0x32fd('0x19')](_0x32fd('0x1a'));}}if(_0x3fcb76[_0x32fd('0x1b')]){_0x587a43=_0x3fcb76[_0x32fd('0x1b')];_0x37b201[_0x32fd('0x1c')]='CAST('+_0x17f58f+'.'+_0x3fcb76[_0x32fd('0x1d')]+_0x32fd('0x1e')+_0x3fcb76[_0x32fd('0x1b')]+')\x20'+parseOperator(_0x3fcb76[_0x32fd('0x12')]);}else{_0x37b201[_0x32fd('0x1c')]=_0x17f58f+'.'+_0x3fcb76[_0x32fd('0x1d')]+'\x20'+parseOperator(_0x3fcb76[_0x32fd('0x12')]);}if(_[_0x32fd('0x1f')]([_0x32fd('0x20'),_0x32fd('0x21')],_0x3fcb76[_0x32fd('0x12')]))_0x37b201['text']='('+_0x37b201[_0x32fd('0x1c')]+_0x32fd('0x22')+_0x17f58f+'.'+_0x3fcb76[_0x32fd('0x1d')]+'\x20IS\x20NULL)';_0x37b201[_0x32fd('0x14')]=parseValue(_0x587a43,_0x3fcb76[_0x32fd('0x12')],_0x3fcb76[_0x32fd('0x14')]);return _0x37b201;};function parseOperator(_0x3ed4e9){var _0x595dd5;switch(_0x3ed4e9){case'$in':_0x595dd5=_0x32fd('0x23');break;case _0x32fd('0x21'):_0x595dd5=_0x32fd('0x24');break;case _0x32fd('0x25'):_0x595dd5=_0x32fd('0x26');break;case _0x32fd('0x20'):_0x595dd5=_0x32fd('0x27');break;case _0x32fd('0x28'):case _0x32fd('0x29'):case _0x32fd('0x2a'):_0x595dd5=_0x32fd('0x2b');break;case _0x32fd('0x2c'):_0x595dd5=_0x32fd('0x2d');break;case _0x32fd('0x15'):_0x595dd5=_0x32fd('0x2e');break;case _0x32fd('0x16'):_0x595dd5=_0x32fd('0x2f');break;case'$gte':_0x595dd5=_0x32fd('0x30');break;case _0x32fd('0x13'):_0x595dd5=_0x32fd('0x31');break;}return _0x595dd5;}function parseValue(_0x2bfe67,_0x22b150,_0x280c11){var _0x2c7900={'start':undefined,'end':undefined};switch(_0x22b150){case _0x32fd('0x32'):case _0x32fd('0x21'):_0x2c7900[_0x32fd('0x33')]=_0x280c11['split'](',');break;case'$substring':_0x2c7900[_0x32fd('0x33')]='%'+_0x280c11+'%';break;case _0x32fd('0x29'):_0x2c7900[_0x32fd('0x33')]=_0x280c11+'%';break;case'$endsWith':_0x2c7900['start']='%'+_0x280c11;break;case'$between':var _0x370b31=_0x280c11[_0x32fd('0x9')](',');var _0x280c11=_0x370b31[_0x32fd('0xb')]();var _0x59f8fd=_0x370b31[_0x32fd('0x34')]();if(_0x2bfe67===_0x32fd('0x11')){_0x280c11=moment(_0x280c11)[_0x32fd('0x35')](0x0,!![])[_0x32fd('0x19')]();_0x59f8fd=moment(_0x59f8fd)[_0x32fd('0x35')](0x0,!![])[_0x32fd('0x17')](0x17,_0x32fd('0x36'))[_0x32fd('0x17')](0x3b,_0x32fd('0x37'))[_0x32fd('0x17')](0x3b,'seconds')[_0x32fd('0x19')]();}_0x2c7900={'start':_0x280c11,'end':_0x59f8fd};break;default:_0x2c7900[_0x32fd('0x33')]=_0x280c11;break;}return _0x2c7900;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ddc5786..038b702 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 _0xe015=['cast','unsigned','substr','DESC','ASC','omit','isArray','length','isObject','isString','hasOwnProperty','isNumeric','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','nolimit','offset','order','where','pick','filter','columns','name','value','VIRTUAL','lower','merge','options','lodash','sequelize','moment','keys','includes','parse','fields','split','filters','isEmpty','find','type','$gte','format','YYYY-MM-DD','utc','uniqueid','limit','sort','map','priority'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe015,0x13b));var _0x5e01=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe015[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x5e01('0x0'));var sequelize=require(_0x5e01('0x1'));var moment=require(_0x5e01('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5811ae){var _0x51f689=['ne'];try{var _0x46ed0d=JSON['parse'](_0x5811ae);var _0x2136cf=Object[_0x5e01('0x3')](_0x46ed0d)[0x0];return _0x51f689[_0x5e01('0x4')](_0x2136cf);}catch(_0x241c0e){return![];}}function getOperatorValue(_0x4ac3f1){var _0x1814cb=JSON[_0x5e01('0x5')](_0x4ac3f1);var _0x4de678=Object['keys'](_0x1814cb)[0x0];var _0x414f73=_0x1814cb[_0x4de678];return{['$'+_0x4de678]:_0x414f73};}exports[_0x5e01('0x6')]=function(_0x1420c2){var _0x40d31f=null;if(_0x1420c2){_0x40d31f=_0x1420c2[_0x5e01('0x7')](',');}return _0x40d31f;};exports[_0x5e01('0x8')]=function(_0x5b3938,_0x1c4a44){var _0x502518={};if(!_[_0x5e01('0x9')](_0x5b3938)){_['forOwn'](_0x5b3938,function(_0x3c2ea2,_0x406b26){try{if(_0x1c4a44){var _0x553a53=_[_0x5e01('0xa')](_0x1c4a44,{'name':_0x406b26})||{};if(hasSequelizeOperator(_0x3c2ea2)){_0x502518[_0x406b26]=getOperatorValue(_0x3c2ea2);}else if(_0x553a53[_0x5e01('0xb')]==='DATE'&&_['isPlainObject'](_0x3c2ea2)){var _0x3d0b04=JSON[_0x5e01('0x5')](_0x3c2ea2);var _0x468901={'$gte':moment(moment(_0x3d0b04[_0x5e01('0xc')])[_0x5e01('0xd')](_0x5e01('0xe')))['utc']()[_0x5e01('0xd')](),'$lte':moment(moment(_0x3d0b04['$lte'])['format'](_0x5e01('0xe')))[_0x5e01('0xf')]()['subtract'](0x1,'s')[_0x5e01('0xd')]()};_0x502518[_0x406b26]=_0x468901;}else if(_0x553a53['name']===_0x5e01('0x10')){_0x502518[_0x406b26]=_0x3c2ea2;}else{_0x502518[_0x406b26]=_['isArray'](_0x3c2ea2)?_0x3c2ea2:JSON[_0x5e01('0x5')](_0x3c2ea2);}}else{_0x502518[_0x406b26]=_['isArray'](_0x3c2ea2)?_0x3c2ea2:JSON[_0x5e01('0x5')](_0x3c2ea2);}}catch(_0x5eda1d){_0x502518[_0x406b26]=_0x3c2ea2['split'](',');}});}return _0x502518;};exports[_0x5e01('0x11')]=function(_0x42b4f8){_0x42b4f8=parseInt(_0x42b4f8,0xa);if(!_0x42b4f8||_0x42b4f8<0x0){_0x42b4f8=LIMIT_VALUE;}return _0x42b4f8;};exports['offset']=function(_0xce3f3f){_0xce3f3f=parseInt(_0xce3f3f,0xa);if(!_0xce3f3f||_0xce3f3f<0x0){_0xce3f3f=0x0;}return _0xce3f3f;};exports[_0x5e01('0x12')]=function(_0x36b4a7){var _0x45e543,_0x396cf3=null;if(_0x36b4a7){_0x45e543=_0x36b4a7[_0x5e01('0x7')](',');_0x396cf3=_[_0x5e01('0x13')](_0x45e543,function(_0x153eb1){if(_0x153eb1['indexOf']('-')===0x0){return[_0x153eb1===_0x5e01('0x14')?sequelize[_0x5e01('0x15')](sequelize['col'](_0x5e01('0x14')),_0x5e01('0x16')):_0x153eb1[_0x5e01('0x17')](0x1),_0x5e01('0x18')];}else{return[_0x153eb1===_0x5e01('0x14')?sequelize[_0x5e01('0x15')](sequelize['col'](_0x5e01('0x14')),_0x5e01('0x16')):_0x153eb1,_0x5e01('0x19')];}});}return _0x396cf3;};exports[_0x5e01('0x1a')]=function(_0x514ade,_0x557f06){if(_[_0x5e01('0x9')](_0x514ade)){return _0x514ade;}if(_[_0x5e01('0x1b')](_0x514ade)){for(var _0x4f94d0=0x0;_0x4f94d0<_0x514ade[_0x5e01('0x1c')];_0x4f94d0+=0x1){_0x514ade[_0x4f94d0]=this[_0x5e01('0x1a')](_0x514ade[_0x4f94d0],_0x557f06);}return _0x514ade;}if(!_[_0x5e01('0x1d')](_0x514ade)){return _0x514ade;}if(_[_0x5e01('0x1e')](_0x557f06)){_0x557f06=[_0x557f06];}if(!_['isArray'](_0x557f06)){return _0x514ade;}for(var _0x4d0ebe=0x0;_0x4d0ebe<_0x557f06[_0x5e01('0x1c')];_0x4d0ebe+=0x1){_['unset'](_0x514ade,_0x557f06[_0x4d0ebe]);}for(var _0x14b9f5 in _0x514ade){if(_0x514ade[_0x5e01('0x1f')](_0x14b9f5)){_0x514ade[_0x14b9f5]=this[_0x5e01('0x1a')](_0x514ade[_0x14b9f5],_0x557f06);}}return _0x514ade;};exports[_0x5e01('0x20')]=function(_0x592a61){return _0x592a61['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x350ab4){return _0x350ab4['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x5e01('0x21')]=function(_0x37b32a){var _0xc6d3c2=[];_0x37b32a['split'](/[ ,]+/)[_0x5e01('0x22')](function(_0x36d7a8){_0x36d7a8=_0x36d7a8[_0x5e01('0x23')](/([^:]")"+/g,'$1');_0x36d7a8='+'+_0x36d7a8+'*';var _0x33b3b3=/[ `!@#$%^&*()_\-?~]/;if(_0x36d7a8['match'](_0x33b3b3))_0x36d7a8='\x22'+_0x36d7a8+'\x22';_0xc6d3c2['push'](_0x36d7a8);});return _0xc6d3c2[_0x5e01('0x24')]('\x20');};exports[_0x5e01('0x25')]=function(_0x308649,_0x207107,_0x350659){var _0x1a0ebe={},_0x2bc93b={};if(_0x207107[_0x5e01('0x26')][_0x5e01('0x27')]){_0x207107[_0x5e01('0x26')]['id']=_0x207107[_0x5e01('0x26')][_0x5e01('0x27')];delete _0x207107['query'][_0x5e01('0x27')];}_0x1a0ebe[_0x5e01('0x28')]=_[_0x5e01('0x13')](_0x308649,'name');_0x1a0ebe[_0x5e01('0x26')]=_[_0x5e01('0x3')](_0x207107['query']);_0x1a0ebe[_0x5e01('0x8')]=_[_0x5e01('0x29')](_0x1a0ebe[_0x5e01('0x28')],_0x1a0ebe['query']);_0x2bc93b[_0x5e01('0x2a')]=_[_0x5e01('0x29')](_0x1a0ebe[_0x5e01('0x28')],this[_0x5e01('0x6')](_0x207107[_0x5e01('0x26')][_0x5e01('0x6')]));_0x2bc93b[_0x5e01('0x2a')]=_0x2bc93b[_0x5e01('0x2a')][_0x5e01('0x1c')]?_0x2bc93b[_0x5e01('0x2a')]:_0x1a0ebe[_0x5e01('0x28')];if(!_0x207107[_0x5e01('0x26')][_0x5e01('0x1f')](_0x5e01('0x2b'))){_0x2bc93b[_0x5e01('0x11')]=this['limit'](_0x207107[_0x5e01('0x26')]['limit']);_0x2bc93b['offset']=this[_0x5e01('0x2c')](_0x207107[_0x5e01('0x26')][_0x5e01('0x2c')]);}_0x2bc93b[_0x5e01('0x2d')]=this[_0x5e01('0x12')](_0x207107['query'][_0x5e01('0x12')]);_0x2bc93b[_0x5e01('0x2e')]=this['filters'](_[_0x5e01('0x2f')](_0x207107[_0x5e01('0x26')],_0x1a0ebe[_0x5e01('0x8')]),_0x308649);if(_0x207107['query'][_0x5e01('0x30')]){var _0xfed2d2=_0x308649;var _0x503c8c=_0x207107[_0x5e01('0x26')][_0x5e01('0x30')];if(typeof _0x503c8c==='object'){_0xfed2d2=_['filter'](_0x308649,function(_0xce5f1b){return _['includes'](_0x503c8c[_0x5e01('0x31')],_0xce5f1b[_0x5e01('0x32')]);});_0x503c8c=_0x503c8c[_0x5e01('0x33')];}_0x2bc93b[_0x5e01('0x2e')]=_['merge'](_0x2bc93b[_0x5e01('0x2e')],{'$or':_[_0x5e01('0x13')](_0xfed2d2,function(_0x23275f){if(_0x23275f[_0x5e01('0xb')]!==_0x5e01('0x34')){if(_0x350659){return sequelize[_0x5e01('0x2e')](sequelize['fn'](_0x5e01('0x35'),sequelize['col'](_0x23275f[_0x5e01('0x32')])),{'$like':sequelize['fn'](_0x5e01('0x35'),'%'+_0x207107[_0x5e01('0x26')][_0x5e01('0x30')]+'%')});}else{var _0x1fb95f={};_0x1fb95f[_0x23275f['name']]={'$like':'%'+_0x207107[_0x5e01('0x26')][_0x5e01('0x30')]+'%'};return _0x1fb95f;}}})});}_0x2bc93b=_[_0x5e01('0x36')]({},_0x2bc93b,_0x207107[_0x5e01('0x37')]);return _0x2bc93b;}; \ No newline at end of file +var _0xa630=['parse','keys','includes','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','attributes','intersection','length','nolimit','pick','filter','object','columns','value','where','type','VIRTUAL','lower','merge','options','lodash','sequelize'];(function(_0x1777bd,_0x3f119c){var _0x2a162e=function(_0x24f293){while(--_0x24f293){_0x1777bd['push'](_0x1777bd['shift']());}};_0x2a162e(++_0x3f119c);}(_0xa630,0xbe));var _0x0a63=function(_0x216242,_0x84456a){_0x216242=_0x216242-0x0;var _0x3c646e=_0xa630[_0x216242];return _0x3c646e;};'use strict';var _=require(_0x0a63('0x0'));var sequelize=require(_0x0a63('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x52ad93){var _0x1a9586=['ne'];try{var _0x4f6b34=JSON[_0x0a63('0x2')](_0x52ad93);var _0x506b55=Object[_0x0a63('0x3')](_0x4f6b34)[0x0];return _0x1a9586[_0x0a63('0x4')](_0x506b55);}catch(_0x2cfdeb){return![];}}function getOperatorValue(_0x2380f8){var _0x37b4c9=JSON['parse'](_0x2380f8);var _0x2760b0=Object[_0x0a63('0x3')](_0x37b4c9)[0x0];var _0xc2dcd7=_0x37b4c9[_0x2760b0];return{['$'+_0x2760b0]:_0xc2dcd7};}exports[_0x0a63('0x5')]=function(_0x12a7df){var _0x2a1bd7=null;if(_0x12a7df){_0x2a1bd7=_0x12a7df['split'](',');}return _0x2a1bd7;};exports[_0x0a63('0x6')]=function(_0xb714c7,_0x2dcbda){var _0x218142={};if(!_[_0x0a63('0x7')](_0xb714c7)){_[_0x0a63('0x8')](_0xb714c7,function(_0x207434,_0x22f340){try{if(_0x2dcbda){var _0x258511=_[_0x0a63('0x9')](_0x2dcbda,{'name':_0x22f340})||{};if(hasSequelizeOperator(_0x207434)){_0x218142[_0x22f340]=getOperatorValue(_0x207434);}else if(_0x258511['type']===_0x0a63('0xa')&&_[_0x0a63('0xb')](_0x207434)){var _0x2fce86=JSON[_0x0a63('0x2')](_0x207434);var _0x55cb2f={'$gte':moment(moment(_0x2fce86[_0x0a63('0xc')])['format'](_0x0a63('0xd')))[_0x0a63('0xe')]()[_0x0a63('0xf')](),'$lte':moment(moment(_0x2fce86[_0x0a63('0x10')])[_0x0a63('0xf')](_0x0a63('0xd')))[_0x0a63('0xe')]()[_0x0a63('0x11')](0x1,'s')['format']()};_0x218142[_0x22f340]=_0x55cb2f;}else if(_0x258511[_0x0a63('0x12')]==='uniqueid'){_0x218142[_0x22f340]=_0x207434;}else{_0x218142[_0x22f340]=_[_0x0a63('0x13')](_0x207434)?_0x207434:JSON[_0x0a63('0x2')](_0x207434);}}else{_0x218142[_0x22f340]=_[_0x0a63('0x13')](_0x207434)?_0x207434:JSON[_0x0a63('0x2')](_0x207434);}}catch(_0x1f7481){_0x218142[_0x22f340]=_0x207434[_0x0a63('0x14')](',');}});}return _0x218142;};exports[_0x0a63('0x15')]=function(_0x374c52){_0x374c52=parseInt(_0x374c52,0xa);if(!_0x374c52||_0x374c52<0x0){_0x374c52=LIMIT_VALUE;}return _0x374c52;};exports[_0x0a63('0x16')]=function(_0x3cc74d){_0x3cc74d=parseInt(_0x3cc74d,0xa);if(!_0x3cc74d||_0x3cc74d<0x0){_0x3cc74d=0x0;}return _0x3cc74d;};exports[_0x0a63('0x17')]=function(_0x4ea56f){var _0x550568,_0x7b2ccd=null;if(_0x4ea56f){_0x550568=_0x4ea56f['split'](',');_0x7b2ccd=_[_0x0a63('0x18')](_0x550568,function(_0x5937df){if(_0x5937df[_0x0a63('0x19')]('-')===0x0){return[_0x5937df===_0x0a63('0x1a')?sequelize[_0x0a63('0x1b')](sequelize[_0x0a63('0x1c')]('priority'),_0x0a63('0x1d')):_0x5937df['substr'](0x1),_0x0a63('0x1e')];}else{return[_0x5937df===_0x0a63('0x1a')?sequelize[_0x0a63('0x1b')](sequelize[_0x0a63('0x1c')](_0x0a63('0x1a')),_0x0a63('0x1d')):_0x5937df,_0x0a63('0x1f')];}});}return _0x7b2ccd;};exports[_0x0a63('0x20')]=function(_0x567017,_0x5e5987){if(_['isEmpty'](_0x567017)){return _0x567017;}if(_['isArray'](_0x567017)){for(var _0xeacfc9=0x0;_0xeacfc9<_0x567017['length'];_0xeacfc9+=0x1){_0x567017[_0xeacfc9]=this['omit'](_0x567017[_0xeacfc9],_0x5e5987);}return _0x567017;}if(!_[_0x0a63('0x21')](_0x567017)){return _0x567017;}if(_[_0x0a63('0x22')](_0x5e5987)){_0x5e5987=[_0x5e5987];}if(!_[_0x0a63('0x13')](_0x5e5987)){return _0x567017;}for(var _0x2e2526=0x0;_0x2e2526<_0x5e5987['length'];_0x2e2526+=0x1){_[_0x0a63('0x23')](_0x567017,_0x5e5987[_0x2e2526]);}for(var _0x498371 in _0x567017){if(_0x567017[_0x0a63('0x24')](_0x498371)){_0x567017[_0x498371]=this['omit'](_0x567017[_0x498371],_0x5e5987);}}return _0x567017;};exports[_0x0a63('0x25')]=function(_0xcf409){return _0xcf409[_0x0a63('0x26')](RegExp(_0x0a63('0x27')))?!![]:![];};exports[_0x0a63('0x28')]=function(_0x4577b6){return _0x4577b6[_0x0a63('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x0a63('0x29')]=function(_0x5f0145){var _0x58cc71=[];_0x5f0145['split'](/[ ,]+/)[_0x0a63('0x2a')](function(_0xc8caf6){_0xc8caf6=_0xc8caf6[_0x0a63('0x2b')](/([^:]")"+/g,'$1');_0xc8caf6='+'+_0xc8caf6+'*';var _0x26de7a=/[ `!@#$%^&*()_\-?~]/;if(_0xc8caf6[_0x0a63('0x26')](_0x26de7a))_0xc8caf6='\x22'+_0xc8caf6+'\x22';_0x58cc71['push'](_0xc8caf6);});return _0x58cc71[_0x0a63('0x2c')]('\x20');};exports[_0x0a63('0x2d')]=function(_0x33a717,_0x46fb40,_0x59d06c){var _0x28f321={},_0x28b3b4={};if(_0x46fb40['query']['$id']){_0x46fb40[_0x0a63('0x2e')]['id']=_0x46fb40['query']['$id'];delete _0x46fb40[_0x0a63('0x2e')][_0x0a63('0x2f')];}_0x28f321['model']=_[_0x0a63('0x18')](_0x33a717,_0x0a63('0x12'));_0x28f321[_0x0a63('0x2e')]=_[_0x0a63('0x3')](_0x46fb40[_0x0a63('0x2e')]);_0x28f321['filters']=_['intersection'](_0x28f321[_0x0a63('0x30')],_0x28f321[_0x0a63('0x2e')]);_0x28b3b4[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x28f321[_0x0a63('0x30')],this[_0x0a63('0x5')](_0x46fb40['query'][_0x0a63('0x5')]));_0x28b3b4[_0x0a63('0x31')]=_0x28b3b4['attributes'][_0x0a63('0x33')]?_0x28b3b4['attributes']:_0x28f321['model'];if(!_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x24')](_0x0a63('0x34'))){_0x28b3b4['limit']=this[_0x0a63('0x15')](_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x15')]);_0x28b3b4[_0x0a63('0x16')]=this[_0x0a63('0x16')](_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x16')]);}_0x28b3b4['order']=this[_0x0a63('0x17')](_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x17')]);_0x28b3b4['where']=this['filters'](_[_0x0a63('0x35')](_0x46fb40['query'],_0x28f321[_0x0a63('0x6')]),_0x33a717);if(_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')]){var _0x5c7b78=_0x33a717;var _0x2af987=_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')];if(typeof _0x2af987===_0x0a63('0x37')){_0x5c7b78=_['filter'](_0x33a717,function(_0x1e3b70){return _[_0x0a63('0x4')](_0x2af987[_0x0a63('0x38')],_0x1e3b70[_0x0a63('0x12')]);});_0x2af987=_0x2af987[_0x0a63('0x39')];}_0x28b3b4[_0x0a63('0x3a')]=_['merge'](_0x28b3b4[_0x0a63('0x3a')],{'$or':_[_0x0a63('0x18')](_0x5c7b78,function(_0x347a0b){if(_0x347a0b[_0x0a63('0x3b')]!==_0x0a63('0x3c')){if(_0x59d06c){return sequelize[_0x0a63('0x3a')](sequelize['fn'](_0x0a63('0x3d'),sequelize[_0x0a63('0x1c')](_0x347a0b[_0x0a63('0x12')])),{'$like':sequelize['fn'](_0x0a63('0x3d'),'%'+_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')]+'%')});}else{var _0xed7787={};_0xed7787[_0x347a0b[_0x0a63('0x12')]]={'$like':'%'+_0x46fb40[_0x0a63('0x2e')][_0x0a63('0x36')]+'%'};return _0xed7787;}}})});}_0x28b3b4=_[_0x0a63('0x3e')]({},_0x28b3b4,_0x46fb40[_0x0a63('0x3f')]);return _0x28b3b4;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0c874de..54322c7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c88=['ejs','renderFile','urlencoded','50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','root','test','appPath','join','client','use','json\x20replacer','split','views','/server/views','html'];(function(_0x463c54,_0x38fa0f){var _0x2af370=function(_0x16147a){while(--_0x16147a){_0x463c54['push'](_0x463c54['shift']());}};_0x2af370(++_0x38fa0f);}(_0x8c88,0x146));var _0x88c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8c88[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x88c8('0x0'));var favicon=require(_0x88c8('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x88c8('0x2'));var cookieParser=require(_0x88c8('0x3'));var errorHandler=require(_0x88c8('0x4'));var path=require('path');var passport=require(_0x88c8('0x5'));var cors=require(_0x88c8('0x6'));var moment=require(_0x88c8('0x7'));var config=require(_0x88c8('0x8'));var db=require(_0x88c8('0x9'))['db'];exports[_0x88c8('0xa')]=function(_0x1f6321){var _0xe13058=_0x1f6321[_0x88c8('0xb')](_0x88c8('0xc'));if(_0xe13058===_0x88c8('0xd')){_0x1f6321[_0x88c8('0xe')]('appPath',path['join'](config[_0x88c8('0xf')],'public'));}if(_0xe13058==='development'||_0xe13058===_0x88c8('0x10')){_0x1f6321[_0x88c8('0xe')](_0x88c8('0x11'),path[_0x88c8('0x12')](config[_0x88c8('0xf')],_0x88c8('0x13')));_0x1f6321[_0x88c8('0x14')](errorHandler());}_0x1f6321[_0x88c8('0xe')](_0x88c8('0x15'),function(_0x258e3a,_0x113802){if(this[_0x258e3a]instanceof Date){_0x113802=this[_0x258e3a]['toISOString']()[_0x88c8('0x16')]('.')[0x0]+'Z';}return _0x113802;});_0x1f6321[_0x88c8('0x14')](express['static'](_0x1f6321[_0x88c8('0xb')](_0x88c8('0x11'))));_0x1f6321[_0x88c8('0xe')](_0x88c8('0x17'),config['root']+_0x88c8('0x18'));_0x1f6321['engine'](_0x88c8('0x19'),require(_0x88c8('0x1a'))[_0x88c8('0x1b')]);_0x1f6321['set']('view\x20engine',_0x88c8('0x19'));_0x1f6321[_0x88c8('0x14')](bodyParser[_0x88c8('0x1c')]({'limit':_0x88c8('0x1d'),'extended':!![]}));_0x1f6321['use'](bodyParser[_0x88c8('0x1e')]({'limit':_0x88c8('0x1d')}));_0x1f6321[_0x88c8('0x14')](cors());_0x1f6321[_0x88c8('0x14')](methodOverride());_0x1f6321[_0x88c8('0x14')](cookieParser());_0x1f6321[_0x88c8('0x14')](passport[_0x88c8('0x1f')]());}; \ No newline at end of file +var _0x773d=['get','env','appPath','root','test','set','join','client','json\x20replacer','split','use','views','/server/views','engine','ejs','html','urlencoded','50mb','json','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb'];(function(_0x5e608c,_0x453591){var _0x44d7fc=function(_0xc9de57){while(--_0xc9de57){_0x5e608c['push'](_0x5e608c['shift']());}};_0x44d7fc(++_0x453591);}(_0x773d,0xf3));var _0xd773=function(_0x2f5711,_0x389860){_0x2f5711=_0x2f5711-0x0;var _0x19b206=_0x773d[_0x2f5711];return _0x19b206;};'use strict';var express=require('express');var favicon=require(_0xd773('0x0'));var bodyParser=require('body-parser');var methodOverride=require(_0xd773('0x1'));var cookieParser=require(_0xd773('0x2'));var errorHandler=require(_0xd773('0x3'));var path=require(_0xd773('0x4'));var passport=require(_0xd773('0x5'));var cors=require(_0xd773('0x6'));var moment=require(_0xd773('0x7'));var config=require('./environment');var db=require(_0xd773('0x8'))['db'];exports['default']=function(_0x4608c3){var _0x3538c5=_0x4608c3[_0xd773('0x9')](_0xd773('0xa'));if(_0x3538c5==='production'){_0x4608c3['set'](_0xd773('0xb'),path['join'](config[_0xd773('0xc')],'public'));}if(_0x3538c5==='development'||_0x3538c5===_0xd773('0xd')){_0x4608c3[_0xd773('0xe')](_0xd773('0xb'),path[_0xd773('0xf')](config['root'],_0xd773('0x10')));_0x4608c3['use'](errorHandler());}_0x4608c3[_0xd773('0xe')](_0xd773('0x11'),function(_0x2e74e8,_0x45ffb9){if(this[_0x2e74e8]instanceof Date){_0x45ffb9=this[_0x2e74e8]['toISOString']()[_0xd773('0x12')]('.')[0x0]+'Z';}return _0x45ffb9;});_0x4608c3[_0xd773('0x13')](express['static'](_0x4608c3[_0xd773('0x9')](_0xd773('0xb'))));_0x4608c3['set'](_0xd773('0x14'),config[_0xd773('0xc')]+_0xd773('0x15'));_0x4608c3[_0xd773('0x16')]('html',require(_0xd773('0x17'))['renderFile']);_0x4608c3[_0xd773('0xe')]('view\x20engine',_0xd773('0x18'));_0x4608c3[_0xd773('0x13')](bodyParser[_0xd773('0x19')]({'limit':_0xd773('0x1a'),'extended':!![]}));_0x4608c3['use'](bodyParser[_0xd773('0x1b')]({'limit':_0xd773('0x1a')}));_0x4608c3[_0xd773('0x13')](cors());_0x4608c3[_0xd773('0x13')](methodOverride());_0x4608c3['use'](cookieParser());_0x4608c3[_0xd773('0x13')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f33157b..358c6ca 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 _0x7983=['networkInterfaces','orderBy','keys','length','filter','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','join','createHash','update','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0x4d22cc,_0x318f2f){var _0x1ec2b8=function(_0x1150df){while(--_0x1150df){_0x4d22cc['push'](_0x4d22cc['shift']());}};_0x1ec2b8(++_0x318f2f);}(_0x7983,0x8b));var _0x3798=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7983[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3798('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x3798('0x1'));var exec=require(_0x3798('0x2'))[_0x3798('0x3')];var config=require(_0x3798('0x4'));function getInterfaces(){var _0x597a9a=[];var _0x15ccd8=os[_0x3798('0x5')]();var _0x390e35=_[_0x3798('0x6')](_[_0x3798('0x7')](_0x15ccd8));for(var _0x4ca5bb=0x0;_0x4ca5bb<_0x390e35[_0x3798('0x8')];_0x4ca5bb++){var _0x1ba3a3=_0x15ccd8[_0x390e35[_0x4ca5bb]][_0x3798('0x9')](function(_0x21eb21){return _0x21eb21['family']===_0x3798('0xa')&&_0x21eb21[_0x3798('0xb')]===![];});_0x597a9a=_0x597a9a['concat'](_0x1ba3a3);}return _0x597a9a;}function getFirstInterface(){var _0x5bc4c9=_[_0x3798('0xc')](getInterfaces());return{'macAddress':_0x5bc4c9&&_0x5bc4c9['mac']?_0x5bc4c9[_0x3798('0xd')]:_0x3798('0xe'),'ipAddress':_0x5bc4c9&&_0x5bc4c9[_0x3798('0xf')]?_0x5bc4c9[_0x3798('0xf')]:_0x3798('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x2ed983=_[_0x3798('0x6')](os['cpus']()[_0x3798('0x11')](function(_0x3ed11a){return _0x3ed11a[_0x3798('0x12')];}))[_0x3798('0x13')](':');return crypto[_0x3798('0x14')]('md5')[_0x3798('0x15')](_0x2ed983)['digest'](_0x3798('0x16'));}exports[_0x3798('0x17')]=function(){var _0x48728f=os[_0x3798('0x18')]();var _0x5144aa=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5144aa['test'](config[_0x3798('0x19')])){return config[_0x3798('0x19')];}else if(_0x48728f===_0x3798('0x1a')){return exec(_0x3798('0x1b'),{'encoding':_0x3798('0x1c')})[_0x3798('0x1d')]('\x0d\x0a','');}else{var _0x43cf92=getFirstInterface();var _0x34ea02=getCPUhash();var _0x244ea1=_0x34ea02+'|'+os[_0x3798('0x1e')]()+'|'+_0x43cf92[_0x3798('0x1f')]+'|'+_0x43cf92[_0x3798('0x20')];var _0x5c25c2=crypto[_0x3798('0x14')](_0x3798('0x21'))[_0x3798('0x15')](_0x244ea1)[_0x3798('0x22')](_0x3798('0x16'));return _0x5c25c2['substring'](0x0,0x8)+'-'+_0x5c25c2[_0x3798('0x23')](0x8,0xc)+'-'+_0x5c25c2[_0x3798('0x23')](0xc,0x10)+'-'+_0x5c25c2['substring'](0x10,0x14)+'-'+_0x5c25c2[_0x3798('0x23')](0x14);}}; \ No newline at end of file +var _0x6e6d=['child_process','../environment','networkInterfaces','keys','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','update','hex','getUuid','platform','licenseToken','win32','utf8','hostname','macAddress','ipAddress','createHash','digest','substring','crypto','bimedia-machine-uuid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e6d,0xc4));var _0xd6e6=function(_0xd4532e,_0x527207){_0xd4532e=_0xd4532e-0x0;var _0x588545=_0x6e6d[_0xd4532e];return _0x588545;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd6e6('0x0'));var machine=require(_0xd6e6('0x1'));var exec=require(_0xd6e6('0x2'))['execSync'];var config=require(_0xd6e6('0x3'));function getInterfaces(){var _0x5849bf=[];var _0x138ea4=os[_0xd6e6('0x4')]();var _0x43ffe3=_['orderBy'](_[_0xd6e6('0x5')](_0x138ea4));for(var _0x2d6cad=0x0;_0x2d6cad<_0x43ffe3['length'];_0x2d6cad++){var _0xe08152=_0x138ea4[_0x43ffe3[_0x2d6cad]][_0xd6e6('0x6')](function(_0x5e117b){return _0x5e117b[_0xd6e6('0x7')]==='IPv4'&&_0x5e117b[_0xd6e6('0x8')]===![];});_0x5849bf=_0x5849bf[_0xd6e6('0x9')](_0xe08152);}return _0x5849bf;}function getFirstInterface(){var _0x314e83=_[_0xd6e6('0xa')](getInterfaces());return{'macAddress':_0x314e83&&_0x314e83[_0xd6e6('0xb')]?_0x314e83[_0xd6e6('0xb')]:_0xd6e6('0xc'),'ipAddress':_0x314e83&&_0x314e83[_0xd6e6('0xd')]?_0x314e83['address']:_0xd6e6('0xe')};}exports[_0xd6e6('0xf')]=getFirstInterface;function getCPUhash(){var _0x37fb22=_['orderBy'](os[_0xd6e6('0x10')]()[_0xd6e6('0x11')](function(_0x4e32d4){return _0x4e32d4[_0xd6e6('0x12')];}))['join'](':');return crypto['createHash'](_0xd6e6('0x13'))[_0xd6e6('0x14')](_0x37fb22)['digest'](_0xd6e6('0x15'));}exports[_0xd6e6('0x16')]=function(){var _0x1a58b3=os[_0xd6e6('0x17')]();var _0x2f678e=/[0-9a-f-]{36}/;if(config[_0xd6e6('0x18')]&&_0x2f678e['test'](config[_0xd6e6('0x18')])){return config[_0xd6e6('0x18')];}else if(_0x1a58b3===_0xd6e6('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xd6e6('0x1a')})['replace']('\x0d\x0a','');}else{var _0x563ade=getFirstInterface();var _0x52a3ce=getCPUhash();var _0x224b6f=_0x52a3ce+'|'+os[_0xd6e6('0x1b')]()+'|'+_0x563ade[_0xd6e6('0x1c')]+'|'+_0x563ade[_0xd6e6('0x1d')];var _0x4934ae=crypto[_0xd6e6('0x1e')](_0xd6e6('0x13'))['update'](_0x224b6f)[_0xd6e6('0x1f')](_0xd6e6('0x15'));return _0x4934ae['substring'](0x0,0x8)+'-'+_0x4934ae[_0xd6e6('0x20')](0x8,0xc)+'-'+_0x4934ae[_0xd6e6('0x20')](0xc,0x10)+'-'+_0x4934ae['substring'](0x10,0x14)+'-'+_0x4934ae['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 83811f9..13ca691 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 _0xb8df=['license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','then','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','active'];(function(_0x15cafa,_0x247a92){var _0x15f157=function(_0xde97ee){while(--_0xde97ee){_0x15cafa['push'](_0x15cafa['shift']());}};_0x15f157(++_0x247a92);}(_0xb8df,0x1a5));var _0xfb8d=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0xb8df[_0x12b683];return _0xfb150b;};'use strict';var util=require('util');var moment=require(_0xfb8d('0x0'));var rp=require(_0xfb8d('0x1'));var BPromise=require(_0xfb8d('0x2'));var pkginfo=require('pkginfo')(module,_0xfb8d('0x3'));var db=require(_0xfb8d('0x4'))['db'];var encryptor=require(_0xfb8d('0x5'));var hardware=require(_0xfb8d('0x6'));var logger=require(_0xfb8d('0x7'))('license');var HOST=_0xfb8d('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x163bfa){return new BPromise(function(_0x51dc5b,_0x5a5c5a){var _0x1a50ac=util[_0xfb8d('0x9')](_0xfb8d('0xa'),HOST,_0x163bfa,module[_0xfb8d('0xb')][_0xfb8d('0x3')]);if(oldToken){_0x1a50ac=util[_0xfb8d('0x9')](_0xfb8d('0xc'),HOST,_0x163bfa,module[_0xfb8d('0xb')][_0xfb8d('0x3')],oldToken);}var _0x336998={'uri':_0x1a50ac,'method':_0xfb8d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x336998)['then'](function(_0x900ce7){_0x51dc5b(_0x900ce7);})[_0xfb8d('0xe')](function(_0x50ac72){_0x5a5c5a(_0x50ac72);});});}function manageLicense(_0x475004,_0x474293){var _0x16938e=_0x474293[_0xfb8d('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x16938e[_0xfb8d('0x10')]!==_0x475004&&!_0x16938e[_0xfb8d('0x11')]){oldToken=_0x16938e[_0xfb8d('0x10')];}httpRequest(_0x475004)['then'](function(_0x19ce32){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x19ce32[_0xfb8d('0x12')]){isOldTokenSent=![];if(!_0x16938e[_0xfb8d('0x13')]&&_0x16938e[_0xfb8d('0x13')]!=_0x19ce32[_0xfb8d('0x13')]||_0x16938e[_0xfb8d('0x13')]&&_0x16938e[_0xfb8d('0x11')]){logger['info'](_0xfb8d('0x14'));}if(_0x16938e[_0xfb8d('0x13')]&&!_0x16938e[_0xfb8d('0x11')]&&_0x16938e[_0xfb8d('0x13')]!=_0x19ce32['license']){logger[_0xfb8d('0x15')](_0xfb8d('0x16'));}if(_0x16938e[_0xfb8d('0x13')]&&!_0x16938e[_0xfb8d('0x11')]&&_0x16938e[_0xfb8d('0x13')]==_0x19ce32['license']){return _0x474293;}return _0x474293[_0xfb8d('0x17')]({'data1':_0x475004,'data2':null,'license':_0x19ce32[_0xfb8d('0x13')]});}else{if(_0x19ce32['license']||_0x16938e[_0xfb8d('0x13')]){if(!_0x16938e[_0xfb8d('0x11')]){if(_0x16938e[_0xfb8d('0x10')]==_0x475004){GRAY_PERIOD_REASON=_0xfb8d('0x18');logger[_0xfb8d('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xfb8d('0x19');logger['info'](_0xfb8d('0x1a'),_0x16938e['data1'],_0x475004);}logger[_0xfb8d('0x15')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xfb8d('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x474293[_0xfb8d('0x17')]({'data2':encryptor['encryptString'](moment()[_0xfb8d('0x9')](_0xfb8d('0x1b')))});}else{if(moment()['diff'](encryptor[_0xfb8d('0x1c')](_0x16938e['data2']),_0xfb8d('0x1d'))>DAYS){logger[_0xfb8d('0x15')](_0xfb8d('0x1e'),moment()['format'](_0xfb8d('0x1b')));isOldTokenSent=![];return _0x474293[_0xfb8d('0x17')]({'data1':_0x475004,'data2':null,'license':null});}}}else{if(_0x16938e[_0xfb8d('0x10')]!=_0x475004){logger[_0xfb8d('0x15')](_0xfb8d('0x1a'),_0x16938e[_0xfb8d('0x10')],_0x475004);return _0x474293[_0xfb8d('0x17')]({'data1':_0x475004,'data2':null,'license':null});}}}return _0x474293;})[_0xfb8d('0x1f')](function(_0x42f377){_0x474293=_0x42f377;})['catch'](function(_0x5c26c8){logger[_0xfb8d('0x20')](_0x5c26c8[_0xfb8d('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xfb8d('0x22')](),_0x474293);},TIME);});}function defaultLicense(){var _0x391cf4=hardware[_0xfb8d('0x22')]();if(_0x391cf4){return db[_0xfb8d('0x23')][_0xfb8d('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x391cf4}})[_0xfb8d('0x25')](function(_0x14f306,_0x4783aa){logger['info'](_0xfb8d('0x26'),_0x391cf4);manageLicense(_0x391cf4,_0x14f306);})[_0xfb8d('0xe')](function(_0x59f7ed){logger[_0xfb8d('0x20')](_0x59f7ed[_0xfb8d('0x21')]);});}}exports[_0xfb8d('0x27')]=defaultLicense; \ No newline at end of file +var _0xa803=['catch','get','data1','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','spread','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','then'];(function(_0x17b11b,_0x2889b8){var _0x413a68=function(_0x36fb85){while(--_0x36fb85){_0x17b11b['push'](_0x17b11b['shift']());}};_0x413a68(++_0x2889b8);}(_0xa803,0x140));var _0x3a80=function(_0x4e281d,_0xd6e1f4){_0x4e281d=_0x4e281d-0x0;var _0x544a27=_0xa803[_0x4e281d];return _0x544a27;};'use strict';var util=require(_0x3a80('0x0'));var moment=require(_0x3a80('0x1'));var rp=require(_0x3a80('0x2'));var BPromise=require(_0x3a80('0x3'));var pkginfo=require(_0x3a80('0x4'))(module,_0x3a80('0x5'));var db=require(_0x3a80('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x3a80('0x7'));var logger=require(_0x3a80('0x8'))('license');var HOST=_0x3a80('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x114463){return new BPromise(function(_0x549b46,_0x4e8226){var _0x3d4f2e=util['format'](_0x3a80('0xa'),HOST,_0x114463,module[_0x3a80('0xb')][_0x3a80('0x5')]);if(oldToken){_0x3d4f2e=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x114463,module['exports'][_0x3a80('0x5')],oldToken);}var _0x2260e3={'uri':_0x3d4f2e,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x2260e3)[_0x3a80('0xc')](function(_0x579685){_0x549b46(_0x579685);})[_0x3a80('0xd')](function(_0x41b8a6){_0x4e8226(_0x41b8a6);});});}function manageLicense(_0x3af406,_0x5cffa7){var _0x262a90=_0x5cffa7[_0x3a80('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x262a90[_0x3a80('0xf')]!==_0x3af406&&!_0x262a90[_0x3a80('0x10')]){oldToken=_0x262a90[_0x3a80('0xf')];}httpRequest(_0x3af406)['then'](function(_0x4df4ce){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4df4ce[_0x3a80('0x11')]){isOldTokenSent=![];if(!_0x262a90[_0x3a80('0x12')]&&_0x262a90[_0x3a80('0x12')]!=_0x4df4ce[_0x3a80('0x12')]||_0x262a90[_0x3a80('0x12')]&&_0x262a90[_0x3a80('0x10')]){logger['info'](_0x3a80('0x13'));}if(_0x262a90[_0x3a80('0x12')]&&!_0x262a90[_0x3a80('0x10')]&&_0x262a90[_0x3a80('0x12')]!=_0x4df4ce[_0x3a80('0x12')]){logger[_0x3a80('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x262a90[_0x3a80('0x12')]&&!_0x262a90['data2']&&_0x262a90[_0x3a80('0x12')]==_0x4df4ce[_0x3a80('0x12')]){return _0x5cffa7;}return _0x5cffa7[_0x3a80('0x15')]({'data1':_0x3af406,'data2':null,'license':_0x4df4ce[_0x3a80('0x12')]});}else{if(_0x4df4ce['license']||_0x262a90['license']){if(!_0x262a90[_0x3a80('0x10')]){if(_0x262a90[_0x3a80('0xf')]==_0x3af406){GRAY_PERIOD_REASON=_0x3a80('0x16');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x3a80('0x17');logger[_0x3a80('0x14')](_0x3a80('0x18'),_0x262a90[_0x3a80('0xf')],_0x3af406);}logger['info'](_0x3a80('0x19'),GRAY_PERIOD_REASON[_0x3a80('0x1a')](),moment()[_0x3a80('0x1b')](_0x3a80('0x1c')));return _0x5cffa7[_0x3a80('0x15')]({'data2':encryptor[_0x3a80('0x1d')](moment()[_0x3a80('0x1b')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x3a80('0x1e')](encryptor['decryptString'](_0x262a90[_0x3a80('0x10')]),_0x3a80('0x1f'))>DAYS){logger[_0x3a80('0x14')](_0x3a80('0x20'),moment()['format'](_0x3a80('0x1c')));isOldTokenSent=![];return _0x5cffa7['update']({'data1':_0x3af406,'data2':null,'license':null});}}}else{if(_0x262a90[_0x3a80('0xf')]!=_0x3af406){logger[_0x3a80('0x14')](_0x3a80('0x18'),_0x262a90[_0x3a80('0xf')],_0x3af406);return _0x5cffa7[_0x3a80('0x15')]({'data1':_0x3af406,'data2':null,'license':null});}}}return _0x5cffa7;})['then'](function(_0x1fb129){_0x5cffa7=_0x1fb129;})['catch'](function(_0x96bc23){logger[_0x3a80('0x21')](_0x96bc23['message']);})[_0x3a80('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5cffa7);},TIME);});}function defaultLicense(){var _0x12cb64=hardware[_0x3a80('0x23')]();if(_0x12cb64){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x12cb64}})[_0x3a80('0x24')](function(_0x230d35,_0x4810c5){logger[_0x3a80('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x12cb64);manageLicense(_0x12cb64,_0x230d35);})[_0x3a80('0xd')](function(_0x32fdb4){logger[_0x3a80('0x21')](_0x32fdb4['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 968f99b..1d16be4 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 _0x4148=['telephones','forEach','admin','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','disabled','message','findAll','role','sequelize','COUNT','col','user','users'];(function(_0x142871,_0x26aa4e){var _0x3b6c57=function(_0x19b1ba){while(--_0x19b1ba){_0x142871['push'](_0x142871['shift']());}};_0x3b6c57(++_0x26aa4e);}(_0x4148,0x104));var _0x8414=function(_0x45afc4,_0xeaa0e3){_0x45afc4=_0x45afc4-0x0;var _0x43e32b=_0x4148[_0x45afc4];return _0x43e32b;};'use strict';var util=require('util');var _=require(_0x8414('0x0'));var moment=require(_0x8414('0x1'));var BPromise=require(_0x8414('0x2'));var hardware=require(_0x8414('0x3'));var encryptor=require(_0x8414('0x4'));var db=require(_0x8414('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x8414('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8414('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8414('0x8'),'machineUuid':hardware[_0x8414('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x24a41e){return new BPromise(function(_0x72c2e8,_0x4be39b){return db[_0x8414('0x9')][_0x8414('0xa')](_['defaults'](_0x24a41e,{'raw':!![],'where':{'id':0x1}}))[_0x8414('0xb')](function(_0x36b308){return checkLicense(_0x36b308,null);})[_0x8414('0xb')](function(_0x37613c){_0x72c2e8(_0x37613c);return;})[_0x8414('0xc')](function(_0x54d3ec){_0x4be39b(_0x54d3ec);});});}function checkLicense(_0x24bfa3,_0x10912c){if(!_0x24bfa3){demoLicense['uuid']=_0x24bfa3[_0x8414('0xd')];return demoLicense;}try{var _0x298fb4=_0x10912c||_0x24bfa3[_0x8414('0xe')];if(_[_0x8414('0xf')](_0x298fb4)){throw new Error(_0x8414('0x10'));}var _0x3564df=_0x24bfa3[_0x8414('0xd')];var _0x7898a9=_0x24bfa3[_0x8414('0x11')];var _0x517119=_0x3564df[_0x8414('0x12')]('-')[0x4];var _0x57f4ca=_0x3564df[_0x8414('0x12')]('-')[0x0];var _0x1e5810=encryptor[_0x8414('0x13')](_0x298fb4,util[_0x8414('0x14')](_0x8414('0x15'),_0x517119,_0x3564df,_0x57f4ca));var _0x37c3ff=JSON[_0x8414('0x16')](_0x1e5810);_0x37c3ff[_0x8414('0x17')]=![];_0x37c3ff[_0x8414('0x18')]=_0x3564df;_0x37c3ff[_0x8414('0x19')]=hardware[_0x8414('0x6')]();if(_0x7898a9){var _0x3654f4=encryptor[_0x8414('0x13')](_0x7898a9);_0x37c3ff[_0x8414('0x1a')]=_0x3654f4;_0x37c3ff[_0x8414('0x1b')]=moment(_0x3654f4)[_0x8414('0x1c')](0x7,_0x8414('0x1d'))[_0x8414('0x14')]();_0x37c3ff[_0x8414('0x1e')]=_0x37c3ff[_0x8414('0x18')]!=_0x37c3ff[_0x8414('0x19')]?'changed':_0x8414('0x1f');}return _0x37c3ff;}catch(_0x17396c){breakingLicense[_0x8414('0x18')]=_0x24bfa3[_0x8414('0xd')];breakingLicense[_0x8414('0x20')]=_0x17396c[_0x8414('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x124e6e,_0x4c4e53){getLicense()[_0x8414('0xb')](function(_0x111181){return db['User'][_0x8414('0x21')]({'attributes':[_0x8414('0x22'),[db[_0x8414('0x23')]['fn'](_0x8414('0x24'),db[_0x8414('0x23')][_0x8414('0x25')](_0x8414('0x22'))),'count']],'group':_0x8414('0x22'),'where':{'role':{'$or':['admin',_0x8414('0x26'),'telephone']}},'raw':!![]})['then'](function(_0x1b8d30){var _0x117688={'user':_0x111181[_0x8414('0x27')]||0x0,'telephone':_0x111181[_0x8414('0x28')]||0x0};_0x1b8d30[_0x8414('0x29')](function(_0x1d22de){var _0x8c6454=_0x1d22de['role']===_0x8414('0x2a')?_0x8414('0x26'):_0x1d22de['role'];_0x117688[_0x8c6454]-=_0x1d22de[_0x8414('0x2b')];if(_0x117688[_0x8c6454]<0x0)_0x117688[_0x8c6454]=0x0;});_0x124e6e(_0x117688);return;});})[_0x8414('0xc')](function(_0x3065dc){_0x4c4e53(_0x3065dc);});});}function checkUserLimits(_0x5e846e){return new BPromise(function(_0x4a7555,_0x4fe4c6){getLimits()['then'](function(_0x26c695){var _0x58f822=_[_0x8414('0x2c')](_[_0x8414('0x2d')](_0x5e846e,_0x8414('0x22')),[_0x8414('0x2a'),_0x8414('0x26'),_0x8414('0x2e')]);var _0x2fecaa=(_0x58f822[_0x8414('0x2a')]||0x0)+(_0x58f822[_0x8414('0x26')]||0x0);var _0x5746af=_0x58f822[_0x8414('0x2e')]||0x0;if(_0x2fecaa>_0x26c695[_0x8414('0x26')])return _0x4fe4c6(_0x8414('0x2f'));if(_0x5746af>_0x26c695['telephone'])return _0x4fe4c6(_0x8414('0x30'));return _0x4a7555();})['catch'](function(_0x3ff92a){_0x4fe4c6(_0x3ff92a);});});}module[_0x8414('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x535f=['days','grayReason','disabled','message','User','findAll','COUNT','col','role','count','admin','user','telephone','telephones','catch','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','moment','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline'];(function(_0x291cf9,_0x2f6de9){var _0x203118=function(_0x1d073d){while(--_0x1d073d){_0x291cf9['push'](_0x291cf9['shift']());}};_0x203118(++_0x2f6de9);}(_0x535f,0xbe));var _0xf535=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x535f[_0x11ce46];return _0x368a1e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf535('0x0'));var BPromise=require('bluebird');var hardware=require(_0xf535('0x1'));var encryptor=require('../../components/encryptor');var db=require(_0xf535('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf535('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf535('0x4'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf535('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf535('0x5'),'machineUuid':hardware[_0xf535('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x191bd3){return new BPromise(function(_0x5dbf1e,_0x45bed7){return db['License'][_0xf535('0x7')](_[_0xf535('0x8')](_0x191bd3,{'raw':!![],'where':{'id':0x1}}))[_0xf535('0x9')](function(_0x45ace6){return checkLicense(_0x45ace6,null);})[_0xf535('0x9')](function(_0x109641){_0x5dbf1e(_0x109641);return;})['catch'](function(_0x89ca0a){_0x45bed7(_0x89ca0a);});});}function checkLicense(_0x292f39,_0x215e9b){if(!_0x292f39){demoLicense[_0xf535('0xa')]=_0x292f39[_0xf535('0xb')];return demoLicense;}try{var _0x29e1b1=_0x215e9b||_0x292f39[_0xf535('0xc')];if(_[_0xf535('0xd')](_0x29e1b1)){throw new Error(_0xf535('0xe'));}var _0x815c55=_0x292f39[_0xf535('0xb')];var _0x298366=_0x292f39[_0xf535('0xf')];var _0x490d75=_0x815c55[_0xf535('0x10')]('-')[0x4];var _0xb61c66=_0x815c55[_0xf535('0x10')]('-')[0x0];var _0x1be218=encryptor[_0xf535('0x11')](_0x29e1b1,util[_0xf535('0x12')](_0xf535('0x13'),_0x490d75,_0x815c55,_0xb61c66));var _0x1df7b0=JSON[_0xf535('0x14')](_0x1be218);_0x1df7b0[_0xf535('0x15')]=![];_0x1df7b0[_0xf535('0xa')]=_0x815c55;_0x1df7b0[_0xf535('0x16')]=hardware[_0xf535('0x6')]();if(_0x298366){var _0x222b85=encryptor[_0xf535('0x11')](_0x298366);_0x1df7b0[_0xf535('0x17')]=_0x222b85;_0x1df7b0[_0xf535('0x18')]=moment(_0x222b85)['add'](0x7,_0xf535('0x19'))[_0xf535('0x12')]();_0x1df7b0[_0xf535('0x1a')]=_0x1df7b0[_0xf535('0xa')]!=_0x1df7b0['machineUuid']?'changed':_0xf535('0x1b');}return _0x1df7b0;}catch(_0x46e118){breakingLicense[_0xf535('0xa')]=_0x292f39[_0xf535('0xb')];breakingLicense[_0xf535('0x1c')]=_0x46e118['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x571bb7,_0x249791){getLicense()[_0xf535('0x9')](function(_0xf4c0bd){return db[_0xf535('0x1d')][_0xf535('0x1e')]({'attributes':['role',[db['sequelize']['fn'](_0xf535('0x1f'),db['sequelize'][_0xf535('0x20')](_0xf535('0x21'))),_0xf535('0x22')]],'group':'role','where':{'role':{'$or':[_0xf535('0x23'),_0xf535('0x24'),_0xf535('0x25')]}},'raw':!![]})['then'](function(_0x38c97e){var _0x158d3e={'user':_0xf4c0bd['users']||0x0,'telephone':_0xf4c0bd[_0xf535('0x26')]||0x0};_0x38c97e['forEach'](function(_0x341c0b){var _0xdb01dd=_0x341c0b[_0xf535('0x21')]===_0xf535('0x23')?_0xf535('0x24'):_0x341c0b[_0xf535('0x21')];_0x158d3e[_0xdb01dd]-=_0x341c0b[_0xf535('0x22')];if(_0x158d3e[_0xdb01dd]<0x0)_0x158d3e[_0xdb01dd]=0x0;});_0x571bb7(_0x158d3e);return;});})[_0xf535('0x27')](function(_0x36711d){_0x249791(_0x36711d);});});}function checkUserLimits(_0xd24abd){return new BPromise(function(_0x57debb,_0x38ef0e){getLimits()['then'](function(_0x4f2554){var _0x23d564=_[_0xf535('0x28')](_[_0xf535('0x29')](_0xd24abd,'role'),['admin','user',_0xf535('0x25')]);var _0x277d3a=(_0x23d564[_0xf535('0x23')]||0x0)+(_0x23d564['user']||0x0);var _0x515893=_0x23d564[_0xf535('0x25')]||0x0;if(_0x277d3a>_0x4f2554[_0xf535('0x24')])return _0x38ef0e('License\x20limit\x20reached\x20for\x20users');if(_0x515893>_0x4f2554[_0xf535('0x25')])return _0x38ef0e(_0xf535('0x2a'));return _0x57debb();})[_0xf535('0x27')](function(_0x57241e){_0x38ef0e(_0x57241e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index b2f78a7..a670f4f 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 _0x77e6=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x480437,_0x24b137){var _0x505f57=function(_0x4367ea){while(--_0x4367ea){_0x480437['push'](_0x480437['shift']());}};_0x505f57(++_0x24b137);}(_0x77e6,0x1a6));var _0x677e=function(_0x997796,_0x48d571){_0x997796=_0x997796-0x0;var _0x51f9c0=_0x77e6[_0x997796];return _0x51f9c0;};'use strict';module[_0x677e('0x0')]={'DOMAIN':_0x677e('0x1'),'SESSION_SECRET':_0x677e('0x2'),'GOOGLE_ID':_0x677e('0x3'),'GOOGLE_SECRET':_0x677e('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0x1e2ff9,_0x208714){var _0xeb1624=function(_0x226ccc){while(--_0x226ccc){_0x1e2ff9['push'](_0x1e2ff9['shift']());}};_0xeb1624(++_0x208714);}(_0x1a85,0x178));var _0x51a8=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x1a85[_0x346737];return _0x1ade2e;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ec0caa9..9b54c0f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb646=['moment','winston','path','INFO','/var','xcally','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel'];(function(_0x480c1b,_0x2c1955){var _0x281759=function(_0x6333e6){while(--_0x6333e6){_0x480c1b['push'](_0x480c1b['shift']());}};_0x281759(++_0x2c1955);}(_0xb646,0x11e));var _0x6b64=function(_0x1adcf6,_0x2faae6){_0x1adcf6=_0x1adcf6-0x0;var _0x42aa68=_0xb646[_0x1adcf6];return _0x42aa68;};'use strict';var moment=require(_0x6b64('0x0'));var winston=require(_0x6b64('0x1'));var util=require('util');var path=require(_0x6b64('0x2'));var debugLevel=_0x6b64('0x3');function filename(_0x515b36,_0x54fce8){return path['join'](_0x6b64('0x4'),'log',_0x6b64('0x5'),util[_0x6b64('0x6')]('%s-%s.log',_0x515b36,_0x54fce8));}function formatter(_0x47f63a,_0x4ae55d){_0x4ae55d[_0x6b64('0x7')]=_0x4ae55d['message'][_0x6b64('0x8')](/@@{/g,'{{{')[_0x6b64('0x8')](/}@@/g,_0x6b64('0x9'))[_0x6b64('0x8')](/@{/g,'{{')[_0x6b64('0x8')](/}@/g,'}}');return util[_0x6b64('0x6')](_0x6b64('0xa'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x4ae55d[_0x6b64('0xb')][_0x6b64('0xc')](),_0x47f63a,_0x4ae55d[_0x6b64('0x7')]);}module['exports']=function(_0x223c89){return new winston[(_0x6b64('0xd'))]({'transports':[new winston[(_0x6b64('0xe'))][(_0x6b64('0xf'))]({'name':util['format'](_0x6b64('0x10'),_0x223c89,_0x6b64('0x11')),'filename':filename(_0x223c89,'error'),'level':_0x6b64('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x440a3b){return formatter(_0x223c89,_0x440a3b);}}),new winston[(_0x6b64('0xe'))]['File']({'name':util[_0x6b64('0x6')](_0x6b64('0x10'),_0x223c89,_0x6b64('0x12')),'filename':filename(_0x223c89,_0x6b64('0x12')),'level':_0x6b64('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b250d){return formatter(_0x223c89,_0x1b250d);}}),new winston[(_0x6b64('0xe'))][(_0x6b64('0x13'))]({'level':process[_0x6b64('0x14')][_0x6b64('0x15')]||debugLevel,'json':![],'formatter':function(_0x223534){return formatter(_0x223c89,_0x223534);}})]});}; \ No newline at end of file +var _0x6b0f=['Logger','transports','File','error','%s-%s','info','Console','env','path','join','/var','log','xcally','message','}}}','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b0f,0x168));var _0xf6b0=function(_0x265f97,_0x2be832){_0x265f97=_0x265f97-0x0;var _0x240e95=_0x6b0f[_0x265f97];return _0x240e95;};'use strict';var moment=require('moment');var winston=require('winston');var util=require('util');var path=require(_0xf6b0('0x0'));var debugLevel='INFO';function filename(_0x314983,_0xcd91f1){return path[_0xf6b0('0x1')](_0xf6b0('0x2'),_0xf6b0('0x3'),_0xf6b0('0x4'),util['format']('%s-%s.log',_0x314983,_0xcd91f1));}function formatter(_0x34b023,_0x314921){_0x314921[_0xf6b0('0x5')]=_0x314921[_0xf6b0('0x5')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0xf6b0('0x6'))[_0xf6b0('0x7')](/@{/g,'{{')[_0xf6b0('0x7')](/}@/g,'}}');return util[_0xf6b0('0x8')](_0xf6b0('0x9'),moment()[_0xf6b0('0x8')](_0xf6b0('0xa')),_0x314921[_0xf6b0('0xb')][_0xf6b0('0xc')](),_0x34b023,_0x314921[_0xf6b0('0x5')]);}module[_0xf6b0('0xd')]=function(_0x40683e){return new winston[(_0xf6b0('0xe'))]({'transports':[new winston[(_0xf6b0('0xf'))][(_0xf6b0('0x10'))]({'name':util[_0xf6b0('0x8')]('%s-%s',_0x40683e,_0xf6b0('0x11')),'filename':filename(_0x40683e,_0xf6b0('0x11')),'level':_0xf6b0('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x305365){return formatter(_0x40683e,_0x305365);}}),new winston[(_0xf6b0('0xf'))][(_0xf6b0('0x10'))]({'name':util[_0xf6b0('0x8')](_0xf6b0('0x12'),_0x40683e,_0xf6b0('0x13')),'filename':filename(_0x40683e,_0xf6b0('0x13')),'level':_0xf6b0('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5905d8){return formatter(_0x40683e,_0x5905d8);}}),new winston['transports'][(_0xf6b0('0x14'))]({'level':process[_0xf6b0('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x2e6dec){return formatter(_0x40683e,_0x2e6dec);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index dc39f3b..225b9d6 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 _0xa744=['xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','../../services/ami/index.js','agi','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x11447a,_0x360188){var _0x10ee27=function(_0x2dedd9){while(--_0x2dedd9){_0x11447a['push'](_0x11447a['shift']());}};_0x10ee27(++_0x360188);}(_0xa744,0x13b));var _0x4a74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa744[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x4a74('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x4a74('0x1')](__dirname,_0x4a74('0x2'))},{'name':'ami','script':path['join'](__dirname,_0x4a74('0x3'))},{'name':_0x4a74('0x4'),'script':path[_0x4a74('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0x4a74('0x5'),'script':path[_0x4a74('0x1')](__dirname,_0x4a74('0x6'))},{'name':_0x4a74('0x7'),'script':path[_0x4a74('0x1')](__dirname,_0x4a74('0x8'))},{'name':_0x4a74('0x9'),'script':path['join'](__dirname,_0x4a74('0xa'))}]};module[_0x4a74('0xb')]=config; \ No newline at end of file +var _0x1802=['exports','join','../../services/express/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js'];(function(_0x2724e5,_0x229d74){var _0x4b6621=function(_0x787046){while(--_0x787046){_0x2724e5['push'](_0x2724e5['shift']());}};_0x4b6621(++_0x229d74);}(_0x1802,0x64));var _0x2180=function(_0x53de30,_0x4e7e85){_0x53de30=_0x53de30-0x0;var _0x29e2b1=_0x1802[_0x53de30];return _0x29e2b1;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x2180('0x0')](__dirname,_0x2180('0x1'))},{'name':'ami','script':path[_0x2180('0x0')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x2180('0x0')](__dirname,_0x2180('0x2'))},{'name':_0x2180('0x3'),'script':path['join'](__dirname,_0x2180('0x4'))},{'name':_0x2180('0x5'),'script':path[_0x2180('0x0')](__dirname,_0x2180('0x6'))},{'name':'xdr','script':path[_0x2180('0x0')](__dirname,_0x2180('0x7'))}]};module[_0x2180('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 66ee0db..32e679f 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 _0x9b3b=['list','describe','delete','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x9b3b,0x17e));var _0xb9b3=function(_0x3130b5,_0x23faf7){_0x3130b5=_0x3130b5-0x0;var _0xa6d8a3=_0x9b3b[_0x3130b5];return _0xa6d8a3;};'use strict';var pm2=require(_0xb9b3('0x0'));var BPromise=require(_0xb9b3('0x1'));var config=require(_0xb9b3('0x2'));function connect(){return new BPromise(function(_0x439a00,_0x42058e){return pm2[_0xb9b3('0x3')](function(_0x4a7215){if(_0x4a7215){return _0x42058e(_0x4a7215);}return _0x439a00(_0xb9b3('0x4'));});});};exports[_0xb9b3('0x5')]=function(_0x5be4dd){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x3239dd,_0x4f4eac){return pm2['start'](_0x5be4dd,function(_0xce2e44,_0x116b73){if(_0xce2e44){return _0x4f4eac(_0xce2e44);}pm2[_0xb9b3('0x7')]();return _0x3239dd(_0x116b73);});});});};exports[_0xb9b3('0x8')]=function(_0x33aeb2){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x4aefc5,_0x5beacd){return pm2['stop'](_0x33aeb2,function(_0x4bca72,_0x2e3930){if(_0x4bca72){return _0x5beacd(_0x4bca72);}pm2[_0xb9b3('0x7')]();return _0x4aefc5(_0x2e3930);});});});};exports['restart']=function(_0x22524f){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x41daaa,_0x141f74){return pm2[_0xb9b3('0x9')](_0x22524f,function(_0x98d344,_0x114f61){if(_0x98d344){return _0x141f74(_0x98d344);}pm2[_0xb9b3('0x7')]();return _0x41daaa(_0x114f61);});});});};exports[_0xb9b3('0xa')]=function(){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x1e6f47,_0x4c8f0b){return pm2[_0xb9b3('0xa')](function(_0x1fd64d,_0x484a68){if(_0x1fd64d){return _0x4c8f0b(_0x1fd64d);}pm2[_0xb9b3('0x7')]();return _0x1e6f47(_0x484a68);});});});};exports[_0xb9b3('0xb')]=function(_0x3cea91){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x3f8338,_0xfa0cc0){return pm2[_0xb9b3('0xb')](_0x3cea91,function(_0x31da38,_0x4debbb){if(_0x31da38){return _0xfa0cc0(_0x31da38);}pm2[_0xb9b3('0x7')]();return _0x3f8338(_0x4debbb);});});});};exports['delete']=function(_0x1456eb){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x3cc975,_0x39b0fb){return pm2[_0xb9b3('0xc')](_0x1456eb,function(_0x460ec9,_0xeddace){if(_0x460ec9){return _0x39b0fb(_0x460ec9);}pm2[_0xb9b3('0x7')]();return _0x3cc975(_0xeddace);});});});};exports['dump']=function(){return connect()[_0xb9b3('0x6')](function(){return new BPromise(function(_0x368f06,_0x2c6146){return pm2['dump'](function(_0x53db6d){if(_0x53db6d){return _0x2c6146(_0x53db6d);}return _0x368f06(_0xb9b3('0xd'));});});});}; \ No newline at end of file +var _0x85b9=['then','start','stop','disconnect','list','describe','delete','saved','bluebird','./config','connected'];(function(_0x1acb0f,_0x53350d){var _0xb6892b=function(_0xbb69b8){while(--_0xbb69b8){_0x1acb0f['push'](_0x1acb0f['shift']());}};_0xb6892b(++_0x53350d);}(_0x85b9,0xb8));var _0x985b=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x85b9[_0x1477ef];return _0x164acd;};'use strict';var pm2=require('pm2');var BPromise=require(_0x985b('0x0'));var config=require(_0x985b('0x1'));function connect(){return new BPromise(function(_0x37faad,_0x476450){return pm2['connect'](function(_0x568133){if(_0x568133){return _0x476450(_0x568133);}return _0x37faad(_0x985b('0x2'));});});};exports['start']=function(_0x48960a){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x1d7d95,_0x28fbcb){return pm2[_0x985b('0x4')](_0x48960a,function(_0x34a465,_0x49d0c5){if(_0x34a465){return _0x28fbcb(_0x34a465);}pm2['disconnect']();return _0x1d7d95(_0x49d0c5);});});});};exports['stop']=function(_0x17e075){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x5c9ab4,_0x33b085){return pm2[_0x985b('0x5')](_0x17e075,function(_0x49f715,_0x2cb03c){if(_0x49f715){return _0x33b085(_0x49f715);}pm2[_0x985b('0x6')]();return _0x5c9ab4(_0x2cb03c);});});});};exports['restart']=function(_0x338630){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x55bd1b,_0x56770b){return pm2['restart'](_0x338630,function(_0x409253,_0x16c26b){if(_0x409253){return _0x56770b(_0x409253);}pm2['disconnect']();return _0x55bd1b(_0x16c26b);});});});};exports[_0x985b('0x7')]=function(){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x52a3f2,_0x189c52){return pm2['list'](function(_0x4fcd0f,_0x4b6261){if(_0x4fcd0f){return _0x189c52(_0x4fcd0f);}pm2[_0x985b('0x6')]();return _0x52a3f2(_0x4b6261);});});});};exports[_0x985b('0x8')]=function(_0x59cb37){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x2d89bc,_0x36491a){return pm2[_0x985b('0x8')](_0x59cb37,function(_0x5244ec,_0x2cd88b){if(_0x5244ec){return _0x36491a(_0x5244ec);}pm2[_0x985b('0x6')]();return _0x2d89bc(_0x2cd88b);});});});};exports[_0x985b('0x9')]=function(_0x4bb2ea){return connect()['then'](function(){return new BPromise(function(_0x43aca9,_0x2df537){return pm2['delete'](_0x4bb2ea,function(_0x393ab0,_0xb91eb4){if(_0x393ab0){return _0x2df537(_0x393ab0);}pm2['disconnect']();return _0x43aca9(_0xb91eb4);});});});};exports['dump']=function(){return connect()[_0x985b('0x3')](function(){return new BPromise(function(_0x50fc46,_0x3f79be){return pm2['dump'](function(_0x325637){if(_0x325637){return _0x3f79be(_0x325637);}return _0x50fc46(_0x985b('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index be5021d..191e03e 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 _0xd5ff=['update','system','timeout','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','error','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','join'];(function(_0x4b1d99,_0x3e6f7c){var _0x44b286=function(_0x2e879a){while(--_0x2e879a){_0x4b1d99['push'](_0x4b1d99['shift']());}};_0x44b286(++_0x3e6f7c);}(_0xd5ff,0x1e8));var _0xfd5f=function(_0x357df5,_0x4fc2bf){_0x357df5=_0x357df5-0x0;var _0x41d8f0=_0xd5ff[_0x357df5];return _0x41d8f0;};'use strict';var _=require(_0xfd5f('0x0'));var moment=require(_0xfd5f('0x1'));var Redis=require(_0xfd5f('0x2'));var util=require(_0xfd5f('0x3'));var config=require(_0xfd5f('0x4'));var db=require(_0xfd5f('0x5'))['db'];var logger=require(_0xfd5f('0x6'))('schedule');config[_0xfd5f('0x7')]=_[_0xfd5f('0x8')](config[_0xfd5f('0x7')],{'host':_0xfd5f('0x9'),'port':0x18eb});var io=require(_0xfd5f('0xa'))(new Redis(config[_0xfd5f('0x7')]));function closeInteractions(){var _0x100777=0x0;var _0x5528dd=[];return db[_0xfd5f('0xb')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x20ad20){_0x100777=_0x20ad20[_0xfd5f('0xc')];if(_0x100777){return db[_0xfd5f('0xd')][_0xfd5f('0xe')]({'raw':!![],'attributes':['id',_0xfd5f('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfd5f('0x10')](_0x20ad20[_0xfd5f('0xc')],_0xfd5f('0x11'))}}});}else{return[];}})[_0xfd5f('0x12')](function(_0x585818){if(_0x585818&&_0x585818[_0xfd5f('0x13')]){_0x5528dd=_[_0xfd5f('0x14')](_0x585818||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x5528dd[_0xfd5f('0x15')]());return db[_0xfd5f('0xd')][_0xfd5f('0x16')]({'closeReason':_0xfd5f('0x17'),'disposition':_0xfd5f('0x18'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5528dd}});}})[_0xfd5f('0x12')](function(){if(_0x5528dd&&_0x5528dd[_0xfd5f('0x13')]){logger[_0xfd5f('0x19')](_0xfd5f('0x1a'),_0x5528dd['join']());for(var _0x2fd4b1=0x0;_0x2fd4b1<_0x5528dd[_0xfd5f('0x13')];_0x2fd4b1++){io[_0xfd5f('0x1b')]('chatInteraction:update',{'id':_0x5528dd[_0x2fd4b1],'closed':!![]});}}})['catch'](function(_0x16ba8f){logger[_0xfd5f('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x16ba8f?util[_0xfd5f('0x1d')](_0x16ba8f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8a06=['subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x3a488e,_0x39b229){var _0x5de53d=function(_0x56a9a9){while(--_0x56a9a9){_0x3a488e['push'](_0x3a488e['shift']());}};_0x5de53d(++_0x39b229);}(_0x8a06,0xc7));var _0x68a0=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x8a06[_0xc8a11];return _0x55a500;};'use strict';var _=require(_0x68a0('0x0'));var moment=require(_0x68a0('0x1'));var Redis=require(_0x68a0('0x2'));var util=require(_0x68a0('0x3'));var config=require(_0x68a0('0x4'));var db=require(_0x68a0('0x5'))['db'];var logger=require(_0x68a0('0x6'))(_0x68a0('0x7'));config[_0x68a0('0x8')]=_['defaults'](config[_0x68a0('0x8')],{'host':_0x68a0('0x9'),'port':0x18eb});var io=require(_0x68a0('0xa'))(new Redis(config[_0x68a0('0x8')]));function closeInteractions(){var _0x4916fc=0x0;var _0x297c1e=[];return db[_0x68a0('0xb')][_0x68a0('0xc')]({'raw':!![],'attributes':['id',_0x68a0('0xd')],'where':{'id':0x1}})[_0x68a0('0xe')](function(_0x3eec7a){_0x4916fc=_0x3eec7a[_0x68a0('0xd')];if(_0x4916fc){return db[_0x68a0('0xf')][_0x68a0('0x10')]({'raw':!![],'attributes':['id',_0x68a0('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x68a0('0x12')](_0x3eec7a[_0x68a0('0xd')],_0x68a0('0x13'))}}});}else{return[];}})[_0x68a0('0xe')](function(_0x1e155){if(_0x1e155&&_0x1e155[_0x68a0('0x14')]){_0x297c1e=_[_0x68a0('0x15')](_0x1e155||[],'id');logger[_0x68a0('0x16')](_0x68a0('0x17'),_0x297c1e[_0x68a0('0x18')]());return db[_0x68a0('0xf')]['update']({'closeReason':_0x68a0('0x19'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x297c1e}});}})[_0x68a0('0xe')](function(){if(_0x297c1e&&_0x297c1e[_0x68a0('0x14')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x297c1e['join']());for(var _0x58622b=0x0;_0x58622b<_0x297c1e[_0x68a0('0x14')];_0x58622b++){io[_0x68a0('0x1a')](_0x68a0('0x1b'),{'id':_0x297c1e[_0x58622b],'closed':!![]});}}})[_0x68a0('0x1c')](function(_0x3ca56c){logger[_0x68a0('0x1d')](_0x68a0('0x1e'),_0x3ca56c?util['inspect'](_0x3ca56c,{'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 f91f7a3..ffbb069 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 _0xe191=['startAllRefreshIntervals','exports'];(function(_0x2f4f25,_0x592d31){var _0x6a112a=function(_0x112d68){while(--_0x112d68){_0x2f4f25['push'](_0x2f4f25['shift']());}};_0x6a112a(++_0x592d31);}(_0xe191,0x172));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';function start(){var _0x380736=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x380736[_0x1e19('0x0')]();}module[_0x1e19('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x5ce0=['exports','startAllRefreshIntervals'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5ce0,0x121));var _0x05ce=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x5ce0[_0x2af053];return _0x4b4001;};'use strict';function start(){var _0x9d3a88=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x9d3a88[_0x05ce('0x0')]();}module[_0x05ce('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 7f4d17b..8536a90 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 _0xa106=['difference','length','exists','deleteJob','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop','update','update\x20cron','stop\x20cron','util','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','auth','pass','format','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','then','error','error\x20mail','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','map','toString','keyBy'];(function(_0x2ca032,_0x68a6b7){var _0x15cb81=function(_0x38339a){while(--_0x38339a){_0x2ca032['push'](_0x2ca032['shift']());}};_0x15cb81(++_0x68a6b7);}(_0xa106,0xb8));var _0x6a10=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0xa106[_0x12c3d1];return _0x282840;};'use strict';var fs=require('fs');var util=require(_0x6a10('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x6a10('0x1'));var CronJobManager=require(_0x6a10('0x2'));var jayson=require(_0x6a10('0x3'));var BPromise=require('bluebird');var logger=require(_0x6a10('0x4'))(_0x6a10('0x5'));var db=require(_0x6a10('0x6'))['db'];var analyticCustomReportController=require(_0x6a10('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x6a10('0x8')][_0x6a10('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3b99a2,_0x47ded4){return function(){logger['info'](_0x6a10('0xa'),_0x3b99a2[_0x6a10('0xb')]);var _0x271669=!![];var _0x51a7af={'tls':{'rejectUnauthorized':![]}};if(_0x3b99a2['MailAccount'][_0x6a10('0xc')][_0x6a10('0xd')]){_0x51a7af[_0x6a10('0xd')]=_0x3b99a2[_0x6a10('0xe')][_0x6a10('0xc')][_0x6a10('0xd')];}else{_0x51a7af[_0x6a10('0xf')]=_0x3b99a2[_0x6a10('0xe')]['Smtp'][_0x6a10('0xf')];_0x51a7af[_0x6a10('0x10')]=_0x3b99a2[_0x6a10('0xe')][_0x6a10('0xc')]['port'];_0x51a7af['secure']=_0x3b99a2[_0x6a10('0xe')][_0x6a10('0xc')][_0x6a10('0x11')];}if(_0x3b99a2[_0x6a10('0xe')][_0x6a10('0xc')]['authentication']){_0x51a7af[_0x6a10('0x12')]={'user':_0x3b99a2[_0x6a10('0xe')][_0x6a10('0xc')]['user'],'pass':_0x3b99a2[_0x6a10('0xe')][_0x6a10('0xc')][_0x6a10('0x13')]};}var _0x156711={'account':_0x51a7af,'message':{'from':util[_0x6a10('0x14')]('\x22%s\x22\x20<%s>',_0x3b99a2[_0x6a10('0xe')][_0x6a10('0x15')],_0x3b99a2[_0x6a10('0xe')]['email']||_0x3b99a2['MailAccount'][_0x6a10('0xc')][_0x6a10('0x16')]),'to':_0x3b99a2['email'],'cc':_0x3b99a2['cc'],'bcc':_0x3b99a2[_0x6a10('0x17')],'subject':util[_0x6a10('0x14')](_0x6a10('0x18'),_0x47ded4[_0x6a10('0x15')],_0x3b99a2['subtractNumber'],_0x3b99a2[_0x6a10('0x19')])}};var _0x25c296=path['join'](__dirname,_0x6a10('0x1a'));var _0x3d92cb=_0x47ded4[_0x6a10('0x1b')];var _0x2346b1=util[_0x6a10('0x14')](_0x6a10('0x1c'),path[_0x6a10('0x1d')](_0x47ded4['savename'],path[_0x6a10('0x1e')](_0x47ded4['savename'])),_0x6a10('0x1f'));var _0x564bb8=path[_0x6a10('0x20')](_0x25c296,_0x3d92cb);var _0x3865c2=path[_0x6a10('0x20')](_0x25c296,_0x2346b1);if(fs[_0x6a10('0x21')](_0x564bb8)){_0x47ded4[_0x6a10('0x22')]=_0x6a10('0x23');_0x156711[_0x6a10('0x24')]['attachments']=[{'filename':_0x3d92cb,'path':_0x564bb8}];_0x156711[_0x6a10('0x24')]['text']=util[_0x6a10('0x14')](_0x6a10('0x25'),JSON[_0x6a10('0x26')](_0x47ded4,null,0x2));}else if(fs[_0x6a10('0x21')](_0x3865c2)){_0x47ded4[_0x6a10('0x22')]='Sent';_0x156711[_0x6a10('0x24')][_0x6a10('0x27')]=[{'filename':_0x2346b1,'path':_0x3865c2}];}else{_0x156711[_0x6a10('0x24')][_0x6a10('0x28')]=_0x6a10('0x29');if(!_0x3b99a2['sendIfEmpty']){_0x271669=![];logger[_0x6a10('0x2a')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x271669){return client['request']('SendMail',_0x156711)[_0x6a10('0x2b')](function(_0x13a81c){if(_0x13a81c[_0x6a10('0x2c')]){return logger[_0x6a10('0x2c')](_0x6a10('0x2d'),JSON[_0x6a10('0x26')](_0x13a81c));}return logger[_0x6a10('0x2a')]('email\x20sent');})[_0x6a10('0x2e')](function(_0x3ce1c9){return logger[_0x6a10('0x2c')](_0x6a10('0x2d'),JSON['stringify'](_0x3ce1c9));});}};}function handleError(){return function(_0x133309){return logger[_0x6a10('0x2c')](JSON['stringify'](_0x133309));};}function handleResult(_0x3ed4a8){return function(_0x1c85cc){logger[_0x6a10('0x2a')](_0x6a10('0x2f'),JSON['stringify'](_0x1c85cc));if(_0x3ed4a8[_0x6a10('0xe')]&&_0x3ed4a8[_0x6a10('0xe')][_0x6a10('0xc')]&&!_[_0x6a10('0x30')](_0x3ed4a8[_0x6a10('0xb')])){setTimeout(handleSendEmail(_0x3ed4a8,_0x1c85cc),0x3c*0x3e8);}};}function handleJob(_0x1212d4){return function(){try{if(_[_0x6a10('0x30')](_0x1212d4[_0x6a10('0x31')])){return logger[_0x6a10('0x2a')](_0x6a10('0x32'));}if(_[_0x6a10('0x30')](_0x1212d4[_0x6a10('0x19')])){return logger[_0x6a10('0x2a')](_0x6a10('0x33'));}var _0x12ef42={'startDate':moment()[_0x6a10('0x34')](_0x1212d4[_0x6a10('0x31')],_0x1212d4[_0x6a10('0x19')])['format'](_0x6a10('0x35')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x6a10('0x36'),'output':_0x1212d4[_0x6a10('0x37')],'name':_0x1212d4[_0x6a10('0x15')]};if(!_[_0x6a10('0x30')](_0x1212d4[_0x6a10('0x38')])){logger['info'](_0x6a10('0x39'),_0x1212d4['DefaultReportId']);return analyticDefaultReportController[_0x6a10('0x3a')]({'id':_0x1212d4['DefaultReportId']},_0x12ef42)[_0x6a10('0x2b')](handleResult(_0x1212d4))[_0x6a10('0x2e')](handleError());}if(!_[_0x6a10('0x30')](_0x1212d4[_0x6a10('0x3b')])){logger[_0x6a10('0x2a')]('exec\x20custom\x20report\x20id:%s',_0x1212d4[_0x6a10('0x3b')]);return analyticCustomReportController[_0x6a10('0x3a')]({'id':_0x1212d4[_0x6a10('0x3b')]},_0x12ef42)[_0x6a10('0x2b')](handleResult(_0x1212d4))[_0x6a10('0x2e')](handleError());}}catch(_0x533c49){logger['error'](JSON[_0x6a10('0x26')](_0x533c49));}return logger['info'](_0x6a10('0x3c'));};}function getJobs(_0x9ef098){var _0x127aed={};if(_0x9ef098){_0x127aed['id']=_0x9ef098;}return db[_0x6a10('0x3d')][_0x6a10('0x3e')]({'where':_0x127aed,'include':[{'model':db[_0x6a10('0xe')],'attributes':['id',_0x6a10('0x15'),_0x6a10('0xb')],'include':[{'model':db[_0x6a10('0x3f')],'as':_0x6a10('0xc')}]}]})[_0x6a10('0x2b')](function(_0x1dd62d){var _0x39c360=_[_0x6a10('0x40')](manager['jobs']);var _0x24a55f=_[_0x6a10('0x41')](_0x1dd62d,function(_0x3ae595){return _0x3ae595['id'][_0x6a10('0x42')]();});var _0x59fe11=_[_0x6a10('0x43')](_0x1dd62d,function(_0xdf3709){return _0xdf3709['id'][_0x6a10('0x42')]();});var _0x5eeb51=_0x9ef098?_0x24a55f:_[_0x6a10('0x44')](_0x24a55f,_0x39c360);var _0x1d08ad=_['intersection'](_0x24a55f,_0x39c360);var _0xbf3a3e=_[_0x6a10('0x44')](_0x39c360,_0x24a55f);var _0x20e554;var _0x390b40;for(_0x20e554=0x0;_0x20e554<_0xbf3a3e[_0x6a10('0x45')]&&!_0x9ef098;_0x20e554+=0x1){_0x390b40=_0xbf3a3e[_0x20e554][_0x6a10('0x42')]();if(manager[_0x6a10('0x46')](_0x390b40)){manager['stop'](_0x390b40);manager[_0x6a10('0x47')](_0x390b40);logger[_0x6a10('0x2a')]('delete\x20cron',_0x390b40);}}logger[_0x6a10('0x2a')]('toRun',JSON['stringify'](_0x5eeb51));for(_0x20e554=0x0;_0x20e554<_0x5eeb51[_0x6a10('0x45')];_0x20e554+=0x1){_0x390b40=_0x5eeb51[_0x20e554][_0x6a10('0x42')]();logger[_0x6a10('0x2a')]('index',_0x390b40);if(_0x9ef098){logger[_0x6a10('0x2a')]('my\x20id',_0x9ef098);logger[_0x6a10('0x2a')](JSON[_0x6a10('0x26')](_0x59fe11[_0x390b40]));BPromise['resolve']()[_0x6a10('0x2b')](handleJob(_0x59fe11[_0x390b40]));logger[_0x6a10('0x2a')]('run\x20job',_0x59fe11[_0x390b40][_0x6a10('0x15')],_0x59fe11[_0x390b40][_0x6a10('0x48')]);}else if(_0x59fe11[_0x390b40][_0x6a10('0x48')]&&_0x59fe11[_0x390b40][_0x6a10('0x49')]&&moment()[_0x6a10('0x4a')](_0x59fe11[_0x390b40][_0x6a10('0x4b')],_0x59fe11[_0x390b40][_0x6a10('0x4c')])){manager[_0x6a10('0x4d')](_0x390b40,_0x59fe11[_0x390b40][_0x6a10('0x48')],handleJob(_0x59fe11[_0x390b40]));manager[_0x6a10('0x4e')](_0x390b40);logger['info'](_0x6a10('0x4f'),_0x59fe11[_0x390b40][_0x6a10('0x15')],_0x59fe11[_0x390b40]['cron']);}else if(manager['exists'](_0x390b40)){manager[_0x6a10('0x50')](_0x390b40);manager[_0x6a10('0x47')](_0x390b40);logger[_0x6a10('0x2a')]('stop\x20cron',_0x59fe11[_0x390b40]['name'],_0x59fe11[_0x390b40]['cron']);}}for(_0x20e554=0x0,_0x390b40;_0x20e554<_0x1d08ad['length']&&!_0x9ef098;_0x20e554+=0x1){_0x390b40=_0x1d08ad[_0x20e554]['toString']();if(manager[_0x6a10('0x46')](_0x390b40)){if(_0x59fe11[_0x390b40]['cron']&&_0x59fe11[_0x390b40]['active']&&moment()[_0x6a10('0x4a')](_0x59fe11[_0x390b40][_0x6a10('0x4b')],_0x59fe11[_0x390b40]['endAt'])){manager[_0x6a10('0x51')](_0x390b40,_0x59fe11[_0x390b40][_0x6a10('0x48')],handleJob(_0x59fe11[_0x390b40]));logger[_0x6a10('0x2a')](_0x6a10('0x52'),_0x59fe11[_0x390b40][_0x6a10('0x15')],_0x59fe11[_0x390b40][_0x6a10('0x48')]);}else{manager[_0x6a10('0x50')](_0x390b40);manager[_0x6a10('0x47')](_0x390b40);logger[_0x6a10('0x2a')](_0x6a10('0x53'),_0x59fe11[_0x390b40]['name'],_0x59fe11[_0x390b40][_0x6a10('0x48')]);}}}})[_0x6a10('0x2e')](function(_0x1a7ae1){logger[_0x6a10('0x2c')](JSON[_0x6a10('0x26')](_0x1a7ae1));});}exports['run']=function(_0x3f689a){return getJobs(_0x3f689a);};exports[_0x6a10('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe12a=['intersection','length','exists','stop','deleteJob','delete\x20cron','my\x20id','resolve','run\x20job','active','startAt','endAt','cron','start','add\x20cron','stop\x20cron','isBetween','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference'];(function(_0x15d5a4,_0x5e27af){var _0x388b48=function(_0x3c39cd){while(--_0x3c39cd){_0x15d5a4['push'](_0x15d5a4['shift']());}};_0x388b48(++_0x5e27af);}(_0xe12a,0x187));var _0xae12=function(_0x20d39a,_0x2ab24b){_0x20d39a=_0x20d39a-0x0;var _0x48bffb=_0xe12a[_0x20d39a];return _0x48bffb;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xae12('0x0'));var _=require(_0xae12('0x1'));var moment=require(_0xae12('0x2'));var CronJobManager=require(_0xae12('0x3'));var jayson=require(_0xae12('0x4'));var BPromise=require(_0xae12('0x5'));var logger=require('../logger')(_0xae12('0x6'));var db=require(_0xae12('0x7'))['db'];var analyticCustomReportController=require(_0xae12('0x8'));var analyticDefaultReportController=require(_0xae12('0x9'));var client=jayson['client'][_0xae12('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x19810e,_0x579690){return function(){logger[_0xae12('0xb')](_0xae12('0xc'),_0x19810e[_0xae12('0xd')]);var _0x226c9a=!![];var _0x5393e8={'tls':{'rejectUnauthorized':![]}};if(_0x19810e[_0xae12('0xe')][_0xae12('0xf')]['service']){_0x5393e8['service']=_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x10')];}else{_0x5393e8['host']=_0x19810e[_0xae12('0xe')]['Smtp'][_0xae12('0x11')];_0x5393e8[_0xae12('0x12')]=_0x19810e[_0xae12('0xe')][_0xae12('0xf')]['port'];_0x5393e8['secure']=_0x19810e[_0xae12('0xe')][_0xae12('0xf')]['secure'];}if(_0x19810e['MailAccount'][_0xae12('0xf')][_0xae12('0x13')]){_0x5393e8[_0xae12('0x14')]={'user':_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x15')],'pass':_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x16')]};}var _0x2ea3d2={'account':_0x5393e8,'message':{'from':util[_0xae12('0x17')](_0xae12('0x18'),_0x19810e[_0xae12('0xe')][_0xae12('0x19')],_0x19810e[_0xae12('0xe')]['email']||_0x19810e[_0xae12('0xe')][_0xae12('0xf')][_0xae12('0x15')]),'to':_0x19810e[_0xae12('0xd')],'cc':_0x19810e['cc'],'bcc':_0x19810e[_0xae12('0x1a')],'subject':util[_0xae12('0x17')](_0xae12('0x1b'),_0x579690['name'],_0x19810e[_0xae12('0x1c')],_0x19810e['subtractUnit'])}};var _0x1f4636=path[_0xae12('0x1d')](__dirname,_0xae12('0x1e'));var _0x4bfb86=_0x579690['savename'];var _0x4c7a39=util[_0xae12('0x17')](_0xae12('0x1f'),path[_0xae12('0x20')](_0x579690[_0xae12('0x21')],path[_0xae12('0x22')](_0x579690[_0xae12('0x21')])),_0xae12('0x23'));var _0x4813e2=path[_0xae12('0x1d')](_0x1f4636,_0x4bfb86);var _0x13c145=path['join'](_0x1f4636,_0x4c7a39);if(fs[_0xae12('0x24')](_0x4813e2)){_0x579690[_0xae12('0x25')]=_0xae12('0x26');_0x2ea3d2[_0xae12('0x27')][_0xae12('0x28')]=[{'filename':_0x4bfb86,'path':_0x4813e2}];_0x2ea3d2[_0xae12('0x27')][_0xae12('0x29')]=util[_0xae12('0x17')](_0xae12('0x2a'),JSON[_0xae12('0x2b')](_0x579690,null,0x2));}else if(fs['existsSync'](_0x13c145)){_0x579690['status']=_0xae12('0x26');_0x2ea3d2['message'][_0xae12('0x28')]=[{'filename':_0x4c7a39,'path':_0x13c145}];}else{_0x2ea3d2[_0xae12('0x27')][_0xae12('0x29')]=_0xae12('0x2c');if(!_0x19810e[_0xae12('0x2d')]){_0x226c9a=![];logger['info'](_0xae12('0x2e'));}}if(_0x226c9a){return client['request'](_0xae12('0x2f'),_0x2ea3d2)['then'](function(_0x14fc29){if(_0x14fc29['error']){return logger['error'](_0xae12('0x30'),JSON['stringify'](_0x14fc29));}return logger['info'](_0xae12('0x31'));})[_0xae12('0x32')](function(_0x42a545){return logger[_0xae12('0x33')](_0xae12('0x30'),JSON[_0xae12('0x2b')](_0x42a545));});}};}function handleError(){return function(_0x13560b){return logger[_0xae12('0x33')](JSON[_0xae12('0x2b')](_0x13560b));};}function handleResult(_0x7199a7){return function(_0x4d04d7){logger['info'](_0xae12('0x34'),JSON[_0xae12('0x2b')](_0x4d04d7));if(_0x7199a7['MailAccount']&&_0x7199a7[_0xae12('0xe')][_0xae12('0xf')]&&!_[_0xae12('0x35')](_0x7199a7[_0xae12('0xd')])){setTimeout(handleSendEmail(_0x7199a7,_0x4d04d7),0x3c*0x3e8);}};}function handleJob(_0x2e63bb){return function(){try{if(_[_0xae12('0x35')](_0x2e63bb[_0xae12('0x1c')])){return logger['info'](_0xae12('0x36'));}if(_[_0xae12('0x35')](_0x2e63bb[_0xae12('0x37')])){return logger[_0xae12('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x5cc9fe={'startDate':moment()[_0xae12('0x38')](_0x2e63bb['subtractNumber'],_0x2e63bb['subtractUnit'])[_0xae12('0x17')](_0xae12('0x39')),'endDate':moment()[_0xae12('0x17')](_0xae12('0x39')),'type':_0xae12('0x3a'),'output':_0x2e63bb['output'],'name':_0x2e63bb['name']};if(!_[_0xae12('0x35')](_0x2e63bb[_0xae12('0x3b')])){logger[_0xae12('0xb')](_0xae12('0x3c'),_0x2e63bb[_0xae12('0x3b')]);return analyticDefaultReportController[_0xae12('0x3d')]({'id':_0x2e63bb[_0xae12('0x3b')]},_0x5cc9fe)[_0xae12('0x3e')](handleResult(_0x2e63bb))[_0xae12('0x32')](handleError());}if(!_[_0xae12('0x35')](_0x2e63bb['CustomReportId'])){logger[_0xae12('0xb')](_0xae12('0x3f'),_0x2e63bb[_0xae12('0x40')]);return analyticCustomReportController['runReport']({'id':_0x2e63bb[_0xae12('0x40')]},_0x5cc9fe)[_0xae12('0x3e')](handleResult(_0x2e63bb))['catch'](handleError());}}catch(_0x3847b4){logger['error'](JSON[_0xae12('0x2b')](_0x3847b4));}return logger[_0xae12('0xb')](_0xae12('0x41'));};}function getJobs(_0x435342){var _0x18bec5={};if(_0x435342){_0x18bec5['id']=_0x435342;}return db[_0xae12('0x42')][_0xae12('0x43')]({'where':_0x18bec5,'include':[{'model':db['MailAccount'],'attributes':['id',_0xae12('0x19'),_0xae12('0xd')],'include':[{'model':db[_0xae12('0x44')],'as':_0xae12('0xf')}]}]})['then'](function(_0x49a72f){var _0xfffe55=_[_0xae12('0x45')](manager[_0xae12('0x46')]);var _0x50c479=_[_0xae12('0x47')](_0x49a72f,function(_0x50eb5c){return _0x50eb5c['id'][_0xae12('0x48')]();});var _0x552976=_['keyBy'](_0x49a72f,function(_0x27bfab){return _0x27bfab['id']['toString']();});var _0x4a6ad3=_0x435342?_0x50c479:_[_0xae12('0x49')](_0x50c479,_0xfffe55);var _0x3e0322=_[_0xae12('0x4a')](_0x50c479,_0xfffe55);var _0x4b0cb4=_[_0xae12('0x49')](_0xfffe55,_0x50c479);var _0x239c08;var _0x248b32;for(_0x239c08=0x0;_0x239c08<_0x4b0cb4[_0xae12('0x4b')]&&!_0x435342;_0x239c08+=0x1){_0x248b32=_0x4b0cb4[_0x239c08][_0xae12('0x48')]();if(manager[_0xae12('0x4c')](_0x248b32)){manager[_0xae12('0x4d')](_0x248b32);manager[_0xae12('0x4e')](_0x248b32);logger[_0xae12('0xb')](_0xae12('0x4f'),_0x248b32);}}logger[_0xae12('0xb')]('toRun',JSON[_0xae12('0x2b')](_0x4a6ad3));for(_0x239c08=0x0;_0x239c08<_0x4a6ad3[_0xae12('0x4b')];_0x239c08+=0x1){_0x248b32=_0x4a6ad3[_0x239c08][_0xae12('0x48')]();logger['info']('index',_0x248b32);if(_0x435342){logger[_0xae12('0xb')](_0xae12('0x50'),_0x435342);logger['info'](JSON[_0xae12('0x2b')](_0x552976[_0x248b32]));BPromise[_0xae12('0x51')]()[_0xae12('0x3e')](handleJob(_0x552976[_0x248b32]));logger[_0xae12('0xb')](_0xae12('0x52'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32]['cron']);}else if(_0x552976[_0x248b32]['cron']&&_0x552976[_0x248b32][_0xae12('0x53')]&&moment()['isBetween'](_0x552976[_0x248b32][_0xae12('0x54')],_0x552976[_0x248b32][_0xae12('0x55')])){manager['add'](_0x248b32,_0x552976[_0x248b32][_0xae12('0x56')],handleJob(_0x552976[_0x248b32]));manager[_0xae12('0x57')](_0x248b32);logger[_0xae12('0xb')](_0xae12('0x58'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32]['cron']);}else if(manager[_0xae12('0x4c')](_0x248b32)){manager[_0xae12('0x4d')](_0x248b32);manager['deleteJob'](_0x248b32);logger['info'](_0xae12('0x59'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32]['cron']);}}for(_0x239c08=0x0,_0x248b32;_0x239c08<_0x3e0322[_0xae12('0x4b')]&&!_0x435342;_0x239c08+=0x1){_0x248b32=_0x3e0322[_0x239c08][_0xae12('0x48')]();if(manager[_0xae12('0x4c')](_0x248b32)){if(_0x552976[_0x248b32][_0xae12('0x56')]&&_0x552976[_0x248b32][_0xae12('0x53')]&&moment()[_0xae12('0x5a')](_0x552976[_0x248b32][_0xae12('0x54')],_0x552976[_0x248b32][_0xae12('0x55')])){manager['update'](_0x248b32,_0x552976[_0x248b32][_0xae12('0x56')],handleJob(_0x552976[_0x248b32]));logger[_0xae12('0xb')](_0xae12('0x5b'),_0x552976[_0x248b32]['name'],_0x552976[_0x248b32][_0xae12('0x56')]);}else{manager[_0xae12('0x4d')](_0x248b32);manager[_0xae12('0x4e')](_0x248b32);logger[_0xae12('0xb')](_0xae12('0x59'),_0x552976[_0x248b32][_0xae12('0x19')],_0x552976[_0x248b32][_0xae12('0x56')]);}}}})['catch'](function(_0x51f8f1){logger[_0xae12('0x33')](JSON['stringify'](_0x51f8f1));});}exports[_0xae12('0x5c')]=function(_0x1a58d8){return getJobs(_0x1a58d8);};exports[_0xae12('0x57')]=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 099a525..2bf6053 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 _0x6f2f=['TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','catch','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','name','SequelizeValidationError','start','lodash','aws-sdk','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0xcd67b8,_0x28f1b1){var _0x52078e=function(_0x36a9d7){while(--_0x36a9d7){_0xcd67b8['push'](_0xcd67b8['shift']());}};_0x52078e(++_0x28f1b1);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x6f2f[_0x2283dc];return _0x16db90;};var _=require(_0xf6f2('0x0'));var AWS=require(_0xf6f2('0x1'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xf6f2('0x2'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0xc69b60,_0x305bb,_0x18de32,_0x5ba2fb){return new Promise(function(_0x5c540a,_0x1123bb){var _0x1c94ad=new AWS[(_0xf6f2('0x3'))]({'accessKeyId':_0x305bb,'secretAccessKey':_0xc69b60,'region':_0x18de32});_0x1c94ad[_0xf6f2('0x4')]({'TranscriptionJobName':_0x5ba2fb},function(_0x15a71c,_0x1873c8){if(_0x15a71c){return _0x1123bb(_0x15a71c);}else{return _0x5c540a(_0x1873c8);}});});}function sentiment(_0x31955f,_0x222673,_0x294a85,_0x17ffd2,_0x55a260){return new Promise(function(_0x109271,_0x266c6e){var _0x2a4325=new AWS[(_0xf6f2('0x5'))]({'accessKeyId':_0x222673,'secretAccessKey':_0x31955f,'region':_0x294a85});_0x2a4325['detectSentiment']({'Text':_0x17ffd2,'LanguageCode':_0x55a260['substring'](0x0,0x2)},function(_0x535252,_0x3f42b5){if(_0x535252){return _0x266c6e(_0x535252);}else{return _0x109271(_0x3f42b5);}});});}function checkTranscribeJob(_0x113991,_0x131a18,_0x4afa2){var _0x1626ce;return new BPromise(function(_0x2ed4b5,_0x52afc8){logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0x8'),_0x113991['id'],_0x113991[_0xf6f2('0x9')]));return getTranscriptionJob(_0x4afa2[_0xf6f2('0xa')],_0x4afa2['data2'],_0x131a18[_0xf6f2('0xb')],_0x113991[_0xf6f2('0x9')])[_0xf6f2('0xc')](function(_0x26c176){logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0xd'),_0x113991['id'],_0x113991[_0xf6f2('0x9')],_0x26c176[_0xf6f2('0xe')][_0xf6f2('0xf')]));if(!_0x113991[_0xf6f2('0x10')]){switch(_0x26c176[_0xf6f2('0xe')][_0xf6f2('0xf')]){case _0xf6f2('0x11'):var _0xb05611={'transcribeStatus':_0x26c176['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x26c176[_0xf6f2('0xe')]['Transcript'][_0xf6f2('0x12')]};logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0x13'),_0x113991['id']));return rp({'uri':_0x26c176['TranscriptionJob'][_0xf6f2('0x14')][_0xf6f2('0x12')],'json':!![]})[_0xf6f2('0xc')](function(_0x3321a0){logger['info'](util[_0xf6f2('0x7')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x113991['id']));if(_0x3321a0&&_0x3321a0[_0xf6f2('0x15')]&&_0x3321a0['results'][_0xf6f2('0x16')]&&_0x3321a0[_0xf6f2('0x15')]['transcripts'][_0xf6f2('0x17')]){_0xb05611[_0xf6f2('0x10')]='';for(var _0x3b0ed5=0x0;_0x3b0ed5<_0x3321a0[_0xf6f2('0x15')][_0xf6f2('0x16')][_0xf6f2('0x17')];_0x3b0ed5++){_0xb05611[_0xf6f2('0x10')]+=_0x3321a0[_0xf6f2('0x15')]['transcripts'][_0x3b0ed5][_0xf6f2('0x18')]+'';}}return _0x113991[_0xf6f2('0x19')](_0xb05611);})[_0xf6f2('0xc')](function(){logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0x1a'),_0x113991['id']));if(!_0x113991[_0xf6f2('0x1b')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x1e'));}if(!_0x131a18[_0xf6f2('0x1f')]||!_0x131a18['sentimentAccountId']||!_0x131a18[_0xf6f2('0x20')]||!_0x131a18[_0xf6f2('0x21')]||!_0x131a18[_0xf6f2('0x22')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x23'));}if(!_0xb05611[_0xf6f2('0x10')]){throw new Error(_0xf6f2('0x24'));}if(_0x131a18[_0xf6f2('0x25')]===_0x4afa2['id']){return _0x4afa2;}else{return db[_0xf6f2('0x26')][_0xf6f2('0x27')]({'where':{'id':_settings[_0xf6f2('0x25')]}});}})['then'](function(_0x13145f){if(!_0x13145f){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x28'));}if(!_0x13145f[_0xf6f2('0xa')]||!_0x13145f[_0xf6f2('0x29')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x2a'));}_0x1626ce=_0x13145f;logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0x2b'),_0x113991['id']));return sentiment(_0x1626ce[_0xf6f2('0xa')],_0x1626ce['data2'],_0x131a18['sentimentRegion'],_0xb05611['fileText'],_0x131a18[_0xf6f2('0x21')]);})[_0xf6f2('0xc')](function(_0x4f5763){logger['info'](util[_0xf6f2('0x7')](_0xf6f2('0x2c'),_0x113991['id']));return _0x113991[_0xf6f2('0x19')]({'sentiment':_0x4f5763[_0xf6f2('0x2d')],'sPositive':_0x4f5763[_0xf6f2('0x2e')][_0xf6f2('0x2f')],'sNegative':_0x4f5763['SentimentScore'][_0xf6f2('0x30')],'sMixed':_0x4f5763['SentimentScore'][_0xf6f2('0x31')],'sNeutral':_0x4f5763[_0xf6f2('0x2e')][_0xf6f2('0x32')]});})[_0xf6f2('0xc')](function(){logger['info'](util[_0xf6f2('0x7')](_0xf6f2('0x1a'),_0x113991['id']));_0x2ed4b5();});case _0xf6f2('0x33'):return _0x113991['update']({'transcribeStatus':_0xf6f2('0x33'),'failureReason':_0x26c176[_0xf6f2('0xe')][_0xf6f2('0x34')]})['then'](function(){logger[_0xf6f2('0x6')](util['format'](_0xf6f2('0x1a'),_0x113991['id']));_0x2ed4b5();});default:logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x113991['id']));break;}}else{return BPromise[_0xf6f2('0x35')]()[_0xf6f2('0xc')](function(){if(!_0x113991[_0xf6f2('0x1b')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x131a18[_0xf6f2('0x1f')]||!_0x131a18[_0xf6f2('0x25')]||!_0x131a18[_0xf6f2('0x20')]||!_0x131a18[_0xf6f2('0x21')]||!_0x131a18[_0xf6f2('0x22')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x113991[_0xf6f2('0x10')]){throw new Error(_0xf6f2('0x24'));}if(_0x131a18[_0xf6f2('0x25')]===_0x4afa2['id']){return _0x4afa2;}else{return db['CloudProvider'][_0xf6f2('0x27')]({'where':{'id':_settings[_0xf6f2('0x25')]}});}})[_0xf6f2('0xc')](function(_0x1005ab){if(!_0x1005ab){throw new db[(_0xf6f2('0x1c'))]['ValidationError'](_0xf6f2('0x28'));}if(!_0x1005ab[_0xf6f2('0xa')]||!_0x1005ab[_0xf6f2('0x29')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x1626ce=_0x1005ab;logger[_0xf6f2('0x6')](util['format'](_0xf6f2('0x2b'),_0x113991['id']));return sentiment(_0x1626ce[_0xf6f2('0xa')],_0x1626ce[_0xf6f2('0x29')],_0x131a18[_0xf6f2('0x20')],_0x113991[_0xf6f2('0x10')],_0x131a18[_0xf6f2('0x21')]);})[_0xf6f2('0xc')](function(_0x24e6f4){logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0x2c'),_0x113991['id']));return _0x113991['update']({'sentiment':_0x24e6f4[_0xf6f2('0x2d')],'sPositive':_0x24e6f4[_0xf6f2('0x2e')][_0xf6f2('0x2f')],'sNegative':_0x24e6f4['SentimentScore']['Negative'],'sMixed':_0x24e6f4['SentimentScore'][_0xf6f2('0x31')],'sNeutral':_0x24e6f4[_0xf6f2('0x2e')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0xf6f2('0xc')](function(){logger[_0xf6f2('0x6')](util[_0xf6f2('0x7')](_0xf6f2('0x1a'),_0x113991['id']));_0x2ed4b5();});}})[_0xf6f2('0x36')](function(_0xd413d3){if(_0xd413d3){if(!_0xd413d3['name']||_0xd413d3['name']!=='SequelizeValidationError'){logger['error'](util[_0xf6f2('0x7')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x113991['id']),util[_0xf6f2('0x37')](_0xd413d3,{'showHidden':![],'depth':null}));}}_0x2ed4b5();});});}function checkTranscribe(){var _0x353d76;var _0x2b9274;var _0x3b7d67;return db[_0xf6f2('0x38')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xf6f2('0xc')](function(_0x5f3863){if(!_0x5f3863||!_0x5f3863['length']){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x39'));}_0x353d76=_0x5f3863;return db[_0xf6f2('0x3a')][_0xf6f2('0x27')]({'where':{'id':0x1}});})[_0xf6f2('0xc')](function(_0x5351f5){if(!_0x5351f5){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))]('Settings\x20not\x20available');}_0x2b9274=_0x5351f5;if(!_0x2b9274[_0xf6f2('0x3b')]||!_0x2b9274[_0xf6f2('0x3c')]||!_0x2b9274[_0xf6f2('0xb')]||!_0x2b9274['language']||!_0x2b9274[_0xf6f2('0x22')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x3d'));}return db[_0xf6f2('0x26')][_0xf6f2('0x27')]({'where':{'id':_0x2b9274[_0xf6f2('0x3c')]}});})[_0xf6f2('0xc')](function(_0x1aec4f){if(!_0x1aec4f){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1aec4f[_0xf6f2('0xa')]||!_0x1aec4f[_0xf6f2('0x29')]){throw new db[(_0xf6f2('0x1c'))][(_0xf6f2('0x1d'))](_0xf6f2('0x2a'));}_0x3b7d67=_0x1aec4f;var _0x39892d=[];_0x353d76[_0xf6f2('0x3e')](function(_0x22e7d1){_0x39892d[_0xf6f2('0x3f')](checkTranscribeJob(_0x22e7d1,_0x2b9274,_0x3b7d67));});return BPromise[_0xf6f2('0x40')](_0x39892d);})['catch'](function(_0x3053de){if(_0x3053de){if(!_0x3053de[_0xf6f2('0x41')]||_0x3053de['name']!==_0xf6f2('0x42')){logger['error'](util['inspect'](_0x3053de,{'showHidden':![],'depth':null}));}}});}exports[_0xf6f2('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc698=['aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Transcript\x20not\x20available','CloudProvider','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20available','forEach','push','all','catch','lodash'];(function(_0x5a26d1,_0x1b1d20){var _0x460dd8=function(_0x3cdb0a){while(--_0x3cdb0a){_0x5a26d1['push'](_0x5a26d1['shift']());}};_0x460dd8(++_0x1b1d20);}(_0xc698,0x85));var _0x8c69=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xc698[_0x152136];return _0x20df44;};var _=require(_0x8c69('0x0'));var AWS=require(_0x8c69('0x1'));var rp=require(_0x8c69('0x2'));var util=require(_0x8c69('0x3'));var BPromise=require(_0x8c69('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8c69('0x5'));function getTranscriptionJob(_0x55386c,_0x1b1dae,_0x4b29d1,_0x35259c){return new Promise(function(_0x5e8069,_0x5c0109){var _0x350620=new AWS[(_0x8c69('0x6'))]({'accessKeyId':_0x1b1dae,'secretAccessKey':_0x55386c,'region':_0x4b29d1});_0x350620[_0x8c69('0x7')]({'TranscriptionJobName':_0x35259c},function(_0x20a688,_0x34a8e8){if(_0x20a688){return _0x5c0109(_0x20a688);}else{return _0x5e8069(_0x34a8e8);}});});}function sentiment(_0x315ce0,_0x2921ee,_0x260354,_0x356fa0,_0x443da4){return new Promise(function(_0xf26d66,_0x4825fc){var _0x21df81=new AWS[(_0x8c69('0x8'))]({'accessKeyId':_0x2921ee,'secretAccessKey':_0x315ce0,'region':_0x260354});_0x21df81[_0x8c69('0x9')]({'Text':_0x356fa0,'LanguageCode':_0x443da4['substring'](0x0,0x2)},function(_0x5e4f68,_0x5e4d32){if(_0x5e4f68){return _0x4825fc(_0x5e4f68);}else{return _0xf26d66(_0x5e4d32);}});});}function checkTranscribeJob(_0xd95d06,_0x5886d3,_0x33e020){var _0x5bbd63;return new BPromise(function(_0x1ebe38,_0x56299e){logger[_0x8c69('0xa')](util[_0x8c69('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xd95d06['id'],_0xd95d06[_0x8c69('0xc')]));return getTranscriptionJob(_0x33e020['data1'],_0x33e020[_0x8c69('0xd')],_0x5886d3[_0x8c69('0xe')],_0xd95d06[_0x8c69('0xc')])[_0x8c69('0xf')](function(_0x557918){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x10'),_0xd95d06['id'],_0xd95d06['transcribeName'],_0x557918[_0x8c69('0x11')][_0x8c69('0x12')]));if(!_0xd95d06[_0x8c69('0x13')]){switch(_0x557918[_0x8c69('0x11')]['TranscriptionJobStatus']){case _0x8c69('0x14'):var _0x3b0355={'transcribeStatus':_0x557918[_0x8c69('0x11')][_0x8c69('0x12')],'fileUri':_0x557918[_0x8c69('0x11')]['Transcript'][_0x8c69('0x15')]};logger['info'](util[_0x8c69('0xb')](_0x8c69('0x16'),_0xd95d06['id']));return rp({'uri':_0x557918[_0x8c69('0x11')][_0x8c69('0x17')][_0x8c69('0x15')],'json':!![]})['then'](function(_0x327ce4){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x18'),_0xd95d06['id']));if(_0x327ce4&&_0x327ce4[_0x8c69('0x19')]&&_0x327ce4[_0x8c69('0x19')]['transcripts']&&_0x327ce4[_0x8c69('0x19')][_0x8c69('0x1a')]['length']){_0x3b0355[_0x8c69('0x13')]='';for(var _0x2ee467=0x0;_0x2ee467<_0x327ce4[_0x8c69('0x19')]['transcripts']['length'];_0x2ee467++){_0x3b0355[_0x8c69('0x13')]+=_0x327ce4['results']['transcripts'][_0x2ee467]['transcript']+'';}}return _0xd95d06[_0x8c69('0x1b')](_0x3b0355);})[_0x8c69('0xf')](function(){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));if(!_0xd95d06[_0x8c69('0x1d')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))](_0x8c69('0x20'));}if(!_0x5886d3[_0x8c69('0x21')]||!_0x5886d3['sentimentAccountId']||!_0x5886d3[_0x8c69('0x22')]||!_0x5886d3[_0x8c69('0x23')]||!_0x5886d3[_0x8c69('0x24')]){throw new db[(_0x8c69('0x1e'))]['ValidationError'](_0x8c69('0x25'));}if(!_0x3b0355[_0x8c69('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5886d3[_0x8c69('0x26')]===_0x33e020['id']){return _0x33e020;}else{return db['CloudProvider'][_0x8c69('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x8c69('0xf')](function(_0x485875){if(!_0x485875){throw new db['Sequelize'][(_0x8c69('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x485875[_0x8c69('0x28')]||!_0x485875[_0x8c69('0xd')]){throw new db['Sequelize'][(_0x8c69('0x1f'))](_0x8c69('0x29'));}_0x5bbd63=_0x485875;logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x2a'),_0xd95d06['id']));return sentiment(_0x5bbd63[_0x8c69('0x28')],_0x5bbd63['data2'],_0x5886d3[_0x8c69('0x22')],_0x3b0355[_0x8c69('0x13')],_0x5886d3[_0x8c69('0x23')]);})[_0x8c69('0xf')](function(_0x4e8e4c){logger[_0x8c69('0xa')](util[_0x8c69('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd95d06['id']));return _0xd95d06['update']({'sentiment':_0x4e8e4c['Sentiment'],'sPositive':_0x4e8e4c['SentimentScore'][_0x8c69('0x2b')],'sNegative':_0x4e8e4c[_0x8c69('0x2c')]['Negative'],'sMixed':_0x4e8e4c['SentimentScore']['Mixed'],'sNeutral':_0x4e8e4c[_0x8c69('0x2c')][_0x8c69('0x2d')]});})['then'](function(){logger['info'](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));_0x1ebe38();});case _0x8c69('0x2e'):return _0xd95d06['update']({'transcribeStatus':_0x8c69('0x2e'),'failureReason':_0x557918[_0x8c69('0x11')][_0x8c69('0x2f')]})[_0x8c69('0xf')](function(){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));_0x1ebe38();});default:logger['info'](util[_0x8c69('0xb')](_0x8c69('0x30'),_0xd95d06['id']));break;}}else{return BPromise['resolve']()[_0x8c69('0xf')](function(){if(!_0xd95d06[_0x8c69('0x1d')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5886d3[_0x8c69('0x21')]||!_0x5886d3[_0x8c69('0x26')]||!_0x5886d3[_0x8c69('0x22')]||!_0x5886d3[_0x8c69('0x23')]||!_0x5886d3['bucket']){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))](_0x8c69('0x25'));}if(!_0xd95d06[_0x8c69('0x13')]){throw new Error(_0x8c69('0x31'));}if(_0x5886d3[_0x8c69('0x26')]===_0x33e020['id']){return _0x33e020;}else{return db[_0x8c69('0x32')]['findOne']({'where':{'id':_settings[_0x8c69('0x26')]}});}})['then'](function(_0x58df85){if(!_0x58df85){throw new db[(_0x8c69('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x58df85['data1']||!_0x58df85[_0x8c69('0xd')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x5bbd63=_0x58df85;logger['info'](util['format'](_0x8c69('0x2a'),_0xd95d06['id']));return sentiment(_0x5bbd63['data1'],_0x5bbd63['data2'],_0x5886d3['sentimentRegion'],_0xd95d06[_0x8c69('0x13')],_0x5886d3[_0x8c69('0x23')]);})[_0x8c69('0xf')](function(_0xc4edab){logger[_0x8c69('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd95d06['id']));return _0xd95d06[_0x8c69('0x1b')]({'sentiment':_0xc4edab[_0x8c69('0x33')],'sPositive':_0xc4edab[_0x8c69('0x2c')][_0x8c69('0x2b')],'sNegative':_0xc4edab[_0x8c69('0x2c')]['Negative'],'sMixed':_0xc4edab[_0x8c69('0x2c')]['Mixed'],'sNeutral':_0xc4edab[_0x8c69('0x2c')][_0x8c69('0x2d')],'transcribeStatus':'COMPLETED'});})[_0x8c69('0xf')](function(){logger[_0x8c69('0xa')](util[_0x8c69('0xb')](_0x8c69('0x1c'),_0xd95d06['id']));_0x1ebe38();});}})['catch'](function(_0x328da7){if(_0x328da7){if(!_0x328da7[_0x8c69('0x34')]||_0x328da7[_0x8c69('0x34')]!==_0x8c69('0x35')){logger[_0x8c69('0x36')](util[_0x8c69('0xb')](_0x8c69('0x37'),_0xd95d06['id']),util[_0x8c69('0x38')](_0x328da7,{'showHidden':![],'depth':null}));}}_0x1ebe38();});});}function checkTranscribe(){var _0x3c6d9a;var _0x55c599;var _0x1d91d0;return db[_0x8c69('0x39')]['findAll']({'where':{'transcribeStatus':_0x8c69('0x3a')}})[_0x8c69('0xf')](function(_0x4d514d){if(!_0x4d514d||!_0x4d514d['length']){throw new db[(_0x8c69('0x1e'))]['ValidationError'](_0x8c69('0x3b'));}_0x3c6d9a=_0x4d514d;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x51549a){if(!_0x51549a){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Settings\x20not\x20available');}_0x55c599=_0x51549a;if(!_0x55c599['transcribe']||!_0x55c599[_0x8c69('0x3c')]||!_0x55c599[_0x8c69('0xe')]||!_0x55c599['language']||!_0x55c599[_0x8c69('0x24')]){throw new db['Sequelize'][(_0x8c69('0x1f'))](_0x8c69('0x3d'));}return db['CloudProvider'][_0x8c69('0x27')]({'where':{'id':_0x55c599[_0x8c69('0x3c')]}});})[_0x8c69('0xf')](function(_0x2de454){if(!_0x2de454){throw new db[(_0x8c69('0x1e'))]['ValidationError'](_0x8c69('0x3e'));}if(!_0x2de454[_0x8c69('0x28')]||!_0x2de454[_0x8c69('0xd')]){throw new db[(_0x8c69('0x1e'))][(_0x8c69('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x1d91d0=_0x2de454;var _0xdd7326=[];_0x3c6d9a[_0x8c69('0x3f')](function(_0xaf6404){_0xdd7326[_0x8c69('0x40')](checkTranscribeJob(_0xaf6404,_0x55c599,_0x1d91d0));});return BPromise[_0x8c69('0x41')](_0xdd7326);})[_0x8c69('0x42')](function(_0x3d67f1){if(_0x3d67f1){if(!_0x3d67f1[_0x8c69('0x34')]||_0x3d67f1[_0x8c69('0x34')]!=='SequelizeValidationError'){logger[_0x8c69('0x36')](util[_0x8c69('0x38')](_0x3d67f1,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 0b750b9..035711f 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 _0xa29a=['timeout','YYYY-MM-DD\x20HH:mm:ss','join','length','emit','whatsappInteraction:update','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system'];(function(_0x2a4dda,_0x394a1b){var _0xe725e=function(_0x5c005c){while(--_0x5c005c){_0x2a4dda['push'](_0x2a4dda['shift']());}};_0xe725e(++_0x394a1b);}(_0xa29a,0x1ee));var _0xaa29=function(_0x1b681f,_0x213d3e){_0x1b681f=_0x1b681f-0x0;var _0x425da8=_0xa29a[_0x1b681f];return _0x425da8;};'use strict';var _=require(_0xaa29('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xaa29('0x1'));var config=require(_0xaa29('0x2'));var db=require(_0xaa29('0x3'))['db'];var logger=require(_0xaa29('0x4'))(_0xaa29('0x5'));config['redis']=_['defaults'](config[_0xaa29('0x6')],{'host':_0xaa29('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa29('0x6')]));function closeInteractions(){var _0x314894=[];return db[_0xaa29('0x8')][_0xaa29('0x9')]({'raw':!![],'attributes':['id',_0xaa29('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xaa29('0xb')](0x18,_0xaa29('0xc'))}}})[_0xaa29('0xd')](function(_0x349cde){if(_0x349cde&&_0x349cde['length']){_0x314894=_[_0xaa29('0xe')](_0x349cde||[],'id');logger[_0xaa29('0xf')](_0xaa29('0x10'),_0x314894['join']());return db[_0xaa29('0x8')][_0xaa29('0x11')]({'closeReason':_0xaa29('0x12'),'disposition':_0xaa29('0x13'),'closed':!![],'closedAt':moment()['format'](_0xaa29('0x14'))},{'where':{'id':_0x314894}});}})['then'](function(){if(_0x314894&&_0x314894['length']){logger[_0xaa29('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x314894[_0xaa29('0x15')]());for(var _0x3c781a=0x0;_0x3c781a<_0x314894[_0xaa29('0x16')];_0x3c781a++){io[_0xaa29('0x17')](_0xaa29('0x18'),{'id':_0x314894[_0x3c781a],'closed':!![]});}}})['catch'](function(_0x4ac0c0){logger['error'](_0xaa29('0x19'),_0x4ac0c0?util[_0xaa29('0x1a')](_0x4ac0c0,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd7e0=['util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','lodash','moment','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd7e0,0xb3));var _0x0d7e=function(_0x563a5a,_0x2a4aa4){_0x563a5a=_0x563a5a-0x0;var _0x3819b4=_0xd7e0[_0x563a5a];return _0x3819b4;};'use strict';var _=require(_0x0d7e('0x0'));var moment=require(_0x0d7e('0x1'));var Redis=require(_0x0d7e('0x2'));var util=require(_0x0d7e('0x3'));var config=require('../../config/environment');var db=require(_0x0d7e('0x4'))['db'];var logger=require(_0x0d7e('0x5'))(_0x0d7e('0x6'));config[_0x0d7e('0x7')]=_['defaults'](config[_0x0d7e('0x7')],{'host':_0x0d7e('0x8'),'port':0x18eb});var io=require(_0x0d7e('0x9'))(new Redis(config[_0x0d7e('0x7')]));function closeInteractions(){var _0x2d0db2=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0d7e('0xa')](0x18,_0x0d7e('0xb'))}}})[_0x0d7e('0xc')](function(_0x24f4e1){if(_0x24f4e1&&_0x24f4e1[_0x0d7e('0xd')]){_0x2d0db2=_['map'](_0x24f4e1||[],'id');logger[_0x0d7e('0xe')](_0x0d7e('0xf'),_0x2d0db2[_0x0d7e('0x10')]());return db[_0x0d7e('0x11')][_0x0d7e('0x12')]({'closeReason':_0x0d7e('0x13'),'disposition':_0x0d7e('0x14'),'closed':!![],'closedAt':moment()['format'](_0x0d7e('0x15'))},{'where':{'id':_0x2d0db2}});}})[_0x0d7e('0xc')](function(){if(_0x2d0db2&&_0x2d0db2[_0x0d7e('0xd')]){logger[_0x0d7e('0xe')](_0x0d7e('0x16'),_0x2d0db2[_0x0d7e('0x10')]());for(var _0x2cf2f1=0x0;_0x2cf2f1<_0x2d0db2[_0x0d7e('0xd')];_0x2cf2f1++){io[_0x0d7e('0x17')](_0x0d7e('0x18'),{'id':_0x2d0db2[_0x2cf2f1],'closed':!![]});}}})['catch'](function(_0x19c5f7){logger[_0x0d7e('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x19c5f7?util['inspect'](_0x19c5f7,{'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 7ebadb9..bb35b09 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf834=['Biondo','CmContact','then','bulkCreate','finished\x20populating','contacts1','destroy','hopper1','log','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xf834,0x6b));var _0x4f83=function(_0x98b4db,_0x11ba60){_0x98b4db=_0x98b4db-0x0;var _0x2a38f9=_0xf834[_0x98b4db];return _0x2a38f9;};'use strict';var util=require(_0x4f83('0x0'));var db=require(_0x4f83('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4f83('0x2')]({'id':i,'firstName':_0x4f83('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x4f83('0x4')+i+_0x4f83('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4f83('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4f83('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4f83('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4f83('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4f83('0x7')+i,'phone':0xf879fb460+i,'email':_0x4f83('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4f83('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4f83('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4f83('0x6')](),'updatedAt':Date['now']()});}db[_0x4f83('0x8')]['destroy']({'where':{}})[_0x4f83('0x9')](function(){return db[_0x4f83('0x8')][_0x4f83('0xa')](contacts);})[_0x4f83('0x9')](function(){console['log'](_0x4f83('0xb'),_0x4f83('0xc'));return db['CmHopper'][_0x4f83('0xd')]({'where':{}});})[_0x4f83('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console['log'](_0x4f83('0xb'),_0x4f83('0xe'));return db[_0x4f83('0x8')]['bulkCreate'](contacts2);})[_0x4f83('0x9')](function(){console[_0x4f83('0xf')]('finished\x20populating','contacts2');return db[_0x4f83('0x10')][_0x4f83('0xa')](hopper2);})['then'](function(){console['log']('finished\x20populating',_0x4f83('0x11'));})[_0x4f83('0x12')](function(_0x271655){console[_0x4f83('0xf')](_0x271655);}); \ No newline at end of file +var _0x5ff7=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','finished\x20populating','hopper1','log','contacts2','hopper2','catch','../mysqldb'];(function(_0x24aebb,_0x43db2f){var _0x3671ab=function(_0x50d4c3){while(--_0x50d4c3){_0x24aebb['push'](_0x24aebb['shift']());}};_0x3671ab(++_0x43db2f);}(_0x5ff7,0x1b4));var _0x75ff=function(_0x55cbfe,_0xc95758){_0x55cbfe=_0x55cbfe-0x0;var _0x2c352b=_0x5ff7[_0x55cbfe];return _0x2c352b;};'use strict';var util=require('util');var db=require(_0x75ff('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x75ff('0x1')]({'id':i,'firstName':_0x75ff('0x2')+i,'lastName':_0x75ff('0x3')+i,'phone':0xf879fb460+i,'email':_0x75ff('0x4')+i+_0x75ff('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x75ff('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x75ff('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x75ff('0x2')+i,'lastName':_0x75ff('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x75ff('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x75ff('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x75ff('0x6')](),'updatedAt':Date[_0x75ff('0x6')]()});}db[_0x75ff('0x7')][_0x75ff('0x8')]({'where':{}})[_0x75ff('0x9')](function(){return db[_0x75ff('0x7')][_0x75ff('0xa')](contacts);})[_0x75ff('0x9')](function(){console['log']('finished\x20populating',_0x75ff('0xb'));return db[_0x75ff('0xc')]['destroy']({'where':{}});})[_0x75ff('0x9')](function(){return db[_0x75ff('0xc')]['bulkCreate'](hopper);})[_0x75ff('0x9')](function(){console['log'](_0x75ff('0xd'),_0x75ff('0xe'));return db['CmContact'][_0x75ff('0xa')](contacts2);})[_0x75ff('0x9')](function(){console[_0x75ff('0xf')]('finished\x20populating',_0x75ff('0x10'));return db[_0x75ff('0xc')][_0x75ff('0xa')](hopper2);})['then'](function(){console[_0x75ff('0xf')](_0x75ff('0xd'),_0x75ff('0x11'));})[_0x75ff('0x12')](function(_0x2a141a){console[_0x75ff('0xf')](_0x2a141a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b223f7f..1fc61ed 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x335a=['wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','%s%s','bulkCreate','then','log','util','../mysqldb','push','agent','format','password','friend','udp'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x335a,0x1e6));var _0xa335=function(_0x227219,_0x76e857){_0x227219=_0x227219-0x0;var _0x2cb9bb=_0x335a[_0x227219];return _0x2cb9bb;};'use strict';var util=require(_0xa335('0x0'));var db=require(_0xa335('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa335('0x2')]({'name':util['format']('%s%s',_0xa335('0x3'),i),'fullname':util['format']('%s%s',_0xa335('0x3'),i),'email':util[_0xa335('0x4')]('%s%s@xcally.com',_0xa335('0x3'),i),'role':'agent','password':_0xa335('0x5'),'internal':0xfa0+i,'type':_0xa335('0x6'),'transport':[_0xa335('0x7'),'ws',_0xa335('0x8')],'disallow':['all'],'allow':[_0xa335('0x9')],'defaultuser':util[_0xa335('0x4')]('%s%s','agent',i),'encryption':_0xa335('0xa'),'avpf':_0xa335('0xa'),'force_avp':_0xa335('0xa'),'icesupport':'yes','dtlsenable':_0xa335('0xa'),'dtlsverify':'no','dtlscertfile':_0xa335('0xb'),'dtlsprivatekey':_0xa335('0xc'),'dtlssetup':_0xa335('0xd'),'callerid':util[_0xa335('0x4')](_0xa335('0xe'),util['format'](_0xa335('0xf'),_0xa335('0x3'),i),0xfa0+i)});}db['User'][_0xa335('0x10')](users)[_0xa335('0x11')](function(){console[_0xa335('0x12')]('add\x20user');})['catch'](function(_0x609e5){console['log'](_0x609e5);}); \ No newline at end of file +var _0x3116=['add\x20user','catch','log','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x3116,0x71));var _0x6311=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x3116[_0x3054be];return _0x3df150;};'use strict';var util=require('util');var db=require(_0x6311('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6311('0x1')]({'name':util[_0x6311('0x2')]('%s%s','agent',i),'fullname':util['format'](_0x6311('0x3'),_0x6311('0x4'),i),'email':util[_0x6311('0x2')]('%s%s@xcally.com','agent',i),'role':_0x6311('0x4'),'password':_0x6311('0x5'),'internal':0xfa0+i,'type':_0x6311('0x6'),'transport':[_0x6311('0x7'),'ws',_0x6311('0x8')],'disallow':[_0x6311('0x9')],'allow':[_0x6311('0xa')],'defaultuser':util[_0x6311('0x2')](_0x6311('0x3'),_0x6311('0x4'),i),'encryption':'yes','avpf':_0x6311('0xb'),'force_avp':_0x6311('0xb'),'icesupport':_0x6311('0xb'),'dtlsenable':_0x6311('0xb'),'dtlsverify':'no','dtlscertfile':_0x6311('0xc'),'dtlsprivatekey':_0x6311('0xd'),'dtlssetup':_0x6311('0xe'),'callerid':util[_0x6311('0x2')](_0x6311('0xf'),util[_0x6311('0x2')](_0x6311('0x3'),'agent',i),0xfa0+i)});}db[_0x6311('0x10')][_0x6311('0x11')](users)[_0x6311('0x12')](function(){console['log'](_0x6311('0x13'));})[_0x6311('0x14')](function(_0x37255f){console[_0x6311('0x15')](_0x37255f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4685a26..21ef059 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeeb=['then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','MailQueue','OpenchannelQueue','user','voice:outbound','VoiceQueues','ChatQueues','FaxQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','join','default','setMaxListeners','request','connection','remoteAddress','remotePort','log','nsp','address','DISCONNECTED','util','bluebird','./environment','Agents','User','name','role','telephone','agent','type','ivr','UserProfileSection','findOne'];(function(_0x9bfeb2,_0x1ab4cb){var _0x2d3422=function(_0x5f1c13){while(--_0x5f1c13){_0x9bfeb2['push'](_0x9bfeb2['shift']());}};_0x2d3422(++_0x1ab4cb);}(_0xaeeb,0x116));var _0xbaee=function(_0xb13cdb,_0x20f315){_0xb13cdb=_0xb13cdb-0x0;var _0x5e4444=_0xaeeb[_0xb13cdb];return _0x5e4444;};'use strict';var _=require('lodash');var util=require(_0xbaee('0x0'));var BPromise=require(_0xbaee('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xbaee('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xbaee('0x3'),'model':db[_0xbaee('0x4')],'attributes':['id',_0xbaee('0x5'),_0xbaee('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xbaee('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xbaee('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xbaee('0x5')],'where':{'role':_0xbaee('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbaee('0x5'),_0xbaee('0x9')],'where':{'type':_0xbaee('0xa')}};function getAssociatedResources(_0x297551,_0x2ccdb6,_0x1a4d24){return db[_0xbaee('0xb')][_0xbaee('0xc')]({'where':{'name':_0x297551,'userProfileId':_0x2ccdb6},'raw':!![]})[_0xbaee('0xd')](function(_0x55fca5){if(_0x55fca5){if(_0x55fca5[_0xbaee('0xe')]){switch(_0x297551){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0xbaee('0xf'):case _0xbaee('0x10'):case _0xbaee('0x11'):case _0xbaee('0x12'):return db[_0x1a4d24]['findAll'](queryQueues);case _0xbaee('0x13'):return db[_0x1a4d24][_0xbaee('0x14')](queryTelephones);case'Trunks':return db[_0x1a4d24][_0xbaee('0x14')](queryTrunks);case _0xbaee('0x15'):return db[_0x1a4d24][_0xbaee('0x14')](queryCampaigns);}}else{return db[_0xbaee('0x16')][_0xbaee('0x14')]({'attributes':[_0xbaee('0x17')],'where':{'sectionId':_0x55fca5['id']},'raw':!![]})[_0xbaee('0xd')](function(_0x389f6c){if(_0x389f6c){var _0x5ec2d4={'where':{'id':_['map'](_0x389f6c,_0xbaee('0x17'))},'raw':!![]};switch(_0x1a4d24){case _0xbaee('0x4'):_0x5ec2d4[_0xbaee('0x18')][_0xbaee('0x6')]=_0xbaee('0x7');break;case _0xbaee('0x19'):_0x5ec2d4[_0xbaee('0x18')][_0xbaee('0x9')]=_0xbaee('0xa');break;}return db[_0x1a4d24][_0xbaee('0x14')](_0x5ec2d4);}else{return[];}});}}else{return[];}})[_0xbaee('0xd')](function(_0x1bfeb7){return _0x1bfeb7;});}function joinOrLeaveQueues(_0x2bec3c,_0x129c89,_0x1831fc,_0x470edd){_0x2bec3c[_0x129c89](util[_0xbaee('0x1a')]('%s:queue:%s',_0x1831fc,_0x470edd[_0xbaee('0x5')]));if(_0x470edd[_0xbaee('0x3')]){for(var _0x3bd78e=0x0;_0x3bd78e<_0x470edd[_0xbaee('0x3')]['length'];_0x3bd78e+=0x1){_0x2bec3c[_0x129c89](util[_0xbaee('0x1a')](_0xbaee('0x1b'),_0x470edd['Agents'][_0x3bd78e]['name']));}}}function joinOrLeave(_0x48cda2,_0x1f7edb,_0x2dadd0){var _0x36d827;if(_0x48cda2[_0xbaee('0x1c')][_0xbaee('0x1d')]['id']){db[_0xbaee('0x4')]['find']({'attributes':['id',_0xbaee('0x5'),'role',_0xbaee('0x1e')],'where':{'id':_0x48cda2[_0xbaee('0x1c')][_0xbaee('0x1d')]['id']},'include':[{'model':db[_0xbaee('0x1f')],'as':_0xbaee('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xbaee('0x21')],'as':_0xbaee('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xbaee('0x23')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbaee('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbaee('0x25')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbaee('0x26')],'as':_0xbaee('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x13f265){if(_0x13f265){_0x36d827=_0x13f265;_0x48cda2[_0x1f7edb](util[_0xbaee('0x1a')](_0xbaee('0x1b'),_0x13f265[_0xbaee('0x5')]));var _0xf116f=[];switch(_0x13f265[_0xbaee('0x6')]){case'admin':_0x48cda2[_0x1f7edb](_0xbaee('0x28'));_0x48cda2[_0x1f7edb]('voice:outbound');if(queryQueues[_0xbaee('0x29')]('include')){delete queryQueues[_0xbaee('0x2a')];}_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x2c')][_0xbaee('0x14')](queryQueues));_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x2d')][_0xbaee('0x14')](queryQueues));_0xf116f[_0xbaee('0x2b')](db['FaxQueue'][_0xbaee('0x14')](queryQueues));_0xf116f[_0xbaee('0x2b')](db['SmsQueue']['findAll'](queryQueues));_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x2e')][_0xbaee('0x14')](queryQueues));_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x2f')][_0xbaee('0x14')](queryQueues));_0xf116f[_0xbaee('0x2b')](db['WhatsappQueue'][_0xbaee('0x14')](queryQueues));_0xf116f['push'](db[_0xbaee('0x4')][_0xbaee('0x14')](queryTelephones));_0xf116f[_0xbaee('0x2b')](db['Trunk'][_0xbaee('0x14')](queryTrunks));_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x19')][_0xbaee('0x14')](queryCampaigns));_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x4')][_0xbaee('0x14')](queryAgents));break;case _0xbaee('0x30'):_0x48cda2[_0x1f7edb]('voice:inbound');_0x48cda2[_0x1f7edb](_0xbaee('0x31'));_0xf116f['push'](getAssociatedResources(_0xbaee('0x32'),_0x13f265[_0xbaee('0x1e')],'VoiceQueue'));_0xf116f['push'](getAssociatedResources(_0xbaee('0x33'),_0x13f265['userProfileId'],_0xbaee('0x2d')));_0xf116f[_0xbaee('0x2b')](getAssociatedResources(_0xbaee('0x34'),_0x13f265[_0xbaee('0x1e')],'FaxQueue'));_0xf116f[_0xbaee('0x2b')](getAssociatedResources(_0xbaee('0xf'),_0x13f265[_0xbaee('0x1e')],'SmsQueue'));_0xf116f[_0xbaee('0x2b')](getAssociatedResources(_0xbaee('0x10'),_0x13f265[_0xbaee('0x1e')],_0xbaee('0x2e')));_0xf116f[_0xbaee('0x2b')](getAssociatedResources(_0xbaee('0x11'),_0x13f265[_0xbaee('0x1e')],_0xbaee('0x2f')));_0xf116f[_0xbaee('0x2b')](getAssociatedResources(_0xbaee('0x12'),_0x13f265[_0xbaee('0x1e')],_0xbaee('0x35')));_0xf116f['push'](getAssociatedResources(_0xbaee('0x13'),_0x13f265[_0xbaee('0x1e')],_0xbaee('0x4')));_0xf116f[_0xbaee('0x2b')](getAssociatedResources('Trunks',_0x13f265[_0xbaee('0x1e')],'Trunk'));_0xf116f[_0xbaee('0x2b')](getAssociatedResources(_0xbaee('0x15'),_0x13f265[_0xbaee('0x1e')],_0xbaee('0x19')));_0xf116f[_0xbaee('0x2b')](db[_0xbaee('0x4')][_0xbaee('0x14')](queryAgents));break;case _0xbaee('0x8'):_0x48cda2[_0x1f7edb](_0xbaee('0x28'));_0x48cda2[_0x1f7edb](_0xbaee('0x31'));_0xf116f['push'](_0x13f265[_0xbaee('0x36')]({'attributes':['id','name']}));_0xf116f[_0xbaee('0x2b')](_0x13f265[_0xbaee('0x37')]({'attributes':['id',_0xbaee('0x5')]}));_0xf116f[_0xbaee('0x2b')](_0x13f265[_0xbaee('0x38')]({'attributes':['id',_0xbaee('0x5')]}));_0xf116f[_0xbaee('0x2b')](_0x13f265['getSmsQueues']({'attributes':['id','name']}));_0xf116f[_0xbaee('0x2b')](_0x13f265[_0xbaee('0x39')]({'attributes':['id',_0xbaee('0x5')]}));_0xf116f[_0xbaee('0x2b')](_0x13f265[_0xbaee('0x3a')]({'attributes':['id',_0xbaee('0x5')]}));_0xf116f[_0xbaee('0x2b')](_0x13f265[_0xbaee('0x3b')]({'attributes':['id','name']}));break;}return BPromise[_0xbaee('0x3c')](_0xf116f);}})[_0xbaee('0xd')](function(_0x5c4105){if(_0x5c4105&&_0x5c4105[_0xbaee('0x3d')]){for(var _0x181031=0x0;_0x181031<_0x5c4105[_0xbaee('0x3d')];_0x181031+=0x1){for(var _0x506f4f=0x0;_0x506f4f<_0x5c4105[_0x181031][_0xbaee('0x3d')];_0x506f4f+=0x1){switch(_0x181031){case 0x0:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,'voice',_0x5c4105[_0x181031][_0x506f4f]);break;case 0x1:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,_0xbaee('0x3e'),_0x5c4105[_0x181031][_0x506f4f]);break;case 0x2:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,_0xbaee('0x3f'),_0x5c4105[_0x181031][_0x506f4f]);break;case 0x3:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,_0xbaee('0x40'),_0x5c4105[_0x181031][_0x506f4f]);break;case 0x4:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,_0xbaee('0x41'),_0x5c4105[_0x181031][_0x506f4f]);break;case 0x5:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,_0xbaee('0x42'),_0x5c4105[_0x181031][_0x506f4f]);break;case 0x6:joinOrLeaveQueues(_0x48cda2,_0x1f7edb,'whatsapp',_0x5c4105[_0x181031][_0x506f4f]);break;case 0x7:if(_0x36d827[_0xbaee('0x6')]!==_0xbaee('0x8'))_0x48cda2[_0x1f7edb](util[_0xbaee('0x1a')](_0xbaee('0x43'),_0x5c4105[_0x181031][_0x506f4f][_0xbaee('0x5')]));break;case 0x8:if(_0x36d827[_0xbaee('0x6')]!==_0xbaee('0x8'))_0x48cda2[_0x1f7edb](util[_0xbaee('0x1a')](_0xbaee('0x44'),_0x5c4105[_0x181031][_0x506f4f]['name']));break;case 0x9:if(_0x36d827['role']!==_0xbaee('0x8'))_0x48cda2[_0x1f7edb](util['format'](_0xbaee('0x45'),_0x5c4105[_0x181031][_0x506f4f]['type'],_0x5c4105[_0x181031][_0x506f4f][_0xbaee('0x5')]));break;case 0xa:_0x48cda2[_0x1f7edb](util[_0xbaee('0x1a')](_0xbaee('0x1b'),_0x5c4105[_0x181031][_0x506f4f][_0xbaee('0x5')]));break;}}}}})['then'](function(){if(_0x1f7edb==='leave'){var _0x5a0bdf=_[_0xbaee('0x46')](_0x36d827['ChatInteractions'],'id');return _0x36d827[_0xbaee('0x47')](_0x5a0bdf)[_0xbaee('0xd')](function(){for(var _0x21214d=0x0;_0x21214d<_0x5a0bdf['length'];_0x21214d+=0x1){_0x2dadd0[_0xbaee('0x48')](_0xbaee('0x49'),{'ChatInteractionId':Number(_0x5a0bdf[_0x21214d]),'UserId':Number(_0x36d827['id'])});}});}})[_0xbaee('0xd')](function(){if(_0x1f7edb===_0xbaee('0x4a')){var _0xbb9efe=_['map'](_0x36d827[_0xbaee('0x22')],'id');return _0x36d827[_0xbaee('0x4b')](_0xbb9efe)[_0xbaee('0xd')](function(){for(var _0x2556cb=0x0;_0x2556cb<_0xbb9efe[_0xbaee('0x3d')];_0x2556cb+=0x1){_0x2dadd0[_0xbaee('0x48')](_0xbaee('0x4c'),{'MailInteractionId':Number(_0xbb9efe[_0x2556cb]),'UserId':Number(_0x36d827['id'])});}});}})[_0xbaee('0xd')](function(){if(_0x1f7edb===_0xbaee('0x4a')){var _0x424231=_[_0xbaee('0x46')](_0x36d827[_0xbaee('0x4d')],'id');return _0x36d827[_0xbaee('0x4e')](_0x424231)['then'](function(){for(var _0x2dbbb5=0x0;_0x2dbbb5<_0x424231[_0xbaee('0x3d')];_0x2dbbb5+=0x1){_0x2dadd0[_0xbaee('0x48')](_0xbaee('0x4f'),{'FaxInteractionId':Number(_0x424231[_0x2dbbb5]),'UserId':Number(_0x36d827['id'])});}});}})[_0xbaee('0xd')](function(){if(_0x1f7edb===_0xbaee('0x4a')){var _0x1a9aa6=_[_0xbaee('0x46')](_0x36d827[_0xbaee('0x50')],'id');return _0x36d827[_0xbaee('0x51')](_0x1a9aa6)[_0xbaee('0xd')](function(){for(var _0xa43e31=0x0;_0xa43e31<_0x1a9aa6['length'];_0xa43e31+=0x1){_0x2dadd0['emit'](_0xbaee('0x52'),{'SmsInteractionId':Number(_0x1a9aa6[_0xa43e31]),'UserId':Number(_0x36d827['id'])});}});}})[_0xbaee('0xd')](function(){if(_0x1f7edb===_0xbaee('0x4a')){var _0x38bae7=_[_0xbaee('0x46')](_0x36d827[_0xbaee('0x53')],'id');return _0x36d827['removeOpenchannelInteractions'](_0x38bae7)[_0xbaee('0xd')](function(){for(var _0xb4ed0f=0x0;_0xb4ed0f<_0x38bae7[_0xbaee('0x3d')];_0xb4ed0f+=0x1){_0x2dadd0[_0xbaee('0x48')](_0xbaee('0x54'),{'OpenchannelInteractionId':Number(_0x38bae7[_0xb4ed0f]),'UserId':Number(_0x36d827['id'])});}});}})[_0xbaee('0xd')](function(){if(_0x1f7edb===_0xbaee('0x4a')){var _0x543b18=_[_0xbaee('0x46')](_0x36d827['WhatsappInteractions'],'id');return _0x36d827[_0xbaee('0x55')](_0x543b18)[_0xbaee('0xd')](function(){for(var _0x3b4e9d=0x0;_0x3b4e9d<_0x543b18[_0xbaee('0x3d')];_0x3b4e9d+=0x1){_0x2dadd0[_0xbaee('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x543b18[_0x3b4e9d]),'UserId':Number(_0x36d827['id'])});}});}})['catch'](function(_0x114853){_0x48cda2['log'](_0x114853);});}}function onDisconnect(_0x59ffc7,_0xba0d06){joinOrLeave(_0x59ffc7,_0xbaee('0x4a'),_0xba0d06);}function onConnect(_0x1c7219){joinOrLeave(_0x1c7219,_0xbaee('0x56'));}exports[_0xbaee('0x57')]=function(_0x5bb60f){_0x5bb60f['on']('connection',function(_0x38cb58){_0x38cb58[_0xbaee('0x58')](0x0);_0x38cb58['address']=_0x38cb58[_0xbaee('0x59')][_0xbaee('0x5a')][_0xbaee('0x5b')]+':'+_0x38cb58[_0xbaee('0x59')][_0xbaee('0x5a')][_0xbaee('0x5c')];_0x38cb58['connectedAt']=new Date();_0x38cb58[_0xbaee('0x5d')]=function(_0x11a199){console['log']('SocketIO\x20'+_0x38cb58[_0xbaee('0x5e')][_0xbaee('0x5')]+'['+_0x38cb58[_0xbaee('0x5f')]+']',_0x11a199);};_0x38cb58['on']('disconnect',function(){onDisconnect(_0x38cb58,_0x5bb60f);_0x38cb58[_0xbaee('0x5d')](_0xbaee('0x60'));});onConnect(_0x38cb58);_0x38cb58['log']('CONNECTED');});}; \ No newline at end of file +var _0xd4ad=['findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','role','telephone','Campaign','%s:queue:%s','Agents','length','format','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','user','VoiceQueues','ChatQueue','SmsQueue','MailQueues','WhatsappQueues','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','voice','chat','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','User','name','agent','type','ivr','UserProfileSection','then','autoAssociation','FaxQueues','SmsQueues','OpenchannelQueues'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x42aac6,_0x48df92){_0x42aac6=_0x42aac6-0x0;var _0x314705=_0xd4ad[_0x42aac6];return _0x314705;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var BPromise=require(_0xdd4a('0x2'));var db=require(_0xdd4a('0x3'))['db'];var config=require(_0xdd4a('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0xdd4a('0x5')],'attributes':['id',_0xdd4a('0x6'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xdd4a('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xdd4a('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xdd4a('0x8')],'where':{'type':_0xdd4a('0x9')}};function getAssociatedResources(_0x3a9192,_0x16f5ba,_0xd1ee35){return db[_0xdd4a('0xa')]['findOne']({'where':{'name':_0x3a9192,'userProfileId':_0x16f5ba},'raw':!![]})[_0xdd4a('0xb')](function(_0x337598){if(_0x337598){if(_0x337598[_0xdd4a('0xc')]){switch(_0x3a9192){case'VoiceQueues':case'ChatQueues':case _0xdd4a('0xd'):case _0xdd4a('0xe'):case'MailQueues':case _0xdd4a('0xf'):case'WhatsappQueues':return db[_0xd1ee35][_0xdd4a('0x10')](queryQueues);case _0xdd4a('0x11'):return db[_0xd1ee35][_0xdd4a('0x10')](queryTelephones);case _0xdd4a('0x12'):return db[_0xd1ee35][_0xdd4a('0x10')](queryTrunks);case _0xdd4a('0x13'):return db[_0xd1ee35][_0xdd4a('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0xdd4a('0x10')]({'attributes':[_0xdd4a('0x14')],'where':{'sectionId':_0x337598['id']},'raw':!![]})[_0xdd4a('0xb')](function(_0x1859f4){if(_0x1859f4){var _0x229a65={'where':{'id':_[_0xdd4a('0x15')](_0x1859f4,_0xdd4a('0x14'))},'raw':!![]};switch(_0xd1ee35){case _0xdd4a('0x5'):_0x229a65[_0xdd4a('0x16')][_0xdd4a('0x17')]=_0xdd4a('0x18');break;case _0xdd4a('0x19'):_0x229a65[_0xdd4a('0x16')][_0xdd4a('0x8')]=_0xdd4a('0x9');break;}return db[_0xd1ee35][_0xdd4a('0x10')](_0x229a65);}else{return[];}});}}else{return[];}})[_0xdd4a('0xb')](function(_0x49c234){return _0x49c234;});}function joinOrLeaveQueues(_0x31a80a,_0x4c7b67,_0x52a229,_0x13ca63){_0x31a80a[_0x4c7b67](util['format'](_0xdd4a('0x1a'),_0x52a229,_0x13ca63['name']));if(_0x13ca63['Agents']){for(var _0xfc51f=0x0;_0xfc51f<_0x13ca63[_0xdd4a('0x1b')][_0xdd4a('0x1c')];_0xfc51f+=0x1){_0x31a80a[_0x4c7b67](util[_0xdd4a('0x1d')]('user:%s',_0x13ca63['Agents'][_0xfc51f][_0xdd4a('0x6')]));}}}function joinOrLeave(_0x3e8cf8,_0x547721,_0x51112d){var _0x3d2b3a;if(_0x3e8cf8['handshake'][_0xdd4a('0x1e')]['id']){db[_0xdd4a('0x5')][_0xdd4a('0x1f')]({'attributes':['id',_0xdd4a('0x6'),_0xdd4a('0x17'),_0xdd4a('0x20')],'where':{'id':_0x3e8cf8[_0xdd4a('0x21')][_0xdd4a('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xdd4a('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x23')],'as':_0xdd4a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdd4a('0x27')],'as':_0xdd4a('0x28'),'attributes':['id'],'raw':!![]}]})[_0xdd4a('0xb')](function(_0x3a5033){if(_0x3a5033){_0x3d2b3a=_0x3a5033;_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')](_0xdd4a('0x29'),_0x3a5033[_0xdd4a('0x6')]));var _0x117ba7=[];switch(_0x3a5033['role']){case _0xdd4a('0x2a'):_0x3e8cf8[_0x547721](_0xdd4a('0x2b'));_0x3e8cf8[_0x547721](_0xdd4a('0x2c'));if(queryQueues[_0xdd4a('0x2d')]('include')){delete queryQueues[_0xdd4a('0x2e')];}_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x30')][_0xdd4a('0x10')](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db['ChatQueue'][_0xdd4a('0x10')](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x31')][_0xdd4a('0x10')](queryQueues));_0x117ba7['push'](db['SmsQueue']['findAll'](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x32')]['findAll'](queryQueues));_0x117ba7['push'](db[_0xdd4a('0x33')][_0xdd4a('0x10')](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db['WhatsappQueue']['findAll'](queryQueues));_0x117ba7[_0xdd4a('0x2f')](db['User'][_0xdd4a('0x10')](queryTelephones));_0x117ba7[_0xdd4a('0x2f')](db['Trunk'][_0xdd4a('0x10')](queryTrunks));_0x117ba7['push'](db['Campaign']['findAll'](queryCampaigns));_0x117ba7[_0xdd4a('0x2f')](db[_0xdd4a('0x5')][_0xdd4a('0x10')](queryAgents));break;case _0xdd4a('0x34'):_0x3e8cf8[_0x547721](_0xdd4a('0x2b'));_0x3e8cf8[_0x547721](_0xdd4a('0x2c'));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x35'),_0x3a5033['userProfileId'],_0xdd4a('0x30')));_0x117ba7['push'](getAssociatedResources('ChatQueues',_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x36')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0xd'),_0x3a5033['userProfileId'],_0xdd4a('0x31')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources('SmsQueues',_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x37')));_0x117ba7['push'](getAssociatedResources(_0xdd4a('0x38'),_0x3a5033['userProfileId'],_0xdd4a('0x32')));_0x117ba7['push'](getAssociatedResources('OpenchannelQueues',_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x33')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x39'),_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x3a')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x11'),_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x5')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x12'),_0x3a5033[_0xdd4a('0x20')],_0xdd4a('0x3b')));_0x117ba7[_0xdd4a('0x2f')](getAssociatedResources(_0xdd4a('0x13'),_0x3a5033['userProfileId'],'Campaign'));_0x117ba7['push'](db['User'][_0xdd4a('0x10')](queryAgents));break;case _0xdd4a('0x7'):_0x3e8cf8[_0x547721](_0xdd4a('0x2b'));_0x3e8cf8[_0x547721]('voice:outbound');_0x117ba7[_0xdd4a('0x2f')](_0x3a5033[_0xdd4a('0x3c')]({'attributes':['id','name']}));_0x117ba7['push'](_0x3a5033[_0xdd4a('0x3d')]({'attributes':['id','name']}));_0x117ba7['push'](_0x3a5033[_0xdd4a('0x3e')]({'attributes':['id','name']}));_0x117ba7[_0xdd4a('0x2f')](_0x3a5033['getSmsQueues']({'attributes':['id',_0xdd4a('0x6')]}));_0x117ba7['push'](_0x3a5033[_0xdd4a('0x3f')]({'attributes':['id',_0xdd4a('0x6')]}));_0x117ba7[_0xdd4a('0x2f')](_0x3a5033['getOpenchannelQueues']({'attributes':['id',_0xdd4a('0x6')]}));_0x117ba7[_0xdd4a('0x2f')](_0x3a5033['getWhatsappQueues']({'attributes':['id',_0xdd4a('0x6')]}));break;}return BPromise['all'](_0x117ba7);}})[_0xdd4a('0xb')](function(_0x47487f){if(_0x47487f&&_0x47487f['length']){for(var _0x177163=0x0;_0x177163<_0x47487f[_0xdd4a('0x1c')];_0x177163+=0x1){for(var _0xd32e15=0x0;_0xd32e15<_0x47487f[_0x177163][_0xdd4a('0x1c')];_0xd32e15+=0x1){switch(_0x177163){case 0x0:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x40'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x1:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x41'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x2:joinOrLeaveQueues(_0x3e8cf8,_0x547721,'fax',_0x47487f[_0x177163][_0xd32e15]);break;case 0x3:joinOrLeaveQueues(_0x3e8cf8,_0x547721,'sms',_0x47487f[_0x177163][_0xd32e15]);break;case 0x4:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x42'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x5:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x43'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x6:joinOrLeaveQueues(_0x3e8cf8,_0x547721,_0xdd4a('0x44'),_0x47487f[_0x177163][_0xd32e15]);break;case 0x7:if(_0x3d2b3a[_0xdd4a('0x17')]!=='agent')_0x3e8cf8[_0x547721](util['format'](_0xdd4a('0x45'),_0x47487f[_0x177163][_0xd32e15][_0xdd4a('0x6')]));break;case 0x8:if(_0x3d2b3a[_0xdd4a('0x17')]!=='agent')_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')](_0xdd4a('0x46'),_0x47487f[_0x177163][_0xd32e15][_0xdd4a('0x6')]));break;case 0x9:if(_0x3d2b3a[_0xdd4a('0x17')]!==_0xdd4a('0x7'))_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')](_0xdd4a('0x47'),_0x47487f[_0x177163][_0xd32e15]['type'],_0x47487f[_0x177163][_0xd32e15]['name']));break;case 0xa:_0x3e8cf8[_0x547721](util[_0xdd4a('0x1d')]('user:%s',_0x47487f[_0x177163][_0xd32e15][_0xdd4a('0x6')]));break;}}}}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0x343091=_[_0xdd4a('0x15')](_0x3d2b3a['ChatInteractions'],'id');return _0x3d2b3a[_0xdd4a('0x49')](_0x343091)[_0xdd4a('0xb')](function(){for(var _0x11d62f=0x0;_0x11d62f<_0x343091['length'];_0x11d62f+=0x1){_0x51112d['emit'](_0xdd4a('0x4a'),{'ChatInteractionId':Number(_0x343091[_0x11d62f]),'UserId':Number(_0x3d2b3a['id'])});}});}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0xacc22=_[_0xdd4a('0x15')](_0x3d2b3a['MailInteractions'],'id');return _0x3d2b3a[_0xdd4a('0x4b')](_0xacc22)[_0xdd4a('0xb')](function(){for(var _0x26fb33=0x0;_0x26fb33<_0xacc22[_0xdd4a('0x1c')];_0x26fb33+=0x1){_0x51112d[_0xdd4a('0x4c')](_0xdd4a('0x4d'),{'MailInteractionId':Number(_0xacc22[_0x26fb33]),'UserId':Number(_0x3d2b3a['id'])});}});}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0x19baf3=_[_0xdd4a('0x15')](_0x3d2b3a[_0xdd4a('0x4e')],'id');return _0x3d2b3a[_0xdd4a('0x4f')](_0x19baf3)[_0xdd4a('0xb')](function(){for(var _0x2d153c=0x0;_0x2d153c<_0x19baf3[_0xdd4a('0x1c')];_0x2d153c+=0x1){_0x51112d[_0xdd4a('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x19baf3[_0x2d153c]),'UserId':Number(_0x3d2b3a['id'])});}});}})['then'](function(){if(_0x547721==='leave'){var _0x691c39=_[_0xdd4a('0x15')](_0x3d2b3a[_0xdd4a('0x50')],'id');return _0x3d2b3a[_0xdd4a('0x51')](_0x691c39)[_0xdd4a('0xb')](function(){for(var _0x3088cd=0x0;_0x3088cd<_0x691c39['length'];_0x3088cd+=0x1){_0x51112d[_0xdd4a('0x4c')](_0xdd4a('0x52'),{'SmsInteractionId':Number(_0x691c39[_0x3088cd]),'UserId':Number(_0x3d2b3a['id'])});}});}})['then'](function(){if(_0x547721===_0xdd4a('0x48')){var _0x52575e=_['map'](_0x3d2b3a[_0xdd4a('0x53')],'id');return _0x3d2b3a[_0xdd4a('0x54')](_0x52575e)['then'](function(){for(var _0x14ff0e=0x0;_0x14ff0e<_0x52575e['length'];_0x14ff0e+=0x1){_0x51112d[_0xdd4a('0x4c')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x52575e[_0x14ff0e]),'UserId':Number(_0x3d2b3a['id'])});}});}})[_0xdd4a('0xb')](function(){if(_0x547721===_0xdd4a('0x48')){var _0x2ffe49=_['map'](_0x3d2b3a[_0xdd4a('0x28')],'id');return _0x3d2b3a[_0xdd4a('0x55')](_0x2ffe49)[_0xdd4a('0xb')](function(){for(var _0x297d73=0x0;_0x297d73<_0x2ffe49[_0xdd4a('0x1c')];_0x297d73+=0x1){_0x51112d[_0xdd4a('0x4c')](_0xdd4a('0x56'),{'WhatsappInteractionId':Number(_0x2ffe49[_0x297d73]),'UserId':Number(_0x3d2b3a['id'])});}});}})['catch'](function(_0x489388){_0x3e8cf8['log'](_0x489388);});}}function onDisconnect(_0x4b63b4,_0x873684){joinOrLeave(_0x4b63b4,'leave',_0x873684);}function onConnect(_0x453f2f){joinOrLeave(_0x453f2f,_0xdd4a('0x57'));}exports[_0xdd4a('0x58')]=function(_0x5f48d4){_0x5f48d4['on']('connection',function(_0x6299fb){_0x6299fb[_0xdd4a('0x59')](0x0);_0x6299fb[_0xdd4a('0x5a')]=_0x6299fb['request'][_0xdd4a('0x5b')][_0xdd4a('0x5c')]+':'+_0x6299fb[_0xdd4a('0x5d')][_0xdd4a('0x5b')][_0xdd4a('0x5e')];_0x6299fb[_0xdd4a('0x5f')]=new Date();_0x6299fb[_0xdd4a('0x60')]=function(_0x3d2289){console[_0xdd4a('0x60')](_0xdd4a('0x61')+_0x6299fb['nsp']['name']+'['+_0x6299fb[_0xdd4a('0x5a')]+']',_0x3d2289);};_0x6299fb['on'](_0xdd4a('0x62'),function(){onDisconnect(_0x6299fb,_0x5f48d4);_0x6299fb['log'](_0xdd4a('0x63'));});onConnect(_0x6299fb);_0x6299fb[_0xdd4a('0x60')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index dd83403..edcffc5 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 _0xbb2c=['fullname','email','hasOwnProperty','model','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','request','EventManager','then','info','error','code','Trigger,\x20%s','channel','motionChannel','direction','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','undefined','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','catch','AfterCreateMessage','get','event','opened','contact','name','AfterCreate','changed','closed','substatus','ContactId','find'];(function(_0x319f37,_0x587a7d){var _0x537410=function(_0x3854cf){while(--_0x3854cf){_0x319f37['push'](_0x319f37['shift']());}};_0x537410(++_0x587a7d);}(_0xbb2c,0x127));var _0xcbb2=function(_0x423eba,_0x5ca862){_0x423eba=_0x423eba-0x0;var _0x2734f8=_0xbb2c[_0x423eba];return _0x2734f8;};'use strict';var util=require(_0xcbb2('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcbb2('0x1'));var logger=require(_0xcbb2('0x2'))(_0xcbb2('0x3'));var client=jayson[_0xcbb2('0x4')][_0xcbb2('0x5')]({'port':0x232a});var triggers=[{'channel':_0xcbb2('0x6'),'model':_0xcbb2('0x7'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0x9'),'callback':afterCreate},{'channel':'Chat','model':_0xcbb2('0x7'),'event':_0xcbb2('0xa'),'condition':_0xcbb2('0xb'),'callback':afterUpdate},{'channel':_0xcbb2('0x6'),'model':_0xcbb2('0xc'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0xd'),'callback':afterCreateMessage},{'channel':_0xcbb2('0x6'),'model':_0xcbb2('0xe'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0xcbb2('0xf'),'model':_0xcbb2('0x10'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0x9'),'callback':afterCreate},{'channel':_0xcbb2('0xf'),'model':_0xcbb2('0x10'),'event':_0xcbb2('0xa'),'condition':_0xcbb2('0xb'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xcbb2('0x11'),'model':_0xcbb2('0x12'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0x9'),'callback':afterCreate},{'channel':_0xcbb2('0x11'),'model':_0xcbb2('0x12'),'event':_0xcbb2('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xcbb2('0x11'),'model':_0xcbb2('0x13'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0xd'),'callback':afterCreateMessage},{'channel':_0xcbb2('0x14'),'model':_0xcbb2('0x15'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0x9'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0xcbb2('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xcbb2('0x14'),'model':_0xcbb2('0x16'),'event':_0xcbb2('0x8'),'condition':_0xcbb2('0xd'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0xcbb2('0x8'),'condition':_0xcbb2('0x9'),'callback':afterCreate},{'channel':'Mail','model':_0xcbb2('0x17'),'event':_0xcbb2('0xa'),'condition':_0xcbb2('0xb'),'callback':afterUpdate},{'channel':_0xcbb2('0x18'),'model':'MailMessage','event':'afterCreate','condition':_0xcbb2('0xd'),'callback':afterCreateMessage},{'channel':_0xcbb2('0x19'),'model':_0xcbb2('0x1a'),'event':_0xcbb2('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xcbb2('0xa'),'condition':_0xcbb2('0xb'),'callback':afterUpdate},{'channel':_0xcbb2('0x19'),'model':'OpenchannelMessage','event':_0xcbb2('0x8'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x1814e9){return client[_0xcbb2('0x1b')](_0xcbb2('0x1c'),_0x1814e9)[_0xcbb2('0x1d')](function(_0x3e75f0){logger[_0xcbb2('0x1e')]('Trigger,\x20%s','EventManager',_0x3e75f0);if(_0x3e75f0[_0xcbb2('0x1f')]){if(_0x3e75f0[_0xcbb2('0x1f')][_0xcbb2('0x20')]===0x1f4){logger[_0xcbb2('0x1f')](_0xcbb2('0x21'),'EventManager',_0x3e75f0[_0xcbb2('0x1f')]);}}})['catch'](function(_0x5e8463){logger[_0xcbb2('0x1f')](_0xcbb2('0x21'),_0xcbb2('0x1c'),_0x5e8463);});}function afterCreateMessage(_0xef99cf){return function(_0x417d16){_0x417d16=_0x417d16['get']({'plain':!![]});_0x417d16[_0xcbb2('0x22')]=_0xef99cf;_0x417d16[_0xcbb2('0x23')]=_0xef99cf;_0x417d16['event']=_0x417d16[_0xcbb2('0x24')];Promise[_0xcbb2('0x25')]()[_0xcbb2('0x1d')](function(){if(typeof _0x417d16['ContactId']==='undefined')return null;var _0x51b6d8=_0xcbb2('0x26')+_0x417d16['ContactId'];return db[_0xcbb2('0x27')][_0xcbb2('0x28')](_0x51b6d8,{'type':db[_0xcbb2('0x29')][_0xcbb2('0x2a')][_0xcbb2('0x2b')],'raw':!![]});})[_0xcbb2('0x1d')](function(_0x51e9ea){if(_0x51e9ea){_0x417d16['contact']=_0x51e9ea[0x0];}if(typeof _0x417d16['UserId']===_0xcbb2('0x2c'))return;return getAgent(_0x417d16[_0xcbb2('0x2d')]);})[_0xcbb2('0x1d')](function(_0x362996){if(_0x362996){_0x417d16[_0xcbb2('0x2e')]=util[_0xcbb2('0x2f')](_0xcbb2('0x30'),_0x362996['name']);_0x417d16[_0xcbb2('0x31')]=_0x362996;_0x417d16['channel']=_0xef99cf;return request({'event':_0xcbb2('0x32'),'message':_0x417d16});}else{return request({'event':_0xcbb2('0x33'),'message':_0x417d16});}})[_0xcbb2('0x34')](function(_0x5d35d1){logger['error'](_0xcbb2('0x21'),_0xcbb2('0x35'),_0x5d35d1);});};}function afterCreateOfflineMessage(_0x2825b5){return function(_0x145dae){_0x145dae=_0x145dae[_0xcbb2('0x36')]({'plain':!![]});_0x145dae['channel']=_0x2825b5;_0x145dae['motionChannel']=_0x2825b5;_0x145dae['event']='offlineMessage';return request({'event':_0x145dae[_0xcbb2('0x37')],'message':_0x145dae});};}function afterCreate(_0x26c7c7,_0x24f640){return function(_0x7a1103){_0x7a1103=_0x7a1103[_0xcbb2('0x36')]({'plain':!![]});_0x7a1103[_0xcbb2('0x22')]=_0x26c7c7;_0x7a1103['motionChannel']=_0x26c7c7;_0x7a1103[_0xcbb2('0x37')]=_0xcbb2('0x38');Promise['resolve']()[_0xcbb2('0x1d')](function(){var _0x11d575='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7a1103['ContactId'];return db['sequelize']['query'](_0x11d575,{'type':db['Sequelize'][_0xcbb2('0x2a')]['SELECT'],'raw':!![]});})[_0xcbb2('0x1d')](function(_0x5beb41){if(_0x5beb41){_0x7a1103[_0xcbb2('0x39')]=_0x5beb41[0x0];}if(typeof _0x7a1103['UserId']===_0xcbb2('0x2c'))return;return getAgent(_0x7a1103[_0xcbb2('0x2d')]);})[_0xcbb2('0x1d')](function(_0x2d1412){if(_0x2d1412){_0x7a1103['interface']=util[_0xcbb2('0x2f')](_0xcbb2('0x30'),_0x2d1412[_0xcbb2('0x3a')]);_0x7a1103[_0xcbb2('0x31')]=_0x2d1412;}return request({'event':_0x24f640,'message':_0x7a1103});})[_0xcbb2('0x34')](function(_0x1ecc89){logger[_0xcbb2('0x1f')](_0xcbb2('0x21'),_0xcbb2('0x3b'),_0x1ecc89);});};}function afterUpdate(_0x1b8b69){return function(_0x54615e){var _0x33e26b=_0x54615e[_0xcbb2('0x3c')]('closed')&&_0x54615e[_0xcbb2('0x3d')];var _0x15b5bd=_0x54615e[_0xcbb2('0x3c')]('substatus');if(_0x33e26b||_0x15b5bd){var _0xaed623=_0x33e26b?'closedinteraction':_0xcbb2('0x3e');var _0x9610c7=_0x54615e[_0xcbb2('0x36')]({'plain':!![]});_0x9610c7[_0xcbb2('0x22')]=_0x1b8b69;_0x9610c7[_0xcbb2('0x23')]=_0x1b8b69;_0x9610c7[_0xcbb2('0x37')]=_0x33e26b?_0xcbb2('0x3d'):_0xcbb2('0x3e');var _0x367d9a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9610c7[_0xcbb2('0x3f')];return db[_0xcbb2('0x27')][_0xcbb2('0x28')](_0x367d9a,{'type':db[_0xcbb2('0x29')]['QueryTypes'][_0xcbb2('0x2b')],'raw':!![]})['then'](function(_0x450519){if(_0x450519){_0x9610c7[_0xcbb2('0x39')]=_0x450519[0x0];}if(typeof _0x9610c7[_0xcbb2('0x2d')]==='undefined')return;return getAgent(_0x9610c7[_0xcbb2('0x2d')]);})[_0xcbb2('0x1d')](function(_0x59a220){if(_0x59a220){_0x9610c7[_0xcbb2('0x2e')]=util['format'](_0xcbb2('0x30'),_0x59a220['name']);_0x9610c7['agent']=_0x59a220;}return request({'event':_0xaed623,'message':_0x9610c7});})['catch'](function(_0x1f9125){logger[_0xcbb2('0x1f')]('Trigger,\x20%s','AfterUpdate',_0x1f9125);});}};}function getAgent(_0x515ac8){return db['User'][_0xcbb2('0x40')]({'where':{'id':_0x515ac8},'attributes':['id','name',_0xcbb2('0x41'),_0xcbb2('0x42'),'internal'],'raw':!![]})['then'](function(_0x27136e){return _0x27136e;});}exports['default']=function(){for(var _0x441cbc=0x0;_0x441cbc=_0x5b07ec[_0x94c3('0x13')]){throw Error(_0x94c3('0x14'));}_0x512802(_0x439d2f);})[_0x94c3('0x15')](function(_0x596c7e){_0x16b7a7(_0x596c7e);});});}; \ No newline at end of file +var _0xa11d=['chat','fax','whatsapp','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','role','agent','User','count','then','agents','catch','bluebird','../mysqldb','./license/util','voice','mail'];(function(_0x2f8998,_0x820d2c){var _0x2759d4=function(_0x27159e){while(--_0x27159e){_0x2f8998['push'](_0x2f8998['shift']());}};_0x2759d4(++_0x820d2c);}(_0xa11d,0xb8));var _0xda11=function(_0x175ff0,_0x1037a7){_0x175ff0=_0x175ff0-0x0;var _0x5e5e59=_0xa11d[_0x175ff0];return _0x5e5e59;};'use strict';var _=require('lodash');var BPromise=require(_0xda11('0x0'));var db=require(_0xda11('0x1'))['db'];var util=require(_0xda11('0x2'));var channels=[_0xda11('0x3'),_0xda11('0x4'),_0xda11('0x5'),_0xda11('0x6'),'sms',_0xda11('0x7'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0xda11('0x8')]=function(_0x342ec5){_0x342ec5=_0x342ec5[_0xda11('0x9')]();return _[_0xda11('0xa')](channels,_0x342ec5);};exports[_0xda11('0xb')]=function(_0x3669d1,_0x1f0f11,_0x23f8d6,_0x168b96){var _0x518dc1={'loginAttempts':_0x1f0f11,'blocked':_0x23f8d6};if(!_[_0xda11('0xc')](_0x168b96)){_0x518dc1[_0xda11('0xd')]=_0x168b96;}return _0x3669d1['updateAttributes'](_0x518dc1);};exports['getLicense']=function(_0x3f8405){return new BPromise(function(_0x3489ab,_0xa3d3d8){var _0x9ae90a=0x0;if(_0x3f8405[_0xda11('0xe')]!==_0xda11('0xf')){_0x3489ab(_0x3f8405);}db[_0xda11('0x10')][_0xda11('0x11')]({'where':{'role':_0xda11('0xf'),'online':!![],'id':{'$ne':_0x3f8405['id']}}})[_0xda11('0x12')](function(_0x2175da){_0x9ae90a=_0x2175da;return util['getLicense']();})['then'](function(_0x29425d){if(_0x29425d&&_0x29425d[_0xda11('0x13')]&&_0x9ae90a>=_0x29425d['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3489ab(_0x3f8405);})[_0xda11('0x14')](function(_0x2a96df){_0xa3d3d8(_0x2a96df);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index adca105..8b1caf2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6594=['status','json','404'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6594,0xcb));var _0x4659=function(_0x2109a8,_0x3a7797){_0x2109a8=_0x2109a8-0x0;var _0x522094=_0x6594[_0x2109a8];return _0x522094;};'use strict';module['exports'][0x194]=function pageNotFound(_0x55b15c,_0x567a59){var _0x5ebc44=_0x4659('0x0');var _0xda9ca2=0x194;var _0x365816={'status':_0xda9ca2};_0x567a59[_0x4659('0x1')](_0x365816[_0x4659('0x1')]);_0x567a59['render'](_0x5ebc44,{},function(_0x4c1f68,_0x3ef3b1){if(_0x4c1f68){return _0x567a59[_0x4659('0x1')](_0x365816[_0x4659('0x1')])[_0x4659('0x2')](_0x365816);}_0x567a59['send'](_0x3ef3b1);});}; \ No newline at end of file +var _0xafdf=['exports','status','render'];(function(_0x55b728,_0xe943c2){var _0x54773f=function(_0x5cbd96){while(--_0x5cbd96){_0x55b728['push'](_0x55b728['shift']());}};_0x54773f(++_0xe943c2);}(_0xafdf,0xf6));var _0xfafd=function(_0x597ca0,_0x525f0c){_0x597ca0=_0x597ca0-0x0;var _0x5de237=_0xafdf[_0x597ca0];return _0x5de237;};'use strict';module[_0xfafd('0x0')][0x194]=function pageNotFound(_0x4be494,_0x504c67){var _0x2ee544='404';var _0x40a3f2=0x194;var _0x49a90d={'status':_0x40a3f2};_0x504c67['status'](_0x49a90d[_0xfafd('0x1')]);_0x504c67[_0xfafd('0x2')](_0x2ee544,{},function(_0x45fd66,_0xb96a7b){if(_0x45fd66){return _0x504c67[_0xfafd('0x1')](_0x49a90d['status'])['json'](_0x49a90d);}_0x504c67['send'](_0xb96a7b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ab4d7be..fbe596b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe062=['Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','UserWhatsappQueue','ChatWebsite','FaxAccounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Pause','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Team','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','belongsTo','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','CloudProvider','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Dispositions','Answers','Messages','Interactions','List','ListId','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Attachments','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','IntervalId','Tag','TagId','Items','FaxAccountId','FaxApplication','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Interaction','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','Hoppers','CmHopperHistory','Company','CompanyId','cm_contact_has_tags','CampaignId','Condition','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','Extensions','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Sound','Mohs','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Field','VariableId','SugarcrmConfiguration','Subjects','Description','DeskAccount','Configurations','DeskField','int_desk_configuration_has_tags','ZohoField','ZendeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','FreshsalesAccount','ChatQueueReport','ToId','SessionId','ProjectId','team_has_fax_queues','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','ToChatQueueId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','FromAccount','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','determine','motion2','xcall','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','defaultsDeep','name','database','password','options','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','MailServerIn','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZendeskAccount/intZendeskAccount.model','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','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','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','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','VoiceMail','cascade','hasMany','UserId','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users'];(function(_0x1dc44d,_0x3f9d0b){var _0x47c0f7=function(_0x57a509){while(--_0x57a509){_0x1dc44d['push'](_0x1dc44d['shift']());}};_0x47c0f7(++_0x3f9d0b);}(_0xe062,0xd5));var _0x2e06=function(_0x2985d1,_0x3d8c8){_0x2985d1=_0x2985d1-0x0;var _0x23e3fd=_0xe062[_0x2985d1];return _0x23e3fd;};'use strict';var config=require(_0x2e06('0x0'));var Sequelize=require(_0x2e06('0x1'));var _=require('lodash');var jstz=require(_0x2e06('0x2'));var timezone=jstz[_0x2e06('0x3')]();config[_0x2e06('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x2e06('0x4'),'username':_0x2e06('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2e06('0x6'),'dialectOptions':{'charset':_0x2e06('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x2e06('0x8')}}});config[_0x2e06('0x9')]=_[_0x2e06('0xa')](config[_0x2e06('0x9')],{'database':_0x2e06('0x4'),'username':_0x2e06('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2e06('0x6'),'dialectOptions':{'charset':_0x2e06('0x7')},'logging':![],'timezone':timezone[_0x2e06('0xb')](),'define':{'charset':'utf8','collate':_0x2e06('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2e06('0x1')][_0x2e06('0xc')],config[_0x2e06('0x1')]['username'],config[_0x2e06('0x1')][_0x2e06('0xd')],config['sequelize'][_0x2e06('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2e06('0x9')]['database'],config[_0x2e06('0x9')][_0x2e06('0xf')],config[_0x2e06('0x9')][_0x2e06('0xd')],config[_0x2e06('0x9')][_0x2e06('0xe')])};db['User']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x11'));db[_0x2e06('0x12')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x13'));db[_0x2e06('0x14')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x15'));db[_0x2e06('0x16')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x17'));db[_0x2e06('0x18')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x19'));db[_0x2e06('0x1a')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x1b'));db[_0x2e06('0x1c')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x1d'));db[_0x2e06('0x1e')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x1f'));db['VoiceMail']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x20'));db[_0x2e06('0x21')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x22'));db[_0x2e06('0x23')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x24'));db[_0x2e06('0x25')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x26'));db['VoiceAgentReport']=db[_0x2e06('0x1')]['import'](_0x2e06('0x27'));db[_0x2e06('0x28')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x29'));db[_0x2e06('0x2a')]=db['sequelize']['import'](_0x2e06('0x2b'));db[_0x2e06('0x2c')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x2d'));db[_0x2e06('0x2e')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x2f'));db['UserVoiceQueueRt']=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x2e06('0x30')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x31'));db[_0x2e06('0x32')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x33'));db[_0x2e06('0x34')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x35'));db[_0x2e06('0x36')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x37'));db[_0x2e06('0x38')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/userSmsQueue/userSmsQueue.model');db[_0x2e06('0x39')]=db[_0x2e06('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0x2e06('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x2e06('0x3a')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/mailServerIn/mailServerIn.model');db[_0x2e06('0x3b')]=db['sequelize'][_0x2e06('0x10')]('../api/mailServerOut/mailServerOut.model');db[_0x2e06('0x3c')]=db[_0x2e06('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0x2e06('0x3d')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x3e'));db['MailSubstatus']=db[_0x2e06('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x2e06('0x3f')]=db['sequelize']['import'](_0x2e06('0x40'));db[_0x2e06('0x41')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x42'));db[_0x2e06('0x43')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x44'));db[_0x2e06('0x45')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x46'));db[_0x2e06('0x47')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/dashboard/dashboard.model');db[_0x2e06('0x48')]=db[_0x2e06('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x2e06('0x49')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x4a'));db['FaxApplication']=db[_0x2e06('0x1')]['import'](_0x2e06('0x4b'));db['FaxInteraction']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x4c'));db['FaxMessage']=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/faxMessage/faxMessage.model');db[_0x2e06('0x4d')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x4e'));db[_0x2e06('0x4f')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x50'));db[_0x2e06('0x51')]=db['sequelize'][_0x2e06('0x10')]('../api/smsAccount/smsAccount.model');db[_0x2e06('0x52')]=db['sequelize'][_0x2e06('0x10')]('../api/smsApplication/smsApplication.model');db[_0x2e06('0x53')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x54'));db[_0x2e06('0x55')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x56'));db['SmsQueue']=db[_0x2e06('0x1')]['import'](_0x2e06('0x57'));db['OpenchannelAccount']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x58'));db[_0x2e06('0x59')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x5a'));db['OpenchannelInteraction']=db['sequelize'][_0x2e06('0x10')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x2e06('0x5b')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x5c'));db[_0x2e06('0x5d')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x5e'));db['ChatWebsite']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x5f'));db[_0x2e06('0x60')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x61'));db[_0x2e06('0x62')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x63'));db['ChatInteraction']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x64'));db[_0x2e06('0x65')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x66'));db[_0x2e06('0x67')]=db[_0x2e06('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/chatGroup/chatGroup.model');db[_0x2e06('0x68')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x69'));db[_0x2e06('0x6a')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x6b'));db[_0x2e06('0x6c')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x6d'));db[_0x2e06('0x6e')]=db['sequelize'][_0x2e06('0x10')]('../api/cmHopper/cmHopper.model');db[_0x2e06('0x6f')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x70'));db[_0x2e06('0x71')]=db['sequelize']['import'](_0x2e06('0x72'));db['CmHopperHistory']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x73'));db['ReportAgentPreview']=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x2e06('0x74')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/cmCustomField/cmCustomField.model');db[_0x2e06('0x75')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x76'));db[_0x2e06('0x77')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x78'));db[_0x2e06('0x79')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x7a'));db[_0x2e06('0x7b')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x7c'));db['Condition']=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/condition/condition.model');db[_0x2e06('0x7d')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x7e'));db['Pause']=db[_0x2e06('0x1')]['import'](_0x2e06('0x7f'));db[_0x2e06('0x80')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x81'));db[_0x2e06('0x82')]=db[_0x2e06('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x2e06('0x83')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x84'));db['Sound']=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/sound/sound.model');db['Tag']=db[_0x2e06('0x1')]['import'](_0x2e06('0x85'));db[_0x2e06('0x86')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x87'));db[_0x2e06('0x88')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x89'));db[_0x2e06('0x8a')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x8b'));db['Integration']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x8c'));db[_0x2e06('0x8d')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize']['import'](_0x2e06('0x8e'));db[_0x2e06('0x8f')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x90'));db[_0x2e06('0x91')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x92'));db[_0x2e06('0x93')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/analyticMetric/analyticMetric.model');db[_0x2e06('0x94')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x95'));db[_0x2e06('0x96')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x97'));db[_0x2e06('0x98')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x99'));db[_0x2e06('0x9a')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x9b'));db[_0x2e06('0x9c')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x9d'));db[_0x2e06('0x9e')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db['SugarcrmConfiguration']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x9f'));db[_0x2e06('0xa0')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x2e06('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x2e06('0xa1')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xa2'));db['DeskField']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xa3'));db[_0x2e06('0xa4')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xa5'));db[_0x2e06('0xa6')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xa7'));db['ZohoField']=db['sequelize'][_0x2e06('0x10')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xa8'));db[_0x2e06('0xa9')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xaa'));db[_0x2e06('0xab')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xac'));db[_0x2e06('0xad')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xae'));db[_0x2e06('0xaf')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xb0'));db[_0x2e06('0xb1')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xb2'));db[_0x2e06('0xb3')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xb4'));db['VtigerConfiguration']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xb5'));db['VtigerField']=db[_0x2e06('0x1')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x2e06('0xb6')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xb7'));db[_0x2e06('0xb8')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x2e06('0xb9')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xba'));db[_0x2e06('0xbb')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xbc'));db[_0x2e06('0xbd')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xbe'));db[_0x2e06('0xbf')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xc0'));db['FreshsalesAccount']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xc1'));db[_0x2e06('0xc2')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xc3'));db[_0x2e06('0xc4')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xc5'));db[_0x2e06('0xc6')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x8c'));db['Network']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xc7'));db['ChatQueueReport']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xc8'));db[_0x2e06('0xc9')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xca'));db[_0x2e06('0xcb')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xcc'));db[_0x2e06('0xcd')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xce'));db[_0x2e06('0xcf')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x2e06('0xd0')]=db['sequelize']['import'](_0x2e06('0xd1'));db[_0x2e06('0xd2')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xd3'));db[_0x2e06('0xd4')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xd5'));db[_0x2e06('0xd6')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xd7'));db[_0x2e06('0xd8')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/setting/setting.model');db[_0x2e06('0xd9')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xda'));db[_0x2e06('0xdb')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xdc'));db[_0x2e06('0xdd')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/squareRecording/squareRecording.model');db[_0x2e06('0xde')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xdf'));db['Team']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xe0'));db['License']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xe1'));db[_0x2e06('0xe2')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xe3'));db[_0x2e06('0xe4')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/migration/migration.model');db[_0x2e06('0xe5')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/attachment/attachment.model');db[_0x2e06('0xe6')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xe7'));db[_0x2e06('0xe8')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xe9'));db[_0x2e06('0xea')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xeb'));db['OpenchannelTransferReport']=db[_0x2e06('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x2e06('0xec')]=db['sequelize']['import'](_0x2e06('0xed'));db[_0x2e06('0xee')]=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xef'));db[_0x2e06('0xf0')]=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xf1'));db[_0x2e06('0xf2')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xf3'));db[_0x2e06('0xf4')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xf5'));db[_0x2e06('0xf6')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xf7'));db['WhatsappAccount']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0xf8'));db['WhatsappApplication']=db['sequelize'][_0x2e06('0x10')]('../api/whatsappApplication/whatsappApplication.model');db[_0x2e06('0xf9')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xfa'));db[_0x2e06('0xfb')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0xfc'));db['WhatsappQueueReport']=db[_0x2e06('0x1')][_0x2e06('0x10')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x2e06('0xfd')]=db[_0x2e06('0x1')]['import'](_0x2e06('0xfe'));db[_0x2e06('0xff')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x100'));db['CloudProvider']=db['sequelize'][_0x2e06('0x10')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize'][_0x2e06('0x10')](_0x2e06('0x101'));db[_0x2e06('0x102')]=db[_0x2e06('0x1')]['import'](_0x2e06('0x103'));db[_0x2e06('0x104')]=db[_0x2e06('0x1')][_0x2e06('0x10')](_0x2e06('0x105'));db[_0x2e06('0x106')][_0x2e06('0x107')](db['VoiceMail'],{'as':_0x2e06('0x108'),'onDelete':_0x2e06('0x109'),'foreignKey':'UserId'});db['User'][_0x2e06('0x10a')](db[_0x2e06('0x1c')],{'as':'Recordings','foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x106')][_0x2e06('0x10a')](db[_0x2e06('0x10c')],{'as':_0x2e06('0x10d'),'foreignKey':'UserId'});db[_0x2e06('0x106')][_0x2e06('0x10a')](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x2e06('0x106')][_0x2e06('0x10a')](db[_0x2e06('0x71')],{'as':_0x2e06('0x10e'),'foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x106')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x106')][_0x2e06('0x10a')](db[_0x2e06('0x10f')],{'as':_0x2e06('0x10f'),'foreignKey':'UserId'});db[_0x2e06('0x106')][_0x2e06('0x10a')](db[_0x2e06('0x110')],{'as':_0x2e06('0x111'),'foreignKey':_0x2e06('0x10b')});db['User'][_0x2e06('0x10a')](db['ChatInteraction'],{'as':_0x2e06('0x112'),'foreignKey':_0x2e06('0x10b')});db['User'][_0x2e06('0x10a')](db[_0x2e06('0x53')],{'as':_0x2e06('0x113'),'foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x106')][_0x2e06('0x10a')](db[_0x2e06('0x114')],{'as':_0x2e06('0x115'),'foreignKey':_0x2e06('0x10b')});db['User'][_0x2e06('0x10a')](db[_0x2e06('0x3f')],{'as':_0x2e06('0x116'),'foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x106')]['hasMany'](db[_0x2e06('0xf9')],{'as':_0x2e06('0x117'),'foreignKey':'UserId'});db[_0x2e06('0x106')][_0x2e06('0x10a')](db[_0x2e06('0xf6')],{'as':'UserNotifications','foreignKey':_0x2e06('0x118')});db['User']['belongsTo'](db[_0x2e06('0xf0')],{'as':_0x2e06('0xf0'),'foreignKey':_0x2e06('0x119')});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x11b')],{'as':_0x2e06('0x11c'),'through':_0x2e06('0x11d')});db[_0x2e06('0x106')][_0x2e06('0x11a')](db['CmContact'],{'as':_0x2e06('0x11e'),'through':_0x2e06('0x11f')});db[_0x2e06('0x106')]['belongsToMany'](db[_0x2e06('0xee')],{'as':_0x2e06('0x120'),'through':_0x2e06('0x121')});db[_0x2e06('0x106')]['belongsToMany'](db['Team'],{'through':_0x2e06('0x122')});db[_0x2e06('0x106')]['belongsToMany'](db[_0x2e06('0x3f')],{'as':_0x2e06('0x116'),'through':_0x2e06('0x123')});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x124')],{'as':'ChatInteractions','through':_0x2e06('0x125')});db['User']['belongsToMany'](db[_0x2e06('0x114')],{'as':_0x2e06('0x115'),'through':_0x2e06('0x126')});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x53')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x2e06('0x106')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x2e06('0x111'),'through':_0x2e06('0x127')});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0xf9')],{'as':_0x2e06('0x117'),'through':'user_has_whatsapp_interactions'});db[_0x2e06('0x106')][_0x2e06('0x11a')](db['VoiceQueue'],{'as':_0x2e06('0x128'),'through':_0x2e06('0x30'),'required':![]});db['User'][_0x2e06('0x11a')](db[_0x2e06('0x129')],{'as':'VoicePrefixes','through':_0x2e06('0x104'),'required':![]});db['User']['belongsToMany'](db[_0x2e06('0x3d')],{'as':_0x2e06('0x12a'),'through':_0x2e06('0x34'),'required':![]});db['User'][_0x2e06('0x11a')](db['ChatQueue'],{'as':_0x2e06('0x12b'),'through':_0x2e06('0x32'),'required':![],'hooks':!![]});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x4d')],{'as':_0x2e06('0x12c'),'through':_0x2e06('0x36'),'required':![]});db['User'][_0x2e06('0x11a')](db[_0x2e06('0x12d')],{'as':_0x2e06('0x12e'),'through':'UserSmsQueue','required':![]});db['User'][_0x2e06('0x11a')](db['OpenchannelQueue'],{'as':_0x2e06('0x12f'),'through':_0x2e06('0x39'),'required':![]});db[_0x2e06('0x106')]['belongsToMany'](db[_0x2e06('0xff')],{'as':'WhatsappQueues','through':_0x2e06('0x130'),'required':![]});db['User'][_0x2e06('0x11a')](db[_0x2e06('0xee')],{'through':_0x2e06('0x121')});db[_0x2e06('0x106')]['belongsToMany'](db[_0x2e06('0x131')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x49')],{'as':_0x2e06('0x132'),'through':'user_has_fax_accounts'});db[_0x2e06('0x106')][_0x2e06('0x11a')](db['MailAccount'],{'as':_0x2e06('0x133'),'through':'user_has_mail_accounts'});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x134')],{'as':_0x2e06('0x135'),'through':_0x2e06('0x136')});db['User'][_0x2e06('0x11a')](db[_0x2e06('0x51')],{'as':'SmsAccounts','through':_0x2e06('0x137')});db[_0x2e06('0x106')][_0x2e06('0x11a')](db[_0x2e06('0x138')],{'as':_0x2e06('0x139'),'through':'user_has_whatsapp_accounts'});db[_0x2e06('0x106')][_0x2e06('0x11a')](db['SquareProject'],{'as':_0x2e06('0x13a'),'through':_0x2e06('0x13b')});db['VoiceChanSpy'][_0x2e06('0x10a')](db[_0x2e06('0x16')],{'as':_0x2e06('0x13c'),'onDelete':'cascade','foreignKey':_0x2e06('0x13d')});db[_0x2e06('0x14')][_0x2e06('0x10a')](db[_0x2e06('0x16')],{'onDelete':_0x2e06('0x109')});db['VoiceExtension'][_0x2e06('0x10a')](db['VoiceExtension'],{'as':_0x2e06('0x13e'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x18')][_0x2e06('0x11a')](db['Sound'],{'as':_0x2e06('0x13f'),'through':_0x2e06('0x140')});db['VoiceQueue'][_0x2e06('0x10a')](db[_0x2e06('0x10c')],{'as':_0x2e06('0x141'),'foreignKey':'VoiceQueueId'});db[_0x2e06('0x1a')]['hasMany'](db[_0x2e06('0x6e')],{'as':'Hoppers','foreignKey':_0x2e06('0x142')});db['VoiceQueue']['hasMany'](db[_0x2e06('0x71')],{'as':_0x2e06('0x10e'),'foreignKey':_0x2e06('0x142')});db[_0x2e06('0x1a')][_0x2e06('0x10a')](db['CmHopperHistory'],{'as':_0x2e06('0x143'),'foreignKey':_0x2e06('0x142')});db[_0x2e06('0x1a')][_0x2e06('0x10a')](db[_0x2e06('0x10f')],{'as':_0x2e06('0x10f'),'foreignKey':'VoiceQueueId'});db[_0x2e06('0x1a')][_0x2e06('0x10a')](db[_0x2e06('0x6f')],{'as':_0x2e06('0x144'),'foreignKey':'VoiceQueueId'});db[_0x2e06('0x1a')][_0x2e06('0x10a')](db[_0x2e06('0xcf')],{'as':_0x2e06('0x145'),'foreignKey':_0x2e06('0x142')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0x2e06('0x2c'),'foreignKey':_0x2e06('0x146')});db[_0x2e06('0x1a')]['belongsTo'](db[_0x2e06('0x2c')],{'as':_0x2e06('0x147'),'foreignKey':_0x2e06('0x148')});db[_0x2e06('0x1a')]['belongsTo'](db[_0x2e06('0x7d')],{'as':_0x2e06('0x7d'),'foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0x2e06('0x149')],{'as':_0x2e06('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue']['belongsToMany'](db[_0x2e06('0xee')],{'as':_0x2e06('0x120'),'through':_0x2e06('0x14b')});db[_0x2e06('0x1a')][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x30')});db[_0x2e06('0x1a')][_0x2e06('0x11a')](db[_0x2e06('0x14d')],{'as':_0x2e06('0x14e'),'through':_0x2e06('0x14f')});db[_0x2e06('0x1a')][_0x2e06('0x11a')](db[_0x2e06('0xee')],{'as':_0x2e06('0x150'),'through':_0x2e06('0x151')});db[_0x2e06('0x1c')]['belongsTo'](db[_0x2e06('0x106')],{'as':_0x2e06('0x106'),'foreignKey':'UserId'});db[_0x2e06('0x1e')][_0x2e06('0x152')](db['User'],{'as':_0x2e06('0x106'),'foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x108')]['hasMany'](db[_0x2e06('0x21')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2e06('0x153'),'sourceKey':'mailbox'});db[_0x2e06('0x21')][_0x2e06('0x152')](db[_0x2e06('0x108')],{'foreignKey':_0x2e06('0x153'),'targetKey':_0x2e06('0x154')});db[_0x2e06('0x23')][_0x2e06('0x10a')](db[_0x2e06('0x28')],{'as':_0x2e06('0x155'),'foreignKey':_0x2e06('0x156'),'constraints':![]});db[_0x2e06('0x23')]['hasMany'](db[_0x2e06('0x157')],{'as':_0x2e06('0x158'),'foreignKey':_0x2e06('0x156'),'constraints':![]});db[_0x2e06('0x23')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':'User','foreignKey':'UserId'});db[_0x2e06('0x23')]['belongsTo'](db['CmContact'],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x3a')][_0x2e06('0x152')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerIn']['belongsTo'](db[_0x2e06('0x15b')],{'as':_0x2e06('0x15b'),'foreignKey':_0x2e06('0x15c'),'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x3b')][_0x2e06('0x152')](db[_0x2e06('0x3c')],{'as':_0x2e06('0x3c'),'foreignKey':_0x2e06('0x15e')});db[_0x2e06('0x3b')]['belongsTo'](db['CloudProvider'],{'as':_0x2e06('0x15b'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x2e06('0x3c')][_0x2e06('0x107')](db[_0x2e06('0x3a')],{'as':_0x2e06('0x15f'),'onDelete':_0x2e06('0x109')});db['MailAccount'][_0x2e06('0x107')](db[_0x2e06('0x3b')],{'as':_0x2e06('0x160'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x3c')][_0x2e06('0x10a')](db['Disposition'],{'as':_0x2e06('0x161'),'foreignKey':_0x2e06('0x15e'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x3c')][_0x2e06('0x10a')](db[_0x2e06('0x79')],{'as':_0x2e06('0x162'),'foreignKey':'MailAccountId'});db[_0x2e06('0x3c')][_0x2e06('0x10a')](db[_0x2e06('0x41')],{'as':_0x2e06('0x163'),'foreignKey':'MailAccountId'});db[_0x2e06('0x3c')][_0x2e06('0x10a')](db['MailInteraction'],{'as':_0x2e06('0x164')});db[_0x2e06('0x3c')]['hasMany'](db[_0x2e06('0x43')],{'as':_0x2e06('0x13e')});db['MailAccount']['belongsTo'](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x3c')]['belongsTo'](db[_0x2e06('0x86')],{'as':'Template','foreignKey':_0x2e06('0x167')});db[_0x2e06('0x3c')][_0x2e06('0x152')](db['Pause'],{'as':_0x2e06('0x14a'),'foreignKey':_0x2e06('0x168')});db[_0x2e06('0x3c')][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0x2e06('0x11a')](db['User'],{'as':_0x2e06('0x14c'),'through':'UserMailQueue'});db[_0x2e06('0x3d')]['belongsToMany'](db[_0x2e06('0x14d')],{'through':'team_has_mail_queues','as':_0x2e06('0x14e')});db[_0x2e06('0x3f')][_0x2e06('0x10a')](db['MailMessage'],{'as':'Messages','onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x169')});db[_0x2e06('0x3f')]['belongsTo'](db[_0x2e06('0x3c')],{'as':_0x2e06('0x16a'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x2e06('0x152')](db['CmContact'],{'as':_0x2e06('0x159'),'foreignKey':'ContactId'});db['MailInteraction'][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':_0x2e06('0x16b'),'foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x3f')][_0x2e06('0x11a')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x2e06('0x16c')});db[_0x2e06('0x3f')][_0x2e06('0x11a')](db['Tag'],{'through':_0x2e06('0x16d'),'as':_0x2e06('0x16e')});db['MailInteraction'][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':'Users','through':_0x2e06('0x123'),'foreignKey':_0x2e06('0x169')});db['MailMessage'][_0x2e06('0x10a')](db[_0x2e06('0xe5')],{'as':_0x2e06('0x16f'),'onDelete':'cascade'});db[_0x2e06('0x41')][_0x2e06('0x152')](db['User'],{'as':_0x2e06('0x106')});db['MailMessage'][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x159')});db['MailMessage'][_0x2e06('0x152')](db[_0x2e06('0x3f')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0x2e06('0x41')][_0x2e06('0x152')](db[_0x2e06('0x3c')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x15e')});db['MailMessage'][_0x2e06('0x152')](db[_0x2e06('0x131')],{'as':'ChatWebsite','foreignKey':_0x2e06('0x170')});db[_0x2e06('0x41')][_0x2e06('0x152')](db['ChatOfflineMessage'],{'as':_0x2e06('0x171'),'foreignKey':_0x2e06('0x172')});db['MailApplication'][_0x2e06('0x152')](db[_0x2e06('0x106')],{'onDelete':_0x2e06('0x15d')});db['MailApplication']['belongsTo'](db[_0x2e06('0x3d')],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x43')][_0x2e06('0x152')](db['MailAccount'],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x43')][_0x2e06('0x152')](db[_0x2e06('0x7d')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x173')});db[_0x2e06('0x43')][_0x2e06('0x152')](db[_0x2e06('0x174')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x175')});db['MailQueueReport'][_0x2e06('0x152')](db['MailAccount'],{});db[_0x2e06('0x45')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x45')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':'ContactId'});db[_0x2e06('0x45')][_0x2e06('0x152')](db[_0x2e06('0x3f')],{});db[_0x2e06('0x45')][_0x2e06('0x152')](db[_0x2e06('0x41')],{});db[_0x2e06('0x45')]['belongsTo'](db[_0x2e06('0x106')],{});db[_0x2e06('0x45')]['belongsTo'](db[_0x2e06('0x3d')],{});db[_0x2e06('0x47')]['hasMany'](db['DashboardItem'],{'as':_0x2e06('0x176'),'onDelete':'cascade'});db[_0x2e06('0x49')]['hasMany'](db[_0x2e06('0x7b')],{'as':'Dispositions','foreignKey':_0x2e06('0x177'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x49')][_0x2e06('0x10a')](db['CannedAnswer'],{'as':_0x2e06('0x162'),'foreignKey':'FaxAccountId'});db[_0x2e06('0x49')][_0x2e06('0x10a')](db[_0x2e06('0x114')],{'as':_0x2e06('0x164')});db[_0x2e06('0x49')][_0x2e06('0x10a')](db[_0x2e06('0x178')],{'as':_0x2e06('0x13e')});db['FaxAccount'][_0x2e06('0x10a')](db['VoiceExtension'],{'as':_0x2e06('0x179'),'onDelete':_0x2e06('0x109')});db['FaxAccount'][_0x2e06('0x10a')](db[_0x2e06('0x17a')],{'as':_0x2e06('0x163')});db[_0x2e06('0x49')][_0x2e06('0x152')](db[_0x2e06('0x2c')],{'as':_0x2e06('0x2c')});db[_0x2e06('0x49')]['belongsTo'](db[_0x2e06('0xee')],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0x2e06('0x152')](db[_0x2e06('0x149')],{'as':_0x2e06('0x14a'),'foreignKey':_0x2e06('0x168')});db[_0x2e06('0x49')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x2e06('0x17b')});db[_0x2e06('0x178')]['belongsTo'](db['User'],{'onDelete':_0x2e06('0x15d')});db['FaxApplication'][_0x2e06('0x152')](db[_0x2e06('0x4d')],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x178')][_0x2e06('0x152')](db[_0x2e06('0x49')],{'onDelete':'restrict'});db[_0x2e06('0x178')]['belongsTo'](db['Tag'],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x175')});db[_0x2e06('0x114')][_0x2e06('0x10a')](db[_0x2e06('0x17a')],{'as':'Messages','onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x17c')});db[_0x2e06('0x114')][_0x2e06('0x152')](db[_0x2e06('0x49')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x177')});db[_0x2e06('0x114')]['belongsTo'](db[_0x2e06('0x6c')],{'as':'Contact','foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x114')]['belongsTo'](db[_0x2e06('0x106')],{'as':'Owner','foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x114')][_0x2e06('0x11a')](db['Tag'],{'through':_0x2e06('0x17d'),'as':_0x2e06('0x16c')});db[_0x2e06('0x114')]['belongsToMany'](db[_0x2e06('0x174')],{'through':_0x2e06('0x17d'),'as':_0x2e06('0x16e')});db[_0x2e06('0x114')][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':'Users','through':_0x2e06('0x126'),'foreignKey':'FaxInteractionId'});db[_0x2e06('0x17a')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x106')});db[_0x2e06('0x17a')][_0x2e06('0x152')](db['FaxInteraction'],{'as':_0x2e06('0x17e'),'foreignKey':_0x2e06('0x17c')});db[_0x2e06('0x17a')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x159')});db['FaxMessage'][_0x2e06('0x152')](db[_0x2e06('0xe5')],{'as':_0x2e06('0xe5'),'foreignKey':'AttachmentId'});db[_0x2e06('0x17a')][_0x2e06('0x152')](db[_0x2e06('0x49')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x177')});db[_0x2e06('0x4d')][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':'Agents','through':_0x2e06('0x36')});db[_0x2e06('0x4d')]['belongsToMany'](db[_0x2e06('0x14d')],{'through':'team_has_fax_queues','as':_0x2e06('0x14e')});db[_0x2e06('0x4f')]['belongsTo'](db[_0x2e06('0x49')],{});db[_0x2e06('0x4f')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x4f')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x4f')][_0x2e06('0x152')](db['FaxInteraction'],{});db[_0x2e06('0x4f')][_0x2e06('0x152')](db['FaxMessage'],{});db[_0x2e06('0x4f')]['belongsTo'](db[_0x2e06('0x106')],{});db['FaxQueueReport'][_0x2e06('0x152')](db['FaxQueue'],{});db['SmsAccount'][_0x2e06('0x10a')](db[_0x2e06('0x7b')],{'as':'Dispositions','foreignKey':_0x2e06('0x17f'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x51')][_0x2e06('0x10a')](db['CannedAnswer'],{'as':_0x2e06('0x162'),'foreignKey':'SmsAccountId'});db[_0x2e06('0x51')]['hasMany'](db[_0x2e06('0x55')],{'as':_0x2e06('0x163'),'foreignKey':_0x2e06('0x17f')});db[_0x2e06('0x51')][_0x2e06('0x10a')](db[_0x2e06('0x53')],{'as':_0x2e06('0x164')});db['SmsAccount'][_0x2e06('0x10a')](db[_0x2e06('0x52')],{'as':_0x2e06('0x13e')});db[_0x2e06('0x51')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x51')]['belongsTo'](db['Pause'],{'as':_0x2e06('0x14a'),'foreignKey':_0x2e06('0x168')});db[_0x2e06('0x51')][_0x2e06('0x11a')](db['User'],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x137')});db[_0x2e06('0x52')][_0x2e06('0x152')](db['User'],{'onDelete':'restrict'});db[_0x2e06('0x52')]['belongsTo'](db[_0x2e06('0x12d')],{'onDelete':'restrict'});db[_0x2e06('0x52')]['belongsTo'](db[_0x2e06('0x51')],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x52')]['belongsTo'](db[_0x2e06('0x7d')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x173')});db[_0x2e06('0x52')][_0x2e06('0x152')](db[_0x2e06('0x174')],{'onDelete':_0x2e06('0x15d'),'foreignKey':'TagId'});db[_0x2e06('0x53')][_0x2e06('0x10a')](db[_0x2e06('0x55')],{'as':_0x2e06('0x163'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x180')});db['SmsInteraction'][_0x2e06('0x152')](db['SmsAccount'],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x17f')});db[_0x2e06('0x53')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x53')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':_0x2e06('0x16b'),'foreignKey':'UserId'});db['SmsInteraction']['belongsToMany'](db[_0x2e06('0x174')],{'through':_0x2e06('0x181'),'as':_0x2e06('0x16c')});db[_0x2e06('0x53')][_0x2e06('0x11a')](db['Tag'],{'through':_0x2e06('0x181'),'as':_0x2e06('0x16e')});db[_0x2e06('0x53')][_0x2e06('0x11a')](db['User'],{'as':'Users','through':_0x2e06('0x182'),'foreignKey':_0x2e06('0x180')});db['SmsMessage'][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':'User'});db[_0x2e06('0x55')]['belongsTo'](db[_0x2e06('0x6c')],{'onDelete':'cascade','as':_0x2e06('0x159')});db['SmsMessage']['belongsTo'](db['SmsInteraction'],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x17e'),'foreignKey':_0x2e06('0x180')});db[_0x2e06('0x55')][_0x2e06('0x152')](db['SmsAccount'],{'as':'Account','foreignKey':_0x2e06('0x17f')});db['SmsQueue'][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':'UserSmsQueue','foreignKey':_0x2e06('0x183')});db[_0x2e06('0x12d')][_0x2e06('0x11a')](db[_0x2e06('0x14d')],{'through':_0x2e06('0x184'),'as':'Teams'});db[_0x2e06('0x134')][_0x2e06('0x10a')](db[_0x2e06('0x7b')],{'as':_0x2e06('0x161'),'foreignKey':'OpenchannelAccountId','onDelete':_0x2e06('0x109')});db[_0x2e06('0x134')][_0x2e06('0x10a')](db[_0x2e06('0x79')],{'as':_0x2e06('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x2e06('0x134')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x2e06('0x164'),'foreignKey':_0x2e06('0x185')});db['OpenchannelAccount'][_0x2e06('0x10a')](db[_0x2e06('0x5b')],{'as':'Messages','foreignKey':_0x2e06('0x185')});db[_0x2e06('0x134')][_0x2e06('0x10a')](db['OpenchannelApplication'],{'as':_0x2e06('0x13e'),'foreignKey':_0x2e06('0x185')});db[_0x2e06('0x134')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x134')]['belongsTo'](db[_0x2e06('0x149')],{'as':_0x2e06('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount']['belongsToMany'](db['User'],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x136')});db['OpenchannelApplication'][_0x2e06('0x152')](db['User'],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x59')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x2e06('0x59')][_0x2e06('0x152')](db[_0x2e06('0x134')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x185')});db[_0x2e06('0x59')][_0x2e06('0x152')](db[_0x2e06('0x7d')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x173')});db[_0x2e06('0x59')][_0x2e06('0x152')](db['Tag'],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x175')});db[_0x2e06('0x110')][_0x2e06('0x10a')](db['OpenchannelMessage'],{'as':_0x2e06('0x163'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x186')});db[_0x2e06('0x110')][_0x2e06('0x152')](db[_0x2e06('0x134')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x185')});db['OpenchannelInteraction']['belongsTo'](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x110')][_0x2e06('0x152')](db['User'],{'as':_0x2e06('0x16b'),'foreignKey':_0x2e06('0x10b')});db['OpenchannelInteraction']['belongsToMany'](db[_0x2e06('0x174')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0x2e06('0x110')][_0x2e06('0x11a')](db[_0x2e06('0x174')],{'through':_0x2e06('0x187'),'as':_0x2e06('0x16e')});db[_0x2e06('0x110')]['belongsToMany'](db[_0x2e06('0x106')],{'as':_0x2e06('0x188'),'through':_0x2e06('0x127'),'foreignKey':'OpenchannelInteractionId'});db[_0x2e06('0x5b')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x106')});db[_0x2e06('0x5b')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'onDelete':'cascade','as':'Contact'});db[_0x2e06('0x5b')][_0x2e06('0x152')](db['OpenchannelInteraction'],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x17e'),'foreignKey':_0x2e06('0x186')});db[_0x2e06('0x5b')][_0x2e06('0x152')](db['Attachment'],{'as':_0x2e06('0xe5'),'foreignKey':_0x2e06('0x189')});db[_0x2e06('0x5b')]['belongsTo'](db[_0x2e06('0x134')],{'as':_0x2e06('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x39'),'foreignKey':_0x2e06('0x18a')});db[_0x2e06('0x5d')]['belongsToMany'](db['Team'],{'through':_0x2e06('0x18b'),'as':_0x2e06('0x14e')});db[_0x2e06('0x131')]['hasMany'](db[_0x2e06('0x7b')],{'as':_0x2e06('0x161'),'foreignKey':_0x2e06('0x170'),'onDelete':'cascade'});db['ChatWebsite'][_0x2e06('0x10a')](db[_0x2e06('0x79')],{'as':_0x2e06('0x162'),'foreignKey':_0x2e06('0x170')});db[_0x2e06('0x131')][_0x2e06('0x10a')](db[_0x2e06('0x68')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x2e06('0x10a')](db['ChatInteraction'],{'as':_0x2e06('0x164')});db[_0x2e06('0x131')][_0x2e06('0x10a')](db['ChatApplication'],{'as':_0x2e06('0x13e')});db['ChatWebsite']['hasMany'](db['ChatMessage'],{'as':_0x2e06('0x163')});db['ChatWebsite'][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db['ChatWebsite'][_0x2e06('0x152')](db[_0x2e06('0x7d')],{'as':_0x2e06('0x7d'),'foreignKey':'IntervalId'});db[_0x2e06('0x131')][_0x2e06('0x152')](db['MailAccount'],{'as':_0x2e06('0x3c'),'foreignKey':_0x2e06('0x15e')});db['ChatWebsite'][_0x2e06('0x152')](db[_0x2e06('0x149')],{'as':_0x2e06('0x14a'),'foreignKey':_0x2e06('0x168')});db['ChatWebsite'][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':'Agents','through':_0x2e06('0x18c')});db['OpenchannelQueueReport'][_0x2e06('0x152')](db[_0x2e06('0x134')],{});db[_0x2e06('0x60')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x60')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x60')]['belongsTo'](db[_0x2e06('0x110')],{});db[_0x2e06('0x60')][_0x2e06('0x152')](db[_0x2e06('0x5b')],{});db[_0x2e06('0x60')][_0x2e06('0x152')](db[_0x2e06('0x106')],{});db[_0x2e06('0x60')]['belongsTo'](db[_0x2e06('0x5d')],{});db[_0x2e06('0x62')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':'Agent','foreignKey':_0x2e06('0x10b'),'onDelete':'restrict'});db[_0x2e06('0x62')][_0x2e06('0x152')](db[_0x2e06('0x67')],{'as':_0x2e06('0x18d'),'foreignKey':_0x2e06('0x18e'),'onDelete':'restrict'});db[_0x2e06('0x62')][_0x2e06('0x152')](db[_0x2e06('0x131')],{'as':_0x2e06('0x18f'),'foreignKey':_0x2e06('0x170'),'onDelete':'restrict'});db[_0x2e06('0x62')][_0x2e06('0x152')](db[_0x2e06('0x174')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x175')});db['ChatInteraction'][_0x2e06('0x10a')](db[_0x2e06('0x65')],{'as':_0x2e06('0x163'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x190')});db[_0x2e06('0x124')][_0x2e06('0x152')](db['ChatWebsite'],{'as':_0x2e06('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x2e06('0x124')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x124')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':_0x2e06('0x16b'),'foreignKey':'UserId'});db[_0x2e06('0x124')][_0x2e06('0x11a')](db['Tag'],{'through':_0x2e06('0x191'),'as':_0x2e06('0x16c')});db[_0x2e06('0x124')][_0x2e06('0x11a')](db[_0x2e06('0x174')],{'through':_0x2e06('0x191'),'as':_0x2e06('0x16e')});db['ChatInteraction'][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x188'),'through':'user_has_chat_interactions','foreignKey':_0x2e06('0x190')});db[_0x2e06('0x65')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'onDelete':_0x2e06('0x109'),'as':'User'});db[_0x2e06('0x65')][_0x2e06('0x152')](db['CmContact'],{'onDelete':_0x2e06('0x109'),'as':'Contact','foreignKey':_0x2e06('0x15a')});db['ChatMessage'][_0x2e06('0x152')](db[_0x2e06('0x124')],{'onDelete':_0x2e06('0x109'),'as':'Interaction','foreignKey':_0x2e06('0x190')});db[_0x2e06('0x65')][_0x2e06('0x152')](db[_0x2e06('0xe5')],{'as':_0x2e06('0xe5'),'foreignKey':_0x2e06('0x189')});db[_0x2e06('0x65')]['belongsTo'](db[_0x2e06('0x131')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x170')});db[_0x2e06('0x171')][_0x2e06('0x10a')](db['Attachment'],{'as':'Attachments','foreignKey':_0x2e06('0x172'),'onDelete':_0x2e06('0x109'),'hooks':!![]});db[_0x2e06('0x171')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'onDelete':_0x2e06('0x109'),'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x171')][_0x2e06('0x152')](db[_0x2e06('0x131')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x170')});db[_0x2e06('0x67')]['belongsToMany'](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x32'),'hooks':!![]});db['ChatQueue'][_0x2e06('0x11a')](db['Team'],{'through':_0x2e06('0x192'),'as':_0x2e06('0x14e')});db[_0x2e06('0x11b')][_0x2e06('0x10a')](db[_0x2e06('0xc9')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x2e06('0x109')});db['ChatGroup']['belongsToMany'](db[_0x2e06('0x106')],{'as':_0x2e06('0x141'),'through':'chat_group_has_users'});db[_0x2e06('0x68')][_0x2e06('0x152')](db[_0x2e06('0x131')],{'as':_0x2e06('0x18f'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x2e06('0x10a')](db[_0x2e06('0x6c')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x2e06('0x6c')]['hasMany'](db['CmHopper'],{'as':_0x2e06('0x193'),'foreignKey':'ContactId'});db['CmContact'][_0x2e06('0x10a')](db[_0x2e06('0x71')],{'as':_0x2e06('0x10e'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x6c')][_0x2e06('0x10a')](db[_0x2e06('0x194')],{'as':'HopperHistories','foreignKey':'ContactId'});db['CmContact'][_0x2e06('0x10a')](db[_0x2e06('0x10f')],{'as':_0x2e06('0x10f'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x6c')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x2e06('0x6c')]['hasMany'](db[_0x2e06('0x110')],{'as':'OpenchannelInteractions','foreignKey':_0x2e06('0x15a'),'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x6c')][_0x2e06('0x10a')](db[_0x2e06('0x124')],{'as':_0x2e06('0x112'),'foreignKey':_0x2e06('0x15a'),'onDelete':'restrict'});db[_0x2e06('0x6c')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x2e06('0x15a'),'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x6c')][_0x2e06('0x10a')](db['FaxInteraction'],{'as':_0x2e06('0x115'),'foreignKey':'ContactId','onDelete':_0x2e06('0x15d')});db[_0x2e06('0x6c')][_0x2e06('0x10a')](db['MailInteraction'],{'as':_0x2e06('0x116'),'foreignKey':'ContactId','onDelete':_0x2e06('0x15d')});db[_0x2e06('0x6c')][_0x2e06('0x152')](db['CmCompany'],{'as':_0x2e06('0x195'),'foreignKey':_0x2e06('0x196')});db[_0x2e06('0x6c')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x6c')]['belongsToMany'](db[_0x2e06('0x106')],{'as':_0x2e06('0x188'),'through':_0x2e06('0x11f')});db[_0x2e06('0x6c')][_0x2e06('0x11a')](db['Tag'],{'as':_0x2e06('0x16c'),'through':_0x2e06('0x197')});db[_0x2e06('0x6c')][_0x2e06('0x11a')](db['Tag'],{'through':_0x2e06('0x197'),'as':_0x2e06('0x16e')});db[_0x2e06('0x6e')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':'Contact','foreignKey':_0x2e06('0x15a'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x6e')][_0x2e06('0x152')](db['CmList'],{'as':'List','foreignKey':_0x2e06('0x166'),'onDelete':'cascade'});db['CmHopper'][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':'Agent','foreignKey':_0x2e06('0x10b')});db[_0x2e06('0x6e')][_0x2e06('0x152')](db[_0x2e06('0x1a')],{'as':_0x2e06('0x18d'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x2e06('0x6e')][_0x2e06('0x152')](db[_0x2e06('0xe2')],{'as':'Campaign','foreignKey':_0x2e06('0x198'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x6e')][_0x2e06('0x152')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db[_0x2e06('0x6f')][_0x2e06('0x152')](db['CmContact'],{'as':_0x2e06('0x159'),'foreignKey':'ContactId','onDelete':_0x2e06('0x109')});db[_0x2e06('0x6f')][_0x2e06('0x152')](db['CmList'],{'as':'List','foreignKey':_0x2e06('0x166'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x6f')][_0x2e06('0x152')](db[_0x2e06('0x1a')],{'as':_0x2e06('0x18d'),'foreignKey':_0x2e06('0x142'),'onDelete':_0x2e06('0x109')});db['CmHopperBlack'][_0x2e06('0x152')](db[_0x2e06('0xe2')],{'as':_0x2e06('0xe2'),'foreignKey':_0x2e06('0x198'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0x77')]['hasMany'](db[_0x2e06('0x199')],{'as':{'plural':_0x2e06('0x19a'),'singular':_0x2e06('0x19b')},'foreignKey':_0x2e06('0x19c'),'onDelete':_0x2e06('0x109'),'hooks':!![]});db[_0x2e06('0x77')][_0x2e06('0x10a')](db[_0x2e06('0x199')],{'as':{'plural':_0x2e06('0x19d'),'singular':_0x2e06('0x19e')},'foreignKey':'AutomationAnyId','onDelete':_0x2e06('0x109'),'hooks':!![]});db[_0x2e06('0x77')][_0x2e06('0x10a')](db['Action'],{'as':_0x2e06('0x19f'),'foreignKey':_0x2e06('0x1a0'),'onDelete':_0x2e06('0x109'),'hooks':!![]});db[_0x2e06('0x7b')][_0x2e06('0x10a')](db[_0x2e06('0x7b')],{'as':_0x2e06('0x161'),'foreignKey':'ParentId','onDelete':_0x2e06('0x109')});db[_0x2e06('0x7d')][_0x2e06('0x10a')](db[_0x2e06('0x7d')],{'as':_0x2e06('0x1a1'),'foreignKey':_0x2e06('0x173'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x2e06('0x7d')][_0x2e06('0x10a')](db[_0x2e06('0x16')],{'as':_0x2e06('0x1a2'),'foreignKey':_0x2e06('0x173'),'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x7d')]['hasMany'](db[_0x2e06('0x43')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x2e06('0x7d')][_0x2e06('0x10a')](db[_0x2e06('0x62')],{'as':'ChatApplications','foreignKey':_0x2e06('0x173')});db[_0x2e06('0x7d')][_0x2e06('0x10a')](db[_0x2e06('0x178')],{'as':_0x2e06('0x1a3'),'foreignKey':_0x2e06('0x173')});db[_0x2e06('0x7d')]['hasMany'](db['SmsApplication'],{'as':_0x2e06('0x1a4'),'foreignKey':'IntervalId'});db[_0x2e06('0x83')][_0x2e06('0x152')](db[_0x2e06('0x3c')],{});db[_0x2e06('0x83')][_0x2e06('0x152')](db[_0x2e06('0x8f')],{'foreignKey':_0x2e06('0x1a5')});db[_0x2e06('0x83')][_0x2e06('0x152')](db[_0x2e06('0x1a6')],{'foreignKey':_0x2e06('0x1a7')});db[_0x2e06('0x1a8')]['belongsToMany'](db[_0x2e06('0x18')],{'as':_0x2e06('0x1a9'),'through':_0x2e06('0x140'),'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x174')][_0x2e06('0x11a')](db[_0x2e06('0x6c')],{'through':'cm_contact_has_tags'});db[_0x2e06('0x174')][_0x2e06('0x11a')](db[_0x2e06('0x124')],{'through':_0x2e06('0x191')});db[_0x2e06('0x174')][_0x2e06('0x11a')](db['MailInteraction'],{'through':_0x2e06('0x16d')});db[_0x2e06('0x174')]['belongsToMany'](db[_0x2e06('0x53')],{'through':_0x2e06('0x181')});db[_0x2e06('0x174')][_0x2e06('0x11a')](db['FaxInteraction'],{'through':_0x2e06('0x17d')});db[_0x2e06('0x174')][_0x2e06('0x11a')](db[_0x2e06('0x110')],{'through':_0x2e06('0x187')});db[_0x2e06('0x174')][_0x2e06('0x11a')](db[_0x2e06('0xf9')],{'through':'whatsapp_interaction_has_tags'});db['Trigger'][_0x2e06('0x10a')](db[_0x2e06('0x199')],{'as':{'plural':_0x2e06('0x1aa'),'singular':'AllCondition'},'foreignKey':_0x2e06('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x2e06('0x88')][_0x2e06('0x10a')](db[_0x2e06('0x199')],{'as':{'plural':'AnyConditions','singular':_0x2e06('0x1ac')},'foreignKey':_0x2e06('0x1ad'),'onDelete':_0x2e06('0x109'),'hooks':!![]});db[_0x2e06('0x88')][_0x2e06('0x10a')](db[_0x2e06('0x75')],{'as':'Actions','foreignKey':_0x2e06('0x1ae'),'onDelete':_0x2e06('0x109'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x2e06('0x94')],{'as':_0x2e06('0x1af'),'onDelete':'cascade','foreignKey':_0x2e06('0x1a7'),'hooks':!![]});db[_0x2e06('0x8f')][_0x2e06('0x10a')](db['AnalyticFieldReport'],{'as':_0x2e06('0x1af'),'onDelete':'cascade','foreignKey':_0x2e06('0x1a5')});db[_0x2e06('0x93')][_0x2e06('0x10a')](db[_0x2e06('0x94')],{'as':'Fields','onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b0')});db[_0x2e06('0x94')]['belongsTo'](db[_0x2e06('0x93')],{'foreignKey':_0x2e06('0x1b0')});db[_0x2e06('0x98')][_0x2e06('0x10a')](db[_0x2e06('0x9a')],{'as':'Configurations','onDelete':_0x2e06('0x109'),'foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0x2e06('0x9c')],{'as':'Subjects','onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0x9a')]['hasMany'](db['SalesforceField'],{'as':_0x2e06('0x1b2'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b3')});db['SalesforceConfiguration'][_0x2e06('0x10a')](db[_0x2e06('0x9c')],{'as':_0x2e06('0x1af'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0x9a')][_0x2e06('0x152')](db[_0x2e06('0x98')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x1b5')});db['SalesforceField'][_0x2e06('0x10a')](db[_0x2e06('0x9c')],{'as':_0x2e06('0x1b6'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0x9c')][_0x2e06('0x10a')](db['SalesforceField'],{'as':'Description','foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0x9c')]['hasMany'](db['SalesforceField'],{'as':_0x2e06('0x1b7'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0x9c')][_0x2e06('0x152')](db['Variable'],{'as':'Variable','foreignKey':_0x2e06('0x1b8')});db['SugarcrmAccount'][_0x2e06('0x10a')](db[_0x2e06('0x1b9')],{'as':'Configurations','onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0x1b9')][_0x2e06('0x10a')](db['SugarcrmField'],{'as':_0x2e06('0x1ba'),'onDelete':_0x2e06('0x109'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x2e06('0x10a')](db['SugarcrmField'],{'as':_0x2e06('0x1b2'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b3')});db['SugarcrmConfiguration'][_0x2e06('0x10a')](db[_0x2e06('0xa0')],{'as':_0x2e06('0x1af'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0x1b9')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x2e06('0x16a'),'foreignKey':'AccountId'});db[_0x2e06('0xa0')]['hasMany'](db[_0x2e06('0xa0')],{'as':_0x2e06('0x1b6'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0xa0')][_0x2e06('0x10a')](db['SugarcrmField'],{'as':_0x2e06('0x1bb'),'foreignKey':'DescriptionId'});db[_0x2e06('0xa0')][_0x2e06('0x10a')](db[_0x2e06('0xa0')],{'as':'Field','foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xa0')][_0x2e06('0x152')](db[_0x2e06('0x8a')],{'as':_0x2e06('0x8a'),'foreignKey':_0x2e06('0x1b8')});db[_0x2e06('0x1bc')][_0x2e06('0x10a')](db['DeskConfiguration'],{'as':_0x2e06('0x1bd'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xa1')][_0x2e06('0x10a')](db['DeskField'],{'as':_0x2e06('0x1ba'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b1')});db['DeskConfiguration'][_0x2e06('0x10a')](db[_0x2e06('0x1be')],{'as':_0x2e06('0x1b2'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xa1')][_0x2e06('0x10a')](db[_0x2e06('0x1be')],{'as':_0x2e06('0x1af'),'onDelete':_0x2e06('0x109'),'foreignKey':'FieldId'});db[_0x2e06('0xa1')][_0x2e06('0x152')](db[_0x2e06('0x1bc')],{'as':_0x2e06('0x16a'),'foreignKey':'AccountId'});db[_0x2e06('0xa1')][_0x2e06('0x11a')](db[_0x2e06('0x174')],{'through':_0x2e06('0x1bf')});db[_0x2e06('0x1be')][_0x2e06('0x10a')](db[_0x2e06('0x1be')],{'as':_0x2e06('0x1b6'),'foreignKey':'SubjectId'});db['DeskField'][_0x2e06('0x10a')](db[_0x2e06('0x1be')],{'as':_0x2e06('0x1bb'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0x1be')]['hasMany'](db['DeskField'],{'as':_0x2e06('0x1b7'),'foreignKey':_0x2e06('0x1b4')});db['DeskField'][_0x2e06('0x152')](db[_0x2e06('0x8a')],{'as':'Variable','foreignKey':_0x2e06('0x1b8')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0x2e06('0x1bd'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xa6')][_0x2e06('0x10a')](db[_0x2e06('0x1c0')],{'as':_0x2e06('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x2e06('0x10a')](db[_0x2e06('0x1c0')],{'as':_0x2e06('0x1b2'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xa6')]['hasMany'](db[_0x2e06('0x1c0')],{'as':_0x2e06('0x1af'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b4')});db['ZohoConfiguration'][_0x2e06('0x152')](db[_0x2e06('0xa4')],{'as':'Account','foreignKey':'AccountId'});db[_0x2e06('0x1c0')][_0x2e06('0x10a')](db[_0x2e06('0x1c0')],{'as':_0x2e06('0x1b6'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0x1c0')][_0x2e06('0x10a')](db['ZohoField'],{'as':'Description','foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0x1c0')][_0x2e06('0x10a')](db[_0x2e06('0x1c0')],{'as':'Field','foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0x1c0')]['belongsTo'](db[_0x2e06('0x8a')],{'as':'Variable','foreignKey':_0x2e06('0x1b8')});db[_0x2e06('0x1c1')][_0x2e06('0x10a')](db[_0x2e06('0xa9')],{'as':'Configurations','onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xa9')][_0x2e06('0x10a')](db[_0x2e06('0xab')],{'as':_0x2e06('0x1ba'),'foreignKey':_0x2e06('0x1b1')});db['ZendeskConfiguration'][_0x2e06('0x10a')](db['ZendeskField'],{'as':_0x2e06('0x1b2'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xa9')]['hasMany'](db[_0x2e06('0xab')],{'as':_0x2e06('0x1af'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xa9')][_0x2e06('0x152')](db[_0x2e06('0x1c1')],{'as':'Account','foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xa9')][_0x2e06('0x11a')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x2e06('0xab')][_0x2e06('0x10a')](db[_0x2e06('0xab')],{'as':_0x2e06('0x1b6'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0xab')][_0x2e06('0x10a')](db['ZendeskField'],{'as':_0x2e06('0x1bb'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xab')][_0x2e06('0x10a')](db[_0x2e06('0xab')],{'as':_0x2e06('0x1b7'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xab')][_0x2e06('0x152')](db[_0x2e06('0x8a')],{'as':'Variable','foreignKey':_0x2e06('0x1b8')});db[_0x2e06('0xad')]['hasMany'](db[_0x2e06('0xaf')],{'as':_0x2e06('0x1bd'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xaf')][_0x2e06('0x10a')](db[_0x2e06('0xb1')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0xaf')][_0x2e06('0x10a')](db[_0x2e06('0xb1')],{'as':_0x2e06('0x1b2'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xaf')]['hasMany'](db['FreshdeskField'],{'as':_0x2e06('0x1af'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xaf')][_0x2e06('0x152')](db[_0x2e06('0xad')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xaf')][_0x2e06('0x11a')](db[_0x2e06('0x174')],{'through':_0x2e06('0x1c2')});db[_0x2e06('0xb1')][_0x2e06('0x10a')](db[_0x2e06('0xb1')],{'as':'Subject','foreignKey':_0x2e06('0x1b1')});db['FreshdeskField'][_0x2e06('0x10a')](db[_0x2e06('0xb1')],{'as':_0x2e06('0x1bb'),'foreignKey':'DescriptionId'});db[_0x2e06('0xb1')][_0x2e06('0x10a')](db[_0x2e06('0xb1')],{'as':_0x2e06('0x1b7'),'foreignKey':'FieldId'});db[_0x2e06('0xb1')][_0x2e06('0x152')](db['Variable'],{'as':'Variable','foreignKey':_0x2e06('0x1b8')});db['VtigerAccount'][_0x2e06('0x10a')](db[_0x2e06('0x1c3')],{'as':_0x2e06('0x1bd'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0x1c3')][_0x2e06('0x10a')](db[_0x2e06('0x1c4')],{'as':'Subjects','foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0x1c3')][_0x2e06('0x10a')](db[_0x2e06('0x1c4')],{'as':_0x2e06('0x1b2'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x2e06('0x10a')](db[_0x2e06('0x1c4')],{'as':_0x2e06('0x1af'),'foreignKey':_0x2e06('0x1b4')});db['VtigerConfiguration'][_0x2e06('0x152')](db[_0x2e06('0xb3')],{'as':_0x2e06('0x16a'),'foreignKey':'AccountId'});db[_0x2e06('0x1c4')][_0x2e06('0x10a')](db[_0x2e06('0x1c4')],{'as':_0x2e06('0x1b6'),'foreignKey':_0x2e06('0x1b1')});db['VtigerField'][_0x2e06('0x10a')](db['VtigerField'],{'as':_0x2e06('0x1bb'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0x1c4')]['hasMany'](db['VtigerField'],{'as':_0x2e06('0x1b7'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0x1c4')][_0x2e06('0x152')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x2e06('0xb6')]['hasMany'](db[_0x2e06('0xb8')],{'as':_0x2e06('0x1bd'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xb8')]['hasMany'](db[_0x2e06('0xb9')],{'as':_0x2e06('0x1ba'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0xb8')][_0x2e06('0x10a')](db['ServicenowField'],{'as':_0x2e06('0x1b2'),'foreignKey':_0x2e06('0x1b3')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x2e06('0x1af'),'foreignKey':_0x2e06('0x1b4')});db['ServicenowConfiguration']['belongsTo'](db[_0x2e06('0xb6')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xb9')][_0x2e06('0x10a')](db['ServicenowField'],{'as':_0x2e06('0x1b6'),'foreignKey':'SubjectId'});db[_0x2e06('0xb9')][_0x2e06('0x10a')](db[_0x2e06('0xb9')],{'as':_0x2e06('0x1bb'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xb9')][_0x2e06('0x10a')](db['ServicenowField'],{'as':_0x2e06('0x1b7'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xb9')][_0x2e06('0x152')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['Dynamics365Account'][_0x2e06('0x10a')](db[_0x2e06('0xbd')],{'as':_0x2e06('0x1bd'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xbd')][_0x2e06('0x10a')](db['Dynamics365Field'],{'as':_0x2e06('0x1ba'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b1')});db['Dynamics365Configuration'][_0x2e06('0x10a')](db[_0x2e06('0xbf')],{'as':_0x2e06('0x1b2'),'onDelete':'cascade','foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xbd')]['hasMany'](db[_0x2e06('0xbf')],{'as':_0x2e06('0x1af'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x2e06('0x152')](db[_0x2e06('0xbb')],{'as':_0x2e06('0x16a'),'foreignKey':_0x2e06('0x1b5')});db['Dynamics365Field'][_0x2e06('0x10a')](db['Dynamics365Field'],{'as':_0x2e06('0x1b6'),'foreignKey':_0x2e06('0x1b1')});db['Dynamics365Field'][_0x2e06('0x10a')](db['Dynamics365Field'],{'as':_0x2e06('0x1bb'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xbf')][_0x2e06('0x10a')](db[_0x2e06('0xbf')],{'as':'Field','foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xbf')]['belongsTo'](db[_0x2e06('0x8a')],{'as':_0x2e06('0x8a'),'foreignKey':'VariableId'});db[_0x2e06('0x1c5')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x2e06('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2e06('0xc2')][_0x2e06('0x10a')](db[_0x2e06('0xc4')],{'as':_0x2e06('0x1ba'),'foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0xc2')][_0x2e06('0x10a')](db[_0x2e06('0xc4')],{'as':_0x2e06('0x1b2'),'foreignKey':_0x2e06('0x1b3')});db[_0x2e06('0xc2')][_0x2e06('0x10a')](db[_0x2e06('0xc4')],{'as':_0x2e06('0x1af'),'foreignKey':_0x2e06('0x1b4')});db[_0x2e06('0xc2')]['belongsTo'](db[_0x2e06('0x1c5')],{'as':'Account','foreignKey':_0x2e06('0x1b5')});db[_0x2e06('0xc4')][_0x2e06('0x10a')](db[_0x2e06('0xc4')],{'as':'Subject','foreignKey':_0x2e06('0x1b1')});db[_0x2e06('0xc4')][_0x2e06('0x10a')](db[_0x2e06('0xc4')],{'as':_0x2e06('0x1bb'),'foreignKey':'DescriptionId'});db[_0x2e06('0xc4')][_0x2e06('0x10a')](db[_0x2e06('0xc4')],{'as':_0x2e06('0x1b7'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x2e06('0x152')](db[_0x2e06('0x8a')],{'as':_0x2e06('0x8a'),'foreignKey':_0x2e06('0x1b8')});db[_0x2e06('0x1c6')][_0x2e06('0x152')](db[_0x2e06('0x131')],{});db[_0x2e06('0x1c6')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x1c6')][_0x2e06('0x152')](db['CmContact'],{'as':'Contact','foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x1c6')][_0x2e06('0x152')](db[_0x2e06('0x124')],{});db[_0x2e06('0x1c6')]['belongsTo'](db['ChatMessage'],{});db[_0x2e06('0x1c6')][_0x2e06('0x152')](db[_0x2e06('0x106')],{});db[_0x2e06('0x1c6')][_0x2e06('0x152')](db[_0x2e06('0x67')],{});db['ChatInternalMessage'][_0x2e06('0x152')](db['User'],{'onDelete':_0x2e06('0x109'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x2e06('0x152')](db[_0x2e06('0x106')],{'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1c7')});db[_0x2e06('0xcf')][_0x2e06('0x10a')](db[_0x2e06('0xcd')],{'foreignKey':_0x2e06('0x1c8'),'onDelete':_0x2e06('0x109')});db[_0x2e06('0xcf')][_0x2e06('0x10a')](db['JscriptyAnswerReport'],{'foreignKey':_0x2e06('0x1c8'),'onDelete':_0x2e06('0x109')});db['SmsQueueReport'][_0x2e06('0x152')](db[_0x2e06('0x51')],{});db['SmsQueueReport']['belongsTo'](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':'ListId'});db[_0x2e06('0xd0')][_0x2e06('0x152')](db['CmContact'],{'as':'Contact','foreignKey':_0x2e06('0x15a')});db[_0x2e06('0xd0')][_0x2e06('0x152')](db[_0x2e06('0x53')],{});db[_0x2e06('0xd0')][_0x2e06('0x152')](db[_0x2e06('0x55')],{});db[_0x2e06('0xd0')]['belongsTo'](db['User'],{});db['SmsQueueReport'][_0x2e06('0x152')](db[_0x2e06('0x12d')],{});db[_0x2e06('0xd6')][_0x2e06('0x10a')](db[_0x2e06('0xcf')],{'foreignKey':_0x2e06('0x1c9')});db[_0x2e06('0xd6')][_0x2e06('0x10a')](db[_0x2e06('0xcd')],{'foreignKey':_0x2e06('0x1c9')});db[_0x2e06('0xd6')][_0x2e06('0x10a')](db['JscriptyAnswerReport'],{'foreignKey':_0x2e06('0x1c9')});db[_0x2e06('0xdb')][_0x2e06('0x11a')](db['User'],{'as':_0x2e06('0x188'),'through':_0x2e06('0x13b')});db[_0x2e06('0x14d')]['belongsToMany'](db['User'],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x122')});db[_0x2e06('0x14d')][_0x2e06('0x11a')](db[_0x2e06('0x1a')],{'through':_0x2e06('0x14f'),'as':'VoiceQueues'});db['Team'][_0x2e06('0x11a')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x2e06('0x14d')][_0x2e06('0x11a')](db[_0x2e06('0x67')],{'through':_0x2e06('0x192'),'as':_0x2e06('0x12b')});db[_0x2e06('0x14d')][_0x2e06('0x11a')](db[_0x2e06('0x4d')],{'through':_0x2e06('0x1ca'),'as':_0x2e06('0x12c')});db[_0x2e06('0x14d')][_0x2e06('0x11a')](db[_0x2e06('0x12d')],{'through':_0x2e06('0x184'),'as':'SmsQueues'});db[_0x2e06('0x14d')][_0x2e06('0x11a')](db['OpenchannelQueue'],{'through':_0x2e06('0x18b'),'as':_0x2e06('0x12f')});db['Team'][_0x2e06('0x11a')](db[_0x2e06('0xff')],{'through':_0x2e06('0x1cb'),'as':_0x2e06('0x1cc')});db[_0x2e06('0x14d')][_0x2e06('0x11a')](db[_0x2e06('0x129')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x2e06('0xe2')][_0x2e06('0x10a')](db['CmHopper'],{'as':_0x2e06('0x193'),'foreignKey':_0x2e06('0x198')});db[_0x2e06('0xe2')]['hasMany'](db['CmHopperFinal'],{'as':_0x2e06('0x10e'),'foreignKey':_0x2e06('0x198')});db['Campaign']['hasMany'](db[_0x2e06('0x194')],{'as':_0x2e06('0x143'),'foreignKey':_0x2e06('0x198')});db['Campaign'][_0x2e06('0x10a')](db['CmHopperBlack'],{'as':_0x2e06('0x144'),'foreignKey':_0x2e06('0x198')});db[_0x2e06('0xe2')][_0x2e06('0x152')](db[_0x2e06('0x2c')],{'as':_0x2e06('0x2c'),'foreignKey':_0x2e06('0x146')});db[_0x2e06('0xe2')][_0x2e06('0x152')](db[_0x2e06('0x2c')],{'as':'TrunkBackup','foreignKey':_0x2e06('0x148')});db[_0x2e06('0xe2')][_0x2e06('0x152')](db[_0x2e06('0x7d')],{'as':_0x2e06('0x7d'),'foreignKey':_0x2e06('0x173')});db[_0x2e06('0xe2')][_0x2e06('0x152')](db[_0x2e06('0xdb')],{'as':_0x2e06('0xdb'),'foreignKey':_0x2e06('0x1cd')});db[_0x2e06('0xe2')][_0x2e06('0x11a')](db[_0x2e06('0xee')],{'as':_0x2e06('0x120'),'through':_0x2e06('0x1ce')});db['Campaign'][_0x2e06('0x11a')](db[_0x2e06('0xee')],{'as':_0x2e06('0x150'),'through':_0x2e06('0x1cf')});db[_0x2e06('0xe5')][_0x2e06('0x152')](db['ChatOfflineMessage'],{'as':_0x2e06('0x171'),'foreignKey':'ChatOfflineMessageId'});db[_0x2e06('0xe8')]['belongsTo'](db[_0x2e06('0x41')],{});db[_0x2e06('0xe8')][_0x2e06('0x152')](db[_0x2e06('0x3f')],{});db[_0x2e06('0xe8')]['belongsTo'](db[_0x2e06('0x3c')],{'foreignKey':_0x2e06('0x1d0'),'as':'FromAccount'});db[_0x2e06('0xe8')][_0x2e06('0x152')](db['User'],{'foreignKey':_0x2e06('0x1d1'),'as':'FromAgent'});db[_0x2e06('0xe8')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d2'),'as':_0x2e06('0x1d3')});db[_0x2e06('0xe8')][_0x2e06('0x152')](db[_0x2e06('0x3d')],{'foreignKey':_0x2e06('0x1d4'),'as':_0x2e06('0x1d5')});db[_0x2e06('0xe8')]['belongsTo'](db[_0x2e06('0x3c')],{'foreignKey':_0x2e06('0x1d6'),'as':_0x2e06('0x1d7')});db[_0x2e06('0x1d8')][_0x2e06('0x152')](db[_0x2e06('0x65')],{});db[_0x2e06('0x1d8')][_0x2e06('0x152')](db[_0x2e06('0x124')],{});db[_0x2e06('0x1d8')]['belongsTo'](db[_0x2e06('0x131')],{'foreignKey':_0x2e06('0x1d9'),'as':'FromAccount'});db[_0x2e06('0x1d8')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d1'),'as':_0x2e06('0x1da')});db['ChatTransferReport'][_0x2e06('0x152')](db['User'],{'foreignKey':_0x2e06('0x1d2'),'as':_0x2e06('0x1d3')});db[_0x2e06('0x1d8')][_0x2e06('0x152')](db['ChatQueue'],{'foreignKey':_0x2e06('0x1db'),'as':'ToQueue'});db['ChatTransferReport'][_0x2e06('0x152')](db[_0x2e06('0x131')],{'foreignKey':'ToChatWebsiteId','as':_0x2e06('0x1d7')});db[_0x2e06('0xea')][_0x2e06('0x152')](db[_0x2e06('0x17a')],{});db[_0x2e06('0xea')][_0x2e06('0x152')](db[_0x2e06('0x114')],{});db[_0x2e06('0xea')]['belongsTo'](db[_0x2e06('0x49')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db[_0x2e06('0xea')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d1'),'as':_0x2e06('0x1da')});db[_0x2e06('0xea')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d2'),'as':_0x2e06('0x1d3')});db[_0x2e06('0xea')][_0x2e06('0x152')](db[_0x2e06('0x4d')],{'foreignKey':_0x2e06('0x1dc'),'as':'ToQueue'});db[_0x2e06('0xea')]['belongsTo'](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0x2e06('0x1d7')});db[_0x2e06('0x1dd')][_0x2e06('0x152')](db[_0x2e06('0x5b')],{});db[_0x2e06('0x1dd')][_0x2e06('0x152')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x2e06('0x152')](db[_0x2e06('0x134')],{'foreignKey':_0x2e06('0x1de'),'as':_0x2e06('0x1df')});db['OpenchannelTransferReport'][_0x2e06('0x152')](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d1'),'as':_0x2e06('0x1da')});db[_0x2e06('0x1dd')]['belongsTo'](db[_0x2e06('0x106')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x2e06('0x1dd')][_0x2e06('0x152')](db[_0x2e06('0x5d')],{'foreignKey':_0x2e06('0x1e0'),'as':_0x2e06('0x1d5')});db[_0x2e06('0x1dd')][_0x2e06('0x152')](db[_0x2e06('0x134')],{'foreignKey':_0x2e06('0x1e1'),'as':_0x2e06('0x1d7')});db[_0x2e06('0xec')][_0x2e06('0x152')](db[_0x2e06('0x55')],{});db[_0x2e06('0xec')][_0x2e06('0x152')](db[_0x2e06('0x53')],{});db[_0x2e06('0xec')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db['SmsTransferReport'][_0x2e06('0x152')](db['User'],{'foreignKey':_0x2e06('0x1d1'),'as':'FromAgent'});db[_0x2e06('0xec')]['belongsTo'](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d2'),'as':_0x2e06('0x1d3')});db['SmsTransferReport'][_0x2e06('0x152')](db['SmsQueue'],{'foreignKey':_0x2e06('0x1e2'),'as':_0x2e06('0x1d5')});db[_0x2e06('0xec')]['belongsTo'](db[_0x2e06('0x51')],{'foreignKey':_0x2e06('0x1e3'),'as':_0x2e06('0x1d7')});db[_0x2e06('0xee')][_0x2e06('0x10a')](db[_0x2e06('0x7b')],{'as':_0x2e06('0x161'),'foreignKey':_0x2e06('0x166'),'onDelete':'cascade'});db[_0x2e06('0xee')][_0x2e06('0x10a')](db[_0x2e06('0x74')],{'as':'CustomFields','foreignKey':_0x2e06('0x166')});db[_0x2e06('0xee')][_0x2e06('0x10a')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x11e'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0xee')][_0x2e06('0x10a')](db[_0x2e06('0x71')],{'as':_0x2e06('0x10e'),'foreignKey':'ListId'});db[_0x2e06('0xee')][_0x2e06('0x10a')](db['CmHopperHistory'],{'as':_0x2e06('0x1e4'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0xee')][_0x2e06('0x10a')](db[_0x2e06('0x10f')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x2e06('0xee')][_0x2e06('0x11a')](db[_0x2e06('0x1a')],{'as':_0x2e06('0x1e5'),'through':_0x2e06('0x14b')});db[_0x2e06('0xee')][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x121')});db[_0x2e06('0x129')][_0x2e06('0x10a')](db[_0x2e06('0x16')],{'as':_0x2e06('0x1a2'),'onDelete':_0x2e06('0x109')});db['VoicePrefix'][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':'Agents','through':'UserVoicePrefix'});db[_0x2e06('0x129')][_0x2e06('0x11a')](db['Team'],{'through':_0x2e06('0x102'),'as':'Teams'});db[_0x2e06('0xf0')][_0x2e06('0x10a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x188'),'foreignKey':_0x2e06('0x119')});db['UserProfile'][_0x2e06('0x10a')](db[_0x2e06('0xf2')],{'as':_0x2e06('0x1e6'),'foreignKey':'userProfileId','onDelete':_0x2e06('0x109')});db[_0x2e06('0xf2')][_0x2e06('0x10a')](db['UserProfileResource'],{'as':_0x2e06('0x1e7'),'foreignKey':_0x2e06('0x1e8'),'onDelete':_0x2e06('0x109')});db['WhatsappAccount']['hasMany'](db[_0x2e06('0x7b')],{'as':_0x2e06('0x161'),'foreignKey':'WhatsappAccountId','onDelete':_0x2e06('0x109')});db[_0x2e06('0x138')]['hasMany'](db[_0x2e06('0x79')],{'as':_0x2e06('0x162'),'foreignKey':'WhatsappAccountId'});db[_0x2e06('0x138')][_0x2e06('0x10a')](db['WhatsappMessage'],{'as':_0x2e06('0x163'),'foreignKey':_0x2e06('0x1e9')});db[_0x2e06('0x138')][_0x2e06('0x10a')](db[_0x2e06('0xf9')],{'as':'Interactions'});db['WhatsappAccount'][_0x2e06('0x10a')](db[_0x2e06('0x1ea')],{'as':'Applications'});db[_0x2e06('0x138')][_0x2e06('0x152')](db[_0x2e06('0xee')],{'as':_0x2e06('0x165'),'foreignKey':_0x2e06('0x166')});db[_0x2e06('0x138')][_0x2e06('0x152')](db[_0x2e06('0x149')],{'as':_0x2e06('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':'user_has_whatsapp_accounts'});db[_0x2e06('0x1ea')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x1ea')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x1ea')][_0x2e06('0x152')](db['WhatsappAccount'],{'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x1ea')][_0x2e06('0x152')](db[_0x2e06('0x7d')],{'onDelete':_0x2e06('0x15d'),'foreignKey':_0x2e06('0x173')});db[_0x2e06('0x1ea')][_0x2e06('0x152')](db[_0x2e06('0x174')],{'onDelete':_0x2e06('0x15d'),'foreignKey':'TagId'});db[_0x2e06('0xf9')][_0x2e06('0x10a')](db[_0x2e06('0xfb')],{'as':_0x2e06('0x163'),'onDelete':_0x2e06('0x109'),'foreignKey':_0x2e06('0x1eb')});db[_0x2e06('0xf9')]['belongsTo'](db[_0x2e06('0x138')],{'as':'Account','foreignKey':_0x2e06('0x1e9')});db[_0x2e06('0xf9')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':'ContactId'});db[_0x2e06('0xf9')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':_0x2e06('0x16b'),'foreignKey':_0x2e06('0x10b')});db[_0x2e06('0xf9')][_0x2e06('0x11a')](db['Tag'],{'through':_0x2e06('0x1ec'),'as':'Tags'});db[_0x2e06('0xf9')]['belongsToMany'](db[_0x2e06('0x174')],{'through':_0x2e06('0x1ec'),'as':'ThroughTags'});db[_0x2e06('0xf9')][_0x2e06('0x11a')](db[_0x2e06('0x106')],{'as':_0x2e06('0x188'),'through':_0x2e06('0x1ed'),'foreignKey':'WhatsappInteractionId'});db[_0x2e06('0xfb')][_0x2e06('0x152')](db[_0x2e06('0x106')],{'as':_0x2e06('0x106')});db[_0x2e06('0xfb')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'onDelete':'cascade','as':_0x2e06('0x159')});db['WhatsappMessage'][_0x2e06('0x152')](db[_0x2e06('0xf9')],{'onDelete':'cascade','as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0x2e06('0xfb')][_0x2e06('0x152')](db[_0x2e06('0x138')],{'as':_0x2e06('0x16a'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport']['belongsTo'](db['WhatsappAccount'],{});db[_0x2e06('0x1ee')]['belongsTo'](db[_0x2e06('0xee')],{'as':'List','foreignKey':_0x2e06('0x166')});db[_0x2e06('0x1ee')][_0x2e06('0x152')](db[_0x2e06('0x6c')],{'as':_0x2e06('0x159'),'foreignKey':_0x2e06('0x15a')});db[_0x2e06('0x1ee')][_0x2e06('0x152')](db[_0x2e06('0xf9')],{});db[_0x2e06('0x1ee')][_0x2e06('0x152')](db['WhatsappQueue'],{});db[_0x2e06('0x1ee')]['belongsTo'](db['WhatsappMessage'],{});db[_0x2e06('0x1ee')][_0x2e06('0x152')](db[_0x2e06('0x106')],{});db[_0x2e06('0xfd')][_0x2e06('0x152')](db[_0x2e06('0xfb')],{});db[_0x2e06('0xfd')][_0x2e06('0x152')](db[_0x2e06('0xf9')],{});db[_0x2e06('0xfd')][_0x2e06('0x152')](db[_0x2e06('0x138')],{'foreignKey':_0x2e06('0x1ef'),'as':_0x2e06('0x1df')});db['WhatsappTransferReport'][_0x2e06('0x152')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0x2e06('0x1d7')});db[_0x2e06('0xfd')][_0x2e06('0x152')](db[_0x2e06('0xff')],{'foreignKey':_0x2e06('0x1f0'),'as':_0x2e06('0x1d5')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x2e06('0x1da')});db[_0x2e06('0xfd')]['belongsTo'](db[_0x2e06('0x106')],{'foreignKey':_0x2e06('0x1d2'),'as':'ToAgent'});db[_0x2e06('0xff')]['belongsToMany'](db[_0x2e06('0x106')],{'as':_0x2e06('0x14c'),'through':_0x2e06('0x130'),'foreignKey':_0x2e06('0x1f1')});db[_0x2e06('0xff')]['belongsToMany'](db[_0x2e06('0x14d')],{'through':_0x2e06('0x1cb'),'as':_0x2e06('0x14e')});db[_0x2e06('0x15b')][_0x2e06('0x107')](db[_0x2e06('0x3a')],{'as':_0x2e06('0x15f'),'onDelete':_0x2e06('0x15d')});db[_0x2e06('0x15b')]['hasOne'](db[_0x2e06('0x3b')],{'as':_0x2e06('0x160'),'onDelete':'restrict'});module[_0x2e06('0x1f2')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbe48=['JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','belongsTo','belongsToMany','Groups','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','UserMailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','VoiceRecording','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','Dispositions','CannedAnswer','Answers','Messages','Interactions','MailApplication','List','TemplateId','Agents','MailQueue','team_has_mail_queues','Account','Contact','Owner','mail_interaction_has_tags','MailInteractionId','ChatWebsiteId','TagId','ListId','DashboardItem','Items','FaxAccountId','FaxInteractionId','Tags','ThroughTags','Users','Interaction','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','IntervalId','SmsMessage','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','ChatApplication','user_has_chat_websites','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','Agent','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticDefaultReport','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','FieldId','AccountId','Subject','DescriptionId','Field','Variable','VariableId','Description','Descriptions','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Account','FreshsalesField','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','WhatsappQueue','team_has_whatsapp_queues','VoicePrefixes','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','HopperHistory','Queues','Extensions','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','../config/environment','sequelize','lodash','jstz','determine','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','defaultsDeep','sequelizeHistory','username','password','database','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmHopper','../api/cmHopper/cmHopper.model','../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','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','IntegrationReport','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xbe48,0x121));var _0x8be4=function(_0x1e9658,_0x131c1a){_0x1e9658=_0x1e9658-0x0;var _0x26fa44=_0xbe48[_0x1e9658];return _0x26fa44;};'use strict';var config=require(_0x8be4('0x0'));var Sequelize=require(_0x8be4('0x1'));var _=require(_0x8be4('0x2'));var jstz=require(_0x8be4('0x3'));var timezone=jstz[_0x8be4('0x4')]();config['sequelize']=_['defaultsDeep'](config[_0x8be4('0x1')],{'database':_0x8be4('0x5'),'username':'xcall','password':_0x8be4('0x6'),'options':{'host':_0x8be4('0x7'),'port':0xcea,'dialect':_0x8be4('0x8'),'dialectOptions':{'charset':_0x8be4('0x9')},'logging':![],'timezone':timezone[_0x8be4('0xa')](),'define':{'charset':_0x8be4('0xb'),'collate':_0x8be4('0xc')}}});config['sequelizeHistory']=_[_0x8be4('0xd')](config[_0x8be4('0xe')],{'database':'motion2','username':'xcall','password':_0x8be4('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8be4('0x9')},'logging':![],'timezone':timezone[_0x8be4('0xa')](),'define':{'charset':_0x8be4('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x8be4('0x1')][_0x8be4('0xf')],config[_0x8be4('0x1')][_0x8be4('0x10')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8be4('0xe')][_0x8be4('0x11')],config[_0x8be4('0xe')][_0x8be4('0xf')],config['sequelizeHistory'][_0x8be4('0x10')],config['sequelizeHistory'][_0x8be4('0x12')])};db[_0x8be4('0x13')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x15'));db[_0x8be4('0x16')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x17'));db[_0x8be4('0x18')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x19'));db[_0x8be4('0x1a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x1b'));db[_0x8be4('0x1c')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x1d'));db[_0x8be4('0x1e')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x1f'));db['VoiceRecording']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x8be4('0x20')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x21'));db['VoiceMail']=db[_0x8be4('0x1')]['import'](_0x8be4('0x22'));db['VoiceMailMessage']=db[_0x8be4('0x1')]['import'](_0x8be4('0x23'));db[_0x8be4('0x24')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/voiceCallReport/voiceCallReport.model');db[_0x8be4('0x25')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x26'));db[_0x8be4('0x27')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x28'));db[_0x8be4('0x29')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x2a'));db[_0x8be4('0x2b')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x2c'));db[_0x8be4('0x2d')]=db['sequelize']['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db[_0x8be4('0x1')]['import'](_0x8be4('0x2e'));db[_0x8be4('0x2f')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8be4('0x30')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x31'));db['UserChatQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x8be4('0x32')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x33'));db['UserSmsQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x8be4('0x34')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x35'));db[_0x8be4('0x36')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x37'));db[_0x8be4('0x38')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x39'));db['MailServerOut']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x3a'));db[_0x8be4('0x3b')]=db['sequelize'][_0x8be4('0x14')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x3c'));db['MailSubstatus']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x3d'));db[_0x8be4('0x3e')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x3f'));db[_0x8be4('0x40')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x41'));db['MailApplication']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x42'));db[_0x8be4('0x43')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x44'));db[_0x8be4('0x45')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x46'));db['DashboardItem']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x47'));db[_0x8be4('0x48')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x49'));db[_0x8be4('0x4a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x4b'));db[_0x8be4('0x4c')]=db['sequelize']['import'](_0x8be4('0x4d'));db[_0x8be4('0x4e')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x4f'));db[_0x8be4('0x50')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x51'));db[_0x8be4('0x52')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x53'));db[_0x8be4('0x54')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x55'));db[_0x8be4('0x56')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x57'));db['SmsInteraction']=db['sequelize'][_0x8be4('0x14')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/smsMessage/smsMessage.model');db[_0x8be4('0x58')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/smsQueue/smsQueue.model');db[_0x8be4('0x59')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0x8be4('0x5a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x5b'));db[_0x8be4('0x5c')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x5d'));db[_0x8be4('0x5e')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x5f'));db[_0x8be4('0x60')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x61'));db[_0x8be4('0x62')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x8be4('0x63')]=db['sequelize'][_0x8be4('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x8be4('0x1')]['import'](_0x8be4('0x64'));db[_0x8be4('0x65')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x66'));db['ChatMessage']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x67'));db[_0x8be4('0x68')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x69'));db[_0x8be4('0x6a')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x6b'));db[_0x8be4('0x6c')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x6d'));db[_0x8be4('0x6e')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x6f'));db['CmContact']=db['sequelize'][_0x8be4('0x14')]('../api/cmContact/cmContact.model');db[_0x8be4('0x70')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x71'));db['CmHopperBlack']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x72'));db[_0x8be4('0x73')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x74'));db[_0x8be4('0x75')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x76'));db[_0x8be4('0x77')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x78'));db[_0x8be4('0x79')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x7a'));db[_0x8be4('0x7b')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x7c'));db[_0x8be4('0x7d')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x7e'));db['CannedAnswer']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x7f'));db[_0x8be4('0x80')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x81'));db[_0x8be4('0x82')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x83'));db[_0x8be4('0x84')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x85'));db[_0x8be4('0x86')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x87'));db['Cdr']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x88'));db[_0x8be4('0x89')]=db[_0x8be4('0x1')]['import'](_0x8be4('0x8a'));db['Schedule']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x8b'));db[_0x8be4('0x8c')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x8d'));db[_0x8be4('0x8e')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x8f'));db[_0x8be4('0x90')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x91'));db[_0x8be4('0x92')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x93'));db['Variable']=db[_0x8be4('0x1')]['import'](_0x8be4('0x94'));db['Integration']=db['sequelize'][_0x8be4('0x14')]('../api/integration/integration.model');db[_0x8be4('0x95')]=db[_0x8be4('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x8be4('0x96')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x97'));db[_0x8be4('0x98')]=db['sequelize'][_0x8be4('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0x8be4('0x99')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x9a'));db[_0x8be4('0x9b')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x9c'));db[_0x8be4('0x9d')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x9e'));db[_0x8be4('0x9f')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xa0'));db[_0x8be4('0xa1')]=db[_0x8be4('0x1')]['import'](_0x8be4('0xa2'));db[_0x8be4('0xa3')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xa4'));db[_0x8be4('0xa5')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x8be4('0xa6')]=db[_0x8be4('0x1')]['import'](_0x8be4('0xa7'));db[_0x8be4('0xa8')]=db[_0x8be4('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x8be4('0xa9')]=db[_0x8be4('0x1')]['import'](_0x8be4('0xaa'));db[_0x8be4('0xab')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xac'));db[_0x8be4('0xad')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xae'));db['ZohoConfiguration']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xaf'));db[_0x8be4('0xb0')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xb1'));db[_0x8be4('0xb2')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x8be4('0xb3')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xb4'));db[_0x8be4('0xb5')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xb6'));db[_0x8be4('0xb7')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x8be4('0xb8')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xb9'));db[_0x8be4('0xba')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xbb'));db[_0x8be4('0xbc')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x8be4('0xbd')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xbe'));db[_0x8be4('0xbf')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/intVtigerField/intVtigerField.model');db[_0x8be4('0xc0')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xc1'));db[_0x8be4('0xc2')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xc3'));db['ServicenowField']=db[_0x8be4('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xc4'));db[_0x8be4('0xc5')]=db['sequelize'][_0x8be4('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x8be4('0xc6')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xc7'));db[_0x8be4('0xc8')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xc9'));db[_0x8be4('0xca')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xcb'));db['FreshsalesField']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xcc'));db[_0x8be4('0xcd')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xce'));db[_0x8be4('0xcf')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/network/network.model');db['ChatQueueReport']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xd0'));db[_0x8be4('0xd1')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xd2'));db[_0x8be4('0xd3')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xd4'));db['JscriptyQuestionReport']=db['sequelize']['import'](_0x8be4('0xd5'));db['JscriptySessionReport']=db[_0x8be4('0x1')]['import'](_0x8be4('0xd6'));db[_0x8be4('0xd7')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xd8'));db[_0x8be4('0xd9')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xda'));db['SquareDetailsReport']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/squareReportDetail/squareReportDetail.model');db[_0x8be4('0xdb')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x8be4('0xdc')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xdd'));db[_0x8be4('0xde')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xdf'));db[_0x8be4('0xe0')]=db[_0x8be4('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x8be4('0xe1')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/squareMessage/squareMessage.model');db[_0x8be4('0xe2')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe3'));db[_0x8be4('0xe4')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe5'));db[_0x8be4('0xe6')]=db['sequelize']['import'](_0x8be4('0xe7'));db['Migration']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe8'));db['Attachment']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xe9'));db[_0x8be4('0xea')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xeb'));db['MailTransferReport']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xec'));db[_0x8be4('0xed')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xee'));db[_0x8be4('0xef')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf0'));db['OpenchannelTransferReport']=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf1'));db[_0x8be4('0xf2')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf3'));db[_0x8be4('0xf4')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/cmList/cmList.model');db[_0x8be4('0xf5')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x8be4('0xf6')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0xf7'));db['UserProfileSection']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xf8'));db['UserProfileResource']=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x8be4('0xf9')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xfa'));db[_0x8be4('0xfb')]=db[_0x8be4('0x1')][_0x8be4('0x14')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xfc'));db[_0x8be4('0xfd')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0xfe'));db[_0x8be4('0xff')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x100'));db[_0x8be4('0x101')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x102'));db[_0x8be4('0x103')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x8be4('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x8be4('0x104')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x105'));db['TeamVoiceQueue']=db[_0x8be4('0x1')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x8be4('0x106')]=db[_0x8be4('0x1')][_0x8be4('0x14')](_0x8be4('0x107'));db[_0x8be4('0x108')]=db['sequelize'][_0x8be4('0x14')](_0x8be4('0x109'));db[_0x8be4('0x13')][_0x8be4('0x10a')](db[_0x8be4('0x10b')],{'as':_0x8be4('0x10b'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db['VoiceRecording'],{'as':_0x8be4('0x10f'),'foreignKey':'UserId'});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0x2f')],{'as':_0x8be4('0x110'),'foreignKey':_0x8be4('0x10d')});db['User'][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'as':'Extensions','onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':'HopperHistory','foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db['ReportAgentPreview'],{'as':_0x8be4('0x77'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x8be4('0x112'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0x65')],{'as':_0x8be4('0x113'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')]['hasMany'](db[_0x8be4('0x114')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x8be4('0x13')]['hasMany'](db[_0x8be4('0x4c')],{'as':_0x8be4('0x115'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db['MailInteraction'],{'as':_0x8be4('0x116'),'foreignKey':'UserId'});db['User'][_0x8be4('0x10e')](db[_0x8be4('0xfd')],{'as':_0x8be4('0x117'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x13')][_0x8be4('0x10e')](db[_0x8be4('0xf9')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x8be4('0x13')][_0x8be4('0x118')](db[_0x8be4('0xf6')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x8be4('0x119')](db[_0x8be4('0x6a')],{'as':_0x8be4('0x11a'),'through':'chat_group_has_users'});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0x11b')],{'as':_0x8be4('0x11c'),'through':_0x8be4('0x11d')});db[_0x8be4('0x13')][_0x8be4('0x119')](db['CmList'],{'as':_0x8be4('0x11e'),'through':_0x8be4('0x11f')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x120')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x3e')],{'as':_0x8be4('0x116'),'through':_0x8be4('0x121')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x65')],{'as':_0x8be4('0x113'),'through':_0x8be4('0x122')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x4c')],{'as':_0x8be4('0x115'),'through':_0x8be4('0x123')});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0x114')],{'as':_0x8be4('0x124'),'through':_0x8be4('0x125')});db['User'][_0x8be4('0x119')](db[_0x8be4('0x5c')],{'as':_0x8be4('0x112'),'through':_0x8be4('0x126')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xfd')],{'as':'WhatsappInteractions','through':_0x8be4('0x127')});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0x1e')],{'as':'VoiceQueues','through':_0x8be4('0x30'),'required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xf5')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db['MailQueue'],{'as':_0x8be4('0x128'),'through':_0x8be4('0x129'),'required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x12a')],{'as':_0x8be4('0x12b'),'through':_0x8be4('0x12c'),'required':![],'hooks':!![]});db[_0x8be4('0x13')]['belongsToMany'](db['FaxQueue'],{'as':_0x8be4('0x12d'),'through':_0x8be4('0x32'),'required':![]});db[_0x8be4('0x13')]['belongsToMany'](db['SmsQueue'],{'as':_0x8be4('0x12e'),'through':'UserSmsQueue','required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x60')],{'as':_0x8be4('0x12f'),'through':_0x8be4('0x34'),'required':![]});db[_0x8be4('0x13')][_0x8be4('0x119')](db['WhatsappQueue'],{'as':_0x8be4('0x130'),'through':_0x8be4('0x36'),'required':![]});db[_0x8be4('0x13')]['belongsToMany'](db[_0x8be4('0xf4')],{'through':'cm_user_has_lists'});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x62')],{'as':_0x8be4('0x131'),'through':'user_has_chat_websites'});db[_0x8be4('0x13')]['belongsToMany'](db['FaxAccount'],{'as':_0x8be4('0x132'),'through':_0x8be4('0x133')});db['User'][_0x8be4('0x119')](db['MailAccount'],{'as':_0x8be4('0x134'),'through':_0x8be4('0x135')});db['User'][_0x8be4('0x119')](db[_0x8be4('0x59')],{'as':_0x8be4('0x136'),'through':'user_has_openchannel_accounts'});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x54')],{'as':'SmsAccounts','through':_0x8be4('0x137')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0xfb')],{'as':_0x8be4('0x138'),'through':_0x8be4('0x139')});db[_0x8be4('0x13')][_0x8be4('0x119')](db[_0x8be4('0x13a')],{'as':_0x8be4('0x13b'),'through':_0x8be4('0x13c')});db['VoiceChanSpy'][_0x8be4('0x10e')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x8be4('0x13d')});db[_0x8be4('0x18')][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x1a')]['hasMany'](db[_0x8be4('0x1a')],{'as':_0x8be4('0x13e'),'onDelete':_0x8be4('0x10c')});db['VoiceMusicOnHold'][_0x8be4('0x119')](db[_0x8be4('0x8c')],{'as':'Sounds','through':'moh_has_sounds'});db[_0x8be4('0x1e')][_0x8be4('0x10e')](db[_0x8be4('0x2f')],{'as':_0x8be4('0x13f'),'foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')]['hasMany'](db[_0x8be4('0x70')],{'as':_0x8be4('0x141'),'foreignKey':'VoiceQueueId'});db[_0x8be4('0x1e')]['hasMany'](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':_0x8be4('0x142'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x8be4('0x10e')](db[_0x8be4('0x77')],{'as':_0x8be4('0x77'),'foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')][_0x8be4('0x10e')](db[_0x8be4('0x143')],{'as':'HopperBlacks','foreignKey':_0x8be4('0x140')});db[_0x8be4('0x1e')]['hasMany'](db['JscriptySessionReport'],{'as':_0x8be4('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x8be4('0x145')});db[_0x8be4('0x1e')][_0x8be4('0x118')](db[_0x8be4('0x2d')],{'as':_0x8be4('0x146'),'foreignKey':_0x8be4('0x147')});db['VoiceQueue'][_0x8be4('0x118')](db[_0x8be4('0x84')],{'as':_0x8be4('0x84'),'foreignKey':'IntervalId'});db[_0x8be4('0x1e')][_0x8be4('0x118')](db['Pause'],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db['VoiceQueue'][_0x8be4('0x119')](db[_0x8be4('0xf4')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x8be4('0x1e')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x8be4('0x1e')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'as':_0x8be4('0x14a'),'through':_0x8be4('0x14b')});db[_0x8be4('0x1e')][_0x8be4('0x119')](db['CmList'],{'as':'BlackLists','through':_0x8be4('0x14c')});db[_0x8be4('0x14d')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x13'),'foreignKey':_0x8be4('0x10d')});db['ScreenRecording'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x13'),'foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x10b')][_0x8be4('0x10e')](db[_0x8be4('0x14e')],{'as':'Messages','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x14f'),'sourceKey':_0x8be4('0x150')});db[_0x8be4('0x14e')][_0x8be4('0x118')](db[_0x8be4('0x10b')],{'foreignKey':_0x8be4('0x14f'),'targetKey':_0x8be4('0x150')});db[_0x8be4('0x24')][_0x8be4('0x10e')](db[_0x8be4('0x29')],{'as':_0x8be4('0x151'),'foreignKey':_0x8be4('0x152'),'constraints':![]});db['VoiceCallReport'][_0x8be4('0x10e')](db[_0x8be4('0x27')],{'as':_0x8be4('0x153'),'foreignKey':_0x8be4('0x152'),'constraints':![]});db['VoiceCallReport'][_0x8be4('0x118')](db['User'],{'as':_0x8be4('0x13'),'foreignKey':'UserId'});db[_0x8be4('0x24')][_0x8be4('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x38')][_0x8be4('0x118')](db['MailAccount'],{'as':_0x8be4('0x3b'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x38')][_0x8be4('0x118')](db[_0x8be4('0x104')],{'as':_0x8be4('0x104'),'foreignKey':_0x8be4('0x156'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x158')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':'MailAccount','foreignKey':_0x8be4('0x155')});db[_0x8be4('0x158')][_0x8be4('0x118')](db[_0x8be4('0x104')],{'as':_0x8be4('0x104'),'foreignKey':_0x8be4('0x156'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x3b')][_0x8be4('0x10a')](db[_0x8be4('0x38')],{'as':_0x8be4('0x159'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x3b')]['hasOne'](db[_0x8be4('0x158')],{'as':'Smtp','onDelete':'cascade'});db[_0x8be4('0x3b')]['hasMany'](db[_0x8be4('0x80')],{'as':_0x8be4('0x15a'),'foreignKey':'MailAccountId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x3b')][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':'MailAccountId'});db[_0x8be4('0x3b')][_0x8be4('0x10e')](db[_0x8be4('0x40')],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x3b')]['hasMany'](db[_0x8be4('0x3e')],{'as':_0x8be4('0x15e')});db['MailAccount'][_0x8be4('0x10e')](db[_0x8be4('0x15f')],{'as':_0x8be4('0x13e')});db[_0x8be4('0x3b')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0x3b')][_0x8be4('0x118')](db[_0x8be4('0x90')],{'as':_0x8be4('0x90'),'foreignKey':_0x8be4('0x161')});db['MailAccount'][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8be4('0x3b')]['belongsToMany'](db['User'],{'as':_0x8be4('0x162'),'through':_0x8be4('0x135')});db[_0x8be4('0x163')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x129')});db[_0x8be4('0x163')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x164'),'as':_0x8be4('0x14a')});db[_0x8be4('0x3e')][_0x8be4('0x10e')](db[_0x8be4('0x40')],{'as':_0x8be4('0x15d'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x8be4('0x3e')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x3e')][_0x8be4('0x118')](db['CmContact'],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db['MailInteraction'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':'UserId'});db[_0x8be4('0x3e')][_0x8be4('0x119')](db['Tag'],{'through':_0x8be4('0x168'),'as':'Tags'});db[_0x8be4('0x3e')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x168'),'as':'ThroughTags'});db[_0x8be4('0x3e')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x8be4('0x169')});db[_0x8be4('0x40')][_0x8be4('0x10e')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x13')});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':'cascade','as':_0x8be4('0x166')});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x3e')],{'as':'Interaction','foreignKey':_0x8be4('0x169')});db['MailMessage'][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':_0x8be4('0x165'),'foreignKey':'MailAccountId'});db[_0x8be4('0x40')][_0x8be4('0x118')](db[_0x8be4('0x62')],{'as':_0x8be4('0x62'),'foreignKey':_0x8be4('0x16a')});db[_0x8be4('0x40')]['belongsTo'](db[_0x8be4('0x68')],{'as':_0x8be4('0x68'),'foreignKey':'ChatOfflineMessageId'});db[_0x8be4('0x15f')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x157')});db['MailApplication']['belongsTo'](db[_0x8be4('0x163')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x15f')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x15f')][_0x8be4('0x118')](db[_0x8be4('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x8be4('0x15f')][_0x8be4('0x118')](db['Tag'],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x16b')});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x3e')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x40')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db[_0x8be4('0x13')],{});db[_0x8be4('0x43')][_0x8be4('0x118')](db['MailQueue'],{});db[_0x8be4('0x45')][_0x8be4('0x10e')](db[_0x8be4('0x16d')],{'as':_0x8be4('0x16e'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8be4('0x16f'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db['CannedAnswer'],{'as':_0x8be4('0x15c'),'foreignKey':'FaxAccountId'});db[_0x8be4('0x48')][_0x8be4('0x10e')](db[_0x8be4('0x4c')],{'as':'Interactions'});db[_0x8be4('0x48')][_0x8be4('0x10e')](db[_0x8be4('0x4a')],{'as':_0x8be4('0x13e')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'as':'Exntensions','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x48')][_0x8be4('0x10e')](db['FaxMessage'],{'as':_0x8be4('0x15d')});db[_0x8be4('0x48')]['belongsTo'](db[_0x8be4('0x2d')],{'as':_0x8be4('0x2d')});db[_0x8be4('0x48')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db['FaxAccount'][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db[_0x8be4('0x48')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x133')});db[_0x8be4('0x4a')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x4a')][_0x8be4('0x118')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x8be4('0x4a')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0x8be4('0x118')](db['Tag'],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x16b')});db[_0x8be4('0x4c')][_0x8be4('0x10e')](db[_0x8be4('0x4e')],{'as':_0x8be4('0x15d'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x170')});db[_0x8be4('0x4c')]['belongsTo'](db[_0x8be4('0x48')],{'as':_0x8be4('0x165'),'foreignKey':'FaxAccountId'});db[_0x8be4('0x4c')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db['FaxInteraction'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':'UserId'});db['FaxInteraction'][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':'fax_interaction_has_tags','as':_0x8be4('0x171')});db['FaxInteraction'][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':'fax_interaction_has_tags','as':_0x8be4('0x172')});db[_0x8be4('0x4c')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x123'),'foreignKey':_0x8be4('0x170')});db['FaxMessage'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x10c'),'as':'User'});db[_0x8be4('0x4e')][_0x8be4('0x118')](db[_0x8be4('0x4c')],{'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x170')});db[_0x8be4('0x4e')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166')});db['FaxMessage'][_0x8be4('0x118')](db[_0x8be4('0x175')],{'as':_0x8be4('0x175'),'foreignKey':_0x8be4('0x176')});db[_0x8be4('0x4e')]['belongsTo'](db[_0x8be4('0x48')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x16f')});db[_0x8be4('0x50')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':'UserFaxQueue'});db[_0x8be4('0x50')]['belongsToMany'](db[_0x8be4('0xe2')],{'through':_0x8be4('0x177'),'as':_0x8be4('0x14a')});db[_0x8be4('0x52')]['belongsTo'](db[_0x8be4('0x48')],{});db[_0x8be4('0x52')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db['FaxQueueReport'][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x52')]['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db[_0x8be4('0x52')]['belongsTo'](db['User'],{});db[_0x8be4('0x52')][_0x8be4('0x118')](db['FaxQueue'],{});db[_0x8be4('0x54')]['hasMany'](db[_0x8be4('0x80')],{'as':_0x8be4('0x15a'),'foreignKey':_0x8be4('0x178'),'onDelete':_0x8be4('0x10c')});db['SmsAccount'][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x178')});db[_0x8be4('0x54')][_0x8be4('0x10e')](db['SmsMessage'],{'as':_0x8be4('0x15d'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x8be4('0x15e')});db[_0x8be4('0x54')][_0x8be4('0x10e')](db[_0x8be4('0x56')],{'as':_0x8be4('0x13e')});db[_0x8be4('0x54')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0x54')][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db[_0x8be4('0x54')]['belongsToMany'](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x137')});db[_0x8be4('0x56')]['belongsTo'](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x157')});db['SmsApplication'][_0x8be4('0x118')](db[_0x8be4('0x58')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x56')]['belongsTo'](db[_0x8be4('0x54')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x56')][_0x8be4('0x118')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x8be4('0x179')});db[_0x8be4('0x56')][_0x8be4('0x118')](db[_0x8be4('0x8e')],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x16b')});db[_0x8be4('0x114')]['hasMany'](db[_0x8be4('0x17a')],{'as':'Messages','onDelete':_0x8be4('0x10c'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x8be4('0x118')](db['SmsAccount'],{'as':_0x8be4('0x165'),'foreignKey':'SmsAccountId'});db[_0x8be4('0x114')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x114')][_0x8be4('0x118')](db['User'],{'as':_0x8be4('0x167'),'foreignKey':_0x8be4('0x10d')});db['SmsInteraction'][_0x8be4('0x119')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8be4('0x171')});db[_0x8be4('0x114')][_0x8be4('0x119')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x8be4('0x172')});db['SmsInteraction'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x125'),'foreignKey':_0x8be4('0x17b')});db[_0x8be4('0x17a')]['belongsTo'](db[_0x8be4('0x13')],{'as':_0x8be4('0x13')});db[_0x8be4('0x17a')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':'Contact'});db[_0x8be4('0x17a')][_0x8be4('0x118')](db['SmsInteraction'],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x17b')});db[_0x8be4('0x17a')]['belongsTo'](db[_0x8be4('0x54')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x178')});db[_0x8be4('0x58')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x17c'),'foreignKey':_0x8be4('0x17d')});db[_0x8be4('0x58')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x17e'),'as':_0x8be4('0x14a')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db[_0x8be4('0x80')],{'as':_0x8be4('0x15a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db['OpenchannelInteraction'],{'as':_0x8be4('0x15e'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x59')]['hasMany'](db[_0x8be4('0x5e')],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x59')][_0x8be4('0x10e')](db[_0x8be4('0x5a')],{'as':_0x8be4('0x13e'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x8be4('0x118')](db['CmList'],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x59')]['belongsTo'](db[_0x8be4('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x8be4('0x149')});db['OpenchannelAccount'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x180')});db[_0x8be4('0x5a')][_0x8be4('0x118')](db['User'],{'onDelete':'restrict'});db[_0x8be4('0x5a')][_0x8be4('0x118')](db[_0x8be4('0x60')],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x181')});db[_0x8be4('0x5a')][_0x8be4('0x118')](db['OpenchannelAccount'],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x17f')});db['OpenchannelApplication'][_0x8be4('0x118')](db[_0x8be4('0x84')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x8be4('0x118')](db[_0x8be4('0x8e')],{'onDelete':_0x8be4('0x157'),'foreignKey':'TagId'});db[_0x8be4('0x5c')][_0x8be4('0x10e')](db[_0x8be4('0x5e')],{'as':_0x8be4('0x15d'),'onDelete':_0x8be4('0x10c'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db[_0x8be4('0x59')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x17f')});db[_0x8be4('0x5c')]['belongsTo'](db['CmContact'],{'as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x5c')]['belongsTo'](db[_0x8be4('0x13')],{'as':'Owner','foreignKey':_0x8be4('0x10d')});db['OpenchannelInteraction'][_0x8be4('0x119')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x8be4('0x171')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8be4('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0x8be4('0x172')});db[_0x8be4('0x5c')]['belongsToMany'](db[_0x8be4('0x13')],{'as':'Users','through':_0x8be4('0x126'),'foreignKey':_0x8be4('0x182')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x13')});db['OpenchannelMessage'][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db['OpenchannelInteraction'],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x182')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db[_0x8be4('0x175')],{'as':_0x8be4('0x175'),'foreignKey':_0x8be4('0x176')});db[_0x8be4('0x5e')][_0x8be4('0x118')](db[_0x8be4('0x59')],{'as':'Account','foreignKey':_0x8be4('0x17f')});db['OpenchannelQueue']['belongsToMany'](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':'UserOpenchannelQueue','foreignKey':_0x8be4('0x181')});db['OpenchannelQueue'][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x183'),'as':_0x8be4('0x14a')});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0x8be4('0x15a'),'foreignKey':_0x8be4('0x16a'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x62')][_0x8be4('0x10e')](db['CannedAnswer'],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x16a')});db[_0x8be4('0x62')][_0x8be4('0x10e')](db[_0x8be4('0x6c')],{'as':_0x8be4('0x184')});db[_0x8be4('0x62')][_0x8be4('0x10e')](db[_0x8be4('0x65')],{'as':_0x8be4('0x15e')});db['ChatWebsite']['hasMany'](db[_0x8be4('0x185')],{'as':'Applications'});db['ChatWebsite'][_0x8be4('0x10e')](db['ChatMessage'],{'as':_0x8be4('0x15d')});db[_0x8be4('0x62')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x62')]['belongsTo'](db[_0x8be4('0x84')],{'as':'Interval','foreignKey':_0x8be4('0x179')});db[_0x8be4('0x62')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{'as':_0x8be4('0x3b'),'foreignKey':_0x8be4('0x155')});db[_0x8be4('0x62')]['belongsTo'](db[_0x8be4('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x8be4('0x149')});db[_0x8be4('0x62')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x186')});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0x59')],{});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':'Contact','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x63')][_0x8be4('0x118')](db['OpenchannelInteraction'],{});db[_0x8be4('0x63')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x8be4('0x63')]['belongsTo'](db[_0x8be4('0x13')],{});db[_0x8be4('0x63')][_0x8be4('0x118')](db[_0x8be4('0x60')],{});db['ChatApplication'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':'Agent','foreignKey':_0x8be4('0x10d'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x185')]['belongsTo'](db[_0x8be4('0x12a')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x8be4('0x157')});db['ChatApplication'][_0x8be4('0x118')](db[_0x8be4('0x62')],{'as':_0x8be4('0x187'),'foreignKey':_0x8be4('0x16a'),'onDelete':'restrict'});db[_0x8be4('0x185')][_0x8be4('0x118')](db['Tag'],{'onDelete':_0x8be4('0x157'),'foreignKey':'TagId'});db[_0x8be4('0x65')]['hasMany'](db[_0x8be4('0x188')],{'as':'Messages','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x189')});db[_0x8be4('0x65')][_0x8be4('0x118')](db['ChatWebsite'],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x16a')});db[_0x8be4('0x65')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x65')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8be4('0x10d')});db[_0x8be4('0x65')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x18a'),'as':'Tags'});db[_0x8be4('0x65')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x18a'),'as':'ThroughTags'});db[_0x8be4('0x65')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x122'),'foreignKey':'ChatInteractionId'});db[_0x8be4('0x188')]['belongsTo'](db[_0x8be4('0x13')],{'onDelete':'cascade','as':'User'});db['ChatMessage'][_0x8be4('0x118')](db['CmContact'],{'onDelete':'cascade','as':_0x8be4('0x166'),'foreignKey':'ContactId'});db[_0x8be4('0x188')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':_0x8be4('0x189')});db[_0x8be4('0x188')][_0x8be4('0x118')](db[_0x8be4('0x175')],{'as':'Attachment','foreignKey':_0x8be4('0x176')});db[_0x8be4('0x188')]['belongsTo'](db[_0x8be4('0x62')],{'as':_0x8be4('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x8be4('0x68')][_0x8be4('0x10e')](db[_0x8be4('0x175')],{'as':_0x8be4('0x18b'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0x8be4('0x68')]['belongsTo'](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x68')][_0x8be4('0x118')](db[_0x8be4('0x62')],{'as':_0x8be4('0x165'),'foreignKey':'ChatWebsiteId'});db[_0x8be4('0x12a')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x12c'),'hooks':!![]});db['ChatQueue'][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x18c'),'as':_0x8be4('0x14a')});db['ChatGroup'][_0x8be4('0x10e')](db['ChatInternalMessage'],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x18d'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x6a')][_0x8be4('0x119')](db['User'],{'as':_0x8be4('0x13f'),'through':'chat_group_has_users'});db[_0x8be4('0x6c')]['belongsTo'](db['ChatWebsite'],{'as':_0x8be4('0x187'),'foreignKey':_0x8be4('0x16a')});db['CmCompany']['hasMany'](db[_0x8be4('0x11b')],{'as':_0x8be4('0x11c'),'foreignKey':_0x8be4('0x18e')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x70')],{'as':'Hoppers','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db['CmHopperHistory'],{'as':_0x8be4('0x142'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x77')],{'as':_0x8be4('0x77'),'foreignKey':_0x8be4('0x154')});db['CmContact'][_0x8be4('0x10e')](db[_0x8be4('0x18f')],{'as':'JscriptySessions','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db['OpenchannelInteraction'],{'as':_0x8be4('0x112'),'foreignKey':'ContactId','onDelete':_0x8be4('0x157')});db['CmContact'][_0x8be4('0x10e')](db[_0x8be4('0x65')],{'as':_0x8be4('0x113'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x114')],{'as':_0x8be4('0x124'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x157')});db['CmContact'][_0x8be4('0x10e')](db[_0x8be4('0x4c')],{'as':_0x8be4('0x115'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x11b')][_0x8be4('0x10e')](db[_0x8be4('0x3e')],{'as':_0x8be4('0x116'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x8be4('0x118')](db[_0x8be4('0x6e')],{'as':_0x8be4('0x190'),'foreignKey':_0x8be4('0x18e')});db['CmContact']['belongsTo'](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x11b')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x8be4('0x11b')]['belongsToMany'](db[_0x8be4('0x8e')],{'as':_0x8be4('0x171'),'through':_0x8be4('0x191')});db[_0x8be4('0x11b')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x191'),'as':_0x8be4('0x172')});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':'Contact','foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c'),'onDelete':'cascade'});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x192'),'foreignKey':_0x8be4('0x10d')});db['CmHopper'][_0x8be4('0x118')](db[_0x8be4('0x1e')],{'as':_0x8be4('0x193'),'foreignKey':_0x8be4('0x140'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x70')][_0x8be4('0x118')](db[_0x8be4('0xe6')],{'as':_0x8be4('0xe6'),'foreignKey':_0x8be4('0x194'),'onDelete':'cascade'});db[_0x8be4('0x70')]['belongsTo'](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':_0x8be4('0x195')});db[_0x8be4('0x143')][_0x8be4('0x118')](db['CmContact'],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x143')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x143')][_0x8be4('0x118')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x8be4('0x140'),'onDelete':_0x8be4('0x10c')});db['CmHopperBlack'][_0x8be4('0x118')](db[_0x8be4('0xe6')],{'as':_0x8be4('0xe6'),'foreignKey':'CampaignId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x7d')][_0x8be4('0x10e')](db['Condition'],{'as':{'plural':_0x8be4('0x196'),'singular':_0x8be4('0x197')},'foreignKey':_0x8be4('0x198'),'onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x7d')][_0x8be4('0x10e')](db[_0x8be4('0x82')],{'as':{'plural':'Any','singular':_0x8be4('0x199')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x8be4('0x7d')]['hasMany'](db[_0x8be4('0x7b')],{'as':_0x8be4('0x19a'),'foreignKey':_0x8be4('0x19b'),'onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x80')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x8be4('0x10c')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db[_0x8be4('0x84')],{'as':_0x8be4('0x19c'),'foreignKey':'IntervalId','onDelete':_0x8be4('0x10c'),'hooks':!![],'required':![]});db[_0x8be4('0x84')][_0x8be4('0x10e')](db[_0x8be4('0x1a')],{'as':'Extensions','foreignKey':_0x8be4('0x179'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x84')]['hasMany'](db[_0x8be4('0x15f')],{'as':_0x8be4('0x19d'),'foreignKey':_0x8be4('0x179')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db['ChatApplication'],{'as':_0x8be4('0x19e'),'foreignKey':_0x8be4('0x179')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x8be4('0x179')});db[_0x8be4('0x84')][_0x8be4('0x10e')](db[_0x8be4('0x56')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x8be4('0x19f')][_0x8be4('0x118')](db[_0x8be4('0x3b')],{});db[_0x8be4('0x19f')][_0x8be4('0x118')](db['AnalyticDefaultReport'],{'foreignKey':_0x8be4('0x1a0')});db[_0x8be4('0x19f')][_0x8be4('0x118')](db[_0x8be4('0x96')],{'foreignKey':_0x8be4('0x1a1')});db[_0x8be4('0x8c')][_0x8be4('0x119')](db[_0x8be4('0x1c')],{'as':_0x8be4('0x1a2'),'through':_0x8be4('0x1a3'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0x11b')],{'through':_0x8be4('0x191')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0x65')],{'through':_0x8be4('0x18a')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0x3e')],{'through':_0x8be4('0x168')});db[_0x8be4('0x8e')][_0x8be4('0x119')](db['SmsInteraction'],{'through':_0x8be4('0x1a4')});db[_0x8be4('0x8e')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x8be4('0x8e')]['belongsToMany'](db[_0x8be4('0x5c')],{'through':'openchannel_interaction_has_tags'});db[_0x8be4('0x8e')][_0x8be4('0x119')](db[_0x8be4('0xfd')],{'through':_0x8be4('0x1a5')});db[_0x8be4('0x92')][_0x8be4('0x10e')](db[_0x8be4('0x82')],{'as':{'plural':_0x8be4('0x1a6'),'singular':_0x8be4('0x1a7')},'foreignKey':_0x8be4('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0x8be4('0x92')][_0x8be4('0x10e')](db[_0x8be4('0x82')],{'as':{'plural':_0x8be4('0x1a9'),'singular':_0x8be4('0x1aa')},'foreignKey':_0x8be4('0x1ab'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x8be4('0x10e')](db['Action'],{'as':_0x8be4('0x19a'),'foreignKey':'TriggerId','onDelete':_0x8be4('0x10c'),'hooks':!![]});db[_0x8be4('0x96')][_0x8be4('0x10e')](db[_0x8be4('0x99')],{'as':_0x8be4('0x1ac'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x8be4('0x1ad')][_0x8be4('0x10e')](db[_0x8be4('0x99')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1a0')});db[_0x8be4('0x1ae')][_0x8be4('0x10e')](db[_0x8be4('0x99')],{'as':_0x8be4('0x1ac'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1af')});db[_0x8be4('0x99')][_0x8be4('0x118')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x8be4('0x9d')][_0x8be4('0x10e')](db['SalesforceConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x8be4('0x10e')](db['SalesforceField'],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b2')});db['SalesforceConfiguration']['hasMany'](db[_0x8be4('0xa1')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x8be4('0x9f')][_0x8be4('0x10e')](db[_0x8be4('0xa1')],{'as':_0x8be4('0x1ac'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0x9f')]['belongsTo'](db['SalesforceAccount'],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa1')]['hasMany'](db[_0x8be4('0xa1')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xa1')][_0x8be4('0x10e')](db[_0x8be4('0xa1')],{'as':'Description','foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xa1')][_0x8be4('0x10e')](db[_0x8be4('0xa1')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db['SalesforceField'][_0x8be4('0x118')](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0xa3')][_0x8be4('0x10e')](db['SugarcrmConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':'AccountId'});db[_0x8be4('0xa5')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1b1'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xa5')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':'Descriptions','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xa5')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1ac'),'onDelete':_0x8be4('0x10c'),'foreignKey':'FieldId'});db[_0x8be4('0xa5')]['belongsTo'](db[_0x8be4('0xa3')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa6')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db['SugarcrmField']['hasMany'](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xa6')][_0x8be4('0x10e')](db[_0x8be4('0xa6')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xa6')]['belongsTo'](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db['DeskAccount'][_0x8be4('0x10e')](db[_0x8be4('0xa9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa9')][_0x8be4('0x10e')](db['DeskField'],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':'DescriptionId'});db[_0x8be4('0xa9')][_0x8be4('0x10e')](db[_0x8be4('0xab')],{'as':_0x8be4('0x1ac'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b3')});db['DeskConfiguration']['belongsTo'](db[_0x8be4('0xa8')],{'as':'Account','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xa9')]['belongsToMany'](db[_0x8be4('0x8e')],{'through':'int_desk_configuration_has_tags'});db[_0x8be4('0xab')]['hasMany'](db['DeskField'],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db[_0x8be4('0xab')][_0x8be4('0x10e')](db[_0x8be4('0xab')],{'as':'Description','foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xab')][_0x8be4('0x10e')](db[_0x8be4('0xab')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xab')][_0x8be4('0x118')](db[_0x8be4('0x1b8')],{'as':_0x8be4('0x1b8'),'foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0xad')]['hasMany'](db['ZohoConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':'SubjectId'});db[_0x8be4('0x1bc')][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b6')});db['ZohoConfiguration'][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':'FieldId'});db[_0x8be4('0x1bc')]['belongsTo'](db[_0x8be4('0xad')],{'as':'Account','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb0')]['hasMany'](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db[_0x8be4('0xb0')][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x8be4('0x10e')](db[_0x8be4('0xb0')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db['ZohoField']['belongsTo'](db[_0x8be4('0x1b8')],{'as':_0x8be4('0x1b8'),'foreignKey':'VariableId'});db[_0x8be4('0xb2')][_0x8be4('0x10e')](db[_0x8be4('0xb3')],{'as':_0x8be4('0x1b0'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb3')][_0x8be4('0x10e')](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xb3')]['hasMany'](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1bb'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xb3')][_0x8be4('0x10e')](db['ZendeskField'],{'as':_0x8be4('0x1ac'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xb3')][_0x8be4('0x118')](db[_0x8be4('0xb2')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb3')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x1bd')});db[_0x8be4('0xb5')][_0x8be4('0x10e')](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xb5')]['hasMany'](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1ba'),'foreignKey':'DescriptionId'});db[_0x8be4('0xb5')][_0x8be4('0x10e')](db[_0x8be4('0xb5')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xb5')][_0x8be4('0x118')](db['Variable'],{'as':_0x8be4('0x1b8'),'foreignKey':_0x8be4('0x1b9')});db['FreshdeskAccount'][_0x8be4('0x10e')](db[_0x8be4('0xb8')],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb8')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xb8')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':'DescriptionId'});db[_0x8be4('0xb8')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xb8')]['belongsTo'](db[_0x8be4('0xb7')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xb8')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x1be')});db['FreshdeskField'][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xba')][_0x8be4('0x10e')](db['FreshdeskField'],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xba')][_0x8be4('0x10e')](db[_0x8be4('0xba')],{'as':'Field','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xba')]['belongsTo'](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0xbc')][_0x8be4('0x10e')](db['VtigerConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':'cascade','foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xbd')][_0x8be4('0x10e')](db[_0x8be4('0xbf')],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xbd')][_0x8be4('0x10e')](db[_0x8be4('0xbf')],{'as':_0x8be4('0x1bb'),'foreignKey':'DescriptionId'});db[_0x8be4('0xbd')]['hasMany'](db[_0x8be4('0xbf')],{'as':'Fields','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xbd')][_0x8be4('0x118')](db[_0x8be4('0xbc')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xbf')][_0x8be4('0x10e')](db['VtigerField'],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xbf')][_0x8be4('0x10e')](db['VtigerField'],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xbf')][_0x8be4('0x10e')](db[_0x8be4('0xbf')],{'as':'Field','foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xbf')]['belongsTo'](db[_0x8be4('0x1b8')],{'as':_0x8be4('0x1b8'),'foreignKey':'VariableId'});db[_0x8be4('0xc0')][_0x8be4('0x10e')](db['ServicenowConfiguration'],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xc2')]['hasMany'](db['ServicenowField'],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xc2')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':'Descriptions','foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xc2')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1ac'),'foreignKey':_0x8be4('0x1b3')});db['ServicenowConfiguration'][_0x8be4('0x118')](db[_0x8be4('0xc0')],{'as':_0x8be4('0x165'),'foreignKey':'AccountId'});db[_0x8be4('0x1bf')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0x1bf')][_0x8be4('0x10e')](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0x1bf')]['hasMany'](db[_0x8be4('0x1bf')],{'as':_0x8be4('0x1b7'),'foreignKey':_0x8be4('0x1b3')});db['ServicenowField'][_0x8be4('0x118')](db['Variable'],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db['Dynamics365Account'][_0x8be4('0x10e')](db[_0x8be4('0xc5')],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xc5')]['hasMany'](db['Dynamics365Field'],{'as':_0x8be4('0x1b1'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xc5')][_0x8be4('0x10e')](db['Dynamics365Field'],{'as':_0x8be4('0x1bb'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b6')});db[_0x8be4('0xc5')][_0x8be4('0x10e')](db[_0x8be4('0xc6')],{'as':'Fields','onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b3')});db[_0x8be4('0xc5')][_0x8be4('0x118')](db[_0x8be4('0x1c0')],{'as':_0x8be4('0x165'),'foreignKey':'AccountId'});db[_0x8be4('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':_0x8be4('0x1b5'),'foreignKey':'SubjectId'});db[_0x8be4('0xc6')][_0x8be4('0x10e')](db[_0x8be4('0xc6')],{'as':_0x8be4('0x1ba'),'foreignKey':_0x8be4('0x1b6')});db['Dynamics365Field'][_0x8be4('0x10e')](db[_0x8be4('0xc6')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field'][_0x8be4('0x118')](db['Variable'],{'as':_0x8be4('0x1b8'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0x8be4('0x10e')](db[_0x8be4('0xca')],{'as':_0x8be4('0x1b0'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1b4')});db[_0x8be4('0xca')]['hasMany'](db['FreshsalesField'],{'as':_0x8be4('0x1b1'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0xca')][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x8be4('0xca')][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1ac'),'foreignKey':_0x8be4('0x1b3')});db['FreshsalesConfiguration'][_0x8be4('0x118')](db[_0x8be4('0xc8')],{'as':'Account','foreignKey':_0x8be4('0x1b4')});db['FreshsalesField'][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1b5'),'foreignKey':_0x8be4('0x1b2')});db[_0x8be4('0x1c1')][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1ba'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x8be4('0x10e')](db[_0x8be4('0x1c1')],{'as':_0x8be4('0x1b7'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0x8be4('0x1b8')],{'as':'Variable','foreignKey':_0x8be4('0x1b9')});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db['ChatWebsite'],{});db[_0x8be4('0x1c2')]['belongsTo'](db['CmList'],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0x8be4('0x154')});db[_0x8be4('0x1c2')]['belongsTo'](db[_0x8be4('0x65')],{});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db[_0x8be4('0x188')],{});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db[_0x8be4('0x13')],{});db[_0x8be4('0x1c2')][_0x8be4('0x118')](db[_0x8be4('0x12a')],{});db[_0x8be4('0xd1')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':_0x8be4('0x10c'),'foreignKey':'FromId'});db[_0x8be4('0xd1')][_0x8be4('0x118')](db['User'],{'onDelete':'cascade','foreignKey':_0x8be4('0x1c3')});db['JscriptySessionReport']['hasMany'](db[_0x8be4('0x1c4')],{'foreignKey':_0x8be4('0x1c5'),'onDelete':'cascade'});db[_0x8be4('0x18f')][_0x8be4('0x10e')](db[_0x8be4('0xd3')],{'foreignKey':_0x8be4('0x1c5'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0xd7')][_0x8be4('0x118')](db[_0x8be4('0x54')],{});db[_0x8be4('0xd7')][_0x8be4('0x118')](db[_0x8be4('0xf4')],{'as':_0x8be4('0x160'),'foreignKey':'ListId'});db[_0x8be4('0xd7')]['belongsTo'](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db['SmsQueueReport'][_0x8be4('0x118')](db[_0x8be4('0x114')],{});db[_0x8be4('0xd7')][_0x8be4('0x118')](db['SmsMessage'],{});db[_0x8be4('0xd7')]['belongsTo'](db['User'],{});db['SmsQueueReport'][_0x8be4('0x118')](db[_0x8be4('0x58')],{});db[_0x8be4('0xdb')]['hasMany'](db[_0x8be4('0x18f')],{'foreignKey':_0x8be4('0x1c6')});db[_0x8be4('0xdb')][_0x8be4('0x10e')](db[_0x8be4('0x1c4')],{'foreignKey':_0x8be4('0x1c6')});db[_0x8be4('0xdb')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x8be4('0x1c6')});db['SquareProject'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x13c')});db['Team']['belongsToMany'](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x120')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db[_0x8be4('0x1e')],{'through':_0x8be4('0x14b'),'as':_0x8be4('0x1c7')});db['Team'][_0x8be4('0x119')](db[_0x8be4('0x163')],{'through':_0x8be4('0x164'),'as':_0x8be4('0x128')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db[_0x8be4('0x12a')],{'through':'team_has_chat_queues','as':_0x8be4('0x12b')});db[_0x8be4('0xe2')]['belongsToMany'](db[_0x8be4('0x50')],{'through':'team_has_fax_queues','as':_0x8be4('0x12d')});db[_0x8be4('0xe2')]['belongsToMany'](db[_0x8be4('0x58')],{'through':_0x8be4('0x17e'),'as':_0x8be4('0x12e')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db['OpenchannelQueue'],{'through':_0x8be4('0x183'),'as':_0x8be4('0x12f')});db[_0x8be4('0xe2')][_0x8be4('0x119')](db[_0x8be4('0x1c8')],{'through':_0x8be4('0x1c9'),'as':_0x8be4('0x130')});db['Team']['belongsToMany'](db[_0x8be4('0xf5')],{'through':'TeamVoicePrefix','as':_0x8be4('0x1ca')});db[_0x8be4('0xe6')][_0x8be4('0x10e')](db[_0x8be4('0x70')],{'as':_0x8be4('0x141'),'foreignKey':'CampaignId'});db[_0x8be4('0xe6')][_0x8be4('0x10e')](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x194')});db[_0x8be4('0xe6')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':_0x8be4('0x142'),'foreignKey':_0x8be4('0x194')});db['Campaign'][_0x8be4('0x10e')](db[_0x8be4('0x143')],{'as':_0x8be4('0x1cb'),'foreignKey':_0x8be4('0x194')});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x2d')],{'as':_0x8be4('0x2d'),'foreignKey':_0x8be4('0x145')});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x2d')],{'as':_0x8be4('0x146'),'foreignKey':'TrunkBackupId'});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x84')],{'as':_0x8be4('0x84'),'foreignKey':_0x8be4('0x179')});db[_0x8be4('0xe6')][_0x8be4('0x118')](db[_0x8be4('0x13a')],{'as':_0x8be4('0x13a'),'foreignKey':_0x8be4('0x1cc')});db[_0x8be4('0xe6')][_0x8be4('0x119')](db['CmList'],{'as':_0x8be4('0x11e'),'through':_0x8be4('0x1cd')});db[_0x8be4('0xe6')][_0x8be4('0x119')](db['CmList'],{'as':_0x8be4('0x1ce'),'through':_0x8be4('0x1cf')});db[_0x8be4('0x175')][_0x8be4('0x118')](db[_0x8be4('0x68')],{'as':_0x8be4('0x68'),'foreignKey':_0x8be4('0x1d0')});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db[_0x8be4('0x40')],{});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db['MailInteraction'],{});db[_0x8be4('0x1d1')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x8be4('0x1d2'),'as':'FromAccount'});db['MailTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d3'),'as':_0x8be4('0x1d4')});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d5'),'as':_0x8be4('0x1d6')});db[_0x8be4('0x1d1')][_0x8be4('0x118')](db['MailQueue'],{'foreignKey':_0x8be4('0x1d7'),'as':_0x8be4('0x1d8')});db['MailTransferReport'][_0x8be4('0x118')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0x8be4('0x1d9')});db[_0x8be4('0xed')][_0x8be4('0x118')](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db['ChatInteraction'],{});db[_0x8be4('0xed')][_0x8be4('0x118')](db['ChatWebsite'],{'foreignKey':_0x8be4('0x1da'),'as':'FromAccount'});db[_0x8be4('0xed')][_0x8be4('0x118')](db['User'],{'foreignKey':_0x8be4('0x1d3'),'as':'FromAgent'});db['ChatTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d5'),'as':_0x8be4('0x1d6')});db[_0x8be4('0xed')]['belongsTo'](db[_0x8be4('0x12a')],{'foreignKey':_0x8be4('0x1db'),'as':_0x8be4('0x1d8')});db[_0x8be4('0xed')][_0x8be4('0x118')](db[_0x8be4('0x62')],{'foreignKey':_0x8be4('0x1dc'),'as':_0x8be4('0x1d9')});db[_0x8be4('0xef')][_0x8be4('0x118')](db['FaxMessage'],{});db[_0x8be4('0xef')][_0x8be4('0x118')](db[_0x8be4('0x4c')],{});db['FaxTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x48')],{'foreignKey':_0x8be4('0x1dd'),'as':_0x8be4('0x1de')});db['FaxTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d3'),'as':_0x8be4('0x1d4')});db[_0x8be4('0xef')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8be4('0xef')][_0x8be4('0x118')](db[_0x8be4('0x50')],{'foreignKey':_0x8be4('0x1df'),'as':_0x8be4('0x1d8')});db[_0x8be4('0xef')]['belongsTo'](db[_0x8be4('0x48')],{'foreignKey':'ToFaxAccountId','as':_0x8be4('0x1d9')});db['OpenchannelTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x5e')],{});db['OpenchannelTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x5c')],{});db[_0x8be4('0x1e0')][_0x8be4('0x118')](db[_0x8be4('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x8be4('0x1de')});db[_0x8be4('0x1e0')]['belongsTo'](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d3'),'as':_0x8be4('0x1d4')});db[_0x8be4('0x1e0')]['belongsTo'](db[_0x8be4('0x13')],{'foreignKey':'ToUserId','as':_0x8be4('0x1d6')});db['OpenchannelTransferReport']['belongsTo'](db[_0x8be4('0x60')],{'foreignKey':_0x8be4('0x1e1'),'as':'ToQueue'});db[_0x8be4('0x1e0')]['belongsTo'](db[_0x8be4('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':_0x8be4('0x1d9')});db['SmsTransferReport']['belongsTo'](db[_0x8be4('0x17a')],{});db[_0x8be4('0xf2')][_0x8be4('0x118')](db['SmsInteraction'],{});db[_0x8be4('0xf2')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x8be4('0x1e2'),'as':_0x8be4('0x1de')});db[_0x8be4('0xf2')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8be4('0xf2')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'foreignKey':_0x8be4('0x1d5'),'as':_0x8be4('0x1d6')});db[_0x8be4('0xf2')][_0x8be4('0x118')](db[_0x8be4('0x58')],{'foreignKey':_0x8be4('0x1e3'),'as':_0x8be4('0x1d8')});db['SmsTransferReport'][_0x8be4('0x118')](db[_0x8be4('0x54')],{'foreignKey':'ToSmsAccountId','as':_0x8be4('0x1d9')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x80')],{'as':'Dispositions','foreignKey':_0x8be4('0x16c'),'onDelete':'cascade'});db['CmList']['hasMany'](db[_0x8be4('0x79')],{'as':_0x8be4('0x1e4'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x11c'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x73')],{'as':_0x8be4('0x111'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db[_0x8be4('0x75')],{'as':_0x8be4('0x1e5'),'foreignKey':'ListId'});db[_0x8be4('0xf4')][_0x8be4('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x8be4('0xf4')][_0x8be4('0x119')](db['VoiceQueue'],{'as':_0x8be4('0x1e6'),'through':'voice_queues_has_cm_lists'});db[_0x8be4('0xf4')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x11f')});db[_0x8be4('0xf5')]['hasMany'](db['VoiceExtension'],{'as':_0x8be4('0x1e7'),'onDelete':'cascade'});db[_0x8be4('0xf5')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':'Agents','through':_0x8be4('0x108')});db['VoicePrefix'][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':_0x8be4('0x106'),'as':'Teams'});db[_0x8be4('0xf6')]['hasMany'](db[_0x8be4('0x13')],{'as':'Users','foreignKey':_0x8be4('0x1e8')});db[_0x8be4('0xf6')][_0x8be4('0x10e')](db[_0x8be4('0x1e9')],{'as':_0x8be4('0x1ea'),'foreignKey':_0x8be4('0x1e8'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0x1e9')]['hasMany'](db['UserProfileResource'],{'as':_0x8be4('0x1eb'),'foreignKey':_0x8be4('0x1ec'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0xfb')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8be4('0x1ed'),'onDelete':_0x8be4('0x10c')});db[_0x8be4('0xfb')][_0x8be4('0x10e')](db[_0x8be4('0x15b')],{'as':_0x8be4('0x15c'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0xfb')][_0x8be4('0x10e')](db[_0x8be4('0xff')],{'as':_0x8be4('0x15d'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0xfb')][_0x8be4('0x10e')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x8be4('0xfb')]['hasMany'](db[_0x8be4('0x1ee')],{'as':_0x8be4('0x13e')});db[_0x8be4('0xfb')][_0x8be4('0x118')](db['CmList'],{'as':_0x8be4('0x160'),'foreignKey':_0x8be4('0x16c')});db[_0x8be4('0xfb')][_0x8be4('0x118')](db[_0x8be4('0x86')],{'as':_0x8be4('0x148'),'foreignKey':_0x8be4('0x149')});db['WhatsappAccount'][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x162'),'through':_0x8be4('0x139')});db['WhatsappApplication'][_0x8be4('0x118')](db[_0x8be4('0x13')],{'onDelete':'restrict'});db[_0x8be4('0x1ee')][_0x8be4('0x118')](db[_0x8be4('0x1c8')],{'onDelete':_0x8be4('0x157')});db[_0x8be4('0x1ee')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{'onDelete':_0x8be4('0x157')});db['WhatsappApplication'][_0x8be4('0x118')](db[_0x8be4('0x84')],{'onDelete':_0x8be4('0x157'),'foreignKey':_0x8be4('0x179')});db['WhatsappApplication'][_0x8be4('0x118')](db[_0x8be4('0x8e')],{'onDelete':_0x8be4('0x157'),'foreignKey':'TagId'});db[_0x8be4('0xfd')]['hasMany'](db[_0x8be4('0xff')],{'as':_0x8be4('0x15d'),'onDelete':_0x8be4('0x10c'),'foreignKey':_0x8be4('0x1ef')});db[_0x8be4('0xfd')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0xfd')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8be4('0xfd')][_0x8be4('0x118')](db[_0x8be4('0x13')],{'as':_0x8be4('0x167'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0x8be4('0x119')](db['Tag'],{'through':_0x8be4('0x1a5'),'as':_0x8be4('0x171')});db[_0x8be4('0xfd')][_0x8be4('0x119')](db[_0x8be4('0x8e')],{'through':_0x8be4('0x1a5'),'as':'ThroughTags'});db[_0x8be4('0xfd')][_0x8be4('0x119')](db[_0x8be4('0x13')],{'as':_0x8be4('0x173'),'through':_0x8be4('0x127'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x8be4('0x118')](db['User'],{'as':'User'});db[_0x8be4('0xff')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x166')});db['WhatsappMessage']['belongsTo'](db[_0x8be4('0xfd')],{'onDelete':_0x8be4('0x10c'),'as':_0x8be4('0x174'),'foreignKey':'WhatsappInteractionId'});db[_0x8be4('0xff')][_0x8be4('0x118')](db['WhatsappAccount'],{'as':_0x8be4('0x165'),'foreignKey':_0x8be4('0x1ed')});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{});db[_0x8be4('0x101')]['belongsTo'](db[_0x8be4('0xf4')],{'as':'List','foreignKey':_0x8be4('0x16c')});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0x11b')],{'as':_0x8be4('0x166'),'foreignKey':_0x8be4('0x154')});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0xfd')],{});db[_0x8be4('0x101')]['belongsTo'](db[_0x8be4('0x1c8')],{});db[_0x8be4('0x101')][_0x8be4('0x118')](db[_0x8be4('0xff')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x8be4('0x13')],{});db[_0x8be4('0x103')][_0x8be4('0x118')](db[_0x8be4('0xff')],{});db['WhatsappTransferReport'][_0x8be4('0x118')](db[_0x8be4('0xfd')],{});db[_0x8be4('0x103')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x8be4('0x1f0'),'as':_0x8be4('0x1de')});db[_0x8be4('0x103')][_0x8be4('0x118')](db[_0x8be4('0xfb')],{'foreignKey':_0x8be4('0x1f1'),'as':_0x8be4('0x1d9')});db[_0x8be4('0x103')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x8be4('0x1f2'),'as':_0x8be4('0x1d8')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x8be4('0x1d4')});db[_0x8be4('0x103')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8be4('0x1c8')][_0x8be4('0x119')](db['User'],{'as':'Agents','through':_0x8be4('0x36'),'foreignKey':_0x8be4('0x1f3')});db[_0x8be4('0x1c8')][_0x8be4('0x119')](db[_0x8be4('0xe2')],{'through':'team_has_whatsapp_queues','as':_0x8be4('0x14a')});db['CloudProvider']['hasOne'](db[_0x8be4('0x38')],{'as':_0x8be4('0x159'),'onDelete':_0x8be4('0x157')});db[_0x8be4('0x104')][_0x8be4('0x10a')](db[_0x8be4('0x158')],{'as':'Smtp','onDelete':_0x8be4('0x157')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 1b8dd33..1fa29a9 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42fa=['firstName','lastName','phone','fax','email','clientId','clientSecret','securityToken','code','tenantId','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','privateKey','secretaccesskey','key','pass','localstationid','dsn','secret','registry','isArray','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','util','./errors','./config/environment','./config/logger','api','auth','./safe-template','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','x-forwarded-for','headers','remoteAddress','url','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','connection','statusCode','role','other','agent_name','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsInteraction','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/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/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','join','root','static','/www','/demo','3.0.0','/plugins','route','get','sendFile','resolve','/index.html','username','password','newPassword','apiKey'];(function(_0x2d31ce,_0x134662){var _0x3e6cfc=function(_0x30fc9e){while(--_0x30fc9e){_0x2d31ce['push'](_0x2d31ce['shift']());}};_0x3e6cfc(++_0x134662);}(_0x42fa,0x161));var _0xa42f=function(_0x419202,_0x3d701b){_0x419202=_0x419202-0x0;var _0x903d09=_0x42fa[_0x419202];return _0x903d09;};'use strict';var _=require(_0xa42f('0x0'));var path=require(_0xa42f('0x1'));var express=require('express');var ewinston=require('express-winston');var util=require(_0xa42f('0x2'));var errors=require(_0xa42f('0x3'));var config=require(_0xa42f('0x4'));var logger=require(_0xa42f('0x5'))(_0xa42f('0x6'));var authLogger=require(_0xa42f('0x5'))(_0xa42f('0x7'));var safeTemplate=require(_0xa42f('0x8'))['safeTemplate'];exports[_0xa42f('0x9')]=function(_0x208179){_0x208179['use'](ewinston[_0xa42f('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x35d5c3,_0x2376f0){var _0x2638cf=_0xa42f('0xb');if(!_[_0xa42f('0xc')](_0x35d5c3[_0xa42f('0xd')])){_0x2638cf+=_0xa42f('0xe');var _0x40b9d1=_0x35d5c3[_0xa42f('0xd')];maskSensitiveData(_0x40b9d1);}return safeTemplate(util[_0xa42f('0xf')](_0x2638cf,_0x35d5c3['method'],_0x35d5c3['headers'][_0xa42f('0x10')]?_0x35d5c3[_0xa42f('0x11')][_0xa42f('0x10')]:_0x35d5c3['connection'][_0xa42f('0x12')]||_0x35d5c3['ip'],_0x35d5c3[_0xa42f('0x13')],_0x2376f0['statusCode'],_0x2376f0[_0xa42f('0x14')],_0x35d5c3['user']?_0x35d5c3['user']['id']:null,_0x35d5c3[_0xa42f('0x15')]?_0x35d5c3[_0xa42f('0x15')][_0xa42f('0x16')]:null,_0x35d5c3['user']?_0x35d5c3[_0xa42f('0x15')]['role']:null,_0x40b9d1?util[_0xa42f('0x17')](_0x40b9d1,![],null):''));}}));_0x208179['use'](ewinston[_0xa42f('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2e3e4e,_0x2083b1){var _0x313373=_0xa42f('0x18');if(_0x2e3e4e[_0xa42f('0xd')]&&_0x2e3e4e['body'][_0xa42f('0x19')]&&_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x1a')]){_0x313373='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xa42f('0xf')](_0x313373,_0x2e3e4e[_0xa42f('0x1b')],_0x2e3e4e['headers'][_0xa42f('0x10')]?_0x2e3e4e[_0xa42f('0x11')][_0xa42f('0x10')]:_0x2e3e4e[_0xa42f('0x1c')][_0xa42f('0x12')]||_0x2e3e4e['ip'],_0x2e3e4e[_0xa42f('0x13')],_0x2083b1[_0xa42f('0x1d')],_0x2083b1[_0xa42f('0x14')],_0x2e3e4e['user']?_0x2e3e4e[_0xa42f('0x15')]['id']:null,_0x2e3e4e[_0xa42f('0x15')]?_0x2e3e4e[_0xa42f('0x15')][_0xa42f('0x16')]:null,_0x2e3e4e[_0xa42f('0x15')]?_0x2e3e4e[_0xa42f('0x15')][_0xa42f('0x1e')]:null,_0x2e3e4e[_0xa42f('0xd')]&&_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x19')]?_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x19')]:_0xa42f('0x1f'),_0x2e3e4e[_0xa42f('0xd')]&&_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x1a')]?_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x1a')]:'',_0x2e3e4e[_0xa42f('0xd')]&&_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x20')]?_0x2e3e4e[_0xa42f('0xd')][_0xa42f('0x20')]:'');},'ignoreRoute':function(_0x1007b7){var _0xd348e0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xd348e0['test'](_0x1007b7[_0xa42f('0x13')]);}}));_0x208179[_0xa42f('0x21')](_0xa42f('0x22'),require(_0xa42f('0x23')));_0x208179[_0xa42f('0x21')](_0xa42f('0x24'),require(_0xa42f('0x25')));_0x208179[_0xa42f('0x21')](_0xa42f('0x26'),require(_0xa42f('0x27')));_0x208179[_0xa42f('0x21')]('/api/voice/extensions',require(_0xa42f('0x28')));_0x208179['use'](_0xa42f('0x29'),require('./api/voiceMusicOnHold'));_0x208179[_0xa42f('0x21')](_0xa42f('0x2a'),require(_0xa42f('0x2b')));_0x208179[_0xa42f('0x21')](_0xa42f('0x2c'),require('./api/voiceRecording'));_0x208179[_0xa42f('0x21')](_0xa42f('0x2d'),require(_0xa42f('0x2e')));_0x208179['use'](_0xa42f('0x2f'),require(_0xa42f('0x30')));_0x208179[_0xa42f('0x21')](_0xa42f('0x31'),require('./api/voiceMailMessage'));_0x208179['use'](_0xa42f('0x32'),require(_0xa42f('0x33')));_0x208179[_0xa42f('0x21')](_0xa42f('0x34'),require(_0xa42f('0x35')));_0x208179[_0xa42f('0x21')]('/api/voice/agents/reports',require(_0xa42f('0x36')));_0x208179[_0xa42f('0x21')](_0xa42f('0x37'),require(_0xa42f('0x38')));_0x208179[_0xa42f('0x21')](_0xa42f('0x39'),require(_0xa42f('0x3a')));_0x208179[_0xa42f('0x21')]('/api/trunks',require(_0xa42f('0x3b')));_0x208179[_0xa42f('0x21')](_0xa42f('0x3c'),require(_0xa42f('0x3d')));_0x208179['use'](_0xa42f('0x3e'),require(_0xa42f('0x3f')));_0x208179['use'](_0xa42f('0x40'),require('./api/mailAccount'));_0x208179[_0xa42f('0x21')](_0xa42f('0x41'),require('./api/mailQueue'));_0x208179['use']('/api/mail/substatuses',require(_0xa42f('0x42')));_0x208179[_0xa42f('0x21')]('/api/mail/interactions',require(_0xa42f('0x43')));_0x208179['use'](_0xa42f('0x44'),require(_0xa42f('0x45')));_0x208179['use'](_0xa42f('0x46'),require('./api/mailApplication'));_0x208179[_0xa42f('0x21')](_0xa42f('0x47'),require('./api/mailQueueReport'));_0x208179[_0xa42f('0x21')]('/api/dashboards',require(_0xa42f('0x48')));_0x208179[_0xa42f('0x21')](_0xa42f('0x49'),require(_0xa42f('0x4a')));_0x208179[_0xa42f('0x21')]('/api/fax/accounts',require(_0xa42f('0x4b')));_0x208179[_0xa42f('0x21')]('/api/fax/applications',require('./api/faxApplication'));_0x208179[_0xa42f('0x21')](_0xa42f('0x4c'),require(_0xa42f('0x4d')));_0x208179[_0xa42f('0x21')](_0xa42f('0x4e'),require(_0xa42f('0x4f')));_0x208179[_0xa42f('0x21')](_0xa42f('0x50'),require(_0xa42f('0x51')));_0x208179[_0xa42f('0x21')](_0xa42f('0x52'),require(_0xa42f('0x53')));_0x208179[_0xa42f('0x21')](_0xa42f('0x54'),require('./api/smsAccount'));_0x208179[_0xa42f('0x21')]('/api/sms/applications',require('./api/smsApplication'));_0x208179[_0xa42f('0x21')]('/api/sms/interactions',require(_0xa42f('0x55')));_0x208179['use']('/api/sms/messages',require('./api/smsMessage'));_0x208179[_0xa42f('0x21')](_0xa42f('0x56'),require('./api/smsQueue'));_0x208179[_0xa42f('0x21')](_0xa42f('0x57'),require(_0xa42f('0x58')));_0x208179['use']('/api/openchannel/applications',require(_0xa42f('0x59')));_0x208179[_0xa42f('0x21')](_0xa42f('0x5a'),require('./api/openchannelInteraction'));_0x208179['use'](_0xa42f('0x5b'),require(_0xa42f('0x5c')));_0x208179[_0xa42f('0x21')](_0xa42f('0x5d'),require('./api/openchannelQueue'));_0x208179['use'](_0xa42f('0x5e'),require('./api/chatWebsite'));_0x208179[_0xa42f('0x21')](_0xa42f('0x5f'),require(_0xa42f('0x60')));_0x208179[_0xa42f('0x21')]('/api/chat/applications',require('./api/chatApplication'));_0x208179[_0xa42f('0x21')](_0xa42f('0x61'),require(_0xa42f('0x62')));_0x208179[_0xa42f('0x21')]('/api/chat/messages',require(_0xa42f('0x63')));_0x208179[_0xa42f('0x21')](_0xa42f('0x64'),require(_0xa42f('0x65')));_0x208179[_0xa42f('0x21')]('/api/chat/queues',require(_0xa42f('0x66')));_0x208179[_0xa42f('0x21')](_0xa42f('0x67'),require(_0xa42f('0x68')));_0x208179[_0xa42f('0x21')](_0xa42f('0x69'),require(_0xa42f('0x6a')));_0x208179[_0xa42f('0x21')](_0xa42f('0x6b'),require('./api/cmCompany'));_0x208179[_0xa42f('0x21')](_0xa42f('0x6c'),require('./api/cmContact'));_0x208179['use'](_0xa42f('0x6d'),require(_0xa42f('0x6e')));_0x208179['use'](_0xa42f('0x6f'),require(_0xa42f('0x70')));_0x208179[_0xa42f('0x21')](_0xa42f('0x71'),require(_0xa42f('0x72')));_0x208179[_0xa42f('0x21')](_0xa42f('0x73'),require('./api/cmHopperHistory'));_0x208179[_0xa42f('0x21')](_0xa42f('0x74'),require(_0xa42f('0x75')));_0x208179[_0xa42f('0x21')](_0xa42f('0x76'),require('./api/action'));_0x208179['use'](_0xa42f('0x77'),require(_0xa42f('0x78')));_0x208179[_0xa42f('0x21')](_0xa42f('0x79'),require(_0xa42f('0x7a')));_0x208179[_0xa42f('0x21')](_0xa42f('0x7b'),require(_0xa42f('0x7c')));_0x208179[_0xa42f('0x21')](_0xa42f('0x7d'),require(_0xa42f('0x7e')));_0x208179[_0xa42f('0x21')](_0xa42f('0x7f'),require(_0xa42f('0x80')));_0x208179['use']('/api/pauses',require('./api/pause'));_0x208179[_0xa42f('0x21')](_0xa42f('0x81'),require(_0xa42f('0x82')));_0x208179[_0xa42f('0x21')](_0xa42f('0x83'),require(_0xa42f('0x84')));_0x208179['use'](_0xa42f('0x85'),require(_0xa42f('0x86')));_0x208179['use'](_0xa42f('0x87'),require('./api/sound'));_0x208179['use']('/api/tags',require(_0xa42f('0x88')));_0x208179[_0xa42f('0x21')](_0xa42f('0x89'),require(_0xa42f('0x8a')));_0x208179[_0xa42f('0x21')](_0xa42f('0x8b'),require('./api/trigger'));_0x208179['use'](_0xa42f('0x8c'),require(_0xa42f('0x8d')));_0x208179[_0xa42f('0x21')](_0xa42f('0x8e'),require(_0xa42f('0x8f')));_0x208179['use'](_0xa42f('0x90'),require(_0xa42f('0x91')));_0x208179['use']('/api/analytics/custom_reports',require(_0xa42f('0x92')));_0x208179[_0xa42f('0x21')](_0xa42f('0x93'),require(_0xa42f('0x94')));_0x208179[_0xa42f('0x21')](_0xa42f('0x95'),require(_0xa42f('0x96')));_0x208179[_0xa42f('0x21')]('/api/analytics/metrics',require(_0xa42f('0x97')));_0x208179['use'](_0xa42f('0x98'),require('./api/analyticFieldReport'));_0x208179[_0xa42f('0x21')]('/api/analytics/tree_reports',require(_0xa42f('0x99')));_0x208179[_0xa42f('0x21')](_0xa42f('0x9a'),require(_0xa42f('0x9b')));_0x208179['use'](_0xa42f('0x9c'),require(_0xa42f('0x9d')));_0x208179['use']('/api/integrations/salesforce/fields',require(_0xa42f('0x9e')));_0x208179['use'](_0xa42f('0x9f'),require('./api/intSugarcrmAccount'));_0x208179[_0xa42f('0x21')](_0xa42f('0xa0'),require('./api/intSugarcrmConfiguration'));_0x208179['use'](_0xa42f('0xa1'),require(_0xa42f('0xa2')));_0x208179[_0xa42f('0x21')](_0xa42f('0xa3'),require(_0xa42f('0xa4')));_0x208179[_0xa42f('0x21')](_0xa42f('0xa5'),require(_0xa42f('0xa6')));_0x208179['use']('/api/integrations/desk/fields',require(_0xa42f('0xa7')));_0x208179[_0xa42f('0x21')](_0xa42f('0xa8'),require(_0xa42f('0xa9')));_0x208179['use']('/api/integrations/zoho/configurations',require(_0xa42f('0xaa')));_0x208179[_0xa42f('0x21')](_0xa42f('0xab'),require(_0xa42f('0xac')));_0x208179[_0xa42f('0x21')](_0xa42f('0xad'),require(_0xa42f('0xae')));_0x208179[_0xa42f('0x21')](_0xa42f('0xaf'),require(_0xa42f('0xb0')));_0x208179[_0xa42f('0x21')](_0xa42f('0xb1'),require('./api/intZendeskField'));_0x208179[_0xa42f('0x21')](_0xa42f('0xb2'),require(_0xa42f('0xb3')));_0x208179[_0xa42f('0x21')](_0xa42f('0xb4'),require(_0xa42f('0xb5')));_0x208179[_0xa42f('0x21')](_0xa42f('0xb6'),require(_0xa42f('0xb7')));_0x208179[_0xa42f('0x21')](_0xa42f('0xb8'),require(_0xa42f('0xb9')));_0x208179[_0xa42f('0x21')]('/api/integrations/vtiger/configurations',require(_0xa42f('0xba')));_0x208179[_0xa42f('0x21')](_0xa42f('0xbb'),require('./api/intVtigerField'));_0x208179[_0xa42f('0x21')](_0xa42f('0xbc'),require(_0xa42f('0xbd')));_0x208179[_0xa42f('0x21')](_0xa42f('0xbe'),require(_0xa42f('0xbf')));_0x208179[_0xa42f('0x21')](_0xa42f('0xc0'),require('./api/intServicenowField'));_0x208179[_0xa42f('0x21')](_0xa42f('0xc1'),require('./api/intDynamics365Account'));_0x208179[_0xa42f('0x21')](_0xa42f('0xc2'),require(_0xa42f('0xc3')));_0x208179[_0xa42f('0x21')](_0xa42f('0xc4'),require(_0xa42f('0xc5')));_0x208179[_0xa42f('0x21')](_0xa42f('0xc6'),require(_0xa42f('0xc7')));_0x208179[_0xa42f('0x21')]('/api/integrations/freshsales/configurations',require(_0xa42f('0xc8')));_0x208179['use'](_0xa42f('0xc9'),require('./api/intFreshsalesField'));_0x208179['use']('/api/networks',require(_0xa42f('0xca')));_0x208179[_0xa42f('0x21')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x208179[_0xa42f('0x21')](_0xa42f('0xcb'),require(_0xa42f('0xcc')));_0x208179[_0xa42f('0x21')](_0xa42f('0xcd'),require(_0xa42f('0xce')));_0x208179['use'](_0xa42f('0xcf'),require(_0xa42f('0xd0')));_0x208179[_0xa42f('0x21')](_0xa42f('0xd1'),require('./api/jscriptySessionReport'));_0x208179[_0xa42f('0x21')](_0xa42f('0xd2'),require(_0xa42f('0xd3')));_0x208179[_0xa42f('0x21')]('/api/square/reports',require(_0xa42f('0xd4')));_0x208179['use']('/api/square/details/reports',require(_0xa42f('0xd5')));_0x208179[_0xa42f('0x21')](_0xa42f('0xd6'),require(_0xa42f('0xd7')));_0x208179['use']('/api/settings',require(_0xa42f('0xd8')));_0x208179[_0xa42f('0x21')](_0xa42f('0xd9'),require('./api/squareOdbc'));_0x208179[_0xa42f('0x21')](_0xa42f('0xda'),require(_0xa42f('0xdb')));_0x208179[_0xa42f('0x21')](_0xa42f('0xdc'),require('./api/squareRecording'));_0x208179[_0xa42f('0x21')](_0xa42f('0xdd'),require('./api/squareMessage'));_0x208179['use']('/api/teams',require(_0xa42f('0xde')));_0x208179[_0xa42f('0x21')](_0xa42f('0xdf'),require(_0xa42f('0xe0')));_0x208179['use'](_0xa42f('0xe1'),require(_0xa42f('0xe2')));_0x208179[_0xa42f('0x21')](_0xa42f('0xe3'),require(_0xa42f('0xe4')));_0x208179[_0xa42f('0x21')]('/api/attachments',require(_0xa42f('0xe5')));_0x208179['use'](_0xa42f('0xe6'),require('./api/plugin'));_0x208179[_0xa42f('0x21')](_0xa42f('0xe7'),require(_0xa42f('0xe8')));_0x208179[_0xa42f('0x21')]('/api/chat/reports/transfer',require(_0xa42f('0xe9')));_0x208179[_0xa42f('0x21')](_0xa42f('0xea'),require(_0xa42f('0xeb')));_0x208179[_0xa42f('0x21')](_0xa42f('0xec'),require('./api/openchannelTransferReport'));_0x208179[_0xa42f('0x21')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x208179[_0xa42f('0x21')]('/api/cm/lists',require('./api/cmList'));_0x208179[_0xa42f('0x21')](_0xa42f('0xed'),require(_0xa42f('0xee')));_0x208179[_0xa42f('0x21')](_0xa42f('0xef'),require('./api/userProfile'));_0x208179[_0xa42f('0x21')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x208179['use'](_0xa42f('0xf0'),require('./api/userProfileResource'));_0x208179[_0xa42f('0x21')](_0xa42f('0xf1'),require(_0xa42f('0xf2')));_0x208179[_0xa42f('0x21')](_0xa42f('0xf3'),require('./api/whatsappAccount'));_0x208179[_0xa42f('0x21')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x208179[_0xa42f('0x21')](_0xa42f('0xf4'),require(_0xa42f('0xf5')));_0x208179[_0xa42f('0x21')](_0xa42f('0xf6'),require(_0xa42f('0xf7')));_0x208179['use'](_0xa42f('0xf8'),require(_0xa42f('0xf9')));_0x208179['use'](_0xa42f('0xfa'),require(_0xa42f('0xfb')));_0x208179[_0xa42f('0x21')](_0xa42f('0xfc'),require(_0xa42f('0xfd')));_0x208179[_0xa42f('0x21')](_0xa42f('0xfe'),require(_0xa42f('0xff')));_0x208179['use']('/api/realtime',require(_0xa42f('0x100')));_0x208179[_0xa42f('0x21')]('/api/auth/local',require('./api/authLocal'));_0x208179['use'](_0xa42f('0x101'),require('./api/authGoogle'));_0x208179[_0xa42f('0x21')](_0xa42f('0x102'),require(_0xa42f('0x103')));_0x208179[_0xa42f('0x21')](_0xa42f('0x104'),require('./api/jira'));_0x208179[_0xa42f('0x21')](_0xa42f('0x105'),require(_0xa42f('0x106')));_0x208179[_0xa42f('0x21')](_0xa42f('0x107'),require(_0xa42f('0x108')));_0x208179[_0xa42f('0x21')](_0xa42f('0x109'),require(_0xa42f('0x10a')));_0x208179['use'](_0xa42f('0x10b'),require('./api/pm2'));_0x208179['use']('/api/webbar',require(_0xa42f('0x10c')));_0x208179[_0xa42f('0x21')]('/apidoc',express['static'](path[_0xa42f('0x10d')](config[_0xa42f('0x10e')],'/apidoc')));_0x208179[_0xa42f('0x21')]('/www',express[_0xa42f('0x10f')](path[_0xa42f('0x10d')](config[_0xa42f('0x10e')],_0xa42f('0x110'))));_0x208179['use'](_0xa42f('0x111'),express['static'](path[_0xa42f('0x10d')](config[_0xa42f('0x10e')],_0xa42f('0x111'))));_0x208179[_0xa42f('0x21')]('/snippet',express[_0xa42f('0x10f')](path[_0xa42f('0x10d')](config[_0xa42f('0x10e')],'snippet',_0xa42f('0x112'))));_0x208179[_0xa42f('0x21')](_0xa42f('0x113'),express['static'](path[_0xa42f('0x10d')](config[_0xa42f('0x10e')],'/server/files/plugins')));_0x208179[_0xa42f('0x114')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xa42f('0x115')](errors[0x194]);_0x208179[_0xa42f('0x114')]('/*')[_0xa42f('0x115')](function(_0x2f4fc9,_0x2e3bb1){_0x2e3bb1[_0xa42f('0x116')](path[_0xa42f('0x117')](_0x208179['get']('appPath')+_0xa42f('0x118')));});};var sensitiveFields=[_0xa42f('0x119'),_0xa42f('0x11a'),_0xa42f('0x11b'),_0xa42f('0x11c'),_0xa42f('0x11d'),_0xa42f('0x11e'),'street',_0xa42f('0x11f'),'mobile',_0xa42f('0x120'),_0xa42f('0x121'),_0xa42f('0x122'),_0xa42f('0x123'),_0xa42f('0x124'),_0xa42f('0x125'),'accessKey',_0xa42f('0x126'),'token','channelSecret','accessToken',_0xa42f('0x127'),_0xa42f('0x128'),_0xa42f('0x129'),_0xa42f('0x12a'),_0xa42f('0x12b'),_0xa42f('0x12c'),_0xa42f('0x12d'),_0xa42f('0x12e'),'vidaooApiKey',_0xa42f('0x12f'),_0xa42f('0x130'),'accesskeyid',_0xa42f('0x131'),_0xa42f('0x132'),_0xa42f('0x15'),_0xa42f('0x133'),'accountSid',_0xa42f('0x134'),_0xa42f('0x135'),_0xa42f('0x136'),_0xa42f('0x137'),'oldPassword'];function maskSensitiveData(_0x25a8fd){var _0x18f96e=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x25a8fd))return;for(var _0x442139 in _0x25a8fd){if(_[_0xa42f('0x138')](_0x25a8fd[_0x442139])){for(var _0x57e7e4=0x0;_0x57e7e4<_0x25a8fd[_0x442139]['length'];_0x57e7e4++){maskSensitiveData(_0x25a8fd[_0x442139][_0x57e7e4]);}}else if(_[_0xa42f('0x139')](_0x25a8fd[_0x442139])){maskSensitiveData(_0x25a8fd[_0x442139]);}else if(_[_0xa42f('0x13a')](_0x25a8fd[_0x442139])){_0x25a8fd[_0x442139]=_0x25a8fd[_0x442139][_0xa42f('0x13b')](/{{{/g,_0xa42f('0x13c'))[_0xa42f('0x13b')](/}}}/g,_0xa42f('0x13d'))[_0xa42f('0x13b')](/{{/g,'@{')[_0xa42f('0x13b')](/}}/g,'}@');if(_[_0xa42f('0x13e')](sensitiveFields,_0x442139)){_0x25a8fd[_0x442139]=_0x25a8fd[_0x442139][_0xa42f('0x13b')](_0x18f96e,'*');}}}} \ No newline at end of file +var _0x8b5f=['/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/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/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','apiKey','firstName','lastName','street','phone','fax','clientId','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','membername','calleridname','calleridnum','exten','privateKey','secretaccesskey','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','includes','express','express-winston','./errors','./config/logger','api','auth','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','role','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction'];(function(_0x480c20,_0x5f369a){var _0x289581=function(_0x57d660){while(--_0x57d660){_0x480c20['push'](_0x480c20['shift']());}};_0x289581(++_0x5f369a);}(_0x8b5f,0x106));var _0xf8b5=function(_0xccfd1d,_0x100964){_0xccfd1d=_0xccfd1d-0x0;var _0x347d12=_0x8b5f[_0xccfd1d];return _0x347d12;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0xf8b5('0x0'));var ewinston=require(_0xf8b5('0x1'));var util=require('util');var errors=require(_0xf8b5('0x2'));var config=require('./config/environment');var logger=require(_0xf8b5('0x3'))(_0xf8b5('0x4'));var authLogger=require(_0xf8b5('0x3'))(_0xf8b5('0x5'));var safeTemplate=require(_0xf8b5('0x6'))[_0xf8b5('0x7')];exports[_0xf8b5('0x8')]=function(_0x4184c3){_0x4184c3[_0xf8b5('0x9')](ewinston[_0xf8b5('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x435110,_0x2229bb){var _0x2e9a1=_0xf8b5('0xb');if(!_['isEmpty'](_0x435110[_0xf8b5('0xc')])){_0x2e9a1+=_0xf8b5('0xd');var _0x57b31f=_0x435110['body'];maskSensitiveData(_0x57b31f);}return safeTemplate(util['format'](_0x2e9a1,_0x435110[_0xf8b5('0xe')],_0x435110['headers']['x-forwarded-for']?_0x435110[_0xf8b5('0xf')][_0xf8b5('0x10')]:_0x435110[_0xf8b5('0x11')][_0xf8b5('0x12')]||_0x435110['ip'],_0x435110[_0xf8b5('0x13')],_0x2229bb[_0xf8b5('0x14')],_0x2229bb[_0xf8b5('0x15')],_0x435110[_0xf8b5('0x16')]?_0x435110[_0xf8b5('0x16')]['id']:null,_0x435110[_0xf8b5('0x16')]?_0x435110['user'][_0xf8b5('0x17')]:null,_0x435110['user']?_0x435110['user']['role']:null,_0x57b31f?util[_0xf8b5('0x18')](_0x57b31f,![],null):''));}}));_0x4184c3[_0xf8b5('0x9')](ewinston[_0xf8b5('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4c2e0c,_0x2f3e88){var _0x27c8da=_0xf8b5('0x19');if(_0x4c2e0c[_0xf8b5('0xc')]&&_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1a')]&&_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1b')]){_0x27c8da=_0xf8b5('0x1c');}return util[_0xf8b5('0x1d')](_0x27c8da,_0x4c2e0c[_0xf8b5('0xe')],_0x4c2e0c['headers'][_0xf8b5('0x10')]?_0x4c2e0c[_0xf8b5('0xf')][_0xf8b5('0x10')]:_0x4c2e0c[_0xf8b5('0x11')][_0xf8b5('0x12')]||_0x4c2e0c['ip'],_0x4c2e0c[_0xf8b5('0x13')],_0x2f3e88[_0xf8b5('0x14')],_0x2f3e88[_0xf8b5('0x15')],_0x4c2e0c['user']?_0x4c2e0c[_0xf8b5('0x16')]['id']:null,_0x4c2e0c[_0xf8b5('0x16')]?_0x4c2e0c[_0xf8b5('0x16')]['name']:null,_0x4c2e0c['user']?_0x4c2e0c[_0xf8b5('0x16')][_0xf8b5('0x1e')]:null,_0x4c2e0c[_0xf8b5('0xc')]&&_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1a')]?_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1a')]:_0xf8b5('0x1f'),_0x4c2e0c['body']&&_0x4c2e0c['body'][_0xf8b5('0x1b')]?_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x1b')]:'',_0x4c2e0c['body']&&_0x4c2e0c[_0xf8b5('0xc')]['agent_name']?_0x4c2e0c[_0xf8b5('0xc')][_0xf8b5('0x20')]:'');},'ignoreRoute':function(_0x3e5972){var _0x1ef0c5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1ef0c5['test'](_0x3e5972['url']);}}));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x21'),require(_0xf8b5('0x22')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x23'),require(_0xf8b5('0x24')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x25'),require(_0xf8b5('0x26')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x27'),require(_0xf8b5('0x28')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x29'),require(_0xf8b5('0x2a')));_0x4184c3['use'](_0xf8b5('0x2b'),require(_0xf8b5('0x2c')));_0x4184c3['use'](_0xf8b5('0x2d'),require(_0xf8b5('0x2e')));_0x4184c3[_0xf8b5('0x9')]('/api/screen/recordings',require(_0xf8b5('0x2f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x30'),require(_0xf8b5('0x31')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x32'),require(_0xf8b5('0x33')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x34'),require(_0xf8b5('0x35')));_0x4184c3['use'](_0xf8b5('0x36'),require(_0xf8b5('0x37')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x38'),require(_0xf8b5('0x39')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x3a'),require(_0xf8b5('0x3b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x3c'),require(_0xf8b5('0x3d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x3e'),require(_0xf8b5('0x3f')));_0x4184c3['use']('/api/voice/transfers/reports',require(_0xf8b5('0x40')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x41'),require('./api/mailServerOut'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x42'),require(_0xf8b5('0x43')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x44'),require(_0xf8b5('0x45')));_0x4184c3['use'](_0xf8b5('0x46'),require('./api/mailSubstatus'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x47'),require(_0xf8b5('0x48')));_0x4184c3[_0xf8b5('0x9')]('/api/mail/messages',require(_0xf8b5('0x49')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x4a'),require(_0xf8b5('0x4b')));_0x4184c3[_0xf8b5('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x4c'),require(_0xf8b5('0x4d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x4e'),require(_0xf8b5('0x4f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x50'),require('./api/faxAccount'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x51'),require('./api/faxApplication'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x52'),require(_0xf8b5('0x53')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x54'),require(_0xf8b5('0x55')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x56'),require(_0xf8b5('0x57')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x58'),require('./api/faxQueueReport'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x59'),require('./api/smsAccount'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x5a'),require(_0xf8b5('0x5b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x5c'),require(_0xf8b5('0x5d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x5e'),require(_0xf8b5('0x5f')));_0x4184c3['use'](_0xf8b5('0x60'),require('./api/smsQueue'));_0x4184c3['use'](_0xf8b5('0x61'),require(_0xf8b5('0x62')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x63'),require(_0xf8b5('0x64')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x65'),require(_0xf8b5('0x66')));_0x4184c3['use'](_0xf8b5('0x67'),require('./api/openchannelMessage'));_0x4184c3['use'](_0xf8b5('0x68'),require(_0xf8b5('0x69')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x6a'),require(_0xf8b5('0x6b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x6c'),require('./api/openchannelQueueReport'));_0x4184c3['use'](_0xf8b5('0x6d'),require(_0xf8b5('0x6e')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x6f'),require(_0xf8b5('0x70')));_0x4184c3['use'](_0xf8b5('0x71'),require(_0xf8b5('0x72')));_0x4184c3['use'](_0xf8b5('0x73'),require('./api/chatOfflineMessage'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x74'),require('./api/chatQueue'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x75'),require(_0xf8b5('0x76')));_0x4184c3[_0xf8b5('0x9')]('/api/chat/proactive_actions',require(_0xf8b5('0x77')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x78'),require('./api/cmCompany'));_0x4184c3['use']('/api/cm/contacts',require(_0xf8b5('0x79')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x7a'),require('./api/cmHopper'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x7b'),require(_0xf8b5('0x7c')));_0x4184c3[_0xf8b5('0x9')]('/api/cm/hopper_final',require(_0xf8b5('0x7d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x7e'),require(_0xf8b5('0x7f')));_0x4184c3['use'](_0xf8b5('0x80'),require(_0xf8b5('0x81')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x82'),require(_0xf8b5('0x83')));_0x4184c3[_0xf8b5('0x9')]('/api/automations',require(_0xf8b5('0x84')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x85'),require(_0xf8b5('0x86')));_0x4184c3['use']('/api/dispositions',require(_0xf8b5('0x87')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x88'),require('./api/condition'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x89'),require(_0xf8b5('0x8a')));_0x4184c3['use'](_0xf8b5('0x8b'),require(_0xf8b5('0x8c')));_0x4184c3[_0xf8b5('0x9')]('/api/cdr',require(_0xf8b5('0x8d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x8e'),require(_0xf8b5('0x8f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x90'),require(_0xf8b5('0x91')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x92'),require(_0xf8b5('0x93')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x94'),require(_0xf8b5('0x95')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x96'),require(_0xf8b5('0x97')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x98'),require(_0xf8b5('0x99')));_0x4184c3[_0xf8b5('0x9')]('/api/variables',require(_0xf8b5('0x9a')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x9b'),require(_0xf8b5('0x9c')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/reports',require(_0xf8b5('0x9d')));_0x4184c3[_0xf8b5('0x9')]('/api/analytics/custom_reports',require(_0xf8b5('0x9e')));_0x4184c3['use'](_0xf8b5('0x9f'),require(_0xf8b5('0xa0')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xa1'),require('./api/analyticExtractedReport'));_0x4184c3['use'](_0xf8b5('0xa2'),require(_0xf8b5('0xa3')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xa4'),require(_0xf8b5('0xa5')));_0x4184c3[_0xf8b5('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/salesforce/accounts',require(_0xf8b5('0xa6')));_0x4184c3['use'](_0xf8b5('0xa7'),require(_0xf8b5('0xa8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xa9'),require(_0xf8b5('0xaa')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xab'),require(_0xf8b5('0xac')));_0x4184c3['use'](_0xf8b5('0xad'),require(_0xf8b5('0xae')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/sugarcrm/fields',require(_0xf8b5('0xaf')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb0'),require(_0xf8b5('0xb1')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb2'),require('./api/intDeskConfiguration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb3'),require('./api/intDeskField'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb4'),require(_0xf8b5('0xb5')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb6'),require(_0xf8b5('0xb7')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/zoho/fields',require(_0xf8b5('0xb8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xb9'),require(_0xf8b5('0xba')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xbb'),require('./api/intZendeskConfiguration'));_0x4184c3['use'](_0xf8b5('0xbc'),require(_0xf8b5('0xbd')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xbe'),require(_0xf8b5('0xbf')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc0'),require('./api/intFreshdeskConfiguration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc1'),require(_0xf8b5('0xc2')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc3'),require(_0xf8b5('0xc4')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc5'),require('./api/intVtigerConfiguration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc6'),require(_0xf8b5('0xc7')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xc8'),require('./api/intServicenowAccount'));_0x4184c3['use'](_0xf8b5('0xc9'),require(_0xf8b5('0xca')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/servicenow/fields',require(_0xf8b5('0xcb')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xcc'),require(_0xf8b5('0xcd')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xce'),require(_0xf8b5('0xcf')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd0'),require(_0xf8b5('0xd1')));_0x4184c3[_0xf8b5('0x9')]('/api/integrations/freshsales/configurations',require(_0xf8b5('0xd2')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd3'),require(_0xf8b5('0xd4')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd5'),require(_0xf8b5('0xd6')));_0x4184c3['use'](_0xf8b5('0xd7'),require(_0xf8b5('0xd8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xd9'),require(_0xf8b5('0xda')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xdb'),require(_0xf8b5('0xdc')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xdd'),require(_0xf8b5('0xde')));_0x4184c3['use'](_0xf8b5('0xdf'),require(_0xf8b5('0xe0')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe1'),require(_0xf8b5('0xe2')));_0x4184c3[_0xf8b5('0x9')]('/api/square/reports',require(_0xf8b5('0xe3')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe4'),require(_0xf8b5('0xe5')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe6'),require(_0xf8b5('0xe7')));_0x4184c3[_0xf8b5('0x9')]('/api/settings',require(_0xf8b5('0xe8')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xe9'),require(_0xf8b5('0xea')));_0x4184c3['use'](_0xf8b5('0xeb'),require('./api/squareProject'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xec'),require(_0xf8b5('0xed')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xee'),require('./api/squareMessage'));_0x4184c3['use'](_0xf8b5('0xef'),require(_0xf8b5('0xf0')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xf1'),require(_0xf8b5('0xf2')));_0x4184c3['use'](_0xf8b5('0xf3'),require(_0xf8b5('0xf4')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xf5'),require('./api/migration'));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xf6'),require(_0xf8b5('0xf7')));_0x4184c3[_0xf8b5('0x9')]('/api/plugins',require(_0xf8b5('0xf8')));_0x4184c3['use']('/api/mail/reports/transfer',require(_0xf8b5('0xf9')));_0x4184c3[_0xf8b5('0x9')]('/api/chat/reports/transfer',require(_0xf8b5('0xfa')));_0x4184c3['use'](_0xf8b5('0xfb'),require(_0xf8b5('0xfc')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xfd'),require(_0xf8b5('0xfe')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0xff'),require(_0xf8b5('0x100')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x101'),require(_0xf8b5('0x102')));_0x4184c3['use'](_0xf8b5('0x103'),require(_0xf8b5('0x104')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x105'),require(_0xf8b5('0x106')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x107'),require(_0xf8b5('0x108')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x109'),require(_0xf8b5('0x10a')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x10b'),require(_0xf8b5('0x10c')));_0x4184c3[_0xf8b5('0x9')]('/api/whatsapp/accounts',require(_0xf8b5('0x10d')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x10e'),require(_0xf8b5('0x10f')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x110'),require(_0xf8b5('0x111')));_0x4184c3[_0xf8b5('0x9')]('/api/whatsapp/messages',require(_0xf8b5('0x112')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x113'),require(_0xf8b5('0x114')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x115'),require(_0xf8b5('0x116')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x117'),require('./api/whatsappQueue'));_0x4184c3['use']('/api/cloudProviders',require(_0xf8b5('0x118')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x119'),require(_0xf8b5('0x11a')));_0x4184c3['use']('/api/auth/local',require(_0xf8b5('0x11b')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x11c'),require(_0xf8b5('0x11d')));_0x4184c3['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x4184c3['use'](_0xf8b5('0x11e'),require(_0xf8b5('0x11f')));_0x4184c3[_0xf8b5('0x9')]('/api/rpc',require(_0xf8b5('0x120')));_0x4184c3['use']('/api/version',require(_0xf8b5('0x121')));_0x4184c3['use'](_0xf8b5('0x122'),require('./api/system'));_0x4184c3['use'](_0xf8b5('0x123'),require(_0xf8b5('0x124')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x125'),require(_0xf8b5('0x126')));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x127'),express['static'](path[_0xf8b5('0x128')](config['root'],'/apidoc')));_0x4184c3['use'](_0xf8b5('0x129'),express[_0xf8b5('0x12a')](path[_0xf8b5('0x128')](config[_0xf8b5('0x12b')],_0xf8b5('0x129'))));_0x4184c3['use']('/demo',express[_0xf8b5('0x12a')](path['join'](config['root'],_0xf8b5('0x12c'))));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x12d'),express['static'](path[_0xf8b5('0x128')](config[_0xf8b5('0x12b')],'snippet',_0xf8b5('0x12e'))));_0x4184c3[_0xf8b5('0x9')](_0xf8b5('0x12f'),express[_0xf8b5('0x12a')](path[_0xf8b5('0x128')](config[_0xf8b5('0x12b')],_0xf8b5('0x130'))));_0x4184c3[_0xf8b5('0x131')](_0xf8b5('0x132'))[_0xf8b5('0x133')](errors[0x194]);_0x4184c3[_0xf8b5('0x131')]('/*')[_0xf8b5('0x133')](function(_0x4c4e4c,_0x3ec6ac){_0x3ec6ac[_0xf8b5('0x134')](path[_0xf8b5('0x135')](_0x4184c3[_0xf8b5('0x133')](_0xf8b5('0x136'))+'/index.html'));});};var sensitiveFields=[_0xf8b5('0x137'),'password','newPassword',_0xf8b5('0x138'),_0xf8b5('0x139'),_0xf8b5('0x13a'),_0xf8b5('0x13b'),_0xf8b5('0x13c'),'mobile',_0xf8b5('0x13d'),'email',_0xf8b5('0x13e'),_0xf8b5('0x13f'),'securityToken',_0xf8b5('0x140'),_0xf8b5('0x141'),_0xf8b5('0x142'),_0xf8b5('0x143'),_0xf8b5('0x144'),_0xf8b5('0x145'),'accessTokenSecret',_0xf8b5('0x146'),'consumerKey','consumerSecret',_0xf8b5('0x147'),_0xf8b5('0x148'),_0xf8b5('0x149'),_0xf8b5('0x14a'),'vidaooApiKey','clientEmail',_0xf8b5('0x14b'),'accesskeyid',_0xf8b5('0x14c'),'key','user',_0xf8b5('0x14d'),_0xf8b5('0x14e'),_0xf8b5('0x14f'),_0xf8b5('0x150'),_0xf8b5('0x151'),_0xf8b5('0x152'),_0xf8b5('0x153')];function maskSensitiveData(_0x56a210){var _0x50dc91=/(?!^)[\s\S](?!$)/g;if(!_[_0xf8b5('0x154')](_0x56a210))return;for(var _0x2c826c in _0x56a210){if(_[_0xf8b5('0x155')](_0x56a210[_0x2c826c])){for(var _0x1efec0=0x0;_0x1efec0<_0x56a210[_0x2c826c][_0xf8b5('0x156')];_0x1efec0++){maskSensitiveData(_0x56a210[_0x2c826c][_0x1efec0]);}}else if(_[_0xf8b5('0x154')](_0x56a210[_0x2c826c])){maskSensitiveData(_0x56a210[_0x2c826c]);}else if(_['isString'](_0x56a210[_0x2c826c])){_0x56a210[_0x2c826c]=_0x56a210[_0x2c826c][_0xf8b5('0x157')](/{{{/g,_0xf8b5('0x158'))[_0xf8b5('0x157')](/}}}/g,'}@@')[_0xf8b5('0x157')](/{{/g,'@{')[_0xf8b5('0x157')](/}}/g,'}@');if(_[_0xf8b5('0x159')](sensitiveFields,_0x2c826c)){_0x56a210[_0x2c826c]=_0x56a210[_0x2c826c]['replace'](_0x50dc91,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 523b826..efd7543 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eaf=['http','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/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/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server'];(function(_0x3aabae,_0xacde4d){var _0x5b6c71=function(_0x3afb7b){while(--_0x3afb7b){_0x3aabae['push'](_0x3aabae['shift']());}};_0x5b6c71(++_0xacde4d);}(_0x3eaf,0xa3));var _0xf3ea=function(_0x56372d,_0x2fa345){_0x56372d=_0x56372d-0x0;var _0xeef899=_0x3eaf[_0x56372d];return _0xeef899;};'use strict';var jayson=require(_0xf3ea('0x0'));var BPromise=require(_0xf3ea('0x1'));var _=require(_0xf3ea('0x2'));var config=require(_0xf3ea('0x3'));exports[_0xf3ea('0x4')]=function(){return new BPromise(function(_0x2b80e8,_0x4abc34){var _0x352a65={};_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/user/user.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x6')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x7')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x8')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x9')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0xa')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0xb')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0xc')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0xd')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0xe')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0xf')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x10')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x11')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/mailAccount/mailAccount.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x12')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/mailInteraction/mailInteraction.rpc'));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x13')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x14')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x15')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x16')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x17')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/faxInteraction/faxInteraction.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x18')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/faxQueue/faxQueue.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x19')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x1a')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x1b')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x1c')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x1d')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x1e')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x1f')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/chatInteraction/chatInteraction.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x20')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x21')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x22')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x23')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x24')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x25')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x26')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x27')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x28')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x29')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x2a')));_0x352a65=_['merge'](_0x352a65,require('../api/variable/variable.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x2b')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x2c')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x2d')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x2e')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x2f')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x30')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x31')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x32')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x33')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x34')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require('../api/squareReport/squareReport.rpc'));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x35')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x36')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x37')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x38')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x39')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x3a')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x3b')));_0x352a65=_['merge'](_0x352a65,require(_0xf3ea('0x3c')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x3d')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x3e')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x3f')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x40')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x41')));_0x352a65=_[_0xf3ea('0x5')](_0x352a65,require(_0xf3ea('0x42')));var _0x12443d=jayson[_0xf3ea('0x43')](_0x352a65)[_0xf3ea('0x44')]();var _0x3b498b=config['rpc'][_0xf3ea('0x45')]||config[_0xf3ea('0x45')]+0x1;var _0xa2f315=config['rpc']['ip']||_0xf3ea('0x46');_0x12443d['on'](_0xf3ea('0x47'),function(_0x4e64c2){return _0x4abc34(_0x4e64c2);});_0x12443d[_0xf3ea('0x4')](_0x3b498b,_0xa2f315,function(){console[_0xf3ea('0x48')](_0xf3ea('0x49'),_0xa2f315,_0x3b498b);require(_0xf3ea('0x4a'))[_0xf3ea('0x4b')]();return _0x2b80e8(_0xf3ea('0x4c')+_0xa2f315+':'+_0x3b498b);});});}; \ No newline at end of file +var _0x7c4f=['../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/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/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7c4f,0x12a));var _0xf7c4=function(_0x146c2b,_0x5ec1bf){_0x146c2b=_0x146c2b-0x0;var _0x794d=_0x7c4f[_0x146c2b];return _0x794d;};'use strict';var jayson=require(_0xf7c4('0x0'));var BPromise=require('bluebird');var _=require(_0xf7c4('0x1'));var config=require(_0xf7c4('0x2'));exports[_0xf7c4('0x3')]=function(){return new BPromise(function(_0x1ace7e,_0x4711dd){var _0x5392d7={};_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x5')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x6')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x7')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x8')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x9')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xa')));_0x5392d7=_['merge'](_0x5392d7,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xb')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0xc')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0xd')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xe')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0xf')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x10')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x11')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x12')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x13')));_0x5392d7=_['merge'](_0x5392d7,require('../api/mailApplication/mailApplication.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x14')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x15')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x16')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x17')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x18')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x19')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1a')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1b')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/smsInteraction/smsInteraction.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1c')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/smsQueue/smsQueue.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x1d')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x1e')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x1f')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x20')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x21')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x22')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x23')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x24')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/cmHopper/cmHopper.rpc'));_0x5392d7=_['merge'](_0x5392d7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x25')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x26')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x27')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x28')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x29')));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x2a')));_0x5392d7=_['merge'](_0x5392d7,require('../api/variable/variable.rpc'));_0x5392d7=_['merge'](_0x5392d7,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2b')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2c')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2d')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2e')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x2f')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x30')));_0x5392d7=_['merge'](_0x5392d7,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x31')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5392d7=_['merge'](_0x5392d7,require(_0xf7c4('0x32')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareReport/squareReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x33')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/setting/setting.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x34')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareProject/squareProject.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareRecording/squareRecording.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/squareMessage/squareMessage.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x35')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x36')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x37')));_0x5392d7=_['merge'](_0x5392d7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x38')));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5392d7=_[_0xf7c4('0x4')](_0x5392d7,require(_0xf7c4('0x39')));var _0x4115fa=jayson['server'](_0x5392d7)[_0xf7c4('0x3a')]();var _0x334a00=config[_0xf7c4('0x3b')][_0xf7c4('0x3c')]||config['port']+0x1;var _0x17da63=config[_0xf7c4('0x3b')]['ip']||_0xf7c4('0x3d');_0x4115fa['on'](_0xf7c4('0x3e'),function(_0x3300ab){return _0x4711dd(_0x3300ab);});_0x4115fa[_0xf7c4('0x3')](_0x334a00,_0x17da63,function(){console[_0xf7c4('0x3f')](_0xf7c4('0x40'),_0x17da63,_0x334a00);require(_0xf7c4('0x41'))['default']();return _0x1ace7e('RPC\x20listening\x20on\x20'+_0x17da63+':'+_0x334a00);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 63fcced..06bb234 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['replace','isArray','map','isPlainObject','reduce','exports','lodash','\x20}\x20}','string'];(function(_0x3b31d2,_0x5291f0){var _0x31cb66=function(_0x23dd9b){while(--_0x23dd9b){_0x3b31d2['push'](_0x3b31d2['shift']());}};_0x31cb66(++_0x5291f0);}(_0xefda,0x96));var _0xaefd=function(_0x8beb3f,_0x82e63e){_0x8beb3f=_0x8beb3f-0x0;var _0x237be4=_0xefda[_0x8beb3f];return _0x237be4;};var _=require(_0xaefd('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4ae616){return _0x4ae616==='{{'?'{\x20{\x20':_0xaefd('0x1');}function safeTemplate(_0x2ccc67){var _0x4ae272=_0x2ccc67;if(typeof _0x2ccc67===_0xaefd('0x2')){_0x4ae272=_0x2ccc67[_0xaefd('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xaefd('0x4')](_0x2ccc67)){_0x4ae272=_0x2ccc67[_0xaefd('0x5')](function(_0x1ef6b4){return safeTemplate(_0x1ef6b4);});}else if(_[_0xaefd('0x6')](_0x2ccc67)){_0x4ae272=Object['keys'](_0x2ccc67)[_0xaefd('0x7')](function(_0x3b9736,_0x24d10c){_0x3b9736[_0x24d10c]=safeTemplate(_0x2ccc67[_0x24d10c]);return _0x3b9736;},{});}return _0x4ae272;}module[_0xaefd('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xd4a2=['exports','safeTemplate','lodash','\x20}\x20}','replace','map','isPlainObject','keys','reduce'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd4a2,0x173));var _0x2d4a=function(_0x26a62d,_0x4faecc){_0x26a62d=_0x26a62d-0x0;var _0x27b1d3=_0xd4a2[_0x26a62d];return _0x27b1d3;};var _=require(_0x2d4a('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5d70e1){return _0x5d70e1==='{{'?'{\x20{\x20':_0x2d4a('0x1');}function safeTemplate(_0x576ffe){var _0x2a8a71=_0x576ffe;if(typeof _0x576ffe==='string'){_0x2a8a71=_0x576ffe[_0x2d4a('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x576ffe)){_0x2a8a71=_0x576ffe[_0x2d4a('0x3')](function(_0x40d744){return safeTemplate(_0x40d744);});}else if(_[_0x2d4a('0x4')](_0x576ffe)){_0x2a8a71=Object[_0x2d4a('0x5')](_0x576ffe)[_0x2d4a('0x6')](function(_0x57058f,_0x45fefb){_0x57058f[_0x45fefb]=safeTemplate(_0x576ffe[_0x45fefb]);return _0x57058f;},{});}return _0x2a8a71;}module[_0x2d4a('0x7')][_0x2d4a('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index ee3b74a..205a43b 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 _0x3c6a=['emit','ready','line','hangup','substring','520-Invalid','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','command','function','write','close','destroy','inherits','sendRequest','sync','prototype','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','format','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x3c6a[_0x450689];return _0x46ffb0;};'use strict';var util=require('util');var _=require(_0xa3c6('0x0'));var EventEmitter=require(_0xa3c6('0x1'))[_0xa3c6('0x2')];var AGIReply=require(_0xa3c6('0x3'));var AGIError=require(_0xa3c6('0x4'));function AGIChannel(_0x216afa){var _0x280c81=this,_0x8addc2=new AGIReply(),_0xc6a73b=![],_0x3392c5={};EventEmitter[_0xa3c6('0x5')](_0x280c81);_0x216afa['setEncoding'](_0xa3c6('0x6'));_0x216afa[_0xa3c6('0x7')](0x8*0x3c*0x3c*0x3e8);_0x8addc2[_0xa3c6('0x8')](_0xa3c6('0x6'));_0x8addc2['on'](_0xa3c6('0x9'),function(_0xa4d22){for(var _0x3eb474 in _0xa4d22){_0x280c81[_0x3eb474]=_0xa4d22[_0x3eb474];}_0x280c81[_0xa3c6('0xa')](_0xa3c6('0xb'));});_0x8addc2['on'](_0xa3c6('0xc'),function(_0xa5da8c){if(_0xa5da8c['toLowerCase']()==_0xa3c6('0xd')){_0x280c81['emit'](_0xa3c6('0xd'));return;}if(_0xa5da8c[_0xa3c6('0xe')](0x0,0xb)==_0xa3c6('0xf')){_0xc6a73b=!![];}if(_0xc6a73b){_0x3392c5['rx']+=_0xa5da8c+'\x0a';if(_0xa5da8c['search']('520\x20End\x20of\x20proper')!=-0x1){_0xc6a73b=![];}}else{_0x3392c5['rx']=_0xa5da8c;}if(_0xc6a73b){return;}if(typeof _0x3392c5['cb']=='function'){var _0x3f17c2=_0x3392c5['rx'][_0xa3c6('0xe')](0x0,0x3),_0x53dcba=null,_0x24b8ae=null;_0x3f17c2=parseInt(_0x3f17c2);if(isNaN(_0x3f17c2)){_0x3392c5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa3c6('0x10')});return;}if(_0x3f17c2!=0xc8){_0x3392c5['cb'](null,{'code':_0x3f17c2,'result':-0x1,'extra':'KO'});return;}_0x53dcba=_0x3392c5['rx'][_0xa3c6('0xe')](0x4)[_0xa3c6('0x11')](_0xa3c6('0x12'),'');if(_0x53dcba[_0xa3c6('0x13')]('\x20')!=-0x1){_0x53dcba=_0x53dcba['substr'](0x0,_0x53dcba[_0xa3c6('0x13')]('\x20'));}if(_[_0xa3c6('0x14')](_0x53dcba,'-1')){_0x53dcba=parseInt(_0x53dcba);}_0x24b8ae=_0x3392c5['rx'][_0xa3c6('0x15')]('\x20');if(_0x24b8ae['length']==0x3){_0x24b8ae=_0x24b8ae[0x2][_0xa3c6('0xe')](0x1,_0x24b8ae[0x2]['length']-0x1);}else if(_0x24b8ae[_0xa3c6('0x16')]>0x3){var _0x4ad5dc=/\((.+)\)/;var _0x364289=_0x3392c5['rx'][_0xa3c6('0x17')](_0x4ad5dc);if(_0x364289){_0x24b8ae=_0x364289[0x1];}else{_0x24b8ae=null;}}else{_0x24b8ae=null;}_0x3392c5['cb'](null,{'code':_0x3f17c2,'result':_0x53dcba,'extra':_0x24b8ae});}});_0x216afa['on'](_0xa3c6('0x18'),function(_0x217d82){_0x280c81[_0xa3c6('0xa')](_0xa3c6('0x18'),new AGIError(_0xa3c6('0x19'),_0x217d82[_0xa3c6('0x1a')]));});_0x216afa['on']('close',function(){_0x280c81[_0xa3c6('0xa')]('close',new AGIError(_0xa3c6('0x1b')));});_0x216afa['on'](_0xa3c6('0x1c'),function(){_0x280c81[_0xa3c6('0xa')](_0xa3c6('0x1c'),new AGIError(_0xa3c6('0x1d')));_0x216afa['destroy']();});_0x216afa['pipe'](_0x8addc2);this[_0xa3c6('0x1e')]=function(_0x5c9c2c,_0x5403b1){var _0x5c9c2c=_0x5c9c2c||'',_0x5403b1=typeof _0x5403b1==_0xa3c6('0x1f')?_0x5403b1:new Function();_0x3392c5={'tx':_0x5c9c2c,'rx':'','cb':_0x5403b1};_0x216afa[_0xa3c6('0x20')](_0x5c9c2c+'\x0a');},this[_0xa3c6('0x21')]=function(){_0x216afa[_0xa3c6('0x22')]();};}util[_0xa3c6('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xa3c6('0x24')]=function(_0x92b3fb){return this[_0xa3c6('0x1e')][_0xa3c6('0x25')](this,_0x92b3fb);};AGIChannel[_0xa3c6('0x26')]['answer']=function(){return this['sendRequest'](_0xa3c6('0x27'));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x28')]=function(_0x5731d9,_0x55c9e7,_0x1394f3){_0x5731d9=_0x5731d9===undefined?'beep':_0x5731d9;_0x55c9e7=_0x55c9e7===undefined?'5':_0x55c9e7;_0x1394f3=_0x1394f3===undefined?'1':_0x1394f3;return this[_0xa3c6('0x24')](util['format'](_0xa3c6('0x29'),_0x5731d9,_0x55c9e7*0x3e8,_0x1394f3));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x2a')]=function(_0x14aa2b){_0x14aa2b=_0x14aa2b||_0xa3c6('0x2b');return this[_0xa3c6('0x24')](util['format'](_0xa3c6('0x2c'),_0x14aa2b));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x2d')]=function(_0x412fc1,_0x33c5d){if(_[_0xa3c6('0x2e')](_0x33c5d)){return this['sendRequest'](util[_0xa3c6('0x2f')]('EXEC\x20%s\x20%s',_0x412fc1,_0x33c5d['join'](',')));}return this['sendRequest'](util[_0xa3c6('0x2f')](_0xa3c6('0x30'),_0x412fc1,_0x33c5d));};AGIChannel[_0xa3c6('0x26')]['setContext']=function(_0x1e1876){return this['sendRequest'](util[_0xa3c6('0x2f')]('SET\x20CONTEXT\x20%s',_0x1e1876));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x31')]=function(_0x3dc775){return this[_0xa3c6('0x24')](util[_0xa3c6('0x2f')](_0xa3c6('0x32'),_0x3dc775));};AGIChannel[_0xa3c6('0x26')]['setPriority']=function(_0x5b0a02){return this[_0xa3c6('0x24')](util[_0xa3c6('0x2f')](_0xa3c6('0x33'),_0x5b0a02));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0xd')]=function(){return this[_0xa3c6('0x24')](_0xa3c6('0x34'));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x35')]=function(_0x2fea57,_0x451f90){var _0x4329b3=_[_0xa3c6('0x36')](_0x451f90)||_[_0xa3c6('0x37')](_0x451f90)?_0x451f90[_0xa3c6('0x38')]():_0x451f90;return this[_0xa3c6('0x24')](util[_0xa3c6('0x2f')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2fea57,_0x4329b3?_0x4329b3[_0xa3c6('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa3c6('0x39')]=function(_0x5896cd,_0x35603e){return this['sendRequest'](util[_0xa3c6('0x2f')](_0xa3c6('0x3a'),_0x5896cd,_0x35603e));};AGIChannel['prototype'][_0xa3c6('0x3b')]=function(_0x3b082a,_0x382b38){return this[_0xa3c6('0x24')](util[_0xa3c6('0x2f')](_0xa3c6('0x3c'),_0x3b082a,_0x382b38));};AGIChannel['prototype']['sayPhonetic']=function(_0x35b2f3,_0x3ea3c1){return this[_0xa3c6('0x24')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x35b2f3,_0x3ea3c1));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x3d')]=function(_0x49e2a9,_0x1a9c9a,_0x5c6a37){_0x1a9c9a=_0x1a9c9a||this[_0xa3c6('0x3e')];_0x5c6a37=_0x5c6a37||0x1;this['setContext'](_0x49e2a9);this[_0xa3c6('0x31')](_0x1a9c9a);this['setPriority'](_0x5c6a37);return this[_0xa3c6('0x2a')](util[_0xa3c6('0x2f')]('GOTO\x20%s\x20%s\x20%s',_0x49e2a9,_0x1a9c9a,_0x5c6a37));};AGIChannel[_0xa3c6('0x26')]['getVariable']=function(_0x9601a8){return this['sendRequest'](util[_0xa3c6('0x2f')](_0xa3c6('0x3f'),_0x9601a8));};AGIChannel[_0xa3c6('0x26')]['recordFile']=function(_0xb8ca63,_0x4da165,_0x4b9489,_0x172578,_0x5ecd1a,_0x1b3870){_0x4da165=_0x4da165||_0xa3c6('0x40');_0x4b9489=_0x4b9489||'';_0x172578=_0x172578===undefined?-0x1:_0x172578==='-1'?-0x1:_0x172578*0x3e8;_0x5ecd1a=_0x5ecd1a===undefined?'':'s='+_0x5ecd1a;_0x1b3870=_0x1b3870?_0xa3c6('0x41'):'';return this[_0xa3c6('0x24')](util[_0xa3c6('0x2f')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xb8ca63,_0x4da165,_0x4b9489,_0x172578,_0x1b3870,_0x5ecd1a));};AGIChannel['prototype']['streamFile']=function(_0x25423d,_0x2ed918){_0x2ed918=_0x2ed918||'';return this['sendRequest'](util[_0xa3c6('0x2f')](_0xa3c6('0x42'),_0x25423d,_0x2ed918));};AGIChannel[_0xa3c6('0x26')][_0xa3c6('0x43')]=function(_0x2c9d01){return this[_0xa3c6('0x2d')](_0xa3c6('0x44'),_0x2c9d01);};AGIChannel['prototype']['wait']=function(_0x360d67){return this['exec'](_0xa3c6('0x45'),_0x360d67);};AGIChannel[_0xa3c6('0x26')]['error']=function(_0x329f06,_0x54a61f){this[_0xa3c6('0x2a')](util[_0xa3c6('0x2f')](_0xa3c6('0x46'),_0x329f06['id'],_0x329f06[_0xa3c6('0x47')],_0x54a61f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa3c6('0x48')]=AGIChannel; \ No newline at end of file +var _0x74d3=['E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','answer','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','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','continueAt','extension','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','setEncoding','utf8','setTimeout','headers','ready','line','hangup','substring','520-Invalid','no\x20code','replace','substr','startsWith','split','length','error','emit','E_AGI_SOCKET_ERROR','code','close','timeout'];(function(_0x319db5,_0x689330){var _0x1ebde2=function(_0x5efdc4){while(--_0x5efdc4){_0x319db5['push'](_0x319db5['shift']());}};_0x1ebde2(++_0x689330);}(_0x74d3,0x159));var _0x374d=function(_0x441380,_0x73cd00){_0x441380=_0x441380-0x0;var _0x3cc38b=_0x74d3[_0x441380];return _0x3cc38b;};'use strict';var util=require(_0x374d('0x0'));var _=require(_0x374d('0x1'));var EventEmitter=require(_0x374d('0x2'))['EventEmitter'];var AGIReply=require(_0x374d('0x3'));var AGIError=require('./error');function AGIChannel(_0x356a4e){var _0x9f6268=this,_0x1a79ae=new AGIReply(),_0x5e7908=![],_0x2ef1fc={};EventEmitter['call'](_0x9f6268);_0x356a4e[_0x374d('0x4')](_0x374d('0x5'));_0x356a4e[_0x374d('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1a79ae['setEncoding'](_0x374d('0x5'));_0x1a79ae['on'](_0x374d('0x7'),function(_0x3668d1){for(var _0x5f400f in _0x3668d1){_0x9f6268[_0x5f400f]=_0x3668d1[_0x5f400f];}_0x9f6268['emit'](_0x374d('0x8'));});_0x1a79ae['on'](_0x374d('0x9'),function(_0x44fb2f){if(_0x44fb2f['toLowerCase']()=='hangup'){_0x9f6268['emit'](_0x374d('0xa'));return;}if(_0x44fb2f[_0x374d('0xb')](0x0,0xb)==_0x374d('0xc')){_0x5e7908=!![];}if(_0x5e7908){_0x2ef1fc['rx']+=_0x44fb2f+'\x0a';if(_0x44fb2f['search']('520\x20End\x20of\x20proper')!=-0x1){_0x5e7908=![];}}else{_0x2ef1fc['rx']=_0x44fb2f;}if(_0x5e7908){return;}if(typeof _0x2ef1fc['cb']=='function'){var _0x18cb16=_0x2ef1fc['rx'][_0x374d('0xb')](0x0,0x3),_0x40b492=null,_0x412286=null;_0x18cb16=parseInt(_0x18cb16);if(isNaN(_0x18cb16)){_0x2ef1fc['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x374d('0xd')});return;}if(_0x18cb16!=0xc8){_0x2ef1fc['cb'](null,{'code':_0x18cb16,'result':-0x1,'extra':'KO'});return;}_0x40b492=_0x2ef1fc['rx'][_0x374d('0xb')](0x4)[_0x374d('0xe')]('result=','');if(_0x40b492['indexOf']('\x20')!=-0x1){_0x40b492=_0x40b492[_0x374d('0xf')](0x0,_0x40b492['indexOf']('\x20'));}if(_[_0x374d('0x10')](_0x40b492,'-1')){_0x40b492=parseInt(_0x40b492);}_0x412286=_0x2ef1fc['rx'][_0x374d('0x11')]('\x20');if(_0x412286[_0x374d('0x12')]==0x3){_0x412286=_0x412286[0x2][_0x374d('0xb')](0x1,_0x412286[0x2][_0x374d('0x12')]-0x1);}else if(_0x412286['length']>0x3){var _0x27651f=/\((.+)\)/;var _0x18776c=_0x2ef1fc['rx']['match'](_0x27651f);if(_0x18776c){_0x412286=_0x18776c[0x1];}else{_0x412286=null;}}else{_0x412286=null;}_0x2ef1fc['cb'](null,{'code':_0x18cb16,'result':_0x40b492,'extra':_0x412286});}});_0x356a4e['on'](_0x374d('0x13'),function(_0x323c53){_0x9f6268[_0x374d('0x14')](_0x374d('0x13'),new AGIError(_0x374d('0x15'),_0x323c53[_0x374d('0x16')]));});_0x356a4e['on'](_0x374d('0x17'),function(){_0x9f6268['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x356a4e['on'](_0x374d('0x18'),function(){_0x9f6268[_0x374d('0x14')]('timeout',new AGIError(_0x374d('0x19')));_0x356a4e[_0x374d('0x1a')]();});_0x356a4e[_0x374d('0x1b')](_0x1a79ae);this[_0x374d('0x1c')]=function(_0x3ecfc0,_0x32b865){var _0x3ecfc0=_0x3ecfc0||'',_0x32b865=typeof _0x32b865==_0x374d('0x1d')?_0x32b865:new Function();_0x2ef1fc={'tx':_0x3ecfc0,'rx':'','cb':_0x32b865};_0x356a4e[_0x374d('0x1e')](_0x3ecfc0+'\x0a');},this[_0x374d('0x17')]=function(){_0x356a4e['destroy']();};}util[_0x374d('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x374d('0x20')][_0x374d('0x21')]=function(_0x58cbb1){return this[_0x374d('0x1c')][_0x374d('0x22')](this,_0x58cbb1);};AGIChannel[_0x374d('0x20')][_0x374d('0x23')]=function(){return this[_0x374d('0x21')]('ANSWER');};AGIChannel[_0x374d('0x20')]['getData']=function(_0x23c47a,_0x49a8ec,_0xd96ed9){_0x23c47a=_0x23c47a===undefined?'beep':_0x23c47a;_0x49a8ec=_0x49a8ec===undefined?'5':_0x49a8ec;_0xd96ed9=_0xd96ed9===undefined?'1':_0xd96ed9;return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x25'),_0x23c47a,_0x49a8ec*0x3e8,_0xd96ed9));};AGIChannel[_0x374d('0x20')][_0x374d('0x26')]=function(_0x322ccf){_0x322ccf=_0x322ccf||_0x374d('0x27');return this[_0x374d('0x21')](util['format'](_0x374d('0x28'),_0x322ccf));};AGIChannel[_0x374d('0x20')][_0x374d('0x29')]=function(_0x2ed03,_0x5ee217){if(_[_0x374d('0x2a')](_0x5ee217)){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x2b'),_0x2ed03,_0x5ee217[_0x374d('0x2c')](',')));}return this['sendRequest'](util[_0x374d('0x24')](_0x374d('0x2b'),_0x2ed03,_0x5ee217));};AGIChannel[_0x374d('0x20')][_0x374d('0x2d')]=function(_0x367617){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x2e'),_0x367617));};AGIChannel['prototype'][_0x374d('0x2f')]=function(_0x5df502){return this[_0x374d('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x5df502));};AGIChannel[_0x374d('0x20')][_0x374d('0x30')]=function(_0x272e89){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x31'),_0x272e89));};AGIChannel['prototype'][_0x374d('0xa')]=function(){return this[_0x374d('0x21')](_0x374d('0x32'));};AGIChannel[_0x374d('0x20')][_0x374d('0x33')]=function(_0x29e0e8,_0x39e0c3){var _0x1d3089=_[_0x374d('0x34')](_0x39e0c3)||_[_0x374d('0x35')](_0x39e0c3)?_0x39e0c3[_0x374d('0x36')]():_0x39e0c3;return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x37'),_0x29e0e8,_0x1d3089?_0x1d3089[_0x374d('0x36')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x374d('0x20')][_0x374d('0x38')]=function(_0x2a2dc2,_0x189480){return this[_0x374d('0x21')](util[_0x374d('0x24')](_0x374d('0x39'),_0x2a2dc2,_0x189480));};AGIChannel['prototype'][_0x374d('0x3a')]=function(_0x348998,_0x55dcb8){return this[_0x374d('0x21')](util['format'](_0x374d('0x3b'),_0x348998,_0x55dcb8));};AGIChannel[_0x374d('0x20')][_0x374d('0x3c')]=function(_0x5413c1,_0x58ffb2){return this[_0x374d('0x21')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x5413c1,_0x58ffb2));};AGIChannel[_0x374d('0x20')][_0x374d('0x3d')]=function(_0x4ef8fd,_0x5c658c,_0x3c324a){_0x5c658c=_0x5c658c||this[_0x374d('0x3e')];_0x3c324a=_0x3c324a||0x1;this[_0x374d('0x2d')](_0x4ef8fd);this['setExtension'](_0x5c658c);this[_0x374d('0x30')](_0x3c324a);return this['noop'](util[_0x374d('0x24')]('GOTO\x20%s\x20%s\x20%s',_0x4ef8fd,_0x5c658c,_0x3c324a));};AGIChannel['prototype']['getVariable']=function(_0x32d43b){return this[_0x374d('0x21')](util[_0x374d('0x24')]('GET\x20VARIABLE\x20\x22%s\x22',_0x32d43b));};AGIChannel[_0x374d('0x20')][_0x374d('0x3f')]=function(_0x4c8e2e,_0x43157e,_0x324793,_0x16a985,_0x51ec22,_0x277015){_0x43157e=_0x43157e||_0x374d('0x40');_0x324793=_0x324793||'';_0x16a985=_0x16a985===undefined?-0x1:_0x16a985==='-1'?-0x1:_0x16a985*0x3e8;_0x51ec22=_0x51ec22===undefined?'':'s='+_0x51ec22;_0x277015=_0x277015?_0x374d('0x41'):'';return this[_0x374d('0x21')](util['format'](_0x374d('0x42'),_0x4c8e2e,_0x43157e,_0x324793,_0x16a985,_0x277015,_0x51ec22));};AGIChannel['prototype'][_0x374d('0x43')]=function(_0x3ec703,_0x36355c){_0x36355c=_0x36355c||'';return this['sendRequest'](util[_0x374d('0x24')](_0x374d('0x44'),_0x3ec703,_0x36355c));};AGIChannel[_0x374d('0x20')][_0x374d('0x45')]=function(_0x319cba){return this[_0x374d('0x29')](_0x374d('0x46'),_0x319cba);};AGIChannel[_0x374d('0x20')]['wait']=function(_0x1b3633){return this[_0x374d('0x29')](_0x374d('0x47'),_0x1b3633);};AGIChannel[_0x374d('0x20')][_0x374d('0x13')]=function(_0x40d1f7,_0x336aef){this[_0x374d('0x26')](util['format'](_0x374d('0x48'),_0x40d1f7['id'],_0x40d1f7['label'],_0x336aef));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x374d('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 29a1ca4..ec00f36 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 _0x2df4=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x794207,_0x54a989){var _0x4ee1c9=function(_0x136ea4){while(--_0x136ea4){_0x794207['push'](_0x794207['shift']());}};_0x4ee1c9(++_0x54a989);}(_0x2df4,0x1bb));var _0x42df=function(_0x92a987,_0x4415b6){_0x92a987=_0x92a987-0x0;var _0x331f4c=_0x2df4[_0x92a987];return _0x331f4c;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x42df('0x0'),'E_AGI_ARGUMENT_PORT':_0x42df('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x42df('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x42df('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x42df('0x4'),'E_AGI_SOCKET_ERROR':_0x42df('0x5'),'E_AGI_SOCKET_CLOSE':_0x42df('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x42df('0x7'),'E_AGI_COMMAND_EMPTY':_0x42df('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x42df('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x1dd5b5){var _0x1dd5b5=_0x1dd5b5||null,_0x2288a1=_0x2288a1||[],_0x217067=0x1,_0x130dbf='';if(!error[_0x1dd5b5]){_0x1dd5b5='E_AGI_UNDEFINED';}_0x2288a1[_0x42df('0xa')](error[_0x1dd5b5]);while(arguments[_0x217067]){_0x2288a1[_0x42df('0xa')](arguments[_0x217067]);_0x217067++;}_0x130dbf=util[_0x42df('0xb')]['apply'](util,_0x2288a1);this[_0x42df('0xc')]=_0x130dbf;this[_0x42df('0xd')]=_0x1dd5b5;}module[_0x42df('0xe')]=AGIError; \ No newline at end of file +var _0x78e3=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x78e3,0xf9));var _0x378e=function(_0xaa563e,_0x3c2d87){_0xaa563e=_0xaa563e-0x0;var _0x447e64=_0x78e3[_0xaa563e];return _0x447e64;};'use strict';var util=require(_0x378e('0x0'));var error={'E_AGI_UNDEFINED':_0x378e('0x1'),'E_AGI_ARGUMENT_PORT':_0x378e('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x378e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x378e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x378e('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x378e('0x6'),'E_AGI_COMMAND_EMPTY':_0x378e('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x378e('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xdff0bc){var _0xdff0bc=_0xdff0bc||null,_0x293daf=_0x293daf||[],_0xafd35=0x1,_0x400f73='';if(!error[_0xdff0bc]){_0xdff0bc='E_AGI_UNDEFINED';}_0x293daf['push'](error[_0xdff0bc]);while(arguments[_0xafd35]){_0x293daf[_0x378e('0x9')](arguments[_0xafd35]);_0xafd35++;}_0x400f73=util[_0x378e('0xa')][_0x378e('0xb')](util,_0x293daf);this[_0x378e('0xc')]=_0x400f73;this[_0x378e('0xd')]=_0xdff0bc;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 181795b..1136adb 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 _0x31a3=['includes','max\x20retry\x20reach','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found'];(function(_0x4658be,_0x5a0158){var _0x498dfa=function(_0x40545d){while(--_0x40545d){_0x4658be['push'](_0x4658be['shift']());}};_0x498dfa(++_0x5a0158);}(_0x31a3,0x183));var _0x331a=function(_0x27cfdc,_0x484964){_0x27cfdc=_0x27cfdc-0x0;var _0x3a5be2=_0x31a3[_0x27cfdc];return _0x3a5be2;};'use strict';var _=require(_0x331a('0x0'));var logger=require(_0x331a('0x1'))(_0x331a('0x2'));var verticesWithRetry=[_0x331a('0x3'),_0x331a('0x4'),_0x331a('0x5')];var Graph=function(){this[_0x331a('0x6')]={};this[_0x331a('0x7')]={};this[_0x331a('0x8')]=0x0;};Graph[_0x331a('0x9')][_0x331a('0xa')]=function(_0x8b6134){this[_0x331a('0x6')][_0x8b6134['id']]=_0x8b6134;this[_0x331a('0x7')][_0x8b6134['id']]=[];};Graph[_0x331a('0x9')][_0x331a('0xb')]=function(_0x30de49,_0x300633,_0x51aad5){this['edges'][_0x30de49][_0x331a('0xc')]({'target':_0x300633,'condition':_0x51aad5});this[_0x331a('0x8')]+=0x1;};Graph[_0x331a('0x9')][_0x331a('0xd')]=function(){return _[_0x331a('0xd')](this[_0x331a('0x6')]);};Graph[_0x331a('0x9')][_0x331a('0xe')]=function(){return this['numberOfEdges'];};Graph[_0x331a('0x9')][_0x331a('0xf')]=function(_0x212cdf){return this[_0x331a('0x6')][_0x212cdf];};Graph[_0x331a('0x9')][_0x331a('0x10')]=function(_0x32d387,_0x19d690){if(!this[_0x331a('0x6')][_0x32d387]){return logger[_0x331a('0x11')]('no\x20vertex\x20found');}var _0x393a23=_0x19d690(this[_0x331a('0x6')][_0x32d387]);if(!_0x393a23){return logger['info'](_0x331a('0x12'));}if(this['edges'][_0x32d387][_0x331a('0x13')]===0x0){return logger[_0x331a('0x11')](_0x331a('0x14'));}for(var _0x12ab11=0x0,_0x43fde0=[],_0x56e04e=![];_0x12ab11\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','root','hasOwnProperty','retry','addVertex','omit','mxCell','length','addEdge','target','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','clear','vertex','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','continueAt','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e2,0x1ae));var _0x234e=function(_0x56ac7e,_0x5503a6){_0x56ac7e=_0x56ac7e-0x0;var _0x272b97=_0x34e2[_0x56ac7e];return _0x272b97;};'use strict';var parser=require(_0x234e('0x0'));var _=require(_0x234e('0x1'));var syncho=require(_0x234e('0x2'));var util=require(_0x234e('0x3'));var moment=require(_0x234e('0x4'));var config=require(_0x234e('0x5'));var logger=require(_0x234e('0x6'))('agi');var utilLicense=require(_0x234e('0x7'));var rpc=require('./rpc');var mailRpc=require(_0x234e('0x8'));var Graph=require(_0x234e('0x9'));var Vertices=require(_0x234e('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x234e('0xb')](config[_0x234e('0xc')],{'ip':_0x234e('0xd'),'port':0x11dd});function connectionHandler(_0x5e8ea8){process[_0x234e('0xe')](function(){syncho(function(){try{setChannelVariables(_0x5e8ea8);agiHandler(_0x5e8ea8);}catch(_0x5905ca){logger[_0x234e('0xf')](_0x5905ca[_0x234e('0x10')]);}});});}function listeningHandler(){console[_0x234e('0x11')](_0x234e('0x12'),config[_0x234e('0xc')][_0x234e('0x13')]);logger[_0x234e('0x14')](util['format'](_0x234e('0x15'),config[_0x234e('0xc')]['ip'],config[_0x234e('0xc')][_0x234e('0x13')]));}function errorHandler(_0x330527){if(_0x330527&&_0x330527[_0x234e('0x16')]&&_0x330527[_0x234e('0x17')]){logger[_0x234e('0xf')](util[_0x234e('0x18')]('[%s]\x20%s',_0x330527[_0x234e('0x16')],_0x330527['message']));}else{logger[_0x234e('0xf')](util[_0x234e('0x18')](_0x234e('0x19'),_0x330527[_0x234e('0x10')]));}}function closeHandler(){logger[_0x234e('0x14')](util[_0x234e('0x18')](_0x234e('0x1a'),this[_0x234e('0x1b')],this[_0x234e('0x1c')],this[_0x234e('0x1d')],this['dnid'],this[_0x234e('0x1e')]));try{createSquareReport(this);}catch(_0x264c08){logger['error'](_0x264c08[_0x234e('0x10')]);}}function timeoutHandler(){logger['info'](util[_0x234e('0x18')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x234e('0x1b')],this[_0x234e('0x1c')],this['callerid'],this['dnid'],this[_0x234e('0x1e')]));}function hangupHandler(){logger[_0x234e('0x14')](util[_0x234e('0x18')](_0x234e('0x1f'),this[_0x234e('0x1b')],this[_0x234e('0x1c')],this[_0x234e('0x1d')],this[_0x234e('0x20')],this[_0x234e('0x1e')]));this[_0x234e('0x21')]=!![];}function getRoot(_0x5e07d0){return parser['toJson'](_0x5e07d0,{'object':!![]})['mxGraphModel'][_0x234e('0x22')];}function addVertex(_0x15c45b,_0x4a5839,_0x5b5933){_0x4a5839['agicommand']=_0x5b5933;if(_0x4a5839[_0x234e('0x23')](_0x234e('0x24'))){_0x4a5839['maxRetry']=parseInt(_0x4a5839['retry'],0xa);}_0x15c45b[_0x234e('0x25')](_[_0x234e('0x26')](_0x4a5839,_0x234e('0x27')));}function initGraph(_0x2ddfe3,_0x2fa6b9){var _0x6cc586=new Graph();for(var _0x5ae2ad in _0x2ddfe3){if(_0x2ddfe3[_0x234e('0x23')](_0x5ae2ad)){if(_['isArray'](_0x2ddfe3[_0x5ae2ad])){for(var _0x47d9de=0x0;_0x47d9de<_0x2ddfe3[_0x5ae2ad][_0x234e('0x28')];_0x47d9de+=0x1){addVertex(_0x6cc586,_0x2ddfe3[_0x5ae2ad][_0x47d9de],_0x5ae2ad);}}else{addVertex(_0x6cc586,_0x2ddfe3[_0x5ae2ad],_0x5ae2ad);}}}for(var _0x5e7a8e=0x0;_0x5e7a8e<_0x2fa6b9['length'];_0x5e7a8e+=0x1){if(_0x2fa6b9[_0x5e7a8e]['source']&&_0x2fa6b9[_0x5e7a8e]['target']){_0x6cc586[_0x234e('0x29')](_0x2fa6b9[_0x5e7a8e]['source'],_0x2fa6b9[_0x5e7a8e][_0x234e('0x2a')],_0x2fa6b9[_0x5e7a8e]['value']);}}return _0x6cc586;}function getSquareProject(_0x7efb23,_0x5ee7c6){rpc[_0x234e('0x2b')](_0x7efb23)[_0x234e('0x2c')](function(_0xef9bfb){_0x5ee7c6(null,_0xef9bfb);})[_0x234e('0x2d')](function(_0x4d44c9){_0x5ee7c6(null,_0x4d44c9);});}function createSquareReport(_0x5cd450,_0x36d729){rpc[_0x234e('0x2e')](_0x5cd450)[_0x234e('0x2c')](function(_0x5a6238){if(_0x36d729){_0x36d729(null,_0x5a6238);}})[_0x234e('0x2d')](function(_0x4b09bf){if(_0x36d729){_0x36d729(null,_0x4b09bf);}});}function setChannelVariables(_0x5a16f6){for(var _0x1574af in _0x5a16f6){if(_0x5a16f6['hasOwnProperty'](_0x1574af)){if(_0x1574af[_0x234e('0x2f')](_0x234e('0x30'))===0x0){_0x5a16f6[_0x1574af[_0x234e('0x31')](0x4)]=_0x5a16f6[_0x1574af];delete _0x5a16f6[_0x1574af];}}}}function getLogFromObject(_0x3e6f78){return util[_0x234e('0x32')](_0x3e6f78,{'showHidden':![],'depth':null});}function agiHandler(_0x180443){var _0x58b5c3,_0x140d2c,_0x5243df,_0x2038e6,_0x2f64e9;logger[_0x234e('0x33')]('variables',JSON['stringify'](_0x180443,null,0x2));logger['info'](util[_0x234e('0x18')](_0x234e('0x34'),_0x180443[_0x234e('0x1b')],_0x180443[_0x234e('0x1c')],_0x180443['callerid'],_0x180443[_0x234e('0x20')],_0x180443['uniqueid']));_0x180443['on'](_0x234e('0xf'),errorHandler);_0x180443['on'](_0x234e('0x35'),closeHandler);_0x180443['on'](_0x234e('0x36'),timeoutHandler);_0x180443[_0x234e('0x21')]=![];_0x180443['on'](_0x234e('0x37'),hangupHandler);var _0x387fe4=getSquareProject[_0x234e('0x38')](null,_0x180443[_0x234e('0x1b')]);if(_0x387fe4){if(_0x387fe4[_0x234e('0x39')]){_0x58b5c3=getRoot(_0x387fe4[_0x234e('0x39')]);if(_0x58b5c3&&_0x58b5c3[_0x234e('0x3a')]){logger[_0x234e('0x33')]('root',JSON[_0x234e('0x3b')](_0x58b5c3,null,0x2));_0x180443[_0x234e('0x3c')]=moment()[_0x234e('0x18')](_0x234e('0x3d'));_0x140d2c=initGraph(_[_0x234e('0x26')](_0x58b5c3,_0x234e('0x27')),_0x58b5c3['mxCell']);_0x5243df=new Vertices(_0x180443,rpc,mailRpc);logger['info'](util[_0x234e('0x18')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x180443[_0x234e('0x1b')],_0x180443[_0x234e('0x1c')],_0x180443['callerid'],_0x180443[_0x234e('0x20')],_0x180443[_0x234e('0x1e')]));_0x140d2c['traverseBFS'](_0x58b5c3['start']['id'],function(_0x5b98c5){try{_0x5b98c5=_0x5243df[_0x234e('0x3e')](_0x5b98c5);logger[_0x234e('0x33')](_0x234e('0x3f'),JSON['stringify'](_0x5b98c5,null,0x2));if(_0x5b98c5[_0x234e('0x40')]==='gotoc'){logger[_0x234e('0x14')](_0x234e('0x41'));_0x180443['context']=_0x5b98c5[_0x234e('0x42')]||_0x180443[_0x234e('0x42')];_0x180443[_0x234e('0x43')]=_0x5b98c5[_0x234e('0x43')];_0x180443[_0x234e('0x44')]=_0x5b98c5[_0x234e('0x44')]?_0x5b98c5[_0x234e('0x44')]-0x1:0x1;return null;}else if(_0x5b98c5&&_0x5243df[_0x5b98c5[_0x234e('0x40')]]){_0x2f64e9=_0x5243df[_0x5b98c5[_0x234e('0x40')]](_0x5b98c5);logger[_0x234e('0x14')](_0x234e('0x45'),JSON[_0x234e('0x3b')](_0x2f64e9,null,0x2));if(_0x2f64e9&&_0x2f64e9['code']===AGI_CODE_SUCCESS&&_0x2f64e9[_0x234e('0x46')]!==AGI_RESULT_ERROR&&!_0x180443['evtHangup']){logger[_0x234e('0x33')](_0x234e('0x45'),getLogFromObject(_0x2f64e9));return _[_0x234e('0x47')](_0x2f64e9[_0x234e('0x46')])?null:_0x2f64e9[_0x234e('0x46')][_0x234e('0x48')]();}else{logger['error'](_0x234e('0x45'),getLogFromObject(_0x2f64e9));return null;}}else{logger[_0x234e('0xf')](_0x234e('0x49'));return null;}}catch(_0x1f2983){logger['error'](_0x1f2983[_0x234e('0x10')]);return null;}});if(_0x58b5c3['finally']){logger[_0x234e('0x14')](util[_0x234e('0x18')](_0x234e('0x4a'),_0x180443[_0x234e('0x1b')],_0x180443[_0x234e('0x1c')],_0x180443[_0x234e('0x1d')],_0x180443[_0x234e('0x20')],_0x180443[_0x234e('0x1e')]));_0x140d2c[_0x234e('0x4b')](_0x58b5c3[_0x234e('0x4c')]['id'],function(_0x34ff0c){try{_0x34ff0c=_0x5243df[_0x234e('0x3e')](_0x34ff0c);logger['debug'](_0x234e('0x3f'),JSON[_0x234e('0x3b')](_0x34ff0c,null,0x2));if(_0x34ff0c&&_0x5243df[_0x34ff0c[_0x234e('0x40')]]){_0x2f64e9=_0x5243df[_0x34ff0c[_0x234e('0x40')]](_0x34ff0c);if(_0x2f64e9){logger[_0x234e('0x33')](_0x234e('0x45'),getLogFromObject(_0x2f64e9));return _[_0x234e('0x47')](_0x2f64e9[_0x234e('0x46')])?null:_0x2f64e9['result'][_0x234e('0x48')]();}else{logger[_0x234e('0xf')](_0x234e('0x45'),getLogFromObject(_0x2f64e9));return null;}}else{logger[_0x234e('0xf')]('agicommand\x20not\x20found');return null;}}catch(_0xf1d817){logger[_0x234e('0xf')](_0xf1d817[_0x234e('0x10')]);return null;}});}logger['info'](util[_0x234e('0x18')](_0x234e('0x4d'),_0x180443[_0x234e('0x1b')],_0x180443[_0x234e('0x1c')],_0x180443[_0x234e('0x1d')],_0x180443['dnid'],_0x180443[_0x234e('0x1e')]));logger[_0x234e('0x14')](util[_0x234e('0x18')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x180443[_0x234e('0x42')],_0x180443[_0x234e('0x43')],parseInt(_0x180443[_0x234e('0x44')],0xa)+0x1));_0x180443['continueAt'](_0x180443['context'],_0x180443[_0x234e('0x43')],parseInt(_0x180443[_0x234e('0x44')],0xa)+0x1);_0x180443[_0x234e('0x35')]();}}else{logger[_0x234e('0xf')](util[_0x234e('0x18')](_0x234e('0x4e'),_0x180443[_0x234e('0x1b')]));_0x180443['continueAt'](_0x180443[_0x234e('0x42')],_0x180443[_0x234e('0x43')],parseInt(_0x180443[_0x234e('0x44')],0xa)+0x1);_0x180443[_0x234e('0x35')]();}}else{logger['error'](util[_0x234e('0x18')](_0x234e('0x4f'),_0x180443[_0x234e('0x1b')]));_0x180443[_0x234e('0x50')](_0x180443['context'],_0x180443[_0x234e('0x43')],parseInt(_0x180443[_0x234e('0x44')],0xa)+0x1);_0x180443[_0x234e('0x35')]();}}function main(){var _0x50fed5;return utilLicense['getLicense']()[_0x234e('0x2c')](function(_0x3f756d){if(_0x3f756d){if(_0x3f756d[_0x234e('0x51')]){if(_0x3f756d[_0x234e('0x52')]&&_0x3f756d[_0x234e('0x52')]>0x0){logger[_0x234e('0x14')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x3f756d[_0x234e('0x52')]));_0x50fed5=_0x3f756d['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x234e('0x14')](_0x234e('0x53'));_0x50fed5=-0x1;}}})[_0x234e('0x2d')](function(_0x226fb3){logger[_0x234e('0xf')]('[LICENSE]',_0x226fb3['stack']);})[_0x234e('0x4c')](function(){var _0x38b8f0=require(_0x234e('0x54'))(config['agi']['port'],config[_0x234e('0xc')]['ip'],_0x50fed5);_0x38b8f0['on'](_0x234e('0xf'),errorHandler);_0x38b8f0['on'](_0x234e('0x55'),listeningHandler);_0x38b8f0['on']('connection',connectionHandler);_0x38b8f0['on'](_0x234e('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xaecf=['[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','./server','listening','connection','lodash','util','moment','../../config/environment','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','catch','createSquareReport','then','agi_','substring','inspect','variables','stringify','close','timeout','hangup','production','start','root','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','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','isUndefined','result','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xaecf,0x11c));var _0xfaec=function(_0x156c8a,_0x403e7f){_0x156c8a=_0x156c8a-0x0;var _0x5f0f3e=_0xaecf[_0x156c8a];return _0x5f0f3e;};'use strict';var parser=require('xml2json');var _=require(_0xfaec('0x0'));var syncho=require('syncho');var util=require(_0xfaec('0x1'));var moment=require(_0xfaec('0x2'));var config=require(_0xfaec('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0xfaec('0x4'));var rpc=require(_0xfaec('0x5'));var mailRpc=require(_0xfaec('0x6'));var Graph=require(_0xfaec('0x7'));var Vertices=require(_0xfaec('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xfaec('0x9')]=_[_0xfaec('0xa')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0xbe227e){process[_0xfaec('0xb')](function(){syncho(function(){try{setChannelVariables(_0xbe227e);agiHandler(_0xbe227e);}catch(_0x4a8bc5){logger[_0xfaec('0xc')](_0x4a8bc5['stack']);}});});}function listeningHandler(){console[_0xfaec('0xd')](_0xfaec('0xe'),config[_0xfaec('0x9')]['port']);logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x11'),config['agi']['ip'],config[_0xfaec('0x9')][_0xfaec('0x12')]));}function errorHandler(_0x4c764b){if(_0x4c764b&&_0x4c764b[_0xfaec('0x13')]&&_0x4c764b[_0xfaec('0x14')]){logger[_0xfaec('0xc')](util['format'](_0xfaec('0x15'),_0x4c764b[_0xfaec('0x13')],_0x4c764b[_0xfaec('0x14')]));}else{logger[_0xfaec('0xc')](util[_0xfaec('0x10')](_0xfaec('0x16'),_0x4c764b[_0xfaec('0x17')]));}}function closeHandler(){logger['info'](util[_0xfaec('0x10')](_0xfaec('0x18'),this[_0xfaec('0x19')],this[_0xfaec('0x1a')],this[_0xfaec('0x1b')],this[_0xfaec('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x3c3b5c){logger[_0xfaec('0xc')](_0x3c3b5c[_0xfaec('0x17')]);}}function timeoutHandler(){logger['info'](util[_0xfaec('0x10')](_0xfaec('0x1d'),this[_0xfaec('0x19')],this[_0xfaec('0x1a')],this['callerid'],this[_0xfaec('0x1c')],this[_0xfaec('0x1e')]));}function hangupHandler(){logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x1f'),this[_0xfaec('0x19')],this[_0xfaec('0x1a')],this[_0xfaec('0x1b')],this[_0xfaec('0x1c')],this['uniqueid']));this[_0xfaec('0x20')]=!![];}function getRoot(_0x2d2b17){return parser[_0xfaec('0x21')](_0x2d2b17,{'object':!![]})[_0xfaec('0x22')]['root'];}function addVertex(_0x40e291,_0x1c3c5c,_0x26401f){_0x1c3c5c[_0xfaec('0x23')]=_0x26401f;if(_0x1c3c5c[_0xfaec('0x24')](_0xfaec('0x25'))){_0x1c3c5c[_0xfaec('0x26')]=parseInt(_0x1c3c5c[_0xfaec('0x25')],0xa);}_0x40e291[_0xfaec('0x27')](_[_0xfaec('0x28')](_0x1c3c5c,_0xfaec('0x29')));}function initGraph(_0x71fffb,_0x4744c3){var _0x1c388a=new Graph();for(var _0xe3c7e9 in _0x71fffb){if(_0x71fffb[_0xfaec('0x24')](_0xe3c7e9)){if(_[_0xfaec('0x2a')](_0x71fffb[_0xe3c7e9])){for(var _0x283451=0x0;_0x283451<_0x71fffb[_0xe3c7e9]['length'];_0x283451+=0x1){addVertex(_0x1c388a,_0x71fffb[_0xe3c7e9][_0x283451],_0xe3c7e9);}}else{addVertex(_0x1c388a,_0x71fffb[_0xe3c7e9],_0xe3c7e9);}}}for(var _0x2d42d9=0x0;_0x2d42d9<_0x4744c3[_0xfaec('0x2b')];_0x2d42d9+=0x1){if(_0x4744c3[_0x2d42d9]['source']&&_0x4744c3[_0x2d42d9]['target']){_0x1c388a['addEdge'](_0x4744c3[_0x2d42d9][_0xfaec('0x2c')],_0x4744c3[_0x2d42d9][_0xfaec('0x2d')],_0x4744c3[_0x2d42d9][_0xfaec('0x2e')]);}}return _0x1c388a;}function getSquareProject(_0x3d0a86,_0x328976){rpc[_0xfaec('0x2f')](_0x3d0a86)['then'](function(_0x1c4f16){_0x328976(null,_0x1c4f16);})[_0xfaec('0x30')](function(_0x4ee274){_0x328976(null,_0x4ee274);});}function createSquareReport(_0x526504,_0x1d5206){rpc[_0xfaec('0x31')](_0x526504)[_0xfaec('0x32')](function(_0x719575){if(_0x1d5206){_0x1d5206(null,_0x719575);}})[_0xfaec('0x30')](function(_0x8c53d6){if(_0x1d5206){_0x1d5206(null,_0x8c53d6);}});}function setChannelVariables(_0x1dc065){for(var _0x9afaa3 in _0x1dc065){if(_0x1dc065['hasOwnProperty'](_0x9afaa3)){if(_0x9afaa3['indexOf'](_0xfaec('0x33'))===0x0){_0x1dc065[_0x9afaa3[_0xfaec('0x34')](0x4)]=_0x1dc065[_0x9afaa3];delete _0x1dc065[_0x9afaa3];}}}}function getLogFromObject(_0x23a749){return util[_0xfaec('0x35')](_0x23a749,{'showHidden':![],'depth':null});}function agiHandler(_0x53788d){var _0x2a9436,_0x468c10,_0x57bd33,_0xed52bb,_0x5aa768;logger['debug'](_0xfaec('0x36'),JSON[_0xfaec('0x37')](_0x53788d,null,0x2));logger[_0xfaec('0xf')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x53788d[_0xfaec('0x19')],_0x53788d[_0xfaec('0x1a')],_0x53788d['callerid'],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));_0x53788d['on'](_0xfaec('0xc'),errorHandler);_0x53788d['on'](_0xfaec('0x38'),closeHandler);_0x53788d['on'](_0xfaec('0x39'),timeoutHandler);_0x53788d[_0xfaec('0x20')]=![];_0x53788d['on'](_0xfaec('0x3a'),hangupHandler);var _0x5743c5=getSquareProject['sync'](null,_0x53788d[_0xfaec('0x19')]);if(_0x5743c5){if(_0x5743c5[_0xfaec('0x3b')]){_0x2a9436=getRoot(_0x5743c5['production']);if(_0x2a9436&&_0x2a9436[_0xfaec('0x3c')]){logger['debug'](_0xfaec('0x3d'),JSON['stringify'](_0x2a9436,null,0x2));_0x53788d[_0xfaec('0x3e')]=moment()[_0xfaec('0x10')](_0xfaec('0x3f'));_0x468c10=initGraph(_['omit'](_0x2a9436,_0xfaec('0x29')),_0x2a9436['mxCell']);_0x57bd33=new Vertices(_0x53788d,rpc,mailRpc);logger['info'](util[_0xfaec('0x10')](_0xfaec('0x40'),_0x53788d[_0xfaec('0x19')],_0x53788d['calleridname'],_0x53788d['callerid'],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));_0x468c10[_0xfaec('0x41')](_0x2a9436[_0xfaec('0x3c')]['id'],function(_0x46b6e3){try{_0x46b6e3=_0x57bd33[_0xfaec('0x42')](_0x46b6e3);logger[_0xfaec('0x43')](_0xfaec('0x44'),JSON[_0xfaec('0x37')](_0x46b6e3,null,0x2));if(_0x46b6e3[_0xfaec('0x23')]===_0xfaec('0x45')){logger[_0xfaec('0xf')](_0xfaec('0x46'));_0x53788d[_0xfaec('0x47')]=_0x46b6e3[_0xfaec('0x47')]||_0x53788d['context'];_0x53788d[_0xfaec('0x48')]=_0x46b6e3[_0xfaec('0x48')];_0x53788d[_0xfaec('0x49')]=_0x46b6e3[_0xfaec('0x49')]?_0x46b6e3[_0xfaec('0x49')]-0x1:0x1;return null;}else if(_0x46b6e3&&_0x57bd33[_0x46b6e3[_0xfaec('0x23')]]){_0x5aa768=_0x57bd33[_0x46b6e3['agicommand']](_0x46b6e3);logger[_0xfaec('0xf')](_0xfaec('0x4a'),JSON[_0xfaec('0x37')](_0x5aa768,null,0x2));if(_0x5aa768&&_0x5aa768['code']===AGI_CODE_SUCCESS&&_0x5aa768['result']!==AGI_RESULT_ERROR&&!_0x53788d[_0xfaec('0x20')]){logger['debug']('response',getLogFromObject(_0x5aa768));return _[_0xfaec('0x4b')](_0x5aa768[_0xfaec('0x4c')])?null:_0x5aa768[_0xfaec('0x4c')][_0xfaec('0x4d')]();}else{logger[_0xfaec('0xc')](_0xfaec('0x4a'),getLogFromObject(_0x5aa768));return null;}}else{logger[_0xfaec('0xc')](_0xfaec('0x4e'));return null;}}catch(_0x5cc7e6){logger[_0xfaec('0xc')](_0x5cc7e6[_0xfaec('0x17')]);return null;}});if(_0x2a9436['finally']){logger[_0xfaec('0xf')](util[_0xfaec('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x53788d['arg_1'],_0x53788d['calleridname'],_0x53788d['callerid'],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));_0x468c10['traverseBFS'](_0x2a9436['finally']['id'],function(_0x445374){try{_0x445374=_0x57bd33['clear'](_0x445374);logger[_0xfaec('0x43')](_0xfaec('0x44'),JSON[_0xfaec('0x37')](_0x445374,null,0x2));if(_0x445374&&_0x57bd33[_0x445374[_0xfaec('0x23')]]){_0x5aa768=_0x57bd33[_0x445374['agicommand']](_0x445374);if(_0x5aa768){logger[_0xfaec('0x43')](_0xfaec('0x4a'),getLogFromObject(_0x5aa768));return _[_0xfaec('0x4b')](_0x5aa768[_0xfaec('0x4c')])?null:_0x5aa768[_0xfaec('0x4c')]['toString']();}else{logger['error']('response',getLogFromObject(_0x5aa768));return null;}}else{logger[_0xfaec('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x1ea222){logger[_0xfaec('0xc')](_0x1ea222['stack']);return null;}});}logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x4f'),_0x53788d['arg_1'],_0x53788d[_0xfaec('0x1a')],_0x53788d[_0xfaec('0x1b')],_0x53788d[_0xfaec('0x1c')],_0x53788d[_0xfaec('0x1e')]));logger[_0xfaec('0xf')](util[_0xfaec('0x10')](_0xfaec('0x50'),_0x53788d[_0xfaec('0x47')],_0x53788d['extension'],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1));_0x53788d[_0xfaec('0x51')](_0x53788d[_0xfaec('0x47')],_0x53788d['extension'],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1);_0x53788d[_0xfaec('0x38')]();}}else{logger[_0xfaec('0xc')](util['format']('Project\x20%s\x20not\x20published',_0x53788d[_0xfaec('0x19')]));_0x53788d[_0xfaec('0x51')](_0x53788d[_0xfaec('0x47')],_0x53788d[_0xfaec('0x48')],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1);_0x53788d[_0xfaec('0x38')]();}}else{logger[_0xfaec('0xc')](util[_0xfaec('0x10')]('Project\x20%s\x20not\x20found',_0x53788d[_0xfaec('0x19')]));_0x53788d[_0xfaec('0x51')](_0x53788d['context'],_0x53788d[_0xfaec('0x48')],parseInt(_0x53788d[_0xfaec('0x49')],0xa)+0x1);_0x53788d['close']();}}function main(){var _0x3eedf0;return utilLicense[_0xfaec('0x52')]()[_0xfaec('0x32')](function(_0x2d41ec){if(_0x2d41ec){if(_0x2d41ec[_0xfaec('0x53')]){if(_0x2d41ec['callysquare']&&_0x2d41ec['callysquare']>0x0){logger[_0xfaec('0xf')](util[_0xfaec('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x2d41ec[_0xfaec('0x54')]));_0x3eedf0=_0x2d41ec[_0xfaec('0x54')];}else{logger[_0xfaec('0xf')](_0xfaec('0x55'));}}else{logger[_0xfaec('0xf')](_0xfaec('0x56'));_0x3eedf0=-0x1;}}})[_0xfaec('0x30')](function(_0x2b9002){logger['error']('[LICENSE]',_0x2b9002[_0xfaec('0x17')]);})[_0xfaec('0x57')](function(){var _0x4f6b87=require(_0xfaec('0x58'))(config['agi'][_0xfaec('0x12')],config[_0xfaec('0x9')]['ip'],_0x3eedf0);_0x4f6b87['on'](_0xfaec('0xc'),errorHandler);_0x4f6b87['on'](_0xfaec('0x59'),listeningHandler);_0x4f6b87['on'](_0xfaec('0x5a'),connectionHandler);_0x4f6b87['on']('close',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 f5ac75d..6ff79a8 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 _0xc802=['error','message','result','catch','SendMail','bluebird','jayson/promise','http','request','then'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0xc802,0x181));var _0x2c80=function(_0x48319d,_0x2d83de){_0x48319d=_0x48319d-0x0;var _0x4bb028=_0xc802[_0x48319d];return _0x4bb028;};'use strict';var BPromise=require(_0x2c80('0x0'));var jayson=require(_0x2c80('0x1'));var client=jayson['client'][_0x2c80('0x2')]({'port':0x232b});function request(_0x35fdaa,_0x2edf7f){return new BPromise(function(_0x3e27d1,_0x587939){return client[_0x2c80('0x3')](_0x35fdaa,_0x2edf7f)[_0x2c80('0x4')](function(_0x4fd9cb){if(_0x4fd9cb[_0x2c80('0x5')]){return _0x587939(_0x4fd9cb[_0x2c80('0x5')][_0x2c80('0x6')]);}else{return _0x3e27d1(_0x4fd9cb[_0x2c80('0x7')]);}})[_0x2c80('0x8')](function(_0x3d044c){return _0x587939(_0x3d044c);});});}exports['sendMailMessage']=function(_0x585521,_0x8cc392){return request(_0x2c80('0x9'),{'account':_0x585521,'message':_0x8cc392});}; \ No newline at end of file +var _0xd928=['http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x3059ad,_0x1ea91f){var _0x4dffb1=function(_0x3bc04a){while(--_0x3bc04a){_0x3059ad['push'](_0x3059ad['shift']());}};_0x4dffb1(++_0x1ea91f);}(_0xd928,0x184));var _0x8d92=function(_0x24ce2e,_0x300669){_0x24ce2e=_0x24ce2e-0x0;var _0x122867=_0xd928[_0x24ce2e];return _0x122867;};'use strict';var BPromise=require(_0x8d92('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8d92('0x1')][_0x8d92('0x2')]({'port':0x232b});function request(_0x488d54,_0x51d179){return new BPromise(function(_0x1ed708,_0x401edd){return client[_0x8d92('0x3')](_0x488d54,_0x51d179)[_0x8d92('0x4')](function(_0x4c0ecd){if(_0x4c0ecd[_0x8d92('0x5')]){return _0x401edd(_0x4c0ecd[_0x8d92('0x5')][_0x8d92('0x6')]);}else{return _0x1ed708(_0x4c0ecd['result']);}})[_0x8d92('0x7')](function(_0x248489){return _0x401edd(_0x248489);});});}exports[_0x8d92('0x8')]=function(_0x28d995,_0xd2abdf){return request(_0x8d92('0x9'),{'account':_0x28d995,'message':_0xd2abdf});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b4d6c28..46c5e07 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 _0x84e1=['indexOf','substring','length','trim','slice','emit','headers','exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_inBody'];(function(_0x51c382,_0x20a789){var _0x3afdf4=function(_0x141c8a){while(--_0x141c8a){_0x51c382['push'](_0x51c382['shift']());}};_0x3afdf4(++_0x20a789);}(_0x84e1,0x1dc));var _0x184e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x84e1[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x184e('0x0'));var Transform=require(_0x184e('0x1'))[_0x184e('0x2')];function AGIReply(_0x1e7e1f){Transform[_0x184e('0x3')](this,_0x1e7e1f);this[_0x184e('0x4')]='';this['_inBody']=![];}util[_0x184e('0x5')](AGIReply,Transform);AGIReply[_0x184e('0x6')][_0x184e('0x7')]=function(_0x1dab36,_0x2a97b1,_0x86a78e){var _0x396183='\x0a',_0x4ad2c3=['\x0a\x0a',_0x184e('0x8')],_0x3f24d3=-0x1,_0xa32654=-0x1,_0x1e79b2='',_0x4b6204=0x0,_0x66d238='',_0x1b948a='';this[_0x184e('0x4')]+=_0x1dab36['toString']();_0x66d238=this[_0x184e('0x4')];if(!this[_0x184e('0x9')]){_0x4b6204=0x0;while(_0x4ad2c3[_0x4b6204]){while((_0xa32654=_0x66d238[_0x184e('0xa')](_0x4ad2c3[_0x4b6204]))!=-0x1){_0x1e79b2=_0x4ad2c3[_0x4b6204];_0x1b948a=_0x66d238[_0x184e('0xb')](0x0,_0xa32654);_0x66d238=_0x66d238[_0x184e('0xb')](_0xa32654+_0x1e79b2[_0x184e('0xc')]);var _0x2568f4=_0x1b948a['split'](_0x396183),_0x15da74=0x0,_0x1f2e7a={},_0x7acac7='',_0x20abe6='',_0x13e59e=-0x1;while(_0x2568f4[_0x15da74]){_0x13e59e=_0x2568f4[_0x15da74][_0x184e('0xa')](':');if(_0x13e59e!=-0x1){_0x7acac7=_0x2568f4[_0x15da74]['slice'](0x0,_0x13e59e)[_0x184e('0xd')]();_0x20abe6=_0x2568f4[_0x15da74][_0x184e('0xe')](_0x13e59e+0x1)[_0x184e('0xd')]();if(_0x7acac7[_0x184e('0xc')]>0x0){_0x1f2e7a[_0x7acac7]=_0x20abe6;}}else{}_0x15da74++;}this[_0x184e('0xf')](_0x184e('0x10'),_0x1f2e7a);this[_0x184e('0x9')]=!![];}_0x4b6204++;}this[_0x184e('0x4')]=_0x66d238;}else{while((_0x3f24d3=_0x66d238[_0x184e('0xa')](_0x396183))!=-0x1){_0x1b948a=_0x66d238['substring'](0x0,_0x3f24d3);this[_0x184e('0xf')]('line',_0x1b948a);_0x66d238=_0x66d238[_0x184e('0xb')](_0x3f24d3+_0x396183['length']);}this['_localBuffer']=_0x66d238;}_0x86a78e();};module[_0x184e('0x11')]=AGIReply; \ No newline at end of file +var _0x6fd6=['substring','length','split','slice','trim','emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','_transform','toString','indexOf'];(function(_0xd2a270,_0x36ece1){var _0x41e28e=function(_0x59e3f0){while(--_0x59e3f0){_0xd2a270['push'](_0xd2a270['shift']());}};_0x41e28e(++_0x36ece1);}(_0x6fd6,0x86));var _0x66fd=function(_0x2c80a8,_0x40354a){_0x2c80a8=_0x2c80a8-0x0;var _0x52cf13=_0x6fd6[_0x2c80a8];return _0x52cf13;};'use strict';var util=require(_0x66fd('0x0'));var Transform=require(_0x66fd('0x1'))[_0x66fd('0x2')];function AGIReply(_0x23b0c3){Transform[_0x66fd('0x3')](this,_0x23b0c3);this[_0x66fd('0x4')]='';this[_0x66fd('0x5')]=![];}util[_0x66fd('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x66fd('0x7')]=function(_0x2f4307,_0x264c77,_0x36f5c9){var _0x3a927f='\x0a',_0x45219c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3b75ac=-0x1,_0x22aad5=-0x1,_0x425b58='',_0x4c5ced=0x0,_0x5214d3='',_0x256a99='';this['_localBuffer']+=_0x2f4307[_0x66fd('0x8')]();_0x5214d3=this[_0x66fd('0x4')];if(!this[_0x66fd('0x5')]){_0x4c5ced=0x0;while(_0x45219c[_0x4c5ced]){while((_0x22aad5=_0x5214d3[_0x66fd('0x9')](_0x45219c[_0x4c5ced]))!=-0x1){_0x425b58=_0x45219c[_0x4c5ced];_0x256a99=_0x5214d3['substring'](0x0,_0x22aad5);_0x5214d3=_0x5214d3[_0x66fd('0xa')](_0x22aad5+_0x425b58[_0x66fd('0xb')]);var _0x4fa475=_0x256a99[_0x66fd('0xc')](_0x3a927f),_0x2eb8ec=0x0,_0x991fd={},_0xa3e795='',_0x20466c='',_0xc54220=-0x1;while(_0x4fa475[_0x2eb8ec]){_0xc54220=_0x4fa475[_0x2eb8ec][_0x66fd('0x9')](':');if(_0xc54220!=-0x1){_0xa3e795=_0x4fa475[_0x2eb8ec][_0x66fd('0xd')](0x0,_0xc54220)[_0x66fd('0xe')]();_0x20466c=_0x4fa475[_0x2eb8ec][_0x66fd('0xd')](_0xc54220+0x1)[_0x66fd('0xe')]();if(_0xa3e795[_0x66fd('0xb')]>0x0){_0x991fd[_0xa3e795]=_0x20466c;}}else{}_0x2eb8ec++;}this[_0x66fd('0xf')](_0x66fd('0x10'),_0x991fd);this['_inBody']=!![];}_0x4c5ced++;}this['_localBuffer']=_0x5214d3;}else{while((_0x3b75ac=_0x5214d3[_0x66fd('0x9')](_0x3a927f))!=-0x1){_0x256a99=_0x5214d3[_0x66fd('0xa')](0x0,_0x3b75ac);this['emit']('line',_0x256a99);_0x5214d3=_0x5214d3[_0x66fd('0xa')](_0x3b75ac+_0x3a927f[_0x66fd('0xb')]);}this[_0x66fd('0x4')]=_0x5214d3;}_0x36f5c9();};module[_0x66fd('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 1a9b7df..f8047fb 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 _0xa536=['email','ShowSquareProject','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','createSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProject','production','getMailAccountById','Smtp','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa536,0x1a0));var _0x6a53=function(_0x4b3d8f,_0x4a0a76){_0x4b3d8f=_0x4b3d8f-0x0;var _0x536607=_0xa536[_0x4b3d8f];return _0x536607;};'use strict';var BPromise=require(_0x6a53('0x0'));var moment=require(_0x6a53('0x1'));var _=require('lodash');var util=require(_0x6a53('0x2'));var jayson=require(_0x6a53('0x3'));var client=jayson[_0x6a53('0x4')][_0x6a53('0x5')]({'port':0x2329});function request(_0x2b19ab,_0x4f2021){return new BPromise(function(_0x2acc72,_0x5af5d7){return client[_0x6a53('0x6')](_0x2b19ab,_0x4f2021)[_0x6a53('0x7')](function(_0x5846e9){if(_0x5846e9[_0x6a53('0x8')]){return _0x5af5d7(_0x5846e9[_0x6a53('0x8')]['message']);}else{return _0x2acc72(_0x5846e9[_0x6a53('0x9')]);}})[_0x6a53('0xa')](function(_0x59fd91){return _0x5af5d7(_0x59fd91);});});}exports[_0x6a53('0xb')]=function(_0x6e64b9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x6e64b9},'attributes':[_0x6a53('0xc')]}});};exports[_0x6a53('0xd')]=function(_0x332491){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x332491},'include':[{'model':'MailServerOut','as':_0x6a53('0xe')}],'attributes':['id',_0x6a53('0xf'),_0x6a53('0x10')]}});};exports['getSquareProjectById']=function(_0x4b65ee){return request(_0x6a53('0x11'),{'options':{'where':{'id':_0x4b65ee},'attributes':[_0x6a53('0xf')]}});};exports['getVoiceQueueById']=function(_0x5d73bb){return request(_0x6a53('0x12'),{'options':{'where':{'id':_0x5d73bb},'attributes':[_0x6a53('0xf')]}});};exports['getVariableById']=function(_0x5a1079){return request(_0x6a53('0x13'),{'options':{'where':{'id':_0x5a1079},'attributes':[_0x6a53('0xf')]}});};exports[_0x6a53('0x14')]=function(_0x4f831b){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4f831b},'attributes':[_0x6a53('0x15')]}});};exports[_0x6a53('0x16')]=function(_0x1c27bd){return request(_0x6a53('0x17'),{'options':{'where':{'id':_0x1c27bd},'attributes':[_0x6a53('0xf')]}});};exports[_0x6a53('0x18')]=function(_0x20012c){return request(_0x6a53('0x19'),{'options':{'where':{'id':_0x20012c},'attributes':[_0x6a53('0xf')]}});};exports[_0x6a53('0x1a')]=function(_0x2d1bb1){return request(_0x6a53('0x1b'),{'options':{'where':{'id':_0x2d1bb1},'attributes':['save_name']}});};exports[_0x6a53('0x1c')]=function(_0x50cfdf){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x50cfdf},'include':[{'model':_0x6a53('0x1d'),'as':_0x6a53('0x1e')}]}});};exports['getSmsAccountById']=function(_0x214fe0){return request(_0x6a53('0x1f'),{'options':{'where':{'id':_0x214fe0},'attributes':['id',_0x6a53('0xf')]}});};exports[_0x6a53('0x20')]=function(_0xc4fd01){return request(_0x6a53('0x21'),{'body':_0xc4fd01});};exports[_0x6a53('0x22')]=function(_0x59cf04){return request('CreateSquareDetailsReport',{'body':_0x59cf04});};exports[_0x6a53('0x23')]=function(_0x14748a){return request(_0x6a53('0x24'),{'body':_[_0x6a53('0x25')](_0x14748a,{'project_name':_0x14748a['arg_1'],'prev_project_name':_0x14748a['arg_2']||'','is_subproject':_0x14748a[_0x6a53('0x26')]?!![]:![],'leaveAt':moment()[_0x6a53('0x27')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x180a35){return request('CreateSquareRecording',{'body':_0x180a35});};exports[_0x6a53('0x28')]=function(_0x3a30ba){return request('CreateSquareMessage',{'body':_0x3a30ba});};exports[_0x6a53('0x29')]=function(_0x4d18ef){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4d18ef[_0x6a53('0x2a')],'ListId':_0x4d18ef[_0x6a53('0x2b')]}}})[_0x6a53('0x7')](function(_0x4aa3fd){if(_0x4aa3fd){return _0x4aa3fd;}return request(_0x6a53('0x2c'),{'body':_0x4d18ef});});};exports[_0x6a53('0x2d')]=function(_0x2ad538){return request(_0x6a53('0x2e'),{'options':{'where':{'id':_0x2ad538},'attributes':[_0x6a53('0xf')]}});};exports[_0x6a53('0x2f')]=function(_0x586362,_0x769d29){return request('LoginUser',{'body':{'interface':_0x769d29},'options':{'where':_0x586362}});};exports[_0x6a53('0x30')]=function(_0xfd4b6d,_0xcfd724,_0x487d68){return request(_0x6a53('0x31'),{'body':{'type':_0xcfd724,'uniqueid':_0x487d68},'options':{'where':_0xfd4b6d}});};exports[_0x6a53('0x32')]=function(_0x2d0e10){return request(_0x6a53('0x33'),{'body':{},'options':{'where':_0x2d0e10}});};exports[_0x6a53('0x34')]=function(_0x4ce05c){return request(_0x6a53('0x35'),{'body':{},'options':{'where':_0x4ce05c}});}; \ No newline at end of file +var _0x6e45=['getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','phone','ListId','CreateCmContact','agentLogin','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getSoundById','ShowSound','save_name'];(function(_0x16b0bd,_0x1731a3){var _0x5c30a3=function(_0x3972d4){while(--_0x3972d4){_0x16b0bd['push'](_0x16b0bd['shift']());}};_0x5c30a3(++_0x1731a3);}(_0x6e45,0x1b9));var _0x56e4=function(_0x12c9be,_0xe23d5){_0x12c9be=_0x12c9be-0x0;var _0x4b4fcf=_0x6e45[_0x12c9be];return _0x4b4fcf;};'use strict';var BPromise=require(_0x56e4('0x0'));var moment=require(_0x56e4('0x1'));var _=require(_0x56e4('0x2'));var util=require(_0x56e4('0x3'));var jayson=require(_0x56e4('0x4'));var client=jayson[_0x56e4('0x5')][_0x56e4('0x6')]({'port':0x2329});function request(_0x3b62db,_0x568f9e){return new BPromise(function(_0x3d5d54,_0x279541){return client[_0x56e4('0x7')](_0x3b62db,_0x568f9e)[_0x56e4('0x8')](function(_0x428a5e){if(_0x428a5e[_0x56e4('0x9')]){return _0x279541(_0x428a5e['error']['message']);}else{return _0x3d5d54(_0x428a5e[_0x56e4('0xa')]);}})[_0x56e4('0xb')](function(_0x2a7d55){return _0x279541(_0x2a7d55);});});}exports[_0x56e4('0xc')]=function(_0x266405){return request(_0x56e4('0xd'),{'options':{'raw':![],'where':{'name':_0x266405},'attributes':[_0x56e4('0xe')]}});};exports[_0x56e4('0xf')]=function(_0x25f28d){return request(_0x56e4('0x10'),{'options':{'raw':![],'where':{'id':_0x25f28d},'include':[{'model':_0x56e4('0x11'),'as':_0x56e4('0x12')}],'attributes':['id',_0x56e4('0x13'),'email']}});};exports[_0x56e4('0x14')]=function(_0x3db180){return request(_0x56e4('0xd'),{'options':{'where':{'id':_0x3db180},'attributes':['name']}});};exports[_0x56e4('0x15')]=function(_0xe33152){return request(_0x56e4('0x16'),{'options':{'where':{'id':_0xe33152},'attributes':[_0x56e4('0x13')]}});};exports['getVariableById']=function(_0x2d4ff5){return request(_0x56e4('0x17'),{'options':{'where':{'id':_0x2d4ff5},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x4a52e0){return request(_0x56e4('0x18'),{'options':{'where':{'id':_0x4a52e0},'attributes':[_0x56e4('0x19')]}});};exports[_0x56e4('0x1a')]=function(_0x4e853a){return request(_0x56e4('0x1b'),{'options':{'where':{'id':_0x4e853a},'attributes':[_0x56e4('0x13')]}});};exports['getTrunkById']=function(_0x25e755){return request('ShowTrunk',{'options':{'where':{'id':_0x25e755},'attributes':[_0x56e4('0x13')]}});};exports[_0x56e4('0x1c')]=function(_0x382fda){return request(_0x56e4('0x1d'),{'options':{'where':{'id':_0x382fda},'attributes':[_0x56e4('0x1e')]}});};exports[_0x56e4('0x1f')]=function(_0xb3bed7){return request(_0x56e4('0x20'),{'options':{'raw':![],'where':{'id':_0xb3bed7},'include':[{'model':'Interval','as':_0x56e4('0x21')}]}});};exports[_0x56e4('0x22')]=function(_0x4c1764){return request(_0x56e4('0x23'),{'options':{'where':{'id':_0x4c1764},'attributes':['id',_0x56e4('0x13')]}});};exports[_0x56e4('0x24')]=function(_0x295fec){return request(_0x56e4('0x25'),{'body':_0x295fec});};exports[_0x56e4('0x26')]=function(_0x2dd4b1){return request(_0x56e4('0x27'),{'body':_0x2dd4b1});};exports[_0x56e4('0x28')]=function(_0x194a1e){return request(_0x56e4('0x29'),{'body':_[_0x56e4('0x2a')](_0x194a1e,{'project_name':_0x194a1e[_0x56e4('0x2b')],'prev_project_name':_0x194a1e[_0x56e4('0x2c')]||'','is_subproject':_0x194a1e[_0x56e4('0x2c')]?!![]:![],'leaveAt':moment()[_0x56e4('0x2d')](_0x56e4('0x2e'))})});};exports[_0x56e4('0x2f')]=function(_0x48cac9){return request(_0x56e4('0x30'),{'body':_0x48cac9});};exports[_0x56e4('0x31')]=function(_0x2c68cc){return request('CreateSquareMessage',{'body':_0x2c68cc});};exports[_0x56e4('0x32')]=function(_0x5f122c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5f122c[_0x56e4('0x33')],'ListId':_0x5f122c[_0x56e4('0x34')]}}})[_0x56e4('0x8')](function(_0x443164){if(_0x443164){return _0x443164;}return request(_0x56e4('0x35'),{'body':_0x5f122c});});};exports['getPauseById']=function(_0x25aea6){return request('ShowPause',{'options':{'where':{'id':_0x25aea6},'attributes':[_0x56e4('0x13')]}});};exports[_0x56e4('0x36')]=function(_0x547f78,_0x200725){return request('LoginUser',{'body':{'interface':_0x200725},'options':{'where':_0x547f78}});};exports[_0x56e4('0x37')]=function(_0x3ecb00,_0x2ace6f,_0xaac61a){return request(_0x56e4('0x38'),{'body':{'type':_0x2ace6f,'uniqueid':_0xaac61a},'options':{'where':_0x3ecb00}});};exports[_0x56e4('0x39')]=function(_0x4b92c2){return request('UnpauseUser',{'body':{},'options':{'where':_0x4b92c2}});};exports[_0x56e4('0x3a')]=function(_0x2ba4f0){return request('LogoutUser',{'body':{},'options':{'where':_0x2ba4f0}});}; \ 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 cc58a53..bfb75ec 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 _0x93bb=['./polly','./lex','exports'];(function(_0x1bf2cd,_0x1ab506){var _0x34674d=function(_0x349fc4){while(--_0x349fc4){_0x1bf2cd['push'](_0x1bf2cd['shift']());}};_0x34674d(++_0x1ab506);}(_0x93bb,0x135));var _0xb93b=function(_0x1d1b2d,_0x4226f7){_0x1d1b2d=_0x1d1b2d-0x0;var _0x49a4bc=_0x93bb[_0x1d1b2d];return _0x49a4bc;};var polly=require(_0xb93b('0x0'));var lex=require(_0xb93b('0x1'));module[_0xb93b('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3831=['./polly','exports'];(function(_0x1fe75e,_0xa1ea15){var _0xc12009=function(_0x3f89f9){while(--_0x3f89f9){_0x1fe75e['push'](_0x1fe75e['shift']());}};_0xc12009(++_0xa1ea15);}(_0x3831,0x14c));var _0x1383=function(_0x56b5d1,_0x59be02){_0x56b5d1=_0x56b5d1-0x0;var _0x5bfe4a=_0x3831[_0x56b5d1];return _0x5bfe4a;};var polly=require(_0x1383('0x0'));var lex=require('./lex');module[_0x1383('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 bb975bb..c48a238 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec56=['./lib/api'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xec56,0x1bd));var _0x6ec5=function(_0xe2788e,_0x23375e){_0xe2788e=_0xe2788e-0x0;var _0x41ed29=_0xec56[_0xe2788e];return _0x41ed29;};'use strict';var lex=require(_0x6ec5('0x0'));module['exports']=function(_0x4d6dcd,_0x10a273,_0x3b8a3f,_0x26a5af,_0x240ccf,_0x43c2cd){return lex(_0x4d6dcd,_0x10a273,_0x3b8a3f,_0x26a5af,_0x240ccf,_0x43c2cd);}; \ No newline at end of file +var _0x9348=['exports','./lib/api'];(function(_0x28de2a,_0x1960b3){var _0x351dc6=function(_0x13886b){while(--_0x13886b){_0x28de2a['push'](_0x28de2a['shift']());}};_0x351dc6(++_0x1960b3);}(_0x9348,0x10d));var _0x8934=function(_0x57cd52,_0x13b734){_0x57cd52=_0x57cd52-0x0;var _0x3ff63f=_0x9348[_0x57cd52];return _0x3ff63f;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ 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 bb3147f..2329abb 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(_0x54cadb,_0x4632ec){var _0x4ffbef=function(_0xa27387){while(--_0xa27387){_0x54cadb['push'](_0x54cadb['shift']());}};_0x4ffbef(++_0x4632ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x15509d,_0x2d0913){var _0x9ad04e=function(_0x35c999){while(--_0x35c999){_0x15509d['push'](_0x15509d['shift']());}};_0x9ad04e(++_0x2d0913);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 14d115d..4cde82d 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 _0x92b9=['./lib/api'];(function(_0xabed87,_0x4bf5f1){var _0x28a8cd=function(_0x2ae10d){while(--_0x2ae10d){_0xabed87['push'](_0xabed87['shift']());}};_0x28a8cd(++_0x4bf5f1);}(_0x92b9,0xfe));var _0x992b=function(_0x4fd852,_0xd632e6){_0x4fd852=_0x4fd852-0x0;var _0x4f4f94=_0x92b9[_0x4fd852];return _0x4f4f94;};'use strict';var polly=require(_0x992b('0x0'));module['exports']=function(_0x4696d9,_0x31e229,_0x5917d9,_0x2ff845,_0x1074e7,_0xe37d3a,_0x24e64b){return polly(_0x4696d9,_0x31e229,_0x5917d9,_0x2ff845,_0x1074e7,_0xe37d3a,_0x24e64b);}; \ No newline at end of file +var _0x13bd=['exports','./lib/api'];(function(_0x168f68,_0x3e0d63){var _0x1b959c=function(_0x300620){while(--_0x300620){_0x168f68['push'](_0x168f68['shift']());}};_0x1b959c(++_0x3e0d63);}(_0x13bd,0x1c9));var _0xd13b=function(_0x5bc95c,_0xfed759){_0x5bc95c=_0x5bc95c-0x0;var _0x3721fc=_0x13bd[_0x5bc95c];return _0x3721fc;};'use strict';var polly=require(_0xd13b('0x0'));module[_0xd13b('0x1')]=function(_0x48f64a,_0x3d133c,_0x543b18,_0x179fd4,_0x10b02a,_0x2d3c5c,_0xe9d0f0){return polly(_0x48f64a,_0x3d133c,_0x543b18,_0x179fd4,_0x10b02a,_0x2d3c5c,_0xe9d0f0);}; \ 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 3d379a7..488b1c1 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 _0x1d90=['synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path','randomstring','aws-sdk'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1d90,0xcd));var _0x01d9=function(_0x226f94,_0x111cb2){_0x226f94=_0x226f94-0x0;var _0xb4249f=_0x1d90[_0x226f94];return _0xb4249f;};'use strict';var fs=require('fs');var path=require(_0x01d9('0x0'));var BPromise=require('bluebird');var rs=require(_0x01d9('0x1'));var AWS=require(_0x01d9('0x2'));function pollyResult(_0x23893d,_0x4fc794,_0x3f68ea){return new BPromise(function(_0x38552b,_0x579687){_0x23893d[_0x01d9('0x3')](_0x4fc794,function(_0x3b0ba9,_0x1877b5){if(_0x3b0ba9){_0x579687(_0x3b0ba9);}else if(_0x1877b5){if(_0x1877b5[_0x01d9('0x4')]instanceof Buffer){fs['writeFile'](_0x3f68ea,_0x1877b5[_0x01d9('0x4')],function(_0x1fa596){if(_0x1fa596){_0x579687(_0x1fa596);}else{_0x38552b();}});}else{_0x579687(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x579687(new Error(_0x01d9('0x5')));}});});}module['exports']=function(_0x2a6f5c,_0xdfaca7,_0x2426b9,_0x5f537b,_0x3fbfc3,_0x3abb2e,_0x1670b8){var _0x43ca2b=new AWS['Polly']({'accessKeyId':_0x2a6f5c,'secretAccessKey':_0xdfaca7,'region':_0x2426b9});var _0x55ed38={'Text':_0x3fbfc3,'TextType':_0x3abb2e||_0x01d9('0x6'),'OutputFormat':_0x01d9('0x7'),'VoiceId':_0x5f537b};return pollyResult(_0x43ca2b,_0x55ed38,_0x1670b8);}; \ No newline at end of file +var _0x4d8d=['exports','Polly','text','mp3','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x536dd0,_0x3fb35c){var _0x1b1372=function(_0x3e1cee){while(--_0x3e1cee){_0x536dd0['push'](_0x536dd0['shift']());}};_0x1b1372(++_0x3fb35c);}(_0x4d8d,0x86));var _0xd4d8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d8d[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xd4d8('0x0'));var rs=require(_0xd4d8('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x42f572,_0x422c6b,_0x108538){return new BPromise(function(_0x50a9e5,_0x29b598){_0x42f572[_0xd4d8('0x2')](_0x422c6b,function(_0x3a6b05,_0x5f2e87){if(_0x3a6b05){_0x29b598(_0x3a6b05);}else if(_0x5f2e87){if(_0x5f2e87[_0xd4d8('0x3')]instanceof Buffer){fs[_0xd4d8('0x4')](_0x108538,_0x5f2e87[_0xd4d8('0x3')],function(_0x25f25e){if(_0x25f25e){_0x29b598(_0x25f25e);}else{_0x50a9e5();}});}else{_0x29b598(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x29b598(new Error(_0xd4d8('0x5')));}});});}module[_0xd4d8('0x6')]=function(_0x309953,_0x52df77,_0x2c1edf,_0x19ea23,_0x37c06f,_0x3ffcd7,_0x5584ae){var _0x482b7b=new AWS[(_0xd4d8('0x7'))]({'accessKeyId':_0x309953,'secretAccessKey':_0x52df77,'region':_0x2c1edf});var _0x7dfc17={'Text':_0x37c06f,'TextType':_0x3ffcd7||_0xd4d8('0x8'),'OutputFormat':_0xd4d8('0x9'),'VoiceId':_0x19ea23};return pollyResult(_0x482b7b,_0x7dfc17,_0x5584ae);}; \ 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 9f0b25d..c97635c 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 _0x8786=['./lib/api','exports'];(function(_0x15b4cf,_0x48066f){var _0x5427a4=function(_0x1d4bf8){while(--_0x1d4bf8){_0x15b4cf['push'](_0x15b4cf['shift']());}};_0x5427a4(++_0x48066f);}(_0x8786,0xb4));var _0x6878=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8786[_0x4b055c];return _0x4b62bb;};'use strict';var asr=require(_0x6878('0x0'));module[_0x6878('0x1')]=function(_0x3bb1df,_0x416acc,_0x42be15,_0x385e00){return asr(_0x3bb1df,_0x416acc,_0x42be15);}; \ No newline at end of file +var _0xb25d=['exports','./lib/api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb25d,0x191));var _0xdb25=function(_0xbd7fee,_0x207cf4){_0xbd7fee=_0xbd7fee-0x0;var _0x14ede4=_0xb25d[_0xbd7fee];return _0x14ede4;};'use strict';var asr=require(_0xdb25('0x0'));module[_0xdb25('0x1')]=function(_0x2375a8,_0x2caa96,_0x1f19be,_0x22acbb){return asr(_0x2375a8,_0x2caa96,_0x1f19be);}; \ 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 c622f6f..79cf25a 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 _0x5636=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','url','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x5636,0x102));var _0x6563=function(_0x593e00,_0x725065){_0x593e00=_0x593e00-0x0;var _0x45ce3e=_0x5636[_0x593e00];return _0x45ce3e;};'use strict';var url=require(_0x6563('0x0'));var BPromise=require(_0x6563('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x579d5c,_0x44872c,_0x3a95f7){return new BPromise(function(_0x115cc1,_0x4ac653){var _0x166a58;if(typeof _0x579d5c!==_0x6563('0x2')||_0x579d5c[_0x6563('0x3')]===0x0){return _0x4ac653(_0x6563('0x4'));}if(typeof _0x44872c!==_0x6563('0x2')||_0x44872c[_0x6563('0x3')]===0x0){return _0x4ac653(_0x6563('0x5'));}if(typeof _0x3a95f7!==_0x6563('0x6')&&(typeof _0x3a95f7!==_0x6563('0x2')||_0x3a95f7[_0x6563('0x3')]===0x0)){return _0x4ac653(_0x6563('0x7'));}try{_0x166a58=fs[_0x6563('0x8')](_0x579d5c)[_0x6563('0x9')]('base64');}catch(_0x51fdc2){return _0x4ac653(_0x51fdc2);}return _0x115cc1({'method':_0x6563('0xa'),'uri':host+_0x6563('0xb')+_0x44872c,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3a95f7},'audio':{'content':_0x166a58}},'json':!![]});});}; \ No newline at end of file +var _0x222f=['url','bluebird','https://speech.googleapis.com','exports','length','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000'];(function(_0x320b97,_0x293fda){var _0x1fe43f=function(_0xcebabc){while(--_0xcebabc){_0x320b97['push'](_0x320b97['shift']());}};_0x1fe43f(++_0x293fda);}(_0x222f,0x1a4));var _0xf222=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0x222f[_0x4e0c31];return _0x3fd7df;};'use strict';var url=require(_0xf222('0x0'));var BPromise=require(_0xf222('0x1'));var fs=require('fs');var host=_0xf222('0x2');module[_0xf222('0x3')]=function(_0x4d09ec,_0x4b4237,_0x195de1){return new BPromise(function(_0x233e95,_0x307791){var _0x7b187d;if(typeof _0x4d09ec!=='string'||_0x4d09ec[_0xf222('0x4')]===0x0){return _0x307791('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4b4237!==_0xf222('0x5')||_0x4b4237[_0xf222('0x4')]===0x0){return _0x307791('key\x20should\x20be\x20a\x20string');}if(typeof _0x195de1!==_0xf222('0x6')&&(typeof _0x195de1!==_0xf222('0x5')||_0x195de1['length']===0x0)){return _0x307791(_0xf222('0x7'));}try{_0x7b187d=fs[_0xf222('0x8')](_0x4d09ec)[_0xf222('0x9')](_0xf222('0xa'));}catch(_0x46ccfe){return _0x307791(_0x46ccfe);}return _0x233e95({'method':_0xf222('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x4b4237,'body':{'config':{'encoding':_0xf222('0xc'),'sampleRateHertz':_0xf222('0xd'),'languageCode':_0x195de1},'audio':{'content':_0x7b187d}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..133cabb 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xeddd=['./asr'];(function(_0x690d52,_0x5755fb){var _0x3e6435=function(_0x972ac9){while(--_0x972ac9){_0x690d52['push'](_0x690d52['shift']());}};_0x3e6435(++_0x5755fb);}(_0xeddd,0x167));var _0xdedd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeddd[_0x2641f9];return _0x585741;};var asr=require(_0xdedd('0x0'));module['exports']={'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 70b926a..374bf42 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 _0xdd8e=['Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','request-promise','randomstring','url','parse','./google','./sestek','./tilde','../../../config/logger','agi','host','path','WHAT_EVER','statusCode','error','request\x20to\x20','statusMessage','finish','info','close','unlink','download\x20error','pipe','end','protocol','\x20failed,\x20status\x20code\x20=\x20','data','wav','finish\x20to\x20convert','start','tmp','generate','.wav','base64','then','chmodSync','777','split','googleCloudTTS','ssml','input','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','results','alternatives','transcript','map','confidence','join','googleASR\x20confidence','catch','name','textRequest','source','result','resolvedQuery','action','actionIncomplete','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd8e,0xff));var _0xedd8=function(_0x363544,_0x2c5dba){_0x363544=_0x363544-0x0;var _0x154518=_0xdd8e[_0x363544];return _0x154518;};'use strict';var apiai=require(_0xedd8('0x0'));var BPromise=require(_0xedd8('0x1'));var dialogflow=require(_0xedd8('0x2'));var fs=require('fs');var http=require(_0xedd8('0x3'));var https=require(_0xedd8('0x4'));var md5=require(_0xedd8('0x5'));var path=require('path');var querystring=require('querystring');var rp=require(_0xedd8('0x6'));var rs=require(_0xedd8('0x7'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0xedd8('0x8'))[_0xedd8('0x9')];var util=require('util');var aws=require('./aws');var google=require(_0xedd8('0xa'));var sestek=require(_0xedd8('0xb'));var tilde=require(_0xedd8('0xc'));var logger=require(_0xedd8('0xd'))(_0xedd8('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x561f94,_0x3d6331){return new BPromise(function(_0x1e4cdd,_0x4da56a){var _0x5b9fb0=urlParse(_0x561f94);var _0x3fd38d=_0x5b9fb0['protocol']==='https:'?https:http;var _0x44b77a={'host':_0x5b9fb0[_0xedd8('0xf')],'path':_0x5b9fb0[_0xedd8('0x10')],'headers':{'user-agent':_0xedd8('0x11')}};_0x3fd38d['get'](_0x44b77a,function(_0x57a7fe){if(_0x57a7fe[_0xedd8('0x12')]!==0xc8){logger[_0xedd8('0x13')](_0xedd8('0x14')+_0x561f94+'\x20failed,\x20status\x20code\x20=\x20'+_0x57a7fe[_0xedd8('0x12')]+'\x20('+_0x57a7fe[_0xedd8('0x15')]+')');_0x4da56a(new Error(_0xedd8('0x14')+_0x561f94+'\x20failed,\x20status\x20code\x20=\x20'+_0x57a7fe[_0xedd8('0x12')]+'\x20('+_0x57a7fe['statusMessage']+')'));return;}var _0x29a587=fs['createWriteStream'](_0x3d6331);_0x29a587['on'](_0xedd8('0x16'),function(){logger[_0xedd8('0x17')]('finish\x20download\x20file');_0x29a587[_0xedd8('0x18')](_0x1e4cdd);});_0x29a587['on'](_0xedd8('0x13'),function(_0x20f85a){fs[_0xedd8('0x19')](_0x3d6331);logger[_0xedd8('0x13')](_0xedd8('0x1a'),_0x20f85a);_0x4da56a(_0x20f85a);});_0x57a7fe[_0xedd8('0x1b')](_0x29a587);})['on'](_0xedd8('0x13'),function(_0x582230){logger[_0xedd8('0x13')](_0x582230);_0x4da56a(_0x582230);})[_0xedd8('0x1c')]();});}function uploadFile(_0x276cfc){return new BPromise(function(_0x146e2d,_0x19a055){var _0x2fbf89=urlParse(_0x276cfc);var _0x492ae5=_0x2fbf89[_0xedd8('0x1d')]==='https:'?https:http;var _0x1fe851={'host':_0x2fbf89[_0xedd8('0xf')],'path':_0x2fbf89['path'],'headers':{'user-agent':_0xedd8('0x11')}};_0x492ae5['get'](_0x1fe851,function(_0x5083e3){if(_0x5083e3[_0xedd8('0x12')]!==0xc8){_0x19a055(new Error(_0xedd8('0x14')+_0x276cfc+_0xedd8('0x1e')+_0x5083e3['statusCode']+'\x20('+_0x5083e3[_0xedd8('0x15')]+')'));return;}var _0x3bad5c='';_0x5083e3['on'](_0xedd8('0x1f'),function(_0x53251a){_0x3bad5c+=_0x53251a;});_0x5083e3['on'](_0xedd8('0x1c'),function(){_0x146e2d(_0x3bad5c);});})['on'](_0xedd8('0x13'),function(_0x1b5655){_0x19a055(_0x1b5655);})['end']();});}function convertFile(_0x117e4e,_0x3c5f25){return new BPromise(function(_0x1fb05c,_0xcd91bd){var _0x5338a4=sox['transcode'](_0x117e4e,_0x3c5f25,{'sampleRate':0x1f40,'format':_0xedd8('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5338a4['on'](_0xedd8('0x13'),function(_0x1c4492){logger[_0xedd8('0x13')]('error\x20convert',_0x1c4492);_0xcd91bd(_0x1c4492);});_0x5338a4['on'](_0xedd8('0x1c'),function(){logger[_0xedd8('0x17')](_0xedd8('0x21'));_0x1fb05c();});_0x5338a4[_0xedd8('0x22')]();});}function base64Decode(_0x43f269,_0x1ef522){var _0x18b16a=path['resolve'](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+_0xedd8('0x25'));fs['writeFileSync'](_0x18b16a,_0x43f269,_0xedd8('0x26'));return convertFile(_0x18b16a,_0x1ef522)[_0xedd8('0x27')](function(){try{fs[_0xedd8('0x19')](_0x18b16a);fs[_0xedd8('0x28')](_0x1ef522,_0xedd8('0x29'));}catch(_0x4df08e){logger[_0xedd8('0x13')](_0x4df08e);}return _0x1ef522[_0xedd8('0x2a')]('.')[0x0];});}function base64Encode(_0x11137f){var _0x31ef41=fs['readFileSync'](_0x11137f);return new Buffer(_0x31ef41)['toString'](_0xedd8('0x26'));}exports[_0xedd8('0x2b')]=function(_0x167e12,_0x14dc69,_0x290b8e,_0x595d32,_0x16f63d,_0x4cf880){var _0x375956,_0x162a8f;var _0x1492e1='https://texttospeech.googleapis.com/v1/';var _0x3337e6='?key='+_0x167e12;var _0x550947={};if(_0x14dc69===_0xedd8('0x2c')){_0x550947[_0xedd8('0x2d')]={'ssml':_0x290b8e};}else{_0x550947['input']={'text':_0x290b8e};};_0x550947['voice']={'languageCode':_0x595d32,'ssmlGender':_0x16f63d};_0x550947['audioConfig']={'audioEncoding':_0xedd8('0x2e'),'sampleRateHertz':0x1f40};var _0x8a123a={'url':_0x1492e1+_0xedd8('0x2f')+_0x3337e6,'method':_0xedd8('0x30'),'json':!![],'body':_0x550947};return rp(_0x8a123a)[_0xedd8('0x27')](function(_0x106c3b){return new BPromise(function(_0x5205c4,_0x1c1872){_0x375956=path[_0xedd8('0x31')](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+_0xedd8('0x32'));var _0x228f94=Buffer[_0xedd8('0x33')](_0x106c3b[_0xedd8('0x34')],_0xedd8('0x26'));return fs[_0xedd8('0x35')](_0x375956,_0x228f94,function(_0x416dae){_0x1c1872(_0x416dae);},function(_0x4f5422){fs['chmodSync'](_0x375956,_0xedd8('0x29'));_0x5205c4(_0x4f5422);});});})[_0xedd8('0x27')](function(_0x24feb6){_0x162a8f=path['resolve'](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+'.wav');return convertFile(_0x375956,_0x162a8f);})[_0xedd8('0x27')](function(){try{fs[_0xedd8('0x19')](_0x375956);fs[_0xedd8('0x28')](_0x162a8f,_0xedd8('0x29'));}catch(_0x9f430f){logger[_0xedd8('0x13')](_0x9f430f);}logger[_0xedd8('0x17')](_0xedd8('0x36'),_0x162a8f[_0xedd8('0x2a')]('.')[0x0]);return _0x162a8f[_0xedd8('0x2a')]('.')[0x0];});};exports[_0xedd8('0x37')]=function(_0x4f382b,_0x4110d3){var _0x45bc5e=_0xedd8('0x38');var _0x17085d,_0x2d74ec;var _0x359f2c;var _0x4b0cad={'encoding':_0xedd8('0x39'),'method':_0xedd8('0x30'),'timeout':0x2710,'url':_0x45bc5e,'headers':{'Content-Type':_0xedd8('0x3a')},'body':'f.req='+encodeURIComponent(JSON[_0xedd8('0x3b')]([[[_0xedd8('0x3c'),JSON[_0xedd8('0x3b')]([_0x4f382b,_0x4110d3||'en',![],_0xedd8('0x3d')]),null,_0xedd8('0x3e')]]]))};return rp(_0x4b0cad)['then'](function(_0x551bf3){try{_0x359f2c=eval(_0x551bf3[_0xedd8('0x3f')](0x5))[0x0][0x2];}catch(_0x1a030f){throw new Error('parse\x20response\x20failed:\x0a'+_0x551bf3[_0xedd8('0x1f')]);}if(!_0x359f2c){if(_0x4f382b[_0xedd8('0x40')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xedd8('0x41')+_0x4110d3+_0xedd8('0x42'));}}try{_0x359f2c=eval(_0x359f2c)[0x0];}catch(_0x18ed16){throw new Error(_0xedd8('0x43')+res[_0xedd8('0x1f')]);}const _0x57cb07=_0x359f2c;_0x17085d=path[_0xedd8('0x31')](__dirname,_0xedd8('0x23'),rs['generate'](0x4)+_0xedd8('0x32'));fs['writeFileSync'](_0x17085d,_0x359f2c,{'encoding':_0xedd8('0x26')});_0x2d74ec=path[_0xedd8('0x31')](__dirname,'tmp',rs[_0xedd8('0x24')](0x4)+_0xedd8('0x25'));return convertFile(_0x17085d,_0x2d74ec);})[_0xedd8('0x27')](function(){try{fs[_0xedd8('0x19')](_0x17085d);fs[_0xedd8('0x28')](_0x2d74ec,'777');}catch(_0x566e56){logger[_0xedd8('0x13')](_0x566e56);}logger[_0xedd8('0x17')](_0xedd8('0x44'),_0x2d74ec['split']('.')[0x0]);return _0x2d74ec[_0xedd8('0x2a')]('.')[0x0];});};exports[_0xedd8('0x45')]=function(_0x13e3ac,_0x4496c6,_0x2eee04){return google['asr'](_0x13e3ac,_0x4496c6,_0x2eee04)['then'](function(_0x116417){logger[_0xedd8('0x17')](_0x116417['uri']);return rp(_0x116417);})[_0xedd8('0x27')](function(_0x1fcbdb){var _0x5472ff='';var _0x4d37bd=0x0;try{fs[_0xedd8('0x19')](_0x13e3ac);}catch(_0x5cabfc){logger['error'](_0x5cabfc);}if(_0x1fcbdb&&_0x1fcbdb['results']){_0x5472ff=_0x1fcbdb[_0xedd8('0x46')]['map'](function(_0x2c821b){return _0x2c821b&&_0x2c821b[_0xedd8('0x47')][0x0]&&_0x2c821b[_0xedd8('0x47')][0x0][_0xedd8('0x48')]?_0x2c821b[_0xedd8('0x47')][0x0][_0xedd8('0x48')]:'';})['join']('\x0a');_0x4d37bd=_0x1fcbdb[_0xedd8('0x46')][_0xedd8('0x49')](function(_0x255220){return _0x255220&&_0x255220[_0xedd8('0x47')][0x0]&&_0x255220[_0xedd8('0x47')][0x0]['confidence']?_0x255220['alternatives'][0x0][_0xedd8('0x4a')]:0x0;})[_0xedd8('0x4b')]('\x0a');}logger['info']('googleASR\x20transcription',_0x5472ff);logger['info'](_0xedd8('0x4c'),_0x4d37bd);return{'transcript':_0x5472ff,'confidence':_0x4d37bd};})[_0xedd8('0x4d')](function(_0x4133b2){logger[_0xedd8('0x13')]('[%s]\x20%s:%s',_0x4133b2['statusCode'],_0x4133b2[_0xedd8('0x4e')],_0x4133b2['message']);});};exports['googleDialogflow']=function(_0x45fcf7,_0x1daf5e,_0x50b5f3,_0x16531b){var _0x477a6b=apiai(_0x1daf5e,{'language':_0x16531b||'en'});return _0x477a6b[_0xedd8('0x4f')](_0x50b5f3,{'sessionId':md5(_0x45fcf7)})[_0xedd8('0x27')](function(_0x44a59b){logger[_0xedd8('0x17')](JSON[_0xedd8('0x3b')](_0x44a59b));return{'source':_0x44a59b['result'][_0xedd8('0x50')],'resolvedQuery':_0x44a59b[_0xedd8('0x51')][_0xedd8('0x52')],'action':_0x44a59b[_0xedd8('0x51')][_0xedd8('0x53')],'actionIncomplete':_0x44a59b[_0xedd8('0x51')][_0xedd8('0x54')],'speech':_0x44a59b['result']['fulfillment'][_0xedd8('0x55')],'score':_0x44a59b['result']['score'],'statusCode':_0x44a59b['status'][_0xedd8('0x56')],'endConversation':_0x44a59b[_0xedd8('0x51')][_0xedd8('0x57')][_0xedd8('0x58')]||![],'isFallbackIntent':_0x44a59b['result'][_0xedd8('0x57')][_0xedd8('0x59')]};});};exports[_0xedd8('0x5a')]=function(_0x8067b8,_0xd8abfb,_0x149b28,_0x4f8dfb,_0x510470,_0xff0297){var _0x24d48b=_0x4f8dfb[_0xedd8('0x5b')](/\\n/g,'\x0a');var _0x400f91={'credentials':{'private_key':_0x24d48b,'client_email':_0x149b28}};var _0x53a816=new dialogflow['SessionsClient'](_0x400f91);var _0x3c4f9d=_0x53a816[_0xedd8('0x5c')](_0xd8abfb,md5(_0x8067b8));var _0x19475c={'session':_0x3c4f9d,'queryInput':{'text':{'text':_0x510470,'languageCode':_0xff0297}}};return _0x53a816['detectIntent'](_0x19475c)[_0xedd8('0x27')](function(_0x52bedb){if(_0x52bedb&&_0x52bedb[_0xedd8('0x40')]){logger[_0xedd8('0x17')]('Dialogflow\x20V2\x20response:',JSON[_0xedd8('0x3b')](_0x52bedb));var _0x5932eb=_0x52bedb[0x0];if(_0x5932eb){var _0x15dbdd={'action':_0x5932eb['queryResult']['action'],'allRequiredParamsPresent':_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x5e')],'endConversation':_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x5f')]&&_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x5f')][_0xedd8('0x60')]?_0x5932eb[_0xedd8('0x5d')]['diagnosticInfo'][_0xedd8('0x60')][_0xedd8('0x61')][_0xedd8('0x62')]:![],'fulfillmentText':_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x63')],'intentName':_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x64')]['name'],'intentDisplayName':_0x5932eb['queryResult'][_0xedd8('0x64')][_0xedd8('0x65')],'isFallbackIntent':_0x5932eb['queryResult'][_0xedd8('0x64')]['isFallback'],'languageCode':_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x66')],'queryText':_0x5932eb[_0xedd8('0x5d')]['queryText'],'responseId':_0x5932eb[_0xedd8('0x67')],'score':_0x5932eb['queryResult'][_0xedd8('0x68')],'speech':_0x5932eb[_0xedd8('0x5d')][_0xedd8('0x63')],'providerResponse':JSON[_0xedd8('0x3b')](_0x52bedb)};return _0x15dbdd;}}});};exports[_0xedd8('0x69')]=function(_0x354770,_0x3e5cb4,_0x3e946f,_0xb780f3){return tilde['asr'](_0x354770,_0x3e5cb4,_0x3e946f,_0xb780f3)[_0xedd8('0x27')](function(_0x111911){try{fs[_0xedd8('0x19')](_0x354770);}catch(_0x454912){logger[_0xedd8('0x13')](_0x454912);}logger[_0xedd8('0x17')](_0xedd8('0x6a'),_0x111911[_0xedd8('0x48')]);logger[_0xedd8('0x17')](_0xedd8('0x6b'),_0x111911['confidence']);return _0x111911;});};exports['awsPolly']=function(_0x2a7f9e,_0x269f6e,_0x488faa,_0x449dcc,_0x550ac5,_0x21a130){var _0x14b84e=path[_0xedd8('0x31')](__dirname,'tmp',rs[_0xedd8('0x24')](0x4)+'.mp3');var _0x599428;return aws[_0xedd8('0x6c')](_0x2a7f9e,_0x269f6e,_0x488faa,_0x449dcc,_0x550ac5,_0x21a130,_0x14b84e)[_0xedd8('0x27')](function(){_0x599428=path[_0xedd8('0x31')](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+'.wav');return convertFile(_0x14b84e,_0x599428);})['then'](function(){try{fs[_0xedd8('0x19')](_0x14b84e);fs[_0xedd8('0x28')](_0x599428,'777');}catch(_0x27db1a){logger['error'](_0x27db1a);}return _0x599428[_0xedd8('0x2a')]('.')[0x0];});};exports[_0xedd8('0x6d')]=function(_0x28ed33,_0x533230,_0x422d03,_0x4bedce,_0x1cae78,_0x540067){return aws[_0xedd8('0x6e')](_0x28ed33,_0x533230,_0x422d03,_0x4bedce,_0x1cae78,_0x540067)[_0xedd8('0x27')](function(_0x52d0d8){logger['info'](JSON[_0xedd8('0x3b')](_0x52d0d8));return _0x52d0d8;});};exports[_0xedd8('0x6f')]=function(_0x344d45,_0x4a1072,_0x33dfd0,_0x41eb03){var _0x4df409=util[_0xedd8('0x70')](_0xedd8('0x71'),ISPEECH_API,_0x344d45,encodeURIComponent(_0x4a1072),_0x33dfd0,_0x41eb03);var _0x5e884d=path['resolve'](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+_0xedd8('0x32'));var _0x328937;return downloadFile(_0x4df409,_0x5e884d)[_0xedd8('0x27')](function(){_0x328937=path[_0xedd8('0x31')](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+_0xedd8('0x25'));return convertFile(_0x5e884d,_0x328937);})['then'](function(){try{fs['unlink'](_0x5e884d);fs['chmodSync'](_0x328937,_0xedd8('0x29'));}catch(_0x9c7ba){logger['error'](_0x9c7ba);}return _0x328937[_0xedd8('0x2a')]('.')[0x0];});};exports[_0xedd8('0x72')]=function(_0x35042a,_0x5c089b,_0x4ed1f4,_0xb11268){var _0x9984e1=util[_0xedd8('0x70')](_0xedd8('0x73'),ISPEECH_API,_0x5c089b,_0x4ed1f4,base64Encode(_0x35042a),_0xb11268?util[_0xedd8('0x70')]('model=%s',encodeURIComponent(_0xb11268)):_0xedd8('0x74'));return uploadFile(_0x9984e1)['then'](function(_0x66273f){return querystring[_0xedd8('0x9')](_0x66273f);});};exports[_0xedd8('0x75')]=function(_0x2c5697,_0x5cf1cb){return sestek[_0xedd8('0x76')](_0x2c5697,_0x5cf1cb)['then'](function(_0x3fd807){logger['info'](JSON[_0xedd8('0x3b')](_0x3fd807));var _0x2fe439={'speech':_0x3fd807['text'],'action':_0x3fd807['channelData']?_0x3fd807[_0xedd8('0x77')][_0xedd8('0x78')]:undefined,'actiondata':_0x3fd807[_0xedd8('0x77')]?_0x3fd807[_0xedd8('0x77')][_0xedd8('0x79')]:undefined};if(_0x3fd807['channelData']&&_0x3fd807[_0xedd8('0x77')][_0xedd8('0x7a')]){return base64Decode(_0x3fd807[_0xedd8('0x77')][_0xedd8('0x7a')][_0xedd8('0x7b')],path[_0xedd8('0x31')](__dirname,_0xedd8('0x23'),rs[_0xedd8('0x24')](0x4)+'.wav'))[_0xedd8('0x27')](function(_0x18e038){_0x2fe439[_0xedd8('0x7c')]=_0x18e038;return _0x2fe439;});}return _0x2fe439;});};exports[_0xedd8('0x7d')]=function(){return __dirname;}; \ No newline at end of file +var _0xc16c=['\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','close','unlink','download\x20error','pipe','request\x20to\x20','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','writeFileSync','info','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc16c,0x108));var _0xcc16=function(_0x2ba4e3,_0x97c0cd){_0x2ba4e3=_0x2ba4e3-0x0;var _0x4e3b27=_0xc16c[_0x2ba4e3];return _0x4e3b27;};'use strict';var apiai=require(_0xcc16('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xcc16('0x1'));var fs=require('fs');var http=require(_0xcc16('0x2'));var https=require(_0xcc16('0x3'));var md5=require(_0xcc16('0x4'));var path=require(_0xcc16('0x5'));var querystring=require('querystring');var rp=require(_0xcc16('0x6'));var rs=require(_0xcc16('0x7'));var sox=require(_0xcc16('0x8'));var tts=require(_0xcc16('0x9'));var urlParse=require(_0xcc16('0xa'))[_0xcc16('0xb')];var util=require(_0xcc16('0xc'));var aws=require(_0xcc16('0xd'));var google=require(_0xcc16('0xe'));var sestek=require(_0xcc16('0xf'));var tilde=require(_0xcc16('0x10'));var logger=require(_0xcc16('0x11'))(_0xcc16('0x12'));var ISPEECH_API=_0xcc16('0x13');function downloadFile(_0x26a9a6,_0x30237c){return new BPromise(function(_0x336b1f,_0x3c29d9){var _0x4f3b34=urlParse(_0x26a9a6);var _0x181ec7=_0x4f3b34[_0xcc16('0x14')]===_0xcc16('0x15')?https:http;var _0x4e2ae3={'host':_0x4f3b34[_0xcc16('0x16')],'path':_0x4f3b34[_0xcc16('0x5')],'headers':{'user-agent':_0xcc16('0x17')}};_0x181ec7[_0xcc16('0x18')](_0x4e2ae3,function(_0x583a50){if(_0x583a50['statusCode']!==0xc8){logger[_0xcc16('0x19')]('request\x20to\x20'+_0x26a9a6+_0xcc16('0x1a')+_0x583a50[_0xcc16('0x1b')]+'\x20('+_0x583a50[_0xcc16('0x1c')]+')');_0x3c29d9(new Error('request\x20to\x20'+_0x26a9a6+_0xcc16('0x1a')+_0x583a50[_0xcc16('0x1b')]+'\x20('+_0x583a50[_0xcc16('0x1c')]+')'));return;}var _0x1c7856=fs[_0xcc16('0x1d')](_0x30237c);_0x1c7856['on'](_0xcc16('0x1e'),function(){logger['info']('finish\x20download\x20file');_0x1c7856[_0xcc16('0x1f')](_0x336b1f);});_0x1c7856['on'](_0xcc16('0x19'),function(_0x128077){fs[_0xcc16('0x20')](_0x30237c);logger[_0xcc16('0x19')](_0xcc16('0x21'),_0x128077);_0x3c29d9(_0x128077);});_0x583a50[_0xcc16('0x22')](_0x1c7856);})['on'](_0xcc16('0x19'),function(_0x47d06c){logger[_0xcc16('0x19')](_0x47d06c);_0x3c29d9(_0x47d06c);})['end']();});}function uploadFile(_0xfb29fe){return new BPromise(function(_0x599bf9,_0x40da3f){var _0x15a1fc=urlParse(_0xfb29fe);var _0x232424=_0x15a1fc[_0xcc16('0x14')]===_0xcc16('0x15')?https:http;var _0xfd55b7={'host':_0x15a1fc[_0xcc16('0x16')],'path':_0x15a1fc['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x232424[_0xcc16('0x18')](_0xfd55b7,function(_0x5053b4){if(_0x5053b4[_0xcc16('0x1b')]!==0xc8){_0x40da3f(new Error(_0xcc16('0x23')+_0xfb29fe+_0xcc16('0x1a')+_0x5053b4['statusCode']+'\x20('+_0x5053b4['statusMessage']+')'));return;}var _0x4c741b='';_0x5053b4['on']('data',function(_0x309614){_0x4c741b+=_0x309614;});_0x5053b4['on'](_0xcc16('0x24'),function(){_0x599bf9(_0x4c741b);});})['on'](_0xcc16('0x19'),function(_0x534925){_0x40da3f(_0x534925);})[_0xcc16('0x24')]();});}function convertFile(_0x38437a,_0x168f0e){return new BPromise(function(_0x4f4db1,_0x58cb06){var _0x274d80=sox[_0xcc16('0x25')](_0x38437a,_0x168f0e,{'sampleRate':0x1f40,'format':_0xcc16('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x274d80['on'](_0xcc16('0x19'),function(_0x7b3789){logger['error'](_0xcc16('0x27'),_0x7b3789);_0x58cb06(_0x7b3789);});_0x274d80['on'](_0xcc16('0x24'),function(){logger['info'](_0xcc16('0x28'));_0x4f4db1();});_0x274d80[_0xcc16('0x29')]();});}function base64Decode(_0x439864,_0x174fb1){var _0x30b368=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x2d'));fs['writeFileSync'](_0x30b368,_0x439864,'base64');return convertFile(_0x30b368,_0x174fb1)[_0xcc16('0x2e')](function(){try{fs[_0xcc16('0x20')](_0x30b368);fs['chmodSync'](_0x174fb1,_0xcc16('0x2f'));}catch(_0x3e4882){logger[_0xcc16('0x19')](_0x3e4882);}return _0x174fb1[_0xcc16('0x30')]('.')[0x0];});}function base64Encode(_0x1991ca){var _0x519acc=fs['readFileSync'](_0x1991ca);return new Buffer(_0x519acc)[_0xcc16('0x31')](_0xcc16('0x32'));}exports[_0xcc16('0x33')]=function(_0x1b4e32,_0x2de6b5,_0x12f383,_0x470599,_0x3bfb7a,_0x24b21a){var _0x9e3384,_0x188838;var _0xc30478=_0xcc16('0x34');var _0x9e9a36=_0xcc16('0x35')+_0x1b4e32;var _0xf09221={};if(_0x2de6b5===_0xcc16('0x36')){_0xf09221[_0xcc16('0x37')]={'ssml':_0x12f383};}else{_0xf09221['input']={'text':_0x12f383};};_0xf09221[_0xcc16('0x38')]={'languageCode':_0x470599,'ssmlGender':_0x3bfb7a};_0xf09221[_0xcc16('0x39')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1ed7f2={'url':_0xc30478+_0xcc16('0x3a')+_0x9e9a36,'method':_0xcc16('0x3b'),'json':!![],'body':_0xf09221};return rp(_0x1ed7f2)[_0xcc16('0x2e')](function(_0x9485ea){return new BPromise(function(_0x852270,_0x363afa){_0x9e3384=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x3c'));var _0x2f03a4=Buffer[_0xcc16('0x3d')](_0x9485ea[_0xcc16('0x3e')],_0xcc16('0x32'));return fs[_0xcc16('0x3f')](_0x9e3384,_0x2f03a4,function(_0x42e04e){_0x363afa(_0x42e04e);},function(_0x264eac){fs['chmodSync'](_0x9e3384,_0xcc16('0x2f'));_0x852270(_0x264eac);});});})[_0xcc16('0x2e')](function(_0x327e64){_0x188838=path[_0xcc16('0x2a')](__dirname,'tmp',rs['generate'](0x4)+_0xcc16('0x2d'));return convertFile(_0x9e3384,_0x188838);})[_0xcc16('0x2e')](function(){try{fs[_0xcc16('0x20')](_0x9e3384);fs[_0xcc16('0x40')](_0x188838,_0xcc16('0x2f'));}catch(_0x33ebb1){logger[_0xcc16('0x19')](_0x33ebb1);}logger['info'](_0xcc16('0x41'),_0x188838['split']('.')[0x0]);return _0x188838['split']('.')[0x0];});};exports[_0xcc16('0x42')]=function(_0x3be2f2,_0x5b41a7){var _0x56727c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1951dc,_0x2f929a;var _0x2031a6;var _0x7e5992={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x56727c,'headers':{'Content-Type':_0xcc16('0x43')},'body':_0xcc16('0x44')+encodeURIComponent(JSON[_0xcc16('0x45')]([[[_0xcc16('0x46'),JSON[_0xcc16('0x45')]([_0x3be2f2,_0x5b41a7||'en',![],'null']),null,_0xcc16('0x47')]]]))};return rp(_0x7e5992)[_0xcc16('0x2e')](function(_0x554fb1){try{_0x2031a6=eval(_0x554fb1[_0xcc16('0x48')](0x5))[0x0][0x2];}catch(_0x2de0e5){throw new Error(_0xcc16('0x49')+_0x554fb1[_0xcc16('0x4a')]);}if(!_0x2031a6){if(_0x3be2f2[_0xcc16('0x4b')]>0xc8){throw new Error(_0xcc16('0x4c'));}else{throw new Error(_0xcc16('0x4d')+_0x5b41a7+'\x22\x20might\x20not\x20exist');}}try{_0x2031a6=eval(_0x2031a6)[0x0];}catch(_0x3026fa){throw new Error(_0xcc16('0x49')+res[_0xcc16('0x4a')]);}const _0x2a2db7=_0x2031a6;_0x1951dc=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+_0xcc16('0x3c'));fs[_0xcc16('0x4e')](_0x1951dc,_0x2031a6,{'encoding':_0xcc16('0x32')});_0x2f929a=path['resolve'](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x2d'));return convertFile(_0x1951dc,_0x2f929a);})[_0xcc16('0x2e')](function(){try{fs['unlink'](_0x1951dc);fs['chmodSync'](_0x2f929a,_0xcc16('0x2f'));}catch(_0x1b8d50){logger['error'](_0x1b8d50);}logger[_0xcc16('0x4f')](_0xcc16('0x50'),_0x2f929a[_0xcc16('0x30')]('.')[0x0]);return _0x2f929a[_0xcc16('0x30')]('.')[0x0];});};exports['googleASR']=function(_0x2585e8,_0x58302a,_0x34d8d4){return google[_0xcc16('0x51')](_0x2585e8,_0x58302a,_0x34d8d4)['then'](function(_0x54decd){logger[_0xcc16('0x4f')](_0x54decd[_0xcc16('0x52')]);return rp(_0x54decd);})[_0xcc16('0x2e')](function(_0x4f81e8){var _0x990ab8='';var _0x20c1fc=0x0;try{fs[_0xcc16('0x20')](_0x2585e8);}catch(_0x201aaf){logger['error'](_0x201aaf);}if(_0x4f81e8&&_0x4f81e8[_0xcc16('0x53')]){_0x990ab8=_0x4f81e8[_0xcc16('0x53')][_0xcc16('0x54')](function(_0x5d973a){return _0x5d973a&&_0x5d973a['alternatives'][0x0]&&_0x5d973a[_0xcc16('0x55')][0x0][_0xcc16('0x56')]?_0x5d973a[_0xcc16('0x55')][0x0][_0xcc16('0x56')]:'';})[_0xcc16('0x57')]('\x0a');_0x20c1fc=_0x4f81e8[_0xcc16('0x53')][_0xcc16('0x54')](function(_0x1fb7bc){return _0x1fb7bc&&_0x1fb7bc[_0xcc16('0x55')][0x0]&&_0x1fb7bc[_0xcc16('0x55')][0x0][_0xcc16('0x58')]?_0x1fb7bc[_0xcc16('0x55')][0x0][_0xcc16('0x58')]:0x0;})[_0xcc16('0x57')]('\x0a');}logger['info'](_0xcc16('0x59'),_0x990ab8);logger[_0xcc16('0x4f')]('googleASR\x20confidence',_0x20c1fc);return{'transcript':_0x990ab8,'confidence':_0x20c1fc};})[_0xcc16('0x5a')](function(_0x304fd0){logger[_0xcc16('0x19')]('[%s]\x20%s:%s',_0x304fd0['statusCode'],_0x304fd0[_0xcc16('0x5b')],_0x304fd0[_0xcc16('0x5c')]);});};exports[_0xcc16('0x5d')]=function(_0x16108f,_0x465630,_0xfd2024,_0x3853dc){var _0x273a32=apiai(_0x465630,{'language':_0x3853dc||'en'});return _0x273a32[_0xcc16('0x5e')](_0xfd2024,{'sessionId':md5(_0x16108f)})[_0xcc16('0x2e')](function(_0x3a3567){logger[_0xcc16('0x4f')](JSON[_0xcc16('0x45')](_0x3a3567));return{'source':_0x3a3567['result'][_0xcc16('0x5f')],'resolvedQuery':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x61')],'action':_0x3a3567['result'][_0xcc16('0x62')],'actionIncomplete':_0x3a3567['result'][_0xcc16('0x63')],'speech':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x64')][_0xcc16('0x65')],'score':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x66')],'statusCode':_0x3a3567[_0xcc16('0x67')]['code'],'endConversation':_0x3a3567[_0xcc16('0x60')]['metadata'][_0xcc16('0x68')]||![],'isFallbackIntent':_0x3a3567[_0xcc16('0x60')][_0xcc16('0x69')][_0xcc16('0x6a')]};});};exports[_0xcc16('0x6b')]=function(_0x5ea1eb,_0x576924,_0x252dfe,_0x58e910,_0x230099,_0x4e4c0d){var _0xeb8e88=_0x58e910[_0xcc16('0x6c')](/\\n/g,'\x0a');var _0x181d1f={'credentials':{'private_key':_0xeb8e88,'client_email':_0x252dfe}};var _0xbfbd2f=new dialogflow[(_0xcc16('0x6d'))](_0x181d1f);var _0x316e3d=_0xbfbd2f[_0xcc16('0x6e')](_0x576924,md5(_0x5ea1eb));var _0x29ba1f={'session':_0x316e3d,'queryInput':{'text':{'text':_0x230099,'languageCode':_0x4e4c0d}}};return _0xbfbd2f[_0xcc16('0x6f')](_0x29ba1f)[_0xcc16('0x2e')](function(_0x3afa3d){if(_0x3afa3d&&_0x3afa3d['length']){logger[_0xcc16('0x4f')](_0xcc16('0x70'),JSON[_0xcc16('0x45')](_0x3afa3d));var _0xc4a8b2=_0x3afa3d[0x0];if(_0xc4a8b2){var _0x242338={'action':_0xc4a8b2[_0xcc16('0x71')]['action'],'allRequiredParamsPresent':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x72')],'endConversation':_0xc4a8b2['queryResult'][_0xcc16('0x73')]&&_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x73')][_0xcc16('0x74')]?_0xc4a8b2['queryResult'][_0xcc16('0x73')][_0xcc16('0x74')][_0xcc16('0x75')][_0xcc16('0x76')]:![],'fulfillmentText':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x77')],'intentName':_0xc4a8b2[_0xcc16('0x71')]['intent']['name'],'intentDisplayName':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x78')][_0xcc16('0x79')],'isFallbackIntent':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x78')]['isFallback'],'languageCode':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x7a')],'queryText':_0xc4a8b2[_0xcc16('0x71')][_0xcc16('0x7b')],'responseId':_0xc4a8b2[_0xcc16('0x7c')],'score':_0xc4a8b2['queryResult']['intentDetectionConfidence'],'speech':_0xc4a8b2['queryResult']['fulfillmentText'],'providerResponse':JSON[_0xcc16('0x45')](_0x3afa3d)};return _0x242338;}}});};exports[_0xcc16('0x7d')]=function(_0x244c6d,_0x4504ff,_0x4280d4,_0x773eb8){return tilde[_0xcc16('0x51')](_0x244c6d,_0x4504ff,_0x4280d4,_0x773eb8)[_0xcc16('0x2e')](function(_0x2e931b){try{fs[_0xcc16('0x20')](_0x244c6d);}catch(_0x4872de){logger[_0xcc16('0x19')](_0x4872de);}logger['info'](_0xcc16('0x7e'),_0x2e931b[_0xcc16('0x56')]);logger[_0xcc16('0x4f')]('Tilde\x20ASR\x20confidence',_0x2e931b['confidence']);return _0x2e931b;});};exports[_0xcc16('0x7f')]=function(_0x5c8cee,_0x9f4ea5,_0x568b4a,_0x88b7c3,_0x39f93d,_0x4a879e){var _0x2ac99f=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x3c'));var _0xb54acb;return aws[_0xcc16('0x80')](_0x5c8cee,_0x9f4ea5,_0x568b4a,_0x88b7c3,_0x39f93d,_0x4a879e,_0x2ac99f)[_0xcc16('0x2e')](function(){_0xb54acb=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+_0xcc16('0x2d'));return convertFile(_0x2ac99f,_0xb54acb);})[_0xcc16('0x2e')](function(){try{fs['unlink'](_0x2ac99f);fs[_0xcc16('0x40')](_0xb54acb,'777');}catch(_0xda45e4){logger[_0xcc16('0x19')](_0xda45e4);}return _0xb54acb[_0xcc16('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x403402,_0x33adec,_0x518737,_0x22cdc2,_0x5cbc59,_0x50735b){return aws[_0xcc16('0x81')](_0x403402,_0x33adec,_0x518737,_0x22cdc2,_0x5cbc59,_0x50735b)['then'](function(_0x1d0180){logger['info'](JSON[_0xcc16('0x45')](_0x1d0180));return _0x1d0180;});};exports[_0xcc16('0x82')]=function(_0x179477,_0x338e49,_0x22fe80,_0x55bc10){var _0x280ab0=util[_0xcc16('0x83')](_0xcc16('0x84'),ISPEECH_API,_0x179477,encodeURIComponent(_0x338e49),_0x22fe80,_0x55bc10);var _0xab8d62=path['resolve'](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+'.mp3');var _0x368e9e;return downloadFile(_0x280ab0,_0xab8d62)[_0xcc16('0x2e')](function(){_0x368e9e=path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs[_0xcc16('0x2c')](0x4)+_0xcc16('0x2d'));return convertFile(_0xab8d62,_0x368e9e);})[_0xcc16('0x2e')](function(){try{fs[_0xcc16('0x20')](_0xab8d62);fs['chmodSync'](_0x368e9e,_0xcc16('0x2f'));}catch(_0xc71608){logger[_0xcc16('0x19')](_0xc71608);}return _0x368e9e['split']('.')[0x0];});};exports[_0xcc16('0x85')]=function(_0xb1ef39,_0x2cb955,_0x15f895,_0x5cc3ac){var _0x401022=util[_0xcc16('0x83')](_0xcc16('0x86'),ISPEECH_API,_0x2cb955,_0x15f895,base64Encode(_0xb1ef39),_0x5cc3ac?util['format'](_0xcc16('0x87'),encodeURIComponent(_0x5cc3ac)):_0xcc16('0x88'));return uploadFile(_0x401022)['then'](function(_0x7855d5){return querystring[_0xcc16('0xb')](_0x7855d5);});};exports[_0xcc16('0x89')]=function(_0x2e7a62,_0x2b5798){return sestek[_0xcc16('0x8a')](_0x2e7a62,_0x2b5798)[_0xcc16('0x2e')](function(_0x22718b){logger['info'](JSON[_0xcc16('0x45')](_0x22718b));var _0x480e3c={'speech':_0x22718b[_0xcc16('0x8b')],'action':_0x22718b[_0xcc16('0x8c')]?_0x22718b['channelData'][_0xcc16('0x8d')]:undefined,'actiondata':_0x22718b[_0xcc16('0x8c')]?_0x22718b[_0xcc16('0x8c')]['CustomActionData']:undefined};if(_0x22718b[_0xcc16('0x8c')]&&_0x22718b[_0xcc16('0x8c')]['AudioFromTts']){return base64Decode(_0x22718b['channelData']['AudioFromTts'][_0xcc16('0x8e')],path[_0xcc16('0x2a')](__dirname,_0xcc16('0x2b'),rs['generate'](0x4)+_0xcc16('0x2d')))[_0xcc16('0x2e')](function(_0x4b3a7f){_0x480e3c[_0xcc16('0x8f')]=_0x4b3a7f;return _0x480e3c;});}return _0x480e3c;});};exports[_0xcc16('0x90')]=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 e453230..8f34e03 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 _0x55c4=['./nda'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x55c4,0x1dc));var _0x455c=function(_0x48a17a,_0x40adc3){_0x48a17a=_0x48a17a-0x0;var _0x375060=_0x55c4[_0x48a17a];return _0x375060;};var nda=require(_0x455c('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var nda=require('./nda');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 21adcbe..31651b1 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 _0x1db3=['custom_action','CustomActionData','custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav'];(function(_0x51aef1,_0x2e3d78){var _0x18f91b=function(_0x31ad0b){while(--_0x31ad0b){_0x51aef1['push'](_0x51aef1['shift']());}};_0x18f91b(++_0x2e3d78);}(_0x1db3,0x1e5));var _0x31db=function(_0x4a3df2,_0x48c0ac){_0x4a3df2=_0x4a3df2-0x0;var _0x5cd87f=_0x1db3[_0x4a3df2];return _0x5cd87f;};'use strict';var rp=require('request-promise');var url=require(_0x31db('0x0'));var logger=require(_0x31db('0x1'))(_0x31db('0x2'));module[_0x31db('0x3')]=function(_0x840c38,_0x4537f0){var _0x1888ef={'method':_0x31db('0x4'),'uri':url[_0x31db('0x5')](_0x4537f0[_0x31db('0x6')],_0x31db('0x7')),'form':{'grant_type':_0x31db('0x8'),'username':_0x4537f0[_0x31db('0x9')],'password':_0x4537f0[_0x31db('0x8')]},'json':!![]};return rp(_0x1888ef)[_0x31db('0xa')](function(_0x44e204){var _0x3a431e={'method':_0x31db('0x4'),'uri':url[_0x31db('0x5')](_0x4537f0['ndassistant_url'],_0x31db('0xb')),'body':{'type':_0x4537f0[_0x31db('0xc')]||_0x31db('0xd'),'channelId':_0x31db('0xe'),'conversation':{'id':_0x840c38[_0x31db('0xf')]},'from':{'id':_0x840c38['callerid'],'name':_0x840c38[_0x31db('0x10')]},'recipient':{'id':_0x840c38[_0x31db('0x11')],'name':_0x840c38[_0x31db('0x12')]},'text':_0x4537f0['text'],'channelData':{}},'headers':{'Authorization':_0x31db('0x13')+_0x44e204[_0x31db('0x14')]},'json':!![]};if(_0x4537f0[_0x31db('0x15')]){_0x3a431e[_0x31db('0x16')][_0x31db('0x17')][_0x31db('0x18')]=_0x4537f0['project'];}if(_0x4537f0['ndagenerate_audio']=='1'){_0x3a431e[_0x31db('0x16')]['channelData'][_0x31db('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x31db('0x1a')};}if(_0x4537f0[_0x31db('0x1b')]){_0x3a431e[_0x31db('0x16')][_0x31db('0x17')]['CustomAction']=_0x4537f0['custom_action'];if(_0x4537f0['custom_action_data']){_0x3a431e[_0x31db('0x16')][_0x31db('0x17')][_0x31db('0x1c')]=_0x4537f0[_0x31db('0x1d')];}}logger[_0x31db('0x1e')](JSON[_0x31db('0x1f')](_0x3a431e));return rp(_0x3a431e);});}; \ No newline at end of file +var _0x24a6=['dnid','extension','Bearer\x20','access_token','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','calleridname'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x24a6,0x14f));var _0x624a=function(_0x4a24f3,_0x115720){_0x4a24f3=_0x4a24f3-0x0;var _0x35da16=_0x24a6[_0x4a24f3];return _0x35da16;};'use strict';var rp=require(_0x624a('0x0'));var url=require('url');var logger=require(_0x624a('0x1'))(_0x624a('0x2'));module[_0x624a('0x3')]=function(_0x346672,_0x3074cb){var _0x45aae2={'method':_0x624a('0x4'),'uri':url[_0x624a('0x5')](_0x3074cb[_0x624a('0x6')],_0x624a('0x7')),'form':{'grant_type':_0x624a('0x8'),'username':_0x3074cb[_0x624a('0x9')],'password':_0x3074cb[_0x624a('0x8')]},'json':!![]};return rp(_0x45aae2)[_0x624a('0xa')](function(_0x58243){var _0x40cb85={'method':_0x624a('0x4'),'uri':url[_0x624a('0x5')](_0x3074cb[_0x624a('0xb')],_0x624a('0xc')),'body':{'type':_0x3074cb[_0x624a('0xd')]||_0x624a('0xe'),'channelId':_0x624a('0xf'),'conversation':{'id':_0x346672['uniqueid']},'from':{'id':_0x346672['callerid'],'name':_0x346672[_0x624a('0x10')]},'recipient':{'id':_0x346672[_0x624a('0x11')],'name':_0x346672[_0x624a('0x12')]},'text':_0x3074cb['text'],'channelData':{}},'headers':{'Authorization':_0x624a('0x13')+_0x58243[_0x624a('0x14')]},'json':!![]};if(_0x3074cb['project']){_0x40cb85['body']['channelData'][_0x624a('0x15')]=_0x3074cb['project'];}if(_0x3074cb[_0x624a('0x16')]=='1'){_0x40cb85[_0x624a('0x17')][_0x624a('0x18')][_0x624a('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3074cb[_0x624a('0x1a')]){_0x40cb85['body'][_0x624a('0x18')][_0x624a('0x1b')]=_0x3074cb['custom_action'];if(_0x3074cb[_0x624a('0x1c')]){_0x40cb85[_0x624a('0x17')][_0x624a('0x18')][_0x624a('0x1d')]=_0x3074cb[_0x624a('0x1c')];}}logger[_0x624a('0x1e')](JSON[_0x624a('0x1f')](_0x40cb85));return rp(_0x40cb85);});}; \ 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 eb8f3e8..ea77c6a 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 _0x8755=['./lib/api','exports'];(function(_0x52ad5f,_0x16d1a3){var _0xb217a2=function(_0x14d9ba){while(--_0x14d9ba){_0x52ad5f['push'](_0x52ad5f['shift']());}};_0xb217a2(++_0x16d1a3);}(_0x8755,0xe0));var _0x5875=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8755[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0x5875('0x0'));module[_0x5875('0x1')]=function(_0x272ccb,_0x3e6b5c,_0x49e4f4,_0x445b38){return asr(_0x272ccb,_0x3e6b5c,_0x49e4f4,_0x445b38);}; \ No newline at end of file +var _0x8946=['exports','./lib/api'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x8946,0x193));var _0x6894=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x8946[_0x5c9307];return _0x373e29;};'use strict';var asr=require(_0x6894('0x0'));module[_0x6894('0x1')]=function(_0x21a979,_0x1b6035,_0x5c3641,_0x559301){return asr(_0x21a979,_0x1b6035,_0x5c3641,_0x559301);}; \ 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 8ed11c5..bbbf7df 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 _0x8c3f=['exports','info','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x8c3f,0x13a));var _0xf8c3=function(_0x2a1b7f,_0x191e86){_0x2a1b7f=_0x2a1b7f-0x0;var _0x275051=_0x8c3f[_0x2a1b7f];return _0x275051;};'use strict';var BPromise=require(_0xf8c3('0x0'));var _=require(_0xf8c3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf8c3('0x2'));var crypto=require(_0xf8c3('0x3'));var logger=require(_0xf8c3('0x4'))(_0xf8c3('0x5'));module[_0xf8c3('0x6')]=function(_0x37a28e,_0x35c4ed,_0x544f61,_0x51503d){return new BPromise(function(_0x3ec08c,_0x39d891){logger[_0xf8c3('0x7')]('Tilde\x20URI',_0x51503d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2211b7=new WebSocket(_0x51503d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2d4fe5='';var _0x11529c='0';var _0x16bd7f='1';var _0x1b4d2d=_0xf8c3('0x8');function _0x111507(_0x265845){var _0x4ec887=crypto[_0xf8c3('0x9')]('sha1');_0x4ec887['update'](_0x265845);return _0x4ec887[_0xf8c3('0xa')](_0xf8c3('0xb'));}function _0x134e1c(){try{logger['info'](_0xf8c3('0xc'));var _0x5f1815=moment()[_0xf8c3('0xd')]();var _0x509494=_0x111507(_0x5f1815+_0x35c4ed+_0x544f61);_0x2211b7[_0xf8c3('0xe')](JSON['stringify']({'appID':_0x35c4ed,'timestamp':_0x5f1815,'appKey':_0x509494}));var _0x465241=fs[_0xf8c3('0xf')](_0x37a28e);_0x465241['on'](_0xf8c3('0x10'),function(_0x2447e3){_0x2211b7['send'](_0x2447e3);});_0x465241['on'](_0xf8c3('0x11'),function(){_0x2211b7['send'](_0xf8c3('0x12'));});}catch(_0xd3088f){logger[_0xf8c3('0x13')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0xd3088f));_0x2211b7[_0xf8c3('0x14')]();}}function _0x11235f(_0x483f32){try{if(_0x483f32){var _0x306a07=JSON[_0xf8c3('0x15')](_0x483f32);switch(_0x306a07[_0xf8c3('0x16')]){case 0x0:if(_0x306a07[_0xf8c3('0x17')]){if(_0x306a07[_0xf8c3('0x17')][_0xf8c3('0x18')]){logger[_0xf8c3('0x7')](_0xf8c3('0x19'),JSON[_0xf8c3('0x1a')](_0x306a07[_0xf8c3('0x17')][_0xf8c3('0x1b')]));_0x2d4fe5=_0x306a07[_0xf8c3('0x17')][_0xf8c3('0x1b')][0x0][_0xf8c3('0x1c')];_0x11529c=_0x306a07[_0xf8c3('0x17')][_0xf8c3('0x1b')][0x0]['likelihood'];_0x16bd7f='0';_0x1b4d2d=_0xf8c3('0x1d');_0x2211b7[_0xf8c3('0x14')]();}}break;case 0x1:logger[_0xf8c3('0x7')](_0xf8c3('0x8'));_0x16bd7f='1';_0x1b4d2d=_0xf8c3('0x8');break;case 0x2:logger[_0xf8c3('0x7')](_0xf8c3('0x1e'));_0x16bd7f='2';_0x1b4d2d=_0xf8c3('0x1e');break;case 0x9:logger['info'](_0xf8c3('0x1f'));_0x16bd7f='9';_0x1b4d2d=_0xf8c3('0x1f');break;case 0xa:logger['info'](_0xf8c3('0x20'));_0x16bd7f='10';_0x1b4d2d=_0xf8c3('0x20');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x16bd7f='11';_0x1b4d2d='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x211c76){logger[_0xf8c3('0x13')](_0xf8c3('0x21'),JSON[_0xf8c3('0x1a')](_0x211c76));_0x2211b7[_0xf8c3('0x14')]();}}function _0x4ca0f5(){logger[_0xf8c3('0x7')](_0xf8c3('0x22'));_0x3ec08c({'transcript':_0x2d4fe5,'confidence':_0x11529c,'status':_0x16bd7f,'status_message':_0x1b4d2d});}function _0x2fe1d8(_0x506c6f){logger[_0xf8c3('0x13')](_0xf8c3('0x23'));if(!_[_0xf8c3('0x24')](_0x506c6f)){logger[_0xf8c3('0x13')](_[_0xf8c3('0x25')](_0x506c6f)?JSON[_0xf8c3('0x1a')](_0x506c6f):_0x506c6f);}}_0x2211b7['on'](_0xf8c3('0x26'),_0x134e1c);_0x2211b7['on'](_0xf8c3('0x27'),_0x11235f);_0x2211b7['on'](_0xf8c3('0x11'),_0x4ca0f5);_0x2211b7['on'](_0xf8c3('0x13'),_0x2fe1d8);});}; \ No newline at end of file +var _0xb826=['agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','bluebird','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0xb826,0x1e5));var _0x6b82=function(_0x3ca5ee,_0x3c7435){_0x3ca5ee=_0x3ca5ee-0x0;var _0x270b80=_0xb826[_0x3ca5ee];return _0x270b80;};'use strict';var BPromise=require(_0x6b82('0x0'));var _=require(_0x6b82('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6b82('0x2'));var crypto=require(_0x6b82('0x3'));var logger=require(_0x6b82('0x4'))(_0x6b82('0x5'));module[_0x6b82('0x6')]=function(_0x34db63,_0x2dba77,_0x129443,_0x4ac296){return new BPromise(function(_0x3f75ff,_0x45c6cf){logger['info'](_0x6b82('0x7'),_0x4ac296||_0x6b82('0x8'));var _0xeb5e43=new WebSocket(_0x4ac296||_0x6b82('0x8'),{'perMessageDeflate':![]});var _0x557311='';var _0x13bda5='0';var _0x28eb5d='1';var _0x284824=_0x6b82('0x9');function _0x164e3f(_0x1dce53){var _0x1ebda0=crypto['createHash']('sha1');_0x1ebda0['update'](_0x1dce53);return _0x1ebda0['digest']('hex');}function _0x560818(){try{logger[_0x6b82('0xa')](_0x6b82('0xb'));var _0x3fb2fc=moment()[_0x6b82('0xc')]();var _0x17728b=_0x164e3f(_0x3fb2fc+_0x2dba77+_0x129443);_0xeb5e43[_0x6b82('0xd')](JSON[_0x6b82('0xe')]({'appID':_0x2dba77,'timestamp':_0x3fb2fc,'appKey':_0x17728b}));var _0x2b4395=fs[_0x6b82('0xf')](_0x34db63);_0x2b4395['on'](_0x6b82('0x10'),function(_0x2a4672){_0xeb5e43[_0x6b82('0xd')](_0x2a4672);});_0x2b4395['on'](_0x6b82('0x11'),function(){_0xeb5e43[_0x6b82('0xd')](_0x6b82('0x12'));});}catch(_0x12905a){logger[_0x6b82('0x13')](_0x6b82('0x14'),JSON['stringify'](_0x12905a));_0xeb5e43[_0x6b82('0x15')]();}}function _0x3460dd(_0x4e53ef){try{if(_0x4e53ef){var _0xeea80=JSON['parse'](_0x4e53ef);switch(_0xeea80['status']){case 0x0:if(_0xeea80[_0x6b82('0x16')]){if(_0xeea80[_0x6b82('0x16')]['final']){logger[_0x6b82('0xa')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0xeea80[_0x6b82('0x16')][_0x6b82('0x17')]));_0x557311=_0xeea80[_0x6b82('0x16')][_0x6b82('0x17')][0x0][_0x6b82('0x18')];_0x13bda5=_0xeea80[_0x6b82('0x16')][_0x6b82('0x17')][0x0][_0x6b82('0x19')];_0x28eb5d='0';_0x284824='Success.';_0xeb5e43[_0x6b82('0x15')]();}}break;case 0x1:logger[_0x6b82('0xa')](_0x6b82('0x9'));_0x28eb5d='1';_0x284824=_0x6b82('0x9');break;case 0x2:logger[_0x6b82('0xa')](_0x6b82('0x1a'));_0x28eb5d='2';_0x284824='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x6b82('0xa')](_0x6b82('0x1b'));_0x28eb5d='9';_0x284824=_0x6b82('0x1b');break;case 0xa:logger['info'](_0x6b82('0x1c'));_0x28eb5d='10';_0x284824=_0x6b82('0x1c');break;case 0xb:logger[_0x6b82('0xa')](_0x6b82('0x1d'));_0x28eb5d='11';_0x284824=_0x6b82('0x1d');}}}catch(_0x301d75){logger['error'](_0x6b82('0x1e'),JSON[_0x6b82('0xe')](_0x301d75));_0xeb5e43[_0x6b82('0x15')]();}}function _0x214f55(){logger[_0x6b82('0xa')](_0x6b82('0x1f'));_0x3f75ff({'transcript':_0x557311,'confidence':_0x13bda5,'status':_0x28eb5d,'status_message':_0x284824});}function _0x290846(_0xb4da35){logger[_0x6b82('0x13')](_0x6b82('0x20'));if(!_[_0x6b82('0x21')](_0xb4da35)){logger[_0x6b82('0x13')](_['isObject'](_0xb4da35)?JSON[_0x6b82('0xe')](_0xb4da35):_0xb4da35);}}_0xeb5e43['on'](_0x6b82('0x22'),_0x560818);_0xeb5e43['on']('message',_0x3460dd);_0xeb5e43['on'](_0x6b82('0x11'),_0x214f55);_0xeb5e43['on'](_0x6b82('0x13'),_0x290846);});}; \ 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 48e5201..acc0331 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 _0x9bf9=['exports','./asr'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x9bf9,0x19d));var _0x99bf=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9bf9[_0x550d12];return _0x12103d;};var asr=require(_0x99bf('0x0'));module[_0x99bf('0x1')]={'asr':asr}; \ No newline at end of file +var _0xdb66=['exports'];(function(_0x2c8db7,_0xfa05d6){var _0xee0bd3=function(_0x2a1f6f){while(--_0x2a1f6f){_0x2c8db7['push'](_0x2c8db7['shift']());}};_0xee0bd3(++_0xfa05d6);}(_0xdb66,0xfe));var _0x6db6=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xdb66[_0x5c9307];return _0x373e29;};var asr=require('./asr');module[_0x6db6('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e7af92e..64ff0e8 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 _0x80f2=['emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','error','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','127.0.0.1','call'];(function(_0x5ad771,_0x34186f){var _0x5b5dce=function(_0x5ad0fb){while(--_0x5ad0fb){_0x5ad771['push'](_0x5ad771['shift']());}};_0x5b5dce(++_0x34186f);}(_0x80f2,0x162));var _0x280f=function(_0x200ff5,_0x15d7c0){_0x200ff5=_0x200ff5-0x0;var _0x432cad=_0x80f2[_0x200ff5];return _0x432cad;};'use strict';var util=require(_0x280f('0x0'));var net=require(_0x280f('0x1'));var EventEmitter=require(_0x280f('0x2'))[_0x280f('0x3')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x230b9a,_0x36c92c,_0x2e8a98){var _0xc89e21=this,_0x230b9a=_0x230b9a||0x11dd,_0x36c92c=_0x36c92c||_0x280f('0x4'),_0x55eeaf=null,_0x198fa8=0x0;EventEmitter[_0x280f('0x5')](_0xc89e21);function _0xc1e337(){if(!_0x230b9a){_0xc89e21[_0x280f('0x6')]('error',new AGIError(_0x280f('0x7')));return![];}_0x55eeaf=net[_0x280f('0x8')]();_0x55eeaf[_0x280f('0x9')](_0x230b9a,_0x36c92c);_0x55eeaf['on'](_0x280f('0xa'),function(){_0xc89e21['emit'](_0x280f('0xa'));});_0x55eeaf['on'](_0x280f('0xb'),function(_0x1c3d9e){_0x55eeaf[_0x280f('0xc')](function(_0x1c70c6,_0x2909d5){if(_0x1c70c6){_0xc89e21['emit']('error',new AGIError(_0x280f('0xd'),_0x1c70c6));}else if(_0x2e8a98&&_0x2e8a98<0x0){_0xc89e21[_0x280f('0x6')]('error',new AGIError(_0x280f('0xe')));_0x1c3d9e[_0x280f('0xf')]();}else if(_0x2e8a98&&_0x2e8a98>0x0&&_0x2e8a98<_0x2909d5){_0x198fa8+=0x1;_0xc89e21[_0x280f('0x6')](_0x280f('0x10'),new AGIError(_0x280f('0x11'),_0x198fa8));_0x1c3d9e['destroy']();}else{var _0x3982ee=new AGIChannel(_0x1c3d9e);_0x3982ee['on']('ready',function(){_0xc89e21[_0x280f('0x6')](_0x280f('0xb'),_0x3982ee);});}});});_0x55eeaf['on']('error',function(_0x176480){_0xc89e21['emit']('error',new AGIError(_0x280f('0xd'),_0x176480[_0x280f('0x12')]));});_0x55eeaf['on'](_0x280f('0x13'),function(){_0xc89e21[_0x280f('0x6')](_0x280f('0x13'),new AGIError(_0x280f('0x14')));});}process[_0x280f('0x15')](function(){_0xc1e337();});};util[_0x280f('0x16')](AGIServer,EventEmitter);module[_0x280f('0x17')]=function(_0x395036,_0x1a7aec,_0x1abd25){return new AGIServer(_0x395036,_0x1a7aec,_0x1abd25);}; \ No newline at end of file +var _0x0f01=['exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f01,0xc1));var _0x10f0=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x0f01[_0x4bd06e];return _0x85ebb;};'use strict';var util=require(_0x10f0('0x0'));var net=require(_0x10f0('0x1'));var EventEmitter=require(_0x10f0('0x2'))['EventEmitter'];var AGIError=require(_0x10f0('0x3'));var AGIChannel=require(_0x10f0('0x4'));var AGIServer=function(_0xa68566,_0x377a7b,_0x5afcf2){var _0x1697af=this,_0xa68566=_0xa68566||0x11dd,_0x377a7b=_0x377a7b||_0x10f0('0x5'),_0x17749f=null,_0x265146=0x0;EventEmitter[_0x10f0('0x6')](_0x1697af);function _0x1bfbe2(){if(!_0xa68566){_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0x9')));return![];}_0x17749f=net[_0x10f0('0xa')]();_0x17749f[_0x10f0('0xb')](_0xa68566,_0x377a7b);_0x17749f['on'](_0x10f0('0xc'),function(){_0x1697af[_0x10f0('0x7')](_0x10f0('0xc'));});_0x17749f['on']('connection',function(_0x45a3d4){_0x17749f['getConnections'](function(_0x2a2eda,_0x212e1b){if(_0x2a2eda){_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0xd'),_0x2a2eda));}else if(_0x5afcf2&&_0x5afcf2<0x0){_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0xe')));_0x45a3d4[_0x10f0('0xf')]();}else if(_0x5afcf2&&_0x5afcf2>0x0&&_0x5afcf2<_0x212e1b){_0x265146+=0x1;_0x1697af[_0x10f0('0x7')](_0x10f0('0x8'),new AGIError(_0x10f0('0x10'),_0x265146));_0x45a3d4['destroy']();}else{var _0x377aa7=new AGIChannel(_0x45a3d4);_0x377aa7['on']('ready',function(){_0x1697af[_0x10f0('0x7')](_0x10f0('0x11'),_0x377aa7);});}});});_0x17749f['on'](_0x10f0('0x8'),function(_0x221eee){_0x1697af['emit'](_0x10f0('0x8'),new AGIError(_0x10f0('0xd'),_0x221eee[_0x10f0('0x12')]));});_0x17749f['on'](_0x10f0('0x13'),function(){_0x1697af[_0x10f0('0x7')](_0x10f0('0x13'),new AGIError(_0x10f0('0x14')));});}process[_0x10f0('0x15')](function(){_0x1bfbe2();});};util[_0x10f0('0x16')](AGIServer,EventEmitter);module[_0x10f0('0x17')]=function(_0x45d60a,_0x22e0bd,_0x569072){return new AGIServer(_0x45d60a,_0x22e0bd,_0x569072);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 8305fff..8e28fbd 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 _0x76e0=['Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','success','playback','no\x20file\x20audio\x20selected','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','no\x20url\x20configured','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','number','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','subproject','project_id','no\x20subproject\x20selected','arg_1','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervalById','IntervalId','interval','map','Intervals','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','channel','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','url','headers','render','stringify','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isArray','length','saveRestApiResult','isPlainObject','%s.%s','format','setVariable','recursiveNodeIndex','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x76e0,0x6e));var _0x076e=function(_0x563757,_0x3d2b22){_0x563757=_0x563757-0x0;var _0x6bdf6b=_0x76e0[_0x563757];return _0x6bdf6b;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x076e('0x0'))();var rs=require('randomstring');var moment=require(_0x076e('0x1'));var Mustache=require(_0x076e('0x2'));var rp=require('request-promise');var logger=require(_0x076e('0x3'))(_0x076e('0x4'));var config=require(_0x076e('0x5'));var scripts=require(_0x076e('0x6'));var FILES_PATH=_0x076e('0x7');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x076e('0x8'),_0x076e('0x9'),_0x076e('0xa')];var AGIVertices=function(_0x58fc4d,_0x49ab28,_0x4d8992){this['channel']=_0x58fc4d;this['rpc']=_0x49ab28;this[_0x076e('0xb')]=_0x4d8992;};AGIVertices[_0x076e('0xc')][_0x076e('0xd')]=function(_0xab4e79,_0xed441e){this[_0x076e('0xe')][_0x076e('0xf')](_0xab4e79)['then'](function(_0x4f0d1a){_0xed441e(null,_0x4f0d1a?_0x4f0d1a[_0x076e('0x10')]:![]);})[_0x076e('0x11')](function(_0x1bb34e){_0xed441e(_0x1bb34e);});};AGIVertices[_0x076e('0xc')][_0x076e('0x12')]=function(_0xbc322,_0x5be8d0){this[_0x076e('0xe')][_0x076e('0x13')](_0xbc322)[_0x076e('0x14')](function(_0x53a195){_0x5be8d0(null,_0x53a195?_0x53a195[_0x076e('0x10')]:![]);})[_0x076e('0x11')](function(_0x4cb203){_0x5be8d0(_0x4cb203);});};AGIVertices[_0x076e('0xc')][_0x076e('0x15')]=function(_0x26156c,_0x393efb){this[_0x076e('0xe')][_0x076e('0x16')](_0x26156c)[_0x076e('0x14')](function(_0x1828f3){_0x393efb(null,_0x1828f3?_0x1828f3[_0x076e('0x10')]:![]);})[_0x076e('0x11')](function(_0x1a3163){_0x393efb(_0x1a3163);});};AGIVertices[_0x076e('0xc')]['getSquareOdbc']=function(_0x1e46d0,_0x139416){this[_0x076e('0xe')]['getSquareOdbcById'](_0x1e46d0)['then'](function(_0x19608b){_0x139416(null,_0x19608b?_0x19608b[_0x076e('0x17')]:![]);})[_0x076e('0x11')](function(_0x516ed8){_0x139416(_0x516ed8);});};AGIVertices[_0x076e('0xc')][_0x076e('0x18')]=function(_0xab2d8c,_0x11c583){this[_0x076e('0xe')][_0x076e('0x19')](_0xab2d8c)[_0x076e('0x14')](function(_0x3d1bf8){_0x11c583(null,_0x3d1bf8?_0x3d1bf8[_0x076e('0x10')]:![]);})[_0x076e('0x11')](function(_0x57cd39){_0x11c583(_0x57cd39);});};AGIVertices[_0x076e('0xc')][_0x076e('0x1a')]=function(_0x57af57,_0x9939de){this[_0x076e('0xe')]['getTrunkById'](_0x57af57)['then'](function(_0x4c7ed3){_0x9939de(null,_0x4c7ed3?_0x4c7ed3[_0x076e('0x10')]:![]);})[_0x076e('0x11')](function(_0x38fa44){_0x9939de(_0x38fa44);});};AGIVertices['prototype'][_0x076e('0x1b')]=function(_0x4e31bc,_0x4d99f6){var _0x4a130d=this;this[_0x076e('0xe')][_0x076e('0x1c')](_0x4e31bc)['then'](function(_0x4c21f5){_0x4d99f6(null,_0x4c21f5?_0x4a130d[_0x076e('0x1d')](_0x4c21f5[_0x076e('0x1e')]):![]);})[_0x076e('0x11')](function(_0x33d9e3){_0x4d99f6(_0x33d9e3);});};AGIVertices[_0x076e('0xc')][_0x076e('0x1f')]=function(_0x3d20d1,_0xc993f){this[_0x076e('0xe')][_0x076e('0x20')](_0x3d20d1)[_0x076e('0x14')](function(_0x58b1df){_0xc993f(null,_0x58b1df?_0x58b1df:![]);})[_0x076e('0x11')](function(_0x16d56a){_0xc993f(_0x16d56a);});};AGIVertices[_0x076e('0xc')]['sendMailMessage']=function(_0x3242eb,_0x440e4c,_0x3cfc30){this[_0x076e('0xb')]['sendMailMessage'](_0x3242eb,_0x440e4c)[_0x076e('0x14')](function(){_0x3cfc30(null);})[_0x076e('0x11')](function(_0x63417){_0x3cfc30(_0x63417);});};AGIVertices[_0x076e('0xc')]['getIntervals']=function(_0x2878dc,_0x1fb5f8){this[_0x076e('0xe')][_0x076e('0x21')](_0x2878dc)[_0x076e('0x14')](function(_0xd87254){if(_0xd87254){if(_0xd87254[_0x076e('0x22')]){_0x1fb5f8(null,[_0xd87254[_0x076e('0x23')]]);}else{_0x1fb5f8(null,_[_0x076e('0x24')](_0xd87254[_0x076e('0x25')],_0x076e('0x23')));}}else{_0x1fb5f8(null,![]);}})[_0x076e('0x11')](function(_0x14d6ac){_0x1fb5f8(_0x14d6ac);});};AGIVertices[_0x076e('0xc')][_0x076e('0x1d')]=function(_0x5d93d1){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x5d93d1);};AGIVertices[_0x076e('0xc')][_0x076e('0x26')]=function(_0x1f7a5a,_0x2db8cd,_0x1c64bc){odbc[_0x076e('0x27')](_0x1f7a5a,function(_0x564e57){if(_0x564e57){logger[_0x076e('0x28')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x564e57);_0x1c64bc(_0x564e57);}else{logger['info'](_0x076e('0x29'));odbc[_0x076e('0x2a')](_0x2db8cd,function(_0x12883c,_0x5caad7){if(_0x12883c){logger[_0x076e('0x2b')](_0x076e('0x2c'),_0x2db8cd);_0x1c64bc(_0x12883c);}else{logger[_0x076e('0x2b')](_0x076e('0x2d'),_0x2db8cd);odbc[_0x076e('0x2e')](function(_0x114fae){if(_0x114fae){logger[_0x076e('0x28')](_0x076e('0x2f'),_0x114fae);}_0x1c64bc(null,_0x5caad7);});}});}});};AGIVertices['prototype'][_0x076e('0x30')]=function(_0x2ff945,_0x2cffd3){this[_0x076e('0xe')][_0x076e('0x31')](_0x2ff945)[_0x076e('0x14')](function(_0x599aa9){_0x2cffd3(null,_0x599aa9?_0x599aa9:![]);})[_0x076e('0x11')](function(_0x14ce94){_0x2cffd3(_0x14ce94);});};AGIVertices[_0x076e('0xc')][_0x076e('0x32')]=function(_0x1d675f,_0x30fd0b){this[_0x076e('0xe')]['createSmsMessage'](_0x1d675f)[_0x076e('0x14')](function(_0x2d9c5b){_0x30fd0b(null,_0x2d9c5b);})[_0x076e('0x11')](function(_0xb81786){_0x30fd0b(_0xb81786);});};AGIVertices[_0x076e('0xc')]['createSquareDetailsReport']=function(_0x3ff574,_0x3d635e,_0x22ab94){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x076e('0x33')]['uniqueid'],'node':_0x3ff574[_0x076e('0x34')],'application':_0x3ff574[_0x076e('0x35')],'data':_0x3d635e||null,'project_name':this[_0x076e('0x33')]['arg_1'],'callerid':this[_0x076e('0x33')][_0x076e('0x36')]})[_0x076e('0x14')](function(_0x175756){if(_0x22ab94){_0x22ab94(null,_0x175756);}})[_0x076e('0x11')](function(_0x3adc69){if(_0x22ab94){_0x22ab94(_0x3adc69);}});};AGIVertices[_0x076e('0xc')][_0x076e('0x37')]=function(_0x45442f,_0x1f9289,_0x2a4460,_0x107668){this[_0x076e('0xe')][_0x076e('0x37')]({'uniqueid':this[_0x076e('0x33')][_0x076e('0x38')],'callerid':this[_0x076e('0x33')]['callerid'],'calleridname':this[_0x076e('0x33')][_0x076e('0x39')],'context':this[_0x076e('0x33')][_0x076e('0x3a')],'extension':this[_0x076e('0x33')][_0x076e('0x3b')],'priority':this[_0x076e('0x33')][_0x076e('0x3c')],'accountcode':this['channel'][_0x076e('0x3d')],'dnid':this['channel'][_0x076e('0x3e')],'projectName':this[_0x076e('0x33')]['arg_1'],'saveName':_0x1f9289,'filename':_0x45442f[_0x076e('0x3f')]||_0x1f9289,'savePath':_0x2a4460})['then'](function(_0x4f1cf6){_0x107668(null,_0x4f1cf6);})['catch'](function(_0x349132){_0x107668(_0x349132);});};AGIVertices[_0x076e('0xc')]['createSquareMessage']=function(_0x5802c4,_0x35bc24,_0x1fe550,_0x3c7ac3,_0x109bd1){this[_0x076e('0xe')][_0x076e('0x40')]({'uniqueid':this['channel'][_0x076e('0x38')],'body':_0x5802c4,'direction':_0x35bc24,'providerName':_0x1fe550,'providerResponse':_0x3c7ac3})['then'](function(_0x505a5a){if(_0x109bd1){_0x109bd1(null,_0x505a5a);}})[_0x076e('0x11')](function(_0x494d4e){if(_0x109bd1){_0x109bd1(_0x494d4e);}});};AGIVertices[_0x076e('0xc')][_0x076e('0x41')]=function(_0x245b6b,_0x470289){this[_0x076e('0xe')][_0x076e('0x41')]({'firstName':_[_0x076e('0x42')](_0x245b6b['name'])||_[_0x076e('0x43')](_0x245b6b[_0x076e('0x10')])?_0x076e('0x44')+Math[_0x076e('0x45')]():_0x245b6b[_0x076e('0x10')],'lastName':_['isEmpty'](_0x245b6b[_0x076e('0x46')])||_[_0x076e('0x43')](_0x245b6b[_0x076e('0x46')])?null:_0x245b6b[_0x076e('0x46')],'phone':_0x245b6b[_0x076e('0x47')],'ListId':_0x245b6b['list_id'],'scheduledat':_0x245b6b[_0x076e('0x48')],'callbackUniqueid':this[_0x076e('0x33')][_0x076e('0x38')],'tags':_0x076e('0x49'),'description':_0x076e('0x4a')+_0x245b6b[_0x076e('0x48')][_0x076e('0x4b')](),'priority':_0x245b6b[_0x076e('0x4c')]})[_0x076e('0x14')](function(_0x158165){_0x470289(null,_0x158165);})[_0x076e('0x11')](function(_0x4d65df){_0x470289(_0x4d65df);});};AGIVertices[_0x076e('0xc')]['getPause']=function(_0x2a208a,_0x221c14){this[_0x076e('0xe')][_0x076e('0x4d')](_0x2a208a)['then'](function(_0x212c95){_0x221c14(null,_0x212c95?_0x212c95['name']:![]);})[_0x076e('0x11')](function(_0x214258){_0x221c14(_0x214258);});};AGIVertices['prototype'][_0x076e('0x4e')]=function(_0x3cb48a,_0x37497d,_0x319bd5){var _0x47c345={'role':_0x076e('0x4f')};_0x47c345[_0x3cb48a]=this['channel'][_0x076e('0x36')];this['rpc'][_0x076e('0x4e')](_0x47c345,_0x37497d,this['channel'][_0x076e('0x38')])[_0x076e('0x14')](function(_0x15124c){_0x319bd5(null,_[_0x076e('0x43')](_0x15124c)?![]:!![]);})[_0x076e('0x11')](function(_0x2835fb){logger[_0x076e('0x28')](_0x2835fb);_0x319bd5(null,![]);});};AGIVertices[_0x076e('0xc')][_0x076e('0x50')]=function(_0x29c388,_0x4a1c12){var _0x2f5d31={'role':_0x076e('0x4f')};_0x2f5d31[_0x29c388]=this[_0x076e('0x33')][_0x076e('0x36')];this[_0x076e('0xe')][_0x076e('0x50')](_0x2f5d31)[_0x076e('0x14')](function(_0x459f88){_0x4a1c12(null,_[_0x076e('0x43')](_0x459f88)?![]:!![]);})[_0x076e('0x11')](function(_0x4135b2){logger['error'](_0x4135b2);_0x4a1c12(null,![]);});};AGIVertices[_0x076e('0xc')][_0x076e('0x51')]=function(_0x1528ff,_0x3d106b){var _0x18eba6={'role':'agent'};_0x18eba6[_0x1528ff]=this[_0x076e('0x33')][_0x076e('0x36')];this['rpc'][_0x076e('0x51')](_0x18eba6)[_0x076e('0x14')](function(_0x4020ba){_0x3d106b(null,_[_0x076e('0x43')](_0x4020ba)?![]:!![]);})[_0x076e('0x11')](function(_0x389ca9){logger[_0x076e('0x28')](_0x389ca9);_0x3d106b(null,![]);});};AGIVertices[_0x076e('0xc')][_0x076e('0x52')]=function(_0x31327c,_0x19a2ba){var _0x1db24d={'role':_0x076e('0x4f')};_0x1db24d[_0x31327c]=this[_0x076e('0x33')][_0x076e('0x36')];var _0x4845ad=_0x31327c!=_0x076e('0x53')?util['format'](_0x076e('0x54'),_0x076e('0x55'),this[_0x076e('0x33')][_0x076e('0x36')]):undefined;this[_0x076e('0xe')][_0x076e('0x52')](_0x1db24d,_0x4845ad)[_0x076e('0x14')](function(_0x244651){_0x19a2ba(null,_[_0x076e('0x43')](_0x244651)?![]:!![]);})[_0x076e('0x11')](function(_0x595064){logger[_0x076e('0x28')](_0x595064);_0x19a2ba(null,![]);});};AGIVertices[_0x076e('0xc')][_0x076e('0x56')]=function(_0x2da7b3,_0x462d8d){sh[_0x076e('0x57')](_[_0x076e('0x58')](_0x2da7b3),function(_0x103a69,_0x1d44ab){var _0x11aa52=_0x1d44ab[_0x076e('0x59')](/(\r\n|\n|\r)/gm,'');_0x462d8d(null,_0x11aa52);});};AGIVertices[_0x076e('0xc')][_0x076e('0x5a')]=function(_0x185ba2,_0x4a6fac){scripts[_0x076e('0x5a')](_0x185ba2['apiKey'],_0x185ba2['google_cloud_tts_text_type']||'text',_0x185ba2[_0x076e('0x5b')],_0x185ba2[_0x076e('0x5c')]||_0x076e('0x5d'),_0x185ba2[_0x076e('0x5e')]||'MALE',_0x185ba2[_0x076e('0x5f')]||_0x076e('0x60'))[_0x076e('0x14')](function(_0x225daa){_0x4a6fac(null,_0x225daa);})[_0x076e('0x11')](function(_0x493b52){_0x4a6fac(_0x493b52);});};AGIVertices[_0x076e('0xc')][_0x076e('0x61')]=function(_0x3c4178,_0x3b87f2){scripts[_0x076e('0x61')](_0x3c4178['text'],_0x3c4178[_0x076e('0x62')]||'en',0x1)[_0x076e('0x14')](function(_0x33d69d){_0x3b87f2(null,_0x33d69d);})[_0x076e('0x11')](function(_0x35f825){_0x3b87f2(_0x35f825);});};AGIVertices[_0x076e('0xc')][_0x076e('0x63')]=function(_0x28d9ce,_0xd7e6f0){var _0x417578={'uri':_0x28d9ce['url'],'method':_0x28d9ce[_0x076e('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x28d9ce['timeout'])==='number'&&parseInt(_0x28d9ce['timeout'])>=0x1?parseInt(_0x28d9ce['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x076e('0x65'),_0x076e('0x66')],_0x417578[_0x076e('0x64')][_0x076e('0x67')]())){try{_0x417578[_0x076e('0x68')]=_0x28d9ce[_0x076e('0x69')]?JSON[_0x076e('0x6a')](_0x28d9ce['rawBody']):{};}catch(_0x22d52f){logger['error'](_0x076e('0x6b'),_0x22d52f);}}try{_0x417578['headers']=_0x28d9ce['rawHeaders']?JSON[_0x076e('0x6a')](_0x28d9ce['rawHeaders']):{};}catch(_0x4600b2){logger['error'](_0x076e('0x6c'),_0x4600b2);}if(_0x28d9ce['computedVariables']){try{var _0x37645c=require(_0x28d9ce[_0x076e('0x6d')])[_0x076e('0x6e')](this,_0x417578);_0x417578[_0x076e('0x6f')]=Mustache['render'](_0x28d9ce[_0x076e('0x70')],_0x37645c,{},['$$','$$']);if(_0x417578[_0x076e('0x71')]){_0x417578[_0x076e('0x71')]=JSON['parse'](Mustache[_0x076e('0x72')](JSON[_0x076e('0x73')](_0x417578[_0x076e('0x71')]),_0x37645c,{},['$$','$$']));}if(_0x417578['body']){_0x417578['body']=JSON[_0x076e('0x6a')](Mustache[_0x076e('0x72')](JSON['stringify'](_0x417578[_0x076e('0x68')]),_0x37645c,{},['$$','$$']));}}catch(_0x5f3faa){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5f3faa);}}rp(_0x417578)[_0x076e('0x14')](function(_0x58629e){var _0x1ee80f={'statusCode':_0x58629e['statusCode']||0xc8,'statusMessage':_0x58629e[_0x076e('0x74')]||'OK','headers':_0x58629e[_0x076e('0x71')]||{},'body':_0x58629e[_0x076e('0x68')]||{}};_0xd7e6f0(null,_0x1ee80f);})['catch'](function(_0x31663a){var _0x18a672={'statusCode':_0x31663a[_0x076e('0x75')]||0x1f4,'statusMessage':_0x31663a[_0x076e('0x76')]||_0x076e('0x77'),'headers':_0x31663a['options'][_0x076e('0x71')]||{},'body':_0x31663a[_0x076e('0x78')]['body']||{}};_0xd7e6f0(null,_0x18a672);});};AGIVertices[_0x076e('0xc')][_0x076e('0x79')]=function(_0x20d844,_0x4f4d0a){scripts[_0x076e('0x79')](this[_0x076e('0x33')][_0x076e('0x38')],_0x20d844['key'],_0x20d844['text'],_0x20d844[_0x076e('0x7a')]||'en')[_0x076e('0x14')](function(_0x30d50c){_0x4f4d0a(null,_0x30d50c);})[_0x076e('0x11')](function(_0x579be4){_0x4f4d0a(_0x579be4);});};AGIVertices[_0x076e('0xc')][_0x076e('0x7b')]=function(_0x419474,_0x3e1899){scripts['googleDialogflowV2'](this[_0x076e('0x33')][_0x076e('0x38')],_0x419474[_0x076e('0x7c')],_0x419474['client_email'],_0x419474[_0x076e('0x7d')],_0x419474[_0x076e('0x5b')],_0x419474[_0x076e('0x7e')]||'en')[_0x076e('0x14')](function(_0x5931c0){_0x3e1899(null,_0x5931c0);})[_0x076e('0x11')](function(_0x582c0c){_0x3e1899(_0x582c0c);});};AGIVertices['prototype']['sestekNDA']=function(_0x233436,_0x2840b5){scripts[_0x076e('0x7f')](this[_0x076e('0x33')],_0x233436)['then'](function(_0x23326c){_0x2840b5(null,_0x23326c);})[_0x076e('0x11')](function(_0x13360c){_0x2840b5(_0x13360c);});};AGIVertices[_0x076e('0xc')][_0x076e('0x80')]=function(_0x334699,_0x5d2cd3){scripts[_0x076e('0x80')](_0x334699[_0x076e('0x81')],_0x334699[_0x076e('0x5b')],_0x334699[_0x076e('0x82')]||_0x076e('0x5d'),_0x334699[_0x076e('0x83')])[_0x076e('0x14')](function(_0x31869a){_0x5d2cd3(null,_0x31869a);})[_0x076e('0x11')](function(_0x4e380d){_0x5d2cd3(_0x4e380d);});};AGIVertices[_0x076e('0xc')][_0x076e('0x84')]=function(_0x157eb5,_0x48b4a5,_0x9340b1){scripts[_0x076e('0x84')](_0x48b4a5,_0x157eb5[_0x076e('0x81')],_0x157eb5[_0x076e('0x85')]||_0x076e('0x5d'),this[_0x076e('0x86')](_0x157eb5[_0x076e('0x87')])?_0x157eb5['model']:undefined)[_0x076e('0x14')](function(_0x30d8cc){_0x9340b1(null,_0x30d8cc);})[_0x076e('0x11')](function(_0x25d8c7){_0x9340b1(_0x25d8c7);});};AGIVertices[_0x076e('0xc')][_0x076e('0x88')]=function(_0xf6623c,_0x270b0a){scripts[_0x076e('0x88')](_0xf6623c['aws_access_key_id'],_0xf6623c[_0x076e('0x89')],_0xf6623c[_0x076e('0x8a')],_0xf6623c['aws_polly_voice']||_0x076e('0x8b'),_0xf6623c[_0x076e('0x5b')],_0xf6623c[_0x076e('0x8c')]||_0x076e('0x5b'))[_0x076e('0x14')](function(_0x3d6dfd){_0x270b0a(null,_0x3d6dfd);})[_0x076e('0x11')](function(_0x21ba09){_0x270b0a(_0x21ba09);});};AGIVertices[_0x076e('0xc')][_0x076e('0x8d')]=function(_0x38950e,_0xa4dffb){scripts[_0x076e('0x8d')](this[_0x076e('0x33')][_0x076e('0x38')],_0x38950e[_0x076e('0x8e')],_0x38950e[_0x076e('0x89')],_0x38950e[_0x076e('0x8f')],_0x38950e[_0x076e('0x5b')],_0x38950e['aws_bot_name'])['then'](function(_0x46882d){_0xa4dffb(null,_0x46882d);})[_0x076e('0x11')](function(_0x33a5c1){_0xa4dffb(_0x33a5c1);});};AGIVertices[_0x076e('0xc')][_0x076e('0x90')]=function(_0x3cce50,_0xf80d0f,_0x37c067){scripts[_0x076e('0x90')](_0xf80d0f,_0x3cce50[_0x076e('0x81')],_0x3cce50['google_asr_language']||_0x076e('0x5d'))['then'](function(_0xedcc4){_0x37c067(null,_0xedcc4);})[_0x076e('0x11')](function(_0x53538c){_0x37c067(_0x53538c);});};AGIVertices[_0x076e('0xc')]['tildeASR']=function(_0x2d97bf,_0x1a1949,_0x320c82){scripts[_0x076e('0x91')](_0x1a1949,_0x2d97bf[_0x076e('0x92')],_0x2d97bf[_0x076e('0x93')],_0x2d97bf['uri'])[_0x076e('0x14')](function(_0x5b926b){_0x320c82(null,_0x5b926b);})[_0x076e('0x11')](function(_0x5634d3){_0x320c82(_0x5634d3);});};AGIVertices['prototype']['clear']=function(_0x193adb){var _0xbc752=_[_0x076e('0x94')](verticesWithRetry,_0x193adb['agicommand'])?_0x193adb:_[_0x076e('0x95')](_0x193adb);for(var _0x2708c6 in _0xbc752){if(_0xbc752[_0x076e('0x96')](_0x2708c6)){if(_0xbc752[_0x2708c6]&&_[_0x076e('0x97')](_0xbc752[_0x2708c6])){if(_[_0x076e('0x94')](recursiveMapAttributes,_0x2708c6)){_0xbc752[_0x2708c6]=this[_0x076e('0x98')](_0xbc752[_0x2708c6]);}else{_0xbc752[_0x2708c6]=this[_0x076e('0x99')](_0xbc752[_0x2708c6]);}}}}return _0xbc752;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x49d53d){for(var _0xf6b515 in _0x49d53d){if(_0x49d53d[_0x076e('0x96')](_0xf6b515)){if(_['isPlainObject'](_0x49d53d[_0xf6b515])){this['recursiveNodeIndex'](_0x49d53d[_0xf6b515]);}else if(_[_0x076e('0x9a')](_0x49d53d[_0xf6b515])){for(var _0x368941=0x0;_0x368941<_0x49d53d[_0xf6b515][_0x076e('0x9b')];_0x368941++){this['recursiveNodeIndex'](_0x49d53d[_0xf6b515][_0x368941]);}}else if(_['isString'](_0x49d53d[_0xf6b515])){_0x49d53d[_0xf6b515]=this[_0x076e('0x99')](_0x49d53d[_0xf6b515]);}}}};AGIVertices[_0x076e('0xc')][_0x076e('0x9c')]=function(_0x2e1dad,_0x8a274){for(var _0x1ae28f in _0x2e1dad){if(_0x2e1dad[_0x076e('0x96')](_0x1ae28f)){if(_[_0x076e('0x9d')](_0x2e1dad[_0x1ae28f])){if(!_[_0x076e('0x42')](_0x2e1dad[_0x1ae28f])){this[_0x076e('0x9c')](_0x2e1dad[_0x1ae28f],util['format'](_0x076e('0x9e'),_0x8a274,_0x1ae28f));}}else if(_[_0x076e('0x9a')](_0x2e1dad[_0x1ae28f])){for(var _0x487db2=0x0;_0x487db2<_0x2e1dad[_0x1ae28f][_0x076e('0x9b')];_0x487db2++){this['saveRestApiResult'](_0x2e1dad[_0x1ae28f][_0x487db2],util[_0x076e('0x9f')](_0x076e('0x9e'),_0x8a274,_0x1ae28f+'['+_0x487db2+']'));}}else{if(!_[_0x076e('0x43')](_0x2e1dad[_0x1ae28f])){this['channel'][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0x9e'),_0x8a274,_0x1ae28f),_0x2e1dad[_0x1ae28f]);}}}}};AGIVertices[_0x076e('0xc')][_0x076e('0x98')]=function(_0x11e7aa){try{var _0x3ed0e7=JSON['parse'](_0x11e7aa);this[_0x076e('0xa1')](_0x3ed0e7);return JSON[_0x076e('0x73')](_0x3ed0e7);}catch(_0xc2cbe8){return this[_0x076e('0x99')](_0x11e7aa);}};AGIVertices[_0x076e('0xc')][_0x076e('0x99')]=function(_0xe90322){var _0x6f4f93=_0xe90322[_0x076e('0xa2')]('{');for(var _0x2f657c=0x1;_0x2f657c<_0x6f4f93['length'];_0x2f657c+=0x1){var _0x35fdaf=_0x6f4f93[_0x2f657c][_0x076e('0xa2')]('}');if(_0x35fdaf['length']>0x1){_0xe90322=_0xe90322[_0x076e('0xa3')]('{'+_0x35fdaf[0x0]+'}',this[_0x076e('0x33')][_0x076e('0xd')](_0x35fdaf[0x0])[_0x076e('0xa4')]||_0x35fdaf[0x0]);}}if(_0x6f4f93[_0x076e('0x9b')]===0x1){return _0xe90322[_0x076e('0x4b')]();}return this[_0x076e('0x99')](_0xe90322);};AGIVertices[_0x076e('0xc')][_0x076e('0xa5')]=function(_0xa4f7cd,_0x338ad1){var _0x54ef37=this[_0x076e('0x33')]['getVariable'](_0xa4f7cd);if(_0x54ef37[_0x076e('0xa6')]===-0x1){return _0x54ef37;}logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xa7'),_0x338ad1,_0x54ef37[_0x076e('0xa4')]));return this['channel'][_0x076e('0xa0')](_0x338ad1,_0x54ef37['extra']);};AGIVertices[_0x076e('0xc')][_0x076e('0x86')]=function(_0x242bb8){return _0x242bb8&&_0x242bb8!=='0'&&_0x242bb8!=='-1'&&_0x242bb8!=='';};AGIVertices[_0x076e('0xc')][_0x076e('0xa8')]=function(_0x1559d1){this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x1559d1,'-');_0x1559d1[_0x076e('0xaa')]=_0x1559d1[_0x076e('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x076e('0xc')][_0x076e('0xab')]=function(_0xa586f8){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xa586f8[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0xa586f8['text'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}var _0x247d01='\x22'+_0xa586f8[_0x076e('0x5b')]+'\x22';if(this[_0x076e('0x86')](_0xa586f8[_0x076e('0x78')])){_0x247d01+=','+_0xa586f8[_0x076e('0x78')];}var _0x5cbb77=this[_0x076e('0x33')][_0x076e('0x57')](_0x076e('0xae'),_0x247d01);if(_0x5cbb77[_0x076e('0xa6')]===-0x1){return _0x5cbb77;}return this['channel']['noop'](util[_0x076e('0x9f')](_0x076e('0xaf'),_0x247d01));};AGIVertices['prototype'][_0x076e('0xb0')]=function(_0x175027){logger['info'](util['format'](_0x076e('0xb1'),_0x175027[_0x076e('0x34')]));if(!this['isConfigured'](_0x175027[_0x076e('0xb2')])){return this[_0x076e('0x33')]['noop'](_0x076e('0xb3'));}var _0xc0253d=_0x175027[_0x076e('0xb2')];if(this[_0x076e('0x86')](_0x175027['options'])){_0xc0253d+=','+_0x175027['options'];}var _0x13215c=this[_0x076e('0x33')][_0x076e('0x57')](_0x076e('0xb4'),_0xc0253d);if(_0x13215c['result']===-0x1){return _0x13215c;}var _0x934a9f=this[_0x076e('0xa5')](_0x076e('0xb5'),_0x076e('0xb6'));if(_0x934a9f[_0x076e('0xa6')]===-0x1){return _0x934a9f;}var _0x374142=this[_0x076e('0xa5')](_0x076e('0xb7'),'MRCP_RECOG_TRANSCRIPT');if(_0x374142[_0x076e('0xa6')]===-0x1){return _0x374142;}var _0x16cf6b=this[_0x076e('0xa5')](_0x076e('0xb8'),_0x076e('0xb9'));if(_0x16cf6b[_0x076e('0xa6')]===-0x1){return _0x16cf6b;}return this[_0x076e('0x33')]['noop'](util['format'](_0x076e('0xba'),_0xc0253d));};AGIVertices[_0x076e('0xc')][_0x076e('0x4')]=function(_0x168601){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xbb'),_0x168601[_0x076e('0x34')]));return this['channel'][_0x076e('0x4')]([_0x168601[_0x076e('0xbc')],_0x168601[_0x076e('0xbd')]]);};AGIVertices[_0x076e('0xc')]['answer']=function(_0x309727){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x309727['label']));if(this['isConfigured'](_0x309727[_0x076e('0xbe')])){logger['info'](util[_0x076e('0x9f')](_0x076e('0xbf'),_0x309727[_0x076e('0xbe')]));var _0x2d2587=this[_0x076e('0x33')][_0x076e('0xc0')](_0x309727[_0x076e('0xbe')]);if(_0x2d2587[_0x076e('0xa6')]===-0x1){return _0x2d2587;}}return this[_0x076e('0x33')][_0x076e('0xc1')]();};AGIVertices[_0x076e('0xc')][_0x076e('0x49')]=function(_0x127d13){logger[_0x076e('0x2b')](util['format'](_0x076e('0xc2'),_0x127d13[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x127d13[_0x076e('0xc3')])){return this[_0x076e('0x33')]['error'](_0x127d13,_0x076e('0xc4'));}_0x127d13[_0x076e('0x48')]=moment();if(this[_0x076e('0x86')](_0x127d13[_0x076e('0xc5')])){_0x127d13[_0x076e('0x48')]=moment()[_0x076e('0xc6')](_0x127d13[_0x076e('0xc5')],_0x076e('0xc7'));}if(!this[_0x076e('0x86')](_0x127d13[_0x076e('0x4c')])){_0x127d13['callback_priority']=0x2;}this[_0x076e('0x41')]['sync'](this,_0x127d13);return this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xc8'),_0x127d13[_0x076e('0x47')],_0x127d13[_0x076e('0xc3')],_0x127d13[_0x076e('0x48')]));};AGIVertices[_0x076e('0xc')][_0x076e('0xc9')]=function(_0x2beec7){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xca'),_0x2beec7[_0x076e('0x34')]));var _0x24752d=this[_0x076e('0x33')]['exec'](_0x2beec7[_0x076e('0xcb')],_0x2beec7[_0x076e('0x78')]);if(_0x24752d[_0x076e('0xa6')]===-0x1){return _0x24752d;}return this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xcc'),_0x2beec7[_0x076e('0xcb')],_0x2beec7['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0xd18c0e){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xcd'),_0xd18c0e[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0xd18c0e['text'])){return this['channel'][_0x076e('0xac')](_0x076e('0xad'));}var _0x13bb98='\x22'+_0xd18c0e[_0x076e('0x5b')]+'\x22';if(this[_0x076e('0x86')](_0xd18c0e['options'])){_0x13bb98+=','+_0xd18c0e['options'];}var _0x4ae266=this[_0x076e('0x33')][_0x076e('0x57')]('MRCPSynth',_0x13bb98);if(_0x4ae266[_0x076e('0xa6')]===-0x1){return _0x4ae266;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xaf'),_0x13bb98));};AGIVertices['prototype']['sestektts']=function(_0x45bf4d){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xce'),_0x45bf4d['label']));if(!this['isConfigured'](_0x45bf4d[_0x076e('0x5b')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}var _0x1ae074='\x22'+_0x45bf4d[_0x076e('0x5b')]+'\x22';if(this[_0x076e('0x86')](_0x45bf4d['options'])){_0x1ae074+=','+_0x45bf4d[_0x076e('0x78')];}var _0x272520=this[_0x076e('0x33')][_0x076e('0x57')]('MRCPSynth',_0x1ae074);if(_0x272520['result']===-0x1){return _0x272520;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xaf'),_0x1ae074));};AGIVertices[_0x076e('0xc')][_0x076e('0xcf')]=function(_0x313d6a){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x313d6a[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x313d6a['grammar'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xb3'));}var _0xee5fab=_0x313d6a['grammar'];if(this[_0x076e('0x86')](_0x313d6a['options'])){_0xee5fab+=','+_0x313d6a[_0x076e('0x78')];}var _0x33fc1c=this['channel'][_0x076e('0x57')](_0x076e('0xb4'),_0xee5fab);if(_0x33fc1c[_0x076e('0xa6')]===-0x1){return _0x33fc1c;}var _0x377762=this[_0x076e('0xa5')](_0x076e('0xb5'),'LUMENVOX_ASR_CONFIDENCE');if(_0x377762[_0x076e('0xa6')]===-0x1){return _0x377762;}var _0x347d0a=this[_0x076e('0xa5')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x347d0a['result']===-0x1){return _0x347d0a;}var _0x390421=this[_0x076e('0xa5')](_0x076e('0xb8'),_0x076e('0xd0'));if(_0x390421[_0x076e('0xa6')]===-0x1){return _0x390421;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xba'),_0xee5fab));};AGIVertices[_0x076e('0xc')][_0x076e('0xd1')]=function(_0x2ebe97){logger['info'](util['format'](_0x076e('0xd2'),_0x2ebe97[_0x076e('0x34')]));if(!this['isConfigured'](_0x2ebe97[_0x076e('0xb2')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xb3'));}var _0x2bedbf=_0x2ebe97['grammar'];if(this[_0x076e('0x86')](_0x2ebe97[_0x076e('0x78')])){_0x2bedbf+=','+_0x2ebe97[_0x076e('0x78')];}var _0x1c2a21=this[_0x076e('0x33')][_0x076e('0x57')](_0x076e('0xb4'),_0x2bedbf);if(_0x1c2a21[_0x076e('0xa6')]===-0x1){return _0x1c2a21;}var _0x37aa63=this[_0x076e('0xa5')](_0x076e('0xb5'),_0x076e('0xd3'));if(_0x37aa63[_0x076e('0xa6')]===-0x1){return _0x37aa63;}var _0x51b48c=this[_0x076e('0xa5')](_0x076e('0xb7'),_0x076e('0xd4'));if(_0x51b48c[_0x076e('0xa6')]===-0x1){return _0x51b48c;}var _0x240665=this[_0x076e('0xa5')](_0x076e('0xb8'),_0x076e('0xd5'));if(_0x240665[_0x076e('0xa6')]===-0x1){return _0x240665;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xba'),_0x2bedbf));};AGIVertices['prototype'][_0x076e('0xd6')]=function(_0x2b95b0){logger['info'](util[_0x076e('0x9f')](_0x076e('0xd7'),_0x2b95b0['label']));if(!this['isConfigured'](_0x2b95b0[_0x076e('0xd8')])){return this['channel'][_0x076e('0x28')](_0x2b95b0,_0x076e('0xd9'));}var _0x10a8c5=this['getSquareOdbc'][_0x076e('0x6e')](this,_0x2b95b0[_0x076e('0xd8')]);if(!_0x10a8c5){return this['channel'][_0x076e('0x28')](_0x2b95b0,_0x076e('0xda'));}if(!this[_0x076e('0x86')](_0x2b95b0['query'])){return this['channel'][_0x076e('0x28')](_0x2b95b0,'no\x20query\x20configured');}var _0x1a8c53=_0x2b95b0[_0x076e('0x2a')][_0x076e('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xdb'),_0x1a8c53));var _0x10950d=this['getQueryOdbc'][_0x076e('0x6e')](this,_0x10a8c5,_0x1a8c53);this['createSquareDetailsReport'][_0x076e('0x6e')](this,_0x2b95b0,_0x1a8c53);if(!this[_0x076e('0x86')](_0x2b95b0[_0x076e('0xdc')])){return this['channel'][_0x076e('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x430fa7=this[_0x076e('0xd')][_0x076e('0x6e')](this,_0x2b95b0[_0x076e('0xdc')]);if(!_0x430fa7){return this[_0x076e('0x33')][_0x076e('0x28')](_0x2b95b0,_0x076e('0xdd'));}var _0xb68d04=this;_0x10950d['forEach'](function(_0x53a670,_0x5581a8){Object['keys'](_0x53a670)[_0x076e('0xde')](function(_0x27ace3){_0xb68d04[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0xdf'),_0x430fa7,_0x5581a8,_0x27ace3),_0x53a670[_0x27ace3]);});});this[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0xe0'),_0x430fa7),_0x10950d['length']);return this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xe1'),_0x430fa7));};AGIVertices[_0x076e('0xc')][_0x076e('0xe2')]=function(_0x5be6a5){logger[_0x076e('0xe3')](util[_0x076e('0x9f')](_0x076e('0xe4'),_0x5be6a5[_0x076e('0x34')]));if(!this['isConfigured'](_0x5be6a5[_0x076e('0xe5')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x5be6a5,_0x076e('0xe6'));}var _0x27de82=this[_0x076e('0x18')][_0x076e('0x6e')](this,_0x5be6a5[_0x076e('0xe5')]);if(!_0x27de82){return this['channel']['error'](_0x5be6a5,_0x076e('0xe7'));}var _0x2a7656=this[_0x076e('0x33')][_0x076e('0x57')]('DIAL',[util[_0x076e('0x9f')]('SIP/%s',_0x27de82),_0x5be6a5['timeout'],_0x5be6a5[_0x076e('0xe8')],_0x5be6a5['url']]);if(_0x2a7656[_0x076e('0xa6')]===-0x1){return _0x2a7656;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xe9'),_0x076e('0xea')));};AGIVertices[_0x076e('0xc')][_0x076e('0xeb')]=function(_0x1d0bbb){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xec'),_0x1d0bbb['label']));if(!this[_0x076e('0x86')](_0x1d0bbb['key'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xed'));}if(!this[_0x076e('0x86')](_0x1d0bbb[_0x076e('0x5b')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}this[_0x076e('0x33')][_0x076e('0xee')]=!![];this[_0x076e('0xa9')](_0x1d0bbb);this['createSquareMessage'](_0x1d0bbb[_0x076e('0x5b')],'in','','');this[_0x076e('0x33')]['noop'](util[_0x076e('0x9f')](_0x076e('0xef'),_0x1d0bbb[_0x076e('0x5b')]));var _0x2792c4=this[_0x076e('0x79')][_0x076e('0x6e')](this,_0x1d0bbb);if(_0x2792c4){for(var _0x5ad02d in _0x2792c4){if(_0x2792c4[_0x076e('0x96')](_0x5ad02d)){this[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0xf0'),_0x5ad02d['toUpperCase']()),_0x2792c4[_0x5ad02d]);}}this['createSquareMessage'](_0x2792c4[_0x076e('0xf1')],'out','dialogflow','');return this[_0x076e('0x33')]['noop'](util[_0x076e('0x9f')]('Dialogflow\x20Result\x20%s',_0x2792c4[_0x076e('0xf1')]));}return this[_0x076e('0x33')][_0x076e('0x28')](_0x1d0bbb,_0x076e('0xf2'));};AGIVertices['prototype'][_0x076e('0xf3')]=function(_0x615e4d){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xf4'),_0x615e4d['label']));if(!this['isConfigured'](_0x615e4d[_0x076e('0x7c')])){return this['channel'][_0x076e('0xac')](_0x076e('0xf5'));}if(!this['isConfigured'](_0x615e4d[_0x076e('0xf6')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xf7'));}if(!this[_0x076e('0x86')](_0x615e4d[_0x076e('0x7d')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xf8'));}if(!this[_0x076e('0x86')](_0x615e4d['dialogflowV2_language'])){return this['channel'][_0x076e('0xac')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x615e4d[_0x076e('0x5b')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}this[_0x076e('0x33')][_0x076e('0xee')]=!![];this['createSquareDetailsReport'](_0x615e4d);this[_0x076e('0x40')](_0x615e4d[_0x076e('0x5b')],'in','','');this[_0x076e('0x33')][_0x076e('0xac')](util['format'](_0x076e('0xf9'),_0x615e4d[_0x076e('0x5b')]));var _0x2eac59=this[_0x076e('0x7b')][_0x076e('0x6e')](this,_0x615e4d);if(_0x2eac59){for(var _0x16c835 in _0x2eac59){if(_0x2eac59['hasOwnProperty'](_0x16c835)){if(_0x16c835!=='providerResponse'){this[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0xf0'),_0x16c835[_0x076e('0x67')]()),_0x2eac59[_0x16c835]);}}}this[_0x076e('0x40')](_0x2eac59[_0x076e('0xf1')],'out',_0x076e('0xf3'),_0x2eac59['providerResponse']);return this[_0x076e('0x33')]['noop'](util['format'](_0x076e('0xfa'),_0x2eac59['speech']));}return this['channel'][_0x076e('0x28')](_0x615e4d,_0x076e('0xfb'));};AGIVertices[_0x076e('0xc')][_0x076e('0xfc')]=function(_0x458274){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0xfd'),_0x458274[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x458274['ndauth_url'])){return this['channel']['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x076e('0x86')](_0x458274[_0x076e('0xfe')])){return this[_0x076e('0x33')]['noop'](_0x076e('0xff'));}if(!this['isConfigured'](_0x458274[_0x076e('0x100')])){return this[_0x076e('0x33')][_0x076e('0xac')]('no\x20password\x20configured');}if(!this[_0x076e('0x86')](_0x458274[_0x076e('0x101')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}this[_0x076e('0x33')][_0x076e('0xee')]=!![];this['createSquareDetailsReport'](_0x458274);this[_0x076e('0x40')](_0x458274[_0x076e('0x5b')],'in','','');this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('Trying\x20SestekNDA:\x20%s',_0x458274[_0x076e('0x5b')]));var _0x4e6e81=this[_0x076e('0x7f')][_0x076e('0x6e')](this,_0x458274);if(_0x4e6e81){for(var _0x45b5c0 in _0x4e6e81){if(_0x4e6e81[_0x076e('0x96')](_0x45b5c0)){this['channel'][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0x102'),_0x45b5c0[_0x076e('0x67')]()),_0x4e6e81[_0x45b5c0]);}}this[_0x076e('0x40')](_0x4e6e81['speech'],'out',_0x076e('0xfc'),'');if(_0x4e6e81['audiofile']){this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x103'),_0x4e6e81[_0x076e('0x104')]));var _0x16654f=this[_0x076e('0x33')]['streamFile'](_0x4e6e81[_0x076e('0x104')]);try{fs[_0x076e('0x105')](_0x4e6e81[_0x076e('0x104')]+'.wav');}catch(_0x1c9f97){logger[_0x076e('0x28')](_0x1c9f97);}return _0x16654f;}else{return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x106'),_0x4e6e81['speech']));}}return this['channel']['error'](_0x458274,_0x076e('0x107'));};AGIVertices[_0x076e('0xc')][_0x076e('0x108')]=function(_0x42ec10){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x109'),_0x42ec10[_0x076e('0x34')]));return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x108'));};AGIVertices[_0x076e('0xc')][_0x076e('0x10a')]=function(_0x5e5507){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x10b'),_0x5e5507[_0x076e('0x34')]));var _0x5a36d5='';if(_0x5e5507[_0x076e('0x10c')]){if(!this['isConfigured'](_0x5e5507[_0x076e('0x10c')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x5e5507,_0x076e('0x10d'));}else{var _0x476805=parseInt(_0x5e5507[_0x076e('0x10c')],0xa);if(isNaN(_0x476805)){_0x5a36d5=_0x5e5507['trunk_id'];}else{_0x5a36d5=this['getTrunk'][_0x076e('0x6e')](this,_0x5e5507['trunk_id']);if(!_0x5a36d5){return this[_0x076e('0x33')][_0x076e('0x28')](_0x5e5507,'no\x20trunk\x20found');}}}}else if(_0x5e5507['trunk_name']){_0x5a36d5=_0x5e5507['trunk_name'];}else{return this['channel'][_0x076e('0x28')](_0x5e5507,_0x076e('0x10d'));}var _0x2831e2=this[_0x076e('0x33')]['exec'](_0x076e('0xea'),[util['format']('SIP/%s/%s',_0x5a36d5,_0x5e5507[_0x076e('0x47')]),_0x5e5507[_0x076e('0xbe')],_0x5e5507['opts'],_0x5e5507[_0x076e('0x70')]]);if(_0x2831e2[_0x076e('0xa6')]===-0x1){return _0x2831e2;}return this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xe9'),_0x076e('0xea')));};AGIVertices[_0x076e('0xc')][_0x076e('0x10e')]=function(_0x58193f){logger[_0x076e('0x2b')](util['format'](_0x076e('0x10f'),_0x58193f['label']));return this[_0x076e('0x33')]['noop']('finally');};AGIVertices[_0x076e('0xc')][_0x076e('0x9')]=function(_0x1aa853){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x110'),_0x1aa853['label']));if(_0x1aa853[_0x076e('0xaa')]===0x0){return this[_0x076e('0xa8')](_0x1aa853);}_0x1aa853[_0x076e('0xaa')]-=0x1;if(!this[_0x076e('0x86')](_0x1aa853[_0x076e('0x111')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x1aa853,'no\x20file\x20audio\x20selected');}var _0x54b378=this['getSound']['sync'](this,_0x1aa853[_0x076e('0x111')]);if(!_0x54b378){return this[_0x076e('0x33')][_0x076e('0x28')](_0x1aa853,_0x076e('0x112'));}if(!this[_0x076e('0x86')](_0x1aa853[_0x076e('0xdc')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x076e('0x113'));}var _0x322372=this[_0x076e('0x33')][_0x076e('0x114')](_0x54b378,_0x1aa853[_0x076e('0x115')],_0x1aa853[_0x076e('0x116')]);var _0x525336=_0x322372[_0x076e('0xa6')]?_0x322372[_0x076e('0xa6')][_0x076e('0x4b')]():'';logger['info'](_0x076e('0x117'),JSON[_0x076e('0x73')](_0x322372));if(_0x322372[_0x076e('0xa6')]===-0x1){this['createSquareDetailsReport'][_0x076e('0x6e')](this,_0x1aa853,_0x525336);return _0x322372;}else if(_0x322372[_0x076e('0xa4')]===_0x076e('0xbe')){_0x322372[_0x076e('0xa6')]=_0x525336[_0x076e('0x9b')]>=parseInt(_0x1aa853[_0x076e('0x118')])?'x':'i';}else{_0x322372[_0x076e('0xa6')]=_0x525336[_0x076e('0x9b')]>=parseInt(_0x1aa853[_0x076e('0x118')])&&_0x525336[_0x076e('0x9b')]<=parseInt(_0x1aa853[_0x076e('0x116')])?'x':'i';}var _0x1eaee5=this['getVariable'][_0x076e('0x6e')](this,_0x1aa853[_0x076e('0xdc')]);if(!_0x1eaee5){return this['channel'][_0x076e('0x28')](_0x1aa853,_0x076e('0xdd'));}this[_0x076e('0x33')]['setVariable'](_0x1eaee5,_0x525336);if(this['isConfigured'](_0x1aa853[_0x076e('0x119')])){var _0x2cfa87=parseInt(_0x1aa853['hiddendigitsnum'],0xa);var _0x57c086=rs[_0x076e('0x11a')]({'charset':'*','length':_0x2cfa87});var _0x1fc881=_0x525336[_0x076e('0x9b')];if(_0x1fc881>0x0){if(_0x1fc881>_0x2cfa87){this[_0x076e('0xa9')]['sync'](this,_0x1aa853,_0x1aa853[_0x076e('0x11b')]===_0x076e('0x11c')?_0x57c086+_0x525336[_0x076e('0x11d')](_0x2cfa87):_0x525336[_0x076e('0x11d')](0x0,_0x1fc881-_0x2cfa87)+_0x57c086);}else{this['createSquareDetailsReport']['sync'](this,_0x1aa853,rs[_0x076e('0x11a')]({'charset':'*','length':_0x1fc881}));}}else{this['createSquareDetailsReport'][_0x076e('0x6e')](this,_0x1aa853,'');}}else{this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x1aa853,_0x525336);}return _0x322372;};AGIVertices['prototype'][_0x076e('0xa')]=function(_0x5825ae){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x11e'),_0x5825ae['label']));return this[_0x076e('0x9')](_0x5825ae);};AGIVertices['prototype']['goal']=function(_0x386fb2){logger[_0x076e('0x2b')](util['format'](_0x076e('0x11f'),_0x386fb2[_0x076e('0x34')]));this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x386fb2,_0x386fb2['goalname']);return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x120'),_0x386fb2['goalname']));};AGIVertices[_0x076e('0xc')]['awspolly']=function(_0x407fa4){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x121'),_0x407fa4[_0x076e('0x34')]));if(!this['isConfigured'](_0x407fa4[_0x076e('0x8e')])||!this['isConfigured'](_0x407fa4[_0x076e('0x89')])){return this['channel'][_0x076e('0xac')](_0x076e('0x122'));}if(!this[_0x076e('0x86')](_0x407fa4[_0x076e('0x5b')])){return this[_0x076e('0x33')]['noop'](_0x076e('0xad'));}this[_0x076e('0x33')]['noop'](util['format'](_0x076e('0x123'),_0x407fa4[_0x076e('0x5b')]));var _0x510ec2=this[_0x076e('0x88')][_0x076e('0x6e')](this,_0x407fa4);if(_0x510ec2){this[_0x076e('0x33')]['noop'](util[_0x076e('0x9f')](_0x076e('0x124'),_0x510ec2));var _0x453a7f=this[_0x076e('0x33')]['streamFile'](_0x510ec2);try{fs[_0x076e('0x105')](_0x510ec2+_0x076e('0x125'));}catch(_0x33224f){logger[_0x076e('0x28')](_0x33224f);}return _0x453a7f;}return this[_0x076e('0x33')]['error'](_0x407fa4,_0x076e('0x126'));};AGIVertices[_0x076e('0xc')][_0x076e('0x127')]=function(_0xa8e719){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x128'),_0xa8e719[_0x076e('0x34')]));if(!this['isConfigured'](_0xa8e719[_0x076e('0x8e')])||!this['isConfigured'](_0xa8e719[_0x076e('0x89')])){return this[_0x076e('0x33')]['noop'](_0x076e('0x122'));}if(!this['isConfigured'](_0xa8e719['aws_bot_name'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x129'));}if(!this['isConfigured'](_0xa8e719[_0x076e('0x5b')])){return this['channel'][_0x076e('0xac')](_0x076e('0xad'));}this[_0x076e('0x33')][_0x076e('0xee')]=!![];this[_0x076e('0xa9')](_0xa8e719);this[_0x076e('0x40')](_0xa8e719[_0x076e('0x5b')],'in','','');this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x12a'),_0xa8e719[_0x076e('0x5b')]));var _0x90cf99=this[_0x076e('0x8d')][_0x076e('0x6e')](this,_0xa8e719);if(_0x90cf99){for(var _0x527ec1 in _0x90cf99){if(_0x90cf99[_0x076e('0x96')](_0x527ec1)&&_[_0x076e('0x97')](_0x90cf99[_0x527ec1])){this['channel'][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0x12b'),_0x527ec1[_0x076e('0x67')]()),_0x90cf99[_0x527ec1]);}}if(_[_0x076e('0x43')](_0x90cf99[_0x076e('0x76')])){return this['channel'][_0x076e('0xac')](_0x076e('0x12c'));}else{this[_0x076e('0x40')](_0x90cf99[_0x076e('0x76')],'out',_0x076e('0x12d'),'');return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('Amazon\x20Lex\x20Result\x20%s',_0x90cf99[_0x076e('0x76')]));}}return this[_0x076e('0x33')][_0x076e('0x28')](_0xa8e719,_0x076e('0x12e'));};AGIVertices[_0x076e('0xc')][_0x076e('0x12f')]=function(_0x31e08c){logger['info'](util['format'](_0x076e('0x130'),_0x31e08c['label'],_0x31e08c['timeout']));if(!this[_0x076e('0x86')](_0x31e08c['key'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xed'));}var _0x11fc93=_0x076e('0x131');var _0x2d00b6=util[_0x076e('0x9f')](_0x076e('0x132'),FILES_PATH,rs[_0x076e('0x11a')](0x4));var _0x24a1ed=util[_0x076e('0x9f')](_0x076e('0x9e'),_0x2d00b6,_0x11fc93);var _0x3714e8=!![];if(_0x31e08c[_0x076e('0x133')]===_0x076e('0x134')){_0x3714e8=![];}var _0x1bfc44=this['channel'][_0x076e('0x135')](_0x2d00b6,_0x11fc93,_0x31e08c['intKey'],_0x31e08c['timeout'],undefined,_0x3714e8);if(_0x1bfc44[_0x076e('0xa6')]!==-0x1){this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')]('google\x20%s\x20file\x20created',_0x24a1ed));var _0x2c33e1=this[_0x076e('0x90')][_0x076e('0x6e')](this,_0x31e08c,_0x24a1ed);if(_0x2c33e1){for(var _0x1d8d0f in _0x2c33e1){if(_0x2c33e1[_0x076e('0x96')](_0x1d8d0f)){this[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0x136'),_0x1d8d0f[_0x076e('0x67')]()),_0x2c33e1[_0x1d8d0f]);}}return this['channel']['noop'](util[_0x076e('0x9f')](_0x076e('0x137'),JSON[_0x076e('0x73')](_0x2c33e1)));}}return _0x1bfc44;};AGIVertices['prototype'][_0x076e('0x138')]=function(_0x9d7142){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x9d7142[_0x076e('0x34')]));if(!this['isConfigured'](_0x9d7142[_0x076e('0x92')])){return this[_0x076e('0x33')][_0x076e('0xac')]('no\x20appid\x20configured');}if(!this[_0x076e('0x86')](_0x9d7142[_0x076e('0x93')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x139'));}var _0x106f10='wav';var _0x168c6e=util['format'](_0x076e('0x132'),FILES_PATH,rs[_0x076e('0x11a')](0x4));var _0x471c74=util[_0x076e('0x9f')](_0x076e('0x9e'),_0x168c6e,_0x106f10);var _0x3f9bee=!![];if(_0x9d7142[_0x076e('0x133')]===_0x076e('0x134')){_0x3f9bee=![];}var _0x1d44fe=this['channel'][_0x076e('0x135')](_0x168c6e,_0x106f10,_0x9d7142[_0x076e('0x13a')],_0x9d7142[_0x076e('0xbe')],undefined,_0x3f9bee);if(_0x1d44fe[_0x076e('0xa6')]!==-0x1){this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x13b'),_0x471c74));var _0x5b0544=this['tildeASR'][_0x076e('0x6e')](this,_0x9d7142,_0x471c74);if(_0x5b0544){for(var _0x39eff5 in _0x5b0544){if(_0x5b0544[_0x076e('0x96')](_0x39eff5)){this[_0x076e('0x33')]['setVariable'](util[_0x076e('0x9f')](_0x076e('0x13c'),_0x39eff5[_0x076e('0x67')]()),_0x5b0544[_0x39eff5]);}}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('TildeASR\x20Result\x20%s',JSON[_0x076e('0x73')](_0x5b0544)));}}return _0x1d44fe;};AGIVertices['prototype'][_0x076e('0x13d')]=function(_0x3cfaa4){logger[_0x076e('0x2b')](util['format'](_0x076e('0x13e'),_0x3cfaa4[_0x076e('0x34')]));return this[_0x076e('0x33')][_0x076e('0x13f')](_0x3cfaa4[_0x076e('0x3a')],_0x3cfaa4[_0x076e('0x3b')],_0x3cfaa4[_0x076e('0x3c')]);};AGIVertices[_0x076e('0xc')][_0x076e('0x140')]=function(_0x4776d0){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x141'),_0x4776d0['label']));if(!this['isConfigured'](_0x4776d0[_0x076e('0x142')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x4776d0,_0x076e('0x143'));}try{var _0x1ee5f2=eval(_0x4776d0[_0x076e('0x142')])?_0x076e('0x144'):'false';this['channel']['noop'](util[_0x076e('0x9f')](_0x076e('0x145'),_0x4776d0[_0x076e('0x142')],_0x1ee5f2));return{'code':0xc8,'result':_0x1ee5f2};}catch(_0x380e46){return{'code':0xc8,'result':_0x076e('0x146')};}};AGIVertices[_0x076e('0xc')][_0x076e('0x147')]=function(_0x3df2ff){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x148'),_0x3df2ff['label']));if(!this[_0x076e('0x86')](_0x3df2ff[_0x076e('0x149')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x3df2ff,_0x076e('0x14a'));}var _0x443a29=this[_0x076e('0x14b')]['sync'](this,_0x3df2ff['interval_id']);if(!_0x443a29){return this['channel'][_0x076e('0x28')](_0x3df2ff,_0x076e('0x14c'));}for(var _0x54328a=0x0;_0x54328a<_0x443a29[_0x076e('0x9b')];_0x54328a+=0x1){var _0x5e11ae=this[_0x076e('0x33')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x443a29[_0x54328a]));if(_0x5e11ae[_0x076e('0xa6')]===-0x1){return _0x5e11ae;}logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x14d'),_0x443a29[_0x54328a],_0x5e11ae[_0x076e('0xa4')]));if(_0x5e11ae['extra']===_0x076e('0x144')){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x14d'),_0x443a29[_0x54328a],_0x076e('0x144')));this['channel'][_0x076e('0xac')](util['format'](_0x076e('0x14d'),_0x443a29[_0x54328a],'true'));return{'code':0xc8,'result':_0x076e('0x144')};}else{logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x14d'),_0x443a29[_0x54328a],'false'));this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x14d'),_0x443a29[_0x54328a],_0x076e('0x146')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x076e('0x14e')]=function(_0x7ddc35){logger['info'](util[_0x076e('0x9f')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x7ddc35[_0x076e('0x34')]));return this[_0x076e('0x33')]['hangup']();};AGIVertices[_0x076e('0xc')][_0x076e('0x14f')]=function(_0x2e745e){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x2e745e[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x2e745e['key'])){return this[_0x076e('0x33')][_0x076e('0xac')]('no\x20key\x20configured');}var _0x289699=_0x076e('0x131');var _0x2c890b=util[_0x076e('0x9f')](_0x076e('0x132'),FILES_PATH,rs[_0x076e('0x11a')](0x4));var _0x9595d3=util[_0x076e('0x9f')](_0x076e('0x9e'),_0x2c890b,_0x289699);var _0x13bef5=!![];if(_0x2e745e[_0x076e('0x133')]===_0x076e('0x134')){_0x13bef5=![];}var _0x166fde=this[_0x076e('0x33')]['recordFile'](_0x2c890b,_0x289699,_0x2e745e[_0x076e('0x13a')],_0x2e745e['timeout'],undefined,_0x13bef5);if(_0x166fde[_0x076e('0xa6')]!==-0x1){this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x150'),_0x9595d3));var _0x1854e0=this['ispeechASR']['sync'](this,_0x2e745e,_0x9595d3);if(_0x1854e0){for(var _0x4d3e38 in _0x1854e0){if(_0x1854e0[_0x076e('0x96')](_0x4d3e38)){this[_0x076e('0x33')]['setVariable'](util['format'](_0x076e('0x151'),_0x4d3e38['toUpperCase']()),_0x1854e0[_0x4d3e38]);}}return this[_0x076e('0x33')][_0x076e('0xac')](util['format'](_0x076e('0x152'),JSON[_0x076e('0x73')](_0x1854e0)));}}return _0x166fde;};AGIVertices['prototype'][_0x076e('0x153')]=function(_0x46dcc2){logger['info'](util['format'](_0x076e('0x154'),_0x46dcc2[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x46dcc2['key'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xed'));}if(!this[_0x076e('0x86')](_0x46dcc2[_0x076e('0x5b')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('Trying\x20ispeech\x20TTS\x20%s',_0x46dcc2[_0x076e('0x5b')]));var _0x6c2b21=this[_0x076e('0x80')][_0x076e('0x6e')](this,_0x46dcc2);if(_0x6c2b21){this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x150'),_0x6c2b21));var _0x15e377=this[_0x076e('0x33')]['streamFile'](_0x6c2b21,_0x46dcc2[_0x076e('0x13a')]);try{fs['unlink'](_0x6c2b21+_0x076e('0x125'));}catch(_0x5f26d1){logger['error'](_0x5f26d1);}return _0x15e377;}return this[_0x076e('0x33')]['error'](_0x46dcc2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x076e('0xc')][_0x076e('0x155')]=function(_0x9a1642){logger['info'](util[_0x076e('0x9f')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x9a1642['label']));if(!this[_0x076e('0x86')](_0x9a1642[_0x076e('0x156')])){return this['channel']['error'](_0x9a1642,'no\x20find\x20by\x20configured');}logger['info'](util[_0x076e('0x9f')](_0x076e('0x157'),this[_0x076e('0x33')]['callerid'],_0x9a1642['findBy']));var _0x246b84=this[_0x076e('0x52')][_0x076e('0x6e')](this,_0x9a1642[_0x076e('0x156')]);if(_0x246b84){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x158'),this['channel']['callerid'],_0x9a1642['findBy']));this['channel'][_0x076e('0xac')](util['format'](_0x076e('0x158'),this[_0x076e('0x33')][_0x076e('0x36')],_0x9a1642['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x076e('0x2b')](util['format'](_0x076e('0x159'),this['channel'][_0x076e('0x36')],_0x9a1642[_0x076e('0x156')]));this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x076e('0x33')][_0x076e('0x36')],_0x9a1642[_0x076e('0x156')]));return{'code':0xc8,'result':_0x076e('0x15a')};}};AGIVertices[_0x076e('0xc')]['logout']=function(_0x1c067d){logger['info'](util[_0x076e('0x9f')](_0x076e('0x15b'),_0x1c067d[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x1c067d[_0x076e('0x156')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x1c067d,_0x076e('0x15c'));}logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x157'),this[_0x076e('0x33')][_0x076e('0x36')],_0x1c067d['findBy']));var _0x384259=this['agentLogout'][_0x076e('0x6e')](this,_0x1c067d[_0x076e('0x156')]);if(_0x384259){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x076e('0x36')],_0x1c067d[_0x076e('0x156')]));this[_0x076e('0x33')]['noop'](util['format'](_0x076e('0x158'),this['channel']['callerid'],_0x1c067d[_0x076e('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x159'),this[_0x076e('0x33')][_0x076e('0x36')],_0x1c067d[_0x076e('0x156')]));this[_0x076e('0x33')]['noop'](util[_0x076e('0x9f')](_0x076e('0x159'),this[_0x076e('0x33')][_0x076e('0x36')],_0x1c067d[_0x076e('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x076e('0xc')][_0x076e('0x15d')]=function(_0x3b9c22){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x15e'),_0x3b9c22[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x3b9c22[_0x076e('0x15f')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x3b9c22,_0x076e('0x160'));}this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('math\x20%s',_0x3b9c22[_0x076e('0x15f')]));var _0x406217=eval(_0x3b9c22[_0x076e('0x15f')]);if(!this['isConfigured'](_0x3b9c22[_0x076e('0xdc')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x113'));}var _0x2741ad=this[_0x076e('0xd')][_0x076e('0x6e')](this,_0x3b9c22[_0x076e('0xdc')]);if(!_0x2741ad){return this[_0x076e('0x33')]['error'](_0x3b9c22,_0x076e('0xdd'));}if(_[_0x076e('0x9a')](_0x406217)){var _0x12e4e2=this;_0x406217['forEach'](function(_0x566a85,_0x4ab441){_0x12e4e2[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')](_0x076e('0x161'),_0x2741ad,_0x4ab441),_0x566a85);});return this[_0x076e('0x33')][_0x076e('0xac')](util['format']('variable\x20%s[key]\x20set',_0x2741ad));}else{return this[_0x076e('0x33')][_0x076e('0xa0')](_0x2741ad,_0x406217);}};AGIVertices[_0x076e('0xc')][_0x076e('0x8')]=function(_0x158e26){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x162'),_0x158e26[_0x076e('0x34')]));if(_0x158e26[_0x076e('0xaa')]===0x0){return this[_0x076e('0xa8')](_0x158e26);}_0x158e26[_0x076e('0xaa')]-=0x1;if(!this[_0x076e('0x86')](_0x158e26[_0x076e('0x111')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x158e26,'no\x20file\x20audio\x20selected');}var _0x41400c=this[_0x076e('0x1b')]['sync'](this,_0x158e26[_0x076e('0x111')]);if(!_0x41400c){return this['channel']['error'](_0x158e26,_0x076e('0x112'));}var _0x58b190=this['channel']['getData'](_0x41400c,_0x158e26['response'],_0x158e26[_0x076e('0x163')]);var _0x23965d=_0x58b190[_0x076e('0xa6')];if(_0x58b190[_0x076e('0xa6')]===-0x1){this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x158e26,'-1');return _0x58b190;}else if(_0x58b190[_0x076e('0xa4')]===_0x076e('0xbe')){_0x58b190[_0x076e('0xa6')]=_0x58b190[_0x076e('0xa6')][_0x076e('0x9b')]>0x0?_0x58b190[_0x076e('0xa6')]:'t';}else if(_[_0x076e('0x42')](_0x58b190[_0x076e('0xa6')])){_0x58b190[_0x076e('0xa6')]='#';_0x23965d='#';}if(!this[_0x076e('0x86')](_0x158e26['variable_id'])){this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x113'));}else{var _0x4938f8=this[_0x076e('0xd')]['sync'](this,_0x158e26[_0x076e('0xdc')]);if(!_0x4938f8){return this[_0x076e('0x33')][_0x076e('0x28')](_0x158e26,_0x076e('0xdd'));}this['channel'][_0x076e('0xa0')](_0x4938f8,_0x23965d);}this['createSquareDetailsReport']['sync'](this,_0x158e26,_0x23965d);return _0x58b190;};AGIVertices[_0x076e('0xc')][_0x076e('0xac')]=function(_0x29448c){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x164'),_0x29448c['label']));return this[_0x076e('0x33')][_0x076e('0xac')](_0x29448c['output']||_0x29448c[_0x076e('0x34')]);};AGIVertices[_0x076e('0xc')][_0x076e('0x165')]=function(_0x12f230){logger['info'](util[_0x076e('0x9f')](_0x076e('0x166'),_0x12f230['label']));if(!this[_0x076e('0x86')](_0x12f230[_0x076e('0x156')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x12f230,'no\x20find\x20by\x20configured');}logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x157'),this[_0x076e('0x33')][_0x076e('0x36')],_0x12f230[_0x076e('0x156')]));var _0x272545=this[_0x076e('0x167')][_0x076e('0x6e')](this,_0x12f230[_0x076e('0x168')]);var _0x954912=this[_0x076e('0x4e')]['sync'](this,_0x12f230['findBy'],_0x272545);if(_0x954912){logger['info'](util[_0x076e('0x9f')](_0x076e('0x158'),this[_0x076e('0x33')][_0x076e('0x36')],_0x12f230[_0x076e('0x156')]));this[_0x076e('0x33')][_0x076e('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x076e('0x33')][_0x076e('0x36')],_0x12f230['findBy']));return{'code':0xc8,'result':_0x076e('0x169')};}else{logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x159'),this[_0x076e('0x33')][_0x076e('0x36')],_0x12f230[_0x076e('0x156')]));this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x158'),this[_0x076e('0x33')][_0x076e('0x36')],_0x12f230[_0x076e('0x156')]));return{'code':0xc8,'result':_0x076e('0x15a')};}};AGIVertices[_0x076e('0xc')][_0x076e('0x16a')]=function(_0x2bac7a){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2bac7a[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x2bac7a[_0x076e('0x111')])){return this['channel'][_0x076e('0x28')](_0x2bac7a,_0x076e('0x16b'));}var _0x2c6e57=this[_0x076e('0x1b')][_0x076e('0x6e')](this,_0x2bac7a[_0x076e('0x111')]);if(!_0x2c6e57){return this[_0x076e('0x33')][_0x076e('0x28')](_0x2bac7a,_0x076e('0x112'));}var _0x6d5c79=this[_0x076e('0x33')][_0x076e('0x57')]('PLAYBACK',[_0x2c6e57,_0x2bac7a[_0x076e('0xe8')]]);if(_0x6d5c79[_0x076e('0xa6')]===-0x1){return _0x6d5c79;}return this[_0x076e('0x33')][_0x076e('0xac')](util['format'](_0x076e('0xcc'),_0x076e('0x16c'),_0x2c6e57));};AGIVertices[_0x076e('0xc')]['queue']=function(_0x4f4ff8){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x16d'),_0x4f4ff8[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x4f4ff8[_0x076e('0x16e')])){return this[_0x076e('0x33')]['error'](_0x4f4ff8,_0x076e('0x16f'));}var _0x59b48f='';var _0x1d03a1=parseInt(_0x4f4ff8['queue_id'],0xa);if(isNaN(_0x1d03a1)){_0x59b48f=_0x4f4ff8['queue_id'];}else{_0x59b48f=this[_0x076e('0x12')][_0x076e('0x6e')](this,_0x4f4ff8[_0x076e('0x16e')]);if(!_0x59b48f){return this['channel']['error'](_0x4f4ff8,'no\x20queue\x20found');}}var _0x4e1dc1='';if(this['isConfigured'](_0x4f4ff8['file_id'])){var _0x3ac41e=this['getSound'][_0x076e('0x6e')](this,_0x4f4ff8['file_id']);if(_0x3ac41e){_0x4e1dc1=_0x3ac41e;}}this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x4f4ff8,_0x59b48f);if(_0x4f4ff8['opts'][_0x076e('0x170')]('x')<0x0){_0x4f4ff8[_0x076e('0xe8')]+='x';}if(_0x4f4ff8[_0x076e('0xe8')]['indexOf']('X')<0x0){_0x4f4ff8['opts']+='X';}this[_0x076e('0x33')][_0x076e('0xa0')](_0x076e('0x171'),_0x59b48f?_0x59b48f[_0x076e('0x172')]():'');var _0x28a640=this[_0x076e('0x33')][_0x076e('0x57')](_0x076e('0x173'),[_0x59b48f,_0x4f4ff8[_0x076e('0xe8')],_0x4f4ff8[_0x076e('0x70')],_0x4e1dc1,_0x4f4ff8[_0x076e('0xbe')],_0x4f4ff8[_0x076e('0x4')],_0x4f4ff8[_0x076e('0x174')],_0x4f4ff8['gosub'],'',_0x4f4ff8[_0x076e('0x175')]]);if(_0x28a640['result']===-0x1){return _0x28a640;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0xcc'),_0x076e('0x173'),_0x59b48f));};AGIVertices[_0x076e('0xc')][_0x076e('0x176')]=function(_0x2c6916){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x177'),_0x2c6916[_0x076e('0x34')]));var _0x368c5a=_0x2c6916[_0x076e('0x178')]||_0x076e('0x131');var _0x2d815b=util[_0x076e('0x9f')](_0x076e('0x179'),this[_0x076e('0x33')][_0x076e('0x38')],rs[_0x076e('0x11a')](0x5));var _0x9afb91=util[_0x076e('0x9f')](_0x076e('0x17a'),FILES_PATH,_0x2d815b,_0x368c5a);var _0x366759=util['format'](_0x076e('0x132'),FILES_PATH,_0x2d815b);this[_0x076e('0x37')]['sync'](this,_0x2c6916,_0x2d815b,_0x9afb91);this[_0x076e('0x33')][_0x076e('0xa0')]('RECORDING_SAVENAME',_0x2d815b);logger[_0x076e('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x366759,_0x368c5a,_0x2c6916[_0x076e('0x17b')],_0x2c6916[_0x076e('0xbe')]);return this['channel'][_0x076e('0x135')](_0x366759,_0x368c5a,_0x2c6916['escape_digits'],_0x2c6916[_0x076e('0xbe')],undefined,!![]);};AGIVertices[_0x076e('0xc')]['restapi']=function(_0x51a48e){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x51a48e['label']));if(!this[_0x076e('0x86')](_0x51a48e['url'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x17c'));}var _0x54336d=this[_0x076e('0x63')][_0x076e('0x6e')](this,_0x51a48e);logger[_0x076e('0x2b')](util['format']('Response:',util['inspect'](_0x54336d,{'showHidden':![],'depth':null})));if(!this[_0x076e('0x86')](_0x51a48e[_0x076e('0xdc')])){return this[_0x076e('0x33')][_0x076e('0xac')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0xa6611=this[_0x076e('0xd')][_0x076e('0x6e')](this,_0x51a48e['variable_id']);if(!_0xa6611){return this[_0x076e('0x33')][_0x076e('0x28')](_0x51a48e,_0x076e('0xdd'));}this[_0x076e('0x33')][_0x076e('0xa0')](util['format'](_0x076e('0x17d'),_0xa6611),_0x54336d[_0x076e('0x75')]?_0x54336d[_0x076e('0x75')]:_0x076e('0x17e'));this[_0x076e('0x33')][_0x076e('0xa0')](util[_0x076e('0x9f')]('%s_STATUS_MESSAGE',_0xa6611),_0x54336d['statusMessage']?_0x54336d[_0x076e('0x74')]:'OK');if(_0x54336d['body']){try{this[_0x076e('0x9c')](_0x54336d[_0x076e('0x68')],_0xa6611);}catch(_0x1b3051){logger[_0x076e('0x28')](util[_0x076e('0x9f')](_0x076e('0x17f'),_0xa6611));}}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('variable\x20%s\x20set',_0xa6611));};AGIVertices[_0x076e('0xc')]['saydigits']=function(_0x3ed802){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x180'),_0x3ed802[_0x076e('0x34')]));return this[_0x076e('0x33')][_0x076e('0x181')](_0x3ed802[_0x076e('0x182')][_0x076e('0x59')](/\s+/g,''),_0x3ed802[_0x076e('0x17b')]);};AGIVertices['prototype'][_0x076e('0x183')]=function(_0x2231aa){logger['info'](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2231aa[_0x076e('0x34')]));return this['channel']['sayNumber'](_0x2231aa[_0x076e('0x184')][_0x076e('0x59')](/\s+/g,''),_0x2231aa[_0x076e('0x17b')]);};AGIVertices[_0x076e('0xc')]['sayphonetic']=function(_0x16a618){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x16a618['label']));return this[_0x076e('0x33')][_0x076e('0x185')](_0x16a618[_0x076e('0x5b')],_0x16a618[_0x076e('0x17b')]);};AGIVertices['prototype']['sendMail']=function(_0x1caa26){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x186'),_0x1caa26[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x1caa26[_0x076e('0x187')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x188'));}var _0x38a049=this[_0x076e('0x1f')][_0x076e('0x6e')](this,_0x1caa26[_0x076e('0x187')]);if(!_0x38a049||!_0x38a049[_0x076e('0x189')]){return this['channel'][_0x076e('0x28')](_0x1caa26,_0x076e('0x18a'));}var _0x511069={'from':util[_0x076e('0x9f')]('\x22%s\x22\x20<%s>',_0x38a049[_0x076e('0x10')],_0x38a049['email']||_0x38a049[_0x076e('0x189')][_0x076e('0x18b')]),'to':_0x1caa26['to']||'','cc':_0x1caa26['cc']||'','bcc':_0x1caa26[_0x076e('0x18c')]||'','subject':_0x1caa26[_0x076e('0x18d')],'html':_0x1caa26[_0x076e('0x5b')],'text':_0x1caa26[_0x076e('0x5b')]};var _0x4022a5={'tls':{'rejectUnauthorized':![]}};if(_0x38a049[_0x076e('0x189')][_0x076e('0x18e')]){_0x4022a5[_0x076e('0x18e')]=_0x38a049[_0x076e('0x189')][_0x076e('0x18e')];}else{_0x4022a5[_0x076e('0x18f')]=_0x38a049[_0x076e('0x189')]['host'];_0x4022a5[_0x076e('0x190')]=_0x38a049['Smtp'][_0x076e('0x190')];_0x4022a5[_0x076e('0x191')]=_0x38a049[_0x076e('0x189')][_0x076e('0x191')];}if(_0x38a049[_0x076e('0x189')]['authentication']){_0x4022a5[_0x076e('0x192')]={'user':_0x38a049[_0x076e('0x189')][_0x076e('0x18b')],'pass':_0x38a049['Smtp'][_0x076e('0x193')]};}if(this[_0x076e('0x86')](_0x1caa26[_0x076e('0x194')])){}logger[_0x076e('0xe3')](_0x076e('0x195'),JSON[_0x076e('0x73')](_0x511069));this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x1caa26,_0x1caa26[_0x076e('0x187')]);this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x196'),_0x38a049[_0x076e('0x10')]));this[_0x076e('0x197')][_0x076e('0x6e')](this,_0x4022a5,_0x511069);return this[_0x076e('0x33')][_0x076e('0xac')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x076e('0x198')]=function(_0x107fbd){logger[_0x076e('0x2b')](util['format'](_0x076e('0x199'),_0x107fbd[_0x076e('0x34')]));return this[_0x076e('0x33')][_0x076e('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x076e('0x19a')]=function(_0x3b16c1){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x19b'),_0x3b16c1[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x3b16c1[_0x076e('0x19c')])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x19d'));}var _0x590a58=this[_0x076e('0x30')][_0x076e('0x6e')](this,_0x3b16c1['sms_account_id']);if(!_0x590a58){return this['channel']['error'](_0x3b16c1,_0x076e('0x19e'));}var _0x454c96={'body':_0x3b16c1[_0x076e('0x19f')],'phone':_0x3b16c1['to']||'','SmsAccountId':_0x590a58['id']};logger['debug']('sendSMS\x20message',JSON[_0x076e('0x73')](_0x454c96));this['createSquareDetailsReport'][_0x076e('0x6e')](this,_0x3b16c1,_0x3b16c1['sms_account_id']);this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x590a58['name']));this[_0x076e('0x32')]['sync'](this,_0x454c96);return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x1a0'));};AGIVertices[_0x076e('0xc')][_0x076e('0x1a1')]=function(_0x30cad0){logger['info'](util[_0x076e('0x9f')](_0x076e('0x1a2'),_0x30cad0[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x30cad0['variable_id'])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x30cad0,'no\x20variable\x20selected');}var _0x22bab7=this[_0x076e('0xd')][_0x076e('0x6e')](this,_0x30cad0[_0x076e('0xdc')]);if(!_0x22bab7){return this[_0x076e('0x33')][_0x076e('0x28')](_0x30cad0,_0x076e('0xdd'));}return this[_0x076e('0x33')][_0x076e('0xa0')](_0x22bab7,_0x30cad0['variable_value']);};AGIVertices[_0x076e('0xc')][_0x076e('0x1a3')]=function(_0x4f0f52){logger[_0x076e('0x2b')](util['format'](_0x076e('0x1a4'),_0x4f0f52[_0x076e('0x34')]));this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x1a5'));if(_0x4f0f52[_0x076e('0xc1')]==='yes'){this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0x1a6'));return this[_0x076e('0x33')][_0x076e('0xc1')]();}return this[_0x076e('0x33')]['noop']('Skipped\x20Answer');};AGIVertices[_0x076e('0xc')][_0x076e('0x1a7')]=function(_0x54bfba){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x54bfba['label']));if(!this[_0x076e('0x86')](_0x54bfba[_0x076e('0x1a8')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x54bfba,_0x076e('0x1a9'));}var _0x5005e6=this[_0x076e('0x15')]['sync'](this,_0x54bfba[_0x076e('0x1a8')]);if(!this[_0x076e('0x86')](_0x5005e6)){return this[_0x076e('0x33')][_0x076e('0x28')](_0x54bfba,util[_0x076e('0x9f')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x54bfba[_0x076e('0x1a8')]));}if(_0x5005e6===this[_0x076e('0x33')][_0x076e('0x1aa')]){return this[_0x076e('0x33')][_0x076e('0x28')](_0x54bfba,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x076e('0xa9')]['sync'](this,_0x54bfba,_0x5005e6);var _0x48617d=this[_0x076e('0x33')][_0x076e('0x57')](_0x076e('0x1ab'),util[_0x076e('0x9f')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0x076e('0x1ac'),_0x5005e6,this[_0x076e('0x33')]['arg_1']));if(_0x48617d['result']===-0x1){return _0x48617d;}return this['channel'][_0x076e('0xac')](util['format']('Executed\x20command\x20%s\x20%s',_0x076e('0x1ab'),_0x5005e6));};AGIVertices[_0x076e('0xc')][_0x076e('0x1ad')]=function(_0x1b31a1){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x1ae'),_0x1b31a1[_0x076e('0x34')]));var _0x1badc9=this[_0x076e('0x56')][_0x076e('0x6e')](this,_0x1b31a1['command']);this[_0x076e('0xa9')][_0x076e('0x6e')](this,_0x1b31a1,_0x1b31a1[_0x076e('0xbc')]);if(this[_0x076e('0x86')](_0x1b31a1['variable_id'])){var _0x1bcfa9=this[_0x076e('0xd')][_0x076e('0x6e')](this,_0x1b31a1['variable_id']);if(_0x1bcfa9){this[_0x076e('0x33')]['setVariable'](_0x1bcfa9,_0x1badc9);return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x1af'),_0x1b31a1[_0x076e('0xbc')],_0x1bcfa9));}}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x1b0'),_0x1b31a1[_0x076e('0xbc')]));};AGIVertices[_0x076e('0xc')]['google_cloud_tts']=function(_0x178006){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x178006[_0x076e('0x34')]));_0x178006['text']=_0x178006[_0x076e('0x5b')][_0x076e('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x076e('0x86')](_0x178006[_0x076e('0x1b1')])){return this['channel'][_0x076e('0xac')](_0x076e('0x1b2'));}if(!this[_0x076e('0x86')](_0x178006[_0x076e('0x5b')])){return this[_0x076e('0x33')][_0x076e('0xac')]('no\x20text\x20configured');}this['channel'][_0x076e('0xac')](util['format'](_0x076e('0x1b3'),_0x178006[_0x076e('0x5b')]));var _0x21ee1f=this[_0x076e('0x5a')][_0x076e('0x6e')](this,_0x178006);if(_0x21ee1f){this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x1b4'),_0x21ee1f));var _0x2a07a7=this['channel']['streamFile'](_0x21ee1f);try{fs[_0x076e('0x105')](_0x21ee1f+_0x076e('0x125'));}catch(_0x35980a){logger[_0x076e('0x28')](_0x35980a);}return _0x2a07a7;}return this['channel'][_0x076e('0x28')](_0x178006,_0x076e('0x1b5'));};AGIVertices[_0x076e('0xc')][_0x076e('0x1b6')]=function(_0xca745c){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x1b7'),_0xca745c['label']));_0xca745c[_0x076e('0x5b')]=_0xca745c[_0x076e('0x5b')][_0x076e('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x076e('0x86')](_0xca745c['text'])){return this[_0x076e('0x33')][_0x076e('0xac')](_0x076e('0xad'));}this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x1b8'),_0xca745c[_0x076e('0x5b')]));var _0x1a69c3=this[_0x076e('0x61')][_0x076e('0x6e')](this,_0xca745c);if(_0x1a69c3){this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')](_0x076e('0x1b9'),_0x1a69c3));var _0x43569d=this[_0x076e('0x33')]['streamFile'](_0x1a69c3);try{fs[_0x076e('0x105')](_0x1a69c3+_0x076e('0x125'));}catch(_0x44aec6){logger[_0x076e('0x28')](_0x44aec6);}return _0x43569d;}return this['channel'][_0x076e('0x28')](_0xca745c,_0x076e('0x1ba'));};AGIVertices['prototype'][_0x076e('0x1bb')]=function(_0x8e25b8){logger[_0x076e('0x2b')](util['format'](_0x076e('0x1bc'),_0x8e25b8[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x8e25b8['findBy'])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x8e25b8,_0x076e('0x15c'));}logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x076e('0x33')][_0x076e('0x36')],_0x8e25b8[_0x076e('0x156')]));var _0x4c8ba2=this[_0x076e('0x50')][_0x076e('0x6e')](this,_0x8e25b8[_0x076e('0x156')]);if(_0x4c8ba2){logger[_0x076e('0x2b')](util[_0x076e('0x9f')](_0x076e('0x158'),this[_0x076e('0x33')][_0x076e('0x36')],_0x8e25b8['findBy']));this['channel']['noop'](util[_0x076e('0x9f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x076e('0x33')][_0x076e('0x36')],_0x8e25b8[_0x076e('0x156')]));return{'code':0xc8,'result':_0x076e('0x169')};}else{logger[_0x076e('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x076e('0x33')][_0x076e('0x36')],_0x8e25b8[_0x076e('0x156')]));this['channel'][_0x076e('0xac')](util[_0x076e('0x9f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x076e('0x33')][_0x076e('0x36')],_0x8e25b8[_0x076e('0x156')]));return{'code':0xc8,'result':_0x076e('0x15a')};}};AGIVertices['prototype']['voicemail']=function(_0x5a987c){logger['info'](util[_0x076e('0x9f')](_0x076e('0x1bd'),_0x5a987c[_0x076e('0x34')]));var _0x38b9d1=this['channel'][_0x076e('0x57')](_0x076e('0x1be'),[_0x5a987c[_0x076e('0x1bf')],_0x5a987c['options']]);if(_0x38b9d1['result']===-0x1){return _0x38b9d1;}return this[_0x076e('0x33')][_0x076e('0xac')](util[_0x076e('0x9f')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x5a987c[_0x076e('0x1bf')]));};AGIVertices[_0x076e('0xc')][_0x076e('0x1c0')]=function(_0x23c305){logger[_0x076e('0x2b')](util[_0x076e('0x9f')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x23c305[_0x076e('0x34')]));if(!this[_0x076e('0x86')](_0x23c305[_0x076e('0xdc')])){return this[_0x076e('0x33')][_0x076e('0x28')](_0x23c305,_0x076e('0x1c1'));}var _0x28ed4a=this['getVariable']['sync'](this,_0x23c305[_0x076e('0xdc')]);if(!_0x28ed4a){return this[_0x076e('0x33')]['error'](_0x23c305,'no\x20variable\x20found');}var _0x2e239=this[_0x076e('0x33')][_0x076e('0xd')](_0x28ed4a);return{'code':0xc8,'result':_0x2e239[_0x076e('0xa4')]?_0x2e239[_0x076e('0xa4')]:'-'};};String['prototype']['replaceAll']=function(_0x1304c8,_0x595f99){return this[_0x076e('0xa2')](_0x1304c8)['join'](_0x595f99);};module['exports']=AGIVertices; \ No newline at end of file +var _0x8404=['An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','split','length','replaceAll','extra','getAndSetVariable','result','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2','dialogflowV2_project_id','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','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','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','context','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','secure','authentication','auth','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','priority','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','MP3','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','rawBody','parse'];(function(_0x2c6d8d,_0xd0025f){var _0x5f3ab8=function(_0x22a4d7){while(--_0x22a4d7){_0x2c6d8d['push'](_0x2c6d8d['shift']());}};_0x5f3ab8(++_0xd0025f);}(_0x8404,0x15d));var _0x4840=function(_0x5585b7,_0x57e174){_0x5585b7=_0x5585b7-0x0;var _0x4e3f75=_0x8404[_0x5585b7];return _0x4e3f75;};'use strict';var fs=require('fs');var path=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var _=require(_0x4840('0x2'));var sh=require(_0x4840('0x3'));var odbc=require(_0x4840('0x4'))();var rs=require(_0x4840('0x5'));var moment=require(_0x4840('0x6'));var Mustache=require(_0x4840('0x7'));var rp=require(_0x4840('0x8'));var logger=require('../../config/logger')(_0x4840('0x9'));var config=require(_0x4840('0xa'));var scripts=require(_0x4840('0xb'));var FILES_PATH=_0x4840('0xc');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x4840('0xd'),_0x4840('0xe'),_0x4840('0xf')];var AGIVertices=function(_0x3e9856,_0x2fee69,_0x1ebef2){this['channel']=_0x3e9856;this[_0x4840('0x10')]=_0x2fee69;this[_0x4840('0x11')]=_0x1ebef2;};AGIVertices['prototype'][_0x4840('0x12')]=function(_0x43e97c,_0x16bee1){this[_0x4840('0x10')]['getVariableById'](_0x43e97c)[_0x4840('0x13')](function(_0x2dfec2){_0x16bee1(null,_0x2dfec2?_0x2dfec2[_0x4840('0x14')]:![]);})[_0x4840('0x15')](function(_0x16e4fd){_0x16bee1(_0x16e4fd);});};AGIVertices[_0x4840('0x16')][_0x4840('0x17')]=function(_0x5be053,_0x4d9cbb){this[_0x4840('0x10')][_0x4840('0x18')](_0x5be053)['then'](function(_0x4449e9){_0x4d9cbb(null,_0x4449e9?_0x4449e9[_0x4840('0x14')]:![]);})['catch'](function(_0x477823){_0x4d9cbb(_0x477823);});};AGIVertices['prototype'][_0x4840('0x19')]=function(_0x1a9282,_0xe693d2){this[_0x4840('0x10')][_0x4840('0x1a')](_0x1a9282)[_0x4840('0x13')](function(_0x1c3dde){_0xe693d2(null,_0x1c3dde?_0x1c3dde['name']:![]);})['catch'](function(_0x319ea4){_0xe693d2(_0x319ea4);});};AGIVertices['prototype'][_0x4840('0x1b')]=function(_0x36e515,_0x470050){this[_0x4840('0x10')]['getSquareOdbcById'](_0x36e515)['then'](function(_0x8d4c52){_0x470050(null,_0x8d4c52?_0x8d4c52[_0x4840('0x1c')]:![]);})['catch'](function(_0xbd08dd){_0x470050(_0xbd08dd);});};AGIVertices[_0x4840('0x16')][_0x4840('0x1d')]=function(_0x2ac38f,_0x4a05bb){this[_0x4840('0x10')][_0x4840('0x1e')](_0x2ac38f)['then'](function(_0x5b65c1){_0x4a05bb(null,_0x5b65c1?_0x5b65c1[_0x4840('0x14')]:![]);})[_0x4840('0x15')](function(_0x35939b){_0x4a05bb(_0x35939b);});};AGIVertices[_0x4840('0x16')][_0x4840('0x1f')]=function(_0x15ec23,_0x2e6760){this['rpc'][_0x4840('0x20')](_0x15ec23)[_0x4840('0x13')](function(_0x76a1be){_0x2e6760(null,_0x76a1be?_0x76a1be[_0x4840('0x14')]:![]);})[_0x4840('0x15')](function(_0x3c7afe){_0x2e6760(_0x3c7afe);});};AGIVertices['prototype'][_0x4840('0x21')]=function(_0x584584,_0x14dee2){var _0x22451c=this;this[_0x4840('0x10')][_0x4840('0x22')](_0x584584)[_0x4840('0x13')](function(_0x5559da){_0x14dee2(null,_0x5559da?_0x22451c[_0x4840('0x23')](_0x5559da['save_name']):![]);})[_0x4840('0x15')](function(_0x141be8){_0x14dee2(_0x141be8);});};AGIVertices[_0x4840('0x16')]['getMailAccount']=function(_0x5ddb38,_0x1944fe){this[_0x4840('0x10')][_0x4840('0x24')](_0x5ddb38)[_0x4840('0x13')](function(_0x243069){_0x1944fe(null,_0x243069?_0x243069:![]);})[_0x4840('0x15')](function(_0x3bdda3){_0x1944fe(_0x3bdda3);});};AGIVertices[_0x4840('0x16')]['sendMailMessage']=function(_0x48aa39,_0x2ee40b,_0x5d1846){this[_0x4840('0x11')][_0x4840('0x25')](_0x48aa39,_0x2ee40b)[_0x4840('0x13')](function(){_0x5d1846(null);})['catch'](function(_0x2c88d5){_0x5d1846(_0x2c88d5);});};AGIVertices[_0x4840('0x16')][_0x4840('0x26')]=function(_0xc532b7,_0x73333a){this[_0x4840('0x10')][_0x4840('0x27')](_0xc532b7)[_0x4840('0x13')](function(_0x569845){if(_0x569845){if(_0x569845[_0x4840('0x28')]){_0x73333a(null,[_0x569845['interval']]);}else{_0x73333a(null,_[_0x4840('0x29')](_0x569845[_0x4840('0x2a')],'interval'));}}else{_0x73333a(null,![]);}})['catch'](function(_0x1aeb01){_0x73333a(_0x1aeb01);});};AGIVertices[_0x4840('0x16')][_0x4840('0x23')]=function(_0x2d3b52){return util[_0x4840('0x2b')](_0x4840('0x2c'),FILES_PATH,_0x2d3b52);};AGIVertices[_0x4840('0x16')][_0x4840('0x2d')]=function(_0x3b0795,_0xeed716,_0x5ab62b){odbc[_0x4840('0x2e')](_0x3b0795,function(_0x524782){if(_0x524782){logger[_0x4840('0x2f')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x524782);_0x5ab62b(_0x524782);}else{logger[_0x4840('0x30')](_0x4840('0x31'));odbc[_0x4840('0x32')](_0xeed716,function(_0x407494,_0xd9a692){if(_0x407494){logger[_0x4840('0x30')](_0x4840('0x33'),_0xeed716);_0x5ab62b(_0x407494);}else{logger[_0x4840('0x30')](_0x4840('0x34'),_0xeed716);odbc[_0x4840('0x35')](function(_0x339716){if(_0x339716){logger[_0x4840('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x339716);}_0x5ab62b(null,_0xd9a692);});}});}});};AGIVertices[_0x4840('0x16')][_0x4840('0x36')]=function(_0x3edd50,_0x2e5515){this['rpc'][_0x4840('0x37')](_0x3edd50)[_0x4840('0x13')](function(_0x54241b){_0x2e5515(null,_0x54241b?_0x54241b:![]);})[_0x4840('0x15')](function(_0x51a8e7){_0x2e5515(_0x51a8e7);});};AGIVertices[_0x4840('0x16')][_0x4840('0x38')]=function(_0x8d3c51,_0x1541f5){this[_0x4840('0x10')][_0x4840('0x38')](_0x8d3c51)[_0x4840('0x13')](function(_0x2ba80d){_0x1541f5(null,_0x2ba80d);})[_0x4840('0x15')](function(_0x44e503){_0x1541f5(_0x44e503);});};AGIVertices[_0x4840('0x16')]['createSquareDetailsReport']=function(_0x969393,_0x3d7f94,_0xd7741e){this[_0x4840('0x10')][_0x4840('0x39')]({'uniqueid':this[_0x4840('0x3a')][_0x4840('0x3b')],'node':_0x969393[_0x4840('0x3c')],'application':_0x969393['agicommand'],'data':_0x3d7f94||null,'project_name':this[_0x4840('0x3a')][_0x4840('0x3d')],'callerid':this['channel'][_0x4840('0x3e')]})[_0x4840('0x13')](function(_0x53bbf5){if(_0xd7741e){_0xd7741e(null,_0x53bbf5);}})[_0x4840('0x15')](function(_0x3745dc){if(_0xd7741e){_0xd7741e(_0x3745dc);}});};AGIVertices['prototype'][_0x4840('0x3f')]=function(_0x4e9fbe,_0x7451b0,_0x554a79,_0x53749e){this['rpc'][_0x4840('0x3f')]({'uniqueid':this['channel'][_0x4840('0x3b')],'callerid':this['channel'][_0x4840('0x3e')],'calleridname':this['channel']['calleridname'],'context':this[_0x4840('0x3a')]['context'],'extension':this[_0x4840('0x3a')]['extension'],'priority':this[_0x4840('0x3a')][_0x4840('0x40')],'accountcode':this['channel'][_0x4840('0x41')],'dnid':this[_0x4840('0x3a')][_0x4840('0x42')],'projectName':this['channel'][_0x4840('0x3d')],'saveName':_0x7451b0,'filename':_0x4e9fbe[_0x4840('0x43')]||_0x7451b0,'savePath':_0x554a79})[_0x4840('0x13')](function(_0x5a32fe){_0x53749e(null,_0x5a32fe);})[_0x4840('0x15')](function(_0x4bfcec){_0x53749e(_0x4bfcec);});};AGIVertices[_0x4840('0x16')]['createSquareMessage']=function(_0x1b37f6,_0x264948,_0x124f37,_0x224a8e,_0x7606e8){this['rpc'][_0x4840('0x44')]({'uniqueid':this[_0x4840('0x3a')][_0x4840('0x3b')],'body':_0x1b37f6,'direction':_0x264948,'providerName':_0x124f37,'providerResponse':_0x224a8e})['then'](function(_0x346d87){if(_0x7606e8){_0x7606e8(null,_0x346d87);}})[_0x4840('0x15')](function(_0x4c1d40){if(_0x7606e8){_0x7606e8(_0x4c1d40);}});};AGIVertices[_0x4840('0x16')]['createCmContact']=function(_0x2562a6,_0x5f2f3c){this[_0x4840('0x10')]['createCmContact']({'firstName':_[_0x4840('0x45')](_0x2562a6['name'])||_[_0x4840('0x46')](_0x2562a6[_0x4840('0x14')])?_0x4840('0x47')+Math[_0x4840('0x48')]():_0x2562a6['name'],'lastName':_[_0x4840('0x45')](_0x2562a6[_0x4840('0x49')])||_[_0x4840('0x46')](_0x2562a6['lastName'])?null:_0x2562a6[_0x4840('0x49')],'phone':_0x2562a6[_0x4840('0x4a')],'ListId':_0x2562a6[_0x4840('0x4b')],'scheduledat':_0x2562a6['scheduledAt'],'callbackUniqueid':this['channel'][_0x4840('0x3b')],'tags':_0x4840('0x4c'),'description':_0x4840('0x4d')+_0x2562a6[_0x4840('0x4e')][_0x4840('0x4f')](),'priority':_0x2562a6['callback_priority']})[_0x4840('0x13')](function(_0x277ead){_0x5f2f3c(null,_0x277ead);})[_0x4840('0x15')](function(_0x41448c){_0x5f2f3c(_0x41448c);});};AGIVertices[_0x4840('0x16')][_0x4840('0x50')]=function(_0x49edf8,_0x10881a){this[_0x4840('0x10')][_0x4840('0x51')](_0x49edf8)[_0x4840('0x13')](function(_0x75902c){_0x10881a(null,_0x75902c?_0x75902c[_0x4840('0x14')]:![]);})['catch'](function(_0x308bbc){_0x10881a(_0x308bbc);});};AGIVertices[_0x4840('0x16')]['agentPause']=function(_0x37b649,_0x153e2f,_0x1ee145){var _0x42aacd={'role':_0x4840('0x52')};_0x42aacd[_0x37b649]=this[_0x4840('0x3a')][_0x4840('0x3e')];this[_0x4840('0x10')][_0x4840('0x53')](_0x42aacd,_0x153e2f,this[_0x4840('0x3a')][_0x4840('0x3b')])['then'](function(_0x4dd09e){_0x1ee145(null,_[_0x4840('0x46')](_0x4dd09e)?![]:!![]);})['catch'](function(_0x3f7e2d){logger['error'](_0x3f7e2d);_0x1ee145(null,![]);});};AGIVertices[_0x4840('0x16')]['agentUnpause']=function(_0x1bc9fa,_0x246f76){var _0x32a6a8={'role':_0x4840('0x52')};_0x32a6a8[_0x1bc9fa]=this[_0x4840('0x3a')][_0x4840('0x3e')];this[_0x4840('0x10')][_0x4840('0x54')](_0x32a6a8)[_0x4840('0x13')](function(_0x15c849){_0x246f76(null,_['isNil'](_0x15c849)?![]:!![]);})[_0x4840('0x15')](function(_0x86a20a){logger[_0x4840('0x2f')](_0x86a20a);_0x246f76(null,![]);});};AGIVertices[_0x4840('0x16')][_0x4840('0x55')]=function(_0x289e8c,_0x3a5b47){var _0x230749={'role':_0x4840('0x52')};_0x230749[_0x289e8c]=this[_0x4840('0x3a')][_0x4840('0x3e')];this[_0x4840('0x10')][_0x4840('0x55')](_0x230749)[_0x4840('0x13')](function(_0x305ba3){_0x3a5b47(null,_['isNil'](_0x305ba3)?![]:!![]);})[_0x4840('0x15')](function(_0x40422c){logger[_0x4840('0x2f')](_0x40422c);_0x3a5b47(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x2e3ac5,_0x2f73e0){var _0x6829e0={'role':_0x4840('0x52')};_0x6829e0[_0x2e3ac5]=this[_0x4840('0x3a')][_0x4840('0x3e')];var _0x114521=_0x2e3ac5!=_0x4840('0x56')?util[_0x4840('0x2b')](_0x4840('0x57'),_0x4840('0x58'),this[_0x4840('0x3a')][_0x4840('0x3e')]):undefined;this['rpc'][_0x4840('0x59')](_0x6829e0,_0x114521)[_0x4840('0x13')](function(_0x37e027){_0x2f73e0(null,_[_0x4840('0x46')](_0x37e027)?![]:!![]);})[_0x4840('0x15')](function(_0x508284){logger['error'](_0x508284);_0x2f73e0(null,![]);});};AGIVertices[_0x4840('0x16')][_0x4840('0x5a')]=function(_0x507056,_0x44b6d8){sh[_0x4840('0x5b')](_['trim'](_0x507056),function(_0x31d330,_0x4736b8){var _0x280ea7=_0x4736b8['replace'](/(\r\n|\n|\r)/gm,'');_0x44b6d8(null,_0x280ea7);});};AGIVertices[_0x4840('0x16')]['googleCloudTTS']=function(_0x162a24,_0x193764){scripts[_0x4840('0x5c')](_0x162a24['apiKey'],_0x162a24['google_cloud_tts_text_type']||_0x4840('0x5d'),_0x162a24[_0x4840('0x5d')],_0x162a24[_0x4840('0x5e')]||_0x4840('0x5f'),_0x162a24[_0x4840('0x60')]||_0x4840('0x61'),_0x162a24['audioEncoding']||_0x4840('0x62'))['then'](function(_0x25aa3c){_0x193764(null,_0x25aa3c);})[_0x4840('0x15')](function(_0x36c53a){_0x193764(_0x36c53a);});};AGIVertices[_0x4840('0x16')]['googleTTS']=function(_0x1e2d74,_0x4aa6c0){scripts['googleTTS'](_0x1e2d74[_0x4840('0x5d')],_0x1e2d74['google_tts_language']||'en',0x1)[_0x4840('0x13')](function(_0xf84cec){_0x4aa6c0(null,_0xf84cec);})['catch'](function(_0x1dda1f){_0x4aa6c0(_0x1dda1f);});};AGIVertices[_0x4840('0x16')][_0x4840('0x63')]=function(_0x479743,_0x23902){var _0x253814={'uri':_0x479743[_0x4840('0x64')],'method':_0x479743[_0x4840('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x479743['timeout'])===_0x4840('0x66')&&parseInt(_0x479743[_0x4840('0x67')])>=0x1?parseInt(_0x479743[_0x4840('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x4840('0x68')]([_0x4840('0x69'),_0x4840('0x6a')],_0x253814[_0x4840('0x65')][_0x4840('0x6b')]())){try{_0x253814['body']=_0x479743[_0x4840('0x6c')]?JSON[_0x4840('0x6d')](_0x479743[_0x4840('0x6c')]):{};}catch(_0x1486fd){logger[_0x4840('0x2f')](_0x4840('0x6e'),_0x1486fd);}}try{_0x253814[_0x4840('0x6f')]=_0x479743['rawHeaders']?JSON[_0x4840('0x6d')](_0x479743[_0x4840('0x70')]):{};}catch(_0x339276){logger[_0x4840('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x339276);}if(_0x479743[_0x4840('0x71')]){try{var _0x15fa5f=require(_0x479743[_0x4840('0x71')])[_0x4840('0x72')](this,_0x253814);_0x253814[_0x4840('0x73')]=Mustache['render'](_0x479743[_0x4840('0x64')],_0x15fa5f,{},['$$','$$']);if(_0x253814[_0x4840('0x6f')]){_0x253814[_0x4840('0x6f')]=JSON['parse'](Mustache[_0x4840('0x74')](JSON[_0x4840('0x75')](_0x253814[_0x4840('0x6f')]),_0x15fa5f,{},['$$','$$']));}if(_0x253814[_0x4840('0x76')]){_0x253814[_0x4840('0x76')]=JSON[_0x4840('0x6d')](Mustache['render'](JSON[_0x4840('0x75')](_0x253814[_0x4840('0x76')]),_0x15fa5f,{},['$$','$$']));}}catch(_0x1576c5){logger['error'](_0x4840('0x77'),_0x1576c5);}}rp(_0x253814)['then'](function(_0x227ba8){var _0x4ff2a4={'statusCode':_0x227ba8[_0x4840('0x78')]||0xc8,'statusMessage':_0x227ba8[_0x4840('0x79')]||'OK','headers':_0x227ba8[_0x4840('0x6f')]||{},'body':_0x227ba8[_0x4840('0x76')]||{}};_0x23902(null,_0x4ff2a4);})[_0x4840('0x15')](function(_0xecaa13){var _0x31c38f={'statusCode':_0xecaa13['statusCode']||0x1f4,'statusMessage':_0xecaa13['message']||_0x4840('0x7a'),'headers':_0xecaa13[_0x4840('0x7b')][_0x4840('0x6f')]||{},'body':_0xecaa13['options'][_0x4840('0x76')]||{}};_0x23902(null,_0x31c38f);});};AGIVertices['prototype'][_0x4840('0x7c')]=function(_0x5df914,_0x1f6df7){scripts['googleDialogflow'](this[_0x4840('0x3a')][_0x4840('0x3b')],_0x5df914[_0x4840('0x7d')],_0x5df914[_0x4840('0x5d')],_0x5df914['dialogflow_language']||'en')[_0x4840('0x13')](function(_0x12b7ee){_0x1f6df7(null,_0x12b7ee);})[_0x4840('0x15')](function(_0x439ce1){_0x1f6df7(_0x439ce1);});};AGIVertices[_0x4840('0x16')][_0x4840('0x7e')]=function(_0x582dd5,_0xffa5eb){scripts['googleDialogflowV2'](this[_0x4840('0x3a')]['uniqueid'],_0x582dd5['dialogflowV2_project_id'],_0x582dd5[_0x4840('0x7f')],_0x582dd5['private_key'],_0x582dd5[_0x4840('0x5d')],_0x582dd5[_0x4840('0x80')]||'en')[_0x4840('0x13')](function(_0x4b2bb2){_0xffa5eb(null,_0x4b2bb2);})[_0x4840('0x15')](function(_0x384039){_0xffa5eb(_0x384039);});};AGIVertices['prototype'][_0x4840('0x81')]=function(_0x4b0d1c,_0x53c78b){scripts[_0x4840('0x81')](this['channel'],_0x4b0d1c)['then'](function(_0x282884){_0x53c78b(null,_0x282884);})[_0x4840('0x15')](function(_0x4a6587){_0x53c78b(_0x4a6587);});};AGIVertices[_0x4840('0x16')][_0x4840('0x82')]=function(_0x39866c,_0x54a38b){scripts['ispeechTTS'](_0x39866c[_0x4840('0x7d')],_0x39866c['text'],_0x39866c[_0x4840('0x83')]||_0x4840('0x5f'),_0x39866c[_0x4840('0x84')])['then'](function(_0x36ca53){_0x54a38b(null,_0x36ca53);})[_0x4840('0x15')](function(_0x4f4891){_0x54a38b(_0x4f4891);});};AGIVertices['prototype'][_0x4840('0x85')]=function(_0x7c87d6,_0x55ee04,_0x5c2666){scripts[_0x4840('0x85')](_0x55ee04,_0x7c87d6['key'],_0x7c87d6[_0x4840('0x86')]||_0x4840('0x5f'),this[_0x4840('0x87')](_0x7c87d6['model'])?_0x7c87d6[_0x4840('0x88')]:undefined)[_0x4840('0x13')](function(_0x2a741f){_0x5c2666(null,_0x2a741f);})[_0x4840('0x15')](function(_0x2d7fee){_0x5c2666(_0x2d7fee);});};AGIVertices[_0x4840('0x16')][_0x4840('0x89')]=function(_0x82eaa1,_0x211a0c){scripts[_0x4840('0x89')](_0x82eaa1[_0x4840('0x8a')],_0x82eaa1[_0x4840('0x8b')],_0x82eaa1[_0x4840('0x8c')],_0x82eaa1[_0x4840('0x8d')]||'Amy',_0x82eaa1[_0x4840('0x5d')],_0x82eaa1['aws_text_type']||'text')['then'](function(_0x43623c){_0x211a0c(null,_0x43623c);})[_0x4840('0x15')](function(_0x22c744){_0x211a0c(_0x22c744);});};AGIVertices['prototype']['awsLex']=function(_0x14c259,_0x5364e0){scripts['awsLex'](this[_0x4840('0x3a')][_0x4840('0x3b')],_0x14c259[_0x4840('0x8a')],_0x14c259[_0x4840('0x8b')],_0x14c259[_0x4840('0x8e')],_0x14c259[_0x4840('0x5d')],_0x14c259[_0x4840('0x8f')])[_0x4840('0x13')](function(_0x3d9f44){_0x5364e0(null,_0x3d9f44);})['catch'](function(_0x198ab1){_0x5364e0(_0x198ab1);});};AGIVertices[_0x4840('0x16')][_0x4840('0x90')]=function(_0x41b99f,_0x445fa6,_0x3edca5){scripts[_0x4840('0x90')](_0x445fa6,_0x41b99f[_0x4840('0x7d')],_0x41b99f[_0x4840('0x91')]||'en-US')[_0x4840('0x13')](function(_0x423ddb){_0x3edca5(null,_0x423ddb);})['catch'](function(_0x30a4ab){_0x3edca5(_0x30a4ab);});};AGIVertices[_0x4840('0x16')][_0x4840('0x92')]=function(_0x298f9e,_0x122590,_0x3ceba4){scripts['tildeASR'](_0x122590,_0x298f9e['appid'],_0x298f9e[_0x4840('0x93')],_0x298f9e[_0x4840('0x73')])['then'](function(_0x101d66){_0x3ceba4(null,_0x101d66);})[_0x4840('0x15')](function(_0x45b217){_0x3ceba4(_0x45b217);});};AGIVertices[_0x4840('0x16')][_0x4840('0x94')]=function(_0x1ec4a6){var _0x49c5e1=_['includes'](verticesWithRetry,_0x1ec4a6[_0x4840('0x95')])?_0x1ec4a6:_[_0x4840('0x96')](_0x1ec4a6);for(var _0x20bc5e in _0x49c5e1){if(_0x49c5e1[_0x4840('0x97')](_0x20bc5e)){if(_0x49c5e1[_0x20bc5e]&&_['isString'](_0x49c5e1[_0x20bc5e])){if(_['includes'](recursiveMapAttributes,_0x20bc5e)){_0x49c5e1[_0x20bc5e]=this[_0x4840('0x98')](_0x49c5e1[_0x20bc5e]);}else{_0x49c5e1[_0x20bc5e]=this[_0x4840('0x99')](_0x49c5e1[_0x20bc5e]);}}}}return _0x49c5e1;};AGIVertices[_0x4840('0x16')][_0x4840('0x9a')]=function(_0x931af7){for(var _0xc0fb48 in _0x931af7){if(_0x931af7[_0x4840('0x97')](_0xc0fb48)){if(_[_0x4840('0x9b')](_0x931af7[_0xc0fb48])){this[_0x4840('0x9a')](_0x931af7[_0xc0fb48]);}else if(_[_0x4840('0x9c')](_0x931af7[_0xc0fb48])){for(var _0x5dd988=0x0;_0x5dd988<_0x931af7[_0xc0fb48]['length'];_0x5dd988++){this[_0x4840('0x9a')](_0x931af7[_0xc0fb48][_0x5dd988]);}}else if(_[_0x4840('0x9d')](_0x931af7[_0xc0fb48])){_0x931af7[_0xc0fb48]=this[_0x4840('0x99')](_0x931af7[_0xc0fb48]);}}}};AGIVertices[_0x4840('0x16')][_0x4840('0x9e')]=function(_0x56eae8,_0x19add2){for(var _0x24315f in _0x56eae8){if(_0x56eae8['hasOwnProperty'](_0x24315f)){if(_[_0x4840('0x9b')](_0x56eae8[_0x24315f])){if(!_[_0x4840('0x45')](_0x56eae8[_0x24315f])){this[_0x4840('0x9e')](_0x56eae8[_0x24315f],util[_0x4840('0x2b')]('%s.%s',_0x19add2,_0x24315f));}}else if(_['isArray'](_0x56eae8[_0x24315f])){for(var _0x56a9aa=0x0;_0x56a9aa<_0x56eae8[_0x24315f]['length'];_0x56a9aa++){this['saveRestApiResult'](_0x56eae8[_0x24315f][_0x56a9aa],util[_0x4840('0x2b')](_0x4840('0x9f'),_0x19add2,_0x24315f+'['+_0x56a9aa+']'));}}else{if(!_[_0x4840('0x46')](_0x56eae8[_0x24315f])){this[_0x4840('0x3a')]['setVariable'](util[_0x4840('0x2b')](_0x4840('0x9f'),_0x19add2,_0x24315f),_0x56eae8[_0x24315f]);}}}}};AGIVertices['prototype'][_0x4840('0x98')]=function(_0x5a720a){try{var _0x4ecf1e=JSON[_0x4840('0x6d')](_0x5a720a);this['recursiveNodeIndex'](_0x4ecf1e);return JSON[_0x4840('0x75')](_0x4ecf1e);}catch(_0x4bba5b){return this[_0x4840('0x99')](_0x5a720a);}};AGIVertices[_0x4840('0x16')][_0x4840('0x99')]=function(_0x19c986){var _0x3d0887=_0x19c986[_0x4840('0xa0')]('{');for(var _0x530ec1=0x1;_0x530ec1<_0x3d0887[_0x4840('0xa1')];_0x530ec1+=0x1){var _0x55f360=_0x3d0887[_0x530ec1][_0x4840('0xa0')]('}');if(_0x55f360['length']>0x1){_0x19c986=_0x19c986[_0x4840('0xa2')]('{'+_0x55f360[0x0]+'}',this[_0x4840('0x3a')][_0x4840('0x12')](_0x55f360[0x0])[_0x4840('0xa3')]||_0x55f360[0x0]);}}if(_0x3d0887['length']===0x1){return _0x19c986[_0x4840('0x4f')]();}return this[_0x4840('0x99')](_0x19c986);};AGIVertices['prototype'][_0x4840('0xa4')]=function(_0x3dc5ff,_0x279e26){var _0x43121e=this[_0x4840('0x3a')]['getVariable'](_0x3dc5ff);if(_0x43121e[_0x4840('0xa5')]===-0x1){return _0x43121e;}logger[_0x4840('0x30')](util[_0x4840('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x279e26,_0x43121e[_0x4840('0xa3')]));return this[_0x4840('0x3a')][_0x4840('0xa6')](_0x279e26,_0x43121e['extra']);};AGIVertices[_0x4840('0x16')]['isConfigured']=function(_0x33e211){return _0x33e211&&_0x33e211!=='0'&&_0x33e211!=='-1'&&_0x33e211!=='';};AGIVertices['prototype'][_0x4840('0xa7')]=function(_0x52ed21){this[_0x4840('0x39')][_0x4840('0x72')](this,_0x52ed21,'-');_0x52ed21[_0x4840('0xa8')]=_0x52ed21[_0x4840('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4840('0x16')][_0x4840('0xa9')]=function(_0x35b970){logger['info'](util[_0x4840('0x2b')](_0x4840('0xaa'),_0x35b970[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x35b970['text'])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}var _0x4fb078='\x22'+_0x35b970[_0x4840('0x5d')]+'\x22';if(this[_0x4840('0x87')](_0x35b970[_0x4840('0x7b')])){_0x4fb078+=','+_0x35b970[_0x4840('0x7b')];}var _0x24cae4=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x4840('0xad'),_0x4fb078);if(_0x24cae4[_0x4840('0xa5')]===-0x1){return _0x24cae4;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4fb078));};AGIVertices[_0x4840('0x16')][_0x4840('0xae')]=function(_0xf0425a){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xf0425a['label']));if(!this[_0x4840('0x87')](_0xf0425a['grammar'])){return this['channel']['noop'](_0x4840('0xaf'));}var _0x261ffe=_0xf0425a[_0x4840('0xb0')];if(this['isConfigured'](_0xf0425a[_0x4840('0x7b')])){_0x261ffe+=','+_0xf0425a['options'];}var _0x1dc627=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x4840('0xb1'),_0x261ffe);if(_0x1dc627['result']===-0x1){return _0x1dc627;}var _0x1533e4=this[_0x4840('0xa4')](_0x4840('0xb2'),_0x4840('0xb3'));if(_0x1533e4[_0x4840('0xa5')]===-0x1){return _0x1533e4;}var _0x25521c=this[_0x4840('0xa4')](_0x4840('0xb4'),_0x4840('0xb5'));if(_0x25521c[_0x4840('0xa5')]===-0x1){return _0x25521c;}var _0x1b20fe=this['getAndSetVariable']('RECOG_INSTANCE()',_0x4840('0xb6'));if(_0x1b20fe[_0x4840('0xa5')]===-0x1){return _0x1b20fe;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xb7'),_0x261ffe));};AGIVertices[_0x4840('0x16')][_0x4840('0x9')]=function(_0x31ef61){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x31ef61[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x9')]([_0x31ef61[_0x4840('0xb8')],_0x31ef61[_0x4840('0xb9')]]);};AGIVertices[_0x4840('0x16')][_0x4840('0xba')]=function(_0x433c02){logger[_0x4840('0x30')](util['format'](_0x4840('0xbb'),_0x433c02[_0x4840('0x3c')]));if(this[_0x4840('0x87')](_0x433c02['timeout'])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x433c02[_0x4840('0x67')]));var _0x2b0c9c=this[_0x4840('0x3a')][_0x4840('0xbc')](_0x433c02[_0x4840('0x67')]);if(_0x2b0c9c[_0x4840('0xa5')]===-0x1){return _0x2b0c9c;}}return this[_0x4840('0x3a')][_0x4840('0xba')]();};AGIVertices[_0x4840('0x16')][_0x4840('0x4c')]=function(_0x571815){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xbd'),_0x571815[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x571815[_0x4840('0x4b')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x571815,_0x4840('0xbe'));}_0x571815[_0x4840('0x4e')]=moment();if(this[_0x4840('0x87')](_0x571815[_0x4840('0xbf')])){_0x571815['scheduledAt']=moment()[_0x4840('0xc0')](_0x571815[_0x4840('0xbf')],_0x4840('0xc1'));}if(!this[_0x4840('0x87')](_0x571815['callback_priority'])){_0x571815[_0x4840('0xc2')]=0x2;}this[_0x4840('0xc3')][_0x4840('0x72')](this,_0x571815);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xc4'),_0x571815[_0x4840('0x4a')],_0x571815[_0x4840('0x4b')],_0x571815[_0x4840('0x4e')]));};AGIVertices[_0x4840('0x16')]['custom_app']=function(_0x37b991){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xc5'),_0x37b991['label']));var _0x31511b=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x37b991[_0x4840('0xc6')],_0x37b991[_0x4840('0x7b')]);if(_0x31511b[_0x4840('0xa5')]===-0x1){return _0x31511b;}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xc7'),_0x37b991['application'],_0x37b991['options']));};AGIVertices[_0x4840('0x16')][_0x4840('0xc8')]=function(_0x9c6fde){logger['info'](util[_0x4840('0x2b')](_0x4840('0xc9'),_0x9c6fde['label']));if(!this['isConfigured'](_0x9c6fde['text'])){return this[_0x4840('0x3a')]['noop'](_0x4840('0xac'));}var _0x5ebf18='\x22'+_0x9c6fde[_0x4840('0x5d')]+'\x22';if(this[_0x4840('0x87')](_0x9c6fde['options'])){_0x5ebf18+=','+_0x9c6fde[_0x4840('0x7b')];}var _0x428bf9=this['channel'][_0x4840('0x5b')](_0x4840('0xad'),_0x5ebf18);if(_0x428bf9['result']===-0x1){return _0x428bf9;}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xca'),_0x5ebf18));};AGIVertices[_0x4840('0x16')][_0x4840('0xcb')]=function(_0x272d92){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xcc'),_0x272d92[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x272d92[_0x4840('0x5d')])){return this[_0x4840('0x3a')]['noop'](_0x4840('0xac'));}var _0x3de0fe='\x22'+_0x272d92[_0x4840('0x5d')]+'\x22';if(this['isConfigured'](_0x272d92['options'])){_0x3de0fe+=','+_0x272d92[_0x4840('0x7b')];}var _0x37f303=this['channel'][_0x4840('0x5b')](_0x4840('0xad'),_0x3de0fe);if(_0x37f303[_0x4840('0xa5')]===-0x1){return _0x37f303;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3de0fe));};AGIVertices[_0x4840('0x16')][_0x4840('0xcd')]=function(_0x2f3a7){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xce'),_0x2f3a7[_0x4840('0x3c')]));if(!this['isConfigured'](_0x2f3a7['grammar'])){return this['channel'][_0x4840('0xab')]('no\x20grammar\x20configured');}var _0x42b1f0=_0x2f3a7[_0x4840('0xb0')];if(this['isConfigured'](_0x2f3a7[_0x4840('0x7b')])){_0x42b1f0+=','+_0x2f3a7[_0x4840('0x7b')];}var _0x220757=this[_0x4840('0x3a')][_0x4840('0x5b')](_0x4840('0xb1'),_0x42b1f0);if(_0x220757[_0x4840('0xa5')]===-0x1){return _0x220757;}var _0x3c5e67=this[_0x4840('0xa4')](_0x4840('0xb2'),_0x4840('0xcf'));if(_0x3c5e67['result']===-0x1){return _0x3c5e67;}var _0xcdf4b0=this[_0x4840('0xa4')](_0x4840('0xb4'),_0x4840('0xd0'));if(_0xcdf4b0[_0x4840('0xa5')]===-0x1){return _0xcdf4b0;}var _0x386ddd=this['getAndSetVariable'](_0x4840('0xd1'),'LUMENVOX_ASR_INSTANCE');if(_0x386ddd[_0x4840('0xa5')]===-0x1){return _0x386ddd;}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xb7'),_0x42b1f0));};AGIVertices['prototype'][_0x4840('0xd2')]=function(_0x5781e8){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xd3'),_0x5781e8[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x5781e8[_0x4840('0xb0')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xaf'));}var _0x36d911=_0x5781e8[_0x4840('0xb0')];if(this['isConfigured'](_0x5781e8[_0x4840('0x7b')])){_0x36d911+=','+_0x5781e8[_0x4840('0x7b')];}var _0x12280a=this[_0x4840('0x3a')]['exec'](_0x4840('0xb1'),_0x36d911);if(_0x12280a[_0x4840('0xa5')]===-0x1){return _0x12280a;}var _0x19b775=this[_0x4840('0xa4')]('RECOG_CONFIDENCE()',_0x4840('0xd4'));if(_0x19b775[_0x4840('0xa5')]===-0x1){return _0x19b775;}var _0x42fdff=this[_0x4840('0xa4')](_0x4840('0xb4'),_0x4840('0xd5'));if(_0x42fdff[_0x4840('0xa5')]===-0x1){return _0x42fdff;}var _0x1208fc=this[_0x4840('0xa4')](_0x4840('0xd1'),'SESTEK_ASR_INSTANCE');if(_0x1208fc['result']===-0x1){return _0x1208fc;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xb7'),_0x36d911));};AGIVertices[_0x4840('0x16')][_0x4840('0xd6')]=function(_0x141a05){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0xd7'),_0x141a05[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x141a05[_0x4840('0xd8')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x141a05,_0x4840('0xd9'));}var _0x4ab037=this[_0x4840('0x1b')][_0x4840('0x72')](this,_0x141a05[_0x4840('0xd8')]);if(!_0x4ab037){return this[_0x4840('0x3a')]['error'](_0x141a05,_0x4840('0xda'));}if(!this['isConfigured'](_0x141a05[_0x4840('0x32')])){return this['channel'][_0x4840('0x2f')](_0x141a05,_0x4840('0xdb'));}var _0x306425=_0x141a05[_0x4840('0x32')][_0x4840('0xdc')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xdd'),_0x306425));var _0x35fba9=this[_0x4840('0x2d')][_0x4840('0x72')](this,_0x4ab037,_0x306425);this[_0x4840('0x39')][_0x4840('0x72')](this,_0x141a05,_0x306425);if(!this[_0x4840('0x87')](_0x141a05[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xdf'));}var _0x22776f=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x141a05['variable_id']);if(!_0x22776f){return this[_0x4840('0x3a')]['error'](_0x141a05,_0x4840('0xe0'));}var _0x3657b9=this;_0x35fba9[_0x4840('0xe1')](function(_0x2b150e,_0x198733){Object[_0x4840('0xe2')](_0x2b150e)[_0x4840('0xe1')](function(_0x120649){_0x3657b9[_0x4840('0x3a')][_0x4840('0xa6')](util[_0x4840('0x2b')](_0x4840('0xe3'),_0x22776f,_0x198733,_0x120649),_0x2b150e[_0x120649]);});});this[_0x4840('0x3a')][_0x4840('0xa6')](util[_0x4840('0x2b')](_0x4840('0xe4'),_0x22776f),_0x35fba9[_0x4840('0xa1')]);return this['channel'][_0x4840('0xab')](util['format'](_0x4840('0xe5'),_0x22776f));};AGIVertices['prototype'][_0x4840('0xe6')]=function(_0x5bcfd5){logger[_0x4840('0xe7')](util[_0x4840('0x2b')](_0x4840('0xe8'),_0x5bcfd5[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x5bcfd5[_0x4840('0xe9')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x5bcfd5,_0x4840('0xea'));}var _0x3d57d3=this[_0x4840('0x1d')]['sync'](this,_0x5bcfd5[_0x4840('0xe9')]);if(!_0x3d57d3){return this['channel'][_0x4840('0x2f')](_0x5bcfd5,_0x4840('0xeb'));}var _0x420465=this[_0x4840('0x3a')][_0x4840('0x5b')]('DIAL',[util[_0x4840('0x2b')](_0x4840('0xec'),_0x3d57d3),_0x5bcfd5[_0x4840('0x67')],_0x5bcfd5['opts'],_0x5bcfd5['url']]);if(_0x420465['result']===-0x1){return _0x420465;}return this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0xed'),_0x4840('0xee')));};AGIVertices[_0x4840('0x16')][_0x4840('0xef')]=function(_0x57659f){logger['info'](util[_0x4840('0x2b')](_0x4840('0xf0'),_0x57659f['label']));if(!this[_0x4840('0x87')](_0x57659f['key'])){return this['channel'][_0x4840('0xab')](_0x4840('0xf1'));}if(!this[_0x4840('0x87')](_0x57659f[_0x4840('0x5d')])){return this['channel']['noop'](_0x4840('0xac'));}this[_0x4840('0x3a')][_0x4840('0xf2')]=!![];this[_0x4840('0x39')](_0x57659f);this['createSquareMessage'](_0x57659f[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')](_0x4840('0xf3'),_0x57659f[_0x4840('0x5d')]));var _0x3e4d74=this[_0x4840('0x7c')][_0x4840('0x72')](this,_0x57659f);if(_0x3e4d74){for(var _0x327a56 in _0x3e4d74){if(_0x3e4d74['hasOwnProperty'](_0x327a56)){this[_0x4840('0x3a')][_0x4840('0xa6')](util['format'](_0x4840('0xf4'),_0x327a56['toUpperCase']()),_0x3e4d74[_0x327a56]);}}this[_0x4840('0x44')](_0x3e4d74[_0x4840('0xf5')],_0x4840('0xf6'),'dialogflow','');return this['channel'][_0x4840('0xab')](util['format']('Dialogflow\x20Result\x20%s',_0x3e4d74[_0x4840('0xf5')]));}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x57659f,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x4840('0x16')][_0x4840('0xf7')]=function(_0x5c64d6){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5c64d6['label']));if(!this[_0x4840('0x87')](_0x5c64d6[_0x4840('0xf8')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x5c64d6[_0x4840('0x7f')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xf9'));}if(!this['isConfigured'](_0x5c64d6[_0x4840('0xfa')])){return this['channel']['noop'](_0x4840('0xfb'));}if(!this[_0x4840('0x87')](_0x5c64d6['dialogflowV2_language'])){return this[_0x4840('0x3a')]['noop']('no\x20anguage\x20configured');}if(!this[_0x4840('0x87')](_0x5c64d6[_0x4840('0x5d')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}this['channel'][_0x4840('0xf2')]=!![];this[_0x4840('0x39')](_0x5c64d6);this[_0x4840('0x44')](_0x5c64d6[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Trying\x20DialogflowV2:\x20%s',_0x5c64d6['text']));var _0x4b05cd=this[_0x4840('0x7e')][_0x4840('0x72')](this,_0x5c64d6);if(_0x4b05cd){for(var _0x2419d5 in _0x4b05cd){if(_0x4b05cd[_0x4840('0x97')](_0x2419d5)){if(_0x2419d5!==_0x4840('0xfc')){this[_0x4840('0x3a')][_0x4840('0xa6')](util['format'](_0x4840('0xf4'),_0x2419d5[_0x4840('0x6b')]()),_0x4b05cd[_0x2419d5]);}}}this[_0x4840('0x44')](_0x4b05cd['speech'],_0x4840('0xf6'),_0x4840('0xf7'),_0x4b05cd[_0x4840('0xfc')]);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('DialogflowV2\x20Result\x20%s',_0x4b05cd[_0x4840('0xf5')]));}return this[_0x4840('0x3a')]['error'](_0x5c64d6,_0x4840('0xfd'));};AGIVertices[_0x4840('0x16')]['sesteknda']=function(_0x446d63){logger[_0x4840('0x30')](util['format'](_0x4840('0xfe'),_0x446d63[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x446d63[_0x4840('0xff')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x100'));}if(!this[_0x4840('0x87')](_0x446d63[_0x4840('0x101')])){return this['channel'][_0x4840('0xab')]('no\x20username\x20configured');}if(!this[_0x4840('0x87')](_0x446d63[_0x4840('0x102')])){return this[_0x4840('0x3a')]['noop'](_0x4840('0x103'));}if(!this[_0x4840('0x87')](_0x446d63['ndassistant_url'])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}this[_0x4840('0x3a')]['bot']=!![];this['createSquareDetailsReport'](_0x446d63);this[_0x4840('0x44')](_0x446d63[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x104'),_0x446d63['text']));var _0xc3bede=this['sestekNDA'][_0x4840('0x72')](this,_0x446d63);if(_0xc3bede){for(var _0x361109 in _0xc3bede){if(_0xc3bede[_0x4840('0x97')](_0x361109)){this[_0x4840('0x3a')]['setVariable'](util[_0x4840('0x2b')](_0x4840('0x105'),_0x361109['toUpperCase']()),_0xc3bede[_0x361109]);}}this[_0x4840('0x44')](_0xc3bede[_0x4840('0xf5')],_0x4840('0xf6'),'sesteknda','');if(_0xc3bede['audiofile']){this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x106'),_0xc3bede['audiofile']));var _0x57b5c8=this[_0x4840('0x3a')][_0x4840('0x107')](_0xc3bede[_0x4840('0x108')]);try{fs[_0x4840('0x109')](_0xc3bede[_0x4840('0x108')]+'.wav');}catch(_0x4a1298){logger[_0x4840('0x2f')](_0x4a1298);}return _0x57b5c8;}else{return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x10a'),_0xc3bede[_0x4840('0xf5')]));}}return this[_0x4840('0x3a')]['error'](_0x446d63,_0x4840('0x10b'));};AGIVertices['prototype'][_0x4840('0x10c')]=function(_0x440666){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x10d'),_0x440666[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x10c'));};AGIVertices['prototype'][_0x4840('0x10e')]=function(_0x39abc3){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x39abc3['label']));var _0x123e70='';if(_0x39abc3[_0x4840('0x10f')]){if(!this[_0x4840('0x87')](_0x39abc3[_0x4840('0x10f')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x39abc3,_0x4840('0x110'));}else{var _0x499244=parseInt(_0x39abc3[_0x4840('0x10f')],0xa);if(isNaN(_0x499244)){_0x123e70=_0x39abc3['trunk_id'];}else{_0x123e70=this[_0x4840('0x1f')]['sync'](this,_0x39abc3[_0x4840('0x10f')]);if(!_0x123e70){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x39abc3,_0x4840('0x111'));}}}}else if(_0x39abc3[_0x4840('0x112')]){_0x123e70=_0x39abc3[_0x4840('0x112')];}else{return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x39abc3,_0x4840('0x110'));}var _0x4c830f=this['channel'][_0x4840('0x5b')](_0x4840('0xee'),[util[_0x4840('0x2b')](_0x4840('0x113'),_0x123e70,_0x39abc3['phone']),_0x39abc3['timeout'],_0x39abc3[_0x4840('0x114')],_0x39abc3[_0x4840('0x64')]]);if(_0x4c830f[_0x4840('0xa5')]===-0x1){return _0x4c830f;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xed'),_0x4840('0xee')));};AGIVertices[_0x4840('0x16')][_0x4840('0x115')]=function(_0x4bb889){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4bb889['label']));return this['channel']['noop'](_0x4840('0x115'));};AGIVertices[_0x4840('0x16')]['getdigits']=function(_0x2a94a4){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x116'),_0x2a94a4[_0x4840('0x3c')]));if(_0x2a94a4[_0x4840('0xa8')]===0x0){return this[_0x4840('0xa7')](_0x2a94a4);}_0x2a94a4[_0x4840('0xa8')]-=0x1;if(!this[_0x4840('0x87')](_0x2a94a4[_0x4840('0x117')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x2a94a4,_0x4840('0x118'));}var _0x446e3e=this[_0x4840('0x21')]['sync'](this,_0x2a94a4[_0x4840('0x117')]);if(!_0x446e3e){return this['channel']['error'](_0x2a94a4,_0x4840('0x119'));}if(!this[_0x4840('0x87')](_0x2a94a4[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4840('0xdf'));}var _0x4aa0e6=this[_0x4840('0x3a')][_0x4840('0x11a')](_0x446e3e,_0x2a94a4[_0x4840('0x11b')],_0x2a94a4[_0x4840('0x11c')]);var _0x238bf7=_0x4aa0e6[_0x4840('0xa5')]?_0x4aa0e6[_0x4840('0xa5')][_0x4840('0x4f')]():'';logger[_0x4840('0x30')](_0x4840('0x11d'),JSON['stringify'](_0x4aa0e6));if(_0x4aa0e6['result']===-0x1){this[_0x4840('0x39')]['sync'](this,_0x2a94a4,_0x238bf7);return _0x4aa0e6;}else if(_0x4aa0e6['extra']==='timeout'){_0x4aa0e6[_0x4840('0xa5')]=_0x238bf7[_0x4840('0xa1')]>=parseInt(_0x2a94a4[_0x4840('0x11e')])?'x':'i';}else{_0x4aa0e6[_0x4840('0xa5')]=_0x238bf7[_0x4840('0xa1')]>=parseInt(_0x2a94a4[_0x4840('0x11e')])&&_0x238bf7['length']<=parseInt(_0x2a94a4['maxdigit'])?'x':'i';}var _0x240520=this[_0x4840('0x12')]['sync'](this,_0x2a94a4[_0x4840('0xde')]);if(!_0x240520){return this[_0x4840('0x3a')]['error'](_0x2a94a4,_0x4840('0xe0'));}this[_0x4840('0x3a')][_0x4840('0xa6')](_0x240520,_0x238bf7);if(this[_0x4840('0x87')](_0x2a94a4[_0x4840('0x11f')])){var _0x482be2=parseInt(_0x2a94a4[_0x4840('0x11f')],0xa);var _0x6d2c4c=rs[_0x4840('0x120')]({'charset':'*','length':_0x482be2});var _0x1273a5=_0x238bf7[_0x4840('0xa1')];if(_0x1273a5>0x0){if(_0x1273a5>_0x482be2){this[_0x4840('0x39')][_0x4840('0x72')](this,_0x2a94a4,_0x2a94a4[_0x4840('0x121')]===_0x4840('0x122')?_0x6d2c4c+_0x238bf7[_0x4840('0x123')](_0x482be2):_0x238bf7['substr'](0x0,_0x1273a5-_0x482be2)+_0x6d2c4c);}else{this[_0x4840('0x39')][_0x4840('0x72')](this,_0x2a94a4,rs[_0x4840('0x120')]({'charset':'*','length':_0x1273a5}));}}else{this[_0x4840('0x39')][_0x4840('0x72')](this,_0x2a94a4,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x2a94a4,_0x238bf7);}return _0x4aa0e6;};AGIVertices[_0x4840('0x16')][_0x4840('0xf')]=function(_0x540bd1){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x124'),_0x540bd1['label']));return this[_0x4840('0xe')](_0x540bd1);};AGIVertices['prototype']['goal']=function(_0x298961){logger[_0x4840('0x30')](util['format'](_0x4840('0x125'),_0x298961[_0x4840('0x3c')]));this[_0x4840('0x39')][_0x4840('0x72')](this,_0x298961,_0x298961['goalname']);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x126'),_0x298961['goalname']));};AGIVertices[_0x4840('0x16')][_0x4840('0x127')]=function(_0x588ce5){logger['info'](util[_0x4840('0x2b')](_0x4840('0x128'),_0x588ce5[_0x4840('0x3c')]));if(!this['isConfigured'](_0x588ce5[_0x4840('0x8a')])||!this[_0x4840('0x87')](_0x588ce5[_0x4840('0x8b')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x129'));}if(!this[_0x4840('0x87')](_0x588ce5[_0x4840('0x5d')])){return this['channel']['noop'](_0x4840('0xac'));}this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0x12a'),_0x588ce5[_0x4840('0x5d')]));var _0x31eb20=this['awsPolly']['sync'](this,_0x588ce5);if(_0x31eb20){this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x31eb20));var _0x35b673=this[_0x4840('0x3a')][_0x4840('0x107')](_0x31eb20);try{fs[_0x4840('0x109')](_0x31eb20+_0x4840('0x12b'));}catch(_0x21e7a3){logger['error'](_0x21e7a3);}return _0x35b673;}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x588ce5,_0x4840('0x12c'));};AGIVertices['prototype'][_0x4840('0x12d')]=function(_0x2a335a){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x12e'),_0x2a335a[_0x4840('0x3c')]));if(!this['isConfigured'](_0x2a335a[_0x4840('0x8a')])||!this[_0x4840('0x87')](_0x2a335a[_0x4840('0x8b')])){return this['channel'][_0x4840('0xab')](_0x4840('0x129'));}if(!this[_0x4840('0x87')](_0x2a335a[_0x4840('0x8f')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x12f'));}if(!this['isConfigured'](_0x2a335a['text'])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20text\x20configured');}this[_0x4840('0x3a')]['bot']=!![];this[_0x4840('0x39')](_0x2a335a);this[_0x4840('0x44')](_0x2a335a[_0x4840('0x5d')],'in','','');this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x130'),_0x2a335a[_0x4840('0x5d')]));var _0x2a694d=this[_0x4840('0x131')]['sync'](this,_0x2a335a);if(_0x2a694d){for(var _0x2c6ee0 in _0x2a694d){if(_0x2a694d[_0x4840('0x97')](_0x2c6ee0)&&_[_0x4840('0x9d')](_0x2a694d[_0x2c6ee0])){this['channel']['setVariable'](util['format'](_0x4840('0x132'),_0x2c6ee0[_0x4840('0x6b')]()),_0x2a694d[_0x2c6ee0]);}}if(_['isNil'](_0x2a694d[_0x4840('0x133')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x134'));}else{this[_0x4840('0x44')](_0x2a694d[_0x4840('0x133')],'out',_0x4840('0x135'),'');return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x136'),_0x2a694d['message']));}}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x2a335a,_0x4840('0x137'));};AGIVertices[_0x4840('0x16')][_0x4840('0x138')]=function(_0x5cb226){logger['info'](util[_0x4840('0x2b')](_0x4840('0x139'),_0x5cb226[_0x4840('0x3c')],_0x5cb226[_0x4840('0x67')]));if(!this[_0x4840('0x87')](_0x5cb226[_0x4840('0x7d')])){return this['channel'][_0x4840('0xab')](_0x4840('0xf1'));}var _0x42075c=_0x4840('0x13a');var _0x4d79c7=util[_0x4840('0x2b')](_0x4840('0x13b'),FILES_PATH,rs['generate'](0x4));var _0x1d4fd2=util[_0x4840('0x2b')](_0x4840('0x9f'),_0x4d79c7,_0x42075c);var _0x4f212e=!![];if(_0x5cb226['beep']===_0x4840('0x13c')){_0x4f212e=![];}var _0x4bc96a=this[_0x4840('0x3a')][_0x4840('0x13d')](_0x4d79c7,_0x42075c,_0x5cb226[_0x4840('0x13e')],_0x5cb226[_0x4840('0x67')],undefined,_0x4f212e);if(_0x4bc96a[_0x4840('0xa5')]!==-0x1){this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('google\x20%s\x20file\x20created',_0x1d4fd2));var _0xc0abf4=this[_0x4840('0x90')][_0x4840('0x72')](this,_0x5cb226,_0x1d4fd2);if(_0xc0abf4){for(var _0x28bd23 in _0xc0abf4){if(_0xc0abf4[_0x4840('0x97')](_0x28bd23)){this[_0x4840('0x3a')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x28bd23['toUpperCase']()),_0xc0abf4[_0x28bd23]);}}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x13f'),JSON['stringify'](_0xc0abf4)));}}return _0x4bc96a;};AGIVertices[_0x4840('0x16')][_0x4840('0x140')]=function(_0x266e1c){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x141'),_0x266e1c['label']));if(!this['isConfigured'](_0x266e1c[_0x4840('0x142')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20appid\x20configured');}if(!this[_0x4840('0x87')](_0x266e1c['appsecret'])){return this[_0x4840('0x3a')]['noop']('no\x20appsecret\x20configured');}var _0xf2759c=_0x4840('0x13a');var _0x4bfda7=util[_0x4840('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1175ab=util['format'](_0x4840('0x9f'),_0x4bfda7,_0xf2759c);var _0x32416c=!![];if(_0x266e1c[_0x4840('0x143')]==='NOBEEP'){_0x32416c=![];}var _0x118578=this[_0x4840('0x3a')]['recordFile'](_0x4bfda7,_0xf2759c,_0x266e1c['intKey'],_0x266e1c[_0x4840('0x67')],undefined,_0x32416c);if(_0x118578[_0x4840('0xa5')]!==-0x1){this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('tilde\x20%s\x20file\x20created',_0x1175ab));var _0x506ba7=this['tildeASR'][_0x4840('0x72')](this,_0x266e1c,_0x1175ab);if(_0x506ba7){for(var _0x516114 in _0x506ba7){if(_0x506ba7['hasOwnProperty'](_0x516114)){this[_0x4840('0x3a')][_0x4840('0xa6')](util['format'](_0x4840('0x144'),_0x516114['toUpperCase']()),_0x506ba7[_0x516114]);}}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x145'),JSON[_0x4840('0x75')](_0x506ba7)));}}return _0x118578;};AGIVertices[_0x4840('0x16')][_0x4840('0x146')]=function(_0x4addd1){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4addd1[_0x4840('0x3c')]));return this[_0x4840('0x3a')]['continueAt'](_0x4addd1[_0x4840('0x147')],_0x4addd1[_0x4840('0x148')],_0x4addd1['priority']);};AGIVertices['prototype'][_0x4840('0x149')]=function(_0x58b5f2){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x14a'),_0x58b5f2[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x58b5f2['condition'])){return this['channel'][_0x4840('0x2f')](_0x58b5f2,'no\x20condition\x20configured');}try{var _0x3ff087=eval(_0x58b5f2[_0x4840('0x14b')])?'true':'false';this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')](_0x4840('0x14c'),_0x58b5f2[_0x4840('0x14b')],_0x3ff087));return{'code':0xc8,'result':_0x3ff087};}catch(_0x23cbe6){return{'code':0xc8,'result':_0x4840('0x14d')};}};AGIVertices[_0x4840('0x16')][_0x4840('0x14e')]=function(_0x583f01){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x14f'),_0x583f01[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x583f01[_0x4840('0x150')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x583f01,_0x4840('0x151'));}var _0x2547e8=this[_0x4840('0x26')][_0x4840('0x72')](this,_0x583f01[_0x4840('0x150')]);if(!_0x2547e8){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x583f01,_0x4840('0x152'));}for(var _0x39c64e=0x0;_0x39c64e<_0x2547e8[_0x4840('0xa1')];_0x39c64e+=0x1){var _0x167f10=this['channel'][_0x4840('0x12')](util['format'](_0x4840('0x153'),_0x2547e8[_0x39c64e]));if(_0x167f10[_0x4840('0xa5')]===-0x1){return _0x167f10;}logger['info'](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],_0x167f10['extra']));if(_0x167f10[_0x4840('0xa3')]===_0x4840('0x155')){logger[_0x4840('0x30')](util['format'](_0x4840('0x154'),_0x2547e8[_0x39c64e],_0x4840('0x155')));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],'true'));return{'code':0xc8,'result':_0x4840('0x155')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],'false'));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x154'),_0x2547e8[_0x39c64e],_0x4840('0x14d')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x4840('0x16')]['hangup']=function(_0x295fec){logger[_0x4840('0x30')](util['format'](_0x4840('0x156'),_0x295fec[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x157')]();};AGIVertices[_0x4840('0x16')][_0x4840('0x158')]=function(_0x73f8bd){logger[_0x4840('0x30')](util['format'](_0x4840('0x159'),_0x73f8bd['label']));if(!this['isConfigured'](_0x73f8bd['key'])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xf1'));}var _0x583868='wav';var _0x2150e0=util[_0x4840('0x2b')](_0x4840('0x13b'),FILES_PATH,rs[_0x4840('0x120')](0x4));var _0x4cd369=util[_0x4840('0x2b')](_0x4840('0x9f'),_0x2150e0,_0x583868);var _0x5de4f9=!![];if(_0x73f8bd[_0x4840('0x143')]===_0x4840('0x13c')){_0x5de4f9=![];}var _0x2d8f04=this[_0x4840('0x3a')][_0x4840('0x13d')](_0x2150e0,_0x583868,_0x73f8bd['intKey'],_0x73f8bd[_0x4840('0x67')],undefined,_0x5de4f9);if(_0x2d8f04[_0x4840('0xa5')]!==-0x1){this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')]('ispeech\x20%s\x20file\x20created',_0x4cd369));var _0x2ffd7c=this[_0x4840('0x85')][_0x4840('0x72')](this,_0x73f8bd,_0x4cd369);if(_0x2ffd7c){for(var _0x401ca6 in _0x2ffd7c){if(_0x2ffd7c[_0x4840('0x97')](_0x401ca6)){this['channel']['setVariable'](util[_0x4840('0x2b')](_0x4840('0x15a'),_0x401ca6['toUpperCase']()),_0x2ffd7c[_0x401ca6]);}}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x4840('0x75')](_0x2ffd7c)));}}return _0x2d8f04;};AGIVertices[_0x4840('0x16')][_0x4840('0x15b')]=function(_0x3ee569){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3ee569[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x3ee569[_0x4840('0x7d')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xf1'));}if(!this[_0x4840('0x87')](_0x3ee569[_0x4840('0x5d')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0xac'));}this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x15c'),_0x3ee569[_0x4840('0x5d')]));var _0x273263=this[_0x4840('0x82')]['sync'](this,_0x3ee569);if(_0x273263){this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('ispeech\x20%s\x20file\x20created',_0x273263));var _0xa6beb2=this[_0x4840('0x3a')][_0x4840('0x107')](_0x273263,_0x3ee569[_0x4840('0x13e')]);try{fs['unlink'](_0x273263+_0x4840('0x12b'));}catch(_0x38de57){logger[_0x4840('0x2f')](_0x38de57);}return _0xa6beb2;}return this['channel'][_0x4840('0x2f')](_0x3ee569,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x4840('0x15d')]=function(_0x405c52){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x405c52['label']));if(!this[_0x4840('0x87')](_0x405c52[_0x4840('0x15e')])){return this[_0x4840('0x3a')]['error'](_0x405c52,_0x4840('0x15f'));}logger[_0x4840('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52[_0x4840('0x15e')]));var _0x5f0000=this[_0x4840('0x59')][_0x4840('0x72')](this,_0x405c52[_0x4840('0x15e')]);if(_0x5f0000){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52['findBy']));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x162'),this['channel'][_0x4840('0x3e')],_0x405c52[_0x4840('0x15e')]));this['channel'][_0x4840('0xab')](util['format'](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x405c52['findBy']));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices[_0x4840('0x16')]['logout']=function(_0x2805c5){logger['info'](util[_0x4840('0x2b')](_0x4840('0x164'),_0x2805c5[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x2805c5[_0x4840('0x15e')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x2805c5,_0x4840('0x15f'));}logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x165'),this['channel'][_0x4840('0x3e')],_0x2805c5['findBy']));var _0x506381=this[_0x4840('0x55')][_0x4840('0x72')](this,_0x2805c5[_0x4840('0x15e')]);if(_0x506381){logger[_0x4840('0x30')](util['format'](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5['findBy']));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger['info'](util[_0x4840('0x2b')](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5[_0x4840('0x15e')]));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0x2805c5[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices[_0x4840('0x16')][_0x4840('0x166')]=function(_0xaff497){logger[_0x4840('0x30')](util['format'](_0x4840('0x167'),_0xaff497[_0x4840('0x3c')]));if(!this['isConfigured'](_0xaff497[_0x4840('0x168')])){return this[_0x4840('0x3a')]['error'](_0xaff497,_0x4840('0x169'));}this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('math\x20%s',_0xaff497[_0x4840('0x168')]));var _0x2bd216=eval(_0xaff497[_0x4840('0x168')]);if(!this[_0x4840('0x87')](_0xaff497[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x574528=this[_0x4840('0x12')][_0x4840('0x72')](this,_0xaff497['variable_id']);if(!_0x574528){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0xaff497,_0x4840('0xe0'));}if(_[_0x4840('0x9c')](_0x2bd216)){var _0x144604=this;_0x2bd216[_0x4840('0xe1')](function(_0x4db36f,_0x5782fd){_0x144604['channel']['setVariable'](util[_0x4840('0x2b')]('%s[%s]',_0x574528,_0x5782fd),_0x4db36f);});return this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0x16a'),_0x574528));}else{return this[_0x4840('0x3a')]['setVariable'](_0x574528,_0x2bd216);}};AGIVertices[_0x4840('0x16')][_0x4840('0xd')]=function(_0x4a20e9){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4a20e9[_0x4840('0x3c')]));if(_0x4a20e9[_0x4840('0xa8')]===0x0){return this[_0x4840('0xa7')](_0x4a20e9);}_0x4a20e9['retry']-=0x1;if(!this['isConfigured'](_0x4a20e9['file_id'])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4a20e9,_0x4840('0x118'));}var _0x3d3395=this[_0x4840('0x21')][_0x4840('0x72')](this,_0x4a20e9[_0x4840('0x117')]);if(!_0x3d3395){return this['channel'][_0x4840('0x2f')](_0x4a20e9,_0x4840('0x119'));}var _0x378b5b=this[_0x4840('0x3a')][_0x4840('0x11a')](_0x3d3395,_0x4a20e9[_0x4840('0x11b')],_0x4a20e9[_0x4840('0x16b')]);var _0x214ea3=_0x378b5b[_0x4840('0xa5')];if(_0x378b5b[_0x4840('0xa5')]===-0x1){this[_0x4840('0x39')][_0x4840('0x72')](this,_0x4a20e9,'-1');return _0x378b5b;}else if(_0x378b5b['extra']===_0x4840('0x67')){_0x378b5b[_0x4840('0xa5')]=_0x378b5b['result'][_0x4840('0xa1')]>0x0?_0x378b5b[_0x4840('0xa5')]:'t';}else if(_[_0x4840('0x45')](_0x378b5b[_0x4840('0xa5')])){_0x378b5b['result']='#';_0x214ea3='#';}if(!this[_0x4840('0x87')](_0x4a20e9[_0x4840('0xde')])){this['channel']['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3e3f9f=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x4a20e9[_0x4840('0xde')]);if(!_0x3e3f9f){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4a20e9,_0x4840('0xe0'));}this[_0x4840('0x3a')][_0x4840('0xa6')](_0x3e3f9f,_0x214ea3);}this[_0x4840('0x39')][_0x4840('0x72')](this,_0x4a20e9,_0x214ea3);return _0x378b5b;};AGIVertices[_0x4840('0x16')][_0x4840('0xab')]=function(_0x446de0){logger['info'](util[_0x4840('0x2b')](_0x4840('0x16c'),_0x446de0[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0xab')](_0x446de0[_0x4840('0x16d')]||_0x446de0['label']);};AGIVertices[_0x4840('0x16')][_0x4840('0x16e')]=function(_0xb7e563){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x16f'),_0xb7e563[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0xb7e563[_0x4840('0x15e')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0xb7e563,'no\x20find\x20by\x20configured');}logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x165'),this[_0x4840('0x3a')]['callerid'],_0xb7e563[_0x4840('0x15e')]));var _0x3d440c=this[_0x4840('0x50')][_0x4840('0x72')](this,_0xb7e563[_0x4840('0x170')]);var _0x59460a=this[_0x4840('0x53')][_0x4840('0x72')](this,_0xb7e563[_0x4840('0x15e')],_0x3d440c);if(_0x59460a){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xb7e563[_0x4840('0x15e')]));this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4840('0x3e')],_0xb7e563['findBy']));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x162'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xb7e563['findBy']));this[_0x4840('0x3a')]['noop'](util['format'](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xb7e563['findBy']));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices['prototype'][_0x4840('0x171')]=function(_0x12ff22){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x12ff22['label']));if(!this[_0x4840('0x87')](_0x12ff22[_0x4840('0x117')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x12ff22,_0x4840('0x118'));}var _0x4f1189=this['getSound'][_0x4840('0x72')](this,_0x12ff22[_0x4840('0x117')]);if(!_0x4f1189){return this['channel'][_0x4840('0x2f')](_0x12ff22,_0x4840('0x119'));}var _0x3c5eda=this[_0x4840('0x3a')]['exec'](_0x4840('0x172'),[_0x4f1189,_0x12ff22['opts']]);if(_0x3c5eda[_0x4840('0xa5')]===-0x1){return _0x3c5eda;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')]('Executed\x20command\x20%s\x20%s',_0x4840('0x172'),_0x4f1189));};AGIVertices[_0x4840('0x16')][_0x4840('0x173')]=function(_0x167636){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x167636[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x167636[_0x4840('0x174')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x167636,'no\x20queue\x20selected');}var _0x2eb9e7='';var _0x6ce4a5=parseInt(_0x167636[_0x4840('0x174')],0xa);if(isNaN(_0x6ce4a5)){_0x2eb9e7=_0x167636[_0x4840('0x174')];}else{_0x2eb9e7=this['getVoiceQueue'][_0x4840('0x72')](this,_0x167636[_0x4840('0x174')]);if(!_0x2eb9e7){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x167636,_0x4840('0x175'));}}var _0x6e4720='';if(this['isConfigured'](_0x167636[_0x4840('0x117')])){var _0x2246c5=this[_0x4840('0x21')][_0x4840('0x72')](this,_0x167636['file_id']);if(_0x2246c5){_0x6e4720=_0x2246c5;}}this[_0x4840('0x39')][_0x4840('0x72')](this,_0x167636,_0x2eb9e7);if(_0x167636['opts'][_0x4840('0x176')]('x')<0x0){_0x167636[_0x4840('0x114')]+='x';}if(_0x167636['opts']['indexOf']('X')<0x0){_0x167636[_0x4840('0x114')]+='X';}this['channel'][_0x4840('0xa6')](_0x4840('0x177'),_0x2eb9e7?_0x2eb9e7[_0x4840('0x178')]():'');var _0x1095c6=this[_0x4840('0x3a')][_0x4840('0x5b')]('QUEUE',[_0x2eb9e7,_0x167636['opts'],_0x167636[_0x4840('0x64')],_0x6e4720,_0x167636[_0x4840('0x67')],_0x167636[_0x4840('0x9')],_0x167636['macro'],_0x167636[_0x4840('0x179')],'',_0x167636[_0x4840('0x17a')]]);if(_0x1095c6[_0x4840('0xa5')]===-0x1){return _0x1095c6;}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xc7'),_0x4840('0x17b'),_0x2eb9e7));};AGIVertices[_0x4840('0x16')][_0x4840('0x17c')]=function(_0x27898f){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x17d'),_0x27898f[_0x4840('0x3c')]));var _0x57b637=_0x27898f[_0x4840('0x17e')]||_0x4840('0x13a');var _0x41b7b2=util[_0x4840('0x2b')](_0x4840('0x17f'),this['channel']['uniqueid'],rs[_0x4840('0x120')](0x5));var _0x727207=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x41b7b2,_0x57b637);var _0x5e2d0b=util[_0x4840('0x2b')](_0x4840('0x13b'),FILES_PATH,_0x41b7b2);this[_0x4840('0x3f')][_0x4840('0x72')](this,_0x27898f,_0x41b7b2,_0x727207);this[_0x4840('0x3a')][_0x4840('0xa6')](_0x4840('0x180'),_0x41b7b2);logger['info'](_0x4840('0x181'),_0x5e2d0b,_0x57b637,_0x27898f['escape_digits'],_0x27898f['timeout']);return this[_0x4840('0x3a')][_0x4840('0x13d')](_0x5e2d0b,_0x57b637,_0x27898f[_0x4840('0x182')],_0x27898f['timeout'],undefined,!![]);};AGIVertices[_0x4840('0x16')]['restapi']=function(_0x4e4cf6){logger[_0x4840('0x30')](util['format'](_0x4840('0x183'),_0x4e4cf6['label']));if(!this[_0x4840('0x87')](_0x4e4cf6[_0x4840('0x64')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x184'));}var _0x4541bb=this['restAPI'][_0x4840('0x72')](this,_0x4e4cf6);logger['info'](util[_0x4840('0x2b')]('Response:',util['inspect'](_0x4541bb,{'showHidden':![],'depth':null})));if(!this[_0x4840('0x87')](_0x4e4cf6['variable_id'])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x424c21=this['getVariable'][_0x4840('0x72')](this,_0x4e4cf6[_0x4840('0xde')]);if(!_0x424c21){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4e4cf6,_0x4840('0xe0'));}this['channel']['setVariable'](util[_0x4840('0x2b')](_0x4840('0x185'),_0x424c21),_0x4541bb['statusCode']?_0x4541bb[_0x4840('0x78')]:_0x4840('0x186'));this[_0x4840('0x3a')]['setVariable'](util['format'](_0x4840('0x187'),_0x424c21),_0x4541bb[_0x4840('0x79')]?_0x4541bb[_0x4840('0x79')]:'OK');if(_0x4541bb[_0x4840('0x76')]){try{this[_0x4840('0x9e')](_0x4541bb[_0x4840('0x76')],_0x424c21);}catch(_0x1ada87){logger[_0x4840('0x2f')](util[_0x4840('0x2b')](_0x4840('0x188'),_0x424c21));}}return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0xe5'),_0x424c21));};AGIVertices[_0x4840('0x16')][_0x4840('0x189')]=function(_0x51f79d){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x51f79d[_0x4840('0x3c')]));return this[_0x4840('0x3a')]['sayDigits'](_0x51f79d[_0x4840('0x18a')]['replace'](/\s+/g,''),_0x51f79d[_0x4840('0x182')]);};AGIVertices[_0x4840('0x16')][_0x4840('0x18b')]=function(_0x4eb432){logger['info'](util[_0x4840('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4eb432[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x18c')](_0x4eb432[_0x4840('0x66')][_0x4840('0xdc')](/\s+/g,''),_0x4eb432[_0x4840('0x182')]);};AGIVertices[_0x4840('0x16')][_0x4840('0x18d')]=function(_0x18301b){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x18e'),_0x18301b[_0x4840('0x3c')]));return this[_0x4840('0x3a')][_0x4840('0x18f')](_0x18301b[_0x4840('0x5d')],_0x18301b[_0x4840('0x182')]);};AGIVertices[_0x4840('0x16')][_0x4840('0x190')]=function(_0x3e57cc){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x191'),_0x3e57cc[_0x4840('0x3c')]));if(!this['isConfigured'](_0x3e57cc[_0x4840('0x192')])){return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x193'));}var _0x1c43c6=this['getMailAccount']['sync'](this,_0x3e57cc[_0x4840('0x192')]);if(!_0x1c43c6||!_0x1c43c6['Smtp']){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x3e57cc,_0x4840('0x194'));}var _0x52480e={'from':util[_0x4840('0x2b')](_0x4840('0x195'),_0x1c43c6[_0x4840('0x14')],_0x1c43c6['email']||_0x1c43c6[_0x4840('0x196')][_0x4840('0x197')]),'to':_0x3e57cc['to']||'','cc':_0x3e57cc['cc']||'','bcc':_0x3e57cc[_0x4840('0x198')]||'','subject':_0x3e57cc[_0x4840('0x199')],'html':_0x3e57cc[_0x4840('0x5d')],'text':_0x3e57cc[_0x4840('0x5d')]};var _0x483ba9={'tls':{'rejectUnauthorized':![]}};if(_0x1c43c6[_0x4840('0x196')][_0x4840('0x19a')]){_0x483ba9['service']=_0x1c43c6[_0x4840('0x196')][_0x4840('0x19a')];}else{_0x483ba9['host']=_0x1c43c6[_0x4840('0x196')]['host'];_0x483ba9['port']=_0x1c43c6[_0x4840('0x196')]['port'];_0x483ba9[_0x4840('0x19b')]=_0x1c43c6['Smtp'][_0x4840('0x19b')];}if(_0x1c43c6[_0x4840('0x196')][_0x4840('0x19c')]){_0x483ba9[_0x4840('0x19d')]={'user':_0x1c43c6['Smtp'][_0x4840('0x197')],'pass':_0x1c43c6['Smtp']['pass']};}if(this[_0x4840('0x87')](_0x3e57cc[_0x4840('0x19e')])){}logger[_0x4840('0xe7')](_0x4840('0x19f'),JSON[_0x4840('0x75')](_0x52480e));this[_0x4840('0x39')][_0x4840('0x72')](this,_0x3e57cc,_0x3e57cc[_0x4840('0x192')]);this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1a0'),_0x1c43c6[_0x4840('0x14')]));this[_0x4840('0x25')]['sync'](this,_0x483ba9,_0x52480e);return this[_0x4840('0x3a')]['noop'](_0x4840('0x1a1'));};AGIVertices[_0x4840('0x16')][_0x4840('0x1a2')]=function(_0x5866a4){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1a3'),_0x5866a4[_0x4840('0x3c')]));return this[_0x4840('0x3a')]['noop'](_0x4840('0x1a4'));};AGIVertices[_0x4840('0x16')]['sendSMS']=function(_0x4cccd0){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4cccd0['label']));if(!this[_0x4840('0x87')](_0x4cccd0[_0x4840('0x1a5')])){return this[_0x4840('0x3a')][_0x4840('0xab')]('no\x20sms\x20account\x20configured');}var _0xc8ec17=this[_0x4840('0x36')][_0x4840('0x72')](this,_0x4cccd0['sms_account_id']);if(!_0xc8ec17){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x4cccd0,_0x4840('0x1a6'));}var _0x384f73={'body':_0x4cccd0[_0x4840('0x1a7')],'phone':_0x4cccd0['to']||'','SmsAccountId':_0xc8ec17['id']};logger['debug'](_0x4840('0x1a8'),JSON['stringify'](_0x384f73));this[_0x4840('0x39')][_0x4840('0x72')](this,_0x4cccd0,_0x4cccd0['sms_account_id']);this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1a9'),_0xc8ec17[_0x4840('0x14')]));this[_0x4840('0x38')][_0x4840('0x72')](this,_0x384f73);return this[_0x4840('0x3a')][_0x4840('0xab')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x1275b4){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1aa'),_0x1275b4['label']));if(!this[_0x4840('0x87')](_0x1275b4[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x1275b4,'no\x20variable\x20selected');}var _0x26bee0=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x1275b4[_0x4840('0xde')]);if(!_0x26bee0){return this[_0x4840('0x3a')]['error'](_0x1275b4,_0x4840('0xe0'));}return this[_0x4840('0x3a')][_0x4840('0xa6')](_0x26bee0,_0x1275b4[_0x4840('0x1ab')]);};AGIVertices[_0x4840('0x16')]['start']=function(_0x7f10bf){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1ac'),_0x7f10bf['label']));this['channel']['noop'](_0x4840('0x1ad'));if(_0x7f10bf[_0x4840('0xba')]===_0x4840('0x1ae')){this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x1af'));return this['channel']['answer']();}return this[_0x4840('0x3a')][_0x4840('0xab')](_0x4840('0x1b0'));};AGIVertices[_0x4840('0x16')]['subproject']=function(_0x217c8e){logger[_0x4840('0x30')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x217c8e[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x217c8e[_0x4840('0x1b1')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x217c8e,_0x4840('0x1b2'));}var _0x561a80=this[_0x4840('0x19')][_0x4840('0x72')](this,_0x217c8e[_0x4840('0x1b1')]);if(!this[_0x4840('0x87')](_0x561a80)){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x217c8e,util[_0x4840('0x2b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x217c8e[_0x4840('0x1b1')]));}if(_0x561a80===this[_0x4840('0x3a')][_0x4840('0x3d')]){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x217c8e,_0x4840('0x1b3'));}this['createSquareDetailsReport'][_0x4840('0x72')](this,_0x217c8e,_0x561a80);var _0x4e487c=this[_0x4840('0x3a')][_0x4840('0x5b')]('AGI',util[_0x4840('0x2b')](_0x4840('0x1b4'),config['agi'][_0x4840('0x1b5')]||_0x4840('0x1b6'),_0x561a80,this['channel']['arg_1']));if(_0x4e487c[_0x4840('0xa5')]===-0x1){return _0x4e487c;}return this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')](_0x4840('0xc7'),_0x4840('0x1b7'),_0x561a80));};AGIVertices[_0x4840('0x16')]['system']=function(_0x1f0369){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1b8'),_0x1f0369[_0x4840('0x3c')]));var _0x840799=this[_0x4840('0x5a')][_0x4840('0x72')](this,_0x1f0369[_0x4840('0xb8')]);this[_0x4840('0x39')][_0x4840('0x72')](this,_0x1f0369,_0x1f0369[_0x4840('0xb8')]);if(this[_0x4840('0x87')](_0x1f0369[_0x4840('0xde')])){var _0x1b768f=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x1f0369[_0x4840('0xde')]);if(_0x1b768f){this[_0x4840('0x3a')][_0x4840('0xa6')](_0x1b768f,_0x840799);return this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1b9'),_0x1f0369[_0x4840('0xb8')],_0x1b768f));}}return this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1ba'),_0x1f0369[_0x4840('0xb8')]));};AGIVertices[_0x4840('0x16')]['google_cloud_tts']=function(_0x43b61d){logger[_0x4840('0x30')](util[_0x4840('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x43b61d['label']));_0x43b61d['text']=_0x43b61d[_0x4840('0x5d')][_0x4840('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4840('0x87')](_0x43b61d[_0x4840('0x1bb')])){return this['channel'][_0x4840('0xab')](_0x4840('0x1bc'));}if(!this[_0x4840('0x87')](_0x43b61d[_0x4840('0x5d')])){return this['channel'][_0x4840('0xab')](_0x4840('0xac'));}this['channel'][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x1bd'),_0x43b61d[_0x4840('0x5d')]));var _0x1138f9=this['googleCloudTTS'][_0x4840('0x72')](this,_0x43b61d);if(_0x1138f9){this[_0x4840('0x3a')]['noop'](util[_0x4840('0x2b')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x1138f9));var _0x56c677=this['channel'][_0x4840('0x107')](_0x1138f9);try{fs[_0x4840('0x109')](_0x1138f9+_0x4840('0x12b'));}catch(_0x332cd8){logger[_0x4840('0x2f')](_0x332cd8);}return _0x56c677;}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x43b61d,_0x4840('0x1be'));};AGIVertices[_0x4840('0x16')][_0x4840('0x1bf')]=function(_0x23ded5){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c0'),_0x23ded5[_0x4840('0x3c')]));_0x23ded5[_0x4840('0x5d')]=_0x23ded5[_0x4840('0x5d')][_0x4840('0xdc')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4840('0x87')](_0x23ded5[_0x4840('0x5d')])){return this['channel'][_0x4840('0xab')]('no\x20text\x20configured');}this[_0x4840('0x3a')][_0x4840('0xab')](util['format'](_0x4840('0x1c1'),_0x23ded5[_0x4840('0x5d')]));var _0x2d95a4=this['googleTTS'][_0x4840('0x72')](this,_0x23ded5);if(_0x2d95a4){this[_0x4840('0x3a')][_0x4840('0xab')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x2d95a4));var _0xbcf7b3=this[_0x4840('0x3a')][_0x4840('0x107')](_0x2d95a4);try{fs['unlink'](_0x2d95a4+_0x4840('0x12b'));}catch(_0x353299){logger[_0x4840('0x2f')](_0x353299);}return _0xbcf7b3;}return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x23ded5,_0x4840('0x1c2'));};AGIVertices['prototype']['unpause']=function(_0xf3a055){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c3'),_0xf3a055['label']));if(!this[_0x4840('0x87')](_0xf3a055[_0x4840('0x15e')])){return this['channel'][_0x4840('0x2f')](_0xf3a055,'no\x20find\x20by\x20configured');}logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x165'),this['channel'][_0x4840('0x3e')],_0xf3a055[_0x4840('0x15e')]));var _0x481a5f=this['agentUnpause'][_0x4840('0x72')](this,_0xf3a055['findBy']);if(_0x481a5f){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xf3a055['findBy']));this[_0x4840('0x3a')][_0x4840('0xab')](util[_0x4840('0x2b')](_0x4840('0x160'),this[_0x4840('0x3a')][_0x4840('0x3e')],_0xf3a055[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x161')};}else{logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x162'),this['channel']['callerid'],_0xf3a055[_0x4840('0x15e')]));this['channel'][_0x4840('0xab')](util['format'](_0x4840('0x162'),this['channel']['callerid'],_0xf3a055[_0x4840('0x15e')]));return{'code':0xc8,'result':_0x4840('0x163')};}};AGIVertices[_0x4840('0x16')]['voicemail']=function(_0x1dff7f){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c4'),_0x1dff7f[_0x4840('0x3c')]));var _0x274d89=this[_0x4840('0x3a')]['exec'](_0x4840('0x1c5'),[_0x1dff7f[_0x4840('0x1c6')],_0x1dff7f[_0x4840('0x7b')]]);if(_0x274d89['result']===-0x1){return _0x274d89;}return this[_0x4840('0x3a')]['noop'](util['format'](_0x4840('0xc7'),_0x4840('0x1c5'),_0x1dff7f['mailbox']));};AGIVertices[_0x4840('0x16')]['vswitch']=function(_0x3c7fe3){logger[_0x4840('0x30')](util[_0x4840('0x2b')](_0x4840('0x1c7'),_0x3c7fe3[_0x4840('0x3c')]));if(!this[_0x4840('0x87')](_0x3c7fe3[_0x4840('0xde')])){return this[_0x4840('0x3a')][_0x4840('0x2f')](_0x3c7fe3,_0x4840('0x1c8'));}var _0x3a1568=this[_0x4840('0x12')][_0x4840('0x72')](this,_0x3c7fe3[_0x4840('0xde')]);if(!_0x3a1568){return this['channel']['error'](_0x3c7fe3,_0x4840('0xe0'));}var _0x1454f0=this[_0x4840('0x3a')]['getVariable'](_0x3a1568);return{'code':0xc8,'result':_0x1454f0[_0x4840('0xa3')]?_0x1454f0[_0x4840('0xa3')]:'-'};};String[_0x4840('0x16')][_0x4840('0xa2')]=function(_0x4e151b,_0x10645b){return this[_0x4840('0xa0')](_0x4e151b)[_0x4840('0x1c9')](_0x10645b);};module[_0x4840('0x1ca')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 5daa72f..7b6356d 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 _0x7f1c=['hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','agents','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7f1c,0x1a1));var _0xc7f1=function(_0xfd336f,_0x1c1dd3){_0xfd336f=_0xfd336f-0x0;var _0xe0bbe2=_0x7f1c[_0xfd336f];return _0xe0bbe2;};'use strict';var util=require(_0xc7f1('0x0'));var _=require('lodash');var moment=require(_0xc7f1('0x1'));var ami=require('../ami');var logger=require(_0xc7f1('0x2'))(_0xc7f1('0x3'));var RpcUser=require(_0xc7f1('0x4'));var RpcVoiceAgentReport=require(_0xc7f1('0x5'));function Acw(_0x33983e){this[_0xc7f1('0x6')]=_0x33983e[_0xc7f1('0x6')];this['agents']=_0x33983e['agents'];this[_0xc7f1('0x7')]=_0x33983e[_0xc7f1('0x7')];this[_0xc7f1('0x8')]={};ami['on'](_0xc7f1('0x9'),this[_0xc7f1('0xa')][_0xc7f1('0xb')](this));ami['on'](_0xc7f1('0xc'),this['syncHangupRequest']['bind'](this));ami['on'](_0xc7f1('0xd'),this['syncHangup']['bind'](this));ami['on'](_0xc7f1('0xe'),this[_0xc7f1('0xf')][_0xc7f1('0xb')](this));ami['on'](_0xc7f1('0x10'),this[_0xc7f1('0x11')][_0xc7f1('0xb')](this));ami['on'](_0xc7f1('0x12'),this['syncBlindTransfer'][_0xc7f1('0xb')](this));ami['on'](_0xc7f1('0x13'),this[_0xc7f1('0x14')][_0xc7f1('0xb')](this));}function getDiff(_0x955c75){var _0x14189c=moment()[_0xc7f1('0x15')](0x0);var _0x43e334=moment(_0x955c75)[_0xc7f1('0x15')](0x0);return _0x14189c[_0xc7f1('0x16')](_0x43e334,_0xc7f1('0x17'));}Acw[_0xc7f1('0x18')]['startAcw']=function(_0x119d63){try{var _0x6665e2=this;var _0x48b36d=this[_0xc7f1('0x8')][_0x119d63][_0xc7f1('0x19')];var _0x611a74=this[_0xc7f1('0x8')][_0x119d63]['queue'];var _0x3ba955=this[_0xc7f1('0x6')][_0x611a74];var _0xfd6e44=![];var _0x47fc33='ACW';if(_0x3ba955[_0xc7f1('0x1a')]){if(_0x3ba955[_0xc7f1('0x1b')]['name']){_0xfd6e44=!![];_0x47fc33=_0x3ba955[_0xc7f1('0x1b')][_0xc7f1('0x1c')];}}ami[_0xc7f1('0x1d')]({'action':_0xc7f1('0x1e'),'interface':_0x48b36d,'paused':!![],'reason':_0x47fc33})['then'](function(_0x45d4e5){if(_0x6665e2[_0xc7f1('0x1f')][_0x48b36d]){return RpcUser[_0xc7f1('0x20')](_0x6665e2[_0xc7f1('0x1f')][_0x48b36d]['id'])[_0xc7f1('0x21')](function(_0x8fc335){if(_0x8fc335&&!_0x8fc335[_0xc7f1('0x22')]){logger[_0xc7f1('0x23')](_0xc7f1('0x24'),_0x119d63,_0x48b36d,_0x611a74);var _0x5e9e12=_0x6665e2['channels'][_0x119d63][_0xc7f1('0x25')]&&_0x6665e2[_0xc7f1('0x8')][_0x119d63][_0xc7f1('0x26')]?_0x6665e2[_0xc7f1('0x8')][_0x119d63][_0xc7f1('0x26')]:_0x119d63;return RpcUser[_0xc7f1('0x27')](_0x6665e2[_0xc7f1('0x1f')][_0x48b36d],_0x47fc33,_0x5e9e12)[_0xc7f1('0x21')](function(_0x5ec939){if(!_0xfd6e44){_0x6665e2[_0xc7f1('0x7')][_0x48b36d]={};logger[_0xc7f1('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x119d63,_0x6665e2[_0xc7f1('0x6')][_0x611a74][_0xc7f1('0x28')],_0x48b36d,_0x611a74);_0x6665e2['timers'][_0x48b36d]['timer']=setTimeout(_0x6665e2[_0xc7f1('0x29')][_0xc7f1('0xb')](_0x6665e2,_0x48b36d),_0x6665e2[_0xc7f1('0x6')][_0x611a74]['acwTimeout']*0x3e8);_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x2a')]=moment()[_0xc7f1('0x2b')](_0xc7f1('0x2c'));_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x2d')]=_0x119d63;_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x2e')]=_0x611a74;_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x2f')]=function(){var _0xa11140=getDiff(_0x6665e2['timers'][_0x48b36d][_0xc7f1('0x2a')]);clearTimeout(_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x30')]);_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x30')]=![];RpcVoiceAgentReport[_0xc7f1('0x31')]({'acwtime':_0xa11140},_0x6665e2[_0xc7f1('0x7')][_0x48b36d][_0xc7f1('0x2d')],_0x48b36d)[_0xc7f1('0x21')](function(_0x1e89e8){logger[_0xc7f1('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x119d63,_0xa11140,_0x1e89e8);})[_0xc7f1('0x32')](function(_0x2bfae9){logger[_0xc7f1('0x33')](_0xc7f1('0x34'),_0x119d63,_0x2bfae9);});delete _0x6665e2[_0xc7f1('0x7')][_0x48b36d];};}});}else{logger[_0xc7f1('0x23')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x119d63,_0x48b36d,_0x611a74);}});}})['catch'](function(_0x221991){logger[_0xc7f1('0x33')](_0xc7f1('0x35'),_0x119d63,_0x6665e2[_0xc7f1('0x6')][_0x611a74][_0xc7f1('0x28')],_0x48b36d,_0x611a74);})['finally'](function(){delete _0x6665e2[_0xc7f1('0x8')][_0x119d63];});}catch(_0x415963){logger[_0xc7f1('0x33')](_0xc7f1('0x36'),_0x415963[_0xc7f1('0x37')]);}};Acw[_0xc7f1('0x18')][_0xc7f1('0x29')]=function(_0x136458){try{var _0x5e6d3a=this;if(_0x5e6d3a[_0xc7f1('0x7')][_0x136458]){_0x5e6d3a['timers'][_0x136458]['timer']=![];var _0x7c1ac9=_0x5e6d3a['timers'][_0x136458][_0xc7f1('0x2d')];var _0x237038=_0x5e6d3a[_0xc7f1('0x7')][_0x136458][_0xc7f1('0x2e')];var _0x436361=_0x5e6d3a['voiceQueues'][_0x237038][_0xc7f1('0x28')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x7c1ac9,_0x136458);RpcUser['saveUnpause'](this['agents'][_0x136458]);RpcVoiceAgentReport['update']({'acwtime':_0x436361,'agentacw':!![]},_0x7c1ac9,_0x136458)[_0xc7f1('0x21')](function(_0x1753b2){logger[_0xc7f1('0x23')](_0xc7f1('0x38'),_0x7c1ac9,_0x436361,_0x1753b2);})[_0xc7f1('0x32')](function(_0xb6cbe){logger[_0xc7f1('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x7c1ac9,_0xb6cbe);});}else{logger[_0xc7f1('0x33')](_0xc7f1('0x39'),_0x136458);if(_0x5e6d3a[_0xc7f1('0x7')]){logger[_0xc7f1('0x23')](_0xc7f1('0x3a'),JSON[_0xc7f1('0x3b')](_0x5e6d3a[_0xc7f1('0x7')]));}}}catch(_0x293735){logger[_0xc7f1('0x33')]('[ACW][STOP]\x20%s',_0x293735['message']);}};Acw[_0xc7f1('0x18')][_0xc7f1('0xa')]=function(_0x5a5a7e){try{if(this[_0xc7f1('0x6')][_0x5a5a7e[_0xc7f1('0x2e')]]&&(this[_0xc7f1('0x6')][_0x5a5a7e['queue']]['acw']||this[_0xc7f1('0x6')][_0x5a5a7e[_0xc7f1('0x2e')]]['mandatoryDisposition'])){if(this[_0xc7f1('0x1f')][_0x5a5a7e['interface']]){this[_0xc7f1('0x8')][_0x5a5a7e[_0xc7f1('0x2d')]]={'queue':_0x5a5a7e[_0xc7f1('0x2e')],'interface':_0x5a5a7e[_0xc7f1('0x19')],'destlinkedid':_0x5a5a7e['destlinkedid']};}}}catch(_0x205e0f){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x205e0f[_0xc7f1('0x37')]);}};Acw[_0xc7f1('0x18')][_0xc7f1('0x14')]=function(_0x3be2f3){try{if(this['voiceQueues'][_0x3be2f3['queue']]&&(this[_0xc7f1('0x6')][_0x3be2f3[_0xc7f1('0x2e')]][_0xc7f1('0x3')]||this['voiceQueues'][_0x3be2f3[_0xc7f1('0x2e')]][_0xc7f1('0x1a')])){if(this['agents'][_0x3be2f3[_0xc7f1('0x19')]]){this[_0xc7f1('0x8')][_0x3be2f3[_0xc7f1('0x2d')]]={'queue':_0x3be2f3[_0xc7f1('0x2e')],'interface':_0x3be2f3[_0xc7f1('0x19')]};}}}catch(_0xc7d6e5){logger[_0xc7f1('0x33')]('[ACW][syncAgentConnectPreview]\x20%s',_0xc7d6e5['message']);}};Acw[_0xc7f1('0x18')]['syncHangupRequest']=function(_0x51ff6f){try{if(this[_0xc7f1('0x8')][_0x51ff6f[_0xc7f1('0x2d')]]&&_[_0xc7f1('0x3c')](this['channels'][_0x51ff6f['uniqueid']][_0xc7f1('0x25')])){logger[_0xc7f1('0x23')](_0xc7f1('0x3d'),_0x51ff6f[_0xc7f1('0x2d')]);this[_0xc7f1('0x3e')](_0x51ff6f[_0xc7f1('0x2d')]);}else if(this[_0xc7f1('0x8')][_0x51ff6f[_0xc7f1('0x3f')]]&&_[_0xc7f1('0x3c')](this[_0xc7f1('0x8')][_0x51ff6f[_0xc7f1('0x3f')]][_0xc7f1('0x25')])){logger[_0xc7f1('0x23')](_0xc7f1('0x40'),_0x51ff6f['linkedid']);this['startAcw'](_0x51ff6f[_0xc7f1('0x3f')]);}}catch(_0x34b50c){logger['error'](_0xc7f1('0x41'),_0x34b50c[_0xc7f1('0x37')]);}};Acw[_0xc7f1('0x18')][_0xc7f1('0x42')]=function(_0x4d3102){try{if(this[_0xc7f1('0x8')][_0x4d3102[_0xc7f1('0x2d')]]&&this['channels'][_0x4d3102['uniqueid']][_0xc7f1('0x25')]){logger[_0xc7f1('0x23')](_0xc7f1('0x43'),_0x4d3102[_0xc7f1('0x2d')]);this[_0xc7f1('0x3e')](_0x4d3102[_0xc7f1('0x2d')]);}else if(this[_0xc7f1('0x8')][_0x4d3102[_0xc7f1('0x3f')]]&&this[_0xc7f1('0x8')][_0x4d3102[_0xc7f1('0x3f')]][_0xc7f1('0x25')]){logger[_0xc7f1('0x23')](_0xc7f1('0x44'),_0x4d3102[_0xc7f1('0x3f')]);this[_0xc7f1('0x3e')](_0x4d3102[_0xc7f1('0x3f')]);}}catch(_0x1936ae){logger[_0xc7f1('0x33')](_0xc7f1('0x45'),_0x1936ae[_0xc7f1('0x37')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x565b4d){try{if(!_['isNil'](this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x46')]])){this['startAcw'](_0x565b4d['transfereeuniqueid']);if(this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x47')]]){this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x47')]]['attended']=!![];this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x48')]]=this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x47')]];delete this[_0xc7f1('0x8')][_0x565b4d['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x48')]])){this[_0xc7f1('0x3e')](_0x565b4d[_0xc7f1('0x48')]);if(this['channels'][_0x565b4d['origtransfereruniqueid']]){this[_0xc7f1('0x8')][_0x565b4d['origtransfereruniqueid']][_0xc7f1('0x25')]=!![];this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x46')]]=this['channels'][_0x565b4d['origtransfereruniqueid']];delete this[_0xc7f1('0x8')][_0x565b4d[_0xc7f1('0x49')]];}}}catch(_0x123d05){logger['error'](_0xc7f1('0x4a'),_0x123d05[_0xc7f1('0x37')]);}};Acw[_0xc7f1('0x18')][_0xc7f1('0x4b')]=function(_0x2379a8){try{if(this[_0xc7f1('0x8')][_0x2379a8[_0xc7f1('0x4c')]]){logger[_0xc7f1('0x23')](_0xc7f1('0x4d'),JSON['stringify'](_0x2379a8[_0xc7f1('0x4c')]));this['startAcw'](_0x2379a8[_0xc7f1('0x4c')]);}else if(this[_0xc7f1('0x8')][_0x2379a8[_0xc7f1('0x4e')]]){logger[_0xc7f1('0x23')](_0xc7f1('0x4f'),JSON[_0xc7f1('0x3b')](_0x2379a8[_0xc7f1('0x4e')]));this[_0xc7f1('0x3e')](_0x2379a8[_0xc7f1('0x4e')]);}}catch(_0x24f3d2){logger[_0xc7f1('0x33')](_0xc7f1('0x50'),_0x24f3d2['message']);}};Acw['prototype'][_0xc7f1('0xf')]=function(_0x50c503){try{if(this[_0xc7f1('0x6')][_0x50c503[_0xc7f1('0x2e')]]&&this[_0xc7f1('0x6')][_0x50c503[_0xc7f1('0x2e')]][_0xc7f1('0x51')]===_0xc7f1('0x52')){if(this[_0xc7f1('0x1f')][_0x50c503[_0xc7f1('0x19')]]){logger['info'](_0xc7f1('0x53'),_0x50c503[_0xc7f1('0x2d')],_0x50c503['interface'],_0x50c503[_0xc7f1('0x2e')]);return RpcUser[_0xc7f1('0x27')](this['agents'][_0x50c503[_0xc7f1('0x19')]],_0xc7f1('0x54'),_0x50c503[_0xc7f1('0x2d')]);}}}catch(_0x54717b){logger[_0xc7f1('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x54717b[_0xc7f1('0x37')]);}};module[_0xc7f1('0x55')]=Acw; \ No newline at end of file +var _0x9bfd=['finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','attended','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bfd,0x181));var _0xd9bf=function(_0xca95cd,_0x143af0){_0xca95cd=_0xca95cd-0x0;var _0x511417=_0x9bfd[_0xca95cd];return _0x511417;};'use strict';var util=require('util');var _=require(_0xd9bf('0x0'));var moment=require('moment');var ami=require(_0xd9bf('0x1'));var logger=require(_0xd9bf('0x2'))('acw');var RpcUser=require(_0xd9bf('0x3'));var RpcVoiceAgentReport=require(_0xd9bf('0x4'));function Acw(_0x1ed35e){this['voiceQueues']=_0x1ed35e['voiceQueues'];this['agents']=_0x1ed35e[_0xd9bf('0x5')];this[_0xd9bf('0x6')]=_0x1ed35e['timers'];this[_0xd9bf('0x7')]={};ami['on'](_0xd9bf('0x8'),this[_0xd9bf('0x9')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0xb'),this['syncHangupRequest'][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0xc'),this[_0xd9bf('0xd')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0xe'),this[_0xd9bf('0xf')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0x10'),this[_0xd9bf('0x11')]['bind'](this));ami['on']('blindtransfer',this[_0xd9bf('0x12')][_0xd9bf('0xa')](this));ami['on'](_0xd9bf('0x13'),this[_0xd9bf('0x14')]['bind'](this));}function getDiff(_0x17ad83){var _0x1702ec=moment()[_0xd9bf('0x15')](0x0);var _0x3f7daa=moment(_0x17ad83)[_0xd9bf('0x15')](0x0);return _0x1702ec[_0xd9bf('0x16')](_0x3f7daa,'seconds');}Acw[_0xd9bf('0x17')][_0xd9bf('0x18')]=function(_0x5192d0){try{var _0x2560d8=this;var _0xb8f907=this[_0xd9bf('0x7')][_0x5192d0][_0xd9bf('0x19')];var _0x4234f2=this[_0xd9bf('0x7')][_0x5192d0][_0xd9bf('0x1a')];var _0x57332a=this[_0xd9bf('0x1b')][_0x4234f2];var _0x758c39=![];var _0x529be1=_0xd9bf('0x1c');if(_0x57332a[_0xd9bf('0x1d')]){if(_0x57332a[_0xd9bf('0x1e')]['name']){_0x758c39=!![];_0x529be1=_0x57332a['mandatoryDispositionPause'][_0xd9bf('0x1f')];}}ami['Action']({'action':'QueuePause','interface':_0xb8f907,'paused':!![],'reason':_0x529be1})[_0xd9bf('0x20')](function(_0x46a07d){if(_0x2560d8[_0xd9bf('0x5')][_0xb8f907]){return RpcUser[_0xd9bf('0x21')](_0x2560d8[_0xd9bf('0x5')][_0xb8f907]['id'])[_0xd9bf('0x20')](function(_0x8ab322){if(_0x8ab322&&!_0x8ab322['voicePause']){logger[_0xd9bf('0x22')](_0xd9bf('0x23'),_0x5192d0,_0xb8f907,_0x4234f2);var _0x1cf73f=_0x2560d8['channels'][_0x5192d0]['attended']&&_0x2560d8[_0xd9bf('0x7')][_0x5192d0][_0xd9bf('0x24')]?_0x2560d8['channels'][_0x5192d0][_0xd9bf('0x24')]:_0x5192d0;return RpcUser[_0xd9bf('0x25')](_0x2560d8[_0xd9bf('0x5')][_0xb8f907],_0x529be1,_0x1cf73f)['then'](function(_0x51e215){if(!_0x758c39){_0x2560d8[_0xd9bf('0x6')][_0xb8f907]={};logger['info'](_0xd9bf('0x26'),_0x5192d0,_0x2560d8[_0xd9bf('0x1b')][_0x4234f2][_0xd9bf('0x27')],_0xb8f907,_0x4234f2);_0x2560d8[_0xd9bf('0x6')][_0xb8f907]['timer']=setTimeout(_0x2560d8[_0xd9bf('0x28')]['bind'](_0x2560d8,_0xb8f907),_0x2560d8[_0xd9bf('0x1b')][_0x4234f2][_0xd9bf('0x27')]*0x3e8);_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x29')]=moment()['format'](_0xd9bf('0x2a'));_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2b')]=_0x5192d0;_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x1a')]=_0x4234f2;_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2c')]=function(){var _0x41f2d3=getDiff(_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x29')]);clearTimeout(_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2d')]);_0x2560d8[_0xd9bf('0x6')][_0xb8f907][_0xd9bf('0x2d')]=![];RpcVoiceAgentReport[_0xd9bf('0x2e')]({'acwtime':_0x41f2d3},_0x2560d8['timers'][_0xb8f907][_0xd9bf('0x2b')],_0xb8f907)['then'](function(_0x171e24){logger[_0xd9bf('0x22')](_0xd9bf('0x2f'),_0x5192d0,_0x41f2d3,_0x171e24);})[_0xd9bf('0x30')](function(_0x3dff03){logger['error'](_0xd9bf('0x31'),_0x5192d0,_0x3dff03);});delete _0x2560d8[_0xd9bf('0x6')][_0xb8f907];};}});}else{logger[_0xd9bf('0x22')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5192d0,_0xb8f907,_0x4234f2);}});}})[_0xd9bf('0x30')](function(_0x2c975e){logger['error'](_0xd9bf('0x26'),_0x5192d0,_0x2560d8[_0xd9bf('0x1b')][_0x4234f2]['acwTimeout'],_0xb8f907,_0x4234f2);})[_0xd9bf('0x32')](function(){delete _0x2560d8[_0xd9bf('0x7')][_0x5192d0];});}catch(_0x524a98){logger['error'](_0xd9bf('0x33'),_0x524a98[_0xd9bf('0x34')]);}};Acw[_0xd9bf('0x17')][_0xd9bf('0x28')]=function(_0x425602){try{var _0x315b81=this;if(_0x315b81[_0xd9bf('0x6')][_0x425602]){_0x315b81[_0xd9bf('0x6')][_0x425602][_0xd9bf('0x2d')]=![];var _0x10106b=_0x315b81[_0xd9bf('0x6')][_0x425602]['uniqueid'];var _0x52e16c=_0x315b81[_0xd9bf('0x6')][_0x425602][_0xd9bf('0x1a')];var _0xd8d9c5=_0x315b81[_0xd9bf('0x1b')][_0x52e16c][_0xd9bf('0x27')];logger['info'](_0xd9bf('0x35'),_0x10106b,_0x425602);RpcUser[_0xd9bf('0x36')](this['agents'][_0x425602]);RpcVoiceAgentReport[_0xd9bf('0x2e')]({'acwtime':_0xd8d9c5,'agentacw':!![]},_0x10106b,_0x425602)[_0xd9bf('0x20')](function(_0x5b203b){logger['info'](_0xd9bf('0x2f'),_0x10106b,_0xd8d9c5,_0x5b203b);})[_0xd9bf('0x30')](function(_0x293e3b){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x10106b,_0x293e3b);});}else{logger[_0xd9bf('0x37')](_0xd9bf('0x38'),_0x425602);if(_0x315b81[_0xd9bf('0x6')]){logger[_0xd9bf('0x22')](_0xd9bf('0x39'),JSON[_0xd9bf('0x3a')](_0x315b81[_0xd9bf('0x6')]));}}}catch(_0x27482b){logger[_0xd9bf('0x37')](_0xd9bf('0x3b'),_0x27482b['message']);}};Acw['prototype'][_0xd9bf('0x9')]=function(_0x364708){try{if(this['voiceQueues'][_0x364708[_0xd9bf('0x1a')]]&&(this[_0xd9bf('0x1b')][_0x364708[_0xd9bf('0x1a')]][_0xd9bf('0x3c')]||this[_0xd9bf('0x1b')][_0x364708[_0xd9bf('0x1a')]][_0xd9bf('0x1d')])){if(this['agents'][_0x364708[_0xd9bf('0x19')]]){this['channels'][_0x364708[_0xd9bf('0x2b')]]={'queue':_0x364708[_0xd9bf('0x1a')],'interface':_0x364708['interface'],'destlinkedid':_0x364708['destlinkedid']};}}}catch(_0x24906e){logger[_0xd9bf('0x37')]('[ACW][syncAgentConnect]\x20%s',_0x24906e['message']);}};Acw[_0xd9bf('0x17')]['syncAgentConnectPreview']=function(_0x5d3fbb){try{if(this['voiceQueues'][_0x5d3fbb[_0xd9bf('0x1a')]]&&(this[_0xd9bf('0x1b')][_0x5d3fbb[_0xd9bf('0x1a')]]['acw']||this[_0xd9bf('0x1b')][_0x5d3fbb['queue']][_0xd9bf('0x1d')])){if(this[_0xd9bf('0x5')][_0x5d3fbb[_0xd9bf('0x19')]]){this['channels'][_0x5d3fbb[_0xd9bf('0x2b')]]={'queue':_0x5d3fbb[_0xd9bf('0x1a')],'interface':_0x5d3fbb['interface']};}}}catch(_0x295681){logger[_0xd9bf('0x37')](_0xd9bf('0x3d'),_0x295681[_0xd9bf('0x34')]);}};Acw['prototype'][_0xd9bf('0x3e')]=function(_0x480fe1){try{if(this[_0xd9bf('0x7')][_0x480fe1[_0xd9bf('0x2b')]]&&_['isUndefined'](this[_0xd9bf('0x7')][_0x480fe1['uniqueid']][_0xd9bf('0x3f')])){logger[_0xd9bf('0x22')](_0xd9bf('0x40'),_0x480fe1[_0xd9bf('0x2b')]);this[_0xd9bf('0x18')](_0x480fe1[_0xd9bf('0x2b')]);}else if(this[_0xd9bf('0x7')][_0x480fe1['linkedid']]&&_[_0xd9bf('0x41')](this[_0xd9bf('0x7')][_0x480fe1['linkedid']]['attended'])){logger[_0xd9bf('0x22')]('[%s][HANGUP:LINKEDID]',_0x480fe1[_0xd9bf('0x42')]);this[_0xd9bf('0x18')](_0x480fe1['linkedid']);}}catch(_0x3bdbae){logger[_0xd9bf('0x37')](_0xd9bf('0x43'),_0x3bdbae['message']);}};Acw['prototype'][_0xd9bf('0xd')]=function(_0x16e2c1){try{if(this[_0xd9bf('0x7')][_0x16e2c1['uniqueid']]&&this[_0xd9bf('0x7')][_0x16e2c1[_0xd9bf('0x2b')]][_0xd9bf('0x3f')]){logger[_0xd9bf('0x22')](_0xd9bf('0x44'),_0x16e2c1[_0xd9bf('0x2b')]);this[_0xd9bf('0x18')](_0x16e2c1['uniqueid']);}else if(this[_0xd9bf('0x7')][_0x16e2c1[_0xd9bf('0x42')]]&&this[_0xd9bf('0x7')][_0x16e2c1[_0xd9bf('0x42')]][_0xd9bf('0x3f')]){logger[_0xd9bf('0x22')](_0xd9bf('0x45'),_0x16e2c1[_0xd9bf('0x42')]);this[_0xd9bf('0x18')](_0x16e2c1[_0xd9bf('0x42')]);}}catch(_0x222eb9){logger['error'](_0xd9bf('0x46'),_0x222eb9['message']);}};Acw[_0xd9bf('0x17')][_0xd9bf('0x11')]=function(_0xcf475e){try{if(!_['isNil'](this['channels'][_0xcf475e[_0xd9bf('0x47')]])){this[_0xd9bf('0x18')](_0xcf475e[_0xd9bf('0x47')]);if(this[_0xd9bf('0x7')][_0xcf475e['secondtransfereruniqueid']]){this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x48')]][_0xd9bf('0x3f')]=!![];this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x49')]]=this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x48')]];delete this[_0xd9bf('0x7')][_0xcf475e['secondtransfereruniqueid']];}}else if(!_[_0xd9bf('0x4a')](this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x49')]])){this[_0xd9bf('0x18')](_0xcf475e[_0xd9bf('0x49')]);if(this['channels'][_0xcf475e[_0xd9bf('0x4b')]]){this[_0xd9bf('0x7')][_0xcf475e[_0xd9bf('0x4b')]]['attended']=!![];this[_0xd9bf('0x7')][_0xcf475e['transfereeuniqueid']]=this[_0xd9bf('0x7')][_0xcf475e['origtransfereruniqueid']];delete this['channels'][_0xcf475e[_0xd9bf('0x4b')]];}}}catch(_0x9c3192){logger[_0xd9bf('0x37')](_0xd9bf('0x4c'),_0x9c3192['message']);}};Acw['prototype']['syncBlindTransfer']=function(_0x2d906c){try{if(this['channels'][_0x2d906c[_0xd9bf('0x4d')]]){logger['info'](_0xd9bf('0x4e'),JSON[_0xd9bf('0x3a')](_0x2d906c['transfereruniqueid']));this[_0xd9bf('0x18')](_0x2d906c[_0xd9bf('0x4d')]);}else if(this[_0xd9bf('0x7')][_0x2d906c[_0xd9bf('0x4f')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xd9bf('0x3a')](_0x2d906c[_0xd9bf('0x4f')]));this['startAcw'](_0x2d906c[_0xd9bf('0x4f')]);}}catch(_0x35b21d){logger['error'](_0xd9bf('0x50'),_0x35b21d['message']);}};Acw[_0xd9bf('0x17')][_0xd9bf('0xf')]=function(_0x27a451){try{if(this[_0xd9bf('0x1b')][_0x27a451[_0xd9bf('0x1a')]]&&this[_0xd9bf('0x1b')][_0x27a451[_0xd9bf('0x1a')]][_0xd9bf('0x51')]===_0xd9bf('0x52')){if(this[_0xd9bf('0x5')][_0x27a451['interface']]){logger['info'](_0xd9bf('0x53'),_0x27a451[_0xd9bf('0x2b')],_0x27a451[_0xd9bf('0x19')],_0x27a451['queue']);return RpcUser[_0xd9bf('0x25')](this[_0xd9bf('0x5')][_0x27a451[_0xd9bf('0x19')]],_0xd9bf('0x54'),_0x27a451[_0xd9bf('0x2b')]);}}}catch(_0x40e50e){logger[_0xd9bf('0x37')](_0xd9bf('0x55'),_0x40e50e[_0xd9bf('0x34')]);}};module[_0xd9bf('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ef2c845..ca4e6b6 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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x1bcd3c,_0x1aba22){var _0x5a4b0a=function(_0x13c5ec){while(--_0x13c5ec){_0x1bcd3c['push'](_0x1bcd3c['shift']());}};_0x5a4b0a(++_0x1aba22);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x2258b9,_0x336201){var _0x29806f=function(_0x3b304a){while(--_0x3b304a){_0x2258b9['push'](_0x2258b9['shift']());}};_0x29806f(++_0x336201);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 18d5cf8..d4df46c 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x128164,_0x1266c4){var _0x28feb2=function(_0x463f4b){while(--_0x463f4b){_0x128164['push'](_0x128164['shift']());}};_0x28feb2(++_0x1266c4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x70e0,0x17b));var _0x070e=function(_0x532bc6,_0x130bb6){_0x532bc6=_0x532bc6-0x0;var _0x5c2cdf=_0x70e0[_0x532bc6];return _0x5c2cdf;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index df230e6..82957fe 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 _0x9a50=['isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','substring','getQueue','exports','lodash','moment'];(function(_0x3ddd47,_0x5d2940){var _0x34f52d=function(_0x3a92c0){while(--_0x3a92c0){_0x3ddd47['push'](_0x3ddd47['shift']());}};_0x34f52d(++_0x5d2940);}(_0x9a50,0x79));var _0x09a5=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x9a50[_0x5dee2a];return _0x31e98e;};'use strict';var util=require('util');var _=require(_0x09a5('0x0'));var moment=require(_0x09a5('0x1'));function checkNameSurname(_0x1cb815,_0x4efa1a,_0x21549c){var _0x38d1d0='';if(!_[_0x09a5('0x2')](_0x4efa1a)&&'string'===typeof _0x4efa1a){_0x38d1d0+=_0x4efa1a;}if(!_[_0x09a5('0x2')](_0x21549c)&&'string'===typeof _0x21549c){_0x38d1d0+='\x20'+_0x21549c;}if(_0x38d1d0!==''){return _0x38d1d0;}return _0x1cb815;}function Action(_0x4a8ad4,_0xa779d0,_0x370968){this[_0x09a5('0x3')]=_0x4a8ad4;this[_0x09a5('0x4')]=_0x370968||undefined;this[_0x09a5('0x5')]=checkNameSurname(_0xa779d0[_0x09a5('0x6')][_0x09a5('0x7')],_0xa779d0[_0x09a5('0x6')][_0x09a5('0x8')],_0xa779d0['Contact'][_0x09a5('0x9')]);this[_0x09a5('0xa')]=_0xa779d0['Contact'][_0x09a5('0x7')];this[_0x09a5('0xb')]=_0x4a8ad4[_0x09a5('0x5')];this['active']=_0xa779d0['active']||![];this[_0x09a5('0xc')]=_0x4a8ad4['type'];this[_0x09a5('0xd')]=_0x4a8ad4[_0x09a5('0xd')]||0x3;this[_0x09a5('0xe')]=_0xa779d0[_0x09a5('0xe')];this[_0x09a5('0xf')]=_0xa779d0[_0x09a5('0xf')];this[_0x09a5('0x10')]=_0xa779d0['countcongestionretry'];this[_0x09a5('0x11')]=_0xa779d0[_0x09a5('0x11')];this[_0x09a5('0x12')]=_0xa779d0[_0x09a5('0x12')];this[_0x09a5('0x13')]=_0xa779d0[_0x09a5('0x13')];this[_0x09a5('0x14')]=_0xa779d0[_0x09a5('0x14')];this['countmachineretry']=_0xa779d0['countmachineretry'];this[_0x09a5('0x15')]=_0xa779d0[_0x09a5('0x15')];this[_0x09a5('0x16')]=_0xa779d0[_0x09a5('0x16')];this['ListId']=_0xa779d0['ListId'];this[_0x09a5('0x17')]=_0xa779d0[_0x09a5('0x17')];this[_0x09a5('0x18')]=_0xa779d0[_0x09a5('0x18')];this[_0x09a5('0x19')]=_0xa779d0[_0x09a5('0x19')];this['idHopper']=_0xa779d0['id'];this[_0x09a5('0x1a')]=_0xa779d0[_0x09a5('0x6')][_0x09a5('0x8')]||'';this[_0x09a5('0x1b')]=moment()[_0x09a5('0x1c')](_0x09a5('0x1d'));this[_0x09a5('0x1e')]=_0xa779d0['callback'];this[_0x09a5('0x1f')]=_0xa779d0[_0x09a5('0x1f')];this[_0x09a5('0x20')]=_0xa779d0['callbackat'];this[_0x09a5('0x21')]=_0xa779d0[_0x09a5('0x21')];this[_0x09a5('0x22')]='';this['originatecalleridname']='';}Action[_0x09a5('0x23')][_0x09a5('0x24')]=function(){return util[_0x09a5('0x1c')](_0x09a5('0x25'),this[_0x09a5('0x5')],this[_0x09a5('0x3')]['dialCutDigit']>0x0?this[_0x09a5('0xa')][_0x09a5('0x26')](this[_0x09a5('0x3')]['dialCutDigit']):this[_0x09a5('0xa')]);};Action[_0x09a5('0x23')][_0x09a5('0x27')]=function(){return this[_0x09a5('0xb')];};module[_0x09a5('0x28')]=Action; \ No newline at end of file +var _0xaad5=['phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','prototype','getQueue','lodash','isNil','string','voiceQueue','name','Contact'];(function(_0x445503,_0x129f75){var _0x3e24e9=function(_0x2a5c4b){while(--_0x2a5c4b){_0x445503['push'](_0x445503['shift']());}};_0x3e24e9(++_0x129f75);}(_0xaad5,0xd1));var _0x5aad=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xaad5[_0x1e4360];return _0x31e6b4;};'use strict';var util=require('util');var _=require(_0x5aad('0x0'));var moment=require('moment');function checkNameSurname(_0x59076b,_0x2610a4,_0x147816){var _0x34f6ce='';if(!_[_0x5aad('0x1')](_0x2610a4)&&_0x5aad('0x2')===typeof _0x2610a4){_0x34f6ce+=_0x2610a4;}if(!_['isNil'](_0x147816)&&'string'===typeof _0x147816){_0x34f6ce+='\x20'+_0x147816;}if(_0x34f6ce!==''){return _0x34f6ce;}return _0x59076b;}function Action(_0x306f72,_0x1a425d,_0x1bc7b){this[_0x5aad('0x3')]=_0x306f72;this['uniqueid']=_0x1bc7b||undefined;this[_0x5aad('0x4')]=checkNameSurname(_0x1a425d[_0x5aad('0x5')][_0x5aad('0x6')],_0x1a425d['Contact'][_0x5aad('0x7')],_0x1a425d[_0x5aad('0x5')][_0x5aad('0x8')]);this[_0x5aad('0x9')]=_0x1a425d[_0x5aad('0x5')][_0x5aad('0x6')];this[_0x5aad('0xa')]=_0x306f72[_0x5aad('0x4')];this[_0x5aad('0xb')]=_0x1a425d['active']||![];this[_0x5aad('0xc')]=_0x306f72[_0x5aad('0xc')];this[_0x5aad('0xd')]=_0x306f72[_0x5aad('0xd')]||0x3;this['scheduledat']=_0x1a425d[_0x5aad('0xe')];this[_0x5aad('0xf')]=_0x1a425d[_0x5aad('0xf')];this[_0x5aad('0x10')]=_0x1a425d[_0x5aad('0x10')];this[_0x5aad('0x11')]=_0x1a425d[_0x5aad('0x11')];this[_0x5aad('0x12')]=_0x1a425d[_0x5aad('0x12')];this[_0x5aad('0x13')]=_0x1a425d['countdropretry'];this[_0x5aad('0x14')]=_0x1a425d[_0x5aad('0x14')];this[_0x5aad('0x15')]=_0x1a425d[_0x5aad('0x15')];this['countagentrejectretry']=_0x1a425d[_0x5aad('0x16')];this[_0x5aad('0x17')]=_0x1a425d[_0x5aad('0x17')];this[_0x5aad('0x18')]=_0x1a425d[_0x5aad('0x18')];this[_0x5aad('0x19')]=_0x1a425d[_0x5aad('0x19')];this['VoiceQueueId']=_0x1a425d[_0x5aad('0x1a')];this['CampaignId']=_0x1a425d[_0x5aad('0x1b')];this['idHopper']=_0x1a425d['id'];this[_0x5aad('0x1c')]=_0x1a425d['Contact'][_0x5aad('0x7')]||'';this[_0x5aad('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5aad('0x1e')]=_0x1a425d[_0x5aad('0x1e')];this[_0x5aad('0x1f')]=_0x1a425d['callbackuniqueid'];this[_0x5aad('0x20')]=_0x1a425d['callbackat'];this[_0x5aad('0x21')]=_0x1a425d['recallme'];this[_0x5aad('0x22')]='';this[_0x5aad('0x23')]='';}Action['prototype'][_0x5aad('0x24')]=function(){return util[_0x5aad('0x25')](_0x5aad('0x26'),this['name'],this[_0x5aad('0x3')]['dialCutDigit']>0x0?this[_0x5aad('0x9')][_0x5aad('0x27')](this[_0x5aad('0x3')][_0x5aad('0x28')]):this[_0x5aad('0x9')]);};Action[_0x5aad('0x29')][_0x5aad('0x2a')]=function(){return this[_0x5aad('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d7eb77f..59e2919 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 _0xb962=['VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x248edd,_0x1f5dd7){var _0x3a37d1=function(_0x56241b){while(--_0x56241b){_0x248edd['push'](_0x248edd['shift']());}};_0x3a37d1(++_0x1f5dd7);}(_0xb962,0x88));var _0x2b96=function(_0x252451,_0x3f40a0){_0x252451=_0x252451-0x0;var _0x5a4002=_0xb962[_0x252451];return _0x5a4002;};'use strict';var util=require(_0x2b96('0x0'));var _=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));function getSeconds(_0x370075,_0x1dc7c1){var _0x39c6cf=moment(_0x370075)[_0x2b96('0x3')](0x0);var _0x40947f=moment(_0x1dc7c1)[_0x2b96('0x3')](0x0);return _0x39c6cf[_0x2b96('0x4')](_0x40947f,_0x2b96('0x5'));}function AgentComplete(_0x126660,_0x5298d1){this[_0x2b96('0x6')]=0x4;this['statedesc']='Answer';this[_0x2b96('0x7')]=_0x126660['scheduledat'];this[_0x2b96('0x8')]=_0x126660[_0x2b96('0x8')];this[_0x2b96('0x9')]=_0x126660[_0x2b96('0x8')]===_0x2b96('0xa')?'queue':_0x126660['type'];this[_0x2b96('0xb')]=_0x126660[_0x2b96('0xb')];this[_0x2b96('0xc')]=_0x126660[_0x2b96('0xc')];this[_0x2b96('0xd')]=_0x126660['countnoanswerretry'];this[_0x2b96('0xe')]=_0x126660[_0x2b96('0xb')]+_0x126660[_0x2b96('0xc')]+_0x126660[_0x2b96('0xd')]+_0x126660['countnosuchnumberretry']+_0x126660[_0x2b96('0xf')]+_0x126660['countabandonedretry']+_0x126660[_0x2b96('0x10')]+_0x126660[_0x2b96('0x11')];this['countnosuchnumberretry']=_0x126660[_0x2b96('0x12')];this['countdropretry']=_0x126660['countdropretry'];this[_0x2b96('0x13')]=_0x126660[_0x2b96('0x13')];this['countmachineretry']=_0x126660[_0x2b96('0x10')];this[_0x2b96('0x11')]=_0x126660['countagentrejectretry'];this[_0x2b96('0x14')]=_0x5298d1[_0x2b96('0x14')];this['calleridname']=_0x126660[_0x2b96('0x15')];this[_0x2b96('0x16')]=_0x126660[_0x2b96('0x17')];this[_0x2b96('0x18')]=_0x126660[_0x2b96('0x18')];this['responsetime']=_0x126660[_0x2b96('0x19')];this[_0x2b96('0x1a')]=_0x126660[_0x2b96('0x1a')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2b96('0x1b')]=getSeconds(_0x126660['responsetime'],_0x126660['starttime']);this[_0x2b96('0x1c')]=getSeconds(_0x126660['answertime'],_0x126660[_0x2b96('0x19')]);this[_0x2b96('0x1d')]=getSeconds(this[_0x2b96('0x1e')],_0x126660[_0x2b96('0x1a')]);this[_0x2b96('0x1f')]=_0x5298d1['queue'];this[_0x2b96('0x20')]=_0x5298d1[_0x2b96('0x20')];this['reason']=_0x5298d1[_0x2b96('0x21')];this[_0x2b96('0x22')]=_0x126660[_0x2b96('0x22')];this['callbackuniqueid']=_0x126660['callbackuniqueid'];this[_0x2b96('0x23')]=_0x126660['callbackat'];this['recallme']=_0x126660[_0x2b96('0x24')];this[_0x2b96('0x25')]=_0x126660[_0x2b96('0x25')];this[_0x2b96('0x26')]=_0x126660[_0x2b96('0x26')];this['UserId']=_0x126660[_0x2b96('0x27')];this['VoiceQueueId']=_0x126660[_0x2b96('0x28')];this[_0x2b96('0x29')]=_0x126660['CampaignId'];this['originatecalleridnum']=_0x126660['originatecalleridnum']||'';this[_0x2b96('0x2a')]=_0x126660[_0x2b96('0x2a')]||'';}module[_0x2b96('0x2b')]=AgentComplete; \ No newline at end of file +var _0x9dbb=['scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x9dbb,0x85));var _0xb9db=function(_0x5098d3,_0x245091){_0x5098d3=_0x5098d3-0x0;var _0x285389=_0x9dbb[_0x5098d3];return _0x285389;};'use strict';var util=require(_0xb9db('0x0'));var _=require(_0xb9db('0x1'));var moment=require(_0xb9db('0x2'));function getSeconds(_0x377639,_0x1ac3fd){var _0x4c3c87=moment(_0x377639)['milliseconds'](0x0);var _0x59a8b9=moment(_0x1ac3fd)[_0xb9db('0x3')](0x0);return _0x4c3c87[_0xb9db('0x4')](_0x59a8b9,_0xb9db('0x5'));}function AgentComplete(_0x29c0e5,_0x426858){this[_0xb9db('0x6')]=0x4;this[_0xb9db('0x7')]='Answer';this[_0xb9db('0x8')]=_0x29c0e5[_0xb9db('0x8')];this[_0xb9db('0x9')]=_0x29c0e5[_0xb9db('0x9')];this['campaigntype']=_0x29c0e5[_0xb9db('0x9')]==='outbound'?_0xb9db('0xa'):_0x29c0e5['type'];this[_0xb9db('0xb')]=_0x29c0e5[_0xb9db('0xb')];this[_0xb9db('0xc')]=_0x29c0e5[_0xb9db('0xc')];this[_0xb9db('0xd')]=_0x29c0e5[_0xb9db('0xd')];this[_0xb9db('0xe')]=_0x29c0e5[_0xb9db('0xb')]+_0x29c0e5[_0xb9db('0xc')]+_0x29c0e5['countnoanswerretry']+_0x29c0e5[_0xb9db('0xf')]+_0x29c0e5[_0xb9db('0x10')]+_0x29c0e5[_0xb9db('0x11')]+_0x29c0e5[_0xb9db('0x12')]+_0x29c0e5['countagentrejectretry'];this[_0xb9db('0xf')]=_0x29c0e5[_0xb9db('0xf')];this['countdropretry']=_0x29c0e5[_0xb9db('0x10')];this['countabandonedretry']=_0x29c0e5[_0xb9db('0x11')];this[_0xb9db('0x12')]=_0x29c0e5['countmachineretry'];this[_0xb9db('0x13')]=_0x29c0e5[_0xb9db('0x13')];this[_0xb9db('0x14')]=_0x426858[_0xb9db('0x14')];this[_0xb9db('0x15')]=_0x29c0e5[_0xb9db('0x16')];this[_0xb9db('0x17')]=_0x29c0e5[_0xb9db('0x18')];this[_0xb9db('0x19')]=_0x29c0e5['starttime'];this['responsetime']=_0x29c0e5['responsetime'];this[_0xb9db('0x1a')]=_0x29c0e5[_0xb9db('0x1a')];this[_0xb9db('0x1b')]=moment()['format'](_0xb9db('0x1c'));this[_0xb9db('0x1d')]=getSeconds(_0x29c0e5[_0xb9db('0x1e')],_0x29c0e5[_0xb9db('0x19')]);this[_0xb9db('0x1f')]=getSeconds(_0x29c0e5[_0xb9db('0x1a')],_0x29c0e5[_0xb9db('0x1e')]);this[_0xb9db('0x20')]=getSeconds(this[_0xb9db('0x1b')],_0x29c0e5[_0xb9db('0x1a')]);this[_0xb9db('0xa')]=_0x426858[_0xb9db('0xa')];this['membername']=_0x426858[_0xb9db('0x21')];this[_0xb9db('0x22')]=_0x426858[_0xb9db('0x22')];this[_0xb9db('0x23')]=_0x29c0e5[_0xb9db('0x23')];this[_0xb9db('0x24')]=_0x29c0e5['callbackuniqueid'];this['callbackat']=_0x29c0e5[_0xb9db('0x25')];this[_0xb9db('0x26')]=_0x29c0e5[_0xb9db('0x26')];this['ContactId']=_0x29c0e5[_0xb9db('0x27')];this[_0xb9db('0x28')]=_0x29c0e5[_0xb9db('0x28')];this['UserId']=_0x29c0e5[_0xb9db('0x29')];this[_0xb9db('0x2a')]=_0x29c0e5[_0xb9db('0x2a')];this[_0xb9db('0x2b')]=_0x29c0e5[_0xb9db('0x2b')];this[_0xb9db('0x2c')]=_0x29c0e5['originatecalleridnum']||'';this[_0xb9db('0x2d')]=_0x29c0e5['originatecalleridname']||'';}module[_0xb9db('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 3788496..2dddafe 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 _0x50a6=['countnosuchnumberretry','countagentrejectretry','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x5b45da,_0x52bb87){var _0x2327f7=function(_0x35c430){while(--_0x35c430){_0x5b45da['push'](_0x5b45da['shift']());}};_0x2327f7(++_0x52bb87);}(_0x50a6,0xa4));var _0x650a=function(_0x361475,_0x32ecc5){_0x361475=_0x361475-0x0;var _0x317cf1=_0x50a6[_0x361475];return _0x317cf1;};'use strict';var util=require(_0x650a('0x0'));var _=require(_0x650a('0x1'));var moment=require('moment');function getSeconds(_0x5d2ffc,_0x154e12){var _0x4abe0c=moment(_0x5d2ffc)[_0x650a('0x2')](0x0);var _0x15dd02=moment(_0x154e12)[_0x650a('0x2')](0x0);return _0x4abe0c['diff'](_0x15dd02,_0x650a('0x3'));}function Final(_0x4c71f3){this['uniqueid']=_0x4c71f3[_0x650a('0x4')];this[_0x650a('0x5')]=_0x4c71f3[_0x650a('0x5')];this[_0x650a('0x6')]=_0x4c71f3['type'];this[_0x650a('0x7')]=_0x4c71f3['type']===_0x650a('0x8')?_0x650a('0x9'):_0x4c71f3['type'];this[_0x650a('0xa')]=_0x4c71f3[_0x650a('0xa')];this['countcongestionretry']=_0x4c71f3[_0x650a('0xb')];this['countnoanswerretry']=_0x4c71f3[_0x650a('0xc')];this['countglobal']=_0x4c71f3[_0x650a('0xa')]+_0x4c71f3['countcongestionretry']+_0x4c71f3[_0x650a('0xc')]+_0x4c71f3['countnosuchnumberretry']+_0x4c71f3[_0x650a('0xd')]+_0x4c71f3[_0x650a('0xe')]+_0x4c71f3[_0x650a('0xf')]+_0x4c71f3['countagentrejectretry'];this[_0x650a('0x10')]=_0x4c71f3[_0x650a('0x10')];this[_0x650a('0xd')]=_0x4c71f3[_0x650a('0xd')];this[_0x650a('0xe')]=_0x4c71f3[_0x650a('0xe')];this['countmachineretry']=_0x4c71f3[_0x650a('0xf')];this['countagentrejectretry']=_0x4c71f3[_0x650a('0x11')];this[_0x650a('0x9')]=_0x4c71f3[_0x650a('0x9')];this['calleridname']=_0x4c71f3['calleridname'];this['calleridnum']=_0x4c71f3['calleridnum'];this[_0x650a('0x12')]=_0x4c71f3[_0x650a('0x12')];this[_0x650a('0x13')]=_0x4c71f3[_0x650a('0x13')];this[_0x650a('0x14')]=_0x4c71f3['responsetime'];this['ringtime']=_0x4c71f3[_0x650a('0x15')]||0x0;this[_0x650a('0x16')]=_0x4c71f3['holdtime']||0x0;this[_0x650a('0x17')]=_0x4c71f3[_0x650a('0x17')]||0x0;this['callback']=_0x4c71f3[_0x650a('0x18')];this[_0x650a('0x19')]=_0x4c71f3[_0x650a('0x19')];this[_0x650a('0x1a')]=_0x4c71f3[_0x650a('0x1a')];this['recallme']=_0x4c71f3[_0x650a('0x1b')];this['ContactId']=_0x4c71f3[_0x650a('0x1c')];this[_0x650a('0x1d')]=_0x4c71f3[_0x650a('0x1d')];this[_0x650a('0x1e')]=_0x4c71f3[_0x650a('0x1e')];this[_0x650a('0x1f')]=_0x4c71f3[_0x650a('0x1f')];this[_0x650a('0x20')]=_0x4c71f3[_0x650a('0x20')];this[_0x650a('0x21')]=_0x4c71f3[_0x650a('0x21')]||'';this[_0x650a('0x22')]=_0x4c71f3[_0x650a('0x22')]||'';}module[_0x650a('0x23')]=Final; \ No newline at end of file +var _0xd6d6=['util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x374e14,_0x1dcd37){var _0x4b42a8=function(_0x3945dd){while(--_0x3945dd){_0x374e14['push'](_0x374e14['shift']());}};_0x4b42a8(++_0x1dcd37);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5e23c9,_0x216339){_0x5e23c9=_0x5e23c9-0x0;var _0x580e4c=_0xd6d6[_0x5e23c9];return _0x580e4c;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));function getSeconds(_0x33226e,_0x536523){var _0x2e1aed=moment(_0x33226e)[_0x6d6d('0x3')](0x0);var _0x1b8610=moment(_0x536523)[_0x6d6d('0x3')](0x0);return _0x2e1aed[_0x6d6d('0x4')](_0x1b8610,_0x6d6d('0x5'));}function Final(_0x35a813){this['uniqueid']=_0x35a813[_0x6d6d('0x6')];this[_0x6d6d('0x7')]=_0x35a813[_0x6d6d('0x7')];this[_0x6d6d('0x8')]=_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0x9')]=_0x35a813[_0x6d6d('0x8')]==='outbound'?'queue':_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0xa')]=_0x35a813[_0x6d6d('0xa')];this[_0x6d6d('0xb')]=_0x35a813[_0x6d6d('0xb')];this['countnoanswerretry']=_0x35a813[_0x6d6d('0xc')];this[_0x6d6d('0xd')]=_0x35a813['countbusyretry']+_0x35a813['countcongestionretry']+_0x35a813[_0x6d6d('0xc')]+_0x35a813[_0x6d6d('0xe')]+_0x35a813[_0x6d6d('0xf')]+_0x35a813[_0x6d6d('0x10')]+_0x35a813[_0x6d6d('0x11')]+_0x35a813[_0x6d6d('0x12')];this[_0x6d6d('0xe')]=_0x35a813[_0x6d6d('0xe')];this['countdropretry']=_0x35a813[_0x6d6d('0xf')];this[_0x6d6d('0x10')]=_0x35a813[_0x6d6d('0x10')];this[_0x6d6d('0x11')]=_0x35a813[_0x6d6d('0x11')];this['countagentrejectretry']=_0x35a813[_0x6d6d('0x12')];this['queue']=_0x35a813[_0x6d6d('0x13')];this[_0x6d6d('0x14')]=_0x35a813[_0x6d6d('0x14')];this['calleridnum']=_0x35a813['calleridnum'];this[_0x6d6d('0x15')]=_0x35a813[_0x6d6d('0x15')];this[_0x6d6d('0x16')]=_0x35a813[_0x6d6d('0x16')];this['endtime']=_0x35a813['responsetime'];this[_0x6d6d('0x17')]=_0x35a813['ringtime']||0x0;this[_0x6d6d('0x18')]=_0x35a813[_0x6d6d('0x18')]||0x0;this[_0x6d6d('0x19')]=_0x35a813[_0x6d6d('0x19')]||0x0;this[_0x6d6d('0x1a')]=_0x35a813[_0x6d6d('0x1a')];this[_0x6d6d('0x1b')]=_0x35a813[_0x6d6d('0x1b')];this[_0x6d6d('0x1c')]=_0x35a813[_0x6d6d('0x1c')];this[_0x6d6d('0x1d')]=_0x35a813[_0x6d6d('0x1d')];this[_0x6d6d('0x1e')]=_0x35a813[_0x6d6d('0x1e')];this[_0x6d6d('0x1f')]=_0x35a813[_0x6d6d('0x1f')];this[_0x6d6d('0x20')]=_0x35a813['UserId'];this[_0x6d6d('0x21')]=_0x35a813[_0x6d6d('0x21')];this[_0x6d6d('0x22')]=_0x35a813[_0x6d6d('0x22')];this[_0x6d6d('0x23')]=_0x35a813[_0x6d6d('0x23')]||'';this['originatecalleridname']=_0x35a813[_0x6d6d('0x24')]||'';}module[_0x6d6d('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9ddcafa..34898db 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 _0x1719=['CampaignId','exports','util','lodash','moment','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x235af1,_0x2db468){var _0x3ba75d=function(_0x279c7f){while(--_0x279c7f){_0x235af1['push'](_0x235af1['shift']());}};_0x3ba75d(++_0x2db468);}(_0x1719,0x142));var _0x9171=function(_0x5c8a91,_0x17d6ce){_0x5c8a91=_0x5c8a91-0x0;var _0x4527c7=_0x1719[_0x5c8a91];return _0x4527c7;};'use strict';var util=require(_0x9171('0x0'));var _=require(_0x9171('0x1'));var moment=require(_0x9171('0x2'));function getSeconds(_0x834923,_0x3356dc){var _0x2b52fa=moment(_0x834923)[_0x9171('0x3')](0x0);var _0x9d1759=moment(_0x3356dc)['milliseconds'](0x0);return _0x2b52fa['diff'](_0x9d1759,'seconds');}function Hangup(_0x3bef2d,_0x27f850){this[_0x9171('0x4')]=0x4;this[_0x9171('0x5')]=_0x9171('0x6');this[_0x9171('0x7')]=_0x3bef2d[_0x9171('0x7')];this['type']=_0x3bef2d[_0x9171('0x8')];this[_0x9171('0x9')]=_0x3bef2d['type']==='outbound'?_0x9171('0xa'):_0x3bef2d['type'];this['countbusyretry']=_0x3bef2d['countbusyretry'];this['countcongestionretry']=_0x3bef2d['countcongestionretry'];this[_0x9171('0xb')]=_0x3bef2d['countnoanswerretry'];this['countglobal']=_0x3bef2d['countbusyretry']+_0x3bef2d['countcongestionretry']+_0x3bef2d[_0x9171('0xb')]+_0x3bef2d[_0x9171('0xc')]+_0x3bef2d['countdropretry']+_0x3bef2d['countabandonedretry']+_0x3bef2d['countmachineretry']+_0x3bef2d['countagentrejectretry'];this[_0x9171('0xc')]=_0x3bef2d[_0x9171('0xc')];this[_0x9171('0xd')]=_0x3bef2d['countdropretry'];this[_0x9171('0xe')]=_0x3bef2d[_0x9171('0xe')];this[_0x9171('0xf')]=_0x3bef2d[_0x9171('0xf')];this[_0x9171('0x10')]=_0x3bef2d[_0x9171('0x10')];this[_0x9171('0x11')]=_0x27f850[_0x9171('0x11')];this['calleridname']=_0x3bef2d[_0x9171('0x12')];this['calleridnum']=_0x3bef2d[_0x9171('0x13')];this[_0x9171('0x14')]=_0x3bef2d[_0x9171('0x14')];this[_0x9171('0x15')]=_0x3bef2d[_0x9171('0x15')];this[_0x9171('0x16')]=moment()['format'](_0x9171('0x17'));this[_0x9171('0x18')]=getSeconds(_0x3bef2d[_0x9171('0x15')],_0x3bef2d[_0x9171('0x14')]);this[_0x9171('0x19')]=0x0;this[_0x9171('0x1a')]=getSeconds(this[_0x9171('0x16')],_0x3bef2d[_0x9171('0x15')]);this[_0x9171('0xa')]=_0x3bef2d[_0x9171('0xa')];this[_0x9171('0x1b')]=_0x9171('0x1c');this[_0x9171('0x1d')]=_0x27f850[_0x9171('0x1e')];this[_0x9171('0x1f')]=_0x3bef2d[_0x9171('0x1f')];this[_0x9171('0x20')]=_0x3bef2d[_0x9171('0x20')];this[_0x9171('0x21')]=_0x3bef2d[_0x9171('0x21')];this['recallme']=_0x3bef2d['recallme'];this[_0x9171('0x22')]=_0x3bef2d['ContactId'];this[_0x9171('0x23')]=_0x3bef2d[_0x9171('0x23')];this[_0x9171('0x24')]=_0x3bef2d[_0x9171('0x24')];this[_0x9171('0x25')]=_0x3bef2d['VoiceQueueId'];this[_0x9171('0x26')]=_0x3bef2d[_0x9171('0x26')];}module[_0x9171('0x27')]=Hangup; \ No newline at end of file +var _0x04f0=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','IVR'];(function(_0x4c23a1,_0x5e630c){var _0x524a39=function(_0x23c008){while(--_0x23c008){_0x4c23a1['push'](_0x4c23a1['shift']());}};_0x524a39(++_0x5e630c);}(_0x04f0,0x1b9));var _0x004f=function(_0x428703,_0x629d2c){_0x428703=_0x428703-0x0;var _0x4e2caa=_0x04f0[_0x428703];return _0x4e2caa;};'use strict';var util=require(_0x004f('0x0'));var _=require(_0x004f('0x1'));var moment=require(_0x004f('0x2'));function getSeconds(_0xc6f257,_0x39be6f){var _0x5108ad=moment(_0xc6f257)[_0x004f('0x3')](0x0);var _0x4b5394=moment(_0x39be6f)[_0x004f('0x3')](0x0);return _0x5108ad['diff'](_0x4b5394,_0x004f('0x4'));}function Hangup(_0x4fb86a,_0x108687){this[_0x004f('0x5')]=0x4;this[_0x004f('0x6')]=_0x004f('0x7');this['scheduledat']=_0x4fb86a[_0x004f('0x8')];this[_0x004f('0x9')]=_0x4fb86a[_0x004f('0x9')];this[_0x004f('0xa')]=_0x4fb86a['type']===_0x004f('0xb')?_0x004f('0xc'):_0x4fb86a['type'];this[_0x004f('0xd')]=_0x4fb86a['countbusyretry'];this[_0x004f('0xe')]=_0x4fb86a[_0x004f('0xe')];this['countnoanswerretry']=_0x4fb86a[_0x004f('0xf')];this[_0x004f('0x10')]=_0x4fb86a[_0x004f('0xd')]+_0x4fb86a['countcongestionretry']+_0x4fb86a[_0x004f('0xf')]+_0x4fb86a[_0x004f('0x11')]+_0x4fb86a[_0x004f('0x12')]+_0x4fb86a[_0x004f('0x13')]+_0x4fb86a['countmachineretry']+_0x4fb86a[_0x004f('0x14')];this[_0x004f('0x11')]=_0x4fb86a[_0x004f('0x11')];this[_0x004f('0x12')]=_0x4fb86a['countdropretry'];this[_0x004f('0x13')]=_0x4fb86a['countabandonedretry'];this[_0x004f('0x15')]=_0x4fb86a[_0x004f('0x15')];this['countagentrejectretry']=_0x4fb86a[_0x004f('0x14')];this[_0x004f('0x16')]=_0x108687[_0x004f('0x16')];this['calleridname']=_0x4fb86a[_0x004f('0x17')];this[_0x004f('0x18')]=_0x4fb86a['number'];this[_0x004f('0x19')]=_0x4fb86a[_0x004f('0x19')];this[_0x004f('0x1a')]=_0x4fb86a[_0x004f('0x1a')];this[_0x004f('0x1b')]=moment()['format'](_0x004f('0x1c'));this[_0x004f('0x1d')]=getSeconds(_0x4fb86a[_0x004f('0x1a')],_0x4fb86a[_0x004f('0x19')]);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0x004f('0x1b')],_0x4fb86a[_0x004f('0x1a')]);this[_0x004f('0xc')]=_0x4fb86a['queue'];this[_0x004f('0x1e')]=_0x004f('0x1f');this[_0x004f('0x20')]=_0x108687['cause-txt'];this[_0x004f('0x21')]=_0x4fb86a[_0x004f('0x21')];this[_0x004f('0x22')]=_0x4fb86a[_0x004f('0x22')];this[_0x004f('0x23')]=_0x4fb86a[_0x004f('0x23')];this['recallme']=_0x4fb86a[_0x004f('0x24')];this[_0x004f('0x25')]=_0x4fb86a[_0x004f('0x25')];this['ListId']=_0x4fb86a[_0x004f('0x26')];this['UserId']=_0x4fb86a[_0x004f('0x27')];this[_0x004f('0x28')]=_0x4fb86a[_0x004f('0x28')];this['CampaignId']=_0x4fb86a[_0x004f('0x29')];}module[_0x004f('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e11ed2c..0684528 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 _0x19e6=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','name','number','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x46cd02,_0x1acf7b){var _0x332301=function(_0x2fb74e){while(--_0x2fb74e){_0x46cd02['push'](_0x46cd02['shift']());}};_0x332301(++_0x1acf7b);}(_0x19e6,0x1ac));var _0x619e=function(_0x5a8461,_0x7d8c37){_0x5a8461=_0x5a8461-0x0;var _0x248ed6=_0x19e6[_0x5a8461];return _0x248ed6;};'use strict';var util=require(_0x619e('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x27be54,_0x884981){var _0x12196d=moment(_0x27be54)[_0x619e('0x1')](0x0);var _0x37a236=moment(_0x884981)[_0x619e('0x1')](0x0);return _0x12196d[_0x619e('0x2')](_0x37a236,_0x619e('0x3'));}function History(_0x1cf640){this[_0x619e('0x4')]=_0x1cf640[_0x619e('0x4')];this[_0x619e('0x5')]=_0x1cf640[_0x619e('0x5')]||undefined;this[_0x619e('0x6')]=_0x1cf640['type'];this[_0x619e('0x7')]=_0x1cf640['type']===_0x619e('0x8')?_0x619e('0x9'):_0x1cf640[_0x619e('0x6')];this['countbusyretry']=_0x1cf640[_0x619e('0xa')];this[_0x619e('0xb')]=_0x1cf640[_0x619e('0xb')];this[_0x619e('0xc')]=_0x1cf640[_0x619e('0xc')];this[_0x619e('0xd')]=_0x1cf640[_0x619e('0xa')]+_0x1cf640[_0x619e('0xb')]+_0x1cf640['countnoanswerretry']+_0x1cf640[_0x619e('0xe')]+_0x1cf640[_0x619e('0xf')]+_0x1cf640[_0x619e('0x10')]+_0x1cf640['countmachineretry']+_0x1cf640[_0x619e('0x11')];this[_0x619e('0xe')]=_0x1cf640['countnosuchnumberretry'];this['countdropretry']=_0x1cf640[_0x619e('0xf')];this[_0x619e('0x10')]=_0x1cf640['countabandonedretry'];this[_0x619e('0x12')]=_0x1cf640[_0x619e('0x12')];this['countagentrejectretry']=_0x1cf640[_0x619e('0x11')];this[_0x619e('0x9')]=_0x1cf640['queue'];this['calleridname']=_0x1cf640[_0x619e('0x13')];this['calleridnum']=_0x1cf640[_0x619e('0x14')];this['starttime']=_0x1cf640['starttime'];this[_0x619e('0x15')]=_0x1cf640[_0x619e('0x15')];this[_0x619e('0x16')]=_0x1cf640[_0x619e('0x15')];this[_0x619e('0x17')]=getSeconds(_0x1cf640[_0x619e('0x15')],_0x1cf640['starttime']);this[_0x619e('0x18')]=0x0;this[_0x619e('0x19')]=0x0;this[_0x619e('0x1a')]=_0x1cf640[_0x619e('0x1a')];this[_0x619e('0x1b')]=_0x1cf640[_0x619e('0x1b')];this[_0x619e('0x1c')]=_0x1cf640[_0x619e('0x1c')];this[_0x619e('0x1d')]=_0x1cf640[_0x619e('0x1d')];this['ContactId']=_0x1cf640[_0x619e('0x1e')];this[_0x619e('0x1f')]=_0x1cf640[_0x619e('0x1f')];this[_0x619e('0x20')]=_0x1cf640['UserId'];this[_0x619e('0x21')]=_0x1cf640[_0x619e('0x21')];this[_0x619e('0x22')]=_0x1cf640[_0x619e('0x22')];this[_0x619e('0x23')]=_0x1cf640[_0x619e('0x23')]||'';this[_0x619e('0x24')]=_0x1cf640[_0x619e('0x24')]||'';}module[_0x619e('0x25')]=History; \ No newline at end of file +var _0x3c60=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3c60,0x14c));var _0x03c6=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0x3c60[_0x3e2489];return _0x2254ce;};'use strict';var util=require('util');var _=require(_0x03c6('0x0'));var moment=require(_0x03c6('0x1'));function getSeconds(_0x1f19fd,_0x1741ef){var _0x5b7053=moment(_0x1f19fd)['milliseconds'](0x0);var _0x55defe=moment(_0x1741ef)[_0x03c6('0x2')](0x0);return _0x5b7053['diff'](_0x55defe,_0x03c6('0x3'));}function History(_0x1b4ac7){this['uniqueid']=_0x1b4ac7[_0x03c6('0x4')];this['scheduledat']=_0x1b4ac7[_0x03c6('0x5')]||undefined;this[_0x03c6('0x6')]=_0x1b4ac7[_0x03c6('0x6')];this['campaigntype']=_0x1b4ac7[_0x03c6('0x6')]==='outbound'?_0x03c6('0x7'):_0x1b4ac7['type'];this[_0x03c6('0x8')]=_0x1b4ac7[_0x03c6('0x8')];this[_0x03c6('0x9')]=_0x1b4ac7[_0x03c6('0x9')];this[_0x03c6('0xa')]=_0x1b4ac7[_0x03c6('0xa')];this[_0x03c6('0xb')]=_0x1b4ac7[_0x03c6('0x8')]+_0x1b4ac7[_0x03c6('0x9')]+_0x1b4ac7[_0x03c6('0xa')]+_0x1b4ac7[_0x03c6('0xc')]+_0x1b4ac7[_0x03c6('0xd')]+_0x1b4ac7[_0x03c6('0xe')]+_0x1b4ac7[_0x03c6('0xf')]+_0x1b4ac7['countagentrejectretry'];this[_0x03c6('0xc')]=_0x1b4ac7[_0x03c6('0xc')];this[_0x03c6('0xd')]=_0x1b4ac7['countdropretry'];this[_0x03c6('0xe')]=_0x1b4ac7[_0x03c6('0xe')];this[_0x03c6('0xf')]=_0x1b4ac7[_0x03c6('0xf')];this[_0x03c6('0x10')]=_0x1b4ac7[_0x03c6('0x10')];this[_0x03c6('0x7')]=_0x1b4ac7[_0x03c6('0x7')];this[_0x03c6('0x11')]=_0x1b4ac7[_0x03c6('0x12')];this[_0x03c6('0x13')]=_0x1b4ac7[_0x03c6('0x14')];this[_0x03c6('0x15')]=_0x1b4ac7[_0x03c6('0x15')];this[_0x03c6('0x16')]=_0x1b4ac7[_0x03c6('0x16')];this[_0x03c6('0x17')]=_0x1b4ac7[_0x03c6('0x16')];this[_0x03c6('0x18')]=getSeconds(_0x1b4ac7['responsetime'],_0x1b4ac7[_0x03c6('0x15')]);this[_0x03c6('0x19')]=0x0;this[_0x03c6('0x1a')]=0x0;this[_0x03c6('0x1b')]=_0x1b4ac7[_0x03c6('0x1b')];this[_0x03c6('0x1c')]=_0x1b4ac7[_0x03c6('0x1c')];this[_0x03c6('0x1d')]=_0x1b4ac7['callbackat'];this[_0x03c6('0x1e')]=_0x1b4ac7['recallme'];this['ContactId']=_0x1b4ac7['ContactId'];this['ListId']=_0x1b4ac7[_0x03c6('0x1f')];this[_0x03c6('0x20')]=_0x1b4ac7[_0x03c6('0x20')];this[_0x03c6('0x21')]=_0x1b4ac7['VoiceQueueId'];this[_0x03c6('0x22')]=_0x1b4ac7[_0x03c6('0x22')];this['originatecalleridnum']=_0x1b4ac7[_0x03c6('0x23')]||'';this[_0x03c6('0x24')]=_0x1b4ac7[_0x03c6('0x24')]||'';}module[_0x03c6('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index db14d05..dc4ed1a 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 _0x8cb5=['pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice:queue:%s','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','preview','ivr','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','AMD','custom:amd','buildObj','amd','MACHINE','uniqueid','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countnosuchnumberretry','countabandonedretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','rescheduleContact','add','dialMachineRetryFrequency','minutes','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','actions','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','timezones','content','indexOf','iftime\x20%s,%s','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Failure','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','random','match','object','originate','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','round','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][MoveBlacklist]','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','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','Amax\x20=\x20','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','../ami','redis','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','answered','available','loggedIn'];(function(_0x581654,_0x53a95a){var _0x5ea1d0=function(_0xd0b09c){while(--_0xd0b09c){_0x581654['push'](_0x581654['shift']());}};_0x5ea1d0(++_0x53a95a);}(_0x8cb5,0x1c8));var _0x58cb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8cb5[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0x58cb('0x0'));var _=require(_0x58cb('0x1'));var BPromise=require(_0x58cb('0x2'));var uuid=require('uuid');var moment=require(_0x58cb('0x3'));var rr=require('rr');var md5=require(_0x58cb('0x4'));var Redis=require(_0x58cb('0x5'));var ut=require('../preview/util/util');var config=require(_0x58cb('0x6'));var logger=require(_0x58cb('0x7'))(_0x58cb('0x8'));var loggerBooked=require(_0x58cb('0x7'))(_0x58cb('0x9'));var loggerPredictive=require(_0x58cb('0x7'))(_0x58cb('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x58cb('0x7'))('syncQueueSummary');var ami=require(_0x58cb('0xb'));config[_0x58cb('0xc')]=_['defaults'](config[_0x58cb('0xc')],{'host':_0x58cb('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58cb('0xc')]));var cmHopper=require(_0x58cb('0xe'));var cmHopperHistory=require(_0x58cb('0xf'));var cmHopperBlack=require(_0x58cb('0x10'));var voiceQueueRt=require(_0x58cb('0x11'));var RpcSetting=require(_0x58cb('0x12'));var Action=require('./action');var History=require(_0x58cb('0x13'));var Final=require(_0x58cb('0x14'));var AgentComplete=require(_0x58cb('0x15'));var QueueCallerAbandon=require(_0x58cb('0x16'));var Hangup=require(_0x58cb('0x17'));var ipAgi=process[_0x58cb('0x18')][_0x58cb('0x19')]||_0x58cb('0x1a');var strategy={'rrmemory':_0x58cb('0x1b'),'roundrobin':_0x58cb('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x58cb('0x1d')][_0x58cb('0x1e')]=function(_0x1fa93){this['tail']=this[_0x58cb('0x1f')]?this['tail'][_0x58cb('0x20')](_0x1fa93):_0x1fa93();};function Dialer(_0x35eaa3,_0x587541){this['sequence']=new Sequence();this['preview']=_0x587541;this[_0x58cb('0x21')]=_0x35eaa3['voiceQueues'];this[_0x58cb('0x22')]=_0x35eaa3[_0x58cb('0x22')];this[_0x58cb('0x23')]=_0x35eaa3[_0x58cb('0x23')];this[_0x58cb('0x24')]=_0x35eaa3[_0x58cb('0x24')];this['maxNumberOriginate']=config[_0x58cb('0x25')]||0x2;this[_0x58cb('0x26')]={};this['actions']={};this['contactsId']={};this[_0x58cb('0x27')]={};this[_0x58cb('0x28')]={};this['startPredictive']={};this[_0x58cb('0x29')]={};this[_0x58cb('0x2a')]={};this[_0x58cb('0x2b')]={};this[_0x58cb('0x2c')]={};ami['on'](_0x58cb('0x2d'),this[_0x58cb('0x2e')][_0x58cb('0x2f')](this));ami['on'](_0x58cb('0x30'),this[_0x58cb('0x31')]['bind'](this));ami['on'](_0x58cb('0x32'),this['syncOriginateResponse'][_0x58cb('0x2f')](this));ami['on'](_0x58cb('0x33'),this[_0x58cb('0x34')][_0x58cb('0x2f')](this));ami['on'](_0x58cb('0x35'),this[_0x58cb('0x36')]['bind'](this));ami['on'](_0x58cb('0x37'),this['syncHangup']['bind'](this));ami['on'](_0x58cb('0x38'),this[_0x58cb('0x39')][_0x58cb('0x2f')](this));ami['on']('varset',this[_0x58cb('0x3a')][_0x58cb('0x2f')](this));ami['on']('queuemember',this[_0x58cb('0x3b')]['bind'](this));ami['on'](_0x58cb('0x3c'),this[_0x58cb('0x3d')]['bind'](this));this[_0x58cb('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0x58cb('0x3f')]()[_0x58cb('0x40')](function(_0x4c5c20){previewRecallmeReminderInterval=_0x4c5c20[_0x58cb('0x41')];});}function isNotNull(_0xad1bfa){return _0xad1bfa!==null&&!_['isUndefined'](_0xad1bfa);}function checkIsLoggedIn(_0x2dfa4f,_0x30ea14){return function(){if(_0x30ea14<=0x0){_0x2dfa4f[_0x58cb('0x42')]=_0x58cb('0x43');throw _0x2dfa4f[_0x58cb('0x44')]+_0x58cb('0x45');}};}function isActive(_0x1afe7a){return _0x1afe7a;}function checkIsActive(_0x581890,_0x12dfb9){return function(){if(!isActive(_0x12dfb9)){_0x581890['message']=_0x58cb('0x46');throw _0x581890[_0x58cb('0x44')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1241d7){return function(){if(!isNotNull(_0x1241d7[_0x58cb('0x47')])){_0x1241d7[_0x58cb('0x42')]=_0x58cb('0x48');throw _0x1241d7[_0x58cb('0x44')]+_0x58cb('0x49');}if(!isNotNull(_0x1241d7['Interval'][_0x58cb('0x4a')])){_0x1241d7[_0x58cb('0x42')]=_0x58cb('0x48');throw _0x1241d7[_0x58cb('0x44')]+_0x58cb('0x49');}if(!isNotNull(_[_0x58cb('0x4b')](_0x1241d7[_0x58cb('0x47')]['Intervals']))){_0x1241d7[_0x58cb('0x42')]='INTERVAL_IS_NULL';throw _0x1241d7[_0x58cb('0x44')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x505ad8,_0x5b9900,_0x575ac1){return{'action':_0x505ad8,'response':_0x5b9900,'message':_0x575ac1,'stack':_0x575ac1};}function myreject(_0x942fa6){return function(_0x537c87){return _0x942fa6(msgResponse(_0x58cb('0x4c'),_0x58cb('0x4d'),JSON[_0x58cb('0x4e')](_0x537c87)));};}function getSeconds(_0x56dd30,_0x3c9011){var _0x19fadb=moment(_0x56dd30)['milliseconds'](0x0);var _0x33213d=moment(_0x3c9011)[_0x58cb('0x4f')](0x0);return _0x19fadb[_0x58cb('0x50')](_0x33213d,_0x58cb('0x51'));}function emit(_0x5f34f7,_0x5442db,_0x1cb774){io['to'](_0x5f34f7)[_0x58cb('0x52')](_0x5442db,_0x1cb774);}function emitVoiceQueueSummary(_0x2e59d6){if(_0x2e59d6[_0x58cb('0x53')]==='outbound'){var _0x2b0f2c={'id':_0x2e59d6['id'],'name':_0x2e59d6['name'],'strategy':_0x2e59d6[_0x58cb('0x54')],'answered':_0x2e59d6[_0x58cb('0x55')],'available':_0x2e59d6[_0x58cb('0x56')],'loggedIn':_0x2e59d6[_0x58cb('0x57')],'pTalking':_0x2e59d6[_0x58cb('0x58')],'sumBillable':_0x2e59d6[_0x58cb('0x59')],'sumDuration':_0x2e59d6[_0x58cb('0x5a')],'sumHoldTime':_0x2e59d6['sumHoldTime']||0x0,'talking':_0x2e59d6[_0x58cb('0x5b')],'total':_0x2e59d6[_0x58cb('0x5c')],'type':_0x2e59d6[_0x58cb('0x53')],'unmanaged':_0x2e59d6[_0x58cb('0x5d')],'abandoned':_0x2e59d6[_0x58cb('0x5e')],'waiting':_0x2e59d6[_0x58cb('0x5f')],'loggedInDb':_0x2e59d6['loggedInDb'],'dialActive':_0x2e59d6['dialActive'],'dialMethod':_0x2e59d6[_0x58cb('0x60')],'dialOriginateCallerIdName':_0x2e59d6['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2e59d6[_0x58cb('0x61')],'dialOriginateTimeout':_0x2e59d6[_0x58cb('0x62')],'dialPrefix':_0x2e59d6[_0x58cb('0x63')],'outboundAnswerAgiCallsDay':_0x2e59d6[_0x58cb('0x64')],'outboundAnswerCallsDay':_0x2e59d6[_0x58cb('0x65')],'outboundBlacklistCallsDay':_0x2e59d6[_0x58cb('0x66')],'outboundBusyCallsDay':_0x2e59d6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2e59d6[_0x58cb('0x67')],'outboundDropCallsDayACS':_0x2e59d6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2e59d6[_0x58cb('0x68')],'outboundDropCallsDayTimeout':_0x2e59d6[_0x58cb('0x69')],'outboundNoAnswerCallsDay':_0x2e59d6[_0x58cb('0x6a')],'outboundNoSuchCallsDay':_0x2e59d6[_0x58cb('0x6b')],'outboundOriginateFailureCallsDay':_0x2e59d6[_0x58cb('0x6c')],'outboundReCallsDay':_0x2e59d6[_0x58cb('0x6d')],'outboundRejectCallsDay':_0x2e59d6[_0x58cb('0x6e')],'outboundUnknownCallsDay':_0x2e59d6[_0x58cb('0x6f')],'predictiveIntervalAnsweredCalls':_0x2e59d6[_0x58cb('0x70')],'predictiveIntervalAvgHoldtime':_0x2e59d6[_0x58cb('0x71')],'predictiveIntervalAvgTalktime':_0x2e59d6[_0x58cb('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0x2e59d6[_0x58cb('0x73')],'predictiveIntervalDroppedCallsTimeout':_0x2e59d6[_0x58cb('0x74')],'predictiveIntervalErlangCalls':_0x2e59d6['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2e59d6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x2e59d6[_0x58cb('0x75')],'predictiveIntervalMultiplicativeFactor':_0x2e59d6[_0x58cb('0x76')],'predictiveIntervalPauses':_0x2e59d6[_0x58cb('0x77')],'predictiveIntervalAvailable':_0x2e59d6[_0x58cb('0x78')],'predictiveIntervalTotalCalls':_0x2e59d6[_0x58cb('0x79')],'message':_0x2e59d6['message'],'originated':_0x2e59d6[_0x58cb('0x7a')],'erlangCalls':_0x2e59d6[_0x58cb('0x7b')],'erlangCallToSecond':_0x2e59d6['erlangCallToSecond'],'erlangAbandonmentRate':_0x2e59d6[_0x58cb('0x7c')],'erlangBusyFactor':_0x2e59d6[_0x58cb('0x7d')],'startPredictive':_0x2e59d6[_0x58cb('0x7e')],'startProgressive':_0x2e59d6[_0x58cb('0x29')]};if(_0x2e59d6[_0x58cb('0x7f')]){_0x2b0f2c[_0x58cb('0x7f')]={'id':_0x2e59d6[_0x58cb('0x7f')]['id'],'name':_0x2e59d6[_0x58cb('0x7f')]['name'],'active':_0x2e59d6[_0x58cb('0x7f')][_0x58cb('0x80')],'callerid':_0x2e59d6['Trunk'][_0x58cb('0x81')]};}if(_0x2e59d6[_0x58cb('0x47')]){_0x2b0f2c[_0x58cb('0x47')]={'id':_0x2e59d6[_0x58cb('0x47')]['id'],'name':_0x2e59d6[_0x58cb('0x47')][_0x58cb('0x44')]};}var _0x30d3c9=md5(JSON[_0x58cb('0x4e')](_0x2b0f2c));if(_0x2e59d6['md5']!==_0x30d3c9){_0x2e59d6[_0x58cb('0x4')]=_0x30d3c9;emit(util[_0x58cb('0x82')](_0x58cb('0x83'),_0x2b0f2c[_0x58cb('0x44')]),'voice_queue:save',_0x2b0f2c);}}}function emitCampaignSummary(_0x41e6c8){if(_0x41e6c8[_0x58cb('0x53')]==='ivr'){emit(util[_0x58cb('0x82')](_0x58cb('0x84'),_0x41e6c8[_0x58cb('0x44')]),'campaign:save',_0x41e6c8);}}function checkGetDataPredictive(_0x108b7a){if(isNotNull(_0x108b7a)&&!_[_0x58cb('0x4b')](_0x108b7a)){loggerPredictive[_0x58cb('0x85')](_0x58cb('0x86'));loggerPredictive[_0x58cb('0x85')](_0x58cb('0x87'),_0x108b7a[_0x58cb('0x79')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x108b7a[_0x58cb('0x70')]);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x88'),_0x108b7a[_0x58cb('0x74')]);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x89'),_0x108b7a[_0x58cb('0x73')]);loggerPredictive['info'](_0x58cb('0x8a'),_0x108b7a['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x8b'),_0x108b7a[_0x58cb('0x72')]);loggerPredictive[_0x58cb('0x85')]('---------------------------');if(_0x108b7a[_0x58cb('0x79')]>0x0){if(!_[_0x58cb('0x8c')](_0x108b7a[_0x58cb('0x72')])&&_0x108b7a[_0x58cb('0x72')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x58cb('0x8c')](_0x108b7a[_0x58cb('0x71')])&&_0x108b7a[_0x58cb('0x71')]>0x0){return!![];}loggerPredictive['info'](_0x58cb('0x8d'));}else{loggerPredictive[_0x58cb('0x85')](_0x58cb('0x8e'));}}else{loggerPredictive['info'](_0x58cb('0x8f'));}return![];}function mergeDataErlangB(_0x5bd76d){return function(_0x4d0377){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x58cb('0x90'),_0x4d0377[_0x58cb('0x7b')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d0377[_0x58cb('0x91')]);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x92'),_0x4d0377['erlangAbandonmentRate']);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x93'),_0x4d0377[_0x58cb('0x7d')]);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x92'),_0x4d0377[_0x58cb('0x7c')]);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x94'));_[_0x58cb('0x95')](_0x5bd76d,_0x4d0377);};}function getDiff(_0x24d935){var _0x4222cb=moment()[_0x58cb('0x4f')](0x0);var _0x4220f2=moment(_0x24d935)[_0x58cb('0x4f')](0x0);return _0x4222cb[_0x58cb('0x50')](_0x4220f2,'seconds');}function ifInterval(_0x23ae3e,_0x553eaf){if(_[_0x58cb('0x8c')](_0x553eaf)){return![];}return getDiff(_0x553eaf)<_0x23ae3e*0x3c;}function freeVariablesPredictive(_0x2ca3d6){if(isNotNull(_0x2ca3d6)){if(!_[_0x58cb('0x8c')](_0x2ca3d6[_0x58cb('0x29')])){_0x2ca3d6[_0x58cb('0x29')]=undefined;loggerPredictive[_0x58cb('0x85')](_0x2ca3d6[_0x58cb('0x44')],_0x58cb('0x96'));}if(!_['isUndefined'](_0x2ca3d6[_0x58cb('0x7e')])){_0x2ca3d6[_0x58cb('0x7e')]=undefined;loggerPredictive[_0x58cb('0x85')](_0x2ca3d6[_0x58cb('0x44')],_0x58cb('0x97'));}if(!_[_0x58cb('0x8c')](_0x2ca3d6[_0x58cb('0x98')])){clearInterval(_0x2ca3d6[_0x58cb('0x98')]);_0x2ca3d6['handlePredictive']=undefined;loggerPredictive[_0x58cb('0x85')](_0x2ca3d6['name'],_0x58cb('0x99'));}}}function erlangb(_0x5692ab,_0xddd7fc){if(_0xddd7fc===0x0){return 0x0;}var _0x23f098=0x1;for(var _0x11f2c8=0x1;_0x11f2c8<=_0xddd7fc;_0x11f2c8+=0x1){_0x23f098=0x1+_0x23f098*_0x11f2c8/_0x5692ab;}return 0x1/_0x23f098;}function isVoiceQueueOutbound(_0x28ffc3){return _0x28ffc3===_0x58cb('0x9a');}function isNotPreview(_0x459f38){return _0x459f38!==_0x58cb('0x9b');}function isCampaignIvr(_0x3f87ba){return _0x3f87ba===_0x58cb('0x9c');}function getCallerId(_0x43a39a,_0x4a04b8,_0x5c0564){if(!_['isUndefined'](_0x5c0564)&&typeof _0x5c0564==='string'&&!_[_0x58cb('0x4b')](_0x5c0564)){if(!_[_0x58cb('0x8c')](_0x4a04b8)&&typeof _0x4a04b8==='string'&&!_[_0x58cb('0x4b')](_0x4a04b8)){return util[_0x58cb('0x82')](_0x58cb('0x9d'),_0x4a04b8,_0x5c0564);}return util[_0x58cb('0x82')](_0x58cb('0x9d'),_0x5c0564,_0x5c0564);}if(!_[_0x58cb('0x8c')](_0x43a39a)&&typeof _0x43a39a==='string'&&!_[_0x58cb('0x4b')](_0x43a39a)){return _0x43a39a;}return _0x58cb('0x9e');}function loggerCatchQueueSummary(_0x4c7e87,_0x30b3c3){return function(_0x488b32){freeVariablesPredictive(_0x30b3c3);emitVoiceQueueSummary(_0x30b3c3);emitCampaignSummary(_0x30b3c3);loggerSyncQueueSummary[_0x58cb('0x9f')](_0x4c7e87,util[_0x58cb('0xa0')](_0x488b32,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4532c3,_0x33ed23){return function(_0x439e67){loggerPredictive[_0x58cb('0x9f')](_0x33ed23['name'],_0x4532c3);loggerPredictive[_0x58cb('0x9f')](_0x439e67[_0x58cb('0xa1')]);freeVariablesPredictive(_0x33ed23);};}function loggerCatch(_0x24b8df){return function(_0x2a2482){logger[_0x58cb('0x9f')](_0x24b8df,util[_0x58cb('0xa0')](_0x2a2482,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x387a2c){return _0x387a2c&&!_[_0x58cb('0x8c')](_0x387a2c)&&_0x387a2c[_0x58cb('0xa2')]>0x0;}function decremetOriginate(_0x3c8b9c){if(!_[_0x58cb('0x8c')](_0x3c8b9c)&&_0x3c8b9c!==null){if(typeof _0x3c8b9c[_0x58cb('0x7a')]!==_0x58cb('0xa3')){if(_0x3c8b9c[_0x58cb('0x7a')]>0x0){_0x3c8b9c[_0x58cb('0x7a')]-=0x1;}else{logger['error'](_0x58cb('0xa4'));}}}else{logger[_0x58cb('0x9f')](_0x58cb('0xa5'));}}function checkContactLowerLimitOriginate(_0x3a32c6,_0x48f199,_0x58d880){if(_0x48f199>_0x58d880){for(var _0x34ffb7=0x0;_0x34ffb7<_0x48f199-_0x58d880;_0x34ffb7+=0x1){decremetOriginate(_0x3a32c6);}}}function loggerGetContactDialer(_0x43cad5,_0x43fa5e,_0x2b0a01){return function(_0x2ad4d6){checkContactLowerLimitOriginate(_0x43fa5e,_0x2b0a01,0x0);logger[_0x58cb('0x9f')](_0x43cad5,util[_0x58cb('0xa0')](_0x2ad4d6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x30ef8d){return function(_0x1ca20b){if(isNotNull(_0x1ca20b)&&isNotNull(_0x1ca20b[0x0])){if(_0x1ca20b[0x0]['contactsRescheduled']>0x0){_0x30ef8d['message']=_0x58cb('0xa6');logger['info'](_0x58cb('0xa7')+_0x30ef8d[_0x58cb('0x44')],_0x1ca20b[0x0][_0x58cb('0xa8')],_0x58cb('0xa9'));}else{_0x30ef8d['message']=_0x58cb('0xaa');logger['info'](_0x58cb('0xab')+_0x30ef8d[_0x58cb('0x44')]);}}};}function notSendMessagesQueue(_0x3956bb){if(_0x3956bb[_0x58cb('0xac')]){freeVariablesPredictive(_0x3956bb);if(_0x3956bb[_0x58cb('0x7a')]===0x0&&_0x3956bb[_0x58cb('0x5b')]===0x0&&_0x3956bb['waiting']===0x0&&(_0x3956bb[_0x58cb('0x58')]||0x0)===0x0){_0x3956bb[_0x58cb('0xac')]=![];_0x3956bb[_0x58cb('0x56')]=0x0;_0x3956bb[_0x58cb('0x42')]=_0x58cb('0x46');loggerSyncQueueSummary[_0x58cb('0x9f')](_0x58cb('0xad'),_0x3956bb[_0x58cb('0x44')],_0x58cb('0xae'));}else{_0x3956bb['message']=_0x58cb('0xaf');loggerSyncQueueSummary['error'](_0x58cb('0xad'),_0x3956bb[_0x58cb('0x44')],_0x58cb('0xb0'));}emitVoiceQueueSummary(_0x3956bb);}}function notSendMessagesCampaign(_0x395a76){if(_0x395a76[_0x58cb('0xac')]){if(_0x395a76[_0x58cb('0x7a')]===0x0){_0x395a76[_0x58cb('0xac')]=![];_0x395a76[_0x58cb('0x42')]=_0x58cb('0x46');loggerSyncQueueSummary[_0x58cb('0x9f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x395a76[_0x58cb('0x44')],'is\x20not\x20active');}else{_0x395a76[_0x58cb('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x58cb('0x9f')](_0x58cb('0xb1'),_0x395a76[_0x58cb('0x44')],_0x58cb('0xb0'));}emitCampaignSummary(_0x395a76);}}function createObjHistory(_0x2d505c,_0x2dae2b,_0x57f91e,_0x18b625,_0x35cdee){_0x2d505c[_0x58cb('0x42')]=_0x57f91e;var _0x40d2ce=new Action(_0x2d505c,_0x2dae2b);var _0x59eb12=new History(_0x40d2ce);_0x59eb12[_0x58cb('0xb2')]=_0x18b625;_0x59eb12[_0x58cb('0xb3')]=_0x35cdee;_0x59eb12[_0x58cb('0xb4')]=_0x40d2ce[_0x58cb('0xb5')];return _0x59eb12;}Dialer[_0x58cb('0x1d')][_0x58cb('0xb6')]=function(){var _0x487cf4=this;setInterval(function(){_0x487cf4[_0x58cb('0xb7')](_0x487cf4[_0x58cb('0x27')],_0x58cb('0xb8'));_0x487cf4[_0x58cb('0xb7')](_0x487cf4['actions'],_0x58cb('0xb9'));},0x32c8);};Dialer[_0x58cb('0x1d')][_0x58cb('0xb7')]=function(_0x5ef8d1,_0x1cfe2f){var _0x22fb36=this;for(var _0xb5ceb4 in _0x5ef8d1){if(typeof _0x5ef8d1[_0xb5ceb4]!==_0x58cb('0xa3')){this[_0x58cb('0xba')][_0x58cb('0x1e')](function(){if(!_[_0x58cb('0xbb')](_0x5ef8d1[_0xb5ceb4])){return ami[_0x58cb('0xbc')]({'action':_0x58cb('0xbd'),'channel':_0x5ef8d1[_0xb5ceb4][_0x58cb('0xbe')]})[_0x58cb('0xbf')](function(_0x3c6c04){if(_0x3c6c04['message']===_0x58cb('0xc0')){setTimeout(function(){if(_0x5ef8d1[_0xb5ceb4]&&_0x5ef8d1[_0xb5ceb4][_0x58cb('0x53')]!=='ivr'){_0x22fb36[_0x58cb('0xc1')](_0x22fb36[_0x58cb('0x21')][_0x5ef8d1[_0xb5ceb4][_0x58cb('0xc2')]]);logger['error'](_0x58cb('0xc3'),_0x1cfe2f,_0xb5ceb4,_0x5ef8d1[_0xb5ceb4][_0x58cb('0xc2')]);delete _0x5ef8d1[_0xb5ceb4];}if(_0x5ef8d1[_0xb5ceb4]&&_0x5ef8d1[_0xb5ceb4][_0x58cb('0x53')]==='ivr'){_0x22fb36[_0x58cb('0xc1')](_0x22fb36[_0x58cb('0x22')][_0x5ef8d1[_0xb5ceb4]['queue']]);logger[_0x58cb('0x9f')](_0x58cb('0xc4'),_0x1cfe2f,_0xb5ceb4,_0x5ef8d1[_0xb5ceb4]['queue']);delete _0x5ef8d1[_0xb5ceb4];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x2b19c8){return BPromise[_0x58cb('0xc5')]()[_0x58cb('0x40')](cmHopper['countReScheduled'](_0x2b19c8))[_0x58cb('0xbf')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x58cb('0xc6')]=function(_0x5923bc){return BPromise[_0x58cb('0xc5')]()['then'](cmHopperBlack['checkIsBlackList'](_0x5923bc))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xc7')));};Dialer['prototype'][_0x58cb('0xc8')]=function(_0x26107d){return BPromise['resolve']()[_0x58cb('0x40')](cmHopperBlack[_0x58cb('0xc8')](_0x26107d))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xc9')));};Dialer['prototype'][_0x58cb('0xca')]=function(_0x4ffea1){return BPromise[_0x58cb('0xc5')]()['then'](cmHopperHistory[_0x58cb('0xcb')](_0x4ffea1))['catch'](loggerCatch(_0x58cb('0xcc')));};Dialer[_0x58cb('0x1d')]['rescheduleContact']=function(_0x487644){return BPromise[_0x58cb('0xc5')]()[_0x58cb('0x40')](cmHopper['rescheduleContact'](_0x487644))[_0x58cb('0xbf')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x58cb('0xcd')]=function(_0x1c56d6,_0x2361c1,_0x3a45ad){return BPromise[_0x58cb('0xc5')]()[_0x58cb('0x40')](cmHopper['unlockContact'](_0x1c56d6,_0x2361c1,_0x3a45ad))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xce')));};Dialer[_0x58cb('0x1d')][_0x58cb('0xcf')]=function(_0x7abc9c,_0xa85f20,_0x2130df,_0x1fc4df,_0x3b1706){return BPromise['resolve']()[_0x58cb('0x40')](cmHopper[_0x58cb('0xcf')](_0x7abc9c,_0xa85f20,_0x2130df,_0x1fc4df))['catch'](function(_0x9058aa){_0x3b1706[_0x58cb('0xd0')]-=_0x2130df;_0x3b1706[_0x58cb('0xd0')]=_0x3b1706[_0x58cb('0xd0')]>0x0?_0x3b1706[_0x58cb('0xd0')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x9058aa);});};Dialer[_0x58cb('0x1d')][_0x58cb('0xd1')]=function(_0x3758d1,_0x28926b,_0x8bbfb3,_0x428c40){return BPromise['resolve']()[_0x58cb('0x40')](cmHopper[_0x58cb('0xd1')](_0x3758d1,_0x28926b,_0x8bbfb3))[_0x58cb('0xbf')](function(_0x1c6ea4){_0x428c40['temp']-=_0x28926b;_0x428c40['temp']=_0x428c40['temp']>0x0?_0x428c40[_0x58cb('0xd0')]:0x0;loggerCatch(_0x58cb('0xd2'))(_0x1c6ea4);});};Dialer[_0x58cb('0x1d')][_0x58cb('0xd3')]=function(_0x2b5104){return BPromise[_0x58cb('0xc5')]()[_0x58cb('0x40')](voiceQueueRt[_0x58cb('0xd3')](_0x2b5104))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xd4')));};Dialer[_0x58cb('0x1d')][_0x58cb('0xd5')]=function(_0x196426){return BPromise[_0x58cb('0xc5')]()[_0x58cb('0x40')](cmHopper[_0x58cb('0xd5')](_0x196426))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xd6')));};Dialer[_0x58cb('0x1d')][_0x58cb('0xd7')]=function(_0x242cec){return BPromise['resolve']()[_0x58cb('0x40')](cmHopperHistory['createHistory'](_0x242cec))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xd8')));};Dialer[_0x58cb('0x1d')][_0x58cb('0xc1')]=function(_0x194740){if(!_[_0x58cb('0x8c')](_0x194740)&&_0x194740!==null){if(typeof _0x194740[_0x58cb('0x7a')]!==_0x58cb('0xa3')){if(_0x194740[_0x58cb('0x7a')]>0x0){_0x194740[_0x58cb('0x7a')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x58cb('0x9f')](_0x58cb('0xd9'));}};Dialer['prototype'][_0x58cb('0xda')]=function(_0x2e3380,_0x399419){var _0x356b42=this;return function(_0x3ab267){_0x356b42[_0x58cb('0xc1')](_0x399419);logger[_0x58cb('0x9f')](_0x2e3380,util[_0x58cb('0xa0')](_0x3ab267,{'showHidden':![],'depth':null}));};};Dialer[_0x58cb('0x1d')]['emptyContact']=function(_0x4c2510,_0x5959a6,_0x32918a){var _0x3b59f7={'state':0x19,'statedesc':'notFound'};this[_0x58cb('0xc1')](_0x5959a6);this[_0x58cb('0xdb')](_[_0x58cb('0x95')](_0x3b59f7,_[_0x58cb('0xdc')](_0x32918a,[_0x58cb('0xdd'),'ListId',_0x58cb('0xde'),_0x58cb('0xdf'),_0x58cb('0xe0')])),_0x58cb('0xe1'),'[emptyContact]');logger['error'](_0x4c2510);};Dialer[_0x58cb('0x1d')][_0x58cb('0xe2')]=function(_0x311956){return _0x311956===_0x58cb('0xe3');};Dialer[_0x58cb('0x1d')][_0x58cb('0xe4')]=function(_0xbdea2c){return!_['isUndefined'](_0xbdea2c)&&_0xbdea2c&&!_[_0x58cb('0x8c')](_0xbdea2c['name'])&&!_[_0x58cb('0x8c')](_0xbdea2c[_0x58cb('0x80')])&&_0xbdea2c[_0x58cb('0x80')]&&(this[_0x58cb('0x24')][util['format'](_0x58cb('0xe5'),_0xbdea2c[_0x58cb('0x44')])][_0x58cb('0xbd')]===_0x58cb('0xe6')||this['trunks'][util[_0x58cb('0x82')](_0x58cb('0xe5'),_0xbdea2c[_0x58cb('0x44')])][_0x58cb('0xbd')]==='unmonitored');};Dialer[_0x58cb('0x1d')][_0x58cb('0xdb')]=function(_0x5ba9e4,_0x2445f1,_0x57f11f){this[_0x58cb('0xd7')](_0x5ba9e4)[_0x58cb('0xbf')](loggerCatch(_0x2445f1));this[_0x58cb('0xd5')](_0x5ba9e4)[_0x58cb('0xbf')](loggerCatch(_0x57f11f));};Dialer[_0x58cb('0x1d')][_0x58cb('0x3a')]=function(_0x2a5ae5){var _0x167b13=this[_0x58cb('0x27')][_0x2a5ae5['uniqueid']];var _0x4f3068;if(!_[_0x58cb('0xbb')](_0x2a5ae5)&&!_[_0x58cb('0xbb')](_0x2a5ae5[_0x58cb('0xe7')])&&!_[_0x58cb('0xbb')](_0x2a5ae5[_0x58cb('0xe7')][_0x58cb('0xe8')])&&_0x2a5ae5[_0x58cb('0xe9')]===_0x58cb('0xea')&&_0x167b13){if(_0x167b13['type']!==_0x58cb('0x9c')&&this[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]][_0x58cb('0xeb')]&&_0x2a5ae5[_0x58cb('0xec')]===_0x58cb('0xed')){delete this[_0x58cb('0x27')][_0x2a5ae5['uniqueid']];this[_0x58cb('0xc1')](this[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]]);this[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]][_0x58cb('0x65')]+=0x1;this[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4f3068=new Hangup(_0x167b13,_0x2a5ae5);_0x4f3068[_0x58cb('0xb2')]=0x12;_0x4f3068[_0x58cb('0xb3')]='HangupInAMD';_0x4f3068['membername']=_0x58cb('0xee');ami[_0x58cb('0x52')](_0x58cb('0xef'),ut[_0x58cb('0xf0')](_0x4f3068,_0x58cb('0xf1')));this[_0x58cb('0xdb')](_0x4f3068,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x167b13[_0x58cb('0x53')]!==_0x58cb('0x9c')&&this[_0x58cb('0x21')][_0x167b13['queue']][_0x58cb('0xeb')]&&_0x2a5ae5[_0x58cb('0xec')]===_0x58cb('0xf2')){var _0x40e5b0=this;return new BPromise(function(_0x11dbf1,_0x23105d){delete _0x40e5b0[_0x58cb('0x27')][_0x2a5ae5[_0x58cb('0xf3')]];_0x40e5b0[_0x58cb('0xc1')](_0x40e5b0['voiceQueues'][_0x167b13[_0x58cb('0xc2')]]);_0x40e5b0[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]]['outboundAnswerCallsDay']+=0x1;_0x40e5b0[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]][_0x58cb('0x64')]+=0x1;var _0x5153b6=_0x40e5b0[_0x58cb('0x21')][_0x167b13[_0x58cb('0xc2')]];var _0x49602a=new Hangup(_0x167b13,_0x2a5ae5);_0x49602a[_0x58cb('0xb2')]=0x13;_0x49602a[_0x58cb('0xb3')]='Machine';_0x49602a[_0x58cb('0xf4')]=_0x58cb('0xee');_0x49602a[_0x58cb('0xf5')]+=0x1;_0x49602a[_0x58cb('0xf6')]+=0x1;_0x49602a[_0x58cb('0xf1')]=!![];ami['emit'](_0x58cb('0xef'),ut[_0x58cb('0xf0')](_0x49602a,_0x58cb('0xf1')));_0x40e5b0[_0x58cb('0xd7')](_0x49602a)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xf7')));if(_0x49602a[_0x58cb('0xf8')]+_0x49602a[_0x58cb('0xf9')]+_0x49602a[_0x58cb('0xfa')]+_0x49602a['countnosuchnumberretry']+_0x49602a[_0x58cb('0xfb')]+_0x49602a['countabandonedretry']+_0x49602a['countmachineretry']+_0x49602a['countagentrejectretry']>=_0x5153b6[_0x58cb('0xfc')]){_0x40e5b0['stateGlobal'](_0x49602a,_0x11dbf1,_0x23105d,_0x58cb('0xfd'));}else{if(_0x49602a[_0x58cb('0xf5')]>=_0x5153b6['dialMachineMaxRetry']){_0x40e5b0[_0x58cb('0xfe')](_0x49602a,_0x11dbf1,_0x23105d,_0x58cb('0xff'));}else{_0x40e5b0['rescheduleContact']({'active':![],'countmachineretry':_0x49602a[_0x58cb('0xf5')],'scheduledat':moment()['add'](_0x5153b6['dialMachineRetryFrequency'],'minutes')[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x49602a[_0x58cb('0xdd')],'ListId':_0x49602a[_0x58cb('0x101')],'VoiceQueueId':_0x49602a[_0x58cb('0xdf')]||undefined,'CampaignId':_0x49602a['CampaignId']||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x102')));_0x11dbf1({'reschedule':0x1});}}});}if(_0x167b13[_0x58cb('0x53')]===_0x58cb('0x9c')&&this[_0x58cb('0x22')][_0x167b13[_0x58cb('0xc2')]]['dialAMDActive']&&_0x2a5ae5[_0x58cb('0xec')]==='HANGUP'){delete this[_0x58cb('0x27')][_0x2a5ae5[_0x58cb('0xf3')]];this[_0x58cb('0xc1')](this['campaigns'][_0x167b13[_0x58cb('0xc2')]]);_0x4f3068=new Hangup(_0x167b13,_0x2a5ae5);_0x4f3068[_0x58cb('0xb2')]=0x12;_0x4f3068[_0x58cb('0xb3')]=_0x58cb('0x103');_0x4f3068[_0x58cb('0xf4')]='AMD';ami[_0x58cb('0x52')](_0x58cb('0xef'),ut[_0x58cb('0xf0')](_0x4f3068,_0x58cb('0xf1')));this[_0x58cb('0xdb')](_0x4f3068,_0x58cb('0x104'),_0x58cb('0x105'));}if(_0x167b13[_0x58cb('0x53')]==='ivr'&&this[_0x58cb('0x22')][_0x167b13['queue']]['dialAMDActive']&&_0x2a5ae5[_0x58cb('0xec')]===_0x58cb('0xf2')){var _0x40e5b0=this;return new BPromise(function(_0x155f61,_0x4e4b83){delete _0x40e5b0[_0x58cb('0x27')][_0x2a5ae5[_0x58cb('0xf3')]];_0x40e5b0[_0x58cb('0xc1')](_0x40e5b0[_0x58cb('0x22')][_0x167b13[_0x58cb('0xc2')]]);_0x40e5b0[_0x58cb('0x22')][_0x167b13['queue']][_0x58cb('0x65')]+=0x1;_0x40e5b0[_0x58cb('0x22')][_0x167b13['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x2f848c=_0x40e5b0[_0x58cb('0x22')][_0x167b13['queue']];var _0xc0365f=new Hangup(_0x167b13,_0x2a5ae5);_0xc0365f[_0x58cb('0xb2')]=0x13;_0xc0365f[_0x58cb('0xb3')]=_0x58cb('0x106');_0xc0365f[_0x58cb('0xf4')]=_0x58cb('0xee');_0xc0365f[_0x58cb('0xf5')]+=0x1;_0xc0365f['countglobal']+=0x1;_0xc0365f[_0x58cb('0xf1')]=!![];ami[_0x58cb('0x52')](_0x58cb('0xef'),ut[_0x58cb('0xf0')](_0xc0365f,_0x58cb('0xf1')));_0x40e5b0[_0x58cb('0xd7')](_0xc0365f)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0xf7')));if(_0xc0365f[_0x58cb('0xf8')]+_0xc0365f[_0x58cb('0xf9')]+_0xc0365f[_0x58cb('0xfa')]+_0xc0365f[_0x58cb('0x107')]+_0xc0365f[_0x58cb('0xfb')]+_0xc0365f[_0x58cb('0x108')]+_0xc0365f[_0x58cb('0xf5')]+_0xc0365f[_0x58cb('0x109')]>=_0x2f848c['dialGlobalMaxRetry']){_0x40e5b0[_0x58cb('0x10a')](_0xc0365f,_0x155f61,_0x4e4b83,_0x58cb('0xfd'));}else{if(_0xc0365f[_0x58cb('0xf5')]>=_0x2f848c[_0x58cb('0x10b')]){_0x40e5b0[_0x58cb('0xfe')](_0xc0365f,_0x155f61,_0x4e4b83,_0x58cb('0xff'));}else{_0x40e5b0[_0x58cb('0x10c')]({'active':![],'countmachineretry':_0xc0365f[_0x58cb('0xf5')],'scheduledat':moment()[_0x58cb('0x10d')](_0x2f848c[_0x58cb('0x10e')],_0x58cb('0x10f'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xc0365f[_0x58cb('0xdd')],'ListId':_0xc0365f[_0x58cb('0x101')],'VoiceQueueId':_0xc0365f['VoiceQueueId']||undefined,'CampaignId':_0xc0365f['CampaignId']||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x102')));_0x155f61({'reschedule':0x1});}}});}}};Dialer[_0x58cb('0x1d')][_0x58cb('0x110')]=function(_0x2890e1){var _0x42f47a=this[_0x58cb('0x27')][_0x2890e1[_0x58cb('0xf3')]];var _0x3f2a4a=this;var _0x21a98a;if(_0x42f47a&&_0x42f47a['type']===_0x58cb('0x9c')){delete this[_0x58cb('0x27')][_0x2890e1[_0x58cb('0xf3')]];this['updateOriginated'](this[_0x58cb('0x22')][_0x42f47a[_0x58cb('0xc2')]]);this['campaigns'][_0x42f47a[_0x58cb('0xc2')]]['ivrAnswerCallsDay']+=0x1;_0x21a98a=new Hangup(_0x42f47a,_0x2890e1);this[_0x58cb('0xd7')](_0x21a98a)['catch'](loggerCatch(_0x58cb('0x111')));this[_0x58cb('0xd5')](_0x21a98a)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x112')));}if(_0x42f47a&&_0x42f47a['type']!==_0x58cb('0x9c')&&isNotNull(this[_0x58cb('0x21')][_0x42f47a[_0x58cb('0xc2')]][_0x58cb('0x113')])){delete this[_0x58cb('0x27')][_0x2890e1[_0x58cb('0xf3')]];this[_0x58cb('0xc1')](this[_0x58cb('0x21')][_0x42f47a[_0x58cb('0xc2')]]);this['voiceQueues'][_0x42f47a[_0x58cb('0xc2')]][_0x58cb('0x65')]+=0x1;this[_0x58cb('0x21')][_0x42f47a[_0x58cb('0xc2')]][_0x58cb('0x64')]+=0x1;_0x21a98a=new Hangup(_0x42f47a,_0x2890e1);_0x21a98a['state']=0x10;_0x21a98a[_0x58cb('0xb3')]=_0x58cb('0x114');_0x21a98a[_0x58cb('0xf4')]=_0x58cb('0x115');this[_0x58cb('0xd7')](_0x21a98a)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x111')));this[_0x58cb('0xd5')](_0x21a98a)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x42f47a&&_0x42f47a[_0x58cb('0x53')]!=='ivr'&&!isNotNull(this[_0x58cb('0x21')][_0x42f47a[_0x58cb('0xc2')]][_0x58cb('0x113')])){delete this[_0x58cb('0x27')][_0x2890e1[_0x58cb('0xf3')]];this[_0x58cb('0xc1')](this[_0x58cb('0x21')][_0x42f47a[_0x58cb('0xc2')]]);this[_0x58cb('0x21')][_0x42f47a[_0x58cb('0xc2')]][_0x58cb('0x6f')]+=0x1;_0x21a98a=new Hangup(_0x42f47a,_0x2890e1);_0x21a98a[_0x58cb('0xb2')]=0xc;_0x21a98a[_0x58cb('0xb3')]=_0x2890e1[_0x58cb('0x116')];_0x21a98a[_0x58cb('0xf4')]='Unknow';this[_0x58cb('0xd7')](_0x21a98a)[_0x58cb('0xbf')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x58cb('0xd5')](_0x21a98a)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x112')));}};Dialer[_0x58cb('0x1d')][_0x58cb('0x34')]=function(_0x3243bb){var _0x4b1b28=this['uniqueId'][_0x3243bb['uniqueid']];var _0x159e09=this;if(this['voiceQueues'][_0x3243bb['queue']]){if(_0x4b1b28&&_0x4b1b28[_0x58cb('0x53')]!==_0x58cb('0x9c')){delete this[_0x58cb('0x27')][_0x3243bb[_0x58cb('0xf3')]];this[_0x58cb('0x21')][_0x3243bb[_0x58cb('0xc2')]]['outboundAnswerCallsDay']+=0x1;var _0x31599a=new AgentComplete(_0x4b1b28,_0x3243bb);if(_0x3243bb[_0x58cb('0x117')]===_0x58cb('0x118')){_0x31599a['agiafterat']=this[_0x58cb('0x21')][_0x3243bb[_0x58cb('0xc2')]][_0x58cb('0x119')]&&this['voiceQueues'][_0x3243bb[_0x58cb('0xc2')]][_0x58cb('0x11a')]?moment()[_0x58cb('0x82')](_0x58cb('0x100')):undefined;}this[_0x58cb('0xd7')](_0x31599a)['catch'](loggerCatch(_0x58cb('0x11b')));this[_0x58cb('0xd5')](_0x31599a)['catch'](loggerCatch(_0x58cb('0x11c')));}}};Dialer[_0x58cb('0x1d')][_0x58cb('0x2e')]=function(_0x2ced7a){if(this[_0x58cb('0x21')][_0x2ced7a[_0x58cb('0xc2')]]){if(this[_0x58cb('0x27')][_0x2ced7a['uniqueid']]&&this[_0x58cb('0x27')][_0x2ced7a['uniqueid']][_0x58cb('0x53')]!==_0x58cb('0x9c')){this[_0x58cb('0xc1')](this[_0x58cb('0x21')][_0x2ced7a['queue']]);this[_0x58cb('0x27')][_0x2ced7a[_0x58cb('0xf3')]][_0x58cb('0x11d')]=moment()[_0x58cb('0x82')](_0x58cb('0x100'));}}};Dialer['prototype'][_0x58cb('0x11e')]=function(_0x24adce){this[_0x58cb('0xd7')](_0x24adce)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x11b')));this['moveContactManagedDialer'](_0x24adce)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x11f')));};Dialer[_0x58cb('0x1d')][_0x58cb('0x31')]=function(_0x5ac52c){var _0x2b5238=this['uniqueId'][_0x5ac52c['uniqueid']];var _0xf20adf=this;if(this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]]){if(_0x2b5238&&_0x2b5238[_0x58cb('0x53')]!==_0x58cb('0x9c')){delete this[_0x58cb('0x27')][_0x5ac52c['uniqueid']];this[_0x58cb('0xc1')](this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]]);_0x2b5238['droptime']=moment()[_0x58cb('0x82')](_0x58cb('0x100'));var _0x40575a=new QueueCallerAbandon(_0x2b5238,_0x5ac52c);if(getSeconds(_0x2b5238[_0x58cb('0x120')],_0x2b5238[_0x58cb('0x121')])>=_0x2b5238['dialQueueTimeout']){this['voiceQueues'][_0x5ac52c['queue']][_0x58cb('0x74')]+=0x1;this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]][_0x58cb('0x69')]+=0x1;this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x40575a[_0x58cb('0xb2')]=0xa;_0x40575a[_0x58cb('0xb3')]=_0x58cb('0x122');_0x40575a['dropreason']=_0x58cb('0x123');_0x40575a['agiafterat']=this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]][_0x58cb('0x119')]?moment()['format'](_0x58cb('0x100')):undefined;_0x40575a[_0x58cb('0xfb')]+=0x1;_0x40575a[_0x58cb('0xf6')]+=0x1;if(_0x40575a[_0x58cb('0xfb')]>=this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]][_0x58cb('0x124')]){this[_0x58cb('0x11e')](_0x40575a);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x40575a['countdropretry'],'scheduledat':moment()[_0x58cb('0x10d')](this['voiceQueues'][_0x5ac52c['queue']][_0x58cb('0x125')],'minutes')[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x2b5238['ContactId'],'ListId':_0x2b5238[_0x58cb('0x101')],'VoiceQueueId':_0x2b5238[_0x58cb('0xdf')]||undefined,'CampaignId':_0x2b5238[_0x58cb('0xe0')]||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x126')));var _0x4d8673=new History(_0x40575a);_0x4d8673[_0x58cb('0xb2')]=0xa;_0x4d8673[_0x58cb('0xb3')]=_0x58cb('0x122');_0x4d8673[_0x58cb('0xb5')]=moment()[_0x58cb('0x82')](_0x58cb('0x100'));_0x4d8673[_0x58cb('0xb4')]=_0x4d8673[_0x58cb('0xb5')];_0x4d8673[_0x58cb('0x127')]=_0x40575a[_0x58cb('0x127')];_0x4d8673[_0x58cb('0x128')]=_0x40575a[_0x58cb('0x128')];this['createHistory'](_0x4d8673)['catch'](loggerCatch(_0x58cb('0x129')));}}else{this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]][_0x58cb('0x73')]+=0x1;this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]][_0x58cb('0x68')]+=0x1;_0x40575a['state']=0xb;_0x40575a['statedesc']='Abandoned';_0x40575a['dropreason']='CALLEREXIT';_0x40575a[_0x58cb('0x108')]+=0x1;_0x40575a[_0x58cb('0xf6')]+=0x1;if(_0x40575a[_0x58cb('0x108')]>=this[_0x58cb('0x21')][_0x5ac52c[_0x58cb('0xc2')]][_0x58cb('0x12a')]){this[_0x58cb('0x11e')](_0x40575a);}else{this[_0x58cb('0x10c')]({'active':![],'countabandonedretry':_0x40575a[_0x58cb('0x108')],'scheduledat':moment()[_0x58cb('0x10d')](this[_0x58cb('0x21')][_0x5ac52c['queue']][_0x58cb('0x12b')],_0x58cb('0x10f'))[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x2b5238[_0x58cb('0xdd')],'ListId':_0x2b5238[_0x58cb('0x101')],'VoiceQueueId':_0x2b5238[_0x58cb('0xdf')]||undefined,'CampaignId':_0x2b5238['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4d8673=new History(_0x40575a);_0x4d8673[_0x58cb('0xb2')]=0xb;_0x4d8673[_0x58cb('0xb3')]=_0x58cb('0x12c');_0x4d8673[_0x58cb('0xb5')]=moment()[_0x58cb('0x82')](_0x58cb('0x100'));_0x4d8673[_0x58cb('0xb4')]=_0x4d8673[_0x58cb('0xb5')];_0x4d8673[_0x58cb('0x127')]=_0x40575a['calleridname'];_0x4d8673[_0x58cb('0x128')]=_0x40575a[_0x58cb('0x128')];this[_0x58cb('0xd7')](_0x4d8673)['catch'](loggerCatch(_0x58cb('0x12d')));}}}}};Dialer['prototype'][_0x58cb('0x39')]=function(_0x2a2236){if(this['actions'][_0x2a2236[_0x58cb('0xf3')]]){this[_0x58cb('0x12e')][_0x2a2236[_0x58cb('0xf3')]]['channel']=_0x2a2236['channel'];}if(this['uniqueId'][_0x2a2236['uniqueid']]){this['uniqueId'][_0x2a2236[_0x58cb('0xf3')]][_0x58cb('0xbe')]=_0x2a2236[_0x58cb('0xbe')];}};Dialer['prototype'][_0x58cb('0x3b')]=function(_0x399458){if(strategy[this[_0x58cb('0x21')][this[_0x58cb('0x12e')][_0x399458[_0x58cb('0x12f')]][_0x58cb('0xc2')]][_0x58cb('0x54')]]==='roundrobin'){if(this['actions'][_0x399458['actionid']]&&_[_0x58cb('0xbb')](this[_0x58cb('0x12e')][_0x399458[_0x58cb('0x12f')]][_0x58cb('0x130')])&&_0x399458[_0x58cb('0xbd')]==='1'&&_0x399458[_0x58cb('0x131')]==='0'){if(this[_0x58cb('0x23')][_0x399458[_0x58cb('0x132')]]){if(!this['agents'][_0x399458['stateinterface']]['locked']){this['agents'][_0x399458['stateinterface']]['locked']=!![];this[_0x58cb('0x12e')][_0x399458['actionid']][_0x58cb('0x130')]=!![];this[_0x58cb('0x12e')][_0x399458['actionid']][_0x58cb('0x132')]=_0x399458[_0x58cb('0x132')];}}}}else if((strategy[this[_0x58cb('0x21')][this[_0x58cb('0x12e')][_0x399458[_0x58cb('0x12f')]][_0x58cb('0xc2')]]['strategy']]||_0x58cb('0x1b'))==='rrmemory'){if(this[_0x58cb('0x12e')][_0x399458[_0x58cb('0x12f')]]){if(this[_0x58cb('0x23')][_0x399458[_0x58cb('0x132')]]){this[_0x58cb('0x12e')][_0x399458['actionid']][_0x58cb('0x132')]=_0x399458[_0x58cb('0x132')];if(_[_0x58cb('0xbb')](this[_0x58cb('0x2b')][this[_0x58cb('0x12e')][_0x399458['actionid']][_0x58cb('0xc2')]])){this[_0x58cb('0x2b')][this[_0x58cb('0x12e')][_0x399458[_0x58cb('0x12f')]][_0x58cb('0xc2')]]=[];}this[_0x58cb('0x2b')][this[_0x58cb('0x12e')][_0x399458['actionid']][_0x58cb('0xc2')]][_0x58cb('0x133')](_['merge'](_[_0x58cb('0xdc')](this['actions'][_0x399458[_0x58cb('0x12f')]],[_0x58cb('0x134'),_0x58cb('0x132')]),{'status':_0x399458[_0x58cb('0xbd')],'paused':_0x399458[_0x58cb('0x131')]}));}}}};function unlockQueueStatus(_0x336250,_0x339186){setTimeout(function(){if(_[_0x58cb('0x8c')](_0x336250[_0x58cb('0x135')])){loggerBooked[_0x58cb('0x9f')]('[unlockQueueStatus][undefined]',_0x339186);}_0x336250[_0x58cb('0x135')]=!![];loggerBooked[_0x58cb('0x85')](_0x58cb('0x136'),_0x339186,JSON['stringify'](_[_0x58cb('0xdc')](_0x336250,[_0x58cb('0x44'),_0x58cb('0x135')])));},0x1f3);}Dialer[_0x58cb('0x1d')][_0x58cb('0x3d')]=function(_0x45566c){var _0x13c2eb=this;var _0x59825a=_0x13c2eb[_0x58cb('0x21')][_0x13c2eb[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]]['queue']];if(strategy[this[_0x58cb('0x21')][this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]][_0x58cb('0x54')]]===_0x58cb('0x1c')){if(this['actions'][_0x45566c[_0x58cb('0x12f')]]&&this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]]['stateinterface']){this[_0x58cb('0x9b')]['run'](this[_0x58cb('0x12e')][_0x45566c['actionid']][_0x58cb('0x134')],this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0x132')])[_0x58cb('0xbf')](function(_0x17bd6a){logger[_0x58cb('0x9f')](_0x58cb('0x137'),util[_0x58cb('0xa0')](_0x17bd6a,{'showHidden':![],'depth':null}));})[_0x58cb('0x20')](function(){_0x13c2eb['updateOriginated'](_0x13c2eb[_0x58cb('0x21')][_0x13c2eb[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]]);_0x13c2eb[_0x58cb('0x23')][_0x13c2eb['actions'][_0x45566c['actionid']][_0x58cb('0x132')]]['locked']=![];delete _0x13c2eb[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]];unlockQueueStatus(_0x59825a);});}else{this[_0x58cb('0xc1')](this['voiceQueues'][this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x45566c['actionid']][_0x58cb('0xdd')],'ListId':this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0x101')],'VoiceQueueId':this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xdf')]||undefined,'CampaignId':this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]]['CampaignId']||undefined})[_0x58cb('0xbf')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x58cb('0x12e')][_0x45566c['actionid']];unlockQueueStatus(_0x59825a);}}else if((strategy[this[_0x58cb('0x21')][this[_0x58cb('0x12e')][_0x45566c['actionid']][_0x58cb('0xc2')]][_0x58cb('0x54')]]||'rrmemory')==='rrmemory'){var _0x1014a1;if(this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]]&&!_[_0x58cb('0x4b')](this[_0x58cb('0x2b')][this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]]['queue']])){if(this[_0x58cb('0x2c')][_0x13c2eb[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]]){this['queueBookedRR'][_0x13c2eb[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]]=this[_0x58cb('0x2c')][this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]]?this[_0x58cb('0x2c')][this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]]:this[_0x58cb('0x2b')][this['actions'][_0x45566c['actionid']][_0x58cb('0xc2')]]?this[_0x58cb('0x2b')][this[_0x58cb('0x12e')][_0x45566c[_0x58cb('0x12f')]][_0x58cb('0xc2')]][_0x58cb('0x138')]||0x0:0x0;}this['queueBooked'][this[_0x58cb('0x12e')][_0x45566c['actionid']]['queue']][_0x58cb('0x138')]=this['queueBookedRR'][this[_0x58cb('0x12e')][_0x45566c['actionid']][_0x58cb('0xc2')]];for(var _0x200933=0x0;_0x200933=0x0;})[_0x58cb('0xbf')](myreject(_0x136c6d)));}}else{_0x1fee39[_0x58cb('0x133')](ami[_0x58cb('0xbc')]({'action':'command','command':util[_0x58cb('0x82')](_0x58cb('0x154'),_0x1d338c,!_[_0x58cb('0x8c')](config[_0x58cb('0x151')][_0x2c5c3b])?_0x2c5c3b:'')})[_0x58cb('0x40')](function(_0x4a7a9f){return _0x4a7a9f[_0x58cb('0x152')][_0x58cb('0x153')](_0x58cb('0x155'))>=0x0;})[_0x58cb('0xbf')](myreject(_0x136c6d)));}BPromise['all'](_0x1fee39)[_0x58cb('0x40')](function(_0x35e91b){var _0x1c6698=_[_0x58cb('0x156')](_0x35e91b);if(_0x1c6698){return _0x1e79f8(_0x1c6698);}else{_0x307251[_0x58cb('0x42')]=_0x3c93e0?_0x58cb('0x157'):_0x58cb('0x158');return _0x136c6d(msgResponse(_0x58cb('0x159'),_0x58cb('0x15a'),_0x58cb('0x15b')+_0x3c93e0+'\x20'+_0x6a96a8+_0x58cb('0x15c')+util[_0x58cb('0xa0')](_0x1d338c,{'showHidden':![],'depth':null})+_0x58cb('0x15d')+_0x2c5c3b));}})[_0x58cb('0xbf')](function(_0x44bb32){return _0x136c6d(msgResponse(_0x58cb('0x148'),_0x58cb('0x15a'),JSON[_0x58cb('0x4e')](_0x44bb32)));});});};Dialer['prototype'][_0x58cb('0x15e')]=function(_0x16f5b2){var _0x44fb64=this;return function(){switch(_0x16f5b2[_0x58cb('0x60')]){case _0x58cb('0x15f'):freeVariablesPredictive(_0x16f5b2);_0x44fb64[_0x58cb('0x160')](_0x16f5b2,0x1);break;case _0x58cb('0x161'):freeVariablesPredictive(_0x16f5b2);_0x44fb64['handlePower'](_0x16f5b2,_0x16f5b2['dialPowerLevel']);break;case'predictive':_0x44fb64[_0x58cb('0xa')](_0x16f5b2);break;case _0x58cb('0x9'):freeVariablesPredictive(_0x16f5b2);_0x44fb64[_0x58cb('0x160')](_0x16f5b2,0x1);break;default:freeVariablesPredictive(_0x16f5b2);logger[_0x58cb('0x9f')](_0x58cb('0x162'),_0x16f5b2['name'],_0x58cb('0x163'));}};};Dialer[_0x58cb('0x1d')][_0x58cb('0x164')]=function(_0x4f6eb9){return BPromise[_0x58cb('0xc5')]()[_0x58cb('0x40')](cmHopper[_0x58cb('0x165')](_0x4f6eb9['id'],previewRecallmeReminderInterval))[_0x58cb('0x40')](function(_0x44a1ef){for(var _0x23c048=0x0;_0x23c048<_0x44a1ef[_0x58cb('0xa2')];_0x23c048++){var _0x2b4115=_0x44a1ef[_0x23c048][_0x58cb('0x166')][_0x58cb('0x44')];if(_0x2b4115)io['to'](util['format'](_0x58cb('0x167'),_0x2b4115))['emit'](_0x58cb('0x168'),{'hopper':_0x44a1ef[_0x23c048]});}})[_0x58cb('0xbf')](function(_0x382116){});};Dialer['prototype'][_0x58cb('0x169')]=function(_0x526250){var _0x51a26d=this;return function(){_0x51a26d['handleIvr'](_0x526250);};};Dialer[_0x58cb('0x1d')]['syncQueueSummary']=function(_0x4257d0){var _0x3221cc=this;if(isNotPreview(_0x4257d0[_0x58cb('0x60')])){if(isVoiceQueueOutbound(_0x4257d0[_0x58cb('0x53')])&&isActive(_0x4257d0[_0x58cb('0x16a')])){_0x4257d0[_0x58cb('0xac')]=!![];BPromise['resolve']()[_0x58cb('0x40')](checkIsLoggedIn(_0x4257d0,_0x4257d0[_0x58cb('0x57')]))[_0x58cb('0x40')](checkIsActive(_0x4257d0,_0x4257d0[_0x58cb('0x16a')]))[_0x58cb('0x40')](checkInterval(_0x4257d0))[_0x58cb('0x40')](_0x3221cc[_0x58cb('0x144')](_0x4257d0))[_0x58cb('0x40')](_0x3221cc[_0x58cb('0x16b')](_0x4257d0[_0x58cb('0x16c')],_0x4257d0[_0x58cb('0x16d')],_0x4257d0[_0x58cb('0x44')],_0x4257d0))[_0x58cb('0x40')](_0x3221cc[_0x58cb('0x149')](_0x4257d0[_0x58cb('0x47')],_0x4257d0['dialTimezone'],_0x4257d0[_0x58cb('0x44')],_0x4257d0))[_0x58cb('0x40')](_0x3221cc[_0x58cb('0x15e')](_0x4257d0))[_0x58cb('0xbf')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4257d0));}else{notSendMessagesQueue(_0x4257d0);}}else{freeVariablesPredictive(_0x4257d0);if(_0x4257d0['dialPreviewRecallmeReminder']){_0x3221cc['checkPreviewRecallReminder'](_0x4257d0);}}};Dialer['prototype'][_0x58cb('0x143')]=function(){var _0x599cff=this;var _0x5574ff;for(var _0x5f15f6 in this['campaigns']){if(typeof this[_0x58cb('0x22')][_0x5f15f6]!==_0x58cb('0xa3')){_0x5574ff=this[_0x58cb('0x22')][_0x5f15f6];if(isCampaignIvr(_0x5574ff[_0x58cb('0x53')])&&isActive(_0x5574ff['active'])){_0x5574ff[_0x58cb('0xac')]=!![];BPromise['resolve']()[_0x58cb('0x40')](checkIsActive(_0x5574ff,_0x5574ff[_0x58cb('0x80')]))[_0x58cb('0x40')](checkInterval(_0x5574ff))['then'](_0x599cff[_0x58cb('0x144')](_0x5574ff))[_0x58cb('0x40')](_0x599cff['checkIfTime'](_0x5574ff[_0x58cb('0x16c')],_0x5574ff['dialTimezone'],_0x5574ff[_0x58cb('0x44')],_0x5574ff))[_0x58cb('0x40')](_0x599cff['checkIfTimeIntervals'](_0x5574ff[_0x58cb('0x47')],_0x5574ff[_0x58cb('0x16d')],_0x5574ff[_0x58cb('0x44')],_0x5574ff))[_0x58cb('0x40')](_0x599cff['launchHandleIvr'](_0x5574ff))[_0x58cb('0xbf')](loggerCatchQueueSummary(_0x58cb('0x16e'),_0x5574ff));}else{notSendMessagesCampaign(_0x5574ff);}}}};function getCallerIdRandom(_0x18de95,_0x8ca830){var _0x59e88f;var _0x3d1cdf;var _0x50dd23;if(_0x8ca830<=0x0){_0x8ca830=0x1;}_0x59e88f=new RegExp(_0x58cb('0x16f')+_0x8ca830+'}$');_0x3d1cdf=Math[_0x58cb('0x170')](0xa,_0x8ca830-0x1);_0x50dd23=Math[_0x58cb('0x170')](0xa,_0x8ca830)-0x1;return util['format']('%s',_['replace'](_0x18de95,_0x59e88f,_[_0x58cb('0x171')](_0x3d1cdf,_0x50dd23)));}function extractCalleridName(_0x21011d){var _0x36ebce=_0x21011d[_0x58cb('0x172')](/"(.*?)"/);return _0x36ebce?_0x36ebce[0x1]:_0x21011d;}function extractCalleridNumber(_0x409332){var _0x4c6043=_0x409332[_0x58cb('0x172')](/<(.*?)>/);return _0x4c6043?_0x4c6043[0x1]:_0x409332;}Dialer[_0x58cb('0x1d')]['actionOriginate']=function(_0x3a7941,_0x46e90c){var _0x3219e8=this;var _0x55fc85=uuid['v4']();this['actions'][_0x55fc85]=new Action(_0x3a7941,_0x46e90c,_0x55fc85);return new BPromise(function(_0x1198fd,_0x80710b){if(_[_0x58cb('0x8c')](_0x3a7941)&&typeof _0x3a7941!==_0x58cb('0x173')){return _0x80710b(msgResponse(_0x58cb('0x174'),_0x58cb('0x15a'),'voiceQueue\x20is\x20undefine'));}if(_[_0x58cb('0x8c')](_0x46e90c['Contact'][_0x58cb('0x175')])||_0x46e90c[_0x58cb('0x176')][_0x58cb('0x175')]===null){return _0x80710b(msgResponse('originate','Failure',_0x58cb('0x177')));}var _0x36ea18={'XMD-CALLERID':_0x3219e8['actions'][_0x55fc85][_0x58cb('0x178')](),'XMD-AGI':_0x3a7941[_0x58cb('0x113')]?util[_0x58cb('0x82')](_0x58cb('0x179'),ipAgi,_0x3a7941[_0x58cb('0x113')]):'NONE','XMD-AGIAFTER':_0x3a7941[_0x58cb('0x119')]?util[_0x58cb('0x82')](_0x58cb('0x179'),ipAgi,_0x3a7941['dialQueueProject2']):_0x58cb('0x17a'),'XMD-QUEUE':_0x3a7941[_0x58cb('0x53')]===_0x58cb('0x9a')?util[_0x58cb('0x82')](_0x58cb('0x17b'),_0x3a7941['name'],_0x3a7941[_0x58cb('0x17c')]||'',_0x3a7941[_0x58cb('0x11a')]?'c':'',_0x3a7941[_0x58cb('0x17d')]||0x3):_0x58cb('0x17a'),'XMD-CONTACTID':_0x46e90c['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3219e8[_0x58cb('0x12e')][_0x55fc85][_0x58cb('0x178')](),'XMD-AMD':_0x3a7941[_0x58cb('0xeb')]?_0x58cb('0x17e'):_0x58cb('0x17a'),'XMD-DESTINATION':_0x58cb('0xea')};if(_0x3a7941[_0x58cb('0xeb')]){_0x36ea18[_0x58cb('0x17f')]=_0x3a7941['dialAMDInitialSilence']||0x9c4;_0x36ea18[_0x58cb('0x180')]=_0x3a7941[_0x58cb('0x181')]||0x5dc;_0x36ea18[_0x58cb('0x182')]=_0x3a7941[_0x58cb('0x183')]||0x320;_0x36ea18['XMD-AMDTOTALANALYSISTIME']=_0x3a7941[_0x58cb('0x184')]||0x1388;_0x36ea18['XMD-AMDMINWORDLENGTH']=_0x3a7941[_0x58cb('0x185')]||0x64;_0x36ea18['XMD-AMDBETWEENWORDSSILENCE']=_0x3a7941[_0x58cb('0x186')]||0x32;_0x36ea18[_0x58cb('0x187')]=_0x3a7941[_0x58cb('0x188')]||0x3;_0x36ea18[_0x58cb('0x189')]=_0x3a7941[_0x58cb('0x18a')]||0x100;_0x36ea18['XMD-AMDMAXIMUMWORDLENGTH']=_0x3a7941['dialAMDMaximumWordLength']||0x1388;}if(_0x3a7941[_0x58cb('0x53')]===_0x58cb('0x9a')){_0x36ea18[_0x58cb('0x18b')]=_0x46e90c[_0x58cb('0xdf')];}else{_0x36ea18[_0x58cb('0x18c')]=_0x46e90c['CampaignId'];}for(var _0x47ec65 in _0x46e90c[_0x58cb('0x176')]){if(typeof _0x46e90c[_0x58cb('0x176')][_0x47ec65]!=='undefined'){if(isNotNull(_0x46e90c[_0x58cb('0x176')][_0x47ec65])&&_0x47ec65!=='id'&&_0x47ec65!=='tags'&&_0x47ec65!==_0x58cb('0x18d')&&_0x47ec65!==_0x58cb('0x18e')){_0x36ea18[util['format'](_0x58cb('0x18f'),_0x58cb('0x190'),_[_0x58cb('0x191')](_0x47ec65))]=_0x46e90c[_0x58cb('0x176')][_0x47ec65];}}}var _0x38a93e=_0x3219e8[_0x58cb('0xe4')](_0x3a7941[_0x58cb('0x7f')])?getCallerId(_0x3a7941[_0x58cb('0x7f')][_0x58cb('0x81')],_0x3a7941['dialOriginateCallerIdName'],_0x3a7941['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3a7941['dialOriginateCallerIdNumber'],_0x3a7941[_0x58cb('0x192')]):_0x3a7941[_0x58cb('0x61')]):getCallerId(_[_0x58cb('0xbb')](_0x3a7941['TrunkBackup'])?_0x3a7941[_0x58cb('0x7f')][_0x58cb('0x81')]:_0x3a7941[_0x58cb('0x145')]['callerid'],_0x3a7941[_0x58cb('0x193')],_0x3a7941[_0x58cb('0x192')]>0x0?getCallerIdRandom(_0x3a7941[_0x58cb('0x61')],_0x3a7941[_0x58cb('0x192')]):_0x3a7941[_0x58cb('0x61')]);if(_0x38a93e){_0x36ea18[_0x58cb('0x194')]=_0x3219e8[_0x58cb('0x12e')][_0x55fc85][_0x58cb('0x195')]=extractCalleridName(_0x38a93e);_0x36ea18[_0x58cb('0x196')]=_0x3219e8[_0x58cb('0x12e')][_0x55fc85][_0x58cb('0x197')]=extractCalleridNumber(_0x38a93e);}return ami[_0x58cb('0xbc')]({'actionid':_0x55fc85,'action':_0x58cb('0x174'),'channel':_0x3219e8[_0x58cb('0xe4')](_0x3a7941[_0x58cb('0x7f')])?util[_0x58cb('0x82')](_0x58cb('0x198'),_0x3a7941[_0x58cb('0x7f')][_0x58cb('0x44')],isNotNull(_0x3a7941[_0x58cb('0x63')])?_0x3a7941[_0x58cb('0x63')][_0x58cb('0x199')]()||'':'',_0x3a7941[_0x58cb('0x19a')]>0x0?_0x46e90c[_0x58cb('0x176')][_0x58cb('0x175')][_0x58cb('0x19b')](_0x3a7941[_0x58cb('0x19a')]):_0x46e90c['Contact'][_0x58cb('0x175')]):util[_0x58cb('0x82')](_0x58cb('0x198'),_[_0x58cb('0xbb')](_0x3a7941[_0x58cb('0x145')])?_0x3a7941[_0x58cb('0x7f')][_0x58cb('0x44')]:_0x3a7941[_0x58cb('0x145')]['name'],isNotNull(_0x3a7941[_0x58cb('0x63')])?_0x3a7941[_0x58cb('0x63')][_0x58cb('0x199')]()||'':'',_0x3a7941[_0x58cb('0x19a')]>0x0?_0x46e90c['Contact'][_0x58cb('0x175')][_0x58cb('0x19b')](_0x3a7941[_0x58cb('0x19a')]):_0x46e90c[_0x58cb('0x176')][_0x58cb('0x175')]),'callerid':_0x38a93e,'Exten':'xcally-motion-dialer','Context':_0x58cb('0x19c'),'Priority':'1','variable':_0x36ea18,'timeout':(_0x3a7941[_0x58cb('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55fc85})['then'](function(_0x5c4183){return _0x1198fd(_0x5c4183);})[_0x58cb('0xbf')](function(_0x3bd730){_0x3a7941[_0x58cb('0x6c')]+=0x1;var _0x1a1428=new History(_0x3219e8['actions'][_0x55fc85]);logger[_0x58cb('0x9f')](util[_0x58cb('0x82')](_0x58cb('0x19d'),JSON[_0x58cb('0x4e')](_0x3bd730)));_0x1a1428[_0x58cb('0xb2')]=0xe;_0x1a1428[_0x58cb('0xb3')]=_0x58cb('0x19e');_0x1a1428[_0x58cb('0xb5')]=moment()[_0x58cb('0x82')](_0x58cb('0x100'));_0x1a1428[_0x58cb('0xb4')]=_0x1a1428[_0x58cb('0xb5')];_0x3219e8[_0x58cb('0xd7')](_0x1a1428)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x19f')));_0x3219e8[_0x58cb('0xd5')](_0x1a1428)['catch'](loggerCatch(_0x58cb('0x19f')))['finally'](function(){delete _0x3219e8[_0x58cb('0x12e')][_0x55fc85];return _0x80710b(msgResponse('originate',_0x58cb('0x4d'),_0x58cb('0x1a0')));});});});};Dialer[_0x58cb('0x1d')][_0x58cb('0x1a1')]=function(_0x39c3ea){var _0x5b744d=this[_0x58cb('0x12e')][_0x39c3ea[_0x58cb('0x12f')]];if(_0x5b744d){delete this['actions'][_0x39c3ea[_0x58cb('0x12f')]];_0x5b744d[_0x58cb('0x121')]=moment()[_0x58cb('0x82')]('YYYY-MM-DD\x20HH:mm:ss');var _0x50ee9f=_0x5b744d[_0x58cb('0x53')]===_0x58cb('0x9c')?this[_0x58cb('0x22')][_0x5b744d['queue']]:this[_0x58cb('0x21')][_0x5b744d[_0x58cb('0x1a2')]()];if(!this[_0x58cb('0xe2')](_0x39c3ea[_0x58cb('0x1a3')])){this[_0x58cb('0xc1')](_0x50ee9f);return this[_0x58cb('0x1a4')](_0x5b744d,_0x50ee9f,_0x39c3ea)[_0x58cb('0xbf')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x58cb('0x27')][_0x39c3ea[_0x58cb('0xf3')]]=_0x5b744d;}};Dialer[_0x58cb('0x1d')][_0x58cb('0x1a5')]=function(_0x423f0f,_0x4e09d2,_0x528db4){var _0x397eb4=new History(_0x4e09d2);if(_0x397eb4[_0x58cb('0xf8')]+_0x397eb4[_0x58cb('0xf9')]+_0x397eb4[_0x58cb('0xfa')]+_0x397eb4['countnosuchnumberretry']+_0x397eb4[_0x58cb('0xfb')]+_0x397eb4[_0x58cb('0x108')]+_0x397eb4['countmachineretry']+_0x397eb4[_0x58cb('0x109')]>=_0x528db4[_0x58cb('0xfc')]-0x1){return!![];}switch(_0x423f0f){case 0x3:if(_0x397eb4[_0x58cb('0xfa')]>=_0x528db4[_0x58cb('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x397eb4[_0x58cb('0xfa')]+=0x1,'scheduledat':moment()[_0x58cb('0x10d')](_0x528db4['dialNoAnswerRetryFrequency'],_0x58cb('0x10f'))[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x397eb4['ContactId'],'ListId':_0x397eb4['ListId'],'VoiceQueueId':_0x397eb4['VoiceQueueId']||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})['catch'](loggerCatch(_0x58cb('0x1a7')));break;case 0x5:if(_0x397eb4[_0x58cb('0xf8')]>=_0x528db4[_0x58cb('0x1a8')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x397eb4[_0x58cb('0xf8')]+=0x1,'scheduledat':moment()[_0x58cb('0x10d')](_0x528db4[_0x58cb('0x1a9')],_0x58cb('0x10f'))[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4[_0x58cb('0x101')],'VoiceQueueId':_0x397eb4[_0x58cb('0xdf')]||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x397eb4['countcongestionretry']>=_0x528db4['dialCongestionMaxRetry']-0x1){return!![];}this[_0x58cb('0x10c')]({'active':![],'countcongestionretry':_0x397eb4[_0x58cb('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x528db4[_0x58cb('0x1aa')],'minutes')[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4[_0x58cb('0x101')],'VoiceQueueId':_0x397eb4['VoiceQueueId']||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x397eb4['countnosuchnumberretry']>=_0x528db4[_0x58cb('0x1ab')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x397eb4[_0x58cb('0x107')]+=0x1,'scheduledat':moment()[_0x58cb('0x10d')](_0x528db4[_0x58cb('0x1ac')],_0x58cb('0x10f'))[_0x58cb('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4[_0x58cb('0x101')],'VoiceQueueId':_0x397eb4[_0x58cb('0xdf')]||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1ad')));}break;case 0xa:if(_0x397eb4[_0x58cb('0xfb')]>=_0x528db4['dialDropMaxRetry']-0x1){return!![];}this[_0x58cb('0x10c')]({'active':![],'countdropretry':_0x397eb4[_0x58cb('0xfb')]+=0x1,'scheduledat':moment()[_0x58cb('0x10d')](_0x528db4['dialDropRetryFrequency'],_0x58cb('0x10f'))[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4[_0x58cb('0x101')],'VoiceQueueId':_0x397eb4[_0x58cb('0xdf')]||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x126')));break;case 0xb:if(_0x397eb4['countabandonedretry']>=_0x528db4[_0x58cb('0x12a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x397eb4[_0x58cb('0x108')]+=0x1,'scheduledat':moment()[_0x58cb('0x10d')](_0x528db4[_0x58cb('0x12b')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4[_0x58cb('0x101')],'VoiceQueueId':_0x397eb4['VoiceQueueId']||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})['catch'](loggerCatch(_0x58cb('0x1ae')));break;case 0x13:if(_0x397eb4[_0x58cb('0xf5')]>=_0x528db4[_0x58cb('0x10b')]-0x1){return!![];}this[_0x58cb('0x10c')]({'active':![],'countmachineretry':_0x397eb4[_0x58cb('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x528db4[_0x58cb('0x10e')],_0x58cb('0x10f'))[_0x58cb('0x82')](_0x58cb('0x100')),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4['ListId'],'VoiceQueueId':_0x397eb4[_0x58cb('0xdf')]||undefined,'CampaignId':_0x397eb4[_0x58cb('0xe0')]||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x102')));break;case 0x14:if(_0x397eb4[_0x58cb('0x109')]>=_0x528db4['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x58cb('0x10c')]({'active':![],'countagentrejectretry':_0x397eb4['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x58cb('0x10d')](_0x528db4[_0x58cb('0x1af')],_0x58cb('0x10f'))['format'](_0x58cb('0x100')),'ContactId':_0x397eb4[_0x58cb('0xdd')],'ListId':_0x397eb4['ListId'],'VoiceQueueId':_0x397eb4[_0x58cb('0xdf')]||undefined,'CampaignId':_0x397eb4['CampaignId']||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1b0')));break;default:return!![];}};Dialer[_0x58cb('0x1d')][_0x58cb('0x1a4')]=function(_0x3c712e,_0x1432d2,_0x3587d0){var _0x1bbac4=this;var _0x485250=new History(_0x3c712e);return new BPromise(function(_0x1ad888,_0x7a756b){if(_[_0x58cb('0x8c')](_0x1432d2)&&typeof _0x1432d2!==_0x58cb('0x173')){return _0x7a756b(msgResponse(_0x58cb('0x1b1'),'Failure',_0x58cb('0x1b2')));}if(_['isUndefined'](_0x3587d0)&&typeof _0x3587d0!==_0x58cb('0x173')){return _0x7a756b(msgResponse(_0x58cb('0x1b1'),_0x58cb('0x15a'),'evt\x20is\x20undefine'));}switch(_0x3587d0[_0x58cb('0x117')]){case'0':_0x1432d2['outboundNoSuchCallsDay']+=0x1;_0x485250[_0x58cb('0xb2')]=0x0;_0x485250['statedesc']=_0x58cb('0x1b3');_0x485250[_0x58cb('0x107')]+=0x1;_0x485250[_0x58cb('0xf6')]+=0x1;ami[_0x58cb('0x52')]('custom:agentnosuchnumber',ut[_0x58cb('0xf0')](_0x3c712e,_0x58cb('0x1b4')));_0x1bbac4[_0x58cb('0xd7')](_0x485250)['catch'](loggerCatch(_0x58cb('0xf7')));if(_0x1bbac4['checkRetriveMax'](0x0,_0x3c712e,_0x1432d2)){if(_0x485250[_0x58cb('0x107')]>=_0x1432d2['dialNoSuchNumberMaxRetry']){_0x1bbac4[_0x58cb('0xfe')](_0x485250,_0x1ad888,_0x7a756b,'reason\x200\x20no\x20such\x20number....');}else{_0x1bbac4[_0x58cb('0x10a')](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1b5'));}}break;case'3':_0x1432d2[_0x58cb('0x6a')]+=0x1;_0x485250[_0x58cb('0xb2')]=0x3;_0x485250['statedesc']=_0x58cb('0x1b6');_0x485250[_0x58cb('0xfa')]+=0x1;_0x485250[_0x58cb('0xf6')]+=0x1;ami[_0x58cb('0x52')](_0x58cb('0x1b7'),ut[_0x58cb('0xf0')](_0x3c712e,'noanswer'));_0x1bbac4[_0x58cb('0xd7')](_0x485250)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1b8')));if(_0x1bbac4[_0x58cb('0x1a5')](0x3,_0x3c712e,_0x1432d2)){if(_0x485250[_0x58cb('0xfa')]>=_0x1432d2['dialNoAnswerMaxRetry']){_0x1bbac4['createStateFinal'](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1b9'));}else{_0x1bbac4[_0x58cb('0x10a')](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1b9'));}}break;case'5':_0x1432d2[_0x58cb('0x1ba')]+=0x1;_0x485250[_0x58cb('0xb2')]=0x5;_0x485250['statedesc']=_0x58cb('0x1bb');_0x485250[_0x58cb('0xf8')]+=0x1;_0x485250[_0x58cb('0xf6')]+=0x1;ami[_0x58cb('0x52')](_0x58cb('0x1bc'),ut[_0x58cb('0xf0')](_0x3c712e,_0x58cb('0x1bd')));_0x1bbac4[_0x58cb('0xd7')](_0x485250)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1be')));if(_0x1bbac4[_0x58cb('0x1a5')](0x5,_0x3c712e,_0x1432d2)){if(_0x485250[_0x58cb('0xf8')]>=_0x1432d2[_0x58cb('0x1a8')]){_0x1bbac4[_0x58cb('0xfe')](_0x485250,_0x1ad888,_0x7a756b,'reason\x205\x20busy');}else{_0x1bbac4[_0x58cb('0x10a')](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1bf'));}}break;case'8':_0x1432d2[_0x58cb('0x67')]+=0x1;_0x485250['state']=0x8;_0x485250[_0x58cb('0xb3')]=_0x58cb('0x1c0');_0x485250[_0x58cb('0xf9')]+=0x1;_0x485250['countglobal']+=0x1;ami[_0x58cb('0x52')](_0x58cb('0x1c1'),ut['buildObj'](_0x3c712e,'congestion'));_0x1bbac4[_0x58cb('0xd7')](_0x485250)['catch'](loggerCatch(_0x58cb('0x1c2')));if(_0x1bbac4[_0x58cb('0x1a5')](0x8,_0x3c712e,_0x1432d2)){if(_0x485250[_0x58cb('0xf9')]>=_0x1432d2[_0x58cb('0x1c3')]){_0x1bbac4[_0x58cb('0xfe')](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1c4'));}else{_0x1bbac4['stateGlobal'](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1c4'));}}break;case'11':_0x1432d2[_0x58cb('0x1c5')]+=0x1;_0x485250[_0x58cb('0xb2')]=0xb;_0x485250[_0x58cb('0xb3')]=_0x58cb('0x12c');_0x485250[_0x58cb('0x108')]+=0x1;_0x485250[_0x58cb('0xf6')]+=0x1;_0x1bbac4['createHistory'](_0x485250)['catch'](loggerCatch(_0x58cb('0x12d')));if(_0x1bbac4['checkRetriveMax'](0xb,_0x3c712e,_0x1432d2)){if(_0x485250[_0x58cb('0x108')]>=_0x1432d2[_0x58cb('0x12a')]){_0x1bbac4[_0x58cb('0xfe')](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1c6'));}else{_0x1bbac4[_0x58cb('0x10a')](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1c6'));}}break;case'20':_0x1432d2[_0x58cb('0x6e')]+=0x1;_0x485250[_0x58cb('0xb2')]=0x14;_0x485250[_0x58cb('0xb3')]='AgentReject';_0x485250[_0x58cb('0x109')]+=0x1;_0x485250[_0x58cb('0xf6')]+=0x1;ami[_0x58cb('0x52')](_0x58cb('0x1c7'),ut[_0x58cb('0xf0')](_0x3c712e,_0x58cb('0x1c8')));_0x1bbac4[_0x58cb('0xd7')](_0x485250)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1c9')));if(_0x1bbac4[_0x58cb('0x1a5')](0x14,_0x3c712e,_0x1432d2)){if(_0x485250[_0x58cb('0x109')]>=_0x1432d2['dialAgentRejectMaxRetry']){_0x1bbac4['createStateFinal'](_0x485250,_0x1ad888,_0x7a756b,'reason\x2020\x20agentreject');}else{_0x1bbac4['stateGlobal'](_0x485250,_0x1ad888,_0x7a756b,_0x58cb('0x1ca'));}}break;default:_0x1432d2[_0x58cb('0x6f')]+=0x1;_0x485250[_0x58cb('0xb2')]=0xc;_0x485250[_0x58cb('0xb3')]=_0x3587d0['reason'];_0x1bbac4[_0x58cb('0xd7')](_0x485250)[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1cb')));if(_0x1bbac4['checkRetriveMax'](_0x3587d0['reason'],_0x3c712e,_0x1432d2)){if(_0x485250['countbusyretry']+_0x485250[_0x58cb('0xf9')]+_0x485250[_0x58cb('0xfa')]+_0x485250[_0x58cb('0x107')]+_0x485250['countdropretry']+_0x485250[_0x58cb('0x108')]+_0x485250[_0x58cb('0xf5')]+_0x485250[_0x58cb('0x109')]>=_0x1432d2[_0x58cb('0xfc')]){_0x1bbac4[_0x58cb('0x10a')](_0x485250,_0x1ad888,_0x7a756b,_0x3587d0['reason']);}else{_0x1bbac4[_0x58cb('0xfe')](_0x485250,_0x1ad888,_0x7a756b,_0x3587d0[_0x58cb('0x117')]);}}}});};Dialer['prototype']['stateGlobal']=function(_0x5ac2d4,_0x26fe6c,_0x50ec20,_0x30ad3d){var _0x6720a4=new Final(_0x5ac2d4);_0x6720a4['state']=0xf;_0x6720a4[_0x58cb('0xb3')]=_0x58cb('0x1cc');this[_0x58cb('0xfe')](_0x6720a4,_0x26fe6c,_0x50ec20,_0x30ad3d);};Dialer[_0x58cb('0x1d')][_0x58cb('0xfe')]=function(_0x1f07c2,_0x183ab5,_0x1f2e00,_0xdea80){this['moveContactManagedDialer'](_0x1f07c2)[_0x58cb('0x40')](function(){return _0x183ab5(msgResponse('[callProgressDetecting]','Success',_0xdea80));})[_0x58cb('0xbf')](function(){return _0x1f2e00(msgResponse(_0x58cb('0x1cd'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x58cb('0x1d')][_0x58cb('0xa')]=function(_0x46c90e){var _0x3c43f9=_0x46c90e['dialPredictiveOptimizationPercentage']/0x64;var _0x1f4b85=_0x46c90e['outboundDropCallsDayTimeout']/(_0x46c90e[_0x58cb('0x69')]+_0x46c90e[_0x58cb('0x65')]);var _0x3259a4=Math[_0x58cb('0x1ce')](_0x46c90e['predictiveIntervalAvailable']*(_0x46c90e['predictiveIntervalMaxThreshold']/0x64));var _0x1f9b4d=Math[_0x58cb('0x1ce')](_0x46c90e[_0x58cb('0x78')]*(_0x46c90e['predictiveIntervalMinThreshold']/0x64));var _0x4c0a0b=_0x46c90e[_0x58cb('0x56')]+_0x46c90e['talking'];var _0x2d8bde=Math['floor'](_0x46c90e[_0x58cb('0x7b')]*_0x46c90e[_0x58cb('0x7c')]*_0x46c90e[_0x58cb('0x75')]*_0x46c90e[_0x58cb('0x76')]);if(_[_0x58cb('0x8c')](_0x46c90e[_0x58cb('0x29')])){if(!_[_0x58cb('0x8c')](_0x46c90e[_0x58cb('0x7e')])){_0x46c90e['startPredictive']=undefined;loggerPredictive[_0x58cb('0x9f')](_0x58cb('0x1cf'),_0x58cb('0x1d0'));}if(!_[_0x58cb('0x8c')](_0x46c90e[_0x58cb('0x98')])){loggerPredictive[_0x58cb('0x9f')](_0x58cb('0x1cf'),_0x58cb('0x1d1'));clearInterval(_0x46c90e['handlePredictive']);_0x46c90e[_0x58cb('0x98')]=undefined;}_0x46c90e[_0x58cb('0x29')]=moment()[_0x58cb('0x82')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x58cb('0x85')](_0x46c90e['name'],_0x58cb('0x1d2'),_0x46c90e[_0x58cb('0x29')]);this[_0x58cb('0x160')](_0x46c90e,0x1);}else if(ifInterval(_0x46c90e[_0x58cb('0x1d3')],_0x46c90e[_0x58cb('0x29')])){this[_0x58cb('0x160')](_0x46c90e,0x1);loggerPredictiveCalls['info'](_0x58cb('0x1d4'),_0x46c90e[_0x58cb('0x29')],_0x46c90e['name']);_0x46c90e[_0x58cb('0x7b')]=0x0;_0x46c90e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3c43f9<_0x1f4b85&&_0x46c90e[_0x58cb('0x1d5')]===_0x58cb('0x1d6')){freeVariablesPredictive(_0x46c90e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x58cb('0x1d7'),_0x1f4b85,_0x58cb('0x29'),_0x46c90e[_0x58cb('0x44')]);}else if(_0x2d8bde<_0x46c90e[_0x58cb('0x1d8')]&&_0x46c90e[_0x58cb('0x1d5')]===_0x58cb('0x1d6')){freeVariablesPredictive(_0x46c90e);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x1d9'),_0x58cb('0x1da'),_0x2d8bde,_0x58cb('0x1db'),_0x46c90e[_0x58cb('0x1d8')],'startProgressive',_0x46c90e[_0x58cb('0x44')]);}else if(!ifInterval(_0x46c90e['dialPredictiveInterval'],_0x46c90e[_0x58cb('0x29')])&&_[_0x58cb('0x8c')](_0x46c90e[_0x58cb('0x7e')])&&!_[_0x58cb('0x8c')](_0x46c90e['startProgressive'])){_0x46c90e[_0x58cb('0x7e')]=moment()[_0x58cb('0x82')](_0x58cb('0x100'));loggerPredictive[_0x58cb('0x85')](_0x46c90e[_0x58cb('0x44')],_0x58cb('0x1dc'),_0x46c90e['startPredictive']);this[_0x58cb('0xca')](_0x46c90e[_0x58cb('0x1d3')])['then'](this[_0x58cb('0x1dd')](_0x46c90e))['then'](mergeDataErlangB(_0x46c90e))[_0x58cb('0x40')](this[_0x58cb('0x1de')](_0x46c90e))['catch'](loggerCatchPredictive(_0x58cb('0x1df'),_0x46c90e));}else if(!ifInterval(_0x46c90e[_0x58cb('0x1d3')],_0x46c90e['startPredictive'])){_0x46c90e['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x46c90e[_0x58cb('0x7e')]=moment()[_0x58cb('0x82')](_0x58cb('0x100'));loggerPredictive['info'](_0x46c90e[_0x58cb('0x44')],'recalculate\x20predictive\x20at',_0x46c90e['startPredictive']);clearInterval(_0x46c90e[_0x58cb('0x98')]);_0x46c90e['handlePredictive']=undefined;this[_0x58cb('0xca')](_0x46c90e[_0x58cb('0x1d3')])['then'](this[_0x58cb('0x1dd')](_0x46c90e))[_0x58cb('0x40')](mergeDataErlangB(_0x46c90e))[_0x58cb('0x40')](this[_0x58cb('0x1de')](_0x46c90e))[_0x58cb('0xbf')](loggerCatchPredictive(_0x58cb('0x1e0'),_0x46c90e));}else if(_0x46c90e['predictiveIntervalAvailable']&&_0x4c0a0b<_0x46c90e[_0x58cb('0x78')]-_0x1f9b4d){freeVariablesPredictive(_0x46c90e);loggerPredictive[_0x58cb('0x85')](_0x46c90e[_0x58cb('0x44')],_0x58cb('0x1e1'),_0x4c0a0b,_0x58cb('0x1e2'),_0x46c90e['predictiveIntervalAvailable'],'-',_0x1f9b4d,'=',_0x46c90e[_0x58cb('0x78')]-_0x1f9b4d,')');}else if(_0x46c90e[_0x58cb('0x78')]&&_0x4c0a0b>_0x46c90e['predictiveIntervalAvailable']+_0x3259a4){freeVariablesPredictive(_0x46c90e);loggerPredictive[_0x58cb('0x85')](_0x46c90e[_0x58cb('0x44')],_0x58cb('0x1e1'),_0x4c0a0b,')\x20are\x20more\x20than\x20threshold\x20(',_0x46c90e[_0x58cb('0x78')],'+',_0x3259a4,'=',_0x46c90e[_0x58cb('0x78')]+_0x3259a4,')');}};Dialer['prototype'][_0x58cb('0x1dd')]=function(_0x8dc3ce){var _0x36c6fa=this;return function(_0xe0bd00){return new BPromise(function(_0xcb6e7f,_0x31ce79){_['merge'](_0x8dc3ce,_0xe0bd00[0x0]);if(checkGetDataPredictive(_0xe0bd00[0x0])){var _0x5e6695=_0x8dc3ce['predictiveIntervalAvailable']=_0x8dc3ce[_0x58cb('0x5b')]+_0x8dc3ce[_0x58cb('0x56')];var _0x3b07b8=_0x8dc3ce['dialPredictiveInterval']*0x3c;var _0x368aa5=_0xe0bd00[0x0][_0x58cb('0x72')]+_0xe0bd00[0x0][_0x58cb('0x71')];var _0x520f16=(_0xe0bd00[0x0][_0x58cb('0x70')]+_0xe0bd00[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xe0bd00[0x0][_0x58cb('0x73')])/_0xe0bd00[0x0][_0x58cb('0x79')];_0x8dc3ce['predictiveIntervalHitRate']=_0x520f16>0x0?_0x520f16:0x1;switch(_0x8dc3ce[_0x58cb('0x1d5')]){case _0x58cb('0x1d6'):var _0x49ef77=_0x8dc3ce[_0x58cb('0x1e3')]/0x64;return _0x36c6fa[_0x58cb('0x1e4')](_0x5e6695,_0x3b07b8,_0x368aa5,_0x520f16,_0x49ef77)[_0x58cb('0x40')](function(_0x80fe9e){return _0xcb6e7f(_0x80fe9e);});case'agentBusyFactor':var _0x575fe2=_0x8dc3ce[_0x58cb('0x1e3')]/0x64;return _0x36c6fa['busyFactor'](_0x5e6695,_0x3b07b8,_0x368aa5,_0x520f16,_0x575fe2)[_0x58cb('0x40')](function(_0x45649f){return _0xcb6e7f(_0x45649f);});default:return _0x31ce79(msgResponse(_0x58cb('0x1e5'),_0x58cb('0x15a'),_0x58cb('0x1e6')));}}else{return _0x31ce79(msgResponse(_0x58cb('0x1e5'),_0x58cb('0x15a'),_0x58cb('0x1e7')));}});};};Dialer[_0x58cb('0x1d')]['getDataPredictiveOld']=function(_0x5f3523){var _0xe11574=this;return function(_0x5b468a){return new BPromise(function(_0x5782d9,_0x2fba8b){_['merge'](_0x5f3523,_0x5b468a[0x0]);if(checkGetDataPredictive(_0x5b468a[0x0])){loggerPredictive[_0x58cb('0x85')](JSON[_0x58cb('0x4e')](_0x5b468a[0x0]));if(_0x5f3523[_0x58cb('0x1d5')]===_0x58cb('0x1d6')){return _0xe11574['getVoiceQueueRtPauses'](_0x5f3523['id'])['then'](function(_0x2b8d85){var _0x137f76=_0x5f3523[_0x58cb('0x57')]-_0x2b8d85[0x0][_0x58cb('0x1e8')];var _0x12b77f=_0x5f3523[_0x58cb('0x1d3')]*0x3c;var _0x5604b9=_0x5b468a[0x0]['predictiveIntervalAvgTalktime']+_0x5b468a[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a3860=(_0x5b468a[0x0][_0x58cb('0x70')]+_0x5b468a[0x0][_0x58cb('0x74')]+_0x5b468a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5b468a[0x0][_0x58cb('0x79')];var _0x255111=_0x5f3523[_0x58cb('0x1e3')]/0x64;_0x5f3523['predictiveIntervalPauses']=_0x2b8d85[0x0][_0x58cb('0x1e8')]||0x0;_0x5f3523['predictiveIntervalHitRate']=_0x5a3860>0x0?_0x5a3860:0x1;return _0xe11574[_0x58cb('0x1e4')](_0x137f76,_0x12b77f,_0x5604b9,_0x5a3860,_0x255111);})['then'](function(_0x51cd45){return _0x5782d9(_0x51cd45);})['catch'](function(_0x41e915){return _0x2fba8b(msgResponse('[CatchErlangB]',_0x58cb('0x15a'),JSON[_0x58cb('0x4e')](_0x41e915)));});}if(_0x5f3523[_0x58cb('0x1d5')]==='agentBusyFactor'){return _0xe11574['getVoiceQueueRtPauses'](_0x5f3523['id'])[_0x58cb('0x40')](function(_0x524d73){var _0x1732b3=_0x5f3523[_0x58cb('0x57')]-_0x524d73[0x0]['outboundQueuePauses'];var _0x55d8ea=_0x5f3523['dialPredictiveInterval']*0x3c;var _0x3c3a8c=_0x5b468a[0x0][_0x58cb('0x72')]+_0x5b468a[0x0][_0x58cb('0x71')];var _0x79be0b=(_0x5b468a[0x0][_0x58cb('0x70')]+_0x5b468a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5b468a[0x0][_0x58cb('0x73')])/_0x5b468a[0x0][_0x58cb('0x79')];var _0xd2f743=_0x5f3523[_0x58cb('0x1e3')]/0x64;_0x5f3523['predictiveIntervalPauses']=_0x524d73[0x0]['outboundQueuePauses']||0x0;_0x5f3523[_0x58cb('0x75')]=_0x79be0b>0x0?_0x79be0b:0x1;return _0xe11574['busyFactor'](_0x1732b3,_0x55d8ea,_0x3c3a8c,_0x79be0b,_0xd2f743);})['then'](function(_0x4af0d7){return _0x5782d9(_0x4af0d7);})[_0x58cb('0xbf')](function(_0x395e90){return _0x2fba8b(msgResponse('[CatchErlangB]',_0x58cb('0x15a'),JSON[_0x58cb('0x4e')](_0x395e90)));});}}else{return _0x2fba8b(msgResponse(_0x58cb('0x1e5'),_0x58cb('0x15a'),_0x58cb('0x1e7')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x224fa4){var _0x54a97e=this;return function(){var _0x3bf595=0x0;var _0xdf32d=Math[_0x58cb('0x1e9')](_0x224fa4[_0x58cb('0x91')]*0x3e8);if(_0xdf32d>0x0){_0xdf32d=_0xdf32d<0x64?0x64:_0xdf32d;loggerPredictive[_0x58cb('0x85')](_0x224fa4[_0x58cb('0x44')],_0x58cb('0x1ea'),_0xdf32d,'milliseconds');_0x224fa4[_0x58cb('0x98')]=setInterval(function(){_0x54a97e[_0x58cb('0x98')](_0x224fa4);loggerPredictiveCalls['info']('[handlePredictive]',_0x3bf595+=0x1);},_0xdf32d);}else{loggerPredictive[_0x58cb('0x85')](_0x224fa4[_0x58cb('0x44')],_0x58cb('0x1eb'));}};};Dialer[_0x58cb('0x1d')][_0x58cb('0x1ec')]=function(_0xcaee2c,_0x1252be){var _0x50beda=this;return function(_0x3d6374){if(_[_0x58cb('0x4b')](_0x3d6374)){if(_[_0x58cb('0xbb')](_0x1252be[_0x58cb('0xde')])||!_0x1252be['recallme']){if(_0xcaee2c[_0x58cb('0x60')]===_0x58cb('0x9')){_0xcaee2c['queueStatusComplete']=_['isUndefined'](_0xcaee2c[_0x58cb('0x135')])?!![]:_0xcaee2c[_0x58cb('0x135')];var _0x5c7c80=uuid['v4']();_0x50beda[_0x58cb('0x12e')][_0x5c7c80]=new Action(_0xcaee2c,_0x1252be,_0x5c7c80);loggerBooked[_0x58cb('0x85')](_0x58cb('0x1ed'),_0x5c7c80,_0x58cb('0x1ee'),JSON[_0x58cb('0x4e')](_0xcaee2c['queueStatusComplete']),_0x58cb('0x1ef'),_0xcaee2c[_0x58cb('0x44')]);if(_0xcaee2c['queueStatusComplete']){_0xcaee2c[_0x58cb('0x135')]=![];_0x50beda[_0x58cb('0x2b')][_0x50beda[_0x58cb('0x12e')][_0x5c7c80]['queue']]=[];ami[_0x58cb('0xbc')]({'actionid':_0x5c7c80,'action':_0x58cb('0x1f0'),'queue':_0xcaee2c[_0x58cb('0x44')]})[_0x58cb('0xbf')](function(){_0x50beda[_0x58cb('0xc1')](_0xcaee2c);_0x50beda[_0x58cb('0x10c')]({'active':![],'ContactId':_0x50beda['actions'][_0x5c7c80][_0x58cb('0xdd')],'ListId':_0x50beda['actions'][_0x5c7c80][_0x58cb('0x101')],'VoiceQueueId':_0x50beda[_0x58cb('0x12e')][_0x5c7c80]['VoiceQueueId']||undefined,'CampaignId':_0x50beda[_0x58cb('0x12e')][_0x5c7c80][_0x58cb('0xe0')]||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1f1')));delete _0x50beda[_0x58cb('0x12e')][_0x5c7c80];});}else{loggerBooked['info'](_0x58cb('0x1f2'),JSON[_0x58cb('0x4e')](_0xcaee2c[_0x58cb('0x135')]),_0x58cb('0x1ef'),_0xcaee2c[_0x58cb('0x44')]);_0x50beda[_0x58cb('0xc1')](_0xcaee2c);_0x50beda['rescheduleContact']({'active':![],'ContactId':_0x50beda[_0x58cb('0x12e')][_0x5c7c80][_0x58cb('0xdd')],'ListId':_0x50beda[_0x58cb('0x12e')][_0x5c7c80][_0x58cb('0x101')],'VoiceQueueId':_0x50beda['actions'][_0x5c7c80][_0x58cb('0xdf')]||undefined,'CampaignId':_0x50beda[_0x58cb('0x12e')][_0x5c7c80]['CampaignId']||undefined})[_0x58cb('0xbf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x50beda[_0x58cb('0x12e')][_0x5c7c80];}}else{return _0x50beda['actionOriginate'](_0xcaee2c,_0x1252be);}}else{if(getDiff(_0x1252be['scheduledat'])<_0xcaee2c[_0x58cb('0x1f3')]*0x3c){if(_0x1252be[_0x58cb('0x166')]&&!_0x1252be[_0x58cb('0x166')][_0x58cb('0x1f4')]){_0x50beda[_0x58cb('0x9b')]['run'](_0x1252be['id'])[_0x58cb('0x20')](function(){_0x50beda[_0x58cb('0xc1')](_0xcaee2c);});}else{_0x50beda[_0x58cb('0xcd')]({'active':![]},_0x1252be['id'],0x1)['finally'](function(){_0x50beda[_0x58cb('0xc1')](_0xcaee2c);});}}else{_0xcaee2c['outboundReCallsDay']+=0x1;_0x50beda[_0x58cb('0xc1')](_0xcaee2c);if(_0xcaee2c[_0x58cb('0x1f5')]){_0x50beda[_0x58cb('0x10c')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1252be[_0x58cb('0xdd')],'ListId':_0x1252be[_0x58cb('0x101')],'VoiceQueueId':_0x1252be[_0x58cb('0xdf')]||undefined,'CampaignId':_0x1252be[_0x58cb('0xe0')]||undefined})[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1f6')));_0x50beda[_0x58cb('0xd7')](createObjHistory(_0xcaee2c,_0x1252be,_0x58cb('0x1f7'),0x17,_0x58cb('0x1f8')))[_0x58cb('0xbf')](loggerCatch(_0x58cb('0x1f9')));}else{_0x50beda[_0x58cb('0xdb')](createObjHistory(_0xcaee2c,_0x1252be,_0x58cb('0x1fa'),0x16,_0x58cb('0x1fb')),_0x58cb('0x1fc'),_0x58cb('0x1fd'));}}}}else{_0xcaee2c['outboundBlacklistCallsDay']+=0x1;_0x50beda['saveInDb'](createObjHistory(_0xcaee2c,_0x1252be,'BLACKLIST',0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x58cb('0x1fe'));throw'inBlackList';}};};Dialer[_0x58cb('0x1d')][_0x58cb('0x1ff')]=function(_0x50db90){var _0x1b0f48=this;var _0x46b32c=_0x50db90[_0x58cb('0x200')]-_0x50db90[_0x58cb('0x7a')]-_0x50db90[_0x58cb('0xd0')];emitCampaignSummary(_0x50db90);if(_0x46b32c>0x0){if(_0x46b32c>this['maxNumberOriginate']){_0x46b32c=this['maxNumberOriginate'];}_0x50db90[_0x58cb('0xd0')]+=_0x46b32c;this[_0x58cb('0xd1')](_0x50db90['id'],_0x46b32c,_0x50db90[_0x58cb('0x201')],_0x50db90)['then'](function(_0x3985e6){_0x50db90['temp']-=_0x46b32c;_0x50db90[_0x58cb('0xd0')]=_0x50db90[_0x58cb('0xd0')]>0x0?_0x50db90[_0x58cb('0xd0')]:0x0;if(!checkContactEmpty(_0x3985e6)){_0x50db90[_0x58cb('0x42')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x58cb('0x85')](_0x58cb('0x202')+_0x50db90['name']);}else{_0x50db90[_0x58cb('0x7a')]+=_0x3985e6[_0x58cb('0xa2')];_0x50db90[_0x58cb('0x42')]='RUNNING';for(var _0x202d75=0x0;_0x202d75<_0x3985e6[_0x58cb('0xa2')];_0x202d75+=0x1){_0x50db90[_0x58cb('0x203')]+=0x1;if(_['isNil'](_0x3985e6[_0x202d75])||_[_0x58cb('0xbb')](_0x3985e6[_0x202d75]['Contact'])||_[_0x58cb('0xbb')](_0x3985e6[_0x202d75][_0x58cb('0x176')][_0x58cb('0x175')])){_0x1b0f48[_0x58cb('0x204')](_0x58cb('0x205'),_0x50db90,_0x3985e6[_0x202d75]);}else{_0x1b0f48['checkIsBlackListIvr'](_[_0x58cb('0xdc')](_0x3985e6[_0x202d75],[_0x58cb('0xe0'),_0x58cb('0x206')]))[_0x58cb('0x40')](_0x1b0f48[_0x58cb('0x1ec')](_0x50db90,_0x3985e6[_0x202d75]))[_0x58cb('0xbf')](_0x1b0f48['loggerHandler'](_0x58cb('0x207'),_0x50db90));}}}})['catch'](loggerGetContactDialer(_0x58cb('0x208'),_0x50db90,_0x46b32c));}};Dialer['prototype'][_0x58cb('0x160')]=function(_0x13d402,_0xac7208){var _0x18a815=this;var _0x56d3e7=[];var _0x3b1bd8=_0xac7208>=0x1?_0xac7208:0x1;if(_0x13d402[_0x58cb('0x60')]==='booked'){_0x3b1bd8=0x1;}var _0x2e8abf=Math[_0x58cb('0x1e9')](_0x13d402['available']*_0x3b1bd8)-_0x13d402[_0x58cb('0x7a')]-_0x13d402[_0x58cb('0xd0')];emitVoiceQueueSummary(_0x13d402);if(_0x13d402[_0x58cb('0x209')]>0x0){var _0x3efd84=_0x13d402['dialLimitQueue']-_0x13d402[_0x58cb('0x7a')]-_0x13d402[_0x58cb('0x5b')]-_0x13d402[_0x58cb('0xd0')]-_0x13d402[_0x58cb('0x58')];if(_0x2e8abf>_0x3efd84){_0x2e8abf=_0x3efd84;}}if(_0x2e8abf>0x0){if(_0x13d402[_0x58cb('0x60')]===_0x58cb('0x9')){_0x2e8abf=0x1;}if(_0x2e8abf>this['maxNumberOriginate']){_0x2e8abf=this[_0x58cb('0x25')];}_0x13d402[_0x58cb('0xd0')]+=_0x2e8abf;for(var _0x3794fb in this[_0x58cb('0x23')]){if(typeof this[_0x58cb('0x23')][_0x3794fb]!==_0x58cb('0xa3')){if(this[_0x58cb('0x23')][_0x3794fb][_0x58cb('0xb2')]===_0x58cb('0x20a')&&this[_0x58cb('0x23')][_0x3794fb][_0x58cb('0xbd')]===_0x58cb('0xe6')){_0x56d3e7[_0x58cb('0x133')](this['agents'][_0x3794fb]['id']);}}}this[_0x58cb('0xcf')](_0x13d402['id'],_0x56d3e7,_0x2e8abf,_0x13d402['dialOrderByScheduledAt'],_0x13d402)[_0x58cb('0x40')](function(_0x244503){_0x13d402[_0x58cb('0xd0')]-=_0x2e8abf;_0x13d402[_0x58cb('0xd0')]=_0x13d402['temp']>0x0?_0x13d402[_0x58cb('0xd0')]:0x0;if(!checkContactEmpty(_0x244503)){_0x18a815[_0x58cb('0x20b')](_0x13d402)[_0x58cb('0x40')](sendMessageReschedule(_0x13d402))[_0x58cb('0xbf')](loggerCatch('[countReScheduled]\x20'));}else{_0x13d402[_0x58cb('0x7a')]+=_0x244503[_0x58cb('0xa2')];_0x13d402[_0x58cb('0x42')]=_0x13d402['dialMethod']===_0x58cb('0x9')?_0x58cb('0x17e'):_0x58cb('0x20c');for(var _0x3d2baa=0x0;_0x3d2baa<_0x244503[_0x58cb('0xa2')];_0x3d2baa+=0x1){if(_[_0x58cb('0xbb')](_0x244503[_0x3d2baa])||_[_0x58cb('0xbb')](_0x244503[_0x3d2baa][_0x58cb('0x176')])||_[_0x58cb('0xbb')](_0x244503[_0x3d2baa][_0x58cb('0x176')][_0x58cb('0x175')])){_0x18a815[_0x58cb('0x204')](_0x58cb('0x205'),_0x13d402,_0x244503[_0x3d2baa]);}else{_0x18a815['checkIsBlackList'](_[_0x58cb('0xdc')](_0x244503[_0x3d2baa],['VoiceQueueId','Contact.phone']))[_0x58cb('0x40')](_0x18a815[_0x58cb('0x1ec')](_0x13d402,_0x244503[_0x3d2baa]))[_0x58cb('0xbf')](_0x18a815[_0x58cb('0xda')](_0x58cb('0x205'),_0x13d402));}}}})['catch'](loggerGetContactDialer(_0x58cb('0x20d'),_0x13d402,_0x2e8abf));}};Dialer[_0x58cb('0x1d')][_0x58cb('0x98')]=function(_0xc2f8f2){if(_0xc2f8f2[_0x58cb('0x209')]>0x0){var _0x2b53a0=_0xc2f8f2['dialLimitQueue']-_0xc2f8f2['originated']-_0xc2f8f2[_0x58cb('0x5b')];if(_0x2b53a0>0x0){this[_0x58cb('0x20e')](_0xc2f8f2);}else{loggerPredictiveCalls[_0x58cb('0x85')](_0x58cb('0x20f'));}}else{this[_0x58cb('0x20e')](_0xc2f8f2);}};Dialer[_0x58cb('0x1d')]['tryOriginatePredictive']=function(_0x334927){var _0x183631=this;var _0xdf5df7=[];_0x334927[_0x58cb('0x7a')]+=0x1;for(var _0x188054 in this[_0x58cb('0x23')]){if(typeof this[_0x58cb('0x23')][_0x188054]!==_0x58cb('0xa3')){if(this[_0x58cb('0x23')][_0x188054][_0x58cb('0xb2')]===_0x58cb('0x20a')&&this[_0x58cb('0x23')][_0x188054][_0x58cb('0xbd')]==='reachable'){_0xdf5df7[_0x58cb('0x133')](this[_0x58cb('0x23')][_0x188054]['id']);}}}this['getContactDialer'](_0x334927['id'],_0xdf5df7,0x1,_0x334927[_0x58cb('0x201')],_0x334927)[_0x58cb('0x40')](function(_0xd5aadf){if(!checkContactEmpty(_0xd5aadf)){checkContactLowerLimitOriginate(_0x334927,0x1,0x0);_0x183631[_0x58cb('0x20b')](_0x334927)[_0x58cb('0x40')](sendMessageReschedule(_0x334927))[_0x58cb('0xbf')](loggerCatch('[countReScheduled]\x20'));}else{_0x334927['message']=_0x58cb('0x20c');if(_[_0x58cb('0xbb')](_0xd5aadf[0x0])||_[_0x58cb('0xbb')](_0xd5aadf[0x0][_0x58cb('0x176')])||_[_0x58cb('0xbb')](_0xd5aadf[0x0][_0x58cb('0x176')][_0x58cb('0x175')])){_0x183631['emptyContact']('[actionOriginate]\x20',_0x334927,_0xd5aadf[0x0]);}else{_0x183631[_0x58cb('0xc6')](_['pick'](_0xd5aadf[0x0],['VoiceQueueId',_0x58cb('0x206')]))['then'](_0x183631[_0x58cb('0x1ec')](_0x334927,_0xd5aadf[0x0]))[_0x58cb('0xbf')](_0x183631['loggerHandler']('[actionOriginatePredictive]\x20',_0x334927));}}})['catch'](loggerGetContactDialer(_0x58cb('0x210'),_0x334927,0x1));emitVoiceQueueSummary(_0x334927);};Dialer[_0x58cb('0x1d')]['abandonmentRate']=function(_0x455f38,_0x22befe,_0x453f46,_0x12d919,_0x1efdc0,_0x502103){loggerPredictive[_0x58cb('0x85')](_0x58cb('0x211'));loggerPredictive['info'](_0x58cb('0x212'),_0x455f38);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x213'),_0x22befe);loggerPredictive[_0x58cb('0x85')]('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',_0x453f46);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x214'),_0x12d919);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x215'),_0x1efdc0);loggerPredictive[_0x58cb('0x85')]('---------------------------');return new BPromise(function(_0x25d04e,_0x35bef0){if(_0x455f38<=0x0||isNaN(_0x455f38)){return _0x35bef0(msgResponse(_0x58cb('0x216'),_0x58cb('0x4d'),_0x58cb('0x217')+_0x455f38));}if(_0x453f46<=0x0||isNaN(_0x453f46)){return _0x35bef0(msgResponse(_0x58cb('0x216'),_0x58cb('0x4d'),'Ts\x20=\x20'+_0x453f46));}if(_0x12d919<=0x0||isNaN(_0x12d919)){return _0x35bef0(msgResponse(_0x58cb('0x216'),_0x58cb('0x4d'),'p\x20=\x20'+_0x12d919));}if(_0x22befe<=0x0||isNaN(_0x22befe)){return _0x35bef0(msgResponse('[abandonmentRate]',_0x58cb('0x4d'),'interval\x20=\x20'+_0x22befe));}if(_0x1efdc0<=0x0||isNaN(_0x1efdc0)){return _0x35bef0(msgResponse('[abandonmentRate]',_0x58cb('0x4d'),_0x58cb('0x218')+_0x1efdc0));}_0x502103=_0x502103||0x0;var _0x3bdca2=0x1/_0x453f46;var _0x112e83=0x0;var _0x422580=0x0;var _0x5a51fb=0x0;var _0x4bc6f3=0x0;for(var _0x3452a8=0x0;_0x5a51fb<_0x1efdc0;_0x3452a8+=0x1){_0x422580=_0x3452a8/_0x22befe;_0x112e83=(_0x12d919*_0x422580+_0x502103)/_0x3bdca2;_0x5a51fb=erlangb(_0x112e83,_0x455f38);_0x4bc6f3=_0x112e83/_0x455f38*(0x1-erlangb(_0x112e83,_0x455f38));}return _0x25d04e({'erlangCalls':_0x3452a8,'erlangCallToSecond':_0x22befe/_0x3452a8,'erlangAbandonmentRate':_0x5a51fb,'erlangBusyFactor':_0x4bc6f3});});};Dialer[_0x58cb('0x1d')][_0x58cb('0x219')]=function(_0x2e8853,_0x5c8035,_0x5a526a,_0x2ccd40,_0x135dff,_0x339392){loggerPredictive[_0x58cb('0x85')](_0x58cb('0x21a'));loggerPredictive[_0x58cb('0x85')]('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',_0x2e8853);loggerPredictive['info'](_0x58cb('0x213'),_0x5c8035);loggerPredictive['info'](_0x58cb('0x21b'),_0x5a526a);loggerPredictive[_0x58cb('0x85')](_0x58cb('0x214'),_0x2ccd40);loggerPredictive[_0x58cb('0x85')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x135dff);loggerPredictive['info'](_0x58cb('0x94'));return new BPromise(function(_0x4f2f5c,_0x1a3114){if(_0x2e8853<=0x0||isNaN(_0x2e8853)){return _0x1a3114(msgResponse(_0x58cb('0x21c'),_0x58cb('0x4d'),_0x58cb('0x217')+_0x2e8853));}if(_0x5a526a<=0x0||isNaN(_0x5a526a)){return _0x1a3114(msgResponse('[busyFactor]',_0x58cb('0x4d'),'Ts\x20=\x20'+_0x5a526a));}if(_0x2ccd40<=0x0||isNaN(_0x2ccd40)){return _0x1a3114(msgResponse(_0x58cb('0x21c'),_0x58cb('0x4d'),_0x58cb('0x21d')+_0x2ccd40));}if(_0x5c8035<=0x0||isNaN(_0x5c8035)){return _0x1a3114(msgResponse(_0x58cb('0x21c'),'Error',_0x58cb('0x21e')+_0x5c8035));}if(_0x135dff<=0x0||isNaN(_0x135dff)){return _0x1a3114(msgResponse(_0x58cb('0x21c'),'Error',_0x58cb('0x21f')+_0x135dff));}_0x339392=_0x339392||0x0;var _0x44adb7=0x1/_0x5a526a;var _0x572f21=0x0;var _0x52eb2c=0x0;var _0x4e8ed5=0x0;var _0x473826=0x0;for(var _0x38d73b=0x0;_0x473826<_0x135dff;_0x38d73b+=0x1){_0x52eb2c=_0x38d73b/_0x5c8035;_0x572f21=(_0x2ccd40*_0x52eb2c+_0x339392)/_0x44adb7;_0x4e8ed5=erlangb(_0x572f21,_0x2e8853);_0x473826=_0x572f21/_0x2e8853*(0x1-erlangb(_0x572f21,_0x2e8853));}return _0x4f2f5c({'erlangCalls':_0x38d73b,'erlangCallToSecond':_0x5c8035/_0x38d73b,'erlangAbandonmentRate':_0x4e8ed5,'erlangBusyFactor':_0x473826});});};module['exports']=Dialer; \ No newline at end of file +var _0x4377=['[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','interval','indexOf','iftime\x20%s,%s','content','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','Agent','user:%s','dialActive','dialTimezone','dialPreviewRecallmeReminder','dialGlobalInterval','launchHandleIvr','pow','replace','random','match','actionOriginate','Contact','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','isTrunkReachable','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','object','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','booked','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','hangup','syncHangup','varset','syncVarSet','queuemember','queuestatuscomplete','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','abandoned','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','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\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','inspect','error','stack','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','sequence','status','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','catch','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','SIP/%s','reachable','uniqueId','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','state','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','countcongestionretry','countdropretry','dialMachineMaxRetry','ivrAnswerCallsDay','dialQueueProject','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','strategy','roundrobin','actionid','stateinterface','locked','rrmemory','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20'];(function(_0x51639f,_0x2f1dc3){var _0x10b89a=function(_0x2df606){while(--_0x2df606){_0x51639f['push'](_0x51639f['shift']());}};_0x10b89a(++_0x2f1dc3);}(_0x4377,0xeb));var _0x7437=function(_0x33c03f,_0x2a4016){_0x33c03f=_0x33c03f-0x0;var _0x97eb85=_0x4377[_0x33c03f];return _0x97eb85;};'use strict';var util=require('util');var _=require(_0x7437('0x0'));var BPromise=require(_0x7437('0x1'));var uuid=require(_0x7437('0x2'));var moment=require(_0x7437('0x3'));var rr=require('rr');var md5=require(_0x7437('0x4'));var Redis=require(_0x7437('0x5'));var ut=require(_0x7437('0x6'));var config=require(_0x7437('0x7'));var logger=require(_0x7437('0x8'))(_0x7437('0x9'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x7437('0x8'))(_0x7437('0xa'));var loggerPredictiveCalls=require(_0x7437('0x8'))(_0x7437('0xb'));var loggerSyncQueueSummary=require(_0x7437('0x8'))(_0x7437('0xc'));var ami=require(_0x7437('0xd'));config['redis']=_[_0x7437('0xe')](config[_0x7437('0xf')],{'host':_0x7437('0x10'),'port':0x18eb});var io=require(_0x7437('0x11'))(new Redis(config[_0x7437('0xf')]));var cmHopper=require(_0x7437('0x12'));var cmHopperHistory=require(_0x7437('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x7437('0x14'));var RpcSetting=require(_0x7437('0x15'));var Action=require(_0x7437('0x16'));var History=require(_0x7437('0x17'));var Final=require(_0x7437('0x18'));var AgentComplete=require(_0x7437('0x19'));var QueueCallerAbandon=require(_0x7437('0x1a'));var Hangup=require(_0x7437('0x1b'));var ipAgi=process[_0x7437('0x1c')]['XCALLY_IP_AGI']||_0x7437('0x1d');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7437('0x1e')][_0x7437('0x1f')]=function(_0x561f62){this[_0x7437('0x20')]=this[_0x7437('0x20')]?this[_0x7437('0x20')][_0x7437('0x21')](_0x561f62):_0x561f62();};function Dialer(_0x1c52af,_0x4facc9){this['sequence']=new Sequence();this[_0x7437('0x22')]=_0x4facc9;this[_0x7437('0x23')]=_0x1c52af['voiceQueues'];this[_0x7437('0x24')]=_0x1c52af[_0x7437('0x24')];this[_0x7437('0x25')]=_0x1c52af[_0x7437('0x25')];this[_0x7437('0x26')]=_0x1c52af[_0x7437('0x26')];this[_0x7437('0x27')]=config[_0x7437('0x27')]||0x2;this[_0x7437('0x28')]={};this[_0x7437('0x29')]={};this[_0x7437('0x2a')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x7437('0x2b')]={};this[_0x7437('0x2c')]={};this[_0x7437('0x2d')]={};this[_0x7437('0x2e')]={};ami['on'](_0x7437('0x2f'),this[_0x7437('0x30')][_0x7437('0x31')](this));ami['on'](_0x7437('0x32'),this[_0x7437('0x33')]['bind'](this));ami['on'](_0x7437('0x34'),this['syncOriginateResponse'][_0x7437('0x31')](this));ami['on'](_0x7437('0x35'),this[_0x7437('0x36')]['bind'](this));ami['on']('custom:queuesummary',this[_0x7437('0xc')][_0x7437('0x31')](this));ami['on'](_0x7437('0x37'),this[_0x7437('0x38')][_0x7437('0x31')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0x7437('0x39'),this[_0x7437('0x3a')][_0x7437('0x31')](this));ami['on'](_0x7437('0x3b'),this['syncQueueMember']['bind'](this));ami['on'](_0x7437('0x3c'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting['getSettings']()['then'](function(_0x52c082){previewRecallmeReminderInterval=_0x52c082[_0x7437('0x3d')];});}function isNotNull(_0x1c60bf){return _0x1c60bf!==null&&!_[_0x7437('0x3e')](_0x1c60bf);}function checkIsLoggedIn(_0x2c0dd8,_0x3dbfbf){return function(){if(_0x3dbfbf<=0x0){_0x2c0dd8[_0x7437('0x3f')]=_0x7437('0x40');throw _0x2c0dd8[_0x7437('0x41')]+_0x7437('0x42');}};}function isActive(_0x5f097e){return _0x5f097e;}function checkIsActive(_0x1fd5c4,_0x349b33){return function(){if(!isActive(_0x349b33)){_0x1fd5c4['message']='NOT_ACTIVE';throw _0x1fd5c4['name']+_0x7437('0x43');}};}function checkInterval(_0xf47500){return function(){if(!isNotNull(_0xf47500['Interval'])){_0xf47500[_0x7437('0x3f')]=_0x7437('0x44');throw _0xf47500[_0x7437('0x41')]+_0x7437('0x45');}if(!isNotNull(_0xf47500[_0x7437('0x46')][_0x7437('0x47')])){_0xf47500[_0x7437('0x3f')]=_0x7437('0x44');throw _0xf47500[_0x7437('0x41')]+_0x7437('0x45');}if(!isNotNull(_['isEmpty'](_0xf47500[_0x7437('0x46')]['Intervals']))){_0xf47500[_0x7437('0x3f')]=_0x7437('0x44');throw _0xf47500['name']+_0x7437('0x45');}};}function msgResponse(_0x5ba72a,_0xfd901,_0x5675ea){return{'action':_0x5ba72a,'response':_0xfd901,'message':_0x5675ea,'stack':_0x5675ea};}function myreject(_0x127e2b){return function(_0x2680b6){return _0x127e2b(msgResponse(_0x7437('0x48'),_0x7437('0x49'),JSON[_0x7437('0x4a')](_0x2680b6)));};}function getSeconds(_0x23169f,_0x3fafe3){var _0x4e31ec=moment(_0x23169f)[_0x7437('0x4b')](0x0);var _0x54a0dc=moment(_0x3fafe3)[_0x7437('0x4b')](0x0);return _0x4e31ec[_0x7437('0x4c')](_0x54a0dc,_0x7437('0x4d'));}function emit(_0x49515d,_0xe41490,_0x565a30){io['to'](_0x49515d)[_0x7437('0x4e')](_0xe41490,_0x565a30);}function emitVoiceQueueSummary(_0x59f6a6){if(_0x59f6a6[_0x7437('0x4f')]==='outbound'){var _0x4ce6af={'id':_0x59f6a6['id'],'name':_0x59f6a6[_0x7437('0x41')],'strategy':_0x59f6a6['strategy'],'answered':_0x59f6a6[_0x7437('0x50')],'available':_0x59f6a6[_0x7437('0x51')],'loggedIn':_0x59f6a6[_0x7437('0x52')],'pTalking':_0x59f6a6[_0x7437('0x53')],'sumBillable':_0x59f6a6[_0x7437('0x54')],'sumDuration':_0x59f6a6['sumDuration'],'sumHoldTime':_0x59f6a6[_0x7437('0x55')]||0x0,'talking':_0x59f6a6[_0x7437('0x56')],'total':_0x59f6a6[_0x7437('0x57')],'type':_0x59f6a6[_0x7437('0x4f')],'unmanaged':_0x59f6a6['unmanaged'],'abandoned':_0x59f6a6[_0x7437('0x58')],'waiting':_0x59f6a6['waiting'],'loggedInDb':_0x59f6a6['loggedInDb'],'dialActive':_0x59f6a6['dialActive'],'dialMethod':_0x59f6a6[_0x7437('0x59')],'dialOriginateCallerIdName':_0x59f6a6[_0x7437('0x5a')],'dialOriginateCallerIdNumber':_0x59f6a6[_0x7437('0x5b')],'dialOriginateTimeout':_0x59f6a6[_0x7437('0x5c')],'dialPrefix':_0x59f6a6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x59f6a6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x59f6a6[_0x7437('0x5d')],'outboundBlacklistCallsDay':_0x59f6a6[_0x7437('0x5e')],'outboundBusyCallsDay':_0x59f6a6[_0x7437('0x5f')],'outboundCongestionCallsDay':_0x59f6a6[_0x7437('0x60')],'outboundDropCallsDayACS':_0x59f6a6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x59f6a6[_0x7437('0x61')],'outboundDropCallsDayTimeout':_0x59f6a6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x59f6a6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x59f6a6[_0x7437('0x62')],'outboundOriginateFailureCallsDay':_0x59f6a6[_0x7437('0x63')],'outboundReCallsDay':_0x59f6a6['outboundReCallsDay'],'outboundRejectCallsDay':_0x59f6a6['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x59f6a6[_0x7437('0x64')],'predictiveIntervalAnsweredCalls':_0x59f6a6[_0x7437('0x65')],'predictiveIntervalAvgHoldtime':_0x59f6a6[_0x7437('0x66')],'predictiveIntervalAvgTalktime':_0x59f6a6[_0x7437('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x59f6a6[_0x7437('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x59f6a6[_0x7437('0x69')],'predictiveIntervalErlangCalls':_0x59f6a6[_0x7437('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x59f6a6[_0x7437('0x6b')],'predictiveIntervalHitRate':_0x59f6a6['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x59f6a6[_0x7437('0x6c')],'predictiveIntervalPauses':_0x59f6a6[_0x7437('0x6d')],'predictiveIntervalAvailable':_0x59f6a6[_0x7437('0x6e')],'predictiveIntervalTotalCalls':_0x59f6a6[_0x7437('0x6f')],'message':_0x59f6a6['message'],'originated':_0x59f6a6[_0x7437('0x70')],'erlangCalls':_0x59f6a6[_0x7437('0x71')],'erlangCallToSecond':_0x59f6a6[_0x7437('0x72')],'erlangAbandonmentRate':_0x59f6a6[_0x7437('0x73')],'erlangBusyFactor':_0x59f6a6[_0x7437('0x74')],'startPredictive':_0x59f6a6[_0x7437('0x75')],'startProgressive':_0x59f6a6[_0x7437('0x2b')]};if(_0x59f6a6['Trunk']){_0x4ce6af['Trunk']={'id':_0x59f6a6['Trunk']['id'],'name':_0x59f6a6[_0x7437('0x76')][_0x7437('0x41')],'active':_0x59f6a6[_0x7437('0x76')][_0x7437('0x77')],'callerid':_0x59f6a6['Trunk'][_0x7437('0x78')]};}if(_0x59f6a6[_0x7437('0x46')]){_0x4ce6af[_0x7437('0x46')]={'id':_0x59f6a6[_0x7437('0x46')]['id'],'name':_0x59f6a6[_0x7437('0x46')][_0x7437('0x41')]};}var _0x3cca6d=md5(JSON[_0x7437('0x4a')](_0x4ce6af));if(_0x59f6a6[_0x7437('0x4')]!==_0x3cca6d){_0x59f6a6[_0x7437('0x4')]=_0x3cca6d;emit(util[_0x7437('0x79')]('voice:queue:%s',_0x4ce6af[_0x7437('0x41')]),_0x7437('0x7a'),_0x4ce6af);}}}function emitCampaignSummary(_0xf39f38){if(_0xf39f38[_0x7437('0x4f')]===_0x7437('0x7b')){emit(util[_0x7437('0x79')](_0x7437('0x7c'),_0xf39f38[_0x7437('0x41')]),_0x7437('0x7d'),_0xf39f38);}}function checkGetDataPredictive(_0x492e36){if(isNotNull(_0x492e36)&&!_[_0x7437('0x7e')](_0x492e36)){loggerPredictive[_0x7437('0x7f')](_0x7437('0x80'));loggerPredictive[_0x7437('0x7f')](_0x7437('0x81'),_0x492e36['predictiveIntervalTotalCalls']);loggerPredictive[_0x7437('0x7f')](_0x7437('0x82'),_0x492e36[_0x7437('0x65')]);loggerPredictive[_0x7437('0x7f')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x492e36[_0x7437('0x69')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x83'),_0x492e36[_0x7437('0x68')]);loggerPredictive['info'](_0x7437('0x84'),_0x492e36[_0x7437('0x66')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x85'),_0x492e36['predictiveIntervalAvgTalktime']);loggerPredictive[_0x7437('0x7f')](_0x7437('0x86'));if(_0x492e36[_0x7437('0x6f')]>0x0){if(!_[_0x7437('0x3e')](_0x492e36[_0x7437('0x67')])&&_0x492e36[_0x7437('0x67')]>0x0){return!![];}loggerPredictive[_0x7437('0x7f')](_0x7437('0x87'));if(!_[_0x7437('0x3e')](_0x492e36[_0x7437('0x66')])&&_0x492e36[_0x7437('0x66')]>0x0){return!![];}loggerPredictive[_0x7437('0x7f')](_0x7437('0x88'));}else{loggerPredictive[_0x7437('0x7f')](_0x7437('0x89'));}}else{loggerPredictive['info'](_0x7437('0x8a'));}return![];}function mergeDataErlangB(_0x1d7e91){return function(_0x58ba33){loggerPredictive['info'](_0x7437('0x8b'));loggerPredictive[_0x7437('0x7f')](_0x7437('0x8c'),_0x58ba33[_0x7437('0x71')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ba33[_0x7437('0x72')]);loggerPredictive[_0x7437('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ba33[_0x7437('0x73')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x8d'),_0x58ba33[_0x7437('0x74')]);loggerPredictive[_0x7437('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58ba33[_0x7437('0x73')]);loggerPredictive[_0x7437('0x7f')](_0x7437('0x86'));_[_0x7437('0x8e')](_0x1d7e91,_0x58ba33);};}function getDiff(_0x3bada3){var _0x1f73f1=moment()[_0x7437('0x4b')](0x0);var _0xa28efd=moment(_0x3bada3)['milliseconds'](0x0);return _0x1f73f1[_0x7437('0x4c')](_0xa28efd,_0x7437('0x4d'));}function ifInterval(_0x62dcdc,_0x54ff5e){if(_['isUndefined'](_0x54ff5e)){return![];}return getDiff(_0x54ff5e)<_0x62dcdc*0x3c;}function freeVariablesPredictive(_0x103bbe){if(isNotNull(_0x103bbe)){if(!_[_0x7437('0x3e')](_0x103bbe[_0x7437('0x2b')])){_0x103bbe[_0x7437('0x2b')]=undefined;loggerPredictive[_0x7437('0x7f')](_0x103bbe[_0x7437('0x41')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x7437('0x3e')](_0x103bbe['startPredictive'])){_0x103bbe['startPredictive']=undefined;loggerPredictive[_0x7437('0x7f')](_0x103bbe[_0x7437('0x41')],_0x7437('0x8f'));}if(!_[_0x7437('0x3e')](_0x103bbe[_0x7437('0x90')])){clearInterval(_0x103bbe['handlePredictive']);_0x103bbe[_0x7437('0x90')]=undefined;loggerPredictive[_0x7437('0x7f')](_0x103bbe[_0x7437('0x41')],_0x7437('0x91'));}}}function erlangb(_0x2e41f1,_0xc99929){if(_0xc99929===0x0){return 0x0;}var _0x548a59=0x1;for(var _0x51488f=0x1;_0x51488f<=_0xc99929;_0x51488f+=0x1){_0x548a59=0x1+_0x548a59*_0x51488f/_0x2e41f1;}return 0x1/_0x548a59;}function isVoiceQueueOutbound(_0x1d524c){return _0x1d524c==='outbound';}function isNotPreview(_0x34d59e){return _0x34d59e!=='preview';}function isCampaignIvr(_0x36d2fa){return _0x36d2fa===_0x7437('0x7b');}function getCallerId(_0x3fdeca,_0x4d5cb9,_0x42d7f9){if(!_[_0x7437('0x3e')](_0x42d7f9)&&typeof _0x42d7f9==='string'&&!_[_0x7437('0x7e')](_0x42d7f9)){if(!_[_0x7437('0x3e')](_0x4d5cb9)&&typeof _0x4d5cb9===_0x7437('0x92')&&!_[_0x7437('0x7e')](_0x4d5cb9)){return util['format']('\x22%s\x22\x20<%s>',_0x4d5cb9,_0x42d7f9);}return util['format']('\x22%s\x22\x20<%s>',_0x42d7f9,_0x42d7f9);}if(!_['isUndefined'](_0x3fdeca)&&typeof _0x3fdeca==='string'&&!_[_0x7437('0x7e')](_0x3fdeca)){return _0x3fdeca;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4da1b1,_0x3870d4){return function(_0x4b5762){freeVariablesPredictive(_0x3870d4);emitVoiceQueueSummary(_0x3870d4);emitCampaignSummary(_0x3870d4);loggerSyncQueueSummary['error'](_0x4da1b1,util[_0x7437('0x93')](_0x4b5762,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e5f94,_0x5d199b){return function(_0x4f66df){loggerPredictive['error'](_0x5d199b[_0x7437('0x41')],_0x1e5f94);loggerPredictive[_0x7437('0x94')](_0x4f66df[_0x7437('0x95')]);freeVariablesPredictive(_0x5d199b);};}function loggerCatch(_0x279699){return function(_0x4f4d6c){logger[_0x7437('0x94')](_0x279699,util[_0x7437('0x93')](_0x4f4d6c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xed8b61){return _0xed8b61&&!_[_0x7437('0x3e')](_0xed8b61)&&_0xed8b61[_0x7437('0x96')]>0x0;}function decremetOriginate(_0x2f2055){if(!_[_0x7437('0x3e')](_0x2f2055)&&_0x2f2055!==null){if(typeof _0x2f2055[_0x7437('0x70')]!==_0x7437('0x97')){if(_0x2f2055[_0x7437('0x70')]>0x0){_0x2f2055['originated']-=0x1;}else{logger[_0x7437('0x94')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7437('0x94')](_0x7437('0x98'));}}function checkContactLowerLimitOriginate(_0x520ec3,_0x5e9bce,_0x3fd2bc){if(_0x5e9bce>_0x3fd2bc){for(var _0x505a83=0x0;_0x505a83<_0x5e9bce-_0x3fd2bc;_0x505a83+=0x1){decremetOriginate(_0x520ec3);}}}function loggerGetContactDialer(_0x191a86,_0x5f514f,_0x222c26){return function(_0x4e6740){checkContactLowerLimitOriginate(_0x5f514f,_0x222c26,0x0);logger[_0x7437('0x94')](_0x191a86,util[_0x7437('0x93')](_0x4e6740,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2cff87){return function(_0x5db74f){if(isNotNull(_0x5db74f)&&isNotNull(_0x5db74f[0x0])){if(_0x5db74f[0x0]['contactsRescheduled']>0x0){_0x2cff87['message']='RESCHEDULED_CONTACTS';logger['info'](_0x7437('0x99')+_0x2cff87[_0x7437('0x41')],_0x5db74f[0x0][_0x7437('0x9a')],'contacts');}else{_0x2cff87['message']=_0x7437('0x9b');logger[_0x7437('0x7f')](_0x7437('0x9c')+_0x2cff87[_0x7437('0x41')]);}}};}function notSendMessagesQueue(_0x559b2e){if(_0x559b2e[_0x7437('0x9d')]){freeVariablesPredictive(_0x559b2e);if(_0x559b2e[_0x7437('0x70')]===0x0&&_0x559b2e[_0x7437('0x56')]===0x0&&_0x559b2e['waiting']===0x0&&(_0x559b2e['pTalking']||0x0)===0x0){_0x559b2e[_0x7437('0x9d')]=![];_0x559b2e[_0x7437('0x51')]=0x0;_0x559b2e['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x7437('0x94')](_0x7437('0x9e'),_0x559b2e['name'],_0x7437('0x9f'));}else{_0x559b2e[_0x7437('0x3f')]=_0x7437('0xa0');loggerSyncQueueSummary['error'](_0x7437('0x9e'),_0x559b2e[_0x7437('0x41')],_0x7437('0xa1'));}emitVoiceQueueSummary(_0x559b2e);}}function notSendMessagesCampaign(_0x508e60){if(_0x508e60[_0x7437('0x9d')]){if(_0x508e60[_0x7437('0x70')]===0x0){_0x508e60['sendMessageOneNotActive']=![];_0x508e60[_0x7437('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x7437('0x94')](_0x7437('0xa2'),_0x508e60[_0x7437('0x41')],_0x7437('0x9f'));}else{_0x508e60[_0x7437('0x3f')]=_0x7437('0xa0');loggerSyncQueueSummary[_0x7437('0x94')](_0x7437('0xa2'),_0x508e60[_0x7437('0x41')],'is\x20disactive');}emitCampaignSummary(_0x508e60);}}function createObjHistory(_0x35764b,_0x5a1090,_0x137c58,_0x6c85f7,_0x554cf7){_0x35764b[_0x7437('0x3f')]=_0x137c58;var _0x4f5849=new Action(_0x35764b,_0x5a1090);var _0x4265c8=new History(_0x4f5849);_0x4265c8['state']=_0x6c85f7;_0x4265c8[_0x7437('0xa3')]=_0x554cf7;_0x4265c8[_0x7437('0xa4')]=_0x4f5849[_0x7437('0xa5')];return _0x4265c8;}Dialer[_0x7437('0x1e')][_0x7437('0xa6')]=function(){var _0x22ae4e=this;setInterval(function(){_0x22ae4e['clearZombieChannels'](_0x22ae4e['uniqueId'],_0x7437('0xa7'));_0x22ae4e[_0x7437('0xa8')](_0x22ae4e[_0x7437('0x29')],_0x7437('0xa9'));},0x32c8);};Dialer[_0x7437('0x1e')][_0x7437('0xa8')]=function(_0x244c03,_0x1c9b78){var _0x4afd34=this;for(var _0x2d7892 in _0x244c03){if(typeof _0x244c03[_0x2d7892]!==_0x7437('0x97')){this[_0x7437('0xaa')][_0x7437('0x1f')](function(){if(!_['isNil'](_0x244c03[_0x2d7892])){return ami['Action']({'action':_0x7437('0xab'),'channel':_0x244c03[_0x2d7892]['channel']})['catch'](function(_0x598b69){if(_0x598b69[_0x7437('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x244c03[_0x2d7892]&&_0x244c03[_0x2d7892]['type']!=='ivr'){_0x4afd34[_0x7437('0xac')](_0x4afd34[_0x7437('0x23')][_0x244c03[_0x2d7892]['queue']]);logger['error'](_0x7437('0xad'),_0x1c9b78,_0x2d7892,_0x244c03[_0x2d7892][_0x7437('0xae')]);delete _0x244c03[_0x2d7892];}if(_0x244c03[_0x2d7892]&&_0x244c03[_0x2d7892][_0x7437('0x4f')]===_0x7437('0x7b')){_0x4afd34[_0x7437('0xac')](_0x4afd34[_0x7437('0x24')][_0x244c03[_0x2d7892][_0x7437('0xae')]]);logger[_0x7437('0x94')](_0x7437('0xaf'),_0x1c9b78,_0x2d7892,_0x244c03[_0x2d7892][_0x7437('0xae')]);delete _0x244c03[_0x2d7892];}},0x2328);}});}});}}};Dialer['prototype'][_0x7437('0xb0')]=function(_0x2bb33e){return BPromise[_0x7437('0xb1')]()['then'](cmHopper[_0x7437('0xb0')](_0x2bb33e))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x7437('0x1e')]['checkIsBlackList']=function(_0x4d6a5a){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperBlack[_0x7437('0xb3')](_0x4d6a5a))[_0x7437('0xb4')](loggerCatch(_0x7437('0xb5')));};Dialer[_0x7437('0x1e')]['checkIsBlackListIvr']=function(_0x2336ec){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperBlack['checkIsBlackListIvr'](_0x2336ec))[_0x7437('0xb4')](loggerCatch(_0x7437('0xb6')));};Dialer[_0x7437('0x1e')][_0x7437('0xb7')]=function(_0x45ae15){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperHistory[_0x7437('0xb8')](_0x45ae15))[_0x7437('0xb4')](loggerCatch(_0x7437('0xb9')));};Dialer['prototype']['rescheduleContact']=function(_0x39cdd9){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xba')](_0x39cdd9))[_0x7437('0xb4')](loggerCatch(_0x7437('0xbb')));};Dialer[_0x7437('0x1e')][_0x7437('0xbc')]=function(_0x268ed7,_0x44f23d,_0x554a9a){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xbc')](_0x268ed7,_0x44f23d,_0x554a9a))['catch'](loggerCatch(_0x7437('0xbd')));};Dialer[_0x7437('0x1e')][_0x7437('0xbe')]=function(_0x1dfac1,_0x4962a5,_0x5186e0,_0x29c8f9,_0x365a63){return BPromise[_0x7437('0xb1')]()['then'](cmHopper['getContactDialer'](_0x1dfac1,_0x4962a5,_0x5186e0,_0x29c8f9))[_0x7437('0xb4')](function(_0x27fed0){_0x365a63[_0x7437('0xbf')]-=_0x5186e0;_0x365a63[_0x7437('0xbf')]=_0x365a63[_0x7437('0xbf')]>0x0?_0x365a63[_0x7437('0xbf')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x27fed0);});};Dialer[_0x7437('0x1e')][_0x7437('0xc0')]=function(_0xb13c,_0x55155b,_0x1f66d3,_0x57053f){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xc0')](_0xb13c,_0x55155b,_0x1f66d3))[_0x7437('0xb4')](function(_0x22b613){_0x57053f['temp']-=_0x55155b;_0x57053f['temp']=_0x57053f['temp']>0x0?_0x57053f['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x22b613);});};Dialer[_0x7437('0x1e')][_0x7437('0xc1')]=function(_0xaa8248){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](voiceQueueRt[_0x7437('0xc1')](_0xaa8248))[_0x7437('0xb4')](loggerCatch(_0x7437('0xc2')));};Dialer[_0x7437('0x1e')][_0x7437('0xc3')]=function(_0x3cf7da){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopper[_0x7437('0xc3')](_0x3cf7da))[_0x7437('0xb4')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype']['createHistory']=function(_0x47e5bb){return BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](cmHopperHistory[_0x7437('0xc4')](_0x47e5bb))[_0x7437('0xb4')](loggerCatch('[createHistory]\x20'));};Dialer[_0x7437('0x1e')]['updateOriginated']=function(_0x920a9b){if(!_[_0x7437('0x3e')](_0x920a9b)&&_0x920a9b!==null){if(typeof _0x920a9b[_0x7437('0x70')]!==_0x7437('0x97')){if(_0x920a9b[_0x7437('0x70')]>0x0){_0x920a9b[_0x7437('0x70')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7437('0x94')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x7437('0x1e')][_0x7437('0xc5')]=function(_0xb228c2,_0x16e1d5){var _0x5deac0=this;return function(_0x181ae3){_0x5deac0[_0x7437('0xac')](_0x16e1d5);logger[_0x7437('0x94')](_0xb228c2,util[_0x7437('0x93')](_0x181ae3,{'showHidden':![],'depth':null}));};};Dialer[_0x7437('0x1e')][_0x7437('0xc6')]=function(_0x38da44,_0x59b859,_0x3d5ced){var _0x2f5ae7={'state':0x19,'statedesc':_0x7437('0xc7')};this[_0x7437('0xac')](_0x59b859);this[_0x7437('0xc8')](_[_0x7437('0x8e')](_0x2f5ae7,_[_0x7437('0xc9')](_0x3d5ced,[_0x7437('0xca'),_0x7437('0xcb'),'UserId',_0x7437('0xcc'),_0x7437('0xcd')])),_0x7437('0xce'),'[emptyContact]');logger[_0x7437('0x94')](_0x38da44);};Dialer[_0x7437('0x1e')][_0x7437('0xcf')]=function(_0x5d2c33){return _0x5d2c33==='Success';};Dialer[_0x7437('0x1e')]['isTrunkReachable']=function(_0x2434d1){return!_['isUndefined'](_0x2434d1)&&_0x2434d1&&!_[_0x7437('0x3e')](_0x2434d1[_0x7437('0x41')])&&!_[_0x7437('0x3e')](_0x2434d1['active'])&&_0x2434d1[_0x7437('0x77')]&&(this[_0x7437('0x26')][util[_0x7437('0x79')](_0x7437('0xd0'),_0x2434d1['name'])]['status']===_0x7437('0xd1')||this[_0x7437('0x26')][util[_0x7437('0x79')]('SIP/%s',_0x2434d1[_0x7437('0x41')])][_0x7437('0xab')]==='unmonitored');};Dialer[_0x7437('0x1e')][_0x7437('0xc8')]=function(_0x397fc1,_0x28df06,_0xe5b3c8){this[_0x7437('0xc4')](_0x397fc1)[_0x7437('0xb4')](loggerCatch(_0x28df06));this[_0x7437('0xc3')](_0x397fc1)[_0x7437('0xb4')](loggerCatch(_0xe5b3c8));};Dialer[_0x7437('0x1e')][_0x7437('0x3a')]=function(_0x1ae7a4){var _0x2d2179=this[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];var _0x2300db;if(!_['isNil'](_0x1ae7a4)&&!_[_0x7437('0xd4')](_0x1ae7a4[_0x7437('0xd5')])&&!_['isNil'](_0x1ae7a4['variable'][_0x7437('0xd6')])&&_0x1ae7a4[_0x7437('0xd7')]===_0x7437('0xd8')&&_0x2d2179){if(_0x2d2179[_0x7437('0x4f')]!==_0x7437('0x7b')&&this[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]][_0x7437('0xd9')]&&_0x1ae7a4[_0x7437('0xda')]===_0x7437('0xdb')){delete this['uniqueId'][_0x1ae7a4[_0x7437('0xd3')]];this[_0x7437('0xac')](this[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]]);this[_0x7437('0x23')][_0x2d2179['queue']][_0x7437('0x5d')]+=0x1;this['voiceQueues'][_0x2d2179[_0x7437('0xae')]][_0x7437('0xdc')]+=0x1;_0x2300db=new Hangup(_0x2d2179,_0x1ae7a4);_0x2300db[_0x7437('0xdd')]=0x12;_0x2300db[_0x7437('0xa3')]=_0x7437('0xde');_0x2300db[_0x7437('0xdf')]=_0x7437('0xe0');ami[_0x7437('0x4e')](_0x7437('0xe1'),ut[_0x7437('0xe2')](_0x2300db,_0x7437('0xe3')));this['saveInDb'](_0x2300db,_0x7437('0xe4'),_0x7437('0xe5'));}if(_0x2d2179[_0x7437('0x4f')]!==_0x7437('0x7b')&&this[_0x7437('0x23')][_0x2d2179['queue']][_0x7437('0xd9')]&&_0x1ae7a4[_0x7437('0xda')]===_0x7437('0xe6')){var _0xda8e06=this;return new BPromise(function(_0x485cf3,_0x366835){delete _0xda8e06[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];_0xda8e06['updateOriginated'](_0xda8e06[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]]);_0xda8e06[_0x7437('0x23')][_0x2d2179['queue']][_0x7437('0x5d')]+=0x1;_0xda8e06[_0x7437('0x23')][_0x2d2179[_0x7437('0xae')]][_0x7437('0xdc')]+=0x1;var _0xf65a9e=_0xda8e06['voiceQueues'][_0x2d2179['queue']];var _0x13d9e0=new Hangup(_0x2d2179,_0x1ae7a4);_0x13d9e0[_0x7437('0xdd')]=0x13;_0x13d9e0[_0x7437('0xa3')]=_0x7437('0xe7');_0x13d9e0[_0x7437('0xdf')]=_0x7437('0xe0');_0x13d9e0[_0x7437('0xe8')]+=0x1;_0x13d9e0[_0x7437('0xe9')]+=0x1;_0x13d9e0['amd']=!![];ami[_0x7437('0x4e')](_0x7437('0xe1'),ut['buildObj'](_0x13d9e0,_0x7437('0xe3')));_0xda8e06['createHistory'](_0x13d9e0)[_0x7437('0xb4')](loggerCatch(_0x7437('0xea')));if(_0x13d9e0['countbusyretry']+_0x13d9e0['countcongestionretry']+_0x13d9e0[_0x7437('0xeb')]+_0x13d9e0[_0x7437('0xec')]+_0x13d9e0['countdropretry']+_0x13d9e0[_0x7437('0xed')]+_0x13d9e0[_0x7437('0xe8')]+_0x13d9e0[_0x7437('0xee')]>=_0xf65a9e[_0x7437('0xef')]){_0xda8e06[_0x7437('0xf0')](_0x13d9e0,_0x485cf3,_0x366835,_0x7437('0xf1'));}else{if(_0x13d9e0[_0x7437('0xe8')]>=_0xf65a9e['dialMachineMaxRetry']){_0xda8e06[_0x7437('0xf2')](_0x13d9e0,_0x485cf3,_0x366835,'reason\x2019\x20machine....');}else{_0xda8e06[_0x7437('0xba')]({'active':![],'countmachineretry':_0x13d9e0[_0x7437('0xe8')],'scheduledat':moment()[_0x7437('0xf3')](_0xf65a9e[_0x7437('0xf4')],_0x7437('0xf5'))['format'](_0x7437('0xf6')),'ContactId':_0x13d9e0[_0x7437('0xca')],'ListId':_0x13d9e0[_0x7437('0xcb')],'VoiceQueueId':_0x13d9e0[_0x7437('0xcc')]||undefined,'CampaignId':_0x13d9e0[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0xf7')));_0x485cf3({'reschedule':0x1});}}});}if(_0x2d2179[_0x7437('0x4f')]===_0x7437('0x7b')&&this[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]][_0x7437('0xd9')]&&_0x1ae7a4['value']==='HANGUP'){delete this[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];this[_0x7437('0xac')](this['campaigns'][_0x2d2179[_0x7437('0xae')]]);_0x2300db=new Hangup(_0x2d2179,_0x1ae7a4);_0x2300db['state']=0x12;_0x2300db[_0x7437('0xa3')]=_0x7437('0xde');_0x2300db[_0x7437('0xdf')]='AMD';ami[_0x7437('0x4e')]('custom:amd',ut[_0x7437('0xe2')](_0x2300db,_0x7437('0xe3')));this[_0x7437('0xc8')](_0x2300db,'[syncHangupInAMDIvr][createHistory]',_0x7437('0xf8'));}if(_0x2d2179[_0x7437('0x4f')]===_0x7437('0x7b')&&this['campaigns'][_0x2d2179[_0x7437('0xae')]]['dialAMDActive']&&_0x1ae7a4[_0x7437('0xda')]==='MACHINE'){var _0xda8e06=this;return new BPromise(function(_0x2ad1d5,_0x9d4b04){delete _0xda8e06[_0x7437('0xd2')][_0x1ae7a4[_0x7437('0xd3')]];_0xda8e06[_0x7437('0xac')](_0xda8e06[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]]);_0xda8e06[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]][_0x7437('0x5d')]+=0x1;_0xda8e06[_0x7437('0x24')][_0x2d2179[_0x7437('0xae')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xf1dacc=_0xda8e06[_0x7437('0x24')][_0x2d2179['queue']];var _0x1553b0=new Hangup(_0x2d2179,_0x1ae7a4);_0x1553b0['state']=0x13;_0x1553b0[_0x7437('0xa3')]='Machine';_0x1553b0[_0x7437('0xdf')]=_0x7437('0xe0');_0x1553b0[_0x7437('0xe8')]+=0x1;_0x1553b0['countglobal']+=0x1;_0x1553b0[_0x7437('0xe3')]=!![];ami['emit'](_0x7437('0xe1'),ut[_0x7437('0xe2')](_0x1553b0,_0x7437('0xe3')));_0xda8e06['createHistory'](_0x1553b0)[_0x7437('0xb4')](loggerCatch(_0x7437('0xea')));if(_0x1553b0['countbusyretry']+_0x1553b0[_0x7437('0xf9')]+_0x1553b0[_0x7437('0xeb')]+_0x1553b0[_0x7437('0xec')]+_0x1553b0[_0x7437('0xfa')]+_0x1553b0['countabandonedretry']+_0x1553b0[_0x7437('0xe8')]+_0x1553b0[_0x7437('0xee')]>=_0xf1dacc[_0x7437('0xef')]){_0xda8e06[_0x7437('0xf0')](_0x1553b0,_0x2ad1d5,_0x9d4b04,'reason19\x20machine....');}else{if(_0x1553b0[_0x7437('0xe8')]>=_0xf1dacc[_0x7437('0xfb')]){_0xda8e06[_0x7437('0xf2')](_0x1553b0,_0x2ad1d5,_0x9d4b04,'reason\x2019\x20machine....');}else{_0xda8e06[_0x7437('0xba')]({'active':![],'countmachineretry':_0x1553b0['countmachineretry'],'scheduledat':moment()[_0x7437('0xf3')](_0xf1dacc['dialMachineRetryFrequency'],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x1553b0[_0x7437('0xca')],'ListId':_0x1553b0['ListId'],'VoiceQueueId':_0x1553b0['VoiceQueueId']||undefined,'CampaignId':_0x1553b0[_0x7437('0xcd')]||undefined})['catch'](loggerCatch(_0x7437('0xf7')));_0x2ad1d5({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x41f5cd){var _0x187772=this[_0x7437('0xd2')][_0x41f5cd[_0x7437('0xd3')]];var _0x1d1b71=this;var _0x41cdfd;if(_0x187772&&_0x187772[_0x7437('0x4f')]==='ivr'){delete this[_0x7437('0xd2')][_0x41f5cd['uniqueid']];this[_0x7437('0xac')](this['campaigns'][_0x187772[_0x7437('0xae')]]);this[_0x7437('0x24')][_0x187772[_0x7437('0xae')]][_0x7437('0xfc')]+=0x1;_0x41cdfd=new Hangup(_0x187772,_0x41f5cd);this['createHistory'](_0x41cdfd)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x7437('0xc3')](_0x41cdfd)[_0x7437('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x187772&&_0x187772[_0x7437('0x4f')]!==_0x7437('0x7b')&&isNotNull(this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]][_0x7437('0xfd')])){delete this[_0x7437('0xd2')][_0x41f5cd[_0x7437('0xd3')]];this[_0x7437('0xac')](this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]]);this['voiceQueues'][_0x187772[_0x7437('0xae')]][_0x7437('0x5d')]+=0x1;this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]][_0x7437('0xdc')]+=0x1;_0x41cdfd=new Hangup(_0x187772,_0x41f5cd);_0x41cdfd['state']=0x10;_0x41cdfd[_0x7437('0xa3')]='AnswerAGI';_0x41cdfd[_0x7437('0xdf')]=_0x7437('0xfe');this[_0x7437('0xc4')](_0x41cdfd)['catch'](loggerCatch(_0x7437('0xff')));this['moveContactManagedDialer'](_0x41cdfd)[_0x7437('0xb4')](loggerCatch(_0x7437('0x100')));}if(_0x187772&&_0x187772[_0x7437('0x4f')]!==_0x7437('0x7b')&&!isNotNull(this[_0x7437('0x23')][_0x187772[_0x7437('0xae')]][_0x7437('0xfd')])){delete this[_0x7437('0xd2')][_0x41f5cd[_0x7437('0xd3')]];this[_0x7437('0xac')](this['voiceQueues'][_0x187772[_0x7437('0xae')]]);this['voiceQueues'][_0x187772[_0x7437('0xae')]]['outboundUnknownCallsDay']+=0x1;_0x41cdfd=new Hangup(_0x187772,_0x41f5cd);_0x41cdfd['state']=0xc;_0x41cdfd[_0x7437('0xa3')]=_0x41f5cd[_0x7437('0x101')];_0x41cdfd[_0x7437('0xdf')]='Unknow';this[_0x7437('0xc4')](_0x41cdfd)[_0x7437('0xb4')](loggerCatch(_0x7437('0xff')));this[_0x7437('0xc3')](_0x41cdfd)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x7437('0x1e')]['syncAgentComplete']=function(_0x36aa3d){var _0x24af1c=this['uniqueId'][_0x36aa3d['uniqueid']];var _0xf7cd8d=this;if(this[_0x7437('0x23')][_0x36aa3d[_0x7437('0xae')]]){if(_0x24af1c&&_0x24af1c[_0x7437('0x4f')]!==_0x7437('0x7b')){delete this[_0x7437('0xd2')][_0x36aa3d[_0x7437('0xd3')]];this[_0x7437('0x23')][_0x36aa3d[_0x7437('0xae')]][_0x7437('0x5d')]+=0x1;var _0x3d169a=new AgentComplete(_0x24af1c,_0x36aa3d);if(_0x36aa3d[_0x7437('0x102')]===_0x7437('0x103')){_0x3d169a[_0x7437('0x104')]=this[_0x7437('0x23')][_0x36aa3d[_0x7437('0xae')]][_0x7437('0x105')]&&this[_0x7437('0x23')][_0x36aa3d['queue']]['dialAgiAfterHangupAgent']?moment()[_0x7437('0x79')](_0x7437('0xf6')):undefined;}this[_0x7437('0xc4')](_0x3d169a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x106')));this[_0x7437('0xc3')](_0x3d169a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x107')));}}};Dialer[_0x7437('0x1e')]['syncAgentConnect']=function(_0x1a392b){if(this[_0x7437('0x23')][_0x1a392b[_0x7437('0xae')]]){if(this['uniqueId'][_0x1a392b[_0x7437('0xd3')]]&&this[_0x7437('0xd2')][_0x1a392b['uniqueid']][_0x7437('0x4f')]!==_0x7437('0x7b')){this['updateOriginated'](this['voiceQueues'][_0x1a392b[_0x7437('0xae')]]);this['uniqueId'][_0x1a392b[_0x7437('0xd3')]][_0x7437('0x108')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));}}};Dialer['prototype'][_0x7437('0x109')]=function(_0x2269cd){this['createHistory'](_0x2269cd)['catch'](loggerCatch(_0x7437('0x106')));this['moveContactManagedDialer'](_0x2269cd)['catch'](loggerCatch(_0x7437('0x10a')));};Dialer[_0x7437('0x1e')][_0x7437('0x33')]=function(_0x3c004e){var _0x249022=this[_0x7437('0xd2')][_0x3c004e[_0x7437('0xd3')]];var _0x5c0f00=this;if(this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]]){if(_0x249022&&_0x249022[_0x7437('0x4f')]!=='ivr'){delete this[_0x7437('0xd2')][_0x3c004e[_0x7437('0xd3')]];this[_0x7437('0xac')](this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]]);_0x249022[_0x7437('0x10b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x16ca6f=new QueueCallerAbandon(_0x249022,_0x3c004e);if(getSeconds(_0x249022[_0x7437('0x10b')],_0x249022['responsetime'])>=_0x249022[_0x7437('0x10c')]){this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x69')]+=0x1;this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x10d')]+=0x1;this[_0x7437('0x23')][_0x3c004e['queue']][_0x7437('0x6b')]+=0x1;_0x16ca6f['state']=0xa;_0x16ca6f[_0x7437('0xa3')]=_0x7437('0x10e');_0x16ca6f[_0x7437('0x10f')]=_0x7437('0x110');_0x16ca6f[_0x7437('0x104')]=this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]]['dialQueueProject2']?moment()[_0x7437('0x79')](_0x7437('0xf6')):undefined;_0x16ca6f[_0x7437('0xfa')]+=0x1;_0x16ca6f[_0x7437('0xe9')]+=0x1;if(_0x16ca6f[_0x7437('0xfa')]>=this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x111')]){this[_0x7437('0x109')](_0x16ca6f);}else{this[_0x7437('0xba')]({'active':![],'countdropretry':_0x16ca6f['countdropretry'],'scheduledat':moment()[_0x7437('0xf3')](this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x112')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x249022[_0x7437('0xca')],'ListId':_0x249022[_0x7437('0xcb')],'VoiceQueueId':_0x249022['VoiceQueueId']||undefined,'CampaignId':_0x249022[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x113')));var _0x40777a=new History(_0x16ca6f);_0x40777a[_0x7437('0xdd')]=0xa;_0x40777a['statedesc']='Drop';_0x40777a[_0x7437('0xa5')]=moment()['format'](_0x7437('0xf6'));_0x40777a[_0x7437('0xa4')]=_0x40777a[_0x7437('0xa5')];_0x40777a[_0x7437('0x114')]=_0x16ca6f[_0x7437('0x114')];_0x40777a['calleridnum']=_0x16ca6f[_0x7437('0x115')];this[_0x7437('0xc4')](_0x40777a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x116')));}}else{this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x68')]+=0x1;this[_0x7437('0x23')][_0x3c004e['queue']][_0x7437('0x61')]+=0x1;_0x16ca6f[_0x7437('0xdd')]=0xb;_0x16ca6f['statedesc']=_0x7437('0x117');_0x16ca6f['dropreason']=_0x7437('0x118');_0x16ca6f[_0x7437('0xed')]+=0x1;_0x16ca6f[_0x7437('0xe9')]+=0x1;if(_0x16ca6f['countabandonedretry']>=this[_0x7437('0x23')][_0x3c004e[_0x7437('0xae')]][_0x7437('0x119')]){this[_0x7437('0x109')](_0x16ca6f);}else{this[_0x7437('0xba')]({'active':![],'countabandonedretry':_0x16ca6f[_0x7437('0xed')],'scheduledat':moment()['add'](this['voiceQueues'][_0x3c004e[_0x7437('0xae')]][_0x7437('0x11a')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x249022[_0x7437('0xca')],'ListId':_0x249022[_0x7437('0xcb')],'VoiceQueueId':_0x249022[_0x7437('0xcc')]||undefined,'CampaignId':_0x249022[_0x7437('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x40777a=new History(_0x16ca6f);_0x40777a[_0x7437('0xdd')]=0xb;_0x40777a['statedesc']=_0x7437('0x117');_0x40777a[_0x7437('0xa5')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));_0x40777a[_0x7437('0xa4')]=_0x40777a[_0x7437('0xa5')];_0x40777a[_0x7437('0x114')]=_0x16ca6f[_0x7437('0x114')];_0x40777a[_0x7437('0x115')]=_0x16ca6f[_0x7437('0x115')];this[_0x7437('0xc4')](_0x40777a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x11b')));}}}}};Dialer[_0x7437('0x1e')]['syncNewExten']=function(_0x583c63){if(this[_0x7437('0x29')][_0x583c63[_0x7437('0xd3')]]){this[_0x7437('0x29')][_0x583c63[_0x7437('0xd3')]]['channel']=_0x583c63[_0x7437('0x11c')];}if(this[_0x7437('0xd2')][_0x583c63[_0x7437('0xd3')]]){this[_0x7437('0xd2')][_0x583c63[_0x7437('0xd3')]]['channel']=_0x583c63[_0x7437('0x11c')];}};Dialer[_0x7437('0x1e')][_0x7437('0x11d')]=function(_0x4bfab6){if(strategy[this[_0x7437('0x23')][this[_0x7437('0x29')][_0x4bfab6['actionid']][_0x7437('0xae')]][_0x7437('0x11e')]]===_0x7437('0x11f')){if(this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]&&_[_0x7437('0xd4')](this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]['locked'])&&_0x4bfab6[_0x7437('0xab')]==='1'&&_0x4bfab6['paused']==='0'){if(this['agents'][_0x4bfab6[_0x7437('0x121')]]){if(!this[_0x7437('0x25')][_0x4bfab6[_0x7437('0x121')]][_0x7437('0x122')]){this[_0x7437('0x25')][_0x4bfab6[_0x7437('0x121')]][_0x7437('0x122')]=!![];this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]][_0x7437('0x122')]=!![];this[_0x7437('0x29')][_0x4bfab6['actionid']][_0x7437('0x121')]=_0x4bfab6[_0x7437('0x121')];}}}}else if((strategy[this[_0x7437('0x23')][this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]['queue']][_0x7437('0x11e')]]||_0x7437('0x123'))===_0x7437('0x123')){if(this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]]){if(this['agents'][_0x4bfab6['stateinterface']]){this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]][_0x7437('0x121')]=_0x4bfab6['stateinterface'];if(_[_0x7437('0xd4')](this[_0x7437('0x2d')][this[_0x7437('0x29')][_0x4bfab6[_0x7437('0x120')]][_0x7437('0xae')]])){this[_0x7437('0x2d')][this['actions'][_0x4bfab6['actionid']][_0x7437('0xae')]]=[];}this[_0x7437('0x2d')][this['actions'][_0x4bfab6[_0x7437('0x120')]][_0x7437('0xae')]][_0x7437('0x124')](_[_0x7437('0x8e')](_[_0x7437('0xc9')](this['actions'][_0x4bfab6[_0x7437('0x120')]],[_0x7437('0x125'),_0x7437('0x121')]),{'status':_0x4bfab6[_0x7437('0xab')],'paused':_0x4bfab6[_0x7437('0x126')]}));}}}};function unlockQueueStatus(_0x406e2a,_0x3add2b){setTimeout(function(){if(_['isUndefined'](_0x406e2a[_0x7437('0x127')])){loggerBooked['error'](_0x7437('0x128'),_0x3add2b);}_0x406e2a[_0x7437('0x127')]=!![];loggerBooked['info'](_0x7437('0x129'),_0x3add2b,JSON[_0x7437('0x4a')](_[_0x7437('0xc9')](_0x406e2a,[_0x7437('0x41'),_0x7437('0x127')])));},0x1f3);}Dialer[_0x7437('0x1e')][_0x7437('0x12a')]=function(_0x334631){var _0xcb438d=this;var _0x56f52b=_0xcb438d['voiceQueues'][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['queue']];if(strategy[this[_0x7437('0x23')][this['actions'][_0x334631['actionid']][_0x7437('0xae')]][_0x7437('0x11e')]]==='roundrobin'){if(this['actions'][_0x334631['actionid']]&&this[_0x7437('0x29')][_0x334631['actionid']]['stateinterface']){this['preview'][_0x7437('0x12b')](this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0x125')],this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0x121')])['catch'](function(_0x2ba146){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x7437('0x93')](_0x2ba146,{'showHidden':![],'depth':null}));})[_0x7437('0x21')](function(){_0xcb438d[_0x7437('0xac')](_0xcb438d[_0x7437('0x23')][_0xcb438d['actions'][_0x334631['actionid']][_0x7437('0xae')]]);_0xcb438d['agents'][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0x121')]][_0x7437('0x122')]=![];delete _0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]];unlockQueueStatus(_0x56f52b);});}else{this[_0x7437('0xac')](this['voiceQueues'][this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]]);this[_0x7437('0xba')]({'active':![],'ContactId':this['actions'][_0x334631[_0x7437('0x120')]]['ContactId'],'ListId':this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['ListId'],'VoiceQueueId':this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xcc')]||undefined,'CampaignId':this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x12c')));delete this['actions'][_0x334631[_0x7437('0x120')]];unlockQueueStatus(_0x56f52b);}}else if((strategy[this[_0x7437('0x23')][this[_0x7437('0x29')][_0x334631['actionid']][_0x7437('0xae')]][_0x7437('0x11e')]]||_0x7437('0x123'))===_0x7437('0x123')){var _0x58a9c9;if(this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]&&!_[_0x7437('0x7e')](this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]])){if(this[_0x7437('0x2e')][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]]){this[_0x7437('0x2e')][_0xcb438d[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['queue']]=this[_0x7437('0x2e')][this[_0x7437('0x29')][_0x334631[_0x7437('0x120')]]['queue']]?this[_0x7437('0x2e')][this[_0x7437('0x29')][_0x334631['actionid']][_0x7437('0xae')]]:this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]]['queue']]?this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]][_0x7437('0x12d')]||0x0:0x0;}this[_0x7437('0x2d')][this['actions'][_0x334631[_0x7437('0x120')]][_0x7437('0xae')]]['_rr']=this[_0x7437('0x2e')][this['actions'][_0x334631[_0x7437('0x120')]]['queue']];for(var _0x5ac28c=0x0;_0x5ac28c=0x0;})[_0x7437('0xb4')](myreject(_0x5e05fa)));}}else{_0x590c77[_0x7437('0x124')](ami[_0x7437('0x148')]({'action':'command','command':util[_0x7437('0x79')](_0x7437('0x14c'),_0xdc10d6,!_[_0x7437('0x3e')](config[_0x7437('0x144')][_0x1b9e80])?_0x1b9e80:'')})[_0x7437('0xb2')](function(_0x5dcaa3){return _0x5dcaa3[_0x7437('0x14d')][_0x7437('0x14b')]('true')>=0x0;})[_0x7437('0xb4')](myreject(_0x5e05fa)));}BPromise['all'](_0x590c77)[_0x7437('0xb2')](function(_0x38358e){var _0x4d5fa5=_[_0x7437('0x14e')](_0x38358e);if(_0x4d5fa5){return _0x37b71c(_0x4d5fa5);}else{_0x405450['message']=_0x591cd0?_0x7437('0x14f'):_0x7437('0x150');return _0x5e05fa(msgResponse(_0x7437('0x151'),_0x7437('0x141'),'Global:\x20'+_0x591cd0+'\x20'+_0x28c52a+_0x7437('0x152')+util[_0x7437('0x93')](_0xdc10d6,{'showHidden':![],'depth':null})+_0x7437('0x153')+_0x1b9e80));}})[_0x7437('0xb4')](function(_0x55ecef){return _0x5e05fa(msgResponse('ifTime',_0x7437('0x141'),JSON['stringify'](_0x55ecef)));});});};Dialer[_0x7437('0x1e')]['checkDialMethod']=function(_0x17fbc3){var _0x599b7d=this;return function(){switch(_0x17fbc3[_0x7437('0x59')]){case _0x7437('0x154'):freeVariablesPredictive(_0x17fbc3);_0x599b7d[_0x7437('0x155')](_0x17fbc3,0x1);break;case'power':freeVariablesPredictive(_0x17fbc3);_0x599b7d[_0x7437('0x155')](_0x17fbc3,_0x17fbc3[_0x7437('0x156')]);break;case _0x7437('0xa'):_0x599b7d[_0x7437('0xa')](_0x17fbc3);break;case'booked':freeVariablesPredictive(_0x17fbc3);_0x599b7d[_0x7437('0x155')](_0x17fbc3,0x1);break;default:freeVariablesPredictive(_0x17fbc3);logger['error']('Queue',_0x17fbc3[_0x7437('0x41')],_0x7437('0x157'));}};};Dialer['prototype'][_0x7437('0x158')]=function(_0x4ae87d){return BPromise[_0x7437('0xb1')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x4ae87d['id'],previewRecallmeReminderInterval))[_0x7437('0xb2')](function(_0x1642a1){for(var _0x2a5dea=0x0;_0x2a5dea<_0x1642a1[_0x7437('0x96')];_0x2a5dea++){var _0x3d855a=_0x1642a1[_0x2a5dea][_0x7437('0x159')]['name'];if(_0x3d855a)io['to'](util['format'](_0x7437('0x15a'),_0x3d855a))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x1642a1[_0x2a5dea]});}})['catch'](function(_0x2ee9d6){});};Dialer[_0x7437('0x1e')]['launchHandleIvr']=function(_0x4a7a79){var _0x2e8f4c=this;return function(){_0x2e8f4c['handleIvr'](_0x4a7a79);};};Dialer[_0x7437('0x1e')]['syncQueueSummary']=function(_0x44da62){var _0x7f41d2=this;if(isNotPreview(_0x44da62[_0x7437('0x59')])){if(isVoiceQueueOutbound(_0x44da62[_0x7437('0x4f')])&&isActive(_0x44da62[_0x7437('0x15b')])){_0x44da62[_0x7437('0x9d')]=!![];BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](checkIsLoggedIn(_0x44da62,_0x44da62['loggedIn']))[_0x7437('0xb2')](checkIsActive(_0x44da62,_0x44da62[_0x7437('0x15b')]))['then'](checkInterval(_0x44da62))[_0x7437('0xb2')](_0x7f41d2['checkIsTrunkReachable'](_0x44da62))['then'](_0x7f41d2['checkIfTime'](_0x44da62['dialGlobalInterval'],_0x44da62['dialTimezone'],_0x44da62[_0x7437('0x41')],_0x44da62))[_0x7437('0xb2')](_0x7f41d2[_0x7437('0x140')](_0x44da62[_0x7437('0x46')],_0x44da62[_0x7437('0x15c')],_0x44da62[_0x7437('0x41')],_0x44da62))[_0x7437('0xb2')](_0x7f41d2['checkDialMethod'](_0x44da62))[_0x7437('0xb4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x44da62));}else{notSendMessagesQueue(_0x44da62);}}else{freeVariablesPredictive(_0x44da62);if(_0x44da62[_0x7437('0x15d')]){_0x7f41d2[_0x7437('0x158')](_0x44da62);}}};Dialer[_0x7437('0x1e')][_0x7437('0x139')]=function(){var _0x2181b1=this;var _0x1bb817;for(var _0x526fb4 in this['campaigns']){if(typeof this['campaigns'][_0x526fb4]!=='undefined'){_0x1bb817=this['campaigns'][_0x526fb4];if(isCampaignIvr(_0x1bb817[_0x7437('0x4f')])&&isActive(_0x1bb817[_0x7437('0x77')])){_0x1bb817[_0x7437('0x9d')]=!![];BPromise[_0x7437('0xb1')]()[_0x7437('0xb2')](checkIsActive(_0x1bb817,_0x1bb817[_0x7437('0x77')]))[_0x7437('0xb2')](checkInterval(_0x1bb817))[_0x7437('0xb2')](_0x2181b1[_0x7437('0x13a')](_0x1bb817))[_0x7437('0xb2')](_0x2181b1['checkIfTime'](_0x1bb817[_0x7437('0x15e')],_0x1bb817[_0x7437('0x15c')],_0x1bb817[_0x7437('0x41')],_0x1bb817))[_0x7437('0xb2')](_0x2181b1[_0x7437('0x140')](_0x1bb817[_0x7437('0x46')],_0x1bb817['dialTimezone'],_0x1bb817[_0x7437('0x41')],_0x1bb817))[_0x7437('0xb2')](_0x2181b1[_0x7437('0x15f')](_0x1bb817))[_0x7437('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x1bb817));}else{notSendMessagesCampaign(_0x1bb817);}}}};function getCallerIdRandom(_0x3a630d,_0x3c54ca){var _0x1b0295;var _0x272034;var _0x9a0de5;if(_0x3c54ca<=0x0){_0x3c54ca=0x1;}_0x1b0295=new RegExp('\x5cw{0,'+_0x3c54ca+'}$');_0x272034=Math['pow'](0xa,_0x3c54ca-0x1);_0x9a0de5=Math[_0x7437('0x160')](0xa,_0x3c54ca)-0x1;return util[_0x7437('0x79')]('%s',_[_0x7437('0x161')](_0x3a630d,_0x1b0295,_[_0x7437('0x162')](_0x272034,_0x9a0de5)));}function extractCalleridName(_0x155203){var _0xeb22b6=_0x155203[_0x7437('0x163')](/"(.*?)"/);return _0xeb22b6?_0xeb22b6[0x1]:_0x155203;}function extractCalleridNumber(_0x355f49){var _0x320c23=_0x355f49[_0x7437('0x163')](/<(.*?)>/);return _0x320c23?_0x320c23[0x1]:_0x355f49;}Dialer[_0x7437('0x1e')][_0x7437('0x164')]=function(_0x3087f9,_0x13c153){var _0x3f1d25=this;var _0x2d3803=uuid['v4']();this[_0x7437('0x29')][_0x2d3803]=new Action(_0x3087f9,_0x13c153,_0x2d3803);return new BPromise(function(_0x8cb869,_0x5d8104){if(_[_0x7437('0x3e')](_0x3087f9)&&typeof _0x3087f9!=='object'){return _0x5d8104(msgResponse('originate',_0x7437('0x141'),'voiceQueue\x20is\x20undefine'));}if(_[_0x7437('0x3e')](_0x13c153[_0x7437('0x165')][_0x7437('0x166')])||_0x13c153[_0x7437('0x165')]['phone']===null){return _0x5d8104(msgResponse(_0x7437('0x167'),_0x7437('0x141'),'contact\x20is\x20undefine'));}var _0x35379b={'XMD-CALLERID':_0x3f1d25['actions'][_0x2d3803][_0x7437('0x168')](),'XMD-AGI':_0x3087f9[_0x7437('0xfd')]?util[_0x7437('0x79')](_0x7437('0x169'),ipAgi,_0x3087f9['dialQueueProject']):_0x7437('0x16a'),'XMD-AGIAFTER':_0x3087f9[_0x7437('0x105')]?util[_0x7437('0x79')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3087f9['dialQueueProject2']):_0x7437('0x16a'),'XMD-QUEUE':_0x3087f9[_0x7437('0x4f')]===_0x7437('0x16b')?util[_0x7437('0x79')](_0x7437('0x16c'),_0x3087f9[_0x7437('0x41')],_0x3087f9['dialQueueOptions']||'',_0x3087f9[_0x7437('0x16d')]?'c':'',_0x3087f9[_0x7437('0x10c')]||0x3):_0x7437('0x16a'),'XMD-CONTACTID':_0x13c153[_0x7437('0xca')],'XMD-CDRTYPE':_0x7437('0x9'),'CALLERID(all)':_0x3f1d25[_0x7437('0x29')][_0x2d3803][_0x7437('0x168')](),'XMD-AMD':_0x3087f9[_0x7437('0xd9')]?_0x7437('0x16e'):_0x7437('0x16a'),'XMD-DESTINATION':_0x7437('0xd8')};if(_0x3087f9[_0x7437('0xd9')]){_0x35379b[_0x7437('0x16f')]=_0x3087f9['dialAMDInitialSilence']||0x9c4;_0x35379b[_0x7437('0x170')]=_0x3087f9[_0x7437('0x171')]||0x5dc;_0x35379b[_0x7437('0x172')]=_0x3087f9[_0x7437('0x173')]||0x320;_0x35379b['XMD-AMDTOTALANALYSISTIME']=_0x3087f9[_0x7437('0x174')]||0x1388;_0x35379b[_0x7437('0x175')]=_0x3087f9[_0x7437('0x176')]||0x64;_0x35379b[_0x7437('0x177')]=_0x3087f9[_0x7437('0x178')]||0x32;_0x35379b[_0x7437('0x179')]=_0x3087f9[_0x7437('0x17a')]||0x3;_0x35379b[_0x7437('0x17b')]=_0x3087f9['dialAMDSilenceThreshold']||0x100;_0x35379b[_0x7437('0x17c')]=_0x3087f9[_0x7437('0x17d')]||0x1388;}if(_0x3087f9[_0x7437('0x4f')]===_0x7437('0x16b')){_0x35379b[_0x7437('0x17e')]=_0x13c153[_0x7437('0xcc')];}else{_0x35379b[_0x7437('0x17f')]=_0x13c153[_0x7437('0xcd')];}for(var _0x26d29f in _0x13c153[_0x7437('0x165')]){if(typeof _0x13c153['Contact'][_0x26d29f]!==_0x7437('0x97')){if(isNotNull(_0x13c153[_0x7437('0x165')][_0x26d29f])&&_0x26d29f!=='id'&&_0x26d29f!==_0x7437('0x180')&&_0x26d29f!==_0x7437('0x181')&&_0x26d29f!==_0x7437('0x182')){_0x35379b[util['format'](_0x7437('0x183'),_0x7437('0x184'),_[_0x7437('0x185')](_0x26d29f))]=_0x13c153['Contact'][_0x26d29f];}}}var _0x502ab7=_0x3f1d25['isTrunkReachable'](_0x3087f9[_0x7437('0x76')])?getCallerId(_0x3087f9[_0x7437('0x76')]['callerid'],_0x3087f9[_0x7437('0x5a')],_0x3087f9['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3087f9['dialOriginateCallerIdNumber'],_0x3087f9[_0x7437('0x186')]):_0x3087f9[_0x7437('0x5b')]):getCallerId(_['isNil'](_0x3087f9['TrunkBackup'])?_0x3087f9[_0x7437('0x76')][_0x7437('0x78')]:_0x3087f9[_0x7437('0x13b')][_0x7437('0x78')],_0x3087f9['dialOriginateCallerIdName'],_0x3087f9[_0x7437('0x186')]>0x0?getCallerIdRandom(_0x3087f9[_0x7437('0x5b')],_0x3087f9[_0x7437('0x186')]):_0x3087f9[_0x7437('0x5b')]);if(_0x502ab7){_0x35379b['XMD-ORIGINATECALLERIDNAME']=_0x3f1d25['actions'][_0x2d3803][_0x7437('0x187')]=extractCalleridName(_0x502ab7);_0x35379b[_0x7437('0x188')]=_0x3f1d25[_0x7437('0x29')][_0x2d3803][_0x7437('0x189')]=extractCalleridNumber(_0x502ab7);}return ami[_0x7437('0x148')]({'actionid':_0x2d3803,'action':_0x7437('0x167'),'channel':_0x3f1d25[_0x7437('0x18a')](_0x3087f9['Trunk'])?util[_0x7437('0x79')]('SIP/%s/%s%s',_0x3087f9[_0x7437('0x76')]['name'],isNotNull(_0x3087f9[_0x7437('0x18b')])?_0x3087f9[_0x7437('0x18b')][_0x7437('0x18c')]()||'':'',_0x3087f9['dialCutDigit']>0x0?_0x13c153[_0x7437('0x165')][_0x7437('0x166')]['substring'](_0x3087f9[_0x7437('0x18d')]):_0x13c153[_0x7437('0x165')][_0x7437('0x166')]):util[_0x7437('0x79')](_0x7437('0x18e'),_['isNil'](_0x3087f9[_0x7437('0x13b')])?_0x3087f9[_0x7437('0x76')][_0x7437('0x41')]:_0x3087f9['TrunkBackup']['name'],isNotNull(_0x3087f9[_0x7437('0x18b')])?_0x3087f9[_0x7437('0x18b')][_0x7437('0x18c')]()||'':'',_0x3087f9[_0x7437('0x18d')]>0x0?_0x13c153[_0x7437('0x165')]['phone'][_0x7437('0x18f')](_0x3087f9['dialCutDigit']):_0x13c153[_0x7437('0x165')]['phone']),'callerid':_0x502ab7,'Exten':_0x7437('0xd8'),'Context':_0x7437('0x190'),'Priority':'1','variable':_0x35379b,'timeout':(_0x3087f9[_0x7437('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d3803})[_0x7437('0xb2')](function(_0x5b1e23){return _0x8cb869(_0x5b1e23);})['catch'](function(_0x7ee51b){_0x3087f9[_0x7437('0x63')]+=0x1;var _0x39981e=new History(_0x3f1d25['actions'][_0x2d3803]);logger[_0x7437('0x94')](util[_0x7437('0x79')](_0x7437('0x191'),JSON[_0x7437('0x4a')](_0x7ee51b)));_0x39981e['state']=0xe;_0x39981e['statedesc']='OriginateError';_0x39981e[_0x7437('0xa5')]=moment()['format'](_0x7437('0xf6'));_0x39981e[_0x7437('0xa4')]=_0x39981e[_0x7437('0xa5')];_0x3f1d25[_0x7437('0xc4')](_0x39981e)[_0x7437('0xb4')](loggerCatch(_0x7437('0x192')));_0x3f1d25[_0x7437('0xc3')](_0x39981e)[_0x7437('0xb4')](loggerCatch(_0x7437('0x192')))['finally'](function(){delete _0x3f1d25[_0x7437('0x29')][_0x2d3803];return _0x5d8104(msgResponse(_0x7437('0x167'),_0x7437('0x49'),_0x7437('0x193')));});});});};Dialer[_0x7437('0x1e')][_0x7437('0x194')]=function(_0x24e87a){var _0x1372cb=this[_0x7437('0x29')][_0x24e87a[_0x7437('0x120')]];if(_0x1372cb){delete this[_0x7437('0x29')][_0x24e87a['actionid']];_0x1372cb[_0x7437('0x195')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));var _0x382b92=_0x1372cb['type']===_0x7437('0x7b')?this[_0x7437('0x24')][_0x1372cb[_0x7437('0xae')]]:this['voiceQueues'][_0x1372cb[_0x7437('0x196')]()];if(!this[_0x7437('0xcf')](_0x24e87a[_0x7437('0x197')])){this[_0x7437('0xac')](_0x382b92);return this['callProgressDetecting'](_0x1372cb,_0x382b92,_0x24e87a)[_0x7437('0xb4')](loggerCatch(_0x7437('0x198')));}this[_0x7437('0xd2')][_0x24e87a[_0x7437('0xd3')]]=_0x1372cb;}};Dialer[_0x7437('0x1e')][_0x7437('0x199')]=function(_0x4c4783,_0x3c4c3a,_0x2d1afa){var _0x2eb713=new History(_0x3c4c3a);if(_0x2eb713[_0x7437('0x19a')]+_0x2eb713['countcongestionretry']+_0x2eb713[_0x7437('0xeb')]+_0x2eb713[_0x7437('0xec')]+_0x2eb713[_0x7437('0xfa')]+_0x2eb713[_0x7437('0xed')]+_0x2eb713['countmachineretry']+_0x2eb713['countagentrejectretry']>=_0x2d1afa[_0x7437('0xef')]-0x1){return!![];}switch(_0x4c4783){case 0x3:if(_0x2eb713['countnoanswerretry']>=_0x2d1afa['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countnoanswerretry':_0x2eb713[_0x7437('0xeb')]+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0x19b')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2eb713['countbusyretry']>=_0x2d1afa[_0x7437('0x19c')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countbusyretry':_0x2eb713[_0x7437('0x19a')]+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x19d')],'minutes')[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713['VoiceQueueId']||undefined,'CampaignId':_0x2eb713['CampaignId']||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x19e')));break;case 0x8:if(_0x2eb713[_0x7437('0xf9')]>=_0x2d1afa[_0x7437('0x19f')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countcongestionretry':_0x2eb713[_0x7437('0xf9')]+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0x1a0')],_0x7437('0xf5'))[_0x7437('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2eb713[_0x7437('0xec')]>=_0x2d1afa[_0x7437('0x1a1')]-0x1){return!![];}else{this[_0x7437('0xba')]({'active':![],'countnosuchnumberretry':_0x2eb713[_0x7437('0xec')]+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x1a2')],_0x7437('0xf5'))[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2eb713[_0x7437('0xfa')]>=_0x2d1afa['dialDropMaxRetry']-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countdropretry':_0x2eb713[_0x7437('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x112')],_0x7437('0xf5'))[_0x7437('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x113')));break;case 0xb:if(_0x2eb713[_0x7437('0xed')]>=_0x2d1afa[_0x7437('0x119')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countabandonedretry':_0x2eb713['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x2d1afa[_0x7437('0x11a')],'minutes')['format'](_0x7437('0xf6')),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713['ListId'],'VoiceQueueId':_0x2eb713['VoiceQueueId']||undefined,'CampaignId':_0x2eb713['CampaignId']||undefined})['catch'](loggerCatch(_0x7437('0x1a3')));break;case 0x13:if(_0x2eb713[_0x7437('0xe8')]>=_0x2d1afa['dialMachineMaxRetry']-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countmachineretry':_0x2eb713['countmachineretry']+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0xf4')],'minutes')[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713['ContactId'],'ListId':_0x2eb713['ListId'],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0xf7')));break;case 0x14:if(_0x2eb713[_0x7437('0xee')]>=_0x2d1afa[_0x7437('0x1a4')]-0x1){return!![];}this[_0x7437('0xba')]({'active':![],'countagentrejectretry':_0x2eb713[_0x7437('0xee')]+=0x1,'scheduledat':moment()[_0x7437('0xf3')](_0x2d1afa[_0x7437('0x1a5')],'minutes')[_0x7437('0x79')](_0x7437('0xf6')),'ContactId':_0x2eb713[_0x7437('0xca')],'ListId':_0x2eb713[_0x7437('0xcb')],'VoiceQueueId':_0x2eb713[_0x7437('0xcc')]||undefined,'CampaignId':_0x2eb713[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x7437('0x1e')][_0x7437('0x1a6')]=function(_0x481a01,_0x4be07c,_0x446d56){var _0x47b171=this;var _0x5bb794=new History(_0x481a01);return new BPromise(function(_0x1f5af8,_0x5375a6){if(_[_0x7437('0x3e')](_0x4be07c)&&typeof _0x4be07c!==_0x7437('0x1a7')){return _0x5375a6(msgResponse(_0x7437('0x1a8'),'Failure','entity\x20is\x20undefine'));}if(_[_0x7437('0x3e')](_0x446d56)&&typeof _0x446d56!==_0x7437('0x1a7')){return _0x5375a6(msgResponse(_0x7437('0x1a8'),'Failure','evt\x20is\x20undefine'));}switch(_0x446d56[_0x7437('0x102')]){case'0':_0x4be07c['outboundNoSuchCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0x0;_0x5bb794['statedesc']=_0x7437('0x1a9');_0x5bb794['countnosuchnumberretry']+=0x1;_0x5bb794['countglobal']+=0x1;ami['emit'](_0x7437('0x1aa'),ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1ab')));_0x47b171[_0x7437('0xc4')](_0x5bb794)['catch'](loggerCatch(_0x7437('0xea')));if(_0x47b171[_0x7437('0x199')](0x0,_0x481a01,_0x4be07c)){if(_0x5bb794['countnosuchnumberretry']>=_0x4be07c[_0x7437('0x1a1')]){_0x47b171['createStateFinal'](_0x5bb794,_0x1f5af8,_0x5375a6,'reason\x200\x20no\x20such\x20number....');}else{_0x47b171[_0x7437('0xf0')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1ac'));}}break;case'3':_0x4be07c[_0x7437('0x1ad')]+=0x1;_0x5bb794['state']=0x3;_0x5bb794[_0x7437('0xa3')]=_0x7437('0x1ae');_0x5bb794['countnoanswerretry']+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami[_0x7437('0x4e')]('custom:agentnoanswer',ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1af')));_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch(_0x7437('0x1b0')));if(_0x47b171[_0x7437('0x199')](0x3,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0xeb')]>=_0x4be07c[_0x7437('0x1b1')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b2'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b2'));}}break;case'5':_0x4be07c['outboundBusyCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0x5;_0x5bb794['statedesc']='Busy';_0x5bb794[_0x7437('0x19a')]+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami[_0x7437('0x4e')](_0x7437('0x1b3'),ut['buildObj'](_0x481a01,_0x7437('0x1b4')));_0x47b171[_0x7437('0xc4')](_0x5bb794)['catch'](loggerCatch(_0x7437('0x1b5')));if(_0x47b171[_0x7437('0x199')](0x5,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0x19a')]>=_0x4be07c[_0x7437('0x19c')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b6'));}else{_0x47b171[_0x7437('0xf0')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1b6'));}}break;case'8':_0x4be07c['outboundCongestionCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0x8;_0x5bb794[_0x7437('0xa3')]=_0x7437('0x1b7');_0x5bb794[_0x7437('0xf9')]+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami[_0x7437('0x4e')](_0x7437('0x1b8'),ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1b9')));_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x47b171[_0x7437('0x199')](0x8,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0xf9')]>=_0x4be07c[_0x7437('0x19f')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1ba'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1ba'));}}break;case'11':_0x4be07c['outboundAbandonedCallsDay']+=0x1;_0x5bb794[_0x7437('0xdd')]=0xb;_0x5bb794['statedesc']=_0x7437('0x117');_0x5bb794[_0x7437('0xed')]+=0x1;_0x5bb794['countglobal']+=0x1;_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch(_0x7437('0x11b')));if(_0x47b171['checkRetriveMax'](0xb,_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0xed')]>=_0x4be07c['dialAbandonedMaxRetry']){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1bb'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1bb'));}}break;case'20':_0x4be07c[_0x7437('0x1bc')]+=0x1;_0x5bb794[_0x7437('0xdd')]=0x14;_0x5bb794[_0x7437('0xa3')]=_0x7437('0x1bd');_0x5bb794[_0x7437('0xee')]+=0x1;_0x5bb794[_0x7437('0xe9')]+=0x1;ami['emit'](_0x7437('0x1be'),ut[_0x7437('0xe2')](_0x481a01,_0x7437('0x1bf')));_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x47b171['checkRetriveMax'](0x14,_0x481a01,_0x4be07c)){if(_0x5bb794['countagentrejectretry']>=_0x4be07c[_0x7437('0x1a4')]){_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1c0'));}else{_0x47b171['stateGlobal'](_0x5bb794,_0x1f5af8,_0x5375a6,_0x7437('0x1c0'));}}break;default:_0x4be07c[_0x7437('0x64')]+=0x1;_0x5bb794[_0x7437('0xdd')]=0xc;_0x5bb794[_0x7437('0xa3')]=_0x446d56[_0x7437('0x102')];_0x47b171[_0x7437('0xc4')](_0x5bb794)[_0x7437('0xb4')](loggerCatch(_0x7437('0x1c1')));if(_0x47b171[_0x7437('0x199')](_0x446d56[_0x7437('0x102')],_0x481a01,_0x4be07c)){if(_0x5bb794[_0x7437('0x19a')]+_0x5bb794['countcongestionretry']+_0x5bb794[_0x7437('0xeb')]+_0x5bb794['countnosuchnumberretry']+_0x5bb794['countdropretry']+_0x5bb794[_0x7437('0xed')]+_0x5bb794[_0x7437('0xe8')]+_0x5bb794[_0x7437('0xee')]>=_0x4be07c['dialGlobalMaxRetry']){_0x47b171[_0x7437('0xf0')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x446d56[_0x7437('0x102')]);}else{_0x47b171[_0x7437('0xf2')](_0x5bb794,_0x1f5af8,_0x5375a6,_0x446d56[_0x7437('0x102')]);}}}});};Dialer['prototype'][_0x7437('0xf0')]=function(_0x3f768e,_0x5c1b59,_0x66fee,_0x24ffbf){var _0x3e70af=new Final(_0x3f768e);_0x3e70af[_0x7437('0xdd')]=0xf;_0x3e70af[_0x7437('0xa3')]='Global';this[_0x7437('0xf2')](_0x3e70af,_0x5c1b59,_0x66fee,_0x24ffbf);};Dialer['prototype'][_0x7437('0xf2')]=function(_0x434bf3,_0x5c714d,_0x4df64d,_0x451f79){this[_0x7437('0xc3')](_0x434bf3)[_0x7437('0xb2')](function(){return _0x5c714d(msgResponse(_0x7437('0x1a8'),_0x7437('0x1c2'),_0x451f79));})[_0x7437('0xb4')](function(){return _0x4df64d(msgResponse('[moveContactManagedDialer][0]',_0x7437('0x141'),_0x7437('0x1c3')));});};Dialer['prototype']['predictive']=function(_0x237b78){var _0x52988f=_0x237b78[_0x7437('0x1c4')]/0x64;var _0x3fef02=_0x237b78['outboundDropCallsDayTimeout']/(_0x237b78['outboundDropCallsDayTimeout']+_0x237b78[_0x7437('0x5d')]);var _0x23c2bf=Math[_0x7437('0x1c5')](_0x237b78['predictiveIntervalAvailable']*(_0x237b78[_0x7437('0x1c6')]/0x64));var _0x38342f=Math[_0x7437('0x1c5')](_0x237b78['predictiveIntervalAvailable']*(_0x237b78[_0x7437('0x1c7')]/0x64));var _0x515817=_0x237b78[_0x7437('0x51')]+_0x237b78[_0x7437('0x56')];var _0x28ee2d=Math[_0x7437('0x1c8')](_0x237b78[_0x7437('0x71')]*_0x237b78[_0x7437('0x73')]*_0x237b78[_0x7437('0x1c9')]*_0x237b78[_0x7437('0x6c')]);if(_[_0x7437('0x3e')](_0x237b78[_0x7437('0x2b')])){if(!_[_0x7437('0x3e')](_0x237b78['startPredictive'])){_0x237b78[_0x7437('0x75')]=undefined;loggerPredictive[_0x7437('0x94')](_0x7437('0x1ca'),_0x7437('0x1cb'));}if(!_[_0x7437('0x3e')](_0x237b78[_0x7437('0x90')])){loggerPredictive[_0x7437('0x94')](_0x7437('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x237b78['handlePredictive']);_0x237b78[_0x7437('0x90')]=undefined;}_0x237b78[_0x7437('0x2b')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));loggerPredictive[_0x7437('0x7f')](_0x237b78[_0x7437('0x41')],_0x7437('0x1cc'),_0x237b78[_0x7437('0x2b')]);this[_0x7437('0x155')](_0x237b78,0x1);}else if(ifInterval(_0x237b78[_0x7437('0x1cd')],_0x237b78[_0x7437('0x2b')])){this[_0x7437('0x155')](_0x237b78,0x1);loggerPredictiveCalls[_0x7437('0x7f')](_0x7437('0x1ce'),_0x237b78[_0x7437('0x2b')],_0x237b78[_0x7437('0x41')]);_0x237b78[_0x7437('0x71')]=0x0;_0x237b78[_0x7437('0x6b')]=0x0;}else if(_0x52988f<_0x3fef02&&_0x237b78[_0x7437('0x1cf')]===_0x7437('0x1d0')){freeVariablesPredictive(_0x237b78);loggerPredictive[_0x7437('0x7f')](_0x7437('0x1d1'),_0x7437('0x1d2'),_0x3fef02,'startProgressive',_0x237b78[_0x7437('0x41')]);}else if(_0x28ee2d<_0x237b78[_0x7437('0x6b')]&&_0x237b78[_0x7437('0x1cf')]===_0x7437('0x1d0')){freeVariablesPredictive(_0x237b78);loggerPredictive[_0x7437('0x7f')](_0x7437('0x1d3'),_0x7437('0x1d4'),_0x28ee2d,_0x7437('0x1d5'),_0x237b78[_0x7437('0x6b')],_0x7437('0x2b'),_0x237b78[_0x7437('0x41')]);}else if(!ifInterval(_0x237b78[_0x7437('0x1cd')],_0x237b78[_0x7437('0x2b')])&&_[_0x7437('0x3e')](_0x237b78['startPredictive'])&&!_[_0x7437('0x3e')](_0x237b78[_0x7437('0x2b')])){_0x237b78[_0x7437('0x75')]=moment()[_0x7437('0x79')](_0x7437('0xf6'));loggerPredictive[_0x7437('0x7f')](_0x237b78['name'],_0x7437('0x1d6'),_0x237b78[_0x7437('0x75')]);this['averageHandleTime'](_0x237b78[_0x7437('0x1cd')])['then'](this[_0x7437('0x1d7')](_0x237b78))['then'](mergeDataErlangB(_0x237b78))['then'](this['startMethodPredictive'](_0x237b78))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x237b78));}else if(!ifInterval(_0x237b78[_0x7437('0x1cd')],_0x237b78[_0x7437('0x75')])){_0x237b78[_0x7437('0x6b')]=0x0;_0x237b78[_0x7437('0x75')]=moment()['format'](_0x7437('0xf6'));loggerPredictive[_0x7437('0x7f')](_0x237b78[_0x7437('0x41')],_0x7437('0x1d8'),_0x237b78['startPredictive']);clearInterval(_0x237b78['handlePredictive']);_0x237b78[_0x7437('0x90')]=undefined;this[_0x7437('0xb7')](_0x237b78[_0x7437('0x1cd')])[_0x7437('0xb2')](this['getDataPredictive'](_0x237b78))[_0x7437('0xb2')](mergeDataErlangB(_0x237b78))[_0x7437('0xb2')](this[_0x7437('0x1d9')](_0x237b78))['catch'](loggerCatchPredictive(_0x7437('0x1da'),_0x237b78));}else if(_0x237b78[_0x7437('0x6e')]&&_0x515817<_0x237b78[_0x7437('0x6e')]-_0x38342f){freeVariablesPredictive(_0x237b78);loggerPredictive['info'](_0x237b78[_0x7437('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x515817,_0x7437('0x1db'),_0x237b78[_0x7437('0x6e')],'-',_0x38342f,'=',_0x237b78[_0x7437('0x6e')]-_0x38342f,')');}else if(_0x237b78[_0x7437('0x6e')]&&_0x515817>_0x237b78[_0x7437('0x6e')]+_0x23c2bf){freeVariablesPredictive(_0x237b78);loggerPredictive['info'](_0x237b78[_0x7437('0x41')],_0x7437('0x1dc'),_0x515817,_0x7437('0x1dd'),_0x237b78[_0x7437('0x6e')],'+',_0x23c2bf,'=',_0x237b78[_0x7437('0x6e')]+_0x23c2bf,')');}};Dialer[_0x7437('0x1e')][_0x7437('0x1d7')]=function(_0x364df4){var _0xbe1b58=this;return function(_0xb275b6){return new BPromise(function(_0x2497b1,_0x125129){_['merge'](_0x364df4,_0xb275b6[0x0]);if(checkGetDataPredictive(_0xb275b6[0x0])){var _0x568764=_0x364df4[_0x7437('0x6e')]=_0x364df4[_0x7437('0x56')]+_0x364df4[_0x7437('0x51')];var _0x103736=_0x364df4[_0x7437('0x1cd')]*0x3c;var _0x5b707b=_0xb275b6[0x0]['predictiveIntervalAvgTalktime']+_0xb275b6[0x0][_0x7437('0x66')];var _0x16060b=(_0xb275b6[0x0][_0x7437('0x65')]+_0xb275b6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xb275b6[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xb275b6[0x0]['predictiveIntervalTotalCalls'];_0x364df4['predictiveIntervalHitRate']=_0x16060b>0x0?_0x16060b:0x1;switch(_0x364df4[_0x7437('0x1cf')]){case _0x7437('0x1d0'):var _0x5c80ca=_0x364df4['dialPredictiveOptimizationPercentage']/0x64;return _0xbe1b58[_0x7437('0x1de')](_0x568764,_0x103736,_0x5b707b,_0x16060b,_0x5c80ca)['then'](function(_0x19e148){return _0x2497b1(_0x19e148);});case _0x7437('0x1df'):var _0x36e79a=_0x364df4['dialPredictiveOptimizationPercentage']/0x64;return _0xbe1b58[_0x7437('0x1e0')](_0x568764,_0x103736,_0x5b707b,_0x16060b,_0x36e79a)[_0x7437('0xb2')](function(_0x4f714d){return _0x2497b1(_0x4f714d);});default:return _0x125129(msgResponse(_0x7437('0x1e1'),'Failure',_0x7437('0x1e2')));}}else{return _0x125129(msgResponse('[getDataPredictive]',_0x7437('0x141'),'check\x20failure'));}});};};Dialer['prototype'][_0x7437('0x1e3')]=function(_0x14930c){var _0xf3d81a=this;return function(_0x21a005){return new BPromise(function(_0xd74919,_0x284785){_['merge'](_0x14930c,_0x21a005[0x0]);if(checkGetDataPredictive(_0x21a005[0x0])){loggerPredictive[_0x7437('0x7f')](JSON[_0x7437('0x4a')](_0x21a005[0x0]));if(_0x14930c[_0x7437('0x1cf')]===_0x7437('0x1d0')){return _0xf3d81a['getVoiceQueueRtPauses'](_0x14930c['id'])[_0x7437('0xb2')](function(_0x1a4e57){var _0x2eb61e=_0x14930c[_0x7437('0x52')]-_0x1a4e57[0x0]['outboundQueuePauses'];var _0x278d1c=_0x14930c[_0x7437('0x1cd')]*0x3c;var _0x33f5cc=_0x21a005[0x0]['predictiveIntervalAvgTalktime']+_0x21a005[0x0]['predictiveIntervalAvgHoldtime'];var _0xb6e3e9=(_0x21a005[0x0]['predictiveIntervalAnsweredCalls']+_0x21a005[0x0][_0x7437('0x69')]+_0x21a005[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x21a005[0x0][_0x7437('0x6f')];var _0x5c97d7=_0x14930c['dialPredictiveOptimizationPercentage']/0x64;_0x14930c['predictiveIntervalPauses']=_0x1a4e57[0x0]['outboundQueuePauses']||0x0;_0x14930c[_0x7437('0x1c9')]=_0xb6e3e9>0x0?_0xb6e3e9:0x1;return _0xf3d81a[_0x7437('0x1de')](_0x2eb61e,_0x278d1c,_0x33f5cc,_0xb6e3e9,_0x5c97d7);})[_0x7437('0xb2')](function(_0xd13cb8){return _0xd74919(_0xd13cb8);})[_0x7437('0xb4')](function(_0x1ff708){return _0x284785(msgResponse(_0x7437('0x1e4'),_0x7437('0x141'),JSON['stringify'](_0x1ff708)));});}if(_0x14930c[_0x7437('0x1cf')]===_0x7437('0x1df')){return _0xf3d81a[_0x7437('0xc1')](_0x14930c['id'])[_0x7437('0xb2')](function(_0x13a743){var _0x5950aa=_0x14930c['loggedIn']-_0x13a743[0x0][_0x7437('0x1e5')];var _0x1d6137=_0x14930c[_0x7437('0x1cd')]*0x3c;var _0x5300eb=_0x21a005[0x0]['predictiveIntervalAvgTalktime']+_0x21a005[0x0][_0x7437('0x66')];var _0x24e67e=(_0x21a005[0x0][_0x7437('0x65')]+_0x21a005[0x0][_0x7437('0x69')]+_0x21a005[0x0][_0x7437('0x68')])/_0x21a005[0x0][_0x7437('0x6f')];var _0x31c248=_0x14930c[_0x7437('0x1c4')]/0x64;_0x14930c['predictiveIntervalPauses']=_0x13a743[0x0]['outboundQueuePauses']||0x0;_0x14930c['predictiveIntervalHitRate']=_0x24e67e>0x0?_0x24e67e:0x1;return _0xf3d81a[_0x7437('0x1e0')](_0x5950aa,_0x1d6137,_0x5300eb,_0x24e67e,_0x31c248);})[_0x7437('0xb2')](function(_0xcb1083){return _0xd74919(_0xcb1083);})[_0x7437('0xb4')](function(_0x2aa529){return _0x284785(msgResponse(_0x7437('0x1e4'),_0x7437('0x141'),JSON[_0x7437('0x4a')](_0x2aa529)));});}}else{return _0x284785(msgResponse(_0x7437('0x1e1'),'Failure','check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x2a05ec){var _0x1b25b6=this;return function(){var _0x5d75d2=0x0;var _0x47c08a=Math[_0x7437('0x1c8')](_0x2a05ec[_0x7437('0x72')]*0x3e8);if(_0x47c08a>0x0){_0x47c08a=_0x47c08a<0x64?0x64:_0x47c08a;loggerPredictive[_0x7437('0x7f')](_0x2a05ec[_0x7437('0x41')],'one\x20call\x20every:',_0x47c08a,'milliseconds');_0x2a05ec['handlePredictive']=setInterval(function(){_0x1b25b6['handlePredictive'](_0x2a05ec);loggerPredictiveCalls[_0x7437('0x7f')](_0x7437('0x1e6'),_0x5d75d2+=0x1);},_0x47c08a);}else{loggerPredictive[_0x7437('0x7f')](_0x2a05ec[_0x7437('0x41')],_0x7437('0x1e7'));}};};Dialer['prototype'][_0x7437('0x1e8')]=function(_0x508db4,_0xe8531e){var _0x2cbb20=this;return function(_0x2b908d){if(_[_0x7437('0x7e')](_0x2b908d)){if(_['isNil'](_0xe8531e[_0x7437('0x1e9')])||!_0xe8531e[_0x7437('0x1ea')]){if(_0x508db4[_0x7437('0x59')]==='booked'){_0x508db4[_0x7437('0x127')]=_['isUndefined'](_0x508db4[_0x7437('0x127')])?!![]:_0x508db4['queueStatusComplete'];var _0x4916fc=uuid['v4']();_0x2cbb20[_0x7437('0x29')][_0x4916fc]=new Action(_0x508db4,_0xe8531e,_0x4916fc);loggerBooked[_0x7437('0x7f')](_0x7437('0x1eb'),_0x4916fc,'queueStatusComplete:\x20',JSON['stringify'](_0x508db4[_0x7437('0x127')]),_0x7437('0x1ec'),_0x508db4['name']);if(_0x508db4[_0x7437('0x127')]){_0x508db4['queueStatusComplete']=![];_0x2cbb20[_0x7437('0x2d')][_0x2cbb20['actions'][_0x4916fc]['queue']]=[];ami[_0x7437('0x148')]({'actionid':_0x4916fc,'action':'queuestatus','queue':_0x508db4[_0x7437('0x41')]})[_0x7437('0xb4')](function(){_0x2cbb20[_0x7437('0xac')](_0x508db4);_0x2cbb20['rescheduleContact']({'active':![],'ContactId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xca')],'ListId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xcb')],'VoiceQueueId':_0x2cbb20[_0x7437('0x29')][_0x4916fc]['VoiceQueueId']||undefined,'CampaignId':_0x2cbb20[_0x7437('0x29')][_0x4916fc][_0x7437('0xcd')]||undefined})['catch'](loggerCatch(_0x7437('0x1ed')));delete _0x2cbb20['actions'][_0x4916fc];});}else{loggerBooked['info'](_0x7437('0x1ee'),JSON[_0x7437('0x4a')](_0x508db4[_0x7437('0x127')]),_0x7437('0x1ec'),_0x508db4[_0x7437('0x41')]);_0x2cbb20['updateOriginated'](_0x508db4);_0x2cbb20['rescheduleContact']({'active':![],'ContactId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xca')],'ListId':_0x2cbb20[_0x7437('0x29')][_0x4916fc][_0x7437('0xcb')],'VoiceQueueId':_0x2cbb20['actions'][_0x4916fc][_0x7437('0xcc')]||undefined,'CampaignId':_0x2cbb20[_0x7437('0x29')][_0x4916fc][_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x1ed')));delete _0x2cbb20[_0x7437('0x29')][_0x4916fc];}}else{return _0x2cbb20[_0x7437('0x164')](_0x508db4,_0xe8531e);}}else{if(getDiff(_0xe8531e[_0x7437('0x1ef')])<_0x508db4[_0x7437('0x1f0')]*0x3c){if(_0xe8531e[_0x7437('0x159')]&&!_0xe8531e['Agent'][_0x7437('0x1f1')]){_0x2cbb20['preview'][_0x7437('0x12b')](_0xe8531e['id'])['finally'](function(){_0x2cbb20[_0x7437('0xac')](_0x508db4);});}else{_0x2cbb20[_0x7437('0xbc')]({'active':![]},_0xe8531e['id'],0x1)['finally'](function(){_0x2cbb20[_0x7437('0xac')](_0x508db4);});}}else{_0x508db4[_0x7437('0x1f2')]+=0x1;_0x2cbb20[_0x7437('0xac')](_0x508db4);if(_0x508db4['dialRecallInQueue']){_0x2cbb20['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xe8531e['ContactId'],'ListId':_0xe8531e['ListId'],'VoiceQueueId':_0xe8531e['VoiceQueueId']||undefined,'CampaignId':_0xe8531e[_0x7437('0xcd')]||undefined})[_0x7437('0xb4')](loggerCatch(_0x7437('0x1f3')));_0x2cbb20[_0x7437('0xc4')](createObjHistory(_0x508db4,_0xe8531e,_0x7437('0x1f4'),0x17,'RecallInQueue'))[_0x7437('0xb4')](loggerCatch(_0x7437('0x1f5')));}else{_0x2cbb20[_0x7437('0xc8')](createObjHistory(_0x508db4,_0xe8531e,_0x7437('0x1f6'),0x16,_0x7437('0x1f7')),_0x7437('0x1f8'),_0x7437('0x1f9'));}}}}else{_0x508db4[_0x7437('0x5e')]+=0x1;_0x2cbb20[_0x7437('0xc8')](createObjHistory(_0x508db4,_0xe8531e,'BLACKLIST',0xd,_0x7437('0x1fa')),_0x7437('0x1fb'),'[Originate][MoveBlacklist]');throw _0x7437('0x1fc');}};};Dialer[_0x7437('0x1e')][_0x7437('0x1fd')]=function(_0x988b1e){var _0x459069=this;var _0x8f7215=_0x988b1e[_0x7437('0x1fe')]-_0x988b1e[_0x7437('0x70')]-_0x988b1e[_0x7437('0xbf')];emitCampaignSummary(_0x988b1e);if(_0x8f7215>0x0){if(_0x8f7215>this[_0x7437('0x27')]){_0x8f7215=this[_0x7437('0x27')];}_0x988b1e[_0x7437('0xbf')]+=_0x8f7215;this[_0x7437('0xc0')](_0x988b1e['id'],_0x8f7215,_0x988b1e['dialOrderByScheduledAt'],_0x988b1e)[_0x7437('0xb2')](function(_0x8ef111){_0x988b1e['temp']-=_0x8f7215;_0x988b1e[_0x7437('0xbf')]=_0x988b1e[_0x7437('0xbf')]>0x0?_0x988b1e['temp']:0x0;if(!checkContactEmpty(_0x8ef111)){_0x988b1e[_0x7437('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x7437('0x7f')](_0x7437('0x1ff')+_0x988b1e[_0x7437('0x41')]);}else{_0x988b1e[_0x7437('0x70')]+=_0x8ef111[_0x7437('0x96')];_0x988b1e[_0x7437('0x3f')]=_0x7437('0x200');for(var _0x27b353=0x0;_0x27b353<_0x8ef111[_0x7437('0x96')];_0x27b353+=0x1){_0x988b1e['ivrTotalCallsDays']+=0x1;if(_[_0x7437('0xd4')](_0x8ef111[_0x27b353])||_[_0x7437('0xd4')](_0x8ef111[_0x27b353][_0x7437('0x165')])||_[_0x7437('0xd4')](_0x8ef111[_0x27b353][_0x7437('0x165')][_0x7437('0x166')])){_0x459069[_0x7437('0xc6')](_0x7437('0x201'),_0x988b1e,_0x8ef111[_0x27b353]);}else{_0x459069[_0x7437('0x202')](_[_0x7437('0xc9')](_0x8ef111[_0x27b353],['CampaignId',_0x7437('0x203')]))[_0x7437('0xb2')](_0x459069['checkContactBlack'](_0x988b1e,_0x8ef111[_0x27b353]))['catch'](_0x459069['loggerHandler'](_0x7437('0x204'),_0x988b1e));}}}})[_0x7437('0xb4')](loggerGetContactDialer(_0x7437('0x205'),_0x988b1e,_0x8f7215));}};Dialer[_0x7437('0x1e')][_0x7437('0x155')]=function(_0x573782,_0x17fb5b){var _0x6269fb=this;var _0x5c8173=[];var _0x2e1e01=_0x17fb5b>=0x1?_0x17fb5b:0x1;if(_0x573782[_0x7437('0x59')]===_0x7437('0x206')){_0x2e1e01=0x1;}var _0x2a9631=Math[_0x7437('0x1c8')](_0x573782[_0x7437('0x51')]*_0x2e1e01)-_0x573782[_0x7437('0x70')]-_0x573782['temp'];emitVoiceQueueSummary(_0x573782);if(_0x573782[_0x7437('0x207')]>0x0){var _0x244d61=_0x573782['dialLimitQueue']-_0x573782[_0x7437('0x70')]-_0x573782['talking']-_0x573782['temp']-_0x573782['pTalking'];if(_0x2a9631>_0x244d61){_0x2a9631=_0x244d61;}}if(_0x2a9631>0x0){if(_0x573782[_0x7437('0x59')]==='booked'){_0x2a9631=0x1;}if(_0x2a9631>this[_0x7437('0x27')]){_0x2a9631=this[_0x7437('0x27')];}_0x573782[_0x7437('0xbf')]+=_0x2a9631;for(var _0x14dc43 in this[_0x7437('0x25')]){if(typeof this[_0x7437('0x25')][_0x14dc43]!=='undefined'){if(this[_0x7437('0x25')][_0x14dc43]['state']===_0x7437('0x208')&&this['agents'][_0x14dc43][_0x7437('0xab')]===_0x7437('0xd1')){_0x5c8173[_0x7437('0x124')](this[_0x7437('0x25')][_0x14dc43]['id']);}}}this[_0x7437('0xbe')](_0x573782['id'],_0x5c8173,_0x2a9631,_0x573782[_0x7437('0x209')],_0x573782)[_0x7437('0xb2')](function(_0xb80a73){_0x573782['temp']-=_0x2a9631;_0x573782[_0x7437('0xbf')]=_0x573782[_0x7437('0xbf')]>0x0?_0x573782['temp']:0x0;if(!checkContactEmpty(_0xb80a73)){_0x6269fb[_0x7437('0xb0')](_0x573782)[_0x7437('0xb2')](sendMessageReschedule(_0x573782))[_0x7437('0xb4')](loggerCatch(_0x7437('0x20a')));}else{_0x573782[_0x7437('0x70')]+=_0xb80a73[_0x7437('0x96')];_0x573782['message']=_0x573782['dialMethod']===_0x7437('0x206')?_0x7437('0x16e'):_0x7437('0x200');for(var _0x5b3407=0x0;_0x5b3407<_0xb80a73['length'];_0x5b3407+=0x1){if(_[_0x7437('0xd4')](_0xb80a73[_0x5b3407])||_[_0x7437('0xd4')](_0xb80a73[_0x5b3407][_0x7437('0x165')])||_[_0x7437('0xd4')](_0xb80a73[_0x5b3407][_0x7437('0x165')][_0x7437('0x166')])){_0x6269fb[_0x7437('0xc6')]('[actionOriginate]\x20',_0x573782,_0xb80a73[_0x5b3407]);}else{_0x6269fb[_0x7437('0xb3')](_[_0x7437('0xc9')](_0xb80a73[_0x5b3407],[_0x7437('0xcc'),_0x7437('0x203')]))[_0x7437('0xb2')](_0x6269fb[_0x7437('0x1e8')](_0x573782,_0xb80a73[_0x5b3407]))['catch'](_0x6269fb['loggerHandler']('[actionOriginate]\x20',_0x573782));}}}})[_0x7437('0xb4')](loggerGetContactDialer('[getContactDialer2]',_0x573782,_0x2a9631));}};Dialer[_0x7437('0x1e')][_0x7437('0x90')]=function(_0x2f1e95){if(_0x2f1e95['dialLimitQueue']>0x0){var _0x2be184=_0x2f1e95[_0x7437('0x207')]-_0x2f1e95[_0x7437('0x70')]-_0x2f1e95['talking'];if(_0x2be184>0x0){this[_0x7437('0x20b')](_0x2f1e95);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x7437('0x20b')](_0x2f1e95);}};Dialer[_0x7437('0x1e')]['tryOriginatePredictive']=function(_0x378625){var _0x5475b8=this;var _0x205c5d=[];_0x378625[_0x7437('0x70')]+=0x1;for(var _0x386dfe in this['agents']){if(typeof this[_0x7437('0x25')][_0x386dfe]!==_0x7437('0x97')){if(this[_0x7437('0x25')][_0x386dfe]['state']===_0x7437('0x208')&&this[_0x7437('0x25')][_0x386dfe]['status']===_0x7437('0xd1')){_0x205c5d[_0x7437('0x124')](this[_0x7437('0x25')][_0x386dfe]['id']);}}}this[_0x7437('0xbe')](_0x378625['id'],_0x205c5d,0x1,_0x378625['dialOrderByScheduledAt'],_0x378625)[_0x7437('0xb2')](function(_0x403b16){if(!checkContactEmpty(_0x403b16)){checkContactLowerLimitOriginate(_0x378625,0x1,0x0);_0x5475b8['countReScheduled'](_0x378625)['then'](sendMessageReschedule(_0x378625))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x378625[_0x7437('0x3f')]=_0x7437('0x200');if(_[_0x7437('0xd4')](_0x403b16[0x0])||_['isNil'](_0x403b16[0x0][_0x7437('0x165')])||_[_0x7437('0xd4')](_0x403b16[0x0][_0x7437('0x165')][_0x7437('0x166')])){_0x5475b8[_0x7437('0xc6')](_0x7437('0x201'),_0x378625,_0x403b16[0x0]);}else{_0x5475b8[_0x7437('0xb3')](_[_0x7437('0xc9')](_0x403b16[0x0],[_0x7437('0xcc'),_0x7437('0x203')]))[_0x7437('0xb2')](_0x5475b8[_0x7437('0x1e8')](_0x378625,_0x403b16[0x0]))[_0x7437('0xb4')](_0x5475b8[_0x7437('0xc5')](_0x7437('0x20c'),_0x378625));}}})['catch'](loggerGetContactDialer(_0x7437('0x20d'),_0x378625,0x1));emitVoiceQueueSummary(_0x378625);};Dialer[_0x7437('0x1e')][_0x7437('0x1de')]=function(_0x22565d,_0x94e619,_0x3b7a83,_0x5047cf,_0x5b1a9f,_0x49f065){loggerPredictive[_0x7437('0x7f')](_0x7437('0x20e'));loggerPredictive[_0x7437('0x7f')](_0x7437('0x20f'),_0x22565d);loggerPredictive['info'](_0x7437('0x210'),_0x94e619);loggerPredictive[_0x7437('0x7f')]('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',_0x3b7a83);loggerPredictive[_0x7437('0x7f')](_0x7437('0x211'),_0x5047cf);loggerPredictive[_0x7437('0x7f')](_0x7437('0x212'),_0x5b1a9f);loggerPredictive[_0x7437('0x7f')](_0x7437('0x86'));return new BPromise(function(_0x234453,_0x430144){if(_0x22565d<=0x0||isNaN(_0x22565d)){return _0x430144(msgResponse(_0x7437('0x213'),_0x7437('0x49'),'m\x20=\x20'+_0x22565d));}if(_0x3b7a83<=0x0||isNaN(_0x3b7a83)){return _0x430144(msgResponse(_0x7437('0x213'),_0x7437('0x49'),_0x7437('0x214')+_0x3b7a83));}if(_0x5047cf<=0x0||isNaN(_0x5047cf)){return _0x430144(msgResponse(_0x7437('0x213'),_0x7437('0x49'),'p\x20=\x20'+_0x5047cf));}if(_0x94e619<=0x0||isNaN(_0x94e619)){return _0x430144(msgResponse('[abandonmentRate]','Error',_0x7437('0x215')+_0x94e619));}if(_0x5b1a9f<=0x0||isNaN(_0x5b1a9f)){return _0x430144(msgResponse('[abandonmentRate]',_0x7437('0x49'),_0x7437('0x216')+_0x5b1a9f));}_0x49f065=_0x49f065||0x0;var _0x3a4bcb=0x1/_0x3b7a83;var _0x370240=0x0;var _0x440c2b=0x0;var _0x382ba5=0x0;var _0x1a1842=0x0;for(var _0x4cad6a=0x0;_0x382ba5<_0x5b1a9f;_0x4cad6a+=0x1){_0x440c2b=_0x4cad6a/_0x94e619;_0x370240=(_0x5047cf*_0x440c2b+_0x49f065)/_0x3a4bcb;_0x382ba5=erlangb(_0x370240,_0x22565d);_0x1a1842=_0x370240/_0x22565d*(0x1-erlangb(_0x370240,_0x22565d));}return _0x234453({'erlangCalls':_0x4cad6a,'erlangCallToSecond':_0x94e619/_0x4cad6a,'erlangAbandonmentRate':_0x382ba5,'erlangBusyFactor':_0x1a1842});});};Dialer[_0x7437('0x1e')]['busyFactor']=function(_0x2461be,_0x45a827,_0x14599c,_0x2ac4de,_0xb31741,_0x3fa424){loggerPredictive[_0x7437('0x7f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7437('0x7f')](_0x7437('0x20f'),_0x2461be);loggerPredictive['info'](_0x7437('0x210'),_0x45a827);loggerPredictive[_0x7437('0x7f')](_0x7437('0x217'),_0x14599c);loggerPredictive[_0x7437('0x7f')](_0x7437('0x211'),_0x2ac4de);loggerPredictive['info'](_0x7437('0x218'),_0xb31741);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x2b9a67,_0x19cd54){if(_0x2461be<=0x0||isNaN(_0x2461be)){return _0x19cd54(msgResponse(_0x7437('0x219'),_0x7437('0x49'),'m\x20=\x20'+_0x2461be));}if(_0x14599c<=0x0||isNaN(_0x14599c)){return _0x19cd54(msgResponse(_0x7437('0x219'),_0x7437('0x49'),_0x7437('0x214')+_0x14599c));}if(_0x2ac4de<=0x0||isNaN(_0x2ac4de)){return _0x19cd54(msgResponse(_0x7437('0x219'),'Error',_0x7437('0x21a')+_0x2ac4de));}if(_0x45a827<=0x0||isNaN(_0x45a827)){return _0x19cd54(msgResponse(_0x7437('0x219'),'Error','interval\x20=\x20'+_0x45a827));}if(_0xb31741<=0x0||isNaN(_0xb31741)){return _0x19cd54(msgResponse('[busyFactor]',_0x7437('0x49'),'Umin\x20=\x20'+_0xb31741));}_0x3fa424=_0x3fa424||0x0;var _0x59c205=0x1/_0x14599c;var _0x37f9c8=0x0;var _0x192f7a=0x0;var _0x333543=0x0;var _0x7fde6f=0x0;for(var _0x432dff=0x0;_0x7fde6f<_0xb31741;_0x432dff+=0x1){_0x192f7a=_0x432dff/_0x45a827;_0x37f9c8=(_0x2ac4de*_0x192f7a+_0x3fa424)/_0x59c205;_0x333543=erlangb(_0x37f9c8,_0x2461be);_0x7fde6f=_0x37f9c8/_0x2461be*(0x1-erlangb(_0x37f9c8,_0x2461be));}return _0x2b9a67({'erlangCalls':_0x432dff,'erlangCallToSecond':_0x45a827/_0x432dff,'erlangAbandonmentRate':_0x333543,'erlangBusyFactor':_0x7fde6f});});};module[_0x7437('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 65ff814..5f236ca 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 _0x3bf9=['name','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname'];(function(_0x4561f5,_0x2be0b6){var _0x3f519a=function(_0x156132){while(--_0x156132){_0x4561f5['push'](_0x4561f5['shift']());}};_0x3f519a(++_0x2be0b6);}(_0x3bf9,0x8b));var _0x93bf=function(_0x5e06a1,_0x340f61){_0x5e06a1=_0x5e06a1-0x0;var _0x5b3253=_0x3bf9[_0x5e06a1];return _0x5b3253;};'use strict';var util=require('util');var _=require(_0x93bf('0x0'));var moment=require(_0x93bf('0x1'));function getSeconds(_0x43d357,_0x5f0446){var _0x3630f7=moment(_0x43d357)[_0x93bf('0x2')](0x0);var _0x3965d7=moment(_0x5f0446)[_0x93bf('0x2')](0x0);return _0x3630f7[_0x93bf('0x3')](_0x3965d7,_0x93bf('0x4'));}function QueueCallerAbandon(_0x328ef2,_0x5da52f){this['scheduledat']=_0x328ef2[_0x93bf('0x5')];this['type']=_0x328ef2['type'];this[_0x93bf('0x6')]=_0x328ef2[_0x93bf('0x7')]===_0x93bf('0x8')?_0x93bf('0x9'):_0x328ef2[_0x93bf('0x7')];this[_0x93bf('0xa')]=_0x328ef2['countbusyretry'];this['countcongestionretry']=_0x328ef2['countcongestionretry'];this[_0x93bf('0xb')]=_0x328ef2['countnoanswerretry'];this[_0x93bf('0xc')]=_0x328ef2['countbusyretry']+_0x328ef2[_0x93bf('0xd')]+_0x328ef2[_0x93bf('0xb')]+_0x328ef2['countnosuchnumberretry']+_0x328ef2['countdropretry']+_0x328ef2[_0x93bf('0xe')]+_0x328ef2[_0x93bf('0xf')]+_0x328ef2[_0x93bf('0x10')];this['countnosuchnumberretry']=_0x328ef2[_0x93bf('0x11')];this['countdropretry']=_0x328ef2[_0x93bf('0x12')];this[_0x93bf('0xe')]=_0x328ef2[_0x93bf('0xe')];this['countmachineretry']=_0x328ef2[_0x93bf('0xf')];this[_0x93bf('0x10')]=_0x328ef2[_0x93bf('0x10')];this[_0x93bf('0x13')]=_0x5da52f[_0x93bf('0x13')];this[_0x93bf('0x14')]=_0x328ef2[_0x93bf('0x15')];this['calleridnum']=_0x328ef2['number'];this[_0x93bf('0x16')]=_0x328ef2['starttime'];this[_0x93bf('0x17')]=_0x328ef2[_0x93bf('0x17')];this[_0x93bf('0x18')]=_0x328ef2[_0x93bf('0x18')];this['endtime']=this[_0x93bf('0x18')];this[_0x93bf('0x19')]=getSeconds(_0x328ef2[_0x93bf('0x17')],_0x328ef2['starttime']);this[_0x93bf('0x1a')]=getSeconds(this[_0x93bf('0x18')],_0x328ef2['responsetime']);this[_0x93bf('0x1b')]=0x0;this['queue']=_0x5da52f[_0x93bf('0x9')];this[_0x93bf('0x1c')]=_0x5da52f[_0x93bf('0x1d')];this[_0x93bf('0x1e')]=_0x5da52f['reason'];this['callback']=_0x328ef2[_0x93bf('0x1f')];this[_0x93bf('0x20')]=_0x328ef2[_0x93bf('0x20')];this[_0x93bf('0x21')]=_0x328ef2[_0x93bf('0x21')];this['recallme']=_0x328ef2['recallme'];this[_0x93bf('0x22')]=_0x328ef2['ContactId'];this['ListId']=_0x328ef2[_0x93bf('0x23')];this['UserId']=_0x328ef2['UserId'];this[_0x93bf('0x24')]=_0x328ef2[_0x93bf('0x24')];this[_0x93bf('0x25')]=_0x328ef2[_0x93bf('0x25')];this[_0x93bf('0x26')]=_0x328ef2[_0x93bf('0x26')]||'';this[_0x93bf('0x27')]=_0x328ef2[_0x93bf('0x27')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xce9d=['util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xce9d,0x1ce));var _0xdce9=function(_0x1937fc,_0x120f75){_0x1937fc=_0x1937fc-0x0;var _0x2689cf=_0xce9d[_0x1937fc];return _0x2689cf;};'use strict';var util=require(_0xdce9('0x0'));var _=require(_0xdce9('0x1'));var moment=require(_0xdce9('0x2'));function getSeconds(_0x3f26cb,_0x489a82){var _0x2d702d=moment(_0x3f26cb)['milliseconds'](0x0);var _0x155991=moment(_0x489a82)[_0xdce9('0x3')](0x0);return _0x2d702d['diff'](_0x155991,_0xdce9('0x4'));}function QueueCallerAbandon(_0x360b42,_0x3b2a80){this[_0xdce9('0x5')]=_0x360b42[_0xdce9('0x5')];this[_0xdce9('0x6')]=_0x360b42[_0xdce9('0x6')];this[_0xdce9('0x7')]=_0x360b42[_0xdce9('0x6')]===_0xdce9('0x8')?_0xdce9('0x9'):_0x360b42[_0xdce9('0x6')];this['countbusyretry']=_0x360b42[_0xdce9('0xa')];this[_0xdce9('0xb')]=_0x360b42[_0xdce9('0xb')];this[_0xdce9('0xc')]=_0x360b42[_0xdce9('0xc')];this['countglobal']=_0x360b42[_0xdce9('0xa')]+_0x360b42[_0xdce9('0xb')]+_0x360b42[_0xdce9('0xc')]+_0x360b42['countnosuchnumberretry']+_0x360b42[_0xdce9('0xd')]+_0x360b42[_0xdce9('0xe')]+_0x360b42[_0xdce9('0xf')]+_0x360b42['countagentrejectretry'];this[_0xdce9('0x10')]=_0x360b42[_0xdce9('0x10')];this[_0xdce9('0xd')]=_0x360b42[_0xdce9('0xd')];this[_0xdce9('0xe')]=_0x360b42['countabandonedretry'];this[_0xdce9('0xf')]=_0x360b42[_0xdce9('0xf')];this['countagentrejectretry']=_0x360b42[_0xdce9('0x11')];this[_0xdce9('0x12')]=_0x3b2a80['uniqueid'];this[_0xdce9('0x13')]=_0x360b42[_0xdce9('0x14')];this[_0xdce9('0x15')]=_0x360b42['number'];this[_0xdce9('0x16')]=_0x360b42[_0xdce9('0x16')];this[_0xdce9('0x17')]=_0x360b42[_0xdce9('0x17')];this[_0xdce9('0x18')]=_0x360b42[_0xdce9('0x18')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x360b42[_0xdce9('0x17')],_0x360b42['starttime']);this[_0xdce9('0x19')]=getSeconds(this[_0xdce9('0x18')],_0x360b42[_0xdce9('0x17')]);this[_0xdce9('0x1a')]=0x0;this[_0xdce9('0x9')]=_0x3b2a80[_0xdce9('0x9')];this[_0xdce9('0x1b')]=_0x3b2a80[_0xdce9('0x1c')];this['reason']=_0x3b2a80[_0xdce9('0x1d')];this['callback']=_0x360b42[_0xdce9('0x1e')];this[_0xdce9('0x1f')]=_0x360b42[_0xdce9('0x1f')];this[_0xdce9('0x20')]=_0x360b42[_0xdce9('0x20')];this[_0xdce9('0x21')]=_0x360b42['recallme'];this[_0xdce9('0x22')]=_0x360b42[_0xdce9('0x22')];this[_0xdce9('0x23')]=_0x360b42[_0xdce9('0x23')];this[_0xdce9('0x24')]=_0x360b42[_0xdce9('0x24')];this[_0xdce9('0x25')]=_0x360b42[_0xdce9('0x25')];this[_0xdce9('0x26')]=_0x360b42[_0xdce9('0x26')];this[_0xdce9('0x27')]=_0x360b42['originatecalleridnum']||'';this[_0xdce9('0x28')]=_0x360b42[_0xdce9('0x28')]||'';}module[_0xdce9('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d4570d8..8aecdf1 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(_0x283f4d,_0x17ce12){var _0x499273=function(_0x4b9eab){while(--_0x4b9eab){_0x283f4d['push'](_0x283f4d['shift']());}};_0x499273(++_0x17ce12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x227105,_0x193852){var _0x5f0acf=function(_0x5ebfca){while(--_0x5ebfca){_0x227105['push'](_0x227105['shift']());}};_0x5f0acf(++_0x193852);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 ed568a7..e972305 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 _0x63a5=['[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./channel','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','calleridnum','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x63a5,0x18e));var _0x563a=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x63a5[_0x456fb1];return _0x4083d6;};'use strict';var util=require(_0x563a('0x0'));var _=require(_0x563a('0x1'));var BPromise=require(_0x563a('0x2'));var uuid=require('uuid');var moment=require(_0x563a('0x3'));var path=require('path');var tiff2pdf=require(_0x563a('0x4'));var gs=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x563a('0x8'));var ut=require('./util/util');var Action=require(_0x563a('0x9'));var faxAccount=require(_0x563a('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0xff1f59){this[_0x563a('0xb')]={};this[_0x563a('0xc')]=_0xff1f59[_0x563a('0xc')];this[_0x563a('0xd')]=_0xff1f59[_0x563a('0xd')];this[_0x563a('0xe')]={};ami['on'](_0x563a('0xf'),this[_0x563a('0x10')][_0x563a('0x11')](this));ami['on'](_0x563a('0x12'),this[_0x563a('0x13')][_0x563a('0x11')](this));ami['on'](_0x563a('0x14'),this['syncNewState'][_0x563a('0x11')](this));ami['on'](_0x563a('0x15'),this[_0x563a('0x16')][_0x563a('0x11')](this));ami['on'](_0x563a('0x17'),this[_0x563a('0x18')]['bind'](this));ami['on'](_0x563a('0x19'),this[_0x563a('0x1a')][_0x563a('0x11')](this));ami['on'](_0x563a('0x1b'),this['syncHangup']['bind'](this));ami['on'](_0x563a('0x1c'),this[_0x563a('0x1d')]['bind'](this));}Fax[_0x563a('0x1e')][_0x563a('0x10')]=function(_0x162a5a){if(_0x162a5a[_0x563a('0x1f')]==='from-voip-provider'){for(var _0x598693 in this[_0x563a('0xc')]){if(this[_0x563a('0xc')][_0x563a('0x20')](_0x598693)){if(_0x162a5a['exten']===this['faxAccounts'][_0x598693]['localstationid']){this['channels'][_0x162a5a[_0x563a('0x21')]]={};this[_0x563a('0xb')][_0x162a5a[_0x563a('0x21')]][_0x563a('0x22')]=_0x162a5a['channel'];this['channels'][_0x162a5a[_0x563a('0x21')]]['id']=this[_0x563a('0xc')][_0x598693]['id'];this[_0x563a('0xb')][_0x162a5a[_0x563a('0x21')]][_0x563a('0x23')]=this[_0x563a('0xc')][_0x598693][_0x563a('0x23')];logger[_0x563a('0x24')](_0x162a5a['uniqueid'],_0x563a('0x25'));}}}}if(this['actions'][_0x162a5a[_0x563a('0x21')]]){this[_0x563a('0xb')][_0x162a5a[_0x563a('0x21')]]={};this[_0x563a('0xb')][_0x162a5a[_0x563a('0x21')]][_0x563a('0x22')]=_0x162a5a[_0x563a('0x22')];logger[_0x563a('0x24')](_0x162a5a['uniqueid'],_0x563a('0x25'));}};Fax[_0x563a('0x1e')][_0x563a('0x13')]=function(_0x3d79ac){if(this[_0x563a('0xb')][_0x3d79ac[_0x563a('0x21')]]){for(var _0x1afdff in _0x3d79ac[_0x563a('0x26')]){if(_0x3d79ac[_0x563a('0x26')][_0x563a('0x20')](_0x1afdff)){this[_0x563a('0xb')][_0x3d79ac[_0x563a('0x21')]][_0x1afdff]=_0x3d79ac[_0x563a('0x27')];}}}};Fax[_0x563a('0x1e')]['syncNewState']=function(_0x43379c){if(this[_0x563a('0xb')][_0x43379c[_0x563a('0x21')]]){this['channels'][_0x43379c[_0x563a('0x21')]][_0x563a('0x28')]=_0x43379c[_0x563a('0x28')];this[_0x563a('0xb')][_0x43379c[_0x563a('0x21')]][_0x563a('0x29')]=_0x43379c[_0x563a('0x29')];}};Fax['prototype'][_0x563a('0x16')]=function(_0x24ec9d){if(this[_0x563a('0xb')][_0x24ec9d[_0x563a('0x21')]]){for(var _0x1a77b8 in _0x24ec9d['variable']){if(_0x24ec9d['variable']['hasOwnProperty'](_0x1a77b8)){this['channels'][_0x24ec9d[_0x563a('0x21')]][_0x1a77b8]=_0x24ec9d[_0x563a('0x27')];}}}};Fax[_0x563a('0x1e')][_0x563a('0x18')]=function(_0x3e39b6){if(this[_0x563a('0xb')][_0x3e39b6['uniqueid']]){this['channels'][_0x3e39b6[_0x563a('0x21')]][_0x563a('0x2a')]=_0x3e39b6[_0x563a('0x2a')];this[_0x563a('0xb')][_0x3e39b6[_0x563a('0x21')]][_0x563a('0x2b')]=_0x3e39b6[_0x563a('0x2b')];this[_0x563a('0xb')][_0x3e39b6[_0x563a('0x21')]][_0x563a('0x2c')]=_0x3e39b6[_0x563a('0x2c')];this[_0x563a('0xb')][_0x3e39b6[_0x563a('0x21')]][_0x563a('0x2d')]=_0x3e39b6[_0x563a('0x2d')];logger[_0x563a('0x24')](_0x3e39b6['uniqueid'],_0x563a('0x2e'));}};Fax[_0x563a('0x1e')][_0x563a('0x1a')]=function(_0x5abfe4){var _0xfd4cee=this;if(this['channels'][_0x5abfe4[_0x563a('0x21')]]){var _0x930c24=this['channels'][_0x5abfe4['uniqueid']]['id'];this[_0x563a('0xb')][_0x5abfe4['uniqueid']][_0x563a('0x2f')]=_0x5abfe4[_0x563a('0x2f')];this[_0x563a('0xb')][_0x5abfe4[_0x563a('0x21')]]['pagestransferred']=_0x5abfe4['pagestransferred'];this[_0x563a('0xb')][_0x5abfe4['uniqueid']][_0x563a('0x2c')]=_0x5abfe4[_0x563a('0x2c')];this[_0x563a('0xb')][_0x5abfe4[_0x563a('0x21')]][_0x563a('0x30')]=_0x5abfe4[_0x563a('0x30')];this[_0x563a('0xb')][_0x5abfe4[_0x563a('0x21')]]['transferrate']=_0x5abfe4[_0x563a('0x31')];this['channels'][_0x5abfe4[_0x563a('0x21')]][_0x563a('0x2d')]=_0x5abfe4[_0x563a('0x2d')];this[_0x563a('0xb')][_0x5abfe4['uniqueid']]['calleridnum']=_0x5abfe4['calleridnum'];if(this[_0x563a('0xb')][_0x5abfe4[_0x563a('0x21')]][_0x563a('0x32')]>0x0){tiff2pdf(_0x5abfe4[_0x563a('0x2d')],_0x563a('0x33'),function(_0x2c7fb3){logger[_0x563a('0x24')](_0x5abfe4[_0x563a('0x21')],_0x563a('0x34'),_0x2c7fb3[_0x563a('0x35')]);attachment[_0x563a('0x36')]({'name':path[_0x563a('0x37')](_0x5abfe4[_0x563a('0x2d')])[_0x563a('0x23')],'basename':path[_0x563a('0x37')](_0x5abfe4[_0x563a('0x2d')])[_0x563a('0x23')]+_0x563a('0x38'),'type':_0x563a('0x39')})['then'](function(_0x54109c){faxAccount[_0x563a('0x3a')](_0x930c24,{'from':_0x5abfe4[_0x563a('0x3b')],'mapKey':_0x563a('0x7'),'body':path[_0x563a('0x37')](_0x5abfe4[_0x563a('0x2d')])[_0x563a('0x23')]+_0x563a('0x38'),'AttachmentId':_0x54109c['id']})[_0x563a('0x3c')](function(_0x568af8){logger['error'](_0x5abfe4[_0x563a('0x21')],_0x563a('0x3d'),JSON[_0x563a('0x3e')](_0x568af8));});})[_0x563a('0x3c')](function(_0x3fed69){logger[_0x563a('0x3f')](_0x5abfe4[_0x563a('0x21')],_0x563a('0x40'),JSON['stringify'](_0x3fed69));});});}logger[_0x563a('0x24')](_0x5abfe4[_0x563a('0x21')],'\x20receiveFax\x20');}};Fax[_0x563a('0x1e')]['syncOriginateResponse']=function(_0x3ea787){if(this[_0x563a('0xe')][_0x3ea787[_0x563a('0x21')]]){_['merge'](this[_0x563a('0xb')][_0x3ea787[_0x563a('0x21')]],_[_0x563a('0x41')](_0x3ea787,[_0x563a('0x42'),_0x563a('0x43')]));}};function updateStatus(_0x18b686){if(_0x18b686[_0x563a('0x44')]){faxMessage[_0x563a('0x45')](_0x18b686[_0x563a('0x44')],{'failMessage':_0x563a('0x46')})[_0x563a('0x47')](function(_0x109224){ut[_0x563a('0x48')]('[Fax][Message][Error][Updated]',_0x109224);})['catch'](function(_0x2803d6){ut[_0x563a('0x48')](_0x563a('0x49'),_0x2803d6);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x563a('0x1e')][_0x563a('0x4a')]=function(_0x50ebde,_0x4b6ba9,_0x51e142){var _0x1a957e=this;var _0x46dd3a={};if(_0x4b6ba9){_0x46dd3a={'read':_0x4b6ba9};}else{_0x46dd3a={'failMessage':_0x51e142};}if(this[_0x563a('0xe')][_0x50ebde][_0x563a('0x44')]){faxMessage[_0x563a('0x45')](this[_0x563a('0xe')][_0x50ebde]['AttachmentId'],_0x46dd3a)['then'](function(_0xfd8006){ut['logger'](_0x563a('0x4b'),_0xfd8006);})[_0x563a('0x3c')](function(_0x3e993e){ut[_0x563a('0x48')](_0x563a('0x4c'),_0x3e993e);})[_0x563a('0x4d')](function(){delete _0x1a957e[_0x563a('0xb')][_0x50ebde];delete _0x1a957e['actions'][_0x50ebde];});}else{ut[_0x563a('0x48')](_0x563a('0x4e'));delete this['channels'][_0x50ebde];delete this[_0x563a('0xe')][_0x50ebde];}};Fax[_0x563a('0x1e')][_0x563a('0x4f')]=function(_0x2afa8c){var _0x456821=this;if(this[_0x563a('0xb')][_0x2afa8c[_0x563a('0x21')]]){if(this[_0x563a('0xe')][_0x2afa8c[_0x563a('0x21')]]){this[_0x563a('0xb')][_0x2afa8c['uniqueid']]['id']=this[_0x563a('0xe')][_0x2afa8c[_0x563a('0x21')]]['id'];this['channels'][_0x2afa8c['uniqueid']][_0x563a('0x23')]=this[_0x563a('0xe')][_0x2afa8c['uniqueid']][_0x563a('0x23')];}logger['info'](_0x2afa8c[_0x563a('0x21')],this[_0x563a('0xe')][_0x2afa8c[_0x563a('0x21')]]?_0x563a('0x50'):_0x563a('0x51'),JSON['stringify'](this['channels'][_0x2afa8c['uniqueid']]));if(this['actions'][_0x2afa8c[_0x563a('0x21')]]){if(this['channels'][_0x2afa8c[_0x563a('0x21')]]['faxpages']>0x0&&this[_0x563a('0xb')][_0x2afa8c[_0x563a('0x21')]][_0x563a('0x17')]===_0x563a('0x52')){this[_0x563a('0x4a')](_0x2afa8c['uniqueid'],!![]);}else{this[_0x563a('0x4a')](_0x2afa8c['uniqueid'],![],this['channels'][_0x2afa8c[_0x563a('0x21')]][_0x563a('0x53')]?_0x563a('0x54')+this[_0x563a('0xb')][_0x2afa8c[_0x563a('0x21')]]['faxstatusstring']:_0x563a('0x55'));}}}};Fax[_0x563a('0x1e')][_0x563a('0x56')]=function(_0x3bbe7c){var _0x36d40c=this;return new BPromise(function(_0x4c88c4,_0xac578c){_0x36d40c['execOriginate'](_0x3bbe7c,_0x36d40c[_0x563a('0xc')][_0x3bbe7c[_0x563a('0x57')]])['then'](function(_0x34dd59){ut[_0x563a('0x48')](_0x563a('0x58'),_0x34dd59);_0x4c88c4(ut[_0x563a('0x35')](_0x563a('0x59')));})[_0x563a('0x3c')](function(_0x608257){ut[_0x563a('0x48')]('[Fax][execOriginate][failure]',_0x608257);updateStatus(_0x3bbe7c);_0xac578c(ut[_0x563a('0x35')](_0x563a('0x5a')));});});};Fax[_0x563a('0x1e')][_0x563a('0x5b')]=function(_0x1b603d){var _0x2c4a9c=this;return new BPromise(function(_0x4636f9,_0x5e3e88){var _0x1e1919=_0x2c4a9c['checkTrunk'](_0x2c4a9c['faxAccounts'][_0x1b603d['FaxAccountId']][_0x563a('0x5c')],_0x1b603d);if(_0x1e1919['isValid']){_0x4636f9(ut['message'](_0x563a('0x5d')));}else{_0x5e3e88(ut[_0x563a('0x35')](_0x1e1919[_0x563a('0x35')]));}});};function originate(_0x42d396,_0x2e442f,_0x51220c){return new BPromise(function(_0x4814b3,_0x4c9ad7){if(_0x51220c){var _0x39b8f8=util[_0x563a('0x5e')](_0x563a('0x5f'),path[_0x563a('0x37')](_0x42d396[_0x563a('0x60')])[_0x563a('0x23')],_0x42d396['path']);gs[_0x563a('0x61')](_0x39b8f8)[_0x563a('0x47')](function(){_0x42d396['path']=util[_0x563a('0x5e')](_0x563a('0x62'),path[_0x563a('0x37')](_0x42d396['path'])[_0x563a('0x63')],path[_0x563a('0x37')](_0x42d396[_0x563a('0x60')])[_0x563a('0x23')]);_0x2e442f['XMF-PATH']=_0x42d396[_0x563a('0x60')];ut[_0x563a('0x48')](_0x563a('0x64'),'');ami[_0x563a('0x65')](ut[_0x563a('0x66')](_0x42d396,_0x2e442f))['then'](function(_0x47eda2){_0x4814b3(_0x47eda2);})[_0x563a('0x3c')](function(_0x598a91){_0x4c9ad7(_0x598a91);});})[_0x563a('0x3c')](function(_0x1ecc63){_0x4c9ad7(_0x1ecc63);});}else{ami[_0x563a('0x65')](ut[_0x563a('0x66')](_0x42d396,_0x2e442f))[_0x563a('0x47')](function(_0x233596){_0x4814b3(_0x233596);})[_0x563a('0x3c')](function(_0x1a111f){_0x4c9ad7(_0x1a111f);});}});}Fax[_0x563a('0x1e')][_0x563a('0x67')]=function(_0x5a2959,_0x1a4c59){var _0x5eec1d=this;return new BPromise(function(_0x163097,_0x441933){var _0x54c512=uuid['v4']();var _0x17d62c=ut['addVariables'](_0x5a2959,_0x1a4c59);_0x5eec1d[_0x563a('0xe')][_0x54c512]=new Action(_0x54c512,_0x1a4c59,_0x5a2959);var _0x42c448=_0x5eec1d['actions'][_0x54c512];if(path[_0x563a('0x37')](_0x5a2959[_0x563a('0x60')])[_0x563a('0x68')]===_0x563a('0x38')){originate(_0x42c448,_0x17d62c,!![])['then'](function(_0x418646){_0x163097(_0x418646);})[_0x563a('0x3c')](function(_0x17000b){_0x441933(_0x17000b);});}else{originate(_0x42c448,_0x17d62c,![])[_0x563a('0x47')](function(_0x474aca){_0x163097(_0x474aca);})[_0x563a('0x3c')](function(_0x15f9f7){_0x441933(_0x15f9f7);});}});};Fax[_0x563a('0x1e')][_0x563a('0x69')]=function(_0x238ae4){return!_['isNil'](_0x238ae4)&&!_[_0x563a('0x6a')](_0x238ae4[_0x563a('0x23')])&&!_[_0x563a('0x6a')](_0x238ae4['active'])&&_0x238ae4[_0x563a('0x6b')]&&!_[_0x563a('0x6a')](this[_0x563a('0xd')][util[_0x563a('0x5e')](_0x563a('0x6c'),_0x238ae4[_0x563a('0x23')])])&&!_[_0x563a('0x6a')](this[_0x563a('0xd')][util[_0x563a('0x5e')](_0x563a('0x6c'),_0x238ae4[_0x563a('0x23')])][_0x563a('0x2b')])&&(this[_0x563a('0xd')][util['format'](_0x563a('0x6c'),_0x238ae4[_0x563a('0x23')])]['status']===_0x563a('0x6d')||this[_0x563a('0xd')][util[_0x563a('0x5e')](_0x563a('0x6c'),_0x238ae4[_0x563a('0x23')])][_0x563a('0x2b')]===_0x563a('0x6e'));};Fax[_0x563a('0x1e')][_0x563a('0x6f')]=function(_0x5d4e5a,_0x2e38a){if(!this[_0x563a('0x69')](_0x5d4e5a)){ut[_0x563a('0x48')](_0x563a('0x70'),_['isNil'](_0x5d4e5a)?'':_0x5d4e5a['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x563a('0x71')};}if(_[_0x563a('0x6a')](_0x2e38a[_0x563a('0x7')])){ut[_0x563a('0x48')](_0x563a('0x72'),JSON[_0x563a('0x3e')](_0x2e38a));return{'isValid':![],'message':_0x563a('0x73')};}if(_[_0x563a('0x6a')](_0x2e38a[_0x563a('0x60')])){ut[_0x563a('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x563a('0x3e')](_0x2e38a));return{'isValid':![],'message':_0x563a('0x74')};}return{'isValid':!![],'message':_0x563a('0x75')};};module[_0x563a('0x76')]=Fax; \ No newline at end of file +var _0xd914=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','channelstate','channelstatedesc','variable','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif'];(function(_0x3c9ee9,_0x3c2001){var _0xf24909=function(_0x2ca6ab){while(--_0x2ca6ab){_0x3c9ee9['push'](_0x3c9ee9['shift']());}};_0xf24909(++_0x3c2001);}(_0xd914,0x17f));var _0x4d91=function(_0x644560,_0x1783aa){_0x644560=_0x644560-0x0;var _0x41b76b=_0xd914[_0x644560];return _0x41b76b;};'use strict';var util=require(_0x4d91('0x0'));var _=require(_0x4d91('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var path=require(_0x4d91('0x4'));var tiff2pdf=require(_0x4d91('0x5'));var gs=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('fax');var ami=require(_0x4d91('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x4d91('0x9'));var ut=require(_0x4d91('0xa'));var Action=require(_0x4d91('0xb'));var faxAccount=require(_0x4d91('0xc'));var attachment=require(_0x4d91('0xd'));var faxMessage=require(_0x4d91('0xe'));function Fax(_0x3016c0){this[_0x4d91('0xf')]={};this['faxAccounts']=_0x3016c0[_0x4d91('0x10')];this[_0x4d91('0x11')]=_0x3016c0[_0x4d91('0x11')];this[_0x4d91('0x12')]={};ami['on'](_0x4d91('0x13'),this[_0x4d91('0x14')]['bind'](this));ami['on']('varset',this[_0x4d91('0x15')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x17'),this[_0x4d91('0x18')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x19'),this['syncNewExten']['bind'](this));ami['on'](_0x4d91('0x1a'),this[_0x4d91('0x1b')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1c'),this[_0x4d91('0x1d')][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1e'),this['syncHangup'][_0x4d91('0x16')](this));ami['on'](_0x4d91('0x1f'),this[_0x4d91('0x20')][_0x4d91('0x16')](this));}Fax[_0x4d91('0x21')]['syncNewchannel']=function(_0x1241a1){if(_0x1241a1[_0x4d91('0x22')]===_0x4d91('0x23')){for(var _0x44b9a7 in this['faxAccounts']){if(this[_0x4d91('0x10')][_0x4d91('0x24')](_0x44b9a7)){if(_0x1241a1[_0x4d91('0x25')]===this['faxAccounts'][_0x44b9a7][_0x4d91('0x26')]){this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]={};this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]][_0x4d91('0x28')]=_0x1241a1[_0x4d91('0x28')];this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]['id']=this[_0x4d91('0x10')][_0x44b9a7]['id'];this['channels'][_0x1241a1[_0x4d91('0x27')]]['name']=this['faxAccounts'][_0x44b9a7][_0x4d91('0x29')];logger[_0x4d91('0x2a')](_0x1241a1[_0x4d91('0x27')],_0x4d91('0x2b'));}}}}if(this[_0x4d91('0x12')][_0x1241a1[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x1241a1[_0x4d91('0x27')]]={};this['channels'][_0x1241a1['uniqueid']][_0x4d91('0x28')]=_0x1241a1[_0x4d91('0x28')];logger[_0x4d91('0x2a')](_0x1241a1[_0x4d91('0x27')],_0x4d91('0x2b'));}};Fax[_0x4d91('0x21')][_0x4d91('0x15')]=function(_0x560966){if(this[_0x4d91('0xf')][_0x560966[_0x4d91('0x27')]]){for(var _0x12ac74 in _0x560966['variable']){if(_0x560966['variable'][_0x4d91('0x24')](_0x12ac74)){this[_0x4d91('0xf')][_0x560966['uniqueid']][_0x12ac74]=_0x560966['value'];}}}};Fax[_0x4d91('0x21')][_0x4d91('0x18')]=function(_0x43371e){if(this[_0x4d91('0xf')][_0x43371e['uniqueid']]){this[_0x4d91('0xf')][_0x43371e[_0x4d91('0x27')]][_0x4d91('0x2c')]=_0x43371e[_0x4d91('0x2c')];this[_0x4d91('0xf')][_0x43371e[_0x4d91('0x27')]][_0x4d91('0x2d')]=_0x43371e['channelstatedesc'];}};Fax[_0x4d91('0x21')]['syncNewExten']=function(_0x4ad7bf){if(this[_0x4d91('0xf')][_0x4ad7bf[_0x4d91('0x27')]]){for(var _0x4f95f0 in _0x4ad7bf[_0x4d91('0x2e')]){if(_0x4ad7bf[_0x4d91('0x2e')][_0x4d91('0x24')](_0x4f95f0)){this[_0x4d91('0xf')][_0x4ad7bf[_0x4d91('0x27')]][_0x4f95f0]=_0x4ad7bf['value'];}}}};Fax[_0x4d91('0x21')][_0x4d91('0x1b')]=function(_0x36d7e0){if(this[_0x4d91('0xf')][_0x36d7e0[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x36d7e0['uniqueid']][_0x4d91('0x2f')]=_0x36d7e0[_0x4d91('0x2f')];this['channels'][_0x36d7e0[_0x4d91('0x27')]][_0x4d91('0x30')]=_0x36d7e0[_0x4d91('0x30')];this['channels'][_0x36d7e0[_0x4d91('0x27')]][_0x4d91('0x26')]=_0x36d7e0[_0x4d91('0x26')];this[_0x4d91('0xf')][_0x36d7e0['uniqueid']][_0x4d91('0x31')]=_0x36d7e0[_0x4d91('0x31')];logger[_0x4d91('0x2a')](_0x36d7e0[_0x4d91('0x27')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x4d91('0x1d')]=function(_0x3dac76){var _0x524052=this;if(this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]]){var _0x197ea6=this[_0x4d91('0xf')][_0x3dac76['uniqueid']]['id'];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]]['remotestationid']=_0x3dac76[_0x4d91('0x32')];this['channels'][_0x3dac76[_0x4d91('0x27')]]['pagestransferred']=_0x3dac76[_0x4d91('0x33')];this['channels'][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x26')]=_0x3dac76[_0x4d91('0x26')];this[_0x4d91('0xf')][_0x3dac76['uniqueid']]['resolution']=_0x3dac76[_0x4d91('0x34')];this['channels'][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x35')]=_0x3dac76['transferrate'];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x31')]=_0x3dac76[_0x4d91('0x31')];this[_0x4d91('0xf')][_0x3dac76[_0x4d91('0x27')]][_0x4d91('0x36')]=_0x3dac76['calleridnum'];if(this[_0x4d91('0xf')][_0x3dac76['uniqueid']][_0x4d91('0x33')]>0x0){tiff2pdf(_0x3dac76[_0x4d91('0x31')],_0x4d91('0x37'),function(_0x2483c4){logger[_0x4d91('0x2a')](_0x3dac76[_0x4d91('0x27')],'\x20result\x20conversion\x20file\x20',_0x2483c4['message']);attachment[_0x4d91('0x38')]({'name':path[_0x4d91('0x39')](_0x3dac76['filename'])[_0x4d91('0x29')],'basename':path[_0x4d91('0x39')](_0x3dac76[_0x4d91('0x31')])[_0x4d91('0x29')]+_0x4d91('0x3a'),'type':_0x4d91('0x3b')})[_0x4d91('0x3c')](function(_0x971da4){faxAccount[_0x4d91('0x3d')](_0x197ea6,{'from':_0x3dac76['calleridnum'],'mapKey':'fax','body':path[_0x4d91('0x39')](_0x3dac76['filename'])[_0x4d91('0x29')]+_0x4d91('0x3a'),'AttachmentId':_0x971da4['id']})[_0x4d91('0x3e')](function(_0x10b1bb){logger['error'](_0x3dac76[_0x4d91('0x27')],'\x20notify\x20',JSON['stringify'](_0x10b1bb));});})[_0x4d91('0x3e')](function(_0xfd7c52){logger[_0x4d91('0x3f')](_0x3dac76[_0x4d91('0x27')],_0x4d91('0x40'),JSON[_0x4d91('0x41')](_0xfd7c52));});});}logger['info'](_0x3dac76[_0x4d91('0x27')],_0x4d91('0x40'));}};Fax[_0x4d91('0x21')][_0x4d91('0x20')]=function(_0x106e5b){if(this[_0x4d91('0x12')][_0x106e5b[_0x4d91('0x27')]]){_[_0x4d91('0x42')](this[_0x4d91('0xf')][_0x106e5b[_0x4d91('0x27')]],_[_0x4d91('0x43')](_0x106e5b,['response',_0x4d91('0x44')]));}};function updateStatus(_0x5a5c03){if(_0x5a5c03[_0x4d91('0x45')]){faxMessage[_0x4d91('0x46')](_0x5a5c03[_0x4d91('0x45')],{'failMessage':_0x4d91('0x47')})[_0x4d91('0x3c')](function(_0x3edc43){ut[_0x4d91('0x48')](_0x4d91('0x49'),_0x3edc43);})['catch'](function(_0x63f708){ut[_0x4d91('0x48')](_0x4d91('0x4a'),_0x63f708);});}else{ut[_0x4d91('0x48')](_0x4d91('0x4b'));}}Fax[_0x4d91('0x21')][_0x4d91('0x4c')]=function(_0x4aae23,_0x392cc3,_0x2159e4){var _0x413b25=this;var _0x4382ff={};if(_0x392cc3){_0x4382ff={'read':_0x392cc3};}else{_0x4382ff={'failMessage':_0x2159e4};}if(this[_0x4d91('0x12')][_0x4aae23][_0x4d91('0x45')]){faxMessage[_0x4d91('0x46')](this[_0x4d91('0x12')][_0x4aae23][_0x4d91('0x45')],_0x4382ff)[_0x4d91('0x3c')](function(_0x8339dd){ut[_0x4d91('0x48')](_0x4d91('0x4d'),_0x8339dd);})[_0x4d91('0x3e')](function(_0x3e9154){ut[_0x4d91('0x48')](_0x4d91('0x4e'),_0x3e9154);})['finally'](function(){delete _0x413b25['channels'][_0x4aae23];delete _0x413b25['actions'][_0x4aae23];});}else{ut[_0x4d91('0x48')](_0x4d91('0x4f'));delete this[_0x4d91('0xf')][_0x4aae23];delete this['actions'][_0x4aae23];}};Fax[_0x4d91('0x21')][_0x4d91('0x50')]=function(_0x3985f3){var _0x4ac087=this;if(this['channels'][_0x3985f3['uniqueid']]){if(this[_0x4d91('0x12')][_0x3985f3[_0x4d91('0x27')]]){this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]['id']=this[_0x4d91('0x12')][_0x3985f3['uniqueid']]['id'];this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]['name']=this['actions'][_0x3985f3[_0x4d91('0x27')]]['name'];}logger[_0x4d91('0x2a')](_0x3985f3[_0x4d91('0x27')],this[_0x4d91('0x12')][_0x3985f3['uniqueid']]?_0x4d91('0x51'):_0x4d91('0x52'),JSON[_0x4d91('0x41')](this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]]));if(this[_0x4d91('0x12')][_0x3985f3[_0x4d91('0x27')]]){if(this['channels'][_0x3985f3['uniqueid']]['faxpages']>0x0&&this['channels'][_0x3985f3[_0x4d91('0x27')]][_0x4d91('0x1a')]===_0x4d91('0x53')){this['updateStatus'](_0x3985f3[_0x4d91('0x27')],!![]);}else{this['updateStatus'](_0x3985f3[_0x4d91('0x27')],![],this[_0x4d91('0xf')][_0x3985f3['uniqueid']]['faxstatusstring']?_0x4d91('0x54')+this[_0x4d91('0xf')][_0x3985f3[_0x4d91('0x27')]][_0x4d91('0x55')]:_0x4d91('0x56'));}}}};Fax[_0x4d91('0x21')][_0x4d91('0x57')]=function(_0x42e550){var _0xd384a9=this;return new BPromise(function(_0xd660b3,_0x5bfb08){_0xd384a9['execOriginate'](_0x42e550,_0xd384a9[_0x4d91('0x10')][_0x42e550[_0x4d91('0x58')]])[_0x4d91('0x3c')](function(_0x13281d){ut[_0x4d91('0x48')](_0x4d91('0x59'),_0x13281d);_0xd660b3(ut[_0x4d91('0x5a')](_0x4d91('0x5b')));})[_0x4d91('0x3e')](function(_0x564885){ut['logger']('[Fax][execOriginate][failure]',_0x564885);updateStatus(_0x42e550);_0x5bfb08(ut['message'](_0x4d91('0x5c')));});});};Fax[_0x4d91('0x21')][_0x4d91('0x5d')]=function(_0x12f7de){var _0x8565e3=this;return new BPromise(function(_0x12fa2e,_0x37710b){var _0xa1b6e5=_0x8565e3[_0x4d91('0x5e')](_0x8565e3[_0x4d91('0x10')][_0x12f7de[_0x4d91('0x58')]][_0x4d91('0x5f')],_0x12f7de);if(_0xa1b6e5[_0x4d91('0x60')]){_0x12fa2e(ut[_0x4d91('0x5a')](_0x4d91('0x61')));}else{_0x37710b(ut[_0x4d91('0x5a')](_0xa1b6e5[_0x4d91('0x5a')]));}});};function originate(_0x5b3a38,_0x4062c6,_0x1be4b1){return new BPromise(function(_0xc4ef10,_0x2e2105){if(_0x1be4b1){var _0x1cad5b=util['format'](_0x4d91('0x62'),path[_0x4d91('0x39')](_0x5b3a38['path'])[_0x4d91('0x29')],_0x5b3a38[_0x4d91('0x4')]);gs[_0x4d91('0x63')](_0x1cad5b)[_0x4d91('0x3c')](function(){_0x5b3a38[_0x4d91('0x4')]=util['format'](_0x4d91('0x64'),path[_0x4d91('0x39')](_0x5b3a38['path'])[_0x4d91('0x65')],path[_0x4d91('0x39')](_0x5b3a38[_0x4d91('0x4')])['name']);_0x4062c6[_0x4d91('0x66')]=_0x5b3a38[_0x4d91('0x4')];ut[_0x4d91('0x48')](_0x4d91('0x67'),'');ami[_0x4d91('0x68')](ut[_0x4d91('0x69')](_0x5b3a38,_0x4062c6))[_0x4d91('0x3c')](function(_0x4fcc58){_0xc4ef10(_0x4fcc58);})[_0x4d91('0x3e')](function(_0x2e014b){_0x2e2105(_0x2e014b);});})['catch'](function(_0x221e44){_0x2e2105(_0x221e44);});}else{ami['Action'](ut['variablesAction'](_0x5b3a38,_0x4062c6))[_0x4d91('0x3c')](function(_0x4b19e2){_0xc4ef10(_0x4b19e2);})[_0x4d91('0x3e')](function(_0x1a4a33){_0x2e2105(_0x1a4a33);});}});}Fax[_0x4d91('0x21')][_0x4d91('0x6a')]=function(_0x10211f,_0x3fa0e0){var _0x17e61c=this;return new BPromise(function(_0x497f84,_0x485da1){var _0x1c27e7=uuid['v4']();var _0x431223=ut[_0x4d91('0x6b')](_0x10211f,_0x3fa0e0);_0x17e61c[_0x4d91('0x12')][_0x1c27e7]=new Action(_0x1c27e7,_0x3fa0e0,_0x10211f);var _0x1e3838=_0x17e61c['actions'][_0x1c27e7];if(path['parse'](_0x10211f[_0x4d91('0x4')])['ext']==='.pdf'){originate(_0x1e3838,_0x431223,!![])[_0x4d91('0x3c')](function(_0x54fea8){_0x497f84(_0x54fea8);})['catch'](function(_0x216c33){_0x485da1(_0x216c33);});}else{originate(_0x1e3838,_0x431223,![])[_0x4d91('0x3c')](function(_0x1987fa){_0x497f84(_0x1987fa);})['catch'](function(_0x5028c5){_0x485da1(_0x5028c5);});}});};Fax['prototype'][_0x4d91('0x6c')]=function(_0x8d84f3){return!_[_0x4d91('0x6d')](_0x8d84f3)&&!_[_0x4d91('0x6d')](_0x8d84f3[_0x4d91('0x29')])&&!_[_0x4d91('0x6d')](_0x8d84f3[_0x4d91('0x6e')])&&_0x8d84f3[_0x4d91('0x6e')]&&!_[_0x4d91('0x6d')](this['trunks'][util[_0x4d91('0x6f')]('SIP/%s',_0x8d84f3['name'])])&&!_[_0x4d91('0x6d')](this[_0x4d91('0x11')][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3['name'])][_0x4d91('0x30')])&&(this[_0x4d91('0x11')][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3[_0x4d91('0x29')])][_0x4d91('0x30')]===_0x4d91('0x71')||this['trunks'][util[_0x4d91('0x6f')](_0x4d91('0x70'),_0x8d84f3[_0x4d91('0x29')])]['status']===_0x4d91('0x72'));};Fax[_0x4d91('0x21')][_0x4d91('0x5e')]=function(_0x2f4796,_0xb3688a){if(!this[_0x4d91('0x6c')](_0x2f4796)){ut['logger'](_0x4d91('0x73'),_['isNil'](_0x2f4796)?'':_0x2f4796[_0x4d91('0x29')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4d91('0x74')};}if(_[_0x4d91('0x6d')](_0xb3688a['fax'])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4d91('0x41')](_0xb3688a));return{'isValid':![],'message':_0x4d91('0x75')};}if(_[_0x4d91('0x6d')](_0xb3688a[_0x4d91('0x4')])){ut[_0x4d91('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0xb3688a));return{'isValid':![],'message':_0x4d91('0x76')};}return{'isValid':!![],'message':_0x4d91('0x77')};};module[_0x4d91('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index a5fc3c2..8e087e1 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 _0x7be9=['resolve','then','catch','../../../config/logger','lodash','../rpc/faxAccount','inspect','notify'];(function(_0x161de4,_0x313a44){var _0x1bab59=function(_0x10a029){while(--_0x10a029){_0x161de4['push'](_0x161de4['shift']());}};_0x1bab59(++_0x313a44);}(_0x7be9,0x1ab));var _0x97be=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7be9[_0x5f3f88];return _0xd08119;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x97be('0x0'))('preview');var _=require(_0x97be('0x1'));var faxAccount=require(_0x97be('0x2'));function loggerCatch(_0x226d35){return function(_0xd9251e){logger['error'](_0x226d35,util[_0x97be('0x3')](_0xd9251e,{'showHidden':![],'depth':null}));};}exports[_0x97be('0x4')]=function(_0x2b214d,_0x298c40){return BPromise[_0x97be('0x5')]()[_0x97be('0x6')](faxAccount['notify'](_0x2b214d,_0x298c40))[_0x97be('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xfcb4=['error','inspect','notify','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x57be57,_0x1e16a5){var _0x110f19=function(_0x4c3deb){while(--_0x4c3deb){_0x57be57['push'](_0x57be57['shift']());}};_0x110f19(++_0x1e16a5);}(_0xfcb4,0x1bc));var _0x4fcb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfcb4[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x4fcb('0x0'));var BPromise=require(_0x4fcb('0x1'));var logger=require(_0x4fcb('0x2'))(_0x4fcb('0x3'));var _=require(_0x4fcb('0x4'));var faxAccount=require(_0x4fcb('0x5'));function loggerCatch(_0x321b52){return function(_0x46588b){logger[_0x4fcb('0x6')](_0x321b52,util[_0x4fcb('0x7')](_0x46588b,{'showHidden':![],'depth':null}));};}exports[_0x4fcb('0x8')]=function(_0x3e7171,_0x5e078b){return BPromise['resolve']()['then'](faxAccount[_0x4fcb('0x8')](_0x3e7171,_0x5e078b))['catch'](loggerCatch(_0x4fcb('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index a4cd05a..e8bf0a0 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 _0x8277=['inspect','util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x437111,_0x138da6){var _0x1813bd=function(_0x2f2bbc){while(--_0x2f2bbc){_0x437111['push'](_0x437111['shift']());}};_0x1813bd(++_0x138da6);}(_0x8277,0xa1));var _0x7827=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x8277[_0xcfeda9];return _0x4826c7;};'use strict';var util=require(_0x7827('0x0'));var logger=require(_0x7827('0x1'))(_0x7827('0x2'));var BPromise=require('bluebird');var exec=require(_0x7827('0x3'))[_0x7827('0x4')];exports[_0x7827('0x5')]=function(_0xa955bc){return new BPromise(function(_0x183b4e,_0x303c88){exec(_0xa955bc,function(_0x492af2,_0x3f4db9,_0x5b92e6){logger[_0x7827('0x6')](_0x7827('0x7'),_0x3f4db9);if(_0x492af2){logger[_0x7827('0x6')]('Exec\x20gs',_0x7827('0x8'),util[_0x7827('0x9')](_0x492af2,{'showHidden':![],'depth':null}),_0x3f4db9,_0x5b92e6);_0x303c88(_0x492af2);}_0x183b4e(_0x3f4db9);});});}; \ No newline at end of file +var _0x3922=['../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs','inspect','util'];(function(_0x2ce9d,_0x4ff962){var _0x578428=function(_0x2e0888){while(--_0x2e0888){_0x2ce9d['push'](_0x2ce9d['shift']());}};_0x578428(++_0x4ff962);}(_0x3922,0xbc));var _0x2392=function(_0x51ef65,_0x7bafbc){_0x51ef65=_0x51ef65-0x0;var _0xd5d69d=_0x3922[_0x51ef65];return _0xd5d69d;};'use strict';var util=require(_0x2392('0x0'));var logger=require(_0x2392('0x1'))(_0x2392('0x2'));var BPromise=require(_0x2392('0x3'));var exec=require('child_process')[_0x2392('0x4')];exports[_0x2392('0x5')]=function(_0x4871d3){return new BPromise(function(_0x5bb34e,_0x5cdaca){exec(_0x4871d3,function(_0x28578d,_0x479a96,_0x3fdaa3){logger[_0x2392('0x6')](_0x2392('0x7'),_0x479a96);if(_0x28578d){logger[_0x2392('0x6')](_0x2392('0x7'),'\x20Error\x20:',util[_0x2392('0x8')](_0x28578d,{'showHidden':![],'depth':null}),_0x479a96,_0x3fdaa3);_0x5cdaca(_0x28578d);}_0x5bb34e(_0x479a96);});});}; \ 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 ff904c8..b0df2b7 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 _0x9a84=['fax','message','info','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','../../../../config/logger'];(function(_0xcde6ec,_0x30b24e){var _0x12e321=function(_0x59f435){while(--_0x59f435){_0xcde6ec['push'](_0xcde6ec['shift']());}};_0x12e321(++_0x30b24e);}(_0x9a84,0x6c));var _0x49a8=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0x9a84[_0x5c814d];return _0x89b71;};'use strict';var util=require('util');var _=require(_0x49a8('0x0'));var moment=require('moment');var logger=require(_0x49a8('0x1'))(_0x49a8('0x2'));exports[_0x49a8('0x3')]=function(_0x47e940){return{'message':_0x47e940};};exports['logger']=function(_0x495f19,_0x4e95d9){logger[_0x49a8('0x4')](_0x495f19,util['inspect'](_0x4e95d9,{'showHidden':![],'depth':null}));};exports[_0x49a8('0x5')]=function(_0x16c622,_0x121089){var _0x417487={'XMF-ECM':_0x121089['ecm'],'XMF-HEADERINFO':_0x121089[_0x49a8('0x6')],'XMF-MINRATE':_0x121089[_0x49a8('0x7')],'XMF-MAXRATE':_0x121089[_0x49a8('0x8')],'XMF-MODEM':util[_0x49a8('0x9')](_0x49a8('0xa'),_0x121089[_0x49a8('0xb')]),'XMF-GATEWAY':_0x121089['gateway'],'XMF-FAXDETECT':_0x121089[_0x49a8('0xc')],'XMF-T38TIMEOUT':_0x121089[_0x49a8('0xd')],'XMF-LOCALSTATIONID':_0x121089[_0x49a8('0xe')],'XMF-PATH':_0x16c622['path']};return _0x417487;};exports[_0x49a8('0xf')]=function(_0x58cceb,_0x1f4815){return{'actionid':_0x58cceb[_0x49a8('0x10')],'action':_0x49a8('0x11'),'channel':_0x58cceb[_0x49a8('0x12')],'Exten':_0x49a8('0x13'),'Context':_0x49a8('0x14'),'Priority':'1','callerid':util[_0x49a8('0x9')](_0x49a8('0x15'),_0x58cceb[_0x49a8('0x6')]?_0x58cceb[_0x49a8('0x6')]:'',_0x58cceb[_0x49a8('0xe')]),'variable':_0x1f4815,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x58cceb[_0x49a8('0x10')]};}; \ No newline at end of file +var _0xe561=['minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','path','variablesAction','uniqueid','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','fax','message','logger','inspect','addVariables','ecm'];(function(_0x357f1f,_0x402762){var _0x316285=function(_0x199dc0){while(--_0x199dc0){_0x357f1f['push'](_0x357f1f['shift']());}};_0x316285(++_0x402762);}(_0xe561,0x117));var _0x1e56=function(_0x102a91,_0x4fa93e){_0x102a91=_0x102a91-0x0;var _0xfcc98c=_0xe561[_0x102a91];return _0xfcc98c;};'use strict';var util=require(_0x1e56('0x0'));var _=require(_0x1e56('0x1'));var moment=require(_0x1e56('0x2'));var logger=require('../../../../config/logger')(_0x1e56('0x3'));exports[_0x1e56('0x4')]=function(_0x58aea5){return{'message':_0x58aea5};};exports[_0x1e56('0x5')]=function(_0x22dd5b,_0x58e59d){logger['info'](_0x22dd5b,util[_0x1e56('0x6')](_0x58e59d,{'showHidden':![],'depth':null}));};exports[_0x1e56('0x7')]=function(_0x15af6c,_0x897a2d){var _0x3e417c={'XMF-ECM':_0x897a2d[_0x1e56('0x8')],'XMF-HEADERINFO':_0x897a2d['headerinfo'],'XMF-MINRATE':_0x897a2d[_0x1e56('0x9')],'XMF-MAXRATE':_0x897a2d[_0x1e56('0xa')],'XMF-MODEM':util[_0x1e56('0xb')](_0x1e56('0xc'),_0x897a2d[_0x1e56('0xd')]),'XMF-GATEWAY':_0x897a2d[_0x1e56('0xe')],'XMF-FAXDETECT':_0x897a2d['faxdetect'],'XMF-T38TIMEOUT':_0x897a2d[_0x1e56('0xf')],'XMF-LOCALSTATIONID':_0x897a2d['localstationid'],'XMF-PATH':_0x15af6c[_0x1e56('0x10')]};return _0x3e417c;};exports[_0x1e56('0x11')]=function(_0x3f15e2,_0x35624d){return{'actionid':_0x3f15e2[_0x1e56('0x12')],'action':'originate','channel':_0x3f15e2[_0x1e56('0x13')],'Exten':_0x1e56('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x1e56('0xb')](_0x1e56('0x15'),_0x3f15e2[_0x1e56('0x16')]?_0x3f15e2['headerinfo']:'',_0x3f15e2[_0x1e56('0x17')]),'variable':_0x35624d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3f15e2[_0x1e56('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 4c047b3..8a2ad45 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 _0xb82c=['getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','catch','[index.js][main]','inspect','bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb82c,0x171));var _0xcb82=function(_0x48a020,_0x492242){_0x48a020=_0x48a020-0x0;var _0x4756f8=_0xb82c[_0x48a020];return _0x4756f8;};'use strict';var BPromise=require(_0xcb82('0x0'));var util=require(_0xcb82('0x1'));var moment=require(_0xcb82('0x2'));var server=require('./server');var Realtime=require(_0xcb82('0x3'));var Report=require(_0xcb82('0x4'));var Acw=require(_0xcb82('0x5'));var Trigger=require(_0xcb82('0x6'));var Dialer=require(_0xcb82('0x7'));var Preview=require(_0xcb82('0x8'));var Fax=require('./fax');var user=require(_0xcb82('0x9'));var voiceQueue=require(_0xcb82('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xcb82('0xb'));var trunk=require(_0xcb82('0xc'));var trigger=require(_0xcb82('0xd'));var template=require(_0xcb82('0xe'));var cmHopperHistory=require(_0xcb82('0xf'));var campaign=require(_0xcb82('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xcb82('0x11'));var zendesk=require(_0xcb82('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xcb82('0x13'));var desk=require(_0xcb82('0x14'));var zoho=require(_0xcb82('0x15'));var vtiger=require(_0xcb82('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xcb82('0x17'));var dynamics365=require(_0xcb82('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(_0xcb82('0x19'))(_0xcb82('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xcb82('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xcb82('0x1c')](user[_0xcb82('0x1d')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x1e')]())[_0xcb82('0x1c')](user[_0xcb82('0x1f')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x20')]())[_0xcb82('0x1c')](trunk[_0xcb82('0x21')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x22')]())[_0xcb82('0x1c')](voiceQueue[_0xcb82('0x23')]())['then'](realtime[_0xcb82('0x24')]())[_0xcb82('0x1c')](trigger[_0xcb82('0x25')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x26')]())[_0xcb82('0x1c')](template['getTemplates']())[_0xcb82('0x1c')](realtime[_0xcb82('0x27')]())[_0xcb82('0x1c')](zendesk[_0xcb82('0x28')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x29')]())['then'](salesforce[_0xcb82('0x2a')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xcb82('0x2b')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x2c')]())['then'](freshdesk[_0xcb82('0x2d')]())['then'](realtime[_0xcb82('0x2e')]())[_0xcb82('0x1c')](desk[_0xcb82('0x2f')]())['then'](realtime['initDeskAccounts']())[_0xcb82('0x1c')](zoho[_0xcb82('0x30')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x31')]())[_0xcb82('0x1c')](vtiger[_0xcb82('0x32')]())[_0xcb82('0x1c')](realtime['initVtigerAccounts']())[_0xcb82('0x1c')](freshsales[_0xcb82('0x33')]())[_0xcb82('0x1c')](realtime['initFreshsalesAccounts']())[_0xcb82('0x1c')](servicenow[_0xcb82('0x34')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x35')]())['then'](dynamics365[_0xcb82('0x36')]())[_0xcb82('0x1c')](realtime['initDynamics365Accounts']())[_0xcb82('0x1c')](campaign[_0xcb82('0x37')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x38')]())['then'](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xcb82('0x39')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0xcb82('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xcb82('0x3b')]()['then'](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xcb82('0x3c')]())['then'](cmHopperHistory[_0xcb82('0x3d')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xcb82('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0xcb82('0x1c')](realtime[_0xcb82('0x3e')]())[_0xcb82('0x1c')](voiceCallReport[_0xcb82('0x3f')]())[_0xcb82('0x1c')](realtime[_0xcb82('0x40')]())['catch'](function(_0x195994){logger[_0xcb82('0x41')]('[index.js][initParams]',util['inspect'](_0x195994,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xcb82('0x1c')](function(_0x3c0a44){return initRealtime();})[_0xcb82('0x1c')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xcb82('0x42')](function(_0x589c63){logger['error'](_0xcb82('0x43'),util[_0xcb82('0x44')](_0x589c63,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x70c8=['getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','[index.js][main]','bluebird','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','../../config/logger','ami','get','hour','resolve','then'];(function(_0x444779,_0x3fc36a){var _0xdaa3bc=function(_0x322604){while(--_0x322604){_0x444779['push'](_0x444779['shift']());}};_0xdaa3bc(++_0x3fc36a);}(_0x70c8,0x6b));var _0x870c=function(_0x361707,_0x2addbb){_0x361707=_0x361707-0x0;var _0x1495b1=_0x70c8[_0x361707];return _0x1495b1;};'use strict';var BPromise=require(_0x870c('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x870c('0x1'));var Realtime=require(_0x870c('0x2'));var Report=require('./report');var Acw=require(_0x870c('0x3'));var Trigger=require(_0x870c('0x4'));var Dialer=require(_0x870c('0x5'));var Preview=require(_0x870c('0x6'));var Fax=require(_0x870c('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x870c('0x8'));var voiceQueueReport=require(_0x870c('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x870c('0xa'));var template=require(_0x870c('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x870c('0xc'));var voiceExtension=require(_0x870c('0xd'));var faxAccount=require(_0x870c('0xe'));var zendesk=require(_0x870c('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x870c('0x10'));var desk=require(_0x870c('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x870c('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x870c('0x13'))(_0x870c('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x870c('0x15')](_0x870c('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x870c('0x17')]()[_0x870c('0x18')](user[_0x870c('0x19')]())[_0x870c('0x18')](realtime[_0x870c('0x1a')]())[_0x870c('0x18')](user[_0x870c('0x1b')]())['then'](realtime[_0x870c('0x1c')]())['then'](trunk[_0x870c('0x1d')]())[_0x870c('0x18')](realtime[_0x870c('0x1e')]())[_0x870c('0x18')](voiceQueue[_0x870c('0x1f')]())[_0x870c('0x18')](realtime[_0x870c('0x20')]())[_0x870c('0x18')](trigger['getTriggers']())[_0x870c('0x18')](realtime[_0x870c('0x21')]())[_0x870c('0x18')](template['getTemplates']())[_0x870c('0x18')](realtime[_0x870c('0x22')]())[_0x870c('0x18')](zendesk['getZendeskAccounts']())[_0x870c('0x18')](realtime[_0x870c('0x23')]())[_0x870c('0x18')](salesforce[_0x870c('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0x870c('0x18')](sugarcrm[_0x870c('0x25')]())[_0x870c('0x18')](realtime['initSugarcrmAccounts']())[_0x870c('0x18')](freshdesk[_0x870c('0x26')]())[_0x870c('0x18')](realtime[_0x870c('0x27')]())[_0x870c('0x18')](desk[_0x870c('0x28')]())[_0x870c('0x18')](realtime[_0x870c('0x29')]())[_0x870c('0x18')](zoho[_0x870c('0x2a')]())[_0x870c('0x18')](realtime[_0x870c('0x2b')]())[_0x870c('0x18')](vtiger[_0x870c('0x2c')]())[_0x870c('0x18')](realtime[_0x870c('0x2d')]())[_0x870c('0x18')](freshsales[_0x870c('0x2e')]())[_0x870c('0x18')](realtime[_0x870c('0x2f')]())[_0x870c('0x18')](servicenow[_0x870c('0x30')]())[_0x870c('0x18')](realtime[_0x870c('0x31')]())['then'](dynamics365[_0x870c('0x32')]())['then'](realtime[_0x870c('0x33')]())[_0x870c('0x18')](campaign[_0x870c('0x34')]())[_0x870c('0x18')](realtime[_0x870c('0x35')]())[_0x870c('0x18')](voiceExtension[_0x870c('0x36')]())[_0x870c('0x18')](realtime['initVoiceExtensions']())[_0x870c('0x18')](faxAccount['getFaxAccounts']())[_0x870c('0x18')](realtime[_0x870c('0x37')]())[_0x870c('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x870c('0x17')]()[_0x870c('0x18')](voiceQueueReport[_0x870c('0x38')]())[_0x870c('0x18')](realtime[_0x870c('0x39')]())['then'](cmHopperHistory[_0x870c('0x3a')]())[_0x870c('0x18')](realtime[_0x870c('0x3b')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x870c('0x18')](realtime['initCampaignHopperHistory']())[_0x870c('0x18')](voiceCallReport[_0x870c('0x3c')]())['then'](realtime['initVoiceCallReports']())[_0x870c('0x3d')](function(_0x42d286){logger[_0x870c('0x3e')](_0x870c('0x3f'),util[_0x870c('0x40')](_0x42d286,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x870c('0x18')](function(_0x14fd69){return initRealtime();})[_0x870c('0x18')](function(){return initParams();})[_0x870c('0x18')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x870c('0x3d')](function(_0x303fe3){logger['error'](_0x870c('0x41'),util[_0x870c('0x40')](_0x303fe3,{'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 c20a42a..03443e2 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(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b8423,_0x30eaf8){_0x3b8423=_0x3b8423-0x0;var _0x4253f0=_0xedd9[_0x3b8423];return _0x4253f0;};'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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x1ff8ca,_0x6588c){var _0x357108=function(_0x3070ed){while(--_0x3070ed){_0x1ff8ca['push'](_0x1ff8ca['shift']());}};_0x357108(++_0x6588c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index cc2a1b2..48b7770 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 _0xb557=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb557,0xaf));var _0x7b55=function(_0x5b61d0,_0x503828){_0x5b61d0=_0x5b61d0-0x0;var _0x2520ac=_0xb557[_0x5b61d0];return _0x2520ac;};'use strict';function Campaign(_0x1114cf){this['id']=_0x1114cf['id']||0x0;this['name']=_0x1114cf[_0x7b55('0x0')]||'';this['type']=_0x1114cf[_0x7b55('0x1')]||_0x7b55('0x2');this[_0x7b55('0x3')]=0x0;this['temp']=0x0;this[_0x7b55('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7b55('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x7b55('0x6')]=_0x1114cf[_0x7b55('0x6')];this[_0x7b55('0x7')]=_0x1114cf[_0x7b55('0x7')];this[_0x7b55('0x8')]=_0x1114cf[_0x7b55('0x8')]||null;this['dialGlobalInterval']=_0x1114cf[_0x7b55('0x9')]?_0x1114cf[_0x7b55('0x9')]:null;this[_0x7b55('0xa')]=_0x1114cf[_0x7b55('0xa')];this['dialOriginateCallerIdNumber']=_0x1114cf[_0x7b55('0xb')];this['dialOriginateTimeout']=_0x1114cf['dialOriginateTimeout']||0x1e;this[_0x7b55('0xc')]=_0x1114cf[_0x7b55('0xc')];this[_0x7b55('0xd')]=_0x1114cf[_0x7b55('0xd')];this['dialBusyMaxRetry']=_0x1114cf[_0x7b55('0xe')];this[_0x7b55('0xf')]=_0x1114cf[_0x7b55('0xf')];this[_0x7b55('0x10')]=_0x1114cf[_0x7b55('0x10')];this[_0x7b55('0x11')]=_0x1114cf['dialNoAnswerRetryFrequency'];this[_0x7b55('0x12')]=_0x1114cf[_0x7b55('0x12')];this[_0x7b55('0x13')]=_0x1114cf[_0x7b55('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1114cf['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1114cf[_0x7b55('0x14')]||0x3;this[_0x7b55('0x15')]=_0x1114cf[_0x7b55('0x15')]||0x96;this[_0x7b55('0x16')]=_0x1114cf[_0x7b55('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0x1114cf[_0x7b55('0x17')]||0x96;this[_0x7b55('0x18')]=_0x1114cf[_0x7b55('0x18')]||0x3;this[_0x7b55('0x19')]=_0x1114cf[_0x7b55('0x19')]||0x96;this[_0x7b55('0x1a')]=_0x1114cf[_0x7b55('0x1a')]||0x3;this[_0x7b55('0x1b')]=_0x1114cf[_0x7b55('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x1114cf[_0x7b55('0x1c')]||_0x7b55('0x1d');this['dialPrefix']=_0x1114cf[_0x7b55('0x1e')]||undefined;this[_0x7b55('0x1f')]=_0x1114cf[_0x7b55('0x1f')]||undefined;this[_0x7b55('0x20')]=_0x1114cf[_0x7b55('0x20')]||undefined;this[_0x7b55('0x21')]=_0x1114cf['TrunkBackup']?_0x1114cf[_0x7b55('0x21')]:undefined;this[_0x7b55('0x22')]=_0x1114cf[_0x7b55('0x22')]?_0x1114cf[_0x7b55('0x22')]:undefined;this['Interval']=_0x1114cf[_0x7b55('0x23')]?_0x1114cf[_0x7b55('0x23')]:undefined;this[_0x7b55('0x24')]=_0x1114cf[_0x7b55('0x24')]?_0x1114cf[_0x7b55('0x24')]:undefined;this['dialQueueProject']=_0x1114cf[_0x7b55('0x24')]?_0x1114cf[_0x7b55('0x24')][_0x7b55('0x0')]:undefined;this[_0x7b55('0x25')]=_0x1114cf[_0x7b55('0x25')]||![];this['dialAMDInitialSilence']=_0x1114cf[_0x7b55('0x26')];this[_0x7b55('0x27')]=_0x1114cf[_0x7b55('0x27')];this[_0x7b55('0x28')]=_0x1114cf[_0x7b55('0x28')];this[_0x7b55('0x29')]=_0x1114cf[_0x7b55('0x29')];this[_0x7b55('0x2a')]=_0x1114cf[_0x7b55('0x2a')];this[_0x7b55('0x2b')]=_0x1114cf[_0x7b55('0x2b')];this[_0x7b55('0x2c')]=_0x1114cf[_0x7b55('0x2c')];this['dialAMDSilenceThreshold']=_0x1114cf[_0x7b55('0x2d')];this[_0x7b55('0x2e')]=_0x1114cf[_0x7b55('0x2e')];}module[_0x7b55('0x2f')]=Campaign; \ No newline at end of file +var _0xb5ed=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay'];(function(_0x38fbc2,_0x641aa1){var _0x43c7d4=function(_0x45d3b9){while(--_0x45d3b9){_0x38fbc2['push'](_0x38fbc2['shift']());}};_0x43c7d4(++_0x641aa1);}(_0xb5ed,0x191));var _0xdb5e=function(_0x9ff750,_0x22316b){_0x9ff750=_0x9ff750-0x0;var _0x54c37b=_0xb5ed[_0x9ff750];return _0x54c37b;};'use strict';function Campaign(_0x1ca4f9){this['id']=_0x1ca4f9['id']||0x0;this[_0xdb5e('0x0')]=_0x1ca4f9[_0xdb5e('0x0')]||'';this[_0xdb5e('0x1')]=_0x1ca4f9[_0xdb5e('0x1')]||_0xdb5e('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xdb5e('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0xdb5e('0x4')]=!![];this[_0xdb5e('0x5')]=_0x1ca4f9[_0xdb5e('0x5')];this[_0xdb5e('0x6')]=_0x1ca4f9[_0xdb5e('0x6')];this[_0xdb5e('0x7')]=_0x1ca4f9['dialTimezone']||null;this[_0xdb5e('0x8')]=_0x1ca4f9[_0xdb5e('0x8')]?_0x1ca4f9[_0xdb5e('0x8')]:null;this['dialOriginateCallerIdName']=_0x1ca4f9[_0xdb5e('0x9')];this[_0xdb5e('0xa')]=_0x1ca4f9[_0xdb5e('0xa')];this['dialOriginateTimeout']=_0x1ca4f9[_0xdb5e('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x1ca4f9['dialCongestionMaxRetry'];this[_0xdb5e('0xc')]=_0x1ca4f9[_0xdb5e('0xc')];this['dialBusyMaxRetry']=_0x1ca4f9[_0xdb5e('0xd')];this[_0xdb5e('0xe')]=_0x1ca4f9[_0xdb5e('0xe')];this[_0xdb5e('0xf')]=_0x1ca4f9[_0xdb5e('0xf')];this[_0xdb5e('0x10')]=_0x1ca4f9[_0xdb5e('0x10')];this[_0xdb5e('0x11')]=_0x1ca4f9[_0xdb5e('0x11')];this['dialNoSuchNumberMaxRetry']=_0x1ca4f9[_0xdb5e('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1ca4f9[_0xdb5e('0x13')]||0x96;this['dialDropMaxRetry']=_0x1ca4f9['dialDropMaxRetry']||0x3;this[_0xdb5e('0x14')]=_0x1ca4f9[_0xdb5e('0x14')]||0x96;this[_0xdb5e('0x15')]=_0x1ca4f9[_0xdb5e('0x15')]||0x3;this[_0xdb5e('0x16')]=_0x1ca4f9['dialAbandonedRetryFrequency']||0x96;this[_0xdb5e('0x17')]=_0x1ca4f9[_0xdb5e('0x17')]||0x3;this[_0xdb5e('0x18')]=_0x1ca4f9[_0xdb5e('0x18')]||0x96;this[_0xdb5e('0x19')]=_0x1ca4f9[_0xdb5e('0x19')]||0x3;this[_0xdb5e('0x1a')]=_0x1ca4f9[_0xdb5e('0x1a')]||0x96;this['dialOrderByScheduledAt']=_0x1ca4f9['dialOrderByScheduledAt']||'DESC';this[_0xdb5e('0x1b')]=_0x1ca4f9['dialPrefix']||undefined;this[_0xdb5e('0x1c')]=_0x1ca4f9[_0xdb5e('0x1c')]||undefined;this['dialCutDigit']=_0x1ca4f9[_0xdb5e('0x1d')]||undefined;this[_0xdb5e('0x1e')]=_0x1ca4f9['TrunkBackup']?_0x1ca4f9[_0xdb5e('0x1e')]:undefined;this['Trunk']=_0x1ca4f9[_0xdb5e('0x1f')]?_0x1ca4f9['Trunk']:undefined;this[_0xdb5e('0x20')]=_0x1ca4f9[_0xdb5e('0x20')]?_0x1ca4f9[_0xdb5e('0x20')]:undefined;this[_0xdb5e('0x21')]=_0x1ca4f9[_0xdb5e('0x21')]?_0x1ca4f9['SquareProject']:undefined;this[_0xdb5e('0x22')]=_0x1ca4f9[_0xdb5e('0x21')]?_0x1ca4f9['SquareProject'][_0xdb5e('0x0')]:undefined;this[_0xdb5e('0x23')]=_0x1ca4f9['dialAMDActive']||![];this[_0xdb5e('0x24')]=_0x1ca4f9[_0xdb5e('0x24')];this['dialAMDGreeting']=_0x1ca4f9[_0xdb5e('0x25')];this[_0xdb5e('0x26')]=_0x1ca4f9['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1ca4f9['dialAMDTotalAnalysisTime'];this[_0xdb5e('0x27')]=_0x1ca4f9[_0xdb5e('0x27')];this[_0xdb5e('0x28')]=_0x1ca4f9[_0xdb5e('0x28')];this[_0xdb5e('0x29')]=_0x1ca4f9[_0xdb5e('0x29')];this[_0xdb5e('0x2a')]=_0x1ca4f9[_0xdb5e('0x2a')];this[_0xdb5e('0x2b')]=_0x1ca4f9[_0xdb5e('0x2b')];}module[_0xdb5e('0x2c')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 821be1d..2148e4f 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 _0xb2ed=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','lastapplication','lastdata','billableseconds','holdtime','disposition','monitor','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','calleridname'];(function(_0x30cdb4,_0x3d70a6){var _0x510529=function(_0x3f0471){while(--_0x3f0471){_0x30cdb4['push'](_0x30cdb4['shift']());}};_0x510529(++_0x3d70a6);}(_0xb2ed,0x86));var _0xdb2e=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb2ed[_0x485b5a];return _0xd2b34d;};'use strict';function Channel(){this[_0xdb2e('0x0')]=null;this[_0xdb2e('0x1')]='';this['destinationchannel']='';this[_0xdb2e('0x2')]=0x0;this[_0xdb2e('0x3')]='';this[_0xdb2e('0x4')]=undefined;this[_0xdb2e('0x5')]=undefined;this[_0xdb2e('0x6')]=0x0;this[_0xdb2e('0x7')]='';this[_0xdb2e('0x8')]=0x0;this[_0xdb2e('0x9')]=0x0;this['exten']=0x0;this[_0xdb2e('0xa')]=![];this[_0xdb2e('0xb')]=null;this[_0xdb2e('0xc')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xdb2e('0xd')]='';this[_0xdb2e('0xe')]='';this['duration']=0x0;this[_0xdb2e('0xf')]=0x0;this[_0xdb2e('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0xdb2e('0x11')]=null;this[_0xdb2e('0x12')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0xdb2e('0x13')]=undefined;this[_0xdb2e('0x14')]=undefined;this['transferType']=undefined;this[_0xdb2e('0x15')]=0x0;}module[_0xdb2e('0x16')]=Channel; \ No newline at end of file +var _0x958a=['unmanaged','abandoned','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','endtime'];(function(_0x5654e3,_0x2e326b){var _0x3d67fa=function(_0xa32661){while(--_0xa32661){_0x5654e3['push'](_0x5654e3['shift']());}};_0x3d67fa(++_0x2e326b);}(_0x958a,0x128));var _0xa958=function(_0x2dfa49,_0x4986ec){_0x2dfa49=_0x2dfa49-0x0;var _0x5b7900=_0x958a[_0x2dfa49];return _0x5b7900;};'use strict';function Channel(){this[_0xa958('0x0')]=null;this[_0xa958('0x1')]='';this['destinationchannel']='';this[_0xa958('0x2')]=0x0;this[_0xa958('0x3')]='';this[_0xa958('0x4')]=undefined;this[_0xa958('0x5')]=undefined;this[_0xa958('0x6')]=0x0;this['context']='';this[_0xa958('0x7')]=0x0;this['linkedid']=0x0;this[_0xa958('0x8')]=0x0;this[_0xa958('0x9')]=![];this[_0xa958('0xa')]=null;this[_0xa958('0xb')]=null;this[_0xa958('0xc')]=![];this[_0xa958('0xd')]=![];this[_0xa958('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0xa958('0xf')]=0x0;this[_0xa958('0x10')]=0x0;this[_0xa958('0x11')]=null;this[_0xa958('0x12')]=null;this[_0xa958('0x13')]=null;this[_0xa958('0x14')]=![];this[_0xa958('0x15')]=null;this[_0xa958('0x16')]=null;this[_0xa958('0x17')]=[];this[_0xa958('0x18')]=undefined;this[_0xa958('0x19')]=undefined;this[_0xa958('0x1a')]=undefined;this[_0xa958('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 1df4280..dfda405 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 _0x5b22=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5b22,0x113));var _0x25b2=function(_0x13605b,_0x2a43a2){_0x13605b=_0x13605b-0x0;var _0xaf605a=_0x5b22[_0x13605b];return _0xaf605a;};'use strict';function DeskAccount(_0x9957be){this['id']=_0x9957be['id']||0x0;this[_0x25b2('0x0')]=_0x9957be[_0x25b2('0x0')]||'';this[_0x25b2('0x1')]=_0x9957be[_0x25b2('0x1')]||'';this[_0x25b2('0x2')]=_0x9957be['remoteUri']||'';this['authType']=_0x9957be[_0x25b2('0x3')]||'';this['password']=_0x9957be[_0x25b2('0x4')]||'';this[_0x25b2('0x5')]=_0x9957be[_0x25b2('0x5')]||'';this['consumerSecret']=_0x9957be[_0x25b2('0x6')]||'';this[_0x25b2('0x7')]=_0x9957be[_0x25b2('0x7')]||'';this['tokenSecret']=_0x9957be[_0x25b2('0x8')]||'';this[_0x25b2('0x9')]=_0x9957be[_0x25b2('0x9')]||'';this['serverUrl']=_0x9957be[_0x25b2('0xa')]||'';this[_0x25b2('0xb')]=_0x9957be[_0x25b2('0xb')]||{};}module[_0x25b2('0xc')]=DeskAccount; \ No newline at end of file +var _0x7ebc=['username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x1fb8d5,_0x5ad2fd){var _0x302103=function(_0x22d799){while(--_0x22d799){_0x1fb8d5['push'](_0x1fb8d5['shift']());}};_0x302103(++_0x5ad2fd);}(_0x7ebc,0x1eb));var _0xc7eb=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x7ebc[_0x1fcaf1];return _0x55f464;};'use strict';function DeskAccount(_0x21f597){this['id']=_0x21f597['id']||0x0;this[_0xc7eb('0x0')]=_0x21f597[_0xc7eb('0x0')]||'';this['username']=_0x21f597[_0xc7eb('0x1')]||'';this[_0xc7eb('0x2')]=_0x21f597[_0xc7eb('0x2')]||'';this[_0xc7eb('0x3')]=_0x21f597[_0xc7eb('0x3')]||'';this[_0xc7eb('0x4')]=_0x21f597[_0xc7eb('0x4')]||'';this['consumerKey']=_0x21f597['consumerKey']||'';this[_0xc7eb('0x5')]=_0x21f597[_0xc7eb('0x5')]||'';this[_0xc7eb('0x6')]=_0x21f597[_0xc7eb('0x6')]||'';this[_0xc7eb('0x7')]=_0x21f597[_0xc7eb('0x7')]||'';this[_0xc7eb('0x8')]=_0x21f597['type']||'';this[_0xc7eb('0x9')]=_0x21f597[_0xc7eb('0x9')]||'';this[_0xc7eb('0xa')]=_0x21f597['Configurations']||{};}module[_0xc7eb('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 230a386..6ed6219 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 _0x6e6c=['clientSecret','serverUrl','Configurations','name','username','remoteUri','tenantId','clientId'];(function(_0x21ce18,_0x5d6146){var _0x104c78=function(_0x135570){while(--_0x135570){_0x21ce18['push'](_0x21ce18['shift']());}};_0x104c78(++_0x5d6146);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';function Dynamics365Account(_0xc51915){this['id']=_0xc51915['id']||0x0;this[_0xc6e6('0x0')]=_0xc51915['name']||'';this[_0xc6e6('0x1')]=_0xc51915[_0xc6e6('0x1')]||'';this['password']=_0xc51915['password']||'';this[_0xc6e6('0x2')]=_0xc51915['remoteUri']||'';this[_0xc6e6('0x3')]=_0xc51915['tenantId']||'';this[_0xc6e6('0x4')]=_0xc51915[_0xc6e6('0x4')]||'';this['clientSecret']=_0xc51915[_0xc6e6('0x5')]||{};this[_0xc6e6('0x6')]=_0xc51915['serverUrl']||'';this[_0xc6e6('0x7')]=_0xc51915[_0xc6e6('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xbaf0=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x468e61,_0x59723d){var _0x1c0325=function(_0x34cef3){while(--_0x34cef3){_0x468e61['push'](_0x468e61['shift']());}};_0x1c0325(++_0x59723d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';function Dynamics365Account(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||'';this[_0x0baf('0x2')]=_0x61caa9[_0x0baf('0x2')]||'';this['remoteUri']=_0x61caa9[_0x0baf('0x3')]||'';this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||'';this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||'';this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||{};this[_0x0baf('0x7')]=_0x61caa9[_0x0baf('0x7')]||'';this['Configurations']=_0x61caa9[_0x0baf('0x8')]||{};}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 b8ed3f6..65d3945 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 _0xe8c0=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x59101c,_0x28d827){var _0x3ecaa7=function(_0x351d3d){while(--_0x351d3d){_0x59101c['push'](_0x59101c['shift']());}};_0x3ecaa7(++_0x28d827);}(_0xe8c0,0x13e));var _0x0e8c=function(_0x4f17eb,_0x582779){_0x4f17eb=_0x4f17eb-0x0;var _0x23da68=_0xe8c0[_0x4f17eb];return _0x23da68;};'use strict';function FaxAccount(_0x5ccf03){this['id']=_0x5ccf03['id']||0x0;this[_0x0e8c('0x0')]=_0x5ccf03[_0x0e8c('0x0')]||'';this['description']=_0x5ccf03[_0x0e8c('0x1')];this['ecm']=_0x5ccf03[_0x0e8c('0x2')];this[_0x0e8c('0x3')]=_0x5ccf03[_0x0e8c('0x3')];this[_0x0e8c('0x4')]=_0x5ccf03[_0x0e8c('0x4')];this[_0x0e8c('0x5')]=_0x5ccf03[_0x0e8c('0x5')]||0x960;this[_0x0e8c('0x6')]=_0x5ccf03[_0x0e8c('0x6')]||0x3840;this[_0x0e8c('0x7')]=_0x5ccf03[_0x0e8c('0x7')]||_0x0e8c('0x8');this[_0x0e8c('0x9')]=_0x5ccf03[_0x0e8c('0x9')]||'no';this['faxdetect']=_0x5ccf03[_0x0e8c('0xa')]||'no';this[_0x0e8c('0xb')]=_0x5ccf03[_0x0e8c('0xb')]||0x1388;this['tech']=_0x5ccf03[_0x0e8c('0xc')]||_0x0e8c('0xd');this[_0x0e8c('0xe')]=_0x5ccf03[_0x0e8c('0xe')]?_0x5ccf03[_0x0e8c('0xe')]:undefined;this['ListId']=_0x5ccf03[_0x0e8c('0xf')];this['key']=_0x5ccf03[_0x0e8c('0x10')];}module[_0x0e8c('0x11')]=FaxAccount; \ No newline at end of file +var _0x83a5=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','ecm','headerinfo','localstationid','minrate'];(function(_0x276f91,_0x22d9fc){var _0x1ba447=function(_0x198337){while(--_0x198337){_0x276f91['push'](_0x276f91['shift']());}};_0x1ba447(++_0x22d9fc);}(_0x83a5,0xcb));var _0x583a=function(_0x5dce70,_0x246f01){_0x5dce70=_0x5dce70-0x0;var _0x107197=_0x83a5[_0x5dce70];return _0x107197;};'use strict';function FaxAccount(_0x42caff){this['id']=_0x42caff['id']||0x0;this[_0x583a('0x0')]=_0x42caff[_0x583a('0x0')]||'';this['description']=_0x42caff['description'];this[_0x583a('0x1')]=_0x42caff[_0x583a('0x1')];this[_0x583a('0x2')]=_0x42caff['headerinfo'];this[_0x583a('0x3')]=_0x42caff[_0x583a('0x3')];this[_0x583a('0x4')]=_0x42caff['minrate']||0x960;this['maxrate']=_0x42caff['maxrate']||0x3840;this[_0x583a('0x5')]=_0x42caff[_0x583a('0x5')]||_0x583a('0x6');this[_0x583a('0x7')]=_0x42caff[_0x583a('0x7')]||'no';this[_0x583a('0x8')]=_0x42caff[_0x583a('0x8')]||'no';this[_0x583a('0x9')]=_0x42caff[_0x583a('0x9')]||0x1388;this['tech']=_0x42caff[_0x583a('0xa')]||_0x583a('0xb');this[_0x583a('0xc')]=_0x42caff['Trunk']?_0x42caff['Trunk']:undefined;this[_0x583a('0xd')]=_0x42caff[_0x583a('0xd')];this[_0x583a('0xe')]=_0x42caff[_0x583a('0xe')];}module[_0x583a('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 24b1d54..5a67cdd 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 _0x2bea=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x35e86e,_0x393a50){var _0x19c22e=function(_0x4789e5){while(--_0x4789e5){_0x35e86e['push'](_0x35e86e['shift']());}};_0x19c22e(++_0x393a50);}(_0x2bea,0x116));var _0xa2be=function(_0x765941,_0x3fd7eb){_0x765941=_0x765941-0x0;var _0x17cd2a=_0x2bea[_0x765941];return _0x17cd2a;};'use strict';function FreshdeskAccount(_0x451b77){this['id']=_0x451b77['id']||0x0;this[_0xa2be('0x0')]=_0x451b77[_0xa2be('0x0')]||'';this[_0xa2be('0x1')]=_0x451b77[_0xa2be('0x1')]||'';this[_0xa2be('0x2')]=_0x451b77['token']||'';this['remoteUri']=_0x451b77[_0xa2be('0x3')]||'';this['serverUrl']=_0x451b77[_0xa2be('0x4')]||'';this[_0xa2be('0x5')]=_0x451b77['Configurations']||{};}module[_0xa2be('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x633d=['remoteUri','serverUrl','Configurations','exports','username','apiKey','token'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x633d,0x100));var _0xd633=function(_0x3ef0d0,_0x4b6e6c){_0x3ef0d0=_0x3ef0d0-0x0;var _0x4dcaeb=_0x633d[_0x3ef0d0];return _0x4dcaeb;};'use strict';function FreshdeskAccount(_0x36fb9b){this['id']=_0x36fb9b['id']||0x0;this['name']=_0x36fb9b['name']||'';this['username']=_0x36fb9b[_0xd633('0x0')]||'';this[_0xd633('0x1')]=_0x36fb9b[_0xd633('0x2')]||'';this[_0xd633('0x3')]=_0x36fb9b[_0xd633('0x3')]||'';this[_0xd633('0x4')]=_0x36fb9b[_0xd633('0x4')]||'';this[_0xd633('0x5')]=_0x36fb9b[_0xd633('0x5')]||{};}module[_0xd633('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5a63766..47b68e5 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 _0x9a14=['name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x596a5b,_0x51af41){var _0x1b7e71=function(_0x37cb7d){while(--_0x37cb7d){_0x596a5b['push'](_0x596a5b['shift']());}};_0x1b7e71(++_0x51af41);}(_0x9a14,0xa8));var _0x49a1=function(_0x543009,_0x59e2f4){_0x543009=_0x543009-0x0;var _0x512aa9=_0x9a14[_0x543009];return _0x512aa9;};'use strict';function FreshsalesAccount(_0x1d4a28){this['id']=_0x1d4a28['id']||0x0;this['name']=_0x1d4a28[_0x49a1('0x0')]||'';this[_0x49a1('0x1')]=_0x1d4a28[_0x49a1('0x1')]||'';this[_0x49a1('0x2')]=_0x1d4a28[_0x49a1('0x3')]||'';this[_0x49a1('0x4')]=_0x1d4a28[_0x49a1('0x4')]||'';this[_0x49a1('0x5')]=_0x1d4a28['serverUrl']||'';this['Configurations']=_0x1d4a28['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x2427=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2427,0x165));var _0x7242=function(_0x566414,_0x35b82a){_0x566414=_0x566414-0x0;var _0x4c90f2=_0x2427[_0x566414];return _0x4c90f2;};'use strict';function FreshsalesAccount(_0x284545){this['id']=_0x284545['id']||0x0;this[_0x7242('0x0')]=_0x284545['name']||'';this[_0x7242('0x1')]=_0x284545['username']||'';this[_0x7242('0x2')]=_0x284545['token']||'';this[_0x7242('0x3')]=_0x284545[_0x7242('0x3')]||'';this[_0x7242('0x4')]=_0x284545['serverUrl']||'';this[_0x7242('0x5')]=_0x284545['Configurations']||{};}module[_0x7242('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index df1e07f..0824345 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 _0x2713=['calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum'];(function(_0x10dcc4,_0x53e31b){var _0x2930bb=function(_0x113d5d){while(--_0x113d5d){_0x10dcc4['push'](_0x10dcc4['shift']());}};_0x2930bb(++_0x53e31b);}(_0x2713,0x8e));var _0x3271=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2713[_0x502c7d];return _0x30b7ed;};'use strict';function QueueReport(){this[_0x3271('0x0')]='inbound';this[_0x3271('0x1')]='';this[_0x3271('0x2')]='';this[_0x3271('0x3')]='';this[_0x3271('0x4')]='';this[_0x3271('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x3271('0x6')]=0x1;this[_0x3271('0x7')]=0x1;this[_0x3271('0x8')]=![];this[_0x3271('0x9')]=null;this[_0x3271('0xa')]=![];this[_0x3271('0xb')]=null;this[_0x3271('0xc')]=![];this[_0x3271('0xd')]=null;this[_0x3271('0xe')]=0x1;this['channel']='';this[_0x3271('0xf')]='';this[_0x3271('0x10')]='';this[_0x3271('0x11')]='';this[_0x3271('0x12')]='';this[_0x3271('0x13')]='';this[_0x3271('0x14')]='';this[_0x3271('0x15')]=0x0;this[_0x3271('0x16')]=![];this[_0x3271('0x17')]='';this[_0x3271('0x18')]=_0x3271('0x19');this[_0x3271('0x1a')]=0x0;this[_0x3271('0x1b')]={};}module[_0x3271('0x1c')]=QueueReport; \ No newline at end of file +var _0x2b84=['queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','exports','type','inbound','uniqueid','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercompleteAt'];(function(_0x3df3c6,_0x496e1a){var _0x254c43=function(_0x371daa){while(--_0x371daa){_0x3df3c6['push'](_0x3df3c6['shift']());}};_0x254c43(++_0x496e1a);}(_0x2b84,0xbe));var _0x42b8=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x2b84[_0x2763f2];return _0x3ef471;};'use strict';function QueueReport(){this[_0x42b8('0x0')]=_0x42b8('0x1');this[_0x42b8('0x2')]='';this['calleridnum']='';this['calleridname']='';this['queue']='';this[_0x42b8('0x3')]=null;this['queuecallerleaveAt']=null;this[_0x42b8('0x4')]=0x1;this[_0x42b8('0x5')]=0x1;this[_0x42b8('0x6')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x42b8('0x7')]=null;this[_0x42b8('0x8')]=![];this[_0x42b8('0x9')]=null;this['originalposition']=0x1;this[_0x42b8('0xa')]='';this[_0x42b8('0xb')]='';this[_0x42b8('0xc')]='';this['accountcode']='';this[_0x42b8('0xd')]='';this[_0x42b8('0xe')]='';this[_0x42b8('0xf')]='';this[_0x42b8('0x10')]=0x0;this[_0x42b8('0x11')]=![];this[_0x42b8('0x12')]='';this[_0x42b8('0x13')]=_0x42b8('0x14');this['mohtime']=0x0;this['variables']={};}module[_0x42b8('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bbbcd09..1d62a07 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 _0x5c96=['username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x4e1919,_0x526280){var _0x5e61da=function(_0x236807){while(--_0x236807){_0x4e1919['push'](_0x4e1919['shift']());}};_0x5e61da(++_0x526280);}(_0x5c96,0x133));var _0x65c9=function(_0x252b48,_0x2750d4){_0x252b48=_0x252b48-0x0;var _0x4897b1=_0x5c96[_0x252b48];return _0x4897b1;};'use strict';function SalesforceAccount(_0x1e81e3){this['id']=_0x1e81e3['id']||0x0;this[_0x65c9('0x0')]=_0x1e81e3[_0x65c9('0x0')]||'';this[_0x65c9('0x1')]=_0x1e81e3['username']||'';this[_0x65c9('0x2')]=_0x1e81e3[_0x65c9('0x2')]||'';this[_0x65c9('0x3')]=_0x1e81e3[_0x65c9('0x3')]||'';this[_0x65c9('0x4')]=_0x1e81e3[_0x65c9('0x4')]||'';this[_0x65c9('0x5')]=_0x1e81e3['clientSecret']||'';this['securityToken']=_0x1e81e3['securityToken']||'';this['type']=_0x1e81e3[_0x65c9('0x6')]||_0x65c9('0x7');this[_0x65c9('0x8')]=_0x1e81e3['serverUrl']||'';this[_0x65c9('0x9')]=_0x1e81e3[_0x65c9('0x9')]||{};}module[_0x65c9('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x1902=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','name'];(function(_0x44e3ad,_0x28f252){var _0x2db038=function(_0x23b331){while(--_0x23b331){_0x44e3ad['push'](_0x44e3ad['shift']());}};_0x2db038(++_0x28f252);}(_0x1902,0x83));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';function SalesforceAccount(_0x1042cc){this['id']=_0x1042cc['id']||0x0;this[_0x2190('0x0')]=_0x1042cc['name']||'';this[_0x2190('0x1')]=_0x1042cc[_0x2190('0x1')]||'';this[_0x2190('0x2')]=_0x1042cc[_0x2190('0x2')]||'';this[_0x2190('0x3')]=_0x1042cc[_0x2190('0x3')]||'';this[_0x2190('0x4')]=_0x1042cc['clientId']||'';this[_0x2190('0x5')]=_0x1042cc[_0x2190('0x5')]||'';this[_0x2190('0x6')]=_0x1042cc[_0x2190('0x6')]||'';this[_0x2190('0x7')]=_0x1042cc['type']||_0x2190('0x8');this[_0x2190('0x9')]=_0x1042cc[_0x2190('0x9')]||'';this['Configurations']=_0x1042cc['Configurations']||{};}module[_0x2190('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 2004f7c..03aefc2 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 _0xf753=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x4a4ba4,_0x31331c){var _0x218c4e=function(_0x37dbba){while(--_0x37dbba){_0x4a4ba4['push'](_0x4a4ba4['shift']());}};_0x218c4e(++_0x31331c);}(_0xf753,0x1ad));var _0x3f75=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0xf753[_0x52c4e9];return _0x252a03;};'use strict';function ServicenowAccount(_0x54e911){this['id']=_0x54e911['id']||0x0;this[_0x3f75('0x0')]=_0x54e911[_0x3f75('0x0')]||'';this[_0x3f75('0x1')]=_0x54e911[_0x3f75('0x1')]||'';this[_0x3f75('0x2')]=_0x54e911[_0x3f75('0x2')]||'';this[_0x3f75('0x3')]=_0x54e911['remoteUri']||'';this[_0x3f75('0x4')]=_0x54e911[_0x3f75('0x4')]||'';this[_0x3f75('0x5')]=_0x54e911[_0x3f75('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x86bd=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x86bd,0xaa));var _0xd86b=function(_0x15fc3a,_0x5d83f4){_0x15fc3a=_0x15fc3a-0x0;var _0x34f2b4=_0x86bd[_0x15fc3a];return _0x34f2b4;};'use strict';function ServicenowAccount(_0x44190a){this['id']=_0x44190a['id']||0x0;this[_0xd86b('0x0')]=_0x44190a[_0xd86b('0x0')]||'';this[_0xd86b('0x1')]=_0x44190a[_0xd86b('0x1')]||'';this[_0xd86b('0x2')]=_0x44190a[_0xd86b('0x2')]||'';this[_0xd86b('0x3')]=_0x44190a[_0xd86b('0x3')]||'';this[_0xd86b('0x4')]=_0x44190a[_0xd86b('0x4')]||'';this[_0xd86b('0x5')]=_0x44190a[_0xd86b('0x5')]||{};}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 5b07bed..dca77f4 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 _0x63b2=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x63b2,0x9a));var _0x263b=function(_0x2e55a4,_0x5ab256){_0x2e55a4=_0x2e55a4-0x0;var _0xdec6ce=_0x63b2[_0x2e55a4];return _0xdec6ce;};'use strict';function SugarcrmAccount(_0x3fc743){this['id']=_0x3fc743['id']||0x0;this[_0x263b('0x0')]=_0x3fc743['name']||'';this[_0x263b('0x1')]=_0x3fc743[_0x263b('0x1')]||'';this[_0x263b('0x2')]=_0x3fc743[_0x263b('0x2')]||'';this[_0x263b('0x3')]=_0x3fc743[_0x263b('0x3')]||'';this[_0x263b('0x4')]=_0x3fc743[_0x263b('0x4')]||'';this[_0x263b('0x5')]=_0x3fc743[_0x263b('0x5')]||{};}module[_0x263b('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x4de0=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x429abb,_0xccaac8){var _0x301ca4=function(_0xfaa0dd){while(--_0xfaa0dd){_0x429abb['push'](_0x429abb['shift']());}};_0x301ca4(++_0xccaac8);}(_0x4de0,0x8e));var _0x04de=function(_0x4bdb5b,_0x5b1e61){_0x4bdb5b=_0x4bdb5b-0x0;var _0x745a0f=_0x4de0[_0x4bdb5b];return _0x745a0f;};'use strict';function SugarcrmAccount(_0x2549de){this['id']=_0x2549de['id']||0x0;this['name']=_0x2549de[_0x04de('0x0')]||'';this[_0x04de('0x1')]=_0x2549de[_0x04de('0x1')]||'';this[_0x04de('0x2')]=_0x2549de['password']||'';this['remoteUri']=_0x2549de[_0x04de('0x3')]||'';this[_0x04de('0x4')]=_0x2549de[_0x04de('0x4')]||'';this[_0x04de('0x5')]=_0x2549de[_0x04de('0x5')]||{};}module[_0x04de('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9cea534..b928689 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 _0xbfda=['exports','name','accountcode','state','unknown','stateTime'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xbfda,0x193));var _0xabfd=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0xbfda[_0x4e11e7];return _0x1d7d39;};'use strict';function Telephone(_0x2d95f9){this['id']=_0x2d95f9['id']||0x0;this[_0xabfd('0x0')]=_0x2d95f9[_0xabfd('0x0')]||'';this[_0xabfd('0x1')]=_0x2d95f9[_0xabfd('0x1')]||'';this[_0xabfd('0x2')]=_0xabfd('0x3');this[_0xabfd('0x4')]=0x0;this['status']=_0xabfd('0x3');this['address']='';}module[_0xabfd('0x5')]=Telephone; \ No newline at end of file +var _0x6b74=['name','accountcode','unknown','stateTime','status','exports'];(function(_0x5e1f0f,_0x45a0e7){var _0x99c34a=function(_0x66dbdb){while(--_0x66dbdb){_0x5e1f0f['push'](_0x5e1f0f['shift']());}};_0x99c34a(++_0x45a0e7);}(_0x6b74,0xcc));var _0x46b7=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0x6b74[_0x340756];return _0x2ef745;};'use strict';function Telephone(_0x24fbf7){this['id']=_0x24fbf7['id']||0x0;this[_0x46b7('0x0')]=_0x24fbf7['name']||'';this[_0x46b7('0x1')]=_0x24fbf7[_0x46b7('0x1')]||'';this['state']=_0x46b7('0x2');this[_0x46b7('0x3')]=0x0;this[_0x46b7('0x4')]='unknown';this['address']='';}module[_0x46b7('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3195879..144ff48 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x348d7d,_0x396e1e){var _0x1dcc94=function(_0x1e143d){while(--_0x1e143d){_0x348d7d['push'](_0x348d7d['shift']());}};_0x1dcc94(++_0x396e1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1c6d5c,_0x225e50){var _0x53ad10=function(_0x32088d){while(--_0x32088d){_0x1c6d5c['push'](_0x1c6d5c['shift']());}};_0x53ad10(++_0x225e50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 bf227a1..a5a955c 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3bd7c1,_0x158e62){var _0x487f3f=function(_0x4d626f){while(--_0x4d626f){_0x3bd7c1['push'](_0x3bd7c1['shift']());}};_0x487f3f(++_0x158e62);}(_0x8603,0x190));var _0x3860=function(_0xe31fc4,_0x2939c4){_0xe31fc4=_0xe31fc4-0x0;var _0x3a975c=_0x8603[_0xe31fc4];return _0x3a975c;};'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 da8c336..16d45da 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 _0x0a2d=['status','registry','split','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','stateTime'];(function(_0x2b93c8,_0x1350df){var _0x111369=function(_0x58019f){while(--_0x58019f){_0x2b93c8['push'](_0x2b93c8['shift']());}};_0x111369(++_0x1350df);}(_0x0a2d,0x160));var _0xd0a2=function(_0x384d6c,_0x187d57){_0x384d6c=_0x384d6c-0x0;var _0x589e61=_0x0a2d[_0x384d6c];return _0x589e61;};'use strict';function Trunk(_0x4d6a70){this['id']=_0x4d6a70['id']||0x0;this['active']=_0x4d6a70[_0xd0a2('0x0')]||![];this[_0xd0a2('0x1')]=_0x4d6a70[_0xd0a2('0x1')]||'';this[_0xd0a2('0x2')]=_0xd0a2('0x3');this[_0xd0a2('0x4')]=0x0;this[_0xd0a2('0x5')]=_0xd0a2('0x3');this[_0xd0a2('0x6')]=_0x4d6a70[_0xd0a2('0x6')]&&_0x4d6a70[_0xd0a2('0x6')]['indexOf'](':')?_0x4d6a70[_0xd0a2('0x6')][_0xd0a2('0x7')](':')[0x0]:'';this[_0xd0a2('0x8')]='';this[_0xd0a2('0x9')]='';this[_0xd0a2('0xa')]='';this[_0xd0a2('0xb')]='';this[_0xd0a2('0xc')]='';this[_0xd0a2('0xd')]=_0xd0a2('0x3');this['registrationtime']='';this[_0xd0a2('0xe')]='';this[_0xd0a2('0xf')]=_0x4d6a70['defaultuser']||'';}module[_0xd0a2('0x10')]=Trunk; \ No newline at end of file +var _0x1995=['defaultuser','exports','active','name','state','unknown','stateTime','status','registry','host','port','domainport','registrationtime'];(function(_0x15ad2e,_0x2c7d3c){var _0x51e0a2=function(_0x496c6a){while(--_0x496c6a){_0x15ad2e['push'](_0x15ad2e['shift']());}};_0x51e0a2(++_0x2c7d3c);}(_0x1995,0x154));var _0x5199=function(_0x39819f,_0x33e1d9){_0x39819f=_0x39819f-0x0;var _0x362eb3=_0x1995[_0x39819f];return _0x362eb3;};'use strict';function Trunk(_0x3e7eb5){this['id']=_0x3e7eb5['id']||0x0;this[_0x5199('0x0')]=_0x3e7eb5['active']||![];this['name']=_0x3e7eb5[_0x5199('0x1')]||'';this[_0x5199('0x2')]=_0x5199('0x3');this[_0x5199('0x4')]=0x0;this[_0x5199('0x5')]=_0x5199('0x3');this[_0x5199('0x6')]=_0x3e7eb5['registry']&&_0x3e7eb5[_0x5199('0x6')]['indexOf'](':')?_0x3e7eb5[_0x5199('0x6')]['split'](':')[0x0]:'';this[_0x5199('0x7')]='';this[_0x5199('0x8')]='';this['domain']='';this[_0x5199('0x9')]='';this['refresh']='';this['stateRegistry']=_0x5199('0x3');this[_0x5199('0xa')]='';this['address']='';this[_0x5199('0xb')]=_0x3e7eb5[_0x5199('0xb')]||'';}module[_0x5199('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4a29042..9205405 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 _0xdc5c=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x333189,_0x1378f1){var _0x4c1e6e=function(_0x1d78ff){while(--_0x1d78ff){_0x333189['push'](_0x333189['shift']());}};_0x4c1e6e(++_0x1378f1);}(_0xdc5c,0x1ab));var _0xcdc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5c[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x8defeb){this['id']=_0x8defeb['id']||0x0;this[_0xcdc5('0x0')]=_0x8defeb[_0xcdc5('0x0')]||'';this[_0xcdc5('0x1')]=_0x8defeb[_0xcdc5('0x1')]||_0xcdc5('0x2');this[_0xcdc5('0x3')]=_0x8defeb[_0xcdc5('0x3')]||![];}module[_0xcdc5('0x4')]=voiceExtension; \ No newline at end of file +var _0x5b81=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4a724f,_0x5b001a){var _0x35adab=function(_0x56298f){while(--_0x56298f){_0x4a724f['push'](_0x4a724f['shift']());}};_0x35adab(++_0x5b001a);}(_0x5b81,0x1de));var _0x15b8=function(_0x428a5f,_0x56c9cf){_0x428a5f=_0x428a5f-0x0;var _0x1a591b=_0x5b81[_0x428a5f];return _0x1a591b;};'use strict';function voiceExtension(_0x1f6acd){this['id']=_0x1f6acd['id']||0x0;this[_0x15b8('0x0')]=_0x1f6acd[_0x15b8('0x0')]||'';this['recordingFormat']=_0x1f6acd[_0x15b8('0x1')]||'none';this[_0x15b8('0x2')]=_0x1f6acd[_0x15b8('0x2')]||![];}module[_0x15b8('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5c1813b..8bae6a0 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 _0xff01=['dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xff01,0xc3));var _0x1ff0=function(_0x185674,_0x49d583){_0x185674=_0x185674-0x0;var _0x4d46a0=_0xff01[_0x185674];return _0x4d46a0;};'use strict';var statusDesc=['unknown',_0x1ff0('0x0'),_0x1ff0('0x1'),_0x1ff0('0x2'),_0x1ff0('0x3'),_0x1ff0('0x4'),_0x1ff0('0x5'),_0x1ff0('0x6'),_0x1ff0('0x7')];var monitorFormat={'wav':_0x1ff0('0x8'),'wav49':'wav49','gsm':_0x1ff0('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x1ff0('0xa')};function VoiceQueue(_0x4611b1){this['id']=_0x4611b1['id']||0x0;this[_0x1ff0('0xb')]=_0x4611b1[_0x1ff0('0xb')]||'';this[_0x1ff0('0xc')]=_0x4611b1[_0x1ff0('0xc')]||'';this['type']=_0x4611b1[_0x1ff0('0xd')]||_0x1ff0('0xe');this[_0x1ff0('0xf')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0x1ff0('0x10')]=0x0;this[_0x1ff0('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x1ff0('0x12')]=0x0;this[_0x1ff0('0x13')]=0x0;this[_0x1ff0('0x14')]=0x0;this[_0x1ff0('0x15')]=0x0;this[_0x1ff0('0x16')]=0x0;this[_0x1ff0('0x17')]=_0x4611b1['acw']||![];this['acwTimeout']=_0x4611b1['acwTimeout']||0xa;this['autopause']=_0x4611b1[_0x1ff0('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x1ff0('0x19')]='';this['originated']=0x0;this[_0x1ff0('0x1a')]=0x0;this['dialTimezone']=_0x4611b1[_0x1ff0('0x1b')]||null;this[_0x1ff0('0x1c')]=_0x4611b1[_0x1ff0('0x1c')]?_0x4611b1[_0x1ff0('0x1c')]:null;this[_0x1ff0('0x1d')]=_0x4611b1['dialActive'];this['dialMethod']=_0x4611b1[_0x1ff0('0x1e')]||'progressive';this['dialLimitChannel']=_0x4611b1['dialLimitChannel']||0x0;this[_0x1ff0('0x1f')]=_0x4611b1[_0x1ff0('0x1f')]||0x0;this[_0x1ff0('0x20')]=_0x4611b1[_0x1ff0('0x20')]||0x1;this[_0x1ff0('0x21')]=_0x4611b1[_0x1ff0('0x21')]||_0x1ff0('0x22');this[_0x1ff0('0x23')]=_0x4611b1[_0x1ff0('0x23')]||0.03;this[_0x1ff0('0x24')]=_0x4611b1[_0x1ff0('0x24')]||0x258;this[_0x1ff0('0x25')]=_0x4611b1[_0x1ff0('0x25')]||_0x1ff0('0x26');this['dialOriginateCallerIdNumber']=_0x4611b1[_0x1ff0('0x27')]||_0x1ff0('0x26');this[_0x1ff0('0x28')]=_0x4611b1['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4611b1[_0x1ff0('0x29')]||_0x1ff0('0x2a');this['dialQueueTimeout']=_0x4611b1['dialQueueTimeout']||0x3;this[_0x1ff0('0x2b')]=_0x4611b1['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x4611b1['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x4611b1['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x4611b1[_0x1ff0('0x2c')]||0x3;this[_0x1ff0('0x2d')]=_0x4611b1[_0x1ff0('0x2d')]||0x96;this[_0x1ff0('0x2e')]=_0x4611b1['dialNoAnswerMaxRetry']||0x3;this[_0x1ff0('0x2f')]=_0x4611b1[_0x1ff0('0x2f')]||0x96;this[_0x1ff0('0x30')]=_0x4611b1[_0x1ff0('0x30')]||0x3;this[_0x1ff0('0x31')]=_0x4611b1[_0x1ff0('0x31')]||0x96;this[_0x1ff0('0x32')]=_0x4611b1[_0x1ff0('0x32')]||0x3;this[_0x1ff0('0x33')]=_0x4611b1[_0x1ff0('0x33')]||0x96;this[_0x1ff0('0x34')]=_0x4611b1['dialAbandonedMaxRetry']||0x3;this[_0x1ff0('0x35')]=_0x4611b1['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x4611b1['dialMachineMaxRetry']||0x3;this[_0x1ff0('0x36')]=_0x4611b1[_0x1ff0('0x36')]||0x96;this[_0x1ff0('0x37')]=_0x4611b1[_0x1ff0('0x37')]||0x3;this[_0x1ff0('0x38')]=_0x4611b1[_0x1ff0('0x38')]||0x96;this['dialGlobalMaxRetry']=_0x4611b1[_0x1ff0('0x39')]||0x4;this[_0x1ff0('0x3a')]=_0x4611b1[_0x1ff0('0x3a')]?_0x4611b1[_0x1ff0('0x3a')]:undefined;this[_0x1ff0('0x3b')]=_0x4611b1[_0x1ff0('0x3b')]?_0x4611b1['TrunkBackup']:undefined;this[_0x1ff0('0x3c')]=_0x4611b1[_0x1ff0('0x3c')]||undefined;this[_0x1ff0('0x3d')]=_0x4611b1['Interval']?_0x4611b1[_0x1ff0('0x3d')]:undefined;this[_0x1ff0('0x3e')]=_0x4611b1[_0x1ff0('0x3e')]||_0x1ff0('0x3f');this[_0x1ff0('0x40')]=_0x4611b1['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1ff0('0x41')]=_0x4611b1[_0x1ff0('0x41')]||undefined;this[_0x1ff0('0x42')]=strategy[_0x4611b1[_0x1ff0('0x42')]]||_0x1ff0('0x43');this['queueStatusComplete']=!![];this[_0x1ff0('0x44')]=_0x4611b1[_0x1ff0('0x44')]||![];this[_0x1ff0('0x45')]=_0x4611b1['dialAMDInitialSilence'];this[_0x1ff0('0x46')]=_0x4611b1[_0x1ff0('0x46')];this[_0x1ff0('0x47')]=_0x4611b1[_0x1ff0('0x47')];this[_0x1ff0('0x48')]=_0x4611b1['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x4611b1[_0x1ff0('0x49')];this[_0x1ff0('0x4a')]=_0x4611b1['dialAMDBetweenWordsSilence'];this[_0x1ff0('0x4b')]=_0x4611b1[_0x1ff0('0x4b')];this[_0x1ff0('0x4c')]=_0x4611b1['dialAMDSilenceThreshold'];this[_0x1ff0('0x4d')]=_0x4611b1['dialAMDMaximumWordLength'];this[_0x1ff0('0x4e')]=0x0;this['pTalking']=0x0;this['timeout']=_0x4611b1[_0x1ff0('0x4f')];this[_0x1ff0('0x50')]=0x0;this[_0x1ff0('0x51')]=0x0;this[_0x1ff0('0x52')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x1ff0('0x53')]=0x0;this[_0x1ff0('0x54')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x1ff0('0x55')]=0x0;this[_0x1ff0('0x56')]=0x0;this[_0x1ff0('0x57')]=0x0;this[_0x1ff0('0x58')]=0x0;this[_0x1ff0('0x59')]=0x0;this[_0x1ff0('0x5a')]=0x0;this[_0x1ff0('0x5b')]=0x0;this[_0x1ff0('0x5c')]=undefined;this[_0x1ff0('0x5d')]=undefined;this['handlePredictive']=undefined;this[_0x1ff0('0x5e')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x1ff0('0x5f')]=0x0;this[_0x1ff0('0x60')]=0x0;this[_0x1ff0('0x61')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x1ff0('0x62')]=0x0;this[_0x1ff0('0x63')]=0x0;this[_0x1ff0('0x64')]=_0x4611b1[_0x1ff0('0x65')]||0x14;this['predictiveIntervalMinThreshold']=_0x4611b1['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x1ff0('0x66')]=0x0;this[_0x1ff0('0x67')]=0x0;this[_0x1ff0('0x68')]=0x1;this['erlangCalls']=0x0;this[_0x1ff0('0x69')]=0x0;this[_0x1ff0('0x6a')]=0x0;this[_0x1ff0('0x6b')]=0x0;this[_0x1ff0('0x6c')]=_0x4611b1[_0x1ff0('0x6c')]||0x1e;this['dialRecallInQueue']=_0x4611b1[_0x1ff0('0x6d')]||![];this[_0x1ff0('0x6e')]=!!_0x4611b1[_0x1ff0('0x6e')]||![];this['dialPreviewRecallmeReminder']=!!_0x4611b1['dialPreviewRecallmeReminder']||![];this[_0x1ff0('0x6f')]=_0x4611b1[_0x1ff0('0x6f')]||undefined;this[_0x1ff0('0x70')]=_0x4611b1[_0x1ff0('0x70')]||![];this['dialAgiAfterHangupAgent']=_0x4611b1['dialAgiAfterHangupAgent']||![];this[_0x1ff0('0xc')]=monitorFormat[_0x4611b1['monitor_format']]?monitorFormat[_0x4611b1[_0x1ff0('0xc')]]:undefined;this[_0x1ff0('0x71')]=_0x4611b1['mandatoryDisposition']||![];this[_0x1ff0('0x72')]=_0x4611b1[_0x1ff0('0x72')]?_0x4611b1['mandatoryDispositionPause']:undefined;}module[_0x1ff0('0x73')]=VoiceQueue; \ No newline at end of file +var _0x0949=['outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','ringing','ringinuse','onhold','wav','wav49','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x3c8499,_0x1e052e){var _0x51d346=function(_0x311729){while(--_0x311729){_0x3c8499['push'](_0x3c8499['shift']());}};_0x51d346(++_0x1e052e);}(_0x0949,0xa3));var _0x9094=function(_0x1d98a3,_0x28e1b8){_0x1d98a3=_0x1d98a3-0x0;var _0x4b8246=_0x0949[_0x1d98a3];return _0x4b8246;};'use strict';var statusDesc=['unknown','not_inuse',_0x9094('0x0'),'busy','invalid','unavailable',_0x9094('0x1'),_0x9094('0x2'),_0x9094('0x3')];var monitorFormat={'wav':_0x9094('0x4'),'wav49':_0x9094('0x5'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x3730cc){this['id']=_0x3730cc['id']||0x0;this['name']=_0x3730cc[_0x9094('0x6')]||'';this[_0x9094('0x7')]=_0x3730cc['monitor_format']||'';this[_0x9094('0x8')]=_0x3730cc[_0x9094('0x8')]||_0x9094('0x9');this['waiting']=0x0;this[_0x9094('0xa')]=0x0;this[_0x9094('0xb')]=0x0;this[_0x9094('0xc')]=0x0;this[_0x9094('0xd')]=0x0;this[_0x9094('0xe')]=0x0;this['sumBillable']=0x0;this[_0x9094('0xf')]=0x0;this[_0x9094('0x10')]=0x0;this[_0x9094('0x11')]=0x0;this[_0x9094('0x12')]=0x0;this[_0x9094('0x13')]=_0x3730cc[_0x9094('0x13')]||![];this[_0x9094('0x14')]=_0x3730cc[_0x9094('0x14')]||0xa;this['autopause']=_0x3730cc['autopause']||'no';this[_0x9094('0x15')]=!![];this[_0x9094('0x16')]='';this[_0x9094('0x17')]=0x0;this[_0x9094('0x18')]=0x0;this[_0x9094('0x19')]=_0x3730cc[_0x9094('0x19')]||null;this[_0x9094('0x1a')]=_0x3730cc[_0x9094('0x1a')]?_0x3730cc[_0x9094('0x1a')]:null;this[_0x9094('0x1b')]=_0x3730cc[_0x9094('0x1b')];this['dialMethod']=_0x3730cc[_0x9094('0x1c')]||_0x9094('0x1d');this[_0x9094('0x1e')]=_0x3730cc[_0x9094('0x1e')]||0x0;this[_0x9094('0x1f')]=_0x3730cc['dialLimitQueue']||0x0;this[_0x9094('0x20')]=_0x3730cc[_0x9094('0x20')]||0x1;this[_0x9094('0x21')]=_0x3730cc['dialPredictiveOptimization']||_0x9094('0x22');this[_0x9094('0x23')]=_0x3730cc[_0x9094('0x23')]||0.03;this[_0x9094('0x24')]=_0x3730cc[_0x9094('0x24')]||0x258;this[_0x9094('0x25')]=_0x3730cc[_0x9094('0x25')]||_0x9094('0x26');this[_0x9094('0x27')]=_0x3730cc[_0x9094('0x27')]||_0x9094('0x26');this['dialOriginateTimeout']=_0x3730cc[_0x9094('0x28')]||0x1e;this[_0x9094('0x29')]=_0x3730cc[_0x9094('0x29')]||_0x9094('0x2a');this[_0x9094('0x2b')]=_0x3730cc[_0x9094('0x2b')]||0x3;this[_0x9094('0x2c')]=_0x3730cc['dialQueueProject']||undefined;this[_0x9094('0x2d')]=_0x3730cc['dialCongestionMaxRetry']||0x3;this[_0x9094('0x2e')]=_0x3730cc[_0x9094('0x2e')]||0x96;this[_0x9094('0x2f')]=_0x3730cc[_0x9094('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x3730cc[_0x9094('0x30')]||0x96;this[_0x9094('0x31')]=_0x3730cc[_0x9094('0x31')]||0x3;this[_0x9094('0x32')]=_0x3730cc['dialNoAnswerRetryFrequency']||0x96;this[_0x9094('0x33')]=_0x3730cc[_0x9094('0x33')]||0x3;this[_0x9094('0x34')]=_0x3730cc[_0x9094('0x34')]||0x96;this[_0x9094('0x35')]=_0x3730cc[_0x9094('0x35')]||0x3;this[_0x9094('0x36')]=_0x3730cc[_0x9094('0x36')]||0x96;this[_0x9094('0x37')]=_0x3730cc['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x3730cc[_0x9094('0x38')]||0x96;this[_0x9094('0x39')]=_0x3730cc[_0x9094('0x39')]||0x3;this[_0x9094('0x3a')]=_0x3730cc['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x3730cc['dialAgentRejectMaxRetry']||0x3;this[_0x9094('0x3b')]=_0x3730cc[_0x9094('0x3b')]||0x96;this['dialGlobalMaxRetry']=_0x3730cc[_0x9094('0x3c')]||0x4;this[_0x9094('0x3d')]=_0x3730cc[_0x9094('0x3d')]?_0x3730cc[_0x9094('0x3d')]:undefined;this[_0x9094('0x3e')]=_0x3730cc[_0x9094('0x3e')]?_0x3730cc['TrunkBackup']:undefined;this[_0x9094('0x3f')]=_0x3730cc[_0x9094('0x3f')]||undefined;this[_0x9094('0x40')]=_0x3730cc[_0x9094('0x40')]?_0x3730cc['Interval']:undefined;this[_0x9094('0x41')]=_0x3730cc[_0x9094('0x41')]||_0x9094('0x42');this[_0x9094('0x43')]=_0x3730cc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9094('0x44')]=_0x3730cc[_0x9094('0x44')]||undefined;this[_0x9094('0x45')]=strategy[_0x3730cc['strategy']]||_0x9094('0x46');this[_0x9094('0x47')]=!![];this[_0x9094('0x48')]=_0x3730cc[_0x9094('0x48')]||![];this['dialAMDInitialSilence']=_0x3730cc['dialAMDInitialSilence'];this[_0x9094('0x49')]=_0x3730cc[_0x9094('0x49')];this[_0x9094('0x4a')]=_0x3730cc[_0x9094('0x4a')];this[_0x9094('0x4b')]=_0x3730cc[_0x9094('0x4b')];this['dialAMDMinWordLength']=_0x3730cc[_0x9094('0x4c')];this[_0x9094('0x4d')]=_0x3730cc['dialAMDBetweenWordsSilence'];this[_0x9094('0x4e')]=_0x3730cc[_0x9094('0x4e')];this['dialAMDSilenceThreshold']=_0x3730cc[_0x9094('0x4f')];this[_0x9094('0x50')]=_0x3730cc[_0x9094('0x50')];this[_0x9094('0x51')]=0x0;this[_0x9094('0x52')]=0x0;this[_0x9094('0x53')]=_0x3730cc[_0x9094('0x53')];this[_0x9094('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9094('0x55')]=0x0;this[_0x9094('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9094('0x57')]=0x0;this[_0x9094('0x58')]=0x0;this[_0x9094('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x9094('0x5a')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9094('0x5b')]=0x0;this[_0x9094('0x5c')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x9094('0x5d')]=undefined;this[_0x9094('0x5e')]=undefined;this[_0x9094('0x5f')]=undefined;this[_0x9094('0x60')]=1.05;this[_0x9094('0x61')]=0x0;this[_0x9094('0x62')]=0x0;this[_0x9094('0x63')]=0x0;this[_0x9094('0x64')]=0x0;this[_0x9094('0x65')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x9094('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x9094('0x67')]=_0x3730cc[_0x9094('0x68')]||0x14;this[_0x9094('0x69')]=_0x3730cc[_0x9094('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x9094('0x6a')]=0x0;this[_0x9094('0x6b')]=0x1;this[_0x9094('0x6c')]=0x0;this[_0x9094('0x6d')]=0x0;this[_0x9094('0x6e')]=0x0;this[_0x9094('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x3730cc[_0x9094('0x70')]||0x1e;this['dialRecallInQueue']=_0x3730cc[_0x9094('0x71')]||![];this[_0x9094('0x72')]=!!_0x3730cc[_0x9094('0x72')]||![];this['dialPreviewRecallmeReminder']=!!_0x3730cc[_0x9094('0x73')]||![];this[_0x9094('0x74')]=_0x3730cc[_0x9094('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x3730cc[_0x9094('0x75')]||![];this[_0x9094('0x76')]=_0x3730cc[_0x9094('0x76')]||![];this[_0x9094('0x7')]=monitorFormat[_0x3730cc[_0x9094('0x7')]]?monitorFormat[_0x3730cc[_0x9094('0x7')]]:undefined;this[_0x9094('0x77')]=_0x3730cc[_0x9094('0x77')]||![];this[_0x9094('0x78')]=_0x3730cc[_0x9094('0x78')]?_0x3730cc[_0x9094('0x78')]:undefined;}module[_0x9094('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f25f680..6681ad1 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 _0xc163=['accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x835ad7,_0x42d2be){var _0x5f5822=function(_0x3a0623){while(--_0x3a0623){_0x835ad7['push'](_0x835ad7['shift']());}};_0x5f5822(++_0x42d2be);}(_0xc163,0xa1));var _0x3c16=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc163[_0x122ef9];return _0x42fba0;};'use strict';function VtigerAccount(_0x5cd2cc){this['id']=_0x5cd2cc['id']||0x0;this[_0x3c16('0x0')]=_0x5cd2cc[_0x3c16('0x0')]||'';this['username']=_0x5cd2cc['username']||'';this['accessKey']=_0x5cd2cc[_0x3c16('0x1')]||'';this[_0x3c16('0x2')]=_0x5cd2cc['remoteUri']||'';this[_0x3c16('0x3')]=_0x5cd2cc[_0x3c16('0x3')]||'';this[_0x3c16('0x4')]=_0x5cd2cc[_0x3c16('0x4')]||{};}module[_0x3c16('0x5')]=VtigerAccount; \ No newline at end of file +var _0xf156=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x38a660,_0x3a6593){var _0x5a601c=function(_0x2190a8){while(--_0x2190a8){_0x38a660['push'](_0x38a660['shift']());}};_0x5a601c(++_0x3a6593);}(_0xf156,0x137));var _0x6f15=function(_0x32808f,_0x248954){_0x32808f=_0x32808f-0x0;var _0x158091=_0xf156[_0x32808f];return _0x158091;};'use strict';function VtigerAccount(_0x48eacf){this['id']=_0x48eacf['id']||0x0;this[_0x6f15('0x0')]=_0x48eacf[_0x6f15('0x0')]||'';this['username']=_0x48eacf[_0x6f15('0x1')]||'';this['accessKey']=_0x48eacf[_0x6f15('0x2')]||'';this[_0x6f15('0x3')]=_0x48eacf[_0x6f15('0x3')]||'';this[_0x6f15('0x4')]=_0x48eacf[_0x6f15('0x4')]||'';this[_0x6f15('0x5')]=_0x48eacf['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6e3e31a..e054784 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 _0x5962=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x5962,0xd8));var _0x2596=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x5962[_0x59eacf];return _0x5d74f2;};'use strict';function ZendeskAccount(_0x3bdd36){this['id']=_0x3bdd36['id']||0x0;this[_0x2596('0x0')]=_0x3bdd36[_0x2596('0x0')]||'';this['username']=_0x3bdd36[_0x2596('0x1')]||'';this[_0x2596('0x2')]=_0x3bdd36[_0x2596('0x2')]||'';this['token']=_0x3bdd36[_0x2596('0x3')]||'';this[_0x2596('0x4')]=_0x3bdd36[_0x2596('0x4')]||'';this[_0x2596('0x5')]=_0x3bdd36[_0x2596('0x5')]||'';this[_0x2596('0x6')]=_0x3bdd36[_0x2596('0x6')]||_0x2596('0x7');this[_0x2596('0x8')]=_0x3bdd36[_0x2596('0x8')]||'';this[_0x2596('0x9')]=_0x3bdd36[_0x2596('0x9')]||{};}module[_0x2596('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xec12=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xec12,0x13f));var _0x2ec1=function(_0x16cf52,_0xb9d255){_0x16cf52=_0x16cf52-0x0;var _0x343e1a=_0xec12[_0x16cf52];return _0x343e1a;};'use strict';function ZendeskAccount(_0x4b1cef){this['id']=_0x4b1cef['id']||0x0;this['name']=_0x4b1cef[_0x2ec1('0x0')]||'';this[_0x2ec1('0x1')]=_0x4b1cef[_0x2ec1('0x1')]||'';this[_0x2ec1('0x2')]=_0x4b1cef['password']||'';this[_0x2ec1('0x3')]=_0x4b1cef['token']||'';this[_0x2ec1('0x4')]=_0x4b1cef[_0x2ec1('0x4')]||'';this['authType']=_0x4b1cef[_0x2ec1('0x5')]||'';this[_0x2ec1('0x6')]=_0x4b1cef[_0x2ec1('0x6')]||_0x2ec1('0x7');this[_0x2ec1('0x8')]=_0x4b1cef[_0x2ec1('0x8')]||'';this[_0x2ec1('0x9')]=_0x4b1cef[_0x2ec1('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 f7017d5..3c04e5a 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 _0x0b75=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x5f4ee1,_0x2538fa){var _0x3f01ed=function(_0x341901){while(--_0x341901){_0x5f4ee1['push'](_0x5f4ee1['shift']());}};_0x3f01ed(++_0x2538fa);}(_0x0b75,0x1d0));var _0x50b7=function(_0x3d7437,_0x4c280f){_0x3d7437=_0x3d7437-0x0;var _0x4b9dbb=_0x0b75[_0x3d7437];return _0x4b9dbb;};'use strict';function ZohoAccount(_0x344fef){this['id']=_0x344fef['id']||0x0;this[_0x50b7('0x0')]=_0x344fef[_0x50b7('0x0')]||'';this['description']=_0x344fef[_0x50b7('0x1')]||'';this[_0x50b7('0x2')]=_0x344fef['host']||'';this[_0x50b7('0x3')]=_0x344fef[_0x50b7('0x3')]||'';this[_0x50b7('0x4')]=_0x344fef[_0x50b7('0x4')]||'';this[_0x50b7('0x5')]=_0x344fef['clientSecret']||'';this[_0x50b7('0x6')]=_0x344fef[_0x50b7('0x6')]||'';this[_0x50b7('0x7')]=_0x344fef[_0x50b7('0x7')]||'';this[_0x50b7('0x8')]=_0x344fef[_0x50b7('0x8')]||'';this[_0x50b7('0x9')]=_0x344fef[_0x50b7('0x9')]||{};}module[_0x50b7('0xa')]=ZohoAccount; \ No newline at end of file +var _0x8f26=['refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f26,0x7b));var _0x68f2=function(_0x1aa910,_0x27f9fa){_0x1aa910=_0x1aa910-0x0;var _0x1518bb=_0x8f26[_0x1aa910];return _0x1518bb;};'use strict';function ZohoAccount(_0x4cf846){this['id']=_0x4cf846['id']||0x0;this[_0x68f2('0x0')]=_0x4cf846[_0x68f2('0x0')]||'';this['description']=_0x4cf846[_0x68f2('0x1')]||'';this[_0x68f2('0x2')]=_0x4cf846[_0x68f2('0x2')]||'';this[_0x68f2('0x3')]=_0x4cf846[_0x68f2('0x3')]||'';this[_0x68f2('0x4')]=_0x4cf846[_0x68f2('0x4')]||'';this['clientSecret']=_0x4cf846['clientSecret']||'';this[_0x68f2('0x5')]=_0x4cf846['serverUrl']||'';this[_0x68f2('0x6')]=_0x4cf846[_0x68f2('0x6')]||'';this[_0x68f2('0x7')]=_0x4cf846[_0x68f2('0x7')]||'';this[_0x68f2('0x8')]=_0x4cf846['Configurations']||{};}module[_0x68f2('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c1f8c31..2bcef99 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 _0x02df=['lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','moment','string','isNil','uniqueid','idContact','queue','dialAnswer','membername','Agent','name','channelAgent','calleridname','Contact','phone','firstName'];(function(_0xc1976e,_0x288cc3){var _0x458608=function(_0x4f4010){while(--_0x4f4010){_0xc1976e['push'](_0xc1976e['shift']());}};_0x458608(++_0x288cc3);}(_0x02df,0x1d5));var _0xf02d=function(_0x453389,_0x3a0ba9){_0x453389=_0x453389-0x0;var _0x13262e=_0x02df[_0x453389];return _0x13262e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf02d('0x0'));function checkNameSurname(_0x419a98,_0x3263a7,_0x19c72a){var _0x3171aa='';if(!_['isNil'](_0x3263a7)&&_0xf02d('0x1')===typeof _0x3263a7){_0x3171aa+=_0x3263a7;}if(!_[_0xf02d('0x2')](_0x19c72a)&&'string'===typeof _0x19c72a){_0x3171aa+='\x20'+_0x19c72a;}if(_0x3171aa!==''){return _0x3171aa;}return _0x419a98;}function Action(_0x5e91b6,_0x59dc0d,_0x1b522c,_0xf17c77,_0x146adc){this[_0xf02d('0x3')]=_0x1b522c||undefined;this[_0xf02d('0x4')]=_0x5e91b6['id'];this['queue']=_0x59dc0d['name'];this['type']=_0x59dc0d['type'];this['campaigntype']=_0xf02d('0x5');this[_0xf02d('0x6')]=![];this[_0xf02d('0x7')]=_[_0xf02d('0x2')](_0x5e91b6[_0xf02d('0x8')])?undefined:_0x5e91b6[_0xf02d('0x8')][_0xf02d('0x9')];this[_0xf02d('0xa')]=this['membername']?util['format']('SIP/%s',this[_0xf02d('0x7')]):_0xf17c77||undefined;this[_0xf02d('0xb')]=checkNameSurname(_0x5e91b6[_0xf02d('0xc')][_0xf02d('0xd')],_0x5e91b6[_0xf02d('0xc')][_0xf02d('0xe')],_0x5e91b6[_0xf02d('0xc')][_0xf02d('0xf')]);this[_0xf02d('0x10')]=_0x5e91b6[_0xf02d('0x10')]||![];this[_0xf02d('0x11')]=_0x5e91b6[_0xf02d('0xc')][_0xf02d('0xd')];this[_0xf02d('0x12')]=_0x5e91b6[_0xf02d('0x12')];this[_0xf02d('0x13')]=_0x5e91b6[_0xf02d('0x13')]||0x0;this['countcongestionretry']=_0x5e91b6[_0xf02d('0x14')]||0x0;this[_0xf02d('0x15')]=_0x5e91b6[_0xf02d('0x15')]||0x0;this[_0xf02d('0x16')]=(_0x5e91b6['countbusyretry']||0x0)+(_0x5e91b6[_0xf02d('0x14')]||0x0)+(_0x5e91b6['countnoanswerretry']||0x0)+(_0x5e91b6[_0xf02d('0x17')]||0x0)+(_0x5e91b6[_0xf02d('0x18')]||0x0)+(_0x5e91b6[_0xf02d('0x19')]||0x0)+(_0x5e91b6[_0xf02d('0x1a')]||0x0)+(_0x5e91b6[_0xf02d('0x1b')]||0x0);this['countnosuchnumberretry']=_0x5e91b6['countnosuchnumberretry']||0x0;this[_0xf02d('0x18')]=_0x5e91b6[_0xf02d('0x18')]||0x0;this['countabandonedretry']=_0x5e91b6[_0xf02d('0x19')]||0x0;this[_0xf02d('0x1a')]=_0x5e91b6[_0xf02d('0x1a')]||0x0;this[_0xf02d('0x1b')]=_0x5e91b6[_0xf02d('0x1b')]||0x0;this[_0xf02d('0x1c')]=_0x5e91b6['callback'];this[_0xf02d('0x1d')]=_0x5e91b6[_0xf02d('0x1d')];this[_0xf02d('0x1e')]=_0x5e91b6[_0xf02d('0x1e')];this['recallme']=_0x5e91b6[_0xf02d('0x1f')];this['ContactId']=_0x5e91b6[_0xf02d('0x20')];this[_0xf02d('0x21')]=_0x5e91b6[_0xf02d('0x21')];this[_0xf02d('0x22')]=_[_0xf02d('0x2')](_0x5e91b6[_0xf02d('0x8')])?_0x5e91b6[_0xf02d('0x22')]:_0x5e91b6[_0xf02d('0x8')]['id'];this[_0xf02d('0x23')]=_0x5e91b6[_0xf02d('0x23')];this[_0xf02d('0x24')]='';this[_0xf02d('0x25')]='';}Action[_0xf02d('0x26')][_0xf02d('0x27')]=function(){return util[_0xf02d('0x28')](_0xf02d('0x29'),this['calleridname'],this[_0xf02d('0x2a')]);};module[_0xf02d('0x2b')]=Action; \ No newline at end of file +var _0xee4b=['scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','format','calleridname','phone','Contact','firstName','lastName','calleridnum'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xee4b,0x177));var _0xbee4=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0xee4b[_0x1857c6];return _0x51011c;};'use strict';var util=require(_0xbee4('0x0'));var _=require(_0xbee4('0x1'));var moment=require(_0xbee4('0x2'));function checkNameSurname(_0x426a03,_0x1ce324,_0x32e90a){var _0x207320='';if(!_[_0xbee4('0x3')](_0x1ce324)&&_0xbee4('0x4')===typeof _0x1ce324){_0x207320+=_0x1ce324;}if(!_[_0xbee4('0x3')](_0x32e90a)&&'string'===typeof _0x32e90a){_0x207320+='\x20'+_0x32e90a;}if(_0x207320!==''){return _0x207320;}return _0x426a03;}function Action(_0x26b7ff,_0x482916,_0x8253ea,_0x70c3c,_0x1d7c24){this[_0xbee4('0x5')]=_0x8253ea||undefined;this[_0xbee4('0x6')]=_0x26b7ff['id'];this[_0xbee4('0x7')]=_0x482916[_0xbee4('0x8')];this[_0xbee4('0x9')]=_0x482916[_0xbee4('0x9')];this[_0xbee4('0xa')]='queue';this[_0xbee4('0xb')]=![];this[_0xbee4('0xc')]=_['isNil'](_0x26b7ff[_0xbee4('0xd')])?undefined:_0x26b7ff[_0xbee4('0xd')][_0xbee4('0x8')];this['channelAgent']=this['membername']?util[_0xbee4('0xe')]('SIP/%s',this[_0xbee4('0xc')]):_0x70c3c||undefined;this[_0xbee4('0xf')]=checkNameSurname(_0x26b7ff['Contact'][_0xbee4('0x10')],_0x26b7ff[_0xbee4('0x11')][_0xbee4('0x12')],_0x26b7ff[_0xbee4('0x11')][_0xbee4('0x13')]);this['active']=_0x26b7ff['active']||![];this[_0xbee4('0x14')]=_0x26b7ff[_0xbee4('0x11')][_0xbee4('0x10')];this[_0xbee4('0x15')]=_0x26b7ff[_0xbee4('0x15')];this['countbusyretry']=_0x26b7ff[_0xbee4('0x16')]||0x0;this[_0xbee4('0x17')]=_0x26b7ff['countcongestionretry']||0x0;this['countnoanswerretry']=_0x26b7ff['countnoanswerretry']||0x0;this[_0xbee4('0x18')]=(_0x26b7ff[_0xbee4('0x16')]||0x0)+(_0x26b7ff['countcongestionretry']||0x0)+(_0x26b7ff[_0xbee4('0x19')]||0x0)+(_0x26b7ff[_0xbee4('0x1a')]||0x0)+(_0x26b7ff[_0xbee4('0x1b')]||0x0)+(_0x26b7ff['countabandonedretry']||0x0)+(_0x26b7ff[_0xbee4('0x1c')]||0x0)+(_0x26b7ff[_0xbee4('0x1d')]||0x0);this['countnosuchnumberretry']=_0x26b7ff[_0xbee4('0x1a')]||0x0;this['countdropretry']=_0x26b7ff[_0xbee4('0x1b')]||0x0;this[_0xbee4('0x1e')]=_0x26b7ff[_0xbee4('0x1e')]||0x0;this[_0xbee4('0x1c')]=_0x26b7ff[_0xbee4('0x1c')]||0x0;this[_0xbee4('0x1d')]=_0x26b7ff[_0xbee4('0x1d')]||0x0;this[_0xbee4('0x1f')]=_0x26b7ff[_0xbee4('0x1f')];this[_0xbee4('0x20')]=_0x26b7ff[_0xbee4('0x20')];this['callbackat']=_0x26b7ff[_0xbee4('0x21')];this[_0xbee4('0x22')]=_0x26b7ff[_0xbee4('0x22')];this[_0xbee4('0x23')]=_0x26b7ff['ContactId'];this[_0xbee4('0x24')]=_0x26b7ff[_0xbee4('0x24')];this[_0xbee4('0x25')]=_['isNil'](_0x26b7ff[_0xbee4('0xd')])?_0x26b7ff[_0xbee4('0x25')]:_0x26b7ff[_0xbee4('0xd')]['id'];this['VoiceQueueId']=_0x26b7ff['VoiceQueueId'];this[_0xbee4('0x26')]='';this['originatecalleridname']='';}Action[_0xbee4('0x27')][_0xbee4('0x28')]=function(){return util[_0xbee4('0xe')](_0xbee4('0x29'),this[_0xbee4('0xf')],this[_0xbee4('0x2a')]);};module[_0xbee4('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c0690a6..252c22b 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 _0x8ef6=['IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','dialPreviewAutoRecallMe','recallMe','sequence','info','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','connect','acw','custom:agentConnectPreview','complete','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','pTalking:\x20','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','Contact','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','clone','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','bind','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','loopCampaigns','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','name','stringify','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2162c2,_0xa073e6){_0x2162c2=_0x2162c2-0x0;var _0x278b7b=_0x8ef6[_0x2162c2];return _0x278b7b;};'use strict';var util=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var BPromise=require(_0x68ef('0x2'));var uuid=require(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var md5=require(_0x68ef('0x5'));var Redis=require(_0x68ef('0x6'));var config=require('../../../config/environment');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var loggerAction=require(_0x68ef('0x7'))(_0x68ef('0x9'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0x68ef('0xa'));var ut=require(_0x68ef('0xb'));config[_0x68ef('0xc')]=_['defaults'](config[_0x68ef('0xc')],{'host':_0x68ef('0xd'),'port':0x18eb});var io=require(_0x68ef('0xe'))(new Redis(config[_0x68ef('0xc')]));var Sequence=function(){};Sequence[_0x68ef('0xf')][_0x68ef('0x10')]=function(_0x304a60){this[_0x68ef('0x11')]=this[_0x68ef('0x11')]?this[_0x68ef('0x11')][_0x68ef('0x12')](_0x304a60):_0x304a60();};function Preview(_0xfa6763){this['sequence']=new Sequence();this[_0x68ef('0x13')]=_0xfa6763[_0x68ef('0x14')];this[_0x68ef('0x15')]=_0xfa6763[_0x68ef('0x15')];this[_0x68ef('0x16')]={};this[_0x68ef('0x17')]=_0xfa6763['agents'];this[_0x68ef('0x18')]=0x0;ami['on'](_0x68ef('0x19'),this[_0x68ef('0x1a')]['bind'](this));ami['on'](_0x68ef('0x1b'),this[_0x68ef('0x1c')][_0x68ef('0x1d')](this));ami['on']('hanguprequest',this[_0x68ef('0x1e')][_0x68ef('0x1d')](this));ami['on'](_0x68ef('0x1f'),this[_0x68ef('0x20')]['bind'](this));ami['on'](_0x68ef('0x21'),this['syncNewExten']['bind'](this));ami['on'](_0x68ef('0x22'),this[_0x68ef('0x23')]['bind'](this));ami['on']('attendedtransfer',this[_0x68ef('0x24')][_0x68ef('0x1d')](this));ami['on'](_0x68ef('0x25'),this['syncBlindTransfer'][_0x68ef('0x1d')](this));this[_0x68ef('0x26')](this[_0x68ef('0x13')]);}function emit(_0x5b246b,_0x3c46d4,_0x3be4c0){io['to'](_0x5b246b)['emit'](_0x3c46d4,_0x3be4c0);}function emitCampaignPreview(_0x399da4){if(_0x399da4[_0x68ef('0x27')]===_0x68ef('0x28')){var _0x5ddec7={'id':_0x399da4['id'],'name':_0x399da4['name'],'strategy':_0x399da4['strategy'],'answered':_0x399da4[_0x68ef('0x29')],'available':_0x399da4[_0x68ef('0x2a')],'loggedIn':_0x399da4[_0x68ef('0x2b')],'pTalking':_0x399da4[_0x68ef('0x2c')],'sumBillable':_0x399da4[_0x68ef('0x2d')],'sumDuration':_0x399da4[_0x68ef('0x2e')],'sumHoldTime':_0x399da4[_0x68ef('0x2f')]||0x0,'talking':_0x399da4[_0x68ef('0x30')],'total':_0x399da4[_0x68ef('0x31')],'type':_0x399da4[_0x68ef('0x27')],'unmanaged':_0x399da4['unmanaged'],'abandoned':_0x399da4[_0x68ef('0x32')],'waiting':_0x399da4['waiting'],'loggedInDb':_0x399da4['loggedInDb'],'dialActive':_0x399da4['dialActive'],'dialMethod':_0x399da4[_0x68ef('0x33')],'dialOriginateCallerIdName':_0x399da4[_0x68ef('0x34')],'dialOriginateCallerIdNumber':_0x399da4[_0x68ef('0x35')],'dialOriginateTimeout':_0x399da4[_0x68ef('0x36')],'dialPrefix':_0x399da4['dialPrefix'],'outboundAnswerAgiCallsDay':_0x399da4['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x399da4[_0x68ef('0x37')],'outboundBlacklistCallsDay':_0x399da4[_0x68ef('0x38')],'outboundBusyCallsDay':_0x399da4[_0x68ef('0x39')],'outboundCongestionCallsDay':_0x399da4[_0x68ef('0x3a')],'outboundDropCallsDayACS':_0x399da4[_0x68ef('0x3b')],'outboundDropCallsDayCallersExit':_0x399da4[_0x68ef('0x3c')],'outboundDropCallsDayTimeout':_0x399da4[_0x68ef('0x3d')],'outboundNoAnswerCallsDay':_0x399da4[_0x68ef('0x3e')],'outboundNoSuchCallsDay':_0x399da4['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x399da4[_0x68ef('0x3f')],'outboundReCallsDay':_0x399da4[_0x68ef('0x40')],'outboundRejectCallsDay':_0x399da4[_0x68ef('0x41')],'outboundUnknownCallsDay':_0x399da4['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x399da4[_0x68ef('0x42')],'predictiveIntervalAnsweredCalls':_0x399da4['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x399da4[_0x68ef('0x43')],'predictiveIntervalAvgTalktime':_0x399da4[_0x68ef('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x399da4['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x399da4['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x399da4[_0x68ef('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x399da4[_0x68ef('0x46')],'predictiveIntervalHitRate':_0x399da4['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x399da4[_0x68ef('0x47')],'predictiveIntervalPauses':_0x399da4[_0x68ef('0x48')],'predictiveIntervalAvailable':_0x399da4[_0x68ef('0x49')],'predictiveIntervalTotalCalls':_0x399da4[_0x68ef('0x4a')],'message':_0x399da4['message'],'originated':_0x399da4[_0x68ef('0x4b')],'erlangCalls':_0x399da4[_0x68ef('0x4c')],'erlangCallToSecond':_0x399da4['erlangCallToSecond'],'erlangAbandonmentRate':_0x399da4[_0x68ef('0x4d')],'erlangBusyFactor':_0x399da4['erlangBusyFactor'],'startPredictive':_0x399da4[_0x68ef('0x4e')],'startProgressive':_0x399da4[_0x68ef('0x4f')]};if(_0x399da4['Trunk']){_0x5ddec7[_0x68ef('0x50')]={'id':_0x399da4['Trunk']['id'],'name':_0x399da4[_0x68ef('0x50')]['name'],'active':_0x399da4[_0x68ef('0x50')][_0x68ef('0x51')],'callerid':_0x399da4[_0x68ef('0x50')]['callerid']};}if(_0x399da4[_0x68ef('0x52')]){_0x5ddec7['Interval']={'id':_0x399da4[_0x68ef('0x52')]['id'],'name':_0x399da4['Interval'][_0x68ef('0x53')]};}var _0x362ef1=md5(JSON[_0x68ef('0x54')](_0x5ddec7));if(_0x399da4[_0x68ef('0x5')]!==_0x362ef1){_0x399da4[_0x68ef('0x5')]=_0x362ef1;emit(util[_0x68ef('0x55')]('voice:queue:%s',_0x5ddec7[_0x68ef('0x53')]),_0x68ef('0x56'),_0x5ddec7);}}}function emitVoiceQueueChannelRemove(_0x32074a){logger['info'](_0x68ef('0x57'),JSON[_0x68ef('0x54')](_0x32074a));emit(util[_0x68ef('0x55')]('voice:queue:%s',_0x32074a['name']),_0x68ef('0x58'),_0x32074a);io[_0x68ef('0x59')](_0x68ef('0x5a'),_0x32074a);}function notSendMessagesQueue(_0x42fc8c){if(_0x42fc8c[_0x68ef('0x5b')]){if(_0x42fc8c[_0x68ef('0x4b')]===0x0&&_0x42fc8c[_0x68ef('0x2c')]===0x0){_0x42fc8c['sendMessageOneNotActive']=![];_0x42fc8c[_0x68ef('0x2a')]=0x0;_0x42fc8c[_0x68ef('0x5c')]=0x0;_0x42fc8c[_0x68ef('0x5d')]=_0x68ef('0x5e');ut['logger'](_0x68ef('0x5f'),_0x42fc8c[_0x68ef('0x53')]+_0x68ef('0x60'));}else{_0x42fc8c[_0x68ef('0x5d')]=_0x68ef('0x61');ut[_0x68ef('0x62')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x42fc8c[_0x68ef('0x53')]+_0x68ef('0x63'));}emitCampaignPreview(_0x42fc8c);}}Preview[_0x68ef('0xf')][_0x68ef('0x26')]=function(){var _0x449f3c=this;setInterval(function(){_0x449f3c[_0x68ef('0x64')]();},0x7cf);};Preview[_0x68ef('0xf')][_0x68ef('0x64')]=function(){var _0xc687ab=this['campaignsPreview'];this[_0x68ef('0x18')]+=0x1;for(var _0x19d7a1 in _0xc687ab){if(_0xc687ab[_0x68ef('0x65')](_0x19d7a1)&&(_0xc687ab[_0x19d7a1][_0x68ef('0x33')]===_0x68ef('0x8')||_0xc687ab[_0x19d7a1][_0x68ef('0x33')]===_0x68ef('0x66'))&&_0xc687ab[_0x19d7a1]['type']===_0x68ef('0x28')){if(this['clockClearZombieChannels']>0x7){this[_0x68ef('0x18')]=0x0;this[_0x68ef('0x67')]();}}if(_0xc687ab[_0x68ef('0x65')](_0x19d7a1)&&_0xc687ab[_0x19d7a1][_0x68ef('0x33')]==='preview'&&_0xc687ab[_0x19d7a1][_0x68ef('0x27')]==='outbound'){if(_0xc687ab[_0x19d7a1][_0x68ef('0x68')]){this['setMessage'](_0xc687ab[_0x19d7a1]);if(_0xc687ab[_0x19d7a1][_0x68ef('0x69')])this[_0x68ef('0x6a')](_0xc687ab[_0x19d7a1]);}else{notSendMessagesQueue(_0xc687ab[_0x19d7a1]);}}}};Preview[_0x68ef('0xf')]['clearZombieChannel']=function(_0x59b148){var _0x4044d5=this;this[_0x68ef('0x6b')]['enqueue'](function(){if(!_['isNil'](_0x4044d5['actions'][_0x59b148])){loggerAction[_0x68ef('0x6c')](_0x68ef('0x6d'),_0x59b148,_0x68ef('0x6e'),_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x6f')],'originated:\x20',JSON['stringify'](_0x4044d5[_0x68ef('0x13')][_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x6f')]][_0x68ef('0x4b')]),'pTalking:\x20',JSON[_0x68ef('0x54')](_0x4044d5[_0x68ef('0x13')][_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x6f')]]['pTalking']),JSON['stringify'](_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x70')]),JSON['stringify'](_[_0x68ef('0x71')](_0x4044d5[_0x68ef('0x16')][_0x59b148],[_0x68ef('0x72'),_0x68ef('0x73'),_0x68ef('0x74'),'ListId'])));return ami[_0x68ef('0x75')]({'action':_0x68ef('0x76'),'channel':_0x4044d5[_0x68ef('0x16')][_0x59b148]['channel']})[_0x68ef('0x77')](function(_0x3e7e55){if(_0x3e7e55[_0x68ef('0x5d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4044d5[_0x68ef('0x16')][_0x59b148]){ut['updateOriginated'](_0x4044d5['campaignsPreview'][_0x4044d5[_0x68ef('0x16')][_0x59b148]['queue']],_0x68ef('0x78'));if(_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x70')]===!![]){ut[_0x68ef('0x79')](_0x4044d5[_0x68ef('0x13')][_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x6f')]],_0x68ef('0x78'));ut[_0x68ef('0x7a')](_0x68ef('0x7b')+_0x59b148,_0x4044d5['actions'][_0x59b148]['queue']);}ut[_0x68ef('0x7a')](_0x68ef('0x7c')+_0x59b148,_0x4044d5[_0x68ef('0x16')][_0x59b148][_0x68ef('0x6f')]);delete _0x4044d5[_0x68ef('0x16')][_0x59b148];}},0x2328);}});}});};Preview[_0x68ef('0xf')][_0x68ef('0x67')]=function(){var _0x300a64=this;loggerAction[_0x68ef('0x6c')]('[action]',_['size'](this[_0x68ef('0x16')]));for(var _0x5781c8 in this[_0x68ef('0x16')]){if(_0x300a64['actions'][_0x68ef('0x65')](_0x5781c8)){_0x300a64[_0x68ef('0x7d')](_0x5781c8);}}};Preview['prototype'][_0x68ef('0x6a')]=function(_0x4e097e){var _0x407c6d=this;rpcDb[_0x68ef('0x7e')](_0x4e097e['id'],ut[_0x68ef('0x7f')](this[_0x68ef('0x17')]))[_0x68ef('0x80')](function(_0x3d81c8){if(!_['isNil'](_0x3d81c8)){for(var _0x1cdaef=0x0;_0x1cdaef<_0x3d81c8[_0x68ef('0x81')];_0x1cdaef+=0x1){if(ut[_0x68ef('0x82')](_0x3d81c8[_0x1cdaef][_0x68ef('0x83')])<_0x4e097e[_0x68ef('0x84')]*0x3c){if(_0x3d81c8[_0x1cdaef][_0x68ef('0x85')]&&!_0x3d81c8[_0x1cdaef]['Agent'][_0x68ef('0x86')]){_0x407c6d[_0x68ef('0x87')](_0x3d81c8[_0x1cdaef]['id'])['then'](ut[_0x68ef('0x88')](_0x68ef('0x89')))[_0x68ef('0x77')](ut['logger2'](_0x68ef('0x89')));}else{rpcDb['disableContact'](_0x3d81c8[_0x1cdaef]['id']);}}else{var _0x5412ea=new Action(_0x3d81c8[_0x1cdaef],_0x4e097e);_0x5412ea[_0x68ef('0x8a')]=moment()['format'](_0x68ef('0x8b'));_0x4e097e['outboundReCallsDay']+=0x1;ut[_0x68ef('0x8c')](_0x5412ea,0x17,_0x68ef('0x8d'));if(_0x4e097e[_0x68ef('0x8e')]){rpcDb[_0x68ef('0x8f')](ut[_0x68ef('0x90')](_0x3d81c8[_0x1cdaef]));rpcDb[_0x68ef('0x91')](_0x5412ea,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x68ef('0x8c')](_0x5412ea,0x16,'RecallFailedTimeout');rpcDb[_0x68ef('0x91')](_0x5412ea,'[HistoryRecallClose]');rpcDb[_0x68ef('0x92')](_0x5412ea,_0x68ef('0x93'));}}}}})[_0x68ef('0x77')](ut[_0x68ef('0x88')](_0x68ef('0x94')));};Preview[_0x68ef('0xf')][_0x68ef('0x95')]=function(_0x52d29a){_0x52d29a[_0x68ef('0x5b')]=!![];if(ut[_0x68ef('0x96')](_0x52d29a[_0x68ef('0x2b')])){_0x52d29a[_0x68ef('0x5d')]=_0x68ef('0x97');}else if(!ut['isActive'](_0x52d29a[_0x68ef('0x68')])){_0x52d29a['message']=_0x68ef('0x5e');}else if(!this['isTrunkReachable'](_0x52d29a['Trunk'])){if(!this[_0x68ef('0x98')](_0x52d29a[_0x68ef('0x99')])){_0x52d29a[_0x68ef('0x5d')]=_0x68ef('0x9a');}else{_0x52d29a['message']=_0x68ef('0x9b');}}else{_0x52d29a['message']=_0x68ef('0x9b');}emitCampaignPreview(_0x52d29a);};Preview[_0x68ef('0xf')][_0x68ef('0x9c')]=function(_0x49e5d4,_0x541e35,_0x3e74d2){var _0x1092f8=this;var _0x24d7f7=this[_0x68ef('0x16')][_0x541e35];var _0x5b41e1=this[_0x68ef('0x13')][_0x24d7f7[_0x68ef('0x6f')]];var _0x19c20f;if(_0x5b41e1){switch(_0x3e74d2){case'1':_0x5b41e1[_0x68ef('0x9d')]+=0x1;_0x24d7f7['countnosuchnumberretry']+=0x1;_0x24d7f7[_0x68ef('0x9e')]=ut['totalGlobal'](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0x0,_0x68ef('0x9f'));ami[_0x68ef('0x59')](_0x68ef('0xa0'),ut[_0x68ef('0xa1')](_0x24d7f7,'nosuchnumber'));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xa2'));if(ut[_0x68ef('0xa3')](_0x24d7f7)>=_0x5b41e1['dialGlobalMaxRetry']){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,'Global');rpcDb[_0x68ef('0x92')](_0x19c20f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x24d7f7['countnosuchnumberretry']>=_0x5b41e1[_0x68ef('0xa5')]){rpcDb[_0x68ef('0x92')](_0x24d7f7,_0x68ef('0xa6'));}else{rpcDb[_0x68ef('0xa7')](ut['scheduledAt'](_0x24d7f7,_0x68ef('0xa8'),_0x5b41e1[_0x68ef('0xa9')]),_0x24d7f7[_0x68ef('0xaa')],_0x24d7f7['activeContact']);}}delete this[_0x68ef('0x16')][_0x49e5d4[_0x68ef('0xab')]];break;case _0x68ef('0xac'):var _0x1cfb74=moment()[_0x68ef('0x55')](_0x68ef('0x8b'));_0x24d7f7[_0x68ef('0xad')]=_0x1cfb74;_0x24d7f7[_0x68ef('0xae')]=_0x1cfb74;_0x24d7f7[_0x68ef('0x70')]=!![];_0x5b41e1[_0x68ef('0x2c')]+=0x1;logger[_0x68ef('0x6c')](_0x68ef('0xaf'),_0x24d7f7['uniqueid'],_0x68ef('0xb0'),_0x5b41e1[_0x68ef('0x53')],'pTalking:\x20',_0x5b41e1['pTalking']);ami[_0x68ef('0x59')]('custom:agentconnect',ut[_0x68ef('0xa1')](_0x24d7f7,_0x68ef('0xb1'),this['campaignsPreview'][_0x24d7f7['queue']]));if(_0x5b41e1[_0x68ef('0xb2')]){ami['emit'](_0x68ef('0xb3'),ut['buildAcw'](_0x24d7f7));}break;case'16':ami[_0x68ef('0x59')]('custom:agentcomplete',ut[_0x68ef('0xa1')](_0x24d7f7,_0x68ef('0xb4'),this['campaignsPreview'][_0x24d7f7[_0x68ef('0x6f')]]));emitVoiceQueueChannelRemove(ut[_0x68ef('0xa1')](_0x24d7f7,_0x68ef('0xb4')));_0x5b41e1[_0x68ef('0x37')]+=0x1;_0x5b41e1['total']+=0x1;_0x5b41e1[_0x68ef('0x29')]+=0x1;ut[_0x68ef('0x79')](_0x5b41e1,'[16]');_0x24d7f7[_0x68ef('0x9e')]=ut[_0x68ef('0xa3')](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0x4,'Answer');rpcDb[_0x68ef('0x91')](_0x24d7f7,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x68ef('0x92')](_0x24d7f7,_0x68ef('0xb5'));rpcDb['crateCustomerReportQueue'](_0x24d7f7);_0x5b41e1['sumDuration']+=_0x24d7f7['talktime'];_0x5b41e1['sumBillable']+=_0x24d7f7[_0x68ef('0xb6')];logger[_0x68ef('0x6c')](_0x68ef('0xb7'),_0x24d7f7[_0x68ef('0xb8')],_0x68ef('0xb0'),_0x5b41e1[_0x68ef('0x53')],_0x68ef('0xb9'),_0x5b41e1[_0x68ef('0x2c')]);delete this[_0x68ef('0x16')][_0x49e5d4[_0x68ef('0xab')]];break;case _0x68ef('0xba'):_0x5b41e1[_0x68ef('0x39')]+=0x1;_0x24d7f7[_0x68ef('0xbb')]+=0x1;_0x24d7f7['countglobal']=ut[_0x68ef('0xa3')](_0x24d7f7);ut['logCustomer'](_0x24d7f7,0x5,_0x68ef('0xbc'));ami['emit']('custom:agentbusy',ut[_0x68ef('0xa1')](_0x24d7f7,_0x68ef('0xbd')));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xbe'));if(ut['totalGlobal'](_0x24d7f7)>=_0x5b41e1['dialGlobalMaxRetry']){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,_0x68ef('0xbf'));rpcDb[_0x68ef('0x92')](_0x19c20f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x24d7f7[_0x68ef('0xbb')]>=_0x5b41e1[_0x68ef('0xc0')]){rpcDb[_0x68ef('0x92')](_0x24d7f7,_0x68ef('0xbe'));}else{rpcDb['rescheduleContact'](ut[_0x68ef('0xc1')](_0x24d7f7,_0x68ef('0xbb'),_0x5b41e1[_0x68ef('0xc2')]),_0x24d7f7[_0x68ef('0xaa')],_0x24d7f7[_0x68ef('0xc3')]);}}break;case _0x68ef('0xc4'):_0x5b41e1['outboundNoAnswerCallsDay']+=0x1;_0x24d7f7[_0x68ef('0xc5')]+=0x1;_0x24d7f7['countglobal']=ut[_0x68ef('0xa3')](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0x3,_0x68ef('0xc6'));ami[_0x68ef('0x59')]('custom:agentnoanswer',ut[_0x68ef('0xa1')](_0x24d7f7,'noanswer'));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xc7'));if(ut['totalGlobal'](_0x24d7f7)>=_0x5b41e1['dialGlobalMaxRetry']){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,'Global');rpcDb[_0x68ef('0x92')](_0x19c20f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x24d7f7[_0x68ef('0xc5')]>=_0x5b41e1[_0x68ef('0xc8')]){rpcDb[_0x68ef('0x92')](_0x24d7f7,_0x68ef('0xc7'));}else{rpcDb[_0x68ef('0xa7')](ut[_0x68ef('0xc1')](_0x24d7f7,'countnoanswerretry',_0x5b41e1[_0x68ef('0xc9')]),_0x24d7f7[_0x68ef('0xaa')],_0x24d7f7[_0x68ef('0xc3')]);}}break;case _0x68ef('0xca'):_0x5b41e1[_0x68ef('0x3a')]+=0x1;_0x24d7f7[_0x68ef('0xcb')]+=0x1;_0x24d7f7[_0x68ef('0x9e')]=ut['totalGlobal'](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0x8,_0x68ef('0xcc'));ami[_0x68ef('0x59')](_0x68ef('0xcd'),ut[_0x68ef('0xa1')](_0x24d7f7,_0x68ef('0xce')));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xcf'));if(ut[_0x68ef('0xa3')](_0x24d7f7)>=_0x5b41e1['dialGlobalMaxRetry']){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,'Global');rpcDb['createCustomerFinal'](_0x19c20f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x24d7f7[_0x68ef('0xcb')]>=_0x5b41e1[_0x68ef('0xd0')]){rpcDb[_0x68ef('0x92')](_0x24d7f7,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24d7f7,_0x68ef('0xcb'),_0x5b41e1[_0x68ef('0xc2')]),_0x24d7f7[_0x68ef('0xaa')],_0x24d7f7[_0x68ef('0xc3')]);}}break;case _0x68ef('0xd1'):_0x5b41e1[_0x68ef('0x41')]+=0x1;_0x24d7f7['countagentrejectretry']+=0x1;_0x24d7f7[_0x68ef('0x9e')]=ut[_0x68ef('0xa3')](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0x14,_0x68ef('0xd2'));ami['emit'](_0x68ef('0xd3'),ut[_0x68ef('0xa1')](_0x24d7f7,_0x68ef('0xd4')));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xd5'));if(ut[_0x68ef('0xa3')](_0x24d7f7)>=_0x5b41e1[_0x68ef('0xd6')]){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0x14,'AgentReject');rpcDb[_0x68ef('0x92')](_0x19c20f,_0x68ef('0xd7'));}else{if(_0x24d7f7['countagentrejectretry']>=_0x5b41e1[_0x68ef('0xd8')]){rpcDb[_0x68ef('0x92')](_0x24d7f7,_0x68ef('0xd7'));}else{rpcDb[_0x68ef('0xa7')](ut[_0x68ef('0xc1')](_0x24d7f7,_0x68ef('0xd9'),_0x5b41e1[_0x68ef('0xda')]),_0x24d7f7[_0x68ef('0xaa')],_0x24d7f7[_0x68ef('0xc3')]);}}break;case _0x68ef('0xdb'):_0x5b41e1[_0x68ef('0x42')]+=0x1;_0x24d7f7[_0x68ef('0xdc')]+=0x1;_0x24d7f7[_0x68ef('0x9e')]=ut[_0x68ef('0xa3')](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0xb,_0x68ef('0xdd'));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xde'));if(ut['totalGlobal'](_0x24d7f7)>=_0x5b41e1[_0x68ef('0xd6')]){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,_0x68ef('0xbf'));rpcDb[_0x68ef('0x92')](_0x19c20f,_0x68ef('0xde'));}else{if(_0x24d7f7['countabandonedetry']>=_0x5b41e1[_0x68ef('0xdf')]){rpcDb[_0x68ef('0x92')](_0x24d7f7,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x68ef('0xa7')](ut['scheduledAt'](_0x24d7f7,'countabandonedretry',_0x5b41e1['dialAbandonedRetryFrequency']),_0x24d7f7['unlockAgent'],_0x24d7f7[_0x68ef('0xc3')]);}}break;case'18':_0x5b41e1['outboundUnknownCallsDay']+=0x1;_0x24d7f7[_0x68ef('0xe0')]+=0x1;_0x24d7f7['countglobal']=ut['totalGlobal'](_0x24d7f7);ut['logCustomer'](_0x24d7f7,0x12,_0x49e5d4[_0x68ef('0xe1')]||_0x49e5d4[_0x68ef('0xe2')]);ami[_0x68ef('0x59')](_0x68ef('0xe3'),ut[_0x68ef('0xa1')](_0x24d7f7,'amd'));rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xe4'));if(ut[_0x68ef('0xa3')](_0x24d7f7)>=_0x5b41e1[_0x68ef('0xd6')]){_0x19c20f=ut['cloneAction'](_0x24d7f7,0xf,_0x68ef('0xbf'));rpcDb['createCustomerFinal'](_0x19c20f,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x24d7f7,_0x68ef('0xe4'));}delete this[_0x68ef('0x16')][_0x49e5d4[_0x68ef('0xab')]];break;case'19':_0x5b41e1[_0x68ef('0xe5')]+=0x1;_0x24d7f7[_0x68ef('0x9e')]=ut[_0x68ef('0xa3')](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0x13,_0x49e5d4[_0x68ef('0xe1')]||_0x49e5d4[_0x68ef('0xe2')]);ami[_0x68ef('0x59')](_0x68ef('0xe3'),ut[_0x68ef('0xa1')](_0x24d7f7,'amd'));rpcDb['createCustomerHistory'](_0x24d7f7,'[callProgressDetectingCustomer][machine]');if(ut[_0x68ef('0xa3')](_0x24d7f7)>=_0x5b41e1[_0x68ef('0xd6')]){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,'Global');rpcDb[_0x68ef('0x92')](_0x19c20f,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x68ef('0x92')](_0x24d7f7,_0x68ef('0xe6'));}delete this[_0x68ef('0x16')][_0x49e5d4['linkedid']];break;default:if(_0x24d7f7[_0x68ef('0x70')]){ut[_0x68ef('0x79')](_0x5b41e1,'[default]');ut[_0x68ef('0x7a')](_0x68ef('0xe7')+_0x5b41e1[_0x68ef('0x53')],_0x49e5d4);}_0x5b41e1[_0x68ef('0xe5')]+=0x1;_0x24d7f7[_0x68ef('0x9e')]=ut[_0x68ef('0xa3')](_0x24d7f7);ut[_0x68ef('0x8c')](_0x24d7f7,0xc,_0x49e5d4['cause-txt']||_0x49e5d4[_0x68ef('0xe2')]);rpcDb[_0x68ef('0x91')](_0x24d7f7,_0x68ef('0xe8'));if(ut[_0x68ef('0xa3')](_0x24d7f7)>=_0x5b41e1[_0x68ef('0xd6')]){_0x19c20f=ut[_0x68ef('0xa4')](_0x24d7f7,0xf,_0x68ef('0xbf'));rpcDb[_0x68ef('0x92')](_0x19c20f,_0x68ef('0xe9'));}else{rpcDb[_0x68ef('0x92')](_0x24d7f7,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x49e5d4[_0x68ef('0xab')]];}if(!(_0x24d7f7['dialAnswer']&&_0x3e74d2==='16')){ut[_0x68ef('0xea')](_0x5b41e1,_0x68ef('0xeb'));logger[_0x68ef('0x6c')](_0x68ef('0xec'),_0x24d7f7[_0x68ef('0xb8')],'\x20Queue',_0x5b41e1[_0x68ef('0x53')],_0x68ef('0xed'),_0x5b41e1[_0x68ef('0x4b')]);}if(_0x3e74d2!==_0x68ef('0xac')){delete this['actions'][_0x49e5d4['linkedid']];delete this[_0x68ef('0x16')][_0x49e5d4[_0x68ef('0xee')]];}}};Preview[_0x68ef('0xf')][_0x68ef('0xef')]=function(_0x1914e9,_0x27d5b6,_0x20362d){if(_[_0x68ef('0xf0')](_0x27d5b6)&&_0x68ef('0xf1')!==typeof _0x27d5b6){return;}if(_[_0x68ef('0xf0')](_0x20362d)&&_0x68ef('0xf1')!==typeof _0x20362d){return;}switch(_0x20362d['reason']){case'0':ut[_0x68ef('0xf2')](_0x1914e9,0x0,_0x68ef('0x9f'));rpcDb[_0x68ef('0xf3')](_0x1914e9,_0x68ef('0xf4'));break;case'3':ut[_0x68ef('0xf2')](_0x1914e9,0x3,_0x68ef('0xc6'));rpcDb[_0x68ef('0xf3')](_0x1914e9,_0x68ef('0xf5'));break;case'5':ut[_0x68ef('0xf2')](_0x1914e9,0x5,_0x68ef('0xbc'));rpcDb['createAgentHistory'](_0x1914e9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x68ef('0xf2')](_0x1914e9,0x8,_0x68ef('0xcc'));rpcDb[_0x68ef('0xf3')](_0x1914e9,_0x68ef('0xf6'));break;case'22':ut[_0x68ef('0xf2')](_0x1914e9,0x16,_0x68ef('0xf7'));rpcDb[_0x68ef('0xf3')](_0x1914e9,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x68ef('0xf2')](_0x1914e9,0xc,_0x20362d[_0x68ef('0xf8')]);rpcDb[_0x68ef('0xf3')](_0x1914e9,_0x68ef('0xf6'));}ut['updateOriginated'](_0x27d5b6,_0x68ef('0xf9'));logger['info'](_0x68ef('0xfa'),_0x1914e9[_0x68ef('0xb8')],_0x68ef('0xb0'),_0x27d5b6['name'],'originated:\x20',_0x27d5b6[_0x68ef('0x4b')]);delete this['actions'][_0x1914e9[_0x68ef('0xb8')]];};Preview['prototype'][_0x68ef('0xfb')]=function(_0x426274,_0x5aa4a2,_0x4a172f,_0x3604b1,_0x1d429a){var _0x4d96a9=this;return new BPromise(function(_0xf9f2c4,_0x4a9167){if(_[_0x68ef('0xfc')](_0x5aa4a2)||_['isNil'](_0x5aa4a2['Contact'])||_[_0x68ef('0xfc')](_0x5aa4a2['Contact'][_0x68ef('0xfd')])||_[_0x68ef('0xfc')](_0x5aa4a2[_0x68ef('0x74')])){_0x4a9167(ut[_0x68ef('0x5d')](_0x68ef('0xfe'),_0x3604b1,_0x1d429a));return;}var _0x7b382e=uuid['v4']();var _0x54ccfe=_0x4d96a9['campaignsPreview'][_0x5aa4a2[_0x68ef('0x6e')][_0x68ef('0x53')]];var _0x8eb711=_0x4a172f?_0x4d96a9[_0x68ef('0x17')][_0x4a172f]['id']:undefined;_0x4d96a9[_0x68ef('0x16')][_0x7b382e]=new Action(_0x5aa4a2,_0x54ccfe,_0x7b382e,_0x4a172f,_0x8eb711);var _0x4929ee=_0x4d96a9[_0x68ef('0x16')][_0x7b382e];_0x4929ee[_0x68ef('0xaa')]=_0x3604b1;_0x4929ee[_0x68ef('0xc3')]=_0x1d429a;_0x4929ee[_0x68ef('0xff')]=_0x4a172f;if(_[_0x68ef('0x100')](_0x426274)){_0x4d96a9[_0x68ef('0x101')](_0x4929ee,_0x54ccfe,_0x5aa4a2,_0x4a172f)[_0x68ef('0x80')](function(_0xd6e356){logger['info'](_0x68ef('0x102'),_0x68ef('0x103')+_0x4929ee[_0x68ef('0x6f')]+_0x68ef('0x104')+_0x4929ee[_0x68ef('0x105')],JSON[_0x68ef('0x54')](_0xd6e356));ami['emit'](_0x68ef('0x106'),ut[_0x68ef('0xa1')](_0x4929ee,_0x68ef('0x107'),_0x4d96a9[_0x68ef('0x13')][_0x4929ee[_0x68ef('0x6f')]]));_0xf9f2c4(ut['message'](_0x68ef('0x108')));})[_0x68ef('0x77')](function(_0x5d156e){ut['logger'](_0x68ef('0x109'),_0x5d156e);_0x4a9167(ut[_0x68ef('0x5d')](_0x68ef('0x10a'),_0x3604b1,_0x1d429a));});}else{_0x54ccfe['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x4929ee);rpcDb[_0x68ef('0x10b')](_0x4929ee,_0x68ef('0x10c'));delete _0x4d96a9[_0x68ef('0x16')][_0x7b382e];_0x4a9167(ut[_0x68ef('0x5d')](_0x68ef('0x10d'),_0x3604b1,_0x1d429a));}});};Preview[_0x68ef('0xf')][_0x68ef('0x98')]=function(_0x1dd16e){return!_[_0x68ef('0xfc')](_0x1dd16e)&&!_[_0x68ef('0xfc')](_0x1dd16e[_0x68ef('0x53')])&&!_[_0x68ef('0xfc')](_0x1dd16e[_0x68ef('0x51')])&&_0x1dd16e[_0x68ef('0x51')]&&!_['isNil'](this['trunks'][util[_0x68ef('0x55')](_0x68ef('0x10e'),_0x1dd16e[_0x68ef('0x53')])])&&!_[_0x68ef('0xfc')](this['trunks'][util[_0x68ef('0x55')](_0x68ef('0x10e'),_0x1dd16e['name'])]['status'])&&(this[_0x68ef('0x15')][util[_0x68ef('0x55')](_0x68ef('0x10e'),_0x1dd16e['name'])][_0x68ef('0x76')]===_0x68ef('0x10f')||this[_0x68ef('0x15')][util['format'](_0x68ef('0x10e'),_0x1dd16e['name'])][_0x68ef('0x76')]===_0x68ef('0x110'));};Preview['prototype'][_0x68ef('0x87')]=function(_0xc24c31,_0x298127){var _0x46af0e=this;return new BPromise(function(_0x35f8c9,_0x196260){_0x46af0e[_0x68ef('0x111')](_0xc24c31,_0x298127)[_0x68ef('0x80')](function(_0xdd801b){_0x35f8c9(_['pick'](_0xdd801b,[_0x68ef('0x5d')]));})[_0x68ef('0x77')](function(_0x12e03f){if(_0x12e03f[_0x68ef('0x112')]){rpcDb[_0x68ef('0x113')](_0xc24c31);}if(_0x12e03f[_0x68ef('0x51')]){rpcDb[_0x68ef('0x114')](_0xc24c31);}_0x196260(_['pick'](_0x12e03f,['message']));});});};Preview[_0x68ef('0xf')]['execRun']=function(_0x11fba7,_0x158e68){var _0xb4e6ea=this;return new BPromise(function(_0x4762db,_0x52d821){var _0x728df1,_0x3d51f0;rpcDb[_0x68ef('0x115')](_0x11fba7)['then'](function(_0xe18083){if(!_[_0x68ef('0xfc')](_0xe18083[0x0])){_0x3d51f0=_0xe18083[0x0]['recallme']?![]:!![];_0x728df1=_0xe18083[0x0][_0x68ef('0x116')]?!![]:![];_0x728df1=_0x158e68?!![]:_0x728df1;}var _0x117233=_0xb4e6ea['validateContact'](_0xe18083);if(_0x117233['isValid']){rpcDb['checkIsBlackList'](_[_0x68ef('0x71')](_0xe18083[0x0],[_0x68ef('0x74'),_0x68ef('0x117')]))[_0x68ef('0x80')](function(_0xd4e347){_0xb4e6ea[_0x68ef('0xfb')](_0xd4e347,_0xe18083[0x0],_0x158e68,_0x3d51f0,_0x728df1)[_0x68ef('0x80')](function(_0x31c252){_0x4762db(_0x31c252);})[_0x68ef('0x77')](function(_0x4b393e){_0x52d821(_0x4b393e);});})[_0x68ef('0x77')](function(_0x62a830){ut['logger'](_0x68ef('0x118'),_0x62a830);_0x52d821(ut[_0x68ef('0x5d')](_0x68ef('0x119'),_0x3d51f0,_0x728df1));});}else{_0x52d821(ut['message'](_0x117233[_0x68ef('0x5d')],_0x3d51f0,_0x728df1));}})['catch'](function(_0x4649f9){ut[_0x68ef('0x62')](_0x68ef('0x11a'),_0x4649f9);_0x52d821(ut[_0x68ef('0x5d')](_0x68ef('0x119'),![],!![]));});});};Preview[_0x68ef('0xf')][_0x68ef('0x11b')]=function(_0x3385ec){if(_['isNil'](_0x3385ec)||_[_0x68ef('0x100')](_0x3385ec)||!_[_0x68ef('0xfc')](_0x3385ec[0x0]['Agent'])&&_[_0x68ef('0xfc')](_0x3385ec[0x0][_0x68ef('0x85')][_0x68ef('0x53')])){ut[_0x68ef('0x62')](_0x68ef('0x11c'),_0x3385ec);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1c4847=this[_0x68ef('0x13')][_0x3385ec[0x0][_0x68ef('0x6e')][_0x68ef('0x53')]];_0x1c4847[_0x68ef('0x5d')]='ACTIVE';if(_[_0x68ef('0xfc')](_0x1c4847)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x1c4847);return{'isValid':![],'message':_0x68ef('0x11d')};}if(!this[_0x68ef('0x98')](_0x1c4847[_0x68ef('0x50')])){ut[_0x68ef('0x62')](_0x68ef('0x11e'),_0x68ef('0x11f')+_0x1c4847[_0x68ef('0x53')]+_0x68ef('0x120'));if(!this['isTrunkReachable'](_0x1c4847[_0x68ef('0x99')])){ut[_0x68ef('0x62')](_0x68ef('0x11e'),_0x1c4847[_0x68ef('0x53')]+_0x68ef('0x121'));return{'isValid':![],'message':_0x68ef('0x122')};}}if(!ut[_0x68ef('0x123')](_0x1c4847[_0x68ef('0x68')])){ut[_0x68ef('0x62')](_0x68ef('0x124'),_0x1c4847[_0x68ef('0x53')]+_0x68ef('0x125'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1c4847[_0x68ef('0x53')]+_0x68ef('0x125')};}return{'isValid':!![],'message':_0x68ef('0x126')};};Preview[_0x68ef('0xf')]['execCall']=function(_0xc5163d,_0xb342e5,_0x1917bb,_0x5a91a7){var _0x13ddbb=this;return new BPromise(function(_0x52043b,_0x184cda){var _0xd4a6c1=_0xc5163d[_0x68ef('0xb8')];var _0x1aa045=_0x13ddbb[_0x68ef('0x98')](_0xb342e5['Trunk'])?util['format']('SIP/%s/%s%s',_0xb342e5[_0x68ef('0x50')][_0x68ef('0x53')],_['isNil'](_0xb342e5[_0x68ef('0x127')])?'':_0xb342e5[_0x68ef('0x127')][_0x68ef('0x128')]()||'',_0xb342e5[_0x68ef('0x129')]>0x0?_0x1917bb[_0x68ef('0x12a')][_0x68ef('0xfd')][_0x68ef('0x12b')](_0xb342e5[_0x68ef('0x129')]):_0x1917bb[_0x68ef('0x12a')][_0x68ef('0xfd')]):util[_0x68ef('0x55')](_0x68ef('0x12c'),_[_0x68ef('0xfc')](_0xb342e5[_0x68ef('0x99')])?_0xb342e5[_0x68ef('0x50')][_0x68ef('0x53')]:_0xb342e5['TrunkBackup'][_0x68ef('0x53')],_[_0x68ef('0xfc')](_0xb342e5['dialPrefix'])?'':_0xb342e5[_0x68ef('0x127')][_0x68ef('0x128')]()||'',_0xb342e5[_0x68ef('0x129')]>0x0?_0x1917bb[_0x68ef('0x12a')][_0x68ef('0xfd')][_0x68ef('0x12b')](_0xb342e5[_0x68ef('0x129')]):_0x1917bb['Contact']['phone']);var _0xc0a464=_0x13ddbb[_0x68ef('0x98')](_0xb342e5['Trunk'])?ut[_0x68ef('0x12d')](_0xb342e5['Trunk'][_0x68ef('0x12e')],_0xb342e5['dialOriginateCallerIdName'],_0xb342e5[_0x68ef('0x12f')]>0x0?ut[_0x68ef('0x130')](_0xb342e5[_0x68ef('0x35')],_0xb342e5[_0x68ef('0x12f')]):_0xb342e5[_0x68ef('0x35')]):ut[_0x68ef('0x12d')](_[_0x68ef('0xfc')](_0xb342e5[_0x68ef('0x99')])?_0xb342e5['Trunk'][_0x68ef('0x12e')]:_0xb342e5[_0x68ef('0x99')][_0x68ef('0x12e')],_0xb342e5[_0x68ef('0x34')],_0xb342e5[_0x68ef('0x12f')]>0x0?ut[_0x68ef('0x130')](_0xb342e5[_0x68ef('0x35')],_0xb342e5[_0x68ef('0x12f')]):_0xb342e5[_0x68ef('0x35')]);if(_0xc0a464){_0xc5163d['originatecalleridname']=ut[_0x68ef('0x131')](_0xc0a464);_0xc5163d[_0x68ef('0x132')]=ut[_0x68ef('0x133')](_0xc0a464);}var _0x552097=ut[_0x68ef('0x134')](_0xb342e5,_0x1917bb,_0x1aa045,_0xc0a464,_0xd4a6c1,_0xc5163d);_[_0x68ef('0x135')](_0xc5163d,ut[_0x68ef('0x136')](_0x552097));_0xc5163d[_0x68ef('0x8a')]=moment()[_0x68ef('0x55')](_0x68ef('0x8b'));ami[_0x68ef('0x75')](ut[_0x68ef('0x137')](_0xc5163d,_0xb342e5,_0x552097,_0xc5163d[_0x68ef('0xc3')],_0x5a91a7))[_0x68ef('0x80')](function(_0x283d63){_0xb342e5[_0x68ef('0x4b')]+=0x1;logger[_0x68ef('0x6c')](_0x68ef('0x138'),_0xd4a6c1,_0x68ef('0xb0'),_0xb342e5['name'],_0x68ef('0xed'),_0xb342e5[_0x68ef('0x4b')]);_0x52043b(_0x283d63);})['catch'](function(_0x1e26d1){ut['logAgent'](_0xc5163d,0xe,_0x68ef('0x139'));rpcDb[_0x68ef('0xf3')](_0xc5163d,_0x68ef('0x13a'));_0x184cda(_0x1e26d1);});});};Preview[_0x68ef('0xf')][_0x68ef('0x13b')]=function(_0x76232b){if(this[_0x68ef('0x16')][_0x76232b[_0x68ef('0xab')]]){this[_0x68ef('0x16')][_0x76232b[_0x68ef('0xab')]][_0x68ef('0x13c')]=_0x76232b[_0x68ef('0x13c')];}};Preview[_0x68ef('0xf')]['syncOriginateResponse']=function(_0x272060){var _0x2a7802=this;var _0x2cf7d3=this[_0x68ef('0x16')][_0x272060['actionid']];if(_0x2cf7d3){if(_0x2cf7d3[_0x68ef('0xff')]&&this[_0x68ef('0x17')][_0x2cf7d3[_0x68ef('0xff')]]){ut['logLookAgent'](_0x2cf7d3,this[_0x68ef('0x17')][_0x2cf7d3[_0x68ef('0xff')]][_0x68ef('0x53')],this[_0x68ef('0x17')][_0x2cf7d3[_0x68ef('0xff')]]['id']);}var _0x2a5f7e=_[_0x68ef('0x13d')](_0x2cf7d3);_0x2a5f7e['responsetime']=moment()['format'](_0x68ef('0x8b'));var _0x1600cc=_0x2a7802['campaignsPreview'][_0x2cf7d3['queue']];if(ut[_0x68ef('0x13e')](_0x272060[_0x68ef('0x13f')])){if(_0x2cf7d3[_0x68ef('0xaa')]){rpcDb[_0x68ef('0x113')](_0x2cf7d3[_0x68ef('0x105')]);}if(_0x2cf7d3[_0x68ef('0xc3')]){rpcDb[_0x68ef('0x114')](_0x2cf7d3[_0x68ef('0x105')]);}ami['emit']('custom:agentringnoanswer',ut[_0x68ef('0xa1')](_0x2cf7d3,_0x68ef('0x140'),this[_0x68ef('0x13')][_0x2cf7d3['queue']]));this[_0x68ef('0xef')](_0x2a5f7e,_0x1600cc,_0x272060);}else{_0x2cf7d3[_0x68ef('0x8a')]=moment()[_0x68ef('0x55')](_0x68ef('0x8b'));ut['logAgent'](_0x2a5f7e,0x4,'Answer');rpcDb[_0x68ef('0xf3')](_0x2a5f7e,_0x68ef('0x141'));}}};Preview[_0x68ef('0xf')]['syncHangup']=function(_0x1b507e){var _0x31219b=this;var _0x1745d3=this[_0x68ef('0x16')][_0x1b507e[_0x68ef('0xab')]];var _0x155d16;if(_0x1745d3){_0x155d16=this[_0x68ef('0x13')][_0x1745d3[_0x68ef('0x6f')]];logger[_0x68ef('0x6c')]('[syncHangup][talking]',_0x1b507e[_0x68ef('0xab')],_0x68ef('0xb0'),_0x155d16['name'],_0x68ef('0xb9'),_0x155d16[_0x68ef('0x2c')]);}if(this[_0x68ef('0x16')][_0x1b507e[_0x68ef('0xab')]]&&_0x1b507e['linkedid']!==_0x1b507e[_0x68ef('0xb8')]){if(_0x1b507e[_0x68ef('0x142')]==='16'&&this[_0x68ef('0x16')][_0x1b507e['linkedid']][_0x68ef('0x70')]){this['callProgressDetectingCustomer'](_0x1b507e,_0x1b507e['linkedid'],_0x1b507e['cause']);}else if(this[_0x68ef('0x16')][_0x1b507e[_0x68ef('0xab')]]['dialAnswer']){logger[_0x68ef('0x6c')]('[syncHangup][talking][cause]',_0x1b507e['linkedid'],_0x1b507e[_0x68ef('0x142')],_0x68ef('0xb0'),_0x155d16[_0x68ef('0x53')],_0x68ef('0xb9'),_0x155d16[_0x68ef('0x2c')]);this[_0x68ef('0x9c')](_0x1b507e,_0x1b507e[_0x68ef('0xab')],_0x1b507e[_0x68ef('0x142')]);}}else if(_0x1745d3&&_[_0x68ef('0xfc')](_0x1745d3[_0x68ef('0x143')])&&_0x155d16[_0x68ef('0x144')]&&_0x1b507e['linkedid']===_0x1b507e[_0x68ef('0xb8')]&&_[_0x68ef('0xfc')](_0x1b507e['reason'])&&_0x1b507e[_0x68ef('0x142')]==='16'&&_0x1b507e['channelstate']==='6'&&_[_0x68ef('0xf0')](_0x1745d3[_0x68ef('0x145')])){if(_0x1745d3[_0x68ef('0xaa')]){rpcDb['unlockContact'](_0x1745d3[_0x68ef('0x105')]);}if(_0x1745d3[_0x68ef('0xc3')]){rpcDb[_0x68ef('0x114')](_0x1745d3[_0x68ef('0x105')]);}_0x1b507e[_0x68ef('0xf8')]='22';this[_0x68ef('0xef')](_0x1745d3,_0x155d16,_0x1b507e);}else if(_0x1745d3&&_0x1745d3['transfer']){if(_0x1b507e['cause']==='16'&&this[_0x68ef('0x16')][_0x1b507e['linkedid']][_0x68ef('0x70')]){logger[_0x68ef('0x6c')](_0x68ef('0x146'),_0x1b507e[_0x68ef('0xab')],_0x1b507e[_0x68ef('0x142')],_0x68ef('0xb0'),_0x155d16[_0x68ef('0x53')],_0x68ef('0xb9'),_0x155d16['pTalking']);this[_0x68ef('0x9c')](_0x1b507e,_0x1b507e[_0x68ef('0xab')],_0x1b507e[_0x68ef('0x142')]);}else if(this['actions'][_0x1b507e[_0x68ef('0xab')]][_0x68ef('0x70')]){logger[_0x68ef('0x6c')](_0x68ef('0x147'),_0x1b507e[_0x68ef('0xab')],_0x1b507e[_0x68ef('0x142')],_0x68ef('0xb0'),_0x155d16[_0x68ef('0x53')],_0x68ef('0xb9'),_0x155d16['pTalking']);this['callProgressDetectingCustomer'](_0x1b507e,_0x1b507e[_0x68ef('0xab')],_0x1b507e[_0x68ef('0x142')]);}}};Preview['prototype'][_0x68ef('0x20')]=function(_0x39a89c){if(this['actions'][_0x39a89c['destlinkedid']]&&_0x39a89c['destlinkedid']!==_0x39a89c['destuniqueid']){this[_0x68ef('0x9c')](_0x39a89c,_0x39a89c['destlinkedid'],_0x39a89c[_0x68ef('0xe2')]);}};Preview['prototype'][_0x68ef('0x1e')]=function(_0x3d8eac){if(this['actions'][_0x3d8eac['linkedid']]&&_0x3d8eac['linkedid']!==_0x3d8eac[_0x68ef('0xb8')]&&!this[_0x68ef('0x16')][_0x3d8eac[_0x68ef('0xab')]]['dialAnswer']){if(_0x3d8eac[_0x68ef('0x142')]==='1'){this['callProgressDetectingCustomer'](_0x3d8eac,_0x3d8eac[_0x68ef('0xab')],_0x3d8eac['cause']);}}};Preview[_0x68ef('0xf')][_0x68ef('0x148')]=function(_0x35db11,_0x3909b1,_0x28c251){if(this[_0x68ef('0x16')][_0x35db11]){if(_[_0x68ef('0xfc')](this['actions'][_0x35db11][_0x68ef('0x149')])){this[_0x68ef('0x16')][_0x35db11][_0x68ef('0x149')]={};}this[_0x68ef('0x16')][_0x35db11][_0x68ef('0x149')][_0x3909b1]=_0x28c251;}};Preview[_0x68ef('0xf')][_0x68ef('0x23')]=function(_0x4bf1d7){try{if(!_[_0x68ef('0xfc')](_0x4bf1d7)){if(ut[_0x68ef('0x14a')](_[_0x68ef('0x14b')](_0x4bf1d7[_0x68ef('0x14c')])[0x0])){this[_0x68ef('0x148')](_0x4bf1d7[_0x68ef('0xb8')],_[_0x68ef('0x14b')](_0x4bf1d7[_0x68ef('0x14c')])[0x0],_0x4bf1d7[_0x68ef('0x14d')]);}}}catch(_0x40da26){logger[_0x68ef('0x14e')](_0x68ef('0x14f'),util['inspect'](_0x40da26,{'showHidden':![],'depth':null}));}};Preview[_0x68ef('0xf')][_0x68ef('0x24')]=function(_0x2ea696){if(_0x2ea696){if(this[_0x68ef('0x16')][_0x2ea696['transfertargetlinkedid']]){this['actions'][_0x2ea696['transfertargetlinkedid']][_0x68ef('0x145')]=!![];}}};Preview[_0x68ef('0xf')][_0x68ef('0x150')]=function(_0x2d7ff2){if(_0x2d7ff2){if(this['actions'][_0x2d7ff2['transfererlinkedid']]){this['actions'][_0x2d7ff2[_0x68ef('0x151')]][_0x68ef('0x145')]=!![];}}};module[_0x68ef('0x152')]=Preview; \ No newline at end of file +var _0x00bb=['[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','object','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','catch','Call\x20failed','logBlacklist','SIP/%s','status','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','[Preview][checkIsBlackList]','Empty\x20Contact','ACTIVE','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','phone','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','destlinkedid','destuniqueid','variables','syncVarSet','filterKey','variable','addVariable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','ioredis','../../../config/environment','preview','../../../config/logger','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','outbound','name','strategy','available','loggedIn','sumBillable','sumDuration','talking','total','type','unmanaged','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','isNil','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','pTalking','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime'];(function(_0x17e94e,_0x2f5ab6){var _0x15e14a=function(_0x40be27){while(--_0x40be27){_0x17e94e['push'](_0x17e94e['shift']());}};_0x15e14a(++_0x2f5ab6);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var BPromise=require(_0xb00b('0x2'));var uuid=require('uuid');var moment=require(_0xb00b('0x3'));var md5=require('md5');var Redis=require(_0xb00b('0x4'));var config=require(_0xb00b('0x5'));var logger=require('../../../config/logger')(_0xb00b('0x6'));var loggerAction=require(_0xb00b('0x7'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xb00b('0x8'));var ut=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitCampaignPreview(_0x3501af){if(_0x3501af['type']===_0xb00b('0x24')){var _0x4df284={'id':_0x3501af['id'],'name':_0x3501af[_0xb00b('0x25')],'strategy':_0x3501af[_0xb00b('0x26')],'answered':_0x3501af['answered'],'available':_0x3501af[_0xb00b('0x27')],'loggedIn':_0x3501af[_0xb00b('0x28')],'pTalking':_0x3501af['pTalking'],'sumBillable':_0x3501af[_0xb00b('0x29')],'sumDuration':_0x3501af[_0xb00b('0x2a')],'sumHoldTime':_0x3501af['sumHoldTime']||0x0,'talking':_0x3501af[_0xb00b('0x2b')],'total':_0x3501af[_0xb00b('0x2c')],'type':_0x3501af[_0xb00b('0x2d')],'unmanaged':_0x3501af[_0xb00b('0x2e')],'abandoned':_0x3501af['abandoned'],'waiting':_0x3501af['waiting'],'loggedInDb':_0x3501af[_0xb00b('0x2f')],'dialActive':_0x3501af['dialActive'],'dialMethod':_0x3501af['dialMethod'],'dialOriginateCallerIdName':_0x3501af['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3501af[_0xb00b('0x30')],'dialOriginateTimeout':_0x3501af[_0xb00b('0x31')],'dialPrefix':_0x3501af[_0xb00b('0x32')],'outboundAnswerAgiCallsDay':_0x3501af[_0xb00b('0x33')],'outboundAnswerCallsDay':_0x3501af[_0xb00b('0x34')],'outboundBlacklistCallsDay':_0x3501af[_0xb00b('0x35')],'outboundBusyCallsDay':_0x3501af[_0xb00b('0x36')],'outboundCongestionCallsDay':_0x3501af['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3501af[_0xb00b('0x37')],'outboundDropCallsDayCallersExit':_0x3501af['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3501af[_0xb00b('0x38')],'outboundNoAnswerCallsDay':_0x3501af[_0xb00b('0x39')],'outboundNoSuchCallsDay':_0x3501af[_0xb00b('0x3a')],'outboundOriginateFailureCallsDay':_0x3501af['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3501af[_0xb00b('0x3b')],'outboundRejectCallsDay':_0x3501af[_0xb00b('0x3c')],'outboundUnknownCallsDay':_0x3501af[_0xb00b('0x3d')],'outboundAbandonedCallsDay':_0x3501af[_0xb00b('0x3e')],'predictiveIntervalAnsweredCalls':_0x3501af[_0xb00b('0x3f')],'predictiveIntervalAvgHoldtime':_0x3501af[_0xb00b('0x40')],'predictiveIntervalAvgTalktime':_0x3501af[_0xb00b('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x3501af[_0xb00b('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x3501af[_0xb00b('0x43')],'predictiveIntervalErlangCalls':_0x3501af['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3501af[_0xb00b('0x44')],'predictiveIntervalHitRate':_0x3501af[_0xb00b('0x45')],'predictiveIntervalMultiplicativeFactor':_0x3501af['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3501af[_0xb00b('0x46')],'predictiveIntervalAvailable':_0x3501af[_0xb00b('0x47')],'predictiveIntervalTotalCalls':_0x3501af['predictiveIntervalTotalCalls'],'message':_0x3501af[_0xb00b('0x48')],'originated':_0x3501af['originated'],'erlangCalls':_0x3501af[_0xb00b('0x49')],'erlangCallToSecond':_0x3501af[_0xb00b('0x4a')],'erlangAbandonmentRate':_0x3501af[_0xb00b('0x4b')],'erlangBusyFactor':_0x3501af[_0xb00b('0x4c')],'startPredictive':_0x3501af[_0xb00b('0x4d')],'startProgressive':_0x3501af[_0xb00b('0x4e')]};if(_0x3501af[_0xb00b('0x4f')]){_0x4df284['Trunk']={'id':_0x3501af['Trunk']['id'],'name':_0x3501af['Trunk'][_0xb00b('0x25')],'active':_0x3501af[_0xb00b('0x4f')][_0xb00b('0x50')],'callerid':_0x3501af[_0xb00b('0x4f')]['callerid']};}if(_0x3501af[_0xb00b('0x51')]){_0x4df284[_0xb00b('0x51')]={'id':_0x3501af[_0xb00b('0x51')]['id'],'name':_0x3501af[_0xb00b('0x51')][_0xb00b('0x25')]};}var _0x39da49=md5(JSON[_0xb00b('0x52')](_0x4df284));if(_0x3501af[_0xb00b('0x53')]!==_0x39da49){_0x3501af['md5']=_0x39da49;emit(util['format'](_0xb00b('0x54'),_0x4df284['name']),_0xb00b('0x55'),_0x4df284);}}}function emitVoiceQueueChannelRemove(_0x1c5400){logger[_0xb00b('0x56')](_0xb00b('0x57'),JSON[_0xb00b('0x52')](_0x1c5400));emit(util[_0xb00b('0x58')](_0xb00b('0x54'),_0x1c5400['name']),_0xb00b('0x59'),_0x1c5400);io[_0xb00b('0x23')](_0xb00b('0x5a'),_0x1c5400);}function notSendMessagesQueue(_0xd9c03f){if(_0xd9c03f[_0xb00b('0x5b')]){if(_0xd9c03f[_0xb00b('0x5c')]===0x0&&_0xd9c03f['pTalking']===0x0){_0xd9c03f[_0xb00b('0x5b')]=![];_0xd9c03f[_0xb00b('0x27')]=0x0;_0xd9c03f['paused']=0x0;_0xd9c03f[_0xb00b('0x48')]=_0xb00b('0x5d');ut[_0xb00b('0x5e')](_0xb00b('0x5f'),_0xd9c03f[_0xb00b('0x25')]+'\x20is\x20not\x20active');}else{_0xd9c03f[_0xb00b('0x48')]=_0xb00b('0x60');ut[_0xb00b('0x5e')](_0xb00b('0x5f'),_0xd9c03f['name']+'\x20is\x20disactive');}emitCampaignPreview(_0xd9c03f);}}Preview[_0xb00b('0xd')][_0xb00b('0x61')]=function(){var _0x10a348=this;setInterval(function(){_0x10a348[_0xb00b('0x62')]();},0x7cf);};Preview[_0xb00b('0xd')][_0xb00b('0x62')]=function(){var _0x275664=this['campaignsPreview'];this[_0xb00b('0x63')]+=0x1;for(var _0x3b72c4 in _0x275664){if(_0x275664[_0xb00b('0x64')](_0x3b72c4)&&(_0x275664[_0x3b72c4][_0xb00b('0x65')]===_0xb00b('0x6')||_0x275664[_0x3b72c4][_0xb00b('0x65')]===_0xb00b('0x66'))&&_0x275664[_0x3b72c4][_0xb00b('0x2d')]===_0xb00b('0x24')){if(this[_0xb00b('0x63')]>0x7){this[_0xb00b('0x63')]=0x0;this[_0xb00b('0x67')]();}}if(_0x275664['hasOwnProperty'](_0x3b72c4)&&_0x275664[_0x3b72c4][_0xb00b('0x65')]===_0xb00b('0x6')&&_0x275664[_0x3b72c4][_0xb00b('0x2d')]===_0xb00b('0x24')){if(_0x275664[_0x3b72c4][_0xb00b('0x68')]){this[_0xb00b('0x69')](_0x275664[_0x3b72c4]);if(_0x275664[_0x3b72c4][_0xb00b('0x6a')])this[_0xb00b('0x6b')](_0x275664[_0x3b72c4]);}else{notSendMessagesQueue(_0x275664[_0x3b72c4]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x6c')]=function(_0x1eec12){var _0x3b3031=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x3b3031[_0xb00b('0x13')][_0x1eec12])){loggerAction[_0xb00b('0x56')]('[clearZombieChannels][talking]',_0x1eec12,_0xb00b('0x6d'),_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')],_0xb00b('0x6f'),JSON['stringify'](_0x3b3031['campaignsPreview'][_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x52')](_0x3b3031[_0xb00b('0x22')][_0x3b3031['actions'][_0x1eec12][_0xb00b('0x6e')]]['pTalking']),JSON['stringify'](_0x3b3031['actions'][_0x1eec12][_0xb00b('0x70')]),JSON['stringify'](_[_0xb00b('0x71')](_0x3b3031[_0xb00b('0x13')][_0x1eec12],[_0xb00b('0x72'),_0xb00b('0x73'),_0xb00b('0x74'),_0xb00b('0x75')])));return ami['Action']({'action':'status','channel':_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x76')]})['catch'](function(_0x114750){if(_0x114750[_0xb00b('0x48')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3b3031[_0xb00b('0x13')][_0x1eec12]){ut[_0xb00b('0x77')](_0x3b3031[_0xb00b('0x22')][_0x3b3031['actions'][_0x1eec12]['queue']],_0xb00b('0x78'));if(_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x70')]===!![]){ut[_0xb00b('0x79')](_0x3b3031['campaignsPreview'][_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')]],'[clearZombieChannel]');ut['loggerError'](_0xb00b('0x7a')+_0x1eec12,_0x3b3031['actions'][_0x1eec12][_0xb00b('0x6e')]);}ut[_0xb00b('0x7b')](_0xb00b('0x7c')+_0x1eec12,_0x3b3031[_0xb00b('0x13')][_0x1eec12][_0xb00b('0x6e')]);delete _0x3b3031[_0xb00b('0x13')][_0x1eec12];}},0x2328);}});}});};Preview['prototype'][_0xb00b('0x67')]=function(){var _0x51c9e3=this;loggerAction[_0xb00b('0x56')](_0xb00b('0x7d'),_[_0xb00b('0x7e')](this['actions']));for(var _0x248335 in this[_0xb00b('0x13')]){if(_0x51c9e3[_0xb00b('0x13')]['hasOwnProperty'](_0x248335)){_0x51c9e3[_0xb00b('0x6c')](_0x248335);}}};Preview[_0xb00b('0xd')][_0xb00b('0x6b')]=function(_0x385029){var _0x131848=this;rpcDb[_0xb00b('0x7f')](_0x385029['id'],ut[_0xb00b('0x80')](this[_0xb00b('0x14')]))['then'](function(_0x153551){if(!_[_0xb00b('0x81')](_0x153551)){for(var _0x1b4860=0x0;_0x1b4860<_0x153551['length'];_0x1b4860+=0x1){if(ut[_0xb00b('0x82')](_0x153551[_0x1b4860][_0xb00b('0x83')])<_0x385029[_0xb00b('0x84')]*0x3c){if(_0x153551[_0x1b4860][_0xb00b('0x85')]&&!_0x153551[_0x1b4860][_0xb00b('0x85')]['voicePause']){_0x131848[_0xb00b('0x86')](_0x153551[_0x1b4860]['id'])[_0xb00b('0x87')](ut[_0xb00b('0x88')](_0xb00b('0x89')))['catch'](ut[_0xb00b('0x88')](_0xb00b('0x89')));}else{rpcDb[_0xb00b('0x8a')](_0x153551[_0x1b4860]['id']);}}else{var _0x2d73bb=new Action(_0x153551[_0x1b4860],_0x385029);_0x2d73bb[_0xb00b('0x8b')]=moment()[_0xb00b('0x58')](_0xb00b('0x8c'));_0x385029['outboundReCallsDay']+=0x1;ut[_0xb00b('0x8d')](_0x2d73bb,0x17,'RecallInQueue');if(_0x385029[_0xb00b('0x8e')]){rpcDb['rescheduleContactInQueue'](ut[_0xb00b('0x8f')](_0x153551[_0x1b4860]));rpcDb['createCustomerHistory'](_0x2d73bb,_0xb00b('0x90'));}else{ut['logCustomer'](_0x2d73bb,0x16,_0xb00b('0x91'));rpcDb[_0xb00b('0x92')](_0x2d73bb,_0xb00b('0x93'));rpcDb['createCustomerFinal'](_0x2d73bb,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xb00b('0x88')](_0xb00b('0x94')));};Preview[_0xb00b('0xd')]['setMessage']=function(_0x311f49){_0x311f49[_0xb00b('0x5b')]=!![];if(ut[_0xb00b('0x95')](_0x311f49[_0xb00b('0x28')])){_0x311f49[_0xb00b('0x48')]='AGENTS_NOT_LOGGED';}else if(!ut[_0xb00b('0x96')](_0x311f49[_0xb00b('0x68')])){_0x311f49['message']=_0xb00b('0x5d');}else if(!this[_0xb00b('0x97')](_0x311f49[_0xb00b('0x4f')])){if(!this['isTrunkReachable'](_0x311f49['TrunkBackup'])){_0x311f49[_0xb00b('0x48')]=_0xb00b('0x98');}else{_0x311f49[_0xb00b('0x48')]='ACTIVE';}}else{_0x311f49['message']='ACTIVE';}emitCampaignPreview(_0x311f49);};Preview['prototype'][_0xb00b('0x99')]=function(_0x4df7fa,_0x2434a0,_0x30c0a7){var _0x53dd22=this;var _0x7523d5=this[_0xb00b('0x13')][_0x2434a0];var _0x2d21ec=this[_0xb00b('0x22')][_0x7523d5[_0xb00b('0x6e')]];var _0x48a57e;if(_0x2d21ec){switch(_0x30c0a7){case'1':_0x2d21ec[_0xb00b('0x3a')]+=0x1;_0x7523d5[_0xb00b('0x9a')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x0,_0xb00b('0x9d'));ami[_0xb00b('0x23')]('custom:agentnosuchnumber',ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0x9f')));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xa0'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb['createCustomerFinal'](_0x48a57e,_0xb00b('0xa4'));}else{if(_0x7523d5[_0xb00b('0x9a')]>=_0x2d21ec[_0xb00b('0xa5')]){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xa4'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,_0xb00b('0x9a'),_0x2d21ec['dialNoSuchNumberRetryFrequency']),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;case _0xb00b('0xac'):var _0x376adc=moment()[_0xb00b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x7523d5[_0xb00b('0xad')]=_0x376adc;_0x7523d5[_0xb00b('0xae')]=_0x376adc;_0x7523d5[_0xb00b('0x70')]=!![];_0x2d21ec[_0xb00b('0xaf')]+=0x1;logger[_0xb00b('0x56')](_0xb00b('0xb0'),_0x7523d5['uniqueid'],_0xb00b('0xb1'),_0x2d21ec['name'],_0xb00b('0xb2'),_0x2d21ec['pTalking']);ami[_0xb00b('0x23')](_0xb00b('0xb3'),ut[_0xb00b('0x9e')](_0x7523d5,'connect',this['campaignsPreview'][_0x7523d5[_0xb00b('0x6e')]]));if(_0x2d21ec[_0xb00b('0xb4')]){ami[_0xb00b('0x23')](_0xb00b('0xb5'),ut[_0xb00b('0xb6')](_0x7523d5));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0xb7'),ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0xb8'),this[_0xb00b('0x22')][_0x7523d5[_0xb00b('0x6e')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0xb8')));_0x2d21ec[_0xb00b('0x34')]+=0x1;_0x2d21ec['total']+=0x1;_0x2d21ec['answered']+=0x1;ut[_0xb00b('0x79')](_0x2d21ec,_0xb00b('0xb9'));_0x7523d5['countglobal']=ut['totalGlobal'](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x4,_0xb00b('0xba'));rpcDb[_0xb00b('0x92')](_0x7523d5,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xbb'));rpcDb[_0xb00b('0xbc')](_0x7523d5);_0x2d21ec[_0xb00b('0x2a')]+=_0x7523d5[_0xb00b('0xbd')];_0x2d21ec[_0xb00b('0x29')]+=_0x7523d5[_0xb00b('0xbd')];logger['info'](_0xb00b('0xbe'),_0x7523d5['uniqueid'],_0xb00b('0xb1'),_0x2d21ec[_0xb00b('0x25')],'pTalking:\x20',_0x2d21ec[_0xb00b('0xaf')]);delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;case _0xb00b('0xbf'):_0x2d21ec[_0xb00b('0x36')]+=0x1;_0x7523d5[_0xb00b('0xc0')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x5,_0xb00b('0xc1'));ami[_0xb00b('0x23')](_0xb00b('0xc2'),ut['buildObj'](_0x7523d5,_0xb00b('0xc3')));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xc4'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xc5'));}else{if(_0x7523d5[_0xb00b('0xc0')]>=_0x2d21ec['dialBusyMaxRetry']){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,'countbusyretry',_0x2d21ec[_0xb00b('0xc6')]),_0x7523d5['unlockAgent'],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xc7'):_0x2d21ec[_0xb00b('0x39')]+=0x1;_0x7523d5[_0xb00b('0xc8')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x3,_0xb00b('0xc9'));ami[_0xb00b('0x23')](_0xb00b('0xca'),ut[_0xb00b('0x9e')](_0x7523d5,'noanswer'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xcb'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x7523d5[_0xb00b('0xc8')]>=_0x2d21ec['dialNoAnswerMaxRetry']){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xcb'));}else{rpcDb[_0xb00b('0xa7')](ut['scheduledAt'](_0x7523d5,_0xb00b('0xc8'),_0x2d21ec[_0xb00b('0xcc')]),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xcd'):_0x2d21ec[_0xb00b('0xce')]+=0x1;_0x7523d5[_0xb00b('0xcf')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut['logCustomer'](_0x7523d5,0x8,'Congestion');ami[_0xb00b('0x23')](_0xb00b('0xd0'),ut[_0xb00b('0x9e')](_0x7523d5,_0xb00b('0xd1')));rpcDb['createCustomerHistory'](_0x7523d5,_0xb00b('0xd2'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x7523d5[_0xb00b('0xcf')]>=_0x2d21ec[_0xb00b('0xd3')]){rpcDb['createCustomerFinal'](_0x7523d5,_0xb00b('0xd2'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,_0xb00b('0xcf'),_0x2d21ec[_0xb00b('0xc6')]),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xd4'):_0x2d21ec['outboundRejectCallsDay']+=0x1;_0x7523d5[_0xb00b('0xd5')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x14,'AgentReject');ami[_0xb00b('0x23')]('custom:agentreject',ut[_0xb00b('0x9e')](_0x7523d5,'agentreject'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xd6'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0x14,'AgentReject');rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xd7'));}else{if(_0x7523d5['countagentrejectretry']>=_0x2d21ec[_0xb00b('0xd8')]){rpcDb['createCustomerFinal'](_0x7523d5,_0xb00b('0xd7'));}else{rpcDb[_0xb00b('0xa7')](ut[_0xb00b('0xa8')](_0x7523d5,_0xb00b('0xd5'),_0x2d21ec['dialAgentRejectRetryFrequency']),_0x7523d5[_0xb00b('0xa9')],_0x7523d5[_0xb00b('0xaa')]);}}break;case _0xb00b('0xd9'):_0x2d21ec[_0xb00b('0x3e')]+=0x1;_0x7523d5[_0xb00b('0xda')]+=0x1;_0x7523d5['countglobal']=ut['totalGlobal'](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0xb,_0xb00b('0xdb'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xdc'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xdc'));}else{if(_0x7523d5[_0xb00b('0xdd')]>=_0x2d21ec[_0xb00b('0xde')]){rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xdc'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0xa8')](_0x7523d5,'countabandonedretry',_0x2d21ec[_0xb00b('0xdf')]),_0x7523d5['unlockAgent'],_0x7523d5[_0xb00b('0xaa')]);}}break;case'18':_0x2d21ec[_0xb00b('0x3d')]+=0x1;_0x7523d5[_0xb00b('0xe0')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x12,_0x4df7fa[_0xb00b('0xe1')]||_0x4df7fa[_0xb00b('0xe2')]);ami[_0xb00b('0x23')](_0xb00b('0xe3'),ut[_0xb00b('0x9e')](_0x7523d5,'amd'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xe4'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0xa6')](_0x7523d5,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;case'19':_0x2d21ec['outboundUnknownCallsDay']+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut[_0xb00b('0x9c')](_0x7523d5);ut[_0xb00b('0x8d')](_0x7523d5,0x13,_0x4df7fa[_0xb00b('0xe1')]||_0x4df7fa[_0xb00b('0xe2')]);ami[_0xb00b('0x23')]('custom:amd',ut[_0xb00b('0x9e')](_0x7523d5,'amd'));rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xe5'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec[_0xb00b('0xa1')]){_0x48a57e=ut['cloneAction'](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xe5'));}else{rpcDb['createCustomerFinal'](_0x7523d5,_0xb00b('0xe5'));}delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];break;default:if(_0x7523d5[_0xb00b('0x70')]){ut['decrementTalkink'](_0x2d21ec,_0xb00b('0xe6'));ut[_0xb00b('0x7b')](_0xb00b('0xe7')+_0x2d21ec[_0xb00b('0x25')],_0x4df7fa);}_0x2d21ec[_0xb00b('0x3d')]+=0x1;_0x7523d5[_0xb00b('0x9b')]=ut['totalGlobal'](_0x7523d5);ut['logCustomer'](_0x7523d5,0xc,_0x4df7fa[_0xb00b('0xe1')]||_0x4df7fa[_0xb00b('0xe2')]);rpcDb[_0xb00b('0x92')](_0x7523d5,_0xb00b('0xe8'));if(ut[_0xb00b('0x9c')](_0x7523d5)>=_0x2d21ec['dialGlobalMaxRetry']){_0x48a57e=ut[_0xb00b('0xa2')](_0x7523d5,0xf,_0xb00b('0xa3'));rpcDb[_0xb00b('0xa6')](_0x48a57e,_0xb00b('0xe9'));}else{rpcDb[_0xb00b('0xa6')](_0x7523d5,_0xb00b('0xe9'));}delete this['actions'][_0x4df7fa[_0xb00b('0xab')]];}if(!(_0x7523d5[_0xb00b('0x70')]&&_0x30c0a7==='16')){ut[_0xb00b('0x77')](_0x2d21ec,_0xb00b('0xea'));logger[_0xb00b('0x56')](_0xb00b('0xeb'),_0x7523d5[_0xb00b('0xec')],_0xb00b('0xb1'),_0x2d21ec[_0xb00b('0x25')],_0xb00b('0x6f'),_0x2d21ec['originated']);}if(_0x30c0a7!=='ANSWER'){delete this[_0xb00b('0x13')][_0x4df7fa[_0xb00b('0xab')]];delete this[_0xb00b('0x13')][_0x4df7fa['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0xf6c3bc,_0x1e50ca,_0xce62a){if(_['isUndefined'](_0x1e50ca)&&_0xb00b('0xed')!==typeof _0x1e50ca){return;}if(_[_0xb00b('0xee')](_0xce62a)&&_0xb00b('0xed')!==typeof _0xce62a){return;}switch(_0xce62a[_0xb00b('0xef')]){case'0':ut['logAgent'](_0xf6c3bc,0x0,_0xb00b('0x9d'));rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf1'));break;case'3':ut[_0xb00b('0xf2')](_0xf6c3bc,0x3,_0xb00b('0xc9'));rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf3'));break;case'5':ut[_0xb00b('0xf2')](_0xf6c3bc,0x5,'Busy');rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf4'));break;case'8':ut[_0xb00b('0xf2')](_0xf6c3bc,0x8,_0xb00b('0xf5'));rpcDb[_0xb00b('0xf0')](_0xf6c3bc,_0xb00b('0xf6'));break;case'22':ut[_0xb00b('0xf2')](_0xf6c3bc,0x16,_0xb00b('0xf7'));rpcDb['createAgentHistory'](_0xf6c3bc,_0xb00b('0xf8'));break;default:ut[_0xb00b('0xf2')](_0xf6c3bc,0xc,_0xce62a[_0xb00b('0xef')]);rpcDb[_0xb00b('0xf0')](_0xf6c3bc,'[callProgressDetectingAgent][logCongestion]');}ut[_0xb00b('0x77')](_0x1e50ca,_0xb00b('0xf9'));logger[_0xb00b('0x56')](_0xb00b('0xfa'),_0xf6c3bc[_0xb00b('0xec')],_0xb00b('0xb1'),_0x1e50ca[_0xb00b('0x25')],_0xb00b('0x6f'),_0x1e50ca['originated']);delete this['actions'][_0xf6c3bc[_0xb00b('0xec')]];};Preview[_0xb00b('0xd')][_0xb00b('0xfb')]=function(_0x58894a,_0x3aa890,_0xdf20d6,_0xfae545,_0x581548){var _0x44d3c0=this;return new BPromise(function(_0x3d5880,_0x3d9e1e){if(_['isNil'](_0x3aa890)||_['isNil'](_0x3aa890[_0xb00b('0xfc')])||_['isNil'](_0x3aa890[_0xb00b('0xfc')]['phone'])||_['isNil'](_0x3aa890[_0xb00b('0x74')])){_0x3d9e1e(ut[_0xb00b('0x48')](_0xb00b('0xfd'),_0xfae545,_0x581548));return;}var _0xcbfe37=uuid['v4']();var _0x41ee74=_0x44d3c0['campaignsPreview'][_0x3aa890[_0xb00b('0x6d')]['name']];var _0x592206=_0xdf20d6?_0x44d3c0[_0xb00b('0x14')][_0xdf20d6]['id']:undefined;_0x44d3c0[_0xb00b('0x13')][_0xcbfe37]=new Action(_0x3aa890,_0x41ee74,_0xcbfe37,_0xdf20d6,_0x592206);var _0xf3a747=_0x44d3c0[_0xb00b('0x13')][_0xcbfe37];_0xf3a747[_0xb00b('0xa9')]=_0xfae545;_0xf3a747[_0xb00b('0xaa')]=_0x581548;_0xf3a747['lookAgent']=_0xdf20d6;if(_[_0xb00b('0xfe')](_0x58894a)){_0x44d3c0['execCall'](_0xf3a747,_0x41ee74,_0x3aa890,_0xdf20d6)[_0xb00b('0x87')](function(_0x8abc0b){logger[_0xb00b('0x56')]('[Preview][execCall][success]',_0xb00b('0xff')+_0xf3a747[_0xb00b('0x6e')]+_0xb00b('0x100')+_0xf3a747[_0xb00b('0x101')],JSON['stringify'](_0x8abc0b));ami['emit'](_0xb00b('0x102'),ut['buildObj'](_0xf3a747,'called',_0x44d3c0[_0xb00b('0x22')][_0xf3a747['queue']]));_0x3d5880(ut['message'](_0xb00b('0x103')));})[_0xb00b('0x104')](function(_0x745803){ut[_0xb00b('0x5e')]('[Preview][execCall][failure]',_0x745803);_0x3d9e1e(ut['message'](_0xb00b('0x105'),_0xfae545,_0x581548));});}else{_0x41ee74[_0xb00b('0x35')]+=0x1;ut[_0xb00b('0x106')](_0xf3a747);rpcDb['createHistory'](_0xf3a747,'[Blacklist][error]');delete _0x44d3c0[_0xb00b('0x13')][_0xcbfe37];_0x3d9e1e(ut['message']('Contact\x20in\x20black\x20List',_0xfae545,_0x581548));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x291010){return!_['isNil'](_0x291010)&&!_[_0xb00b('0x81')](_0x291010['name'])&&!_[_0xb00b('0x81')](_0x291010[_0xb00b('0x50')])&&_0x291010[_0xb00b('0x50')]&&!_['isNil'](this[_0xb00b('0x12')][util['format'](_0xb00b('0x107'),_0x291010[_0xb00b('0x25')])])&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x291010[_0xb00b('0x25')])]['status'])&&(this[_0xb00b('0x12')][util['format'](_0xb00b('0x107'),_0x291010[_0xb00b('0x25')])][_0xb00b('0x108')]===_0xb00b('0x109')||this[_0xb00b('0x12')][util['format'](_0xb00b('0x107'),_0x291010[_0xb00b('0x25')])][_0xb00b('0x108')]===_0xb00b('0x10a'));};Preview['prototype']['run']=function(_0xe1f667,_0xfee3f5){var _0x181393=this;return new BPromise(function(_0x226d78,_0xa100a4){_0x181393[_0xb00b('0x10b')](_0xe1f667,_0xfee3f5)[_0xb00b('0x87')](function(_0x8dc8f7){_0x226d78(_[_0xb00b('0x71')](_0x8dc8f7,['message']));})[_0xb00b('0x104')](function(_0x2fd7f1){if(_0x2fd7f1['unlock']){rpcDb[_0xb00b('0x10c')](_0xe1f667);}if(_0x2fd7f1['active']){rpcDb[_0xb00b('0x8a')](_0xe1f667);}_0xa100a4(_[_0xb00b('0x71')](_0x2fd7f1,['message']));});});};Preview['prototype'][_0xb00b('0x10b')]=function(_0x3b9285,_0x240f04){var _0x4a5a72=this;return new BPromise(function(_0x3b3a53,_0x69b160){var _0x9acbff,_0x47a0b8;rpcDb[_0xb00b('0x10d')](_0x3b9285)['then'](function(_0x5bf454){if(!_['isNil'](_0x5bf454[0x0])){_0x47a0b8=_0x5bf454[0x0][_0xb00b('0x10e')]?![]:!![];_0x9acbff=_0x5bf454[0x0]['recallme']?!![]:![];_0x9acbff=_0x240f04?!![]:_0x9acbff;}var _0x1b8d45=_0x4a5a72[_0xb00b('0x10f')](_0x5bf454);if(_0x1b8d45['isValid']){rpcDb['checkIsBlackList'](_[_0xb00b('0x71')](_0x5bf454[0x0],[_0xb00b('0x74'),'Contact.phone']))[_0xb00b('0x87')](function(_0x3bcd75){_0x4a5a72[_0xb00b('0xfb')](_0x3bcd75,_0x5bf454[0x0],_0x240f04,_0x47a0b8,_0x9acbff)[_0xb00b('0x87')](function(_0x1ceb60){_0x3b3a53(_0x1ceb60);})[_0xb00b('0x104')](function(_0x49cfd5){_0x69b160(_0x49cfd5);});})[_0xb00b('0x104')](function(_0x22b425){ut['logger'](_0xb00b('0x110'),_0x22b425);_0x69b160(ut['message']('Call\x20unsuccessful',_0x47a0b8,_0x9acbff));});}else{_0x69b160(ut[_0xb00b('0x48')](_0x1b8d45['message'],_0x47a0b8,_0x9acbff));}})[_0xb00b('0x104')](function(_0xd75be6){ut[_0xb00b('0x5e')]('[Preview][getContactPreview]',_0xd75be6);_0x69b160(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0xb00b('0xd')][_0xb00b('0x10f')]=function(_0x4cb653){if(_[_0xb00b('0x81')](_0x4cb653)||_[_0xb00b('0xfe')](_0x4cb653)||!_[_0xb00b('0x81')](_0x4cb653[0x0][_0xb00b('0x85')])&&_[_0xb00b('0x81')](_0x4cb653[0x0][_0xb00b('0x85')][_0xb00b('0x25')])){ut[_0xb00b('0x5e')]('[Preview][validateContact][Empty\x20Contact]',_0x4cb653);return{'isValid':![],'message':_0xb00b('0x111')};}var _0x3da033=this[_0xb00b('0x22')][_0x4cb653[0x0]['Queue']['name']];_0x3da033['message']=_0xb00b('0x112');if(_[_0xb00b('0x81')](_0x3da033)){ut[_0xb00b('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x3da033);return{'isValid':![],'message':_0xb00b('0x113')};}if(!this[_0xb00b('0x97')](_0x3da033[_0xb00b('0x4f')])){ut[_0xb00b('0x5e')](_0xb00b('0x114'),'campaign\x20Name:\x20'+_0x3da033[_0xb00b('0x25')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xb00b('0x97')](_0x3da033[_0xb00b('0x115')])){ut[_0xb00b('0x5e')](_0xb00b('0x114'),_0x3da033[_0xb00b('0x25')]+_0xb00b('0x116'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xb00b('0x96')](_0x3da033[_0xb00b('0x68')])){ut[_0xb00b('0x5e')](_0xb00b('0x117'),_0x3da033[_0xb00b('0x25')]+_0xb00b('0x118'));return{'isValid':![],'message':_0xb00b('0x119')+_0x3da033[_0xb00b('0x25')]+_0xb00b('0x118')};}return{'isValid':!![],'message':_0xb00b('0x11a')};};Preview['prototype'][_0xb00b('0x11b')]=function(_0x33952b,_0x4cd459,_0x3c4684,_0x5175c6){var _0x4c1a3a=this;return new BPromise(function(_0x5c95c2,_0x384a16){var _0x4d6930=_0x33952b[_0xb00b('0xec')];var _0x2cfe9f=_0x4c1a3a[_0xb00b('0x97')](_0x4cd459[_0xb00b('0x4f')])?util[_0xb00b('0x58')](_0xb00b('0x11c'),_0x4cd459[_0xb00b('0x4f')][_0xb00b('0x25')],_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x32')])?'':_0x4cd459[_0xb00b('0x32')][_0xb00b('0x11d')]()||'',_0x4cd459[_0xb00b('0x11e')]>0x0?_0x3c4684[_0xb00b('0xfc')]['phone'][_0xb00b('0x11f')](_0x4cd459[_0xb00b('0x11e')]):_0x3c4684[_0xb00b('0xfc')][_0xb00b('0x120')]):util[_0xb00b('0x58')]('SIP/%s/%s%s',_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x115')])?_0x4cd459['Trunk']['name']:_0x4cd459[_0xb00b('0x115')][_0xb00b('0x25')],_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x32')])?'':_0x4cd459[_0xb00b('0x32')][_0xb00b('0x11d')]()||'',_0x4cd459[_0xb00b('0x11e')]>0x0?_0x3c4684[_0xb00b('0xfc')][_0xb00b('0x120')][_0xb00b('0x11f')](_0x4cd459[_0xb00b('0x11e')]):_0x3c4684['Contact'][_0xb00b('0x120')]);var _0x4d067a=_0x4c1a3a[_0xb00b('0x97')](_0x4cd459[_0xb00b('0x4f')])?ut[_0xb00b('0x121')](_0x4cd459[_0xb00b('0x4f')][_0xb00b('0x122')],_0x4cd459[_0xb00b('0x123')],_0x4cd459['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x124')](_0x4cd459[_0xb00b('0x30')],_0x4cd459[_0xb00b('0x125')]):_0x4cd459[_0xb00b('0x30')]):ut['getCallerId'](_[_0xb00b('0x81')](_0x4cd459[_0xb00b('0x115')])?_0x4cd459['Trunk'][_0xb00b('0x122')]:_0x4cd459[_0xb00b('0x115')][_0xb00b('0x122')],_0x4cd459[_0xb00b('0x123')],_0x4cd459[_0xb00b('0x125')]>0x0?ut[_0xb00b('0x124')](_0x4cd459[_0xb00b('0x30')],_0x4cd459[_0xb00b('0x125')]):_0x4cd459[_0xb00b('0x30')]);if(_0x4d067a){_0x33952b['originatecalleridname']=ut[_0xb00b('0x126')](_0x4d067a);_0x33952b[_0xb00b('0x127')]=ut['extractCalleridNumber'](_0x4d067a);}var _0x51995c=ut[_0xb00b('0x128')](_0x4cd459,_0x3c4684,_0x2cfe9f,_0x4d067a,_0x4d6930,_0x33952b);_[_0xb00b('0x129')](_0x33952b,ut[_0xb00b('0x12a')](_0x51995c));_0x33952b[_0xb00b('0x8b')]=moment()[_0xb00b('0x58')](_0xb00b('0x8c'));ami[_0xb00b('0x12b')](ut[_0xb00b('0x12c')](_0x33952b,_0x4cd459,_0x51995c,_0x33952b[_0xb00b('0xaa')],_0x5175c6))[_0xb00b('0x87')](function(_0x5943a2){_0x4cd459[_0xb00b('0x5c')]+=0x1;logger[_0xb00b('0x56')](_0xb00b('0x12d'),_0x4d6930,'\x20Queue',_0x4cd459[_0xb00b('0x25')],_0xb00b('0x6f'),_0x4cd459[_0xb00b('0x5c')]);_0x5c95c2(_0x5943a2);})[_0xb00b('0x104')](function(_0x49ccb6){ut[_0xb00b('0xf2')](_0x33952b,0xe,_0xb00b('0x12e'));rpcDb['createAgentHistory'](_0x33952b,'[originateFailure][logOriginateFailure]');_0x384a16(_0x49ccb6);});});};Preview[_0xb00b('0xd')][_0xb00b('0x1d')]=function(_0x482f60){if(this[_0xb00b('0x13')][_0x482f60['linkedid']]){this['actions'][_0x482f60[_0xb00b('0xab')]]['channel']=_0x482f60['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x37d3d1){var _0xb34a7c=this;var _0x11e9b4=this[_0xb00b('0x13')][_0x37d3d1[_0xb00b('0x12f')]];if(_0x11e9b4){if(_0x11e9b4[_0xb00b('0x130')]&&this[_0xb00b('0x14')][_0x11e9b4[_0xb00b('0x130')]]){ut[_0xb00b('0x131')](_0x11e9b4,this[_0xb00b('0x14')][_0x11e9b4[_0xb00b('0x130')]][_0xb00b('0x25')],this['agents'][_0x11e9b4[_0xb00b('0x130')]]['id']);}var _0x388bf8=_['clone'](_0x11e9b4);_0x388bf8[_0xb00b('0xad')]=moment()['format'](_0xb00b('0x8c'));var _0x40546f=_0xb34a7c[_0xb00b('0x22')][_0x11e9b4['queue']];if(ut[_0xb00b('0x132')](_0x37d3d1[_0xb00b('0x133')])){if(_0x11e9b4['unlockAgent']){rpcDb[_0xb00b('0x10c')](_0x11e9b4[_0xb00b('0x101')]);}if(_0x11e9b4[_0xb00b('0xaa')]){rpcDb[_0xb00b('0x8a')](_0x11e9b4['idContact']);}ami[_0xb00b('0x23')](_0xb00b('0x134'),ut[_0xb00b('0x9e')](_0x11e9b4,'rejected',this['campaignsPreview'][_0x11e9b4['queue']]));this[_0xb00b('0x135')](_0x388bf8,_0x40546f,_0x37d3d1);}else{_0x11e9b4[_0xb00b('0x8b')]=moment()[_0xb00b('0x58')](_0xb00b('0x8c'));ut[_0xb00b('0xf2')](_0x388bf8,0x4,_0xb00b('0xba'));rpcDb[_0xb00b('0xf0')](_0x388bf8,_0xb00b('0x136'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0x59e4eb){var _0x5cee95=this;var _0x198da1=this['actions'][_0x59e4eb[_0xb00b('0xab')]];var _0x525fb3;if(_0x198da1){_0x525fb3=this[_0xb00b('0x22')][_0x198da1['queue']];logger[_0xb00b('0x56')](_0xb00b('0x137'),_0x59e4eb['linkedid'],_0xb00b('0xb1'),_0x525fb3[_0xb00b('0x25')],'pTalking:\x20',_0x525fb3[_0xb00b('0xaf')]);}if(this['actions'][_0x59e4eb[_0xb00b('0xab')]]&&_0x59e4eb[_0xb00b('0xab')]!==_0x59e4eb[_0xb00b('0xec')]){if(_0x59e4eb[_0xb00b('0x138')]==='16'&&this[_0xb00b('0x13')][_0x59e4eb[_0xb00b('0xab')]][_0xb00b('0x70')]){this[_0xb00b('0x99')](_0x59e4eb,_0x59e4eb[_0xb00b('0xab')],_0x59e4eb[_0xb00b('0x138')]);}else if(this['actions'][_0x59e4eb['linkedid']][_0xb00b('0x70')]){logger['info'](_0xb00b('0x139'),_0x59e4eb['linkedid'],_0x59e4eb[_0xb00b('0x138')],_0xb00b('0xb1'),_0x525fb3['name'],_0xb00b('0xb2'),_0x525fb3['pTalking']);this[_0xb00b('0x99')](_0x59e4eb,_0x59e4eb[_0xb00b('0xab')],_0x59e4eb['cause']);}}else if(_0x198da1&&_[_0xb00b('0x81')](_0x198da1[_0xb00b('0x13a')])&&_0x525fb3[_0xb00b('0x13b')]&&_0x59e4eb[_0xb00b('0xab')]===_0x59e4eb[_0xb00b('0xec')]&&_['isNil'](_0x59e4eb[_0xb00b('0xef')])&&_0x59e4eb[_0xb00b('0x138')]==='16'&&_0x59e4eb['channelstate']==='6'&&_['isUndefined'](_0x198da1[_0xb00b('0x13c')])){if(_0x198da1['unlockAgent']){rpcDb['unlockContact'](_0x198da1['idContact']);}if(_0x198da1[_0xb00b('0xaa')]){rpcDb[_0xb00b('0x8a')](_0x198da1[_0xb00b('0x101')]);}_0x59e4eb[_0xb00b('0xef')]='22';this['callProgressDetectingAgent'](_0x198da1,_0x525fb3,_0x59e4eb);}else if(_0x198da1&&_0x198da1[_0xb00b('0x13c')]){if(_0x59e4eb['cause']==='16'&&this[_0xb00b('0x13')][_0x59e4eb[_0xb00b('0xab')]][_0xb00b('0x70')]){logger[_0xb00b('0x56')]('[syncHangup][talking][transfer]',_0x59e4eb[_0xb00b('0xab')],_0x59e4eb[_0xb00b('0x138')],'\x20Queue',_0x525fb3[_0xb00b('0x25')],_0xb00b('0xb2'),_0x525fb3[_0xb00b('0xaf')]);this['callProgressDetectingCustomer'](_0x59e4eb,_0x59e4eb['linkedid'],_0x59e4eb[_0xb00b('0x138')]);}else if(this[_0xb00b('0x13')][_0x59e4eb[_0xb00b('0xab')]][_0xb00b('0x70')]){logger[_0xb00b('0x56')](_0xb00b('0x139'),_0x59e4eb[_0xb00b('0xab')],_0x59e4eb['cause'],'\x20Queue',_0x525fb3[_0xb00b('0x25')],'pTalking:\x20',_0x525fb3['pTalking']);this[_0xb00b('0x99')](_0x59e4eb,_0x59e4eb[_0xb00b('0xab')],_0x59e4eb['cause']);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x13783c){if(this['actions'][_0x13783c[_0xb00b('0x13d')]]&&_0x13783c[_0xb00b('0x13d')]!==_0x13783c[_0xb00b('0x13e')]){this[_0xb00b('0x99')](_0x13783c,_0x13783c[_0xb00b('0x13d')],_0x13783c[_0xb00b('0xe2')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x22e757){if(this[_0xb00b('0x13')][_0x22e757['linkedid']]&&_0x22e757['linkedid']!==_0x22e757['uniqueid']&&!this[_0xb00b('0x13')][_0x22e757[_0xb00b('0xab')]][_0xb00b('0x70')]){if(_0x22e757[_0xb00b('0x138')]==='1'){this[_0xb00b('0x99')](_0x22e757,_0x22e757[_0xb00b('0xab')],_0x22e757[_0xb00b('0x138')]);}}};Preview['prototype']['addVariable']=function(_0x1290d9,_0x19d624,_0x50d9a3){if(this[_0xb00b('0x13')][_0x1290d9]){if(_[_0xb00b('0x81')](this['actions'][_0x1290d9][_0xb00b('0x13f')])){this['actions'][_0x1290d9][_0xb00b('0x13f')]={};}this['actions'][_0x1290d9]['variables'][_0x19d624]=_0x50d9a3;}};Preview['prototype'][_0xb00b('0x140')]=function(_0x230223){try{if(!_[_0xb00b('0x81')](_0x230223)){if(ut[_0xb00b('0x141')](_['keys'](_0x230223[_0xb00b('0x142')])[0x0])){this[_0xb00b('0x143')](_0x230223[_0xb00b('0xec')],_[_0xb00b('0x144')](_0x230223[_0xb00b('0x142')])[0x0],_0x230223[_0xb00b('0x145')]);}}}catch(_0x1cc9fb){logger[_0xb00b('0x146')](_0xb00b('0x147'),util[_0xb00b('0x148')](_0x1cc9fb,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x3fe113){if(_0x3fe113){if(this[_0xb00b('0x13')][_0x3fe113[_0xb00b('0x149')]]){this[_0xb00b('0x13')][_0x3fe113[_0xb00b('0x149')]][_0xb00b('0x13c')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x2bba6e){if(_0x2bba6e){if(this['actions'][_0x2bba6e[_0xb00b('0x14a')]]){this[_0xb00b('0x13')][_0x2bba6e[_0xb00b('0x14a')]][_0xb00b('0x13c')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c4b0c6e..c042f00 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 _0xadf0=['[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x48834d,_0x52911c){var _0x51513f=function(_0x2d36cd){while(--_0x2d36cd){_0x48834d['push'](_0x48834d['shift']());}};_0x51513f(++_0x52911c);}(_0xadf0,0xa0));var _0x0adf=function(_0x4d0d9e,_0x1dae25){_0x4d0d9e=_0x4d0d9e-0x0;var _0x322e71=_0xadf0[_0x4d0d9e];return _0x322e71;};'use strict';var util=require('util');var BPromise=require(_0x0adf('0x0'));var logger=require(_0x0adf('0x1'))(_0x0adf('0x2'));var _=require('lodash');var cmHopper=require(_0x0adf('0x3'));var cmHopperFinal=require(_0x0adf('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x0adf('0x5'));var voiceQueueRt=require(_0x0adf('0x6'));var agentReportPreview=require(_0x0adf('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1c6c46){return function(_0x4e07f2){logger['error'](_0x1c6c46,util[_0x0adf('0x8')](_0x4e07f2,{'showHidden':![],'depth':null}));};}function create(_0x9e78e4){return BPromise['resolve']()['then'](cmHopperHistory[_0x0adf('0x9')](_0x9e78e4))['catch'](loggerCatch(_0x0adf('0xa')));}function createAgent(_0x1d63ab){return BPromise[_0x0adf('0xb')]()[_0x0adf('0xc')](agentReportPreview[_0x0adf('0x9')](_0x1d63ab))[_0x0adf('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x1b3415){return BPromise[_0x0adf('0xb')]()['then'](cmHopper[_0x0adf('0xe')](_0x1b3415,!![]))['catch'](loggerCatch(_0x0adf('0xf')));}exports[_0x0adf('0x10')]=function(_0x6cc44){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0x6cc44))[_0x0adf('0xd')](loggerCatch(_0x0adf('0x11')));};exports['getContactPreview']=function(_0x4a6213){return BPromise[_0x0adf('0xb')]()['then'](cmHopper[_0x0adf('0x12')](_0x4a6213))['catch'](loggerCatch(_0x0adf('0x13')));};exports[_0x0adf('0x9')]=function(_0x436149,_0x530c78){create(_0x436149)[_0x0adf('0xd')](loggerCatch(_0x530c78));moveContact(_0x436149)[_0x0adf('0xd')](loggerCatch(_0x530c78));};exports[_0x0adf('0x14')]=function(_0x4ab5ff,_0x442a11){createAgent(_0x4ab5ff)[_0x0adf('0xd')](loggerCatch(_0x442a11));};exports[_0x0adf('0x15')]=function(_0x4b9b89,_0x591a60){create(_0x4b9b89)['catch'](loggerCatch(_0x591a60));};exports['createCustomerFinal']=function(_0xf2faf2,_0x363203){moveContact(_0xf2faf2)[_0x0adf('0xd')](loggerCatch(_0x363203));};exports[_0x0adf('0x16')]=function(_0x420eae,_0x168b30,_0x5e2236){if(_0x168b30){_0x420eae[_0x0adf('0x17')]=null;}if(_0x5e2236){_0x420eae[_0x0adf('0x18')]=![];}return BPromise['resolve']()[_0x0adf('0xc')](cmHopper['rescheduleContact'](_0x420eae))['catch'](loggerCatch(_0x0adf('0x19')));};exports[_0x0adf('0x1a')]=function(_0x3b4ee4){return BPromise[_0x0adf('0xb')]()[_0x0adf('0xc')](cmHopper['countReScheduled'](_0x3b4ee4))[_0x0adf('0xd')](loggerCatch(_0x0adf('0x1b')));};exports['unlockContact']=function(_0x1bd1ac){return BPromise[_0x0adf('0xb')]()['then'](cmHopper[_0x0adf('0x1c')]({'UserId':null},_0x1bd1ac,0x1))[_0x0adf('0xd')](loggerCatch(_0x0adf('0x1d')));};exports[_0x0adf('0x1e')]=function(_0x518898){return BPromise[_0x0adf('0xb')]()['then'](cmHopper[_0x0adf('0x1c')]({'active':![]},_0x518898,0x1))[_0x0adf('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0x0adf('0x1f')]=function(_0x454fe9){var _0x4750b2={};_0x4750b2[_0x0adf('0x20')]=_0x454fe9[_0x0adf('0x20')];_0x4750b2['uniqueid']=_0x454fe9[_0x0adf('0x21')];_0x4750b2['calleridnum']=_0x454fe9['calleridnum'];_0x4750b2[_0x0adf('0x22')]=_0x454fe9[_0x0adf('0x22')];_0x4750b2[_0x0adf('0x23')]=_0x454fe9[_0x0adf('0x23')];_0x4750b2[_0x0adf('0x24')]=_0x454fe9[_0x0adf('0x25')];_0x4750b2[_0x0adf('0x26')]=_0x454fe9[_0x0adf('0x25')];_0x4750b2[_0x0adf('0x27')]=0x1;_0x4750b2[_0x0adf('0x28')]=_0x454fe9[_0x0adf('0x29')];_0x4750b2[_0x0adf('0x2a')]=_0x454fe9[_0x0adf('0x2b')];_0x4750b2[_0x0adf('0x2c')]='from-sip';_0x4750b2[_0x0adf('0x2d')]='xcally-motion-preview';_0x4750b2[_0x0adf('0x2e')]=0x0;_0x4750b2[_0x0adf('0x2f')]=0x1;_0x4750b2['lastAssignedTo']=_0x454fe9[_0x0adf('0x2b')];_0x4750b2[_0x0adf('0x30')]=_0x0adf('0x31');return BPromise[_0x0adf('0xb')]()[_0x0adf('0xc')](voiceQueueReport['create'](_0x4750b2))[_0x0adf('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0adf('0x32')]=function(_0x57f64a,_0x1231d0){return BPromise['resolve']()[_0x0adf('0xc')](cmHopper['getContactRecallMe'](_0x57f64a,_0x1231d0))[_0x0adf('0xd')](loggerCatch(_0x0adf('0x33')));};exports['rescheduleContactInQueue']=function(_0x233231){return BPromise['resolve']()[_0x0adf('0xc')](cmHopper[_0x0adf('0x16')](_0x233231,!![],!![]))[_0x0adf('0xd')](loggerCatch(_0x0adf('0x34')));}; \ No newline at end of file +var _0x9b6e=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9b6e,0x1d2));var _0xe9b6=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x9b6e[_0x1b2ff7];return _0x31656a;};'use strict';var util=require(_0xe9b6('0x0'));var BPromise=require(_0xe9b6('0x1'));var logger=require(_0xe9b6('0x2'))(_0xe9b6('0x3'));var _=require(_0xe9b6('0x4'));var cmHopper=require(_0xe9b6('0x5'));var cmHopperFinal=require(_0xe9b6('0x6'));var cmHopperHistory=require(_0xe9b6('0x7'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xe9b6('0x8'));function loggerCatch(_0x41843b){return function(_0x542e05){logger[_0xe9b6('0x9')](_0x41843b,util['inspect'](_0x542e05,{'showHidden':![],'depth':null}));};}function create(_0x316b88){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopperHistory[_0xe9b6('0xc')](_0x316b88))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0xe')));}function createAgent(_0x2c9d50){return BPromise[_0xe9b6('0xa')]()['then'](agentReportPreview[_0xe9b6('0xc')](_0x2c9d50))['catch'](loggerCatch(_0xe9b6('0xe')));}function moveContact(_0x4d4adf){return BPromise['resolve']()['then'](cmHopper[_0xe9b6('0xf')](_0x4d4adf,!![]))[_0xe9b6('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe9b6('0x10')]=function(_0xe53653){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0xe53653))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x11')));};exports[_0xe9b6('0x12')]=function(_0x1d16e1){return BPromise['resolve']()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x12')](_0x1d16e1))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x13')));};exports[_0xe9b6('0xc')]=function(_0x3ec6b0,_0xe4e090){create(_0x3ec6b0)['catch'](loggerCatch(_0xe4e090));moveContact(_0x3ec6b0)[_0xe9b6('0xd')](loggerCatch(_0xe4e090));};exports['createAgentHistory']=function(_0x2ee164,_0x3935f6){createAgent(_0x2ee164)['catch'](loggerCatch(_0x3935f6));};exports[_0xe9b6('0x14')]=function(_0x405352,_0x5bf6a2){create(_0x405352)[_0xe9b6('0xd')](loggerCatch(_0x5bf6a2));};exports[_0xe9b6('0x15')]=function(_0xf343c0,_0xcb6974){moveContact(_0xf343c0)[_0xe9b6('0xd')](loggerCatch(_0xcb6974));};exports['rescheduleContact']=function(_0x24f7c0,_0x741048,_0x44e0a6){if(_0x741048){_0x24f7c0[_0xe9b6('0x16')]=null;}if(_0x44e0a6){_0x24f7c0[_0xe9b6('0x17')]=![];}return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x18')](_0x24f7c0))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x19')));};exports[_0xe9b6('0x1a')]=function(_0x3954dd){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x1a')](_0x3954dd))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x1b')));};exports[_0xe9b6('0x1c')]=function(_0x17be40){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x1c')]({'UserId':null},_0x17be40,0x1))['catch'](loggerCatch(_0xe9b6('0x1d')));};exports['disableContact']=function(_0x3e5bf0){return BPromise[_0xe9b6('0xa')]()['then'](cmHopper['unlockContact']({'active':![]},_0x3e5bf0,0x1))['catch'](loggerCatch(_0xe9b6('0x1e')));};exports[_0xe9b6('0x1f')]=function(_0x4c16e2){var _0x444074={};_0x444074[_0xe9b6('0x20')]=_0x4c16e2[_0xe9b6('0x20')];_0x444074[_0xe9b6('0x21')]=_0x4c16e2[_0xe9b6('0x21')];_0x444074[_0xe9b6('0x22')]=_0x4c16e2[_0xe9b6('0x22')];_0x444074['calleridname']=_0x4c16e2[_0xe9b6('0x23')];_0x444074[_0xe9b6('0x24')]=_0x4c16e2[_0xe9b6('0x24')];_0x444074[_0xe9b6('0x25')]=_0x4c16e2['answertime'];_0x444074[_0xe9b6('0x26')]=_0x4c16e2[_0xe9b6('0x27')];_0x444074[_0xe9b6('0x28')]=0x1;_0x444074[_0xe9b6('0x29')]=_0x4c16e2[_0xe9b6('0x2a')];_0x444074[_0xe9b6('0x2b')]=_0x4c16e2[_0xe9b6('0x2c')];_0x444074[_0xe9b6('0x2d')]=_0xe9b6('0x2e');_0x444074[_0xe9b6('0x2f')]=_0xe9b6('0x30');_0x444074[_0xe9b6('0x31')]=0x0;_0x444074[_0xe9b6('0x32')]=0x1;_0x444074[_0xe9b6('0x33')]=_0x4c16e2[_0xe9b6('0x2c')];_0x444074[_0xe9b6('0x34')]=_0xe9b6('0x35');return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](voiceQueueReport['create'](_0x444074))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x3c572e,_0x28fa94){return BPromise[_0xe9b6('0xa')]()['then'](cmHopper[_0xe9b6('0x36')](_0x3c572e,_0x28fa94))[_0xe9b6('0xd')](loggerCatch(_0xe9b6('0x37')));};exports[_0xe9b6('0x38')]=function(_0x93e464){return BPromise[_0xe9b6('0xa')]()[_0xe9b6('0xb')](cmHopper[_0xe9b6('0x18')](_0x93e464,!![],!![]))['catch'](loggerCatch(_0xe9b6('0x39')));}; \ 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 9ac1416..4ffd38f 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 _0xf65b=['\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','logger','info','error','logger2','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','ContactId','dialer','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logAgent','ringtime','membername','UserId','logCustomer','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','originate','channelAgent','calleridnum','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','reachable','push','getDiff','createBody','filterKey','idContact','type','dialAnswer','calleridname','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid'];(function(_0x527110,_0x5133bf){var _0x3f01cf=function(_0xb7580b){while(--_0xb7580b){_0x527110['push'](_0x527110['shift']());}};_0x3f01cf(++_0x5133bf);}(_0xf65b,0x1a7));var _0xbf65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf65b[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xbf65('0x0'));var _=require(_0xbf65('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xbf65('0x2'));var ipAgi=process[_0xbf65('0x3')][_0xbf65('0x4')]||_0xbf65('0x5');function getSeconds(_0x2d6a6e,_0x50facd){var _0xcbc2b2=moment(_0x2d6a6e)[_0xbf65('0x6')](0x0);var _0x5cdfd4=moment(_0x50facd)[_0xbf65('0x6')](0x0);return _0xcbc2b2[_0xbf65('0x7')](_0x5cdfd4,_0xbf65('0x8'));}exports[_0xbf65('0x9')]=function(_0x35145d){return function(_0x1fd03f){logger['error'](_0x35145d,util[_0xbf65('0xa')](_0x1fd03f,{'showHidden':![],'depth':null}));};};exports[_0xbf65('0xb')]=function(_0x552d08,_0x47976f){logger[_0xbf65('0xc')](_0x552d08,util[_0xbf65('0xa')](_0x47976f,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x216351,_0x367967){logger[_0xbf65('0xd')](_0x216351,util['inspect'](_0x367967,{'showHidden':![],'depth':null}));};exports[_0xbf65('0xe')]=function(_0x5eb1ad){return function(_0x5c8c3c){logger[_0xbf65('0xc')](_0x5eb1ad,util[_0xbf65('0xa')](_0x5c8c3c,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x35b851,_0x8bbcfb,_0x8755a9){return{'message':_0x35b851,'unlock':_0x8bbcfb,'active':_0x8755a9};};exports['getCallerId']=function(_0x67fc72,_0x144738,_0x4f4d79){if(!_[_0xbf65('0xf')](_0x4f4d79)&&_0xbf65('0x10')===typeof _0x4f4d79&&!_[_0xbf65('0x11')](_0x4f4d79)){if(!_[_0xbf65('0xf')](_0x144738)&&_0xbf65('0x10')===typeof _0x144738&&!_['isEmpty'](_0x144738)){return util['format'](_0xbf65('0x12'),_0x144738,_0x4f4d79);}return util[_0xbf65('0x13')](_0xbf65('0x12'),_0x4f4d79,_0x4f4d79);}if(!_['isUndefined'](_0x67fc72)&&_0xbf65('0x10')===typeof _0x67fc72&&!_[_0xbf65('0x11')](_0x67fc72)){return _0x67fc72;}return _0xbf65('0x14');};exports[_0xbf65('0x15')]=function(_0x25abac){if(_[_0xbf65('0x16')](_0x25abac)){return![];}return _0x25abac;};exports[_0xbf65('0x17')]=function(_0x57fce9,_0x40a3e9,_0x43db18,_0x14cb3c,_0x4e7280,_0x428e21){var _0x5b7497={'XMD-QUEUE':_0x40a3e9[_0xbf65('0x18')]?_0x40a3e9[_0xbf65('0x18')]['name']:'','XMD-CALLERID':_0x14cb3c,'XMD-CALLERID-PREVIEW':_0x428e21?util[_0xbf65('0x13')]('\x22%s\x22\x20<%s>',_0x428e21['calleridname'],_0x428e21['calleridnum']):_0x14cb3c,'XMD-DIALID':_0x4e7280,'XMD-CONTACTID':_0x40a3e9[_0xbf65('0x19')],'XMD-CDRTYPE':_0xbf65('0x1a'),'CALLERID(all)':_0x14cb3c,'XMD-VOICEQUEUEID':_0x40a3e9['VoiceQueueId'],'XMD-DIALCHANNEL':_0x43db18,'XMD-DIALTIMEOUT':_0x57fce9['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xbf65('0x1b'),_0x57fce9['dialQueueProject2']?'g':'',_['isEmpty'](_0x57fce9[_0xbf65('0x1c')])?'':_0xbf65('0x1d')),'XMD-DIALURL':_0x57fce9[_0xbf65('0x1e')]||'','XMD-AGI':_0x57fce9[_0xbf65('0x1f')]?util[_0xbf65('0x13')](_0xbf65('0x20'),ipAgi,_0x57fce9[_0xbf65('0x1f')]):_0xbf65('0x21'),'XMD-AGIAFTER':_0x57fce9['dialQueueProject2']?util[_0xbf65('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x57fce9[_0xbf65('0x22')]):_0xbf65('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x428e21?_0x428e21[_0xbf65('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x428e21?_0x428e21['originatecalleridname']:'','XMD-DESTINATION':_0xbf65('0x24'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xbf65('0x11')](_0x57fce9[_0xbf65('0x1c')])){_0x5b7497[util[_0xbf65('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x57fce9[_0xbf65('0x1c')];_0x5b7497[util[_0xbf65('0x13')]('%s',_0xbf65('0x25'))]=_0x4e7280;}if(_0x40a3e9&&_0x40a3e9[_0xbf65('0x26')]){for(var _0x12cbd9 in _0x40a3e9[_0xbf65('0x26')]){if(_0x40a3e9[_0xbf65('0x26')][_0xbf65('0x27')](_0x12cbd9)){if(!_[_0xbf65('0x16')](_0x40a3e9[_0xbf65('0x26')][_0x12cbd9])&&_0x12cbd9!=='id'&&_0x12cbd9!==_0xbf65('0x28')&&_0x12cbd9!==_0xbf65('0x29')&&_0x12cbd9!==_0xbf65('0x2a')){_0x5b7497[util[_0xbf65('0x13')]('%s%s',_0xbf65('0x2b'),_[_0xbf65('0x2c')](_0x12cbd9))]=_0x40a3e9[_0xbf65('0x26')][_0x12cbd9];}}}}return _0x5b7497;};exports['toLowerVariables']=function(_0x38e6b8){var _0x2378fc={};for(var _0x28dd7f in _0x38e6b8){if(_0x38e6b8[_0xbf65('0x27')](_0x28dd7f)){_0x2378fc[util[_0xbf65('0x13')]('%s',_['toLower'](_0x28dd7f))]=_0x38e6b8[_0x28dd7f];}}return{'variables':_0x2378fc};};exports[_0xbf65('0x2d')]=function(_0x57fe98,_0x1ab17e){if(!_[_0xbf65('0x16')](_0x57fe98)){if(_0x57fe98['hasOwnProperty']('originated')){if(_0x57fe98['originated']>0x0){_0x57fe98['originated']-=0x1;}else{logger[_0xbf65('0xd')](_0xbf65('0x2e'),_0x1ab17e);}}}else{logger[_0xbf65('0xd')](_0xbf65('0x2f'),_0x1ab17e);}};exports[_0xbf65('0x30')]=function(_0x52b4ed){var _0x26fca6=moment()[_0xbf65('0x13')](_0xbf65('0x31'));_0x52b4ed[_0xbf65('0x32')]=0xd;_0x52b4ed[_0xbf65('0x33')]='Blacklist';_0x52b4ed[_0xbf65('0x34')]=_0x26fca6;_0x52b4ed[_0xbf65('0x35')]=_0x26fca6;_0x52b4ed['endtime']=_0x26fca6;};exports[_0xbf65('0x36')]=function(_0x172171,_0x454c94,_0x316974){var _0x519e07=moment()[_0xbf65('0x13')](_0xbf65('0x31'));_0x172171[_0xbf65('0x32')]=_0x454c94;_0x172171[_0xbf65('0x33')]=_0x316974;_0x172171[_0xbf65('0x35')]=_0x519e07;_0x172171[_0xbf65('0x37')]=getSeconds(_0x172171[_0xbf65('0x35')],_0x172171[_0xbf65('0x34')]);};exports['logLookAgent']=function(_0x38fe08,_0x9a2ac8,_0x301264){_0x38fe08[_0xbf65('0x38')]=_0x9a2ac8;_0x38fe08[_0xbf65('0x39')]=_0x301264;};exports[_0xbf65('0x3a')]=function(_0x594354,_0x304a9c,_0x474aa9){var _0x763e77=moment()[_0xbf65('0x13')](_0xbf65('0x31'));_0x594354[_0xbf65('0x32')]=_0x304a9c;_0x594354[_0xbf65('0x33')]=_0x474aa9;_0x594354['responsetime']=_0x594354['responsetime']?_0x594354[_0xbf65('0x35')]:_0x763e77;_0x594354[_0xbf65('0x3b')]=_0x594354['endtime']?_0x594354['endtime']:_0x763e77;_0x594354[_0xbf65('0x37')]=getSeconds(_0x594354['responsetime']||0x0,_0x594354[_0xbf65('0x34')]||0x0);_0x594354[_0xbf65('0x3c')]=_0x594354[_0xbf65('0x3d')]?getSeconds(_0x594354['endtime'],_0x594354['answertime']):0x0;};exports['isFailure']=function(_0x5d5fa5){return _0x5d5fa5===_0xbf65('0x3e');};exports[_0xbf65('0x3f')]=function(_0x275faa,_0x5c8876,_0x4c76c8,_0xef42e0,_0x78aa5e){var _0x21d285=_0xef42e0?_0xbf65('0x40'):_0x275faa['calleridname'];_0x21d285=_0x78aa5e?_0xbf65('0x41'):_0x21d285;return{'actionid':_0x275faa['uniqueid'],'action':_0xbf65('0x42'),'channel':_0x275faa[_0xbf65('0x43')],'callerid':util[_0xbf65('0x13')](_0xbf65('0x12'),_0x21d285,_0x275faa[_0xbf65('0x44')]),'Exten':_0xbf65('0x24'),'Context':_0xbf65('0x45'),'Priority':'1','variable':_0x4c76c8,'timeout':(_0x5c8876[_0xbf65('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x275faa[_0xbf65('0x47')]};};exports['totalGlobal']=function(_0x3b77ad){return _0x3b77ad[_0xbf65('0x48')]+_0x3b77ad[_0xbf65('0x49')]+_0x3b77ad[_0xbf65('0x4a')]+_0x3b77ad['countagentrejectretry']+_0x3b77ad[_0xbf65('0x4b')];};exports['cloneAction']=function(_0x65d78a){var _0x3ddf36=_[_0xbf65('0x4c')](_0x65d78a);_0x3ddf36[_0xbf65('0x32')]=0xf;_0x3ddf36[_0xbf65('0x33')]='Global';return _0x3ddf36;};exports[_0xbf65('0x4d')]=function(_0x3d329d,_0x5bff9f,_0x47ed09){var _0x24cd88={};_0x24cd88[_0x5bff9f]=_0x3d329d[_0x5bff9f];_0x24cd88['active']=![];_0x24cd88[_0xbf65('0x4e')]=moment()[_0xbf65('0x4f')](_0x47ed09,_0xbf65('0x50'))[_0xbf65('0x13')](_0xbf65('0x31'));_0x24cd88[_0xbf65('0x19')]=_0x3d329d['ContactId'];_0x24cd88[_0xbf65('0x51')]=_0x3d329d['ListId'];_0x24cd88[_0xbf65('0x52')]=_0x3d329d[_0xbf65('0x52')]||undefined;return _0x24cd88;};exports['decrementTalkink']=function(_0xf490b1,_0x447f52){if(!_[_0xbf65('0x16')](_0xf490b1)){if(_0xf490b1[_0xbf65('0x53')]>0x0){_0xf490b1['pTalking']-=0x1;}else{logger[_0xbf65('0xd')](_0x447f52,_0xbf65('0x54'));}}else{logger['error'](_0x447f52,_0xbf65('0x55'));}};exports[_0xbf65('0x56')]=function(_0x4b289b){if(_0x4b289b<=0x0){return!![];}return![];};exports['buildObj']=function(_0x594ad2,_0x45f54a,_0x474731){_0x594ad2[_0xbf65('0x57')]=_0x45f54a;_0x594ad2['name']=_0x594ad2[_0xbf65('0x58')];_0x594ad2[_0xbf65('0x59')]=_0x594ad2[_0xbf65('0x43')];_0x594ad2[_0xbf65('0x5a')]=_0xbf65('0x5b');if(_0x474731){_0x594ad2['mandatoryDisposition']=_0x474731[_0xbf65('0x5c')];}return _0x594ad2;};exports[_0xbf65('0x5d')]=function(_0x4f9f3a){var _0x4e4481={};_0x4e4481[_0xbf65('0x58')]=_0x4f9f3a['queue'];_0x4e4481[_0xbf65('0x59')]=_0x4f9f3a[_0xbf65('0x43')];_0x4e4481['uniqueid']=_0x4f9f3a['uniqueid'];return _0x4e4481;};exports[_0xbf65('0x5e')]=function(_0x441a82){var _0x3f4551=[];for(var _0x6e7ac2 in _0x441a82){if(_0x441a82[_0xbf65('0x27')](_0x6e7ac2)){if(!_[_0xbf65('0x16')](_0x441a82[_0x6e7ac2])&&_0x441a82[_0x6e7ac2][_0xbf65('0x32')]==='not_inuse'&&_0x441a82[_0x6e7ac2]['status']===_0xbf65('0x5f')){_0x3f4551[_0xbf65('0x60')](_0x441a82[_0x6e7ac2]['id']);}}}return _0x3f4551;};exports[_0xbf65('0x61')]=function(_0x50a068){var _0x2c1590=moment()[_0xbf65('0x6')](0x0);var _0x4957f7=moment(_0x50a068)[_0xbf65('0x6')](0x0);return _0x2c1590[_0xbf65('0x7')](_0x4957f7,_0xbf65('0x8'));};exports[_0xbf65('0x62')]=function(_0x337a31){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x337a31[_0xbf65('0x19')],'ListId':_0x337a31[_0xbf65('0x51')],'VoiceQueueId':_0x337a31['VoiceQueueId']||undefined,'CampaignId':_0x337a31['CampaignId']||undefined};};exports[_0xbf65('0x63')]=function(_0x46031f){if(_0x46031f===_0xbf65('0x47')||_0x46031f===_0xbf65('0x64')||_0x46031f===_0xbf65('0x58')||_0x46031f===_0xbf65('0x65')||_0x46031f==='campaigntype'||_0x46031f===_0xbf65('0x66')||_0x46031f===_0xbf65('0x38')||_0x46031f===_0xbf65('0x43')||_0x46031f===_0xbf65('0x67')||_0x46031f===_0xbf65('0x68')||_0x46031f==='calleridnum'||_0x46031f==='scheduledat'||_0x46031f===_0xbf65('0x48')||_0x46031f===_0xbf65('0x49')||_0x46031f===_0xbf65('0x4a')||_0x46031f===_0xbf65('0x69')||_0x46031f===_0xbf65('0x6a')||_0x46031f===_0xbf65('0x6b')||_0x46031f===_0xbf65('0x6c')||_0x46031f===_0xbf65('0x6d')||_0x46031f===_0xbf65('0x19')||_0x46031f===_0xbf65('0x51')||_0x46031f===_0xbf65('0x39')||_0x46031f==='VoiceQueueId'||_0x46031f===_0xbf65('0x6e')||_0x46031f===_0xbf65('0x6f')||_0x46031f===_0xbf65('0x70')||_0x46031f===_0xbf65('0x71')||_0x46031f===_0xbf65('0x72')||_0x46031f===_0xbf65('0x73')||_0x46031f===_0xbf65('0x74')||_0x46031f===_0xbf65('0x75')||_0x46031f===_0xbf65('0x76')||_0x46031f==='xmd-dialchannel'||_0x46031f===_0xbf65('0x77')||_0x46031f===_0xbf65('0x78')||_0x46031f===_0xbf65('0x79')||_0x46031f===_0xbf65('0x7a')||_0x46031f===_0xbf65('0x7b')||_0x46031f===_0xbf65('0x7c')||_0x46031f===_0xbf65('0x7d')||_0x46031f===_0xbf65('0x7e')||_0x46031f===_0xbf65('0x7f')||_0x46031f===_0xbf65('0x80')||_0x46031f==='rtpaudioqoslossbridged'||_0x46031f===_0xbf65('0x81')||_0x46031f===_0xbf65('0x82')||_0x46031f===_0xbf65('0x7c')||_0x46031f===_0xbf65('0x7d')||_0x46031f==='rtpaudioqosjitter'||_0x46031f==='rtpaudioqosjitterbridged'||_0x46031f===_0xbf65('0x80')||_0x46031f==='rtpaudioqoslossbridged'||_0x46031f===_0xbf65('0x81')||_0x46031f===_0xbf65('0x82')||_0x46031f===_0xbf65('0x83')||_0x46031f===_0xbf65('0x84')||_0x46031f===_0xbf65('0x32')||_0x46031f===_0xbf65('0x33')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x1acac4,_0x4a3b37){var _0x3307c6,_0x33fb5a,_0x245174;if(_0x4a3b37<=0x0){_0x4a3b37=0x1;}_0x3307c6=new RegExp(_0xbf65('0x85')+_0x4a3b37+'}$');_0x33fb5a=Math[_0xbf65('0x86')](0xa,_0x4a3b37-0x1);_0x245174=Math[_0xbf65('0x86')](0xa,_0x4a3b37)-0x1;return util['format']('%s',_[_0xbf65('0x87')](_0x1acac4,_0x3307c6,_[_0xbf65('0x88')](_0x33fb5a,_0x245174)));};exports[_0xbf65('0x89')]=function(_0x3002ed){var _0x56b1ad=_0x3002ed[_0xbf65('0x8a')](/"(.*?)"/);return _0x56b1ad?_0x56b1ad[0x1]:_0x3002ed;};exports['extractCalleridNumber']=function(_0x3020aa){var _0x38196a=_0x3020aa[_0xbf65('0x8a')](/<(.*?)>/);return _0x38196a?_0x38196a[0x1]:_0x3020aa;}; \ No newline at end of file +var _0x7f8f=['getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','XMD-','toUpper','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','endtime','logAgent','statedesc','responsetime','ringtime','logLookAgent','UserId','logCustomer','starttime','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','countnoanswerretry','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid'];(function(_0x4f30bd,_0xf47f9b){var _0x457faa=function(_0x3ff51a){while(--_0x3ff51a){_0x4f30bd['push'](_0x4f30bd['shift']());}};_0x457faa(++_0xf47f9b);}(_0x7f8f,0x121));var _0xf7f8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f8f[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf7f8('0x0'));var _=require(_0xf7f8('0x1'));var moment=require(_0xf7f8('0x2'));var logger=require('../../../../config/logger')(_0xf7f8('0x3'));var ipAgi=process[_0xf7f8('0x4')][_0xf7f8('0x5')]||_0xf7f8('0x6');function getSeconds(_0x5e93d4,_0x112cc5){var _0x42fa42=moment(_0x5e93d4)[_0xf7f8('0x7')](0x0);var _0x4264f5=moment(_0x112cc5)[_0xf7f8('0x7')](0x0);return _0x42fa42[_0xf7f8('0x8')](_0x4264f5,_0xf7f8('0x9'));}exports[_0xf7f8('0xa')]=function(_0x381361){return function(_0x2f7f4f){logger[_0xf7f8('0xb')](_0x381361,util[_0xf7f8('0xc')](_0x2f7f4f,{'showHidden':![],'depth':null}));};};exports[_0xf7f8('0xd')]=function(_0x38f4ed,_0x10eed6){logger[_0xf7f8('0xe')](_0x38f4ed,util[_0xf7f8('0xc')](_0x10eed6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4f597a,_0x50438a){logger['error'](_0x4f597a,util[_0xf7f8('0xc')](_0x50438a,{'showHidden':![],'depth':null}));};exports[_0xf7f8('0xf')]=function(_0x17c6f4){return function(_0x450bec){logger[_0xf7f8('0xe')](_0x17c6f4,util['inspect'](_0x450bec,{'showHidden':![],'depth':null}));};};exports[_0xf7f8('0x10')]=function(_0x55e81e,_0x1c7918,_0xa14f4f){return{'message':_0x55e81e,'unlock':_0x1c7918,'active':_0xa14f4f};};exports[_0xf7f8('0x11')]=function(_0x526612,_0x15d3a4,_0xc5704){if(!_[_0xf7f8('0x12')](_0xc5704)&&_0xf7f8('0x13')===typeof _0xc5704&&!_['isEmpty'](_0xc5704)){if(!_['isUndefined'](_0x15d3a4)&&_0xf7f8('0x13')===typeof _0x15d3a4&&!_[_0xf7f8('0x14')](_0x15d3a4)){return util[_0xf7f8('0x15')](_0xf7f8('0x16'),_0x15d3a4,_0xc5704);}return util['format']('\x22%s\x22\x20<%s>',_0xc5704,_0xc5704);}if(!_['isUndefined'](_0x526612)&&'string'===typeof _0x526612&&!_[_0xf7f8('0x14')](_0x526612)){return _0x526612;}return'\x22\x22\x20<>';};exports[_0xf7f8('0x17')]=function(_0x1ff33e){if(_[_0xf7f8('0x18')](_0x1ff33e)){return![];}return _0x1ff33e;};exports[_0xf7f8('0x19')]=function(_0x5be475,_0x39cac3,_0x11aacf,_0x472018,_0x4168b2,_0x4aa81e){var _0x272712={'XMD-QUEUE':_0x39cac3[_0xf7f8('0x1a')]?_0x39cac3['Queue'][_0xf7f8('0x1b')]:'','XMD-CALLERID':_0x472018,'XMD-CALLERID-PREVIEW':_0x4aa81e?util[_0xf7f8('0x15')](_0xf7f8('0x16'),_0x4aa81e['calleridname'],_0x4aa81e[_0xf7f8('0x1c')]):_0x472018,'XMD-DIALID':_0x4168b2,'XMD-CONTACTID':_0x39cac3[_0xf7f8('0x1d')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x472018,'XMD-VOICEQUEUEID':_0x39cac3[_0xf7f8('0x1e')],'XMD-DIALCHANNEL':_0x11aacf,'XMD-DIALTIMEOUT':_0x5be475[_0xf7f8('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xf7f8('0x15')]('\x22rtTxX%s%s\x22',_0x5be475[_0xf7f8('0x20')]?'g':'',_[_0xf7f8('0x14')](_0x5be475[_0xf7f8('0x21')])?'':_0xf7f8('0x22')),'XMD-DIALURL':_0x5be475[_0xf7f8('0x23')]||'','XMD-AGI':_0x5be475['dialQueueProject']?util[_0xf7f8('0x15')](_0xf7f8('0x24'),ipAgi,_0x5be475[_0xf7f8('0x25')]):'NONE','XMD-AGIAFTER':_0x5be475[_0xf7f8('0x20')]?util[_0xf7f8('0x15')](_0xf7f8('0x24'),ipAgi,_0x5be475[_0xf7f8('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4aa81e?_0x4aa81e[_0xf7f8('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4aa81e?_0x4aa81e[_0xf7f8('0x27')]:'','XMD-DESTINATION':_0xf7f8('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xf7f8('0x14')](_0x5be475['monitor_format'])){_0x272712[util[_0xf7f8('0x15')]('%s',_0xf7f8('0x29'))]=_0x5be475[_0xf7f8('0x21')];_0x272712[util[_0xf7f8('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4168b2;}if(_0x39cac3&&_0x39cac3[_0xf7f8('0x2a')]){for(var _0x5345d2 in _0x39cac3[_0xf7f8('0x2a')]){if(_0x39cac3[_0xf7f8('0x2a')]['hasOwnProperty'](_0x5345d2)){if(!_[_0xf7f8('0x18')](_0x39cac3[_0xf7f8('0x2a')][_0x5345d2])&&_0x5345d2!=='id'&&_0x5345d2!==_0xf7f8('0x2b')&&_0x5345d2!==_0xf7f8('0x2c')&&_0x5345d2!=='updatedAt'){_0x272712[util[_0xf7f8('0x15')]('%s%s',_0xf7f8('0x2d'),_[_0xf7f8('0x2e')](_0x5345d2))]=_0x39cac3[_0xf7f8('0x2a')][_0x5345d2];}}}}return _0x272712;};exports['toLowerVariables']=function(_0x11d203){var _0x42a76c={};for(var _0x490d8c in _0x11d203){if(_0x11d203[_0xf7f8('0x2f')](_0x490d8c)){_0x42a76c[util[_0xf7f8('0x15')]('%s',_[_0xf7f8('0x30')](_0x490d8c))]=_0x11d203[_0x490d8c];}}return{'variables':_0x42a76c};};exports[_0xf7f8('0x31')]=function(_0x12f808,_0x254ae2){if(!_[_0xf7f8('0x18')](_0x12f808)){if(_0x12f808[_0xf7f8('0x2f')](_0xf7f8('0x32'))){if(_0x12f808[_0xf7f8('0x32')]>0x0){_0x12f808['originated']-=0x1;}else{logger[_0xf7f8('0xb')](_0xf7f8('0x33'),_0x254ae2);}}}else{logger[_0xf7f8('0xb')](_0xf7f8('0x34'),_0x254ae2);}};exports[_0xf7f8('0x35')]=function(_0x3ff0b6){var _0xc3feb9=moment()['format'](_0xf7f8('0x36'));_0x3ff0b6[_0xf7f8('0x37')]=0xd;_0x3ff0b6['statedesc']=_0xf7f8('0x38');_0x3ff0b6['starttime']=_0xc3feb9;_0x3ff0b6['responsetime']=_0xc3feb9;_0x3ff0b6[_0xf7f8('0x39')]=_0xc3feb9;};exports[_0xf7f8('0x3a')]=function(_0x254dda,_0x3ae6f0,_0x589d93){var _0x2deef8=moment()['format'](_0xf7f8('0x36'));_0x254dda['state']=_0x3ae6f0;_0x254dda[_0xf7f8('0x3b')]=_0x589d93;_0x254dda[_0xf7f8('0x3c')]=_0x2deef8;_0x254dda[_0xf7f8('0x3d')]=getSeconds(_0x254dda[_0xf7f8('0x3c')],_0x254dda['starttime']);};exports[_0xf7f8('0x3e')]=function(_0x1b58ed,_0x40dfa5,_0x56df10){_0x1b58ed['membername']=_0x40dfa5;_0x1b58ed[_0xf7f8('0x3f')]=_0x56df10;};exports[_0xf7f8('0x40')]=function(_0x1dca8b,_0x514a52,_0x20a661){var _0x7af758=moment()[_0xf7f8('0x15')](_0xf7f8('0x36'));_0x1dca8b['state']=_0x514a52;_0x1dca8b[_0xf7f8('0x3b')]=_0x20a661;_0x1dca8b[_0xf7f8('0x3c')]=_0x1dca8b[_0xf7f8('0x3c')]?_0x1dca8b[_0xf7f8('0x3c')]:_0x7af758;_0x1dca8b[_0xf7f8('0x39')]=_0x1dca8b['endtime']?_0x1dca8b[_0xf7f8('0x39')]:_0x7af758;_0x1dca8b[_0xf7f8('0x3d')]=getSeconds(_0x1dca8b['responsetime']||0x0,_0x1dca8b[_0xf7f8('0x41')]||0x0);_0x1dca8b[_0xf7f8('0x42')]=_0x1dca8b[_0xf7f8('0x43')]?getSeconds(_0x1dca8b[_0xf7f8('0x39')],_0x1dca8b[_0xf7f8('0x43')]):0x0;};exports['isFailure']=function(_0x330815){return _0x330815===_0xf7f8('0x44');};exports[_0xf7f8('0x45')]=function(_0x4fb6ce,_0x2db5fe,_0x5ba2e0,_0x32afd5,_0x30b79f){var _0x322f97=_0x32afd5?_0xf7f8('0x46'):_0x4fb6ce[_0xf7f8('0x47')];_0x322f97=_0x30b79f?_0xf7f8('0x48'):_0x322f97;return{'actionid':_0x4fb6ce[_0xf7f8('0x49')],'action':_0xf7f8('0x4a'),'channel':_0x4fb6ce[_0xf7f8('0x4b')],'callerid':util['format'](_0xf7f8('0x16'),_0x322f97,_0x4fb6ce[_0xf7f8('0x1c')]),'Exten':_0xf7f8('0x28'),'Context':_0xf7f8('0x4c'),'Priority':'1','variable':_0x5ba2e0,'timeout':(_0x2db5fe[_0xf7f8('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4fb6ce['uniqueid']};};exports[_0xf7f8('0x4e')]=function(_0x8e1a9e){return _0x8e1a9e[_0xf7f8('0x4f')]+_0x8e1a9e[_0xf7f8('0x50')]+_0x8e1a9e['countnoanswerretry']+_0x8e1a9e[_0xf7f8('0x51')]+_0x8e1a9e[_0xf7f8('0x52')];};exports[_0xf7f8('0x53')]=function(_0x342221){var _0x52cb1e=_['clone'](_0x342221);_0x52cb1e[_0xf7f8('0x37')]=0xf;_0x52cb1e[_0xf7f8('0x3b')]='Global';return _0x52cb1e;};exports[_0xf7f8('0x54')]=function(_0x15968d,_0x1ca094,_0x43ab10){var _0x25ffec={};_0x25ffec[_0x1ca094]=_0x15968d[_0x1ca094];_0x25ffec['active']=![];_0x25ffec[_0xf7f8('0x55')]=moment()['add'](_0x43ab10,_0xf7f8('0x56'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25ffec[_0xf7f8('0x1d')]=_0x15968d[_0xf7f8('0x1d')];_0x25ffec[_0xf7f8('0x57')]=_0x15968d['ListId'];_0x25ffec['VoiceQueueId']=_0x15968d['VoiceQueueId']||undefined;return _0x25ffec;};exports['decrementTalkink']=function(_0x2fcd9b,_0x21f6b4){if(!_[_0xf7f8('0x18')](_0x2fcd9b)){if(_0x2fcd9b['pTalking']>0x0){_0x2fcd9b[_0xf7f8('0x58')]-=0x1;}else{logger[_0xf7f8('0xb')](_0x21f6b4,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xf7f8('0xb')](_0x21f6b4,_0xf7f8('0x59'));}};exports['IsNotLoggedIn']=function(_0x1baa3b){if(_0x1baa3b<=0x0){return!![];}return![];};exports[_0xf7f8('0x5a')]=function(_0x18245b,_0x38503d,_0x385f31){_0x18245b['lastevent']=_0x38503d;_0x18245b[_0xf7f8('0x1b')]=_0x18245b[_0xf7f8('0x5b')];_0x18245b[_0xf7f8('0x5c')]=_0x18245b[_0xf7f8('0x4b')];_0x18245b[_0xf7f8('0x5d')]=_0xf7f8('0x5e');if(_0x385f31){_0x18245b['mandatoryDisposition']=_0x385f31[_0xf7f8('0x5f')];}return _0x18245b;};exports[_0xf7f8('0x60')]=function(_0x19b73a){var _0x2239f6={};_0x2239f6[_0xf7f8('0x5b')]=_0x19b73a[_0xf7f8('0x5b')];_0x2239f6[_0xf7f8('0x5c')]=_0x19b73a[_0xf7f8('0x4b')];_0x2239f6['uniqueid']=_0x19b73a[_0xf7f8('0x49')];return _0x2239f6;};exports[_0xf7f8('0x61')]=function(_0x2fde6c){var _0x45ca5d=[];for(var _0x4c47ab in _0x2fde6c){if(_0x2fde6c[_0xf7f8('0x2f')](_0x4c47ab)){if(!_['isNil'](_0x2fde6c[_0x4c47ab])&&_0x2fde6c[_0x4c47ab][_0xf7f8('0x37')]===_0xf7f8('0x62')&&_0x2fde6c[_0x4c47ab][_0xf7f8('0x63')]==='reachable'){_0x45ca5d[_0xf7f8('0x64')](_0x2fde6c[_0x4c47ab]['id']);}}}return _0x45ca5d;};exports[_0xf7f8('0x65')]=function(_0x471171){var _0x3128ce=moment()['milliseconds'](0x0);var _0x3d3cf1=moment(_0x471171)[_0xf7f8('0x7')](0x0);return _0x3128ce[_0xf7f8('0x8')](_0x3d3cf1,'seconds');};exports[_0xf7f8('0x66')]=function(_0x348e3a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x348e3a[_0xf7f8('0x1d')],'ListId':_0x348e3a['ListId'],'VoiceQueueId':_0x348e3a['VoiceQueueId']||undefined,'CampaignId':_0x348e3a[_0xf7f8('0x67')]||undefined};};exports[_0xf7f8('0x68')]=function(_0x33c7c3){if(_0x33c7c3===_0xf7f8('0x49')||_0x33c7c3===_0xf7f8('0x69')||_0x33c7c3==='queue'||_0x33c7c3===_0xf7f8('0x6a')||_0x33c7c3===_0xf7f8('0x6b')||_0x33c7c3===_0xf7f8('0x6c')||_0x33c7c3===_0xf7f8('0x6d')||_0x33c7c3===_0xf7f8('0x4b')||_0x33c7c3===_0xf7f8('0x47')||_0x33c7c3===_0xf7f8('0x6e')||_0x33c7c3===_0xf7f8('0x1c')||_0x33c7c3===_0xf7f8('0x55')||_0x33c7c3===_0xf7f8('0x4f')||_0x33c7c3===_0xf7f8('0x50')||_0x33c7c3===_0xf7f8('0x6f')||_0x33c7c3==='countglobal'||_0x33c7c3==='callback'||_0x33c7c3===_0xf7f8('0x70')||_0x33c7c3==='callbackat'||_0x33c7c3===_0xf7f8('0x71')||_0x33c7c3===_0xf7f8('0x1d')||_0x33c7c3==='ListId'||_0x33c7c3===_0xf7f8('0x3f')||_0x33c7c3===_0xf7f8('0x1e')||_0x33c7c3===_0xf7f8('0x72')||_0x33c7c3===_0xf7f8('0x73')||_0x33c7c3===_0xf7f8('0x74')||_0x33c7c3===_0xf7f8('0x75')||_0x33c7c3===_0xf7f8('0x76')||_0x33c7c3==='xmd-dialurl'||_0x33c7c3===_0xf7f8('0x77')||_0x33c7c3==='xmd-dialoptions'||_0x33c7c3===_0xf7f8('0x78')||_0x33c7c3===_0xf7f8('0x79')||_0x33c7c3===_0xf7f8('0x7a')||_0x33c7c3===_0xf7f8('0x7b')||_0x33c7c3===_0xf7f8('0x7c')||_0x33c7c3==='xmd-agiafter'||_0x33c7c3==='xmd-agi'||_0x33c7c3===_0xf7f8('0x7d')||_0x33c7c3==='rtpaudioqosbridged'||_0x33c7c3===_0xf7f8('0x7e')||_0x33c7c3===_0xf7f8('0x7f')||_0x33c7c3===_0xf7f8('0x80')||_0x33c7c3==='rtpaudioqoslossbridged'||_0x33c7c3===_0xf7f8('0x81')||_0x33c7c3===_0xf7f8('0x82')||_0x33c7c3==='rtpaudioqos'||_0x33c7c3==='rtpaudioqosbridged'||_0x33c7c3==='rtpaudioqosjitter'||_0x33c7c3===_0xf7f8('0x7f')||_0x33c7c3==='rtpaudioqosloss'||_0x33c7c3===_0xf7f8('0x83')||_0x33c7c3===_0xf7f8('0x81')||_0x33c7c3===_0xf7f8('0x82')||_0x33c7c3===_0xf7f8('0x84')||_0x33c7c3===_0xf7f8('0x85')||_0x33c7c3===_0xf7f8('0x37')||_0x33c7c3==='statedesc'){return![];}return!![];};exports[_0xf7f8('0x86')]=function(_0x368c3e,_0x5953f2){var _0x220da2,_0x3533f7,_0x273cb6;if(_0x5953f2<=0x0){_0x5953f2=0x1;}_0x220da2=new RegExp(_0xf7f8('0x87')+_0x5953f2+'}$');_0x3533f7=Math['pow'](0xa,_0x5953f2-0x1);_0x273cb6=Math[_0xf7f8('0x88')](0xa,_0x5953f2)-0x1;return util[_0xf7f8('0x15')]('%s',_[_0xf7f8('0x89')](_0x368c3e,_0x220da2,_[_0xf7f8('0x8a')](_0x3533f7,_0x273cb6)));};exports[_0xf7f8('0x8b')]=function(_0x3ddafb){var _0x369353=_0x3ddafb[_0xf7f8('0x8c')](/"(.*?)"/);return _0x369353?_0x369353[0x1]:_0x3ddafb;};exports['extractCalleridNumber']=function(_0x3f3b68){var _0x5bd255=_0x3f3b68[_0xf7f8('0x8c')](/<(.*?)>/);return _0x5bd255?_0x5bd255[0x1]:_0x3f3b68;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3d43439..45ece53 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 _0x83f7=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','reload','voicequeuechannel'];(function(_0x41a49c,_0x33be78){var _0x534b4e=function(_0x588bf5){while(--_0x588bf5){_0x41a49c['push'](_0x41a49c['shift']());}};_0x534b4e(++_0x33be78);}(_0x83f7,0x175));var _0x783f=function(_0x5a6d51,_0x55e339){_0x5a6d51=_0x5a6d51-0x0;var _0x44e994=_0x83f7[_0x5a6d51];return _0x44e994;};'use strict';exports[_0x783f('0x0')]={'queue':{'type':_0x783f('0x1'),'required':!![]},'interface':{'type':_0x783f('0x1'),'required':!![]},'membername':{'type':_0x783f('0x1'),'required':!![]},'penalty':{'type':_0x783f('0x2'),'required':![]},'paused':{'type':_0x783f('0x3'),'required':![]}};exports[_0x783f('0x4')]={'queue':{'type':_0x783f('0x1'),'required':!![]},'interface':{'type':_0x783f('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x783f('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x783f('0x5')]={'module':{'type':_0x783f('0x1'),'required':![]}};exports[_0x783f('0x6')]={'uniqueid':{'type':_0x783f('0x1'),'required':!![]}};exports[_0x783f('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x783f('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x783f('0x1')}};exports[_0x783f('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x783f('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x783f('0x1'),'required':!![]},'context':{'type':_0x783f('0x1')}}; \ No newline at end of file +var _0x3f80=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number'];(function(_0xc67563,_0x5d40fb){var _0x420434=function(_0x5ec1e2){while(--_0x5ec1e2){_0xc67563['push'](_0xc67563['shift']());}};_0x420434(++_0x5d40fb);}(_0x3f80,0xa7));var _0x03f8=function(_0x32f825,_0x22a80f){_0x32f825=_0x32f825-0x0;var _0x59a157=_0x3f80[_0x32f825];return _0x59a157;};'use strict';exports[_0x03f8('0x0')]={'queue':{'type':_0x03f8('0x1'),'required':!![]},'interface':{'type':_0x03f8('0x1'),'required':!![]},'membername':{'type':_0x03f8('0x1'),'required':!![]},'penalty':{'type':_0x03f8('0x2'),'required':![]},'paused':{'type':_0x03f8('0x3'),'required':![]}};exports[_0x03f8('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x03f8('0x5')]={'interface':{'type':_0x03f8('0x1'),'required':!![]},'paused':{'type':_0x03f8('0x3')},'reason':{'type':_0x03f8('0x1'),'required':![]}};exports[_0x03f8('0x6')]={'module':{'type':_0x03f8('0x1'),'required':![]}};exports[_0x03f8('0x7')]={'uniqueid':{'type':_0x03f8('0x1'),'required':!![]}};exports[_0x03f8('0x8')]={'uniqueid':{'type':_0x03f8('0x1'),'required':!![]},'filename':{'type':_0x03f8('0x1')},'format':{'type':_0x03f8('0x1')},'mixmonitorid':{'type':_0x03f8('0x1')}};exports[_0x03f8('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x03f8('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 dd8c724..9551cb4 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 _0xeca1=['servicenowAccounts','dynamics365Accounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','isUndefined','initTrunks','initVoiceQueues','voiceQueues','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','sumHoldTime','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','diff','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','channels','queueChannels','outboundChannels','timers','settings','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts'];(function(_0x2656f6,_0x39f39c){var _0x4ede31=function(_0x328555){while(--_0x328555){_0x2656f6['push'](_0x2656f6['shift']());}};_0x4ede31(++_0x39f39c);}(_0xeca1,0x1f3));var _0x1eca=function(_0x44e42b,_0x59e450){_0x44e42b=_0x44e42b-0x0;var _0x5575c2=_0xeca1[_0x44e42b];return _0x5575c2;};'use strict';var BPromise=require(_0x1eca('0x0'));var util=require(_0x1eca('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x1eca('0x2'));var Telephone=require(_0x1eca('0x3'));var Trunk=require(_0x1eca('0x4'));var VoiceQueue=require(_0x1eca('0x5'));var Trigger=require(_0x1eca('0x6'));var Template=require(_0x1eca('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x1eca('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x1eca('0x9'));var FreshdeskAccount=require(_0x1eca('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x1eca('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x1eca('0xc'));var ServicenowAccount=require(_0x1eca('0xd'));var Dynamics365Account=require(_0x1eca('0xe'));var FreshsalesAccount=require(_0x1eca('0xf'));var FaxAccount=require(_0x1eca('0x10'));var Realtime=function(){this[_0x1eca('0x11')]={};this[_0x1eca('0x12')]={};this[_0x1eca('0x13')]={};this['voiceQueues']={};this[_0x1eca('0x14')]={};this[_0x1eca('0x15')]={};this[_0x1eca('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x1eca('0x17')]={};this[_0x1eca('0x18')]={};this[_0x1eca('0x19')]={};this[_0x1eca('0x1a')]={};this[_0x1eca('0x1b')]={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x1eca('0x1c')]={};this[_0x1eca('0x1d')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x1eca('0x1e')]={};this[_0x1eca('0x1f')]={};this[_0x1eca('0x20')]={};this['freshsalesAccounts']={};this[_0x1eca('0x21')]={};};function freeIsNotKey(_0x165011,_0x3aa47f,_0x269a23){var _0x10048b=_['mapKeys'](_0x165011,function(_0x4417e6,_0x8bddb3){return _0x4417e6[_0x269a23];});for(var _0x374fc6 in _0x3aa47f){if(_0x3aa47f[_0x1eca('0x22')](_0x374fc6)){if(!_0x10048b[_0x374fc6]){delete _0x3aa47f[_0x374fc6];}}}}function freeIsNotKeySip(_0xe91c89,_0x4b56f4){var _0x131b42=_[_0x1eca('0x23')](_0xe91c89,function(_0x464956,_0x364cc2){return util[_0x1eca('0x24')](_0x1eca('0x25'),_0x464956[_0x1eca('0x26')]);});for(var _0x2a0880 in _0x4b56f4){if(_0x4b56f4[_0x1eca('0x22')](_0x2a0880)){if(!_0x131b42[_0x2a0880]){delete _0x4b56f4[_0x2a0880];}}}}function freeIsNotKeyAgent(_0x2e9ef5,_0x51532e){var _0x151a49=_[_0x1eca('0x23')](_0x2e9ef5,function(_0x2e5251,_0x1a6654){var _0x181e70=_[_0x1eca('0x27')](_0x2e5251['interface'])?util[_0x1eca('0x24')]('SIP/%s',_0x2e5251[_0x1eca('0x26')]):_0x2e5251[_0x1eca('0x28')];return _0x181e70;});for(var _0x25a0e2 in _0x51532e){if(_0x51532e['hasOwnProperty'](_0x25a0e2)){if(!_0x151a49[_0x25a0e2]){delete _0x51532e[_0x25a0e2];}}}}function clearVoiceCallReports(_0xa8730c){_0xa8730c[_0x1eca('0x29')]=0x0;_0xa8730c[_0x1eca('0x2a')]=0x0;_0xa8730c['sumHoldTime']=0x0;_0xa8730c[_0x1eca('0x2b')]=0x0;_0xa8730c[_0x1eca('0x2c')]=0x0;}function clearCampaigns(_0x617ff2){if(!_[_0x1eca('0x2d')](_0x617ff2)){for(var _0xa8984e in _0x617ff2){if(_0x617ff2[_0x1eca('0x22')](_0xa8984e)){_0x617ff2[_0xa8984e]['ivrTotalCallsDays']=0x0;_0x617ff2[_0xa8984e][_0x1eca('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x39691b){if(!_[_0x1eca('0x2d')](_0x39691b)){for(var _0x4868d5 in _0x39691b){if(_0x39691b['hasOwnProperty'](_0x4868d5)){_0x39691b[_0x4868d5][_0x1eca('0x29')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x2a')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x2f')]=0x0;_0x39691b[_0x4868d5]['abandoned']=0x0;_0x39691b[_0x4868d5]['sumHoldTime']=0x0;_0x39691b[_0x4868d5]['sumDuration']=0x0;_0x39691b[_0x4868d5]['sumBillable']=0x0;_0x39691b[_0x4868d5][_0x1eca('0x30')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x31')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x32')]=0x0;_0x39691b[_0x4868d5]['outboundCongestionCallsDay']=0x0;_0x39691b[_0x4868d5][_0x1eca('0x33')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x34')]=0x0;_0x39691b[_0x4868d5]['outboundDropCallsDayTimeout']=0x0;_0x39691b[_0x4868d5][_0x1eca('0x35')]=0x0;_0x39691b[_0x4868d5]['outboundBlacklistCallsDay']=0x0;_0x39691b[_0x4868d5]['outboundOriginateFailureCallsDay']=0x0;_0x39691b[_0x4868d5][_0x1eca('0x36')]=0x0;_0x39691b[_0x4868d5]['outboundReCallsDay']=0x0;_0x39691b[_0x4868d5][_0x1eca('0x30')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x37')]=0x0;_0x39691b[_0x4868d5][_0x1eca('0x38')]=!![];}}}}Realtime[_0x1eca('0x39')][_0x1eca('0x3a')]=function(_0x2cfd72,_0x2cbb26){for(var _0x257ac5 in _0x2cbb26){if(_0x2cfd72[_0x1eca('0x22')](_0x257ac5)){_0x2cfd72[_0x257ac5]=_0x2cbb26[_0x257ac5];}}};Realtime[_0x1eca('0x39')][_0x1eca('0x3b')]=function(){var _0x279db5=this;return function(_0x328c0d){if(_0x328c0d){freeIsNotKeyAgent(_0x328c0d,_0x279db5[_0x1eca('0x11')]);for(var _0x594c17=0x0,_0x566d01={},_0x18a4dd={};_0x594c17<_0x328c0d[_0x1eca('0x3c')];_0x594c17+=0x1){_0x566d01=_0x328c0d[_0x594c17];var _0x43a24f=_[_0x1eca('0x27')](_0x566d01['interface'])?util[_0x1eca('0x24')](_0x1eca('0x25'),_0x566d01['name']):_0x566d01[_0x1eca('0x28')];if(_['isUndefined'](_0x279db5[_0x1eca('0x11')][_0x43a24f])){_0x279db5[_0x1eca('0x11')][_0x43a24f]=new Agent(_0x566d01);}else{_0x279db5[_0x1eca('0x3a')](_0x279db5[_0x1eca('0x11')][_0x43a24f],_0x566d01);}}}return _0x279db5[_0x1eca('0x11')];};};Realtime['prototype'][_0x1eca('0x3d')]=function(){var _0x445d01=this;return function(_0x44b1f8){if(_0x44b1f8){freeIsNotKeySip(_0x44b1f8,_0x445d01['telephones']);for(var _0x9e0072=0x0,_0x2c4a86={},_0x48cf8d={};_0x9e0072<_0x44b1f8[_0x1eca('0x3c')];_0x9e0072+=0x1){_0x2c4a86=_0x44b1f8[_0x9e0072];if(_[_0x1eca('0x3e')](_0x445d01[_0x1eca('0x12')][util[_0x1eca('0x24')](_0x1eca('0x25'),_0x2c4a86[_0x1eca('0x26')])])){_0x445d01['telephones'][util[_0x1eca('0x24')](_0x1eca('0x25'),_0x2c4a86[_0x1eca('0x26')])]=new Telephone(_0x2c4a86);}else{_0x445d01[_0x1eca('0x3a')](_0x445d01[_0x1eca('0x12')][util[_0x1eca('0x24')](_0x1eca('0x25'),_0x2c4a86[_0x1eca('0x26')])],_0x2c4a86);}}}return _0x445d01[_0x1eca('0x12')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x3f')]=function(){var _0x4c6280=this;return function(_0x1ddf28){if(_0x1ddf28){freeIsNotKeySip(_0x1ddf28,_0x4c6280['trunks']);for(var _0x4d2bea=0x0,_0x2512fd={},_0xbeaa66={};_0x4d2bea<_0x1ddf28[_0x1eca('0x3c')];_0x4d2bea+=0x1){_0x2512fd=_0x1ddf28[_0x4d2bea];if(_[_0x1eca('0x3e')](_0x4c6280['trunks'][util[_0x1eca('0x24')](_0x1eca('0x25'),_0x2512fd['name'])])){_0x4c6280[_0x1eca('0x13')][util[_0x1eca('0x24')](_0x1eca('0x25'),_0x2512fd[_0x1eca('0x26')])]=new Trunk(_0x2512fd);}else{_0x4c6280['mergeFromDatabase'](_0x4c6280[_0x1eca('0x13')][util['format'](_0x1eca('0x25'),_0x2512fd[_0x1eca('0x26')])],_0x2512fd);}}}return _0x4c6280['trunks'];};};Realtime[_0x1eca('0x39')][_0x1eca('0x40')]=function(){var _0x4f77c5=this;return function(_0x5623f8){if(_0x5623f8){freeIsNotKey(_0x5623f8,_0x4f77c5[_0x1eca('0x41')],_0x1eca('0x26'));for(var _0x740f7d=0x0,_0x513f70={},_0xb5f317={};_0x740f7d<_0x5623f8[_0x1eca('0x3c')];_0x740f7d+=0x1){_0x513f70=_0x5623f8[_0x740f7d];if(_[_0x1eca('0x3e')](_0x4f77c5[_0x1eca('0x41')][_0x513f70[_0x1eca('0x26')]])){_0x4f77c5['voiceQueues'][_0x513f70['name']]=new VoiceQueue(_0x513f70);}else{_0x4f77c5['mergeFromDatabase'](_0x4f77c5[_0x1eca('0x41')][_0x513f70[_0x1eca('0x26')]],_0x513f70);}}}return _0x4f77c5[_0x1eca('0x41')];};};Realtime[_0x1eca('0x39')]['initTriggers']=function(){var _0x228cb8=this;return function(_0x36db03){if(_0x36db03){freeIsNotKey(_0x36db03,_0x228cb8[_0x1eca('0x14')],'id');for(var _0xfd15d8=0x0,_0x31fbe1={},_0x3338bc={};_0xfd15d8<_0x36db03[_0x1eca('0x3c')];_0xfd15d8+=0x1){_0x31fbe1=_0x36db03[_0xfd15d8];if(_[_0x1eca('0x3e')](_0x228cb8[_0x1eca('0x14')][_0x31fbe1['id']])){_0x228cb8[_0x1eca('0x14')][_0x31fbe1['id']]=new Trigger(_0x31fbe1);}else{_0x228cb8['mergeFromDatabase'](_0x228cb8['triggers'][_0x31fbe1['id']],_0x31fbe1);}}}return _0x228cb8[_0x1eca('0x14')];};};Realtime[_0x1eca('0x39')]['initTemplates']=function(){var _0xeaa8e0=this;return function(_0x222160){if(_0x222160){freeIsNotKey(_0x222160,_0xeaa8e0['templates'],'id');for(var _0x58e4b3=0x0,_0x4f5dba={},_0x524bdb={};_0x58e4b3<_0x222160[_0x1eca('0x3c')];_0x58e4b3+=0x1){_0x4f5dba=_0x222160[_0x58e4b3];if(_[_0x1eca('0x3e')](_0xeaa8e0[_0x1eca('0x16')][_0x4f5dba['id']])){_0xeaa8e0[_0x1eca('0x16')][_0x4f5dba['id']]=new Template(_0x4f5dba);}else{_0xeaa8e0[_0x1eca('0x3a')](_0xeaa8e0['templates'][_0x4f5dba['id']],_0x4f5dba);}}}return _0xeaa8e0['templates'];};};Realtime[_0x1eca('0x39')]['initZendeskAccounts']=function(){var _0x1a44ce=this;return function(_0x85d9e3){if(_0x85d9e3){freeIsNotKey(_0x85d9e3,_0x1a44ce['zendeskAccounts'],'id');for(var _0x1123de=0x0,_0x3882c7={},_0x533bea={};_0x1123de<_0x85d9e3[_0x1eca('0x3c')];_0x1123de+=0x1){_0x3882c7=_0x85d9e3[_0x1123de];if(_[_0x1eca('0x3e')](_0x1a44ce[_0x1eca('0x42')][_0x3882c7['id']])){_0x1a44ce[_0x1eca('0x42')][_0x3882c7['id']]=new ZendeskAccount(_0x3882c7);}else{_0x1a44ce[_0x1eca('0x3a')](_0x1a44ce[_0x1eca('0x42')][_0x3882c7['id']],_0x3882c7);}}}return _0x1a44ce[_0x1eca('0x42')];};};Realtime['prototype'][_0x1eca('0x43')]=function(){var _0x57daae=this;return function(_0x5db58f){if(_0x5db58f){freeIsNotKey(_0x5db58f,_0x57daae[_0x1eca('0x44')],'id');for(var _0x34f049=0x0,_0xc4b080={},_0x5a0927={};_0x34f049<_0x5db58f['length'];_0x34f049+=0x1){_0xc4b080=_0x5db58f[_0x34f049];if(_[_0x1eca('0x3e')](_0x57daae[_0x1eca('0x44')][_0xc4b080['id']])){_0x57daae[_0x1eca('0x44')][_0xc4b080['id']]=new SalesforceAccount(_0xc4b080);}else{_0x57daae[_0x1eca('0x3a')](_0x57daae[_0x1eca('0x44')][_0xc4b080['id']],_0xc4b080);}}}return _0x57daae[_0x1eca('0x44')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x45')]=function(){var _0x24c35c=this;return function(_0x2ced38){if(_0x2ced38){freeIsNotKey(_0x2ced38,_0x24c35c[_0x1eca('0x1d')],'id');for(var _0x2de325=0x0,_0x40c793={},_0x39f1a3={};_0x2de325<_0x2ced38[_0x1eca('0x3c')];_0x2de325+=0x1){_0x40c793=_0x2ced38[_0x2de325];if(_['isUndefined'](_0x24c35c[_0x1eca('0x1d')][_0x40c793['id']])){_0x24c35c[_0x1eca('0x1d')][_0x40c793['id']]=new FreshdeskAccount(_0x40c793);}else{_0x24c35c[_0x1eca('0x3a')](_0x24c35c['freshdeskAccounts'][_0x40c793['id']],_0x40c793);}}}return _0x24c35c[_0x1eca('0x1d')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x46')]=function(){var _0x438093=this;return function(_0x4f8d40){if(_0x4f8d40){freeIsNotKey(_0x4f8d40,_0x438093[_0x1eca('0x47')],'id');for(var _0x2c83c8=0x0,_0x3d99e1={},_0x24e05b={};_0x2c83c8<_0x4f8d40[_0x1eca('0x3c')];_0x2c83c8+=0x1){_0x3d99e1=_0x4f8d40[_0x2c83c8];if(_[_0x1eca('0x3e')](_0x438093['zohoAccounts'][_0x3d99e1['id']])){_0x438093[_0x1eca('0x47')][_0x3d99e1['id']]=new ZohoAccount(_0x3d99e1);}else{_0x438093[_0x1eca('0x3a')](_0x438093[_0x1eca('0x47')][_0x3d99e1['id']],_0x3d99e1);}}}return _0x438093[_0x1eca('0x47')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x48')]=function(){var _0x158877=this;return function(_0x175f61){if(_0x175f61){freeIsNotKey(_0x175f61,_0x158877[_0x1eca('0x49')],'id');for(var _0x438b95=0x0,_0x1e37e0={},_0x327ca9={};_0x438b95<_0x175f61[_0x1eca('0x3c')];_0x438b95+=0x1){_0x1e37e0=_0x175f61[_0x438b95];if(_[_0x1eca('0x3e')](_0x158877[_0x1eca('0x49')][_0x1e37e0['id']])){_0x158877[_0x1eca('0x49')][_0x1e37e0['id']]=new DeskAccount(_0x1e37e0);}else{_0x158877[_0x1eca('0x3a')](_0x158877[_0x1eca('0x49')][_0x1e37e0['id']],_0x1e37e0);}}}return _0x158877[_0x1eca('0x49')];};};Realtime[_0x1eca('0x39')]['initSugarcrmAccounts']=function(){var _0x3bc4c0=this;return function(_0x5ea7c9){if(_0x5ea7c9){freeIsNotKey(_0x5ea7c9,_0x3bc4c0['sugarcrmAccounts'],'id');for(var _0x5336fc=0x0,_0x152d02={},_0x1ce58d={};_0x5336fc<_0x5ea7c9[_0x1eca('0x3c')];_0x5336fc+=0x1){_0x152d02=_0x5ea7c9[_0x5336fc];if(_[_0x1eca('0x3e')](_0x3bc4c0[_0x1eca('0x1c')][_0x152d02['id']])){_0x3bc4c0['sugarcrmAccounts'][_0x152d02['id']]=new SugarcrmAccount(_0x152d02);}else{_0x3bc4c0[_0x1eca('0x3a')](_0x3bc4c0[_0x1eca('0x1c')][_0x152d02['id']],_0x152d02);}}}return _0x3bc4c0['sugarcrmAccounts'];};};Realtime[_0x1eca('0x39')][_0x1eca('0x4a')]=function(){var _0x1d7f67=this;return function(_0x1e4ac8){if(_0x1e4ac8){freeIsNotKey(_0x1e4ac8,_0x1d7f67[_0x1eca('0x1e')],'id');for(var _0x505b0a=0x0,_0x303007={},_0x315e94={};_0x505b0a<_0x1e4ac8[_0x1eca('0x3c')];_0x505b0a+=0x1){_0x303007=_0x1e4ac8[_0x505b0a];if(_[_0x1eca('0x3e')](_0x1d7f67[_0x1eca('0x1e')][_0x303007['id']])){_0x1d7f67['vtigerAccounts'][_0x303007['id']]=new VtigerAccount(_0x303007);}else{_0x1d7f67[_0x1eca('0x3a')](_0x1d7f67[_0x1eca('0x1e')][_0x303007['id']],_0x303007);}}}return _0x1d7f67['vtigerAccounts'];};};Realtime[_0x1eca('0x39')][_0x1eca('0x4b')]=function(){var _0x231b9b=this;return function(_0x4ebe89){if(_0x4ebe89){freeIsNotKey(_0x4ebe89,_0x231b9b[_0x1eca('0x1f')],'id');for(var _0x3eabc2=0x0,_0x26d22c={},_0x225cd5={};_0x3eabc2<_0x4ebe89[_0x1eca('0x3c')];_0x3eabc2+=0x1){_0x26d22c=_0x4ebe89[_0x3eabc2];if(_[_0x1eca('0x3e')](_0x231b9b[_0x1eca('0x1f')][_0x26d22c['id']])){_0x231b9b[_0x1eca('0x1f')][_0x26d22c['id']]=new ServicenowAccount(_0x26d22c);}else{_0x231b9b[_0x1eca('0x3a')](_0x231b9b[_0x1eca('0x1f')][_0x26d22c['id']],_0x26d22c);}}}return _0x231b9b[_0x1eca('0x1f')];};};Realtime['prototype'][_0x1eca('0x4c')]=function(){var _0x5f2c5a=this;return function(_0x2fd245){if(_0x2fd245){freeIsNotKey(_0x2fd245,_0x5f2c5a[_0x1eca('0x20')],'id');for(var _0x31f5b3=0x0,_0x13228e={},_0x23a614={};_0x31f5b3<_0x2fd245[_0x1eca('0x3c')];_0x31f5b3+=0x1){_0x13228e=_0x2fd245[_0x31f5b3];if(_['isUndefined'](_0x5f2c5a[_0x1eca('0x20')][_0x13228e['id']])){_0x5f2c5a[_0x1eca('0x20')][_0x13228e['id']]=new Dynamics365Account(_0x13228e);}else{_0x5f2c5a['mergeFromDatabase'](_0x5f2c5a['dynamics365Accounts'][_0x13228e['id']],_0x13228e);}}}return _0x5f2c5a[_0x1eca('0x20')];};};Realtime['prototype'][_0x1eca('0x4d')]=function(){var _0x33d085=this;return function(_0x192c60){if(_0x192c60){freeIsNotKey(_0x192c60,_0x33d085[_0x1eca('0x4e')],'id');for(var _0x30a4ad=0x0,_0x11e38b={},_0x52dbfe={};_0x30a4ad<_0x192c60['length'];_0x30a4ad+=0x1){_0x11e38b=_0x192c60[_0x30a4ad];if(_[_0x1eca('0x3e')](_0x33d085[_0x1eca('0x4e')][_0x11e38b['id']])){_0x33d085[_0x1eca('0x4e')][_0x11e38b['id']]=new FreshsalesAccount(_0x11e38b);}else{_0x33d085[_0x1eca('0x3a')](_0x33d085[_0x1eca('0x4e')][_0x11e38b['id']],_0x11e38b);}}}return _0x33d085[_0x1eca('0x4e')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x4f')]=function(){var _0x48ba05=this;return function(_0x4b5adb){for(var _0x2a7098=0x0;_0x2a7098<_0x4b5adb[_0x1eca('0x3c')];_0x2a7098+=0x1){_['merge'](_0x48ba05['voiceQueues'][_0x4b5adb[_0x2a7098]['name']],_0x4b5adb[_0x2a7098]);}return _0x48ba05[_0x1eca('0x41')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x50')]=function(){var _0x180bd9=this;return function(_0x3a1c31){clearVoiceQueues(_0x180bd9[_0x1eca('0x41')]);if(_0x3a1c31){_0x3a1c31=_[_0x1eca('0x51')](_0x3a1c31,_0x1eca('0x52'));for(var _0x815bc8 in _0x3a1c31){if(_0x3a1c31['hasOwnProperty'](_0x815bc8)){var _0x13d047={};for(var _0x133869=0x0;_0x133869<_0x3a1c31[_0x815bc8][_0x1eca('0x3c')];_0x133869+=0x1){var _0xd3b803=_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x53')];if(_0x180bd9['voiceQueues'][_0xd3b803]){if(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x54')]){_0x180bd9['voiceQueues'][_0xd3b803][_0x1eca('0x2f')]+=0x1;}if(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x55')]){_0x180bd9[_0x1eca('0x41')][_0xd3b803][_0x1eca('0x56')]+=0x1;}_0x180bd9[_0x1eca('0x41')][_0xd3b803][_0x1eca('0x57')]+=moment(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x58')])['diff'](moment(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x59')]),_0x1eca('0x5a'))||0x0;if(_0x133869===_0x3a1c31[_0x815bc8]['length']-0x1){_0x180bd9[_0x1eca('0x41')][_0xd3b803]['sumDuration']+=moment(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x5b')]||_0x3a1c31[_0x815bc8][_0x133869]['queuecallerabandonAt']||_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x5c')])[_0x1eca('0x5d')](moment(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x59')]),_0x1eca('0x5a'))||0x0;_0x180bd9[_0x1eca('0x41')][_0xd3b803]['total']+=0x1;if(_0x3a1c31[_0x815bc8][_0x133869]['queuecallercomplete']){_0x180bd9[_0x1eca('0x41')][_0xd3b803][_0x1eca('0x2a')]+=0x1;_0x180bd9[_0x1eca('0x41')][_0xd3b803][_0x1eca('0x2c')]+=moment(_0x3a1c31[_0x815bc8][_0x133869]['queuecallercompleteAt'])[_0x1eca('0x5d')](moment(_0x3a1c31[_0x815bc8][_0x133869][_0x1eca('0x58')]),'seconds')||0x0;}}else{_0x180bd9['voiceQueues'][_0xd3b803][_0x1eca('0x2b')]+=_0x180bd9[_0x1eca('0x41')][_0xd3b803][_0x1eca('0x57')]||0x0;}}}}}}return _0x180bd9[_0x1eca('0x41')];};};Realtime['prototype'][_0x1eca('0x5e')]=function(){var _0x5d9adb=this;return function(_0x104436){clearVoiceCallReports(_0x5d9adb[_0x1eca('0x5f')]);if(_0x104436){for(var _0x542312=0x0;_0x542312<_0x104436[_0x1eca('0x3c')];_0x542312+=0x1){_0x5d9adb[_0x1eca('0x5f')][_0x1eca('0x29')]+=0x1;_0x5d9adb[_0x1eca('0x5f')][_0x1eca('0x2b')]+=_0x104436[_0x542312][_0x1eca('0x60')];if(_0x104436[_0x542312]['disposition']===_0x1eca('0x61')){_0x5d9adb[_0x1eca('0x5f')]['answered']+=0x1;_0x5d9adb[_0x1eca('0x5f')][_0x1eca('0x57')]+=_0x104436[_0x542312]['duration']-_0x104436[_0x542312][_0x1eca('0x62')]||0x0;_0x5d9adb[_0x1eca('0x5f')][_0x1eca('0x2c')]+=_0x104436[_0x542312]['billableseconds'];}}}return _0x5d9adb[_0x1eca('0x5f')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x63')]=function(){var _0x18c425=this;return function(_0x519428){if(_0x519428){freeIsNotKey(_0x519428,_0x18c425['campaigns'],_0x1eca('0x26'));for(var _0x1ded43=0x0,_0x377b8a={};_0x1ded43<_0x519428[_0x1eca('0x3c')];_0x1ded43+=0x1){_0x377b8a=_0x519428[_0x1ded43];if(_[_0x1eca('0x3e')](_0x18c425[_0x1eca('0x15')][_0x377b8a[_0x1eca('0x26')]])){_0x18c425[_0x1eca('0x15')][_0x377b8a[_0x1eca('0x26')]]=new Campaign(_0x377b8a);}else{_0x18c425[_0x1eca('0x3a')](_0x18c425[_0x1eca('0x15')][_0x377b8a['name']],_0x377b8a);_0x18c425[_0x1eca('0x15')][_0x377b8a[_0x1eca('0x26')]][_0x1eca('0x64')]=_0x377b8a[_0x1eca('0x65')]?_0x377b8a[_0x1eca('0x65')]['name']:undefined;}}}return _0x18c425[_0x1eca('0x15')];};};Realtime[_0x1eca('0x39')]['initVoiceExtensions']=function(){var _0x358651=this;return function(_0x16ee68){if(_0x16ee68){freeIsNotKey(_0x16ee68,_0x358651[_0x1eca('0x66')],'id');for(var _0x3f41d5=0x0,_0x5ca570={};_0x3f41d5<_0x16ee68[_0x1eca('0x3c')];_0x3f41d5+=0x1){_0x5ca570=_0x16ee68[_0x3f41d5];if(_['isUndefined'](_0x358651[_0x1eca('0x66')][_0x5ca570['id']])){_0x358651[_0x1eca('0x66')][_0x5ca570['id']]=new VoiceExtension(_0x5ca570);}else{_0x358651[_0x1eca('0x3a')](_0x358651['voiceExtensions'][_0x5ca570['id']],_0x5ca570);}}}return _0x358651[_0x1eca('0x66')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x67')]=function(){var _0x5081d4=this;return function(_0x2aacae){clearCampaigns(_0x5081d4['campaigns']);for(var _0x244b5e=0x0;_0x244b5e<_0x2aacae[_0x1eca('0x3c')];_0x244b5e+=0x1){_[_0x1eca('0x68')](_0x5081d4[_0x1eca('0x15')][_0x2aacae[_0x244b5e]['name']],_0x2aacae[_0x244b5e]);}return _0x5081d4[_0x1eca('0x15')];};};Realtime[_0x1eca('0x39')][_0x1eca('0x69')]=function(){var _0x5fd1d6=this;return function(_0x12fbc7){if(_0x12fbc7){freeIsNotKey(_0x12fbc7,_0x5fd1d6[_0x1eca('0x21')],'id');for(var _0x4386d7=0x0,_0x26db56={},_0x497c22={};_0x4386d7<_0x12fbc7['length'];_0x4386d7+=0x1){_0x26db56=_0x12fbc7[_0x4386d7];if(_['isUndefined'](_0x5fd1d6['faxAccounts'][_0x26db56['id']])){_0x5fd1d6[_0x1eca('0x21')][_0x26db56['id']]=new FaxAccount(_0x26db56);}else{_0x5fd1d6[_0x1eca('0x3a')](_0x5fd1d6[_0x1eca('0x21')][_0x26db56['id']],_0x26db56);}}}return _0x5fd1d6[_0x1eca('0x21')];};};module['exports']=Realtime; \ No newline at end of file +var _0xed06=['answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','interface','isUndefined','initTelephones','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','queuecallerjoinAt','seconds','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','voiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil'];(function(_0x21e725,_0x22283b){var _0x1859e7=function(_0x4be5f1){while(--_0x4be5f1){_0x21e725['push'](_0x21e725['shift']());}};_0x1859e7(++_0x22283b);}(_0xed06,0x117));var _0x6ed0=function(_0xcb65be,_0x551ddd){_0xcb65be=_0xcb65be-0x0;var _0x4b7824=_0xed06[_0xcb65be];return _0x4b7824;};'use strict';var BPromise=require(_0x6ed0('0x0'));var util=require(_0x6ed0('0x1'));var _=require(_0x6ed0('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x6ed0('0x3'));var Trunk=require(_0x6ed0('0x4'));var VoiceQueue=require(_0x6ed0('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x6ed0('0x6'));var Campaign=require(_0x6ed0('0x7'));var VoiceExtension=require(_0x6ed0('0x8'));var ZendeskAccount=require(_0x6ed0('0x9'));var SalesforceAccount=require(_0x6ed0('0xa'));var FreshdeskAccount=require(_0x6ed0('0xb'));var SugarcrmAccount=require(_0x6ed0('0xc'));var ZohoAccount=require(_0x6ed0('0xd'));var DeskAccount=require(_0x6ed0('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x6ed0('0xf'));var Dynamics365Account=require(_0x6ed0('0x10'));var FreshsalesAccount=require(_0x6ed0('0x11'));var FaxAccount=require(_0x6ed0('0x12'));var Realtime=function(){this[_0x6ed0('0x13')]={};this[_0x6ed0('0x14')]={};this[_0x6ed0('0x15')]={};this[_0x6ed0('0x16')]={};this[_0x6ed0('0x17')]={};this[_0x6ed0('0x18')]={};this[_0x6ed0('0x19')]={};this[_0x6ed0('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x6ed0('0x1b')]={};this[_0x6ed0('0x1c')]={};this['timers']={};this[_0x6ed0('0x1d')]={};this[_0x6ed0('0x1e')]={};this[_0x6ed0('0x1f')]={};this[_0x6ed0('0x20')]={};this[_0x6ed0('0x21')]={};this[_0x6ed0('0x22')]={};this[_0x6ed0('0x23')]={};this[_0x6ed0('0x24')]={};this['servicenowAccounts']={};this[_0x6ed0('0x25')]={};this[_0x6ed0('0x26')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2e35dc,_0x1c45ec,_0x339c09){var _0x144be7=_[_0x6ed0('0x27')](_0x2e35dc,function(_0x2901ea,_0x5d79a5){return _0x2901ea[_0x339c09];});for(var _0x2862ab in _0x1c45ec){if(_0x1c45ec[_0x6ed0('0x28')](_0x2862ab)){if(!_0x144be7[_0x2862ab]){delete _0x1c45ec[_0x2862ab];}}}}function freeIsNotKeySip(_0x59d264,_0x3fcd3b){var _0x4718ae=_[_0x6ed0('0x27')](_0x59d264,function(_0x1a1b1c,_0x22c9df){return util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1a1b1c[_0x6ed0('0x2b')]);});for(var _0x2d1abe in _0x3fcd3b){if(_0x3fcd3b[_0x6ed0('0x28')](_0x2d1abe)){if(!_0x4718ae[_0x2d1abe]){delete _0x3fcd3b[_0x2d1abe];}}}}function freeIsNotKeyAgent(_0x583cb8,_0x8edf19){var _0x3db026=_[_0x6ed0('0x27')](_0x583cb8,function(_0x1e76c1,_0x232c98){var _0x32074a=_[_0x6ed0('0x2c')](_0x1e76c1['interface'])?util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1e76c1[_0x6ed0('0x2b')]):_0x1e76c1['interface'];return _0x32074a;});for(var _0x4485a3 in _0x8edf19){if(_0x8edf19[_0x6ed0('0x28')](_0x4485a3)){if(!_0x3db026[_0x4485a3]){delete _0x8edf19[_0x4485a3];}}}}function clearVoiceCallReports(_0x2a74bd){_0x2a74bd['total']=0x0;_0x2a74bd[_0x6ed0('0x2d')]=0x0;_0x2a74bd[_0x6ed0('0x2e')]=0x0;_0x2a74bd[_0x6ed0('0x2f')]=0x0;_0x2a74bd[_0x6ed0('0x30')]=0x0;}function clearCampaigns(_0x28dcd6){if(!_[_0x6ed0('0x31')](_0x28dcd6)){for(var _0x3c7e7b in _0x28dcd6){if(_0x28dcd6[_0x6ed0('0x28')](_0x3c7e7b)){_0x28dcd6[_0x3c7e7b][_0x6ed0('0x32')]=0x0;_0x28dcd6[_0x3c7e7b]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x5558d4){if(!_[_0x6ed0('0x31')](_0x5558d4)){for(var _0x3b2205 in _0x5558d4){if(_0x5558d4[_0x6ed0('0x28')](_0x3b2205)){_0x5558d4[_0x3b2205][_0x6ed0('0x33')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x2d')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x34')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x35')]=0x0;_0x5558d4[_0x3b2205]['sumHoldTime']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x2f')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x30')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x36')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x37')]=0x0;_0x5558d4[_0x3b2205]['outboundBusyCallsDay']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x38')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x39')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3a')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3b')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3c')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3d')]=0x0;_0x5558d4[_0x3b2205]['outboundOriginateFailureCallsDay']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3e')]=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x3f')]=0x0;_0x5558d4[_0x3b2205]['outboundAnswerAgiCallsDay']=0x0;_0x5558d4[_0x3b2205]['outboundAnswerCallsDay']=0x0;_0x5558d4[_0x3b2205][_0x6ed0('0x40')]=!![];}}}}Realtime[_0x6ed0('0x41')][_0x6ed0('0x42')]=function(_0x2337d0,_0x306c4f){for(var _0x9d38bd in _0x306c4f){if(_0x2337d0[_0x6ed0('0x28')](_0x9d38bd)){_0x2337d0[_0x9d38bd]=_0x306c4f[_0x9d38bd];}}};Realtime[_0x6ed0('0x41')]['initAgents']=function(){var _0x51e78f=this;return function(_0x3ca7ba){if(_0x3ca7ba){freeIsNotKeyAgent(_0x3ca7ba,_0x51e78f[_0x6ed0('0x13')]);for(var _0x575718=0x0,_0x9d84bc={},_0x2f71ea={};_0x575718<_0x3ca7ba[_0x6ed0('0x43')];_0x575718+=0x1){_0x9d84bc=_0x3ca7ba[_0x575718];var _0x3d9150=_[_0x6ed0('0x2c')](_0x9d84bc['interface'])?util['format']('SIP/%s',_0x9d84bc['name']):_0x9d84bc[_0x6ed0('0x44')];if(_[_0x6ed0('0x45')](_0x51e78f[_0x6ed0('0x13')][_0x3d9150])){_0x51e78f['agents'][_0x3d9150]=new Agent(_0x9d84bc);}else{_0x51e78f[_0x6ed0('0x42')](_0x51e78f[_0x6ed0('0x13')][_0x3d9150],_0x9d84bc);}}}return _0x51e78f[_0x6ed0('0x13')];};};Realtime['prototype'][_0x6ed0('0x46')]=function(){var _0x7d9ce7=this;return function(_0xf2d3e9){if(_0xf2d3e9){freeIsNotKeySip(_0xf2d3e9,_0x7d9ce7[_0x6ed0('0x14')]);for(var _0x1cb3aa=0x0,_0x1c5c6f={},_0x1d4614={};_0x1cb3aa<_0xf2d3e9[_0x6ed0('0x43')];_0x1cb3aa+=0x1){_0x1c5c6f=_0xf2d3e9[_0x1cb3aa];if(_['isUndefined'](_0x7d9ce7[_0x6ed0('0x14')][util['format'](_0x6ed0('0x2a'),_0x1c5c6f[_0x6ed0('0x2b')])])){_0x7d9ce7[_0x6ed0('0x14')][util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1c5c6f[_0x6ed0('0x2b')])]=new Telephone(_0x1c5c6f);}else{_0x7d9ce7[_0x6ed0('0x42')](_0x7d9ce7[_0x6ed0('0x14')][util[_0x6ed0('0x29')](_0x6ed0('0x2a'),_0x1c5c6f[_0x6ed0('0x2b')])],_0x1c5c6f);}}}return _0x7d9ce7[_0x6ed0('0x14')];};};Realtime[_0x6ed0('0x41')]['initTrunks']=function(){var _0x1b0028=this;return function(_0x30bc95){if(_0x30bc95){freeIsNotKeySip(_0x30bc95,_0x1b0028[_0x6ed0('0x15')]);for(var _0x562c61=0x0,_0x5082fc={},_0x281f6c={};_0x562c61<_0x30bc95[_0x6ed0('0x43')];_0x562c61+=0x1){_0x5082fc=_0x30bc95[_0x562c61];if(_[_0x6ed0('0x45')](_0x1b0028['trunks'][util['format'](_0x6ed0('0x2a'),_0x5082fc[_0x6ed0('0x2b')])])){_0x1b0028['trunks'][util[_0x6ed0('0x29')]('SIP/%s',_0x5082fc['name'])]=new Trunk(_0x5082fc);}else{_0x1b0028[_0x6ed0('0x42')](_0x1b0028[_0x6ed0('0x15')][util[_0x6ed0('0x29')]('SIP/%s',_0x5082fc[_0x6ed0('0x2b')])],_0x5082fc);}}}return _0x1b0028[_0x6ed0('0x15')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x47')]=function(){var _0x2b5318=this;return function(_0x32318c){if(_0x32318c){freeIsNotKey(_0x32318c,_0x2b5318[_0x6ed0('0x16')],_0x6ed0('0x2b'));for(var _0x33c013=0x0,_0x531ee5={},_0x1282a0={};_0x33c013<_0x32318c[_0x6ed0('0x43')];_0x33c013+=0x1){_0x531ee5=_0x32318c[_0x33c013];if(_[_0x6ed0('0x45')](_0x2b5318['voiceQueues'][_0x531ee5['name']])){_0x2b5318['voiceQueues'][_0x531ee5[_0x6ed0('0x2b')]]=new VoiceQueue(_0x531ee5);}else{_0x2b5318[_0x6ed0('0x42')](_0x2b5318[_0x6ed0('0x16')][_0x531ee5[_0x6ed0('0x2b')]],_0x531ee5);}}}return _0x2b5318[_0x6ed0('0x16')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x48')]=function(){var _0x3a8e51=this;return function(_0x27ab8a){if(_0x27ab8a){freeIsNotKey(_0x27ab8a,_0x3a8e51[_0x6ed0('0x17')],'id');for(var _0x147c4d=0x0,_0x308fd1={},_0x135cf4={};_0x147c4d<_0x27ab8a[_0x6ed0('0x43')];_0x147c4d+=0x1){_0x308fd1=_0x27ab8a[_0x147c4d];if(_[_0x6ed0('0x45')](_0x3a8e51[_0x6ed0('0x17')][_0x308fd1['id']])){_0x3a8e51[_0x6ed0('0x17')][_0x308fd1['id']]=new Trigger(_0x308fd1);}else{_0x3a8e51[_0x6ed0('0x42')](_0x3a8e51[_0x6ed0('0x17')][_0x308fd1['id']],_0x308fd1);}}}return _0x3a8e51[_0x6ed0('0x17')];};};Realtime['prototype'][_0x6ed0('0x49')]=function(){var _0x5dbc21=this;return function(_0xb29261){if(_0xb29261){freeIsNotKey(_0xb29261,_0x5dbc21['templates'],'id');for(var _0x421e28=0x0,_0x5a1893={},_0x20b264={};_0x421e28<_0xb29261[_0x6ed0('0x43')];_0x421e28+=0x1){_0x5a1893=_0xb29261[_0x421e28];if(_[_0x6ed0('0x45')](_0x5dbc21[_0x6ed0('0x19')][_0x5a1893['id']])){_0x5dbc21[_0x6ed0('0x19')][_0x5a1893['id']]=new Template(_0x5a1893);}else{_0x5dbc21[_0x6ed0('0x42')](_0x5dbc21['templates'][_0x5a1893['id']],_0x5a1893);}}}return _0x5dbc21[_0x6ed0('0x19')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x55dfd5=this;return function(_0xdfd3b1){if(_0xdfd3b1){freeIsNotKey(_0xdfd3b1,_0x55dfd5[_0x6ed0('0x1e')],'id');for(var _0xe33edf=0x0,_0x1aa89b={},_0x43df94={};_0xe33edf<_0xdfd3b1[_0x6ed0('0x43')];_0xe33edf+=0x1){_0x1aa89b=_0xdfd3b1[_0xe33edf];if(_[_0x6ed0('0x45')](_0x55dfd5[_0x6ed0('0x1e')][_0x1aa89b['id']])){_0x55dfd5['zendeskAccounts'][_0x1aa89b['id']]=new ZendeskAccount(_0x1aa89b);}else{_0x55dfd5[_0x6ed0('0x42')](_0x55dfd5[_0x6ed0('0x1e')][_0x1aa89b['id']],_0x1aa89b);}}}return _0x55dfd5[_0x6ed0('0x1e')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4a')]=function(){var _0x3bf36f=this;return function(_0x1fd65f){if(_0x1fd65f){freeIsNotKey(_0x1fd65f,_0x3bf36f['salesforceAccounts'],'id');for(var _0x395a01=0x0,_0x392d9c={},_0x5d0d60={};_0x395a01<_0x1fd65f[_0x6ed0('0x43')];_0x395a01+=0x1){_0x392d9c=_0x1fd65f[_0x395a01];if(_[_0x6ed0('0x45')](_0x3bf36f[_0x6ed0('0x1f')][_0x392d9c['id']])){_0x3bf36f['salesforceAccounts'][_0x392d9c['id']]=new SalesforceAccount(_0x392d9c);}else{_0x3bf36f[_0x6ed0('0x42')](_0x3bf36f['salesforceAccounts'][_0x392d9c['id']],_0x392d9c);}}}return _0x3bf36f[_0x6ed0('0x1f')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4b')]=function(){var _0x41bf24=this;return function(_0x45fb27){if(_0x45fb27){freeIsNotKey(_0x45fb27,_0x41bf24[_0x6ed0('0x21')],'id');for(var _0x3ec4b7=0x0,_0x10d9a6={},_0x211b7b={};_0x3ec4b7<_0x45fb27[_0x6ed0('0x43')];_0x3ec4b7+=0x1){_0x10d9a6=_0x45fb27[_0x3ec4b7];if(_[_0x6ed0('0x45')](_0x41bf24[_0x6ed0('0x21')][_0x10d9a6['id']])){_0x41bf24[_0x6ed0('0x21')][_0x10d9a6['id']]=new FreshdeskAccount(_0x10d9a6);}else{_0x41bf24[_0x6ed0('0x42')](_0x41bf24[_0x6ed0('0x21')][_0x10d9a6['id']],_0x10d9a6);}}}return _0x41bf24[_0x6ed0('0x21')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4c')]=function(){var _0x12be79=this;return function(_0x332e6f){if(_0x332e6f){freeIsNotKey(_0x332e6f,_0x12be79[_0x6ed0('0x22')],'id');for(var _0x1ffff2=0x0,_0x4a78d5={},_0x210cc6={};_0x1ffff2<_0x332e6f[_0x6ed0('0x43')];_0x1ffff2+=0x1){_0x4a78d5=_0x332e6f[_0x1ffff2];if(_[_0x6ed0('0x45')](_0x12be79[_0x6ed0('0x22')][_0x4a78d5['id']])){_0x12be79[_0x6ed0('0x22')][_0x4a78d5['id']]=new ZohoAccount(_0x4a78d5);}else{_0x12be79['mergeFromDatabase'](_0x12be79[_0x6ed0('0x22')][_0x4a78d5['id']],_0x4a78d5);}}}return _0x12be79[_0x6ed0('0x22')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4d')]=function(){var _0x5c993f=this;return function(_0x2e2905){if(_0x2e2905){freeIsNotKey(_0x2e2905,_0x5c993f[_0x6ed0('0x23')],'id');for(var _0x1c4b6b=0x0,_0x19f997={},_0x337f57={};_0x1c4b6b<_0x2e2905[_0x6ed0('0x43')];_0x1c4b6b+=0x1){_0x19f997=_0x2e2905[_0x1c4b6b];if(_['isUndefined'](_0x5c993f[_0x6ed0('0x23')][_0x19f997['id']])){_0x5c993f[_0x6ed0('0x23')][_0x19f997['id']]=new DeskAccount(_0x19f997);}else{_0x5c993f[_0x6ed0('0x42')](_0x5c993f['deskAccounts'][_0x19f997['id']],_0x19f997);}}}return _0x5c993f['deskAccounts'];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4e')]=function(){var _0x20066e=this;return function(_0x9befc4){if(_0x9befc4){freeIsNotKey(_0x9befc4,_0x20066e['sugarcrmAccounts'],'id');for(var _0x397632=0x0,_0x32bffb={},_0x1f8fdd={};_0x397632<_0x9befc4['length'];_0x397632+=0x1){_0x32bffb=_0x9befc4[_0x397632];if(_['isUndefined'](_0x20066e[_0x6ed0('0x20')][_0x32bffb['id']])){_0x20066e[_0x6ed0('0x20')][_0x32bffb['id']]=new SugarcrmAccount(_0x32bffb);}else{_0x20066e[_0x6ed0('0x42')](_0x20066e[_0x6ed0('0x20')][_0x32bffb['id']],_0x32bffb);}}}return _0x20066e[_0x6ed0('0x20')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x4f')]=function(){var _0x591006=this;return function(_0x4e5f38){if(_0x4e5f38){freeIsNotKey(_0x4e5f38,_0x591006[_0x6ed0('0x24')],'id');for(var _0x309c24=0x0,_0x42faf5={},_0x3c48fa={};_0x309c24<_0x4e5f38[_0x6ed0('0x43')];_0x309c24+=0x1){_0x42faf5=_0x4e5f38[_0x309c24];if(_[_0x6ed0('0x45')](_0x591006[_0x6ed0('0x24')][_0x42faf5['id']])){_0x591006[_0x6ed0('0x24')][_0x42faf5['id']]=new VtigerAccount(_0x42faf5);}else{_0x591006[_0x6ed0('0x42')](_0x591006['vtigerAccounts'][_0x42faf5['id']],_0x42faf5);}}}return _0x591006['vtigerAccounts'];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x50')]=function(){var _0xb1203=this;return function(_0x52af5b){if(_0x52af5b){freeIsNotKey(_0x52af5b,_0xb1203[_0x6ed0('0x51')],'id');for(var _0x5edbc3=0x0,_0x593c90={},_0x494be8={};_0x5edbc3<_0x52af5b['length'];_0x5edbc3+=0x1){_0x593c90=_0x52af5b[_0x5edbc3];if(_[_0x6ed0('0x45')](_0xb1203['servicenowAccounts'][_0x593c90['id']])){_0xb1203[_0x6ed0('0x51')][_0x593c90['id']]=new ServicenowAccount(_0x593c90);}else{_0xb1203[_0x6ed0('0x42')](_0xb1203['servicenowAccounts'][_0x593c90['id']],_0x593c90);}}}return _0xb1203[_0x6ed0('0x51')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x52')]=function(){var _0x1356ca=this;return function(_0x36b59c){if(_0x36b59c){freeIsNotKey(_0x36b59c,_0x1356ca[_0x6ed0('0x25')],'id');for(var _0x5652e0=0x0,_0x2c0d87={},_0x3fd156={};_0x5652e0<_0x36b59c[_0x6ed0('0x43')];_0x5652e0+=0x1){_0x2c0d87=_0x36b59c[_0x5652e0];if(_[_0x6ed0('0x45')](_0x1356ca[_0x6ed0('0x25')][_0x2c0d87['id']])){_0x1356ca[_0x6ed0('0x25')][_0x2c0d87['id']]=new Dynamics365Account(_0x2c0d87);}else{_0x1356ca['mergeFromDatabase'](_0x1356ca['dynamics365Accounts'][_0x2c0d87['id']],_0x2c0d87);}}}return _0x1356ca[_0x6ed0('0x25')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x53')]=function(){var _0x1d2677=this;return function(_0x218c9e){if(_0x218c9e){freeIsNotKey(_0x218c9e,_0x1d2677['freshsalesAccounts'],'id');for(var _0x2c01d4=0x0,_0x1acf17={},_0x123b79={};_0x2c01d4<_0x218c9e[_0x6ed0('0x43')];_0x2c01d4+=0x1){_0x1acf17=_0x218c9e[_0x2c01d4];if(_[_0x6ed0('0x45')](_0x1d2677[_0x6ed0('0x26')][_0x1acf17['id']])){_0x1d2677['freshsalesAccounts'][_0x1acf17['id']]=new FreshsalesAccount(_0x1acf17);}else{_0x1d2677[_0x6ed0('0x42')](_0x1d2677['freshsalesAccounts'][_0x1acf17['id']],_0x1acf17);}}}return _0x1d2677[_0x6ed0('0x26')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x54')]=function(){var _0x576a2f=this;return function(_0x310a9e){for(var _0xf69c92=0x0;_0xf69c92<_0x310a9e[_0x6ed0('0x43')];_0xf69c92+=0x1){_[_0x6ed0('0x55')](_0x576a2f[_0x6ed0('0x16')][_0x310a9e[_0xf69c92]['name']],_0x310a9e[_0xf69c92]);}return _0x576a2f['voiceQueues'];};};Realtime[_0x6ed0('0x41')]['initVoiceQueueReports']=function(){var _0xfeac5b=this;return function(_0x54de68){clearVoiceQueues(_0xfeac5b[_0x6ed0('0x16')]);if(_0x54de68){_0x54de68=_[_0x6ed0('0x56')](_0x54de68,_0x6ed0('0x57'));for(var _0x2980f2 in _0x54de68){if(_0x54de68[_0x6ed0('0x28')](_0x2980f2)){var _0x3ffa2f={};for(var _0x40601c=0x0;_0x40601c<_0x54de68[_0x2980f2]['length'];_0x40601c+=0x1){var _0x49aa40=_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x58')];if(_0xfeac5b[_0x6ed0('0x16')][_0x49aa40]){if(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x59')]){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x34')]+=0x1;}if(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5a')]){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x35')]+=0x1;}_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x2e')]+=moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5b')])[_0x6ed0('0x5c')](moment(_0x54de68[_0x2980f2][_0x40601c]['queuecallerjoinAt']),'seconds')||0x0;if(_0x40601c===_0x54de68[_0x2980f2][_0x6ed0('0x43')]-0x1){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x2f')]+=moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5d')]||_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5e')]||_0x54de68[_0x2980f2][_0x40601c]['queuecallerexitAt'])[_0x6ed0('0x5c')](moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5f')]),_0x6ed0('0x60'))||0x0;_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x33')]+=0x1;if(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x61')]){_0xfeac5b[_0x6ed0('0x16')][_0x49aa40][_0x6ed0('0x2d')]+=0x1;_0xfeac5b['voiceQueues'][_0x49aa40]['sumBillable']+=moment(_0x54de68[_0x2980f2][_0x40601c][_0x6ed0('0x5d')])['diff'](moment(_0x54de68[_0x2980f2][_0x40601c]['queuecallerleaveAt']),_0x6ed0('0x60'))||0x0;}}else{_0xfeac5b[_0x6ed0('0x16')][_0x49aa40]['sumDuration']+=_0xfeac5b['voiceQueues'][_0x49aa40]['sumHoldTime']||0x0;}}}}}}return _0xfeac5b[_0x6ed0('0x16')];};};Realtime[_0x6ed0('0x41')]['initVoiceCallReports']=function(){var _0x529e3b=this;return function(_0x4babf9){clearVoiceCallReports(_0x529e3b[_0x6ed0('0x1a')]);if(_0x4babf9){for(var _0x3f2714=0x0;_0x3f2714<_0x4babf9[_0x6ed0('0x43')];_0x3f2714+=0x1){_0x529e3b[_0x6ed0('0x1a')]['total']+=0x1;_0x529e3b['outbound'][_0x6ed0('0x2f')]+=_0x4babf9[_0x3f2714][_0x6ed0('0x62')];if(_0x4babf9[_0x3f2714][_0x6ed0('0x63')]===_0x6ed0('0x64')){_0x529e3b[_0x6ed0('0x1a')][_0x6ed0('0x2d')]+=0x1;_0x529e3b[_0x6ed0('0x1a')]['sumHoldTime']+=_0x4babf9[_0x3f2714][_0x6ed0('0x62')]-_0x4babf9[_0x3f2714][_0x6ed0('0x65')]||0x0;_0x529e3b[_0x6ed0('0x1a')][_0x6ed0('0x30')]+=_0x4babf9[_0x3f2714][_0x6ed0('0x65')];}}}return _0x529e3b[_0x6ed0('0x1a')];};};Realtime['prototype']['initCampaigns']=function(){var _0x533b87=this;return function(_0x5dd0f6){if(_0x5dd0f6){freeIsNotKey(_0x5dd0f6,_0x533b87[_0x6ed0('0x18')],'name');for(var _0x14da61=0x0,_0x582ccf={};_0x14da61<_0x5dd0f6[_0x6ed0('0x43')];_0x14da61+=0x1){_0x582ccf=_0x5dd0f6[_0x14da61];if(_[_0x6ed0('0x45')](_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]])){_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]]=new Campaign(_0x582ccf);}else{_0x533b87['mergeFromDatabase'](_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]],_0x582ccf);_0x533b87[_0x6ed0('0x18')][_0x582ccf[_0x6ed0('0x2b')]][_0x6ed0('0x66')]=_0x582ccf[_0x6ed0('0x67')]?_0x582ccf['SquareProject'][_0x6ed0('0x2b')]:undefined;}}}return _0x533b87[_0x6ed0('0x18')];};};Realtime[_0x6ed0('0x41')]['initVoiceExtensions']=function(){var _0x472706=this;return function(_0x129d1c){if(_0x129d1c){freeIsNotKey(_0x129d1c,_0x472706[_0x6ed0('0x68')],'id');for(var _0x576dbf=0x0,_0x31e7c1={};_0x576dbf<_0x129d1c['length'];_0x576dbf+=0x1){_0x31e7c1=_0x129d1c[_0x576dbf];if(_[_0x6ed0('0x45')](_0x472706[_0x6ed0('0x68')][_0x31e7c1['id']])){_0x472706['voiceExtensions'][_0x31e7c1['id']]=new VoiceExtension(_0x31e7c1);}else{_0x472706['mergeFromDatabase'](_0x472706[_0x6ed0('0x68')][_0x31e7c1['id']],_0x31e7c1);}}}return _0x472706['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x3896e7=this;return function(_0x1e93a0){clearCampaigns(_0x3896e7['campaigns']);for(var _0xf4fdfd=0x0;_0xf4fdfd<_0x1e93a0[_0x6ed0('0x43')];_0xf4fdfd+=0x1){_[_0x6ed0('0x55')](_0x3896e7[_0x6ed0('0x18')][_0x1e93a0[_0xf4fdfd][_0x6ed0('0x2b')]],_0x1e93a0[_0xf4fdfd]);}return _0x3896e7[_0x6ed0('0x18')];};};Realtime[_0x6ed0('0x41')][_0x6ed0('0x69')]=function(){var _0x40848c=this;return function(_0x372ebe){if(_0x372ebe){freeIsNotKey(_0x372ebe,_0x40848c[_0x6ed0('0x6a')],'id');for(var _0xc0d1f4=0x0,_0x21e887={},_0x5006b1={};_0xc0d1f4<_0x372ebe['length'];_0xc0d1f4+=0x1){_0x21e887=_0x372ebe[_0xc0d1f4];if(_[_0x6ed0('0x45')](_0x40848c[_0x6ed0('0x6a')][_0x21e887['id']])){_0x40848c['faxAccounts'][_0x21e887['id']]=new FaxAccount(_0x21e887);}else{_0x40848c[_0x6ed0('0x42')](_0x40848c[_0x6ed0('0x6a')][_0x21e887['id']],_0x21e887);}}}return _0x40848c[_0x6ed0('0x6a')];};};module[_0x6ed0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0f3eb76..012e2c2 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 _0xcf2a=['voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','name','isNil','interface','length','connectedlinenum','accountcode','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitors','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','SIP/%s','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf2a,0x1b3));var _0xacf2=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xcf2a[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xacf2('0x0'));var moment=require('moment');var util=require(_0xacf2('0x1'));var config=require(_0xacf2('0x2'));var ami=require(_0xacf2('0x3'));var RpcVoiceAgentReport=require(_0xacf2('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xacf2('0x5'));var RpcMemberReport=require(_0xacf2('0x6'));var RpcVoiceQueueReport=require(_0xacf2('0x7'));var RpcVoiceRecording=require(_0xacf2('0x8'));var RpcVoiceTransferReport=require(_0xacf2('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xacf2('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xacf2('0xb'));var UserReport=require(_0xacf2('0xc'));function Report(_0x6452db){this[_0xacf2('0xd')]=_0x6452db;this[_0xacf2('0xe')]=_0x6452db[_0xacf2('0xe')];this[_0xacf2('0xf')]=_0x6452db[_0xacf2('0xf')];}Report['prototype'][_0xacf2('0x10')]=function(_0x28eb6a){var _0x552afa=new VoiceQueueReport(this[_0xacf2('0xd')]);var _0x4972c9=new VoiceAgentReport(this[_0xacf2('0xd')]);var _0x2eb7d7=new VoiceDialReport(this[_0xacf2('0xd')]);var _0x12b91a=new VoiceCallReport(this[_0xacf2('0xd')]);var _0x199a0f=new UserReport(this['realtime']);if(config[_0xacf2('0x11')]&&config[_0xacf2('0x11')][_0xacf2('0x12')]){ami['on'](_0xacf2('0x13'),this[_0xacf2('0x14')][_0xacf2('0x15')](this));ami['on'](_0xacf2('0x16'),this[_0xacf2('0x17')][_0xacf2('0x15')](this));ami['on'](_0xacf2('0x18'),this[_0xacf2('0x19')][_0xacf2('0x15')](this));ami['on'](_0xacf2('0x1a'),this[_0xacf2('0x1b')][_0xacf2('0x15')](this));ami['on'](_0xacf2('0x1c'),this[_0xacf2('0x1d')][_0xacf2('0x15')](this));ami['on'](_0xacf2('0x1e'),this[_0xacf2('0x1f')][_0xacf2('0x15')](this));}};Report[_0xacf2('0x20')][_0xacf2('0x21')]=function(_0x10abfa){var _0x41cd67;_0x41cd67=_[_0xacf2('0x22')](this[_0xacf2('0xe')],function(_0xc1a8a9){return _0xc1a8a9['accountcode']==_0x10abfa||_0xc1a8a9[_0xacf2('0x23')]==_0x10abfa;});if(_[_0xacf2('0x24')](_0x41cd67)){var _0x372646=_[_0xacf2('0x22')](this[_0xacf2('0xf')],function(_0x36e93a){return _0x36e93a['accountcode']==_0x10abfa||_0x36e93a[_0xacf2('0x23')]==_0x10abfa;});if(_0x372646){_0x41cd67=_[_0xacf2('0x22')](this['agents'],function(_0x11b473){return _0x11b473[_0xacf2('0x25')]==util['format']('SIP/%s',_0x372646[_0xacf2('0x23')]);});}}return _0x41cd67;};Report[_0xacf2('0x20')]['voiceQueueReport']=function(_0x515047){for(var _0x3e474b=0x0;_0x3e474b<_0x515047[_0xacf2('0x26')];_0x3e474b+=0x1){var _0x57c871=this[_0xacf2('0x21')](_0x515047[_0x3e474b][_0xacf2('0x27')]);if(_0x57c871){_0x515047[_0x3e474b][_0xacf2('0x28')]=_0x57c871[_0xacf2('0x28')];_0x515047[_0x3e474b][_0xacf2('0x29')]=!![];_0x515047[_0x3e474b][_0xacf2('0x2a')]=_0x57c871[_0xacf2('0x23')];_0x515047[_0x3e474b][_0xacf2('0x25')]=_[_0xacf2('0x24')](_0x57c871[_0xacf2('0x25')])?util[_0xacf2('0x2b')]('SIP/%s',_0x57c871[_0xacf2('0x23')]):_0x57c871[_0xacf2('0x25')];if(_0x515047[_0x3e474b][_0xacf2('0x2c')]){_0x515047[_0x3e474b][_0xacf2('0x2d')]=moment()[_0xacf2('0x2b')](_0xacf2('0x2e'));}if(_0x515047[_0x3e474b]['queuecallerexit']){_0x515047[_0x3e474b]['queuecallerexitAt']=moment()[_0xacf2('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xacf2('0x14')](_0x515047[_0x3e474b]);}RpcVoiceQueueReport[_0xacf2('0x2f')](_0x515047[_0x3e474b]);}};function extractCalleridNumber(_0x782e87){var _0x53dd35=_0x782e87['match'](/<(.*?)>/);return _0x53dd35?_0x53dd35[0x1]:_0x782e87;}Report[_0xacf2('0x20')][_0xacf2('0x30')]=function(_0x46bbb3){for(var _0x4ad3fb=0x0;_0x4ad3fb','calleridname','transfers','linkedid','transfereelinkedid','split','UserId','membername','monitors','monitorFilename','createdAt','exten','connectedlinename','isArray','forEach','voiceDialReport','startsWith','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','exports','lodash','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider'];(function(_0x284048,_0x5b9381){var _0x1769b0=function(_0x203f4a){while(--_0x203f4a){_0x284048['push'](_0x284048['shift']());}};_0x1769b0(++_0x5b9381);}(_0x6c58,0x141));var _0x86c5=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x6c58[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x86c5('0x0'));var moment=require('moment');var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x86c5('0x1'));var RpcVoiceCallReport=require(_0x86c5('0x2'));var RpcVoiceDialReport=require(_0x86c5('0x3'));var RpcMemberReport=require(_0x86c5('0x4'));var RpcVoiceQueueReport=require(_0x86c5('0x5'));var RpcVoiceRecording=require(_0x86c5('0x6'));var RpcVoiceTransferReport=require(_0x86c5('0x7'));var VoiceQueueReport=require(_0x86c5('0x8'));var VoiceCallReport=require(_0x86c5('0x9'));var VoiceAgentReport=require(_0x86c5('0xa'));var VoiceDialReport=require(_0x86c5('0xb'));var UserReport=require(_0x86c5('0xc'));function Report(_0x29e5ab){this['realtime']=_0x29e5ab;this[_0x86c5('0xd')]=_0x29e5ab[_0x86c5('0xd')];this[_0x86c5('0xe')]=_0x29e5ab[_0x86c5('0xe')];}Report[_0x86c5('0xf')]['sync']=function(_0x153735){var _0x539231=new VoiceQueueReport(this[_0x86c5('0x10')]);var _0x2ccad7=new VoiceAgentReport(this[_0x86c5('0x10')]);var _0x4472c0=new VoiceDialReport(this[_0x86c5('0x10')]);var _0x579c74=new VoiceCallReport(this[_0x86c5('0x10')]);var _0x397ba7=new UserReport(this[_0x86c5('0x10')]);if(config[_0x86c5('0x11')]&&config[_0x86c5('0x11')][_0x86c5('0x12')]){ami['on'](_0x86c5('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x86c5('0x14'),this[_0x86c5('0x15')]['bind'](this));ami['on'](_0x86c5('0x16'),this[_0x86c5('0x17')][_0x86c5('0x18')](this));ami['on'](_0x86c5('0x19'),this['voiceDialReport']['bind'](this));ami['on'](_0x86c5('0x1a'),this[_0x86c5('0x1b')]['bind'](this));ami['on'](_0x86c5('0x1c'),this[_0x86c5('0x1d')][_0x86c5('0x18')](this));}};Report[_0x86c5('0xf')][_0x86c5('0x1e')]=function(_0x52a90b){var _0x34c856;_0x34c856=_[_0x86c5('0x1f')](this[_0x86c5('0xd')],function(_0x34b852){return _0x34b852[_0x86c5('0x20')]==_0x52a90b||_0x34b852[_0x86c5('0x21')]==_0x52a90b;});if(_[_0x86c5('0x22')](_0x34c856)){var _0x4b31d4=_['find'](this[_0x86c5('0xe')],function(_0x493f75){return _0x493f75[_0x86c5('0x20')]==_0x52a90b||_0x493f75[_0x86c5('0x21')]==_0x52a90b;});if(_0x4b31d4){_0x34c856=_[_0x86c5('0x1f')](this['agents'],function(_0x312668){return _0x312668[_0x86c5('0x23')]==util['format'](_0x86c5('0x24'),_0x4b31d4[_0x86c5('0x21')]);});}}return _0x34c856;};Report[_0x86c5('0xf')][_0x86c5('0x25')]=function(_0x44bc09){for(var _0x279c58=0x0;_0x279c58<_0x44bc09[_0x86c5('0x26')];_0x279c58+=0x1){var _0x4dc461=this[_0x86c5('0x1e')](_0x44bc09[_0x279c58][_0x86c5('0x27')]);if(_0x4dc461){_0x44bc09[_0x279c58][_0x86c5('0x20')]=_0x4dc461[_0x86c5('0x20')];_0x44bc09[_0x279c58][_0x86c5('0x28')]=!![];_0x44bc09[_0x279c58]['lastAssignedTo']=_0x4dc461[_0x86c5('0x21')];_0x44bc09[_0x279c58][_0x86c5('0x23')]=_[_0x86c5('0x22')](_0x4dc461[_0x86c5('0x23')])?util[_0x86c5('0x29')]('SIP/%s',_0x4dc461['name']):_0x4dc461[_0x86c5('0x23')];if(_0x44bc09[_0x279c58][_0x86c5('0x2a')]){_0x44bc09[_0x279c58][_0x86c5('0x2b')]=moment()['format'](_0x86c5('0x2c'));}if(_0x44bc09[_0x279c58][_0x86c5('0x2d')]){_0x44bc09[_0x279c58][_0x86c5('0x2e')]=moment()[_0x86c5('0x29')](_0x86c5('0x2c'));}RpcMemberReport[_0x86c5('0x25')](_0x44bc09[_0x279c58]);}RpcVoiceQueueReport[_0x86c5('0x2f')](_0x44bc09[_0x279c58]);}};function extractCalleridNumber(_0x3deeb4){var _0x2a1ea4=_0x3deeb4[_0x86c5('0x30')](/<(.*?)>/);return _0x2a1ea4?_0x2a1ea4[0x1]:_0x3deeb4;}Report[_0x86c5('0xf')][_0x86c5('0x31')]=function(_0x33d48c){for(var _0xd82621=0x0;_0xd826210x0?_0x206eb6:0x0;this['voiceQueues'][_0x1f7daa[_0x9e31('0x6d')]][_0x9e31('0x31')]=this[_0x9e31('0x11')][_0x1f7daa[_0x9e31('0x6d')]][_0x9e31('0x31')]>_[_0x9e31('0x72')](_0x1f7daa['loggedin'])?_[_0x9e31('0x72')](_0x1f7daa[_0x9e31('0x73')]):this[_0x9e31('0x11')][_0x1f7daa[_0x9e31('0x6d')]][_0x9e31('0x31')];this[_0x9e31('0x52')](this[_0x9e31('0x11')][_0x1f7daa[_0x9e31('0x6d')]],_0x9e31('0x15'));}logger[_0x9e31('0x47')](_0x9e31('0x74'),util[_0x9e31('0x3e')](this['voiceQueues'][_0x1f7daa[_0x9e31('0x6d')]],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this[_0x9e31('0x11')][_0x1f7daa[_0x9e31('0x6d')]]);}}}catch(_0x2b0857){logger[_0x9e31('0x3c')](_0x9e31('0x6b'),util[_0x9e31('0x3e')](_0x2b0857,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e31('0xa')][_0x9e31('0x19')]=function(_0x1942f1){logger[_0x9e31('0x47')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x9e31('0x3e')](_0x1942f1,{'showHidden':![],'depth':null}));this[_0x9e31('0x12')]=!![];};VoiceQueueReport[_0x9e31('0xa')]['syncQueueCallerJoin']=function(_0x47ef8e){try{if(this['isNotNull'](_0x47ef8e)){logger['debug'](_0x9e31('0x75'),_0x47ef8e[_0x9e31('0x4e')],util['inspect'](_0x47ef8e,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x47ef8e['uniqueid']]))this[_0x9e31('0x3f')][_0x47ef8e[_0x9e31('0x4e')]]=[];if(_[_0x9e31('0x65')](this['channels'][_0x47ef8e[_0x9e31('0x4e')]]))this['channels'][_0x47ef8e['uniqueid']]={};var _0x59386e=new QueueReport();_0x59386e[_0x9e31('0x76')]=_0x47ef8e[_0x9e31('0x6d')];_0x59386e[_0x9e31('0x5a')]=this[_0x9e31('0x11')][_0x59386e[_0x9e31('0x76')]]&&this['voiceQueues'][_0x59386e[_0x9e31('0x76')]][_0x9e31('0x5a')]?this[_0x9e31('0x11')][_0x59386e[_0x9e31('0x76')]]['type']||_0x9e31('0x53'):_0x9e31('0x53');_0x59386e[_0x9e31('0x6d')]=_0x47ef8e[_0x9e31('0x6d')];_0x59386e[_0x9e31('0x77')]=moment()['format'](_0x9e31('0x78'));_0x59386e[_0x9e31('0x79')]=_0x47ef8e[_0x9e31('0x79')];_0x59386e['count']=_0x47ef8e[_0x9e31('0x7a')];_0x59386e[_0x9e31('0x4e')]=_0x47ef8e[_0x9e31('0x4e')];_0x59386e['routealias']=this[_0x9e31('0xf')][_0x47ef8e['uniqueid']]['routealias'];logger[_0x9e31('0x6e')](_0x9e31('0x7b'),_0x59386e[_0x9e31('0x76')],_0x59386e[_0x9e31('0x5a')]);_[_0x9e31('0x7c')](_0x59386e,_[_0x9e31('0x7d')](_0x47ef8e,_[_0x9e31('0x7e')](_0x59386e)));this['queueReports'][_0x47ef8e[_0x9e31('0x4e')]][_0x9e31('0x7f')](_0x59386e);this['channels'][_0x47ef8e[_0x9e31('0x4e')]]=_0x59386e;this[_0x9e31('0x46')](_0x59386e,_0x9e31('0x80'));}}catch(_0x1581a2){logger[_0x9e31('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x47ef8e['uniqueid'],util[_0x9e31('0x3e')](_0x1581a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9e31('0x1a')]=function(_0x4dc1fb){try{if(this['isNotNull'](_0x4dc1fb)){logger[_0x9e31('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4dc1fb[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0x4dc1fb,{'showHidden':![],'depth':null}));if(this[_0x9e31('0x3f')][_0x4dc1fb[_0x9e31('0x4e')]]){var _0x2af6e4=_[_0x9e31('0x81')](this[_0x9e31('0x3f')][_0x4dc1fb[_0x9e31('0x4e')]]);_0x2af6e4[_0x9e31('0x82')]=![];_0x2af6e4[_0x9e31('0x83')]=null;_0x2af6e4[_0x9e31('0x84')]=_0x4dc1fb[_0x9e31('0x84')];_0x2af6e4[_0x9e31('0x85')]=_0x4dc1fb[_0x9e31('0x85')];_0x2af6e4[_0x9e31('0x86')]=!![];_0x2af6e4[_0x9e31('0x87')]=moment()[_0x9e31('0x4f')](_0x9e31('0x78'));_0x2af6e4[_0x9e31('0x88')]=_0x9e31('0x89');_0x2af6e4['lastAssignedTo']=null;logger[_0x9e31('0x6e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2af6e4['name'],_0x2af6e4[_0x9e31('0x5a')]);this[_0x9e31('0xf')][_0x4dc1fb[_0x9e31('0x4e')]]=_0x2af6e4;this[_0x9e31('0x44')](_0x2af6e4,_0x9e31('0x86'));}}}catch(_0x2717a6){logger[_0x9e31('0x3c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4dc1fb[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0x2717a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e31('0xa')][_0x9e31('0x1c')]=function(_0xb2b8d){try{if(this['isNotNull'](_0xb2b8d)){logger[_0x9e31('0x47')](_0x9e31('0x8a'),_0xb2b8d[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0xb2b8d,{'showHidden':![],'depth':null}));if(this[_0x9e31('0x3f')][_0xb2b8d[_0x9e31('0x4e')]]){var _0xf4c749=_[_0x9e31('0x81')](this[_0x9e31('0x3f')][_0xb2b8d[_0x9e31('0x4e')]]);_0xf4c749[_0x9e31('0x8b')]=moment()[_0x9e31('0x4f')](_0x9e31('0x78'));_0xf4c749[_0x9e31('0x8c')]=_0xb2b8d['connectedlinenum'];_0xf4c749['connectedlinename']=_0xb2b8d[_0x9e31('0x8d')];logger[_0x9e31('0x6e')](_0x9e31('0x8e'),_0xf4c749[_0x9e31('0x76')],_0xf4c749['type'],_0xb2b8d[_0x9e31('0x8c')],_0xb2b8d[_0x9e31('0x8d')]);this[_0x9e31('0xf')][_0xb2b8d[_0x9e31('0x4e')]]=_0xf4c749;this[_0x9e31('0x46')](_0xf4c749,_0x9e31('0x1b'));}}}catch(_0x4a2444){logger['error'](_0x9e31('0x8a'),_0xb2b8d[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0x4a2444,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e31('0xa')]['syncAgentConnect']=function(_0x1d80d8){try{if(this[_0x9e31('0x64')](_0x1d80d8)){logger[_0x9e31('0x47')]('[%s][voiceQueueReport][agentconnect]',_0x1d80d8[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0x1d80d8,{'showHidden':![],'depth':null}));if(this[_0x9e31('0x3f')][_0x1d80d8[_0x9e31('0x4e')]]){var _0x30c9cf=_[_0x9e31('0x81')](this[_0x9e31('0x3f')][_0x1d80d8['uniqueid']]);_0x30c9cf[_0x9e31('0x82')]=!![];_0x30c9cf['queuecallerexitreason']=_0x9e31('0x8f');logger[_0x9e31('0x6e')](_0x9e31('0x90'),_0x30c9cf[_0x9e31('0x76')],_0x30c9cf[_0x9e31('0x5a')]);}}}catch(_0x124c12){logger[_0x9e31('0x3c')](_0x9e31('0x91'),_0x1d80d8[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0x124c12,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e31('0xa')][_0x9e31('0x1d')]=function(_0x820276){try{if(this['isNotNull'](_0x820276)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x820276[_0x9e31('0x4e')],util[_0x9e31('0x3e')](_0x820276,{'showHidden':![],'depth':null}));if(this[_0x9e31('0x3f')][_0x820276['uniqueid']]){var _0x47d66f=_['last'](this[_0x9e31('0x3f')][_0x820276[_0x9e31('0x4e')]]);_0x47d66f[_0x9e31('0x86')]=![];_0x47d66f[_0x9e31('0x87')]=null;_0x47d66f['assigned']=!![];_0x47d66f['lastAssignedTo']=_0x820276[_0x9e31('0x92')];_0x47d66f[_0x9e31('0x84')]=_0x820276[_0x9e31('0x84')];_0x47d66f['queuecallercomplete']=!![];_0x47d66f['queuecallerexit']=![];_0x47d66f[_0x9e31('0x93')]=null;if(!_0x47d66f[_0x9e31('0x94')]){if(_0x820276['reason']==_0x9e31('0x94')){_0x47d66f['queuecallerexitreason']=_0x9e31('0x95');logger[_0x9e31('0x6e')](_0x9e31('0x96'),_0x47d66f['name'],_0x47d66f['type']);}else{if(_['startsWith'](_0x820276[_0x9e31('0x39')][_0x9e31('0x97')](),_0x9e31('0x98'))){if(this[_0x9e31('0x3f')][_0x820276[_0x9e31('0x99')]]){var _0x533722=_['last'](this[_0x9e31('0x3f')][_0x820276['linkedid']]);_0x533722[_0x9e31('0x82')]=![];_0x533722['queuecallerexit']=!![];_0x533722[_0x9e31('0x93')]=moment(_0x47d66f[_0x9e31('0x77')])[_0x9e31('0x9a')](_0x820276[_0x9e31('0x84')],'seconds')[_0x9e31('0x4f')](_0x9e31('0x78'));_0x533722[_0x9e31('0x88')]=_0x9e31('0x9b');_0x533722[_0x9e31('0x94')]=!![];_0x533722[_0x9e31('0x9c')]=_0x9e31('0x9d');_0x533722['transferexten']=_0x820276[_0x9e31('0x9e')];_0x533722['transferuniqueid']=_0x820276[_0x9e31('0x4e')];logger[_0x9e31('0x6e')](_0x9e31('0x9f'),_0x533722[_0x9e31('0x76')],_0x533722[_0x9e31('0x5a')]);var _0x214bdf=this[_0x9e31('0x3f')][_0x820276[_0x9e31('0x99')]];this['queueReports'][_0x820276[_0x9e31('0x99')]]=this['queueReports'][_0x820276['uniqueid']];this[_0x9e31('0x3f')][_0x820276[_0x9e31('0x4e')]]=_0x214bdf;}}else{_0x47d66f[_0x9e31('0x88')]=_0x9e31('0xa0')+_0x820276[_0x9e31('0xa1')]['toUpperCase']();logger[_0x9e31('0x6e')](_0x9e31('0xa2'),_0x47d66f['name'],_0x47d66f[_0x9e31('0x5a')],_0x47d66f[_0x9e31('0x88')]);}}}this[_0x9e31('0xf')][_0x820276[_0x9e31('0x4e')]]=_0x47d66f;this[_0x9e31('0x44')](_0x47d66f,_0x9e31('0xa3'));}}}catch(_0x539594){logger['error'](_0x9e31('0xa4'),_0x820276['uniqueid'],util[_0x9e31('0x3e')](_0x539594,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e31('0xa')]['syncVarSet']=function(_0x5e6a6d){try{if(this[_0x9e31('0x64')](_0x5e6a6d)){logger[_0x9e31('0x47')](_0x9e31('0xa5'),_0x5e6a6d[_0x9e31('0x4e')],util['inspect'](_0x5e6a6d,{'showHidden':![],'depth':null}));this['addVariable'](_0x5e6a6d['uniqueid'],_[_0x9e31('0x7e')](_0x5e6a6d[_0x9e31('0xa6')])[0x0],_0x5e6a6d[_0x9e31('0xa7')]);if(this[_0x9e31('0x3f')][_0x5e6a6d[_0x9e31('0x4e')]]){var _0x3e55a0=_[_0x9e31('0x81')](this[_0x9e31('0x3f')][_0x5e6a6d[_0x9e31('0x4e')]]);if(_0x3e55a0){if(this[_0x9e31('0x64')](_0x5e6a6d[_0x9e31('0xa6')])&&this[_0x9e31('0x64')](_0x5e6a6d[_0x9e31('0xa6')]['queuestatus'])){switch(_0x5e6a6d['value']){case'CONTINUE':_0x3e55a0[_0x9e31('0xa8')]=![];_0x3e55a0[_0x9e31('0x93')]=null;break;case'TIMEOUT':_0x3e55a0['lastevent']=_0x9e31('0xa9');_0x3e55a0[_0x9e31('0xa8')]=!![];_0x3e55a0[_0x9e31('0x93')]=moment()['format'](_0x9e31('0x78'));_0x3e55a0[_0x9e31('0x8b')]=moment()['format'](_0x9e31('0x78'));logger[_0x9e31('0x47')](_0x9e31('0xaa'),_0x5e6a6d[_0x9e31('0x4e')],util['inspect'](_0x3e55a0,{'showHidden':![],'depth':null}));ami[_0x9e31('0x45')](_0x9e31('0xab'),_0x3e55a0);break;default:_0x3e55a0[_0x9e31('0xa8')]=!![];_0x3e55a0[_0x9e31('0x93')]=moment()['format'](_0x9e31('0x78'));_0x3e55a0[_0x9e31('0x8b')]=moment()['format'](_0x9e31('0x78'));}_0x3e55a0[_0x9e31('0x86')]=![];_0x3e55a0[_0x9e31('0x87')]=null;_0x3e55a0['queuecallerexitreason']=_0x5e6a6d[_0x9e31('0xa7')];this[_0x9e31('0xf')][_0x5e6a6d['uniqueid']]=_0x3e55a0;this[_0x9e31('0x44')](_0x3e55a0,'varset');}else if(this[_0x9e31('0x64')](_0x5e6a6d[_0x9e31('0xa6')])&&this[_0x9e31('0x64')](_0x5e6a6d['variable']['queueposition'])){if(!_0x3e55a0[_0x9e31('0x86')]){_0x3e55a0[_0x9e31('0xa8')]=!![];_0x3e55a0[_0x9e31('0x93')]=moment()[_0x9e31('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e55a0[_0x9e31('0x88')]='EXITWITHKEY';_0x3e55a0[_0x9e31('0x8b')]=moment()['format'](_0x9e31('0x78'));this[_0x9e31('0xf')][_0x5e6a6d[_0x9e31('0x4e')]]=_0x3e55a0;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5e6a6d[_0x9e31('0x4e')],_0x3e55a0[_0x9e31('0x76')],_0x3e55a0[_0x9e31('0x5a')],_[_0x9e31('0x7e')](_0x5e6a6d[_0x9e31('0xa6')])[0x0],_0x5e6a6d[_0x9e31('0xa7')]);_0x3e55a0[_0x9e31('0x14')]=this[_0x9e31('0x14')][_0x5e6a6d[_0x9e31('0x4e')]];}}}}catch(_0x2d5a5d){logger[_0x9e31('0x3c')]('[%s][voiceQueueReport][varset]',_0x5e6a6d[_0x9e31('0x4e')],util['inspect'](_0x2d5a5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e31('0xa')][_0x9e31('0xac')]=function(_0x587afa,_0x263a5a,_0x37596b){var _0x76560e=['rtpaudioqos','rtpaudioqosbridged',_0x9e31('0xad'),_0x9e31('0xae'),_0x9e31('0xaf'),'rtpaudioqoslossbridged',_0x9e31('0xb0'),'rtpaudioqosrttbridged',_0x9e31('0xb1'),_0x9e31('0xb2'),'bridgepeer','bridgepvtcallid','membercalls',_0x9e31('0xb3'),'memberinterface',_0x9e31('0xb4'),_0x9e31('0x92'),_0x9e31('0xb5'),'memberrealtime'];if(!_[_0x9e31('0x37')](_0x263a5a)&&!_[_0x9e31('0xb6')](_0x76560e,_0x263a5a)){if(_[_0x9e31('0x65')](this[_0x9e31('0x14')][_0x587afa])){this[_0x9e31('0x14')][_0x587afa]={};}this[_0x9e31('0x14')][_0x587afa][_0x263a5a]=_0x37596b;}};VoiceQueueReport['prototype'][_0x9e31('0x23')]=function(_0x248402){try{if(this[_0x9e31('0x64')](_0x248402)){logger['debug'](_0x9e31('0xb7'),_0x248402['uniqueid'],util[_0x9e31('0x3e')](_0x248402,{'showHidden':![],'depth':null}));if(this[_0x9e31('0x3f')][_0x248402[_0x9e31('0x4e')]]){for(var _0x5be0da=0x0,_0x281a02={};_0x5be0da0x0?_0x1f9e45:0x0;this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]]['talking']=this[_0xa101('0x12')][_0x3ebe99['queue']][_0xa101('0x2b')]>_[_0xa101('0x6c')](_0x3ebe99[_0xa101('0x6d')])?_['toNumber'](_0x3ebe99['loggedin']):this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]]['talking'];this[_0xa101('0x4f')](this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]],_0xa101('0x15'));}logger[_0xa101('0x44')](_0xa101('0x6e'),util[_0xa101('0x3b')](this[_0xa101('0x12')][_0x3ebe99[_0xa101('0x68')]],{'showHidden':![],'depth':null}));ami[_0xa101('0x47')](_0xa101('0x6f'),this[_0xa101('0x12')][_0x3ebe99['queue']]);}}}catch(_0x1ef5b1){logger[_0xa101('0x39')](_0xa101('0x70'),util[_0xa101('0x3b')](_0x1ef5b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x71')]=function(_0x24af47){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x24af47,{'showHidden':![],'depth':null}));this[_0xa101('0x65')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x54ee8a){try{if(this[_0xa101('0x61')](_0x54ee8a)){logger[_0xa101('0x44')](_0xa101('0x72'),_0x54ee8a['uniqueid'],util[_0xa101('0x3b')](_0x54ee8a,{'showHidden':![],'depth':null}));if(_[_0xa101('0x62')](this[_0xa101('0xe')][_0x54ee8a[_0xa101('0x4d')]]))this[_0xa101('0xe')][_0x54ee8a['uniqueid']]=[];if(_['isUndefined'](this[_0xa101('0x10')][_0x54ee8a['uniqueid']]))this['channels'][_0x54ee8a[_0xa101('0x4d')]]={};var _0x1608fe=new QueueReport();_0x1608fe[_0xa101('0x49')]=_0x54ee8a['queue'];_0x1608fe[_0xa101('0x50')]=this['voiceQueues'][_0x1608fe[_0xa101('0x49')]]&&this[_0xa101('0x12')][_0x1608fe[_0xa101('0x49')]][_0xa101('0x50')]?this[_0xa101('0x12')][_0x1608fe['name']][_0xa101('0x50')]||_0xa101('0x51'):_0xa101('0x51');_0x1608fe[_0xa101('0x68')]=_0x54ee8a[_0xa101('0x68')];_0x1608fe[_0xa101('0x73')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));_0x1608fe['position']=_0x54ee8a[_0xa101('0x75')];_0x1608fe['count']=_0x54ee8a[_0xa101('0x76')];_0x1608fe[_0xa101('0x4d')]=_0x54ee8a[_0xa101('0x4d')];_0x1608fe[_0xa101('0x77')]=this['channels'][_0x54ee8a[_0xa101('0x4d')]][_0xa101('0x77')];logger[_0xa101('0x78')](_0xa101('0x79'),_0x1608fe['name'],_0x1608fe[_0xa101('0x50')]);_[_0xa101('0x7a')](_0x1608fe,_[_0xa101('0x7b')](_0x54ee8a,_[_0xa101('0x7c')](_0x1608fe)));this[_0xa101('0xe')][_0x54ee8a[_0xa101('0x4d')]]['push'](_0x1608fe);this['channels'][_0x54ee8a['uniqueid']]=_0x1608fe;this[_0xa101('0x43')](_0x1608fe,_0xa101('0x19'));}}catch(_0x5a5bec){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x54ee8a['uniqueid'],util[_0xa101('0x3b')](_0x5a5bec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x1b')]=function(_0x397666){try{if(this['isNotNull'](_0x397666)){logger[_0xa101('0x44')](_0xa101('0x7d'),_0x397666['uniqueid'],util['inspect'](_0x397666,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x397666[_0xa101('0x4d')]]){var _0x4a295e=_['last'](this['queueReports'][_0x397666['uniqueid']]);_0x4a295e[_0xa101('0x7e')]=![];_0x4a295e[_0xa101('0x7f')]=null;_0x4a295e[_0xa101('0x80')]=_0x397666[_0xa101('0x80')];_0x4a295e[_0xa101('0x81')]=_0x397666[_0xa101('0x81')];_0x4a295e[_0xa101('0x82')]=!![];_0x4a295e[_0xa101('0x83')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));_0x4a295e[_0xa101('0x84')]='ABANDONED';_0x4a295e[_0xa101('0x85')]=null;logger[_0xa101('0x78')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4a295e['name'],_0x4a295e['type']);this['channels'][_0x397666[_0xa101('0x4d')]]=_0x4a295e;this[_0xa101('0x41')](_0x4a295e,_0xa101('0x82'));}}}catch(_0x339560){logger[_0xa101('0x39')]('[%s][voiceQueueReport][queuecallerabandon]',_0x397666[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x339560,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')]['syncQueueCallerLeave']=function(_0x307594){try{if(this['isNotNull'](_0x307594)){logger[_0xa101('0x44')](_0xa101('0x86'),_0x307594['uniqueid'],util[_0xa101('0x3b')](_0x307594,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x307594[_0xa101('0x4d')]]){var _0x2af69e=_['last'](this[_0xa101('0xe')][_0x307594[_0xa101('0x4d')]]);_0x2af69e['queuecallerleaveAt']=moment()[_0xa101('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2af69e[_0xa101('0x87')]=_0x307594[_0xa101('0x87')];_0x2af69e[_0xa101('0x88')]=_0x307594[_0xa101('0x88')];logger['info'](_0xa101('0x89'),_0x2af69e[_0xa101('0x49')],_0x2af69e[_0xa101('0x50')],_0x307594[_0xa101('0x87')],_0x307594['connectedlinename']);this['channels'][_0x307594[_0xa101('0x4d')]]=_0x2af69e;this[_0xa101('0x43')](_0x2af69e,_0xa101('0x1c'));}}}catch(_0x38a4e3){logger[_0xa101('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x307594[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x38a4e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x1f')]=function(_0x26379a){try{if(this['isNotNull'](_0x26379a)){logger['debug'](_0xa101('0x8a'),_0x26379a[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x26379a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x26379a[_0xa101('0x4d')]]){var _0x23b23f=_[_0xa101('0x8b')](this[_0xa101('0xe')][_0x26379a[_0xa101('0x4d')]]);_0x23b23f['queuecallercomplete']=!![];_0x23b23f[_0xa101('0x84')]='COMPLETEDBYAGENT';logger[_0xa101('0x78')](_0xa101('0x8c'),_0x23b23f[_0xa101('0x49')],_0x23b23f[_0xa101('0x50')]);}}}catch(_0x22796b){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x26379a[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x22796b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x8d')]=function(_0x4ea052){try{if(this[_0xa101('0x61')](_0x4ea052)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x4ea052[_0xa101('0x4d')],util['inspect'](_0x4ea052,{'showHidden':![],'depth':null}));if(this[_0xa101('0xe')][_0x4ea052[_0xa101('0x4d')]]){var _0x54181f=_[_0xa101('0x8b')](this['queueReports'][_0x4ea052[_0xa101('0x4d')]]);_0x54181f[_0xa101('0x82')]=![];_0x54181f[_0xa101('0x83')]=null;_0x54181f[_0xa101('0x8e')]=!![];_0x54181f[_0xa101('0x85')]=_0x4ea052[_0xa101('0x8f')];_0x54181f[_0xa101('0x80')]=_0x4ea052[_0xa101('0x80')];_0x54181f[_0xa101('0x7e')]=!![];_0x54181f[_0xa101('0x90')]=![];_0x54181f[_0xa101('0x91')]=null;if(!_0x54181f[_0xa101('0x92')]){if(_0x4ea052[_0xa101('0x93')]==_0xa101('0x92')){_0x54181f[_0xa101('0x84')]=_0xa101('0x94');logger[_0xa101('0x78')](_0xa101('0x95'),_0x54181f[_0xa101('0x49')],_0x54181f[_0xa101('0x50')]);}else{if(_[_0xa101('0x96')](_0x4ea052['channel'][_0xa101('0x97')](),_0xa101('0x98'))){if(this[_0xa101('0xe')][_0x4ea052[_0xa101('0x99')]]){var _0x51385c=_[_0xa101('0x8b')](this[_0xa101('0xe')][_0x4ea052[_0xa101('0x99')]]);_0x51385c[_0xa101('0x7e')]=![];_0x51385c['queuecallerexit']=!![];_0x51385c[_0xa101('0x91')]=moment(_0x54181f[_0xa101('0x73')])[_0xa101('0x9a')](_0x4ea052['holdtime'],_0xa101('0x9b'))[_0xa101('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x51385c[_0xa101('0x84')]=_0xa101('0x9c');_0x51385c['transfer']=!![];_0x51385c[_0xa101('0x9d')]=_0xa101('0x9e');_0x51385c[_0xa101('0x9f')]=_0x4ea052['destexten'];_0x51385c[_0xa101('0xa0')]=_0x4ea052[_0xa101('0x4d')];logger[_0xa101('0x78')](_0xa101('0xa1'),_0x51385c[_0xa101('0x49')],_0x51385c[_0xa101('0x50')]);var _0x9e64e6=this[_0xa101('0xe')][_0x4ea052[_0xa101('0x99')]];this['queueReports'][_0x4ea052[_0xa101('0x99')]]=this[_0xa101('0xe')][_0x4ea052['uniqueid']];this[_0xa101('0xe')][_0x4ea052[_0xa101('0x4d')]]=_0x9e64e6;}}else{_0x54181f[_0xa101('0x84')]=_0xa101('0xa2')+_0x4ea052[_0xa101('0x93')][_0xa101('0xa3')]();logger[_0xa101('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x54181f[_0xa101('0x49')],_0x54181f['type'],_0x54181f['queuecallerexitreason']);}}}this[_0xa101('0x10')][_0x4ea052['uniqueid']]=_0x54181f;this[_0xa101('0x41')](_0x54181f,_0xa101('0xa4'));}}}catch(_0x40a38c){logger['error'](_0xa101('0xa5'),_0x4ea052['uniqueid'],util['inspect'](_0x40a38c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x21')]=function(_0x2b6f02){try{if(this['isNotNull'](_0x2b6f02)){logger[_0xa101('0x44')](_0xa101('0xa6'),_0x2b6f02[_0xa101('0x4d')],util['inspect'](_0x2b6f02,{'showHidden':![],'depth':null}));this['addVariable'](_0x2b6f02[_0xa101('0x4d')],_['keys'](_0x2b6f02[_0xa101('0xa7')])[0x0],_0x2b6f02[_0xa101('0xa8')]);if(this['queueReports'][_0x2b6f02[_0xa101('0x4d')]]){var _0x20b251=_['last'](this[_0xa101('0xe')][_0x2b6f02[_0xa101('0x4d')]]);if(_0x20b251){if(this[_0xa101('0x61')](_0x2b6f02[_0xa101('0xa7')])&&this[_0xa101('0x61')](_0x2b6f02['variable'][_0xa101('0xa9')])){switch(_0x2b6f02[_0xa101('0xa8')]){case _0xa101('0xaa'):_0x20b251['queuecallerexit']=![];_0x20b251[_0xa101('0x91')]=null;break;case _0xa101('0xab'):_0x20b251[_0xa101('0xac')]=_0xa101('0xad');_0x20b251[_0xa101('0x90')]=!![];_0x20b251[_0xa101('0x91')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));_0x20b251['queuecallerleaveAt']=moment()[_0xa101('0x4e')](_0xa101('0x74'));logger[_0xa101('0x44')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2b6f02[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x20b251,{'showHidden':![],'depth':null}));ami[_0xa101('0x47')](_0xa101('0xae'),_0x20b251);break;default:_0x20b251[_0xa101('0x90')]=!![];_0x20b251[_0xa101('0x91')]=moment()['format'](_0xa101('0x74'));_0x20b251[_0xa101('0xaf')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));}_0x20b251[_0xa101('0x82')]=![];_0x20b251[_0xa101('0x83')]=null;_0x20b251[_0xa101('0x84')]=_0x2b6f02[_0xa101('0xa8')];this['channels'][_0x2b6f02[_0xa101('0x4d')]]=_0x20b251;this[_0xa101('0x41')](_0x20b251,'varset');}else if(this[_0xa101('0x61')](_0x2b6f02[_0xa101('0xa7')])&&this[_0xa101('0x61')](_0x2b6f02[_0xa101('0xa7')][_0xa101('0xb0')])){if(!_0x20b251[_0xa101('0x82')]){_0x20b251['queuecallerexit']=!![];_0x20b251[_0xa101('0x91')]=moment()['format'](_0xa101('0x74'));_0x20b251[_0xa101('0x84')]=_0xa101('0xb1');_0x20b251[_0xa101('0xaf')]=moment()[_0xa101('0x4e')](_0xa101('0x74'));this['channels'][_0x2b6f02[_0xa101('0x4d')]]=_0x20b251;}}logger['info'](_0xa101('0xb2'),_0x2b6f02['uniqueid'],_0x20b251[_0xa101('0x49')],_0x20b251[_0xa101('0x50')],_[_0xa101('0x7c')](_0x2b6f02['variable'])[0x0],_0x2b6f02[_0xa101('0xa8')]);_0x20b251['variables']=this['variables'][_0x2b6f02[_0xa101('0x4d')]];}}}}catch(_0x2c2f9c){logger['error'](_0xa101('0xa6'),_0x2b6f02[_0xa101('0x4d')],util[_0xa101('0x3b')](_0x2c2f9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0xb3')]=function(_0x4987d0,_0x4afc65,_0x2234cb){var _0xff80cc=[_0xa101('0xb4'),_0xa101('0xb5'),_0xa101('0xb6'),_0xa101('0xb7'),_0xa101('0xb8'),_0xa101('0xb9'),_0xa101('0xba'),'rtpaudioqosrttbridged',_0xa101('0xbb'),_0xa101('0xbc'),_0xa101('0xbd'),_0xa101('0xbe'),'membercalls',_0xa101('0xbf'),_0xa101('0xc0'),_0xa101('0xc1'),_0xa101('0x8f'),_0xa101('0xc2'),_0xa101('0xc3')];if(!_[_0xa101('0x32')](_0x4afc65)&&!_[_0xa101('0xc4')](_0xff80cc,_0x4afc65)){if(_[_0xa101('0x62')](this[_0xa101('0x14')][_0x4987d0])){this[_0xa101('0x14')][_0x4987d0]={};}this[_0xa101('0x14')][_0x4987d0][_0x4afc65]=_0x2234cb;}};VoiceQueueReport[_0xa101('0x30')][_0xa101('0x23')]=function(_0x2b47ae){try{if(this['isNotNull'](_0x2b47ae)){logger[_0xa101('0x44')](_0xa101('0xc5'),_0x2b47ae[_0xa101('0x4d')],util['inspect'](_0x2b47ae,{'showHidden':![],'depth':null}));if(this[_0xa101('0xe')][_0x2b47ae['uniqueid']]){for(var _0x3bfe50=0x0,_0x1947a2={};_0x3bfe50=0x0?moment(_0x97b7ba['endtime'])[_0x7f0c('0xd')](_0x97b7ba[_0x7f0c('0x18')],_0x7f0c('0xf')):null,'data1':_0x7f0c('0x1a'),'data2':_0x97b7ba[_0x7f0c('0x14')],'data3':_0x97b7ba[_0x7f0c('0x12')],'data4':_0x97b7ba['dialstring']||null,'role':_0x7f0c('0x13'),'internal':_0x97b7ba[_0x7f0c('0x14')]?_[_0x7f0c('0x15')](_0x97b7ba['accountcode']):undefined,'uniqueid':_0x97b7ba[_0x7f0c('0x1b')]},'log':_0x7f0c('0x5')});}; \ No newline at end of file +var _0xf012=['lastAssignedTo','interface','format','SIP/%s','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','dialstring','toNumber','moment','lodash','util','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice'];(function(_0x73d502,_0x19ac4d){var _0x2721bc=function(_0x2fb014){while(--_0x2fb014){_0x73d502['push'](_0x73d502['shift']());}};_0x2721bc(++_0x19ac4d);}(_0xf012,0x154));var _0x2f01=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xf012[_0x119d5a];return _0x15bff4;};'use strict';var moment=require(_0x2f01('0x0'));var _=require(_0x2f01('0x1'));var util=require(_0x2f01('0x2'));var client=require('../client');exports[_0x2f01('0x3')]=function(_0x563fec){var _0x14fb58=_0x563fec['queuecallercompleteAt']||_0x563fec[_0x2f01('0x4')];return client[_0x2f01('0x5')](_0x2f01('0x6'),{'body':{'channel':_0x2f01('0x7'),'membername':_0x563fec[_0x2f01('0x8')],'interface':_['isNil'](_0x563fec[_0x2f01('0x9')])?util[_0x2f01('0xa')](_0x2f01('0xb'),_0x563fec[_0x2f01('0x8')]):_0x563fec[_0x2f01('0x9')],'type':'TALKING','enterAt':_0x563fec[_0x2f01('0xc')],'exitAt':_0x14fb58,'duration':moment(_0x14fb58)[_0x2f01('0xd')](_0x563fec[_0x2f01('0xc')],_0x2f01('0xe')),'data1':_0x2f01('0xf'),'data2':_0x563fec[_0x2f01('0x10')],'data3':_0x563fec[_0x2f01('0x11')],'data4':null,'data5':_0x563fec[_0x2f01('0x12')],'role':_0x2f01('0x13'),'internal':_0x563fec[_0x2f01('0x14')]?_['toNumber'](_0x563fec[_0x2f01('0x14')]):undefined,'uniqueid':_0x563fec[_0x2f01('0x15')]},'log':_0x2f01('0x6')});};exports[_0x2f01('0x16')]=function(_0x10d572){return client[_0x2f01('0x5')](_0x2f01('0x6'),{'body':{'channel':_0x2f01('0x7'),'membername':_0x10d572[_0x2f01('0x17')],'interface':_0x10d572[_0x2f01('0x9')],'type':_0x2f01('0x18'),'enterAt':_0x10d572[_0x2f01('0x19')],'exitAt':_0x10d572[_0x2f01('0x1a')],'duration':moment(_0x10d572['endtime'])['diff'](_0x10d572[_0x2f01('0x19')],_0x2f01('0xe'))>=0x0?moment(_0x10d572[_0x2f01('0x1a')])['diff'](_0x10d572[_0x2f01('0x19')],_0x2f01('0xe')):null,'data1':'outbound','data2':_0x10d572['accountcode'],'data3':_0x10d572[_0x2f01('0x11')],'data4':_0x10d572[_0x2f01('0x1b')]||null,'role':'agent','internal':_0x10d572[_0x2f01('0x14')]?_[_0x2f01('0x1c')](_0x10d572[_0x2f01('0x14')]):undefined,'uniqueid':_0x10d572[_0x2f01('0x15')]},'log':_0x2f01('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 001b287..e05e488 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 _0xaa1b=['GetSettings','../client','getSettings','Request','stopRecordingOnTransfer'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xbaa1('0x0'));exports[_0xbaa1('0x1')]=function(){return client[_0xbaa1('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbaa1('0x3'),'previewRecallmeReminderInterval']},'log':_0xbaa1('0x4')});}; \ No newline at end of file +var _0x1458=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x53d5c7,_0x4212b3){var _0x40cc26=function(_0x2b519a){while(--_0x2b519a){_0x53d5c7['push'](_0x53d5c7['shift']());}};_0x40cc26(++_0x4212b3);}(_0x1458,0x16c));var _0x8145=function(_0x5690c4,_0x4c8668){_0x5690c4=_0x5690c4-0x0;var _0x4b6b88=_0x1458[_0x5690c4];return _0x4b6b88;};'use strict';var client=require(_0x8145('0x0'));exports[_0x8145('0x1')]=function(){return client[_0x8145('0x2')](_0x8145('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8145('0x4'),_0x8145('0x5')]},'log':_0x8145('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index a4d3098..360e6dd 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 _0xbafa=['name','GetTemplate','../client','getTemplates','Request'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0xbafa,0x66));var _0xabaf=function(_0x75720e,_0x21bcfb){_0x75720e=_0x75720e-0x0;var _0x38de95=_0xbafa[_0x75720e];return _0x38de95;};'use strict';var client=require(_0xabaf('0x0'));exports[_0xabaf('0x1')]=function(_0x519ed6){return function(_0x172308){return client[_0xabaf('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xabaf('0x3'),'html']},'log':_0xabaf('0x4')});};}; \ No newline at end of file +var _0xf79b=['getTemplates','Request','GetTemplate','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf79b,0xa0));var _0xbf79=function(_0x329fd3,_0x5721dd){_0x329fd3=_0x329fd3-0x0;var _0x5096ec=_0xf79b[_0x329fd3];return _0x5096ec;};'use strict';var client=require('../client');exports[_0xbf79('0x0')]=function(_0x15d780){return function(_0x5389ed){return client[_0xbf79('0x1')](_0xbf79('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbf79('0x3'),'html']},'log':_0xbf79('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6c304e5..efa3a1c 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 _0xcc7a=['status','Condition','field','operator','value','Action','Actions','action','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel'];(function(_0x248c90,_0x1ed333){var _0x449036=function(_0x54ed08){while(--_0x54ed08){_0x248c90['push'](_0x248c90['shift']());}};_0x449036(++_0x1ed333);}(_0xcc7a,0x151));var _0xacc7=function(_0x38a3d6,_0x52e305){_0x38a3d6=_0x38a3d6-0x0;var _0x3768d7=_0xcc7a[_0x38a3d6];return _0x3768d7;};'use strict';var client=require(_0xacc7('0x0'));exports[_0xacc7('0x1')]=function(_0x370214){return function(_0x11911c){return client['Request'](_0xacc7('0x2'),{'options':{'raw':![],'attributes':['id',_0xacc7('0x3'),_0xacc7('0x4'),_0xacc7('0x5')],'include':[{'model':_0xacc7('0x6'),'as':'AllConditions','attributes':['id',_0xacc7('0x7'),_0xacc7('0x8'),_0xacc7('0x9')]},{'model':_0xacc7('0x6'),'as':'AnyConditions','attributes':['id',_0xacc7('0x7'),_0xacc7('0x8'),_0xacc7('0x9')]},{'model':_0xacc7('0xa'),'as':_0xacc7('0xb'),'attributes':['id',_0xacc7('0xc'),'data1',_0xacc7('0xd'),_0xacc7('0xe'),_0xacc7('0xf'),'data5',_0xacc7('0x10'),_0xacc7('0x11')]}]},'log':_0xacc7('0x2')});};}; \ No newline at end of file +var _0x503f=['../client','Request','name','channel','status','Condition','field','value','AnyConditions','operator','Action','Actions','action','data2','data3','data4','data5','data6','data7','GetTrigger'];(function(_0x5d8bc1,_0x561111){var _0x447ae2=function(_0x40dff9){while(--_0x40dff9){_0x5d8bc1['push'](_0x5d8bc1['shift']());}};_0x447ae2(++_0x561111);}(_0x503f,0x1e0));var _0xf503=function(_0x14c360,_0xeea136){_0x14c360=_0x14c360-0x0;var _0x49e3d7=_0x503f[_0x14c360];return _0x49e3d7;};'use strict';var client=require(_0xf503('0x0'));exports['getTriggers']=function(_0xc170c5){return function(_0x2b08c7){return client[_0xf503('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xf503('0x2'),_0xf503('0x3'),_0xf503('0x4')],'include':[{'model':_0xf503('0x5'),'as':'AllConditions','attributes':['id',_0xf503('0x6'),'operator',_0xf503('0x7')]},{'model':'Condition','as':_0xf503('0x8'),'attributes':['id',_0xf503('0x6'),_0xf503('0x9'),_0xf503('0x7')]},{'model':_0xf503('0xa'),'as':_0xf503('0xb'),'attributes':['id',_0xf503('0xc'),'data1',_0xf503('0xd'),_0xf503('0xe'),_0xf503('0xf'),_0xf503('0x10'),_0xf503('0x11'),_0xf503('0x12')]}]},'log':_0xf503('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c9a716f..d4efc65 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 _0x1d1e=['getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x184c32,_0x3e0ec1){var _0x4dd97e=function(_0x1bc447){while(--_0x1bc447){_0x184c32['push'](_0x184c32['shift']());}};_0x4dd97e(++_0x3e0ec1);}(_0x1d1e,0x1e5));var _0xe1d1=function(_0x4d9242,_0x385b6e){_0x4d9242=_0x4d9242-0x0;var _0x59301e=_0x1d1e[_0x4d9242];return _0x59301e;};'use strict';var client=require('../client');exports[_0xe1d1('0x0')]=function(_0x1b0fe9){return function(_0x3dc502){return client['Request'](_0xe1d1('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe1d1('0x2'),_0xe1d1('0x3'),_0xe1d1('0x4')]},'log':_0xe1d1('0x1')});};}; \ No newline at end of file +var _0x1403=['GetTrunk','registry','defaultuser','../client','getTrunks','Request'];(function(_0x2d49ce,_0x4903d6){var _0x3c85f7=function(_0xf93d6a){while(--_0xf93d6a){_0x2d49ce['push'](_0x2d49ce['shift']());}};_0x3c85f7(++_0x4903d6);}(_0x1403,0x153));var _0x3140=function(_0x5efea9,_0x30c556){_0x5efea9=_0x5efea9-0x0;var _0x8012dd=_0x1403[_0x5efea9];return _0x8012dd;};'use strict';var client=require(_0x3140('0x0'));exports[_0x3140('0x1')]=function(_0x222d86){return function(_0x176022){return client[_0x3140('0x2')](_0x3140('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x3140('0x4'),_0x3140('0x5')]},'log':_0x3140('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4a08e05..2c197b6 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x54be6f,_0x34f348){var _0x318034=function(_0x2193b4){while(--_0x2193b4){_0x54be6f['push'](_0x54be6f['shift']());}};_0x318034(++_0x34f348);}(_0x70e0,0x17b));var _0x070e=function(_0x1e9a4b,_0x5104c6){_0x1e9a4b=_0x1e9a4b-0x0;var _0x58c6f0=_0x70e0[_0x1e9a4b];return _0x58c6f0;};'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 +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x41db0c,_0x1a4f78){var _0x5412b8=function(_0x421cab){while(--_0x421cab){_0x41db0c['push'](_0x41db0c['shift']());}};_0x5412b8(++_0x1a4f78);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index fedbee2..1b61c8b 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 _0x7db6=['UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update','Request'];(function(_0x1d0458,_0x4ed6d4){var _0x2fad3c=function(_0x44b181){while(--_0x44b181){_0x1d0458['push'](_0x1d0458['shift']());}};_0x2fad3c(++_0x4ed6d4);}(_0x7db6,0x19b));var _0x67db=function(_0x5e5f4c,_0x1a65c6){_0x5e5f4c=_0x5e5f4c-0x0;var _0x3b0dc5=_0x7db6[_0x5e5f4c];return _0x3b0dc5;};'use strict';var client=require(_0x67db('0x0'));exports['create']=function(_0x3ca3bf){return client['Request']('CreateVoiceAgentReport',{'body':_0x3ca3bf,'log':_0x67db('0x1')});};exports[_0x67db('0x2')]=function(_0x1ab383,_0x5232e3,_0x1e7e92){return client[_0x67db('0x3')](_0x67db('0x4'),{'body':_0x1ab383,'options':{'where':{'uniqueid':_0x5232e3,'interface':_0x1e7e92,'agentcomplete':!![]}},'log':_0x67db('0x4')});}; \ No newline at end of file +var _0xcd76=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3b9705,_0x5b8651){var _0x2d9c14=function(_0xf6c50b){while(--_0xf6c50b){_0x3b9705['push'](_0x3b9705['shift']());}};_0x2d9c14(++_0x5b8651);}(_0xcd76,0x101));var _0x6cd7=function(_0x14b596,_0x1a2e86){_0x14b596=_0x14b596-0x0;var _0x14ece4=_0xcd76[_0x14b596];return _0x14ece4;};'use strict';var client=require(_0x6cd7('0x0'));exports[_0x6cd7('0x1')]=function(_0x8b807){return client[_0x6cd7('0x2')](_0x6cd7('0x3'),{'body':_0x8b807,'log':_0x6cd7('0x3')});};exports[_0x6cd7('0x4')]=function(_0x38d131,_0x165c85,_0x531475){return client['Request'](_0x6cd7('0x5'),{'body':_0x38d131,'options':{'where':{'uniqueid':_0x165c85,'interface':_0x531475,'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 6bae169..7541873 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 _0x8c00=['GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','duration','billableseconds'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x8c00,0xa1));var _0x08c0=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x8c00[_0x52684f];return _0x4a55f0;};'use strict';var moment=require(_0x08c0('0x0'));var util=require(_0x08c0('0x1'));var _=require('lodash');var client=require('../client');exports[_0x08c0('0x2')]=function(_0xc13e50){return client[_0x08c0('0x3')](_0x08c0('0x4'),{'body':_[_0x08c0('0x5')](_0xc13e50,{'source':_0xc13e50[_0x08c0('0x6')],'destinationcontext':_0xc13e50[_0x08c0('0x7')],'callerid':_0xc13e50[_0x08c0('0x8')],'amaflags':_0x08c0('0x9')}),'log':_0x08c0('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x08c0('0x3')](_0x08c0('0xa'),{'options':{'where':{'type':[_0x08c0('0xb')],'createdAt':{'$between':[moment()[_0x08c0('0xc')](_0x08c0('0xd'))['format'](_0x08c0('0xe')),moment()[_0x08c0('0xf')](_0x08c0('0xd'))[_0x08c0('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type','disposition',_0x08c0('0x11'),_0x08c0('0x12')]},'log':_0x08c0('0x13')});};}; \ No newline at end of file +var _0x0130=['calleridnum','context','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','merge'];(function(_0x845587,_0x44f4f8){var _0x396303=function(_0x39959b){while(--_0x39959b){_0x845587['push'](_0x845587['shift']());}};_0x396303(++_0x44f4f8);}(_0x0130,0x174));var _0x0013=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x0130[_0x528575];return _0x3063b7;};'use strict';var moment=require(_0x0013('0x0'));var util=require(_0x0013('0x1'));var _=require(_0x0013('0x2'));var client=require(_0x0013('0x3'));exports[_0x0013('0x4')]=function(_0x67c17d){return client['Request']('CreateVoiceCallReport',{'body':_[_0x0013('0x5')](_0x67c17d,{'source':_0x67c17d[_0x0013('0x6')],'destinationcontext':_0x67c17d[_0x0013('0x7')],'callerid':_0x67c17d['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x0013('0x8')});};exports[_0x0013('0x9')]=function(){return function(){return client['Request'](_0x0013('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x0013('0xb')]('day')[_0x0013('0xc')](_0x0013('0xd')),moment()[_0x0013('0xe')](_0x0013('0xf'))[_0x0013('0xc')](_0x0013('0xd'))]}},'attributes':[_0x0013('0x10'),_0x0013('0x11'),_0x0013('0x12'),_0x0013('0x13')]},'log':_0x0013('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5ffed17..217e65f 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 _0x1283=['Request','CreateVoiceDialReport','../client','create'];(function(_0x6ce94a,_0x41187a){var _0x1ff8b3=function(_0x21dd3e){while(--_0x21dd3e){_0x6ce94a['push'](_0x6ce94a['shift']());}};_0x1ff8b3(++_0x41187a);}(_0x1283,0x16e));var _0x3128=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x1283[_0x602ca8];return _0x26e8ab;};'use strict';var client=require(_0x3128('0x0'));exports[_0x3128('0x1')]=function(_0x168a34){return client[_0x3128('0x2')](_0x3128('0x3'),{'body':_0x168a34,'log':_0x3128('0x3')});}; \ No newline at end of file +var _0xad9e=['../client','CreateVoiceDialReport'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0xad9e,0x154));var _0xead9=function(_0x1377be,_0x536cda){_0x1377be=_0x1377be-0x0;var _0x344720=_0xad9e[_0x1377be];return _0x344720;};'use strict';var client=require(_0xead9('0x0'));exports['create']=function(_0x3704b9){return client['Request'](_0xead9('0x1'),{'body':_0x3704b9,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index bfb3615..5a4114c 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 _0x2750=['exten','recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x15842a,_0x22c5c1){var _0x549051=function(_0x362a3a){while(--_0x362a3a){_0x15842a['push'](_0x15842a['shift']());}};_0x549051(++_0x22c5c1);}(_0x2750,0x13b));var _0x0275=function(_0x245636,_0x562edc){_0x245636=_0x245636-0x0;var _0x309297=_0x2750[_0x245636];return _0x309297;};'use strict';var client=require(_0x0275('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x0275('0x1')](_0x0275('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0275('0x3'),_0x0275('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0275('0x5')});};}; \ No newline at end of file +var _0x2750=['exten','recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x5954d6,_0x5c5402){var _0x3e8ad5=function(_0x2b6d21){while(--_0x2b6d21){_0x5954d6['push'](_0x5954d6['shift']());}};_0x3e8ad5(++_0x5c5402);}(_0x2750,0x13b));var _0x0275=function(_0x369883,_0x3dd9cc){_0x369883=_0x369883-0x0;var _0x4116cc=_0x2750[_0x369883];return _0x4116cc;};'use strict';var client=require(_0x0275('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x0275('0x1')](_0x0275('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0275('0x3'),_0x0275('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0275('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a42458c..90333e6 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 _0x6fff=['callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','Request','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk'];(function(_0x3ef240,_0x371ba8){var _0x57ad45=function(_0x299071){while(--_0x299071){_0x3ef240['push'](_0x3ef240['shift']());}};_0x57ad45(++_0x371ba8);}(_0x6fff,0x77));var _0xf6ff=function(_0x1fa3d6,_0x1550d4){_0x1fa3d6=_0x1fa3d6-0x0;var _0x12ae4b=_0x6fff[_0x1fa3d6];return _0x12ae4b;};'use strict';var client=require('../client');exports[_0xf6ff('0x0')]=function(){return function(){return client[_0xf6ff('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xf6ff('0x2'),_0xf6ff('0x3'),_0xf6ff('0x4'),_0xf6ff('0x5'),'monitor_format',_0xf6ff('0x6'),_0xf6ff('0x7'),_0xf6ff('0x8'),_0xf6ff('0x9'),_0xf6ff('0xa'),_0xf6ff('0xb'),'dialPredictiveOptimization',_0xf6ff('0xc'),_0xf6ff('0xd'),_0xf6ff('0xe'),_0xf6ff('0xf'),_0xf6ff('0x10'),_0xf6ff('0x11'),_0xf6ff('0x12'),_0xf6ff('0x13'),_0xf6ff('0x14'),'dialCongestionRetryFrequency',_0xf6ff('0x15'),_0xf6ff('0x16'),_0xf6ff('0x17'),_0xf6ff('0x18'),'dialGlobalMaxRetry',_0xf6ff('0x19'),_0xf6ff('0x1a'),'dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting',_0xf6ff('0x1b'),_0xf6ff('0x1c'),'dialAMDMinWordLength',_0xf6ff('0x1d'),'dialAMDMaximumNumberOfWords',_0xf6ff('0x1e'),'dialAMDMaximumWordLength','timeout',_0xf6ff('0x1f'),'dialRecallInQueue','dialOrderByScheduledAt',_0xf6ff('0x20'),_0xf6ff('0x21'),_0xf6ff('0x22'),_0xf6ff('0x23'),_0xf6ff('0x24'),_0xf6ff('0x25'),'dialCutDigit',_0xf6ff('0x26'),'dialNoSuchNumberRetryFrequency',_0xf6ff('0x27'),_0xf6ff('0x28'),_0xf6ff('0x29'),_0xf6ff('0x2a'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xf6ff('0x2b'),_0xf6ff('0x2c'),'mandatoryDisposition',_0xf6ff('0x2d'),_0xf6ff('0x2e'),'dialPreviewAutoRecallMe',_0xf6ff('0x2f')],'include':[{'model':_0xf6ff('0x30'),'as':_0xf6ff('0x30'),'attributes':['id',_0xf6ff('0x2'),_0xf6ff('0x31'),_0xf6ff('0x32')]},{'model':_0xf6ff('0x33'),'as':_0xf6ff('0x34'),'attributes':['id','name']},{'model':_0xf6ff('0x30'),'as':_0xf6ff('0x35'),'attributes':['id',_0xf6ff('0x2'),'callerid',_0xf6ff('0x32')]},{'model':_0xf6ff('0x36'),'as':_0xf6ff('0x36'),'attributes':['id',_0xf6ff('0x2')],'include':[{'model':_0xf6ff('0x36'),'as':'Intervals','attributes':['id',_0xf6ff('0x2'),_0xf6ff('0x37')]}]}]},'log':_0xf6ff('0x0')});};}; \ No newline at end of file +var _0x9b62=['dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe'];(function(_0x41648f,_0x4a8936){var _0x20340a=function(_0x358f29){while(--_0x358f29){_0x41648f['push'](_0x41648f['shift']());}};_0x20340a(++_0x4a8936);}(_0x9b62,0x169));var _0x29b6=function(_0x148fdd,_0x116751){_0x148fdd=_0x148fdd-0x0;var _0x130f14=_0x9b62[_0x148fdd];return _0x130f14;};'use strict';var client=require(_0x29b6('0x0'));exports[_0x29b6('0x1')]=function(){return function(){return client[_0x29b6('0x2')](_0x29b6('0x3'),{'options':{'raw':![],'attributes':['id',_0x29b6('0x4'),_0x29b6('0x5'),_0x29b6('0x6'),_0x29b6('0x7'),_0x29b6('0x8'),_0x29b6('0x9'),_0x29b6('0xa'),_0x29b6('0xb'),_0x29b6('0xc'),_0x29b6('0xd'),_0x29b6('0xe'),'dialPredictiveOptimization',_0x29b6('0xf'),'dialPredictiveInterval',_0x29b6('0x10'),_0x29b6('0x11'),'dialOriginateTimeout',_0x29b6('0x12'),'dialQueueTimeout',_0x29b6('0x13'),'dialCongestionMaxRetry',_0x29b6('0x14'),'dialBusyMaxRetry',_0x29b6('0x15'),_0x29b6('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x29b6('0x17'),_0x29b6('0x18'),_0x29b6('0x19'),_0x29b6('0x1a'),'dialAMDActive',_0x29b6('0x1b'),_0x29b6('0x1c'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x29b6('0x1d'),_0x29b6('0x1e'),_0x29b6('0x1f'),_0x29b6('0x20'),_0x29b6('0x21'),_0x29b6('0x22'),'dialRecallMeTimeout',_0x29b6('0x23'),_0x29b6('0x24'),'dialAgiAfterHangupAgent',_0x29b6('0x25'),'dialQueueProject2',_0x29b6('0x8'),_0x29b6('0x26'),_0x29b6('0x27'),'dialCutDigit',_0x29b6('0x28'),_0x29b6('0x29'),_0x29b6('0x2a'),_0x29b6('0x2b'),_0x29b6('0x2c'),_0x29b6('0x2d'),_0x29b6('0x2e'),'dialMachineRetryFrequency',_0x29b6('0x2f'),_0x29b6('0x30'),_0x29b6('0x31'),_0x29b6('0x32'),'dialPredictiveIntervalMinThreshold',_0x29b6('0x33'),_0x29b6('0x34')],'include':[{'model':'Trunk','as':_0x29b6('0x35'),'attributes':['id',_0x29b6('0x4'),'callerid','active']},{'model':_0x29b6('0x36'),'as':_0x29b6('0x37'),'attributes':['id',_0x29b6('0x4')]},{'model':_0x29b6('0x35'),'as':_0x29b6('0x38'),'attributes':['id',_0x29b6('0x4'),'callerid','active']},{'model':_0x29b6('0x39'),'as':_0x29b6('0x39'),'attributes':['id','name'],'include':[{'model':_0x29b6('0x39'),'as':'Intervals','attributes':['id',_0x29b6('0x4'),_0x29b6('0x3a')]}]}]},'log':_0x29b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 81c82fc..944b465 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(_0x255b6d,_0x1f2c7a){var _0x3313f0=function(_0x1e389a){while(--_0x1e389a){_0x255b6d['push'](_0x255b6d['shift']());}};_0x3313f0(++_0x1f2c7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x4a08b6,_0x21a046){var _0x3fac4d=function(_0x3556d5){while(--_0x3556d5){_0x4a08b6['push'](_0x4a08b6['shift']());}};_0x3fac4d(++_0x21a046);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 76d6823..7d4c9dd 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 _0x18e4=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x42555d,_0x3b41a7){var _0x41e13e=function(_0x4066a3){while(--_0x4066a3){_0x42555d['push'](_0x42555d['shift']());}};_0x41e13e(++_0x3b41a7);}(_0x18e4,0xdd));var _0x418e=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0x18e4[_0x1ff2ec];return _0x405683;};'use strict';var client=require('../client');exports[_0x418e('0x0')]=function(_0x1747b5){return function(){return client[_0x418e('0x1')](_0x418e('0x2'),{'options':{'where':{'VoiceQueueId':_0x1747b5,'paused':!![]},'raw':!![]},'log':_0x418e('0x0')});};}; \ No newline at end of file +var _0x8888=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x54ab7c,_0x20d9f9){var _0x4ce8d8=function(_0x1dc0b4){while(--_0x1dc0b4){_0x54ab7c['push'](_0x54ab7c['shift']());}};_0x4ce8d8(++_0x20d9f9);}(_0x8888,0x168));var _0x8888=function(_0x57fe0e,_0x51d158){_0x57fe0e=_0x57fe0e-0x0;var _0x368c40=_0x8888[_0x57fe0e];return _0x368c40;};'use strict';var client=require(_0x8888('0x0'));exports[_0x8888('0x1')]=function(_0x391b3d){return function(){return client['Request'](_0x8888('0x2'),{'options':{'where':{'VoiceQueueId':_0x391b3d,'paused':!![]},'raw':!![]},'log':_0x8888('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e44c376..b0f7f4c 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(_0x9a8c85,_0x7c4f84){var _0x106725=function(_0x22abd0){while(--_0x22abd0){_0x9a8c85['push'](_0x9a8c85['shift']());}};_0x106725(++_0x7c4f84);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x5653ab,_0x6928cf){var _0x2c3efa=function(_0x2b7a2a){while(--_0x2b7a2a){_0x5653ab['push'](_0x5653ab['shift']());}};_0x2c3efa(++_0x6928cf);}(_0x7a54,0x106));var _0x47a5=function(_0x466e4d,_0x28d50e){_0x466e4d=_0x466e4d-0x0;var _0x595288=_0x7a54[_0x466e4d];return _0x595288;};'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 9382f88..de93644 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 _0x4b9c=['blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4b9c,0x1d4));var _0xc4b9=function(_0x152434,_0x1963fc){_0x152434=_0x152434-0x0;var _0x56b5a9=_0x4b9c[_0x152434];return _0x56b5a9;};'use strict';var client=require('../client');exports['transfers']={};exports[_0xc4b9('0x0')]=function(_0x837581){return client[_0xc4b9('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x837581[_0xc4b9('0x2')],'transfererchannel':_0x837581[_0xc4b9('0x3')],'transferercalleridnum':_0x837581[_0xc4b9('0x4')],'transferercalleridname':_0x837581[_0xc4b9('0x5')],'transfererconnectedlinenum':_0x837581[_0xc4b9('0x6')],'transfererconnectedlinename':_0x837581[_0xc4b9('0x7')],'transfereraccountcode':_0x837581['transfereraccountcode'],'transferercontext':_0x837581[_0xc4b9('0x8')],'transfererexten':_0x837581[_0xc4b9('0x9')],'transfererlinkedid':_0x837581['transfererlinkedid'],'transfereechannel':_0x837581[_0xc4b9('0xa')],'transfereecalleridnum':_0x837581['transfereecalleridnum'],'transfereecalleridname':_0x837581[_0xc4b9('0xb')],'transfereeconnectedlinenum':_0x837581[_0xc4b9('0xc')],'transfereeconnectedlinename':_0x837581['transfereeconnectedlinename'],'transfereeaccountcode':_0x837581['transfereeaccountcode'],'transfereecontext':_0x837581['transfereecontext'],'transfereeexten':_0x837581[_0xc4b9('0xd')],'transfereelinkedid':_0x837581['transfereelinkedid'],'isexternal':_0x837581[_0xc4b9('0xe')],'context':_0x837581[_0xc4b9('0xf')],'extension':_0x837581[_0xc4b9('0x10')],'type':_0xc4b9('0x11')},'log':_0xc4b9('0x12')});};exports['attendedTransfer']=function(_0x652316){return client[_0xc4b9('0x1')](_0xc4b9('0x12'),{'body':{'result':_0x652316[_0xc4b9('0x2')],'transfererchannel':_0x652316['origtransfererchannel'],'transferercalleridnum':_0x652316[_0xc4b9('0x13')],'transferercalleridname':_0x652316[_0xc4b9('0x14')],'transfererconnectedlinenum':_0x652316[_0xc4b9('0x15')],'transfererconnectedlinename':_0x652316[_0xc4b9('0x16')],'transfereraccountcode':_0x652316[_0xc4b9('0x17')],'transferercontext':_0x652316[_0xc4b9('0x18')],'transfererexten':_0x652316[_0xc4b9('0x19')],'transfererlinkedid':_0x652316[_0xc4b9('0x1a')],'transfereechannel':_0x652316['transfertargetchannel'],'transfereecalleridnum':_0x652316[_0xc4b9('0x1b')],'transfereecalleridname':_0x652316[_0xc4b9('0x1c')],'transfereeconnectedlinenum':_0x652316[_0xc4b9('0x1d')],'transfereeconnectedlinename':_0x652316['transfertargetconnectedlinename'],'transfereeaccountcode':_0x652316[_0xc4b9('0x1e')],'transfereecontext':_0x652316[_0xc4b9('0x1f')],'transfereeexten':_0x652316[_0xc4b9('0x20')],'transfereelinkedid':_0x652316[_0xc4b9('0x21')],'isexternal':_0x652316[_0xc4b9('0xe')],'context':_0x652316['origtransferercontext'],'extension':_0x652316[_0xc4b9('0x22')],'type':_0xc4b9('0x23')},'log':_0xc4b9('0x12')});}; \ No newline at end of file +var _0x81a3=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x81a3,0x16b));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x381a('0x0'));exports[_0x381a('0x1')]={};exports[_0x381a('0x2')]=function(_0x7b0945){return client[_0x381a('0x3')](_0x381a('0x4'),{'body':{'result':_0x7b0945[_0x381a('0x5')],'transfererchannel':_0x7b0945[_0x381a('0x6')],'transferercalleridnum':_0x7b0945[_0x381a('0x7')],'transferercalleridname':_0x7b0945['transferercalleridname'],'transfererconnectedlinenum':_0x7b0945[_0x381a('0x8')],'transfererconnectedlinename':_0x7b0945['transfererconnectedlinename'],'transfereraccountcode':_0x7b0945['transfereraccountcode'],'transferercontext':_0x7b0945[_0x381a('0x9')],'transfererexten':_0x7b0945[_0x381a('0xa')],'transfererlinkedid':_0x7b0945['transfererlinkedid'],'transfereechannel':_0x7b0945[_0x381a('0xb')],'transfereecalleridnum':_0x7b0945[_0x381a('0xc')],'transfereecalleridname':_0x7b0945['transfereecalleridname'],'transfereeconnectedlinenum':_0x7b0945['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x7b0945[_0x381a('0xd')],'transfereeaccountcode':_0x7b0945['transfereeaccountcode'],'transfereecontext':_0x7b0945['transfereecontext'],'transfereeexten':_0x7b0945['transfereeexten'],'transfereelinkedid':_0x7b0945[_0x381a('0xe')],'isexternal':_0x7b0945[_0x381a('0xf')],'context':_0x7b0945['context'],'extension':_0x7b0945[_0x381a('0x10')],'type':_0x381a('0x11')},'log':'CreateVoiceTransferReport'});};exports[_0x381a('0x12')]=function(_0x3b9b5e){return client[_0x381a('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3b9b5e[_0x381a('0x5')],'transfererchannel':_0x3b9b5e[_0x381a('0x13')],'transferercalleridnum':_0x3b9b5e[_0x381a('0x14')],'transferercalleridname':_0x3b9b5e[_0x381a('0x15')],'transfererconnectedlinenum':_0x3b9b5e[_0x381a('0x16')],'transfererconnectedlinename':_0x3b9b5e[_0x381a('0x17')],'transfereraccountcode':_0x3b9b5e[_0x381a('0x18')],'transferercontext':_0x3b9b5e['secondtransferercontext'],'transfererexten':_0x3b9b5e[_0x381a('0x19')],'transfererlinkedid':_0x3b9b5e['origtransfererlinkedid'],'transfereechannel':_0x3b9b5e['transfertargetchannel'],'transfereecalleridnum':_0x3b9b5e[_0x381a('0x1a')],'transfereecalleridname':_0x3b9b5e[_0x381a('0x1b')],'transfereeconnectedlinenum':_0x3b9b5e[_0x381a('0x1c')],'transfereeconnectedlinename':_0x3b9b5e[_0x381a('0x1d')],'transfereeaccountcode':_0x3b9b5e[_0x381a('0x1e')],'transfereecontext':_0x3b9b5e[_0x381a('0x1f')],'transfereeexten':_0x3b9b5e[_0x381a('0x20')],'transfereelinkedid':_0x3b9b5e[_0x381a('0x21')],'isexternal':_0x3b9b5e[_0x381a('0xf')],'context':_0x3b9b5e['origtransferercontext'],'extension':_0x3b9b5e['origtransfererexten'],'type':_0x381a('0x22')},'log':_0x381a('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index dd8f1e0..292a75e 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 _0x5496=['type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','omit','undefined','values','channels','voicechannel','map','find','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','length','resolve','StopMixMonitor','destinationchannel','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','isConnected','error','asterisk','username','pick','keys','action','Reload','Action','then','ami\x20disconnected','join','command','Command','content','catch','message','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','unmanaged','abandoned','loggedInDb'];(function(_0x5b76cf,_0x562478){var _0x43e3a3=function(_0x38515c){while(--_0x38515c){_0x5b76cf['push'](_0x5b76cf['shift']());}};_0x43e3a3(++_0x562478);}(_0x5496,0x175));var _0x6549=function(_0x4e1a60,_0x54e3ab){_0x4e1a60=_0x4e1a60-0x0;var _0x460457=_0x5496[_0x4e1a60];return _0x460457;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var jayson=require(_0x6549('0x2'));var schema=require(_0x6549('0x3'));var BPromise=require(_0x6549('0x4'));var moment=require('moment');var config=require(_0x6549('0x5'));var properties=require('../properties');var ami=require(_0x6549('0x6'));exports[_0x6549('0x7')]=function(_0x3750cc,_0x4d0473,_0x5a4658){return new BPromise(function(_0x43cb17,_0x1d8cea){var _0x4fcffd={'QueuePause':function(_0x1ca8fc){return new Promise(function(_0x3442c3,_0x1ef2a6){var _0x5c47ba=util[_0x6549('0x8')](_0x6549('0x9'),_0x6549('0xa'),_0x1ca8fc[_0x6549('0xb')]);if(_0x3750cc[_0x6549('0xc')]&&_0x3750cc[_0x6549('0xc')][_0x5c47ba]&&_0x3750cc['timers'][_0x5c47ba]['timer']){_0x3750cc[_0x6549('0xc')][_0x5c47ba][_0x6549('0xd')]();}if(_0x3750cc[_0x6549('0xe')][_0x5c47ba]){_0x3750cc[_0x6549('0xe')][_0x5c47ba][_0x6549('0xf')]({'statePause':_0x1ca8fc['pause']?!![]:![]});}_0x3442c3({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3f844f){var _0x39d78c=this;return new Promise(function(_0x57a149,_0x200ff1){if(ami[_0x6549('0x10')]()==![]){return _0x200ff1(_0x39d78c[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config[_0x6549('0x12')][_0x6549('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x3f844f=_[_0x6549('0x14')](_0x3f844f,_[_0x6549('0x15')](properties['module']));_0x3f844f[_0x6549('0x16')]=_0x6549('0x17');return ami[_0x6549('0x18')](_0x3f844f)[_0x6549('0x19')](function(_0xffc8b9){_0x57a149({'code':0xc8,'message':_0xffc8b9['message']});})['catch'](function(_0x26a212){_0x200ff1(_0x39d78c['error'](0x1f5,_0x26a212['message']));});});},'Command':function(_0x31f8e7){var _0x1e5079=this;return new Promise(function(_0x19c4a6,_0xfca192){if(ami[_0x6549('0x10')]()==![]){return _0xfca192(_0x1e5079['error'](0x1f4,[config[_0x6549('0x12')]['ip'],config['asterisk'][_0x6549('0x13')],_0x6549('0x1a')][_0x6549('0x1b')]('\x20')));}_0x31f8e7=_[_0x6549('0x14')](_0x31f8e7,_0x6549('0x1c'));_0x31f8e7[_0x6549('0x16')]=_0x6549('0x1d');return ami[_0x6549('0x18')](_0x31f8e7)[_0x6549('0x19')](function(_0x6ae00c){_0x19c4a6({'code':0xc8,'message':_0x6ae00c[_0x6549('0x1e')]});})[_0x6549('0x1f')](function(_0x23c0ba){_0xfca192(_0x1e5079['error'](0x1f5,_0x23c0ba[_0x6549('0x20')]));});});},'VoiceQueues':function(_0x1bc8db){return new Promise(function(_0x53bbca,_0x126967){var _0x29f89e=[];for(var _0x3768cb in _0x3750cc['voiceQueues']){if(_0x3750cc[_0x6549('0x21')][_0x6549('0x22')](_0x3768cb)){var _0x14de1f=_0x3750cc[_0x6549('0x21')][_0x3768cb];var _0x442862={'id':_0x14de1f['id'],'name':_0x14de1f[_0x6549('0xb')],'strategy':_0x14de1f[_0x6549('0x23')],'answered':_0x14de1f[_0x6549('0x24')],'available':_0x14de1f['available'],'loggedIn':_0x14de1f[_0x6549('0x25')],'pTalking':_0x14de1f[_0x6549('0x26')],'sumBillable':_0x14de1f[_0x6549('0x27')],'sumDuration':_0x14de1f['sumDuration'],'sumHoldTime':_0x14de1f[_0x6549('0x28')]||0x0,'talking':_0x14de1f['talking'],'total':_0x14de1f['total'],'type':_0x14de1f['type'],'unmanaged':_0x14de1f[_0x6549('0x29')],'abandoned':_0x14de1f[_0x6549('0x2a')],'waiting':_0x14de1f['waiting'],'loggedInDb':_0x14de1f[_0x6549('0x2b')]};if(_0x14de1f[_0x6549('0x2c')]===_0x6549('0x2d')){_0x442862[_0x6549('0x2e')]=_0x14de1f[_0x6549('0x2e')];_0x442862[_0x6549('0x2f')]=_0x14de1f[_0x6549('0x2f')];_0x442862['dialOriginateCallerIdName']=_0x14de1f[_0x6549('0x30')];_0x442862[_0x6549('0x31')]=_0x14de1f[_0x6549('0x31')];_0x442862[_0x6549('0x32')]=_0x14de1f[_0x6549('0x32')];_0x442862[_0x6549('0x33')]=_0x14de1f['dialPrefix'];_0x442862[_0x6549('0x34')]=_0x14de1f['temp'];_0x442862[_0x6549('0x35')]=_0x14de1f['outboundAnswerAgiCallsDay'];_0x442862[_0x6549('0x36')]=_0x14de1f[_0x6549('0x36')];_0x442862[_0x6549('0x37')]=_0x14de1f['outboundBlacklistCallsDay'];_0x442862[_0x6549('0x38')]=_0x14de1f[_0x6549('0x38')];_0x442862[_0x6549('0x39')]=_0x14de1f[_0x6549('0x39')];_0x442862['outboundDropCallsDayACS']=_0x14de1f['outboundDropCallsDayACS'];_0x442862['outboundDropCallsDayCallersExit']=_0x14de1f[_0x6549('0x3a')];_0x442862[_0x6549('0x3b')]=_0x14de1f['outboundDropCallsDayTimeout'];_0x442862[_0x6549('0x3c')]=_0x14de1f[_0x6549('0x3c')];_0x442862[_0x6549('0x3d')]=_0x14de1f[_0x6549('0x3d')];_0x442862[_0x6549('0x3e')]=_0x14de1f['outboundOriginateFailureCallsDay'];_0x442862['outboundReCallsDay']=_0x14de1f[_0x6549('0x3f')];_0x442862[_0x6549('0x40')]=_0x14de1f[_0x6549('0x40')];_0x442862[_0x6549('0x41')]=_0x14de1f[_0x6549('0x41')];_0x442862[_0x6549('0x42')]=_0x14de1f[_0x6549('0x42')];_0x442862[_0x6549('0x43')]=_0x14de1f[_0x6549('0x43')];_0x442862[_0x6549('0x44')]=_0x14de1f['predictiveIntervalAvgTalktime'];_0x442862[_0x6549('0x45')]=_0x14de1f[_0x6549('0x45')];_0x442862[_0x6549('0x46')]=_0x14de1f[_0x6549('0x46')];_0x442862[_0x6549('0x47')]=_0x14de1f['predictiveIntervalErlangCalls'];_0x442862['predictiveIntervalErlangCallsDroppedCalls']=_0x14de1f['predictiveIntervalErlangCallsDroppedCalls'];_0x442862[_0x6549('0x48')]=_0x14de1f[_0x6549('0x48')];_0x442862[_0x6549('0x49')]=_0x14de1f[_0x6549('0x49')];_0x442862['predictiveIntervalPauses']=_0x14de1f['predictiveIntervalPauses'];_0x442862[_0x6549('0x4a')]=_0x14de1f[_0x6549('0x4a')];_0x442862[_0x6549('0x4b')]=_0x14de1f['predictiveIntervalTotalCalls'];_0x442862[_0x6549('0x20')]=_0x14de1f['message'];_0x442862[_0x6549('0x4c')]=_0x14de1f[_0x6549('0x4c')];_0x442862[_0x6549('0x4d')]=_0x14de1f[_0x6549('0x4d')];_0x442862[_0x6549('0x4e')]=_0x14de1f[_0x6549('0x4e')];_0x442862[_0x6549('0x4f')]=_0x14de1f['erlangAbandonmentRate'];_0x442862[_0x6549('0x50')]=_0x14de1f[_0x6549('0x50')];_0x442862[_0x6549('0x51')]=_0x14de1f[_0x6549('0x51')];_0x442862[_0x6549('0x52')]=_0x14de1f[_0x6549('0x52')];}if(_0x14de1f[_0x6549('0x53')]){_0x442862[_0x6549('0x53')]={'id':_0x14de1f[_0x6549('0x53')]['id'],'name':_0x14de1f[_0x6549('0x53')][_0x6549('0xb')],'active':_0x14de1f[_0x6549('0x53')][_0x6549('0x54')],'callerid':_0x14de1f[_0x6549('0x53')][_0x6549('0x55')]};}if(_0x14de1f[_0x6549('0x56')]){_0x442862['Interval']={'id':_0x14de1f[_0x6549('0x56')]['id'],'name':_0x14de1f[_0x6549('0x56')][_0x6549('0xb')]};}_0x29f89e[_0x6549('0x57')](_0x442862);}}_0x53bbca({'count':_0x29f89e['length'],'rows':_0x29f89e});});},'UpdateVoiceQueue':function(_0x8f03dd){return new Promise(function(_0x483727,_0x14c90a){var _0x465fff=_['find'](_0x3750cc[_0x6549('0x21')],{'id':parseInt(_0x8f03dd['id'])});var _0x2503d5=_[_0x6549('0x58')](_0x8f03dd,['id']);if(_0x465fff){for(var _0x18a751 in _0x2503d5){if(typeof _0x2503d5[_0x18a751]!==_0x6549('0x59')&&typeof _0x465fff[_0x18a751]!=='undefined'){_0x465fff[_0x18a751]=_0x2503d5[_0x18a751];}}_0x483727(_0x465fff);}else{_0x14c90a();}});},'VoiceChannels':function(_0x4ce2d2){return new Promise(function(_0xa2acf5,_0x198eec){var _0x41d675=_[_0x6549('0x5a')](_0x3750cc[_0x6549('0x5b')]);_0xa2acf5({'count':_0x41d675['length'],'rows':_0x41d675});});},'VoiceChannelMixMonitor':function(_0x22370d){var _0x17e691=this;return new Promise(function(_0x1e4f4f,_0x6121af){if(ami[_0x6549('0x10')]()==![]){return _0x6121af(_0x17e691[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config[_0x6549('0x12')]['username'],_0x6549('0x1a')]['join']('\x20')));}var _0x2ed77c=schema(properties[_0x6549('0x5c')])[_0x6549('0x3')](_0x22370d);if(_0x2ed77c['length']>0x0){return _0x6121af(_0x17e691[_0x6549('0x11')](0x1f4,_[_0x6549('0x5d')](_0x2ed77c,_0x6549('0x20'))['join'](',\x20')));}var _0x19ac50=_[_0x6549('0x5e')](_0x3750cc[_0x6549('0x5b')],{'uniqueid':_0x22370d[_0x6549('0x5f')]});if(_0x19ac50&&_0x19ac50[_0x6549('0x60')]){var _0x402ae6=util['format'](_0x6549('0x61'),_0x22370d['filename']||_0x22370d[_0x6549('0x5f')],_0x22370d[_0x6549('0x8')]||_0x6549('0x62'));return ami[_0x6549('0x18')]({'action':_0x6549('0x63'),'channel':_0x19ac50[_0x6549('0x60')],'file':_0x402ae6,'options':_0x6549('0x64')})[_0x6549('0x19')](function(_0x1ff699){var _0x105e0c=_[_0x6549('0x5e')](_0x19ac50[_0x6549('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x402ae6[_0x6549('0x66')]()});if(_[_0x6549('0x67')](_0x105e0c)){_0x19ac50[_0x6549('0x65')][_0x6549('0x57')]({'filename':_0x6549('0x68')+_0x402ae6[_0x6549('0x66')](),'createdAt':moment()[_0x6549('0x8')](_0x6549('0x69')),'mixmonitorid':_0x1ff699['mixmonitorid'],'status':_0x6549('0x6a')});}else{_0x105e0c[_0x6549('0x6b')]=_0x1ff699[_0x6549('0x6b')];_0x105e0c[_0x6549('0x6c')]=_0x6549('0x6a');}_0x1e4f4f({'code':0xc8,'message':[_0x22370d[_0x6549('0x5f')],_0x6549('0x6d'),_0x1ff699[_0x6549('0x6b')]]['join']('\x20'),'mixmonitorid':_0x1ff699[_0x6549('0x6b')]});})[_0x6549('0x1f')](function(_0x32b336){_0x6121af(_0x17e691[_0x6549('0x11')](0x1f5,[_0x22370d[_0x6549('0x5f')],_0x32b336[_0x6549('0x20')]['toLowerCase']()][_0x6549('0x1b')]('\x20')));});}else{return _0x6121af(_0x17e691[_0x6549('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x38bce4){var _0x36a162=this;return new Promise(function(_0x2efad1,_0x557b52){if(ami[_0x6549('0x10')]()==![]){return _0x557b52(_0x36a162[_0x6549('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x6549('0x12')]['username'],_0x6549('0x1a')]['join']('\x20')));}var _0x119e07=schema(properties[_0x6549('0x5c')])[_0x6549('0x3')](_0x38bce4);if(_0x119e07[_0x6549('0x6e')]>0x0){return _0x557b52(_0x36a162[_0x6549('0x11')](0x1f4,_[_0x6549('0x5d')](_0x119e07,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0xed105a=_[_0x6549('0x5e')](_0x3750cc[_0x6549('0x5b')],{'uniqueid':_0x38bce4[_0x6549('0x5f')]});if(_0xed105a){return BPromise[_0x6549('0x6f')]()[_0x6549('0x19')](function(){if(_0xed105a['channel']){return ami[_0x6549('0x18')]({'action':_0x6549('0x70'),'channel':_0xed105a['channel'],'mixmonitorid':_0x38bce4[_0x6549('0x6b')]})[_0x6549('0x1f')](function(_0x146d02){});}})[_0x6549('0x19')](function(){if(_0xed105a['destinationchannel']){return ami[_0x6549('0x18')]({'action':_0x6549('0x70'),'channel':_0xed105a[_0x6549('0x71')],'mixmonitorid':_0x38bce4[_0x6549('0x6b')]})['catch'](function(_0x395039){});}})['then'](function(_0xbe3fcb){var _0x16dc29=_[_0x6549('0x5e')](_0xed105a[_0x6549('0x65')],{'mixmonitorid':_0x38bce4[_0x6549('0x6b')]});if(_0x16dc29){_0x16dc29[_0x6549('0x6c')]=_0x6549('0x72');}})[_0x6549('0x19')](function(){var _0x36504c=util[_0x6549('0x8')]('%s.%s',_0x38bce4[_0x6549('0x73')]||_0x38bce4[_0x6549('0x5f')],_0x38bce4[_0x6549('0x8')]||_0x6549('0x62'));var _0x21f408=_[_0x6549('0x5e')](_0xed105a['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x36504c[_0x6549('0x66')]()});if(_0x21f408){_0x21f408[_0x6549('0x6c')]=_0x6549('0x72');}})['then'](function(){_0x2efad1({'code':0xc8,'message':[_0x38bce4[_0x6549('0x5f')],_0x6549('0x74')]['join']('\x20')});})[_0x6549('0x1f')](function(_0x3865cd){_0x557b52(_0x36a162[_0x6549('0x11')](0x1f5,[_0x38bce4[_0x6549('0x5f')],_0x3865cd[_0x6549('0x20')][_0x6549('0x66')]()][_0x6549('0x1b')]('\x20')));});}else{return _0x557b52(_0x36a162[_0x6549('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x43c667){return new Promise(function(_0x51916f,_0x23e42b){var _0x44b5f1=_['values'](_0x3750cc[_0x6549('0x75')]);_0x51916f({'count':_0x44b5f1[_0x6549('0x6e')],'rows':_0x44b5f1});});},'VoiceQueuesChannel':function(_0x2e6b4b){var _0x5f3873=this;return new Promise(function(_0xaf4ef3,_0x755ff1){var _0x19da5a=schema(properties[_0x6549('0x76')])[_0x6549('0x3')](_0x2e6b4b);if(_0x19da5a[_0x6549('0x6e')]>0x0){return _0x755ff1(_0x5f3873['error'](0x1f4,_[_0x6549('0x5d')](_0x19da5a,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0x5a996c=_['find'](_0x3750cc['queueChannels'],{'uniqueid':_0x2e6b4b[_0x6549('0x5f')]});if(_0x5a996c){_0xaf4ef3(_0x5a996c);}else{return _0x755ff1(_0x5f3873[_0x6549('0x11')](0x1f5,_0x6549('0x77')));}});},'VoiceQueuesChannelHangup':function(_0x4d3103){var _0x5255e1=this;return new Promise(function(_0x1458a3,_0x4f941b){if(ami[_0x6549('0x10')]()==![]){return _0x4f941b(_0x5255e1[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config[_0x6549('0x12')][_0x6549('0x13')],_0x6549('0x1a')][_0x6549('0x1b')]('\x20')));}var _0x5dcc26=schema(properties[_0x6549('0x78')])[_0x6549('0x3')](_0x4d3103);if(_0x5dcc26[_0x6549('0x6e')]>0x0){return _0x4f941b(_0x5255e1['error'](0x1f4,_[_0x6549('0x5d')](_0x5dcc26,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0x16a15f=_[_0x6549('0x5e')](_0x3750cc[_0x6549('0x75')],{'uniqueid':_0x4d3103[_0x6549('0x5f')]});if(_0x16a15f&&_0x16a15f['channel']){return ami[_0x6549('0x18')]({'action':'Hangup','channel':_0x16a15f[_0x6549('0x60')]})[_0x6549('0x19')](function(_0x20a273){_0x1458a3({'code':0xc8,'message':[_0x4d3103[_0x6549('0x5f')],_0x20a273[_0x6549('0x20')][_0x6549('0x66')]()][_0x6549('0x1b')]('\x20')});})[_0x6549('0x1f')](function(_0x4d72ae){_0x4f941b(_0x5255e1[_0x6549('0x11')](0x1f5,[_0x4d3103[_0x6549('0x5f')],_0x4d72ae[_0x6549('0x20')][_0x6549('0x66')]()][_0x6549('0x1b')]('\x20')));});}else{return _0x4f941b(_0x5255e1[_0x6549('0x11')](0x1f5,_0x6549('0x77')));}});},'VoiceQueuesChannelRedirect':function(_0x202b41){var _0x824a23=this;return new Promise(function(_0x1b5648,_0x51f479){if(ami[_0x6549('0x10')]()==![]){return _0x51f479(_0x824a23[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config[_0x6549('0x12')][_0x6549('0x13')],_0x6549('0x1a')][_0x6549('0x1b')]('\x20')));}var _0x463ab1=schema(properties[_0x6549('0x79')])[_0x6549('0x3')](_0x202b41);if(_0x463ab1[_0x6549('0x6e')]>0x0){return _0x51f479(_0x824a23[_0x6549('0x11')](0x1f4,_[_0x6549('0x5d')](_0x463ab1,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0x14fb53=_[_0x6549('0x5e')](_0x3750cc[_0x6549('0x75')],{'uniqueid':_0x202b41['uniqueid']});if(_0x14fb53&&_0x14fb53[_0x6549('0x60')]){return ami[_0x6549('0x18')]({'action':_0x6549('0x7a'),'channel':_0x14fb53[_0x6549('0x60')],'exten':_0x202b41[_0x6549('0x7b')],'context':_0x202b41[_0x6549('0x7c')]||_0x14fb53[_0x6549('0x7c')],'priority':0x1})[_0x6549('0x19')](function(_0x21e551){_0x1b5648({'code':0xc8,'message':[_0x202b41[_0x6549('0x5f')],_0x21e551[_0x6549('0x20')][_0x6549('0x66')]()][_0x6549('0x1b')]('\x20')});})[_0x6549('0x1f')](function(_0x38df70){_0x51f479(_0x824a23[_0x6549('0x11')](0x1f5,[_0x202b41[_0x6549('0x5f')],_0x38df70['message'][_0x6549('0x66')]()][_0x6549('0x1b')]('\x20')));});}else{return _0x51f479(_0x824a23[_0x6549('0x11')](0x1f5,_0x6549('0x77')));}});},'Agents':function(_0x8073a7){return new Promise(function(_0x42a47f,_0x3206e8){var _0x51665b=_[_0x6549('0x5a')](_0x3750cc['agents']);_0x42a47f({'count':_0x51665b['length'],'rows':_0x51665b});});},'Telephones':function(_0x3d0d09){return new Promise(function(_0x4ebaf9,_0x3e8de9){var _0x1f3230=_[_0x6549('0x5a')](_0x3750cc[_0x6549('0x7d')]);_0x4ebaf9({'count':_0x1f3230[_0x6549('0x6e')],'rows':_0x1f3230});});},'Trunks':function(_0x5ac35c){return new Promise(function(_0x352182,_0x51253c){var _0xbaf80d=_[_0x6549('0x5a')](_0x3750cc[_0x6549('0x7e')]);_0x352182({'count':_0xbaf80d['length'],'rows':_0xbaf80d});});},'OutboundChannels':function(_0x32ed83){return new Promise(function(_0x2e013e,_0x5976ca){var _0x580c50=_[_0x6549('0x5a')](_0x3750cc[_0x6549('0x7f')]);_0x2e013e({'count':_0x580c50[_0x6549('0x6e')],'rows':_0x580c50});});},'Outbound':function(_0x22c9f1){return new Promise(function(_0x1138d4,_0x1f5263){_0x1138d4(_0x3750cc[_0x6549('0x2d')]);});},'Campaigns':function(_0x13242b){return new Promise(function(_0x2fafb0,_0x24d4ca){var _0x28ec97=_[_0x6549('0x5a')](_0x3750cc[_0x6549('0x80')]);_0x2fafb0({'count':_0x28ec97[_0x6549('0x6e')],'rows':_0x28ec97});});},'VoiceQueuesPreview':function(_0x159467){var _0x25a080=this;return new Promise(function(_0x1e8c92,_0x3cf7b1){_0x4d0473[_0x6549('0x81')](_0x159467['id'])['then'](function(_0x5b8b88){_0x1e8c92({'code':0xc8,'message':_0x5b8b88[_0x6549('0x20')]});})[_0x6549('0x1f')](function(_0x4d3266){_0x3cf7b1(_0x25a080[_0x6549('0x11')](0x1f4,_0x4d3266[_0x6549('0x20')]));});});},'EventManager':function(_0x171e14){var _0x63496d=this;return new Promise(function(_0x2dd15c,_0x3dee4f){if(!_0x171e14[_0x6549('0x82')]){return _0x3dee4f(_0x63496d['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x6549('0x83')+_0x171e14[_0x6549('0x82')],_0x171e14[_0x6549('0x20')]);_0x2dd15c({'code':0xc8,'message':_0x171e14});});},'FaxAccounts':function(_0xc84cdb){return new Promise(function(_0x7a1c77,_0x570f56){var _0x100c37=_[_0x6549('0x5a')](_0x3750cc[_0x6549('0x84')]);_0x7a1c77({'count':_0x100c37[_0x6549('0x6e')],'rows':_0x100c37});});},'SendFax':function(_0x230874){var _0x3be369=this;return new Promise(function(_0xaf1a80,_0x1dd688){_0x5a4658[_0x6549('0x85')](_0x230874)[_0x6549('0x19')](function(_0x31e41a){_0xaf1a80({'code':0xc8,'message':_0x31e41a['message']});})[_0x6549('0x1f')](function(_0x43708a){_0x1dd688(_0x3be369[_0x6549('0x11')](0x1f4,_0x43708a[_0x6549('0x20')]));});});},'CheckAfterSend':function(_0x585cad){var _0x158c92=this;return new Promise(function(_0x433386,_0x1dbcc4){_0x5a4658[_0x6549('0x86')](_0x585cad)[_0x6549('0x19')](function(_0x23013a){_0x433386({'code':0xc8,'message':_0x23013a[_0x6549('0x20')]});})[_0x6549('0x1f')](function(_0x3c48f1){_0x1dbcc4(_0x158c92['error'](0x1f4,_0x3c48f1[_0x6549('0x20')]));});});}};var _0x3264f4=jayson[_0x6549('0x87')](_0x4fcffd)[_0x6549('0x88')]();_0x3264f4['on']('error',function(_0x5a86d1){return _0x1d8cea(_0x5a86d1);});_0x3264f4['listen'](0x232a,_0x6549('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x43cb17(_0x6549('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x7ee1=['emit','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','bluebird','moment','../../../config/environment','../ami','listen','format','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','module','action','Reload','Action','then','message','ami\x20disconnected','join','pick','command','Command','voiceQueues','hasOwnProperty','name','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','validate','map','uniqueid','channel','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','catch','toLowerCase','resolve','StopMixMonitor','destinationchannel','stop','wav','/var/spool/asterisk/monitor/','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ee1,0x8d));var _0x17ee=function(_0x489d29,_0x44a00f){_0x489d29=_0x489d29-0x0;var _0x39156d=_0x7ee1[_0x489d29];return _0x39156d;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x17ee('0x1'));var moment=require(_0x17ee('0x2'));var config=require(_0x17ee('0x3'));var properties=require('../properties');var ami=require(_0x17ee('0x4'));exports[_0x17ee('0x5')]=function(_0x10f7a8,_0x2f9ebc,_0x5c0617){return new BPromise(function(_0x52b1db,_0x29b9eb){var _0x54b4f6={'QueuePause':function(_0x3f61af){return new Promise(function(_0x57e1d1,_0x3d767b){var _0xfa5096=util[_0x17ee('0x6')]('%s/%s','SIP',_0x3f61af['name']);if(_0x10f7a8[_0x17ee('0x7')]&&_0x10f7a8['timers'][_0xfa5096]&&_0x10f7a8[_0x17ee('0x7')][_0xfa5096][_0x17ee('0x8')]){_0x10f7a8[_0x17ee('0x7')][_0xfa5096][_0x17ee('0x9')]();}if(_0x10f7a8['agents'][_0xfa5096]){_0x10f7a8[_0x17ee('0xa')][_0xfa5096]['updateStatusRealtime']({'statePause':_0x3f61af[_0x17ee('0xb')]?!![]:![]});}_0x57e1d1({'code':0xc8,'message':_0x17ee('0xc')});});},'Reload':function(_0x358514){var _0xe75682=this;return new Promise(function(_0x308ec7,_0xca5e20){if(ami[_0x17ee('0xd')]()==![]){return _0xca5e20(_0xe75682[_0x17ee('0xe')](0x1f4,[config[_0x17ee('0xf')]['ip'],config[_0x17ee('0xf')][_0x17ee('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x358514=_['pick'](_0x358514,_['keys'](properties[_0x17ee('0x11')]));_0x358514[_0x17ee('0x12')]=_0x17ee('0x13');return ami[_0x17ee('0x14')](_0x358514)[_0x17ee('0x15')](function(_0x236d18){_0x308ec7({'code':0xc8,'message':_0x236d18[_0x17ee('0x16')]});})['catch'](function(_0x44fe58){_0xca5e20(_0xe75682[_0x17ee('0xe')](0x1f5,_0x44fe58[_0x17ee('0x16')]));});});},'Command':function(_0x11ca6b){var _0x31c0bd=this;return new Promise(function(_0x57925d,_0x393720){if(ami['isConnected']()==![]){return _0x393720(_0x31c0bd[_0x17ee('0xe')](0x1f4,[config['asterisk']['ip'],config[_0x17ee('0xf')][_0x17ee('0x10')],_0x17ee('0x17')][_0x17ee('0x18')]('\x20')));}_0x11ca6b=_[_0x17ee('0x19')](_0x11ca6b,_0x17ee('0x1a'));_0x11ca6b[_0x17ee('0x12')]=_0x17ee('0x1b');return ami[_0x17ee('0x14')](_0x11ca6b)[_0x17ee('0x15')](function(_0x37fe4e){_0x57925d({'code':0xc8,'message':_0x37fe4e['content']});})['catch'](function(_0x2118a6){_0x393720(_0x31c0bd[_0x17ee('0xe')](0x1f5,_0x2118a6[_0x17ee('0x16')]));});});},'VoiceQueues':function(_0x9b379d){return new Promise(function(_0x3bbddf,_0xea358f){var _0x2f6e84=[];for(var _0x1d8aa2 in _0x10f7a8[_0x17ee('0x1c')]){if(_0x10f7a8[_0x17ee('0x1c')][_0x17ee('0x1d')](_0x1d8aa2)){var _0x2a332f=_0x10f7a8['voiceQueues'][_0x1d8aa2];var _0x3634c9={'id':_0x2a332f['id'],'name':_0x2a332f[_0x17ee('0x1e')],'strategy':_0x2a332f[_0x17ee('0x1f')],'answered':_0x2a332f[_0x17ee('0x20')],'available':_0x2a332f[_0x17ee('0x21')],'loggedIn':_0x2a332f['loggedIn'],'pTalking':_0x2a332f[_0x17ee('0x22')],'sumBillable':_0x2a332f[_0x17ee('0x23')],'sumDuration':_0x2a332f[_0x17ee('0x24')],'sumHoldTime':_0x2a332f['sumHoldTime']||0x0,'talking':_0x2a332f[_0x17ee('0x25')],'total':_0x2a332f[_0x17ee('0x26')],'type':_0x2a332f['type'],'unmanaged':_0x2a332f[_0x17ee('0x27')],'abandoned':_0x2a332f['abandoned'],'waiting':_0x2a332f[_0x17ee('0x28')],'loggedInDb':_0x2a332f['loggedInDb']};if(_0x2a332f[_0x17ee('0x29')]===_0x17ee('0x2a')){_0x3634c9[_0x17ee('0x2b')]=_0x2a332f['dialActive'];_0x3634c9[_0x17ee('0x2c')]=_0x2a332f[_0x17ee('0x2c')];_0x3634c9['dialOriginateCallerIdName']=_0x2a332f[_0x17ee('0x2d')];_0x3634c9[_0x17ee('0x2e')]=_0x2a332f[_0x17ee('0x2e')];_0x3634c9['dialOriginateTimeout']=_0x2a332f['dialOriginateTimeout'];_0x3634c9[_0x17ee('0x2f')]=_0x2a332f[_0x17ee('0x2f')];_0x3634c9[_0x17ee('0x30')]=_0x2a332f[_0x17ee('0x30')];_0x3634c9['outboundAnswerAgiCallsDay']=_0x2a332f['outboundAnswerAgiCallsDay'];_0x3634c9[_0x17ee('0x31')]=_0x2a332f[_0x17ee('0x31')];_0x3634c9[_0x17ee('0x32')]=_0x2a332f[_0x17ee('0x32')];_0x3634c9[_0x17ee('0x33')]=_0x2a332f[_0x17ee('0x33')];_0x3634c9[_0x17ee('0x34')]=_0x2a332f['outboundCongestionCallsDay'];_0x3634c9['outboundDropCallsDayACS']=_0x2a332f['outboundDropCallsDayACS'];_0x3634c9[_0x17ee('0x35')]=_0x2a332f['outboundDropCallsDayCallersExit'];_0x3634c9[_0x17ee('0x36')]=_0x2a332f[_0x17ee('0x36')];_0x3634c9[_0x17ee('0x37')]=_0x2a332f['outboundNoAnswerCallsDay'];_0x3634c9[_0x17ee('0x38')]=_0x2a332f[_0x17ee('0x38')];_0x3634c9['outboundOriginateFailureCallsDay']=_0x2a332f['outboundOriginateFailureCallsDay'];_0x3634c9[_0x17ee('0x39')]=_0x2a332f[_0x17ee('0x39')];_0x3634c9[_0x17ee('0x3a')]=_0x2a332f[_0x17ee('0x3a')];_0x3634c9[_0x17ee('0x3b')]=_0x2a332f['outboundUnknownCallsDay'];_0x3634c9['predictiveIntervalAnsweredCalls']=_0x2a332f[_0x17ee('0x3c')];_0x3634c9[_0x17ee('0x3d')]=_0x2a332f[_0x17ee('0x3d')];_0x3634c9[_0x17ee('0x3e')]=_0x2a332f[_0x17ee('0x3e')];_0x3634c9[_0x17ee('0x3f')]=_0x2a332f['predictiveIntervalDroppedCallsCallersExit'];_0x3634c9['predictiveIntervalDroppedCallsTimeout']=_0x2a332f[_0x17ee('0x40')];_0x3634c9[_0x17ee('0x41')]=_0x2a332f[_0x17ee('0x41')];_0x3634c9[_0x17ee('0x42')]=_0x2a332f[_0x17ee('0x42')];_0x3634c9[_0x17ee('0x43')]=_0x2a332f[_0x17ee('0x43')];_0x3634c9[_0x17ee('0x44')]=_0x2a332f[_0x17ee('0x44')];_0x3634c9[_0x17ee('0x45')]=_0x2a332f['predictiveIntervalPauses'];_0x3634c9['predictiveIntervalAvailable']=_0x2a332f['predictiveIntervalAvailable'];_0x3634c9[_0x17ee('0x46')]=_0x2a332f[_0x17ee('0x46')];_0x3634c9[_0x17ee('0x16')]=_0x2a332f[_0x17ee('0x16')];_0x3634c9['originated']=_0x2a332f[_0x17ee('0x47')];_0x3634c9[_0x17ee('0x48')]=_0x2a332f[_0x17ee('0x48')];_0x3634c9[_0x17ee('0x49')]=_0x2a332f['erlangCallToSecond'];_0x3634c9[_0x17ee('0x4a')]=_0x2a332f[_0x17ee('0x4a')];_0x3634c9[_0x17ee('0x4b')]=_0x2a332f[_0x17ee('0x4b')];_0x3634c9[_0x17ee('0x4c')]=_0x2a332f[_0x17ee('0x4c')];_0x3634c9[_0x17ee('0x4d')]=_0x2a332f[_0x17ee('0x4d')];}if(_0x2a332f['Trunk']){_0x3634c9[_0x17ee('0x4e')]={'id':_0x2a332f[_0x17ee('0x4e')]['id'],'name':_0x2a332f[_0x17ee('0x4e')][_0x17ee('0x1e')],'active':_0x2a332f[_0x17ee('0x4e')][_0x17ee('0x4f')],'callerid':_0x2a332f[_0x17ee('0x4e')][_0x17ee('0x50')]};}if(_0x2a332f[_0x17ee('0x51')]){_0x3634c9[_0x17ee('0x51')]={'id':_0x2a332f[_0x17ee('0x51')]['id'],'name':_0x2a332f[_0x17ee('0x51')]['name']};}_0x2f6e84[_0x17ee('0x52')](_0x3634c9);}}_0x3bbddf({'count':_0x2f6e84[_0x17ee('0x53')],'rows':_0x2f6e84});});},'UpdateVoiceQueue':function(_0x578510){return new Promise(function(_0x5e3c93,_0x53a24e){var _0x329d42=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x1c')],{'id':parseInt(_0x578510['id'])});var _0x45aa19=_[_0x17ee('0x55')](_0x578510,['id']);if(_0x329d42){for(var _0x5b394b in _0x45aa19){if(typeof _0x45aa19[_0x5b394b]!==_0x17ee('0x56')&&typeof _0x329d42[_0x5b394b]!==_0x17ee('0x56')){_0x329d42[_0x5b394b]=_0x45aa19[_0x5b394b];}}_0x5e3c93(_0x329d42);}else{_0x53a24e();}});},'VoiceChannels':function(_0x2a6b24){return new Promise(function(_0x3a0ef8,_0x93c5fd){var _0x243ba7=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x58')]);_0x3a0ef8({'count':_0x243ba7[_0x17ee('0x53')],'rows':_0x243ba7});});},'VoiceChannelMixMonitor':function(_0x26d086){var _0x3f0ade=this;return new Promise(function(_0xc369f6,_0x4a99bf){if(ami['isConnected']()==![]){return _0x4a99bf(_0x3f0ade[_0x17ee('0xe')](0x1f4,[config[_0x17ee('0xf')]['ip'],config['asterisk']['username'],_0x17ee('0x17')]['join']('\x20')));}var _0x10a542=schema(properties[_0x17ee('0x59')])[_0x17ee('0x5a')](_0x26d086);if(_0x10a542[_0x17ee('0x53')]>0x0){return _0x4a99bf(_0x3f0ade[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x10a542,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x75e94a=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x58')],{'uniqueid':_0x26d086[_0x17ee('0x5c')]});if(_0x75e94a&&_0x75e94a[_0x17ee('0x5d')]){var _0x5be66b=util[_0x17ee('0x6')](_0x17ee('0x5e'),_0x26d086['filename']||_0x26d086[_0x17ee('0x5c')],_0x26d086[_0x17ee('0x6')]||'wav');return ami[_0x17ee('0x14')]({'action':_0x17ee('0x5f'),'channel':_0x75e94a[_0x17ee('0x5d')],'file':_0x5be66b,'options':_0x17ee('0x60')})[_0x17ee('0x15')](function(_0x10a021){var _0x2c2df5=_['find'](_0x75e94a[_0x17ee('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x5be66b['toLowerCase']()});if(_[_0x17ee('0x62')](_0x2c2df5)){_0x75e94a[_0x17ee('0x61')][_0x17ee('0x52')]({'filename':'/var/spool/asterisk/monitor/'+_0x5be66b['toLowerCase'](),'createdAt':moment()[_0x17ee('0x6')](_0x17ee('0x63')),'mixmonitorid':_0x10a021[_0x17ee('0x64')],'status':_0x17ee('0x65')});}else{_0x2c2df5[_0x17ee('0x64')]=_0x10a021[_0x17ee('0x64')];_0x2c2df5[_0x17ee('0x66')]=_0x17ee('0x65');}_0xc369f6({'code':0xc8,'message':[_0x26d086['uniqueid'],_0x17ee('0x67'),_0x10a021[_0x17ee('0x64')]]['join']('\x20'),'mixmonitorid':_0x10a021['mixmonitorid']});})[_0x17ee('0x68')](function(_0x2ff762){_0x4a99bf(_0x3f0ade['error'](0x1f5,[_0x26d086['uniqueid'],_0x2ff762['message'][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x4a99bf(_0x3f0ade[_0x17ee('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3b5284){var _0x408b60=this;return new Promise(function(_0x407317,_0x289548){if(ami['isConnected']()==![]){return _0x289548(_0x408b60[_0x17ee('0xe')](0x1f4,[config[_0x17ee('0xf')]['ip'],config['asterisk'][_0x17ee('0x10')],_0x17ee('0x17')][_0x17ee('0x18')]('\x20')));}var _0x2d3252=schema(properties[_0x17ee('0x59')])[_0x17ee('0x5a')](_0x3b5284);if(_0x2d3252[_0x17ee('0x53')]>0x0){return _0x289548(_0x408b60[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x2d3252,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x4db694=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x58')],{'uniqueid':_0x3b5284['uniqueid']});if(_0x4db694){return BPromise[_0x17ee('0x6a')]()[_0x17ee('0x15')](function(){if(_0x4db694[_0x17ee('0x5d')]){return ami['Action']({'action':_0x17ee('0x6b'),'channel':_0x4db694[_0x17ee('0x5d')],'mixmonitorid':_0x3b5284[_0x17ee('0x64')]})[_0x17ee('0x68')](function(_0x4aab2a){});}})[_0x17ee('0x15')](function(){if(_0x4db694[_0x17ee('0x6c')]){return ami['Action']({'action':_0x17ee('0x6b'),'channel':_0x4db694[_0x17ee('0x6c')],'mixmonitorid':_0x3b5284[_0x17ee('0x64')]})[_0x17ee('0x68')](function(_0x25b8d5){});}})[_0x17ee('0x15')](function(_0x541dc0){var _0xeabfa=_[_0x17ee('0x54')](_0x4db694[_0x17ee('0x61')],{'mixmonitorid':_0x3b5284[_0x17ee('0x64')]});if(_0xeabfa){_0xeabfa['status']=_0x17ee('0x6d');}})['then'](function(){var _0x420eee=util[_0x17ee('0x6')](_0x17ee('0x5e'),_0x3b5284['filename']||_0x3b5284['uniqueid'],_0x3b5284[_0x17ee('0x6')]||_0x17ee('0x6e'));var _0x1ee84b=_[_0x17ee('0x54')](_0x4db694['monitors'],{'filename':_0x17ee('0x6f')+_0x420eee['toLowerCase']()});if(_0x1ee84b){_0x1ee84b['status']=_0x17ee('0x6d');}})[_0x17ee('0x15')](function(){_0x407317({'code':0xc8,'message':[_0x3b5284['uniqueid'],'StopMixMonitor\x20Success'][_0x17ee('0x18')]('\x20')});})[_0x17ee('0x68')](function(_0x51a02e){_0x289548(_0x408b60[_0x17ee('0xe')](0x1f5,[_0x3b5284[_0x17ee('0x5c')],_0x51a02e[_0x17ee('0x16')][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x289548(_0x408b60[_0x17ee('0xe')](0x1f5,_0x17ee('0x70')));}});},'VoiceQueuesChannels':function(_0x504467){return new Promise(function(_0x1ac252,_0x273ffa){var _0x22e4b9=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x71')]);_0x1ac252({'count':_0x22e4b9[_0x17ee('0x53')],'rows':_0x22e4b9});});},'VoiceQueuesChannel':function(_0x278dff){var _0x44a5f3=this;return new Promise(function(_0x1dbfb0,_0x9ff7a5){var _0x22f9ee=schema(properties['voicequeuechannel'])[_0x17ee('0x5a')](_0x278dff);if(_0x22f9ee[_0x17ee('0x53')]>0x0){return _0x9ff7a5(_0x44a5f3[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x22f9ee,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x4c3af8=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x71')],{'uniqueid':_0x278dff['uniqueid']});if(_0x4c3af8){_0x1dbfb0(_0x4c3af8);}else{return _0x9ff7a5(_0x44a5f3[_0x17ee('0xe')](0x1f5,_0x17ee('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x22ef0a){var _0x28c88f=this;return new Promise(function(_0xf0ddbf,_0x650ba4){if(ami['isConnected']()==![]){return _0x650ba4(_0x28c88f['error'](0x1f4,[config[_0x17ee('0xf')]['ip'],config['asterisk'][_0x17ee('0x10')],_0x17ee('0x17')]['join']('\x20')));}var _0x518cba=schema(properties[_0x17ee('0x72')])[_0x17ee('0x5a')](_0x22ef0a);if(_0x518cba[_0x17ee('0x53')]>0x0){return _0x650ba4(_0x28c88f['error'](0x1f4,_[_0x17ee('0x5b')](_0x518cba,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x45d316=_['find'](_0x10f7a8[_0x17ee('0x71')],{'uniqueid':_0x22ef0a[_0x17ee('0x5c')]});if(_0x45d316&&_0x45d316[_0x17ee('0x5d')]){return ami[_0x17ee('0x14')]({'action':_0x17ee('0x73'),'channel':_0x45d316[_0x17ee('0x5d')]})[_0x17ee('0x15')](function(_0x466ca3){_0xf0ddbf({'code':0xc8,'message':[_0x22ef0a[_0x17ee('0x5c')],_0x466ca3[_0x17ee('0x16')][_0x17ee('0x69')]()]['join']('\x20')});})[_0x17ee('0x68')](function(_0x98eabf){_0x650ba4(_0x28c88f[_0x17ee('0xe')](0x1f5,[_0x22ef0a[_0x17ee('0x5c')],_0x98eabf[_0x17ee('0x16')][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x650ba4(_0x28c88f['error'](0x1f5,_0x17ee('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x4157b8){var _0x2f08e0=this;return new Promise(function(_0x45b67c,_0x212fdf){if(ami[_0x17ee('0xd')]()==![]){return _0x212fdf(_0x2f08e0['error'](0x1f4,[config[_0x17ee('0xf')]['ip'],config[_0x17ee('0xf')][_0x17ee('0x10')],_0x17ee('0x17')][_0x17ee('0x18')]('\x20')));}var _0x3b8188=schema(properties['voicequeuechannelredirect'])[_0x17ee('0x5a')](_0x4157b8);if(_0x3b8188[_0x17ee('0x53')]>0x0){return _0x212fdf(_0x2f08e0[_0x17ee('0xe')](0x1f4,_[_0x17ee('0x5b')](_0x3b8188,_0x17ee('0x16'))[_0x17ee('0x18')](',\x20')));}var _0x3461e0=_[_0x17ee('0x54')](_0x10f7a8[_0x17ee('0x71')],{'uniqueid':_0x4157b8[_0x17ee('0x5c')]});if(_0x3461e0&&_0x3461e0[_0x17ee('0x5d')]){return ami[_0x17ee('0x14')]({'action':'Redirect','channel':_0x3461e0[_0x17ee('0x5d')],'exten':_0x4157b8[_0x17ee('0x74')],'context':_0x4157b8['context']||_0x3461e0[_0x17ee('0x75')],'priority':0x1})[_0x17ee('0x15')](function(_0x2e7317){_0x45b67c({'code':0xc8,'message':[_0x4157b8['uniqueid'],_0x2e7317[_0x17ee('0x16')][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')});})[_0x17ee('0x68')](function(_0x1012b6){_0x212fdf(_0x2f08e0[_0x17ee('0xe')](0x1f5,[_0x4157b8[_0x17ee('0x5c')],_0x1012b6['message'][_0x17ee('0x69')]()][_0x17ee('0x18')]('\x20')));});}else{return _0x212fdf(_0x2f08e0[_0x17ee('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x40e04b){return new Promise(function(_0x188da2,_0x112351){var _0x2bbff6=_[_0x17ee('0x57')](_0x10f7a8['agents']);_0x188da2({'count':_0x2bbff6[_0x17ee('0x53')],'rows':_0x2bbff6});});},'Telephones':function(_0x572a43){return new Promise(function(_0xb1758c,_0xeeb388){var _0x3571a8=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x76')]);_0xb1758c({'count':_0x3571a8[_0x17ee('0x53')],'rows':_0x3571a8});});},'Trunks':function(_0x26ef1f){return new Promise(function(_0x550427,_0x65ecdb){var _0x3b9a31=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x77')]);_0x550427({'count':_0x3b9a31[_0x17ee('0x53')],'rows':_0x3b9a31});});},'OutboundChannels':function(_0x520872){return new Promise(function(_0x3e4786,_0x33b399){var _0x509613=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x78')]);_0x3e4786({'count':_0x509613[_0x17ee('0x53')],'rows':_0x509613});});},'Outbound':function(_0xf55cbb){return new Promise(function(_0x564a2e,_0x4c1d3f){_0x564a2e(_0x10f7a8['outbound']);});},'Campaigns':function(_0x22faec){return new Promise(function(_0x23f84c,_0x3da8cd){var _0x75bf67=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x79')]);_0x23f84c({'count':_0x75bf67['length'],'rows':_0x75bf67});});},'VoiceQueuesPreview':function(_0x2ed610){var _0x24793f=this;return new Promise(function(_0x8706cc,_0x1bd6cb){_0x2f9ebc[_0x17ee('0x7a')](_0x2ed610['id'])[_0x17ee('0x15')](function(_0x3bfa6d){_0x8706cc({'code':0xc8,'message':_0x3bfa6d[_0x17ee('0x16')]});})[_0x17ee('0x68')](function(_0x5b7387){_0x1bd6cb(_0x24793f[_0x17ee('0xe')](0x1f4,_0x5b7387[_0x17ee('0x16')]));});});},'EventManager':function(_0x39220a){var _0x52ef66=this;return new Promise(function(_0x50a81c,_0x1b57d4){if(!_0x39220a[_0x17ee('0x7b')]){return _0x1b57d4(_0x52ef66[_0x17ee('0xe')](0x1f4,_0x17ee('0x7c')));}ami[_0x17ee('0x7d')]('custom:'+_0x39220a[_0x17ee('0x7b')],_0x39220a[_0x17ee('0x16')]);_0x50a81c({'code':0xc8,'message':_0x39220a});});},'FaxAccounts':function(_0x1cdc32){return new Promise(function(_0x2e6906,_0x633b58){var _0x2bdf47=_[_0x17ee('0x57')](_0x10f7a8[_0x17ee('0x7e')]);_0x2e6906({'count':_0x2bdf47[_0x17ee('0x53')],'rows':_0x2bdf47});});},'SendFax':function(_0x4a95de){var _0x350fd5=this;return new Promise(function(_0x50daad,_0x3801b6){_0x5c0617[_0x17ee('0x7f')](_0x4a95de)['then'](function(_0x910850){_0x50daad({'code':0xc8,'message':_0x910850[_0x17ee('0x16')]});})['catch'](function(_0x2aaae6){_0x3801b6(_0x350fd5['error'](0x1f4,_0x2aaae6[_0x17ee('0x16')]));});});},'CheckAfterSend':function(_0x27dc3e){var _0x2e708b=this;return new Promise(function(_0xe069b0,_0x4cbb59){_0x5c0617[_0x17ee('0x80')](_0x27dc3e)[_0x17ee('0x15')](function(_0x36be47){_0xe069b0({'code':0xc8,'message':_0x36be47['message']});})[_0x17ee('0x68')](function(_0x5a4664){_0x4cbb59(_0x2e708b[_0x17ee('0xe')](0x1f4,_0x5a4664[_0x17ee('0x16')]));});});}};var _0xe749d7=jayson[_0x17ee('0x81')](_0x54b4f6)['http']();_0xe749d7['on'](_0x17ee('0xe'),function(_0x405dc5){return _0x29b9eb(_0x405dc5);});_0xe749d7[_0x17ee('0x5')](0x232a,_0x17ee('0x82'),function(){console[_0x17ee('0x83')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x52b1db(_0x17ee('0x84')+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 2a156a8..946216f 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 _0xedd9=['data3','phone','$or','map','routeId','destcalleridnum','lastName','scheduledAt','union','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridnum','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','user:%s','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','data1','data2','data5','xmd-contactid','ListId'];(function(_0x195f13,_0x443a61){var _0x1010fa=function(_0x327cb1){while(--_0x327cb1){_0x195f13['push'](_0x195f13['shift']());}};_0x1010fa(++_0x443a61);}(_0xedd9,0xfc));var _0x9edd=function(_0x349a1b,_0x261d61){_0x349a1b=_0x349a1b-0x0;var _0x2104ad=_0xedd9[_0x349a1b];return _0x2104ad;};'use strict';var _=require('lodash');var BPromise=require(_0x9edd('0x0'));var Redis=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var logger=require(_0x9edd('0x4'))(_0x9edd('0x5'));var cmContactRpc=require(_0x9edd('0x6'));config[_0x9edd('0x7')]=_['defaults'](config[_0x9edd('0x7')],{'host':_0x9edd('0x8'),'port':0x18eb});var io=require(_0x9edd('0x9'))(new Redis(config[_0x9edd('0x7')]));function emit(_0x5319f7,_0xf0b2d8,_0x571af9,_0x172522,_0x190185){logger[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,_0xf0b2d8['id'],_0x571af9,_0x172522,JSON['stringify'](_0x190185));io['to'](_0x571af9)[_0x9edd('0xc')](_0x172522,_0x190185);}exports['exec']=function(_0x2076fc,_0x138767,_0x523026,_0xbf9da6){var _0x13dc4f,_0x5b6c00;var _0x30c0d7={};var _0x1b73d1=Number(_0x523026[_0x9edd('0xd')]);var _0xfd544a=_0x523026[_0x9edd('0xe')]?Boolean(Number(_0x523026[_0x9edd('0xe')])):![];var _0xfca576;var _0xef5498=![];if(!_['isNil'](_0x523026[_0x9edd('0xf')])){if(_0x523026[_0x9edd('0xf')]=='1')_0xef5498=!![];}if(!_0xef5498){if(_0xbf9da6[_0x9edd('0x10')]){_0x30c0d7['id']=_0xbf9da6[_0x9edd('0x10')];}}if(!_0x30c0d7['id']){_0x30c0d7[_0x9edd('0x11')]=_0x1b73d1;_0xfca576=_0x523026[_0x9edd('0x12')]&&_0x523026[_0x9edd('0x12')]!=='0'?_0x523026[_0x9edd('0x12')]['split'](','):[_0x9edd('0x13')];_0x30c0d7[_0x9edd('0x14')]=_[_0x9edd('0x15')](_0xfca576,function(_0x5acf65){var _0x1b54c0={};_0x1b54c0[_0x5acf65]=_0xbf9da6[_0x9edd('0x16')]?_0xbf9da6[_0x9edd('0x17')]:_0xbf9da6['calleridnum'];return _0x1b54c0;});}var _0x43dc70=['id','firstName',_0x9edd('0x18'),_0x9edd('0x13'),'mobile','fax',_0x9edd('0x11'),'createdAt',_0x9edd('0x19'),'updatedAt'];var _0x535f37=_[_0x9edd('0x1a')](_0x43dc70,_0xfca576);BPromise[_0x9edd('0x1b')]()['then'](cmContactRpc['getContacts']({'attributes':_0x535f37,'where':_0x30c0d7}))[_0x9edd('0x1c')](function(_0x186186){_0x5b6c00=_0x186186;if(!_[_0x9edd('0x1d')](_0x5b6c00)){if(_0x5b6c00['length']===0x1){_0x13dc4f=_0x5b6c00[0x0];logger[_0x9edd('0xa')](_0x9edd('0x1e'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id'],_0x13dc4f['id']);}else{logger[_0x9edd('0xa')](_0x9edd('0x20'),_0xbf9da6['uniqueid'],_0x138767['id'],_[_0x9edd('0x15')](_0x5b6c00,'id')[_0x9edd('0x21')](','));}return;}else{logger[_0x9edd('0xa')](_0x9edd('0x22'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id']);var _0x4d507f={'ListId':_0x1b73d1};var _0x4b3d1b=_0x523026[_0x9edd('0x23')]&&_0x523026[_0x9edd('0x23')]!=='0'?_0x523026[_0x9edd('0x23')]:_0x9edd('0x13');if(_0xfd544a){logger[_0x9edd('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xbf9da6['uniqueid'],_0x138767['id']);_0x4d507f[_0x4b3d1b]=_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])?_0xbf9da6[_0x9edd('0x25')]:_0xbf9da6['destcalleridnum'];if(_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])){_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x27')]&&_0xbf9da6['calleridname']!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x27')]:_0x9edd('0x29');}else{_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x2a')]&&_0xbf9da6[_0x9edd('0x2a')]!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x2a')]:_0x9edd('0x29');}return BPromise[_0x9edd('0x1b')]()[_0x9edd('0x1c')](cmContactRpc[_0x9edd('0x2b')](_0x4d507f))[_0x9edd('0x1c')](function(_0xa55906){_0x13dc4f=_0xa55906;_0x5b6c00[_0x9edd('0x2c')](_0xa55906);if(_0x13dc4f){logger['info'](_0x9edd('0x2d'),_0xbf9da6[_0x9edd('0x1f')],_0x138767['id'],_0x13dc4f['id']);}return;});}else{logger[_0x9edd('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xbf9da6[_0x9edd('0x1f')],_0x138767['id']);_0x4d507f[_0x4b3d1b]=_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])?_0xbf9da6[_0x9edd('0x25')]:_0xbf9da6[_0x9edd('0x17')];if(_[_0x9edd('0x24')](_0xbf9da6[_0x9edd('0x16')])){_0x4d507f[_0x9edd('0x26')]=_0xbf9da6[_0x9edd('0x27')]&&_0xbf9da6[_0x9edd('0x27')]!==_0x9edd('0x28')?_0xbf9da6[_0x9edd('0x27')]:_0x9edd('0x29');}else{_0x4d507f[_0x9edd('0x26')]=_0xbf9da6['destcalleridname']&&_0xbf9da6[_0x9edd('0x2a')]!==''?_0xbf9da6[_0x9edd('0x2a')]:_0x9edd('0x29');}_0x13dc4f=_0x4d507f;_0x5b6c00[_0x9edd('0x2c')](_0x4d507f);return;}}})[_0x9edd('0x1c')](function(){if(_0x2076fc){emit(_0xbf9da6[_0x9edd('0x1f')],_0x138767,util['format'](_0x9edd('0x2e'),_0x2076fc[_0x9edd('0x2f')]),util[_0x9edd('0x30')](_0x9edd('0x31'),_0x523026[_0x9edd('0x32')][_0x9edd('0x33')]()),{'evt':_[_0x9edd('0x34')](_0xbf9da6,{'autoCreate':_0xfd544a}),'contact':_0x13dc4f===undefined?{}:_0x13dc4f,'contacts':_0x5b6c00[_0x9edd('0x35')]===0x0?undefined:_0x5b6c00});}});}; \ No newline at end of file +var _0xbec5=['fax','scheduledAt','union','resolve','then','getContacts','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','firstName','phone','mobile'];(function(_0x5a4744,_0x2310bd){var _0x41f496=function(_0x2e3814){while(--_0x2e3814){_0x5a4744['push'](_0x5a4744['shift']());}};_0x41f496(++_0x2310bd);}(_0xbec5,0xe5));var _0x5bec=function(_0x3452a8,_0x4bfaa4){_0x3452a8=_0x3452a8-0x0;var _0x233814=_0xbec5[_0x3452a8];return _0x233814;};'use strict';var _=require(_0x5bec('0x0'));var BPromise=require(_0x5bec('0x1'));var Redis=require('ioredis');var util=require(_0x5bec('0x2'));var config=require(_0x5bec('0x3'));var logger=require(_0x5bec('0x4'))(_0x5bec('0x5'));var cmContactRpc=require(_0x5bec('0x6'));config['redis']=_[_0x5bec('0x7')](config[_0x5bec('0x8')],{'host':_0x5bec('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bec('0x8')]));function emit(_0x28a427,_0x38456e,_0x406e65,_0x43d96e,_0x302aae){logger[_0x5bec('0xa')](_0x5bec('0xb'),_0x28a427,_0x38456e['id'],_0x406e65,_0x43d96e,JSON['stringify'](_0x302aae));io['to'](_0x406e65)[_0x5bec('0xc')](_0x43d96e,_0x302aae);}exports['exec']=function(_0x748f75,_0x2a70a7,_0x117162,_0x4a5482){var _0x288d1b,_0x18fa47;var _0x16226b={};var _0x57ffc4=Number(_0x117162[_0x5bec('0xd')]);var _0x1c888f=_0x117162['data2']?Boolean(Number(_0x117162[_0x5bec('0xe')])):![];var _0xaa984d;var _0x35393a=![];if(!_[_0x5bec('0xf')](_0x117162[_0x5bec('0x10')])){if(_0x117162[_0x5bec('0x10')]=='1')_0x35393a=!![];}if(!_0x35393a){if(_0x4a5482[_0x5bec('0x11')]){_0x16226b['id']=_0x4a5482[_0x5bec('0x11')];}}if(!_0x16226b['id']){_0x16226b[_0x5bec('0x12')]=_0x57ffc4;_0xaa984d=_0x117162[_0x5bec('0x13')]&&_0x117162[_0x5bec('0x13')]!=='0'?_0x117162[_0x5bec('0x13')][_0x5bec('0x14')](','):['phone'];_0x16226b['$or']=_[_0x5bec('0x15')](_0xaa984d,function(_0x773740){var _0x31ad9c={};_0x31ad9c[_0x773740]=_0x4a5482[_0x5bec('0x16')]?_0x4a5482['destcalleridnum']:_0x4a5482['calleridnum'];return _0x31ad9c;});}var _0x3cd354=['id',_0x5bec('0x17'),'lastName',_0x5bec('0x18'),_0x5bec('0x19'),_0x5bec('0x1a'),_0x5bec('0x12'),'createdAt',_0x5bec('0x1b'),'updatedAt'];var _0x191c0f=_[_0x5bec('0x1c')](_0x3cd354,_0xaa984d);BPromise[_0x5bec('0x1d')]()[_0x5bec('0x1e')](cmContactRpc[_0x5bec('0x1f')]({'attributes':_0x191c0f,'where':_0x16226b}))['then'](function(_0x232584){_0x18fa47=_0x232584;if(!_['isEmpty'](_0x18fa47)){if(_0x18fa47[_0x5bec('0x20')]===0x1){_0x288d1b=_0x18fa47[0x0];logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}else{logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_[_0x5bec('0x15')](_0x18fa47,'id')[_0x5bec('0x22')](','));}return;}else{logger[_0x5bec('0xa')](_0x5bec('0x23'),_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);var _0x2dc014={'ListId':_0x57ffc4};var _0x4de66a=_0x117162['data4']&&_0x117162['data4']!=='0'?_0x117162[_0x5bec('0x24')]:_0x5bec('0x18');if(_0x1c888f){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482['routeId'])?_0x4a5482[_0x5bec('0x25')]:_0x4a5482[_0x5bec('0x26')];if(_['isNil'](_0x4a5482['routeId'])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482[_0x5bec('0x27')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x27')]:_0x5bec('0x29');}else{_0x2dc014['firstName']=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482['destcalleridname']!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:_0x5bec('0x29');}return BPromise[_0x5bec('0x1d')]()['then'](cmContactRpc[_0x5bec('0x2b')](_0x2dc014))[_0x5bec('0x1e')](function(_0xfc7d41){_0x288d1b=_0xfc7d41;_0x18fa47['push'](_0xfc7d41);if(_0x288d1b){logger[_0x5bec('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x4a5482[_0x5bec('0x21')],_0x2a70a7['id'],_0x288d1b['id']);}return;});}else{logger[_0x5bec('0xa')](_0x5bec('0x2c'),_0x4a5482['uniqueid'],_0x2a70a7['id']);_0x2dc014[_0x4de66a]=_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])?_0x4a5482['calleridnum']:_0x4a5482[_0x5bec('0x26')];if(_[_0x5bec('0xf')](_0x4a5482[_0x5bec('0x16')])){_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x27')]&&_0x4a5482['calleridname']!==_0x5bec('0x28')?_0x4a5482['calleridname']:_0x5bec('0x29');}else{_0x2dc014[_0x5bec('0x17')]=_0x4a5482[_0x5bec('0x2a')]&&_0x4a5482[_0x5bec('0x2a')]!==_0x5bec('0x28')?_0x4a5482[_0x5bec('0x2a')]:'Unknown';}_0x288d1b=_0x2dc014;_0x18fa47[_0x5bec('0x2d')](_0x2dc014);return;}}})[_0x5bec('0x1e')](function(){if(_0x748f75){emit(_0x4a5482[_0x5bec('0x21')],_0x2a70a7,util['format'](_0x5bec('0x2e'),_0x748f75[_0x5bec('0x2f')]),util['format'](_0x5bec('0x30'),_0x117162['action'][_0x5bec('0x31')]()),{'evt':_[_0x5bec('0x32')](_0x4a5482,{'autoCreate':_0x1c888f}),'contact':_0x288d1b===undefined?{}:_0x288d1b,'contacts':_0x18fa47[_0x5bec('0x20')]===0x0?undefined:_0x18fa47});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 310c137..fcbf469 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 _0x762e=['defaults','redis','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','isNil','data3','uriLocation','data4','data5','windowHeight','data6','600','winArguments','format','name','action','jscripty','user:%s','trigger:%s','toLowerCase','exec','integration','queue','routeId','script','buildUri','parse','query','replace','channel','AllConditions','AnyConditions','length','checkConditions','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','event','agent','lastevent','mailSubstatus','null','substatus','offlineMessage','created','exports','util','mustache','./integration','./cmContact','./script','../../../config/logger','trigger','../ami'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x762e,0xea));var _0xe762=function(_0x1fadbb,_0x3e5630){_0x1fadbb=_0x1fadbb-0x0;var _0x31f9d2=_0x762e[_0x1fadbb];return _0x31f9d2;};'use strict';var util=require(_0xe762('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0xe762('0x1'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0xe762('0x2'));var cmContact=require(_0xe762('0x3'));var script=require(_0xe762('0x4'));var config=require('../../../config/environment');var logger=require(_0xe762('0x5'))(_0xe762('0x6'));var ami=require(_0xe762('0x7'));config['redis']=_[_0xe762('0x8')](config[_0xe762('0x9')],{'host':_0xe762('0xa'),'port':0x18eb});var io=require(_0xe762('0xb'))(new Redis(config[_0xe762('0x9')]));var operators={'equals':function(_0x38aac7,_0x567750){return _0x38aac7==_0x567750;},'not_equals':function(_0x50dd96,_0x2c0793){return _0x50dd96!=_0x2c0793;}};var barAndWebActions=[_0xe762('0xc'),_0xe762('0xd'),_0xe762('0xe')];function Trigger(_0x3735d5){this[_0xe762('0xf')]=_0x3735d5['triggers'];this[_0xe762('0x10')]=_0x3735d5[_0xe762('0x10')];this[_0xe762('0x11')]=_0x3735d5['voiceQueues'];this[_0xe762('0x12')]=_0x3735d5['templates'];this[_0xe762('0x13')]=_0x3735d5['voiceExtensions'];this[_0xe762('0x14')]=_0x3735d5[_0xe762('0x14')];this[_0xe762('0x15')]=_0x3735d5['freshdeskAccounts'];this['salesforceAccounts']=_0x3735d5[_0xe762('0x16')];this[_0xe762('0x17')]=_0x3735d5[_0xe762('0x17')];this[_0xe762('0x18')]=_0x3735d5[_0xe762('0x18')];this[_0xe762('0x19')]=_0x3735d5[_0xe762('0x19')];this[_0xe762('0x1a')]=_0x3735d5['vtigerAccounts'];this[_0xe762('0x1b')]=_0x3735d5[_0xe762('0x1b')];this[_0xe762('0x1c')]=_0x3735d5[_0xe762('0x1c')];this['freshsalesAccounts']=_0x3735d5[_0xe762('0x1d')];this[_0xe762('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xe762('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xe762('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xe762('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xe762('0x1b')]};ami['on'](_0xe762('0x1f'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x22'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0xe762('0x21')](this));ami['on'](_0xe762('0x23'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x24'),this['syncCustomEvent'][_0xe762('0x21')](this));ami['on'](_0xe762('0x25'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x26'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x27'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0xe762('0x29'),this['syncCustomEvent'][_0xe762('0x21')](this));ami['on'](_0xe762('0x2a'),this['syncCustomEvent'][_0xe762('0x21')](this));ami['on'](_0xe762('0x2b'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x2c'),this[_0xe762('0x2d')][_0xe762('0x21')](this));ami['on'](_0xe762('0x2e'),this[_0xe762('0x2d')][_0xe762('0x21')](this));ami['on']('custom:dialend',this[_0xe762('0x2d')][_0xe762('0x21')](this));ami['on'](_0xe762('0x2f'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x30'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on']('custom:substatus',this['syncCustomEvent'][_0xe762('0x21')](this));ami['on'](_0xe762('0x31'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x32'),this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on']('custom:acceptmessage',this[_0xe762('0x20')][_0xe762('0x21')](this));ami['on'](_0xe762('0x33'),this['syncCustomEvent'][_0xe762('0x21')](this));ami['on'](_0xe762('0x34'),this[_0xe762('0x20')][_0xe762('0x21')](this));}Trigger[_0xe762('0x35')][_0xe762('0x36')]=function(_0x3dcade,_0x2bb268,_0x37cc8b){logger[_0xe762('0x37')](_0x3dcade,_0x2bb268,JSON['stringify'](_0x37cc8b));io['to'](_0x3dcade)[_0xe762('0x36')](_0x2bb268,_0x37cc8b);};Trigger[_0xe762('0x35')][_0xe762('0x20')]=function(_0xcdb005){var _0xca71c6=_[_0xe762('0x38')](_0xcdb005);if(typeof _0xca71c6[_0xe762('0x39')]===_0xe762('0x3a')){_0xca71c6[_0xe762('0x39')]=_0xe762('0x3b');}this[_0xe762('0x3c')](_0xca71c6);};Trigger[_0xe762('0x35')][_0xe762('0x2d')]=function(_0x2ee29c){if(this[_0xe762('0x10')][_0x2ee29c[_0xe762('0x3d')]]){this[_0xe762('0x20')](_0x2ee29c);}};Trigger[_0xe762('0x35')][_0xe762('0x3c')]=function(_0x383c8b){var _0x32fbef;for(var _0x5f312e in this['triggers']){if(this[_0xe762('0xf')][_0xe762('0x3e')](_0x5f312e)){if(this[_0xe762('0xf')][_0x5f312e][_0xe762('0x3f')]){_0x32fbef=this[_0xe762('0x40')](this[_0xe762('0xf')][_0x5f312e],_0x383c8b);if(_0x32fbef){_[_0xe762('0x41')](_0x383c8b,_0x383c8b[_0xe762('0x42')]);for(var _0x394f46=0x0,_0x1ad8bc,_0x4e0733,_0x593823;_0x394f460x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x326f,0xd1));var _0xf326=function(_0xb2bde9,_0xb79931){_0xb2bde9=_0xb2bde9-0x0;var _0x53e835=_0x326f[_0xb2bde9];return _0x53e835;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5d2552c..fc422fc 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 _0xfc87=['substring','lastIndexOf','enduserId','catch','replace','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','/contacts(','Fields','callDirection','queue','phonecalls','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','recordingURL','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','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token','error','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid'];(function(_0xc843d4,_0x3baddf){var _0x5f1187=function(_0x5eafc0){while(--_0x5eafc0){_0xc843d4['push'](_0xc843d4['shift']());}};_0x5f1187(++_0x3baddf);}(_0xfc87,0x155));var _0x7fc8=function(_0x299634,_0x247fd9){_0x299634=_0x299634-0x0;var _0x3a2e32=_0xfc87[_0x299634];return _0x3a2e32;};'use strict';var _=require('lodash');var BPromise=require(_0x7fc8('0x0'));var rp=require(_0x7fc8('0x1'));var util=require('util');var intUtil=require('./util');var md5=require(_0x7fc8('0x2'));var Redis=require('ioredis');var logger=require(_0x7fc8('0x3'))(_0x7fc8('0x4'));var config=require(_0x7fc8('0x5'));config[_0x7fc8('0x6')]=_['defaults'](config[_0x7fc8('0x6')],{'host':_0x7fc8('0x7'),'port':0x18eb});var io=require(_0x7fc8('0x8'))(new Redis(config[_0x7fc8('0x6')]));function getAuthToken(_0x6632b9,_0x3cc35e,_0x5e3b85){var _0x5a8174={'method':_0x7fc8('0x9'),'uri':_0x3cc35e,'form':{'client_id':_0x6632b9[_0x7fc8('0xa')],'resource':_0x6632b9[_0x7fc8('0xb')],'username':_0x6632b9[_0x7fc8('0xc')],'password':_0x6632b9['password'],'grant_type':_0x7fc8('0xd'),'client_secret':_0x6632b9['clientSecret']},'json':!![]};return rp(_0x5a8174)[_0x7fc8('0xe')](function(_0x38ada6){return _0x38ada6[_0x7fc8('0xf')];})['catch'](function(_0x56b721){logger[_0x7fc8('0x10')]('['+[_0x5e3b85['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x56b721['message'];});}function getUser(_0x14dcc1,_0x45f956,_0x3a93d3,_0x39f4a6,_0x21519b,_0x1709cd){return new BPromise(function(_0x5be93c,_0x294d23){return getAuthToken(_0x45f956,_0x39f4a6,_0x1709cd)[_0x7fc8('0xe')](function(_0x184477){var _0x5be3b1={'method':_0x7fc8('0x11'),'uri':_0x21519b+_0x7fc8('0x12'),'headers':{'Authorization':_0x7fc8('0x13')+_0x184477,'OData-Version':_0x7fc8('0x14')},'json':!![]};return rp(_0x5be3b1);})[_0x7fc8('0xe')](function(_0x33e3fb){var _0x1880f3=_0x33e3fb['value'];var _0x58fbd1=![];var _0x31d191=null;if(!_[_0x7fc8('0x15')](_0x3a93d3)){if(intUtil['validateEmail'](_0x3a93d3[_0x7fc8('0x16')])){_0x14dcc1[_0x7fc8('0x17')]=_0x3a93d3[_0x7fc8('0x16')];for(_0x31d191=0x0;_0x31d191<_0x1880f3[_0x7fc8('0x18')];_0x31d191++){if(_0x1880f3[_0x31d191][_0x7fc8('0x19')]===_0x3a93d3[_0x7fc8('0x16')]&&!_0x1880f3[_0x31d191][_0x7fc8('0x1a')]){_0x58fbd1=!![];logger[_0x7fc8('0x1b')]('['+[_0x1709cd[_0x7fc8('0x1c')]()]+_0x7fc8('0x1d')+_0x1880f3[_0x31d191][_0x7fc8('0x1e')]+'!');_0x14dcc1[_0x7fc8('0x1f')]=_0x1880f3[_0x31d191][_0x7fc8('0x1e')];}}}}if(!_0x58fbd1){logger[_0x7fc8('0x1b')]('['+[_0x1709cd[_0x7fc8('0x1c')]()]+_0x7fc8('0x20'));_0x14dcc1['userEmail']=_0x45f956[_0x7fc8('0xc')];for(_0x31d191=0x0;_0x31d191<_0x1880f3['length'];_0x31d191++){if(_0x1880f3[_0x31d191]['internalemailaddress']===_0x45f956[_0x7fc8('0xc')]){_0x14dcc1[_0x7fc8('0x1f')]=_0x1880f3[_0x31d191][_0x7fc8('0x1e')];}}}_0x5be93c(_0x14dcc1);})['catch'](function(_0x20b66a){_0x294d23(_0x20b66a[_0x7fc8('0x21')]);});});}function createEndUser(_0x1a6ab5,_0x4e8a34,_0x483ed0,_0x454f78,_0x2a91a4,_0x1e6510){return new BPromise(function(_0x2d2c9b,_0x382421){return getAuthToken(_0x4e8a34,_0x483ed0,_0x1e6510)[_0x7fc8('0xe')](function(_0xf98459){var _0x7b6ec9=_0x1e6510['toLowerCase']()===_0x7fc8('0x22')?_0x2a91a4[_0x7fc8('0x23')]:_0x2a91a4[_0x7fc8('0x24')];var _0x66ffd0={'method':_0x7fc8('0x9'),'uri':_0x454f78+'contacts','body':{'telephone1':_0x7b6ec9,'fullname':_0x7b6ec9,'firstname':_0x7b6ec9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7fc8('0x25')+_0x1a6ab5['userId']+')'},'headers':{'Authorization':_0x7fc8('0x13')+_0xf98459,'OData-Version':_0x7fc8('0x14')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x66ffd0);})['then'](function(_0x354eed){var _0x322372=_0x354eed['headers'][_0x7fc8('0x26')];var _0xab7298=_0x322372[_0x7fc8('0x27')](_0x322372[_0x7fc8('0x28')]('(')+0x1,_0x322372[_0x7fc8('0x28')](')'));_0x1a6ab5[_0x7fc8('0x29')]=_0xab7298;_0x2d2c9b(_0x1a6ab5);})[_0x7fc8('0x2a')](function(_0x2450b5){_0x382421(_0x2450b5[_0x7fc8('0x21')]);});});}function getEndUser(_0x49bc2a,_0x4a9fa1,_0x104a5c,_0x721019,_0x5c899b,_0xa54ab2,_0x1fa752){var _0x4b10f6=_0xa54ab2['toLowerCase']()===_0x7fc8('0x22')?_0x5c899b[_0x7fc8('0x23')]:_0x5c899b['calleridnum'];return getAuthToken(_0x4a9fa1,_0x104a5c,_0xa54ab2)[_0x7fc8('0xe')](function(_0x3105f6){var _0x514ac8={'method':_0x7fc8('0x11'),'uri':_0x721019+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x4b10f6[_0x7fc8('0x2b')]('+',_0x7fc8('0x2c'))+'\x27','headers':{'Authorization':_0x7fc8('0x13')+_0x3105f6,'If-None-Match':null,'OData-Version':_0x7fc8('0x14')},'json':!![]};return rp(_0x514ac8);})[_0x7fc8('0xe')](function(_0x53acac){var _0x35eadb=![];if(!_0x53acac)return _0x35eadb;var _0x1b6b4b=_0x53acac[_0x7fc8('0x2d')];for(var _0x395a8b=0x0;_0x395a8b<_0x1b6b4b['length'];_0x395a8b++){if(_0x1b6b4b[_0x395a8b]['telephone1']===_0x4b10f6){_0x35eadb=!![];_0x49bc2a[_0x7fc8('0x29')]=_0x1b6b4b[_0x395a8b]['contactid'];}}return _0x35eadb;})['then'](function(_0x2eaae6){if(_0x2eaae6)return _0x49bc2a;if(_0x1fa752===_0x7fc8('0x2e')){logger[_0x7fc8('0x1b')]('['+[_0xa54ab2[_0x7fc8('0x1c')]()]+_0x7fc8('0x2f'));return _0x49bc2a;}return createEndUser(_0x49bc2a,_0x4a9fa1,_0x104a5c,_0x721019,_0x5c899b,_0xa54ab2)[_0x7fc8('0xe')](function(_0x2848f0){logger[_0x7fc8('0x1b')]('['+[_0xa54ab2[_0x7fc8('0x1c')]()]+_0x7fc8('0x30'),_0x2848f0['enduserId']);return _0x2848f0;});});}function getCustomFields(_0xd7d5f4,_0x3fc60c,_0x3ad2f3){var _0x56f682={};if(_0xd7d5f4[_0x7fc8('0x18')]>0x0){_['forEach'](_0xd7d5f4,function(_0x58ef1b){if(_['includes']([_0x7fc8('0x31'),_0x7fc8('0x32')],_0x58ef1b['type'])&&_0x58ef1b[_0x7fc8('0x33')]&&!_0x58ef1b[_0x7fc8('0x34')]){var _0x3bfdee=_0x58ef1b[_0x7fc8('0x35')]['toLowerCase']();var _0x301ee6=_0x3bfdee['substring'](0x0,_0x3bfdee[_0x7fc8('0x36')]('_'));var _0x1a763f=_0x3bfdee[_0x7fc8('0x27')](_0x3bfdee[_0x7fc8('0x36')]('_')+0x1);if(_0x301ee6===_0x3ad2f3){_0x56f682[_0x1a763f]=_0x58ef1b[_0x7fc8('0x37')];}}});}return _0x56f682;}function getTicket(_0x16d0aa,_0x511a08,_0x320d4d,_0x4a71b9,_0x35d748,_0x2e9151,_0x4eddcb){return new BPromise(function(_0x54cdf3,_0x553c59){var _0x4b276f;return getAuthToken(_0x511a08,_0x320d4d,_0x4eddcb)[_0x7fc8('0xe')](function(_0x31450f){if(_0x2e9151[_0x7fc8('0x38')]==='incident'){_0x4b276f={'method':_0x7fc8('0x9'),'uri':_0x4a71b9+_0x7fc8('0x39'),'body':Object[_0x7fc8('0x3a')]({},{'title':intUtil[_0x7fc8('0x3b')](_0x2e9151['Subjects'],_0x35d748,'\x20'),'description':intUtil[_0x7fc8('0x3b')](_0x2e9151['Descriptions'],_0x35d748,'\x0a'),'customerid_contact@odata.bind':_0x16d0aa['enduserId']?_0x7fc8('0x3c')+_0x16d0aa[_0x7fc8('0x29')]+')':undefined,'ownerid@odata.bind':_0x7fc8('0x25')+_0x16d0aa[_0x7fc8('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x2e9151[_0x7fc8('0x3d')],_0x35d748,_0x2e9151[_0x7fc8('0x38')])),'headers':{'Authorization':_0x7fc8('0x13')+_0x31450f,'OData-Version':_0x7fc8('0x14')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e9151[_0x7fc8('0x38')]==='phonecall'){var _0x308c8d=_0x16d0aa['enduserId']?[{'partyid_systemuser@odata.bind':_0x7fc8('0x25')+_0x16d0aa['userId']+')','participationtypemask':_0x16d0aa[_0x7fc8('0x3e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x7fc8('0x3c')+_0x16d0aa[_0x7fc8('0x29')]+')','participationtypemask':_0x16d0aa['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x16d0aa[_0x7fc8('0x1f')]+')','participationtypemask':_0x16d0aa[_0x7fc8('0x3e')]===_0x7fc8('0x3f')?0x2:0x1}];_0x4b276f={'method':'POST','uri':_0x4a71b9+_0x7fc8('0x40'),'body':Object['assign']({},{'subject':intUtil[_0x7fc8('0x3b')](_0x2e9151['Subjects'],_0x35d748,'\x20'),'phonenumber':String(_0x35d748[_0x7fc8('0x24')]),'description':intUtil[_0x7fc8('0x3b')](_0x2e9151['Descriptions'],_0x35d748,'\x0a'),'regardingobjectid_contact@odata.bind':_0x16d0aa[_0x7fc8('0x29')]?_0x7fc8('0x3c')+_0x16d0aa['enduserId']+')':undefined,'ownerid@odata.bind':_0x7fc8('0x25')+_0x16d0aa[_0x7fc8('0x1f')]+')','directioncode':_0x16d0aa[_0x7fc8('0x3e')]===_0x7fc8('0x3f')?![]:!![],'phonecall_activity_parties':_0x308c8d},getCustomFields(_0x2e9151[_0x7fc8('0x3d')],_0x35d748,_0x2e9151[_0x7fc8('0x38')])),'headers':{'Authorization':_0x7fc8('0x13')+_0x31450f,'OData-Version':_0x7fc8('0x14')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4b276f);})['then'](function(_0x5b5335){var _0x34262e=_0x5b5335[_0x7fc8('0x41')]['odata-entityid'];var _0x3f4575=_0x34262e[_0x7fc8('0x27')](_0x34262e[_0x7fc8('0x28')]('(')+0x1,_0x34262e[_0x7fc8('0x28')](')'));_0x16d0aa[_0x7fc8('0x42')]=_0x3f4575;_0x54cdf3(_0x16d0aa);})[_0x7fc8('0x2a')](function(_0x1c774d){_0x553c59(_0x1c774d[_0x7fc8('0x21')]);});});}function emit(_0x3583d2,_0xf4e5da,_0x29d03f,_0x4055e8){var _0x34bba4={'uri':util[_0x7fc8('0x43')](_0x7fc8('0x44'),_0x3583d2,_0x29d03f,_0x4055e8)};io['to'](util['format'](_0x7fc8('0x45'),_0xf4e5da))[_0x7fc8('0x46')](_0x7fc8('0x47'),_0x34bba4);}exports['cs']=function(_0x1126bb,_0x2b9e40,_0x19727f,_0x33b1eb,_0x3fbcb9,_0xdf2198,_0x4eee1f,_0x3e4437){var _0x58e664={};_0xdf2198[_0x7fc8('0xb')]=intUtil[_0x7fc8('0x48')](_0xdf2198[_0x7fc8('0xb')]);_0xdf2198[_0x7fc8('0x49')]=intUtil[_0x7fc8('0x48')](_0xdf2198[_0x7fc8('0x49')]);_0x58e664[_0x7fc8('0x3e')]=_0x3e4437==='queue'||_0x3e4437===_0x7fc8('0x4a')?_0x7fc8('0x3f'):_0x7fc8('0x22');var _0x332573=util['format'](_0x7fc8('0x4b'),_0xdf2198['remoteUri']);var _0x5ee5de=util[_0x7fc8('0x43')](_0x7fc8('0x4c'),_0xdf2198[_0x7fc8('0x4d')]);var _0x57b56a=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdf2198[_0x7fc8('0x49')],_0x2b9e40[_0x7fc8('0x4e')],md5(_0x2b9e40['uniqueid']));if(_0x3fbcb9&&_0x3fbcb9[_0x7fc8('0x4f')]){logger[_0x7fc8('0x1b')](_0x7fc8('0x50'),'Recording\x20is\x20enabled!');_0x2b9e40[_0x7fc8('0x51')]=_0x57b56a;}else if(_0x4eee1f&&_0x4eee1f['recordingFormat']&&_0x4eee1f['recordingFormat']!==_0x7fc8('0x52')){logger[_0x7fc8('0x1b')](_0x7fc8('0x53'),'Recording\x20is\x20enabled!');_0x2b9e40[_0x7fc8('0x51')]=_0x57b56a;}else{_0x2b9e40['recordingURL']='';}return getUser(_0x58e664,_0xdf2198,_0x33b1eb,_0x5ee5de,_0x332573,_0x3e4437)[_0x7fc8('0xe')](function(_0x22540d){logger[_0x7fc8('0x1b')]('['+_0x3e4437['toUpperCase']()+_0x7fc8('0x54'),_0x22540d['userId']);logger[_0x7fc8('0x1b')]('['+_0x3e4437[_0x7fc8('0x1c')]()+_0x7fc8('0x55'),_0x22540d[_0x7fc8('0x17')]);return getEndUser(_0x22540d,_0xdf2198,_0x5ee5de,_0x332573,_0x2b9e40,_0x3e4437,_0x19727f[_0x7fc8('0x56')]);})[_0x7fc8('0xe')](function(_0x3e23ca){logger[_0x7fc8('0x1b')]('['+_0x3e4437['toUpperCase']()+_0x7fc8('0x57'),_0x3e23ca['enduserId']);logger[_0x7fc8('0x1b')]('['+_0x3e4437[_0x7fc8('0x1c')]()+_0x7fc8('0x58'),_0x2b9e40['calleridnum']);return getTicket(_0x3e23ca,_0xdf2198,_0x5ee5de,_0x332573,_0x2b9e40,_0x19727f,_0x3e4437);})[_0x7fc8('0xe')](function(_0x54d3e3){logger[_0x7fc8('0x1b')](util['format']('['+_0x3e4437[_0x7fc8('0x1c')]()+_0x7fc8('0x59'),_0x19727f[_0x7fc8('0x38')],_0x54d3e3[_0x7fc8('0x42')]));logger[_0x7fc8('0x1b')](util[_0x7fc8('0x43')]('['+_0x3e4437[_0x7fc8('0x1c')]()+_0x7fc8('0x5a'),_0x3e4437));if(_0x3e4437!=='unmanaged'){logger['info']('['+_0x3e4437[_0x7fc8('0x1c')]()+']',_0x7fc8('0x5b'));emit(_0xdf2198['remoteUri'],_0x33b1eb[_0x7fc8('0x5c')],_0x19727f['ticketType'],_0x54d3e3[_0x7fc8('0x42')]);}})[_0x7fc8('0x2a')](function(_0x2bd25d){logger['error']('['+_0x3e4437[_0x7fc8('0x1c')]()+_0x7fc8('0x5d'),util[_0x7fc8('0x5e')](_0x2bd25d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0d82=['Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','unmanaged','name','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase','message','then','GET','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','length','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','string','picklist','type','nameField','indexOf','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]'];(function(_0x420c44,_0x11af5b){var _0x138afb=function(_0x3e52f5){while(--_0x3e52f5){_0x420c44['push'](_0x420c44['shift']());}};_0x138afb(++_0x11af5b);}(_0x0d82,0xcf));var _0x20d8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0d82[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x20d8('0x0'));var BPromise=require(_0x20d8('0x1'));var rp=require(_0x20d8('0x2'));var util=require(_0x20d8('0x3'));var intUtil=require('./util');var md5=require(_0x20d8('0x4'));var Redis=require('ioredis');var logger=require(_0x20d8('0x5'))(_0x20d8('0x6'));var config=require(_0x20d8('0x7'));config[_0x20d8('0x8')]=_[_0x20d8('0x9')](config[_0x20d8('0x8')],{'host':_0x20d8('0xa'),'port':0x18eb});var io=require(_0x20d8('0xb'))(new Redis(config[_0x20d8('0x8')]));function getAuthToken(_0xe6b7b6,_0x4f5469,_0x63be3a){var _0x2e8298={'method':_0x20d8('0xc'),'uri':_0x4f5469,'form':{'client_id':_0xe6b7b6[_0x20d8('0xd')],'resource':_0xe6b7b6[_0x20d8('0xe')],'username':_0xe6b7b6[_0x20d8('0xf')],'password':_0xe6b7b6['password'],'grant_type':_0x20d8('0x10'),'client_secret':_0xe6b7b6[_0x20d8('0x11')]},'json':!![]};return rp(_0x2e8298)['then'](function(_0x5de2bb){return _0x5de2bb[_0x20d8('0x12')];})[_0x20d8('0x13')](function(_0x122c95){logger[_0x20d8('0x14')]('['+[_0x63be3a[_0x20d8('0x15')]()]+']\x20Wrong\x20credentials!');return _0x122c95[_0x20d8('0x16')];});}function getUser(_0x1c5f6c,_0x48818e,_0x4b7312,_0x2a11f1,_0x494f5b,_0x5e8b9c){return new BPromise(function(_0x2b5a25,_0x40604d){return getAuthToken(_0x48818e,_0x2a11f1,_0x5e8b9c)[_0x20d8('0x17')](function(_0x50b250){var _0x2ea2df={'method':_0x20d8('0x18'),'uri':_0x494f5b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x20d8('0x19')+_0x50b250,'OData-Version':_0x20d8('0x1a')},'json':!![]};return rp(_0x2ea2df);})[_0x20d8('0x17')](function(_0x50bf19){var _0x514aa1=_0x50bf19['value'];var _0x3f1c8d=![];var _0x5a0dd9=null;if(!_[_0x20d8('0x1b')](_0x4b7312)){if(intUtil[_0x20d8('0x1c')](_0x4b7312[_0x20d8('0x1d')])){_0x1c5f6c[_0x20d8('0x1e')]=_0x4b7312[_0x20d8('0x1d')];for(_0x5a0dd9=0x0;_0x5a0dd9<_0x514aa1['length'];_0x5a0dd9++){if(_0x514aa1[_0x5a0dd9][_0x20d8('0x1f')]===_0x4b7312[_0x20d8('0x1d')]&&!_0x514aa1[_0x5a0dd9]['isdisabled']){_0x3f1c8d=!![];logger[_0x20d8('0x20')]('['+[_0x5e8b9c[_0x20d8('0x15')]()]+_0x20d8('0x21')+_0x514aa1[_0x5a0dd9][_0x20d8('0x22')]+'!');_0x1c5f6c[_0x20d8('0x23')]=_0x514aa1[_0x5a0dd9][_0x20d8('0x22')];}}}}if(!_0x3f1c8d){logger[_0x20d8('0x20')]('['+[_0x5e8b9c[_0x20d8('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1c5f6c[_0x20d8('0x1e')]=_0x48818e[_0x20d8('0xf')];for(_0x5a0dd9=0x0;_0x5a0dd9<_0x514aa1['length'];_0x5a0dd9++){if(_0x514aa1[_0x5a0dd9][_0x20d8('0x1f')]===_0x48818e[_0x20d8('0xf')]){_0x1c5f6c['userId']=_0x514aa1[_0x5a0dd9][_0x20d8('0x22')];}}}_0x2b5a25(_0x1c5f6c);})['catch'](function(_0x4b84a8){_0x40604d(_0x4b84a8['message']);});});}function createEndUser(_0x172993,_0x5a1b89,_0x59e2bb,_0xd02bf8,_0xe6cfc1,_0xaf0938){return new BPromise(function(_0x49d174,_0x1e1872){return getAuthToken(_0x5a1b89,_0x59e2bb,_0xaf0938)[_0x20d8('0x17')](function(_0x206e38){var _0x59e187=_0xaf0938[_0x20d8('0x24')]()===_0x20d8('0x25')?_0xe6cfc1[_0x20d8('0x26')]:_0xe6cfc1[_0x20d8('0x27')];var _0x2f1800={'method':_0x20d8('0xc'),'uri':_0xd02bf8+_0x20d8('0x28'),'body':{'telephone1':_0x59e187,'fullname':_0x59e187,'firstname':_0x59e187,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x20d8('0x29')+_0x172993[_0x20d8('0x23')]+')'},'headers':{'Authorization':_0x20d8('0x19')+_0x206e38,'OData-Version':_0x20d8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2f1800);})[_0x20d8('0x17')](function(_0x1be4e2){var _0x2bc4ed=_0x1be4e2['headers']['odata-entityid'];var _0xcdbc83=_0x2bc4ed[_0x20d8('0x2a')](_0x2bc4ed[_0x20d8('0x2b')]('(')+0x1,_0x2bc4ed[_0x20d8('0x2b')](')'));_0x172993[_0x20d8('0x2c')]=_0xcdbc83;_0x49d174(_0x172993);})[_0x20d8('0x13')](function(_0x2d9534){_0x1e1872(_0x2d9534[_0x20d8('0x16')]);});});}function getEndUser(_0x49f6f9,_0x216c1a,_0x1c8a45,_0x43a74e,_0x465adc,_0x41802f,_0x119bb4){var _0x9d18c4=_0x41802f[_0x20d8('0x24')]()==='outbound'?_0x465adc[_0x20d8('0x26')]:_0x465adc['calleridnum'];return getAuthToken(_0x216c1a,_0x1c8a45,_0x41802f)[_0x20d8('0x17')](function(_0x225ab5){var _0xd53153={'method':_0x20d8('0x18'),'uri':_0x43a74e+_0x20d8('0x2d')+_0x9d18c4[_0x20d8('0x2e')]('+',_0x20d8('0x2f'))+'\x27','headers':{'Authorization':_0x20d8('0x19')+_0x225ab5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd53153);})[_0x20d8('0x17')](function(_0x19daba){var _0x33baf4=![];if(!_0x19daba)return _0x33baf4;var _0x1a42a5=_0x19daba[_0x20d8('0x30')];for(var _0x20eecc=0x0;_0x20eecc<_0x1a42a5[_0x20d8('0x31')];_0x20eecc++){if(_0x1a42a5[_0x20eecc]['telephone1']===_0x9d18c4){_0x33baf4=!![];_0x49f6f9[_0x20d8('0x2c')]=_0x1a42a5[_0x20eecc][_0x20d8('0x32')];}}return _0x33baf4;})['then'](function(_0x15c98f){if(_0x15c98f)return _0x49f6f9;if(_0x119bb4===_0x20d8('0x33')){logger['info']('['+[_0x41802f['toUpperCase']()]+_0x20d8('0x34'));return _0x49f6f9;}return createEndUser(_0x49f6f9,_0x216c1a,_0x1c8a45,_0x43a74e,_0x465adc,_0x41802f)[_0x20d8('0x17')](function(_0x552479){logger[_0x20d8('0x20')]('['+[_0x41802f[_0x20d8('0x15')]()]+']\x20Enduser\x20created!',_0x552479['enduserId']);return _0x552479;});});}function getCustomFields(_0x46aefe,_0x272738,_0x4d723b){var _0x3c8104={};if(_0x46aefe[_0x20d8('0x31')]>0x0){_['forEach'](_0x46aefe,function(_0x57d903){if(_['includes']([_0x20d8('0x35'),_0x20d8('0x36')],_0x57d903[_0x20d8('0x37')])&&_0x57d903[_0x20d8('0x38')]&&!_0x57d903['customField']){var _0xe9c71=_0x57d903['idField'][_0x20d8('0x24')]();var _0x389576=_0xe9c71[_0x20d8('0x2a')](0x0,_0xe9c71[_0x20d8('0x39')]('_'));var _0xf7a381=_0xe9c71[_0x20d8('0x2a')](_0xe9c71[_0x20d8('0x39')]('_')+0x1);if(_0x389576===_0x4d723b){_0x3c8104[_0xf7a381]=_0x57d903['content'];}}});}return _0x3c8104;}function getTicket(_0x43488c,_0x3f62f2,_0x1b2a61,_0x223829,_0x6a9d90,_0x2f64fc,_0x2aa00e){return new BPromise(function(_0x465ce2,_0x129337){var _0x557f7e;return getAuthToken(_0x3f62f2,_0x1b2a61,_0x2aa00e)[_0x20d8('0x17')](function(_0x3e109d){if(_0x2f64fc['ticketType']==='incident'){_0x557f7e={'method':'POST','uri':_0x223829+_0x20d8('0x3a'),'body':Object[_0x20d8('0x3b')]({},{'title':intUtil[_0x20d8('0x3c')](_0x2f64fc[_0x20d8('0x3d')],_0x6a9d90,'\x20'),'description':intUtil[_0x20d8('0x3c')](_0x2f64fc[_0x20d8('0x3e')],_0x6a9d90,'\x0a'),'customerid_contact@odata.bind':_0x43488c[_0x20d8('0x2c')]?_0x20d8('0x3f')+_0x43488c[_0x20d8('0x2c')]+')':undefined,'ownerid@odata.bind':_0x20d8('0x29')+_0x43488c['userId']+')','caseorigincode':'1'},getCustomFields(_0x2f64fc[_0x20d8('0x40')],_0x6a9d90,_0x2f64fc['ticketType'])),'headers':{'Authorization':_0x20d8('0x19')+_0x3e109d,'OData-Version':_0x20d8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f64fc[_0x20d8('0x41')]===_0x20d8('0x42')){var _0x2f781c=_0x43488c['enduserId']?[{'partyid_systemuser@odata.bind':_0x20d8('0x29')+_0x43488c[_0x20d8('0x23')]+')','participationtypemask':_0x43488c[_0x20d8('0x43')]===_0x20d8('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x20d8('0x3f')+_0x43488c[_0x20d8('0x2c')]+')','participationtypemask':_0x43488c[_0x20d8('0x43')]===_0x20d8('0x44')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x20d8('0x29')+_0x43488c[_0x20d8('0x23')]+')','participationtypemask':_0x43488c[_0x20d8('0x43')]==='queue'?0x2:0x1}];_0x557f7e={'method':_0x20d8('0xc'),'uri':_0x223829+_0x20d8('0x45'),'body':Object[_0x20d8('0x3b')]({},{'subject':intUtil['getString'](_0x2f64fc[_0x20d8('0x3d')],_0x6a9d90,'\x20'),'phonenumber':String(_0x6a9d90[_0x20d8('0x27')]),'description':intUtil[_0x20d8('0x3c')](_0x2f64fc['Descriptions'],_0x6a9d90,'\x0a'),'regardingobjectid_contact@odata.bind':_0x43488c[_0x20d8('0x2c')]?_0x20d8('0x3f')+_0x43488c[_0x20d8('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x43488c[_0x20d8('0x23')]+')','directioncode':_0x43488c[_0x20d8('0x43')]===_0x20d8('0x44')?![]:!![],'phonecall_activity_parties':_0x2f781c},getCustomFields(_0x2f64fc['Fields'],_0x6a9d90,_0x2f64fc[_0x20d8('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x3e109d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x557f7e);})[_0x20d8('0x17')](function(_0x2528a7){var _0x47e19e=_0x2528a7[_0x20d8('0x46')]['odata-entityid'];var _0x55bde7=_0x47e19e['substring'](_0x47e19e[_0x20d8('0x2b')]('(')+0x1,_0x47e19e['lastIndexOf'](')'));_0x43488c['ticketId']=_0x55bde7;_0x465ce2(_0x43488c);})[_0x20d8('0x13')](function(_0x1fa94c){_0x129337(_0x1fa94c['message']);});});}function emit(_0x5f1990,_0x4336da,_0x8ed8d7,_0xb1c496){var _0xa7a3ce={'uri':util[_0x20d8('0x47')](_0x20d8('0x48'),_0x5f1990,_0x8ed8d7,_0xb1c496)};io['to'](util[_0x20d8('0x47')]('user:%s',_0x4336da))['emit'](_0x20d8('0x49'),_0xa7a3ce);}exports['cs']=function(_0x184b6b,_0x3a15c3,_0x133855,_0x412d98,_0x4b3c33,_0x2cae13,_0x934810,_0x412357){var _0x5834d3={};_0x2cae13[_0x20d8('0xe')]=intUtil[_0x20d8('0x4a')](_0x2cae13[_0x20d8('0xe')]);_0x2cae13[_0x20d8('0x4b')]=intUtil[_0x20d8('0x4a')](_0x2cae13[_0x20d8('0x4b')]);_0x5834d3['callDirection']=_0x412357===_0x20d8('0x44')||_0x412357==='unmanaged'?_0x20d8('0x44'):_0x20d8('0x25');var _0x121524=util[_0x20d8('0x47')](_0x20d8('0x4c'),_0x2cae13[_0x20d8('0xe')]);var _0x3ffbf6=util[_0x20d8('0x47')](_0x20d8('0x4d'),_0x2cae13['tenantId']);var _0x27dff6=util[_0x20d8('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cae13[_0x20d8('0x4b')],_0x3a15c3[_0x20d8('0x4e')],md5(_0x3a15c3[_0x20d8('0x4e')]));if(_0x4b3c33&&_0x4b3c33[_0x20d8('0x4f')]){logger[_0x20d8('0x20')](_0x20d8('0x50'),_0x20d8('0x51'));_0x3a15c3[_0x20d8('0x52')]=_0x27dff6;}else if(_0x934810&&_0x934810[_0x20d8('0x53')]&&_0x934810[_0x20d8('0x53')]!==_0x20d8('0x54')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3a15c3[_0x20d8('0x52')]=_0x27dff6;}else{_0x3a15c3['recordingURL']='';}return getUser(_0x5834d3,_0x2cae13,_0x412d98,_0x3ffbf6,_0x121524,_0x412357)['then'](function(_0x4db1f8){logger['info']('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x55'),_0x4db1f8['userId']);logger[_0x20d8('0x20')]('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x56'),_0x4db1f8[_0x20d8('0x1e')]);return getEndUser(_0x4db1f8,_0x2cae13,_0x3ffbf6,_0x121524,_0x3a15c3,_0x412357,_0x133855[_0x20d8('0x57')]);})[_0x20d8('0x17')](function(_0xae62fa){logger[_0x20d8('0x20')]('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x58'),_0xae62fa[_0x20d8('0x2c')]);logger[_0x20d8('0x20')]('['+_0x412357['toUpperCase']()+_0x20d8('0x59'),_0x3a15c3[_0x20d8('0x27')]);return getTicket(_0xae62fa,_0x2cae13,_0x3ffbf6,_0x121524,_0x3a15c3,_0x133855,_0x412357);})[_0x20d8('0x17')](function(_0x4fc6ad){logger['info'](util[_0x20d8('0x47')]('['+_0x412357['toUpperCase']()+_0x20d8('0x5a'),_0x133855[_0x20d8('0x41')],_0x4fc6ad[_0x20d8('0x5b')]));logger[_0x20d8('0x20')](util[_0x20d8('0x47')]('['+_0x412357[_0x20d8('0x15')]()+_0x20d8('0x5c'),_0x412357));if(_0x412357!==_0x20d8('0x5d')){logger[_0x20d8('0x20')]('['+_0x412357[_0x20d8('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2cae13[_0x20d8('0xe')],_0x412d98[_0x20d8('0x5e')],_0x133855['ticketType'],_0x4fc6ad[_0x20d8('0x5b')]);}})[_0x20d8('0x13')](function(_0x599bbb){logger[_0x20d8('0x14')]('['+_0x412357['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x20d8('0x5f')](_0x599bbb,{'showHidden':!![],'depth':null}));});}; \ 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 1eccd03..43d4630 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 _0xd80c=['ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','Fields','custom_fields','keyBy','value','format','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','[HTTP]','stringify','map','forEach','includes','picklist','type','nameField','customField','content','string','idField','push','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','name','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util'];(function(_0x37bd0d,_0x1b3079){var _0x33f81d=function(_0x458cfa){while(--_0x458cfa){_0x37bd0d['push'](_0x37bd0d['shift']());}};_0x33f81d(++_0x1b3079);}(_0xd80c,0xba));var _0xcd80=function(_0x5924ff,_0x5d1033){_0x5924ff=_0x5924ff-0x0;var _0x4b3f7c=_0xd80c[_0x5924ff];return _0x4b3f7c;};'use strict';var _=require(_0xcd80('0x0'));var rp=require(_0xcd80('0x1'));var md5=require(_0xcd80('0x2'));var util=require(_0xcd80('0x3'));var Redis=require(_0xcd80('0x4'));var intUtil=require(_0xcd80('0x5'));var config=require(_0xcd80('0x6'));var logger=require(_0xcd80('0x7'))(_0xcd80('0x8'));config[_0xcd80('0x9')]=_[_0xcd80('0xa')](config[_0xcd80('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xcd80('0xb'))(new Redis(config[_0xcd80('0x9')]));var headers={'Content-Type':_0xcd80('0xc'),'Accept':'application/json'};function emit(_0x12b309,_0x57e6a1,_0x168bc0){io['to'](_0x12b309)[_0xcd80('0xd')](_0x57e6a1,_0x168bc0);}function getTicket(_0x1abee5,_0x528615,_0x4119e5,_0x41157b,_0x1bceef){logger[_0xcd80('0xe')](_0xcd80('0xf'));var _0x7de6e4=_[_0xcd80('0x10')]({'responder_id':_0x528615['id'],'requester_id':_0x4119e5['id'],'name':util['format'](_0xcd80('0x11'),_0x1bceef[_0xcd80('0x12')]),'phone':_0x1bceef[_0xcd80('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcd80('0x14')](_0x41157b['Subjects'],_0x1bceef,'\x20'),'description':intUtil[_0xcd80('0x14')](_0x41157b[_0xcd80('0x15')],_0x1bceef,'
'),'tags':getTags(_0x41157b['Tags'],'name')},getCustomFields(_0x41157b[_0xcd80('0x16')],_0x1bceef));_0x7de6e4[_0xcd80('0x17')]=_['mapValues'](_[_0xcd80('0x18')](_0x7de6e4[_0xcd80('0x17')],'id'),_0xcd80('0x19'));return request({'uri':util[_0xcd80('0x1a')]('%s/api/v2/tickets',_0x1abee5[_0xcd80('0x1b')]),'method':_0xcd80('0x1c'),'body':_0x7de6e4})['then'](function(_0x2fdbf5){logger[_0xcd80('0xe')](_0xcd80('0x1d'));return _0x2fdbf5;});}function getUser(_0x38b4c6,_0x3b8833){if(intUtil[_0xcd80('0x1e')](_0x3b8833)){return request({'uri':util['format'](_0xcd80('0x1f'),_0x38b4c6['remoteUri']),'qs':{'email':_0x3b8833}})[_0xcd80('0x20')](function(_0x34a486){if(_0x34a486[_0xcd80('0x21')]){logger['info'](_0xcd80('0x22'));return _['find'](_0x34a486,function(_0x4df974){return _0x4df974[_0xcd80('0x23')]['email']===_0x3b8833;});}else{logger[_0xcd80('0xe')](_0xcd80('0x24'));return request({'uri':util[_0xcd80('0x1a')](_0xcd80('0x25'),_0x38b4c6['remoteUri'])})['then'](function(_0x3815ad){logger[_0xcd80('0xe')](_0xcd80('0x26'));return _0x3815ad;});}});}else{logger['info'](_0xcd80('0x27'));return request({'uri':util[_0xcd80('0x1a')](_0xcd80('0x25'),_0x38b4c6['remoteUri'])})[_0xcd80('0x20')](function(_0x56795d){logger[_0xcd80('0xe')](_0xcd80('0x26'));return _0x56795d;});}}function getEndUser(_0x3ab3f8,_0x216233,_0x5c6884){logger[_0xcd80('0xe')](_0xcd80('0x28'),_0x5c6884);return request({'uri':util['format'](_0xcd80('0x29'),_0x3ab3f8[_0xcd80('0x1b')]),'qs':{'phone':_0x5c6884}})[_0xcd80('0x20')](function(_0x5a9847){if(_0x5a9847[_0xcd80('0x21')]){logger[_0xcd80('0xe')](_0xcd80('0x2a'));return _[_0xcd80('0x2b')](_0x5a9847,{'phone':_0x5c6884});}else{logger[_0xcd80('0xe')](_0xcd80('0x2c'));return request({'uri':util['format'](_0xcd80('0x29'),_0x3ab3f8[_0xcd80('0x1b')]),'method':_0xcd80('0x1c'),'body':{'name':_0x216233,'phone':_0x5c6884}})['then'](function(_0x28589d){logger[_0xcd80('0xe')](_0xcd80('0x2d'));return _0x28589d;});}});}function getAuth(_0x570281){return util[_0xcd80('0x1a')]('Basic\x20%s',new Buffer(_0x570281[_0xcd80('0x2e')]+':X')[_0xcd80('0x2f')](_0xcd80('0x30')));}function request(_0x48d849){logger['debug'](_0xcd80('0x31'),JSON[_0xcd80('0x32')](_0x48d849));return rp(_[_0xcd80('0xa')](_0x48d849,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x26679f,_0x3d4425){var _0x470d89=[];if(_0x26679f&&_0x26679f[_0xcd80('0x21')]>0x0){_0x470d89=_[_0xcd80('0x33')](_0x26679f,_0x3d4425);}return _0x470d89;}function getCustomFields(_0x3ec6fe,_0x2fc945){var _0x2a096e=[];var _0x449f03={'custom_fields':[]};if(_0x3ec6fe[_0xcd80('0x21')]>0x0){_[_0xcd80('0x34')](_0x3ec6fe,function(_0x26f62c){if(_[_0xcd80('0x35')](['string',_0xcd80('0x36')],_0x26f62c[_0xcd80('0x37')])&&_0x26f62c[_0xcd80('0x38')]&&!_0x26f62c[_0xcd80('0x39')]){_0x449f03[_0x26f62c[_0xcd80('0x38')]['toLowerCase']()]=_0x26f62c[_0xcd80('0x3a')]['toString']();}else if(_['includes']([_0xcd80('0x3b'),_0xcd80('0x36')],_0x26f62c[_0xcd80('0x37')])&&_0x26f62c[_0xcd80('0x3c')]&&_0x26f62c[_0xcd80('0x39')]){_0x449f03[_0xcd80('0x17')][_0xcd80('0x3d')]({'id':_0x26f62c['idField'],'value':_0x26f62c['content'][_0xcd80('0x2f')]()});}else if(_0x26f62c['type']===_0xcd80('0x3e')&&_0x26f62c[_0xcd80('0x3f')]&&_0x26f62c[_0xcd80('0x3c')]&&_0x26f62c[_0xcd80('0x39')]){_0x2fc945[_0x26f62c[_0xcd80('0x3f')]]&&_0x449f03['custom_fields'][_0xcd80('0x3d')]({'id':_0x26f62c[_0xcd80('0x3c')],'value':_0x2fc945[_0x26f62c[_0xcd80('0x3f')]]['toString']()});}else if(_0x26f62c[_0xcd80('0x37')]==='customVariable'&&_0x26f62c[_0xcd80('0x40')]&&_0x26f62c[_0xcd80('0x40')]['name']&&_0x26f62c[_0xcd80('0x3c')]&&_0x26f62c[_0xcd80('0x39')]){_0x2fc945[_0x26f62c[_0xcd80('0x40')]['name'][_0xcd80('0x41')]()]&&_0x449f03['custom_fields']['push']({'id':_0x26f62c[_0xcd80('0x3c')],'value':_0x2fc945[_0x26f62c[_0xcd80('0x40')]['name'][_0xcd80('0x41')]()][_0xcd80('0x2f')]()});}});}return _0x449f03;}exports[_0xcd80('0x42')]=function(_0x30781a,_0x5ab1a3,_0x555ba5,_0x3e49c6,_0x4005f7,_0x439141){var _0xd19d5f,_0x5a70e8;_0x439141[_0xcd80('0x1b')]=intUtil[_0xcd80('0x43')](_0x439141['remoteUri']);_0x439141[_0xcd80('0x44')]=intUtil[_0xcd80('0x43')](_0x439141[_0xcd80('0x44')]);if(_0x4005f7&&_0x4005f7[_0xcd80('0x45')]){logger['info'](_0xcd80('0x46'),_0xcd80('0x47'));_0x5ab1a3[_0xcd80('0x48')]=util[_0xcd80('0x1a')](_0xcd80('0x49'),_0x439141[_0xcd80('0x44')],_0x5ab1a3['uniqueid'],md5(_0x5ab1a3[_0xcd80('0x4a')]));}else{_0x5ab1a3[_0xcd80('0x48')]='';}headers[_0xcd80('0x4b')]=getAuth(_0x439141);return getUser(_0x439141,_0x3e49c6[_0xcd80('0x4c')])['then'](function(_0x56fcb9){_0xd19d5f=_0x56fcb9;logger[_0xcd80('0xe')]('The\x20User\x20ID\x20is:',_0xd19d5f['id']);return getEndUser(_0x439141,_0x5ab1a3[_0xcd80('0x12')],_0x5ab1a3['calleridnum']);})['then'](function(_0x27df78){_0x5a70e8=_0x27df78;logger[_0xcd80('0xe')](_0xcd80('0x4d'),_0x5a70e8['id']);return getTicket(_0x439141,_0xd19d5f,_0x5a70e8,_0x555ba5,_0x5ab1a3);})['then'](function(_0x1de3d8){if(_0x1de3d8&&_0x1de3d8['id']){logger['info']('Ticket\x20created!');logger[_0xcd80('0xe')](_0xcd80('0x4e'),_0x1de3d8['id']);logger['info']('[QUEUE]',_0xcd80('0x4f'));emit(util['format'](_0xcd80('0x50'),_0x3e49c6[_0xcd80('0x51')]),_0xcd80('0x52'),{'uri':util[_0xcd80('0x1a')](_0xcd80('0x53'),_0x439141[_0xcd80('0x1b')],_0x1de3d8['id'])});}})[_0xcd80('0x54')](function(_0x33aca4){logger[_0xcd80('0x55')]('[QUEUE]',JSON[_0xcd80('0x32')](_0x33aca4));});};exports[_0xcd80('0x56')]=function(_0x115af7,_0x3e657e,_0x3c51dc,_0x124e2e,_0x392375,_0x1229eb,_0x48be32){var _0x29d087,_0x5d6c83;_0x1229eb[_0xcd80('0x1b')]=intUtil[_0xcd80('0x43')](_0x1229eb[_0xcd80('0x1b')]);_0x1229eb[_0xcd80('0x44')]=intUtil[_0xcd80('0x43')](_0x1229eb[_0xcd80('0x44')]);if(_0x48be32&&_0x48be32[_0xcd80('0x57')]&&_0x48be32[_0xcd80('0x57')]!==_0xcd80('0x58')){logger[_0xcd80('0xe')](_0xcd80('0x59'),_0xcd80('0x47'));_0x3e657e[_0xcd80('0x48')]=util['format'](_0xcd80('0x49'),_0x1229eb[_0xcd80('0x44')],_0x3e657e[_0xcd80('0x4a')],md5(_0x3e657e[_0xcd80('0x4a')]));}headers[_0xcd80('0x4b')]=getAuth(_0x1229eb);return getUser(_0x1229eb,_0x124e2e[_0xcd80('0x4c')])[_0xcd80('0x20')](function(_0x5c117f){_0x29d087=_0x5c117f;logger[_0xcd80('0xe')](_0xcd80('0x5a'),_0x29d087['id']);return getEndUser(_0x1229eb,_0x3e657e[_0xcd80('0x5b')],_0x3e657e['destcalleridnum']);})[_0xcd80('0x20')](function(_0x3918a7){_0x5d6c83=_0x3918a7;logger[_0xcd80('0xe')](_0xcd80('0x4d'),_0x5d6c83['id']);return getTicket(_0x1229eb,_0x29d087,_0x5d6c83,_0x3c51dc,_0x3e657e);})[_0xcd80('0x20')](function(_0x465a3a){if(_0x465a3a&&_0x465a3a['id']){logger['info'](_0xcd80('0x1d'));logger[_0xcd80('0xe')](_0xcd80('0x4e'),_0x465a3a['id']);logger[_0xcd80('0xe')](_0xcd80('0x59'),_0xcd80('0x4f'));emit(util['format'](_0xcd80('0x50'),_0x124e2e[_0xcd80('0x51')]),_0xcd80('0x52'),{'uri':util[_0xcd80('0x1a')](_0xcd80('0x53'),_0x1229eb['remoteUri'],_0x465a3a['id'])});}})[_0xcd80('0x54')](function(_0x7a1ec9){logger[_0xcd80('0x55')](_0xcd80('0x59'),JSON['stringify'](_0x7a1ec9));});};exports[_0xcd80('0x5c')]=function(_0x228717,_0x3777e1,_0x585339,_0x4858db,_0x50a7c5,_0x15a5bd){var _0x574f7a,_0x4c02f8;_0x15a5bd[_0xcd80('0x1b')]=intUtil[_0xcd80('0x43')](_0x15a5bd[_0xcd80('0x1b')]);_0x15a5bd['serverUrl']=intUtil[_0xcd80('0x43')](_0x15a5bd[_0xcd80('0x44')]);if(_0x50a7c5&&_0x50a7c5[_0xcd80('0x45')]){logger[_0xcd80('0xe')]('['+_0x3777e1[_0xcd80('0x5d')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3777e1[_0xcd80('0x48')]=util[_0xcd80('0x1a')](_0xcd80('0x49'),_0x15a5bd[_0xcd80('0x44')],_0x3777e1[_0xcd80('0x4a')],md5(_0x3777e1['uniqueid']));}else{_0x3777e1[_0xcd80('0x48')]='';}headers[_0xcd80('0x4b')]=getAuth(_0x15a5bd);return getUser(_0x15a5bd,'')['then'](function(_0xb43555){_0x574f7a=_0xb43555;logger[_0xcd80('0xe')](_0xcd80('0x5a'),_0x574f7a['id']);return getEndUser(_0x15a5bd,_0x3777e1[_0xcd80('0x12')],_0x3777e1[_0xcd80('0x13')]);})[_0xcd80('0x20')](function(_0x423838){_0x4c02f8=_0x423838;logger['info'](_0xcd80('0x4d'),_0x4c02f8['id']);return getTicket(_0x15a5bd,_0x574f7a,_0x4c02f8,_0x585339,_0x3777e1);})[_0xcd80('0x20')](function(_0x135e80){if(_0x135e80){logger[_0xcd80('0xe')](_0xcd80('0x1d'));logger['info'](_0xcd80('0x4e'),_0x135e80['id']);}})['catch'](function(_0x321cbf){logger[_0xcd80('0x55')]('['+_0x3777e1[_0xcd80('0x5d')][_0xcd80('0x5e')]()+']',JSON[_0xcd80('0x32')](_0x321cbf));});}; \ No newline at end of file +var _0xcaa8=['type','variableName','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','trigger:browser:url','%s/helpdesk/tickets/%d','stringify','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','contact','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','base64','debug','[HTTP]','GET','includes','string','picklist','customField','nameField','toLowerCase','toString','push','idField','content'];(function(_0xf4eafd,_0x4363bd){var _0x2a3fd6=function(_0x41cfbb){while(--_0x41cfbb){_0xf4eafd['push'](_0xf4eafd['shift']());}};_0x2a3fd6(++_0x4363bd);}(_0xcaa8,0xdb));var _0x8caa=function(_0x4e72e8,_0x201b63){_0x4e72e8=_0x4e72e8-0x0;var _0xbbd405=_0xcaa8[_0x4e72e8];return _0xbbd405;};'use strict';var _=require(_0x8caa('0x0'));var rp=require(_0x8caa('0x1'));var md5=require('md5');var util=require(_0x8caa('0x2'));var Redis=require(_0x8caa('0x3'));var intUtil=require(_0x8caa('0x4'));var config=require(_0x8caa('0x5'));var logger=require('../../../../config/logger')(_0x8caa('0x6'));config[_0x8caa('0x7')]=_[_0x8caa('0x8')](config[_0x8caa('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8caa('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x8caa('0xa'),'Accept':_0x8caa('0xa')};function emit(_0x2ec57a,_0x43d063,_0x839052){io['to'](_0x2ec57a)[_0x8caa('0xb')](_0x43d063,_0x839052);}function getTicket(_0x1c7522,_0x20cf9d,_0x5c410f,_0x54c491,_0x53ec2f){logger['info'](_0x8caa('0xc'));var _0x24ff4f=_[_0x8caa('0xd')]({'responder_id':_0x20cf9d['id'],'requester_id':_0x5c410f['id'],'name':util['format'](_0x8caa('0xe'),_0x53ec2f[_0x8caa('0xf')]),'phone':_0x53ec2f[_0x8caa('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8caa('0x11')](_0x54c491[_0x8caa('0x12')],_0x53ec2f,'\x20'),'description':intUtil[_0x8caa('0x11')](_0x54c491[_0x8caa('0x13')],_0x53ec2f,'
'),'tags':getTags(_0x54c491[_0x8caa('0x14')],_0x8caa('0x15'))},getCustomFields(_0x54c491[_0x8caa('0x16')],_0x53ec2f));_0x24ff4f[_0x8caa('0x17')]=_[_0x8caa('0x18')](_[_0x8caa('0x19')](_0x24ff4f[_0x8caa('0x17')],'id'),_0x8caa('0x1a'));return request({'uri':util['format'](_0x8caa('0x1b'),_0x1c7522[_0x8caa('0x1c')]),'method':'POST','body':_0x24ff4f})[_0x8caa('0x1d')](function(_0x1f54d2){logger['info'](_0x8caa('0x1e'));return _0x1f54d2;});}function getUser(_0x48970b,_0x11f174){if(intUtil[_0x8caa('0x1f')](_0x11f174)){return request({'uri':util[_0x8caa('0x20')](_0x8caa('0x21'),_0x48970b[_0x8caa('0x1c')]),'qs':{'email':_0x11f174}})[_0x8caa('0x1d')](function(_0x3f4ac7){if(_0x3f4ac7[_0x8caa('0x22')]){logger['info'](_0x8caa('0x23'));return _['find'](_0x3f4ac7,function(_0x345243){return _0x345243[_0x8caa('0x24')]['email']===_0x11f174;});}else{logger[_0x8caa('0x25')](_0x8caa('0x26'));return request({'uri':util['format'](_0x8caa('0x27'),_0x48970b['remoteUri'])})[_0x8caa('0x1d')](function(_0x223db4){logger['info'](_0x8caa('0x28'));return _0x223db4;});}});}else{logger[_0x8caa('0x25')](_0x8caa('0x29'));return request({'uri':util[_0x8caa('0x20')]('%s/api/v2/agents/me',_0x48970b[_0x8caa('0x1c')])})[_0x8caa('0x1d')](function(_0x2c58f5){logger['info'](_0x8caa('0x28'));return _0x2c58f5;});}}function getEndUser(_0x54a060,_0x56d1b0,_0x1eba51){logger[_0x8caa('0x25')](_0x8caa('0x2a'),_0x1eba51);return request({'uri':util['format'](_0x8caa('0x2b'),_0x54a060[_0x8caa('0x1c')]),'qs':{'phone':_0x1eba51}})['then'](function(_0x4d77bc){if(_0x4d77bc[_0x8caa('0x22')]){logger[_0x8caa('0x25')]('Enduser\x20found!');return _[_0x8caa('0x2c')](_0x4d77bc,{'phone':_0x1eba51});}else{logger[_0x8caa('0x25')](_0x8caa('0x2d'));return request({'uri':util[_0x8caa('0x20')]('%s/api/v2/contacts',_0x54a060[_0x8caa('0x1c')]),'method':_0x8caa('0x2e'),'body':{'name':_0x56d1b0,'phone':_0x1eba51}})['then'](function(_0x4b13ad){logger[_0x8caa('0x25')](_0x8caa('0x2f'));return _0x4b13ad;});}});}function getAuth(_0x1c2c5c){return util[_0x8caa('0x20')]('Basic\x20%s',new Buffer(_0x1c2c5c[_0x8caa('0x30')]+':X')['toString'](_0x8caa('0x31')));}function request(_0x20a470){logger[_0x8caa('0x32')](_0x8caa('0x33'),JSON['stringify'](_0x20a470));return rp(_[_0x8caa('0x8')](_0x20a470,{'method':_0x8caa('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x2f6e23,_0x4bf6c9){var _0x7f2f74=[];if(_0x2f6e23&&_0x2f6e23[_0x8caa('0x22')]>0x0){_0x7f2f74=_['map'](_0x2f6e23,_0x4bf6c9);}return _0x7f2f74;}function getCustomFields(_0xace973,_0x4bff14){var _0x5c50bb=[];var _0x239670={'custom_fields':[]};if(_0xace973[_0x8caa('0x22')]>0x0){_['forEach'](_0xace973,function(_0x5d968e){if(_[_0x8caa('0x35')]([_0x8caa('0x36'),_0x8caa('0x37')],_0x5d968e['type'])&&_0x5d968e['nameField']&&!_0x5d968e[_0x8caa('0x38')]){_0x239670[_0x5d968e[_0x8caa('0x39')][_0x8caa('0x3a')]()]=_0x5d968e['content'][_0x8caa('0x3b')]();}else if(_[_0x8caa('0x35')]([_0x8caa('0x36'),_0x8caa('0x37')],_0x5d968e['type'])&&_0x5d968e['idField']&&_0x5d968e['customField']){_0x239670[_0x8caa('0x17')][_0x8caa('0x3c')]({'id':_0x5d968e[_0x8caa('0x3d')],'value':_0x5d968e[_0x8caa('0x3e')][_0x8caa('0x3b')]()});}else if(_0x5d968e[_0x8caa('0x3f')]==='variable'&&_0x5d968e[_0x8caa('0x40')]&&_0x5d968e['idField']&&_0x5d968e['customField']){_0x4bff14[_0x5d968e[_0x8caa('0x40')]]&&_0x239670['custom_fields'][_0x8caa('0x3c')]({'id':_0x5d968e['idField'],'value':_0x4bff14[_0x5d968e[_0x8caa('0x40')]][_0x8caa('0x3b')]()});}else if(_0x5d968e[_0x8caa('0x3f')]===_0x8caa('0x41')&&_0x5d968e[_0x8caa('0x42')]&&_0x5d968e['Variable'][_0x8caa('0x15')]&&_0x5d968e[_0x8caa('0x3d')]&&_0x5d968e[_0x8caa('0x38')]){_0x4bff14[_0x5d968e['Variable'][_0x8caa('0x15')]['toLowerCase']()]&&_0x239670['custom_fields'][_0x8caa('0x3c')]({'id':_0x5d968e[_0x8caa('0x3d')],'value':_0x4bff14[_0x5d968e['Variable']['name'][_0x8caa('0x3a')]()][_0x8caa('0x3b')]()});}});}return _0x239670;}exports[_0x8caa('0x43')]=function(_0x3c4673,_0x41ed02,_0x69ebed,_0x2a5b89,_0x2e8335,_0x48558f){var _0x3e088a,_0x3d660f;_0x48558f[_0x8caa('0x1c')]=intUtil['stripTrailingSlash'](_0x48558f[_0x8caa('0x1c')]);_0x48558f['serverUrl']=intUtil['stripTrailingSlash'](_0x48558f[_0x8caa('0x44')]);if(_0x2e8335&&_0x2e8335[_0x8caa('0x45')]){logger['info'](_0x8caa('0x46'),'Recording\x20is\x20enabled!');_0x41ed02['recordingURL']=util[_0x8caa('0x20')](_0x8caa('0x47'),_0x48558f[_0x8caa('0x44')],_0x41ed02[_0x8caa('0x48')],md5(_0x41ed02[_0x8caa('0x48')]));}else{_0x41ed02[_0x8caa('0x49')]='';}headers['Authorization']=getAuth(_0x48558f);return getUser(_0x48558f,_0x2a5b89[_0x8caa('0x4a')])['then'](function(_0x2b153c){_0x3e088a=_0x2b153c;logger[_0x8caa('0x25')]('The\x20User\x20ID\x20is:',_0x3e088a['id']);return getEndUser(_0x48558f,_0x41ed02['calleridname'],_0x41ed02[_0x8caa('0x10')]);})['then'](function(_0x4ff907){_0x3d660f=_0x4ff907;logger[_0x8caa('0x25')]('The\x20Enduser\x20ID\x20is:',_0x3d660f['id']);return getTicket(_0x48558f,_0x3e088a,_0x3d660f,_0x69ebed,_0x41ed02);})['then'](function(_0x1223f7){if(_0x1223f7&&_0x1223f7['id']){logger[_0x8caa('0x25')](_0x8caa('0x1e'));logger[_0x8caa('0x25')]('The\x20Ticket\x20ID\x20is:',_0x1223f7['id']);logger[_0x8caa('0x25')](_0x8caa('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8caa('0x20')]('user:%s',_0x2a5b89['name']),_0x8caa('0x4b'),{'uri':util['format'](_0x8caa('0x4c'),_0x48558f['remoteUri'],_0x1223f7['id'])});}})['catch'](function(_0x326122){logger['error']('[QUEUE]',JSON[_0x8caa('0x4d')](_0x326122));});};exports['outbound']=function(_0x13c3be,_0x558094,_0xddd6c9,_0x4017a6,_0x1cecfa,_0x316580,_0x5a82eb){var _0x363e39,_0x11aedf;_0x316580[_0x8caa('0x1c')]=intUtil['stripTrailingSlash'](_0x316580[_0x8caa('0x1c')]);_0x316580['serverUrl']=intUtil[_0x8caa('0x4e')](_0x316580['serverUrl']);if(_0x5a82eb&&_0x5a82eb[_0x8caa('0x4f')]&&_0x5a82eb[_0x8caa('0x4f')]!=='none'){logger['info'](_0x8caa('0x50'),_0x8caa('0x51'));_0x558094[_0x8caa('0x49')]=util[_0x8caa('0x20')](_0x8caa('0x47'),_0x316580['serverUrl'],_0x558094['uniqueid'],md5(_0x558094[_0x8caa('0x48')]));}headers[_0x8caa('0x52')]=getAuth(_0x316580);return getUser(_0x316580,_0x4017a6[_0x8caa('0x4a')])[_0x8caa('0x1d')](function(_0x5446a1){_0x363e39=_0x5446a1;logger['info'](_0x8caa('0x53'),_0x363e39['id']);return getEndUser(_0x316580,_0x558094[_0x8caa('0x54')],_0x558094['destcalleridnum']);})[_0x8caa('0x1d')](function(_0x59929e){_0x11aedf=_0x59929e;logger[_0x8caa('0x25')](_0x8caa('0x55'),_0x11aedf['id']);return getTicket(_0x316580,_0x363e39,_0x11aedf,_0xddd6c9,_0x558094);})[_0x8caa('0x1d')](function(_0x50fe07){if(_0x50fe07&&_0x50fe07['id']){logger[_0x8caa('0x25')](_0x8caa('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x50fe07['id']);logger[_0x8caa('0x25')](_0x8caa('0x50'),_0x8caa('0x56'));emit(util[_0x8caa('0x20')](_0x8caa('0x57'),_0x4017a6[_0x8caa('0x15')]),_0x8caa('0x4b'),{'uri':util['format'](_0x8caa('0x4c'),_0x316580[_0x8caa('0x1c')],_0x50fe07['id'])});}})[_0x8caa('0x58')](function(_0x201edc){logger[_0x8caa('0x59')](_0x8caa('0x50'),JSON['stringify'](_0x201edc));});};exports[_0x8caa('0x5a')]=function(_0xb33e9,_0x2f8bef,_0x5630d3,_0x15e67c,_0x211811,_0xf646ac){var _0x4ad23c,_0x3ac916;_0xf646ac[_0x8caa('0x1c')]=intUtil[_0x8caa('0x4e')](_0xf646ac['remoteUri']);_0xf646ac['serverUrl']=intUtil[_0x8caa('0x4e')](_0xf646ac[_0x8caa('0x44')]);if(_0x211811&&_0x211811[_0x8caa('0x45')]){logger[_0x8caa('0x25')]('['+_0x2f8bef[_0x8caa('0x5b')][_0x8caa('0x5c')]()+']',_0x8caa('0x51'));_0x2f8bef[_0x8caa('0x49')]=util['format'](_0x8caa('0x47'),_0xf646ac['serverUrl'],_0x2f8bef[_0x8caa('0x48')],md5(_0x2f8bef[_0x8caa('0x48')]));}else{_0x2f8bef[_0x8caa('0x49')]='';}headers[_0x8caa('0x52')]=getAuth(_0xf646ac);return getUser(_0xf646ac,'')['then'](function(_0x154eea){_0x4ad23c=_0x154eea;logger['info'](_0x8caa('0x53'),_0x4ad23c['id']);return getEndUser(_0xf646ac,_0x2f8bef[_0x8caa('0xf')],_0x2f8bef[_0x8caa('0x10')]);})[_0x8caa('0x1d')](function(_0x37a1e8){_0x3ac916=_0x37a1e8;logger['info'](_0x8caa('0x55'),_0x3ac916['id']);return getTicket(_0xf646ac,_0x4ad23c,_0x3ac916,_0x5630d3,_0x2f8bef);})[_0x8caa('0x1d')](function(_0x5415d6){if(_0x5415d6){logger[_0x8caa('0x25')](_0x8caa('0x1e'));logger['info'](_0x8caa('0x5d'),_0x5415d6['id']);}})[_0x8caa('0x58')](function(_0x37a10f){logger[_0x8caa('0x59')]('['+_0x2f8bef['lastevent']['toUpperCase']()+']',JSON[_0x8caa('0x4d')](_0x37a10f));});}; \ 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 51a83f4..ea7a0af 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 _0x6bf1=['Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','&entities=contact','find','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','add','task','Task\x20created:','ticketId','user:%s','emit','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:'];(function(_0x39e603,_0xd680d2){var _0x631048=function(_0x57430d){while(--_0x57430d){_0x39e603['push'](_0x39e603['shift']());}};_0x631048(++_0xd680d2);}(_0x6bf1,0xd3));var _0x16bf=function(_0xfd7cb3,_0x7f7744){_0xfd7cb3=_0xfd7cb3-0x0;var _0x4a7f70=_0x6bf1[_0xfd7cb3];return _0x4a7f70;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var moment=require(_0x16bf('0x0'));var Promise=require(_0x16bf('0x1'));var Redis=require(_0x16bf('0x2'));var intUtil=require(_0x16bf('0x3'));var config=require(_0x16bf('0x4'));var logger=require(_0x16bf('0x5'))('freshsales');config[_0x16bf('0x6')]=_[_0x16bf('0x7')](config['redis'],{'host':_0x16bf('0x8'),'port':0x18eb});var io=require(_0x16bf('0x9'))(new Redis(config['redis']));function getAdminId(_0x28a9ce,_0x5d6f5c,_0x1eed46,_0x474f62){return new Promise(function(_0x38833d,_0xc0b567){var _0x950b65=![];var _0x2c3f8c={'method':_0x16bf('0xa'),'uri':_0x474f62+_0x16bf('0xb'),'json':!![]};_0x2c3f8c[_0x16bf('0xc')]=_0x1eed46;logger[_0x16bf('0xd')](_0x16bf('0xe'));return rp(_0x2c3f8c)[_0x16bf('0xf')](function(_0x445c1f){if(_0x445c1f){var _0x532c1b=_0x445c1f[_0x16bf('0x10')];var _0x2a85e4=null;for(_0x2a85e4=0x0;_0x2a85e4<_0x532c1b[_0x16bf('0x11')];_0x2a85e4++){if(_0x532c1b[_0x2a85e4]['email']===_0x28a9ce[_0x16bf('0x12')]){_0x28a9ce[_0x16bf('0x13')]=_0x532c1b[_0x2a85e4]['id'];_0x950b65=!![];}}if(_0x950b65){logger[_0x16bf('0xd')](_0x16bf('0x14'),_0x28a9ce[_0x16bf('0x13')]);_0x38833d(_0x28a9ce);}else{_0xc0b567({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xc0b567({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x16bf('0x15')](function(_0x51cd82){logger[_0x16bf('0x16')]('['+[_0x5d6f5c[_0x16bf('0x17')]()]+']',_0x51cd82[_0x16bf('0x18')]);_0xc0b567(_0x51cd82);});});}function getUser(_0xfc59ac,_0x5b40fb,_0x1ec319){return function(_0x43d5dc){return new Promise(function(_0x132565,_0x2c5b26){var _0x444795={'method':_0x16bf('0xa'),'uri':_0x1ec319+_0x16bf('0xb'),'json':!![]};_0x444795['headers']=_0x5b40fb;logger[_0x16bf('0xd')](_0x16bf('0x19'));return rp(_0x444795)[_0x16bf('0xf')](function(_0x3e14c6){if(_0x3e14c6){var _0x13ced7=_0x3e14c6[_0x16bf('0x10')];var _0x17241a=![];var _0x69284=null;if(_0x43d5dc[_0x16bf('0x1a')]!==null){logger[_0x16bf('0xd')](_0x16bf('0x1b'),_0x43d5dc[_0x16bf('0x1a')]);_0x43d5dc[_0x16bf('0x1c')]=_0x43d5dc['agentEmail'];for(_0x69284=0x0;_0x69284<_0x13ced7[_0x16bf('0x11')];_0x69284++){if(_0x13ced7[_0x69284][_0x16bf('0x1d')]===_0x43d5dc[_0x16bf('0x1a')]){_0x17241a=!![];_0x43d5dc[_0x16bf('0x1e')]=_0x13ced7[_0x69284]['id'];logger[_0x16bf('0xd')](_0x16bf('0x1f'),_0x43d5dc['userId']);}}}if(!_0x17241a){logger[_0x16bf('0xd')]('Admin\x20selected');_0x43d5dc[_0x16bf('0x1c')]=_0x43d5dc[_0x16bf('0x12')];_0x43d5dc[_0x16bf('0x1e')]=_0x43d5dc[_0x16bf('0x13')];_0x17241a=!![];}if(_0x17241a){_0x132565(_0x43d5dc);}else{_0x2c5b26({'statusCode':0x194,'message':_0x16bf('0x20')});}}else{_0x2c5b26({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x16bf('0x15')](function(_0x268806){logger[_0x16bf('0x16')]('['+[_0xfc59ac['toUpperCase']()]+']',_0x268806[_0x16bf('0x18')]);_0x2c5b26(_0x268806);});});};}function searchContact(_0x1d1466,_0x350d59,_0x19a77d,_0x545f70){return new Promise(function(_0x532c37,_0x46b2ff){var _0x539b6f={'method':_0x16bf('0xa'),'headers':_0x350d59,'uri':_0x1d1466+_0x16bf('0x21')+_0x545f70+_0x16bf('0x22')+_0x19a77d+_0x16bf('0x23'),'json':!![]};rp(_0x539b6f)[_0x16bf('0xf')](function(_0x354201){var _0x1ae113=_[_0x16bf('0x24')](_0x354201['contacts']['contacts'],[_0x19a77d,_0x545f70]);_0x532c37(_0x1ae113);})[_0x16bf('0x15')](function(_0x52ffbc){_0x46b2ff(_0x52ffbc);});});}function getEndUser(_0x3b00a6,_0x224c81,_0x288674){return function(_0x2e352d){return new Promise(function(_0x420431,_0x2d45bb){logger[_0x16bf('0xd')](util[_0x16bf('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2e352d[_0x16bf('0x26')]));searchContact(_0x288674,_0x224c81,_0x16bf('0x27'),_0x2e352d[_0x16bf('0x26')])['then'](function(_0x493f3b){if(_0x493f3b){_0x2e352d['endUserId']=_0x493f3b['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x2e352d[_0x16bf('0x28')]);return _0x420431(_0x2e352d);}searchContact(_0x288674,_0x224c81,_0x16bf('0x29'),_0x2e352d[_0x16bf('0x26')])[_0x16bf('0xf')](function(_0x53c67a){if(_0x53c67a){_0x2e352d[_0x16bf('0x28')]=_0x53c67a['id'];logger['info'](_0x16bf('0x2a'),_0x2e352d['endUserId']);return _0x420431(_0x2e352d);}createEndUser(_0x2e352d,_0x3b00a6,_0x224c81,_0x288674)[_0x16bf('0xf')](function(_0x114e29){logger[_0x16bf('0xd')](_0x16bf('0x2b'),_0x114e29[_0x16bf('0x28')]);return _0x420431(_0x114e29);});});})[_0x16bf('0x15')](function(_0x49fcfb){_0x2d45bb(_0x49fcfb);});});};}function createEndUser(_0xf575a6,_0x3172f9,_0x58df7c,_0x41b92d){return new Promise(function(_0x17807b,_0x1c69b6){var _0x39ff2c=moment();var _0x8030de={'method':'POST','uri':_0x41b92d+_0x16bf('0x2c'),'body':{'contact':{'last_name':_0xf575a6[_0x16bf('0x26')],'work_number':_0xf575a6[_0x16bf('0x26')],'mobile_number':_0xf575a6[_0x16bf('0x26')],'owner_id':_0xf575a6[_0x16bf('0x1e')],'created_at':_0x39ff2c[_0x16bf('0x25')](_0x16bf('0x2d'))}},'json':!![]};_0x8030de[_0x16bf('0xc')]=_0x58df7c;logger[_0x16bf('0xd')](_0x16bf('0x2e'));return rp(_0x8030de)['then'](function(_0x57a157){_0xf575a6[_0x16bf('0x28')]=_0x57a157['contact']['id'];_0x17807b(_0xf575a6);})[_0x16bf('0x15')](function(_0x18a932){logger[_0x16bf('0x16')]('['+[_0x3172f9['toUpperCase']()]+']',_0x18a932[_0x16bf('0x18')]);_0x1c69b6(_0x18a932[_0x16bf('0x18')]);});});}function getTicket(_0x8524eb,_0x3ad1ef,_0x17a389,_0x3643b4,_0x1e8768){return function(_0x3731b7){logger['info'](_0x16bf('0x2f'));return new Promise(function(_0x22f831,_0x133787){var _0x48b798=moment();var _0x13cd63={'method':'POST','uri':_0x17a389+_0x16bf('0x30'),'body':{'title':intUtil['getString'](_0x3643b4[_0x16bf('0x31')],_0x1e8768,'\x20'),'description':intUtil[_0x16bf('0x32')](_0x3643b4[_0x16bf('0x33')],_0x1e8768,'\x0a'),'owner_id':_0x3731b7[_0x16bf('0x1e')],'creater_id':_0x3731b7[_0x16bf('0x13')],'targetable_id':_0x3731b7['endUserId'],'targetable_type':'Contact','created_at':_0x48b798['format'](_0x16bf('0x2d')),'due_date':_0x48b798[_0x16bf('0x34')](0x1e,'m')[_0x16bf('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x13cd63[_0x16bf('0xc')]=_0x3ad1ef;return rp(_0x13cd63)[_0x16bf('0xf')](function(_0x17c77b){_0x3731b7['ticketId']=_0x17c77b[_0x16bf('0x35')]['id'];logger[_0x16bf('0xd')](_0x16bf('0x36'),_0x3731b7[_0x16bf('0x37')]);_0x22f831(_0x3731b7);})[_0x16bf('0x15')](function(_0x29d2a3){logger[_0x16bf('0x16')]('['+[_0x8524eb[_0x16bf('0x17')]()]+']',_0x29d2a3[_0x16bf('0x18')]);_0x133787(_0x29d2a3[_0x16bf('0x18')]);});});};}function emit(_0x24d43b,_0x3027b9,_0x408d71){var _0x52f5ee={'uri':_0x24d43b+'/contacts/'+_0x408d71};io['to'](util['format'](_0x16bf('0x38'),_0x3027b9))[_0x16bf('0x39')]('trigger:browser:url',_0x52f5ee);}exports['cs']=function(_0x4aa942,_0x2d7034,_0x262de6,_0x2fa35d,_0x7f9fae,_0x3e1e1d,_0x5044fd,_0x404c83){var _0x14982b={};var _0x16487a={'Authorization':_0x16bf('0x3a')+_0x3e1e1d[_0x16bf('0x3b')]};_0x3e1e1d['remoteUri']=intUtil[_0x16bf('0x3c')](_0x3e1e1d[_0x16bf('0x3d')]);_0x3e1e1d[_0x16bf('0x3e')]=intUtil[_0x16bf('0x3c')](_0x3e1e1d[_0x16bf('0x3e')]);var _0x2072cf=_0x3e1e1d[_0x16bf('0x3d')];_0x14982b[_0x16bf('0x12')]=_0x3e1e1d[_0x16bf('0x3f')];_0x14982b[_0x16bf('0x26')]=_0x404c83[_0x16bf('0x40')]()===_0x16bf('0x41')?_0x2d7034['destcalleridnum']:_0x2d7034[_0x16bf('0x42')];_0x14982b[_0x16bf('0x43')]=_0x404c83==='queue'||_0x404c83===_0x16bf('0x44')?_0x16bf('0x45'):'outbound';if(_0x2fa35d){_0x14982b[_0x16bf('0x1a')]=_0x2fa35d[_0x16bf('0x1d')];}var _0x2a7622=util[_0x16bf('0x25')](_0x16bf('0x46'),_0x3e1e1d['serverUrl'],_0x2d7034['uniqueid'],md5(_0x2d7034[_0x16bf('0x47')]));if(_0x7f9fae&&_0x7f9fae[_0x16bf('0x48')]){logger[_0x16bf('0xd')](_0x16bf('0x49'),_0x16bf('0x4a'));_0x2d7034[_0x16bf('0x4b')]=_0x2a7622;}else if(_0x5044fd&&_0x5044fd[_0x16bf('0x4c')]&&_0x5044fd[_0x16bf('0x4c')]!==_0x16bf('0x4d')){logger[_0x16bf('0xd')]('[OUTBOUND]',_0x16bf('0x4a'));_0x2d7034[_0x16bf('0x4b')]=_0x2a7622;}else{_0x2d7034[_0x16bf('0x4b')]='';}return getAdminId(_0x14982b,_0x404c83,_0x16487a,_0x2072cf)['then'](getUser(_0x404c83,_0x16487a,_0x2072cf))[_0x16bf('0xf')](getEndUser(_0x404c83,_0x16487a,_0x2072cf))['then'](getTicket(_0x404c83,_0x16487a,_0x2072cf,_0x262de6,_0x2d7034))['then'](function(_0x42c2eb){logger[_0x16bf('0xd')](util[_0x16bf('0x25')](_0x16bf('0x4e'),_0x42c2eb[_0x16bf('0x37')]));if(_0x404c83!==_0x16bf('0x44')){logger[_0x16bf('0xd')]('['+[_0x404c83[_0x16bf('0x17')]()]+']',_0x16bf('0x4f'));emit(_0x2072cf,_0x2fa35d[_0x16bf('0x50')],_0x42c2eb[_0x16bf('0x28')]);}})[_0x16bf('0x15')](function(_0x2eebeb){logger['error']('['+[_0x404c83[_0x16bf('0x17')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x2eebeb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x458c=['&entities=contact','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','username','destcalleridnum','calleridnum','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','catch','message','GET','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/lookup?q=','&f='];(function(_0x3fcf62,_0x5044bc){var _0x154b13=function(_0x335490){while(--_0x335490){_0x3fcf62['push'](_0x3fcf62['shift']());}};_0x154b13(++_0x5044bc);}(_0x458c,0x123));var _0xc458=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x458c[_0x1c156e];return _0x58fc22;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc458('0x0'));var util=require(_0xc458('0x1'));var moment=require(_0xc458('0x2'));var Promise=require(_0xc458('0x3'));var Redis=require(_0xc458('0x4'));var intUtil=require(_0xc458('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc458('0x6'))(_0xc458('0x7'));config[_0xc458('0x8')]=_[_0xc458('0x9')](config[_0xc458('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc458('0xa'))(new Redis(config[_0xc458('0x8')]));function getAdminId(_0x3a9ffe,_0x340e0f,_0x35c652,_0x180c5c){return new Promise(function(_0x316570,_0x3dfe85){var _0x380196=![];var _0x650b1b={'method':'GET','uri':_0x180c5c+_0xc458('0xb'),'json':!![]};_0x650b1b[_0xc458('0xc')]=_0x35c652;logger[_0xc458('0xd')](_0xc458('0xe'));return rp(_0x650b1b)[_0xc458('0xf')](function(_0x2ef41c){if(_0x2ef41c){var _0x495c2e=_0x2ef41c['users'];var _0x2a1cad=null;for(_0x2a1cad=0x0;_0x2a1cad<_0x495c2e[_0xc458('0x10')];_0x2a1cad++){if(_0x495c2e[_0x2a1cad][_0xc458('0x11')]===_0x3a9ffe[_0xc458('0x12')]){_0x3a9ffe[_0xc458('0x13')]=_0x495c2e[_0x2a1cad]['id'];_0x380196=!![];}}if(_0x380196){logger['info'](_0xc458('0x14'),_0x3a9ffe['adminId']);_0x316570(_0x3a9ffe);}else{_0x3dfe85({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3dfe85({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc458('0x15')](function(_0x4c535c){logger['error']('['+[_0x340e0f['toUpperCase']()]+']',_0x4c535c[_0xc458('0x16')]);_0x3dfe85(_0x4c535c);});});}function getUser(_0x48382e,_0x38f375,_0x5e1ac6){return function(_0x45dcef){return new Promise(function(_0x58e713,_0xe68969){var _0x442239={'method':_0xc458('0x17'),'uri':_0x5e1ac6+_0xc458('0xb'),'json':!![]};_0x442239['headers']=_0x38f375;logger[_0xc458('0xd')](_0xc458('0x18'));return rp(_0x442239)[_0xc458('0xf')](function(_0x29ef42){if(_0x29ef42){var _0x2dcee5=_0x29ef42[_0xc458('0x19')];var _0xaabdc5=![];var _0x39dacd=null;if(_0x45dcef[_0xc458('0x1a')]!==null){logger[_0xc458('0xd')](_0xc458('0x1b'),_0x45dcef[_0xc458('0x1a')]);_0x45dcef['userEmail']=_0x45dcef[_0xc458('0x1a')];for(_0x39dacd=0x0;_0x39dacd<_0x2dcee5[_0xc458('0x10')];_0x39dacd++){if(_0x2dcee5[_0x39dacd][_0xc458('0x11')]===_0x45dcef[_0xc458('0x1a')]){_0xaabdc5=!![];_0x45dcef[_0xc458('0x1c')]=_0x2dcee5[_0x39dacd]['id'];logger[_0xc458('0xd')](_0xc458('0x1d'),_0x45dcef[_0xc458('0x1c')]);}}}if(!_0xaabdc5){logger[_0xc458('0xd')](_0xc458('0x1e'));_0x45dcef[_0xc458('0x1f')]=_0x45dcef['adminEmail'];_0x45dcef[_0xc458('0x1c')]=_0x45dcef['adminId'];_0xaabdc5=!![];}if(_0xaabdc5){_0x58e713(_0x45dcef);}else{_0xe68969({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xe68969({'statusCode':0x194,'message':_0xc458('0x20')});}})[_0xc458('0x15')](function(_0x361d14){logger[_0xc458('0x21')]('['+[_0x48382e[_0xc458('0x22')]()]+']',_0x361d14[_0xc458('0x16')]);_0xe68969(_0x361d14);});});};}function searchContact(_0xcdc4a0,_0x57f3b8,_0x5c16d6,_0x3d46ef){return new Promise(function(_0x1f0f06,_0x53b350){var _0x306747={'method':_0xc458('0x17'),'headers':_0x57f3b8,'uri':_0xcdc4a0+_0xc458('0x23')+_0x3d46ef+_0xc458('0x24')+_0x5c16d6+_0xc458('0x25'),'json':!![]};rp(_0x306747)[_0xc458('0xf')](function(_0x20aac2){var _0x4f611a=_['find'](_0x20aac2[_0xc458('0x26')][_0xc458('0x26')],[_0x5c16d6,_0x3d46ef]);_0x1f0f06(_0x4f611a);})[_0xc458('0x15')](function(_0x164b82){_0x53b350(_0x164b82);});});}function getEndUser(_0x182977,_0x301f82,_0x2c1d1f){return function(_0x455bdf){return new Promise(function(_0x547b8f,_0x419b3d){logger['info'](util[_0xc458('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x455bdf[_0xc458('0x28')]));searchContact(_0x2c1d1f,_0x301f82,_0xc458('0x29'),_0x455bdf[_0xc458('0x28')])['then'](function(_0xb00e6a){if(_0xb00e6a){_0x455bdf[_0xc458('0x2a')]=_0xb00e6a['id'];logger[_0xc458('0xd')](_0xc458('0x2b'),_0x455bdf[_0xc458('0x2a')]);return _0x547b8f(_0x455bdf);}searchContact(_0x2c1d1f,_0x301f82,_0xc458('0x2c'),_0x455bdf[_0xc458('0x28')])[_0xc458('0xf')](function(_0x546993){if(_0x546993){_0x455bdf[_0xc458('0x2a')]=_0x546993['id'];logger[_0xc458('0xd')](_0xc458('0x2d'),_0x455bdf[_0xc458('0x2a')]);return _0x547b8f(_0x455bdf);}createEndUser(_0x455bdf,_0x182977,_0x301f82,_0x2c1d1f)[_0xc458('0xf')](function(_0x2f4dd6){logger['info'](_0xc458('0x2e'),_0x2f4dd6[_0xc458('0x2a')]);return _0x547b8f(_0x2f4dd6);});});})[_0xc458('0x15')](function(_0x5cd558){_0x419b3d(_0x5cd558);});});};}function createEndUser(_0xeb4566,_0x565b1e,_0xf8136f,_0x29e247){return new Promise(function(_0x73f525,_0x20fae9){var _0x3513ab=moment();var _0x2d274b={'method':_0xc458('0x2f'),'uri':_0x29e247+_0xc458('0x30'),'body':{'contact':{'last_name':_0xeb4566['contactNumber'],'work_number':_0xeb4566[_0xc458('0x28')],'mobile_number':_0xeb4566[_0xc458('0x28')],'owner_id':_0xeb4566['userId'],'created_at':_0x3513ab[_0xc458('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2d274b[_0xc458('0xc')]=_0xf8136f;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2d274b)[_0xc458('0xf')](function(_0x53b705){_0xeb4566[_0xc458('0x2a')]=_0x53b705[_0xc458('0x31')]['id'];_0x73f525(_0xeb4566);})[_0xc458('0x15')](function(_0x464f8c){logger[_0xc458('0x21')]('['+[_0x565b1e[_0xc458('0x22')]()]+']',_0x464f8c[_0xc458('0x16')]);_0x20fae9(_0x464f8c['message']);});});}function getTicket(_0x4e7cc2,_0x577c15,_0x157894,_0xa9a0fe,_0x225585){return function(_0x377e0a){logger['info'](_0xc458('0x32'));return new Promise(function(_0x54d7be,_0x49f78f){var _0x5f13d3=moment();var _0x54adda={'method':_0xc458('0x2f'),'uri':_0x157894+'/api/tasks','body':{'title':intUtil['getString'](_0xa9a0fe[_0xc458('0x33')],_0x225585,'\x20'),'description':intUtil[_0xc458('0x34')](_0xa9a0fe[_0xc458('0x35')],_0x225585,'\x0a'),'owner_id':_0x377e0a[_0xc458('0x1c')],'creater_id':_0x377e0a[_0xc458('0x13')],'targetable_id':_0x377e0a[_0xc458('0x2a')],'targetable_type':'Contact','created_at':_0x5f13d3['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5f13d3[_0xc458('0x36')](0x1e,'m')[_0xc458('0x27')](_0xc458('0x37'))},'json':!![]};_0x54adda[_0xc458('0xc')]=_0x577c15;return rp(_0x54adda)[_0xc458('0xf')](function(_0x203711){_0x377e0a[_0xc458('0x38')]=_0x203711[_0xc458('0x39')]['id'];logger[_0xc458('0xd')](_0xc458('0x3a'),_0x377e0a[_0xc458('0x38')]);_0x54d7be(_0x377e0a);})['catch'](function(_0x53622c){logger[_0xc458('0x21')]('['+[_0x4e7cc2[_0xc458('0x22')]()]+']',_0x53622c[_0xc458('0x16')]);_0x49f78f(_0x53622c[_0xc458('0x16')]);});});};}function emit(_0x5d42ee,_0x2dceee,_0x45dd35){var _0x5989df={'uri':_0x5d42ee+_0xc458('0x3b')+_0x45dd35};io['to'](util[_0xc458('0x27')](_0xc458('0x3c'),_0x2dceee))['emit'](_0xc458('0x3d'),_0x5989df);}exports['cs']=function(_0x1dc17e,_0x369a5f,_0x2b25b1,_0x515fd6,_0x5127a8,_0x826217,_0x1c60ff,_0x3da732){var _0x4b42ce={};var _0xc16721={'Authorization':'Token\x20token='+_0x826217['apiKey']};_0x826217['remoteUri']=intUtil[_0xc458('0x3e')](_0x826217[_0xc458('0x3f')]);_0x826217[_0xc458('0x40')]=intUtil[_0xc458('0x3e')](_0x826217[_0xc458('0x40')]);var _0x14f507=_0x826217[_0xc458('0x3f')];_0x4b42ce[_0xc458('0x12')]=_0x826217[_0xc458('0x41')];_0x4b42ce[_0xc458('0x28')]=_0x3da732['toLowerCase']()==='outbound'?_0x369a5f[_0xc458('0x42')]:_0x369a5f[_0xc458('0x43')];_0x4b42ce['callDirection']=_0x3da732===_0xc458('0x44')||_0x3da732==='unmanaged'?'queue':_0xc458('0x45');if(_0x515fd6){_0x4b42ce[_0xc458('0x1a')]=_0x515fd6[_0xc458('0x11')];}var _0x1a9ce0=util[_0xc458('0x27')](_0xc458('0x46'),_0x826217[_0xc458('0x40')],_0x369a5f[_0xc458('0x47')],md5(_0x369a5f['uniqueid']));if(_0x5127a8&&_0x5127a8[_0xc458('0x48')]){logger['info']('[QUEUE]',_0xc458('0x49'));_0x369a5f[_0xc458('0x4a')]=_0x1a9ce0;}else if(_0x1c60ff&&_0x1c60ff[_0xc458('0x4b')]&&_0x1c60ff[_0xc458('0x4b')]!==_0xc458('0x4c')){logger['info'](_0xc458('0x4d'),_0xc458('0x49'));_0x369a5f[_0xc458('0x4a')]=_0x1a9ce0;}else{_0x369a5f['recordingURL']='';}return getAdminId(_0x4b42ce,_0x3da732,_0xc16721,_0x14f507)[_0xc458('0xf')](getUser(_0x3da732,_0xc16721,_0x14f507))[_0xc458('0xf')](getEndUser(_0x3da732,_0xc16721,_0x14f507))[_0xc458('0xf')](getTicket(_0x3da732,_0xc16721,_0x14f507,_0x2b25b1,_0x369a5f))[_0xc458('0xf')](function(_0x2da3ee){logger[_0xc458('0xd')](util[_0xc458('0x27')](_0xc458('0x4e'),_0x2da3ee[_0xc458('0x38')]));if(_0x3da732!==_0xc458('0x4f')){logger['info']('['+[_0x3da732[_0xc458('0x22')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x14f507,_0x515fd6['name'],_0x2da3ee['endUserId']);}})['catch'](function(_0x584a48){logger[_0xc458('0x21')]('['+[_0x3da732[_0xc458('0x22')]()]+_0xc458('0x50'),util[_0xc458('0x51')](_0x584a48,{'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 7f7ccab..e611d66 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 _0xed4d=['./zoho','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','sugarcrm','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk'];(function(_0x1b0f0f,_0x4511df){var _0x377640=function(_0x2da1ad){while(--_0x2da1ad){_0x1b0f0f['push'](_0x1b0f0f['shift']());}};_0x377640(++_0x4511df);}(_0xed4d,0x1d7));var _0xded4=function(_0x191547,_0x29e95f){_0x191547=_0x191547-0x0;var _0x1b37fb=_0xed4d[_0x191547];return _0x1b37fb;};'use strict';var _=require(_0xded4('0x0'));var util=require(_0xded4('0x1'));var zendesk=require(_0xded4('0x2'));var salesforce=require(_0xded4('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xded4('0x4'));var zoho=require(_0xded4('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xded4('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xded4('0x7'));var integrations=[_0xded4('0x8'),_0xded4('0x9'),'sugarcrm',_0xded4('0xa'),_0xded4('0xb'),_0xded4('0xc'),_0xded4('0xd'),_0xded4('0xe'),'freshsales',_0xded4('0xf')];exports['exec']=function(_0x3d2b58,_0x5e92b9,_0x2624ae,_0x5e05c9,_0x1dd75f,_0x598d2a){if(_0x2624ae){if(_[_0xded4('0x10')](integrations,_0x3d2b58[_0xded4('0x11')][_0xded4('0x12')]())){try{var _0x48da48=null;var _0x36c2c5='';var _0x14e64a=_0x2624ae[_0x3d2b58[_0xded4('0x11')][_0xded4('0x12')]()];if(_0x14e64a){var _0x49da2c=_0x14e64a[_0x3d2b58['data2']];if(_0x49da2c){var _0x1a4f9c=_[_0xded4('0x13')](_0x49da2c[_0xded4('0x14')],{'id':parseInt(_0x3d2b58[_0xded4('0x15')],0xa)});if(_0x1a4f9c){if(_0x5e05c9){if(_0x1dd75f&&_0x5e92b9['queue']){_0x36c2c5=_0xded4('0x16');}else if(_0x5e92b9[_0xded4('0x17')]){_0x36c2c5=_0xded4('0x18');}else{console[_0xded4('0x19')](_0xded4('0x1a'),_0x5e92b9);}}else{_0x36c2c5='unmanaged';}switch(_0x3d2b58['data1'][_0xded4('0x12')]()){case _0xded4('0x8'):zendesk[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case _0xded4('0x9'):salesforce[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case _0xded4('0x1b'):sugarcrm[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case'freshdesk':freshdesk[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case _0xded4('0xb'):zoho[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case _0xded4('0xc'):desk[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case _0xded4('0xd'):vtiger[_0x36c2c5](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a);break;case _0xded4('0x1c'):freshsales['cs'](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a,_0x36c2c5);break;case _0xded4('0xf'):servicenow['cs'](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a,_0x36c2c5);break;case _0xded4('0xe'):dynamics365['cs'](_0x3d2b58,_0x5e92b9,_0x1a4f9c,_0x5e05c9,_0x1dd75f,_0x49da2c,_0x598d2a,_0x36c2c5);break;default:console[_0xded4('0x19')](_0xded4('0x1d'));}}else{_0x48da48=require(_0xded4('0x1e'))(_0x3d2b58[_0xded4('0x11')][_0xded4('0x12')]());_0x48da48[_0xded4('0x1f')](_0xded4('0x20'),util['format'](_0xded4('0x21'),_0x3d2b58['data1'][_0xded4('0x12')](),_0x3d2b58[_0xded4('0x15')]));}}else{_0x48da48=require('../../../../config/logger')(_0x3d2b58[_0xded4('0x11')][_0xded4('0x12')]());_0x48da48[_0xded4('0x1f')](_0xded4('0x20'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x3d2b58[_0xded4('0x11')][_0xded4('0x12')](),_0x3d2b58['data2']));}}else{}}catch(_0x4162c8){console[_0xded4('0x1f')](_0x4162c8);}}}}; \ No newline at end of file +var _0x56ab=['./servicenow','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','data1','zendesk','sugarcrm','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x56ab,0x174));var _0xb56a=function(_0x47ac31,_0x45fc7a){_0x47ac31=_0x47ac31-0x0;var _0x24b428=_0x56ab[_0x47ac31];return _0x24b428;};'use strict';var _=require('lodash');var util=require(_0xb56a('0x0'));var zendesk=require(_0xb56a('0x1'));var salesforce=require(_0xb56a('0x2'));var sugarcrm=require(_0xb56a('0x3'));var freshdesk=require(_0xb56a('0x4'));var zoho=require(_0xb56a('0x5'));var desk=require(_0xb56a('0x6'));var vtiger=require(_0xb56a('0x7'));var servicenow=require(_0xb56a('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xb56a('0x9'));var integrations=['zendesk',_0xb56a('0xa'),'sugarcrm',_0xb56a('0xb'),_0xb56a('0xc'),_0xb56a('0xd'),_0xb56a('0xe'),'dynamics365','freshsales',_0xb56a('0xf')];exports[_0xb56a('0x10')]=function(_0x5a884d,_0x17bfcc,_0x5901ad,_0x3ea4d8,_0x405790,_0x4907b3){if(_0x5901ad){if(_[_0xb56a('0x11')](integrations,_0x5a884d['data1']['toLowerCase']())){try{var _0x10dcdd=null;var _0x4681c0='';var _0x586242=_0x5901ad[_0x5a884d['data1'][_0xb56a('0x12')]()];if(_0x586242){var _0xb2a42f=_0x586242[_0x5a884d[_0xb56a('0x13')]];if(_0xb2a42f){var _0x2f6ae7=_[_0xb56a('0x14')](_0xb2a42f[_0xb56a('0x15')],{'id':parseInt(_0x5a884d[_0xb56a('0x16')],0xa)});if(_0x2f6ae7){if(_0x3ea4d8){if(_0x405790&&_0x17bfcc[_0xb56a('0x17')]){_0x4681c0=_0xb56a('0x17');}else if(_0x17bfcc[_0xb56a('0x18')]){_0x4681c0=_0xb56a('0x19');}else{console[_0xb56a('0x1a')]('EVENT\x20UNKNOWN',_0x17bfcc);}}else{_0x4681c0='unmanaged';}switch(_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')]()){case _0xb56a('0x1c'):zendesk[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xa'):salesforce[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0x1d'):sugarcrm[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xb'):freshdesk[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xc'):zoho[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xd'):desk[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0xe'):vtiger[_0x4681c0](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3);break;case _0xb56a('0x1e'):freshsales['cs'](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3,_0x4681c0);break;case'servicenow':servicenow['cs'](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3,_0x4681c0);break;case _0xb56a('0x1f'):dynamics365['cs'](_0x5a884d,_0x17bfcc,_0x2f6ae7,_0x3ea4d8,_0x405790,_0xb2a42f,_0x4907b3,_0x4681c0);break;default:console[_0xb56a('0x1a')](_0xb56a('0x20'));}}else{_0x10dcdd=require(_0xb56a('0x21'))(_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')]());_0x10dcdd[_0xb56a('0x22')]('[EXEC]',util[_0xb56a('0x23')](_0xb56a('0x24'),_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')](),_0x5a884d['data3']));}}else{_0x10dcdd=require(_0xb56a('0x21'))(_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')]());_0x10dcdd['error']('[EXEC]',util[_0xb56a('0x23')](_0xb56a('0x25'),_0x5a884d[_0xb56a('0x1b')][_0xb56a('0x12')](),_0x5a884d[_0xb56a('0x13')]));}}else{}}catch(_0x13cf44){console[_0xb56a('0x22')](_0x13cf44);}}}}; \ 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 51c9482..2bba1b3 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 _0xe8b8=['lead','WhoId','WhatId','Case','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','validateEmail','sobject','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','account','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','forEach','string','picklist','idField','toString','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[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','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','calleridnum','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','ticketType','ActivityDate','utc','IsReminderSet','contact','endUserType'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe8b8,0xec));var _0x8e8b=function(_0x5d7cd3,_0x40171c){_0x5d7cd3=_0x5d7cd3-0x0;var _0x4aec55=_0xe8b8[_0x5d7cd3];return _0x4aec55;};'use strict';var _=require(_0x8e8b('0x0'));var rp=require(_0x8e8b('0x1'));var moment=require(_0x8e8b('0x2'));var BPromise=require(_0x8e8b('0x3'));var md5=require(_0x8e8b('0x4'));var jsforce=require(_0x8e8b('0x5'));var util=require('util');var Redis=require(_0x8e8b('0x6'));var intUtil=require(_0x8e8b('0x7'));var config=require(_0x8e8b('0x8'));var logger=require(_0x8e8b('0x9'))(_0x8e8b('0xa'));config[_0x8e8b('0xb')]=_[_0x8e8b('0xc')](config[_0x8e8b('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x8e8b('0xd'))(new Redis(config[_0x8e8b('0xb')]));function emit(_0xdef419,_0x2efa92,_0x119a01){io['to'](_0xdef419)[_0x8e8b('0xe')](_0x2efa92,_0x119a01);}function getTicket(_0x1653f6,_0xf4390e,_0x239363,_0x8e9b76,_0x3840bd,_0x331a6e,_0x58303b,_0x4e1cff){var _0x2ca57c=Object[_0x8e8b('0xf')]({},{'OwnerId':_0xf4390e['id'],'Subject':intUtil[_0x8e8b('0x10')](_0x8e9b76[_0x8e8b('0x11')],_0x3840bd,'\x20'),'Description':intUtil['getString'](_0x8e9b76['Descriptions'],_0x3840bd,'\x0a')},getCustomFields(_0x331a6e,_0x3840bd));if(_0x239363){if(_0x8e9b76[_0x8e8b('0x12')]==='Task'){_0x2ca57c[_0x8e8b('0x13')]=moment[_0x8e8b('0x14')]();_0x2ca57c[_0x8e8b('0x15')]=![];_0x2ca57c['IsRecurrence']=![];if(_0x239363['endUserType']===_0x8e8b('0x16')||_0x239363[_0x8e8b('0x17')]===_0x8e8b('0x18')){_0x2ca57c[_0x8e8b('0x19')]=_0x239363['id'];}else if(_0x239363[_0x8e8b('0x17')]==='account'){_0x2ca57c[_0x8e8b('0x1a')]=_0x239363['id'];}}else if(_0x8e9b76[_0x8e8b('0x12')]===_0x8e8b('0x1b')){if(_0x239363[_0x8e8b('0x17')]===_0x8e8b('0x16')){_0x2ca57c['ContactId']=_0x239363['id'];}else if(_0x239363[_0x8e8b('0x17')]==='account'){_0x2ca57c[_0x8e8b('0x1c')]=_0x239363['id'];}else if(_0x239363[_0x8e8b('0x17')]===_0x8e8b('0x18')&&_0x8e9b76[_0x8e8b('0x1d')]){_0x2ca57c[_0x8e9b76[_0x8e8b('0x1d')]]=_0x239363['id'];}else{logger['info'](_0x8e8b('0x1e'));}}}return _0x58303b['sobject'](_0x8e9b76[_0x8e8b('0x12')])[_0x8e8b('0x1f')](_0x2ca57c);}function getUser(_0x3f3034,_0x193975,_0xb18fb0){if(!_['isNil'](_0x193975)&&intUtil[_0x8e8b('0x20')](_0x193975)){var _0x1bab4a={'Email':_0x193975};var _0x5a6e82={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb18fb0[_0x8e8b('0x21')](_0x8e8b('0x22'))[_0x8e8b('0x23')](_0x1bab4a,_0x5a6e82)[_0x8e8b('0x24')]()[_0x8e8b('0x25')](function(_0xd9354f){if(_0xd9354f[_0x8e8b('0x26')]){var _0x419bac=_[_0x8e8b('0x23')](_0xd9354f,function(_0x2f4ac3){return _0x2f4ac3[_0x8e8b('0x27')]===_0x193975;});if(_0x419bac){logger[_0x8e8b('0x28')](_0x8e8b('0x29'),_0x193975);return BPromise[_0x8e8b('0x2a')]({'id':_0x419bac['Id'],'name':_0x419bac[_0x8e8b('0x2b')]});}}else{logger[_0x8e8b('0x28')](_0x8e8b('0x2c'),_0x193975);return _0xb18fb0[_0x8e8b('0x2d')]()[_0x8e8b('0x25')](function(_0x4993e6){return BPromise[_0x8e8b('0x2a')]({'id':_0x4993e6['user_id'],'name':_0x4993e6[_0x8e8b('0x2e')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x193975);return _0xb18fb0['identity']()[_0x8e8b('0x25')](function(_0x580343){return BPromise[_0x8e8b('0x2a')]({'id':_0x580343[_0x8e8b('0x2f')],'name':_0x580343[_0x8e8b('0x2e')]});});}}function getEndUser(_0x3e51ec,_0x4c3e00,_0x50ba57,_0x3201d7,_0x7d18ff){var _0x463b79={'$or':{'Phone':_0x3201d7}};var _0x38b843={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8e8b('0x2a')]()[_0x8e8b('0x25')](function(){logger[_0x8e8b('0x28')](_0x8e8b('0x30'),_0x3201d7,_0x4c3e00[_0x8e8b('0x31')]);switch(_0x4c3e00['moduleSearch']){case _0x8e8b('0x32'):var _0x225386=_[_0x8e8b('0x33')](_0x463b79);if(_0x4c3e00[_0x8e8b('0x34')]){var _0xeef396={};_0xeef396[_0x4c3e00[_0x8e8b('0x34')]]=_0x3201d7;_[_0x8e8b('0x35')](_0x225386[_0x8e8b('0x36')],_0xeef396);}return _0x7d18ff[_0x8e8b('0x21')](_0x8e8b('0x37'))[_0x8e8b('0x23')](_0x225386,_0x38b843)['execute']()['then'](function(_0x48a309){if(_0x48a309&&_0x48a309[_0x8e8b('0x26')]){return _0x48a309;}else{var _0x5a4053=_[_0x8e8b('0x33')](_0x463b79);if(_0x4c3e00[_0x8e8b('0x38')]){var _0x355093={};_0x355093[_0x4c3e00['additionalSearchLead']]=_0x3201d7;_[_0x8e8b('0x35')](_0x5a4053[_0x8e8b('0x36')],_0x355093);}return _0x7d18ff[_0x8e8b('0x21')](_0x8e8b('0x39'))[_0x8e8b('0x23')](_0x5a4053,_0x38b843);}});case _0x8e8b('0x3a'):var _0x47cefd=_[_0x8e8b('0x33')](_0x463b79);if(_0x4c3e00[_0x8e8b('0x3b')]){var _0xeef396={};_0xeef396[_0x4c3e00['additionalSearchAccount']]=_0x3201d7;_[_0x8e8b('0x35')](_0x47cefd[_0x8e8b('0x36')],_0xeef396);}return _0x7d18ff[_0x8e8b('0x21')]('Account')[_0x8e8b('0x23')](_0x47cefd,_0x38b843)[_0x8e8b('0x24')]()[_0x8e8b('0x25')](function(_0x2d8c64){if(_0x2d8c64&&_0x2d8c64[_0x8e8b('0x26')]){return _0x2d8c64;}else{var _0x14fc0a=_['cloneDeep'](_0x463b79);if(_0x4c3e00[_0x8e8b('0x34')]){var _0x40c772={};_0x40c772[_0x4c3e00[_0x8e8b('0x34')]]=_0x3201d7;_['merge'](_0x14fc0a[_0x8e8b('0x36')],_0x40c772);}return _0x7d18ff[_0x8e8b('0x21')]('Contact')[_0x8e8b('0x23')](_0x14fc0a,_0x38b843)[_0x8e8b('0x25')](function(_0x573d3a){if(_0x573d3a&&_0x573d3a['length']){return _0x573d3a;}else{var _0x7f5a81=_['cloneDeep'](_0x463b79);if(_0x4c3e00['additionalSearchLead']){var _0x5b0e96={};_0x5b0e96[_0x4c3e00[_0x8e8b('0x38')]]=_0x3201d7;_[_0x8e8b('0x35')](_0x7f5a81[_0x8e8b('0x36')],_0x5b0e96);}return _0x7d18ff[_0x8e8b('0x21')](_0x8e8b('0x39'))[_0x8e8b('0x23')](_0x7f5a81,_0x38b843);}});}});case _0x8e8b('0x16'):var _0x225386=_[_0x8e8b('0x33')](_0x463b79);if(_0x4c3e00[_0x8e8b('0x34')]){var _0xeef396={};_0xeef396[_0x4c3e00[_0x8e8b('0x34')]]=_0x3201d7;_[_0x8e8b('0x35')](_0x225386['$or'],_0xeef396);}return _0x7d18ff[_0x8e8b('0x21')](_0x8e8b('0x37'))[_0x8e8b('0x23')](_0x225386,_0x38b843)[_0x8e8b('0x24')]();case'lead':var _0x1ab657=_[_0x8e8b('0x33')](_0x463b79);if(_0x4c3e00[_0x8e8b('0x38')]){var _0xeef396={};_0xeef396[_0x4c3e00[_0x8e8b('0x38')]]=_0x3201d7;_[_0x8e8b('0x35')](_0x1ab657[_0x8e8b('0x36')],_0xeef396);}return _0x7d18ff['sobject'](_0x8e8b('0x39'))[_0x8e8b('0x23')](_0x1ab657,_0x38b843);case _0x8e8b('0x3c'):var _0x47cefd=_[_0x8e8b('0x33')](_0x463b79);if(_0x4c3e00[_0x8e8b('0x3b')]){var _0xeef396={};_0xeef396[_0x4c3e00['additionalSearchAccount']]=_0x3201d7;_[_0x8e8b('0x35')](_0x47cefd[_0x8e8b('0x36')],_0xeef396);}return _0x7d18ff[_0x8e8b('0x21')](_0x8e8b('0x3d'))['find'](_0x47cefd,_0x38b843);default:return null;}})[_0x8e8b('0x25')](function(_0x4ead7a){if(_0x4ead7a&&_0x4ead7a[_0x8e8b('0x26')]){var _0x49af71=_[_0x8e8b('0x3e')](_0x4ead7a);if(_0x49af71){return BPromise[_0x8e8b('0x2a')]({'id':_0x49af71['Id'],'name':_0x49af71[_0x8e8b('0x2b')],'phone':_0x49af71[_0x8e8b('0x3f')],'endUserType':_0x49af71[_0x8e8b('0x40')][_0x8e8b('0x41')][_0x8e8b('0x42')]()});}}})[_0x8e8b('0x25')](function(_0x2e31b1){if(_0x2e31b1){logger[_0x8e8b('0x28')](_0x8e8b('0x43'),_0x2e31b1['endUserType'],_0x3201d7);return BPromise['resolve'](_0x2e31b1);}else{logger['info'](_0x8e8b('0x44'),_0x3201d7);var _0x5e6c1b={'Phone':_0x3201d7};if(_0x4c3e00[_0x8e8b('0x45')]){if(_0x4c3e00[_0x8e8b('0x45')]===_0x8e8b('0x16')){logger[_0x8e8b('0x28')](_0x8e8b('0x46'),_0x3201d7,_0x4c3e00['moduleCreate']);_0x5e6c1b[_0x8e8b('0x47')]=_0x50ba57!==_0x8e8b('0x48')?_0x50ba57:util[_0x8e8b('0x49')](_0x8e8b('0x4a'),_0x3201d7);}else if(_0x4c3e00[_0x8e8b('0x45')]==='lead'){logger[_0x8e8b('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3201d7,_0x4c3e00[_0x8e8b('0x45')]);_0x5e6c1b['LastName']=_0x50ba57!==_0x8e8b('0x48')?_0x50ba57:util[_0x8e8b('0x49')](_0x8e8b('0x4a'),_0x3201d7);_0x5e6c1b[_0x8e8b('0x4b')]='No\x20Company';}else if(_0x4c3e00[_0x8e8b('0x45')]==='account'){logger[_0x8e8b('0x28')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3201d7,_0x4c3e00[_0x8e8b('0x45')]);_0x5e6c1b[_0x8e8b('0x2b')]=_0x50ba57!==''?_0x50ba57:util[_0x8e8b('0x49')](_0x8e8b('0x4a'),_0x3201d7);}else{return null;}}return _0x7d18ff['sobject'](_['upperFirst'](_0x4c3e00['moduleCreate']))['create'](_0x5e6c1b)[_0x8e8b('0x25')](function(_0x2e14c5){return BPromise[_0x8e8b('0x2a')]({'id':_0x2e14c5['id'],'endUserType':_0x4c3e00[_0x8e8b('0x45')]});});}});}function getCustomFields(_0x5d3995,_0x10f84f){var _0x464400={};if(_0x5d3995['length']>0x0){_[_0x8e8b('0x4c')](_0x5d3995,function(_0x3cf4a3){if(_['includes']([_0x8e8b('0x4d'),_0x8e8b('0x4e')],_0x3cf4a3[_0x8e8b('0x41')])&&_0x3cf4a3['idField']){_0x464400[_0x3cf4a3[_0x8e8b('0x4f')]]=_0x3cf4a3['content'][_0x8e8b('0x50')]();}else if(_0x3cf4a3[_0x8e8b('0x41')]==='variable'&&_0x3cf4a3[_0x8e8b('0x51')]&&_0x3cf4a3[_0x8e8b('0x4f')]){_0x10f84f[_0x3cf4a3[_0x8e8b('0x51')]]&&(_0x464400[_0x3cf4a3[_0x8e8b('0x4f')]]=_0x10f84f[_0x3cf4a3[_0x8e8b('0x51')]][_0x8e8b('0x50')]());}else if(_0x3cf4a3['type']===_0x8e8b('0x52')&&_0x3cf4a3[_0x8e8b('0x53')]&&_0x3cf4a3['Variable'][_0x8e8b('0x54')]&&_0x3cf4a3[_0x8e8b('0x4f')]){_0x10f84f[_0x3cf4a3[_0x8e8b('0x53')][_0x8e8b('0x54')]['toLowerCase']()]&&(_0x464400[_0x3cf4a3[_0x8e8b('0x4f')]]=_0x10f84f[_0x3cf4a3[_0x8e8b('0x53')][_0x8e8b('0x54')][_0x8e8b('0x42')]()]['toString']());}});}return _0x464400;}function getConnection(_0x563cc8){var _0x47d572=_0x563cc8['password'][_0x8e8b('0x55')](_0x563cc8[_0x8e8b('0x56')]);var _0x4173d3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x563cc8[_0x8e8b('0x57')]||_0x8e8b('0x58'),'clientId':_0x563cc8[_0x8e8b('0x59')],'clientSecret':_0x563cc8[_0x8e8b('0x5a')]}});return _0x4173d3[_0x8e8b('0x5b')](_0x563cc8[_0x8e8b('0x5c')],_0x47d572)[_0x8e8b('0x25')](function(){logger['info'](_0x8e8b('0x5d'));return _0x4173d3;});}exports[_0x8e8b('0x5e')]=function(_0x42bad4,_0x4682b2,_0x42fda4,_0xd058f3,_0x1106da,_0x2ac324){var _0x4a712e,_0xdf7f6b,_0x2bce54,_0x31d231;_0x2ac324['serverUrl']=intUtil[_0x8e8b('0x5f')](_0x2ac324[_0x8e8b('0x60')]);_0x2ac324['remoteUri']=intUtil['stripTrailingSlash'](_0x2ac324[_0x8e8b('0x57')]);if(_0x1106da&&_0x1106da[_0x8e8b('0x61')]){logger['info'](_0x8e8b('0x62'),_0x8e8b('0x63'));_0x4682b2[_0x8e8b('0x64')]=util[_0x8e8b('0x49')](_0x8e8b('0x65'),_0x2ac324[_0x8e8b('0x60')],_0x4682b2[_0x8e8b('0x66')],md5(_0x4682b2[_0x8e8b('0x66')]));}else{_0x4682b2['recordingURL']='';}return getConnection(_0x2ac324)[_0x8e8b('0x25')](function(_0x3c0da7){_0x31d231=_0x3c0da7;return getUser(_0x2ac324,_0xd058f3[_0x8e8b('0x67')],_0x31d231);})[_0x8e8b('0x25')](function(_0x58ed34){_0x4a712e=_0x58ed34;return getEndUser(_0x2ac324,_0x42fda4,_0x4682b2[_0x8e8b('0x68')],_0x4682b2['calleridnum'],_0x31d231);})[_0x8e8b('0x25')](function(_0x33a817){_0xdf7f6b=_0x33a817;return getTicket(_0x2ac324,_0x4a712e,_0xdf7f6b,_0x42fda4,_0x4682b2,_0x42fda4[_0x8e8b('0x69')],_0x31d231,'queue');})[_0x8e8b('0x25')](function(_0x15f6f3){_0x2bce54=_0x15f6f3;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x2bce54['id']);logger[_0x8e8b('0x28')](_0x8e8b('0x6a'),_0x2bce54['id'],_0xd058f3[_0x8e8b('0x54')],_0x2ac324[_0x8e8b('0x41')]);switch(_0x2ac324[_0x8e8b('0x41')]){case _0x8e8b('0x6b'):emit(util[_0x8e8b('0x49')](_0x8e8b('0x6c'),_0xd058f3['name']),_0x8e8b('0x6d'),{'recordId':_0x2bce54['id']});break;case _0x8e8b('0x6e'):emit(util['format'](_0x8e8b('0x6c'),_0xd058f3['name']),_0x8e8b('0x6f'),{'uri':util[_0x8e8b('0x49')](_0x8e8b('0x70'),_0x31d231[_0x8e8b('0x71')],_0x2bce54['id'])});break;default:logger[_0x8e8b('0x72')](_0x8e8b('0x73'));}})[_0x8e8b('0x74')](function(_0x336365){logger[_0x8e8b('0x72')](_0x8e8b('0x62'),_0x336365);});};exports['outbound']=function(_0x354a96,_0x38f28c,_0x7d1640,_0x2855f0,_0x53b447,_0x4fea4e,_0xc1abeb){var _0x353c8f,_0x62f148,_0x5a9c23,_0x202c44;_0x4fea4e[_0x8e8b('0x60')]=intUtil['stripTrailingSlash'](_0x4fea4e[_0x8e8b('0x60')]);_0x4fea4e[_0x8e8b('0x57')]=intUtil[_0x8e8b('0x5f')](_0x4fea4e['remoteUri']);if(_0xc1abeb&&_0xc1abeb[_0x8e8b('0x75')]&&_0xc1abeb['recordingFormat']!==_0x8e8b('0x76')){logger[_0x8e8b('0x28')](_0x8e8b('0x77'),'Recording\x20is\x20enabled!');_0x38f28c[_0x8e8b('0x64')]=util[_0x8e8b('0x49')](_0x8e8b('0x65'),_0x4fea4e['serverUrl'],_0x38f28c[_0x8e8b('0x66')],md5(_0x38f28c[_0x8e8b('0x66')]));}return getConnection(_0x4fea4e)['then'](function(_0x22cd70){_0x202c44=_0x22cd70;return getUser(_0x4fea4e,_0x2855f0[_0x8e8b('0x67')],_0x202c44);})[_0x8e8b('0x25')](function(_0x39722a){_0x353c8f=_0x39722a;return getEndUser(_0x4fea4e,_0x7d1640,_0x38f28c[_0x8e8b('0x78')],_0x38f28c[_0x8e8b('0x79')],_0x202c44);})[_0x8e8b('0x25')](function(_0xb837ec){_0x62f148=_0xb837ec;return getTicket(_0x4fea4e,_0x353c8f,_0x62f148,_0x7d1640,_0x38f28c,_0x7d1640[_0x8e8b('0x69')],_0x202c44,'outbound');})[_0x8e8b('0x25')](function(_0x2de7fa){_0x5a9c23=_0x2de7fa;logger[_0x8e8b('0x28')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5a9c23['id']);logger[_0x8e8b('0x28')](_0x8e8b('0x7a'),_0x5a9c23['id'],_0x2855f0[_0x8e8b('0x54')],_0x4fea4e[_0x8e8b('0x41')]);switch(_0x4fea4e[_0x8e8b('0x41')]){case _0x8e8b('0x6b'):emit(util['format'](_0x8e8b('0x6c'),_0x2855f0[_0x8e8b('0x54')]),_0x8e8b('0x6d'),{'recordId':_0x5a9c23['id']});break;case _0x8e8b('0x6e'):emit(util[_0x8e8b('0x49')](_0x8e8b('0x6c'),_0x2855f0['name']),'trigger:browser:url',{'uri':util[_0x8e8b('0x49')](_0x8e8b('0x70'),_0x202c44[_0x8e8b('0x71')],_0x5a9c23['id'])});break;default:logger['error'](_0x8e8b('0x77'),_0x8e8b('0x7b'));}})[_0x8e8b('0x74')](function(_0x3a5fd8){logger['error']('[OUTBOUND]',_0x3a5fd8);});};exports[_0x8e8b('0x7c')]=function(_0x220ac8,_0x2c5564,_0x324128,_0x3bc492,_0x42e678,_0x416c4c){var _0x456efa,_0x205fe4,_0x2f3448,_0x3045fd;_0x416c4c[_0x8e8b('0x60')]=intUtil['stripTrailingSlash'](_0x416c4c['serverUrl']);_0x416c4c[_0x8e8b('0x57')]=intUtil[_0x8e8b('0x5f')](_0x416c4c[_0x8e8b('0x57')]);if(_0x42e678&&_0x42e678['monitor_format']){logger[_0x8e8b('0x28')]('['+_0x2c5564['lastevent']['toUpperCase']()+']',_0x8e8b('0x63'));_0x2c5564[_0x8e8b('0x64')]=util[_0x8e8b('0x49')](_0x8e8b('0x65'),_0x416c4c[_0x8e8b('0x60')],_0x2c5564['uniqueid'],md5(_0x2c5564['uniqueid']));}else{_0x2c5564[_0x8e8b('0x64')]='';}return getConnection(_0x416c4c)[_0x8e8b('0x25')](function(_0x157918){_0x3045fd=_0x157918;if(!_['isNil'](_0x3bc492)){return getUser(_0x416c4c,_0x3bc492[_0x8e8b('0x54')],_0x3045fd);}else{return getUser(_0x416c4c,null,_0x3045fd);}})[_0x8e8b('0x25')](function(_0x3156fd){_0x456efa=_0x3156fd;return getEndUser(_0x416c4c,_0x324128,_0x2c5564[_0x8e8b('0x68')],_0x2c5564[_0x8e8b('0x7d')],_0x3045fd);})[_0x8e8b('0x25')](function(_0x1fee2a){_0x205fe4=_0x1fee2a;return getTicket(_0x416c4c,_0x456efa,_0x205fe4,_0x324128,_0x2c5564,_0x324128['Fields'],_0x3045fd);})['then'](function(_0x20ff1e){_0x2f3448=_0x20ff1e;logger[_0x8e8b('0x28')]('['+_0x2c5564[_0x8e8b('0x7e')][_0x8e8b('0x7f')]()+_0x8e8b('0x80'),_0x2f3448['id']);logger['info']('['+_0x2c5564['lastevent'][_0x8e8b('0x7f')]()+_0x8e8b('0x81'),_0x416c4c['type']);})[_0x8e8b('0x74')](function(_0x4650c4){logger[_0x8e8b('0x72')]('['+_0x2c5564['lastevent']['toUpperCase']()+']',_0x4650c4);});}; \ No newline at end of file +var _0x8fb6=['No\x20Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','./util','salesforce','redis','localhost','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','lead','account','WhatId','ticketType','contact','ContactId','AccountId','info','sobject','create','isNil','validateEmail','User','find','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company'];(function(_0x300bcb,_0x59a0f2){var _0x50fdca=function(_0xe91b21){while(--_0xe91b21){_0x300bcb['push'](_0x300bcb['shift']());}};_0x50fdca(++_0x59a0f2);}(_0x8fb6,0x1b9));var _0x68fb=function(_0x4f523a,_0x578cbe){_0x4f523a=_0x4f523a-0x0;var _0x508810=_0x8fb6[_0x4f523a];return _0x508810;};'use strict';var _=require('lodash');var rp=require(_0x68fb('0x0'));var moment=require(_0x68fb('0x1'));var BPromise=require(_0x68fb('0x2'));var md5=require(_0x68fb('0x3'));var jsforce=require(_0x68fb('0x4'));var util=require(_0x68fb('0x5'));var Redis=require('ioredis');var intUtil=require(_0x68fb('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x68fb('0x7'));config['redis']=_['defaults'](config[_0x68fb('0x8')],{'host':_0x68fb('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x68fb('0x8')]));function emit(_0x2026c9,_0x39b76d,_0x58447f){io['to'](_0x2026c9)['emit'](_0x39b76d,_0x58447f);}function getTicket(_0x3c1bfc,_0xfae39c,_0x4195c5,_0x339a9a,_0x3d4aba,_0x9a2121,_0x2c1a6b,_0x371ba6){var _0x3d4317=Object[_0x68fb('0xa')]({},{'OwnerId':_0xfae39c['id'],'Subject':intUtil[_0x68fb('0xb')](_0x339a9a[_0x68fb('0xc')],_0x3d4aba,'\x20'),'Description':intUtil['getString'](_0x339a9a[_0x68fb('0xd')],_0x3d4aba,'\x0a')},getCustomFields(_0x9a2121,_0x3d4aba));if(_0x4195c5){if(_0x339a9a['ticketType']===_0x68fb('0xe')){_0x3d4317[_0x68fb('0xf')]=moment['utc']();_0x3d4317[_0x68fb('0x10')]=![];_0x3d4317[_0x68fb('0x11')]=![];if(_0x4195c5[_0x68fb('0x12')]==='contact'||_0x4195c5[_0x68fb('0x12')]===_0x68fb('0x13')){_0x3d4317['WhoId']=_0x4195c5['id'];}else if(_0x4195c5['endUserType']===_0x68fb('0x14')){_0x3d4317[_0x68fb('0x15')]=_0x4195c5['id'];}}else if(_0x339a9a[_0x68fb('0x16')]==='Case'){if(_0x4195c5['endUserType']===_0x68fb('0x17')){_0x3d4317[_0x68fb('0x18')]=_0x4195c5['id'];}else if(_0x4195c5[_0x68fb('0x12')]===_0x68fb('0x14')){_0x3d4317[_0x68fb('0x19')]=_0x4195c5['id'];}else if(_0x4195c5[_0x68fb('0x12')]===_0x68fb('0x13')&&_0x339a9a['leadId']){_0x3d4317[_0x339a9a['leadId']]=_0x4195c5['id'];}else{logger[_0x68fb('0x1a')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2c1a6b[_0x68fb('0x1b')](_0x339a9a[_0x68fb('0x16')])[_0x68fb('0x1c')](_0x3d4317);}function getUser(_0xeffb6b,_0x1f173c,_0x228b79){if(!_[_0x68fb('0x1d')](_0x1f173c)&&intUtil[_0x68fb('0x1e')](_0x1f173c)){var _0x367d6a={'Email':_0x1f173c};var _0xf99da={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x228b79[_0x68fb('0x1b')](_0x68fb('0x1f'))[_0x68fb('0x20')](_0x367d6a,_0xf99da)['execute']()['then'](function(_0x19098b){if(_0x19098b[_0x68fb('0x21')]){var _0x54377e=_[_0x68fb('0x20')](_0x19098b,function(_0xd845){return _0xd845[_0x68fb('0x22')]===_0x1f173c;});if(_0x54377e){logger[_0x68fb('0x1a')]('Agent\x20%s\x20found.',_0x1f173c);return BPromise['resolve']({'id':_0x54377e['Id'],'name':_0x54377e[_0x68fb('0x23')]});}}else{logger['info'](_0x68fb('0x24'),_0x1f173c);return _0x228b79['identity']()['then'](function(_0x38b04b){return BPromise[_0x68fb('0x25')]({'id':_0x38b04b[_0x68fb('0x26')],'name':_0x38b04b[_0x68fb('0x27')]});});}});}else{logger[_0x68fb('0x1a')](_0x68fb('0x24'),_0x1f173c);return _0x228b79['identity']()[_0x68fb('0x28')](function(_0x43c115){return BPromise[_0x68fb('0x25')]({'id':_0x43c115[_0x68fb('0x26')],'name':_0x43c115['display_name']});});}}function getEndUser(_0x2200b0,_0x38340b,_0x3c2a50,_0x5a62a2,_0x1f9931){var _0x1aacc8={'$or':{'Phone':_0x5a62a2}};var _0x3217c3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x68fb('0x25')]()[_0x68fb('0x28')](function(){logger[_0x68fb('0x1a')](_0x68fb('0x29'),_0x5a62a2,_0x38340b[_0x68fb('0x2a')]);switch(_0x38340b[_0x68fb('0x2a')]){case _0x68fb('0x2b'):var _0x328de9=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x2d')]){var _0x1c990e={};_0x1c990e[_0x38340b[_0x68fb('0x2d')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x328de9['$or'],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')]('Contact')[_0x68fb('0x20')](_0x328de9,_0x3217c3)[_0x68fb('0x2f')]()['then'](function(_0x15b3a2){if(_0x15b3a2&&_0x15b3a2['length']){return _0x15b3a2;}else{var _0x3c2155=_['cloneDeep'](_0x1aacc8);if(_0x38340b['additionalSearchLead']){var _0x39d15a={};_0x39d15a[_0x38340b[_0x68fb('0x30')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x3c2155[_0x68fb('0x31')],_0x39d15a);}return _0x1f9931['sobject'](_0x68fb('0x32'))[_0x68fb('0x20')](_0x3c2155,_0x3217c3);}});case _0x68fb('0x33'):var _0x16e4e5=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x34')]){var _0x1c990e={};_0x1c990e[_0x38340b[_0x68fb('0x34')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x16e4e5[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')](_0x68fb('0x35'))[_0x68fb('0x20')](_0x16e4e5,_0x3217c3)['execute']()[_0x68fb('0x28')](function(_0x52f39c){if(_0x52f39c&&_0x52f39c[_0x68fb('0x21')]){return _0x52f39c;}else{var _0x2e113d=_['cloneDeep'](_0x1aacc8);if(_0x38340b['additionalSearchContact']){var _0x1fa665={};_0x1fa665[_0x38340b[_0x68fb('0x2d')]]=_0x5a62a2;_[_0x68fb('0x2e')](_0x2e113d[_0x68fb('0x31')],_0x1fa665);}return _0x1f9931['sobject'](_0x68fb('0x36'))[_0x68fb('0x20')](_0x2e113d,_0x3217c3)[_0x68fb('0x28')](function(_0x336a7c){if(_0x336a7c&&_0x336a7c['length']){return _0x336a7c;}else{var _0x2ded34=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x30')]){var _0x1e1c1f={};_0x1e1c1f[_0x38340b['additionalSearchLead']]=_0x5a62a2;_[_0x68fb('0x2e')](_0x2ded34['$or'],_0x1e1c1f);}return _0x1f9931['sobject'](_0x68fb('0x32'))['find'](_0x2ded34,_0x3217c3);}});}});case'contact':var _0x328de9=_['cloneDeep'](_0x1aacc8);if(_0x38340b[_0x68fb('0x2d')]){var _0x1c990e={};_0x1c990e[_0x38340b[_0x68fb('0x2d')]]=_0x5a62a2;_['merge'](_0x328de9[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')](_0x68fb('0x36'))[_0x68fb('0x20')](_0x328de9,_0x3217c3)[_0x68fb('0x2f')]();case _0x68fb('0x13'):var _0xd89e02=_['cloneDeep'](_0x1aacc8);if(_0x38340b[_0x68fb('0x30')]){var _0x1c990e={};_0x1c990e[_0x38340b['additionalSearchLead']]=_0x5a62a2;_[_0x68fb('0x2e')](_0xd89e02[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931[_0x68fb('0x1b')](_0x68fb('0x32'))[_0x68fb('0x20')](_0xd89e02,_0x3217c3);case _0x68fb('0x14'):var _0x16e4e5=_[_0x68fb('0x2c')](_0x1aacc8);if(_0x38340b[_0x68fb('0x34')]){var _0x1c990e={};_0x1c990e[_0x38340b['additionalSearchAccount']]=_0x5a62a2;_['merge'](_0x16e4e5[_0x68fb('0x31')],_0x1c990e);}return _0x1f9931['sobject'](_0x68fb('0x35'))['find'](_0x16e4e5,_0x3217c3);default:return null;}})[_0x68fb('0x28')](function(_0x5bcd07){if(_0x5bcd07&&_0x5bcd07[_0x68fb('0x21')]){var _0x54654e=_[_0x68fb('0x37')](_0x5bcd07);if(_0x54654e){return BPromise[_0x68fb('0x25')]({'id':_0x54654e['Id'],'name':_0x54654e['Name'],'phone':_0x54654e[_0x68fb('0x38')],'endUserType':_0x54654e[_0x68fb('0x39')][_0x68fb('0x3a')]['toLowerCase']()});}}})['then'](function(_0x3562cc){if(_0x3562cc){logger[_0x68fb('0x1a')](_0x68fb('0x3b'),_0x3562cc[_0x68fb('0x12')],_0x5a62a2);return BPromise['resolve'](_0x3562cc);}else{logger[_0x68fb('0x1a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5a62a2);var _0x523f34={'Phone':_0x5a62a2};if(_0x38340b[_0x68fb('0x3c')]){if(_0x38340b[_0x68fb('0x3c')]==='contact'){logger['info'](_0x68fb('0x3d'),_0x5a62a2,_0x38340b[_0x68fb('0x3c')]);_0x523f34[_0x68fb('0x3e')]=_0x3c2a50!==_0x68fb('0x3f')?_0x3c2a50:util[_0x68fb('0x40')]('Caller\x20-\x20%s',_0x5a62a2);}else if(_0x38340b['moduleCreate']===_0x68fb('0x13')){logger['info'](_0x68fb('0x3d'),_0x5a62a2,_0x38340b[_0x68fb('0x3c')]);_0x523f34[_0x68fb('0x3e')]=_0x3c2a50!==_0x68fb('0x3f')?_0x3c2a50:util[_0x68fb('0x40')](_0x68fb('0x41'),_0x5a62a2);_0x523f34[_0x68fb('0x42')]=_0x68fb('0x43');}else if(_0x38340b['moduleCreate']===_0x68fb('0x14')){logger[_0x68fb('0x1a')](_0x68fb('0x3d'),_0x5a62a2,_0x38340b['moduleCreate']);_0x523f34[_0x68fb('0x23')]=_0x3c2a50!==_0x68fb('0x3f')?_0x3c2a50:util['format']('Caller\x20-\x20%s',_0x5a62a2);}else{return null;}}return _0x1f9931[_0x68fb('0x1b')](_[_0x68fb('0x44')](_0x38340b['moduleCreate']))[_0x68fb('0x1c')](_0x523f34)['then'](function(_0x5e060f){return BPromise['resolve']({'id':_0x5e060f['id'],'endUserType':_0x38340b[_0x68fb('0x3c')]});});}});}function getCustomFields(_0x40d656,_0x4791f2){var _0x1a2784={};if(_0x40d656[_0x68fb('0x21')]>0x0){_[_0x68fb('0x45')](_0x40d656,function(_0x35b7c3){if(_[_0x68fb('0x46')]([_0x68fb('0x47'),'picklist'],_0x35b7c3['type'])&&_0x35b7c3[_0x68fb('0x48')]){_0x1a2784[_0x35b7c3[_0x68fb('0x48')]]=_0x35b7c3[_0x68fb('0x49')][_0x68fb('0x4a')]();}else if(_0x35b7c3[_0x68fb('0x3a')]===_0x68fb('0x4b')&&_0x35b7c3[_0x68fb('0x4c')]&&_0x35b7c3[_0x68fb('0x48')]){_0x4791f2[_0x35b7c3[_0x68fb('0x4c')]]&&(_0x1a2784[_0x35b7c3['idField']]=_0x4791f2[_0x35b7c3['variableName']][_0x68fb('0x4a')]());}else if(_0x35b7c3[_0x68fb('0x3a')]===_0x68fb('0x4d')&&_0x35b7c3[_0x68fb('0x4e')]&&_0x35b7c3[_0x68fb('0x4e')][_0x68fb('0x4f')]&&_0x35b7c3[_0x68fb('0x48')]){_0x4791f2[_0x35b7c3[_0x68fb('0x4e')][_0x68fb('0x4f')][_0x68fb('0x50')]()]&&(_0x1a2784[_0x35b7c3[_0x68fb('0x48')]]=_0x4791f2[_0x35b7c3[_0x68fb('0x4e')][_0x68fb('0x4f')][_0x68fb('0x50')]()][_0x68fb('0x4a')]());}});}return _0x1a2784;}function getConnection(_0x475e58){var _0x2ec989=_0x475e58[_0x68fb('0x51')][_0x68fb('0x52')](_0x475e58[_0x68fb('0x53')]);var _0x387961=new jsforce[(_0x68fb('0x54'))]({'oauth2':{'loginUrl':_0x475e58[_0x68fb('0x55')]||_0x68fb('0x56'),'clientId':_0x475e58[_0x68fb('0x57')],'clientSecret':_0x475e58[_0x68fb('0x58')]}});return _0x387961[_0x68fb('0x59')](_0x475e58[_0x68fb('0x5a')],_0x2ec989)[_0x68fb('0x28')](function(){logger['info']('Connection\x20established.');return _0x387961;});}exports[_0x68fb('0x5b')]=function(_0x306c8e,_0x4dbbfa,_0x38d082,_0x3f6342,_0xfb3449,_0x39ea35){var _0xb996f9,_0x2d6e78,_0x34429d,_0x12f21b;_0x39ea35[_0x68fb('0x5c')]=intUtil[_0x68fb('0x5d')](_0x39ea35[_0x68fb('0x5c')]);_0x39ea35['remoteUri']=intUtil[_0x68fb('0x5d')](_0x39ea35[_0x68fb('0x55')]);if(_0xfb3449&&_0xfb3449[_0x68fb('0x5e')]){logger['info'](_0x68fb('0x5f'),'Recording\x20is\x20enabled!');_0x4dbbfa['recordingURL']=util[_0x68fb('0x40')](_0x68fb('0x60'),_0x39ea35[_0x68fb('0x5c')],_0x4dbbfa['uniqueid'],md5(_0x4dbbfa[_0x68fb('0x61')]));}else{_0x4dbbfa[_0x68fb('0x62')]='';}return getConnection(_0x39ea35)[_0x68fb('0x28')](function(_0x484df6){_0x12f21b=_0x484df6;return getUser(_0x39ea35,_0x3f6342[_0x68fb('0x63')],_0x12f21b);})[_0x68fb('0x28')](function(_0x40d003){_0xb996f9=_0x40d003;return getEndUser(_0x39ea35,_0x38d082,_0x4dbbfa[_0x68fb('0x64')],_0x4dbbfa['calleridnum'],_0x12f21b);})[_0x68fb('0x28')](function(_0x197a11){_0x2d6e78=_0x197a11;return getTicket(_0x39ea35,_0xb996f9,_0x2d6e78,_0x38d082,_0x4dbbfa,_0x38d082['Fields'],_0x12f21b,_0x68fb('0x5b'));})[_0x68fb('0x28')](function(_0x588b14){_0x34429d=_0x588b14;logger[_0x68fb('0x1a')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x34429d['id']);logger[_0x68fb('0x1a')](_0x68fb('0x65'),_0x34429d['id'],_0x3f6342['name'],_0x39ea35[_0x68fb('0x3a')]);switch(_0x39ea35[_0x68fb('0x3a')]){case _0x68fb('0x66'):emit(util[_0x68fb('0x40')](_0x68fb('0x67'),_0x3f6342[_0x68fb('0x4f')]),_0x68fb('0x68'),{'recordId':_0x34429d['id']});break;case'newTab':emit(util['format'](_0x68fb('0x67'),_0x3f6342[_0x68fb('0x4f')]),_0x68fb('0x69'),{'uri':util['format'](_0x68fb('0x6a'),_0x12f21b[_0x68fb('0x6b')],_0x34429d['id'])});break;default:logger[_0x68fb('0x6c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x21489c){logger[_0x68fb('0x6c')](_0x68fb('0x5f'),_0x21489c);});};exports[_0x68fb('0x6d')]=function(_0x2868b8,_0x27a631,_0x48ed2a,_0x412800,_0x1c952c,_0xced70c,_0x41909f){var _0x43d6cc,_0x557be8,_0x1664aa,_0x380ef7;_0xced70c[_0x68fb('0x5c')]=intUtil[_0x68fb('0x5d')](_0xced70c['serverUrl']);_0xced70c['remoteUri']=intUtil[_0x68fb('0x5d')](_0xced70c[_0x68fb('0x55')]);if(_0x41909f&&_0x41909f[_0x68fb('0x6e')]&&_0x41909f[_0x68fb('0x6e')]!==_0x68fb('0x6f')){logger[_0x68fb('0x1a')]('[OUTBOUND]',_0x68fb('0x70'));_0x27a631[_0x68fb('0x62')]=util[_0x68fb('0x40')](_0x68fb('0x60'),_0xced70c[_0x68fb('0x5c')],_0x27a631[_0x68fb('0x61')],md5(_0x27a631[_0x68fb('0x61')]));}return getConnection(_0xced70c)[_0x68fb('0x28')](function(_0x21f069){_0x380ef7=_0x21f069;return getUser(_0xced70c,_0x412800[_0x68fb('0x63')],_0x380ef7);})[_0x68fb('0x28')](function(_0x53ebe1){_0x43d6cc=_0x53ebe1;return getEndUser(_0xced70c,_0x48ed2a,_0x27a631[_0x68fb('0x71')],_0x27a631[_0x68fb('0x72')],_0x380ef7);})[_0x68fb('0x28')](function(_0x3b04b9){_0x557be8=_0x3b04b9;return getTicket(_0xced70c,_0x43d6cc,_0x557be8,_0x48ed2a,_0x27a631,_0x48ed2a[_0x68fb('0x73')],_0x380ef7,_0x68fb('0x6d'));})[_0x68fb('0x28')](function(_0x5c46e9){_0x1664aa=_0x5c46e9;logger['info'](_0x68fb('0x74'),_0x1664aa['id']);logger['info'](_0x68fb('0x75'),_0x1664aa['id'],_0x412800['name'],_0xced70c[_0x68fb('0x3a')]);switch(_0xced70c[_0x68fb('0x3a')]){case _0x68fb('0x66'):emit(util['format'](_0x68fb('0x67'),_0x412800[_0x68fb('0x4f')]),_0x68fb('0x68'),{'recordId':_0x1664aa['id']});break;case'newTab':emit(util[_0x68fb('0x40')](_0x68fb('0x67'),_0x412800[_0x68fb('0x4f')]),'trigger:browser:url',{'uri':util[_0x68fb('0x40')](_0x68fb('0x6a'),_0x380ef7[_0x68fb('0x6b')],_0x1664aa['id'])});break;default:logger[_0x68fb('0x6c')](_0x68fb('0x76'),_0x68fb('0x77'));}})[_0x68fb('0x78')](function(_0x26a617){logger['error'](_0x68fb('0x76'),_0x26a617);});};exports[_0x68fb('0x79')]=function(_0x2ca057,_0x184631,_0x5ce3bf,_0x1af9bd,_0x4a4562,_0x4396b8){var _0x26d901,_0x519545,_0x3f3bb4,_0x4feed2;_0x4396b8[_0x68fb('0x5c')]=intUtil[_0x68fb('0x5d')](_0x4396b8['serverUrl']);_0x4396b8[_0x68fb('0x55')]=intUtil[_0x68fb('0x5d')](_0x4396b8[_0x68fb('0x55')]);if(_0x4a4562&&_0x4a4562['monitor_format']){logger[_0x68fb('0x1a')]('['+_0x184631['lastevent'][_0x68fb('0x7a')]()+']','Recording\x20is\x20enabled!');_0x184631['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4396b8[_0x68fb('0x5c')],_0x184631[_0x68fb('0x61')],md5(_0x184631[_0x68fb('0x61')]));}else{_0x184631['recordingURL']='';}return getConnection(_0x4396b8)[_0x68fb('0x28')](function(_0x532cd3){_0x4feed2=_0x532cd3;if(!_[_0x68fb('0x1d')](_0x1af9bd)){return getUser(_0x4396b8,_0x1af9bd[_0x68fb('0x4f')],_0x4feed2);}else{return getUser(_0x4396b8,null,_0x4feed2);}})['then'](function(_0x2ba604){_0x26d901=_0x2ba604;return getEndUser(_0x4396b8,_0x5ce3bf,_0x184631[_0x68fb('0x64')],_0x184631[_0x68fb('0x7b')],_0x4feed2);})[_0x68fb('0x28')](function(_0x37da99){_0x519545=_0x37da99;return getTicket(_0x4396b8,_0x26d901,_0x519545,_0x5ce3bf,_0x184631,_0x5ce3bf[_0x68fb('0x73')],_0x4feed2);})[_0x68fb('0x28')](function(_0x20d35a){_0x3f3bb4=_0x20d35a;logger['info']('['+_0x184631[_0x68fb('0x7c')][_0x68fb('0x7a')]()+_0x68fb('0x7d'),_0x3f3bb4['id']);logger['info']('['+_0x184631['lastevent'][_0x68fb('0x7a')]()+_0x68fb('0x7e'),_0x4396b8[_0x68fb('0x3a')]);})[_0x68fb('0x78')](function(_0x3ce90c){logger['error']('['+_0x184631['lastevent'][_0x68fb('0x7a')]()+']',_0x3ce90c);});}; \ 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 fa29846..d561189 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 _0xa08f=['Variable',']\x20getTicket\x20input\x20crm','assign','true','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','name','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','ioredis','./util','../../../../config/logger','redis','localhost','GET','result','length','adminId','sys_id','info','toUpperCase','catch','message','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa08f,0x9a));var _0xfa08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa08f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfa08('0x0'));var Promise=require('bluebird');var rp=require(_0xfa08('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0xfa08('0x2'));var intUtil=require(_0xfa08('0x3'));var config=require('../../../../config/environment');var logger=require(_0xfa08('0x4'))('servicenow');config[_0xfa08('0x5')]=_['defaults'](config[_0xfa08('0x5')],{'host':_0xfa08('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfa08('0x5')]));function getAdminUser(_0x2208e2,_0x309b64,_0x33bb8a,_0x3ce5f1,_0x504411,_0x36407c){return new Promise(function(_0x246a47,_0x4e5949){var _0x42b245={'method':_0xfa08('0x7'),'uri':_0x3ce5f1+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x504411+'&'+_0x36407c,'auth':_0x309b64,'json':!![]};return rp(_0x42b245)['then'](function(_0x5cb77a){if(_0x5cb77a[_0xfa08('0x8')][_0xfa08('0x9')]>0x0){_0x33bb8a[_0xfa08('0xa')]=_0x5cb77a['result'][0x0][_0xfa08('0xb')];}logger[_0xfa08('0xc')]('['+[_0x2208e2[_0xfa08('0xd')]()]+'],\x20getAdminUser\x20crm',_0x33bb8a);_0x246a47(_0x33bb8a);})[_0xfa08('0xe')](function(_0x444000){logger['error']('['+[_0x2208e2[_0xfa08('0xd')]()]+']',_0x444000[_0xfa08('0xf')]);_0x4e5949(_0x444000[_0xfa08('0xf')]);});});}function getUser(_0x57594c,_0x76b172,_0x56206d,_0x195403,_0xafa37){return function(_0x3f959c){logger[_0xfa08('0xc')]('['+[_0x57594c[_0xfa08('0xd')]()]+'],\x20getUser\x20input\x20crm',_0x3f959c);return new Promise(function(_0x8333ed,_0x146d71){if(intUtil[_0xfa08('0x10')](_0x3f959c['userEmail'])){var _0x4e437a={'method':'GET','uri':_0x56206d+_0xfa08('0x11')+_0x3f959c[_0xfa08('0x12')]+'&'+_0x195403+'&'+_0xafa37,'auth':_0x76b172,'json':!![]};logger[_0xfa08('0xc')]('['+[_0x57594c['toUpperCase']()]+_0xfa08('0x13'),_0x4e437a);return rp(_0x4e437a)[_0xfa08('0x14')](function(_0x230b0e){logger[_0xfa08('0xc')]('['+[_0x57594c[_0xfa08('0xd')]()]+_0xfa08('0x15'),_0x230b0e);if(_0x230b0e[_0xfa08('0x8')][_0xfa08('0x9')]>0x0&&String(_0x230b0e[_0xfa08('0x8')][0x0]['active'])==='true'){_0x3f959c[_0xfa08('0x16')]=_0x230b0e[_0xfa08('0x8')][0x0][_0xfa08('0xb')];}else{_0x3f959c[_0xfa08('0x16')]=_0x3f959c[_0xfa08('0xa')];_0x3f959c[_0xfa08('0x12')]=_0x3f959c[_0xfa08('0x17')];}logger[_0xfa08('0xc')]('['+[_0x57594c['toUpperCase']()]+_0xfa08('0x18'),_0x3f959c);_0x8333ed(_0x3f959c);})['catch'](function(_0x1c5868){logger[_0xfa08('0x19')]('['+[_0x57594c[_0xfa08('0xd')]()]+']',_0x1c5868[_0xfa08('0xf')]);_0x146d71(_0x1c5868[_0xfa08('0xf')]);});}else{logger[_0xfa08('0xc')]('['+[_0x57594c[_0xfa08('0xd')]()]+_0xfa08('0x1a'));_0x3f959c['userId']=_0x3f959c[_0xfa08('0xa')];_0x3f959c[_0xfa08('0x12')]=_0x3f959c[_0xfa08('0x17')];_0x8333ed(_0x3f959c);}});};}function createEndUser(_0x458f10,_0x586d33,_0x3eead5,_0xc79716,_0x4161f0){logger[_0xfa08('0xc')]('['+[_0x458f10['toUpperCase']()]+_0xfa08('0x1b'),_0x3eead5);return new Promise(function(_0x14ff3d,_0x565966){var _0x300389={'method':_0xfa08('0x1c'),'uri':_0xc79716+'sys_user?'+_0x4161f0,'body':{'user_name':_0x3eead5['endUserNumber'],'roles':_0xfa08('0x1d'),'first_name':_0x3eead5[_0xfa08('0x1e')],'active':'true','date_format':_0xfa08('0x1f'),'phone':_0x3eead5['endUserNumber']},'auth':_0x586d33,'json':!![]};return rp(_0x300389)[_0xfa08('0x14')](function(_0x5c38e8){logger[_0xfa08('0xc')]('['+[_0x458f10[_0xfa08('0xd')]()]+_0xfa08('0x20'),_0x5c38e8['result']);_0x3eead5[_0xfa08('0x21')]=_0x5c38e8['result'][_0xfa08('0xb')];_0x14ff3d(_0x3eead5);})[_0xfa08('0xe')](function(_0x324e48){logger['error']('['+[_0x458f10['toUpperCase']()]+']',_0x324e48['message']);_0x565966(_0x324e48['message']);});});}function getEndUser(_0x33c084,_0x560ae2,_0x2d926d,_0x2285eb,_0x139536){return function(_0x4ace08){logger['info']('['+[_0x33c084[_0xfa08('0xd')]()]+_0xfa08('0x22'),_0x4ace08);return new Promise(function(_0x57c37f,_0xd2780d){var _0x291dad={'method':'GET','uri':_0x2d926d+_0xfa08('0x23')+_0x4ace08['endUserNumber']+'&'+_0x2285eb+'&'+_0x139536,'auth':_0x560ae2,'json':!![]};return rp(_0x291dad)[_0xfa08('0x14')](function(_0x2c1b1c){if(_0x2c1b1c[_0xfa08('0x8')][_0xfa08('0x9')]>0x0){_0x4ace08[_0xfa08('0x21')]=_0x2c1b1c[_0xfa08('0x8')][0x0][_0xfa08('0xb')];logger[_0xfa08('0xc')]('['+[_0x33c084['toUpperCase']()]+_0xfa08('0x24'),_0x4ace08);_0x57c37f(_0x4ace08);}else{return createEndUser(_0x33c084,_0x560ae2,_0x4ace08,_0x2d926d,_0x2285eb)[_0xfa08('0x14')](function(_0x1d7af0){logger[_0xfa08('0xc')]('['+[_0x33c084[_0xfa08('0xd')]()]+_0xfa08('0x25'),_0x1d7af0);_0x57c37f(_0x1d7af0);});}})[_0xfa08('0xe')](function(_0xc37184){logger['error']('['+[_0x33c084[_0xfa08('0xd')]()]+']',_0xc37184['message']);_0xd2780d(_0xc37184[_0xfa08('0xf')]);});});};}function getCustomFields(_0x29cc1e,_0x3b5bf9){var _0x6c9874={};if(_0x29cc1e[_0xfa08('0x9')]>0x0){_[_0xfa08('0x26')](_0x29cc1e,function(_0x51a76a){if(_[_0xfa08('0x27')]([_0xfa08('0x28'),_0xfa08('0x29')],_0x51a76a[_0xfa08('0x2a')])&&_0x51a76a[_0xfa08('0x2b')]&&!_0x51a76a[_0xfa08('0x2c')]){_0x6c9874[_0x51a76a[_0xfa08('0x2b')][_0xfa08('0x2d')]()]=_0x51a76a[_0xfa08('0x2e')][_0xfa08('0x2f')]();}else if(_['includes'](['string',_0xfa08('0x29')],_0x51a76a[_0xfa08('0x2a')])&&_0x51a76a['idField']&&_0x51a76a[_0xfa08('0x2c')]){_0x6c9874[_0x51a76a[_0xfa08('0x30')][_0xfa08('0x2d')]()]=_0x51a76a[_0xfa08('0x2e')][_0xfa08('0x2f')]();}else if(_0x51a76a[_0xfa08('0x2a')]===_0xfa08('0x31')&&_0x51a76a[_0xfa08('0x32')]&&_0x51a76a[_0xfa08('0x30')]&&_0x51a76a[_0xfa08('0x2c')]){_0x6c9874[_0x51a76a[_0xfa08('0x30')][_0xfa08('0x2d')]()]=_0x3b5bf9[_0x51a76a[_0xfa08('0x32')]][_0xfa08('0x2f')]();}else if(_0x51a76a[_0xfa08('0x2a')]===_0xfa08('0x33')&&_0x51a76a[_0xfa08('0x34')]&&_0x51a76a[_0xfa08('0x34')]['name']&&_0x51a76a['idField']&&_0x51a76a[_0xfa08('0x2c')]){_0x6c9874[_0x51a76a['idField'][_0xfa08('0x2d')]()]=_0x3b5bf9[_0x51a76a['Variable']['name'][_0xfa08('0x2d')]()]['toString']();}});}return _0x6c9874;}function getTicket(_0x2f5f16,_0x3cb857,_0x1d32f4,_0x52459f,_0x5a2044,_0x56d75c){return function(_0x1374ab){logger[_0xfa08('0xc')]('['+[_0x2f5f16[_0xfa08('0xd')]()]+_0xfa08('0x35'),_0x1374ab);return new Promise(function(_0x1526a0,_0x2334cb){var _0x1906d8=_0x2f5f16[_0xfa08('0x2d')]()==='outbound'?_0x1374ab[_0xfa08('0x16')]:_0x1374ab[_0xfa08('0x21')];var _0x8bd90a={'method':_0xfa08('0x1c'),'uri':_0x1d32f4+'incident'+'?'+_0x56d75c,'body':Object[_0xfa08('0x36')]({},{'active':_0xfa08('0x37'),'caller_id':_0x1906d8,'assigned_to':_0x1374ab['userId'],'short_description':intUtil['getString'](_0x52459f['Subjects'],_0x5a2044,'\x20'),'description':intUtil[_0xfa08('0x38')](_0x52459f[_0xfa08('0x39')],_0x5a2044,'\x0a')},getCustomFields(_0x52459f[_0xfa08('0x3a')],_0x5a2044)),'auth':_0x3cb857,'json':!![]};return rp(_0x8bd90a)[_0xfa08('0x14')](function(_0xecf275){logger['info']('['+[_0x2f5f16['toUpperCase']()]+_0xfa08('0x3b'),_0xecf275['result']);_0x1374ab[_0xfa08('0x3c')]=_0xecf275[_0xfa08('0x8')][_0xfa08('0xb')];_0x1374ab['ticketNumber']=_0xecf275[_0xfa08('0x8')][_0xfa08('0x3d')];logger[_0xfa08('0xc')]('['+[_0x2f5f16[_0xfa08('0xd')]()]+_0xfa08('0x3e'),_0x1374ab);_0x1526a0(_0x1374ab);})[_0xfa08('0xe')](function(_0x25744c){logger[_0xfa08('0x19')]('['+[_0x2f5f16[_0xfa08('0xd')]()]+']',_0x25744c[_0xfa08('0xf')]);_0x2334cb(_0x25744c[_0xfa08('0xf')]);});});};}function createRemoteTag(_0x492b9c,_0x34895e,_0x1d3266,_0x5b376f){return new Promise(function(_0x7be485,_0x50d0e6){var _0x12aa6f={'method':'POST','uri':_0x1d3266+_0xfa08('0x3f')+'?'+_0x5b376f,'body':{'short_description':_0x492b9c,'global':!![],'active':!![],'name':_0x492b9c},'auth':_0x34895e,'json':!![]};return rp(_0x12aa6f)[_0xfa08('0x14')](function(_0x3cc786){var _0x3e62e2=_0x3cc786['result'][_0xfa08('0xb')];_0x7be485(_0x3e62e2);});});}function getRemoteTag(_0xb3fe9d,_0xb7266e,_0x56a137,_0x3f0b61,_0x5c5e24){return new Promise(function(_0x50cb0c,_0x423d40){var _0xd2f6d9={'method':_0xfa08('0x7'),'uri':_0x56a137+_0xfa08('0x3f')+_0xfa08('0x40')+_0xb3fe9d+'&'+_0x3f0b61,'auth':_0xb7266e,'json':!![]};return rp(_0xd2f6d9)['then'](function(_0x21d07a){if(_0x21d07a['result']['length']>0x0){var _0x5720c1=_0x21d07a['result'][0x0]['sys_id'];_0x50cb0c(_0x5720c1);}else{return createRemoteTag(_0xb3fe9d,_0xb7266e,_0x56a137,_0x3f0b61)[_0xfa08('0x14')](function(_0x272b10){_0x50cb0c(_0x272b10);});}});});}function assignTagToIncident(_0x54b44f,_0x29b557,_0x2c85f9,_0x4191c9,_0x2b17f1){return new Promise(function(_0x3eaeb3,_0x5ea699){var _0x9ea2c={'method':_0xfa08('0x1c'),'uri':_0x2c85f9+'label_entry'+'?'+_0x2b17f1,'body':{'label':_0x54b44f,'table':_0xfa08('0x41'),'id_type':_0xfa08('0x42'),'table_key':_0x4191c9[_0xfa08('0x3c')],'title':_0xfa08('0x43')+_0x4191c9['ticketNumber'],'id_display':_0x4191c9['ticketNumber']},'auth':_0x29b557,'json':!![]};return rp(_0x9ea2c)[_0xfa08('0x14')](function(_0x49dc88){_0x3eaeb3();})['catch'](function(){_0x3eaeb3();});});}function manageTags(_0x45d8b1,_0x332597,_0x3b86d5,_0x52c47a,_0x557394,_0x47a41b,_0x3a86c4){return new Promise(function(_0x3b2d2d,_0x3b240b){var _0x56e5e7=[];_0x332597['forEach'](function(_0x227810){_0x56e5e7['push'](getRemoteTag(_0x227810,_0x3b86d5,_0x52c47a,_0x47a41b,_0x3a86c4));});return Promise[_0xfa08('0x44')](_0x56e5e7)[_0xfa08('0x14')](function(_0x54570d){if(_0x54570d[_0xfa08('0x9')]){logger['info']('['+[_0x45d8b1[_0xfa08('0xd')]()]+_0xfa08('0x45'),_0x54570d);var _0x519f3c=[];_0x54570d[_0xfa08('0x26')](function(_0x1cb6e6){_0x519f3c['push'](assignTagToIncident(_0x1cb6e6,_0x3b86d5,_0x52c47a,_0x557394,_0x47a41b));});return Promise[_0xfa08('0x44')](_0x519f3c)[_0xfa08('0x14')](function(){_0x3b2d2d();})[_0xfa08('0xe')](function(){_0x3b2d2d();});}else{_0x3b2d2d();}});});}function getTags(_0x2323f2,_0x556ca1,_0x61d8ea,_0x14f288,_0x401e03,_0x512e47){return function(_0x1f12cf){return new Promise(function(_0x164ab4,_0x306221){var _0x1be281=[];var _0x2bbf65=_0x14f288[_0xfa08('0x46')];if(_0x2bbf65&&_0x2bbf65[_0xfa08('0x9')]>0x0){_0x1be281=_['map'](_0x2bbf65,_0xfa08('0x47'));}if(_0x1be281[_0xfa08('0x9')]>0x0){return manageTags(_0x2323f2,_0x1be281,_0x556ca1,_0x61d8ea,_0x1f12cf,_0x401e03,_0x512e47)[_0xfa08('0x14')](function(){_0x164ab4(_0x1f12cf);});}else{_0x164ab4(_0x1f12cf);}});};}function emit(_0x4096bb,_0x5a1505,_0x141632){var _0x2d1d1c=_0xfa08('0x48')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xfa08('0x49')+'%255EORDERBYDESCnumber';var _0x53124e={'uri':_0x4096bb+_0xfa08('0x4a')+_0x141632+_0x2d1d1c};io['to'](util['format'](_0xfa08('0x4b'),_0x5a1505))['emit']('trigger:browser:url',_0x53124e);}exports['cs']=function(_0x55a4cd,_0x2bd6df,_0x4525fb,_0x4c756a,_0x4ca145,_0x4394d8,_0x28304b,_0x2f364f){var _0x54f58d={};var _0x1343d6={'user':_0x4394d8[_0xfa08('0x4c')],'pass':_0x4394d8[_0xfa08('0x4d')]};var _0x1b039d=_0xfa08('0x4e');var _0x2d27e0=_0xfa08('0x4f');_0x4394d8['remoteUri']=intUtil[_0xfa08('0x50')](_0x4394d8[_0xfa08('0x51')]);_0x4394d8[_0xfa08('0x52')]=intUtil[_0xfa08('0x50')](_0x4394d8['serverUrl']);var _0x3debf6=util[_0xfa08('0x53')](_0xfa08('0x54'),_0x4394d8[_0xfa08('0x51')]);_0x54f58d[_0xfa08('0x12')]=!_[_0xfa08('0x55')](_0x4c756a)?_0x4c756a[_0xfa08('0x56')]:null;_0x54f58d[_0xfa08('0x17')]=_0x4394d8[_0xfa08('0x56')];_0x54f58d['endUserNumber']=_0x2f364f[_0xfa08('0x2d')]()==='outbound'?_0x2bd6df[_0xfa08('0x57')]:_0x2bd6df[_0xfa08('0x58')];_0x54f58d[_0xfa08('0x59')]=_0x2f364f===_0xfa08('0x5a')||_0x2f364f===_0xfa08('0x5b')?_0xfa08('0x5a'):'outbound';var _0x43de06=util[_0xfa08('0x53')](_0xfa08('0x5c'),_0x4394d8[_0xfa08('0x52')],_0x2bd6df[_0xfa08('0x5d')],md5(_0x2bd6df[_0xfa08('0x5d')]));if(_0x4ca145&&_0x4ca145[_0xfa08('0x5e')]){logger[_0xfa08('0xc')]('[QUEUE]',_0xfa08('0x5f'));_0x2bd6df[_0xfa08('0x60')]=_0x43de06;}else if(_0x28304b&&_0x28304b[_0xfa08('0x61')]&&_0x28304b[_0xfa08('0x61')]!=='none'){logger[_0xfa08('0xc')](_0xfa08('0x62'),'Recording\x20is\x20enabled!');_0x2bd6df['recordingURL']=_0x43de06;}else{_0x2bd6df[_0xfa08('0x60')]='';}return getAdminUser(_0x2f364f,_0x1343d6,_0x54f58d,_0x3debf6,_0x2d27e0,_0x1b039d)[_0xfa08('0x14')](getUser(_0x2f364f,_0x1343d6,_0x3debf6,_0x2d27e0,_0x1b039d))['then'](getEndUser(_0x2f364f,_0x1343d6,_0x3debf6,_0x2d27e0,_0x1b039d))[_0xfa08('0x14')](getTicket(_0x2f364f,_0x1343d6,_0x3debf6,_0x4525fb,_0x2bd6df,_0x2d27e0))[_0xfa08('0x14')](function(_0x1de250){logger[_0xfa08('0xc')](util[_0xfa08('0x53')](_0xfa08('0x63'),_0x1de250[_0xfa08('0x3c')]));logger[_0xfa08('0xc')](util[_0xfa08('0x53')](_0xfa08('0x64'),_0x2f364f));if(_0x2f364f!=='unmanaged'){logger[_0xfa08('0xc')]('['+[_0x2f364f[_0xfa08('0xd')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4394d8[_0xfa08('0x51')],_0x4c756a[_0xfa08('0x47')],_0x1de250[_0xfa08('0x3c')]);}})[_0xfa08('0xe')](function(_0x5cbff0){logger['error']('['+[_0x2f364f[_0xfa08('0xd')]()]+_0xfa08('0x65'),util[_0xfa08('0x66')](_0x5cbff0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc74c=['email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','result','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','content','toString','includes','string','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','?sysparm_query=name%3D','Incident','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','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/'];(function(_0x1b027e,_0xbd225f){var _0x59125b=function(_0x41021e){while(--_0x41021e){_0x1b027e['push'](_0x1b027e['shift']());}};_0x59125b(++_0xbd225f);}(_0xc74c,0x15a));var _0xcc74=function(_0x2a2c99,_0x351a1d){_0x2a2c99=_0x2a2c99-0x0;var _0x5271bf=_0xc74c[_0x2a2c99];return _0x5271bf;};'use strict';var _=require(_0xcc74('0x0'));var Promise=require(_0xcc74('0x1'));var rp=require(_0xcc74('0x2'));var util=require(_0xcc74('0x3'));var md5=require(_0xcc74('0x4'));var Redis=require(_0xcc74('0x5'));var intUtil=require('./util');var config=require(_0xcc74('0x6'));var logger=require(_0xcc74('0x7'))('servicenow');config[_0xcc74('0x8')]=_['defaults'](config[_0xcc74('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcc74('0x9'))(new Redis(config[_0xcc74('0x8')]));function getAdminUser(_0x188431,_0x141acf,_0x498df9,_0x56e1f4,_0x88c7c4,_0x2d0d2f){return new Promise(function(_0x423376,_0x4385bd){var _0x2b6b4b={'method':_0xcc74('0xa'),'uri':_0x56e1f4+_0xcc74('0xb')+'&'+_0x88c7c4+'&'+_0x2d0d2f,'auth':_0x141acf,'json':!![]};return rp(_0x2b6b4b)['then'](function(_0x555317){if(_0x555317['result'][_0xcc74('0xc')]>0x0){_0x498df9[_0xcc74('0xd')]=_0x555317['result'][0x0][_0xcc74('0xe')];}logger[_0xcc74('0xf')]('['+[_0x188431[_0xcc74('0x10')]()]+_0xcc74('0x11'),_0x498df9);_0x423376(_0x498df9);})[_0xcc74('0x12')](function(_0x16a513){logger[_0xcc74('0x13')]('['+[_0x188431[_0xcc74('0x10')]()]+']',_0x16a513['message']);_0x4385bd(_0x16a513[_0xcc74('0x14')]);});});}function getUser(_0xd25265,_0x14387c,_0x25ea2a,_0x3e56d1,_0x4af442){return function(_0x4d2df6){logger[_0xcc74('0xf')]('['+[_0xd25265[_0xcc74('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x4d2df6);return new Promise(function(_0x42867c,_0x33c7aa){if(intUtil[_0xcc74('0x15')](_0x4d2df6[_0xcc74('0x16')])){var _0x464678={'method':'GET','uri':_0x25ea2a+_0xcc74('0x17')+_0x4d2df6['userEmail']+'&'+_0x3e56d1+'&'+_0x4af442,'auth':_0x14387c,'json':!![]};logger[_0xcc74('0xf')]('['+[_0xd25265[_0xcc74('0x10')]()]+_0xcc74('0x18'),_0x464678);return rp(_0x464678)[_0xcc74('0x19')](function(_0x5daf3f){logger[_0xcc74('0xf')]('['+[_0xd25265['toUpperCase']()]+'],\x20getUser\x20entity',_0x5daf3f);if(_0x5daf3f[_0xcc74('0x1a')]['length']>0x0&&String(_0x5daf3f[_0xcc74('0x1a')][0x0]['active'])===_0xcc74('0x1b')){_0x4d2df6[_0xcc74('0x1c')]=_0x5daf3f[_0xcc74('0x1a')][0x0][_0xcc74('0xe')];}else{_0x4d2df6[_0xcc74('0x1c')]=_0x4d2df6['adminId'];_0x4d2df6[_0xcc74('0x16')]=_0x4d2df6['adminEmail'];}logger[_0xcc74('0xf')]('['+[_0xd25265[_0xcc74('0x10')]()]+'],\x20getUser\x20crm',_0x4d2df6);_0x42867c(_0x4d2df6);})['catch'](function(_0xf61b5e){logger[_0xcc74('0x13')]('['+[_0xd25265[_0xcc74('0x10')]()]+']',_0xf61b5e['message']);_0x33c7aa(_0xf61b5e[_0xcc74('0x14')]);});}else{logger['info']('['+[_0xd25265['toUpperCase']()]+_0xcc74('0x1d'));_0x4d2df6[_0xcc74('0x1c')]=_0x4d2df6[_0xcc74('0xd')];_0x4d2df6[_0xcc74('0x16')]=_0x4d2df6[_0xcc74('0x1e')];_0x42867c(_0x4d2df6);}});};}function createEndUser(_0x4e5f4a,_0x5cb057,_0x3ee68d,_0x12edb2,_0x4ffeb9){logger[_0xcc74('0xf')]('['+[_0x4e5f4a[_0xcc74('0x10')]()]+_0xcc74('0x1f'),_0x3ee68d);return new Promise(function(_0x3cb3c9,_0x1a54a4){var _0x288a5e={'method':_0xcc74('0x20'),'uri':_0x12edb2+_0xcc74('0x21')+_0x4ffeb9,'body':{'user_name':_0x3ee68d[_0xcc74('0x22')],'roles':_0xcc74('0x23'),'first_name':_0x3ee68d['endUserNumber'],'active':_0xcc74('0x1b'),'date_format':_0xcc74('0x24'),'phone':_0x3ee68d[_0xcc74('0x22')]},'auth':_0x5cb057,'json':!![]};return rp(_0x288a5e)[_0xcc74('0x19')](function(_0x5a639e){logger['info']('['+[_0x4e5f4a['toUpperCase']()]+_0xcc74('0x25'),_0x5a639e[_0xcc74('0x1a')]);_0x3ee68d[_0xcc74('0x26')]=_0x5a639e['result'][_0xcc74('0xe')];_0x3cb3c9(_0x3ee68d);})[_0xcc74('0x12')](function(_0x3d1ab6){logger[_0xcc74('0x13')]('['+[_0x4e5f4a['toUpperCase']()]+']',_0x3d1ab6[_0xcc74('0x14')]);_0x1a54a4(_0x3d1ab6[_0xcc74('0x14')]);});});}function getEndUser(_0x5db741,_0x4c9368,_0x1bca92,_0x4445ef,_0xeb28b2){return function(_0x2c5d28){logger[_0xcc74('0xf')]('['+[_0x5db741[_0xcc74('0x10')]()]+_0xcc74('0x27'),_0x2c5d28);return new Promise(function(_0x5ab610,_0x1bf2a6){var _0x41b3be={'method':_0xcc74('0xa'),'uri':_0x1bca92+_0xcc74('0x28')+_0x2c5d28[_0xcc74('0x22')]+'&'+_0x4445ef+'&'+_0xeb28b2,'auth':_0x4c9368,'json':!![]};return rp(_0x41b3be)[_0xcc74('0x19')](function(_0x1b0ad1){if(_0x1b0ad1[_0xcc74('0x1a')]['length']>0x0){_0x2c5d28['endUserId']=_0x1b0ad1['result'][0x0]['sys_id'];logger[_0xcc74('0xf')]('['+[_0x5db741[_0xcc74('0x10')]()]+_0xcc74('0x29'),_0x2c5d28);_0x5ab610(_0x2c5d28);}else{return createEndUser(_0x5db741,_0x4c9368,_0x2c5d28,_0x1bca92,_0x4445ef)['then'](function(_0x33f1d6){logger[_0xcc74('0xf')]('['+[_0x5db741[_0xcc74('0x10')]()]+_0xcc74('0x2a'),_0x33f1d6);_0x5ab610(_0x33f1d6);});}})[_0xcc74('0x12')](function(_0x4f4ae9){logger[_0xcc74('0x13')]('['+[_0x5db741[_0xcc74('0x10')]()]+']',_0x4f4ae9[_0xcc74('0x14')]);_0x1bf2a6(_0x4f4ae9['message']);});});};}function getCustomFields(_0xbea9c8,_0x578abf){var _0x10eed0={};if(_0xbea9c8[_0xcc74('0xc')]>0x0){_[_0xcc74('0x2b')](_0xbea9c8,function(_0x361115){if(_['includes'](['string',_0xcc74('0x2c')],_0x361115[_0xcc74('0x2d')])&&_0x361115[_0xcc74('0x2e')]&&!_0x361115[_0xcc74('0x2f')]){_0x10eed0[_0x361115['nameField']['toLowerCase']()]=_0x361115[_0xcc74('0x30')][_0xcc74('0x31')]();}else if(_[_0xcc74('0x32')]([_0xcc74('0x33'),_0xcc74('0x2c')],_0x361115['type'])&&_0x361115[_0xcc74('0x34')]&&_0x361115['customField']){_0x10eed0[_0x361115[_0xcc74('0x34')][_0xcc74('0x35')]()]=_0x361115['content'][_0xcc74('0x31')]();}else if(_0x361115[_0xcc74('0x2d')]===_0xcc74('0x36')&&_0x361115[_0xcc74('0x37')]&&_0x361115['idField']&&_0x361115[_0xcc74('0x2f')]){_0x10eed0[_0x361115[_0xcc74('0x34')]['toLowerCase']()]=_0x578abf[_0x361115[_0xcc74('0x37')]][_0xcc74('0x31')]();}else if(_0x361115[_0xcc74('0x2d')]===_0xcc74('0x38')&&_0x361115[_0xcc74('0x39')]&&_0x361115[_0xcc74('0x39')][_0xcc74('0x3a')]&&_0x361115[_0xcc74('0x34')]&&_0x361115[_0xcc74('0x2f')]){_0x10eed0[_0x361115[_0xcc74('0x34')][_0xcc74('0x35')]()]=_0x578abf[_0x361115[_0xcc74('0x39')]['name'][_0xcc74('0x35')]()][_0xcc74('0x31')]();}});}return _0x10eed0;}function getTicket(_0x3da544,_0x43306f,_0x343731,_0x4d8a8a,_0x3c5362,_0x3531f4){return function(_0x320df4){logger['info']('['+[_0x3da544[_0xcc74('0x10')]()]+_0xcc74('0x3b'),_0x320df4);return new Promise(function(_0x3803ad,_0x1c6c4f){var _0x530fe1=_0x3da544['toLowerCase']()===_0xcc74('0x3c')?_0x320df4[_0xcc74('0x1c')]:_0x320df4[_0xcc74('0x26')];var _0x55c212={'method':'POST','uri':_0x343731+_0xcc74('0x3d')+'?'+_0x3531f4,'body':Object['assign']({},{'active':_0xcc74('0x1b'),'caller_id':_0x530fe1,'assigned_to':_0x320df4['userId'],'short_description':intUtil[_0xcc74('0x3e')](_0x4d8a8a[_0xcc74('0x3f')],_0x3c5362,'\x20'),'description':intUtil[_0xcc74('0x3e')](_0x4d8a8a[_0xcc74('0x40')],_0x3c5362,'\x0a')},getCustomFields(_0x4d8a8a[_0xcc74('0x41')],_0x3c5362)),'auth':_0x43306f,'json':!![]};return rp(_0x55c212)[_0xcc74('0x19')](function(_0x387b60){logger[_0xcc74('0xf')]('['+[_0x3da544[_0xcc74('0x10')]()]+_0xcc74('0x42'),_0x387b60[_0xcc74('0x1a')]);_0x320df4[_0xcc74('0x43')]=_0x387b60[_0xcc74('0x1a')]['sys_id'];_0x320df4[_0xcc74('0x44')]=_0x387b60['result']['number'];logger[_0xcc74('0xf')]('['+[_0x3da544['toUpperCase']()]+']\x20getTicket\x20crm',_0x320df4);_0x3803ad(_0x320df4);})[_0xcc74('0x12')](function(_0x5c670d){logger[_0xcc74('0x13')]('['+[_0x3da544['toUpperCase']()]+']',_0x5c670d[_0xcc74('0x14')]);_0x1c6c4f(_0x5c670d[_0xcc74('0x14')]);});});};}function createRemoteTag(_0x1a57e3,_0x5f2283,_0x395767,_0x290fab){return new Promise(function(_0x2cd9a0,_0x3f7729){var _0x57a068={'method':_0xcc74('0x20'),'uri':_0x395767+_0xcc74('0x45')+'?'+_0x290fab,'body':{'short_description':_0x1a57e3,'global':!![],'active':!![],'name':_0x1a57e3},'auth':_0x5f2283,'json':!![]};return rp(_0x57a068)[_0xcc74('0x19')](function(_0x4322e1){var _0x489387=_0x4322e1[_0xcc74('0x1a')][_0xcc74('0xe')];_0x2cd9a0(_0x489387);});});}function getRemoteTag(_0x3148b2,_0x13ced2,_0x1aadd7,_0xa64141,_0x3e1c8d){return new Promise(function(_0x899c02,_0x1d57ee){var _0x3ded7={'method':'GET','uri':_0x1aadd7+_0xcc74('0x45')+_0xcc74('0x46')+_0x3148b2+'&'+_0xa64141,'auth':_0x13ced2,'json':!![]};return rp(_0x3ded7)['then'](function(_0x4ff8da){if(_0x4ff8da[_0xcc74('0x1a')][_0xcc74('0xc')]>0x0){var _0x21e364=_0x4ff8da[_0xcc74('0x1a')][0x0][_0xcc74('0xe')];_0x899c02(_0x21e364);}else{return createRemoteTag(_0x3148b2,_0x13ced2,_0x1aadd7,_0xa64141)[_0xcc74('0x19')](function(_0x43a9d7){_0x899c02(_0x43a9d7);});}});});}function assignTagToIncident(_0x57114b,_0x2a292d,_0x31b254,_0x823ab1,_0x333c4f){return new Promise(function(_0x4a5f79,_0x5df356){var _0x539ff9={'method':_0xcc74('0x20'),'uri':_0x31b254+'label_entry'+'?'+_0x333c4f,'body':{'label':_0x57114b,'table':'incident','id_type':_0xcc74('0x47'),'table_key':_0x823ab1['ticketId'],'title':'Incident\x20-\x20'+_0x823ab1[_0xcc74('0x44')],'id_display':_0x823ab1[_0xcc74('0x44')]},'auth':_0x2a292d,'json':!![]};return rp(_0x539ff9)[_0xcc74('0x19')](function(_0x4db028){_0x4a5f79();})['catch'](function(){_0x4a5f79();});});}function manageTags(_0x14c85b,_0x4e2917,_0x131d4a,_0x5fa894,_0x2013eb,_0x38cecb,_0x54d25c){return new Promise(function(_0x4364c8,_0x15f2d7){var _0x1c6421=[];_0x4e2917[_0xcc74('0x2b')](function(_0x155f3e){_0x1c6421['push'](getRemoteTag(_0x155f3e,_0x131d4a,_0x5fa894,_0x38cecb,_0x54d25c));});return Promise[_0xcc74('0x48')](_0x1c6421)[_0xcc74('0x19')](function(_0x2f2d61){if(_0x2f2d61['length']){logger[_0xcc74('0xf')]('['+[_0x14c85b[_0xcc74('0x10')]()]+_0xcc74('0x49'),_0x2f2d61);var _0x3a6d78=[];_0x2f2d61[_0xcc74('0x2b')](function(_0x51cb69){_0x3a6d78['push'](assignTagToIncident(_0x51cb69,_0x131d4a,_0x5fa894,_0x2013eb,_0x38cecb));});return Promise[_0xcc74('0x48')](_0x3a6d78)[_0xcc74('0x19')](function(){_0x4364c8();})[_0xcc74('0x12')](function(){_0x4364c8();});}else{_0x4364c8();}});});}function getTags(_0x2fecca,_0x36d406,_0x1cd69c,_0x376330,_0x38a294,_0x3caeee){return function(_0x4e611e){return new Promise(function(_0xc4d2f3,_0x2530b6){var _0x455f54=[];var _0x1f0641=_0x376330[_0xcc74('0x4a')];if(_0x1f0641&&_0x1f0641[_0xcc74('0xc')]>0x0){_0x455f54=_[_0xcc74('0x4b')](_0x1f0641,_0xcc74('0x3a'));}if(_0x455f54[_0xcc74('0xc')]>0x0){return manageTags(_0x2fecca,_0x455f54,_0x36d406,_0x1cd69c,_0x4e611e,_0x38a294,_0x3caeee)[_0xcc74('0x19')](function(){_0xc4d2f3(_0x4e611e);});}else{_0xc4d2f3(_0x4e611e);}});};}function emit(_0x47f965,_0x3ac966,_0x403454){var _0x1f05ef=_0xcc74('0x4c')+_0xcc74('0x4d')+_0xcc74('0x4e')+'%255EORDERBYDESCnumber';var _0x2a3c8d={'uri':_0x47f965+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x403454+_0x1f05ef};io['to'](util[_0xcc74('0x4f')](_0xcc74('0x50'),_0x3ac966))[_0xcc74('0x51')](_0xcc74('0x52'),_0x2a3c8d);}exports['cs']=function(_0x2ade73,_0x16b641,_0x3442de,_0x1c3011,_0x2499c8,_0x5d5d9d,_0x38d7eb,_0x181f94){var _0x55f0ad={};var _0x3f980d={'user':_0x5d5d9d['username'],'pass':_0x5d5d9d[_0xcc74('0x53')]};var _0x159460=_0xcc74('0x54');var _0x48e46e=_0xcc74('0x55');_0x5d5d9d['remoteUri']=intUtil['stripTrailingSlash'](_0x5d5d9d[_0xcc74('0x56')]);_0x5d5d9d[_0xcc74('0x57')]=intUtil[_0xcc74('0x58')](_0x5d5d9d[_0xcc74('0x57')]);var _0x49187b=util[_0xcc74('0x4f')](_0xcc74('0x59'),_0x5d5d9d['remoteUri']);_0x55f0ad[_0xcc74('0x16')]=!_['isNil'](_0x1c3011)?_0x1c3011[_0xcc74('0x5a')]:null;_0x55f0ad['adminEmail']=_0x5d5d9d['email'];_0x55f0ad['endUserNumber']=_0x181f94[_0xcc74('0x35')]()===_0xcc74('0x3c')?_0x16b641[_0xcc74('0x5b')]:_0x16b641[_0xcc74('0x5c')];_0x55f0ad[_0xcc74('0x5d')]=_0x181f94===_0xcc74('0x5e')||_0x181f94===_0xcc74('0x5f')?_0xcc74('0x5e'):_0xcc74('0x3c');var _0x2f8a70=util[_0xcc74('0x4f')](_0xcc74('0x60'),_0x5d5d9d[_0xcc74('0x57')],_0x16b641[_0xcc74('0x61')],md5(_0x16b641[_0xcc74('0x61')]));if(_0x2499c8&&_0x2499c8[_0xcc74('0x62')]){logger[_0xcc74('0xf')](_0xcc74('0x63'),_0xcc74('0x64'));_0x16b641['recordingURL']=_0x2f8a70;}else if(_0x38d7eb&&_0x38d7eb[_0xcc74('0x65')]&&_0x38d7eb[_0xcc74('0x65')]!==_0xcc74('0x66')){logger[_0xcc74('0xf')](_0xcc74('0x67'),_0xcc74('0x64'));_0x16b641['recordingURL']=_0x2f8a70;}else{_0x16b641[_0xcc74('0x68')]='';}return getAdminUser(_0x181f94,_0x3f980d,_0x55f0ad,_0x49187b,_0x48e46e,_0x159460)[_0xcc74('0x19')](getUser(_0x181f94,_0x3f980d,_0x49187b,_0x48e46e,_0x159460))[_0xcc74('0x19')](getEndUser(_0x181f94,_0x3f980d,_0x49187b,_0x48e46e,_0x159460))[_0xcc74('0x19')](getTicket(_0x181f94,_0x3f980d,_0x49187b,_0x3442de,_0x16b641,_0x48e46e))['then'](function(_0x1f308f){logger[_0xcc74('0xf')](util[_0xcc74('0x4f')](_0xcc74('0x69'),_0x1f308f[_0xcc74('0x43')]));logger[_0xcc74('0xf')](util[_0xcc74('0x4f')](_0xcc74('0x6a'),_0x181f94));if(_0x181f94!=='unmanaged'){logger[_0xcc74('0xf')]('['+[_0x181f94[_0xcc74('0x10')]()]+']',_0xcc74('0x6b'));emit(_0x5d5d9d[_0xcc74('0x56')],_0x1c3011[_0xcc74('0x3a')],_0x1f308f[_0xcc74('0x43')]);}})[_0xcc74('0x12')](function(_0x2283c5){logger[_0xcc74('0x13')]('['+[_0x181f94[_0xcc74('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xcc74('0x6c')](_0x2283c5,{'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 62b2e1e..366a00a 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 _0xd42d=['redis','socket.io-emitter','emit','name','getString','Subjects','created_by','description','date_start','duration_hours','duration_minutes','Contacts','length','forEach','variableName','push','idField','JSON','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','info','then','entry_list','find','user_name','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','merge','nameField','customField','content','type','string','custom_fields','variable','customVariable','Variable','toLowerCase','POST','login','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','uniqueid','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','isNil','calleridname','calleridnum','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','sugarcrm'];(function(_0x2165f1,_0x6ed20d){var _0x3d617b=function(_0x5e79f5){while(--_0x5e79f5){_0x2165f1['push'](_0x2165f1['shift']());}};_0x3d617b(++_0x6ed20d);}(_0xd42d,0xd9));var _0xdd42=function(_0x16af5d,_0x951e45){_0x16af5d=_0x16af5d-0x0;var _0x1c88ac=_0xd42d[_0x16af5d];return _0x1c88ac;};'use strict';var _=require('lodash');var rp=require(_0xdd42('0x0'));var BPromise=require(_0xdd42('0x1'));var md5=require('md5');var util=require(_0xdd42('0x2'));var Redis=require(_0xdd42('0x3'));var intUtil=require(_0xdd42('0x4'));var config=require(_0xdd42('0x5'));var logger=require('../../../../config/logger')(_0xdd42('0x6'));config[_0xdd42('0x7')]=_['defaults'](config[_0xdd42('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xdd42('0x8'))(new Redis(config[_0xdd42('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x4e8090,_0x382a3f,_0x238aef){io['to'](_0x4e8090)[_0xdd42('0x9')](_0x382a3f,_0x238aef);}function getTicket(_0x132f41,_0x25abdc,_0x40674d,_0x4b10aa,_0x308525,_0x160bc0,_0x2353cd,_0x44f46a){logger['info']('Creating\x20new\x20ticket...');var _0xd5b383=new Date();var _0x504d96=[{'name':_0xdd42('0xa'),'value':intUtil[_0xdd42('0xb')](_0x4b10aa[_0xdd42('0xc')],_0x308525,'\x20')},{'name':'assigned_user_id','value':_0x25abdc['id']},{'name':_0xdd42('0xd'),'value':_0x25abdc['id']},{'name':_0xdd42('0xe'),'value':intUtil[_0xdd42('0xb')](_0x4b10aa['Descriptions'],_0x308525,'\x0a')},{'name':_0xdd42('0xf'),'value':_0xd5b383['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xdd42('0x10'),'value':'0'},{'name':_0xdd42('0x11'),'value':'15'},{'name':'parent_id','value':_0x40674d['id']},{'name':'parent_type','value':_0xdd42('0x12')},{'name':'parent_name','value':_0x40674d[_0xdd42('0xa')]},{'name':'direction','value':_0x44f46a}];if(_0x160bc0[_0xdd42('0x13')]){_[_0xdd42('0x14')](_0x160bc0,function(_0x2cd199){if(_0x308525[_0x2cd199[_0xdd42('0x15')]]){_0x504d96[_0xdd42('0x16')]({'name':_0x2cd199[_0xdd42('0x17')],'value':_0x308525[_0x2cd199['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xdd42('0x18'),'rest_data':JSON['stringify']({'session':_0x2353cd['id'],'module_name':'Calls','name_value_list':_0x504d96})}});}function getAuth(_0xe0d578){return util[_0xdd42('0x19')](_0xdd42('0x1a'),new Buffer(_0xe0d578[_0xdd42('0x1b')]+':X')[_0xdd42('0x1c')]('base64'));}function getServerInfo(_0x4093de){return request({'form':{'method':_0xdd42('0x1d'),'input_type':_0xdd42('0x18'),'response_type':'JSON','rest_data':JSON[_0xdd42('0x1e')]({'session':_0x4093de['id']})}});}function getUser(_0x259ec7,_0x26499a,_0x4a8544){if(!_['isNil'](_0x26499a)){logger[_0xdd42('0x1f')]('Getting\x20agent\x20with\x20name',_0x26499a);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xdd42('0x18'),'rest_data':JSON['stringify']({'session':_0x4a8544['id'],'module_name':'Employees','query':util[_0xdd42('0x19')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x26499a),'order_by':'','offset':'0','select_fields':['id',_0xdd42('0xa'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdd42('0x20')](function(_0x14adc0){if(_0x14adc0[_0xdd42('0x21')][_0xdd42('0x13')]){var _0x46aee8=_[_0xdd42('0x22')](_0x14adc0[_0xdd42('0x21')],function(_0x5dc51a){return _0x5dc51a['name_value_list'][_0xdd42('0x23')][_0xdd42('0x24')]===_0x26499a;});if(_0x46aee8){logger[_0xdd42('0x1f')](_0xdd42('0x25'));return BPromise['resolve']({'id':_0x46aee8[_0xdd42('0x26')]['id'][_0xdd42('0x24')],'name':_0x46aee8[_0xdd42('0x26')][_0xdd42('0xa')][_0xdd42('0x24')]});}}logger[_0xdd42('0x1f')](_0xdd42('0x27'));return BPromise[_0xdd42('0x28')]({'id':_0x4a8544[_0xdd42('0x26')][_0xdd42('0x29')][_0xdd42('0x24')],'name':_0x4a8544[_0xdd42('0x26')][_0xdd42('0x23')][_0xdd42('0x24')]});});}else{logger['info'](_0xdd42('0x2a'));return BPromise['resolve']({'id':_0x4a8544['name_value_list'][_0xdd42('0x29')][_0xdd42('0x24')],'name':_0x4a8544['name_value_list'][_0xdd42('0x23')][_0xdd42('0x24')]});}}function getEndUser(_0x428214,_0x1cb0fd,_0x2c45e3,_0x4929ef){logger[_0xdd42('0x1f')](_0xdd42('0x2b'),_0x2c45e3);return request({'form':{'method':_0xdd42('0x2c'),'input_type':_0xdd42('0x18'),'response_type':_0xdd42('0x18'),'rest_data':JSON[_0xdd42('0x1e')]({'session':_0x4929ef['id'],'module_name':_0xdd42('0x12'),'query':util[_0xdd42('0x19')](_0xdd42('0x2d'),_0x2c45e3),'order_by':'','offset':'0','select_fields':['id',_0xdd42('0xa'),_0xdd42('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x347286){if(_0x347286['entry_list'][_0xdd42('0x13')]){var _0x4da9ef=_[_0xdd42('0x22')](_0x347286['entry_list'],function(_0x528cb8){return _0x528cb8[_0xdd42('0x26')][_0xdd42('0x2e')][_0xdd42('0x24')]===_0x2c45e3;});if(_0x4da9ef){logger['info'](_0xdd42('0x2f'));return BPromise[_0xdd42('0x28')]({'id':_0x4da9ef[_0xdd42('0x26')]['id'][_0xdd42('0x24')],'name':_0x4da9ef[_0xdd42('0x26')]['name'][_0xdd42('0x24')],'phone':_0x4da9ef[_0xdd42('0x26')][_0xdd42('0x2e')][_0xdd42('0x24')]});}}else{logger['info'](_0xdd42('0x30'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4929ef['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x1cb0fd!==_0xdd42('0x31')?_0x1cb0fd:util[_0xdd42('0x19')](_0xdd42('0x32'),_0x2c45e3)},{'name':_0xdd42('0x2e'),'value':_0x2c45e3}]})}})[_0xdd42('0x20')](function(_0x20ff42){logger[_0xdd42('0x1f')](_0xdd42('0x33'));return BPromise[_0xdd42('0x28')]({'id':_0x20ff42['id'],'name':_0x20ff42[_0xdd42('0x21')][_0xdd42('0x34')][_0xdd42('0x24')],'phone':_0x20ff42[_0xdd42('0x21')][_0xdd42('0x2e')][_0xdd42('0x24')]});});}});}function request(_0x5434ca){logger['debug']('[HTTP]',JSON[_0xdd42('0x1e')](_0x5434ca));return rp(_[_0xdd42('0x35')](def,_0x5434ca));}function getTags(_0x3f8ea3,_0x3fc3af){var _0xac2b0c=[];if(_0x3f8ea3&&_0x3f8ea3[_0xdd42('0x13')]>0x0){_0xac2b0c=_['map'](_0x3f8ea3,_0x3fc3af);}return _0xac2b0c;}function getCustomFields(_0x9c48e1,_0x371a4a){var _0x571159=[];var _0x65e809={'custom_fields':[]};if(_0x9c48e1[_0xdd42('0x13')]>0x0){_[_0xdd42('0x14')](_0x9c48e1,function(_0x4fe2d8){if(_0x4fe2d8['type']==='string'&&_0x4fe2d8[_0xdd42('0x36')]&&!_0x4fe2d8[_0xdd42('0x37')]){_0x65e809[_0x4fe2d8['nameField']['toLowerCase']()]=_0x4fe2d8[_0xdd42('0x38')][_0xdd42('0x1c')]();}else if(_0x4fe2d8[_0xdd42('0x39')]===_0xdd42('0x3a')&&_0x4fe2d8[_0xdd42('0x17')]&&_0x4fe2d8[_0xdd42('0x37')]){_0x65e809[_0xdd42('0x3b')][_0xdd42('0x16')]({'id':_0x4fe2d8[_0xdd42('0x17')],'value':_0x4fe2d8['content'][_0xdd42('0x1c')]()});}else if(_0x4fe2d8['type']===_0xdd42('0x3c')&&_0x4fe2d8['variableName']&&_0x4fe2d8[_0xdd42('0x17')]&&_0x4fe2d8[_0xdd42('0x37')]){_0x371a4a[_0x4fe2d8[_0xdd42('0x15')]]&&_0x65e809[_0xdd42('0x3b')][_0xdd42('0x16')]({'id':_0x4fe2d8['idField'],'value':_0x371a4a[_0x4fe2d8[_0xdd42('0x15')]]['toString']()});}else if(_0x4fe2d8[_0xdd42('0x39')]===_0xdd42('0x3d')&&_0x4fe2d8['Variable']&&_0x4fe2d8[_0xdd42('0x3e')][_0xdd42('0xa')]&&_0x4fe2d8['idField']&&_0x4fe2d8[_0xdd42('0x37')]){_0x371a4a[_0x4fe2d8[_0xdd42('0x3e')]['name'][_0xdd42('0x3f')]()]&&_0x65e809[_0xdd42('0x3b')]['push']({'id':_0x4fe2d8[_0xdd42('0x17')],'value':_0x371a4a[_0x4fe2d8[_0xdd42('0x3e')][_0xdd42('0xa')][_0xdd42('0x3f')]()][_0xdd42('0x1c')]()});}});}return _0x65e809;}function getConnection(_0x1e5c51){return request({'method':_0xdd42('0x40'),'form':{'method':_0xdd42('0x41'),'input_type':_0xdd42('0x18'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1e5c51['username'],'password':_0x1e5c51[_0xdd42('0x42')],'encryption':'PLAIN'},'application':_0xdd42('0x43')})}})[_0xdd42('0x20')](function(_0x1644b3){var _0x16def1=_0x1644b3;if(_0x16def1['id']){def[_0xdd42('0x44')]=_0x16def1['id'];return BPromise[_0xdd42('0x28')](_0x16def1);}else{throw new Error(util[_0xdd42('0x19')](_0xdd42('0x45'),_0x1e5c51['id']));}});}function setRelationship(_0x1c5e7f,_0x445d22,_0x218e93,_0x193c50){return request({'form':{'method':_0xdd42('0x46'),'input_type':_0xdd42('0x18'),'response_type':_0xdd42('0x18'),'rest_data':JSON[_0xdd42('0x1e')]({'session':_0x1c5e7f['id'],'module_name':'Calls','module_id':_0x218e93['id'],'link_field_name':_0x193c50,'related_ids':[_0x445d22['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x25f814,_0xadf197,_0x3ace3f,_0x4dadf9,_0x4cbd10,_0x3fce0b){var _0x56bab6,_0x59bad5,_0x3f6c51,_0x577dcc;_0x3fce0b[_0xdd42('0x47')]=intUtil['stripTrailingSlash'](_0x3fce0b[_0xdd42('0x47')]);_0x3fce0b['serverUrl']=intUtil[_0xdd42('0x48')](_0x3fce0b[_0xdd42('0x49')]);def['uri']=util[_0xdd42('0x19')](_0xdd42('0x4a'),_0x3fce0b['remoteUri']);if(_0x4cbd10&&_0x4cbd10[_0xdd42('0x4b')]){logger[_0xdd42('0x1f')](_0xdd42('0x4c'),_0xdd42('0x4d'));_0xadf197['recordingURL']=util[_0xdd42('0x19')](_0xdd42('0x4e'),_0x3fce0b[_0xdd42('0x49')],_0xadf197['uniqueid'],md5(_0xadf197['uniqueid']));}else{_0xadf197[_0xdd42('0x4f')]='';}return getConnection(_0x3fce0b)[_0xdd42('0x20')](function(_0x4fb850){_0x577dcc=_0x4fb850;return getUser(_0x3fce0b,_0x4dadf9[_0xdd42('0xa')],_0x577dcc);})[_0xdd42('0x20')](function(_0x4b64ed){_0x56bab6=_0x4b64ed;logger[_0xdd42('0x1f')](_0xdd42('0x50'),_0x56bab6['id']);return getEndUser(_0x3fce0b,_0xadf197['calleridname'],_0xadf197['calleridnum'],_0x577dcc);})[_0xdd42('0x20')](function(_0x2e19c5){_0x59bad5=_0x2e19c5;logger[_0xdd42('0x1f')](_0xdd42('0x51'),_0x59bad5['id']);return getTicket(_0x3fce0b,_0x56bab6,_0x59bad5,_0x3ace3f,_0xadf197,_0x3ace3f['Fields'],_0x577dcc,_0xdd42('0x52'));})['then'](function(_0x3c600d){_0x3f6c51=_0x3c600d;logger[_0xdd42('0x1f')]('Ticket\x20created!');logger['info'](_0xdd42('0x53'),_0x3f6c51['id']);return setRelationship(_0x577dcc,_0x56bab6,_0x3f6c51,_0xdd42('0x54'));})[_0xdd42('0x20')](function(){return setRelationship(_0x577dcc,_0x59bad5,_0x3f6c51,_0xdd42('0x55'));})['then'](function(){return getServerInfo(_0x577dcc);})[_0xdd42('0x20')](function(_0x1d37bb){var _0x61d04e=parseInt(_0x1d37bb[_0xdd42('0x56')][_0xdd42('0x57')](0x0));var _0x590133=util[_0xdd42('0x19')](_0xdd42('0x58'),_0x3fce0b[_0xdd42('0x47')],_0x3f6c51['id']);if(_0x61d04e>0x6){_0x590133=util[_0xdd42('0x19')](_0xdd42('0x59'),_0x3fce0b[_0xdd42('0x47')],_0x3f6c51['id']);}logger[_0xdd42('0x1f')](_0xdd42('0x4c'),_0xdd42('0x5a'));emit(util[_0xdd42('0x19')]('user:%s',_0x4dadf9[_0xdd42('0xa')]),_0xdd42('0x5b'),{'uri':_0x590133});})[_0xdd42('0x5c')](function(_0x4684b3){logger[_0xdd42('0x5d')](_0xdd42('0x4c'),JSON[_0xdd42('0x1e')](_0x4684b3));});};exports[_0xdd42('0x5e')]=function(_0x3768fc,_0x2be534,_0x47e356,_0x49d8b8,_0x38e3d4,_0x1c2679,_0x4ad5e2){var _0x4972d0,_0x965b88,_0x586126,_0x413cb2;_0x1c2679['remoteUri']=intUtil[_0xdd42('0x48')](_0x1c2679[_0xdd42('0x47')]);_0x1c2679[_0xdd42('0x49')]=intUtil[_0xdd42('0x48')](_0x1c2679['serverUrl']);def[_0xdd42('0x5f')]=util[_0xdd42('0x19')](_0xdd42('0x4a'),_0x1c2679[_0xdd42('0x47')]);if(_0x4ad5e2&&_0x4ad5e2[_0xdd42('0x60')]&&_0x4ad5e2[_0xdd42('0x60')]!==_0xdd42('0x61')){logger['info']('[OUTBOUND]',_0xdd42('0x4d'));_0x2be534['recordingURL']=util[_0xdd42('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c2679['serverUrl'],_0x2be534['uniqueid'],md5(_0x2be534[_0xdd42('0x62')]));}return getConnection(_0x1c2679)[_0xdd42('0x20')](function(_0x2b2c24){_0x413cb2=_0x2b2c24;return getUser(_0x1c2679,_0x49d8b8[_0xdd42('0xa')],_0x413cb2);})['then'](function(_0x1be9ca){_0x4972d0=_0x1be9ca;logger['info'](_0xdd42('0x50'),_0x4972d0['id']);return getEndUser(_0x1c2679,_0x2be534[_0xdd42('0x63')],_0x2be534[_0xdd42('0x64')],_0x413cb2);})['then'](function(_0x326541){_0x965b88=_0x326541;logger['info']('The\x20Enduser\x20ID\x20is:',_0x965b88['id']);return getTicket(_0x1c2679,_0x4972d0,_0x965b88,_0x47e356,_0x2be534,_0x47e356[_0xdd42('0x65')],_0x413cb2,_0xdd42('0x66'));})[_0xdd42('0x20')](function(_0x3a6bb7){_0x586126=_0x3a6bb7;logger['info'](_0xdd42('0x67'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x586126['id']);return setRelationship(_0x413cb2,_0x4972d0,_0x586126,_0xdd42('0x54'));})[_0xdd42('0x20')](function(){return setRelationship(_0x413cb2,_0x965b88,_0x586126,'contacts');})[_0xdd42('0x20')](function(){return getServerInfo(_0x413cb2);})['then'](function(_0x58cf55){var _0x43caaa=parseInt(_0x58cf55[_0xdd42('0x56')][_0xdd42('0x57')](0x0));var _0x505b94=util['format'](_0xdd42('0x58'),_0x1c2679[_0xdd42('0x47')],_0x586126['id']);if(_0x43caaa>0x6){_0x505b94=util[_0xdd42('0x19')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1c2679[_0xdd42('0x47')],_0x586126['id']);}logger[_0xdd42('0x1f')](_0xdd42('0x68'),_0xdd42('0x5a'));emit(util[_0xdd42('0x19')](_0xdd42('0x69'),_0x49d8b8[_0xdd42('0xa')]),_0xdd42('0x5b'),{'uri':_0x505b94});})['catch'](function(_0x1ccfd1){logger[_0xdd42('0x5d')](_0xdd42('0x68'),JSON[_0xdd42('0x1e')](_0x1ccfd1));});};exports[_0xdd42('0x6a')]=function(_0x8c54e3,_0x5a6ba5,_0x231519,_0x5e795d,_0xba7e7c,_0x30455a){var _0x422eaa,_0x3e86e4,_0x2e201b,_0x1f043f;_0x30455a[_0xdd42('0x47')]=intUtil[_0xdd42('0x48')](_0x30455a['remoteUri']);_0x30455a['serverUrl']=intUtil[_0xdd42('0x48')](_0x30455a['serverUrl']);def[_0xdd42('0x5f')]=util[_0xdd42('0x19')](_0xdd42('0x4a'),_0x30455a[_0xdd42('0x47')]);if(_0xba7e7c&&_0xba7e7c['monitor_format']){logger[_0xdd42('0x1f')]('['+_0x5a6ba5[_0xdd42('0x6b')][_0xdd42('0x6c')]()+']',_0xdd42('0x4d'));_0x5a6ba5[_0xdd42('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30455a[_0xdd42('0x49')],_0x5a6ba5[_0xdd42('0x62')],md5(_0x5a6ba5[_0xdd42('0x62')]));}else{_0x5a6ba5[_0xdd42('0x4f')]='';}return getConnection(_0x30455a)[_0xdd42('0x20')](function(_0x136d61){_0x1f043f=_0x136d61;if(!_[_0xdd42('0x6d')](_0x5e795d)){return getUser(_0x30455a,_0x5e795d['name'],_0x1f043f);}else{return getUser(_0x30455a,null,_0x1f043f);}})[_0xdd42('0x20')](function(_0x34085c){_0x422eaa=_0x34085c;logger[_0xdd42('0x1f')](_0xdd42('0x50'),_0x422eaa['id']);return getEndUser(_0x30455a,_0x5a6ba5[_0xdd42('0x6e')],_0x5a6ba5[_0xdd42('0x6f')],_0x1f043f);})[_0xdd42('0x20')](function(_0x2bcc9c){_0x3e86e4=_0x2bcc9c;logger[_0xdd42('0x1f')](_0xdd42('0x51'),_0x3e86e4['id']);return getTicket(_0x30455a,_0x422eaa,_0x3e86e4,_0x231519,_0x5a6ba5,_0x231519[_0xdd42('0x65')],_0x1f043f,'Inbound');})['then'](function(_0x11d44a){_0x2e201b=_0x11d44a;logger[_0xdd42('0x1f')]('Ticket\x20created!');logger[_0xdd42('0x1f')](_0xdd42('0x53'),_0x2e201b['id']);return setRelationship(_0x1f043f,_0x422eaa,_0x2e201b,_0xdd42('0x54'));})[_0xdd42('0x20')](function(){return setRelationship(_0x1f043f,_0x3e86e4,_0x2e201b,_0xdd42('0x55'));})[_0xdd42('0x20')](function(){return getServerInfo(_0x1f043f);})['catch'](function(_0x1e00ac){logger[_0xdd42('0x5d')]('['+_0x5a6ba5[_0xdd42('0x6b')]['toUpperCase']()+']',JSON[_0xdd42('0x1e')](_0x1e00ac));});}; \ No newline at end of file +var _0xc5db=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','unmanaged','toUpperCase','isNil','lodash','request-promise','bluebird','md5','./util','../../../../config/logger','sugarcrm','redis','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_name','direction','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','get_entry_list','Employees','user_name','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','map','string','nameField','customField','toLowerCase','content','type','custom_fields','push','variable','customVariable','Variable','login','username','PLAIN','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x5b0457,_0x38e163){var _0x25231b=function(_0x4694b4){while(--_0x4694b4){_0x5b0457['push'](_0x5b0457['shift']());}};_0x25231b(++_0x38e163);}(_0xc5db,0x1e8));var _0xbc5d=function(_0x4ca868,_0xf33587){_0x4ca868=_0x4ca868-0x0;var _0x33cdb9=_0xc5db[_0x4ca868];return _0x33cdb9;};'use strict';var _=require(_0xbc5d('0x0'));var rp=require(_0xbc5d('0x1'));var BPromise=require(_0xbc5d('0x2'));var md5=require(_0xbc5d('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbc5d('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbc5d('0x5'))(_0xbc5d('0x6'));config['redis']=_['defaults'](config[_0xbc5d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xbc5d('0x8'),'json':!![]};function emit(_0x85f257,_0x4a8be5,_0x19fb32){io['to'](_0x85f257)[_0xbc5d('0x9')](_0x4a8be5,_0x19fb32);}function getTicket(_0xf29b06,_0x3ad9ba,_0x37b67a,_0x22221b,_0x58ee49,_0x7edb0f,_0x319c40,_0x357b73){logger[_0xbc5d('0xa')](_0xbc5d('0xb'));var _0x1d2273=new Date();var _0x16aa68=[{'name':_0xbc5d('0xc'),'value':intUtil[_0xbc5d('0xd')](_0x22221b[_0xbc5d('0xe')],_0x58ee49,'\x20')},{'name':_0xbc5d('0xf'),'value':_0x3ad9ba['id']},{'name':_0xbc5d('0x10'),'value':_0x3ad9ba['id']},{'name':_0xbc5d('0x11'),'value':intUtil[_0xbc5d('0xd')](_0x22221b[_0xbc5d('0x12')],_0x58ee49,'\x0a')},{'name':_0xbc5d('0x13'),'value':_0x1d2273[_0xbc5d('0x14')]()[_0xbc5d('0x15')](0x0,0x13)[_0xbc5d('0x16')]('T','\x20')},{'name':_0xbc5d('0x17'),'value':'0'},{'name':_0xbc5d('0x18'),'value':'15'},{'name':'parent_id','value':_0x37b67a['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xbc5d('0x19'),'value':_0x37b67a['name']},{'name':_0xbc5d('0x1a'),'value':_0x357b73}];if(_0x7edb0f['length']){_['forEach'](_0x7edb0f,function(_0x578052){if(_0x58ee49[_0x578052[_0xbc5d('0x1b')]]){_0x16aa68['push']({'name':_0x578052[_0xbc5d('0x1c')],'value':_0x58ee49[_0x578052[_0xbc5d('0x1b')]]});}});}return request({'form':{'method':_0xbc5d('0x1d'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x319c40['id'],'module_name':_0xbc5d('0x20'),'name_value_list':_0x16aa68})}});}function getAuth(_0x585a15){return util[_0xbc5d('0x21')](_0xbc5d('0x22'),new Buffer(_0x585a15[_0xbc5d('0x23')]+':X')[_0xbc5d('0x24')](_0xbc5d('0x25')));}function getServerInfo(_0x3fce54){return request({'form':{'method':_0xbc5d('0x26'),'input_type':_0xbc5d('0x1e'),'response_type':_0xbc5d('0x1e'),'rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x3fce54['id']})}});}function getUser(_0x55c4c9,_0x19bd44,_0x5971d4){if(!_['isNil'](_0x19bd44)){logger[_0xbc5d('0xa')]('Getting\x20agent\x20with\x20name',_0x19bd44);return request({'form':{'method':_0xbc5d('0x27'),'input_type':_0xbc5d('0x1e'),'response_type':_0xbc5d('0x1e'),'rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x5971d4['id'],'module_name':_0xbc5d('0x28'),'query':util[_0xbc5d('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x19bd44),'order_by':'','offset':'0','select_fields':['id','name',_0xbc5d('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x265f19){if(_0x265f19[_0xbc5d('0x2a')][_0xbc5d('0x2b')]){var _0x1035c1=_[_0xbc5d('0x2c')](_0x265f19['entry_list'],function(_0x473e12){return _0x473e12[_0xbc5d('0x2d')]['user_name'][_0xbc5d('0x2e')]===_0x19bd44;});if(_0x1035c1){logger[_0xbc5d('0xa')](_0xbc5d('0x2f'));return BPromise[_0xbc5d('0x30')]({'id':_0x1035c1['name_value_list']['id']['value'],'name':_0x1035c1['name_value_list']['name'][_0xbc5d('0x2e')]});}}logger['info'](_0xbc5d('0x31'));return BPromise[_0xbc5d('0x30')]({'id':_0x5971d4[_0xbc5d('0x2d')][_0xbc5d('0x32')]['value'],'name':_0x5971d4[_0xbc5d('0x2d')][_0xbc5d('0x29')]['value']});});}else{logger[_0xbc5d('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbc5d('0x30')]({'id':_0x5971d4[_0xbc5d('0x2d')]['user_id'][_0xbc5d('0x2e')],'name':_0x5971d4['name_value_list'][_0xbc5d('0x29')][_0xbc5d('0x2e')]});}}function getEndUser(_0x110769,_0x37c742,_0x14ca78,_0x14eb5a){logger[_0xbc5d('0xa')]('Searching\x20enduser\x20with\x20phone',_0x14ca78);return request({'form':{'method':_0xbc5d('0x27'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x14eb5a['id'],'module_name':_0xbc5d('0x33'),'query':util[_0xbc5d('0x21')](_0xbc5d('0x34'),_0x14ca78),'order_by':'','offset':'0','select_fields':['id',_0xbc5d('0xc'),_0xbc5d('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbc5d('0x36')](function(_0x1cc0d0){if(_0x1cc0d0[_0xbc5d('0x2a')][_0xbc5d('0x2b')]){var _0x10e431=_[_0xbc5d('0x2c')](_0x1cc0d0[_0xbc5d('0x2a')],function(_0x50f6aa){return _0x50f6aa[_0xbc5d('0x2d')][_0xbc5d('0x35')]['value']===_0x14ca78;});if(_0x10e431){logger[_0xbc5d('0xa')](_0xbc5d('0x37'));return BPromise[_0xbc5d('0x30')]({'id':_0x10e431['name_value_list']['id'][_0xbc5d('0x2e')],'name':_0x10e431[_0xbc5d('0x2d')]['name']['value'],'phone':_0x10e431['name_value_list'][_0xbc5d('0x35')][_0xbc5d('0x2e')]});}}else{logger[_0xbc5d('0xa')](_0xbc5d('0x38'));return request({'form':{'method':_0xbc5d('0x1d'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbc5d('0x1f')]({'session':_0x14eb5a['id'],'module_name':_0xbc5d('0x33'),'name_value_list':[{'name':_0xbc5d('0x39'),'value':_0x37c742!==''?_0x37c742:util['format']('Caller\x20-\x20%s',_0x14ca78)},{'name':_0xbc5d('0x35'),'value':_0x14ca78}]})}})[_0xbc5d('0x36')](function(_0x3e2dc3){logger[_0xbc5d('0xa')](_0xbc5d('0x3a'));return BPromise[_0xbc5d('0x30')]({'id':_0x3e2dc3['id'],'name':_0x3e2dc3[_0xbc5d('0x2a')]['first_name'][_0xbc5d('0x2e')],'phone':_0x3e2dc3[_0xbc5d('0x2a')][_0xbc5d('0x35')]['value']});});}});}function request(_0x3745e5){logger[_0xbc5d('0x3b')]('[HTTP]',JSON[_0xbc5d('0x1f')](_0x3745e5));return rp(_['merge'](def,_0x3745e5));}function getTags(_0xe89ef2,_0x26851b){var _0x1050b9=[];if(_0xe89ef2&&_0xe89ef2['length']>0x0){_0x1050b9=_[_0xbc5d('0x3c')](_0xe89ef2,_0x26851b);}return _0x1050b9;}function getCustomFields(_0x4480e1,_0x41de1c){var _0x10e9de=[];var _0x26265a={'custom_fields':[]};if(_0x4480e1[_0xbc5d('0x2b')]>0x0){_['forEach'](_0x4480e1,function(_0xc9915){if(_0xc9915['type']===_0xbc5d('0x3d')&&_0xc9915[_0xbc5d('0x3e')]&&!_0xc9915[_0xbc5d('0x3f')]){_0x26265a[_0xc9915[_0xbc5d('0x3e')][_0xbc5d('0x40')]()]=_0xc9915[_0xbc5d('0x41')][_0xbc5d('0x24')]();}else if(_0xc9915[_0xbc5d('0x42')]===_0xbc5d('0x3d')&&_0xc9915[_0xbc5d('0x1c')]&&_0xc9915['customField']){_0x26265a[_0xbc5d('0x43')][_0xbc5d('0x44')]({'id':_0xc9915[_0xbc5d('0x1c')],'value':_0xc9915[_0xbc5d('0x41')][_0xbc5d('0x24')]()});}else if(_0xc9915[_0xbc5d('0x42')]===_0xbc5d('0x45')&&_0xc9915[_0xbc5d('0x1b')]&&_0xc9915[_0xbc5d('0x1c')]&&_0xc9915[_0xbc5d('0x3f')]){_0x41de1c[_0xc9915[_0xbc5d('0x1b')]]&&_0x26265a[_0xbc5d('0x43')]['push']({'id':_0xc9915[_0xbc5d('0x1c')],'value':_0x41de1c[_0xc9915['variableName']]['toString']()});}else if(_0xc9915[_0xbc5d('0x42')]===_0xbc5d('0x46')&&_0xc9915[_0xbc5d('0x47')]&&_0xc9915[_0xbc5d('0x47')][_0xbc5d('0xc')]&&_0xc9915[_0xbc5d('0x1c')]&&_0xc9915[_0xbc5d('0x3f')]){_0x41de1c[_0xc9915[_0xbc5d('0x47')]['name']['toLowerCase']()]&&_0x26265a[_0xbc5d('0x43')][_0xbc5d('0x44')]({'id':_0xc9915[_0xbc5d('0x1c')],'value':_0x41de1c[_0xc9915[_0xbc5d('0x47')]['name'][_0xbc5d('0x40')]()][_0xbc5d('0x24')]()});}});}return _0x26265a;}function getConnection(_0x35593e){return request({'method':_0xbc5d('0x8'),'form':{'method':_0xbc5d('0x48'),'input_type':_0xbc5d('0x1e'),'response_type':'JSON','rest_data':JSON[_0xbc5d('0x1f')]({'user_auth':{'user_name':_0x35593e[_0xbc5d('0x49')],'password':_0x35593e['password'],'encryption':_0xbc5d('0x4a')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xbc5d('0x36')](function(_0x3b4547){var _0x2de54b=_0x3b4547;if(_0x2de54b['id']){def[_0xbc5d('0x4b')]=_0x2de54b['id'];return BPromise['resolve'](_0x2de54b);}else{throw new Error(util[_0xbc5d('0x21')]('Account\x20%d\x20is\x20not\x20valid',_0x35593e['id']));}});}function setRelationship(_0xb4ef64,_0xb5d4e8,_0x19d492,_0x38b066){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xbc5d('0x1e'),'rest_data':JSON['stringify']({'session':_0xb4ef64['id'],'module_name':_0xbc5d('0x20'),'module_id':_0x19d492['id'],'link_field_name':_0x38b066,'related_ids':[_0xb5d4e8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xbc5d('0x4c')]=function(_0x32464c,_0xe7bcf,_0x1bd974,_0x276611,_0x4ac5a6,_0x2b1ebd){var _0x50a141,_0x13bf8a,_0x1443fe,_0x1b6928;_0x2b1ebd[_0xbc5d('0x4d')]=intUtil[_0xbc5d('0x4e')](_0x2b1ebd[_0xbc5d('0x4d')]);_0x2b1ebd[_0xbc5d('0x4f')]=intUtil[_0xbc5d('0x4e')](_0x2b1ebd[_0xbc5d('0x4f')]);def[_0xbc5d('0x50')]=util[_0xbc5d('0x21')](_0xbc5d('0x51'),_0x2b1ebd[_0xbc5d('0x4d')]);if(_0x4ac5a6&&_0x4ac5a6['monitor_format']){logger[_0xbc5d('0xa')](_0xbc5d('0x52'),_0xbc5d('0x53'));_0xe7bcf[_0xbc5d('0x54')]=util['format'](_0xbc5d('0x55'),_0x2b1ebd[_0xbc5d('0x4f')],_0xe7bcf['uniqueid'],md5(_0xe7bcf[_0xbc5d('0x56')]));}else{_0xe7bcf['recordingURL']='';}return getConnection(_0x2b1ebd)[_0xbc5d('0x36')](function(_0x4252d5){_0x1b6928=_0x4252d5;return getUser(_0x2b1ebd,_0x276611[_0xbc5d('0xc')],_0x1b6928);})[_0xbc5d('0x36')](function(_0x2c9e78){_0x50a141=_0x2c9e78;logger[_0xbc5d('0xa')]('The\x20User\x20ID\x20is:',_0x50a141['id']);return getEndUser(_0x2b1ebd,_0xe7bcf[_0xbc5d('0x57')],_0xe7bcf[_0xbc5d('0x58')],_0x1b6928);})[_0xbc5d('0x36')](function(_0x5cf7d6){_0x13bf8a=_0x5cf7d6;logger['info'](_0xbc5d('0x59'),_0x13bf8a['id']);return getTicket(_0x2b1ebd,_0x50a141,_0x13bf8a,_0x1bd974,_0xe7bcf,_0x1bd974[_0xbc5d('0x5a')],_0x1b6928,_0xbc5d('0x5b'));})['then'](function(_0x19ef79){_0x1443fe=_0x19ef79;logger[_0xbc5d('0xa')](_0xbc5d('0x5c'));logger['info'](_0xbc5d('0x5d'),_0x1443fe['id']);return setRelationship(_0x1b6928,_0x50a141,_0x1443fe,_0xbc5d('0x5e'));})[_0xbc5d('0x36')](function(){return setRelationship(_0x1b6928,_0x13bf8a,_0x1443fe,_0xbc5d('0x5f'));})[_0xbc5d('0x36')](function(){return getServerInfo(_0x1b6928);})[_0xbc5d('0x36')](function(_0x1eab6e){var _0x22ae16=parseInt(_0x1eab6e['version'][_0xbc5d('0x60')](0x0));var _0xd4b61=util[_0xbc5d('0x21')](_0xbc5d('0x61'),_0x2b1ebd[_0xbc5d('0x4d')],_0x1443fe['id']);if(_0x22ae16>0x6){_0xd4b61=util[_0xbc5d('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2b1ebd[_0xbc5d('0x4d')],_0x1443fe['id']);}logger[_0xbc5d('0xa')](_0xbc5d('0x52'),_0xbc5d('0x62'));emit(util[_0xbc5d('0x21')]('user:%s',_0x276611['name']),_0xbc5d('0x63'),{'uri':_0xd4b61});})[_0xbc5d('0x64')](function(_0x4b480b){logger[_0xbc5d('0x65')]('[QUEUE]',JSON['stringify'](_0x4b480b));});};exports[_0xbc5d('0x66')]=function(_0x32211e,_0x2179f7,_0x4b7ee2,_0x5917cc,_0x171b01,_0x583c71,_0x4474d1){var _0x551f67,_0xadcc6f,_0x226233,_0x511b27;_0x583c71['remoteUri']=intUtil[_0xbc5d('0x4e')](_0x583c71[_0xbc5d('0x4d')]);_0x583c71[_0xbc5d('0x4f')]=intUtil[_0xbc5d('0x4e')](_0x583c71[_0xbc5d('0x4f')]);def[_0xbc5d('0x50')]=util[_0xbc5d('0x21')](_0xbc5d('0x51'),_0x583c71[_0xbc5d('0x4d')]);if(_0x4474d1&&_0x4474d1[_0xbc5d('0x67')]&&_0x4474d1[_0xbc5d('0x67')]!==_0xbc5d('0x68')){logger[_0xbc5d('0xa')](_0xbc5d('0x69'),'Recording\x20is\x20enabled!');_0x2179f7[_0xbc5d('0x54')]=util[_0xbc5d('0x21')](_0xbc5d('0x55'),_0x583c71[_0xbc5d('0x4f')],_0x2179f7[_0xbc5d('0x56')],md5(_0x2179f7['uniqueid']));}return getConnection(_0x583c71)[_0xbc5d('0x36')](function(_0x4a6769){_0x511b27=_0x4a6769;return getUser(_0x583c71,_0x5917cc[_0xbc5d('0xc')],_0x511b27);})[_0xbc5d('0x36')](function(_0x4f9441){_0x551f67=_0x4f9441;logger[_0xbc5d('0xa')](_0xbc5d('0x6a'),_0x551f67['id']);return getEndUser(_0x583c71,_0x2179f7['destcalleridname'],_0x2179f7[_0xbc5d('0x6b')],_0x511b27);})['then'](function(_0x319099){_0xadcc6f=_0x319099;logger[_0xbc5d('0xa')](_0xbc5d('0x59'),_0xadcc6f['id']);return getTicket(_0x583c71,_0x551f67,_0xadcc6f,_0x4b7ee2,_0x2179f7,_0x4b7ee2[_0xbc5d('0x5a')],_0x511b27,_0xbc5d('0x6c'));})['then'](function(_0x2fb119){_0x226233=_0x2fb119;logger[_0xbc5d('0xa')](_0xbc5d('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x226233['id']);return setRelationship(_0x511b27,_0x551f67,_0x226233,_0xbc5d('0x5e'));})[_0xbc5d('0x36')](function(){return setRelationship(_0x511b27,_0xadcc6f,_0x226233,_0xbc5d('0x5f'));})[_0xbc5d('0x36')](function(){return getServerInfo(_0x511b27);})[_0xbc5d('0x36')](function(_0x59f58f){var _0x5a2e62=parseInt(_0x59f58f[_0xbc5d('0x6d')][_0xbc5d('0x60')](0x0));var _0xc0987d=util[_0xbc5d('0x21')](_0xbc5d('0x61'),_0x583c71[_0xbc5d('0x4d')],_0x226233['id']);if(_0x5a2e62>0x6){_0xc0987d=util[_0xbc5d('0x21')](_0xbc5d('0x6e'),_0x583c71['remoteUri'],_0x226233['id']);}logger[_0xbc5d('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbc5d('0x21')](_0xbc5d('0x6f'),_0x5917cc[_0xbc5d('0xc')]),'trigger:browser:url',{'uri':_0xc0987d});})[_0xbc5d('0x64')](function(_0x34a025){logger[_0xbc5d('0x65')](_0xbc5d('0x69'),JSON[_0xbc5d('0x1f')](_0x34a025));});};exports[_0xbc5d('0x70')]=function(_0xc2ad24,_0x4cdc2d,_0x5b2d04,_0xbe6137,_0x385fdc,_0x584e9a){var _0xb6b5dd,_0x44f8d0,_0x473a38,_0x31c270;_0x584e9a[_0xbc5d('0x4d')]=intUtil['stripTrailingSlash'](_0x584e9a[_0xbc5d('0x4d')]);_0x584e9a[_0xbc5d('0x4f')]=intUtil[_0xbc5d('0x4e')](_0x584e9a[_0xbc5d('0x4f')]);def['uri']=util['format'](_0xbc5d('0x51'),_0x584e9a['remoteUri']);if(_0x385fdc&&_0x385fdc['monitor_format']){logger[_0xbc5d('0xa')]('['+_0x4cdc2d['lastevent'][_0xbc5d('0x71')]()+']',_0xbc5d('0x53'));_0x4cdc2d['recordingURL']=util[_0xbc5d('0x21')](_0xbc5d('0x55'),_0x584e9a[_0xbc5d('0x4f')],_0x4cdc2d['uniqueid'],md5(_0x4cdc2d[_0xbc5d('0x56')]));}else{_0x4cdc2d[_0xbc5d('0x54')]='';}return getConnection(_0x584e9a)[_0xbc5d('0x36')](function(_0x325871){_0x31c270=_0x325871;if(!_[_0xbc5d('0x72')](_0xbe6137)){return getUser(_0x584e9a,_0xbe6137[_0xbc5d('0xc')],_0x31c270);}else{return getUser(_0x584e9a,null,_0x31c270);}})[_0xbc5d('0x36')](function(_0x44d989){_0xb6b5dd=_0x44d989;logger[_0xbc5d('0xa')]('The\x20User\x20ID\x20is:',_0xb6b5dd['id']);return getEndUser(_0x584e9a,_0x4cdc2d[_0xbc5d('0x57')],_0x4cdc2d[_0xbc5d('0x58')],_0x31c270);})[_0xbc5d('0x36')](function(_0x27dc8f){_0x44f8d0=_0x27dc8f;logger[_0xbc5d('0xa')](_0xbc5d('0x59'),_0x44f8d0['id']);return getTicket(_0x584e9a,_0xb6b5dd,_0x44f8d0,_0x5b2d04,_0x4cdc2d,_0x5b2d04[_0xbc5d('0x5a')],_0x31c270,_0xbc5d('0x5b'));})[_0xbc5d('0x36')](function(_0x273d64){_0x473a38=_0x273d64;logger[_0xbc5d('0xa')](_0xbc5d('0x5c'));logger[_0xbc5d('0xa')](_0xbc5d('0x5d'),_0x473a38['id']);return setRelationship(_0x31c270,_0xb6b5dd,_0x473a38,_0xbc5d('0x5e'));})['then'](function(){return setRelationship(_0x31c270,_0x44f8d0,_0x473a38,_0xbc5d('0x5f'));})['then'](function(){return getServerInfo(_0x31c270);})['catch'](function(_0xa41e7a){logger[_0xbc5d('0x65')]('['+_0x4cdc2d['lastevent']['toUpperCase']()+']',JSON[_0xbc5d('0x1f')](_0xa41e7a));});}; \ 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 b4eff64..bbed0e3 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 _0x83dd=['keyType','format','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','string','%s:\x20%s','key','keyContent'];(function(_0x5f2f96,_0x251343){var _0x1d6045=function(_0x563343){while(--_0x563343){_0x5f2f96['push'](_0x5f2f96['shift']());}};_0x1d6045(++_0x251343);}(_0x83dd,0x104));var _0xd83d=function(_0x54b543,_0x4112ef){_0x54b543=_0x54b543-0x0;var _0x2cd2b4=_0x83dd[_0x54b543];return _0x2cd2b4;};'use strict';var _=require(_0xd83d('0x0'));var util=require(_0xd83d('0x1'));exports[_0xd83d('0x2')]=function(_0x28d9f8,_0x51d238,_0x6beef1){var _0x614c4f=[];if(_0x28d9f8[_0xd83d('0x3')]>0x0){var _0x2a82ec=_[_0xd83d('0x4')](_0x28d9f8,['id']);for(var _0xa40fc1=0x0;_0xa40fc1<_0x2a82ec[_0xd83d('0x3')];_0xa40fc1++){var _0x36d0d2=_0x2a82ec[_0xa40fc1];if(_0x36d0d2[_0xd83d('0x5')]==='string'){_0x614c4f[_0xd83d('0x6')](_0x36d0d2[_0xd83d('0x7')]);}else if(_0x36d0d2[_0xd83d('0x5')]===_0xd83d('0x8')&&_0x36d0d2['variableName']){_0x51d238[_0x36d0d2[_0xd83d('0x9')]]&&_0x614c4f['push'](_0x51d238[_0x36d0d2['variableName']][_0xd83d('0xa')]());}else if(_0x36d0d2[_0xd83d('0x5')]===_0xd83d('0xb')&&_0x36d0d2[_0xd83d('0xc')]&&_0x36d0d2['Variable'][_0xd83d('0xd')]){_0x51d238[_0x36d0d2['Variable'][_0xd83d('0xd')][_0xd83d('0xe')]()]&&_0x614c4f[_0xd83d('0x6')](_0x51d238[_0x36d0d2[_0xd83d('0xc')][_0xd83d('0xd')]['toLowerCase']()][_0xd83d('0xa')]());}else if(_0x36d0d2[_0xd83d('0x5')]===_0xd83d('0xf')){if(_0x36d0d2['keyType']===_0xd83d('0x10')&&_0x36d0d2['key']){_0x614c4f['push'](util['format'](_0xd83d('0x11'),_0x36d0d2[_0xd83d('0x12')],_0x36d0d2[_0xd83d('0x13')]));}else if(_0x36d0d2[_0xd83d('0x14')]===_0xd83d('0x8')&&_0x36d0d2[_0xd83d('0x9')]&&_0x36d0d2['key']){_0x51d238[_0x36d0d2[_0xd83d('0x9')]]&&_0x614c4f[_0xd83d('0x6')](util[_0xd83d('0x15')](_0xd83d('0x11'),_0x36d0d2[_0xd83d('0x12')],_0x51d238[_0x36d0d2[_0xd83d('0x9')]]));}else if(_0x36d0d2[_0xd83d('0x14')]==='customVariable'&&_0x36d0d2[_0xd83d('0xc')]&&_0x36d0d2[_0xd83d('0xc')][_0xd83d('0xd')]&&_0x36d0d2[_0xd83d('0x12')]){_0x51d238[_0x36d0d2['Variable']['name'][_0xd83d('0xe')]()]&&_0x614c4f[_0xd83d('0x6')](util['format'](_0xd83d('0x11'),_0x36d0d2[_0xd83d('0x12')],_0x51d238[_0x36d0d2[_0xd83d('0xc')]['name'][_0xd83d('0xe')]()]));}}}}return _0x614c4f[_0xd83d('0x16')](_0x6beef1);};exports[_0xd83d('0x17')]=function(_0x197575){var _0x1c22a9=_0x197575['slice'](-0x1);if(_0x1c22a9==='/'){_0x197575=_0x197575[_0xd83d('0x18')](0x0,_0x197575[_0xd83d('0x19')](_0x1c22a9));}return _0x197575;};exports[_0xd83d('0x1a')]=function(_0x49dea7){if(!_['isNil'](_0x49dea7)&&_0x49dea7!==''){var _0x5cec90=/^(([^<>()\[\]\\.,;:\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 _0x5cec90[_0xd83d('0x1b')](String(_0x49dea7)[_0xd83d('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x815a=['toLowerCase','keyValue','keyType','key','format','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','sortBy','length','type','string','variable','variableName','push','toString','Variable','name'];(function(_0x4e7ab1,_0x439952){var _0xcd4285=function(_0x1ccae3){while(--_0x1ccae3){_0x4e7ab1['push'](_0x4e7ab1['shift']());}};_0xcd4285(++_0x439952);}(_0x815a,0x1d0));var _0xa815=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x815a[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0xa815('0x0'));exports['getString']=function(_0x6ad0e1,_0x3bdd45,_0x2afa42){var _0x1ae70c=[];if(_0x6ad0e1['length']>0x0){var _0x3ff9cb=_[_0xa815('0x1')](_0x6ad0e1,['id']);for(var _0x58ff5e=0x0;_0x58ff5e<_0x3ff9cb[_0xa815('0x2')];_0x58ff5e++){var _0x4fe6d9=_0x3ff9cb[_0x58ff5e];if(_0x4fe6d9[_0xa815('0x3')]===_0xa815('0x4')){_0x1ae70c['push'](_0x4fe6d9['content']);}else if(_0x4fe6d9[_0xa815('0x3')]===_0xa815('0x5')&&_0x4fe6d9[_0xa815('0x6')]){_0x3bdd45[_0x4fe6d9[_0xa815('0x6')]]&&_0x1ae70c[_0xa815('0x7')](_0x3bdd45[_0x4fe6d9[_0xa815('0x6')]][_0xa815('0x8')]());}else if(_0x4fe6d9['type']==='customVariable'&&_0x4fe6d9[_0xa815('0x9')]&&_0x4fe6d9[_0xa815('0x9')][_0xa815('0xa')]){_0x3bdd45[_0x4fe6d9[_0xa815('0x9')]['name'][_0xa815('0xb')]()]&&_0x1ae70c[_0xa815('0x7')](_0x3bdd45[_0x4fe6d9[_0xa815('0x9')][_0xa815('0xa')][_0xa815('0xb')]()][_0xa815('0x8')]());}else if(_0x4fe6d9['type']===_0xa815('0xc')){if(_0x4fe6d9[_0xa815('0xd')]==='string'&&_0x4fe6d9[_0xa815('0xe')]){_0x1ae70c[_0xa815('0x7')](util[_0xa815('0xf')]('%s:\x20%s',_0x4fe6d9[_0xa815('0xe')],_0x4fe6d9['keyContent']));}else if(_0x4fe6d9['keyType']===_0xa815('0x5')&&_0x4fe6d9[_0xa815('0x6')]&&_0x4fe6d9[_0xa815('0xe')]){_0x3bdd45[_0x4fe6d9['variableName']]&&_0x1ae70c[_0xa815('0x7')](util[_0xa815('0xf')](_0xa815('0x10'),_0x4fe6d9['key'],_0x3bdd45[_0x4fe6d9['variableName']]));}else if(_0x4fe6d9[_0xa815('0xd')]===_0xa815('0x11')&&_0x4fe6d9[_0xa815('0x9')]&&_0x4fe6d9[_0xa815('0x9')]['name']&&_0x4fe6d9[_0xa815('0xe')]){_0x3bdd45[_0x4fe6d9['Variable'][_0xa815('0xa')][_0xa815('0xb')]()]&&_0x1ae70c[_0xa815('0x7')](util[_0xa815('0xf')](_0xa815('0x10'),_0x4fe6d9[_0xa815('0xe')],_0x3bdd45[_0x4fe6d9[_0xa815('0x9')][_0xa815('0xa')][_0xa815('0xb')]()]));}}}}return _0x1ae70c[_0xa815('0x12')](_0x2afa42);};exports[_0xa815('0x13')]=function(_0x59fe0a){var _0x18b025=_0x59fe0a[_0xa815('0x14')](-0x1);if(_0x18b025==='/'){_0x59fe0a=_0x59fe0a[_0xa815('0x15')](0x0,_0x59fe0a[_0xa815('0x16')](_0x18b025));}return _0x59fe0a;};exports[_0xa815('0x17')]=function(_0x33a93c){if(!_[_0xa815('0x18')](_0x33a93c)&&_0x33a93c!==''){var _0x366b45=/^(([^<>()\[\]\\.,;:\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 _0x366b45['test'](String(_0x33a93c)[_0xa815('0xb')]());}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 a64dd71..962e474 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','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','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','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','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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 a1e798d..e430759 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 _0x1682=['customField','content','includes','variable','variableName','idField','custom_fields','push','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridnum','replace','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','calleridnum','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','application/json','info','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','%s/users.json','Caller\x20-\x20%s','authType','password','username','toString','base64','debug','stringify','GET','map','forEach','string','picklist','type','nameField'];(function(_0x109a8b,_0x291bce){var _0x5d5a7f=function(_0x8ef75a){while(--_0x8ef75a){_0x109a8b['push'](_0x109a8b['shift']());}};_0x5d5a7f(++_0x291bce);}(_0x1682,0x1e1));var _0x2168=function(_0x320dc2,_0x129a13){_0x320dc2=_0x320dc2-0x0;var _0x5abef5=_0x1682[_0x320dc2];return _0x5abef5;};'use strict';var _=require(_0x2168('0x0'));var rp=require(_0x2168('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x2168('0x2'));var intUtil=require(_0x2168('0x3'));var config=require(_0x2168('0x4'));var logger=require('../../../../config/logger')(_0x2168('0x5'));config[_0x2168('0x6')]=_[_0x2168('0x7')](config['redis'],{'host':_0x2168('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2168('0x6')]));function emit(_0x211ec1,_0x319ecb,_0x5dfe0e){io['to'](_0x211ec1)['emit'](_0x319ecb,_0x5dfe0e);}var headers={'Content-Type':_0x2168('0x9'),'Accept':_0x2168('0x9')};function getTicket(_0x55d100,_0x295caf,_0x1d5554,_0x5157e7,_0x34b234){logger[_0x2168('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x2168('0xb')](_0x2168('0xc'),_0x55d100['remoteUri']),'method':_0x2168('0xd'),'body':{'ticket':_[_0x2168('0xe')]({'requester_id':_0x1d5554['id'],'submitter_id':_0x295caf?_0x295caf['id']:undefined,'assignee_id':_0x295caf?_0x295caf['id']:undefined,'tags':getTags(_0x5157e7[_0x2168('0xf')],_0x2168('0x10')),'subject':intUtil[_0x2168('0x11')](_0x5157e7[_0x2168('0x12')],_0x34b234,'\x20'),'description':intUtil[_0x2168('0x11')](_0x5157e7[_0x2168('0x13')],_0x34b234,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2168('0x11')](_0x5157e7['Descriptions'],_0x34b234,'\x0a')}},getCustomFields(_0x5157e7[_0x2168('0x14')],_0x34b234))}})[_0x2168('0x15')](function(_0x3060eb){logger['info'](_0x2168('0x16'));return _0x3060eb[_0x2168('0x17')];});}function getUser(_0x157c97,_0x1a21e4){if(intUtil[_0x2168('0x18')](_0x1a21e4)){logger[_0x2168('0xa')](_0x2168('0x19'),_0x1a21e4);return request({'uri':util['format']('%s/search.json',_0x157c97[_0x2168('0x1a')]),'qs':{'query':util[_0x2168('0xb')](_0x2168('0x1b'),_0x1a21e4)}})[_0x2168('0x15')](function(_0x1ad7f0){if(_0x1ad7f0[_0x2168('0x1c')]){logger['info']('Agent\x20found!');return _[_0x2168('0x1d')](_0x1ad7f0[_0x2168('0x1e')],{'email':_0x1a21e4,'role':_0x2168('0x1f')});}else{logger[_0x2168('0xa')](_0x2168('0x20'));return request({'uri':util['format']('%s/users/me.json',_0x157c97[_0x2168('0x1a')])})['then'](function(_0x2942ac){logger['info'](_0x2168('0x21'));return _0x2942ac[_0x2168('0x22')];});}});}else{logger[_0x2168('0xa')](_0x2168('0x20'));return request({'uri':util['format'](_0x2168('0x23'),_0x157c97['remoteUri'])})[_0x2168('0x15')](function(_0x4b3856){logger[_0x2168('0xa')](_0x2168('0x21'));return _0x4b3856[_0x2168('0x22')];});}}function getEndUser(_0x74c3dd,_0x28b6cd,_0x4559cc){logger[_0x2168('0xa')](_0x2168('0x24'),_0x4559cc);return request({'uri':util['format'](_0x2168('0x25'),_0x74c3dd['remoteUri']),'qs':{'query':util[_0x2168('0xb')](_0x2168('0x26'),_0x4559cc)}})['then'](function(_0x125a1c){var _0x531cb7;if(_0x125a1c[_0x2168('0x1e')][_0x2168('0x27')]){_0x125a1c[_0x2168('0x1e')]=_[_0x2168('0x28')](_0x125a1c[_0x2168('0x1e')],{'suspended':![],'role':_0x2168('0x29')});if(_0x125a1c[_0x2168('0x1e')][_0x2168('0x27')]){_0x531cb7=_[_0x2168('0x2a')](_0x125a1c['results']);}}if(_0x531cb7){logger['info']('Enduser\x20found!');return _0x531cb7;}else{logger[_0x2168('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2168('0xb')](_0x2168('0x2b'),_0x74c3dd[_0x2168('0x1a')]),'method':_0x2168('0xd'),'body':{'user':{'role':_0x2168('0x29'),'name':util[_0x2168('0xb')](_0x2168('0x2c'),_0x28b6cd||_0x4559cc),'phone':_0x4559cc}}})['then'](function(_0x19b6e6){logger[_0x2168('0xa')]('Enduser\x20created.');return _0x19b6e6[_0x2168('0x22')];});}});}function getAuth(_0x70d39c){var _0x480954;if(_0x70d39c[_0x2168('0x2d')]===_0x2168('0x2e')){_0x480954=util['format']('%s:%s',_0x70d39c[_0x2168('0x2f')],_0x70d39c[_0x2168('0x2e')]);}else if(_0x70d39c[_0x2168('0x2d')]==='token'){_0x480954=util[_0x2168('0xb')]('%s/token:%s',_0x70d39c[_0x2168('0x2f')],_0x70d39c['token']);}return util['format']('Basic\x20%s',new Buffer(_0x480954)[_0x2168('0x30')](_0x2168('0x31')));}function request(_0x4e0361){logger[_0x2168('0x32')]('[HTTP]',JSON[_0x2168('0x33')](_0x4e0361));return rp(_[_0x2168('0x7')](_0x4e0361,{'method':_0x2168('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x4b9391,_0x3595a6){var _0xa8e7af=[];if(_0x4b9391&&_0x4b9391['length']>0x0){_0xa8e7af=_[_0x2168('0x35')](_0x4b9391,_0x3595a6);}return _0xa8e7af;}function getCustomFields(_0x474b66,_0x283b05){var _0x10edd=[];var _0x43cbc0={'custom_fields':[]};if(_0x474b66[_0x2168('0x27')]>0x0){_[_0x2168('0x36')](_0x474b66,function(_0x4d00b6){if(_['includes']([_0x2168('0x37'),_0x2168('0x38')],_0x4d00b6[_0x2168('0x39')])&&_0x4d00b6[_0x2168('0x3a')]&&!_0x4d00b6[_0x2168('0x3b')]){_0x43cbc0[_0x4d00b6['nameField']['toLowerCase']()]=_0x4d00b6[_0x2168('0x3c')][_0x2168('0x30')]();}else if(_[_0x2168('0x3d')]([_0x2168('0x37'),_0x2168('0x38')],_0x4d00b6[_0x2168('0x39')])&&_0x4d00b6['idField']&&_0x4d00b6[_0x2168('0x3b')]){_0x43cbc0['custom_fields']['push']({'id':_0x4d00b6['idField'],'value':_0x4d00b6['content'][_0x2168('0x30')]()});}else if(_0x4d00b6[_0x2168('0x39')]===_0x2168('0x3e')&&_0x4d00b6[_0x2168('0x3f')]&&_0x4d00b6[_0x2168('0x40')]&&_0x4d00b6[_0x2168('0x3b')]){_0x283b05[_0x4d00b6['variableName']]&&_0x43cbc0[_0x2168('0x41')][_0x2168('0x42')]({'id':_0x4d00b6[_0x2168('0x40')],'value':_0x283b05[_0x4d00b6[_0x2168('0x3f')]]['toString']()});}else if(_0x4d00b6['type']===_0x2168('0x43')&&_0x4d00b6['Variable']&&_0x4d00b6[_0x2168('0x44')][_0x2168('0x10')]&&_0x4d00b6[_0x2168('0x40')]&&_0x4d00b6[_0x2168('0x3b')]){_0x283b05[_0x4d00b6[_0x2168('0x44')][_0x2168('0x10')][_0x2168('0x45')]()]&&_0x43cbc0[_0x2168('0x41')][_0x2168('0x42')]({'id':_0x4d00b6[_0x2168('0x40')],'value':_0x283b05[_0x4d00b6['Variable']['name']['toLowerCase']()][_0x2168('0x30')]()});}});}return _0x43cbc0;}exports['queue']=function(_0x176c11,_0x5761d4,_0xee2b45,_0x249a8d,_0x1d2c13,_0x526fe6){var _0x1c2743,_0x1fd932;_0x526fe6[_0x2168('0x1a')]=intUtil[_0x2168('0x46')](_0x526fe6[_0x2168('0x1a')]);_0x526fe6[_0x2168('0x47')]=intUtil[_0x2168('0x46')](_0x526fe6[_0x2168('0x47')]);if(_0x1d2c13&&_0x1d2c13[_0x2168('0x48')]){logger[_0x2168('0xa')]('[QUEUE]',_0x2168('0x49'));_0x5761d4[_0x2168('0x4a')]=util[_0x2168('0xb')](_0x2168('0x4b'),_0x526fe6[_0x2168('0x47')],_0x5761d4[_0x2168('0x4c')],md5(_0x5761d4['uniqueid']));}else{_0x5761d4[_0x2168('0x4a')]='';}headers[_0x2168('0x4d')]=getAuth(_0x526fe6);return getUser(_0x526fe6,_0x249a8d['email'])[_0x2168('0x15')](function(_0xf8b5d){_0x1c2743=_0xf8b5d;logger[_0x2168('0xa')](_0x2168('0x4e'),_0x1c2743['id']);return getEndUser(_0x526fe6,_0x5761d4[_0x2168('0x4f')],_0x5761d4['calleridnum']);})[_0x2168('0x15')](function(_0x3eb2e2){_0x1fd932=_0x3eb2e2;logger[_0x2168('0xa')](_0x2168('0x50'),_0x1fd932['id']);return getTicket(_0x526fe6,_0x1c2743,_0x1fd932,_0xee2b45,_0x5761d4);})[_0x2168('0x15')](function(_0x1a0d35){if(_0x1a0d35){logger[_0x2168('0xa')](_0x2168('0x51'),_0x1a0d35['id']);switch(_0x526fe6[_0x2168('0x39')]){case _0x2168('0x52'):logger[_0x2168('0xa')](_0x2168('0x53'),_0x2168('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x526fe6[_0x2168('0x1a')],_0x1c2743['id'],_0x1a0d35['id']),'method':_0x2168('0xd')});case _0x2168('0x55'):logger[_0x2168('0xa')](_0x2168('0x53'),_0x2168('0x56'));emit(util['format'](_0x2168('0x57'),_0x249a8d[_0x2168('0x10')]),_0x2168('0x58'),{'uri':util[_0x2168('0xb')](_0x2168('0x59'),_0x526fe6['remoteUri']['replace'](_0x2168('0x5a'),''),_0x1a0d35['id'])});break;default:logger[_0x2168('0x5b')](_0x2168('0x53'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2168('0x5c')](function(_0x40fae5){logger['error'](_0x2168('0x5d'),util[_0x2168('0x5e')](_0x40fae5,{'showHidden':!![],'depth':null}));});};exports[_0x2168('0x5f')]=function(_0x4fd431,_0x5aa94a,_0x12db02,_0x423259,_0x24fabc,_0x308c6f,_0x13b260){var _0x5b8d38,_0x228490;_0x308c6f[_0x2168('0x1a')]=intUtil['stripTrailingSlash'](_0x308c6f[_0x2168('0x1a')]);_0x308c6f[_0x2168('0x47')]=intUtil[_0x2168('0x46')](_0x308c6f[_0x2168('0x47')]);if(_0x13b260&&_0x13b260[_0x2168('0x60')]&&_0x13b260[_0x2168('0x60')]!=='none'){logger[_0x2168('0xa')](_0x2168('0x61'),_0x2168('0x49'));_0x5aa94a['recordingURL']=util['format'](_0x2168('0x4b'),_0x308c6f[_0x2168('0x47')],_0x5aa94a[_0x2168('0x4c')],md5(_0x5aa94a['uniqueid']));}headers[_0x2168('0x4d')]=getAuth(_0x308c6f);return getUser(_0x308c6f,_0x423259[_0x2168('0x62')])[_0x2168('0x15')](function(_0x2a2520){_0x5b8d38=_0x2a2520;logger[_0x2168('0xa')](_0x2168('0x4e'),_0x5b8d38['id']);return getEndUser(_0x308c6f,_0x5aa94a['destcalleridname'],_0x5aa94a[_0x2168('0x63')]);})[_0x2168('0x15')](function(_0x5c9359){_0x228490=_0x5c9359;logger[_0x2168('0xa')]('The\x20Enduser\x20ID\x20is:',_0x228490['id']);return getTicket(_0x308c6f,_0x5b8d38,_0x228490,_0x12db02,_0x5aa94a);})[_0x2168('0x15')](function(_0x1a8b7d){if(_0x1a8b7d){logger['info'](_0x2168('0x51'),_0x1a8b7d['id']);switch(_0x308c6f[_0x2168('0x39')]){case _0x2168('0x52'):logger[_0x2168('0xa')](_0x2168('0x61'),_0x2168('0x54'));return request({'uri':util[_0x2168('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x308c6f[_0x2168('0x1a')],_0x5b8d38['id'],_0x1a8b7d['id']),'method':_0x2168('0xd')});case _0x2168('0x55'):logger[_0x2168('0xa')]('[OUTBOUND]',_0x2168('0x56'));emit(util[_0x2168('0xb')]('user:%s',_0x423259[_0x2168('0x10')]),_0x2168('0x58'),{'uri':util[_0x2168('0xb')](_0x2168('0x59'),_0x308c6f[_0x2168('0x1a')][_0x2168('0x64')]('/api/v2',''),_0x1a8b7d['id'])});break;default:logger[_0x2168('0x5b')](_0x2168('0x61'),_0x2168('0x65'));}}})['catch'](function(_0x46a10e){logger[_0x2168('0x5b')](_0x2168('0x66'),util[_0x2168('0x5e')](_0x46a10e,{'showHidden':!![],'depth':null}));});};exports[_0x2168('0x67')]=function(_0x1554d4,_0x2697dc,_0x4c2845,_0x4a3e92,_0x14e2c7,_0x4923e2){var _0x3916f5,_0xbbbd33;_0x4923e2[_0x2168('0x1a')]=intUtil[_0x2168('0x46')](_0x4923e2[_0x2168('0x1a')]);_0x4923e2[_0x2168('0x47')]=intUtil['stripTrailingSlash'](_0x4923e2[_0x2168('0x47')]);if(_0x14e2c7&&_0x14e2c7['monitor_format']){logger['info']('['+_0x2697dc[_0x2168('0x68')]['toUpperCase']()+']',_0x2168('0x49'));_0x2697dc[_0x2168('0x4a')]=util[_0x2168('0xb')](_0x2168('0x4b'),_0x4923e2['serverUrl'],_0x2697dc['uniqueid'],md5(_0x2697dc['uniqueid']));}else{_0x2697dc['recordingURL']='';}headers[_0x2168('0x4d')]=getAuth(_0x4923e2);return getUser(_0x4923e2)[_0x2168('0x15')](function(_0x4cb213){_0x3916f5=_0x4cb213;logger['info'](_0x2168('0x4e'),_0x3916f5['id']);return getEndUser(_0x4923e2,_0x2697dc[_0x2168('0x4f')],_0x2697dc[_0x2168('0x69')]);})[_0x2168('0x15')](function(_0x2dda33){_0xbbbd33=_0x2dda33;logger[_0x2168('0xa')]('The\x20Enduser\x20ID\x20is:',_0xbbbd33['id']);return getTicket(_0x4923e2,_0x3916f5,_0xbbbd33,_0x4c2845,_0x2697dc);})[_0x2168('0x15')](function(_0xa402b9){if(_0xa402b9){logger['info'](_0x2168('0x51'),_0xa402b9['id']);}})[_0x2168('0x5c')](function(_0x5acd04){logger['error']('['+_0x2697dc['lastevent'][_0x2168('0x6a')]()+']'+_0x2168('0x6b'),util['inspect'](_0x5acd04,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf322=['Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','includes','picklist','type','nameField','customField','content','string','idField','custom_fields','push','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]'];(function(_0x436278,_0x101c83){var _0x2d93cb=function(_0x2d6153){while(--_0x2d6153){_0x436278['push'](_0x436278['shift']());}};_0x2d93cb(++_0x101c83);}(_0xf322,0x10d));var _0x2f32=function(_0x1951f1,_0x699e4){_0x1951f1=_0x1951f1-0x0;var _0x252aef=_0xf322[_0x1951f1];return _0x252aef;};'use strict';var _=require(_0x2f32('0x0'));var rp=require('request-promise');var md5=require(_0x2f32('0x1'));var util=require(_0x2f32('0x2'));var Redis=require(_0x2f32('0x3'));var intUtil=require(_0x2f32('0x4'));var config=require(_0x2f32('0x5'));var logger=require(_0x2f32('0x6'))(_0x2f32('0x7'));config[_0x2f32('0x8')]=_[_0x2f32('0x9')](config[_0x2f32('0x8')],{'host':_0x2f32('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2f32('0x8')]));function emit(_0x55ec75,_0x5a0117,_0x2f173d){io['to'](_0x55ec75)['emit'](_0x5a0117,_0x2f173d);}var headers={'Content-Type':_0x2f32('0xb'),'Accept':'application/json'};function getTicket(_0x487393,_0x55dbda,_0x4c2d57,_0x8dcd12,_0x432216){logger[_0x2f32('0xc')](_0x2f32('0xd'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0xf'),_0x487393[_0x2f32('0x10')]),'method':_0x2f32('0x11'),'body':{'ticket':_[_0x2f32('0x12')]({'requester_id':_0x4c2d57['id'],'submitter_id':_0x55dbda?_0x55dbda['id']:undefined,'assignee_id':_0x55dbda?_0x55dbda['id']:undefined,'tags':getTags(_0x8dcd12[_0x2f32('0x13')],_0x2f32('0x14')),'subject':intUtil['getString'](_0x8dcd12[_0x2f32('0x15')],_0x432216,'\x20'),'description':intUtil[_0x2f32('0x16')](_0x8dcd12[_0x2f32('0x17')],_0x432216,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x8dcd12[_0x2f32('0x17')],_0x432216,'\x0a')}},getCustomFields(_0x8dcd12[_0x2f32('0x18')],_0x432216))}})[_0x2f32('0x19')](function(_0x1889be){logger['info'](_0x2f32('0x1a'));return _0x1889be[_0x2f32('0x1b')];});}function getUser(_0x48906a,_0x27591a){if(intUtil[_0x2f32('0x1c')](_0x27591a)){logger[_0x2f32('0xc')](_0x2f32('0x1d'),_0x27591a);return request({'uri':util[_0x2f32('0xe')]('%s/search.json',_0x48906a[_0x2f32('0x10')]),'qs':{'query':util['format'](_0x2f32('0x1e'),_0x27591a)}})[_0x2f32('0x19')](function(_0x211732){if(_0x211732[_0x2f32('0x1f')]){logger[_0x2f32('0xc')](_0x2f32('0x20'));return _[_0x2f32('0x21')](_0x211732[_0x2f32('0x22')],{'email':_0x27591a,'role':_0x2f32('0x23')});}else{logger[_0x2f32('0xc')](_0x2f32('0x24'));return request({'uri':util['format'](_0x2f32('0x25'),_0x48906a[_0x2f32('0x10')])})[_0x2f32('0x19')](function(_0x49fd6f){logger['info']('Admin\x20account\x20selected.');return _0x49fd6f[_0x2f32('0x26')];});}});}else{logger[_0x2f32('0xc')](_0x2f32('0x24'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x25'),_0x48906a['remoteUri'])})[_0x2f32('0x19')](function(_0x2e43e0){logger['info'](_0x2f32('0x27'));return _0x2e43e0[_0x2f32('0x26')];});}}function getEndUser(_0x590485,_0x2cf829,_0x1e507d){logger[_0x2f32('0xc')](_0x2f32('0x28'),_0x1e507d);return request({'uri':util[_0x2f32('0xe')]('%s/search.json',_0x590485[_0x2f32('0x10')]),'qs':{'query':util[_0x2f32('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x1e507d)}})['then'](function(_0x3086b7){var _0x496942;if(_0x3086b7[_0x2f32('0x22')]['length']){_0x3086b7[_0x2f32('0x22')]=_[_0x2f32('0x29')](_0x3086b7[_0x2f32('0x22')],{'suspended':![],'role':_0x2f32('0x2a')});if(_0x3086b7[_0x2f32('0x22')][_0x2f32('0x2b')]){_0x496942=_[_0x2f32('0x2c')](_0x3086b7[_0x2f32('0x22')]);}}if(_0x496942){logger['info'](_0x2f32('0x2d'));return _0x496942;}else{logger['info'](_0x2f32('0x2e'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x2f'),_0x590485[_0x2f32('0x10')]),'method':_0x2f32('0x11'),'body':{'user':{'role':_0x2f32('0x2a'),'name':util[_0x2f32('0xe')](_0x2f32('0x30'),_0x2cf829||_0x1e507d),'phone':_0x1e507d}}})[_0x2f32('0x19')](function(_0x3846f2){logger['info']('Enduser\x20created.');return _0x3846f2[_0x2f32('0x26')];});}});}function getAuth(_0x2b2ee6){var _0x4ae1aa;if(_0x2b2ee6[_0x2f32('0x31')]==='password'){_0x4ae1aa=util[_0x2f32('0xe')](_0x2f32('0x32'),_0x2b2ee6[_0x2f32('0x33')],_0x2b2ee6[_0x2f32('0x34')]);}else if(_0x2b2ee6['authType']===_0x2f32('0x35')){_0x4ae1aa=util[_0x2f32('0xe')](_0x2f32('0x36'),_0x2b2ee6['username'],_0x2b2ee6[_0x2f32('0x35')]);}return util[_0x2f32('0xe')](_0x2f32('0x37'),new Buffer(_0x4ae1aa)[_0x2f32('0x38')](_0x2f32('0x39')));}function request(_0x5d9072){logger['debug'](_0x2f32('0x3a'),JSON[_0x2f32('0x3b')](_0x5d9072));return rp(_[_0x2f32('0x9')](_0x5d9072,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x22aed7,_0x2aed40){var _0x237434=[];if(_0x22aed7&&_0x22aed7[_0x2f32('0x2b')]>0x0){_0x237434=_['map'](_0x22aed7,_0x2aed40);}return _0x237434;}function getCustomFields(_0x5e56ef,_0x49eb0e){var _0x3bfa79=[];var _0x3fafa3={'custom_fields':[]};if(_0x5e56ef[_0x2f32('0x2b')]>0x0){_['forEach'](_0x5e56ef,function(_0x1283db){if(_[_0x2f32('0x3c')](['string',_0x2f32('0x3d')],_0x1283db[_0x2f32('0x3e')])&&_0x1283db[_0x2f32('0x3f')]&&!_0x1283db[_0x2f32('0x40')]){_0x3fafa3[_0x1283db[_0x2f32('0x3f')]['toLowerCase']()]=_0x1283db[_0x2f32('0x41')][_0x2f32('0x38')]();}else if(_[_0x2f32('0x3c')]([_0x2f32('0x42'),'picklist'],_0x1283db[_0x2f32('0x3e')])&&_0x1283db[_0x2f32('0x43')]&&_0x1283db['customField']){_0x3fafa3[_0x2f32('0x44')][_0x2f32('0x45')]({'id':_0x1283db[_0x2f32('0x43')],'value':_0x1283db[_0x2f32('0x41')][_0x2f32('0x38')]()});}else if(_0x1283db['type']==='variable'&&_0x1283db[_0x2f32('0x46')]&&_0x1283db[_0x2f32('0x43')]&&_0x1283db['customField']){_0x49eb0e[_0x1283db[_0x2f32('0x46')]]&&_0x3fafa3[_0x2f32('0x44')]['push']({'id':_0x1283db[_0x2f32('0x43')],'value':_0x49eb0e[_0x1283db[_0x2f32('0x46')]][_0x2f32('0x38')]()});}else if(_0x1283db['type']===_0x2f32('0x47')&&_0x1283db[_0x2f32('0x48')]&&_0x1283db[_0x2f32('0x48')]['name']&&_0x1283db[_0x2f32('0x43')]&&_0x1283db['customField']){_0x49eb0e[_0x1283db[_0x2f32('0x48')]['name'][_0x2f32('0x49')]()]&&_0x3fafa3[_0x2f32('0x44')]['push']({'id':_0x1283db[_0x2f32('0x43')],'value':_0x49eb0e[_0x1283db[_0x2f32('0x48')]['name'][_0x2f32('0x49')]()][_0x2f32('0x38')]()});}});}return _0x3fafa3;}exports[_0x2f32('0x4a')]=function(_0x5420d3,_0x3c083b,_0x1ca451,_0x2d5f06,_0x4d8c96,_0x465811){var _0x389d18,_0x5c976c;_0x465811[_0x2f32('0x10')]=intUtil['stripTrailingSlash'](_0x465811['remoteUri']);_0x465811[_0x2f32('0x4b')]=intUtil[_0x2f32('0x4c')](_0x465811[_0x2f32('0x4b')]);if(_0x4d8c96&&_0x4d8c96[_0x2f32('0x4d')]){logger['info'](_0x2f32('0x4e'),_0x2f32('0x4f'));_0x3c083b[_0x2f32('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x465811[_0x2f32('0x4b')],_0x3c083b[_0x2f32('0x51')],md5(_0x3c083b['uniqueid']));}else{_0x3c083b['recordingURL']='';}headers['Authorization']=getAuth(_0x465811);return getUser(_0x465811,_0x2d5f06[_0x2f32('0x52')])['then'](function(_0x4910d7){_0x389d18=_0x4910d7;logger[_0x2f32('0xc')](_0x2f32('0x53'),_0x389d18['id']);return getEndUser(_0x465811,_0x3c083b[_0x2f32('0x54')],_0x3c083b[_0x2f32('0x55')]);})[_0x2f32('0x19')](function(_0x582af9){_0x5c976c=_0x582af9;logger[_0x2f32('0xc')](_0x2f32('0x56'),_0x5c976c['id']);return getTicket(_0x465811,_0x389d18,_0x5c976c,_0x1ca451,_0x3c083b);})['then'](function(_0x6950ce){if(_0x6950ce){logger['info']('The\x20Ticket\x20ID\x20is:',_0x6950ce['id']);switch(_0x465811[_0x2f32('0x3e')]){case _0x2f32('0x57'):logger[_0x2f32('0xc')](_0x2f32('0x4e'),_0x2f32('0x58'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x59'),_0x465811[_0x2f32('0x10')],_0x389d18['id'],_0x6950ce['id']),'method':'POST'});case _0x2f32('0x5a'):logger[_0x2f32('0xc')](_0x2f32('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2f32('0xe')]('user:%s',_0x2d5f06[_0x2f32('0x14')]),_0x2f32('0x5b'),{'uri':util['format'](_0x2f32('0x5c'),_0x465811[_0x2f32('0x10')][_0x2f32('0x5d')](_0x2f32('0x5e'),''),_0x6950ce['id'])});break;default:logger['error'](_0x2f32('0x4e'),_0x2f32('0x5f'));}}})[_0x2f32('0x60')](function(_0x53ab2d){logger[_0x2f32('0x61')](_0x2f32('0x62'),util['inspect'](_0x53ab2d,{'showHidden':!![],'depth':null}));});};exports[_0x2f32('0x63')]=function(_0x128988,_0x2dbc07,_0x17daf4,_0x51916f,_0x245559,_0x364b78,_0x4b06b9){var _0x91265a,_0x3ee303;_0x364b78[_0x2f32('0x10')]=intUtil[_0x2f32('0x4c')](_0x364b78[_0x2f32('0x10')]);_0x364b78[_0x2f32('0x4b')]=intUtil['stripTrailingSlash'](_0x364b78['serverUrl']);if(_0x4b06b9&&_0x4b06b9[_0x2f32('0x64')]&&_0x4b06b9[_0x2f32('0x64')]!==_0x2f32('0x65')){logger[_0x2f32('0xc')]('[OUTBOUND]',_0x2f32('0x4f'));_0x2dbc07['recordingURL']=util[_0x2f32('0xe')](_0x2f32('0x66'),_0x364b78['serverUrl'],_0x2dbc07[_0x2f32('0x51')],md5(_0x2dbc07[_0x2f32('0x51')]));}headers[_0x2f32('0x67')]=getAuth(_0x364b78);return getUser(_0x364b78,_0x51916f['email'])[_0x2f32('0x19')](function(_0x5bed1e){_0x91265a=_0x5bed1e;logger[_0x2f32('0xc')]('The\x20User\x20ID\x20is:',_0x91265a['id']);return getEndUser(_0x364b78,_0x2dbc07[_0x2f32('0x68')],_0x2dbc07[_0x2f32('0x69')]);})[_0x2f32('0x19')](function(_0x290b3c){_0x3ee303=_0x290b3c;logger['info'](_0x2f32('0x56'),_0x3ee303['id']);return getTicket(_0x364b78,_0x91265a,_0x3ee303,_0x17daf4,_0x2dbc07);})[_0x2f32('0x19')](function(_0x4f5339){if(_0x4f5339){logger[_0x2f32('0xc')](_0x2f32('0x6a'),_0x4f5339['id']);switch(_0x364b78[_0x2f32('0x3e')]){case'integrationTab':logger['info'](_0x2f32('0x6b'),_0x2f32('0x58'));return request({'uri':util[_0x2f32('0xe')](_0x2f32('0x59'),_0x364b78['remoteUri'],_0x91265a['id'],_0x4f5339['id']),'method':_0x2f32('0x11')});case _0x2f32('0x5a'):logger['info']('[OUTBOUND]',_0x2f32('0x6c'));emit(util['format'](_0x2f32('0x6d'),_0x51916f[_0x2f32('0x14')]),_0x2f32('0x5b'),{'uri':util[_0x2f32('0xe')]('%s/agent/tickets/%s',_0x364b78[_0x2f32('0x10')]['replace']('/api/v2',''),_0x4f5339['id'])});break;default:logger[_0x2f32('0x61')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2f32('0x60')](function(_0x12f7b2){logger[_0x2f32('0x61')](_0x2f32('0x6e'),util[_0x2f32('0x6f')](_0x12f7b2,{'showHidden':!![],'depth':null}));});};exports[_0x2f32('0x70')]=function(_0x2de672,_0x4d909a,_0x2ee997,_0x5710c2,_0x17d163,_0x53b1ae){var _0x5e2284,_0xfd0a62;_0x53b1ae[_0x2f32('0x10')]=intUtil[_0x2f32('0x4c')](_0x53b1ae['remoteUri']);_0x53b1ae[_0x2f32('0x4b')]=intUtil[_0x2f32('0x4c')](_0x53b1ae[_0x2f32('0x4b')]);if(_0x17d163&&_0x17d163['monitor_format']){logger[_0x2f32('0xc')]('['+_0x4d909a[_0x2f32('0x71')][_0x2f32('0x72')]()+']',_0x2f32('0x4f'));_0x4d909a[_0x2f32('0x50')]=util[_0x2f32('0xe')](_0x2f32('0x66'),_0x53b1ae[_0x2f32('0x4b')],_0x4d909a[_0x2f32('0x51')],md5(_0x4d909a[_0x2f32('0x51')]));}else{_0x4d909a[_0x2f32('0x50')]='';}headers['Authorization']=getAuth(_0x53b1ae);return getUser(_0x53b1ae)[_0x2f32('0x19')](function(_0x1ab55e){_0x5e2284=_0x1ab55e;logger[_0x2f32('0xc')](_0x2f32('0x53'),_0x5e2284['id']);return getEndUser(_0x53b1ae,_0x4d909a[_0x2f32('0x54')],_0x4d909a[_0x2f32('0x55')]);})['then'](function(_0x29371a){_0xfd0a62=_0x29371a;logger['info'](_0x2f32('0x56'),_0xfd0a62['id']);return getTicket(_0x53b1ae,_0x5e2284,_0xfd0a62,_0x2ee997,_0x4d909a);})[_0x2f32('0x19')](function(_0x31c1c3){if(_0x31c1c3){logger[_0x2f32('0xc')]('The\x20Ticket\x20ID\x20is:',_0x31c1c3['id']);}})[_0x2f32('0x60')](function(_0x2f15e0){logger['error']('['+_0x4d909a[_0x2f32('0x71')][_0x2f32('0x72')]()+']'+_0x2f32('0x73'),util[_0x2f32('0x6f')](_0x2f15e0,{'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 fcb2065..b8adbd9 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 _0x79c6=['Inbound','Fields','/crm/v2/Calls','err','log','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','recordingURL','/api/voice/recordings/','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','idField','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','GET','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type'];(function(_0xfbe418,_0x2677f4){var _0x46e9b7=function(_0x5f2f62){while(--_0x5f2f62){_0xfbe418['push'](_0xfbe418['shift']());}};_0x46e9b7(++_0x2677f4);}(_0x79c6,0x158));var _0x679c=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x79c6[_0x7791d5];return _0x5ce288;};'use strict';var _=require(_0x679c('0x0'));var rp=require(_0x679c('0x1'));var md5=require(_0x679c('0x2'));var util=require('util');var intUtil=require(_0x679c('0x3'));var moment=require(_0x679c('0x4'));var Redis=require(_0x679c('0x5'));var BPromise=require(_0x679c('0x6'));var config=require(_0x679c('0x7'));var logger=require(_0x679c('0x8'))(_0x679c('0x9'));config[_0x679c('0xa')]=_[_0x679c('0xb')](config[_0x679c('0xa')],{'host':_0x679c('0xc'),'port':0x18eb});var io=require(_0x679c('0xd'))(new Redis(config[_0x679c('0xa')]));function emit(_0xc42b66,_0x3ae23e,_0x219888){io['to'](_0xc42b66)[_0x679c('0xe')](_0x3ae23e,_0x219888);}function request(_0x5df653){logger[_0x679c('0xf')]('[HTTP]',JSON[_0x679c('0x10')](_0x5df653));return rp(_0x5df653);}function getCustomFields(_0x263b05,_0x2e1d97){var _0x1da868={};if(_0x263b05[_0x679c('0x11')]>0x0){_[_0x679c('0x12')](_0x263b05,function(_0xca2f44){if(_[_0x679c('0x13')]([_0x679c('0x14'),'picklist'],_0xca2f44['type'])&&_0xca2f44[_0x679c('0x15')]){_0x1da868[_0xca2f44['idField']]=_0xca2f44['content']['toString']();}else if(_0xca2f44[_0x679c('0x16')]===_0x679c('0x17')&&_0xca2f44[_0x679c('0x18')]&&_0xca2f44[_0x679c('0x15')]&&_0x2e1d97[_0xca2f44[_0x679c('0x18')]]){_0x1da868[_0xca2f44[_0x679c('0x15')]]=_0x2e1d97[_0xca2f44[_0x679c('0x18')]]['toString']();}else if(_0xca2f44['type']===_0x679c('0x19')&&_0xca2f44[_0x679c('0x1a')]&&_0xca2f44['Variable']['name']&&_0xca2f44[_0x679c('0x15')]&&_0x2e1d97[_0xca2f44[_0x679c('0x1a')][_0x679c('0x1b')][_0x679c('0x1c')]()]){_0x1da868[_0xca2f44['idField']]=_0x2e1d97[_0xca2f44[_0x679c('0x1a')]['name']['toLowerCase']()][_0x679c('0x1d')]();}});}return _0x1da868;}function getName(_0x4e0ed9){if(_0x4e0ed9[_0x679c('0x1e')]('\x20')>0x0){var _0x4bd623=_0x4e0ed9[_0x679c('0x1f')](/ (.+)/);if(_0x4bd623[0x1]){return _0x4bd623;}}return[_0x4e0ed9,_0x4e0ed9];}var accountsTokens={};function getAccessToken(_0x3e38f9){return new Promise(function(_0x229245,_0x3bea71){if(!_[_0x679c('0x20')](accountsTokens[_0x3e38f9['id']])&&!_['isNil'](accountsTokens[_0x3e38f9['id']][_0x679c('0x21')])){if(moment()[_0x679c('0x22')](accountsTokens[_0x3e38f9['id']][_0x679c('0x23')])){_0x229245(accountsTokens[_0x3e38f9['id']][_0x679c('0x21')]);}}var _0x2dfae8;switch(_0x3e38f9[_0x679c('0x24')]){case'US':_0x2dfae8=_0x679c('0x25');break;case'AU':_0x2dfae8='https://accounts.zoho.com.au';break;case'EU':_0x2dfae8=_0x679c('0x26');break;case'IN':_0x2dfae8=_0x679c('0x27');break;case'CN':_0x2dfae8='https://accounts.zoho.com.cn';break;default:_0x2dfae8=_0x679c('0x26');break;}var _0x41fb72={'method':_0x679c('0x28'),'uri':_0x2dfae8+'/oauth/v2/token','qs':{'refresh_token':_0x3e38f9[_0x679c('0x29')],'client_id':_0x3e38f9[_0x679c('0x2a')],'client_secret':_0x3e38f9[_0x679c('0x2b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x41fb72)[_0x679c('0x2c')](function(_0x1fb3e5){accountsTokens[_0x3e38f9['id']]={'access_token':_0x1fb3e5[_0x679c('0x21')],'expires_in':moment()[_0x679c('0x2d')](_0x1fb3e5[_0x679c('0x23')],_0x679c('0x2e'))};_0x229245(_0x1fb3e5[_0x679c('0x21')]);})['catch'](function(_0x227982){logger[_0x679c('0x2f')](_0x679c('0x30'),_0x227982[_0x679c('0x31')]);_0x3bea71(_0x227982);});});}function getUser(_0xf6d475,_0x22b452,_0x4fcb22,_0x2ff8d3){logger[_0x679c('0x32')]('Search\x20user');return request({'method':'GET','uri':util[_0x679c('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x22b452),'qs':{'type':_0x679c('0x34')},'headers':{'Authorization':_0x679c('0x35')+_0xf6d475},'json':!![]})[_0x679c('0x2c')](function(_0x2dc30d){if(_0x2dc30d[_0x679c('0x36')]){var _0x5dd913=-0x1;if(_[_0x679c('0x37')](_0x2dc30d['users'])){if(!_['isNil'](_0x2ff8d3)){_0x5dd913=_[_0x679c('0x38')](_0x2dc30d['users'],function(_0x1f2f42){return _0x1f2f42[_0x679c('0x39')]===_0x2ff8d3;});}if(_0x5dd913>=0x0){logger[_0x679c('0x32')](_0x679c('0x3a'));}else{logger[_0x679c('0x32')](_0x679c('0x3b'));_0x5dd913=_[_0x679c('0x38')](_0x2dc30d[_0x679c('0x36')],function(_0x1b4028){return _0x1b4028[_0x679c('0x3c')][_0x679c('0x1b')]===_0x679c('0x3d');});}return _0x2dc30d['users'][_0x5dd913];}else{if(_0x2dc30d[_0x679c('0x3e')][_0x679c('0x3c')][_0x679c('0x1b')]===_0x679c('0x3d')){logger[_0x679c('0x32')](_0x679c('0x3b'));user=_0x2dc30d[_0x679c('0x3e')];return user;}else{logger[_0x679c('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x679c('0x10')](_0x2dc30d));throw new Error(_0x679c('0x3f')+JSON['stringify'](_0x2dc30d));}}}else{logger[_0x679c('0x2f')](_0x679c('0x40'),JSON[_0x679c('0x10')](_0x2dc30d));throw new Error(_0x679c('0x3f')+JSON[_0x679c('0x10')](_0x2dc30d));}})[_0x679c('0x41')](function(_0x16195f){console['error'](_0x16195f);});}function getZohoUser(_0x244809,_0xc738f9){return new BPromise(function(_0x21afef,_0x44d3eb){request(_0x244809)[_0x679c('0x2c')](function(_0x537c81){var _0x341d6c=null;if(_0x537c81){_0x341d6c=_0x537c81[_0x679c('0x42')][0x0];_0x341d6c['enduserType']=_0xc738f9;}_0x21afef(_0x341d6c);})['catch'](function(_0x35abc5){_0x44d3eb(_0x35abc5);});});}function createEndUser(_0x1c4e99,_0x436fe7,_0x20aa26,_0x5d8d6b,_0x19f6b2,_0x8887ad){var _0x20aa26=getName(_0x20aa26);return request({'method':_0x679c('0x28'),'uri':_0x679c('0x43')+_0x436fe7+_0x679c('0x44')+_[_0x679c('0x45')](_0x8887ad[_0x679c('0x46')])+'s','body':{'data':[{'Last_Name':_0x20aa26[0x1],'First_Name':_0x20aa26[0x0],'Phone':_0x5d8d6b,'Owner':{'name':!_[_0x679c('0x20')](_0x19f6b2[_0x679c('0x47')]['name'])?_0x19f6b2[_0x679c('0x47')][_0x679c('0x1b')]:!_[_0x679c('0x20')](_0x19f6b2['first_name'])?_0x19f6b2[_0x679c('0x48')]+'\x20'+_0x19f6b2[_0x679c('0x49')]:_0x19f6b2[_0x679c('0x49')],'id':_0x19f6b2['id']}}]},'headers':{'Authorization':_0x679c('0x35')+_0x1c4e99},'json':!![]})['then'](function(_0x3a6d39){if(_0x3a6d39&&_0x3a6d39[_0x679c('0x42')][0x0][_0x679c('0x4a')]===_0x679c('0x4b')){var _0x38f3c4=_0x3a6d39[_0x679c('0x42')][0x0][_0x679c('0x4c')];_0x38f3c4[_0x679c('0x4d')]=_[_0x679c('0x45')](_0x8887ad[_0x679c('0x46')])+'s';return _0x38f3c4;}logger[_0x679c('0x2f')]('The\x20failing\x20result\x20is',JSON[_0x679c('0x10')](data));throw new Error(_0x679c('0x4e')+JSON[_0x679c('0x10')](data));})['catch'](function(_0xc54d64){console['log']('CREATE\x20ERROR',_0xc54d64);});}function getEndUser(_0x1d9747,_0x3b8c6f,_0x1f02e8,_0x142c5c,_0x3bda20,_0x5b366e,_0x2ecf16){var _0x487f90={'method':_0x679c('0x4f'),'uri':'','headers':{'Authorization':_0x679c('0x35')+_0x1d9747},'json':!![]};switch(_0x2ecf16[_0x679c('0x50')]){case _0x679c('0x51'):_0x487f90['uri']=_0x679c('0x43')+_0x3b8c6f+_0x679c('0x52')+_0x3bda20+'))';return getZohoUser(_0x487f90,_0x679c('0x53'))['then'](function(_0x3efdaa){if(_0x3efdaa)return _0x3efdaa;_0x487f90['uri']=_0x679c('0x43')+_0x3b8c6f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3bda20+'))';return getZohoUser(_0x487f90,_0x679c('0x54'))[_0x679c('0x2c')](function(_0x590a23){if(_0x590a23)return _0x590a23;if(_0x2ecf16[_0x679c('0x46')]!=_0x679c('0x55')){return createEndUser(_0x1d9747,_0x3b8c6f,_0x142c5c,_0x3bda20,_0x5b366e,_0x2ecf16);}else{return{};}});});break;case _0x679c('0x56'):_0x487f90['uri']=_0x679c('0x43')+_0x3b8c6f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3bda20+'))';return getZohoUser(_0x487f90,_0x679c('0x53'))[_0x679c('0x2c')](function(_0x1776bd){if(_0x1776bd)return _0x1776bd;if(_0x2ecf16[_0x679c('0x46')]!=_0x679c('0x55')){return createEndUser(_0x1d9747,_0x3b8c6f,_0x142c5c,_0x3bda20,_0x5b366e,_0x2ecf16);}else{return{};}});break;case _0x679c('0x57'):_0x487f90['uri']=_0x679c('0x43')+_0x3b8c6f+_0x679c('0x58')+_0x3bda20+'))';return getZohoUser(_0x487f90,_0x679c('0x54'))[_0x679c('0x2c')](function(_0x4eda70){if(_0x4eda70)return _0x4eda70;if(_0x2ecf16[_0x679c('0x46')]!='nothing'){return createEndUser(_0x1d9747,_0x3b8c6f,_0x142c5c,_0x3bda20,_0x5b366e,_0x2ecf16);}else{return{};}});break;}}function getCall(_0x936f40,_0x2b4dc7,_0x1d6638,_0x24676a,_0x6343d0,_0x25e543,_0xef8b8b,_0x1ef4b6){logger[_0x679c('0x32')]('Creating\x20new\x20call...');var _0x1f1ec1={};_0x1f1ec1['Owner']={'name':!_[_0x679c('0x20')](_0x24676a[_0x679c('0x47')][_0x679c('0x1b')])&&!_[_0x679c('0x20')](_0x24676a[_0x679c('0x3c')][_0x679c('0x1b')])&&_0x24676a[_0x679c('0x3c')][_0x679c('0x1b')]===_0x679c('0x59')?_0x24676a[_0x679c('0x47')][_0x679c('0x1b')]:!_[_0x679c('0x20')](_0x24676a[_0x679c('0x48')])?_0x24676a[_0x679c('0x48')]+'\x20'+_0x24676a[_0x679c('0x49')]:_0x24676a[_0x679c('0x49')],'id':_0x24676a['id']};_0x1f1ec1[_0x679c('0x5a')]=intUtil[_0x679c('0x5b')](_0x25e543[_0x679c('0x5c')],_0xef8b8b,'\x20');_0x1f1ec1['Description']=intUtil[_0x679c('0x5b')](_0x25e543['Descriptions'],_0xef8b8b,'\x0a');if(_0x6343d0['enduserType']===_0x679c('0x53')){_0x1f1ec1[_0x679c('0x5d')]={'name':!_[_0x679c('0x20')](_0x6343d0[_0x679c('0x5e')])?_0x6343d0['Full_Name']:!_[_0x679c('0x20')](_0x6343d0[_0x679c('0x5f')])?_0x6343d0[_0x679c('0x5f')]+'\x20'+_0x6343d0[_0x679c('0x60')]:_0x6343d0['Last_Name'],'id':_0x6343d0['id']};}if(_0x6343d0[_0x679c('0x4d')]===_0x679c('0x54')){_0x1f1ec1[_0x679c('0x61')]={'name':!_[_0x679c('0x20')](_0x6343d0['Full_Name'])?_0x6343d0[_0x679c('0x5e')]:!_[_0x679c('0x20')](_0x6343d0['First_Name'])?_0x6343d0[_0x679c('0x5f')]+'\x20'+_0x6343d0[_0x679c('0x60')]:_0x6343d0['Last_Name'],'id':_0x6343d0['id']};_0x1f1ec1[_0x679c('0x62')]=_['startCase'](_0x6343d0['enduserType']);}if(_0xef8b8b[_0x679c('0x63')]){_0x1f1ec1['Call_Duration']=moment['utc'](parseInt(_0xef8b8b[_0x679c('0x63')])*0x3e8)[_0x679c('0x33')]('mm:ss');}else if(_0xef8b8b[_0x679c('0x64')]&&_0xef8b8b[_0x679c('0x65')]){_0x1f1ec1['Call_Duration']=moment['utc'](moment(_0xef8b8b[_0x679c('0x65')],_0x679c('0x66'))[_0x679c('0x67')](moment(_0xef8b8b[_0x679c('0x68')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x679c('0x69'));}switch(_0xef8b8b['lastevent']){case _0x679c('0x6a'):_0x1f1ec1[_0x679c('0x6b')]=_0x679c('0x6c');break;case _0x679c('0x6d'):case _0x679c('0x6e'):_0x1f1ec1[_0x679c('0x6b')]=_0x679c('0x6f');break;case _0x679c('0x70'):_0x1f1ec1['Call_Result']=_0x679c('0x71');break;case _0x679c('0x72'):_0x1f1ec1[_0x679c('0x6b')]=_0x679c('0x73');break;case _0x679c('0x74'):_0x1f1ec1['Call_Result']='Timeout';default:}_0x1f1ec1[_0x679c('0x75')]=(_0x1ef4b6===_0x679c('0x76')?moment(_0xef8b8b[_0x679c('0x68')])[_0x679c('0x33')](_0x679c('0x66')):moment(_0xef8b8b[_0x679c('0x77')])[_0x679c('0x33')](_0x679c('0x66')))||moment()['format'](_0x679c('0x66'));_0x1f1ec1[_0x679c('0x78')]=_0x1ef4b6||_0x679c('0x79');_0x1f1ec1=_['merge'](_0x1f1ec1,getCustomFields(_0x25e543[_0x679c('0x7a')],_0xef8b8b));return request({'method':_0x679c('0x28'),'uri':_0x679c('0x43')+_0x2b4dc7+_0x679c('0x7b'),'headers':{'Authorization':_0x679c('0x35')+_0x936f40},'body':{'data':[_0x1f1ec1]},'json':!![]})[_0x679c('0x2c')](function(_0x69b167){if(_0x69b167&&_0x69b167[_0x679c('0x42')][0x0][_0x679c('0x4a')]===_0x679c('0x4b')){logger[_0x679c('0x32')]('Call\x20created!');return{'id':_0x69b167['data'][0x0][_0x679c('0x4c')]['id']};}})[_0x679c('0x41')](function(_0x54681d){logger[_0x679c('0x32')](_0x679c('0x7c'),_0x54681d[_0x679c('0x31')]);console[_0x679c('0x7d')](_0x679c('0x7c'),_0x54681d);});}exports[_0x679c('0x7e')]=function(_0x4df28c,_0x2b328b,_0xae60b1,_0xb4cca0,_0x332706,_0x1f8781){var _0x558d98,_0x364d8d,_0x4a70d7;_0x1f8781['host']=intUtil[_0x679c('0x7f')](_0x1f8781['host']);_0x1f8781[_0x679c('0x80')]=intUtil['stripTrailingSlash'](_0x1f8781[_0x679c('0x80')]);if(_0x332706&&_0x332706[_0x679c('0x81')]){logger['info'](_0x679c('0x82'),_0x679c('0x83'));_0x2b328b['recordingURL']=_0x1f8781[_0x679c('0x80')]+'/api/voice/recordings/'+_0x2b328b[_0x679c('0x84')]+_0x679c('0x85')+md5(_0x2b328b[_0x679c('0x84')]);}else{_0x2b328b['recordingURL']='';}var _0x4e12b3=_0x1f8781[_0x679c('0x86')]===_0x679c('0x87')?'eu':_0x679c('0x88');return getAccessToken(_0x1f8781)[_0x679c('0x2c')](function(_0x689b77){_0x4a70d7=_0x689b77;return getUser(_0x4a70d7,_0x4e12b3,_0x1f8781,_0xb4cca0[_0x679c('0x39')]);})[_0x679c('0x2c')](function(_0x1741e0){_0x558d98=_0x1741e0;logger[_0x679c('0x32')](_0x679c('0x89'),_0x558d98['id']);return getEndUser(_0x4a70d7,_0x4e12b3,_0x1f8781,_0x2b328b[_0x679c('0x8a')],_0x2b328b[_0x679c('0x8b')],_0x558d98,_0xae60b1);})['then'](function(_0x26925a){_0x364d8d=_0x26925a;return getCall(_0x4a70d7,_0x4e12b3,_0x1f8781,_0x558d98,_0x364d8d,_0xae60b1,_0x2b328b,_0x679c('0x79'));})[_0x679c('0x2c')](function(_0x4baeee){if(_0x4baeee){logger[_0x679c('0x32')](_0x679c('0x8c'),_0x4baeee['id']);logger[_0x679c('0x32')](_0x679c('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x679c('0x8d'),_0xb4cca0[_0x679c('0x1b')]),_0x679c('0x8e'),{'uri':_0x679c('0x8f')+_0x1f8781[_0x679c('0x86')]+_0x679c('0x90')+_0x4baeee['id']});}})[_0x679c('0x41')](function(_0x3a27e1){logger[_0x679c('0x2f')](_0x679c('0x82'),JSON['stringify'](_0x3a27e1));});};exports[_0x679c('0x76')]=function(_0x147eec,_0x5f4702,_0xd749d4,_0x1311a6,_0x2ba956,_0xbc9ed5,_0x4c37f1){var _0x24aa24,_0x5664e2,_0x29c7df;_0xbc9ed5[_0x679c('0x86')]=intUtil[_0x679c('0x7f')](_0xbc9ed5['host']);_0xbc9ed5[_0x679c('0x80')]=intUtil[_0x679c('0x7f')](_0xbc9ed5[_0x679c('0x80')]);if(_0x4c37f1&&_0x4c37f1[_0x679c('0x91')]&&_0x4c37f1[_0x679c('0x91')]!==_0x679c('0x92')){logger[_0x679c('0x32')](_0x679c('0x93'),_0x679c('0x83'));_0x5f4702[_0x679c('0x94')]=_0xbc9ed5[_0x679c('0x80')]+_0x679c('0x95')+_0x5f4702[_0x679c('0x84')]+_0x679c('0x85')+md5(_0x5f4702[_0x679c('0x84')]);}var _0x3bce1d=_0xbc9ed5[_0x679c('0x86')]===_0x679c('0x87')?'eu':_0x679c('0x88');return getAccessToken(_0xbc9ed5)['then'](function(_0xd0339a){_0x29c7df=_0xd0339a;return getUser(_0x29c7df,_0x3bce1d,_0xbc9ed5,_0x1311a6[_0x679c('0x39')]);})['then'](function(_0x5cd529){_0x24aa24=_0x5cd529;logger['info']('The\x20User\x20ID\x20is:',_0x24aa24['id']);return getEndUser(_0x29c7df,_0x3bce1d,_0xbc9ed5,_0x5f4702[_0x679c('0x96')],_0x5f4702[_0x679c('0x97')],_0x24aa24,_0xd749d4);})['then'](function(_0x5316e2){_0x5664e2=_0x5316e2;return getCall(_0x29c7df,_0x3bce1d,_0xbc9ed5,_0x24aa24,_0x5664e2,_0xd749d4,_0x5f4702,'Outbound');})[_0x679c('0x2c')](function(_0x1313b7){if(_0x1313b7){logger[_0x679c('0x32')](_0x679c('0x8c'),_0x1313b7['id']);logger[_0x679c('0x32')](_0x679c('0x93'),_0x679c('0x98'));emit(util[_0x679c('0x33')](_0x679c('0x8d'),_0x1311a6[_0x679c('0x1b')]),_0x679c('0x8e'),{'uri':_0x679c('0x8f')+_0xbc9ed5[_0x679c('0x86')]+_0x679c('0x90')+_0x1313b7['id']});}})[_0x679c('0x41')](function(_0xf518ee){logger[_0x679c('0x2f')](_0x679c('0x93'),JSON['stringify'](_0xf518ee));});};exports['unmanaged']=function(_0x45079f,_0x450106,_0x1024c1,_0x7548d3,_0x43680b,_0x91ff9b){var _0x2f8169,_0x403d07,_0x1fc42d;_0x91ff9b[_0x679c('0x86')]=intUtil[_0x679c('0x7f')](_0x91ff9b['host']);_0x91ff9b[_0x679c('0x80')]=intUtil[_0x679c('0x7f')](_0x91ff9b['serverUrl']);if(_0x43680b&&_0x43680b[_0x679c('0x81')]){logger[_0x679c('0x32')]('['+_0x450106[_0x679c('0x99')]['toUpperCase']()+']',_0x679c('0x83'));_0x450106[_0x679c('0x94')]=_0x91ff9b[_0x679c('0x80')]+_0x679c('0x95')+_0x450106[_0x679c('0x84')]+_0x679c('0x85')+md5(_0x450106[_0x679c('0x84')]);}else{_0x450106[_0x679c('0x94')]='';}var _0x43091e=_0x91ff9b[_0x679c('0x86')]===_0x679c('0x87')?'eu':'com';return getAccessToken(_0x91ff9b)[_0x679c('0x2c')](function(_0xac7377){_0x1fc42d=_0xac7377;return getUser(_0x1fc42d,_0x43091e,_0x91ff9b);})[_0x679c('0x2c')](function(_0x16f6b0){_0x2f8169=_0x16f6b0;logger[_0x679c('0x32')](_0x679c('0x89'),_0x2f8169['id']);return getEndUser(_0x1fc42d,_0x43091e,_0x91ff9b,_0x450106[_0x679c('0x8a')],_0x450106[_0x679c('0x8b')],_0x2f8169,_0x1024c1);})['then'](function(_0x22b01d){_0x403d07=_0x22b01d;return getCall(_0x1fc42d,_0x43091e,_0x91ff9b,_0x2f8169,_0x403d07,_0x1024c1,_0x450106,_0x679c('0x79'));})[_0x679c('0x2c')](function(_0x591c76){if(_0x591c76){logger[_0x679c('0x32')](_0x679c('0x8c'),_0x591c76['id']);}})['catch'](function(_0x253992){logger[_0x679c('0x2f')]('['+_0x450106[_0x679c('0x99')][_0x679c('0x9a')]()+']',JSON['stringify'](_0x253992));});}; \ No newline at end of file +var _0x1542=['/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','seconds','error','info','Search\x20user','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','catch','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','diff','starttime','lastevent','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','YYYY-MM-DDTHH:mm:ss','Inbound','merge','/crm/v2/Calls','details','err','stack','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','trigger:browser:url','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridname','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','debug','stringify','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','indexOf','split','isNil','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST'];(function(_0x405052,_0x155366){var _0x39c572=function(_0x2e2341){while(--_0x2e2341){_0x405052['push'](_0x405052['shift']());}};_0x39c572(++_0x155366);}(_0x1542,0x73));var _0x2154=function(_0x39f2e1,_0x14a940){_0x39f2e1=_0x39f2e1-0x0;var _0xce7766=_0x1542[_0x39f2e1];return _0xce7766;};'use strict';var _=require(_0x2154('0x0'));var rp=require(_0x2154('0x1'));var md5=require(_0x2154('0x2'));var util=require(_0x2154('0x3'));var intUtil=require(_0x2154('0x4'));var moment=require('moment');var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x2154('0x5'));var logger=require(_0x2154('0x6'))(_0x2154('0x7'));config['redis']=_[_0x2154('0x8')](config[_0x2154('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2154('0xa'))(new Redis(config[_0x2154('0x9')]));function emit(_0x3b3ecc,_0x4805d1,_0x2242f8){io['to'](_0x3b3ecc)['emit'](_0x4805d1,_0x2242f8);}function request(_0x542abe){logger[_0x2154('0xb')]('[HTTP]',JSON[_0x2154('0xc')](_0x542abe));return rp(_0x542abe);}function getCustomFields(_0x589659,_0x391cfe){var _0x5c5135={};if(_0x589659['length']>0x0){_['forEach'](_0x589659,function(_0x5a2ba3){if(_[_0x2154('0xd')]([_0x2154('0xe'),_0x2154('0xf')],_0x5a2ba3['type'])&&_0x5a2ba3[_0x2154('0x10')]){_0x5c5135[_0x5a2ba3[_0x2154('0x10')]]=_0x5a2ba3[_0x2154('0x11')][_0x2154('0x12')]();}else if(_0x5a2ba3[_0x2154('0x13')]==='variable'&&_0x5a2ba3[_0x2154('0x14')]&&_0x5a2ba3[_0x2154('0x10')]&&_0x391cfe[_0x5a2ba3['variableName']]){_0x5c5135[_0x5a2ba3[_0x2154('0x10')]]=_0x391cfe[_0x5a2ba3[_0x2154('0x14')]][_0x2154('0x12')]();}else if(_0x5a2ba3['type']===_0x2154('0x15')&&_0x5a2ba3[_0x2154('0x16')]&&_0x5a2ba3['Variable'][_0x2154('0x17')]&&_0x5a2ba3[_0x2154('0x10')]&&_0x391cfe[_0x5a2ba3[_0x2154('0x16')]['name']['toLowerCase']()]){_0x5c5135[_0x5a2ba3['idField']]=_0x391cfe[_0x5a2ba3[_0x2154('0x16')][_0x2154('0x17')]['toLowerCase']()]['toString']();}});}return _0x5c5135;}function getName(_0x1e3b20){if(_0x1e3b20[_0x2154('0x18')]('\x20')>0x0){var _0x5121bd=_0x1e3b20[_0x2154('0x19')](/ (.+)/);if(_0x5121bd[0x1]){return _0x5121bd;}}return[_0x1e3b20,_0x1e3b20];}var accountsTokens={};function getAccessToken(_0x438442){return new Promise(function(_0x217e6d,_0x4bd8b8){if(!_[_0x2154('0x1a')](accountsTokens[_0x438442['id']])&&!_[_0x2154('0x1a')](accountsTokens[_0x438442['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x438442['id']]['expires_in'])){_0x217e6d(accountsTokens[_0x438442['id']]['access_token']);}}var _0x2a4bcb;switch(_0x438442[_0x2154('0x1b')]){case'US':_0x2a4bcb=_0x2154('0x1c');break;case'AU':_0x2a4bcb=_0x2154('0x1d');break;case'EU':_0x2a4bcb='https://accounts.zoho.eu';break;case'IN':_0x2a4bcb=_0x2154('0x1e');break;case'CN':_0x2a4bcb=_0x2154('0x1f');break;default:_0x2a4bcb='https://accounts.zoho.eu';break;}var _0x2878dc={'method':_0x2154('0x20'),'uri':_0x2a4bcb+_0x2154('0x21'),'qs':{'refresh_token':_0x438442[_0x2154('0x22')],'client_id':_0x438442[_0x2154('0x23')],'client_secret':_0x438442[_0x2154('0x24')],'grant_type':_0x2154('0x25')},'json':!![]};return rp(_0x2878dc)[_0x2154('0x26')](function(_0x4e4ee7){accountsTokens[_0x438442['id']]={'access_token':_0x4e4ee7[_0x2154('0x27')],'expires_in':moment()['add'](_0x4e4ee7['expires_in'],_0x2154('0x28'))};_0x217e6d(_0x4e4ee7[_0x2154('0x27')]);})['catch'](function(_0x421682){logger[_0x2154('0x29')]('Failing\x20creating\x20the\x20access_token',_0x421682['stack']);_0x4bd8b8(_0x421682);});});}function getUser(_0x30a40c,_0x546006,_0x29f038,_0x13c644){logger[_0x2154('0x2a')](_0x2154('0x2b'));return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x546006),'qs':{'type':_0x2154('0x2c')},'headers':{'Authorization':_0x2154('0x2d')+_0x30a40c},'json':!![]})[_0x2154('0x26')](function(_0xd205ec){if(_0xd205ec['users']){var _0x20d767=-0x1;if(_['isArrayLikeObject'](_0xd205ec[_0x2154('0x2e')])){if(!_[_0x2154('0x1a')](_0x13c644)){_0x20d767=_[_0x2154('0x2f')](_0xd205ec[_0x2154('0x2e')],function(_0x5de924){return _0x5de924['email']===_0x13c644;});}if(_0x20d767>=0x0){logger[_0x2154('0x2a')](_0x2154('0x30'));}else{logger[_0x2154('0x2a')](_0x2154('0x31'));_0x20d767=_[_0x2154('0x2f')](_0xd205ec[_0x2154('0x2e')],function(_0x95b342){return _0x95b342['profile'][_0x2154('0x17')]==='Administrator';});}return _0xd205ec['users'][_0x20d767];}else{if(_0xd205ec['user'][_0x2154('0x32')][_0x2154('0x17')]===_0x2154('0x33')){logger[_0x2154('0x2a')]('Using\x20the\x20admin\x20account!');user=_0xd205ec[_0x2154('0x34')];return user;}else{logger[_0x2154('0x29')](_0x2154('0x35'),JSON['stringify'](_0xd205ec));throw new Error(_0x2154('0x36')+JSON['stringify'](_0xd205ec));}}}else{logger[_0x2154('0x29')](_0x2154('0x35'),JSON[_0x2154('0xc')](_0xd205ec));throw new Error(_0x2154('0x36')+JSON['stringify'](_0xd205ec));}})['catch'](function(_0xa2e0bc){console['error'](_0xa2e0bc);});}function getZohoUser(_0x2ae32d,_0x4c8b2c){return new BPromise(function(_0x260fda,_0xa91c11){request(_0x2ae32d)[_0x2154('0x26')](function(_0x2041b3){var _0x4be1ab=null;if(_0x2041b3){_0x4be1ab=_0x2041b3[_0x2154('0x37')][0x0];_0x4be1ab['enduserType']=_0x4c8b2c;}_0x260fda(_0x4be1ab);})[_0x2154('0x38')](function(_0x3a960c){_0xa91c11(_0x3a960c);});});}function createEndUser(_0x259534,_0x460c81,_0x4f6c57,_0x5594d8,_0xedaffc,_0x37d791){var _0x4f6c57=getName(_0x4f6c57);return request({'method':'POST','uri':_0x2154('0x39')+_0x460c81+'/crm/v2/'+_[_0x2154('0x3a')](_0x37d791[_0x2154('0x3b')])+'s','body':{'data':[{'Last_Name':_0x4f6c57[0x1],'First_Name':_0x4f6c57[0x0],'Phone':_0x5594d8,'Owner':{'name':!_[_0x2154('0x1a')](_0xedaffc[_0x2154('0x3c')]['name'])?_0xedaffc[_0x2154('0x3c')]['name']:!_[_0x2154('0x1a')](_0xedaffc[_0x2154('0x3d')])?_0xedaffc['first_name']+'\x20'+_0xedaffc[_0x2154('0x3e')]:_0xedaffc[_0x2154('0x3e')],'id':_0xedaffc['id']}}]},'headers':{'Authorization':_0x2154('0x2d')+_0x259534},'json':!![]})[_0x2154('0x26')](function(_0x22477e){if(_0x22477e&&_0x22477e['data'][0x0][_0x2154('0x3f')]===_0x2154('0x40')){var _0x3469a9=_0x22477e[_0x2154('0x37')][0x0]['details'];_0x3469a9['enduserType']=_[_0x2154('0x3a')](_0x37d791[_0x2154('0x3b')])+'s';return _0x3469a9;}logger[_0x2154('0x29')](_0x2154('0x35'),JSON[_0x2154('0xc')](data));throw new Error(_0x2154('0x41')+JSON[_0x2154('0xc')](data));})[_0x2154('0x38')](function(_0x402684){console[_0x2154('0x42')]('CREATE\x20ERROR',_0x402684);});}function getEndUser(_0x1bda65,_0x137bc3,_0x10bc70,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7){var _0x48d020={'method':_0x2154('0x43'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1bda65},'json':!![]};switch(_0x4ac7a7[_0x2154('0x44')]){case _0x2154('0x45'):_0x48d020[_0x2154('0x46')]=_0x2154('0x39')+_0x137bc3+_0x2154('0x47')+_0x4767b0+'))';return getZohoUser(_0x48d020,_0x2154('0x48'))[_0x2154('0x26')](function(_0x2ee230){if(_0x2ee230)return _0x2ee230;_0x48d020['uri']=_0x2154('0x39')+_0x137bc3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4767b0+'))';return getZohoUser(_0x48d020,_0x2154('0x49'))[_0x2154('0x26')](function(_0x1f3a59){if(_0x1f3a59)return _0x1f3a59;if(_0x4ac7a7[_0x2154('0x3b')]!=_0x2154('0x4a')){return createEndUser(_0x1bda65,_0x137bc3,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7);}else{return{};}});});break;case _0x2154('0x4b'):_0x48d020[_0x2154('0x46')]='https://www.zohoapis.'+_0x137bc3+_0x2154('0x47')+_0x4767b0+'))';return getZohoUser(_0x48d020,'Contacts')[_0x2154('0x26')](function(_0x333d28){if(_0x333d28)return _0x333d28;if(_0x4ac7a7[_0x2154('0x3b')]!=_0x2154('0x4a')){return createEndUser(_0x1bda65,_0x137bc3,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7);}else{return{};}});break;case _0x2154('0x4c'):_0x48d020[_0x2154('0x46')]='https://www.zohoapis.'+_0x137bc3+_0x2154('0x4d')+_0x4767b0+'))';return getZohoUser(_0x48d020,_0x2154('0x49'))[_0x2154('0x26')](function(_0x50e12e){if(_0x50e12e)return _0x50e12e;if(_0x4ac7a7[_0x2154('0x3b')]!=_0x2154('0x4a')){return createEndUser(_0x1bda65,_0x137bc3,_0x5991ed,_0x4767b0,_0x45ac56,_0x4ac7a7);}else{return{};}});break;}}function getCall(_0x73f716,_0x460df3,_0x59e687,_0x413439,_0x47d116,_0x4e117a,_0x4dbfe1,_0x3c4681){logger[_0x2154('0x2a')](_0x2154('0x4e'));var _0x28d2cf={};_0x28d2cf['Owner']={'name':!_['isNil'](_0x413439['role'][_0x2154('0x17')])&&!_['isNil'](_0x413439[_0x2154('0x32')]['name'])&&_0x413439[_0x2154('0x32')]['name']===_0x2154('0x4f')?_0x413439[_0x2154('0x3c')][_0x2154('0x17')]:!_['isNil'](_0x413439[_0x2154('0x3d')])?_0x413439[_0x2154('0x3d')]+'\x20'+_0x413439[_0x2154('0x3e')]:_0x413439[_0x2154('0x3e')],'id':_0x413439['id']};_0x28d2cf[_0x2154('0x50')]=intUtil[_0x2154('0x51')](_0x4e117a['Subjects'],_0x4dbfe1,'\x20');_0x28d2cf[_0x2154('0x52')]=intUtil[_0x2154('0x51')](_0x4e117a[_0x2154('0x53')],_0x4dbfe1,'\x0a');if(_0x47d116[_0x2154('0x54')]==='Contacts'){_0x28d2cf[_0x2154('0x55')]={'name':!_[_0x2154('0x1a')](_0x47d116[_0x2154('0x56')])?_0x47d116['Full_Name']:!_['isNil'](_0x47d116[_0x2154('0x57')])?_0x47d116[_0x2154('0x57')]+'\x20'+_0x47d116[_0x2154('0x58')]:_0x47d116[_0x2154('0x58')],'id':_0x47d116['id']};}if(_0x47d116[_0x2154('0x54')]===_0x2154('0x49')){_0x28d2cf[_0x2154('0x59')]={'name':!_['isNil'](_0x47d116[_0x2154('0x56')])?_0x47d116[_0x2154('0x56')]:!_['isNil'](_0x47d116[_0x2154('0x57')])?_0x47d116['First_Name']+'\x20'+_0x47d116[_0x2154('0x58')]:_0x47d116[_0x2154('0x58')],'id':_0x47d116['id']};_0x28d2cf[_0x2154('0x5a')]=_[_0x2154('0x3a')](_0x47d116[_0x2154('0x54')]);}if(_0x4dbfe1[_0x2154('0x5b')]){_0x28d2cf[_0x2154('0x5c')]=moment[_0x2154('0x5d')](parseInt(_0x4dbfe1['talktime'])*0x3e8)[_0x2154('0x5e')](_0x2154('0x5f'));}else if(_0x4dbfe1[_0x2154('0x60')]&&_0x4dbfe1[_0x2154('0x61')]){_0x28d2cf[_0x2154('0x5c')]=moment['utc'](moment(_0x4dbfe1[_0x2154('0x61')],'YYYY-MM-DDTHH:mm:ss')[_0x2154('0x62')](moment(_0x4dbfe1[_0x2154('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0x2154('0x5e')](_0x2154('0x5f'));}switch(_0x4dbfe1[_0x2154('0x64')]){case'called':_0x28d2cf[_0x2154('0x65')]=_0x2154('0x66');break;case'complete':case _0x2154('0x67'):_0x28d2cf[_0x2154('0x65')]=_0x2154('0x68');break;case _0x2154('0x69'):_0x28d2cf[_0x2154('0x65')]=_0x2154('0x6a');break;case'abandoned':_0x28d2cf['Call_Result']=_0x2154('0x6b');break;case _0x2154('0x6c'):_0x28d2cf[_0x2154('0x65')]=_0x2154('0x6d');default:}_0x28d2cf[_0x2154('0x6e')]=(_0x3c4681===_0x2154('0x6f')?moment(_0x4dbfe1[_0x2154('0x63')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x4dbfe1[_0x2154('0x70')])[_0x2154('0x5e')](_0x2154('0x71')))||moment()['format'](_0x2154('0x71'));_0x28d2cf['Call_Type']=_0x3c4681||_0x2154('0x72');_0x28d2cf=_[_0x2154('0x73')](_0x28d2cf,getCustomFields(_0x4e117a['Fields'],_0x4dbfe1));return request({'method':_0x2154('0x20'),'uri':_0x2154('0x39')+_0x460df3+_0x2154('0x74'),'headers':{'Authorization':_0x2154('0x2d')+_0x73f716},'body':{'data':[_0x28d2cf]},'json':!![]})[_0x2154('0x26')](function(_0x564b54){if(_0x564b54&&_0x564b54[_0x2154('0x37')][0x0]['code']===_0x2154('0x40')){logger[_0x2154('0x2a')]('Call\x20created!');return{'id':_0x564b54['data'][0x0][_0x2154('0x75')]['id']};}})[_0x2154('0x38')](function(_0x2674e4){logger[_0x2154('0x2a')](_0x2154('0x76'),_0x2674e4[_0x2154('0x77')]);console['log'](_0x2154('0x76'),_0x2674e4);});}exports['queue']=function(_0x1a3724,_0x15c5af,_0x3a4ff9,_0x1f23a7,_0x16fb54,_0x4aa75b){var _0x3ff84b,_0x2359f7,_0x5c1743;_0x4aa75b[_0x2154('0x78')]=intUtil[_0x2154('0x79')](_0x4aa75b[_0x2154('0x78')]);_0x4aa75b['serverUrl']=intUtil['stripTrailingSlash'](_0x4aa75b[_0x2154('0x7a')]);if(_0x16fb54&&_0x16fb54['monitor_format']){logger['info'](_0x2154('0x7b'),_0x2154('0x7c'));_0x15c5af[_0x2154('0x7d')]=_0x4aa75b['serverUrl']+'/api/voice/recordings/'+_0x15c5af[_0x2154('0x7e')]+_0x2154('0x7f')+md5(_0x15c5af['uniqueid']);}else{_0x15c5af[_0x2154('0x7d')]='';}var _0x241051=_0x4aa75b[_0x2154('0x78')]===_0x2154('0x80')?'eu':_0x2154('0x81');return getAccessToken(_0x4aa75b)['then'](function(_0x6f0849){_0x5c1743=_0x6f0849;return getUser(_0x5c1743,_0x241051,_0x4aa75b,_0x1f23a7[_0x2154('0x82')]);})[_0x2154('0x26')](function(_0xb02fc1){_0x3ff84b=_0xb02fc1;logger[_0x2154('0x2a')](_0x2154('0x83'),_0x3ff84b['id']);return getEndUser(_0x5c1743,_0x241051,_0x4aa75b,_0x15c5af['calleridname'],_0x15c5af[_0x2154('0x84')],_0x3ff84b,_0x3a4ff9);})[_0x2154('0x26')](function(_0x58f5c4){_0x2359f7=_0x58f5c4;return getCall(_0x5c1743,_0x241051,_0x4aa75b,_0x3ff84b,_0x2359f7,_0x3a4ff9,_0x15c5af,'Inbound');})[_0x2154('0x26')](function(_0x1a48c5){if(_0x1a48c5){logger['info']('The\x20Call\x20ID\x20is:',_0x1a48c5['id']);logger[_0x2154('0x2a')](_0x2154('0x7b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2154('0x5e')]('user:%s',_0x1f23a7[_0x2154('0x17')]),_0x2154('0x85'),{'uri':'https://crm.'+_0x4aa75b['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1a48c5['id']});}})[_0x2154('0x38')](function(_0x124432){logger['error'](_0x2154('0x7b'),JSON[_0x2154('0xc')](_0x124432));});};exports[_0x2154('0x6f')]=function(_0x50dddf,_0x1e094e,_0x8e875a,_0x4adeca,_0x12dfc6,_0x3f08ef,_0x2da132){var _0x4839a6,_0x4534a1,_0x8483fb;_0x3f08ef[_0x2154('0x78')]=intUtil['stripTrailingSlash'](_0x3f08ef[_0x2154('0x78')]);_0x3f08ef['serverUrl']=intUtil[_0x2154('0x79')](_0x3f08ef[_0x2154('0x7a')]);if(_0x2da132&&_0x2da132['recordingFormat']&&_0x2da132[_0x2154('0x86')]!==_0x2154('0x87')){logger['info'](_0x2154('0x88'),_0x2154('0x7c'));_0x1e094e[_0x2154('0x7d')]=_0x3f08ef[_0x2154('0x7a')]+_0x2154('0x89')+_0x1e094e[_0x2154('0x7e')]+_0x2154('0x7f')+md5(_0x1e094e[_0x2154('0x7e')]);}var _0x6c7750=_0x3f08ef[_0x2154('0x78')]==='zoho.eu'?'eu':_0x2154('0x81');return getAccessToken(_0x3f08ef)[_0x2154('0x26')](function(_0x4d8ce5){_0x8483fb=_0x4d8ce5;return getUser(_0x8483fb,_0x6c7750,_0x3f08ef,_0x4adeca['email']);})[_0x2154('0x26')](function(_0x5d0bdd){_0x4839a6=_0x5d0bdd;logger[_0x2154('0x2a')](_0x2154('0x83'),_0x4839a6['id']);return getEndUser(_0x8483fb,_0x6c7750,_0x3f08ef,_0x1e094e[_0x2154('0x8a')],_0x1e094e[_0x2154('0x8b')],_0x4839a6,_0x8e875a);})[_0x2154('0x26')](function(_0x213e07){_0x4534a1=_0x213e07;return getCall(_0x8483fb,_0x6c7750,_0x3f08ef,_0x4839a6,_0x4534a1,_0x8e875a,_0x1e094e,'Outbound');})[_0x2154('0x26')](function(_0x4f29a2){if(_0x4f29a2){logger['info']('The\x20Call\x20ID\x20is:',_0x4f29a2['id']);logger[_0x2154('0x2a')](_0x2154('0x88'),_0x2154('0x8c'));emit(util[_0x2154('0x5e')](_0x2154('0x8d'),_0x4adeca[_0x2154('0x17')]),_0x2154('0x85'),{'uri':_0x2154('0x8e')+_0x3f08ef[_0x2154('0x78')]+_0x2154('0x8f')+_0x4f29a2['id']});}})[_0x2154('0x38')](function(_0x29ef37){logger[_0x2154('0x29')](_0x2154('0x88'),JSON[_0x2154('0xc')](_0x29ef37));});};exports[_0x2154('0x90')]=function(_0x449638,_0x62d7aa,_0xf97ca,_0x2a8b58,_0x838b8f,_0x1842d2){var _0x56c1b6,_0x13fe65,_0x3e32f5;_0x1842d2[_0x2154('0x78')]=intUtil['stripTrailingSlash'](_0x1842d2[_0x2154('0x78')]);_0x1842d2['serverUrl']=intUtil[_0x2154('0x79')](_0x1842d2[_0x2154('0x7a')]);if(_0x838b8f&&_0x838b8f['monitor_format']){logger[_0x2154('0x2a')]('['+_0x62d7aa[_0x2154('0x64')][_0x2154('0x91')]()+']',_0x2154('0x7c'));_0x62d7aa[_0x2154('0x7d')]=_0x1842d2[_0x2154('0x7a')]+'/api/voice/recordings/'+_0x62d7aa[_0x2154('0x7e')]+_0x2154('0x7f')+md5(_0x62d7aa['uniqueid']);}else{_0x62d7aa['recordingURL']='';}var _0x53ae55=_0x1842d2[_0x2154('0x78')]===_0x2154('0x80')?'eu':_0x2154('0x81');return getAccessToken(_0x1842d2)[_0x2154('0x26')](function(_0x28da12){_0x3e32f5=_0x28da12;return getUser(_0x3e32f5,_0x53ae55,_0x1842d2);})[_0x2154('0x26')](function(_0x131207){_0x56c1b6=_0x131207;logger[_0x2154('0x2a')](_0x2154('0x83'),_0x56c1b6['id']);return getEndUser(_0x3e32f5,_0x53ae55,_0x1842d2,_0x62d7aa[_0x2154('0x92')],_0x62d7aa['calleridnum'],_0x56c1b6,_0xf97ca);})[_0x2154('0x26')](function(_0x17c3bb){_0x13fe65=_0x17c3bb;return getCall(_0x3e32f5,_0x53ae55,_0x1842d2,_0x56c1b6,_0x13fe65,_0xf97ca,_0x62d7aa,_0x2154('0x72'));})[_0x2154('0x26')](function(_0x16fc04){if(_0x16fc04){logger[_0x2154('0x2a')](_0x2154('0x93'),_0x16fc04['id']);}})[_0x2154('0x38')](function(_0x2925ad){logger[_0x2154('0x29')]('['+_0x62d7aa['lastevent'][_0x2154('0x91')]()+']',JSON[_0x2154('0xc')](_0x2925ad));});}; \ 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 55cd60a..dde8658 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 _0xe588=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','exec','error'];(function(_0x5bd1bd,_0x43b655){var _0x438345=function(_0x439bec){while(--_0x439bec){_0x5bd1bd['push'](_0x5bd1bd['shift']());}};_0x438345(++_0x43b655);}(_0xe588,0x1d9));var _0x8e58=function(_0x120636,_0x477fb3){_0x120636=_0x120636-0x0;var _0x482238=_0xe588[_0x120636];return _0x482238;};'use strict';var util=require('util');var sh=require(_0x8e58('0x0'));var Mustache=require(_0x8e58('0x1'));var logger=require(_0x8e58('0x2'))(_0x8e58('0x3'));exports['exec']=function(_0x19013c,_0x53152f){var _0x204c6a=_0x19013c[_0x8e58('0x4')]?_0x19013c['data2']:'Script';var _0x5acf8d=_0x19013c['data3']?Mustache['render'](_0x19013c['data3'],_0x53152f):_0x53152f;sh[_0x8e58('0x5')](_0x5acf8d,function(_0x250666,_0x5a5431,_0x58351c){if(_0x250666!==0x0){logger[_0x8e58('0x6')](util[_0x8e58('0x7')](_0x8e58('0x8'),_0x204c6a,_0x5acf8d,_0x250666,_0x58351c));}else{logger['info'](util['format'](_0x8e58('0x9'),_0x204c6a,_0x5acf8d,_0x5a5431));}});}; \ No newline at end of file +var _0x8ef3=['data2','Script','render','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8ef3,0x7c));var _0x38ef=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8ef3[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0x38ef('0x0'));var sh=require(_0x38ef('0x1'));var Mustache=require(_0x38ef('0x2'));var logger=require(_0x38ef('0x3'))(_0x38ef('0x4'));exports[_0x38ef('0x5')]=function(_0x517efd,_0x46d77b){var _0x1aa33e=_0x517efd[_0x38ef('0x6')]?_0x517efd[_0x38ef('0x6')]:_0x38ef('0x7');var _0x2a7cc1=_0x517efd['data3']?Mustache[_0x38ef('0x8')](_0x517efd[_0x38ef('0x9')],_0x46d77b):_0x46d77b;sh['exec'](_0x2a7cc1,function(_0x810e7b,_0x2a4532,_0x3ac9aa){if(_0x810e7b!==0x0){logger['error'](util[_0x38ef('0xa')](_0x38ef('0xb'),_0x1aa33e,_0x2a7cc1,_0x810e7b,_0x3ac9aa));}else{logger['info'](util[_0x38ef('0xa')](_0x38ef('0xc'),_0x1aa33e,_0x2a7cc1,_0x2a4532));}});}; \ 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 c63d70c..6fdc1fd 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 _0xdc1d=['statusCode','name','message','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data5','headers','parse','render','error','GET','PUT','data7','body','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc1d,0xb1));var _0xddc1=function(_0x2bffa5,_0xa2f513){_0x2bffa5=_0x2bffa5-0x0;var _0x53de2c=_0xdc1d[_0x2bffa5];return _0x53de2c;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var Mustache=require(_0xddc1('0x0'));var logger=require(_0xddc1('0x1'))(_0xddc1('0x2'));exports[_0xddc1('0x3')]=function(_0x21ceb2,_0x18c31e){var _0x2abd30,_0x1e0210;var _0x2279d9={'method':_0x21ceb2[_0xddc1('0x4')][_0xddc1('0x5')](),'uri':Mustache['render'](_0x21ceb2['data2'],_0x18c31e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x21ceb2['data5'])==='number'&&parseInt(_0x21ceb2['data5'])>=0x1&&parseInt(_0x21ceb2['data5'])<=0xa?parseInt(_0x21ceb2[_0xddc1('0x6')])*0x3e8:0x5*0x3e8};try{_0x2279d9[_0xddc1('0x7')]=_0x21ceb2['data6']?JSON[_0xddc1('0x8')](Mustache[_0xddc1('0x9')](_0x21ceb2['data6'],_0x18c31e)):{};}catch(_0x193495){logger[_0xddc1('0xa')](_0x193495['stack']);}switch(_0x21ceb2[_0xddc1('0x4')]['toUpperCase']()){case _0xddc1('0xb'):case'DELETE':_0x2abd30=null;_0x2279d9['qs']=_0x18c31e;break;case'POST':case _0xddc1('0xc'):if(_0x21ceb2[_0xddc1('0xd')]){try{_0x2abd30=JSON['parse'](Mustache['render'](_0x21ceb2['data7'],_0x18c31e));_0x2279d9[_0xddc1('0xe')]=_0x2abd30;}catch(_0x443864){logger['error'](_0x443864[_0xddc1('0xf')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2abd30=_0x18c31e;_0x2279d9[_0xddc1('0xe')]=_0x2abd30;}break;}logger[_0xddc1('0x10')](util[_0xddc1('0x11')](_0xddc1('0x12'),_0x21ceb2[_0xddc1('0x4')],_0x21ceb2[_0xddc1('0x13')],JSON[_0xddc1('0x14')](_0x2279d9)));rp(_0x2279d9)[_0xddc1('0x15')](function(_0x46b7f6){_0x2abd30=!_[_0xddc1('0x16')](_0x2abd30)?',\x20request\x20body:\x20'+_0x2abd30:'';_0x1e0210=typeof _0x46b7f6[_0xddc1('0xe')]===_0xddc1('0x17')?JSON[_0xddc1('0x14')](_0x46b7f6[_0xddc1('0xe')]):_0x46b7f6[_0xddc1('0xe')];logger[_0xddc1('0x10')](util['format'](_0xddc1('0x18'),_0x21ceb2[_0xddc1('0x4')],_0x21ceb2['data2'],_0x46b7f6['statusCode'],_0x1e0210));})[_0xddc1('0x19')](function(_0xb1af11){logger['error'](util[_0xddc1('0x11')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x21ceb2[_0xddc1('0x4')],_0x21ceb2[_0xddc1('0x13')],_0xb1af11[_0xddc1('0x1a')],_0xb1af11[_0xddc1('0x1b')],_0xb1af11[_0xddc1('0x1c')]));});}; \ No newline at end of file +var _0x134f=['render','data2','data5','number','headers','parse','stack','GET','POST','PUT','data7','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',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase'];(function(_0x182265,_0x5a6140){var _0x18b8df=function(_0x6771de){while(--_0x6771de){_0x182265['push'](_0x182265['shift']());}};_0x18b8df(++_0x5a6140);}(_0x134f,0xa6));var _0xf134=function(_0x5c2daa,_0x307bd8){_0x5c2daa=_0x5c2daa-0x0;var _0x31839a=_0x134f[_0x5c2daa];return _0x31839a;};'use strict';var rp=require(_0xf134('0x0'));var util=require(_0xf134('0x1'));var _=require(_0xf134('0x2'));var Mustache=require(_0xf134('0x3'));var logger=require(_0xf134('0x4'))(_0xf134('0x5'));exports[_0xf134('0x6')]=function(_0x276b1f,_0x188dff){var _0x43eb00,_0x71494a;var _0xc161ea={'method':_0x276b1f[_0xf134('0x7')][_0xf134('0x8')](),'uri':Mustache[_0xf134('0x9')](_0x276b1f[_0xf134('0xa')],_0x188dff),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x276b1f[_0xf134('0xb')])===_0xf134('0xc')&&parseInt(_0x276b1f[_0xf134('0xb')])>=0x1&&parseInt(_0x276b1f[_0xf134('0xb')])<=0xa?parseInt(_0x276b1f[_0xf134('0xb')])*0x3e8:0x5*0x3e8};try{_0xc161ea[_0xf134('0xd')]=_0x276b1f['data6']?JSON[_0xf134('0xe')](Mustache[_0xf134('0x9')](_0x276b1f['data6'],_0x188dff)):{};}catch(_0x2b8ce0){logger['error'](_0x2b8ce0[_0xf134('0xf')]);}switch(_0x276b1f['data1'][_0xf134('0x8')]()){case _0xf134('0x10'):case'DELETE':_0x43eb00=null;_0xc161ea['qs']=_0x188dff;break;case _0xf134('0x11'):case _0xf134('0x12'):if(_0x276b1f['data7']){try{_0x43eb00=JSON[_0xf134('0xe')](Mustache[_0xf134('0x9')](_0x276b1f[_0xf134('0x13')],_0x188dff));_0xc161ea[_0xf134('0x14')]=_0x43eb00;}catch(_0x547828){logger[_0xf134('0x15')](_0x547828[_0xf134('0xf')]);logger[_0xf134('0x15')](_0xf134('0x16'));}}else{_0x43eb00=_0x188dff;_0xc161ea[_0xf134('0x14')]=_0x43eb00;}break;}logger[_0xf134('0x17')](util['format'](_0xf134('0x18'),_0x276b1f['data1'],_0x276b1f[_0xf134('0xa')],JSON[_0xf134('0x19')](_0xc161ea)));rp(_0xc161ea)[_0xf134('0x1a')](function(_0x5eea79){_0x43eb00=!_['isNil'](_0x43eb00)?_0xf134('0x1b')+_0x43eb00:'';_0x71494a=typeof _0x5eea79[_0xf134('0x14')]===_0xf134('0x1c')?JSON[_0xf134('0x19')](_0x5eea79[_0xf134('0x14')]):_0x5eea79[_0xf134('0x14')];logger[_0xf134('0x17')](util[_0xf134('0x1d')](_0xf134('0x1e'),_0x276b1f['data1'],_0x276b1f[_0xf134('0xa')],_0x5eea79[_0xf134('0x1f')],_0x71494a));})['catch'](function(_0x3aaba3){logger[_0xf134('0x15')](util[_0xf134('0x1d')](_0xf134('0x20'),_0x276b1f[_0xf134('0x7')],_0x276b1f[_0xf134('0xa')],_0x3aaba3[_0xf134('0x1f')],_0x3aaba3[_0xf134('0x21')],_0x3aaba3[_0xf134('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 354cdfd..6518dcb 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 _0xb07e=['rpc','error','message','result','catch','exports','jayson/promise','routing','client','Request','request','then','debug'];(function(_0x10a212,_0x579d85){var _0x23c82b=function(_0x412ea9){while(--_0x412ea9){_0x10a212['push'](_0x10a212['shift']());}};_0x23c82b(++_0x579d85);}(_0xb07e,0x1f4));var _0xeb07=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb07e[_0x1035c1];return _0x308d67;};'use strict';var jayson=require(_0xeb07('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xeb07('0x1'));var client=jayson[_0xeb07('0x2')]['http']({'port':0x2329});client[_0xeb07('0x3')]=function(_0x116681,_0x1f4911){return new BPromise(function(_0x78f34d,_0x10e31d){return client[_0xeb07('0x4')](_0x116681,_0x1f4911)[_0xeb07('0x5')](function(_0x44fb6e){logger[_0xeb07('0x6')](_0xeb07('0x7'),'routing',_0x116681,_0x1f4911,_0x44fb6e);if(_0x44fb6e[_0xeb07('0x8')]){logger[_0xeb07('0x8')](_0xeb07('0x7'),_0xeb07('0x1'),_0x116681,_0x44fb6e[_0xeb07('0x8')]['message'],_0x1f4911);return _0x10e31d(_0x44fb6e[_0xeb07('0x8')][_0xeb07('0x9')]);}else{return _0x78f34d(_0x44fb6e[_0xeb07('0xa')]);}})[_0xeb07('0xb')](function(_0x490d57){logger[_0xeb07('0x8')]('rpc',_0xeb07('0x1'),_0x116681,_0x490d57,_0x1f4911);return _0x10e31d(_0x490d57);});});};module[_0xeb07('0xc')]=client; \ No newline at end of file +var _0x3a7d=['message','result','exports','../../config/logger','routing','http','request','rpc','error'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x3a7d,0x108));var _0xd3a7=function(_0x162f44,_0x2b0eb3){_0x162f44=_0x162f44-0x0;var _0x510bae=_0x3a7d[_0x162f44];return _0x510bae;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xd3a7('0x0'))(_0xd3a7('0x1'));var client=jayson['client'][_0xd3a7('0x2')]({'port':0x2329});client['Request']=function(_0x361c64,_0x16d836){return new BPromise(function(_0xc0b65,_0x1c4f5f){return client[_0xd3a7('0x3')](_0x361c64,_0x16d836)['then'](function(_0x4b08bf){logger['debug'](_0xd3a7('0x4'),_0xd3a7('0x1'),_0x361c64,_0x16d836,_0x4b08bf);if(_0x4b08bf[_0xd3a7('0x5')]){logger[_0xd3a7('0x5')]('rpc','routing',_0x361c64,_0x4b08bf[_0xd3a7('0x5')][_0xd3a7('0x6')],_0x16d836);return _0x1c4f5f(_0x4b08bf['error'][_0xd3a7('0x6')]);}else{return _0xc0b65(_0x4b08bf[_0xd3a7('0x7')]);}})['catch'](function(_0x2e8f60){logger[_0xd3a7('0x5')](_0xd3a7('0x4'),_0xd3a7('0x1'),_0x361c64,_0x2e8f60,_0x16d836);return _0x1c4f5f(_0x2e8f60);});});};module[_0xd3a7('0x8')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2db0ea3..c7c1c0b 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 _0x08af=['Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','refresh','listen','getSettings','catch','error'];(function(_0x3e8c59,_0x38f2e7){var _0x61d3ff=function(_0x32170b){while(--_0x32170b){_0x3e8c59['push'](_0x3e8c59['shift']());}};_0x61d3ff(++_0x38f2e7);}(_0x08af,0x1d2));var _0xf08a=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x08af[_0x540133];return _0x26b6e9;};'use strict';var server=require(_0xf08a('0x0'));var Realtime=require(_0xf08a('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xf08a('0x2'));var setting=require(_0xf08a('0x3'));var logger=require(_0xf08a('0x4'))(_0xf08a('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf08a('0x6')]()[_0xf08a('0x7')](mailAccount['getMailAccounts']())[_0xf08a('0x7')](realtime[_0xf08a('0x8')]())[_0xf08a('0x7')](function(){email[_0xf08a('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xf08a('0xa')](realtime,email)[_0xf08a('0x7')](function(){return initRealtime();})[_0xf08a('0x7')](function(){return setting[_0xf08a('0xb')]();})[_0xf08a('0x7')](function(_0x3866f4){return setInterval(initRealtime,_0x3866f4['loginMailFrequency']*0x3e8);})[_0xf08a('0xc')](function(_0x2a744c){logger[_0xf08a('0xd')](_0xf08a('0xe'),_0x2a744c);});}main(); \ No newline at end of file +var _0x1f53=['Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error'];(function(_0x3640e2,_0x562103){var _0x277415=function(_0x1b2c89){while(--_0x1b2c89){_0x3640e2['push'](_0x3640e2['shift']());}};_0x277415(++_0x562103);}(_0x1f53,0x1bb));var _0x31f5=function(_0xd9a0ad,_0x202e71){_0xd9a0ad=_0xd9a0ad-0x0;var _0x84eea6=_0x1f53[_0xd9a0ad];return _0x84eea6;};'use strict';var server=require('./server');var Realtime=require(_0x31f5('0x0'));var EmailChannel=require(_0x31f5('0x1'));var mailAccount=require(_0x31f5('0x2'));var setting=require(_0x31f5('0x3'));var logger=require(_0x31f5('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x31f5('0x5')]()[_0x31f5('0x6')](mailAccount[_0x31f5('0x7')]())[_0x31f5('0x6')](realtime[_0x31f5('0x8')]())[_0x31f5('0x6')](function(){email[_0x31f5('0x9')](realtime[_0x31f5('0xa')]);return realtime;});}function main(){return server[_0x31f5('0xb')](realtime,email)[_0x31f5('0x6')](function(){return initRealtime();})[_0x31f5('0x6')](function(){return setting[_0x31f5('0xc')]();})[_0x31f5('0x6')](function(_0x465145){return setInterval(initRealtime,_0x465145[_0x31f5('0xd')]*0x3e8);})[_0x31f5('0xe')](function(_0x385ccb){logger[_0x31f5('0xf')](_0x31f5('0x10'),_0x385ccb);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index bfda85f..ec34db1 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 _0x9d52=['handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','verifySmtp','Smtp','verify','moment','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','emit','name','key','Imap','messageStatus','total','isNil','md5','mailAccount:update','prototype','hasOwnProperty','active','service','provider','custom','email','box','handleImapBox','bind'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x9d52,0x1c6));var _0x29d5=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x9d52[_0x99868f];return _0x27a71b;};'use strict';var _=require('lodash');var moment=require(_0x29d5('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x29d5('0x1'));var logger=require(_0x29d5('0x2'))('email');config[_0x29d5('0x3')]=_[_0x29d5('0x4')](config[_0x29d5('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x29d5('0x5'))(new Redis(config[_0x29d5('0x3')]));var EmailImap=require(_0x29d5('0x6'));var EmailSmtp=require(_0x29d5('0x7'));var mailAccount=require(_0x29d5('0x8'));var md5Accounts={};function EmailChannel(_0xa5059d){logger[_0x29d5('0x9')]('start\x20email\x20channel');this[_0x29d5('0xa')]=_0xa5059d[_0x29d5('0xa')];this[_0x29d5('0xb')]={};this[_0x29d5('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0x29d5('0xd')]=function(_0x2f7b5f){var _0x2ba6f4=this[_0x29d5('0xa')][_0x2f7b5f];var _0x52629b={'id':_0x2ba6f4['id'],'name':_0x2ba6f4[_0x29d5('0xe')],'key':_0x2ba6f4[_0x29d5('0xf')],'active':_0x2ba6f4['active'],'Imap':{'status':_0x2ba6f4[_0x29d5('0x10')]['status'],'messageStatus':_0x2ba6f4['Imap'][_0x29d5('0x11')],'total':_0x2ba6f4[_0x29d5('0x10')][_0x29d5('0x12')]}};if(_[_0x29d5('0x13')](md5Accounts[_0x2f7b5f])){md5Accounts[_0x2f7b5f]={};}var _0x42aa87=md5(JSON['stringify'](_0x52629b));if(md5Accounts[_0x2f7b5f][_0x29d5('0x14')]!==_0x42aa87){md5Accounts[_0x2f7b5f][_0x29d5('0x14')]=_0x42aa87;io[_0x29d5('0xd')](_0x29d5('0x15'),_0x52629b);}};EmailChannel[_0x29d5('0x16')]['refresh']=function(_0x36bcf2){for(var _0x1e8e0f in _0x36bcf2){if(_0x36bcf2[_0x29d5('0x17')](_0x1e8e0f)){if(_0x36bcf2[_0x1e8e0f]['Imap']&&_0x36bcf2[_0x1e8e0f][_0x29d5('0x18')]){var _0x440000=_0x36bcf2[_0x1e8e0f]['Imap'];if(!_0x440000[_0x29d5('0x19')]&&_0x36bcf2[_0x1e8e0f][_0x29d5('0x1a')]!==_0x29d5('0x1b'))_0x440000[_0x29d5('0x19')]=_0x36bcf2[_0x1e8e0f]['provider'];if(!this[_0x29d5('0xb')][_0x29d5('0x17')](_0x440000['id'])){this[_0x29d5('0xb')][_0x440000['id']]=new EmailImap(_0x440000,_0x36bcf2[_0x1e8e0f][_0x29d5('0x1c')]);this[_0x29d5('0xb')][_0x440000['id']]['on'](_0x29d5('0x1d'),this[_0x29d5('0x1e')][_0x29d5('0x1f')](this,_0x1e8e0f));this[_0x29d5('0xb')][_0x440000['id']]['on'](_0x29d5('0x1c'),this[_0x29d5('0x20')]['bind'](this,_0x1e8e0f));this[_0x29d5('0xb')][_0x440000['id']]['on'](_0x29d5('0x21'),this[_0x29d5('0x22')][_0x29d5('0x1f')](this,_0x1e8e0f));this[_0x29d5('0xb')][_0x440000['id']]['on'](_0x29d5('0x23'),this[_0x29d5('0x24')][_0x29d5('0x1f')](this,_0x1e8e0f));}}else{if(_[_0x29d5('0x13')](this['mailAccounts'][_0x1e8e0f]['Imap'])){this[_0x29d5('0xa')][_0x1e8e0f][_0x29d5('0x10')]={};}this['mailAccounts'][_0x1e8e0f][_0x29d5('0x10')][_0x29d5('0x25')]=_0x29d5('0x26');this[_0x29d5('0xa')][_0x1e8e0f][_0x29d5('0x10')][_0x29d5('0x11')]='';this[_0x29d5('0xd')](_0x1e8e0f);}}}};EmailChannel['prototype'][_0x29d5('0x1e')]=function(_0x452bf2,_0x1c30d8){if(this[_0x29d5('0xa')][_0x452bf2]){this['mailAccounts'][_0x452bf2][_0x29d5('0x10')][_0x29d5('0x25')]=_0x29d5('0x27');this[_0x29d5('0xa')][_0x452bf2]['Imap'][_0x29d5('0x11')]=_0x1c30d8['name'];if(_0x1c30d8[_0x29d5('0x28')]){this[_0x29d5('0xa')][_0x452bf2]['Imap'][_0x29d5('0x12')]=_0x1c30d8[_0x29d5('0x28')][_0x29d5('0x12')];}return this[_0x29d5('0xd')](_0x452bf2);}};EmailChannel[_0x29d5('0x16')][_0x29d5('0x20')]=function(_0x1acf9a,_0x4a80ca){logger[_0x29d5('0x9')](_0x29d5('0x29'),_0x4a80ca['firstName'],_0x4a80ca[_0x29d5('0x2a')],_0x4a80ca['from'],_0x1acf9a);if(this[_0x29d5('0xa')][_0x1acf9a]){return mailAccount[_0x29d5('0x2b')](_0x1acf9a,_0x4a80ca)[_0x29d5('0x2c')](function(_0x27e688){if(_0x27e688){logger[_0x29d5('0x9')]('Mail\x20accepted\x20from\x20routing');}})[_0x29d5('0x2d')](function(_0x1d98a2){logger[_0x29d5('0x23')](_0x29d5('0x2e'),JSON[_0x29d5('0x2f')](_0x1d98a2));});}};EmailChannel[_0x29d5('0x16')]['handleImapEnd']=function(_0x1ec02a){if(this[_0x29d5('0xa')][_0x1ec02a]&&this[_0x29d5('0xa')][_0x1ec02a][_0x29d5('0x10')]){if(this[_0x29d5('0xb')][this['mailAccounts'][_0x1ec02a]['Imap']['id']]){delete this['imapAccounts'][this[_0x29d5('0xa')][_0x1ec02a]['Imap']['id']];}this[_0x29d5('0xa')][_0x1ec02a][_0x29d5('0x10')][_0x29d5('0x30')]=moment();this['emit'](_0x1ec02a);}};EmailChannel[_0x29d5('0x16')][_0x29d5('0x24')]=function(_0x27b902,_0x547130){if(this[_0x29d5('0xa')][_0x27b902]){this[_0x29d5('0xa')][_0x27b902]['Imap']['status']=_0x29d5('0x23');this['mailAccounts'][_0x27b902][_0x29d5('0x10')][_0x29d5('0x11')]=_0x547130;return this[_0x29d5('0xd')](_0x27b902);}};EmailChannel[_0x29d5('0x16')][_0x29d5('0x31')]=function(_0x4accbc,_0x28721d){return this[_0x29d5('0xc')][_0x29d5('0x32')](_0x4accbc,_0x28721d);};EmailChannel[_0x29d5('0x16')][_0x29d5('0x33')]=function(_0x3a9af9){var _0x59c1dc=this;if(this[_0x29d5('0xa')][_0x3a9af9['id']]){if(_[_0x29d5('0x13')](this[_0x29d5('0xa')][_0x3a9af9['id']][_0x29d5('0x34')])){this[_0x29d5('0xa')][_0x3a9af9['id']]['Smtp']={};}this[_0x29d5('0xa')][_0x3a9af9['id']][_0x29d5('0x34')][_0x29d5('0x30')]=moment();return new BPromise(function(_0x4d2663,_0x324ad7){return _0x59c1dc[_0x29d5('0xc')][_0x29d5('0x35')](_0x3a9af9)[_0x29d5('0x2c')](function(_0x3d926d){_0x59c1dc[_0x29d5('0xa')][_0x3a9af9['id']]['Smtp'][_0x29d5('0x25')]='verified';_0x59c1dc[_0x29d5('0xa')][_0x3a9af9['id']][_0x29d5('0x34')][_0x29d5('0x11')]='';_0x59c1dc[_0x29d5('0xd')](_0x3a9af9['id']);_0x4d2663(_0x3d926d);})[_0x29d5('0x2d')](function(_0x238c4d){_0x59c1dc['mailAccounts'][_0x3a9af9['id']][_0x29d5('0x34')][_0x29d5('0x25')]=_0x29d5('0x23');_0x59c1dc[_0x29d5('0xa')][_0x3a9af9['id']][_0x29d5('0x34')][_0x29d5('0x11')]=_0x238c4d;_0x59c1dc['emit'](_0x3a9af9['id']);_0x324ad7(_0x238c4d);});});}return this[_0x29d5('0xc')][_0x29d5('0x35')](_0x3a9af9);};module['exports']=EmailChannel; \ No newline at end of file +var _0xc7d1=['email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','name','key','active','Imap','status','messageStatus','total','isNil','stringify','emit','mailAccount:update','prototype','hasOwnProperty','service','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xc7d1,0x1da));var _0x1c7d=function(_0x4905a9,_0x206549){_0x4905a9=_0x4905a9-0x0;var _0x5bfcf5=_0xc7d1[_0x4905a9];return _0x5bfcf5;};'use strict';var _=require('lodash');var moment=require(_0x1c7d('0x0'));var BPromise=require(_0x1c7d('0x1'));var md5=require(_0x1c7d('0x2'));var Redis=require(_0x1c7d('0x3'));var config=require(_0x1c7d('0x4'));var logger=require(_0x1c7d('0x5'))(_0x1c7d('0x6'));config[_0x1c7d('0x7')]=_[_0x1c7d('0x8')](config[_0x1c7d('0x7')],{'host':_0x1c7d('0x9'),'port':0x18eb});var io=require(_0x1c7d('0xa'))(new Redis(config[_0x1c7d('0x7')]));var EmailImap=require(_0x1c7d('0xb'));var EmailSmtp=require(_0x1c7d('0xc'));var mailAccount=require(_0x1c7d('0xd'));var md5Accounts={};function EmailChannel(_0x394893){logger[_0x1c7d('0xe')]('start\x20email\x20channel');this[_0x1c7d('0xf')]=_0x394893[_0x1c7d('0xf')];this[_0x1c7d('0x10')]={};this[_0x1c7d('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0xb7c6d8){var _0x3059e3=this[_0x1c7d('0xf')][_0xb7c6d8];var _0x18fe68={'id':_0x3059e3['id'],'name':_0x3059e3[_0x1c7d('0x12')],'key':_0x3059e3[_0x1c7d('0x13')],'active':_0x3059e3[_0x1c7d('0x14')],'Imap':{'status':_0x3059e3[_0x1c7d('0x15')][_0x1c7d('0x16')],'messageStatus':_0x3059e3['Imap'][_0x1c7d('0x17')],'total':_0x3059e3[_0x1c7d('0x15')][_0x1c7d('0x18')]}};if(_[_0x1c7d('0x19')](md5Accounts[_0xb7c6d8])){md5Accounts[_0xb7c6d8]={};}var _0xa54205=md5(JSON[_0x1c7d('0x1a')](_0x18fe68));if(md5Accounts[_0xb7c6d8][_0x1c7d('0x2')]!==_0xa54205){md5Accounts[_0xb7c6d8][_0x1c7d('0x2')]=_0xa54205;io[_0x1c7d('0x1b')](_0x1c7d('0x1c'),_0x18fe68);}};EmailChannel[_0x1c7d('0x1d')]['refresh']=function(_0x13850e){for(var _0x4acc68 in _0x13850e){if(_0x13850e[_0x1c7d('0x1e')](_0x4acc68)){if(_0x13850e[_0x4acc68][_0x1c7d('0x15')]&&_0x13850e[_0x4acc68][_0x1c7d('0x14')]){var _0x432705=_0x13850e[_0x4acc68][_0x1c7d('0x15')];if(!_0x432705[_0x1c7d('0x1f')]&&_0x13850e[_0x4acc68][_0x1c7d('0x20')]!=='custom')_0x432705[_0x1c7d('0x1f')]=_0x13850e[_0x4acc68]['provider'];if(!this[_0x1c7d('0x10')][_0x1c7d('0x1e')](_0x432705['id'])){this['imapAccounts'][_0x432705['id']]=new EmailImap(_0x432705,_0x13850e[_0x4acc68]['email']);this[_0x1c7d('0x10')][_0x432705['id']]['on'](_0x1c7d('0x21'),this[_0x1c7d('0x22')][_0x1c7d('0x23')](this,_0x4acc68));this['imapAccounts'][_0x432705['id']]['on'](_0x1c7d('0x6'),this[_0x1c7d('0x24')][_0x1c7d('0x23')](this,_0x4acc68));this[_0x1c7d('0x10')][_0x432705['id']]['on'](_0x1c7d('0x25'),this[_0x1c7d('0x26')]['bind'](this,_0x4acc68));this[_0x1c7d('0x10')][_0x432705['id']]['on']('error',this[_0x1c7d('0x27')]['bind'](this,_0x4acc68));}}else{if(_['isNil'](this[_0x1c7d('0xf')][_0x4acc68]['Imap'])){this[_0x1c7d('0xf')][_0x4acc68]['Imap']={};}this[_0x1c7d('0xf')][_0x4acc68][_0x1c7d('0x15')][_0x1c7d('0x16')]='disabled';this[_0x1c7d('0xf')][_0x4acc68]['Imap'][_0x1c7d('0x17')]='';this[_0x1c7d('0x1b')](_0x4acc68);}}}};EmailChannel['prototype'][_0x1c7d('0x22')]=function(_0x4a09e9,_0x236f52){if(this[_0x1c7d('0xf')][_0x4a09e9]){this[_0x1c7d('0xf')][_0x4a09e9][_0x1c7d('0x15')]['status']=_0x1c7d('0x28');this[_0x1c7d('0xf')][_0x4a09e9][_0x1c7d('0x15')]['messageStatus']=_0x236f52[_0x1c7d('0x12')];if(_0x236f52[_0x1c7d('0x29')]){this[_0x1c7d('0xf')][_0x4a09e9][_0x1c7d('0x15')][_0x1c7d('0x18')]=_0x236f52['messages'][_0x1c7d('0x18')];}return this[_0x1c7d('0x1b')](_0x4a09e9);}};EmailChannel['prototype'][_0x1c7d('0x24')]=function(_0x21cf52,_0x18f22c){logger['info'](_0x1c7d('0x2a'),_0x18f22c[_0x1c7d('0x2b')],_0x18f22c[_0x1c7d('0x2c')],_0x18f22c[_0x1c7d('0x2d')],_0x21cf52);if(this[_0x1c7d('0xf')][_0x21cf52]){return mailAccount[_0x1c7d('0x2e')](_0x21cf52,_0x18f22c)[_0x1c7d('0x2f')](function(_0x31ef7b){if(_0x31ef7b){logger[_0x1c7d('0xe')](_0x1c7d('0x30'));}})[_0x1c7d('0x31')](function(_0x2e4cbe){logger[_0x1c7d('0x32')](_0x1c7d('0x33'),JSON[_0x1c7d('0x1a')](_0x2e4cbe));});}};EmailChannel[_0x1c7d('0x1d')][_0x1c7d('0x26')]=function(_0x144c98){if(this[_0x1c7d('0xf')][_0x144c98]&&this['mailAccounts'][_0x144c98]['Imap']){if(this[_0x1c7d('0x10')][this['mailAccounts'][_0x144c98][_0x1c7d('0x15')]['id']]){delete this['imapAccounts'][this[_0x1c7d('0xf')][_0x144c98][_0x1c7d('0x15')]['id']];}this[_0x1c7d('0xf')][_0x144c98]['Imap']['lastSync']=moment();this[_0x1c7d('0x1b')](_0x144c98);}};EmailChannel[_0x1c7d('0x1d')][_0x1c7d('0x27')]=function(_0x263273,_0x45ca49){if(this[_0x1c7d('0xf')][_0x263273]){this['mailAccounts'][_0x263273][_0x1c7d('0x15')][_0x1c7d('0x16')]=_0x1c7d('0x32');this['mailAccounts'][_0x263273][_0x1c7d('0x15')]['messageStatus']=_0x45ca49;return this[_0x1c7d('0x1b')](_0x263273);}};EmailChannel[_0x1c7d('0x1d')][_0x1c7d('0x34')]=function(_0x3fe886,_0x5ef7b1){return this[_0x1c7d('0x11')][_0x1c7d('0x35')](_0x3fe886,_0x5ef7b1);};EmailChannel['prototype'][_0x1c7d('0x36')]=function(_0x180019){var _0x2b5578=this;if(this[_0x1c7d('0xf')][_0x180019['id']]){if(_['isNil'](this[_0x1c7d('0xf')][_0x180019['id']]['Smtp'])){this[_0x1c7d('0xf')][_0x180019['id']][_0x1c7d('0x37')]={};}this['mailAccounts'][_0x180019['id']][_0x1c7d('0x37')][_0x1c7d('0x38')]=moment();return new BPromise(function(_0x440f1e,_0x5c655c){return _0x2b5578[_0x1c7d('0x11')][_0x1c7d('0x39')](_0x180019)[_0x1c7d('0x2f')](function(_0x306a06){_0x2b5578[_0x1c7d('0xf')][_0x180019['id']][_0x1c7d('0x37')][_0x1c7d('0x16')]=_0x1c7d('0x3a');_0x2b5578[_0x1c7d('0xf')][_0x180019['id']]['Smtp'][_0x1c7d('0x17')]='';_0x2b5578['emit'](_0x180019['id']);_0x440f1e(_0x306a06);})['catch'](function(_0x2a6b9c){_0x2b5578[_0x1c7d('0xf')][_0x180019['id']]['Smtp'][_0x1c7d('0x16')]=_0x1c7d('0x32');_0x2b5578[_0x1c7d('0xf')][_0x180019['id']]['Smtp']['messageStatus']=_0x2a6b9c;_0x2b5578[_0x1c7d('0x1b')](_0x180019['id']);_0x5c655c(_0x2a6b9c);});});}return this[_0x1c7d('0x11')][_0x1c7d('0x39')](_0x180019);};module[_0x1c7d('0x3b')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ca809b6..a958193 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 _0xeda8=['fetch','handleFetchError','end','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','parser','stringify','textCode','hasOwnProperty','exports','lodash','util','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','bind','once','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','password','host','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0xeda8,0x104));var _0x8eda=function(_0x32d240,_0x413984){_0x32d240=_0x32d240-0x0;var _0x2a8d0b=_0xeda8[_0x32d240];return _0x2a8d0b;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var Imap=require('imap');var simpleParser=require(_0x8eda('0x2'))[_0x8eda('0x3')];var Iconv=require(_0x8eda('0x4'))[_0x8eda('0x5')];var EventEmitter=require(_0x8eda('0x6'))[_0x8eda('0x7')];var utils=require(_0x8eda('0x8'));var logger=require(_0x8eda('0x9'))(_0x8eda('0xa'));function EmailImap(_0x1f3556,_0x349361){this[_0x8eda('0xb')]='INBOX';this[_0x8eda('0xc')]=this[_0x8eda('0xd')](_0x1f3556,_0x349361);this[_0x8eda('0xe')]=new Imap(this[_0x8eda('0xc')]);this['imap']['once']('ready',this['handleReady'][_0x8eda('0xf')](this));this[_0x8eda('0xe')][_0x8eda('0x10')]('end',this[_0x8eda('0x11')]['bind'](this));this[_0x8eda('0xe')]['on'](_0x8eda('0x12'),this[_0x8eda('0x13')][_0x8eda('0xf')](this));this[_0x8eda('0xe')][_0x8eda('0x14')]();}util[_0x8eda('0x15')](EmailImap,EventEmitter);EmailImap[_0x8eda('0x16')]['getAccount']=function(_0x500bd4,_0xe04d90){var _0x223dcf={'connTimeout':_0x500bd4['connTimeout']?_0x500bd4[_0x8eda('0x17')]*0x3e8:0x2710,'authTimeout':_0x500bd4[_0x8eda('0x18')]?_0x500bd4[_0x8eda('0x18')]*0x3e8:0x1388};if(_['isNil'](_0x500bd4[_0x8eda('0x19')])){if(_0x500bd4['authentication']){_0x223dcf[_0x8eda('0x1a')]=_0x500bd4['user'];_0x223dcf[_0x8eda('0x1b')]=_0x500bd4['password'];}_0x223dcf[_0x8eda('0x1c')]=_0x500bd4[_0x8eda('0x1c')];_0x223dcf['port']=_0x500bd4['port']||0x3e1;if(_0x500bd4[_0x8eda('0x1d')]){_0x223dcf[_0x8eda('0x1d')]=!![];}else{_0x223dcf[_0x8eda('0x1d')]=![];_0x223dcf[_0x8eda('0x1e')]=_0x8eda('0x1f');}}else{if(_0x500bd4[_0x8eda('0x20')]){_0x223dcf[_0x8eda('0x21')]=utils[_0x8eda('0x22')](_0x500bd4[_0x8eda('0x23')][_0x8eda('0x24')],_0x500bd4[_0x8eda('0x1a')]);_0x223dcf['user']=_0x500bd4[_0x8eda('0x1a')];}else{_0x223dcf['user']=_0x500bd4[_0x8eda('0x1a')];_0x223dcf['password']=_0x500bd4[_0x8eda('0x1b')];}_0x223dcf[_0x8eda('0x1c')]=utils['getHost'](_0x500bd4['service']);_0x223dcf['port']=0x3e1;_0x223dcf[_0x8eda('0x1d')]=!![];}_0x223dcf[_0x8eda('0xa')]=_0xe04d90||_0x500bd4['user']||_0x8eda('0x25');return _0x223dcf;};EmailImap[_0x8eda('0x16')]['handleReady']=function(){this[_0x8eda('0xe')][_0x8eda('0x26')](this[_0x8eda('0xb')],![],this[_0x8eda('0x27')][_0x8eda('0xf')](this));};EmailImap['prototype'][_0x8eda('0x27')]=function(_0x5a8bed,_0x35310c){if(_0x5a8bed){this[_0x8eda('0x13')](_0x5a8bed,!![]);}else{this[_0x8eda('0x28')]('box',_0x35310c);this[_0x8eda('0x29')]();}};EmailImap[_0x8eda('0x16')][_0x8eda('0x2a')]=function(_0x4cdd2e){if(_0x4cdd2e){this[_0x8eda('0x13')](_0x4cdd2e,!![]);}else{this[_0x8eda('0xe')]['end']();}};EmailImap[_0x8eda('0x16')][_0x8eda('0x29')]=function(){this[_0x8eda('0xe')][_0x8eda('0x2b')](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap[_0x8eda('0x16')][_0x8eda('0x2c')]=function(_0x1ed3d3,_0x540690){if(_0x1ed3d3){this['handleError'](_0x1ed3d3,!![]);}else{if(_0x540690['length']){try{var _0x244da0=this[_0x8eda('0xe')][_0x8eda('0x2d')](_0x540690,{'bodies':'','markSeen':!![]});_0x244da0['on']('message',this['handleFetchMessage']['bind'](this));_0x244da0[_0x8eda('0x10')](_0x8eda('0x12'),this[_0x8eda('0x2e')][_0x8eda('0xf')](this));_0x244da0[_0x8eda('0x10')](_0x8eda('0x2f'),this[_0x8eda('0x30')][_0x8eda('0xf')](this));}catch(_0x2db577){logger[_0x8eda('0x12')](_0x2db577);}}else{this[_0x8eda('0xe')][_0x8eda('0x31')](!![],this[_0x8eda('0x2a')][_0x8eda('0xf')](this));}}};EmailImap['prototype'][_0x8eda('0x32')]=function(_0x2ed279){_0x2ed279['on'](_0x8eda('0x33'),this['handleMessageBody']['bind'](this));_0x2ed279[_0x8eda('0x10')](_0x8eda('0x34'),this[_0x8eda('0x35')][_0x8eda('0xf')](this));_0x2ed279['once'](_0x8eda('0x2f'),this[_0x8eda('0x36')][_0x8eda('0xf')](this));};EmailImap[_0x8eda('0x16')][_0x8eda('0x37')]=function(_0x29a706){simpleParser(_0x29a706,{'Iconv':Iconv},this['handleSimpleParser'][_0x8eda('0xf')](this));};EmailImap[_0x8eda('0x16')][_0x8eda('0x35')]=function(){};EmailImap[_0x8eda('0x16')][_0x8eda('0x36')]=function(){};EmailImap[_0x8eda('0x16')]['handleSimpleParser']=function(_0x1067eb,_0x2007c3){if(_0x1067eb){logger[_0x8eda('0x12')](_0x1067eb);}else{var _0x3b8527=this;utils[_0x8eda('0x38')](this['account'],_0x2007c3,function(_0x17ee80){_0x3b8527[_0x8eda('0x28')](_0x8eda('0xa'),_0x17ee80);});}};EmailImap['prototype'][_0x8eda('0x30')]=function(){this['imap'][_0x8eda('0x31')](!![],this[_0x8eda('0x2a')][_0x8eda('0xf')](this));};EmailImap[_0x8eda('0x16')][_0x8eda('0x2e')]=function(_0x5cdc89){this['handleError'](_0x5cdc89);this[_0x8eda('0xe')][_0x8eda('0x31')](!![],this[_0x8eda('0x2a')][_0x8eda('0xf')](this));};EmailImap[_0x8eda('0x16')][_0x8eda('0x11')]=function(){this[_0x8eda('0x28')](_0x8eda('0x2f'));};EmailImap[_0x8eda('0x16')][_0x8eda('0x13')]=function(_0x3f0552,_0x400548){logger[_0x8eda('0x12')](_0x8eda('0x13'),this[_0x8eda('0xc')][_0x8eda('0xa')],JSON[_0x8eda('0x39')](_0x3f0552));var _0x106232='';if(_0x3f0552){if(_0x3f0552[_0x8eda('0x3a')]){_0x106232=_0x3f0552['textCode'];}else{for(var _0x3711f8 in _0x3f0552){if(_0x3f0552[_0x8eda('0x3b')](_0x3711f8)){_0x106232+=_['upperFirst'](_0x3711f8)+':\x20'+_0x3f0552[_0x3711f8]+'\x0a';}}}}if(_0x400548){this[_0x8eda('0xe')][_0x8eda('0x2f')]();}else{this['emit'](_0x8eda('0x12'),_0x106232);this[_0x8eda('0x28')]('end');}};module[_0x8eda('0x3c')]=EmailImap; \ No newline at end of file +var _0xd8fb=['box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','account','stringify','upperFirst','emit','exports','lodash','util','imap','mailparser','events','EventEmitter','../../../config/logger','email','INBOX','getAccount','once','ready','handleReady','bind','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd8fb,0x99));var _0xbd8f=function(_0x8e00d3,_0x5d02b6){_0x8e00d3=_0x8e00d3-0x0;var _0x13c585=_0xd8fb[_0x8e00d3];return _0x13c585;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var Imap=require(_0xbd8f('0x2'));var simpleParser=require(_0xbd8f('0x3'))['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xbd8f('0x4'))[_0xbd8f('0x5')];var utils=require('./utils');var logger=require(_0xbd8f('0x6'))(_0xbd8f('0x7'));function EmailImap(_0x5543b2,_0x33d541){this['mailbox']=_0xbd8f('0x8');this['account']=this[_0xbd8f('0x9')](_0x5543b2,_0x33d541);this[_0xbd8f('0x2')]=new Imap(this['account']);this['imap'][_0xbd8f('0xa')](_0xbd8f('0xb'),this[_0xbd8f('0xc')]['bind'](this));this[_0xbd8f('0x2')][_0xbd8f('0xa')]('end',this['handleEnd'][_0xbd8f('0xd')](this));this[_0xbd8f('0x2')]['on'](_0xbd8f('0xe'),this['handleError'][_0xbd8f('0xd')](this));this[_0xbd8f('0x2')][_0xbd8f('0xf')]();}util[_0xbd8f('0x10')](EmailImap,EventEmitter);EmailImap[_0xbd8f('0x11')][_0xbd8f('0x9')]=function(_0x37d4d5,_0x29ffe8){var _0x14606c={'connTimeout':_0x37d4d5['connTimeout']?_0x37d4d5[_0xbd8f('0x12')]*0x3e8:0x2710,'authTimeout':_0x37d4d5[_0xbd8f('0x13')]?_0x37d4d5[_0xbd8f('0x13')]*0x3e8:0x1388};if(_[_0xbd8f('0x14')](_0x37d4d5['service'])){if(_0x37d4d5[_0xbd8f('0x15')]){_0x14606c[_0xbd8f('0x16')]=_0x37d4d5['user'];_0x14606c[_0xbd8f('0x17')]=_0x37d4d5[_0xbd8f('0x17')];}_0x14606c['host']=_0x37d4d5[_0xbd8f('0x18')];_0x14606c[_0xbd8f('0x19')]=_0x37d4d5['port']||0x3e1;if(_0x37d4d5['tls']){_0x14606c[_0xbd8f('0x1a')]=!![];}else{_0x14606c['tls']=![];_0x14606c['autotls']=_0xbd8f('0x1b');}}else{if(_0x37d4d5['modernAuthentication']){_0x14606c[_0xbd8f('0x1c')]=utils[_0xbd8f('0x1d')](_0x37d4d5[_0xbd8f('0x1e')][_0xbd8f('0x1f')],_0x37d4d5[_0xbd8f('0x16')]);_0x14606c[_0xbd8f('0x16')]=_0x37d4d5[_0xbd8f('0x16')];}else{_0x14606c[_0xbd8f('0x16')]=_0x37d4d5[_0xbd8f('0x16')];_0x14606c[_0xbd8f('0x17')]=_0x37d4d5[_0xbd8f('0x17')];}_0x14606c[_0xbd8f('0x18')]=utils[_0xbd8f('0x20')](_0x37d4d5[_0xbd8f('0x21')]);_0x14606c[_0xbd8f('0x19')]=0x3e1;_0x14606c[_0xbd8f('0x1a')]=!![];}_0x14606c[_0xbd8f('0x7')]=_0x29ffe8||_0x37d4d5['user']||_0xbd8f('0x22');return _0x14606c;};EmailImap[_0xbd8f('0x11')][_0xbd8f('0xc')]=function(){this[_0xbd8f('0x2')][_0xbd8f('0x23')](this[_0xbd8f('0x24')],![],this[_0xbd8f('0x25')][_0xbd8f('0xd')](this));};EmailImap['prototype'][_0xbd8f('0x25')]=function(_0x421f3e,_0x5a3a8c){if(_0x421f3e){this[_0xbd8f('0x26')](_0x421f3e,!![]);}else{this['emit'](_0xbd8f('0x27'),_0x5a3a8c);this[_0xbd8f('0x28')]();}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x29')]=function(_0x2aefa2){if(_0x2aefa2){this[_0xbd8f('0x26')](_0x2aefa2,!![]);}else{this['imap'][_0xbd8f('0x2a')]();}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x28')]=function(){this[_0xbd8f('0x2')][_0xbd8f('0x2b')]([_0xbd8f('0x2c')],this[_0xbd8f('0x2d')]['bind'](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x2d')]=function(_0xb9214c,_0x7ca145){if(_0xb9214c){this['handleError'](_0xb9214c,!![]);}else{if(_0x7ca145['length']){try{var _0x1c2274=this[_0xbd8f('0x2')][_0xbd8f('0x2e')](_0x7ca145,{'bodies':'','markSeen':!![]});_0x1c2274['on'](_0xbd8f('0x2f'),this['handleFetchMessage'][_0xbd8f('0xd')](this));_0x1c2274[_0xbd8f('0xa')](_0xbd8f('0xe'),this[_0xbd8f('0x30')][_0xbd8f('0xd')](this));_0x1c2274['once'](_0xbd8f('0x2a'),this[_0xbd8f('0x31')][_0xbd8f('0xd')](this));}catch(_0x3949c2){logger[_0xbd8f('0xe')](_0x3949c2);}}else{this['imap'][_0xbd8f('0x32')](!![],this['handleCloseBox'][_0xbd8f('0xd')](this));}}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x33')]=function(_0x386a29){_0x386a29['on'](_0xbd8f('0x34'),this[_0xbd8f('0x35')]['bind'](this));_0x386a29['once']('attributes',this[_0xbd8f('0x36')][_0xbd8f('0xd')](this));_0x386a29[_0xbd8f('0xa')](_0xbd8f('0x2a'),this[_0xbd8f('0x37')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x35')]=function(_0x2d4882){simpleParser(_0x2d4882,{'Iconv':Iconv},this[_0xbd8f('0x38')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x36')]=function(){};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x37')]=function(){};EmailImap['prototype'][_0xbd8f('0x38')]=function(_0x4181e0,_0x47f9cd){if(_0x4181e0){logger[_0xbd8f('0xe')](_0x4181e0);}else{var _0x40204a=this;utils[_0xbd8f('0x39')](this['account'],_0x47f9cd,function(_0x21da54){_0x40204a['emit'](_0xbd8f('0x7'),_0x21da54);});}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x31')]=function(){this['imap'][_0xbd8f('0x32')](!![],this[_0xbd8f('0x29')][_0xbd8f('0xd')](this));};EmailImap['prototype'][_0xbd8f('0x30')]=function(_0x3d82ef){this[_0xbd8f('0x26')](_0x3d82ef);this[_0xbd8f('0x2')][_0xbd8f('0x32')](!![],this[_0xbd8f('0x29')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x3a')]=function(){this['emit']('end');};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x26')]=function(_0x353e34,_0x2f014b){logger['error'](_0xbd8f('0x26'),this[_0xbd8f('0x3b')][_0xbd8f('0x7')],JSON[_0xbd8f('0x3c')](_0x353e34));var _0x753f0='';if(_0x353e34){if(_0x353e34['textCode']){_0x753f0=_0x353e34['textCode'];}else{for(var _0x44776c in _0x353e34){if(_0x353e34['hasOwnProperty'](_0x44776c)){_0x753f0+=_[_0xbd8f('0x3d')](_0x44776c)+':\x20'+_0x353e34[_0x44776c]+'\x0a';}}}}if(_0x2f014b){this[_0xbd8f('0x2')][_0xbd8f('0x2a')]();}else{this[_0xbd8f('0x3e')](_0xbd8f('0xe'),_0x753f0);this[_0xbd8f('0x3e')](_0xbd8f('0x2a'));}};module[_0xbd8f('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 410da4b..262e456 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 _0xed78=['verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString'];(function(_0x27b00d,_0xc3f13e){var _0x455fd1=function(_0x1a737e){while(--_0x1a737e){_0x27b00d['push'](_0x27b00d['shift']());}};_0x455fd1(++_0xc3f13e);}(_0xed78,0x11a));var _0x8ed7=function(_0x7d0577,_0xc5c9f2){_0x7d0577=_0x7d0577-0x0;var _0x27db24=_0xed78[_0x7d0577];return _0x27db24;};'use strict';var nodemailer=require(_0x8ed7('0x0'));var inlineBase64=require(_0x8ed7('0x1'));function EmailSmtp(){}EmailSmtp[_0x8ed7('0x2')][_0x8ed7('0x3')]=function(_0x302f91,_0x2cdf92){return new Promise(function(_0x498076,_0x5ea0b3){var _0x40c367=nodemailer[_0x8ed7('0x4')](_0x302f91);_0x40c367[_0x8ed7('0x5')](_0x8ed7('0x6'),inlineBase64());_0x40c367['sendMail'](_0x2cdf92,function(_0x57a166,_0x271d13){if(_0x57a166){_0x5ea0b3(_0x57a166[_0x8ed7('0x7')]());}else{_0x498076(_0x271d13);}});});};EmailSmtp[_0x8ed7('0x2')][_0x8ed7('0x8')]=function(_0x2a81e8){return new Promise(function(_0x3d1f80,_0x5d39d6){var _0x4fe518=nodemailer['createTransport'](_0x2a81e8);_0x4fe518[_0x8ed7('0x8')](function(_0x335405,_0x26c6cf){if(_0x335405){_0x5d39d6(_0x335405[_0x8ed7('0x7')]());}else{if(_0x26c6cf){_0x3d1f80(_0x26c6cf);}else{_0x5d39d6(_0x8ed7('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x43ad=['createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','prototype','send'];(function(_0x4b2099,_0x589018){var _0x51a20d=function(_0xda1932){while(--_0xda1932){_0x4b2099['push'](_0x4b2099['shift']());}};_0x51a20d(++_0x589018);}(_0x43ad,0x9d));var _0xd43a=function(_0x8b1d9f,_0x23a45a){_0x8b1d9f=_0x8b1d9f-0x0;var _0x390a30=_0x43ad[_0x8b1d9f];return _0x390a30;};'use strict';var nodemailer=require(_0xd43a('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xd43a('0x1')][_0xd43a('0x2')]=function(_0x45e0d4,_0x24daa5){return new Promise(function(_0x1b3c7e,_0x6e715e){var _0x3c3491=nodemailer[_0xd43a('0x3')](_0x45e0d4);_0x3c3491[_0xd43a('0x4')](_0xd43a('0x5'),inlineBase64());_0x3c3491[_0xd43a('0x6')](_0x24daa5,function(_0x1a7a6d,_0x5266f7){if(_0x1a7a6d){_0x6e715e(_0x1a7a6d[_0xd43a('0x7')]());}else{_0x1b3c7e(_0x5266f7);}});});};EmailSmtp[_0xd43a('0x1')][_0xd43a('0x8')]=function(_0x5a4e66){return new Promise(function(_0x1eea66,_0x386a19){var _0xb0da0=nodemailer[_0xd43a('0x3')](_0x5a4e66);_0xb0da0[_0xd43a('0x8')](function(_0x2ffab4,_0x3ba200){if(_0x2ffab4){_0x386a19(_0x2ffab4[_0xd43a('0x7')]());}else{if(_0x3ba200){_0x1eea66(_0x3ba200);}else{_0x386a19('Not\x20verifired');}}});});};module[_0xd43a('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1f40198..a9cb19f 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 _0x95ba=['../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','isEmpty','html','replace','attachments','forEach','filename','_SRC','_IMG','\x20]','body','textAsHtml','0x1?_0x2e80d8[_0xa95b('0x13')](0x0,-0x1)[_0xa95b('0x14')]('\x20'):_0x1f404f[_0xa95b('0xe')];}return'Anonymous';}function getLastName(_0x149598){var _0x5e58f2=_[_0xa95b('0x8')](_0x149598[_0xa95b('0x9')]);if(_0x5e58f2&&_0x5e58f2[_0xa95b('0xe')]){var _0x528822=_0x5e58f2[_0xa95b('0xe')][_0xa95b('0x11')](/\s+/);return _0x528822[_0xa95b('0x12')]>0x1?_0x528822['pop']():'';}return'';}function getMails(_0x52d07f,_0x138b96){var _0x3cb2a1='';for(var _0x5995ad=0x0;_0x5995ad<_0x138b96[_0xa95b('0x9')][_0xa95b('0x12')];_0x5995ad+=0x1){if(_0x138b96[_0xa95b('0x9')][_0x5995ad][_0xa95b('0xa')]!==_0x52d07f){if(!_[_0xa95b('0x15')](_0x3cb2a1)){_0x3cb2a1+=',';}_0x3cb2a1+=_0x138b96[_0xa95b('0x9')][_0x5995ad]['name']||_0x138b96['value'][_0x5995ad][_0xa95b('0xa')]||'';_0x3cb2a1+='\x20<';_0x3cb2a1+=_0x138b96[_0xa95b('0x9')][_0x5995ad][_0xa95b('0xa')]?_0x138b96['value'][_0x5995ad][_0xa95b('0xa')]:'anonymous'+random[_0xa95b('0xc')](0x6)+_0xa95b('0xd');_0x3cb2a1+='>';}}return _0x3cb2a1;}function parseEmail(_0x114fd0,_0xef4e7d,_0x5eb47b){if(_0xef4e7d[_0xa95b('0x16')]){var _0x4a1f7d=/)<[^<]*)*<\/script>/gi;while(_0x4a1f7d['test'](_0xef4e7d[_0xa95b('0x16')])){_0xef4e7d[_0xa95b('0x16')]=_0xef4e7d['html'][_0xa95b('0x17')](_0x4a1f7d,'');}if(_0xef4e7d[_0xa95b('0x16')]['includes']('{_0x5ac28c['push'](_0x159704[_0xa95b('0x1a')]);});var _0x36383a=/]+>/g;var _0x55ae0d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4947af=_0xef4e7d['html'][_0xa95b('0x17')](_0x55ae0d,_0xa95b('0x1b'));var _0x168a25=_0x4947af['replace'](_0x36383a,_0xa95b('0x1c'));for(let _0x50d518=0x0;_0x50d518<_0x5ac28c['length'];_0x50d518++){var _0x1d9ce9=_0x168a25[_0xa95b('0x17')](_0xa95b('0x1c'),'\x20[Attachment:\x20'+_0x5ac28c[_0x50d518]+_0xa95b('0x1d'));_0x168a25=_0x1d9ce9;}_0xef4e7d[_0xa95b('0x16')]=_0x168a25;}_0x5eb47b[_0xa95b('0x1e')]=_0xef4e7d[_0xa95b('0x16')];}else{_0x5eb47b[_0xa95b('0x1e')]=_0xef4e7d[_0xa95b('0x1f')];}if(_0x5eb47b[_0xa95b('0x1e')]){_0x5eb47b[_0xa95b('0x1e')]=_0x5eb47b['body']['replace'](/0x0){var _0x201519=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xa95b('0x2e')];for(var _0xe6c9a8=0x0;_0xe6c9a8<_0xef4e7d[_0xa95b('0x2f')][_0xa95b('0x12')];_0xe6c9a8++){var _0x1be5bf=_['indexOf'](_0x201519,_0xef4e7d['headerLines'][_0xe6c9a8][_0xa95b('0x30')]);if(_0x1be5bf>=0x0){_0x5eb47b['isAutoreply']=!![];}}}return _0x5eb47b;}exports[_0xa95b('0x31')]=function(_0x1da711,_0x103970,_0x41b063){var _0x1c865b={'from':getAddress(_0x103970['from']),'firstName':getFirstName(_0x103970[_0xa95b('0x32')]),'lastName':getLastName(_0x103970[_0xa95b('0x32')]),'mapKey':_0xa95b('0x6'),'message':{'from':getMails(_0x1da711['email'],_0x103970[_0xa95b('0x32')]),'to':_0x1da711['email'],'cc':'','subject':_0x103970['subject']||'','messageId':_0x103970[_0xa95b('0x33')],'inReplyTo':_0x103970['inReplyTo'],'sentAt':moment(_0x103970[_0xa95b('0x34')])[_0xa95b('0x35')](_0xa95b('0x36')),'attach':![],'attachments':[]}};if(!_0x103970[_0xa95b('0x16')]&&!_0x103970['textAsHtml']){var _0x31338e=_['filter'](_0x103970[_0xa95b('0x18')],{'contentType':_0xa95b('0x37')});if(_0x31338e[_0xa95b('0x12')]){logger[_0xa95b('0x38')](util[_0xa95b('0x35')](_0xa95b('0x39'),_0x103970[_0xa95b('0x33')]));tnef[_0xa95b('0x3a')](_[_0xa95b('0x3b')](_0x31338e)['content'],function(_0x232332,_0x5772de){if(_0x5772de){_0x103970[_0xa95b('0x16')]=_0x5772de[_0xa95b('0x3c')]||'

Empty\x20message

';if(_0x5772de[_0xa95b('0x3d')]){for(var _0x4bfe5c=0x0;_0x4bfe5c<_0x5772de[_0xa95b('0x3d')][_0xa95b('0x12')];_0x4bfe5c++){var _0x2dc333=_0x5772de[_0xa95b('0x3d')][_0x4bfe5c];_0x1c865b[_0xa95b('0x21')]['attachments'][_0xa95b('0x3e')]({'filename':_0x2dc333[_0xa95b('0x3f')],'content':Buffer['from'](_0x2dc333['Data'])});}}}_0x41b063(parseEmail(_0x1da711,_0x103970,_0x1c865b));});}else{_0x103970['html']='

Empty\x20message

';_0x41b063(parseEmail(_0x1da711,_0x103970,_0x1c865b));}}else{_0x41b063(parseEmail(_0x1da711,_0x103970,_0x1c865b));}};exports['getHost']=function(_0x3b1cc9){switch(_0x3b1cc9){case'gmail':return'imap.gmail.com';case _0xa95b('0x40'):return _0xa95b('0x41');case _0xa95b('0x42'):return _0xa95b('0x43');case _0xa95b('0x44'):return _0xa95b('0x45');}return _0xa95b('0x46');};exports['generateXOAuth2Token']=function(_0x2a5ac2,_0x546cb2){var _0x572d27=['user='+(_0x546cb2||''),_0xa95b('0x47')+_0x2a5ac2,'',''];return Buffer['from'](_0x572d27[_0xa95b('0x14')](''),_0xa95b('0x48'))[_0xa95b('0x49')](_0xa95b('0x4a'));}; \ No newline at end of file +var _0xb63b=['first','BodyHTML','

Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','toString','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','indexOf','split','length','slice','pop','isEmpty','html','replace','includes','\x20[Attachment:\x20','\x20]','body','originTo','message','originCc','bcc','type','attachment-','%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','date','textAsHtml','filter','application/ms-tnef','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer'];(function(_0x22a47b,_0x4b3742){var _0xbce88a=function(_0x25a8d0){while(--_0x25a8d0){_0x22a47b['push'](_0x22a47b['shift']());}};_0xbce88a(++_0x4b3742);}(_0xb63b,0xbb));var _0xbb63=function(_0x25cc65,_0x4bec07){_0x25cc65=_0x25cc65-0x0;var _0x34bb18=_0xb63b[_0x25cc65];return _0x34bb18;};'use strict';var _=require(_0xbb63('0x0'));var moment=require(_0xbb63('0x1'));var random=require(_0xbb63('0x2'));var fs=require('fs');var path=require(_0xbb63('0x3'));var util=require('util');var tnef=require(_0xbb63('0x4'));var logger=require(_0xbb63('0x5'))(_0xbb63('0x6'));var config=require(_0xbb63('0x7'));function getAddress(_0x4d5c29){var _0x2b56dc=_[_0xbb63('0x8')](_0x4d5c29[_0xbb63('0x9')]);return _0x2b56dc&&_0x2b56dc[_0xbb63('0xa')]?_0x2b56dc['address']:_0xbb63('0xb')+random[_0xbb63('0xc')](0x6)+_0xbb63('0xd');}function getFirstName(_0x3f8edf){var _0x54b205=_[_0xbb63('0x8')](_0x3f8edf[_0xbb63('0x9')]);if(_0x54b205&&_0x54b205[_0xbb63('0xe')]){if(_0x54b205[_0xbb63('0xe')]==_0x54b205['address']){return _0x54b205[_0xbb63('0xe')]['substring'](0x0,_0x54b205[_0xbb63('0xe')][_0xbb63('0xf')]('@'));}var _0x335579=_0x54b205[_0xbb63('0xe')][_0xbb63('0x10')](/\s+/);return _0x335579[_0xbb63('0x11')]>0x1?_0x335579[_0xbb63('0x12')](0x0,-0x1)['join']('\x20'):_0x54b205['name'];}return'Anonymous';}function getLastName(_0x3bebd8){var _0x284320=_[_0xbb63('0x8')](_0x3bebd8[_0xbb63('0x9')]);if(_0x284320&&_0x284320[_0xbb63('0xe')]){var _0x421b8b=_0x284320[_0xbb63('0xe')]['split'](/\s+/);return _0x421b8b[_0xbb63('0x11')]>0x1?_0x421b8b[_0xbb63('0x13')]():'';}return'';}function getMails(_0x20311c,_0x51d1c5){var _0x4290fb='';for(var _0x57fbab=0x0;_0x57fbab<_0x51d1c5[_0xbb63('0x9')][_0xbb63('0x11')];_0x57fbab+=0x1){if(_0x51d1c5['value'][_0x57fbab][_0xbb63('0xa')]!==_0x20311c){if(!_[_0xbb63('0x14')](_0x4290fb)){_0x4290fb+=',';}_0x4290fb+=_0x51d1c5['value'][_0x57fbab]['name']||_0x51d1c5[_0xbb63('0x9')][_0x57fbab][_0xbb63('0xa')]||'';_0x4290fb+='\x20<';_0x4290fb+=_0x51d1c5[_0xbb63('0x9')][_0x57fbab][_0xbb63('0xa')]?_0x51d1c5[_0xbb63('0x9')][_0x57fbab][_0xbb63('0xa')]:_0xbb63('0xb')+random[_0xbb63('0xc')](0x6)+_0xbb63('0xd');_0x4290fb+='>';}}return _0x4290fb;}function parseEmail(_0xc1a0a7,_0x53eab3,_0x1e77af){if(_0x53eab3[_0xbb63('0x15')]){var _0x9bcab6=/)<[^<]*)*<\/script>/gi;while(_0x9bcab6['test'](_0x53eab3[_0xbb63('0x15')])){_0x53eab3[_0xbb63('0x15')]=_0x53eab3[_0xbb63('0x15')][_0xbb63('0x16')](_0x9bcab6,'');}if(_0x53eab3[_0xbb63('0x15')][_0xbb63('0x17')](_0xbb63('0x18'))){var _0x260c54=[];_0x53eab3[_0xbb63('0x19')][_0xbb63('0x1a')](_0x1f04e9=>{_0x260c54[_0xbb63('0x1b')](_0x1f04e9[_0xbb63('0x1c')]);});var _0x508f2c=/]+>/g;var _0x1ead85=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x441fa5=_0x53eab3['html']['replace'](_0x1ead85,_0xbb63('0x1d'));var _0x3163e0=_0x441fa5['replace'](_0x508f2c,_0xbb63('0x1e'));for(let _0x129d11=0x0;_0x129d11<_0x260c54[_0xbb63('0x11')];_0x129d11++){var _0x5d94d7=_0x3163e0['replace'](_0xbb63('0x1e'),_0xbb63('0x1f')+_0x260c54[_0x129d11]+_0xbb63('0x20'));_0x3163e0=_0x5d94d7;}_0x53eab3[_0xbb63('0x15')]=_0x3163e0;}_0x1e77af[_0xbb63('0x21')]=_0x53eab3[_0xbb63('0x15')];}else{_0x1e77af[_0xbb63('0x21')]=_0x53eab3['textAsHtml'];}if(_0x1e77af[_0xbb63('0x21')]){_0x1e77af[_0xbb63('0x21')]=_0x1e77af['body'][_0xbb63('0x16')](/0x0){var _0x1bb523=[_0xbb63('0x31'),_0xbb63('0x32'),_0xbb63('0x33')];for(var _0x4c7dd3=0x0;_0x4c7dd3<_0x53eab3['headerLines'][_0xbb63('0x11')];_0x4c7dd3++){var _0x1a67df=_[_0xbb63('0xf')](_0x1bb523,_0x53eab3[_0xbb63('0x30')][_0x4c7dd3]['line']);if(_0x1a67df>=0x0){_0x1e77af[_0xbb63('0x34')]=!![];}}}return _0x1e77af;}exports[_0xbb63('0x35')]=function(_0xda5e0b,_0x59c79c,_0x32edff){var _0x1ca256={'from':getAddress(_0x59c79c[_0xbb63('0x36')]),'firstName':getFirstName(_0x59c79c['from']),'lastName':getLastName(_0x59c79c[_0xbb63('0x36')]),'mapKey':'email','message':{'from':getMails(_0xda5e0b[_0xbb63('0x6')],_0x59c79c[_0xbb63('0x36')]),'to':_0xda5e0b[_0xbb63('0x6')],'cc':'','subject':_0x59c79c[_0xbb63('0x37')]||'','messageId':_0x59c79c[_0xbb63('0x38')],'inReplyTo':_0x59c79c['inReplyTo'],'sentAt':moment(_0x59c79c[_0xbb63('0x39')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x59c79c['html']&&!_0x59c79c[_0xbb63('0x3a')]){var _0x5c92d7=_[_0xbb63('0x3b')](_0x59c79c[_0xbb63('0x19')],{'contentType':_0xbb63('0x3c')});if(_0x5c92d7['length']){logger[_0xbb63('0x3d')](util[_0xbb63('0x3e')](_0xbb63('0x3f'),_0x59c79c[_0xbb63('0x38')]));tnef[_0xbb63('0x40')](_[_0xbb63('0x41')](_0x5c92d7)[_0xbb63('0x2e')],function(_0x1b31dc,_0x4c86cb){if(_0x4c86cb){_0x59c79c[_0xbb63('0x15')]=_0x4c86cb[_0xbb63('0x42')]||_0xbb63('0x43');if(_0x4c86cb['Attachments']){for(var _0x1387fc=0x0;_0x1387fc<_0x4c86cb[_0xbb63('0x44')][_0xbb63('0x11')];_0x1387fc++){var _0xe7ed1f=_0x4c86cb['Attachments'][_0x1387fc];_0x1ca256[_0xbb63('0x23')][_0xbb63('0x19')]['push']({'filename':_0xe7ed1f[_0xbb63('0x45')],'content':Buffer[_0xbb63('0x36')](_0xe7ed1f['Data'])});}}}_0x32edff(parseEmail(_0xda5e0b,_0x59c79c,_0x1ca256));});}else{_0x59c79c['html']=_0xbb63('0x43');_0x32edff(parseEmail(_0xda5e0b,_0x59c79c,_0x1ca256));}}else{_0x32edff(parseEmail(_0xda5e0b,_0x59c79c,_0x1ca256));}};exports[_0xbb63('0x46')]=function(_0x39c779){switch(_0x39c779){case _0xbb63('0x47'):return _0xbb63('0x48');case'yahoo':return _0xbb63('0x49');case _0xbb63('0x4a'):return _0xbb63('0x4b');case _0xbb63('0x4c'):return _0xbb63('0x4d');}return _0xbb63('0x4e');};exports[_0xbb63('0x4f')]=function(_0x43f36c,_0x4958c2){var _0x58a083=[_0xbb63('0x50')+(_0x4958c2||''),_0xbb63('0x51')+_0x43f36c,'',''];return Buffer[_0xbb63('0x36')](_0x58a083[_0xbb63('0x2a')](''),'utf-8')[_0xbb63('0x52')](_0xbb63('0x53'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a55223f..b773060 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 _0x4c89=['active','Imap','exports','name','Service','key','SERV'];(function(_0xe5a473,_0x54eb27){var _0x15c63e=function(_0x526b8f){while(--_0x526b8f){_0xe5a473['push'](_0xe5a473['shift']());}};_0x15c63e(++_0x54eb27);}(_0x4c89,0x1a0));var _0x94c8=function(_0x28737b,_0x192beb){_0x28737b=_0x28737b-0x0;var _0x5b7d0f=_0x4c89[_0x28737b];return _0x5b7d0f;};'use strict';var _=require('lodash');function MailAccount(_0x4aaf88){this['id']=_0x4aaf88['id']||0x0;this[_0x94c8('0x0')]=_0x4aaf88['name']||_0x94c8('0x1');this['key']=_0x4aaf88[_0x94c8('0x2')]||_0x94c8('0x3');this[_0x94c8('0x4')]=_0x4aaf88['active']||![];this[_0x94c8('0x5')]=_0x4aaf88[_0x94c8('0x5')]||[];this['Smtp']=_0x4aaf88['Smtp']||[];}module[_0x94c8('0x6')]=MailAccount; \ No newline at end of file +var _0x5980=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x21d022,_0x5a48be){var _0x5f089b=function(_0x2d5cb5){while(--_0x2d5cb5){_0x21d022['push'](_0x21d022['shift']());}};_0x5f089b(++_0x5a48be);}(_0x5980,0x1f0));var _0x0598=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x5980[_0x4e21ba];return _0x55b94b;};'use strict';var _=require('lodash');function MailAccount(_0x4803c3){this['id']=_0x4803c3['id']||0x0;this[_0x0598('0x0')]=_0x4803c3[_0x0598('0x0')]||_0x0598('0x1');this[_0x0598('0x2')]=_0x4803c3[_0x0598('0x2')]||_0x0598('0x3');this[_0x0598('0x4')]=_0x4803c3[_0x0598('0x4')]||![];this['Imap']=_0x4803c3[_0x0598('0x5')]||[];this[_0x0598('0x6')]=_0x4803c3[_0x0598('0x6')]||[];}module[_0x0598('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c2cc92c..2e4f227 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 _0xfd2d=['../model/mailAccount','mailAccounts','mapKeys','prototype','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xfd2d,0x15e));var _0xdfd2=function(_0x26e871,_0x437ed8){_0x26e871=_0x26e871-0x0;var _0x14dc88=_0xfd2d[_0x26e871];return _0x14dc88;};'use strict';var _=require('lodash');var MailAccount=require(_0xdfd2('0x0'));var Realtime=function(){this[_0xdfd2('0x1')]={};};function freeIsNotKey(_0x2f16b4,_0x3b97b7,_0x516351){var _0x27febe=_[_0xdfd2('0x2')](_0x2f16b4,function(_0x452d22,_0x23cbca){return _0x452d22[_0x516351];});for(var _0x501ac8 in _0x3b97b7){if(_0x3b97b7['hasOwnProperty'](_0x501ac8)){if(!_0x27febe[_0x501ac8]){delete _0x3b97b7[_0x501ac8];}}}}Realtime[_0xdfd2('0x3')]['mergeFromDatabase']=function(_0x1d1ea0,_0x2eb1d1){for(var _0x31cc45 in _0x2eb1d1){if(_0x1d1ea0[_0xdfd2('0x4')](_0x31cc45)){_0x1d1ea0[_0x31cc45]=_0x2eb1d1[_0x31cc45];}}};Realtime[_0xdfd2('0x3')][_0xdfd2('0x5')]=function(){var _0x20a1cb=this;return function(_0x321bc8){if(_0x321bc8){freeIsNotKey(_0x321bc8,_0x20a1cb[_0xdfd2('0x1')],'id');for(var _0x554aff=0x0,_0x304c55={},_0x5de64e={};_0x554aff<_0x321bc8[_0xdfd2('0x6')];_0x554aff+=0x1){_0x304c55=_0x321bc8[_0x554aff];if(_[_0xdfd2('0x7')](_0x20a1cb['mailAccounts'][_0x304c55['id']])){_0x20a1cb[_0xdfd2('0x1')][_0x304c55['id']]=new MailAccount(_0x304c55);}else{_[_0xdfd2('0x8')](_0x20a1cb[_0xdfd2('0x1')][_0x304c55['id']],_0x304c55);}}}return _0x20a1cb['mailAccounts'];};};module[_0xdfd2('0x9')]=Realtime; \ No newline at end of file +var _0xa374=['initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x45b7c1,_0x94c894){var _0x273f63=function(_0x2438d8){while(--_0x2438d8){_0x45b7c1['push'](_0x45b7c1['shift']());}};_0x273f63(++_0x94c894);}(_0xa374,0xd6));var _0x4a37=function(_0x5794fb,_0x1624a8){_0x5794fb=_0x5794fb-0x0;var _0x5df3e2=_0xa374[_0x5794fb];return _0x5df3e2;};'use strict';var _=require(_0x4a37('0x0'));var MailAccount=require(_0x4a37('0x1'));var Realtime=function(){this[_0x4a37('0x2')]={};};function freeIsNotKey(_0x37498d,_0x39890a,_0x2d0585){var _0x362e32=_['mapKeys'](_0x37498d,function(_0x591110,_0x4c46df){return _0x591110[_0x2d0585];});for(var _0x5ed1e7 in _0x39890a){if(_0x39890a[_0x4a37('0x3')](_0x5ed1e7)){if(!_0x362e32[_0x5ed1e7]){delete _0x39890a[_0x5ed1e7];}}}}Realtime[_0x4a37('0x4')][_0x4a37('0x5')]=function(_0x586524,_0x3e7b3b){for(var _0xa9451b in _0x3e7b3b){if(_0x586524[_0x4a37('0x3')](_0xa9451b)){_0x586524[_0xa9451b]=_0x3e7b3b[_0xa9451b];}}};Realtime['prototype'][_0x4a37('0x6')]=function(){var _0x5e10ee=this;return function(_0x4e2a60){if(_0x4e2a60){freeIsNotKey(_0x4e2a60,_0x5e10ee[_0x4a37('0x2')],'id');for(var _0x27b16b=0x0,_0x3c972c={},_0x5976c6={};_0x27b16b<_0x4e2a60[_0x4a37('0x7')];_0x27b16b+=0x1){_0x3c972c=_0x4e2a60[_0x27b16b];if(_[_0x4a37('0x8')](_0x5e10ee[_0x4a37('0x2')][_0x3c972c['id']])){_0x5e10ee['mailAccounts'][_0x3c972c['id']]=new MailAccount(_0x3c972c);}else{_[_0x4a37('0x9')](_0x5e10ee[_0x4a37('0x2')][_0x3c972c['id']],_0x3c972c);}}}return _0x5e10ee['mailAccounts'];};};module[_0x4a37('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 6fd6207..f1a6701 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 _0xd641=['GetMailAccount','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','name','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd641,0xd9));var _0x1d64=function(_0x3616d1,_0x5631c9){_0x3616d1=_0x3616d1-0x0;var _0x91965e=_0xd641[_0x3616d1];return _0x91965e;};'use strict';var client=require(_0x1d64('0x0'));exports[_0x1d64('0x1')]=function(){return function(){return client[_0x1d64('0x2')](_0x1d64('0x3'),{'options':{'attributes':['id','name',_0x1d64('0x4'),_0x1d64('0x5'),'email',_0x1d64('0x6'),_0x1d64('0x7'),_0x1d64('0x8'),_0x1d64('0x9')],'raw':![],'include':[{'model':_0x1d64('0xa'),'as':_0x1d64('0xb'),'include':[{'model':_0x1d64('0xc'),'attributes':['id','name',_0x1d64('0x5'),_0x1d64('0xd'),_0x1d64('0xe')],'as':'CloudProvider'}]},{'model':_0x1d64('0xf'),'as':_0x1d64('0x10'),'include':[{'model':_0x1d64('0xc'),'attributes':['id',_0x1d64('0x11'),_0x1d64('0x5'),_0x1d64('0xd'),_0x1d64('0xe')],'as':'CloudProvider'}]}]},'log':_0x1d64('0x12')});};};exports['notify']=function(_0x49bd1c,_0x61d170){return client['Request']('NotifyMailAccount',{'account':{'id':_0x49bd1c},'body':_0x61d170,'log':_0x1d64('0x13')});}; \ No newline at end of file +var _0x184e=['Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x83ce13,_0x51c35f){var _0x46633a=function(_0x566a80){while(--_0x566a80){_0x83ce13['push'](_0x83ce13['shift']());}};_0x46633a(++_0x51c35f);}(_0x184e,0x1a0));var _0xe184=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x184e[_0x333767];return _0x51661b;};'use strict';var client=require(_0xe184('0x0'));exports[_0xe184('0x1')]=function(){return function(){return client[_0xe184('0x2')](_0xe184('0x3'),{'options':{'attributes':['id',_0xe184('0x4'),_0xe184('0x5'),_0xe184('0x6'),'email',_0xe184('0x7'),_0xe184('0x8'),_0xe184('0x9'),_0xe184('0xa')],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':'CloudProvider','attributes':['id',_0xe184('0x4'),'service',_0xe184('0xb'),_0xe184('0xc')],'as':_0xe184('0xd')}]},{'model':_0xe184('0xe'),'as':_0xe184('0xf'),'include':[{'model':_0xe184('0xd'),'attributes':['id',_0xe184('0x4'),'service','type',_0xe184('0xc')],'as':_0xe184('0xd')}]}]},'log':_0xe184('0x10')});};};exports[_0xe184('0x11')]=function(_0x5600ea,_0x3cb466){return client[_0xe184('0x2')](_0xe184('0x12'),{'account':{'id':_0x5600ea},'body':_0x3cb466,'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 2d1e151..ee900a2 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 _0x308d=['Request','loginMailFrequency','GetSettings','getSettings'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x308d,0x1ab));var _0xd308=function(_0x49f18b,_0x160a8d){_0x49f18b=_0x49f18b-0x0;var _0x4675f8=_0x308d[_0x49f18b];return _0x4675f8;};'use strict';var client=require('../client');exports[_0xd308('0x0')]=function(){return client[_0xd308('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd308('0x2')]},'log':_0xd308('0x3')});}; \ No newline at end of file +var _0x43d1=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x15e348,_0x419e41){var _0x22268e=function(_0x302dde){while(--_0x302dde){_0x15e348['push'](_0x15e348['shift']());}};_0x22268e(++_0x419e41);}(_0x43d1,0x1b1));var _0x143d=function(_0x136ac2,_0x533c10){_0x136ac2=_0x136ac2-0x0;var _0x5a6fba=_0x43d1[_0x136ac2];return _0x5a6fba;};'use strict';var client=require(_0x143d('0x0'));exports[_0x143d('0x1')]=function(){return client[_0x143d('0x2')](_0x143d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x143d('0x4')]},'log':_0x143d('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 25a8f4c..6957b5d 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 568027f..226f2d1 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 _0x7fac=['lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x53b1e8,_0x5d36e8){var _0xf3272e=function(_0x385910){while(--_0x385910){_0x53b1e8['push'](_0x53b1e8['shift']());}};_0xf3272e(++_0x5d36e8);}(_0x7fac,0xc6));var _0xc7fa=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x7fac[_0x4191af];return _0x27bebf;};'use strict';var _=require(_0xc7fa('0x0'));var http=require(_0xc7fa('0x1'));var express=require(_0xc7fa('0x2'));var sticky=require(_0xc7fa('0x3'));var Redis=require('ioredis');var config=require(_0xc7fa('0x4'));var app=express();var server=http[_0xc7fa('0x5')](app);server[_0xc7fa('0x6')]=0xdbba0;if(sticky[_0xc7fa('0x7')](server,config[_0xc7fa('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xc7fa('0x9'),_0xc7fa('0xa')]});config[_0xc7fa('0xb')]=_[_0xc7fa('0xc')](config[_0xc7fa('0xb')],{'host':_0xc7fa('0xd'),'port':0x18eb});socketio[_0xc7fa('0xe')](require(_0xc7fa('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xc7fa('0xb')])}));require('../../config/triggers')[_0xc7fa('0x10')]();require(_0xc7fa('0x11'))[_0xc7fa('0x10')](socketio);require(_0xc7fa('0x12'))[_0xc7fa('0x10')](app);require('../../routes')['default'](app);}else{server[_0xc7fa('0x13')]('listening',function(){console[_0xc7fa('0x14')](_0xc7fa('0x15'),config[_0xc7fa('0x8')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x6e75=['../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','websocket','polling','redis','defaults','adapter','../../config/socketio','default','../../config/express'];(function(_0x357fe9,_0x1eefc2){var _0x3187f6=function(_0x3e536f){while(--_0x3e536f){_0x357fe9['push'](_0x357fe9['shift']());}};_0x3187f6(++_0x1eefc2);}(_0x6e75,0x194));var _0x56e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e75[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var http=require(_0x56e7('0x0'));var express=require(_0x56e7('0x1'));var sticky=require(_0x56e7('0x2'));var Redis=require(_0x56e7('0x3'));var config=require(_0x56e7('0x4'));var app=express();var server=http[_0x56e7('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x56e7('0x6')](server,config[_0x56e7('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x56e7('0x8'),_0x56e7('0x9')]});config[_0x56e7('0xa')]=_[_0x56e7('0xb')](config[_0x56e7('0xa')],{'host':'localhost','port':0x18eb});socketio[_0x56e7('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x56e7('0xa')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x56e7('0xd'))[_0x56e7('0xe')](socketio);require(_0x56e7('0xf'))[_0x56e7('0xe')](app);require(_0x56e7('0x10'))[_0x56e7('0xe')](app);}else{server[_0x56e7('0x11')](_0x56e7('0x12'),function(){console[_0x56e7('0x13')](_0x56e7('0x14'),config[_0x56e7('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 32dcbfb..84406d4 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 _0x7830=['rpc','error','message','catch','jayson/promise','bluebird','routing','http','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7830,0x1f3));var _0x0783=function(_0x1be6e7,_0x5607b8){_0x1be6e7=_0x1be6e7-0x0;var _0x2f07c4=_0x7830[_0x1be6e7];return _0x2f07c4;};'use strict';var jayson=require(_0x0783('0x0'));var BPromise=require(_0x0783('0x1'));var logger=require('../../config/logger')(_0x0783('0x2'));var client=jayson['client'][_0x0783('0x3')]({'port':0x2329});client['Request']=function(_0x4a663d,_0x1d2b12){return new BPromise(function(_0xa24077,_0x2c12c8){return client['request'](_0x4a663d,_0x1d2b12)[_0x0783('0x4')](function(_0x303969){logger['debug'](_0x0783('0x5'),_0x0783('0x2'),_0x4a663d,_0x1d2b12,_0x303969);if(_0x303969[_0x0783('0x6')]){logger[_0x0783('0x6')](_0x0783('0x5'),'routing',_0x4a663d,_0x303969[_0x0783('0x6')][_0x0783('0x7')],_0x1d2b12);return _0x2c12c8(_0x303969[_0x0783('0x6')][_0x0783('0x7')]);}else{return _0xa24077(_0x303969['result']);}})[_0x0783('0x8')](function(_0x29edbb){logger['error'](_0x0783('0x5'),_0x0783('0x2'),_0x4a663d,_0x29edbb,_0x1d2b12);return _0x2c12c8(_0x29edbb);});});};module['exports']=client; \ No newline at end of file +var _0x2585=['message','catch','rpc','../../config/logger','routing','client','http','Request','then','debug','error'];(function(_0x1fd384,_0x958168){var _0x4395d5=function(_0x3efaf6){while(--_0x3efaf6){_0x1fd384['push'](_0x1fd384['shift']());}};_0x4395d5(++_0x958168);}(_0x2585,0x121));var _0x5258=function(_0x1c64ce,_0x36b246){_0x1c64ce=_0x1c64ce-0x0;var _0x1952f2=_0x2585[_0x1c64ce];return _0x1952f2;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x5258('0x0'))(_0x5258('0x1'));var client=jayson[_0x5258('0x2')][_0x5258('0x3')]({'port':0x2329});client[_0x5258('0x4')]=function(_0x47bb33,_0x25b1f9){return new BPromise(function(_0x1ff06,_0x5aa110){return client['request'](_0x47bb33,_0x25b1f9)[_0x5258('0x5')](function(_0x17ee5d){logger[_0x5258('0x6')]('rpc',_0x5258('0x1'),_0x47bb33,_0x25b1f9,_0x17ee5d);if(_0x17ee5d[_0x5258('0x7')]){logger['error']('rpc',_0x5258('0x1'),_0x47bb33,_0x17ee5d[_0x5258('0x7')][_0x5258('0x8')],_0x25b1f9);return _0x5aa110(_0x17ee5d[_0x5258('0x7')][_0x5258('0x8')]);}else{return _0x1ff06(_0x17ee5d['result']);}})[_0x5258('0x9')](function(_0x438053){logger[_0x5258('0x7')](_0x5258('0xa'),'routing',_0x47bb33,_0x438053,_0x25b1f9);return _0x5aa110(_0x438053);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 19092aa..fa6f7d9 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 _0xb5e2=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xb5e2,0x119));var _0x2b5e=function(_0x1b085e,_0x29add6){_0x1b085e=_0x1b085e-0x0;var _0x19211c=_0xb5e2[_0x1b085e];return _0x19211c;};'use strict';var BPromise=require('bluebird');var server=require(_0x2b5e('0x0'));var Realtime=require(_0x2b5e('0x1'));var user=require(_0x2b5e('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x2b5e('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x2b5e('0x4'));var mailQueue=require(_0x2b5e('0x5'));var faxQueue=require(_0x2b5e('0x6'));var whatsappQueue=require(_0x2b5e('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2b5e('0x8')]()[_0x2b5e('0x9')](user[_0x2b5e('0xa')]())[_0x2b5e('0x9')](realtime[_0x2b5e('0xb')]())[_0x2b5e('0x9')](interval['getIntervals']())['then'](realtime[_0x2b5e('0xc')]())[_0x2b5e('0x9')](openchannelQueue[_0x2b5e('0xd')]())[_0x2b5e('0x9')](realtime[_0x2b5e('0xe')]())[_0x2b5e('0x9')](chatQueue[_0x2b5e('0xf')]())[_0x2b5e('0x9')](realtime[_0x2b5e('0x10')]())[_0x2b5e('0x9')](smsQueue[_0x2b5e('0x11')]())[_0x2b5e('0x9')](realtime['initSmsQueues']())[_0x2b5e('0x9')](mailQueue[_0x2b5e('0x12')]())[_0x2b5e('0x9')](realtime[_0x2b5e('0x13')]())[_0x2b5e('0x9')](faxQueue[_0x2b5e('0x14')]())['then'](realtime[_0x2b5e('0x15')]())[_0x2b5e('0x9')](whatsappQueue[_0x2b5e('0x16')]())['then'](realtime['initWhatsappQueues']())[_0x2b5e('0x9')](function(){return realtime;});}function main(){return server[_0x2b5e('0x17')](realtime)[_0x2b5e('0x9')](function(_0x300e7f){return initRealtime();})[_0x2b5e('0x9')](function(_0x52a8ab){return setInterval(initRealtime,0x1388);})[_0x2b5e('0x18')](function(_0x1bb811){console[_0x2b5e('0x19')](_0x1bb811);});}main(); \ No newline at end of file +var _0xc4a8=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals'];(function(_0x9d806f,_0x486ab0){var _0x1fad91=function(_0x272db4){while(--_0x272db4){_0x9d806f['push'](_0x9d806f['shift']());}};_0x1fad91(++_0x486ab0);}(_0xc4a8,0x89));var _0x8c4a=function(_0x2ca703,_0x52ab3c){_0x2ca703=_0x2ca703-0x0;var _0x1a19a9=_0xc4a8[_0x2ca703];return _0x1a19a9;};'use strict';var BPromise=require(_0x8c4a('0x0'));var server=require(_0x8c4a('0x1'));var Realtime=require(_0x8c4a('0x2'));var user=require(_0x8c4a('0x3'));var interval=require(_0x8c4a('0x4'));var openchannelQueue=require(_0x8c4a('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8c4a('0x6'));var faxQueue=require(_0x8c4a('0x7'));var whatsappQueue=require(_0x8c4a('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8c4a('0x9')]()['then'](user[_0x8c4a('0xa')]())[_0x8c4a('0xb')](realtime['initAgents']())[_0x8c4a('0xb')](interval[_0x8c4a('0xc')]())['then'](realtime['initIntervals']())[_0x8c4a('0xb')](openchannelQueue[_0x8c4a('0xd')]())[_0x8c4a('0xb')](realtime[_0x8c4a('0xe')]())[_0x8c4a('0xb')](chatQueue[_0x8c4a('0xf')]())['then'](realtime[_0x8c4a('0x10')]())[_0x8c4a('0xb')](smsQueue[_0x8c4a('0x11')]())[_0x8c4a('0xb')](realtime[_0x8c4a('0x12')]())[_0x8c4a('0xb')](mailQueue['getMailQueues']())['then'](realtime[_0x8c4a('0x13')]())[_0x8c4a('0xb')](faxQueue[_0x8c4a('0x14')]())['then'](realtime[_0x8c4a('0x15')]())[_0x8c4a('0xb')](whatsappQueue[_0x8c4a('0x16')]())['then'](realtime[_0x8c4a('0x17')]())[_0x8c4a('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x8c4a('0xb')](function(_0x45dab4){return initRealtime();})['then'](function(_0x1cf913){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4d9f70){console[_0x8c4a('0x18')](_0x4d9f70);});}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 98290c4..cf4ef9c 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x8dbaa8,_0x5282b9){var _0x463665=function(_0x459efe){while(--_0x459efe){_0x8dbaa8['push'](_0x8dbaa8['shift']());}};_0x463665(++_0x5282b9);}(_0x7a54,0x106));var _0x47a5=function(_0x1dc1ca,_0x39ef26){_0x1dc1ca=_0x1dc1ca-0x0;var _0x21a19c=_0x7a54[_0x1dc1ca];return _0x21a19c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x217706,_0x2d6f90){var _0x159670=function(_0x423cd7){while(--_0x423cd7){_0x217706['push'](_0x217706['shift']());}};_0x159670(++_0x2d6f90);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 6d4e854..d3b2c0d 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 _0x8d34=['request','error','message','result','sendMailMessage','SendMail','client','http'];(function(_0x5b2843,_0x2a7952){var _0x4478d2=function(_0x2cb626){while(--_0x2cb626){_0x5b2843['push'](_0x5b2843['shift']());}};_0x4478d2(++_0x2a7952);}(_0x8d34,0x116));var _0x48d3=function(_0x5ea1b7,_0x33d477){_0x5ea1b7=_0x5ea1b7-0x0;var _0x5db996=_0x8d34[_0x5ea1b7];return _0x5db996;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x48d3('0x0')][_0x48d3('0x1')]({'port':0x232b});function request(_0x5673ef,_0x1a1717){return new BPromise(function(_0x4bb1d5,_0x27150c){return client[_0x48d3('0x2')](_0x5673ef,_0x1a1717)['then'](function(_0x28988f){if(_0x28988f[_0x48d3('0x3')]){return _0x27150c(_0x28988f[_0x48d3('0x3')][_0x48d3('0x4')]);}else{return _0x4bb1d5(_0x28988f[_0x48d3('0x5')]);}})['catch'](function(_0x4d5552){return _0x27150c(_0x4d5552);});});}exports[_0x48d3('0x6')]=function(_0x5f1479,_0x2bf6ae){return request(_0x48d3('0x7'),{'account':_0x5f1479,'message':_0x2bf6ae});}; \ No newline at end of file +var _0xa0cc=['bluebird','jayson/promise','client','then','error','message','SendMail'];(function(_0xe7955b,_0xa67a96){var _0x4383bf=function(_0x2ec671){while(--_0x2ec671){_0xe7955b['push'](_0xe7955b['shift']());}};_0x4383bf(++_0xa67a96);}(_0xa0cc,0x1c0));var _0xca0c=function(_0x33ad42,_0x4b421b){_0x33ad42=_0x33ad42-0x0;var _0x5478e9=_0xa0cc[_0x33ad42];return _0x5478e9;};'use strict';var BPromise=require(_0xca0c('0x0'));var jayson=require(_0xca0c('0x1'));var client=jayson[_0xca0c('0x2')]['http']({'port':0x232b});function request(_0x548961,_0x4a437c){return new BPromise(function(_0x43bb3c,_0x40e8a2){return client['request'](_0x548961,_0x4a437c)[_0xca0c('0x3')](function(_0x3480a6){if(_0x3480a6[_0xca0c('0x4')]){return _0x40e8a2(_0x3480a6[_0xca0c('0x4')][_0xca0c('0x5')]);}else{return _0x43bb3c(_0x3480a6['result']);}})['catch'](function(_0xf7a1b9){return _0x40e8a2(_0xf7a1b9);});});}exports['sendMailMessage']=function(_0x4ffc46,_0x53b340){return request(_0xca0c('0x6'),{'account':_0x4ffc46,'message':_0x53b340});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 25f272d..34e09b8 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 _0xae37=['Status','StatusTime','toNumber','mailStatus','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp'];(function(_0x1ca9cd,_0x3d3544){var _0x3299b6=function(_0x22d352){while(--_0x22d352){_0x1ca9cd['push'](_0x1ca9cd['shift']());}};_0x3299b6(++_0x3d3544);}(_0xae37,0xc3));var _0x7ae3=function(_0x54a14f,_0x59c124){_0x54a14f=_0x54a14f-0x0;var _0x47d334=_0xae37[_0x54a14f];return _0x47d334;};'use strict';var _=require(_0x7ae3('0x0'));var moment=require(_0x7ae3('0x1'));var md5=require(_0x7ae3('0x2'));var Redis=require(_0x7ae3('0x3'));var config=require(_0x7ae3('0x4'));config['redis']=_[_0x7ae3('0x5')](config[_0x7ae3('0x6')],{'host':_0x7ae3('0x7'),'port':0x18eb});var io=require(_0x7ae3('0x8'))(new Redis(config[_0x7ae3('0x6')]));function Agent(_0xcf4f74){this['id']=_0xcf4f74['id']||0x0;this['name']=_0xcf4f74[_0x7ae3('0x9')]||'';this[_0x7ae3('0xa')]=_0xcf4f74['online']||!![];this[_0x7ae3('0xb')]=_0xcf4f74[_0x7ae3('0xb')]||![];this[_0x7ae3('0xc')]=_0xcf4f74[_0x7ae3('0xc')]||![];this[_0x7ae3('0xd')]=_0xcf4f74[_0x7ae3('0xd')]||![];this[_0x7ae3('0xe')]=_0xcf4f74[_0x7ae3('0xe')]||![];this[_0x7ae3('0xf')]=_0xcf4f74[_0x7ae3('0xf')]||![];this[_0x7ae3('0x10')]=_0xcf4f74[_0x7ae3('0x10')]||![];this[_0x7ae3('0x11')]=_0x7ae3('0x12');this[_0x7ae3('0x13')]=0x0;this[_0x7ae3('0x14')]=_0xcf4f74['chatCapacity']||0x0;this[_0x7ae3('0x15')]=0x0;this['mailStatus']=_0x7ae3('0x12');this[_0x7ae3('0x16')]=0x0;this[_0x7ae3('0x17')]=_0xcf4f74['mailCapacity']||0x0;this[_0x7ae3('0x18')]=0x0;this[_0x7ae3('0x19')]='unknown';this[_0x7ae3('0x1a')]=0x0;this[_0x7ae3('0x1b')]=_0xcf4f74[_0x7ae3('0x1b')]||0x0;this[_0x7ae3('0x1c')]=0x0;this['smsStatus']=_0x7ae3('0x12');this['smsStatusTime']=0x0;this[_0x7ae3('0x1d')]=_0xcf4f74['smsCapacity']||0x0;this[_0x7ae3('0x1e')]=0x0;this[_0x7ae3('0x1f')]='unknown';this[_0x7ae3('0x20')]=0x0;this[_0x7ae3('0x21')]=_0xcf4f74[_0x7ae3('0x21')]||0x0;this[_0x7ae3('0x22')]=0x0;this[_0x7ae3('0x23')]='unknown';this[_0x7ae3('0x24')]=0x0;this[_0x7ae3('0x25')]=_0xcf4f74['openchannelCapacity']||0x0;this[_0x7ae3('0x26')]=0x0;this[_0x7ae3('0x27')]=![];this['busyQueue']=undefined;this[_0x7ae3('0x2')]='';this[_0x7ae3('0x28')]();}Agent[_0x7ae3('0x29')][_0x7ae3('0x2a')]=function(_0x3852d8){if(this[_0x3852d8+_0x7ae3('0x2b')]>0x0){if(this[_0x3852d8+'Capacity']>0x0&&this[_0x3852d8+_0x7ae3('0x2b')]>=this[_0x3852d8+_0x7ae3('0x2c')]){return _0x7ae3('0x2d');}else{return _0x7ae3('0x2e');}}else{return _0x7ae3('0x2f');}};Agent[_0x7ae3('0x29')][_0x7ae3('0x28')]=function(){var _0x4a57fd=['mail',_0x7ae3('0x30'),_0x7ae3('0x31'),_0x7ae3('0x32'),_0x7ae3('0x33'),_0x7ae3('0x34')];for(var _0x54f49f=0x0;_0x54f49f<_0x4a57fd['length'];_0x54f49f+=0x1){var _0x26c64b=this[_0x7ae3('0x2a')](_0x4a57fd[_0x54f49f]);if(this[_0x4a57fd[_0x54f49f]+_0x7ae3('0x35')]!==_0x26c64b){this[_0x4a57fd[_0x54f49f]+_0x7ae3('0x36')]=_[_0x7ae3('0x37')](moment()['format']('x'));}this[_0x4a57fd[_0x54f49f]+'Status']=_0x26c64b;}var _0x5c6fde={'id':this['id'],'name':this[_0x7ae3('0x9')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x7ae3('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x7ae3('0xf')],'faxPause':this[_0x7ae3('0xe')],'openchannelPause':this[_0x7ae3('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x7ae3('0x13')],'chatCapacity':this[_0x7ae3('0x14')],'chatCurrentCapacity':this[_0x7ae3('0x15')],'mailStatus':this[_0x7ae3('0x38')],'mailStatusTime':this[_0x7ae3('0x16')],'mailCapacity':this[_0x7ae3('0x17')],'mailCurrentCapacity':this[_0x7ae3('0x18')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x7ae3('0x1a')],'faxCapacity':this[_0x7ae3('0x1b')],'faxCurrentCapacity':this[_0x7ae3('0x1c')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x7ae3('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7ae3('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7ae3('0x22')],'openchannelStatus':this[_0x7ae3('0x23')],'openchannelStatusTime':this[_0x7ae3('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x7ae3('0x26')],'busy':this[_0x7ae3('0x27')],'busyQueue':this[_0x7ae3('0x39')]};var _0x3c3c41=md5(JSON[_0x7ae3('0x3a')](_0x5c6fde));if(this[_0x7ae3('0x2')]!==_0x3c3c41){this[_0x7ae3('0x2')]=_0x3c3c41;io[_0x7ae3('0x3b')](_0x7ae3('0x3c'),_0x5c6fde);}};module[_0x7ae3('0x3d')]=Agent; \ No newline at end of file +var _0x35fc=['whatsappStatus','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','length','getChannelStatus','Status','StatusTime','toNumber','format','online','chatStatus','mailStatusTime','faxStatusTime','faxCurrentCapacity'];(function(_0x1c085c,_0x14880c){var _0x27695a=function(_0x15bbe7){while(--_0x15bbe7){_0x1c085c['push'](_0x1c085c['shift']());}};_0x27695a(++_0x14880c);}(_0x35fc,0x7f));var _0xc35f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x35fc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc35f('0x0'));var moment=require(_0xc35f('0x1'));var md5=require('md5');var Redis=require(_0xc35f('0x2'));var config=require(_0xc35f('0x3'));config[_0xc35f('0x4')]=_[_0xc35f('0x5')](config[_0xc35f('0x4')],{'host':_0xc35f('0x6'),'port':0x18eb});var io=require(_0xc35f('0x7'))(new Redis(config[_0xc35f('0x4')]));function Agent(_0x2624ca){this['id']=_0x2624ca['id']||0x0;this[_0xc35f('0x8')]=_0x2624ca[_0xc35f('0x8')]||'';this['online']=_0x2624ca['online']||!![];this[_0xc35f('0x9')]=_0x2624ca[_0xc35f('0x9')]||![];this[_0xc35f('0xa')]=_0x2624ca[_0xc35f('0xa')]||![];this[_0xc35f('0xb')]=_0x2624ca['mailPause']||![];this['faxPause']=_0x2624ca['faxPause']||![];this[_0xc35f('0xc')]=_0x2624ca[_0xc35f('0xc')]||![];this['openchannelPause']=_0x2624ca[_0xc35f('0xd')]||![];this['chatStatus']='unknown';this[_0xc35f('0xe')]=0x0;this[_0xc35f('0xf')]=_0x2624ca[_0xc35f('0xf')]||0x0;this[_0xc35f('0x10')]=0x0;this[_0xc35f('0x11')]=_0xc35f('0x12');this['mailStatusTime']=0x0;this[_0xc35f('0x13')]=_0x2624ca[_0xc35f('0x13')]||0x0;this[_0xc35f('0x14')]=0x0;this[_0xc35f('0x15')]='unknown';this['faxStatusTime']=0x0;this['faxCapacity']=_0x2624ca[_0xc35f('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xc35f('0x17')]='unknown';this[_0xc35f('0x18')]=0x0;this[_0xc35f('0x19')]=_0x2624ca[_0xc35f('0x19')]||0x0;this[_0xc35f('0x1a')]=0x0;this['whatsappStatus']='unknown';this[_0xc35f('0x1b')]=0x0;this[_0xc35f('0x1c')]=_0x2624ca[_0xc35f('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0xc35f('0x12');this[_0xc35f('0x1d')]=0x0;this[_0xc35f('0x1e')]=_0x2624ca['openchannelCapacity']||0x0;this[_0xc35f('0x1f')]=0x0;this[_0xc35f('0x20')]=![];this[_0xc35f('0x21')]=undefined;this[_0xc35f('0x22')]='';this[_0xc35f('0x23')]();}Agent[_0xc35f('0x24')]['getChannelStatus']=function(_0x43120d){if(this[_0x43120d+'CurrentCapacity']>0x0){if(this[_0x43120d+'Capacity']>0x0&&this[_0x43120d+'CurrentCapacity']>=this[_0x43120d+_0xc35f('0x25')]){return _0xc35f('0x26');}else{return _0xc35f('0x27');}}else{return _0xc35f('0x28');}};Agent[_0xc35f('0x24')]['updateRealtime']=function(){var _0x55c29c=[_0xc35f('0x29'),_0xc35f('0x2a'),_0xc35f('0x2b'),_0xc35f('0x2c'),'sms','whatsapp'];for(var _0x2ad120=0x0;_0x2ad120<_0x55c29c[_0xc35f('0x2d')];_0x2ad120+=0x1){var _0x194300=this[_0xc35f('0x2e')](_0x55c29c[_0x2ad120]);if(this[_0x55c29c[_0x2ad120]+_0xc35f('0x2f')]!==_0x194300){this[_0x55c29c[_0x2ad120]+_0xc35f('0x30')]=_[_0xc35f('0x31')](moment()[_0xc35f('0x32')]('x'));}this[_0x55c29c[_0x2ad120]+'Status']=_0x194300;}var _0x5c314e={'id':this['id'],'name':this[_0xc35f('0x8')],'online':this[_0xc35f('0x33')],'voicePause':this[_0xc35f('0x9')],'chatPause':this[_0xc35f('0xa')],'mailPause':this[_0xc35f('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xc35f('0x34')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc35f('0xf')],'chatCurrentCapacity':this[_0xc35f('0x10')],'mailStatus':this[_0xc35f('0x11')],'mailStatusTime':this[_0xc35f('0x35')],'mailCapacity':this[_0xc35f('0x13')],'mailCurrentCapacity':this[_0xc35f('0x14')],'faxStatus':this[_0xc35f('0x15')],'faxStatusTime':this[_0xc35f('0x36')],'faxCapacity':this[_0xc35f('0x16')],'faxCurrentCapacity':this[_0xc35f('0x37')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc35f('0x18')],'smsCapacity':this[_0xc35f('0x19')],'smsCurrentCapacity':this[_0xc35f('0x1a')],'whatsappStatus':this[_0xc35f('0x38')],'whatsappStatusTime':this[_0xc35f('0x1b')],'whatsappCapacity':this[_0xc35f('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xc35f('0x1d')],'openchannelCapacity':this[_0xc35f('0x1e')],'openchannelCurrentCapacity':this[_0xc35f('0x1f')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x4102e0=md5(JSON[_0xc35f('0x39')](_0x5c314e));if(this[_0xc35f('0x22')]!==_0x4102e0){this[_0xc35f('0x22')]=_0x4102e0;io[_0xc35f('0x3a')](_0xc35f('0x3b'),_0x5c314e);}};module[_0xc35f('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 a1d7690..412df84 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 _0x14cd=['updateRealtime','loggedIn','length','online','chatPause','available','paused','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x14cd,0xa7));var _0xd14c=function(_0x3e374e,_0x1bae81){_0x3e374e=_0x3e374e-0x0;var _0x55286f=_0x14cd[_0x3e374e];return _0x55286f;};'use strict';var _=require(_0xd14c('0x0'));var md5=require(_0xd14c('0x1'));var util=require(_0xd14c('0x2'));var Redis=require(_0xd14c('0x3'));var config=require(_0xd14c('0x4'));config[_0xd14c('0x5')]=_[_0xd14c('0x6')](config[_0xd14c('0x5')],{'host':_0xd14c('0x7'),'port':0x18eb});var io=require(_0xd14c('0x8'))(new Redis(config[_0xd14c('0x5')]));function ChatQueue(_0x3b0a31){this['id']=_0x3b0a31['id']||0x0;this['name']=_0x3b0a31[_0xd14c('0x9')]||'';this[_0xd14c('0xa')]=_0x3b0a31['timeout']||0xa;this[_0xd14c('0xb')]=_0x3b0a31['strategy']||'beepall';this[_0xd14c('0xc')]=_0x3b0a31['Agents'];this[_0xd14c('0xd')]={};this[_0xd14c('0xe')]=0x0;this['md5']='';this[_0xd14c('0xf')]();this['updateRealtime']();}ChatQueue[_0xd14c('0x10')][_0xd14c('0xf')]=function(){var _0x5729eb=this[_0xd14c('0xd')][_0xd14c('0x11')];this[_0xd14c('0xd')]=_[_0xd14c('0x12')](this[_0xd14c('0xc')],'id');this[_0xd14c('0xd')][_0xd14c('0x11')]=_0x5729eb;};ChatQueue[_0xd14c('0x10')][_0xd14c('0x13')]=function(){this[_0xd14c('0x14')]=0x0;this['paused']=0x0;for(var _0x48e304=0x0;_0x48e304=0x0?this[_0xd14c('0x18')]:0x0;var _0x5d9bdf={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd14c('0x14')],'name':this['name'],'paused':this[_0xd14c('0x19')],'waiting':this[_0xd14c('0xe')]};var _0x3d86b9=md5(JSON[_0xd14c('0x1a')](_0x5d9bdf));if(this[_0xd14c('0x1')]!==_0x3d86b9){this[_0xd14c('0x1')]=_0x3d86b9;io['to'](util['format'](_0xd14c('0x1b'),_0x5d9bdf[_0xd14c('0x9')]))[_0xd14c('0x1c')](_0xd14c('0x1d'),_0x5d9bdf);}};module[_0xd14c('0x1e')]=ChatQueue; \ No newline at end of file +var _0x94d6=['lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','emit','chat_queue:save'];(function(_0x97d1b4,_0x279adf){var _0x118e30=function(_0x5a893e){while(--_0x5a893e){_0x97d1b4['push'](_0x97d1b4['shift']());}};_0x118e30(++_0x279adf);}(_0x94d6,0xa2));var _0x694d=function(_0x467886,_0x341b0e){_0x467886=_0x467886-0x0;var _0x4dede8=_0x94d6[_0x467886];return _0x4dede8;};'use strict';var _=require(_0x694d('0x0'));var md5=require(_0x694d('0x1'));var util=require('util');var Redis=require(_0x694d('0x2'));var config=require(_0x694d('0x3'));config[_0x694d('0x4')]=_[_0x694d('0x5')](config[_0x694d('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x694d('0x6'))(new Redis(config[_0x694d('0x4')]));function ChatQueue(_0x39d6b1){this['id']=_0x39d6b1['id']||0x0;this['name']=_0x39d6b1[_0x694d('0x7')]||'';this[_0x694d('0x8')]=_0x39d6b1[_0x694d('0x8')]||0xa;this[_0x694d('0x9')]=_0x39d6b1['strategy']||_0x694d('0xa');this['Agents']=_0x39d6b1[_0x694d('0xb')];this[_0x694d('0xc')]={};this[_0x694d('0xd')]=0x0;this[_0x694d('0x1')]='';this['updateRouting']();this[_0x694d('0xe')]();}ChatQueue[_0x694d('0xf')]['updateRouting']=function(){var _0x2f03d1=this[_0x694d('0xc')][_0x694d('0x10')];this[_0x694d('0xc')]=_[_0x694d('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x694d('0x10')]=_0x2f03d1;};ChatQueue[_0x694d('0xf')][_0x694d('0xe')]=function(){this[_0x694d('0x12')]=0x0;this[_0x694d('0x13')]=0x0;for(var _0x3a0622=0x0;_0x3a0622=0x0?this[_0x694d('0x17')]:0x0;var _0x4eff3a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x694d('0x12')],'name':this[_0x694d('0x7')],'paused':this['paused'],'waiting':this[_0x694d('0xd')]};var _0xbeeac=md5(JSON[_0x694d('0x18')](_0x4eff3a));if(this[_0x694d('0x1')]!==_0xbeeac){this['md5']=_0xbeeac;io['to'](util['format']('chat:queue:%s',_0x4eff3a['name']))[_0x694d('0x19')](_0x694d('0x1a'),_0x4eff3a);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index f6e6881..050ceff 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 _0x3378=['beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','faxPause','paused','available','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy'];(function(_0xe4eacf,_0x6d92db){var _0x1c059f=function(_0x4a23f4){while(--_0x4a23f4){_0xe4eacf['push'](_0xe4eacf['shift']());}};_0x1c059f(++_0x6d92db);}(_0x3378,0x189));var _0x8337=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0x3378[_0x246f0c];return _0x30fe50;};'use strict';var _=require(_0x8337('0x0'));var md5=require('md5');var util=require(_0x8337('0x1'));var Redis=require(_0x8337('0x2'));var config=require(_0x8337('0x3'));config[_0x8337('0x4')]=_[_0x8337('0x5')](config[_0x8337('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8337('0x6'))(new Redis(config[_0x8337('0x4')]));function FaxQueue(_0x32efee){this['id']=_0x32efee['id']||0x0;this[_0x8337('0x7')]=_0x32efee[_0x8337('0x7')]||'';this[_0x8337('0x8')]=_0x32efee['timeout']||0xa;this[_0x8337('0x9')]=_0x32efee[_0x8337('0x9')]||_0x8337('0xa');this[_0x8337('0xb')]=_0x32efee[_0x8337('0xb')];this[_0x8337('0xc')]={};this[_0x8337('0xd')]=0x0;this[_0x8337('0xe')]='';this[_0x8337('0xf')]();this[_0x8337('0x10')]();}FaxQueue[_0x8337('0x11')][_0x8337('0xf')]=function(){var _0x24ff00=this['mapAgentsId'][_0x8337('0x12')];this['mapAgentsId']=_[_0x8337('0x13')](this[_0x8337('0xb')],'id');this[_0x8337('0xc')]['_rr']=_0x24ff00;};FaxQueue[_0x8337('0x11')][_0x8337('0x10')]=function(){this[_0x8337('0x14')]=0x0;this['paused']=0x0;for(var _0x43380b=0x0;_0x43380b=0x0?this['available']:0x0;var _0x96bb3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8337('0x14')],'name':this['name'],'paused':this[_0x8337('0x18')],'waiting':this[_0x8337('0xd')]};var _0x1c548d=md5(JSON[_0x8337('0x1a')](_0x96bb3));if(this['md5']!==_0x1c548d){this[_0x8337('0xe')]=_0x1c548d;io['to'](util[_0x8337('0x1b')]('fax:queue:%s',_0x96bb3[_0x8337('0x7')]))[_0x8337('0x1c')](_0x8337('0x1d'),_0x96bb3);}};module[_0x8337('0x1e')]=FaxQueue; \ No newline at end of file +var _0x99f3=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s','fax_queue:save','md5','util','defaults','localhost','redis','name'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x99f3,0x1a3));var _0x399f=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x99f3[_0x329664];return _0x4e346e;};'use strict';var _=require('lodash');var md5=require(_0x399f('0x0'));var util=require(_0x399f('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x399f('0x2')](config['redis'],{'host':_0x399f('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x399f('0x4')]));function FaxQueue(_0x24c392){this['id']=_0x24c392['id']||0x0;this[_0x399f('0x5')]=_0x24c392[_0x399f('0x5')]||'';this[_0x399f('0x6')]=_0x24c392['timeout']||0xa;this[_0x399f('0x7')]=_0x24c392['strategy']||_0x399f('0x8');this[_0x399f('0x9')]=_0x24c392['Agents'];this[_0x399f('0xa')]={};this['waiting']=0x0;this[_0x399f('0x0')]='';this[_0x399f('0xb')]();this[_0x399f('0xc')]();}FaxQueue[_0x399f('0xd')][_0x399f('0xb')]=function(){var _0x56d358=this[_0x399f('0xa')][_0x399f('0xe')];this[_0x399f('0xa')]=_[_0x399f('0xf')](this[_0x399f('0x9')],'id');this[_0x399f('0xa')][_0x399f('0xe')]=_0x56d358;};FaxQueue['prototype'][_0x399f('0xc')]=function(){this[_0x399f('0x10')]=0x0;this[_0x399f('0x11')]=0x0;for(var _0x4a0de0=0x0;_0x4a0de0=0x0?this[_0x399f('0x15')]:0x0;var _0x56ecd9={'id':this['id'],'available':this[_0x399f('0x15')],'loggedIn':this[_0x399f('0x10')],'name':this['name'],'paused':this[_0x399f('0x11')],'waiting':this['waiting']};var _0x40cbe2=md5(JSON['stringify'](_0x56ecd9));if(this[_0x399f('0x0')]!==_0x40cbe2){this[_0x399f('0x0')]=_0x40cbe2;io['to'](util[_0x399f('0x16')](_0x399f('0x17'),_0x56ecd9['name']))['emit'](_0x399f('0x18'),_0x56ecd9);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 880d6ab..f3e452f 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 _0xc2e3=['name','Intervals','exports'];(function(_0x142fcd,_0x4e631c){var _0x117df6=function(_0x3042da){while(--_0x3042da){_0x142fcd['push'](_0x142fcd['shift']());}};_0x117df6(++_0x4e631c);}(_0xc2e3,0x1b3));var _0x3c2e=function(_0x50c428,_0x181584){_0x50c428=_0x50c428-0x0;var _0x5751fd=_0xc2e3[_0x50c428];return _0x5751fd;};'use strict';function Interval(_0x343c1c){this['id']=_0x343c1c['id']||0x0;this[_0x3c2e('0x0')]=_0x343c1c[_0x3c2e('0x0')]||'';this['Intervals']=_0x343c1c[_0x3c2e('0x1')]||{};}module[_0x3c2e('0x2')]=Interval; \ No newline at end of file +var _0x0c71=['exports','Intervals'];(function(_0x468857,_0x2f4090){var _0x1ab002=function(_0x450dac){while(--_0x450dac){_0x468857['push'](_0x468857['shift']());}};_0x1ab002(++_0x2f4090);}(_0x0c71,0xd7));var _0x10c7=function(_0x2ea738,_0x17d6a9){_0x2ea738=_0x2ea738-0x0;var _0x46acd0=_0x0c71[_0x2ea738];return _0x46acd0;};'use strict';function Interval(_0x5dad24){this['id']=_0x5dad24['id']||0x0;this['name']=_0x5dad24['name']||'';this[_0x10c7('0x0')]=_0x5dad24['Intervals']||{};}module[_0x10c7('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index cd080d3..409f992 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 _0xa57c=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','online','loggedIn','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xa57c,0x6f));var _0xca57=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa57c[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xca57('0x0'));var md5=require(_0xca57('0x1'));var util=require(_0xca57('0x2'));var Redis=require('ioredis');var config=require(_0xca57('0x3'));config[_0xca57('0x4')]=_[_0xca57('0x5')](config[_0xca57('0x4')],{'host':_0xca57('0x6'),'port':0x18eb});var io=require(_0xca57('0x7'))(new Redis(config[_0xca57('0x4')]));function MailQueue(_0xa87213){this['id']=_0xa87213['id']||0x0;this[_0xca57('0x8')]=_0xa87213[_0xca57('0x8')]||'';this[_0xca57('0x9')]=_0xa87213['timeout']||0xa;this[_0xca57('0xa')]=_0xa87213[_0xca57('0xa')]||_0xca57('0xb');this[_0xca57('0xc')]=_0xa87213['Agents'];this[_0xca57('0xd')]={};this[_0xca57('0xe')]=0x0;this[_0xca57('0x1')]='';this[_0xca57('0xf')]();this[_0xca57('0x10')]();}MailQueue[_0xca57('0x11')][_0xca57('0xf')]=function(){var _0x40891d=this[_0xca57('0xd')][_0xca57('0x12')];this[_0xca57('0xd')]=_[_0xca57('0x13')](this[_0xca57('0xc')],'id');this['mapAgentsId']['_rr']=_0x40891d;};MailQueue[_0xca57('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3e22bf=0x0;_0x3e22bf=0x0?this[_0xca57('0x18')]:0x0;var _0x2924b9={'id':this['id'],'available':this[_0xca57('0x18')],'loggedIn':this[_0xca57('0x15')],'name':this[_0xca57('0x8')],'paused':this[_0xca57('0x17')],'waiting':this[_0xca57('0xe')]};var _0x502251=md5(JSON[_0xca57('0x19')](_0x2924b9));if(this[_0xca57('0x1')]!==_0x502251){this['md5']=_0x502251;io['to'](util[_0xca57('0x1a')](_0xca57('0x1b'),_0x2924b9[_0xca57('0x8')]))[_0xca57('0x1c')](_0xca57('0x1d'),_0x2924b9);}};module[_0xca57('0x1e')]=MailQueue; \ No newline at end of file +var _0x2b63=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format','mail_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','localhost'];(function(_0x19dc2c,_0x2709ab){var _0x34949a=function(_0x8d94af){while(--_0x8d94af){_0x19dc2c['push'](_0x19dc2c['shift']());}};_0x34949a(++_0x2709ab);}(_0x2b63,0x13d));var _0x32b6=function(_0x3b8326,_0x212581){_0x3b8326=_0x3b8326-0x0;var _0x160763=_0x2b63[_0x3b8326];return _0x160763;};'use strict';var _=require(_0x32b6('0x0'));var md5=require(_0x32b6('0x1'));var util=require(_0x32b6('0x2'));var Redis=require(_0x32b6('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x32b6('0x4')](config[_0x32b6('0x5')],{'host':_0x32b6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x29c735){this['id']=_0x29c735['id']||0x0;this[_0x32b6('0x7')]=_0x29c735['name']||'';this[_0x32b6('0x8')]=_0x29c735[_0x32b6('0x8')]||0xa;this[_0x32b6('0x9')]=_0x29c735[_0x32b6('0x9')]||_0x32b6('0xa');this[_0x32b6('0xb')]=_0x29c735[_0x32b6('0xb')];this[_0x32b6('0xc')]={};this[_0x32b6('0xd')]=0x0;this[_0x32b6('0x1')]='';this[_0x32b6('0xe')]();this[_0x32b6('0xf')]();}MailQueue[_0x32b6('0x10')][_0x32b6('0xe')]=function(){var _0x343e7a=this[_0x32b6('0xc')]['_rr'];this[_0x32b6('0xc')]=_[_0x32b6('0x11')](this[_0x32b6('0xb')],'id');this['mapAgentsId'][_0x32b6('0x12')]=_0x343e7a;};MailQueue[_0x32b6('0x10')][_0x32b6('0xf')]=function(){this[_0x32b6('0x13')]=0x0;this[_0x32b6('0x14')]=0x0;for(var _0x22d155=0x0;_0x22d155=0x0?this['available']:0x0;var _0x225b6d={'id':this['id'],'available':this[_0x32b6('0x17')],'loggedIn':this[_0x32b6('0x13')],'name':this['name'],'paused':this[_0x32b6('0x14')],'waiting':this[_0x32b6('0xd')]};var _0x53f003=md5(JSON['stringify'](_0x225b6d));if(this['md5']!==_0x53f003){this[_0x32b6('0x1')]=_0x53f003;io['to'](util[_0x32b6('0x18')]('mail:queue:%s',_0x225b6d[_0x32b6('0x7')]))['emit'](_0x32b6('0x19'),_0x225b6d);}};module[_0x32b6('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 2d3e798..4fdbb00 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 _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(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x1261,0x144));var _0x1126=function(_0x1e691f,_0x215f5f){_0x1e691f=_0x1e691f-0x0;var _0x5b37cb=_0x1261[_0x1e691f];return _0x5b37cb;};'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 +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(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a28dd44..5b60748 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 _0xbe02=['beepall','Agents','mapAgentsId','map','_rr','prototype','updateRealtime','loggedIn','paused','length','available','waiting','stringify','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy'];(function(_0xa28795,_0x944fcb){var _0x5ad34d=function(_0x108206){while(--_0x108206){_0xa28795['push'](_0xa28795['shift']());}};_0x5ad34d(++_0x944fcb);}(_0xbe02,0x146));var _0x2be0=function(_0x1b70bc,_0x2f44a5){_0x1b70bc=_0x1b70bc-0x0;var _0x395a7b=_0xbe02[_0x1b70bc];return _0x395a7b;};'use strict';var _=require(_0x2be0('0x0'));var md5=require(_0x2be0('0x1'));var util=require(_0x2be0('0x2'));var Redis=require(_0x2be0('0x3'));var config=require('../../../config/environment');config[_0x2be0('0x4')]=_[_0x2be0('0x5')](config[_0x2be0('0x4')],{'host':_0x2be0('0x6'),'port':0x18eb});var io=require(_0x2be0('0x7'))(new Redis(config[_0x2be0('0x4')]));function SmsQueue(_0x40f52b){this['id']=_0x40f52b['id']||0x0;this[_0x2be0('0x8')]=_0x40f52b[_0x2be0('0x8')]||'';this['timeout']=_0x40f52b['timeout']||0xa;this[_0x2be0('0x9')]=_0x40f52b[_0x2be0('0x9')]||_0x2be0('0xa');this[_0x2be0('0xb')]=_0x40f52b[_0x2be0('0xb')];this[_0x2be0('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue['prototype']['updateRouting']=function(){var _0x367444=this[_0x2be0('0xc')]['_rr'];this[_0x2be0('0xc')]=_[_0x2be0('0xd')](this[_0x2be0('0xb')],'id');this[_0x2be0('0xc')][_0x2be0('0xe')]=_0x367444;};SmsQueue[_0x2be0('0xf')][_0x2be0('0x10')]=function(){this[_0x2be0('0x11')]=0x0;this[_0x2be0('0x12')]=0x0;for(var _0x271f25=0x0;_0x271f25=0x0?this[_0x2be0('0x14')]:0x0;var _0x415894={'id':this['id'],'available':this[_0x2be0('0x14')],'loggedIn':this[_0x2be0('0x11')],'name':this[_0x2be0('0x8')],'paused':this[_0x2be0('0x12')],'waiting':this[_0x2be0('0x15')]};var _0x34f588=md5(JSON[_0x2be0('0x16')](_0x415894));if(this[_0x2be0('0x1')]!==_0x34f588){this[_0x2be0('0x1')]=_0x34f588;io['to'](util['format']('sms:queue:%s',_0x415894[_0x2be0('0x8')]))['emit']('sms_queue:save',_0x415894);}};module[_0x2be0('0x17')]=SmsQueue; \ No newline at end of file +var _0xb2b5=['md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','smsPause','available','paused','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb2b5[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x5b2b('0x0'));config[_0x5b2b('0x1')]=_['defaults'](config['redis'],{'host':_0x5b2b('0x2'),'port':0x18eb});var io=require(_0x5b2b('0x3'))(new Redis(config[_0x5b2b('0x1')]));function SmsQueue(_0x3c073f){this['id']=_0x3c073f['id']||0x0;this['name']=_0x3c073f[_0x5b2b('0x4')]||'';this[_0x5b2b('0x5')]=_0x3c073f['timeout']||0xa;this['strategy']=_0x3c073f[_0x5b2b('0x6')]||_0x5b2b('0x7');this[_0x5b2b('0x8')]=_0x3c073f[_0x5b2b('0x8')];this[_0x5b2b('0x9')]={};this[_0x5b2b('0xa')]=0x0;this[_0x5b2b('0xb')]='';this[_0x5b2b('0xc')]();this['updateRealtime']();}SmsQueue[_0x5b2b('0xd')][_0x5b2b('0xc')]=function(){var _0x53e4ca=this[_0x5b2b('0x9')][_0x5b2b('0xe')];this['mapAgentsId']=_[_0x5b2b('0xf')](this[_0x5b2b('0x8')],'id');this[_0x5b2b('0x9')][_0x5b2b('0xe')]=_0x53e4ca;};SmsQueue[_0x5b2b('0xd')][_0x5b2b('0x10')]=function(){this[_0x5b2b('0x11')]=0x0;this['paused']=0x0;for(var _0x30e9a3=0x0;_0x30e9a3=0x0?this['available']:0x0;var _0x13eaa1={'id':this['id'],'available':this[_0x5b2b('0x15')],'loggedIn':this[_0x5b2b('0x11')],'name':this[_0x5b2b('0x4')],'paused':this[_0x5b2b('0x16')],'waiting':this['waiting']};var _0x35b589=md5(JSON[_0x5b2b('0x17')](_0x13eaa1));if(this[_0x5b2b('0xb')]!==_0x35b589){this[_0x5b2b('0xb')]=_0x35b589;io['to'](util[_0x5b2b('0x18')](_0x5b2b('0x19'),_0x13eaa1[_0x5b2b('0x4')]))[_0x5b2b('0x1a')](_0x5b2b('0x1b'),_0x13eaa1);}};module[_0x5b2b('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 34eef93..5f18f98 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 _0x809c=['loggedIn','paused','length','online','whatsappPause','available','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','prototype'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x809c,0x142));var _0xc809=function(_0x40d8ec,_0x13a245){_0x40d8ec=_0x40d8ec-0x0;var _0x274d78=_0x809c[_0x40d8ec];return _0x274d78;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xc809('0x0'));var config=require('../../../config/environment');config[_0xc809('0x1')]=_['defaults'](config[_0xc809('0x1')],{'host':_0xc809('0x2'),'port':0x18eb});var io=require(_0xc809('0x3'))(new Redis(config['redis']));function WhatsappQueue(_0x3484ae){this['id']=_0x3484ae['id']||0x0;this[_0xc809('0x4')]=_0x3484ae[_0xc809('0x4')]||'';this[_0xc809('0x5')]=_0x3484ae[_0xc809('0x5')]||0xa;this[_0xc809('0x6')]=_0x3484ae[_0xc809('0x6')]||_0xc809('0x7');this[_0xc809('0x8')]=_0x3484ae[_0xc809('0x8')];this[_0xc809('0x9')]={};this[_0xc809('0xa')]=0x0;this[_0xc809('0xb')]='';this[_0xc809('0xc')]();this[_0xc809('0xd')]();}WhatsappQueue['prototype'][_0xc809('0xc')]=function(){var _0x269af6=this[_0xc809('0x9')][_0xc809('0xe')];this[_0xc809('0x9')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x269af6;};WhatsappQueue[_0xc809('0xf')][_0xc809('0xd')]=function(){this[_0xc809('0x10')]=0x0;this[_0xc809('0x11')]=0x0;for(var _0x14c897=0x0;_0x14c897=0x0?this[_0xc809('0x15')]:0x0;var _0x58c42b={'id':this['id'],'available':this[_0xc809('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xc809('0x4')],'paused':this[_0xc809('0x11')],'waiting':this['waiting']};var _0x21870a=md5(JSON['stringify'](_0x58c42b));if(this[_0xc809('0xb')]!==_0x21870a){this['md5']=_0x21870a;io['to'](util['format'](_0xc809('0x16'),_0x58c42b[_0xc809('0x4')]))[_0xc809('0x17')](_0xc809('0x18'),_0x58c42b);}};module[_0xc809('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x983e=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x20ed42,_0x5f58dc){var _0x3a51a7=function(_0x5a4bfe){while(--_0x5a4bfe){_0x20ed42['push'](_0x20ed42['shift']());}};_0x3a51a7(++_0x5f58dc);}(_0x983e,0x92));var _0xe983=function(_0x181dc2,_0x1e96e5){_0x181dc2=_0x181dc2-0x0;var _0x35f6ed=_0x983e[_0x181dc2];return _0x35f6ed;};'use strict';var _=require(_0xe983('0x0'));var md5=require('md5');var util=require(_0xe983('0x1'));var Redis=require(_0xe983('0x2'));var config=require('../../../config/environment');config[_0xe983('0x3')]=_[_0xe983('0x4')](config[_0xe983('0x3')],{'host':_0xe983('0x5'),'port':0x18eb});var io=require(_0xe983('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x42b6f3){this['id']=_0x42b6f3['id']||0x0;this[_0xe983('0x7')]=_0x42b6f3[_0xe983('0x7')]||'';this[_0xe983('0x8')]=_0x42b6f3[_0xe983('0x8')]||0xa;this[_0xe983('0x9')]=_0x42b6f3[_0xe983('0x9')]||'beepall';this[_0xe983('0xa')]=_0x42b6f3['Agents'];this[_0xe983('0xb')]={};this[_0xe983('0xc')]=0x0;this['md5']='';this[_0xe983('0xd')]();this[_0xe983('0xe')]();}WhatsappQueue[_0xe983('0xf')][_0xe983('0xd')]=function(){var _0x1f3114=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xe983('0x10')](this[_0xe983('0xa')],'id');this[_0xe983('0xb')][_0xe983('0x11')]=_0x1f3114;};WhatsappQueue['prototype'][_0xe983('0xe')]=function(){this[_0xe983('0x12')]=0x0;this[_0xe983('0x13')]=0x0;for(var _0x5cc68b=0x0;_0x5cc68b=0x0?this[_0xe983('0x17')]:0x0;var _0x180361={'id':this['id'],'available':this[_0xe983('0x17')],'loggedIn':this[_0xe983('0x12')],'name':this[_0xe983('0x7')],'paused':this[_0xe983('0x13')],'waiting':this[_0xe983('0xc')]};var _0x20960e=md5(JSON[_0xe983('0x18')](_0x180361));if(this[_0xe983('0x19')]!==_0x20960e){this[_0xe983('0x19')]=_0x20960e;io['to'](util[_0xe983('0x1a')](_0xe983('0x1b'),_0x180361[_0xe983('0x7')]))[_0xe983('0x1c')](_0xe983('0x1d'),_0x180361);}};module[_0xe983('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 6d99974..8c8ac32 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 3d22386..acef1d8 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 _0x0927=['../client','update','Request','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x8edb4d,_0x4abd95){var _0x2e1c99=function(_0x3a2274){while(--_0x3a2274){_0x8edb4d['push'](_0x8edb4d['shift']());}};_0x2e1c99(++_0x4abd95);}(_0x0927,0xfc));var _0x7092=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0927[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7092('0x0'));exports[_0x7092('0x1')]=function(_0x296344,_0x22916c){return client[_0x7092('0x2')]('UpdateChatInteraction',{'body':_0x22916c,'options':{'where':{'id':_0x296344}},'log':'updateChatInteraction'});};exports[_0x7092('0x3')]=function(_0x4dedbf,_0x34d6c4){return client['Request'](_0x7092('0x4'),{'body':_0x34d6c4,'options':{'where':{'id':_0x4dedbf}},'log':_0x7092('0x5')});}; \ No newline at end of file +var _0xbe17=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x498784,_0x58af60){var _0x26238d=function(_0x2a48ed){while(--_0x2a48ed){_0x498784['push'](_0x498784['shift']());}};_0x26238d(++_0x58af60);}(_0xbe17,0xfb));var _0x7be1=function(_0x4042e8,_0x4aeb45){_0x4042e8=_0x4042e8-0x0;var _0x660e36=_0xbe17[_0x4042e8];return _0x660e36;};'use strict';var client=require(_0x7be1('0x0'));exports[_0x7be1('0x1')]=function(_0xd3265,_0x1ac9bb){return client[_0x7be1('0x2')](_0x7be1('0x3'),{'body':_0x1ac9bb,'options':{'where':{'id':_0xd3265}},'log':_0x7be1('0x4')});};exports[_0x7be1('0x5')]=function(_0x459ef2,_0x41bff5){return client[_0x7be1('0x2')](_0x7be1('0x6'),{'body':_0x41bff5,'options':{'where':{'id':_0x459ef2}},'log':_0x7be1('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 60b7520..61a3b80 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 _0x504e=['../client','CreateChatMessage'];(function(_0x1f10df,_0x224828){var _0x17d981=function(_0x27ff13){while(--_0x27ff13){_0x1f10df['push'](_0x1f10df['shift']());}};_0x17d981(++_0x224828);}(_0x504e,0x64));var _0xe504=function(_0x39ae1d,_0x26a11c){_0x39ae1d=_0x39ae1d-0x0;var _0x252362=_0x504e[_0x39ae1d];return _0x252362;};'use strict';var client=require(_0xe504('0x0'));exports['create']=function(_0x37ab08){return client['Request'](_0xe504('0x1'),{'body':_0x37ab08,'log':'createChatMessage'});}; \ No newline at end of file +var _0xba48=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x21b75d,_0x48fa9c){var _0x4ab2c2=function(_0x3f5400){while(--_0x3f5400){_0x21b75d['push'](_0x21b75d['shift']());}};_0x4ab2c2(++_0x48fa9c);}(_0xba48,0xfd));var _0x8ba4=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xba48[_0x2cfb58];return _0xd99951;};'use strict';var client=require(_0x8ba4('0x0'));exports[_0x8ba4('0x1')]=function(_0x36fde4){return client[_0x8ba4('0x2')](_0x8ba4('0x3'),{'body':_0x36fde4,'log':_0x8ba4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a7f0322..6767dad 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 _0xa41a=['getChatQueues','GetChatQueue','name','timeout','strategy','User','Agents','online','../client'];(function(_0x143ff8,_0x5b0298){var _0x36192b=function(_0x4a8858){while(--_0x4a8858){_0x143ff8['push'](_0x143ff8['shift']());}};_0x36192b(++_0x5b0298);}(_0xa41a,0x6b));var _0xaa41=function(_0xc025ea,_0x1e27a1){_0xc025ea=_0xc025ea-0x0;var _0x4cdef4=_0xa41a[_0xc025ea];return _0x4cdef4;};'use strict';var client=require(_0xaa41('0x0'));exports[_0xaa41('0x1')]=function(){return function(){return client['Request'](_0xaa41('0x2'),{'options':{'raw':![],'attributes':['id',_0xaa41('0x3'),_0xaa41('0x4'),_0xaa41('0x5')],'include':[{'model':_0xaa41('0x6'),'as':_0xaa41('0x7'),'attributes':['id',_0xaa41('0x3'),_0xaa41('0x8'),'chatPause']}]},'log':_0xaa41('0x1')});};}; \ No newline at end of file +var _0x29d4=['name','timeout','strategy','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x3c5acb,_0x35f0af){var _0x3e069c=function(_0x56eb5f){while(--_0x56eb5f){_0x3c5acb['push'](_0x3c5acb['shift']());}};_0x3e069c(++_0x35f0af);}(_0x29d4,0x1a1));var _0x429d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x29d4[_0x54d4fe];return _0x1ab5bb;};'use strict';var client=require(_0x429d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x429d('0x1')](_0x429d('0x2'),{'options':{'raw':![],'attributes':['id',_0x429d('0x3'),_0x429d('0x4'),_0x429d('0x5')],'include':[{'model':'User','as':_0x429d('0x6'),'attributes':['id',_0x429d('0x3'),_0x429d('0x7'),_0x429d('0x8')]}]},'log':_0x429d('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index bd432a5..e804b58 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 _0xca66=['Request','CreateChatQueueReport','DESC','UpdateChatQueueReport','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca66,0x8b));var _0x6ca6=function(_0x228a9b,_0x4d83da){_0x228a9b=_0x228a9b-0x0;var _0x426a9f=_0xca66[_0x228a9b];return _0x426a9f;};'use strict';var client=require(_0x6ca6('0x0'));exports['create']=function(_0x5bad57){return client[_0x6ca6('0x1')](_0x6ca6('0x2'),{'body':_0x5bad57,'log':_0x6ca6('0x2')});};exports['update']=function(_0x3c03b2,_0x4b1a10){return client[_0x6ca6('0x1')]('UpdateChatQueueReport',{'body':_0x4b1a10,'options':{'where':{'uniqueid':_0x3c03b2},'order':[['id',_0x6ca6('0x3')]],'limit':0x1},'log':_0x6ca6('0x4')});}; \ No newline at end of file +var _0x0ef0=['DESC','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x49f2e9,_0x115c19){var _0x3801db=function(_0x6665b){while(--_0x6665b){_0x49f2e9['push'](_0x49f2e9['shift']());}};_0x3801db(++_0x115c19);}(_0x0ef0,0x80));var _0x00ef=function(_0x255036,_0xf94145){_0x255036=_0x255036-0x0;var _0x3c4c56=_0x0ef0[_0x255036];return _0x3c4c56;};'use strict';var client=require(_0x00ef('0x0'));exports[_0x00ef('0x1')]=function(_0x498146){return client[_0x00ef('0x2')](_0x00ef('0x3'),{'body':_0x498146,'log':_0x00ef('0x3')});};exports[_0x00ef('0x4')]=function(_0xd4ab59,_0x92e0b){return client['Request']('UpdateChatQueueReport',{'body':_0x92e0b,'options':{'where':{'uniqueid':_0xd4ab59},'order':[['id',_0x00ef('0x5')]],'limit':0x1},'log':_0x00ef('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 7c85b1f..bd6b468 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(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x7a54,0x106));var _0x47a5=function(_0x2f14c2,_0x3affa7){_0x2f14c2=_0x2f14c2-0x0;var _0x112a1d=_0x7a54[_0x2f14c2];return _0x112a1d;};'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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x7a54,0x106));var _0x47a5=function(_0x2dd3a0,_0x45701e){_0x2dd3a0=_0x2dd3a0-0x0;var _0x593d5b=_0x7a54[_0x2dd3a0];return _0x593d5b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 9ddc89f..a681b47 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 _0xac78=['createFaxMessage','create','Request'];(function(_0xe8d0d0,_0xcdc83a){var _0x41ea7b=function(_0x59d3d6){while(--_0x59d3d6){_0xe8d0d0['push'](_0xe8d0d0['shift']());}};_0x41ea7b(++_0xcdc83a);}(_0xac78,0x1cf));var _0x8ac7=function(_0x2f742b,_0x3ca4ad){_0x2f742b=_0x2f742b-0x0;var _0x4ffc39=_0xac78[_0x2f742b];return _0x4ffc39;};'use strict';var client=require('../client');exports[_0x8ac7('0x0')]=function(_0x1d971f){return client[_0x8ac7('0x1')]('CreateFaxMessage',{'body':_0x1d971f,'log':_0x8ac7('0x2')});}; \ No newline at end of file +var _0x22ef=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x22ef,0x1a6));var _0xf22e=function(_0x41030b,_0x1bd93a){_0x41030b=_0x41030b-0x0;var _0x4706b2=_0x22ef[_0x41030b];return _0x4706b2;};'use strict';var client=require(_0xf22e('0x0'));exports[_0xf22e('0x1')]=function(_0x3d3d92){return client[_0xf22e('0x2')](_0xf22e('0x3'),{'body':_0x3d3d92,'log':_0xf22e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index af83e0a..0ae0d0c 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 _0x1851=['../client','GetFaxQueue','name','User','Agents','online','faxPause','getFaxQueues'];(function(_0x822bf7,_0x48b81e){var _0x3bd97b=function(_0x439ba2){while(--_0x439ba2){_0x822bf7['push'](_0x822bf7['shift']());}};_0x3bd97b(++_0x48b81e);}(_0x1851,0x168));var _0x1185=function(_0x13534b,_0x25bc34){_0x13534b=_0x13534b-0x0;var _0x4131e7=_0x1851[_0x13534b];return _0x4131e7;};'use strict';var client=require(_0x1185('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x1185('0x1'),{'options':{'raw':![],'attributes':['id',_0x1185('0x2'),'timeout','strategy'],'include':[{'model':_0x1185('0x3'),'as':_0x1185('0x4'),'attributes':['id',_0x1185('0x2'),_0x1185('0x5'),_0x1185('0x6')]}]},'log':_0x1185('0x7')});};}; \ No newline at end of file +var _0x869c=['GetFaxQueue','name','timeout','faxPause','../client','getFaxQueues','Request'];(function(_0x2a6a4e,_0x3cca0d){var _0x1c8a82=function(_0x4be1d6){while(--_0x4be1d6){_0x2a6a4e['push'](_0x2a6a4e['shift']());}};_0x1c8a82(++_0x3cca0d);}(_0x869c,0x66));var _0xc869=function(_0x11579f,_0x26ab6b){_0x11579f=_0x11579f-0x0;var _0x56e613=_0x869c[_0x11579f];return _0x56e613;};'use strict';var client=require(_0xc869('0x0'));exports[_0xc869('0x1')]=function(){return function(){return client[_0xc869('0x2')](_0xc869('0x3'),{'options':{'raw':![],'attributes':['id',_0xc869('0x4'),_0xc869('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xc869('0x4'),'online',_0xc869('0x6')]}]},'log':_0xc869('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e357c91..e502f0c 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 _0xf665=['update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x242c98,_0x206af2){var _0x28b1bb=function(_0x491113){while(--_0x491113){_0x242c98['push'](_0x242c98['shift']());}};_0x28b1bb(++_0x206af2);}(_0xf665,0x15f));var _0x5f66=function(_0x1f9773,_0x4365fb){_0x1f9773=_0x1f9773-0x0;var _0x3fc947=_0xf665[_0x1f9773];return _0x3fc947;};'use strict';var client=require(_0x5f66('0x0'));exports[_0x5f66('0x1')]=function(_0x587d8){return client[_0x5f66('0x2')]('CreateFaxQueueReport',{'body':_0x587d8,'log':'CreateFaxQueueReport'});};exports[_0x5f66('0x3')]=function(_0x2bece2,_0x5e03bf){return client[_0x5f66('0x2')](_0x5f66('0x4'),{'body':_0x5e03bf,'options':{'where':{'uniqueid':_0x2bece2},'order':[['id',_0x5f66('0x5')]],'limit':0x1},'log':_0x5f66('0x4')});}; \ No newline at end of file +var _0xadd5=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x42bcba,_0x1f6e71){var _0x2b8da7=function(_0x58a792){while(--_0x58a792){_0x42bcba['push'](_0x42bcba['shift']());}};_0x2b8da7(++_0x1f6e71);}(_0xadd5,0x19f));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5add('0x0'));exports[_0x5add('0x1')]=function(_0x5cb135){return client[_0x5add('0x2')](_0x5add('0x3'),{'body':_0x5cb135,'log':_0x5add('0x3')});};exports[_0x5add('0x4')]=function(_0x5a8db1,_0x14b884){return client[_0x5add('0x2')](_0x5add('0x5'),{'body':_0x14b884,'options':{'where':{'uniqueid':_0x5a8db1},'order':[['id','DESC']],'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 d7ac805..3f8abe5 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 _0x5d27=['../client','GetInterval','name','Interval','interval','getIntervals'];(function(_0x1496c1,_0x23cf40){var _0x48abc0=function(_0x5337d6){while(--_0x5337d6){_0x1496c1['push'](_0x1496c1['shift']());}};_0x48abc0(++_0x23cf40);}(_0x5d27,0xf0));var _0x75d2=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0x5d27[_0x574d9b];return _0x31d2a5;};'use strict';var client=require(_0x75d2('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0x75d2('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x75d2('0x2')],'include':[{'model':_0x75d2('0x3'),'as':'Intervals','attributes':['id',_0x75d2('0x2'),_0x75d2('0x4')]}]},'log':_0x75d2('0x5')});};}; \ No newline at end of file +var _0xfc5c=['GetInterval','Interval','Intervals','name','getIntervals'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xfc5c,0x10d));var _0xcfc5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfc5c[_0x465a0c];return _0x1e202e;};'use strict';var client=require('../client');exports[_0xcfc5('0x0')]=function(){return function(){return client['Request'](_0xcfc5('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xcfc5('0x2'),'as':_0xcfc5('0x3'),'attributes':['id',_0xcfc5('0x4'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 19ae04e..22bcb81 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 _0xfb11=['UpdateMailInteraction','addTags','Request','addTagsToChatInteraction','../client'];(function(_0x314488,_0x60c674){var _0x5188d1=function(_0x3f182b){while(--_0x3f182b){_0x314488['push'](_0x314488['shift']());}};_0x5188d1(++_0x60c674);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xfb11[_0x3ff085];return _0x2b68c3;};'use strict';var client=require(_0x1fb1('0x0'));exports['update']=function(_0x3418a7,_0x34e2d6){return client['Request'](_0x1fb1('0x1'),{'body':_0x34e2d6,'options':{'where':{'id':_0x3418a7}},'log':'updateMailInteraction'});};exports[_0x1fb1('0x2')]=function(_0x5a830e,_0x190f74){return client[_0x1fb1('0x3')]('AddTagsToMailInteraction',{'body':_0x190f74,'options':{'where':{'id':_0x5a830e}},'log':_0x1fb1('0x4')});}; \ No newline at end of file +var _0x4cf8=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update'];(function(_0x489358,_0x38dbdd){var _0x4e4b56=function(_0x4a0722){while(--_0x4a0722){_0x489358['push'](_0x489358['shift']());}};_0x4e4b56(++_0x38dbdd);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0x4cf8[_0x287059];return _0x225c79;};'use strict';var client=require(_0x84cf('0x0'));exports[_0x84cf('0x1')]=function(_0x287eb2,_0x2125ed){return client[_0x84cf('0x2')](_0x84cf('0x3'),{'body':_0x2125ed,'options':{'where':{'id':_0x287eb2}},'log':_0x84cf('0x4')});};exports[_0x84cf('0x5')]=function(_0x3bbbc3,_0x2d38c0){return client[_0x84cf('0x2')](_0x84cf('0x6'),{'body':_0x2d38c0,'options':{'where':{'id':_0x3bbbc3}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 31e2d45..37843a4 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 _0xc1fa=['../client','create','Request','createMailMessage'];(function(_0x33d4dd,_0xab8529){var _0x44d328=function(_0x3aec51){while(--_0x3aec51){_0x33d4dd['push'](_0x33d4dd['shift']());}};_0x44d328(++_0xab8529);}(_0xc1fa,0x70));var _0xac1f=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xc1fa[_0x2fdf82];return _0x2382f5;};'use strict';var client=require(_0xac1f('0x0'));exports[_0xac1f('0x1')]=function(_0x5bb517){return client[_0xac1f('0x2')]('CreateMailMessage',{'body':_0x5bb517,'log':_0xac1f('0x3')});}; \ No newline at end of file +var _0x51e4=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x27e811,_0x1fad22){var _0x1bfe61=function(_0x2d8d02){while(--_0x2d8d02){_0x27e811['push'](_0x27e811['shift']());}};_0x1bfe61(++_0x1fad22);}(_0x51e4,0xc2));var _0x451e=function(_0x5cf4a4,_0xbb03a1){_0x5cf4a4=_0x5cf4a4-0x0;var _0x3dcc02=_0x51e4[_0x5cf4a4];return _0x3dcc02;};'use strict';var client=require(_0x451e('0x0'));exports[_0x451e('0x1')]=function(_0x3817f6){return client[_0x451e('0x2')](_0x451e('0x3'),{'body':_0x3817f6,'log':_0x451e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 667aa08..a1e7285 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 _0x8b52=['name','timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0x72e8fb,_0x43c4aa){var _0x42919f=function(_0x4f5e7c){while(--_0x4f5e7c){_0x72e8fb['push'](_0x72e8fb['shift']());}};_0x42919f(++_0x43c4aa);}(_0x8b52,0xee));var _0x28b5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8b52[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x28b5('0x0'));exports[_0x28b5('0x1')]=function(){return function(){return client[_0x28b5('0x2')](_0x28b5('0x3'),{'options':{'raw':![],'attributes':['id',_0x28b5('0x4'),_0x28b5('0x5'),_0x28b5('0x6')],'include':[{'model':_0x28b5('0x7'),'as':_0x28b5('0x8'),'attributes':['id','name',_0x28b5('0x9'),_0x28b5('0xa')]}]},'log':_0x28b5('0x1')});};}; \ No newline at end of file +var _0x1df0=['strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x54a2df,_0x376f96){var _0x42e322=function(_0x12c3cf){while(--_0x12c3cf){_0x54a2df['push'](_0x54a2df['shift']());}};_0x42e322(++_0x376f96);}(_0x1df0,0x19c));var _0x01df=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1df0[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x01df('0x0'));exports[_0x01df('0x1')]=function(){return function(){return client[_0x01df('0x2')](_0x01df('0x3'),{'options':{'raw':![],'attributes':['id',_0x01df('0x4'),_0x01df('0x5'),_0x01df('0x6')],'include':[{'model':_0x01df('0x7'),'as':_0x01df('0x8'),'attributes':['id',_0x01df('0x4'),_0x01df('0x9'),_0x01df('0xa')]}]},'log':_0x01df('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7d7b81c..a09e227 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 _0x5852=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport','update','DESC'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0x5852,0xbb));var _0x2585=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5852[_0x173441];return _0x2423a8;};'use strict';var client=require(_0x2585('0x0'));exports['create']=function(_0x2260aa){return client[_0x2585('0x1')](_0x2585('0x2'),{'body':_0x2260aa,'log':_0x2585('0x2')});};exports[_0x2585('0x3')]=function(_0x1ff073,_0x7dcf7){return client[_0x2585('0x1')]('UpdateMailQueueReport',{'body':_0x7dcf7,'options':{'where':{'uniqueid':_0x1ff073},'order':[['id',_0x2585('0x4')]],'limit':0x1},'log':_0x2585('0x5')});}; \ No newline at end of file +var _0x3d88=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client','create'];(function(_0x5935d9,_0x42fff7){var _0x247e32=function(_0xbc97c){while(--_0xbc97c){_0x5935d9['push'](_0x5935d9['shift']());}};_0x247e32(++_0x42fff7);}(_0x3d88,0x142));var _0x83d8=function(_0x3dfc20,_0x82a51f){_0x3dfc20=_0x3dfc20-0x0;var _0x2ef297=_0x3d88[_0x3dfc20];return _0x2ef297;};'use strict';var client=require(_0x83d8('0x0'));exports[_0x83d8('0x1')]=function(_0x5e3359){return client[_0x83d8('0x2')](_0x83d8('0x3'),{'body':_0x5e3359,'log':'CreateMailQueueReport'});};exports[_0x83d8('0x4')]=function(_0x2474d7,_0x508807){return client[_0x83d8('0x2')](_0x83d8('0x5'),{'body':_0x508807,'options':{'where':{'uniqueid':_0x2474d7},'order':[['id','DESC']],'limit':0x1},'log':_0x83d8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1304b72..95deb17 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 _0x5405=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction'];(function(_0x308408,_0x37d440){var _0x9dc073=function(_0x29f0c9){while(--_0x29f0c9){_0x308408['push'](_0x308408['shift']());}};_0x9dc073(++_0x37d440);}(_0x5405,0x1cd));var _0x5540=function(_0x25f793,_0x534fc3){_0x25f793=_0x25f793-0x0;var _0x4421de=_0x5405[_0x25f793];return _0x4421de;};'use strict';var client=require(_0x5540('0x0'));exports[_0x5540('0x1')]=function(_0x3f5e96,_0x42568a){return client['Request'](_0x5540('0x2'),{'body':_0x42568a,'options':{'where':{'id':_0x3f5e96}},'log':_0x5540('0x3')});};exports[_0x5540('0x4')]=function(_0xb9e5f6,_0x5999d4){return client[_0x5540('0x5')](_0x5540('0x6'),{'body':_0x5999d4,'options':{'where':{'id':_0xb9e5f6}},'log':_0x5540('0x7')});}; \ No newline at end of file +var _0x1a7c=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','update'];(function(_0x1c323c,_0x116b58){var _0x40a6f9=function(_0x11947f){while(--_0x11947f){_0x1c323c['push'](_0x1c323c['shift']());}};_0x40a6f9(++_0x116b58);}(_0x1a7c,0xa1));var _0xc1a7=function(_0x35289d,_0x230ce7){_0x35289d=_0x35289d-0x0;var _0x2dec71=_0x1a7c[_0x35289d];return _0x2dec71;};'use strict';var client=require('../client');exports[_0xc1a7('0x0')]=function(_0x2eb088,_0x2d068d){return client[_0xc1a7('0x1')](_0xc1a7('0x2'),{'body':_0x2d068d,'options':{'where':{'id':_0x2eb088}},'log':_0xc1a7('0x3')});};exports[_0xc1a7('0x4')]=function(_0x4d870b,_0x1a5f57){return client[_0xc1a7('0x1')](_0xc1a7('0x5'),{'body':_0x1a5f57,'options':{'where':{'id':_0x4d870b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 30e3a31..6f6315f 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 _0x11ce=['createOpenchannelMessage','../client','CreateOpenchannelMessage'];(function(_0x3b0578,_0x307731){var _0x5a7546=function(_0x2a330c){while(--_0x2a330c){_0x3b0578['push'](_0x3b0578['shift']());}};_0x5a7546(++_0x307731);}(_0x11ce,0x148));var _0xe11c=function(_0x3a5b1d,_0x206a8c){_0x3a5b1d=_0x3a5b1d-0x0;var _0x36d9ed=_0x11ce[_0x3a5b1d];return _0x36d9ed;};'use strict';var client=require(_0xe11c('0x0'));exports['create']=function(_0x2b4a58){return client['Request'](_0xe11c('0x1'),{'body':_0x2b4a58,'log':_0xe11c('0x2')});}; \ No newline at end of file +var _0x7c08=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x98c584,_0x15f015){var _0x4e45c0=function(_0x304831){while(--_0x304831){_0x98c584['push'](_0x98c584['shift']());}};_0x4e45c0(++_0x15f015);}(_0x7c08,0xb1));var _0x87c0=function(_0x409247,_0x36d78a){_0x409247=_0x409247-0x0;var _0x3b1340=_0x7c08[_0x409247];return _0x3b1340;};'use strict';var client=require(_0x87c0('0x0'));exports[_0x87c0('0x1')]=function(_0x5a8706){return client[_0x87c0('0x2')](_0x87c0('0x3'),{'body':_0x5a8706,'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 07ea84c..aaff310 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 _0x847d=['online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','User','Agents'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x847d,0x14a));var _0xd847=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x847d[_0x77d310];return _0x2cdce4;};'use strict';var client=require('../client');exports[_0xd847('0x0')]=function(){return function(){return client[_0xd847('0x1')](_0xd847('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd847('0x3'),'strategy'],'include':[{'model':_0xd847('0x4'),'as':_0xd847('0x5'),'attributes':['id','name',_0xd847('0x6'),_0xd847('0x7')]}]},'log':_0xd847('0x0')});};}; \ No newline at end of file +var _0xbd45=['name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0xe71c66,_0x325fdc){var _0x280b8b=function(_0x59d9c5){while(--_0x59d9c5){_0xe71c66['push'](_0xe71c66['shift']());}};_0x280b8b(++_0x325fdc);}(_0xbd45,0xf6));var _0x5bd4=function(_0x24711a,_0x4cb71f){_0x24711a=_0x24711a-0x0;var _0x1a47ec=_0xbd45[_0x24711a];return _0x1a47ec;};'use strict';var client=require(_0x5bd4('0x0'));exports[_0x5bd4('0x1')]=function(){return function(){return client[_0x5bd4('0x2')](_0x5bd4('0x3'),{'options':{'raw':![],'attributes':['id',_0x5bd4('0x4'),_0x5bd4('0x5'),_0x5bd4('0x6')],'include':[{'model':_0x5bd4('0x7'),'as':_0x5bd4('0x8'),'attributes':['id',_0x5bd4('0x4'),'online',_0x5bd4('0x9')]}]},'log':_0x5bd4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2102c4c..d23ef80 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 _0x6a40=['update','UpdateOpenchannelQueueReport','DESC','../client','Request','CreateOpenchannelQueueReport'];(function(_0x475fe2,_0x505f67){var _0x2d813f=function(_0x3b5e86){while(--_0x3b5e86){_0x475fe2['push'](_0x475fe2['shift']());}};_0x2d813f(++_0x505f67);}(_0x6a40,0x1a7));var _0x06a4=function(_0x4aa28a,_0x59c9af){_0x4aa28a=_0x4aa28a-0x0;var _0x547335=_0x6a40[_0x4aa28a];return _0x547335;};'use strict';var client=require(_0x06a4('0x0'));exports['create']=function(_0x331623){return client[_0x06a4('0x1')](_0x06a4('0x2'),{'body':_0x331623,'log':'CreateOpenchannelQueueReport'});};exports[_0x06a4('0x3')]=function(_0x5d2065,_0x16ee4b){return client[_0x06a4('0x1')](_0x06a4('0x4'),{'body':_0x16ee4b,'options':{'where':{'uniqueid':_0x5d2065},'order':[['id',_0x06a4('0x5')]],'limit':0x1},'log':_0x06a4('0x4')});}; \ No newline at end of file +var _0x9d3f=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','create','Request'];(function(_0xdf2038,_0x242be5){var _0x2f4a0d=function(_0x18e322){while(--_0x18e322){_0xdf2038['push'](_0xdf2038['shift']());}};_0x2f4a0d(++_0x242be5);}(_0x9d3f,0x18e));var _0xf9d3=function(_0x46be86,_0x491f52){_0x46be86=_0x46be86-0x0;var _0x2962c8=_0x9d3f[_0x46be86];return _0x2962c8;};'use strict';var client=require('../client');exports[_0xf9d3('0x0')]=function(_0x594ce1){return client[_0xf9d3('0x1')](_0xf9d3('0x2'),{'body':_0x594ce1,'log':_0xf9d3('0x2')});};exports['update']=function(_0x5b3818,_0x2a29c6){return client[_0xf9d3('0x1')](_0xf9d3('0x3'),{'body':_0x2a29c6,'options':{'where':{'uniqueid':_0x5b3818},'order':[['id','DESC']],'limit':0x1},'log':_0xf9d3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 673d79e..7394d97 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 _0xf23b=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x2bd012,_0x9a9005){var _0x63f120=function(_0x54561d){while(--_0x54561d){_0x2bd012['push'](_0x2bd012['shift']());}};_0x63f120(++_0x9a9005);}(_0xf23b,0x133));var _0xbf23=function(_0x26bba0,_0x9d2602){_0x26bba0=_0x26bba0-0x0;var _0x1763c1=_0xf23b[_0x26bba0];return _0x1763c1;};'use strict';var client=require(_0xbf23('0x0'));exports[_0xbf23('0x1')]=function(_0x18dde4,_0x1c8f27){return client[_0xbf23('0x2')]('UpdateSmsInteraction',{'body':_0x1c8f27,'options':{'where':{'id':_0x18dde4}},'log':_0xbf23('0x3')});};exports[_0xbf23('0x4')]=function(_0x14ff3b,_0x5ecbf5){return client[_0xbf23('0x2')](_0xbf23('0x5'),{'body':_0x5ecbf5,'options':{'where':{'id':_0x14ff3b}},'log':_0xbf23('0x6')});}; \ No newline at end of file +var _0xceae=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','Request'];(function(_0x525a94,_0x5ed4da){var _0x589d42=function(_0x4cfb03){while(--_0x4cfb03){_0x525a94['push'](_0x525a94['shift']());}};_0x589d42(++_0x5ed4da);}(_0xceae,0x122));var _0xecea=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0xceae[_0x35f15b];return _0x262619;};'use strict';var client=require(_0xecea('0x0'));exports[_0xecea('0x1')]=function(_0x49d585,_0x5533c7){return client['Request'](_0xecea('0x2'),{'body':_0x5533c7,'options':{'where':{'id':_0x49d585}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x28b2cf,_0x457d37){return client[_0xecea('0x3')](_0xecea('0x4'),{'body':_0x457d37,'options':{'where':{'id':_0x28b2cf}},'log':_0xecea('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 18e4c3c..3472d03 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 _0x7660=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x33e1f9,_0x23c125){var _0x513c98=function(_0x412400){while(--_0x412400){_0x33e1f9['push'](_0x33e1f9['shift']());}};_0x513c98(++_0x23c125);}(_0x7660,0x187));var _0x0766=function(_0x91cc04,_0x48e6a6){_0x91cc04=_0x91cc04-0x0;var _0x26b085=_0x7660[_0x91cc04];return _0x26b085;};'use strict';var client=require(_0x0766('0x0'));exports[_0x0766('0x1')]=function(_0x5cca1e){return client[_0x0766('0x2')](_0x0766('0x3'),{'body':_0x5cca1e,'log':_0x0766('0x4')});}; \ No newline at end of file +var _0x06fc=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x554cc3,_0x20bb6e){var _0x26fa3d=function(_0x433c27){while(--_0x433c27){_0x554cc3['push'](_0x554cc3['shift']());}};_0x26fa3d(++_0x20bb6e);}(_0x06fc,0x1f1));var _0xc06f=function(_0x550186,_0x27a8f5){_0x550186=_0x550186-0x0;var _0x2c5a5e=_0x06fc[_0x550186];return _0x2c5a5e;};'use strict';var client=require(_0xc06f('0x0'));exports[_0xc06f('0x1')]=function(_0x3ffa10){return client[_0xc06f('0x2')](_0xc06f('0x3'),{'body':_0x3ffa10,'log':_0xc06f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index e55c521..871b878 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x263cfa,_0x443531){var _0x14b8ec=function(_0x4fe59a){while(--_0x4fe59a){_0x263cfa['push'](_0x263cfa['shift']());}};_0x14b8ec(++_0x443531);}(_0x70e0,0x17b));var _0x070e=function(_0x47a3c7,_0x1bdabd){_0x47a3c7=_0x47a3c7-0x0;var _0x3f6e22=_0x70e0[_0x47a3c7];return _0x3f6e22;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x38a8ad,_0x381d7e){var _0x434122=function(_0xc1ed36){while(--_0xc1ed36){_0x38a8ad['push'](_0x38a8ad['shift']());}};_0x434122(++_0x381d7e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 654ce3e..9a7e6ff 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x535e73,_0x1b38e6){var _0x583f6d=function(_0x31d6a3){while(--_0x31d6a3){_0x535e73['push'](_0x535e73['shift']());}};_0x583f6d(++_0x1b38e6);}(_0x70e0,0x17b));var _0x070e=function(_0x1af8e5,_0x3f8ca6){_0x1af8e5=_0x1af8e5-0x0;var _0x22a7a1=_0x70e0[_0x1af8e5];return _0x22a7a1;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x22193e,_0x2ae001){var _0x10c378=function(_0x411e3f){while(--_0x411e3f){_0x22193e['push'](_0x22193e['shift']());}};_0x10c378(++_0x2ae001);}(_0x008c,0x188));var _0xc008=function(_0x1238e0,_0x16bd9b){_0x1238e0=_0x1238e0-0x0;var _0x59dfc8=_0x008c[_0x1238e0];return _0x59dfc8;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1102d50..b5c95de 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(_0x4954c0,_0x3e8838){var _0x27a38f=function(_0x278f1f){while(--_0x278f1f){_0x4954c0['push'](_0x4954c0['shift']());}};_0x27a38f(++_0x3e8838);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x54bd66,_0x361ba1){var _0x3ff510=function(_0x18c95e){while(--_0x18c95e){_0x54bd66['push'](_0x54bd66['shift']());}};_0x3ff510(++_0x361ba1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 c33e050..28b20e0 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 _0xb091=['updateWhatsappInteraction','addTagsToWhatsappInteraction','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb091,0x16e));var _0x1b09=function(_0x323ac7,_0x4358bf){_0x323ac7=_0x323ac7-0x0;var _0x277226=_0xb091[_0x323ac7];return _0x277226;};'use strict';var client=require('../client');exports[_0x1b09('0x0')]=function(_0x12cc7c,_0x3cfda4){return client[_0x1b09('0x1')]('UpdateWhatsappInteraction',{'body':_0x3cfda4,'options':{'where':{'id':_0x12cc7c}},'log':_0x1b09('0x2')});};exports['addTags']=function(_0x5aa3b0,_0x295863){return client[_0x1b09('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x295863,'options':{'where':{'id':_0x5aa3b0}},'log':_0x1b09('0x3')});}; \ No newline at end of file +var _0xe2bc=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0xa48e4f,_0x442ba4){var _0x483abf=function(_0x241512){while(--_0x241512){_0xa48e4f['push'](_0xa48e4f['shift']());}};_0x483abf(++_0x442ba4);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xe2bc[_0x432fca];return _0x3adba4;};'use strict';var client=require(_0xce2b('0x0'));exports['update']=function(_0x15775c,_0x47cd82){return client[_0xce2b('0x1')](_0xce2b('0x2'),{'body':_0x47cd82,'options':{'where':{'id':_0x15775c}},'log':_0xce2b('0x3')});};exports[_0xce2b('0x4')]=function(_0x3f7887,_0x5af322){return client[_0xce2b('0x1')](_0xce2b('0x5'),{'body':_0x5af322,'options':{'where':{'id':_0x3f7887}},'log':_0xce2b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 8177f55..b6df1db 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 _0x2e08=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x59b907,_0x33de40){var _0x13fab4=function(_0x25f629){while(--_0x25f629){_0x59b907['push'](_0x59b907['shift']());}};_0x13fab4(++_0x33de40);}(_0x2e08,0x17e));var _0x82e0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2e08[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x82e0('0x0'));exports[_0x82e0('0x1')]=function(_0x3d7f88){return client['Request'](_0x82e0('0x2'),{'body':_0x3d7f88,'log':_0x82e0('0x3')});}; \ No newline at end of file +var _0xfbdf=['create','createWhatsappMessage','../client'];(function(_0x34f44c,_0x4baeea){var _0x4c0d7c=function(_0x5ecd89){while(--_0x5ecd89){_0x34f44c['push'](_0x34f44c['shift']());}};_0x4c0d7c(++_0x4baeea);}(_0xfbdf,0x188));var _0xffbd=function(_0x2df2c4,_0x3b183b){_0x2df2c4=_0x2df2c4-0x0;var _0x3244d3=_0xfbdf[_0x2df2c4];return _0x3244d3;};'use strict';var client=require(_0xffbd('0x0'));exports[_0xffbd('0x1')]=function(_0x592149){return client['Request']('CreateWhatsappMessage',{'body':_0x592149,'log':_0xffbd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 9f5a2ec..94892fe 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 _0x5e10=['Agents','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0xb8dbd6,_0x236e97){var _0x52d8fc=function(_0x406314){while(--_0x406314){_0xb8dbd6['push'](_0xb8dbd6['shift']());}};_0x52d8fc(++_0x236e97);}(_0x5e10,0x1e1));var _0x05e1=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x5e10[_0x39872b];return _0x55fa18;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x05e1('0x0')](_0x05e1('0x1'),{'options':{'raw':![],'attributes':['id',_0x05e1('0x2'),_0x05e1('0x3'),_0x05e1('0x4')],'include':[{'model':'User','as':_0x05e1('0x5'),'attributes':['id',_0x05e1('0x2'),_0x05e1('0x6'),_0x05e1('0x7')]}]},'log':_0x05e1('0x8')});};}; \ No newline at end of file +var _0xd77a=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x221085,_0x5dbc19){var _0x29e0bd=function(_0x520b6a){while(--_0x520b6a){_0x221085['push'](_0x221085['shift']());}};_0x29e0bd(++_0x5dbc19);}(_0xd77a,0xeb));var _0xad77=function(_0x53af73,_0x16a217){_0x53af73=_0x53af73-0x0;var _0x14749a=_0xd77a[_0x53af73];return _0x14749a;};'use strict';var client=require(_0xad77('0x0'));exports[_0xad77('0x1')]=function(){return function(){return client[_0xad77('0x2')](_0xad77('0x3'),{'options':{'raw':![],'attributes':['id',_0xad77('0x4'),_0xad77('0x5'),_0xad77('0x6')],'include':[{'model':_0xad77('0x7'),'as':_0xad77('0x8'),'attributes':['id',_0xad77('0x4'),_0xad77('0x9'),_0xad77('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 5f33971..9d58639 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 _0x1c18=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1c18,0x12f));var _0x81c1=function(_0x948065,_0x402299){_0x948065=_0x948065-0x0;var _0x8bacf4=_0x1c18[_0x948065];return _0x8bacf4;};'use strict';var client=require(_0x81c1('0x0'));exports[_0x81c1('0x1')]=function(_0x35dcd8){return client[_0x81c1('0x2')](_0x81c1('0x3'),{'body':_0x35dcd8,'log':_0x81c1('0x3')});};exports[_0x81c1('0x4')]=function(_0x46798b,_0x38d1f1){return client['Request'](_0x81c1('0x5'),{'body':_0x38d1f1,'options':{'where':{'uniqueid':_0x46798b},'order':[['id','DESC']],'limit':0x1},'log':_0x81c1('0x5')});}; \ No newline at end of file +var _0x5155=['Request','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x5155,0x125));var _0x5515=function(_0x3a112c,_0x2830c7){_0x3a112c=_0x3a112c-0x0;var _0x24e770=_0x5155[_0x3a112c];return _0x24e770;};'use strict';var client=require(_0x5515('0x0'));exports[_0x5515('0x1')]=function(_0x2251d9){return client[_0x5515('0x2')]('CreateWhatsappQueueReport',{'body':_0x2251d9,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x5eda08,_0x1a0bc9){return client[_0x5515('0x2')](_0x5515('0x3'),{'body':_0x1a0bc9,'options':{'where':{'uniqueid':_0x5eda08},'order':[['id',_0x5515('0x4')]],'limit':0x1},'log':_0x5515('0x3')});}; \ 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 46e8059..f876dc7 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 _0x7610=['join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','[%s][AGENT]\x20%s','message'];(function(_0x5f13ca,_0x1f1de9){var _0x117f66=function(_0x399066){while(--_0x399066){_0x5f13ca['push'](_0x5f13ca['shift']());}};_0x117f66(++_0x1f1de9);}(_0x7610,0x123));var _0x0761=function(_0xb1ff6e,_0x3b2369){_0xb1ff6e=_0xb1ff6e-0x0;var _0x2cec30=_0x7610[_0xb1ff6e];return _0x2cec30;};'use strict';var schema=require(_0x0761('0x0'));var _=require(_0x0761('0x1'));var util=require(_0x0761('0x2'));var seqqueue=require(_0x0761('0x3'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x0761('0x4'));var queue=schema({'name':{'type':_0x0761('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0761('0x6'),'message':_0x0761('0x7')}});function writeLog(_0x5b690d,_0x30022e,_0x4788e4){return logger[_0x0761('0x8')](util[_0x0761('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5b690d,_0x30022e[_0x0761('0xa')],_0x4788e4));}function handleFindAgent(_0x3ce957){return function(_0x2e769f){return _0x2e769f['name'][_0x0761('0xb')]()===_0x3ce957['toLowerCase']();};}exports['consequence']=function(_0x19b98c,_0x14f021,_0x4fd8ed,_0x3951a1){return function(_0x5ed188){try{var _0x2b2d34={'name':_0x14f021[0x0],'timeout':_0x14f021[0x1]};var _0x32f80a=queue[_0x0761('0x0')](_0x2b2d34,{'typecast':!![]});if(_0x32f80a[_0x0761('0xc')]){logger['error'](_0x0761('0xd'),_0x19b98c,_['map'](_0x32f80a,_0x0761('0xe'))[_0x0761('0xf')](',\x20'));_0x5ed188[_0x0761('0x10')]();}else{var _0x24cd2a=_[_0x0761('0x11')](_0x4fd8ed[_0x0761('0x12')],handleFindAgent(_0x2b2d34['name']));if(_0x24cd2a){var _0x593c88=(_0x2b2d34[_0x0761('0x13')]||0xa)*0x3e8;var _0x335bba,_0x48c228;var _0x1498a2=seqqueue[_0x0761('0x14')](_0x593c88);_0x1498a2['id']=_0x19b98c;_0x1498a2[_0x0761('0x15')]=_0x593c88;_0x1498a2[_0x0761('0x16')]=_0x3951a1[_0x0761('0x16')];writeLog(_0x19b98c,_0x24cd2a,util[_0x0761('0x9')](_0x0761('0x17'),_0x593c88));_0x4fd8ed[_0x0761('0x18')][_0x19b98c]['on'](_0x0761('0x19'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x19b98c);clearTimeout(_0x48c228);_0x48c228=undefined;_0x1498a2[_0x0761('0x1a')]();if(_0x4fd8ed[_0x0761('0x18')][_0x19b98c]){delete _0x4fd8ed[_0x0761('0x18')][_0x19b98c];}_0x5ed188[_0x0761('0x10')]();});_0x4fd8ed[_0x0761('0x18')][_0x19b98c]['on'](_0x0761('0x1b'),function(){if(_0x4fd8ed[_0x0761('0x18')][_0x19b98c]){delete _0x4fd8ed['rules'][_0x19b98c];}});_0x48c228=setTimeout(function(){logger['info'](_0x0761('0x1c'),_0x19b98c);clearTimeout(_0x48c228);_0x1498a2[_0x0761('0x1a')]();_0x5ed188['next']();},_0x593c88);strategy['agent'](_0x1498a2,_0x24cd2a,_0x4fd8ed,_0x3951a1);}else{logger['error'](_0x0761('0x1d'),_0x19b98c,_0x2b2d34[_0x0761('0xa')]);_0x5ed188[_0x0761('0x10')]();}}}catch(_0x30b9b2){console[_0x0761('0x1e')](_0x30b9b2);logger[_0x0761('0x1f')](_0x0761('0x20'),_0x19b98c,_0x30b9b2[_0x0761('0x21')]);_0x5ed188[_0x0761('0x10')]();}};}; \ No newline at end of file +var _0xab14=['atimeout','channel','START:%s','rules','end','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','error','[%s][AGENT]\x20%s','join','stop','agents','timeout','createQueue'];(function(_0x4fdc74,_0x3186d0){var _0x516645=function(_0xa11c9b){while(--_0xa11c9b){_0x4fdc74['push'](_0x4fdc74['shift']());}};_0x516645(++_0x3186d0);}(_0xab14,0x16b));var _0x4ab1=function(_0x5eb62d,_0x47cdc9){_0x5eb62d=_0x5eb62d-0x0;var _0x4ef958=_0xab14[_0x5eb62d];return _0x4ef958;};'use strict';var schema=require(_0x4ab1('0x0'));var _=require(_0x4ab1('0x1'));var util=require(_0x4ab1('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x4ab1('0x3'))(_0x4ab1('0x4'));var strategy=require(_0x4ab1('0x5'));var queue=schema({'name':{'type':_0x4ab1('0x6'),'required':!![],'message':_0x4ab1('0x7')},'timeout':{'type':'number','message':_0x4ab1('0x8')}});function writeLog(_0x3acd91,_0x2a0d07,_0x5d986e){return logger[_0x4ab1('0x9')](util[_0x4ab1('0xa')](_0x4ab1('0xb'),_0x3acd91,_0x2a0d07[_0x4ab1('0xc')],_0x5d986e));}function handleFindAgent(_0x345775){return function(_0xebf253){return _0xebf253[_0x4ab1('0xc')]['toLowerCase']()===_0x345775['toLowerCase']();};}exports[_0x4ab1('0xd')]=function(_0x386fa9,_0xeba40,_0x17d873,_0x5f13bb){return function(_0x5ec8cf){try{var _0x78fbcf={'name':_0xeba40[0x0],'timeout':_0xeba40[0x1]};var _0x41ad2d=queue[_0x4ab1('0x0')](_0x78fbcf,{'typecast':!![]});if(_0x41ad2d['length']){logger[_0x4ab1('0xe')](_0x4ab1('0xf'),_0x386fa9,_['map'](_0x41ad2d,'message')[_0x4ab1('0x10')](',\x20'));_0x5ec8cf[_0x4ab1('0x11')]();}else{var _0xdcf3b4=_['find'](_0x17d873[_0x4ab1('0x12')],handleFindAgent(_0x78fbcf[_0x4ab1('0xc')]));if(_0xdcf3b4){var _0x10a708=(_0x78fbcf[_0x4ab1('0x13')]||0xa)*0x3e8;var _0x832b70,_0x3aa8d9;var _0x38b4c9=seqqueue[_0x4ab1('0x14')](_0x10a708);_0x38b4c9['id']=_0x386fa9;_0x38b4c9[_0x4ab1('0x15')]=_0x10a708;_0x38b4c9['channel']=_0x5f13bb[_0x4ab1('0x16')];writeLog(_0x386fa9,_0xdcf3b4,util[_0x4ab1('0xa')](_0x4ab1('0x17'),_0x10a708));_0x17d873[_0x4ab1('0x18')][_0x386fa9]['on'](_0x4ab1('0x19'),function(){logger[_0x4ab1('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x386fa9);clearTimeout(_0x3aa8d9);_0x3aa8d9=undefined;_0x38b4c9[_0x4ab1('0x1a')]();if(_0x17d873[_0x4ab1('0x18')][_0x386fa9]){delete _0x17d873[_0x4ab1('0x18')][_0x386fa9];}_0x5ec8cf[_0x4ab1('0x11')]();});_0x17d873[_0x4ab1('0x18')][_0x386fa9]['on']('complete',function(){if(_0x17d873[_0x4ab1('0x18')][_0x386fa9]){delete _0x17d873[_0x4ab1('0x18')][_0x386fa9];}});_0x3aa8d9=setTimeout(function(){logger[_0x4ab1('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x386fa9);clearTimeout(_0x3aa8d9);_0x38b4c9['close']();_0x5ec8cf[_0x4ab1('0x1b')]();},_0x10a708);strategy[_0x4ab1('0x1c')](_0x38b4c9,_0xdcf3b4,_0x17d873,_0x5f13bb);}else{logger['error'](_0x4ab1('0x1d'),_0x386fa9,_0x78fbcf[_0x4ab1('0xc')]);_0x5ec8cf['stop']();}}}catch(_0xe6bf8d){console['log'](_0xe6bf8d);logger[_0x4ab1('0xe')](_0x4ab1('0x1e'),_0x386fa9,_0xe6bf8d[_0x4ab1('0x1f')]);_0x5ec8cf[_0x4ab1('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 96ea208..143f35f 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 _0x3d74=['../../rpc/faxMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','error','message','next','amazonlex','providerName','providerResponse','dialogState','catch','moment','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3d74,0x14a));var _0x43d7=function(_0x330daa,_0x1abd0e){_0x330daa=_0x330daa-0x0;var _0x215d70=_0x3d74[_0x330daa];return _0x215d70;};'use strict';var _=require('lodash');var moment=require(_0x43d7('0x0'));var AWS=require(_0x43d7('0x1'));var utils=require('./utils');var logger=require(_0x43d7('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x43d7('0x3')),'mailMessage':require(_0x43d7('0x4')),'smsMessage':require(_0x43d7('0x5')),'faxMessage':require(_0x43d7('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x43d7('0x7')]=function(_0x29a58f,_0xb1531c){return function(_0x286ae8){try{if(!_['isNil'](this[_0x43d7('0x8')][_0x43d7('0x9')])){logger[_0x43d7('0xa')]('[%s][AMAZONLEX]\x20%s',_0x29a58f,_0x43d7('0xb'));return _0x286ae8['next']();}var _0x4459ed={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x43d7('0xc')};if(this[_0x43d7('0xd')]==='sms'||this['channel']==='whatsapp'){_0x4459ed[_0x43d7('0xe')]=this[_0x43d7('0x8')][_0x43d7('0xe')];}var _0x360976=this[_0x43d7('0xd')];if(_0x360976===_0x43d7('0xf')){_0x4459ed[_0x43d7('0x10')]=this[_0x43d7('0x11')]['id'];}else{_0x4459ed[_[_0x43d7('0x12')](_0x360976)+_0x43d7('0x13')]=this[_0x43d7('0x11')]['id'];}_0x4459ed[_['upperFirst'](_0x360976)+'InteractionId']=this[_0x43d7('0x8')]['id'];if(this[_0x43d7('0x8')][_0x43d7('0x14')]){var _0xd670ff=_0xb1531c[0x4];if(!_[_0x43d7('0x15')](_0xd670ff)){_0x4459ed[_0x43d7('0x16')]=utils['getMustacheRender'](_0xd670ff,this);return rpc[_0x360976+_0x43d7('0x17')][_0x43d7('0x18')](_0x4459ed)[_0x43d7('0x19')](function(_0x203c12){logger[_0x43d7('0xa')](_0x43d7('0x1a'),_0x29a58f,_0x4459ed[_0x43d7('0x16')]);})['catch'](function(_0x2880e8){logger['error'](_0x43d7('0x1a'),_0x29a58f,JSON['stringify'](_0x2880e8));})[_0x43d7('0x1b')](function(){logger[_0x43d7('0xa')](_0x43d7('0x1c'),_0x29a58f);_0x286ae8[_0x43d7('0x1d')]();});}else{logger[_0x43d7('0xa')](_0x43d7('0x1e'),_0x29a58f);_0x286ae8['stop']();}}else{var _0x504b10=this;var _0xae8723=new AWS[(_0x43d7('0x1f'))]({'accessKeyId':_0xb1531c[0x0],'secretAccessKey':_0xb1531c[0x1],'region':_0xb1531c[0x2]});var _0x3c87ad={'botAlias':_0x43d7('0x20'),'botName':_0xb1531c[0x3],'inputText':this['message'][_0x43d7('0x16')],'userId':this[_0x43d7('0xd')]+':'+this[_0x43d7('0x8')]['id'][_0x43d7('0x21')]()};_0xae8723['postText'](_0x3c87ad,function(_0x330388,_0x40132d){if(_0x330388){logger[_0x43d7('0x22')](_0x43d7('0x1a'),_0x29a58f,_0x330388[_0x43d7('0x23')]);_0x286ae8[_0x43d7('0x24')]();}else if(_0x40132d&&_0x40132d[_0x43d7('0x23')]){_0x504b10['body'][_0x43d7('0x25')]=_0x40132d;_0x4459ed[_0x43d7('0x16')]=_0x40132d[_0x43d7('0x23')];_0x4459ed[_0x43d7('0x26')]=_0x43d7('0x25');_0x4459ed[_0x43d7('0x27')]=JSON['stringify'](_0x40132d);return rpc[_0x360976+_0x43d7('0x17')][_0x43d7('0x18')](_0x4459ed)[_0x43d7('0x19')](function(_0x20d12b){logger['info'](_0x43d7('0x1a'),_0x29a58f,_0x4459ed[_0x43d7('0x16')]);if(_0x40132d[_0x43d7('0x28')]=='Failed'){_0x286ae8[_0x43d7('0x24')]();}else{_0x286ae8[_0x43d7('0x1d')]();}})[_0x43d7('0x29')](function(_0x261e9a){logger[_0x43d7('0x22')](_0x43d7('0x1a'),_0x29a58f,JSON['stringify'](_0x261e9a));_0x286ae8[_0x43d7('0x24')]();});}else{_0x286ae8['next']();}});}}catch(_0x1379e7){logger[_0x43d7('0x22')](_0x43d7('0x1a'),_0x29a58f,JSON['stringify'](_0x1379e7));_0x286ae8[_0x43d7('0x1d')]();}};}; \ No newline at end of file +var _0x3f32=['ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','error','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','toString','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','catch','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone'];(function(_0x48ebe8,_0x300832){var _0x5c65fb=function(_0x55a95b){while(--_0x55a95b){_0x48ebe8['push'](_0x48ebe8['shift']());}};_0x5c65fb(++_0x300832);}(_0x3f32,0xdc));var _0x23f3=function(_0x54f859,_0x59d463){_0x54f859=_0x54f859-0x0;var _0x17a08b=_0x3f32[_0x54f859];return _0x17a08b;};'use strict';var _=require('lodash');var moment=require(_0x23f3('0x0'));var AWS=require('aws-sdk');var utils=require(_0x23f3('0x1'));var logger=require(_0x23f3('0x2'))(_0x23f3('0x3'));var rpc={'chatMessage':require(_0x23f3('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x23f3('0x5')),'smsMessage':require(_0x23f3('0x6')),'faxMessage':require(_0x23f3('0x7')),'whatsappMessage':require(_0x23f3('0x8'))};exports['consequence']=function(_0x2237a3,_0x262253){return function(_0x3581b6){try{if(!_[_0x23f3('0x9')](this[_0x23f3('0xa')][_0x23f3('0xb')])){logger[_0x23f3('0xc')]('[%s][AMAZONLEX]\x20%s',_0x2237a3,_0x23f3('0xd'));return _0x3581b6[_0x23f3('0xe')]();}var _0x24bf8a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x23f3('0xf')](_0x23f3('0x10')),'direction':_0x23f3('0x11')};if(this[_0x23f3('0x12')]==='sms'||this[_0x23f3('0x12')]==='whatsapp'){_0x24bf8a[_0x23f3('0x13')]=this[_0x23f3('0xa')]['phone'];}var _0x4b063d=this['channel'];if(_0x4b063d==='chat'){_0x24bf8a[_0x23f3('0x14')]=this['account']['id'];}else{_0x24bf8a[_[_0x23f3('0x15')](_0x4b063d)+_0x23f3('0x16')]=this[_0x23f3('0x17')]['id'];}_0x24bf8a[_[_0x23f3('0x15')](_0x4b063d)+_0x23f3('0x18')]=this[_0x23f3('0xa')]['id'];if(this[_0x23f3('0xa')][_0x23f3('0x19')]){var _0x2841c0=_0x262253[0x4];if(!_['isEmpty'](_0x2841c0)){_0x24bf8a[_0x23f3('0x1a')]=utils[_0x23f3('0x1b')](_0x2841c0,this);return rpc[_0x4b063d+_0x23f3('0x1c')][_0x23f3('0x1d')](_0x24bf8a)[_0x23f3('0x1e')](function(_0x8d934f){logger[_0x23f3('0xc')](_0x23f3('0x1f'),_0x2237a3,_0x24bf8a[_0x23f3('0x1a')]);})['catch'](function(_0x48e0ea){logger[_0x23f3('0x20')](_0x23f3('0x1f'),_0x2237a3,JSON['stringify'](_0x48e0ea));})[_0x23f3('0x21')](function(){logger['info'](_0x23f3('0x22'),_0x2237a3);_0x3581b6[_0x23f3('0x23')]();});}else{logger[_0x23f3('0xc')](_0x23f3('0x24'),_0x2237a3);_0x3581b6['stop']();}}else{var _0x5a86c1=this;var _0x349541=new AWS[(_0x23f3('0x25'))]({'accessKeyId':_0x262253[0x0],'secretAccessKey':_0x262253[0x1],'region':_0x262253[0x2]});var _0x14e0e9={'botAlias':_0x23f3('0x26'),'botName':_0x262253[0x3],'inputText':this[_0x23f3('0x27')][_0x23f3('0x1a')],'userId':this[_0x23f3('0x12')]+':'+this[_0x23f3('0xa')]['id'][_0x23f3('0x28')]()};_0x349541['postText'](_0x14e0e9,function(_0x27e27d,_0x48ca85){if(_0x27e27d){logger[_0x23f3('0x20')](_0x23f3('0x1f'),_0x2237a3,_0x27e27d[_0x23f3('0x27')]);_0x3581b6['next']();}else if(_0x48ca85&&_0x48ca85[_0x23f3('0x27')]){_0x5a86c1[_0x23f3('0x1a')][_0x23f3('0x29')]=_0x48ca85;_0x24bf8a['body']=_0x48ca85['message'];_0x24bf8a[_0x23f3('0x2a')]=_0x23f3('0x29');_0x24bf8a[_0x23f3('0x2b')]=JSON[_0x23f3('0x2c')](_0x48ca85);return rpc[_0x4b063d+_0x23f3('0x1c')][_0x23f3('0x1d')](_0x24bf8a)[_0x23f3('0x1e')](function(_0x160895){logger[_0x23f3('0xc')](_0x23f3('0x1f'),_0x2237a3,_0x24bf8a[_0x23f3('0x1a')]);if(_0x48ca85[_0x23f3('0x2d')]==_0x23f3('0x2e')){_0x3581b6[_0x23f3('0xe')]();}else{_0x3581b6[_0x23f3('0x23')]();}})[_0x23f3('0x2f')](function(_0x593a35){logger[_0x23f3('0x20')](_0x23f3('0x1f'),_0x2237a3,JSON[_0x23f3('0x2c')](_0x593a35));_0x3581b6[_0x23f3('0xe')]();});}else{_0x3581b6['next']();}});}}catch(_0x504ce5){logger['error'](_0x23f3('0x1f'),_0x2237a3,JSON[_0x23f3('0x2c')](_0x504ce5));_0x3581b6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index ee7ddf4..2de0747 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 _0xacd7=['messageId','Message','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','autoreplyExecuted','contact','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','then'];(function(_0x41305b,_0x54fbb8){var _0x19af15=function(_0x23177b){while(--_0x23177b){_0x41305b['push'](_0x41305b['shift']());}};_0x19af15(++_0x54fbb8);}(_0xacd7,0x185));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x7acd('0x0'));var logger=require(_0x7acd('0x1'))(_0x7acd('0x2'));var rpc={'chatMessage':require(_0x7acd('0x3')),'openchannelMessage':require(_0x7acd('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7acd('0x5')),'faxMessage':require(_0x7acd('0x6')),'whatsappMessage':require(_0x7acd('0x7')),'chatInteraction':require(_0x7acd('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x7acd('0x9')),'smsInteraction':require(_0x7acd('0xa')),'faxInteraction':require(_0x7acd('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x7acd('0xc'));exports[_0x7acd('0xd')]=function(_0x21f3aa,_0x25ec62,_0x4a5aa2,_0x564c89){return function(_0x3c8a2d){try{var _0x270db5=this[_0x7acd('0xe')];if(_0x270db5===_0x7acd('0xf')&&_0x564c89[_0x7acd('0x10')]['isAutoreply']){logger['info'](_0x7acd('0x11'),_0x21f3aa,_0x7acd('0x12'));return _0x3c8a2d[_0x7acd('0x13')]();}if(_0x25ec62[0x0]==='1'&&(_[_0x7acd('0x14')](this[_0x7acd('0x15')][_0x7acd('0x16')])||!this[_0x7acd('0x15')][_0x7acd('0x16')])){logger[_0x7acd('0x17')](_0x7acd('0x11'),_0x21f3aa,_0x7acd('0x18'));return _0x3c8a2d[_0x7acd('0x13')]();}if(_0x25ec62[0x0]==='2'&&this['interaction'][_0x7acd('0x19')]){logger[_0x7acd('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x21f3aa,'One\x20Time\x20already\x20sent');return _0x3c8a2d[_0x7acd('0x13')]();}var _0x43cb8e={'ContactId':this[_0x7acd('0x1a')]['id'],'sentAt':moment()['format'](_0x7acd('0x1b')),'direction':'out'};if(this[_0x7acd('0xe')]==='mail'){_0x43cb8e[_0x7acd('0x10')]=utils[_0x7acd('0x1c')](_0x25ec62[0x2],this);}else{_0x43cb8e[_0x7acd('0x10')]=utils['getMustacheRender'](_0x25ec62[0x1],this);}if(this['message']){_0x43cb8e['to']=this[_0x7acd('0x1d')][_0x7acd('0x1e')]||'';if(this['channel']==='mail'&&_0x25ec62[0x1]==='1'){_0x43cb8e['cc']=this['message']['cc']||'';}_0x43cb8e[_0x7acd('0x1e')]=this[_0x7acd('0x1d')]['to']||'';_0x43cb8e[_0x7acd('0x1f')]=this[_0x7acd('0x1d')]['phone']||'';_0x43cb8e[_0x7acd('0x20')]=!![];if(this['message'][_0x7acd('0x21')]){_0x43cb8e['subject']='';_0x43cb8e[_0x7acd('0x21')]+=_['startsWith'](this[_0x7acd('0x1d')][_0x7acd('0x21')],_0x7acd('0x22'))?'':_0x7acd('0x23');_0x43cb8e[_0x7acd('0x21')]+=this[_0x7acd('0x1d')][_0x7acd('0x21')];}}if(this[_0x7acd('0xe')]===_0x7acd('0x24')){_0x43cb8e[_0x7acd('0x25')]=this[_0x7acd('0x26')]['id'];}else{_0x43cb8e[_[_0x7acd('0x27')](this[_0x7acd('0xe')])+'AccountId']=this[_0x7acd('0x26')]['id'];}_0x43cb8e[_[_0x7acd('0x27')](this[_0x7acd('0xe')])+_0x7acd('0x28')]=this[_0x7acd('0x15')]['id'];var _0x17e93a=this['interaction'];if(rpc[this[_0x7acd('0xe')]+'Message']){if(this['channel']===_0x7acd('0xf')){var _0x496495={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x7acd('0x29')]['service']){_0x496495[_0x7acd('0x2a')]=this[_0x7acd('0x26')][_0x7acd('0x29')][_0x7acd('0x2a')];}else{_0x496495[_0x7acd('0x2b')]=this[_0x7acd('0x26')][_0x7acd('0x29')]['host'];_0x496495[_0x7acd('0x2c')]=this[_0x7acd('0x26')][_0x7acd('0x29')][_0x7acd('0x2c')];_0x496495[_0x7acd('0x2d')]=this[_0x7acd('0x26')][_0x7acd('0x29')][_0x7acd('0x2d')];}if(this['account'][_0x7acd('0x29')][_0x7acd('0x2e')]){_0x496495['auth']={'user':this['account']['Smtp'][_0x7acd('0x2f')],'pass':this[_0x7acd('0x26')][_0x7acd('0x29')][_0x7acd('0x30')]};}_0x43cb8e[_0x7acd('0x31')]=this[_0x7acd('0x1d')]['messageId'];_0x43cb8e[_0x7acd('0x32')]=_0x7acd('0x33')+_[_0x7acd('0x34')](_0x43cb8e[_0x7acd('0x10')],_0x7acd('0x35'),_0x7acd('0x36'))+_0x7acd('0x37');_0x43cb8e['headers']={'Auto-Submitted':_0x7acd('0x38'),'X-Auto-Response-Suppress':_0x7acd('0x39'),'Precedence':_0x7acd('0x3a')};return mailRpc[_0x7acd('0x3b')](_0x496495,_0x43cb8e)[_0x7acd('0x3c')](function(_0x3b1deb){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x21f3aa);_0x43cb8e[_0x7acd('0x3d')]=_0x3b1deb[_0x7acd('0x1d')][_0x7acd('0x3d')];return rpc[_0x270db5+_0x7acd('0x3e')][_0x7acd('0x3f')](_0x43cb8e);})[_0x7acd('0x3c')](function(_0x1a4c06){logger[_0x7acd('0x17')]('[%s][AUTOREPLY]\x20%s',_0x21f3aa,JSON[_0x7acd('0x40')](_0x1a4c06));})[_0x7acd('0x41')](function(_0x42c6d2){logger[_0x7acd('0x42')](_0x7acd('0x43'),_0x21f3aa,JSON[_0x7acd('0x40')](_0x42c6d2));})[_0x7acd('0x44')](function(){Promise['resolve']()[_0x7acd('0x3c')](function(){if(_0x25ec62[0x0]!=='2'||_0x17e93a[_0x7acd('0x19')])return;return rpc[_0x270db5+_0x7acd('0x45')][_0x7acd('0x46')](_0x17e93a['id'],{'autoreplyExecuted':!![]})[_0x7acd('0x3c')](function(_0x23321e){logger[_0x7acd('0x17')](_0x7acd('0x47'),_0x21f3aa,JSON[_0x7acd('0x40')](_0x23321e));})['catch'](function(_0x308a5f){logger[_0x7acd('0x42')](_0x7acd('0x48'),_0x21f3aa,JSON[_0x7acd('0x40')](_0x308a5f));});})[_0x7acd('0x3c')](function(){_0x3c8a2d[_0x7acd('0x13')]();});});}else{return rpc[this[_0x7acd('0xe')]+'Message'][_0x7acd('0x3f')](_0x43cb8e)[_0x7acd('0x3c')](function(_0x30e2ca){logger[_0x7acd('0x17')](_0x7acd('0x11'),_0x21f3aa,_0x43cb8e[_0x7acd('0x10')]);})[_0x7acd('0x41')](function(_0x4a99ec){logger[_0x7acd('0x42')](_0x7acd('0x11'),_0x21f3aa,JSON[_0x7acd('0x40')](_0x4a99ec));})[_0x7acd('0x44')](function(){Promise[_0x7acd('0x49')]()[_0x7acd('0x3c')](function(){if(_0x25ec62[0x0]!=='2'||_0x17e93a[_0x7acd('0x19')])return;return rpc[_0x270db5+_0x7acd('0x45')][_0x7acd('0x46')](_0x17e93a['id'],{'autoreplyExecuted':!![]})[_0x7acd('0x3c')](function(_0x3a32de){logger[_0x7acd('0x17')](_0x7acd('0x47'),_0x21f3aa,JSON[_0x7acd('0x40')](_0x3a32de));})['catch'](function(_0x5a535b){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x21f3aa,JSON[_0x7acd('0x40')](_0x5a535b));});})[_0x7acd('0x3c')](function(){_0x3c8a2d['next']();});});}}}catch(_0x4a3ce9){logger[_0x7acd('0x42')](_0x7acd('0x11'),_0x21f3aa,JSON['stringify'](_0x4a3ce9));_0x3c8a2d[_0x7acd('0x4a')]();}};}; \ No newline at end of file +var _0x419e=[''+_[_0xe419('0x37')](_0x117e61[_0xe419('0x12')],_0xe419('0x38'),_0xe419('0x39'))+'';_0x117e61[_0xe419('0x3a')]={'Auto-Submitted':_0xe419('0x3b'),'X-Auto-Response-Suppress':_0xe419('0x3c'),'Precedence':'auto_reply'};return mailRpc[_0xe419('0x3d')](_0x274301,_0x117e61)[_0xe419('0x3e')](function(_0x34fcb9){logger[_0xe419('0x14')](_0xe419('0x3f'),_0xd14718);_0x117e61[_0xe419('0x35')]=_0x34fcb9[_0xe419('0x1f')][_0xe419('0x35')];return rpc[_0x505774+_0xe419('0x2b')][_0xe419('0x40')](_0x117e61);})['then'](function(_0x486189){logger[_0xe419('0x14')](_0xe419('0x15'),_0xd14718,JSON['stringify'](_0x486189));})[_0xe419('0x41')](function(_0x2446fd){logger[_0xe419('0x42')](_0xe419('0x43'),_0xd14718,JSON['stringify'](_0x2446fd));})['finally'](function(){Promise[_0xe419('0x44')]()[_0xe419('0x3e')](function(){if(_0x2ee44f[0x0]!=='2'||_0x3869a2[_0xe419('0x19')])return;return rpc[_0x505774+'Interaction'][_0xe419('0x45')](_0x3869a2['id'],{'autoreplyExecuted':!![]})[_0xe419('0x3e')](function(_0x11921e){logger[_0xe419('0x14')](_0xe419('0x1a'),_0xd14718,JSON[_0xe419('0x46')](_0x11921e));})[_0xe419('0x41')](function(_0x157756){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xd14718,JSON[_0xe419('0x46')](_0x157756));});})[_0xe419('0x3e')](function(){_0x4c3b99[_0xe419('0x16')]();});});}else{return rpc[this[_0xe419('0x10')]+'Message'][_0xe419('0x40')](_0x117e61)['then'](function(_0x523bf5){logger[_0xe419('0x14')](_0xe419('0x15'),_0xd14718,_0x117e61['body']);})[_0xe419('0x41')](function(_0x437e5c){logger[_0xe419('0x42')](_0xe419('0x15'),_0xd14718,JSON[_0xe419('0x46')](_0x437e5c));})[_0xe419('0x47')](function(){Promise[_0xe419('0x44')]()[_0xe419('0x3e')](function(){if(_0x2ee44f[0x0]!=='2'||_0x3869a2[_0xe419('0x19')])return;return rpc[_0x505774+_0xe419('0x48')][_0xe419('0x45')](_0x3869a2['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1e2e7d){logger[_0xe419('0x14')](_0xe419('0x1a'),_0xd14718,JSON['stringify'](_0x1e2e7d));})[_0xe419('0x41')](function(_0x41c6fc){logger[_0xe419('0x42')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xd14718,JSON['stringify'](_0x41c6fc));});})[_0xe419('0x3e')](function(){_0x4c3b99[_0xe419('0x16')]();});});}}}catch(_0x3a512e){logger[_0xe419('0x42')](_0xe419('0x15'),_0xd14718,JSON[_0xe419('0x46')](_0x3a512e));_0x4c3b99[_0xe419('0x49')]();}};}; \ 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 9ab368f..de317ab 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 _0x8f76=['routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger'];(function(_0x5d81fc,_0x2df17e){var _0xd507d7=function(_0x1152f9){while(--_0x1152f9){_0x5d81fc['push'](_0x5d81fc['shift']());}};_0xd507d7(++_0x2df17e);}(_0x8f76,0x136));var _0x68f7=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x8f76[_0x4dbaad];return _0x226c72;};'use strict';var moment=require(_0x68f7('0x0'));var logger=require(_0x68f7('0x1'))(_0x68f7('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x68f7('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x68f7('0x4')),'faxInteraction':require(_0x68f7('0x5')),'whatsappInteraction':require(_0x68f7('0x6'))};exports[_0x68f7('0x7')]=function(_0x197ea7,_0x2bd715,_0xef380c,_0x1ad3b9){return function(_0x4b6437){try{logger[_0x68f7('0x8')](_0x68f7('0x9'),_0x197ea7,_0x2bd715[0x0]);var _0x5da380={'closed':0x1,'closedAt':moment()[_0x68f7('0xa')](_0x68f7('0xb')),'closeReason':_0x68f7('0xc'),'disposition':_0x2bd715[0x0]};if(rpc[_0x1ad3b9[_0x68f7('0xd')]+'Interaction']){rpc[_0x1ad3b9['channel']+_0x68f7('0xe')][_0x68f7('0xf')](_0x1ad3b9['interaction']['id'],_0x5da380)['then'](function(_0x43d9eb){logger['info'](_0x68f7('0x10'),_0x197ea7,_0x1ad3b9[_0x68f7('0x11')]['id']);})[_0x68f7('0x12')](function(_0x11330a){logger['error'](_0x68f7('0x13'),_0x197ea7,JSON[_0x68f7('0x14')](_0x11330a));})[_0x68f7('0x15')](function(){_0x4b6437[_0x68f7('0x16')]();});}}catch(_0x482f36){logger[_0x68f7('0x17')]('[%s][CLOSE]\x20%s',_0x197ea7,JSON['stringify'](_0x482f36));_0x4b6437[_0x68f7('0x16')]();}};}; \ No newline at end of file +var _0x97d5=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','interaction','error','[%s][CLOSE]\x20%s','finally','stop','stringify','../../../../config/logger','routing'];(function(_0x2b97f6,_0x3109dd){var _0x605ab=function(_0x595423){while(--_0x595423){_0x2b97f6['push'](_0x2b97f6['shift']());}};_0x605ab(++_0x3109dd);}(_0x97d5,0x1ca));var _0x597d=function(_0x3f1a77,_0x100ae0){_0x3f1a77=_0x3f1a77-0x0;var _0x3370ed=_0x97d5[_0x3f1a77];return _0x3370ed;};'use strict';var moment=require('moment');var logger=require(_0x597d('0x0'))(_0x597d('0x1'));var rpc={'chatInteraction':require(_0x597d('0x2')),'openchannelInteraction':require(_0x597d('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x597d('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x597d('0x5')]=function(_0x447f32,_0x46e4b6,_0x436e2a,_0xcd37c2){return function(_0x544f3b){try{logger[_0x597d('0x6')](_0x597d('0x7'),_0x447f32,_0x46e4b6[0x0]);var _0x49a3a4={'closed':0x1,'closedAt':moment()[_0x597d('0x8')](_0x597d('0x9')),'closeReason':'system','disposition':_0x46e4b6[0x0]};if(rpc[_0xcd37c2[_0x597d('0xa')]+_0x597d('0xb')]){rpc[_0xcd37c2[_0x597d('0xa')]+_0x597d('0xb')][_0x597d('0xc')](_0xcd37c2['interaction']['id'],_0x49a3a4)[_0x597d('0xd')](function(_0x19886c){logger[_0x597d('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x447f32,_0xcd37c2[_0x597d('0xe')]['id']);})['catch'](function(_0x2384cb){logger[_0x597d('0xf')](_0x597d('0x10'),_0x447f32,JSON['stringify'](_0x2384cb));})[_0x597d('0x11')](function(){_0x544f3b[_0x597d('0x12')]();});}}catch(_0x4c6c1c){logger['error'](_0x597d('0x10'),_0x447f32,JSON[_0x597d('0x13')](_0x4c6c1c));_0x544f3b[_0x597d('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 f484878..a2b11de 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 _0x8110=['isEmpty','body','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','fulfillment','providerName','providerResponse','result','metadata','endConversation','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','phone','account','created'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x8110,0x185));var _0x0811=function(_0x42e03b,_0x110aea){_0x42e03b=_0x42e03b-0x0;var _0x3ba84b=_0x8110[_0x42e03b];return _0x3ba84b;};'use strict';var _=require('lodash');var moment=require(_0x0811('0x0'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require('./utils');var logger=require(_0x0811('0x1'))('routing');var rpc={'chatMessage':require(_0x0811('0x2')),'openchannelMessage':require(_0x0811('0x3')),'mailMessage':require(_0x0811('0x4')),'smsMessage':require(_0x0811('0x5')),'faxMessage':require(_0x0811('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0811('0x7')]=function(_0x53b418,_0x39dcb1){return function(_0x375ae0){try{if(!_[_0x0811('0x8')](this[_0x0811('0x9')][_0x0811('0xa')])){logger[_0x0811('0xb')](_0x0811('0xc'),_0x53b418,_0x0811('0xd'));return _0x375ae0[_0x0811('0xe')]();}var _0x37e502={'ContactId':this[_0x0811('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0811('0x10')};if(this[_0x0811('0x11')]==='sms'||this[_0x0811('0x11')]==='whatsapp'){_0x37e502[_0x0811('0x12')]=this[_0x0811('0x9')][_0x0811('0x12')];}var _0x467535=this[_0x0811('0x11')];if(_0x467535==='chat'){_0x37e502['ChatWebsiteId']=this[_0x0811('0x13')]['id'];}else{_0x37e502[_['upperFirst'](_0x467535)+'AccountId']=this[_0x0811('0x13')]['id'];}_0x37e502[_['upperFirst'](_0x467535)+'InteractionId']=this['interaction']['id'];if(this[_0x0811('0x9')][_0x0811('0x14')]){var _0xd7bbc2=_0x39dcb1[0x2];if(!_[_0x0811('0x15')](_0xd7bbc2)){_0x37e502[_0x0811('0x16')]=utils['getMustacheRender'](_0xd7bbc2,this);return rpc[_0x467535+_0x0811('0x17')][_0x0811('0x18')](_0x37e502)[_0x0811('0x19')](function(_0x1367c7){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x53b418,_0x37e502[_0x0811('0x16')]);})[_0x0811('0x1a')](function(_0x48e375){logger[_0x0811('0x1b')](_0x0811('0xc'),_0x53b418,JSON[_0x0811('0x1c')](_0x48e375));})[_0x0811('0x1d')](function(){logger['info'](_0x0811('0x1e'),_0x53b418);_0x375ae0[_0x0811('0x1f')]();});}else{logger[_0x0811('0xb')](_0x0811('0x20'),_0x53b418);_0x375ae0[_0x0811('0x1f')]();}}else{var _0x43c1a4=this;var _0x19e222=apiai(_0x39dcb1[0x0],{'language':_0x39dcb1[0x1]||'en'});return _0x19e222['textRequest'](this[_0x0811('0x21')][_0x0811('0x16')],{'sessionId':md5(this['interaction']['id'])})[_0x0811('0x19')](function(_0x46303e){_0x43c1a4[_0x0811('0x16')][_0x0811('0x22')]=_0x46303e;_0x37e502['body']=_0x46303e['result'][_0x0811('0x23')]['speech'];_0x37e502[_0x0811('0x24')]='dialogflow';_0x37e502[_0x0811('0x25')]=JSON[_0x0811('0x1c')](_0x46303e);return rpc[_0x467535+_0x0811('0x17')][_0x0811('0x18')](_0x37e502)[_0x0811('0x19')](function(_0x158c5e){logger[_0x0811('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x53b418,_0x37e502[_0x0811('0x16')]);if(_0x46303e[_0x0811('0x26')][_0x0811('0x27')][_0x0811('0x28')]){_0x375ae0[_0x0811('0xe')]();}else{_0x375ae0[_0x0811('0x1f')]();}})[_0x0811('0x1a')](function(_0x59c623){logger[_0x0811('0x1b')](_0x0811('0xc'),_0x53b418,JSON[_0x0811('0x1c')](_0x59c623));_0x375ae0['next']();});})[_0x0811('0x1a')](function(_0x5db93c){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x53b418,_0x5db93c[_0x0811('0x21')]);_0x375ae0[_0x0811('0xe')]();});}}catch(_0x5adbef){logger['error'](_0x0811('0xc'),_0x53b418,JSON['stringify'](_0x5adbef));_0x375ae0[_0x0811('0x1f')]();}};}; \ No newline at end of file +var _0x5419=['endConversation','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','providerName','providerResponse','metadata'];(function(_0x49e759,_0x26f831){var _0x3f1269=function(_0x5a46d3){while(--_0x5a46d3){_0x49e759['push'](_0x49e759['shift']());}};_0x3f1269(++_0x26f831);}(_0x5419,0x175));var _0x9541=function(_0x37ee87,_0x2b2b62){_0x37ee87=_0x37ee87-0x0;var _0x4ffc88=_0x5419[_0x37ee87];return _0x4ffc88;};'use strict';var _=require(_0x9541('0x0'));var moment=require(_0x9541('0x1'));var apiai=require(_0x9541('0x2'));var md5=require(_0x9541('0x3'));var utils=require(_0x9541('0x4'));var logger=require(_0x9541('0x5'))(_0x9541('0x6'));var rpc={'chatMessage':require(_0x9541('0x7')),'openchannelMessage':require(_0x9541('0x8')),'mailMessage':require(_0x9541('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9541('0xa')),'whatsappMessage':require(_0x9541('0xb'))};exports[_0x9541('0xc')]=function(_0x3c8491,_0x2aed30){return function(_0x22f42f){try{if(!_[_0x9541('0xd')](this[_0x9541('0xe')]['UserId'])){logger[_0x9541('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3c8491,_0x9541('0x10'));return _0x22f42f[_0x9541('0x11')]();}var _0x76ee06={'ContactId':this[_0x9541('0x12')]['id'],'sentAt':moment()[_0x9541('0x13')](_0x9541('0x14')),'direction':_0x9541('0x15')};if(this['channel']===_0x9541('0x16')||this['channel']==='whatsapp'){_0x76ee06[_0x9541('0x17')]=this['interaction'][_0x9541('0x17')];}var _0x596222=this[_0x9541('0x18')];if(_0x596222===_0x9541('0x19')){_0x76ee06[_0x9541('0x1a')]=this[_0x9541('0x1b')]['id'];}else{_0x76ee06[_[_0x9541('0x1c')](_0x596222)+_0x9541('0x1d')]=this['account']['id'];}_0x76ee06[_[_0x9541('0x1c')](_0x596222)+'InteractionId']=this[_0x9541('0xe')]['id'];if(this['interaction'][_0x9541('0x1e')]){var _0x5ad2f5=_0x2aed30[0x2];if(!_[_0x9541('0x1f')](_0x5ad2f5)){_0x76ee06[_0x9541('0x20')]=utils[_0x9541('0x21')](_0x5ad2f5,this);return rpc[_0x596222+_0x9541('0x22')][_0x9541('0x23')](_0x76ee06)[_0x9541('0x24')](function(_0x50e39f){logger['info'](_0x9541('0x25'),_0x3c8491,_0x76ee06[_0x9541('0x20')]);})['catch'](function(_0x4cf375){logger[_0x9541('0x26')](_0x9541('0x25'),_0x3c8491,JSON[_0x9541('0x27')](_0x4cf375));})[_0x9541('0x28')](function(){logger[_0x9541('0xf')](_0x9541('0x29'),_0x3c8491);_0x22f42f[_0x9541('0x2a')]();});}else{logger[_0x9541('0xf')](_0x9541('0x2b'),_0x3c8491);_0x22f42f[_0x9541('0x2a')]();}}else{var _0x43bb4c=this;var _0x54a827=apiai(_0x2aed30[0x0],{'language':_0x2aed30[0x1]||'en'});return _0x54a827[_0x9541('0x2c')](this[_0x9541('0x2d')][_0x9541('0x20')],{'sessionId':md5(this[_0x9541('0xe')]['id'])})[_0x9541('0x24')](function(_0x2f6b0a){_0x43bb4c[_0x9541('0x20')][_0x9541('0x2e')]=_0x2f6b0a;_0x76ee06[_0x9541('0x20')]=_0x2f6b0a['result'][_0x9541('0x2f')]['speech'];_0x76ee06[_0x9541('0x30')]=_0x9541('0x2e');_0x76ee06[_0x9541('0x31')]=JSON[_0x9541('0x27')](_0x2f6b0a);return rpc[_0x596222+'Message'][_0x9541('0x23')](_0x76ee06)[_0x9541('0x24')](function(_0x4f5602){logger[_0x9541('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x3c8491,_0x76ee06[_0x9541('0x20')]);if(_0x2f6b0a['result'][_0x9541('0x32')][_0x9541('0x33')]){_0x22f42f['next']();}else{_0x22f42f[_0x9541('0x2a')]();}})[_0x9541('0x34')](function(_0x4f4d23){logger[_0x9541('0x26')](_0x9541('0x25'),_0x3c8491,JSON['stringify'](_0x4f4d23));_0x22f42f[_0x9541('0x11')]();});})['catch'](function(_0x4455cf){logger[_0x9541('0x26')](_0x9541('0x25'),_0x3c8491,_0x4455cf[_0x9541('0x2d')]);_0x22f42f[_0x9541('0x11')]();});}}catch(_0x33259c){logger[_0x9541('0x26')]('[%s][DIALOGFLOW]\x20%s',_0x3c8491,JSON[_0x9541('0x27')](_0x33259c));_0x22f42f[_0x9541('0x2a')]();}};}; \ 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 81a01dd..f93725e 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 _0xcff2=['getMustacheRender','[%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','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','fulfillmentText','push','all','then','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','isEmpty'];(function(_0x54dc55,_0x1cab6b){var _0x5a5aee=function(_0x46a375){while(--_0x46a375){_0x54dc55['push'](_0x54dc55['shift']());}};_0x5a5aee(++_0x1cab6b);}(_0xcff2,0x68));var _0x2cff=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xcff2[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x2cff('0x0'));var dialogflow=require(_0x2cff('0x1'));var md5=require(_0x2cff('0x2'));var moment=require(_0x2cff('0x3'));var Promise=require(_0x2cff('0x4'));var logger=require(_0x2cff('0x5'))('routing');var utils=require(_0x2cff('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2cff('0x7')),'smsMessage':require(_0x2cff('0x8')),'faxMessage':require(_0x2cff('0x9')),'whatsappMessage':require(_0x2cff('0xa'))};function createMessage(_0x3451d9,_0x596875,_0x18ace5,_0x2d676e){return new Promise(function(_0x461fd7,_0x12d931){var _0x24ff7c=_[_0x2cff('0xb')](_0x18ace5);_0x24ff7c[_0x2cff('0xc')]=_0x2d676e;return rpc[_0x596875+'Message']['create'](_0x24ff7c)['then'](function(){logger['info'](_0x2cff('0xd'),_0x3451d9,_0x24ff7c['body']);_0x461fd7();})[_0x2cff('0xe')](function(_0x3a3d92){logger[_0x2cff('0xf')](_0x2cff('0xd'),_0x3451d9,JSON[_0x2cff('0x10')](_0x3a3d92));_0x12d931(_0x3a3d92);});});}exports[_0x2cff('0x11')]=function(_0x32402a,_0x39e2c8){return function(_0x290536){try{if(!_[_0x2cff('0x12')](this[_0x2cff('0x13')][_0x2cff('0x14')])){logger[_0x2cff('0x15')](_0x2cff('0xd'),_0x32402a,_0x2cff('0x16'));return _0x290536[_0x2cff('0x17')]();}var _0x528b38={'ContactId':this[_0x2cff('0x18')]['id'],'sentAt':moment()[_0x2cff('0x19')](_0x2cff('0x1a')),'direction':_0x2cff('0x1b')};if(this['channel']==='sms'||this[_0x2cff('0x1c')]==='whatsapp'){_0x528b38['phone']=this[_0x2cff('0x13')]['phone'];}var _0x16ddf2=this['channel'];if(_0x16ddf2===_0x2cff('0x1d')){_0x528b38[_0x2cff('0x1e')]=this[_0x2cff('0x1f')]['id'];}else{_0x528b38[_[_0x2cff('0x20')](_0x16ddf2)+'AccountId']=this[_0x2cff('0x1f')]['id'];}_0x528b38[_[_0x2cff('0x20')](_0x16ddf2)+'InteractionId']=this[_0x2cff('0x13')]['id'];if(this[_0x2cff('0x13')]['created']){var _0x4ba3b4=_0x39e2c8[0x4];if(!_[_0x2cff('0x21')](_0x4ba3b4)){_0x528b38[_0x2cff('0xc')]=utils[_0x2cff('0x22')](_0x4ba3b4,this);return rpc[_0x16ddf2+'Message']['create'](_0x528b38)['then'](function(_0x4eceb0){logger[_0x2cff('0x15')](_0x2cff('0xd'),_0x32402a,_0x528b38['body']);})['catch'](function(_0x2522c6){logger[_0x2cff('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x32402a,JSON[_0x2cff('0x10')](_0x2522c6));})['finally'](function(){logger[_0x2cff('0x15')](_0x2cff('0x23'),_0x32402a);_0x290536[_0x2cff('0x24')]();});}else{logger['info'](_0x2cff('0x25'),_0x32402a);_0x290536['stop']();}}else{var _0x181d68=this;var _0x15934a=_0x39e2c8[0x2][_0x2cff('0x26')](/\\n/g,'\x0a');var _0x1f14f9={'credentials':{'private_key':_0x15934a,'client_email':_0x39e2c8[0x1]}};var _0x5b07f3=new dialogflow[(_0x2cff('0x27'))](_0x1f14f9);var _0x17f15e=_0x5b07f3[_0x2cff('0x28')](_0x39e2c8[0x0],md5(_0x181d68[_0x2cff('0x13')]['id']));var _0x47a07a={'session':_0x17f15e,'queryInput':{'text':{'text':_0x181d68['message'][_0x2cff('0xc')],'languageCode':_0x39e2c8[0x3]||'en'}}};return _0x5b07f3[_0x2cff('0x29')](_0x47a07a)['then'](function(_0x3aa4a9){if(_0x3aa4a9&&_0x3aa4a9[_0x2cff('0x2a')]){_0x181d68['body'][_0x2cff('0x2b')]=_0x3aa4a9;var _0xd84c36=_0x3aa4a9[0x0];var _0x54255b=_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x2d')]&&_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x2d')][_0x2cff('0x2e')]?_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x2d')][_0x2cff('0x2e')][_0x2cff('0x2f')]['boolValue']:![];_0x181d68['body'][_0x2cff('0x30')]=_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x31')];_0x181d68[_0x2cff('0xc')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x32')];_0x181d68[_0x2cff('0xc')][_0x2cff('0x33')]=_0xd84c36[_0x2cff('0x2c')]['diagnosticInfo']&&_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x2d')][_0x2cff('0x2e')]?_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x2d')][_0x2cff('0x2e')][_0x2cff('0x2f')][_0x2cff('0x34')]:![];_0x181d68[_0x2cff('0xc')][_0x2cff('0x35')]=_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x36')][_0x2cff('0x37')];_0x181d68[_0x2cff('0xc')][_0x2cff('0x38')]=_0xd84c36['queryResult'][_0x2cff('0x36')][_0x2cff('0x39')];_0x181d68[_0x2cff('0xc')][_0x2cff('0x3a')]=_0xd84c36[_0x2cff('0x2c')]['intent'][_0x2cff('0x3b')];_0x181d68[_0x2cff('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x3c')];_0x181d68[_0x2cff('0xc')][_0x2cff('0x3d')]=_0xd84c36['queryResult'][_0x2cff('0x3e')];_0x181d68['body']['DIALOGFLOWV2_SCORE']=_0xd84c36[_0x2cff('0x2c')][_0x2cff('0x3f')];_0x528b38[_0x2cff('0x40')]='dialogflowV2';_0x528b38['providerResponse']=JSON[_0x2cff('0x10')](_0x3aa4a9);var _0x34eaef=[];for(var _0x3d6fc3=0x0;_0x3d6fc3<_0x3aa4a9[_0x2cff('0x2a')];_0x3d6fc3++){var _0x355065=_0x3aa4a9[_0x3d6fc3];if(_0x355065&&_0x355065[_0x2cff('0x2c')]&&_0x355065[_0x2cff('0x2c')][_0x2cff('0x41')]){_0x34eaef[_0x2cff('0x42')](createMessage(_0x32402a,_0x16ddf2,_0x528b38,_0x355065['queryResult']['fulfillmentText']));}}return Promise[_0x2cff('0x43')](_0x34eaef)[_0x2cff('0x44')](function(){if(_0x54255b){_0x290536[_0x2cff('0x17')]();}else{_0x290536[_0x2cff('0x24')]();}})[_0x2cff('0xe')](function(_0x547c8a){logger['error'](_0x2cff('0xd'),_0x32402a,JSON[_0x2cff('0x10')](_0x547c8a));_0x290536[_0x2cff('0x17')]();});}})[_0x2cff('0xe')](function(_0x102ce6){logger[_0x2cff('0xf')](_0x2cff('0xd'),_0x32402a,_0x102ce6['message']);_0x290536[_0x2cff('0x17')]();});}}catch(_0x2cd792){logger[_0x2cff('0xf')](_0x2cff('0xd'),_0x32402a,JSON[_0x2cff('0x10')](_0x2cd792));_0x290536[_0x2cff('0x24')]();}};}; \ No newline at end of file +var _0xc343=['diagnosticInfo','DIALOGFLOWV2_INTENTNAME','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','error','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','then','info','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc343,0x1bf));var _0x3c34=function(_0x40441b,_0xf0c91f){_0x40441b=_0x40441b-0x0;var _0x5a657e=_0xc343[_0x40441b];return _0x5a657e;};'use strict';var _=require('lodash');var dialogflow=require(_0x3c34('0x0'));var md5=require(_0x3c34('0x1'));var moment=require(_0x3c34('0x2'));var Promise=require(_0x3c34('0x3'));var logger=require(_0x3c34('0x4'))('routing');var utils=require(_0x3c34('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3c34('0x6')),'mailMessage':require(_0x3c34('0x7')),'smsMessage':require(_0x3c34('0x8')),'faxMessage':require(_0x3c34('0x9')),'whatsappMessage':require(_0x3c34('0xa'))};function createMessage(_0x28e239,_0x568d4a,_0x3b7b81,_0x5c379d){return new Promise(function(_0x509d05,_0x5f02cd){var _0xda66bf=_[_0x3c34('0xb')](_0x3b7b81);_0xda66bf[_0x3c34('0xc')]=_0x5c379d;return rpc[_0x568d4a+_0x3c34('0xd')][_0x3c34('0xe')](_0xda66bf)['then'](function(){logger['info'](_0x3c34('0xf'),_0x28e239,_0xda66bf['body']);_0x509d05();})[_0x3c34('0x10')](function(_0x563e01){logger['error'](_0x3c34('0xf'),_0x28e239,JSON[_0x3c34('0x11')](_0x563e01));_0x5f02cd(_0x563e01);});});}exports[_0x3c34('0x12')]=function(_0x2b0e2e,_0x520207){return function(_0x390a86){try{if(!_[_0x3c34('0x13')](this[_0x3c34('0x14')][_0x3c34('0x15')])){logger['info'](_0x3c34('0xf'),_0x2b0e2e,_0x3c34('0x16'));return _0x390a86[_0x3c34('0x17')]();}var _0x6c1379={'ContactId':this[_0x3c34('0x18')]['id'],'sentAt':moment()['format'](_0x3c34('0x19')),'direction':_0x3c34('0x1a')};if(this[_0x3c34('0x1b')]===_0x3c34('0x1c')||this[_0x3c34('0x1b')]===_0x3c34('0x1d')){_0x6c1379[_0x3c34('0x1e')]=this['interaction'][_0x3c34('0x1e')];}var _0x3f15ac=this[_0x3c34('0x1b')];if(_0x3f15ac==='chat'){_0x6c1379[_0x3c34('0x1f')]=this[_0x3c34('0x20')]['id'];}else{_0x6c1379[_[_0x3c34('0x21')](_0x3f15ac)+_0x3c34('0x22')]=this[_0x3c34('0x20')]['id'];}_0x6c1379[_['upperFirst'](_0x3f15ac)+_0x3c34('0x23')]=this[_0x3c34('0x14')]['id'];if(this[_0x3c34('0x14')][_0x3c34('0x24')]){var _0x478159=_0x520207[0x4];if(!_['isEmpty'](_0x478159)){_0x6c1379[_0x3c34('0xc')]=utils[_0x3c34('0x25')](_0x478159,this);return rpc[_0x3f15ac+_0x3c34('0xd')][_0x3c34('0xe')](_0x6c1379)[_0x3c34('0x26')](function(_0x28ebb5){logger[_0x3c34('0x27')](_0x3c34('0xf'),_0x2b0e2e,_0x6c1379[_0x3c34('0xc')]);})[_0x3c34('0x10')](function(_0x866b8b){logger['error'](_0x3c34('0xf'),_0x2b0e2e,JSON['stringify'](_0x866b8b));})['finally'](function(){logger[_0x3c34('0x27')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2b0e2e);_0x390a86[_0x3c34('0x28')]();});}else{logger['info'](_0x3c34('0x29'),_0x2b0e2e);_0x390a86[_0x3c34('0x28')]();}}else{var _0x108c48=this;var _0x156e3e=_0x520207[0x2][_0x3c34('0x2a')](/\\n/g,'\x0a');var _0x91e5f7={'credentials':{'private_key':_0x156e3e,'client_email':_0x520207[0x1]}};var _0x399438=new dialogflow[(_0x3c34('0x2b'))](_0x91e5f7);var _0x1e7b1a=_0x399438[_0x3c34('0x2c')](_0x520207[0x0],md5(_0x108c48['interaction']['id']));var _0x4b7366={'session':_0x1e7b1a,'queryInput':{'text':{'text':_0x108c48[_0x3c34('0x2d')][_0x3c34('0xc')],'languageCode':_0x520207[0x3]||'en'}}};return _0x399438[_0x3c34('0x2e')](_0x4b7366)[_0x3c34('0x26')](function(_0x3abec0){if(_0x3abec0&&_0x3abec0[_0x3c34('0x2f')]){_0x108c48[_0x3c34('0xc')][_0x3c34('0x30')]=_0x3abec0;var _0x4bdaef=_0x3abec0[0x0];var _0x39218f=_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo']&&_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo'][_0x3c34('0x32')]?_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo'][_0x3c34('0x32')][_0x3c34('0x33')][_0x3c34('0x34')]:![];_0x108c48['body'][_0x3c34('0x35')]=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x36')];_0x108c48[_0x3c34('0xc')][_0x3c34('0x37')]=_0x4bdaef['queryResult'][_0x3c34('0x38')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x4bdaef['queryResult'][_0x3c34('0x39')]&&_0x4bdaef[_0x3c34('0x31')]['diagnosticInfo'][_0x3c34('0x32')]?_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x39')][_0x3c34('0x32')]['end_conversation'][_0x3c34('0x34')]:![];_0x108c48['body'][_0x3c34('0x3a')]=_0x4bdaef[_0x3c34('0x31')]['intent'][_0x3c34('0x3b')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x3c')]['displayName'];_0x108c48[_0x3c34('0xc')][_0x3c34('0x3d')]=_0x4bdaef['queryResult'][_0x3c34('0x3c')][_0x3c34('0x3e')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4bdaef['queryResult'][_0x3c34('0x3f')];_0x108c48['body'][_0x3c34('0x40')]=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x41')];_0x108c48[_0x3c34('0xc')]['DIALOGFLOWV2_SCORE']=_0x4bdaef[_0x3c34('0x31')][_0x3c34('0x42')];_0x6c1379['providerName']=_0x3c34('0x30');_0x6c1379[_0x3c34('0x43')]=JSON[_0x3c34('0x11')](_0x3abec0);var _0x546ca7=[];for(var _0x3269f2=0x0;_0x3269f2<_0x3abec0[_0x3c34('0x2f')];_0x3269f2++){var _0x42f789=_0x3abec0[_0x3269f2];if(_0x42f789&&_0x42f789['queryResult']&&_0x42f789[_0x3c34('0x31')][_0x3c34('0x44')]){_0x546ca7[_0x3c34('0x45')](createMessage(_0x2b0e2e,_0x3f15ac,_0x6c1379,_0x42f789['queryResult']['fulfillmentText']));}}return Promise[_0x3c34('0x46')](_0x546ca7)['then'](function(){if(_0x39218f){_0x390a86['next']();}else{_0x390a86[_0x3c34('0x28')]();}})[_0x3c34('0x10')](function(_0x467306){logger[_0x3c34('0x47')](_0x3c34('0xf'),_0x2b0e2e,JSON[_0x3c34('0x11')](_0x467306));_0x390a86['next']();});}})[_0x3c34('0x10')](function(_0x1fe038){logger[_0x3c34('0x47')]('[%s][DIALOGFLOWV2]\x20%s',_0x2b0e2e,_0x1fe038['message']);_0x390a86['next']();});}}catch(_0x17caa6){logger[_0x3c34('0x47')](_0x3c34('0xf'),_0x2b0e2e,JSON[_0x3c34('0x11')](_0x17caa6));_0x390a86[_0x3c34('0x28')]();}};}; \ 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 b24a767..76b0589 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 _0x0bc4=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0bc4,0x165));var _0x40bc=function(_0x35ab35,_0x68ad16){_0x35ab35=_0x35ab35-0x0;var _0x1544be=_0x0bc4[_0x35ab35];return _0x1544be;};'use strict';var schema=require('validate');var _=require(_0x40bc('0x0'));var htmlToText=require(_0x40bc('0x1'));var utils=require(_0x40bc('0x2'));var logger=require(_0x40bc('0x3'))(_0x40bc('0x4'));var gotoif=schema({'condition':{'type':_0x40bc('0x5'),'required':!![],'message':_0x40bc('0x6')},'priorityTrue':{'type':_0x40bc('0x7'),'message':_0x40bc('0x8')},'priorityFalse':{'type':_0x40bc('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x40bc('0x9')]=function(_0x55df98,_0x4cf130){return function(_0x1838a7){try{var _0x7f38e2={'condition':htmlToText[_0x40bc('0xa')](utils[_0x40bc('0xb')](_0x4cf130[0x0],this),{'wordwrap':![]})[_0x40bc('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4cf130[0x1],'priorityFalse':_0x4cf130[0x2]};var _0x294ab3=gotoif[_0x40bc('0xd')](_0x7f38e2,{'typecast':!![]});if(_0x294ab3['length']){logger[_0x40bc('0xe')](_0x40bc('0xf'),_0x55df98,_[_0x40bc('0x10')](_0x294ab3,_0x40bc('0x11'))[_0x40bc('0x12')](',\x20'));_0x1838a7['stop']();}else{try{var _0x57642f=eval('('+_0x7f38e2['condition']+')');var _0x44fda1=_0x57642f?_0x7f38e2[_0x40bc('0x13')]:_0x7f38e2['priorityFalse'];logger['info'](_0x40bc('0x14'),_0x55df98,_0x7f38e2[_0x40bc('0x15')],_0x57642f,_0x44fda1||_0x40bc('0x16'));if(_0x44fda1){var _0x5e50bb=_[_0x40bc('0x17')](_0x1838a7[_0x40bc('0x18')](),{'p':_0x44fda1});if(_0x5e50bb>=0x0){logger[_0x40bc('0x19')](_0x40bc('0x1a'),_0x55df98,_0x44fda1||'next',_0x5e50bb);_0x1838a7['next'](_0x5e50bb);}else{logger[_0x40bc('0x19')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x55df98,_0x44fda1||_0x40bc('0x16'));_0x1838a7[_0x40bc('0x1b')]();}}else{_0x1838a7[_0x40bc('0x16')]();}}catch(_0x196cba){logger[_0x40bc('0xe')](_0x40bc('0x1c'),_0x55df98,_0x196cba[_0x40bc('0x11')]);_0x1838a7[_0x40bc('0x1b')]();}}}catch(_0xded37){logger[_0x40bc('0xe')]('[%s][GOTOIF]\x20%s',_0x55df98,JSON[_0x40bc('0x1d')](_0xded37));_0x1838a7['stop']();}};}; \ No newline at end of file +var _0x2118=['lodash','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','join','stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate'];(function(_0x4d9c59,_0x4e44c8){var _0x166b0b=function(_0x2c26bf){while(--_0x2c26bf){_0x4d9c59['push'](_0x4d9c59['shift']());}};_0x166b0b(++_0x4e44c8);}(_0x2118,0x194));var _0x8211=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x2118[_0x3e5086];return _0xfeb102;};'use strict';var schema=require(_0x8211('0x0'));var _=require(_0x8211('0x1'));var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x8211('0x2'))(_0x8211('0x3'));var gotoif=schema({'condition':{'type':_0x8211('0x4'),'required':!![],'message':_0x8211('0x5')},'priorityTrue':{'type':'number','message':_0x8211('0x6')},'priorityFalse':{'type':_0x8211('0x7'),'message':_0x8211('0x8')}});exports[_0x8211('0x9')]=function(_0x3be54c,_0x140a13){return function(_0x50b590){try{var _0x480906={'condition':htmlToText[_0x8211('0xa')](utils[_0x8211('0xb')](_0x140a13[0x0],this),{'wordwrap':![]})[_0x8211('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x140a13[0x1],'priorityFalse':_0x140a13[0x2]};var _0x3b04b0=gotoif[_0x8211('0x0')](_0x480906,{'typecast':!![]});if(_0x3b04b0[_0x8211('0xd')]){logger[_0x8211('0xe')]('[%s][GOTOIF]\x20%s',_0x3be54c,_['map'](_0x3b04b0,'message')[_0x8211('0xf')](',\x20'));_0x50b590[_0x8211('0x10')]();}else{try{var _0x3c9be3=eval('('+_0x480906[_0x8211('0x11')]+')');var _0x4db80d=_0x3c9be3?_0x480906[_0x8211('0x12')]:_0x480906[_0x8211('0x13')];logger[_0x8211('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3be54c,_0x480906[_0x8211('0x11')],_0x3c9be3,_0x4db80d||'next');if(_0x4db80d){var _0x39f10e=_[_0x8211('0x15')](_0x50b590[_0x8211('0x16')](),{'p':_0x4db80d});if(_0x39f10e>=0x0){logger['info'](_0x8211('0x17'),_0x3be54c,_0x4db80d||_0x8211('0x18'),_0x39f10e);_0x50b590[_0x8211('0x18')](_0x39f10e);}else{logger[_0x8211('0x14')](_0x8211('0x19'),_0x3be54c,_0x4db80d||_0x8211('0x18'));_0x50b590['stop']();}}else{_0x50b590[_0x8211('0x18')]();}}catch(_0x4615cb){logger[_0x8211('0xe')](_0x8211('0x1a'),_0x3be54c,_0x4615cb['message']);_0x50b590[_0x8211('0x10')]();}}}catch(_0x4f9fb7){logger[_0x8211('0xe')]('[%s][GOTOIF]\x20%s',_0x3be54c,JSON['stringify'](_0x4f9fb7));_0x50b590[_0x8211('0x10')]();}};}; \ 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 9edfd2d..d67f168 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 _0x921f=['[%s][GOTOP]\x20%s','join','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stop','validate','../../../../config/logger','routing','number','consequence','length'];(function(_0x39e5a0,_0x2b63ff){var _0x22bead=function(_0x17b526){while(--_0x17b526){_0x39e5a0['push'](_0x39e5a0['shift']());}};_0x22bead(++_0x2b63ff);}(_0x921f,0xe8));var _0xf921=function(_0x3dfa59,_0x53979e){_0x3dfa59=_0x3dfa59-0x0;var _0xe41499=_0x921f[_0x3dfa59];return _0xe41499;};'use strict';var schema=require(_0xf921('0x0'));var _=require('lodash');var logger=require(_0xf921('0x1'))(_0xf921('0x2'));var gotop=schema({'priority':{'type':_0xf921('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf921('0x4')]=function(_0x1c2524,_0x475118){return function(_0x4d1633){try{var _0x2ce407={'priority':_0x475118[0x0]};var _0x85e7cd=gotop[_0xf921('0x0')](_0x2ce407,{'typecast':!![]});if(_0x85e7cd[_0xf921('0x5')]){logger['error'](_0xf921('0x6'),_0x1c2524,_['map'](_0x85e7cd,'message')[_0xf921('0x7')](',\x20'));_0x4d1633['stop']();}else{logger[_0xf921('0x8')]('[%s][GOTOP]\x20priority\x20%s',_0x1c2524,_0x2ce407[_0xf921('0x9')]);if(_0x2ce407[_0xf921('0x9')]){var _0x78d3ed=_[_0xf921('0xa')](_0x4d1633[_0xf921('0xb')](),{'p':_0x2ce407[_0xf921('0x9')]});if(_0x78d3ed>=0x0){logger[_0xf921('0x8')](_0xf921('0xc'),_0x1c2524,_0x2ce407[_0xf921('0x9')]||_0xf921('0xd'),_0x78d3ed);_0x4d1633[_0xf921('0xd')](_0x78d3ed);}else{logger['info'](_0xf921('0xe'),_0x1c2524,_0x2ce407['priority']||_0xf921('0xd'));_0x4d1633['stop']();}}else{_0x4d1633[_0xf921('0xd')]();}}}catch(_0x174770){logger[_0xf921('0xf')](_0xf921('0x6'),_0x1c2524,JSON['stringify'](_0x174770));_0x4d1633[_0xf921('0x10')]();}};}; \ No newline at end of file +var _0xf145=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info'];(function(_0x54f518,_0xac40b){var _0x5a59dd=function(_0x1da504){while(--_0x1da504){_0x54f518['push'](_0x54f518['shift']());}};_0x5a59dd(++_0xac40b);}(_0xf145,0x16c));var _0x5f14=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xf145[_0xd511d];return _0x3f148e;};'use strict';var schema=require(_0x5f14('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x5f14('0x1')}});exports[_0x5f14('0x2')]=function(_0x467a73,_0x8d870){return function(_0x556ce6){try{var _0x240d37={'priority':_0x8d870[0x0]};var _0x1795dc=gotop['validate'](_0x240d37,{'typecast':!![]});if(_0x1795dc[_0x5f14('0x3')]){logger[_0x5f14('0x4')](_0x5f14('0x5'),_0x467a73,_[_0x5f14('0x6')](_0x1795dc,_0x5f14('0x7'))[_0x5f14('0x8')](',\x20'));_0x556ce6[_0x5f14('0x9')]();}else{logger['info'](_0x5f14('0xa'),_0x467a73,_0x240d37[_0x5f14('0xb')]);if(_0x240d37['priority']){var _0x358174=_['findIndex'](_0x556ce6[_0x5f14('0xc')](),{'p':_0x240d37['priority']});if(_0x358174>=0x0){logger[_0x5f14('0xd')](_0x5f14('0xe'),_0x467a73,_0x240d37[_0x5f14('0xb')]||_0x5f14('0xf'),_0x358174);_0x556ce6[_0x5f14('0xf')](_0x358174);}else{logger[_0x5f14('0xd')](_0x5f14('0x10'),_0x467a73,_0x240d37[_0x5f14('0xb')]||'next');_0x556ce6[_0x5f14('0x9')]();}}else{_0x556ce6[_0x5f14('0xf')]();}}}catch(_0x339246){logger[_0x5f14('0x4')](_0x5f14('0x5'),_0x467a73,JSON[_0x5f14('0x11')](_0x339246));_0x556ce6[_0x5f14('0x9')]();}};}; \ 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 c93deac..e831da9 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 _0xf663=['create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','channel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf663,0x1aa));var _0x3f66=function(_0x49fa6e,_0x2e53e8){_0x49fa6e=_0x49fa6e-0x0;var _0x447f5b=_0xf663[_0x49fa6e];return _0x447f5b;};'use strict';var _=require('lodash');var utils=require(_0x3f66('0x0'));var logger=require(_0x3f66('0x1'))(_0x3f66('0x2'));var rpc={'chatMessage':require(_0x3f66('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3f66('0x4'))};exports[_0x3f66('0x5')]=function(_0x2dc3f2,_0x3dc4ad){return function(_0x3a18e4){try{var _0x2f61a3={'body':utils[_0x3f66('0x6')](_0x3dc4ad[0x0],this),'ContactId':this[_0x3f66('0x7')]['id']};if(this['channel']===_0x3f66('0x8')){_0x2f61a3[_0x3f66('0x9')]=this[_0x3f66('0xa')]['id'];}else{_0x2f61a3[_[_0x3f66('0xb')](this['channel'])+'AccountId']=this[_0x3f66('0xa')]['id'];}_0x2f61a3[_[_0x3f66('0xb')](this['channel'])+_0x3f66('0xc')]=this[_0x3f66('0xd')]['id'];if(rpc[this['channel']+_0x3f66('0xe')]){return rpc[this[_0x3f66('0xf')]+'Message'][_0x3f66('0x10')](_0x2f61a3)[_0x3f66('0x11')](function(_0x30d368){logger[_0x3f66('0x12')]('[%s][MESSAGE]\x20%s',_0x2dc3f2,_0x2f61a3[_0x3f66('0x13')]);_0x3a18e4[_0x3f66('0x14')]();})[_0x3f66('0x15')](function(_0x127546){logger[_0x3f66('0x16')](_0x3f66('0x17'),_0x2dc3f2,JSON[_0x3f66('0x18')](_0x127546));_0x3a18e4[_0x3f66('0x19')]();});}}catch(_0x80838c){logger[_0x3f66('0x16')]('[%s][MESSAGE]\x20%s',_0x2dc3f2,JSON[_0x3f66('0x18')](_0x80838c));_0x3a18e4['stop']();}};}; \ No newline at end of file +var _0x36ad=['Message','create','then','info','[%s][MESSAGE]\x20%s','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','InteractionId','interaction'];(function(_0x4eff77,_0x23cb4a){var _0x5bf6d5=function(_0x22bc8e){while(--_0x22bc8e){_0x4eff77['push'](_0x4eff77['shift']());}};_0x5bf6d5(++_0x23cb4a);}(_0x36ad,0x95));var _0xd36a=function(_0x37c631,_0x264bf8){_0x37c631=_0x37c631-0x0;var _0x1589d4=_0x36ad[_0x37c631];return _0x1589d4;};'use strict';var _=require(_0xd36a('0x0'));var utils=require(_0xd36a('0x1'));var logger=require(_0xd36a('0x2'))(_0xd36a('0x3'));var rpc={'chatMessage':require(_0xd36a('0x4')),'openchannelMessage':require(_0xd36a('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd36a('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd36a('0x7'))};exports[_0xd36a('0x8')]=function(_0x352dc1,_0x276f48){return function(_0x51290f){try{var _0x45e3af={'body':utils[_0xd36a('0x9')](_0x276f48[0x0],this),'ContactId':this[_0xd36a('0xa')]['id']};if(this['channel']===_0xd36a('0xb')){_0x45e3af[_0xd36a('0xc')]=this[_0xd36a('0xd')]['id'];}else{_0x45e3af[_[_0xd36a('0xe')](this[_0xd36a('0xf')])+_0xd36a('0x10')]=this['account']['id'];}_0x45e3af[_[_0xd36a('0xe')](this[_0xd36a('0xf')])+_0xd36a('0x11')]=this[_0xd36a('0x12')]['id'];if(rpc[this['channel']+_0xd36a('0x13')]){return rpc[this['channel']+_0xd36a('0x13')][_0xd36a('0x14')](_0x45e3af)[_0xd36a('0x15')](function(_0x589a1b){logger[_0xd36a('0x16')](_0xd36a('0x17'),_0x352dc1,_0x45e3af['body']);_0x51290f['next']();})[_0xd36a('0x18')](function(_0x435613){logger['error']('[%s][MESSAGE]\x20%s',_0x352dc1,JSON[_0xd36a('0x19')](_0x435613));_0x51290f[_0xd36a('0x1a')]();});}}catch(_0x187079){logger[_0xd36a('0x1b')]('[%s][MESSAGE]\x20%s',_0x352dc1,JSON[_0xd36a('0x19')](_0x187079));_0x51290f[_0xd36a('0x1a')]();}};}; \ 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 bb5d3ca..6330369 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 _0xf9fa=['info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','../../../../config/logger','routing'];(function(_0x34c403,_0x341b70){var _0x5bf2b9=function(_0x300064){while(--_0x300064){_0x34c403['push'](_0x34c403['shift']());}};_0x5bf2b9(++_0x341b70);}(_0xf9fa,0x136));var _0xaf9f=function(_0x341745,_0x3d0788){_0x341745=_0x341745-0x0;var _0x488769=_0xf9fa[_0x341745];return _0x488769;};'use strict';var utils=require('./utils');var logger=require(_0xaf9f('0x0'))(_0xaf9f('0x1'));exports['consequence']=function(_0x2fa6a6,_0x47a2d9){return function(_0x3ebf9d){try{logger[_0xaf9f('0x2')](_0xaf9f('0x3'),_0x2fa6a6,utils[_0xaf9f('0x4')](_0x47a2d9[0x0],this));_0x3ebf9d[_0xaf9f('0x5')]();}catch(_0x7eb1ab){logger['error'](_0xaf9f('0x3'),_0x2fa6a6,JSON[_0xaf9f('0x6')](_0x7eb1ab));_0x3ebf9d[_0xaf9f('0x7')]();}};}; \ No newline at end of file +var _0xc877=['./utils','../../../../config/logger','routing','info','next','error','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xc877,0x129));var _0x7c87=function(_0x5297c1,_0x2636a7){_0x5297c1=_0x5297c1-0x0;var _0x1086c2=_0xc877[_0x5297c1];return _0x1086c2;};'use strict';var utils=require(_0x7c87('0x0'));var logger=require(_0x7c87('0x1'))(_0x7c87('0x2'));exports['consequence']=function(_0x44f54f,_0x491c54){return function(_0x4b9b4e){try{logger[_0x7c87('0x3')]('[%s][NOOP]\x20%s',_0x44f54f,utils['getMustacheRender'](_0x491c54[0x0],this));_0x4b9b4e[_0x7c87('0x4')]();}catch(_0x21f59e){logger[_0x7c87('0x5')](_0x7c87('0x6'),_0x44f54f,JSON[_0x7c87('0x7')](_0x21f59e));_0x4b9b4e[_0x7c87('0x8')]();}};}; \ 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 e122ef9..e88728a 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 _0x12fa=['channel','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','atimeout','[%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','moment','../../../../config/environment','redis','account','queue','emit','queue_id','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst'];(function(_0x2f7c4e,_0x12dfeb){var _0xd1b287=function(_0x3d6f12){while(--_0x3d6f12){_0x2f7c4e['push'](_0x2f7c4e['shift']());}};_0xd1b287(++_0x12dfeb);}(_0x12fa,0x6f));var _0xa12f=function(_0x5679a4,_0x1f420b){_0x5679a4=_0x5679a4-0x0;var _0x397109=_0x12fa[_0x5679a4];return _0x397109;};'use strict';var schema=require(_0xa12f('0x0'));var _=require(_0xa12f('0x1'));var util=require(_0xa12f('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xa12f('0x3'));var Redis=require('ioredis');var config=require(_0xa12f('0x4'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config['redis']=_['defaults'](config[_0xa12f('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id','queue_id',_0xa12f('0x6'),_0xa12f('0x7'),'from','joinAt'];function emit(_0x34ae40,_0x2e48c2,_0x1020f2){io['to'](_0x34ae40)[_0xa12f('0x8')](_0x2e48c2,_0x1020f2);}function emitChannelQueueInteraction(_0x2578bc,_0xe2fca0,_0x1a824e,_0x4b4742,_0x1ff14b,_0x27cfd5,_0x1e3736,_0x3c81da){var _0x2b9869=_['clone'](_0x1a824e);_0x2b9869[_0xa12f('0x9')]=_0x3c81da;_0x2b9869[_0xa12f('0x7')]=_0xe2fca0;_0x2b9869['account']=_0x4b4742;_0x2b9869['id']=_0x1ff14b;if(_0x27cfd5){_0x1e3736[util[_0xa12f('0xa')](_0xa12f('0xb'),_0x2578bc)][_0x1ff14b]=_[_0xa12f('0xc')](_0x2b9869,attributes);}else{delete _0x1e3736[util[_0xa12f('0xa')](_0xa12f('0xb'),_0x2578bc)][_0x1ff14b];}emit(util['format'](_0xa12f('0xd'),_0x2578bc,_0xe2fca0),util[_0xa12f('0xa')]('%s_queue_waiting_interaction:%s',_0x2578bc,_0x27cfd5?_0xa12f('0xe'):_0xa12f('0xf')),_['pick'](_0x2b9869,attributes));}var rpc={'openchannelQueueReport':require(_0xa12f('0x10')),'mailQueueReport':require(_0xa12f('0x11')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xa12f('0x12')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa12f('0x13'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xa12f('0x14')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x4eac7f,_0x340381,_0x5f1f33,_0x8f69b2){if(_0x4eac7f&&_0x340381&&_0x5f1f33){_0x340381[_0xa12f('0x15')]+=0x1;var _0x21a5b0={'uniqueid':_0x4eac7f,'from':_0x5f1f33[_0xa12f('0x16')]?_0x5f1f33['body'][_0xa12f('0x17')]:'','joinAt':moment()[_0xa12f('0xa')](_0xa12f('0x18')),'ContactId':_0x5f1f33[_0xa12f('0x19')]?_0x5f1f33[_0xa12f('0x19')]['id']:null,'ListId':_0x5f1f33['list']?_0x5f1f33[_0xa12f('0x1a')]['id']:null};_0x21a5b0[_['upperFirst'](_0x5f1f33['channel'])+_0xa12f('0x1b')]=_0x340381['id']||null;_0x21a5b0[_[_0xa12f('0x1c')](_0x5f1f33[_0xa12f('0x1d')])+'InteractionId']=_0x5f1f33['interaction']?_0x5f1f33[_0xa12f('0x1e')]['id']:null;_0x21a5b0[_[_0xa12f('0x1c')](_0x5f1f33[_0xa12f('0x1d')])+'MessageId']=_0x5f1f33[_0xa12f('0x1f')]?_0x5f1f33[_0xa12f('0x1f')]['id']:null;_0x21a5b0[_[_0xa12f('0x1c')](_0x5f1f33[_0xa12f('0x1d')])+(_0x5f1f33['channel']!==_0xa12f('0x20')?_0xa12f('0x21'):_0xa12f('0x22'))]=_0x5f1f33[_0xa12f('0x6')]?_0x5f1f33['account']['id']:null;logger[_0xa12f('0x23')](util['format'](_0xa12f('0x24'),_0x4eac7f,_0x340381[_0xa12f('0x25')]));emitChannelQueueInteraction(_0x5f1f33[_0xa12f('0x1d')],_0x340381[_0xa12f('0x25')],_0x21a5b0,_0x5f1f33['account']['name'],_0x5f1f33[_0xa12f('0x1f')]['id'],!![],_0x8f69b2,_0x340381['id']);if(rpc[_0x5f1f33['channel']+_0xa12f('0x26')]){return rpc[_0x5f1f33['channel']+_0xa12f('0x26')][_0xa12f('0x27')](_0x21a5b0)[_0xa12f('0x28')](function(_0x4337db){logger['error'](_0xa12f('0x29'));});}}}function stopRouting(_0x285842,_0x3d8adb,_0x29bdd8,_0x2ca1ee){if(_0x285842&&_0x3d8adb){_0x3d8adb['waiting']-=0x1;var _0xae06e1={'leaveAt':moment()[_0xa12f('0xa')](_0xa12f('0x18')),'acceptAt':moment()[_0xa12f('0xa')](_0xa12f('0x18')),'reason':_0xa12f('0x2a')};logger[_0xa12f('0x23')](util['format'](_0xa12f('0x2b'),_0x285842,_0x3d8adb[_0xa12f('0x25')]));emitChannelQueueInteraction(_0x29bdd8[_0xa12f('0x1d')],_0x3d8adb[_0xa12f('0x25')],_0x29bdd8[_0xa12f('0x16')],_0x29bdd8[_0xa12f('0x6')][_0xa12f('0x25')],_0x29bdd8[_0xa12f('0x1f')]['id'],![],_0x2ca1ee,_0x3d8adb['id']);if(rpc[_0x29bdd8[_0xa12f('0x1d')]+_0xa12f('0x26')]){return rpc[_0x29bdd8[_0xa12f('0x1d')]+_0xa12f('0x26')][_0xa12f('0x2c')](_0x285842,_0xae06e1)[_0xa12f('0x28')](function(_0x5e5f19){logger[_0xa12f('0x2d')](_0xa12f('0x2e'));});}}}function endRouting(_0x3edd6f,_0x1fd2ca,_0x46df3c,_0x5ae4a9){if(_0x3edd6f&&_0x1fd2ca){_0x1fd2ca[_0xa12f('0x15')]-=0x1;var _0x23e69d={'leaveAt':moment()[_0xa12f('0xa')](_0xa12f('0x18')),'exitAt':moment()[_0xa12f('0xa')](_0xa12f('0x18')),'reason':_0xa12f('0x2f')};logger[_0xa12f('0x23')](util[_0xa12f('0xa')](_0xa12f('0x30'),_0x3edd6f,_0x1fd2ca[_0xa12f('0x25')]));emitChannelQueueInteraction(_0x46df3c[_0xa12f('0x1d')],_0x1fd2ca[_0xa12f('0x25')],_0x46df3c[_0xa12f('0x16')],_0x46df3c[_0xa12f('0x6')]['name'],_0x46df3c[_0xa12f('0x1f')]['id'],![],_0x5ae4a9);if(rpc[_0x46df3c['channel']+_0xa12f('0x26')]){return rpc[_0x46df3c[_0xa12f('0x1d')]+_0xa12f('0x26')]['update'](_0x3edd6f,_0x23e69d)[_0xa12f('0x28')](function(_0x158be3){logger[_0xa12f('0x2d')](_0xa12f('0x2e'));});}}}function handleFindQueue(_0x532840){return function(_0x15733d){return _0x15733d['name'][_0xa12f('0x31')]()===_0x532840[_0xa12f('0x31')]();};}exports[_0xa12f('0x32')]=function(_0x416912,_0x37d472,_0x5074a2,_0x1e2049){return function(_0x28f054){try{var _0x2932df={'name':_0x37d472[0x0],'timeout':_0x37d472[0x1]};var _0x6623ff=queue[_0xa12f('0x0')](_0x2932df,{'typecast':!![]});if(_0x6623ff[_0xa12f('0x33')]){logger['error'](_0xa12f('0x34'),_0x416912,_[_0xa12f('0x35')](_0x6623ff,_0xa12f('0x1f'))[_0xa12f('0x36')](',\x20'));_0x28f054[_0xa12f('0x37')]();}else{var _0xb9d25d=_['find'](_0x5074a2[_0x1e2049[_0xa12f('0x1d')]+_0xa12f('0x38')],handleFindQueue(_0x2932df[_0xa12f('0x25')]));if(_0xb9d25d){startRouting(_0x416912,_0xb9d25d,_0x1e2049,_0x5074a2);var _0x415de0=(_0xb9d25d['timeout']||0xa)*0x3e8;var _0x42a2bc=(_0x2932df[_0xa12f('0x2f')]||0x14)*0x3e8;var _0x48ab03,_0xddf6d5;if(_0x415de0>_0x42a2bc){_0x42a2bc=_0x415de0;}var _0x19356c=seqqueue['createQueue'](_0x415de0);_0x19356c['id']=_0x416912;_0x19356c[_0xa12f('0x39')]=_0x415de0;_0x19356c['qtimeout']=_0x42a2bc;_0x19356c['channel']=_0x1e2049[_0xa12f('0x1d')];_0x5074a2['rules'][_0x416912]['on']('end',function(){logger[_0xa12f('0x23')](_0xa12f('0x3a'),_0x416912);stopRouting(_0x416912,_0xb9d25d,_0x1e2049,_0x5074a2);clearTimeout(_0x48ab03);_0x48ab03=undefined;_0x19356c[_0xa12f('0x3b')](!![]);if(_0x5074a2[_0xa12f('0x3c')][_0x416912]){delete _0x5074a2[_0xa12f('0x3c')][_0x416912];}_0x28f054['stop']();});_0x5074a2[_0xa12f('0x3c')][_0x416912]['on'](_0xa12f('0x3d'),function(){if(_0x5074a2[_0xa12f('0x3c')][_0x416912]){delete _0x5074a2[_0xa12f('0x3c')][_0x416912];}});_0x48ab03=setTimeout(function(){logger['info'](_0xa12f('0x3e'),_0x416912);endRouting(_0x416912,_0xb9d25d,_0x1e2049,_0x5074a2);clearTimeout(_0x48ab03);_0x19356c['close'](!![]);_0x28f054[_0xa12f('0x3f')]();},_0x42a2bc);switch(_0xb9d25d[_0xa12f('0x40')]){case _0xa12f('0x41'):strategy[_0xa12f('0x41')](_0x19356c,_0xb9d25d,_0x5074a2,_0x1e2049);break;default:strategy[_0xa12f('0x42')](_0x19356c,_0xb9d25d,_0x5074a2,_0x1e2049);}}else{logger[_0xa12f('0x2d')](_0xa12f('0x43'),_0x416912,_0x2932df['name']);_0x28f054[_0xa12f('0x37')]();}}}catch(_0x273c73){console[_0xa12f('0x44')](_0x273c73);logger[_0xa12f('0x2d')]('[%s][QUEUE]\x20%s',_0x416912,_0x273c73[_0xa12f('0x45')]);_0x28f054[_0xa12f('0x37')]();}};}; \ No newline at end of file +var _0xcf33=['remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','interaction','channel','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','find','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','../../../../config/environment','../../../../config/logger','routing','redis','localhost','queue_id','account','from','joinAt','emit','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save'];(function(_0x5afec7,_0x3710e8){var _0x3d72d0=function(_0xae2974){while(--_0xae2974){_0x5afec7['push'](_0x5afec7['shift']());}};_0x3d72d0(++_0x3710e8);}(_0xcf33,0x114));var _0x3cf3=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xcf33[_0x4a53d];return _0x27410e;};'use strict';var schema=require(_0x3cf3('0x0'));var _=require(_0x3cf3('0x1'));var util=require(_0x3cf3('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x3cf3('0x3'));var Redis=require('ioredis');var config=require(_0x3cf3('0x4'));var logger=require(_0x3cf3('0x5'))(_0x3cf3('0x6'));var strategy=require('./strategy');config[_0x3cf3('0x7')]=_['defaults'](config[_0x3cf3('0x7')],{'host':_0x3cf3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3cf3('0x7')]));var attributes=['id',_0x3cf3('0x9'),_0x3cf3('0xa'),'queue',_0x3cf3('0xb'),_0x3cf3('0xc')];function emit(_0x2c24e2,_0x1a3572,_0x45b370){io['to'](_0x2c24e2)[_0x3cf3('0xd')](_0x1a3572,_0x45b370);}function emitChannelQueueInteraction(_0x5c7478,_0x564664,_0xfbaae8,_0x411f83,_0x8ed04e,_0x985e2a,_0x124ee2,_0x4744b3){var _0x4b8e82=_['clone'](_0xfbaae8);_0x4b8e82[_0x3cf3('0x9')]=_0x4744b3;_0x4b8e82['queue']=_0x564664;_0x4b8e82[_0x3cf3('0xa')]=_0x411f83;_0x4b8e82['id']=_0x8ed04e;if(_0x985e2a){_0x124ee2[util['format'](_0x3cf3('0xe'),_0x5c7478)][_0x8ed04e]=_[_0x3cf3('0xf')](_0x4b8e82,attributes);}else{delete _0x124ee2[util[_0x3cf3('0x10')](_0x3cf3('0xe'),_0x5c7478)][_0x8ed04e];}emit(util[_0x3cf3('0x10')](_0x3cf3('0x11'),_0x5c7478,_0x564664),util[_0x3cf3('0x10')](_0x3cf3('0x12'),_0x5c7478,_0x985e2a?_0x3cf3('0x13'):_0x3cf3('0x14')),_[_0x3cf3('0xf')](_0x4b8e82,attributes));}var rpc={'openchannelQueueReport':require(_0x3cf3('0x15')),'mailQueueReport':require(_0x3cf3('0x16')),'chatQueueReport':require(_0x3cf3('0x17')),'smsQueueReport':require(_0x3cf3('0x18')),'faxQueueReport':require(_0x3cf3('0x19')),'whatsappQueueReport':require(_0x3cf3('0x1a'))};var queue=schema({'name':{'type':_0x3cf3('0x1b'),'required':!![],'message':_0x3cf3('0x1c')},'timeout':{'type':'number','message':_0x3cf3('0x1d')}});function startRouting(_0x3a8f34,_0x3fddba,_0x4c50a0,_0x4b2cdb){if(_0x3a8f34&&_0x3fddba&&_0x4c50a0){_0x3fddba[_0x3cf3('0x1e')]+=0x1;var _0x498698={'uniqueid':_0x3a8f34,'from':_0x4c50a0[_0x3cf3('0x1f')]?_0x4c50a0[_0x3cf3('0x1f')]['from']:'','joinAt':moment()[_0x3cf3('0x10')](_0x3cf3('0x20')),'ContactId':_0x4c50a0[_0x3cf3('0x21')]?_0x4c50a0['contact']['id']:null,'ListId':_0x4c50a0['list']?_0x4c50a0[_0x3cf3('0x22')]['id']:null};_0x498698[_['upperFirst'](_0x4c50a0['channel'])+_0x3cf3('0x23')]=_0x3fddba['id']||null;_0x498698[_[_0x3cf3('0x24')](_0x4c50a0['channel'])+'InteractionId']=_0x4c50a0[_0x3cf3('0x25')]?_0x4c50a0[_0x3cf3('0x25')]['id']:null;_0x498698[_[_0x3cf3('0x24')](_0x4c50a0[_0x3cf3('0x26')])+'MessageId']=_0x4c50a0[_0x3cf3('0x27')]?_0x4c50a0[_0x3cf3('0x27')]['id']:null;_0x498698[_['upperFirst'](_0x4c50a0['channel'])+(_0x4c50a0[_0x3cf3('0x26')]!==_0x3cf3('0x28')?_0x3cf3('0x29'):_0x3cf3('0x2a'))]=_0x4c50a0[_0x3cf3('0xa')]?_0x4c50a0[_0x3cf3('0xa')]['id']:null;logger[_0x3cf3('0x2b')](util[_0x3cf3('0x10')](_0x3cf3('0x2c'),_0x3a8f34,_0x3fddba[_0x3cf3('0x2d')]));emitChannelQueueInteraction(_0x4c50a0[_0x3cf3('0x26')],_0x3fddba[_0x3cf3('0x2d')],_0x498698,_0x4c50a0[_0x3cf3('0xa')][_0x3cf3('0x2d')],_0x4c50a0[_0x3cf3('0x27')]['id'],!![],_0x4b2cdb,_0x3fddba['id']);if(rpc[_0x4c50a0[_0x3cf3('0x26')]+_0x3cf3('0x2e')]){return rpc[_0x4c50a0[_0x3cf3('0x26')]+_0x3cf3('0x2e')][_0x3cf3('0x2f')](_0x498698)[_0x3cf3('0x30')](function(_0x5b911d){logger[_0x3cf3('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x1c061c,_0x19c891,_0x104955,_0x34b3e2){if(_0x1c061c&&_0x19c891){_0x19c891[_0x3cf3('0x1e')]-=0x1;var _0x127257={'leaveAt':moment()[_0x3cf3('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x3cf3('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x1c061c,_0x19c891[_0x3cf3('0x2d')]));emitChannelQueueInteraction(_0x104955['channel'],_0x19c891['name'],_0x104955[_0x3cf3('0x1f')],_0x104955['account'][_0x3cf3('0x2d')],_0x104955[_0x3cf3('0x27')]['id'],![],_0x34b3e2,_0x19c891['id']);if(rpc[_0x104955[_0x3cf3('0x26')]+_0x3cf3('0x2e')]){return rpc[_0x104955['channel']+_0x3cf3('0x2e')][_0x3cf3('0x32')](_0x1c061c,_0x127257)['catch'](function(_0x4a9702){logger[_0x3cf3('0x31')](_0x3cf3('0x33'));});}}}function endRouting(_0xea8816,_0x41e0be,_0xc12b43,_0xf590a2){if(_0xea8816&&_0x41e0be){_0x41e0be[_0x3cf3('0x1e')]-=0x1;var _0x44bc99={'leaveAt':moment()[_0x3cf3('0x10')](_0x3cf3('0x20')),'exitAt':moment()['format'](_0x3cf3('0x20')),'reason':'timeout'};logger[_0x3cf3('0x2b')](util[_0x3cf3('0x10')](_0x3cf3('0x34'),_0xea8816,_0x41e0be[_0x3cf3('0x2d')]));emitChannelQueueInteraction(_0xc12b43[_0x3cf3('0x26')],_0x41e0be[_0x3cf3('0x2d')],_0xc12b43[_0x3cf3('0x1f')],_0xc12b43['account'][_0x3cf3('0x2d')],_0xc12b43[_0x3cf3('0x27')]['id'],![],_0xf590a2);if(rpc[_0xc12b43[_0x3cf3('0x26')]+_0x3cf3('0x2e')]){return rpc[_0xc12b43[_0x3cf3('0x26')]+_0x3cf3('0x2e')][_0x3cf3('0x32')](_0xea8816,_0x44bc99)[_0x3cf3('0x30')](function(_0x4e0da5){logger[_0x3cf3('0x31')](_0x3cf3('0x33'));});}}}function handleFindQueue(_0x3f2c7b){return function(_0x5728b6){return _0x5728b6[_0x3cf3('0x2d')][_0x3cf3('0x35')]()===_0x3f2c7b[_0x3cf3('0x35')]();};}exports[_0x3cf3('0x36')]=function(_0x23b769,_0x16bc5b,_0x5164b1,_0x29a95a){return function(_0x384cc2){try{var _0x236749={'name':_0x16bc5b[0x0],'timeout':_0x16bc5b[0x1]};var _0x39d2d6=queue[_0x3cf3('0x0')](_0x236749,{'typecast':!![]});if(_0x39d2d6[_0x3cf3('0x37')]){logger[_0x3cf3('0x31')](_0x3cf3('0x38'),_0x23b769,_['map'](_0x39d2d6,_0x3cf3('0x27'))['join'](',\x20'));_0x384cc2['stop']();}else{var _0xd33197=_[_0x3cf3('0x39')](_0x5164b1[_0x29a95a[_0x3cf3('0x26')]+'Queues'],handleFindQueue(_0x236749[_0x3cf3('0x2d')]));if(_0xd33197){startRouting(_0x23b769,_0xd33197,_0x29a95a,_0x5164b1);var _0x5cddc9=(_0xd33197['timeout']||0xa)*0x3e8;var _0x328a62=(_0x236749[_0x3cf3('0x3a')]||0x14)*0x3e8;var _0x5db6be,_0x4159b3;if(_0x5cddc9>_0x328a62){_0x328a62=_0x5cddc9;}var _0x4904c4=seqqueue[_0x3cf3('0x3b')](_0x5cddc9);_0x4904c4['id']=_0x23b769;_0x4904c4['atimeout']=_0x5cddc9;_0x4904c4['qtimeout']=_0x328a62;_0x4904c4[_0x3cf3('0x26')]=_0x29a95a[_0x3cf3('0x26')];_0x5164b1[_0x3cf3('0x3c')][_0x23b769]['on'](_0x3cf3('0x3d'),function(){logger[_0x3cf3('0x2b')](_0x3cf3('0x3e'),_0x23b769);stopRouting(_0x23b769,_0xd33197,_0x29a95a,_0x5164b1);clearTimeout(_0x5db6be);_0x5db6be=undefined;_0x4904c4[_0x3cf3('0x3f')](!![]);if(_0x5164b1[_0x3cf3('0x3c')][_0x23b769]){delete _0x5164b1[_0x3cf3('0x3c')][_0x23b769];}_0x384cc2[_0x3cf3('0x40')]();});_0x5164b1['rules'][_0x23b769]['on'](_0x3cf3('0x41'),function(){if(_0x5164b1[_0x3cf3('0x3c')][_0x23b769]){delete _0x5164b1[_0x3cf3('0x3c')][_0x23b769];}});_0x5db6be=setTimeout(function(){logger[_0x3cf3('0x2b')](_0x3cf3('0x42'),_0x23b769);endRouting(_0x23b769,_0xd33197,_0x29a95a,_0x5164b1);clearTimeout(_0x5db6be);_0x4904c4[_0x3cf3('0x3f')](!![]);_0x384cc2[_0x3cf3('0x43')]();},_0x328a62);switch(_0xd33197[_0x3cf3('0x44')]){case _0x3cf3('0x45'):strategy[_0x3cf3('0x45')](_0x4904c4,_0xd33197,_0x5164b1,_0x29a95a);break;default:strategy[_0x3cf3('0x46')](_0x4904c4,_0xd33197,_0x5164b1,_0x29a95a);}}else{logger['error'](_0x3cf3('0x47'),_0x23b769,_0x236749['name']);_0x384cc2[_0x3cf3('0x40')]();}}}catch(_0x4889a9){console[_0x3cf3('0x48')](_0x4889a9);logger[_0x3cf3('0x31')](_0x3cf3('0x38'),_0x23b769,_0x4889a9[_0x3cf3('0x49')]);_0x384cc2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 589dbdd..2435721 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 _0xa7f6=['[%s][AGENT]\x20try\x20with\x20%s','agent','realtime','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype'];(function(_0x2b8957,_0x31f9f2){var _0x1ec0d9=function(_0x309b1f){while(--_0x309b1f){_0x2b8957['push'](_0x2b8957['shift']());}};_0x1ec0d9(++_0x31f9f2);}(_0xa7f6,0x72));var _0x6a7f=function(_0x2f7f7f,_0x27dcc2){_0x2f7f7f=_0x2f7f7f-0x0;var _0x5b9a36=_0xa7f6[_0x2f7f7f];return _0x5b9a36;};'use strict';var _=require(_0x6a7f('0x0'));var uuid=require(_0x6a7f('0x1'));var util=require(_0x6a7f('0x2'));var logger=require(_0x6a7f('0x3'))(_0x6a7f('0x4'));var Agent=function(_0x5eae78,_0x435d26,_0x4d339d,_0x549ea5){this[_0x6a7f('0x5')]=uuid['v4']();this[_0x6a7f('0x6')]=_0x5eae78;this['agent']=_0x435d26;this['realtime']=_0x4d339d;this['routing']=_0x549ea5;this[_0x6a7f('0x6')][_0x6a7f('0x7')](this[_0x6a7f('0x8')][_0x6a7f('0x9')](this),this[_0x6a7f('0xa')][_0x6a7f('0x9')](this));this[_0x6a7f('0x6')]['on']('timeout',this[_0x6a7f('0xa')][_0x6a7f('0x9')](this));this[_0x6a7f('0x6')]['on'](_0x6a7f('0xb'),this[_0x6a7f('0xc')][_0x6a7f('0x9')](this));};Agent[_0x6a7f('0xd')]['push']=function(){this[_0x6a7f('0x6')][_0x6a7f('0x7')](this[_0x6a7f('0x8')]['bind'](this),this[_0x6a7f('0xa')]['bind'](this));};Agent[_0x6a7f('0xd')]['handleDrained']=function(){this[_0x6a7f('0xa')](!![]);};Agent[_0x6a7f('0xd')][_0x6a7f('0x8')]=function(_0x53e83e){logger['info'](_0x6a7f('0xe'),this[_0x6a7f('0x6')]['id'],this[_0x6a7f('0xf')]['id']);if(_['isNil'](this[_0x6a7f('0x10')][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']])){logger[_0x6a7f('0x12')](_0x6a7f('0x13'),this[_0x6a7f('0x6')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x6a7f('0x4')][_0x6a7f('0x14')]||util[_0x6a7f('0x15')](this[_0x6a7f('0x6')]['id'],this['realtime']['agents'][this[_0x6a7f('0xf')]['id']],this[_0x6a7f('0x6')][_0x6a7f('0x16')],![])){this[_0x6a7f('0x10')][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']][_0x6a7f('0x17')]=!![];this[_0x6a7f('0x10')][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']][_0x6a7f('0x18')]=undefined;util['showNotification'](this[_0x6a7f('0x5')],this[_0x6a7f('0x6')]['id'],this[_0x6a7f('0x10')]['agents'][this[_0x6a7f('0xf')]['id']],null,this[_0x6a7f('0x4')]);util['writeLog'](this[_0x6a7f('0x6')]['id'],this[_0x6a7f('0x10')][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']],'RINGING'+(this['routing']['forcedOwnership']?_0x6a7f('0x19'):''));}else{logger[_0x6a7f('0x12')](_0x6a7f('0x1a'),this[_0x6a7f('0x6')]['id'],this[_0x6a7f('0xf')]['id']);setTimeout(this[_0x6a7f('0x7')][_0x6a7f('0x9')](this),0x3e8);}}};Agent[_0x6a7f('0xd')][_0x6a7f('0xa')]=function(_0x38e898){if(_[_0x6a7f('0x1b')](this['realtime']['agents'][this[_0x6a7f('0xf')]['id']])){return logger[_0x6a7f('0x12')](_0x6a7f('0x13'),this['squeue']['id'],this['agent']['id']);}else{logger['info'](_0x6a7f('0x1c'),this[_0x6a7f('0x6')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0x6a7f('0x6')]['id'],this[_0x6a7f('0x10')][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']],null,this[_0x6a7f('0x4')]);this[_0x6a7f('0x10')][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']][_0x6a7f('0x17')]=![];this['realtime'][_0x6a7f('0x11')][this[_0x6a7f('0xf')]['id']][_0x6a7f('0x18')]=undefined;util[_0x6a7f('0x1d')](this[_0x6a7f('0x6')]['id'],this[_0x6a7f('0x10')]['agents'][this[_0x6a7f('0xf')]['id']],_0x38e898?_0x6a7f('0x1e'):'TIMEOUT');}if(!_0x38e898){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x5349b5,_0x599cd5,_0x5d3562,_0x56dbaa){return new Agent(_0x5349b5,_0x599cd5,_0x5d3562,_0x56dbaa);}module[_0x6a7f('0x1f')]=agent; \ No newline at end of file +var _0x9122=['notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x5f4e27,_0x4a6767){var _0x38564a=function(_0x1cc49e){while(--_0x1cc49e){_0x5f4e27['push'](_0x5f4e27['shift']());}};_0x38564a(++_0x4a6767);}(_0x9122,0xa5));var _0x2912=function(_0xedeb5b,_0x129a28){_0xedeb5b=_0xedeb5b-0x0;var _0x3ec94f=_0x9122[_0xedeb5b];return _0x3ec94f;};'use strict';var _=require(_0x2912('0x0'));var uuid=require(_0x2912('0x1'));var util=require(_0x2912('0x2'));var logger=require(_0x2912('0x3'))(_0x2912('0x4'));var Agent=function(_0x46da56,_0x24a063,_0x394455,_0x354eb2){this[_0x2912('0x5')]=uuid['v4']();this[_0x2912('0x6')]=_0x46da56;this[_0x2912('0x7')]=_0x24a063;this[_0x2912('0x8')]=_0x394455;this[_0x2912('0x4')]=_0x354eb2;this[_0x2912('0x6')][_0x2912('0x9')](this[_0x2912('0xa')][_0x2912('0xb')](this),this[_0x2912('0xc')][_0x2912('0xb')](this));this[_0x2912('0x6')]['on']('timeout',this['handleTimeout']['bind'](this));this[_0x2912('0x6')]['on'](_0x2912('0xd'),this[_0x2912('0xe')]['bind'](this));};Agent[_0x2912('0xf')][_0x2912('0x9')]=function(){this['squeue'][_0x2912('0x9')](this[_0x2912('0xa')]['bind'](this),this['handleTimeout'][_0x2912('0xb')](this));};Agent[_0x2912('0xf')]['handleDrained']=function(){this[_0x2912('0xc')](!![]);};Agent[_0x2912('0xf')]['handleRun']=function(_0x9c1426){logger['info'](_0x2912('0x10'),this[_0x2912('0x6')]['id'],this['agent']['id']);if(_['isNil'](this['realtime']['agents'][this[_0x2912('0x7')]['id']])){logger[_0x2912('0x11')](_0x2912('0x12'),this[_0x2912('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x2912('0x9')][_0x2912('0xb')](this),0x3e8);}else{if(this[_0x2912('0x4')][_0x2912('0x13')]||util[_0x2912('0x14')](this[_0x2912('0x6')]['id'],this[_0x2912('0x8')][_0x2912('0x15')][this[_0x2912('0x7')]['id']],this[_0x2912('0x6')][_0x2912('0x16')],![])){this[_0x2912('0x8')]['agents'][this[_0x2912('0x7')]['id']][_0x2912('0x17')]=!![];this[_0x2912('0x8')][_0x2912('0x15')][this[_0x2912('0x7')]['id']][_0x2912('0x18')]=undefined;util['showNotification'](this['notificationId'],this[_0x2912('0x6')]['id'],this['realtime'][_0x2912('0x15')][this[_0x2912('0x7')]['id']],null,this[_0x2912('0x4')]);util[_0x2912('0x19')](this[_0x2912('0x6')]['id'],this[_0x2912('0x8')]['agents'][this[_0x2912('0x7')]['id']],_0x2912('0x1a')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x2912('0x11')](_0x2912('0x1b'),this[_0x2912('0x6')]['id'],this[_0x2912('0x7')]['id']);setTimeout(this['push'][_0x2912('0xb')](this),0x3e8);}}};Agent[_0x2912('0xf')]['handleTimeout']=function(_0x19f81e){if(_[_0x2912('0x1c')](this[_0x2912('0x8')][_0x2912('0x15')][this[_0x2912('0x7')]['id']])){return logger[_0x2912('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);}else{logger[_0x2912('0x11')](_0x2912('0x1d'),this[_0x2912('0x6')]['id'],this[_0x2912('0x7')]['id']);util[_0x2912('0x1e')](this[_0x2912('0x5')],this[_0x2912('0x6')]['id'],this[_0x2912('0x8')][_0x2912('0x15')][this['agent']['id']],null,this[_0x2912('0x4')]);this[_0x2912('0x8')][_0x2912('0x15')][this['agent']['id']]['busy']=![];this[_0x2912('0x8')]['agents'][this[_0x2912('0x7')]['id']][_0x2912('0x18')]=undefined;util[_0x2912('0x19')](this[_0x2912('0x6')]['id'],this['realtime'][_0x2912('0x15')][this[_0x2912('0x7')]['id']],_0x19f81e?_0x2912('0x1f'):_0x2912('0x20'));}if(!_0x19f81e){setTimeout(this['push'][_0x2912('0xb')](this),0x3e8);}};function agent(_0x191799,_0x35d170,_0x587d66,_0x3ff4c4){return new Agent(_0x191799,_0x35d170,_0x587d66,_0x3ff4c4);}module[_0x2912('0x21')]=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 36bc342..3d602c2 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 _0x09f4=['prototype','handleDrained','isNil','Agents','length','agents','channel','writeLog','RINGING','busy','busyQueue','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout'];(function(_0x35bdba,_0x4ec8b7){var _0x35ba2c=function(_0x48aaf4){while(--_0x48aaf4){_0x35bdba['push'](_0x35bdba['shift']());}};_0x35ba2c(++_0x4ec8b7);}(_0x09f4,0xe4));var _0x409f=function(_0x1f2743,_0x48193b){_0x1f2743=_0x1f2743-0x0;var _0x1665d7=_0x09f4[_0x1f2743];return _0x1665d7;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x409f('0x0'));var logger=require(_0x409f('0x1'))(_0x409f('0x2'));var Beepall=function(_0x4ee58a,_0xf642c7,_0x13f1a1,_0x1d859b){this[_0x409f('0x3')]=uuid['v4']();this[_0x409f('0x4')]=_0x4ee58a;this[_0x409f('0x5')]=_0xf642c7;this[_0x409f('0x6')]=_0x13f1a1;this['routing']=_0x1d859b;this['squeue'][_0x409f('0x7')](this[_0x409f('0x8')][_0x409f('0x9')](this),this[_0x409f('0xa')][_0x409f('0x9')](this));this[_0x409f('0x4')]['on'](_0x409f('0xb'),this[_0x409f('0xa')]['bind'](this));this[_0x409f('0x4')]['on']('drained',this['handleDrained'][_0x409f('0x9')](this));};Beepall[_0x409f('0xc')][_0x409f('0x7')]=function(){this['squeue']['push'](this[_0x409f('0x8')][_0x409f('0x9')](this),this[_0x409f('0xa')][_0x409f('0x9')](this));};Beepall[_0x409f('0xc')][_0x409f('0xd')]=function(_0x2c4e0e){this['handleTimeout'](!![]);};Beepall[_0x409f('0xc')]['handleRun']=function(_0x3ec157){var _0x316d07=!![];if(!_['isNil'](this[_0x409f('0x5')])&&!_[_0x409f('0xe')](this[_0x409f('0x5')][_0x409f('0xf')])&&this[_0x409f('0x5')]['Agents']['length']>0x0){for(var _0x54b98a=0x0,_0x51e656;_0x54b98a0x0){for(var _0x19fc7f=0x0,_0x5214c6;_0x19fc7f0x0&&_0x3c3497[_0x38e752+_0xc741('0x20')]>=_0x3c3497[_0x38e752+_0xc741('0x21')]){writeLog(_0xd498b,_0x3c3497,_0x38e752['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xc741('0x22')]=function(_0x11c65e,_0x102408,_0x328793,_0x57f6fc,_0x378ab5){return sendNotification(!![],_0x11c65e,_0x102408,_0x328793,_0x57f6fc,_0x378ab5);};exports['hideNotification']=function(_0x353729,_0x2e960e,_0x4cd23c,_0x3797c5,_0x314fc2){return sendNotification(![],_0x353729,_0x2e960e,_0x4cd23c,_0x3797c5,_0x314fc2);};exports[_0xc741('0x23')]=writeLog; \ No newline at end of file +var _0xa456=['name','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','user:%s'];(function(_0x4c063f,_0x492ad4){var _0x13a173=function(_0x2c55bb){while(--_0x2c55bb){_0x4c063f['push'](_0x4c063f['shift']());}};_0x13a173(++_0x492ad4);}(_0xa456,0x142));var _0x6a45=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xa456[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var utils=require(_0x6a45('0x2'));var Mustache=require(_0x6a45('0x3'));var Redis=require('ioredis');var config=require(_0x6a45('0x4'));var logger=require(_0x6a45('0x5'))(_0x6a45('0x6'));config['redis']=_[_0x6a45('0x7')](config[_0x6a45('0x8')],{'host':_0x6a45('0x9'),'port':0x18eb});var io=require(_0x6a45('0xa'))(new Redis(config['redis']));function emit(_0x25cf8d,_0x26bfc0,_0x214514){io['to'](_0x25cf8d)[_0x6a45('0xb')](_0x26bfc0,_0x214514);}function sendNotification(_0x3deb09,_0x4858df,_0x3a5c20,_0x517040,_0x36378a,_0x3a9671){io['to'](util[_0x6a45('0xc')](_0x6a45('0xd'),_0x517040[_0x6a45('0xe')]))['emit']('user:save',_0x517040);var _0xe62823=_0x3a9671||{};var _0x465b59=_0x3a5c20['split']('.');var _0x5a39f6={'uniqueid':_0x4858df,'channel':_0x465b59[0x0],'id':_0x465b59[0x1],'title':_0x465b59[0x0]+'\x20interaction','interactionId':_0x465b59[0x2],'queue':_0x36378a?_0x36378a[_0x6a45('0xe')]:null,'sound':_0xe62823[_0x6a45('0xf')][_0x6a45('0x10')],'shake':_0xe62823[_0x6a45('0xf')][_0x6a45('0x11')]};try{if(!_0xe62823['body']){_0xe62823['body']={};}if(_0x36378a){_0xe62823[_0x6a45('0x12')][_0x6a45('0x13')]=_0x36378a;}else if(_0xe62823['body'][_0x6a45('0x13')]){delete _0xe62823[_0x6a45('0x12')][_0x6a45('0x13')];}_0x5a39f6[_0x6a45('0x14')]=utils['getMustacheRender'](_0xe62823['account']['notificationTemplate'],_0xe62823);}catch(_0x396d7d){_0x5a39f6[_0x6a45('0x14')]=_0x6a45('0x15');logger['error'](util[_0x6a45('0xc')](_0x6a45('0x16'),_0x4858df,_0x396d7d[_0x6a45('0x17')]));}io['to'](util['format']('user:%s',_0x517040['name']))[_0x6a45('0xb')](util[_0x6a45('0xc')]('notification:%s',_0x3deb09?_0x6a45('0x18'):_0x6a45('0x19')),_0x5a39f6);}function writeLog(_0x4f7000,_0x4f7110,_0xdf10c6){return logger[_0x6a45('0x1a')](util[_0x6a45('0xc')](_0x6a45('0x1b'),_0x4f7000,_0x4f7110['name'],_0xdf10c6));}exports['isAgentAvailable']=function(_0x3faae5,_0x59af4b,_0x11290c,_0x22373c){if(_0x59af4b[_0x6a45('0x1c')]){writeLog(_0x3faae5,_0x59af4b,_0x6a45('0x1d'));return![];}if(!_0x59af4b[_0x6a45('0x1e')]){writeLog(_0x3faae5,_0x59af4b,_0x6a45('0x1f'));return![];}if(_0x59af4b[_0x11290c+_0x6a45('0x20')]){writeLog(_0x3faae5,_0x59af4b,_0x6a45('0x21'));return![];}if(_0x22373c&&_0x59af4b[_0x6a45('0x22')](_0x11290c+_0x6a45('0x23'))&&_0x59af4b['hasOwnProperty'](_0x11290c+_0x6a45('0x24'))){if(_0x59af4b[_0x11290c+'Capacity']>0x0&&_0x59af4b[_0x11290c+_0x6a45('0x24')]>=_0x59af4b[_0x11290c+_0x6a45('0x23')]){writeLog(_0x3faae5,_0x59af4b,_0x11290c[_0x6a45('0x25')]()+_0x6a45('0x26'));return![];}}return!![];};exports[_0x6a45('0x27')]=function(_0x526062,_0x2b8cc8,_0x308003,_0x4770cc,_0x1ccff0){return sendNotification(!![],_0x526062,_0x2b8cc8,_0x308003,_0x4770cc,_0x1ccff0);};exports[_0x6a45('0x28')]=function(_0x227b6f,_0x3fac9b,_0x313c13,_0x54286d,_0x14adb5){return sendNotification(![],_0x227b6f,_0x3fac9b,_0x313c13,_0x54286d,_0x14adb5);};exports[_0x6a45('0x29')]=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 fee6766..c3ec6af 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 _0x67bf=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','join','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x67bf,0xe1));var _0xf67b=function(_0x462926,_0x549149){_0x462926=_0x462926-0x0;var _0x1c995f=_0x67bf[_0x462926];return _0x1c995f;};'use strict';var schema=require(_0xf67b('0x0'));var sh=require('shelljs');var _=require(_0xf67b('0x1'));var utils=require(_0xf67b('0x2'));var logger=require(_0xf67b('0x3'))(_0xf67b('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xf67b('0x5')}});exports[_0xf67b('0x6')]=function(_0x3c72b2,_0x6a3bc8){return function(_0x42dce6){try{var _0x50193e={'command':_0x6a3bc8[0x0]};var _0x1f3ee4=system[_0xf67b('0x0')](_0x50193e,{'typecast':!![]});if(_0x1f3ee4['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x3c72b2,_[_0xf67b('0x7')](_0x1f3ee4,_0xf67b('0x8'))[_0xf67b('0x9')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3c72b2);_0x42dce6[_0xf67b('0xa')]();}else{var _0x4f71dd=this;var _0x22b374=utils[_0xf67b('0xb')](_0x6a3bc8[0x0],this);logger[_0xf67b('0xc')](_0xf67b('0xd'),_0x3c72b2,_0x22b374);sh[_0xf67b('0xe')](_[_0xf67b('0xf')](_0x22b374),function(_0xd3ec5e,_0x52c3a2){logger[_0xf67b('0xc')](_0xf67b('0x10'),_0x3c72b2,_0xd3ec5e);if(_0xd3ec5e==0x0){var _0x39c412=_0x52c3a2[_0xf67b('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xf67b('0x12')](_0x6a3bc8[0x1])||_[_0xf67b('0x13')](_0x6a3bc8[0x1])){logger[_0xf67b('0xc')](_0xf67b('0x14'),_0x3c72b2);_0x4f71dd[_0xf67b('0x15')][_0x6a3bc8[0x1]]=_0x39c412;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x3c72b2,_0x6a3bc8[0x1],_0x39c412);_0x4f71dd[_0xf67b('0x15')][_0x6a3bc8[0x1]]=_0x39c412;}}_0x42dce6['next']();});}}catch(_0x4301fc){logger[_0xf67b('0x16')]('[%s][SYSTEM]\x20%s',_0x3c72b2,_['isObject'](_0x4301fc)?JSON['stringify'](_0x4301fc):_0x4301fc);logger[_0xf67b('0xc')](_0xf67b('0x17'),_0x3c72b2);_0x42dce6[_0xf67b('0xa')]();}};}; \ No newline at end of file +var _0x6944=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','body'];(function(_0x514be6,_0x1ca62c){var _0x250c5c=function(_0x403fbe){while(--_0x403fbe){_0x514be6['push'](_0x514be6['shift']());}};_0x250c5c(++_0x1ca62c);}(_0x6944,0xe6));var _0x4694=function(_0x171462,_0x489a7e){_0x171462=_0x171462-0x0;var _0x5c4ab2=_0x6944[_0x171462];return _0x5c4ab2;};'use strict';var schema=require(_0x4694('0x0'));var sh=require(_0x4694('0x1'));var _=require(_0x4694('0x2'));var utils=require(_0x4694('0x3'));var logger=require(_0x4694('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x4694('0x5')}});exports['consequence']=function(_0x454c18,_0x216ccb){return function(_0x270d1c){try{var _0x401ff1={'command':_0x216ccb[0x0]};var _0x2b677a=system[_0x4694('0x0')](_0x401ff1,{'typecast':!![]});if(_0x2b677a[_0x4694('0x6')]){logger['error']('[%s][SYSTEM]\x20%s',_0x454c18,_[_0x4694('0x7')](_0x2b677a,_0x4694('0x8'))[_0x4694('0x9')](',\x20'));logger['info'](_0x4694('0xa'),_0x454c18);_0x270d1c[_0x4694('0xb')]();}else{var _0x1e08e7=this;var _0x29bb08=utils['getMustacheRender'](_0x216ccb[0x0],this);logger[_0x4694('0xc')](_0x4694('0xd'),_0x454c18,_0x29bb08);sh[_0x4694('0xe')](_[_0x4694('0xf')](_0x29bb08),function(_0x52511d,_0x136d5c){logger['info'](_0x4694('0x10'),_0x454c18,_0x52511d);if(_0x52511d==0x0){var _0x4fc853=_0x136d5c[_0x4694('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x216ccb[0x1])||_[_0x4694('0x12')](_0x216ccb[0x1])){logger[_0x4694('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x454c18);_0x1e08e7[_0x4694('0x13')][_0x216ccb[0x1]]=_0x4fc853;}else{logger[_0x4694('0xc')](_0x4694('0x14'),_0x454c18,_0x216ccb[0x1],_0x4fc853);_0x1e08e7[_0x4694('0x13')][_0x216ccb[0x1]]=_0x4fc853;}}_0x270d1c[_0x4694('0xb')]();});}}catch(_0x402eeb){logger[_0x4694('0x15')](_0x4694('0x16'),_0x454c18,_[_0x4694('0x17')](_0x402eeb)?JSON[_0x4694('0x18')](_0x402eeb):_0x402eeb);logger[_0x4694('0xc')](_0x4694('0xa'),_0x454c18);_0x270d1c['next']();}};}; \ 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 5e8469e..4a2cbbd 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 _0x3913=['message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','isObject','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence','length','error','[%s][TAG]\x20%s'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x3913,0x8f));var _0x3391=function(_0x48a67d,_0xaa4af2){_0x48a67d=_0x48a67d-0x0;var _0x2f1ec4=_0x3913[_0x48a67d];return _0x2f1ec4;};'use strict';var schema=require(_0x3391('0x0'));var _=require(_0x3391('0x1'));var rpc={'chatInteraction':require(_0x3391('0x2')),'openchannelInteraction':require(_0x3391('0x3')),'smsInteraction':require(_0x3391('0x4')),'mailInteraction':require(_0x3391('0x5')),'faxInteraction':require(_0x3391('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x3391('0x7'))('routing');var tag=schema({'tag':{'type':_0x3391('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x3391('0x9')]=function(_0x4827c3,_0x29a62d,_0x16a9ab,_0x2838e4){return function(_0x5c5726){try{var _0x406018={'tag':_0x29a62d[0x0]};var _0x3acefd=tag[_0x3391('0x0')](_0x406018,{'typecast':!![]});if(_0x3acefd[_0x3391('0xa')]){logger[_0x3391('0xb')](_0x3391('0xc'),_0x4827c3,_['map'](_0x3acefd,_0x3391('0xd'))[_0x3391('0xe')](',\x20'));logger[_0x3391('0xf')](_0x3391('0x10'),_0x4827c3);_0x5c5726['next']();}else{var _0x54eb65={'ids':[_0x29a62d[0x0]]};if(rpc[_0x2838e4[_0x3391('0x11')]+'Interaction']){rpc[_0x2838e4[_0x3391('0x11')]+'Interaction'][_0x3391('0x12')](_0x2838e4['interaction']['id'],_0x54eb65)[_0x3391('0x13')](function(_0x3b3526){logger[_0x3391('0xf')](_0x3391('0x14'),_0x4827c3,_0x29a62d[0x1],_0x2838e4[_0x3391('0x11')],_0x2838e4[_0x3391('0x15')]['id']);})[_0x3391('0x16')](function(_0x49d620){logger['error']('[%s][TAG]\x20%s',_0x4827c3,JSON[_0x3391('0x17')](_0x49d620));logger['info'](_0x3391('0x10'),_0x4827c3);})['finally'](function(){_0x5c5726['next']();});}}}catch(_0x5bb470){logger['error'](_0x3391('0xc'),_0x4827c3,_[_0x3391('0x18')](_0x5bb470)?JSON[_0x3391('0x17')](_0x5bb470):_0x5bb470);logger[_0x3391('0xf')](_0x3391('0x10'),_0x4827c3);_0x5c5726[_0x3391('0x19')]();}};}; \ No newline at end of file +var _0x7fa8=['join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x7fa8,0xcb));var _0x87fa=function(_0x39dd10,_0x134622){_0x39dd10=_0x39dd10-0x0;var _0x35bd8a=_0x7fa8[_0x39dd10];return _0x35bd8a;};'use strict';var schema=require(_0x87fa('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x87fa('0x1')),'openchannelInteraction':require(_0x87fa('0x2')),'smsInteraction':require(_0x87fa('0x3')),'mailInteraction':require(_0x87fa('0x4')),'faxInteraction':require(_0x87fa('0x5')),'whatsappInteraction':require(_0x87fa('0x6'))};var logger=require('../../../../config/logger')(_0x87fa('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x87fa('0x8')}});exports[_0x87fa('0x9')]=function(_0x3bdaee,_0x4380c7,_0x44e37f,_0x3011d2){return function(_0x339a2c){try{var _0x2ab527={'tag':_0x4380c7[0x0]};var _0x575888=tag[_0x87fa('0x0')](_0x2ab527,{'typecast':!![]});if(_0x575888[_0x87fa('0xa')]){logger['error'](_0x87fa('0xb'),_0x3bdaee,_[_0x87fa('0xc')](_0x575888,'message')[_0x87fa('0xd')](',\x20'));logger[_0x87fa('0xe')](_0x87fa('0xf'),_0x3bdaee);_0x339a2c[_0x87fa('0x10')]();}else{var _0x384d5f={'ids':[_0x4380c7[0x0]]};if(rpc[_0x3011d2['channel']+_0x87fa('0x11')]){rpc[_0x3011d2[_0x87fa('0x12')]+_0x87fa('0x11')][_0x87fa('0x13')](_0x3011d2[_0x87fa('0x14')]['id'],_0x384d5f)[_0x87fa('0x15')](function(_0x384d7d){logger[_0x87fa('0xe')](_0x87fa('0x16'),_0x3bdaee,_0x4380c7[0x1],_0x3011d2[_0x87fa('0x12')],_0x3011d2[_0x87fa('0x14')]['id']);})[_0x87fa('0x17')](function(_0x17b1d2){logger[_0x87fa('0x18')](_0x87fa('0xb'),_0x3bdaee,JSON[_0x87fa('0x19')](_0x17b1d2));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3bdaee);})[_0x87fa('0x1a')](function(){_0x339a2c[_0x87fa('0x10')]();});}}}catch(_0x380e70){logger[_0x87fa('0x18')](_0x87fa('0xb'),_0x3bdaee,_['isObject'](_0x380e70)?JSON[_0x87fa('0x19')](_0x380e70):_0x380e70);logger[_0x87fa('0xe')](_0x87fa('0xf'),_0x3bdaee);_0x339a2c[_0x87fa('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 9716adf..7c92a00 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 _0xc39d=['includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','utf8','POST','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','[%s][TVOX]\x20%s','isObject','stringify','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','routing','consequence','replace','\x20-\x20'];(function(_0x132641,_0x153b24){var _0xc68b80=function(_0x14dd35){while(--_0x14dd35){_0x132641['push'](_0x132641['shift']());}};_0xc68b80(++_0x153b24);}(_0xc39d,0x1cc));var _0xdc39=function(_0x2b6c38,_0xaa5e72){_0x2b6c38=_0x2b6c38-0x0;var _0x340837=_0xc39d[_0x2b6c38];return _0x340837;};'use strict';var rp=require('request-promise');var logger=require(_0xdc39('0x0'))(_0xdc39('0x1'));var _=require('lodash');var arr=[];exports[_0xdc39('0x2')]=function(_0x303a0a,_0x58f96e){return function(_0x580a02){var _0x43933b=_0x58f96e[0xa];var _0x43bc2e=_0x58f96e[0xb];var _0x43e513=_0x58f96e[0xc];var _0x6e7d58=_0x58f96e[0xd];var _0x3504e5=_0x58f96e[0xe];var _0x26f2b3=_0x58f96e[0xf][_0xdc39('0x3')](/\n/g,_0xdc39('0x4'));var _0x5aade6=_0x58f96e[0x10][_0xdc39('0x3')](/\n/g,'\x20');if(!arr[_0xdc39('0x5')](_0x43bc2e)){arr[_0xdc39('0x6')](_0x43bc2e);var _0x223c52=_0x58f96e[0x3];var _0x1d03ad=_0x58f96e[0x4];var _0x4e9d40=_0x58f96e[0x1];var _0x5c44b2=_0x58f96e[0x0];var _0x14168a={};_0x14168a[_0xdc39('0x7')]=_0x58f96e[0x8]+_0xdc39('0x8')+_0x43e513+'|'+_0x43933b+'|'+_0x6e7d58+'|'+_0x43bc2e+'|'+_0x3504e5;_0x14168a['urlOnRing']=_0x58f96e[0x7]+'?params='+_0x43e513+'|'+_0x43933b+'|'+_0x6e7d58+'|'+_0x43bc2e+'|'+_0x3504e5+'|'+_0x26f2b3+'|'+_0x5aade6;_0x14168a[_0xdc39('0x9')]=_0x58f96e[0x9];var _0x2b8966={};_0x2b8966[_0xdc39('0xa')]=_0xdc39('0xb');_0x2b8966[_0xdc39('0xc')]=_0xdc39('0xd');var _0xd1981f=[];_0xd1981f['push'](_0x58f96e[0x2]);_0xd1981f[_0xdc39('0x6')](_0x58f96e[0x5]);_0xd1981f[_0xdc39('0x6')](_0x58f96e[0x6]);_0x2b8966['params']=_0xd1981f;_0x2b8966['id']=0x1;var _0x5867d9=JSON['stringify'](_0x2b8966);var _0x351fed={'encoding':_0xdc39('0xe'),'method':_0xdc39('0xf'),'timeout':0x2710,'url':_0x223c52,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5867d9};return rp(_0x351fed)['then'](function(_0x1ffec3){const _0x127bfc=JSON[_0xdc39('0x10')](_0x1ffec3);if(!_0x127bfc['result'][_0xdc39('0x11')]){throw new Error(_0xdc39('0x12'));}var _0x30d975=_0x43bc2e;var _0x148906=_0xdc39('0x13')+_0x4e9d40+_0xdc39('0x14')+_0x5c44b2+_0xdc39('0x15')+_0x30d975+_0xdc39('0x16')+JSON['stringify'](_0x14168a);var _0x2ee7e4=_0x1d03ad+'?'+_0x148906;return rp(_0x2ee7e4);})[_0xdc39('0x17')](function(_0xcb0417){logger[_0xdc39('0x18')](_0xdc39('0x19'),_0x303a0a,_0xcb0417);_0x580a02[_0xdc39('0x1a')]();})['catch'](function(_0x22f24a){logger['error'](_0xdc39('0x1b'),_0x303a0a,_[_0xdc39('0x1c')](_0x22f24a)?JSON[_0xdc39('0x1d')](_0x22f24a):_0x22f24a);_0x580a02[_0xdc39('0x1a')]();});}else{logger['info'](_0xdc39('0x1e'),_0x303a0a);_0x580a02['next']();}};}; \ No newline at end of file +var _0x2195=['replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','push','stringify','utf8','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence'];(function(_0x2fa137,_0x15d570){var _0x15a421=function(_0x5797c7){while(--_0x5797c7){_0x2fa137['push'](_0x2fa137['shift']());}};_0x15a421(++_0x15d570);}(_0x2195,0xfd));var _0x5219=function(_0x10c2d3,_0x2f5914){_0x10c2d3=_0x10c2d3-0x0;var _0x5a0b13=_0x2195[_0x10c2d3];return _0x5a0b13;};'use strict';var rp=require('request-promise');var logger=require(_0x5219('0x0'))('routing');var _=require(_0x5219('0x1'));var arr=[];exports[_0x5219('0x2')]=function(_0x95dd84,_0x19da7a){return function(_0x1cef82){var _0x23a749=_0x19da7a[0xa];var _0x31405b=_0x19da7a[0xb];var _0x3e8f2a=_0x19da7a[0xc];var _0x115b03=_0x19da7a[0xd];var _0x15c4a6=_0x19da7a[0xe];var _0x92d4ff=_0x19da7a[0xf][_0x5219('0x3')](/\n/g,_0x5219('0x4'));var _0x4ef8f7=_0x19da7a[0x10][_0x5219('0x3')](/\n/g,'\x20');if(!arr[_0x5219('0x5')](_0x31405b)){arr['push'](_0x31405b);var _0x2db601=_0x19da7a[0x3];var _0x43d73a=_0x19da7a[0x4];var _0x29f611=_0x19da7a[0x1];var _0x195614=_0x19da7a[0x0];var _0x4b9ea2={};_0x4b9ea2[_0x5219('0x6')]=_0x19da7a[0x8]+_0x5219('0x7')+_0x3e8f2a+'|'+_0x23a749+'|'+_0x115b03+'|'+_0x31405b+'|'+_0x15c4a6;_0x4b9ea2[_0x5219('0x8')]=_0x19da7a[0x7]+'?params='+_0x3e8f2a+'|'+_0x23a749+'|'+_0x115b03+'|'+_0x31405b+'|'+_0x15c4a6+'|'+_0x92d4ff+'|'+_0x4ef8f7;_0x4b9ea2[_0x5219('0x9')]=_0x19da7a[0x9];var _0x4097b5={};_0x4097b5['jsonrpc']=_0x5219('0xa');_0x4097b5[_0x5219('0xb')]=_0x5219('0xc');var _0x2cf57e=[];_0x2cf57e['push'](_0x19da7a[0x2]);_0x2cf57e[_0x5219('0xd')](_0x19da7a[0x5]);_0x2cf57e[_0x5219('0xd')](_0x19da7a[0x6]);_0x4097b5['params']=_0x2cf57e;_0x4097b5['id']=0x1;var _0x6b9c17=JSON[_0x5219('0xe')](_0x4097b5);var _0x49624c={'encoding':_0x5219('0xf'),'method':'POST','timeout':0x2710,'url':_0x2db601,'headers':{'Content-Type':'application/json-rpc'},'body':_0x6b9c17};return rp(_0x49624c)['then'](function(_0x4e75a6){const _0x198074=JSON[_0x5219('0x10')](_0x4e75a6);if(!_0x198074['result'][_0x5219('0x11')]){throw new Error(_0x5219('0x12'));}var _0x2435c4=_0x31405b;var _0x1e283f=_0x5219('0x13')+_0x29f611+_0x5219('0x14')+_0x195614+_0x5219('0x15')+_0x2435c4+_0x5219('0x16')+JSON[_0x5219('0xe')](_0x4b9ea2);var _0x1337e5=_0x43d73a+'?'+_0x1e283f;return rp(_0x1337e5);})[_0x5219('0x17')](function(_0x41d447){logger[_0x5219('0x18')](_0x5219('0x19'),_0x95dd84,_0x41d447);_0x1cef82[_0x5219('0x1a')]();})[_0x5219('0x1b')](function(_0x425938){logger[_0x5219('0x1c')]('[%s][TVOX]\x20%s',_0x95dd84,_[_0x5219('0x1d')](_0x425938)?JSON[_0x5219('0xe')](_0x425938):_0x425938);_0x1cef82[_0x5219('0x1a')]();});}else{logger[_0x5219('0x18')](_0x5219('0x1e'),_0x95dd84);_0x1cef82[_0x5219('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 0e12e8e..3a9c51d 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x187d01,_0xd90724){var _0x3c7266=function(_0x5a3c5c){while(--_0x5a3c5c){_0x187d01['push'](_0x187d01['shift']());}};_0x3c7266(++_0xd90724);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x299620,_0x1252fa){var _0x24cef9=function(_0x3afde3){while(--_0x3afde3){_0x299620['push'](_0x299620['shift']());}};_0x24cef9(++_0x1252fa);}(_0xe706,0xa3));var _0x6e70=function(_0x30662f,_0x4d202e){_0x30662f=_0x30662f-0x0;var _0x40d038=_0xe706[_0x30662f];return _0x40d038;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c8fe9f0..69e6349 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 _0xc6d8=['available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','bluebird','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','app','toLowerCase','mail','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','stringify','matchPath','emit','error','routing\x20is\x20empty','agent','agents','busyQueue','end','update','UserId','catch','stack','busy','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues'];(function(_0xd4a5,_0x12a607){var _0x4c99f6=function(_0x58c621){while(--_0x58c621){_0xd4a5['push'](_0xd4a5['shift']());}};_0x4c99f6(++_0x12a607);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x5820df,_0x24240a){_0x5820df=_0x5820df-0x0;var _0x7a47f1=_0xc6d8[_0x5820df];return _0x7a47f1;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x8c6d('0x2'));var uuid=require('uuid');var utils=require(_0x8c6d('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x8c6d('0x4'));var rpc={'openchannelQueueReport':require(_0x8c6d('0x5')),'mailQueueReport':require(_0x8c6d('0x6')),'chatQueueReport':require(_0x8c6d('0x7')),'smsQueueReport':require(_0x8c6d('0x8')),'faxQueueReport':require(_0x8c6d('0x9')),'whatsappQueueReport':require(_0x8c6d('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1496ba,_0x75c49f,_0x16d4b2){return util['format'](_0x8c6d('0xb'),_0x1496ba,_0x75c49f||0x0,_0x16d4b2||0x0);}function getIntervals(_0x1ec65c,_0x45e50e){var _0x354fd5=[];if(!_[_0x8c6d('0xc')](_0x45e50e[_0x8c6d('0xd')])&&!_[_0x8c6d('0xc')](_0x1ec65c[_0x45e50e[_0x8c6d('0xd')]])&&!_['isNil'](_0x1ec65c[_0x45e50e[_0x8c6d('0xd')]]['Intervals'])){_0x354fd5=_['map'](_0x1ec65c[_0x45e50e[_0x8c6d('0xd')]][_0x8c6d('0xe')],_0x8c6d('0xf'));}else if(!_[_0x8c6d('0xc')](_0x45e50e[_0x8c6d('0xf')])){_0x354fd5=[_0x45e50e[_0x8c6d('0xf')]];}return _0x354fd5;}exports[_0x8c6d('0x10')]=function(_0x103699){_0x103699[_0x8c6d('0x11')]={};return new BPromise(function(_0x31d943,_0x4fb956){var _0x16c6b5={'Start':function(_0x4b2bb1){var _0x16af06=this;return new Promise(function(_0x4dd4b6,_0x150a16){if(_0x4b2bb1){try{var _0x3d95a6=[];var _0x52ed7b=getId(_0x4b2bb1[_0x8c6d('0x12')],_0x4b2bb1[_0x8c6d('0x13')]?_0x4b2bb1['message']['id']:0x0,_0x4b2bb1[_0x8c6d('0x14')]?_0x4b2bb1['interaction']['id']:0x0);if(_0x4b2bb1['applications']&&_[_0x8c6d('0x15')](_0x4b2bb1['applications'])&&_0x4b2bb1[_0x8c6d('0x16')][_0x8c6d('0x17')]){for(var _0x1d0f0a=0x0;_0x1d0f0a<_0x4b2bb1[_0x8c6d('0x16')][_0x8c6d('0x17')];_0x1d0f0a+=0x1){var _0x56854a=_0x4b2bb1['applications'][_0x1d0f0a];if(fs['existsSync'](path[_0x8c6d('0x18')](__dirname,'applications',_0x56854a[_0x8c6d('0x19')]+'.js'))){var _0x4c378b=[];switch(_0x56854a[_0x8c6d('0x19')][_0x8c6d('0x1a')]()){case'autoreply':var _0x512a72=_0x56854a['appdata']['split'](',');if(_0x4b2bb1[_0x8c6d('0x12')]===_0x8c6d('0x1b')){_0x4c378b[_0x8c6d('0x1c')](_0x512a72[0x0]);_0x4c378b['push'](_0x512a72[0x1]);_0x4c378b[_0x8c6d('0x1c')](_0x512a72['slice'](0x2,_0x512a72[_0x8c6d('0x17')])['join'](','));}else{_0x4c378b[_0x8c6d('0x1c')](_0x512a72[0x0]);_0x4c378b[_0x8c6d('0x1c')](_0x512a72[_0x8c6d('0x1d')](0x1,_0x512a72[_0x8c6d('0x17')])[_0x8c6d('0x18')](','));}break;case _0x8c6d('0x1e'):var _0x9c269d=_0x56854a[_0x8c6d('0x1f')][_0x8c6d('0x20')](',');_0x4c378b['push'](_0x9c269d[0x0]);_0x4c378b['push'](_0x9c269d[0x1]);_0x4c378b[_0x8c6d('0x1c')](_0x9c269d[_0x8c6d('0x1d')](0x2,_0x9c269d[_0x8c6d('0x17')])[_0x8c6d('0x18')](','));break;case _0x8c6d('0x21'):var _0x316ca7=_0x56854a[_0x8c6d('0x1f')][_0x8c6d('0x20')](',');_0x4c378b[_0x8c6d('0x1c')](_0x316ca7[0x0]);_0x4c378b[_0x8c6d('0x1c')](_0x316ca7[0x1]);_0x4c378b[_0x8c6d('0x1c')](_0x316ca7[0x2]);_0x4c378b[_0x8c6d('0x1c')](_0x316ca7[0x3]);_0x4c378b['push'](_0x316ca7[_0x8c6d('0x1d')](0x4,_0x316ca7[_0x8c6d('0x17')])[_0x8c6d('0x18')](','));break;case _0x8c6d('0x22'):var _0x115621=_0x56854a[_0x8c6d('0x1f')][_0x8c6d('0x20')](',');_0x4c378b[_0x8c6d('0x1c')](_0x115621[0x0]);_0x4c378b[_0x8c6d('0x1c')](_0x115621[0x1]);_0x4c378b['push'](_0x115621[0x2]);_0x4c378b[_0x8c6d('0x1c')](_0x115621[0x3]);_0x4c378b['push'](_0x115621[_0x8c6d('0x1d')](0x4,_0x115621[_0x8c6d('0x17')])[_0x8c6d('0x18')](','));break;case _0x8c6d('0x13'):_0x4c378b[_0x8c6d('0x1c')](_0x56854a[_0x8c6d('0x1f')]);break;case'tag':_0x4c378b['push'](_0x56854a[_0x8c6d('0x23')]);_0x4c378b[_0x8c6d('0x1c')](_0x56854a[_0x8c6d('0x1f')]);break;case _0x8c6d('0x24'):var _0x5638f4=utils[_0x8c6d('0x25')](_0x4b2bb1[_0x8c6d('0x26')][_0x8c6d('0x27')],_0x4b2bb1);var _0x29cef8=_0x56854a[_0x8c6d('0x1f')][_0x8c6d('0x20')](',');_0x4c378b['push'](_0x29cef8[0x0]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x1]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x2]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x3]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x4]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x5]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x6]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x7]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x8]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0x9]);_0x4c378b[_0x8c6d('0x1c')](_0x29cef8[0xa]);_0x4c378b[_0x8c6d('0x1c')](_0x4b2bb1[_0x8c6d('0x14')]['id']);_0x4c378b['push'](_0x4b2bb1[_0x8c6d('0x13')]['id']);_0x4c378b[_0x8c6d('0x1c')](_0x56854a[_0x8c6d('0x28')]);_0x4c378b[_0x8c6d('0x1c')](_0x4b2bb1[_0x8c6d('0x14')]['ContactId']);_0x4c378b[_0x8c6d('0x1c')](_0x4b2bb1[_0x8c6d('0x29')]['body']);_0x4c378b[_0x8c6d('0x1c')](_0x5638f4);break;default:_0x4c378b=_[_0x8c6d('0xc')](_0x56854a[_0x8c6d('0x1f')])?[]:_0x56854a['appdata'][_0x8c6d('0x20')](',');}var _0xb7293d={'id':util[_0x8c6d('0x2a')](_0x8c6d('0x2b'),_0x52ed7b,_0x56854a['id'],_0x56854a[_0x8c6d('0x19')]),'condition':require(_0x8c6d('0x2c'))[_0x8c6d('0x2d')](_0x52ed7b,getIntervals(_0x103699[_0x8c6d('0x2e')],_0x56854a),_0x103699),'consequence':require(_0x8c6d('0x2f')+_0x56854a[_0x8c6d('0x19')])[_0x8c6d('0x30')](_0x52ed7b,_0x4c378b,_0x103699,_0x4b2bb1),'p':_0x56854a['priority']||0x0};logger['info']('Push\x20new\x20rule',_0xb7293d['id'],_0x8c6d('0x31'),getIntervals(_0x103699[_0x8c6d('0x2e')],_0x56854a)[_0x8c6d('0x18')](_0x8c6d('0x32')));_0x3d95a6[_0x8c6d('0x1c')](_0xb7293d);}else{logger['error'](_0x8c6d('0x33'),path[_0x8c6d('0x18')](__dirname,_0x8c6d('0x16'),_0x56854a['app']+_0x8c6d('0x34')));}}_0x103699[_0x8c6d('0x11')][_0x52ed7b]=new RuleEngine(_0x3d95a6);_0x103699['rules'][_0x52ed7b]['execute'](_0x4b2bb1,function(_0x4bd626){logger['info']('Applications\x20executed',JSON[_0x8c6d('0x35')](_0x4bd626[_0x8c6d('0x36')]));if(_0x103699[_0x8c6d('0x11')][_0x52ed7b]){_0x103699[_0x8c6d('0x11')][_0x52ed7b][_0x8c6d('0x37')]('complete');}});return _0x4dd4b6({'code':0xc8,'message':_0x4b2bb1});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x4dd4b6({'code':0xc8,'message':_0x4b2bb1});}}catch(_0x512a57){logger[_0x8c6d('0x38')](_0x512a57['stack']);return _0x150a16(_0x16af06[_0x8c6d('0x38')](0x1f4,_0x512a57));}}return _0x150a16(_0x8c6d('0x39'));});},'AcceptMessage':function(_0x38c127){var _0x8a980b=this;return new Promise(function(_0x3daa32,_0x12feff){if(_0x38c127['agent']&&_0x38c127[_0x8c6d('0x3a')]['id']){if(_0x103699[_0x8c6d('0x3b')][_0x38c127['agent']['id']]){_0x103699[_0x8c6d('0x3b')][_0x38c127[_0x8c6d('0x3a')]['id']]['busy']=![];_0x103699[_0x8c6d('0x3b')][_0x38c127[_0x8c6d('0x3a')]['id']][_0x8c6d('0x3c')]=undefined;}}if(_0x38c127[_0x8c6d('0x13')]&&_0x38c127[_0x8c6d('0x13')]['id']){try{var _0x21eedb=getId(_0x38c127[_0x8c6d('0x12')],_0x38c127[_0x8c6d('0x13')]?_0x38c127[_0x8c6d('0x13')]['id']:0x0,_0x38c127[_0x8c6d('0x14')]?_0x38c127[_0x8c6d('0x14')]['id']:0x0);if(_0x103699[_0x8c6d('0x11')][_0x21eedb]){_0x103699[_0x8c6d('0x11')][_0x21eedb][_0x8c6d('0x37')](_0x8c6d('0x3d'));if(rpc[_0x38c127[_0x8c6d('0x12')]+'QueueReport']){rpc[_0x38c127['channel']+'QueueReport'][_0x8c6d('0x3e')](_0x21eedb,{'UserId':_0x38c127[_0x8c6d('0x13')][_0x8c6d('0x3f')]})[_0x8c6d('0x40')](function(_0x53f7b0){logger[_0x8c6d('0x38')]('error\x20update\x20queue\x20report');});}}return _0x3daa32({'code':0xc8,'message':_0x38c127});}catch(_0x6bcc06){logger[_0x8c6d('0x38')](_0x6bcc06[_0x8c6d('0x41')]);return _0x12feff(_0x8a980b['error'](0x1f4,_0x6bcc06));}}logger[_0x8c6d('0x38')]('message\x20is\x20empty');return _0x12feff(_0x8a980b[_0x8c6d('0x38')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xcbcc60){var _0x21597a=this;return new Promise(function(_0x2e22cc,_0x334a29){if(_0xcbcc60['agent']&&_0xcbcc60[_0x8c6d('0x3a')]['id']){try{if(_0x103699[_0x8c6d('0x3b')][_0xcbcc60[_0x8c6d('0x3a')]['id']]){_0x103699[_0x8c6d('0x3b')][_0xcbcc60[_0x8c6d('0x3a')]['id']][_0x8c6d('0x42')]=![];_0x103699[_0x8c6d('0x3b')][_0xcbcc60[_0x8c6d('0x3a')]['id']]['busyQueue']=undefined;}return _0x2e22cc({'code':0xc8,'message':_0xcbcc60});}catch(_0x164770){logger[_0x8c6d('0x38')](_0x164770[_0x8c6d('0x41')]);return _0x334a29(_0x21597a[_0x8c6d('0x38')](0x1f4,_0x164770));}}logger['error'](_0x8c6d('0x43'));return _0x334a29(_0x21597a['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x28b5c6){var _0x6c8f78=this;return new Promise(function(_0x223365,_0x2f8380){if(_0x28b5c6[_0x8c6d('0x12')]&&_0x28b5c6[_0x8c6d('0x14')]&&_0x28b5c6[_0x8c6d('0x14')]['id']){try{var _0x494e8e=getId(_0x28b5c6[_0x8c6d('0x12')],_0x28b5c6[_0x8c6d('0x13')]?_0x28b5c6[_0x8c6d('0x13')]['id']:0x0,_0x28b5c6['interaction']?_0x28b5c6[_0x8c6d('0x14')]['id']:0x0);if(_0x103699[_0x8c6d('0x11')][_0x494e8e]){_0x103699[_0x8c6d('0x11')][_0x494e8e][_0x8c6d('0x37')](_0x8c6d('0x3d'));}return _0x223365({'code':0xc8,'message':_0x28b5c6});}catch(_0x53a333){logger[_0x8c6d('0x38')](_0x53a333[_0x8c6d('0x41')]);return _0x2f8380(_0x6c8f78['error'](0x1f4,_0x53a333));}}logger[_0x8c6d('0x38')]('message\x20is\x20empty');return _0x2f8380(_0x6c8f78[_0x8c6d('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5b6e78){var _0x203049=this;return new Promise(function(_0x12df94,_0x36de3c){if(_0x103699[_0x8c6d('0x3b')][_0x8c6d('0x44')](_0x5b6e78['id'])){for(var _0x3090a9 in _0x5b6e78[_0x8c6d('0x45')]){if(_0x5b6e78[_0x8c6d('0x45')][_0x8c6d('0x44')](_0x3090a9)){if(_0x103699[_0x8c6d('0x3b')][_0x5b6e78['id']][_0x8c6d('0x44')](_0x3090a9+'CurrentCapacity')){_0x103699[_0x8c6d('0x3b')][_0x5b6e78['id']][_0x3090a9+_0x8c6d('0x46')]=parseInt(_0x5b6e78[_0x8c6d('0x45')][_0x3090a9],0xa);}}}_0x103699['agents'][_0x5b6e78['id']][_0x8c6d('0x47')]();return _0x12df94({'code':0xc8,'message':_0x103699[_0x8c6d('0x3b')][_0x5b6e78['id']]});}else{return _0x36de3c(_0x203049[_0x8c6d('0x38')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2949f7){return new Promise(function(_0x55d88b,_0xc24613){var _0x51d3b4=_['values'](_0x103699[_0x8c6d('0x3b')]);_0x55d88b({'count':_0x51d3b4[_0x8c6d('0x17')],'rows':_0x51d3b4});});},'ChatQueues':function(_0x56f801){return new Promise(function(_0x59d43d,_0x4cb3e5){var _0x365201=[];for(var _0x197d5a in _0x103699[_0x8c6d('0x48')]){if(_0x103699[_0x8c6d('0x48')]['hasOwnProperty'](_0x197d5a)){var _0x5d48b8=_0x103699[_0x8c6d('0x48')][_0x197d5a];var _0x39e5d9={'id':_0x5d48b8['id'],'available':_0x5d48b8[_0x8c6d('0x49')],'loggedIn':_0x5d48b8[_0x8c6d('0x4a')],'name':_0x5d48b8[_0x8c6d('0x4b')],'paused':_0x5d48b8[_0x8c6d('0x4c')],'waiting':_0x5d48b8[_0x8c6d('0x4d')]};_0x365201[_0x8c6d('0x1c')](_0x39e5d9);}}_0x59d43d({'count':_0x365201['length'],'rows':_0x365201});});},'MailQueues':function(_0x19c69a){return new Promise(function(_0x2e2fa8,_0x1d7be0){var _0x361c40=[];for(var _0x559bd4 in _0x103699[_0x8c6d('0x4e')]){if(_0x103699[_0x8c6d('0x4e')]['hasOwnProperty'](_0x559bd4)){var _0x2608ac=_0x103699[_0x8c6d('0x4e')][_0x559bd4];var _0x52298b={'id':_0x2608ac['id'],'available':_0x2608ac['available'],'loggedIn':_0x2608ac[_0x8c6d('0x4a')],'name':_0x2608ac[_0x8c6d('0x4b')],'paused':_0x2608ac['paused'],'waiting':_0x2608ac[_0x8c6d('0x4d')]};_0x361c40[_0x8c6d('0x1c')](_0x52298b);}}_0x2e2fa8({'count':_0x361c40[_0x8c6d('0x17')],'rows':_0x361c40});});},'OpenchannelQueues':function(_0x666bb0){return new Promise(function(_0x24c412,_0x5dbbac){var _0x532b89=[];for(var _0x11dddf in _0x103699[_0x8c6d('0x4f')]){if(_0x103699[_0x8c6d('0x4f')][_0x8c6d('0x44')](_0x11dddf)){var _0x405461=_0x103699[_0x8c6d('0x4f')][_0x11dddf];var _0x1500f0={'id':_0x405461['id'],'available':_0x405461['available'],'loggedIn':_0x405461[_0x8c6d('0x4a')],'name':_0x405461[_0x8c6d('0x4b')],'paused':_0x405461[_0x8c6d('0x4c')],'waiting':_0x405461[_0x8c6d('0x4d')]};_0x532b89[_0x8c6d('0x1c')](_0x1500f0);}}_0x24c412({'count':_0x532b89[_0x8c6d('0x17')],'rows':_0x532b89});});},'SmsQueues':function(_0x1df6e0){return new Promise(function(_0x535f19,_0x2953ca){var _0x2f41d3=[];for(var _0x448e1c in _0x103699[_0x8c6d('0x50')]){if(_0x103699['smsQueues'][_0x8c6d('0x44')](_0x448e1c)){var _0xe281ec=_0x103699[_0x8c6d('0x50')][_0x448e1c];var _0xf86ea6={'id':_0xe281ec['id'],'available':_0xe281ec['available'],'loggedIn':_0xe281ec[_0x8c6d('0x4a')],'name':_0xe281ec[_0x8c6d('0x4b')],'paused':_0xe281ec['paused'],'waiting':_0xe281ec[_0x8c6d('0x4d')]};_0x2f41d3[_0x8c6d('0x1c')](_0xf86ea6);}}_0x535f19({'count':_0x2f41d3['length'],'rows':_0x2f41d3});});},'FaxQueues':function(_0x185b43){return new Promise(function(_0x3eed2c,_0x16337f){var _0x13321d=[];for(var _0x120c09 in _0x103699[_0x8c6d('0x51')]){if(_0x103699[_0x8c6d('0x51')][_0x8c6d('0x44')](_0x120c09)){var _0xe5c66b=_0x103699[_0x8c6d('0x51')][_0x120c09];var _0x2b9f0b={'id':_0xe5c66b['id'],'available':_0xe5c66b[_0x8c6d('0x49')],'loggedIn':_0xe5c66b[_0x8c6d('0x4a')],'name':_0xe5c66b[_0x8c6d('0x4b')],'paused':_0xe5c66b[_0x8c6d('0x4c')],'waiting':_0xe5c66b[_0x8c6d('0x4d')]};_0x13321d[_0x8c6d('0x1c')](_0x2b9f0b);}}_0x3eed2c({'count':_0x13321d['length'],'rows':_0x13321d});});},'WhatsappQueues':function(_0x451d2e){return new Promise(function(_0xf4ce26,_0x1761b5){var _0x99c231=[];for(var _0x2ccb5c in _0x103699[_0x8c6d('0x52')]){if(_0x103699[_0x8c6d('0x52')][_0x8c6d('0x44')](_0x2ccb5c)){var _0x1868d1=_0x103699[_0x8c6d('0x52')][_0x2ccb5c];var _0x18c3dd={'id':_0x1868d1['id'],'available':_0x1868d1[_0x8c6d('0x49')],'loggedIn':_0x1868d1[_0x8c6d('0x4a')],'name':_0x1868d1['name'],'paused':_0x1868d1[_0x8c6d('0x4c')],'waiting':_0x1868d1[_0x8c6d('0x4d')]};_0x99c231[_0x8c6d('0x1c')](_0x18c3dd);}}_0xf4ce26({'count':_0x99c231[_0x8c6d('0x17')],'rows':_0x99c231});});},'ChatQueuesWaitingInteractions':function(_0x499873){return new Promise(function(_0x1c2231,_0x31797e){var _0xbd99eb=_[_0x8c6d('0x53')](_0x103699[_0x8c6d('0x54')]);_0x1c2231({'count':_0xbd99eb['length'],'rows':_0xbd99eb});});},'MailQueuesWaitingInteractions':function(_0x31ed96){return new Promise(function(_0xcb7b5,_0x578183){var _0x5812a7=_[_0x8c6d('0x53')](_0x103699[_0x8c6d('0x55')]);_0xcb7b5({'count':_0x5812a7[_0x8c6d('0x17')],'rows':_0x5812a7});});},'OpenchannelQueuesWaitingInteractions':function(_0x232cac){return new Promise(function(_0x11ae05,_0x2f2751){var _0xd8e252=_[_0x8c6d('0x53')](_0x103699[_0x8c6d('0x56')]);_0x11ae05({'count':_0xd8e252[_0x8c6d('0x17')],'rows':_0xd8e252});});},'SmsQueuesWaitingInteractions':function(_0x2778fa){return new Promise(function(_0x4a0c76,_0x5589ff){var _0x59b5f8=_[_0x8c6d('0x53')](_0x103699[_0x8c6d('0x57')]);_0x4a0c76({'count':_0x59b5f8['length'],'rows':_0x59b5f8});});},'FaxQueuesWaitingInteractions':function(_0x284fa0){return new Promise(function(_0x55e00e,_0x31d9b7){var _0x2bcc41=_[_0x8c6d('0x53')](_0x103699[_0x8c6d('0x58')]);_0x55e00e({'count':_0x2bcc41[_0x8c6d('0x17')],'rows':_0x2bcc41});});},'WhatsappQueuesWaitingInteractions':function(_0x276ad5){return new Promise(function(_0xc233cb,_0x5d7717){var _0x4ccecb=_[_0x8c6d('0x53')](_0x103699[_0x8c6d('0x59')]);_0xc233cb({'count':_0x4ccecb[_0x8c6d('0x17')],'rows':_0x4ccecb});});}};var _0x3dfa76=jayson[_0x8c6d('0x5a')](_0x16c6b5)[_0x8c6d('0x5b')]();_0x3dfa76['on'](_0x8c6d('0x38'),function(_0xbae75c){logger[_0x8c6d('0x38')](JSON[_0x8c6d('0x35')](_0xbae75c));return _0x4fb956(_0xbae75c);});_0x3dfa76['listen'](0x232c,_0x8c6d('0x5c'),function(){console[_0x8c6d('0x5d')](_0x8c6d('0x5e'),0x232c);return _0x31d943(_0x8c6d('0x5f')+0x232c);});});}; \ No newline at end of file +var _0x8eeb=['join','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','condition','intervals','./applications/','consequence','priority','info','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','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','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','rules','message','interaction','applications','isArray','length','existsSync'];(function(_0x3b6a6d,_0x3ba7df){var _0x13268d=function(_0x3f94f1){while(--_0x3f94f1){_0x3b6a6d['push'](_0x3b6a6d['shift']());}};_0x13268d(++_0x3ba7df);}(_0x8eeb,0x183));var _0xb8ee=function(_0x2329ce,_0x2cac79){_0x2329ce=_0x2329ce-0x0;var _0x863b60=_0x8eeb[_0x2329ce];return _0x863b60;};'use strict';var _=require(_0xb8ee('0x0'));var util=require('util');var path=require(_0xb8ee('0x1'));var fs=require('fs');var jayson=require(_0xb8ee('0x2'));var BPromise=require('bluebird');var uuid=require(_0xb8ee('0x3'));var utils=require(_0xb8ee('0x4'));var config=require(_0xb8ee('0x5'));var logger=require(_0xb8ee('0x6'))(_0xb8ee('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb8ee('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xb8ee('0x9')),'faxQueueReport':require(_0xb8ee('0xa')),'whatsappQueueReport':require(_0xb8ee('0xb'))};var RuleEngine=require(_0xb8ee('0xc'));function getId(_0x4e2428,_0x27243c,_0x11dc1a){return util[_0xb8ee('0xd')]('%s.%s.%s',_0x4e2428,_0x27243c||0x0,_0x11dc1a||0x0);}function getIntervals(_0x1e7242,_0x4bf260){var _0x146167=[];if(!_[_0xb8ee('0xe')](_0x4bf260[_0xb8ee('0xf')])&&!_[_0xb8ee('0xe')](_0x1e7242[_0x4bf260[_0xb8ee('0xf')]])&&!_[_0xb8ee('0xe')](_0x1e7242[_0x4bf260[_0xb8ee('0xf')]][_0xb8ee('0x10')])){_0x146167=_['map'](_0x1e7242[_0x4bf260[_0xb8ee('0xf')]][_0xb8ee('0x10')],_0xb8ee('0x11'));}else if(!_[_0xb8ee('0xe')](_0x4bf260[_0xb8ee('0x11')])){_0x146167=[_0x4bf260[_0xb8ee('0x11')]];}return _0x146167;}exports['listen']=function(_0x237f49){_0x237f49[_0xb8ee('0x12')]={};return new BPromise(function(_0x2af0c5,_0x253c95){var _0x6c405c={'Start':function(_0x19f9c9){var _0x22b97b=this;return new Promise(function(_0x13b79c,_0x40be2d){if(_0x19f9c9){try{var _0x5a3f29=[];var _0x135d5d=getId(_0x19f9c9['channel'],_0x19f9c9['message']?_0x19f9c9[_0xb8ee('0x13')]['id']:0x0,_0x19f9c9[_0xb8ee('0x14')]?_0x19f9c9['interaction']['id']:0x0);if(_0x19f9c9[_0xb8ee('0x15')]&&_[_0xb8ee('0x16')](_0x19f9c9['applications'])&&_0x19f9c9[_0xb8ee('0x15')][_0xb8ee('0x17')]){for(var _0xcd3f98=0x0;_0xcd3f98<_0x19f9c9['applications'][_0xb8ee('0x17')];_0xcd3f98+=0x1){var _0x19739f=_0x19f9c9[_0xb8ee('0x15')][_0xcd3f98];if(fs[_0xb8ee('0x18')](path[_0xb8ee('0x19')](__dirname,'applications',_0x19739f[_0xb8ee('0x1a')]+'.js'))){var _0x35adf8=[];switch(_0x19739f[_0xb8ee('0x1a')][_0xb8ee('0x1b')]()){case _0xb8ee('0x1c'):var _0x17ee68=_0x19739f[_0xb8ee('0x1d')][_0xb8ee('0x1e')](',');if(_0x19f9c9[_0xb8ee('0x1f')]===_0xb8ee('0x20')){_0x35adf8[_0xb8ee('0x21')](_0x17ee68[0x0]);_0x35adf8['push'](_0x17ee68[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x17ee68['slice'](0x2,_0x17ee68['length'])['join'](','));}else{_0x35adf8['push'](_0x17ee68[0x0]);_0x35adf8[_0xb8ee('0x21')](_0x17ee68[_0xb8ee('0x22')](0x1,_0x17ee68[_0xb8ee('0x17')])[_0xb8ee('0x19')](','));}break;case _0xb8ee('0x23'):var _0x33faad=_0x19739f[_0xb8ee('0x1d')][_0xb8ee('0x1e')](',');_0x35adf8['push'](_0x33faad[0x0]);_0x35adf8[_0xb8ee('0x21')](_0x33faad[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x33faad[_0xb8ee('0x22')](0x2,_0x33faad[_0xb8ee('0x17')])['join'](','));break;case _0xb8ee('0x24'):var _0x1a643f=_0x19739f['appdata'][_0xb8ee('0x1e')](',');_0x35adf8[_0xb8ee('0x21')](_0x1a643f[0x0]);_0x35adf8['push'](_0x1a643f[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x1a643f[0x2]);_0x35adf8[_0xb8ee('0x21')](_0x1a643f[0x3]);_0x35adf8[_0xb8ee('0x21')](_0x1a643f['slice'](0x4,_0x1a643f[_0xb8ee('0x17')])[_0xb8ee('0x19')](','));break;case _0xb8ee('0x25'):var _0x57a4e6=_0x19739f['appdata'][_0xb8ee('0x1e')](',');_0x35adf8[_0xb8ee('0x21')](_0x57a4e6[0x0]);_0x35adf8['push'](_0x57a4e6[0x1]);_0x35adf8[_0xb8ee('0x21')](_0x57a4e6[0x2]);_0x35adf8['push'](_0x57a4e6[0x3]);_0x35adf8[_0xb8ee('0x21')](_0x57a4e6['slice'](0x4,_0x57a4e6[_0xb8ee('0x17')])[_0xb8ee('0x19')](','));break;case _0xb8ee('0x13'):_0x35adf8[_0xb8ee('0x21')](_0x19739f[_0xb8ee('0x1d')]);break;case'tag':_0x35adf8['push'](_0x19739f[_0xb8ee('0x26')]);_0x35adf8[_0xb8ee('0x21')](_0x19739f[_0xb8ee('0x1d')]);break;case _0xb8ee('0x27'):var _0x18e300=utils[_0xb8ee('0x28')](_0x19f9c9[_0xb8ee('0x29')][_0xb8ee('0x2a')],_0x19f9c9);var _0xff20d2=_0x19739f[_0xb8ee('0x1d')][_0xb8ee('0x1e')](',');_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x0]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x1]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x2]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x3]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x4]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x5]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x6]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x7]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x8]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0x9]);_0x35adf8[_0xb8ee('0x21')](_0xff20d2[0xa]);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9[_0xb8ee('0x14')]['id']);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9['message']['id']);_0x35adf8[_0xb8ee('0x21')](_0x19739f['ChatWebsiteId']);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9[_0xb8ee('0x14')][_0xb8ee('0x2b')]);_0x35adf8[_0xb8ee('0x21')](_0x19f9c9[_0xb8ee('0x2c')]['body']);_0x35adf8['push'](_0x18e300);break;default:_0x35adf8=_['isNil'](_0x19739f[_0xb8ee('0x1d')])?[]:_0x19739f[_0xb8ee('0x1d')]['split'](',');}var _0xd68f53={'id':util[_0xb8ee('0xd')]('%s:%s:%s',_0x135d5d,_0x19739f['id'],_0x19739f[_0xb8ee('0x1a')]),'condition':require('./interval')[_0xb8ee('0x2d')](_0x135d5d,getIntervals(_0x237f49[_0xb8ee('0x2e')],_0x19739f),_0x237f49),'consequence':require(_0xb8ee('0x2f')+_0x19739f['app'])[_0xb8ee('0x30')](_0x135d5d,_0x35adf8,_0x237f49,_0x19f9c9),'p':_0x19739f[_0xb8ee('0x31')]||0x0};logger[_0xb8ee('0x32')]('Push\x20new\x20rule',_0xd68f53['id'],'on\x20interval',getIntervals(_0x237f49['intervals'],_0x19739f)[_0xb8ee('0x19')](_0xb8ee('0x33')));_0x5a3f29['push'](_0xd68f53);}else{logger[_0xb8ee('0x34')](_0xb8ee('0x35'),path[_0xb8ee('0x19')](__dirname,'applications',_0x19739f[_0xb8ee('0x1a')]+_0xb8ee('0x36')));}}_0x237f49[_0xb8ee('0x12')][_0x135d5d]=new RuleEngine(_0x5a3f29);_0x237f49[_0xb8ee('0x12')][_0x135d5d][_0xb8ee('0x37')](_0x19f9c9,function(_0x41ff6a){logger[_0xb8ee('0x32')](_0xb8ee('0x38'),JSON[_0xb8ee('0x39')](_0x41ff6a[_0xb8ee('0x3a')]));if(_0x237f49[_0xb8ee('0x12')][_0x135d5d]){_0x237f49[_0xb8ee('0x12')][_0x135d5d]['emit'](_0xb8ee('0x3b'));}});return _0x13b79c({'code':0xc8,'message':_0x19f9c9});}else{logger[_0xb8ee('0x32')](_0xb8ee('0x3c'));return _0x13b79c({'code':0xc8,'message':_0x19f9c9});}}catch(_0x39695f){logger[_0xb8ee('0x34')](_0x39695f[_0xb8ee('0x3d')]);return _0x40be2d(_0x22b97b['error'](0x1f4,_0x39695f));}}return _0x40be2d(_0xb8ee('0x3e'));});},'AcceptMessage':function(_0x207426){var _0x58f9c5=this;return new Promise(function(_0x89fe5f,_0x4e6970){if(_0x207426[_0xb8ee('0x3f')]&&_0x207426[_0xb8ee('0x3f')]['id']){if(_0x237f49['agents'][_0x207426[_0xb8ee('0x3f')]['id']]){_0x237f49[_0xb8ee('0x40')][_0x207426[_0xb8ee('0x3f')]['id']][_0xb8ee('0x41')]=![];_0x237f49[_0xb8ee('0x40')][_0x207426[_0xb8ee('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x207426[_0xb8ee('0x13')]&&_0x207426[_0xb8ee('0x13')]['id']){try{var _0x43f8a8=getId(_0x207426[_0xb8ee('0x1f')],_0x207426[_0xb8ee('0x13')]?_0x207426['message']['id']:0x0,_0x207426[_0xb8ee('0x14')]?_0x207426[_0xb8ee('0x14')]['id']:0x0);if(_0x237f49[_0xb8ee('0x12')][_0x43f8a8]){_0x237f49[_0xb8ee('0x12')][_0x43f8a8][_0xb8ee('0x42')](_0xb8ee('0x43'));if(rpc[_0x207426[_0xb8ee('0x1f')]+'QueueReport']){rpc[_0x207426[_0xb8ee('0x1f')]+_0xb8ee('0x44')][_0xb8ee('0x45')](_0x43f8a8,{'UserId':_0x207426[_0xb8ee('0x13')][_0xb8ee('0x46')]})[_0xb8ee('0x47')](function(_0x55ac7c){logger[_0xb8ee('0x34')](_0xb8ee('0x48'));});}}return _0x89fe5f({'code':0xc8,'message':_0x207426});}catch(_0x2e9803){logger[_0xb8ee('0x34')](_0x2e9803[_0xb8ee('0x3d')]);return _0x4e6970(_0x58f9c5[_0xb8ee('0x34')](0x1f4,_0x2e9803));}}logger[_0xb8ee('0x34')](_0xb8ee('0x49'));return _0x4e6970(_0x58f9c5[_0xb8ee('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x591d0c){var _0x2cb7cd=this;return new Promise(function(_0x592dfc,_0x4ba434){if(_0x591d0c['agent']&&_0x591d0c[_0xb8ee('0x3f')]['id']){try{if(_0x237f49[_0xb8ee('0x40')][_0x591d0c[_0xb8ee('0x3f')]['id']]){_0x237f49['agents'][_0x591d0c[_0xb8ee('0x3f')]['id']][_0xb8ee('0x41')]=![];_0x237f49[_0xb8ee('0x40')][_0x591d0c[_0xb8ee('0x3f')]['id']]['busyQueue']=undefined;}return _0x592dfc({'code':0xc8,'message':_0x591d0c});}catch(_0x3595e0){logger['error'](_0x3595e0['stack']);return _0x4ba434(_0x2cb7cd[_0xb8ee('0x34')](0x1f4,_0x3595e0));}}logger[_0xb8ee('0x34')](_0xb8ee('0x49'));return _0x4ba434(_0x2cb7cd[_0xb8ee('0x34')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x595992){var _0xfb4ff5=this;return new Promise(function(_0x3d2f39,_0x429ad6){if(_0x595992[_0xb8ee('0x1f')]&&_0x595992[_0xb8ee('0x14')]&&_0x595992[_0xb8ee('0x14')]['id']){try{var _0x3d6c0e=getId(_0x595992[_0xb8ee('0x1f')],_0x595992[_0xb8ee('0x13')]?_0x595992['message']['id']:0x0,_0x595992['interaction']?_0x595992['interaction']['id']:0x0);if(_0x237f49[_0xb8ee('0x12')][_0x3d6c0e]){_0x237f49['rules'][_0x3d6c0e][_0xb8ee('0x42')]('end');}return _0x3d2f39({'code':0xc8,'message':_0x595992});}catch(_0x163277){logger[_0xb8ee('0x34')](_0x163277['stack']);return _0x429ad6(_0xfb4ff5[_0xb8ee('0x34')](0x1f4,_0x163277));}}logger[_0xb8ee('0x34')](_0xb8ee('0x49'));return _0x429ad6(_0xfb4ff5[_0xb8ee('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x157cdd){var _0x2b2e0a=this;return new Promise(function(_0x4f6278,_0x2e532b){if(_0x237f49[_0xb8ee('0x40')][_0xb8ee('0x4a')](_0x157cdd['id'])){for(var _0xd47a77 in _0x157cdd[_0xb8ee('0x4b')]){if(_0x157cdd['capacity'][_0xb8ee('0x4a')](_0xd47a77)){if(_0x237f49['agents'][_0x157cdd['id']][_0xb8ee('0x4a')](_0xd47a77+_0xb8ee('0x4c'))){_0x237f49[_0xb8ee('0x40')][_0x157cdd['id']][_0xd47a77+_0xb8ee('0x4c')]=parseInt(_0x157cdd[_0xb8ee('0x4b')][_0xd47a77],0xa);}}}_0x237f49['agents'][_0x157cdd['id']][_0xb8ee('0x4d')]();return _0x4f6278({'code':0xc8,'message':_0x237f49[_0xb8ee('0x40')][_0x157cdd['id']]});}else{return _0x2e532b(_0x2b2e0a[_0xb8ee('0x34')](0x1f4,_0xb8ee('0x4e')));}});},'Agents':function(_0xf135ac){return new Promise(function(_0x5deab2,_0x26385d){var _0x56ac3a=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x40')]);_0x5deab2({'count':_0x56ac3a[_0xb8ee('0x17')],'rows':_0x56ac3a});});},'ChatQueues':function(_0x54f461){return new Promise(function(_0x363637,_0x4f6c5d){var _0x3042e1=[];for(var _0x84d15e in _0x237f49[_0xb8ee('0x50')]){if(_0x237f49[_0xb8ee('0x50')][_0xb8ee('0x4a')](_0x84d15e)){var _0x5eeb11=_0x237f49[_0xb8ee('0x50')][_0x84d15e];var _0x14192d={'id':_0x5eeb11['id'],'available':_0x5eeb11[_0xb8ee('0x51')],'loggedIn':_0x5eeb11[_0xb8ee('0x52')],'name':_0x5eeb11[_0xb8ee('0x53')],'paused':_0x5eeb11[_0xb8ee('0x54')],'waiting':_0x5eeb11[_0xb8ee('0x55')]};_0x3042e1[_0xb8ee('0x21')](_0x14192d);}}_0x363637({'count':_0x3042e1[_0xb8ee('0x17')],'rows':_0x3042e1});});},'MailQueues':function(_0x4bcc0f){return new Promise(function(_0xbcd97a,_0x470f98){var _0x711d72=[];for(var _0x3ca650 in _0x237f49['mailQueues']){if(_0x237f49['mailQueues']['hasOwnProperty'](_0x3ca650)){var _0x330aff=_0x237f49[_0xb8ee('0x56')][_0x3ca650];var _0x2ed878={'id':_0x330aff['id'],'available':_0x330aff[_0xb8ee('0x51')],'loggedIn':_0x330aff[_0xb8ee('0x52')],'name':_0x330aff['name'],'paused':_0x330aff[_0xb8ee('0x54')],'waiting':_0x330aff[_0xb8ee('0x55')]};_0x711d72['push'](_0x2ed878);}}_0xbcd97a({'count':_0x711d72['length'],'rows':_0x711d72});});},'OpenchannelQueues':function(_0x10c8e6){return new Promise(function(_0x28e95c,_0x40e81e){var _0x1d5542=[];for(var _0x605c14 in _0x237f49['openchannelQueues']){if(_0x237f49[_0xb8ee('0x57')]['hasOwnProperty'](_0x605c14)){var _0x45f939=_0x237f49[_0xb8ee('0x57')][_0x605c14];var _0x2251ae={'id':_0x45f939['id'],'available':_0x45f939[_0xb8ee('0x51')],'loggedIn':_0x45f939[_0xb8ee('0x52')],'name':_0x45f939[_0xb8ee('0x53')],'paused':_0x45f939[_0xb8ee('0x54')],'waiting':_0x45f939[_0xb8ee('0x55')]};_0x1d5542['push'](_0x2251ae);}}_0x28e95c({'count':_0x1d5542[_0xb8ee('0x17')],'rows':_0x1d5542});});},'SmsQueues':function(_0x418b1f){return new Promise(function(_0x1f6da4,_0xa221d7){var _0xae0acb=[];for(var _0x34fe5b in _0x237f49[_0xb8ee('0x58')]){if(_0x237f49[_0xb8ee('0x58')]['hasOwnProperty'](_0x34fe5b)){var _0x5b94a8=_0x237f49[_0xb8ee('0x58')][_0x34fe5b];var _0x4aed0b={'id':_0x5b94a8['id'],'available':_0x5b94a8[_0xb8ee('0x51')],'loggedIn':_0x5b94a8[_0xb8ee('0x52')],'name':_0x5b94a8[_0xb8ee('0x53')],'paused':_0x5b94a8[_0xb8ee('0x54')],'waiting':_0x5b94a8[_0xb8ee('0x55')]};_0xae0acb['push'](_0x4aed0b);}}_0x1f6da4({'count':_0xae0acb[_0xb8ee('0x17')],'rows':_0xae0acb});});},'FaxQueues':function(_0x23945b){return new Promise(function(_0x38d19c,_0x392d10){var _0x1f2394=[];for(var _0x1d5f58 in _0x237f49[_0xb8ee('0x59')]){if(_0x237f49[_0xb8ee('0x59')][_0xb8ee('0x4a')](_0x1d5f58)){var _0x3cd834=_0x237f49[_0xb8ee('0x59')][_0x1d5f58];var _0x5733c0={'id':_0x3cd834['id'],'available':_0x3cd834[_0xb8ee('0x51')],'loggedIn':_0x3cd834[_0xb8ee('0x52')],'name':_0x3cd834[_0xb8ee('0x53')],'paused':_0x3cd834[_0xb8ee('0x54')],'waiting':_0x3cd834[_0xb8ee('0x55')]};_0x1f2394[_0xb8ee('0x21')](_0x5733c0);}}_0x38d19c({'count':_0x1f2394['length'],'rows':_0x1f2394});});},'WhatsappQueues':function(_0x16d3e9){return new Promise(function(_0x35f5d2,_0x4962d1){var _0x1ec95b=[];for(var _0x1e4140 in _0x237f49[_0xb8ee('0x5a')]){if(_0x237f49['whatsappQueues'][_0xb8ee('0x4a')](_0x1e4140)){var _0x908921=_0x237f49[_0xb8ee('0x5a')][_0x1e4140];var _0x467040={'id':_0x908921['id'],'available':_0x908921[_0xb8ee('0x51')],'loggedIn':_0x908921['loggedIn'],'name':_0x908921[_0xb8ee('0x53')],'paused':_0x908921[_0xb8ee('0x54')],'waiting':_0x908921['waiting']};_0x1ec95b[_0xb8ee('0x21')](_0x467040);}}_0x35f5d2({'count':_0x1ec95b[_0xb8ee('0x17')],'rows':_0x1ec95b});});},'ChatQueuesWaitingInteractions':function(_0x3f5e8d){return new Promise(function(_0x678e7,_0x32117e){var _0x11bce1=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5b')]);_0x678e7({'count':_0x11bce1[_0xb8ee('0x17')],'rows':_0x11bce1});});},'MailQueuesWaitingInteractions':function(_0x20a8da){return new Promise(function(_0x5d6449,_0x157b89){var _0x667eb6=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5c')]);_0x5d6449({'count':_0x667eb6[_0xb8ee('0x17')],'rows':_0x667eb6});});},'OpenchannelQueuesWaitingInteractions':function(_0x4c7e18){return new Promise(function(_0x546f8d,_0x202d00){var _0xf8fc4a=_['values'](_0x237f49[_0xb8ee('0x5d')]);_0x546f8d({'count':_0xf8fc4a[_0xb8ee('0x17')],'rows':_0xf8fc4a});});},'SmsQueuesWaitingInteractions':function(_0x3b9ce5){return new Promise(function(_0x1364fd,_0x5efff4){var _0x1af63f=_[_0xb8ee('0x4f')](_0x237f49['smsQueuesWaitingInteractions']);_0x1364fd({'count':_0x1af63f[_0xb8ee('0x17')],'rows':_0x1af63f});});},'FaxQueuesWaitingInteractions':function(_0x938306){return new Promise(function(_0x175547,_0x5f0b07){var _0x5164bb=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5e')]);_0x175547({'count':_0x5164bb[_0xb8ee('0x17')],'rows':_0x5164bb});});},'WhatsappQueuesWaitingInteractions':function(_0x25ecd5){return new Promise(function(_0x4637b8,_0x54379e){var _0x540e63=_[_0xb8ee('0x4f')](_0x237f49[_0xb8ee('0x5f')]);_0x4637b8({'count':_0x540e63[_0xb8ee('0x17')],'rows':_0x540e63});});}};var _0x5a8565=jayson[_0xb8ee('0x60')](_0x6c405c)[_0xb8ee('0x61')]();_0x5a8565['on'](_0xb8ee('0x34'),function(_0x1037c2){logger[_0xb8ee('0x34')](JSON[_0xb8ee('0x39')](_0x1037c2));return _0x253c95(_0x1037c2);});_0x5a8565[_0xb8ee('0x62')](0x232c,_0xb8ee('0x63'),function(){console[_0xb8ee('0x64')](_0xb8ee('0x65'),0x232c);return _0x2af0c5(_0xb8ee('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 40ceffd..58ebcc8 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 _0x3945=['all','some','[%s][INTERVAL]\x20%s\x20%s','when','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','indexOf','[%s][INTERVAL]\x20%s'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x3945,0x163));var _0x5394=function(_0x38c9af,_0x5970a8){_0x38c9af=_0x38c9af-0x0;var _0x177d3b=_0x3945[_0x38c9af];return _0x177d3b;};'use strict';var util=require(_0x5394('0x0'));var BPromise=require(_0x5394('0x1'));var jayson=require(_0x5394('0x2'));var _=require(_0x5394('0x3'));var logger=require(_0x5394('0x4'))('routing');var client=jayson[_0x5394('0x5')]['http']({'port':0x232a});function request(_0x2caee0,_0x550172){return new BPromise(function(_0x351047,_0x5d393c){return client[_0x5394('0x6')](_0x2caee0,_0x550172)[_0x5394('0x7')](function(_0x14da36){if(_0x14da36['error']){return _0x5d393c(_0x14da36[_0x5394('0x8')][_0x5394('0x9')]);}else{return _0x351047(_0x14da36['result']);}})[_0x5394('0xa')](function(_0x503183){return _0x5d393c(_0x503183);});});}exports[_0x5394('0xb')]=function(_0x20e1ee,_0x274fbc,_0x2307b4){return function(_0x8721e1){if(_0x2307b4['rules']&&!_0x2307b4[_0x5394('0xc')][_0x20e1ee]){logger[_0x5394('0xd')](_0x5394('0xe'),_0x20e1ee);return _0x8721e1[_0x5394('0xf')]();}var _0x5c44b7=[];for(var _0x4f9d1a=0x0;_0x4f9d1a<_0x274fbc[_0x5394('0x10')];_0x4f9d1a+=0x1){_0x5c44b7[_0x5394('0x11')](request(_0x5394('0x12'),{'command':util[_0x5394('0x13')]('iftime\x20%s',_0x274fbc[_0x4f9d1a])})[_0x5394('0x7')](function(_0x9f812){return _0x9f812&&_0x9f812[_0x5394('0x9')]&&_0x9f812[_0x5394('0x9')][_0x5394('0x14')]('true')>=0x0?!![]:![];})[_0x5394('0xa')](function(_0x495fd3){logger[_0x5394('0x8')](_0x5394('0x15'),_0x20e1ee,_0x274fbc[_0x4f9d1a]);}));}BPromise[_0x5394('0x16')](_0x5c44b7)['then'](function(_0x2904d6){var _0x1656f1=_[_0x5394('0x17')](_0x2904d6);logger[_0x5394('0xd')](_0x5394('0x18'),_0x20e1ee,_0x274fbc['join']('\x20|\x20'),_0x1656f1);_0x8721e1[_0x5394('0x19')](_0x1656f1);})[_0x5394('0xa')](function(_0x404a9a){console['log'](_0x404a9a);logger[_0x5394('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x20e1ee,_0x274fbc[_0x5394('0x1a')](_0x5394('0x1b')),_0x404a9a[_0x5394('0x1c')]);_0x8721e1[_0x5394('0xf')]();});};}; \ No newline at end of file +var _0xd24b=['jayson/promise','../../../config/logger','client','http','then','error','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','catch','log','stop','util'];(function(_0x10d405,_0x28d136){var _0x12bd98=function(_0x3b6cc3){while(--_0x3b6cc3){_0x10d405['push'](_0x10d405['shift']());}};_0x12bd98(++_0x28d136);}(_0xd24b,0x73));var _0xbd24=function(_0xa38daf,_0x30406b){_0xa38daf=_0xa38daf-0x0;var _0x1b786a=_0xd24b[_0xa38daf];return _0x1b786a;};'use strict';var util=require(_0xbd24('0x0'));var BPromise=require('bluebird');var jayson=require(_0xbd24('0x1'));var _=require('lodash');var logger=require(_0xbd24('0x2'))('routing');var client=jayson[_0xbd24('0x3')][_0xbd24('0x4')]({'port':0x232a});function request(_0x300749,_0x3ea439){return new BPromise(function(_0x5663cf,_0x43398e){return client['request'](_0x300749,_0x3ea439)[_0xbd24('0x5')](function(_0xe170cb){if(_0xe170cb[_0xbd24('0x6')]){return _0x43398e(_0xe170cb[_0xbd24('0x6')]['message']);}else{return _0x5663cf(_0xe170cb[_0xbd24('0x7')]);}})['catch'](function(_0x249bb2){return _0x43398e(_0x249bb2);});});}exports[_0xbd24('0x8')]=function(_0x398f5b,_0x5c1cf3,_0x139190){return function(_0x4e9eec){if(_0x139190[_0xbd24('0x9')]&&!_0x139190[_0xbd24('0x9')][_0x398f5b]){logger[_0xbd24('0xa')](_0xbd24('0xb'),_0x398f5b);return _0x4e9eec['stop']();}var _0x301e43=[];for(var _0x1a9c72=0x0;_0x1a9c72<_0x5c1cf3[_0xbd24('0xc')];_0x1a9c72+=0x1){_0x301e43[_0xbd24('0xd')](request(_0xbd24('0xe'),{'command':util[_0xbd24('0xf')](_0xbd24('0x10'),_0x5c1cf3[_0x1a9c72])})['then'](function(_0x141138){return _0x141138&&_0x141138['message']&&_0x141138[_0xbd24('0x11')][_0xbd24('0x12')](_0xbd24('0x13'))>=0x0?!![]:![];})['catch'](function(_0x5176ed){logger[_0xbd24('0x6')](_0xbd24('0x14'),_0x398f5b,_0x5c1cf3[_0x1a9c72]);}));}BPromise[_0xbd24('0x15')](_0x301e43)['then'](function(_0x13624d){var _0x1ba7fc=_['some'](_0x13624d);logger[_0xbd24('0xa')](_0xbd24('0x16'),_0x398f5b,_0x5c1cf3[_0xbd24('0x17')](_0xbd24('0x18')),_0x1ba7fc);_0x4e9eec[_0xbd24('0x19')](_0x1ba7fc);})[_0xbd24('0x1a')](function(_0x31b9c3){console[_0xbd24('0x1b')](_0x31b9c3);logger['error'](_0xbd24('0x16'),_0x398f5b,_0x5c1cf3['join'](_0xbd24('0x18')),_0x31b9c3['stack']);_0x4e9eec[_0xbd24('0x1c')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index feadd8f..94bff0d 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 _0x13f6=['[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','calleridname','agententerreason','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','info','format','uniqueid','channel','queue','interface','calleridnum','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','connectedlinename','membername','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','[%s][agents][agentconnect]'];(function(_0x235c3d,_0x3fa014){var _0x10bb48=function(_0x3e10b7){while(--_0x3e10b7){_0x235c3d['push'](_0x235c3d['shift']());}};_0x10bb48(++_0x3fa014);}(_0x13f6,0x124));var _0x613f=function(_0x71b9f6,_0x2194bc){_0x71b9f6=_0x71b9f6-0x0;var _0x3dea01=_0x13f6[_0x71b9f6];return _0x3dea01;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563492,_0xd04cfd){utils[_0x613f('0x2')](util[_0x613f('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x563492[_0x613f('0x4')],_0x563492[_0x613f('0x5')],_0x563492[_0x613f('0x6')],_0x563492['membername'],_0x563492[_0x613f('0x7')],_0x563492[_0x613f('0x8')],_0x563492['connectedlinenum'],_0x563492['lastevent']));if(_0x563492['queue']){utils['getVoiceQueueByName'](_0x563492[_0x613f('0x6')])[_0x613f('0x9')](function(_0x363736){if(_0x363736){_0x563492[_0x613f('0xa')]=_0x363736['type'];_0x563492[_0x613f('0xb')]=_0x563492[_0x613f('0xc')]?_0x363736[_0x613f('0xd')]:![];_0x563492['acwtime']=_0x563492[_0x613f('0xb')]?_0x363736[_0x613f('0xe')]:0x0;}utils[_0x613f('0xf')]('CreateVoiceAgentReport',_0x563492);});}else{utils[_0x613f('0xf')](_0x613f('0x10'),_0x563492);}if(_0xd04cfd){delete transfers[_0x563492['uniqueid']];}else{delete agents[_0x563492['destuniqueid']];}}exports['agentcalled']=function(_0x38d90a){try{utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x12'),_0x38d90a[_0x613f('0x4')]),_0x38d90a);agents[_0x38d90a[_0x613f('0x13')]]=_0x38d90a;agents[_0x38d90a[_0x613f('0x13')]][_0x613f('0x14')]=utils[_0x613f('0x15')]();agents[_0x38d90a[_0x613f('0x13')]]['lastevent']=_0x613f('0x16');agents[_0x38d90a['destuniqueid']]['connectedlinenum']=null;agents[_0x38d90a[_0x613f('0x13')]][_0x613f('0x17')]=null;utils['info'](util[_0x613f('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x38d90a[_0x613f('0x4')],agents[_0x38d90a[_0x613f('0x13')]][_0x613f('0x18')],_0x38d90a[_0x613f('0x13')]));}catch(_0x3c0feb){utils[_0x613f('0x19')](util['format']('[%s][agents][agentcalled]',_0x38d90a[_0x613f('0x4')]),_0x3c0feb);}};exports['agentringnoanswer']=function(_0x48493c){try{if(!_[_0x613f('0x1a')](agents[_0x48493c[_0x613f('0x13')]])){utils['debug'](util[_0x613f('0x3')](_0x613f('0x1b'),_0x48493c[_0x613f('0x4')]),_0x48493c);utils['info'](util['format'](_0x613f('0x1c'),_0x48493c[_0x613f('0x4')],agents[_0x48493c[_0x613f('0x13')]]['membername'],_0x48493c[_0x613f('0x13')]));agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x1d')]=!![];agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x1e')]=utils['now']();agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x1f')]='timeout';agents[_0x48493c[_0x613f('0x13')]][_0x613f('0x20')]=_0x613f('0x21');agents[_0x48493c['destuniqueid']]['holdtime']=_0x48493c['ringtime']?parseInt(_0x48493c[_0x613f('0x22')])/0x3e8:0x0;agents[_0x48493c['destuniqueid']][_0x613f('0x23')]=0x0;unanswered[_0x613f('0x24')](_0x48493c['destuniqueid']);}}catch(_0x121241){utils[_0x613f('0x19')](util['format']('[%s][agents][agentringnoanswer]',_0x48493c['uniqueid']),_0x121241);}};exports[_0x613f('0x25')]=function(_0x7c1a94){try{_[_0x613f('0x26')](agents,function(_0x47f4af,_0x23eda8){if(_0x47f4af[_0x613f('0x4')]==_0x7c1a94[_0x613f('0x4')]&&!_[_0x613f('0x27')](unanswered,_0x47f4af['destuniqueid'])){utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x28'),_0x7c1a94[_0x613f('0x4')]),_0x7c1a94);utils[_0x613f('0x2')](util[_0x613f('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x7c1a94[_0x613f('0x4')],_0x47f4af[_0x613f('0x18')],_0x47f4af[_0x613f('0x13')]));_0x47f4af['agentringnoanswer']=!![];_0x47f4af[_0x613f('0x1e')]=utils['now']();_0x47f4af[_0x613f('0x1f')]=_0x613f('0x29');_0x47f4af[_0x613f('0x20')]=_0x613f('0x29');_0x47f4af[_0x613f('0x2a')]=_0x7c1a94[_0x613f('0x2a')];_0x47f4af['talktime']=0x0;writeDB(_0x47f4af);}});}catch(_0x1a18ce){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x28'),_0x7c1a94[_0x613f('0x4')]),_0x1a18ce);}};exports['agentconnect']=function(_0x59236e){try{if(agents[_0x59236e['destuniqueid']]){utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x2b'),_0x59236e[_0x613f('0x4')]),_0x59236e);utils['info'](util[_0x613f('0x3')](_0x613f('0x2c'),_0x59236e['uniqueid'],agents[_0x59236e[_0x613f('0x13')]]['membername'],_0x59236e[_0x613f('0x13')]));agents[_0x59236e['destuniqueid']][_0x613f('0x2d')]=utils['now']();agents[_0x59236e[_0x613f('0x13')]][_0x613f('0x2e')]=_0x59236e[_0x613f('0x2e')];agents[_0x59236e['destuniqueid']][_0x613f('0x17')]=_0x59236e[_0x613f('0x17')];agents[_0x59236e[_0x613f('0x13')]][_0x613f('0x2a')]=_0x59236e[_0x613f('0x22')];agents[_0x59236e[_0x613f('0x13')]][_0x613f('0x1f')]=_0x613f('0x2f');_[_0x613f('0x26')](agents,function(_0x3313c1,_0x4da8d3){if(_0x3313c1[_0x613f('0x13')]!=_0x59236e[_0x613f('0x13')]&&_0x3313c1[_0x613f('0x4')]==_0x59236e[_0x613f('0x4')]){_0x3313c1[_0x613f('0x23')]=0x0;_0x3313c1[_0x613f('0x2a')]=_0x59236e[_0x613f('0x22')];_0x3313c1['agentringnoanswer']=!![];_0x3313c1[_0x613f('0x1e')]=utils[_0x613f('0x15')]();_0x3313c1[_0x613f('0x1f')]=_0x613f('0x30');_0x3313c1[_0x613f('0x20')]=_0x613f('0x30');_0x3313c1[_0x613f('0x31')]=_0x59236e['destuniqueid'];_0x3313c1[_0x613f('0x32')]=_0x59236e[_0x613f('0x18')];writeDB(_0x3313c1);}});}}catch(_0x3bb605){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x2b'),_0x59236e[_0x613f('0x4')]),_0x3bb605);}};exports[_0x613f('0xc')]=function(_0x403feb){try{if(!_[_0x613f('0x1a')](agents[_0x403feb[_0x613f('0x13')]])){utils[_0x613f('0x11')](util[_0x613f('0x3')]('[%s][agents][agentcomplete]',_0x403feb[_0x613f('0x4')]),_0x403feb);utils[_0x613f('0x2')](util[_0x613f('0x3')](_0x613f('0x33'),_0x403feb['uniqueid'],agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x18')],_0x403feb[_0x613f('0x13')]));agents[_0x403feb[_0x613f('0x13')]][_0x613f('0xc')]=!![];agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x34')]=utils[_0x613f('0x15')]();agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x23')]=utils['diffTime'](agents[_0x403feb['destuniqueid']][_0x613f('0x34')],agents[_0x403feb[_0x613f('0x13')]]['agentconnectAt']);agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x20')]=_0x403feb[_0x613f('0x20')];agents[_0x403feb[_0x613f('0x13')]][_0x613f('0x1f')]=_0x613f('0x35');writeDB(agents[_0x403feb[_0x613f('0x13')]]);}}catch(_0x3a7f95){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x36'),_0x403feb[_0x613f('0x4')]),_0x3a7f95);}};exports[_0x613f('0x37')]=function(_0x17f8e5){try{if(!_[_0x613f('0x1a')](agents[_0x17f8e5[_0x613f('0x38')]])){utils[_0x613f('0x11')](util[_0x613f('0x3')]('[%s][agents][blindtransfer]',_0x17f8e5['uniqueid']),_0x17f8e5);utils[_0x613f('0x2')](util[_0x613f('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x17f8e5['uniqueid'],agents[_0x17f8e5[_0x613f('0x38')]]['membername'],agents[_0x17f8e5['transfereruniqueid']][_0x613f('0x4')]));agents[_0x17f8e5[_0x613f('0x38')]][_0x613f('0x39')]=!![];agents[_0x17f8e5['transfereruniqueid']][_0x613f('0x3a')]=_0x613f('0x3b');agents[_0x17f8e5['transfereruniqueid']]['transferexten']=_0x17f8e5[_0x613f('0x3c')];agents[_0x17f8e5[_0x613f('0x38')]][_0x613f('0x3d')]=agents[_0x17f8e5[_0x613f('0x38')]][_0x613f('0x4')];}}catch(_0x395357){utils[_0x613f('0x19')](util['format']('[%s][agents][blindtransfer]',_0x17f8e5[_0x613f('0x4')]),_0x395357);}};exports['attendedtransfer']=function(_0x5dd54e){try{utils[_0x613f('0x11')](util[_0x613f('0x3')](_0x613f('0x3e'),_0x5dd54e['origtransfereruniqueid']),_0x5dd54e);if(_0x5dd54e[_0x613f('0x3f')]==_0x5dd54e[_0x613f('0x40')]){if(!_[_0x613f('0x1a')](agents[_0x5dd54e[_0x613f('0x41')]])){utils[_0x613f('0x2')](util[_0x613f('0x3')](_0x613f('0x42'),_0x5dd54e['origtransfereruniqueid'],agents[_0x5dd54e[_0x613f('0x41')]]['membername']));agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x39')]=!![];agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x3a')]=_0x613f('0x43');agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x44')]=_0x5dd54e[_0x613f('0x45')];agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x3d')]=_0x5dd54e[_0x613f('0x3f')];}if(_0x5dd54e[_0x613f('0x46')]&&agents[_0x5dd54e[_0x613f('0x46')]]){agents[_0x5dd54e['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x5dd54e[_0x613f('0x46')]]=_['clone'](agents[_0x5dd54e[_0x613f('0x46')]]);transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x8')]=agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x8')];transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x47')]=agents[_0x5dd54e[_0x613f('0x41')]][_0x613f('0x47')];transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x14')]=utils['now']();transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x2d')]=utils[_0x613f('0x15')]();transfers[_0x5dd54e[_0x613f('0x46')]]['holdtime']=0x0;transfers[_0x5dd54e[_0x613f('0x46')]][_0x613f('0x48')]=0x2;}}else if(_0x5dd54e['secondtransfereruniqueid']==_0x5dd54e['secondtransfererlinkedid']){if(!_[_0x613f('0x1a')](agents[_0x5dd54e['origtransfereruniqueid']])){utils['info'](util['format'](_0x613f('0x42'),_0x5dd54e['origtransfereruniqueid'],agents[_0x5dd54e['origtransfereruniqueid']]['membername']));agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x39')]=!![];agents[_0x5dd54e['origtransfereruniqueid']][_0x613f('0x3a')]=_0x613f('0x43');agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x44')]=_0x5dd54e['secondtransfererexten'];agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x3d')]=_0x5dd54e['secondtransfereruniqueid'];}if(_0x5dd54e[_0x613f('0x49')]&&agents[_0x5dd54e[_0x613f('0x49')]]){agents[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x48')]=0x1;transfers[_0x5dd54e[_0x613f('0x49')]]=_[_0x613f('0x4a')](agents[_0x5dd54e[_0x613f('0x49')]]);transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x8')]=agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x8')];transfers[_0x5dd54e[_0x613f('0x49')]]['calleridname']=agents[_0x5dd54e[_0x613f('0x3f')]][_0x613f('0x47')];transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x14')]=utils[_0x613f('0x15')]();transfers[_0x5dd54e[_0x613f('0x49')]]['agentconnectAt']=utils[_0x613f('0x15')]();transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x2a')]=0x0;transfers[_0x5dd54e[_0x613f('0x49')]][_0x613f('0x48')]=0x2;}}}catch(_0x2ae459){utils['error'](util['format'](_0x613f('0x3e'),_0x5dd54e[_0x613f('0x3f')]),_0x2ae459);}};exports[_0x613f('0x4b')]=function(_0xddcd6){try{utils['debug'](util[_0x613f('0x3')](_0x613f('0x4c'),_0xddcd6[_0x613f('0x4')]),_0xddcd6);if(agents[_0xddcd6[_0x613f('0x4')]]&&agents[_0xddcd6['uniqueid']][_0x613f('0x20')]===_0x613f('0x21')){if(_0xddcd6[_0x613f('0x4d')]==='21'){agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x20')]=_0x613f('0x4e');agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x1f')]='rejected';}utils[_0x613f('0x2')](util[_0x613f('0x3')](_0x613f('0x4f'),_0xddcd6[_0x613f('0x4')],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x18')],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x20')],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x1f')]));writeDB(agents[_0xddcd6['uniqueid']]);var _0x2c4b88=unanswered[_0x613f('0x50')](_0xddcd6[_0x613f('0x4')]);if(_0x2c4b88>-0x1){unanswered[_0x613f('0x51')](_0x2c4b88,0x1);}}if(transfers[_0xddcd6[_0x613f('0x4')]]){transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0xc')]=!![];transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x34')]=utils[_0x613f('0x15')]();transfers[_0xddcd6[_0x613f('0x4')]]['talktime']=utils[_0x613f('0x52')](transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x34')],transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x2d')]);transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x20')]=_0x613f('0x53');transfers[_0xddcd6[_0x613f('0x4')]][_0x613f('0x1f')]=_0x613f('0x35');utils[_0x613f('0x2')](util['format'](_0x613f('0x4f'),_0xddcd6[_0x613f('0x4')],transfers[_0xddcd6['uniqueid']][_0x613f('0x18')],transfers[_0xddcd6['uniqueid']][_0x613f('0x20')],transfers[_0xddcd6['uniqueid']]['lastevent']));writeDB(transfers[_0xddcd6[_0x613f('0x4')]],!![]);}if(agents[_0xddcd6[_0x613f('0x4')]]&&agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x2d')]){agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0xc')]=!![];agents[_0xddcd6[_0x613f('0x4')]]['agentcompleteAt']=utils[_0x613f('0x15')]();agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x23')]=utils[_0x613f('0x52')](agents[_0xddcd6[_0x613f('0x4')]]['agentcompleteAt'],agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x2d')]);agents[_0xddcd6['uniqueid']][_0x613f('0x20')]=agents[_0xddcd6[_0x613f('0x4')]][_0x613f('0x39')]?'transfer':'agent';agents[_0xddcd6['uniqueid']][_0x613f('0x1f')]=_0x613f('0x35');utils['info'](util[_0x613f('0x3')](_0x613f('0x4f'),_0xddcd6[_0x613f('0x4')],agents[_0xddcd6['uniqueid']][_0x613f('0x18')],agents[_0xddcd6['uniqueid']][_0x613f('0x20')],agents[_0xddcd6['uniqueid']]['lastevent']));writeDB(agents[_0xddcd6[_0x613f('0x4')]]);}}catch(_0x1b5f6e){utils[_0x613f('0x19')](util[_0x613f('0x3')](_0x613f('0x4c'),_0xddcd6[_0x613f('0x4')]),_0x1b5f6e);}}; \ No newline at end of file +var _0xfe57=['agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','agentconnect','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','CreateVoiceAgentReport','request','agentcalled','destuniqueid','agentcalledAt','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x553eca,_0xaa129a){var _0x221d37=function(_0x2d3981){while(--_0x2d3981){_0x553eca['push'](_0x553eca['shift']());}};_0x221d37(++_0xaa129a);}(_0xfe57,0x195));var _0x7fe5=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xfe57[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x581f71,_0x3f7dca){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x4'),_0x581f71[_0x7fe5('0x5')],_0x581f71[_0x7fe5('0x6')],_0x581f71[_0x7fe5('0x7')],_0x581f71[_0x7fe5('0x8')],_0x581f71[_0x7fe5('0x9')],_0x581f71[_0x7fe5('0xa')],_0x581f71[_0x7fe5('0xb')],_0x581f71[_0x7fe5('0xc')]));if(_0x581f71[_0x7fe5('0x7')]){utils['getVoiceQueueByName'](_0x581f71[_0x7fe5('0x7')])['then'](function(_0x3564f1){if(_0x3564f1){_0x581f71[_0x7fe5('0xd')]=_0x3564f1['type'];_0x581f71['agentacw']=_0x581f71[_0x7fe5('0xe')]?_0x3564f1[_0x7fe5('0xf')]:![];_0x581f71['acwtime']=_0x581f71[_0x7fe5('0x10')]?_0x3564f1['acwTimeout']:0x0;}utils['request'](_0x7fe5('0x11'),_0x581f71);});}else{utils[_0x7fe5('0x12')](_0x7fe5('0x11'),_0x581f71);}if(_0x3f7dca){delete transfers[_0x581f71[_0x7fe5('0x5')]];}else{delete agents[_0x581f71['destuniqueid']];}}exports[_0x7fe5('0x13')]=function(_0x16bed9){try{utils['debug'](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9[_0x7fe5('0x5')]),_0x16bed9);agents[_0x16bed9[_0x7fe5('0x14')]]=_0x16bed9;agents[_0x16bed9['destuniqueid']][_0x7fe5('0x15')]=utils['now']();agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x16');agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0xb')]=null;agents[_0x16bed9[_0x7fe5('0x14')]]['connectedlinename']=null;utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x17'),_0x16bed9[_0x7fe5('0x5')],agents[_0x16bed9[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x16bed9[_0x7fe5('0x14')]));}catch(_0x29b0bd){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')]('[%s][agents][agentcalled]',_0x16bed9['uniqueid']),_0x29b0bd);}};exports[_0x7fe5('0x19')]=function(_0x459c2d){try{if(!_[_0x7fe5('0x1a')](agents[_0x459c2d[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x459c2d);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x1d'),_0x459c2d[_0x7fe5('0x5')],agents[_0x459c2d['destuniqueid']][_0x7fe5('0x8')],_0x459c2d[_0x7fe5('0x14')]));agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswer']=!![];agents[_0x459c2d[_0x7fe5('0x14')]]['agentringnoanswerAt']=utils[_0x7fe5('0x1e')]();agents[_0x459c2d['destuniqueid']][_0x7fe5('0xc')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x20')]=_0x7fe5('0x1f');agents[_0x459c2d[_0x7fe5('0x14')]]['holdtime']=_0x459c2d['ringtime']?parseInt(_0x459c2d[_0x7fe5('0x21')])/0x3e8:0x0;agents[_0x459c2d[_0x7fe5('0x14')]][_0x7fe5('0x22')]=0x0;unanswered[_0x7fe5('0x23')](_0x459c2d['destuniqueid']);}}catch(_0x46f816){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x1c'),_0x459c2d[_0x7fe5('0x5')]),_0x46f816);}};exports[_0x7fe5('0x24')]=function(_0x1f8572){try{_[_0x7fe5('0x25')](agents,function(_0x5c07f0,_0xe521c6){if(_0x5c07f0[_0x7fe5('0x5')]==_0x1f8572['uniqueid']&&!_[_0x7fe5('0x26')](unanswered,_0x5c07f0[_0x7fe5('0x14')])){utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x1f8572);utils['info'](util[_0x7fe5('0x3')](_0x7fe5('0x28'),_0x1f8572[_0x7fe5('0x5')],_0x5c07f0[_0x7fe5('0x8')],_0x5c07f0['destuniqueid']));_0x5c07f0[_0x7fe5('0x19')]=!![];_0x5c07f0[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x5c07f0[_0x7fe5('0xc')]=_0x7fe5('0x2a');_0x5c07f0[_0x7fe5('0x20')]='abandoned';_0x5c07f0[_0x7fe5('0x2b')]=_0x1f8572[_0x7fe5('0x2b')];_0x5c07f0[_0x7fe5('0x22')]=0x0;writeDB(_0x5c07f0);}});}catch(_0x39cfe9){utils['error'](util['format'](_0x7fe5('0x27'),_0x1f8572['uniqueid']),_0x39cfe9);}};exports[_0x7fe5('0x2c')]=function(_0x513680){try{if(agents[_0x513680[_0x7fe5('0x14')]]){utils['debug'](util['format']('[%s][agents][agentconnect]',_0x513680['uniqueid']),_0x513680);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x513680[_0x7fe5('0x5')],agents[_0x513680[_0x7fe5('0x14')]]['membername'],_0x513680[_0x7fe5('0x14')]));agents[_0x513680['destuniqueid']]['agentconnectAt']=utils[_0x7fe5('0x1e')]();agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xb')]=_0x513680[_0x7fe5('0xb')];agents[_0x513680[_0x7fe5('0x14')]]['connectedlinename']=_0x513680[_0x7fe5('0x2d')];agents[_0x513680[_0x7fe5('0x14')]]['holdtime']=_0x513680[_0x7fe5('0x21')];agents[_0x513680[_0x7fe5('0x14')]][_0x7fe5('0xc')]=_0x7fe5('0x2e');_[_0x7fe5('0x25')](agents,function(_0x1c81c8,_0x1a14e3){if(_0x1c81c8['destuniqueid']!=_0x513680['destuniqueid']&&_0x1c81c8[_0x7fe5('0x5')]==_0x513680['uniqueid']){_0x1c81c8[_0x7fe5('0x22')]=0x0;_0x1c81c8[_0x7fe5('0x2b')]=_0x513680['ringtime'];_0x1c81c8[_0x7fe5('0x19')]=!![];_0x1c81c8[_0x7fe5('0x29')]=utils[_0x7fe5('0x1e')]();_0x1c81c8[_0x7fe5('0xc')]=_0x7fe5('0x2f');_0x1c81c8[_0x7fe5('0x20')]=_0x7fe5('0x2f');_0x1c81c8['answeredelsewheredestinationuniqueid']=_0x513680['destuniqueid'];_0x1c81c8[_0x7fe5('0x30')]=_0x513680['membername'];writeDB(_0x1c81c8);}});}}catch(_0xad0b05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x31'),_0x513680['uniqueid']),_0xad0b05);}};exports[_0x7fe5('0xe')]=function(_0x5439bc){try{if(!_['isNil'](agents[_0x5439bc[_0x7fe5('0x14')]])){utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x5439bc);utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x33'),_0x5439bc['uniqueid'],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x8')],_0x5439bc['destuniqueid']));agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0xe')]=!![];agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x34')]=utils['now']();agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x5439bc['destuniqueid']][_0x7fe5('0x34')],agents[_0x5439bc[_0x7fe5('0x14')]][_0x7fe5('0x36')]);agents[_0x5439bc['destuniqueid']][_0x7fe5('0x20')]=_0x5439bc[_0x7fe5('0x20')];agents[_0x5439bc[_0x7fe5('0x14')]]['lastevent']=_0x7fe5('0x37');writeDB(agents[_0x5439bc[_0x7fe5('0x14')]]);}}catch(_0x1ac93a){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x32'),_0x5439bc[_0x7fe5('0x5')]),_0x1ac93a);}};exports[_0x7fe5('0x38')]=function(_0x446f01){try{if(!_[_0x7fe5('0x1a')](agents[_0x446f01[_0x7fe5('0x39')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x446f01['uniqueid']),_0x446f01);utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x3a'),_0x446f01[_0x7fe5('0x5')],agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x8')],agents[_0x446f01[_0x7fe5('0x39')]]['uniqueid']));agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3b')]=!![];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3c')]=_0x7fe5('0x3d');agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x3e')]=_0x446f01[_0x7fe5('0x3f')];agents[_0x446f01[_0x7fe5('0x39')]][_0x7fe5('0x40')]=agents[_0x446f01['transfereruniqueid']][_0x7fe5('0x5')];}}catch(_0x401d05){utils[_0x7fe5('0x18')](util[_0x7fe5('0x3')](_0x7fe5('0x41'),_0x446f01[_0x7fe5('0x5')]),_0x401d05);}};exports['attendedtransfer']=function(_0x31a196){try{utils[_0x7fe5('0x1b')](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x31a196);if(_0x31a196[_0x7fe5('0x43')]==_0x31a196[_0x7fe5('0x44')]){if(!_['isNil'](agents[_0x31a196[_0x7fe5('0x45')]])){utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3b')]=!![];agents[_0x31a196[_0x7fe5('0x45')]]['transfertype']=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x48')];agents[_0x31a196[_0x7fe5('0x45')]][_0x7fe5('0x40')]=_0x31a196[_0x7fe5('0x43')];}if(_0x31a196[_0x7fe5('0x49')]&&agents[_0x31a196[_0x7fe5('0x49')]]){agents[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196['transfereeuniqueid']]=_[_0x7fe5('0x4b')](agents[_0x31a196[_0x7fe5('0x49')]]);transfers[_0x31a196[_0x7fe5('0x49')]]['calleridnum']=agents[_0x31a196['secondtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfereeuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x45')]]['calleridname'];transfers[_0x31a196[_0x7fe5('0x49')]]['agentcalledAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x36')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x49')]][_0x7fe5('0x2b')]=0x0;transfers[_0x31a196['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x31a196[_0x7fe5('0x45')]==_0x31a196[_0x7fe5('0x4d')]){if(!_[_0x7fe5('0x1a')](agents[_0x31a196[_0x7fe5('0x43')]])){utils[_0x7fe5('0x2')](util['format'](_0x7fe5('0x46'),_0x31a196[_0x7fe5('0x43')],agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x8')]));agents[_0x31a196[_0x7fe5('0x43')]]['transfer']=!![];agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3c')]=_0x7fe5('0x47');agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x3e')]=_0x31a196[_0x7fe5('0x4e')];agents[_0x31a196[_0x7fe5('0x43')]]['transferuniqueid']=_0x31a196[_0x7fe5('0x45')];}if(_0x31a196[_0x7fe5('0x4f')]&&agents[_0x31a196[_0x7fe5('0x4f')]]){agents[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x1;transfers[_0x31a196[_0x7fe5('0x4f')]]=_[_0x7fe5('0x4b')](agents[_0x31a196['transfertargetuniqueid']]);transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0xa')]=agents[_0x31a196['origtransfereruniqueid']][_0x7fe5('0xa')];transfers[_0x31a196['transfertargetuniqueid']][_0x7fe5('0x4c')]=agents[_0x31a196[_0x7fe5('0x43')]][_0x7fe5('0x4c')];transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x15')]=utils[_0x7fe5('0x1e')]();transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x36')]=utils['now']();transfers[_0x31a196[_0x7fe5('0x4f')]]['holdtime']=0x0;transfers[_0x31a196[_0x7fe5('0x4f')]][_0x7fe5('0x4a')]=0x2;}}}catch(_0x36ac40){utils['error'](util[_0x7fe5('0x3')](_0x7fe5('0x42'),_0x31a196[_0x7fe5('0x43')]),_0x36ac40);}};exports[_0x7fe5('0x50')]=function(_0x31404b){try{utils[_0x7fe5('0x1b')](util['format'](_0x7fe5('0x51'),_0x31404b[_0x7fe5('0x5')]),_0x31404b);if(agents[_0x31404b['uniqueid']]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]==='timeout'){if(_0x31404b[_0x7fe5('0x52')]==='21'){agents[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x53');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x53');}utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]]['reason'],agents[_0x31404b[_0x7fe5('0x5')]]['lastevent']));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);var _0x2e3b94=unanswered['indexOf'](_0x31404b[_0x7fe5('0x5')]);if(_0x2e3b94>-0x1){unanswered[_0x7fe5('0x54')](_0x2e3b94,0x1);}}if(transfers[_0x31404b['uniqueid']]){transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt']=utils[_0x7fe5('0x1e')]();transfers[_0x31404b[_0x7fe5('0x5')]]['talktime']=utils[_0x7fe5('0x35')](transfers[_0x31404b[_0x7fe5('0x5')]]['agentcompleteAt'],transfers[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);transfers[_0x31404b['uniqueid']][_0x7fe5('0x20')]=_0x7fe5('0x55');transfers[_0x31404b['uniqueid']]['lastevent']=_0x7fe5('0x37');utils['info'](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],transfers[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],transfers[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(transfers[_0x31404b[_0x7fe5('0x5')]],!![]);}if(agents[_0x31404b[_0x7fe5('0x5')]]&&agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x36')]){agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xe')]=!![];agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')]=utils[_0x7fe5('0x1e')]();agents[_0x31404b['uniqueid']][_0x7fe5('0x22')]=utils[_0x7fe5('0x35')](agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x34')],agents[_0x31404b[_0x7fe5('0x5')]]['agentconnectAt']);agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')]=agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x3b')]?_0x7fe5('0x3b'):_0x7fe5('0x55');agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0xc')]=_0x7fe5('0x37');utils[_0x7fe5('0x2')](util[_0x7fe5('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31404b[_0x7fe5('0x5')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x8')],agents[_0x31404b[_0x7fe5('0x5')]][_0x7fe5('0x20')],agents[_0x31404b['uniqueid']][_0x7fe5('0xc')]));writeDB(agents[_0x31404b[_0x7fe5('0x5')]]);}}catch(_0x226ada){utils['error'](util['format']('[%s][agents][hangup]',_0x31404b[_0x7fe5('0x5')]),_0x226ada);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b69c4ca..35faf15 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 _0xc677=['destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','execif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','now','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','cause-txt','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s'];(function(_0x51bf13,_0x68715a){var _0x4f8dc5=function(_0x34eec7){while(--_0x34eec7){_0x51bf13['push'](_0x51bf13['shift']());}};_0x4f8dc5(++_0x68715a);}(_0xc677,0x16c));var _0x7c67=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc677[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x7c67('0x0'));var utils=require(_0x7c67('0x1'));var transfers=require(_0x7c67('0x2'));var dispositions=[_0x7c67('0x3'),_0x7c67('0x4'),_0x7c67('0x4'),_0x7c67('0x3'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED','BUSY',_0x7c67('0x4'),_0x7c67('0x4'),'FAILED'];var channels={};function writeDB(_0x1e916c){var _0x5475af;if(transfers[_0x7c67('0x5')][_0x1e916c['uniqueid']]){_0x5475af=_0x1e916c[_0x7c67('0x6')];_0x1e916c[_0x7c67('0x6')]=transfers[_0x7c67('0x5')][_0x1e916c[_0x7c67('0x6')]][_0x7c67('0x7')];}utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0xa'),_0x1e916c[_0x7c67('0x6')],_0x1e916c[_0x7c67('0xb')],_0x1e916c[_0x7c67('0xc')],_0x1e916c[_0x7c67('0xd')],_0x1e916c['interface'],_0x1e916c[_0x7c67('0xe')],_0x1e916c[_0x7c67('0xf')],_0x1e916c[_0x7c67('0x10')]));if(_0x1e916c['accountcode']){utils[_0x7c67('0x11')](_0x1e916c['accountcode'])['then'](function(_0x31355e){if(_0x31355e){_0x1e916c[_0x7c67('0x12')]=_0x31355e['id'];}utils[_0x7c67('0x13')](_0x7c67('0x14'),_0x1e916c);});}else{utils[_0x7c67('0x13')](_0x7c67('0x14'),_0x1e916c);}if(channels[_0x1e916c[_0x7c67('0x6')]]){delete channels[_0x1e916c[_0x7c67('0x6')]];}else if(_0x5475af&&channels[_0x5475af]){if(!transfers[_0x7c67('0x5')][_0x5475af][_0x7c67('0x15')])delete transfers['blinds'][_0x5475af];delete channels[_0x5475af];}}exports[_0x7c67('0x16')]=function(_0x3a9bb6){try{utils[_0x7c67('0x17')](util[_0x7c67('0x9')](_0x7c67('0x18'),_0x3a9bb6[_0x7c67('0x6')]),_0x3a9bb6);if(_0x3a9bb6[_0x7c67('0x6')]==_0x3a9bb6[_0x7c67('0x19')]&&_0x3a9bb6[_0x7c67('0xb')]!=_0x7c67('0x1a')){utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x1b'),_0x3a9bb6[_0x7c67('0x6')],_0x3a9bb6[_0x7c67('0x1c')],_0x3a9bb6[_0x7c67('0x1d')]));channels[_0x3a9bb6[_0x7c67('0x6')]]={'uniqueid':_0x3a9bb6['uniqueid'],'accountcode':_0x3a9bb6[_0x7c67('0x1e')],'source':_0x3a9bb6['calleridnum'],'destination':_0x3a9bb6[_0x7c67('0x1d')],'destinationcontext':_0x3a9bb6[_0x7c67('0x1c')],'channel':_0x3a9bb6[_0x7c67('0xb')],'starttime':utils[_0x7c67('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x35b9c8){utils[_0x7c67('0x20')](util[_0x7c67('0x9')]('[%s][calls][newchannel]',_0x3a9bb6['uniqueid']),_0x35b9c8);}};exports[_0x7c67('0x21')]=function(_0x32ffb8){try{utils[_0x7c67('0x17')](util[_0x7c67('0x9')](_0x7c67('0x22'),_0x32ffb8[_0x7c67('0x6')]),_0x32ffb8);if(!_['isNil'](channels[_0x32ffb8[_0x7c67('0x6')]])&&_0x32ffb8[_0x7c67('0x23')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x32ffb8['uniqueid'],_0x32ffb8[_0x7c67('0x1c')],_0x32ffb8['channel']));if(_[_0x7c67('0x24')](channels[_0x32ffb8[_0x7c67('0x6')]][_0x7c67('0x25')])){channels[_0x32ffb8[_0x7c67('0x6')]][_0x7c67('0x25')]=utils['now']();}}else if(!_[_0x7c67('0x24')](channels[_0x32ffb8[_0x7c67('0x19')]])&&_0x32ffb8[_0x7c67('0x23')]==0x6&&_0x32ffb8['context']!=_0x7c67('0x26')){utils[_0x7c67('0x8')](util['format'](_0x7c67('0x27'),_0x32ffb8[_0x7c67('0x6')],_0x32ffb8['linkedid'],_0x32ffb8['context'],_0x32ffb8[_0x7c67('0xb')]));channels[_0x32ffb8[_0x7c67('0x19')]][_0x7c67('0x1e')]=_0x32ffb8[_0x7c67('0x1e')];channels[_0x32ffb8['linkedid']]['destinationchannel']=_0x32ffb8[_0x7c67('0xb')];if(_[_0x7c67('0x24')](channels[_0x32ffb8[_0x7c67('0x19')]]['answertime'])){channels[_0x32ffb8[_0x7c67('0x19')]][_0x7c67('0x28')]=utils['now']();}channels[_0x32ffb8[_0x7c67('0x19')]][_0x7c67('0x29')]=dispositions[_[_0x7c67('0x2a')](_0x32ffb8['channelstate'])]||_0x7c67('0x2b');}}catch(_0x3ff41e){utils[_0x7c67('0x20')](util[_0x7c67('0x9')](_0x7c67('0x22'),_0x32ffb8[_0x7c67('0x6')]),_0x3ff41e);}};exports[_0x7c67('0x2c')]=function(_0x1c2d7e){try{if(!_[_0x7c67('0x24')](channels[_0x1c2d7e['uniqueid']])){utils[_0x7c67('0x17')](util['format'](_0x7c67('0x2d'),_0x1c2d7e[_0x7c67('0x6')]),_0x1c2d7e);if(_['isNil'](channels[_0x1c2d7e[_0x7c67('0x6')]][_0x7c67('0x2e')])){channels[_0x1c2d7e[_0x7c67('0x6')]]['callerid']=_0x1c2d7e['calleridname']+'\x20<'+_0x1c2d7e[_0x7c67('0xe')]+'>';}utils['info'](util[_0x7c67('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1c2d7e[_0x7c67('0x6')],channels[_0x1c2d7e['uniqueid']][_0x7c67('0x2e')],_0x1c2d7e[_0x7c67('0x2f')]));channels[_0x1c2d7e[_0x7c67('0x6')]]['endtime']=utils[_0x7c67('0x1f')]();channels[_0x1c2d7e[_0x7c67('0x6')]]['duration']=utils[_0x7c67('0x30')](channels[_0x1c2d7e['uniqueid']][_0x7c67('0x31')],channels[_0x1c2d7e[_0x7c67('0x6')]][_0x7c67('0x32')]);channels[_0x1c2d7e['uniqueid']][_0x7c67('0x33')]=channels[_0x1c2d7e[_0x7c67('0x6')]]['answertime']?utils[_0x7c67('0x30')](channels[_0x1c2d7e['uniqueid']][_0x7c67('0x31')],channels[_0x1c2d7e[_0x7c67('0x6')]][_0x7c67('0x28')]):0x0;writeDB(channels[_0x1c2d7e[_0x7c67('0x6')]]);}}catch(_0x505a21){utils[_0x7c67('0x20')](util[_0x7c67('0x9')]('[%s][calls][hangup]',_0x1c2d7e[_0x7c67('0x6')]),_0x505a21);}};exports[_0x7c67('0x34')]=function(_0x1530be){try{if(!_[_0x7c67('0x24')](channels[_0x1530be[_0x7c67('0x35')]])){utils[_0x7c67('0x17')](util[_0x7c67('0x9')](_0x7c67('0x36'),_0x1530be[_0x7c67('0x37')]),_0x1530be);if(channels[_0x1530be[_0x7c67('0x35')]][_0x7c67('0xb')]==_0x1530be[_0x7c67('0x38')]){utils[_0x7c67('0x8')](util['format'](_0x7c67('0x39'),_0x1530be[_0x7c67('0x37')],_0x1530be[_0x7c67('0x35')],_0x1530be[_0x7c67('0x3a')]));channels[_0x1530be['localtwolinkedid']][_0x7c67('0x3b')]=_0x1530be[_0x7c67('0x3a')];channels[_0x1530be['localtwolinkedid']][_0x7c67('0x3c')]=_0x7c67('0x3d');}else if(channels[_0x1530be[_0x7c67('0x35')]][_0x7c67('0xb')]=_0x1530be[_0x7c67('0x3e')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1530be[_0x7c67('0x37')],_0x1530be[_0x7c67('0x35')],_0x1530be[_0x7c67('0x3f')]));channels[_0x1530be[_0x7c67('0x35')]]['destinationchannel']=_0x1530be[_0x7c67('0x3f')];channels[_0x1530be[_0x7c67('0x35')]][_0x7c67('0x3c')]=_0x7c67('0x3d');}}}catch(_0x5f50d3){utils[_0x7c67('0x20')](util[_0x7c67('0x9')](_0x7c67('0x36'),_0x1530be[_0x7c67('0x37')]),_0x5f50d3);}};exports[_0x7c67('0x40')]=function(_0x5a08ec){try{if(!_[_0x7c67('0x24')](channels[_0x5a08ec[_0x7c67('0x6')]])){utils[_0x7c67('0x17')](util[_0x7c67('0x9')](_0x7c67('0x41'),_0x5a08ec[_0x7c67('0x6')]),_0x5a08ec);channels[_0x5a08ec[_0x7c67('0x6')]][_0x7c67('0x42')]=utils['now']();utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x43'),_0x5a08ec['uniqueid'],channels[_0x5a08ec[_0x7c67('0x6')]][_0x7c67('0x42')]));}}catch(_0x1b885a){utils[_0x7c67('0x20')](util[_0x7c67('0x9')](_0x7c67('0x41'),_0x5a08ec['uniqueid']),_0x1b885a);}};exports['musiconholdstop']=function(_0x1e400f){try{if(!_['isNil'](channels[_0x1e400f[_0x7c67('0x6')]])){utils['debug'](util[_0x7c67('0x9')](_0x7c67('0x44'),_0x1e400f[_0x7c67('0x6')]),_0x1e400f);if(!_[_0x7c67('0x24')](channels[_0x1e400f['uniqueid']]['musiconholdstartAt'])){channels[_0x1e400f[_0x7c67('0x6')]][_0x7c67('0x45')]+=utils['diffTime'](utils[_0x7c67('0x1f')](),channels[_0x1e400f[_0x7c67('0x6')]]['musiconholdstartAt']);utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x46'),_0x1e400f['uniqueid'],channels[_0x1e400f[_0x7c67('0x6')]]['mohtime']));delete channels[_0x1e400f['uniqueid']][_0x7c67('0x42')];}}}catch(_0x5744c5){utils[_0x7c67('0x20')](util[_0x7c67('0x9')](_0x7c67('0x44'),_0x1e400f[_0x7c67('0x6')]),_0x5744c5);}};exports[_0x7c67('0x47')]=function(_0x1f0d0b){try{if(!_[_0x7c67('0x24')](channels[_0x1f0d0b[_0x7c67('0x6')]])){utils['debug'](util[_0x7c67('0x9')](_0x7c67('0x48'),_0x1f0d0b[_0x7c67('0x6')]),_0x1f0d0b);if(!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x4a')])){utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x4b'),_0x1f0d0b[_0x7c67('0x6')],_0x1f0d0b[_0x7c67('0x4c')]));channels[_0x1f0d0b[_0x7c67('0x6')]][_0x7c67('0x4d')]=_0x1f0d0b['value'];}if(!_[_0x7c67('0x24')](_0x1f0d0b['variable'][_0x7c67('0x4e')])){utils['info'](util[_0x7c67('0x9')](_0x7c67('0x4f'),_0x1f0d0b[_0x7c67('0x6')],_0x1f0d0b[_0x7c67('0x4c')]));channels[_0x1f0d0b['uniqueid']][_0x7c67('0x50')]=_0x1f0d0b['value'];channels[_0x1f0d0b[_0x7c67('0x6')]]['callerid']='\x22'+_0x1f0d0b['value']+_0x7c67('0x51')+_0x1f0d0b[_0x7c67('0x4c')]+'>';}if(!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x52')])||!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x53')])){utils[_0x7c67('0x8')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1f0d0b[_0x7c67('0x6')],!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x52')])?_0x7c67('0x52'):_0x7c67('0x53'),_0x1f0d0b['value']));channels[_0x1f0d0b[_0x7c67('0x6')]][_0x7c67('0x2e')]=_0x1f0d0b[_0x7c67('0x4c')];}if(!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x54')])||!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x55')])){utils['info'](util[_0x7c67('0x9')](_0x7c67('0x56'),_0x1f0d0b[_0x7c67('0x6')],!_[_0x7c67('0x24')](_0x1f0d0b['variable']['xmd-queue'])?'xmd-queue':'xmcs-queue',_0x1f0d0b[_0x7c67('0x4c')]));channels[_0x1f0d0b[_0x7c67('0x6')]][_0x7c67('0x57')]=_0x7c67('0x58');channels[_0x1f0d0b['uniqueid']][_0x7c67('0x59')]=_0x1f0d0b[_0x7c67('0x4c')];channels[_0x1f0d0b['uniqueid']]['queue']=!![];}if(!_[_0x7c67('0x24')](_0x1f0d0b['variable']['xmd-contactid'])){utils['info'](util[_0x7c67('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1f0d0b[_0x7c67('0x6')],_0x1f0d0b['value']));channels[_0x1f0d0b[_0x7c67('0x6')]][_0x7c67('0x5a')]=_0x1f0d0b['value'];}if(!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')][_0x7c67('0x5b')])){utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x5c'),_0x1f0d0b[_0x7c67('0x6')],_0x1f0d0b['value']));channels[_0x1f0d0b[_0x7c67('0x6')]][_0x7c67('0x5d')]=_0x1f0d0b[_0x7c67('0x4c')];}if(!_[_0x7c67('0x24')](_0x1f0d0b[_0x7c67('0x49')]['outboundrouteid'])){utils[_0x7c67('0x8')](util['format'](_0x7c67('0x5e'),_0x1f0d0b[_0x7c67('0x6')],_0x1f0d0b[_0x7c67('0x4c')]));channels[_0x1f0d0b[_0x7c67('0x6')]]['routeid']=_0x1f0d0b[_0x7c67('0x4c')];}if(!_[_0x7c67('0x24')](_0x1f0d0b['variable']['sipcallid'])){utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x5f'),_0x1f0d0b['uniqueid'],_0x1f0d0b[_0x7c67('0x4c')]));channels[_0x1f0d0b['uniqueid']][_0x7c67('0x60')]=_0x1f0d0b[_0x7c67('0x4c')];}}}catch(_0x3184be){utils[_0x7c67('0x20')](util[_0x7c67('0x9')](_0x7c67('0x48'),_0x1f0d0b[_0x7c67('0x6')]),_0x3184be);}};exports[_0x7c67('0x61')]=function(_0xfb797b){try{if(!_[_0x7c67('0x24')](channels[_0xfb797b[_0x7c67('0x6')]])){utils['debug'](util[_0x7c67('0x9')](_0x7c67('0x62'),_0xfb797b[_0x7c67('0x6')]),_0xfb797b);utils[_0x7c67('0x8')](util[_0x7c67('0x9')](_0x7c67('0x63'),_0xfb797b[_0x7c67('0x6')],_0xfb797b[_0x7c67('0x64')],_0xfb797b[_0x7c67('0x65')]));if(_0xfb797b[_0x7c67('0x64')][_0x7c67('0x66')]()==_0x7c67('0x67')&&_[_0x7c67('0x68')](_0xfb797b[_0x7c67('0x65')][_0x7c67('0x66')](),_0x7c67('0x69'))){var _0x59e1af=_0xfb797b[_0x7c67('0x65')][_0x7c67('0x6a')]('=');var _0x11ff28=_0x59e1af[0x0][_0x7c67('0x6b')](_0x59e1af[0x0][_0x7c67('0x6c')]('(')+0x1,_0x59e1af[0x0][_0x7c67('0x6c')](')'));var _0x3d7a61=_0x59e1af[0x1];channels[_0xfb797b[_0x7c67('0x6')]][_0x11ff28]=_0x3d7a61;}if(!_['includes']([_0x7c67('0x2c'),_0x7c67('0x6d'),_0x7c67('0x6e'),_0x7c67('0x67'),'gotoif'],_0xfb797b[_0x7c67('0x64')]['toLowerCase']())){channels[_0xfb797b[_0x7c67('0x6')]][_0x7c67('0x57')]=_0xfb797b[_0x7c67('0x64')];channels[_0xfb797b[_0x7c67('0x6')]][_0x7c67('0x59')]=_0xfb797b[_0x7c67('0x65')];}}}catch(_0x22d22c){utils[_0x7c67('0x20')](util[_0x7c67('0x9')](_0x7c67('0x62'),_0xfb797b[_0x7c67('0x6')]),_0x22d22c);}}; \ No newline at end of file +var _0xcddb=['source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x3585f6,_0x26b184){var _0x49c864=function(_0xe615a6){while(--_0xe615a6){_0x3585f6['push'](_0x3585f6['shift']());}};_0x49c864(++_0x26b184);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x1cfbce,_0x44ee54){_0x1cfbce=_0x1cfbce-0x0;var _0x28dcf6=_0xcddb[_0x1cfbce];return _0x28dcf6;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var utils=require(_0xbcdd('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xbcdd('0x3'),'FAILED',_0xbcdd('0x4'),_0xbcdd('0x4'),_0xbcdd('0x4'),_0xbcdd('0x5'),'BUSY',_0xbcdd('0x3'),'FAILED',_0xbcdd('0x3')];var channels={};function writeDB(_0x25675b){var _0x586e64;if(transfers[_0xbcdd('0x6')][_0x25675b[_0xbcdd('0x7')]]){_0x586e64=_0x25675b['uniqueid'];_0x25675b['uniqueid']=transfers[_0xbcdd('0x6')][_0x25675b[_0xbcdd('0x7')]][_0xbcdd('0x8')];}utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0xa'),_0x25675b[_0xbcdd('0x7')],_0x25675b[_0xbcdd('0xb')],_0x25675b['queue'],_0x25675b[_0xbcdd('0xc')],_0x25675b[_0xbcdd('0xd')],_0x25675b['calleridnum'],_0x25675b[_0xbcdd('0xe')],_0x25675b[_0xbcdd('0xf')]));if(_0x25675b['accountcode']){utils[_0xbcdd('0x10')](_0x25675b[_0xbcdd('0x11')])['then'](function(_0x59da7a){if(_0x59da7a){_0x25675b[_0xbcdd('0x12')]=_0x59da7a['id'];}utils[_0xbcdd('0x13')](_0xbcdd('0x14'),_0x25675b);});}else{utils[_0xbcdd('0x13')](_0xbcdd('0x14'),_0x25675b);}if(channels[_0x25675b['uniqueid']]){delete channels[_0x25675b[_0xbcdd('0x7')]];}else if(_0x586e64&&channels[_0x586e64]){if(!transfers[_0xbcdd('0x6')][_0x586e64]['recording'])delete transfers[_0xbcdd('0x6')][_0x586e64];delete channels[_0x586e64];}}exports['newchannel']=function(_0x13460b){try{utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')](_0xbcdd('0x16'),_0x13460b[_0xbcdd('0x7')]),_0x13460b);if(_0x13460b[_0xbcdd('0x7')]==_0x13460b[_0xbcdd('0x17')]&&_0x13460b[_0xbcdd('0xb')]!=_0xbcdd('0x18')){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x19'),_0x13460b[_0xbcdd('0x7')],_0x13460b[_0xbcdd('0x1a')],_0x13460b[_0xbcdd('0x1b')]));channels[_0x13460b[_0xbcdd('0x7')]]={'uniqueid':_0x13460b['uniqueid'],'accountcode':_0x13460b[_0xbcdd('0x11')],'source':_0x13460b['calleridnum'],'destination':_0x13460b[_0xbcdd('0x1b')],'destinationcontext':_0x13460b[_0xbcdd('0x1a')],'channel':_0x13460b[_0xbcdd('0xb')],'starttime':utils[_0xbcdd('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xbcdd('0x1d')};}}catch(_0x2cd0dd){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')]('[%s][calls][newchannel]',_0x13460b[_0xbcdd('0x7')]),_0x2cd0dd);}};exports[_0xbcdd('0x1f')]=function(_0x26fd3c){try{utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')]('[%s][calls][newstate]',_0x26fd3c[_0xbcdd('0x7')]),_0x26fd3c);if(!_[_0xbcdd('0x20')](channels[_0x26fd3c[_0xbcdd('0x7')]])&&_0x26fd3c[_0xbcdd('0x21')]==0x6){utils[_0xbcdd('0x22')](util['format'](_0xbcdd('0x23'),_0x26fd3c[_0xbcdd('0x7')],_0x26fd3c['context'],_0x26fd3c[_0xbcdd('0xb')]));if(_[_0xbcdd('0x20')](channels[_0x26fd3c[_0xbcdd('0x7')]][_0xbcdd('0x24')])){channels[_0x26fd3c[_0xbcdd('0x7')]]['systemanswertime']=utils[_0xbcdd('0x1c')]();}}else if(!_['isNil'](channels[_0x26fd3c['linkedid']])&&_0x26fd3c[_0xbcdd('0x21')]==0x6&&_0x26fd3c[_0xbcdd('0x1a')]!='transfer'){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x25'),_0x26fd3c[_0xbcdd('0x7')],_0x26fd3c[_0xbcdd('0x17')],_0x26fd3c[_0xbcdd('0x1a')],_0x26fd3c[_0xbcdd('0xb')]));channels[_0x26fd3c[_0xbcdd('0x17')]][_0xbcdd('0x11')]=_0x26fd3c['accountcode'];channels[_0x26fd3c[_0xbcdd('0x17')]][_0xbcdd('0x26')]=_0x26fd3c['channel'];if(_['isNil'](channels[_0x26fd3c[_0xbcdd('0x17')]][_0xbcdd('0x27')])){channels[_0x26fd3c['linkedid']][_0xbcdd('0x27')]=utils['now']();}channels[_0x26fd3c[_0xbcdd('0x17')]]['disposition']=dispositions[_[_0xbcdd('0x28')](_0x26fd3c['channelstate'])]||_0xbcdd('0x5');}}catch(_0x95ed44){utils['error'](util[_0xbcdd('0x9')](_0xbcdd('0x29'),_0x26fd3c[_0xbcdd('0x7')]),_0x95ed44);}};exports[_0xbcdd('0x2a')]=function(_0x406ee4){try{if(!_['isNil'](channels[_0x406ee4[_0xbcdd('0x7')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x2b'),_0x406ee4['uniqueid']),_0x406ee4);if(_['isNil'](channels[_0x406ee4[_0xbcdd('0x7')]]['callerid'])){channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x2c')]=_0x406ee4[_0xbcdd('0x2d')]+'\x20<'+_0x406ee4['calleridnum']+'>';}utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x2e'),_0x406ee4[_0xbcdd('0x7')],channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x2c')],_0x406ee4[_0xbcdd('0x2f')]));channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x30')]=utils[_0xbcdd('0x1c')]();channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x31')]=utils['diffTime'](channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x30')],channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x32')]);channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x33')]=channels[_0x406ee4['uniqueid']][_0xbcdd('0x27')]?utils['diffTime'](channels[_0x406ee4[_0xbcdd('0x7')]]['endtime'],channels[_0x406ee4[_0xbcdd('0x7')]][_0xbcdd('0x27')]):0x0;writeDB(channels[_0x406ee4['uniqueid']]);}}catch(_0x1a71a7){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x2b'),_0x406ee4['uniqueid']),_0x1a71a7);}};exports['attendedtransfer']=function(_0xe632dc){try{if(!_[_0xbcdd('0x20')](channels[_0xe632dc[_0xbcdd('0x34')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x35'),_0xe632dc['origtransfereruniqueid']),_0xe632dc);if(channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0xb')]==_0xe632dc[_0xbcdd('0x36')]){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x37'),_0xe632dc[_0xbcdd('0x38')],_0xe632dc['localtwolinkedid'],_0xe632dc[_0xbcdd('0x39')]));channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0x26')]=_0xe632dc[_0xbcdd('0x39')];channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0x3a')]=_0xbcdd('0x3b');}else if(channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0xb')]=_0xe632dc[_0xbcdd('0x3c')]){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xe632dc[_0xbcdd('0x38')],_0xe632dc['localtwolinkedid'],_0xe632dc[_0xbcdd('0x3d')]));channels[_0xe632dc[_0xbcdd('0x34')]]['destinationchannel']=_0xe632dc[_0xbcdd('0x3d')];channels[_0xe632dc[_0xbcdd('0x34')]][_0xbcdd('0x3a')]=_0xbcdd('0x3b');}}}catch(_0x35c7c1){utils['error'](util[_0xbcdd('0x9')](_0xbcdd('0x35'),_0xe632dc['origtransfereruniqueid']),_0x35c7c1);}};exports['musiconholdstart']=function(_0xed8e01){try{if(!_[_0xbcdd('0x20')](channels[_0xed8e01[_0xbcdd('0x7')]])){utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')](_0xbcdd('0x3e'),_0xed8e01[_0xbcdd('0x7')]),_0xed8e01);channels[_0xed8e01['uniqueid']][_0xbcdd('0x3f')]=utils[_0xbcdd('0x1c')]();utils['info'](util[_0xbcdd('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0xed8e01[_0xbcdd('0x7')],channels[_0xed8e01[_0xbcdd('0x7')]][_0xbcdd('0x3f')]));}}catch(_0x1519d3){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x3e'),_0xed8e01[_0xbcdd('0x7')]),_0x1519d3);}};exports['musiconholdstop']=function(_0x5f4adc){try{if(!_[_0xbcdd('0x20')](channels[_0x5f4adc[_0xbcdd('0x7')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x40'),_0x5f4adc[_0xbcdd('0x7')]),_0x5f4adc);if(!_[_0xbcdd('0x20')](channels[_0x5f4adc[_0xbcdd('0x7')]]['musiconholdstartAt'])){channels[_0x5f4adc[_0xbcdd('0x7')]][_0xbcdd('0x41')]+=utils[_0xbcdd('0x42')](utils[_0xbcdd('0x1c')](),channels[_0x5f4adc['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x43'),_0x5f4adc[_0xbcdd('0x7')],channels[_0x5f4adc['uniqueid']][_0xbcdd('0x41')]));delete channels[_0x5f4adc[_0xbcdd('0x7')]][_0xbcdd('0x3f')];}}}catch(_0x8df2d0){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x40'),_0x5f4adc[_0xbcdd('0x7')]),_0x8df2d0);}};exports[_0xbcdd('0x44')]=function(_0x58fd16){try{if(!_[_0xbcdd('0x20')](channels[_0x58fd16[_0xbcdd('0x7')]])){utils[_0xbcdd('0x15')](util[_0xbcdd('0x9')](_0xbcdd('0x45'),_0x58fd16[_0xbcdd('0x7')]),_0x58fd16);if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmd-originatecalleridnum'])){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x47'),_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16['uniqueid']][_0xbcdd('0x49')]=_0x58fd16['value'];}if(!_['isNil'](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x4a')])){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x4b'),_0x58fd16[_0xbcdd('0x7')],_0x58fd16['value']));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x4c')]=_0x58fd16['value'];channels[_0x58fd16[_0xbcdd('0x7')]]['callerid']='\x22'+_0x58fd16[_0xbcdd('0x48')]+_0xbcdd('0x4d')+_0x58fd16[_0xbcdd('0x48')]+'>';}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmd-callerid-preview'])||!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x4e')])){utils[_0xbcdd('0x22')](util['format'](_0xbcdd('0x4f'),_0x58fd16[_0xbcdd('0x7')],!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x50')])?_0xbcdd('0x50'):'xmd-callerid',_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x2c')]=_0x58fd16[_0xbcdd('0x48')];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x51')])||!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmcs-queue'])){utils['info'](util[_0xbcdd('0x9')](_0xbcdd('0x4f'),_0x58fd16['uniqueid'],!_['isNil'](_0x58fd16[_0xbcdd('0x46')]['xmd-queue'])?_0xbcdd('0x51'):_0xbcdd('0x52'),_0x58fd16['value']));channels[_0x58fd16[_0xbcdd('0x7')]]['lastapplication']=_0xbcdd('0x53');channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x54')]=_0x58fd16[_0xbcdd('0x48')];channels[_0x58fd16[_0xbcdd('0x7')]]['queue']=!![];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')]['xmd-contactid'])){utils['info'](util[_0xbcdd('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x55')]=_0x58fd16[_0xbcdd('0x48')];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x56')])){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x57'),_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]]['type']=_0x58fd16['value'];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x58')])){utils['info'](util[_0xbcdd('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x58fd16[_0xbcdd('0x7')],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]][_0xbcdd('0x59')]=_0x58fd16['value'];}if(!_[_0xbcdd('0x20')](_0x58fd16[_0xbcdd('0x46')][_0xbcdd('0x5a')])){utils[_0xbcdd('0x22')](util[_0xbcdd('0x9')](_0xbcdd('0x5b'),_0x58fd16['uniqueid'],_0x58fd16[_0xbcdd('0x48')]));channels[_0x58fd16[_0xbcdd('0x7')]]['sipcallid']=_0x58fd16[_0xbcdd('0x48')];}}}catch(_0x4fa7be){utils[_0xbcdd('0x1e')](util['format'](_0xbcdd('0x45'),_0x58fd16['uniqueid']),_0x4fa7be);}};exports['newexten']=function(_0x4d8748){try{if(!_['isNil'](channels[_0x4d8748[_0xbcdd('0x7')]])){utils['debug'](util[_0xbcdd('0x9')](_0xbcdd('0x5c'),_0x4d8748[_0xbcdd('0x7')]),_0x4d8748);utils['info'](util[_0xbcdd('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x4d8748[_0xbcdd('0x7')],_0x4d8748[_0xbcdd('0x5d')],_0x4d8748[_0xbcdd('0x5e')]));if(_0x4d8748['application'][_0xbcdd('0x5f')]()=='set'&&_[_0xbcdd('0x60')](_0x4d8748[_0xbcdd('0x5e')]['toLowerCase'](),_0xbcdd('0x61'))){var _0x2af157=_0x4d8748[_0xbcdd('0x5e')][_0xbcdd('0x62')]('=');var _0x5c1a20=_0x2af157[0x0][_0xbcdd('0x63')](_0x2af157[0x0][_0xbcdd('0x64')]('(')+0x1,_0x2af157[0x0][_0xbcdd('0x64')](')'));var _0x50a2de=_0x2af157[0x1];channels[_0x4d8748[_0xbcdd('0x7')]][_0x5c1a20]=_0x50a2de;}if(!_[_0xbcdd('0x65')](['hangup','noop',_0xbcdd('0x66'),'set',_0xbcdd('0x67')],_0x4d8748['application'][_0xbcdd('0x5f')]())){channels[_0x4d8748[_0xbcdd('0x7')]][_0xbcdd('0x68')]=_0x4d8748['application'];channels[_0x4d8748['uniqueid']]['lastdata']=_0x4d8748['appdata'];}}}catch(_0x1db750){utils[_0xbcdd('0x1e')](util[_0xbcdd('0x9')](_0xbcdd('0x5c'),_0x4d8748[_0xbcdd('0x7')]),_0x1db750);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b707da3..8009dc7 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 _0x0bd8=['error','[core]\x20error','[core]\x20close','managerevent','./utils','[core]\x20connected','shutdown','info','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x2cd0d2,_0x4b6d17){var _0x4b15f8=function(_0x530340){while(--_0x530340){_0x2cd0d2['push'](_0x2cd0d2['shift']());}};_0x4b15f8(++_0x4b6d17);}(_0x0bd8,0xe0));var _0x80bd=function(_0x40b66c,_0x578758){_0x40b66c=_0x40b66c-0x0;var _0x2fd22b=_0x0bd8[_0x40b66c];return _0x2fd22b;};'use strict';var utils=require(_0x80bd('0x0'));exports['connect']=function(){utils['info'](_0x80bd('0x1'));};exports[_0x80bd('0x2')]=function(){utils[_0x80bd('0x3')](_0x80bd('0x4'));};exports['fullybooted']=function(){utils[_0x80bd('0x3')](_0x80bd('0x5'));};exports['error']=function(_0x1aa586){utils[_0x80bd('0x6')](_0x80bd('0x7'),_0x1aa586);};exports['close']=function(){utils['info'](_0x80bd('0x8'));};exports[_0x80bd('0x9')]=function(_0x339171){}; \ No newline at end of file +var _0xcd05=['error','[core]\x20error','close','managerevent','info','[core]\x20shutdown'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xcd05,0x64));var _0x5cd0=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xcd05[_0x28578d];return _0x524826;};'use strict';var utils=require('./utils');exports['connect']=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils[_0x5cd0('0x0')](_0x5cd0('0x1'));};exports['fullybooted']=function(){utils[_0x5cd0('0x0')]('[core]\x20fullybooted');};exports[_0x5cd0('0x2')]=function(_0x50e5cc){utils[_0x5cd0('0x2')](_0x5cd0('0x3'),_0x50e5cc);};exports[_0x5cd0('0x4')]=function(){utils[_0x5cd0('0x0')]('[core]\x20close');};exports[_0x5cd0('0x5')]=function(_0x839964){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9f5953b..a4396df 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 _0xd2f7=['application','appdata','toLowerCase','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','assign','now','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','complete','duration','diffTime','endtime','answertime','billableseconds','lodash','./utils','info','format','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x131685,_0x2be83a){var _0x237f0d=function(_0x142a4f){while(--_0x142a4f){_0x131685['push'](_0x131685['shift']());}};_0x237f0d(++_0x2be83a);}(_0xd2f7,0x134));var _0x7d2f=function(_0x2c7780,_0x100f4a){_0x2c7780=_0x2c7780-0x0;var _0x580bc8=_0xd2f7[_0x2c7780];return _0x580bc8;};'use strict';var _=require(_0x7d2f('0x0'));var util=require('util');var utils=require(_0x7d2f('0x1'));var dials={};function writeDB(_0x52e51e){utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x52e51e['uniqueid'],_0x52e51e[_0x7d2f('0x4')],_0x52e51e[_0x7d2f('0x5')],_0x52e51e[_0x7d2f('0x6')],_0x52e51e[_0x7d2f('0x7')],_0x52e51e[_0x7d2f('0x8')]));utils[_0x7d2f('0x9')]('CreateVoiceDialReport',_0x52e51e);delete dials[_0x52e51e['uniqueid']];}exports[_0x7d2f('0xa')]=function(_0x426477){try{utils[_0x7d2f('0xb')](util[_0x7d2f('0x3')]('[%s][dials][newexten]',_0x426477[_0x7d2f('0xc')]),_0x426477);utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')](_0x7d2f('0xd'),_0x426477['uniqueid'],_0x426477[_0x7d2f('0xe')],_0x426477[_0x7d2f('0xf')]));if(_0x426477[_0x7d2f('0xe')]['toLowerCase']()=='set'&&_['startsWith'](_0x426477[_0x7d2f('0xf')][_0x7d2f('0x10')](),'cdr(routeid)')){var _0x14889a=_0x426477[_0x7d2f('0xf')][_0x7d2f('0x11')]('=');dials[_0x426477[_0x7d2f('0xc')]]={'routeId':_0x14889a[0x1]};}}catch(_0x276b8e){utils[_0x7d2f('0x12')](util[_0x7d2f('0x3')](_0x7d2f('0x13'),_0x426477[_0x7d2f('0xc')]),_0x276b8e);}};exports[_0x7d2f('0x14')]=function(_0x32e732){try{utils[_0x7d2f('0xb')](util[_0x7d2f('0x3')](_0x7d2f('0x15'),_0x32e732[_0x7d2f('0xc')]),_0x32e732);if(!_['isNil'](_0x32e732[_0x7d2f('0x16')]['outboundrouteid'])){utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')](_0x7d2f('0x17'),_0x32e732[_0x7d2f('0xc')],_0x32e732[_0x7d2f('0x18')]));dials[_0x32e732[_0x7d2f('0xc')]]={'routeId':_0x32e732['value']};}}catch(_0x2516b3){utils[_0x7d2f('0x12')](util[_0x7d2f('0x3')]('[%s][dials][varset]',_0x32e732[_0x7d2f('0xc')]),_0x2516b3);}};exports[_0x7d2f('0x19')]=function(_0x5870e4){try{if(!_[_0x7d2f('0x1a')](dials[_0x5870e4[_0x7d2f('0xc')]])){utils[_0x7d2f('0xb')](util['format'](_0x7d2f('0x1b'),_0x5870e4[_0x7d2f('0xc')]),_0x5870e4);dials[_0x5870e4[_0x7d2f('0xc')]]=_['assign'](dials[_0x5870e4[_0x7d2f('0xc')]],_0x5870e4);dials[_0x5870e4[_0x7d2f('0xc')]][_0x7d2f('0x1c')]=utils['now']();dials[_0x5870e4[_0x7d2f('0xc')]][_0x7d2f('0x1d')]=_0x7d2f('0x1e');utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')](_0x7d2f('0x1f'),_0x5870e4[_0x7d2f('0xc')],dials[_0x5870e4['uniqueid']][_0x7d2f('0x1c')]));}}catch(_0x57aa5d){utils['error'](util[_0x7d2f('0x3')](_0x7d2f('0x1b'),_0x5870e4[_0x7d2f('0xc')]),_0x57aa5d);}};exports['dialend']=function(_0x3239f7){try{if(!_[_0x7d2f('0x1a')](dials[_0x3239f7['uniqueid']])){utils[_0x7d2f('0xb')](util[_0x7d2f('0x3')](_0x7d2f('0x20'),_0x3239f7[_0x7d2f('0xc')]),_0x3239f7);dials[_0x3239f7['uniqueid']][_0x7d2f('0x8')]=_0x3239f7['dialstatus'];if(_0x3239f7[_0x7d2f('0x8')]==_0x7d2f('0x21')){dials[_0x3239f7[_0x7d2f('0xc')]]=_[_0x7d2f('0x22')](dials[_0x3239f7[_0x7d2f('0xc')]],_0x3239f7);dials[_0x3239f7[_0x7d2f('0xc')]]['answertime']=utils[_0x7d2f('0x23')]();dials[_0x3239f7[_0x7d2f('0xc')]][_0x7d2f('0x1d')]=_0x7d2f('0x24');utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3239f7[_0x7d2f('0xc')],_0x3239f7[_0x7d2f('0x8')],dials[_0x3239f7[_0x7d2f('0xc')]]['answertime']));}else{utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')](_0x7d2f('0x25'),_0x3239f7['uniqueid'],_0x3239f7[_0x7d2f('0x8')]));}}}catch(_0x1620e9){utils[_0x7d2f('0x12')](util[_0x7d2f('0x3')](_0x7d2f('0x20'),_0x3239f7['uniqueid']),_0x1620e9);}};exports['hangup']=function(_0x1d2b9a){try{if(!_[_0x7d2f('0x1a')](dials[_0x1d2b9a['uniqueid']])){utils['debug'](util[_0x7d2f('0x3')](_0x7d2f('0x26'),_0x1d2b9a[_0x7d2f('0xc')]),_0x1d2b9a);utils[_0x7d2f('0x2')](util[_0x7d2f('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x1d2b9a['uniqueid'],_0x1d2b9a[_0x7d2f('0x6')],_0x1d2b9a[_0x7d2f('0x27')],_0x1d2b9a['cause-txt']));dials[_0x1d2b9a[_0x7d2f('0xc')]]=_[_0x7d2f('0x22')](dials[_0x1d2b9a[_0x7d2f('0xc')]],{'endtime':utils[_0x7d2f('0x23')](),'lastevent':_0x7d2f('0x28')});dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x29')]=utils[_0x7d2f('0x2a')](dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x2b')],dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x1c')]);dials[_0x1d2b9a[_0x7d2f('0xc')]]['holdtime']=utils['diffTime'](dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x2c')]||dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x2b')],dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x1c')]);dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x2d')]=dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x2c')]?utils[_0x7d2f('0x2a')](dials[_0x1d2b9a['uniqueid']][_0x7d2f('0x2b')],dials[_0x1d2b9a[_0x7d2f('0xc')]][_0x7d2f('0x2c')]):0x0;writeDB(dials[_0x1d2b9a[_0x7d2f('0xc')]]);}}catch(_0x216f75){utils[_0x7d2f('0x12')](util[_0x7d2f('0x3')](_0x7d2f('0x26'),_0x1d2b9a[_0x7d2f('0xc')]),_0x216f75);}}; \ No newline at end of file +var _0x9f48=['error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][dialend]','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','endtime','holdtime','diffTime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split'];(function(_0x3c0095,_0x4d6642){var _0x33a6a6=function(_0x198050){while(--_0x198050){_0x3c0095['push'](_0x3c0095['shift']());}};_0x33a6a6(++_0x4d6642);}(_0x9f48,0x1de));var _0x89f4=function(_0x2adb30,_0x32650c){_0x2adb30=_0x2adb30-0x0;var _0x27f506=_0x9f48[_0x2adb30];return _0x27f506;};'use strict';var _=require(_0x89f4('0x0'));var util=require('util');var utils=require(_0x89f4('0x1'));var dials={};function writeDB(_0x5a4b66){utils[_0x89f4('0x2')](util[_0x89f4('0x3')](_0x89f4('0x4'),_0x5a4b66[_0x89f4('0x5')],_0x5a4b66['channel'],_0x5a4b66[_0x89f4('0x6')],_0x5a4b66[_0x89f4('0x7')],_0x5a4b66[_0x89f4('0x8')],_0x5a4b66[_0x89f4('0x9')]));utils[_0x89f4('0xa')]('CreateVoiceDialReport',_0x5a4b66);delete dials[_0x5a4b66[_0x89f4('0x5')]];}exports[_0x89f4('0xb')]=function(_0x24b880){try{utils[_0x89f4('0xc')](util[_0x89f4('0x3')](_0x89f4('0xd'),_0x24b880[_0x89f4('0x5')]),_0x24b880);utils['info'](util[_0x89f4('0x3')](_0x89f4('0xe'),_0x24b880[_0x89f4('0x5')],_0x24b880[_0x89f4('0xf')],_0x24b880[_0x89f4('0x10')]));if(_0x24b880['application'][_0x89f4('0x11')]()==_0x89f4('0x12')&&_[_0x89f4('0x13')](_0x24b880[_0x89f4('0x10')][_0x89f4('0x11')](),_0x89f4('0x14'))){var _0x28baaf=_0x24b880[_0x89f4('0x10')][_0x89f4('0x15')]('=');dials[_0x24b880[_0x89f4('0x5')]]={'routeId':_0x28baaf[0x1]};}}catch(_0x2f40db){utils[_0x89f4('0x16')](util['format']('[%s][dials][newexten]',_0x24b880['uniqueid']),_0x2f40db);}};exports[_0x89f4('0x17')]=function(_0x58321b){try{utils[_0x89f4('0xc')](util[_0x89f4('0x3')](_0x89f4('0x18'),_0x58321b['uniqueid']),_0x58321b);if(!_[_0x89f4('0x19')](_0x58321b[_0x89f4('0x1a')][_0x89f4('0x1b')])){utils[_0x89f4('0x2')](util[_0x89f4('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x58321b[_0x89f4('0x5')],_0x58321b[_0x89f4('0x1c')]));dials[_0x58321b[_0x89f4('0x5')]]={'routeId':_0x58321b[_0x89f4('0x1c')]};}}catch(_0x5eba0e){utils[_0x89f4('0x16')](util['format']('[%s][dials][varset]',_0x58321b[_0x89f4('0x5')]),_0x5eba0e);}};exports[_0x89f4('0x1d')]=function(_0x42f54a){try{if(!_[_0x89f4('0x19')](dials[_0x42f54a[_0x89f4('0x5')]])){utils['debug'](util[_0x89f4('0x3')](_0x89f4('0x1e'),_0x42f54a['uniqueid']),_0x42f54a);dials[_0x42f54a['uniqueid']]=_[_0x89f4('0x1f')](dials[_0x42f54a['uniqueid']],_0x42f54a);dials[_0x42f54a[_0x89f4('0x5')]][_0x89f4('0x20')]=utils[_0x89f4('0x21')]();dials[_0x42f54a['uniqueid']]['lastevent']=_0x89f4('0x22');utils[_0x89f4('0x2')](util[_0x89f4('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x42f54a[_0x89f4('0x5')],dials[_0x42f54a['uniqueid']]['starttime']));}}catch(_0x14cbf0){utils[_0x89f4('0x16')](util[_0x89f4('0x3')](_0x89f4('0x1e'),_0x42f54a['uniqueid']),_0x14cbf0);}};exports['dialend']=function(_0x4f9044){try{if(!_[_0x89f4('0x19')](dials[_0x4f9044[_0x89f4('0x5')]])){utils[_0x89f4('0xc')](util[_0x89f4('0x3')](_0x89f4('0x23'),_0x4f9044[_0x89f4('0x5')]),_0x4f9044);dials[_0x4f9044[_0x89f4('0x5')]]['dialstatus']=_0x4f9044['dialstatus'];if(_0x4f9044[_0x89f4('0x9')]==_0x89f4('0x24')){dials[_0x4f9044[_0x89f4('0x5')]]=_['assign'](dials[_0x4f9044[_0x89f4('0x5')]],_0x4f9044);dials[_0x4f9044[_0x89f4('0x5')]][_0x89f4('0x25')]=utils[_0x89f4('0x21')]();dials[_0x4f9044[_0x89f4('0x5')]][_0x89f4('0x26')]=_0x89f4('0x27');utils[_0x89f4('0x2')](util[_0x89f4('0x3')](_0x89f4('0x28'),_0x4f9044[_0x89f4('0x5')],_0x4f9044[_0x89f4('0x9')],dials[_0x4f9044[_0x89f4('0x5')]][_0x89f4('0x25')]));}else{utils['info'](util[_0x89f4('0x3')](_0x89f4('0x29'),_0x4f9044[_0x89f4('0x5')],_0x4f9044['dialstatus']));}}}catch(_0x2d1000){utils['error'](util[_0x89f4('0x3')](_0x89f4('0x23'),_0x4f9044['uniqueid']),_0x2d1000);}};exports[_0x89f4('0x2a')]=function(_0x4922f9){try{if(!_[_0x89f4('0x19')](dials[_0x4922f9[_0x89f4('0x5')]])){utils['debug'](util[_0x89f4('0x3')](_0x89f4('0x2b'),_0x4922f9['uniqueid']),_0x4922f9);utils['info'](util[_0x89f4('0x3')](_0x89f4('0x2c'),_0x4922f9['uniqueid'],_0x4922f9[_0x89f4('0x7')],_0x4922f9['calleridname'],_0x4922f9[_0x89f4('0x2d')]));dials[_0x4922f9[_0x89f4('0x5')]]=_[_0x89f4('0x1f')](dials[_0x4922f9['uniqueid']],{'endtime':utils[_0x89f4('0x21')](),'lastevent':'complete'});dials[_0x4922f9[_0x89f4('0x5')]]['duration']=utils['diffTime'](dials[_0x4922f9['uniqueid']][_0x89f4('0x2e')],dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x20')]);dials[_0x4922f9['uniqueid']][_0x89f4('0x2f')]=utils[_0x89f4('0x30')](dials[_0x4922f9['uniqueid']]['answertime']||dials[_0x4922f9[_0x89f4('0x5')]]['endtime'],dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x20')]);dials[_0x4922f9['uniqueid']][_0x89f4('0x31')]=dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x25')]?utils[_0x89f4('0x30')](dials[_0x4922f9[_0x89f4('0x5')]][_0x89f4('0x2e')],dials[_0x4922f9['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4922f9[_0x89f4('0x5')]]);}}catch(_0x5aea30){utils[_0x89f4('0x16')](util[_0x89f4('0x3')](_0x89f4('0x2b'),_0x4922f9['uniqueid']),_0x5aea30);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 55cef5b..76a6d39 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 _0x6755=['../../config/environment','./utils','asterisk','username','password','keepConnected','xdr','info','./agents.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager'];(function(_0x41ec6c,_0x34e09f){var _0x492f1b=function(_0xb0053f){while(--_0xb0053f){_0x41ec6c['push'](_0x41ec6c['shift']());}};_0x492f1b(++_0x34e09f);}(_0x6755,0xb9));var _0x5675=function(_0x5cae44,_0x26aa77){_0x5cae44=_0x5cae44-0x0;var _0x171ac7=_0x6755[_0x5cae44];return _0x171ac7;};var AsteriskManager=require(_0x5675('0x0'));var config=require(_0x5675('0x1'));var utils=require(_0x5675('0x2'));var util=require('util');var ami=new AsteriskManager(config[_0x5675('0x3')]['port'],config['asterisk']['ip'],config[_0x5675('0x3')][_0x5675('0x4')],config[_0x5675('0x3')][_0x5675('0x5')],!![]);ami[_0x5675('0x6')]();if(config[_0x5675('0x7')]&&config[_0x5675('0x7')]['disabled']){utils[_0x5675('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x5675('0x9'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x5675('0xa'));var members=require('./members.controller');var dials=require(_0x5675('0xb'));var transfers=require(_0x5675('0xc'));var core=require(_0x5675('0xd'));ami['on'](_0x5675('0xe'),core['connect']);ami['on'](_0x5675('0xf'),core[_0x5675('0xf')]);ami['on']('fullybooted',core[_0x5675('0x10')]);ami['on']('error',core[_0x5675('0x11')]);ami['on'](_0x5675('0x12'),core[_0x5675('0x12')]);ami['on'](_0x5675('0x13'),core['managerevent']);ami['on'](_0x5675('0x14'),function(_0x3a5842){try{utils[_0x5675('0x15')](util[_0x5675('0x16')]('[%s][index][devicestatechange]',_0x3a5842[_0x5675('0x17')]),_0x3a5842);members[_0x5675('0x14')](_0x3a5842);}catch(_0x29d2fb){utils['error'](util['format'](_0x5675('0x18'),_0x3a5842[_0x5675('0x17')]),_0x29d2fb);}});ami['on'](_0x5675('0x19'),function(_0x249a14){try{utils['debug'](util[_0x5675('0x16')](_0x5675('0x1a'),_0x249a14[_0x5675('0x1b')]),_0x249a14);agents['agentcalled'](_0x249a14);}catch(_0xf7d8f){utils[_0x5675('0x11')](util[_0x5675('0x16')](_0x5675('0x1a'),_0x249a14[_0x5675('0x1b')]),_0xf7d8f);}});ami['on']('agentringnoanswer',function(_0x1a4e13){try{utils[_0x5675('0x15')](util[_0x5675('0x16')](_0x5675('0x1c'),_0x1a4e13[_0x5675('0x1b')]),_0x1a4e13);agents[_0x5675('0x1d')](_0x1a4e13);}catch(_0x4dcb66){utils['error'](util[_0x5675('0x16')](_0x5675('0x1c'),_0x1a4e13['uniqueid']),_0x4dcb66);}});ami['on'](_0x5675('0x1e'),function(_0xd6c8d2){try{utils[_0x5675('0x15')](util['format']('[%s][index][agentconnect]',_0xd6c8d2[_0x5675('0x1b')]),_0xd6c8d2);agents['agentconnect'](_0xd6c8d2);queues['agentconnect'](_0xd6c8d2);}catch(_0x22fa4e){utils[_0x5675('0x11')](util[_0x5675('0x16')]('[%s][index][agentconnect]',_0xd6c8d2[_0x5675('0x1b')]),_0x22fa4e);}});ami['on'](_0x5675('0x1f'),function(_0x19ced0){try{utils[_0x5675('0x15')](util[_0x5675('0x16')]('[%s][index][agentcomplete]',_0x19ced0[_0x5675('0x1b')]),_0x19ced0);agents['agentcomplete'](_0x19ced0);queues['agentcomplete'](_0x19ced0);members[_0x5675('0x1f')](_0x19ced0);}catch(_0x48ef98){utils['error'](util[_0x5675('0x16')](_0x5675('0x20'),_0x19ced0[_0x5675('0x1b')]),_0x48ef98);}});ami['on'](_0x5675('0x21'),function(_0x1089f8){try{utils[_0x5675('0x15')](util['format'](_0x5675('0x22'),_0x1089f8[_0x5675('0x1b')]),_0x1089f8);agents[_0x5675('0x21')](_0x1089f8);queues[_0x5675('0x21')](_0x1089f8);}catch(_0x1936b4){utils[_0x5675('0x11')](util[_0x5675('0x16')](_0x5675('0x22'),_0x1089f8[_0x5675('0x1b')]),_0x1936b4);}});ami['on'](_0x5675('0x23'),function(_0x3ed3c5){try{utils['debug'](util[_0x5675('0x16')](_0x5675('0x24'),_0x3ed3c5['uniqueid']),_0x3ed3c5);queues[_0x5675('0x23')](_0x3ed3c5);recordings[_0x5675('0x23')](_0x3ed3c5);}catch(_0x37a70d){utils[_0x5675('0x11')](util[_0x5675('0x16')](_0x5675('0x24'),_0x3ed3c5[_0x5675('0x1b')]),_0x37a70d);}});ami['on'](_0x5675('0x25'),function(_0x183061){try{utils[_0x5675('0x15')](util[_0x5675('0x16')]('[%s][index][queuecallerleave]',_0x183061['uniqueid']),_0x183061);queues[_0x5675('0x25')](_0x183061);}catch(_0x23b10b){utils[_0x5675('0x11')](util[_0x5675('0x16')](_0x5675('0x26'),_0x183061['uniqueid']),_0x23b10b);}});ami['on'](_0x5675('0x27'),function(_0x48501e){try{utils[_0x5675('0x15')](util[_0x5675('0x16')](_0x5675('0x28'),_0x48501e[_0x5675('0x1b')]),_0x48501e);queues['musiconholdstart'](_0x48501e);calls[_0x5675('0x27')](_0x48501e);}catch(_0x864cc3){utils['error'](util[_0x5675('0x16')](_0x5675('0x28'),_0x48501e[_0x5675('0x1b')]),_0x864cc3);}});ami['on'](_0x5675('0x29'),function(_0x1284f1){try{utils[_0x5675('0x15')](util[_0x5675('0x16')](_0x5675('0x2a'),_0x1284f1[_0x5675('0x1b')]),_0x1284f1);queues[_0x5675('0x29')](_0x1284f1);calls[_0x5675('0x29')](_0x1284f1);}catch(_0xd353e){utils[_0x5675('0x11')](util['format'](_0x5675('0x2a'),_0x1284f1[_0x5675('0x1b')]),_0xd353e);}});ami['on'](_0x5675('0x2b'),function(_0x3abbb4){try{utils[_0x5675('0x15')](util[_0x5675('0x16')]('[%s][index][newstate]',_0x3abbb4[_0x5675('0x1b')]),_0x3abbb4);calls[_0x5675('0x2b')](_0x3abbb4);recordings['newstate'](_0x3abbb4);}catch(_0x474911){utils['error'](util[_0x5675('0x16')](_0x5675('0x2c'),_0x3abbb4[_0x5675('0x1b')]),_0x474911);}});ami['on']('hangup',function(_0x53d992){try{utils[_0x5675('0x15')](util['format']('[%s][index][hangup]',_0x53d992[_0x5675('0x1b')]),_0x53d992);calls[_0x5675('0x2d')](_0x53d992);recordings[_0x5675('0x2d')](_0x53d992);dials[_0x5675('0x2d')](_0x53d992);agents['hangup'](_0x53d992);queues[_0x5675('0x2d')](_0x53d992);}catch(_0x282639){utils[_0x5675('0x11')](util['format']('[%s][index][hangup]',_0x53d992[_0x5675('0x1b')]),_0x282639);}});ami['on'](_0x5675('0x2e'),function(_0x3ac94d){try{utils[_0x5675('0x15')](util['format'](_0x5675('0x2f'),_0x3ac94d[_0x5675('0x1b')]),_0x3ac94d);members[_0x5675('0x2e')](_0x3ac94d);}catch(_0x17b5a9){utils['error'](util[_0x5675('0x16')](_0x5675('0x2f'),_0x3ac94d[_0x5675('0x1b')]),_0x17b5a9);}});ami['on'](_0x5675('0x30'),function(_0x480127){try{utils['debug'](util[_0x5675('0x16')](_0x5675('0x31'),_0x480127[_0x5675('0x1b')]),_0x480127);queues['blindtransfer'](_0x480127);agents['blindtransfer'](_0x480127);transfers[_0x5675('0x30')](_0x480127);recordings['blindtransfer'](_0x480127);}catch(_0x13524e){utils[_0x5675('0x11')](util['format'](_0x5675('0x31'),_0x480127[_0x5675('0x1b')]),_0x13524e);}});ami['on'](_0x5675('0x32'),function(_0x4c881f){try{utils[_0x5675('0x15')](util[_0x5675('0x16')](_0x5675('0x33'),_0x4c881f['origtransfereruniqueid']),_0x4c881f);queues[_0x5675('0x32')](_0x4c881f);transfers[_0x5675('0x32')](_0x4c881f);agents[_0x5675('0x32')](_0x4c881f);calls[_0x5675('0x32')](_0x4c881f);}catch(_0xffa32b){utils[_0x5675('0x11')](util[_0x5675('0x16')]('[%s][index][attendedtransfer]',_0x4c881f[_0x5675('0x34')]),_0xffa32b);}});ami['on']('varset',function(_0x47ad6e){try{utils['debug'](util[_0x5675('0x16')]('[%s][index][varset]',_0x47ad6e[_0x5675('0x1b')]),_0x47ad6e);queues[_0x5675('0x35')](_0x47ad6e);recordings[_0x5675('0x35')](_0x47ad6e);calls[_0x5675('0x35')](_0x47ad6e);dials[_0x5675('0x35')](_0x47ad6e);}catch(_0x279901){utils[_0x5675('0x11')](util[_0x5675('0x16')]('[%s][index][varset]',_0x47ad6e[_0x5675('0x1b')]),_0x279901);}});ami['on']('newexten',function(_0x22844e){try{utils[_0x5675('0x15')](util[_0x5675('0x16')](_0x5675('0x36'),_0x22844e[_0x5675('0x1b')]),_0x22844e);calls[_0x5675('0x37')](_0x22844e);recordings[_0x5675('0x37')](_0x22844e);dials['newexten'](_0x22844e);}catch(_0x4dfec3){utils[_0x5675('0x11')](util[_0x5675('0x16')]('[%s][index][newexten]',_0x22844e[_0x5675('0x1b')]),_0x4dfec3);}});ami['on']('newchannel',function(_0x383f7c){try{utils['debug'](util['format'](_0x5675('0x38'),_0x383f7c[_0x5675('0x1b')]),_0x383f7c);calls[_0x5675('0x39')](_0x383f7c);recordings['newchannel'](_0x383f7c);}catch(_0x52e988){utils[_0x5675('0x11')](util[_0x5675('0x16')](_0x5675('0x38'),_0x383f7c[_0x5675('0x1b')]),_0x52e988);}});ami['on']('dialbegin',function(_0x1d68b7){try{utils[_0x5675('0x15')](util[_0x5675('0x16')](_0x5675('0x3a'),_0x1d68b7['uniqueid']),_0x1d68b7);dials[_0x5675('0x3b')](_0x1d68b7);}catch(_0x134c9e){utils[_0x5675('0x11')](util['format']('[%s]dialbegin',_0x1d68b7[_0x5675('0x1b')]),_0x134c9e);}});ami['on'](_0x5675('0x3c'),function(_0x1ce572){try{utils['debug'](util[_0x5675('0x16')](_0x5675('0x3d'),_0x1ce572['uniqueid']),_0x1ce572);dials[_0x5675('0x3c')](_0x1ce572);}catch(_0x2b2d6d){utils[_0x5675('0x11')](util[_0x5675('0x16')](_0x5675('0x3d'),_0x1ce572[_0x5675('0x1b')]),_0x2b2d6d);}});} \ No newline at end of file +var _0x569f=['asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','fullybooted','error','close','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util'];(function(_0x3b366d,_0x57d5ac){var _0x1ea933=function(_0xe53e3a){while(--_0xe53e3a){_0x3b366d['push'](_0x3b366d['shift']());}};_0x1ea933(++_0x57d5ac);}(_0x569f,0xcb));var _0xf569=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0x569f[_0x23b3e0];return _0x122558;};var AsteriskManager=require(_0xf569('0x0'));var config=require(_0xf569('0x1'));var utils=require(_0xf569('0x2'));var util=require(_0xf569('0x3'));var ami=new AsteriskManager(config[_0xf569('0x4')][_0xf569('0x5')],config[_0xf569('0x4')]['ip'],config[_0xf569('0x4')][_0xf569('0x6')],config['asterisk'][_0xf569('0x7')],!![]);ami[_0xf569('0x8')]();if(config['xdr']&&config[_0xf569('0x9')]['disabled']){utils[_0xf569('0xa')](_0xf569('0xb'));}else{var agents=require(_0xf569('0xc'));var calls=require(_0xf569('0xd'));var queues=require(_0xf569('0xe'));var recordings=require(_0xf569('0xf'));var members=require(_0xf569('0x10'));var dials=require(_0xf569('0x11'));var transfers=require(_0xf569('0x12'));var core=require('./core.controller');ami['on']('connect',core[_0xf569('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xf569('0x14'),core['fullybooted']);ami['on'](_0xf569('0x15'),core[_0xf569('0x15')]);ami['on'](_0xf569('0x16'),core['close']);ami['on']('managerevent',core['managerevent']);ami['on'](_0xf569('0x17'),function(_0x253f29){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x19'),_0x253f29[_0xf569('0x1a')]),_0x253f29);members[_0xf569('0x17')](_0x253f29);}catch(_0x3fea16){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x19'),_0x253f29[_0xf569('0x1a')]),_0x3fea16);}});ami['on'](_0xf569('0x1c'),function(_0x4c64ab){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x1d'),_0x4c64ab[_0xf569('0x1e')]),_0x4c64ab);agents[_0xf569('0x1c')](_0x4c64ab);}catch(_0x1d901a){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x1d'),_0x4c64ab['uniqueid']),_0x1d901a);}});ami['on'](_0xf569('0x1f'),function(_0x48b836){try{utils[_0xf569('0x18')](util['format']('[%s][index][agentringnoanswer]',_0x48b836['uniqueid']),_0x48b836);agents[_0xf569('0x1f')](_0x48b836);}catch(_0x24b49a){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x20'),_0x48b836[_0xf569('0x1e')]),_0x24b49a);}});ami['on'](_0xf569('0x21'),function(_0xdd3f67){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x22'),_0xdd3f67[_0xf569('0x1e')]),_0xdd3f67);agents[_0xf569('0x21')](_0xdd3f67);queues[_0xf569('0x21')](_0xdd3f67);}catch(_0x5f163f){utils[_0xf569('0x15')](util['format'](_0xf569('0x22'),_0xdd3f67['uniqueid']),_0x5f163f);}});ami['on'](_0xf569('0x23'),function(_0x267be0){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x24'),_0x267be0[_0xf569('0x1e')]),_0x267be0);agents[_0xf569('0x23')](_0x267be0);queues['agentcomplete'](_0x267be0);members[_0xf569('0x23')](_0x267be0);}catch(_0x4a80da){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x24'),_0x267be0[_0xf569('0x1e')]),_0x4a80da);}});ami['on'](_0xf569('0x25'),function(_0x254c30){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x26'),_0x254c30[_0xf569('0x1e')]),_0x254c30);agents[_0xf569('0x25')](_0x254c30);queues[_0xf569('0x25')](_0x254c30);}catch(_0x1a53c4){utils['error'](util[_0xf569('0x1b')](_0xf569('0x26'),_0x254c30[_0xf569('0x1e')]),_0x1a53c4);}});ami['on'](_0xf569('0x27'),function(_0x2f9e76){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')]('[%s][index][queuecallerjoin]',_0x2f9e76[_0xf569('0x1e')]),_0x2f9e76);queues[_0xf569('0x27')](_0x2f9e76);recordings['queuecallerjoin'](_0x2f9e76);}catch(_0x45dfab){utils['error'](util[_0xf569('0x1b')](_0xf569('0x28'),_0x2f9e76[_0xf569('0x1e')]),_0x45dfab);}});ami['on'](_0xf569('0x29'),function(_0x2eb5c4){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x2a'),_0x2eb5c4[_0xf569('0x1e')]),_0x2eb5c4);queues['queuecallerleave'](_0x2eb5c4);}catch(_0x2ce0d7){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x2a'),_0x2eb5c4[_0xf569('0x1e')]),_0x2ce0d7);}});ami['on'](_0xf569('0x2b'),function(_0x4ecdaf){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x2c'),_0x4ecdaf[_0xf569('0x1e')]),_0x4ecdaf);queues[_0xf569('0x2b')](_0x4ecdaf);calls[_0xf569('0x2b')](_0x4ecdaf);}catch(_0x3777d5){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x2c'),_0x4ecdaf[_0xf569('0x1e')]),_0x3777d5);}});ami['on']('musiconholdstop',function(_0x4fea47){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x2d'),_0x4fea47['uniqueid']),_0x4fea47);queues[_0xf569('0x2e')](_0x4fea47);calls[_0xf569('0x2e')](_0x4fea47);}catch(_0x627ebe){utils['error'](util[_0xf569('0x1b')](_0xf569('0x2d'),_0x4fea47[_0xf569('0x1e')]),_0x627ebe);}});ami['on'](_0xf569('0x2f'),function(_0x4a7802){try{utils['debug'](util[_0xf569('0x1b')](_0xf569('0x30'),_0x4a7802[_0xf569('0x1e')]),_0x4a7802);calls[_0xf569('0x2f')](_0x4a7802);recordings[_0xf569('0x2f')](_0x4a7802);}catch(_0x57c7d2){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x30'),_0x4a7802[_0xf569('0x1e')]),_0x57c7d2);}});ami['on']('hangup',function(_0x191125){try{utils['debug'](util[_0xf569('0x1b')]('[%s][index][hangup]',_0x191125[_0xf569('0x1e')]),_0x191125);calls[_0xf569('0x31')](_0x191125);recordings[_0xf569('0x31')](_0x191125);dials[_0xf569('0x31')](_0x191125);agents[_0xf569('0x31')](_0x191125);queues[_0xf569('0x31')](_0x191125);}catch(_0x7f934a){utils['error'](util[_0xf569('0x1b')](_0xf569('0x32'),_0x191125[_0xf569('0x1e')]),_0x7f934a);}});ami['on'](_0xf569('0x33'),function(_0x24d77d){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')]('[%s][index][cdr]',_0x24d77d[_0xf569('0x1e')]),_0x24d77d);members[_0xf569('0x33')](_0x24d77d);}catch(_0x30a6d4){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x34'),_0x24d77d['uniqueid']),_0x30a6d4);}});ami['on']('blindtransfer',function(_0x31697b){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x35'),_0x31697b[_0xf569('0x1e')]),_0x31697b);queues[_0xf569('0x36')](_0x31697b);agents['blindtransfer'](_0x31697b);transfers[_0xf569('0x36')](_0x31697b);recordings[_0xf569('0x36')](_0x31697b);}catch(_0x400938){utils[_0xf569('0x15')](util[_0xf569('0x1b')]('[%s][index][blindtransfer]',_0x31697b[_0xf569('0x1e')]),_0x400938);}});ami['on']('attendedtransfer',function(_0x512806){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')](_0xf569('0x37'),_0x512806[_0xf569('0x38')]),_0x512806);queues[_0xf569('0x39')](_0x512806);transfers[_0xf569('0x39')](_0x512806);agents[_0xf569('0x39')](_0x512806);calls['attendedtransfer'](_0x512806);}catch(_0x23600a){utils['error'](util[_0xf569('0x1b')](_0xf569('0x37'),_0x512806['origtransfereruniqueid']),_0x23600a);}});ami['on'](_0xf569('0x3a'),function(_0x1fbe96){try{utils['debug'](util[_0xf569('0x1b')](_0xf569('0x3b'),_0x1fbe96[_0xf569('0x1e')]),_0x1fbe96);queues[_0xf569('0x3a')](_0x1fbe96);recordings[_0xf569('0x3a')](_0x1fbe96);calls[_0xf569('0x3a')](_0x1fbe96);dials[_0xf569('0x3a')](_0x1fbe96);}catch(_0x18a65e){utils[_0xf569('0x15')](util[_0xf569('0x1b')]('[%s][index][varset]',_0x1fbe96[_0xf569('0x1e')]),_0x18a65e);}});ami['on']('newexten',function(_0x38fcdb){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x3c'),_0x38fcdb[_0xf569('0x1e')]),_0x38fcdb);calls[_0xf569('0x3d')](_0x38fcdb);recordings[_0xf569('0x3d')](_0x38fcdb);dials[_0xf569('0x3d')](_0x38fcdb);}catch(_0x3faadc){utils['error'](util[_0xf569('0x1b')](_0xf569('0x3c'),_0x38fcdb[_0xf569('0x1e')]),_0x3faadc);}});ami['on'](_0xf569('0x3e'),function(_0x4e42c1){try{utils['debug'](util[_0xf569('0x1b')](_0xf569('0x3f'),_0x4e42c1[_0xf569('0x1e')]),_0x4e42c1);calls[_0xf569('0x3e')](_0x4e42c1);recordings[_0xf569('0x3e')](_0x4e42c1);}catch(_0x27a984){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x3f'),_0x4e42c1[_0xf569('0x1e')]),_0x27a984);}});ami['on'](_0xf569('0x40'),function(_0x32f2c1){try{utils[_0xf569('0x18')](util['format'](_0xf569('0x41'),_0x32f2c1['uniqueid']),_0x32f2c1);dials['dialbegin'](_0x32f2c1);}catch(_0x3ec474){utils['error'](util[_0xf569('0x1b')](_0xf569('0x42'),_0x32f2c1[_0xf569('0x1e')]),_0x3ec474);}});ami['on'](_0xf569('0x43'),function(_0x50123d){try{utils[_0xf569('0x18')](util[_0xf569('0x1b')]('[%s][index][dialend]',_0x50123d[_0xf569('0x1e')]),_0x50123d);dials[_0xf569('0x43')](_0x50123d);}catch(_0x3ffc99){utils[_0xf569('0x15')](util[_0xf569('0x1b')](_0xf569('0x44'),_0x50123d[_0xf569('0x1e')]),_0x3ffc99);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a3b37da..377d499 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 _0x69b0=['assign','[%s][members][cdr]','channel','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data2','lodash','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','membername','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','now','agent','NOT_INUSE','exitAt','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue'];(function(_0xadb9c3,_0x1f3b9e){var _0x3c3338=function(_0x102252){while(--_0x102252){_0xadb9c3['push'](_0xadb9c3['shift']());}};_0x3c3338(++_0x1f3b9e);}(_0x69b0,0x170));var _0x069b=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x69b0[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0x069b('0x0'));var util=require('util');var utils=require(_0x069b('0x1'));var members={};var exclude=[_0x069b('0x2'),_0x069b('0x3')];function writeDB(_0x58acfa){utils['info'](util[_0x069b('0x4')](_0x069b('0x5'),_0x58acfa['uniqueid'],_0x58acfa[_0x069b('0x6')],_0x58acfa['channel'],_0x58acfa['data2'],_0x58acfa[_0x069b('0x7')],_0x58acfa['type']));if(_0x58acfa['interface']){utils[_0x069b('0x8')](_0x58acfa[_0x069b('0x6')])[_0x069b('0x9')](function(_0x582cea){if(_0x582cea){_0x58acfa[_0x069b('0x7')]=_0x582cea['name'];_0x58acfa[_0x069b('0xa')]=_0x582cea[_0x069b('0xa')];utils[_0x069b('0xb')](_0x069b('0xc'),_0x58acfa);}else{utils[_0x069b('0xd')](_0x58acfa[_0x069b('0x6')][_0x069b('0xe')]('/')[0x1])['then'](function(_0x2c4bcc){if(_0x2c4bcc){_0x58acfa[_0x069b('0x7')]=_0x2c4bcc[_0x069b('0xf')];_0x58acfa['internal']=_0x2c4bcc[_0x069b('0xa')];utils[_0x069b('0xb')](_0x069b('0xc'),_0x58acfa);}});}})['catch'](function(_0x361691){utils[_0x069b('0x10')](util[_0x069b('0x4')](_0x069b('0x11'),_0x58acfa['uniqueid']),_0x361691);});}delete members[_0x58acfa[_0x069b('0x6')]];}function startsWith(_0x57e253,_0x19e029){return _[_0x069b('0x12')](_0x57e253,function(_0x52de45){return _[_0x069b('0x13')](_0x19e029,_0x52de45);});}exports[_0x069b('0x14')]=function(_0x3502d4){try{utils[_0x069b('0x15')](util[_0x069b('0x4')](_0x069b('0x16'),members[_0x3502d4[_0x069b('0x17')]]?members[_0x3502d4[_0x069b('0x17')]][_0x069b('0x18')]:_0x3502d4[_0x069b('0x17')]),_0x3502d4);utils['info'](util[_0x069b('0x4')](_0x069b('0x19'),members[_0x3502d4[_0x069b('0x17')]]?members[_0x3502d4[_0x069b('0x17')]]['uniqueid']:_0x3502d4[_0x069b('0x17')],_0x3502d4[_0x069b('0x1a')],_0x3502d4[_0x069b('0x17')]));switch(_0x3502d4[_0x069b('0x1a')]){case _0x069b('0x1b'):case'BUSY':if(!startsWith(exclude,_0x3502d4[_0x069b('0x17')])){members[_0x3502d4[_0x069b('0x17')]]={'channel':'voice','interface':_0x3502d4[_0x069b('0x17')],'type':'TALKING','enterAt':utils[_0x069b('0x1c')](),'role':_0x069b('0x1d')};}break;case _0x069b('0x1e'):if(!_['isNil'](members[_0x3502d4[_0x069b('0x17')]])){members[_0x3502d4['device']][_0x069b('0x1f')]=utils[_0x069b('0x1c')]();members[_0x3502d4[_0x069b('0x17')]]['duration']=utils[_0x069b('0x20')](members[_0x3502d4['device']]['exitAt'],members[_0x3502d4[_0x069b('0x17')]][_0x069b('0x21')]);if(members[_0x3502d4[_0x069b('0x17')]][_0x069b('0x18')]){writeDB(members[_0x3502d4[_0x069b('0x17')]]);}}break;default:break;}}catch(_0x242225){utils['error'](util['format'](_0x069b('0x16'),members[_0x3502d4[_0x069b('0x17')]]?members[_0x3502d4[_0x069b('0x17')]][_0x069b('0x18')]:_0x3502d4['device']),_0x242225);}};exports[_0x069b('0x22')]=function(_0x394dec){try{if(!_[_0x069b('0x23')](members[_0x394dec['interface']])){utils[_0x069b('0x15')](util['format'](_0x069b('0x24'),_0x394dec[_0x069b('0x18')]),_0x394dec);utils[_0x069b('0x25')](util[_0x069b('0x4')](_0x069b('0x26'),_0x394dec[_0x069b('0x18')],_0x394dec['interface'],_0x394dec[_0x069b('0x27')]));members[_0x394dec[_0x069b('0x6')]]=_[_0x069b('0x28')](members[_0x394dec[_0x069b('0x6')]],{'data4':_0x394dec['queue'],'uniqueid':_0x394dec[_0x069b('0x18')]});}}catch(_0x19a518){utils[_0x069b('0x10')](util[_0x069b('0x4')](_0x069b('0x24'),_0x394dec['uniqueid']),_0x19a518);}};exports['cdr']=function(_0x173fdd){try{utils[_0x069b('0x15')](util[_0x069b('0x4')](_0x069b('0x29'),_0x173fdd[_0x069b('0x18')]),_0x173fdd);if(_0x173fdd[_0x069b('0x2a')]){var _0x4f1b02=_0x173fdd['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x4f1b02])){members[_0x4f1b02]=_[_0x069b('0x28')](members[_0x4f1b02],{'data1':members[_0x4f1b02][_0x069b('0x2b')]||_0x173fdd[_0x069b('0x2c')],'data2':members[_0x4f1b02]['data2']||_0x173fdd[_0x069b('0x2d')],'data3':members[_0x4f1b02][_0x069b('0x2e')]||_0x173fdd[_0x069b('0x2f')],'uniqueid':members[_0x4f1b02][_0x069b('0x18')]||_0x173fdd[_0x069b('0x18')]});utils['info'](util[_0x069b('0x4')](_0x069b('0x30'),_0x173fdd['uniqueid'],members[_0x4f1b02][_0x069b('0x2b')],members[_0x4f1b02]['data2'],members[_0x4f1b02][_0x069b('0x2e')]));if(members[_0x4f1b02][_0x069b('0x1f')]){writeDB(members[_0x4f1b02]);}}}if(_0x173fdd['destinationchannel']){var _0x3aa584=_0x173fdd[_0x069b('0x31')]['split']('-')[0x0];if(!_[_0x069b('0x23')](members[_0x3aa584])){members[_0x3aa584]=_[_0x069b('0x28')](members[_0x3aa584],{'data1':members[_0x3aa584][_0x069b('0x2b')]||_0x173fdd[_0x069b('0x2c')],'data2':members[_0x3aa584][_0x069b('0x32')]||_0x173fdd[_0x069b('0x2d')],'data3':members[_0x3aa584][_0x069b('0x2e')]||_0x173fdd[_0x069b('0x2f')],'uniqueid':members[_0x3aa584][_0x069b('0x18')]||_0x173fdd[_0x069b('0x18')]});utils['info'](util['format'](_0x069b('0x30'),_0x173fdd['uniqueid'],members[_0x3aa584][_0x069b('0x2b')],members[_0x3aa584][_0x069b('0x32')],members[_0x3aa584][_0x069b('0x2e')]));if(members[_0x3aa584][_0x069b('0x1f')]){writeDB(members[_0x3aa584]);}}}}catch(_0x35f89d){utils['error'](util[_0x069b('0x4')]('[%s][members][cdr]',_0x173fdd['uniqueid']),_0x35f89d);}}; \ No newline at end of file +var _0xc0f3=['data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','membername','name','internal','CreateMemberReport','getUserByName','split','request','catch','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source'];(function(_0x218396,_0x52b9ef){var _0x26e705=function(_0x3d5e89){while(--_0x3d5e89){_0x218396['push'](_0x218396['shift']());}};_0x26e705(++_0x52b9ef);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc0f3[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x3c0f('0x0'));var utils=require(_0x3c0f('0x1'));var members={};var exclude=[_0x3c0f('0x2'),'Queue:'];function writeDB(_0x3168a0){utils['info'](util['format'](_0x3c0f('0x3'),_0x3168a0[_0x3c0f('0x4')],_0x3168a0[_0x3c0f('0x5')],_0x3168a0[_0x3c0f('0x6')],_0x3168a0[_0x3c0f('0x7')],_0x3168a0['membername'],_0x3168a0[_0x3c0f('0x8')]));if(_0x3168a0[_0x3c0f('0x5')]){utils[_0x3c0f('0x9')](_0x3168a0[_0x3c0f('0x5')])['then'](function(_0x2dcb80){if(_0x2dcb80){_0x3168a0[_0x3c0f('0xa')]=_0x2dcb80[_0x3c0f('0xb')];_0x3168a0[_0x3c0f('0xc')]=_0x2dcb80[_0x3c0f('0xc')];utils['request'](_0x3c0f('0xd'),_0x3168a0);}else{utils[_0x3c0f('0xe')](_0x3168a0[_0x3c0f('0x5')][_0x3c0f('0xf')]('/')[0x1])['then'](function(_0x467327){if(_0x467327){_0x3168a0[_0x3c0f('0xa')]=_0x467327[_0x3c0f('0xb')];_0x3168a0[_0x3c0f('0xc')]=_0x467327[_0x3c0f('0xc')];utils[_0x3c0f('0x10')]('CreateMemberReport',_0x3168a0);}});}})[_0x3c0f('0x11')](function(_0x300911){utils['error'](util[_0x3c0f('0x12')](_0x3c0f('0x13'),_0x3168a0[_0x3c0f('0x4')]),_0x300911);});}delete members[_0x3168a0['interface']];}function startsWith(_0x5be32c,_0x2f523b){return _[_0x3c0f('0x14')](_0x5be32c,function(_0x4b2a45){return _[_0x3c0f('0x15')](_0x2f523b,_0x4b2a45);});}exports[_0x3c0f('0x16')]=function(_0xc014ae){try{utils[_0x3c0f('0x17')](util[_0x3c0f('0x12')]('[%s][members][devicestatechange]',members[_0xc014ae['device']]?members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x4')]:_0xc014ae['device']),_0xc014ae);utils['info'](util['format'](_0x3c0f('0x19'),members[_0xc014ae[_0x3c0f('0x18')]]?members[_0xc014ae[_0x3c0f('0x18')]]['uniqueid']:_0xc014ae[_0x3c0f('0x18')],_0xc014ae['state'],_0xc014ae['device']));switch(_0xc014ae[_0x3c0f('0x1a')]){case _0x3c0f('0x1b'):case'BUSY':if(!startsWith(exclude,_0xc014ae[_0x3c0f('0x18')])){members[_0xc014ae[_0x3c0f('0x18')]]={'channel':_0x3c0f('0x1c'),'interface':_0xc014ae[_0x3c0f('0x18')],'type':_0x3c0f('0x1d'),'enterAt':utils[_0x3c0f('0x1e')](),'role':_0x3c0f('0x1f')};}break;case _0x3c0f('0x20'):if(!_[_0x3c0f('0x21')](members[_0xc014ae[_0x3c0f('0x18')]])){members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x22')]=utils[_0x3c0f('0x1e')]();members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x23')]=utils[_0x3c0f('0x24')](members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x22')],members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x25')]);if(members[_0xc014ae[_0x3c0f('0x18')]][_0x3c0f('0x4')]){writeDB(members[_0xc014ae[_0x3c0f('0x18')]]);}}break;default:break;}}catch(_0x140c6d){utils[_0x3c0f('0x26')](util[_0x3c0f('0x12')](_0x3c0f('0x27'),members[_0xc014ae[_0x3c0f('0x18')]]?members[_0xc014ae['device']]['uniqueid']:_0xc014ae[_0x3c0f('0x18')]),_0x140c6d);}};exports[_0x3c0f('0x28')]=function(_0x29843c){try{if(!_[_0x3c0f('0x21')](members[_0x29843c[_0x3c0f('0x5')]])){utils[_0x3c0f('0x17')](util[_0x3c0f('0x12')]('[%s][members][agentcomplete]',_0x29843c['uniqueid']),_0x29843c);utils[_0x3c0f('0x29')](util[_0x3c0f('0x12')](_0x3c0f('0x2a'),_0x29843c['uniqueid'],_0x29843c[_0x3c0f('0x5')],_0x29843c[_0x3c0f('0x2b')]));members[_0x29843c[_0x3c0f('0x5')]]=_[_0x3c0f('0x2c')](members[_0x29843c['interface']],{'data4':_0x29843c[_0x3c0f('0x2b')],'uniqueid':_0x29843c[_0x3c0f('0x4')]});}}catch(_0x470228){utils['error'](util[_0x3c0f('0x12')]('[%s][members][agentcomplete]',_0x29843c[_0x3c0f('0x4')]),_0x470228);}};exports['cdr']=function(_0x484b95){try{utils[_0x3c0f('0x17')](util[_0x3c0f('0x12')](_0x3c0f('0x2d'),_0x484b95['uniqueid']),_0x484b95);if(_0x484b95[_0x3c0f('0x6')]){var _0x5c2633=_0x484b95[_0x3c0f('0x6')][_0x3c0f('0xf')]('-')[0x0];if(!_[_0x3c0f('0x21')](members[_0x5c2633])){members[_0x5c2633]=_['assign'](members[_0x5c2633],{'data1':members[_0x5c2633][_0x3c0f('0x2e')]||_0x484b95[_0x3c0f('0x8')],'data2':members[_0x5c2633]['data2']||_0x484b95[_0x3c0f('0x2f')],'data3':members[_0x5c2633][_0x3c0f('0x30')]||_0x484b95[_0x3c0f('0x31')],'uniqueid':members[_0x5c2633]['uniqueid']||_0x484b95[_0x3c0f('0x4')]});utils[_0x3c0f('0x29')](util[_0x3c0f('0x12')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x484b95[_0x3c0f('0x4')],members[_0x5c2633][_0x3c0f('0x2e')],members[_0x5c2633][_0x3c0f('0x7')],members[_0x5c2633][_0x3c0f('0x30')]));if(members[_0x5c2633][_0x3c0f('0x22')]){writeDB(members[_0x5c2633]);}}}if(_0x484b95[_0x3c0f('0x32')]){var _0x49e573=_0x484b95[_0x3c0f('0x32')][_0x3c0f('0xf')]('-')[0x0];if(!_[_0x3c0f('0x21')](members[_0x49e573])){members[_0x49e573]=_[_0x3c0f('0x2c')](members[_0x49e573],{'data1':members[_0x49e573][_0x3c0f('0x2e')]||_0x484b95[_0x3c0f('0x8')],'data2':members[_0x49e573][_0x3c0f('0x7')]||_0x484b95['source'],'data3':members[_0x49e573]['data3']||_0x484b95[_0x3c0f('0x31')],'uniqueid':members[_0x49e573][_0x3c0f('0x4')]||_0x484b95[_0x3c0f('0x4')]});utils[_0x3c0f('0x29')](util[_0x3c0f('0x12')](_0x3c0f('0x33'),_0x484b95[_0x3c0f('0x4')],members[_0x49e573][_0x3c0f('0x2e')],members[_0x49e573][_0x3c0f('0x7')],members[_0x49e573][_0x3c0f('0x30')]));if(members[_0x49e573]['exitAt']){writeDB(members[_0x49e573]);}}}}catch(_0x24b2ee){utils[_0x3c0f('0x26')](util[_0x3c0f('0x12')]('[%s][members][cdr]',_0x484b95['uniqueid']),_0x24b2ee);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6f23027..563c5b6 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 _0xed9e=['[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','isNil','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','connectedlinenum','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','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','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed9e,0xb5));var _0xeed9=function(_0x30a831,_0x3db3dc){_0x30a831=_0x30a831-0x0;var _0x4f4171=_0xed9e[_0x30a831];return _0x4f4171;};'use strict';var _=require(_0xeed9('0x0'));var util=require(_0xeed9('0x1'));var utils=require(_0xeed9('0x2'));var queues={};function writeDB(_0x30fd06){utils[_0xeed9('0x3')](util['format'](_0xeed9('0x4'),_0x30fd06['uniqueid'],_0x30fd06[_0xeed9('0x5')],_0x30fd06['queue'],_0x30fd06[_0xeed9('0x6')],_0x30fd06[_0xeed9('0x7')],_0x30fd06[_0xeed9('0x8')],_0x30fd06[_0xeed9('0x9')]));if(_0x30fd06[_0xeed9('0xa')]){utils['getVoiceQueueByName'](_0x30fd06[_0xeed9('0xa')])[_0xeed9('0xb')](function(_0x50636a){if(_0x50636a){_0x30fd06[_0xeed9('0xc')]=_0x50636a['type'];}utils['request'](_0xeed9('0xd'),_0x30fd06);});}else{utils['request'](_0xeed9('0xd'),_0x30fd06);}if(_0x30fd06[_0xeed9('0xe')]){delete queues[_0x30fd06[_0xeed9('0xe')]];}else{delete queues[_0x30fd06[_0xeed9('0xf')]];}}exports[_0xeed9('0x10')]=function(_0x18e329){try{utils[_0xeed9('0x11')](util[_0xeed9('0x12')](_0xeed9('0x13'),_0x18e329['uniqueid']),_0x18e329);utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x14'),_0x18e329[_0xeed9('0xf')],_0x18e329['queue'],_0x18e329[_0xeed9('0x15')]));queues[_0x18e329[_0xeed9('0xf')]]=_[_0xeed9('0x16')](_0x18e329,{'originalposition':_0x18e329[_0xeed9('0x15')],'queuecallerjoinAt':utils[_0xeed9('0x17')](),'mohtime':0x0});}catch(_0x4d9cd6){utils['error'](util[_0xeed9('0x12')](_0xeed9('0x13'),_0x18e329['uniqueid']),_0x4d9cd6);}};exports['hangup']=function(_0x3fabd7){try{if(!_['isNil'](queues[_0x3fabd7[_0xeed9('0xf')]])){utils[_0xeed9('0x11')](util[_0xeed9('0x12')](_0xeed9('0x18'),_0x3fabd7[_0xeed9('0xf')]),_0x3fabd7);if(queues[_0x3fabd7[_0xeed9('0xf')]]['queuecallerleaveAt']){if(!queues[_0x3fabd7[_0xeed9('0xf')]]['queuecallerabandon']&&!queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0x19')]){queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0x1a')]=!![];queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0x1b')]=utils[_0xeed9('0x17')]();queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0x9')]='COMPLETEDBYAGENT';}utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x1c'),_0x3fabd7[_0xeed9('0xf')],queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0x1d')],queues[_0x3fabd7[_0xeed9('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x3fabd7[_0xeed9('0xf')]]);}else if(queues[_0x3fabd7['uniqueid']][_0xeed9('0xe')]){utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x1e'),_0x3fabd7[_0xeed9('0xf')],queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0x1d')],queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0xe')]));queues[queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0xe')]]=queues[_0x3fabd7['uniqueid']];queues[queues[_0x3fabd7[_0xeed9('0xf')]][_0xeed9('0xe')]][_0xeed9('0x1f')]=0x2;delete queues[_0x3fabd7[_0xeed9('0xf')]];}}}catch(_0x119d7b){utils[_0xeed9('0x20')](util['format'](_0xeed9('0x18'),_0x3fabd7[_0xeed9('0xf')]),_0x119d7b);}};exports[_0xeed9('0x21')]=function(_0x214ae9){try{utils['debug'](util['format'](_0xeed9('0x22'),_0x214ae9[_0xeed9('0xf')]),_0x214ae9);if(!_['isNil'](_0x214ae9['variable'][_0xeed9('0x23')])&&_0x214ae9['value'][_0xeed9('0x24')]()!==_0xeed9('0x25')){if(!_[_0xeed9('0x26')](queues[_0x214ae9['uniqueid']])){queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x27')]=![];queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x28')]=null;queues[_0x214ae9['uniqueid']][_0xeed9('0x19')]=!![];queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x29')]=utils[_0xeed9('0x17')]();queues[_0x214ae9[_0xeed9('0xf')]]['queuecallerexitreason']=_0x214ae9[_0xeed9('0x2a')]['toUpperCase']();utils['info'](util['format'](_0xeed9('0x2b'),_0x214ae9[_0xeed9('0xf')],queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x1d')],_0x214ae9[_0xeed9('0x2a')],queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x9')]));writeDB(queues[_0x214ae9[_0xeed9('0xf')]]);}}else if(!_[_0xeed9('0x26')](_0x214ae9['variable'][_0xeed9('0x2c')])){if(!_[_0xeed9('0x26')](queues[_0x214ae9['uniqueid']])&&!queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x27')]){queues[_0x214ae9['uniqueid']]['queuecallerabandon']=![];queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x28')]=null;queues[_0x214ae9[_0xeed9('0xf')]]['queuecallerexit']=!![];queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x29')]=utils[_0xeed9('0x17')]();queues[_0x214ae9[_0xeed9('0xf')]][_0xeed9('0x9')]=_0xeed9('0x2d');utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x2e'),_0x214ae9['uniqueid'],queues[_0x214ae9[_0xeed9('0xf')]]['name'],_0x214ae9[_0xeed9('0x2a')],queues[_0x214ae9['uniqueid']][_0xeed9('0x9')]));}}}catch(_0x15e0ce){utils[_0xeed9('0x20')](util[_0xeed9('0x12')](_0xeed9('0x22'),_0x214ae9[_0xeed9('0xf')]),_0x15e0ce);}};exports[_0xeed9('0x27')]=function(_0x1cc557){try{if(!_[_0xeed9('0x26')](queues[_0x1cc557['uniqueid']])){utils[_0xeed9('0x11')](util['format'](_0xeed9('0x2f'),_0x1cc557[_0xeed9('0xf')]),_0x1cc557);queues[_0x1cc557['uniqueid']]['queuecallerexit']=![];queues[_0x1cc557[_0xeed9('0xf')]][_0xeed9('0x29')]=null;queues[_0x1cc557[_0xeed9('0xf')]]['queuecallerabandon']=!![];queues[_0x1cc557[_0xeed9('0xf')]][_0xeed9('0x28')]=utils[_0xeed9('0x17')]();queues[_0x1cc557[_0xeed9('0xf')]][_0xeed9('0x9')]=_0xeed9('0x30');utils[_0xeed9('0x3')](util[_0xeed9('0x12')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1cc557[_0xeed9('0xf')],queues[_0x1cc557[_0xeed9('0xf')]][_0xeed9('0x1d')],queues[_0x1cc557['uniqueid']]['queuecallerexitreason']));}}catch(_0x384e4c){utils[_0xeed9('0x20')](util[_0xeed9('0x12')]('[%s][queues][queuecallerabandon]',_0x1cc557[_0xeed9('0xf')]),_0x384e4c);}};exports[_0xeed9('0x31')]=function(_0x1af4ae){try{if(!_[_0xeed9('0x26')](queues[_0x1af4ae[_0xeed9('0xf')]])){utils[_0xeed9('0x11')](util['format']('[%s][queues][queuecallerleave]',_0x1af4ae['uniqueid']),_0x1af4ae);utils[_0xeed9('0x3')](util[_0xeed9('0x12')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1af4ae[_0xeed9('0xf')],queues[_0x1af4ae[_0xeed9('0xf')]]['name'],_0x1af4ae[_0xeed9('0x32')],_0x1af4ae['connectedlinename']));queues[_0x1af4ae[_0xeed9('0xf')]]['queuecallerleave']=!![];queues[_0x1af4ae[_0xeed9('0xf')]][_0xeed9('0x33')]=utils['now']();queues[_0x1af4ae[_0xeed9('0xf')]][_0xeed9('0x34')]=utils[_0xeed9('0x35')](queues[_0x1af4ae[_0xeed9('0xf')]][_0xeed9('0x33')],queues[_0x1af4ae[_0xeed9('0xf')]][_0xeed9('0x36')]);queues[_0x1af4ae['uniqueid']][_0xeed9('0x15')]=_0x1af4ae['position'];queues[_0x1af4ae[_0xeed9('0xf')]][_0xeed9('0x37')]=_0x1af4ae[_0xeed9('0x37')];queues[_0x1af4ae[_0xeed9('0xf')]][_0xeed9('0x32')]=_0x1af4ae[_0xeed9('0x32')];queues[_0x1af4ae['uniqueid']][_0xeed9('0x38')]=_0x1af4ae['connectedlinename'];}}catch(_0x310dba){utils[_0xeed9('0x20')](util[_0xeed9('0x12')](_0xeed9('0x39'),_0x1af4ae[_0xeed9('0xf')]),_0x310dba);}};exports['agentconnect']=function(_0x4c7a89){try{if(!_['isNil'](queues[_0x4c7a89[_0xeed9('0xf')]])){utils['debug'](util['format'](_0xeed9('0x3a'),_0x4c7a89['uniqueid']),_0x4c7a89);utils[_0xeed9('0x3')](util[_0xeed9('0x12')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4c7a89[_0xeed9('0xf')],queues[_0x4c7a89[_0xeed9('0xf')]][_0xeed9('0x1d')],_0x4c7a89[_0xeed9('0x3b')],_0x4c7a89['destaccountcode']));queues[_0x4c7a89[_0xeed9('0xf')]][_0xeed9('0x27')]=![];queues[_0x4c7a89[_0xeed9('0xf')]]['queuecallerabandon']=![];queues[_0x4c7a89[_0xeed9('0xf')]]['queuecallerabandonAt']=null;queues[_0x4c7a89[_0xeed9('0xf')]][_0xeed9('0x19')]=![];queues[_0x4c7a89['uniqueid']]['queuecallerexitreason']=null;queues[_0x4c7a89[_0xeed9('0xf')]][_0xeed9('0x29')]=null;queues[_0x4c7a89[_0xeed9('0xf')]]['assigned']=!![];queues[_0x4c7a89[_0xeed9('0xf')]][_0xeed9('0x8')]=_0x4c7a89[_0xeed9('0x3c')];queues[_0x4c7a89[_0xeed9('0xf')]][_0xeed9('0x6')]=_0x4c7a89[_0xeed9('0x3b')];}}catch(_0x12bece){utils[_0xeed9('0x20')](util['format']('[%s][queues][agentconnect]',_0x4c7a89[_0xeed9('0xf')]),_0x12bece);}};exports[_0xeed9('0x3d')]=function(_0x5c2043){try{if(!_[_0xeed9('0x26')](queues[_0x5c2043[_0xeed9('0xf')]])){if(queues[_0x5c2043[_0xeed9('0xf')]][_0xeed9('0x33')]){utils[_0xeed9('0x11')](util[_0xeed9('0x12')](_0xeed9('0x3e'),_0x5c2043['uniqueid']),_0x5c2043);queues[_0x5c2043[_0xeed9('0xf')]]['queuecallerabandon']=![];queues[_0x5c2043[_0xeed9('0xf')]][_0xeed9('0x27')]=![];queues[_0x5c2043[_0xeed9('0xf')]]['queuecallerabandonAt']=null;queues[_0x5c2043[_0xeed9('0xf')]][_0xeed9('0x19')]=![];queues[_0x5c2043['uniqueid']][_0xeed9('0x29')]=null;queues[_0x5c2043['uniqueid']][_0xeed9('0x3f')]=!![];queues[_0x5c2043[_0xeed9('0xf')]][_0xeed9('0x6')]=_0x5c2043[_0xeed9('0x3b')];queues[_0x5c2043[_0xeed9('0xf')]]['queuecallercomplete']=!![];queues[_0x5c2043['uniqueid']][_0xeed9('0x1b')]=utils[_0xeed9('0x17')]();if(_0x5c2043[_0xeed9('0x40')]==_0xeed9('0x41')){if(!queues[_0x5c2043[_0xeed9('0xf')]]['transfer']){queues[_0x5c2043['uniqueid']]['queuecallerexitreason']=_0xeed9('0x42');}}else{queues[_0x5c2043[_0xeed9('0xf')]]['queuecallerexitreason']=_0xeed9('0x43')+_0x5c2043[_0xeed9('0x40')][_0xeed9('0x24')]();}utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x44'),_0x5c2043['uniqueid'],queues[_0x5c2043['uniqueid']]['name'],_0x5c2043[_0xeed9('0x3b')],queues[_0x5c2043[_0xeed9('0xf')]][_0xeed9('0x9')]));writeDB(queues[_0x5c2043['uniqueid']]);}}}catch(_0x4930ff){utils[_0xeed9('0x20')](util[_0xeed9('0x12')](_0xeed9('0x3e'),_0x5c2043[_0xeed9('0xf')]),_0x4930ff);}};exports['blindtransfer']=function(_0x37e14c){try{if(!_[_0xeed9('0x26')](queues[_0x37e14c[_0xeed9('0x45')]])){utils[_0xeed9('0x11')](util[_0xeed9('0x12')]('[%s][queues][blindtransfer]',_0x37e14c['uniqueid']),_0x37e14c);queues[_0x37e14c['transfereeuniqueid']][_0xeed9('0x41')]=!![];queues[_0x37e14c[_0xeed9('0x45')]]['transfertype']=_0xeed9('0x46');queues[_0x37e14c[_0xeed9('0x45')]][_0xeed9('0x47')]=_0x37e14c[_0xeed9('0x48')];queues[_0x37e14c[_0xeed9('0x45')]][_0xeed9('0x49')]=_0x37e14c['transfereeuniqueid'];queues[_0x37e14c[_0xeed9('0x45')]][_0xeed9('0x9')]='BLINDTRANSFER';utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x4a'),_0x37e14c[_0xeed9('0xf')],queues[_0x37e14c[_0xeed9('0x45')]][_0xeed9('0x1d')],_0x37e14c[_0xeed9('0x45')],_0x37e14c[_0xeed9('0x48')]));}}catch(_0x45412b){utils[_0xeed9('0x20')](util[_0xeed9('0x12')]('[%s][queues][blindtransfer]',_0x37e14c[_0xeed9('0xf')]),_0x45412b);}};exports[_0xeed9('0x4b')]=function(_0x3c5234){try{utils[_0xeed9('0x11')](util[_0xeed9('0x12')](_0xeed9('0x4c'),_0x3c5234[_0xeed9('0x4d')]),_0x3c5234);if(_0x3c5234[_0xeed9('0x4d')]==_0x3c5234[_0xeed9('0x4e')]){if(!_[_0xeed9('0x26')](queues[_0x3c5234[_0xeed9('0x4f')]])){utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x50'),_0x3c5234[_0xeed9('0x4d')],queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0x1d')],_0x3c5234[_0xeed9('0x51')]));queues[_0x3c5234['secondtransfererlinkedid']]['transfer']=!![];queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0x52')]=_0xeed9('0x53');queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0x47')]=_0x3c5234['origtransfererexten'];queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0x49')]=_0x3c5234['origtransfereruniqueid'];queues[_0x3c5234[_0xeed9('0x4f')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x3c5234[_0xeed9('0x4e')]])){if(_0x3c5234['transfereelinkedid']&&queues[_0x3c5234[_0xeed9('0x54')]]){queues[_0x3c5234[_0xeed9('0x54')]][_0xeed9('0x1f')]=0x1;queues[_0x3c5234['transfereeuniqueid']]=_['clone'](queues[_0x3c5234[_0xeed9('0x54')]]);queues[_0x3c5234['transfereeuniqueid']][_0xeed9('0xe')]=_0x3c5234['transfertargetuniqueid'];queues[_0x3c5234[_0xeed9('0x45')]]['queuecallerenterreason']=0x2;queues[_0x3c5234[_0xeed9('0x45')]][_0xeed9('0x7')]=queues[_0x3c5234[_0xeed9('0x4f')]]['calleridnum'];queues[_0x3c5234[_0xeed9('0x45')]][_0xeed9('0x55')]=queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0x55')];queues[_0x3c5234[_0xeed9('0x45')]]['queuecallerjoinAt']=utils[_0xeed9('0x17')]();queues[_0x3c5234[_0xeed9('0x45')]][_0xeed9('0x33')]=utils[_0xeed9('0x17')]();queues[_0x3c5234['transfereeuniqueid']][_0xeed9('0x34')]=0x0;queues[_0x3c5234['transfereeuniqueid']][_0xeed9('0x56')]=0x0;utils[_0xeed9('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3c5234['origtransfereruniqueid'],queues[_0x3c5234[_0xeed9('0x45')]][_0xeed9('0x1d')],queues[_0x3c5234['transfereeuniqueid']][_0xeed9('0x7')],queues[_0x3c5234[_0xeed9('0x45')]]['calleridname']));}else{utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x57'),_0x3c5234[_0xeed9('0x4d')],queues[_0x3c5234[_0xeed9('0x4e')]][_0xeed9('0x1d')],_0x3c5234[_0xeed9('0x4f')]));queues[_0x3c5234[_0xeed9('0x4e')]]['transfereduniqueid']=_0x3c5234['secondtransfererlinkedid'];}}}else if(_0x3c5234[_0xeed9('0x58')]==_0x3c5234[_0xeed9('0x4f')]){if(!_[_0xeed9('0x26')](queues[_0x3c5234[_0xeed9('0x4e')]])){utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x59'),_0x3c5234[_0xeed9('0x4d')],queues[_0x3c5234[_0xeed9('0x4e')]][_0xeed9('0x1d')],_0x3c5234['secondtransfereruniqueid'],_0x3c5234['secondtransfererexten']));queues[_0x3c5234['origtransfererlinkedid']][_0xeed9('0x41')]=!![];queues[_0x3c5234[_0xeed9('0x4e')]][_0xeed9('0x52')]=_0xeed9('0x53');queues[_0x3c5234['origtransfererlinkedid']][_0xeed9('0x47')]=_0x3c5234['secondtransfererexten'];queues[_0x3c5234[_0xeed9('0x4e')]][_0xeed9('0x49')]=_0x3c5234[_0xeed9('0x58')];queues[_0x3c5234[_0xeed9('0x4e')]][_0xeed9('0x9')]=_0xeed9('0x5a');}if(!_['isNil'](queues[_0x3c5234[_0xeed9('0x4f')]])){if(_0x3c5234[_0xeed9('0x5b')]&&queues[_0x3c5234[_0xeed9('0x5b')]]){queues[_0x3c5234['transfertargetlinkedid']][_0xeed9('0x1f')]=0x1;queues[_0x3c5234[_0xeed9('0x5c')]]=_['clone'](queues[_0x3c5234[_0xeed9('0x5b')]]);queues[_0x3c5234[_0xeed9('0x5c')]]['transfereduniqueid']=_0x3c5234[_0xeed9('0x5c')];queues[_0x3c5234[_0xeed9('0x5c')]][_0xeed9('0x1f')]=0x2;queues[_0x3c5234['transfertargetuniqueid']][_0xeed9('0x7')]=queues[_0x3c5234[_0xeed9('0x4e')]][_0xeed9('0x7')];queues[_0x3c5234[_0xeed9('0x5c')]]['calleridname']=queues[_0x3c5234['origtransfererlinkedid']][_0xeed9('0x55')];queues[_0x3c5234['transfertargetuniqueid']][_0xeed9('0x36')]=utils[_0xeed9('0x17')]();queues[_0x3c5234['transfertargetuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x3c5234[_0xeed9('0x5c')]]['holdtime']=0x0;queues[_0x3c5234[_0xeed9('0x5c')]][_0xeed9('0x56')]=0x0;utils[_0xeed9('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3c5234['origtransfereruniqueid'],queues[_0x3c5234[_0xeed9('0x5c')]][_0xeed9('0x1d')],queues[_0x3c5234[_0xeed9('0x5c')]][_0xeed9('0xe')],queues[_0x3c5234[_0xeed9('0x5c')]]['calleridnum'],queues[_0x3c5234[_0xeed9('0x5c')]][_0xeed9('0x55')]));}else{utils[_0xeed9('0x3')](util['format'](_0xeed9('0x57'),_0x3c5234['origtransfereruniqueid'],queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0x1d')],_0x3c5234['origtransfererlinkedid']));queues[_0x3c5234[_0xeed9('0x4f')]][_0xeed9('0xe')]=_0x3c5234[_0xeed9('0x4e')];}}}}catch(_0x2807aa){utils[_0xeed9('0x20')](util[_0xeed9('0x12')](_0xeed9('0x4c'),_0x3c5234[_0xeed9('0x4d')]),_0x2807aa);}};exports[_0xeed9('0x5d')]=function(_0x4bf267){try{if(!_[_0xeed9('0x26')](queues[_0x4bf267[_0xeed9('0xf')]])){utils[_0xeed9('0x11')](util[_0xeed9('0x12')](_0xeed9('0x5e'),_0x4bf267[_0xeed9('0xf')]),_0x4bf267);queues[_0x4bf267[_0xeed9('0xf')]][_0xeed9('0x5f')]=utils[_0xeed9('0x17')]();utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x60'),_0x4bf267[_0xeed9('0xf')],queues[_0x4bf267[_0xeed9('0xf')]][_0xeed9('0x1d')],queues[_0x4bf267[_0xeed9('0xf')]]['musiconholdstartAt']));}}catch(_0x27f1c6){utils['error'](util[_0xeed9('0x12')](_0xeed9('0x5e'),_0x4bf267[_0xeed9('0xf')]),_0x27f1c6);}};exports[_0xeed9('0x61')]=function(_0x2e45c9){try{if(!_[_0xeed9('0x26')](queues[_0x2e45c9[_0xeed9('0xf')]])){if(!_[_0xeed9('0x26')](queues[_0x2e45c9[_0xeed9('0xf')]]['musiconholdstartAt'])){utils['debug'](util['format'](_0xeed9('0x62'),_0x2e45c9[_0xeed9('0xf')]),_0x2e45c9);queues[_0x2e45c9[_0xeed9('0xf')]][_0xeed9('0x56')]+=utils[_0xeed9('0x35')](utils['now'](),queues[_0x2e45c9['uniqueid']][_0xeed9('0x5f')]);utils[_0xeed9('0x3')](util[_0xeed9('0x12')](_0xeed9('0x63'),_0x2e45c9['uniqueid'],queues[_0x2e45c9[_0xeed9('0xf')]][_0xeed9('0x1d')],queues[_0x2e45c9[_0xeed9('0xf')]][_0xeed9('0x56')]));delete queues[_0x2e45c9['uniqueid']][_0xeed9('0x5f')];}}}catch(_0x3dce7c){utils[_0xeed9('0x20')](util[_0xeed9('0x12')]('[%s][queues][musiconholdstop]',_0x2e45c9[_0xeed9('0xf')]),_0x3dce7c);}}; \ No newline at end of file +var _0x0596=['queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexit','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','origtransfererexten','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','isNil','now','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','queuecallerabandonAt'];(function(_0x10adc7,_0x46ad48){var _0x147f71=function(_0x44f8ce){while(--_0x44f8ce){_0x10adc7['push'](_0x10adc7['shift']());}};_0x147f71(++_0x46ad48);}(_0x0596,0x1f2));var _0x6059=function(_0xc77993,_0x416fdf){_0xc77993=_0xc77993-0x0;var _0x49a506=_0x0596[_0xc77993];return _0x49a506;};'use strict';var _=require(_0x6059('0x0'));var util=require(_0x6059('0x1'));var utils=require(_0x6059('0x2'));var queues={};function writeDB(_0x46eeb5){utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x5'),_0x46eeb5[_0x6059('0x6')],_0x46eeb5[_0x6059('0x7')],_0x46eeb5[_0x6059('0x8')],_0x46eeb5[_0x6059('0x9')],_0x46eeb5[_0x6059('0xa')],_0x46eeb5[_0x6059('0xb')],_0x46eeb5['queuecallerexitreason']));if(_0x46eeb5[_0x6059('0x8')]){utils[_0x6059('0xc')](_0x46eeb5['queue'])[_0x6059('0xd')](function(_0x267494){if(_0x267494){_0x46eeb5[_0x6059('0xe')]=_0x267494[_0x6059('0xe')];}utils['request'](_0x6059('0xf'),_0x46eeb5);});}else{utils[_0x6059('0x10')](_0x6059('0xf'),_0x46eeb5);}if(_0x46eeb5[_0x6059('0x11')]){delete queues[_0x46eeb5['transfereduniqueid']];}else{delete queues[_0x46eeb5['uniqueid']];}}exports[_0x6059('0x12')]=function(_0x346f24){try{utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x14'),_0x346f24[_0x6059('0x6')]),_0x346f24);utils[_0x6059('0x3')](util['format'](_0x6059('0x15'),_0x346f24[_0x6059('0x6')],_0x346f24[_0x6059('0x8')],_0x346f24[_0x6059('0x16')]));queues[_0x346f24[_0x6059('0x6')]]=_[_0x6059('0x17')](_0x346f24,{'originalposition':_0x346f24[_0x6059('0x16')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x17c5f5){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x14'),_0x346f24[_0x6059('0x6')]),_0x17c5f5);}};exports[_0x6059('0x19')]=function(_0x517800){try{if(!_['isNil'](queues[_0x517800['uniqueid']])){utils[_0x6059('0x13')](util[_0x6059('0x4')]('[%s][queues][hangup]',_0x517800['uniqueid']),_0x517800);if(queues[_0x517800['uniqueid']][_0x6059('0x1a')]){if(!queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1b')]&&!queues[_0x517800[_0x6059('0x6')]]['queuecallerexit']){queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1c')]=!![];queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1d')]=utils['now']();queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1e')]='COMPLETEDBYAGENT';}utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x1f'),_0x517800[_0x6059('0x6')],queues[_0x517800[_0x6059('0x6')]][_0x6059('0x20')],queues[_0x517800[_0x6059('0x6')]][_0x6059('0x1e')]));writeDB(queues[_0x517800[_0x6059('0x6')]]);}else if(queues[_0x517800[_0x6059('0x6')]][_0x6059('0x11')]){utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x21'),_0x517800[_0x6059('0x6')],queues[_0x517800[_0x6059('0x6')]]['name'],queues[_0x517800[_0x6059('0x6')]][_0x6059('0x11')]));queues[queues[_0x517800['uniqueid']][_0x6059('0x11')]]=queues[_0x517800[_0x6059('0x6')]];queues[queues[_0x517800[_0x6059('0x6')]][_0x6059('0x11')]]['queuecallerenterreason']=0x2;delete queues[_0x517800[_0x6059('0x6')]];}}}catch(_0x571aa2){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x22'),_0x517800['uniqueid']),_0x571aa2);}};exports[_0x6059('0x23')]=function(_0x409e8f){try{utils[_0x6059('0x13')](util['format'](_0x6059('0x24'),_0x409e8f['uniqueid']),_0x409e8f);if(!_['isNil'](_0x409e8f[_0x6059('0x25')][_0x6059('0x26')])&&_0x409e8f['value']['toUpperCase']()!==_0x6059('0x27')){if(!_[_0x6059('0x28')](queues[_0x409e8f['uniqueid']])){queues[_0x409e8f[_0x6059('0x6')]]['queuecallerabandon']=![];queues[_0x409e8f['uniqueid']]['queuecallerabandonAt']=null;queues[_0x409e8f[_0x6059('0x6')]]['queuecallerexit']=!![];queues[_0x409e8f['uniqueid']]['queuecallerexitAt']=utils[_0x6059('0x29')]();queues[_0x409e8f['uniqueid']][_0x6059('0x1e')]=_0x409e8f['value'][_0x6059('0x2a')]();utils['info'](util[_0x6059('0x4')](_0x6059('0x2b'),_0x409e8f[_0x6059('0x6')],queues[_0x409e8f[_0x6059('0x6')]]['name'],_0x409e8f[_0x6059('0x2c')],queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1e')]));writeDB(queues[_0x409e8f[_0x6059('0x6')]]);}}else if(!_[_0x6059('0x28')](_0x409e8f[_0x6059('0x25')][_0x6059('0x2d')])){if(!_['isNil'](queues[_0x409e8f[_0x6059('0x6')]])&&!queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1b')]){queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x409e8f['uniqueid']][_0x6059('0x2e')]=null;queues[_0x409e8f[_0x6059('0x6')]]['queuecallerexit']=!![];queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x2f')]=utils[_0x6059('0x29')]();queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1e')]=_0x6059('0x30');utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x31'),_0x409e8f[_0x6059('0x6')],queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x20')],_0x409e8f['value'],queues[_0x409e8f[_0x6059('0x6')]][_0x6059('0x1e')]));}}}catch(_0xb03377){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x24'),_0x409e8f[_0x6059('0x6')]),_0xb03377);}};exports[_0x6059('0x1b')]=function(_0x347ac9){try{if(!_[_0x6059('0x28')](queues[_0x347ac9[_0x6059('0x6')]])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x32'),_0x347ac9['uniqueid']),_0x347ac9);queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x33')]=![];queues[_0x347ac9[_0x6059('0x6')]]['queuecallerexitAt']=null;queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x1b')]=!![];queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x2e')]=utils[_0x6059('0x29')]();queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x1e')]='ABANDONED';utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x34'),_0x347ac9[_0x6059('0x6')],queues[_0x347ac9['uniqueid']][_0x6059('0x20')],queues[_0x347ac9[_0x6059('0x6')]][_0x6059('0x1e')]));}}catch(_0x3b8c85){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x32'),_0x347ac9[_0x6059('0x6')]),_0x3b8c85);}};exports[_0x6059('0x35')]=function(_0x356fab){try{if(!_[_0x6059('0x28')](queues[_0x356fab['uniqueid']])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x36'),_0x356fab[_0x6059('0x6')]),_0x356fab);utils[_0x6059('0x3')](util[_0x6059('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x356fab['uniqueid'],queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x20')],_0x356fab[_0x6059('0x37')],_0x356fab[_0x6059('0x38')]));queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x35')]=!![];queues[_0x356fab[_0x6059('0x6')]]['queuecallerleaveAt']=utils[_0x6059('0x29')]();queues[_0x356fab[_0x6059('0x6')]]['holdtime']=utils[_0x6059('0x39')](queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x1a')],queues[_0x356fab['uniqueid']][_0x6059('0x3a')]);queues[_0x356fab['uniqueid']]['position']=_0x356fab[_0x6059('0x16')];queues[_0x356fab[_0x6059('0x6')]]['count']=_0x356fab['count'];queues[_0x356fab[_0x6059('0x6')]][_0x6059('0x37')]=_0x356fab[_0x6059('0x37')];queues[_0x356fab['uniqueid']][_0x6059('0x38')]=_0x356fab[_0x6059('0x38')];}}catch(_0x163496){utils['error'](util[_0x6059('0x4')](_0x6059('0x36'),_0x356fab[_0x6059('0x6')]),_0x163496);}};exports[_0x6059('0x3b')]=function(_0x3dff5f){try{if(!_['isNil'](queues[_0x3dff5f['uniqueid']])){utils['debug'](util[_0x6059('0x4')](_0x6059('0x3c'),_0x3dff5f[_0x6059('0x6')]),_0x3dff5f);utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x3d'),_0x3dff5f[_0x6059('0x6')],queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x20')],_0x3dff5f[_0x6059('0x3e')],_0x3dff5f[_0x6059('0x3f')]));queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x3dff5f['uniqueid']][_0x6059('0x2e')]=null;queues[_0x3dff5f['uniqueid']][_0x6059('0x33')]=![];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x1e')]=null;queues[_0x3dff5f['uniqueid']][_0x6059('0x2f')]=null;queues[_0x3dff5f[_0x6059('0x6')]]['assigned']=!![];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0xb')]=_0x3dff5f[_0x6059('0x3f')];queues[_0x3dff5f[_0x6059('0x6')]][_0x6059('0x9')]=_0x3dff5f[_0x6059('0x3e')];}}catch(_0x5c5f0c){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x3c'),_0x3dff5f[_0x6059('0x6')]),_0x5c5f0c);}};exports[_0x6059('0x40')]=function(_0x343c98){try{if(!_[_0x6059('0x28')](queues[_0x343c98[_0x6059('0x6')]])){if(queues[_0x343c98[_0x6059('0x6')]]['queuecallerleaveAt']){utils[_0x6059('0x13')](util[_0x6059('0x4')]('[%s][queues][agentcomplete]',_0x343c98['uniqueid']),_0x343c98);queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1b')]=![];queues[_0x343c98['uniqueid']][_0x6059('0x1b')]=![];queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x2e')]=null;queues[_0x343c98[_0x6059('0x6')]]['queuecallerexit']=![];queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x2f')]=null;queues[_0x343c98[_0x6059('0x6')]]['assigned']=!![];queues[_0x343c98['uniqueid']]['lastAssignedTo']=_0x343c98[_0x6059('0x3e')];queues[_0x343c98['uniqueid']]['queuecallercomplete']=!![];queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1d')]=utils[_0x6059('0x29')]();if(_0x343c98[_0x6059('0x41')]=='transfer'){if(!queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x42')]){queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1e')]=_0x6059('0x43');}}else{queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1e')]=_0x6059('0x44')+_0x343c98[_0x6059('0x41')]['toUpperCase']();}utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x45'),_0x343c98[_0x6059('0x6')],queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x20')],_0x343c98['membername'],queues[_0x343c98[_0x6059('0x6')]][_0x6059('0x1e')]));writeDB(queues[_0x343c98[_0x6059('0x6')]]);}}}catch(_0x3f2a4f){utils['error'](util[_0x6059('0x4')](_0x6059('0x46'),_0x343c98[_0x6059('0x6')]),_0x3f2a4f);}};exports['blindtransfer']=function(_0x4a3e42){try{if(!_['isNil'](queues[_0x4a3e42[_0x6059('0x47')]])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x48'),_0x4a3e42[_0x6059('0x6')]),_0x4a3e42);queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x42')]=!![];queues[_0x4a3e42[_0x6059('0x47')]]['transfertype']=_0x6059('0x49');queues[_0x4a3e42['transfereeuniqueid']][_0x6059('0x4a')]=_0x4a3e42[_0x6059('0x4b')];queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x4c')]=_0x4a3e42[_0x6059('0x47')];queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x1e')]=_0x6059('0x4d');utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x4e'),_0x4a3e42[_0x6059('0x6')],queues[_0x4a3e42[_0x6059('0x47')]][_0x6059('0x20')],_0x4a3e42['transfereeuniqueid'],_0x4a3e42[_0x6059('0x4b')]));}}catch(_0x2f9d2e){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x48'),_0x4a3e42[_0x6059('0x6')]),_0x2f9d2e);}};exports[_0x6059('0x4f')]=function(_0x3025ce){try{utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x50'),_0x3025ce[_0x6059('0x51')]),_0x3025ce);if(_0x3025ce[_0x6059('0x51')]==_0x3025ce[_0x6059('0x52')]){if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x53')]])){utils[_0x6059('0x3')](util['format'](_0x6059('0x54'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x20')],_0x3025ce['origtransfererexten']));queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0x42')]=!![];queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x55')]=_0x6059('0x56');queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x4a')]=_0x3025ce[_0x6059('0x57')];queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0x4c')]=_0x3025ce[_0x6059('0x51')];queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x1e')]='ATTENDEDTRANSFER';}if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x52')]])){if(_0x3025ce[_0x6059('0x58')]&&queues[_0x3025ce['transfereelinkedid']]){queues[_0x3025ce[_0x6059('0x58')]][_0x6059('0x59')]=0x1;queues[_0x3025ce[_0x6059('0x47')]]=_['clone'](queues[_0x3025ce[_0x6059('0x58')]]);queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x11')]=_0x3025ce[_0x6059('0x5a')];queues[_0x3025ce['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0xa')]=queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0xa')];queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x5b')]=queues[_0x3025ce['secondtransfererlinkedid']][_0x6059('0x5b')];queues[_0x3025ce['transfereeuniqueid']][_0x6059('0x3a')]=utils['now']();queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x1a')]=utils['now']();queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x5c')]=0x0;queues[_0x3025ce[_0x6059('0x47')]]['mohtime']=0x0;utils['info'](util[_0x6059('0x4')](_0x6059('0x5d'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x20')],queues[_0x3025ce['transfereeuniqueid']]['calleridnum'],queues[_0x3025ce[_0x6059('0x47')]][_0x6059('0x5b')]));}else{utils[_0x6059('0x3')](util['format'](_0x6059('0x5e'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x20')],_0x3025ce[_0x6059('0x53')]));queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x11')]=_0x3025ce[_0x6059('0x53')];}}}else if(_0x3025ce[_0x6059('0x5f')]==_0x3025ce[_0x6059('0x53')]){if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x52')]])){utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x60'),_0x3025ce['origtransfereruniqueid'],queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x20')],_0x3025ce[_0x6059('0x5f')],_0x3025ce[_0x6059('0x61')]));queues[_0x3025ce[_0x6059('0x52')]]['transfer']=!![];queues[_0x3025ce[_0x6059('0x52')]]['transfertype']=_0x6059('0x56');queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x4a')]=_0x3025ce['secondtransfererexten'];queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x4c')]=_0x3025ce[_0x6059('0x5f')];queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0x1e')]=_0x6059('0x62');}if(!_[_0x6059('0x28')](queues[_0x3025ce[_0x6059('0x53')]])){if(_0x3025ce[_0x6059('0x63')]&&queues[_0x3025ce[_0x6059('0x63')]]){queues[_0x3025ce[_0x6059('0x63')]]['queuecallerenterreason']=0x1;queues[_0x3025ce[_0x6059('0x5a')]]=_[_0x6059('0x64')](queues[_0x3025ce[_0x6059('0x63')]]);queues[_0x3025ce[_0x6059('0x5a')]]['transfereduniqueid']=_0x3025ce['transfertargetuniqueid'];queues[_0x3025ce[_0x6059('0x5a')]]['queuecallerenterreason']=0x2;queues[_0x3025ce[_0x6059('0x5a')]]['calleridnum']=queues[_0x3025ce[_0x6059('0x52')]][_0x6059('0xa')];queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x5b')]=queues[_0x3025ce[_0x6059('0x52')]]['calleridname'];queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x3a')]=utils[_0x6059('0x29')]();queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x1a')]=utils[_0x6059('0x29')]();queues[_0x3025ce[_0x6059('0x5a')]]['holdtime']=0x0;queues[_0x3025ce['transfertargetuniqueid']][_0x6059('0x65')]=0x0;utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x66'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0x20')],queues[_0x3025ce['transfertargetuniqueid']][_0x6059('0x11')],queues[_0x3025ce[_0x6059('0x5a')]][_0x6059('0xa')],queues[_0x3025ce['transfertargetuniqueid']][_0x6059('0x5b')]));}else{utils[_0x6059('0x3')](util[_0x6059('0x4')](_0x6059('0x5e'),_0x3025ce[_0x6059('0x51')],queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x20')],_0x3025ce[_0x6059('0x52')]));queues[_0x3025ce[_0x6059('0x53')]][_0x6059('0x11')]=_0x3025ce[_0x6059('0x52')];}}}}catch(_0x2e96a3){utils[_0x6059('0x18')](util[_0x6059('0x4')]('[%s][queues][attendedtransfer]',_0x3025ce[_0x6059('0x51')]),_0x2e96a3);}};exports[_0x6059('0x67')]=function(_0x4deb2c){try{if(!_[_0x6059('0x28')](queues[_0x4deb2c[_0x6059('0x6')]])){utils['debug'](util[_0x6059('0x4')](_0x6059('0x68'),_0x4deb2c[_0x6059('0x6')]),_0x4deb2c);queues[_0x4deb2c['uniqueid']]['musiconholdstartAt']=utils[_0x6059('0x29')]();utils['info'](util['format'](_0x6059('0x69'),_0x4deb2c['uniqueid'],queues[_0x4deb2c[_0x6059('0x6')]][_0x6059('0x20')],queues[_0x4deb2c[_0x6059('0x6')]]['musiconholdstartAt']));}}catch(_0x54f206){utils[_0x6059('0x18')](util[_0x6059('0x4')](_0x6059('0x68'),_0x4deb2c['uniqueid']),_0x54f206);}};exports['musiconholdstop']=function(_0x3e438b){try{if(!_['isNil'](queues[_0x3e438b[_0x6059('0x6')]])){if(!_['isNil'](queues[_0x3e438b[_0x6059('0x6')]][_0x6059('0x6a')])){utils[_0x6059('0x13')](util[_0x6059('0x4')](_0x6059('0x6b'),_0x3e438b[_0x6059('0x6')]),_0x3e438b);queues[_0x3e438b[_0x6059('0x6')]][_0x6059('0x65')]+=utils[_0x6059('0x39')](utils[_0x6059('0x29')](),queues[_0x3e438b['uniqueid']][_0x6059('0x6a')]);utils['info'](util[_0x6059('0x4')](_0x6059('0x6c'),_0x3e438b['uniqueid'],queues[_0x3e438b[_0x6059('0x6')]]['name'],queues[_0x3e438b[_0x6059('0x6')]][_0x6059('0x65')]));delete queues[_0x3e438b[_0x6059('0x6')]]['musiconholdstartAt'];}}}catch(_0x3a5701){utils[_0x6059('0x18')](util['format'](_0x6059('0x6b'),_0x3e438b[_0x6059('0x6')]),_0x3a5701);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index d2f24b1..495e613 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 _0x9605=['transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname'];(function(_0x58c52b,_0x408f63){var _0x235a37=function(_0x54ca37){while(--_0x54ca37){_0x58c52b['push'](_0x58c52b['shift']());}};_0x235a37(++_0x408f63);}(_0x9605,0x1ee));var _0x5960=function(_0x3a97e0,_0x362886){_0x3a97e0=_0x3a97e0-0x0;var _0x38396e=_0x9605[_0x3a97e0];return _0x38396e;};'use strict';var _=require('lodash');var util=require(_0x5960('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0xf61c31){var _0x397c8d;utils['info'](util[_0x5960('0x1')](_0x5960('0x2'),_0xf61c31[_0x5960('0x3')]));if(transfers['blinds'][_0xf61c31[_0x5960('0x3')]]){_0x397c8d=_0xf61c31[_0x5960('0x3')];_0xf61c31[_0x5960('0x3')]=transfers[_0x5960('0x4')][_0xf61c31['uniqueid']][_0x5960('0x5')];}if(_0xf61c31[_0x5960('0x6')]){utils['getUserByInternal'](_0xf61c31['accountcode'])[_0x5960('0x7')](function(_0x106772){if(_0x106772){_0xf61c31[_0x5960('0x8')]=_0x106772[_0x5960('0x9')];_0xf61c31[_0x5960('0xa')]=_0x106772['id'];}utils[_0x5960('0xb')](_0x5960('0xc'),_0xf61c31);});}else{utils[_0x5960('0xb')](_0x5960('0xc'),_0xf61c31);}if(_0x397c8d)delete transfers[_0x5960('0x4')][_0x397c8d];}exports[_0x5960('0xd')]=function(_0x43c5cc){try{utils[_0x5960('0xe')](util['format'](_0x5960('0xf'),_0x43c5cc['uniqueid']),_0x43c5cc);if(_0x43c5cc['uniqueid']==_0x43c5cc[_0x5960('0x10')]){utils[_0x5960('0x11')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x43c5cc[_0x5960('0x3')],_0x43c5cc[_0x5960('0x12')],_0x43c5cc['exten']));recordings[_0x43c5cc[_0x5960('0x3')]]={'uniqueid':_0x43c5cc[_0x5960('0x3')],'accountcode':_0x43c5cc[_0x5960('0x6')],'exten':_0x43c5cc[_0x5960('0x13')],'context':_0x43c5cc[_0x5960('0x12')],'channel':_0x43c5cc[_0x5960('0x14')],'monitors':[]};}}catch(_0x108f4e){utils[_0x5960('0x15')](util[_0x5960('0x1')]('[%s][recordings][newchannel]',_0x43c5cc['uniqueid']),_0x108f4e);}};exports['newstate']=function(_0x55ecb0){try{utils[_0x5960('0xe')](util['format'](_0x5960('0x16'),_0x55ecb0[_0x5960('0x3')]),_0x55ecb0);if(!_[_0x5960('0x17')](recordings[_0x55ecb0[_0x5960('0x3')]])&&_0x55ecb0[_0x5960('0x18')]==0x6){utils[_0x5960('0x11')](util[_0x5960('0x1')](_0x5960('0x19'),_0x55ecb0[_0x5960('0x3')],_0x55ecb0['context'],_0x55ecb0[_0x5960('0x14')]));}else if(!_[_0x5960('0x17')](recordings[_0x55ecb0[_0x5960('0x10')]])&&_0x55ecb0[_0x5960('0x18')]==0x6&&_0x55ecb0[_0x5960('0x12')]!=_0x5960('0x1a')){utils[_0x5960('0x11')](util[_0x5960('0x1')](_0x5960('0x1b'),_0x55ecb0[_0x5960('0x3')],_0x55ecb0[_0x5960('0x10')],_0x55ecb0[_0x5960('0x12')],_0x55ecb0[_0x5960('0x14')]));recordings[_0x55ecb0[_0x5960('0x10')]][_0x5960('0x6')]=_0x55ecb0['accountcode'];}}catch(_0x2f75b9){utils['error'](util[_0x5960('0x1')]('[%s][recordings][newstate]',_0x55ecb0[_0x5960('0x3')]),_0x2f75b9);}};exports['varset']=function(_0x536fab){try{if(!_[_0x5960('0x17')](_0x536fab['variable'])&&!_[_0x5960('0x17')](_0x536fab['variable'][_0x5960('0x1c')])){utils[_0x5960('0xe')](util[_0x5960('0x1')](_0x5960('0x1d'),_0x536fab['uniqueid']),_0x536fab);utils['info'](util['format'](_0x5960('0x1e'),_0x536fab['uniqueid'],_0x536fab[_0x5960('0x1f')],_0x536fab[_0x5960('0x20')]));if(_[_0x5960('0x21')](_0x536fab[_0x5960('0x20')],_0x5960('0x22'))){_0x536fab[_0x5960('0x20')]=_0x536fab[_0x5960('0x20')][_0x5960('0x23')](_0x5960('0x22'),_0x5960('0x24'));}if(recordings[_0x536fab[_0x5960('0x10')]]){var _0x3db041=_[_0x5960('0x25')](recordings[_0x536fab[_0x5960('0x10')]][_0x5960('0x26')],{'value':_0x536fab[_0x5960('0x20')]});if(_[_0x5960('0x17')](_0x3db041)){recordings[_0x536fab['linkedid']]['monitors'][_0x5960('0x27')]({'value':_0x536fab[_0x5960('0x20')]});}}}}catch(_0x5ad4b4){utils[_0x5960('0x15')](util[_0x5960('0x1')](_0x5960('0x1d'),_0x536fab[_0x5960('0x3')]),_0x5ad4b4);}};exports['hangup']=function(_0x21780c){try{if(!_[_0x5960('0x17')](recordings[_0x21780c[_0x5960('0x3')]])){utils['debug'](util[_0x5960('0x1')](_0x5960('0x28'),_0x21780c[_0x5960('0x3')]),_0x21780c);utils[_0x5960('0x11')](util[_0x5960('0x1')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x21780c[_0x5960('0x3')],_0x21780c[_0x5960('0x29')],_0x21780c[_0x5960('0x2a')],_0x21780c[_0x5960('0x2b')]));recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x29')]=_0x21780c[_0x5960('0x29')];recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x2a')]=_0x21780c[_0x5960('0x2a')];recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x2c')]=_0x21780c[_0x5960('0x2c')];recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x2d')]=_0x21780c[_0x5960('0x2d')];if(recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x2e')]==_0x5960('0x2f')&&recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x6')]){recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x2c')]=recordings[_0x21780c[_0x5960('0x3')]]['accountcode'];recordings[_0x21780c['uniqueid']][_0x5960('0x2d')]='';}recordings[_0x21780c[_0x5960('0x3')]][_0x5960('0x26')][_0x5960('0x30')](function(_0xf073fb){var _0x3143ba=_[_0x5960('0x31')](recordings[_0x21780c[_0x5960('0x3')]]);_0x3143ba[_0x5960('0x20')]=_0xf073fb[_0x5960('0x20')];writeDB(_0x3143ba);});delete recordings[_0x21780c[_0x5960('0x3')]];}}catch(_0xadbadc){utils[_0x5960('0x15')](util[_0x5960('0x1')](_0x5960('0x28'),_0x21780c['uniqueid']),_0xadbadc);}};exports[_0x5960('0x32')]=function(_0x4769e6){try{if(!_[_0x5960('0x17')](recordings[_0x4769e6[_0x5960('0x3')]])){utils[_0x5960('0xe')](util[_0x5960('0x1')](_0x5960('0x33'),_0x4769e6[_0x5960('0x3')]),_0x4769e6);utils[_0x5960('0x11')](util[_0x5960('0x1')](_0x5960('0x34'),_0x4769e6[_0x5960('0x3')],_0x4769e6[_0x5960('0x35')],_0x4769e6[_0x5960('0x36')]));if(_0x4769e6[_0x5960('0x35')][_0x5960('0x37')]()=='set'&&_[_0x5960('0x38')](_0x4769e6[_0x5960('0x36')][_0x5960('0x37')](),_0x5960('0x39'))){var _0x12a863=_0x4769e6[_0x5960('0x36')]['split']('=');var _0x4b27de=_0x12a863[0x0][_0x5960('0x3a')](_0x12a863[0x0][_0x5960('0x3b')]('(')+0x1,_0x12a863[0x0][_0x5960('0x3b')](')'));var _0xd78de2=_0x12a863[0x1];recordings[_0x4769e6['uniqueid']][_0x4b27de]=_0xd78de2;}}}catch(_0x4107ae){utils[_0x5960('0x15')](util['format'](_0x5960('0x33'),_0x4769e6[_0x5960('0x3')]),_0x4107ae);}};exports[_0x5960('0x3c')]=function(_0x33a975){try{if(!_[_0x5960('0x17')](recordings[_0x33a975['uniqueid']])){utils[_0x5960('0xe')](util['format'](_0x5960('0x3d'),_0x33a975[_0x5960('0x3')]),_0x33a975);utils[_0x5960('0x11')](util[_0x5960('0x1')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x33a975['uniqueid'],_0x33a975['queue']));recordings[_0x33a975[_0x5960('0x3')]][_0x5960('0x3e')]=_0x33a975[_0x5960('0x3e')];}}catch(_0x4787a3){utils[_0x5960('0x15')](util[_0x5960('0x1')](_0x5960('0x3d'),_0x33a975[_0x5960('0x3')]),_0x4787a3);}};exports['blindtransfer']=function(_0xfac10c){try{utils[_0x5960('0xe')](util['format']('[%s][recordings][blindtransfer]',_0xfac10c[_0x5960('0x3')]),_0xfac10c);utils[_0x5960('0x11')](util['format'](_0x5960('0x3f'),_0xfac10c[_0x5960('0x3')],_0xfac10c[_0x5960('0x40')],_0xfac10c[_0x5960('0x41')],_0xfac10c['transfereecalleridnum'],_0xfac10c[_0x5960('0x42')]));if(recordings[_0xfac10c['transfereruniqueid']]&&transfers[_0x5960('0x4')][_0xfac10c['transfereruniqueid']]){transfers[_0x5960('0x4')][_0xfac10c[_0x5960('0x43')]][_0x5960('0x44')]=!![];}}catch(_0x38e999){utils['error'](util[_0x5960('0x1')](_0x5960('0x45'),_0xfac10c[_0x5960('0x3')]),_0x38e999);}}; \ No newline at end of file +var _0x6763=['calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','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','util','./utils','./transfers.controller','info','uniqueid','blinds','transfereeuniqueid','accountcode','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt'];(function(_0x4ae767,_0x4140f0){var _0x571df1=function(_0x454c64){while(--_0x454c64){_0x4ae767['push'](_0x4ae767['shift']());}};_0x571df1(++_0x4140f0);}(_0x6763,0x12c));var _0x3676=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0x6763[_0x156a77];return _0x32398a;};'use strict';var _=require('lodash');var util=require(_0x3676('0x0'));var utils=require(_0x3676('0x1'));var transfers=require(_0x3676('0x2'));var recordings={};function writeDB(_0x44a6c6){var _0x157b4d;utils[_0x3676('0x3')](util['format']('[%s][recordings][writeDB]',_0x44a6c6[_0x3676('0x4')]));if(transfers['blinds'][_0x44a6c6[_0x3676('0x4')]]){_0x157b4d=_0x44a6c6[_0x3676('0x4')];_0x44a6c6[_0x3676('0x4')]=transfers[_0x3676('0x5')][_0x44a6c6['uniqueid']][_0x3676('0x6')];}if(_0x44a6c6[_0x3676('0x7')]){utils['getUserByInternal'](_0x44a6c6['accountcode'])['then'](function(_0x4e7db1){if(_0x4e7db1){_0x44a6c6['membername']=_0x4e7db1[_0x3676('0x8')];_0x44a6c6[_0x3676('0x9')]=_0x4e7db1['id'];}utils[_0x3676('0xa')](_0x3676('0xb'),_0x44a6c6);});}else{utils[_0x3676('0xa')](_0x3676('0xb'),_0x44a6c6);}if(_0x157b4d)delete transfers[_0x3676('0x5')][_0x157b4d];}exports[_0x3676('0xc')]=function(_0x47791f){try{utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0xf'),_0x47791f[_0x3676('0x4')]),_0x47791f);if(_0x47791f['uniqueid']==_0x47791f[_0x3676('0x10')]){utils[_0x3676('0x3')](util['format'](_0x3676('0x11'),_0x47791f['uniqueid'],_0x47791f[_0x3676('0x12')],_0x47791f[_0x3676('0x13')]));recordings[_0x47791f[_0x3676('0x4')]]={'uniqueid':_0x47791f['uniqueid'],'accountcode':_0x47791f[_0x3676('0x7')],'exten':_0x47791f[_0x3676('0x13')],'context':_0x47791f[_0x3676('0x12')],'channel':_0x47791f['channel'],'monitors':[]};}}catch(_0x2ef043){utils[_0x3676('0x14')](util[_0x3676('0xe')]('[%s][recordings][newchannel]',_0x47791f[_0x3676('0x4')]),_0x2ef043);}};exports[_0x3676('0x15')]=function(_0x4f49cd){try{utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x16'),_0x4f49cd['uniqueid']),_0x4f49cd);if(!_[_0x3676('0x17')](recordings[_0x4f49cd[_0x3676('0x4')]])&&_0x4f49cd['channelstate']==0x6){utils['info'](util[_0x3676('0xe')](_0x3676('0x18'),_0x4f49cd[_0x3676('0x4')],_0x4f49cd[_0x3676('0x12')],_0x4f49cd[_0x3676('0x19')]));}else if(!_[_0x3676('0x17')](recordings[_0x4f49cd[_0x3676('0x10')]])&&_0x4f49cd['channelstate']==0x6&&_0x4f49cd[_0x3676('0x12')]!='transfer'){utils[_0x3676('0x3')](util['format'](_0x3676('0x1a'),_0x4f49cd[_0x3676('0x4')],_0x4f49cd[_0x3676('0x10')],_0x4f49cd[_0x3676('0x12')],_0x4f49cd[_0x3676('0x19')]));recordings[_0x4f49cd['linkedid']][_0x3676('0x7')]=_0x4f49cd['accountcode'];}}catch(_0x1fb1b8){utils[_0x3676('0x14')](util[_0x3676('0xe')]('[%s][recordings][newstate]',_0x4f49cd[_0x3676('0x4')]),_0x1fb1b8);}};exports['varset']=function(_0x49ad09){try{if(!_['isNil'](_0x49ad09['variable'])&&!_[_0x3676('0x17')](_0x49ad09[_0x3676('0x1b')][_0x3676('0x1c')])){utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x1d'),_0x49ad09[_0x3676('0x4')]),_0x49ad09);utils[_0x3676('0x3')](util[_0x3676('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x49ad09[_0x3676('0x4')],_0x49ad09[_0x3676('0x1b')],_0x49ad09[_0x3676('0x1e')]));if(_['endsWith'](_0x49ad09[_0x3676('0x1e')],_0x3676('0x1f'))){_0x49ad09['value']=_0x49ad09[_0x3676('0x1e')][_0x3676('0x20')]('.wav49',_0x3676('0x21'));}if(recordings[_0x49ad09[_0x3676('0x10')]]){var _0x14553=_[_0x3676('0x22')](recordings[_0x49ad09[_0x3676('0x10')]][_0x3676('0x23')],{'value':_0x49ad09[_0x3676('0x1e')]});if(_[_0x3676('0x17')](_0x14553)){recordings[_0x49ad09[_0x3676('0x10')]]['monitors']['push']({'value':_0x49ad09[_0x3676('0x1e')]});}}}}catch(_0xe193f4){utils[_0x3676('0x14')](util[_0x3676('0xe')](_0x3676('0x1d'),_0x49ad09[_0x3676('0x4')]),_0xe193f4);}};exports[_0x3676('0x24')]=function(_0x3c2536){try{if(!_[_0x3676('0x17')](recordings[_0x3c2536[_0x3676('0x4')]])){utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x25'),_0x3c2536[_0x3676('0x4')]),_0x3c2536);utils[_0x3676('0x3')](util[_0x3676('0xe')](_0x3676('0x26'),_0x3c2536[_0x3676('0x4')],_0x3c2536['calleridnum'],_0x3c2536['calleridname'],_0x3c2536[_0x3676('0x27')]));recordings[_0x3c2536[_0x3676('0x4')]][_0x3676('0x28')]=_0x3c2536[_0x3676('0x28')];recordings[_0x3c2536[_0x3676('0x4')]]['calleridname']=_0x3c2536[_0x3676('0x29')];recordings[_0x3c2536['uniqueid']][_0x3676('0x2a')]=_0x3c2536[_0x3676('0x2a')];recordings[_0x3c2536['uniqueid']][_0x3676('0x2b')]=_0x3c2536[_0x3676('0x2b')];if(recordings[_0x3c2536['uniqueid']][_0x3676('0x2c')]==_0x3676('0x2d')&&recordings[_0x3c2536[_0x3676('0x4')]]['accountcode']){recordings[_0x3c2536['uniqueid']][_0x3676('0x2a')]=recordings[_0x3c2536['uniqueid']][_0x3676('0x7')];recordings[_0x3c2536[_0x3676('0x4')]][_0x3676('0x2b')]='';}recordings[_0x3c2536['uniqueid']][_0x3676('0x23')][_0x3676('0x2e')](function(_0xe3547c){var _0x1d6c6c=_[_0x3676('0x2f')](recordings[_0x3c2536[_0x3676('0x4')]]);_0x1d6c6c[_0x3676('0x1e')]=_0xe3547c['value'];writeDB(_0x1d6c6c);});delete recordings[_0x3c2536[_0x3676('0x4')]];}}catch(_0x3c08ed){utils[_0x3676('0x14')](util[_0x3676('0xe')](_0x3676('0x25'),_0x3c2536[_0x3676('0x4')]),_0x3c08ed);}};exports['newexten']=function(_0x586b4f){try{if(!_[_0x3676('0x17')](recordings[_0x586b4f[_0x3676('0x4')]])){utils['debug'](util[_0x3676('0xe')]('[%s][recordings][newexten]',_0x586b4f['uniqueid']),_0x586b4f);utils[_0x3676('0x3')](util[_0x3676('0xe')](_0x3676('0x30'),_0x586b4f[_0x3676('0x4')],_0x586b4f[_0x3676('0x31')],_0x586b4f['appdata']));if(_0x586b4f[_0x3676('0x31')][_0x3676('0x32')]()==_0x3676('0x33')&&_[_0x3676('0x34')](_0x586b4f[_0x3676('0x35')]['toLowerCase'](),_0x3676('0x36'))){var _0x1f0275=_0x586b4f[_0x3676('0x35')][_0x3676('0x37')]('=');var _0x59ce85=_0x1f0275[0x0]['substring'](_0x1f0275[0x0][_0x3676('0x38')]('(')+0x1,_0x1f0275[0x0][_0x3676('0x38')](')'));var _0xcadde1=_0x1f0275[0x1];recordings[_0x586b4f[_0x3676('0x4')]][_0x59ce85]=_0xcadde1;}}}catch(_0xa911c6){utils['error'](util[_0x3676('0xe')]('[%s][recordings][newexten]',_0x586b4f[_0x3676('0x4')]),_0xa911c6);}};exports[_0x3676('0x39')]=function(_0x8bc661){try{if(!_[_0x3676('0x17')](recordings[_0x8bc661[_0x3676('0x4')]])){utils[_0x3676('0xd')](util[_0x3676('0xe')](_0x3676('0x3a'),_0x8bc661[_0x3676('0x4')]),_0x8bc661);utils[_0x3676('0x3')](util[_0x3676('0xe')](_0x3676('0x3b'),_0x8bc661[_0x3676('0x4')],_0x8bc661['queue']));recordings[_0x8bc661[_0x3676('0x4')]][_0x3676('0x3c')]=_0x8bc661[_0x3676('0x3c')];}}catch(_0x4fa7a8){utils[_0x3676('0x14')](util[_0x3676('0xe')](_0x3676('0x3a'),_0x8bc661['uniqueid']),_0x4fa7a8);}};exports[_0x3676('0x3d')]=function(_0x4001bf){try{utils[_0x3676('0xd')](util[_0x3676('0xe')]('[%s][recordings][blindtransfer]',_0x4001bf[_0x3676('0x4')]),_0x4001bf);utils[_0x3676('0x3')](util['format'](_0x3676('0x3e'),_0x4001bf[_0x3676('0x4')],_0x4001bf[_0x3676('0x3f')],_0x4001bf['transferercalleridname'],_0x4001bf[_0x3676('0x40')],_0x4001bf[_0x3676('0x41')]));if(recordings[_0x4001bf[_0x3676('0x42')]]&&transfers[_0x3676('0x5')][_0x4001bf[_0x3676('0x42')]]){transfers[_0x3676('0x5')][_0x4001bf[_0x3676('0x42')]][_0x3676('0x43')]=!![];}}catch(_0x36d1c0){utils[_0x3676('0x14')](util[_0x3676('0xe')]('[%s][recordings][blindtransfer]',_0x4001bf[_0x3676('0x4')]),_0x36d1c0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 56a284f..b836592 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 _0x2b7a=['[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','util','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','debug'];(function(_0x43ac3e,_0x15bd8e){var _0x775793=function(_0x3b6886){while(--_0x3b6886){_0x43ac3e['push'](_0x43ac3e['shift']());}};_0x775793(++_0x15bd8e);}(_0x2b7a,0x99));var _0xa2b7=function(_0x5611a0,_0x3e20ff){_0x5611a0=_0x5611a0-0x0;var _0x463d9f=_0x2b7a[_0x5611a0];return _0x463d9f;};'use strict';var _=require(_0xa2b7('0x0'));var util=require(_0xa2b7('0x1'));var utils=require('./utils');function writeDB(_0x24a444){utils[_0xa2b7('0x2')](util['format'](_0xa2b7('0x3'),_0x24a444[_0xa2b7('0x4')]===_0xa2b7('0x5')?_0x24a444[_0xa2b7('0x6')]:_0x24a444['uniqueid'],_0x24a444['type']));utils[_0xa2b7('0x7')](_0xa2b7('0x8'),_0x24a444);}exports[_0xa2b7('0x9')]={};exports['blindtransfer']=function(_0x387735){try{utils[_0xa2b7('0xa')](util['format'](_0xa2b7('0xb'),_0x387735['uniqueid']),_0x387735);utils[_0xa2b7('0x2')](util[_0xa2b7('0xc')](_0xa2b7('0xd'),_0x387735[_0xa2b7('0xe')],_0x387735['transferercalleridnum'],_0x387735[_0xa2b7('0xf')],_0x387735[_0xa2b7('0x10')],_0x387735[_0xa2b7('0x11')]));_0x387735[_0xa2b7('0x4')]=_0xa2b7('0x12');exports[_0xa2b7('0x9')][_0x387735[_0xa2b7('0x13')]]=_0x387735;writeDB(_0x387735);}catch(_0x2b538c){utils['error'](util['format']('[%s][transfers][blindtransfer]',_0x387735[_0xa2b7('0xe')]),_0x2b538c);}};exports['attendedtransfer']=function(_0x360c24){try{utils[_0xa2b7('0xa')](util[_0xa2b7('0xc')](_0xa2b7('0x14'),_0x360c24[_0xa2b7('0x6')]),_0x360c24);utils[_0xa2b7('0x2')](util['format'](_0xa2b7('0x15'),_0x360c24['origtransfereruniqueid'],_0x360c24[_0xa2b7('0x16')],_0x360c24[_0xa2b7('0x17')],_0x360c24[_0xa2b7('0x18')],_0x360c24['transfertargetcalleridname']));_0x360c24=_[_0xa2b7('0x19')](_0x360c24,{'transfererchannel':_0x360c24[_0xa2b7('0x1a')],'transferercalleridnum':_0x360c24[_0xa2b7('0x16')],'transferercalleridname':_0x360c24[_0xa2b7('0x17')],'transfererconnectedlinenum':_0x360c24[_0xa2b7('0x1b')],'transfererconnectedlinename':_0x360c24[_0xa2b7('0x1c')],'transfereraccountcode':_0x360c24['origtransfereraccountcode'],'transferercontext':_0x360c24[_0xa2b7('0x1d')],'transfererexten':_0x360c24[_0xa2b7('0x1e')],'transfererlinkedid':_0x360c24[_0xa2b7('0x1f')],'context':_0x360c24[_0xa2b7('0x20')],'extension':_0x360c24[_0xa2b7('0x21')],'type':'attended'});if(_[_0xa2b7('0x22')](_0x360c24['transfereechannel'])){_0x360c24=_['assign'](_0x360c24,{'transfereechannel':_0x360c24[_0xa2b7('0x23')],'transfereecalleridnum':_0x360c24[_0xa2b7('0x18')],'transfereecalleridname':_0x360c24['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x360c24[_0xa2b7('0x24')],'transfereeconnectedlinename':_0x360c24['transfertargetconnectedlinename'],'transfereeaccountcode':_0x360c24[_0xa2b7('0x25')],'transfereecontext':_0x360c24['transfertargetcontext'],'transfereeexten':_0x360c24[_0xa2b7('0x26')],'transfereelinkedid':_0x360c24[_0xa2b7('0x27')]});}writeDB(_0x360c24);}catch(_0x502bbf){utils[_0xa2b7('0x28')](util['format'](_0xa2b7('0x14'),_0x360c24[_0xa2b7('0x6')]),_0x502bbf);}}; \ No newline at end of file +var _0x838a=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info'];(function(_0x578df5,_0x294587){var _0x3d11ef=function(_0x278c6e){while(--_0x278c6e){_0x578df5['push'](_0x578df5['shift']());}};_0x3d11ef(++_0x294587);}(_0x838a,0x1d5));var _0xa838=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x838a[_0x83af7f];return _0x32d85c;};'use strict';var _=require(_0xa838('0x0'));var util=require(_0xa838('0x1'));var utils=require(_0xa838('0x2'));function writeDB(_0x2c2a30){utils[_0xa838('0x3')](util[_0xa838('0x4')](_0xa838('0x5'),_0x2c2a30[_0xa838('0x6')]===_0xa838('0x7')?_0x2c2a30[_0xa838('0x8')]:_0x2c2a30['uniqueid'],_0x2c2a30[_0xa838('0x6')]));utils[_0xa838('0x9')](_0xa838('0xa'),_0x2c2a30);}exports[_0xa838('0xb')]={};exports[_0xa838('0xc')]=function(_0x51465f){try{utils[_0xa838('0xd')](util['format'](_0xa838('0xe'),_0x51465f['uniqueid']),_0x51465f);utils[_0xa838('0x3')](util[_0xa838('0x4')](_0xa838('0xf'),_0x51465f[_0xa838('0x10')],_0x51465f[_0xa838('0x11')],_0x51465f['transferercalleridname'],_0x51465f[_0xa838('0x12')],_0x51465f[_0xa838('0x13')]));_0x51465f[_0xa838('0x6')]=_0xa838('0x14');exports[_0xa838('0xb')][_0x51465f[_0xa838('0x15')]]=_0x51465f;writeDB(_0x51465f);}catch(_0x2371ac){utils[_0xa838('0x16')](util[_0xa838('0x4')](_0xa838('0xe'),_0x51465f[_0xa838('0x10')]),_0x2371ac);}};exports[_0xa838('0x17')]=function(_0xb9296e){try{utils[_0xa838('0xd')](util[_0xa838('0x4')]('[%s][transfers][attendedtransfer]',_0xb9296e['origtransfereruniqueid']),_0xb9296e);utils[_0xa838('0x3')](util[_0xa838('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xb9296e[_0xa838('0x8')],_0xb9296e[_0xa838('0x18')],_0xb9296e[_0xa838('0x19')],_0xb9296e[_0xa838('0x1a')],_0xb9296e['transfertargetcalleridname']));_0xb9296e=_[_0xa838('0x1b')](_0xb9296e,{'transfererchannel':_0xb9296e[_0xa838('0x1c')],'transferercalleridnum':_0xb9296e[_0xa838('0x18')],'transferercalleridname':_0xb9296e[_0xa838('0x19')],'transfererconnectedlinenum':_0xb9296e[_0xa838('0x1d')],'transfererconnectedlinename':_0xb9296e[_0xa838('0x1e')],'transfereraccountcode':_0xb9296e[_0xa838('0x1f')],'transferercontext':_0xb9296e[_0xa838('0x20')],'transfererexten':_0xb9296e['secondtransfererexten'],'transfererlinkedid':_0xb9296e[_0xa838('0x21')],'context':_0xb9296e[_0xa838('0x22')],'extension':_0xb9296e['origtransfererexten'],'type':_0xa838('0x7')});if(_[_0xa838('0x23')](_0xb9296e[_0xa838('0x24')])){_0xb9296e=_[_0xa838('0x1b')](_0xb9296e,{'transfereechannel':_0xb9296e['transfertargetchannel'],'transfereecalleridnum':_0xb9296e[_0xa838('0x1a')],'transfereecalleridname':_0xb9296e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb9296e[_0xa838('0x25')],'transfereeconnectedlinename':_0xb9296e[_0xa838('0x26')],'transfereeaccountcode':_0xb9296e[_0xa838('0x27')],'transfereecontext':_0xb9296e[_0xa838('0x28')],'transfereeexten':_0xb9296e['transfertargetexten'],'transfereelinkedid':_0xb9296e[_0xa838('0x29')]});}writeDB(_0xb9296e);}catch(_0x321650){utils['error'](util[_0xa838('0x4')](_0xa838('0x2a'),_0xb9296e[_0xa838('0x8')]),_0x321650);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1f2d6dc..2e4340b 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 _0x9931=['notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9931,0x1b6));var _0x1993=function(_0x57feaa,_0x348056){_0x57feaa=_0x57feaa-0x0;var _0x5f139c=_0x9931[_0x57feaa];return _0x5f139c;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1993('0x0'));var moment=require('moment');var util=require(_0x1993('0x1'));var client=jayson[_0x1993('0x2')][_0x1993('0x3')]({'port':0x2329});var logger=require(_0x1993('0x4'))(_0x1993('0x5'));exports[_0x1993('0x6')]=function(_0x31e1a5,_0x401ac4){logger[_0x1993('0x6')](_0x31e1a5,_0x401ac4?util[_0x1993('0x7')](_0x401ac4,{'showHidden':![],'depth':null}):'');};exports[_0x1993('0x8')]=function(_0x75d9c,_0x223be3){logger[_0x1993('0x8')](_0x75d9c,_0x223be3?util[_0x1993('0x7')](_0x223be3,{'showHidden':![],'depth':null}):'');};exports[_0x1993('0x9')]=function(_0x42ef8f,_0x5b6426){logger['error'](_0x42ef8f,_0x5b6426?util[_0x1993('0x7')](_0x5b6426,{'showHidden':![],'depth':null}):'');};exports[_0x1993('0xa')]=function(_0x21c2af,_0x372c71){return client[_0x1993('0xa')](_0x21c2af,{'body':_0x372c71})[_0x1993('0xb')](function(_0x1b0480){logger[_0x1993('0x8')](_0x1993('0xc'),_0x21c2af,_0x1b0480?util[_0x1993('0x7')](_0x1b0480,{'showHidden':![],'depth':null}):'');})[_0x1993('0xd')](function(_0x336f62){logger['error']('[utils][request]\x20name:%s',_0x21c2af,_0x336f62?util[_0x1993('0x7')](_0x336f62,{'showHidden':![],'depth':null}):'');});};function getUser(_0x73c803){return client[_0x1993('0xa')](_0x1993('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0x1993('0xf'),_0x1993('0x10')],'where':_0x73c803,'limit':0x1}})[_0x1993('0xb')](function(_0x22ff88){logger[_0x1993('0x8')](_0x1993('0x11'),JSON[_0x1993('0x12')](_0x73c803),_0x22ff88?util['inspect'](_0x22ff88,{'showHidden':![],'depth':null}):'');return _0x22ff88[_0x1993('0x13')]['length']?_0x22ff88[_0x1993('0x13')][0x0]:null;});}exports[_0x1993('0x14')]=function(_0x54fca4){return new BPromise(function(_0x12c873,_0x230f8a){if(_0x54fca4){return getUser({'internal':_0x54fca4})[_0x1993('0xb')](function(_0x507a6b){logger[_0x1993('0x6')](_0x1993('0x15'),_0x54fca4,_0x507a6b?'found':_0x1993('0x16'));return _0x12c873(_0x507a6b);})[_0x1993('0xd')](function(_0x404b8f){logger['error'](_0x1993('0x17'),_0x404b8f?util[_0x1993('0x7')](_0x404b8f,{'showHidden':![],'depth':null}):'');return _0x12c873(null);});}return _0x12c873(null);});};exports[_0x1993('0x18')]=function(_0x314b3c){return new BPromise(function(_0x4eca98,_0x460c03){if(_0x314b3c){return getUser({'interface':_0x314b3c})[_0x1993('0xb')](function(_0x9b2a2a){logger[_0x1993('0x6')](_0x1993('0x19'),_0x314b3c,_0x9b2a2a?_0x1993('0x1a'):_0x1993('0x16'));return _0x4eca98(_0x9b2a2a);})[_0x1993('0xd')](function(_0x473599){logger[_0x1993('0x9')](_0x1993('0x1b'),_0x473599?util['inspect'](_0x473599,{'showHidden':![],'depth':null}):'');return _0x4eca98(null);});}return _0x4eca98(null);});};exports['getUserByName']=function(_0x130ffa){return new BPromise(function(_0x2e046b,_0x55b98f){if(_0x130ffa){return getUser({'name':_0x130ffa})['then'](function(_0x317bbc){logger[_0x1993('0x6')](_0x1993('0x1c'),_0x130ffa,_0x317bbc?_0x1993('0x1a'):_0x1993('0x16'));return _0x2e046b(_0x317bbc);})[_0x1993('0xd')](function(_0x4a8b57){logger['error'](_0x1993('0x1d'),_0x4a8b57?util[_0x1993('0x7')](_0x4a8b57,{'showHidden':![],'depth':null}):'');return _0x2e046b(null);});}return _0x2e046b(null);});};exports[_0x1993('0x1e')]=function(_0x14537b){return new BPromise(function(_0x998e7e,_0x262958){if(_0x14537b){return client[_0x1993('0xa')](_0x1993('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x1993('0xf'),_0x1993('0x20'),'acw',_0x1993('0x21')],'where':{'name':_0x14537b},'limit':0x1}})[_0x1993('0xb')](function(_0x1b69e7){logger[_0x1993('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x14537b,_0x1b69e7?util['inspect'](_0x1b69e7,{'showHidden':![],'depth':null}):'');logger[_0x1993('0x6')](_0x1993('0x22'),_0x14537b,_0x1b69e7?_0x1993('0x1a'):_0x1993('0x16'));return _0x998e7e(_0x1b69e7[_0x1993('0x13')]['length']?_0x1b69e7['result'][0x0]:null);})['catch'](function(_0x2a9c6a){logger[_0x1993('0x9')]('[utils][getVoiceQueueByName]',_0x2a9c6a?util[_0x1993('0x7')](_0x2a9c6a,{'showHidden':![],'depth':null}):'');return _0x998e7e(null);});}return _0x998e7e(null);});};exports['addTime']=function(_0x523ec7,_0x588c18){return moment(_0x523ec7)['add'](_0x588c18,_0x1993('0x23'))[_0x1993('0x24')](_0x1993('0x25'));};exports[_0x1993('0x26')]=function(_0x573c40,_0x66fb8a){return moment(_0x573c40)[_0x1993('0x27')](_0x66fb8a,_0x1993('0x23'))[_0x1993('0x24')](_0x1993('0x25'));};exports[_0x1993('0x28')]=function(_0x37ad72,_0x186b14){return moment(_0x37ad72)[_0x1993('0x29')](moment(_0x186b14),_0x1993('0x23'));};exports[_0x1993('0x2a')]=function(_0xf33241,_0x188ff6){return parseInt(_0xf33241,0xa)+parseInt(_0x188ff6,0xa);};exports[_0x1993('0x2b')]=function(){return moment()[_0x1993('0x24')](_0x1993('0x25'));};exports[_0x1993('0x2c')]=function(_0x55715f,_0x47c694){if(_0x47c694){return moment(_0x55715f)['isAfter'](_0x47c694);}return!![];};exports['isBefore']=function(_0xcd427e,_0x52e010){if(_0x52e010){return moment(_0xcd427e)[_0x1993('0x2d')](_0x52e010);}else if(_0xcd427e){return!![];}return![];}; \ No newline at end of file +var _0xad37=['internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser'];(function(_0x5ae639,_0x5c7c0e){var _0xead0c9=function(_0x424bf4){while(--_0x424bf4){_0x5ae639['push'](_0x5ae639['shift']());}};_0xead0c9(++_0x5c7c0e);}(_0xad37,0xaf));var _0x7ad3=function(_0x1fcc82,_0x5a1d23){_0x1fcc82=_0x1fcc82-0x0;var _0x3df629=_0xad37[_0x1fcc82];return _0x3df629;};'use strict';var BPromise=require(_0x7ad3('0x0'));var jayson=require(_0x7ad3('0x1'));var moment=require(_0x7ad3('0x2'));var util=require(_0x7ad3('0x3'));var client=jayson[_0x7ad3('0x4')][_0x7ad3('0x5')]({'port':0x2329});var logger=require(_0x7ad3('0x6'))(_0x7ad3('0x7'));exports[_0x7ad3('0x8')]=function(_0x41a1c0,_0x51d6ae){logger[_0x7ad3('0x8')](_0x41a1c0,_0x51d6ae?util[_0x7ad3('0x9')](_0x51d6ae,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x25f5b3,_0x33cba0){logger[_0x7ad3('0xa')](_0x25f5b3,_0x33cba0?util[_0x7ad3('0x9')](_0x33cba0,{'showHidden':![],'depth':null}):'');};exports[_0x7ad3('0xb')]=function(_0x2f422e,_0x43abb7){logger[_0x7ad3('0xb')](_0x2f422e,_0x43abb7?util[_0x7ad3('0x9')](_0x43abb7,{'showHidden':![],'depth':null}):'');};exports[_0x7ad3('0xc')]=function(_0x46f05d,_0x51eaf7){return client['request'](_0x46f05d,{'body':_0x51eaf7})[_0x7ad3('0xd')](function(_0xb0a5bf){logger[_0x7ad3('0xa')](_0x7ad3('0xe'),_0x46f05d,_0xb0a5bf?util['inspect'](_0xb0a5bf,{'showHidden':![],'depth':null}):'');})[_0x7ad3('0xf')](function(_0x11aab6){logger[_0x7ad3('0xb')](_0x7ad3('0xe'),_0x46f05d,_0x11aab6?util[_0x7ad3('0x9')](_0x11aab6,{'showHidden':![],'depth':null}):'');});};function getUser(_0x258e3e){return client[_0x7ad3('0xc')](_0x7ad3('0x10'),{'options':{'raw':!![],'attributes':['id',_0x7ad3('0x11'),_0x7ad3('0x12'),_0x7ad3('0x13')],'where':_0x258e3e,'limit':0x1}})[_0x7ad3('0xd')](function(_0xc5147){logger[_0x7ad3('0xa')]('[utils][getUser]\x20where:%s',JSON[_0x7ad3('0x14')](_0x258e3e),_0xc5147?util['inspect'](_0xc5147,{'showHidden':![],'depth':null}):'');return _0xc5147[_0x7ad3('0x15')][_0x7ad3('0x16')]?_0xc5147['result'][0x0]:null;});}exports[_0x7ad3('0x17')]=function(_0xeacca0){return new BPromise(function(_0x3635f4,_0x1da7e2){if(_0xeacca0){return getUser({'internal':_0xeacca0})[_0x7ad3('0xd')](function(_0x1f3e57){logger[_0x7ad3('0x8')](_0x7ad3('0x18'),_0xeacca0,_0x1f3e57?'found':_0x7ad3('0x19'));return _0x3635f4(_0x1f3e57);})[_0x7ad3('0xf')](function(_0x5209d8){logger[_0x7ad3('0xb')](_0x7ad3('0x1a'),_0x5209d8?util[_0x7ad3('0x9')](_0x5209d8,{'showHidden':![],'depth':null}):'');return _0x3635f4(null);});}return _0x3635f4(null);});};exports[_0x7ad3('0x1b')]=function(_0x158f91){return new BPromise(function(_0x395ed2,_0x150b3){if(_0x158f91){return getUser({'interface':_0x158f91})['then'](function(_0x5bb5ec){logger['info'](_0x7ad3('0x1c'),_0x158f91,_0x5bb5ec?_0x7ad3('0x1d'):_0x7ad3('0x19'));return _0x395ed2(_0x5bb5ec);})[_0x7ad3('0xf')](function(_0x416fb8){logger['error'](_0x7ad3('0x1e'),_0x416fb8?util[_0x7ad3('0x9')](_0x416fb8,{'showHidden':![],'depth':null}):'');return _0x395ed2(null);});}return _0x395ed2(null);});};exports[_0x7ad3('0x1f')]=function(_0xdfb55f){return new BPromise(function(_0x35bdf0,_0x536b44){if(_0xdfb55f){return getUser({'name':_0xdfb55f})[_0x7ad3('0xd')](function(_0x4a9f4f){logger[_0x7ad3('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0xdfb55f,_0x4a9f4f?_0x7ad3('0x1d'):_0x7ad3('0x19'));return _0x35bdf0(_0x4a9f4f);})[_0x7ad3('0xf')](function(_0x526db4){logger[_0x7ad3('0xb')](_0x7ad3('0x20'),_0x526db4?util[_0x7ad3('0x9')](_0x526db4,{'showHidden':![],'depth':null}):'');return _0x35bdf0(null);});}return _0x35bdf0(null);});};exports[_0x7ad3('0x21')]=function(_0x268c1f){return new BPromise(function(_0x4bb0c4,_0x53d783){if(_0x268c1f){return client[_0x7ad3('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x7ad3('0x22'),_0x7ad3('0x23'),_0x7ad3('0x24')],'where':{'name':_0x268c1f},'limit':0x1}})['then'](function(_0x352347){logger[_0x7ad3('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x268c1f,_0x352347?util['inspect'](_0x352347,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x268c1f,_0x352347?_0x7ad3('0x1d'):'notfound');return _0x4bb0c4(_0x352347['result'][_0x7ad3('0x16')]?_0x352347[_0x7ad3('0x15')][0x0]:null);})['catch'](function(_0x374d36){logger[_0x7ad3('0xb')](_0x7ad3('0x25'),_0x374d36?util[_0x7ad3('0x9')](_0x374d36,{'showHidden':![],'depth':null}):'');return _0x4bb0c4(null);});}return _0x4bb0c4(null);});};exports[_0x7ad3('0x26')]=function(_0x5d8f16,_0x297e32){return moment(_0x5d8f16)[_0x7ad3('0x27')](_0x297e32,_0x7ad3('0x28'))['format'](_0x7ad3('0x29'));};exports[_0x7ad3('0x2a')]=function(_0x17071a,_0x439140){return moment(_0x17071a)['subtract'](_0x439140,_0x7ad3('0x28'))[_0x7ad3('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x33dd59,_0x116e70){return moment(_0x33dd59)[_0x7ad3('0x2c')](moment(_0x116e70),'seconds');};exports[_0x7ad3('0x2d')]=function(_0x5320b6,_0x3e40cd){return parseInt(_0x5320b6,0xa)+parseInt(_0x3e40cd,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7ad3('0x2e')]=function(_0x160ad6,_0x4ef57f){if(_0x4ef57f){return moment(_0x160ad6)['isAfter'](_0x4ef57f);}return!![];};exports[_0x7ad3('0x2f')]=function(_0x576a2e,_0x32f810){if(_0x32f810){return moment(_0x576a2e)[_0x7ad3('0x2f')](_0x32f810);}else if(_0x576a2e){return!![];}return![];}; \ No newline at end of file